From: support Date: Thu, 12 May 2022 12:20:33 +0000 (+0000) Subject: Built motion from commit 261ab583.|2.6.10 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22%7B%7Blicense.chat?a=commitdiff_plain;h=f755302bccf92217103936131d19412755fbec66;p=motion2.git Built motion from commit 261ab583.|2.6.10 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index b112a96..9d27c63 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-05-12T10:14:30.267Z", + "time": "2022-05-12T12:12:16.383Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 5fadf9d..db5ed7c 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-05-12T10:14:30.267Z", + "time": "2022-05-12T12:12:16.383Z", "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 1293da0..5105a85 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 _0xbdf3=['contactManager','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','VIRTUAL','getDataValue','STRING'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xbdf3,0x10a));var _0x3bdf=function(_0x3b2369,_0x4c68b9){_0x3b2369=_0x3b2369-0x0;var _0x5a1367=_0xbdf3[_0x3b2369];return _0x5a1367;};'use strict';var Sequelize=require('sequelize');module[_0x3bdf('0x0')]={'name':{'type':Sequelize[_0x3bdf('0x1')],'get':function(_0x49d1b9){return this[_0x3bdf('0x2')]('action');}},'action':{'type':Sequelize[_0x3bdf('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x3bdf('0x4'),'integration','motionbar',_0x3bdf('0x5'),_0x3bdf('0x6'),_0x3bdf('0x7'),_0x3bdf('0x8'),_0x3bdf('0x9')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x3bdf('0xa')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x3bdf('0xb')},'data2':{'type':Sequelize[_0x3bdf('0x3')](0x1000),'comment':_0x3bdf('0xc')},'data3':{'type':Sequelize[_0x3bdf('0x3')](0x1000),'comment':_0x3bdf('0xd')},'data4':{'type':Sequelize[_0x3bdf('0x3')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x3bdf('0xe')},'data6':{'type':Sequelize[_0x3bdf('0x3')],'comments':_0x3bdf('0xf')},'data7':{'type':Sequelize[_0x3bdf('0x10')],'comments':_0x3bdf('0x11')}}; \ No newline at end of file +var _0xd10f=['bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','STRING','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','contactManager','integration','jscripty','urlForward'];(function(_0x4ef612,_0xbc27ab){var _0x11d7cc=function(_0x430547){while(--_0x430547){_0x4ef612['push'](_0x4ef612['shift']());}};_0x11d7cc(++_0xbc27ab);}(_0xd10f,0xc9));var _0xfd10=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd10f[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0xfd10('0x0'));module[_0xfd10('0x1')]={'name':{'type':Sequelize[_0xfd10('0x2')],'get':function(_0x3d30bb){return this[_0xfd10('0x3')](_0xfd10('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xfd10('0x5'),_0xfd10('0x6'),'motionbar',_0xfd10('0x7'),_0xfd10('0x8'),'browser',_0xfd10('0x9'),_0xfd10('0xa')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xfd10('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xfd10('0xc')},'data2':{'type':Sequelize[_0xfd10('0xd')](0x1000),'comment':_0xfd10('0xe')},'data3':{'type':Sequelize[_0xfd10('0xd')](0x1000),'comment':_0xfd10('0xf')},'data4':{'type':Sequelize[_0xfd10('0xd')](0x1000),'comments':_0xfd10('0x10')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xfd10('0x11')},'data6':{'type':Sequelize['STRING'],'comments':_0xfd10('0x12')},'data7':{'type':Sequelize[_0xfd10('0x13')],'comments':_0xfd10('0x14')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 9800a10..9f0cb6a 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 _0xe5ee=['rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','body','Action','find','params','catch','eml-format'];(function(_0x1b29fe,_0x4f6969){var _0x11cc2c=function(_0x1c7882){while(--_0x1c7882){_0x1b29fe['push'](_0x1b29fe['shift']());}};_0x11cc2c(++_0x4f6969);}(_0xe5ee,0x8f));var _0xee5e=function(_0x168146,_0x411bc4){_0x168146=_0x168146-0x0;var _0x588942=_0xe5ee[_0x168146];return _0x588942;};'use strict';var emlformat=require(_0xee5e('0x0'));var rimraf=require(_0xee5e('0x1'));var zipdir=require(_0xee5e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee5e('0x3'));var moment=require(_0xee5e('0x4'));var BPromise=require(_0xee5e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xee5e('0x6'));var sox=require(_0xee5e('0x7'));var csv=require(_0xee5e('0x8'));var ejs=require(_0xee5e('0x9'));var fs=require('fs');var fs_extra=require(_0xee5e('0xa'));var _=require(_0xee5e('0xb'));var squel=require(_0xee5e('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xee5e('0xd'));var toCsv=require('to-csv');var querystring=require(_0xee5e('0xe'));var Papa=require(_0xee5e('0xf'));var Redis=require('ioredis');var authService=require(_0xee5e('0x10'));var qs=require(_0xee5e('0x11'));var as=require(_0xee5e('0x12'));var hardwareService=require(_0xee5e('0x13'));var logger=require(_0xee5e('0x14'))(_0xee5e('0x15'));var utils=require(_0xee5e('0x16'));var config=require(_0xee5e('0x17'));var licenseUtil=require(_0xee5e('0x18'));var db=require(_0xee5e('0x19'))['db'];function respondWithStatusCode(_0x59fddd,_0x47a4d6){_0x47a4d6=_0x47a4d6||0xcc;return function(_0x536fab){if(_0x536fab){return _0x59fddd['sendStatus'](_0x47a4d6);}return _0x59fddd[_0xee5e('0x1a')](_0x47a4d6)[_0xee5e('0x1b')]();};}function respondWithResult(_0x485c64,_0xdb75ee){_0xdb75ee=_0xdb75ee||0xc8;return function(_0x2b77fb){if(_0x2b77fb){return _0x485c64[_0xee5e('0x1a')](_0xdb75ee)[_0xee5e('0x1c')](_0x2b77fb);}};}function respondWithFilteredResult(_0x2884a3,_0x6b9a38){return function(_0x1a5053){if(_0x1a5053){var _0x2aa865=typeof _0x6b9a38[_0xee5e('0x1d')]===_0xee5e('0x1e')&&typeof _0x6b9a38[_0xee5e('0x1f')]===_0xee5e('0x1e');var _0x51cef6=_0x1a5053[_0xee5e('0x20')];var _0x36d4c3=_0x2aa865?0x0:_0x6b9a38[_0xee5e('0x1d')];var _0x300f23=_0x2aa865?_0x1a5053[_0xee5e('0x20')]:_0x6b9a38['offset']+_0x6b9a38[_0xee5e('0x1f')];var _0x49cba0;if(_0x300f23>=_0x51cef6){_0x300f23=_0x51cef6;_0x49cba0=0xc8;}else{_0x49cba0=0xce;}_0x2884a3[_0xee5e('0x1a')](_0x49cba0);return _0x2884a3['set'](_0xee5e('0x21'),_0x36d4c3+'-'+_0x300f23+'/'+_0x51cef6)[_0xee5e('0x1c')](_0x1a5053);}return null;};}function patchUpdates(_0x1c173d){return function(_0x213f07){try{jsonpatch['apply'](_0x213f07,_0x1c173d,!![]);}catch(_0x2e9e3a){return BPromise[_0xee5e('0x22')](_0x2e9e3a);}return _0x213f07[_0xee5e('0x23')]();};}function saveUpdates(_0x3a3d02,_0x1cfdad){return function(_0x519a10){if(_0x519a10){return _0x519a10[_0xee5e('0x24')](_0x3a3d02)[_0xee5e('0x25')](function(_0x3bdfe1){return _0x3bdfe1;});}return null;};}function removeEntity(_0x4db02e,_0x573d58){return function(_0x1a7c0c){if(_0x1a7c0c){return _0x1a7c0c[_0xee5e('0x26')]()[_0xee5e('0x25')](function(){_0x4db02e['status'](0xcc)[_0xee5e('0x1b')]();});}};}function handleEntityNotFound(_0x453b4f,_0x41f7f5){return function(_0x4bd125){if(!_0x4bd125){_0x453b4f[_0xee5e('0x27')](0x194);}return _0x4bd125;};}function handleError(_0x4df2bb,_0x4b81f4){_0x4b81f4=_0x4b81f4||0x1f4;return function(_0x514f37){logger[_0xee5e('0x28')](_0x514f37[_0xee5e('0x29')]);if(_0x514f37[_0xee5e('0x2a')]){delete _0x514f37['name'];}_0x4df2bb['status'](_0x4b81f4)['send'](_0x514f37);};}exports[_0xee5e('0x24')]=function(_0x264390,_0x597879){if(_0x264390[_0xee5e('0x2b')]['id']){delete _0x264390['body']['id'];}return db[_0xee5e('0x2c')][_0xee5e('0x2d')]({'where':{'id':_0x264390[_0xee5e('0x2e')]['id']}})[_0xee5e('0x25')](handleEntityNotFound(_0x597879,null))[_0xee5e('0x25')](saveUpdates(_0x264390[_0xee5e('0x2b')],null))['then'](respondWithResult(_0x597879,null))[_0xee5e('0x2f')](handleError(_0x597879,null));};exports[_0xee5e('0x26')]=function(_0x60246c,_0x25ea58){return db[_0xee5e('0x2c')]['find']({'where':{'id':_0x60246c['params']['id']}})[_0xee5e('0x25')](handleEntityNotFound(_0x25ea58,null))['then'](removeEntity(_0x25ea58,null))[_0xee5e('0x2f')](handleError(_0x25ea58,null));}; \ No newline at end of file +var _0xb5c6=['name','body','Action','find','params','catch','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0xb5c6,0xc6));var _0x6b5c=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb5c6[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b5c('0x0'));var zipdir=require(_0x6b5c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6b5c('0x2'));var BPromise=require(_0x6b5c('0x3'));var Mustache=require(_0x6b5c('0x4'));var util=require(_0x6b5c('0x5'));var path=require(_0x6b5c('0x6'));var sox=require(_0x6b5c('0x7'));var csv=require(_0x6b5c('0x8'));var ejs=require(_0x6b5c('0x9'));var fs=require('fs');var fs_extra=require(_0x6b5c('0xa'));var _=require(_0x6b5c('0xb'));var squel=require(_0x6b5c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6b5c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6b5c('0xe'));var Papa=require(_0x6b5c('0xf'));var Redis=require(_0x6b5c('0x10'));var authService=require(_0x6b5c('0x11'));var qs=require(_0x6b5c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b5c('0x13'));var logger=require(_0x6b5c('0x14'))('api');var utils=require(_0x6b5c('0x15'));var config=require(_0x6b5c('0x16'));var licenseUtil=require(_0x6b5c('0x17'));var db=require(_0x6b5c('0x18'))['db'];function respondWithStatusCode(_0x4dff97,_0x1c7551){_0x1c7551=_0x1c7551||0xcc;return function(_0x4661b1){if(_0x4661b1){return _0x4dff97[_0x6b5c('0x19')](_0x1c7551);}return _0x4dff97[_0x6b5c('0x1a')](_0x1c7551)[_0x6b5c('0x1b')]();};}function respondWithResult(_0x3c6a32,_0x4a5bce){_0x4a5bce=_0x4a5bce||0xc8;return function(_0x54b1d7){if(_0x54b1d7){return _0x3c6a32[_0x6b5c('0x1a')](_0x4a5bce)[_0x6b5c('0x1c')](_0x54b1d7);}};}function respondWithFilteredResult(_0x241e2f,_0x5e6f76){return function(_0xe6a008){if(_0xe6a008){var _0x24fc72=typeof _0x5e6f76[_0x6b5c('0x1d')]===_0x6b5c('0x1e')&&typeof _0x5e6f76[_0x6b5c('0x1f')]===_0x6b5c('0x1e');var _0x501651=_0xe6a008[_0x6b5c('0x20')];var _0x59d648=_0x24fc72?0x0:_0x5e6f76[_0x6b5c('0x1d')];var _0x2a1855=_0x24fc72?_0xe6a008[_0x6b5c('0x20')]:_0x5e6f76[_0x6b5c('0x1d')]+_0x5e6f76['limit'];var _0x3e8114;if(_0x2a1855>=_0x501651){_0x2a1855=_0x501651;_0x3e8114=0xc8;}else{_0x3e8114=0xce;}_0x241e2f['status'](_0x3e8114);return _0x241e2f[_0x6b5c('0x21')](_0x6b5c('0x22'),_0x59d648+'-'+_0x2a1855+'/'+_0x501651)['json'](_0xe6a008);}return null;};}function patchUpdates(_0x5cd0e6){return function(_0x24dd03){try{jsonpatch[_0x6b5c('0x23')](_0x24dd03,_0x5cd0e6,!![]);}catch(_0x39447c){return BPromise[_0x6b5c('0x24')](_0x39447c);}return _0x24dd03[_0x6b5c('0x25')]();};}function saveUpdates(_0x131435,_0x1d68b9){return function(_0x53e1bd){if(_0x53e1bd){return _0x53e1bd[_0x6b5c('0x26')](_0x131435)[_0x6b5c('0x27')](function(_0x4327a2){return _0x4327a2;});}return null;};}function removeEntity(_0x578787,_0x408775){return function(_0x451b75){if(_0x451b75){return _0x451b75[_0x6b5c('0x28')]()[_0x6b5c('0x27')](function(){_0x578787[_0x6b5c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dc242,_0x59f784){return function(_0xc5222e){if(!_0xc5222e){_0x1dc242['sendStatus'](0x194);}return _0xc5222e;};}function handleError(_0x3c1734,_0x487503){_0x487503=_0x487503||0x1f4;return function(_0x21091f){logger['error'](_0x21091f[_0x6b5c('0x29')]);if(_0x21091f[_0x6b5c('0x2a')]){delete _0x21091f[_0x6b5c('0x2a')];}_0x3c1734[_0x6b5c('0x1a')](_0x487503)['send'](_0x21091f);};}exports[_0x6b5c('0x26')]=function(_0x4824c0,_0x390bc0){if(_0x4824c0[_0x6b5c('0x2b')]['id']){delete _0x4824c0[_0x6b5c('0x2b')]['id'];}return db[_0x6b5c('0x2c')][_0x6b5c('0x2d')]({'where':{'id':_0x4824c0[_0x6b5c('0x2e')]['id']}})['then'](handleEntityNotFound(_0x390bc0,null))[_0x6b5c('0x27')](saveUpdates(_0x4824c0[_0x6b5c('0x2b')],null))[_0x6b5c('0x27')](respondWithResult(_0x390bc0,null))[_0x6b5c('0x2f')](handleError(_0x390bc0,null));};exports[_0x6b5c('0x28')]=function(_0x2bb6bd,_0x4fa986){return db[_0x6b5c('0x2c')][_0x6b5c('0x2d')]({'where':{'id':_0x2bb6bd[_0x6b5c('0x2e')]['id']}})['then'](handleEntityNotFound(_0x4fa986,null))[_0x6b5c('0x27')](removeEntity(_0x4fa986,null))[_0x6b5c('0x2f')](handleError(_0x4fa986,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 7f493c6..0bb551b 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 _0x43d8=['../../config/environment','tools_actions','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x254d23,_0x1f5c76){var _0x453efd=function(_0x20db53){while(--_0x20db53){_0x254d23['push'](_0x254d23['shift']());}};_0x453efd(++_0x1f5c76);}(_0x43d8,0x1d2));var _0x843d=function(_0x491082,_0x28f78b){_0x491082=_0x491082-0x0;var _0x5797d9=_0x43d8[_0x491082];return _0x5797d9;};'use strict';var _=require(_0x843d('0x0'));var util=require(_0x843d('0x1'));var logger=require(_0x843d('0x2'))('api');var moment=require(_0x843d('0x3'));var BPromise=require(_0x843d('0x4'));var rp=require(_0x843d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x843d('0x6'));var attributes=require('./action.attributes');module['exports']=function(_0x22847d,_0x3b18e5){return _0x22847d['define']('Action',attributes,{'tableName':_0x843d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb356=['request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x96a05,_0x1f4b8c){var _0x253e31=function(_0xca8d69){while(--_0xca8d69){_0x96a05['push'](_0x96a05['shift']());}};_0x253e31(++_0x1f4b8c);}(_0xb356,0x135));var _0x6b35=function(_0x4ab3f2,_0x449ee8){_0x4ab3f2=_0x4ab3f2-0x0;var _0x362ab7=_0xb356[_0x4ab3f2];return _0x362ab7;};'use strict';var _=require(_0x6b35('0x0'));var util=require(_0x6b35('0x1'));var logger=require(_0x6b35('0x2'))(_0x6b35('0x3'));var moment=require(_0x6b35('0x4'));var BPromise=require(_0x6b35('0x5'));var rp=require(_0x6b35('0x6'));var fs=require('fs');var path=require(_0x6b35('0x7'));var rimraf=require(_0x6b35('0x8'));var config=require(_0x6b35('0x9'));var attributes=require(_0x6b35('0xa'));module[_0x6b35('0xb')]=function(_0x49acb4,_0x5efb20){return _0x49acb4[_0x6b35('0xc')](_0x6b35('0xd'),attributes,{'tableName':_0x6b35('0xe'),'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 27b3296..9f4ac63 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x46428c,_0x20ab75){var _0x16a677=function(_0x2b0817){while(--_0x2b0817){_0x46428c['push'](_0x46428c['shift']());}};_0x16a677(++_0x20ab75);}(_0xf494,0x1c6));var _0x4f49=function(_0x5d4892,_0x5b4689){_0x5d4892=_0x5d4892-0x0;var _0x57b6ac=_0xf494[_0x5d4892];return _0x57b6ac;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file +var _0x814b=['info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x814b,0x1a2));var _0xb814=function(_0x35f969,_0x2c03bd){_0x35f969=_0x35f969-0x0;var _0x373c46=_0x814b[_0x35f969];return _0x373c46;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Action,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index a75d619..b46a776 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 _0x3b69=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy'];(function(_0x370929,_0x3cb35f){var _0xc11495=function(_0x2fb0c5){while(--_0x2fb0c5){_0x370929['push'](_0x370929['shift']());}};_0xc11495(++_0x3cb35f);}(_0x3b69,0x15f));var _0x93b6=function(_0x4ea2c6,_0x6fe21b){_0x4ea2c6=_0x4ea2c6-0x0;var _0x2bf71d=_0x3b69[_0x4ea2c6];return _0x2bf71d;};'use strict';var multer=require(_0x93b6('0x0'));var util=require(_0x93b6('0x1'));var path=require(_0x93b6('0x2'));var timeout=require(_0x93b6('0x3'));var express=require(_0x93b6('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x93b6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x93b6('0x6'));var controller=require('./action.controller');router[_0x93b6('0x7')](_0x93b6('0x8'),auth[_0x93b6('0x9')](),controller[_0x93b6('0xa')]);router[_0x93b6('0xb')](_0x93b6('0x8'),auth['isAuthenticated'](),controller[_0x93b6('0xc')]);module[_0x93b6('0xd')]=router; \ No newline at end of file +var _0x3e2f=['./action.controller','put','/:id','isAuthenticated','destroy','exports','path','express','fs-extra','../../components/auth/service'];(function(_0x1d9847,_0x1b42cc){var _0x2c64e6=function(_0x51a3d8){while(--_0x51a3d8){_0x1d9847['push'](_0x1d9847['shift']());}};_0x2c64e6(++_0x1b42cc);}(_0x3e2f,0xec));var _0xf3e2=function(_0x152449,_0x49f41d){_0x152449=_0x152449-0x0;var _0x5b58b2=_0x3e2f[_0x152449];return _0x5b58b2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf3e2('0x0'));var timeout=require('connect-timeout');var express=require(_0xf3e2('0x1'));var router=express['Router']();var fs_extra=require(_0xf3e2('0x2'));var auth=require(_0xf3e2('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf3e2('0x4'));router[_0xf3e2('0x5')](_0xf3e2('0x6'),auth[_0xf3e2('0x7')](),controller['update']);router['delete']('/:id',auth[_0xf3e2('0x7')](),controller[_0xf3e2('0x8')]);module[_0xf3e2('0x9')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index ec1a2e1..bf32bdd 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 _0x814b=['STRING','TEXT','sequelize','exports'];(function(_0x143ee8,_0x123180){var _0x5a6337=function(_0x31d42f){while(--_0x31d42f){_0x143ee8['push'](_0x143ee8['shift']());}};_0x5a6337(++_0x123180);}(_0x814b,0x1a2));var _0xb814=function(_0x1fd441,_0x2629bf){_0x1fd441=_0x1fd441-0x0;var _0x411a91=_0x814b[_0x1fd441];return _0x411a91;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'name':{'type':Sequelize[_0xb814('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb814('0x2')]},'parent':{'type':Sequelize[_0xb814('0x2')]},'table':{'type':Sequelize[_0xb814('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xb814('0x3')]}}; \ No newline at end of file +var _0x2bd8=['TEXT','sequelize','STRING'];(function(_0x2ee712,_0x5a2179){var _0x2e8783=function(_0x1857d3){while(--_0x1857d3){_0x2ee712['push'](_0x2ee712['shift']());}};_0x2e8783(++_0x5a2179);}(_0x2bd8,0x130));var _0x82bd=function(_0x4e3e94,_0x27fcfe){_0x4e3e94=_0x4e3e94-0x0;var _0x4c3a01=_0x2bd8[_0x4e3e94];return _0x4c3a01;};'use strict';var Sequelize=require(_0x82bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x82bd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x82bd('0x1')]},'parent':{'type':Sequelize[_0x82bd('0x1')]},'table':{'type':Sequelize[_0x82bd('0x1')]},'conditions':{'type':Sequelize[_0x82bd('0x2')]},'joins':{'type':Sequelize[_0x82bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 59bc928..a7c9d2e 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 _0xd3fd=['alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','join','MIN(%s)','IS\x20NULL','IS\x20EMPTY','operator','AnalyticMetric','from','output','web','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../files/reports','savename','COUNT(*)','SELECT','run','runReport','IS\x20NOT\x20EMPTY','Sequelize','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','json','offset','undefined','limit','count','status','Content-Range','apply','reject','then','destroy','get','CustomReports','end','error','stack','name','send','index','AnalyticCustomReport','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','include','findAll','params','rawAttributes','includeAll','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','rules','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC'];(function(_0x17135b,_0x15b3a7){var _0x3c07f3=function(_0x17db01){while(--_0x17db01){_0x17135b['push'](_0x17135b['shift']());}};_0x3c07f3(++_0x15b3a7);}(_0xd3fd,0xd7));var _0xdd3f=function(_0x38ed7f,_0x50c04a){_0x38ed7f=_0x38ed7f-0x0;var _0x443c08=_0xd3fd[_0x38ed7f];return _0x443c08;};'use strict';var emlformat=require(_0xdd3f('0x0'));var rimraf=require(_0xdd3f('0x1'));var zipdir=require(_0xdd3f('0x2'));var jsonpatch=require(_0xdd3f('0x3'));var rp=require(_0xdd3f('0x4'));var moment=require(_0xdd3f('0x5'));var BPromise=require(_0xdd3f('0x6'));var Mustache=require(_0xdd3f('0x7'));var util=require(_0xdd3f('0x8'));var path=require(_0xdd3f('0x9'));var sox=require(_0xdd3f('0xa'));var csv=require(_0xdd3f('0xb'));var ejs=require(_0xdd3f('0xc'));var fs=require('fs');var fs_extra=require(_0xdd3f('0xd'));var _=require(_0xdd3f('0xe'));var squel=require(_0xdd3f('0xf'));var crypto=require(_0xdd3f('0x10'));var jsforce=require(_0xdd3f('0x11'));var deskjs=require(_0xdd3f('0x12'));var toCsv=require(_0xdd3f('0xb'));var querystring=require('querystring');var Papa=require(_0xdd3f('0x13'));var Redis=require(_0xdd3f('0x14'));var authService=require(_0xdd3f('0x15'));var qs=require(_0xdd3f('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd3f('0x17'));var logger=require(_0xdd3f('0x18'))(_0xdd3f('0x19'));var utils=require(_0xdd3f('0x1a'));var config=require(_0xdd3f('0x1b'));var licenseUtil=require(_0xdd3f('0x1c'));var db=require(_0xdd3f('0x1d'))['db'];var dbH=require(_0xdd3f('0x1d'))[_0xdd3f('0x1e')];function respondWithStatusCode(_0x470b00,_0x2814b9){_0x2814b9=_0x2814b9||0xcc;return function(_0x2e6ae2){if(_0x2e6ae2){return _0x470b00[_0xdd3f('0x1f')](_0x2814b9);}return _0x470b00['status'](_0x2814b9)['end']();};}function respondWithResult(_0x325a5e,_0x75f302){_0x75f302=_0x75f302||0xc8;return function(_0x472b43){if(_0x472b43){return _0x325a5e['status'](_0x75f302)[_0xdd3f('0x20')](_0x472b43);}};}function respondWithFilteredResult(_0x45371d,_0x33c576){return function(_0x1d1ba3){if(_0x1d1ba3){var _0x57c479=typeof _0x33c576[_0xdd3f('0x21')]===_0xdd3f('0x22')&&typeof _0x33c576[_0xdd3f('0x23')]===_0xdd3f('0x22');var _0x5f509e=_0x1d1ba3[_0xdd3f('0x24')];var _0x46f1d4=_0x57c479?0x0:_0x33c576[_0xdd3f('0x21')];var _0x51de5b=_0x57c479?_0x1d1ba3[_0xdd3f('0x24')]:_0x33c576[_0xdd3f('0x21')]+_0x33c576[_0xdd3f('0x23')];var _0x4aeca8;if(_0x51de5b>=_0x5f509e){_0x51de5b=_0x5f509e;_0x4aeca8=0xc8;}else{_0x4aeca8=0xce;}_0x45371d[_0xdd3f('0x25')](_0x4aeca8);return _0x45371d['set'](_0xdd3f('0x26'),_0x46f1d4+'-'+_0x51de5b+'/'+_0x5f509e)[_0xdd3f('0x20')](_0x1d1ba3);}return null;};}function patchUpdates(_0x1a9543){return function(_0x12a609){try{jsonpatch[_0xdd3f('0x27')](_0x12a609,_0x1a9543,!![]);}catch(_0x5669a3){return BPromise[_0xdd3f('0x28')](_0x5669a3);}return _0x12a609['save']();};}function saveUpdates(_0x5e1655,_0x269441){return function(_0x56afff){if(_0x56afff){return _0x56afff['update'](_0x5e1655)[_0xdd3f('0x29')](function(_0x652c15){return _0x652c15;});}return null;};}function removeEntity(_0x36b84b,_0x1dda95){return function(_0x30d660){if(_0x30d660){return _0x30d660[_0xdd3f('0x2a')]()[_0xdd3f('0x29')](function(){var _0x4d7a24=_0x30d660[_0xdd3f('0x2b')]({'plain':!![]});var _0x32f609=_0xdd3f('0x2c');return db['UserProfileResource'][_0xdd3f('0x2a')]({'where':{'type':_0x32f609,'resourceId':_0x4d7a24['id']}})[_0xdd3f('0x29')](function(){return _0x30d660;});})[_0xdd3f('0x29')](function(){_0x36b84b['status'](0xcc)[_0xdd3f('0x2d')]();});}};}function handleEntityNotFound(_0xebe947,_0x36abfa){return function(_0x43e53b){if(!_0x43e53b){_0xebe947['sendStatus'](0x194);}return _0x43e53b;};}function handleError(_0x166503,_0x51fa38){_0x51fa38=_0x51fa38||0x1f4;return function(_0x1ee467){logger[_0xdd3f('0x2e')](_0x1ee467[_0xdd3f('0x2f')]);if(_0x1ee467[_0xdd3f('0x30')]){delete _0x1ee467[_0xdd3f('0x30')];}_0x166503[_0xdd3f('0x25')](_0x51fa38)[_0xdd3f('0x31')](_0x1ee467);};}exports[_0xdd3f('0x32')]=function(_0x4fbc82,_0x3a04e4){var _0x27e304={},_0x28698f={},_0x1c7651={'count':0x0,'rows':[]};var _0x3072d2=_['map'](db[_0xdd3f('0x33')]['rawAttributes'],function(_0x3362e5){return{'name':_0x3362e5['fieldName'],'type':_0x3362e5[_0xdd3f('0x34')][_0xdd3f('0x35')]};});_0x28698f[_0xdd3f('0x36')]=_[_0xdd3f('0x37')](_0x3072d2,'name');_0x28698f['query']=_[_0xdd3f('0x38')](_0x4fbc82[_0xdd3f('0x39')]);_0x28698f['filters']=_[_0xdd3f('0x3a')](_0x28698f['model'],_0x28698f[_0xdd3f('0x39')]);_0x27e304[_0xdd3f('0x3b')]=_[_0xdd3f('0x3a')](_0x28698f[_0xdd3f('0x36')],qs[_0xdd3f('0x3c')](_0x4fbc82[_0xdd3f('0x39')][_0xdd3f('0x3c')]));_0x27e304['attributes']=_0x27e304[_0xdd3f('0x3b')][_0xdd3f('0x3d')]?_0x27e304['attributes']:_0x28698f[_0xdd3f('0x36')];if(!_0x4fbc82[_0xdd3f('0x39')][_0xdd3f('0x3e')](_0xdd3f('0x3f'))){_0x27e304[_0xdd3f('0x23')]=qs[_0xdd3f('0x23')](_0x4fbc82[_0xdd3f('0x39')]['limit']);_0x27e304[_0xdd3f('0x21')]=qs[_0xdd3f('0x21')](_0x4fbc82[_0xdd3f('0x39')][_0xdd3f('0x21')]);}_0x27e304[_0xdd3f('0x40')]=qs[_0xdd3f('0x41')](_0x4fbc82[_0xdd3f('0x39')][_0xdd3f('0x41')]);_0x27e304['where']=qs[_0xdd3f('0x42')](_[_0xdd3f('0x43')](_0x4fbc82[_0xdd3f('0x39')],_0x28698f[_0xdd3f('0x42')]),_0x3072d2);if(_0x4fbc82[_0xdd3f('0x39')][_0xdd3f('0x44')]){_0x27e304[_0xdd3f('0x45')]=_[_0xdd3f('0x46')](_0x27e304[_0xdd3f('0x45')],{'$or':_[_0xdd3f('0x37')](_0x3072d2,function(_0x25924d){if(_0x25924d['type']!==_0xdd3f('0x47')){var _0x296c3d={};_0x296c3d[_0x25924d['name']]={'$like':'%'+_0x4fbc82[_0xdd3f('0x39')]['filter']+'%'};return _0x296c3d;}})});}_0x27e304=_[_0xdd3f('0x46')]({},_0x27e304,_0x4fbc82['options']);var _0x50115d={'where':_0x27e304[_0xdd3f('0x45')]};return db['AnalyticCustomReport'][_0xdd3f('0x24')](_0x50115d)[_0xdd3f('0x29')](function(_0xdd733f){_0x1c7651['count']=_0xdd733f;if(_0x4fbc82[_0xdd3f('0x39')]['includeAll']){_0x27e304[_0xdd3f('0x48')]=[{'all':!![]}];}return db[_0xdd3f('0x33')][_0xdd3f('0x49')](_0x27e304);})[_0xdd3f('0x29')](function(_0x49e17d){_0x1c7651['rows']=_0x49e17d;return _0x1c7651;})[_0xdd3f('0x29')](respondWithFilteredResult(_0x3a04e4,_0x27e304))['catch'](handleError(_0x3a04e4,null));};exports['show']=function(_0x317e67,_0x36df10){var _0x3b0618={'raw':![],'where':{'id':_0x317e67[_0xdd3f('0x4a')]['id']}},_0x33c3cd={};_0x33c3cd[_0xdd3f('0x36')]=_[_0xdd3f('0x38')](db['AnalyticCustomReport'][_0xdd3f('0x4b')]);_0x33c3cd[_0xdd3f('0x39')]=_['keys'](_0x317e67[_0xdd3f('0x39')]);_0x33c3cd[_0xdd3f('0x42')]=_[_0xdd3f('0x3a')](_0x33c3cd[_0xdd3f('0x36')],_0x33c3cd[_0xdd3f('0x39')]);_0x3b0618[_0xdd3f('0x3b')]=_[_0xdd3f('0x3a')](_0x33c3cd[_0xdd3f('0x36')],qs[_0xdd3f('0x3c')](_0x317e67[_0xdd3f('0x39')][_0xdd3f('0x3c')]));_0x3b0618['attributes']=_0x3b0618[_0xdd3f('0x3b')]['length']?_0x3b0618[_0xdd3f('0x3b')]:_0x33c3cd['model'];if(_0x317e67['query'][_0xdd3f('0x4c')]){_0x3b0618[_0xdd3f('0x48')]=[{'all':!![]}];}_0x3b0618=_[_0xdd3f('0x46')]({},_0x3b0618,_0x317e67[_0xdd3f('0x4d')]);return db[_0xdd3f('0x33')][_0xdd3f('0x4e')](_0x3b0618)[_0xdd3f('0x29')](handleEntityNotFound(_0x36df10,null))[_0xdd3f('0x29')](respondWithResult(_0x36df10,null))[_0xdd3f('0x4f')](handleError(_0x36df10,null));};exports[_0xdd3f('0x50')]=function(_0x1ba32f,_0x4dfbbf){return db[_0xdd3f('0x33')][_0xdd3f('0x50')](_0x1ba32f['body'],{})[_0xdd3f('0x29')](function(_0x14c69b){var _0x215cdc=_0x1ba32f[_0xdd3f('0x51')][_0xdd3f('0x2b')]({'plain':!![]});if(!_0x215cdc)throw new Error(_0xdd3f('0x52'));if(_0x215cdc['role']===_0xdd3f('0x51')){var _0x4bf5e8=_0x14c69b[_0xdd3f('0x2b')]({'plain':!![]});var _0x2fb73e=_0xdd3f('0x53');return db[_0xdd3f('0x54')][_0xdd3f('0x4e')]({'where':{'name':_0x2fb73e,'userProfileId':_0x215cdc[_0xdd3f('0x55')]},'raw':!![]})[_0xdd3f('0x29')](function(_0x14ab90){if(_0x14ab90&&_0x14ab90[_0xdd3f('0x56')]===0x0){return db['UserProfileResource'][_0xdd3f('0x50')]({'name':_0x4bf5e8['name'],'resourceId':_0x4bf5e8['id'],'type':'CustomReports','sectionId':_0x14ab90['id']},{})['then'](function(){return _0x14c69b;});}else{return _0x14c69b;}})[_0xdd3f('0x4f')](function(_0x24a01e){logger[_0xdd3f('0x2e')](_0xdd3f('0x57'),_0x24a01e);throw _0x24a01e;});}return _0x14c69b;})['then'](respondWithResult(_0x4dfbbf,0xc9))[_0xdd3f('0x4f')](handleError(_0x4dfbbf,null));};exports[_0xdd3f('0x58')]=function(_0x3c2b5a,_0x4b3064){if(_0x3c2b5a[_0xdd3f('0x59')]['id']){delete _0x3c2b5a[_0xdd3f('0x59')]['id'];}return db['AnalyticCustomReport'][_0xdd3f('0x4e')]({'where':{'id':_0x3c2b5a['params']['id']}})[_0xdd3f('0x29')](handleEntityNotFound(_0x4b3064,null))[_0xdd3f('0x29')](saveUpdates(_0x3c2b5a[_0xdd3f('0x59')],null))[_0xdd3f('0x29')](respondWithResult(_0x4b3064,null))[_0xdd3f('0x4f')](handleError(_0x4b3064,null));};exports['destroy']=function(_0x19f056,_0x5e1a7d){return db[_0xdd3f('0x33')]['find']({'where':{'id':_0x19f056[_0xdd3f('0x4a')]['id']}})[_0xdd3f('0x29')](handleEntityNotFound(_0x5e1a7d,null))[_0xdd3f('0x29')](removeEntity(_0x5e1a7d,null))['catch'](handleError(_0x5e1a7d,null));};exports[_0xdd3f('0x5a')]=function(_0x1e1bfb,_0x31df9d){var _0x52f111=0xa;var _0x30aea9=['join',_0xdd3f('0x5b'),_0xdd3f('0x5c'),_0xdd3f('0x5d')];var _0x32d8e6={'SUM':_0xdd3f('0x5e'),'COUNT':_0xdd3f('0x5f'),'COUNT DISTINCT':_0xdd3f('0x60'),'MAX':_0xdd3f('0x61'),'MIN':'MIN(%s)','AVG':_0xdd3f('0x62'),'GROUP_CONCAT':_0xdd3f('0x63'),'GROUP_CONCAT ASC':_0xdd3f('0x64'),'GROUP_CONCAT DESC':_0xdd3f('0x65')};var _0x4d25d7={'SEC_TO_TIME':_0xdd3f('0x66'),'DATE':_0xdd3f('0x67'),'HOUR':_0xdd3f('0x68'),'ROUND':_0xdd3f('0x69'),'UNIX_TIMESTAMP':_0xdd3f('0x6a')};var _0x45f4c8=function(_0x16a30a){return!_[_0xdd3f('0x6b')](['IS\x20NULL',_0xdd3f('0x6c'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x16a30a);};var _0x26a849=function(_0x1d91cc){if(!_0x1d91cc||!_0x1d91cc['rules'][_0xdd3f('0x3d')]){return'';}for(var _0x69dd5d='(',_0x3f0a94=0x0;_0x3f0a94<_0x1d91cc[_0xdd3f('0x6d')]['length'];_0x3f0a94+=0x1){_0x3f0a94>0x0&&(_0x69dd5d+='\x20'+_0x1d91cc['operator']+'\x20');_0x69dd5d+=_0x1d91cc[_0xdd3f('0x6d')][_0x3f0a94][_0xdd3f('0x6e')]?_0x26a849(_0x1d91cc[_0xdd3f('0x6d')][_0x3f0a94][_0xdd3f('0x6e')]):_0x1d91cc[_0xdd3f('0x6d')][_0x3f0a94][_0xdd3f('0x6f')]+'\x20'+_0x1d91cc['rules'][_0x3f0a94][_0xdd3f('0x70')]+(_0x45f4c8(_0x1d91cc[_0xdd3f('0x6d')][_0x3f0a94][_0xdd3f('0x70')])?'\x20'+_0x1d91cc[_0xdd3f('0x6d')][_0x3f0a94]['value']:'');}return _0x69dd5d+')';};var _0xfbd7ff={'where':{'id':_0x1e1bfb[_0xdd3f('0x4a')]['id']}},_0x2ce6f2,_0x2985e6,_0x4aae81,_0x2aadb9,_0x5228c7;_0xfbd7ff=_[_0xdd3f('0x46')]({},_0xfbd7ff,_0x1e1bfb['options']);return db[_0xdd3f('0x33')][_0xdd3f('0x4e')](_0xfbd7ff)[_0xdd3f('0x29')](function(_0x526e08){if(_0x526e08){_0x2ce6f2=_0x526e08;return _0x526e08[_0xdd3f('0x71')]();}return null;})[_0xdd3f('0x29')](function(_0x269871){if(_0x269871){if(!_0x269871[_0xdd3f('0x3d')]){throw new db['Sequelize'][(_0xdd3f('0x72'))](_0xdd3f('0x73'),0x193);}_0x2985e6=_0x269871;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xdd3f('0x29')](function(_0xcacb95){if(_0xcacb95){_0x4aae81=_[_0xdd3f('0x74')](_0xcacb95,'id');var _0xc4ebe5;var _0x36505c=squel[_0xdd3f('0x75')]();_0x36505c['from'](_0x2ce6f2[_0xdd3f('0x76')]);for(var _0x127632=0x0;_0x127632<_0x2985e6[_0xdd3f('0x3d')];_0x127632+=0x1){_0xc4ebe5=_0x2985e6[_0x127632][_0xdd3f('0x77')]?_0x4aae81[_0x2985e6[_0x127632][_0xdd3f('0x77')]][_0xdd3f('0x78')]:_0x2985e6[_0x127632][_0xdd3f('0x6f')];_0xc4ebe5=_0x2985e6[_0x127632][_0xdd3f('0x79')]?_[_0xdd3f('0x7a')](_0x32d8e6[_0x2985e6[_0x127632][_0xdd3f('0x79')]],'%s',_0xc4ebe5):_0xc4ebe5;_0xc4ebe5=_0x2985e6[_0x127632][_0xdd3f('0x7b')]?_[_0xdd3f('0x7a')](_0x4d25d7[_0x2985e6[_0x127632][_0xdd3f('0x7b')]],'%s',_0xc4ebe5):_0xc4ebe5;if(_0x2985e6[_0x127632][_0xdd3f('0x7c')]){_0x36505c[_0xdd3f('0x6e')](_0xc4ebe5);}_0x2985e6[_0x127632]['orderBy']&&_0x36505c['order'](_0xc4ebe5,_0x2985e6[_0x127632][_0xdd3f('0x7d')]===_0xdd3f('0x7e')?![]:!![]);_0x36505c[_0xdd3f('0x6f')](_0xc4ebe5,_0x2985e6[_0x127632][_0xdd3f('0x7f')]||_0xc4ebe5);}if(_0x2ce6f2[_0xdd3f('0x80')]){_0x2ce6f2[_0xdd3f('0x80')]=JSON[_0xdd3f('0x81')](_0x2ce6f2[_0xdd3f('0x80')]);for(var _0x554c12=0x0;_0x554c12<_0x2ce6f2[_0xdd3f('0x80')][_0xdd3f('0x3d')];_0x554c12+=0x1){if(_0x2ce6f2[_0xdd3f('0x80')][_0x554c12][_0xdd3f('0x34')]&&_['includes'](_0x30aea9,_0x2ce6f2[_0xdd3f('0x80')][_0x554c12][_0xdd3f('0x34')])&&_0x2ce6f2['joins'][_0x554c12][_0xdd3f('0x82')]&&_0x2ce6f2['joins'][_0x554c12][_0xdd3f('0x83')]&&_0x2ce6f2[_0xdd3f('0x80')][_0x554c12][_0xdd3f('0x84')]){_0x36505c[_0x2ce6f2['joins'][_0x554c12][_0xdd3f('0x34')]](_0x2ce6f2['joins'][_0x554c12][_0xdd3f('0x83')],null,util[_0xdd3f('0x7b')](_0xdd3f('0x85'),_0x2ce6f2['table'],_0x2ce6f2[_0xdd3f('0x80')][_0x554c12][_0xdd3f('0x82')],_0x2ce6f2['joins'][_0x554c12][_0xdd3f('0x83')],_0x2ce6f2[_0xdd3f('0x80')][_0x554c12]['foreignKey']));}}}if(_0x2ce6f2[_0xdd3f('0x86')]){_0x2ce6f2[_0xdd3f('0x86')]=JSON[_0xdd3f('0x81')](_0x2ce6f2[_0xdd3f('0x86')]);_0x36505c[_0xdd3f('0x45')](_0x26a849(_0x2ce6f2[_0xdd3f('0x86')]['group']));}_0x5228c7=_0x36505c[_0xdd3f('0x87')]();_0x36505c[_0xdd3f('0x23')](_0x52f111);_0x36505c[_0xdd3f('0x21')](0x0);logger[_0xdd3f('0x88')](_0xdd3f('0x89'),_0x36505c[_0xdd3f('0x8a')]());return dbH[_0xdd3f('0x8b')][_0xdd3f('0x39')](_0x36505c['toString'](),{'type':dbH[_0xdd3f('0x8b')][_0xdd3f('0x8c')]['SELECT']});}})[_0xdd3f('0x29')](respondWithResult(_0x31df9d,null))[_0xdd3f('0x4f')](handleError(_0x31df9d,null));};function runReport(_0x2339a9,_0x5d9eb8,_0x535c65){var _0xcd154=_0x5d9eb8[_0xdd3f('0x30')];var _0x12a96d=0xa;var _0x292be4=[_0xdd3f('0x8d'),_0xdd3f('0x5b'),_0xdd3f('0x5c'),_0xdd3f('0x5d')];var _0x5584b1={'SUM':_0xdd3f('0x5e'),'COUNT':_0xdd3f('0x5f'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xdd3f('0x61'),'MIN':_0xdd3f('0x8e'),'AVG':_0xdd3f('0x62'),'GROUP_CONCAT':_0xdd3f('0x63'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xdd3f('0x65')};var _0x4f3490={'SEC_TO_TIME':_0xdd3f('0x66'),'DATE':_0xdd3f('0x67'),'HOUR':_0xdd3f('0x68'),'ROUND':_0xdd3f('0x69'),'UNIX_TIMESTAMP':_0xdd3f('0x6a')};var _0x120df0=function(_0x2d7dc7){return!_[_0xdd3f('0x6b')]([_0xdd3f('0x8f'),_0xdd3f('0x6c'),_0xdd3f('0x90'),'IS\x20NOT\x20EMPTY'],_0x2d7dc7);};var _0x4d35cc=function(_0x5dff93){if(!_0x5dff93||!_0x5dff93[_0xdd3f('0x6d')]['length']){return'';}for(var _0x56b2da='(',_0x2d8fc5=0x0;_0x2d8fc5<_0x5dff93['rules'][_0xdd3f('0x3d')];_0x2d8fc5+=0x1){_0x2d8fc5>0x0&&(_0x56b2da+='\x20'+_0x5dff93[_0xdd3f('0x91')]+'\x20');_0x56b2da+=_0x5dff93[_0xdd3f('0x6d')][_0x2d8fc5][_0xdd3f('0x6e')]?_0x4d35cc(_0x5dff93[_0xdd3f('0x6d')][_0x2d8fc5][_0xdd3f('0x6e')]):_0x5dff93['rules'][_0x2d8fc5][_0xdd3f('0x6f')]+'\x20'+_0x5dff93[_0xdd3f('0x6d')][_0x2d8fc5][_0xdd3f('0x70')]+(_0x120df0(_0x5dff93['rules'][_0x2d8fc5][_0xdd3f('0x70')])?'\x20'+_0x5dff93[_0xdd3f('0x6d')][_0x2d8fc5]['value']:'');}return _0x56b2da+')';};var _0x43f02c={'where':{'id':_0x2339a9['id']}},_0x39c9d2,_0x3e4aa4,_0x88bfa9,_0x10bd83,_0x8700b1;_0x43f02c=_[_0xdd3f('0x46')]({},_0x43f02c,_0x535c65);return db[_0xdd3f('0x33')][_0xdd3f('0x4e')](_0x43f02c)['then'](function(_0x387fc5){if(_0x387fc5){_0x39c9d2=_0x387fc5;return _0x387fc5['getFields']();}return null;})[_0xdd3f('0x29')](function(_0x59d649){if(_0x59d649){if(!_0x59d649['length']){throw new db['Sequelize'][(_0xdd3f('0x72'))](_0xdd3f('0x73'),0x193);}_0x3e4aa4=_0x59d649;return db[_0xdd3f('0x92')][_0xdd3f('0x49')]({'raw':!![]});}return null;})[_0xdd3f('0x29')](function(_0x143a3c){if(_0x143a3c){_0x88bfa9=_[_0xdd3f('0x74')](_0x143a3c,'id');var _0x24755f;var _0x2cae15=squel[_0xdd3f('0x75')]();_0x2cae15[_0xdd3f('0x93')](_0x39c9d2[_0xdd3f('0x76')]);for(var _0x22c7e3=0x0;_0x22c7e3<_0x3e4aa4[_0xdd3f('0x3d')];_0x22c7e3+=0x1){_0x24755f=_0x3e4aa4[_0x22c7e3][_0xdd3f('0x77')]?_0x88bfa9[_0x3e4aa4[_0x22c7e3][_0xdd3f('0x77')]]['metric']:_0x3e4aa4[_0x22c7e3][_0xdd3f('0x6f')];_0x24755f=_0x3e4aa4[_0x22c7e3][_0xdd3f('0x79')]?_[_0xdd3f('0x7a')](_0x5584b1[_0x3e4aa4[_0x22c7e3][_0xdd3f('0x79')]],'%s',_0x24755f):_0x24755f;_0x24755f=_0x3e4aa4[_0x22c7e3]['format']?_[_0xdd3f('0x7a')](_0x4f3490[_0x3e4aa4[_0x22c7e3]['format']],'%s',_0x24755f):_0x24755f;if(_0x3e4aa4[_0x22c7e3]['groupBy']){_0x2cae15[_0xdd3f('0x6e')](_0x24755f);}_0x3e4aa4[_0x22c7e3]['orderBy']&&_0x2cae15[_0xdd3f('0x40')](_0x24755f,_0x3e4aa4[_0x22c7e3][_0xdd3f('0x7d')]===_0xdd3f('0x7e')?![]:!![]);_0x2cae15['field'](_0x24755f,_0x3e4aa4[_0x22c7e3]['alias']||_0x24755f);}if(_0x39c9d2[_0xdd3f('0x80')]){_0x39c9d2[_0xdd3f('0x80')]=JSON['parse'](_0x39c9d2[_0xdd3f('0x80')]);for(var _0x288282=0x0;_0x288282<_0x39c9d2[_0xdd3f('0x80')][_0xdd3f('0x3d')];_0x288282+=0x1){if(_0x39c9d2[_0xdd3f('0x80')][_0x288282][_0xdd3f('0x34')]&&_[_0xdd3f('0x6b')](_0x292be4,_0x39c9d2[_0xdd3f('0x80')][_0x288282][_0xdd3f('0x34')])&&_0x39c9d2[_0xdd3f('0x80')][_0x288282]['parentKey']&&_0x39c9d2[_0xdd3f('0x80')][_0x288282][_0xdd3f('0x83')]&&_0x39c9d2[_0xdd3f('0x80')][_0x288282][_0xdd3f('0x84')]){_0x2cae15[_0x39c9d2[_0xdd3f('0x80')][_0x288282]['type']](_0x39c9d2[_0xdd3f('0x80')][_0x288282]['foreignTable'],null,util[_0xdd3f('0x7b')](_0xdd3f('0x85'),_0x39c9d2['table'],_0x39c9d2[_0xdd3f('0x80')][_0x288282][_0xdd3f('0x82')],_0x39c9d2[_0xdd3f('0x80')][_0x288282][_0xdd3f('0x83')],_0x39c9d2['joins'][_0x288282][_0xdd3f('0x84')]));}}}if(_0x39c9d2[_0xdd3f('0x86')]){_0x39c9d2[_0xdd3f('0x86')]=JSON[_0xdd3f('0x81')](_0x39c9d2[_0xdd3f('0x86')]);_0x2cae15[_0xdd3f('0x45')](_0x4d35cc(_0x39c9d2[_0xdd3f('0x86')][_0xdd3f('0x6e')]));}_0x8700b1=_0x2cae15[_0xdd3f('0x87')]();_0x2cae15['limit'](_0x12a96d);_0x2cae15['offset'](0x0);return;}})['then'](function(){if(_0x5d9eb8[_0xdd3f('0x94')]===_0xdd3f('0x95')){return null;}var _0x44ae47=_['merge'](_0x5d9eb8,{'name':_0x5d9eb8['fullPath']||_0x5d9eb8[_0xdd3f('0x30')]||_0x39c9d2['name'],'basename':_0xcd154,'savename':util['format'](_0xdd3f('0x96'),_0x5d9eb8[_0xdd3f('0x30')]||_0x39c9d2[_0xdd3f('0x30')],require(_0xdd3f('0x97'))[_0xdd3f('0x98')](0x4),_0x5d9eb8[_0xdd3f('0x94')]||_0xdd3f('0x99')),'reportId':_0x39c9d2['id'],'reportType':_0xdd3f('0x9a')});return db[_0xdd3f('0x9b')]['create'](_0x44ae47,{'raw':!![]});})[_0xdd3f('0x29')](function(_0x38009e){if(_0x39c9d2['table']==='cdr'){_0x8700b1[_0xdd3f('0x45')](_0x39c9d2[_0xdd3f('0x76')]+_0xdd3f('0x9c'),_0x5d9eb8[_0xdd3f('0x9d')],_0x5d9eb8[_0xdd3f('0x9e')]);}else{_0x8700b1[_0xdd3f('0x45')](_0x39c9d2[_0xdd3f('0x76')]+_0xdd3f('0x9f'),_0x5d9eb8[_0xdd3f('0x9d')],_0x5d9eb8[_0xdd3f('0x9e')]);}if(_0x38009e){logger[_0xdd3f('0xa0')]('Run\x20Query:',_0x8700b1[_0xdd3f('0x8a')]());require(_0xdd3f('0xa1'))[_0xdd3f('0xa2')](path[_0xdd3f('0x8d')](__dirname,'../../components/export/',_0x38009e[_0xdd3f('0x94')]),[_0x38009e['id'],_0x8700b1['toString'](),path[_0xdd3f('0x8d')](__dirname,_0xdd3f('0xa3'),_0x38009e[_0xdd3f('0xa4')]),_0xcd154]);return _0x38009e;}else{var _0x355365=squel['select']();_0x355365[_0xdd3f('0x93')]('('+_0x8700b1[_0xdd3f('0x8a')]()+')','countTable');_0x355365[_0xdd3f('0x6f')](_0xdd3f('0xa5'),'count');_0x8700b1[_0xdd3f('0x23')](_0x5d9eb8['limit']||_0x12a96d);_0x8700b1[_0xdd3f('0x21')](_0x5d9eb8[_0xdd3f('0x21')]||0x0);return dbH['sequelize'][_0xdd3f('0x39')](_0x355365[_0xdd3f('0x8a')](),{'type':dbH[_0xdd3f('0x8b')][_0xdd3f('0x8c')][_0xdd3f('0xa6')]})[_0xdd3f('0x29')](function(_0x497998){if(!_0x497998[_0xdd3f('0x3d')]){_0x10bd83=0x0;}else{_0x10bd83=_0x497998[0x0][_0xdd3f('0x24')]||0x0;}return dbH[_0xdd3f('0x8b')]['query'](_0x8700b1[_0xdd3f('0x8a')](),{'type':dbH[_0xdd3f('0x8b')][_0xdd3f('0x8c')]['SELECT']});})['then'](function(_0x17102f){return{'rows':_0x17102f||[],'count':_0x10bd83};});}});}exports[_0xdd3f('0xa7')]=function(_0x3be18c,_0x2c4c0c){return runReport(_0x3be18c[_0xdd3f('0x4a')],_0x3be18c[_0xdd3f('0x39')],_0x3be18c[_0xdd3f('0x4d')])[_0xdd3f('0x29')](respondWithResult(_0x2c4c0c,null))[_0xdd3f('0x4f')](handleError(_0x2c4c0c,null));};exports[_0xdd3f('0xa8')]=runReport;exports[_0xdd3f('0x39')]=function(_0xcba2f6,_0xbe2654){var _0x294ba8=0xa;var _0x4047c5=[_0xdd3f('0x8d'),_0xdd3f('0x5b'),_0xdd3f('0x5c'),_0xdd3f('0x5d')];var _0x101aae={'SUM':'SUM(%s)','COUNT':_0xdd3f('0x5f'),'COUNT DISTINCT':_0xdd3f('0x60'),'MAX':_0xdd3f('0x61'),'MIN':_0xdd3f('0x8e'),'AVG':_0xdd3f('0x62'),'GROUP_CONCAT':_0xdd3f('0x63'),'GROUP_CONCAT ASC':_0xdd3f('0x64'),'GROUP_CONCAT DESC':_0xdd3f('0x65')};var _0x1ed7d1={'SEC_TO_TIME':_0xdd3f('0x66'),'DATE':_0xdd3f('0x67'),'HOUR':'HOUR(%s)','ROUND':_0xdd3f('0x69'),'UNIX_TIMESTAMP':_0xdd3f('0x6a')};var _0x4910a4=function(_0x364444){return!_[_0xdd3f('0x6b')](['IS\x20NULL',_0xdd3f('0x6c'),'IS\x20EMPTY',_0xdd3f('0xa9')],_0x364444);};var _0x2254b8=function(_0x493075){if(!_0x493075||!_0x493075['rules']['length']){return'';}for(var _0x24cbf9='(',_0x2d02cb=0x0;_0x2d02cb<_0x493075['rules'][_0xdd3f('0x3d')];_0x2d02cb+=0x1){_0x2d02cb>0x0&&(_0x24cbf9+='\x20'+_0x493075[_0xdd3f('0x91')]+'\x20');_0x24cbf9+=_0x493075[_0xdd3f('0x6d')][_0x2d02cb][_0xdd3f('0x6e')]?_0x2254b8(_0x493075[_0xdd3f('0x6d')][_0x2d02cb][_0xdd3f('0x6e')]):_0x493075[_0xdd3f('0x6d')][_0x2d02cb][_0xdd3f('0x6f')]+'\x20'+_0x493075[_0xdd3f('0x6d')][_0x2d02cb][_0xdd3f('0x70')]+(_0x4910a4(_0x493075[_0xdd3f('0x6d')][_0x2d02cb][_0xdd3f('0x70')])?'\x20'+_0x493075['rules'][_0x2d02cb]['value']:'');}return _0x24cbf9+')';};var _0x4abbad={'where':{'id':_0xcba2f6[_0xdd3f('0x4a')]['id']}},_0x256db2,_0x3cc043,_0x2d4723,_0x20e772,_0x1f5e4a;_0x4abbad=_[_0xdd3f('0x46')]({},_0x4abbad,_0xcba2f6[_0xdd3f('0x4d')]);return db[_0xdd3f('0x33')][_0xdd3f('0x4e')](_0x4abbad)[_0xdd3f('0x29')](function(_0x7257d7){if(_0x7257d7){_0x256db2=_0x7257d7;return _0x7257d7[_0xdd3f('0x71')]();}return null;})['then'](function(_0x59734f){if(_0x59734f){if(!_0x59734f[_0xdd3f('0x3d')]){throw new db[(_0xdd3f('0xaa'))]['ValidationErrorItem'](_0xdd3f('0x73'),0x193);}_0x3cc043=_0x59734f;return db[_0xdd3f('0x92')][_0xdd3f('0x49')]({'raw':!![]});}return null;})['then'](function(_0x395d7d){if(_0x395d7d){_0x2d4723=_[_0xdd3f('0x74')](_0x395d7d,'id');var _0x3b2794;var _0x5ab4b6=squel[_0xdd3f('0x75')]();_0x5ab4b6[_0xdd3f('0x93')](_0x256db2['table']);for(var _0x226c40=0x0;_0x226c40<_0x3cc043[_0xdd3f('0x3d')];_0x226c40+=0x1){_0x3b2794=_0x3cc043[_0x226c40][_0xdd3f('0x77')]?_0x2d4723[_0x3cc043[_0x226c40]['MetricId']]['metric']:_0x3cc043[_0x226c40]['field'];_0x3b2794=_0x3cc043[_0x226c40][_0xdd3f('0x79')]?_[_0xdd3f('0x7a')](_0x101aae[_0x3cc043[_0x226c40]['function']],'%s',_0x3b2794):_0x3b2794;_0x3b2794=_0x3cc043[_0x226c40][_0xdd3f('0x7b')]?_['replace'](_0x1ed7d1[_0x3cc043[_0x226c40][_0xdd3f('0x7b')]],'%s',_0x3b2794):_0x3b2794;if(_0x3cc043[_0x226c40][_0xdd3f('0x7c')]){_0x5ab4b6['group'](_0x3b2794);}_0x3cc043[_0x226c40][_0xdd3f('0x7d')]&&_0x5ab4b6[_0xdd3f('0x40')](_0x3b2794,_0x3cc043[_0x226c40][_0xdd3f('0x7d')]===_0xdd3f('0x7e')?![]:!![]);_0x5ab4b6[_0xdd3f('0x6f')](_0x3b2794,_0x3cc043[_0x226c40][_0xdd3f('0x7f')]||_0x3b2794);}if(_0x256db2['joins']){_0x256db2[_0xdd3f('0x80')]=JSON[_0xdd3f('0x81')](_0x256db2[_0xdd3f('0x80')]);for(var _0x57b644=0x0;_0x57b644<_0x256db2[_0xdd3f('0x80')][_0xdd3f('0x3d')];_0x57b644+=0x1){if(_0x256db2[_0xdd3f('0x80')][_0x57b644][_0xdd3f('0x34')]&&_[_0xdd3f('0x6b')](_0x4047c5,_0x256db2[_0xdd3f('0x80')][_0x57b644][_0xdd3f('0x34')])&&_0x256db2[_0xdd3f('0x80')][_0x57b644][_0xdd3f('0x82')]&&_0x256db2[_0xdd3f('0x80')][_0x57b644][_0xdd3f('0x83')]&&_0x256db2['joins'][_0x57b644][_0xdd3f('0x84')]){_0x5ab4b6[_0x256db2[_0xdd3f('0x80')][_0x57b644]['type']](_0x256db2[_0xdd3f('0x80')][_0x57b644]['foreignTable'],null,util[_0xdd3f('0x7b')](_0xdd3f('0x85'),_0x256db2[_0xdd3f('0x76')],_0x256db2['joins'][_0x57b644][_0xdd3f('0x82')],_0x256db2[_0xdd3f('0x80')][_0x57b644][_0xdd3f('0x83')],_0x256db2[_0xdd3f('0x80')][_0x57b644][_0xdd3f('0x84')]));}}}if(_0x256db2[_0xdd3f('0x86')]){_0x256db2[_0xdd3f('0x86')]=JSON['parse'](_0x256db2[_0xdd3f('0x86')]);_0x5ab4b6['where'](_0x2254b8(_0x256db2[_0xdd3f('0x86')][_0xdd3f('0x6e')]));}_0x1f5e4a=_0x5ab4b6[_0xdd3f('0x87')]();_0x5ab4b6[_0xdd3f('0x23')](_0x294ba8);_0x5ab4b6['offset'](0x0);logger[_0xdd3f('0x88')](_0xdd3f('0x89'),_0x5ab4b6[_0xdd3f('0x8a')]());return dbH['sequelize'][_0xdd3f('0x39')](_0x5ab4b6[_0xdd3f('0x8a')](),{'type':dbH[_0xdd3f('0x8b')][_0xdd3f('0x8c')][_0xdd3f('0xa6')]});}})[_0xdd3f('0x29')](function(){return{'sql':_0x1f5e4a[_0xdd3f('0x8a')]()};})[_0xdd3f('0x29')](respondWithResult(_0xbe2654,null))['catch'](handleError(_0xbe2654,null));}; \ No newline at end of file +var _0xc5dd=['MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','condition','value','merge','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','replace','function','format','groupBy','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','sequelize','toString','right_join','cross_join','MAX(%s)','HOUR(%s)','IS\x20NOT\x20EMPTY','select','DESC','web','fullPath','randomstring','generate','output','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','SELECT','run','runReport','ROUND(%s)','orderBy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','get','CustomReports','then','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','options','includeAll','findAll','catch','params','keys','intersection','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)'];(function(_0x3343a9,_0xfd6856){var _0x51a6ef=function(_0x336a50){while(--_0x336a50){_0x3343a9['push'](_0x3343a9['shift']());}};_0x51a6ef(++_0xfd6856);}(_0xc5dd,0x19b));var _0xdc5d=function(_0x1d746a,_0x400948){_0x1d746a=_0x1d746a-0x0;var _0x53bd57=_0xc5dd[_0x1d746a];return _0x53bd57;};'use strict';var emlformat=require(_0xdc5d('0x0'));var rimraf=require(_0xdc5d('0x1'));var zipdir=require(_0xdc5d('0x2'));var jsonpatch=require(_0xdc5d('0x3'));var rp=require(_0xdc5d('0x4'));var moment=require(_0xdc5d('0x5'));var BPromise=require(_0xdc5d('0x6'));var Mustache=require(_0xdc5d('0x7'));var util=require(_0xdc5d('0x8'));var path=require(_0xdc5d('0x9'));var sox=require('sox');var csv=require(_0xdc5d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdc5d('0xb'));var squel=require(_0xdc5d('0xc'));var crypto=require('crypto');var jsforce=require(_0xdc5d('0xd'));var deskjs=require(_0xdc5d('0xe'));var toCsv=require(_0xdc5d('0xa'));var querystring=require(_0xdc5d('0xf'));var Papa=require(_0xdc5d('0x10'));var Redis=require(_0xdc5d('0x11'));var authService=require(_0xdc5d('0x12'));var qs=require(_0xdc5d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdc5d('0x14'));var utils=require(_0xdc5d('0x15'));var config=require(_0xdc5d('0x16'));var licenseUtil=require(_0xdc5d('0x17'));var db=require(_0xdc5d('0x18'))['db'];var dbH=require(_0xdc5d('0x18'))['dbH'];function respondWithStatusCode(_0x3a6e8d,_0x28961d){_0x28961d=_0x28961d||0xcc;return function(_0x521360){if(_0x521360){return _0x3a6e8d[_0xdc5d('0x19')](_0x28961d);}return _0x3a6e8d[_0xdc5d('0x1a')](_0x28961d)[_0xdc5d('0x1b')]();};}function respondWithResult(_0x1c81e3,_0x26a0a6){_0x26a0a6=_0x26a0a6||0xc8;return function(_0x1b241a){if(_0x1b241a){return _0x1c81e3[_0xdc5d('0x1a')](_0x26a0a6)[_0xdc5d('0x1c')](_0x1b241a);}};}function respondWithFilteredResult(_0x1f71fc,_0x15cbe7){return function(_0x37bb4e){if(_0x37bb4e){var _0x24b589=typeof _0x15cbe7['offset']===_0xdc5d('0x1d')&&typeof _0x15cbe7[_0xdc5d('0x1e')]===_0xdc5d('0x1d');var _0x112053=_0x37bb4e['count'];var _0x205b81=_0x24b589?0x0:_0x15cbe7[_0xdc5d('0x1f')];var _0x267dee=_0x24b589?_0x37bb4e[_0xdc5d('0x20')]:_0x15cbe7[_0xdc5d('0x1f')]+_0x15cbe7[_0xdc5d('0x1e')];var _0x3c6ed0;if(_0x267dee>=_0x112053){_0x267dee=_0x112053;_0x3c6ed0=0xc8;}else{_0x3c6ed0=0xce;}_0x1f71fc[_0xdc5d('0x1a')](_0x3c6ed0);return _0x1f71fc[_0xdc5d('0x21')](_0xdc5d('0x22'),_0x205b81+'-'+_0x267dee+'/'+_0x112053)[_0xdc5d('0x1c')](_0x37bb4e);}return null;};}function patchUpdates(_0x11894c){return function(_0x53232e){try{jsonpatch[_0xdc5d('0x23')](_0x53232e,_0x11894c,!![]);}catch(_0x297cf7){return BPromise[_0xdc5d('0x24')](_0x297cf7);}return _0x53232e[_0xdc5d('0x25')]();};}function saveUpdates(_0x44d6e1,_0x1e9227){return function(_0x30f184){if(_0x30f184){return _0x30f184[_0xdc5d('0x26')](_0x44d6e1)['then'](function(_0x6186f3){return _0x6186f3;});}return null;};}function removeEntity(_0x59b06a,_0x1c8a37){return function(_0x1958c4){if(_0x1958c4){return _0x1958c4[_0xdc5d('0x27')]()['then'](function(){var _0x5b901e=_0x1958c4[_0xdc5d('0x28')]({'plain':!![]});var _0x132c23=_0xdc5d('0x29');return db['UserProfileResource'][_0xdc5d('0x27')]({'where':{'type':_0x132c23,'resourceId':_0x5b901e['id']}})[_0xdc5d('0x2a')](function(){return _0x1958c4;});})[_0xdc5d('0x2a')](function(){_0x59b06a[_0xdc5d('0x1a')](0xcc)[_0xdc5d('0x1b')]();});}};}function handleEntityNotFound(_0x5f1815,_0x4495c4){return function(_0x4e879a){if(!_0x4e879a){_0x5f1815[_0xdc5d('0x19')](0x194);}return _0x4e879a;};}function handleError(_0x33e472,_0x101974){_0x101974=_0x101974||0x1f4;return function(_0x3b6393){logger[_0xdc5d('0x2b')](_0x3b6393[_0xdc5d('0x2c')]);if(_0x3b6393[_0xdc5d('0x2d')]){delete _0x3b6393[_0xdc5d('0x2d')];}_0x33e472[_0xdc5d('0x1a')](_0x101974)[_0xdc5d('0x2e')](_0x3b6393);};}exports[_0xdc5d('0x2f')]=function(_0x56fefe,_0x599f1f){var _0x8431ef={},_0x4245f9={},_0x2f4ca2={'count':0x0,'rows':[]};var _0x39928a=_[_0xdc5d('0x30')](db[_0xdc5d('0x31')][_0xdc5d('0x32')],function(_0x5f1f26){return{'name':_0x5f1f26[_0xdc5d('0x33')],'type':_0x5f1f26[_0xdc5d('0x34')][_0xdc5d('0x35')]};});_0x4245f9[_0xdc5d('0x36')]=_[_0xdc5d('0x30')](_0x39928a,_0xdc5d('0x2d'));_0x4245f9[_0xdc5d('0x37')]=_['keys'](_0x56fefe[_0xdc5d('0x37')]);_0x4245f9['filters']=_['intersection'](_0x4245f9[_0xdc5d('0x36')],_0x4245f9['query']);_0x8431ef[_0xdc5d('0x38')]=_['intersection'](_0x4245f9[_0xdc5d('0x36')],qs[_0xdc5d('0x39')](_0x56fefe[_0xdc5d('0x37')][_0xdc5d('0x39')]));_0x8431ef[_0xdc5d('0x38')]=_0x8431ef[_0xdc5d('0x38')][_0xdc5d('0x3a')]?_0x8431ef[_0xdc5d('0x38')]:_0x4245f9['model'];if(!_0x56fefe[_0xdc5d('0x37')][_0xdc5d('0x3b')](_0xdc5d('0x3c'))){_0x8431ef['limit']=qs[_0xdc5d('0x1e')](_0x56fefe[_0xdc5d('0x37')]['limit']);_0x8431ef[_0xdc5d('0x1f')]=qs[_0xdc5d('0x1f')](_0x56fefe[_0xdc5d('0x37')][_0xdc5d('0x1f')]);}_0x8431ef[_0xdc5d('0x3d')]=qs['sort'](_0x56fefe[_0xdc5d('0x37')][_0xdc5d('0x3e')]);_0x8431ef[_0xdc5d('0x3f')]=qs[_0xdc5d('0x40')](_[_0xdc5d('0x41')](_0x56fefe[_0xdc5d('0x37')],_0x4245f9[_0xdc5d('0x40')]),_0x39928a);if(_0x56fefe[_0xdc5d('0x37')][_0xdc5d('0x42')]){_0x8431ef[_0xdc5d('0x3f')]=_['merge'](_0x8431ef[_0xdc5d('0x3f')],{'$or':_[_0xdc5d('0x30')](_0x39928a,function(_0x486e51){if(_0x486e51[_0xdc5d('0x34')]!=='VIRTUAL'){var _0x26e474={};_0x26e474[_0x486e51[_0xdc5d('0x2d')]]={'$like':'%'+_0x56fefe[_0xdc5d('0x37')][_0xdc5d('0x42')]+'%'};return _0x26e474;}})});}_0x8431ef=_['merge']({},_0x8431ef,_0x56fefe[_0xdc5d('0x43')]);var _0x2db75f={'where':_0x8431ef['where']};return db[_0xdc5d('0x31')][_0xdc5d('0x20')](_0x2db75f)[_0xdc5d('0x2a')](function(_0x2e95ad){_0x2f4ca2[_0xdc5d('0x20')]=_0x2e95ad;if(_0x56fefe[_0xdc5d('0x37')][_0xdc5d('0x44')]){_0x8431ef['include']=[{'all':!![]}];}return db[_0xdc5d('0x31')][_0xdc5d('0x45')](_0x8431ef);})[_0xdc5d('0x2a')](function(_0x1b4239){_0x2f4ca2['rows']=_0x1b4239;return _0x2f4ca2;})['then'](respondWithFilteredResult(_0x599f1f,_0x8431ef))[_0xdc5d('0x46')](handleError(_0x599f1f,null));};exports['show']=function(_0x49cb9f,_0x7a3c28){var _0x1c3f5a={'raw':![],'where':{'id':_0x49cb9f[_0xdc5d('0x47')]['id']}},_0x29f77a={};_0x29f77a[_0xdc5d('0x36')]=_[_0xdc5d('0x48')](db['AnalyticCustomReport'][_0xdc5d('0x32')]);_0x29f77a[_0xdc5d('0x37')]=_[_0xdc5d('0x48')](_0x49cb9f[_0xdc5d('0x37')]);_0x29f77a[_0xdc5d('0x40')]=_[_0xdc5d('0x49')](_0x29f77a[_0xdc5d('0x36')],_0x29f77a[_0xdc5d('0x37')]);_0x1c3f5a[_0xdc5d('0x38')]=_[_0xdc5d('0x49')](_0x29f77a[_0xdc5d('0x36')],qs[_0xdc5d('0x39')](_0x49cb9f['query'][_0xdc5d('0x39')]));_0x1c3f5a[_0xdc5d('0x38')]=_0x1c3f5a[_0xdc5d('0x38')][_0xdc5d('0x3a')]?_0x1c3f5a[_0xdc5d('0x38')]:_0x29f77a['model'];if(_0x49cb9f[_0xdc5d('0x37')][_0xdc5d('0x44')]){_0x1c3f5a[_0xdc5d('0x4a')]=[{'all':!![]}];}_0x1c3f5a=_['merge']({},_0x1c3f5a,_0x49cb9f['options']);return db[_0xdc5d('0x31')]['find'](_0x1c3f5a)[_0xdc5d('0x2a')](handleEntityNotFound(_0x7a3c28,null))[_0xdc5d('0x2a')](respondWithResult(_0x7a3c28,null))[_0xdc5d('0x46')](handleError(_0x7a3c28,null));};exports['create']=function(_0xa6a95f,_0x43db3e){return db[_0xdc5d('0x31')][_0xdc5d('0x4b')](_0xa6a95f[_0xdc5d('0x4c')],{})[_0xdc5d('0x2a')](function(_0x46cebf){var _0x5dbd7d=_0xa6a95f['user']['get']({'plain':!![]});if(!_0x5dbd7d)throw new Error(_0xdc5d('0x4d'));if(_0x5dbd7d[_0xdc5d('0x4e')]===_0xdc5d('0x4f')){var _0x3487ca=_0x46cebf['get']({'plain':!![]});var _0xb14984='Reports';return db[_0xdc5d('0x50')][_0xdc5d('0x51')]({'where':{'name':_0xb14984,'userProfileId':_0x5dbd7d['userProfileId']},'raw':!![]})[_0xdc5d('0x2a')](function(_0x25c0ac){if(_0x25c0ac&&_0x25c0ac[_0xdc5d('0x52')]===0x0){return db[_0xdc5d('0x53')][_0xdc5d('0x4b')]({'name':_0x3487ca['name'],'resourceId':_0x3487ca['id'],'type':'CustomReports','sectionId':_0x25c0ac['id']},{})['then'](function(){return _0x46cebf;});}else{return _0x46cebf;}})[_0xdc5d('0x46')](function(_0x403b6a){logger[_0xdc5d('0x2b')](_0xdc5d('0x54'),_0x403b6a);throw _0x403b6a;});}return _0x46cebf;})['then'](respondWithResult(_0x43db3e,0xc9))['catch'](handleError(_0x43db3e,null));};exports[_0xdc5d('0x26')]=function(_0xba617,_0x2755a1){if(_0xba617[_0xdc5d('0x4c')]['id']){delete _0xba617[_0xdc5d('0x4c')]['id'];}return db['AnalyticCustomReport'][_0xdc5d('0x51')]({'where':{'id':_0xba617[_0xdc5d('0x47')]['id']}})[_0xdc5d('0x2a')](handleEntityNotFound(_0x2755a1,null))[_0xdc5d('0x2a')](saveUpdates(_0xba617['body'],null))[_0xdc5d('0x2a')](respondWithResult(_0x2755a1,null))['catch'](handleError(_0x2755a1,null));};exports[_0xdc5d('0x27')]=function(_0x551364,_0x52a3da){return db[_0xdc5d('0x31')]['find']({'where':{'id':_0x551364[_0xdc5d('0x47')]['id']}})[_0xdc5d('0x2a')](handleEntityNotFound(_0x52a3da,null))['then'](removeEntity(_0x52a3da,null))[_0xdc5d('0x46')](handleError(_0x52a3da,null));};exports['preview']=function(_0x267003,_0xc12464){var _0x5bd6e9=0xa;var _0x43a552=[_0xdc5d('0x55'),_0xdc5d('0x56'),'right_join','cross_join'];var _0x56a385={'SUM':_0xdc5d('0x57'),'COUNT':_0xdc5d('0x58'),'COUNT DISTINCT':_0xdc5d('0x59'),'MAX':'MAX(%s)','MIN':_0xdc5d('0x5a'),'AVG':_0xdc5d('0x5b'),'GROUP_CONCAT':_0xdc5d('0x5c'),'GROUP_CONCAT ASC':_0xdc5d('0x5d'),'GROUP_CONCAT DESC':_0xdc5d('0x5e')};var _0x291dea={'SEC_TO_TIME':_0xdc5d('0x5f'),'DATE':_0xdc5d('0x60'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xdc5d('0x61')};var _0x5b06eb=function(_0x91c0a7){return!_[_0xdc5d('0x62')]([_0xdc5d('0x63'),_0xdc5d('0x64'),_0xdc5d('0x65'),'IS\x20NOT\x20EMPTY'],_0x91c0a7);};var _0x168e1a=function(_0x232788){if(!_0x232788||!_0x232788[_0xdc5d('0x66')][_0xdc5d('0x3a')]){return'';}for(var _0x40b816='(',_0x1934d2=0x0;_0x1934d2<_0x232788[_0xdc5d('0x66')][_0xdc5d('0x3a')];_0x1934d2+=0x1){_0x1934d2>0x0&&(_0x40b816+='\x20'+_0x232788['operator']+'\x20');_0x40b816+=_0x232788[_0xdc5d('0x66')][_0x1934d2][_0xdc5d('0x67')]?_0x168e1a(_0x232788[_0xdc5d('0x66')][_0x1934d2][_0xdc5d('0x67')]):_0x232788['rules'][_0x1934d2][_0xdc5d('0x68')]+'\x20'+_0x232788[_0xdc5d('0x66')][_0x1934d2]['condition']+(_0x5b06eb(_0x232788[_0xdc5d('0x66')][_0x1934d2][_0xdc5d('0x69')])?'\x20'+_0x232788['rules'][_0x1934d2][_0xdc5d('0x6a')]:'');}return _0x40b816+')';};var _0x9740d2={'where':{'id':_0x267003[_0xdc5d('0x47')]['id']}},_0x3d4d89,_0x326129,_0x5530f2,_0x3a8201,_0x31d318;_0x9740d2=_[_0xdc5d('0x6b')]({},_0x9740d2,_0x267003[_0xdc5d('0x43')]);return db['AnalyticCustomReport'][_0xdc5d('0x51')](_0x9740d2)[_0xdc5d('0x2a')](function(_0xeec8a5){if(_0xeec8a5){_0x3d4d89=_0xeec8a5;return _0xeec8a5[_0xdc5d('0x6c')]();}return null;})[_0xdc5d('0x2a')](function(_0x283fd0){if(_0x283fd0){if(!_0x283fd0['length']){throw new db[(_0xdc5d('0x6d'))][(_0xdc5d('0x6e'))](_0xdc5d('0x6f'),0x193);}_0x326129=_0x283fd0;return db[_0xdc5d('0x70')][_0xdc5d('0x45')]({'raw':!![]});}return null;})[_0xdc5d('0x2a')](function(_0xe8d135){if(_0xe8d135){_0x5530f2=_[_0xdc5d('0x71')](_0xe8d135,'id');var _0x15bfb6;var _0x4ae00e=squel['select']();_0x4ae00e[_0xdc5d('0x72')](_0x3d4d89[_0xdc5d('0x73')]);for(var _0x449d9d=0x0;_0x449d9d<_0x326129['length'];_0x449d9d+=0x1){_0x15bfb6=_0x326129[_0x449d9d]['MetricId']?_0x5530f2[_0x326129[_0x449d9d][_0xdc5d('0x74')]][_0xdc5d('0x75')]:_0x326129[_0x449d9d][_0xdc5d('0x68')];_0x15bfb6=_0x326129[_0x449d9d]['function']?_[_0xdc5d('0x76')](_0x56a385[_0x326129[_0x449d9d][_0xdc5d('0x77')]],'%s',_0x15bfb6):_0x15bfb6;_0x15bfb6=_0x326129[_0x449d9d][_0xdc5d('0x78')]?_['replace'](_0x291dea[_0x326129[_0x449d9d][_0xdc5d('0x78')]],'%s',_0x15bfb6):_0x15bfb6;if(_0x326129[_0x449d9d][_0xdc5d('0x79')]){_0x4ae00e['group'](_0x15bfb6);}_0x326129[_0x449d9d]['orderBy']&&_0x4ae00e[_0xdc5d('0x3d')](_0x15bfb6,_0x326129[_0x449d9d]['orderBy']==='DESC'?![]:!![]);_0x4ae00e[_0xdc5d('0x68')](_0x15bfb6,_0x326129[_0x449d9d][_0xdc5d('0x7a')]||_0x15bfb6);}if(_0x3d4d89[_0xdc5d('0x7b')]){_0x3d4d89[_0xdc5d('0x7b')]=JSON[_0xdc5d('0x7c')](_0x3d4d89[_0xdc5d('0x7b')]);for(var _0x558bdc=0x0;_0x558bdc<_0x3d4d89[_0xdc5d('0x7b')][_0xdc5d('0x3a')];_0x558bdc+=0x1){if(_0x3d4d89[_0xdc5d('0x7b')][_0x558bdc]['type']&&_['includes'](_0x43a552,_0x3d4d89[_0xdc5d('0x7b')][_0x558bdc][_0xdc5d('0x34')])&&_0x3d4d89['joins'][_0x558bdc][_0xdc5d('0x7d')]&&_0x3d4d89[_0xdc5d('0x7b')][_0x558bdc][_0xdc5d('0x7e')]&&_0x3d4d89[_0xdc5d('0x7b')][_0x558bdc][_0xdc5d('0x7f')]){_0x4ae00e[_0x3d4d89[_0xdc5d('0x7b')][_0x558bdc]['type']](_0x3d4d89[_0xdc5d('0x7b')][_0x558bdc][_0xdc5d('0x7e')],null,util[_0xdc5d('0x78')](_0xdc5d('0x80'),_0x3d4d89[_0xdc5d('0x73')],_0x3d4d89[_0xdc5d('0x7b')][_0x558bdc][_0xdc5d('0x7d')],_0x3d4d89[_0xdc5d('0x7b')][_0x558bdc][_0xdc5d('0x7e')],_0x3d4d89[_0xdc5d('0x7b')][_0x558bdc][_0xdc5d('0x7f')]));}}}if(_0x3d4d89[_0xdc5d('0x81')]){_0x3d4d89[_0xdc5d('0x81')]=JSON[_0xdc5d('0x7c')](_0x3d4d89[_0xdc5d('0x81')]);_0x4ae00e[_0xdc5d('0x3f')](_0x168e1a(_0x3d4d89['conditions'][_0xdc5d('0x67')]));}_0x31d318=_0x4ae00e[_0xdc5d('0x82')]();_0x4ae00e['limit'](_0x5bd6e9);_0x4ae00e[_0xdc5d('0x1f')](0x0);logger[_0xdc5d('0x83')](_0xdc5d('0x84'),_0x4ae00e['toString']());return dbH[_0xdc5d('0x85')][_0xdc5d('0x37')](_0x4ae00e[_0xdc5d('0x86')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});}})['then'](respondWithResult(_0xc12464,null))['catch'](handleError(_0xc12464,null));};function runReport(_0x51c6d0,_0x3e7614,_0xd34ba8){var _0x4ce840=_0x3e7614[_0xdc5d('0x2d')];var _0x5a4cd9=0xa;var _0x1ff1f=['join',_0xdc5d('0x56'),_0xdc5d('0x87'),_0xdc5d('0x88')];var _0x5f556d={'SUM':_0xdc5d('0x57'),'COUNT':_0xdc5d('0x58'),'COUNT DISTINCT':_0xdc5d('0x59'),'MAX':_0xdc5d('0x89'),'MIN':_0xdc5d('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xdc5d('0x5e')};var _0x4fe8b6={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xdc5d('0x8a'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xdc5d('0x61')};var _0x5d9c86=function(_0xcb98ea){return!_[_0xdc5d('0x62')]([_0xdc5d('0x63'),_0xdc5d('0x64'),_0xdc5d('0x65'),_0xdc5d('0x8b')],_0xcb98ea);};var _0x32f8af=function(_0x44cb9b){if(!_0x44cb9b||!_0x44cb9b['rules']['length']){return'';}for(var _0x286bf4='(',_0x312b66=0x0;_0x312b66<_0x44cb9b[_0xdc5d('0x66')][_0xdc5d('0x3a')];_0x312b66+=0x1){_0x312b66>0x0&&(_0x286bf4+='\x20'+_0x44cb9b['operator']+'\x20');_0x286bf4+=_0x44cb9b[_0xdc5d('0x66')][_0x312b66][_0xdc5d('0x67')]?_0x32f8af(_0x44cb9b[_0xdc5d('0x66')][_0x312b66][_0xdc5d('0x67')]):_0x44cb9b[_0xdc5d('0x66')][_0x312b66]['field']+'\x20'+_0x44cb9b[_0xdc5d('0x66')][_0x312b66][_0xdc5d('0x69')]+(_0x5d9c86(_0x44cb9b[_0xdc5d('0x66')][_0x312b66][_0xdc5d('0x69')])?'\x20'+_0x44cb9b[_0xdc5d('0x66')][_0x312b66]['value']:'');}return _0x286bf4+')';};var _0x4eb18b={'where':{'id':_0x51c6d0['id']}},_0x2465f0,_0x3792e0,_0x5586fc,_0x22b9b6,_0x34cc04;_0x4eb18b=_[_0xdc5d('0x6b')]({},_0x4eb18b,_0xd34ba8);return db[_0xdc5d('0x31')][_0xdc5d('0x51')](_0x4eb18b)[_0xdc5d('0x2a')](function(_0x33d85f){if(_0x33d85f){_0x2465f0=_0x33d85f;return _0x33d85f[_0xdc5d('0x6c')]();}return null;})[_0xdc5d('0x2a')](function(_0x198f46){if(_0x198f46){if(!_0x198f46['length']){throw new db['Sequelize'][(_0xdc5d('0x6e'))](_0xdc5d('0x6f'),0x193);}_0x3792e0=_0x198f46;return db[_0xdc5d('0x70')][_0xdc5d('0x45')]({'raw':!![]});}return null;})['then'](function(_0x2a844f){if(_0x2a844f){_0x5586fc=_[_0xdc5d('0x71')](_0x2a844f,'id');var _0x23c24a;var _0x3d666d=squel[_0xdc5d('0x8c')]();_0x3d666d[_0xdc5d('0x72')](_0x2465f0[_0xdc5d('0x73')]);for(var _0x2bb478=0x0;_0x2bb478<_0x3792e0['length'];_0x2bb478+=0x1){_0x23c24a=_0x3792e0[_0x2bb478][_0xdc5d('0x74')]?_0x5586fc[_0x3792e0[_0x2bb478][_0xdc5d('0x74')]][_0xdc5d('0x75')]:_0x3792e0[_0x2bb478][_0xdc5d('0x68')];_0x23c24a=_0x3792e0[_0x2bb478][_0xdc5d('0x77')]?_[_0xdc5d('0x76')](_0x5f556d[_0x3792e0[_0x2bb478]['function']],'%s',_0x23c24a):_0x23c24a;_0x23c24a=_0x3792e0[_0x2bb478][_0xdc5d('0x78')]?_['replace'](_0x4fe8b6[_0x3792e0[_0x2bb478]['format']],'%s',_0x23c24a):_0x23c24a;if(_0x3792e0[_0x2bb478][_0xdc5d('0x79')]){_0x3d666d['group'](_0x23c24a);}_0x3792e0[_0x2bb478]['orderBy']&&_0x3d666d[_0xdc5d('0x3d')](_0x23c24a,_0x3792e0[_0x2bb478]['orderBy']===_0xdc5d('0x8d')?![]:!![]);_0x3d666d[_0xdc5d('0x68')](_0x23c24a,_0x3792e0[_0x2bb478][_0xdc5d('0x7a')]||_0x23c24a);}if(_0x2465f0[_0xdc5d('0x7b')]){_0x2465f0[_0xdc5d('0x7b')]=JSON['parse'](_0x2465f0[_0xdc5d('0x7b')]);for(var _0x5511c9=0x0;_0x5511c9<_0x2465f0[_0xdc5d('0x7b')]['length'];_0x5511c9+=0x1){if(_0x2465f0[_0xdc5d('0x7b')][_0x5511c9][_0xdc5d('0x34')]&&_['includes'](_0x1ff1f,_0x2465f0[_0xdc5d('0x7b')][_0x5511c9][_0xdc5d('0x34')])&&_0x2465f0[_0xdc5d('0x7b')][_0x5511c9]['parentKey']&&_0x2465f0[_0xdc5d('0x7b')][_0x5511c9]['foreignTable']&&_0x2465f0[_0xdc5d('0x7b')][_0x5511c9][_0xdc5d('0x7f')]){_0x3d666d[_0x2465f0[_0xdc5d('0x7b')][_0x5511c9][_0xdc5d('0x34')]](_0x2465f0[_0xdc5d('0x7b')][_0x5511c9]['foreignTable'],null,util[_0xdc5d('0x78')](_0xdc5d('0x80'),_0x2465f0['table'],_0x2465f0[_0xdc5d('0x7b')][_0x5511c9][_0xdc5d('0x7d')],_0x2465f0[_0xdc5d('0x7b')][_0x5511c9][_0xdc5d('0x7e')],_0x2465f0[_0xdc5d('0x7b')][_0x5511c9][_0xdc5d('0x7f')]));}}}if(_0x2465f0[_0xdc5d('0x81')]){_0x2465f0['conditions']=JSON['parse'](_0x2465f0[_0xdc5d('0x81')]);_0x3d666d[_0xdc5d('0x3f')](_0x32f8af(_0x2465f0[_0xdc5d('0x81')][_0xdc5d('0x67')]));}_0x34cc04=_0x3d666d[_0xdc5d('0x82')]();_0x3d666d[_0xdc5d('0x1e')](_0x5a4cd9);_0x3d666d[_0xdc5d('0x1f')](0x0);return;}})['then'](function(){if(_0x3e7614['output']===_0xdc5d('0x8e')){return null;}var _0x2d3c84=_[_0xdc5d('0x6b')](_0x3e7614,{'name':_0x3e7614[_0xdc5d('0x8f')]||_0x3e7614[_0xdc5d('0x2d')]||_0x2465f0['name'],'basename':_0x4ce840,'savename':util[_0xdc5d('0x78')]('%s-%s.%s',_0x3e7614[_0xdc5d('0x2d')]||_0x2465f0[_0xdc5d('0x2d')],require(_0xdc5d('0x90'))[_0xdc5d('0x91')](0x4),_0x3e7614[_0xdc5d('0x92')]||_0xdc5d('0x93')),'reportId':_0x2465f0['id'],'reportType':'custom'});return db[_0xdc5d('0x94')][_0xdc5d('0x4b')](_0x2d3c84,{'raw':!![]});})[_0xdc5d('0x2a')](function(_0x770419){if(_0x2465f0[_0xdc5d('0x73')]===_0xdc5d('0x95')){_0x34cc04[_0xdc5d('0x3f')](_0x2465f0['table']+_0xdc5d('0x96'),_0x3e7614[_0xdc5d('0x97')],_0x3e7614[_0xdc5d('0x98')]);}else{_0x34cc04['where'](_0x2465f0['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3e7614[_0xdc5d('0x97')],_0x3e7614[_0xdc5d('0x98')]);}if(_0x770419){logger[_0xdc5d('0x99')](_0xdc5d('0x9a'),_0x34cc04[_0xdc5d('0x86')]());require('child_process')[_0xdc5d('0x9b')](path[_0xdc5d('0x55')](__dirname,_0xdc5d('0x9c'),_0x770419[_0xdc5d('0x92')]),[_0x770419['id'],_0x34cc04[_0xdc5d('0x86')](),path['join'](__dirname,_0xdc5d('0x9d'),_0x770419[_0xdc5d('0x9e')]),_0x4ce840]);return _0x770419;}else{var _0x4d2e4d=squel[_0xdc5d('0x8c')]();_0x4d2e4d[_0xdc5d('0x72')]('('+_0x34cc04[_0xdc5d('0x86')]()+')',_0xdc5d('0x9f'));_0x4d2e4d[_0xdc5d('0x68')](_0xdc5d('0xa0'),_0xdc5d('0x20'));_0x34cc04[_0xdc5d('0x1e')](_0x3e7614['limit']||_0x5a4cd9);_0x34cc04[_0xdc5d('0x1f')](_0x3e7614[_0xdc5d('0x1f')]||0x0);return dbH[_0xdc5d('0x85')]['query'](_0x4d2e4d[_0xdc5d('0x86')](),{'type':dbH[_0xdc5d('0x85')][_0xdc5d('0xa1')][_0xdc5d('0xa2')]})['then'](function(_0x3a4ea0){if(!_0x3a4ea0['length']){_0x22b9b6=0x0;}else{_0x22b9b6=_0x3a4ea0[0x0][_0xdc5d('0x20')]||0x0;}return dbH[_0xdc5d('0x85')][_0xdc5d('0x37')](_0x34cc04[_0xdc5d('0x86')](),{'type':dbH[_0xdc5d('0x85')]['QueryTypes'][_0xdc5d('0xa2')]});})[_0xdc5d('0x2a')](function(_0x406127){return{'rows':_0x406127||[],'count':_0x22b9b6};});}});}exports[_0xdc5d('0xa3')]=function(_0x5ed906,_0x4255c5){return runReport(_0x5ed906[_0xdc5d('0x47')],_0x5ed906[_0xdc5d('0x37')],_0x5ed906[_0xdc5d('0x43')])[_0xdc5d('0x2a')](respondWithResult(_0x4255c5,null))[_0xdc5d('0x46')](handleError(_0x4255c5,null));};exports[_0xdc5d('0xa4')]=runReport;exports[_0xdc5d('0x37')]=function(_0x1223e6,_0x505569){var _0x4ddfa9=0xa;var _0x3a246a=[_0xdc5d('0x55'),_0xdc5d('0x56'),'right_join',_0xdc5d('0x88')];var _0x12d06a={'SUM':_0xdc5d('0x57'),'COUNT':_0xdc5d('0x58'),'COUNT DISTINCT':_0xdc5d('0x59'),'MAX':_0xdc5d('0x89'),'MIN':'MIN(%s)','AVG':_0xdc5d('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xdc5d('0x5e')};var _0x213457={'SEC_TO_TIME':_0xdc5d('0x5f'),'DATE':_0xdc5d('0x60'),'HOUR':_0xdc5d('0x8a'),'ROUND':_0xdc5d('0xa5'),'UNIX_TIMESTAMP':_0xdc5d('0x61')};var _0x1991e0=function(_0x2f2b79){return!_[_0xdc5d('0x62')]([_0xdc5d('0x63'),_0xdc5d('0x64'),_0xdc5d('0x65'),'IS\x20NOT\x20EMPTY'],_0x2f2b79);};var _0x3e0593=function(_0x16d870){if(!_0x16d870||!_0x16d870[_0xdc5d('0x66')][_0xdc5d('0x3a')]){return'';}for(var _0x576350='(',_0x531b11=0x0;_0x531b11<_0x16d870['rules'][_0xdc5d('0x3a')];_0x531b11+=0x1){_0x531b11>0x0&&(_0x576350+='\x20'+_0x16d870['operator']+'\x20');_0x576350+=_0x16d870['rules'][_0x531b11]['group']?_0x3e0593(_0x16d870['rules'][_0x531b11][_0xdc5d('0x67')]):_0x16d870[_0xdc5d('0x66')][_0x531b11]['field']+'\x20'+_0x16d870['rules'][_0x531b11][_0xdc5d('0x69')]+(_0x1991e0(_0x16d870[_0xdc5d('0x66')][_0x531b11][_0xdc5d('0x69')])?'\x20'+_0x16d870[_0xdc5d('0x66')][_0x531b11][_0xdc5d('0x6a')]:'');}return _0x576350+')';};var _0x544053={'where':{'id':_0x1223e6[_0xdc5d('0x47')]['id']}},_0x312fe1,_0x1839b3,_0x34f907,_0x484646,_0x47e8d9;_0x544053=_[_0xdc5d('0x6b')]({},_0x544053,_0x1223e6[_0xdc5d('0x43')]);return db[_0xdc5d('0x31')][_0xdc5d('0x51')](_0x544053)['then'](function(_0x13c03f){if(_0x13c03f){_0x312fe1=_0x13c03f;return _0x13c03f[_0xdc5d('0x6c')]();}return null;})[_0xdc5d('0x2a')](function(_0x4a37b0){if(_0x4a37b0){if(!_0x4a37b0[_0xdc5d('0x3a')]){throw new db[(_0xdc5d('0x6d'))][(_0xdc5d('0x6e'))](_0xdc5d('0x6f'),0x193);}_0x1839b3=_0x4a37b0;return db['AnalyticMetric'][_0xdc5d('0x45')]({'raw':!![]});}return null;})[_0xdc5d('0x2a')](function(_0x2f6af1){if(_0x2f6af1){_0x34f907=_[_0xdc5d('0x71')](_0x2f6af1,'id');var _0x17481c;var _0x324614=squel[_0xdc5d('0x8c')]();_0x324614[_0xdc5d('0x72')](_0x312fe1[_0xdc5d('0x73')]);for(var _0x474c43=0x0;_0x474c43<_0x1839b3[_0xdc5d('0x3a')];_0x474c43+=0x1){_0x17481c=_0x1839b3[_0x474c43][_0xdc5d('0x74')]?_0x34f907[_0x1839b3[_0x474c43][_0xdc5d('0x74')]][_0xdc5d('0x75')]:_0x1839b3[_0x474c43][_0xdc5d('0x68')];_0x17481c=_0x1839b3[_0x474c43][_0xdc5d('0x77')]?_[_0xdc5d('0x76')](_0x12d06a[_0x1839b3[_0x474c43]['function']],'%s',_0x17481c):_0x17481c;_0x17481c=_0x1839b3[_0x474c43][_0xdc5d('0x78')]?_[_0xdc5d('0x76')](_0x213457[_0x1839b3[_0x474c43][_0xdc5d('0x78')]],'%s',_0x17481c):_0x17481c;if(_0x1839b3[_0x474c43][_0xdc5d('0x79')]){_0x324614[_0xdc5d('0x67')](_0x17481c);}_0x1839b3[_0x474c43][_0xdc5d('0xa6')]&&_0x324614[_0xdc5d('0x3d')](_0x17481c,_0x1839b3[_0x474c43][_0xdc5d('0xa6')]==='DESC'?![]:!![]);_0x324614[_0xdc5d('0x68')](_0x17481c,_0x1839b3[_0x474c43][_0xdc5d('0x7a')]||_0x17481c);}if(_0x312fe1[_0xdc5d('0x7b')]){_0x312fe1[_0xdc5d('0x7b')]=JSON['parse'](_0x312fe1[_0xdc5d('0x7b')]);for(var _0x78626c=0x0;_0x78626c<_0x312fe1[_0xdc5d('0x7b')][_0xdc5d('0x3a')];_0x78626c+=0x1){if(_0x312fe1[_0xdc5d('0x7b')][_0x78626c][_0xdc5d('0x34')]&&_[_0xdc5d('0x62')](_0x3a246a,_0x312fe1[_0xdc5d('0x7b')][_0x78626c][_0xdc5d('0x34')])&&_0x312fe1['joins'][_0x78626c][_0xdc5d('0x7d')]&&_0x312fe1[_0xdc5d('0x7b')][_0x78626c][_0xdc5d('0x7e')]&&_0x312fe1['joins'][_0x78626c][_0xdc5d('0x7f')]){_0x324614[_0x312fe1[_0xdc5d('0x7b')][_0x78626c][_0xdc5d('0x34')]](_0x312fe1['joins'][_0x78626c]['foreignTable'],null,util[_0xdc5d('0x78')](_0xdc5d('0x80'),_0x312fe1[_0xdc5d('0x73')],_0x312fe1[_0xdc5d('0x7b')][_0x78626c][_0xdc5d('0x7d')],_0x312fe1[_0xdc5d('0x7b')][_0x78626c]['foreignTable'],_0x312fe1[_0xdc5d('0x7b')][_0x78626c][_0xdc5d('0x7f')]));}}}if(_0x312fe1[_0xdc5d('0x81')]){_0x312fe1['conditions']=JSON['parse'](_0x312fe1[_0xdc5d('0x81')]);_0x324614[_0xdc5d('0x3f')](_0x3e0593(_0x312fe1[_0xdc5d('0x81')][_0xdc5d('0x67')]));}_0x47e8d9=_0x324614[_0xdc5d('0x82')]();_0x324614[_0xdc5d('0x1e')](_0x4ddfa9);_0x324614['offset'](0x0);logger['debug']('Limited\x20Query:',_0x324614[_0xdc5d('0x86')]());return dbH[_0xdc5d('0x85')]['query'](_0x324614[_0xdc5d('0x86')](),{'type':dbH[_0xdc5d('0x85')][_0xdc5d('0xa1')]['SELECT']});}})[_0xdc5d('0x2a')](function(){return{'sql':_0x47e8d9[_0xdc5d('0x86')]()};})['then'](respondWithResult(_0x505569,null))['catch'](handleError(_0x505569,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 81b92d4..15d4f82 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 _0xb3aa=['request-promise','path','rimraf','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','api','moment'];(function(_0xe45b6d,_0x443cac){var _0x4d6f47=function(_0x1c57a6){while(--_0x1c57a6){_0xe45b6d['push'](_0xe45b6d['shift']());}};_0x4d6f47(++_0x443cac);}(_0xb3aa,0x170));var _0xab3a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb3aa[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xab3a('0x0'));var util=require('util');var logger=require(_0xab3a('0x1'))(_0xab3a('0x2'));var moment=require(_0xab3a('0x3'));var BPromise=require('bluebird');var rp=require(_0xab3a('0x4'));var fs=require('fs');var path=require(_0xab3a('0x5'));var rimraf=require(_0xab3a('0x6'));var config=require('../../config/environment');var attributes=require(_0xab3a('0x7'));module[_0xab3a('0x8')]=function(_0x5bb5da,_0x2172e0){return _0x5bb5da[_0xab3a('0x9')](_0xab3a('0xa'),attributes,{'tableName':_0xab3a('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe36f=['./analyticCustomReport.attributes','exports','define','analytics_custom_reports','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x399b91,_0x4c3278){var _0x4a39b2=function(_0x12dcdc){while(--_0x12dcdc){_0x399b91['push'](_0x399b91['shift']());}};_0x4a39b2(++_0x4c3278);}(_0xe36f,0x1c0));var _0xfe36=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe36f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfe36('0x0'));var util=require(_0xfe36('0x1'));var logger=require(_0xfe36('0x2'))(_0xfe36('0x3'));var moment=require(_0xfe36('0x4'));var BPromise=require('bluebird');var rp=require(_0xfe36('0x5'));var fs=require('fs');var path=require(_0xfe36('0x6'));var rimraf=require('rimraf');var config=require(_0xfe36('0x7'));var attributes=require(_0xfe36('0x8'));module[_0xfe36('0x9')]=function(_0x9bcf2d,_0x15a9df){return _0x9bcf2d[_0xfe36('0xa')]('AnalyticCustomReport',attributes,{'tableName':_0xfe36('0xb'),'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 904ae32..04e2a1b 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 _0x7121=['AnalyticCustomReport,\x20%s,\x20%s','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x4b1e31,_0x5059ba){var _0x12a812=function(_0x1ec497){while(--_0x1ec497){_0x4b1e31['push'](_0x4b1e31['shift']());}};_0x12a812(++_0x5059ba);}(_0x7121,0xa3));var _0x1712=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x7121[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0x1712('0x0'));var util=require(_0x1712('0x1'));var moment=require('moment');var BPromise=require(_0x1712('0x2'));var rs=require(_0x1712('0x3'));var fs=require('fs');var Redis=require(_0x1712('0x4'));var db=require(_0x1712('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1712('0x6'))(_0x1712('0x7'));var config=require(_0x1712('0x8'));var jayson=require(_0x1712('0x9'));var client=jayson['client'][_0x1712('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29944e,_0x43a976,_0x44f632){return new BPromise(function(_0x590224,_0x5128b0){return client[_0x1712('0xb')](_0x29944e,_0x44f632)[_0x1712('0xc')](function(_0x19674f){logger['info'](_0x1712('0xd'),_0x43a976,'request\x20sent');logger['debug'](_0x1712('0xe'),_0x43a976,_0x1712('0xf'),JSON[_0x1712('0x10')](_0x19674f));if(_0x19674f[_0x1712('0x11')]){if(_0x19674f[_0x1712('0x11')]['code']===0x1f4){logger[_0x1712('0x11')](_0x1712('0xd'),_0x43a976,_0x19674f['error']['message']);return _0x5128b0(_0x19674f[_0x1712('0x11')][_0x1712('0x12')]);}logger[_0x1712('0x11')](_0x1712('0xd'),_0x43a976,_0x19674f[_0x1712('0x11')][_0x1712('0x12')]);return _0x590224(_0x19674f[_0x1712('0x11')][_0x1712('0x12')]);}else{logger[_0x1712('0x13')](_0x1712('0xd'),_0x43a976,_0x1712('0xf'));_0x590224(_0x19674f[_0x1712('0x14')][_0x1712('0x12')]);}})[_0x1712('0x15')](function(_0x40ba56){logger['error'](_0x1712('0xd'),_0x43a976,_0x40ba56);_0x5128b0(_0x40ba56);});});} \ No newline at end of file +var _0xa16f=['catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x1fc128,_0x341527){var _0x17a692=function(_0x3d930d){while(--_0x3d930d){_0x1fc128['push'](_0x1fc128['shift']());}};_0x17a692(++_0x341527);}(_0xa16f,0xd9));var _0xfa16=function(_0x53e87b,_0x54e40d){_0x53e87b=_0x53e87b-0x0;var _0xf9021d=_0xa16f[_0x53e87b];return _0xf9021d;};'use strict';var _=require(_0xfa16('0x0'));var util=require(_0xfa16('0x1'));var moment=require('moment');var BPromise=require(_0xfa16('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa16('0x3'))['db'];var utils=require(_0xfa16('0x4'));var logger=require(_0xfa16('0x5'))(_0xfa16('0x6'));var config=require(_0xfa16('0x7'));var jayson=require(_0xfa16('0x8'));var client=jayson[_0xfa16('0x9')][_0xfa16('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7fffe4,_0x1c0cde,_0x116d95){return new BPromise(function(_0x38df04,_0x576b9b){return client[_0xfa16('0xb')](_0x7fffe4,_0x116d95)[_0xfa16('0xc')](function(_0x13f84d){logger['info'](_0xfa16('0xd'),_0x1c0cde,_0xfa16('0xe'));logger[_0xfa16('0xf')](_0xfa16('0x10'),_0x1c0cde,_0xfa16('0xe'),JSON[_0xfa16('0x11')](_0x13f84d));if(_0x13f84d[_0xfa16('0x12')]){if(_0x13f84d[_0xfa16('0x12')][_0xfa16('0x13')]===0x1f4){logger[_0xfa16('0x12')](_0xfa16('0xd'),_0x1c0cde,_0x13f84d['error'][_0xfa16('0x14')]);return _0x576b9b(_0x13f84d[_0xfa16('0x12')][_0xfa16('0x14')]);}logger[_0xfa16('0x12')](_0xfa16('0xd'),_0x1c0cde,_0x13f84d[_0xfa16('0x12')]['message']);return _0x38df04(_0x13f84d[_0xfa16('0x12')][_0xfa16('0x14')]);}else{logger[_0xfa16('0x15')](_0xfa16('0xd'),_0x1c0cde,'request\x20sent');_0x38df04(_0x13f84d[_0xfa16('0x16')][_0xfa16('0x14')]);}})[_0xfa16('0x17')](function(_0x5cb26e){logger[_0xfa16('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1c0cde,_0x5cb26e);_0x576b9b(_0x5cb26e);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index b1f1ac4..7f32b77 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 _0x48b5=['update','delete','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','index','get','show','/:id/preview','isAuthenticated','preview','/:id/run','run','/:id/query','query','post','create','/:id'];(function(_0x16ff3d,_0x38be9b){var _0x14e0ed=function(_0x4dc69a){while(--_0x4dc69a){_0x16ff3d['push'](_0x16ff3d['shift']());}};_0x14e0ed(++_0x38be9b);}(_0x48b5,0xdb));var _0x548b=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x48b5[_0x35da42];return _0x370035;};'use strict';var multer=require('multer');var util=require(_0x548b('0x0'));var path=require(_0x548b('0x1'));var timeout=require('connect-timeout');var express=require(_0x548b('0x2'));var router=express['Router']();var fs_extra=require(_0x548b('0x3'));var auth=require(_0x548b('0x4'));var interaction=require(_0x548b('0x5'));var config=require(_0x548b('0x6'));var controller=require(_0x548b('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x548b('0x8')]);router[_0x548b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x548b('0xa')]);router[_0x548b('0x9')](_0x548b('0xb'),auth[_0x548b('0xc')](),controller[_0x548b('0xd')]);router[_0x548b('0x9')](_0x548b('0xe'),auth[_0x548b('0xc')](),controller[_0x548b('0xf')]);router['get'](_0x548b('0x10'),auth['isAuthenticated'](),controller[_0x548b('0x11')]);router[_0x548b('0x12')]('/',auth[_0x548b('0xc')](),controller[_0x548b('0x13')]);router['put'](_0x548b('0x14'),auth['isAuthenticated'](),controller[_0x548b('0x15')]);router[_0x548b('0x16')](_0x548b('0x14'),auth['isAuthenticated'](),controller['destroy']);module[_0x548b('0x17')]=router; \ No newline at end of file +var _0x7e6f=['destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get','/:id','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update'];(function(_0x421f64,_0x145637){var _0x49995e=function(_0x5ac7b7){while(--_0x5ac7b7){_0x421f64['push'](_0x421f64['shift']());}};_0x49995e(++_0x145637);}(_0x7e6f,0x139));var _0xf7e6=function(_0x1645a6,_0x102f19){_0x1645a6=_0x1645a6-0x0;var _0x52648e=_0x7e6f[_0x1645a6];return _0x52648e;};'use strict';var multer=require(_0xf7e6('0x0'));var util=require(_0xf7e6('0x1'));var path=require(_0xf7e6('0x2'));var timeout=require(_0xf7e6('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf7e6('0x4'));var auth=require(_0xf7e6('0x5'));var interaction=require(_0xf7e6('0x6'));var config=require(_0xf7e6('0x7'));var controller=require(_0xf7e6('0x8'));router['get']('/',auth[_0xf7e6('0x9')](),controller[_0xf7e6('0xa')]);router[_0xf7e6('0xb')](_0xf7e6('0xc'),auth[_0xf7e6('0x9')](),controller['show']);router[_0xf7e6('0xb')](_0xf7e6('0xd'),auth[_0xf7e6('0x9')](),controller[_0xf7e6('0xe')]);router[_0xf7e6('0xb')](_0xf7e6('0xf'),auth[_0xf7e6('0x9')](),controller[_0xf7e6('0x10')]);router[_0xf7e6('0xb')](_0xf7e6('0x11'),auth[_0xf7e6('0x9')](),controller[_0xf7e6('0x12')]);router[_0xf7e6('0x13')]('/',auth['isAuthenticated'](),controller[_0xf7e6('0x14')]);router[_0xf7e6('0x15')](_0xf7e6('0xc'),auth[_0xf7e6('0x9')](),controller[_0xf7e6('0x16')]);router['delete'](_0xf7e6('0xc'),auth['isAuthenticated'](),controller[_0xf7e6('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 29c2fa8..d810081 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 _0x5496=['TEXT','sequelize','exports','STRING'];(function(_0x3ef4df,_0x3446ef){var _0x4c40ca=function(_0x1b5c75){while(--_0x1b5c75){_0x3ef4df['push'](_0x3ef4df['shift']());}};_0x4c40ca(++_0x3446ef);}(_0x5496,0x175));var _0x6549=function(_0x5ecf4e,_0x73edc5){_0x5ecf4e=_0x5ecf4e-0x0;var _0x198e42=_0x5496[_0x5ecf4e];return _0x198e42;};'use strict';var Sequelize=require(_0x6549('0x0'));module[_0x6549('0x1')]={'name':{'type':Sequelize[_0x6549('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6549('0x2')]},'parent':{'type':Sequelize[_0x6549('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x6549('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xa630=['STRING','TEXT','sequelize','exports'];(function(_0x58c3d1,_0x2c46c4){var _0x334e7a=function(_0xd05f6b){while(--_0xd05f6b){_0x58c3d1['push'](_0x58c3d1['shift']());}};_0x334e7a(++_0x2c46c4);}(_0xa630,0xbe));var _0x0a63=function(_0x3be66f,_0x393541){_0x3be66f=_0x3be66f-0x0;var _0x2c0de6=_0xa630[_0x3be66f];return _0x2c0de6;};'use strict';var Sequelize=require(_0x0a63('0x0'));module[_0x0a63('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x0a63('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x0a63('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 840fda0..6b51ebd 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 _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(_0x46ab23,_0x47b89d){var _0x45c474=function(_0x253e72){while(--_0x253e72){_0x46ab23['push'](_0x46ab23['shift']());}};_0x45c474(++_0x47b89d);}(_0x5fab,0x177));var _0xb5fa=function(_0x4468b2,_0x4f0703){_0x4468b2=_0x4468b2-0x0;var _0x4fb044=_0x5fab[_0x4468b2];return _0x4fb044;};'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 +var _0x1967=['conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','table','web','%s-%s.%s','randomstring','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','select','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','get','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','DefaultReports','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey'];(function(_0x567f61,_0x4470df){var _0x546cfe=function(_0x14c42f){while(--_0x14c42f){_0x567f61['push'](_0x567f61['shift']());}};_0x546cfe(++_0x4470df);}(_0x1967,0x173));var _0x7196=function(_0x685edf,_0x2a2bc3){_0x685edf=_0x685edf-0x0;var _0x460317=_0x1967[_0x685edf];return _0x460317;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];var dbH=require(_0x7196('0x1b'))[_0x7196('0x1c')];function respondWithStatusCode(_0xba707b,_0x154101){_0x154101=_0x154101||0xcc;return function(_0x4e8c4c){if(_0x4e8c4c){return _0xba707b[_0x7196('0x1d')](_0x154101);}return _0xba707b[_0x7196('0x1e')](_0x154101)[_0x7196('0x1f')]();};}function respondWithResult(_0xf098c1,_0x511aa1){_0x511aa1=_0x511aa1||0xc8;return function(_0x31c778){if(_0x31c778){return _0xf098c1['status'](_0x511aa1)[_0x7196('0x20')](_0x31c778);}};}function respondWithFilteredResult(_0x2590a6,_0xf7e97){return function(_0x3ed1ad){if(_0x3ed1ad){var _0x12dce7=typeof _0xf7e97[_0x7196('0x21')]===_0x7196('0x22')&&typeof _0xf7e97[_0x7196('0x23')]===_0x7196('0x22');var _0x32fe2b=_0x3ed1ad[_0x7196('0x24')];var _0x5b716a=_0x12dce7?0x0:_0xf7e97['offset'];var _0x448f13=_0x12dce7?_0x3ed1ad[_0x7196('0x24')]:_0xf7e97[_0x7196('0x21')]+_0xf7e97['limit'];var _0x39b944;if(_0x448f13>=_0x32fe2b){_0x448f13=_0x32fe2b;_0x39b944=0xc8;}else{_0x39b944=0xce;}_0x2590a6['status'](_0x39b944);return _0x2590a6['set'](_0x7196('0x25'),_0x5b716a+'-'+_0x448f13+'/'+_0x32fe2b)[_0x7196('0x20')](_0x3ed1ad);}return null;};}function patchUpdates(_0x8dee9d){return function(_0x4ddf78){try{jsonpatch['apply'](_0x4ddf78,_0x8dee9d,!![]);}catch(_0x38d291){return BPromise[_0x7196('0x26')](_0x38d291);}return _0x4ddf78['save']();};}function saveUpdates(_0x18649b,_0x27ff84){return function(_0x6e22e5){if(_0x6e22e5){return _0x6e22e5[_0x7196('0x27')](_0x18649b)[_0x7196('0x28')](function(_0x549f34){return _0x549f34;});}return null;};}function removeEntity(_0x3f8178,_0x520d01){return function(_0x3ce9a0){if(_0x3ce9a0){return _0x3ce9a0[_0x7196('0x29')]()[_0x7196('0x28')](function(){var _0xa69810=_0x3ce9a0[_0x7196('0x2a')]({'plain':!![]});var _0x43f6a2='DefaultReports';return db['UserProfileResource'][_0x7196('0x29')]({'where':{'type':_0x43f6a2,'resourceId':_0xa69810['id']}})[_0x7196('0x28')](function(){return _0x3ce9a0;});})[_0x7196('0x28')](function(){_0x3f8178['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41cfd2,_0x162cfc){return function(_0x675e64){if(!_0x675e64){_0x41cfd2['sendStatus'](0x194);}return _0x675e64;};}function handleError(_0x35eef9,_0x4ecea1){_0x4ecea1=_0x4ecea1||0x1f4;return function(_0x4fd339){logger['error'](_0x4fd339[_0x7196('0x2b')]);if(_0x4fd339[_0x7196('0x2c')]){delete _0x4fd339[_0x7196('0x2c')];}_0x35eef9['status'](_0x4ecea1)[_0x7196('0x2d')](_0x4fd339);};}exports[_0x7196('0x2e')]=function(_0x2f9583,_0xf999e9){var _0x50c386={},_0x39710d={},_0x429160={'count':0x0,'rows':[]};var _0xd07f22=_[_0x7196('0x2f')](db[_0x7196('0x30')][_0x7196('0x31')],function(_0x15c5f0){return{'name':_0x15c5f0[_0x7196('0x32')],'type':_0x15c5f0[_0x7196('0x33')][_0x7196('0x34')]};});_0x39710d[_0x7196('0x35')]=_['map'](_0xd07f22,_0x7196('0x2c'));_0x39710d['query']=_[_0x7196('0x36')](_0x2f9583['query']);_0x39710d[_0x7196('0x37')]=_[_0x7196('0x38')](_0x39710d['model'],_0x39710d[_0x7196('0x39')]);_0x50c386[_0x7196('0x3a')]=_[_0x7196('0x38')](_0x39710d[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x2f9583['query'][_0x7196('0x3b')]));_0x50c386[_0x7196('0x3a')]=_0x50c386[_0x7196('0x3a')][_0x7196('0x3c')]?_0x50c386[_0x7196('0x3a')]:_0x39710d[_0x7196('0x35')];if(!_0x2f9583['query'][_0x7196('0x3d')](_0x7196('0x3e'))){_0x50c386[_0x7196('0x23')]=qs['limit'](_0x2f9583[_0x7196('0x39')][_0x7196('0x23')]);_0x50c386[_0x7196('0x21')]=qs[_0x7196('0x21')](_0x2f9583[_0x7196('0x39')][_0x7196('0x21')]);}_0x50c386[_0x7196('0x3f')]=qs[_0x7196('0x40')](_0x2f9583[_0x7196('0x39')][_0x7196('0x40')]);_0x50c386['where']=qs[_0x7196('0x37')](_[_0x7196('0x41')](_0x2f9583['query'],_0x39710d[_0x7196('0x37')]),_0xd07f22);if(_0x2f9583['query']['filter']){_0x50c386[_0x7196('0x42')]=_[_0x7196('0x43')](_0x50c386['where'],{'$or':_['map'](_0xd07f22,function(_0x1bad95){if(_0x1bad95[_0x7196('0x33')]!==_0x7196('0x44')){var _0x4c2341={};_0x4c2341[_0x1bad95[_0x7196('0x2c')]]={'$like':'%'+_0x2f9583[_0x7196('0x39')][_0x7196('0x45')]+'%'};return _0x4c2341;}})});}_0x50c386=_[_0x7196('0x43')]({},_0x50c386,_0x2f9583[_0x7196('0x46')]);var _0x428d76={'where':_0x50c386[_0x7196('0x42')]};return db[_0x7196('0x30')]['count'](_0x428d76)[_0x7196('0x28')](function(_0xa852e1){_0x429160['count']=_0xa852e1;if(_0x2f9583[_0x7196('0x39')][_0x7196('0x47')]){_0x50c386['include']=[{'all':!![]}];}return db[_0x7196('0x30')][_0x7196('0x48')](_0x50c386);})[_0x7196('0x28')](function(_0x5749e2){_0x429160[_0x7196('0x49')]=_0x5749e2;return _0x429160;})[_0x7196('0x28')](respondWithFilteredResult(_0xf999e9,_0x50c386))['catch'](handleError(_0xf999e9,null));};exports[_0x7196('0x4a')]=function(_0x1a7052,_0x4f0c6c){var _0x335e6f={'raw':!![],'where':{'id':_0x1a7052['params']['id']}},_0x53a5e6={};_0x53a5e6['model']=_['keys'](db['AnalyticDefaultReport'][_0x7196('0x31')]);_0x53a5e6['query']=_[_0x7196('0x36')](_0x1a7052[_0x7196('0x39')]);_0x53a5e6[_0x7196('0x37')]=_[_0x7196('0x38')](_0x53a5e6['model'],_0x53a5e6[_0x7196('0x39')]);_0x335e6f['attributes']=_[_0x7196('0x38')](_0x53a5e6[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x1a7052['query'][_0x7196('0x3b')]));_0x335e6f[_0x7196('0x3a')]=_0x335e6f[_0x7196('0x3a')]['length']?_0x335e6f['attributes']:_0x53a5e6[_0x7196('0x35')];if(_0x1a7052['query'][_0x7196('0x47')]){_0x335e6f['include']=[{'all':!![]}];}_0x335e6f=_['merge']({},_0x335e6f,_0x1a7052[_0x7196('0x46')]);return db['AnalyticDefaultReport']['find'](_0x335e6f)['then'](handleEntityNotFound(_0x4f0c6c,null))[_0x7196('0x28')](respondWithResult(_0x4f0c6c,null))['catch'](handleError(_0x4f0c6c,null));};exports['create']=function(_0x28591e,_0x182c8b){return db[_0x7196('0x30')][_0x7196('0x4b')](_0x28591e['body'],{})[_0x7196('0x28')](function(_0x564688){var _0x36844f=_0x28591e[_0x7196('0x4c')]['get']({'plain':!![]});if(!_0x36844f)throw new Error(_0x7196('0x4d'));if(_0x36844f[_0x7196('0x4e')]===_0x7196('0x4c')){var _0x4fa18f=_0x564688[_0x7196('0x2a')]({'plain':!![]});var _0x5d51aa=_0x7196('0x4f');return db[_0x7196('0x50')][_0x7196('0x51')]({'where':{'name':_0x5d51aa,'userProfileId':_0x36844f[_0x7196('0x52')]},'raw':!![]})[_0x7196('0x28')](function(_0x19733a){if(_0x19733a&&_0x19733a[_0x7196('0x53')]===0x0){return db[_0x7196('0x54')]['create']({'name':_0x4fa18f['name'],'resourceId':_0x4fa18f['id'],'type':_0x7196('0x55'),'sectionId':_0x19733a['id']},{})[_0x7196('0x28')](function(){return _0x564688;});}else{return _0x564688;}})[_0x7196('0x56')](function(_0xe4b032){logger['error'](_0x7196('0x57'),_0xe4b032);throw _0xe4b032;});}return _0x564688;})[_0x7196('0x28')](respondWithResult(_0x182c8b,0xc9))[_0x7196('0x56')](handleError(_0x182c8b,null));};exports[_0x7196('0x27')]=function(_0x9fcfd4,_0x3177c2){if(_0x9fcfd4[_0x7196('0x58')]['id']){delete _0x9fcfd4[_0x7196('0x58')]['id'];}return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x9fcfd4[_0x7196('0x59')]['id']}})['then'](handleEntityNotFound(_0x3177c2,null))[_0x7196('0x28')](saveUpdates(_0x9fcfd4[_0x7196('0x58')],null))[_0x7196('0x28')](respondWithResult(_0x3177c2,null))['catch'](handleError(_0x3177c2,null));};exports[_0x7196('0x29')]=function(_0x5ca1ca,_0x34407d){return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x5ca1ca[_0x7196('0x59')]['id']}})[_0x7196('0x28')](handleEntityNotFound(_0x34407d,null))['then'](removeEntity(_0x34407d,null))[_0x7196('0x56')](handleError(_0x34407d,null));};exports['preview']=function(_0x4be36d,_0x5b9824){var _0x1bc358=0xa;var _0x3be180=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x2d8b3d={'SUM':'SUM(%s)','COUNT':_0x7196('0x5e'),'COUNT DISTINCT':_0x7196('0x5f'),'MAX':_0x7196('0x60'),'MIN':_0x7196('0x61'),'AVG':_0x7196('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7196('0x63')};var _0x1c7eb2={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x43ee13=function(_0x13e9d0){return!_[_0x7196('0x69')]([_0x7196('0x6a'),'IS\x20NOT\x20NULL',_0x7196('0x6b'),_0x7196('0x6c')],_0x13e9d0);};var _0x27d5d7=function(_0x33f43b){if(!_0x33f43b||!_0x33f43b['rules'][_0x7196('0x3c')]){return'';}for(var _0x204c3a='(',_0x1f3acc=0x0;_0x1f3acc<_0x33f43b[_0x7196('0x6d')][_0x7196('0x3c')];_0x1f3acc+=0x1){_0x1f3acc>0x0&&(_0x204c3a+='\x20'+_0x33f43b[_0x7196('0x6e')]+'\x20');_0x204c3a+=_0x33f43b[_0x7196('0x6d')][_0x1f3acc]['group']?_0x27d5d7(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x6f')]):_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x70')]+'\x20'+_0x33f43b['rules'][_0x1f3acc][_0x7196('0x71')]+(_0x43ee13(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x71')])?'\x20'+_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x72')]:'');}return _0x204c3a+')';};var _0x37c6be={'where':{'id':_0x4be36d['params']['id']}},_0x57065,_0x517dfb,_0x56b2eb,_0x56955e,_0x72f6f1;_0x37c6be=_[_0x7196('0x43')]({},_0x37c6be,_0x4be36d[_0x7196('0x46')]);return db[_0x7196('0x30')][_0x7196('0x51')](_0x37c6be)[_0x7196('0x28')](function(_0x30d44f){if(_0x30d44f){_0x57065=_0x30d44f;return _0x30d44f[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x3881a5){if(_0x3881a5){if(!_0x3881a5['length']){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x517dfb=_0x3881a5;return db[_0x7196('0x76')][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x45e21f){if(_0x45e21f){_0x56b2eb=_[_0x7196('0x77')](_0x45e21f,'id');var _0x2f36f8;var _0x4cc5e3=squel['select']();_0x4cc5e3[_0x7196('0x78')](_0x57065['table']);for(var _0x30d114=0x0;_0x30d114<_0x517dfb['length'];_0x30d114+=0x1){_0x2f36f8=_0x517dfb[_0x30d114][_0x7196('0x79')]?_0x56b2eb[_0x517dfb[_0x30d114][_0x7196('0x79')]][_0x7196('0x7a')]:_0x517dfb[_0x30d114][_0x7196('0x70')];_0x2f36f8=_0x517dfb[_0x30d114]['function']?_['replace'](_0x2d8b3d[_0x517dfb[_0x30d114][_0x7196('0x7b')]],'%s',_0x2f36f8):_0x2f36f8;_0x2f36f8=_0x517dfb[_0x30d114]['format']?_[_0x7196('0x7c')](_0x1c7eb2[_0x517dfb[_0x30d114][_0x7196('0x7d')]],'%s',_0x2f36f8):_0x2f36f8;if(_0x517dfb[_0x30d114][_0x7196('0x7e')]){_0x4cc5e3[_0x7196('0x6f')](_0x2f36f8);}_0x517dfb[_0x30d114][_0x7196('0x7f')]&&_0x4cc5e3[_0x7196('0x3f')](_0x2f36f8,_0x517dfb[_0x30d114]['orderBy']===_0x7196('0x80')?![]:!![]);_0x4cc5e3[_0x7196('0x70')](_0x2f36f8,_0x517dfb[_0x30d114][_0x7196('0x81')]||_0x2f36f8);}if(_0x57065[_0x7196('0x82')]){_0x57065[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x82')]);for(var _0x473c0e=0x0;_0x473c0e<_0x57065[_0x7196('0x82')][_0x7196('0x3c')];_0x473c0e+=0x1){if(_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')]&&_['includes'](_0x3be180,_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')])&&_0x57065['joins'][_0x473c0e]['parentKey']&&_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')]&&_0x57065[_0x7196('0x82')][_0x473c0e]['foreignKey']){_0x4cc5e3[_0x57065[_0x7196('0x82')][_0x473c0e]['type']](_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],null,util['format'](_0x7196('0x85'),_0x57065['table'],_0x57065['joins'][_0x473c0e][_0x7196('0x86')],_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],_0x57065['joins'][_0x473c0e][_0x7196('0x87')]));}}}if(_0x57065['conditions']){_0x57065[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x88')]);_0x4cc5e3[_0x7196('0x42')](_0x27d5d7(_0x57065[_0x7196('0x88')]['group']));}_0x72f6f1=_0x4cc5e3[_0x7196('0x89')]();_0x4cc5e3[_0x7196('0x23')](_0x1bc358);_0x4cc5e3[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x4cc5e3[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x4cc5e3['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});}})[_0x7196('0x28')](respondWithResult(_0x5b9824,null))['catch'](handleError(_0x5b9824,null));};function runReport(_0x1364f5,_0x2cb53c,_0x4fe2cb){var _0x2e4807=_0x2cb53c['name'];var _0xd6d8cf=0xa;var _0x5318c1=[_0x7196('0x5a'),_0x7196('0x5b'),'right_join',_0x7196('0x5d')];var _0x2b52c0={'SUM':_0x7196('0x90'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7196('0x60'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0x509c4a={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x26048c=function(_0x1a4d17){return!_[_0x7196('0x69')]([_0x7196('0x6a'),_0x7196('0x93'),_0x7196('0x6b'),'IS\x20NOT\x20EMPTY'],_0x1a4d17);};var _0x5acff1=function(_0x32ab6c){if(!_0x32ab6c||!_0x32ab6c['rules']['length']){return'';}for(var _0x2bfdc4='(',_0x1604fa=0x0;_0x1604fa<_0x32ab6c[_0x7196('0x6d')][_0x7196('0x3c')];_0x1604fa+=0x1){_0x1604fa>0x0&&(_0x2bfdc4+='\x20'+_0x32ab6c['operator']+'\x20');_0x2bfdc4+=_0x32ab6c['rules'][_0x1604fa][_0x7196('0x6f')]?_0x5acff1(_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x6f')]):_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['field']+'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['condition']+(_0x26048c(_0x32ab6c['rules'][_0x1604fa][_0x7196('0x71')])?'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x72')]:'');}return _0x2bfdc4+')';};var _0x494418={'where':{'id':_0x1364f5['id']}},_0x400aa5,_0x40d4c3,_0x1824e2,_0x30c54b,_0x10712f;_0x494418=_[_0x7196('0x43')]({},_0x494418,_0x4fe2cb);return db[_0x7196('0x30')][_0x7196('0x51')](_0x494418)['then'](function(_0x9bd2ea){if(_0x9bd2ea){_0x400aa5=_0x9bd2ea;return _0x9bd2ea[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x408760){if(_0x408760){if(!_0x408760[_0x7196('0x3c')]){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x40d4c3=_0x408760;return db[_0x7196('0x76')]['findAll']({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x4b98de){if(_0x4b98de){_0x1824e2=_['keyBy'](_0x4b98de,'id');var _0x1dcf93;var _0x25d323=squel['select']();_0x25d323[_0x7196('0x78')](_0x400aa5[_0x7196('0x94')]);for(var _0x48ceda=0x0;_0x48ceda<_0x40d4c3[_0x7196('0x3c')];_0x48ceda+=0x1){_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x79')]?_0x1824e2[_0x40d4c3[_0x48ceda][_0x7196('0x79')]][_0x7196('0x7a')]:_0x40d4c3[_0x48ceda][_0x7196('0x70')];_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7b')]?_['replace'](_0x2b52c0[_0x40d4c3[_0x48ceda][_0x7196('0x7b')]],'%s',_0x1dcf93):_0x1dcf93;_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0x509c4a[_0x40d4c3[_0x48ceda]['format']],'%s',_0x1dcf93):_0x1dcf93;if(_0x40d4c3[_0x48ceda]['groupBy']){_0x25d323['group'](_0x1dcf93);}_0x40d4c3[_0x48ceda][_0x7196('0x7f')]&&_0x25d323[_0x7196('0x3f')](_0x1dcf93,_0x40d4c3[_0x48ceda][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x25d323[_0x7196('0x70')](_0x1dcf93,_0x40d4c3[_0x48ceda]['alias']||_0x1dcf93);}if(_0x400aa5[_0x7196('0x82')]){_0x400aa5['joins']=JSON[_0x7196('0x83')](_0x400aa5[_0x7196('0x82')]);for(var _0x33d5bf=0x0;_0x33d5bf<_0x400aa5[_0x7196('0x82')][_0x7196('0x3c')];_0x33d5bf+=0x1){if(_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x33')]&&_['includes'](_0x5318c1,_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type'])&&_0x400aa5['joins'][_0x33d5bf]['parentKey']&&_0x400aa5['joins'][_0x33d5bf]['foreignTable']&&_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]){_0x25d323[_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type']](_0x400aa5[_0x7196('0x82')][_0x33d5bf]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x400aa5[_0x7196('0x94')],_0x400aa5['joins'][_0x33d5bf][_0x7196('0x86')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x84')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]));}}}if(_0x400aa5[_0x7196('0x88')]){_0x400aa5[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x400aa5['conditions']);_0x25d323[_0x7196('0x42')](_0x5acff1(_0x400aa5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x10712f=_0x25d323['clone']();_0x25d323[_0x7196('0x23')](_0xd6d8cf);_0x25d323[_0x7196('0x21')](0x0);return;}})[_0x7196('0x28')](function(){if(_0x2cb53c['output']===_0x7196('0x95')){return null;}var _0x46a563=_[_0x7196('0x43')](_0x2cb53c,{'name':_0x2cb53c['fullPath']||_0x2cb53c[_0x7196('0x2c')]||_0x400aa5[_0x7196('0x2c')],'basename':_0x2e4807,'savename':util['format'](_0x7196('0x96'),_0x2cb53c['name']||_0x400aa5[_0x7196('0x2c')],require(_0x7196('0x97'))['generate'](0x4),_0x2cb53c[_0x7196('0x98')]||'csv'),'reportId':_0x400aa5['id'],'reportType':_0x7196('0x99')});return db[_0x7196('0x9a')][_0x7196('0x4b')](_0x46a563,{'raw':!![]});})['then'](function(_0xd9619d){if(_0x400aa5[_0x7196('0x94')]===_0x7196('0x9b')){_0x10712f[_0x7196('0x42')](_0x400aa5['table']+_0x7196('0x9c'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}else{_0x10712f['where'](_0x400aa5['table']+_0x7196('0x9f'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}if(_0xd9619d){logger[_0x7196('0xa0')]('Run\x20Query:',_0x10712f[_0x7196('0x8c')]());require('child_process')[_0x7196('0xa1')](path['join'](__dirname,_0x7196('0xa2'),_0xd9619d[_0x7196('0x98')]),[_0xd9619d['id'],_0x10712f[_0x7196('0x8c')](),path[_0x7196('0x5a')](__dirname,_0x7196('0xa3'),_0xd9619d[_0x7196('0xa4')]),_0x2e4807]);return _0xd9619d;}else{var _0x342fb1=squel['select']();_0x342fb1[_0x7196('0x78')]('('+_0x10712f[_0x7196('0x8c')]()+')',_0x7196('0xa5'));_0x342fb1[_0x7196('0x70')](_0x7196('0xa6'),_0x7196('0x24'));_0x10712f[_0x7196('0x23')](_0x2cb53c[_0x7196('0x23')]||_0xd6d8cf);_0x10712f['offset'](_0x2cb53c[_0x7196('0x21')]||0x0);return dbH[_0x7196('0x8d')]['query'](_0x342fb1[_0x7196('0x8c')](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]})[_0x7196('0x28')](function(_0xdf1ede){if(!_0xdf1ede[_0x7196('0x3c')]){_0x30c54b=0x0;}else{_0x30c54b=_0xdf1ede[0x0]['count']||0x0;}return dbH['sequelize'][_0x7196('0x39')](_0x10712f['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});})[_0x7196('0x28')](function(_0x2df80a){return{'rows':_0x2df80a||[],'count':_0x30c54b};});}});}exports['run']=function(_0x392e74,_0x17ba6d){return runReport(_0x392e74[_0x7196('0x59')],_0x392e74[_0x7196('0x39')],_0x392e74[_0x7196('0x46')])[_0x7196('0x28')](respondWithResult(_0x17ba6d,null))[_0x7196('0x56')](handleError(_0x17ba6d,null));};exports[_0x7196('0xa7')]=runReport;exports[_0x7196('0x39')]=function(_0x5a3c87,_0x58fb86){var _0x51da79=0xa;var _0x144613=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x9055af={'SUM':_0x7196('0x90'),'COUNT':_0x7196('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0xab9595={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':'HOUR(%s)','ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5236a0=function(_0x520fe8){return!_['includes'](['IS\x20NULL',_0x7196('0x93'),'IS\x20EMPTY',_0x7196('0x6c')],_0x520fe8);};var _0x425a57=function(_0x302728){if(!_0x302728||!_0x302728[_0x7196('0x6d')][_0x7196('0x3c')]){return'';}for(var _0x14492e='(',_0x58df43=0x0;_0x58df43<_0x302728[_0x7196('0x6d')][_0x7196('0x3c')];_0x58df43+=0x1){_0x58df43>0x0&&(_0x14492e+='\x20'+_0x302728[_0x7196('0x6e')]+'\x20');_0x14492e+=_0x302728['rules'][_0x58df43][_0x7196('0x6f')]?_0x425a57(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x6f')]):_0x302728['rules'][_0x58df43]['field']+'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')]+(_0x5236a0(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')])?'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x72')]:'');}return _0x14492e+')';};var _0x1a8a5a={'where':{'id':_0x5a3c87[_0x7196('0x59')]['id']}},_0x2944e5,_0x3f9385,_0xbd94ef,_0x5d2a56,_0x2fb552;_0x1a8a5a=_['merge']({},_0x1a8a5a,_0x5a3c87[_0x7196('0x46')]);return db[_0x7196('0x30')]['find'](_0x1a8a5a)[_0x7196('0x28')](function(_0x386259){if(_0x386259){_0x2944e5=_0x386259;return _0x386259[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x1e7a64){if(_0x1e7a64){if(!_0x1e7a64[_0x7196('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0x7196('0x75'),0x193);}_0x3f9385=_0x1e7a64;return db['AnalyticMetric'][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x30db09){if(_0x30db09){_0xbd94ef=_['keyBy'](_0x30db09,'id');var _0x4729e1;var _0x66e1e6=squel[_0x7196('0xa8')]();_0x66e1e6[_0x7196('0x78')](_0x2944e5[_0x7196('0x94')]);for(var _0x1e2105=0x0;_0x1e2105<_0x3f9385[_0x7196('0x3c')];_0x1e2105+=0x1){_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x79')]?_0xbd94ef[_0x3f9385[_0x1e2105][_0x7196('0x79')]]['metric']:_0x3f9385[_0x1e2105][_0x7196('0x70')];_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7b')]?_[_0x7196('0x7c')](_0x9055af[_0x3f9385[_0x1e2105][_0x7196('0x7b')]],'%s',_0x4729e1):_0x4729e1;_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0xab9595[_0x3f9385[_0x1e2105]['format']],'%s',_0x4729e1):_0x4729e1;if(_0x3f9385[_0x1e2105][_0x7196('0x7e')]){_0x66e1e6['group'](_0x4729e1);}_0x3f9385[_0x1e2105][_0x7196('0x7f')]&&_0x66e1e6[_0x7196('0x3f')](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x66e1e6['field'](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x81')]||_0x4729e1);}if(_0x2944e5[_0x7196('0x82')]){_0x2944e5[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x2944e5[_0x7196('0x82')]);for(var _0x220315=0x0;_0x220315<_0x2944e5[_0x7196('0x82')][_0x7196('0x3c')];_0x220315+=0x1){if(_0x2944e5['joins'][_0x220315][_0x7196('0x33')]&&_[_0x7196('0x69')](_0x144613,_0x2944e5['joins'][_0x220315][_0x7196('0x33')])&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')]&&_0x2944e5['joins'][_0x220315][_0x7196('0x84')]&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]){_0x66e1e6[_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x33')]](_0x2944e5['joins'][_0x220315]['foreignTable'],null,util[_0x7196('0x7d')](_0x7196('0x85'),_0x2944e5[_0x7196('0x94')],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')],_0x2944e5[_0x7196('0x82')][_0x220315]['foreignTable'],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]));}}}if(_0x2944e5[_0x7196('0x88')]){_0x2944e5[_0x7196('0x88')]=JSON['parse'](_0x2944e5[_0x7196('0x88')]);_0x66e1e6[_0x7196('0x42')](_0x425a57(_0x2944e5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x2fb552=_0x66e1e6[_0x7196('0x89')]();_0x66e1e6[_0x7196('0x23')](_0x51da79);_0x66e1e6[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x66e1e6[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x66e1e6['toString'](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]});}})['then'](function(){return{'sql':_0x2fb552[_0x7196('0x8c')]()};})['then'](respondWithResult(_0x58fb86,null))[_0x7196('0x56')](handleError(_0x58fb86,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 32b3a4a..6016a99 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 _0xd056=['api','bluebird','request-promise','path','rimraf','define','analytics_default_reports','../../config/logger'];(function(_0x5b19bf,_0xa2c7ac){var _0x286f7e=function(_0x43d395){while(--_0x43d395){_0x5b19bf['push'](_0x5b19bf['shift']());}};_0x286f7e(++_0xa2c7ac);}(_0xd056,0x87));var _0x6d05=function(_0x59f661,_0x2675c9){_0x59f661=_0x59f661-0x0;var _0x46c224=_0xd056[_0x59f661];return _0x46c224;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6d05('0x0'))(_0x6d05('0x1'));var moment=require('moment');var BPromise=require(_0x6d05('0x2'));var rp=require(_0x6d05('0x3'));var fs=require('fs');var path=require(_0x6d05('0x4'));var rimraf=require(_0x6d05('0x5'));var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module['exports']=function(_0x45e35c,_0x188391){return _0x45e35c[_0x6d05('0x6')]('AnalyticDefaultReport',attributes,{'tableName':_0x6d05('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb45=['AnalyticDefaultReport','analytics_default_reports','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define'];(function(_0x22a2ce,_0x283ea2){var _0x1e07fb=function(_0x1168d3){while(--_0x1168d3){_0x22a2ce['push'](_0x22a2ce['shift']());}};_0x1e07fb(++_0x283ea2);}(_0xdb45,0xd4));var _0x5db4=function(_0x1fec86,_0x422ed7){_0x1fec86=_0x1fec86-0x0;var _0x55e897=_0xdb45[_0x1fec86];return _0x55e897;};'use strict';var _=require(_0x5db4('0x0'));var util=require(_0x5db4('0x1'));var logger=require('../../config/logger')(_0x5db4('0x2'));var moment=require(_0x5db4('0x3'));var BPromise=require(_0x5db4('0x4'));var rp=require(_0x5db4('0x5'));var fs=require('fs');var path=require(_0x5db4('0x6'));var rimraf=require(_0x5db4('0x7'));var config=require(_0x5db4('0x8'));var attributes=require(_0x5db4('0x9'));module[_0x5db4('0xa')]=function(_0x4678eb,_0x2e5936){return _0x4678eb[_0x5db4('0xb')](_0x5db4('0xc'),attributes,{'tableName':_0x5db4('0xd'),'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 cf23f5e..37da6e8 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 _0x9827=['lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x4cec0d,_0x56a21b){var _0x18314a=function(_0x39ff5b){while(--_0x39ff5b){_0x4cec0d['push'](_0x4cec0d['shift']());}};_0x18314a(++_0x56a21b);}(_0x9827,0x1b9));var _0x7982=function(_0xc87d08,_0x59c9be){_0xc87d08=_0xc87d08-0x0;var _0x30a714=_0x9827[_0xc87d08];return _0x30a714;};'use strict';var _=require(_0x7982('0x0'));var util=require(_0x7982('0x1'));var moment=require(_0x7982('0x2'));var BPromise=require(_0x7982('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7982('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7982('0x5'));var logger=require('../../config/logger')(_0x7982('0x6'));var config=require('../../config/environment');var jayson=require(_0x7982('0x7'));var client=jayson[_0x7982('0x8')][_0x7982('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40629,_0x3e6f0e,_0x23e819){return new BPromise(function(_0x5749a4,_0x13f2bc){return client['request'](_0x40629,_0x23e819)[_0x7982('0xa')](function(_0x164089){logger[_0x7982('0xb')](_0x7982('0xc'),_0x3e6f0e,_0x7982('0xd'));logger[_0x7982('0xe')](_0x7982('0xf'),_0x3e6f0e,_0x7982('0xd'),JSON[_0x7982('0x10')](_0x164089));if(_0x164089[_0x7982('0x11')]){if(_0x164089[_0x7982('0x11')][_0x7982('0x12')]===0x1f4){logger[_0x7982('0x11')](_0x7982('0xc'),_0x3e6f0e,_0x164089[_0x7982('0x11')][_0x7982('0x13')]);return _0x13f2bc(_0x164089[_0x7982('0x11')][_0x7982('0x13')]);}logger[_0x7982('0x11')](_0x7982('0xc'),_0x3e6f0e,_0x164089['error'][_0x7982('0x13')]);return _0x5749a4(_0x164089['error'][_0x7982('0x13')]);}else{logger[_0x7982('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3e6f0e,_0x7982('0xd'));_0x5749a4(_0x164089['result'][_0x7982('0x13')]);}})[_0x7982('0x14')](function(_0x5dbe97){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x3e6f0e,_0x5dbe97);_0x13f2bc(_0x5dbe97);});});} \ No newline at end of file +var _0x28fe=['result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x376db5,_0x2b8874){var _0x304c17=function(_0x2dd9ba){while(--_0x2dd9ba){_0x376db5['push'](_0x376db5['shift']());}};_0x304c17(++_0x2b8874);}(_0x28fe,0xff));var _0xe28f=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x28fe[_0x59d89e];return _0x554e93;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe28f('0x0'));var BPromise=require(_0xe28f('0x1'));var rs=require(_0xe28f('0x2'));var fs=require('fs');var Redis=require(_0xe28f('0x3'));var db=require(_0xe28f('0x4'))['db'];var utils=require(_0xe28f('0x5'));var logger=require(_0xe28f('0x6'))(_0xe28f('0x7'));var config=require(_0xe28f('0x8'));var jayson=require(_0xe28f('0x9'));var client=jayson[_0xe28f('0xa')][_0xe28f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29aa4e,_0x4f536a,_0x26923d){return new BPromise(function(_0x4fccef,_0x4c5d8e){return client[_0xe28f('0xc')](_0x29aa4e,_0x26923d)[_0xe28f('0xd')](function(_0x99d795){logger[_0xe28f('0xe')](_0xe28f('0xf'),_0x4f536a,_0xe28f('0x10'));logger[_0xe28f('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x4f536a,_0xe28f('0x10'),JSON[_0xe28f('0x12')](_0x99d795));if(_0x99d795[_0xe28f('0x13')]){if(_0x99d795[_0xe28f('0x13')]['code']===0x1f4){logger[_0xe28f('0x13')](_0xe28f('0xf'),_0x4f536a,_0x99d795[_0xe28f('0x13')]['message']);return _0x4c5d8e(_0x99d795['error'][_0xe28f('0x14')]);}logger[_0xe28f('0x13')](_0xe28f('0xf'),_0x4f536a,_0x99d795[_0xe28f('0x13')][_0xe28f('0x14')]);return _0x4fccef(_0x99d795['error'][_0xe28f('0x14')]);}else{logger['info'](_0xe28f('0xf'),_0x4f536a,'request\x20sent');_0x4fccef(_0x99d795[_0xe28f('0x15')][_0xe28f('0x14')]);}})[_0xe28f('0x16')](function(_0x574581){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x4f536a,_0x574581);_0x4c5d8e(_0x574581);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index fc04886..b046c6a 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 _0x5a44=['isAuthenticated','index','get','show','/:id/preview','preview','run','/:id/query','query','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller'];(function(_0x42565a,_0x441e1b){var _0x4a8397=function(_0x15146e){while(--_0x15146e){_0x42565a['push'](_0x42565a['shift']());}};_0x4a8397(++_0x441e1b);}(_0x5a44,0x122));var _0x45a4=function(_0x15f4a9,_0x1b0845){_0x15f4a9=_0x15f4a9-0x0;var _0x33cf98=_0x5a44[_0x15f4a9];return _0x33cf98;};'use strict';var multer=require(_0x45a4('0x0'));var util=require(_0x45a4('0x1'));var path=require(_0x45a4('0x2'));var timeout=require(_0x45a4('0x3'));var express=require(_0x45a4('0x4'));var router=express[_0x45a4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x45a4('0x6'));var interaction=require(_0x45a4('0x7'));var config=require(_0x45a4('0x8'));var controller=require(_0x45a4('0x9'));router['get']('/',auth[_0x45a4('0xa')](),controller[_0x45a4('0xb')]);router[_0x45a4('0xc')]('/:id',auth[_0x45a4('0xa')](),controller[_0x45a4('0xd')]);router[_0x45a4('0xc')](_0x45a4('0xe'),auth['isAuthenticated'](),controller[_0x45a4('0xf')]);router[_0x45a4('0xc')]('/:id/run',auth[_0x45a4('0xa')](),controller[_0x45a4('0x10')]);router[_0x45a4('0xc')](_0x45a4('0x11'),auth['isAuthenticated'](),controller[_0x45a4('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x45a4('0x13')]);router[_0x45a4('0x14')](_0x45a4('0x15'),auth['isAuthenticated'](),controller[_0x45a4('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x45a4('0x17')]);module[_0x45a4('0x18')]=router; \ No newline at end of file +var _0xed65=['isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./analyticDefaultReport.controller'];(function(_0x3c79e2,_0x146c93){var _0x3b4b86=function(_0x35b0a8){while(--_0x35b0a8){_0x3c79e2['push'](_0x3c79e2['shift']());}};_0x3b4b86(++_0x146c93);}(_0xed65,0xa1));var _0x5ed6=function(_0x2136d5,_0x4b0479){_0x2136d5=_0x2136d5-0x0;var _0x3bee2e=_0xed65[_0x2136d5];return _0x3bee2e;};'use strict';var multer=require(_0x5ed6('0x0'));var util=require(_0x5ed6('0x1'));var path=require(_0x5ed6('0x2'));var timeout=require(_0x5ed6('0x3'));var express=require('express');var router=express[_0x5ed6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5ed6('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5ed6('0x6'));router['get']('/',auth[_0x5ed6('0x7')](),controller[_0x5ed6('0x8')]);router[_0x5ed6('0x9')](_0x5ed6('0xa'),auth[_0x5ed6('0x7')](),controller[_0x5ed6('0xb')]);router[_0x5ed6('0x9')](_0x5ed6('0xc'),auth['isAuthenticated'](),controller[_0x5ed6('0xd')]);router[_0x5ed6('0x9')](_0x5ed6('0xe'),auth[_0x5ed6('0x7')](),controller[_0x5ed6('0xf')]);router[_0x5ed6('0x9')](_0x5ed6('0x10'),auth[_0x5ed6('0x7')](),controller[_0x5ed6('0x11')]);router[_0x5ed6('0x12')]('/',auth[_0x5ed6('0x7')](),controller[_0x5ed6('0x13')]);router['put'](_0x5ed6('0xa'),auth[_0x5ed6('0x7')](),controller[_0x5ed6('0x14')]);router[_0x5ed6('0x15')](_0x5ed6('0xa'),auth[_0x5ed6('0x7')](),controller[_0x5ed6('0x16')]);module[_0x5ed6('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 8e3fc73..300161c 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 _0xe11a=['DATE','Loading','scheduled','INTEGER','UNSIGNED','exports','ENUM','csv','xlsx','STRING'];(function(_0x38c845,_0x32cfea){var _0x236b0a=function(_0x5bc1eb){while(--_0x5bc1eb){_0x38c845['push'](_0x38c845['shift']());}};_0x236b0a(++_0x32cfea);}(_0xe11a,0xcd));var _0xae11=function(_0x3742d3,_0x4ab91f){_0x3742d3=_0x3742d3-0x0;var _0x1a78be=_0xe11a[_0x3742d3];return _0x1a78be;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xae11('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xae11('0x1')](_0xae11('0x2'),'pdf',_0xae11('0x3')),'allowNull':![],'defaultValue':_0xae11('0x2')},'savename':{'type':Sequelize[_0xae11('0x4')],'allowNull':![]},'startDate':{'type':Sequelize[_0xae11('0x5')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xae11('0x4')],'defaultValue':_0xae11('0x6')},'type':{'type':Sequelize[_0xae11('0x1')]('manual',_0xae11('0x7')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xae11('0x8')](0xb)[_0xae11('0x9')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf097=['sequelize','exports','STRING','ENUM','pdf','xlsx','DATE','Loading','manual','scheduled','INTEGER'];(function(_0x125079,_0x3f07f0){var _0x55493b=function(_0x4b15bb){while(--_0x4b15bb){_0x125079['push'](_0x125079['shift']());}};_0x55493b(++_0x3f07f0);}(_0xf097,0x176));var _0x7f09=function(_0x1edd20,_0x1dbc2f){_0x1edd20=_0x1edd20-0x0;var _0x4188b9=_0xf097[_0x1edd20];return _0x4188b9;};'use strict';var Sequelize=require(_0x7f09('0x0'));var moment=require('moment');module[_0x7f09('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x7f09('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x7f09('0x3')]('csv',_0x7f09('0x4'),_0x7f09('0x5')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x7f09('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x7f09('0x6')]},'endDate':{'type':Sequelize[_0x7f09('0x6')]},'status':{'type':Sequelize[_0x7f09('0x2')],'defaultValue':_0x7f09('0x7')},'type':{'type':Sequelize[_0x7f09('0x3')](_0x7f09('0x8'),_0x7f09('0x9')),'allowNull':![],'defaultValue':_0x7f09('0x8')},'reportId':{'type':Sequelize[_0x7f09('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x7f09('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 4713aba..7acd903 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 _0x182e=['keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','savename','output','existsSync','join','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','root','format','%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','Content-Range','save','update','then','get','ExtractedReports','UserProfileResource','destroy','end','error','stack','name','index','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','map','query'];(function(_0x105783,_0x3c9334){var _0x2fc07f=function(_0x502062){while(--_0x502062){_0x105783['push'](_0x105783['shift']());}};_0x2fc07f(++_0x3c9334);}(_0x182e,0x1a4));var _0xe182=function(_0x48999d,_0x1e02cb){_0x48999d=_0x48999d-0x0;var _0x1ad0d1=_0x182e[_0x48999d];return _0x1ad0d1;};'use strict';var emlformat=require(_0xe182('0x0'));var rimraf=require(_0xe182('0x1'));var zipdir=require(_0xe182('0x2'));var jsonpatch=require(_0xe182('0x3'));var rp=require(_0xe182('0x4'));var moment=require('moment');var BPromise=require(_0xe182('0x5'));var Mustache=require('mustache');var util=require(_0xe182('0x6'));var path=require(_0xe182('0x7'));var sox=require(_0xe182('0x8'));var csv=require('to-csv');var ejs=require(_0xe182('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe182('0xa'));var squel=require('squel');var crypto=require(_0xe182('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe182('0xc'));var toCsv=require(_0xe182('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe182('0xe'));var authService=require(_0xe182('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe182('0x10'));var hardwareService=require(_0xe182('0x11'));var logger=require(_0xe182('0x12'))('api');var utils=require(_0xe182('0x13'));var config=require(_0xe182('0x14'));var licenseUtil=require(_0xe182('0x15'));var db=require(_0xe182('0x16'))['db'];function respondWithStatusCode(_0x4cd7ff,_0x1acb9b){_0x1acb9b=_0x1acb9b||0xcc;return function(_0xf90ad1){if(_0xf90ad1){return _0x4cd7ff[_0xe182('0x17')](_0x1acb9b);}return _0x4cd7ff[_0xe182('0x18')](_0x1acb9b)['end']();};}function respondWithResult(_0x36728b,_0x121129){_0x121129=_0x121129||0xc8;return function(_0xa24ab4){if(_0xa24ab4){return _0x36728b[_0xe182('0x18')](_0x121129)[_0xe182('0x19')](_0xa24ab4);}};}function respondWithFilteredResult(_0x38553b,_0x2c13aa){return function(_0x279879){if(_0x279879){var _0x51e2c6=typeof _0x2c13aa[_0xe182('0x1a')]===_0xe182('0x1b')&&typeof _0x2c13aa[_0xe182('0x1c')]===_0xe182('0x1b');var _0x3ba538=_0x279879['count'];var _0x126243=_0x51e2c6?0x0:_0x2c13aa['offset'];var _0x4c11e1=_0x51e2c6?_0x279879['count']:_0x2c13aa[_0xe182('0x1a')]+_0x2c13aa[_0xe182('0x1c')];var _0x421aea;if(_0x4c11e1>=_0x3ba538){_0x4c11e1=_0x3ba538;_0x421aea=0xc8;}else{_0x421aea=0xce;}_0x38553b['status'](_0x421aea);return _0x38553b['set'](_0xe182('0x1d'),_0x126243+'-'+_0x4c11e1+'/'+_0x3ba538)[_0xe182('0x19')](_0x279879);}return null;};}function patchUpdates(_0x32f144){return function(_0x50cf5a){try{jsonpatch['apply'](_0x50cf5a,_0x32f144,!![]);}catch(_0x227de5){return BPromise['reject'](_0x227de5);}return _0x50cf5a[_0xe182('0x1e')]();};}function saveUpdates(_0x3fc1d3,_0xc18770){return function(_0x404408){if(_0x404408){return _0x404408[_0xe182('0x1f')](_0x3fc1d3)[_0xe182('0x20')](function(_0x6c4005){return _0x6c4005;});}return null;};}function removeEntity(_0x5647a9,_0x4dcd8a){return function(_0x3ff52f){if(_0x3ff52f){return _0x3ff52f['destroy']()[_0xe182('0x20')](function(){var _0x39920e=_0x3ff52f[_0xe182('0x21')]({'plain':!![]});var _0x1cd666=_0xe182('0x22');return db[_0xe182('0x23')][_0xe182('0x24')]({'where':{'type':_0x1cd666,'resourceId':_0x39920e['id']}})[_0xe182('0x20')](function(){return _0x3ff52f;});})[_0xe182('0x20')](function(){_0x5647a9[_0xe182('0x18')](0xcc)[_0xe182('0x25')]();});}};}function handleEntityNotFound(_0x51901c,_0x1aca7e){return function(_0x15b0c6){if(!_0x15b0c6){_0x51901c[_0xe182('0x17')](0x194);}return _0x15b0c6;};}function handleError(_0xd6d268,_0x427bda){_0x427bda=_0x427bda||0x1f4;return function(_0x4d9385){logger[_0xe182('0x26')](_0x4d9385[_0xe182('0x27')]);if(_0x4d9385['name']){delete _0x4d9385[_0xe182('0x28')];}_0xd6d268['status'](_0x427bda)['send'](_0x4d9385);};}exports[_0xe182('0x29')]=function(_0x3c9e3e,_0x530a3f){var _0x5e1b76={},_0xeafff7={},_0x3d38f3={'count':0x0,'rows':[]};var _0x1768f1=_['map'](db[_0xe182('0x2a')][_0xe182('0x2b')],function(_0x4cb0ca){return{'name':_0x4cb0ca[_0xe182('0x2c')],'type':_0x4cb0ca[_0xe182('0x2d')][_0xe182('0x2e')]};});_0xeafff7[_0xe182('0x2f')]=_[_0xe182('0x30')](_0x1768f1,_0xe182('0x28'));_0xeafff7[_0xe182('0x31')]=_[_0xe182('0x32')](_0x3c9e3e[_0xe182('0x31')]);_0xeafff7['filters']=_[_0xe182('0x33')](_0xeafff7[_0xe182('0x2f')],_0xeafff7[_0xe182('0x31')]);_0x5e1b76[_0xe182('0x34')]=_[_0xe182('0x33')](_0xeafff7[_0xe182('0x2f')],qs['fields'](_0x3c9e3e[_0xe182('0x31')][_0xe182('0x35')]));_0x5e1b76[_0xe182('0x34')]=_0x5e1b76[_0xe182('0x34')][_0xe182('0x36')]?_0x5e1b76[_0xe182('0x34')]:_0xeafff7[_0xe182('0x2f')];if(!_0x3c9e3e[_0xe182('0x31')][_0xe182('0x37')]('nolimit')){_0x5e1b76['limit']=qs[_0xe182('0x1c')](_0x3c9e3e[_0xe182('0x31')][_0xe182('0x1c')]);_0x5e1b76['offset']=qs[_0xe182('0x1a')](_0x3c9e3e[_0xe182('0x31')]['offset']);}_0x5e1b76['order']=qs[_0xe182('0x38')](_0x3c9e3e[_0xe182('0x31')][_0xe182('0x38')]);_0x5e1b76[_0xe182('0x39')]=qs[_0xe182('0x3a')](_[_0xe182('0x3b')](_0x3c9e3e[_0xe182('0x31')],_0xeafff7[_0xe182('0x3a')]),_0x1768f1);if(_0x3c9e3e['query'][_0xe182('0x3c')]){_0x5e1b76[_0xe182('0x39')]=_[_0xe182('0x3d')](_0x5e1b76[_0xe182('0x39')],{'$or':_[_0xe182('0x30')](_0x1768f1,function(_0x26691e){if(_0x26691e[_0xe182('0x2d')]!==_0xe182('0x3e')){var _0x36fdec={};_0x36fdec[_0x26691e[_0xe182('0x28')]]={'$like':'%'+_0x3c9e3e[_0xe182('0x31')]['filter']+'%'};return _0x36fdec;}})});}_0x5e1b76=_[_0xe182('0x3d')]({},_0x5e1b76,_0x3c9e3e[_0xe182('0x3f')]);var _0x34098f={'where':_0x5e1b76[_0xe182('0x39')]};return db[_0xe182('0x2a')][_0xe182('0x40')](_0x34098f)[_0xe182('0x20')](function(_0x1aca48){_0x3d38f3[_0xe182('0x40')]=_0x1aca48;if(_0x3c9e3e['query'][_0xe182('0x41')]){_0x5e1b76[_0xe182('0x42')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xe182('0x43')](_0x5e1b76);})[_0xe182('0x20')](function(_0x581389){_0x3d38f3[_0xe182('0x44')]=_0x581389;return _0x3d38f3;})[_0xe182('0x20')](respondWithFilteredResult(_0x530a3f,_0x5e1b76))[_0xe182('0x45')](handleError(_0x530a3f,null));};exports[_0xe182('0x46')]=function(_0x2b08fa,_0xd426f7){var _0x42212e={'raw':!![],'where':{'id':_0x2b08fa[_0xe182('0x47')]['id']}},_0x5dc48e={};_0x5dc48e[_0xe182('0x2f')]=_[_0xe182('0x32')](db[_0xe182('0x2a')][_0xe182('0x2b')]);_0x5dc48e[_0xe182('0x31')]=_['keys'](_0x2b08fa[_0xe182('0x31')]);_0x5dc48e[_0xe182('0x3a')]=_[_0xe182('0x33')](_0x5dc48e[_0xe182('0x2f')],_0x5dc48e[_0xe182('0x31')]);_0x42212e[_0xe182('0x34')]=_[_0xe182('0x33')](_0x5dc48e['model'],qs['fields'](_0x2b08fa[_0xe182('0x31')][_0xe182('0x35')]));_0x42212e[_0xe182('0x34')]=_0x42212e[_0xe182('0x34')][_0xe182('0x36')]?_0x42212e[_0xe182('0x34')]:_0x5dc48e['model'];if(_0x2b08fa[_0xe182('0x31')][_0xe182('0x41')]){_0x42212e[_0xe182('0x42')]=[{'all':!![]}];}_0x42212e=_['merge']({},_0x42212e,_0x2b08fa['options']);return db[_0xe182('0x2a')][_0xe182('0x48')](_0x42212e)[_0xe182('0x20')](handleEntityNotFound(_0xd426f7,null))[_0xe182('0x20')](respondWithResult(_0xd426f7,null))['catch'](handleError(_0xd426f7,null));};exports[_0xe182('0x49')]=function(_0x5feb79,_0x2eb712){return db['AnalyticExtractedReport'][_0xe182('0x49')](_0x5feb79[_0xe182('0x4a')],{})[_0xe182('0x20')](function(_0x4dbfbf){var _0x5b5893=_0x5feb79[_0xe182('0x4b')][_0xe182('0x21')]({'plain':!![]});if(!_0x5b5893)throw new Error(_0xe182('0x4c'));if(_0x5b5893[_0xe182('0x4d')]===_0xe182('0x4b')){var _0x1928e4=_0x4dbfbf[_0xe182('0x21')]({'plain':!![]});var _0xf72848=_0xe182('0x22');return db['UserProfileSection'][_0xe182('0x48')]({'where':{'name':_0xf72848,'userProfileId':_0x5b5893[_0xe182('0x4e')]},'raw':!![]})[_0xe182('0x20')](function(_0x2cfe0d){if(_0x2cfe0d&&_0x2cfe0d[_0xe182('0x4f')]===0x0){return db[_0xe182('0x23')]['create']({'name':_0x1928e4[_0xe182('0x28')],'resourceId':_0x1928e4['id'],'type':_0x2cfe0d[_0xe182('0x28')],'sectionId':_0x2cfe0d['id']},{})['then'](function(){return _0x4dbfbf;});}else{return _0x4dbfbf;}})[_0xe182('0x45')](function(_0x2c1bc4){logger[_0xe182('0x26')](_0xe182('0x50'),_0x2c1bc4);throw _0x2c1bc4;});}return _0x4dbfbf;})[_0xe182('0x20')](respondWithResult(_0x2eb712,0xc9))['catch'](handleError(_0x2eb712,null));};exports['update']=function(_0x1b19d1,_0x30f68c){if(_0x1b19d1[_0xe182('0x4a')]['id']){delete _0x1b19d1[_0xe182('0x4a')]['id'];}return db[_0xe182('0x2a')][_0xe182('0x48')]({'where':{'id':_0x1b19d1[_0xe182('0x47')]['id']}})[_0xe182('0x20')](handleEntityNotFound(_0x30f68c,null))['then'](saveUpdates(_0x1b19d1[_0xe182('0x4a')],null))[_0xe182('0x20')](respondWithResult(_0x30f68c,null))[_0xe182('0x45')](handleError(_0x30f68c,null));};exports[_0xe182('0x24')]=function(_0x4580ec,_0x203d56){return db[_0xe182('0x2a')][_0xe182('0x48')]({'where':{'id':_0x4580ec[_0xe182('0x47')]['id']}})['then'](handleEntityNotFound(_0x203d56,null))[_0xe182('0x20')](removeEntity(_0x203d56,null))[_0xe182('0x45')](handleError(_0x203d56,null));};exports['download']=function(_0x25a283,_0x15c9ad,_0x57dc09){return db[_0xe182('0x2a')][_0xe182('0x48')]({'where':{'id':_0x25a283['params']['id']},'attributes':['name',_0xe182('0x51'),_0xe182('0x52'),_0xe182('0x53')],'raw':!![]})[_0xe182('0x20')](handleEntityNotFound(_0x15c9ad,null))['then'](function(_0x5ee86a){if(_0x5ee86a){if(!fs[_0xe182('0x54')](path[_0xe182('0x55')](config['root'],_0xe182('0x56'),_0x5ee86a['savename']))){throw new db[(_0xe182('0x57'))][(_0xe182('0x58'))](_0xe182('0x59'));}if(_0x25a283[_0xe182('0x31')][_0xe182('0x5a')]){return _0x15c9ad[_0xe182('0x17')](0xc8);}return _0x15c9ad['download'](path[_0xe182('0x55')](config[_0xe182('0x5b')],_0xe182('0x56'),_0x5ee86a[_0xe182('0x52')]),util[_0xe182('0x5c')](_0xe182('0x5d'),_0x5ee86a['basename']||_0x5ee86a[_0xe182('0x28')],_0x5ee86a[_0xe182('0x53')]['toLowerCase']()));}})[_0xe182('0x45')](handleError(_0x15c9ad,null));}; \ No newline at end of file +var _0xada0=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','server/files/reports','output','toLowerCase','rimraf','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','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','get','ExtractedReports','destroy','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource'];(function(_0x5275f2,_0x243d58){var _0x34f3f0=function(_0x2496db){while(--_0x2496db){_0x5275f2['push'](_0x5275f2['shift']());}};_0x34f3f0(++_0x243d58);}(_0xada0,0x12c));var _0x0ada=function(_0x173c5b,_0xbdbfff){_0x173c5b=_0x173c5b-0x0;var _0xab9e07=_0xada0[_0x173c5b];return _0xab9e07;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0ada('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0ada('0x1'));var rp=require(_0x0ada('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0ada('0x3'));var util=require(_0x0ada('0x4'));var path=require(_0x0ada('0x5'));var sox=require(_0x0ada('0x6'));var csv=require(_0x0ada('0x7'));var ejs=require(_0x0ada('0x8'));var fs=require('fs');var fs_extra=require(_0x0ada('0x9'));var _=require(_0x0ada('0xa'));var squel=require(_0x0ada('0xb'));var crypto=require(_0x0ada('0xc'));var jsforce=require(_0x0ada('0xd'));var deskjs=require(_0x0ada('0xe'));var toCsv=require(_0x0ada('0x7'));var querystring=require(_0x0ada('0xf'));var Papa=require(_0x0ada('0x10'));var Redis=require(_0x0ada('0x11'));var authService=require(_0x0ada('0x12'));var qs=require(_0x0ada('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0ada('0x14'));var logger=require('../../config/logger')(_0x0ada('0x15'));var utils=require('../../config/utils');var config=require(_0x0ada('0x16'));var licenseUtil=require(_0x0ada('0x17'));var db=require(_0x0ada('0x18'))['db'];function respondWithStatusCode(_0x165c2a,_0x2f3cbf){_0x2f3cbf=_0x2f3cbf||0xcc;return function(_0x5acad6){if(_0x5acad6){return _0x165c2a[_0x0ada('0x19')](_0x2f3cbf);}return _0x165c2a[_0x0ada('0x1a')](_0x2f3cbf)[_0x0ada('0x1b')]();};}function respondWithResult(_0x268b93,_0xb314e8){_0xb314e8=_0xb314e8||0xc8;return function(_0x33e19d){if(_0x33e19d){return _0x268b93[_0x0ada('0x1a')](_0xb314e8)[_0x0ada('0x1c')](_0x33e19d);}};}function respondWithFilteredResult(_0x2c2e9f,_0x5bee1e){return function(_0x2e8ab8){if(_0x2e8ab8){var _0x292ce8=typeof _0x5bee1e[_0x0ada('0x1d')]===_0x0ada('0x1e')&&typeof _0x5bee1e[_0x0ada('0x1f')]==='undefined';var _0x953b29=_0x2e8ab8['count'];var _0x592d3e=_0x292ce8?0x0:_0x5bee1e['offset'];var _0x1b417f=_0x292ce8?_0x2e8ab8[_0x0ada('0x20')]:_0x5bee1e[_0x0ada('0x1d')]+_0x5bee1e[_0x0ada('0x1f')];var _0x4a5010;if(_0x1b417f>=_0x953b29){_0x1b417f=_0x953b29;_0x4a5010=0xc8;}else{_0x4a5010=0xce;}_0x2c2e9f[_0x0ada('0x1a')](_0x4a5010);return _0x2c2e9f[_0x0ada('0x21')]('Content-Range',_0x592d3e+'-'+_0x1b417f+'/'+_0x953b29)[_0x0ada('0x1c')](_0x2e8ab8);}return null;};}function patchUpdates(_0x56d87e){return function(_0x894958){try{jsonpatch[_0x0ada('0x22')](_0x894958,_0x56d87e,!![]);}catch(_0x3f9961){return BPromise['reject'](_0x3f9961);}return _0x894958[_0x0ada('0x23')]();};}function saveUpdates(_0x3fe1e5,_0x2fb70c){return function(_0x1c62a8){if(_0x1c62a8){return _0x1c62a8[_0x0ada('0x24')](_0x3fe1e5)['then'](function(_0x3bf3ec){return _0x3bf3ec;});}return null;};}function removeEntity(_0xa6d0d8,_0x2f75e8){return function(_0x27afb5){if(_0x27afb5){return _0x27afb5['destroy']()[_0x0ada('0x25')](function(){var _0x1d4de3=_0x27afb5[_0x0ada('0x26')]({'plain':!![]});var _0x587e65=_0x0ada('0x27');return db['UserProfileResource'][_0x0ada('0x28')]({'where':{'type':_0x587e65,'resourceId':_0x1d4de3['id']}})[_0x0ada('0x25')](function(){return _0x27afb5;});})['then'](function(){_0xa6d0d8[_0x0ada('0x1a')](0xcc)[_0x0ada('0x1b')]();});}};}function handleEntityNotFound(_0x5763fa,_0x3f895c){return function(_0x547e0e){if(!_0x547e0e){_0x5763fa[_0x0ada('0x19')](0x194);}return _0x547e0e;};}function handleError(_0x4e7516,_0x20a3c0){_0x20a3c0=_0x20a3c0||0x1f4;return function(_0x1e3e04){logger[_0x0ada('0x29')](_0x1e3e04[_0x0ada('0x2a')]);if(_0x1e3e04[_0x0ada('0x2b')]){delete _0x1e3e04['name'];}_0x4e7516['status'](_0x20a3c0)[_0x0ada('0x2c')](_0x1e3e04);};}exports[_0x0ada('0x2d')]=function(_0x51b910,_0x5465c4){var _0x5c3cef={},_0xa108e8={},_0x4d73f7={'count':0x0,'rows':[]};var _0x44a411=_[_0x0ada('0x2e')](db[_0x0ada('0x2f')][_0x0ada('0x30')],function(_0x43311c){return{'name':_0x43311c[_0x0ada('0x31')],'type':_0x43311c['type'][_0x0ada('0x32')]};});_0xa108e8[_0x0ada('0x33')]=_[_0x0ada('0x2e')](_0x44a411,_0x0ada('0x2b'));_0xa108e8['query']=_[_0x0ada('0x34')](_0x51b910[_0x0ada('0x35')]);_0xa108e8[_0x0ada('0x36')]=_['intersection'](_0xa108e8['model'],_0xa108e8[_0x0ada('0x35')]);_0x5c3cef[_0x0ada('0x37')]=_[_0x0ada('0x38')](_0xa108e8['model'],qs['fields'](_0x51b910[_0x0ada('0x35')][_0x0ada('0x39')]));_0x5c3cef[_0x0ada('0x37')]=_0x5c3cef[_0x0ada('0x37')][_0x0ada('0x3a')]?_0x5c3cef['attributes']:_0xa108e8[_0x0ada('0x33')];if(!_0x51b910[_0x0ada('0x35')][_0x0ada('0x3b')](_0x0ada('0x3c'))){_0x5c3cef[_0x0ada('0x1f')]=qs[_0x0ada('0x1f')](_0x51b910[_0x0ada('0x35')][_0x0ada('0x1f')]);_0x5c3cef['offset']=qs[_0x0ada('0x1d')](_0x51b910[_0x0ada('0x35')][_0x0ada('0x1d')]);}_0x5c3cef[_0x0ada('0x3d')]=qs[_0x0ada('0x3e')](_0x51b910['query'][_0x0ada('0x3e')]);_0x5c3cef[_0x0ada('0x3f')]=qs[_0x0ada('0x36')](_['pick'](_0x51b910[_0x0ada('0x35')],_0xa108e8[_0x0ada('0x36')]),_0x44a411);if(_0x51b910[_0x0ada('0x35')][_0x0ada('0x40')]){_0x5c3cef['where']=_[_0x0ada('0x41')](_0x5c3cef['where'],{'$or':_[_0x0ada('0x2e')](_0x44a411,function(_0x379da6){if(_0x379da6[_0x0ada('0x42')]!==_0x0ada('0x43')){var _0x3a0e31={};_0x3a0e31[_0x379da6[_0x0ada('0x2b')]]={'$like':'%'+_0x51b910[_0x0ada('0x35')][_0x0ada('0x40')]+'%'};return _0x3a0e31;}})});}_0x5c3cef=_[_0x0ada('0x41')]({},_0x5c3cef,_0x51b910[_0x0ada('0x44')]);var _0x253c55={'where':_0x5c3cef[_0x0ada('0x3f')]};return db[_0x0ada('0x2f')][_0x0ada('0x20')](_0x253c55)['then'](function(_0x1a0b87){_0x4d73f7[_0x0ada('0x20')]=_0x1a0b87;if(_0x51b910[_0x0ada('0x35')][_0x0ada('0x45')]){_0x5c3cef[_0x0ada('0x46')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x5c3cef);})[_0x0ada('0x25')](function(_0x5266fa){_0x4d73f7[_0x0ada('0x47')]=_0x5266fa;return _0x4d73f7;})[_0x0ada('0x25')](respondWithFilteredResult(_0x5465c4,_0x5c3cef))[_0x0ada('0x48')](handleError(_0x5465c4,null));};exports[_0x0ada('0x49')]=function(_0x37ffcf,_0x2ced23){var _0x30713e={'raw':!![],'where':{'id':_0x37ffcf[_0x0ada('0x4a')]['id']}},_0x423003={};_0x423003['model']=_[_0x0ada('0x34')](db[_0x0ada('0x2f')][_0x0ada('0x30')]);_0x423003[_0x0ada('0x35')]=_['keys'](_0x37ffcf[_0x0ada('0x35')]);_0x423003['filters']=_[_0x0ada('0x38')](_0x423003[_0x0ada('0x33')],_0x423003[_0x0ada('0x35')]);_0x30713e[_0x0ada('0x37')]=_['intersection'](_0x423003['model'],qs[_0x0ada('0x39')](_0x37ffcf[_0x0ada('0x35')]['fields']));_0x30713e['attributes']=_0x30713e['attributes'][_0x0ada('0x3a')]?_0x30713e[_0x0ada('0x37')]:_0x423003[_0x0ada('0x33')];if(_0x37ffcf[_0x0ada('0x35')][_0x0ada('0x45')]){_0x30713e[_0x0ada('0x46')]=[{'all':!![]}];}_0x30713e=_[_0x0ada('0x41')]({},_0x30713e,_0x37ffcf[_0x0ada('0x44')]);return db[_0x0ada('0x2f')]['find'](_0x30713e)[_0x0ada('0x25')](handleEntityNotFound(_0x2ced23,null))[_0x0ada('0x25')](respondWithResult(_0x2ced23,null))[_0x0ada('0x48')](handleError(_0x2ced23,null));};exports[_0x0ada('0x4b')]=function(_0x510ac2,_0x483653){return db[_0x0ada('0x2f')][_0x0ada('0x4b')](_0x510ac2[_0x0ada('0x4c')],{})['then'](function(_0x38f4df){var _0x289ef9=_0x510ac2[_0x0ada('0x4d')]['get']({'plain':!![]});if(!_0x289ef9)throw new Error(_0x0ada('0x4e'));if(_0x289ef9[_0x0ada('0x4f')]==='user'){var _0x1b50db=_0x38f4df['get']({'plain':!![]});var _0x2551c3=_0x0ada('0x27');return db['UserProfileSection'][_0x0ada('0x50')]({'where':{'name':_0x2551c3,'userProfileId':_0x289ef9[_0x0ada('0x51')]},'raw':!![]})[_0x0ada('0x25')](function(_0x150757){if(_0x150757&&_0x150757[_0x0ada('0x52')]===0x0){return db[_0x0ada('0x53')]['create']({'name':_0x1b50db['name'],'resourceId':_0x1b50db['id'],'type':_0x150757[_0x0ada('0x2b')],'sectionId':_0x150757['id']},{})[_0x0ada('0x25')](function(){return _0x38f4df;});}else{return _0x38f4df;}})[_0x0ada('0x48')](function(_0xabbdd0){logger[_0x0ada('0x29')](_0x0ada('0x54'),_0xabbdd0);throw _0xabbdd0;});}return _0x38f4df;})[_0x0ada('0x25')](respondWithResult(_0x483653,0xc9))['catch'](handleError(_0x483653,null));};exports[_0x0ada('0x24')]=function(_0x48683c,_0x589961){if(_0x48683c[_0x0ada('0x4c')]['id']){delete _0x48683c[_0x0ada('0x4c')]['id'];}return db[_0x0ada('0x2f')]['find']({'where':{'id':_0x48683c['params']['id']}})[_0x0ada('0x25')](handleEntityNotFound(_0x589961,null))['then'](saveUpdates(_0x48683c[_0x0ada('0x4c')],null))[_0x0ada('0x25')](respondWithResult(_0x589961,null))[_0x0ada('0x48')](handleError(_0x589961,null));};exports[_0x0ada('0x28')]=function(_0x3835e1,_0x258b2d){return db[_0x0ada('0x2f')][_0x0ada('0x50')]({'where':{'id':_0x3835e1[_0x0ada('0x4a')]['id']}})['then'](handleEntityNotFound(_0x258b2d,null))[_0x0ada('0x25')](removeEntity(_0x258b2d,null))['catch'](handleError(_0x258b2d,null));};exports[_0x0ada('0x55')]=function(_0x230147,_0x47bdac,_0x1d21a7){return db[_0x0ada('0x2f')][_0x0ada('0x50')]({'where':{'id':_0x230147[_0x0ada('0x4a')]['id']},'attributes':[_0x0ada('0x2b'),_0x0ada('0x56'),_0x0ada('0x57'),'output'],'raw':!![]})[_0x0ada('0x25')](handleEntityNotFound(_0x47bdac,null))['then'](function(_0x8086ec){if(_0x8086ec){if(!fs['existsSync'](path[_0x0ada('0x58')](config[_0x0ada('0x59')],'server/files/reports',_0x8086ec['savename']))){throw new db[(_0x0ada('0x5a'))][(_0x0ada('0x5b'))](_0x0ada('0x5c'));}if(_0x230147[_0x0ada('0x35')]['exists']){return _0x47bdac['sendStatus'](0xc8);}return _0x47bdac['download'](path[_0x0ada('0x58')](config['root'],_0x0ada('0x5d'),_0x8086ec['savename']),util['format']('%s.%s',_0x8086ec['basename']||_0x8086ec[_0x0ada('0x2b')],_0x8086ec[_0x0ada('0x5e')][_0x0ada('0x5f')]()));}})[_0x0ada('0x48')](handleError(_0x47bdac,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index cf1a975..c026f01 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 _0xf005=['define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','bluebird','../../config/environment','./analyticExtractedReport.attributes'];(function(_0xe011b,_0x2b556b){var _0x58b75d=function(_0x35eb99){while(--_0x35eb99){_0xe011b['push'](_0xe011b['shift']());}};_0x58b75d(++_0x2b556b);}(_0xf005,0xc1));var _0x5f00=function(_0x1bf59f,_0x1aaf99){_0x1bf59f=_0x1bf59f-0x0;var _0x285449=_0xf005[_0x1bf59f];return _0x285449;};'use strict';var _=require(_0x5f00('0x0'));var util=require(_0x5f00('0x1'));var logger=require(_0x5f00('0x2'))(_0x5f00('0x3'));var moment=require('moment');var BPromise=require(_0x5f00('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5f00('0x5'));var attributes=require(_0x5f00('0x6'));module['exports']=function(_0x41538b,_0x2c009a){return _0x41538b[_0x5f00('0x7')](_0x5f00('0x8'),attributes,{'tableName':_0x5f00('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1fb=['request-promise','path','../../config/environment','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x50f3b9,_0x466e0c){var _0x1ca787=function(_0x648331){while(--_0x648331){_0x50f3b9['push'](_0x50f3b9['shift']());}};_0x1ca787(++_0x466e0c);}(_0xf1fb,0x13f));var _0xbf1f=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xf1fb[_0x176329];return _0x31997c;};'use strict';var _=require(_0xbf1f('0x0'));var util=require(_0xbf1f('0x1'));var logger=require(_0xbf1f('0x2'))(_0xbf1f('0x3'));var moment=require(_0xbf1f('0x4'));var BPromise=require(_0xbf1f('0x5'));var rp=require(_0xbf1f('0x6'));var fs=require('fs');var path=require(_0xbf1f('0x7'));var rimraf=require('rimraf');var config=require(_0xbf1f('0x8'));var attributes=require(_0xbf1f('0x9'));module[_0xbf1f('0xa')]=function(_0x4aa3c0,_0x2cce76){return _0x4aa3c0[_0xbf1f('0xb')]('AnalyticExtractedReport',attributes,{'tableName':_0xbf1f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 8a0870c..726cde5 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 _0x9b37=['info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x1d5d6a,_0x18fd59){var _0x1b77dd=function(_0x5a5c63){while(--_0x5a5c63){_0x1d5d6a['push'](_0x1d5d6a['shift']());}};_0x1b77dd(++_0x18fd59);}(_0x9b37,0x184));var _0x79b3=function(_0x25fc41,_0x250864){_0x25fc41=_0x25fc41-0x0;var _0x1371d1=_0x9b37[_0x25fc41];return _0x1371d1;};'use strict';var _=require(_0x79b3('0x0'));var util=require(_0x79b3('0x1'));var moment=require(_0x79b3('0x2'));var BPromise=require('bluebird');var rs=require(_0x79b3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x79b3('0x4'));var logger=require(_0x79b3('0x5'))(_0x79b3('0x6'));var config=require(_0x79b3('0x7'));var jayson=require(_0x79b3('0x8'));var client=jayson[_0x79b3('0x9')][_0x79b3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13d27b,_0x5bfe9b,_0x1cb698){return new BPromise(function(_0x492c4e,_0x2ce8ad){return client[_0x79b3('0xb')](_0x13d27b,_0x1cb698)['then'](function(_0x37d8a2){logger[_0x79b3('0xc')](_0x79b3('0xd'),_0x5bfe9b,_0x79b3('0xe'));logger[_0x79b3('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x5bfe9b,_0x79b3('0xe'),JSON['stringify'](_0x37d8a2));if(_0x37d8a2[_0x79b3('0x10')]){if(_0x37d8a2[_0x79b3('0x10')]['code']===0x1f4){logger[_0x79b3('0x10')](_0x79b3('0xd'),_0x5bfe9b,_0x37d8a2['error']['message']);return _0x2ce8ad(_0x37d8a2[_0x79b3('0x10')][_0x79b3('0x11')]);}logger[_0x79b3('0x10')](_0x79b3('0xd'),_0x5bfe9b,_0x37d8a2[_0x79b3('0x10')][_0x79b3('0x11')]);return _0x492c4e(_0x37d8a2[_0x79b3('0x10')]['message']);}else{logger[_0x79b3('0xc')](_0x79b3('0xd'),_0x5bfe9b,_0x79b3('0xe'));_0x492c4e(_0x37d8a2[_0x79b3('0x12')]['message']);}})[_0x79b3('0x13')](function(_0x2ed133){logger[_0x79b3('0x10')](_0x79b3('0xd'),_0x5bfe9b,_0x2ed133);_0x2ce8ad(_0x2ed133);});});} \ No newline at end of file +var _0x5208=['then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x51aa5b,_0x512fc0){var _0x5066d8=function(_0x2bdda9){while(--_0x2bdda9){_0x51aa5b['push'](_0x51aa5b['shift']());}};_0x5066d8(++_0x512fc0);}(_0x5208,0x1e9));var _0x8520=function(_0x158e6c,_0xaab4ed){_0x158e6c=_0x158e6c-0x0;var _0x3c26db=_0x5208[_0x158e6c];return _0x3c26db;};'use strict';var _=require(_0x8520('0x0'));var util=require(_0x8520('0x1'));var moment=require('moment');var BPromise=require(_0x8520('0x2'));var rs=require(_0x8520('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8520('0x4'));var logger=require(_0x8520('0x5'))(_0x8520('0x6'));var config=require(_0x8520('0x7'));var jayson=require(_0x8520('0x8'));var client=jayson['client'][_0x8520('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31e786,_0x44b7c9,_0x21f2b5){return new BPromise(function(_0x15ebb9,_0xc9b058){return client[_0x8520('0xa')](_0x31e786,_0x21f2b5)[_0x8520('0xb')](function(_0x22eb90){logger[_0x8520('0xc')](_0x8520('0xd'),_0x44b7c9,_0x8520('0xe'));logger[_0x8520('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x44b7c9,_0x8520('0xe'),JSON['stringify'](_0x22eb90));if(_0x22eb90[_0x8520('0x10')]){if(_0x22eb90[_0x8520('0x10')][_0x8520('0x11')]===0x1f4){logger[_0x8520('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x44b7c9,_0x22eb90[_0x8520('0x10')][_0x8520('0x12')]);return _0xc9b058(_0x22eb90[_0x8520('0x10')][_0x8520('0x12')]);}logger['error'](_0x8520('0xd'),_0x44b7c9,_0x22eb90[_0x8520('0x10')]['message']);return _0x15ebb9(_0x22eb90[_0x8520('0x10')][_0x8520('0x12')]);}else{logger[_0x8520('0xc')](_0x8520('0xd'),_0x44b7c9,_0x8520('0xe'));_0x15ebb9(_0x22eb90['result'][_0x8520('0x12')]);}})[_0x8520('0x13')](function(_0x457be0){logger[_0x8520('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x44b7c9,_0x457be0);_0xc9b058(_0x457be0);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index a838c81..7a40ae9 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 _0x149b=['index','/:id','/:id/download','isAuthenticated','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get'];(function(_0x566f77,_0x275098){var _0x1e94a6=function(_0x571676){while(--_0x571676){_0x566f77['push'](_0x566f77['shift']());}};_0x1e94a6(++_0x275098);}(_0x149b,0xa2));var _0xb149=function(_0x4a4aee,_0xe2f294){_0x4a4aee=_0x4a4aee-0x0;var _0x2e1719=_0x149b[_0x4a4aee];return _0x2e1719;};'use strict';var multer=require(_0xb149('0x0'));var util=require('util');var path=require(_0xb149('0x1'));var timeout=require(_0xb149('0x2'));var express=require(_0xb149('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb149('0x4'));var interaction=require(_0xb149('0x5'));var config=require(_0xb149('0x6'));var controller=require(_0xb149('0x7'));router[_0xb149('0x8')]('/',auth['isAuthenticated'](),controller[_0xb149('0x9')]);router[_0xb149('0x8')](_0xb149('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xb149('0x8')](_0xb149('0xb'),auth[_0xb149('0xc')](),controller['download']);router[_0xb149('0xd')]('/',auth[_0xb149('0xc')](),controller[_0xb149('0xe')]);router[_0xb149('0xf')](_0xb149('0xa'),auth['isAuthenticated'](),controller[_0xb149('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb149('0x11')]);module[_0xb149('0x12')]=router; \ No newline at end of file +var _0xd3bb=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put'];(function(_0x1381df,_0xa4f9e9){var _0x3dd915=function(_0x104735){while(--_0x104735){_0x1381df['push'](_0x1381df['shift']());}};_0x3dd915(++_0xa4f9e9);}(_0xd3bb,0x10c));var _0xbd3b=function(_0x2d5ee8,_0xbba399){_0x2d5ee8=_0x2d5ee8-0x0;var _0x532fdb=_0xd3bb[_0x2d5ee8];return _0x532fdb;};'use strict';var multer=require(_0xbd3b('0x0'));var util=require(_0xbd3b('0x1'));var path=require('path');var timeout=require(_0xbd3b('0x2'));var express=require(_0xbd3b('0x3'));var router=express[_0xbd3b('0x4')]();var fs_extra=require(_0xbd3b('0x5'));var auth=require(_0xbd3b('0x6'));var interaction=require(_0xbd3b('0x7'));var config=require(_0xbd3b('0x8'));var controller=require(_0xbd3b('0x9'));router[_0xbd3b('0xa')]('/',auth[_0xbd3b('0xb')](),controller[_0xbd3b('0xc')]);router[_0xbd3b('0xa')](_0xbd3b('0xd'),auth[_0xbd3b('0xb')](),controller[_0xbd3b('0xe')]);router[_0xbd3b('0xa')](_0xbd3b('0xf'),auth[_0xbd3b('0xb')](),controller[_0xbd3b('0x10')]);router[_0xbd3b('0x11')]('/',auth[_0xbd3b('0xb')](),controller[_0xbd3b('0x12')]);router[_0xbd3b('0x13')](_0xbd3b('0xd'),auth[_0xbd3b('0xb')](),controller[_0xbd3b('0x14')]);router[_0xbd3b('0x15')](_0xbd3b('0xd'),auth[_0xbd3b('0xb')](),controller[_0xbd3b('0x16')]);module[_0xbd3b('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 4cf6c1a..ba5111d 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 _0x5def=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x576b33,_0x2115ea){var _0x46834d=function(_0x38c45a){while(--_0x38c45a){_0x576b33['push'](_0x576b33['shift']());}};_0x46834d(++_0x2115ea);}(_0x5def,0xac));var _0xf5de=function(_0x577ce5,_0x515b3f){_0x577ce5=_0x577ce5-0x0;var _0x1ef1ba=_0x5def[_0x577ce5];return _0x1ef1ba;};'use strict';var Sequelize=require(_0xf5de('0x0'));module[_0xf5de('0x1')]={'field':{'type':Sequelize[_0xf5de('0x2')]},'alias':{'type':Sequelize[_0xf5de('0x3')]},'function':{'type':Sequelize[_0xf5de('0x3')]},'format':{'type':Sequelize[_0xf5de('0x3')]},'groupBy':{'type':Sequelize[_0xf5de('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xf5de('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x06a8=['exports','STRING','BOOLEAN','sequelize'];(function(_0x516927,_0xb4aad0){var _0x30749b=function(_0x2ca6cc){while(--_0x2ca6cc){_0x516927['push'](_0x516927['shift']());}};_0x30749b(++_0xb4aad0);}(_0x06a8,0x1c7));var _0x806a=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x06a8[_0x725b8e];return _0x43ac45;};'use strict';var Sequelize=require(_0x806a('0x0'));module[_0x806a('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x806a('0x2')]},'function':{'type':Sequelize[_0x806a('0x2')]},'format':{'type':Sequelize[_0x806a('0x2')]},'groupBy':{'type':Sequelize[_0x806a('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x806a('0x2')]},'custom':{'type':Sequelize[_0x806a('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 fe41971..f3a0ed2 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 _0xd456=['pick','filter','merge','map','options','findAll','catch','show','params','keys','rawAttributes','includeAll','include','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','../../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','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','AnalyticFieldReport','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x58ba99,_0x578b5b){var _0x44f31b=function(_0x1a35b7){while(--_0x1a35b7){_0x58ba99['push'](_0x58ba99['shift']());}};_0x44f31b(++_0x578b5b);}(_0xd456,0x10f));var _0x6d45=function(_0xbb66f6,_0x5bda04){_0xbb66f6=_0xbb66f6-0x0;var _0x324c66=_0xd456[_0xbb66f6];return _0x324c66;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6d45('0x0'));var jsonpatch=require(_0x6d45('0x1'));var rp=require('request-promise');var moment=require(_0x6d45('0x2'));var BPromise=require(_0x6d45('0x3'));var Mustache=require(_0x6d45('0x4'));var util=require('util');var path=require(_0x6d45('0x5'));var sox=require(_0x6d45('0x6'));var csv=require(_0x6d45('0x7'));var ejs=require(_0x6d45('0x8'));var fs=require('fs');var fs_extra=require(_0x6d45('0x9'));var _=require('lodash');var squel=require(_0x6d45('0xa'));var crypto=require(_0x6d45('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6d45('0xc'));var Redis=require('ioredis');var authService=require(_0x6d45('0xd'));var qs=require(_0x6d45('0xe'));var as=require(_0x6d45('0xf'));var hardwareService=require(_0x6d45('0x10'));var logger=require(_0x6d45('0x11'))(_0x6d45('0x12'));var utils=require(_0x6d45('0x13'));var config=require(_0x6d45('0x14'));var licenseUtil=require(_0x6d45('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa593f0,_0x26ab08){_0x26ab08=_0x26ab08||0xcc;return function(_0x2d5ad4){if(_0x2d5ad4){return _0xa593f0[_0x6d45('0x16')](_0x26ab08);}return _0xa593f0[_0x6d45('0x17')](_0x26ab08)[_0x6d45('0x18')]();};}function respondWithResult(_0x46a92e,_0x1af26d){_0x1af26d=_0x1af26d||0xc8;return function(_0x1c83e7){if(_0x1c83e7){return _0x46a92e[_0x6d45('0x17')](_0x1af26d)['json'](_0x1c83e7);}};}function respondWithFilteredResult(_0x9630e6,_0x57f7f1){return function(_0x9c530b){if(_0x9c530b){var _0x3148ea=typeof _0x57f7f1[_0x6d45('0x19')]===_0x6d45('0x1a')&&typeof _0x57f7f1[_0x6d45('0x1b')]===_0x6d45('0x1a');var _0x181052=_0x9c530b[_0x6d45('0x1c')];var _0xa766cb=_0x3148ea?0x0:_0x57f7f1['offset'];var _0x16717a=_0x3148ea?_0x9c530b[_0x6d45('0x1c')]:_0x57f7f1[_0x6d45('0x19')]+_0x57f7f1['limit'];var _0x2782a6;if(_0x16717a>=_0x181052){_0x16717a=_0x181052;_0x2782a6=0xc8;}else{_0x2782a6=0xce;}_0x9630e6[_0x6d45('0x17')](_0x2782a6);return _0x9630e6[_0x6d45('0x1d')](_0x6d45('0x1e'),_0xa766cb+'-'+_0x16717a+'/'+_0x181052)['json'](_0x9c530b);}return null;};}function patchUpdates(_0x228a5f){return function(_0x7d309b){try{jsonpatch[_0x6d45('0x1f')](_0x7d309b,_0x228a5f,!![]);}catch(_0x57d31b){return BPromise[_0x6d45('0x20')](_0x57d31b);}return _0x7d309b[_0x6d45('0x21')]();};}function saveUpdates(_0x343252,_0x5b2a0f){return function(_0x2836ae){if(_0x2836ae){return _0x2836ae[_0x6d45('0x22')](_0x343252)[_0x6d45('0x23')](function(_0x50238c){return _0x50238c;});}return null;};}function removeEntity(_0x1b16d4,_0xcd1437){return function(_0x527dfb){if(_0x527dfb){return _0x527dfb[_0x6d45('0x24')]()[_0x6d45('0x23')](function(){_0x1b16d4['status'](0xcc)[_0x6d45('0x18')]();});}};}function handleEntityNotFound(_0x18b26e,_0x485566){return function(_0x4dba88){if(!_0x4dba88){_0x18b26e['sendStatus'](0x194);}return _0x4dba88;};}function handleError(_0x365ccf,_0x1fe39a){_0x1fe39a=_0x1fe39a||0x1f4;return function(_0x44d1f5){logger[_0x6d45('0x25')](_0x44d1f5[_0x6d45('0x26')]);if(_0x44d1f5[_0x6d45('0x27')]){delete _0x44d1f5['name'];}_0x365ccf[_0x6d45('0x17')](_0x1fe39a)['send'](_0x44d1f5);};}exports[_0x6d45('0x28')]=function(_0x34a4f2,_0x5dbf0f){var _0x218d65={},_0x5931bc={},_0x225d45={'count':0x0,'rows':[]};var _0x5c99ed=_['map'](db[_0x6d45('0x29')]['rawAttributes'],function(_0x1a691d){return{'name':_0x1a691d[_0x6d45('0x2a')],'type':_0x1a691d[_0x6d45('0x2b')][_0x6d45('0x2c')]};});_0x5931bc[_0x6d45('0x2d')]=_['map'](_0x5c99ed,_0x6d45('0x27'));_0x5931bc[_0x6d45('0x2e')]=_['keys'](_0x34a4f2[_0x6d45('0x2e')]);_0x5931bc[_0x6d45('0x2f')]=_['intersection'](_0x5931bc['model'],_0x5931bc[_0x6d45('0x2e')]);_0x218d65[_0x6d45('0x30')]=_[_0x6d45('0x31')](_0x5931bc[_0x6d45('0x2d')],qs[_0x6d45('0x32')](_0x34a4f2[_0x6d45('0x2e')][_0x6d45('0x32')]));_0x218d65['attributes']=_0x218d65[_0x6d45('0x30')][_0x6d45('0x33')]?_0x218d65['attributes']:_0x5931bc['model'];if(!_0x34a4f2[_0x6d45('0x2e')][_0x6d45('0x34')](_0x6d45('0x35'))){_0x218d65[_0x6d45('0x1b')]=qs[_0x6d45('0x1b')](_0x34a4f2[_0x6d45('0x2e')]['limit']);_0x218d65[_0x6d45('0x19')]=qs[_0x6d45('0x19')](_0x34a4f2['query'][_0x6d45('0x19')]);}_0x218d65[_0x6d45('0x36')]=qs[_0x6d45('0x37')](_0x34a4f2[_0x6d45('0x2e')][_0x6d45('0x37')]);_0x218d65[_0x6d45('0x38')]=qs[_0x6d45('0x2f')](_[_0x6d45('0x39')](_0x34a4f2[_0x6d45('0x2e')],_0x5931bc[_0x6d45('0x2f')]),_0x5c99ed);if(_0x34a4f2[_0x6d45('0x2e')][_0x6d45('0x3a')]){_0x218d65[_0x6d45('0x38')]=_[_0x6d45('0x3b')](_0x218d65[_0x6d45('0x38')],{'$or':_[_0x6d45('0x3c')](_0x5c99ed,function(_0x291e30){if(_0x291e30[_0x6d45('0x2b')]!=='VIRTUAL'){var _0x4a7a8f={};_0x4a7a8f[_0x291e30[_0x6d45('0x27')]]={'$like':'%'+_0x34a4f2[_0x6d45('0x2e')][_0x6d45('0x3a')]+'%'};return _0x4a7a8f;}})});}_0x218d65=_[_0x6d45('0x3b')]({},_0x218d65,_0x34a4f2[_0x6d45('0x3d')]);var _0x194ebc={'where':_0x218d65[_0x6d45('0x38')]};return db['AnalyticFieldReport']['count'](_0x194ebc)[_0x6d45('0x23')](function(_0x3d87e1){_0x225d45['count']=_0x3d87e1;if(_0x34a4f2[_0x6d45('0x2e')]['includeAll']){_0x218d65['include']=[{'all':!![]}];}return db[_0x6d45('0x29')][_0x6d45('0x3e')](_0x218d65);})[_0x6d45('0x23')](function(_0xd09e30){_0x225d45['rows']=_0xd09e30;return _0x225d45;})[_0x6d45('0x23')](respondWithFilteredResult(_0x5dbf0f,_0x218d65))[_0x6d45('0x3f')](handleError(_0x5dbf0f,null));};exports[_0x6d45('0x40')]=function(_0x3074b1,_0x3fb043){var _0x53a5c3={'raw':![],'where':{'id':_0x3074b1[_0x6d45('0x41')]['id']}},_0x5cd43c={};_0x5cd43c[_0x6d45('0x2d')]=_[_0x6d45('0x42')](db['AnalyticFieldReport'][_0x6d45('0x43')]);_0x5cd43c[_0x6d45('0x2e')]=_[_0x6d45('0x42')](_0x3074b1[_0x6d45('0x2e')]);_0x5cd43c['filters']=_[_0x6d45('0x31')](_0x5cd43c['model'],_0x5cd43c[_0x6d45('0x2e')]);_0x53a5c3[_0x6d45('0x30')]=_[_0x6d45('0x31')](_0x5cd43c[_0x6d45('0x2d')],qs[_0x6d45('0x32')](_0x3074b1[_0x6d45('0x2e')][_0x6d45('0x32')]));_0x53a5c3['attributes']=_0x53a5c3[_0x6d45('0x30')]['length']?_0x53a5c3[_0x6d45('0x30')]:_0x5cd43c[_0x6d45('0x2d')];if(_0x3074b1['query'][_0x6d45('0x44')]){_0x53a5c3[_0x6d45('0x45')]=[{'all':!![]}];}_0x53a5c3=_[_0x6d45('0x3b')]({},_0x53a5c3,_0x3074b1[_0x6d45('0x3d')]);return db[_0x6d45('0x29')][_0x6d45('0x46')](_0x53a5c3)['then'](handleEntityNotFound(_0x3fb043,null))[_0x6d45('0x23')](respondWithResult(_0x3fb043,null))[_0x6d45('0x3f')](handleError(_0x3fb043,null));};exports[_0x6d45('0x47')]=function(_0x4844fb,_0x444e4e){return db[_0x6d45('0x29')][_0x6d45('0x47')](_0x4844fb[_0x6d45('0x48')],{})[_0x6d45('0x23')](respondWithResult(_0x444e4e,0xc9))[_0x6d45('0x3f')](handleError(_0x444e4e,null));};exports[_0x6d45('0x49')]=function(_0x23a8b5,_0x16f7c2){return db[_0x6d45('0x29')][_0x6d45('0x49')](_0x23a8b5[_0x6d45('0x48')],{'raw':![],'individualHooks':!![]})[_0x6d45('0x23')](respondWithResult(_0x16f7c2,0xc9))['catch'](handleError(_0x16f7c2,null));};exports['update']=function(_0x21cd87,_0x7d72bb){if(_0x21cd87[_0x6d45('0x48')]['id']){delete _0x21cd87[_0x6d45('0x48')]['id'];}return db[_0x6d45('0x29')]['find']({'where':{'id':_0x21cd87[_0x6d45('0x41')]['id']}})[_0x6d45('0x23')](handleEntityNotFound(_0x7d72bb,null))[_0x6d45('0x23')](saveUpdates(_0x21cd87['body'],null))[_0x6d45('0x23')](respondWithResult(_0x7d72bb,null))[_0x6d45('0x3f')](handleError(_0x7d72bb,null));};exports[_0x6d45('0x24')]=function(_0x13e3ac,_0x298471){return db[_0x6d45('0x29')]['find']({'where':{'id':_0x13e3ac['params']['id']}})[_0x6d45('0x23')](handleEntityNotFound(_0x298471,null))['then'](removeEntity(_0x298471,null))[_0x6d45('0x3f')](handleError(_0x298471,null));};exports[_0x6d45('0x4a')]=function(_0x22a51d,_0x431da7){return db[_0x6d45('0x29')][_0x6d45('0x24')]({'where':{'id':_0x22a51d['query'][_0x6d45('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x6d45('0x23')](respondWithResult(_0x431da7,0xcc))['catch'](handleError(_0x431da7,null));};exports[_0x6d45('0x4c')]=function(_0x58c7bf,_0x58dd9a,_0x8edfe9){return db[_0x6d45('0x4d')][_0x6d45('0x4e')]({'where':{'id':_0x58c7bf['params']['id']}})[_0x6d45('0x23')](handleEntityNotFound(_0x58dd9a,null))['then'](function(_0x4e085d){if(_0x4e085d){return db[_0x6d45('0x4f')][_0x6d45('0x50')](function(_0x134d5e){return db[_0x6d45('0x29')][_0x6d45('0x24')]({'where':{'CustomReportId':_0x58c7bf[_0x6d45('0x41')]['id']},'transaction':_0x134d5e})[_0x6d45('0x23')](function(_0x244074){var _0x4f3e94=_[_0x6d45('0x3c')](_0x58c7bf[_0x6d45('0x48')],function(_0x132bc3){delete _0x132bc3['id'];_0x132bc3[_0x6d45('0x51')]=_0x58c7bf[_0x6d45('0x41')]['id'];return _0x132bc3;});return db[_0x6d45('0x29')]['bulkCreate'](_0x4f3e94,{'transaction':_0x134d5e});});})[_0x6d45('0x23')](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x58c7bf[_0x6d45('0x41')]['id']}});});}})[_0x6d45('0x23')](respondWithResult(_0x58dd9a,null))['catch'](handleError(_0x58dd9a,null));}; \ No newline at end of file +var _0xebc8=['status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','order','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','rows','show','params','catch','create','body','bulkCreate','find','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xebc8,0x134));var _0x8ebc=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xebc8[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x8ebc('0x0'));var rimraf=require(_0x8ebc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8ebc('0x2'));var rp=require(_0x8ebc('0x3'));var moment=require(_0x8ebc('0x4'));var BPromise=require(_0x8ebc('0x5'));var Mustache=require(_0x8ebc('0x6'));var util=require(_0x8ebc('0x7'));var path=require('path');var sox=require(_0x8ebc('0x8'));var csv=require(_0x8ebc('0x9'));var ejs=require(_0x8ebc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8ebc('0xb'));var squel=require(_0x8ebc('0xc'));var crypto=require(_0x8ebc('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8ebc('0xe'));var toCsv=require(_0x8ebc('0x9'));var querystring=require(_0x8ebc('0xf'));var Papa=require(_0x8ebc('0x10'));var Redis=require(_0x8ebc('0x11'));var authService=require(_0x8ebc('0x12'));var qs=require(_0x8ebc('0x13'));var as=require(_0x8ebc('0x14'));var hardwareService=require(_0x8ebc('0x15'));var logger=require(_0x8ebc('0x16'))(_0x8ebc('0x17'));var utils=require(_0x8ebc('0x18'));var config=require(_0x8ebc('0x19'));var licenseUtil=require(_0x8ebc('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c3783,_0x184205){_0x184205=_0x184205||0xcc;return function(_0x420e2e){if(_0x420e2e){return _0x2c3783['sendStatus'](_0x184205);}return _0x2c3783['status'](_0x184205)[_0x8ebc('0x1b')]();};}function respondWithResult(_0x583fe8,_0xaa7708){_0xaa7708=_0xaa7708||0xc8;return function(_0x43784b){if(_0x43784b){return _0x583fe8[_0x8ebc('0x1c')](_0xaa7708)[_0x8ebc('0x1d')](_0x43784b);}};}function respondWithFilteredResult(_0x3053b1,_0x2ef8e2){return function(_0xfbea63){if(_0xfbea63){var _0x391a3e=typeof _0x2ef8e2[_0x8ebc('0x1e')]===_0x8ebc('0x1f')&&typeof _0x2ef8e2[_0x8ebc('0x20')]===_0x8ebc('0x1f');var _0x1dbb4f=_0xfbea63[_0x8ebc('0x21')];var _0x42543e=_0x391a3e?0x0:_0x2ef8e2['offset'];var _0x16d751=_0x391a3e?_0xfbea63[_0x8ebc('0x21')]:_0x2ef8e2[_0x8ebc('0x1e')]+_0x2ef8e2['limit'];var _0x500159;if(_0x16d751>=_0x1dbb4f){_0x16d751=_0x1dbb4f;_0x500159=0xc8;}else{_0x500159=0xce;}_0x3053b1['status'](_0x500159);return _0x3053b1[_0x8ebc('0x22')]('Content-Range',_0x42543e+'-'+_0x16d751+'/'+_0x1dbb4f)[_0x8ebc('0x1d')](_0xfbea63);}return null;};}function patchUpdates(_0x49cc45){return function(_0x2a6174){try{jsonpatch[_0x8ebc('0x23')](_0x2a6174,_0x49cc45,!![]);}catch(_0x1d7eee){return BPromise[_0x8ebc('0x24')](_0x1d7eee);}return _0x2a6174[_0x8ebc('0x25')]();};}function saveUpdates(_0x23e8d5,_0x2d8d10){return function(_0x39cada){if(_0x39cada){return _0x39cada[_0x8ebc('0x26')](_0x23e8d5)[_0x8ebc('0x27')](function(_0x36aead){return _0x36aead;});}return null;};}function removeEntity(_0x58748d,_0x1f0edc){return function(_0x19a2b5){if(_0x19a2b5){return _0x19a2b5[_0x8ebc('0x28')]()[_0x8ebc('0x27')](function(){_0x58748d[_0x8ebc('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51241e,_0x2c8fa9){return function(_0x1ab675){if(!_0x1ab675){_0x51241e[_0x8ebc('0x29')](0x194);}return _0x1ab675;};}function handleError(_0x2a8523,_0x1bcb1f){_0x1bcb1f=_0x1bcb1f||0x1f4;return function(_0x34439c){logger['error'](_0x34439c[_0x8ebc('0x2a')]);if(_0x34439c[_0x8ebc('0x2b')]){delete _0x34439c[_0x8ebc('0x2b')];}_0x2a8523['status'](_0x1bcb1f)[_0x8ebc('0x2c')](_0x34439c);};}exports[_0x8ebc('0x2d')]=function(_0x268141,_0x127370){var _0x5c9413={},_0x9daa71={},_0x58977a={'count':0x0,'rows':[]};var _0x3a2b1e=_[_0x8ebc('0x2e')](db[_0x8ebc('0x2f')][_0x8ebc('0x30')],function(_0x54c2fc){return{'name':_0x54c2fc[_0x8ebc('0x31')],'type':_0x54c2fc['type']['key']};});_0x9daa71[_0x8ebc('0x32')]=_[_0x8ebc('0x2e')](_0x3a2b1e,_0x8ebc('0x2b'));_0x9daa71['query']=_[_0x8ebc('0x33')](_0x268141[_0x8ebc('0x34')]);_0x9daa71[_0x8ebc('0x35')]=_[_0x8ebc('0x36')](_0x9daa71['model'],_0x9daa71[_0x8ebc('0x34')]);_0x5c9413[_0x8ebc('0x37')]=_[_0x8ebc('0x36')](_0x9daa71[_0x8ebc('0x32')],qs[_0x8ebc('0x38')](_0x268141[_0x8ebc('0x34')][_0x8ebc('0x38')]));_0x5c9413['attributes']=_0x5c9413['attributes'][_0x8ebc('0x39')]?_0x5c9413[_0x8ebc('0x37')]:_0x9daa71[_0x8ebc('0x32')];if(!_0x268141[_0x8ebc('0x34')]['hasOwnProperty']('nolimit')){_0x5c9413['limit']=qs['limit'](_0x268141[_0x8ebc('0x34')][_0x8ebc('0x20')]);_0x5c9413[_0x8ebc('0x1e')]=qs[_0x8ebc('0x1e')](_0x268141[_0x8ebc('0x34')][_0x8ebc('0x1e')]);}_0x5c9413[_0x8ebc('0x3a')]=qs['sort'](_0x268141['query']['sort']);_0x5c9413[_0x8ebc('0x3b')]=qs[_0x8ebc('0x35')](_[_0x8ebc('0x3c')](_0x268141[_0x8ebc('0x34')],_0x9daa71[_0x8ebc('0x35')]),_0x3a2b1e);if(_0x268141[_0x8ebc('0x34')][_0x8ebc('0x3d')]){_0x5c9413[_0x8ebc('0x3b')]=_['merge'](_0x5c9413[_0x8ebc('0x3b')],{'$or':_[_0x8ebc('0x2e')](_0x3a2b1e,function(_0x58a8cf){if(_0x58a8cf[_0x8ebc('0x3e')]!==_0x8ebc('0x3f')){var _0x4df083={};_0x4df083[_0x58a8cf['name']]={'$like':'%'+_0x268141[_0x8ebc('0x34')]['filter']+'%'};return _0x4df083;}})});}_0x5c9413=_[_0x8ebc('0x40')]({},_0x5c9413,_0x268141[_0x8ebc('0x41')]);var _0x1df9a8={'where':_0x5c9413[_0x8ebc('0x3b')]};return db[_0x8ebc('0x2f')]['count'](_0x1df9a8)[_0x8ebc('0x27')](function(_0x20604d){_0x58977a[_0x8ebc('0x21')]=_0x20604d;if(_0x268141[_0x8ebc('0x34')][_0x8ebc('0x42')]){_0x5c9413[_0x8ebc('0x43')]=[{'all':!![]}];}return db[_0x8ebc('0x2f')]['findAll'](_0x5c9413);})[_0x8ebc('0x27')](function(_0x260744){_0x58977a[_0x8ebc('0x44')]=_0x260744;return _0x58977a;})[_0x8ebc('0x27')](respondWithFilteredResult(_0x127370,_0x5c9413))['catch'](handleError(_0x127370,null));};exports[_0x8ebc('0x45')]=function(_0x463874,_0x52d714){var _0x2d6881={'raw':![],'where':{'id':_0x463874[_0x8ebc('0x46')]['id']}},_0x1595a7={};_0x1595a7[_0x8ebc('0x32')]=_[_0x8ebc('0x33')](db[_0x8ebc('0x2f')][_0x8ebc('0x30')]);_0x1595a7['query']=_['keys'](_0x463874[_0x8ebc('0x34')]);_0x1595a7['filters']=_[_0x8ebc('0x36')](_0x1595a7[_0x8ebc('0x32')],_0x1595a7[_0x8ebc('0x34')]);_0x2d6881[_0x8ebc('0x37')]=_[_0x8ebc('0x36')](_0x1595a7[_0x8ebc('0x32')],qs[_0x8ebc('0x38')](_0x463874['query'][_0x8ebc('0x38')]));_0x2d6881[_0x8ebc('0x37')]=_0x2d6881['attributes'][_0x8ebc('0x39')]?_0x2d6881[_0x8ebc('0x37')]:_0x1595a7[_0x8ebc('0x32')];if(_0x463874[_0x8ebc('0x34')][_0x8ebc('0x42')]){_0x2d6881[_0x8ebc('0x43')]=[{'all':!![]}];}_0x2d6881=_[_0x8ebc('0x40')]({},_0x2d6881,_0x463874[_0x8ebc('0x41')]);return db['AnalyticFieldReport']['find'](_0x2d6881)[_0x8ebc('0x27')](handleEntityNotFound(_0x52d714,null))[_0x8ebc('0x27')](respondWithResult(_0x52d714,null))[_0x8ebc('0x47')](handleError(_0x52d714,null));};exports[_0x8ebc('0x48')]=function(_0x312a5e,_0x3d7dd9){return db['AnalyticFieldReport'][_0x8ebc('0x48')](_0x312a5e[_0x8ebc('0x49')],{})[_0x8ebc('0x27')](respondWithResult(_0x3d7dd9,0xc9))[_0x8ebc('0x47')](handleError(_0x3d7dd9,null));};exports[_0x8ebc('0x4a')]=function(_0x53e194,_0x5060ee){return db['AnalyticFieldReport'][_0x8ebc('0x4a')](_0x53e194[_0x8ebc('0x49')],{'raw':![],'individualHooks':!![]})[_0x8ebc('0x27')](respondWithResult(_0x5060ee,0xc9))[_0x8ebc('0x47')](handleError(_0x5060ee,null));};exports['update']=function(_0x4adeec,_0x20c2f1){if(_0x4adeec[_0x8ebc('0x49')]['id']){delete _0x4adeec[_0x8ebc('0x49')]['id'];}return db[_0x8ebc('0x2f')][_0x8ebc('0x4b')]({'where':{'id':_0x4adeec[_0x8ebc('0x46')]['id']}})['then'](handleEntityNotFound(_0x20c2f1,null))[_0x8ebc('0x27')](saveUpdates(_0x4adeec[_0x8ebc('0x49')],null))[_0x8ebc('0x27')](respondWithResult(_0x20c2f1,null))[_0x8ebc('0x47')](handleError(_0x20c2f1,null));};exports[_0x8ebc('0x28')]=function(_0x391977,_0x3ebaf1){return db['AnalyticFieldReport'][_0x8ebc('0x4b')]({'where':{'id':_0x391977['params']['id']}})[_0x8ebc('0x27')](handleEntityNotFound(_0x3ebaf1,null))[_0x8ebc('0x27')](removeEntity(_0x3ebaf1,null))['catch'](handleError(_0x3ebaf1,null));};exports[_0x8ebc('0x4c')]=function(_0x2fa53c,_0x272a3b){return db['AnalyticFieldReport'][_0x8ebc('0x28')]({'where':{'id':_0x2fa53c[_0x8ebc('0x34')][_0x8ebc('0x4d')]||[]},'raw':![],'individualHooks':!![]})[_0x8ebc('0x27')](respondWithResult(_0x272a3b,0xcc))[_0x8ebc('0x47')](handleError(_0x272a3b,null));};exports[_0x8ebc('0x4e')]=function(_0x5ad928,_0x2503cc,_0x3acaa4){return db[_0x8ebc('0x4f')][_0x8ebc('0x50')]({'where':{'id':_0x5ad928[_0x8ebc('0x46')]['id']}})[_0x8ebc('0x27')](handleEntityNotFound(_0x2503cc,null))[_0x8ebc('0x27')](function(_0x30aade){if(_0x30aade){return db[_0x8ebc('0x51')][_0x8ebc('0x52')](function(_0x3ec511){return db[_0x8ebc('0x2f')][_0x8ebc('0x28')]({'where':{'CustomReportId':_0x5ad928[_0x8ebc('0x46')]['id']},'transaction':_0x3ec511})['then'](function(_0x58b7ac){var _0x3c4509=_[_0x8ebc('0x2e')](_0x5ad928[_0x8ebc('0x49')],function(_0x4f886e){delete _0x4f886e['id'];_0x4f886e[_0x8ebc('0x53')]=_0x5ad928[_0x8ebc('0x46')]['id'];return _0x4f886e;});return db[_0x8ebc('0x2f')][_0x8ebc('0x4a')](_0x3c4509,{'transaction':_0x3ec511});});})[_0x8ebc('0x27')](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x5ad928[_0x8ebc('0x46')]['id']}});});}})[_0x8ebc('0x27')](respondWithResult(_0x2503cc,null))['catch'](handleError(_0x2503cc,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 275d743..6c1d306 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 _0x3ce1=['./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1b1e76,_0x31695b){var _0x3d743a=function(_0x4ae27b){while(--_0x4ae27b){_0x1b1e76['push'](_0x1b1e76['shift']());}};_0x3d743a(++_0x31695b);}(_0x3ce1,0x178));var _0x13ce=function(_0x3acde1,_0x1b923d){_0x3acde1=_0x3acde1-0x0;var _0x282205=_0x3ce1[_0x3acde1];return _0x282205;};'use strict';var _=require(_0x13ce('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x13ce('0x1'));var moment=require(_0x13ce('0x2'));var BPromise=require(_0x13ce('0x3'));var rp=require(_0x13ce('0x4'));var fs=require('fs');var path=require(_0x13ce('0x5'));var rimraf=require(_0x13ce('0x6'));var config=require(_0x13ce('0x7'));var attributes=require(_0x13ce('0x8'));module['exports']=function(_0x28acac,_0x20288b){return _0x28acac[_0x13ce('0x9')](_0x13ce('0xa'),attributes,{'tableName':_0x13ce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7596=['exports','analytics_report_fields','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticFieldReport.attributes'];(function(_0x44c935,_0x3653f0){var _0x465bee=function(_0x211d20){while(--_0x211d20){_0x44c935['push'](_0x44c935['shift']());}};_0x465bee(++_0x3653f0);}(_0x7596,0x16d));var _0x6759=function(_0x1a3cc7,_0x2900e3){_0x1a3cc7=_0x1a3cc7-0x0;var _0x338438=_0x7596[_0x1a3cc7];return _0x338438;};'use strict';var _=require(_0x6759('0x0'));var util=require('util');var logger=require(_0x6759('0x1'))(_0x6759('0x2'));var moment=require(_0x6759('0x3'));var BPromise=require(_0x6759('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6759('0x5'));var rimraf=require(_0x6759('0x6'));var config=require(_0x6759('0x7'));var attributes=require(_0x6759('0x8'));module[_0x6759('0x9')]=function(_0x4faf7b,_0xddd2e8){return _0x4faf7b['define']('AnalyticFieldReport',attributes,{'tableName':_0x6759('0xa'),'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 16bc6c1..24d1e7d 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 _0xa64e=['then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x39880e,_0x1ae44a){var _0x57998e=function(_0x45481d){while(--_0x45481d){_0x39880e['push'](_0x39880e['shift']());}};_0x57998e(++_0x1ae44a);}(_0xa64e,0x1e6));var _0xea64=function(_0x50a732,_0x1eab82){_0x50a732=_0x50a732-0x0;var _0x2047a1=_0xa64e[_0x50a732];return _0x2047a1;};'use strict';var _=require('lodash');var util=require(_0xea64('0x0'));var moment=require(_0xea64('0x1'));var BPromise=require(_0xea64('0x2'));var rs=require(_0xea64('0x3'));var fs=require('fs');var Redis=require(_0xea64('0x4'));var db=require(_0xea64('0x5'))['db'];var utils=require(_0xea64('0x6'));var logger=require(_0xea64('0x7'))(_0xea64('0x8'));var config=require(_0xea64('0x9'));var jayson=require(_0xea64('0xa'));var client=jayson[_0xea64('0xb')][_0xea64('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5872b6,_0x1fdd87,_0x287445){return new BPromise(function(_0x448744,_0x121b35){return client[_0xea64('0xd')](_0x5872b6,_0x287445)[_0xea64('0xe')](function(_0x12ccd8){logger[_0xea64('0xf')](_0xea64('0x10'),_0x1fdd87,_0xea64('0x11'));logger[_0xea64('0x12')](_0xea64('0x13'),_0x1fdd87,_0xea64('0x11'),JSON[_0xea64('0x14')](_0x12ccd8));if(_0x12ccd8[_0xea64('0x15')]){if(_0x12ccd8[_0xea64('0x15')]['code']===0x1f4){logger[_0xea64('0x15')](_0xea64('0x10'),_0x1fdd87,_0x12ccd8['error'][_0xea64('0x16')]);return _0x121b35(_0x12ccd8[_0xea64('0x15')][_0xea64('0x16')]);}logger[_0xea64('0x15')](_0xea64('0x10'),_0x1fdd87,_0x12ccd8['error'][_0xea64('0x16')]);return _0x448744(_0x12ccd8[_0xea64('0x15')][_0xea64('0x16')]);}else{logger['info'](_0xea64('0x10'),_0x1fdd87,_0xea64('0x11'));_0x448744(_0x12ccd8[_0xea64('0x17')]['message']);}})[_0xea64('0x18')](function(_0x314e4e){logger[_0xea64('0x15')](_0xea64('0x10'),_0x1fdd87,_0x314e4e);_0x121b35(_0x314e4e);});});} \ No newline at end of file +var _0x22ab=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s'];(function(_0x4b527e,_0x4c85fe){var _0x1a1189=function(_0x21c560){while(--_0x21c560){_0x4b527e['push'](_0x4b527e['shift']());}};_0x1a1189(++_0x4c85fe);}(_0x22ab,0x78));var _0xb22a=function(_0x5b734b,_0x486a7f){_0x5b734b=_0x5b734b-0x0;var _0x2a15a3=_0x22ab[_0x5b734b];return _0x2a15a3;};'use strict';var _=require(_0xb22a('0x0'));var util=require(_0xb22a('0x1'));var moment=require(_0xb22a('0x2'));var BPromise=require(_0xb22a('0x3'));var rs=require(_0xb22a('0x4'));var fs=require('fs');var Redis=require(_0xb22a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb22a('0x6'));var config=require(_0xb22a('0x7'));var jayson=require(_0xb22a('0x8'));var client=jayson[_0xb22a('0x9')][_0xb22a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d02c9,_0x57c439,_0x3b74f6){return new BPromise(function(_0x47665e,_0x62e619){return client[_0xb22a('0xb')](_0x3d02c9,_0x3b74f6)[_0xb22a('0xc')](function(_0x56c69e){logger[_0xb22a('0xd')](_0xb22a('0xe'),_0x57c439,_0xb22a('0xf'));logger[_0xb22a('0x10')](_0xb22a('0x11'),_0x57c439,_0xb22a('0xf'),JSON[_0xb22a('0x12')](_0x56c69e));if(_0x56c69e[_0xb22a('0x13')]){if(_0x56c69e[_0xb22a('0x13')][_0xb22a('0x14')]===0x1f4){logger['error'](_0xb22a('0xe'),_0x57c439,_0x56c69e[_0xb22a('0x13')][_0xb22a('0x15')]);return _0x62e619(_0x56c69e['error'][_0xb22a('0x15')]);}logger[_0xb22a('0x13')](_0xb22a('0xe'),_0x57c439,_0x56c69e[_0xb22a('0x13')]['message']);return _0x47665e(_0x56c69e[_0xb22a('0x13')]['message']);}else{logger[_0xb22a('0xd')](_0xb22a('0xe'),_0x57c439,_0xb22a('0xf'));_0x47665e(_0x56c69e['result'][_0xb22a('0x15')]);}})[_0xb22a('0x16')](function(_0x27a46b){logger[_0xb22a('0x13')](_0xb22a('0xe'),_0x57c439,_0x27a46b);_0x62e619(_0x27a46b);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index bce7a6e..29ad6a7 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(_0x101d30,_0x162c4a){var _0x16c078=function(_0x3f5a39){while(--_0x3f5a39){_0x101d30['push'](_0x101d30['shift']());}};_0x16c078(++_0x162c4a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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(_0x22f1b6,_0x21174c){var _0x3944a7=function(_0x1130da){while(--_0x1130da){_0x22f1b6['push'](_0x22f1b6['shift']());}};_0x3944a7(++_0x21174c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 573871b..abef8b6 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 _0xd816=['sequelize','exports','name'];(function(_0x65891b,_0x32c4f1){var _0x25120e=function(_0x333345){while(--_0x333345){_0x65891b['push'](_0x65891b['shift']());}};_0x25120e(++_0x32c4f1);}(_0xd816,0xd5));var _0x6d81=function(_0xba4b4,_0x234e87){_0xba4b4=_0xba4b4-0x0;var _0x5c9a3b=_0xd816[_0xba4b4];return _0x5c9a3b;};'use strict';var Sequelize=require(_0x6d81('0x0'));module[_0x6d81('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6d81('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9c5e=['sequelize','exports','STRING','name'];(function(_0xb91fb5,_0x19ce74){var _0x17d0c8=function(_0x515213){while(--_0x515213){_0xb91fb5['push'](_0xb91fb5['shift']());}};_0x17d0c8(++_0x19ce74);}(_0x9c5e,0x9c));var _0xe9c5=function(_0x2f6f50,_0x1d21a7){_0x2f6f50=_0x2f6f50-0x0;var _0x2cf365=_0x9c5e[_0x2f6f50];return _0x2cf365;};'use strict';var Sequelize=require(_0xe9c5('0x0'));module[_0xe9c5('0x1')]={'name':{'type':Sequelize[_0xe9c5('0x2')],'allowNull':![],'unique':_0xe9c5('0x3')},'table':{'type':Sequelize[_0xe9c5('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 411b8fb..ea6c9df 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 _0xe14b=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','keys','length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring'];(function(_0x57aaf3,_0x42549e){var _0xd889c9=function(_0x3e56df){while(--_0x3e56df){_0x57aaf3['push'](_0x57aaf3['shift']());}};_0xd889c9(++_0x42549e);}(_0xe14b,0x93));var _0xbe14=function(_0x38a995,_0x129e64){_0x38a995=_0x38a995-0x0;var _0x3e402b=_0xe14b[_0x38a995];return _0x3e402b;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=typeof _0x3dc4a9['offset']===_0xbe14('0x19')&&typeof _0x3dc4a9[_0xbe14('0x1a')]===_0xbe14('0x19');var _0x123ede=_0xf4ac9[_0xbe14('0x1b')];var _0x29ab73=_0x37ce4e?0x0:_0x3dc4a9[_0xbe14('0x1c')];var _0x5ea1f8=_0x37ce4e?_0xf4ac9[_0xbe14('0x1b')]:_0x3dc4a9[_0xbe14('0x1c')]+_0x3dc4a9[_0xbe14('0x1a')];var _0x433459;if(_0x5ea1f8>=_0x123ede){_0x5ea1f8=_0x123ede;_0x433459=0xc8;}else{_0x433459=0xce;}_0x3f58f5[_0xbe14('0x17')](_0x433459);return _0x3f58f5[_0xbe14('0x1d')]('Content-Range',_0x29ab73+'-'+_0x5ea1f8+'/'+_0x123ede)[_0xbe14('0x1e')](_0xf4ac9);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x1f')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x20')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x22')](function(){var _0x4851f8=_0x2da350[_0xbe14('0x23')]({'plain':!![]});var _0x5fa043=_0xbe14('0x24');return db[_0xbe14('0x25')][_0xbe14('0x26')]({'where':{'type':_0x5fa043,'resourceId':_0x4851f8['id']}})[_0xbe14('0x22')](function(){return _0x2da350;});})['then'](function(){_0x3d3608[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x391556,_0x169369){return function(_0x5dd475){if(!_0x5dd475){_0x391556[_0xbe14('0x16')](0x194);}return _0x5dd475;};}function handleError(_0x29fc64,_0x59bf34){_0x59bf34=_0x59bf34||0x1f4;return function(_0x3c3613){logger[_0xbe14('0x27')](_0x3c3613[_0xbe14('0x28')]);if(_0x3c3613[_0xbe14('0x29')]){delete _0x3c3613[_0xbe14('0x29')];}_0x29fc64[_0xbe14('0x17')](_0x59bf34)[_0xbe14('0x2a')](_0x3c3613);};}exports[_0xbe14('0x2b')]=function(_0x4168c8,_0x16a159){var _0x40538f={},_0x3bf43c={},_0x39dc0a={'count':0x0,'rows':[]};var _0x10ae36=_[_0xbe14('0x2c')](db[_0xbe14('0x2d')][_0xbe14('0x2e')],function(_0x2ff48e){return{'name':_0x2ff48e[_0xbe14('0x2f')],'type':_0x2ff48e[_0xbe14('0x30')]['key']};});_0x3bf43c[_0xbe14('0x31')]=_['map'](_0x10ae36,'name');_0x3bf43c[_0xbe14('0x32')]=_['keys'](_0x4168c8[_0xbe14('0x32')]);_0x3bf43c[_0xbe14('0x33')]=_['intersection'](_0x3bf43c['model'],_0x3bf43c['query']);_0x40538f[_0xbe14('0x34')]=_[_0xbe14('0x35')](_0x3bf43c['model'],qs[_0xbe14('0x36')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x36')]));_0x40538f[_0xbe14('0x34')]=_0x40538f[_0xbe14('0x34')]['length']?_0x40538f['attributes']:_0x3bf43c[_0xbe14('0x31')];if(!_0x4168c8['query']['hasOwnProperty']('nolimit')){_0x40538f[_0xbe14('0x1a')]=qs[_0xbe14('0x1a')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x1a')]);_0x40538f[_0xbe14('0x1c')]=qs[_0xbe14('0x1c')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x1c')]);}_0x40538f[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x38')]);_0x40538f['where']=qs['filters'](_[_0xbe14('0x39')](_0x4168c8[_0xbe14('0x32')],_0x3bf43c[_0xbe14('0x33')]),_0x10ae36);if(_0x4168c8['query'][_0xbe14('0x3a')]){_0x40538f[_0xbe14('0x3b')]=_[_0xbe14('0x3c')](_0x40538f[_0xbe14('0x3b')],{'$or':_[_0xbe14('0x2c')](_0x10ae36,function(_0x25ee1f){if(_0x25ee1f[_0xbe14('0x30')]!==_0xbe14('0x3d')){var _0x1b2608={};_0x1b2608[_0x25ee1f['name']]={'$like':'%'+_0x4168c8[_0xbe14('0x32')][_0xbe14('0x3a')]+'%'};return _0x1b2608;}})});}_0x40538f=_[_0xbe14('0x3c')]({},_0x40538f,_0x4168c8[_0xbe14('0x3e')]);var _0x3287b9={'where':_0x40538f[_0xbe14('0x3b')]};return db['AnalyticMetric'][_0xbe14('0x1b')](_0x3287b9)[_0xbe14('0x22')](function(_0x1220c9){_0x39dc0a[_0xbe14('0x1b')]=_0x1220c9;if(_0x4168c8['query']['includeAll']){_0x40538f[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x2d')][_0xbe14('0x40')](_0x40538f);})['then'](function(_0x5d5318){_0x39dc0a[_0xbe14('0x41')]=_0x5d5318;return _0x39dc0a;})['then'](respondWithFilteredResult(_0x16a159,_0x40538f))['catch'](handleError(_0x16a159,null));};exports[_0xbe14('0x42')]=function(_0x1f0355,_0x8216c3){var _0x5051e4={'raw':!![],'where':{'id':_0x1f0355['params']['id']}},_0x558525={};_0x558525[_0xbe14('0x31')]=_[_0xbe14('0x43')](db[_0xbe14('0x2d')]['rawAttributes']);_0x558525[_0xbe14('0x32')]=_[_0xbe14('0x43')](_0x1f0355[_0xbe14('0x32')]);_0x558525[_0xbe14('0x33')]=_['intersection'](_0x558525['model'],_0x558525[_0xbe14('0x32')]);_0x5051e4[_0xbe14('0x34')]=_[_0xbe14('0x35')](_0x558525[_0xbe14('0x31')],qs[_0xbe14('0x36')](_0x1f0355['query']['fields']));_0x5051e4[_0xbe14('0x34')]=_0x5051e4[_0xbe14('0x34')][_0xbe14('0x44')]?_0x5051e4[_0xbe14('0x34')]:_0x558525['model'];if(_0x1f0355[_0xbe14('0x32')][_0xbe14('0x45')]){_0x5051e4['include']=[{'all':!![]}];}_0x5051e4=_[_0xbe14('0x3c')]({},_0x5051e4,_0x1f0355[_0xbe14('0x3e')]);return db[_0xbe14('0x2d')][_0xbe14('0x46')](_0x5051e4)['then'](handleEntityNotFound(_0x8216c3,null))['then'](respondWithResult(_0x8216c3,null))[_0xbe14('0x47')](handleError(_0x8216c3,null));};exports[_0xbe14('0x48')]=function(_0x4a1a37,_0x5acf90){return db[_0xbe14('0x2d')][_0xbe14('0x48')](_0x4a1a37[_0xbe14('0x49')],{})[_0xbe14('0x22')](function(_0xdbc6e1){var _0xd04fd5=_0x4a1a37[_0xbe14('0x4a')]['get']({'plain':!![]});if(!_0xd04fd5)throw new Error(_0xbe14('0x4b'));if(_0xd04fd5[_0xbe14('0x4c')]===_0xbe14('0x4a')){var _0x22b1f8=_0xdbc6e1[_0xbe14('0x23')]({'plain':!![]});var _0x494c32=_0xbe14('0x24');return db[_0xbe14('0x4d')][_0xbe14('0x46')]({'where':{'name':_0x494c32,'userProfileId':_0xd04fd5[_0xbe14('0x4e')]},'raw':!![]})[_0xbe14('0x22')](function(_0x2dbeb1){if(_0x2dbeb1&&_0x2dbeb1['autoAssociation']===0x0){return db['UserProfileResource'][_0xbe14('0x48')]({'name':_0x22b1f8[_0xbe14('0x29')],'resourceId':_0x22b1f8['id'],'type':_0x2dbeb1[_0xbe14('0x29')],'sectionId':_0x2dbeb1['id']},{})['then'](function(){return _0xdbc6e1;});}else{return _0xdbc6e1;}})['catch'](function(_0x44fe0d){logger[_0xbe14('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44fe0d);throw _0x44fe0d;});}return _0xdbc6e1;})[_0xbe14('0x22')](respondWithResult(_0x5acf90,0xc9))[_0xbe14('0x47')](handleError(_0x5acf90,null));};exports['update']=function(_0x28f995,_0x4a40d2){if(_0x28f995[_0xbe14('0x49')]['id']){delete _0x28f995[_0xbe14('0x49')]['id'];}return db[_0xbe14('0x2d')]['find']({'where':{'id':_0x28f995[_0xbe14('0x4f')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x4a40d2,null))['then'](saveUpdates(_0x28f995[_0xbe14('0x49')],null))[_0xbe14('0x22')](respondWithResult(_0x4a40d2,null))[_0xbe14('0x47')](handleError(_0x4a40d2,null));};exports[_0xbe14('0x26')]=function(_0x49322f,_0x4f06a3){return db[_0xbe14('0x2d')][_0xbe14('0x46')]({'where':{'id':_0x49322f[_0xbe14('0x4f')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x4f06a3,null))[_0xbe14('0x22')](removeEntity(_0x4f06a3,null))[_0xbe14('0x47')](handleError(_0x4f06a3,null));}; \ No newline at end of file +var _0x6aa7=['json','apply','reject','save','update','then','destroy','get','Metrics','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','show','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','UserProfileResource','catch','error','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range'];(function(_0x312835,_0xff273e){var _0x1da8b9=function(_0x193c4){while(--_0x193c4){_0x312835['push'](_0x312835['shift']());}};_0x1da8b9(++_0xff273e);}(_0x6aa7,0x178));var _0x76aa=function(_0x274276,_0x1b7f16){_0x274276=_0x274276-0x0;var _0x1df42d=_0x6aa7[_0x274276];return _0x1df42d;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x112c39,_0x5df49c){_0x5df49c=_0x5df49c||0xcc;return function(_0x226536){if(_0x226536){return _0x112c39[_0x76aa('0x19')](_0x5df49c);}return _0x112c39[_0x76aa('0x1a')](_0x5df49c)[_0x76aa('0x1b')]();};}function respondWithResult(_0x10432c,_0x4e309f){_0x4e309f=_0x4e309f||0xc8;return function(_0x5f5b59){if(_0x5f5b59){return _0x10432c[_0x76aa('0x1a')](_0x4e309f)['json'](_0x5f5b59);}};}function respondWithFilteredResult(_0x180d92,_0x319bf1){return function(_0x5cf594){if(_0x5cf594){var _0x2111c7=typeof _0x319bf1['offset']===_0x76aa('0x1c')&&typeof _0x319bf1['limit']===_0x76aa('0x1c');var _0x413cf6=_0x5cf594[_0x76aa('0x1d')];var _0x21c16d=_0x2111c7?0x0:_0x319bf1[_0x76aa('0x1e')];var _0x3ead3f=_0x2111c7?_0x5cf594['count']:_0x319bf1['offset']+_0x319bf1[_0x76aa('0x1f')];var _0x454dd3;if(_0x3ead3f>=_0x413cf6){_0x3ead3f=_0x413cf6;_0x454dd3=0xc8;}else{_0x454dd3=0xce;}_0x180d92[_0x76aa('0x1a')](_0x454dd3);return _0x180d92[_0x76aa('0x20')](_0x76aa('0x21'),_0x21c16d+'-'+_0x3ead3f+'/'+_0x413cf6)[_0x76aa('0x22')](_0x5cf594);}return null;};}function patchUpdates(_0x19af92){return function(_0x2eaf48){try{jsonpatch[_0x76aa('0x23')](_0x2eaf48,_0x19af92,!![]);}catch(_0x5990c1){return BPromise[_0x76aa('0x24')](_0x5990c1);}return _0x2eaf48[_0x76aa('0x25')]();};}function saveUpdates(_0x338a6b,_0x5b3f55){return function(_0x41463a){if(_0x41463a){return _0x41463a[_0x76aa('0x26')](_0x338a6b)[_0x76aa('0x27')](function(_0x2bd2c6){return _0x2bd2c6;});}return null;};}function removeEntity(_0x29c50c,_0xc1044c){return function(_0x3cd039){if(_0x3cd039){return _0x3cd039[_0x76aa('0x28')]()[_0x76aa('0x27')](function(){var _0x2cba6d=_0x3cd039[_0x76aa('0x29')]({'plain':!![]});var _0x26b75e=_0x76aa('0x2a');return db['UserProfileResource'][_0x76aa('0x28')]({'where':{'type':_0x26b75e,'resourceId':_0x2cba6d['id']}})[_0x76aa('0x27')](function(){return _0x3cd039;});})[_0x76aa('0x27')](function(){_0x29c50c[_0x76aa('0x1a')](0xcc)[_0x76aa('0x1b')]();});}};}function handleEntityNotFound(_0x2f9316,_0x25a803){return function(_0x282d0a){if(!_0x282d0a){_0x2f9316[_0x76aa('0x19')](0x194);}return _0x282d0a;};}function handleError(_0x1bdc3d,_0x545b06){_0x545b06=_0x545b06||0x1f4;return function(_0x3fcb7f){logger['error'](_0x3fcb7f[_0x76aa('0x2b')]);if(_0x3fcb7f[_0x76aa('0x2c')]){delete _0x3fcb7f[_0x76aa('0x2c')];}_0x1bdc3d[_0x76aa('0x1a')](_0x545b06)[_0x76aa('0x2d')](_0x3fcb7f);};}exports[_0x76aa('0x2e')]=function(_0x2ee0f9,_0x3827ec){var _0x19fd4f={},_0x3ea05a={},_0x5edcd8={'count':0x0,'rows':[]};var _0x430ad6=_[_0x76aa('0x2f')](db[_0x76aa('0x30')][_0x76aa('0x31')],function(_0x458ac3){return{'name':_0x458ac3[_0x76aa('0x32')],'type':_0x458ac3[_0x76aa('0x33')]['key']};});_0x3ea05a[_0x76aa('0x34')]=_[_0x76aa('0x2f')](_0x430ad6,'name');_0x3ea05a[_0x76aa('0x35')]=_['keys'](_0x2ee0f9[_0x76aa('0x35')]);_0x3ea05a['filters']=_[_0x76aa('0x36')](_0x3ea05a['model'],_0x3ea05a['query']);_0x19fd4f[_0x76aa('0x37')]=_[_0x76aa('0x36')](_0x3ea05a[_0x76aa('0x34')],qs[_0x76aa('0x38')](_0x2ee0f9['query']['fields']));_0x19fd4f[_0x76aa('0x37')]=_0x19fd4f[_0x76aa('0x37')][_0x76aa('0x39')]?_0x19fd4f[_0x76aa('0x37')]:_0x3ea05a[_0x76aa('0x34')];if(!_0x2ee0f9['query'][_0x76aa('0x3a')]('nolimit')){_0x19fd4f['limit']=qs[_0x76aa('0x1f')](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x1f')]);_0x19fd4f[_0x76aa('0x1e')]=qs['offset'](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x1e')]);}_0x19fd4f[_0x76aa('0x3b')]=qs['sort'](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x3c')]);_0x19fd4f[_0x76aa('0x3d')]=qs[_0x76aa('0x3e')](_[_0x76aa('0x3f')](_0x2ee0f9[_0x76aa('0x35')],_0x3ea05a[_0x76aa('0x3e')]),_0x430ad6);if(_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x40')]){_0x19fd4f['where']=_[_0x76aa('0x41')](_0x19fd4f[_0x76aa('0x3d')],{'$or':_[_0x76aa('0x2f')](_0x430ad6,function(_0xa824e8){if(_0xa824e8[_0x76aa('0x33')]!==_0x76aa('0x42')){var _0x572fdb={};_0x572fdb[_0xa824e8['name']]={'$like':'%'+_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x40')]+'%'};return _0x572fdb;}})});}_0x19fd4f=_[_0x76aa('0x41')]({},_0x19fd4f,_0x2ee0f9[_0x76aa('0x43')]);var _0x50599f={'where':_0x19fd4f[_0x76aa('0x3d')]};return db[_0x76aa('0x30')][_0x76aa('0x1d')](_0x50599f)[_0x76aa('0x27')](function(_0x1138b5){_0x5edcd8['count']=_0x1138b5;if(_0x2ee0f9[_0x76aa('0x35')]['includeAll']){_0x19fd4f[_0x76aa('0x44')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x19fd4f);})['then'](function(_0x144f0a){_0x5edcd8['rows']=_0x144f0a;return _0x5edcd8;})['then'](respondWithFilteredResult(_0x3827ec,_0x19fd4f))['catch'](handleError(_0x3827ec,null));};exports[_0x76aa('0x45')]=function(_0x3fd153,_0x116dc5){var _0x2c0744={'raw':!![],'where':{'id':_0x3fd153['params']['id']}},_0x27a52e={};_0x27a52e[_0x76aa('0x34')]=_[_0x76aa('0x46')](db[_0x76aa('0x30')][_0x76aa('0x31')]);_0x27a52e[_0x76aa('0x35')]=_['keys'](_0x3fd153[_0x76aa('0x35')]);_0x27a52e[_0x76aa('0x3e')]=_['intersection'](_0x27a52e[_0x76aa('0x34')],_0x27a52e['query']);_0x2c0744[_0x76aa('0x37')]=_[_0x76aa('0x36')](_0x27a52e[_0x76aa('0x34')],qs[_0x76aa('0x38')](_0x3fd153[_0x76aa('0x35')][_0x76aa('0x38')]));_0x2c0744[_0x76aa('0x37')]=_0x2c0744[_0x76aa('0x37')][_0x76aa('0x39')]?_0x2c0744[_0x76aa('0x37')]:_0x27a52e['model'];if(_0x3fd153[_0x76aa('0x35')]['includeAll']){_0x2c0744[_0x76aa('0x44')]=[{'all':!![]}];}_0x2c0744=_[_0x76aa('0x41')]({},_0x2c0744,_0x3fd153[_0x76aa('0x43')]);return db[_0x76aa('0x30')]['find'](_0x2c0744)['then'](handleEntityNotFound(_0x116dc5,null))[_0x76aa('0x27')](respondWithResult(_0x116dc5,null))['catch'](handleError(_0x116dc5,null));};exports[_0x76aa('0x47')]=function(_0x302a0c,_0x4315b3){return db[_0x76aa('0x30')][_0x76aa('0x47')](_0x302a0c[_0x76aa('0x48')],{})['then'](function(_0x564546){var _0x2fcf8f=_0x302a0c[_0x76aa('0x49')][_0x76aa('0x29')]({'plain':!![]});if(!_0x2fcf8f)throw new Error(_0x76aa('0x4a'));if(_0x2fcf8f[_0x76aa('0x4b')]===_0x76aa('0x49')){var _0x4c52d5=_0x564546[_0x76aa('0x29')]({'plain':!![]});var _0x2d631e=_0x76aa('0x2a');return db['UserProfileSection'][_0x76aa('0x4c')]({'where':{'name':_0x2d631e,'userProfileId':_0x2fcf8f['userProfileId']},'raw':!![]})[_0x76aa('0x27')](function(_0x5e1d84){if(_0x5e1d84&&_0x5e1d84[_0x76aa('0x4d')]===0x0){return db[_0x76aa('0x4e')][_0x76aa('0x47')]({'name':_0x4c52d5[_0x76aa('0x2c')],'resourceId':_0x4c52d5['id'],'type':_0x5e1d84[_0x76aa('0x2c')],'sectionId':_0x5e1d84['id']},{})[_0x76aa('0x27')](function(){return _0x564546;});}else{return _0x564546;}})[_0x76aa('0x4f')](function(_0x4f2c2b){logger[_0x76aa('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f2c2b);throw _0x4f2c2b;});}return _0x564546;})[_0x76aa('0x27')](respondWithResult(_0x4315b3,0xc9))[_0x76aa('0x4f')](handleError(_0x4315b3,null));};exports[_0x76aa('0x26')]=function(_0x53be10,_0x3fa7ec){if(_0x53be10[_0x76aa('0x48')]['id']){delete _0x53be10[_0x76aa('0x48')]['id'];}return db['AnalyticMetric'][_0x76aa('0x4c')]({'where':{'id':_0x53be10[_0x76aa('0x51')]['id']}})[_0x76aa('0x27')](handleEntityNotFound(_0x3fa7ec,null))[_0x76aa('0x27')](saveUpdates(_0x53be10['body'],null))[_0x76aa('0x27')](respondWithResult(_0x3fa7ec,null))[_0x76aa('0x4f')](handleError(_0x3fa7ec,null));};exports[_0x76aa('0x28')]=function(_0x410933,_0x2027f8){return db[_0x76aa('0x30')]['find']({'where':{'id':_0x410933[_0x76aa('0x51')]['id']}})[_0x76aa('0x27')](handleEntityNotFound(_0x2027f8,null))[_0x76aa('0x27')](removeEntity(_0x2027f8,null))[_0x76aa('0x4f')](handleError(_0x2027f8,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index a6929b5..5bf354f 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 _0xf8bb=['rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x10eee1,_0x330c90){var _0xe16025=function(_0x23a1e5){while(--_0x23a1e5){_0x10eee1['push'](_0x10eee1['shift']());}};_0xe16025(++_0x330c90);}(_0xf8bb,0x111));var _0xbf8b=function(_0x136d62,_0x4b917c){_0x136d62=_0x136d62-0x0;var _0x200cda=_0xf8bb[_0x136d62];return _0x200cda;};'use strict';var _=require(_0xbf8b('0x0'));var util=require(_0xbf8b('0x1'));var logger=require(_0xbf8b('0x2'))('api');var moment=require(_0xbf8b('0x3'));var BPromise=require(_0xbf8b('0x4'));var rp=require(_0xbf8b('0x5'));var fs=require('fs');var path=require(_0xbf8b('0x6'));var rimraf=require(_0xbf8b('0x7'));var config=require(_0xbf8b('0x8'));var attributes=require(_0xbf8b('0x9'));module[_0xbf8b('0xa')]=function(_0x441686,_0x8d5666){return _0x441686[_0xbf8b('0xb')](_0xbf8b('0xc'),attributes,{'tableName':_0xbf8b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac4f=['lodash','../../config/logger','moment','path','rimraf','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics'];(function(_0x427c73,_0xe98574){var _0x6b9596=function(_0x2e4fa1){while(--_0x2e4fa1){_0x427c73['push'](_0x427c73['shift']());}};_0x6b9596(++_0xe98574);}(_0xac4f,0x122));var _0xfac4=function(_0x3d0528,_0x21a0b7){_0x3d0528=_0x3d0528-0x0;var _0x4ebb2d=_0xac4f[_0x3d0528];return _0x4ebb2d;};'use strict';var _=require(_0xfac4('0x0'));var util=require('util');var logger=require(_0xfac4('0x1'))('api');var moment=require(_0xfac4('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfac4('0x3'));var rimraf=require(_0xfac4('0x4'));var config=require('../../config/environment');var attributes=require(_0xfac4('0x5'));module[_0xfac4('0x6')]=function(_0x1aae1c,_0x48f014){return _0x1aae1c[_0xfac4('0x7')](_0xfac4('0x8'),attributes,{'tableName':_0xfac4('0x9'),'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 1504f48..3bc6075 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 _0xb278=['info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x49c06d,_0x274373){var _0x59519d=function(_0x2b3674){while(--_0x2b3674){_0x49c06d['push'](_0x49c06d['shift']());}};_0x59519d(++_0x274373);}(_0xb278,0xcf));var _0x8b27=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xb278[_0x18cd5b];return _0x5eaa52;};'use strict';var _=require(_0x8b27('0x0'));var util=require(_0x8b27('0x1'));var moment=require('moment');var BPromise=require(_0x8b27('0x2'));var rs=require(_0x8b27('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b27('0x4'))['db'];var utils=require(_0x8b27('0x5'));var logger=require(_0x8b27('0x6'))(_0x8b27('0x7'));var config=require(_0x8b27('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8b27('0x9')][_0x8b27('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x364ee6,_0x3b5957,_0x49888){return new BPromise(function(_0x88f73e,_0x6e37f){return client[_0x8b27('0xb')](_0x364ee6,_0x49888)[_0x8b27('0xc')](function(_0x1d26f3){logger[_0x8b27('0xd')](_0x8b27('0xe'),_0x3b5957,_0x8b27('0xf'));logger[_0x8b27('0x10')](_0x8b27('0x11'),_0x3b5957,_0x8b27('0xf'),JSON[_0x8b27('0x12')](_0x1d26f3));if(_0x1d26f3[_0x8b27('0x13')]){if(_0x1d26f3[_0x8b27('0x13')]['code']===0x1f4){logger[_0x8b27('0x13')](_0x8b27('0xe'),_0x3b5957,_0x1d26f3['error'][_0x8b27('0x14')]);return _0x6e37f(_0x1d26f3[_0x8b27('0x13')][_0x8b27('0x14')]);}logger[_0x8b27('0x13')](_0x8b27('0xe'),_0x3b5957,_0x1d26f3['error'][_0x8b27('0x14')]);return _0x88f73e(_0x1d26f3[_0x8b27('0x13')][_0x8b27('0x14')]);}else{logger[_0x8b27('0xd')](_0x8b27('0xe'),_0x3b5957,_0x8b27('0xf'));_0x88f73e(_0x1d26f3[_0x8b27('0x15')][_0x8b27('0x14')]);}})['catch'](function(_0x5171b0){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x3b5957,_0x5171b0);_0x6e37f(_0x5171b0);});});} \ No newline at end of file +var _0xc30b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','request\x20sent','debug','stringify','error','message','AnalyticMetric,\x20%s,\x20%s','catch','lodash','moment','bluebird','randomstring'];(function(_0x18f82b,_0x3ea7a0){var _0x5d8128=function(_0x16a009){while(--_0x16a009){_0x18f82b['push'](_0x18f82b['shift']());}};_0x5d8128(++_0x3ea7a0);}(_0xc30b,0x1ea));var _0xbc30=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xc30b[_0x12f688];return _0x59c3de;};'use strict';var _=require(_0xbc30('0x0'));var util=require('util');var moment=require(_0xbc30('0x1'));var BPromise=require(_0xbc30('0x2'));var rs=require(_0xbc30('0x3'));var fs=require('fs');var Redis=require(_0xbc30('0x4'));var db=require(_0xbc30('0x5'))['db'];var utils=require(_0xbc30('0x6'));var logger=require(_0xbc30('0x7'))('rpc');var config=require(_0xbc30('0x8'));var jayson=require(_0xbc30('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x334f80,_0x16ec47,_0x4c0476){return new BPromise(function(_0x3cfc8c,_0x384acb){return client[_0xbc30('0xa')](_0x334f80,_0x4c0476)['then'](function(_0x45a393){logger[_0xbc30('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x16ec47,_0xbc30('0xc'));logger[_0xbc30('0xd')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x16ec47,_0xbc30('0xc'),JSON[_0xbc30('0xe')](_0x45a393));if(_0x45a393[_0xbc30('0xf')]){if(_0x45a393[_0xbc30('0xf')]['code']===0x1f4){logger[_0xbc30('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x16ec47,_0x45a393[_0xbc30('0xf')][_0xbc30('0x10')]);return _0x384acb(_0x45a393[_0xbc30('0xf')][_0xbc30('0x10')]);}logger[_0xbc30('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x16ec47,_0x45a393['error'][_0xbc30('0x10')]);return _0x3cfc8c(_0x45a393[_0xbc30('0xf')][_0xbc30('0x10')]);}else{logger[_0xbc30('0xb')](_0xbc30('0x11'),_0x16ec47,_0xbc30('0xc'));_0x3cfc8c(_0x45a393['result'][_0xbc30('0x10')]);}})[_0xbc30('0x12')](function(_0x4c4181){logger[_0xbc30('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x16ec47,_0x4c4181);_0x384acb(_0x4c4181);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index da01a4d..6d9ed1b 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 _0xe9e8=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x1188e8,_0x5b5373){var _0x29c84f=function(_0xde5ff8){while(--_0xde5ff8){_0x1188e8['push'](_0x1188e8['shift']());}};_0x29c84f(++_0x5b5373);}(_0xe9e8,0x179));var _0x8e9e=function(_0xc43c21,_0x22203b){_0xc43c21=_0xc43c21-0x0;var _0x12bebe=_0xe9e8[_0xc43c21];return _0x12bebe;};'use strict';var multer=require(_0x8e9e('0x0'));var util=require(_0x8e9e('0x1'));var path=require(_0x8e9e('0x2'));var timeout=require(_0x8e9e('0x3'));var express=require(_0x8e9e('0x4'));var router=express[_0x8e9e('0x5')]();var fs_extra=require(_0x8e9e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8e9e('0x7'));var config=require('../../config/environment');var controller=require(_0x8e9e('0x8'));router[_0x8e9e('0x9')]('/',auth[_0x8e9e('0xa')](),controller['index']);router['get'](_0x8e9e('0xb'),auth[_0x8e9e('0xa')](),controller[_0x8e9e('0xc')]);router[_0x8e9e('0xd')]('/',auth[_0x8e9e('0xa')](),controller[_0x8e9e('0xe')]);router['put']('/:id',auth[_0x8e9e('0xa')](),controller[_0x8e9e('0xf')]);router[_0x8e9e('0x10')](_0x8e9e('0xb'),auth[_0x8e9e('0xa')](),controller[_0x8e9e('0x11')]);module[_0x8e9e('0x12')]=router; \ No newline at end of file +var _0xf50b=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','index','/:id','post','create','update','delete'];(function(_0x192875,_0xe6c516){var _0x4c9ee0=function(_0x2d1618){while(--_0x2d1618){_0x192875['push'](_0x192875['shift']());}};_0x4c9ee0(++_0xe6c516);}(_0xf50b,0xc8));var _0xbf50=function(_0x3b149d,_0x2150ad){_0x3b149d=_0x3b149d-0x0;var _0x25eb83=_0xf50b[_0x3b149d];return _0x25eb83;};'use strict';var multer=require(_0xbf50('0x0'));var util=require(_0xbf50('0x1'));var path=require('path');var timeout=require(_0xbf50('0x2'));var express=require(_0xbf50('0x3'));var router=express[_0xbf50('0x4')]();var fs_extra=require(_0xbf50('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbf50('0x6'));var config=require('../../config/environment');var controller=require(_0xbf50('0x7'));router[_0xbf50('0x8')]('/',auth[_0xbf50('0x9')](),controller[_0xbf50('0xa')]);router[_0xbf50('0x8')](_0xbf50('0xb'),auth[_0xbf50('0x9')](),controller['show']);router[_0xbf50('0xc')]('/',auth[_0xbf50('0x9')](),controller[_0xbf50('0xd')]);router['put']('/:id',auth[_0xbf50('0x9')](),controller[_0xbf50('0xe')]);router[_0xbf50('0xf')]('/:id',auth[_0xbf50('0x9')](),controller[_0xbf50('0x10')]);module[_0xbf50('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index f262258..39fc655 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 _0xbb7f=['exports','TEXT','sequelize'];(function(_0x4180cf,_0x237bad){var _0x37dcbd=function(_0x126022){while(--_0x126022){_0x4180cf['push'](_0x4180cf['shift']());}};_0x37dcbd(++_0x237bad);}(_0xbb7f,0xe6));var _0xfbb7=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbb7f[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xfbb7('0x0'));module[_0xfbb7('0x1')]={'tree':{'type':Sequelize[_0xfbb7('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xacb1=['exports','TEXT'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0xacb1,0x8c));var _0x1acb=function(_0x220d0d,_0x4d2017){_0x220d0d=_0x220d0d-0x0;var _0x4c82d5=_0xacb1[_0x220d0d];return _0x4c82d5;};'use strict';var Sequelize=require('sequelize');module[_0x1acb('0x0')]={'tree':{'type':Sequelize[_0x1acb('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 5cf6516..9d11d0f 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 _0x7a64=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','stack','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','VIRTUAL','options','includeAll','include','rows','show','params','merge','find','catch','create','body','destroy'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x7a64,0x128));var _0x47a6=function(_0x244bc9,_0x2ab8e7){_0x244bc9=_0x244bc9-0x0;var _0x3d001e=_0x7a64[_0x244bc9];return _0x3d001e;};'use strict';var emlformat=require(_0x47a6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x47a6('0x1'));var jsonpatch=require(_0x47a6('0x2'));var rp=require(_0x47a6('0x3'));var moment=require(_0x47a6('0x4'));var BPromise=require(_0x47a6('0x5'));var Mustache=require(_0x47a6('0x6'));var util=require(_0x47a6('0x7'));var path=require('path');var sox=require(_0x47a6('0x8'));var csv=require(_0x47a6('0x9'));var ejs=require(_0x47a6('0xa'));var fs=require('fs');var fs_extra=require(_0x47a6('0xb'));var _=require(_0x47a6('0xc'));var squel=require(_0x47a6('0xd'));var crypto=require(_0x47a6('0xe'));var jsforce=require(_0x47a6('0xf'));var deskjs=require(_0x47a6('0x10'));var toCsv=require(_0x47a6('0x9'));var querystring=require(_0x47a6('0x11'));var Papa=require(_0x47a6('0x12'));var Redis=require(_0x47a6('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x47a6('0x14'));var as=require(_0x47a6('0x15'));var hardwareService=require(_0x47a6('0x16'));var logger=require(_0x47a6('0x17'))(_0x47a6('0x18'));var utils=require(_0x47a6('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x47a6('0x1a'))['db'];function respondWithStatusCode(_0x30412e,_0x55e711){_0x55e711=_0x55e711||0xcc;return function(_0x5c7e59){if(_0x5c7e59){return _0x30412e[_0x47a6('0x1b')](_0x55e711);}return _0x30412e['status'](_0x55e711)[_0x47a6('0x1c')]();};}function respondWithResult(_0x510e96,_0x32eddd){_0x32eddd=_0x32eddd||0xc8;return function(_0x26e52d){if(_0x26e52d){return _0x510e96[_0x47a6('0x1d')](_0x32eddd)['json'](_0x26e52d);}};}function respondWithFilteredResult(_0x1fb667,_0x5e0f50){return function(_0x5b5f56){if(_0x5b5f56){var _0x36dcb6=typeof _0x5e0f50[_0x47a6('0x1e')]===_0x47a6('0x1f')&&typeof _0x5e0f50[_0x47a6('0x20')]===_0x47a6('0x1f');var _0x430624=_0x5b5f56[_0x47a6('0x21')];var _0x2eaec9=_0x36dcb6?0x0:_0x5e0f50[_0x47a6('0x1e')];var _0x183fc5=_0x36dcb6?_0x5b5f56[_0x47a6('0x21')]:_0x5e0f50[_0x47a6('0x1e')]+_0x5e0f50[_0x47a6('0x20')];var _0x4448cd;if(_0x183fc5>=_0x430624){_0x183fc5=_0x430624;_0x4448cd=0xc8;}else{_0x4448cd=0xce;}_0x1fb667[_0x47a6('0x1d')](_0x4448cd);return _0x1fb667[_0x47a6('0x22')](_0x47a6('0x23'),_0x2eaec9+'-'+_0x183fc5+'/'+_0x430624)[_0x47a6('0x24')](_0x5b5f56);}return null;};}function patchUpdates(_0x1e3064){return function(_0x2e4faa){try{jsonpatch['apply'](_0x2e4faa,_0x1e3064,!![]);}catch(_0x5ae05c){return BPromise[_0x47a6('0x25')](_0x5ae05c);}return _0x2e4faa['save']();};}function saveUpdates(_0x366fbe,_0xece9dd){return function(_0x57ea09){if(_0x57ea09){return _0x57ea09[_0x47a6('0x26')](_0x366fbe)['then'](function(_0x30bbee){return _0x30bbee;});}return null;};}function removeEntity(_0x568beb,_0x30d588){return function(_0x1cfc45){if(_0x1cfc45){return _0x1cfc45['destroy']()[_0x47a6('0x27')](function(){_0x568beb[_0x47a6('0x1d')](0xcc)[_0x47a6('0x1c')]();});}};}function handleEntityNotFound(_0x523832,_0xa86bbf){return function(_0x3e5be9){if(!_0x3e5be9){_0x523832['sendStatus'](0x194);}return _0x3e5be9;};}function handleError(_0xa97f11,_0x48eeda){_0x48eeda=_0x48eeda||0x1f4;return function(_0x3ea035){logger['error'](_0x3ea035[_0x47a6('0x28')]);if(_0x3ea035[_0x47a6('0x29')]){delete _0x3ea035['name'];}_0xa97f11[_0x47a6('0x1d')](_0x48eeda)[_0x47a6('0x2a')](_0x3ea035);};}exports[_0x47a6('0x2b')]=function(_0x34297e,_0x2aa277){var _0x512b21={},_0x3a9a71={},_0x5f1eb4={'count':0x0,'rows':[]};var _0x27675c=_['map'](db[_0x47a6('0x2c')][_0x47a6('0x2d')],function(_0x43b967){return{'name':_0x43b967[_0x47a6('0x2e')],'type':_0x43b967['type'][_0x47a6('0x2f')]};});_0x3a9a71[_0x47a6('0x30')]=_[_0x47a6('0x31')](_0x27675c,_0x47a6('0x29'));_0x3a9a71[_0x47a6('0x32')]=_[_0x47a6('0x33')](_0x34297e[_0x47a6('0x32')]);_0x3a9a71[_0x47a6('0x34')]=_[_0x47a6('0x35')](_0x3a9a71[_0x47a6('0x30')],_0x3a9a71['query']);_0x512b21[_0x47a6('0x36')]=_[_0x47a6('0x35')](_0x3a9a71[_0x47a6('0x30')],qs['fields'](_0x34297e[_0x47a6('0x32')][_0x47a6('0x37')]));_0x512b21[_0x47a6('0x36')]=_0x512b21['attributes'][_0x47a6('0x38')]?_0x512b21[_0x47a6('0x36')]:_0x3a9a71[_0x47a6('0x30')];if(!_0x34297e[_0x47a6('0x32')]['hasOwnProperty'](_0x47a6('0x39'))){_0x512b21[_0x47a6('0x20')]=qs[_0x47a6('0x20')](_0x34297e[_0x47a6('0x32')][_0x47a6('0x20')]);_0x512b21[_0x47a6('0x1e')]=qs[_0x47a6('0x1e')](_0x34297e[_0x47a6('0x32')][_0x47a6('0x1e')]);}_0x512b21['order']=qs['sort'](_0x34297e[_0x47a6('0x32')][_0x47a6('0x3a')]);_0x512b21[_0x47a6('0x3b')]=qs[_0x47a6('0x34')](_['pick'](_0x34297e[_0x47a6('0x32')],_0x3a9a71[_0x47a6('0x34')]),_0x27675c);if(_0x34297e[_0x47a6('0x32')][_0x47a6('0x3c')]){_0x512b21['where']=_['merge'](_0x512b21[_0x47a6('0x3b')],{'$or':_[_0x47a6('0x31')](_0x27675c,function(_0x58bee0){if(_0x58bee0['type']!==_0x47a6('0x3d')){var _0xc69c47={};_0xc69c47[_0x58bee0[_0x47a6('0x29')]]={'$like':'%'+_0x34297e[_0x47a6('0x32')]['filter']+'%'};return _0xc69c47;}})});}_0x512b21=_['merge']({},_0x512b21,_0x34297e[_0x47a6('0x3e')]);var _0x59feef={'where':_0x512b21[_0x47a6('0x3b')]};return db['AnalyticTreeReport'][_0x47a6('0x21')](_0x59feef)['then'](function(_0x4d72bc){_0x5f1eb4[_0x47a6('0x21')]=_0x4d72bc;if(_0x34297e[_0x47a6('0x32')][_0x47a6('0x3f')]){_0x512b21[_0x47a6('0x40')]=[{'all':!![]}];}return db[_0x47a6('0x2c')]['findAll'](_0x512b21);})[_0x47a6('0x27')](function(_0x19356d){_0x5f1eb4[_0x47a6('0x41')]=_0x19356d;return _0x5f1eb4;})[_0x47a6('0x27')](respondWithFilteredResult(_0x2aa277,_0x512b21))['catch'](handleError(_0x2aa277,null));};exports[_0x47a6('0x42')]=function(_0x2a4b70,_0x39973d){var _0x16efb1={'raw':!![],'where':{'id':_0x2a4b70[_0x47a6('0x43')]['id']}},_0x13039e={};_0x13039e[_0x47a6('0x30')]=_['keys'](db[_0x47a6('0x2c')][_0x47a6('0x2d')]);_0x13039e[_0x47a6('0x32')]=_[_0x47a6('0x33')](_0x2a4b70[_0x47a6('0x32')]);_0x13039e[_0x47a6('0x34')]=_['intersection'](_0x13039e[_0x47a6('0x30')],_0x13039e[_0x47a6('0x32')]);_0x16efb1[_0x47a6('0x36')]=_[_0x47a6('0x35')](_0x13039e[_0x47a6('0x30')],qs[_0x47a6('0x37')](_0x2a4b70[_0x47a6('0x32')][_0x47a6('0x37')]));_0x16efb1[_0x47a6('0x36')]=_0x16efb1[_0x47a6('0x36')][_0x47a6('0x38')]?_0x16efb1[_0x47a6('0x36')]:_0x13039e[_0x47a6('0x30')];if(_0x2a4b70[_0x47a6('0x32')][_0x47a6('0x3f')]){_0x16efb1['include']=[{'all':!![]}];}_0x16efb1=_[_0x47a6('0x44')]({},_0x16efb1,_0x2a4b70[_0x47a6('0x3e')]);return db[_0x47a6('0x2c')][_0x47a6('0x45')](_0x16efb1)[_0x47a6('0x27')](handleEntityNotFound(_0x39973d,null))[_0x47a6('0x27')](respondWithResult(_0x39973d,null))[_0x47a6('0x46')](handleError(_0x39973d,null));};exports[_0x47a6('0x47')]=function(_0x430b14,_0x504e59){return db['AnalyticTreeReport'][_0x47a6('0x47')](_0x430b14['body'],{})[_0x47a6('0x27')](respondWithResult(_0x504e59,0xc9))[_0x47a6('0x46')](handleError(_0x504e59,null));};exports[_0x47a6('0x26')]=function(_0x3d90d1,_0x4067d6){if(_0x3d90d1[_0x47a6('0x48')]['id']){delete _0x3d90d1['body']['id'];}return db['AnalyticTreeReport'][_0x47a6('0x45')]({'where':{'id':_0x3d90d1[_0x47a6('0x43')]['id']}})[_0x47a6('0x27')](handleEntityNotFound(_0x4067d6,null))[_0x47a6('0x27')](saveUpdates(_0x3d90d1['body'],null))['then'](respondWithResult(_0x4067d6,null))[_0x47a6('0x46')](handleError(_0x4067d6,null));};exports[_0x47a6('0x49')]=function(_0x1bdb3d,_0x109235){return db[_0x47a6('0x2c')]['find']({'where':{'id':_0x1bdb3d['params']['id']}})[_0x47a6('0x27')](handleEntityNotFound(_0x109235,null))['then'](removeEntity(_0x109235,null))[_0x47a6('0x46')](handleError(_0x109235,null));}; \ No newline at end of file +var _0x6903=['apply','save','update','then','destroy','sendStatus','stack','name','send','map','AnalyticTreeReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x39d121,_0x5087e8){var _0x815f7f=function(_0xd3f00a){while(--_0xd3f00a){_0x39d121['push'](_0x39d121['shift']());}};_0x815f7f(++_0x5087e8);}(_0x6903,0x10e));var _0x3690=function(_0x1e4edd,_0x4c9fc5){_0x1e4edd=_0x1e4edd-0x0;var _0x47a8fa=_0x6903[_0x1e4edd];return _0x47a8fa;};'use strict';var emlformat=require(_0x3690('0x0'));var rimraf=require(_0x3690('0x1'));var zipdir=require(_0x3690('0x2'));var jsonpatch=require(_0x3690('0x3'));var rp=require(_0x3690('0x4'));var moment=require(_0x3690('0x5'));var BPromise=require(_0x3690('0x6'));var Mustache=require(_0x3690('0x7'));var util=require(_0x3690('0x8'));var path=require(_0x3690('0x9'));var sox=require('sox');var csv=require(_0x3690('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3690('0xb'));var _=require(_0x3690('0xc'));var squel=require('squel');var crypto=require(_0x3690('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3690('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3690('0xf'));var Redis=require(_0x3690('0x10'));var authService=require(_0x3690('0x11'));var qs=require(_0x3690('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3690('0x13'));var logger=require(_0x3690('0x14'))(_0x3690('0x15'));var utils=require(_0x3690('0x16'));var config=require(_0x3690('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3690('0x18'))['db'];function respondWithStatusCode(_0x589424,_0x5816e8){_0x5816e8=_0x5816e8||0xcc;return function(_0x5473b8){if(_0x5473b8){return _0x589424['sendStatus'](_0x5816e8);}return _0x589424['status'](_0x5816e8)[_0x3690('0x19')]();};}function respondWithResult(_0x5841aa,_0x1526c2){_0x1526c2=_0x1526c2||0xc8;return function(_0x8acd2b){if(_0x8acd2b){return _0x5841aa[_0x3690('0x1a')](_0x1526c2)[_0x3690('0x1b')](_0x8acd2b);}};}function respondWithFilteredResult(_0x41b842,_0x490846){return function(_0x569eb6){if(_0x569eb6){var _0xc7625f=typeof _0x490846[_0x3690('0x1c')]===_0x3690('0x1d')&&typeof _0x490846[_0x3690('0x1e')]==='undefined';var _0xbf8424=_0x569eb6[_0x3690('0x1f')];var _0x2f36e1=_0xc7625f?0x0:_0x490846[_0x3690('0x1c')];var _0x5ea283=_0xc7625f?_0x569eb6['count']:_0x490846[_0x3690('0x1c')]+_0x490846[_0x3690('0x1e')];var _0x5542ed;if(_0x5ea283>=_0xbf8424){_0x5ea283=_0xbf8424;_0x5542ed=0xc8;}else{_0x5542ed=0xce;}_0x41b842[_0x3690('0x1a')](_0x5542ed);return _0x41b842[_0x3690('0x20')](_0x3690('0x21'),_0x2f36e1+'-'+_0x5ea283+'/'+_0xbf8424)[_0x3690('0x1b')](_0x569eb6);}return null;};}function patchUpdates(_0x6fcd54){return function(_0x4592ca){try{jsonpatch[_0x3690('0x22')](_0x4592ca,_0x6fcd54,!![]);}catch(_0x282edd){return BPromise['reject'](_0x282edd);}return _0x4592ca[_0x3690('0x23')]();};}function saveUpdates(_0x5e0339,_0x531fdd){return function(_0x3985f9){if(_0x3985f9){return _0x3985f9[_0x3690('0x24')](_0x5e0339)[_0x3690('0x25')](function(_0x56f912){return _0x56f912;});}return null;};}function removeEntity(_0x11d7ef,_0x590390){return function(_0x2f51a5){if(_0x2f51a5){return _0x2f51a5[_0x3690('0x26')]()[_0x3690('0x25')](function(){_0x11d7ef['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2705f0,_0x4a8bd4){return function(_0x17eae0){if(!_0x17eae0){_0x2705f0[_0x3690('0x27')](0x194);}return _0x17eae0;};}function handleError(_0x5bd331,_0x4a5a1){_0x4a5a1=_0x4a5a1||0x1f4;return function(_0x352bee){logger['error'](_0x352bee[_0x3690('0x28')]);if(_0x352bee[_0x3690('0x29')]){delete _0x352bee[_0x3690('0x29')];}_0x5bd331[_0x3690('0x1a')](_0x4a5a1)[_0x3690('0x2a')](_0x352bee);};}exports['index']=function(_0x3f9c1f,_0x53cd49){var _0x4644f1={},_0xc34144={},_0x1c128e={'count':0x0,'rows':[]};var _0x43d6b0=_[_0x3690('0x2b')](db[_0x3690('0x2c')][_0x3690('0x2d')],function(_0x1172f1){return{'name':_0x1172f1[_0x3690('0x2e')],'type':_0x1172f1[_0x3690('0x2f')]['key']};});_0xc34144[_0x3690('0x30')]=_[_0x3690('0x2b')](_0x43d6b0,'name');_0xc34144[_0x3690('0x31')]=_[_0x3690('0x32')](_0x3f9c1f[_0x3690('0x31')]);_0xc34144[_0x3690('0x33')]=_[_0x3690('0x34')](_0xc34144[_0x3690('0x30')],_0xc34144[_0x3690('0x31')]);_0x4644f1[_0x3690('0x35')]=_[_0x3690('0x34')](_0xc34144[_0x3690('0x30')],qs[_0x3690('0x36')](_0x3f9c1f['query'][_0x3690('0x36')]));_0x4644f1['attributes']=_0x4644f1[_0x3690('0x35')]['length']?_0x4644f1[_0x3690('0x35')]:_0xc34144[_0x3690('0x30')];if(!_0x3f9c1f[_0x3690('0x31')][_0x3690('0x37')](_0x3690('0x38'))){_0x4644f1[_0x3690('0x1e')]=qs['limit'](_0x3f9c1f[_0x3690('0x31')][_0x3690('0x1e')]);_0x4644f1[_0x3690('0x1c')]=qs[_0x3690('0x1c')](_0x3f9c1f[_0x3690('0x31')][_0x3690('0x1c')]);}_0x4644f1[_0x3690('0x39')]=qs['sort'](_0x3f9c1f[_0x3690('0x31')][_0x3690('0x3a')]);_0x4644f1['where']=qs[_0x3690('0x33')](_[_0x3690('0x3b')](_0x3f9c1f['query'],_0xc34144[_0x3690('0x33')]),_0x43d6b0);if(_0x3f9c1f[_0x3690('0x31')][_0x3690('0x3c')]){_0x4644f1[_0x3690('0x3d')]=_['merge'](_0x4644f1['where'],{'$or':_['map'](_0x43d6b0,function(_0x3b0c30){if(_0x3b0c30[_0x3690('0x2f')]!==_0x3690('0x3e')){var _0x6e1dd1={};_0x6e1dd1[_0x3b0c30['name']]={'$like':'%'+_0x3f9c1f['query'][_0x3690('0x3c')]+'%'};return _0x6e1dd1;}})});}_0x4644f1=_['merge']({},_0x4644f1,_0x3f9c1f[_0x3690('0x3f')]);var _0x41b546={'where':_0x4644f1[_0x3690('0x3d')]};return db[_0x3690('0x2c')][_0x3690('0x1f')](_0x41b546)[_0x3690('0x25')](function(_0xa8dc18){_0x1c128e[_0x3690('0x1f')]=_0xa8dc18;if(_0x3f9c1f[_0x3690('0x31')][_0x3690('0x40')]){_0x4644f1[_0x3690('0x41')]=[{'all':!![]}];}return db[_0x3690('0x2c')][_0x3690('0x42')](_0x4644f1);})[_0x3690('0x25')](function(_0x23b015){_0x1c128e[_0x3690('0x43')]=_0x23b015;return _0x1c128e;})[_0x3690('0x25')](respondWithFilteredResult(_0x53cd49,_0x4644f1))[_0x3690('0x44')](handleError(_0x53cd49,null));};exports[_0x3690('0x45')]=function(_0x39222b,_0x25293d){var _0x369f10={'raw':!![],'where':{'id':_0x39222b[_0x3690('0x46')]['id']}},_0x2f0b14={};_0x2f0b14[_0x3690('0x30')]=_['keys'](db[_0x3690('0x2c')][_0x3690('0x2d')]);_0x2f0b14[_0x3690('0x31')]=_[_0x3690('0x32')](_0x39222b[_0x3690('0x31')]);_0x2f0b14['filters']=_[_0x3690('0x34')](_0x2f0b14['model'],_0x2f0b14[_0x3690('0x31')]);_0x369f10[_0x3690('0x35')]=_[_0x3690('0x34')](_0x2f0b14[_0x3690('0x30')],qs[_0x3690('0x36')](_0x39222b[_0x3690('0x31')]['fields']));_0x369f10[_0x3690('0x35')]=_0x369f10[_0x3690('0x35')][_0x3690('0x47')]?_0x369f10['attributes']:_0x2f0b14['model'];if(_0x39222b[_0x3690('0x31')]['includeAll']){_0x369f10[_0x3690('0x41')]=[{'all':!![]}];}_0x369f10=_[_0x3690('0x48')]({},_0x369f10,_0x39222b[_0x3690('0x3f')]);return db[_0x3690('0x2c')][_0x3690('0x49')](_0x369f10)[_0x3690('0x25')](handleEntityNotFound(_0x25293d,null))[_0x3690('0x25')](respondWithResult(_0x25293d,null))[_0x3690('0x44')](handleError(_0x25293d,null));};exports['create']=function(_0x49298b,_0x136153){return db[_0x3690('0x2c')][_0x3690('0x4a')](_0x49298b['body'],{})['then'](respondWithResult(_0x136153,0xc9))[_0x3690('0x44')](handleError(_0x136153,null));};exports[_0x3690('0x24')]=function(_0x686f7f,_0x2bceb7){if(_0x686f7f['body']['id']){delete _0x686f7f[_0x3690('0x4b')]['id'];}return db[_0x3690('0x2c')][_0x3690('0x49')]({'where':{'id':_0x686f7f[_0x3690('0x46')]['id']}})[_0x3690('0x25')](handleEntityNotFound(_0x2bceb7,null))['then'](saveUpdates(_0x686f7f[_0x3690('0x4b')],null))[_0x3690('0x25')](respondWithResult(_0x2bceb7,null))[_0x3690('0x44')](handleError(_0x2bceb7,null));};exports[_0x3690('0x26')]=function(_0x4196d9,_0x70e7c0){return db[_0x3690('0x2c')][_0x3690('0x49')]({'where':{'id':_0x4196d9[_0x3690('0x46')]['id']}})[_0x3690('0x25')](handleEntityNotFound(_0x70e7c0,null))[_0x3690('0x25')](removeEntity(_0x70e7c0,null))[_0x3690('0x44')](handleError(_0x70e7c0,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 1cc829b..b454df3 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 _0x215d=['AnalyticTreeReport','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x7ba1c3,_0x3dd545){var _0x82b393=function(_0x1550ce){while(--_0x1550ce){_0x7ba1c3['push'](_0x7ba1c3['shift']());}};_0x82b393(++_0x3dd545);}(_0x215d,0x187));var _0xd215=function(_0x3fc9b2,_0x2d201e){_0x3fc9b2=_0x3fc9b2-0x0;var _0x19ab05=_0x215d[_0x3fc9b2];return _0x19ab05;};'use strict';var _=require(_0xd215('0x0'));var util=require('util');var logger=require(_0xd215('0x1'))(_0xd215('0x2'));var moment=require(_0xd215('0x3'));var BPromise=require(_0xd215('0x4'));var rp=require(_0xd215('0x5'));var fs=require('fs');var path=require(_0xd215('0x6'));var rimraf=require('rimraf');var config=require(_0xd215('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0xd215('0x8')]=function(_0x1c1356,_0x269e38){return _0x1c1356['define'](_0xd215('0x9'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb16d=['rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x3000b6,_0x3d272a){var _0x38d185=function(_0x55e7bc){while(--_0x55e7bc){_0x3000b6['push'](_0x3000b6['shift']());}};_0x38d185(++_0x3d272a);}(_0xb16d,0x132));var _0xdb16=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb16d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdb16('0x0'));var util=require(_0xdb16('0x1'));var logger=require(_0xdb16('0x2'))(_0xdb16('0x3'));var moment=require('moment');var BPromise=require(_0xdb16('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdb16('0x5'));var rimraf=require(_0xdb16('0x6'));var config=require(_0xdb16('0x7'));var attributes=require(_0xdb16('0x8'));module[_0xdb16('0x9')]=function(_0x2a478c,_0x267977){return _0x2a478c[_0xdb16('0xa')](_0xdb16('0xb'),attributes,{'tableName':_0xdb16('0xc'),'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 9f88a73..397b166 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 _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x37f7ce,_0x4d75f4){var _0x3a18a7=function(_0x4bc164){while(--_0x4bc164){_0x37f7ce['push'](_0x37f7ce['shift']());}};_0x3a18a7(++_0x4d75f4);}(_0x1261,0x144));var _0x1126=function(_0x52d543,_0x4982e1){_0x52d543=_0x52d543-0x0;var _0x572ca0=_0x1261[_0x52d543];return _0x572ca0;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x2247ca,_0x32ff48){var _0x53336c=function(_0x255aab){while(--_0x255aab){_0x2247ca['push'](_0x2247ca['shift']());}};_0x53336c(++_0x32ff48);}(_0x1261,0x144));var _0x1126=function(_0x113c43,_0x171537){_0x113c43=_0x113c43-0x0;var _0x25a1ac=_0x1261[_0x113c43];return _0x25a1ac;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 65f8701..11f2cd8 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 _0x23a9=['create','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','/:id','isAuthenticated','show','post'];(function(_0x3d2c02,_0x113622){var _0x4d9ca0=function(_0x1d0dd1){while(--_0x1d0dd1){_0x3d2c02['push'](_0x3d2c02['shift']());}};_0x4d9ca0(++_0x113622);}(_0x23a9,0xc4));var _0x923a=function(_0x206fd0,_0x4e33a4){_0x206fd0=_0x206fd0-0x0;var _0x2457be=_0x23a9[_0x206fd0];return _0x2457be;};'use strict';var multer=require('multer');var util=require(_0x923a('0x0'));var path=require(_0x923a('0x1'));var timeout=require('connect-timeout');var express=require(_0x923a('0x2'));var router=express[_0x923a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x923a('0x4'));var interaction=require(_0x923a('0x5'));var config=require(_0x923a('0x6'));var controller=require(_0x923a('0x7'));router[_0x923a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x923a('0x8')](_0x923a('0x9'),auth[_0x923a('0xa')](),controller[_0x923a('0xb')]);router[_0x923a('0xc')]('/',auth[_0x923a('0xa')](),controller[_0x923a('0xd')]);router[_0x923a('0xe')](_0x923a('0x9'),auth['isAuthenticated'](),controller[_0x923a('0xf')]);router[_0x923a('0x10')](_0x923a('0x9'),auth['isAuthenticated'](),controller[_0x923a('0x11')]);module[_0x923a('0x12')]=router; \ No newline at end of file +var _0xdbe4=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','exports','multer','connect-timeout','Router'];(function(_0x2d8277,_0x365758){var _0xee46ba=function(_0x5560e8){while(--_0x5560e8){_0x2d8277['push'](_0x2d8277['shift']());}};_0xee46ba(++_0x365758);}(_0xdbe4,0x15d));var _0x4dbe=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdbe4[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x4dbe('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4dbe('0x1'));var express=require('express');var router=express[_0x4dbe('0x2')]();var fs_extra=require(_0x4dbe('0x3'));var auth=require(_0x4dbe('0x4'));var interaction=require(_0x4dbe('0x5'));var config=require(_0x4dbe('0x6'));var controller=require('./analyticTreeReport.controller');router[_0x4dbe('0x7')]('/',auth[_0x4dbe('0x8')](),controller[_0x4dbe('0x9')]);router[_0x4dbe('0x7')](_0x4dbe('0xa'),auth['isAuthenticated'](),controller[_0x4dbe('0xb')]);router[_0x4dbe('0xc')]('/',auth[_0x4dbe('0x8')](),controller[_0x4dbe('0xd')]);router[_0x4dbe('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x4dbe('0xa'),auth[_0x4dbe('0x8')](),controller['destroy']);module[_0x4dbe('0xf')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index f56a457..6f06b3b 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 _0xb458=['STRING','sequelize','exports'];(function(_0x4bb71a,_0x485978){var _0x3cb2cc=function(_0x18f457){while(--_0x18f457){_0x4bb71a['push'](_0x4bb71a['shift']());}};_0x3cb2cc(++_0x485978);}(_0xb458,0x103));var _0x8b45=function(_0x5c3526,_0x2a1e90){_0x5c3526=_0x5c3526-0x0;var _0xec27a2=_0xb458[_0x5c3526];return _0xec27a2;};'use strict';var Sequelize=require(_0x8b45('0x0'));module[_0x8b45('0x1')]={'name':{'type':Sequelize[_0x8b45('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x142c=['sequelize','STRING'];(function(_0x300522,_0x4562b4){var _0x536ff5=function(_0x3158b4){while(--_0x3158b4){_0x300522['push'](_0x300522['shift']());}};_0x536ff5(++_0x4562b4);}(_0x142c,0x86));var _0xc142=function(_0x45c771,_0x2f537c){_0x45c771=_0x45c771-0x0;var _0x49423d=_0x142c[_0x45c771];return _0x49423d;};'use strict';var Sequelize=require(_0xc142('0x0'));module['exports']={'name':{'type':Sequelize[_0xc142('0x1')]},'basename':{'type':Sequelize[_0xc142('0x1')]},'type':{'type':Sequelize[_0xc142('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index cd3d4f5..6badfad 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 _0x51f6=['sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','clone','find','get','omit','updatedAt','body','create','file','originalname','basename','filename','mimetype','download','findOne','join','root','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','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','count','limit','set','Content-Range','json','apply','save','update','then','destroy','error','name','map','Attachment','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x35741f,_0x1bfb4f){var _0x2cd2b7=function(_0x3513e5){while(--_0x3513e5){_0x35741f['push'](_0x35741f['shift']());}};_0x2cd2b7(++_0x1bfb4f);}(_0x51f6,0x7a));var _0x651f=function(_0x4b4493,_0x2389d5){_0x4b4493=_0x4b4493-0x0;var _0x2c395f=_0x51f6[_0x4b4493];return _0x2c395f;};'use strict';var emlformat=require(_0x651f('0x0'));var rimraf=require(_0x651f('0x1'));var zipdir=require(_0x651f('0x2'));var jsonpatch=require(_0x651f('0x3'));var rp=require(_0x651f('0x4'));var moment=require(_0x651f('0x5'));var BPromise=require(_0x651f('0x6'));var Mustache=require(_0x651f('0x7'));var util=require('util');var path=require(_0x651f('0x8'));var sox=require(_0x651f('0x9'));var csv=require(_0x651f('0xa'));var ejs=require(_0x651f('0xb'));var fs=require('fs');var fs_extra=require(_0x651f('0xc'));var _=require(_0x651f('0xd'));var squel=require(_0x651f('0xe'));var crypto=require(_0x651f('0xf'));var jsforce=require(_0x651f('0x10'));var deskjs=require(_0x651f('0x11'));var toCsv=require(_0x651f('0xa'));var querystring=require('querystring');var Papa=require(_0x651f('0x12'));var Redis=require(_0x651f('0x13'));var authService=require(_0x651f('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x651f('0x15'));var hardwareService=require(_0x651f('0x16'));var logger=require(_0x651f('0x17'))(_0x651f('0x18'));var utils=require(_0x651f('0x19'));var config=require(_0x651f('0x1a'));var licenseUtil=require(_0x651f('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3684c4,_0x1de72e){_0x1de72e=_0x1de72e||0xcc;return function(_0x36467f){if(_0x36467f){return _0x3684c4[_0x651f('0x1c')](_0x1de72e);}return _0x3684c4[_0x651f('0x1d')](_0x1de72e)[_0x651f('0x1e')]();};}function respondWithResult(_0x41897a,_0xe22ba0){_0xe22ba0=_0xe22ba0||0xc8;return function(_0xae2b28){if(_0xae2b28){return _0x41897a['status'](_0xe22ba0)['json'](_0xae2b28);}};}function respondWithFilteredResult(_0x20aa5e,_0x1fe8c9){return function(_0x1bce2c){if(_0x1bce2c){var _0x6c8202=typeof _0x1fe8c9[_0x651f('0x1f')]==='undefined'&&typeof _0x1fe8c9['limit']===_0x651f('0x20');var _0x521649=_0x1bce2c[_0x651f('0x21')];var _0x3eb2bd=_0x6c8202?0x0:_0x1fe8c9[_0x651f('0x1f')];var _0x477026=_0x6c8202?_0x1bce2c[_0x651f('0x21')]:_0x1fe8c9['offset']+_0x1fe8c9[_0x651f('0x22')];var _0x2ce732;if(_0x477026>=_0x521649){_0x477026=_0x521649;_0x2ce732=0xc8;}else{_0x2ce732=0xce;}_0x20aa5e[_0x651f('0x1d')](_0x2ce732);return _0x20aa5e[_0x651f('0x23')](_0x651f('0x24'),_0x3eb2bd+'-'+_0x477026+'/'+_0x521649)[_0x651f('0x25')](_0x1bce2c);}return null;};}function patchUpdates(_0x146f40){return function(_0x2b99d9){try{jsonpatch[_0x651f('0x26')](_0x2b99d9,_0x146f40,!![]);}catch(_0x530ccd){return BPromise['reject'](_0x530ccd);}return _0x2b99d9[_0x651f('0x27')]();};}function saveUpdates(_0x1958d2,_0x4fe4a5){return function(_0x4c6411){if(_0x4c6411){return _0x4c6411[_0x651f('0x28')](_0x1958d2)[_0x651f('0x29')](function(_0x5a2bc2){return _0x5a2bc2;});}return null;};}function removeEntity(_0x210e93,_0x491507){return function(_0x5b0939){if(_0x5b0939){return _0x5b0939[_0x651f('0x2a')]()[_0x651f('0x29')](function(){_0x210e93[_0x651f('0x1d')](0xcc)[_0x651f('0x1e')]();});}};}function handleEntityNotFound(_0x35678c,_0x540d30){return function(_0x455b6d){if(!_0x455b6d){_0x35678c['sendStatus'](0x194);}return _0x455b6d;};}function handleError(_0x2df0ae,_0x2fda9a){_0x2fda9a=_0x2fda9a||0x1f4;return function(_0x331fc6){logger[_0x651f('0x2b')](_0x331fc6['stack']);if(_0x331fc6[_0x651f('0x2c')]){delete _0x331fc6[_0x651f('0x2c')];}_0x2df0ae[_0x651f('0x1d')](_0x2fda9a)['send'](_0x331fc6);};}exports['index']=function(_0x113c1e,_0xe13c10){var _0x50c8f9={},_0x54e6d1={},_0x307f77={'count':0x0,'rows':[]};var _0x1a6968=_[_0x651f('0x2d')](db[_0x651f('0x2e')]['rawAttributes'],function(_0x56d2c7){return{'name':_0x56d2c7[_0x651f('0x2f')],'type':_0x56d2c7[_0x651f('0x30')][_0x651f('0x31')]};});_0x54e6d1[_0x651f('0x32')]=_[_0x651f('0x2d')](_0x1a6968,_0x651f('0x2c'));_0x54e6d1[_0x651f('0x33')]=_['keys'](_0x113c1e[_0x651f('0x33')]);_0x54e6d1[_0x651f('0x34')]=_[_0x651f('0x35')](_0x54e6d1['model'],_0x54e6d1[_0x651f('0x33')]);_0x50c8f9['attributes']=_[_0x651f('0x35')](_0x54e6d1[_0x651f('0x32')],qs['fields'](_0x113c1e[_0x651f('0x33')][_0x651f('0x36')]));_0x50c8f9[_0x651f('0x37')]=_0x50c8f9[_0x651f('0x37')][_0x651f('0x38')]?_0x50c8f9['attributes']:_0x54e6d1[_0x651f('0x32')];if(!_0x113c1e[_0x651f('0x33')][_0x651f('0x39')](_0x651f('0x3a'))){_0x50c8f9[_0x651f('0x22')]=qs[_0x651f('0x22')](_0x113c1e[_0x651f('0x33')][_0x651f('0x22')]);_0x50c8f9[_0x651f('0x1f')]=qs[_0x651f('0x1f')](_0x113c1e[_0x651f('0x33')][_0x651f('0x1f')]);}_0x50c8f9[_0x651f('0x3b')]=qs[_0x651f('0x3c')](_0x113c1e[_0x651f('0x33')][_0x651f('0x3c')]);_0x50c8f9[_0x651f('0x3d')]=qs[_0x651f('0x34')](_[_0x651f('0x3e')](_0x113c1e[_0x651f('0x33')],_0x54e6d1[_0x651f('0x34')]),_0x1a6968);if(_0x113c1e['query'][_0x651f('0x3f')]){_0x50c8f9[_0x651f('0x3d')]=_[_0x651f('0x40')](_0x50c8f9[_0x651f('0x3d')],{'$or':_[_0x651f('0x2d')](_0x1a6968,function(_0xcbbd4){if(_0xcbbd4[_0x651f('0x30')]!=='VIRTUAL'){var _0x36ebf8={};_0x36ebf8[_0xcbbd4[_0x651f('0x2c')]]={'$like':'%'+_0x113c1e[_0x651f('0x33')]['filter']+'%'};return _0x36ebf8;}})});}_0x50c8f9=_['merge']({},_0x50c8f9,_0x113c1e[_0x651f('0x41')]);var _0x57ebe1={'where':_0x50c8f9[_0x651f('0x3d')]};return db[_0x651f('0x2e')][_0x651f('0x21')](_0x57ebe1)[_0x651f('0x29')](function(_0x3abc48){_0x307f77[_0x651f('0x21')]=_0x3abc48;if(_0x113c1e['query'][_0x651f('0x42')]){_0x50c8f9[_0x651f('0x43')]=[{'all':!![]}];}return db['Attachment'][_0x651f('0x44')](_0x50c8f9);})[_0x651f('0x29')](function(_0x59bcdd){_0x307f77[_0x651f('0x45')]=_0x59bcdd;return _0x307f77;})[_0x651f('0x29')](respondWithFilteredResult(_0xe13c10,_0x50c8f9))[_0x651f('0x46')](handleError(_0xe13c10,null));};exports[_0x651f('0x47')]=function(_0x38bd71,_0x2abcda){var _0x57fafb={'raw':!![],'where':{'id':_0x38bd71[_0x651f('0x48')]['id']}},_0x1d76e9={};_0x1d76e9[_0x651f('0x32')]=_[_0x651f('0x49')](db[_0x651f('0x2e')][_0x651f('0x4a')]);_0x1d76e9['query']=_[_0x651f('0x49')](_0x38bd71[_0x651f('0x33')]);_0x1d76e9[_0x651f('0x34')]=_[_0x651f('0x35')](_0x1d76e9[_0x651f('0x32')],_0x1d76e9[_0x651f('0x33')]);_0x57fafb[_0x651f('0x37')]=_[_0x651f('0x35')](_0x1d76e9['model'],qs['fields'](_0x38bd71[_0x651f('0x33')][_0x651f('0x36')]));_0x57fafb[_0x651f('0x37')]=_0x57fafb[_0x651f('0x37')][_0x651f('0x38')]?_0x57fafb[_0x651f('0x37')]:_0x1d76e9[_0x651f('0x32')];if(_0x38bd71[_0x651f('0x33')][_0x651f('0x42')]){_0x57fafb[_0x651f('0x43')]=[{'all':!![]}];}_0x57fafb=_[_0x651f('0x40')]({},_0x57fafb,_0x38bd71['options']);return db[_0x651f('0x2e')]['find'](_0x57fafb)[_0x651f('0x29')](handleEntityNotFound(_0x2abcda,null))['then'](respondWithResult(_0x2abcda,null))[_0x651f('0x46')](handleError(_0x2abcda,null));};exports[_0x651f('0x4b')]=function(_0x2d870d,_0x459295){var _0x5b531b={'where':{'id':_0x2d870d['params']['id']}},_0x3bb392={};_0x3bb392[_0x651f('0x32')]=_[_0x651f('0x49')](db[_0x651f('0x2e')][_0x651f('0x4a')]);_0x5b531b['attributes']=_[_0x651f('0x35')](_0x3bb392[_0x651f('0x32')],qs[_0x651f('0x36')](_0x2d870d['query']['fields']));_0x5b531b[_0x651f('0x37')]=_0x5b531b[_0x651f('0x37')][_0x651f('0x38')]?_0x5b531b[_0x651f('0x37')]:_0x3bb392['model'];if(_0x2d870d[_0x651f('0x33')]['includeAll']){_0x5b531b[_0x651f('0x43')]=[{'all':!![]}];}_0x5b531b=_[_0x651f('0x40')]({},_0x5b531b,_0x2d870d[_0x651f('0x41')]);return db[_0x651f('0x2e')][_0x651f('0x4c')](_0x5b531b)['then'](handleEntityNotFound(_0x459295,null))[_0x651f('0x29')](function(_0x375f73){if(_0x375f73){var _0x395ab1=_0x375f73[_0x651f('0x4d')]({'plain':!![]});_0x395ab1=qs[_0x651f('0x4e')](_0x395ab1,['id','createdAt',_0x651f('0x4f')]);_0x2d870d[_0x651f('0x50')]=_[_0x651f('0x4e')](_0x2d870d[_0x651f('0x50')],['id','createdAt','updatedAt']);return db[_0x651f('0x2e')][_0x651f('0x51')](_[_0x651f('0x40')](_0x395ab1,_0x2d870d['body']),{'include':_0x2d870d[_0x651f('0x33')][_0x651f('0x42')]?[{'all':!![]}]:undefined});}})[_0x651f('0x29')](respondWithResult(_0x459295,0xc9))[_0x651f('0x46')](handleError(_0x459295,null));};exports[_0x651f('0x28')]=function(_0x1378f2,_0x644f8f){if(_0x1378f2[_0x651f('0x50')]['id']){delete _0x1378f2[_0x651f('0x50')]['id'];}return db[_0x651f('0x2e')][_0x651f('0x4c')]({'where':{'id':_0x1378f2[_0x651f('0x48')]['id']}})[_0x651f('0x29')](handleEntityNotFound(_0x644f8f,null))[_0x651f('0x29')](saveUpdates(_0x1378f2[_0x651f('0x50')],null))['then'](respondWithResult(_0x644f8f,null))[_0x651f('0x46')](handleError(_0x644f8f,null));};exports[_0x651f('0x2a')]=function(_0x5669ec,_0x29e349){return db[_0x651f('0x2e')][_0x651f('0x4c')]({'where':{'id':_0x5669ec[_0x651f('0x48')]['id']}})['then'](handleEntityNotFound(_0x29e349,null))[_0x651f('0x29')](removeEntity(_0x29e349,null))[_0x651f('0x46')](handleError(_0x29e349,null));};exports['create']=function(_0x2a6097,_0x43f66b,_0x1bb427){_0x2a6097[_0x651f('0x50')][_0x651f('0x2c')]=_0x2a6097[_0x651f('0x52')][_0x651f('0x53')];_0x2a6097[_0x651f('0x50')][_0x651f('0x54')]=_0x2a6097['file'][_0x651f('0x55')];_0x2a6097[_0x651f('0x50')][_0x651f('0x30')]=_0x2a6097[_0x651f('0x52')][_0x651f('0x56')];return db[_0x651f('0x2e')][_0x651f('0x51')](_0x2a6097[_0x651f('0x50')])[_0x651f('0x29')](respondWithResult(_0x43f66b,0xc9))['catch'](handleError(_0x43f66b,null));};exports[_0x651f('0x57')]=function(_0x75829e,_0x4de701,_0x1c3543){return db[_0x651f('0x2e')][_0x651f('0x58')]({'where':{'id':_0x75829e[_0x651f('0x48')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4de701,null))['then'](function(_0x3966fe){if(_0x3966fe){var _0x59d16e=_0x3966fe['ChatOfflineMessageId']!==null;var _0x4ac1be=path[_0x651f('0x59')](config[_0x651f('0x5a')],'server/files/attachments/');if(_0x59d16e){_0x4ac1be=path['join'](_0x4ac1be,'offline-chat/');}var _0xecde42=path[_0x651f('0x59')](_0x4ac1be,_0x3966fe[_0x651f('0x54')]);return _0x4de701['download'](_0xecde42);}})[_0x651f('0x46')](handleError(_0x4de701,null));}; \ No newline at end of file +var _0x7043=['count','set','Content-Range','apply','update','then','error','name','send','index','map','Attachment','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','catch','show','params','length','include','find','clone','get','omit','createdAt','updatedAt','body','destroy','create','file','originalname','basename','download','findOne','ChatOfflineMessageId','join','root','offline-chat/','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x262f1f,_0x593f60){var _0x2fafbe=function(_0x3449d6){while(--_0x3449d6){_0x262f1f['push'](_0x262f1f['shift']());}};_0x2fafbe(++_0x593f60);}(_0x7043,0xea));var _0x3704=function(_0xf7df73,_0xa4e4af){_0xf7df73=_0xf7df73-0x0;var _0x578c11=_0x7043[_0xf7df73];return _0x578c11;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3704('0x0'));var zipdir=require(_0x3704('0x1'));var jsonpatch=require(_0x3704('0x2'));var rp=require(_0x3704('0x3'));var moment=require(_0x3704('0x4'));var BPromise=require(_0x3704('0x5'));var Mustache=require(_0x3704('0x6'));var util=require(_0x3704('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3704('0x8'));var fs=require('fs');var fs_extra=require(_0x3704('0x9'));var _=require('lodash');var squel=require(_0x3704('0xa'));var crypto=require(_0x3704('0xb'));var jsforce=require(_0x3704('0xc'));var deskjs=require(_0x3704('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3704('0xe'));var Papa=require(_0x3704('0xf'));var Redis=require(_0x3704('0x10'));var authService=require(_0x3704('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3704('0x12'));var hardwareService=require(_0x3704('0x13'));var logger=require(_0x3704('0x14'))(_0x3704('0x15'));var utils=require(_0x3704('0x16'));var config=require(_0x3704('0x17'));var licenseUtil=require(_0x3704('0x18'));var db=require(_0x3704('0x19'))['db'];function respondWithStatusCode(_0x138017,_0x20bc4b){_0x20bc4b=_0x20bc4b||0xcc;return function(_0x528740){if(_0x528740){return _0x138017[_0x3704('0x1a')](_0x20bc4b);}return _0x138017[_0x3704('0x1b')](_0x20bc4b)[_0x3704('0x1c')]();};}function respondWithResult(_0x29b189,_0x1338a7){_0x1338a7=_0x1338a7||0xc8;return function(_0x150751){if(_0x150751){return _0x29b189[_0x3704('0x1b')](_0x1338a7)[_0x3704('0x1d')](_0x150751);}};}function respondWithFilteredResult(_0x498e98,_0x564faa){return function(_0xb5b588){if(_0xb5b588){var _0x731e94=typeof _0x564faa[_0x3704('0x1e')]===_0x3704('0x1f')&&typeof _0x564faa[_0x3704('0x20')]===_0x3704('0x1f');var _0x16d89e=_0xb5b588[_0x3704('0x21')];var _0x5d9f3a=_0x731e94?0x0:_0x564faa['offset'];var _0x20a94b=_0x731e94?_0xb5b588[_0x3704('0x21')]:_0x564faa['offset']+_0x564faa[_0x3704('0x20')];var _0x5b2a12;if(_0x20a94b>=_0x16d89e){_0x20a94b=_0x16d89e;_0x5b2a12=0xc8;}else{_0x5b2a12=0xce;}_0x498e98[_0x3704('0x1b')](_0x5b2a12);return _0x498e98[_0x3704('0x22')](_0x3704('0x23'),_0x5d9f3a+'-'+_0x20a94b+'/'+_0x16d89e)[_0x3704('0x1d')](_0xb5b588);}return null;};}function patchUpdates(_0x349102){return function(_0x43b71d){try{jsonpatch[_0x3704('0x24')](_0x43b71d,_0x349102,!![]);}catch(_0x472566){return BPromise['reject'](_0x472566);}return _0x43b71d['save']();};}function saveUpdates(_0x4e1bb4,_0x56613f){return function(_0x3ddf08){if(_0x3ddf08){return _0x3ddf08[_0x3704('0x25')](_0x4e1bb4)[_0x3704('0x26')](function(_0x110674){return _0x110674;});}return null;};}function removeEntity(_0x1dbb9a,_0x4d00d7){return function(_0x45dfd6){if(_0x45dfd6){return _0x45dfd6['destroy']()[_0x3704('0x26')](function(){_0x1dbb9a[_0x3704('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x346de0,_0x51a369){return function(_0x51db45){if(!_0x51db45){_0x346de0[_0x3704('0x1a')](0x194);}return _0x51db45;};}function handleError(_0x3902ea,_0x296b61){_0x296b61=_0x296b61||0x1f4;return function(_0x1be053){logger[_0x3704('0x27')](_0x1be053['stack']);if(_0x1be053[_0x3704('0x28')]){delete _0x1be053[_0x3704('0x28')];}_0x3902ea[_0x3704('0x1b')](_0x296b61)[_0x3704('0x29')](_0x1be053);};}exports[_0x3704('0x2a')]=function(_0x5ebc91,_0xc38665){var _0x4aff21={},_0x248a03={},_0xc96f0c={'count':0x0,'rows':[]};var _0x23e9a9=_[_0x3704('0x2b')](db[_0x3704('0x2c')][_0x3704('0x2d')],function(_0x37f5dd){return{'name':_0x37f5dd[_0x3704('0x2e')],'type':_0x37f5dd[_0x3704('0x2f')]['key']};});_0x248a03['model']=_['map'](_0x23e9a9,_0x3704('0x28'));_0x248a03[_0x3704('0x30')]=_[_0x3704('0x31')](_0x5ebc91[_0x3704('0x30')]);_0x248a03[_0x3704('0x32')]=_[_0x3704('0x33')](_0x248a03[_0x3704('0x34')],_0x248a03[_0x3704('0x30')]);_0x4aff21[_0x3704('0x35')]=_['intersection'](_0x248a03['model'],qs['fields'](_0x5ebc91['query'][_0x3704('0x36')]));_0x4aff21[_0x3704('0x35')]=_0x4aff21[_0x3704('0x35')]['length']?_0x4aff21[_0x3704('0x35')]:_0x248a03[_0x3704('0x34')];if(!_0x5ebc91['query'][_0x3704('0x37')](_0x3704('0x38'))){_0x4aff21['limit']=qs[_0x3704('0x20')](_0x5ebc91[_0x3704('0x30')]['limit']);_0x4aff21[_0x3704('0x1e')]=qs[_0x3704('0x1e')](_0x5ebc91[_0x3704('0x30')][_0x3704('0x1e')]);}_0x4aff21[_0x3704('0x39')]=qs['sort'](_0x5ebc91[_0x3704('0x30')][_0x3704('0x3a')]);_0x4aff21[_0x3704('0x3b')]=qs[_0x3704('0x32')](_[_0x3704('0x3c')](_0x5ebc91[_0x3704('0x30')],_0x248a03[_0x3704('0x32')]),_0x23e9a9);if(_0x5ebc91[_0x3704('0x30')][_0x3704('0x3d')]){_0x4aff21[_0x3704('0x3b')]=_['merge'](_0x4aff21['where'],{'$or':_[_0x3704('0x2b')](_0x23e9a9,function(_0x3e48d9){if(_0x3e48d9[_0x3704('0x2f')]!==_0x3704('0x3e')){var _0x4c67e4={};_0x4c67e4[_0x3e48d9[_0x3704('0x28')]]={'$like':'%'+_0x5ebc91[_0x3704('0x30')][_0x3704('0x3d')]+'%'};return _0x4c67e4;}})});}_0x4aff21=_[_0x3704('0x3f')]({},_0x4aff21,_0x5ebc91[_0x3704('0x40')]);var _0x4dfe5d={'where':_0x4aff21['where']};return db[_0x3704('0x2c')]['count'](_0x4dfe5d)[_0x3704('0x26')](function(_0x1b1bfe){_0xc96f0c[_0x3704('0x21')]=_0x1b1bfe;if(_0x5ebc91[_0x3704('0x30')][_0x3704('0x41')]){_0x4aff21['include']=[{'all':!![]}];}return db[_0x3704('0x2c')]['findAll'](_0x4aff21);})['then'](function(_0x3cf266){_0xc96f0c['rows']=_0x3cf266;return _0xc96f0c;})[_0x3704('0x26')](respondWithFilteredResult(_0xc38665,_0x4aff21))[_0x3704('0x42')](handleError(_0xc38665,null));};exports[_0x3704('0x43')]=function(_0x59f849,_0x92dff4){var _0x2e77aa={'raw':!![],'where':{'id':_0x59f849[_0x3704('0x44')]['id']}},_0x6a8382={};_0x6a8382[_0x3704('0x34')]=_['keys'](db['Attachment'][_0x3704('0x2d')]);_0x6a8382[_0x3704('0x30')]=_[_0x3704('0x31')](_0x59f849['query']);_0x6a8382['filters']=_['intersection'](_0x6a8382[_0x3704('0x34')],_0x6a8382[_0x3704('0x30')]);_0x2e77aa[_0x3704('0x35')]=_[_0x3704('0x33')](_0x6a8382[_0x3704('0x34')],qs[_0x3704('0x36')](_0x59f849['query']['fields']));_0x2e77aa[_0x3704('0x35')]=_0x2e77aa[_0x3704('0x35')][_0x3704('0x45')]?_0x2e77aa[_0x3704('0x35')]:_0x6a8382[_0x3704('0x34')];if(_0x59f849['query'][_0x3704('0x41')]){_0x2e77aa[_0x3704('0x46')]=[{'all':!![]}];}_0x2e77aa=_[_0x3704('0x3f')]({},_0x2e77aa,_0x59f849['options']);return db['Attachment'][_0x3704('0x47')](_0x2e77aa)['then'](handleEntityNotFound(_0x92dff4,null))[_0x3704('0x26')](respondWithResult(_0x92dff4,null))['catch'](handleError(_0x92dff4,null));};exports[_0x3704('0x48')]=function(_0x48b7fd,_0x481ccd){var _0x5ed644={'where':{'id':_0x48b7fd[_0x3704('0x44')]['id']}},_0x5c06e3={};_0x5c06e3['model']=_['keys'](db[_0x3704('0x2c')][_0x3704('0x2d')]);_0x5ed644[_0x3704('0x35')]=_['intersection'](_0x5c06e3[_0x3704('0x34')],qs[_0x3704('0x36')](_0x48b7fd['query'][_0x3704('0x36')]));_0x5ed644[_0x3704('0x35')]=_0x5ed644['attributes'][_0x3704('0x45')]?_0x5ed644['attributes']:_0x5c06e3[_0x3704('0x34')];if(_0x48b7fd[_0x3704('0x30')]['includeAll']){_0x5ed644[_0x3704('0x46')]=[{'all':!![]}];}_0x5ed644=_[_0x3704('0x3f')]({},_0x5ed644,_0x48b7fd[_0x3704('0x40')]);return db[_0x3704('0x2c')][_0x3704('0x47')](_0x5ed644)[_0x3704('0x26')](handleEntityNotFound(_0x481ccd,null))[_0x3704('0x26')](function(_0x44df45){if(_0x44df45){var _0x5bf0e4=_0x44df45[_0x3704('0x49')]({'plain':!![]});_0x5bf0e4=qs[_0x3704('0x4a')](_0x5bf0e4,['id',_0x3704('0x4b'),_0x3704('0x4c')]);_0x48b7fd[_0x3704('0x4d')]=_[_0x3704('0x4a')](_0x48b7fd['body'],['id','createdAt',_0x3704('0x4c')]);return db[_0x3704('0x2c')]['create'](_['merge'](_0x5bf0e4,_0x48b7fd[_0x3704('0x4d')]),{'include':_0x48b7fd['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0x3704('0x26')](respondWithResult(_0x481ccd,0xc9))[_0x3704('0x42')](handleError(_0x481ccd,null));};exports[_0x3704('0x25')]=function(_0x583c8b,_0x4fc441){if(_0x583c8b[_0x3704('0x4d')]['id']){delete _0x583c8b['body']['id'];}return db[_0x3704('0x2c')][_0x3704('0x47')]({'where':{'id':_0x583c8b[_0x3704('0x44')]['id']}})[_0x3704('0x26')](handleEntityNotFound(_0x4fc441,null))[_0x3704('0x26')](saveUpdates(_0x583c8b[_0x3704('0x4d')],null))[_0x3704('0x26')](respondWithResult(_0x4fc441,null))[_0x3704('0x42')](handleError(_0x4fc441,null));};exports[_0x3704('0x4e')]=function(_0x2b70a1,_0x2607f6){return db[_0x3704('0x2c')]['find']({'where':{'id':_0x2b70a1[_0x3704('0x44')]['id']}})[_0x3704('0x26')](handleEntityNotFound(_0x2607f6,null))[_0x3704('0x26')](removeEntity(_0x2607f6,null))[_0x3704('0x42')](handleError(_0x2607f6,null));};exports[_0x3704('0x4f')]=function(_0x429eef,_0x145eae,_0x36579a){_0x429eef[_0x3704('0x4d')][_0x3704('0x28')]=_0x429eef[_0x3704('0x50')][_0x3704('0x51')];_0x429eef[_0x3704('0x4d')][_0x3704('0x52')]=_0x429eef[_0x3704('0x50')]['filename'];_0x429eef[_0x3704('0x4d')][_0x3704('0x2f')]=_0x429eef[_0x3704('0x50')]['mimetype'];return db[_0x3704('0x2c')][_0x3704('0x4f')](_0x429eef[_0x3704('0x4d')])[_0x3704('0x26')](respondWithResult(_0x145eae,0xc9))[_0x3704('0x42')](handleError(_0x145eae,null));};exports[_0x3704('0x53')]=function(_0x4cf73d,_0x4dddcd,_0x3b77b1){return db[_0x3704('0x2c')][_0x3704('0x54')]({'where':{'id':_0x4cf73d[_0x3704('0x44')]['id']},'raw':!![]})[_0x3704('0x26')](handleEntityNotFound(_0x4dddcd,null))[_0x3704('0x26')](function(_0x6a5b14){if(_0x6a5b14){var _0x313c50=_0x6a5b14[_0x3704('0x55')]!==null;var _0x2dfb12=path[_0x3704('0x56')](config[_0x3704('0x57')],'server/files/attachments/');if(_0x313c50){_0x2dfb12=path[_0x3704('0x56')](_0x2dfb12,_0x3704('0x58'));}var _0x30cf41=path[_0x3704('0x56')](_0x2dfb12,_0x6a5b14[_0x3704('0x52')]);return _0x4dddcd['download'](_0x30cf41);}})[_0x3704('0x42')](handleError(_0x4dddcd,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 8d171a5..3adc835 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 _0xa52d=['rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xa52d,0x77));var _0xda52=function(_0x8e8ca7,_0x5a5e07){_0x8e8ca7=_0x8e8ca7-0x0;var _0x561381=_0xa52d[_0x8e8ca7];return _0x561381;};'use strict';var _=require(_0xda52('0x0'));var util=require(_0xda52('0x1'));var logger=require(_0xda52('0x2'))(_0xda52('0x3'));var moment=require(_0xda52('0x4'));var BPromise=require('bluebird');var rp=require(_0xda52('0x5'));var fs=require('fs');var path=require(_0xda52('0x6'));var rimraf=require(_0xda52('0x7'));var config=require(_0xda52('0x8'));var attributes=require(_0xda52('0x9'));module[_0xda52('0xa')]=function(_0x2c9a07,_0x2bd10d){return _0x2c9a07[_0xda52('0xb')](_0xda52('0xc'),attributes,{'tableName':_0xda52('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84c4=['attachments','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Attachment'];(function(_0x185c25,_0x2337f){var _0x2e7997=function(_0x25aebd){while(--_0x25aebd){_0x185c25['push'](_0x185c25['shift']());}};_0x2e7997(++_0x2337f);}(_0x84c4,0x187));var _0x484c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84c4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x484c('0x0'));var util=require('util');var logger=require(_0x484c('0x1'))(_0x484c('0x2'));var moment=require(_0x484c('0x3'));var BPromise=require(_0x484c('0x4'));var rp=require(_0x484c('0x5'));var fs=require('fs');var path=require(_0x484c('0x6'));var rimraf=require(_0x484c('0x7'));var config=require(_0x484c('0x8'));var attributes=require('./attachment.attributes');module[_0x484c('0x9')]=function(_0x4a4030,_0x127b35){return _0x4a4030[_0x484c('0xa')](_0x484c('0xb'),attributes,{'tableName':_0x484c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index a055e96..116627d 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 _0x9224=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateAttachment','create','body','options','raw'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x9224,0xa3));var _0x4922=function(_0x20daba,_0x56a9df){_0x20daba=_0x20daba-0x0;var _0x10bd26=_0x9224[_0x20daba];return _0x10bd26;};'use strict';var _=require('lodash');var util=require(_0x4922('0x0'));var moment=require(_0x4922('0x1'));var BPromise=require(_0x4922('0x2'));var rs=require(_0x4922('0x3'));var fs=require('fs');var Redis=require(_0x4922('0x4'));var db=require(_0x4922('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4922('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4922('0x7')][_0x4922('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4216c0,_0x251048,_0x7a8bd1){return new BPromise(function(_0x245562,_0x5c65dd){return client[_0x4922('0x9')](_0x4216c0,_0x7a8bd1)[_0x4922('0xa')](function(_0x50db40){logger[_0x4922('0xb')](_0x4922('0xc'),_0x251048,_0x4922('0xd'));logger[_0x4922('0xe')](_0x4922('0xf'),_0x251048,_0x4922('0xd'),JSON[_0x4922('0x10')](_0x50db40));if(_0x50db40[_0x4922('0x11')]){if(_0x50db40['error'][_0x4922('0x12')]===0x1f4){logger['error'](_0x4922('0xc'),_0x251048,_0x50db40[_0x4922('0x11')][_0x4922('0x13')]);return _0x5c65dd(_0x50db40[_0x4922('0x11')][_0x4922('0x13')]);}logger['error'](_0x4922('0xc'),_0x251048,_0x50db40[_0x4922('0x11')]['message']);return _0x245562(_0x50db40[_0x4922('0x11')][_0x4922('0x13')]);}else{logger[_0x4922('0xb')](_0x4922('0xc'),_0x251048,_0x4922('0xd'));_0x245562(_0x50db40[_0x4922('0x14')][_0x4922('0x13')]);}})['catch'](function(_0x2ae924){logger['error'](_0x4922('0xc'),_0x251048,_0x2ae924);_0x5c65dd(_0x2ae924);});});}exports[_0x4922('0x15')]=function(_0x1d7fc2){var _0x15cdc9=this;return new Promise(function(_0x2ef410,_0x435e7b){return db['Attachment'][_0x4922('0x16')](_0x1d7fc2[_0x4922('0x17')],{'raw':_0x1d7fc2[_0x4922('0x18')]?_0x1d7fc2[_0x4922('0x18')][_0x4922('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x2b6a2d){logger[_0x4922('0xb')](_0x4922('0x15'),_0x1d7fc2);logger[_0x4922('0xe')](_0x4922('0x15'),_0x1d7fc2,JSON[_0x4922('0x10')](_0x2b6a2d));_0x2ef410(_0x2b6a2d);})[_0x4922('0x1a')](function(_0x3b182b){logger['error'](_0x4922('0x15'),_0x3b182b[_0x4922('0x13')],_0x1d7fc2);_0x435e7b(_0x15cdc9['error'](0x1f4,_0x3b182b[_0x4922('0x13')]));});});}; \ No newline at end of file +var _0x984b=['ioredis','../../config/logger','rpc','client','http','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Attachment','create','options','raw','CreateAttachment','bluebird','randomstring'];(function(_0x3908f2,_0x20176e){var _0x3dcb1e=function(_0x4b7b3e){while(--_0x4b7b3e){_0x3908f2['push'](_0x3908f2['shift']());}};_0x3dcb1e(++_0x20176e);}(_0x984b,0xee));var _0xb984=function(_0x2d1d07,_0x9c8af3){_0x2d1d07=_0x2d1d07-0x0;var _0x4b7f25=_0x984b[_0x2d1d07];return _0x4b7f25;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb984('0x0'));var rs=require(_0xb984('0x1'));var fs=require('fs');var Redis=require(_0xb984('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb984('0x3'))(_0xb984('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb984('0x5')][_0xb984('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5a605a,_0x7405cd,_0x1a00d6){return new BPromise(function(_0x4d72b7,_0x37fd36){return client['request'](_0x5a605a,_0x1a00d6)[_0xb984('0x7')](function(_0x42dfd9){logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,_0xb984('0xa'));logger[_0xb984('0xb')](_0xb984('0xc'),_0x7405cd,_0xb984('0xa'),JSON[_0xb984('0xd')](_0x42dfd9));if(_0x42dfd9[_0xb984('0xe')]){if(_0x42dfd9[_0xb984('0xe')][_0xb984('0xf')]===0x1f4){logger['error'](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x37fd36(_0x42dfd9[_0xb984('0xe')]['message']);}logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x4d72b7(_0x42dfd9[_0xb984('0xe')]['message']);}else{logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,'request\x20sent');_0x4d72b7(_0x42dfd9[_0xb984('0x11')]['message']);}})[_0xb984('0x12')](function(_0x1dc4df){logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x1dc4df);_0x37fd36(_0x1dc4df);});});}exports['CreateAttachment']=function(_0x396c36){var _0x35bd75=this;return new Promise(function(_0x3a5c96,_0x9afbee){return db[_0xb984('0x13')][_0xb984('0x14')](_0x396c36['body'],{'raw':_0x396c36[_0xb984('0x15')]?_0x396c36[_0xb984('0x15')][_0xb984('0x16')]===undefined?!![]:![]:!![]})[_0xb984('0x7')](function(_0x32831b){logger[_0xb984('0x8')]('CreateAttachment',_0x396c36);logger[_0xb984('0xb')](_0xb984('0x17'),_0x396c36,JSON['stringify'](_0x32831b));_0x3a5c96(_0x32831b);})[_0xb984('0x12')](function(_0x97af5c){logger[_0xb984('0xe')](_0xb984('0x17'),_0x97af5c[_0xb984('0x10')],_0x396c36);_0x9afbee(_0x35bd75[_0xb984('0xe')](0x1f4,_0x97af5c[_0xb984('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 4992e7b..46be08b 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 _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x289e64,_0x5adb3c){var _0x30246c=function(_0x1bf7f6){while(--_0x1bf7f6){_0x289e64['push'](_0x289e64['shift']());}};_0x30246c(++_0x5adb3c);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file +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(_0x306db8,_0x5959f){var _0xc0d4fe=function(_0x5352aa){while(--_0x5352aa){_0x306db8['push'](_0x306db8['shift']());}};_0xc0d4fe(++_0x5959f);}(_0xadb5,0xad));var _0x5adb=function(_0x1c54d4,_0x538c3e){_0x1c54d4=_0x1c54d4-0x0;var _0x186f8d=_0xadb5[_0x1c54d4];return _0x186f8d;};'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/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 02e13fc..113ada5 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8111=['Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','salt','role','disabled','blocked','blockedAt','online','user','agent','add','minutes','getLicense','catch','status','send','ad-login','json','use','User','passport','passport-local','Strategy','moment','bluebird','util','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','activedirectory','undefined','baseDN','url','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','blockDuration','then','adSsoEnabled'];(function(_0x7dbed6,_0x15cb72){var _0x2402eb=function(_0x28a284){while(--_0x28a284){_0x7dbed6['push'](_0x7dbed6['shift']());}};_0x2402eb(++_0x15cb72);}(_0x8111,0x1bd));var _0x1811=function(_0x227c29,_0x75678d){_0x227c29=_0x227c29-0x0;var _0x41b03b=_0x8111[_0x227c29];return _0x41b03b;};'use strict';var passport=require(_0x1811('0x0'));var LocalStrategy=require(_0x1811('0x1'))[_0x1811('0x2')];var moment=require(_0x1811('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x1811('0x4'));var util=require(_0x1811('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x1811('0x6'));var utils=require(_0x1811('0x7'));var config=require(_0x1811('0x8'));var logger=require(_0x1811('0x9'))('api');function isActiveDirectoryConfigured(_0x4afeb6){var _0x3cc119=![];if(typeof _0x4afeb6[_0x1811('0xa')]!==_0x1811('0xb')){_0x3cc119=_0x4afeb6['activedirectory'][_0x1811('0xc')]&&_0x4afeb6[_0x1811('0xa')][_0x1811('0xd')]&&_0x4afeb6[_0x1811('0xa')]['domain'];}return _0x3cc119;}function adAuthenticate(_0x147fa5,_0x398cb9,_0x1e9f91){return new BPromise(function(_0x1723f3,_0x3a3dfc){try{var _0x32e65b=new ActiveDirectory(_0x147fa5);_0x32e65b[_0x1811('0xe')](_0x398cb9,_0x1e9f91,function(_0x3913c0,_0x423d89){if(_0x3913c0){logger[_0x1811('0xf')](_0x1811('0x10'),_0x398cb9,util[_0x1811('0x11')](_0x3913c0,{'showHidden':![],'depth':null}));_0x3a3dfc(_0x1811('0x12'));}else if(!_0x423d89){logger['error'](_0x1811('0x13'),_0x398cb9);_0x3a3dfc(_0x1811('0x12'));}else{_0x1723f3(_0x423d89);}});}catch(_0x2449e8){_0x3a3dfc(_0x2449e8);}});}function ActiveDirectoryAuthenticate(_0x28cf39,_0x5e06ba,_0x374f75,_0x1fed60){var _0x412855,_0x5008e7;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x1811('0x14'),_0x5e06ba);return _0x1fed60(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x1811('0x15')]['findOne']({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x1811('0x16')],'raw':!![]})[_0x1811('0x17')](function(_0x3c3556){_0x412855=_0x3c3556;if(!_0x412855[_0x1811('0x18')]){logger[_0x1811('0xf')](_0x1811('0x19'),_0x5e06ba);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x28cf39[_0x1811('0x1a')]({'attributes':['id',_0x1811('0x1b'),_0x1811('0x1c'),_0x1811('0x1d'),_0x1811('0x1e'),_0x1811('0x1f'),_0x1811('0x20'),_0x1811('0x21'),_0x1811('0x22')],'where':{'name':_0x5e06ba,'role':{'$or':['admin',_0x1811('0x23'),_0x1811('0x24')]},'adSsoEnabled':!![]}});})[_0x1811('0x17')](function(_0x4da99e){if(!_0x4da99e||_0x4da99e&&_0x4da99e[_0x1811('0x1b')]!==_0x5e06ba){throw new Error(_0x1811('0x12'));}_0x5008e7=_0x4da99e;var _0x3bb4c1=_0x5008e7[_0x1811('0x1b')]+'@'+config[_0x1811('0xa')]['domain'];return adAuthenticate(config[_0x1811('0xa')],_0x3bb4c1,_0x374f75);})['then'](function(_0x175d32){if(_0x5008e7[_0x1811('0x1f')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x412855['blockDuration']>0x0){if(_0x5008e7[_0x1811('0x20')]){if(moment(_0x5008e7[_0x1811('0x21')])[_0x1811('0x25')](_0x412855[_0x1811('0x16')],_0x1811('0x26'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils['clearBlockUser'](_0x5008e7,0x0,![],null)[_0x1811('0x17')](function(){return utils[_0x1811('0x27')](_0x5008e7);})['then'](function(){return _0x1fed60(null,_0x5008e7);});}else{return utils[_0x1811('0x27')](_0x5008e7)[_0x1811('0x17')](function(){return _0x1fed60(null,_0x5008e7);});}}else{return utils[_0x1811('0x27')](_0x5008e7)[_0x1811('0x17')](function(){return _0x1fed60(null,_0x5008e7);});}})[_0x1811('0x28')](function(_0x4f05d1){return _0x1fed60(null,![],_0x4f05d1);});}function handleError(_0xe95719,_0x161c43,_0x1f57f0){return _0xe95719[_0x1811('0x29')](_0x161c43||0x1f4)[_0x1811('0x2a')]({'message':_0x1f57f0?_0x1f57f0['message']||_0x1f57f0:''});}exports['login']=function(_0x14d625,_0x5631eb,_0x49f6b6){passport[_0x1811('0xe')](_0x1811('0x2b'),function(_0x18626a,_0xa48298,_0x4b9335){var _0x1a6f7a=_0x18626a||_0x4b9335;if(_0x1a6f7a){return handleError(_0x5631eb,0x191,_0x1a6f7a);}if(!_0xa48298){return handleError(_0x5631eb,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x3681b1={'payload':{'id':_0xa48298['id'],'role':_0xa48298[_0x1811('0x1e')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x3681b1)[_0x1811('0x17')](function(_0x32cda5){_0x5631eb[_0x1811('0x2c')]({'id':_0xa48298['id'],'token':_0x32cda5,'statusCall':'','isAlreadyLogged':_0xa48298[_0x1811('0x22')]});});}})(_0x14d625,_0x5631eb,_0x49f6b6);};passport[_0x1811('0x2d')](_0x1811('0x2b'),new LocalStrategy({'usernameField':_0x1811('0x1b'),'passwordField':'password'},function(_0x2542b3,_0x4c20fe,_0x5b2757){return ActiveDirectoryAuthenticate(db[_0x1811('0x2e')],_0x2542b3,_0x4c20fe,_0x5b2757);})); \ No newline at end of file +var _0xd883=['inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Setting','findOne','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','role','disabled','blocked','blockedAt','online','admin','user','agent','blockDuration','add','minutes','clearBlockUser','getLicense','status','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','ad-login','passport','passport-local','Strategy','moment','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','activedirectory','undefined','baseDN','domain','authenticate','Error\x20authenticate\x20%s:\x20%s'];(function(_0x289a67,_0x1e5a3c){var _0x572b49=function(_0x22e036){while(--_0x22e036){_0x289a67['push'](_0x289a67['shift']());}};_0x572b49(++_0x1e5a3c);}(_0xd883,0x81));var _0x3d88=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xd883[_0x5d2803];return _0xdcad2c;};'use strict';var passport=require(_0x3d88('0x0'));var LocalStrategy=require(_0x3d88('0x1'))[_0x3d88('0x2')];var moment=require(_0x3d88('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x3d88('0x4'));var util=require('util');var db=require(_0x3d88('0x5'))['db'];var authService=require(_0x3d88('0x6'));var utils=require(_0x3d88('0x7'));var config=require('../../config/environment');var logger=require(_0x3d88('0x8'))('api');function isActiveDirectoryConfigured(_0x423431){var _0x171324=![];if(typeof _0x423431[_0x3d88('0x9')]!==_0x3d88('0xa')){_0x171324=_0x423431[_0x3d88('0x9')][_0x3d88('0xb')]&&_0x423431['activedirectory']['url']&&_0x423431[_0x3d88('0x9')][_0x3d88('0xc')];}return _0x171324;}function adAuthenticate(_0x255cb5,_0x406f19,_0x437f9b){return new BPromise(function(_0xb8c821,_0x528123){try{var _0x106c14=new ActiveDirectory(_0x255cb5);_0x106c14[_0x3d88('0xd')](_0x406f19,_0x437f9b,function(_0x3aea69,_0x4a4f23){if(_0x3aea69){logger['error'](_0x3d88('0xe'),_0x406f19,util[_0x3d88('0xf')](_0x3aea69,{'showHidden':![],'depth':null}));_0x528123(_0x3d88('0x10'));}else if(!_0x4a4f23){logger[_0x3d88('0x11')](_0x3d88('0x12'),_0x406f19);_0x528123(_0x3d88('0x10'));}else{_0xb8c821(_0x4a4f23);}});}catch(_0x5f1ea5){_0x528123(_0x5f1ea5);}});}function ActiveDirectoryAuthenticate(_0x100158,_0x3e6206,_0x5648c2,_0x5b9394){var _0x2c7cf9,_0x4ebad9;if(!isActiveDirectoryConfigured(config)){logger[_0x3d88('0x11')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x3e6206);return _0x5b9394(null,![],{'message':_0x3d88('0x10')});}return db[_0x3d88('0x13')][_0x3d88('0x14')]({'where':{'id':0x1},'attributes':['adSsoEnabled','blockDuration'],'raw':!![]})[_0x3d88('0x15')](function(_0x44ff46){_0x2c7cf9=_0x44ff46;if(!_0x2c7cf9[_0x3d88('0x16')]){logger['error'](_0x3d88('0x17'),_0x3e6206);throw new Error(_0x3d88('0x10'));}return _0x100158['findOne']({'attributes':['id',_0x3d88('0x18'),_0x3d88('0x19'),'salt',_0x3d88('0x1a'),_0x3d88('0x1b'),_0x3d88('0x1c'),_0x3d88('0x1d'),_0x3d88('0x1e')],'where':{'name':_0x3e6206,'role':{'$or':[_0x3d88('0x1f'),_0x3d88('0x20'),_0x3d88('0x21')]},'adSsoEnabled':!![]}});})[_0x3d88('0x15')](function(_0x1afd0a){if(!_0x1afd0a||_0x1afd0a&&_0x1afd0a[_0x3d88('0x18')]!==_0x3e6206){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x4ebad9=_0x1afd0a;var _0x2d2eb9=_0x4ebad9['name']+'@'+config['activedirectory']['domain'];return adAuthenticate(config[_0x3d88('0x9')],_0x2d2eb9,_0x5648c2);})[_0x3d88('0x15')](function(_0x17f1ae){if(_0x4ebad9['disabled']){throw new Error(_0x3d88('0x10'));}if(_0x2c7cf9[_0x3d88('0x22')]>0x0){if(_0x4ebad9['blocked']){if(moment(_0x4ebad9[_0x3d88('0x1d')])[_0x3d88('0x23')](_0x2c7cf9[_0x3d88('0x22')],_0x3d88('0x24'))>moment()){throw new Error(_0x3d88('0x10'));}return utils[_0x3d88('0x25')](_0x4ebad9,0x0,![],null)[_0x3d88('0x15')](function(){return utils[_0x3d88('0x26')](_0x4ebad9);})[_0x3d88('0x15')](function(){return _0x5b9394(null,_0x4ebad9);});}else{return utils[_0x3d88('0x26')](_0x4ebad9)[_0x3d88('0x15')](function(){return _0x5b9394(null,_0x4ebad9);});}}else{return utils[_0x3d88('0x26')](_0x4ebad9)[_0x3d88('0x15')](function(){return _0x5b9394(null,_0x4ebad9);});}})['catch'](function(_0x514a9f){return _0x5b9394(null,![],_0x514a9f);});}function handleError(_0x4c0083,_0x2ad7f5,_0x5a33da){return _0x4c0083[_0x3d88('0x27')](_0x2ad7f5||0x1f4)[_0x3d88('0x28')]({'message':_0x5a33da?_0x5a33da[_0x3d88('0x29')]||_0x5a33da:''});}exports[_0x3d88('0x2a')]=function(_0x1ce6c4,_0x5431f7,_0x3a961a){passport[_0x3d88('0xd')]('ad-login',function(_0x551397,_0x54499e,_0x55ebc9){var _0x57a978=_0x551397||_0x55ebc9;if(_0x57a978){return handleError(_0x5431f7,0x191,_0x57a978);}if(!_0x54499e){return handleError(_0x5431f7,0x194,{'message':_0x3d88('0x2b')});}else{var _0x496aef={'payload':{'id':_0x54499e['id'],'role':_0x54499e[_0x3d88('0x1a')]},'options':{'expiresIn':0x15180}};return authService[_0x3d88('0x2c')](_0x496aef)[_0x3d88('0x15')](function(_0x496609){_0x5431f7[_0x3d88('0x2d')]({'id':_0x54499e['id'],'token':_0x496609,'statusCall':'','isAlreadyLogged':_0x54499e['online']});});}})(_0x1ce6c4,_0x5431f7,_0x3a961a);};passport[_0x3d88('0x2e')](_0x3d88('0x2f'),new LocalStrategy({'usernameField':_0x3d88('0x18'),'passwordField':_0x3d88('0x19')},function(_0x5b9bfc,_0x2626a5,_0x5a5631){return ActiveDirectoryAuthenticate(db['User'],_0x5b9bfc,_0x2626a5,_0x5a5631);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 2475a22..267b647 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xebf1=['post','login','Router','./authActiveDirectory.controller'];(function(_0x5d7d86,_0x23c32c){var _0x766743=function(_0x1ded8c){while(--_0x1ded8c){_0x5d7d86['push'](_0x5d7d86['shift']());}};_0x766743(++_0x23c32c);}(_0xebf1,0x19e));var _0x1ebf=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0xebf1[_0x209ec9];return _0x129b1b;};'use strict';var express=require('express');var router=express[_0x1ebf('0x0')]();var controller=require(_0x1ebf('0x1'));router[_0x1ebf('0x2')]('/',controller[_0x1ebf('0x3')]);module['exports']=router; \ No newline at end of file +var _0x21fd=['exports','Router','./authActiveDirectory.controller','post','login'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x21fd,0xc4));var _0xd21f=function(_0x2463c4,_0x3371c4){_0x2463c4=_0x2463c4-0x0;var _0x1b1ec8=_0x21fd[_0x2463c4];return _0x1b1ec8;};'use strict';var express=require('express');var router=express[_0xd21f('0x0')]();var controller=require(_0xd21f('0x1'));router[_0xd21f('0x2')]('/',controller[_0xd21f('0x3')]);module[_0xd21f('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 0ba8ac2..e4d5718 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x2877ee,_0x27763b){var _0x2f2f23=function(_0x28fd6b){while(--_0x28fd6b){_0x2877ee['push'](_0x2877ee['shift']());}};_0x2f2f23(++_0x27763b);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x2889ec,_0x1e3b6d){var _0x331101=function(_0x203e90){while(--_0x203e90){_0x2889ec['push'](_0x2889ec['shift']());}};_0x331101(++_0x1e3b6d);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 21c032a..a671504 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 _0x3ae4=['./authGoogle.controller','../../components/auth/service','get','login','/callback','isMiddleware','setTokenCookie','exports','passport','Router'];(function(_0x48d218,_0x38ae7b){var _0x5d86c7=function(_0x362ae9){while(--_0x362ae9){_0x48d218['push'](_0x48d218['shift']());}};_0x5d86c7(++_0x38ae7b);}(_0x3ae4,0x166));var _0x43ae=function(_0x3b4c39,_0x187edc){_0x3b4c39=_0x3b4c39-0x0;var _0x53bc1d=_0x3ae4[_0x3b4c39];return _0x53bc1d;};'use strict';var express=require('express');var passport=require(_0x43ae('0x0'));var router=express[_0x43ae('0x1')]();var controller=require(_0x43ae('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0x43ae('0x3'));router[_0x43ae('0x4')]('/',controller[_0x43ae('0x5')]);router[_0x43ae('0x4')](_0x43ae('0x6'),controller['callback'],authService[_0x43ae('0x7')],userController['login'],authService[_0x43ae('0x8')]);module[_0x43ae('0x9')]=router; \ No newline at end of file +var _0xa21d=['Router','./authGoogle.controller','../user/user.controller.js','get','login','/callback','isMiddleware','setTokenCookie','exports','express'];(function(_0x1e8860,_0x534c89){var _0x176d65=function(_0x15460c){while(--_0x15460c){_0x1e8860['push'](_0x1e8860['shift']());}};_0x176d65(++_0x534c89);}(_0xa21d,0x8b));var _0xda21=function(_0x2bbd8a,_0x261fbf){_0x2bbd8a=_0x2bbd8a-0x0;var _0x177a69=_0xa21d[_0x2bbd8a];return _0x177a69;};'use strict';var express=require(_0xda21('0x0'));var passport=require('passport');var router=express[_0xda21('0x1')]();var controller=require(_0xda21('0x2'));var userController=require(_0xda21('0x3'));var authService=require('../../components/auth/service');router[_0xda21('0x4')]('/',controller[_0xda21('0x5')]);router[_0xda21('0x4')](_0xda21('0x6'),controller['callback'],authService[_0xda21('0x7')],userController[_0xda21('0x5')],authService[_0xda21('0x8')]);module[_0xda21('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 2d4e4ae..ddaeec0 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 _0x7d42=['Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blockedAt','add','clearBlockUser','minutes','getLicense','catch','MailAccount','find','name','MailServerOut','Smtp','CloudProvider','getSmtpOptions','format','email','request','error','message','stringify','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','resetPasswordToken','save','use','local-login','util','passport','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','password','role','disabled','blocked','loginAttempts','admin','user','agent','authenticate'];(function(_0x4a6154,_0x5750de){var _0x4debdc=function(_0x1439fe){while(--_0x1439fe){_0x4a6154['push'](_0x4a6154['shift']());}};_0x4debdc(++_0x5750de);}(_0x7d42,0xdd));var _0x27d4=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x7d42[_0x4a9fb1];return _0x348672;};'use strict';var util=require(_0x27d4('0x0'));var passport=require(_0x27d4('0x1'));var LocalStrategy=require(_0x27d4('0x2'))['Strategy'];var jayson=require(_0x27d4('0x3'));var _=require(_0x27d4('0x4'));var rs=require(_0x27d4('0x5'));var moment=require(_0x27d4('0x6'));var db=require(_0x27d4('0x7'))['db'];var authService=require(_0x27d4('0x8'));var utils=require(_0x27d4('0x9'));var client=jayson[_0x27d4('0xa')][_0x27d4('0xb')]({'port':0x232b});function localAuthenticate(_0x4fbb11,_0x3d69b4,_0x21324c,_0x19d877){var _0xe1f9ad,_0x422d68;return db[_0x27d4('0xc')][_0x27d4('0xd')]({'where':{'id':0x1},'attributes':[_0x27d4('0xe'),'blockDuration'],'raw':!![]})[_0x27d4('0xf')](function(_0x17bc01){_0xe1f9ad=_0x17bc01;return _0x4fbb11[_0x27d4('0xd')]({'attributes':['id','name',_0x27d4('0x10'),'salt',_0x27d4('0x11'),_0x27d4('0x12'),_0x27d4('0x13'),'blockedAt',_0x27d4('0x14')],'where':{'name':_0x3d69b4,'role':{'$or':[_0x27d4('0x15'),_0x27d4('0x16'),_0x27d4('0x17')]}}});})[_0x27d4('0xf')](function(_0x422129){if(!_0x422129||_0x422129&&_0x422129['name']!==_0x3d69b4){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x422d68=_0x422129;return _0x422d68;}})[_0x27d4('0xf')](function(){_0x422d68[_0x27d4('0x18')](_0x21324c,function(_0x230776,_0x59b77a){var _0x2479e3=_0x422d68[_0x27d4('0x14')]+0x1;if(_0x230776){return _0x19d877(_0x230776);}else if(!_0x59b77a){if(_0x422d68[_0x27d4('0x12')]){return _0x19d877(null,![],{'message':_0x27d4('0x19')});}else if(_0xe1f9ad[_0x27d4('0xe')]>0x0){if(_0x422d68[_0x27d4('0x13')]){if(_0xe1f9ad[_0x27d4('0x1a')]>0x0){if(moment(_0x422d68[_0x27d4('0x1b')])[_0x27d4('0x1c')](_0xe1f9ad[_0x27d4('0x1a')],'minutes')>moment()){return _0x19d877(null,![],{'message':_0x27d4('0x19')});}else{return utils[_0x27d4('0x1d')](_0x422d68,_0x2479e3,![],null)[_0x27d4('0xf')](function(){return _0x19d877(null,![],{'message':_0x27d4('0x19')});});}}else{return _0x19d877(null,![],{'message':_0x27d4('0x19')});}}else{if(_0x2479e3>=_0xe1f9ad[_0x27d4('0xe')]){return utils[_0x27d4('0x1d')](_0x422d68,0x0,!![],moment())[_0x27d4('0xf')](function(){return _0x19d877(null,![],{'message':_0x27d4('0x19')});});}else{return utils[_0x27d4('0x1d')](_0x422d68,_0x2479e3,![],null)[_0x27d4('0xf')](function(){return _0x19d877(null,![],{'message':_0x27d4('0x19')});});}}}else{return _0x19d877(null,![],{'message':_0x27d4('0x19')});}}else{if(_0x422d68[_0x27d4('0x12')]){return _0x19d877(null,![],{'message':_0x27d4('0x19')});}else if(_0xe1f9ad[_0x27d4('0xe')]>0x0){if(_0x422d68[_0x27d4('0x13')]){if(_0xe1f9ad['blockDuration']>0x0){if(moment(_0x422d68['blockedAt'])[_0x27d4('0x1c')](_0xe1f9ad['blockDuration'],_0x27d4('0x1e'))>moment()){return _0x19d877(null,![],{'message':_0x27d4('0x19')});}else{return utils['clearBlockUser'](_0x422d68,0x0,![],null)[_0x27d4('0xf')](function(){return utils[_0x27d4('0x1f')](_0x422d68);})[_0x27d4('0xf')](function(){return _0x19d877(null,_0x422d68);});}}else{return _0x19d877(null,![],{'message':_0x27d4('0x19')});}}else{return utils['clearBlockUser'](_0x422d68,0x0,![],null)[_0x27d4('0xf')](function(){return utils[_0x27d4('0x1f')](_0x422d68);})[_0x27d4('0xf')](function(){return _0x19d877(null,_0x422d68);})[_0x27d4('0x20')](function(_0x3a5cf5){return _0x19d877(null,![],_0x3a5cf5);});}}else{if(_0x422d68[_0x27d4('0x13')]){return _0x19d877(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x27d4('0x1f')](_0x422d68)[_0x27d4('0xf')](function(){return _0x19d877(null,_0x422d68);});}}}});})['catch'](function(_0x386352){return _0x19d877(null,![],_0x386352);});}function sendServiceMail(_0x14e341){return db[_0x27d4('0x21')][_0x27d4('0x22')]({'where':{'service':!![]},'attributes':['id',_0x27d4('0x23'),'email'],'include':[{'model':db[_0x27d4('0x24')],'as':_0x27d4('0x25'),'include':[{'model':db[_0x27d4('0x26')],'as':_0x27d4('0x26')}]}]})['then'](function(_0x5110be){if(!_0x5110be){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x3809d4=_0x5110be[_0x27d4('0x27')]();var _0x3ba2e9={'account':_0x3809d4,'message':_['merge']({'from':util[_0x27d4('0x28')]('\x22%s\x22\x20<%s>',_0x5110be[_0x27d4('0x23')],_0x5110be[_0x27d4('0x29')]||_0x5110be[_0x27d4('0x25')]['user'])},_0x14e341)};return client[_0x27d4('0x2a')]('SendMail',_0x3ba2e9);})[_0x27d4('0xf')](function(_0x4703b5){if(_0x4703b5['error']){throw new Error(util[_0x27d4('0x28')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x4703b5[_0x27d4('0x2b')][_0x27d4('0x2c')]||JSON[_0x27d4('0x2d')](_0x4703b5[_0x27d4('0x2b')])));}return!![];});}function handleError(_0x38220a,_0x19c17e,_0x173887){return _0x38220a[_0x27d4('0x2e')](_0x19c17e||0x1f4)[_0x27d4('0x2f')]({'message':_0x173887?_0x173887[_0x27d4('0x2c')]||_0x173887:''});}exports[_0x27d4('0x30')]=function(_0x266210,_0x10283f,_0x5313c1){passport[_0x27d4('0x18')]('local-login',function(_0x5a4dab,_0x3bb6bb,_0x40cd3a){var _0x2d7f94=_0x5a4dab||_0x40cd3a;if(_0x2d7f94){return handleError(_0x10283f,0x191,_0x2d7f94);}if(!_0x3bb6bb){return handleError(_0x10283f,0x194,{'message':_0x27d4('0x31')});}else{var _0x4137b0={'payload':{'id':_0x3bb6bb['id'],'role':_0x3bb6bb['role']},'options':{'expiresIn':0x15180}};return authService[_0x27d4('0x32')](_0x4137b0)[_0x27d4('0xf')](function(_0x27a3cb){_0x10283f['json']({'id':_0x3bb6bb['id'],'token':_0x27a3cb,'statusCall':'','isAlreadyLogged':_0x3bb6bb[_0x27d4('0x33')]});});}})(_0x266210,_0x10283f,_0x5313c1);};exports[_0x27d4('0x34')]=function(_0x318b8d,_0x4b4a4e){if(!_0x318b8d[_0x27d4('0x35')]['email']){return handleError(_0x4b4a4e,0x1f4,{'message':_0x27d4('0x36')});}var _0x223d04=rs[_0x27d4('0x37')]();_0x318b8d['body'][_0x27d4('0x29')]=_0x318b8d[_0x27d4('0x35')][_0x27d4('0x29')]['trim']()[_0x27d4('0x38')]();var _0x491f9e;return db[_0x27d4('0xc')][_0x27d4('0xd')]({'where':{'id':0x1},'attributes':[_0x27d4('0xe'),_0x27d4('0x1a')],'raw':!![]})[_0x27d4('0xf')](function(_0x1e2603){_0x491f9e=_0x1e2603;return db[_0x27d4('0x39')][_0x27d4('0x22')]({'where':{'email':_0x318b8d['body'][_0x27d4('0x29')]}});})[_0x27d4('0xf')](function(_0x5ea695){if(!_0x5ea695){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x5ea695['disabled']){throw new Error(_0x27d4('0x3a'));}if(_0x5ea695[_0x27d4('0x13')]){if(moment(_0x5ea695[_0x27d4('0x1b')])[_0x27d4('0x1c')](_0x491f9e[_0x27d4('0x1a')],_0x27d4('0x1e'))>moment()){throw new Error(_0x27d4('0x3b'));}else{_0x5ea695[_0x27d4('0x13')]=![];_0x5ea695['blockedAt']=null;}}_0x5ea695['resetPasswordToken']=_0x223d04;_0x5ea695[_0x27d4('0x3c')]=Date[_0x27d4('0x3d')]()+0x36ee80;return _0x5ea695['save']();})['then'](function(){return sendServiceMail({'to':_0x318b8d[_0x27d4('0x35')][_0x27d4('0x29')],'subject':_0x27d4('0x3e'),'text':_0x27d4('0x3f')+_0x27d4('0x40')+_0x27d4('0x41')+_0x318b8d[_0x27d4('0x42')][_0x27d4('0x43')]+_0x27d4('0x44')+_0x223d04+'\x0a\x0a'+_0x27d4('0x45')});})['then'](function(){_0x4b4a4e[_0x27d4('0x2e')](0xc8)[_0x27d4('0x2f')]({'message':_0x27d4('0x46')});})[_0x27d4('0x20')](function(_0xbcc690){return handleError(_0x4b4a4e,0x1f4,_0xbcc690);});};exports['reset']=function(_0x15d7bd,_0x24037f){return db['User']['find']({'where':{'resetPasswordToken':_0x15d7bd['params'][_0x27d4('0x47')],'resetPasswordExpires':{'$gt':Date[_0x27d4('0x3d')]()}}})[_0x27d4('0xf')](function(_0x48e08b){if(!_0x48e08b){throw new Error(_0x27d4('0x48'));}return db['Setting'][_0x27d4('0xd')]({'attributes':['id',_0x27d4('0x49'),_0x27d4('0x4a'),_0x27d4('0x4b')]})['then'](function(_0x24b3a8){if(_0x24b3a8['securePassword'])authService[_0x27d4('0x4c')](_0x15d7bd['body'][_0x27d4('0x10')]);if(!_0x24b3a8['enforcePasswordHistory']||!_0x48e08b[_0x27d4('0x4d')])return _0x48e08b;authService['validatePasswordHistory'](_0x15d7bd['body'][_0x27d4('0x10')],_0x48e08b[_0x27d4('0x4d')],_0x24b3a8[_0x27d4('0x4b')]);return _0x48e08b;})[_0x27d4('0xf')](function(){_0x48e08b[_0x27d4('0x10')]=_0x15d7bd[_0x27d4('0x35')][_0x27d4('0x10')];_0x48e08b[_0x27d4('0x4e')]=null;_0x48e08b[_0x27d4('0x3c')]=null;return _0x48e08b[_0x27d4('0x4f')]();});})[_0x27d4('0xf')](function(){_0x24037f[_0x27d4('0x2e')](0xc8)[_0x27d4('0x2f')]({'message':'Password\x20reset!'});})[_0x27d4('0x20')](function(_0x51258b){return handleError(_0x24037f,0x1f4,_0x51258b);});};passport[_0x27d4('0x50')](_0x27d4('0x51'),new LocalStrategy({'usernameField':'name','passwordField':_0x27d4('0x10')},function(_0x2b9d30,_0x7ae1c3,_0x44f46e){return localAuthenticate(db[_0x27d4('0x39')],_0x2b9d30,_0x7ae1c3,_0x44f46e);})); \ No newline at end of file +var _0x7532=['findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockedAt','add','minutes','clearBlockUser','catch','getLicense','MailAccount','find','Smtp','CloudProvider','getSmtpOptions','format','\x22%s\x22\x20<%s>','SendMail','error','stringify','status','send','login','local-login','signToken','online','forgot','email','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','Reset\x20Email\x20sent!','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','validatePasswordHistory','previousPasswords','resetPasswordExpires','Password\x20reset!','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../config/utils','http','Setting'];(function(_0x1c3020,_0x583634){var _0x404f3d=function(_0x5a0b54){while(--_0x5a0b54){_0x1c3020['push'](_0x1c3020['shift']());}};_0x404f3d(++_0x583634);}(_0x7532,0x130));var _0x2753=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x7532[_0x21aec3];return _0x288bbc;};'use strict';var util=require(_0x2753('0x0'));var passport=require(_0x2753('0x1'));var LocalStrategy=require(_0x2753('0x2'))[_0x2753('0x3')];var jayson=require(_0x2753('0x4'));var _=require(_0x2753('0x5'));var rs=require(_0x2753('0x6'));var moment=require(_0x2753('0x7'));var db=require(_0x2753('0x8'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x2753('0x9'));var client=jayson['client'][_0x2753('0xa')]({'port':0x232b});function localAuthenticate(_0x3c5dbf,_0x4b2550,_0x3f87ba,_0x5857aa){var _0x1ba307,_0x185ff5;return db[_0x2753('0xb')][_0x2753('0xc')]({'where':{'id':0x1},'attributes':[_0x2753('0xd'),_0x2753('0xe')],'raw':!![]})[_0x2753('0xf')](function(_0x3e95dd){_0x1ba307=_0x3e95dd;return _0x3c5dbf[_0x2753('0xc')]({'attributes':['id',_0x2753('0x10'),_0x2753('0x11'),_0x2753('0x12'),_0x2753('0x13'),_0x2753('0x14'),_0x2753('0x15'),'blockedAt',_0x2753('0x16')],'where':{'name':_0x4b2550,'role':{'$or':['admin',_0x2753('0x17'),_0x2753('0x18')]}}});})[_0x2753('0xf')](function(_0x1c15db){if(!_0x1c15db||_0x1c15db&&_0x1c15db[_0x2753('0x10')]!==_0x4b2550){throw new Error(_0x2753('0x19'));}else{_0x185ff5=_0x1c15db;return _0x185ff5;}})['then'](function(){_0x185ff5[_0x2753('0x1a')](_0x3f87ba,function(_0x59f7f8,_0x49c840){var _0x58cc69=_0x185ff5[_0x2753('0x16')]+0x1;if(_0x59f7f8){return _0x5857aa(_0x59f7f8);}else if(!_0x49c840){if(_0x185ff5['disabled']){return _0x5857aa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x1ba307[_0x2753('0xd')]>0x0){if(_0x185ff5['blocked']){if(_0x1ba307[_0x2753('0xe')]>0x0){if(moment(_0x185ff5[_0x2753('0x1b')])[_0x2753('0x1c')](_0x1ba307[_0x2753('0xe')],_0x2753('0x1d'))>moment()){return _0x5857aa(null,![],{'message':_0x2753('0x19')});}else{return utils[_0x2753('0x1e')](_0x185ff5,_0x58cc69,![],null)[_0x2753('0xf')](function(){return _0x5857aa(null,![],{'message':_0x2753('0x19')});});}}else{return _0x5857aa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x58cc69>=_0x1ba307[_0x2753('0xd')]){return utils[_0x2753('0x1e')](_0x185ff5,0x0,!![],moment())[_0x2753('0xf')](function(){return _0x5857aa(null,![],{'message':_0x2753('0x19')});});}else{return utils['clearBlockUser'](_0x185ff5,_0x58cc69,![],null)[_0x2753('0xf')](function(){return _0x5857aa(null,![],{'message':_0x2753('0x19')});});}}}else{return _0x5857aa(null,![],{'message':_0x2753('0x19')});}}else{if(_0x185ff5[_0x2753('0x14')]){return _0x5857aa(null,![],{'message':_0x2753('0x19')});}else if(_0x1ba307[_0x2753('0xd')]>0x0){if(_0x185ff5[_0x2753('0x15')]){if(_0x1ba307[_0x2753('0xe')]>0x0){if(moment(_0x185ff5[_0x2753('0x1b')])[_0x2753('0x1c')](_0x1ba307['blockDuration'],_0x2753('0x1d'))>moment()){return _0x5857aa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x2753('0x1e')](_0x185ff5,0x0,![],null)[_0x2753('0xf')](function(){return utils['getLicense'](_0x185ff5);})[_0x2753('0xf')](function(){return _0x5857aa(null,_0x185ff5);});}}else{return _0x5857aa(null,![],{'message':_0x2753('0x19')});}}else{return utils[_0x2753('0x1e')](_0x185ff5,0x0,![],null)['then'](function(){return utils['getLicense'](_0x185ff5);})['then'](function(){return _0x5857aa(null,_0x185ff5);})[_0x2753('0x1f')](function(_0x330ce9){return _0x5857aa(null,![],_0x330ce9);});}}else{if(_0x185ff5['blocked']){return _0x5857aa(null,![],{'message':_0x2753('0x19')});}else{return utils[_0x2753('0x20')](_0x185ff5)[_0x2753('0xf')](function(){return _0x5857aa(null,_0x185ff5);});}}}});})[_0x2753('0x1f')](function(_0x470452){return _0x5857aa(null,![],_0x470452);});}function sendServiceMail(_0x467032){return db[_0x2753('0x21')][_0x2753('0x22')]({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db['MailServerOut'],'as':_0x2753('0x23'),'include':[{'model':db[_0x2753('0x24')],'as':'CloudProvider'}]}]})[_0x2753('0xf')](function(_0x43600a){if(!_0x43600a){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x1b1a2a=_0x43600a[_0x2753('0x25')]();var _0x456271={'account':_0x1b1a2a,'message':_['merge']({'from':util[_0x2753('0x26')](_0x2753('0x27'),_0x43600a[_0x2753('0x10')],_0x43600a['email']||_0x43600a[_0x2753('0x23')][_0x2753('0x17')])},_0x467032)};return client['request'](_0x2753('0x28'),_0x456271);})[_0x2753('0xf')](function(_0x1b2098){if(_0x1b2098[_0x2753('0x29')]){throw new Error(util[_0x2753('0x26')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x1b2098[_0x2753('0x29')]['message']||JSON[_0x2753('0x2a')](_0x1b2098[_0x2753('0x29')])));}return!![];});}function handleError(_0x191e09,_0xf7ca91,_0x3ab38b){return _0x191e09[_0x2753('0x2b')](_0xf7ca91||0x1f4)[_0x2753('0x2c')]({'message':_0x3ab38b?_0x3ab38b['message']||_0x3ab38b:''});}exports[_0x2753('0x2d')]=function(_0x491bf9,_0x40a9b0,_0x49a0e8){passport[_0x2753('0x1a')](_0x2753('0x2e'),function(_0x2b9571,_0x1d5865,_0x276d70){var _0x14493c=_0x2b9571||_0x276d70;if(_0x14493c){return handleError(_0x40a9b0,0x191,_0x14493c);}if(!_0x1d5865){return handleError(_0x40a9b0,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x2ec72b={'payload':{'id':_0x1d5865['id'],'role':_0x1d5865['role']},'options':{'expiresIn':0x15180}};return authService[_0x2753('0x2f')](_0x2ec72b)[_0x2753('0xf')](function(_0x3cea4e){_0x40a9b0['json']({'id':_0x1d5865['id'],'token':_0x3cea4e,'statusCall':'','isAlreadyLogged':_0x1d5865[_0x2753('0x30')]});});}})(_0x491bf9,_0x40a9b0,_0x49a0e8);};exports[_0x2753('0x31')]=function(_0x51f25e,_0x1669f3){if(!_0x51f25e['body'][_0x2753('0x32')]){return handleError(_0x1669f3,0x1f4,{'message':_0x2753('0x33')});}var _0x54e504=rs[_0x2753('0x34')]();_0x51f25e[_0x2753('0x35')][_0x2753('0x32')]=_0x51f25e[_0x2753('0x35')][_0x2753('0x32')][_0x2753('0x36')]()[_0x2753('0x37')]();var _0x19a480;return db[_0x2753('0xb')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x2753('0xe')],'raw':!![]})['then'](function(_0xb5700e){_0x19a480=_0xb5700e;return db[_0x2753('0x38')]['find']({'where':{'email':_0x51f25e['body'][_0x2753('0x32')]}});})[_0x2753('0xf')](function(_0x2c1718){if(!_0x2c1718){throw new Error(_0x2753('0x39'));}if(_0x2c1718[_0x2753('0x14')]){throw new Error(_0x2753('0x3a'));}if(_0x2c1718[_0x2753('0x15')]){if(moment(_0x2c1718[_0x2753('0x1b')])[_0x2753('0x1c')](_0x19a480['blockDuration'],_0x2753('0x1d'))>moment()){throw new Error(_0x2753('0x3b'));}else{_0x2c1718[_0x2753('0x15')]=![];_0x2c1718[_0x2753('0x1b')]=null;}}_0x2c1718[_0x2753('0x3c')]=_0x54e504;_0x2c1718['resetPasswordExpires']=Date[_0x2753('0x3d')]()+0x36ee80;return _0x2c1718['save']();})[_0x2753('0xf')](function(){return sendServiceMail({'to':_0x51f25e[_0x2753('0x35')][_0x2753('0x32')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x2753('0x3e')+_0x2753('0x3f')+_0x2753('0x40')+_0x51f25e[_0x2753('0x41')][_0x2753('0x42')]+_0x2753('0x43')+_0x54e504+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x2753('0xf')](function(){_0x1669f3[_0x2753('0x2b')](0xc8)[_0x2753('0x2c')]({'message':_0x2753('0x44')});})[_0x2753('0x1f')](function(_0x163c7f){return handleError(_0x1669f3,0x1f4,_0x163c7f);});};exports[_0x2753('0x45')]=function(_0x1fb7a1,_0x1e84b1){return db[_0x2753('0x38')][_0x2753('0x22')]({'where':{'resetPasswordToken':_0x1fb7a1['params'][_0x2753('0x46')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x2753('0xf')](function(_0x256c94){if(!_0x256c94){throw new Error(_0x2753('0x47'));}return db['Setting'][_0x2753('0xc')]({'attributes':['id',_0x2753('0x48'),_0x2753('0x49'),'passwordHistoryLimit']})['then'](function(_0x35a5f6){if(_0x35a5f6[_0x2753('0x48')])authService[_0x2753('0x4a')](_0x1fb7a1[_0x2753('0x35')][_0x2753('0x11')]);if(!_0x35a5f6['enforcePasswordHistory']||!_0x256c94['previousPasswords'])return _0x256c94;authService[_0x2753('0x4b')](_0x1fb7a1[_0x2753('0x35')][_0x2753('0x11')],_0x256c94[_0x2753('0x4c')],_0x35a5f6['passwordHistoryLimit']);return _0x256c94;})['then'](function(){_0x256c94[_0x2753('0x11')]=_0x1fb7a1[_0x2753('0x35')]['password'];_0x256c94[_0x2753('0x3c')]=null;_0x256c94[_0x2753('0x4d')]=null;return _0x256c94['save']();});})['then'](function(){_0x1e84b1[_0x2753('0x2b')](0xc8)[_0x2753('0x2c')]({'message':_0x2753('0x4e')});})[_0x2753('0x1f')](function(_0x2cc301){return handleError(_0x1e84b1,0x1f4,_0x2cc301);});};passport['use'](_0x2753('0x2e'),new LocalStrategy({'usernameField':'name','passwordField':_0x2753('0x11')},function(_0x4924e1,_0x1abde9,_0x270300){return localAuthenticate(db[_0x2753('0x38')],_0x4924e1,_0x1abde9,_0x270300);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 1a73875..8d906af 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 _0x2f0a=['exports','./authLocal.controller','login','post','forgot','reset'];(function(_0x4e1cb6,_0x5336e5){var _0x3749e5=function(_0x425fd2){while(--_0x425fd2){_0x4e1cb6['push'](_0x4e1cb6['shift']());}};_0x3749e5(++_0x5336e5);}(_0x2f0a,0xc7));var _0xa2f0=function(_0x41286a,_0x13943a){_0x41286a=_0x41286a-0x0;var _0x316c39=_0x2f0a[_0x41286a];return _0x316c39;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0xa2f0('0x0'));router['post']('/',controller[_0xa2f0('0x1')]);router[_0xa2f0('0x2')]('/forgot',controller[_0xa2f0('0x3')]);router[_0xa2f0('0x2')]('/reset/:token',controller[_0xa2f0('0x4')]);module[_0xa2f0('0x5')]=router; \ No newline at end of file +var _0x8812=['/reset/:token','reset','exports','express','Router','./authLocal.controller','login','post','/forgot','forgot'];(function(_0x14f458,_0x5dd219){var _0x4ff2da=function(_0x473b86){while(--_0x473b86){_0x14f458['push'](_0x14f458['shift']());}};_0x4ff2da(++_0x5dd219);}(_0x8812,0x143));var _0x2881=function(_0x379d1f,_0x31575d){_0x379d1f=_0x379d1f-0x0;var _0x2a52a2=_0x8812[_0x379d1f];return _0x2a52a2;};'use strict';var express=require(_0x2881('0x0'));var router=express[_0x2881('0x1')]();var controller=require(_0x2881('0x2'));router['post']('/',controller[_0x2881('0x3')]);router[_0x2881('0x4')](_0x2881('0x5'),controller[_0x2881('0x6')]);router[_0x2881('0x4')](_0x2881('0x7'),controller[_0x2881('0x8')]);module[_0x2881('0x9')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 16fb887..72c566b 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 _0x2539=['sequelize','exports','STRING','BOOLEAN'];(function(_0x2d9c1c,_0x3c4b75){var _0x30e6d0=function(_0x325c6b){while(--_0x325c6b){_0x2d9c1c['push'](_0x2d9c1c['shift']());}};_0x30e6d0(++_0x3c4b75);}(_0x2539,0xc4));var _0x9253=function(_0x56c91a,_0x21a76f){_0x56c91a=_0x56c91a-0x0;var _0x536659=_0x2539[_0x56c91a];return _0x536659;};'use strict';var Sequelize=require(_0x9253('0x0'));module[_0x9253('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x9253('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x9253('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x0456=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x51821c,_0x2e39c5){var _0x20bde8=function(_0x2d307a){while(--_0x2d307a){_0x51821c['push'](_0x51821c['shift']());}};_0x20bde8(++_0x2e39c5);}(_0x0456,0x1d5));var _0x6045=function(_0x44cc8f,_0x772a83){_0x44cc8f=_0x44cc8f-0x0;var _0x424569=_0x0456[_0x44cc8f];return _0x424569;};'use strict';var Sequelize=require(_0x6045('0x0'));module[_0x6045('0x1')]={'name':{'type':Sequelize[_0x6045('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x6045('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x6045('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x6045('0x4')],'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 9ed88b0..259589a 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 _0x5470=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','set','apply','update','then','destroy','error','stack','name','index','map','Automation','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','ids','omit','getConditions','findOne','Condition','order','nolimit','Action','addActions','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x292bab,_0x18b725){var _0x3a1de1=function(_0x8d52cf){while(--_0x8d52cf){_0x292bab['push'](_0x292bab['shift']());}};_0x3a1de1(++_0x18b725);}(_0x5470,0x14a));var _0x0547=function(_0x20f1ef,_0x4ade18){_0x20f1ef=_0x20f1ef-0x0;var _0x5a0c1c=_0x5470[_0x20f1ef];return _0x5a0c1c;};'use strict';var emlformat=require(_0x0547('0x0'));var rimraf=require(_0x0547('0x1'));var zipdir=require(_0x0547('0x2'));var jsonpatch=require(_0x0547('0x3'));var rp=require(_0x0547('0x4'));var moment=require('moment');var BPromise=require(_0x0547('0x5'));var Mustache=require(_0x0547('0x6'));var util=require(_0x0547('0x7'));var path=require(_0x0547('0x8'));var sox=require(_0x0547('0x9'));var csv=require(_0x0547('0xa'));var ejs=require(_0x0547('0xb'));var fs=require('fs');var fs_extra=require(_0x0547('0xc'));var _=require(_0x0547('0xd'));var squel=require(_0x0547('0xe'));var crypto=require(_0x0547('0xf'));var jsforce=require(_0x0547('0x10'));var deskjs=require(_0x0547('0x11'));var toCsv=require(_0x0547('0xa'));var querystring=require('querystring');var Papa=require(_0x0547('0x12'));var Redis=require(_0x0547('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x0547('0x14'));var as=require(_0x0547('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0547('0x16'))(_0x0547('0x17'));var utils=require('../../config/utils');var config=require(_0x0547('0x18'));var licenseUtil=require(_0x0547('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ee926,_0x4d76c6){_0x4d76c6=_0x4d76c6||0xcc;return function(_0x364c45){if(_0x364c45){return _0x1ee926[_0x0547('0x1a')](_0x4d76c6);}return _0x1ee926['status'](_0x4d76c6)[_0x0547('0x1b')]();};}function respondWithResult(_0x2193f4,_0x146c5c){_0x146c5c=_0x146c5c||0xc8;return function(_0x45a818){if(_0x45a818){return _0x2193f4[_0x0547('0x1c')](_0x146c5c)[_0x0547('0x1d')](_0x45a818);}};}function respondWithFilteredResult(_0x3c7d46,_0x2a779c){return function(_0x2114e5){if(_0x2114e5){var _0x5ddf78=typeof _0x2a779c[_0x0547('0x1e')]===_0x0547('0x1f')&&typeof _0x2a779c['limit']===_0x0547('0x1f');var _0x46eb84=_0x2114e5[_0x0547('0x20')];var _0xb7c5fb=_0x5ddf78?0x0:_0x2a779c['offset'];var _0x2b8094=_0x5ddf78?_0x2114e5['count']:_0x2a779c['offset']+_0x2a779c['limit'];var _0x574daf;if(_0x2b8094>=_0x46eb84){_0x2b8094=_0x46eb84;_0x574daf=0xc8;}else{_0x574daf=0xce;}_0x3c7d46[_0x0547('0x1c')](_0x574daf);return _0x3c7d46[_0x0547('0x21')]('Content-Range',_0xb7c5fb+'-'+_0x2b8094+'/'+_0x46eb84)['json'](_0x2114e5);}return null;};}function patchUpdates(_0x176411){return function(_0x5c6e92){try{jsonpatch[_0x0547('0x22')](_0x5c6e92,_0x176411,!![]);}catch(_0x5927dc){return BPromise['reject'](_0x5927dc);}return _0x5c6e92['save']();};}function saveUpdates(_0x3dbb1d,_0x4e2014){return function(_0xd872be){if(_0xd872be){return _0xd872be[_0x0547('0x23')](_0x3dbb1d)[_0x0547('0x24')](function(_0x1acd97){return _0x1acd97;});}return null;};}function removeEntity(_0x1369af,_0xce46b6){return function(_0x2f4359){if(_0x2f4359){return _0x2f4359[_0x0547('0x25')]()['then'](function(){_0x1369af[_0x0547('0x1c')](0xcc)[_0x0547('0x1b')]();});}};}function handleEntityNotFound(_0x66734e,_0x5d77f2){return function(_0x380672){if(!_0x380672){_0x66734e[_0x0547('0x1a')](0x194);}return _0x380672;};}function handleError(_0x1dbc45,_0x3e1d88){_0x3e1d88=_0x3e1d88||0x1f4;return function(_0x29a6ac){logger[_0x0547('0x26')](_0x29a6ac[_0x0547('0x27')]);if(_0x29a6ac[_0x0547('0x28')]){delete _0x29a6ac[_0x0547('0x28')];}_0x1dbc45[_0x0547('0x1c')](_0x3e1d88)['send'](_0x29a6ac);};}exports[_0x0547('0x29')]=function(_0x377d80,_0x3759b0){var _0x1efb15={},_0x48d6b7={},_0x3672b4={'count':0x0,'rows':[]};var _0x36c870=_[_0x0547('0x2a')](db[_0x0547('0x2b')][_0x0547('0x2c')],function(_0x575d39){return{'name':_0x575d39[_0x0547('0x2d')],'type':_0x575d39['type'][_0x0547('0x2e')]};});_0x48d6b7[_0x0547('0x2f')]=_[_0x0547('0x2a')](_0x36c870,_0x0547('0x28'));_0x48d6b7[_0x0547('0x30')]=_['keys'](_0x377d80['query']);_0x48d6b7[_0x0547('0x31')]=_[_0x0547('0x32')](_0x48d6b7[_0x0547('0x2f')],_0x48d6b7['query']);_0x1efb15[_0x0547('0x33')]=_[_0x0547('0x32')](_0x48d6b7['model'],qs['fields'](_0x377d80[_0x0547('0x30')][_0x0547('0x34')]));_0x1efb15[_0x0547('0x33')]=_0x1efb15['attributes']['length']?_0x1efb15['attributes']:_0x48d6b7[_0x0547('0x2f')];if(!_0x377d80['query'][_0x0547('0x35')]('nolimit')){_0x1efb15['limit']=qs[_0x0547('0x36')](_0x377d80[_0x0547('0x30')]['limit']);_0x1efb15['offset']=qs[_0x0547('0x1e')](_0x377d80[_0x0547('0x30')][_0x0547('0x1e')]);}_0x1efb15['order']=qs['sort'](_0x377d80['query'][_0x0547('0x37')]);_0x1efb15[_0x0547('0x38')]=qs[_0x0547('0x31')](_[_0x0547('0x39')](_0x377d80['query'],_0x48d6b7[_0x0547('0x31')]),_0x36c870);if(_0x377d80[_0x0547('0x30')][_0x0547('0x3a')]){_0x1efb15['where']=_['merge'](_0x1efb15[_0x0547('0x38')],{'$or':_['map'](_0x36c870,function(_0x3c3d2f){if(_0x3c3d2f[_0x0547('0x3b')]!==_0x0547('0x3c')){var _0x33a599={};_0x33a599[_0x3c3d2f[_0x0547('0x28')]]={'$like':'%'+_0x377d80[_0x0547('0x30')][_0x0547('0x3a')]+'%'};return _0x33a599;}})});}_0x1efb15=_[_0x0547('0x3d')]({},_0x1efb15,_0x377d80[_0x0547('0x3e')]);var _0x2ea218={'where':_0x1efb15[_0x0547('0x38')]};return db[_0x0547('0x2b')]['count'](_0x2ea218)[_0x0547('0x24')](function(_0x5c9819){_0x3672b4[_0x0547('0x20')]=_0x5c9819;if(_0x377d80['query'][_0x0547('0x3f')]){_0x1efb15[_0x0547('0x40')]=[{'all':!![]}];}return db[_0x0547('0x2b')][_0x0547('0x41')](_0x1efb15);})[_0x0547('0x24')](function(_0x4dd4cc){_0x3672b4[_0x0547('0x42')]=_0x4dd4cc;return _0x3672b4;})['then'](respondWithFilteredResult(_0x3759b0,_0x1efb15))[_0x0547('0x43')](handleError(_0x3759b0,null));};exports[_0x0547('0x44')]=function(_0x4c5f71,_0x271471){var _0x3801bb={'raw':![],'where':{'id':_0x4c5f71[_0x0547('0x45')]['id']}},_0x56a4b9={};_0x56a4b9[_0x0547('0x2f')]=_[_0x0547('0x46')](db[_0x0547('0x2b')]['rawAttributes']);_0x56a4b9[_0x0547('0x30')]=_['keys'](_0x4c5f71['query']);_0x56a4b9[_0x0547('0x31')]=_['intersection'](_0x56a4b9[_0x0547('0x2f')],_0x56a4b9[_0x0547('0x30')]);_0x3801bb[_0x0547('0x33')]=_['intersection'](_0x56a4b9[_0x0547('0x2f')],qs[_0x0547('0x34')](_0x4c5f71['query']['fields']));_0x3801bb[_0x0547('0x33')]=_0x3801bb[_0x0547('0x33')][_0x0547('0x47')]?_0x3801bb[_0x0547('0x33')]:_0x56a4b9[_0x0547('0x2f')];if(_0x4c5f71[_0x0547('0x30')]['includeAll']){_0x3801bb[_0x0547('0x40')]=[{'all':!![]}];}_0x3801bb=_['merge']({},_0x3801bb,_0x4c5f71[_0x0547('0x3e')]);return db['Automation'][_0x0547('0x48')](_0x3801bb)[_0x0547('0x24')](handleEntityNotFound(_0x271471,null))[_0x0547('0x24')](respondWithResult(_0x271471,null))[_0x0547('0x43')](handleError(_0x271471,null));};exports[_0x0547('0x49')]=function(_0x48996b,_0x41fc8a){return db[_0x0547('0x2b')][_0x0547('0x49')](_0x48996b[_0x0547('0x4a')],{})['then'](respondWithResult(_0x41fc8a,0xc9))[_0x0547('0x43')](handleError(_0x41fc8a,null));};exports['update']=function(_0x13989c,_0x5e4602){if(_0x13989c[_0x0547('0x4a')]['id']){delete _0x13989c[_0x0547('0x4a')]['id'];}return db['Automation']['find']({'where':{'id':_0x13989c[_0x0547('0x45')]['id']}})[_0x0547('0x24')](handleEntityNotFound(_0x5e4602,null))[_0x0547('0x24')](saveUpdates(_0x13989c[_0x0547('0x4a')],null))['then'](respondWithResult(_0x5e4602,null))['catch'](handleError(_0x5e4602,null));};exports[_0x0547('0x25')]=function(_0x2128f5,_0x596f46){return db['Automation']['find']({'where':{'id':_0x2128f5[_0x0547('0x45')]['id']}})['then'](handleEntityNotFound(_0x596f46,null))['then'](removeEntity(_0x596f46,null))[_0x0547('0x43')](handleError(_0x596f46,null));};exports['addConditions']=function(_0x292045,_0xe1b1de,_0x3712eb){return db['Condition'][_0x0547('0x48')]({'where':{'id':_0x292045[_0x0547('0x45')]['id']}})[_0x0547('0x24')](handleEntityNotFound(_0xe1b1de,null))[_0x0547('0x24')](function(_0x487786){if(_0x487786){return _0x487786['addConditions'](_0x292045[_0x0547('0x4a')][_0x0547('0x4b')],_[_0x0547('0x4c')](_0x292045[_0x0547('0x4a')],[_0x0547('0x4b'),'id'])||{});}})[_0x0547('0x24')](respondWithResult(_0xe1b1de,null))[_0x0547('0x43')](handleError(_0xe1b1de,null));};exports[_0x0547('0x4d')]=function(_0x433994,_0x5b5198,_0x314368){var _0x363e72={};var _0xec5dc9={};var _0x1887b4;var _0x5e3ca8;return db['Automation'][_0x0547('0x4e')]({'where':{'id':_0x433994['params']['id']}})['then'](handleEntityNotFound(_0x5b5198,null))['then'](function(_0x256bea){if(_0x256bea){_0x1887b4=_0x256bea;_0xec5dc9[_0x0547('0x2f')]=_[_0x0547('0x46')](db[_0x0547('0x4f')][_0x0547('0x2c')]);_0xec5dc9['query']=_[_0x0547('0x46')](_0x433994[_0x0547('0x30')]);_0xec5dc9['filters']=_['intersection'](_0xec5dc9[_0x0547('0x2f')],_0xec5dc9['query']);_0x363e72['attributes']=_[_0x0547('0x32')](_0xec5dc9[_0x0547('0x2f')],qs[_0x0547('0x34')](_0x433994['query'][_0x0547('0x34')]));_0x363e72['attributes']=_0x363e72[_0x0547('0x33')][_0x0547('0x47')]?_0x363e72[_0x0547('0x33')]:_0xec5dc9[_0x0547('0x2f')];_0x363e72[_0x0547('0x50')]=qs[_0x0547('0x37')](_0x433994[_0x0547('0x30')][_0x0547('0x37')]);_0x363e72[_0x0547('0x38')]=qs[_0x0547('0x31')](_[_0x0547('0x39')](_0x433994[_0x0547('0x30')],_0xec5dc9[_0x0547('0x31')]));if(_0x433994[_0x0547('0x30')][_0x0547('0x3a')]){_0x363e72['where']=_[_0x0547('0x3d')](_0x363e72[_0x0547('0x38')],{'$or':_[_0x0547('0x2a')](_0x363e72['attributes'],function(_0x243396){var _0x312786={};_0x312786[_0x243396]={'$like':'%'+_0x433994[_0x0547('0x30')][_0x0547('0x3a')]+'%'};return _0x312786;})});}_0x363e72=_['merge']({},_0x363e72,_0x433994[_0x0547('0x3e')]);return _0x1887b4[_0x0547('0x4d')](_0x363e72);}})['then'](function(_0x38b045){if(_0x38b045){_0x5e3ca8=_0x38b045[_0x0547('0x47')];if(!_0x433994[_0x0547('0x30')]['hasOwnProperty'](_0x0547('0x51'))){_0x363e72[_0x0547('0x36')]=qs[_0x0547('0x36')](_0x433994[_0x0547('0x30')][_0x0547('0x36')]);_0x363e72[_0x0547('0x1e')]=qs[_0x0547('0x1e')](_0x433994[_0x0547('0x30')][_0x0547('0x1e')]);}return _0x1887b4['getConditions'](_0x363e72);}})['then'](function(_0x4923dc){if(_0x4923dc){return _0x4923dc?{'count':_0x5e3ca8,'rows':_0x4923dc}:null;}})[_0x0547('0x24')](respondWithResult(_0x5b5198,null))[_0x0547('0x43')](handleError(_0x5b5198,null));};exports['addActions']=function(_0x32f00b,_0x1eb2ba,_0xe667fb){return db[_0x0547('0x52')]['find']({'where':{'id':_0x32f00b[_0x0547('0x45')]['id']}})[_0x0547('0x24')](handleEntityNotFound(_0x1eb2ba,null))[_0x0547('0x24')](function(_0x459c8d){if(_0x459c8d){return _0x459c8d[_0x0547('0x53')](_0x32f00b[_0x0547('0x4a')]['ids'],_[_0x0547('0x4c')](_0x32f00b['body'],[_0x0547('0x4b'),'id'])||{});}})[_0x0547('0x24')](respondWithResult(_0x1eb2ba,null))[_0x0547('0x43')](handleError(_0x1eb2ba,null));};exports[_0x0547('0x54')]=function(_0x43533c,_0x12061f,_0x3cb8b7){var _0xe833b6={};var _0x11c841={};var _0x21d602;var _0x1268b5;return db[_0x0547('0x2b')][_0x0547('0x4e')]({'where':{'id':_0x43533c[_0x0547('0x45')]['id']}})[_0x0547('0x24')](handleEntityNotFound(_0x12061f,null))[_0x0547('0x24')](function(_0x53f1d8){if(_0x53f1d8){_0x21d602=_0x53f1d8;_0x11c841['model']=_[_0x0547('0x46')](db[_0x0547('0x52')][_0x0547('0x2c')]);_0x11c841[_0x0547('0x30')]=_[_0x0547('0x46')](_0x43533c['query']);_0x11c841[_0x0547('0x31')]=_[_0x0547('0x32')](_0x11c841[_0x0547('0x2f')],_0x11c841[_0x0547('0x30')]);_0xe833b6['attributes']=_['intersection'](_0x11c841['model'],qs[_0x0547('0x34')](_0x43533c[_0x0547('0x30')][_0x0547('0x34')]));_0xe833b6[_0x0547('0x33')]=_0xe833b6[_0x0547('0x33')][_0x0547('0x47')]?_0xe833b6[_0x0547('0x33')]:_0x11c841[_0x0547('0x2f')];_0xe833b6[_0x0547('0x50')]=qs[_0x0547('0x37')](_0x43533c[_0x0547('0x30')]['sort']);_0xe833b6[_0x0547('0x38')]=qs['filters'](_[_0x0547('0x39')](_0x43533c[_0x0547('0x30')],_0x11c841[_0x0547('0x31')]));if(_0x43533c[_0x0547('0x30')][_0x0547('0x3a')]){_0xe833b6['where']=_[_0x0547('0x3d')](_0xe833b6[_0x0547('0x38')],{'$or':_['map'](_0xe833b6[_0x0547('0x33')],function(_0x34f604){var _0x2fba1f={};_0x2fba1f[_0x34f604]={'$like':'%'+_0x43533c[_0x0547('0x30')][_0x0547('0x3a')]+'%'};return _0x2fba1f;})});}_0xe833b6=_[_0x0547('0x3d')]({},_0xe833b6,_0x43533c['options']);return _0x21d602[_0x0547('0x54')](_0xe833b6);}})[_0x0547('0x24')](function(_0x2b86c3){if(_0x2b86c3){_0x1268b5=_0x2b86c3['length'];if(!_0x43533c['query']['hasOwnProperty'](_0x0547('0x51'))){_0xe833b6['limit']=qs[_0x0547('0x36')](_0x43533c[_0x0547('0x30')][_0x0547('0x36')]);_0xe833b6[_0x0547('0x1e')]=qs[_0x0547('0x1e')](_0x43533c[_0x0547('0x30')][_0x0547('0x1e')]);}return _0x21d602[_0x0547('0x54')](_0xe833b6);}})[_0x0547('0x24')](function(_0x43338d){if(_0x43338d){return _0x43338d?{'count':_0x1268b5,'rows':_0x43338d}:null;}})[_0x0547('0x24')](respondWithResult(_0x12061f,null))[_0x0547('0x43')](handleError(_0x12061f,null));}; \ No newline at end of file +var _0x5651=['send','index','map','Automation','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','create','body','find','addConditions','Condition','ids','omit','getConditions','findOne','hasOwnProperty','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','stack','name'];(function(_0x44c066,_0x34f5c8){var _0x350548=function(_0x4b8d5b){while(--_0x4b8d5b){_0x44c066['push'](_0x44c066['shift']());}};_0x350548(++_0x34f5c8);}(_0x5651,0x134));var _0x1565=function(_0x2df724,_0x411382){_0x2df724=_0x2df724-0x0;var _0x1b2504=_0x5651[_0x2df724];return _0x1b2504;};'use strict';var emlformat=require(_0x1565('0x0'));var rimraf=require(_0x1565('0x1'));var zipdir=require(_0x1565('0x2'));var jsonpatch=require(_0x1565('0x3'));var rp=require(_0x1565('0x4'));var moment=require(_0x1565('0x5'));var BPromise=require(_0x1565('0x6'));var Mustache=require('mustache');var util=require(_0x1565('0x7'));var path=require(_0x1565('0x8'));var sox=require(_0x1565('0x9'));var csv=require(_0x1565('0xa'));var ejs=require(_0x1565('0xb'));var fs=require('fs');var fs_extra=require(_0x1565('0xc'));var _=require('lodash');var squel=require(_0x1565('0xd'));var crypto=require(_0x1565('0xe'));var jsforce=require(_0x1565('0xf'));var deskjs=require(_0x1565('0x10'));var toCsv=require(_0x1565('0xa'));var querystring=require('querystring');var Papa=require(_0x1565('0x11'));var Redis=require(_0x1565('0x12'));var authService=require(_0x1565('0x13'));var qs=require(_0x1565('0x14'));var as=require(_0x1565('0x15'));var hardwareService=require(_0x1565('0x16'));var logger=require(_0x1565('0x17'))('api');var utils=require(_0x1565('0x18'));var config=require(_0x1565('0x19'));var licenseUtil=require(_0x1565('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52054d,_0x201089){_0x201089=_0x201089||0xcc;return function(_0x66213){if(_0x66213){return _0x52054d[_0x1565('0x1b')](_0x201089);}return _0x52054d[_0x1565('0x1c')](_0x201089)[_0x1565('0x1d')]();};}function respondWithResult(_0x1b213f,_0x453ced){_0x453ced=_0x453ced||0xc8;return function(_0xaf7ee2){if(_0xaf7ee2){return _0x1b213f[_0x1565('0x1c')](_0x453ced)[_0x1565('0x1e')](_0xaf7ee2);}};}function respondWithFilteredResult(_0x337f93,_0x1cd1d4){return function(_0x3a4932){if(_0x3a4932){var _0xf74a2a=typeof _0x1cd1d4[_0x1565('0x1f')]==='undefined'&&typeof _0x1cd1d4[_0x1565('0x20')]===_0x1565('0x21');var _0x3e995c=_0x3a4932[_0x1565('0x22')];var _0xde9e2c=_0xf74a2a?0x0:_0x1cd1d4['offset'];var _0x253f46=_0xf74a2a?_0x3a4932[_0x1565('0x22')]:_0x1cd1d4[_0x1565('0x1f')]+_0x1cd1d4[_0x1565('0x20')];var _0x5e66c8;if(_0x253f46>=_0x3e995c){_0x253f46=_0x3e995c;_0x5e66c8=0xc8;}else{_0x5e66c8=0xce;}_0x337f93['status'](_0x5e66c8);return _0x337f93[_0x1565('0x23')](_0x1565('0x24'),_0xde9e2c+'-'+_0x253f46+'/'+_0x3e995c)[_0x1565('0x1e')](_0x3a4932);}return null;};}function patchUpdates(_0x17a4a7){return function(_0x131f8b){try{jsonpatch[_0x1565('0x25')](_0x131f8b,_0x17a4a7,!![]);}catch(_0x22330b){return BPromise['reject'](_0x22330b);}return _0x131f8b[_0x1565('0x26')]();};}function saveUpdates(_0x3cc1cf,_0x3bddc0){return function(_0x50ff11){if(_0x50ff11){return _0x50ff11[_0x1565('0x27')](_0x3cc1cf)['then'](function(_0x4968bb){return _0x4968bb;});}return null;};}function removeEntity(_0x39604e,_0x2cb6db){return function(_0x9cb6c1){if(_0x9cb6c1){return _0x9cb6c1[_0x1565('0x28')]()[_0x1565('0x29')](function(){_0x39604e[_0x1565('0x1c')](0xcc)[_0x1565('0x1d')]();});}};}function handleEntityNotFound(_0x514a5e,_0x1afbb6){return function(_0x5ce669){if(!_0x5ce669){_0x514a5e[_0x1565('0x1b')](0x194);}return _0x5ce669;};}function handleError(_0x52de1c,_0x3bc87e){_0x3bc87e=_0x3bc87e||0x1f4;return function(_0x2f8521){logger['error'](_0x2f8521[_0x1565('0x2a')]);if(_0x2f8521[_0x1565('0x2b')]){delete _0x2f8521[_0x1565('0x2b')];}_0x52de1c['status'](_0x3bc87e)[_0x1565('0x2c')](_0x2f8521);};}exports[_0x1565('0x2d')]=function(_0x23672c,_0x2e9e86){var _0x1d07ed={},_0x5418d4={},_0x24046d={'count':0x0,'rows':[]};var _0x5d01cc=_[_0x1565('0x2e')](db[_0x1565('0x2f')][_0x1565('0x30')],function(_0x15de99){return{'name':_0x15de99[_0x1565('0x31')],'type':_0x15de99['type'][_0x1565('0x32')]};});_0x5418d4['model']=_[_0x1565('0x2e')](_0x5d01cc,_0x1565('0x2b'));_0x5418d4[_0x1565('0x33')]=_['keys'](_0x23672c['query']);_0x5418d4[_0x1565('0x34')]=_[_0x1565('0x35')](_0x5418d4[_0x1565('0x36')],_0x5418d4[_0x1565('0x33')]);_0x1d07ed[_0x1565('0x37')]=_['intersection'](_0x5418d4['model'],qs['fields'](_0x23672c[_0x1565('0x33')][_0x1565('0x38')]));_0x1d07ed[_0x1565('0x37')]=_0x1d07ed['attributes'][_0x1565('0x39')]?_0x1d07ed['attributes']:_0x5418d4[_0x1565('0x36')];if(!_0x23672c['query']['hasOwnProperty'](_0x1565('0x3a'))){_0x1d07ed['limit']=qs[_0x1565('0x20')](_0x23672c[_0x1565('0x33')][_0x1565('0x20')]);_0x1d07ed[_0x1565('0x1f')]=qs[_0x1565('0x1f')](_0x23672c[_0x1565('0x33')]['offset']);}_0x1d07ed[_0x1565('0x3b')]=qs[_0x1565('0x3c')](_0x23672c[_0x1565('0x33')][_0x1565('0x3c')]);_0x1d07ed[_0x1565('0x3d')]=qs[_0x1565('0x34')](_[_0x1565('0x3e')](_0x23672c[_0x1565('0x33')],_0x5418d4[_0x1565('0x34')]),_0x5d01cc);if(_0x23672c[_0x1565('0x33')][_0x1565('0x3f')]){_0x1d07ed['where']=_['merge'](_0x1d07ed[_0x1565('0x3d')],{'$or':_[_0x1565('0x2e')](_0x5d01cc,function(_0x18e9c5){if(_0x18e9c5[_0x1565('0x40')]!==_0x1565('0x41')){var _0x43198c={};_0x43198c[_0x18e9c5[_0x1565('0x2b')]]={'$like':'%'+_0x23672c[_0x1565('0x33')][_0x1565('0x3f')]+'%'};return _0x43198c;}})});}_0x1d07ed=_[_0x1565('0x42')]({},_0x1d07ed,_0x23672c[_0x1565('0x43')]);var _0x402538={'where':_0x1d07ed[_0x1565('0x3d')]};return db[_0x1565('0x2f')][_0x1565('0x22')](_0x402538)[_0x1565('0x29')](function(_0x3ba327){_0x24046d['count']=_0x3ba327;if(_0x23672c[_0x1565('0x33')][_0x1565('0x44')]){_0x1d07ed[_0x1565('0x45')]=[{'all':!![]}];}return db['Automation'][_0x1565('0x46')](_0x1d07ed);})[_0x1565('0x29')](function(_0x2c36e7){_0x24046d['rows']=_0x2c36e7;return _0x24046d;})[_0x1565('0x29')](respondWithFilteredResult(_0x2e9e86,_0x1d07ed))[_0x1565('0x47')](handleError(_0x2e9e86,null));};exports[_0x1565('0x48')]=function(_0x41c4c6,_0x261465){var _0x4e01e3={'raw':![],'where':{'id':_0x41c4c6[_0x1565('0x49')]['id']}},_0x4a73c2={};_0x4a73c2[_0x1565('0x36')]=_['keys'](db[_0x1565('0x2f')][_0x1565('0x30')]);_0x4a73c2[_0x1565('0x33')]=_[_0x1565('0x4a')](_0x41c4c6[_0x1565('0x33')]);_0x4a73c2['filters']=_[_0x1565('0x35')](_0x4a73c2['model'],_0x4a73c2[_0x1565('0x33')]);_0x4e01e3['attributes']=_[_0x1565('0x35')](_0x4a73c2[_0x1565('0x36')],qs['fields'](_0x41c4c6[_0x1565('0x33')][_0x1565('0x38')]));_0x4e01e3[_0x1565('0x37')]=_0x4e01e3['attributes'][_0x1565('0x39')]?_0x4e01e3[_0x1565('0x37')]:_0x4a73c2[_0x1565('0x36')];if(_0x41c4c6[_0x1565('0x33')]['includeAll']){_0x4e01e3[_0x1565('0x45')]=[{'all':!![]}];}_0x4e01e3=_[_0x1565('0x42')]({},_0x4e01e3,_0x41c4c6['options']);return db['Automation']['find'](_0x4e01e3)[_0x1565('0x29')](handleEntityNotFound(_0x261465,null))[_0x1565('0x29')](respondWithResult(_0x261465,null))['catch'](handleError(_0x261465,null));};exports[_0x1565('0x4b')]=function(_0x4038c5,_0x5d1472){return db[_0x1565('0x2f')][_0x1565('0x4b')](_0x4038c5[_0x1565('0x4c')],{})[_0x1565('0x29')](respondWithResult(_0x5d1472,0xc9))[_0x1565('0x47')](handleError(_0x5d1472,null));};exports[_0x1565('0x27')]=function(_0x1dcb97,_0x54682d){if(_0x1dcb97[_0x1565('0x4c')]['id']){delete _0x1dcb97['body']['id'];}return db['Automation'][_0x1565('0x4d')]({'where':{'id':_0x1dcb97[_0x1565('0x49')]['id']}})[_0x1565('0x29')](handleEntityNotFound(_0x54682d,null))['then'](saveUpdates(_0x1dcb97[_0x1565('0x4c')],null))[_0x1565('0x29')](respondWithResult(_0x54682d,null))[_0x1565('0x47')](handleError(_0x54682d,null));};exports[_0x1565('0x28')]=function(_0x2d70f2,_0x50177d){return db[_0x1565('0x2f')]['find']({'where':{'id':_0x2d70f2[_0x1565('0x49')]['id']}})[_0x1565('0x29')](handleEntityNotFound(_0x50177d,null))[_0x1565('0x29')](removeEntity(_0x50177d,null))['catch'](handleError(_0x50177d,null));};exports[_0x1565('0x4e')]=function(_0x2d66d9,_0x68f0be,_0x5d4b11){return db[_0x1565('0x4f')]['find']({'where':{'id':_0x2d66d9['params']['id']}})[_0x1565('0x29')](handleEntityNotFound(_0x68f0be,null))[_0x1565('0x29')](function(_0x34b216){if(_0x34b216){return _0x34b216[_0x1565('0x4e')](_0x2d66d9['body'][_0x1565('0x50')],_[_0x1565('0x51')](_0x2d66d9[_0x1565('0x4c')],[_0x1565('0x50'),'id'])||{});}})[_0x1565('0x29')](respondWithResult(_0x68f0be,null))['catch'](handleError(_0x68f0be,null));};exports[_0x1565('0x52')]=function(_0x4680e9,_0x5a4b22,_0x3d9354){var _0xa2e2a3={};var _0x475217={};var _0x1aacd1;var _0x802e03;return db['Automation'][_0x1565('0x53')]({'where':{'id':_0x4680e9[_0x1565('0x49')]['id']}})[_0x1565('0x29')](handleEntityNotFound(_0x5a4b22,null))['then'](function(_0xf0cef6){if(_0xf0cef6){_0x1aacd1=_0xf0cef6;_0x475217[_0x1565('0x36')]=_['keys'](db[_0x1565('0x4f')][_0x1565('0x30')]);_0x475217['query']=_['keys'](_0x4680e9[_0x1565('0x33')]);_0x475217[_0x1565('0x34')]=_[_0x1565('0x35')](_0x475217[_0x1565('0x36')],_0x475217[_0x1565('0x33')]);_0xa2e2a3[_0x1565('0x37')]=_[_0x1565('0x35')](_0x475217[_0x1565('0x36')],qs[_0x1565('0x38')](_0x4680e9[_0x1565('0x33')]['fields']));_0xa2e2a3[_0x1565('0x37')]=_0xa2e2a3[_0x1565('0x37')][_0x1565('0x39')]?_0xa2e2a3[_0x1565('0x37')]:_0x475217[_0x1565('0x36')];_0xa2e2a3['order']=qs['sort'](_0x4680e9[_0x1565('0x33')][_0x1565('0x3c')]);_0xa2e2a3[_0x1565('0x3d')]=qs['filters'](_[_0x1565('0x3e')](_0x4680e9[_0x1565('0x33')],_0x475217[_0x1565('0x34')]));if(_0x4680e9['query']['filter']){_0xa2e2a3[_0x1565('0x3d')]=_[_0x1565('0x42')](_0xa2e2a3[_0x1565('0x3d')],{'$or':_[_0x1565('0x2e')](_0xa2e2a3['attributes'],function(_0x1ab0c3){var _0x5f4420={};_0x5f4420[_0x1ab0c3]={'$like':'%'+_0x4680e9[_0x1565('0x33')][_0x1565('0x3f')]+'%'};return _0x5f4420;})});}_0xa2e2a3=_[_0x1565('0x42')]({},_0xa2e2a3,_0x4680e9[_0x1565('0x43')]);return _0x1aacd1[_0x1565('0x52')](_0xa2e2a3);}})[_0x1565('0x29')](function(_0x541ce6){if(_0x541ce6){_0x802e03=_0x541ce6['length'];if(!_0x4680e9['query'][_0x1565('0x54')](_0x1565('0x3a'))){_0xa2e2a3[_0x1565('0x20')]=qs[_0x1565('0x20')](_0x4680e9[_0x1565('0x33')]['limit']);_0xa2e2a3['offset']=qs['offset'](_0x4680e9[_0x1565('0x33')][_0x1565('0x1f')]);}return _0x1aacd1['getConditions'](_0xa2e2a3);}})['then'](function(_0x40aa22){if(_0x40aa22){return _0x40aa22?{'count':_0x802e03,'rows':_0x40aa22}:null;}})[_0x1565('0x29')](respondWithResult(_0x5a4b22,null))[_0x1565('0x47')](handleError(_0x5a4b22,null));};exports[_0x1565('0x55')]=function(_0x5bfb38,_0x5df42c,_0x353d78){return db[_0x1565('0x56')][_0x1565('0x4d')]({'where':{'id':_0x5bfb38['params']['id']}})[_0x1565('0x29')](handleEntityNotFound(_0x5df42c,null))[_0x1565('0x29')](function(_0x598d81){if(_0x598d81){return _0x598d81[_0x1565('0x55')](_0x5bfb38[_0x1565('0x4c')]['ids'],_[_0x1565('0x51')](_0x5bfb38[_0x1565('0x4c')],['ids','id'])||{});}})[_0x1565('0x29')](respondWithResult(_0x5df42c,null))[_0x1565('0x47')](handleError(_0x5df42c,null));};exports[_0x1565('0x57')]=function(_0x3eb520,_0x5de76c,_0x34863a){var _0x38a22a={};var _0x1a9f41={};var _0x551369;var _0x24333e;return db[_0x1565('0x2f')][_0x1565('0x53')]({'where':{'id':_0x3eb520[_0x1565('0x49')]['id']}})[_0x1565('0x29')](handleEntityNotFound(_0x5de76c,null))[_0x1565('0x29')](function(_0x132d02){if(_0x132d02){_0x551369=_0x132d02;_0x1a9f41[_0x1565('0x36')]=_[_0x1565('0x4a')](db['Action'][_0x1565('0x30')]);_0x1a9f41[_0x1565('0x33')]=_[_0x1565('0x4a')](_0x3eb520[_0x1565('0x33')]);_0x1a9f41['filters']=_[_0x1565('0x35')](_0x1a9f41[_0x1565('0x36')],_0x1a9f41[_0x1565('0x33')]);_0x38a22a[_0x1565('0x37')]=_[_0x1565('0x35')](_0x1a9f41[_0x1565('0x36')],qs['fields'](_0x3eb520[_0x1565('0x33')]['fields']));_0x38a22a['attributes']=_0x38a22a[_0x1565('0x37')]['length']?_0x38a22a[_0x1565('0x37')]:_0x1a9f41[_0x1565('0x36')];_0x38a22a[_0x1565('0x3b')]=qs['sort'](_0x3eb520[_0x1565('0x33')][_0x1565('0x3c')]);_0x38a22a[_0x1565('0x3d')]=qs[_0x1565('0x34')](_[_0x1565('0x3e')](_0x3eb520[_0x1565('0x33')],_0x1a9f41['filters']));if(_0x3eb520[_0x1565('0x33')]['filter']){_0x38a22a[_0x1565('0x3d')]=_['merge'](_0x38a22a[_0x1565('0x3d')],{'$or':_[_0x1565('0x2e')](_0x38a22a[_0x1565('0x37')],function(_0x3b5441){var _0xfbe7={};_0xfbe7[_0x3b5441]={'$like':'%'+_0x3eb520['query'][_0x1565('0x3f')]+'%'};return _0xfbe7;})});}_0x38a22a=_[_0x1565('0x42')]({},_0x38a22a,_0x3eb520[_0x1565('0x43')]);return _0x551369[_0x1565('0x57')](_0x38a22a);}})['then'](function(_0x1efb45){if(_0x1efb45){_0x24333e=_0x1efb45[_0x1565('0x39')];if(!_0x3eb520[_0x1565('0x33')][_0x1565('0x54')](_0x1565('0x3a'))){_0x38a22a[_0x1565('0x20')]=qs[_0x1565('0x20')](_0x3eb520[_0x1565('0x33')][_0x1565('0x20')]);_0x38a22a[_0x1565('0x1f')]=qs[_0x1565('0x1f')](_0x3eb520[_0x1565('0x33')]['offset']);}return _0x551369[_0x1565('0x57')](_0x38a22a);}})['then'](function(_0x198e85){if(_0x198e85){return _0x198e85?{'count':_0x24333e,'rows':_0x198e85}:null;}})[_0x1565('0x29')](respondWithResult(_0x5de76c,null))[_0x1565('0x47')](handleError(_0x5de76c,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index d2adbd5..b3989bd 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 _0xd17f=['define','Automation','tools_automations','lodash','util','api','moment','bluebird','request-promise','path','./automation.attributes','exports'];(function(_0x388e37,_0x40009f){var _0x4886f2=function(_0x12e42b){while(--_0x12e42b){_0x388e37['push'](_0x388e37['shift']());}};_0x4886f2(++_0x40009f);}(_0xd17f,0x93));var _0xfd17=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd17f[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xfd17('0x0'));var util=require(_0xfd17('0x1'));var logger=require('../../config/logger')(_0xfd17('0x2'));var moment=require(_0xfd17('0x3'));var BPromise=require(_0xfd17('0x4'));var rp=require(_0xfd17('0x5'));var fs=require('fs');var path=require(_0xfd17('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfd17('0x7'));module[_0xfd17('0x8')]=function(_0x9fa7a6,_0xffd01d){return _0x9fa7a6[_0xfd17('0x9')](_0xfd17('0xa'),attributes,{'tableName':_0xfd17('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9a8=['../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x36bf88,_0x15c459){var _0x332914=function(_0x512adf){while(--_0x512adf){_0x36bf88['push'](_0x36bf88['shift']());}};_0x332914(++_0x15c459);}(_0xc9a8,0x13a));var _0x8c9a=function(_0x146837,_0x2aa6a2){_0x146837=_0x146837-0x0;var _0x3d7e60=_0xc9a8[_0x146837];return _0x3d7e60;};'use strict';var _=require(_0x8c9a('0x0'));var util=require(_0x8c9a('0x1'));var logger=require(_0x8c9a('0x2'))(_0x8c9a('0x3'));var moment=require(_0x8c9a('0x4'));var BPromise=require(_0x8c9a('0x5'));var rp=require(_0x8c9a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8c9a('0x7'));var config=require(_0x8c9a('0x8'));var attributes=require(_0x8c9a('0x9'));module[_0x8c9a('0xa')]=function(_0x77ae46,_0x5e3005){return _0x77ae46[_0x8c9a('0xb')](_0x8c9a('0xc'),attributes,{'tableName':_0x8c9a('0xd'),'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 fdbf275..e433253 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 _0x88c3=['lodash','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','Automation,\x20%s,\x20%s','message','result'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0x88c3,0x1ee));var _0x388c=function(_0x324eab,_0x2ed898){_0x324eab=_0x324eab-0x0;var _0x1af397=_0x88c3[_0x324eab];return _0x1af397;};'use strict';var _=require(_0x388c('0x0'));var util=require('util');var moment=require(_0x388c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x388c('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x388c('0x3'))(_0x388c('0x4'));var config=require(_0x388c('0x5'));var jayson=require(_0x388c('0x6'));var client=jayson[_0x388c('0x7')][_0x388c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a1c0d,_0x3e79d8,_0x374b99){return new BPromise(function(_0x26be80,_0xc157a){return client[_0x388c('0x9')](_0x5a1c0d,_0x374b99)[_0x388c('0xa')](function(_0x2debe9){logger[_0x388c('0xb')]('Automation,\x20%s,\x20%s',_0x3e79d8,_0x388c('0xc'));logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x3e79d8,_0x388c('0xc'),JSON[_0x388c('0xd')](_0x2debe9));if(_0x2debe9[_0x388c('0xe')]){if(_0x2debe9[_0x388c('0xe')][_0x388c('0xf')]===0x1f4){logger[_0x388c('0xe')](_0x388c('0x10'),_0x3e79d8,_0x2debe9[_0x388c('0xe')][_0x388c('0x11')]);return _0xc157a(_0x2debe9['error']['message']);}logger['error'](_0x388c('0x10'),_0x3e79d8,_0x2debe9[_0x388c('0xe')]['message']);return _0x26be80(_0x2debe9[_0x388c('0xe')][_0x388c('0x11')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0x3e79d8,_0x388c('0xc'));_0x26be80(_0x2debe9[_0x388c('0x12')][_0x388c('0x11')]);}})['catch'](function(_0x10a3b4){logger['error'](_0x388c('0x10'),_0x3e79d8,_0x10a3b4);_0xc157a(_0x10a3b4);});});} \ No newline at end of file +var _0x26b2=['jayson/promise','client','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3e8258,_0x5ac586){var _0x49dc22=function(_0x3d22ac){while(--_0x3d22ac){_0x3e8258['push'](_0x3e8258['shift']());}};_0x49dc22(++_0x5ac586);}(_0x26b2,0xc5));var _0x226b=function(_0x32de4b,_0x19d2b5){_0x32de4b=_0x32de4b-0x0;var _0x433f7f=_0x26b2[_0x32de4b];return _0x433f7f;};'use strict';var _=require(_0x226b('0x0'));var util=require(_0x226b('0x1'));var moment=require(_0x226b('0x2'));var BPromise=require('bluebird');var rs=require(_0x226b('0x3'));var fs=require('fs');var Redis=require(_0x226b('0x4'));var db=require(_0x226b('0x5'))['db'];var utils=require(_0x226b('0x6'));var logger=require(_0x226b('0x7'))(_0x226b('0x8'));var config=require(_0x226b('0x9'));var jayson=require(_0x226b('0xa'));var client=jayson[_0x226b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7997dc,_0x4eb496,_0x15b465){return new BPromise(function(_0x28d0f8,_0x2cd2db){return client['request'](_0x7997dc,_0x15b465)['then'](function(_0x1fea7e){logger[_0x226b('0xc')](_0x226b('0xd'),_0x4eb496,_0x226b('0xe'));logger[_0x226b('0xf')](_0x226b('0x10'),_0x4eb496,'request\x20sent',JSON[_0x226b('0x11')](_0x1fea7e));if(_0x1fea7e['error']){if(_0x1fea7e[_0x226b('0x12')][_0x226b('0x13')]===0x1f4){logger[_0x226b('0x12')](_0x226b('0xd'),_0x4eb496,_0x1fea7e[_0x226b('0x12')][_0x226b('0x14')]);return _0x2cd2db(_0x1fea7e['error'][_0x226b('0x14')]);}logger[_0x226b('0x12')](_0x226b('0xd'),_0x4eb496,_0x1fea7e[_0x226b('0x12')]['message']);return _0x28d0f8(_0x1fea7e[_0x226b('0x12')][_0x226b('0x14')]);}else{logger[_0x226b('0xc')](_0x226b('0xd'),_0x4eb496,_0x226b('0xe'));_0x28d0f8(_0x1fea7e[_0x226b('0x15')]['message']);}})[_0x226b('0x16')](function(_0xadda16){logger[_0x226b('0x12')](_0x226b('0xd'),_0x4eb496,_0xadda16);_0x2cd2db(_0xadda16);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 1ff8ba7..b6e157e 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 _0x3b75=['fs-extra','../../components/auth/service','./automation.controller','get','isAuthenticated','index','show','/:id/conditions','/:id/actions','getActions','post','addConditions','addActions','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x3b75,0x144));var _0x53b7=function(_0x483d8b,_0x526c52){_0x483d8b=_0x483d8b-0x0;var _0x6500f1=_0x3b75[_0x483d8b];return _0x6500f1;};'use strict';var multer=require(_0x53b7('0x0'));var util=require(_0x53b7('0x1'));var path=require(_0x53b7('0x2'));var timeout=require(_0x53b7('0x3'));var express=require(_0x53b7('0x4'));var router=express[_0x53b7('0x5')]();var fs_extra=require(_0x53b7('0x6'));var auth=require(_0x53b7('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x53b7('0x8'));router[_0x53b7('0x9')]('/',auth[_0x53b7('0xa')](),controller[_0x53b7('0xb')]);router['get']('/:id',auth[_0x53b7('0xa')](),controller[_0x53b7('0xc')]);router[_0x53b7('0x9')](_0x53b7('0xd'),auth[_0x53b7('0xa')](),controller['getConditions']);router[_0x53b7('0x9')](_0x53b7('0xe'),auth[_0x53b7('0xa')](),controller[_0x53b7('0xf')]);router[_0x53b7('0x10')]('/',auth[_0x53b7('0xa')](),controller['create']);router['post'](_0x53b7('0xd'),auth['isAuthenticated'](),controller[_0x53b7('0x11')]);router['post'](_0x53b7('0xe'),auth[_0x53b7('0xa')](),controller[_0x53b7('0x12')]);router['put'](_0x53b7('0x13'),auth[_0x53b7('0xa')](),controller['update']);router['delete'](_0x53b7('0x13'),auth[_0x53b7('0xa')](),controller[_0x53b7('0x14')]);module[_0x53b7('0x15')]=router; \ No newline at end of file +var _0x6d6f=['/:id','delete','destroy','connect-timeout','express','Router','../../components/auth/service','./automation.controller','isAuthenticated','get','/:id/conditions','getConditions','/:id/actions','post','create','addConditions','addActions','put'];(function(_0x398d94,_0x2d26d6){var _0x5d0624=function(_0x4e2c32){while(--_0x4e2c32){_0x398d94['push'](_0x398d94['shift']());}};_0x5d0624(++_0x2d26d6);}(_0x6d6f,0x159));var _0xf6d6=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x6d6f[_0x455c6c];return _0x488242;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf6d6('0x0'));var express=require(_0xf6d6('0x1'));var router=express[_0xf6d6('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xf6d6('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf6d6('0x4'));router['get']('/',auth[_0xf6d6('0x5')](),controller['index']);router['get']('/:id',auth[_0xf6d6('0x5')](),controller['show']);router[_0xf6d6('0x6')](_0xf6d6('0x7'),auth[_0xf6d6('0x5')](),controller[_0xf6d6('0x8')]);router[_0xf6d6('0x6')](_0xf6d6('0x9'),auth[_0xf6d6('0x5')](),controller['getActions']);router[_0xf6d6('0xa')]('/',auth[_0xf6d6('0x5')](),controller[_0xf6d6('0xb')]);router[_0xf6d6('0xa')](_0xf6d6('0x7'),auth['isAuthenticated'](),controller[_0xf6d6('0xc')]);router['post']('/:id/actions',auth[_0xf6d6('0x5')](),controller[_0xf6d6('0xd')]);router[_0xf6d6('0xe')](_0xf6d6('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xf6d6('0x10')](_0xf6d6('0xf'),auth[_0xf6d6('0x5')](),controller[_0xf6d6('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 6e0a832..8569c3a 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 _0xc2e7=['onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ENUM','ivr','STRING','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never'];(function(_0x1a27e9,_0x4c8a50){var _0x1a5849=function(_0x4a91d1){while(--_0x4a91d1){_0x1a27e9['push'](_0x1a27e9['shift']());}};_0x1a5849(++_0x4c8a50);}(_0xc2e7,0x1c1));var _0x7c2e=function(_0x17cde5,_0x14f1b8){_0x17cde5=_0x17cde5-0x0;var _0x41a2de=_0xc2e7[_0x17cde5];return _0x41a2de;};'use strict';var Sequelize=require(_0x7c2e('0x0'));module[_0x7c2e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7c2e('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x7c2e('0x3')]('ivr'),'allowNull':![],'defaultValue':_0x7c2e('0x4')},'description':{'type':Sequelize[_0x7c2e('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x7c2e('0x6')},'limitCalls':{'type':Sequelize[_0x7c2e('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x7c2e('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x7c2e('0x5')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x7c2e('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x7c2e('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7c2e('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7c2e('0x7')](0x5)[_0x7c2e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7c2e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7c2e('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x7c2e('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c2e('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7c2e('0x7')](0x3)[_0x7c2e('0x9')],'defaultValue':0x3,'comment':_0x7c2e('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x7c2e('0x7')](0x5)[_0x7c2e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c2e('0xe')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7c2e('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7c2e('0xf')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7c2e('0x5')],'defaultValue':_0x7c2e('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x7c2e('0x3')](_0x7c2e('0x11'),_0x7c2e('0x12'),_0x7c2e('0x13')),'defaultValue':_0x7c2e('0x11')},'dialAMDActive':{'type':Sequelize[_0x7c2e('0x14')],'defaultValue':0x0,'comment':_0x7c2e('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0x7c2e('0x7')](0x9)[_0x7c2e('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x7c2e('0x7')](0x9)[_0x7c2e('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x7c2e('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x7c2e('0x7')](0x9)[_0x7c2e('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x7c2e('0x7')](0x9)[_0x7c2e('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x7c2e('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7c2e('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x7c2e('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7c2e('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x7c2e('0x7')](0x9)[_0x7c2e('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x7c2e('0x7')](0x5)[_0x7c2e('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7c2e('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7c2e('0x7')](0x9)[_0x7c2e('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7c2e('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x7c2e('0x3')]('DESC',_0x7c2e('0x1b')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x7c2e('0x5')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7c2e('0x7')](0x3)[_0x7c2e('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7c2e('0x1c')},'dialCutDigit':{'type':Sequelize[_0x7c2e('0x7')](0x3)[_0x7c2e('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7c2e('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x7c2e('0x7')](0x3)[_0x7c2e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7c2e('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7c2e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x7c2e('0x7')](0x3)[_0x7c2e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7c2e('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x7c2e('0x7')](0x5)[_0x7c2e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c2e('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x7c2e('0x7')](0x3)[_0x7c2e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7c2e('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7c2e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c2e('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x7c2e('0x7')](0x3)[_0x7c2e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7c2e('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x7c2e('0x7')](0x5)[_0x7c2e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c2e('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7c2e('0x7')](0x3)[_0x7c2e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7c2e('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7c2e('0x7')](0x5)[_0x7c2e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c2e('0x26')}}; \ No newline at end of file +var _0xf132=['#AMD\x20Initial\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','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)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','Active/Disactive\x20AMD'];(function(_0x5ad521,_0x3af1da){var _0x3ea33e=function(_0x425662){while(--_0x425662){_0x5ad521['push'](_0x5ad521['shift']());}};_0x3ea33e(++_0x3af1da);}(_0xf132,0xaa));var _0x2f13=function(_0x303a45,_0x9484c){_0x303a45=_0x303a45-0x0;var _0x4916d8=_0xf132[_0x303a45];return _0x4916d8;};'use strict';var Sequelize=require(_0x2f13('0x0'));module['exports']={'name':{'type':Sequelize[_0x2f13('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x2f13('0x2')](_0x2f13('0x3')),'allowNull':![],'defaultValue':_0x2f13('0x3')},'description':{'type':Sequelize[_0x2f13('0x1')]},'active':{'type':Sequelize[_0x2f13('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x2f13('0x5')](0x4)[_0x2f13('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x2f13('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x2f13('0x5')](0x3)[_0x2f13('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f13('0x7')},'dialCongestionMaxRetry':{'type':Sequelize[_0x2f13('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f13('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x2f13('0x5')](0x5)[_0x2f13('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f13('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0x2f13('0x5')](0x3)[_0x2f13('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x2f13('0x5')](0x5)[_0x2f13('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2f13('0x6')],'defaultValue':0x3,'comment':_0x2f13('0xa')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2f13('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f13('0xb')},'dialGlobalMaxRetry':{'type':Sequelize[_0x2f13('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x2f13('0xc')},'dialTimezone':{'type':Sequelize[_0x2f13('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x2f13('0x1')],'defaultValue':_0x2f13('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0x2f13('0x2')](_0x2f13('0xe'),'never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x2f13('0xf')},'dialAMDInitialSilence':{'type':Sequelize[_0x2f13('0x5')](0x9)[_0x2f13('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x2f13('0x10')},'dialAMDGreeting':{'type':Sequelize[_0x2f13('0x5')](0x9)[_0x2f13('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x2f13('0x5')](0x9)[_0x2f13('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2f13('0x5')](0x9)[_0x2f13('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x2f13('0x5')](0x9)[_0x2f13('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x2f13('0x11')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x2f13('0x5')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x2f13('0x12')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x2f13('0x5')](0x9)[_0x2f13('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x2f13('0x5')](0x5)[_0x2f13('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x2f13('0x13')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x2f13('0x5')](0x9)[_0x2f13('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2f13('0x14')},'dialOrderByScheduledAt':{'type':Sequelize[_0x2f13('0x2')]('DESC',_0x2f13('0x15')),'defaultValue':_0x2f13('0x16')},'dialPrefix':{'type':Sequelize[_0x2f13('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x2f13('0x5')](0x3)[_0x2f13('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2f13('0x17')},'dialCutDigit':{'type':Sequelize[_0x2f13('0x5')](0x3)[_0x2f13('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2f13('0x18')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x2f13('0x5')](0x3)[_0x2f13('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f13('0x19')},'dialDropMaxRetry':{'type':Sequelize[_0x2f13('0x5')](0x3)[_0x2f13('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f13('0x1a')},'dialDropRetryFrequency':{'type':Sequelize[_0x2f13('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2f13('0x5')](0x3)[_0x2f13('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2f13('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x2f13('0x5')](0x3)[_0x2f13('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f13('0x1b')},'dialMachineRetryFrequency':{'type':Sequelize[_0x2f13('0x5')](0x5)[_0x2f13('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f13('0x1c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x2f13('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2f13('0x1d')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2f13('0x1e')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 05f1cdb..6945ab6 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 _0x8201=['apply','reject','then','get','UserProfileResource','error','stack','name','index','Campaign','fieldName','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','include','findAll','rows','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','clone','rawAttributes','find','omit','createdAt','userProfileId','update','getHoppers','findOne','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','insert','fromQuery','phone','scheduledAt','ContactId','updatedAt','select','field','NOW()','CmListId','toString','ListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','from','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','into','phone\x20NOT\x20IN\x20(?)','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','sequelize','push','all','removeLists','destroy','addBlackLists','spread','cm_hopper_black','removeBlackLists','eml-format','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json'];(function(_0x19246a,_0x2e1097){var _0x5c3fbb=function(_0x30a2e6){while(--_0x30a2e6){_0x19246a['push'](_0x19246a['shift']());}};_0x5c3fbb(++_0x2e1097);}(_0x8201,0x71));var _0x1820=function(_0x5a5059,_0x43b452){_0x5a5059=_0x5a5059-0x0;var _0x4ecb66=_0x8201[_0x5a5059];return _0x4ecb66;};'use strict';var emlformat=require(_0x1820('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1820('0x1'));var rp=require('request-promise');var moment=require(_0x1820('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1820('0x3'));var util=require(_0x1820('0x4'));var path=require('path');var sox=require(_0x1820('0x5'));var csv=require(_0x1820('0x6'));var ejs=require(_0x1820('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1820('0x8'));var squel=require(_0x1820('0x9'));var crypto=require('crypto');var jsforce=require(_0x1820('0xa'));var deskjs=require(_0x1820('0xb'));var toCsv=require(_0x1820('0x6'));var querystring=require(_0x1820('0xc'));var Papa=require(_0x1820('0xd'));var Redis=require(_0x1820('0xe'));var authService=require(_0x1820('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1820('0x10'));var logger=require(_0x1820('0x11'))(_0x1820('0x12'));var utils=require(_0x1820('0x13'));var config=require(_0x1820('0x14'));var licenseUtil=require(_0x1820('0x15'));var db=require(_0x1820('0x16'))['db'];function respondWithStatusCode(_0x4b5920,_0x4fd81d){_0x4fd81d=_0x4fd81d||0xcc;return function(_0x57b825){if(_0x57b825){return _0x4b5920[_0x1820('0x17')](_0x4fd81d);}return _0x4b5920['status'](_0x4fd81d)[_0x1820('0x18')]();};}function respondWithResult(_0x448fd9,_0x230223){_0x230223=_0x230223||0xc8;return function(_0x5317cf){if(_0x5317cf){return _0x448fd9[_0x1820('0x19')](_0x230223)['json'](_0x5317cf);}};}function respondWithFilteredResult(_0x467d22,_0x28eef6){return function(_0x327479){if(_0x327479){var _0x20eb5e=typeof _0x28eef6['offset']===_0x1820('0x1a')&&typeof _0x28eef6[_0x1820('0x1b')]==='undefined';var _0xa2378e=_0x327479[_0x1820('0x1c')];var _0x2d12a4=_0x20eb5e?0x0:_0x28eef6[_0x1820('0x1d')];var _0x4ed267=_0x20eb5e?_0x327479[_0x1820('0x1c')]:_0x28eef6[_0x1820('0x1d')]+_0x28eef6[_0x1820('0x1b')];var _0x2f240f;if(_0x4ed267>=_0xa2378e){_0x4ed267=_0xa2378e;_0x2f240f=0xc8;}else{_0x2f240f=0xce;}_0x467d22[_0x1820('0x19')](_0x2f240f);return _0x467d22[_0x1820('0x1e')](_0x1820('0x1f'),_0x2d12a4+'-'+_0x4ed267+'/'+_0xa2378e)[_0x1820('0x20')](_0x327479);}return null;};}function patchUpdates(_0x56a36a){return function(_0x14603d){try{jsonpatch[_0x1820('0x21')](_0x14603d,_0x56a36a,!![]);}catch(_0x22ec43){return BPromise[_0x1820('0x22')](_0x22ec43);}return _0x14603d['save']();};}function saveUpdates(_0x50db2b,_0x3dcdbb){return function(_0x3702ea){if(_0x3702ea){return _0x3702ea['update'](_0x50db2b)[_0x1820('0x23')](function(_0x2840b4){return _0x2840b4;});}return null;};}function removeEntity(_0x3c00d3,_0xc7145b){return function(_0x2d9074){if(_0x2d9074){return _0x2d9074['destroy']()['then'](function(){var _0x4c93d4=_0x2d9074[_0x1820('0x24')]({'plain':!![]});var _0x55badd='IvrCampaigns';return db[_0x1820('0x25')]['destroy']({'where':{'type':_0x55badd,'resourceId':_0x4c93d4['id']}})['then'](function(){return _0x2d9074;});})[_0x1820('0x23')](function(){_0x3c00d3[_0x1820('0x19')](0xcc)[_0x1820('0x18')]();});}};}function handleEntityNotFound(_0x486b99,_0x4b7009){return function(_0x4f3f6e){if(!_0x4f3f6e){_0x486b99['sendStatus'](0x194);}return _0x4f3f6e;};}function handleError(_0x22eb1a,_0x5e0581){_0x5e0581=_0x5e0581||0x1f4;return function(_0x4161b8){logger[_0x1820('0x26')](_0x4161b8[_0x1820('0x27')]);if(_0x4161b8[_0x1820('0x28')]){delete _0x4161b8[_0x1820('0x28')];}_0x22eb1a[_0x1820('0x19')](_0x5e0581)['send'](_0x4161b8);};}exports[_0x1820('0x29')]=function(_0x2b8209,_0x122c64){var _0x4f7200={},_0x41c673={},_0x4fa1e7={'count':0x0,'rows':[]};var _0x333880=_['map'](db[_0x1820('0x2a')]['rawAttributes'],function(_0x459a46){return{'name':_0x459a46[_0x1820('0x2b')],'type':_0x459a46['type'][_0x1820('0x2c')]};});_0x41c673['model']=_[_0x1820('0x2d')](_0x333880,'name');_0x41c673[_0x1820('0x2e')]=_[_0x1820('0x2f')](_0x2b8209[_0x1820('0x2e')]);_0x41c673[_0x1820('0x30')]=_['intersection'](_0x41c673[_0x1820('0x31')],_0x41c673['query']);_0x4f7200[_0x1820('0x32')]=_[_0x1820('0x33')](_0x41c673[_0x1820('0x31')],qs['fields'](_0x2b8209[_0x1820('0x2e')][_0x1820('0x34')]));_0x4f7200[_0x1820('0x32')]=_0x4f7200['attributes'][_0x1820('0x35')]?_0x4f7200[_0x1820('0x32')]:_0x41c673['model'];if(!_0x2b8209['query'][_0x1820('0x36')](_0x1820('0x37'))){_0x4f7200[_0x1820('0x1b')]=qs[_0x1820('0x1b')](_0x2b8209['query'][_0x1820('0x1b')]);_0x4f7200[_0x1820('0x1d')]=qs[_0x1820('0x1d')](_0x2b8209[_0x1820('0x2e')][_0x1820('0x1d')]);}_0x4f7200[_0x1820('0x38')]=qs[_0x1820('0x39')](_0x2b8209['query'][_0x1820('0x39')]);_0x4f7200[_0x1820('0x3a')]=qs[_0x1820('0x30')](_[_0x1820('0x3b')](_0x2b8209['query'],_0x41c673[_0x1820('0x30')]),_0x333880);if(_0x2b8209[_0x1820('0x2e')]['filter']){_0x4f7200[_0x1820('0x3a')]=_['merge'](_0x4f7200['where'],{'$or':_['map'](_0x333880,function(_0x53047b){if(_0x53047b[_0x1820('0x3c')]!==_0x1820('0x3d')){var _0x5ab38f={};_0x5ab38f[_0x53047b[_0x1820('0x28')]]={'$like':'%'+_0x2b8209[_0x1820('0x2e')][_0x1820('0x3e')]+'%'};return _0x5ab38f;}})});}_0x4f7200=_[_0x1820('0x3f')]({},_0x4f7200,_0x2b8209['options']);var _0x53c0b2={'where':_0x4f7200[_0x1820('0x3a')]};return db[_0x1820('0x2a')][_0x1820('0x1c')](_0x53c0b2)[_0x1820('0x23')](function(_0x3bf571){_0x4fa1e7[_0x1820('0x1c')]=_0x3bf571;if(_0x2b8209[_0x1820('0x2e')]['includeAll']){_0x4f7200[_0x1820('0x40')]=[{'all':!![]}];}return db[_0x1820('0x2a')][_0x1820('0x41')](_0x4f7200);})[_0x1820('0x23')](function(_0x5727ae){_0x4fa1e7[_0x1820('0x42')]=_0x5727ae;return _0x4fa1e7;})[_0x1820('0x23')](respondWithFilteredResult(_0x122c64,_0x4f7200))[_0x1820('0x43')](handleError(_0x122c64,null));};exports[_0x1820('0x44')]=function(_0x1f96c7,_0x225f2c){var _0xda5042={'raw':![],'where':{'id':_0x1f96c7[_0x1820('0x45')]['id']}},_0x2db8ea={};_0x2db8ea['model']=_[_0x1820('0x2f')](db[_0x1820('0x2a')]['rawAttributes']);_0x2db8ea[_0x1820('0x2e')]=_[_0x1820('0x2f')](_0x1f96c7[_0x1820('0x2e')]);_0x2db8ea[_0x1820('0x30')]=_[_0x1820('0x33')](_0x2db8ea[_0x1820('0x31')],_0x2db8ea[_0x1820('0x2e')]);_0xda5042[_0x1820('0x32')]=_[_0x1820('0x33')](_0x2db8ea['model'],qs[_0x1820('0x34')](_0x1f96c7[_0x1820('0x2e')][_0x1820('0x34')]));_0xda5042['attributes']=_0xda5042[_0x1820('0x32')][_0x1820('0x35')]?_0xda5042[_0x1820('0x32')]:_0x2db8ea['model'];if(_0x1f96c7['query'][_0x1820('0x46')]){_0xda5042[_0x1820('0x40')]=[{'all':!![]}];}_0xda5042=_[_0x1820('0x3f')]({},_0xda5042,_0x1f96c7[_0x1820('0x47')]);return db['Campaign']['find'](_0xda5042)[_0x1820('0x23')](handleEntityNotFound(_0x225f2c,null))['then'](respondWithResult(_0x225f2c,null))[_0x1820('0x43')](handleError(_0x225f2c,null));};exports[_0x1820('0x48')]=function(_0x47812b,_0x2d2471){return db['Campaign'][_0x1820('0x48')](_0x47812b[_0x1820('0x49')],{})[_0x1820('0x23')](function(_0x38b1d6){var _0x1dba08=_0x47812b[_0x1820('0x4a')][_0x1820('0x24')]({'plain':!![]});if(!_0x1dba08)throw new Error(_0x1820('0x4b'));if(_0x1dba08[_0x1820('0x4c')]===_0x1820('0x4a')){var _0x422dcc=_0x38b1d6[_0x1820('0x24')]({'plain':!![]});var _0x1f3cbc='IvrCampaigns';return db[_0x1820('0x4d')]['find']({'where':{'name':_0x1f3cbc,'userProfileId':_0x1dba08['userProfileId']},'raw':!![]})[_0x1820('0x23')](function(_0x10ed66){if(_0x10ed66&&_0x10ed66[_0x1820('0x4e')]===0x0){return db[_0x1820('0x25')][_0x1820('0x48')]({'name':_0x422dcc[_0x1820('0x28')],'resourceId':_0x422dcc['id'],'type':_0x10ed66[_0x1820('0x28')],'sectionId':_0x10ed66['id']},{})[_0x1820('0x23')](function(){return _0x38b1d6;});}else{return _0x38b1d6;}})[_0x1820('0x43')](function(_0x1f7521){logger[_0x1820('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f7521);throw _0x1f7521;});}return _0x38b1d6;})[_0x1820('0x23')](respondWithResult(_0x2d2471,0xc9))[_0x1820('0x43')](handleError(_0x2d2471,null));};exports[_0x1820('0x4f')]=function(_0xcf77d5,_0x46413a){var _0x14f5b8={'where':{'id':_0xcf77d5['params']['id']}},_0x171f5d={};_0x171f5d[_0x1820('0x31')]=_[_0x1820('0x2f')](db[_0x1820('0x2a')][_0x1820('0x50')]);_0x14f5b8[_0x1820('0x32')]=_[_0x1820('0x33')](_0x171f5d[_0x1820('0x31')],qs[_0x1820('0x34')](_0xcf77d5[_0x1820('0x2e')][_0x1820('0x34')]));_0x14f5b8[_0x1820('0x32')]=_0x14f5b8[_0x1820('0x32')][_0x1820('0x35')]?_0x14f5b8['attributes']:_0x171f5d[_0x1820('0x31')];if(_0xcf77d5[_0x1820('0x2e')][_0x1820('0x46')]){_0x14f5b8[_0x1820('0x40')]=[{'all':!![]}];}_0x14f5b8=_['merge']({},_0x14f5b8,_0xcf77d5[_0x1820('0x47')]);return db['Campaign'][_0x1820('0x51')](_0x14f5b8)[_0x1820('0x23')](handleEntityNotFound(_0x46413a,null))[_0x1820('0x23')](function(_0x3ab55b){if(_0x3ab55b){var _0x494425=_0x3ab55b[_0x1820('0x24')]({'plain':!![]});_0x494425=qs[_0x1820('0x52')](_0x494425,['id',_0x1820('0x53'),'updatedAt']);_0xcf77d5[_0x1820('0x49')]=_[_0x1820('0x52')](_0xcf77d5[_0x1820('0x49')],['id',_0x1820('0x53'),'updatedAt']);return db[_0x1820('0x2a')][_0x1820('0x48')](_['merge'](_0x494425,_0xcf77d5[_0x1820('0x49')]),{'include':_0xcf77d5[_0x1820('0x2e')][_0x1820('0x46')]?[{'all':!![]}]:undefined})['then'](function(_0x3d32d8){var _0x5aa1d9=_0xcf77d5['user'][_0x1820('0x24')]({'plain':!![]});if(!_0x5aa1d9)throw new Error(_0x1820('0x4b'));if(_0x5aa1d9[_0x1820('0x4c')]==='user'){var _0x1d5aa4=_0x3d32d8[_0x1820('0x24')]({'plain':!![]});var _0x5db294='IvrCampaigns';return db[_0x1820('0x4d')]['find']({'where':{'name':_0x5db294,'userProfileId':_0x5aa1d9[_0x1820('0x54')]},'raw':!![]})[_0x1820('0x23')](function(_0x4106ab){if(_0x4106ab&&_0x4106ab[_0x1820('0x4e')]===0x0){return db[_0x1820('0x25')][_0x1820('0x48')]({'name':_0x1d5aa4[_0x1820('0x28')],'resourceId':_0x1d5aa4['id'],'type':_0x4106ab[_0x1820('0x28')],'sectionId':_0x4106ab['id']},{})[_0x1820('0x23')](function(){return _0x3d32d8;});}else{return _0x3d32d8;}})[_0x1820('0x43')](function(_0x48a651){logger[_0x1820('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48a651);throw _0x48a651;});}return _0x3d32d8;});}})['then'](respondWithResult(_0x46413a,0xc9))['catch'](handleError(_0x46413a,null));};exports[_0x1820('0x55')]=function(_0x4b76cd,_0x1a3440){if(_0x4b76cd[_0x1820('0x49')]['id']){delete _0x4b76cd[_0x1820('0x49')]['id'];}return db[_0x1820('0x2a')]['find']({'where':{'id':_0x4b76cd[_0x1820('0x45')]['id']}})['then'](handleEntityNotFound(_0x1a3440,null))[_0x1820('0x23')](saveUpdates(_0x4b76cd[_0x1820('0x49')],null))[_0x1820('0x23')](respondWithResult(_0x1a3440,null))[_0x1820('0x43')](handleError(_0x1a3440,null));};exports['destroy']=function(_0x402203,_0x5244fa){return db[_0x1820('0x2a')][_0x1820('0x51')]({'where':{'id':_0x402203[_0x1820('0x45')]['id']}})['then'](handleEntityNotFound(_0x5244fa,null))['then'](removeEntity(_0x5244fa,null))['catch'](handleError(_0x5244fa,null));};exports[_0x1820('0x56')]=function(_0x51502c,_0x3f71c3,_0xa6a099){var _0x493ec5={'raw':!![],'where':{}};var _0x379e95={};var _0x42a765={'count':0x0,'rows':[]};return db['Campaign'][_0x1820('0x57')]({'where':{'id':_0x51502c[_0x1820('0x45')]['id']}})['then'](handleEntityNotFound(_0x3f71c3,null))[_0x1820('0x23')](function(_0x3e4c85){if(_0x3e4c85){_0x379e95[_0x1820('0x31')]=_[_0x1820('0x2f')](db['CmHopper']['rawAttributes']);_0x379e95['query']=_[_0x1820('0x2f')](_0x51502c[_0x1820('0x2e')]);_0x379e95[_0x1820('0x30')]=_['intersection'](_0x379e95[_0x1820('0x31')],_0x379e95[_0x1820('0x2e')]);_0x493ec5[_0x1820('0x32')]=_[_0x1820('0x33')](_0x379e95[_0x1820('0x31')],qs['fields'](_0x51502c[_0x1820('0x2e')][_0x1820('0x34')]));_0x493ec5[_0x1820('0x32')]=_0x493ec5[_0x1820('0x32')][_0x1820('0x35')]?_0x493ec5[_0x1820('0x32')]:_0x379e95[_0x1820('0x31')];if(!_0x51502c[_0x1820('0x2e')]['hasOwnProperty'](_0x1820('0x37'))){_0x493ec5[_0x1820('0x1b')]=qs[_0x1820('0x1b')](_0x51502c[_0x1820('0x2e')][_0x1820('0x1b')]);_0x493ec5['offset']=qs[_0x1820('0x1d')](_0x51502c[_0x1820('0x2e')][_0x1820('0x1d')]);}_0x493ec5[_0x1820('0x38')]=qs[_0x1820('0x39')](_0x51502c[_0x1820('0x2e')][_0x1820('0x39')]);_0x493ec5[_0x1820('0x3a')]=qs[_0x1820('0x30')](_[_0x1820('0x3b')](_0x51502c[_0x1820('0x2e')],_0x379e95[_0x1820('0x30')]));_0x493ec5['where'][_0x1820('0x58')]=_0x3e4c85['id'];if(_0x51502c[_0x1820('0x2e')][_0x1820('0x3e')]){_0x493ec5[_0x1820('0x3a')]=_[_0x1820('0x3f')](_0x493ec5[_0x1820('0x3a')],{'$or':_[_0x1820('0x2d')](_0x493ec5['attributes'],function(_0x357cab){var _0x47492f={};_0x47492f[_0x357cab]={'$like':'%'+_0x51502c[_0x1820('0x2e')]['filter']+'%'};return _0x47492f;})});}_0x493ec5=_[_0x1820('0x3f')]({},_0x493ec5,_0x51502c[_0x1820('0x47')]);return db[_0x1820('0x59')]['count']({'where':_0x493ec5[_0x1820('0x3a')]})['then'](function(_0x275a18){_0x42a765[_0x1820('0x1c')]=_0x275a18;if(_0x51502c[_0x1820('0x2e')]['includeAll']){_0x493ec5[_0x1820('0x40')]=[{'all':!![]}];}return db[_0x1820('0x59')][_0x1820('0x41')](_0x493ec5);})[_0x1820('0x23')](function(_0x38e903){_0x42a765[_0x1820('0x42')]=_0x38e903;return _0x42a765;});}})[_0x1820('0x23')](respondWithFilteredResult(_0x3f71c3,_0x493ec5))[_0x1820('0x43')](handleError(_0x3f71c3,null));};exports[_0x1820('0x5a')]=function(_0x2d2a54,_0x2fb989,_0x2841b0){var _0x16f0d1={'raw':!![],'where':{}};var _0x21e769={};var _0x274ad6={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x2d2a54['params']['id']}})[_0x1820('0x23')](handleEntityNotFound(_0x2fb989,null))[_0x1820('0x23')](function(_0x5ef58a){if(_0x5ef58a){_0x21e769[_0x1820('0x31')]=_[_0x1820('0x2f')](db[_0x1820('0x5b')][_0x1820('0x50')]);_0x21e769[_0x1820('0x2e')]=_[_0x1820('0x2f')](_0x2d2a54[_0x1820('0x2e')]);_0x21e769['filters']=_['intersection'](_0x21e769[_0x1820('0x31')],_0x21e769[_0x1820('0x2e')]);_0x16f0d1[_0x1820('0x32')]=_['intersection'](_0x21e769['model'],qs[_0x1820('0x34')](_0x2d2a54[_0x1820('0x2e')]['fields']));_0x16f0d1[_0x1820('0x32')]=_0x16f0d1[_0x1820('0x32')]['length']?_0x16f0d1[_0x1820('0x32')]:_0x21e769['model'];if(!_0x2d2a54[_0x1820('0x2e')][_0x1820('0x36')](_0x1820('0x37'))){_0x16f0d1[_0x1820('0x1b')]=qs['limit'](_0x2d2a54[_0x1820('0x2e')]['limit']);_0x16f0d1[_0x1820('0x1d')]=qs[_0x1820('0x1d')](_0x2d2a54[_0x1820('0x2e')]['offset']);}_0x16f0d1[_0x1820('0x38')]=qs[_0x1820('0x39')](_0x2d2a54[_0x1820('0x2e')][_0x1820('0x39')]);_0x16f0d1[_0x1820('0x3a')]=qs[_0x1820('0x30')](_['pick'](_0x2d2a54[_0x1820('0x2e')],_0x21e769['filters']));_0x16f0d1[_0x1820('0x3a')][_0x1820('0x58')]=_0x5ef58a['id'];if(_0x2d2a54['query'][_0x1820('0x3e')]){_0x16f0d1['where']=_[_0x1820('0x3f')](_0x16f0d1[_0x1820('0x3a')],{'$or':_[_0x1820('0x2d')](_0x16f0d1[_0x1820('0x32')],function(_0x28360d){var _0x12ca2a={};_0x12ca2a[_0x28360d]={'$like':'%'+_0x2d2a54[_0x1820('0x2e')]['filter']+'%'};return _0x12ca2a;})});}_0x16f0d1=_[_0x1820('0x3f')]({},_0x16f0d1,_0x2d2a54['options']);return db[_0x1820('0x5b')][_0x1820('0x1c')]({'where':_0x16f0d1[_0x1820('0x3a')]})['then'](function(_0x1ee503){_0x274ad6['count']=_0x1ee503;if(_0x2d2a54['query'][_0x1820('0x46')]){_0x16f0d1['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x1820('0x41')](_0x16f0d1);})[_0x1820('0x23')](function(_0x3e41b7){_0x274ad6[_0x1820('0x42')]=_0x3e41b7;return _0x274ad6;});}})['then'](respondWithFilteredResult(_0x2fb989,_0x16f0d1))['catch'](handleError(_0x2fb989,null));};exports[_0x1820('0x5c')]=function(_0x2ef0d0,_0x2402e6,_0x24c71c){var _0x54349e={'raw':!![],'where':{}};var _0x1396b5={};var _0x1d23bd={'count':0x0,'rows':[]};return db[_0x1820('0x2a')][_0x1820('0x57')]({'where':{'id':_0x2ef0d0[_0x1820('0x45')]['id']}})[_0x1820('0x23')](handleEntityNotFound(_0x2402e6,null))['then'](function(_0x1b286c){if(_0x1b286c){_0x1396b5[_0x1820('0x31')]=_[_0x1820('0x2f')](db[_0x1820('0x5d')][_0x1820('0x50')]);_0x1396b5[_0x1820('0x2e')]=_[_0x1820('0x2f')](_0x2ef0d0['query']);_0x1396b5['filters']=_[_0x1820('0x33')](_0x1396b5['model'],_0x1396b5[_0x1820('0x2e')]);_0x54349e[_0x1820('0x32')]=_[_0x1820('0x33')](_0x1396b5[_0x1820('0x31')],qs[_0x1820('0x34')](_0x2ef0d0[_0x1820('0x2e')][_0x1820('0x34')]));_0x54349e[_0x1820('0x32')]=_0x54349e[_0x1820('0x32')][_0x1820('0x35')]?_0x54349e[_0x1820('0x32')]:_0x1396b5[_0x1820('0x31')];if(!_0x2ef0d0['query'][_0x1820('0x36')](_0x1820('0x37'))){_0x54349e[_0x1820('0x1b')]=qs[_0x1820('0x1b')](_0x2ef0d0[_0x1820('0x2e')][_0x1820('0x1b')]);_0x54349e[_0x1820('0x1d')]=qs[_0x1820('0x1d')](_0x2ef0d0['query'][_0x1820('0x1d')]);}_0x54349e[_0x1820('0x38')]=qs['sort'](_0x2ef0d0[_0x1820('0x2e')][_0x1820('0x39')]);_0x54349e['where']=qs['filters'](_[_0x1820('0x3b')](_0x2ef0d0[_0x1820('0x2e')],_0x1396b5[_0x1820('0x30')]));_0x54349e[_0x1820('0x3a')][_0x1820('0x58')]=_0x1b286c['id'];if(_0x2ef0d0['query'][_0x1820('0x3e')]){_0x54349e[_0x1820('0x3a')]=_[_0x1820('0x3f')](_0x54349e['where'],{'$or':_[_0x1820('0x2d')](_0x54349e[_0x1820('0x32')],function(_0x24bc41){var _0x3503d3={};_0x3503d3[_0x24bc41]={'$like':'%'+_0x2ef0d0[_0x1820('0x2e')]['filter']+'%'};return _0x3503d3;})});}_0x54349e=_[_0x1820('0x3f')]({},_0x54349e,_0x2ef0d0[_0x1820('0x47')]);return db[_0x1820('0x5d')][_0x1820('0x1c')]({'where':_0x54349e[_0x1820('0x3a')]})[_0x1820('0x23')](function(_0x1e7a7c){_0x1d23bd[_0x1820('0x1c')]=_0x1e7a7c;if(_0x2ef0d0[_0x1820('0x2e')]['includeAll']){_0x54349e[_0x1820('0x40')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x1820('0x41')](_0x54349e);})['then'](function(_0x1885a3){_0x1d23bd[_0x1820('0x42')]=_0x1885a3;return _0x1d23bd;});}})[_0x1820('0x23')](respondWithFilteredResult(_0x2402e6,_0x54349e))[_0x1820('0x43')](handleError(_0x2402e6,null));};exports[_0x1820('0x5e')]=function(_0x1de4b8,_0x16ed33,_0x2b70ab){var _0x133e39={'raw':!![],'where':{}};var _0x4cff9d={};var _0x9fc743={'count':0x0,'rows':[]};return db['Campaign'][_0x1820('0x57')]({'where':{'id':_0x1de4b8[_0x1820('0x45')]['id']}})[_0x1820('0x23')](handleEntityNotFound(_0x16ed33,null))[_0x1820('0x23')](function(_0x5493bb){if(_0x5493bb){_0x4cff9d[_0x1820('0x31')]=_[_0x1820('0x2f')](db[_0x1820('0x5f')][_0x1820('0x50')]);_0x4cff9d[_0x1820('0x2e')]=_[_0x1820('0x2f')](_0x1de4b8['query']);_0x4cff9d[_0x1820('0x30')]=_[_0x1820('0x33')](_0x4cff9d[_0x1820('0x31')],_0x4cff9d[_0x1820('0x2e')]);_0x133e39[_0x1820('0x32')]=_[_0x1820('0x33')](_0x4cff9d['model'],qs[_0x1820('0x34')](_0x1de4b8[_0x1820('0x2e')][_0x1820('0x34')]));_0x133e39[_0x1820('0x32')]=_0x133e39[_0x1820('0x32')][_0x1820('0x35')]?_0x133e39[_0x1820('0x32')]:_0x4cff9d['model'];if(!_0x1de4b8[_0x1820('0x2e')][_0x1820('0x36')](_0x1820('0x37'))){_0x133e39['limit']=qs[_0x1820('0x1b')](_0x1de4b8[_0x1820('0x2e')][_0x1820('0x1b')]);_0x133e39[_0x1820('0x1d')]=qs[_0x1820('0x1d')](_0x1de4b8[_0x1820('0x2e')][_0x1820('0x1d')]);}_0x133e39['order']=qs[_0x1820('0x39')](_0x1de4b8['query'][_0x1820('0x39')]);_0x133e39[_0x1820('0x3a')]=qs[_0x1820('0x30')](_[_0x1820('0x3b')](_0x1de4b8[_0x1820('0x2e')],_0x4cff9d[_0x1820('0x30')]));_0x133e39['where'][_0x1820('0x58')]=_0x5493bb['id'];if(_0x1de4b8[_0x1820('0x2e')][_0x1820('0x3e')]){_0x133e39[_0x1820('0x3a')]=_['merge'](_0x133e39[_0x1820('0x3a')],{'$or':_[_0x1820('0x2d')](_0x133e39['attributes'],function(_0x100c93){var _0x693d6f={};_0x693d6f[_0x100c93]={'$like':'%'+_0x1de4b8[_0x1820('0x2e')][_0x1820('0x3e')]+'%'};return _0x693d6f;})});}_0x133e39=_[_0x1820('0x3f')]({},_0x133e39,_0x1de4b8['options']);return db['CmHopperBlack']['count']({'where':_0x133e39['where']})[_0x1820('0x23')](function(_0x4d4993){_0x9fc743['count']=_0x4d4993;if(_0x1de4b8[_0x1820('0x2e')]['includeAll']){_0x133e39[_0x1820('0x40')]=[{'all':!![]}];}return db[_0x1820('0x5f')][_0x1820('0x41')](_0x133e39);})[_0x1820('0x23')](function(_0xfe47e5){_0x9fc743['rows']=_0xfe47e5;return _0x9fc743;});}})[_0x1820('0x23')](respondWithFilteredResult(_0x16ed33,_0x133e39))[_0x1820('0x43')](handleError(_0x16ed33,null));};exports[_0x1820('0x60')]=function(_0x50352a,_0x1f629d,_0x2ad9eb){var _0x4c981d={};var _0x530ef5={};var _0x12384f;var _0x49cbed;return db[_0x1820('0x2a')][_0x1820('0x57')]({'where':{'id':_0x50352a[_0x1820('0x45')]['id']}})[_0x1820('0x23')](handleEntityNotFound(_0x1f629d,null))[_0x1820('0x23')](function(_0x109479){if(_0x109479){_0x12384f=_0x109479;_0x530ef5[_0x1820('0x31')]=_[_0x1820('0x2f')](db[_0x1820('0x61')][_0x1820('0x50')]);_0x530ef5[_0x1820('0x2e')]=_[_0x1820('0x2f')](_0x50352a['query']);_0x530ef5['filters']=_['intersection'](_0x530ef5[_0x1820('0x31')],_0x530ef5[_0x1820('0x2e')]);_0x4c981d[_0x1820('0x32')]=_[_0x1820('0x33')](_0x530ef5['model'],qs[_0x1820('0x34')](_0x50352a['query'][_0x1820('0x34')]));_0x4c981d[_0x1820('0x32')]=_0x4c981d[_0x1820('0x32')][_0x1820('0x35')]?_0x4c981d['attributes']:_0x530ef5['model'];_0x4c981d[_0x1820('0x38')]=qs['sort'](_0x50352a[_0x1820('0x2e')][_0x1820('0x39')]);_0x4c981d[_0x1820('0x3a')]=qs[_0x1820('0x30')](_['pick'](_0x50352a[_0x1820('0x2e')],_0x530ef5[_0x1820('0x30')]));if(_0x50352a[_0x1820('0x2e')][_0x1820('0x3e')]){_0x4c981d['where']=_['merge'](_0x4c981d['where'],{'$or':_[_0x1820('0x2d')](_0x4c981d[_0x1820('0x32')],function(_0x477bc9){var _0x15dbdb={};_0x15dbdb[_0x477bc9]={'$like':'%'+_0x50352a[_0x1820('0x2e')][_0x1820('0x3e')]+'%'};return _0x15dbdb;})});}_0x4c981d=_[_0x1820('0x3f')]({},_0x4c981d,_0x50352a[_0x1820('0x47')]);return _0x12384f[_0x1820('0x60')](_0x4c981d);}})[_0x1820('0x23')](function(_0x58a9a9){if(_0x58a9a9){_0x49cbed=_0x58a9a9[_0x1820('0x35')];if(!_0x50352a[_0x1820('0x2e')][_0x1820('0x36')]('nolimit')){_0x4c981d[_0x1820('0x1b')]=qs[_0x1820('0x1b')](_0x50352a[_0x1820('0x2e')][_0x1820('0x1b')]);_0x4c981d[_0x1820('0x1d')]=qs[_0x1820('0x1d')](_0x50352a[_0x1820('0x2e')][_0x1820('0x1d')]);}return _0x12384f['getLists'](_0x4c981d);}})[_0x1820('0x23')](function(_0x237a44){if(_0x237a44){return _0x237a44?{'count':_0x49cbed,'rows':_0x237a44}:null;}})[_0x1820('0x23')](respondWithResult(_0x1f629d,null))[_0x1820('0x43')](handleError(_0x1f629d,null));};exports[_0x1820('0x62')]=function(_0x137917,_0x3f126b,_0x230128){var _0x4b18e9,_0xcd303c;var _0x5ec9cb=[];var _0x4c061f=moment()[_0x1820('0x63')](_0x1820('0x64'));return db[_0x1820('0x2a')][_0x1820('0x51')]({'where':{'id':_0x137917[_0x1820('0x45')]['id']}})[_0x1820('0x23')](handleEntityNotFound(_0x3f126b,null))['then'](function(_0x19d23d){if(_0x19d23d){_0xcd303c=_0x19d23d;return _0x19d23d[_0x1820('0x62')](_0x137917[_0x1820('0x49')][_0x1820('0x65')],_['omit'](_0x137917[_0x1820('0x49')],[_0x1820('0x65'),'id'])||{});}return null;})['spread'](function(_0x17c5bc){var _0x1974f9;var _0x5da347;_0x4b18e9=_0x17c5bc||[];var _0x388e0b=[];if(_0x17c5bc){for(var _0x5807de=0x0;_0x5807de<_0x17c5bc[_0x1820('0x35')];_0x5807de+=0x1){var _0x4a4910=_0x17c5bc[_0x5807de][_0x1820('0x24')]({'plain':!![]});_0xcd303c[_0x1820('0x66')]=_0x137917[_0x1820('0x49')][_0x1820('0x66')]?_0x137917['body'][_0x1820('0x66')]:_0xcd303c['dialCheckDuplicateType'];switch(_0xcd303c['dialCheckDuplicateType']){case _0x1820('0x67'):_0x1974f9=squel[_0x1820('0x68')]()['into']('cm_hopper')[_0x1820('0x69')]([_0x1820('0x6a'),_0x1820('0x6b'),_0x1820('0x6c'),'ListId',_0x1820('0x58'),_0x1820('0x53'),_0x1820('0x6d')],squel[_0x1820('0x6e')]()[_0x1820('0x6f')](_0x1820('0x6a'),_0x1820('0x6a'))[_0x1820('0x6f')](_0x1820('0x70'),_0x1820('0x6b'))['field']('id',_0x1820('0x6c'))[_0x1820('0x6f')](_0x4a4910[_0x1820('0x71')][_0x1820('0x72')](),_0x1820('0x73'))[_0x1820('0x6f')](_0x137917['params']['id'][_0x1820('0x72')](),'CampaignId')[_0x1820('0x6f')]('\x27'+_0x4c061f+'\x27',_0x1820('0x53'))['field']('\x27'+_0x4c061f+'\x27',_0x1820('0x6d'))['from'](_0x1820('0x74'))[_0x1820('0x3a')](_0x1820('0x75'))[_0x1820('0x3a')](_0x1820('0x76'),_0x4a4910[_0x1820('0x71')]['toString']())[_0x1820('0x3a')](_0x1820('0x77'))[_0x1820('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1820('0x6e')]()[_0x1820('0x6f')]('COALESCE(calleridnum,\x27\x27)')[_0x1820('0x78')](_0x1820('0x79'))[_0x1820('0x3a')](_0x1820('0x7a'),_0x137917[_0x1820('0x45')]['id'][_0x1820('0x72')]()))[_0x1820('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x1820('0x6f')](_0x1820('0x7b'))['from'](_0x1820('0x7c'))[_0x1820('0x3a')](_0x1820('0x7a'),_0x137917[_0x1820('0x45')]['id'][_0x1820('0x72')]())))[_0x1820('0x72')]();break;case _0x1820('0x7d'):_0x1974f9=squel['insert']()[_0x1820('0x7e')]('cm_hopper')['fromQuery']([_0x1820('0x6a'),_0x1820('0x6b'),_0x1820('0x6c'),_0x1820('0x73'),_0x1820('0x58'),_0x1820('0x53'),_0x1820('0x6d')],squel['select']()[_0x1820('0x6f')](_0x1820('0x6a'),_0x1820('0x6a'))[_0x1820('0x6f')](_0x1820('0x70'),_0x1820('0x6b'))[_0x1820('0x6f')]('id',_0x1820('0x6c'))[_0x1820('0x6f')](_0x4a4910[_0x1820('0x71')]['toString'](),_0x1820('0x73'))['field'](_0x137917['params']['id'][_0x1820('0x72')](),_0x1820('0x58'))['field']('\x27'+_0x4c061f+'\x27','createdAt')['field']('\x27'+_0x4c061f+'\x27',_0x1820('0x6d'))[_0x1820('0x78')](_0x1820('0x74'))[_0x1820('0x3a')]('deletedAt\x20IS\x20NULL')[_0x1820('0x3a')](_0x1820('0x76'),_0x4a4910[_0x1820('0x71')]['toString']())[_0x1820('0x3a')](_0x1820('0x77'))[_0x1820('0x3a')](_0x1820('0x7f'),squel[_0x1820('0x6e')]()[_0x1820('0x6f')](_0x1820('0x7b'))[_0x1820('0x78')](_0x1820('0x7c'))[_0x1820('0x3a')](_0x1820('0x7a'),_0x137917[_0x1820('0x45')]['id']['toString']())))[_0x1820('0x72')]();break;default:_0x1974f9=squel[_0x1820('0x68')]()['into'](_0x1820('0x7c'))[_0x1820('0x69')]([_0x1820('0x6a'),'scheduledAt',_0x1820('0x6c'),_0x1820('0x73'),_0x1820('0x58'),_0x1820('0x53'),'updatedAt'],squel[_0x1820('0x6e')]()[_0x1820('0x6f')]('phone','phone')[_0x1820('0x6f')]('NOW()',_0x1820('0x6b'))[_0x1820('0x6f')]('id',_0x1820('0x6c'))['field'](_0x4a4910[_0x1820('0x71')]['toString'](),'ListId')['field'](_0x137917[_0x1820('0x45')]['id'][_0x1820('0x72')](),'CampaignId')['field']('\x27'+_0x4c061f+'\x27','createdAt')[_0x1820('0x6f')]('\x27'+_0x4c061f+'\x27','updatedAt')[_0x1820('0x78')](_0x1820('0x74'))[_0x1820('0x3a')](_0x1820('0x75'))['where'](_0x1820('0x76'),_0x4a4910['CmListId'][_0x1820('0x72')]())['where'](_0x1820('0x77')))[_0x1820('0x72')]();}_0x5da347=squel[_0x1820('0x68')]()[_0x1820('0x7e')]('cm_hopper_additional_phones')[_0x1820('0x69')]([_0x1820('0x80'),_0x1820('0x6b'),_0x1820('0x6a'),_0x1820('0x81'),_0x1820('0x53'),_0x1820('0x6d')],squel[_0x1820('0x6e')]()[_0x1820('0x6f')](_0x1820('0x82'),'id')[_0x1820('0x6f')]('NOW()',_0x1820('0x6b'))['field'](_0x1820('0x83'),_0x1820('0x6a'))[_0x1820('0x6f')](_0x1820('0x84'),_0x1820('0x81'))[_0x1820('0x6f')]('\x27'+_0x4c061f+'\x27',_0x1820('0x53'))[_0x1820('0x6f')]('\x27'+_0x4c061f+'\x27',_0x1820('0x6d'))[_0x1820('0x78')](_0x1820('0x85'),'ci')['join'](_0x1820('0x7c'),'h',_0x1820('0x86'))[_0x1820('0x3a')](_0x1820('0x87'),_0x4a4910[_0x1820('0x71')][_0x1820('0x72')]())[_0x1820('0x3a')](_0x1820('0x88'),_0x137917[_0x1820('0x45')]['id'][_0x1820('0x72')]())[_0x1820('0x3a')]('h.createdAt\x20=\x20?',_0x4c061f))[_0x1820('0x72')]();_0x388e0b['push'](db[_0x1820('0x89')][_0x1820('0x2e')](_0x1974f9));_0x5ec9cb[_0x1820('0x8a')](db['sequelize']['query'](_0x5da347));}return BPromise[_0x1820('0x8b')](_0x388e0b);}})[_0x1820('0x23')](function(){return BPromise[_0x1820('0x8b')](_0x5ec9cb);})[_0x1820('0x23')](function(){return _0x4b18e9;})[_0x1820('0x23')](respondWithResult(_0x3f126b,null))[_0x1820('0x43')](handleError(_0x3f126b,null));};exports[_0x1820('0x8c')]=function(_0x51d226,_0xad2a1a,_0x41e707){return db['Campaign'][_0x1820('0x51')]({'where':{'id':_0x51d226[_0x1820('0x45')]['id']}})[_0x1820('0x23')](handleEntityNotFound(_0xad2a1a,null))['then'](function(_0x274832){if(_0x274832){return _0x274832['removeLists'](_0x51d226[_0x1820('0x2e')][_0x1820('0x65')]);}})[_0x1820('0x23')](function(_0x17a2d6){if(_0x17a2d6){return db[_0x1820('0x59')][_0x1820('0x8d')]({'where':{'ListId':_0x51d226[_0x1820('0x2e')]['ids'],'CampaignId':_0x51d226[_0x1820('0x45')]['id']}})[_0x1820('0x23')](function(){return _0x17a2d6;});}})['then'](respondWithStatusCode(_0xad2a1a,null))['catch'](handleError(_0xad2a1a,null));};exports['getBlackLists']=function(_0x1e17a5,_0x54a59a,_0x3e9abd){var _0x479cc2={};var _0xa1c6af={};var _0x49ac7c;var _0x2d3bb1;return db[_0x1820('0x2a')][_0x1820('0x57')]({'where':{'id':_0x1e17a5['params']['id']}})['then'](handleEntityNotFound(_0x54a59a,null))['then'](function(_0x29fe94){if(_0x29fe94){_0x49ac7c=_0x29fe94;_0xa1c6af[_0x1820('0x31')]=_[_0x1820('0x2f')](db[_0x1820('0x61')][_0x1820('0x50')]);_0xa1c6af[_0x1820('0x2e')]=_[_0x1820('0x2f')](_0x1e17a5[_0x1820('0x2e')]);_0xa1c6af[_0x1820('0x30')]=_[_0x1820('0x33')](_0xa1c6af[_0x1820('0x31')],_0xa1c6af[_0x1820('0x2e')]);_0x479cc2['attributes']=_[_0x1820('0x33')](_0xa1c6af[_0x1820('0x31')],qs[_0x1820('0x34')](_0x1e17a5[_0x1820('0x2e')][_0x1820('0x34')]));_0x479cc2[_0x1820('0x32')]=_0x479cc2[_0x1820('0x32')]['length']?_0x479cc2[_0x1820('0x32')]:_0xa1c6af[_0x1820('0x31')];_0x479cc2[_0x1820('0x38')]=qs[_0x1820('0x39')](_0x1e17a5['query'][_0x1820('0x39')]);_0x479cc2[_0x1820('0x3a')]=qs[_0x1820('0x30')](_[_0x1820('0x3b')](_0x1e17a5[_0x1820('0x2e')],_0xa1c6af[_0x1820('0x30')]));if(_0x1e17a5[_0x1820('0x2e')][_0x1820('0x3e')]){_0x479cc2[_0x1820('0x3a')]=_[_0x1820('0x3f')](_0x479cc2[_0x1820('0x3a')],{'$or':_[_0x1820('0x2d')](_0x479cc2['attributes'],function(_0x2c93c7){var _0x334989={};_0x334989[_0x2c93c7]={'$like':'%'+_0x1e17a5[_0x1820('0x2e')][_0x1820('0x3e')]+'%'};return _0x334989;})});}_0x479cc2=_[_0x1820('0x3f')]({},_0x479cc2,_0x1e17a5[_0x1820('0x47')]);return _0x49ac7c['getBlackLists'](_0x479cc2);}})[_0x1820('0x23')](function(_0x5e4d6a){if(_0x5e4d6a){_0x2d3bb1=_0x5e4d6a[_0x1820('0x35')];if(!_0x1e17a5[_0x1820('0x2e')][_0x1820('0x36')](_0x1820('0x37'))){_0x479cc2[_0x1820('0x1b')]=qs[_0x1820('0x1b')](_0x1e17a5[_0x1820('0x2e')]['limit']);_0x479cc2[_0x1820('0x1d')]=qs[_0x1820('0x1d')](_0x1e17a5[_0x1820('0x2e')][_0x1820('0x1d')]);}return _0x49ac7c['getBlackLists'](_0x479cc2);}})[_0x1820('0x23')](function(_0x3606e7){if(_0x3606e7){return _0x3606e7?{'count':_0x2d3bb1,'rows':_0x3606e7}:null;}})['then'](respondWithResult(_0x54a59a,null))[_0x1820('0x43')](handleError(_0x54a59a,null));};exports[_0x1820('0x8e')]=function(_0x2b8a22,_0x44bc74,_0x10ccae){var _0x2dde93,_0x58e953;var _0x2fa718=[];var _0x78de8c=moment()[_0x1820('0x63')](_0x1820('0x64'));return db[_0x1820('0x2a')][_0x1820('0x51')]({'where':{'id':_0x2b8a22[_0x1820('0x45')]['id']}})[_0x1820('0x23')](handleEntityNotFound(_0x44bc74,null))[_0x1820('0x23')](function(_0x438ad4){if(_0x438ad4){_0x58e953=_0x438ad4;return _0x438ad4['addBlackLists'](_0x2b8a22['body']['ids'],_[_0x1820('0x52')](_0x2b8a22[_0x1820('0x49')],[_0x1820('0x65'),'id'])||{});}return null;})[_0x1820('0x8f')](function(_0x50b5a5){var _0x474d20;var _0x595a3a;_0x2dde93=_0x50b5a5||[];var _0x32da2c=[];if(_0x50b5a5){for(var _0x1e9ded=0x0;_0x1e9ded<_0x50b5a5['length'];_0x1e9ded+=0x1){var _0xc35898=_0x50b5a5[_0x1e9ded]['get']({'plain':!![]});_0x474d20=squel['insert']()[_0x1820('0x7e')](_0x1820('0x90'))[_0x1820('0x69')](['phone',_0x1820('0x6c'),_0x1820('0x73'),_0x1820('0x58'),'createdAt',_0x1820('0x6d')],squel[_0x1820('0x6e')]()['field'](_0x1820('0x6a'),'phone')[_0x1820('0x6f')]('id','ContactId')[_0x1820('0x6f')](_0xc35898[_0x1820('0x71')][_0x1820('0x72')](),_0x1820('0x73'))[_0x1820('0x6f')](_0x2b8a22[_0x1820('0x45')]['id']['toString'](),_0x1820('0x58'))[_0x1820('0x6f')](_0x1820('0x70'),_0x1820('0x53'))[_0x1820('0x6f')](_0x1820('0x70'),'updatedAt')[_0x1820('0x78')](_0x1820('0x74'))[_0x1820('0x3a')](_0x1820('0x75'))['where'](_0x1820('0x76'),_0xc35898[_0x1820('0x71')]['toString']())[_0x1820('0x3a')](_0x1820('0x77')))['toString']();_0x32da2c['push'](db[_0x1820('0x89')][_0x1820('0x2e')](_0x474d20));}return BPromise[_0x1820('0x8b')](_0x32da2c);}})['then'](function(){return _0x2dde93;})[_0x1820('0x23')](respondWithResult(_0x44bc74,null))[_0x1820('0x43')](handleError(_0x44bc74,null));};exports['removeBlackLists']=function(_0x2e1975,_0x27cdcd,_0x52d2d2){return db[_0x1820('0x2a')][_0x1820('0x51')]({'where':{'id':_0x2e1975['params']['id']}})[_0x1820('0x23')](handleEntityNotFound(_0x27cdcd,null))[_0x1820('0x23')](function(_0xf066ac){if(_0xf066ac){return _0xf066ac[_0x1820('0x91')](_0x2e1975[_0x1820('0x2e')][_0x1820('0x65')]);}})[_0x1820('0x23')](function(_0x54479a){if(_0x54479a){return db[_0x1820('0x5f')][_0x1820('0x8d')]({'where':{'ListId':_0x2e1975[_0x1820('0x2e')]['ids'],'CampaignId':_0x2e1975[_0x1820('0x45')]['id']}})[_0x1820('0x23')](function(){return _0x54479a;});}})['then'](respondWithStatusCode(_0x27cdcd,null))[_0x1820('0x43')](handleError(_0x27cdcd,null));}; \ No newline at end of file +var _0x4ded=['fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','intersection','find','create','body','user','role','IvrCampaigns','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','findOne','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','hasOwnProperty','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','into','cm_hopper','phone','scheduledAt','ContactId','ListId','field','CmListId','toString','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','select','from','CampaignId\x20=\x20?','insert','fromQuery','NOW()','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','cm_contacts','cmHopperId','OrderBy','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','update','then','get','destroy','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','filters','attributes'];(function(_0x10a34c,_0x34d45e){var _0x4fda9a=function(_0x2520e7){while(--_0x2520e7){_0x10a34c['push'](_0x10a34c['shift']());}};_0x4fda9a(++_0x34d45e);}(_0x4ded,0xf3));var _0xd4de=function(_0x38887b,_0x25c650){_0x38887b=_0x38887b-0x0;var _0x396795=_0x4ded[_0x38887b];return _0x396795;};'use strict';var emlformat=require(_0xd4de('0x0'));var rimraf=require(_0xd4de('0x1'));var zipdir=require(_0xd4de('0x2'));var jsonpatch=require(_0xd4de('0x3'));var rp=require(_0xd4de('0x4'));var moment=require(_0xd4de('0x5'));var BPromise=require(_0xd4de('0x6'));var Mustache=require(_0xd4de('0x7'));var util=require(_0xd4de('0x8'));var path=require('path');var sox=require(_0xd4de('0x9'));var csv=require(_0xd4de('0xa'));var ejs=require(_0xd4de('0xb'));var fs=require('fs');var fs_extra=require(_0xd4de('0xc'));var _=require(_0xd4de('0xd'));var squel=require('squel');var crypto=require(_0xd4de('0xe'));var jsforce=require(_0xd4de('0xf'));var deskjs=require(_0xd4de('0x10'));var toCsv=require(_0xd4de('0xa'));var querystring=require('querystring');var Papa=require(_0xd4de('0x11'));var Redis=require(_0xd4de('0x12'));var authService=require(_0xd4de('0x13'));var qs=require(_0xd4de('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd4de('0x15'));var logger=require(_0xd4de('0x16'))(_0xd4de('0x17'));var utils=require(_0xd4de('0x18'));var config=require(_0xd4de('0x19'));var licenseUtil=require(_0xd4de('0x1a'));var db=require(_0xd4de('0x1b'))['db'];function respondWithStatusCode(_0x2c4eb1,_0x49d204){_0x49d204=_0x49d204||0xcc;return function(_0x2415bf){if(_0x2415bf){return _0x2c4eb1[_0xd4de('0x1c')](_0x49d204);}return _0x2c4eb1[_0xd4de('0x1d')](_0x49d204)[_0xd4de('0x1e')]();};}function respondWithResult(_0x38e756,_0x2aa31b){_0x2aa31b=_0x2aa31b||0xc8;return function(_0x2a0c10){if(_0x2a0c10){return _0x38e756[_0xd4de('0x1d')](_0x2aa31b)['json'](_0x2a0c10);}};}function respondWithFilteredResult(_0x5b1740,_0x550f7f){return function(_0x529bcc){if(_0x529bcc){var _0x2def14=typeof _0x550f7f[_0xd4de('0x1f')]==='undefined'&&typeof _0x550f7f['limit']===_0xd4de('0x20');var _0x5f9076=_0x529bcc[_0xd4de('0x21')];var _0x33ecc1=_0x2def14?0x0:_0x550f7f[_0xd4de('0x1f')];var _0x3f5778=_0x2def14?_0x529bcc[_0xd4de('0x21')]:_0x550f7f['offset']+_0x550f7f['limit'];var _0x188207;if(_0x3f5778>=_0x5f9076){_0x3f5778=_0x5f9076;_0x188207=0xc8;}else{_0x188207=0xce;}_0x5b1740['status'](_0x188207);return _0x5b1740['set'](_0xd4de('0x22'),_0x33ecc1+'-'+_0x3f5778+'/'+_0x5f9076)[_0xd4de('0x23')](_0x529bcc);}return null;};}function patchUpdates(_0x29aa85){return function(_0x1903f3){try{jsonpatch[_0xd4de('0x24')](_0x1903f3,_0x29aa85,!![]);}catch(_0xe039f1){return BPromise[_0xd4de('0x25')](_0xe039f1);}return _0x1903f3['save']();};}function saveUpdates(_0x7a8370,_0xa93a8b){return function(_0x3967ee){if(_0x3967ee){return _0x3967ee[_0xd4de('0x26')](_0x7a8370)['then'](function(_0x2a416e){return _0x2a416e;});}return null;};}function removeEntity(_0x53a530,_0x414d4e){return function(_0x599543){if(_0x599543){return _0x599543['destroy']()[_0xd4de('0x27')](function(){var _0x3f18eb=_0x599543[_0xd4de('0x28')]({'plain':!![]});var _0x1d6b5c='IvrCampaigns';return db['UserProfileResource'][_0xd4de('0x29')]({'where':{'type':_0x1d6b5c,'resourceId':_0x3f18eb['id']}})[_0xd4de('0x27')](function(){return _0x599543;});})[_0xd4de('0x27')](function(){_0x53a530[_0xd4de('0x1d')](0xcc)[_0xd4de('0x1e')]();});}};}function handleEntityNotFound(_0x57dd25,_0x4e9ead){return function(_0x41be9b){if(!_0x41be9b){_0x57dd25[_0xd4de('0x1c')](0x194);}return _0x41be9b;};}function handleError(_0x2f4c9c,_0x29f5b1){_0x29f5b1=_0x29f5b1||0x1f4;return function(_0x5d6c4d){logger[_0xd4de('0x2a')](_0x5d6c4d[_0xd4de('0x2b')]);if(_0x5d6c4d[_0xd4de('0x2c')]){delete _0x5d6c4d[_0xd4de('0x2c')];}_0x2f4c9c[_0xd4de('0x1d')](_0x29f5b1)[_0xd4de('0x2d')](_0x5d6c4d);};}exports[_0xd4de('0x2e')]=function(_0x3da9b2,_0x3206d2){var _0x478815={},_0x1d76f0={},_0x286001={'count':0x0,'rows':[]};var _0x16e531=_[_0xd4de('0x2f')](db[_0xd4de('0x30')][_0xd4de('0x31')],function(_0x5d7ea4){return{'name':_0x5d7ea4[_0xd4de('0x32')],'type':_0x5d7ea4[_0xd4de('0x33')][_0xd4de('0x34')]};});_0x1d76f0[_0xd4de('0x35')]=_['map'](_0x16e531,'name');_0x1d76f0[_0xd4de('0x36')]=_['keys'](_0x3da9b2[_0xd4de('0x36')]);_0x1d76f0[_0xd4de('0x37')]=_['intersection'](_0x1d76f0[_0xd4de('0x35')],_0x1d76f0['query']);_0x478815[_0xd4de('0x38')]=_['intersection'](_0x1d76f0['model'],qs[_0xd4de('0x39')](_0x3da9b2[_0xd4de('0x36')][_0xd4de('0x39')]));_0x478815[_0xd4de('0x38')]=_0x478815[_0xd4de('0x38')][_0xd4de('0x3a')]?_0x478815[_0xd4de('0x38')]:_0x1d76f0['model'];if(!_0x3da9b2[_0xd4de('0x36')]['hasOwnProperty'](_0xd4de('0x3b'))){_0x478815[_0xd4de('0x3c')]=qs['limit'](_0x3da9b2['query'][_0xd4de('0x3c')]);_0x478815['offset']=qs[_0xd4de('0x1f')](_0x3da9b2[_0xd4de('0x36')][_0xd4de('0x1f')]);}_0x478815[_0xd4de('0x3d')]=qs['sort'](_0x3da9b2['query'][_0xd4de('0x3e')]);_0x478815[_0xd4de('0x3f')]=qs['filters'](_[_0xd4de('0x40')](_0x3da9b2[_0xd4de('0x36')],_0x1d76f0[_0xd4de('0x37')]),_0x16e531);if(_0x3da9b2['query'][_0xd4de('0x41')]){_0x478815[_0xd4de('0x3f')]=_[_0xd4de('0x42')](_0x478815[_0xd4de('0x3f')],{'$or':_[_0xd4de('0x2f')](_0x16e531,function(_0x3abecb){if(_0x3abecb[_0xd4de('0x33')]!==_0xd4de('0x43')){var _0x14d65c={};_0x14d65c[_0x3abecb[_0xd4de('0x2c')]]={'$like':'%'+_0x3da9b2['query'][_0xd4de('0x41')]+'%'};return _0x14d65c;}})});}_0x478815=_['merge']({},_0x478815,_0x3da9b2[_0xd4de('0x44')]);var _0x5db739={'where':_0x478815[_0xd4de('0x3f')]};return db[_0xd4de('0x30')][_0xd4de('0x21')](_0x5db739)['then'](function(_0x30d8ce){_0x286001[_0xd4de('0x21')]=_0x30d8ce;if(_0x3da9b2['query'][_0xd4de('0x45')]){_0x478815[_0xd4de('0x46')]=[{'all':!![]}];}return db[_0xd4de('0x30')][_0xd4de('0x47')](_0x478815);})[_0xd4de('0x27')](function(_0x3d38a0){_0x286001[_0xd4de('0x48')]=_0x3d38a0;return _0x286001;})[_0xd4de('0x27')](respondWithFilteredResult(_0x3206d2,_0x478815))['catch'](handleError(_0x3206d2,null));};exports[_0xd4de('0x49')]=function(_0x5e5450,_0x25e937){var _0x331cf2={'raw':![],'where':{'id':_0x5e5450[_0xd4de('0x4a')]['id']}},_0x3c1be5={};_0x3c1be5[_0xd4de('0x35')]=_[_0xd4de('0x4b')](db[_0xd4de('0x30')][_0xd4de('0x31')]);_0x3c1be5[_0xd4de('0x36')]=_[_0xd4de('0x4b')](_0x5e5450[_0xd4de('0x36')]);_0x3c1be5[_0xd4de('0x37')]=_[_0xd4de('0x4c')](_0x3c1be5['model'],_0x3c1be5[_0xd4de('0x36')]);_0x331cf2[_0xd4de('0x38')]=_[_0xd4de('0x4c')](_0x3c1be5[_0xd4de('0x35')],qs[_0xd4de('0x39')](_0x5e5450[_0xd4de('0x36')]['fields']));_0x331cf2[_0xd4de('0x38')]=_0x331cf2[_0xd4de('0x38')][_0xd4de('0x3a')]?_0x331cf2['attributes']:_0x3c1be5['model'];if(_0x5e5450['query']['includeAll']){_0x331cf2[_0xd4de('0x46')]=[{'all':!![]}];}_0x331cf2=_[_0xd4de('0x42')]({},_0x331cf2,_0x5e5450[_0xd4de('0x44')]);return db[_0xd4de('0x30')][_0xd4de('0x4d')](_0x331cf2)[_0xd4de('0x27')](handleEntityNotFound(_0x25e937,null))[_0xd4de('0x27')](respondWithResult(_0x25e937,null))['catch'](handleError(_0x25e937,null));};exports[_0xd4de('0x4e')]=function(_0x3ee7b2,_0x4393ee){return db[_0xd4de('0x30')][_0xd4de('0x4e')](_0x3ee7b2[_0xd4de('0x4f')],{})[_0xd4de('0x27')](function(_0x9e47f){var _0x431135=_0x3ee7b2[_0xd4de('0x50')][_0xd4de('0x28')]({'plain':!![]});if(!_0x431135)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x431135[_0xd4de('0x51')]===_0xd4de('0x50')){var _0x5b73f9=_0x9e47f['get']({'plain':!![]});var _0x20d5bd=_0xd4de('0x52');return db['UserProfileSection'][_0xd4de('0x4d')]({'where':{'name':_0x20d5bd,'userProfileId':_0x431135[_0xd4de('0x53')]},'raw':!![]})['then'](function(_0x141a16){if(_0x141a16&&_0x141a16[_0xd4de('0x54')]===0x0){return db[_0xd4de('0x55')][_0xd4de('0x4e')]({'name':_0x5b73f9[_0xd4de('0x2c')],'resourceId':_0x5b73f9['id'],'type':_0x141a16['name'],'sectionId':_0x141a16['id']},{})[_0xd4de('0x27')](function(){return _0x9e47f;});}else{return _0x9e47f;}})[_0xd4de('0x56')](function(_0x73f46b){logger[_0xd4de('0x2a')](_0xd4de('0x57'),_0x73f46b);throw _0x73f46b;});}return _0x9e47f;})[_0xd4de('0x27')](respondWithResult(_0x4393ee,0xc9))[_0xd4de('0x56')](handleError(_0x4393ee,null));};exports[_0xd4de('0x58')]=function(_0x247fc6,_0x14c66e){var _0x3e9038={'where':{'id':_0x247fc6[_0xd4de('0x4a')]['id']}},_0x5a907b={};_0x5a907b[_0xd4de('0x35')]=_[_0xd4de('0x4b')](db[_0xd4de('0x30')]['rawAttributes']);_0x3e9038[_0xd4de('0x38')]=_[_0xd4de('0x4c')](_0x5a907b[_0xd4de('0x35')],qs['fields'](_0x247fc6[_0xd4de('0x36')]['fields']));_0x3e9038[_0xd4de('0x38')]=_0x3e9038[_0xd4de('0x38')][_0xd4de('0x3a')]?_0x3e9038[_0xd4de('0x38')]:_0x5a907b[_0xd4de('0x35')];if(_0x247fc6[_0xd4de('0x36')]['includeAll']){_0x3e9038[_0xd4de('0x46')]=[{'all':!![]}];}_0x3e9038=_[_0xd4de('0x42')]({},_0x3e9038,_0x247fc6[_0xd4de('0x44')]);return db['Campaign'][_0xd4de('0x4d')](_0x3e9038)[_0xd4de('0x27')](handleEntityNotFound(_0x14c66e,null))[_0xd4de('0x27')](function(_0x442ab5){if(_0x442ab5){var _0x594d60=_0x442ab5['get']({'plain':!![]});_0x594d60=qs[_0xd4de('0x59')](_0x594d60,['id',_0xd4de('0x5a'),_0xd4de('0x5b')]);_0x247fc6[_0xd4de('0x4f')]=_[_0xd4de('0x59')](_0x247fc6[_0xd4de('0x4f')],['id',_0xd4de('0x5a'),'updatedAt']);return db['Campaign'][_0xd4de('0x4e')](_['merge'](_0x594d60,_0x247fc6['body']),{'include':_0x247fc6[_0xd4de('0x36')][_0xd4de('0x45')]?[{'all':!![]}]:undefined})[_0xd4de('0x27')](function(_0x291745){var _0x4ff238=_0x247fc6[_0xd4de('0x50')][_0xd4de('0x28')]({'plain':!![]});if(!_0x4ff238)throw new Error(_0xd4de('0x5c'));if(_0x4ff238[_0xd4de('0x51')]===_0xd4de('0x50')){var _0x1e206a=_0x291745[_0xd4de('0x28')]({'plain':!![]});var _0x53427f='IvrCampaigns';return db['UserProfileSection'][_0xd4de('0x4d')]({'where':{'name':_0x53427f,'userProfileId':_0x4ff238[_0xd4de('0x53')]},'raw':!![]})[_0xd4de('0x27')](function(_0x475272){if(_0x475272&&_0x475272[_0xd4de('0x54')]===0x0){return db['UserProfileResource'][_0xd4de('0x4e')]({'name':_0x1e206a['name'],'resourceId':_0x1e206a['id'],'type':_0x475272[_0xd4de('0x2c')],'sectionId':_0x475272['id']},{})[_0xd4de('0x27')](function(){return _0x291745;});}else{return _0x291745;}})[_0xd4de('0x56')](function(_0x4b6929){logger[_0xd4de('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b6929);throw _0x4b6929;});}return _0x291745;});}})[_0xd4de('0x27')](respondWithResult(_0x14c66e,0xc9))['catch'](handleError(_0x14c66e,null));};exports[_0xd4de('0x26')]=function(_0x15071d,_0x16d7be){if(_0x15071d[_0xd4de('0x4f')]['id']){delete _0x15071d[_0xd4de('0x4f')]['id'];}return db[_0xd4de('0x30')]['find']({'where':{'id':_0x15071d[_0xd4de('0x4a')]['id']}})[_0xd4de('0x27')](handleEntityNotFound(_0x16d7be,null))[_0xd4de('0x27')](saveUpdates(_0x15071d['body'],null))['then'](respondWithResult(_0x16d7be,null))[_0xd4de('0x56')](handleError(_0x16d7be,null));};exports[_0xd4de('0x29')]=function(_0x247a5d,_0x7229cb){return db['Campaign'][_0xd4de('0x4d')]({'where':{'id':_0x247a5d[_0xd4de('0x4a')]['id']}})[_0xd4de('0x27')](handleEntityNotFound(_0x7229cb,null))[_0xd4de('0x27')](removeEntity(_0x7229cb,null))[_0xd4de('0x56')](handleError(_0x7229cb,null));};exports[_0xd4de('0x5d')]=function(_0x48f807,_0x4fad8b,_0x583504){var _0x2eb843={'raw':!![],'where':{}};var _0x58b39e={};var _0x2406b3={'count':0x0,'rows':[]};return db[_0xd4de('0x30')][_0xd4de('0x5e')]({'where':{'id':_0x48f807[_0xd4de('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4fad8b,null))[_0xd4de('0x27')](function(_0x22985f){if(_0x22985f){_0x58b39e[_0xd4de('0x35')]=_['keys'](db['CmHopper']['rawAttributes']);_0x58b39e[_0xd4de('0x36')]=_['keys'](_0x48f807[_0xd4de('0x36')]);_0x58b39e[_0xd4de('0x37')]=_[_0xd4de('0x4c')](_0x58b39e[_0xd4de('0x35')],_0x58b39e[_0xd4de('0x36')]);_0x2eb843['attributes']=_[_0xd4de('0x4c')](_0x58b39e['model'],qs[_0xd4de('0x39')](_0x48f807['query'][_0xd4de('0x39')]));_0x2eb843[_0xd4de('0x38')]=_0x2eb843[_0xd4de('0x38')][_0xd4de('0x3a')]?_0x2eb843[_0xd4de('0x38')]:_0x58b39e[_0xd4de('0x35')];if(!_0x48f807[_0xd4de('0x36')]['hasOwnProperty']('nolimit')){_0x2eb843[_0xd4de('0x3c')]=qs[_0xd4de('0x3c')](_0x48f807['query']['limit']);_0x2eb843[_0xd4de('0x1f')]=qs[_0xd4de('0x1f')](_0x48f807[_0xd4de('0x36')][_0xd4de('0x1f')]);}_0x2eb843[_0xd4de('0x3d')]=qs[_0xd4de('0x3e')](_0x48f807[_0xd4de('0x36')]['sort']);_0x2eb843[_0xd4de('0x3f')]=qs['filters'](_[_0xd4de('0x40')](_0x48f807['query'],_0x58b39e['filters']));_0x2eb843[_0xd4de('0x3f')][_0xd4de('0x5f')]=_0x22985f['id'];if(_0x48f807['query'][_0xd4de('0x41')]){_0x2eb843[_0xd4de('0x3f')]=_[_0xd4de('0x42')](_0x2eb843['where'],{'$or':_[_0xd4de('0x2f')](_0x2eb843[_0xd4de('0x38')],function(_0x215947){var _0x26457b={};_0x26457b[_0x215947]={'$like':'%'+_0x48f807[_0xd4de('0x36')][_0xd4de('0x41')]+'%'};return _0x26457b;})});}_0x2eb843=_[_0xd4de('0x42')]({},_0x2eb843,_0x48f807[_0xd4de('0x44')]);return db[_0xd4de('0x60')]['count']({'where':_0x2eb843[_0xd4de('0x3f')]})[_0xd4de('0x27')](function(_0x2910b7){_0x2406b3['count']=_0x2910b7;if(_0x48f807[_0xd4de('0x36')][_0xd4de('0x45')]){_0x2eb843[_0xd4de('0x46')]=[{'all':!![]}];}return db[_0xd4de('0x60')][_0xd4de('0x47')](_0x2eb843);})[_0xd4de('0x27')](function(_0x3cd5d4){_0x2406b3[_0xd4de('0x48')]=_0x3cd5d4;return _0x2406b3;});}})[_0xd4de('0x27')](respondWithFilteredResult(_0x4fad8b,_0x2eb843))[_0xd4de('0x56')](handleError(_0x4fad8b,null));};exports[_0xd4de('0x61')]=function(_0x3fb47c,_0x320507,_0x21694b){var _0x367349={'raw':!![],'where':{}};var _0x13d4b6={};var _0x414e83={'count':0x0,'rows':[]};return db[_0xd4de('0x30')][_0xd4de('0x5e')]({'where':{'id':_0x3fb47c[_0xd4de('0x4a')]['id']}})[_0xd4de('0x27')](handleEntityNotFound(_0x320507,null))[_0xd4de('0x27')](function(_0x240c98){if(_0x240c98){_0x13d4b6[_0xd4de('0x35')]=_[_0xd4de('0x4b')](db[_0xd4de('0x62')][_0xd4de('0x31')]);_0x13d4b6[_0xd4de('0x36')]=_['keys'](_0x3fb47c[_0xd4de('0x36')]);_0x13d4b6[_0xd4de('0x37')]=_['intersection'](_0x13d4b6['model'],_0x13d4b6['query']);_0x367349[_0xd4de('0x38')]=_[_0xd4de('0x4c')](_0x13d4b6[_0xd4de('0x35')],qs[_0xd4de('0x39')](_0x3fb47c['query'][_0xd4de('0x39')]));_0x367349['attributes']=_0x367349[_0xd4de('0x38')][_0xd4de('0x3a')]?_0x367349[_0xd4de('0x38')]:_0x13d4b6[_0xd4de('0x35')];if(!_0x3fb47c[_0xd4de('0x36')][_0xd4de('0x63')]('nolimit')){_0x367349['limit']=qs[_0xd4de('0x3c')](_0x3fb47c[_0xd4de('0x36')]['limit']);_0x367349[_0xd4de('0x1f')]=qs[_0xd4de('0x1f')](_0x3fb47c[_0xd4de('0x36')]['offset']);}_0x367349[_0xd4de('0x3d')]=qs[_0xd4de('0x3e')](_0x3fb47c[_0xd4de('0x36')]['sort']);_0x367349[_0xd4de('0x3f')]=qs['filters'](_[_0xd4de('0x40')](_0x3fb47c[_0xd4de('0x36')],_0x13d4b6[_0xd4de('0x37')]));_0x367349[_0xd4de('0x3f')][_0xd4de('0x5f')]=_0x240c98['id'];if(_0x3fb47c['query'][_0xd4de('0x41')]){_0x367349[_0xd4de('0x3f')]=_[_0xd4de('0x42')](_0x367349['where'],{'$or':_[_0xd4de('0x2f')](_0x367349[_0xd4de('0x38')],function(_0x274520){var _0x321277={};_0x321277[_0x274520]={'$like':'%'+_0x3fb47c[_0xd4de('0x36')][_0xd4de('0x41')]+'%'};return _0x321277;})});}_0x367349=_['merge']({},_0x367349,_0x3fb47c[_0xd4de('0x44')]);return db[_0xd4de('0x62')]['count']({'where':_0x367349[_0xd4de('0x3f')]})[_0xd4de('0x27')](function(_0x596bd0){_0x414e83['count']=_0x596bd0;if(_0x3fb47c[_0xd4de('0x36')][_0xd4de('0x45')]){_0x367349[_0xd4de('0x46')]=[{'all':!![]}];}return db[_0xd4de('0x62')][_0xd4de('0x47')](_0x367349);})['then'](function(_0x46a3cc){_0x414e83[_0xd4de('0x48')]=_0x46a3cc;return _0x414e83;});}})['then'](respondWithFilteredResult(_0x320507,_0x367349))[_0xd4de('0x56')](handleError(_0x320507,null));};exports[_0xd4de('0x64')]=function(_0xa55161,_0x16d68a,_0x34a724){var _0x44d955={'raw':!![],'where':{}};var _0x408a82={};var _0x5b6a66={'count':0x0,'rows':[]};return db[_0xd4de('0x30')][_0xd4de('0x5e')]({'where':{'id':_0xa55161['params']['id']}})[_0xd4de('0x27')](handleEntityNotFound(_0x16d68a,null))[_0xd4de('0x27')](function(_0x4cd51d){if(_0x4cd51d){_0x408a82[_0xd4de('0x35')]=_['keys'](db[_0xd4de('0x65')][_0xd4de('0x31')]);_0x408a82[_0xd4de('0x36')]=_[_0xd4de('0x4b')](_0xa55161[_0xd4de('0x36')]);_0x408a82['filters']=_[_0xd4de('0x4c')](_0x408a82['model'],_0x408a82['query']);_0x44d955['attributes']=_[_0xd4de('0x4c')](_0x408a82[_0xd4de('0x35')],qs[_0xd4de('0x39')](_0xa55161['query']['fields']));_0x44d955['attributes']=_0x44d955[_0xd4de('0x38')][_0xd4de('0x3a')]?_0x44d955[_0xd4de('0x38')]:_0x408a82[_0xd4de('0x35')];if(!_0xa55161[_0xd4de('0x36')][_0xd4de('0x63')](_0xd4de('0x3b'))){_0x44d955[_0xd4de('0x3c')]=qs[_0xd4de('0x3c')](_0xa55161[_0xd4de('0x36')][_0xd4de('0x3c')]);_0x44d955[_0xd4de('0x1f')]=qs[_0xd4de('0x1f')](_0xa55161[_0xd4de('0x36')][_0xd4de('0x1f')]);}_0x44d955[_0xd4de('0x3d')]=qs[_0xd4de('0x3e')](_0xa55161[_0xd4de('0x36')][_0xd4de('0x3e')]);_0x44d955[_0xd4de('0x3f')]=qs[_0xd4de('0x37')](_[_0xd4de('0x40')](_0xa55161[_0xd4de('0x36')],_0x408a82['filters']));_0x44d955['where'][_0xd4de('0x5f')]=_0x4cd51d['id'];if(_0xa55161[_0xd4de('0x36')][_0xd4de('0x41')]){_0x44d955[_0xd4de('0x3f')]=_['merge'](_0x44d955[_0xd4de('0x3f')],{'$or':_[_0xd4de('0x2f')](_0x44d955[_0xd4de('0x38')],function(_0x5e8ef3){var _0x254b45={};_0x254b45[_0x5e8ef3]={'$like':'%'+_0xa55161[_0xd4de('0x36')][_0xd4de('0x41')]+'%'};return _0x254b45;})});}_0x44d955=_[_0xd4de('0x42')]({},_0x44d955,_0xa55161['options']);return db[_0xd4de('0x65')][_0xd4de('0x21')]({'where':_0x44d955[_0xd4de('0x3f')]})[_0xd4de('0x27')](function(_0x4dfd52){_0x5b6a66['count']=_0x4dfd52;if(_0xa55161[_0xd4de('0x36')][_0xd4de('0x45')]){_0x44d955[_0xd4de('0x46')]=[{'all':!![]}];}return db[_0xd4de('0x65')][_0xd4de('0x47')](_0x44d955);})[_0xd4de('0x27')](function(_0x3432ca){_0x5b6a66['rows']=_0x3432ca;return _0x5b6a66;});}})[_0xd4de('0x27')](respondWithFilteredResult(_0x16d68a,_0x44d955))[_0xd4de('0x56')](handleError(_0x16d68a,null));};exports[_0xd4de('0x66')]=function(_0x1de576,_0x1323c3,_0x16d91e){var _0x3f7f64={'raw':!![],'where':{}};var _0x4fc6bf={};var _0x1764db={'count':0x0,'rows':[]};return db[_0xd4de('0x30')]['findOne']({'where':{'id':_0x1de576[_0xd4de('0x4a')]['id']}})[_0xd4de('0x27')](handleEntityNotFound(_0x1323c3,null))['then'](function(_0x154efe){if(_0x154efe){_0x4fc6bf[_0xd4de('0x35')]=_[_0xd4de('0x4b')](db[_0xd4de('0x67')]['rawAttributes']);_0x4fc6bf[_0xd4de('0x36')]=_[_0xd4de('0x4b')](_0x1de576[_0xd4de('0x36')]);_0x4fc6bf[_0xd4de('0x37')]=_['intersection'](_0x4fc6bf[_0xd4de('0x35')],_0x4fc6bf[_0xd4de('0x36')]);_0x3f7f64[_0xd4de('0x38')]=_[_0xd4de('0x4c')](_0x4fc6bf[_0xd4de('0x35')],qs[_0xd4de('0x39')](_0x1de576[_0xd4de('0x36')][_0xd4de('0x39')]));_0x3f7f64[_0xd4de('0x38')]=_0x3f7f64[_0xd4de('0x38')][_0xd4de('0x3a')]?_0x3f7f64[_0xd4de('0x38')]:_0x4fc6bf[_0xd4de('0x35')];if(!_0x1de576['query'][_0xd4de('0x63')]('nolimit')){_0x3f7f64[_0xd4de('0x3c')]=qs['limit'](_0x1de576[_0xd4de('0x36')][_0xd4de('0x3c')]);_0x3f7f64[_0xd4de('0x1f')]=qs[_0xd4de('0x1f')](_0x1de576['query']['offset']);}_0x3f7f64['order']=qs[_0xd4de('0x3e')](_0x1de576[_0xd4de('0x36')][_0xd4de('0x3e')]);_0x3f7f64['where']=qs[_0xd4de('0x37')](_[_0xd4de('0x40')](_0x1de576['query'],_0x4fc6bf['filters']));_0x3f7f64[_0xd4de('0x3f')][_0xd4de('0x5f')]=_0x154efe['id'];if(_0x1de576[_0xd4de('0x36')]['filter']){_0x3f7f64[_0xd4de('0x3f')]=_['merge'](_0x3f7f64[_0xd4de('0x3f')],{'$or':_['map'](_0x3f7f64['attributes'],function(_0x42f31b){var _0x3bd4be={};_0x3bd4be[_0x42f31b]={'$like':'%'+_0x1de576['query'][_0xd4de('0x41')]+'%'};return _0x3bd4be;})});}_0x3f7f64=_[_0xd4de('0x42')]({},_0x3f7f64,_0x1de576[_0xd4de('0x44')]);return db[_0xd4de('0x67')][_0xd4de('0x21')]({'where':_0x3f7f64[_0xd4de('0x3f')]})[_0xd4de('0x27')](function(_0x201322){_0x1764db[_0xd4de('0x21')]=_0x201322;if(_0x1de576[_0xd4de('0x36')][_0xd4de('0x45')]){_0x3f7f64[_0xd4de('0x46')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x3f7f64);})[_0xd4de('0x27')](function(_0x26a5cb){_0x1764db[_0xd4de('0x48')]=_0x26a5cb;return _0x1764db;});}})[_0xd4de('0x27')](respondWithFilteredResult(_0x1323c3,_0x3f7f64))[_0xd4de('0x56')](handleError(_0x1323c3,null));};exports[_0xd4de('0x68')]=function(_0x50e1bf,_0x4c31a7,_0x48640d){var _0x47439d={};var _0x5cb4ce={};var _0x2da6bc;var _0x3a08e8;return db[_0xd4de('0x30')][_0xd4de('0x5e')]({'where':{'id':_0x50e1bf[_0xd4de('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4c31a7,null))[_0xd4de('0x27')](function(_0x2f73c5){if(_0x2f73c5){_0x2da6bc=_0x2f73c5;_0x5cb4ce[_0xd4de('0x35')]=_[_0xd4de('0x4b')](db[_0xd4de('0x69')]['rawAttributes']);_0x5cb4ce[_0xd4de('0x36')]=_[_0xd4de('0x4b')](_0x50e1bf['query']);_0x5cb4ce['filters']=_[_0xd4de('0x4c')](_0x5cb4ce[_0xd4de('0x35')],_0x5cb4ce[_0xd4de('0x36')]);_0x47439d[_0xd4de('0x38')]=_[_0xd4de('0x4c')](_0x5cb4ce['model'],qs['fields'](_0x50e1bf[_0xd4de('0x36')]['fields']));_0x47439d[_0xd4de('0x38')]=_0x47439d['attributes'][_0xd4de('0x3a')]?_0x47439d[_0xd4de('0x38')]:_0x5cb4ce[_0xd4de('0x35')];_0x47439d[_0xd4de('0x3d')]=qs[_0xd4de('0x3e')](_0x50e1bf['query']['sort']);_0x47439d['where']=qs[_0xd4de('0x37')](_[_0xd4de('0x40')](_0x50e1bf[_0xd4de('0x36')],_0x5cb4ce['filters']));if(_0x50e1bf['query'][_0xd4de('0x41')]){_0x47439d[_0xd4de('0x3f')]=_[_0xd4de('0x42')](_0x47439d[_0xd4de('0x3f')],{'$or':_[_0xd4de('0x2f')](_0x47439d[_0xd4de('0x38')],function(_0x15d481){var _0x44f2a4={};_0x44f2a4[_0x15d481]={'$like':'%'+_0x50e1bf[_0xd4de('0x36')][_0xd4de('0x41')]+'%'};return _0x44f2a4;})});}_0x47439d=_['merge']({},_0x47439d,_0x50e1bf['options']);return _0x2da6bc[_0xd4de('0x68')](_0x47439d);}})[_0xd4de('0x27')](function(_0x4b9f20){if(_0x4b9f20){_0x3a08e8=_0x4b9f20[_0xd4de('0x3a')];if(!_0x50e1bf[_0xd4de('0x36')][_0xd4de('0x63')](_0xd4de('0x3b'))){_0x47439d[_0xd4de('0x3c')]=qs[_0xd4de('0x3c')](_0x50e1bf[_0xd4de('0x36')][_0xd4de('0x3c')]);_0x47439d[_0xd4de('0x1f')]=qs[_0xd4de('0x1f')](_0x50e1bf[_0xd4de('0x36')][_0xd4de('0x1f')]);}return _0x2da6bc[_0xd4de('0x68')](_0x47439d);}})[_0xd4de('0x27')](function(_0x4daaf0){if(_0x4daaf0){return _0x4daaf0?{'count':_0x3a08e8,'rows':_0x4daaf0}:null;}})['then'](respondWithResult(_0x4c31a7,null))[_0xd4de('0x56')](handleError(_0x4c31a7,null));};exports[_0xd4de('0x6a')]=function(_0x3d8ba8,_0x482586,_0x4705a8){var _0x2698f9,_0xecc9c3;var _0x50313c=[];var _0x197446=moment()[_0xd4de('0x6b')](_0xd4de('0x6c'));return db[_0xd4de('0x30')][_0xd4de('0x4d')]({'where':{'id':_0x3d8ba8[_0xd4de('0x4a')]['id']}})['then'](handleEntityNotFound(_0x482586,null))[_0xd4de('0x27')](function(_0x5997ce){if(_0x5997ce){_0xecc9c3=_0x5997ce;return _0x5997ce[_0xd4de('0x6a')](_0x3d8ba8[_0xd4de('0x4f')][_0xd4de('0x6d')],_[_0xd4de('0x59')](_0x3d8ba8[_0xd4de('0x4f')],[_0xd4de('0x6d'),'id'])||{});}return null;})[_0xd4de('0x6e')](function(_0x577776){var _0x4960d0;var _0x15bc7b;_0x2698f9=_0x577776||[];var _0x56226c=[];if(_0x577776){for(var _0x1db14d=0x0;_0x1db14d<_0x577776[_0xd4de('0x3a')];_0x1db14d+=0x1){var _0xb5cf27=_0x577776[_0x1db14d][_0xd4de('0x28')]({'plain':!![]});_0xecc9c3[_0xd4de('0x6f')]=_0x3d8ba8[_0xd4de('0x4f')][_0xd4de('0x6f')]?_0x3d8ba8[_0xd4de('0x4f')]['dialCheckDuplicateType']:_0xecc9c3[_0xd4de('0x6f')];switch(_0xecc9c3[_0xd4de('0x6f')]){case'always':_0x4960d0=squel['insert']()[_0xd4de('0x70')](_0xd4de('0x71'))['fromQuery']([_0xd4de('0x72'),_0xd4de('0x73'),_0xd4de('0x74'),_0xd4de('0x75'),_0xd4de('0x5f'),'createdAt',_0xd4de('0x5b')],squel['select']()[_0xd4de('0x76')](_0xd4de('0x72'),_0xd4de('0x72'))['field']('NOW()',_0xd4de('0x73'))[_0xd4de('0x76')]('id',_0xd4de('0x74'))[_0xd4de('0x76')](_0xb5cf27[_0xd4de('0x77')][_0xd4de('0x78')](),_0xd4de('0x75'))[_0xd4de('0x76')](_0x3d8ba8[_0xd4de('0x4a')]['id']['toString'](),_0xd4de('0x5f'))[_0xd4de('0x76')]('\x27'+_0x197446+'\x27','createdAt')['field']('\x27'+_0x197446+'\x27',_0xd4de('0x5b'))['from']('cm_contacts')['where'](_0xd4de('0x79'))[_0xd4de('0x3f')](_0xd4de('0x7a'),_0xb5cf27[_0xd4de('0x77')]['toString']())[_0xd4de('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0xd4de('0x3f')](_0xd4de('0x7b'),squel[_0xd4de('0x7c')]()[_0xd4de('0x76')]('COALESCE(calleridnum,\x27\x27)')[_0xd4de('0x7d')]('cm_hopper_final')[_0xd4de('0x3f')]('CampaignId\x20=\x20?',_0x3d8ba8['params']['id'][_0xd4de('0x78')]()))[_0xd4de('0x3f')](_0xd4de('0x7b'),squel['select']()[_0xd4de('0x76')]('COALESCE(phone,\x27\x27)')[_0xd4de('0x7d')](_0xd4de('0x71'))['where'](_0xd4de('0x7e'),_0x3d8ba8[_0xd4de('0x4a')]['id'][_0xd4de('0x78')]())))[_0xd4de('0x78')]();break;case'onlyIfOpen':_0x4960d0=squel[_0xd4de('0x7f')]()['into'](_0xd4de('0x71'))[_0xd4de('0x80')]([_0xd4de('0x72'),_0xd4de('0x73'),_0xd4de('0x74'),_0xd4de('0x75'),'CampaignId',_0xd4de('0x5a'),_0xd4de('0x5b')],squel['select']()[_0xd4de('0x76')](_0xd4de('0x72'),_0xd4de('0x72'))[_0xd4de('0x76')](_0xd4de('0x81'),_0xd4de('0x73'))[_0xd4de('0x76')]('id',_0xd4de('0x74'))[_0xd4de('0x76')](_0xb5cf27[_0xd4de('0x77')][_0xd4de('0x78')](),_0xd4de('0x75'))[_0xd4de('0x76')](_0x3d8ba8['params']['id'][_0xd4de('0x78')](),'CampaignId')['field']('\x27'+_0x197446+'\x27','createdAt')[_0xd4de('0x76')]('\x27'+_0x197446+'\x27',_0xd4de('0x5b'))['from']('cm_contacts')[_0xd4de('0x3f')](_0xd4de('0x79'))[_0xd4de('0x3f')](_0xd4de('0x7a'),_0xb5cf27[_0xd4de('0x77')][_0xd4de('0x78')]())['where'](_0xd4de('0x82'))[_0xd4de('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0xd4de('0x7c')]()[_0xd4de('0x76')](_0xd4de('0x83'))[_0xd4de('0x7d')](_0xd4de('0x71'))['where'](_0xd4de('0x7e'),_0x3d8ba8['params']['id']['toString']())))[_0xd4de('0x78')]();break;default:_0x4960d0=squel[_0xd4de('0x7f')]()['into']('cm_hopper')[_0xd4de('0x80')](['phone',_0xd4de('0x73'),_0xd4de('0x74'),_0xd4de('0x75'),_0xd4de('0x5f'),_0xd4de('0x5a'),'updatedAt'],squel[_0xd4de('0x7c')]()['field'](_0xd4de('0x72'),_0xd4de('0x72'))[_0xd4de('0x76')](_0xd4de('0x81'),_0xd4de('0x73'))[_0xd4de('0x76')]('id',_0xd4de('0x74'))['field'](_0xb5cf27[_0xd4de('0x77')][_0xd4de('0x78')](),_0xd4de('0x75'))[_0xd4de('0x76')](_0x3d8ba8['params']['id'][_0xd4de('0x78')](),_0xd4de('0x5f'))[_0xd4de('0x76')]('\x27'+_0x197446+'\x27',_0xd4de('0x5a'))[_0xd4de('0x76')]('\x27'+_0x197446+'\x27',_0xd4de('0x5b'))[_0xd4de('0x7d')](_0xd4de('0x84'))['where']('deletedAt\x20IS\x20NULL')[_0xd4de('0x3f')](_0xd4de('0x7a'),_0xb5cf27[_0xd4de('0x77')][_0xd4de('0x78')]())['where'](_0xd4de('0x82')))[_0xd4de('0x78')]();}_0x15bc7b=squel[_0xd4de('0x7f')]()['into']('cm_hopper_additional_phones')['fromQuery']([_0xd4de('0x85'),_0xd4de('0x73'),'phone',_0xd4de('0x86'),_0xd4de('0x5a'),'updatedAt'],squel[_0xd4de('0x7c')]()[_0xd4de('0x76')]('h.id','id')[_0xd4de('0x76')](_0xd4de('0x81'),_0xd4de('0x73'))[_0xd4de('0x76')](_0xd4de('0x87'),_0xd4de('0x72'))[_0xd4de('0x76')](_0xd4de('0x88'),_0xd4de('0x86'))[_0xd4de('0x76')]('\x27'+_0x197446+'\x27',_0xd4de('0x5a'))[_0xd4de('0x76')]('\x27'+_0x197446+'\x27','updatedAt')[_0xd4de('0x7d')](_0xd4de('0x89'),'ci')[_0xd4de('0x8a')](_0xd4de('0x71'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0xd4de('0x3f')](_0xd4de('0x8b'),_0xb5cf27[_0xd4de('0x77')][_0xd4de('0x78')]())['where'](_0xd4de('0x8c'),_0x3d8ba8[_0xd4de('0x4a')]['id'][_0xd4de('0x78')]())[_0xd4de('0x3f')](_0xd4de('0x8d'),_0x197446))[_0xd4de('0x78')]();_0x56226c[_0xd4de('0x8e')](db[_0xd4de('0x8f')][_0xd4de('0x36')](_0x4960d0));_0x50313c['push'](db['sequelize']['query'](_0x15bc7b));}return BPromise[_0xd4de('0x90')](_0x56226c);}})[_0xd4de('0x27')](function(){return BPromise[_0xd4de('0x90')](_0x50313c);})[_0xd4de('0x27')](function(){return _0x2698f9;})[_0xd4de('0x27')](respondWithResult(_0x482586,null))[_0xd4de('0x56')](handleError(_0x482586,null));};exports[_0xd4de('0x91')]=function(_0x5dc254,_0x49f604,_0x193201){return db['Campaign'][_0xd4de('0x4d')]({'where':{'id':_0x5dc254[_0xd4de('0x4a')]['id']}})['then'](handleEntityNotFound(_0x49f604,null))[_0xd4de('0x27')](function(_0x127322){if(_0x127322){return _0x127322[_0xd4de('0x91')](_0x5dc254['query'][_0xd4de('0x6d')]);}})[_0xd4de('0x27')](function(_0x5e6ca4){if(_0x5e6ca4){return db[_0xd4de('0x60')][_0xd4de('0x29')]({'where':{'ListId':_0x5dc254[_0xd4de('0x36')][_0xd4de('0x6d')],'CampaignId':_0x5dc254[_0xd4de('0x4a')]['id']}})['then'](function(){return _0x5e6ca4;});}})[_0xd4de('0x27')](respondWithStatusCode(_0x49f604,null))[_0xd4de('0x56')](handleError(_0x49f604,null));};exports[_0xd4de('0x92')]=function(_0x53b6ce,_0x48227c,_0x3705fb){var _0x45d2e3={};var _0x4d6c98={};var _0x5e5ce8;var _0x29c72d;return db[_0xd4de('0x30')]['findOne']({'where':{'id':_0x53b6ce[_0xd4de('0x4a')]['id']}})[_0xd4de('0x27')](handleEntityNotFound(_0x48227c,null))[_0xd4de('0x27')](function(_0x429644){if(_0x429644){_0x5e5ce8=_0x429644;_0x4d6c98['model']=_[_0xd4de('0x4b')](db['CmList'][_0xd4de('0x31')]);_0x4d6c98[_0xd4de('0x36')]=_[_0xd4de('0x4b')](_0x53b6ce[_0xd4de('0x36')]);_0x4d6c98[_0xd4de('0x37')]=_[_0xd4de('0x4c')](_0x4d6c98[_0xd4de('0x35')],_0x4d6c98['query']);_0x45d2e3[_0xd4de('0x38')]=_[_0xd4de('0x4c')](_0x4d6c98[_0xd4de('0x35')],qs['fields'](_0x53b6ce['query'][_0xd4de('0x39')]));_0x45d2e3[_0xd4de('0x38')]=_0x45d2e3[_0xd4de('0x38')][_0xd4de('0x3a')]?_0x45d2e3['attributes']:_0x4d6c98[_0xd4de('0x35')];_0x45d2e3[_0xd4de('0x3d')]=qs[_0xd4de('0x3e')](_0x53b6ce['query'][_0xd4de('0x3e')]);_0x45d2e3[_0xd4de('0x3f')]=qs['filters'](_['pick'](_0x53b6ce['query'],_0x4d6c98[_0xd4de('0x37')]));if(_0x53b6ce[_0xd4de('0x36')][_0xd4de('0x41')]){_0x45d2e3[_0xd4de('0x3f')]=_[_0xd4de('0x42')](_0x45d2e3[_0xd4de('0x3f')],{'$or':_[_0xd4de('0x2f')](_0x45d2e3[_0xd4de('0x38')],function(_0x266e71){var _0x55312e={};_0x55312e[_0x266e71]={'$like':'%'+_0x53b6ce[_0xd4de('0x36')]['filter']+'%'};return _0x55312e;})});}_0x45d2e3=_[_0xd4de('0x42')]({},_0x45d2e3,_0x53b6ce[_0xd4de('0x44')]);return _0x5e5ce8[_0xd4de('0x92')](_0x45d2e3);}})[_0xd4de('0x27')](function(_0x23b864){if(_0x23b864){_0x29c72d=_0x23b864['length'];if(!_0x53b6ce[_0xd4de('0x36')]['hasOwnProperty'](_0xd4de('0x3b'))){_0x45d2e3[_0xd4de('0x3c')]=qs[_0xd4de('0x3c')](_0x53b6ce[_0xd4de('0x36')][_0xd4de('0x3c')]);_0x45d2e3[_0xd4de('0x1f')]=qs[_0xd4de('0x1f')](_0x53b6ce[_0xd4de('0x36')][_0xd4de('0x1f')]);}return _0x5e5ce8[_0xd4de('0x92')](_0x45d2e3);}})[_0xd4de('0x27')](function(_0x363e62){if(_0x363e62){return _0x363e62?{'count':_0x29c72d,'rows':_0x363e62}:null;}})[_0xd4de('0x27')](respondWithResult(_0x48227c,null))[_0xd4de('0x56')](handleError(_0x48227c,null));};exports[_0xd4de('0x93')]=function(_0xdd32b9,_0x5c891e,_0x504fee){var _0x5a475e,_0x4ccd1e;var _0x207955=[];var _0x55148d=moment()['format'](_0xd4de('0x6c'));return db['Campaign'][_0xd4de('0x4d')]({'where':{'id':_0xdd32b9[_0xd4de('0x4a')]['id']}})[_0xd4de('0x27')](handleEntityNotFound(_0x5c891e,null))[_0xd4de('0x27')](function(_0x187ce1){if(_0x187ce1){_0x4ccd1e=_0x187ce1;return _0x187ce1[_0xd4de('0x93')](_0xdd32b9[_0xd4de('0x4f')][_0xd4de('0x6d')],_[_0xd4de('0x59')](_0xdd32b9[_0xd4de('0x4f')],['ids','id'])||{});}return null;})['spread'](function(_0x1bc087){var _0x4a6ca5;var _0x32cf37;_0x5a475e=_0x1bc087||[];var _0x1b6c2a=[];if(_0x1bc087){for(var _0x56c83a=0x0;_0x56c83a<_0x1bc087['length'];_0x56c83a+=0x1){var _0x15dcb0=_0x1bc087[_0x56c83a][_0xd4de('0x28')]({'plain':!![]});_0x4a6ca5=squel[_0xd4de('0x7f')]()['into'](_0xd4de('0x94'))['fromQuery']([_0xd4de('0x72'),'ContactId','ListId',_0xd4de('0x5f'),_0xd4de('0x5a'),_0xd4de('0x5b')],squel[_0xd4de('0x7c')]()[_0xd4de('0x76')](_0xd4de('0x72'),_0xd4de('0x72'))[_0xd4de('0x76')]('id','ContactId')[_0xd4de('0x76')](_0x15dcb0[_0xd4de('0x77')]['toString'](),_0xd4de('0x75'))[_0xd4de('0x76')](_0xdd32b9['params']['id'][_0xd4de('0x78')](),_0xd4de('0x5f'))[_0xd4de('0x76')](_0xd4de('0x81'),'createdAt')[_0xd4de('0x76')](_0xd4de('0x81'),_0xd4de('0x5b'))['from']('cm_contacts')[_0xd4de('0x3f')](_0xd4de('0x79'))[_0xd4de('0x3f')](_0xd4de('0x7a'),_0x15dcb0[_0xd4de('0x77')]['toString']())[_0xd4de('0x3f')](_0xd4de('0x82')))[_0xd4de('0x78')]();_0x1b6c2a['push'](db[_0xd4de('0x8f')]['query'](_0x4a6ca5));}return BPromise[_0xd4de('0x90')](_0x1b6c2a);}})[_0xd4de('0x27')](function(){return _0x5a475e;})[_0xd4de('0x27')](respondWithResult(_0x5c891e,null))[_0xd4de('0x56')](handleError(_0x5c891e,null));};exports[_0xd4de('0x95')]=function(_0x50bdaf,_0x58ec2b,_0x13d1ac){return db[_0xd4de('0x30')][_0xd4de('0x4d')]({'where':{'id':_0x50bdaf[_0xd4de('0x4a')]['id']}})[_0xd4de('0x27')](handleEntityNotFound(_0x58ec2b,null))[_0xd4de('0x27')](function(_0x462e04){if(_0x462e04){return _0x462e04[_0xd4de('0x95')](_0x50bdaf['query'][_0xd4de('0x6d')]);}})[_0xd4de('0x27')](function(_0x21368c){if(_0x21368c){return db[_0xd4de('0x67')][_0xd4de('0x29')]({'where':{'ListId':_0x50bdaf[_0xd4de('0x36')][_0xd4de('0x6d')],'CampaignId':_0x50bdaf[_0xd4de('0x4a')]['id']}})[_0xd4de('0x27')](function(){return _0x21368c;});}})[_0xd4de('0x27')](respondWithStatusCode(_0x58ec2b,null))[_0xd4de('0x56')](handleError(_0x58ec2b,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index a97dd54..3ece4e8 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_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 logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index bcb21a4..b0c06e0 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 _0x544a=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','result','GetCampaign','Campaign','findAll','raw','options','limit','model','attributes','include','map','then','debug','catch','lodash','util','moment'];(function(_0x52d4ad,_0x25e611){var _0x34a767=function(_0x1f3daa){while(--_0x1f3daa){_0x52d4ad['push'](_0x52d4ad['shift']());}};_0x34a767(++_0x25e611);}(_0x544a,0xbd));var _0xa544=function(_0x3734dc,_0x24f3c0){_0x3734dc=_0x3734dc-0x0;var _0x551eba=_0x544a[_0x3734dc];return _0x551eba;};'use strict';var _=require(_0xa544('0x0'));var util=require(_0xa544('0x1'));var moment=require(_0xa544('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa544('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa544('0x4'));var logger=require(_0xa544('0x5'))('rpc');var config=require(_0xa544('0x6'));var jayson=require(_0xa544('0x7'));var client=jayson[_0xa544('0x8')][_0xa544('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39caac,_0x543cd1,_0x407443){return new BPromise(function(_0x495819,_0x39bcd7){return client[_0xa544('0xa')](_0x39caac,_0x407443)['then'](function(_0x2e9a6a){logger[_0xa544('0xb')](_0xa544('0xc'),_0x543cd1,_0xa544('0xd'));logger['debug'](_0xa544('0xe'),_0x543cd1,_0xa544('0xd'),JSON['stringify'](_0x2e9a6a));if(_0x2e9a6a[_0xa544('0xf')]){if(_0x2e9a6a['error'][_0xa544('0x10')]===0x1f4){logger[_0xa544('0xf')]('Campaign,\x20%s,\x20%s',_0x543cd1,_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);return _0x39bcd7(_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);}logger[_0xa544('0xf')](_0xa544('0xc'),_0x543cd1,_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);return _0x495819(_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);}else{logger[_0xa544('0xb')](_0xa544('0xc'),_0x543cd1,'request\x20sent');_0x495819(_0x2e9a6a[_0xa544('0x12')][_0xa544('0x11')]);}})['catch'](function(_0x9093bd){logger[_0xa544('0xf')](_0xa544('0xc'),_0x543cd1,_0x9093bd);_0x39bcd7(_0x9093bd);});});}exports[_0xa544('0x13')]=function(_0x2c5ae8){var _0x297298=this;return new Promise(function(_0x1f3fcc,_0x44ccd3){return db[_0xa544('0x14')][_0xa544('0x15')]({'raw':_0x2c5ae8['options']?_0x2c5ae8['options'][_0xa544('0x16')]===undefined?!![]:![]:!![],'where':_0x2c5ae8[_0xa544('0x17')]?_0x2c5ae8[_0xa544('0x17')]['where']||null:null,'attributes':_0x2c5ae8[_0xa544('0x17')]?_0x2c5ae8[_0xa544('0x17')]['attributes']||null:null,'limit':_0x2c5ae8[_0xa544('0x17')]?_0x2c5ae8[_0xa544('0x17')][_0xa544('0x18')]||null:null,'include':_0x2c5ae8[_0xa544('0x17')]?_0x2c5ae8[_0xa544('0x17')]['include']?_['map'](_0x2c5ae8[_0xa544('0x17')]['include'],function(_0x407a61){return{'model':db[_0x407a61[_0xa544('0x19')]],'as':_0x407a61['as'],'attributes':_0x407a61[_0xa544('0x1a')],'include':_0x407a61[_0xa544('0x1b')]?_[_0xa544('0x1c')](_0x407a61[_0xa544('0x1b')],function(_0xcd7bfa){return{'model':db[_0xcd7bfa[_0xa544('0x19')]],'as':_0xcd7bfa['as'],'attributes':_0xcd7bfa[_0xa544('0x1a')],'include':_0xcd7bfa['include']?_[_0xa544('0x1c')](_0xcd7bfa[_0xa544('0x1b')],function(_0x578483){return{'model':db[_0x578483[_0xa544('0x19')]],'as':_0x578483['as'],'attributes':_0x578483[_0xa544('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa544('0x1d')](function(_0x4fdf9e){logger[_0xa544('0xb')](_0xa544('0x13'),_0x2c5ae8);logger[_0xa544('0x1e')](_0xa544('0x13'),_0x2c5ae8,JSON['stringify'](_0x4fdf9e));_0x1f3fcc(_0x4fdf9e);})[_0xa544('0x1f')](function(_0x290c45){logger[_0xa544('0xf')]('GetCampaign',_0x290c45[_0xa544('0x11')],_0x2c5ae8);_0x44ccd3(_0x297298[_0xa544('0xf')](0x1f4,_0x290c45['message']));});});}; \ No newline at end of file +var _0x38a5=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Campaign,\x20%s,\x20%s','result','catch','Campaign','findAll','options','raw','where','attributes','limit','include','model','map','GetCampaign','lodash','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x38a5,0x69));var _0x538a=function(_0x163085,_0x59cd2b){_0x163085=_0x163085-0x0;var _0x323ea2=_0x38a5[_0x163085];return _0x323ea2;};'use strict';var _=require(_0x538a('0x0'));var util=require(_0x538a('0x1'));var moment=require(_0x538a('0x2'));var BPromise=require(_0x538a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x538a('0x4'));var db=require(_0x538a('0x5'))['db'];var utils=require(_0x538a('0x6'));var logger=require(_0x538a('0x7'))(_0x538a('0x8'));var config=require(_0x538a('0x9'));var jayson=require(_0x538a('0xa'));var client=jayson[_0x538a('0xb')][_0x538a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3fcf5b,_0x11fbcf,_0x3d4e22){return new BPromise(function(_0x6eed8e,_0x5a750d){return client['request'](_0x3fcf5b,_0x3d4e22)[_0x538a('0xd')](function(_0x74ecbf){logger[_0x538a('0xe')]('Campaign,\x20%s,\x20%s',_0x11fbcf,_0x538a('0xf'));logger[_0x538a('0x10')](_0x538a('0x11'),_0x11fbcf,_0x538a('0xf'),JSON[_0x538a('0x12')](_0x74ecbf));if(_0x74ecbf[_0x538a('0x13')]){if(_0x74ecbf[_0x538a('0x13')][_0x538a('0x14')]===0x1f4){logger['error']('Campaign,\x20%s,\x20%s',_0x11fbcf,_0x74ecbf[_0x538a('0x13')][_0x538a('0x15')]);return _0x5a750d(_0x74ecbf['error']['message']);}logger[_0x538a('0x13')](_0x538a('0x16'),_0x11fbcf,_0x74ecbf[_0x538a('0x13')][_0x538a('0x15')]);return _0x6eed8e(_0x74ecbf[_0x538a('0x13')][_0x538a('0x15')]);}else{logger[_0x538a('0xe')](_0x538a('0x16'),_0x11fbcf,'request\x20sent');_0x6eed8e(_0x74ecbf[_0x538a('0x17')][_0x538a('0x15')]);}})[_0x538a('0x18')](function(_0x547adf){logger['error']('Campaign,\x20%s,\x20%s',_0x11fbcf,_0x547adf);_0x5a750d(_0x547adf);});});}exports['GetCampaign']=function(_0xc94f01){var _0x344b64=this;return new Promise(function(_0x3d7a30,_0x5108fb){return db[_0x538a('0x19')][_0x538a('0x1a')]({'raw':_0xc94f01['options']?_0xc94f01[_0x538a('0x1b')][_0x538a('0x1c')]===undefined?!![]:![]:!![],'where':_0xc94f01[_0x538a('0x1b')]?_0xc94f01[_0x538a('0x1b')][_0x538a('0x1d')]||null:null,'attributes':_0xc94f01['options']?_0xc94f01[_0x538a('0x1b')][_0x538a('0x1e')]||null:null,'limit':_0xc94f01['options']?_0xc94f01[_0x538a('0x1b')][_0x538a('0x1f')]||null:null,'include':_0xc94f01[_0x538a('0x1b')]?_0xc94f01['options'][_0x538a('0x20')]?_['map'](_0xc94f01[_0x538a('0x1b')]['include'],function(_0xed1f6a){return{'model':db[_0xed1f6a[_0x538a('0x21')]],'as':_0xed1f6a['as'],'attributes':_0xed1f6a['attributes'],'include':_0xed1f6a[_0x538a('0x20')]?_[_0x538a('0x22')](_0xed1f6a[_0x538a('0x20')],function(_0x52824a){return{'model':db[_0x52824a[_0x538a('0x21')]],'as':_0x52824a['as'],'attributes':_0x52824a[_0x538a('0x1e')],'include':_0x52824a[_0x538a('0x20')]?_['map'](_0x52824a['include'],function(_0x141680){return{'model':db[_0x141680['model']],'as':_0x141680['as'],'attributes':_0x141680['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ec7d4){logger[_0x538a('0xe')](_0x538a('0x23'),_0xc94f01);logger[_0x538a('0x10')](_0x538a('0x23'),_0xc94f01,JSON[_0x538a('0x12')](_0x3ec7d4));_0x3d7a30(_0x3ec7d4);})['catch'](function(_0x55b5c6){logger[_0x538a('0x13')](_0x538a('0x23'),_0x55b5c6[_0x538a('0x15')],_0xc94f01);_0x5108fb(_0x344b64[_0x538a('0x13')](0x1f4,_0x55b5c6[_0x538a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index cf14c38..9ab4985 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 _0xfd03=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','/:id/hoppers','isAuthenticated','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','put','update','delete','destroy','removeLists','removeBlackLists','exports','path','connect-timeout','express'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xfd03,0xa2));var _0x3fd0=function(_0x23e6bb,_0x5c2d69){_0x23e6bb=_0x23e6bb-0x0;var _0x1e3b4c=_0xfd03[_0x23e6bb];return _0x1e3b4c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3fd0('0x0'));var timeout=require(_0x3fd0('0x1'));var express=require(_0x3fd0('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3fd0('0x3'));var interaction=require(_0x3fd0('0x4'));var config=require(_0x3fd0('0x5'));var controller=require('./campaign.controller');router[_0x3fd0('0x6')]('/',auth['isAuthenticated'](),controller[_0x3fd0('0x7')]);router[_0x3fd0('0x6')](_0x3fd0('0x8'),auth['isAuthenticated'](),controller[_0x3fd0('0x9')]);router[_0x3fd0('0x6')](_0x3fd0('0xa'),auth[_0x3fd0('0xb')](),controller['getHoppers']);router[_0x3fd0('0x6')]('/:id/hopper_histories',auth[_0x3fd0('0xb')](),controller[_0x3fd0('0xc')]);router[_0x3fd0('0x6')](_0x3fd0('0xd'),auth[_0x3fd0('0xb')](),controller[_0x3fd0('0xe')]);router[_0x3fd0('0x6')](_0x3fd0('0xf'),auth['isAuthenticated'](),controller[_0x3fd0('0x10')]);router['get'](_0x3fd0('0x11'),auth[_0x3fd0('0xb')](),controller[_0x3fd0('0x12')]);router[_0x3fd0('0x6')]('/:id/blacklists',auth[_0x3fd0('0xb')](),controller[_0x3fd0('0x13')]);router[_0x3fd0('0x14')]('/',auth['isAuthenticated'](),controller[_0x3fd0('0x15')]);router[_0x3fd0('0x14')](_0x3fd0('0x16'),auth[_0x3fd0('0xb')](),controller[_0x3fd0('0x17')]);router[_0x3fd0('0x14')](_0x3fd0('0x11'),auth[_0x3fd0('0xb')](),controller[_0x3fd0('0x18')]);router[_0x3fd0('0x14')](_0x3fd0('0x19'),auth[_0x3fd0('0xb')](),controller['addBlackLists']);router[_0x3fd0('0x1a')](_0x3fd0('0x8'),auth[_0x3fd0('0xb')](),controller[_0x3fd0('0x1b')]);router[_0x3fd0('0x1c')](_0x3fd0('0x8'),auth['isAuthenticated'](),controller[_0x3fd0('0x1d')]);router[_0x3fd0('0x1c')](_0x3fd0('0x11'),auth[_0x3fd0('0xb')](),controller[_0x3fd0('0x1e')]);router[_0x3fd0('0x1c')](_0x3fd0('0x19'),auth[_0x3fd0('0xb')](),controller[_0x3fd0('0x1f')]);module[_0x3fd0('0x20')]=router; \ No newline at end of file +var _0xfb09=['/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','post','create','/:id/clone','clone','/:id/lists','addLists','addBlackLists','/:id','update','delete','removeLists','removeBlackLists','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers'];(function(_0x52975d,_0x127968){var _0x3baabc=function(_0x3b80e6){while(--_0x3b80e6){_0x52975d['push'](_0x52975d['shift']());}};_0x3baabc(++_0x127968);}(_0xfb09,0xa3));var _0x9fb0=function(_0x46dcac,_0x5e3a5c){_0x46dcac=_0x46dcac-0x0;var _0x37c3a2=_0xfb09[_0x46dcac];return _0x37c3a2;};'use strict';var multer=require(_0x9fb0('0x0'));var util=require(_0x9fb0('0x1'));var path=require(_0x9fb0('0x2'));var timeout=require(_0x9fb0('0x3'));var express=require(_0x9fb0('0x4'));var router=express[_0x9fb0('0x5')]();var fs_extra=require(_0x9fb0('0x6'));var auth=require(_0x9fb0('0x7'));var interaction=require(_0x9fb0('0x8'));var config=require(_0x9fb0('0x9'));var controller=require(_0x9fb0('0xa'));router[_0x9fb0('0xb')]('/',auth['isAuthenticated'](),controller[_0x9fb0('0xc')]);router[_0x9fb0('0xb')]('/:id',auth[_0x9fb0('0xd')](),controller[_0x9fb0('0xe')]);router[_0x9fb0('0xb')](_0x9fb0('0xf'),auth[_0x9fb0('0xd')](),controller[_0x9fb0('0x10')]);router[_0x9fb0('0xb')](_0x9fb0('0x11'),auth[_0x9fb0('0xd')](),controller[_0x9fb0('0x12')]);router[_0x9fb0('0xb')](_0x9fb0('0x13'),auth[_0x9fb0('0xd')](),controller['getHopperFinals']);router[_0x9fb0('0xb')](_0x9fb0('0x14'),auth[_0x9fb0('0xd')](),controller[_0x9fb0('0x15')]);router[_0x9fb0('0xb')]('/:id/lists',auth[_0x9fb0('0xd')](),controller[_0x9fb0('0x16')]);router['get'](_0x9fb0('0x17'),auth[_0x9fb0('0xd')](),controller['getBlackLists']);router[_0x9fb0('0x18')]('/',auth[_0x9fb0('0xd')](),controller[_0x9fb0('0x19')]);router[_0x9fb0('0x18')](_0x9fb0('0x1a'),auth['isAuthenticated'](),controller[_0x9fb0('0x1b')]);router[_0x9fb0('0x18')](_0x9fb0('0x1c'),auth[_0x9fb0('0xd')](),controller[_0x9fb0('0x1d')]);router[_0x9fb0('0x18')](_0x9fb0('0x17'),auth[_0x9fb0('0xd')](),controller[_0x9fb0('0x1e')]);router['put'](_0x9fb0('0x1f'),auth['isAuthenticated'](),controller[_0x9fb0('0x20')]);router['delete'](_0x9fb0('0x1f'),auth['isAuthenticated'](),controller['destroy']);router[_0x9fb0('0x21')](_0x9fb0('0x1c'),auth['isAuthenticated'](),controller[_0x9fb0('0x22')]);router[_0x9fb0('0x21')](_0x9fb0('0x17'),auth[_0x9fb0('0xd')](),controller[_0x9fb0('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index da38519..02f1774 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 _0xcebe=['sequelize','exports','STRING','TEXT','getDataValue','key'];(function(_0x2165ce,_0xd0b0e9){var _0x5dfcfb=function(_0xd1093c){while(--_0xd1093c){_0x2165ce['push'](_0x2165ce['shift']());}};_0x5dfcfb(++_0xd0b0e9);}(_0xcebe,0x13e));var _0xeceb=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xcebe[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xeceb('0x0'));module[_0xeceb('0x1')]={'key':{'type':Sequelize[_0xeceb('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xeceb('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xeceb('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xeceb('0x4')](_0xeceb('0x5'));}}}; \ No newline at end of file +var _0xd594=['getDataValue','key','sequelize','TEXT','STRING','VIRTUAL'];(function(_0x1e7741,_0x23b963){var _0x29e1db=function(_0x5b4cf2){while(--_0x5b4cf2){_0x1e7741['push'](_0x1e7741['shift']());}};_0x29e1db(++_0x23b963);}(_0xd594,0x1ee));var _0x4d59=function(_0x527f28,_0x5c1418){_0x527f28=_0x527f28-0x0;var _0xa23737=_0xd594[_0x527f28];return _0xa23737;};'use strict';var Sequelize=require(_0x4d59('0x0'));module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x4d59('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4d59('0x2')]},'name':{'type':Sequelize[_0x4d59('0x3')],'get':function(){return this[_0x4d59('0x4')](_0x4d59('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 5c774fb..3707580 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 _0x866b=['then','get','CannedAnswers','UserProfileResource','error','stack','name','send','rawAttributes','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','CannedAnswer','include','findAll','rows','catch','show','params','keys','includeAll','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','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','count','limit','Content-Range','apply','reject','save','update','destroy'];(function(_0x5d9b16,_0x25789a){var _0x22b34d=function(_0x187ac6){while(--_0x187ac6){_0x5d9b16['push'](_0x5d9b16['shift']());}};_0x22b34d(++_0x25789a);}(_0x866b,0x156));var _0xb866=function(_0x597e38,_0x551ac2){_0x597e38=_0x597e38-0x0;var _0x5305d2=_0x866b[_0x597e38];return _0x5305d2;};'use strict';var emlformat=require(_0xb866('0x0'));var rimraf=require(_0xb866('0x1'));var zipdir=require(_0xb866('0x2'));var jsonpatch=require(_0xb866('0x3'));var rp=require(_0xb866('0x4'));var moment=require(_0xb866('0x5'));var BPromise=require(_0xb866('0x6'));var Mustache=require(_0xb866('0x7'));var util=require(_0xb866('0x8'));var path=require(_0xb866('0x9'));var sox=require(_0xb866('0xa'));var csv=require(_0xb866('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb866('0xc'));var _=require(_0xb866('0xd'));var squel=require(_0xb866('0xe'));var crypto=require('crypto');var jsforce=require(_0xb866('0xf'));var deskjs=require(_0xb866('0x10'));var toCsv=require(_0xb866('0xb'));var querystring=require(_0xb866('0x11'));var Papa=require(_0xb866('0x12'));var Redis=require(_0xb866('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb866('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb866('0x15'));var logger=require(_0xb866('0x16'))(_0xb866('0x17'));var utils=require(_0xb866('0x18'));var config=require(_0xb866('0x19'));var licenseUtil=require(_0xb866('0x1a'));var db=require(_0xb866('0x1b'))['db'];function respondWithStatusCode(_0x52498d,_0x521424){_0x521424=_0x521424||0xcc;return function(_0x1421e7){if(_0x1421e7){return _0x52498d[_0xb866('0x1c')](_0x521424);}return _0x52498d[_0xb866('0x1d')](_0x521424)[_0xb866('0x1e')]();};}function respondWithResult(_0x2144e0,_0x93dedf){_0x93dedf=_0x93dedf||0xc8;return function(_0xb9a440){if(_0xb9a440){return _0x2144e0[_0xb866('0x1d')](_0x93dedf)[_0xb866('0x1f')](_0xb9a440);}};}function respondWithFilteredResult(_0x45b306,_0x42d450){return function(_0x46d841){if(_0x46d841){var _0x32bca7=typeof _0x42d450[_0xb866('0x20')]===_0xb866('0x21')&&typeof _0x42d450['limit']===_0xb866('0x21');var _0x344e36=_0x46d841[_0xb866('0x22')];var _0x4a6be7=_0x32bca7?0x0:_0x42d450[_0xb866('0x20')];var _0x1bda03=_0x32bca7?_0x46d841[_0xb866('0x22')]:_0x42d450[_0xb866('0x20')]+_0x42d450[_0xb866('0x23')];var _0x2bfbeb;if(_0x1bda03>=_0x344e36){_0x1bda03=_0x344e36;_0x2bfbeb=0xc8;}else{_0x2bfbeb=0xce;}_0x45b306[_0xb866('0x1d')](_0x2bfbeb);return _0x45b306['set'](_0xb866('0x24'),_0x4a6be7+'-'+_0x1bda03+'/'+_0x344e36)[_0xb866('0x1f')](_0x46d841);}return null;};}function patchUpdates(_0x20f48e){return function(_0xb2afd6){try{jsonpatch[_0xb866('0x25')](_0xb2afd6,_0x20f48e,!![]);}catch(_0x4c5689){return BPromise[_0xb866('0x26')](_0x4c5689);}return _0xb2afd6[_0xb866('0x27')]();};}function saveUpdates(_0x367f25,_0x275d9e){return function(_0x382eec){if(_0x382eec){return _0x382eec[_0xb866('0x28')](_0x367f25)['then'](function(_0x2df4db){return _0x2df4db;});}return null;};}function removeEntity(_0x8e59da,_0x531f4a){return function(_0x2b1f48){if(_0x2b1f48){return _0x2b1f48[_0xb866('0x29')]()[_0xb866('0x2a')](function(){var _0x39ce27=_0x2b1f48[_0xb866('0x2b')]({'plain':!![]});var _0xfab342=_0xb866('0x2c');return db[_0xb866('0x2d')]['destroy']({'where':{'type':_0xfab342,'resourceId':_0x39ce27['id']}})['then'](function(){return _0x2b1f48;});})[_0xb866('0x2a')](function(){_0x8e59da[_0xb866('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x89c49a,_0x1e518b){return function(_0x3f002f){if(!_0x3f002f){_0x89c49a[_0xb866('0x1c')](0x194);}return _0x3f002f;};}function handleError(_0x442a31,_0x415e99){_0x415e99=_0x415e99||0x1f4;return function(_0x4767dd){logger[_0xb866('0x2e')](_0x4767dd[_0xb866('0x2f')]);if(_0x4767dd[_0xb866('0x30')]){delete _0x4767dd[_0xb866('0x30')];}_0x442a31['status'](_0x415e99)[_0xb866('0x31')](_0x4767dd);};}exports['index']=function(_0x2caf0c,_0x41d63a){var _0x870a6d={},_0x2afbe8={},_0x3377e6={'count':0x0,'rows':[]};var _0x547102=_['map'](db['CannedAnswer'][_0xb866('0x32')],function(_0x247c18){return{'name':_0x247c18['fieldName'],'type':_0x247c18[_0xb866('0x33')][_0xb866('0x34')]};});_0x2afbe8[_0xb866('0x35')]=_[_0xb866('0x36')](_0x547102,_0xb866('0x30'));_0x2afbe8[_0xb866('0x37')]=_['keys'](_0x2caf0c[_0xb866('0x37')]);_0x2afbe8[_0xb866('0x38')]=_[_0xb866('0x39')](_0x2afbe8[_0xb866('0x35')],_0x2afbe8[_0xb866('0x37')]);_0x870a6d['attributes']=_[_0xb866('0x39')](_0x2afbe8[_0xb866('0x35')],qs[_0xb866('0x3a')](_0x2caf0c[_0xb866('0x37')][_0xb866('0x3a')]));_0x870a6d[_0xb866('0x3b')]=_0x870a6d[_0xb866('0x3b')][_0xb866('0x3c')]?_0x870a6d['attributes']:_0x2afbe8['model'];if(!_0x2caf0c['query'][_0xb866('0x3d')](_0xb866('0x3e'))){_0x870a6d[_0xb866('0x23')]=qs[_0xb866('0x23')](_0x2caf0c['query'][_0xb866('0x23')]);_0x870a6d[_0xb866('0x20')]=qs[_0xb866('0x20')](_0x2caf0c[_0xb866('0x37')][_0xb866('0x20')]);}_0x870a6d[_0xb866('0x3f')]=qs[_0xb866('0x40')](_0x2caf0c['query'][_0xb866('0x40')]);_0x870a6d[_0xb866('0x41')]=qs[_0xb866('0x38')](_[_0xb866('0x42')](_0x2caf0c[_0xb866('0x37')],_0x2afbe8[_0xb866('0x38')]),_0x547102);if(_0x2caf0c[_0xb866('0x37')][_0xb866('0x43')]){_0x870a6d[_0xb866('0x41')]=_['merge'](_0x870a6d[_0xb866('0x41')],{'$or':[{'key':{'$like':'%'+_0x2caf0c[_0xb866('0x37')][_0xb866('0x43')]+'%'}},{'value':{'$like':'%'+_0x2caf0c[_0xb866('0x37')]['filter']+'%'}}]});}_0x870a6d=_[_0xb866('0x44')]({},_0x870a6d,_0x2caf0c[_0xb866('0x45')]);var _0x51d7fc={'where':_0x870a6d[_0xb866('0x41')]};return db[_0xb866('0x46')][_0xb866('0x22')](_0x51d7fc)[_0xb866('0x2a')](function(_0x901fe3){_0x3377e6[_0xb866('0x22')]=_0x901fe3;if(_0x2caf0c['query']['includeAll']){_0x870a6d[_0xb866('0x47')]=[{'all':!![]}];}return db[_0xb866('0x46')][_0xb866('0x48')](_0x870a6d);})['then'](function(_0x93bf4a){_0x3377e6[_0xb866('0x49')]=_0x93bf4a;return _0x3377e6;})[_0xb866('0x2a')](respondWithFilteredResult(_0x41d63a,_0x870a6d))[_0xb866('0x4a')](handleError(_0x41d63a,null));};exports[_0xb866('0x4b')]=function(_0x8182,_0x59f846){var _0xa91197={'raw':!![],'where':{'id':_0x8182[_0xb866('0x4c')]['id']}},_0x19080d={};_0x19080d[_0xb866('0x35')]=_['keys'](db['CannedAnswer'][_0xb866('0x32')]);_0x19080d[_0xb866('0x37')]=_[_0xb866('0x4d')](_0x8182[_0xb866('0x37')]);_0x19080d['filters']=_[_0xb866('0x39')](_0x19080d[_0xb866('0x35')],_0x19080d[_0xb866('0x37')]);_0xa91197[_0xb866('0x3b')]=_[_0xb866('0x39')](_0x19080d[_0xb866('0x35')],qs['fields'](_0x8182[_0xb866('0x37')][_0xb866('0x3a')]));_0xa91197[_0xb866('0x3b')]=_0xa91197[_0xb866('0x3b')][_0xb866('0x3c')]?_0xa91197['attributes']:_0x19080d[_0xb866('0x35')];if(_0x8182[_0xb866('0x37')][_0xb866('0x4e')]){_0xa91197[_0xb866('0x47')]=[{'all':!![]}];}_0xa91197=_[_0xb866('0x44')]({},_0xa91197,_0x8182[_0xb866('0x45')]);return db[_0xb866('0x46')][_0xb866('0x4f')](_0xa91197)[_0xb866('0x2a')](handleEntityNotFound(_0x59f846,null))['then'](respondWithResult(_0x59f846,null))[_0xb866('0x4a')](handleError(_0x59f846,null));};exports[_0xb866('0x28')]=function(_0x4421ef,_0x39b4a6){if(_0x4421ef[_0xb866('0x50')]['id']){delete _0x4421ef['body']['id'];}return db['CannedAnswer'][_0xb866('0x4f')]({'where':{'id':_0x4421ef[_0xb866('0x4c')]['id']}})[_0xb866('0x2a')](handleEntityNotFound(_0x39b4a6,null))[_0xb866('0x2a')](saveUpdates(_0x4421ef[_0xb866('0x50')],null))[_0xb866('0x2a')](respondWithResult(_0x39b4a6,null))[_0xb866('0x4a')](handleError(_0x39b4a6,null));};exports[_0xb866('0x29')]=function(_0x35eb2c,_0x3fe99c){return db[_0xb866('0x46')][_0xb866('0x4f')]({'where':{'id':_0x35eb2c['params']['id']}})['then'](handleEntityNotFound(_0x3fe99c,null))['then'](removeEntity(_0x3fe99c,null))[_0xb866('0x4a')](handleError(_0x3fe99c,null));};exports[_0xb866('0x51')]=function(_0x58e856,_0x42e21d){var _0xdaae90={'key':_0x58e856[_0xb866('0x50')]['key']};if(_0x58e856[_0xb866('0x50')][_0xb866('0x52')]){_0xdaae90[_0xb866('0x52')]=_0x58e856[_0xb866('0x50')][_0xb866('0x52')];}else if(_0x58e856[_0xb866('0x50')]['SmsAccountId']){_0xdaae90[_0xb866('0x53')]=_0x58e856['body'][_0xb866('0x53')];}else if(_0x58e856[_0xb866('0x50')][_0xb866('0x54')]){_0xdaae90[_0xb866('0x54')]=_0x58e856[_0xb866('0x50')][_0xb866('0x54')];}else if(_0x58e856['body'][_0xb866('0x55')]){_0xdaae90[_0xb866('0x55')]=_0x58e856[_0xb866('0x50')][_0xb866('0x55')];}return db['CannedAnswer'][_0xb866('0x4f')]({'where':_0xdaae90})[_0xb866('0x2a')](function(_0x2f870f){if(_0x2f870f){throw new db[(_0xb866('0x56'))][(_0xb866('0x57'))](_0xb866('0x58'));}return db[_0xb866('0x46')][_0xb866('0x51')](_0x58e856[_0xb866('0x50')]);})[_0xb866('0x2a')](function(_0x2bdcd8){var _0x3c2631=_0x58e856['user'][_0xb866('0x2b')]({'plain':!![]});if(!_0x3c2631)throw new Error(_0xb866('0x59'));if(_0x3c2631[_0xb866('0x5a')]===_0xb866('0x5b')){var _0x3f34c4=_0x2bdcd8['get']({'plain':!![]});return db[_0xb866('0x5c')][_0xb866('0x4f')]({'where':{'name':'CannedAnswers','userProfileId':_0x3c2631[_0xb866('0x5d')]},'raw':!![]})[_0xb866('0x2a')](function(_0x388ca7){if(_0x388ca7&&_0x388ca7[_0xb866('0x5e')]===0x0){return db[_0xb866('0x2d')]['create']({'name':_0x3f34c4[_0xb866('0x30')],'resourceId':_0x3f34c4['id'],'type':_0x388ca7[_0xb866('0x30')],'sectionId':_0x388ca7['id']},{})[_0xb866('0x2a')](function(){return _0x2bdcd8;});}else{return _0x2bdcd8;}})['catch'](function(_0x54f0bb){logger[_0xb866('0x2e')](_0xb866('0x5f'),_0x54f0bb);throw _0x54f0bb;});}return _0x2bdcd8;})[_0xb866('0x2a')](respondWithResult(_0x42e21d,0xc9))['catch'](handleError(_0x42e21d,null));}; \ No newline at end of file +var _0xeeb6=['rawAttributes','includeAll','include','find','update','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','CannedAnswers','UserProfileResource','stack','name','send','map','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','CannedAnswer','findAll','rows','catch','params'];(function(_0xb4d2a2,_0x2187c9){var _0x8e6eb9=function(_0x4a9431){while(--_0x4a9431){_0xb4d2a2['push'](_0xb4d2a2['shift']());}};_0x8e6eb9(++_0x2187c9);}(_0xeeb6,0x176));var _0x6eeb=function(_0x247d8a,_0x5239d3){_0x247d8a=_0x247d8a-0x0;var _0x55733b=_0xeeb6[_0x247d8a];return _0x55733b;};'use strict';var emlformat=require(_0x6eeb('0x0'));var rimraf=require(_0x6eeb('0x1'));var zipdir=require(_0x6eeb('0x2'));var jsonpatch=require(_0x6eeb('0x3'));var rp=require(_0x6eeb('0x4'));var moment=require(_0x6eeb('0x5'));var BPromise=require(_0x6eeb('0x6'));var Mustache=require('mustache');var util=require(_0x6eeb('0x7'));var path=require(_0x6eeb('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6eeb('0x9'));var fs=require('fs');var fs_extra=require(_0x6eeb('0xa'));var _=require(_0x6eeb('0xb'));var squel=require(_0x6eeb('0xc'));var crypto=require('crypto');var jsforce=require(_0x6eeb('0xd'));var deskjs=require(_0x6eeb('0xe'));var toCsv=require(_0x6eeb('0xf'));var querystring=require(_0x6eeb('0x10'));var Papa=require(_0x6eeb('0x11'));var Redis=require(_0x6eeb('0x12'));var authService=require(_0x6eeb('0x13'));var qs=require(_0x6eeb('0x14'));var as=require(_0x6eeb('0x15'));var hardwareService=require(_0x6eeb('0x16'));var logger=require(_0x6eeb('0x17'))(_0x6eeb('0x18'));var utils=require(_0x6eeb('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x6eeb('0x1a'));var db=require(_0x6eeb('0x1b'))['db'];function respondWithStatusCode(_0x1d9981,_0x1eda7d){_0x1eda7d=_0x1eda7d||0xcc;return function(_0x123aab){if(_0x123aab){return _0x1d9981[_0x6eeb('0x1c')](_0x1eda7d);}return _0x1d9981[_0x6eeb('0x1d')](_0x1eda7d)[_0x6eeb('0x1e')]();};}function respondWithResult(_0x346826,_0x17e6fe){_0x17e6fe=_0x17e6fe||0xc8;return function(_0xc128a3){if(_0xc128a3){return _0x346826[_0x6eeb('0x1d')](_0x17e6fe)[_0x6eeb('0x1f')](_0xc128a3);}};}function respondWithFilteredResult(_0x2d409c,_0x248648){return function(_0x5d2417){if(_0x5d2417){var _0x2fa7f4=typeof _0x248648['offset']===_0x6eeb('0x20')&&typeof _0x248648[_0x6eeb('0x21')]===_0x6eeb('0x20');var _0x33ecfd=_0x5d2417[_0x6eeb('0x22')];var _0x324f4d=_0x2fa7f4?0x0:_0x248648[_0x6eeb('0x23')];var _0x4a6dd7=_0x2fa7f4?_0x5d2417[_0x6eeb('0x22')]:_0x248648[_0x6eeb('0x23')]+_0x248648[_0x6eeb('0x21')];var _0x101e8b;if(_0x4a6dd7>=_0x33ecfd){_0x4a6dd7=_0x33ecfd;_0x101e8b=0xc8;}else{_0x101e8b=0xce;}_0x2d409c[_0x6eeb('0x1d')](_0x101e8b);return _0x2d409c[_0x6eeb('0x24')](_0x6eeb('0x25'),_0x324f4d+'-'+_0x4a6dd7+'/'+_0x33ecfd)['json'](_0x5d2417);}return null;};}function patchUpdates(_0x4954b3){return function(_0x5dfab8){try{jsonpatch[_0x6eeb('0x26')](_0x5dfab8,_0x4954b3,!![]);}catch(_0x267101){return BPromise[_0x6eeb('0x27')](_0x267101);}return _0x5dfab8[_0x6eeb('0x28')]();};}function saveUpdates(_0x40a649,_0x5a0e17){return function(_0x576dd3){if(_0x576dd3){return _0x576dd3['update'](_0x40a649)[_0x6eeb('0x29')](function(_0x4e632b){return _0x4e632b;});}return null;};}function removeEntity(_0x41cafb,_0x1df208){return function(_0x51f4b2){if(_0x51f4b2){return _0x51f4b2[_0x6eeb('0x2a')]()[_0x6eeb('0x29')](function(){var _0x53b3a3=_0x51f4b2[_0x6eeb('0x2b')]({'plain':!![]});var _0xee9271=_0x6eeb('0x2c');return db[_0x6eeb('0x2d')][_0x6eeb('0x2a')]({'where':{'type':_0xee9271,'resourceId':_0x53b3a3['id']}})[_0x6eeb('0x29')](function(){return _0x51f4b2;});})[_0x6eeb('0x29')](function(){_0x41cafb['status'](0xcc)[_0x6eeb('0x1e')]();});}};}function handleEntityNotFound(_0x20d565,_0x5ed316){return function(_0x442d06){if(!_0x442d06){_0x20d565[_0x6eeb('0x1c')](0x194);}return _0x442d06;};}function handleError(_0xb2c112,_0x1063c5){_0x1063c5=_0x1063c5||0x1f4;return function(_0x1eefae){logger['error'](_0x1eefae[_0x6eeb('0x2e')]);if(_0x1eefae['name']){delete _0x1eefae[_0x6eeb('0x2f')];}_0xb2c112[_0x6eeb('0x1d')](_0x1063c5)[_0x6eeb('0x30')](_0x1eefae);};}exports['index']=function(_0xd230b6,_0x547838){var _0x307110={},_0x44d532={},_0x3d7411={'count':0x0,'rows':[]};var _0x387d1f=_[_0x6eeb('0x31')](db['CannedAnswer']['rawAttributes'],function(_0x31d5cf){return{'name':_0x31d5cf['fieldName'],'type':_0x31d5cf['type'][_0x6eeb('0x32')]};});_0x44d532[_0x6eeb('0x33')]=_[_0x6eeb('0x31')](_0x387d1f,_0x6eeb('0x2f'));_0x44d532[_0x6eeb('0x34')]=_[_0x6eeb('0x35')](_0xd230b6[_0x6eeb('0x34')]);_0x44d532[_0x6eeb('0x36')]=_[_0x6eeb('0x37')](_0x44d532[_0x6eeb('0x33')],_0x44d532[_0x6eeb('0x34')]);_0x307110[_0x6eeb('0x38')]=_[_0x6eeb('0x37')](_0x44d532[_0x6eeb('0x33')],qs[_0x6eeb('0x39')](_0xd230b6['query']['fields']));_0x307110[_0x6eeb('0x38')]=_0x307110['attributes'][_0x6eeb('0x3a')]?_0x307110[_0x6eeb('0x38')]:_0x44d532['model'];if(!_0xd230b6['query'][_0x6eeb('0x3b')]('nolimit')){_0x307110[_0x6eeb('0x21')]=qs[_0x6eeb('0x21')](_0xd230b6[_0x6eeb('0x34')][_0x6eeb('0x21')]);_0x307110[_0x6eeb('0x23')]=qs[_0x6eeb('0x23')](_0xd230b6[_0x6eeb('0x34')][_0x6eeb('0x23')]);}_0x307110[_0x6eeb('0x3c')]=qs[_0x6eeb('0x3d')](_0xd230b6[_0x6eeb('0x34')][_0x6eeb('0x3d')]);_0x307110[_0x6eeb('0x3e')]=qs[_0x6eeb('0x36')](_['pick'](_0xd230b6['query'],_0x44d532[_0x6eeb('0x36')]),_0x387d1f);if(_0xd230b6[_0x6eeb('0x34')][_0x6eeb('0x3f')]){_0x307110['where']=_[_0x6eeb('0x40')](_0x307110[_0x6eeb('0x3e')],{'$or':[{'key':{'$like':'%'+_0xd230b6[_0x6eeb('0x34')][_0x6eeb('0x3f')]+'%'}},{'value':{'$like':'%'+_0xd230b6[_0x6eeb('0x34')][_0x6eeb('0x3f')]+'%'}}]});}_0x307110=_['merge']({},_0x307110,_0xd230b6[_0x6eeb('0x41')]);var _0x42ae70={'where':_0x307110[_0x6eeb('0x3e')]};return db['CannedAnswer'][_0x6eeb('0x22')](_0x42ae70)['then'](function(_0x504a26){_0x3d7411[_0x6eeb('0x22')]=_0x504a26;if(_0xd230b6[_0x6eeb('0x34')]['includeAll']){_0x307110['include']=[{'all':!![]}];}return db[_0x6eeb('0x42')][_0x6eeb('0x43')](_0x307110);})['then'](function(_0x26f1ec){_0x3d7411[_0x6eeb('0x44')]=_0x26f1ec;return _0x3d7411;})['then'](respondWithFilteredResult(_0x547838,_0x307110))[_0x6eeb('0x45')](handleError(_0x547838,null));};exports['show']=function(_0x41bd2d,_0x2f4dd5){var _0x31d839={'raw':!![],'where':{'id':_0x41bd2d[_0x6eeb('0x46')]['id']}},_0x586c3e={};_0x586c3e['model']=_['keys'](db[_0x6eeb('0x42')][_0x6eeb('0x47')]);_0x586c3e[_0x6eeb('0x34')]=_[_0x6eeb('0x35')](_0x41bd2d[_0x6eeb('0x34')]);_0x586c3e[_0x6eeb('0x36')]=_['intersection'](_0x586c3e[_0x6eeb('0x33')],_0x586c3e[_0x6eeb('0x34')]);_0x31d839[_0x6eeb('0x38')]=_[_0x6eeb('0x37')](_0x586c3e['model'],qs['fields'](_0x41bd2d['query'][_0x6eeb('0x39')]));_0x31d839['attributes']=_0x31d839[_0x6eeb('0x38')]['length']?_0x31d839[_0x6eeb('0x38')]:_0x586c3e[_0x6eeb('0x33')];if(_0x41bd2d['query'][_0x6eeb('0x48')]){_0x31d839[_0x6eeb('0x49')]=[{'all':!![]}];}_0x31d839=_[_0x6eeb('0x40')]({},_0x31d839,_0x41bd2d['options']);return db[_0x6eeb('0x42')][_0x6eeb('0x4a')](_0x31d839)['then'](handleEntityNotFound(_0x2f4dd5,null))[_0x6eeb('0x29')](respondWithResult(_0x2f4dd5,null))['catch'](handleError(_0x2f4dd5,null));};exports[_0x6eeb('0x4b')]=function(_0x4820fa,_0x250793){if(_0x4820fa[_0x6eeb('0x4c')]['id']){delete _0x4820fa[_0x6eeb('0x4c')]['id'];}return db['CannedAnswer'][_0x6eeb('0x4a')]({'where':{'id':_0x4820fa[_0x6eeb('0x46')]['id']}})[_0x6eeb('0x29')](handleEntityNotFound(_0x250793,null))['then'](saveUpdates(_0x4820fa[_0x6eeb('0x4c')],null))['then'](respondWithResult(_0x250793,null))['catch'](handleError(_0x250793,null));};exports[_0x6eeb('0x2a')]=function(_0x30926b,_0xdaa29f){return db[_0x6eeb('0x42')]['find']({'where':{'id':_0x30926b[_0x6eeb('0x46')]['id']}})[_0x6eeb('0x29')](handleEntityNotFound(_0xdaa29f,null))['then'](removeEntity(_0xdaa29f,null))[_0x6eeb('0x45')](handleError(_0xdaa29f,null));};exports['create']=function(_0xc3265a,_0x4ca14b){var _0x2affde={'key':_0xc3265a[_0x6eeb('0x4c')][_0x6eeb('0x32')]};if(_0xc3265a[_0x6eeb('0x4c')]['MailAccountId']){_0x2affde[_0x6eeb('0x4d')]=_0xc3265a[_0x6eeb('0x4c')][_0x6eeb('0x4d')];}else if(_0xc3265a[_0x6eeb('0x4c')]['SmsAccountId']){_0x2affde[_0x6eeb('0x4e')]=_0xc3265a['body'][_0x6eeb('0x4e')];}else if(_0xc3265a[_0x6eeb('0x4c')][_0x6eeb('0x4f')]){_0x2affde['OpenchannelAccountId']=_0xc3265a[_0x6eeb('0x4c')][_0x6eeb('0x4f')];}else if(_0xc3265a[_0x6eeb('0x4c')][_0x6eeb('0x50')]){_0x2affde['ChatWebsiteId']=_0xc3265a[_0x6eeb('0x4c')][_0x6eeb('0x50')];}return db[_0x6eeb('0x42')][_0x6eeb('0x4a')]({'where':_0x2affde})[_0x6eeb('0x29')](function(_0x20bd0a){if(_0x20bd0a){throw new db[(_0x6eeb('0x51'))][(_0x6eeb('0x52'))]('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer'][_0x6eeb('0x53')](_0xc3265a[_0x6eeb('0x4c')]);})['then'](function(_0x4a3e5d){var _0x366711=_0xc3265a[_0x6eeb('0x54')]['get']({'plain':!![]});if(!_0x366711)throw new Error(_0x6eeb('0x55'));if(_0x366711[_0x6eeb('0x56')]===_0x6eeb('0x54')){var _0x2f2ae4=_0x4a3e5d[_0x6eeb('0x2b')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x6eeb('0x2c'),'userProfileId':_0x366711[_0x6eeb('0x57')]},'raw':!![]})[_0x6eeb('0x29')](function(_0x384216){if(_0x384216&&_0x384216['autoAssociation']===0x0){return db[_0x6eeb('0x2d')]['create']({'name':_0x2f2ae4[_0x6eeb('0x2f')],'resourceId':_0x2f2ae4['id'],'type':_0x384216[_0x6eeb('0x2f')],'sectionId':_0x384216['id']},{})[_0x6eeb('0x29')](function(){return _0x4a3e5d;});}else{return _0x4a3e5d;}})['catch'](function(_0x4f2e03){logger['error'](_0x6eeb('0x58'),_0x4f2e03);throw _0x4f2e03;});}return _0x4a3e5d;})['then'](respondWithResult(_0x4ca14b,0xc9))[_0x6eeb('0x45')](handleError(_0x4ca14b,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 6e6ff29..261b1eb 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 _0x8ac5=['utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','../../config/environment','define','CannedAnswer','tools_canned_answers'];(function(_0x54c231,_0x41508f){var _0x3801b7=function(_0x44d5b6){while(--_0x44d5b6){_0x54c231['push'](_0x54c231['shift']());}};_0x3801b7(++_0x41508f);}(_0x8ac5,0x109));var _0x58ac=function(_0x16973f,_0x403b11){_0x16973f=_0x16973f-0x0;var _0x31204e=_0x8ac5[_0x16973f];return _0x31204e;};'use strict';var _=require('lodash');var util=require(_0x58ac('0x0'));var logger=require('../../config/logger')(_0x58ac('0x1'));var moment=require(_0x58ac('0x2'));var BPromise=require(_0x58ac('0x3'));var rp=require(_0x58ac('0x4'));var fs=require('fs');var path=require(_0x58ac('0x5'));var rimraf=require('rimraf');var config=require(_0x58ac('0x6'));var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x1500e8,_0x5e8279){return _0x1500e8[_0x58ac('0x7')](_0x58ac('0x8'),attributes,{'tableName':_0x58ac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x58ac('0xa')});}; \ No newline at end of file +var _0x3183=['../../config/environment','exports','tools_canned_answers','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x30b094,_0x555417){var _0x4337f3=function(_0x593f40){while(--_0x593f40){_0x30b094['push'](_0x30b094['shift']());}};_0x4337f3(++_0x555417);}(_0x3183,0x16c));var _0x3318=function(_0x673722,_0x275d7e){_0x673722=_0x673722-0x0;var _0x21249c=_0x3183[_0x673722];return _0x21249c;};'use strict';var _=require(_0x3318('0x0'));var util=require(_0x3318('0x1'));var logger=require(_0x3318('0x2'))('api');var moment=require(_0x3318('0x3'));var BPromise=require(_0x3318('0x4'));var rp=require(_0x3318('0x5'));var fs=require('fs');var path=require(_0x3318('0x6'));var rimraf=require(_0x3318('0x7'));var config=require(_0x3318('0x8'));var attributes=require('./cannedAnswer.attributes');module[_0x3318('0x9')]=function(_0x417620,_0x4deeb4){return _0x417620['define']('CannedAnswer',attributes,{'tableName':_0x3318('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3318('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index d392e8c..a107e87 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(_0x54bea7,_0xf44402){var _0x2be924=function(_0x5b7618){while(--_0x5b7618){_0x54bea7['push'](_0x54bea7['shift']());}};_0x2be924(++_0xf44402);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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(_0x2fd7a7,_0x896d96){var _0x10d47f=function(_0x1a51f4){while(--_0x1a51f4){_0x2fd7a7['push'](_0x2fd7a7['shift']());}};_0x10d47f(++_0x896d96);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 67a8e73..7ea7cf6 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 _0xccde=['show','post','put','isAuthenticated','update','exports','util','path','connect-timeout','express','fs-extra','../../config/environment','./cannedAnswer.controller','get','index','/:id'];(function(_0x563f9d,_0x51c26f){var _0x9f3eb1=function(_0x3ded16){while(--_0x3ded16){_0x563f9d['push'](_0x563f9d['shift']());}};_0x9f3eb1(++_0x51c26f);}(_0xccde,0x116));var _0xeccd=function(_0x4f83ca,_0x46f67a){_0x4f83ca=_0x4f83ca-0x0;var _0x1fbac3=_0xccde[_0x4f83ca];return _0x1fbac3;};'use strict';var multer=require('multer');var util=require(_0xeccd('0x0'));var path=require(_0xeccd('0x1'));var timeout=require(_0xeccd('0x2'));var express=require(_0xeccd('0x3'));var router=express['Router']();var fs_extra=require(_0xeccd('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xeccd('0x5'));var controller=require(_0xeccd('0x6'));router[_0xeccd('0x7')]('/',auth['isAuthenticated'](),controller[_0xeccd('0x8')]);router[_0xeccd('0x7')](_0xeccd('0x9'),auth['isAuthenticated'](),controller[_0xeccd('0xa')]);router[_0xeccd('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xeccd('0xc')]('/:id',auth[_0xeccd('0xd')](),controller[_0xeccd('0xe')]);router['delete'](_0xeccd('0x9'),auth[_0xeccd('0xd')](),controller['destroy']);module[_0xeccd('0xf')]=router; \ No newline at end of file +var _0x3296=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','show','create','put','update','delete'];(function(_0x575f12,_0x3dfdeb){var _0x5c1887=function(_0x4fa75b){while(--_0x4fa75b){_0x575f12['push'](_0x575f12['shift']());}};_0x5c1887(++_0x3dfdeb);}(_0x3296,0x92));var _0x6329=function(_0x19c0ea,_0x5973a8){_0x19c0ea=_0x19c0ea-0x0;var _0x3700e8=_0x3296[_0x19c0ea];return _0x3700e8;};'use strict';var multer=require(_0x6329('0x0'));var util=require(_0x6329('0x1'));var path=require(_0x6329('0x2'));var timeout=require(_0x6329('0x3'));var express=require(_0x6329('0x4'));var router=express['Router']();var fs_extra=require(_0x6329('0x5'));var auth=require(_0x6329('0x6'));var interaction=require(_0x6329('0x7'));var config=require(_0x6329('0x8'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0x6329('0x9')](),controller['index']);router['get'](_0x6329('0xa'),auth[_0x6329('0x9')](),controller[_0x6329('0xb')]);router['post']('/',auth[_0x6329('0x9')](),controller[_0x6329('0xc')]);router[_0x6329('0xd')](_0x6329('0xa'),auth[_0x6329('0x9')](),controller[_0x6329('0xe')]);router[_0x6329('0xf')](_0x6329('0xa'),auth['isAuthenticated'](),controller[_0x6329('0x10')]);module[_0x6329('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 5823497..544dc13 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 _0xfbac=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','exports'];(function(_0x2a6466,_0x1b7072){var _0x1c0a62=function(_0x5c7c5c){while(--_0x5c7c5c){_0x2a6466['push'](_0x2a6466['shift']());}};_0x1c0a62(++_0x1b7072);}(_0xfbac,0x167));var _0xcfba=function(_0x3f26b3,_0x4fc939){_0x3f26b3=_0x3f26b3-0x0;var _0x5d7512=_0xfbac[_0x3f26b3];return _0x5d7512;};'use strict';var Sequelize=require('sequelize');module[_0xcfba('0x0')]={'calldate':{'type':Sequelize[_0xcfba('0x1')],'allowNull':![],'defaultValue':_0xcfba('0x2')},'clid':{'type':Sequelize[_0xcfba('0x3')]},'src':{'type':Sequelize[_0xcfba('0x3')]},'dst':{'type':Sequelize[_0xcfba('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xcfba('0x3')]},'lastapp':{'type':Sequelize[_0xcfba('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xcfba('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xcfba('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xcfba('0x3')]},'uniqueid':{'type':Sequelize[_0xcfba('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xcfba('0x3')]},'peeraccount':{'type':Sequelize[_0xcfba('0x3')]},'type':{'type':Sequelize[_0xcfba('0x3')]},'tag':{'type':Sequelize[_0xcfba('0x3')]}}; \ No newline at end of file +var _0xa769=['INTEGER','sequelize','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xa769,0xfb));var _0x9a76=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xa769[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0x9a76('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x9a76('0x1')],'allowNull':![],'defaultValue':_0x9a76('0x2')},'clid':{'type':Sequelize[_0x9a76('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x9a76('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x9a76('0x3')]},'lastapp':{'type':Sequelize[_0x9a76('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x9a76('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x9a76('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9a76('0x3')]},'amaflags':{'type':Sequelize[_0x9a76('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x9a76('0x3')]},'userfield':{'type':Sequelize[_0x9a76('0x3')]},'uniqueid':{'type':Sequelize[_0x9a76('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x9a76('0x3')]},'peeraccount':{'type':Sequelize[_0x9a76('0x3')]},'type':{'type':Sequelize[_0x9a76('0x3')]},'tag':{'type':Sequelize[_0x9a76('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 46e27ba..574a915 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 _0x5162=['undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','intersection','find','create','body','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5162,0x103));var _0x2516=function(_0x11d684,_0x4d4123){_0x11d684=_0x11d684-0x0;var _0x78a301=_0x5162[_0x11d684];return _0x78a301;};'use strict';var emlformat=require(_0x2516('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2516('0x1'));var BPromise=require(_0x2516('0x2'));var Mustache=require(_0x2516('0x3'));var util=require(_0x2516('0x4'));var path=require(_0x2516('0x5'));var sox=require(_0x2516('0x6'));var csv=require(_0x2516('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2516('0x8'));var crypto=require(_0x2516('0x9'));var jsforce=require(_0x2516('0xa'));var deskjs=require(_0x2516('0xb'));var toCsv=require(_0x2516('0x7'));var querystring=require(_0x2516('0xc'));var Papa=require(_0x2516('0xd'));var Redis=require('ioredis');var authService=require(_0x2516('0xe'));var qs=require(_0x2516('0xf'));var as=require(_0x2516('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2516('0x11'));var licenseUtil=require(_0x2516('0x12'));var db=require(_0x2516('0x13'))['db'];function respondWithStatusCode(_0x3ef6ff,_0x56c69c){_0x56c69c=_0x56c69c||0xcc;return function(_0x33496b){if(_0x33496b){return _0x3ef6ff[_0x2516('0x14')](_0x56c69c);}return _0x3ef6ff[_0x2516('0x15')](_0x56c69c)[_0x2516('0x16')]();};}function respondWithResult(_0x42c771,_0x558d20){_0x558d20=_0x558d20||0xc8;return function(_0x3e5e0f){if(_0x3e5e0f){return _0x42c771[_0x2516('0x15')](_0x558d20)[_0x2516('0x17')](_0x3e5e0f);}};}function respondWithFilteredResult(_0x181a28,_0x2637e8){return function(_0x2ec31f){if(_0x2ec31f){var _0x19aacb=typeof _0x2637e8[_0x2516('0x18')]===_0x2516('0x19')&&typeof _0x2637e8['limit']===_0x2516('0x19');var _0x1ced29=_0x2ec31f[_0x2516('0x1a')];var _0x564d05=_0x19aacb?0x0:_0x2637e8[_0x2516('0x18')];var _0x5e96c7=_0x19aacb?_0x2ec31f['count']:_0x2637e8[_0x2516('0x18')]+_0x2637e8[_0x2516('0x1b')];var _0x151168;if(_0x5e96c7>=_0x1ced29){_0x5e96c7=_0x1ced29;_0x151168=0xc8;}else{_0x151168=0xce;}_0x181a28[_0x2516('0x15')](_0x151168);return _0x181a28[_0x2516('0x1c')](_0x2516('0x1d'),_0x564d05+'-'+_0x5e96c7+'/'+_0x1ced29)[_0x2516('0x17')](_0x2ec31f);}return null;};}function patchUpdates(_0x113616){return function(_0x248c5a){try{jsonpatch[_0x2516('0x1e')](_0x248c5a,_0x113616,!![]);}catch(_0x39ba5b){return BPromise[_0x2516('0x1f')](_0x39ba5b);}return _0x248c5a[_0x2516('0x20')]();};}function saveUpdates(_0x4fb7d9,_0x559a3e){return function(_0x12db4d){if(_0x12db4d){return _0x12db4d[_0x2516('0x21')](_0x4fb7d9)[_0x2516('0x22')](function(_0x2d5b1b){return _0x2d5b1b;});}return null;};}function removeEntity(_0x3ffb6d,_0x32de7a){return function(_0x3d906d){if(_0x3d906d){return _0x3d906d[_0x2516('0x23')]()['then'](function(){_0x3ffb6d[_0x2516('0x15')](0xcc)[_0x2516('0x16')]();});}};}function handleEntityNotFound(_0x774b60,_0x434d54){return function(_0x47f4fb){if(!_0x47f4fb){_0x774b60[_0x2516('0x14')](0x194);}return _0x47f4fb;};}function handleError(_0x30eeb9,_0x1f722c){_0x1f722c=_0x1f722c||0x1f4;return function(_0x3d728a){logger[_0x2516('0x24')](_0x3d728a['stack']);if(_0x3d728a[_0x2516('0x25')]){delete _0x3d728a[_0x2516('0x25')];}_0x30eeb9[_0x2516('0x15')](_0x1f722c)[_0x2516('0x26')](_0x3d728a);};}exports[_0x2516('0x27')]=function(_0x285e67,_0x556f01){var _0x136893={},_0x20dc9f={},_0x493a3e={'count':0x0,'rows':[]};var _0x19d90d=_[_0x2516('0x28')](db[_0x2516('0x29')][_0x2516('0x2a')],function(_0x539704){return{'name':_0x539704[_0x2516('0x2b')],'type':_0x539704[_0x2516('0x2c')][_0x2516('0x2d')]};});_0x20dc9f[_0x2516('0x2e')]=_[_0x2516('0x28')](_0x19d90d,_0x2516('0x25'));_0x20dc9f[_0x2516('0x2f')]=_[_0x2516('0x30')](_0x285e67[_0x2516('0x2f')]);_0x20dc9f[_0x2516('0x31')]=_['intersection'](_0x20dc9f[_0x2516('0x2e')],_0x20dc9f['query']);_0x136893[_0x2516('0x32')]=_['intersection'](_0x20dc9f[_0x2516('0x2e')],qs['fields'](_0x285e67[_0x2516('0x2f')][_0x2516('0x33')]));_0x136893[_0x2516('0x32')]=_0x136893[_0x2516('0x32')][_0x2516('0x34')]?_0x136893[_0x2516('0x32')]:_0x20dc9f[_0x2516('0x2e')];if(!_0x285e67[_0x2516('0x2f')][_0x2516('0x35')]('nolimit')){_0x136893[_0x2516('0x1b')]=qs[_0x2516('0x1b')](_0x285e67[_0x2516('0x2f')][_0x2516('0x1b')]);_0x136893['offset']=qs['offset'](_0x285e67[_0x2516('0x2f')][_0x2516('0x18')]);}_0x136893[_0x2516('0x36')]=qs[_0x2516('0x37')](_0x285e67[_0x2516('0x2f')][_0x2516('0x37')]);_0x136893[_0x2516('0x38')]=qs[_0x2516('0x31')](_[_0x2516('0x39')](_0x285e67[_0x2516('0x2f')],_0x20dc9f['filters']),_0x19d90d);if(_0x285e67['query'][_0x2516('0x3a')]){_0x136893[_0x2516('0x38')]=_['merge'](_0x136893['where'],{'$or':_[_0x2516('0x28')](_0x19d90d,function(_0x3b310f){if(_0x3b310f['type']!==_0x2516('0x3b')){var _0x52ef6b={};_0x52ef6b[_0x3b310f[_0x2516('0x25')]]={'$like':'%'+_0x285e67[_0x2516('0x2f')]['filter']+'%'};return _0x52ef6b;}})});}_0x136893=_[_0x2516('0x3c')]({},_0x136893,_0x285e67[_0x2516('0x3d')]);var _0x155cf7={'where':_0x136893[_0x2516('0x38')]};return db[_0x2516('0x29')][_0x2516('0x1a')](_0x155cf7)[_0x2516('0x22')](function(_0x2371a8){_0x493a3e[_0x2516('0x1a')]=_0x2371a8;if(_0x285e67[_0x2516('0x2f')][_0x2516('0x3e')]){_0x136893[_0x2516('0x3f')]=[{'all':!![]}];}return db[_0x2516('0x29')]['findAll'](_0x136893);})[_0x2516('0x22')](function(_0x1bc0e){_0x493a3e['rows']=_0x1bc0e;return _0x493a3e;})[_0x2516('0x22')](respondWithFilteredResult(_0x556f01,_0x136893))[_0x2516('0x40')](handleError(_0x556f01,null));};exports[_0x2516('0x41')]=function(_0x1afefb,_0x421c58){var _0x582cb6={'raw':!![],'where':{'id':_0x1afefb[_0x2516('0x42')]['id']}},_0x1a8d2d={};_0x1a8d2d[_0x2516('0x2e')]=_[_0x2516('0x30')](db[_0x2516('0x29')][_0x2516('0x2a')]);_0x1a8d2d['query']=_[_0x2516('0x30')](_0x1afefb[_0x2516('0x2f')]);_0x1a8d2d[_0x2516('0x31')]=_[_0x2516('0x43')](_0x1a8d2d[_0x2516('0x2e')],_0x1a8d2d[_0x2516('0x2f')]);_0x582cb6[_0x2516('0x32')]=_['intersection'](_0x1a8d2d[_0x2516('0x2e')],qs['fields'](_0x1afefb[_0x2516('0x2f')]['fields']));_0x582cb6[_0x2516('0x32')]=_0x582cb6[_0x2516('0x32')][_0x2516('0x34')]?_0x582cb6['attributes']:_0x1a8d2d['model'];if(_0x1afefb[_0x2516('0x2f')][_0x2516('0x3e')]){_0x582cb6['include']=[{'all':!![]}];}_0x582cb6=_['merge']({},_0x582cb6,_0x1afefb[_0x2516('0x3d')]);return db[_0x2516('0x29')][_0x2516('0x44')](_0x582cb6)['then'](handleEntityNotFound(_0x421c58,null))[_0x2516('0x22')](respondWithResult(_0x421c58,null))['catch'](handleError(_0x421c58,null));};exports[_0x2516('0x45')]=function(_0x39fd32,_0x318128){return db[_0x2516('0x29')]['create'](_0x39fd32[_0x2516('0x46')],{})[_0x2516('0x22')](respondWithResult(_0x318128,0xc9))[_0x2516('0x40')](handleError(_0x318128,null));};exports[_0x2516('0x21')]=function(_0x43874c,_0x482883){if(_0x43874c[_0x2516('0x46')]['id']){delete _0x43874c[_0x2516('0x46')]['id'];}return db[_0x2516('0x29')][_0x2516('0x44')]({'where':{'id':_0x43874c['params']['id']}})[_0x2516('0x22')](handleEntityNotFound(_0x482883,null))[_0x2516('0x22')](saveUpdates(_0x43874c[_0x2516('0x46')],null))[_0x2516('0x22')](respondWithResult(_0x482883,null))[_0x2516('0x40')](handleError(_0x482883,null));};exports['destroy']=function(_0x1c4be3,_0x1aa854){return db[_0x2516('0x29')][_0x2516('0x44')]({'where':{'id':_0x1c4be3[_0x2516('0x42')]['id']}})[_0x2516('0x22')](handleEntityNotFound(_0x1aa854,null))['then'](removeEntity(_0x1aa854,null))['catch'](handleError(_0x1aa854,null));};exports['describe']=function(_0x323590,_0x4f7eb4){return db['Cdr']['describe']()[_0x2516('0x22')](respondWithResult(_0x4f7eb4,null))[_0x2516('0x40')](handleError(_0x4f7eb4,null));}; \ No newline at end of file +var _0xa3e6=['offset','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','Cdr','fieldName','type','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','where','VIRTUAL','options','include','findAll','catch','params','rawAttributes','includeAll','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x109e21,_0x4ab3a8){var _0x55a4bc=function(_0x15083d){while(--_0x15083d){_0x109e21['push'](_0x109e21['shift']());}};_0x55a4bc(++_0x4ab3a8);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x54b1c8,_0x589a5e){_0x54b1c8=_0x54b1c8-0x0;var _0x1e31e6=_0xa3e6[_0x54b1c8];return _0x1e31e6;};'use strict';var emlformat=require(_0x6a3e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6a3e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a3e('0x2'));var moment=require(_0x6a3e('0x3'));var BPromise=require(_0x6a3e('0x4'));var Mustache=require('mustache');var util=require(_0x6a3e('0x5'));var path=require('path');var sox=require(_0x6a3e('0x6'));var csv=require(_0x6a3e('0x7'));var ejs=require(_0x6a3e('0x8'));var fs=require('fs');var fs_extra=require(_0x6a3e('0x9'));var _=require(_0x6a3e('0xa'));var squel=require('squel');var crypto=require(_0x6a3e('0xb'));var jsforce=require(_0x6a3e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6a3e('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6a3e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6a3e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6a3e('0x10'))(_0x6a3e('0x11'));var utils=require(_0x6a3e('0x12'));var config=require(_0x6a3e('0x13'));var licenseUtil=require(_0x6a3e('0x14'));var db=require(_0x6a3e('0x15'))['db'];function respondWithStatusCode(_0x4a3a97,_0x27e169){_0x27e169=_0x27e169||0xcc;return function(_0x385c29){if(_0x385c29){return _0x4a3a97[_0x6a3e('0x16')](_0x27e169);}return _0x4a3a97[_0x6a3e('0x17')](_0x27e169)[_0x6a3e('0x18')]();};}function respondWithResult(_0x31aefa,_0x222f7c){_0x222f7c=_0x222f7c||0xc8;return function(_0x4bd05f){if(_0x4bd05f){return _0x31aefa[_0x6a3e('0x17')](_0x222f7c)[_0x6a3e('0x19')](_0x4bd05f);}};}function respondWithFilteredResult(_0x8ed74b,_0x2a62a8){return function(_0x500ccd){if(_0x500ccd){var _0x462b8d=typeof _0x2a62a8[_0x6a3e('0x1a')]==='undefined'&&typeof _0x2a62a8['limit']==='undefined';var _0x58b221=_0x500ccd['count'];var _0x3693a2=_0x462b8d?0x0:_0x2a62a8[_0x6a3e('0x1a')];var _0x31a190=_0x462b8d?_0x500ccd[_0x6a3e('0x1b')]:_0x2a62a8[_0x6a3e('0x1a')]+_0x2a62a8[_0x6a3e('0x1c')];var _0x1d6ccc;if(_0x31a190>=_0x58b221){_0x31a190=_0x58b221;_0x1d6ccc=0xc8;}else{_0x1d6ccc=0xce;}_0x8ed74b[_0x6a3e('0x17')](_0x1d6ccc);return _0x8ed74b['set'](_0x6a3e('0x1d'),_0x3693a2+'-'+_0x31a190+'/'+_0x58b221)['json'](_0x500ccd);}return null;};}function patchUpdates(_0xc0452f){return function(_0x5ae73b){try{jsonpatch[_0x6a3e('0x1e')](_0x5ae73b,_0xc0452f,!![]);}catch(_0x131d80){return BPromise[_0x6a3e('0x1f')](_0x131d80);}return _0x5ae73b[_0x6a3e('0x20')]();};}function saveUpdates(_0x58721c,_0x4f7507){return function(_0x215ac1){if(_0x215ac1){return _0x215ac1[_0x6a3e('0x21')](_0x58721c)[_0x6a3e('0x22')](function(_0x4687d0){return _0x4687d0;});}return null;};}function removeEntity(_0x4e5a25,_0x1ae966){return function(_0x21b5aa){if(_0x21b5aa){return _0x21b5aa[_0x6a3e('0x23')]()[_0x6a3e('0x22')](function(){_0x4e5a25[_0x6a3e('0x17')](0xcc)[_0x6a3e('0x18')]();});}};}function handleEntityNotFound(_0x359460,_0x83e681){return function(_0x25fc14){if(!_0x25fc14){_0x359460[_0x6a3e('0x16')](0x194);}return _0x25fc14;};}function handleError(_0x5b1ed9,_0x4ec834){_0x4ec834=_0x4ec834||0x1f4;return function(_0x150992){logger[_0x6a3e('0x24')](_0x150992[_0x6a3e('0x25')]);if(_0x150992[_0x6a3e('0x26')]){delete _0x150992[_0x6a3e('0x26')];}_0x5b1ed9[_0x6a3e('0x17')](_0x4ec834)[_0x6a3e('0x27')](_0x150992);};}exports[_0x6a3e('0x28')]=function(_0xd87198,_0x436169){var _0x3a831b={},_0x508a55={},_0x4eec67={'count':0x0,'rows':[]};var _0x2a2b2a=_['map'](db[_0x6a3e('0x29')]['rawAttributes'],function(_0x553fc5){return{'name':_0x553fc5[_0x6a3e('0x2a')],'type':_0x553fc5[_0x6a3e('0x2b')]['key']};});_0x508a55['model']=_[_0x6a3e('0x2c')](_0x2a2b2a,_0x6a3e('0x26'));_0x508a55[_0x6a3e('0x2d')]=_[_0x6a3e('0x2e')](_0xd87198['query']);_0x508a55['filters']=_[_0x6a3e('0x2f')](_0x508a55[_0x6a3e('0x30')],_0x508a55[_0x6a3e('0x2d')]);_0x3a831b[_0x6a3e('0x31')]=_['intersection'](_0x508a55[_0x6a3e('0x30')],qs[_0x6a3e('0x32')](_0xd87198['query']['fields']));_0x3a831b['attributes']=_0x3a831b[_0x6a3e('0x31')][_0x6a3e('0x33')]?_0x3a831b[_0x6a3e('0x31')]:_0x508a55[_0x6a3e('0x30')];if(!_0xd87198[_0x6a3e('0x2d')][_0x6a3e('0x34')](_0x6a3e('0x35'))){_0x3a831b[_0x6a3e('0x1c')]=qs[_0x6a3e('0x1c')](_0xd87198[_0x6a3e('0x2d')][_0x6a3e('0x1c')]);_0x3a831b[_0x6a3e('0x1a')]=qs[_0x6a3e('0x1a')](_0xd87198[_0x6a3e('0x2d')][_0x6a3e('0x1a')]);}_0x3a831b['order']=qs[_0x6a3e('0x36')](_0xd87198[_0x6a3e('0x2d')][_0x6a3e('0x36')]);_0x3a831b['where']=qs[_0x6a3e('0x37')](_[_0x6a3e('0x38')](_0xd87198['query'],_0x508a55[_0x6a3e('0x37')]),_0x2a2b2a);if(_0xd87198[_0x6a3e('0x2d')][_0x6a3e('0x39')]){_0x3a831b['where']=_[_0x6a3e('0x3a')](_0x3a831b[_0x6a3e('0x3b')],{'$or':_[_0x6a3e('0x2c')](_0x2a2b2a,function(_0x3e604c){if(_0x3e604c[_0x6a3e('0x2b')]!==_0x6a3e('0x3c')){var _0x5f4ff5={};_0x5f4ff5[_0x3e604c[_0x6a3e('0x26')]]={'$like':'%'+_0xd87198['query']['filter']+'%'};return _0x5f4ff5;}})});}_0x3a831b=_['merge']({},_0x3a831b,_0xd87198[_0x6a3e('0x3d')]);var _0x4bb1ba={'where':_0x3a831b[_0x6a3e('0x3b')]};return db[_0x6a3e('0x29')][_0x6a3e('0x1b')](_0x4bb1ba)[_0x6a3e('0x22')](function(_0xca83d2){_0x4eec67[_0x6a3e('0x1b')]=_0xca83d2;if(_0xd87198['query']['includeAll']){_0x3a831b[_0x6a3e('0x3e')]=[{'all':!![]}];}return db[_0x6a3e('0x29')][_0x6a3e('0x3f')](_0x3a831b);})[_0x6a3e('0x22')](function(_0x1dd524){_0x4eec67['rows']=_0x1dd524;return _0x4eec67;})[_0x6a3e('0x22')](respondWithFilteredResult(_0x436169,_0x3a831b))[_0x6a3e('0x40')](handleError(_0x436169,null));};exports['show']=function(_0x35c927,_0x417f8a){var _0x35c836={'raw':!![],'where':{'id':_0x35c927[_0x6a3e('0x41')]['id']}},_0x53ad48={};_0x53ad48[_0x6a3e('0x30')]=_[_0x6a3e('0x2e')](db[_0x6a3e('0x29')][_0x6a3e('0x42')]);_0x53ad48[_0x6a3e('0x2d')]=_['keys'](_0x35c927[_0x6a3e('0x2d')]);_0x53ad48[_0x6a3e('0x37')]=_[_0x6a3e('0x2f')](_0x53ad48['model'],_0x53ad48[_0x6a3e('0x2d')]);_0x35c836['attributes']=_['intersection'](_0x53ad48[_0x6a3e('0x30')],qs[_0x6a3e('0x32')](_0x35c927[_0x6a3e('0x2d')]['fields']));_0x35c836['attributes']=_0x35c836[_0x6a3e('0x31')][_0x6a3e('0x33')]?_0x35c836[_0x6a3e('0x31')]:_0x53ad48[_0x6a3e('0x30')];if(_0x35c927[_0x6a3e('0x2d')][_0x6a3e('0x43')]){_0x35c836['include']=[{'all':!![]}];}_0x35c836=_[_0x6a3e('0x3a')]({},_0x35c836,_0x35c927[_0x6a3e('0x3d')]);return db[_0x6a3e('0x29')][_0x6a3e('0x44')](_0x35c836)[_0x6a3e('0x22')](handleEntityNotFound(_0x417f8a,null))[_0x6a3e('0x22')](respondWithResult(_0x417f8a,null))[_0x6a3e('0x40')](handleError(_0x417f8a,null));};exports[_0x6a3e('0x45')]=function(_0x2d0685,_0x4d36e2){return db[_0x6a3e('0x29')][_0x6a3e('0x45')](_0x2d0685['body'],{})[_0x6a3e('0x22')](respondWithResult(_0x4d36e2,0xc9))['catch'](handleError(_0x4d36e2,null));};exports[_0x6a3e('0x21')]=function(_0x10cd8e,_0x28a3e9){if(_0x10cd8e['body']['id']){delete _0x10cd8e[_0x6a3e('0x46')]['id'];}return db[_0x6a3e('0x29')]['find']({'where':{'id':_0x10cd8e['params']['id']}})['then'](handleEntityNotFound(_0x28a3e9,null))[_0x6a3e('0x22')](saveUpdates(_0x10cd8e[_0x6a3e('0x46')],null))[_0x6a3e('0x22')](respondWithResult(_0x28a3e9,null))[_0x6a3e('0x40')](handleError(_0x28a3e9,null));};exports[_0x6a3e('0x23')]=function(_0x448e46,_0x404473){return db[_0x6a3e('0x29')][_0x6a3e('0x44')]({'where':{'id':_0x448e46[_0x6a3e('0x41')]['id']}})[_0x6a3e('0x22')](handleEntityNotFound(_0x404473,null))['then'](removeEntity(_0x404473,null))[_0x6a3e('0x40')](handleError(_0x404473,null));};exports[_0x6a3e('0x47')]=function(_0x3fabf8,_0x21ba7b){return db[_0x6a3e('0x29')]['describe']()[_0x6a3e('0x22')](respondWithResult(_0x21ba7b,null))['catch'](handleError(_0x21ba7b,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index dc9dd33..4639cd2 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x51a8fa,_0x111c40){var _0x5baed=function(_0x55509a){while(--_0x55509a){_0x51a8fa['push'](_0x51a8fa['shift']());}};_0x5baed(++_0x111c40);}(_0x7a54,0x106));var _0x47a5=function(_0x4517dd,_0x16a95e){_0x4517dd=_0x4517dd-0x0;var _0x470db1=_0x7a54[_0x4517dd];return _0x470db1;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x5e59f4,_0x4417a7){var _0xec121=function(_0x1ae241){while(--_0x1ae241){_0x5e59f4['push'](_0x5e59f4['shift']());}};_0xec121(++_0x4417a7);}(_0x7a54,0x106));var _0x47a5=function(_0x20f2e6,_0x40914c){_0x20f2e6=_0x20f2e6-0x0;var _0xa566d=_0x7a54[_0x20f2e6];return _0xa566d;};'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 f5db0b8..52e99e2 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 _0x9c8e=['client','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','message','lodash','moment','bluebird','ioredis','../../config/utils','jayson/promise'];(function(_0x4ecd76,_0x79f1f3){var _0x240f34=function(_0x563f79){while(--_0x563f79){_0x4ecd76['push'](_0x4ecd76['shift']());}};_0x240f34(++_0x79f1f3);}(_0x9c8e,0x15a));var _0xe9c8=function(_0x146b71,_0x4ed1ce){_0x146b71=_0x146b71-0x0;var _0x211249=_0x9c8e[_0x146b71];return _0x211249;};'use strict';var _=require(_0xe9c8('0x0'));var util=require('util');var moment=require(_0xe9c8('0x1'));var BPromise=require(_0xe9c8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9c8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe9c8('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe9c8('0x5'));var client=jayson[_0xe9c8('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c6742,_0x10d3ea,_0x49018c){return new BPromise(function(_0x592e9d,_0x28c003){return client[_0xe9c8('0x7')](_0x3c6742,_0x49018c)[_0xe9c8('0x8')](function(_0x4b1960){logger[_0xe9c8('0x9')](_0xe9c8('0xa'),_0x10d3ea,_0xe9c8('0xb'));logger[_0xe9c8('0xc')](_0xe9c8('0xd'),_0x10d3ea,'request\x20sent',JSON['stringify'](_0x4b1960));if(_0x4b1960[_0xe9c8('0xe')]){if(_0x4b1960[_0xe9c8('0xe')]['code']===0x1f4){logger['error'](_0xe9c8('0xa'),_0x10d3ea,_0x4b1960['error'][_0xe9c8('0xf')]);return _0x28c003(_0x4b1960['error'][_0xe9c8('0xf')]);}logger[_0xe9c8('0xe')]('Cdr,\x20%s,\x20%s',_0x10d3ea,_0x4b1960['error'][_0xe9c8('0xf')]);return _0x592e9d(_0x4b1960[_0xe9c8('0xe')]['message']);}else{logger['info'](_0xe9c8('0xa'),_0x10d3ea,_0xe9c8('0xb'));_0x592e9d(_0x4b1960['result'][_0xe9c8('0xf')]);}})['catch'](function(_0x3e7bd4){logger[_0xe9c8('0xe')](_0xe9c8('0xa'),_0x10d3ea,_0x3e7bd4);_0x28c003(_0x3e7bd4);});});} \ No newline at end of file +var _0x0bfe=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1d2655,_0x403a64){var _0xf330a8=function(_0x21b3a4){while(--_0x21b3a4){_0x1d2655['push'](_0x1d2655['shift']());}};_0xf330a8(++_0x403a64);}(_0x0bfe,0x6e));var _0xe0bf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0bfe[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xe0bf('0x0'));var util=require('util');var moment=require(_0xe0bf('0x1'));var BPromise=require(_0xe0bf('0x2'));var rs=require(_0xe0bf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe0bf('0x4'))['db'];var utils=require(_0xe0bf('0x5'));var logger=require(_0xe0bf('0x6'))(_0xe0bf('0x7'));var config=require(_0xe0bf('0x8'));var jayson=require(_0xe0bf('0x9'));var client=jayson[_0xe0bf('0xa')][_0xe0bf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x114f8e,_0x1b642e,_0x884671){return new BPromise(function(_0x551ce5,_0x219600){return client[_0xe0bf('0xc')](_0x114f8e,_0x884671)[_0xe0bf('0xd')](function(_0x4e3f65){logger[_0xe0bf('0xe')](_0xe0bf('0xf'),_0x1b642e,_0xe0bf('0x10'));logger[_0xe0bf('0x11')]('Cdr,\x20%s,\x20%s,\x20%s',_0x1b642e,_0xe0bf('0x10'),JSON[_0xe0bf('0x12')](_0x4e3f65));if(_0x4e3f65[_0xe0bf('0x13')]){if(_0x4e3f65[_0xe0bf('0x13')]['code']===0x1f4){logger[_0xe0bf('0x13')]('Cdr,\x20%s,\x20%s',_0x1b642e,_0x4e3f65[_0xe0bf('0x13')]['message']);return _0x219600(_0x4e3f65[_0xe0bf('0x13')][_0xe0bf('0x14')]);}logger[_0xe0bf('0x13')](_0xe0bf('0xf'),_0x1b642e,_0x4e3f65[_0xe0bf('0x13')]['message']);return _0x551ce5(_0x4e3f65[_0xe0bf('0x13')]['message']);}else{logger[_0xe0bf('0xe')](_0xe0bf('0xf'),_0x1b642e,_0xe0bf('0x10'));_0x551ce5(_0x4e3f65[_0xe0bf('0x15')]['message']);}})[_0xe0bf('0x16')](function(_0x2c6401){logger[_0xe0bf('0x13')](_0xe0bf('0xf'),_0x1b642e,_0x2c6401);_0x219600(_0x2c6401);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 8c0cf7b..410d222 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x1793de,_0x4d7233){var _0x4f0309=function(_0x229ee7){while(--_0x229ee7){_0x1793de['push'](_0x1793de['shift']());}};_0x4f0309(++_0x4d7233);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x286314,_0x199345){var _0x713f9b=function(_0xa4325){while(--_0xa4325){_0x286314['push'](_0x286314['shift']());}};_0x713f9b(++_0x199345);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index abf28fc..b930ff1 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 _0xd350=['exports','INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x2c96f6,_0x877207){var _0x6d4808=function(_0x567e0c){while(--_0x567e0c){_0x2c96f6['push'](_0x2c96f6['shift']());}};_0x6d4808(++_0x877207);}(_0xd350,0x65));var _0x0d35=function(_0x1ac6e5,_0x40f47f){_0x1ac6e5=_0x1ac6e5-0x0;var _0x5877dc=_0xd350[_0x1ac6e5];return _0x5877dc;};'use strict';var Sequelize=require(_0x0d35('0x0'));module[_0x0d35('0x1')]={'priority':{'type':Sequelize[_0x0d35('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0d35('0x3')],'allowNull':![],'defaultValue':_0x0d35('0x4')},'appdata':{'type':Sequelize[_0x0d35('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0d35('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x067f=['sequelize','exports','STRING','noop','*,*,*,*'];(function(_0x40015a,_0x415db5){var _0x42f8a4=function(_0x5685ad){while(--_0x5685ad){_0x40015a['push'](_0x40015a['shift']());}};_0x42f8a4(++_0x415db5);}(_0x067f,0x1cc));var _0xf067=function(_0x3313a9,_0x2e9931){_0x3313a9=_0x3313a9-0x0;var _0x528769=_0x067f[_0x3313a9];return _0x528769;};'use strict';var Sequelize=require(_0xf067('0x0'));module[_0xf067('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf067('0x2')],'allowNull':![],'defaultValue':_0xf067('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xf067('0x2')]},'interval':{'type':Sequelize[_0xf067('0x2')],'defaultValue':_0xf067('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 6d50e90..08d7925 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 _0xf996=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','params','model','keys','ChatApplication','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','catch','body','find','eml-format','rimraf','zip-dir','request-promise'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0xf996,0x74));var _0x6f99=function(_0x175154,_0x223d6d){_0x175154=_0x175154-0x0;var _0x3c89bb=_0xf996[_0x175154];return _0x3c89bb;};'use strict';var emlformat=require(_0x6f99('0x0'));var rimraf=require(_0x6f99('0x1'));var zipdir=require(_0x6f99('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f99('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6f99('0x4'));var util=require(_0x6f99('0x5'));var path=require(_0x6f99('0x6'));var sox=require(_0x6f99('0x7'));var csv=require(_0x6f99('0x8'));var ejs=require(_0x6f99('0x9'));var fs=require('fs');var fs_extra=require(_0x6f99('0xa'));var _=require(_0x6f99('0xb'));var squel=require(_0x6f99('0xc'));var crypto=require(_0x6f99('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6f99('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6f99('0xf'));var Papa=require(_0x6f99('0x10'));var Redis=require(_0x6f99('0x11'));var authService=require(_0x6f99('0x12'));var qs=require(_0x6f99('0x13'));var as=require(_0x6f99('0x14'));var hardwareService=require(_0x6f99('0x15'));var logger=require(_0x6f99('0x16'))(_0x6f99('0x17'));var utils=require('../../config/utils');var config=require(_0x6f99('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55e7f0,_0x12081d){_0x12081d=_0x12081d||0xcc;return function(_0xa1af95){if(_0xa1af95){return _0x55e7f0[_0x6f99('0x19')](_0x12081d);}return _0x55e7f0[_0x6f99('0x1a')](_0x12081d)[_0x6f99('0x1b')]();};}function respondWithResult(_0x7aea00,_0xf5d4df){_0xf5d4df=_0xf5d4df||0xc8;return function(_0xb9874a){if(_0xb9874a){return _0x7aea00[_0x6f99('0x1a')](_0xf5d4df)[_0x6f99('0x1c')](_0xb9874a);}};}function respondWithFilteredResult(_0x1534e9,_0x1c7733){return function(_0x537f3d){if(_0x537f3d){var _0x293937=typeof _0x1c7733[_0x6f99('0x1d')]==='undefined'&&typeof _0x1c7733['limit']===_0x6f99('0x1e');var _0x5b3638=_0x537f3d[_0x6f99('0x1f')];var _0x210360=_0x293937?0x0:_0x1c7733[_0x6f99('0x1d')];var _0x25d50b=_0x293937?_0x537f3d[_0x6f99('0x1f')]:_0x1c7733['offset']+_0x1c7733[_0x6f99('0x20')];var _0x5377cb;if(_0x25d50b>=_0x5b3638){_0x25d50b=_0x5b3638;_0x5377cb=0xc8;}else{_0x5377cb=0xce;}_0x1534e9[_0x6f99('0x1a')](_0x5377cb);return _0x1534e9[_0x6f99('0x21')](_0x6f99('0x22'),_0x210360+'-'+_0x25d50b+'/'+_0x5b3638)[_0x6f99('0x1c')](_0x537f3d);}return null;};}function patchUpdates(_0x1dc9e5){return function(_0xf66bde){try{jsonpatch['apply'](_0xf66bde,_0x1dc9e5,!![]);}catch(_0x4c4d00){return BPromise[_0x6f99('0x23')](_0x4c4d00);}return _0xf66bde[_0x6f99('0x24')]();};}function saveUpdates(_0x4974ff,_0x497fd7){return function(_0x1d4dc3){if(_0x1d4dc3){return _0x1d4dc3[_0x6f99('0x25')](_0x4974ff)[_0x6f99('0x26')](function(_0xe3e6ab){return _0xe3e6ab;});}return null;};}function removeEntity(_0x290c88,_0x1174a2){return function(_0x2e7b94){if(_0x2e7b94){return _0x2e7b94[_0x6f99('0x27')]()[_0x6f99('0x26')](function(){_0x290c88[_0x6f99('0x1a')](0xcc)[_0x6f99('0x1b')]();});}};}function handleEntityNotFound(_0x1f8078,_0x21a5c8){return function(_0x381e92){if(!_0x381e92){_0x1f8078['sendStatus'](0x194);}return _0x381e92;};}function handleError(_0x1aff24,_0x201070){_0x201070=_0x201070||0x1f4;return function(_0x4c9572){logger['error'](_0x4c9572[_0x6f99('0x28')]);if(_0x4c9572[_0x6f99('0x29')]){delete _0x4c9572['name'];}_0x1aff24[_0x6f99('0x1a')](_0x201070)[_0x6f99('0x2a')](_0x4c9572);};}exports['show']=function(_0x45fe22,_0x3c1012){var _0x513519={'raw':!![],'where':{'id':_0x45fe22[_0x6f99('0x2b')]['id']}},_0x21eb46={};_0x21eb46[_0x6f99('0x2c')]=_[_0x6f99('0x2d')](db[_0x6f99('0x2e')][_0x6f99('0x2f')]);_0x21eb46['query']=_[_0x6f99('0x2d')](_0x45fe22[_0x6f99('0x30')]);_0x21eb46['filters']=_['intersection'](_0x21eb46[_0x6f99('0x2c')],_0x21eb46[_0x6f99('0x30')]);_0x513519[_0x6f99('0x31')]=_[_0x6f99('0x32')](_0x21eb46[_0x6f99('0x2c')],qs[_0x6f99('0x33')](_0x45fe22['query']['fields']));_0x513519[_0x6f99('0x31')]=_0x513519[_0x6f99('0x31')][_0x6f99('0x34')]?_0x513519[_0x6f99('0x31')]:_0x21eb46[_0x6f99('0x2c')];if(_0x45fe22[_0x6f99('0x30')][_0x6f99('0x35')]){_0x513519[_0x6f99('0x36')]=[{'all':!![]}];}_0x513519=_[_0x6f99('0x37')]({},_0x513519,_0x45fe22[_0x6f99('0x38')]);return db[_0x6f99('0x2e')]['find'](_0x513519)[_0x6f99('0x26')](handleEntityNotFound(_0x3c1012,null))[_0x6f99('0x26')](respondWithResult(_0x3c1012,null))[_0x6f99('0x39')](handleError(_0x3c1012,null));};exports[_0x6f99('0x25')]=function(_0x350857,_0x48a1b8){if(_0x350857[_0x6f99('0x3a')]['id']){delete _0x350857[_0x6f99('0x3a')]['id'];}return db['ChatApplication'][_0x6f99('0x3b')]({'where':{'id':_0x350857[_0x6f99('0x2b')]['id']}})[_0x6f99('0x26')](handleEntityNotFound(_0x48a1b8,null))[_0x6f99('0x26')](saveUpdates(_0x350857[_0x6f99('0x3a')],null))[_0x6f99('0x26')](respondWithResult(_0x48a1b8,null))[_0x6f99('0x39')](handleError(_0x48a1b8,null));};exports[_0x6f99('0x27')]=function(_0x56e206,_0x304db7){return db['ChatApplication'][_0x6f99('0x3b')]({'where':{'id':_0x56e206[_0x6f99('0x2b')]['id']}})[_0x6f99('0x26')](handleEntityNotFound(_0x304db7,null))[_0x6f99('0x26')](removeEntity(_0x304db7,null))['catch'](handleError(_0x304db7,null));}; \ No newline at end of file +var _0x983c=['find','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','show','model','keys','intersection','attributes','query','fields','length','include','merge','options','catch','body','ChatApplication'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x983c,0xf3));var _0xc983=function(_0x589cdf,_0x53f463){_0x589cdf=_0x589cdf-0x0;var _0x5f0774=_0x983c[_0x589cdf];return _0x5f0774;};'use strict';var emlformat=require(_0xc983('0x0'));var rimraf=require(_0xc983('0x1'));var zipdir=require(_0xc983('0x2'));var jsonpatch=require(_0xc983('0x3'));var rp=require(_0xc983('0x4'));var moment=require('moment');var BPromise=require(_0xc983('0x5'));var Mustache=require(_0xc983('0x6'));var util=require(_0xc983('0x7'));var path=require(_0xc983('0x8'));var sox=require(_0xc983('0x9'));var csv=require(_0xc983('0xa'));var ejs=require(_0xc983('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc983('0xc'));var squel=require(_0xc983('0xd'));var crypto=require(_0xc983('0xe'));var jsforce=require(_0xc983('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc983('0x10'));var authService=require(_0xc983('0x11'));var qs=require(_0xc983('0x12'));var as=require(_0xc983('0x13'));var hardwareService=require(_0xc983('0x14'));var logger=require(_0xc983('0x15'))(_0xc983('0x16'));var utils=require(_0xc983('0x17'));var config=require(_0xc983('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc983('0x19'))['db'];function respondWithStatusCode(_0x2ae6f0,_0x28b2f1){_0x28b2f1=_0x28b2f1||0xcc;return function(_0x1b4dd2){if(_0x1b4dd2){return _0x2ae6f0[_0xc983('0x1a')](_0x28b2f1);}return _0x2ae6f0[_0xc983('0x1b')](_0x28b2f1)['end']();};}function respondWithResult(_0x1ebf7c,_0x7cdd1b){_0x7cdd1b=_0x7cdd1b||0xc8;return function(_0x1e4763){if(_0x1e4763){return _0x1ebf7c[_0xc983('0x1b')](_0x7cdd1b)[_0xc983('0x1c')](_0x1e4763);}};}function respondWithFilteredResult(_0x28e2ae,_0x5cad69){return function(_0x18d7f5){if(_0x18d7f5){var _0x1a1e7d=typeof _0x5cad69[_0xc983('0x1d')]===_0xc983('0x1e')&&typeof _0x5cad69[_0xc983('0x1f')]===_0xc983('0x1e');var _0x390f05=_0x18d7f5[_0xc983('0x20')];var _0x135e0d=_0x1a1e7d?0x0:_0x5cad69[_0xc983('0x1d')];var _0x5bac5d=_0x1a1e7d?_0x18d7f5['count']:_0x5cad69[_0xc983('0x1d')]+_0x5cad69[_0xc983('0x1f')];var _0x3bdbc9;if(_0x5bac5d>=_0x390f05){_0x5bac5d=_0x390f05;_0x3bdbc9=0xc8;}else{_0x3bdbc9=0xce;}_0x28e2ae[_0xc983('0x1b')](_0x3bdbc9);return _0x28e2ae[_0xc983('0x21')](_0xc983('0x22'),_0x135e0d+'-'+_0x5bac5d+'/'+_0x390f05)[_0xc983('0x1c')](_0x18d7f5);}return null;};}function patchUpdates(_0x51c552){return function(_0x55bbee){try{jsonpatch[_0xc983('0x23')](_0x55bbee,_0x51c552,!![]);}catch(_0x3873b1){return BPromise[_0xc983('0x24')](_0x3873b1);}return _0x55bbee[_0xc983('0x25')]();};}function saveUpdates(_0xfcf7b6,_0x35e092){return function(_0x26cf51){if(_0x26cf51){return _0x26cf51[_0xc983('0x26')](_0xfcf7b6)[_0xc983('0x27')](function(_0x6851b5){return _0x6851b5;});}return null;};}function removeEntity(_0x36a1c6,_0x2ad799){return function(_0x48a916){if(_0x48a916){return _0x48a916['destroy']()[_0xc983('0x27')](function(){_0x36a1c6[_0xc983('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x223215,_0x505307){return function(_0x2df87b){if(!_0x2df87b){_0x223215[_0xc983('0x1a')](0x194);}return _0x2df87b;};}function handleError(_0x4132c6,_0x31cb28){_0x31cb28=_0x31cb28||0x1f4;return function(_0x16f027){logger['error'](_0x16f027[_0xc983('0x28')]);if(_0x16f027[_0xc983('0x29')]){delete _0x16f027[_0xc983('0x29')];}_0x4132c6[_0xc983('0x1b')](_0x31cb28)[_0xc983('0x2a')](_0x16f027);};}exports[_0xc983('0x2b')]=function(_0x56880c,_0x2a94c1){var _0x46a97e={'raw':!![],'where':{'id':_0x56880c['params']['id']}},_0x509d90={};_0x509d90[_0xc983('0x2c')]=_[_0xc983('0x2d')](db['ChatApplication']['rawAttributes']);_0x509d90['query']=_[_0xc983('0x2d')](_0x56880c['query']);_0x509d90['filters']=_[_0xc983('0x2e')](_0x509d90[_0xc983('0x2c')],_0x509d90['query']);_0x46a97e[_0xc983('0x2f')]=_['intersection'](_0x509d90['model'],qs['fields'](_0x56880c[_0xc983('0x30')][_0xc983('0x31')]));_0x46a97e['attributes']=_0x46a97e[_0xc983('0x2f')][_0xc983('0x32')]?_0x46a97e[_0xc983('0x2f')]:_0x509d90[_0xc983('0x2c')];if(_0x56880c['query']['includeAll']){_0x46a97e[_0xc983('0x33')]=[{'all':!![]}];}_0x46a97e=_[_0xc983('0x34')]({},_0x46a97e,_0x56880c[_0xc983('0x35')]);return db['ChatApplication']['find'](_0x46a97e)[_0xc983('0x27')](handleEntityNotFound(_0x2a94c1,null))[_0xc983('0x27')](respondWithResult(_0x2a94c1,null))[_0xc983('0x36')](handleError(_0x2a94c1,null));};exports[_0xc983('0x26')]=function(_0x1746a4,_0x41a533){if(_0x1746a4[_0xc983('0x37')]['id']){delete _0x1746a4[_0xc983('0x37')]['id'];}return db[_0xc983('0x38')][_0xc983('0x39')]({'where':{'id':_0x1746a4[_0xc983('0x3a')]['id']}})[_0xc983('0x27')](handleEntityNotFound(_0x41a533,null))['then'](saveUpdates(_0x1746a4['body'],null))[_0xc983('0x27')](respondWithResult(_0x41a533,null))['catch'](handleError(_0x41a533,null));};exports[_0xc983('0x3b')]=function(_0x1aed5c,_0x5cf2df){return db['ChatApplication'][_0xc983('0x39')]({'where':{'id':_0x1aed5c[_0xc983('0x3a')]['id']}})[_0xc983('0x27')](handleEntityNotFound(_0x5cf2df,null))[_0xc983('0x27')](removeEntity(_0x5cf2df,null))['catch'](handleError(_0x5cf2df,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index fdf0386..cc0cc6c 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 _0x4390=['utf8mb4_unicode_ci','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','define','ChatApplication'];(function(_0x9f3e89,_0x39b12c){var _0x12d365=function(_0x2d9326){while(--_0x2d9326){_0x9f3e89['push'](_0x9f3e89['shift']());}};_0x12d365(++_0x39b12c);}(_0x4390,0x64));var _0x0439=function(_0x172873,_0x3b482a){_0x172873=_0x172873-0x0;var _0x59bcc3=_0x4390[_0x172873];return _0x59bcc3;};'use strict';var _=require('lodash');var util=require(_0x0439('0x0'));var logger=require(_0x0439('0x1'))(_0x0439('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0439('0x3'));var fs=require('fs');var path=require(_0x0439('0x4'));var rimraf=require(_0x0439('0x5'));var config=require(_0x0439('0x6'));var attributes=require(_0x0439('0x7'));module['exports']=function(_0x22ddca,_0x4fde7e){return _0x22ddca[_0x0439('0x8')](_0x0439('0x9'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0439('0xa')});}; \ No newline at end of file +var _0x9795=['rimraf','exports','ChatApplication','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4023d4,_0x1c1f3a){var _0xbaf14e=function(_0x2d6a25){while(--_0x2d6a25){_0x4023d4['push'](_0x4023d4['shift']());}};_0xbaf14e(++_0x1c1f3a);}(_0x9795,0x1e3));var _0x5979=function(_0xf17d47,_0x4fcf2c){_0xf17d47=_0xf17d47-0x0;var _0x199aa2=_0x9795[_0xf17d47];return _0x199aa2;};'use strict';var _=require(_0x5979('0x0'));var util=require('util');var logger=require(_0x5979('0x1'))(_0x5979('0x2'));var moment=require(_0x5979('0x3'));var BPromise=require(_0x5979('0x4'));var rp=require(_0x5979('0x5'));var fs=require('fs');var path=require(_0x5979('0x6'));var rimraf=require(_0x5979('0x7'));var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0x5979('0x8')]=function(_0x33a99c,_0x2bbf83){return _0x33a99c['define'](_0x5979('0x9'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index f3b17a0..f062a41 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 _0xd74a=['then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2688b1,_0x4e6bd0){var _0x27f9db=function(_0x470c6b){while(--_0x470c6b){_0x2688b1['push'](_0x2688b1['shift']());}};_0x27f9db(++_0x4e6bd0);}(_0xd74a,0x1af));var _0xad74=function(_0x3c3fc6,_0x35ce9c){_0x3c3fc6=_0x3c3fc6-0x0;var _0x5f0e5e=_0xd74a[_0x3c3fc6];return _0x5f0e5e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xad74('0x0'));var BPromise=require(_0xad74('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad74('0x2'));var db=require(_0xad74('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xad74('0x4'))(_0xad74('0x5'));var config=require(_0xad74('0x6'));var jayson=require(_0xad74('0x7'));var client=jayson[_0xad74('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35f641,_0x3acbb6,_0x44dc1f){return new BPromise(function(_0x2b82c7,_0x36bcf1){return client['request'](_0x35f641,_0x44dc1f)[_0xad74('0x9')](function(_0x4cb603){logger[_0xad74('0xa')](_0xad74('0xb'),_0x3acbb6,_0xad74('0xc'));logger['debug'](_0xad74('0xd'),_0x3acbb6,_0xad74('0xc'),JSON[_0xad74('0xe')](_0x4cb603));if(_0x4cb603[_0xad74('0xf')]){if(_0x4cb603[_0xad74('0xf')][_0xad74('0x10')]===0x1f4){logger[_0xad74('0xf')](_0xad74('0xb'),_0x3acbb6,_0x4cb603[_0xad74('0xf')][_0xad74('0x11')]);return _0x36bcf1(_0x4cb603['error'][_0xad74('0x11')]);}logger[_0xad74('0xf')](_0xad74('0xb'),_0x3acbb6,_0x4cb603['error'][_0xad74('0x11')]);return _0x2b82c7(_0x4cb603[_0xad74('0xf')][_0xad74('0x11')]);}else{logger[_0xad74('0xa')]('ChatApplication,\x20%s,\x20%s',_0x3acbb6,_0xad74('0xc'));_0x2b82c7(_0x4cb603[_0xad74('0x12')][_0xad74('0x11')]);}})[_0xad74('0x13')](function(_0x31972e){logger[_0xad74('0xf')]('ChatApplication,\x20%s,\x20%s',_0x3acbb6,_0x31972e);_0x36bcf1(_0x31972e);});});} \ No newline at end of file +var _0x5b43=['debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x211c64,_0x3ecac5){var _0x5b1d2a=function(_0x2faec9){while(--_0x2faec9){_0x211c64['push'](_0x211c64['shift']());}};_0x5b1d2a(++_0x3ecac5);}(_0x5b43,0x1a5));var _0x35b4=function(_0x564354,_0x5d88ba){_0x564354=_0x564354-0x0;var _0x299c45=_0x5b43[_0x564354];return _0x299c45;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x35b4('0x0'));var BPromise=require('bluebird');var rs=require(_0x35b4('0x1'));var fs=require('fs');var Redis=require(_0x35b4('0x2'));var db=require(_0x35b4('0x3'))['db'];var utils=require(_0x35b4('0x4'));var logger=require(_0x35b4('0x5'))(_0x35b4('0x6'));var config=require(_0x35b4('0x7'));var jayson=require(_0x35b4('0x8'));var client=jayson[_0x35b4('0x9')][_0x35b4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4275b1,_0x288861,_0x4ce9c8){return new BPromise(function(_0x44af4b,_0x35f068){return client[_0x35b4('0xb')](_0x4275b1,_0x4ce9c8)[_0x35b4('0xc')](function(_0x28833d){logger[_0x35b4('0xd')](_0x35b4('0xe'),_0x288861,_0x35b4('0xf'));logger[_0x35b4('0x10')](_0x35b4('0x11'),_0x288861,_0x35b4('0xf'),JSON[_0x35b4('0x12')](_0x28833d));if(_0x28833d['error']){if(_0x28833d[_0x35b4('0x13')]['code']===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x288861,_0x28833d[_0x35b4('0x13')]['message']);return _0x35f068(_0x28833d[_0x35b4('0x13')]['message']);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x288861,_0x28833d['error'][_0x35b4('0x14')]);return _0x44af4b(_0x28833d[_0x35b4('0x13')][_0x35b4('0x14')]);}else{logger[_0x35b4('0xd')]('ChatApplication,\x20%s,\x20%s',_0x288861,_0x35b4('0xf'));_0x44af4b(_0x28833d[_0x35b4('0x15')]['message']);}})[_0x35b4('0x16')](function(_0x467ded){logger[_0x35b4('0x13')]('ChatApplication,\x20%s,\x20%s',_0x288861,_0x467ded);_0x35f068(_0x467ded);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index b165477..cf2b9d0 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 _0x33a9=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','exports','multer','path','connect-timeout'];(function(_0x3d9cd5,_0x2857e4){var _0x5553e1=function(_0x1f5c7f){while(--_0x1f5c7f){_0x3d9cd5['push'](_0x3d9cd5['shift']());}};_0x5553e1(++_0x2857e4);}(_0x33a9,0x11d));var _0x933a=function(_0xd6fcb5,_0x526523){_0xd6fcb5=_0xd6fcb5-0x0;var _0x278ac7=_0x33a9[_0xd6fcb5];return _0x278ac7;};'use strict';var multer=require(_0x933a('0x0'));var util=require('util');var path=require(_0x933a('0x1'));var timeout=require(_0x933a('0x2'));var express=require(_0x933a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x933a('0x4'));var interaction=require(_0x933a('0x5'));var config=require(_0x933a('0x6'));var controller=require(_0x933a('0x7'));router[_0x933a('0x8')](_0x933a('0x9'),auth[_0x933a('0xa')](),controller[_0x933a('0xb')]);router[_0x933a('0xc')](_0x933a('0x9'),auth[_0x933a('0xa')](),controller[_0x933a('0xd')]);router[_0x933a('0xe')](_0x933a('0x9'),auth[_0x933a('0xa')](),controller['destroy']);module[_0x933a('0xf')]=router; \ No newline at end of file +var _0x4c4f=['isAuthenticated','show','put','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatApplication.controller','get','/:id'];(function(_0x7a35b1,_0x925417){var _0x3c4535=function(_0x140109){while(--_0x140109){_0x7a35b1['push'](_0x7a35b1['shift']());}};_0x3c4535(++_0x925417);}(_0x4c4f,0x1a6));var _0xf4c4=function(_0x3d1a55,_0x1b1b42){_0x3d1a55=_0x3d1a55-0x0;var _0x40da43=_0x4c4f[_0x3d1a55];return _0x40da43;};'use strict';var multer=require(_0xf4c4('0x0'));var util=require(_0xf4c4('0x1'));var path=require('path');var timeout=require(_0xf4c4('0x2'));var express=require(_0xf4c4('0x3'));var router=express[_0xf4c4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf4c4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf4c4('0x6'));var controller=require(_0xf4c4('0x7'));router[_0xf4c4('0x8')](_0xf4c4('0x9'),auth[_0xf4c4('0xa')](),controller[_0xf4c4('0xb')]);router[_0xf4c4('0xc')](_0xf4c4('0x9'),auth[_0xf4c4('0xa')](),controller[_0xf4c4('0xd')]);router['delete'](_0xf4c4('0x9'),auth[_0xf4c4('0xa')](),controller[_0xf4c4('0xe')]);module[_0xf4c4('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 7a80b5f..8ea642a 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 _0x1574=['STRING','sequelize','exports'];(function(_0x22c684,_0x753309){var _0x39fcbb=function(_0x38b631){while(--_0x38b631){_0x22c684['push'](_0x22c684['shift']());}};_0x39fcbb(++_0x753309);}(_0x1574,0x148));var _0x4157=function(_0x150e2c,_0x3d9f13){_0x150e2c=_0x150e2c-0x0;var _0x33a9d4=_0x1574[_0x150e2c];return _0x33a9d4;};'use strict';var Sequelize=require(_0x4157('0x0'));module[_0x4157('0x1')]={'name':{'type':Sequelize[_0x4157('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4157('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x66fa=['exports','STRING','BOOLEAN','sequelize'];(function(_0x1ca566,_0x2f5214){var _0x216a4f=function(_0x5293d3){while(--_0x5293d3){_0x1ca566['push'](_0x1ca566['shift']());}};_0x216a4f(++_0x2f5214);}(_0x66fa,0x117));var _0xa66f=function(_0x5761a1,_0x1cb792){_0x5761a1=_0x5761a1-0x0;var _0x3c654d=_0x66fa[_0x5761a1];return _0x3c654d;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa66f('0x2')]},'write':{'type':Sequelize[_0xa66f('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 a982ee7..c797c9c 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 _0xb8c3=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','save','update','then','destroy','name','send','map','ChatGroup','fieldName','type','key','model','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','include','rows','catch','show','params','keys','rawAttributes','options','find','create','body','describe','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','findOne','removeMembers','addMessage','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x4df9a5,_0x49ec1e){var _0x21d8e8=function(_0x89b012){while(--_0x89b012){_0x4df9a5['push'](_0x4df9a5['shift']());}};_0x21d8e8(++_0x49ec1e);}(_0xb8c3,0x1ce));var _0x3b8c=function(_0x106bfd,_0x5acbdb){_0x106bfd=_0x106bfd-0x0;var _0x53909b=_0xb8c3[_0x106bfd];return _0x53909b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b8c('0x0'));var zipdir=require(_0x3b8c('0x1'));var jsonpatch=require(_0x3b8c('0x2'));var rp=require(_0x3b8c('0x3'));var moment=require(_0x3b8c('0x4'));var BPromise=require(_0x3b8c('0x5'));var Mustache=require(_0x3b8c('0x6'));var util=require('util');var path=require(_0x3b8c('0x7'));var sox=require(_0x3b8c('0x8'));var csv=require(_0x3b8c('0x9'));var ejs=require(_0x3b8c('0xa'));var fs=require('fs');var fs_extra=require(_0x3b8c('0xb'));var _=require(_0x3b8c('0xc'));var squel=require(_0x3b8c('0xd'));var crypto=require(_0x3b8c('0xe'));var jsforce=require(_0x3b8c('0xf'));var deskjs=require(_0x3b8c('0x10'));var toCsv=require(_0x3b8c('0x9'));var querystring=require(_0x3b8c('0x11'));var Papa=require(_0x3b8c('0x12'));var Redis=require(_0x3b8c('0x13'));var authService=require(_0x3b8c('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3b8c('0x15'));var utils=require(_0x3b8c('0x16'));var config=require(_0x3b8c('0x17'));var licenseUtil=require(_0x3b8c('0x18'));var db=require(_0x3b8c('0x19'))['db'];config[_0x3b8c('0x1a')]=_['defaults'](config[_0x3b8c('0x1a')],{'host':_0x3b8c('0x1b'),'port':0x18eb});var socket=require(_0x3b8c('0x1c'))(new Redis(config[_0x3b8c('0x1a')]));require(_0x3b8c('0x1d'))[_0x3b8c('0x1e')](socket);function respondWithStatusCode(_0x47bded,_0x47b5d2){_0x47b5d2=_0x47b5d2||0xcc;return function(_0x5e5a5a){if(_0x5e5a5a){return _0x47bded[_0x3b8c('0x1f')](_0x47b5d2);}return _0x47bded[_0x3b8c('0x20')](_0x47b5d2)[_0x3b8c('0x21')]();};}function respondWithResult(_0x111543,_0x41234e){_0x41234e=_0x41234e||0xc8;return function(_0x3ddaf6){if(_0x3ddaf6){return _0x111543[_0x3b8c('0x20')](_0x41234e)[_0x3b8c('0x22')](_0x3ddaf6);}};}function respondWithFilteredResult(_0x14ae5b,_0x5bf15d){return function(_0x3eda20){if(_0x3eda20){var _0x4d20c5=typeof _0x5bf15d['offset']===_0x3b8c('0x23')&&typeof _0x5bf15d['limit']==='undefined';var _0x5918c2=_0x3eda20[_0x3b8c('0x24')];var _0x442398=_0x4d20c5?0x0:_0x5bf15d[_0x3b8c('0x25')];var _0x37edb8=_0x4d20c5?_0x3eda20[_0x3b8c('0x24')]:_0x5bf15d[_0x3b8c('0x25')]+_0x5bf15d[_0x3b8c('0x26')];var _0x3afac9;if(_0x37edb8>=_0x5918c2){_0x37edb8=_0x5918c2;_0x3afac9=0xc8;}else{_0x3afac9=0xce;}_0x14ae5b[_0x3b8c('0x20')](_0x3afac9);return _0x14ae5b[_0x3b8c('0x27')](_0x3b8c('0x28'),_0x442398+'-'+_0x37edb8+'/'+_0x5918c2)[_0x3b8c('0x22')](_0x3eda20);}return null;};}function patchUpdates(_0x3e4b42){return function(_0x21eed6){try{jsonpatch['apply'](_0x21eed6,_0x3e4b42,!![]);}catch(_0x518480){return BPromise['reject'](_0x518480);}return _0x21eed6[_0x3b8c('0x29')]();};}function saveUpdates(_0x2914fa,_0x37e274){return function(_0x2c9547){if(_0x2c9547){return _0x2c9547[_0x3b8c('0x2a')](_0x2914fa)[_0x3b8c('0x2b')](function(_0x30c7e7){return _0x30c7e7;});}return null;};}function removeEntity(_0x239396,_0x49c547){return function(_0x239e68){if(_0x239e68){return _0x239e68[_0x3b8c('0x2c')]()[_0x3b8c('0x2b')](function(){_0x239396[_0x3b8c('0x20')](0xcc)[_0x3b8c('0x21')]();});}};}function handleEntityNotFound(_0x54a012,_0x57478d){return function(_0x3412dd){if(!_0x3412dd){_0x54a012[_0x3b8c('0x1f')](0x194);}return _0x3412dd;};}function handleError(_0x3f276c,_0x168c0f){_0x168c0f=_0x168c0f||0x1f4;return function(_0x3ab23f){logger['error'](_0x3ab23f['stack']);if(_0x3ab23f[_0x3b8c('0x2d')]){delete _0x3ab23f[_0x3b8c('0x2d')];}_0x3f276c[_0x3b8c('0x20')](_0x168c0f)[_0x3b8c('0x2e')](_0x3ab23f);};}exports['index']=function(_0x25c1b0,_0x3157ef){var _0x1953cb={},_0x1749b5={},_0x181ff2={'count':0x0,'rows':[]};var _0x5401d9=_[_0x3b8c('0x2f')](db[_0x3b8c('0x30')]['rawAttributes'],function(_0x4d34ff){return{'name':_0x4d34ff[_0x3b8c('0x31')],'type':_0x4d34ff[_0x3b8c('0x32')][_0x3b8c('0x33')]};});_0x1749b5[_0x3b8c('0x34')]=_['map'](_0x5401d9,'name');_0x1749b5['query']=_['keys'](_0x25c1b0['query']);_0x1749b5['filters']=_[_0x3b8c('0x35')](_0x1749b5[_0x3b8c('0x34')],_0x1749b5[_0x3b8c('0x36')]);_0x1953cb[_0x3b8c('0x37')]=_[_0x3b8c('0x35')](_0x1749b5[_0x3b8c('0x34')],qs[_0x3b8c('0x38')](_0x25c1b0[_0x3b8c('0x36')][_0x3b8c('0x38')]));_0x1953cb[_0x3b8c('0x37')]=_0x1953cb[_0x3b8c('0x37')][_0x3b8c('0x39')]?_0x1953cb[_0x3b8c('0x37')]:_0x1749b5['model'];if(!_0x25c1b0[_0x3b8c('0x36')][_0x3b8c('0x3a')](_0x3b8c('0x3b'))){_0x1953cb[_0x3b8c('0x26')]=qs['limit'](_0x25c1b0[_0x3b8c('0x36')][_0x3b8c('0x26')]);_0x1953cb[_0x3b8c('0x25')]=qs[_0x3b8c('0x25')](_0x25c1b0[_0x3b8c('0x36')][_0x3b8c('0x25')]);}_0x1953cb[_0x3b8c('0x3c')]=qs['sort'](_0x25c1b0['query'][_0x3b8c('0x3d')]);_0x1953cb[_0x3b8c('0x3e')]=qs['filters'](_[_0x3b8c('0x3f')](_0x25c1b0[_0x3b8c('0x36')],_0x1749b5[_0x3b8c('0x40')]),_0x5401d9);if(_0x25c1b0[_0x3b8c('0x36')][_0x3b8c('0x41')]){_0x1953cb[_0x3b8c('0x3e')]=_['merge'](_0x1953cb[_0x3b8c('0x3e')],{'$or':_[_0x3b8c('0x2f')](_0x5401d9,function(_0x4a02d9){if(_0x4a02d9['type']!==_0x3b8c('0x42')){var _0x16e3da={};_0x16e3da[_0x4a02d9[_0x3b8c('0x2d')]]={'$like':'%'+_0x25c1b0[_0x3b8c('0x36')][_0x3b8c('0x41')]+'%'};return _0x16e3da;}})});}_0x1953cb=_[_0x3b8c('0x43')]({},_0x1953cb,_0x25c1b0['options']);var _0x4961ad={'where':_0x1953cb[_0x3b8c('0x3e')]};return db['ChatGroup'][_0x3b8c('0x24')](_0x4961ad)['then'](function(_0x1402a2){_0x181ff2[_0x3b8c('0x24')]=_0x1402a2;if(_0x25c1b0[_0x3b8c('0x36')]['includeAll']){_0x1953cb[_0x3b8c('0x44')]=[{'all':!![]}];}return db[_0x3b8c('0x30')]['findAll'](_0x1953cb);})['then'](function(_0x332300){_0x181ff2[_0x3b8c('0x45')]=_0x332300;return _0x181ff2;})[_0x3b8c('0x2b')](respondWithFilteredResult(_0x3157ef,_0x1953cb))[_0x3b8c('0x46')](handleError(_0x3157ef,null));};exports[_0x3b8c('0x47')]=function(_0x53883f,_0x1954ad){var _0x313d88={'raw':!![],'where':{'id':_0x53883f[_0x3b8c('0x48')]['id']}},_0x13655c={};_0x13655c[_0x3b8c('0x34')]=_[_0x3b8c('0x49')](db['ChatGroup'][_0x3b8c('0x4a')]);_0x13655c[_0x3b8c('0x36')]=_['keys'](_0x53883f['query']);_0x13655c[_0x3b8c('0x40')]=_[_0x3b8c('0x35')](_0x13655c[_0x3b8c('0x34')],_0x13655c[_0x3b8c('0x36')]);_0x313d88[_0x3b8c('0x37')]=_[_0x3b8c('0x35')](_0x13655c['model'],qs[_0x3b8c('0x38')](_0x53883f['query']['fields']));_0x313d88['attributes']=_0x313d88[_0x3b8c('0x37')][_0x3b8c('0x39')]?_0x313d88[_0x3b8c('0x37')]:_0x13655c['model'];if(_0x53883f[_0x3b8c('0x36')]['includeAll']){_0x313d88[_0x3b8c('0x44')]=[{'all':!![]}];}_0x313d88=_['merge']({},_0x313d88,_0x53883f[_0x3b8c('0x4b')]);return db['ChatGroup'][_0x3b8c('0x4c')](_0x313d88)[_0x3b8c('0x2b')](handleEntityNotFound(_0x1954ad,null))['then'](respondWithResult(_0x1954ad,null))[_0x3b8c('0x46')](handleError(_0x1954ad,null));};exports[_0x3b8c('0x4d')]=function(_0x532173,_0x3c9694){return db[_0x3b8c('0x30')][_0x3b8c('0x4d')](_0x532173[_0x3b8c('0x4e')],{})['then'](respondWithResult(_0x3c9694,0xc9))[_0x3b8c('0x46')](handleError(_0x3c9694,null));};exports[_0x3b8c('0x2a')]=function(_0x10a72a,_0x56d0a7){if(_0x10a72a[_0x3b8c('0x4e')]['id']){delete _0x10a72a['body']['id'];}return db[_0x3b8c('0x30')]['find']({'where':{'id':_0x10a72a[_0x3b8c('0x48')]['id']}})[_0x3b8c('0x2b')](handleEntityNotFound(_0x56d0a7,null))[_0x3b8c('0x2b')](saveUpdates(_0x10a72a[_0x3b8c('0x4e')],null))[_0x3b8c('0x2b')](respondWithResult(_0x56d0a7,null))[_0x3b8c('0x46')](handleError(_0x56d0a7,null));};exports[_0x3b8c('0x2c')]=function(_0x2c8e97,_0xff6eac){return db[_0x3b8c('0x30')][_0x3b8c('0x4c')]({'where':{'id':_0x2c8e97[_0x3b8c('0x48')]['id']}})[_0x3b8c('0x2b')](handleEntityNotFound(_0xff6eac,null))[_0x3b8c('0x2b')](removeEntity(_0xff6eac,null))['catch'](handleError(_0xff6eac,null));};exports[_0x3b8c('0x4f')]=function(_0x143191,_0x9809d){return db[_0x3b8c('0x30')][_0x3b8c('0x4f')]()[_0x3b8c('0x2b')](respondWithResult(_0x9809d,null))[_0x3b8c('0x46')](handleError(_0x9809d,null));};exports['getUnread']=function(_0x5aa204,_0x622a34,_0x4ef52c){return db[_0x3b8c('0x50')][_0x3b8c('0x24')]({'where':{'ChatGroupId':_0x5aa204[_0x3b8c('0x48')]['id'],'ToId':_0x5aa204['user']['id'],'read':![]}})[_0x3b8c('0x2b')](function(_0x5569c6){return{'id':_[_0x3b8c('0x51')](_0x5aa204[_0x3b8c('0x48')]['id']),'count':_0x5569c6};})[_0x3b8c('0x2b')](respondWithResult(_0x622a34,null))['catch'](handleError(_0x622a34,null));};exports['addMembers']=function(_0x4d4779,_0x530db6,_0x2c0adb){return db['ChatGroup'][_0x3b8c('0x4c')]({'where':{'id':_0x4d4779[_0x3b8c('0x48')]['id']}})['then'](handleEntityNotFound(_0x530db6,null))['then'](function(_0x293e4a){if(_0x293e4a){return _0x293e4a[_0x3b8c('0x52')](_0x4d4779[_0x3b8c('0x4e')][_0x3b8c('0x53')],_[_0x3b8c('0x54')](_0x4d4779[_0x3b8c('0x4e')],[_0x3b8c('0x53'),'id'])||{});}})[_0x3b8c('0x2b')](respondWithResult(_0x530db6,null))[_0x3b8c('0x46')](handleError(_0x530db6,null));};exports[_0x3b8c('0x55')]=function(_0x27e971,_0x42cabb,_0x1a119b){var _0x364666={};var _0x537515={};var _0x50ddf7;var _0xf76685;return db[_0x3b8c('0x30')][_0x3b8c('0x56')]({'where':{'id':_0x27e971['params']['id']}})[_0x3b8c('0x2b')](handleEntityNotFound(_0x42cabb,null))[_0x3b8c('0x2b')](function(_0x4a3140){if(_0x4a3140){_0x50ddf7=_0x4a3140;_0x537515[_0x3b8c('0x34')]=_[_0x3b8c('0x49')](db['User']['rawAttributes']);_0x537515[_0x3b8c('0x36')]=_['keys'](_0x27e971[_0x3b8c('0x36')]);_0x537515[_0x3b8c('0x40')]=_[_0x3b8c('0x35')](_0x537515['model'],_0x537515[_0x3b8c('0x36')]);_0x364666['attributes']=_['intersection'](_0x537515[_0x3b8c('0x34')],qs[_0x3b8c('0x38')](_0x27e971['query'][_0x3b8c('0x38')]));_0x364666['attributes']=_0x364666[_0x3b8c('0x37')]['length']?_0x364666[_0x3b8c('0x37')]:_0x537515[_0x3b8c('0x34')];_0x364666['order']=qs[_0x3b8c('0x3d')](_0x27e971[_0x3b8c('0x36')]['sort']);_0x364666[_0x3b8c('0x3e')]=qs[_0x3b8c('0x40')](_['pick'](_0x27e971[_0x3b8c('0x36')],_0x537515[_0x3b8c('0x40')]));if(_0x27e971[_0x3b8c('0x36')][_0x3b8c('0x41')]){_0x364666[_0x3b8c('0x3e')]=_[_0x3b8c('0x43')](_0x364666[_0x3b8c('0x3e')],{'$or':_['map'](_0x364666[_0x3b8c('0x37')],function(_0x176bb7){var _0x199efc={};_0x199efc[_0x176bb7]={'$like':'%'+_0x27e971[_0x3b8c('0x36')][_0x3b8c('0x41')]+'%'};return _0x199efc;})});}_0x364666=_['merge']({},_0x364666,_0x27e971['options']);return _0x50ddf7[_0x3b8c('0x55')](_0x364666);}})['then'](function(_0x2a69b0){if(_0x2a69b0){_0xf76685=_0x2a69b0[_0x3b8c('0x39')];if(!_0x27e971['query']['hasOwnProperty'](_0x3b8c('0x3b'))){_0x364666['limit']=qs[_0x3b8c('0x26')](_0x27e971['query'][_0x3b8c('0x26')]);_0x364666[_0x3b8c('0x25')]=qs[_0x3b8c('0x25')](_0x27e971[_0x3b8c('0x36')]['offset']);}return _0x50ddf7[_0x3b8c('0x55')](_0x364666);}})[_0x3b8c('0x2b')](function(_0x1a5bc2){if(_0x1a5bc2){return _0x1a5bc2?{'count':_0xf76685,'rows':_0x1a5bc2}:null;}})[_0x3b8c('0x2b')](respondWithResult(_0x42cabb,null))[_0x3b8c('0x46')](handleError(_0x42cabb,null));};exports[_0x3b8c('0x57')]=function(_0xc61fb5,_0x55df00,_0x5a7b88){return db[_0x3b8c('0x30')][_0x3b8c('0x4c')]({'where':{'id':_0xc61fb5['params']['id']}})['then'](handleEntityNotFound(_0x55df00,null))['then'](function(_0x2b4ed5){if(_0x2b4ed5){return _0x2b4ed5[_0x3b8c('0x57')](_0xc61fb5[_0x3b8c('0x36')][_0x3b8c('0x53')]);}})[_0x3b8c('0x2b')](respondWithStatusCode(_0x55df00,null))[_0x3b8c('0x46')](handleError(_0x55df00,null));};exports[_0x3b8c('0x58')]=function(_0x572aca,_0x25e693,_0x3b8c7f){if(_0x572aca['body']['id']){delete _0x572aca[_0x3b8c('0x4e')]['id'];}return db['ChatGroup'][_0x3b8c('0x4c')]({'where':{'id':_0x572aca[_0x3b8c('0x48')]['id']}})['then'](handleEntityNotFound(_0x25e693,null))[_0x3b8c('0x2b')](function(_0x3821f8){if(_0x3821f8){_0x572aca['body']['ChatGroupId']=_0x3821f8['id'];return db[_0x3b8c('0x50')][_0x3b8c('0x4d')](_0x572aca[_0x3b8c('0x4e')]);}})[_0x3b8c('0x2b')](respondWithResult(_0x25e693,null))[_0x3b8c('0x46')](handleError(_0x25e693,null));};exports[_0x3b8c('0x59')]=function(_0x34d9bd,_0x38ceb0,_0x4e19af){var _0x5d440e={};var _0x16a5bd={};var _0x5deb2d;var _0x1744be;return db[_0x3b8c('0x30')][_0x3b8c('0x56')]({'where':{'id':_0x34d9bd[_0x3b8c('0x48')]['id']}})[_0x3b8c('0x2b')](handleEntityNotFound(_0x38ceb0,null))[_0x3b8c('0x2b')](function(_0x20c78e){if(_0x20c78e){_0x5deb2d=_0x20c78e;_0x16a5bd['model']=_[_0x3b8c('0x49')](db[_0x3b8c('0x50')][_0x3b8c('0x4a')]);_0x16a5bd['query']=_[_0x3b8c('0x49')](_0x34d9bd[_0x3b8c('0x36')]);_0x16a5bd[_0x3b8c('0x40')]=_[_0x3b8c('0x35')](_0x16a5bd[_0x3b8c('0x34')],_0x16a5bd[_0x3b8c('0x36')]);_0x5d440e[_0x3b8c('0x37')]=_[_0x3b8c('0x35')](_0x16a5bd[_0x3b8c('0x34')],qs[_0x3b8c('0x38')](_0x34d9bd['query'][_0x3b8c('0x38')]));_0x5d440e['attributes']=_0x5d440e[_0x3b8c('0x37')][_0x3b8c('0x39')]?_0x5d440e[_0x3b8c('0x37')]:_0x16a5bd[_0x3b8c('0x34')];_0x5d440e['order']=qs['sort'](_0x34d9bd[_0x3b8c('0x36')][_0x3b8c('0x3d')]);_0x5d440e[_0x3b8c('0x3e')]=qs[_0x3b8c('0x40')](_[_0x3b8c('0x3f')](_0x34d9bd['query'],_0x16a5bd['filters']));if(_0x34d9bd[_0x3b8c('0x36')][_0x3b8c('0x41')]){_0x5d440e[_0x3b8c('0x3e')]=_[_0x3b8c('0x43')](_0x5d440e[_0x3b8c('0x3e')],{'$or':_[_0x3b8c('0x2f')](_0x5d440e['attributes'],function(_0x2141be){var _0x34dd76={};_0x34dd76[_0x2141be]={'$like':'%'+_0x34d9bd[_0x3b8c('0x36')][_0x3b8c('0x41')]+'%'};return _0x34dd76;})});}if(_0x34d9bd[_0x3b8c('0x36')][_0x3b8c('0x5a')]){var _0x53e7ff=_0x34d9bd[_0x3b8c('0x36')][_0x3b8c('0x5a')][_0x3b8c('0x5b')](',');var _0x4a0538={};_0x4a0538[_0x53e7ff[0x0]]={'$gte':moment(_0x53e7ff[0x1])[_0x3b8c('0x5c')](_0x3b8c('0x5d'))};_0x5d440e[_0x3b8c('0x3e')]=_['merge'](_0x5d440e[_0x3b8c('0x3e')],_0x4a0538);}_0x5d440e=_[_0x3b8c('0x43')]({},_0x5d440e,_0x34d9bd[_0x3b8c('0x4b')]);return _0x5deb2d[_0x3b8c('0x59')](_0x5d440e);}})[_0x3b8c('0x2b')](function(_0x1e2caf){if(_0x1e2caf){_0x1744be=_0x1e2caf[_0x3b8c('0x39')];if(!_0x34d9bd[_0x3b8c('0x36')]['hasOwnProperty'](_0x3b8c('0x3b'))){_0x5d440e[_0x3b8c('0x26')]=qs[_0x3b8c('0x26')](_0x34d9bd['query'][_0x3b8c('0x26')]);_0x5d440e[_0x3b8c('0x25')]=qs[_0x3b8c('0x25')](_0x34d9bd[_0x3b8c('0x36')][_0x3b8c('0x25')]);}return _0x5deb2d[_0x3b8c('0x59')](_0x5d440e);}})[_0x3b8c('0x2b')](function(_0x5e5a2f){if(_0x5e5a2f){return _0x5e5a2f?{'count':_0x1744be,'rows':_0x5e5a2f}:null;}})[_0x3b8c('0x2b')](respondWithResult(_0x38ceb0,null))[_0x3b8c('0x46')](handleError(_0x38ceb0,null));}; \ No newline at end of file +var _0xd1f0=['hasOwnProperty','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','length','query','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','include','options','find','create','body','params','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','findOne','order','$gte','split','format'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0xd1f0,0x121));var _0x0d1f=function(_0x28c752,_0x238454){_0x28c752=_0x28c752-0x0;var _0x30cd6c=_0xd1f0[_0x28c752];return _0x30cd6c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0d1f('0x0'));var jsonpatch=require(_0x0d1f('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0d1f('0x2'));var Mustache=require(_0x0d1f('0x3'));var util=require(_0x0d1f('0x4'));var path=require(_0x0d1f('0x5'));var sox=require(_0x0d1f('0x6'));var csv=require(_0x0d1f('0x7'));var ejs=require(_0x0d1f('0x8'));var fs=require('fs');var fs_extra=require(_0x0d1f('0x9'));var _=require('lodash');var squel=require(_0x0d1f('0xa'));var crypto=require(_0x0d1f('0xb'));var jsforce=require(_0x0d1f('0xc'));var deskjs=require(_0x0d1f('0xd'));var toCsv=require(_0x0d1f('0x7'));var querystring=require(_0x0d1f('0xe'));var Papa=require(_0x0d1f('0xf'));var Redis=require(_0x0d1f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0d1f('0x11'));var as=require(_0x0d1f('0x12'));var hardwareService=require(_0x0d1f('0x13'));var logger=require(_0x0d1f('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x0d1f('0x15'));var licenseUtil=require(_0x0d1f('0x16'));var db=require(_0x0d1f('0x17'))['db'];config[_0x0d1f('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0d1f('0x19'))(new Redis(config['redis']));require(_0x0d1f('0x1a'))[_0x0d1f('0x1b')](socket);function respondWithStatusCode(_0x458fbc,_0x110149){_0x110149=_0x110149||0xcc;return function(_0x26c3c9){if(_0x26c3c9){return _0x458fbc[_0x0d1f('0x1c')](_0x110149);}return _0x458fbc[_0x0d1f('0x1d')](_0x110149)['end']();};}function respondWithResult(_0x5e204f,_0x215612){_0x215612=_0x215612||0xc8;return function(_0x10fb38){if(_0x10fb38){return _0x5e204f[_0x0d1f('0x1d')](_0x215612)['json'](_0x10fb38);}};}function respondWithFilteredResult(_0x518cbd,_0x1dfebd){return function(_0x4b31ea){if(_0x4b31ea){var _0x26b2e8=typeof _0x1dfebd[_0x0d1f('0x1e')]===_0x0d1f('0x1f')&&typeof _0x1dfebd[_0x0d1f('0x20')]==='undefined';var _0x570925=_0x4b31ea['count'];var _0x308b1d=_0x26b2e8?0x0:_0x1dfebd['offset'];var _0x2be483=_0x26b2e8?_0x4b31ea[_0x0d1f('0x21')]:_0x1dfebd['offset']+_0x1dfebd[_0x0d1f('0x20')];var _0x55e01e;if(_0x2be483>=_0x570925){_0x2be483=_0x570925;_0x55e01e=0xc8;}else{_0x55e01e=0xce;}_0x518cbd['status'](_0x55e01e);return _0x518cbd[_0x0d1f('0x22')](_0x0d1f('0x23'),_0x308b1d+'-'+_0x2be483+'/'+_0x570925)[_0x0d1f('0x24')](_0x4b31ea);}return null;};}function patchUpdates(_0x501c7c){return function(_0x445249){try{jsonpatch[_0x0d1f('0x25')](_0x445249,_0x501c7c,!![]);}catch(_0x1f1999){return BPromise[_0x0d1f('0x26')](_0x1f1999);}return _0x445249['save']();};}function saveUpdates(_0x202e8a,_0x38d2f5){return function(_0xf8a384){if(_0xf8a384){return _0xf8a384[_0x0d1f('0x27')](_0x202e8a)[_0x0d1f('0x28')](function(_0x5ecefb){return _0x5ecefb;});}return null;};}function removeEntity(_0x2ea00d,_0x438d8e){return function(_0x29ac70){if(_0x29ac70){return _0x29ac70[_0x0d1f('0x29')]()[_0x0d1f('0x28')](function(){_0x2ea00d[_0x0d1f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29349f,_0x2c895a){return function(_0x4e9d13){if(!_0x4e9d13){_0x29349f[_0x0d1f('0x1c')](0x194);}return _0x4e9d13;};}function handleError(_0x242c8d,_0x4afdb1){_0x4afdb1=_0x4afdb1||0x1f4;return function(_0x6c1245){logger['error'](_0x6c1245[_0x0d1f('0x2a')]);if(_0x6c1245[_0x0d1f('0x2b')]){delete _0x6c1245[_0x0d1f('0x2b')];}_0x242c8d[_0x0d1f('0x1d')](_0x4afdb1)[_0x0d1f('0x2c')](_0x6c1245);};}exports[_0x0d1f('0x2d')]=function(_0x2b7c5c,_0xa4daa9){var _0x19c97b={},_0x2b361e={},_0x11a2d9={'count':0x0,'rows':[]};var _0x724ce5=_[_0x0d1f('0x2e')](db[_0x0d1f('0x2f')][_0x0d1f('0x30')],function(_0x14e2d3){return{'name':_0x14e2d3[_0x0d1f('0x31')],'type':_0x14e2d3[_0x0d1f('0x32')][_0x0d1f('0x33')]};});_0x2b361e[_0x0d1f('0x34')]=_[_0x0d1f('0x2e')](_0x724ce5,'name');_0x2b361e['query']=_[_0x0d1f('0x35')](_0x2b7c5c['query']);_0x2b361e[_0x0d1f('0x36')]=_[_0x0d1f('0x37')](_0x2b361e['model'],_0x2b361e['query']);_0x19c97b[_0x0d1f('0x38')]=_[_0x0d1f('0x37')](_0x2b361e[_0x0d1f('0x34')],qs[_0x0d1f('0x39')](_0x2b7c5c['query'][_0x0d1f('0x39')]));_0x19c97b[_0x0d1f('0x38')]=_0x19c97b['attributes'][_0x0d1f('0x3a')]?_0x19c97b[_0x0d1f('0x38')]:_0x2b361e[_0x0d1f('0x34')];if(!_0x2b7c5c[_0x0d1f('0x3b')]['hasOwnProperty'](_0x0d1f('0x3c'))){_0x19c97b[_0x0d1f('0x20')]=qs[_0x0d1f('0x20')](_0x2b7c5c[_0x0d1f('0x3b')][_0x0d1f('0x20')]);_0x19c97b[_0x0d1f('0x1e')]=qs[_0x0d1f('0x1e')](_0x2b7c5c[_0x0d1f('0x3b')][_0x0d1f('0x1e')]);}_0x19c97b['order']=qs['sort'](_0x2b7c5c[_0x0d1f('0x3b')][_0x0d1f('0x3d')]);_0x19c97b[_0x0d1f('0x3e')]=qs[_0x0d1f('0x36')](_['pick'](_0x2b7c5c[_0x0d1f('0x3b')],_0x2b361e['filters']),_0x724ce5);if(_0x2b7c5c[_0x0d1f('0x3b')][_0x0d1f('0x3f')]){_0x19c97b['where']=_[_0x0d1f('0x40')](_0x19c97b['where'],{'$or':_[_0x0d1f('0x2e')](_0x724ce5,function(_0x1fb33d){if(_0x1fb33d[_0x0d1f('0x32')]!==_0x0d1f('0x41')){var _0x5bf3c5={};_0x5bf3c5[_0x1fb33d['name']]={'$like':'%'+_0x2b7c5c[_0x0d1f('0x3b')]['filter']+'%'};return _0x5bf3c5;}})});}_0x19c97b=_[_0x0d1f('0x40')]({},_0x19c97b,_0x2b7c5c['options']);var _0x4aa249={'where':_0x19c97b['where']};return db[_0x0d1f('0x2f')]['count'](_0x4aa249)[_0x0d1f('0x28')](function(_0x553ad){_0x11a2d9[_0x0d1f('0x21')]=_0x553ad;if(_0x2b7c5c[_0x0d1f('0x3b')][_0x0d1f('0x42')]){_0x19c97b['include']=[{'all':!![]}];}return db[_0x0d1f('0x2f')][_0x0d1f('0x43')](_0x19c97b);})[_0x0d1f('0x28')](function(_0x593afb){_0x11a2d9[_0x0d1f('0x44')]=_0x593afb;return _0x11a2d9;})['then'](respondWithFilteredResult(_0xa4daa9,_0x19c97b))[_0x0d1f('0x45')](handleError(_0xa4daa9,null));};exports[_0x0d1f('0x46')]=function(_0x2dc20a,_0x43b543){var _0x40aa49={'raw':!![],'where':{'id':_0x2dc20a['params']['id']}},_0x32cda9={};_0x32cda9[_0x0d1f('0x34')]=_['keys'](db['ChatGroup'][_0x0d1f('0x30')]);_0x32cda9[_0x0d1f('0x3b')]=_[_0x0d1f('0x35')](_0x2dc20a[_0x0d1f('0x3b')]);_0x32cda9[_0x0d1f('0x36')]=_[_0x0d1f('0x37')](_0x32cda9['model'],_0x32cda9['query']);_0x40aa49[_0x0d1f('0x38')]=_[_0x0d1f('0x37')](_0x32cda9[_0x0d1f('0x34')],qs[_0x0d1f('0x39')](_0x2dc20a[_0x0d1f('0x3b')]['fields']));_0x40aa49[_0x0d1f('0x38')]=_0x40aa49[_0x0d1f('0x38')][_0x0d1f('0x3a')]?_0x40aa49[_0x0d1f('0x38')]:_0x32cda9['model'];if(_0x2dc20a[_0x0d1f('0x3b')][_0x0d1f('0x42')]){_0x40aa49[_0x0d1f('0x47')]=[{'all':!![]}];}_0x40aa49=_[_0x0d1f('0x40')]({},_0x40aa49,_0x2dc20a[_0x0d1f('0x48')]);return db[_0x0d1f('0x2f')][_0x0d1f('0x49')](_0x40aa49)[_0x0d1f('0x28')](handleEntityNotFound(_0x43b543,null))['then'](respondWithResult(_0x43b543,null))[_0x0d1f('0x45')](handleError(_0x43b543,null));};exports[_0x0d1f('0x4a')]=function(_0x2426ce,_0x73af19){return db[_0x0d1f('0x2f')][_0x0d1f('0x4a')](_0x2426ce[_0x0d1f('0x4b')],{})[_0x0d1f('0x28')](respondWithResult(_0x73af19,0xc9))[_0x0d1f('0x45')](handleError(_0x73af19,null));};exports[_0x0d1f('0x27')]=function(_0x4bbe44,_0x15eb5a){if(_0x4bbe44[_0x0d1f('0x4b')]['id']){delete _0x4bbe44[_0x0d1f('0x4b')]['id'];}return db['ChatGroup'][_0x0d1f('0x49')]({'where':{'id':_0x4bbe44['params']['id']}})['then'](handleEntityNotFound(_0x15eb5a,null))['then'](saveUpdates(_0x4bbe44[_0x0d1f('0x4b')],null))['then'](respondWithResult(_0x15eb5a,null))['catch'](handleError(_0x15eb5a,null));};exports[_0x0d1f('0x29')]=function(_0x1857a7,_0x26924d){return db['ChatGroup'][_0x0d1f('0x49')]({'where':{'id':_0x1857a7[_0x0d1f('0x4c')]['id']}})[_0x0d1f('0x28')](handleEntityNotFound(_0x26924d,null))[_0x0d1f('0x28')](removeEntity(_0x26924d,null))['catch'](handleError(_0x26924d,null));};exports['describe']=function(_0x2d5d89,_0x349a45){return db[_0x0d1f('0x2f')][_0x0d1f('0x4d')]()[_0x0d1f('0x28')](respondWithResult(_0x349a45,null))[_0x0d1f('0x45')](handleError(_0x349a45,null));};exports[_0x0d1f('0x4e')]=function(_0x313ebe,_0x29dce4,_0xf29f9f){return db[_0x0d1f('0x4f')][_0x0d1f('0x21')]({'where':{'ChatGroupId':_0x313ebe['params']['id'],'ToId':_0x313ebe[_0x0d1f('0x50')]['id'],'read':![]}})['then'](function(_0x788dd3){return{'id':_[_0x0d1f('0x51')](_0x313ebe[_0x0d1f('0x4c')]['id']),'count':_0x788dd3};})[_0x0d1f('0x28')](respondWithResult(_0x29dce4,null))['catch'](handleError(_0x29dce4,null));};exports[_0x0d1f('0x52')]=function(_0x4ca63d,_0x26bb7e,_0x39e5ac){return db[_0x0d1f('0x2f')][_0x0d1f('0x49')]({'where':{'id':_0x4ca63d[_0x0d1f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x26bb7e,null))[_0x0d1f('0x28')](function(_0xa3f114){if(_0xa3f114){return _0xa3f114[_0x0d1f('0x52')](_0x4ca63d['body'][_0x0d1f('0x53')],_[_0x0d1f('0x54')](_0x4ca63d[_0x0d1f('0x4b')],[_0x0d1f('0x53'),'id'])||{});}})[_0x0d1f('0x28')](respondWithResult(_0x26bb7e,null))[_0x0d1f('0x45')](handleError(_0x26bb7e,null));};exports[_0x0d1f('0x55')]=function(_0x2cbada,_0x3ba8e7,_0x1c8739){var _0x3e79c6={};var _0x342219={};var _0x1ef433;var _0x224ec3;return db['ChatGroup']['findOne']({'where':{'id':_0x2cbada[_0x0d1f('0x4c')]['id']}})[_0x0d1f('0x28')](handleEntityNotFound(_0x3ba8e7,null))[_0x0d1f('0x28')](function(_0x52ce58){if(_0x52ce58){_0x1ef433=_0x52ce58;_0x342219['model']=_[_0x0d1f('0x35')](db['User'][_0x0d1f('0x30')]);_0x342219[_0x0d1f('0x3b')]=_['keys'](_0x2cbada[_0x0d1f('0x3b')]);_0x342219['filters']=_[_0x0d1f('0x37')](_0x342219[_0x0d1f('0x34')],_0x342219[_0x0d1f('0x3b')]);_0x3e79c6[_0x0d1f('0x38')]=_[_0x0d1f('0x37')](_0x342219[_0x0d1f('0x34')],qs[_0x0d1f('0x39')](_0x2cbada[_0x0d1f('0x3b')][_0x0d1f('0x39')]));_0x3e79c6['attributes']=_0x3e79c6[_0x0d1f('0x38')][_0x0d1f('0x3a')]?_0x3e79c6['attributes']:_0x342219[_0x0d1f('0x34')];_0x3e79c6['order']=qs[_0x0d1f('0x3d')](_0x2cbada[_0x0d1f('0x3b')][_0x0d1f('0x3d')]);_0x3e79c6[_0x0d1f('0x3e')]=qs[_0x0d1f('0x36')](_['pick'](_0x2cbada[_0x0d1f('0x3b')],_0x342219[_0x0d1f('0x36')]));if(_0x2cbada[_0x0d1f('0x3b')][_0x0d1f('0x3f')]){_0x3e79c6[_0x0d1f('0x3e')]=_[_0x0d1f('0x40')](_0x3e79c6[_0x0d1f('0x3e')],{'$or':_[_0x0d1f('0x2e')](_0x3e79c6[_0x0d1f('0x38')],function(_0x4196bc){var _0x3cb1c8={};_0x3cb1c8[_0x4196bc]={'$like':'%'+_0x2cbada[_0x0d1f('0x3b')][_0x0d1f('0x3f')]+'%'};return _0x3cb1c8;})});}_0x3e79c6=_[_0x0d1f('0x40')]({},_0x3e79c6,_0x2cbada[_0x0d1f('0x48')]);return _0x1ef433[_0x0d1f('0x55')](_0x3e79c6);}})['then'](function(_0x592fbd){if(_0x592fbd){_0x224ec3=_0x592fbd[_0x0d1f('0x3a')];if(!_0x2cbada['query']['hasOwnProperty'](_0x0d1f('0x3c'))){_0x3e79c6['limit']=qs['limit'](_0x2cbada[_0x0d1f('0x3b')]['limit']);_0x3e79c6[_0x0d1f('0x1e')]=qs[_0x0d1f('0x1e')](_0x2cbada[_0x0d1f('0x3b')]['offset']);}return _0x1ef433[_0x0d1f('0x55')](_0x3e79c6);}})['then'](function(_0x151bf6){if(_0x151bf6){return _0x151bf6?{'count':_0x224ec3,'rows':_0x151bf6}:null;}})[_0x0d1f('0x28')](respondWithResult(_0x3ba8e7,null))[_0x0d1f('0x45')](handleError(_0x3ba8e7,null));};exports['removeMembers']=function(_0x15e22c,_0x5386e1,_0x1f32b2){return db[_0x0d1f('0x2f')][_0x0d1f('0x49')]({'where':{'id':_0x15e22c['params']['id']}})[_0x0d1f('0x28')](handleEntityNotFound(_0x5386e1,null))['then'](function(_0x38156d){if(_0x38156d){return _0x38156d[_0x0d1f('0x56')](_0x15e22c[_0x0d1f('0x3b')]['ids']);}})['then'](respondWithStatusCode(_0x5386e1,null))[_0x0d1f('0x45')](handleError(_0x5386e1,null));};exports[_0x0d1f('0x57')]=function(_0x11cf93,_0x5cd282,_0x5d106f){if(_0x11cf93[_0x0d1f('0x4b')]['id']){delete _0x11cf93[_0x0d1f('0x4b')]['id'];}return db[_0x0d1f('0x2f')][_0x0d1f('0x49')]({'where':{'id':_0x11cf93[_0x0d1f('0x4c')]['id']}})[_0x0d1f('0x28')](handleEntityNotFound(_0x5cd282,null))[_0x0d1f('0x28')](function(_0x5c2d99){if(_0x5c2d99){_0x11cf93[_0x0d1f('0x4b')][_0x0d1f('0x58')]=_0x5c2d99['id'];return db[_0x0d1f('0x4f')][_0x0d1f('0x4a')](_0x11cf93['body']);}})[_0x0d1f('0x28')](respondWithResult(_0x5cd282,null))[_0x0d1f('0x45')](handleError(_0x5cd282,null));};exports[_0x0d1f('0x59')]=function(_0x557bfa,_0x1b526a,_0x7be642){var _0x5caa7a={};var _0x1cbfff={};var _0x25673d;var _0x571c9e;return db[_0x0d1f('0x2f')][_0x0d1f('0x5a')]({'where':{'id':_0x557bfa['params']['id']}})['then'](handleEntityNotFound(_0x1b526a,null))[_0x0d1f('0x28')](function(_0x19ccb2){if(_0x19ccb2){_0x25673d=_0x19ccb2;_0x1cbfff[_0x0d1f('0x34')]=_[_0x0d1f('0x35')](db[_0x0d1f('0x4f')][_0x0d1f('0x30')]);_0x1cbfff['query']=_['keys'](_0x557bfa[_0x0d1f('0x3b')]);_0x1cbfff[_0x0d1f('0x36')]=_[_0x0d1f('0x37')](_0x1cbfff['model'],_0x1cbfff[_0x0d1f('0x3b')]);_0x5caa7a['attributes']=_['intersection'](_0x1cbfff[_0x0d1f('0x34')],qs[_0x0d1f('0x39')](_0x557bfa['query']['fields']));_0x5caa7a['attributes']=_0x5caa7a['attributes'][_0x0d1f('0x3a')]?_0x5caa7a[_0x0d1f('0x38')]:_0x1cbfff[_0x0d1f('0x34')];_0x5caa7a[_0x0d1f('0x5b')]=qs[_0x0d1f('0x3d')](_0x557bfa[_0x0d1f('0x3b')][_0x0d1f('0x3d')]);_0x5caa7a[_0x0d1f('0x3e')]=qs[_0x0d1f('0x36')](_['pick'](_0x557bfa[_0x0d1f('0x3b')],_0x1cbfff[_0x0d1f('0x36')]));if(_0x557bfa[_0x0d1f('0x3b')][_0x0d1f('0x3f')]){_0x5caa7a[_0x0d1f('0x3e')]=_[_0x0d1f('0x40')](_0x5caa7a['where'],{'$or':_[_0x0d1f('0x2e')](_0x5caa7a[_0x0d1f('0x38')],function(_0x3ba24a){var _0x23d135={};_0x23d135[_0x3ba24a]={'$like':'%'+_0x557bfa[_0x0d1f('0x3b')][_0x0d1f('0x3f')]+'%'};return _0x23d135;})});}if(_0x557bfa[_0x0d1f('0x3b')][_0x0d1f('0x5c')]){var _0x12c4eb=_0x557bfa[_0x0d1f('0x3b')][_0x0d1f('0x5c')][_0x0d1f('0x5d')](',');var _0xbdec7={};_0xbdec7[_0x12c4eb[0x0]]={'$gte':moment(_0x12c4eb[0x1])[_0x0d1f('0x5e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5caa7a[_0x0d1f('0x3e')]=_[_0x0d1f('0x40')](_0x5caa7a[_0x0d1f('0x3e')],_0xbdec7);}_0x5caa7a=_[_0x0d1f('0x40')]({},_0x5caa7a,_0x557bfa[_0x0d1f('0x48')]);return _0x25673d[_0x0d1f('0x59')](_0x5caa7a);}})[_0x0d1f('0x28')](function(_0x5dc055){if(_0x5dc055){_0x571c9e=_0x5dc055[_0x0d1f('0x3a')];if(!_0x557bfa[_0x0d1f('0x3b')][_0x0d1f('0x5f')](_0x0d1f('0x3c'))){_0x5caa7a[_0x0d1f('0x20')]=qs[_0x0d1f('0x20')](_0x557bfa[_0x0d1f('0x3b')][_0x0d1f('0x20')]);_0x5caa7a[_0x0d1f('0x1e')]=qs[_0x0d1f('0x1e')](_0x557bfa[_0x0d1f('0x3b')][_0x0d1f('0x1e')]);}return _0x25673d['getMessages'](_0x5caa7a);}})[_0x0d1f('0x28')](function(_0x2dc371){if(_0x2dc371){return _0x2dc371?{'count':_0x571c9e,'rows':_0x2dc371}:null;}})['then'](respondWithResult(_0x1b526a,null))[_0x0d1f('0x45')](handleError(_0x1b526a,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index de3b54c..a384e5a 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 _0x97ce=['hook','events','../../mysqldb','ChatGroup','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x4ce4c8,_0x26fd92){var _0x41dec1=function(_0x405a0a){while(--_0x405a0a){_0x4ce4c8['push'](_0x4ce4c8['shift']());}};_0x41dec1(++_0x26fd92);}(_0x97ce,0x151));var _0xe97c=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x97ce[_0x4b7895];return _0x264180;};'use strict';var EventEmitter=require(_0xe97c('0x0'));var ChatGroup=require(_0xe97c('0x1'))['db'][_0xe97c('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xe97c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe97c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3001eb){return function(_0x49df42,_0x443ea2,_0x259e69){ChatGroupEvents[_0xe97c('0x5')](_0x3001eb+':'+_0x49df42['id'],_0x49df42);ChatGroupEvents[_0xe97c('0x5')](_0x3001eb,_0x49df42);_0x259e69(null);};}for(var e in events){if(events[_0xe97c('0x6')](e)){var event=events[e];ChatGroup[_0xe97c('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x5cc3=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5cc3,0x144));var _0x35cc=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5cc3[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0x35cc('0x0'));var ChatGroup=require(_0x35cc('0x1'))['db'][_0x35cc('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x35cc('0x3')](0x0);var events={'afterCreate':_0x35cc('0x4'),'afterUpdate':_0x35cc('0x5'),'afterDestroy':_0x35cc('0x6')};function emitEvent(_0x31215c){return function(_0x4c5fc0,_0x4ba698,_0x23c609){ChatGroupEvents[_0x35cc('0x7')](_0x31215c+':'+_0x4c5fc0['id'],_0x4c5fc0);ChatGroupEvents[_0x35cc('0x7')](_0x31215c,_0x4c5fc0);_0x23c609(null);};}for(var e in events){if(events[_0x35cc('0x8')](e)){var event=events[e];ChatGroup[_0x35cc('0x9')](e,emitEvent(event));}}module[_0x35cc('0xa')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 1874c4d..cfabc1c 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 _0x92aa=['../../config/logger','api','moment','bluebird','request-promise','path','./chatGroup.attributes','exports','define','chat_groups','lodash','util'];(function(_0xe86606,_0x2804a3){var _0x7cbd97=function(_0xaae7c7){while(--_0xaae7c7){_0xe86606['push'](_0xe86606['shift']());}};_0x7cbd97(++_0x2804a3);}(_0x92aa,0x1ea));var _0xa92a=function(_0x2dd889,_0x29c616){_0x2dd889=_0x2dd889-0x0;var _0xd809a0=_0x92aa[_0x2dd889];return _0xd809a0;};'use strict';var _=require(_0xa92a('0x0'));var util=require(_0xa92a('0x1'));var logger=require(_0xa92a('0x2'))(_0xa92a('0x3'));var moment=require(_0xa92a('0x4'));var BPromise=require(_0xa92a('0x5'));var rp=require(_0xa92a('0x6'));var fs=require('fs');var path=require(_0xa92a('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa92a('0x8'));module[_0xa92a('0x9')]=function(_0x3f8e82,_0x167e83){return _0x3f8e82[_0xa92a('0xa')]('ChatGroup',attributes,{'tableName':_0xa92a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0af8=['util','moment','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash'];(function(_0x4c42ed,_0x125705){var _0xdc5cc4=function(_0x3c92b7){while(--_0x3c92b7){_0x4c42ed['push'](_0x4c42ed['shift']());}};_0xdc5cc4(++_0x125705);}(_0x0af8,0x1c7));var _0x80af=function(_0x3b2ee7,_0x217f4a){_0x3b2ee7=_0x3b2ee7-0x0;var _0x43699b=_0x0af8[_0x3b2ee7];return _0x43699b;};'use strict';var _=require(_0x80af('0x0'));var util=require(_0x80af('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x80af('0x2'));var BPromise=require('bluebird');var rp=require(_0x80af('0x3'));var fs=require('fs');var path=require(_0x80af('0x4'));var rimraf=require(_0x80af('0x5'));var config=require(_0x80af('0x6'));var attributes=require(_0x80af('0x7'));module[_0x80af('0x8')]=function(_0x4497c2,_0x41d2df){return _0x4497c2[_0x80af('0x9')](_0x80af('0xa'),attributes,{'tableName':_0x80af('0xb'),'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 beba14b..2e40c36 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 _0x4b0c=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b0c,0x138));var _0xc4b0=function(_0xfebda8,_0x2538a0){_0xfebda8=_0xfebda8-0x0;var _0x69c74a=_0x4b0c[_0xfebda8];return _0x69c74a;};'use strict';var _=require(_0xc4b0('0x0'));var util=require('util');var moment=require(_0xc4b0('0x1'));var BPromise=require(_0xc4b0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4b0('0x3'));var db=require(_0xc4b0('0x4'))['db'];var utils=require(_0xc4b0('0x5'));var logger=require(_0xc4b0('0x6'))(_0xc4b0('0x7'));var config=require(_0xc4b0('0x8'));var jayson=require(_0xc4b0('0x9'));var client=jayson[_0xc4b0('0xa')]['http']({'port':0x232a});config[_0xc4b0('0xb')]=_[_0xc4b0('0xc')](config[_0xc4b0('0xb')],{'host':_0xc4b0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc4b0('0xb')]));require(_0xc4b0('0xe'))[_0xc4b0('0xf')](socket);function respondWithRpcPromise(_0x28267b,_0x40a0ac,_0x38a6f8){return new BPromise(function(_0x21c483,_0x752945){return client[_0xc4b0('0x10')](_0x28267b,_0x38a6f8)[_0xc4b0('0x11')](function(_0x8107b9){logger['info'](_0xc4b0('0x12'),_0x40a0ac,'request\x20sent');logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x40a0ac,'request\x20sent',JSON[_0xc4b0('0x13')](_0x8107b9));if(_0x8107b9['error']){if(_0x8107b9[_0xc4b0('0x14')][_0xc4b0('0x15')]===0x1f4){logger['error'](_0xc4b0('0x12'),_0x40a0ac,_0x8107b9['error'][_0xc4b0('0x16')]);return _0x752945(_0x8107b9['error'][_0xc4b0('0x16')]);}logger[_0xc4b0('0x14')](_0xc4b0('0x12'),_0x40a0ac,_0x8107b9[_0xc4b0('0x14')]['message']);return _0x21c483(_0x8107b9[_0xc4b0('0x14')][_0xc4b0('0x16')]);}else{logger[_0xc4b0('0x17')](_0xc4b0('0x12'),_0x40a0ac,_0xc4b0('0x18'));_0x21c483(_0x8107b9[_0xc4b0('0x19')][_0xc4b0('0x16')]);}})['catch'](function(_0x5ab1c2){logger[_0xc4b0('0x14')](_0xc4b0('0x12'),_0x40a0ac,_0x5ab1c2);_0x752945(_0x5ab1c2);});});} \ No newline at end of file +var _0xe914=['info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xe914,0x7f));var _0x4e91=function(_0x38efe1,_0x34a883){_0x38efe1=_0x38efe1-0x0;var _0x44c9fb=_0xe914[_0x38efe1];return _0x44c9fb;};'use strict';var _=require(_0x4e91('0x0'));var util=require(_0x4e91('0x1'));var moment=require('moment');var BPromise=require(_0x4e91('0x2'));var rs=require(_0x4e91('0x3'));var fs=require('fs');var Redis=require(_0x4e91('0x4'));var db=require(_0x4e91('0x5'))['db'];var utils=require(_0x4e91('0x6'));var logger=require(_0x4e91('0x7'))('rpc');var config=require(_0x4e91('0x8'));var jayson=require(_0x4e91('0x9'));var client=jayson['client'][_0x4e91('0xa')]({'port':0x232a});config[_0x4e91('0xb')]=_[_0x4e91('0xc')](config[_0x4e91('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4e91('0xb')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0xa7ca19,_0x1a0504,_0x2997fa){return new BPromise(function(_0x2762e9,_0x4c690f){return client[_0x4e91('0xd')](_0xa7ca19,_0x2997fa)[_0x4e91('0xe')](function(_0x38d3b4){logger['info'](_0x4e91('0xf'),_0x1a0504,_0x4e91('0x10'));logger[_0x4e91('0x11')](_0x4e91('0x12'),_0x1a0504,_0x4e91('0x10'),JSON[_0x4e91('0x13')](_0x38d3b4));if(_0x38d3b4[_0x4e91('0x14')]){if(_0x38d3b4[_0x4e91('0x14')][_0x4e91('0x15')]===0x1f4){logger['error'](_0x4e91('0xf'),_0x1a0504,_0x38d3b4[_0x4e91('0x14')][_0x4e91('0x16')]);return _0x4c690f(_0x38d3b4['error'][_0x4e91('0x16')]);}logger[_0x4e91('0x14')](_0x4e91('0xf'),_0x1a0504,_0x38d3b4[_0x4e91('0x14')][_0x4e91('0x16')]);return _0x2762e9(_0x38d3b4[_0x4e91('0x14')][_0x4e91('0x16')]);}else{logger[_0x4e91('0x17')]('ChatGroup,\x20%s,\x20%s',_0x1a0504,_0x4e91('0x10'));_0x2762e9(_0x38d3b4[_0x4e91('0x18')][_0x4e91('0x16')]);}})['catch'](function(_0x23caed){logger[_0x4e91('0x14')]('ChatGroup,\x20%s,\x20%s',_0x1a0504,_0x23caed);_0x4c690f(_0x23caed);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index da07eac..2f84872 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 _0x8e41=['register','length','chatGroup:','./chatGroup.events','update','removeListener'];(function(_0x56df43,_0x5d6aea){var _0x1b3c06=function(_0x1b796a){while(--_0x1b796a){_0x56df43['push'](_0x56df43['shift']());}};_0x1b3c06(++_0x5d6aea);}(_0x8e41,0x141));var _0x18e4=function(_0x5ad3cb,_0x4ff404){_0x5ad3cb=_0x5ad3cb-0x0;var _0xbea1e2=_0x8e41[_0x5ad3cb];return _0xbea1e2;};'use strict';var ChatGroupEvents=require(_0x18e4('0x0'));var events=['save','remove',_0x18e4('0x1')];function createListener(_0x3c4fed,_0x50561a){return function(_0x3ed085){_0x50561a['emit'](_0x3c4fed,_0x3ed085);};}function removeListener(_0x40d04a,_0x3d8cdb){return function(){ChatGroupEvents[_0x18e4('0x2')](_0x40d04a,_0x3d8cdb);};}exports[_0x18e4('0x3')]=function(_0x57d012){for(var _0x98441d=0x0,_0x346c6e=events[_0x18e4('0x4')];_0x98441d<_0x346c6e;_0x98441d++){var _0x167901=events[_0x98441d];var _0x5f3db5=createListener(_0x18e4('0x5')+_0x167901,_0x57d012);ChatGroupEvents['on'](_0x167901,_0x5f3db5);}}; \ No newline at end of file +var _0x42c0=['remove','update','emit','removeListener','register','chatGroup:','./chatGroup.events'];(function(_0x584bfa,_0x15fccb){var _0x3b55a6=function(_0x299738){while(--_0x299738){_0x584bfa['push'](_0x584bfa['shift']());}};_0x3b55a6(++_0x15fccb);}(_0x42c0,0x156));var _0x042c=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x42c0[_0x4a53d];return _0x27410e;};'use strict';var ChatGroupEvents=require(_0x042c('0x0'));var events=['save',_0x042c('0x1'),_0x042c('0x2')];function createListener(_0x1cfe9d,_0x4f2c9d){return function(_0x38075b){_0x4f2c9d[_0x042c('0x3')](_0x1cfe9d,_0x38075b);};}function removeListener(_0x186c3b,_0x4d643d){return function(){ChatGroupEvents[_0x042c('0x4')](_0x186c3b,_0x4d643d);};}exports[_0x042c('0x5')]=function(_0xa9f6e0){for(var _0x37466a=0x0,_0x35faac=events['length'];_0x37466a<_0x35faac;_0x37466a++){var _0xd8a0e0=events[_0x37466a];var _0x34d2c1=createListener(_0x042c('0x6')+_0xd8a0e0,_0xa9f6e0);ChatGroupEvents['on'](_0xd8a0e0,_0x34d2c1);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 35a4b00..8dae62f 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 _0x6ff7=['express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','describe','/:id','show','/:id/unread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put','update','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ff7,0x10a));var _0x76ff=function(_0xd0272b,_0x655b5e){_0xd0272b=_0xd0272b-0x0;var _0x46e0cc=_0x6ff7[_0xd0272b];return _0x46e0cc;};'use strict';var multer=require(_0x76ff('0x0'));var util=require(_0x76ff('0x1'));var path=require(_0x76ff('0x2'));var timeout=require(_0x76ff('0x3'));var express=require(_0x76ff('0x4'));var router=express['Router']();var fs_extra=require(_0x76ff('0x5'));var auth=require(_0x76ff('0x6'));var interaction=require(_0x76ff('0x7'));var config=require('../../config/environment');var controller=require(_0x76ff('0x8'));router[_0x76ff('0x9')]('/',auth[_0x76ff('0xa')](),controller[_0x76ff('0xb')]);router[_0x76ff('0x9')]('/describe',auth[_0x76ff('0xa')](),controller[_0x76ff('0xc')]);router[_0x76ff('0x9')](_0x76ff('0xd'),auth[_0x76ff('0xa')](),controller[_0x76ff('0xe')]);router['get'](_0x76ff('0xf'),auth[_0x76ff('0xa')](),controller['getUnread']);router['get'](_0x76ff('0x10'),auth[_0x76ff('0xa')](),controller[_0x76ff('0x11')]);router[_0x76ff('0x9')](_0x76ff('0x12'),auth[_0x76ff('0xa')](),controller[_0x76ff('0x13')]);router[_0x76ff('0x14')]('/',auth[_0x76ff('0xa')](),controller[_0x76ff('0x15')]);router[_0x76ff('0x14')]('/:id/members',auth[_0x76ff('0xa')](),controller[_0x76ff('0x16')]);router[_0x76ff('0x14')](_0x76ff('0x12'),auth[_0x76ff('0xa')](),controller[_0x76ff('0x17')]);router[_0x76ff('0x18')](_0x76ff('0xd'),auth[_0x76ff('0xa')](),controller[_0x76ff('0x19')]);router[_0x76ff('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x76ff('0x1b')]);router['delete'](_0x76ff('0x10'),auth['isAuthenticated'](),controller[_0x76ff('0x1c')]);module[_0x76ff('0x1d')]=router; \ No newline at end of file +var _0x3bd1=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./chatGroup.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/unread','/:id/members','getMembers','/:id/messages','getMessages','create','post','addMessage','update','delete','destroy','removeMembers'];(function(_0xa1da69,_0x34c5da){var _0x20ed09=function(_0x23e2bc){while(--_0x23e2bc){_0xa1da69['push'](_0xa1da69['shift']());}};_0x20ed09(++_0x34c5da);}(_0x3bd1,0x1b0));var _0x13bd=function(_0x3a948e,_0x477a92){_0x3a948e=_0x3a948e-0x0;var _0x463825=_0x3bd1[_0x3a948e];return _0x463825;};'use strict';var multer=require(_0x13bd('0x0'));var util=require(_0x13bd('0x1'));var path=require(_0x13bd('0x2'));var timeout=require(_0x13bd('0x3'));var express=require(_0x13bd('0x4'));var router=express[_0x13bd('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x13bd('0x6'));var config=require('../../config/environment');var controller=require(_0x13bd('0x7'));router['get']('/',auth[_0x13bd('0x8')](),controller[_0x13bd('0x9')]);router[_0x13bd('0xa')](_0x13bd('0xb'),auth[_0x13bd('0x8')](),controller[_0x13bd('0xc')]);router[_0x13bd('0xa')](_0x13bd('0xd'),auth[_0x13bd('0x8')](),controller[_0x13bd('0xe')]);router[_0x13bd('0xa')](_0x13bd('0xf'),auth['isAuthenticated'](),controller['getUnread']);router['get'](_0x13bd('0x10'),auth[_0x13bd('0x8')](),controller[_0x13bd('0x11')]);router[_0x13bd('0xa')](_0x13bd('0x12'),auth['isAuthenticated'](),controller[_0x13bd('0x13')]);router['post']('/',auth[_0x13bd('0x8')](),controller[_0x13bd('0x14')]);router[_0x13bd('0x15')](_0x13bd('0x10'),auth['isAuthenticated'](),controller['addMembers']);router[_0x13bd('0x15')]('/:id/messages',auth[_0x13bd('0x8')](),controller[_0x13bd('0x16')]);router['put'](_0x13bd('0xd'),auth[_0x13bd('0x8')](),controller[_0x13bd('0x17')]);router[_0x13bd('0x18')](_0x13bd('0xd'),auth[_0x13bd('0x8')](),controller[_0x13bd('0x19')]);router[_0x13bd('0x18')](_0x13bd('0x10'),auth[_0x13bd('0x8')](),controller[_0x13bd('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 84ad579..5711b5d 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 _0x2964=['sequelize','exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long','out'];(function(_0x38b82d,_0x346436){var _0x38a684=function(_0x3730d1){while(--_0x3730d1){_0x38b82d['push'](_0x38b82d['shift']());}};_0x38a684(++_0x346436);}(_0x2964,0x108));var _0x4296=function(_0x3c83e9,_0x33e1fc){_0x3c83e9=_0x3c83e9-0x0;var _0x5c8ab5=_0x2964[_0x3c83e9];return _0x5c8ab5;};'use strict';var Sequelize=require(_0x4296('0x0'));module[_0x4296('0x1')]={'closed':{'type':Sequelize[_0x4296('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x4296('0x3')]},'ratingType':{'type':Sequelize[_0x4296('0x4')](_0x4296('0x5'),_0x4296('0x6')),'defaultValue':_0x4296('0x5')},'ratingMessage':{'type':Sequelize[_0x4296('0x7')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x4296('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x4296('0x9')]},'disposition':{'type':Sequelize[_0x4296('0x8')]},'secondDisposition':{'type':Sequelize[_0x4296('0x8')]},'thirdDisposition':{'type':Sequelize[_0x4296('0x8')]},'note':{'type':Sequelize[_0x4296('0x8')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x4296('0x8')]},'osName':{'type':Sequelize[_0x4296('0x8')]},'osVersion':{'type':Sequelize[_0x4296('0x8')]},'deviceModel':{'type':Sequelize[_0x4296('0x8')]},'deviceVendor':{'type':Sequelize[_0x4296('0x8')]},'deviceType':{'type':Sequelize[_0x4296('0x8')]},'referer':{'type':Sequelize[_0x4296('0x7')]},'customerIp':{'type':Sequelize[_0x4296('0x8')]},'formData':{'type':Sequelize[_0x4296('0x7')](_0x4296('0xa'))},'read1stAt':{'type':Sequelize[_0x4296('0x9')]},'lastMsgAt':{'type':Sequelize[_0x4296('0x9')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x4296('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x4296('0x8')]},'customerPort':{'type':Sequelize[_0x4296('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x4296('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0x4296('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x407f=['TEXT','STRING','DATE','out','BOOLEAN','INTEGER','ENUM','star','thumb'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x407f,0xc2));var _0xf407=function(_0x5dd8df,_0x3199e2){_0x5dd8df=_0x5dd8df-0x0;var _0x3cb358=_0x407f[_0x5dd8df];return _0x3cb358;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xf407('0x0')]},'ratingType':{'type':Sequelize[_0xf407('0x1')](_0xf407('0x2'),_0xf407('0x3')),'defaultValue':_0xf407('0x2')},'ratingMessage':{'type':Sequelize[_0xf407('0x4')]},'pathTranscript':{'type':Sequelize[_0xf407('0x4')]},'mailTranscript':{'type':Sequelize[_0xf407('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xf407('0x6')]},'disposition':{'type':Sequelize[_0xf407('0x5')]},'secondDisposition':{'type':Sequelize[_0xf407('0x5')]},'thirdDisposition':{'type':Sequelize[_0xf407('0x5')]},'note':{'type':Sequelize[_0xf407('0x5')]},'browserName':{'type':Sequelize[_0xf407('0x5')]},'browserVersion':{'type':Sequelize[_0xf407('0x5')]},'osName':{'type':Sequelize[_0xf407('0x5')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xf407('0x5')]},'deviceVendor':{'type':Sequelize[_0xf407('0x5')]},'deviceType':{'type':Sequelize[_0xf407('0x5')]},'referer':{'type':Sequelize[_0xf407('0x4')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT']('long')},'read1stAt':{'type':Sequelize[_0xf407('0x6')]},'lastMsgAt':{'type':Sequelize[_0xf407('0x6')]},'lastMsgDirection':{'type':Sequelize[_0xf407('0x1')]('in',_0xf407('0x7')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xf407('0x5')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xf407('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xf407('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 6b23d22..a81b5aa 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 _0x142a=['findAll','chat','query','user','show','params','model','keys','filters','attributes','intersection','fields','length','includeAll','include','options','create','find','describe','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','follow','isNull','vidaooMetadata','parse','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','abandon','originalname','file','filename','Attachment','closed','Unauthorized','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','basename','download','close','server/files/chat/upload/','format','now','pathTranscript','Messages','User','ChatWebsite','UserId','%s%d','agentAlias','System','customer','Visitor','ContactId','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','getMessages','hasOwnProperty','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','map','secret','includeAgent','rows','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','transcript-%d-%s.zip','push','lastName','attachments','Account','Owner','mkdirSync','Chat','closedAt','disposition','browserName','referer','customerIp','customerPort','existsSync','createReadStream','pipe','createWriteStream','direction','read','value','renderFile','transcript-','err','unlinkSync','rimraf','zip-dir','request-promise','bluebird','mustache','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','client','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','update','destroy','name','send','render','merge','body','contact','agent','account','index','ChatInteraction','rawAttributes','fieldName','type','key','getOptions'];(function(_0x252218,_0x59a0d9){var _0x1f685d=function(_0x3f71ed){while(--_0x3f71ed){_0x252218['push'](_0x252218['shift']());}};_0x1f685d(++_0x59a0d9);}(_0x142a,0x159));var _0xa142=function(_0x3df38b,_0x46223e){_0x3df38b=_0x3df38b-0x0;var _0x5e5e22=_0x142a[_0x3df38b];return _0x5e5e22;};'use strict';var rimraf=require(_0xa142('0x0'));var zipdir=require(_0xa142('0x1'));var rp=require(_0xa142('0x2'));var moment=require('moment');var BPromise=require(_0xa142('0x3'));var Mustache=require(_0xa142('0x4'));var util=require('util');var path=require('path');var ejs=require(_0xa142('0x5'));var fs=require('fs');var _=require(_0xa142('0x6'));var Redis=require(_0xa142('0x7'));var interaction=require(_0xa142('0x8'));var qs=require(_0xa142('0x9'));var pdf=require(_0xa142('0xa'));var logger=require(_0xa142('0xb'))(_0xa142('0xc'));var config=require(_0xa142('0xd'));var db=require(_0xa142('0xe'))['db'];config[_0xa142('0xf')]=_[_0xa142('0x10')](config[_0xa142('0xf')],{'host':_0xa142('0x11'),'port':0x18eb});var socket=require(_0xa142('0x12'))(new Redis(config[_0xa142('0xf')]));require(_0xa142('0x13'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xa142('0x14')]['http']({'port':0x232b});var client9004=jayson[_0xa142('0x14')]['http']({'port':0x232c});function respondWithRpcPromise(_0x595cc2,_0x4d1fb9,_0x58c643,_0x22a55e){return new BPromise(function(_0x3c8432,_0x366b92){var _0x3a2f7b=_0x22a55e||client;return _0x3a2f7b[_0xa142('0x15')](_0x595cc2,_0x58c643)[_0xa142('0x16')](function(_0x271d58){logger['info'](_0xa142('0x17'),_0x4d1fb9,_0xa142('0x18'));logger[_0xa142('0x19')](_0xa142('0x1a'),_0x4d1fb9,_0xa142('0x18'),JSON['stringify'](_0x271d58));if(_0x271d58[_0xa142('0x1b')]){if(_0x271d58[_0xa142('0x1b')]['code']===0x1f4){logger[_0xa142('0x1b')](_0xa142('0x17'),_0x4d1fb9,_0x271d58[_0xa142('0x1b')]['message']);return _0x366b92(_0x271d58[_0xa142('0x1b')][_0xa142('0x1c')]);}logger[_0xa142('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0x4d1fb9,_0x271d58['error']['message']);return _0x3c8432(_0x271d58[_0xa142('0x1b')][_0xa142('0x1c')]);}else{logger[_0xa142('0x1d')](_0xa142('0x17'),_0x4d1fb9,'request\x20sent');_0x3c8432(_0x271d58[_0xa142('0x1e')][_0xa142('0x1c')]);}})[_0xa142('0x1f')](function(_0x485491){logger[_0xa142('0x1b')](_0xa142('0x17'),_0x4d1fb9,_0x485491);_0x366b92(_0x485491);});});}function respondWithStatusCode(_0x384c4e,_0x354b99){_0x354b99=_0x354b99||0xcc;return function(_0x1b59c9){if(_0x1b59c9){return _0x384c4e[_0xa142('0x20')](_0x354b99);}return _0x384c4e[_0xa142('0x21')](_0x354b99)[_0xa142('0x22')]();};}function respondWithResult(_0x4dad0d,_0x17d1b2){_0x17d1b2=_0x17d1b2||0xc8;return function(_0x8e0498){if(_0x8e0498){return _0x4dad0d[_0xa142('0x21')](_0x17d1b2)[_0xa142('0x23')](_0x8e0498);}};}function respondWithFilteredResult(_0x1e27e5,_0x5dade6){return function(_0x2f71ae){if(_0x2f71ae){var _0x399ce0=typeof _0x5dade6[_0xa142('0x24')]===_0xa142('0x25')&&typeof _0x5dade6[_0xa142('0x26')]==='undefined';var _0x3c056d=_0x2f71ae[_0xa142('0x27')];var _0x2a9e91=_0x399ce0?0x0:_0x5dade6[_0xa142('0x24')];var _0x200ce7=_0x399ce0?_0x2f71ae[_0xa142('0x27')]:_0x5dade6['offset']+_0x5dade6[_0xa142('0x26')];var _0x8c0450;if(_0x200ce7>=_0x3c056d){_0x200ce7=_0x3c056d;_0x8c0450=0xc8;}else{_0x8c0450=0xce;}_0x1e27e5['status'](_0x8c0450);return _0x1e27e5['set']('Content-Range',_0x2a9e91+'-'+_0x200ce7+'/'+_0x3c056d)['json'](_0x2f71ae);}return null;};}function saveUpdates(_0x510e8b){return function(_0x4e828b){if(_0x4e828b){return _0x4e828b[_0xa142('0x28')](_0x510e8b)[_0xa142('0x16')](function(_0x137d1a){return _0x137d1a;});}return null;};}function removeEntity(_0x5f1069){return function(_0x1220ae){if(_0x1220ae){return _0x1220ae[_0xa142('0x29')]()[_0xa142('0x16')](function(){_0x5f1069[_0xa142('0x21')](0xcc)[_0xa142('0x22')]();});}};}function handleEntityNotFound(_0x59f7d6){return function(_0x105718){if(!_0x105718){_0x59f7d6[_0xa142('0x20')](0x194);}return _0x105718;};}function handleError(_0x6586d3,_0x4028f5){_0x4028f5=_0x4028f5||0x1f4;return function(_0x597148){logger[_0xa142('0x1b')](_0x597148['stack']);if(_0x597148[_0xa142('0x2a')]){delete _0x597148['name'];}_0x6586d3[_0xa142('0x21')](_0x4028f5)[_0xa142('0x2b')](_0x597148);};}function getMustacheRender(_0x4d2ca5,_0x20ef2b){return Mustache[_0xa142('0x2c')](_0x4d2ca5,_[_0xa142('0x2d')](_0x20ef2b[_0xa142('0x2e')],{'contact':_0x20ef2b[_0xa142('0x2f')],'message':_0x20ef2b[_0xa142('0x1c')],'agent':_0x20ef2b[_0xa142('0x30')],'interaction':_0x20ef2b['interaction'],'account':_0x20ef2b[_0xa142('0x31')]}))||'';}exports[_0xa142('0x32')]=function(_0x4a8c52,_0x4db1fe){var _0x42eefe={};var _0x44fda3=_['map'](db[_0xa142('0x33')][_0xa142('0x34')],function(_0x50d5ef){return{'name':_0x50d5ef[_0xa142('0x35')],'type':_0x50d5ef[_0xa142('0x36')][_0xa142('0x37')]};});_0x42eefe=qs[_0xa142('0x38')](_0x44fda3,_0x4a8c52);return interaction[_0xa142('0x39')](_0xa142('0x3a'),_0x4a8c52[_0xa142('0x3b')],_0x4a8c52[_0xa142('0x3c')],_0x42eefe,_0x44fda3)[_0xa142('0x16')](respondWithFilteredResult(_0x4db1fe,_0x42eefe))[_0xa142('0x1f')](handleError(_0x4db1fe,null));};exports[_0xa142('0x3d')]=function(_0x34e71b,_0xe9a919){var _0x15497e={'raw':![],'where':{'id':_0x34e71b[_0xa142('0x3e')]['id']}},_0x5916a6={};_0x5916a6[_0xa142('0x3f')]=_[_0xa142('0x40')](db[_0xa142('0x33')]['rawAttributes']);_0x5916a6[_0xa142('0x3b')]=_[_0xa142('0x40')](_0x34e71b[_0xa142('0x3b')]);_0x5916a6[_0xa142('0x41')]=_['intersection'](_0x5916a6[_0xa142('0x3f')],_0x5916a6[_0xa142('0x3b')]);_0x15497e[_0xa142('0x42')]=_[_0xa142('0x43')](_0x5916a6['model'],qs['fields'](_0x34e71b['query'][_0xa142('0x44')]));_0x15497e[_0xa142('0x42')]=_0x15497e[_0xa142('0x42')][_0xa142('0x45')]?_0x15497e[_0xa142('0x42')]:_0x5916a6['model'];if(_0x34e71b[_0xa142('0x3b')][_0xa142('0x46')]){_0x15497e[_0xa142('0x47')]=[{'all':!![]}];}_0x15497e=_[_0xa142('0x2d')]({},_0x15497e,_0x34e71b[_0xa142('0x48')]);return db[_0xa142('0x33')]['find'](_0x15497e)['then'](handleEntityNotFound(_0xe9a919,null))[_0xa142('0x16')](respondWithResult(_0xe9a919,null))[_0xa142('0x1f')](handleError(_0xe9a919,null));};exports[_0xa142('0x49')]=function(_0x5a690c,_0x4be7b3){return db['ChatInteraction'][_0xa142('0x49')](_0x5a690c[_0xa142('0x2e')],{})['then'](respondWithResult(_0x4be7b3,0xc9))['catch'](handleError(_0x4be7b3,null));};exports[_0xa142('0x28')]=function(_0x3452b0,_0x185bdd){if(_0x3452b0[_0xa142('0x2e')]['id']){delete _0x3452b0[_0xa142('0x2e')]['id'];}return db[_0xa142('0x33')][_0xa142('0x4a')]({'where':{'id':_0x3452b0[_0xa142('0x3e')]['id']}})[_0xa142('0x16')](handleEntityNotFound(_0x185bdd,null))[_0xa142('0x16')](saveUpdates(_0x3452b0[_0xa142('0x2e')],null))[_0xa142('0x16')](respondWithResult(_0x185bdd,null))[_0xa142('0x1f')](handleError(_0x185bdd,null));};exports[_0xa142('0x29')]=function(_0x35be3e,_0x1b09c3){return db[_0xa142('0x33')][_0xa142('0x4a')]({'where':{'id':_0x35be3e[_0xa142('0x3e')]['id']}})[_0xa142('0x16')](handleEntityNotFound(_0x1b09c3,null))[_0xa142('0x16')](removeEntity(_0x1b09c3,null))['catch'](handleError(_0x1b09c3,null));};exports[_0xa142('0x4b')]=function(_0x84c16b,_0x2f8915){return db[_0xa142('0x33')]['describe']()[_0xa142('0x16')](respondWithResult(_0x2f8915,null))[_0xa142('0x1f')](handleError(_0x2f8915,null));};exports['createVidaooSession']=function(_0x548c86,_0x503eda){var _0x37a100=_0x548c86['params']['id'];var _0x214b84;var _0x5571c0;var _0x25647a;return db[_0xa142('0x33')]['findOne']({'where':{'id':_0x37a100}})[_0xa142('0x16')](function(_0x26467a){_0x214b84=_0x26467a;return db['ChatWebsite'][_0xa142('0x4c')]({'where':{'id':_0x26467a[_0xa142('0x4d')]},'attributes':['id',_0xa142('0x4e'),_0xa142('0x4f'),_0xa142('0x50'),_0xa142('0x51'),'vidaooMetadata'],'raw':!![]});})[_0xa142('0x16')](function(_0x5c0a95){if(_0x5c0a95&&_0x5c0a95[_0xa142('0x4e')]&&_0x5c0a95[_0xa142('0x4f')]){_0x5571c0=_0x5c0a95;var _0x4249d4={'interaction':{'id':_0x37a100},'agent':{'id':_0x548c86['user']['id'],'name':_0x548c86[_0xa142('0x3c')][_0xa142('0x2a')],'fullname':_0x548c86[_0xa142('0x3c')][_0xa142('0x52')],'email':_0x548c86['user'][_0xa142('0x53')]},'contact':_0x548c86[_0xa142('0x2e')][_0xa142('0x2f')],'account':_0x548c86[_0xa142('0x2e')]['account']};var _0x3b587e={'rejectUnauthorized':![],'method':_0xa142('0x54'),'url':_0xa142('0x55'),'headers':{'X-APIKEY':_0x5c0a95[_0xa142('0x4e')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x548c86['user'][_0xa142('0x53')]],'buttons':null,'topic':_0x5571c0[_0xa142('0x50')],'note':_['isNull'](_0x5571c0[_0xa142('0x51')])?null:getMustacheRender(_0x5571c0['vidaooNote'],_0x4249d4),'metadata':null},'redirect':_0xa142('0x56'),'json':!![]};try{if(!_[_0xa142('0x57')](_0x5571c0[_0xa142('0x58')])){var _0x4cc914=getMustacheRender(_0x5571c0[_0xa142('0x58')],_0x4249d4);var _0x35dafa=JSON[_0xa142('0x59')](_0x4cc914);_0x3b587e['body'][_0xa142('0x5a')]=_0x35dafa;}}catch(_0xc26b4f){throw new db['Sequelize'][(_0xa142('0x5b'))](_0xa142('0x5c'));}return rp(_0x3b587e);}else{throw new db[(_0xa142('0x5d'))][(_0xa142('0x5b'))]('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x116742){_0x25647a=_0x116742;if(_0x25647a['id']){var _0x331fbc={'body':_0x25647a[_0xa142('0x5e')],'ChatWebsiteId':_0x5571c0['id'],'ChatInteractionId':_0x214b84['id'],'direction':_0xa142('0x5f'),'UserId':_0x548c86[_0xa142('0x3c')]['id']};return db[_0xa142('0x60')][_0xa142('0x49')](_0x331fbc,{});}else{throw new db[(_0xa142('0x5d'))][(_0xa142('0x5b'))](_0xa142('0x61'));}})['then'](function(){return _0x214b84[_0xa142('0x62')]({'vidaooSessionId':_0x25647a['id']});})['then'](respondWithResult(_0x503eda,null))[_0xa142('0x1f')](handleError(_0x503eda,null));};exports[_0xa142('0x63')]=function(_0x14cafb,_0x5d8cf3){if(_0x14cafb[_0xa142('0x2e')]['id']){delete _0x14cafb[_0xa142('0x2e')]['id'];}return db['ChatInteraction'][_0xa142('0x4a')]({'where':{'id':_0x14cafb[_0xa142('0x3e')]['id']},'include':[{'model':db[_0xa142('0x64')],'as':_0xa142('0x65')}]})[_0xa142('0x16')](handleEntityNotFound(_0x5d8cf3,null))['then'](saveUpdates(_0x14cafb[_0xa142('0x2e')],null))[_0xa142('0x16')](respondWithResult(_0x5d8cf3,null))[_0xa142('0x1f')](handleError(_0x5d8cf3,null));};exports['abandon']=function(_0x52290a,_0x37daa8){if(_0x52290a['body']['id']){delete _0x52290a[_0xa142('0x2e')]['id'];}return db[_0xa142('0x33')][_0xa142('0x4a')]({'where':{'id':_0x52290a[_0xa142('0x3e')]['id']}})[_0xa142('0x16')](function(_0x2a6aff){if(!_0x2a6aff){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,_0xa142('0x66'));_0x37daa8[_0xa142('0x20')](0x194);}else{if(_0x2a6aff['UserId']){throw new db[(_0xa142('0x5d'))][(_0xa142('0x5b'))](_0xa142('0x67'));}}return _0x2a6aff;})[_0xa142('0x16')](function(_0x25eb33){if(_0x25eb33){return _0x25eb33['update']({'closed':_0x52290a[_0xa142('0x2e')]['closed'],'disposition':_0x52290a[_0xa142('0x2e')]['disposition']})[_0xa142('0x16')](function(_0x5f14d3){return _0x5f14d3;});}})[_0xa142('0x16')](function(){return respondWithRpcPromise(_0xa142('0x68'),_0xa142('0x69'),_0x52290a['body'],client9004);})[_0xa142('0x16')](respondWithResult(_0x37daa8,null))[_0xa142('0x1f')](handleError(_0x37daa8,null));};exports['attachmentUpload']=function(_0x5ba816,_0x467224){_0x5ba816[_0xa142('0x2e')][_0xa142('0x2a')]=_0x5ba816['file'][_0xa142('0x6a')];_0x5ba816['body']['basename']=_0x5ba816[_0xa142('0x6b')][_0xa142('0x6c')];_0x5ba816[_0xa142('0x2e')]['type']=_0x5ba816[_0xa142('0x6b')]['mimetype'];return db[_0xa142('0x6d')][_0xa142('0x49')](_0x5ba816[_0xa142('0x2e')])[_0xa142('0x16')](respondWithResult(_0x467224,0xc9))[_0xa142('0x1f')](handleError(_0x467224,null));};exports['attachmentDownload']=function(_0x15bcbb,_0x1b9a55){return db[_0xa142('0x33')][_0xa142('0x4c')]({'where':{'id':_0x15bcbb[_0xa142('0x3e')]['id']},'raw':!![]})[_0xa142('0x16')](handleEntityNotFound(_0x1b9a55,null))[_0xa142('0x16')](function(_0x472de7){if(_0x472de7){if(_0x472de7[_0xa142('0x6e')]){return _0x1b9a55[_0xa142('0x21')](0x193)[_0xa142('0x23')]({'status':0x193,'message':_0xa142('0x6f')});}return db['Attachment'][_0xa142('0x4c')]({'where':{'id':_0x15bcbb[_0xa142('0x3b')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x1b9a55,null));}})['then'](function(_0x3af042){if(_0x3af042){var _0x58d17e=_0x3af042[_0xa142('0x70')]!==null;var _0x38273e=path['join'](config[_0xa142('0x71')],_0xa142('0x72'));if(_0x58d17e){_0x38273e=path[_0xa142('0x73')](_0x38273e,_0xa142('0x74'));}var _0x4f7ec1=path[_0xa142('0x73')](_0x38273e,_0x3af042[_0xa142('0x75')]);return _0x1b9a55[_0xa142('0x76')](_0x4f7ec1);}})[_0xa142('0x1f')](handleError(_0x1b9a55,null));};exports[_0xa142('0x77')]=function(_0x3407c9,_0x387c91){var _0x543253=null;var _0x1bd67a=null;var _0x302b0a=null;if(_0x3407c9['body']['id']){delete _0x3407c9[_0xa142('0x2e')]['id'];}if(_0x3407c9[_0xa142('0x2e')]['mailTranscript']){_0x302b0a=path['join'](config[_0xa142('0x71')],_0xa142('0x78'),util[_0xa142('0x79')]('transcript-%s.txt',Date[_0xa142('0x7a')]()));_0x3407c9[_0xa142('0x2e')][_0xa142('0x7b')]=_0x302b0a;}return db[_0xa142('0x33')][_0xa142('0x4a')]({'where':{'id':_0x3407c9[_0xa142('0x3e')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xa142('0x7c'),'include':[{'model':db[_0xa142('0x7d')],'as':'User'}]}]})[_0xa142('0x16')](handleEntityNotFound(_0x387c91,null))[_0xa142('0x16')](saveUpdates(_0x3407c9['body'],null))[_0xa142('0x16')](function(_0xcfb191){if(_0xcfb191){_0x543253=_0xcfb191;return db[_0xa142('0x7e')][_0xa142('0x4a')]({'where':{'id':_0x543253[_0xa142('0x4d')]}});}})[_0xa142('0x16')](function(_0x536b02){if(_0x536b02){_0x1bd67a=_0x536b02;return db['CmContact']['find']({'where':{'id':_0x543253['ContactId']}});}})['then'](function(_0x42b227){if(_0x42b227){if(_0x302b0a){var _0x39cff9=null;for(var _0x59707c=0x1;_0x59707c<_0x543253[_0xa142('0x7c')]['length'];++_0x59707c){_0x39cff9=_0x543253[_0xa142('0x7c')][_0x59707c];var _0xa14431=_0x39cff9[_0xa142('0x7f')]?util[_0xa142('0x79')](_0xa142('0x80'),_0x1bd67a[_0xa142('0x81')],_0x39cff9['UserId']):_0xa142('0x82');var _0x52ff38=_0x3407c9[_0xa142('0x2e')][_0xa142('0x83')]||util[_0xa142('0x79')]('%s%d',_0xa142('0x84'),_0x39cff9[_0xa142('0x85')]);switch(_0x1bd67a['agentIdentifier']){case'website_alias':_0xa14431=_0x39cff9[_0xa142('0x7f')]?util['format']('%s%d',_0x1bd67a['agentAlias'],_0x39cff9[_0xa142('0x7f')]):_0xa142('0x82');break;case'agent_alias':_0xa14431=_0x39cff9[_0xa142('0x7f')]?_0x39cff9[_0xa142('0x7d')]['alias']||_0x39cff9[_0xa142('0x7d')][_0xa142('0x52')]:_0xa142('0x82');break;case _0xa142('0x86'):_0xa14431=_0x39cff9[_0xa142('0x7f')]?_0x39cff9[_0xa142('0x7d')][_0xa142('0x52')]:_0xa142('0x82');break;default:_0xa14431=_0x39cff9[_0xa142('0x7f')]?util[_0xa142('0x79')](_0xa142('0x80'),_0x1bd67a[_0xa142('0x81')],_0x39cff9[_0xa142('0x7f')]):'System';}var _0x144620=util[_0xa142('0x79')](_0xa142('0x87'),moment(_0x39cff9[_0xa142('0x88')])['format']('MM/DD/YYYY\x20HH:mm:ss'),_0x39cff9['direction']==='in'?_0x52ff38:_0xa14431,_0x39cff9[_0xa142('0x2e')]);if(!_0x39cff9['secret']){fs[_0xa142('0x89')](_0x302b0a,_0x144620);}}return db[_0xa142('0x8a')][_0xa142('0x4c')]({'where':{'service':!![]},'include':[{'model':db[_0xa142('0x8b')],'as':_0xa142('0x8c'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xa142('0x8d'),'raw':!![]}]}]});}}})['then'](function(_0x44907b){if(!_0x44907b||!_0x44907b[_0xa142('0x8c')]||!_0x3407c9[_0xa142('0x2e')])return _0x543253;var _0x36b2a0=_0x44907b[_0xa142('0x8e')]();return respondWithRpcPromise('SendMail',_0xa142('0x8f'),{'account':_0x36b2a0,'message':{'from':util['format'](_0xa142('0x90'),_0x44907b[_0xa142('0x2a')],_0x44907b[_0xa142('0x53')]||_0x44907b[_0xa142('0x8c')]['user']),'to':_0x3407c9[_0xa142('0x2e')][_0xa142('0x91')],'subject':'Mail\x20Transcript','text':util['format'](_0xa142('0x92'),_0x3407c9['body'][_0xa142('0x91')]),'attachments':[{'path':_0x302b0a}]}})[_0xa142('0x16')](function(){return _0x543253;})[_0xa142('0x1f')](function(_0x30e25f){logger['error'](_0x30e25f);});})[_0xa142('0x16')](respondWithStatusCode(_0x387c91,0xc8))['catch'](handleError(_0x387c91,null));};exports[_0xa142('0x93')]=function(_0x6f47d8,_0x2dde1a){return db['ChatMessage'][_0xa142('0x4a')]({'where':{'id':_0x6f47d8[_0xa142('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2dde1a,null))[_0xa142('0x16')](function(_0x353e4b){if(_0x353e4b){return _0x353e4b['addMessage'](_0x6f47d8['body']['ids'],_[_0xa142('0x94')](_0x6f47d8[_0xa142('0x2e')],[_0xa142('0x95'),'id'])||{});}})['then'](respondWithResult(_0x2dde1a,null))['catch'](handleError(_0x2dde1a,null));};exports[_0xa142('0x96')]=function(_0x5d9a1f,_0x5d5809){var _0x21b597={'raw':![],'where':{}};var _0x2403b7={};var _0x41f5c4={'count':0x0,'rows':[]};return db[_0xa142('0x33')]['findOne']({'where':{'id':_0x5d9a1f[_0xa142('0x3e')]['id']}})[_0xa142('0x16')](handleEntityNotFound(_0x5d5809,null))[_0xa142('0x16')](function(_0x16580b){if(_0x16580b){_0x2403b7[_0xa142('0x3f')]=_[_0xa142('0x40')](db['ChatMessage'][_0xa142('0x34')]);_0x2403b7[_0xa142('0x3b')]=_[_0xa142('0x40')](_0x5d9a1f[_0xa142('0x3b')]);_0x2403b7[_0xa142('0x41')]=_[_0xa142('0x43')](_0x2403b7[_0xa142('0x3f')],_0x2403b7['query']);_0x21b597[_0xa142('0x42')]=_[_0xa142('0x43')](_0x2403b7[_0xa142('0x3f')],qs[_0xa142('0x44')](_0x5d9a1f['query']['fields']));_0x21b597[_0xa142('0x42')]=_0x21b597[_0xa142('0x42')][_0xa142('0x45')]?_0x21b597[_0xa142('0x42')]:_0x2403b7[_0xa142('0x3f')];if(!_0x5d9a1f[_0xa142('0x3b')][_0xa142('0x97')]('nolimit')){_0x21b597[_0xa142('0x26')]=qs[_0xa142('0x26')](_0x5d9a1f[_0xa142('0x3b')][_0xa142('0x26')]);_0x21b597[_0xa142('0x24')]=qs['offset'](_0x5d9a1f[_0xa142('0x3b')][_0xa142('0x24')]);}_0x21b597[_0xa142('0x98')]=qs[_0xa142('0x99')](_0x5d9a1f[_0xa142('0x3b')][_0xa142('0x99')]);_0x21b597[_0xa142('0x9a')]=qs[_0xa142('0x41')](_[_0xa142('0x9b')](_0x5d9a1f[_0xa142('0x3b')],_0x2403b7[_0xa142('0x41')]));_0x21b597[_0xa142('0x9a')][_0xa142('0x9c')]=_0x16580b['id'];if(_0x5d9a1f[_0xa142('0x3b')][_0xa142('0x9d')]){_0x21b597[_0xa142('0x9a')]=_[_0xa142('0x2d')](_0x21b597[_0xa142('0x9a')],{'$or':_['map'](_0x21b597[_0xa142('0x42')],function(_0x3d56b6){var _0x2d131f={};_0x2d131f[_0x3d56b6]={'$like':'%'+_0x5d9a1f[_0xa142('0x3b')][_0xa142('0x9d')]+'%'};return _0x2d131f;})});}if(_0x5d9a1f[_0xa142('0x3b')][_0xa142('0x9e')]){var _0x15b138=_0x5d9a1f[_0xa142('0x3b')][_0xa142('0x9e')][_0xa142('0x9f')](',');var _0x2dcd56={};_0x2dcd56[_0x15b138[0x0]]={'$gte':moment(_0x15b138[0x1])[_0xa142('0x79')](_0xa142('0xa0'))};_0x21b597[_0xa142('0x9a')]=_[_0xa142('0x2d')](_0x21b597[_0xa142('0x9a')],_0x2dcd56);}_0x21b597=_['merge']({},_0x21b597,_0x5d9a1f[_0xa142('0x48')]);return db[_0xa142('0x60')][_0xa142('0x27')]({'where':_0x21b597[_0xa142('0x9a')]})[_0xa142('0x16')](function(_0x280c9a){_0x41f5c4[_0xa142('0x27')]=_0x280c9a;if(_0x5d9a1f[_0xa142('0x3b')]['includeAll']){_0x21b597[_0xa142('0x47')]=[{'all':!![]}];}return db[_0xa142('0x60')]['findAll'](_0x21b597);})[_0xa142('0x16')](function(_0xb44ddb){_0x41f5c4['rows']=_0xb44ddb;return _0x41f5c4;});}})['then'](respondWithFilteredResult(_0x5d5809,_0x21b597))[_0xa142('0x1f')](handleError(_0x5d5809,null));};exports[_0xa142('0xa1')]=function(_0x1e2245,_0x379d6a){var _0x7d1c50={'where':{}},_0xf715fc={},_0xa1fcf9={'count':0x0,'rows':[]};return db[_0xa142('0x33')][_0xa142('0x4c')]({'where':{'id':_0x1e2245[_0xa142('0x3e')]['id']}})[_0xa142('0x16')](handleEntityNotFound(_0x379d6a,null))[_0xa142('0x16')](function(_0x55d3ee){if(_0x55d3ee){_0xf715fc[_0xa142('0x3f')]=_[_0xa142('0x40')](db['ChatMessage'][_0xa142('0x34')]);_0xf715fc[_0xa142('0x3b')]=_[_0xa142('0x40')](_0x1e2245['query']);_0xf715fc[_0xa142('0x41')]=_[_0xa142('0x43')](_0xf715fc[_0xa142('0x3f')],_0xf715fc[_0xa142('0x3b')]);_0x7d1c50['attributes']=_['intersection'](_0xf715fc[_0xa142('0x3f')],qs[_0xa142('0x44')](_0x1e2245[_0xa142('0x3b')]['fields']));_0x7d1c50[_0xa142('0x42')]=_0x7d1c50[_0xa142('0x42')][_0xa142('0x45')]?_0x7d1c50[_0xa142('0x42')]:_0xf715fc[_0xa142('0x3f')];if(!_0x1e2245['query'][_0xa142('0x97')]('nolimit')){_0x7d1c50['limit']=qs[_0xa142('0x26')](_0x1e2245[_0xa142('0x3b')][_0xa142('0x26')]);_0x7d1c50['offset']=qs[_0xa142('0x24')](_0x1e2245[_0xa142('0x3b')]['offset']);}_0x7d1c50[_0xa142('0x98')]=qs[_0xa142('0x99')](_0x1e2245[_0xa142('0x3b')][_0xa142('0x99')]);_0x7d1c50['where']=qs[_0xa142('0x41')](_[_0xa142('0x9b')](_0x1e2245['query'],_0xf715fc[_0xa142('0x41')]));_0x7d1c50[_0xa142('0x9a')][_0xa142('0x9c')]=_0x55d3ee['id'];if(_0x1e2245[_0xa142('0x3b')][_0xa142('0x9d')]){_0x7d1c50[_0xa142('0x9a')]=_[_0xa142('0x2d')](_0x7d1c50[_0xa142('0x9a')],{'$or':_[_0xa142('0xa2')](_0x7d1c50['attributes'],function(_0x2b7f2b){var _0x402f9f={};_0x402f9f[_0x2b7f2b]={'$like':'%'+_0x1e2245['query'][_0xa142('0x9d')]+'%'};return _0x402f9f;})});}_0x7d1c50['where'][_0xa142('0xa3')]=![];if(_0x1e2245['query']['id']){_0x7d1c50[_0xa142('0x9a')]['id']={'$gt':_0x1e2245['query']['id']};}_0x7d1c50=_[_0xa142('0x2d')]({},_0x7d1c50,_0x1e2245[_0xa142('0x48')]);return db['ChatMessage']['count']({'where':_0x7d1c50['where']})[_0xa142('0x16')](function(_0x2889ec){_0xa1fcf9['count']=_0x2889ec;_0x7d1c50['include']=[];if(_0x1e2245['query'][_0xa142('0xa4')]){_0x7d1c50['include']['push']({'model':db[_0xa142('0x7d')],'as':'User','attributes':['id',_0xa142('0x52'),'alias']});}if(_0x1e2245['query'][_0xa142('0x46')]){_0x7d1c50[_0xa142('0x47')]=[{'all':!![]}];}return db[_0xa142('0x60')][_0xa142('0x39')](_0x7d1c50);})[_0xa142('0x16')](function(_0x147eeb){_0xa1fcf9[_0xa142('0xa5')]=_0x147eeb;return _0xa1fcf9;});}})[_0xa142('0x16')](respondWithFilteredResult(_0x379d6a,_0x7d1c50))['catch'](handleError(_0x379d6a,null));};exports[_0xa142('0xa6')]=function(_0x20a08e,_0x521c80){return db[_0xa142('0x33')]['find']({'where':{'id':_0x20a08e['params']['id']}})[_0xa142('0x16')](handleEntityNotFound(_0x521c80,null))[_0xa142('0x16')](function(_0x583074){if(_0x583074){return _0x583074[_0xa142('0xa7')](_0x20a08e[_0xa142('0x2e')][_0xa142('0x95')],_['omit'](_0x20a08e[_0xa142('0x2e')],[_0xa142('0x95'),'id'])||{})[_0xa142('0xa8')](function(){return db['Tag']['findAll']({'attributes':['id',_0xa142('0x2a'),'color'],'where':{'id':_0x20a08e[_0xa142('0x2e')]['ids']}});})[_0xa142('0x16')](function(_0x3d55ac){socket[_0xa142('0xa9')](_0xa142('0xaa'),{'id':Number(_0x20a08e[_0xa142('0x3e')]['id']),'tags':_0x3d55ac||[]});return{'id':Number(_0x20a08e[_0xa142('0x3e')]['id']),'tags':_0x3d55ac||[]};});}})[_0xa142('0x16')](respondWithResult(_0x521c80,null))[_0xa142('0x1f')](handleError(_0x521c80,null));};exports[_0xa142('0xab')]=function(_0x38d51c,_0x38d36a){return db[_0xa142('0x33')][_0xa142('0x4a')]({'where':{'id':_0x38d51c[_0xa142('0x3e')]['id']}})['then'](handleEntityNotFound(_0x38d36a,null))[_0xa142('0x16')](function(_0x5b1280){if(_0x5b1280){return _0x5b1280['removeTags'](_0x38d51c[_0xa142('0x3b')][_0xa142('0x95')]);}})['then'](respondWithStatusCode(_0x38d36a,null))[_0xa142('0x1f')](handleError(_0x38d36a,null));};exports[_0xa142('0x76')]=function(_0x3d4d0c,_0x15a167){var _0x27b8e1=moment()[_0xa142('0xac')]()[_0xa142('0xad')]();var _0x29e9c2=path['join'](config[_0xa142('0x71')],_0xa142('0xae'),'files','tmp');var _0x1c3737=path[_0xa142('0x73')](config[_0xa142('0x71')],'server',_0xa142('0xaf'),'attachments');var _0x2b2903=path[_0xa142('0x73')](_0x29e9c2,_0x27b8e1);var _0x4de069=util[_0xa142('0x79')](_0xa142('0xb0'),_0x3d4d0c[_0xa142('0x3e')]['id'],_0x27b8e1);var _0x37a42a=path['join'](_0x29e9c2,_0x4de069);var _0x2c3d2e=[];_0x2c3d2e[_0xa142('0xb1')]({'model':db[_0xa142('0x7d')],'as':_0xa142('0x7d'),'attributes':['id',_0xa142('0x52')],'raw':!![]});_0x2c3d2e['push']({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName',_0xa142('0xb2')],'raw':!![]});if(_0x3d4d0c[_0xa142('0x3b')][_0xa142('0xb3')]){_0x2c3d2e['push']({'model':db['Attachment'],'as':_0xa142('0x6d'),'raw':!![]});}var _0xf3a769=[{'model':db[_0xa142('0x60')],'as':_0xa142('0x7c'),'attributes':['id',_0xa142('0x2e'),_0xa142('0x88'),'direction',_0xa142('0xa3'),'read'],'include':_0x2c3d2e}];_0xf3a769['push']({'model':db[_0xa142('0x7e')],'as':_0xa142('0xb4'),'attributes':['id',_0xa142('0x2a')]});_0xf3a769[_0xa142('0xb1')]({'model':db['User'],'as':_0xa142('0xb5'),'attributes':['id',_0xa142('0x52')]});return db[_0xa142('0x33')]['find']({'where':{'id':_0x3d4d0c['params']['id']},'include':_0xf3a769})[_0xa142('0x16')](handleEntityNotFound(_0x15a167,null))[_0xa142('0x16')](function(_0x3a378){if(_0x3a378){var _0x5c35d6=_0x3a378['get']({'plain':!![]});fs[_0xa142('0xb6')](_0x2b2903);var _0x20c2eb={'channel':_0xa142('0xb7'),'account':_0x5c35d6[_0xa142('0xb4')][_0xa142('0x2a')],'agent':_0x5c35d6['Owner']?_0x5c35d6[_0xa142('0xb5')][_0xa142('0x52')]:'N.A.','createdAt':moment(_0x5c35d6[_0xa142('0x88')])['format'](_0xa142('0xa0'))[_0xa142('0xad')](),'closedAt':_0x5c35d6['closed']?moment(_0x5c35d6[_0xa142('0xb8')])[_0xa142('0x79')](_0xa142('0xa0'))['toString']():'','disposition':_0x5c35d6[_0xa142('0xb9')],'chatInfo':{'browser':_0x5c35d6[_0xa142('0xba')],'os':_0x5c35d6['osName'],'referer':_0x5c35d6[_0xa142('0xbb')],'customerIp':_0x5c35d6[_0xa142('0xbc')],'customerPort':_0x5c35d6[_0xa142('0xbd')]?_0x5c35d6[_0xa142('0xbd')]:'N.A.'},'messages':_(_0x5c35d6['Messages'])['tail']()['filter']({'secret':![]})[_0xa142('0xa2')](function(_0x3dbf17){if(_0x3dbf17['Attachment']){var _0x31b7ee=path[_0xa142('0x73')](_0x1c3737,_0x3dbf17['Attachment'][_0xa142('0x75')]);if(fs[_0xa142('0xbe')](_0x31b7ee)){fs[_0xa142('0xbf')](_0x31b7ee)[_0xa142('0xc0')](fs[_0xa142('0xc1')](path[_0xa142('0x73')](_0x2b2903,_0x3dbf17[_0xa142('0x6d')][_0xa142('0x75')])));}}return{'date':moment(_0x3dbf17['createdAt'])[_0xa142('0x79')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa142('0xad')](),'sender':_0x3dbf17['direction']===_0xa142('0x5f')?_0x3dbf17[_0xa142('0x7d')]?_0x3dbf17[_0xa142('0x7d')][_0xa142('0x52')]:_0xa142('0x82'):_0x3dbf17[_0xa142('0x65')]['firstName']+(_0x3dbf17['Contact']['lastName']?'\x20'+_0x3dbf17[_0xa142('0x65')][_0xa142('0xb2')]:''),'body':_0x3dbf17[_0xa142('0x6d')]?_0x3dbf17[_0xa142('0x6d')][_0xa142('0x75')]:_0x3dbf17[_0xa142('0x2e')],'direction':_0x3dbf17[_0xa142('0xc2')]===_0xa142('0x5f')?'A':'C','secret':_0x3dbf17[_0xa142('0xa3')],'read':_0x3dbf17[_0xa142('0xc3')],'attachment':_0x3dbf17[_0xa142('0x6d')]};})[_0xa142('0xc4')]()};return ejs[_0xa142('0xc5')](path[_0xa142('0x73')](config[_0xa142('0x71')],_0xa142('0xae'),'views','downloadInteraction.ejs'),{'interaction':_0x20c2eb})[_0xa142('0x16')](function(_0x2df3c6){var _0x381cb3=path[_0xa142('0x73')](_0x2b2903,_0xa142('0xc6')+_0x5c35d6['id']+'-'+_0x27b8e1+'.pdf');var _0x2823f8={'path':_0x381cb3,'channel':_0xa142('0xb7'),'interactionId':_0x5c35d6['id']};return pdf['createPdfFromHTML'](_0x2df3c6,_0x2823f8);})[_0xa142('0x16')](function(){return new Promise(function(_0x3862e5,_0x2a6d66){zipdir(_0x2b2903,{'saveTo':_0x37a42a},function(_0x5316f8,_0x398900){if(_0x5316f8)return _0x2a6d66(_0x5316f8);return _0x3862e5(_0x398900);});})['then'](function(){return new BPromise(function(_0xabb5b4,_0xa69959){rimraf(_0x2b2903,function(_0xba4cf7){if(_0xba4cf7)_0xa69959(_0xba4cf7);return _0xabb5b4();});});})[_0xa142('0x16')](function(){return _0x15a167[_0xa142('0x76')](_0x37a42a,_0x4de069,function(_0x161895){if(_0x161895){logger['error'](_0xa142('0xc7'),_0x161895);}else{fs[_0xa142('0xc8')](_0x37a42a);}});});});}else{return _0x15a167[_0xa142('0x20')](0xc8);}})[_0xa142('0x1f')](handleError(_0x15a167,null));}; \ No newline at end of file +var _0xec72=['filters','intersection','attributes','fields','length','includeAll','include','options','find','create','describe','findOne','ChatWebsite','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','vidaooEscalation','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','ValidationError','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','closed','disposition','AbandonInteraction','file','basename','filename','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId','join','server/files/attachments/','close','mailTranscript','root','server/files/chat/upload/','format','now','Messages','User','ContactId','UserId','System','customer','%s%d','Visitor','agentIdentifier','website_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','sort','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','nolimit','order','pick','includeAgent','push','addTags','setTags','emit','removeTags','download','unix','toString','server','files','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','read','Account','Owner','mkdirSync','N.A.','closedAt','browserName','osName','referer','customerPort','tail','createReadStream','pipe','createWriteStream','out','views','downloadInteraction.ejs','transcript-','Chat','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','stack','name','send','render','merge','body','contact','agent','account','map','rawAttributes','type','key','getOptions','findAll','query','user','catch','show','params','model','keys','ChatInteraction'];(function(_0x1bc71a,_0xb132ce){var _0x49a2c6=function(_0x2f5f97){while(--_0x2f5f97){_0x1bc71a['push'](_0x1bc71a['shift']());}};_0x49a2c6(++_0xb132ce);}(_0xec72,0x87));var _0x2ec7=function(_0x3e25b7,_0x42c1fd){_0x3e25b7=_0x3e25b7-0x0;var _0x35d0b0=_0xec72[_0x3e25b7];return _0x35d0b0;};'use strict';var rimraf=require(_0x2ec7('0x0'));var zipdir=require(_0x2ec7('0x1'));var rp=require(_0x2ec7('0x2'));var moment=require(_0x2ec7('0x3'));var BPromise=require(_0x2ec7('0x4'));var Mustache=require(_0x2ec7('0x5'));var util=require(_0x2ec7('0x6'));var path=require(_0x2ec7('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2ec7('0x8'));var Redis=require(_0x2ec7('0x9'));var interaction=require(_0x2ec7('0xa'));var qs=require(_0x2ec7('0xb'));var pdf=require(_0x2ec7('0xc'));var logger=require(_0x2ec7('0xd'))('api');var config=require(_0x2ec7('0xe'));var db=require('../../mysqldb')['db'];config[_0x2ec7('0xf')]=_[_0x2ec7('0x10')](config[_0x2ec7('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0x2ec7('0x11'))(new Redis(config[_0x2ec7('0xf')]));require('./chatInteraction.socket')[_0x2ec7('0x12')](socket);var jayson=require(_0x2ec7('0x13'));var client=jayson[_0x2ec7('0x14')][_0x2ec7('0x15')]({'port':0x232b});var client9004=jayson[_0x2ec7('0x14')][_0x2ec7('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x451d99,_0x4c1d72,_0x1c01bf,_0x1268ee){return new BPromise(function(_0x274336,_0xbdb87){var _0x326f9d=_0x1268ee||client;return _0x326f9d[_0x2ec7('0x16')](_0x451d99,_0x1c01bf)[_0x2ec7('0x17')](function(_0x4258d6){logger[_0x2ec7('0x18')](_0x2ec7('0x19'),_0x4c1d72,_0x2ec7('0x1a'));logger[_0x2ec7('0x1b')](_0x2ec7('0x1c'),_0x4c1d72,_0x2ec7('0x1a'),JSON[_0x2ec7('0x1d')](_0x4258d6));if(_0x4258d6[_0x2ec7('0x1e')]){if(_0x4258d6[_0x2ec7('0x1e')][_0x2ec7('0x1f')]===0x1f4){logger[_0x2ec7('0x1e')]('ChatInteraction,\x20%s,\x20%s',_0x4c1d72,_0x4258d6[_0x2ec7('0x1e')]['message']);return _0xbdb87(_0x4258d6['error'][_0x2ec7('0x20')]);}logger['error'](_0x2ec7('0x19'),_0x4c1d72,_0x4258d6[_0x2ec7('0x1e')][_0x2ec7('0x20')]);return _0x274336(_0x4258d6[_0x2ec7('0x1e')]['message']);}else{logger[_0x2ec7('0x18')](_0x2ec7('0x19'),_0x4c1d72,'request\x20sent');_0x274336(_0x4258d6[_0x2ec7('0x21')][_0x2ec7('0x20')]);}})['catch'](function(_0x1f1a14){logger[_0x2ec7('0x1e')]('ChatInteraction,\x20%s,\x20%s',_0x4c1d72,_0x1f1a14);_0xbdb87(_0x1f1a14);});});}function respondWithStatusCode(_0x35fa6b,_0x2b8ced){_0x2b8ced=_0x2b8ced||0xcc;return function(_0x22bfa6){if(_0x22bfa6){return _0x35fa6b[_0x2ec7('0x22')](_0x2b8ced);}return _0x35fa6b[_0x2ec7('0x23')](_0x2b8ced)[_0x2ec7('0x24')]();};}function respondWithResult(_0x39a109,_0x192920){_0x192920=_0x192920||0xc8;return function(_0x5a8d0b){if(_0x5a8d0b){return _0x39a109[_0x2ec7('0x23')](_0x192920)[_0x2ec7('0x25')](_0x5a8d0b);}};}function respondWithFilteredResult(_0x415def,_0x169ace){return function(_0x4118f2){if(_0x4118f2){var _0xbb2fc2=typeof _0x169ace[_0x2ec7('0x26')]===_0x2ec7('0x27')&&typeof _0x169ace['limit']===_0x2ec7('0x27');var _0x50521e=_0x4118f2[_0x2ec7('0x28')];var _0x265879=_0xbb2fc2?0x0:_0x169ace['offset'];var _0x4eeeaa=_0xbb2fc2?_0x4118f2[_0x2ec7('0x28')]:_0x169ace[_0x2ec7('0x26')]+_0x169ace[_0x2ec7('0x29')];var _0x53dc63;if(_0x4eeeaa>=_0x50521e){_0x4eeeaa=_0x50521e;_0x53dc63=0xc8;}else{_0x53dc63=0xce;}_0x415def['status'](_0x53dc63);return _0x415def[_0x2ec7('0x2a')](_0x2ec7('0x2b'),_0x265879+'-'+_0x4eeeaa+'/'+_0x50521e)[_0x2ec7('0x25')](_0x4118f2);}return null;};}function saveUpdates(_0x563730){return function(_0x32530e){if(_0x32530e){return _0x32530e[_0x2ec7('0x2c')](_0x563730)[_0x2ec7('0x17')](function(_0x2cadd2){return _0x2cadd2;});}return null;};}function removeEntity(_0x14ae9c){return function(_0x598964){if(_0x598964){return _0x598964[_0x2ec7('0x2d')]()[_0x2ec7('0x17')](function(){_0x14ae9c['status'](0xcc)[_0x2ec7('0x24')]();});}};}function handleEntityNotFound(_0x211b30){return function(_0x219a34){if(!_0x219a34){_0x211b30[_0x2ec7('0x22')](0x194);}return _0x219a34;};}function handleError(_0x31830f,_0xe2c74b){_0xe2c74b=_0xe2c74b||0x1f4;return function(_0x17c616){logger[_0x2ec7('0x1e')](_0x17c616[_0x2ec7('0x2e')]);if(_0x17c616[_0x2ec7('0x2f')]){delete _0x17c616[_0x2ec7('0x2f')];}_0x31830f[_0x2ec7('0x23')](_0xe2c74b)[_0x2ec7('0x30')](_0x17c616);};}function getMustacheRender(_0x1f5aa8,_0x1e1872){return Mustache[_0x2ec7('0x31')](_0x1f5aa8,_[_0x2ec7('0x32')](_0x1e1872[_0x2ec7('0x33')],{'contact':_0x1e1872[_0x2ec7('0x34')],'message':_0x1e1872[_0x2ec7('0x20')],'agent':_0x1e1872[_0x2ec7('0x35')],'interaction':_0x1e1872['interaction'],'account':_0x1e1872[_0x2ec7('0x36')]}))||'';}exports['index']=function(_0x24ad02,_0x86ffbf){var _0x3416f4={};var _0x4e8217=_[_0x2ec7('0x37')](db['ChatInteraction'][_0x2ec7('0x38')],function(_0x1c9bd0){return{'name':_0x1c9bd0['fieldName'],'type':_0x1c9bd0[_0x2ec7('0x39')][_0x2ec7('0x3a')]};});_0x3416f4=qs[_0x2ec7('0x3b')](_0x4e8217,_0x24ad02);return interaction[_0x2ec7('0x3c')]('chat',_0x24ad02[_0x2ec7('0x3d')],_0x24ad02[_0x2ec7('0x3e')],_0x3416f4,_0x4e8217)[_0x2ec7('0x17')](respondWithFilteredResult(_0x86ffbf,_0x3416f4))[_0x2ec7('0x3f')](handleError(_0x86ffbf,null));};exports[_0x2ec7('0x40')]=function(_0x1fb332,_0x3c6aa0){var _0x4e6957={'raw':![],'where':{'id':_0x1fb332[_0x2ec7('0x41')]['id']}},_0x47a43d={};_0x47a43d[_0x2ec7('0x42')]=_[_0x2ec7('0x43')](db[_0x2ec7('0x44')][_0x2ec7('0x38')]);_0x47a43d[_0x2ec7('0x3d')]=_[_0x2ec7('0x43')](_0x1fb332[_0x2ec7('0x3d')]);_0x47a43d[_0x2ec7('0x45')]=_[_0x2ec7('0x46')](_0x47a43d[_0x2ec7('0x42')],_0x47a43d['query']);_0x4e6957[_0x2ec7('0x47')]=_[_0x2ec7('0x46')](_0x47a43d[_0x2ec7('0x42')],qs[_0x2ec7('0x48')](_0x1fb332['query'][_0x2ec7('0x48')]));_0x4e6957['attributes']=_0x4e6957['attributes'][_0x2ec7('0x49')]?_0x4e6957[_0x2ec7('0x47')]:_0x47a43d[_0x2ec7('0x42')];if(_0x1fb332['query'][_0x2ec7('0x4a')]){_0x4e6957[_0x2ec7('0x4b')]=[{'all':!![]}];}_0x4e6957=_[_0x2ec7('0x32')]({},_0x4e6957,_0x1fb332[_0x2ec7('0x4c')]);return db[_0x2ec7('0x44')][_0x2ec7('0x4d')](_0x4e6957)[_0x2ec7('0x17')](handleEntityNotFound(_0x3c6aa0,null))['then'](respondWithResult(_0x3c6aa0,null))[_0x2ec7('0x3f')](handleError(_0x3c6aa0,null));};exports[_0x2ec7('0x4e')]=function(_0x341051,_0x248462){return db[_0x2ec7('0x44')][_0x2ec7('0x4e')](_0x341051['body'],{})['then'](respondWithResult(_0x248462,0xc9))[_0x2ec7('0x3f')](handleError(_0x248462,null));};exports[_0x2ec7('0x2c')]=function(_0x52fecf,_0x2e3096){if(_0x52fecf[_0x2ec7('0x33')]['id']){delete _0x52fecf[_0x2ec7('0x33')]['id'];}return db[_0x2ec7('0x44')]['find']({'where':{'id':_0x52fecf['params']['id']}})['then'](handleEntityNotFound(_0x2e3096,null))[_0x2ec7('0x17')](saveUpdates(_0x52fecf[_0x2ec7('0x33')],null))['then'](respondWithResult(_0x2e3096,null))[_0x2ec7('0x3f')](handleError(_0x2e3096,null));};exports[_0x2ec7('0x2d')]=function(_0x3bcd5e,_0x2993b5){return db['ChatInteraction'][_0x2ec7('0x4d')]({'where':{'id':_0x3bcd5e[_0x2ec7('0x41')]['id']}})[_0x2ec7('0x17')](handleEntityNotFound(_0x2993b5,null))[_0x2ec7('0x17')](removeEntity(_0x2993b5,null))[_0x2ec7('0x3f')](handleError(_0x2993b5,null));};exports['describe']=function(_0x1840ce,_0x1fc757){return db[_0x2ec7('0x44')][_0x2ec7('0x4f')]()[_0x2ec7('0x17')](respondWithResult(_0x1fc757,null))[_0x2ec7('0x3f')](handleError(_0x1fc757,null));};exports['createVidaooSession']=function(_0xdd52d7,_0x53d6ad){var _0x324424=_0xdd52d7[_0x2ec7('0x41')]['id'];var _0x344dac;var _0x357f5b;var _0x2091c9;return db[_0x2ec7('0x44')][_0x2ec7('0x50')]({'where':{'id':_0x324424}})[_0x2ec7('0x17')](function(_0x3b648e){_0x344dac=_0x3b648e;return db[_0x2ec7('0x51')][_0x2ec7('0x50')]({'where':{'id':_0x3b648e['ChatWebsiteId']},'attributes':['id','vidaooApiKey','vidaooEscalation',_0x2ec7('0x52'),_0x2ec7('0x53'),_0x2ec7('0x54')],'raw':!![]});})[_0x2ec7('0x17')](function(_0x2e7b35){if(_0x2e7b35&&_0x2e7b35[_0x2ec7('0x55')]&&_0x2e7b35[_0x2ec7('0x56')]){_0x357f5b=_0x2e7b35;var _0x55e631={'interaction':{'id':_0x324424},'agent':{'id':_0xdd52d7['user']['id'],'name':_0xdd52d7[_0x2ec7('0x3e')]['name'],'fullname':_0xdd52d7['user'][_0x2ec7('0x57')],'email':_0xdd52d7[_0x2ec7('0x3e')][_0x2ec7('0x58')]},'contact':_0xdd52d7['body'][_0x2ec7('0x34')],'account':_0xdd52d7[_0x2ec7('0x33')][_0x2ec7('0x36')]};var _0x17986f={'rejectUnauthorized':![],'method':_0x2ec7('0x59'),'url':_0x2ec7('0x5a'),'headers':{'X-APIKEY':_0x2e7b35['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0xdd52d7[_0x2ec7('0x3e')][_0x2ec7('0x58')]],'buttons':null,'topic':_0x357f5b[_0x2ec7('0x52')],'note':_[_0x2ec7('0x5b')](_0x357f5b[_0x2ec7('0x53')])?null:getMustacheRender(_0x357f5b[_0x2ec7('0x53')],_0x55e631),'metadata':null},'redirect':_0x2ec7('0x5c'),'json':!![]};try{if(!_[_0x2ec7('0x5b')](_0x357f5b[_0x2ec7('0x54')])){var _0x3a52fa=getMustacheRender(_0x357f5b[_0x2ec7('0x54')],_0x55e631);var _0x566e64=JSON[_0x2ec7('0x5d')](_0x3a52fa);_0x17986f[_0x2ec7('0x33')]['metadata']=_0x566e64;}}catch(_0xa2e965){throw new db['Sequelize']['ValidationError'](_0x2ec7('0x5e'));}return rp(_0x17986f);}else{throw new db[(_0x2ec7('0x5f'))]['ValidationError'](_0x2ec7('0x60'));}})[_0x2ec7('0x17')](function(_0x2aa5e5){_0x2091c9=_0x2aa5e5;if(_0x2091c9['id']){var _0x31ac1d={'body':_0x2091c9[_0x2ec7('0x61')],'ChatWebsiteId':_0x357f5b['id'],'ChatInteractionId':_0x344dac['id'],'direction':'out','UserId':_0xdd52d7[_0x2ec7('0x3e')]['id']};return db[_0x2ec7('0x62')]['create'](_0x31ac1d,{});}else{throw new db[(_0x2ec7('0x5f'))][(_0x2ec7('0x63'))](_0x2ec7('0x64'));}})[_0x2ec7('0x17')](function(){return _0x344dac['updateAttributes']({'vidaooSessionId':_0x2091c9['id']});})['then'](respondWithResult(_0x53d6ad,null))['catch'](handleError(_0x53d6ad,null));};exports[_0x2ec7('0x65')]=function(_0x46858d,_0x2d1cc2){if(_0x46858d[_0x2ec7('0x33')]['id']){delete _0x46858d['body']['id'];}return db[_0x2ec7('0x44')]['find']({'where':{'id':_0x46858d['params']['id']},'include':[{'model':db[_0x2ec7('0x66')],'as':'Contact'}]})[_0x2ec7('0x17')](handleEntityNotFound(_0x2d1cc2,null))[_0x2ec7('0x17')](saveUpdates(_0x46858d[_0x2ec7('0x33')],null))[_0x2ec7('0x17')](respondWithResult(_0x2d1cc2,null))[_0x2ec7('0x3f')](handleError(_0x2d1cc2,null));};exports[_0x2ec7('0x67')]=function(_0x7defb,_0x3700a0){if(_0x7defb[_0x2ec7('0x33')]['id']){delete _0x7defb['body']['id'];}return db[_0x2ec7('0x44')][_0x2ec7('0x4d')]({'where':{'id':_0x7defb[_0x2ec7('0x41')]['id']}})['then'](function(_0x2ee8c7){if(!_0x2ee8c7){logger[_0x2ec7('0x1e')](_0x2ec7('0x68'),'abandon',0x194,_0x2ec7('0x69'));_0x3700a0['sendStatus'](0x194);}else{if(_0x2ee8c7['UserId']){throw new db[(_0x2ec7('0x5f'))][(_0x2ec7('0x63'))]('Interaction\x20already\x20assigned');}}return _0x2ee8c7;})['then'](function(_0x2dcc02){if(_0x2dcc02){return _0x2dcc02[_0x2ec7('0x2c')]({'closed':_0x7defb[_0x2ec7('0x33')][_0x2ec7('0x6a')],'disposition':_0x7defb[_0x2ec7('0x33')][_0x2ec7('0x6b')]})[_0x2ec7('0x17')](function(_0x3288b4){return _0x3288b4;});}})[_0x2ec7('0x17')](function(){return respondWithRpcPromise(_0x2ec7('0x6c'),_0x2ec7('0x67'),_0x7defb[_0x2ec7('0x33')],client9004);})[_0x2ec7('0x17')](respondWithResult(_0x3700a0,null))[_0x2ec7('0x3f')](handleError(_0x3700a0,null));};exports['attachmentUpload']=function(_0x193648,_0x3cc063){_0x193648[_0x2ec7('0x33')][_0x2ec7('0x2f')]=_0x193648[_0x2ec7('0x6d')]['originalname'];_0x193648[_0x2ec7('0x33')][_0x2ec7('0x6e')]=_0x193648[_0x2ec7('0x6d')][_0x2ec7('0x6f')];_0x193648[_0x2ec7('0x33')][_0x2ec7('0x39')]=_0x193648[_0x2ec7('0x6d')]['mimetype'];return db[_0x2ec7('0x70')]['create'](_0x193648[_0x2ec7('0x33')])[_0x2ec7('0x17')](respondWithResult(_0x3cc063,0xc9))[_0x2ec7('0x3f')](handleError(_0x3cc063,null));};exports[_0x2ec7('0x71')]=function(_0x915b80,_0x19acd4){return db[_0x2ec7('0x44')]['findOne']({'where':{'id':_0x915b80[_0x2ec7('0x41')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x19acd4,null))[_0x2ec7('0x17')](function(_0x3d3107){if(_0x3d3107){if(_0x3d3107['closed']){return _0x19acd4['status'](0x193)[_0x2ec7('0x25')]({'status':0x193,'message':_0x2ec7('0x72')});}return db['Attachment'][_0x2ec7('0x50')]({'where':{'id':_0x915b80['query']['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x19acd4,null));}})['then'](function(_0x567edd){if(_0x567edd){var _0x2a241b=_0x567edd[_0x2ec7('0x73')]!==null;var _0x4c364b=path[_0x2ec7('0x74')](config['root'],_0x2ec7('0x75'));if(_0x2a241b){_0x4c364b=path['join'](_0x4c364b,'offline-chat/');}var _0xa29a7f=path['join'](_0x4c364b,_0x567edd[_0x2ec7('0x6e')]);return _0x19acd4['download'](_0xa29a7f);}})[_0x2ec7('0x3f')](handleError(_0x19acd4,null));};exports[_0x2ec7('0x76')]=function(_0x3daee5,_0x4e0b32){var _0x1a2741=null;var _0x2ab746=null;var _0x2be248=null;if(_0x3daee5['body']['id']){delete _0x3daee5[_0x2ec7('0x33')]['id'];}if(_0x3daee5[_0x2ec7('0x33')][_0x2ec7('0x77')]){_0x2be248=path['join'](config[_0x2ec7('0x78')],_0x2ec7('0x79'),util[_0x2ec7('0x7a')]('transcript-%s.txt',Date[_0x2ec7('0x7b')]()));_0x3daee5['body']['pathTranscript']=_0x2be248;}return db[_0x2ec7('0x44')][_0x2ec7('0x4d')]({'where':{'id':_0x3daee5[_0x2ec7('0x41')]['id']},'include':[{'model':db[_0x2ec7('0x62')],'as':_0x2ec7('0x7c'),'include':[{'model':db[_0x2ec7('0x7d')],'as':_0x2ec7('0x7d')}]}]})['then'](handleEntityNotFound(_0x4e0b32,null))[_0x2ec7('0x17')](saveUpdates(_0x3daee5[_0x2ec7('0x33')],null))[_0x2ec7('0x17')](function(_0x4a9043){if(_0x4a9043){_0x1a2741=_0x4a9043;return db[_0x2ec7('0x51')][_0x2ec7('0x4d')]({'where':{'id':_0x1a2741['ChatWebsiteId']}});}})['then'](function(_0x2ec18c){if(_0x2ec18c){_0x2ab746=_0x2ec18c;return db['CmContact'][_0x2ec7('0x4d')]({'where':{'id':_0x1a2741[_0x2ec7('0x7e')]}});}})[_0x2ec7('0x17')](function(_0x14b722){if(_0x14b722){if(_0x2be248){var _0x28b484=null;for(var _0xa56c8a=0x1;_0xa56c8a<_0x1a2741[_0x2ec7('0x7c')][_0x2ec7('0x49')];++_0xa56c8a){_0x28b484=_0x1a2741[_0x2ec7('0x7c')][_0xa56c8a];var _0x17574b=_0x28b484['UserId']?util[_0x2ec7('0x7a')]('%s%d',_0x2ab746['agentAlias'],_0x28b484[_0x2ec7('0x7f')]):_0x2ec7('0x80');var _0x25c1e7=_0x3daee5[_0x2ec7('0x33')][_0x2ec7('0x81')]||util[_0x2ec7('0x7a')](_0x2ec7('0x82'),_0x2ec7('0x83'),_0x28b484['ContactId']);switch(_0x2ab746[_0x2ec7('0x84')]){case _0x2ec7('0x85'):_0x17574b=_0x28b484['UserId']?util[_0x2ec7('0x7a')]('%s%d',_0x2ab746['agentAlias'],_0x28b484[_0x2ec7('0x7f')]):_0x2ec7('0x80');break;case'agent_alias':_0x17574b=_0x28b484[_0x2ec7('0x7f')]?_0x28b484[_0x2ec7('0x7d')][_0x2ec7('0x86')]||_0x28b484[_0x2ec7('0x7d')][_0x2ec7('0x57')]:_0x2ec7('0x80');break;case _0x2ec7('0x87'):_0x17574b=_0x28b484['UserId']?_0x28b484[_0x2ec7('0x7d')][_0x2ec7('0x57')]:'System';break;default:_0x17574b=_0x28b484[_0x2ec7('0x7f')]?util[_0x2ec7('0x7a')](_0x2ec7('0x82'),_0x2ab746['agentAlias'],_0x28b484[_0x2ec7('0x7f')]):'System';}var _0x2389d6=util[_0x2ec7('0x7a')](_0x2ec7('0x88'),moment(_0x28b484[_0x2ec7('0x89')])['format'](_0x2ec7('0x8a')),_0x28b484[_0x2ec7('0x8b')]==='in'?_0x25c1e7:_0x17574b,_0x28b484['body']);if(!_0x28b484[_0x2ec7('0x8c')]){fs['appendFileSync'](_0x2be248,_0x2389d6);}}return db['MailAccount'][_0x2ec7('0x50')]({'where':{'service':!![]},'include':[{'model':db[_0x2ec7('0x8d')],'as':_0x2ec7('0x8e'),'raw':!![],'include':[{'model':db[_0x2ec7('0x8f')],'as':_0x2ec7('0x8f'),'raw':!![]}]}]});}}})['then'](function(_0x4ee943){if(!_0x4ee943||!_0x4ee943['Smtp']||!_0x3daee5[_0x2ec7('0x33')])return _0x1a2741;var _0x2cfac8=_0x4ee943[_0x2ec7('0x90')]();return respondWithRpcPromise(_0x2ec7('0x91'),_0x2ec7('0x92'),{'account':_0x2cfac8,'message':{'from':util[_0x2ec7('0x7a')](_0x2ec7('0x93'),_0x4ee943[_0x2ec7('0x2f')],_0x4ee943[_0x2ec7('0x58')]||_0x4ee943[_0x2ec7('0x8e')][_0x2ec7('0x3e')]),'to':_0x3daee5[_0x2ec7('0x33')][_0x2ec7('0x77')],'subject':_0x2ec7('0x94'),'text':util[_0x2ec7('0x7a')](_0x2ec7('0x95'),_0x3daee5['body'][_0x2ec7('0x77')]),'attachments':[{'path':_0x2be248}]}})['then'](function(){return _0x1a2741;})[_0x2ec7('0x3f')](function(_0x25810e){logger[_0x2ec7('0x1e')](_0x25810e);});})[_0x2ec7('0x17')](respondWithStatusCode(_0x4e0b32,0xc8))['catch'](handleError(_0x4e0b32,null));};exports['addMessage']=function(_0x1a65df,_0x4d76e2){return db[_0x2ec7('0x62')][_0x2ec7('0x4d')]({'where':{'id':_0x1a65df[_0x2ec7('0x41')]['id']}})[_0x2ec7('0x17')](handleEntityNotFound(_0x4d76e2,null))[_0x2ec7('0x17')](function(_0x291ee1){if(_0x291ee1){return _0x291ee1[_0x2ec7('0x96')](_0x1a65df[_0x2ec7('0x33')][_0x2ec7('0x97')],_[_0x2ec7('0x98')](_0x1a65df['body'],[_0x2ec7('0x97'),'id'])||{});}})[_0x2ec7('0x17')](respondWithResult(_0x4d76e2,null))[_0x2ec7('0x3f')](handleError(_0x4d76e2,null));};exports[_0x2ec7('0x99')]=function(_0x28d684,_0x458af8){var _0x1b8f31={'raw':![],'where':{}};var _0x5c13b0={};var _0x286aa5={'count':0x0,'rows':[]};return db[_0x2ec7('0x44')][_0x2ec7('0x50')]({'where':{'id':_0x28d684[_0x2ec7('0x41')]['id']}})[_0x2ec7('0x17')](handleEntityNotFound(_0x458af8,null))[_0x2ec7('0x17')](function(_0x976741){if(_0x976741){_0x5c13b0['model']=_[_0x2ec7('0x43')](db[_0x2ec7('0x62')][_0x2ec7('0x38')]);_0x5c13b0['query']=_[_0x2ec7('0x43')](_0x28d684[_0x2ec7('0x3d')]);_0x5c13b0['filters']=_['intersection'](_0x5c13b0[_0x2ec7('0x42')],_0x5c13b0[_0x2ec7('0x3d')]);_0x1b8f31['attributes']=_[_0x2ec7('0x46')](_0x5c13b0[_0x2ec7('0x42')],qs[_0x2ec7('0x48')](_0x28d684[_0x2ec7('0x3d')][_0x2ec7('0x48')]));_0x1b8f31[_0x2ec7('0x47')]=_0x1b8f31[_0x2ec7('0x47')]['length']?_0x1b8f31[_0x2ec7('0x47')]:_0x5c13b0[_0x2ec7('0x42')];if(!_0x28d684[_0x2ec7('0x3d')][_0x2ec7('0x9a')]('nolimit')){_0x1b8f31[_0x2ec7('0x29')]=qs[_0x2ec7('0x29')](_0x28d684[_0x2ec7('0x3d')][_0x2ec7('0x29')]);_0x1b8f31['offset']=qs['offset'](_0x28d684['query'][_0x2ec7('0x26')]);}_0x1b8f31['order']=qs[_0x2ec7('0x9b')](_0x28d684[_0x2ec7('0x3d')][_0x2ec7('0x9b')]);_0x1b8f31[_0x2ec7('0x9c')]=qs['filters'](_['pick'](_0x28d684[_0x2ec7('0x3d')],_0x5c13b0[_0x2ec7('0x45')]));_0x1b8f31[_0x2ec7('0x9c')][_0x2ec7('0x9d')]=_0x976741['id'];if(_0x28d684[_0x2ec7('0x3d')][_0x2ec7('0x9e')]){_0x1b8f31[_0x2ec7('0x9c')]=_['merge'](_0x1b8f31[_0x2ec7('0x9c')],{'$or':_[_0x2ec7('0x37')](_0x1b8f31[_0x2ec7('0x47')],function(_0x408166){var _0x39abc1={};_0x39abc1[_0x408166]={'$like':'%'+_0x28d684[_0x2ec7('0x3d')][_0x2ec7('0x9e')]+'%'};return _0x39abc1;})});}if(_0x28d684[_0x2ec7('0x3d')][_0x2ec7('0x9f')]){var _0x282c9d=_0x28d684['query']['$gte'][_0x2ec7('0xa0')](',');var _0x453e55={};_0x453e55[_0x282c9d[0x0]]={'$gte':moment(_0x282c9d[0x1])[_0x2ec7('0x7a')](_0x2ec7('0xa1'))};_0x1b8f31[_0x2ec7('0x9c')]=_[_0x2ec7('0x32')](_0x1b8f31[_0x2ec7('0x9c')],_0x453e55);}_0x1b8f31=_[_0x2ec7('0x32')]({},_0x1b8f31,_0x28d684[_0x2ec7('0x4c')]);return db[_0x2ec7('0x62')][_0x2ec7('0x28')]({'where':_0x1b8f31['where']})[_0x2ec7('0x17')](function(_0x22f319){_0x286aa5[_0x2ec7('0x28')]=_0x22f319;if(_0x28d684[_0x2ec7('0x3d')][_0x2ec7('0x4a')]){_0x1b8f31[_0x2ec7('0x4b')]=[{'all':!![]}];}return db['ChatMessage'][_0x2ec7('0x3c')](_0x1b8f31);})[_0x2ec7('0x17')](function(_0x38d14b){_0x286aa5[_0x2ec7('0xa2')]=_0x38d14b;return _0x286aa5;});}})['then'](respondWithFilteredResult(_0x458af8,_0x1b8f31))['catch'](handleError(_0x458af8,null));};exports['getMyMessages']=function(_0x3837f9,_0x577557){var _0x4823bf={'where':{}},_0x2ccefe={},_0x10d263={'count':0x0,'rows':[]};return db[_0x2ec7('0x44')][_0x2ec7('0x50')]({'where':{'id':_0x3837f9[_0x2ec7('0x41')]['id']}})[_0x2ec7('0x17')](handleEntityNotFound(_0x577557,null))[_0x2ec7('0x17')](function(_0x3ad164){if(_0x3ad164){_0x2ccefe[_0x2ec7('0x42')]=_['keys'](db['ChatMessage'][_0x2ec7('0x38')]);_0x2ccefe[_0x2ec7('0x3d')]=_[_0x2ec7('0x43')](_0x3837f9['query']);_0x2ccefe[_0x2ec7('0x45')]=_[_0x2ec7('0x46')](_0x2ccefe['model'],_0x2ccefe['query']);_0x4823bf[_0x2ec7('0x47')]=_[_0x2ec7('0x46')](_0x2ccefe['model'],qs[_0x2ec7('0x48')](_0x3837f9['query'][_0x2ec7('0x48')]));_0x4823bf[_0x2ec7('0x47')]=_0x4823bf[_0x2ec7('0x47')][_0x2ec7('0x49')]?_0x4823bf[_0x2ec7('0x47')]:_0x2ccefe[_0x2ec7('0x42')];if(!_0x3837f9[_0x2ec7('0x3d')][_0x2ec7('0x9a')](_0x2ec7('0xa3'))){_0x4823bf[_0x2ec7('0x29')]=qs[_0x2ec7('0x29')](_0x3837f9[_0x2ec7('0x3d')][_0x2ec7('0x29')]);_0x4823bf[_0x2ec7('0x26')]=qs[_0x2ec7('0x26')](_0x3837f9[_0x2ec7('0x3d')][_0x2ec7('0x26')]);}_0x4823bf[_0x2ec7('0xa4')]=qs[_0x2ec7('0x9b')](_0x3837f9['query'][_0x2ec7('0x9b')]);_0x4823bf[_0x2ec7('0x9c')]=qs[_0x2ec7('0x45')](_[_0x2ec7('0xa5')](_0x3837f9['query'],_0x2ccefe[_0x2ec7('0x45')]));_0x4823bf['where'][_0x2ec7('0x9d')]=_0x3ad164['id'];if(_0x3837f9[_0x2ec7('0x3d')][_0x2ec7('0x9e')]){_0x4823bf[_0x2ec7('0x9c')]=_[_0x2ec7('0x32')](_0x4823bf['where'],{'$or':_['map'](_0x4823bf[_0x2ec7('0x47')],function(_0x4485e5){var _0x4d04c0={};_0x4d04c0[_0x4485e5]={'$like':'%'+_0x3837f9[_0x2ec7('0x3d')][_0x2ec7('0x9e')]+'%'};return _0x4d04c0;})});}_0x4823bf[_0x2ec7('0x9c')]['secret']=![];if(_0x3837f9[_0x2ec7('0x3d')]['id']){_0x4823bf[_0x2ec7('0x9c')]['id']={'$gt':_0x3837f9[_0x2ec7('0x3d')]['id']};}_0x4823bf=_[_0x2ec7('0x32')]({},_0x4823bf,_0x3837f9['options']);return db['ChatMessage'][_0x2ec7('0x28')]({'where':_0x4823bf['where']})[_0x2ec7('0x17')](function(_0x174cb3){_0x10d263['count']=_0x174cb3;_0x4823bf['include']=[];if(_0x3837f9['query'][_0x2ec7('0xa6')]){_0x4823bf['include'][_0x2ec7('0xa7')]({'model':db[_0x2ec7('0x7d')],'as':_0x2ec7('0x7d'),'attributes':['id',_0x2ec7('0x57'),_0x2ec7('0x86')]});}if(_0x3837f9[_0x2ec7('0x3d')]['includeAll']){_0x4823bf[_0x2ec7('0x4b')]=[{'all':!![]}];}return db[_0x2ec7('0x62')][_0x2ec7('0x3c')](_0x4823bf);})['then'](function(_0x1d556f){_0x10d263[_0x2ec7('0xa2')]=_0x1d556f;return _0x10d263;});}})[_0x2ec7('0x17')](respondWithFilteredResult(_0x577557,_0x4823bf))[_0x2ec7('0x3f')](handleError(_0x577557,null));};exports[_0x2ec7('0xa8')]=function(_0x5dd494,_0x42c332){return db[_0x2ec7('0x44')][_0x2ec7('0x4d')]({'where':{'id':_0x5dd494['params']['id']}})[_0x2ec7('0x17')](handleEntityNotFound(_0x42c332,null))[_0x2ec7('0x17')](function(_0x395cfe){if(_0x395cfe){return _0x395cfe[_0x2ec7('0xa9')](_0x5dd494[_0x2ec7('0x33')][_0x2ec7('0x97')],_[_0x2ec7('0x98')](_0x5dd494[_0x2ec7('0x33')],[_0x2ec7('0x97'),'id'])||{})['spread'](function(){return db['Tag'][_0x2ec7('0x3c')]({'attributes':['id',_0x2ec7('0x2f'),'color'],'where':{'id':_0x5dd494['body']['ids']}});})[_0x2ec7('0x17')](function(_0x80ee98){socket[_0x2ec7('0xaa')]('chatInteractionTags:save',{'id':Number(_0x5dd494[_0x2ec7('0x41')]['id']),'tags':_0x80ee98||[]});return{'id':Number(_0x5dd494[_0x2ec7('0x41')]['id']),'tags':_0x80ee98||[]};});}})[_0x2ec7('0x17')](respondWithResult(_0x42c332,null))['catch'](handleError(_0x42c332,null));};exports[_0x2ec7('0xab')]=function(_0x4a8003,_0x521e1d){return db[_0x2ec7('0x44')][_0x2ec7('0x4d')]({'where':{'id':_0x4a8003[_0x2ec7('0x41')]['id']}})['then'](handleEntityNotFound(_0x521e1d,null))[_0x2ec7('0x17')](function(_0x54c55b){if(_0x54c55b){return _0x54c55b[_0x2ec7('0xab')](_0x4a8003[_0x2ec7('0x3d')][_0x2ec7('0x97')]);}})[_0x2ec7('0x17')](respondWithStatusCode(_0x521e1d,null))['catch'](handleError(_0x521e1d,null));};exports[_0x2ec7('0xac')]=function(_0x129016,_0x64a89c){var _0x57e400=moment()[_0x2ec7('0xad')]()[_0x2ec7('0xae')]();var _0x35c85d=path[_0x2ec7('0x74')](config[_0x2ec7('0x78')],_0x2ec7('0xaf'),_0x2ec7('0xb0'),_0x2ec7('0xb1'));var _0x4e54f1=path[_0x2ec7('0x74')](config[_0x2ec7('0x78')],_0x2ec7('0xaf'),_0x2ec7('0xb0'),_0x2ec7('0xb2'));var _0x3e7330=path[_0x2ec7('0x74')](_0x35c85d,_0x57e400);var _0x4336ff=util[_0x2ec7('0x7a')](_0x2ec7('0xb3'),_0x129016[_0x2ec7('0x41')]['id'],_0x57e400);var _0x269617=path[_0x2ec7('0x74')](_0x35c85d,_0x4336ff);var _0xe56568=[];_0xe56568[_0x2ec7('0xa7')]({'model':db[_0x2ec7('0x7d')],'as':'User','attributes':['id',_0x2ec7('0x57')],'raw':!![]});_0xe56568[_0x2ec7('0xa7')]({'model':db[_0x2ec7('0x66')],'as':_0x2ec7('0xb4'),'attributes':['id',_0x2ec7('0xb5'),_0x2ec7('0xb6')],'raw':!![]});if(_0x129016[_0x2ec7('0x3d')]['attachments']){_0xe56568[_0x2ec7('0xa7')]({'model':db[_0x2ec7('0x70')],'as':_0x2ec7('0x70'),'raw':!![]});}var _0x25c234=[{'model':db['ChatMessage'],'as':'Messages','attributes':['id',_0x2ec7('0x33'),_0x2ec7('0x89'),_0x2ec7('0x8b'),_0x2ec7('0x8c'),_0x2ec7('0xb7')],'include':_0xe56568}];_0x25c234[_0x2ec7('0xa7')]({'model':db[_0x2ec7('0x51')],'as':_0x2ec7('0xb8'),'attributes':['id','name']});_0x25c234[_0x2ec7('0xa7')]({'model':db['User'],'as':_0x2ec7('0xb9'),'attributes':['id',_0x2ec7('0x57')]});return db[_0x2ec7('0x44')]['find']({'where':{'id':_0x129016['params']['id']},'include':_0x25c234})[_0x2ec7('0x17')](handleEntityNotFound(_0x64a89c,null))[_0x2ec7('0x17')](function(_0x555c1b){if(_0x555c1b){var _0xa7224d=_0x555c1b['get']({'plain':!![]});fs[_0x2ec7('0xba')](_0x3e7330);var _0x5f58a4={'channel':'Chat','account':_0xa7224d[_0x2ec7('0xb8')][_0x2ec7('0x2f')],'agent':_0xa7224d[_0x2ec7('0xb9')]?_0xa7224d[_0x2ec7('0xb9')][_0x2ec7('0x57')]:_0x2ec7('0xbb'),'createdAt':moment(_0xa7224d[_0x2ec7('0x89')])['format'](_0x2ec7('0xa1'))[_0x2ec7('0xae')](),'closedAt':_0xa7224d['closed']?moment(_0xa7224d[_0x2ec7('0xbc')])[_0x2ec7('0x7a')](_0x2ec7('0xa1'))['toString']():'','disposition':_0xa7224d['disposition'],'chatInfo':{'browser':_0xa7224d[_0x2ec7('0xbd')],'os':_0xa7224d[_0x2ec7('0xbe')],'referer':_0xa7224d[_0x2ec7('0xbf')],'customerIp':_0xa7224d['customerIp'],'customerPort':_0xa7224d[_0x2ec7('0xc0')]?_0xa7224d[_0x2ec7('0xc0')]:_0x2ec7('0xbb')},'messages':_(_0xa7224d['Messages'])[_0x2ec7('0xc1')]()['filter']({'secret':![]})[_0x2ec7('0x37')](function(_0x1ee0b7){if(_0x1ee0b7[_0x2ec7('0x70')]){var _0x5b7027=path['join'](_0x4e54f1,_0x1ee0b7[_0x2ec7('0x70')]['basename']);if(fs['existsSync'](_0x5b7027)){fs[_0x2ec7('0xc2')](_0x5b7027)[_0x2ec7('0xc3')](fs[_0x2ec7('0xc4')](path['join'](_0x3e7330,_0x1ee0b7[_0x2ec7('0x70')][_0x2ec7('0x6e')])));}}return{'date':moment(_0x1ee0b7['createdAt'])[_0x2ec7('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2ec7('0xae')](),'sender':_0x1ee0b7[_0x2ec7('0x8b')]===_0x2ec7('0xc5')?_0x1ee0b7[_0x2ec7('0x7d')]?_0x1ee0b7[_0x2ec7('0x7d')][_0x2ec7('0x57')]:_0x2ec7('0x80'):_0x1ee0b7[_0x2ec7('0xb4')][_0x2ec7('0xb5')]+(_0x1ee0b7[_0x2ec7('0xb4')][_0x2ec7('0xb6')]?'\x20'+_0x1ee0b7['Contact'][_0x2ec7('0xb6')]:''),'body':_0x1ee0b7[_0x2ec7('0x70')]?_0x1ee0b7[_0x2ec7('0x70')][_0x2ec7('0x6e')]:_0x1ee0b7[_0x2ec7('0x33')],'direction':_0x1ee0b7[_0x2ec7('0x8b')]==='out'?'A':'C','secret':_0x1ee0b7[_0x2ec7('0x8c')],'read':_0x1ee0b7[_0x2ec7('0xb7')],'attachment':_0x1ee0b7[_0x2ec7('0x70')]};})['value']()};return ejs['renderFile'](path[_0x2ec7('0x74')](config[_0x2ec7('0x78')],'server',_0x2ec7('0xc6'),_0x2ec7('0xc7')),{'interaction':_0x5f58a4})[_0x2ec7('0x17')](function(_0x45d624){var _0x1adfa3=path[_0x2ec7('0x74')](_0x3e7330,_0x2ec7('0xc8')+_0xa7224d['id']+'-'+_0x57e400+'.pdf');var _0x5784bb={'path':_0x1adfa3,'channel':_0x2ec7('0xc9'),'interactionId':_0xa7224d['id']};return pdf['createPdfFromHTML'](_0x45d624,_0x5784bb);})[_0x2ec7('0x17')](function(){return new Promise(function(_0x52e555,_0x549956){zipdir(_0x3e7330,{'saveTo':_0x269617},function(_0x3bdb1d,_0x20a4cc){if(_0x3bdb1d)return _0x549956(_0x3bdb1d);return _0x52e555(_0x20a4cc);});})[_0x2ec7('0x17')](function(){return new BPromise(function(_0xa38bd4,_0x4045ff){rimraf(_0x3e7330,function(_0x4789db){if(_0x4789db)_0x4045ff(_0x4789db);return _0xa38bd4();});});})[_0x2ec7('0x17')](function(){return _0x64a89c[_0x2ec7('0xac')](_0x269617,_0x4336ff,function(_0x4755ef){if(_0x4755ef){logger[_0x2ec7('0x1e')](_0x2ec7('0xca'),_0x4755ef);}else{fs[_0x2ec7('0xcb')](_0x269617);}});});});}else{return _0x64a89c[_0x2ec7('0x22')](0xc8);}})[_0x2ec7('0x3f')](handleError(_0x64a89c,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index d7b43b4..82f2ebd 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 _0x6273=['hasOwnProperty','events','../../mysqldb','ChatMessage','setMaxListeners','save','remove','then','setDataValue','Users','map','findAll','length','emit','catch'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x6273,0x1f0));var _0x3627=function(_0x4fd66d,_0x45ba36){_0x4fd66d=_0x4fd66d-0x0;var _0x2f5572=_0x6273[_0x4fd66d];return _0x2f5572;};'use strict';var EventEmitter=require(_0x3627('0x0'));var ChatInteraction=require(_0x3627('0x1'))['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0x3627('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x3627('0x3')](0x0);var events={'afterCreate':_0x3627('0x4'),'afterUpdate':'update','afterDestroy':_0x3627('0x5')};function emitEvent(_0x46e9bc){return function(_0x3b6912,_0x5dafca,_0x529f84){_0x3b6912['getUsers']({'attributes':['id'],'raw':!![]})[_0x3627('0x6')](function(_0x22e03b){_0x3b6912[_0x3627('0x7')](_0x3627('0x8'),_0x22e03b[_0x3627('0x9')](function(_0x4951bc){return{'id':_0x4951bc['id']};}));return ChatMessage[_0x3627('0xa')]({'where':{'ChatInteractionId':_0x3b6912['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2d91a5){_0x3b6912[_0x3627('0x7')]('unreadMessages',_0x2d91a5[_0x3627('0xb')]);ChatInteractionEvents[_0x3627('0xc')](_0x46e9bc+':'+_0x3b6912['id'],_0x3b6912);ChatInteractionEvents[_0x3627('0xc')](_0x46e9bc,_0x3b6912);_0x529f84(null);})[_0x3627('0xd')](_0x529f84(null));};}for(var e in events){if(events[_0x3627('0xe')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0xac2e=['findAll','unreadMessages','emit','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','save','update','getUsers','then','setDataValue','Users'];(function(_0x2bad2c,_0x56d9c5){var _0x553454=function(_0x199d25){while(--_0x199d25){_0x2bad2c['push'](_0x2bad2c['shift']());}};_0x553454(++_0x56d9c5);}(_0xac2e,0x122));var _0xeac2=function(_0x43b833,_0x345a9e){_0x43b833=_0x43b833-0x0;var _0x5085d0=_0xac2e[_0x43b833];return _0x5085d0;};'use strict';var EventEmitter=require(_0xeac2('0x0'));var ChatInteraction=require(_0xeac2('0x1'))['db'][_0xeac2('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0xeac2('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xeac2('0x4'),'afterUpdate':_0xeac2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4770c1){return function(_0x179067,_0x191769,_0xe490){_0x179067[_0xeac2('0x6')]({'attributes':['id'],'raw':!![]})[_0xeac2('0x7')](function(_0xa34dbe){_0x179067[_0xeac2('0x8')](_0xeac2('0x9'),_0xa34dbe['map'](function(_0x196068){return{'id':_0x196068['id']};}));return ChatMessage[_0xeac2('0xa')]({'where':{'ChatInteractionId':_0x179067['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1fefc3){_0x179067[_0xeac2('0x8')](_0xeac2('0xb'),_0x1fefc3['length']);ChatInteractionEvents[_0xeac2('0xc')](_0x4770c1+':'+_0x179067['id'],_0x179067);ChatInteractionEvents[_0xeac2('0xc')](_0x4770c1,_0x179067);_0xe490(null);})['catch'](_0xe490(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xeac2('0xd')](e,emitEvent(event));}}module[_0xeac2('0xe')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index c4be814..048bc3f 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 _0xbc3f=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','rimraf','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','format'];(function(_0x43f1fa,_0x5cfe26){var _0x189522=function(_0x5a10){while(--_0x5a10){_0x43f1fa['push'](_0x43f1fa['shift']());}};_0x189522(++_0x5cfe26);}(_0xbc3f,0x123));var _0xfbc3=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xbc3f[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0xfbc3('0x0'));var util=require(_0xfbc3('0x1'));var logger=require(_0xfbc3('0x2'))(_0xfbc3('0x3'));var moment=require('moment');var BPromise=require(_0xfbc3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfbc3('0x5'));var rimraf=require(_0xfbc3('0x6'));var config=require('../../config/environment');var attributes=require(_0xfbc3('0x7'));module[_0xfbc3('0x8')]=function(_0xd77c5f,_0x2bed21){return _0xd77c5f[_0xfbc3('0x9')](_0xfbc3('0xa'),attributes,{'tableName':_0xfbc3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4e9332,_0x4cedd2,_0x8fd3af){if(_0x4e9332[_0xfbc3('0xc')](_0xfbc3('0xd'))){_0x4e9332['closedAt']=moment()[_0xfbc3('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x8fd3af(null,_0x4e9332);}},'charset':_0xfbc3('0xf'),'collate':_0xfbc3('0x10')});}; \ No newline at end of file +var _0x85d9=['../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0xdbe1ca,_0x461894){var _0x1eeac1=function(_0x311a37){while(--_0x311a37){_0xdbe1ca['push'](_0xdbe1ca['shift']());}};_0x1eeac1(++_0x461894);}(_0x85d9,0x65));var _0x985d=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x85d9[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x985d('0x0'));var util=require(_0x985d('0x1'));var logger=require(_0x985d('0x2'))('api');var moment=require(_0x985d('0x3'));var BPromise=require(_0x985d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x985d('0x5'));var rimraf=require(_0x985d('0x6'));var config=require(_0x985d('0x7'));var attributes=require(_0x985d('0x8'));module[_0x985d('0x9')]=function(_0x494a22,_0x5711b7){return _0x494a22[_0x985d('0xa')](_0x985d('0xb'),attributes,{'tableName':_0x985d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1d3b46,_0x25f9a3,_0x245f25){if(_0x1d3b46[_0x985d('0xd')]('closed')){_0x1d3b46['closedAt']=moment()[_0x985d('0xe')](_0x985d('0xf'));}_0x245f25(null,_0x1d3b46);}},'charset':_0x985d('0x10'),'collate':_0x985d('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 6a9da76..968a20f 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 _0xa6ba=['message','result','UpdateChatInteraction','update','options','raw','where','catch','AddTagsToChatInteraction','ChatInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4e8efd,_0x46bc20){var _0x31e442=function(_0x4c6c00){while(--_0x4c6c00){_0x4e8efd['push'](_0x4e8efd['shift']());}};_0x31e442(++_0x46bc20);}(_0xa6ba,0x18b));var _0xaa6b=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xa6ba[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xaa6b('0x0'));var util=require(_0xaa6b('0x1'));var moment=require('moment');var BPromise=require(_0xaa6b('0x2'));var rs=require(_0xaa6b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa6b('0x4'))['db'];var utils=require(_0xaa6b('0x5'));var logger=require('../../config/logger')(_0xaa6b('0x6'));var config=require(_0xaa6b('0x7'));var jayson=require(_0xaa6b('0x8'));var client=jayson[_0xaa6b('0x9')][_0xaa6b('0xa')]({'port':0x232a});config[_0xaa6b('0xb')]=_[_0xaa6b('0xc')](config[_0xaa6b('0xb')],{'host':_0xaa6b('0xd'),'port':0x18eb});var socket=require(_0xaa6b('0xe'))(new Redis(config[_0xaa6b('0xb')]));require(_0xaa6b('0xf'))[_0xaa6b('0x10')](socket);function respondWithRpcPromise(_0x321a7c,_0x5d184b,_0x6c0f46){return new BPromise(function(_0x5cfbbc,_0x30490c){return client['request'](_0x321a7c,_0x6c0f46)[_0xaa6b('0x11')](function(_0x2421dc){logger[_0xaa6b('0x12')](_0xaa6b('0x13'),_0x5d184b,_0xaa6b('0x14'));logger[_0xaa6b('0x15')](_0xaa6b('0x16'),_0x5d184b,_0xaa6b('0x14'),JSON[_0xaa6b('0x17')](_0x2421dc));if(_0x2421dc[_0xaa6b('0x18')]){if(_0x2421dc[_0xaa6b('0x18')]['code']===0x1f4){logger[_0xaa6b('0x18')](_0xaa6b('0x13'),_0x5d184b,_0x2421dc['error']['message']);return _0x30490c(_0x2421dc['error']['message']);}logger['error'](_0xaa6b('0x13'),_0x5d184b,_0x2421dc[_0xaa6b('0x18')][_0xaa6b('0x19')]);return _0x5cfbbc(_0x2421dc['error'][_0xaa6b('0x19')]);}else{logger[_0xaa6b('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x5d184b,_0xaa6b('0x14'));_0x5cfbbc(_0x2421dc[_0xaa6b('0x1a')][_0xaa6b('0x19')]);}})['catch'](function(_0x4bceb0){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x5d184b,_0x4bceb0);_0x30490c(_0x4bceb0);});});}exports[_0xaa6b('0x1b')]=function(_0x1d9212){var _0x517c8e=this;return new Promise(function(_0x587303,_0x4854c9){return db['ChatInteraction'][_0xaa6b('0x1c')](_0x1d9212['body'],{'raw':_0x1d9212['options']?_0x1d9212[_0xaa6b('0x1d')][_0xaa6b('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d9212[_0xaa6b('0x1d')]?_0x1d9212[_0xaa6b('0x1d')][_0xaa6b('0x1f')]||null:null,'attributes':_0x1d9212[_0xaa6b('0x1d')]?_0x1d9212[_0xaa6b('0x1d')]['attributes']||null:null,'limit':_0x1d9212[_0xaa6b('0x1d')]?_0x1d9212[_0xaa6b('0x1d')]['limit']||null:null})[_0xaa6b('0x11')](function(_0x4a8853){logger[_0xaa6b('0x12')]('UpdateChatInteraction',_0x1d9212);logger[_0xaa6b('0x15')](_0xaa6b('0x1b'),_0x1d9212,JSON['stringify'](_0x4a8853));_0x587303(_0x4a8853);})[_0xaa6b('0x20')](function(_0x4da8f6){logger[_0xaa6b('0x18')]('UpdateChatInteraction',_0x4da8f6[_0xaa6b('0x19')],_0x1d9212);_0x4854c9(_0x517c8e[_0xaa6b('0x18')](0x1f4,_0x4da8f6[_0xaa6b('0x19')]));});});};exports[_0xaa6b('0x21')]=function(_0x2b85a9){return new Promise(function(_0x37ec69,_0x1e1bc0){return db[_0xaa6b('0x22')][_0xaa6b('0x23')]({'where':_0x2b85a9[_0xaa6b('0x1d')]?_0x2b85a9[_0xaa6b('0x1d')][_0xaa6b('0x1f')]||null:null})['then'](function(_0x30f568){if(_0x30f568){return _0x30f568[_0xaa6b('0x24')](_0x2b85a9[_0xaa6b('0x25')][_0xaa6b('0x26')],_[_0xaa6b('0x27')](_0x2b85a9[_0xaa6b('0x25')],['ids','id'])||{});}})[_0xaa6b('0x28')](function(_0x283804){logger[_0xaa6b('0x12')]('AddTags',_0x2b85a9);logger[_0xaa6b('0x15')](_0xaa6b('0x29'),_0x2b85a9,JSON[_0xaa6b('0x17')](_0x283804));_0x37ec69(_0x283804);})['catch'](function(_0xbf2f6d){logger[_0xaa6b('0x18')](_0xaa6b('0x29'),_0xbf2f6d['message'],_0x2b85a9);_0x1e1bc0(_this[_0xaa6b('0x18')](0x1f4,_0xbf2f6d[_0xaa6b('0x19')]));});});}; \ No newline at end of file +var _0x74b7=['code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3bbe57,_0x12e0c6){var _0x22aad4=function(_0x2d7496){while(--_0x2d7496){_0x3bbe57['push'](_0x3bbe57['shift']());}};_0x22aad4(++_0x12e0c6);}(_0x74b7,0x198));var _0x774b=function(_0x3df26c,_0x4255ff){_0x3df26c=_0x3df26c-0x0;var _0x2f81b7=_0x74b7[_0x3df26c];return _0x2f81b7;};'use strict';var _=require(_0x774b('0x0'));var util=require('util');var moment=require(_0x774b('0x1'));var BPromise=require(_0x774b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x774b('0x3'));var db=require(_0x774b('0x4'))['db'];var utils=require(_0x774b('0x5'));var logger=require('../../config/logger')(_0x774b('0x6'));var config=require(_0x774b('0x7'));var jayson=require(_0x774b('0x8'));var client=jayson[_0x774b('0x9')][_0x774b('0xa')]({'port':0x232a});config[_0x774b('0xb')]=_[_0x774b('0xc')](config['redis'],{'host':_0x774b('0xd'),'port':0x18eb});var socket=require(_0x774b('0xe'))(new Redis(config['redis']));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x19529b,_0x5aeed4,_0x2dc7f3){return new BPromise(function(_0x35faae,_0xf52b48){return client['request'](_0x19529b,_0x2dc7f3)['then'](function(_0xeec6b3){logger[_0x774b('0xf')](_0x774b('0x10'),_0x5aeed4,_0x774b('0x11'));logger[_0x774b('0x12')](_0x774b('0x13'),_0x5aeed4,_0x774b('0x11'),JSON[_0x774b('0x14')](_0xeec6b3));if(_0xeec6b3[_0x774b('0x15')]){if(_0xeec6b3[_0x774b('0x15')][_0x774b('0x16')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x5aeed4,_0xeec6b3[_0x774b('0x15')][_0x774b('0x17')]);return _0xf52b48(_0xeec6b3[_0x774b('0x15')]['message']);}logger[_0x774b('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x5aeed4,_0xeec6b3[_0x774b('0x15')]['message']);return _0x35faae(_0xeec6b3[_0x774b('0x15')][_0x774b('0x17')]);}else{logger[_0x774b('0xf')](_0x774b('0x10'),_0x5aeed4,_0x774b('0x11'));_0x35faae(_0xeec6b3[_0x774b('0x18')][_0x774b('0x17')]);}})[_0x774b('0x19')](function(_0x3aa54f){logger['error'](_0x774b('0x10'),_0x5aeed4,_0x3aa54f);_0xf52b48(_0x3aa54f);});});}exports[_0x774b('0x1a')]=function(_0x52268f){var _0x56dd31=this;return new Promise(function(_0x3cbeda,_0x5098db){return db[_0x774b('0x1b')][_0x774b('0x1c')](_0x52268f[_0x774b('0x1d')],{'raw':_0x52268f[_0x774b('0x1e')]?_0x52268f[_0x774b('0x1e')][_0x774b('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52268f[_0x774b('0x1e')]?_0x52268f['options'][_0x774b('0x20')]||null:null,'attributes':_0x52268f[_0x774b('0x1e')]?_0x52268f[_0x774b('0x1e')][_0x774b('0x21')]||null:null,'limit':_0x52268f[_0x774b('0x1e')]?_0x52268f['options'][_0x774b('0x22')]||null:null})[_0x774b('0x23')](function(_0xc463ce){logger['info'](_0x774b('0x1a'),_0x52268f);logger[_0x774b('0x12')](_0x774b('0x1a'),_0x52268f,JSON[_0x774b('0x14')](_0xc463ce));_0x3cbeda(_0xc463ce);})['catch'](function(_0x56c378){logger['error'](_0x774b('0x1a'),_0x56c378['message'],_0x52268f);_0x5098db(_0x56dd31['error'](0x1f4,_0x56c378[_0x774b('0x17')]));});});};exports[_0x774b('0x24')]=function(_0x376eb1){return new Promise(function(_0x5aa3a8,_0x26ad28){return db[_0x774b('0x1b')][_0x774b('0x25')]({'where':_0x376eb1[_0x774b('0x1e')]?_0x376eb1[_0x774b('0x1e')][_0x774b('0x20')]||null:null})['then'](function(_0x11cbc4){if(_0x11cbc4){return _0x11cbc4[_0x774b('0x26')](_0x376eb1[_0x774b('0x1d')][_0x774b('0x27')],_[_0x774b('0x28')](_0x376eb1[_0x774b('0x1d')],[_0x774b('0x27'),'id'])||{});}})[_0x774b('0x29')](function(_0x5ac36c){logger[_0x774b('0xf')](_0x774b('0x2a'),_0x376eb1);logger[_0x774b('0x12')]('AddTags',_0x376eb1,JSON[_0x774b('0x14')](_0x5ac36c));_0x5aa3a8(_0x5ac36c);})[_0x774b('0x19')](function(_0x3cd62c){logger[_0x774b('0x15')](_0x774b('0x2a'),_0x3cd62c['message'],_0x376eb1);_0x26ad28(_this[_0x774b('0x15')](0x1f4,_0x3cd62c[_0x774b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 029c58e..87e6b80 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 _0x3881=['./chatInteraction.events','emit','register','length','chatInteraction:'];(function(_0xa3f6dc,_0x17cb77){var _0x25a810=function(_0xc485d2){while(--_0xc485d2){_0xa3f6dc['push'](_0xa3f6dc['shift']());}};_0x25a810(++_0x17cb77);}(_0x3881,0xe6));var _0x1388=function(_0x5b1036,_0x40f801){_0x5b1036=_0x5b1036-0x0;var _0x41f932=_0x3881[_0x5b1036];return _0x41f932;};'use strict';var ChatInteractionEvents=require(_0x1388('0x0'));var events=['save','remove','update'];function createListener(_0x2386fa,_0x1c52f7){return function(_0x1ec3cf){_0x1c52f7[_0x1388('0x1')](_0x2386fa,_0x1ec3cf);};}function removeListener(_0x1461c2,_0x3191b0){return function(){ChatInteractionEvents['removeListener'](_0x1461c2,_0x3191b0);};}exports[_0x1388('0x2')]=function(_0x3ea438){for(var _0x231bf0=0x0,_0x573ec0=events[_0x1388('0x3')];_0x231bf0<_0x573ec0;_0x231bf0++){var _0x2ef8ad=events[_0x231bf0];var _0x34cf91=createListener(_0x1388('0x4')+_0x2ef8ad,_0x3ea438);ChatInteractionEvents['on'](_0x2ef8ad,_0x34cf91);}}; \ No newline at end of file +var _0x4e56=['emit','removeListener','register','length','./chatInteraction.events','save','remove'];(function(_0x38d044,_0x310524){var _0x4f8779=function(_0x37aa5b){while(--_0x37aa5b){_0x38d044['push'](_0x38d044['shift']());}};_0x4f8779(++_0x310524);}(_0x4e56,0x89));var _0x64e5=function(_0x1b0a89,_0x5f4f8f){_0x1b0a89=_0x1b0a89-0x0;var _0x3800f0=_0x4e56[_0x1b0a89];return _0x3800f0;};'use strict';var ChatInteractionEvents=require(_0x64e5('0x0'));var events=[_0x64e5('0x1'),_0x64e5('0x2'),'update'];function createListener(_0xde95da,_0x44ea33){return function(_0x3d272c){_0x44ea33[_0x64e5('0x3')](_0xde95da,_0x3d272c);};}function removeListener(_0x10cebc,_0x4d7d91){return function(){ChatInteractionEvents[_0x64e5('0x4')](_0x10cebc,_0x4d7d91);};}exports[_0x64e5('0x5')]=function(_0x3b322b){for(var _0x2d37c7=0x0,_0x59ceeb=events[_0x64e5('0x6')];_0x2d37c7<_0x59ceeb;_0x2d37c7++){var _0x38c508=events[_0x2d37c7];var _0x21e67e=createListener('chatInteraction:'+_0x38c508,_0x3b322b);ChatInteractionEvents['on'](_0x38c508,_0x21e67e);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 7cfd916..ba53f73 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 _0xfb5d=['download','post','/:id/vidaoo','diskStorage','join','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','attachmentUpload','addMessage','/:id/tags','tracked','addTags','put','chat','update','/:id/custom_update','customUpdate','/:id/close','close','delete','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','/:id/download'];(function(_0x581432,_0x4fa5bf){var _0x342f1c=function(_0x11b85e){while(--_0x11b85e){_0x581432['push'](_0x581432['shift']());}};_0x342f1c(++_0x4fa5bf);}(_0xfb5d,0x193));var _0xdfb5=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xfb5d[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0xdfb5('0x0'));var util=require('util');var path=require(_0xdfb5('0x1'));var timeout=require(_0xdfb5('0x2'));var express=require(_0xdfb5('0x3'));var router=express[_0xdfb5('0x4')]();var fs_extra=require(_0xdfb5('0x5'));var auth=require(_0xdfb5('0x6'));var interaction=require(_0xdfb5('0x7'));var config=require(_0xdfb5('0x8'));var controller=require('./chatInteraction.controller');router['get']('/',auth[_0xdfb5('0x9')](),controller[_0xdfb5('0xa')]);router[_0xdfb5('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xdfb5('0xc')]);router[_0xdfb5('0xb')](_0xdfb5('0xd'),auth[_0xdfb5('0xe')](),controller[_0xdfb5('0xf')]);router[_0xdfb5('0xb')]('/:id/attachment_download',auth[_0xdfb5('0xe')](),controller[_0xdfb5('0x10')]);router[_0xdfb5('0xb')](_0xdfb5('0x11'),auth['isAuthenticated'](),controller[_0xdfb5('0x12')]);router[_0xdfb5('0xb')]('/:id/my_messages',auth[_0xdfb5('0xe')](),controller['getMyMessages']);router[_0xdfb5('0xb')](_0xdfb5('0x13'),auth[_0xdfb5('0x9')](),controller[_0xdfb5('0x14')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xdfb5('0x15')](_0xdfb5('0x16'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xdfb5('0x17')]({'destination':function(_0x18331c,_0x4d1858,_0xa14c53){_0xa14c53(null,path[_0xdfb5('0x18')](config['root'],_0xdfb5('0x19')));},'filename':function(_0x2b6b5c,_0x3a7081,_0x5d92ba){_0x5d92ba(null,util[_0xdfb5('0x1a')](_0xdfb5('0x1b'),Date[_0xdfb5('0x1c')](),_0x3a7081[_0xdfb5('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xdfb5('0x15')](_0xdfb5('0x1e'),upload['single']('file'),controller[_0xdfb5('0x1f')]);router[_0xdfb5('0x15')](_0xdfb5('0x11'),auth[_0xdfb5('0xe')](),controller[_0xdfb5('0x20')]);router[_0xdfb5('0x15')](_0xdfb5('0x21'),auth[_0xdfb5('0x9')](),interaction[_0xdfb5('0x22')]('chat','chatinteraction:addtags'),controller[_0xdfb5('0x23')]);router[_0xdfb5('0x24')](_0xdfb5('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0xdfb5('0x25'),'chatinteraction:update'),controller[_0xdfb5('0x26')]);router[_0xdfb5('0x24')](_0xdfb5('0x27'),controller[_0xdfb5('0x28')]);router[_0xdfb5('0x24')]('/:id/abandon',auth[_0xdfb5('0xe')](),controller['abandon']);router['put'](_0xdfb5('0x29'),controller[_0xdfb5('0x2a')]);router[_0xdfb5('0x2b')](_0xdfb5('0xd'),auth['isAuthenticated'](),interaction[_0xdfb5('0x22')](_0xdfb5('0x25'),'chatinteraction:destroy'),controller[_0xdfb5('0x2c')]);router[_0xdfb5('0x2b')]('/:id/tags',auth[_0xdfb5('0x9')](),controller[_0xdfb5('0x2d')]);module[_0xdfb5('0x2e')]=router; \ No newline at end of file +var _0xe841=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','join','root','server/files/attachments/','format','%s-%s','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','chatinteraction:update','update','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','destroy','exports','multer','path','connect-timeout'];(function(_0x32181b,_0x1ef736){var _0x12af6b=function(_0x3138e4){while(--_0x3138e4){_0x32181b['push'](_0x32181b['shift']());}};_0x12af6b(++_0x1ef736);}(_0xe841,0x69));var _0x1e84=function(_0x54dfa7,_0x10987c){_0x54dfa7=_0x54dfa7-0x0;var _0x3caab0=_0xe841[_0x54dfa7];return _0x3caab0;};'use strict';var multer=require(_0x1e84('0x0'));var util=require('util');var path=require(_0x1e84('0x1'));var timeout=require(_0x1e84('0x2'));var express=require('express');var router=express[_0x1e84('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1e84('0x4'));var interaction=require(_0x1e84('0x5'));var config=require(_0x1e84('0x6'));var controller=require(_0x1e84('0x7'));router['get']('/',auth[_0x1e84('0x8')](),controller[_0x1e84('0x9')]);router[_0x1e84('0xa')](_0x1e84('0xb'),auth['isAuthenticated'](),controller[_0x1e84('0xc')]);router['get'](_0x1e84('0xd'),auth['isChatInteractionAuthorized'](),controller[_0x1e84('0xe')]);router[_0x1e84('0xa')](_0x1e84('0xf'),auth[_0x1e84('0x10')](),controller[_0x1e84('0x11')]);router[_0x1e84('0xa')](_0x1e84('0x12'),auth[_0x1e84('0x8')](),controller[_0x1e84('0x13')]);router['get'](_0x1e84('0x14'),auth[_0x1e84('0x10')](),controller[_0x1e84('0x15')]);router['get'](_0x1e84('0x16'),auth[_0x1e84('0x8')](),controller[_0x1e84('0x17')]);router[_0x1e84('0x18')]('/',auth[_0x1e84('0x8')](),controller[_0x1e84('0x19')]);router[_0x1e84('0x18')]('/:id/vidaoo',auth[_0x1e84('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1f8ed0,_0x2e05bb,_0x21d717){_0x21d717(null,path[_0x1e84('0x1a')](config[_0x1e84('0x1b')],_0x1e84('0x1c')));},'filename':function(_0x1560b6,_0x118056,_0x25c79d){_0x25c79d(null,util[_0x1e84('0x1d')](_0x1e84('0x1e'),Date['now'](),_0x118056['originalname'][_0x1e84('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x1e84('0x18')](_0x1e84('0x20'),upload[_0x1e84('0x21')](_0x1e84('0x22')),controller[_0x1e84('0x23')]);router[_0x1e84('0x18')](_0x1e84('0x12'),auth['isChatInteractionAuthorized'](),controller[_0x1e84('0x24')]);router[_0x1e84('0x18')](_0x1e84('0x25'),auth['isAuthenticated'](),interaction[_0x1e84('0x26')](_0x1e84('0x27'),_0x1e84('0x28')),controller[_0x1e84('0x29')]);router['put'](_0x1e84('0xd'),auth[_0x1e84('0x8')](),interaction[_0x1e84('0x26')](_0x1e84('0x27'),_0x1e84('0x2a')),controller[_0x1e84('0x2b')]);router[_0x1e84('0x2c')](_0x1e84('0x2d'),controller[_0x1e84('0x2e')]);router[_0x1e84('0x2c')](_0x1e84('0x2f'),auth[_0x1e84('0x10')](),controller[_0x1e84('0x30')]);router[_0x1e84('0x2c')](_0x1e84('0x31'),controller['close']);router[_0x1e84('0x32')](_0x1e84('0xd'),auth[_0x1e84('0x8')](),interaction[_0x1e84('0x26')](_0x1e84('0x27'),_0x1e84('0x33')),controller[_0x1e84('0x34')]);router[_0x1e84('0x32')](_0x1e84('0x25'),auth[_0x1e84('0x8')](),controller['removeTags']);module[_0x1e84('0x35')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index e4ccc1b..6ad4bba 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 _0x873d=['exports','TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x25548b,_0x2bc1b9){var _0x5de8b0=function(_0xe2314d){while(--_0xe2314d){_0x25548b['push'](_0x25548b['shift']());}};_0x5de8b0(++_0x2bc1b9);}(_0x873d,0x119));var _0xd873=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x873d[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0xd873('0x0'));module[_0xd873('0x1')]={'body':{'type':Sequelize[_0xd873('0x2')](_0xd873('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xd873('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xd873('0x5')]}}; \ No newline at end of file +var _0x187b=['medium','INTEGER','sequelize','exports'];(function(_0x417955,_0x4ed8c8){var _0x3a94ef=function(_0xa3a38d){while(--_0xa3a38d){_0x417955['push'](_0x417955['shift']());}};_0x3a94ef(++_0x4ed8c8);}(_0x187b,0xee));var _0xb187=function(_0x2939a5,_0x51374d){_0x2939a5=_0x2939a5-0x0;var _0x650be9=_0x187b[_0x2939a5];return _0x650be9;};'use strict';var Sequelize=require(_0xb187('0x0'));module[_0xb187('0x1')]={'body':{'type':Sequelize['TEXT'](_0xb187('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xb187('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index f649e53..f04086b 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 _0x46bf=['jsforce','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','./chatInternalMessage.socket','register','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range','apply','save','then','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','count','includeAll','include','rows','show','params','find','catch','create','body','update','destroy','describe','get','messages','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','agent','user','fullname','role','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','resourceId','push','createdAt','ToId','read','-createdAt','all','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto'];(function(_0x503899,_0x4989e8){var _0x3f5e29=function(_0x552e09){while(--_0x552e09){_0x503899['push'](_0x503899['shift']());}};_0x3f5e29(++_0x4989e8);}(_0x46bf,0xd7));var _0xf46b=function(_0xf6e75d,_0xc70967){_0xf6e75d=_0xf6e75d-0x0;var _0x27514d=_0x46bf[_0xf6e75d];return _0x27514d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf46b('0x0'));var zipdir=require(_0xf46b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf46b('0x2'));var moment=require(_0xf46b('0x3'));var BPromise=require(_0xf46b('0x4'));var Mustache=require(_0xf46b('0x5'));var util=require('util');var path=require('path');var sox=require(_0xf46b('0x6'));var csv=require(_0xf46b('0x7'));var ejs=require(_0xf46b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf46b('0x9'));var crypto=require(_0xf46b('0xa'));var jsforce=require(_0xf46b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf46b('0x7'));var querystring=require('querystring');var Papa=require(_0xf46b('0xc'));var Redis=require('ioredis');var authService=require(_0xf46b('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xf46b('0xe'));var hardwareService=require(_0xf46b('0xf'));var logger=require(_0xf46b('0x10'))(_0xf46b('0x11'));var utils=require(_0xf46b('0x12'));var config=require(_0xf46b('0x13'));var licenseUtil=require(_0xf46b('0x14'));var db=require(_0xf46b('0x15'))['db'];config[_0xf46b('0x16')]=_[_0xf46b('0x17')](config[_0xf46b('0x16')],{'host':_0xf46b('0x18'),'port':0x18eb});var socket=require(_0xf46b('0x19'))(new Redis(config[_0xf46b('0x16')]));require(_0xf46b('0x1a'))[_0xf46b('0x1b')](socket);function respondWithStatusCode(_0x4572c7,_0x456c7d){_0x456c7d=_0x456c7d||0xcc;return function(_0x1214e2){if(_0x1214e2){return _0x4572c7[_0xf46b('0x1c')](_0x456c7d);}return _0x4572c7[_0xf46b('0x1d')](_0x456c7d)[_0xf46b('0x1e')]();};}function respondWithResult(_0x25490c,_0x549ba2){_0x549ba2=_0x549ba2||0xc8;return function(_0x27e8eb){if(_0x27e8eb){return _0x25490c[_0xf46b('0x1d')](_0x549ba2)[_0xf46b('0x1f')](_0x27e8eb);}};}function respondWithFilteredResult(_0x15861c,_0x258e9d){return function(_0x2d5e0d){if(_0x2d5e0d){var _0x4eac38=typeof _0x258e9d['offset']===_0xf46b('0x20')&&typeof _0x258e9d['limit']===_0xf46b('0x20');var _0x3e6c92=_0x2d5e0d['count'];var _0x160a74=_0x4eac38?0x0:_0x258e9d[_0xf46b('0x21')];var _0x2427c1=_0x4eac38?_0x2d5e0d['count']:_0x258e9d[_0xf46b('0x21')]+_0x258e9d[_0xf46b('0x22')];var _0x47c667;if(_0x2427c1>=_0x3e6c92){_0x2427c1=_0x3e6c92;_0x47c667=0xc8;}else{_0x47c667=0xce;}_0x15861c[_0xf46b('0x1d')](_0x47c667);return _0x15861c[_0xf46b('0x23')](_0xf46b('0x24'),_0x160a74+'-'+_0x2427c1+'/'+_0x3e6c92)[_0xf46b('0x1f')](_0x2d5e0d);}return null;};}function patchUpdates(_0x3ac252){return function(_0x239618){try{jsonpatch[_0xf46b('0x25')](_0x239618,_0x3ac252,!![]);}catch(_0x276ee9){return BPromise['reject'](_0x276ee9);}return _0x239618[_0xf46b('0x26')]();};}function saveUpdates(_0x6be434,_0x632ac8){return function(_0x46e4a1){if(_0x46e4a1){return _0x46e4a1['update'](_0x6be434)[_0xf46b('0x27')](function(_0x3c0615){return _0x3c0615;});}return null;};}function removeEntity(_0x50f90c,_0x221d74){return function(_0x5c00a1){if(_0x5c00a1){return _0x5c00a1['destroy']()[_0xf46b('0x27')](function(){_0x50f90c['status'](0xcc)[_0xf46b('0x1e')]();});}};}function handleEntityNotFound(_0x2f7f1d,_0x4620ef){return function(_0x259bb6){if(!_0x259bb6){_0x2f7f1d[_0xf46b('0x1c')](0x194);}return _0x259bb6;};}function handleError(_0x51aba5,_0x3d9c05){_0x3d9c05=_0x3d9c05||0x1f4;return function(_0x570870){logger['error'](_0x570870[_0xf46b('0x28')]);if(_0x570870[_0xf46b('0x29')]){delete _0x570870[_0xf46b('0x29')];}_0x51aba5['status'](_0x3d9c05)[_0xf46b('0x2a')](_0x570870);};}exports[_0xf46b('0x2b')]=function(_0x300d63,_0x118916){var _0x47dfdd={},_0x324f9c={},_0x1677cb={'count':0x0,'rows':[]};var _0x44fe89=_[_0xf46b('0x2c')](db[_0xf46b('0x2d')][_0xf46b('0x2e')],function(_0x3785b9){return{'name':_0x3785b9[_0xf46b('0x2f')],'type':_0x3785b9['type'][_0xf46b('0x30')]};});_0x324f9c['model']=_[_0xf46b('0x2c')](_0x44fe89,'name');_0x324f9c['query']=_[_0xf46b('0x31')](_0x300d63[_0xf46b('0x32')]);_0x324f9c['filters']=_[_0xf46b('0x33')](_0x324f9c[_0xf46b('0x34')],_0x324f9c[_0xf46b('0x32')]);_0x47dfdd[_0xf46b('0x35')]=_[_0xf46b('0x33')](_0x324f9c[_0xf46b('0x34')],qs[_0xf46b('0x36')](_0x300d63[_0xf46b('0x32')]['fields']));_0x47dfdd[_0xf46b('0x35')]=_0x47dfdd[_0xf46b('0x35')][_0xf46b('0x37')]?_0x47dfdd[_0xf46b('0x35')]:_0x324f9c[_0xf46b('0x34')];if(!_0x300d63[_0xf46b('0x32')][_0xf46b('0x38')](_0xf46b('0x39'))){_0x47dfdd['limit']=qs[_0xf46b('0x22')](_0x300d63[_0xf46b('0x32')]['limit']);_0x47dfdd[_0xf46b('0x21')]=qs[_0xf46b('0x21')](_0x300d63[_0xf46b('0x32')][_0xf46b('0x21')]);}_0x47dfdd[_0xf46b('0x3a')]=qs[_0xf46b('0x3b')](_0x300d63['query'][_0xf46b('0x3b')]);_0x47dfdd[_0xf46b('0x3c')]=qs[_0xf46b('0x3d')](_['pick'](_0x300d63[_0xf46b('0x32')],_0x324f9c['filters']),_0x44fe89);if(_0x300d63[_0xf46b('0x32')][_0xf46b('0x3e')]){_0x47dfdd[_0xf46b('0x3c')]=_[_0xf46b('0x3f')](_0x47dfdd[_0xf46b('0x3c')],{'$or':_[_0xf46b('0x2c')](_0x44fe89,function(_0x23687f){if(_0x23687f[_0xf46b('0x40')]!==_0xf46b('0x41')){var _0x2fdf80={};_0x2fdf80[_0x23687f[_0xf46b('0x29')]]={'$like':'%'+_0x300d63[_0xf46b('0x32')][_0xf46b('0x3e')]+'%'};return _0x2fdf80;}})});}_0x47dfdd=_['merge']({},_0x47dfdd,_0x300d63[_0xf46b('0x42')]);var _0x1c99a5={'where':_0x47dfdd['where']};return db[_0xf46b('0x2d')][_0xf46b('0x43')](_0x1c99a5)[_0xf46b('0x27')](function(_0x70bf44){_0x1677cb[_0xf46b('0x43')]=_0x70bf44;if(_0x300d63[_0xf46b('0x32')][_0xf46b('0x44')]){_0x47dfdd[_0xf46b('0x45')]=[{'all':!![]}];}return db[_0xf46b('0x2d')]['findAll'](_0x47dfdd);})['then'](function(_0x32ffdf){_0x1677cb[_0xf46b('0x46')]=_0x32ffdf;return _0x1677cb;})[_0xf46b('0x27')](respondWithFilteredResult(_0x118916,_0x47dfdd))['catch'](handleError(_0x118916,null));};exports[_0xf46b('0x47')]=function(_0x58e41a,_0x5c741e){var _0x1fbb42={'raw':!![],'where':{'id':_0x58e41a[_0xf46b('0x48')]['id']}},_0x4304b0={};_0x4304b0['model']=_['keys'](db[_0xf46b('0x2d')][_0xf46b('0x2e')]);_0x4304b0[_0xf46b('0x32')]=_['keys'](_0x58e41a[_0xf46b('0x32')]);_0x4304b0['filters']=_[_0xf46b('0x33')](_0x4304b0['model'],_0x4304b0[_0xf46b('0x32')]);_0x1fbb42['attributes']=_[_0xf46b('0x33')](_0x4304b0['model'],qs[_0xf46b('0x36')](_0x58e41a['query'][_0xf46b('0x36')]));_0x1fbb42[_0xf46b('0x35')]=_0x1fbb42[_0xf46b('0x35')][_0xf46b('0x37')]?_0x1fbb42[_0xf46b('0x35')]:_0x4304b0[_0xf46b('0x34')];if(_0x58e41a[_0xf46b('0x32')][_0xf46b('0x44')]){_0x1fbb42[_0xf46b('0x45')]=[{'all':!![]}];}_0x1fbb42=_[_0xf46b('0x3f')]({},_0x1fbb42,_0x58e41a[_0xf46b('0x42')]);return db[_0xf46b('0x2d')][_0xf46b('0x49')](_0x1fbb42)[_0xf46b('0x27')](handleEntityNotFound(_0x5c741e,null))['then'](respondWithResult(_0x5c741e,null))[_0xf46b('0x4a')](handleError(_0x5c741e,null));};exports[_0xf46b('0x4b')]=function(_0x53ec80,_0x12b227){return db['ChatInternalMessage'][_0xf46b('0x4b')](_0x53ec80[_0xf46b('0x4c')],{})[_0xf46b('0x27')](respondWithResult(_0x12b227,0xc9))[_0xf46b('0x4a')](handleError(_0x12b227,null));};exports[_0xf46b('0x4d')]=function(_0x3f5941,_0x257f7a){if(_0x3f5941['body']['id']){delete _0x3f5941[_0xf46b('0x4c')]['id'];}return db[_0xf46b('0x2d')][_0xf46b('0x49')]({'where':{'id':_0x3f5941[_0xf46b('0x48')]['id']}})[_0xf46b('0x27')](handleEntityNotFound(_0x257f7a,null))[_0xf46b('0x27')](saveUpdates(_0x3f5941[_0xf46b('0x4c')],null))['then'](respondWithResult(_0x257f7a,null))[_0xf46b('0x4a')](handleError(_0x257f7a,null));};exports[_0xf46b('0x4e')]=function(_0xa27107,_0x3d501f){return db[_0xf46b('0x2d')]['find']({'where':{'id':_0xa27107[_0xf46b('0x48')]['id']}})[_0xf46b('0x27')](handleEntityNotFound(_0x3d501f,null))[_0xf46b('0x27')](removeEntity(_0x3d501f,null))[_0xf46b('0x4a')](handleError(_0x3d501f,null));};exports[_0xf46b('0x4f')]=function(_0x3666cc,_0x274e5a){return db[_0xf46b('0x2d')][_0xf46b('0x4f')]()['then'](respondWithResult(_0x274e5a,null))[_0xf46b('0x4a')](handleError(_0x274e5a,null));};function wrapUser(_0xcb4f03){return function(_0x45aaf3){var _0x161564=_0xcb4f03[_0xf46b('0x50')]({'plain':!![]});_0x161564[_0xf46b('0x51')]=[];if(_0x45aaf3){_0x161564[_0xf46b('0x52')]=_0x45aaf3['createdAt'];_0x161564['lastMessage']=_0x45aaf3;}else{_0x161564['lastMessageAt']=moment(0x0)[_0xf46b('0x53')](_0xf46b('0x54'));_0x161564[_0xf46b('0x55')]={};}return _0x161564;};}exports[_0xf46b('0x56')]=function(_0x9c1391,_0x41744f,_0x4de4e2){var _0x103d0b=[];return db[_0xf46b('0x57')]['findAll']({'where':{'role':[_0xf46b('0x58'),'admin',_0xf46b('0x59')]},'attributes':['id',_0xf46b('0x5a'),_0xf46b('0x29'),_0xf46b('0x5b'),'userpic',_0xf46b('0x5c'),_0xf46b('0x5d'),_0xf46b('0x5e'),_0xf46b('0x5f'),_0xf46b('0x60')],'order':qs[_0xf46b('0x3b')](_0xf46b('0x61')),'include':[{'model':db[_0xf46b('0x62')],'as':_0xf46b('0x63'),'attributes':['id',_0xf46b('0x29'),_0xf46b('0x40')],'through':{'attributes':[]}}]})[_0xf46b('0x27')](function(_0x41a50f){if(_0x41a50f){var _0x1a7a49=_0x9c1391[_0xf46b('0x59')]['get']({'plain':!![]});if(!_0x1a7a49)throw new Error(_0xf46b('0x64'));if(_0x1a7a49[_0xf46b('0x5b')]===_0xf46b('0x59')){return db[_0xf46b('0x65')][_0xf46b('0x49')]({'where':{'name':_0xf46b('0x66'),'userProfileId':_0x1a7a49[_0xf46b('0x67')]},'raw':!![]})['then'](function(_0x1e9528){if(_0x1e9528){if(_0x1e9528[_0xf46b('0x68')]===0x0){return db[_0xf46b('0x69')]['findAll']({'where':{'sectionId':_0x1e9528['id']},'raw':!![]})[_0xf46b('0x27')](function(_0x5bb643){var _0x46a395=[];if(_['isEmpty'](_0x5bb643)){_0x46a395=_['filter'](_0x41a50f,function(_0x44b31a){if(_0x44b31a[_0xf46b('0x5b')]!==_0xf46b('0x58')){return _0x44b31a;}});return _0x46a395;}else{for(var _0x3d1424=0x0;_0x3d1424<_0x41a50f[_0xf46b('0x37')];_0x3d1424++){var _0x52a0e6=_0x41a50f[_0x3d1424];if(_0x52a0e6[_0xf46b('0x5b')]===_0xf46b('0x58')){var _0x1eab76=_[_0xf46b('0x49')](_0x5bb643,function(_0x36c07d){return _0x36c07d[_0xf46b('0x6a')]===_0x52a0e6['id'];});if(_0x1eab76)_0x46a395['push'](_0x52a0e6);}else{_0x46a395[_0xf46b('0x6b')](_0x52a0e6);}}return _0x46a395;}});}else{return _0x41a50f;}}else{var _0x27f967=_['filter'](_0x41a50f,function(_0x3e741d){if(_0x3e741d[_0xf46b('0x5b')]!=='agent'){return _0x3e741d;}});return _0x27f967;}});}else{return _0x41a50f;}}})['then'](function(_0x41f3ee){var _0x16aefb=[];if(_0x41f3ee){_0x103d0b=_0x41f3ee;for(var _0x5ba9ab=0x0;_0x5ba9ab<_0x41f3ee[_0xf46b('0x37')];_0x5ba9ab+=0x1){_0x103d0b[_0x5ba9ab]['messages']=[];_0x16aefb[_0xf46b('0x6b')](db['ChatInternalMessage'][_0xf46b('0x49')]({'where':{'FromId':[_0x9c1391['user']['id'],_0x41f3ee[_0x5ba9ab]['id']],'ToId':[_0x9c1391[_0xf46b('0x59')]['id'],_0x41f3ee[_0x5ba9ab]['id']],'ChatGroupId':null},'attributes':['id',_0xf46b('0x6c'),'FromId',_0xf46b('0x6d'),_0xf46b('0x6e'),_0xf46b('0x4c')],'order':qs[_0xf46b('0x3b')](_0xf46b('0x6f')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xf46b('0x27')](wrapUser(_0x41f3ee[_0x5ba9ab])));}return BPromise[_0xf46b('0x70')](_0x16aefb);}return[];})['then'](function(_0xa923a1){return{'rows':_0xa923a1,'count':_0xa923a1[_0xf46b('0x37')]};})[_0xf46b('0x27')](respondWithResult(_0x41744f,null))['catch'](handleError(_0x41744f,null));}; \ No newline at end of file +var _0xd2c9=['UserProfileSection','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','-createdAt','all','eml-format','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatInternalMessage','includeAll','include','findAll','rows','catch','length','find','create','body','params','destroy','describe','get','messages','lastMessageAt','createdAt','lastMessage','getUsers','User','agent','user','role','userpic','internal','online','lastLoginAt','-online','VoiceQueue','VoiceQueues'];(function(_0x3399d6,_0xad213a){var _0x1378e4=function(_0x566d97){while(--_0x566d97){_0x3399d6['push'](_0x3399d6['shift']());}};_0x1378e4(++_0xad213a);}(_0xd2c9,0x6f));var _0x9d2c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2c9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9d2c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9d2c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9d2c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9d2c('0x3'));var util=require(_0x9d2c('0x4'));var path=require('path');var sox=require(_0x9d2c('0x5'));var csv=require(_0x9d2c('0x6'));var ejs=require(_0x9d2c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d2c('0x8'));var squel=require(_0x9d2c('0x9'));var crypto=require(_0x9d2c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9d2c('0xb'));var toCsv=require(_0x9d2c('0x6'));var querystring=require('querystring');var Papa=require(_0x9d2c('0xc'));var Redis=require(_0x9d2c('0xd'));var authService=require(_0x9d2c('0xe'));var qs=require(_0x9d2c('0xf'));var as=require(_0x9d2c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9d2c('0x11'));var utils=require(_0x9d2c('0x12'));var config=require(_0x9d2c('0x13'));var licenseUtil=require(_0x9d2c('0x14'));var db=require('../../mysqldb')['db'];config[_0x9d2c('0x15')]=_['defaults'](config['redis'],{'host':_0x9d2c('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9d2c('0x15')]));require(_0x9d2c('0x17'))[_0x9d2c('0x18')](socket);function respondWithStatusCode(_0x179106,_0x1b535a){_0x1b535a=_0x1b535a||0xcc;return function(_0x594c78){if(_0x594c78){return _0x179106[_0x9d2c('0x19')](_0x1b535a);}return _0x179106[_0x9d2c('0x1a')](_0x1b535a)[_0x9d2c('0x1b')]();};}function respondWithResult(_0x38cdd0,_0x21a169){_0x21a169=_0x21a169||0xc8;return function(_0x54844c){if(_0x54844c){return _0x38cdd0[_0x9d2c('0x1a')](_0x21a169)[_0x9d2c('0x1c')](_0x54844c);}};}function respondWithFilteredResult(_0x17b2bc,_0x439e56){return function(_0x413e55){if(_0x413e55){var _0x292a7d=typeof _0x439e56[_0x9d2c('0x1d')]===_0x9d2c('0x1e')&&typeof _0x439e56[_0x9d2c('0x1f')]===_0x9d2c('0x1e');var _0x596cea=_0x413e55['count'];var _0x2a58be=_0x292a7d?0x0:_0x439e56['offset'];var _0x5d7e11=_0x292a7d?_0x413e55[_0x9d2c('0x20')]:_0x439e56[_0x9d2c('0x1d')]+_0x439e56['limit'];var _0x4f8567;if(_0x5d7e11>=_0x596cea){_0x5d7e11=_0x596cea;_0x4f8567=0xc8;}else{_0x4f8567=0xce;}_0x17b2bc[_0x9d2c('0x1a')](_0x4f8567);return _0x17b2bc[_0x9d2c('0x21')](_0x9d2c('0x22'),_0x2a58be+'-'+_0x5d7e11+'/'+_0x596cea)[_0x9d2c('0x1c')](_0x413e55);}return null;};}function patchUpdates(_0x416a86){return function(_0x5d3c3c){try{jsonpatch[_0x9d2c('0x23')](_0x5d3c3c,_0x416a86,!![]);}catch(_0x433ffa){return BPromise['reject'](_0x433ffa);}return _0x5d3c3c[_0x9d2c('0x24')]();};}function saveUpdates(_0x3a8fab,_0x1b5257){return function(_0x54a49b){if(_0x54a49b){return _0x54a49b[_0x9d2c('0x25')](_0x3a8fab)[_0x9d2c('0x26')](function(_0x5c31c7){return _0x5c31c7;});}return null;};}function removeEntity(_0x22066a,_0x34cb28){return function(_0x47c88d){if(_0x47c88d){return _0x47c88d['destroy']()[_0x9d2c('0x26')](function(){_0x22066a[_0x9d2c('0x1a')](0xcc)[_0x9d2c('0x1b')]();});}};}function handleEntityNotFound(_0x1da78f,_0x531215){return function(_0x354171){if(!_0x354171){_0x1da78f[_0x9d2c('0x19')](0x194);}return _0x354171;};}function handleError(_0x8057f6,_0x480c9a){_0x480c9a=_0x480c9a||0x1f4;return function(_0x1440fa){logger[_0x9d2c('0x27')](_0x1440fa['stack']);if(_0x1440fa[_0x9d2c('0x28')]){delete _0x1440fa['name'];}_0x8057f6[_0x9d2c('0x1a')](_0x480c9a)[_0x9d2c('0x29')](_0x1440fa);};}exports[_0x9d2c('0x2a')]=function(_0x1cb23c,_0x1df8c7){var _0x2006e1={},_0x389e99={},_0x3033b0={'count':0x0,'rows':[]};var _0xb8f6f3=_[_0x9d2c('0x2b')](db['ChatInternalMessage'][_0x9d2c('0x2c')],function(_0x47bb2b){return{'name':_0x47bb2b['fieldName'],'type':_0x47bb2b[_0x9d2c('0x2d')][_0x9d2c('0x2e')]};});_0x389e99[_0x9d2c('0x2f')]=_[_0x9d2c('0x2b')](_0xb8f6f3,'name');_0x389e99[_0x9d2c('0x30')]=_[_0x9d2c('0x31')](_0x1cb23c[_0x9d2c('0x30')]);_0x389e99[_0x9d2c('0x32')]=_[_0x9d2c('0x33')](_0x389e99['model'],_0x389e99[_0x9d2c('0x30')]);_0x2006e1[_0x9d2c('0x34')]=_[_0x9d2c('0x33')](_0x389e99[_0x9d2c('0x2f')],qs[_0x9d2c('0x35')](_0x1cb23c['query']['fields']));_0x2006e1[_0x9d2c('0x34')]=_0x2006e1[_0x9d2c('0x34')]['length']?_0x2006e1[_0x9d2c('0x34')]:_0x389e99[_0x9d2c('0x2f')];if(!_0x1cb23c[_0x9d2c('0x30')]['hasOwnProperty'](_0x9d2c('0x36'))){_0x2006e1[_0x9d2c('0x1f')]=qs['limit'](_0x1cb23c[_0x9d2c('0x30')][_0x9d2c('0x1f')]);_0x2006e1[_0x9d2c('0x1d')]=qs[_0x9d2c('0x1d')](_0x1cb23c['query'][_0x9d2c('0x1d')]);}_0x2006e1[_0x9d2c('0x37')]=qs[_0x9d2c('0x38')](_0x1cb23c[_0x9d2c('0x30')][_0x9d2c('0x38')]);_0x2006e1[_0x9d2c('0x39')]=qs[_0x9d2c('0x32')](_[_0x9d2c('0x3a')](_0x1cb23c[_0x9d2c('0x30')],_0x389e99[_0x9d2c('0x32')]),_0xb8f6f3);if(_0x1cb23c[_0x9d2c('0x30')][_0x9d2c('0x3b')]){_0x2006e1[_0x9d2c('0x39')]=_[_0x9d2c('0x3c')](_0x2006e1[_0x9d2c('0x39')],{'$or':_[_0x9d2c('0x2b')](_0xb8f6f3,function(_0x102ca8){if(_0x102ca8[_0x9d2c('0x2d')]!==_0x9d2c('0x3d')){var _0x5de674={};_0x5de674[_0x102ca8[_0x9d2c('0x28')]]={'$like':'%'+_0x1cb23c[_0x9d2c('0x30')][_0x9d2c('0x3b')]+'%'};return _0x5de674;}})});}_0x2006e1=_[_0x9d2c('0x3c')]({},_0x2006e1,_0x1cb23c[_0x9d2c('0x3e')]);var _0x202f04={'where':_0x2006e1[_0x9d2c('0x39')]};return db[_0x9d2c('0x3f')][_0x9d2c('0x20')](_0x202f04)[_0x9d2c('0x26')](function(_0x2c0201){_0x3033b0['count']=_0x2c0201;if(_0x1cb23c[_0x9d2c('0x30')][_0x9d2c('0x40')]){_0x2006e1[_0x9d2c('0x41')]=[{'all':!![]}];}return db[_0x9d2c('0x3f')][_0x9d2c('0x42')](_0x2006e1);})[_0x9d2c('0x26')](function(_0x3a334d){_0x3033b0[_0x9d2c('0x43')]=_0x3a334d;return _0x3033b0;})[_0x9d2c('0x26')](respondWithFilteredResult(_0x1df8c7,_0x2006e1))[_0x9d2c('0x44')](handleError(_0x1df8c7,null));};exports['show']=function(_0x1719e8,_0x4c7a8f){var _0x43643d={'raw':!![],'where':{'id':_0x1719e8['params']['id']}},_0x597289={};_0x597289[_0x9d2c('0x2f')]=_[_0x9d2c('0x31')](db[_0x9d2c('0x3f')]['rawAttributes']);_0x597289[_0x9d2c('0x30')]=_[_0x9d2c('0x31')](_0x1719e8[_0x9d2c('0x30')]);_0x597289[_0x9d2c('0x32')]=_['intersection'](_0x597289[_0x9d2c('0x2f')],_0x597289['query']);_0x43643d[_0x9d2c('0x34')]=_[_0x9d2c('0x33')](_0x597289[_0x9d2c('0x2f')],qs[_0x9d2c('0x35')](_0x1719e8['query'][_0x9d2c('0x35')]));_0x43643d[_0x9d2c('0x34')]=_0x43643d[_0x9d2c('0x34')][_0x9d2c('0x45')]?_0x43643d[_0x9d2c('0x34')]:_0x597289[_0x9d2c('0x2f')];if(_0x1719e8[_0x9d2c('0x30')][_0x9d2c('0x40')]){_0x43643d['include']=[{'all':!![]}];}_0x43643d=_[_0x9d2c('0x3c')]({},_0x43643d,_0x1719e8[_0x9d2c('0x3e')]);return db[_0x9d2c('0x3f')][_0x9d2c('0x46')](_0x43643d)[_0x9d2c('0x26')](handleEntityNotFound(_0x4c7a8f,null))[_0x9d2c('0x26')](respondWithResult(_0x4c7a8f,null))['catch'](handleError(_0x4c7a8f,null));};exports[_0x9d2c('0x47')]=function(_0x3abc04,_0x129ca1){return db[_0x9d2c('0x3f')]['create'](_0x3abc04[_0x9d2c('0x48')],{})[_0x9d2c('0x26')](respondWithResult(_0x129ca1,0xc9))[_0x9d2c('0x44')](handleError(_0x129ca1,null));};exports[_0x9d2c('0x25')]=function(_0x385a3c,_0x3f14b2){if(_0x385a3c[_0x9d2c('0x48')]['id']){delete _0x385a3c[_0x9d2c('0x48')]['id'];}return db['ChatInternalMessage'][_0x9d2c('0x46')]({'where':{'id':_0x385a3c[_0x9d2c('0x49')]['id']}})[_0x9d2c('0x26')](handleEntityNotFound(_0x3f14b2,null))['then'](saveUpdates(_0x385a3c[_0x9d2c('0x48')],null))['then'](respondWithResult(_0x3f14b2,null))[_0x9d2c('0x44')](handleError(_0x3f14b2,null));};exports[_0x9d2c('0x4a')]=function(_0xf55836,_0x44d315){return db[_0x9d2c('0x3f')]['find']({'where':{'id':_0xf55836[_0x9d2c('0x49')]['id']}})[_0x9d2c('0x26')](handleEntityNotFound(_0x44d315,null))[_0x9d2c('0x26')](removeEntity(_0x44d315,null))[_0x9d2c('0x44')](handleError(_0x44d315,null));};exports[_0x9d2c('0x4b')]=function(_0xfa810d,_0xc6c31f){return db[_0x9d2c('0x3f')][_0x9d2c('0x4b')]()[_0x9d2c('0x26')](respondWithResult(_0xc6c31f,null))['catch'](handleError(_0xc6c31f,null));};function wrapUser(_0x5f1f0b){return function(_0x128d0e){var _0x5a76f3=_0x5f1f0b[_0x9d2c('0x4c')]({'plain':!![]});_0x5a76f3[_0x9d2c('0x4d')]=[];if(_0x128d0e){_0x5a76f3[_0x9d2c('0x4e')]=_0x128d0e[_0x9d2c('0x4f')];_0x5a76f3[_0x9d2c('0x50')]=_0x128d0e;}else{_0x5a76f3[_0x9d2c('0x4e')]=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5a76f3[_0x9d2c('0x50')]={};}return _0x5a76f3;};}exports[_0x9d2c('0x51')]=function(_0x1dada2,_0x1e7cf8,_0x4ae5ac){var _0x238a0b=[];return db[_0x9d2c('0x52')]['findAll']({'where':{'role':[_0x9d2c('0x53'),'admin',_0x9d2c('0x54')]},'attributes':['id','fullname','name',_0x9d2c('0x55'),_0x9d2c('0x56'),_0x9d2c('0x57'),_0x9d2c('0x58'),_0x9d2c('0x59'),'allowmessenger','showWebBar'],'order':qs[_0x9d2c('0x38')](_0x9d2c('0x5a')),'include':[{'model':db[_0x9d2c('0x5b')],'as':_0x9d2c('0x5c'),'attributes':['id',_0x9d2c('0x28'),_0x9d2c('0x2d')],'through':{'attributes':[]}}]})['then'](function(_0x5601f9){if(_0x5601f9){var _0x2c1ec0=_0x1dada2[_0x9d2c('0x54')][_0x9d2c('0x4c')]({'plain':!![]});if(!_0x2c1ec0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c1ec0[_0x9d2c('0x55')]==='user'){return db[_0x9d2c('0x5d')][_0x9d2c('0x46')]({'where':{'name':'Agents','userProfileId':_0x2c1ec0['userProfileId']},'raw':!![]})['then'](function(_0x42ff0f){if(_0x42ff0f){if(_0x42ff0f['autoAssociation']===0x0){return db[_0x9d2c('0x5e')][_0x9d2c('0x42')]({'where':{'sectionId':_0x42ff0f['id']},'raw':!![]})[_0x9d2c('0x26')](function(_0x386d73){var _0x42f18f=[];if(_[_0x9d2c('0x5f')](_0x386d73)){_0x42f18f=_[_0x9d2c('0x3b')](_0x5601f9,function(_0x333e9e){if(_0x333e9e[_0x9d2c('0x55')]!=='agent'){return _0x333e9e;}});return _0x42f18f;}else{for(var _0x504100=0x0;_0x504100<_0x5601f9[_0x9d2c('0x45')];_0x504100++){var _0x1cbe37=_0x5601f9[_0x504100];if(_0x1cbe37['role']===_0x9d2c('0x53')){var _0x4c4e82=_[_0x9d2c('0x46')](_0x386d73,function(_0x4c4719){return _0x4c4719[_0x9d2c('0x60')]===_0x1cbe37['id'];});if(_0x4c4e82)_0x42f18f[_0x9d2c('0x61')](_0x1cbe37);}else{_0x42f18f[_0x9d2c('0x61')](_0x1cbe37);}}return _0x42f18f;}});}else{return _0x5601f9;}}else{var _0x3c44fd=_[_0x9d2c('0x3b')](_0x5601f9,function(_0x1622fa){if(_0x1622fa[_0x9d2c('0x55')]!=='agent'){return _0x1622fa;}});return _0x3c44fd;}});}else{return _0x5601f9;}}})[_0x9d2c('0x26')](function(_0x48445c){var _0x3530ed=[];if(_0x48445c){_0x238a0b=_0x48445c;for(var _0x174c25=0x0;_0x174c25<_0x48445c[_0x9d2c('0x45')];_0x174c25+=0x1){_0x238a0b[_0x174c25]['messages']=[];_0x3530ed[_0x9d2c('0x61')](db[_0x9d2c('0x3f')]['find']({'where':{'FromId':[_0x1dada2[_0x9d2c('0x54')]['id'],_0x48445c[_0x174c25]['id']],'ToId':[_0x1dada2['user']['id'],_0x48445c[_0x174c25]['id']],'ChatGroupId':null},'attributes':['id',_0x9d2c('0x4f'),_0x9d2c('0x62'),_0x9d2c('0x63'),'read',_0x9d2c('0x48')],'order':qs[_0x9d2c('0x38')](_0x9d2c('0x64')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x9d2c('0x26')](wrapUser(_0x48445c[_0x174c25])));}return BPromise[_0x9d2c('0x65')](_0x3530ed);}return[];})['then'](function(_0x2b478f){return{'rows':_0x2b478f,'count':_0x2b478f[_0x9d2c('0x45')]};})[_0x9d2c('0x26')](respondWithResult(_0x1e7cf8,null))[_0x9d2c('0x44')](handleError(_0x1e7cf8,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 3b9b304..1726d34 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 _0x0fe7=['save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x3bf52b,_0x5979d3){var _0x1f6c0c=function(_0x3607af){while(--_0x3607af){_0x3bf52b['push'](_0x3bf52b['shift']());}};_0x1f6c0c(++_0x5979d3);}(_0x0fe7,0xb4));var _0x70fe=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x0fe7[_0x1203f];return _0x365f0a;};'use strict';var EventEmitter=require(_0x70fe('0x0'));var ChatInternalMessage=require(_0x70fe('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x70fe('0x2'),'afterUpdate':_0x70fe('0x3'),'afterDestroy':_0x70fe('0x4')};function emitEvent(_0x4cb804){return function(_0x46db27,_0x5d2847,_0x555048){ChatInternalMessageEvents[_0x70fe('0x5')](_0x4cb804+':'+_0x46db27['id'],_0x46db27);ChatInternalMessageEvents[_0x70fe('0x5')](_0x4cb804,_0x46db27);_0x555048(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x70fe('0x6')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x1036=['events','../../mysqldb','ChatInternalMessage','save','update','emit','exports'];(function(_0x4db12c,_0x51a677){var _0x24e6ac=function(_0x7f70f8){while(--_0x7f70f8){_0x4db12c['push'](_0x4db12c['shift']());}};_0x24e6ac(++_0x51a677);}(_0x1036,0x196));var _0x6103=function(_0xa880c7,_0x9b7912){_0xa880c7=_0xa880c7-0x0;var _0x22ffd5=_0x1036[_0xa880c7];return _0x22ffd5;};'use strict';var EventEmitter=require(_0x6103('0x0'));var ChatInternalMessage=require(_0x6103('0x1'))['db'][_0x6103('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6103('0x3'),'afterUpdate':_0x6103('0x4'),'afterDestroy':'remove'};function emitEvent(_0x38cd7c){return function(_0x287ed1,_0x49609c,_0x4ee98d){ChatInternalMessageEvents[_0x6103('0x5')](_0x38cd7c+':'+_0x287ed1['id'],_0x287ed1);ChatInternalMessageEvents[_0x6103('0x5')](_0x38cd7c,_0x287ed1);_0x4ee98d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x6103('0x6')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 9e7e1da..438122f 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 _0x5136=['../../config/logger','moment','bluebird','path','rimraf','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5136,0xdb));var _0x6513=function(_0x87a455,_0x1780c5){_0x87a455=_0x87a455-0x0;var _0xe20292=_0x5136[_0x87a455];return _0xe20292;};'use strict';var _=require(_0x6513('0x0'));var util=require('util');var logger=require(_0x6513('0x1'))('api');var moment=require(_0x6513('0x2'));var BPromise=require(_0x6513('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6513('0x4'));var rimraf=require(_0x6513('0x5'));var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module[_0x6513('0x6')]=function(_0x49f059,_0x5355fb){return _0x49f059[_0x6513('0x7')](_0x6513('0x8'),attributes,{'tableName':_0x6513('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6513('0xa')});}; \ No newline at end of file +var _0xd500=['chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatInternalMessage.attributes','exports','define'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0xd500,0x12f));var _0x0d50=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xd500[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x0d50('0x0'));var util=require(_0x0d50('0x1'));var logger=require(_0x0d50('0x2'))(_0x0d50('0x3'));var moment=require(_0x0d50('0x4'));var BPromise=require(_0x0d50('0x5'));var rp=require(_0x0d50('0x6'));var fs=require('fs');var path=require(_0x0d50('0x7'));var rimraf=require('rimraf');var config=require(_0x0d50('0x8'));var attributes=require(_0x0d50('0x9'));module[_0x0d50('0xa')]=function(_0x7e9b95,_0x2359f7){return _0x7e9b95[_0x0d50('0xb')]('ChatInternalMessage',attributes,{'tableName':_0x0d50('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0d50('0xd'),'collate':_0x0d50('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 36ee6bf..ab20210 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 _0x1261=['util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash'];(function(_0x180cd0,_0x386c6e){var _0x49fc32=function(_0x551c2c){while(--_0x551c2c){_0x180cd0['push'](_0x180cd0['shift']());}};_0x49fc32(++_0x386c6e);}(_0x1261,0x1a8));var _0x1126=function(_0x86d32e,_0x3a0bf1){_0x86d32e=_0x86d32e-0x0;var _0x50a35e=_0x1261[_0x86d32e];return _0x50a35e;};'use strict';var _=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var moment=require('moment');var BPromise=require(_0x1126('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1126('0x3'));var db=require(_0x1126('0x4'))['db'];var utils=require(_0x1126('0x5'));var logger=require('../../config/logger')(_0x1126('0x6'));var config=require(_0x1126('0x7'));var jayson=require(_0x1126('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x1126('0x9')]=_['defaults'](config[_0x1126('0x9')],{'host':_0x1126('0xa'),'port':0x18eb});var socket=require(_0x1126('0xb'))(new Redis(config[_0x1126('0x9')]));require(_0x1126('0xc'))[_0x1126('0xd')](socket);function respondWithRpcPromise(_0x5f5d44,_0x3f0760,_0x3a68fc){return new BPromise(function(_0x1d661f,_0x4db8ac){return client[_0x1126('0xe')](_0x5f5d44,_0x3a68fc)[_0x1126('0xf')](function(_0x3fcbde){logger[_0x1126('0x10')](_0x1126('0x11'),_0x3f0760,_0x1126('0x12'));logger[_0x1126('0x13')](_0x1126('0x14'),_0x3f0760,_0x1126('0x12'),JSON[_0x1126('0x15')](_0x3fcbde));if(_0x3fcbde['error']){if(_0x3fcbde[_0x1126('0x16')][_0x1126('0x17')]===0x1f4){logger[_0x1126('0x16')](_0x1126('0x11'),_0x3f0760,_0x3fcbde[_0x1126('0x16')][_0x1126('0x18')]);return _0x4db8ac(_0x3fcbde['error']['message']);}logger[_0x1126('0x16')](_0x1126('0x11'),_0x3f0760,_0x3fcbde[_0x1126('0x16')][_0x1126('0x18')]);return _0x1d661f(_0x3fcbde['error'][_0x1126('0x18')]);}else{logger[_0x1126('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x3f0760,_0x1126('0x12'));_0x1d661f(_0x3fcbde['result'][_0x1126('0x18')]);}})['catch'](function(_0x39c0ae){logger[_0x1126('0x16')](_0x1126('0x11'),_0x3f0760,_0x39c0ae);_0x4db8ac(_0x39c0ae);});});} \ No newline at end of file +var _0x865e=['error','code','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4dd321,_0x2171a5){var _0x38f1c4=function(_0x549925){while(--_0x549925){_0x4dd321['push'](_0x4dd321['shift']());}};_0x38f1c4(++_0x2171a5);}(_0x865e,0x6d));var _0xe865=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x865e[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xe865('0x0'));var util=require(_0xe865('0x1'));var moment=require(_0xe865('0x2'));var BPromise=require('bluebird');var rs=require(_0xe865('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe865('0x4'));var logger=require(_0xe865('0x5'))(_0xe865('0x6'));var config=require(_0xe865('0x7'));var jayson=require(_0xe865('0x8'));var client=jayson['client'][_0xe865('0x9')]({'port':0x232a});config[_0xe865('0xa')]=_[_0xe865('0xb')](config[_0xe865('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xe865('0xc'))(new Redis(config['redis']));require(_0xe865('0xd'))['register'](socket);function respondWithRpcPromise(_0x5ada1b,_0x105112,_0x2df051){return new BPromise(function(_0xb20fd1,_0x3b9e79){return client[_0xe865('0xe')](_0x5ada1b,_0x2df051)[_0xe865('0xf')](function(_0x38bd6f){logger[_0xe865('0x10')](_0xe865('0x11'),_0x105112,_0xe865('0x12'));logger['debug'](_0xe865('0x13'),_0x105112,'request\x20sent',JSON[_0xe865('0x14')](_0x38bd6f));if(_0x38bd6f[_0xe865('0x15')]){if(_0x38bd6f['error'][_0xe865('0x16')]===0x1f4){logger[_0xe865('0x15')](_0xe865('0x11'),_0x105112,_0x38bd6f[_0xe865('0x15')][_0xe865('0x17')]);return _0x3b9e79(_0x38bd6f[_0xe865('0x15')][_0xe865('0x17')]);}logger[_0xe865('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x105112,_0x38bd6f[_0xe865('0x15')]['message']);return _0xb20fd1(_0x38bd6f[_0xe865('0x15')][_0xe865('0x17')]);}else{logger[_0xe865('0x10')](_0xe865('0x11'),_0x105112,_0xe865('0x12'));_0xb20fd1(_0x38bd6f[_0xe865('0x18')][_0xe865('0x17')]);}})[_0xe865('0x19')](function(_0x1aaf06){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x105112,_0x1aaf06);_0x3b9e79(_0x1aaf06);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 88cf304..68d7c32 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 _0xa468=['removeListener','length','chatInternalMessage:','save','remove','update'];(function(_0x4aadf7,_0x520593){var _0x55151e=function(_0x225144){while(--_0x225144){_0x4aadf7['push'](_0x4aadf7['shift']());}};_0x55151e(++_0x520593);}(_0xa468,0x9f));var _0x8a46=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa468[_0x1ac595];return _0x455fff;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x8a46('0x0'),_0x8a46('0x1'),_0x8a46('0x2')];function createListener(_0x546f86,_0x4de3f6){return function(_0x3e09d5){_0x4de3f6['emit'](_0x546f86,_0x3e09d5);};}function removeListener(_0xcf703d,_0x49fd5b){return function(){ChatInternalMessageEvents[_0x8a46('0x3')](_0xcf703d,_0x49fd5b);};}exports['register']=function(_0x423653){for(var _0x21d3c6=0x0,_0x1e8878=events[_0x8a46('0x4')];_0x21d3c6<_0x1e8878;_0x21d3c6++){var _0x3b7cb1=events[_0x21d3c6];var _0x55d7cb=createListener(_0x8a46('0x5')+_0x3b7cb1,_0x423653);ChatInternalMessageEvents['on'](_0x3b7cb1,_0x55d7cb);}}; \ No newline at end of file +var _0xa602=['length','chatInternalMessage:','save','remove','update','emit','removeListener','register'];(function(_0xc81022,_0x5e3d31){var _0x555fd3=function(_0x9f7cc1){while(--_0x9f7cc1){_0xc81022['push'](_0xc81022['shift']());}};_0x555fd3(++_0x5e3d31);}(_0xa602,0x7a));var _0x2a60=function(_0x40b580,_0x5b9ebd){_0x40b580=_0x40b580-0x0;var _0x162d48=_0xa602[_0x40b580];return _0x162d48;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x2a60('0x0'),_0x2a60('0x1'),_0x2a60('0x2')];function createListener(_0x1146bb,_0x418136){return function(_0x57bb36){_0x418136[_0x2a60('0x3')](_0x1146bb,_0x57bb36);};}function removeListener(_0x5e2889,_0x5eb05d){return function(){ChatInternalMessageEvents[_0x2a60('0x4')](_0x5e2889,_0x5eb05d);};}exports[_0x2a60('0x5')]=function(_0x30c540){for(var _0x166202=0x0,_0x401958=events[_0x2a60('0x6')];_0x166202<_0x401958;_0x166202++){var _0x4170de=events[_0x166202];var _0x2cebe0=createListener(_0x2a60('0x7')+_0x4170de,_0x30c540);ChatInternalMessageEvents['on'](_0x4170de,_0x2cebe0);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index ee41984..45e29d9 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 _0x3d32=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','getUsers','/:id','show','create','update','destroy','util'];(function(_0x2f420a,_0x26bdb3){var _0x57b6ef=function(_0x4ee112){while(--_0x4ee112){_0x2f420a['push'](_0x2f420a['shift']());}};_0x57b6ef(++_0x26bdb3);}(_0x3d32,0x6f));var _0x23d3=function(_0x32f4e5,_0x35d4fd){_0x32f4e5=_0x32f4e5-0x0;var _0x170c9a=_0x3d32[_0x32f4e5];return _0x170c9a;};'use strict';var multer=require('multer');var util=require(_0x23d3('0x0'));var path=require(_0x23d3('0x1'));var timeout=require(_0x23d3('0x2'));var express=require(_0x23d3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x23d3('0x4'));var interaction=require(_0x23d3('0x5'));var config=require(_0x23d3('0x6'));var controller=require(_0x23d3('0x7'));router[_0x23d3('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x23d3('0x8')]('/describe',auth[_0x23d3('0x9')](),controller['describe']);router[_0x23d3('0x8')]('/users',auth[_0x23d3('0x9')](),controller[_0x23d3('0xa')]);router[_0x23d3('0x8')](_0x23d3('0xb'),auth[_0x23d3('0x9')](),controller[_0x23d3('0xc')]);router['post']('/',auth[_0x23d3('0x9')](),controller[_0x23d3('0xd')]);router['put'](_0x23d3('0xb'),controller[_0x23d3('0xe')]);router['delete'](_0x23d3('0xb'),auth[_0x23d3('0x9')](),controller[_0x23d3('0xf')]);module['exports']=router; \ No newline at end of file +var _0x6726=['index','/describe','/users','getUsers','show','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated'];(function(_0x166893,_0x4b1313){var _0x1ff405=function(_0x4c0080){while(--_0x4c0080){_0x166893['push'](_0x166893['shift']());}};_0x1ff405(++_0x4b1313);}(_0x6726,0xf1));var _0x6672=function(_0x7185f7,_0x37065){_0x7185f7=_0x7185f7-0x0;var _0x182e45=_0x6726[_0x7185f7];return _0x182e45;};'use strict';var multer=require('multer');var util=require(_0x6672('0x0'));var path=require(_0x6672('0x1'));var timeout=require(_0x6672('0x2'));var express=require(_0x6672('0x3'));var router=express[_0x6672('0x4')]();var fs_extra=require(_0x6672('0x5'));var auth=require(_0x6672('0x6'));var interaction=require(_0x6672('0x7'));var config=require(_0x6672('0x8'));var controller=require(_0x6672('0x9'));router[_0x6672('0xa')]('/',auth[_0x6672('0xb')](),controller[_0x6672('0xc')]);router[_0x6672('0xa')](_0x6672('0xd'),auth[_0x6672('0xb')](),controller['describe']);router[_0x6672('0xa')](_0x6672('0xe'),auth['isAuthenticated'](),controller[_0x6672('0xf')]);router[_0x6672('0xa')]('/:id',auth[_0x6672('0xb')](),controller[_0x6672('0x10')]);router['post']('/',auth[_0x6672('0xb')](),controller['create']);router[_0x6672('0x11')](_0x6672('0x12'),controller[_0x6672('0x13')]);router[_0x6672('0x14')](_0x6672('0x12'),auth[_0x6672('0xb')](),controller[_0x6672('0x15')]);module[_0x6672('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index af8f328..8dea884 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 _0x915a=['DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x22b6d8,_0x1876fd){var _0x1a5212=function(_0x344d1c){while(--_0x344d1c){_0x22b6d8['push'](_0x22b6d8['shift']());}};_0x1a5212(++_0x1876fd);}(_0x915a,0x1d2));var _0xa915=function(_0x578a69,_0x17dca6){_0x578a69=_0x578a69-0x0;var _0x16e24f=_0x915a[_0x578a69];return _0x16e24f;};'use strict';var Sequelize=require(_0xa915('0x0'));module[_0xa915('0x1')]={'body':{'type':Sequelize[_0xa915('0x2')](_0xa915('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa915('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xa915('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xa915('0x6')]},'providerName':{'type':Sequelize[_0xa915('0x7')]},'providerResponse':{'type':Sequelize[_0xa915('0x2')]}}; \ No newline at end of file +var _0x6947=['STRING','TEXT','exports','medium','BOOLEAN','ENUM','DATE'];(function(_0x40be86,_0x68fe5d){var _0xda3c3b=function(_0x39deab){while(--_0x39deab){_0x40be86['push'](_0x40be86['shift']());}};_0xda3c3b(++_0x68fe5d);}(_0x6947,0x72));var _0x7694=function(_0x4a2ca1,_0x369429){_0x4a2ca1=_0x4a2ca1-0x0;var _0x37d593=_0x6947[_0x4a2ca1];return _0x37d593;};'use strict';var Sequelize=require('sequelize');module[_0x7694('0x0')]={'body':{'type':Sequelize['TEXT'](_0x7694('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x7694('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x7694('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7694('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x7694('0x4')]},'providerName':{'type':Sequelize[_0x7694('0x5')]},'providerResponse':{'type':Sequelize[_0x7694('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 78e57f3..36918eb 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 _0x283b=['rawAttributes','fields','find','create','body','params','describe','chat-interactions','accept','chat','read','readAt','format','UserId','agent','get','ChatInteraction','ChatInteractionId','update','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','User','fullname','manual','SIP/%s','channel','event','EventManager','formData','../../config/logger','RejectMessage','rejectMessage','SELECT','email','internal','interface','motionChannel','parse','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','client','http','request','info','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatMessage,\x20%s,\x20%s','message','result','catch','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','sendStatus','name','send','map','type','key','model','query','keys','intersection','attributes','length','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','ChatMessage','then','includeAll','include','findAll','rows','show'];(function(_0x366729,_0x1314c0){var _0x1dddb1=function(_0x3fb335){while(--_0x3fb335){_0x366729['push'](_0x366729['shift']());}};_0x1dddb1(++_0x1314c0);}(_0x283b,0xb4));var _0xb283=function(_0x53b135,_0x3aa0d3){_0x53b135=_0x53b135-0x0;var _0x56e52f=_0x283b[_0x53b135];return _0x56e52f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb283('0x0'));var zipdir=require(_0xb283('0x1'));var jsonpatch=require(_0xb283('0x2'));var rp=require(_0xb283('0x3'));var moment=require(_0xb283('0x4'));var BPromise=require(_0xb283('0x5'));var Mustache=require(_0xb283('0x6'));var util=require(_0xb283('0x7'));var path=require(_0xb283('0x8'));var sox=require(_0xb283('0x9'));var csv=require(_0xb283('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb283('0xb'));var _=require(_0xb283('0xc'));var squel=require(_0xb283('0xd'));var crypto=require(_0xb283('0xe'));var jsforce=require(_0xb283('0xf'));var deskjs=require(_0xb283('0x10'));var toCsv=require(_0xb283('0xa'));var querystring=require(_0xb283('0x11'));var Papa=require(_0xb283('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb283('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb283('0x14'));var logger=require('../../config/logger')(_0xb283('0x15'));var utils=require(_0xb283('0x16'));var config=require(_0xb283('0x17'));var licenseUtil=require(_0xb283('0x18'));var db=require(_0xb283('0x19'))['db'];config[_0xb283('0x1a')]=_[_0xb283('0x1b')](config[_0xb283('0x1a')],{'host':_0xb283('0x1c'),'port':0x18eb});var socket=require(_0xb283('0x1d'))(new Redis(config[_0xb283('0x1a')]));require(_0xb283('0x1e'))['register'](socket);var jayson=require(_0xb283('0x1f'));var client=jayson[_0xb283('0x20')][_0xb283('0x21')]({'port':0x232c});var client9002=jayson[_0xb283('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3863d1,_0x4272d1,_0x29c2af,_0x71b3a6){return new BPromise(function(_0x5dfd13,_0x4012a2){var _0x146efe=_0x71b3a6||client;return _0x146efe[_0xb283('0x22')](_0x3863d1,_0x29c2af)['then'](function(_0x370615){logger[_0xb283('0x23')]('ChatMessage,\x20%s,\x20%s',_0x4272d1,'request\x20sent');logger['debug'](_0xb283('0x24'),_0x4272d1,_0xb283('0x25'),JSON[_0xb283('0x26')](_0x370615));if(_0x370615['error']){if(_0x370615[_0xb283('0x27')]['code']===0x1f4){logger[_0xb283('0x27')](_0xb283('0x28'),_0x4272d1,_0x370615['error']['message']);return _0x4012a2(_0x370615[_0xb283('0x27')][_0xb283('0x29')]);}logger[_0xb283('0x27')](_0xb283('0x28'),_0x4272d1,_0x370615[_0xb283('0x27')][_0xb283('0x29')]);return _0x5dfd13(_0x370615['error'][_0xb283('0x29')]);}else{logger[_0xb283('0x23')](_0xb283('0x28'),_0x4272d1,_0xb283('0x25'));_0x5dfd13(_0x370615[_0xb283('0x2a')][_0xb283('0x29')]);}})[_0xb283('0x2b')](function(_0x53c994){logger[_0xb283('0x27')]('ChatMessage,\x20%s,\x20%s',_0x4272d1,_0x53c994);_0x4012a2(_0x53c994);});});}function respondWithStatusCode(_0x1b06d5,_0x3acc70){_0x3acc70=_0x3acc70||0xcc;return function(_0x5c7178){if(_0x5c7178){return _0x1b06d5['sendStatus'](_0x3acc70);}return _0x1b06d5[_0xb283('0x2c')](_0x3acc70)[_0xb283('0x2d')]();};}function respondWithResult(_0x3d504b,_0x1c49a6){_0x1c49a6=_0x1c49a6||0xc8;return function(_0x1f9c92){if(_0x1f9c92){return _0x3d504b[_0xb283('0x2c')](_0x1c49a6)[_0xb283('0x2e')](_0x1f9c92);}};}function respondWithFilteredResult(_0x1d1cac,_0x43ee6){return function(_0x1794c9){if(_0x1794c9){var _0x39f4ce=typeof _0x43ee6['offset']===_0xb283('0x2f')&&typeof _0x43ee6[_0xb283('0x30')]===_0xb283('0x2f');var _0x5539fc=_0x1794c9[_0xb283('0x31')];var _0x534388=_0x39f4ce?0x0:_0x43ee6[_0xb283('0x32')];var _0x5661d5=_0x39f4ce?_0x1794c9['count']:_0x43ee6[_0xb283('0x32')]+_0x43ee6['limit'];var _0x1414d8;if(_0x5661d5>=_0x5539fc){_0x5661d5=_0x5539fc;_0x1414d8=0xc8;}else{_0x1414d8=0xce;}_0x1d1cac['status'](_0x1414d8);return _0x1d1cac['set'](_0xb283('0x33'),_0x534388+'-'+_0x5661d5+'/'+_0x5539fc)['json'](_0x1794c9);}return null;};}function patchUpdates(_0xddccf3){return function(_0x141a1c){try{jsonpatch[_0xb283('0x34')](_0x141a1c,_0xddccf3,!![]);}catch(_0xa6eeb9){return BPromise[_0xb283('0x35')](_0xa6eeb9);}return _0x141a1c[_0xb283('0x36')]();};}function saveUpdates(_0xf0abdd,_0x2d2e40){return function(_0x36aabd){if(_0x36aabd){return _0x36aabd['update'](_0xf0abdd)['then'](function(_0x5510d6){return _0x5510d6;});}return null;};}function removeEntity(_0xdceddd,_0x3be644){return function(_0x5214b0){if(_0x5214b0){return _0x5214b0['destroy']()['then'](function(){_0xdceddd[_0xb283('0x2c')](0xcc)[_0xb283('0x2d')]();});}};}function handleEntityNotFound(_0x1dc668,_0x5bef74){return function(_0x4fcf68){if(!_0x4fcf68){_0x1dc668[_0xb283('0x37')](0x194);}return _0x4fcf68;};}function handleError(_0x255538,_0xd28650){_0xd28650=_0xd28650||0x1f4;return function(_0x2da947){logger['error'](_0x2da947['stack']);if(_0x2da947['name']){delete _0x2da947[_0xb283('0x38')];}_0x255538['status'](_0xd28650)[_0xb283('0x39')](_0x2da947);};}exports['index']=function(_0x2d82ed,_0x1f3062){var _0x271ee8={},_0x45ce86={},_0x385117={'count':0x0,'rows':[]};var _0x5babe3=_[_0xb283('0x3a')](db['ChatMessage']['rawAttributes'],function(_0xe6cb55){return{'name':_0xe6cb55['fieldName'],'type':_0xe6cb55[_0xb283('0x3b')][_0xb283('0x3c')]};});_0x45ce86[_0xb283('0x3d')]=_[_0xb283('0x3a')](_0x5babe3,_0xb283('0x38'));_0x45ce86[_0xb283('0x3e')]=_[_0xb283('0x3f')](_0x2d82ed[_0xb283('0x3e')]);_0x45ce86['filters']=_[_0xb283('0x40')](_0x45ce86[_0xb283('0x3d')],_0x45ce86['query']);_0x271ee8[_0xb283('0x41')]=_[_0xb283('0x40')](_0x45ce86[_0xb283('0x3d')],qs['fields'](_0x2d82ed[_0xb283('0x3e')]['fields']));_0x271ee8[_0xb283('0x41')]=_0x271ee8[_0xb283('0x41')][_0xb283('0x42')]?_0x271ee8[_0xb283('0x41')]:_0x45ce86[_0xb283('0x3d')];if(!_0x2d82ed[_0xb283('0x3e')]['hasOwnProperty'](_0xb283('0x43'))){_0x271ee8['limit']=qs[_0xb283('0x30')](_0x2d82ed['query'][_0xb283('0x30')]);_0x271ee8[_0xb283('0x32')]=qs[_0xb283('0x32')](_0x2d82ed[_0xb283('0x3e')][_0xb283('0x32')]);}_0x271ee8['order']=qs[_0xb283('0x44')](_0x2d82ed[_0xb283('0x3e')][_0xb283('0x44')]);_0x271ee8[_0xb283('0x45')]=qs[_0xb283('0x46')](_['pick'](_0x2d82ed[_0xb283('0x3e')],_0x45ce86['filters']),_0x5babe3);if(_0x2d82ed[_0xb283('0x3e')][_0xb283('0x47')]){_0x271ee8[_0xb283('0x45')]=_[_0xb283('0x48')](_0x271ee8[_0xb283('0x45')],{'$or':_[_0xb283('0x3a')](_0x5babe3,function(_0x67ec02){if(_0x67ec02['type']!==_0xb283('0x49')){var _0x100228={};_0x100228[_0x67ec02[_0xb283('0x38')]]={'$like':'%'+_0x2d82ed['query'][_0xb283('0x47')]+'%'};return _0x100228;}})});}_0x271ee8=_[_0xb283('0x48')]({},_0x271ee8,_0x2d82ed[_0xb283('0x4a')]);var _0x52137e={'where':_0x271ee8[_0xb283('0x45')]};return db[_0xb283('0x4b')][_0xb283('0x31')](_0x52137e)[_0xb283('0x4c')](function(_0x1b90e4){_0x385117['count']=_0x1b90e4;if(_0x2d82ed[_0xb283('0x3e')][_0xb283('0x4d')]){_0x271ee8[_0xb283('0x4e')]=[{'all':!![]}];}return db['ChatMessage'][_0xb283('0x4f')](_0x271ee8);})[_0xb283('0x4c')](function(_0x4038d1){_0x385117[_0xb283('0x50')]=_0x4038d1;return _0x385117;})[_0xb283('0x4c')](respondWithFilteredResult(_0x1f3062,_0x271ee8))[_0xb283('0x2b')](handleError(_0x1f3062,null));};exports[_0xb283('0x51')]=function(_0x55567e,_0x460b4f){var _0x21582={'raw':!![],'where':{'id':_0x55567e['params']['id']}},_0xb10bbf={};_0xb10bbf[_0xb283('0x3d')]=_['keys'](db[_0xb283('0x4b')][_0xb283('0x52')]);_0xb10bbf[_0xb283('0x3e')]=_[_0xb283('0x3f')](_0x55567e[_0xb283('0x3e')]);_0xb10bbf[_0xb283('0x46')]=_[_0xb283('0x40')](_0xb10bbf[_0xb283('0x3d')],_0xb10bbf[_0xb283('0x3e')]);_0x21582[_0xb283('0x41')]=_[_0xb283('0x40')](_0xb10bbf[_0xb283('0x3d')],qs[_0xb283('0x53')](_0x55567e['query'][_0xb283('0x53')]));_0x21582[_0xb283('0x41')]=_0x21582[_0xb283('0x41')][_0xb283('0x42')]?_0x21582[_0xb283('0x41')]:_0xb10bbf['model'];if(_0x55567e[_0xb283('0x3e')]['includeAll']){_0x21582[_0xb283('0x4e')]=[{'all':!![]}];}_0x21582=_['merge']({},_0x21582,_0x55567e[_0xb283('0x4a')]);return db['ChatMessage'][_0xb283('0x54')](_0x21582)[_0xb283('0x4c')](handleEntityNotFound(_0x460b4f,null))[_0xb283('0x4c')](respondWithResult(_0x460b4f,null))[_0xb283('0x2b')](handleError(_0x460b4f,null));};exports[_0xb283('0x55')]=function(_0x234964,_0x162178){return db[_0xb283('0x4b')][_0xb283('0x55')](_0x234964[_0xb283('0x56')],{})[_0xb283('0x4c')](respondWithResult(_0x162178,0xc9))['catch'](handleError(_0x162178,null));};exports['update']=function(_0x1a82d6,_0x19fc9a){if(_0x1a82d6[_0xb283('0x56')]['id']){delete _0x1a82d6['body']['id'];}return db['ChatMessage'][_0xb283('0x54')]({'where':{'id':_0x1a82d6[_0xb283('0x57')]['id']}})[_0xb283('0x4c')](handleEntityNotFound(_0x19fc9a,null))[_0xb283('0x4c')](saveUpdates(_0x1a82d6[_0xb283('0x56')],null))[_0xb283('0x4c')](respondWithResult(_0x19fc9a,null))[_0xb283('0x2b')](handleError(_0x19fc9a,null));};exports['destroy']=function(_0x84e51c,_0x4bd17a){return db[_0xb283('0x4b')]['find']({'where':{'id':_0x84e51c[_0xb283('0x57')]['id']}})['then'](handleEntityNotFound(_0x4bd17a,null))[_0xb283('0x4c')](removeEntity(_0x4bd17a,null))[_0xb283('0x2b')](handleError(_0x4bd17a,null));};exports[_0xb283('0x58')]=function(_0x512247,_0x543efc){return db['ChatMessage'][_0xb283('0x58')]()[_0xb283('0x4c')](respondWithResult(_0x543efc,null))[_0xb283('0x2b')](handleError(_0x543efc,null));};var interaction_log=require('../../config/logger')(_0xb283('0x59'));exports[_0xb283('0x5a')]=function(_0x3ad0c3,_0x544741,_0x3780de){var _0xf9abf3={'agent':{},'channel':_0xb283('0x5b')};if(_0x3ad0c3[_0xb283('0x56')]['id']){delete _0x3ad0c3[_0xb283('0x56')]['id'];}_0x3ad0c3[_0xb283('0x56')][_0xb283('0x5c')]=!![];_0x3ad0c3['body'][_0xb283('0x5d')]=moment()[_0xb283('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x3ad0c3[_0xb283('0x56')][_0xb283('0x5f')]=_0x3ad0c3[_0xb283('0x56')][_0xb283('0x5f')]||_0x3ad0c3['user']['id'];_0xf9abf3[_0xb283('0x60')]['id']=_0x3ad0c3[_0xb283('0x56')]['UserId'];return db['ChatMessage'][_0xb283('0x54')]({'where':{'id':_0x3ad0c3[_0xb283('0x57')]['id'],'UserId':null}})[_0xb283('0x4c')](handleEntityNotFound(_0x544741,null))[_0xb283('0x4c')](saveUpdates(_0x3ad0c3[_0xb283('0x56')],null))[_0xb283('0x4c')](function(_0x1b4f47){if(_0x1b4f47){_0xf9abf3['message']=_0x1b4f47[_0xb283('0x61')]({'plain':!![]});return db[_0xb283('0x62')][_0xb283('0x54')]({'where':{'id':_0x1b4f47[_0xb283('0x63')]}});}return null;})[_0xb283('0x4c')](handleEntityNotFound(_0x544741,null))[_0xb283('0x4c')](function(_0x29ca0e){if(_0x29ca0e){return _0x29ca0e[_0xb283('0x64')]({'UserId':_0x3ad0c3[_0xb283('0x56')][_0xb283('0x5f')],'read1stAt':_['isNil'](_0x29ca0e[_0xb283('0x65')])?moment()[_0xb283('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xb283('0x4c')](function(_0x34a7ae){if(_0x34a7ae){_0xf9abf3[_0xb283('0x66')]=_0x34a7ae[_0xb283('0x61')]({'plain':!![]});interaction_log[_0xb283('0x23')](_0xb283('0x67'),_0x3ad0c3[_0xb283('0x68')]['id'],_0x3ad0c3[_0xb283('0x68')]['name'],_0x3ad0c3[_0xb283('0x68')][_0xb283('0x69')],_0xf9abf3[_0xb283('0x66')]['id'],_0x3ad0c3[_0xb283('0x56')]?JSON[_0xb283('0x26')](_0x3ad0c3['body']):_0xb283('0x6a'));return respondWithRpcPromise(_0xb283('0x6b'),_0xb283('0x6c'),_0xf9abf3);}return null;})[_0xb283('0x4c')](function(_0x2995c0){var _0x1ccb0c=_0xb283('0x6d')+_0x2995c0[_0xb283('0x29')][_0xb283('0x6e')];return db['sequelize'][_0xb283('0x3e')](_0x1ccb0c,{'type':db[_0xb283('0x6f')][_0xb283('0x70')]['SELECT'],'raw':!![]})[_0xb283('0x4c')](function(_0x3c7751){return _0x3c7751;});})[_0xb283('0x4c')](function(_0x46c7dd){if(_0x46c7dd){_0xf9abf3[_0xb283('0x29')][_0xb283('0x71')]=_0x46c7dd[0x0];if(!_0x3ad0c3['body']['UserId'])return;return db[_0xb283('0x72')][_0xb283('0x54')]({'where':{'id':_0x3ad0c3[_0xb283('0x56')][_0xb283('0x5f')],'role':'agent'},'attributes':['id',_0xb283('0x38'),_0xb283('0x73'),'email','internal'],'raw':!![]});}return null;})[_0xb283('0x4c')](function(_0x4977ac){if(!_0x4977ac)return null;_0xf9abf3[_0xb283('0x29')][_0xb283('0x60')]=_0x4977ac;return _0xf9abf3;})[_0xb283('0x4c')](function(_0x4205f8){if(_0x4205f8){if(_0x3ad0c3[_0xb283('0x56')][_0xb283('0x74')]){_0xf9abf3[_0xb283('0x29')]['interface']=util['format'](_0xb283('0x75'),_0x3ad0c3['user'][_0xb283('0x38')]);_0xf9abf3['message'][_0xb283('0x76')]=_0xf9abf3['channel'];_0xf9abf3[_0xb283('0x29')]['motionChannel']=_0xf9abf3[_0xb283('0x76')];_0xf9abf3[_0xb283('0x29')][_0xb283('0x77')]=_0xb283('0x5a');return respondWithRpcPromise(_0xb283('0x78'),_0xb283('0x78'),{'event':'acceptmessage','message':_[_0xb283('0x48')](_0xf9abf3[_0xb283('0x29')],JSON['parse'](_0xf9abf3[_0xb283('0x66')][_0xb283('0x79')]))},client9002)['then'](function(){return _0xf9abf3;});}return _0xf9abf3;}return null;})[_0xb283('0x4c')](respondWithResult(_0x544741,null))[_0xb283('0x2b')](handleError(_0x544741,null));};var interaction_log=require(_0xb283('0x7a'))(_0xb283('0x59'));exports[_0xb283('0x35')]=function(_0x225134,_0x284550,_0x4aac83){var _0x1c7024={'agent':{},'channel':_0xb283('0x5b')};if(_0x225134[_0xb283('0x56')]['id']){delete _0x225134['body']['id'];}_0x225134[_0xb283('0x56')][_0xb283('0x5f')]=_0x225134[_0xb283('0x56')][_0xb283('0x5f')]||_0x225134[_0xb283('0x68')]['id'];_0x1c7024[_0xb283('0x60')]['id']=_0x225134[_0xb283('0x56')]['UserId'];return db['ChatMessage'][_0xb283('0x54')]({'where':{'id':_0x225134[_0xb283('0x57')]['id'],'UserId':null}})[_0xb283('0x4c')](handleEntityNotFound(_0x284550,null))[_0xb283('0x4c')](function(_0x13cbdc){if(_0x13cbdc){_0x1c7024[_0xb283('0x29')]=_0x13cbdc[_0xb283('0x61')]({'plain':!![]});return db[_0xb283('0x62')]['find']({'where':{'id':_0x13cbdc[_0xb283('0x63')]}});}return null;})[_0xb283('0x4c')](handleEntityNotFound(_0x284550,null))[_0xb283('0x4c')](function(_0x59a069){if(_0x59a069){_0x1c7024[_0xb283('0x66')]=_0x59a069[_0xb283('0x61')]({'plain':!![]});interaction_log[_0xb283('0x23')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x225134[_0xb283('0x68')]['id'],_0x225134[_0xb283('0x68')]['name'],_0x225134['user'][_0xb283('0x69')],_0x1c7024['interaction']['id'],_0x225134[_0xb283('0x56')]?JSON['stringify'](_0x225134[_0xb283('0x56')]):_0xb283('0x6a'));return respondWithRpcPromise(_0xb283('0x7b'),_0xb283('0x7c'),_0x1c7024);}return null;})[_0xb283('0x4c')](function(_0x189b1c){var _0x405886=_0xb283('0x6d')+_0x189b1c[_0xb283('0x29')][_0xb283('0x6e')];return db['sequelize']['query'](_0x405886,{'type':db[_0xb283('0x6f')][_0xb283('0x70')][_0xb283('0x7d')],'raw':!![]})['then'](function(_0x4e3615){return _0x4e3615;});})['then'](function(_0x10db74){if(_0x10db74){_0x1c7024[_0xb283('0x29')][_0xb283('0x71')]=_0x10db74[0x0];if(!_0x225134[_0xb283('0x56')]['UserId'])return;return db[_0xb283('0x72')][_0xb283('0x54')]({'where':{'id':_0x225134[_0xb283('0x56')]['UserId'],'role':_0xb283('0x60')},'attributes':['id',_0xb283('0x38'),_0xb283('0x73'),_0xb283('0x7e'),_0xb283('0x7f')],'raw':!![]});}return null;})[_0xb283('0x4c')](function(_0x10c143){if(!_0x10c143)return null;_0x1c7024[_0xb283('0x29')][_0xb283('0x60')]=_0x10c143;return _0x1c7024;})[_0xb283('0x4c')](function(_0x413c44){if(_0x413c44){_0x413c44['message'][_0xb283('0x80')]=util['format'](_0xb283('0x75'),_0x225134['user'][_0xb283('0x38')]);_0x413c44[_0xb283('0x29')]['channel']=_0x1c7024[_0xb283('0x76')];_0x413c44['message'][_0xb283('0x81')]=_0x1c7024[_0xb283('0x76')];_0x413c44['message'][_0xb283('0x77')]=_0xb283('0x35');respondWithRpcPromise(_0xb283('0x78'),_0xb283('0x78'),{'event':'rejectmessage','message':_[_0xb283('0x48')](_0x1c7024[_0xb283('0x29')],JSON[_0xb283('0x82')](_0x1c7024[_0xb283('0x66')][_0xb283('0x79')]))},client9002);return _0x1c7024;}return null;})[_0xb283('0x4c')](respondWithResult(_0x284550,null))['catch'](handleError(_0x284550,null));}; \ No newline at end of file +var _0xd16c=['fs-extra','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','http','client','request','then','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatMessage,\x20%s,\x20%s','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','update','stack','name','send','index','ChatMessage','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','sort','where','pick','merge','VIRTUAL','filter','options','rows','params','find','create','body','destroy','describe','chat-interactions','accept','read','readAt','UserId','user','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[CHATMESSAGE: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','contact','User','agent','email','internal','interface','format','SIP/%s','channel','event','EventManager','parse','formData','reject','chat','ChatInteraction','info','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','ContactId','fullname','motionChannel','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs'];(function(_0x22edc3,_0x36a8e3){var _0x434803=function(_0x2898e3){while(--_0x2898e3){_0x22edc3['push'](_0x22edc3['shift']());}};_0x434803(++_0x36a8e3);}(_0xd16c,0x16c));var _0xcd16=function(_0x1a50e5,_0x14accb){_0x1a50e5=_0x1a50e5-0x0;var _0x53b463=_0xd16c[_0x1a50e5];return _0x53b463;};'use strict';var emlformat=require(_0xcd16('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcd16('0x1'));var jsonpatch=require(_0xcd16('0x2'));var rp=require(_0xcd16('0x3'));var moment=require(_0xcd16('0x4'));var BPromise=require(_0xcd16('0x5'));var Mustache=require('mustache');var util=require(_0xcd16('0x6'));var path=require(_0xcd16('0x7'));var sox=require(_0xcd16('0x8'));var csv=require(_0xcd16('0x9'));var ejs=require(_0xcd16('0xa'));var fs=require('fs');var fs_extra=require(_0xcd16('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcd16('0xc'));var deskjs=require(_0xcd16('0xd'));var toCsv=require(_0xcd16('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcd16('0xe'));var authService=require(_0xcd16('0xf'));var qs=require(_0xcd16('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcd16('0x11'));var logger=require(_0xcd16('0x12'))('api');var utils=require(_0xcd16('0x13'));var config=require(_0xcd16('0x14'));var licenseUtil=require(_0xcd16('0x15'));var db=require(_0xcd16('0x16'))['db'];config[_0xcd16('0x17')]=_[_0xcd16('0x18')](config['redis'],{'host':_0xcd16('0x19'),'port':0x18eb});var socket=require(_0xcd16('0x1a'))(new Redis(config['redis']));require(_0xcd16('0x1b'))[_0xcd16('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xcd16('0x1d')]({'port':0x232c});var client9002=jayson[_0xcd16('0x1e')][_0xcd16('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x11d966,_0x3bc372,_0x3381d3,_0x27f637){return new BPromise(function(_0x1b163f,_0x34ba5c){var _0x5ccd3a=_0x27f637||client;return _0x5ccd3a[_0xcd16('0x1f')](_0x11d966,_0x3381d3)[_0xcd16('0x20')](function(_0x5ce523){logger['info']('ChatMessage,\x20%s,\x20%s',_0x3bc372,'request\x20sent');logger['debug'](_0xcd16('0x21'),_0x3bc372,_0xcd16('0x22'),JSON[_0xcd16('0x23')](_0x5ce523));if(_0x5ce523['error']){if(_0x5ce523[_0xcd16('0x24')][_0xcd16('0x25')]===0x1f4){logger[_0xcd16('0x24')]('ChatMessage,\x20%s,\x20%s',_0x3bc372,_0x5ce523[_0xcd16('0x24')][_0xcd16('0x26')]);return _0x34ba5c(_0x5ce523[_0xcd16('0x24')][_0xcd16('0x26')]);}logger[_0xcd16('0x24')](_0xcd16('0x27'),_0x3bc372,_0x5ce523['error'][_0xcd16('0x26')]);return _0x1b163f(_0x5ce523[_0xcd16('0x24')][_0xcd16('0x26')]);}else{logger['info'](_0xcd16('0x27'),_0x3bc372,'request\x20sent');_0x1b163f(_0x5ce523[_0xcd16('0x28')][_0xcd16('0x26')]);}})[_0xcd16('0x29')](function(_0x1b87c7){logger[_0xcd16('0x24')](_0xcd16('0x27'),_0x3bc372,_0x1b87c7);_0x34ba5c(_0x1b87c7);});});}function respondWithStatusCode(_0x48cced,_0x559daa){_0x559daa=_0x559daa||0xcc;return function(_0x5cba1b){if(_0x5cba1b){return _0x48cced[_0xcd16('0x2a')](_0x559daa);}return _0x48cced[_0xcd16('0x2b')](_0x559daa)[_0xcd16('0x2c')]();};}function respondWithResult(_0x47ecdd,_0x1502de){_0x1502de=_0x1502de||0xc8;return function(_0x2719dc){if(_0x2719dc){return _0x47ecdd[_0xcd16('0x2b')](_0x1502de)['json'](_0x2719dc);}};}function respondWithFilteredResult(_0xc8bbb3,_0x9836c5){return function(_0x11717c){if(_0x11717c){var _0x4ebefa=typeof _0x9836c5[_0xcd16('0x2d')]===_0xcd16('0x2e')&&typeof _0x9836c5[_0xcd16('0x2f')]===_0xcd16('0x2e');var _0x431164=_0x11717c[_0xcd16('0x30')];var _0x462101=_0x4ebefa?0x0:_0x9836c5[_0xcd16('0x2d')];var _0x1ecc4a=_0x4ebefa?_0x11717c['count']:_0x9836c5[_0xcd16('0x2d')]+_0x9836c5[_0xcd16('0x2f')];var _0x41c38e;if(_0x1ecc4a>=_0x431164){_0x1ecc4a=_0x431164;_0x41c38e=0xc8;}else{_0x41c38e=0xce;}_0xc8bbb3[_0xcd16('0x2b')](_0x41c38e);return _0xc8bbb3[_0xcd16('0x31')]('Content-Range',_0x462101+'-'+_0x1ecc4a+'/'+_0x431164)[_0xcd16('0x32')](_0x11717c);}return null;};}function patchUpdates(_0x56f5f3){return function(_0x2535da){try{jsonpatch[_0xcd16('0x33')](_0x2535da,_0x56f5f3,!![]);}catch(_0x5a9468){return BPromise['reject'](_0x5a9468);}return _0x2535da[_0xcd16('0x34')]();};}function saveUpdates(_0x2c9a8f,_0x4bed7){return function(_0x3028a8){if(_0x3028a8){return _0x3028a8[_0xcd16('0x35')](_0x2c9a8f)[_0xcd16('0x20')](function(_0x34136d){return _0x34136d;});}return null;};}function removeEntity(_0x7d9583,_0xab6f61){return function(_0x23efa2){if(_0x23efa2){return _0x23efa2['destroy']()[_0xcd16('0x20')](function(){_0x7d9583['status'](0xcc)[_0xcd16('0x2c')]();});}};}function handleEntityNotFound(_0x47f13a,_0x4dda7f){return function(_0x3509e6){if(!_0x3509e6){_0x47f13a[_0xcd16('0x2a')](0x194);}return _0x3509e6;};}function handleError(_0xc11c20,_0x4b9131){_0x4b9131=_0x4b9131||0x1f4;return function(_0x7a2e3a){logger['error'](_0x7a2e3a[_0xcd16('0x36')]);if(_0x7a2e3a[_0xcd16('0x37')]){delete _0x7a2e3a['name'];}_0xc11c20['status'](_0x4b9131)[_0xcd16('0x38')](_0x7a2e3a);};}exports[_0xcd16('0x39')]=function(_0x3bcdbb,_0x3b37f8){var _0x563446={},_0x275f64={},_0xb527cd={'count':0x0,'rows':[]};var _0xb78228=_['map'](db[_0xcd16('0x3a')][_0xcd16('0x3b')],function(_0x26e608){return{'name':_0x26e608[_0xcd16('0x3c')],'type':_0x26e608[_0xcd16('0x3d')][_0xcd16('0x3e')]};});_0x275f64['model']=_[_0xcd16('0x3f')](_0xb78228,_0xcd16('0x37'));_0x275f64[_0xcd16('0x40')]=_[_0xcd16('0x41')](_0x3bcdbb['query']);_0x275f64[_0xcd16('0x42')]=_[_0xcd16('0x43')](_0x275f64['model'],_0x275f64['query']);_0x563446['attributes']=_[_0xcd16('0x43')](_0x275f64[_0xcd16('0x44')],qs[_0xcd16('0x45')](_0x3bcdbb['query'][_0xcd16('0x45')]));_0x563446['attributes']=_0x563446[_0xcd16('0x46')]['length']?_0x563446[_0xcd16('0x46')]:_0x275f64[_0xcd16('0x44')];if(!_0x3bcdbb[_0xcd16('0x40')]['hasOwnProperty']('nolimit')){_0x563446['limit']=qs[_0xcd16('0x2f')](_0x3bcdbb['query'][_0xcd16('0x2f')]);_0x563446[_0xcd16('0x2d')]=qs[_0xcd16('0x2d')](_0x3bcdbb[_0xcd16('0x40')]['offset']);}_0x563446['order']=qs[_0xcd16('0x47')](_0x3bcdbb['query'][_0xcd16('0x47')]);_0x563446[_0xcd16('0x48')]=qs['filters'](_[_0xcd16('0x49')](_0x3bcdbb[_0xcd16('0x40')],_0x275f64[_0xcd16('0x42')]),_0xb78228);if(_0x3bcdbb['query']['filter']){_0x563446[_0xcd16('0x48')]=_[_0xcd16('0x4a')](_0x563446[_0xcd16('0x48')],{'$or':_[_0xcd16('0x3f')](_0xb78228,function(_0x29d947){if(_0x29d947[_0xcd16('0x3d')]!==_0xcd16('0x4b')){var _0x496a9c={};_0x496a9c[_0x29d947['name']]={'$like':'%'+_0x3bcdbb[_0xcd16('0x40')][_0xcd16('0x4c')]+'%'};return _0x496a9c;}})});}_0x563446=_['merge']({},_0x563446,_0x3bcdbb[_0xcd16('0x4d')]);var _0xd45349={'where':_0x563446[_0xcd16('0x48')]};return db[_0xcd16('0x3a')][_0xcd16('0x30')](_0xd45349)[_0xcd16('0x20')](function(_0x273b1c){_0xb527cd['count']=_0x273b1c;if(_0x3bcdbb[_0xcd16('0x40')]['includeAll']){_0x563446['include']=[{'all':!![]}];}return db[_0xcd16('0x3a')]['findAll'](_0x563446);})['then'](function(_0x4eb9c3){_0xb527cd[_0xcd16('0x4e')]=_0x4eb9c3;return _0xb527cd;})[_0xcd16('0x20')](respondWithFilteredResult(_0x3b37f8,_0x563446))[_0xcd16('0x29')](handleError(_0x3b37f8,null));};exports['show']=function(_0x325ac2,_0x2d6f1f){var _0xc102f={'raw':!![],'where':{'id':_0x325ac2[_0xcd16('0x4f')]['id']}},_0x46187a={};_0x46187a[_0xcd16('0x44')]=_[_0xcd16('0x41')](db[_0xcd16('0x3a')]['rawAttributes']);_0x46187a['query']=_[_0xcd16('0x41')](_0x325ac2[_0xcd16('0x40')]);_0x46187a['filters']=_['intersection'](_0x46187a['model'],_0x46187a[_0xcd16('0x40')]);_0xc102f[_0xcd16('0x46')]=_[_0xcd16('0x43')](_0x46187a['model'],qs[_0xcd16('0x45')](_0x325ac2[_0xcd16('0x40')]['fields']));_0xc102f['attributes']=_0xc102f[_0xcd16('0x46')]['length']?_0xc102f[_0xcd16('0x46')]:_0x46187a[_0xcd16('0x44')];if(_0x325ac2[_0xcd16('0x40')]['includeAll']){_0xc102f['include']=[{'all':!![]}];}_0xc102f=_[_0xcd16('0x4a')]({},_0xc102f,_0x325ac2[_0xcd16('0x4d')]);return db[_0xcd16('0x3a')][_0xcd16('0x50')](_0xc102f)[_0xcd16('0x20')](handleEntityNotFound(_0x2d6f1f,null))[_0xcd16('0x20')](respondWithResult(_0x2d6f1f,null))['catch'](handleError(_0x2d6f1f,null));};exports[_0xcd16('0x51')]=function(_0x2fac30,_0x924e84){return db[_0xcd16('0x3a')][_0xcd16('0x51')](_0x2fac30[_0xcd16('0x52')],{})[_0xcd16('0x20')](respondWithResult(_0x924e84,0xc9))[_0xcd16('0x29')](handleError(_0x924e84,null));};exports[_0xcd16('0x35')]=function(_0x3c5c33,_0x2d897a){if(_0x3c5c33['body']['id']){delete _0x3c5c33[_0xcd16('0x52')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x3c5c33['params']['id']}})['then'](handleEntityNotFound(_0x2d897a,null))[_0xcd16('0x20')](saveUpdates(_0x3c5c33[_0xcd16('0x52')],null))[_0xcd16('0x20')](respondWithResult(_0x2d897a,null))[_0xcd16('0x29')](handleError(_0x2d897a,null));};exports[_0xcd16('0x53')]=function(_0x5025c0,_0x44087d){return db[_0xcd16('0x3a')][_0xcd16('0x50')]({'where':{'id':_0x5025c0[_0xcd16('0x4f')]['id']}})[_0xcd16('0x20')](handleEntityNotFound(_0x44087d,null))[_0xcd16('0x20')](removeEntity(_0x44087d,null))[_0xcd16('0x29')](handleError(_0x44087d,null));};exports[_0xcd16('0x54')]=function(_0x329500,_0x8ba1cf){return db[_0xcd16('0x3a')]['describe']()[_0xcd16('0x20')](respondWithResult(_0x8ba1cf,null))['catch'](handleError(_0x8ba1cf,null));};var interaction_log=require(_0xcd16('0x12'))(_0xcd16('0x55'));exports[_0xcd16('0x56')]=function(_0x34cac5,_0x1b1c75,_0x49234f){var _0x4dc379={'agent':{},'channel':'chat'};if(_0x34cac5[_0xcd16('0x52')]['id']){delete _0x34cac5[_0xcd16('0x52')]['id'];}_0x34cac5[_0xcd16('0x52')][_0xcd16('0x57')]=!![];_0x34cac5[_0xcd16('0x52')][_0xcd16('0x58')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x34cac5[_0xcd16('0x52')][_0xcd16('0x59')]=_0x34cac5['body'][_0xcd16('0x59')]||_0x34cac5[_0xcd16('0x5a')]['id'];_0x4dc379['agent']['id']=_0x34cac5[_0xcd16('0x52')]['UserId'];return db[_0xcd16('0x3a')][_0xcd16('0x50')]({'where':{'id':_0x34cac5['params']['id'],'UserId':null}})[_0xcd16('0x20')](handleEntityNotFound(_0x1b1c75,null))[_0xcd16('0x20')](saveUpdates(_0x34cac5[_0xcd16('0x52')],null))[_0xcd16('0x20')](function(_0x3be87c){if(_0x3be87c){_0x4dc379['message']=_0x3be87c['get']({'plain':!![]});return db['ChatInteraction'][_0xcd16('0x50')]({'where':{'id':_0x3be87c[_0xcd16('0x5b')]}});}return null;})[_0xcd16('0x20')](handleEntityNotFound(_0x1b1c75,null))[_0xcd16('0x20')](function(_0x385842){if(_0x385842){return _0x385842[_0xcd16('0x35')]({'UserId':_0x34cac5[_0xcd16('0x52')][_0xcd16('0x59')],'read1stAt':_['isNil'](_0x385842['read1stAt'])?moment()['format'](_0xcd16('0x5c')):undefined});}return null;})[_0xcd16('0x20')](function(_0x2431c3){if(_0x2431c3){_0x4dc379[_0xcd16('0x5d')]=_0x2431c3[_0xcd16('0x5e')]({'plain':!![]});interaction_log['info'](_0xcd16('0x5f'),_0x34cac5[_0xcd16('0x5a')]['id'],_0x34cac5['user']['name'],_0x34cac5['user'][_0xcd16('0x60')],_0x4dc379[_0xcd16('0x5d')]['id'],_0x34cac5['body']?JSON['stringify'](_0x34cac5[_0xcd16('0x52')]):_0xcd16('0x61'));return respondWithRpcPromise(_0xcd16('0x62'),_0xcd16('0x63'),_0x4dc379);}return null;})[_0xcd16('0x20')](function(_0x150e7d){var _0x253d2b=_0xcd16('0x64')+_0x150e7d[_0xcd16('0x26')]['ContactId'];return db[_0xcd16('0x65')][_0xcd16('0x40')](_0x253d2b,{'type':db['Sequelize'][_0xcd16('0x66')]['SELECT'],'raw':!![]})[_0xcd16('0x20')](function(_0x261f4b){return _0x261f4b;});})[_0xcd16('0x20')](function(_0x46695a){if(_0x46695a){_0x4dc379[_0xcd16('0x26')][_0xcd16('0x67')]=_0x46695a[0x0];if(!_0x34cac5[_0xcd16('0x52')][_0xcd16('0x59')])return;return db[_0xcd16('0x68')][_0xcd16('0x50')]({'where':{'id':_0x34cac5[_0xcd16('0x52')]['UserId'],'role':_0xcd16('0x69')},'attributes':['id',_0xcd16('0x37'),'fullname',_0xcd16('0x6a'),_0xcd16('0x6b')],'raw':!![]});}return null;})[_0xcd16('0x20')](function(_0x775bde){if(!_0x775bde)return null;_0x4dc379['message'][_0xcd16('0x69')]=_0x775bde;return _0x4dc379;})[_0xcd16('0x20')](function(_0xa9091c){if(_0xa9091c){if(_0x34cac5[_0xcd16('0x52')]['manual']){_0x4dc379['message'][_0xcd16('0x6c')]=util[_0xcd16('0x6d')](_0xcd16('0x6e'),_0x34cac5[_0xcd16('0x5a')][_0xcd16('0x37')]);_0x4dc379[_0xcd16('0x26')]['channel']=_0x4dc379[_0xcd16('0x6f')];_0x4dc379['message']['motionChannel']=_0x4dc379[_0xcd16('0x6f')];_0x4dc379[_0xcd16('0x26')][_0xcd16('0x70')]=_0xcd16('0x56');return respondWithRpcPromise('EventManager',_0xcd16('0x71'),{'event':'acceptmessage','message':_[_0xcd16('0x4a')](_0x4dc379['message'],JSON[_0xcd16('0x72')](_0x4dc379['interaction'][_0xcd16('0x73')]))},client9002)[_0xcd16('0x20')](function(){return _0x4dc379;});}return _0x4dc379;}return null;})[_0xcd16('0x20')](respondWithResult(_0x1b1c75,null))['catch'](handleError(_0x1b1c75,null));};var interaction_log=require(_0xcd16('0x12'))('chat-interactions');exports[_0xcd16('0x74')]=function(_0x42448e,_0x1e821c,_0x3a8ebb){var _0x242279={'agent':{},'channel':_0xcd16('0x75')};if(_0x42448e[_0xcd16('0x52')]['id']){delete _0x42448e['body']['id'];}_0x42448e['body'][_0xcd16('0x59')]=_0x42448e['body']['UserId']||_0x42448e[_0xcd16('0x5a')]['id'];_0x242279[_0xcd16('0x69')]['id']=_0x42448e[_0xcd16('0x52')][_0xcd16('0x59')];return db['ChatMessage'][_0xcd16('0x50')]({'where':{'id':_0x42448e[_0xcd16('0x4f')]['id'],'UserId':null}})[_0xcd16('0x20')](handleEntityNotFound(_0x1e821c,null))[_0xcd16('0x20')](function(_0x320cff){if(_0x320cff){_0x242279[_0xcd16('0x26')]=_0x320cff[_0xcd16('0x5e')]({'plain':!![]});return db[_0xcd16('0x76')][_0xcd16('0x50')]({'where':{'id':_0x320cff[_0xcd16('0x5b')]}});}return null;})[_0xcd16('0x20')](handleEntityNotFound(_0x1e821c,null))[_0xcd16('0x20')](function(_0x14caa6){if(_0x14caa6){_0x242279[_0xcd16('0x5d')]=_0x14caa6[_0xcd16('0x5e')]({'plain':!![]});interaction_log[_0xcd16('0x77')](_0xcd16('0x78'),_0x42448e['user']['id'],_0x42448e[_0xcd16('0x5a')]['name'],_0x42448e[_0xcd16('0x5a')][_0xcd16('0x60')],_0x242279[_0xcd16('0x5d')]['id'],_0x42448e[_0xcd16('0x52')]?JSON[_0xcd16('0x23')](_0x42448e['body']):_0xcd16('0x61'));return respondWithRpcPromise('RejectMessage',_0xcd16('0x79'),_0x242279);}return null;})['then'](function(_0x3c3c88){var _0x45e1ef=_0xcd16('0x64')+_0x3c3c88['message'][_0xcd16('0x7a')];return db[_0xcd16('0x65')]['query'](_0x45e1ef,{'type':db['Sequelize'][_0xcd16('0x66')]['SELECT'],'raw':!![]})[_0xcd16('0x20')](function(_0x26681c){return _0x26681c;});})[_0xcd16('0x20')](function(_0x24e0f1){if(_0x24e0f1){_0x242279[_0xcd16('0x26')][_0xcd16('0x67')]=_0x24e0f1[0x0];if(!_0x42448e[_0xcd16('0x52')][_0xcd16('0x59')])return;return db['User'][_0xcd16('0x50')]({'where':{'id':_0x42448e[_0xcd16('0x52')][_0xcd16('0x59')],'role':'agent'},'attributes':['id',_0xcd16('0x37'),_0xcd16('0x7b'),'email',_0xcd16('0x6b')],'raw':!![]});}return null;})[_0xcd16('0x20')](function(_0x2a6603){if(!_0x2a6603)return null;_0x242279[_0xcd16('0x26')][_0xcd16('0x69')]=_0x2a6603;return _0x242279;})[_0xcd16('0x20')](function(_0x5720e0){if(_0x5720e0){_0x5720e0[_0xcd16('0x26')][_0xcd16('0x6c')]=util['format'](_0xcd16('0x6e'),_0x42448e[_0xcd16('0x5a')][_0xcd16('0x37')]);_0x5720e0[_0xcd16('0x26')][_0xcd16('0x6f')]=_0x242279[_0xcd16('0x6f')];_0x5720e0[_0xcd16('0x26')][_0xcd16('0x7c')]=_0x242279['channel'];_0x5720e0[_0xcd16('0x26')]['event']=_0xcd16('0x74');respondWithRpcPromise(_0xcd16('0x71'),_0xcd16('0x71'),{'event':'rejectmessage','message':_[_0xcd16('0x4a')](_0x242279['message'],JSON[_0xcd16('0x72')](_0x242279['interaction'][_0xcd16('0x73')]))},client9002);return _0x242279;}return null;})['then'](respondWithResult(_0x1e821c,null))[_0xcd16('0x29')](handleError(_0x1e821c,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 7ee67e5..550d2d3 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 _0xc373=['../../mysqldb','ChatMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x34fe22,_0x4b0faa){var _0x126030=function(_0x4046c0){while(--_0x4046c0){_0x34fe22['push'](_0x34fe22['shift']());}};_0x126030(++_0x4b0faa);}(_0xc373,0x1df));var _0x3c37=function(_0x104a84,_0x285970){_0x104a84=_0x104a84-0x0;var _0x4973ff=_0xc373[_0x104a84];return _0x4973ff;};'use strict';var EventEmitter=require(_0x3c37('0x0'));var ChatMessage=require(_0x3c37('0x1'))['db'][_0x3c37('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x3c37('0x3')](0x0);var events={'afterCreate':_0x3c37('0x4'),'afterUpdate':'update','afterDestroy':_0x3c37('0x5')};function emitEvent(_0x41a507){return function(_0x5251a1,_0x3f2a51,_0x12460c){ChatMessageEvents[_0x3c37('0x6')](_0x41a507+':'+_0x5251a1['id'],_0x5251a1);ChatMessageEvents[_0x3c37('0x6')](_0x41a507,_0x5251a1);_0x12460c(null);};}for(var e in events){if(events[_0x3c37('0x7')](e)){var event=events[e];ChatMessage[_0x3c37('0x8')](e,emitEvent(event));}}module[_0x3c37('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0x659a=['ChatMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x2058e7,_0x17de44){var _0x53b5dc=function(_0x55b792){while(--_0x55b792){_0x2058e7['push'](_0x2058e7['shift']());}};_0x53b5dc(++_0x17de44);}(_0x659a,0xa1));var _0xa659=function(_0x2605dc,_0x50cf7e){_0x2605dc=_0x2605dc-0x0;var _0x4568c9=_0x659a[_0x2605dc];return _0x4568c9;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xa659('0x0'))['db'][_0xa659('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xa659('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa659('0x3'),'afterDestroy':_0xa659('0x4')};function emitEvent(_0x511b62){return function(_0x728709,_0x5d5b39,_0x5a561d){ChatMessageEvents[_0xa659('0x5')](_0x511b62+':'+_0x728709['id'],_0x728709);ChatMessageEvents[_0xa659('0x5')](_0x511b62,_0x728709);_0x5a561d(null);};}for(var e in events){if(events[_0xa659('0x6')](e)){var event=events[e];ChatMessage[_0xa659('0x7')](e,emitEvent(event));}}module[_0xa659('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 3f0fad8..e87fa67 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 _0xa3f5=['toLowerCase','out','isNil','UserId','ChatInteraction','findOne','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','FULLTEXT','models','get','direction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa3f5,0x80));var _0x5a3f=function(_0x214a14,_0xe382c6){_0x214a14=_0x214a14-0x0;var _0x4c2f73=_0xa3f5[_0x214a14];return _0x4c2f73;};'use strict';var _=require(_0x5a3f('0x0'));var util=require(_0x5a3f('0x1'));var logger=require('../../config/logger')(_0x5a3f('0x2'));var moment=require(_0x5a3f('0x3'));var BPromise=require(_0x5a3f('0x4'));var rp=require(_0x5a3f('0x5'));var fs=require('fs');var path=require(_0x5a3f('0x6'));var rimraf=require(_0x5a3f('0x7'));var config=require(_0x5a3f('0x8'));var attributes=require(_0x5a3f('0x9'));module[_0x5a3f('0xa')]=function(_0x31c79e,_0x4b43c7){return _0x31c79e[_0x5a3f('0xb')](_0x5a3f('0xc'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0x5a3f('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xf0dbd6,_0x473feb,_0x20d013){var _0x25490e=_0x31c79e[_0x5a3f('0xe')];var _0x2f5346=_0xf0dbd6[_0x5a3f('0xf')]({'plain':!![]});if(_0x2f5346['direction']['toLowerCase']()==='in'||_0x2f5346[_0x5a3f('0x10')][_0x5a3f('0x11')]()===_0x5a3f('0x12')&&!_0x2f5346['secret']&&!_[_0x5a3f('0x13')](_0x2f5346[_0x5a3f('0x14')])){_0x25490e[_0x5a3f('0x15')][_0x5a3f('0x16')]({'where':{'id':_0x2f5346['ChatInteractionId']}})[_0x5a3f('0x17')](function(_0x160a82){if(_0x160a82){_0x160a82['update']({'lastMsgAt':_0x2f5346[_0x5a3f('0x18')],'lastMsgDirection':_0x2f5346[_0x5a3f('0x10')][_0x5a3f('0x11')]()});}})[_0x5a3f('0x19')](function(_0x20aa4d){console[_0x5a3f('0x1a')](_0x20aa4d);});}_0x20d013();}},'charset':_0x5a3f('0x1b'),'collate':_0x5a3f('0x1c')});}; \ No newline at end of file +var _0x6d6a=['moment','bluebird','path','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','body','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','ChatInteraction','findOne','then','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x6d6a,0x192));var _0xa6d6=function(_0x4f11cb,_0x14e174){_0x4f11cb=_0x4f11cb-0x0;var _0x491488=_0x6d6a[_0x4f11cb];return _0x491488;};'use strict';var _=require(_0xa6d6('0x0'));var util=require(_0xa6d6('0x1'));var logger=require(_0xa6d6('0x2'))(_0xa6d6('0x3'));var moment=require(_0xa6d6('0x4'));var BPromise=require(_0xa6d6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa6d6('0x6'));var rimraf=require('rimraf');var config=require(_0xa6d6('0x7'));var attributes=require(_0xa6d6('0x8'));module[_0xa6d6('0x9')]=function(_0x3c9342,_0xb17564){return _0x3c9342[_0xa6d6('0xa')](_0xa6d6('0xb'),attributes,{'tableName':_0xa6d6('0xc'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xa6d6('0xd')],'type':_0xa6d6('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a901e,_0x504d88,_0x444d74){var _0x16661e=_0x3c9342['models'];var _0x3200b5=_0x2a901e[_0xa6d6('0xf')]({'plain':!![]});if(_0x3200b5[_0xa6d6('0x10')][_0xa6d6('0x11')]()==='in'||_0x3200b5[_0xa6d6('0x10')][_0xa6d6('0x11')]()===_0xa6d6('0x12')&&!_0x3200b5['secret']&&!_[_0xa6d6('0x13')](_0x3200b5[_0xa6d6('0x14')])){_0x16661e[_0xa6d6('0x15')][_0xa6d6('0x16')]({'where':{'id':_0x3200b5['ChatInteractionId']}})[_0xa6d6('0x17')](function(_0x734ac5){if(_0x734ac5){_0x734ac5[_0xa6d6('0x18')]({'lastMsgAt':_0x3200b5[_0xa6d6('0x19')],'lastMsgDirection':_0x3200b5['direction'][_0xa6d6('0x11')]()});}})[_0xa6d6('0x1a')](function(_0x4ec12c){console[_0xa6d6('0x1b')](_0x4ec12c);});}_0x444d74();}},'charset':_0xa6d6('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index ca91753..024b711 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 _0x63f1=['stringify','error','code','message','info','result','catch','create','body','options','raw','CreateChatMessage','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x63f1,0x1da));var _0x163f=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x63f1[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x163f('0x0'));var util=require(_0x163f('0x1'));var moment=require('moment');var BPromise=require(_0x163f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x163f('0x3'));var db=require(_0x163f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x163f('0x5'))(_0x163f('0x6'));var config=require(_0x163f('0x7'));var jayson=require(_0x163f('0x8'));var client=jayson[_0x163f('0x9')][_0x163f('0xa')]({'port':0x232a});config[_0x163f('0xb')]=_[_0x163f('0xc')](config['redis'],{'host':_0x163f('0xd'),'port':0x18eb});var socket=require(_0x163f('0xe'))(new Redis(config[_0x163f('0xb')]));require(_0x163f('0xf'))['register'](socket);function respondWithRpcPromise(_0x11d3df,_0xc1f46c,_0x3510ff){return new BPromise(function(_0x72125d,_0x2eafef){return client['request'](_0x11d3df,_0x3510ff)[_0x163f('0x10')](function(_0x18c825){logger['info'](_0x163f('0x11'),_0xc1f46c,_0x163f('0x12'));logger[_0x163f('0x13')](_0x163f('0x14'),_0xc1f46c,'request\x20sent',JSON[_0x163f('0x15')](_0x18c825));if(_0x18c825[_0x163f('0x16')]){if(_0x18c825[_0x163f('0x16')][_0x163f('0x17')]===0x1f4){logger[_0x163f('0x16')](_0x163f('0x11'),_0xc1f46c,_0x18c825[_0x163f('0x16')][_0x163f('0x18')]);return _0x2eafef(_0x18c825[_0x163f('0x16')]['message']);}logger[_0x163f('0x16')](_0x163f('0x11'),_0xc1f46c,_0x18c825[_0x163f('0x16')][_0x163f('0x18')]);return _0x72125d(_0x18c825[_0x163f('0x16')]['message']);}else{logger[_0x163f('0x19')](_0x163f('0x11'),_0xc1f46c,'request\x20sent');_0x72125d(_0x18c825[_0x163f('0x1a')][_0x163f('0x18')]);}})[_0x163f('0x1b')](function(_0x2be697){logger[_0x163f('0x16')](_0x163f('0x11'),_0xc1f46c,_0x2be697);_0x2eafef(_0x2be697);});});}exports['CreateChatMessage']=function(_0x29534f){var _0x429f38=this;return new Promise(function(_0x57ff90,_0x1d8a9d){return db['ChatMessage'][_0x163f('0x1c')](_0x29534f[_0x163f('0x1d')],{'raw':_0x29534f[_0x163f('0x1e')]?_0x29534f[_0x163f('0x1e')][_0x163f('0x1f')]===undefined?!![]:![]:!![]})[_0x163f('0x10')](function(_0x30da66){logger['info'](_0x163f('0x20'),_0x29534f);logger['debug']('CreateChatMessage',_0x29534f,JSON[_0x163f('0x15')](_0x30da66));_0x57ff90(_0x30da66);})['catch'](function(_0x1fa748){logger[_0x163f('0x16')](_0x163f('0x20'),_0x1fa748[_0x163f('0x18')],_0x29534f);_0x1d8a9d(_0x429f38[_0x163f('0x16')](0x1f4,_0x1fa748[_0x163f('0x18')]));});});}; \ No newline at end of file +var _0x5914=['stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0x240fdd,_0x1372d8){var _0x44e066=function(_0x1ba9de){while(--_0x1ba9de){_0x240fdd['push'](_0x240fdd['shift']());}};_0x44e066(++_0x1372d8);}(_0x5914,0x198));var _0x4591=function(_0x388864,_0x3879e4){_0x388864=_0x388864-0x0;var _0x2a238a=_0x5914[_0x388864];return _0x2a238a;};'use strict';var _=require(_0x4591('0x0'));var util=require('util');var moment=require(_0x4591('0x1'));var BPromise=require(_0x4591('0x2'));var rs=require(_0x4591('0x3'));var fs=require('fs');var Redis=require(_0x4591('0x4'));var db=require(_0x4591('0x5'))['db'];var utils=require(_0x4591('0x6'));var logger=require(_0x4591('0x7'))('rpc');var config=require(_0x4591('0x8'));var jayson=require(_0x4591('0x9'));var client=jayson['client'][_0x4591('0xa')]({'port':0x232a});config[_0x4591('0xb')]=_[_0x4591('0xc')](config[_0x4591('0xb')],{'host':_0x4591('0xd'),'port':0x18eb});var socket=require(_0x4591('0xe'))(new Redis(config[_0x4591('0xb')]));require(_0x4591('0xf'))[_0x4591('0x10')](socket);function respondWithRpcPromise(_0x4e486e,_0x334cab,_0xdb7c5b){return new BPromise(function(_0x287546,_0x2feae8){return client[_0x4591('0x11')](_0x4e486e,_0xdb7c5b)[_0x4591('0x12')](function(_0x4779c3){logger[_0x4591('0x13')](_0x4591('0x14'),_0x334cab,_0x4591('0x15'));logger[_0x4591('0x16')](_0x4591('0x17'),_0x334cab,_0x4591('0x15'),JSON[_0x4591('0x18')](_0x4779c3));if(_0x4779c3['error']){if(_0x4779c3[_0x4591('0x19')][_0x4591('0x1a')]===0x1f4){logger[_0x4591('0x19')]('ChatMessage,\x20%s,\x20%s',_0x334cab,_0x4779c3[_0x4591('0x19')]['message']);return _0x2feae8(_0x4779c3['error'][_0x4591('0x1b')]);}logger[_0x4591('0x19')](_0x4591('0x14'),_0x334cab,_0x4779c3[_0x4591('0x19')][_0x4591('0x1b')]);return _0x287546(_0x4779c3[_0x4591('0x19')][_0x4591('0x1b')]);}else{logger['info'](_0x4591('0x14'),_0x334cab,_0x4591('0x15'));_0x287546(_0x4779c3[_0x4591('0x1c')][_0x4591('0x1b')]);}})[_0x4591('0x1d')](function(_0x5ea028){logger[_0x4591('0x19')]('ChatMessage,\x20%s,\x20%s',_0x334cab,_0x5ea028);_0x2feae8(_0x5ea028);});});}exports[_0x4591('0x1e')]=function(_0x2a1b19){var _0x67691a=this;return new Promise(function(_0x2142d8,_0x89f137){return db[_0x4591('0x1f')][_0x4591('0x20')](_0x2a1b19[_0x4591('0x21')],{'raw':_0x2a1b19[_0x4591('0x22')]?_0x2a1b19[_0x4591('0x22')][_0x4591('0x23')]===undefined?!![]:![]:!![]})[_0x4591('0x12')](function(_0x44cfce){logger[_0x4591('0x13')](_0x4591('0x1e'),_0x2a1b19);logger['debug']('CreateChatMessage',_0x2a1b19,JSON['stringify'](_0x44cfce));_0x2142d8(_0x44cfce);})[_0x4591('0x1d')](function(_0x19eaa0){logger[_0x4591('0x19')](_0x4591('0x1e'),_0x19eaa0[_0x4591('0x1b')],_0x2a1b19);_0x89f137(_0x67691a[_0x4591('0x19')](0x1f4,_0x19eaa0[_0x4591('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 43f20ee..16b45ea 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 _0xa630=['removeListener','register','length','chatMessage:','./chatMessage.events','save'];(function(_0x3e5631,_0x39ef03){var _0x2749ad=function(_0x23f5fe){while(--_0x23f5fe){_0x3e5631['push'](_0x3e5631['shift']());}};_0x2749ad(++_0x39ef03);}(_0xa630,0xbe));var _0x0a63=function(_0x396c73,_0x4e8eef){_0x396c73=_0x396c73-0x0;var _0x51e6f2=_0xa630[_0x396c73];return _0x51e6f2;};'use strict';var ChatMessageEvents=require(_0x0a63('0x0'));var events=[_0x0a63('0x1'),'remove','update'];function createListener(_0x1a9586,_0x4f6b34){return function(_0xd0a045){_0x4f6b34['emit'](_0x1a9586,_0xd0a045);};}function removeListener(_0x91a747,_0x3bcb90){return function(){ChatMessageEvents[_0x0a63('0x2')](_0x91a747,_0x3bcb90);};}exports[_0x0a63('0x3')]=function(_0x37b4c9){for(var _0x4b7474=0x0,_0x2760b0=events[_0x0a63('0x4')];_0x4b7474<_0x2760b0;_0x4b7474++){var _0xc2dcd7=events[_0x4b7474];var _0x41d21d=createListener(_0x0a63('0x5')+_0xc2dcd7,_0x37b4c9);ChatMessageEvents['on'](_0xc2dcd7,_0x41d21d);}}; \ No newline at end of file +var _0x93bb=['update','emit','register','length','chatMessage:','./chatMessage.events','save','remove'];(function(_0x2aa4c8,_0x1f65b4){var _0x29edb8=function(_0x77caef){while(--_0x77caef){_0x2aa4c8['push'](_0x2aa4c8['shift']());}};_0x29edb8(++_0x1f65b4);}(_0x93bb,0x135));var _0xb93b=function(_0xa665e2,_0x47dee7){_0xa665e2=_0xa665e2-0x0;var _0x10c713=_0x93bb[_0xa665e2];return _0x10c713;};'use strict';var ChatMessageEvents=require(_0xb93b('0x0'));var events=[_0xb93b('0x1'),_0xb93b('0x2'),_0xb93b('0x3')];function createListener(_0xef52ba,_0x9b62ab){return function(_0x3ae317){_0x9b62ab[_0xb93b('0x4')](_0xef52ba,_0x3ae317);};}function removeListener(_0x3eb285,_0x355196){return function(){ChatMessageEvents['removeListener'](_0x3eb285,_0x355196);};}exports[_0xb93b('0x5')]=function(_0x1ec4dd){for(var _0x4e89c7=0x0,_0x3c4dcf=events[_0xb93b('0x6')];_0x4e89c7<_0x3c4dcf;_0x4e89c7++){var _0x516b0b=events[_0x4e89c7];var _0x35c135=createListener(_0xb93b('0x7')+_0x516b0b,_0x1ec4dd);ChatMessageEvents['on'](_0x516b0b,_0x35c135);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index eb12da0..1289f48 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 _0xca74=['update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','create'];(function(_0x358a10,_0x22c08c){var _0x3c0578=function(_0x39971d){while(--_0x39971d){_0x358a10['push'](_0x358a10['shift']());}};_0x3c0578(++_0x22c08c);}(_0xca74,0x103));var _0x4ca7=function(_0x4fb797,_0x200ee6){_0x4fb797=_0x4fb797-0x0;var _0x34e096=_0xca74[_0x4fb797];return _0x34e096;};'use strict';var multer=require(_0x4ca7('0x0'));var util=require(_0x4ca7('0x1'));var path=require('path');var timeout=require(_0x4ca7('0x2'));var express=require('express');var router=express[_0x4ca7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4ca7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4ca7('0x5'));var controller=require(_0x4ca7('0x6'));router[_0x4ca7('0x7')]('/',auth[_0x4ca7('0x8')](),controller['index']);router[_0x4ca7('0x7')](_0x4ca7('0x9'),auth[_0x4ca7('0x8')](),controller[_0x4ca7('0xa')]);router[_0x4ca7('0x7')](_0x4ca7('0xb'),auth[_0x4ca7('0x8')](),controller[_0x4ca7('0xc')]);router[_0x4ca7('0xd')]('/',auth['isAuthenticated'](),interaction[_0x4ca7('0xe')]('chat','chatmessage:create'),controller[_0x4ca7('0xf')]);router['put'](_0x4ca7('0xb'),controller[_0x4ca7('0x10')]);router[_0x4ca7('0x11')](_0x4ca7('0x12'),auth[_0x4ca7('0x8')](),controller[_0x4ca7('0x13')]);router[_0x4ca7('0x11')](_0x4ca7('0x14'),auth[_0x4ca7('0x8')](),controller[_0x4ca7('0x15')]);router[_0x4ca7('0x16')](_0x4ca7('0xb'),auth[_0x4ca7('0x8')](),controller[_0x4ca7('0x17')]);module[_0x4ca7('0x18')]=router; \ No newline at end of file +var _0xef4c=['describe','/:id','tracked','chat','create','put','update','/:id/accept','accept','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x2de630,_0x534adc){var _0x35259e=function(_0x5672a3){while(--_0x5672a3){_0x2de630['push'](_0x2de630['shift']());}};_0x35259e(++_0x534adc);}(_0xef4c,0xd9));var _0xcef4=function(_0x3659e5,_0x2dd313){_0x3659e5=_0x3659e5-0x0;var _0x38d480=_0xef4c[_0x3659e5];return _0x38d480;};'use strict';var multer=require(_0xcef4('0x0'));var util=require(_0xcef4('0x1'));var path=require(_0xcef4('0x2'));var timeout=require(_0xcef4('0x3'));var express=require(_0xcef4('0x4'));var router=express['Router']();var fs_extra=require(_0xcef4('0x5'));var auth=require(_0xcef4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcef4('0x7'));var controller=require(_0xcef4('0x8'));router[_0xcef4('0x9')]('/',auth[_0xcef4('0xa')](),controller[_0xcef4('0xb')]);router[_0xcef4('0x9')](_0xcef4('0xc'),auth[_0xcef4('0xa')](),controller[_0xcef4('0xd')]);router[_0xcef4('0x9')](_0xcef4('0xe'),auth[_0xcef4('0xa')](),controller['show']);router['post']('/',auth[_0xcef4('0xa')](),interaction[_0xcef4('0xf')](_0xcef4('0x10'),'chatmessage:create'),controller[_0xcef4('0x11')]);router[_0xcef4('0x12')](_0xcef4('0xe'),controller[_0xcef4('0x13')]);router[_0xcef4('0x12')](_0xcef4('0x14'),auth[_0xcef4('0xa')](),controller[_0xcef4('0x15')]);router[_0xcef4('0x12')]('/:id/reject',auth['isAuthenticated'](),controller['reject']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xcef4('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 5dc3d10..038ca23 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 _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x329c94,_0x3f64bb){var _0x40e96d=function(_0x4309b8){while(--_0x4309b8){_0x329c94['push'](_0x329c94['shift']());}};_0x40e96d(++_0x3f64bb);}(_0xdb28,0x106));var _0x8db2=function(_0x3a63b6,_0x1cc231){_0x3a63b6=_0x3a63b6-0x0;var _0x54ac16=_0xdb28[_0x3a63b6];return _0x54ac16;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x2032=['medium','exports','TEXT'];(function(_0x18ee80,_0x2adf1c){var _0x2f60c2=function(_0x2bd265){while(--_0x2bd265){_0x18ee80['push'](_0x18ee80['shift']());}};_0x2f60c2(++_0x2adf1c);}(_0x2032,0xd9));var _0x2203=function(_0x8ada22,_0xb3bfb5){_0x8ada22=_0x8ada22-0x0;var _0x2b3ee3=_0x2032[_0x8ada22];return _0x2b3ee3;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 704cd35..ebb030b 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(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x7a54,0x106));var _0x47a5=function(_0x3bbbc6,_0x5d6cac){_0x3bbbc6=_0x3bbbc6-0x0;var _0x39a375=_0x7a54[_0x3bbbc6];return _0x39a375;};'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 _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x328471,_0x1c8d84){var _0x5b097a=function(_0x27a123){while(--_0x27a123){_0x328471['push'](_0x328471['shift']());}};_0x5b097a(++_0x1c8d84);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 327beff..50394d3 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee7c=['setMaxListeners','remove','emit','hasOwnProperty','exports','../../mysqldb','ChatOfflineMessage'];(function(_0x4160de,_0x147d55){var _0x3221c7=function(_0x26ab21){while(--_0x26ab21){_0x4160de['push'](_0x4160de['shift']());}};_0x3221c7(++_0x147d55);}(_0xee7c,0x14e));var _0xcee7=function(_0x288cc0,_0xcb098e){_0x288cc0=_0x288cc0-0x0;var _0x2e1883=_0xee7c[_0x288cc0];return _0x2e1883;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0xcee7('0x0'))['db'][_0xcee7('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xcee7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xcee7('0x3')};function emitEvent(_0x4e26aa){return function(_0x20da40,_0x532afe,_0x4c04ee){ChatOfflineMessageEvents['emit'](_0x4e26aa+':'+_0x20da40['id'],_0x20da40);ChatOfflineMessageEvents[_0xcee7('0x4')](_0x4e26aa,_0x20da40);_0x4c04ee(null);};}for(var e in events){if(events[_0xcee7('0x5')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0xcee7('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x072c=['../../mysqldb','ChatOfflineMessage','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events'];(function(_0x135623,_0x14dd72){var _0x10b6ae=function(_0xb8ff6b){while(--_0xb8ff6b){_0x135623['push'](_0x135623['shift']());}};_0x10b6ae(++_0x14dd72);}(_0x072c,0x18b));var _0xc072=function(_0x1a2164,_0x5732c8){_0x1a2164=_0x1a2164-0x0;var _0x3bd001=_0x072c[_0x1a2164];return _0x3bd001;};'use strict';var EventEmitter=require(_0xc072('0x0'));var ChatOfflineMessage=require(_0xc072('0x1'))['db'][_0xc072('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xc072('0x3')](0x0);var events={'afterCreate':_0xc072('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xf62f93){return function(_0xe364be,_0x56ffb2,_0x5ad45f){ChatOfflineMessageEvents[_0xc072('0x5')](_0xf62f93+':'+_0xe364be['id'],_0xe364be);ChatOfflineMessageEvents[_0xc072('0x5')](_0xf62f93,_0xe364be);_0x5ad45f(null);};}for(var e in events){if(events[_0xc072('0x6')](e)){var event=events[e];ChatOfflineMessage[_0xc072('0x7')](e,emitEvent(event));}}module[_0xc072('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index a018953..f1d7245 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 _0x4118=['exports','ChatOfflineMessage','chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes'];(function(_0x3fb780,_0x540d09){var _0x49bcf4=function(_0x122b11){while(--_0x122b11){_0x3fb780['push'](_0x3fb780['shift']());}};_0x49bcf4(++_0x540d09);}(_0x4118,0xcc));var _0x8411=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x4118[_0x2dea24];return _0x309d58;};'use strict';var attributes=require(_0x8411('0x0'));module[_0x8411('0x1')]=function(_0x386a32){return _0x386a32['define'](_0x8411('0x2'),attributes,{'tableName':_0x8411('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8411('0x4'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xfb3a=['ChatOfflineMessage','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define'];(function(_0xb97335,_0x459b23){var _0x4935ab=function(_0x5268dd){while(--_0x5268dd){_0xb97335['push'](_0xb97335['shift']());}};_0x4935ab(++_0x459b23);}(_0xfb3a,0x197));var _0xafb3=function(_0x4bf9c4,_0x934618){_0x4bf9c4=_0x4bf9c4-0x0;var _0x3419b0=_0xfb3a[_0x4bf9c4];return _0x3419b0;};'use strict';var attributes=require(_0xafb3('0x0'));module[_0xafb3('0x1')]=function(_0x12147d){return _0x12147d[_0xafb3('0x2')](_0xafb3('0x3'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xafb3('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 1b4f06a..1666f87 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 _0xa459=['../../config/logger','client','request','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4cdb4b,_0x8feb31){var _0x1769ef=function(_0x5261e4){while(--_0x5261e4){_0x4cdb4b['push'](_0x4cdb4b['shift']());}};_0x1769ef(++_0x8feb31);}(_0xa459,0x1d8));var _0x9a45=function(_0x1fbd96,_0x5caae5){_0x1fbd96=_0x1fbd96-0x0;var _0x427f59=_0xa459[_0x1fbd96];return _0x427f59;};'use strict';var _=require(_0x9a45('0x0'));var util=require(_0x9a45('0x1'));var moment=require(_0x9a45('0x2'));var BPromise=require(_0x9a45('0x3'));var rs=require(_0x9a45('0x4'));var fs=require('fs');var Redis=require(_0x9a45('0x5'));var db=require(_0x9a45('0x6'))['db'];var utils=require(_0x9a45('0x7'));var logger=require(_0x9a45('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9a45('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ea9ec,_0x430dae,_0x2fc5db){return new BPromise(function(_0x347d22,_0xa3f541){return client[_0x9a45('0xa')](_0x2ea9ec,_0x2fc5db)['then'](function(_0x1144b0){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x430dae,'request\x20sent');logger[_0x9a45('0xb')](_0x9a45('0xc'),_0x430dae,_0x9a45('0xd'),JSON['stringify'](_0x1144b0));if(_0x1144b0[_0x9a45('0xe')]){if(_0x1144b0[_0x9a45('0xe')][_0x9a45('0xf')]===0x1f4){logger[_0x9a45('0xe')](_0x9a45('0x10'),_0x430dae,_0x1144b0[_0x9a45('0xe')][_0x9a45('0x11')]);return _0xa3f541(_0x1144b0[_0x9a45('0xe')][_0x9a45('0x11')]);}logger['error'](_0x9a45('0x10'),_0x430dae,_0x1144b0[_0x9a45('0xe')][_0x9a45('0x11')]);return _0x347d22(_0x1144b0['error'][_0x9a45('0x11')]);}else{logger['info'](_0x9a45('0x10'),_0x430dae,'request\x20sent');_0x347d22(_0x1144b0[_0x9a45('0x12')][_0x9a45('0x11')]);}})[_0x9a45('0x13')](function(_0x1ab361){logger[_0x9a45('0xe')](_0x9a45('0x10'),_0x430dae,_0x1ab361);_0xa3f541(_0x1ab361);});});} \ No newline at end of file +var _0x0763=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x217553,_0x51612b){var _0x178524=function(_0x491bf5){while(--_0x491bf5){_0x217553['push'](_0x217553['shift']());}};_0x178524(++_0x51612b);}(_0x0763,0x87));var _0x3076=function(_0x2f1172,_0x5f5b26){_0x2f1172=_0x2f1172-0x0;var _0x58e374=_0x0763[_0x2f1172];return _0x58e374;};'use strict';var _=require(_0x3076('0x0'));var util=require('util');var moment=require(_0x3076('0x1'));var BPromise=require(_0x3076('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3076('0x3'));var db=require(_0x3076('0x4'))['db'];var utils=require(_0x3076('0x5'));var logger=require(_0x3076('0x6'))('rpc');var config=require(_0x3076('0x7'));var jayson=require(_0x3076('0x8'));var client=jayson[_0x3076('0x9')][_0x3076('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18b4c8,_0x5efd65,_0x2776c8){return new BPromise(function(_0xf1ee41,_0xf5b1b0){return client[_0x3076('0xb')](_0x18b4c8,_0x2776c8)['then'](function(_0x42804a){logger[_0x3076('0xc')](_0x3076('0xd'),_0x5efd65,'request\x20sent');logger['debug'](_0x3076('0xe'),_0x5efd65,_0x3076('0xf'),JSON[_0x3076('0x10')](_0x42804a));if(_0x42804a[_0x3076('0x11')]){if(_0x42804a[_0x3076('0x11')]['code']===0x1f4){logger[_0x3076('0x11')](_0x3076('0xd'),_0x5efd65,_0x42804a[_0x3076('0x11')][_0x3076('0x12')]);return _0xf5b1b0(_0x42804a[_0x3076('0x11')][_0x3076('0x12')]);}logger[_0x3076('0x11')](_0x3076('0xd'),_0x5efd65,_0x42804a['error']['message']);return _0xf1ee41(_0x42804a[_0x3076('0x11')][_0x3076('0x12')]);}else{logger[_0x3076('0xc')](_0x3076('0xd'),_0x5efd65,'request\x20sent');_0xf1ee41(_0x42804a['result'][_0x3076('0x12')]);}})[_0x3076('0x13')](function(_0x45a69b){logger[_0x3076('0x11')](_0x3076('0xd'),_0x5efd65,_0x45a69b);_0xf5b1b0(_0x45a69b);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 4d55ac2..f9c08ca 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 _0x019a=['./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','put','/:id','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x4e2ce2,_0x21721e){var _0x1234c3=function(_0x202220){while(--_0x202220){_0x4e2ce2['push'](_0x4e2ce2['shift']());}};_0x1234c3(++_0x21721e);}(_0x019a,0x1c6));var _0xa019=function(_0x4ab302,_0x44837a){_0x4ab302=_0x4ab302-0x0;var _0x5112fb=_0x019a[_0x4ab302];return _0x5112fb;};'use strict';var multer=require(_0xa019('0x0'));var util=require(_0xa019('0x1'));var path=require(_0xa019('0x2'));var timeout=require('connect-timeout');var express=require(_0xa019('0x3'));var router=express[_0xa019('0x4')]();var fs_extra=require(_0xa019('0x5'));var auth=require(_0xa019('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa019('0x7'));var controller=require(_0xa019('0x8'));router[_0xa019('0x9')]('/',auth[_0xa019('0xa')](),controller[_0xa019('0xb')]);router[_0xa019('0x9')](_0xa019('0xc'),auth[_0xa019('0xa')](),controller[_0xa019('0xd')]);router[_0xa019('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xa019('0xe')]);router[_0xa019('0xf')]('/',auth[_0xa019('0xa')](),controller['create']);router[_0xa019('0x10')](_0xa019('0x11'),auth[_0xa019('0xa')](),controller[_0xa019('0x12')]);router[_0xa019('0x13')]('/:id',auth[_0xa019('0xa')](),controller['destroy']);module[_0xa019('0x14')]=router; \ No newline at end of file +var _0x7ff5=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x3f88bc,_0xe38cf5){var _0x4df1c4=function(_0x111de1){while(--_0x111de1){_0x3f88bc['push'](_0x3f88bc['shift']());}};_0x4df1c4(++_0xe38cf5);}(_0x7ff5,0xf0));var _0x57ff=function(_0x5aeeae,_0x2c6f39){_0x5aeeae=_0x5aeeae-0x0;var _0x2844d2=_0x7ff5[_0x5aeeae];return _0x2844d2;};'use strict';var multer=require('multer');var util=require(_0x57ff('0x0'));var path=require(_0x57ff('0x1'));var timeout=require(_0x57ff('0x2'));var express=require('express');var router=express[_0x57ff('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x57ff('0x4'));var interaction=require(_0x57ff('0x5'));var config=require(_0x57ff('0x6'));var controller=require(_0x57ff('0x7'));router['get']('/',auth[_0x57ff('0x8')](),controller[_0x57ff('0x9')]);router[_0x57ff('0xa')](_0x57ff('0xb'),auth[_0x57ff('0x8')](),controller[_0x57ff('0xc')]);router['get'](_0x57ff('0xd'),auth[_0x57ff('0x8')](),controller[_0x57ff('0xe')]);router[_0x57ff('0xf')]('/',auth['isAuthenticated'](),controller[_0x57ff('0x10')]);router[_0x57ff('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x57ff('0x12')]);router[_0x57ff('0x13')](_0x57ff('0xd'),auth[_0x57ff('0x8')](),controller[_0x57ff('0x14')]);module[_0x57ff('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index d379ab1..cf9b235 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 _0xcaf8=['exports','STRING','ENUM','mouseOver','sequelize'];(function(_0x3ae542,_0x45f03f){var _0x35ba61=function(_0x53ac0d){while(--_0x53ac0d){_0x3ae542['push'](_0x3ae542['shift']());}};_0x35ba61(++_0x45f03f);}(_0xcaf8,0x9f));var _0x8caf=function(_0x15ae5b,_0x39f9bf){_0x15ae5b=_0x15ae5b-0x0;var _0x15d178=_0xcaf8[_0x15ae5b];return _0x15d178;};'use strict';var Sequelize=require(_0x8caf('0x0'));module[_0x8caf('0x1')]={'name':{'type':Sequelize[_0x8caf('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8caf('0x3')](_0x8caf('0x4'),'timeout'),'defaultValue':_0x8caf('0x4')},'selector':{'type':Sequelize[_0x8caf('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xa9d5=['STRING','mouseOver','timeout','INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9d5,0x14e));var _0x5a9d=function(_0x3f6a65,_0x164dcc){_0x3f6a65=_0x3f6a65-0x0;var _0x28d936=_0xa9d5[_0x3f6a65];return _0x28d936;};'use strict';var Sequelize=require(_0x5a9d('0x0'));module[_0x5a9d('0x1')]={'name':{'type':Sequelize[_0x5a9d('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x5a9d('0x3'),_0x5a9d('0x4')),'defaultValue':_0x5a9d('0x3')},'selector':{'type':Sequelize[_0x5a9d('0x2')]},'timeout':{'type':Sequelize[_0x5a9d('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index d5d2acc..45aa4d3 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 _0xdfe7=['stack','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','attributes','fields','length','include','merge','options','catch','create','body','find','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus'];(function(_0xcedc4b,_0x4af99d){var _0x23efcc=function(_0x4f7ff4){while(--_0x4f7ff4){_0xcedc4b['push'](_0xcedc4b['shift']());}};_0x23efcc(++_0x4af99d);}(_0xdfe7,0xc8));var _0x7dfe=function(_0x2f06a0,_0x37ea3c){_0x2f06a0=_0x2f06a0-0x0;var _0x2613c2=_0xdfe7[_0x2f06a0];return _0x2613c2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7dfe('0x0'));var zipdir=require(_0x7dfe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7dfe('0x2'));var moment=require(_0x7dfe('0x3'));var BPromise=require(_0x7dfe('0x4'));var Mustache=require(_0x7dfe('0x5'));var util=require('util');var path=require(_0x7dfe('0x6'));var sox=require(_0x7dfe('0x7'));var csv=require('to-csv');var ejs=require(_0x7dfe('0x8'));var fs=require('fs');var fs_extra=require(_0x7dfe('0x9'));var _=require(_0x7dfe('0xa'));var squel=require(_0x7dfe('0xb'));var crypto=require('crypto');var jsforce=require(_0x7dfe('0xc'));var deskjs=require(_0x7dfe('0xd'));var toCsv=require(_0x7dfe('0xe'));var querystring=require(_0x7dfe('0xf'));var Papa=require('papaparse');var Redis=require(_0x7dfe('0x10'));var authService=require(_0x7dfe('0x11'));var qs=require(_0x7dfe('0x12'));var as=require(_0x7dfe('0x13'));var hardwareService=require(_0x7dfe('0x14'));var logger=require('../../config/logger')(_0x7dfe('0x15'));var utils=require(_0x7dfe('0x16'));var config=require(_0x7dfe('0x17'));var licenseUtil=require(_0x7dfe('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49d7ed,_0x1f4f2d){_0x1f4f2d=_0x1f4f2d||0xcc;return function(_0x5a4e50){if(_0x5a4e50){return _0x49d7ed['sendStatus'](_0x1f4f2d);}return _0x49d7ed[_0x7dfe('0x19')](_0x1f4f2d)['end']();};}function respondWithResult(_0x2a6c47,_0x16e61d){_0x16e61d=_0x16e61d||0xc8;return function(_0x40b1fe){if(_0x40b1fe){return _0x2a6c47['status'](_0x16e61d)[_0x7dfe('0x1a')](_0x40b1fe);}};}function respondWithFilteredResult(_0x2f7c13,_0xc238d7){return function(_0x14691e){if(_0x14691e){var _0x133e49=typeof _0xc238d7[_0x7dfe('0x1b')]===_0x7dfe('0x1c')&&typeof _0xc238d7[_0x7dfe('0x1d')]===_0x7dfe('0x1c');var _0x11e178=_0x14691e[_0x7dfe('0x1e')];var _0x397509=_0x133e49?0x0:_0xc238d7[_0x7dfe('0x1b')];var _0x4a8bbb=_0x133e49?_0x14691e['count']:_0xc238d7[_0x7dfe('0x1b')]+_0xc238d7[_0x7dfe('0x1d')];var _0x61d7f3;if(_0x4a8bbb>=_0x11e178){_0x4a8bbb=_0x11e178;_0x61d7f3=0xc8;}else{_0x61d7f3=0xce;}_0x2f7c13[_0x7dfe('0x19')](_0x61d7f3);return _0x2f7c13[_0x7dfe('0x1f')](_0x7dfe('0x20'),_0x397509+'-'+_0x4a8bbb+'/'+_0x11e178)[_0x7dfe('0x1a')](_0x14691e);}return null;};}function patchUpdates(_0x3bc56d){return function(_0x582b5f){try{jsonpatch[_0x7dfe('0x21')](_0x582b5f,_0x3bc56d,!![]);}catch(_0xc8c429){return BPromise[_0x7dfe('0x22')](_0xc8c429);}return _0x582b5f['save']();};}function saveUpdates(_0x3db368,_0x35525c){return function(_0x59c422){if(_0x59c422){return _0x59c422[_0x7dfe('0x23')](_0x3db368)[_0x7dfe('0x24')](function(_0x3fcee1){return _0x3fcee1;});}return null;};}function removeEntity(_0x4a5b95,_0x303027){return function(_0x5ea4a1){if(_0x5ea4a1){return _0x5ea4a1[_0x7dfe('0x25')]()[_0x7dfe('0x24')](function(){_0x4a5b95[_0x7dfe('0x19')](0xcc)[_0x7dfe('0x26')]();});}};}function handleEntityNotFound(_0x266144,_0x187df8){return function(_0x3f6571){if(!_0x3f6571){_0x266144[_0x7dfe('0x27')](0x194);}return _0x3f6571;};}function handleError(_0x4d2865,_0x2bcbec){_0x2bcbec=_0x2bcbec||0x1f4;return function(_0x80f9dd){logger['error'](_0x80f9dd[_0x7dfe('0x28')]);if(_0x80f9dd[_0x7dfe('0x29')]){delete _0x80f9dd[_0x7dfe('0x29')];}_0x4d2865[_0x7dfe('0x19')](_0x2bcbec)[_0x7dfe('0x2a')](_0x80f9dd);};}exports['show']=function(_0x908aa4,_0x3a6ee8){var _0x4daa57={'raw':!![],'where':{'id':_0x908aa4[_0x7dfe('0x2b')]['id']}},_0x2aca4e={};_0x2aca4e[_0x7dfe('0x2c')]=_[_0x7dfe('0x2d')](db[_0x7dfe('0x2e')][_0x7dfe('0x2f')]);_0x2aca4e[_0x7dfe('0x30')]=_[_0x7dfe('0x2d')](_0x908aa4[_0x7dfe('0x30')]);_0x2aca4e[_0x7dfe('0x31')]=_['intersection'](_0x2aca4e['model'],_0x2aca4e['query']);_0x4daa57[_0x7dfe('0x32')]=_['intersection'](_0x2aca4e[_0x7dfe('0x2c')],qs[_0x7dfe('0x33')](_0x908aa4[_0x7dfe('0x30')]['fields']));_0x4daa57[_0x7dfe('0x32')]=_0x4daa57[_0x7dfe('0x32')][_0x7dfe('0x34')]?_0x4daa57[_0x7dfe('0x32')]:_0x2aca4e[_0x7dfe('0x2c')];if(_0x908aa4[_0x7dfe('0x30')]['includeAll']){_0x4daa57[_0x7dfe('0x35')]=[{'all':!![]}];}_0x4daa57=_[_0x7dfe('0x36')]({},_0x4daa57,_0x908aa4[_0x7dfe('0x37')]);return db['ChatProactiveAction']['find'](_0x4daa57)[_0x7dfe('0x24')](handleEntityNotFound(_0x3a6ee8,null))[_0x7dfe('0x24')](respondWithResult(_0x3a6ee8,null))[_0x7dfe('0x38')](handleError(_0x3a6ee8,null));};exports[_0x7dfe('0x39')]=function(_0x23d6fa,_0x47c39a){return db[_0x7dfe('0x2e')]['create'](_0x23d6fa[_0x7dfe('0x3a')],{})[_0x7dfe('0x24')](respondWithResult(_0x47c39a,0xc9))[_0x7dfe('0x38')](handleError(_0x47c39a,null));};exports[_0x7dfe('0x23')]=function(_0x7ff7a,_0x38b326){if(_0x7ff7a[_0x7dfe('0x3a')]['id']){delete _0x7ff7a[_0x7dfe('0x3a')]['id'];}return db[_0x7dfe('0x2e')][_0x7dfe('0x3b')]({'where':{'id':_0x7ff7a[_0x7dfe('0x2b')]['id']}})['then'](handleEntityNotFound(_0x38b326,null))[_0x7dfe('0x24')](saveUpdates(_0x7ff7a['body'],null))[_0x7dfe('0x24')](respondWithResult(_0x38b326,null))[_0x7dfe('0x38')](handleError(_0x38b326,null));};exports[_0x7dfe('0x25')]=function(_0x527654,_0x24ac38){return db[_0x7dfe('0x2e')][_0x7dfe('0x3b')]({'where':{'id':_0x527654[_0x7dfe('0x2b')]['id']}})[_0x7dfe('0x24')](handleEntityNotFound(_0x24ac38,null))['then'](removeEntity(_0x24ac38,null))['catch'](handleError(_0x24ac38,null));}; \ No newline at end of file +var _0x17c4=['model','attributes','fields','include','options','find','catch','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','end','sendStatus','error','name','send','show','params','keys','ChatProactiveAction','rawAttributes','query','filters','intersection'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x17c4,0x102));var _0x417c=function(_0x20b8b6,_0x29a14c){_0x20b8b6=_0x20b8b6-0x0;var _0x22c341=_0x17c4[_0x20b8b6];return _0x22c341;};'use strict';var emlformat=require(_0x417c('0x0'));var rimraf=require(_0x417c('0x1'));var zipdir=require(_0x417c('0x2'));var jsonpatch=require(_0x417c('0x3'));var rp=require(_0x417c('0x4'));var moment=require(_0x417c('0x5'));var BPromise=require(_0x417c('0x6'));var Mustache=require(_0x417c('0x7'));var util=require(_0x417c('0x8'));var path=require(_0x417c('0x9'));var sox=require(_0x417c('0xa'));var csv=require('to-csv');var ejs=require(_0x417c('0xb'));var fs=require('fs');var fs_extra=require(_0x417c('0xc'));var _=require(_0x417c('0xd'));var squel=require(_0x417c('0xe'));var crypto=require(_0x417c('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x417c('0x10'));var querystring=require(_0x417c('0x11'));var Papa=require(_0x417c('0x12'));var Redis=require(_0x417c('0x13'));var authService=require(_0x417c('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x417c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x417c('0x16'))(_0x417c('0x17'));var utils=require(_0x417c('0x18'));var config=require(_0x417c('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23b22f,_0x5952b2){_0x5952b2=_0x5952b2||0xcc;return function(_0x4e113a){if(_0x4e113a){return _0x23b22f['sendStatus'](_0x5952b2);}return _0x23b22f[_0x417c('0x1a')](_0x5952b2)['end']();};}function respondWithResult(_0x73f8c3,_0x34361a){_0x34361a=_0x34361a||0xc8;return function(_0x49a227){if(_0x49a227){return _0x73f8c3[_0x417c('0x1a')](_0x34361a)[_0x417c('0x1b')](_0x49a227);}};}function respondWithFilteredResult(_0x3feb87,_0x4416c6){return function(_0x509fce){if(_0x509fce){var _0x56d121=typeof _0x4416c6[_0x417c('0x1c')]===_0x417c('0x1d')&&typeof _0x4416c6[_0x417c('0x1e')]==='undefined';var _0x1ab811=_0x509fce[_0x417c('0x1f')];var _0xf8d94c=_0x56d121?0x0:_0x4416c6[_0x417c('0x1c')];var _0x308618=_0x56d121?_0x509fce[_0x417c('0x1f')]:_0x4416c6[_0x417c('0x1c')]+_0x4416c6[_0x417c('0x1e')];var _0x4a8fc3;if(_0x308618>=_0x1ab811){_0x308618=_0x1ab811;_0x4a8fc3=0xc8;}else{_0x4a8fc3=0xce;}_0x3feb87[_0x417c('0x1a')](_0x4a8fc3);return _0x3feb87[_0x417c('0x20')](_0x417c('0x21'),_0xf8d94c+'-'+_0x308618+'/'+_0x1ab811)[_0x417c('0x1b')](_0x509fce);}return null;};}function patchUpdates(_0x226647){return function(_0x7c1e5a){try{jsonpatch[_0x417c('0x22')](_0x7c1e5a,_0x226647,!![]);}catch(_0x32247b){return BPromise[_0x417c('0x23')](_0x32247b);}return _0x7c1e5a[_0x417c('0x24')]();};}function saveUpdates(_0xcb26f7,_0x6b6835){return function(_0xd5a3fa){if(_0xd5a3fa){return _0xd5a3fa['update'](_0xcb26f7)['then'](function(_0x1924eb){return _0x1924eb;});}return null;};}function removeEntity(_0x3b3c60,_0x1867e6){return function(_0x5b6067){if(_0x5b6067){return _0x5b6067[_0x417c('0x25')]()[_0x417c('0x26')](function(){_0x3b3c60[_0x417c('0x1a')](0xcc)[_0x417c('0x27')]();});}};}function handleEntityNotFound(_0x2a27f8,_0x482b3f){return function(_0x243066){if(!_0x243066){_0x2a27f8[_0x417c('0x28')](0x194);}return _0x243066;};}function handleError(_0x528e04,_0x4cebb9){_0x4cebb9=_0x4cebb9||0x1f4;return function(_0x54dd1a){logger[_0x417c('0x29')](_0x54dd1a['stack']);if(_0x54dd1a[_0x417c('0x2a')]){delete _0x54dd1a[_0x417c('0x2a')];}_0x528e04[_0x417c('0x1a')](_0x4cebb9)[_0x417c('0x2b')](_0x54dd1a);};}exports[_0x417c('0x2c')]=function(_0xa9435f,_0x1f0805){var _0x3fb31c={'raw':!![],'where':{'id':_0xa9435f[_0x417c('0x2d')]['id']}},_0x9685fd={};_0x9685fd['model']=_[_0x417c('0x2e')](db[_0x417c('0x2f')][_0x417c('0x30')]);_0x9685fd[_0x417c('0x31')]=_[_0x417c('0x2e')](_0xa9435f[_0x417c('0x31')]);_0x9685fd[_0x417c('0x32')]=_[_0x417c('0x33')](_0x9685fd[_0x417c('0x34')],_0x9685fd[_0x417c('0x31')]);_0x3fb31c[_0x417c('0x35')]=_['intersection'](_0x9685fd[_0x417c('0x34')],qs['fields'](_0xa9435f['query'][_0x417c('0x36')]));_0x3fb31c['attributes']=_0x3fb31c['attributes']['length']?_0x3fb31c['attributes']:_0x9685fd[_0x417c('0x34')];if(_0xa9435f[_0x417c('0x31')]['includeAll']){_0x3fb31c[_0x417c('0x37')]=[{'all':!![]}];}_0x3fb31c=_['merge']({},_0x3fb31c,_0xa9435f[_0x417c('0x38')]);return db[_0x417c('0x2f')][_0x417c('0x39')](_0x3fb31c)['then'](handleEntityNotFound(_0x1f0805,null))[_0x417c('0x26')](respondWithResult(_0x1f0805,null))[_0x417c('0x3a')](handleError(_0x1f0805,null));};exports[_0x417c('0x3b')]=function(_0x10eda8,_0x1a7b88){return db[_0x417c('0x2f')][_0x417c('0x3b')](_0x10eda8['body'],{})['then'](respondWithResult(_0x1a7b88,0xc9))[_0x417c('0x3a')](handleError(_0x1a7b88,null));};exports[_0x417c('0x3c')]=function(_0x47f93a,_0x56391a){if(_0x47f93a[_0x417c('0x3d')]['id']){delete _0x47f93a[_0x417c('0x3d')]['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x47f93a[_0x417c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x56391a,null))[_0x417c('0x26')](saveUpdates(_0x47f93a[_0x417c('0x3d')],null))['then'](respondWithResult(_0x56391a,null))['catch'](handleError(_0x56391a,null));};exports[_0x417c('0x25')]=function(_0x3a1b78,_0x3ddcc6){return db[_0x417c('0x2f')][_0x417c('0x39')]({'where':{'id':_0x3a1b78['params']['id']}})['then'](handleEntityNotFound(_0x3ddcc6,null))[_0x417c('0x26')](removeEntity(_0x3ddcc6,null))[_0x417c('0x3a')](handleError(_0x3ddcc6,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index bd05910..a108943 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 _0x8470=['chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes'];(function(_0x32f23e,_0x32f12e){var _0x7743e7=function(_0x3a7fd9){while(--_0x3a7fd9){_0x32f23e['push'](_0x32f23e['shift']());}};_0x7743e7(++_0x32f12e);}(_0x8470,0x1a5));var _0x0847=function(_0x2d552a,_0x496b32){_0x2d552a=_0x2d552a-0x0;var _0x12ca11=_0x8470[_0x2d552a];return _0x12ca11;};'use strict';var _=require(_0x0847('0x0'));var util=require(_0x0847('0x1'));var logger=require(_0x0847('0x2'))(_0x0847('0x3'));var moment=require(_0x0847('0x4'));var BPromise=require(_0x0847('0x5'));var rp=require(_0x0847('0x6'));var fs=require('fs');var path=require(_0x0847('0x7'));var rimraf=require(_0x0847('0x8'));var config=require(_0x0847('0x9'));var attributes=require(_0x0847('0xa'));module['exports']=function(_0x20c924,_0x3cd87d){return _0x20c924['define']('ChatProactiveAction',attributes,{'tableName':_0x0847('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7ff=['ChatProactiveAction','chat_proactive_actions','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','define'];(function(_0x3594e0,_0x1ff4f6){var _0x297de6=function(_0x23db58){while(--_0x23db58){_0x3594e0['push'](_0x3594e0['shift']());}};_0x297de6(++_0x1ff4f6);}(_0xe7ff,0x19c));var _0xfe7f=function(_0x263f4c,_0x438626){_0x263f4c=_0x263f4c-0x0;var _0x3a78d3=_0xe7ff[_0x263f4c];return _0x3a78d3;};'use strict';var _=require(_0xfe7f('0x0'));var util=require('util');var logger=require(_0xfe7f('0x1'))(_0xfe7f('0x2'));var moment=require(_0xfe7f('0x3'));var BPromise=require(_0xfe7f('0x4'));var rp=require(_0xfe7f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfe7f('0x6'));var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0x5470b9,_0x207298){return _0x5470b9[_0xfe7f('0x7')](_0xfe7f('0x8'),attributes,{'tableName':_0xfe7f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 61b82e1..16bc170 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 _0x7174=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util'];(function(_0x50b6f8,_0x523770){var _0x26f09e=function(_0x1440b1){while(--_0x1440b1){_0x50b6f8['push'](_0x50b6f8['shift']());}};_0x26f09e(++_0x523770);}(_0x7174,0x154));var _0x4717=function(_0x1a7a39,_0x47b900){_0x1a7a39=_0x1a7a39-0x0;var _0x24af5b=_0x7174[_0x1a7a39];return _0x24af5b;};'use strict';var _=require(_0x4717('0x0'));var util=require(_0x4717('0x1'));var moment=require('moment');var BPromise=require(_0x4717('0x2'));var rs=require(_0x4717('0x3'));var fs=require('fs');var Redis=require(_0x4717('0x4'));var db=require(_0x4717('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4717('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4717('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x515629,_0x2ff750,_0x5a6199){return new BPromise(function(_0x32919b,_0xd5ee1d){return client[_0x4717('0x8')](_0x515629,_0x5a6199)[_0x4717('0x9')](function(_0x109c86){logger['info'](_0x4717('0xa'),_0x2ff750,_0x4717('0xb'));logger[_0x4717('0xc')](_0x4717('0xd'),_0x2ff750,'request\x20sent',JSON[_0x4717('0xe')](_0x109c86));if(_0x109c86['error']){if(_0x109c86[_0x4717('0xf')]['code']===0x1f4){logger[_0x4717('0xf')](_0x4717('0xa'),_0x2ff750,_0x109c86['error'][_0x4717('0x10')]);return _0xd5ee1d(_0x109c86[_0x4717('0xf')]['message']);}logger[_0x4717('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x2ff750,_0x109c86[_0x4717('0xf')][_0x4717('0x10')]);return _0x32919b(_0x109c86[_0x4717('0xf')][_0x4717('0x10')]);}else{logger[_0x4717('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x2ff750,_0x4717('0xb'));_0x32919b(_0x109c86['result']['message']);}})[_0x4717('0x12')](function(_0x59ecee){logger[_0x4717('0xf')](_0x4717('0xa'),_0x2ff750,_0x59ecee);_0xd5ee1d(_0x59ecee);});});} \ No newline at end of file +var _0x2d43=['request\x20sent','debug','ChatProactiveAction,\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','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x150f86,_0x26b9c3){var _0x21ce57=function(_0x3e3a50){while(--_0x3e3a50){_0x150f86['push'](_0x150f86['shift']());}};_0x21ce57(++_0x26b9c3);}(_0x2d43,0x1cb));var _0x32d4=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x2d43[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0x32d4('0x0'));var util=require(_0x32d4('0x1'));var moment=require(_0x32d4('0x2'));var BPromise=require(_0x32d4('0x3'));var rs=require(_0x32d4('0x4'));var fs=require('fs');var Redis=require(_0x32d4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32d4('0x6'));var logger=require(_0x32d4('0x7'))(_0x32d4('0x8'));var config=require(_0x32d4('0x9'));var jayson=require(_0x32d4('0xa'));var client=jayson[_0x32d4('0xb')][_0x32d4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x292a40,_0x391056,_0x17121c){return new BPromise(function(_0x14ed42,_0x55b857){return client[_0x32d4('0xd')](_0x292a40,_0x17121c)[_0x32d4('0xe')](function(_0x39b9f1){logger['info'](_0x32d4('0xf'),_0x391056,_0x32d4('0x10'));logger[_0x32d4('0x11')](_0x32d4('0x12'),_0x391056,'request\x20sent',JSON[_0x32d4('0x13')](_0x39b9f1));if(_0x39b9f1[_0x32d4('0x14')]){if(_0x39b9f1['error'][_0x32d4('0x15')]===0x1f4){logger['error'](_0x32d4('0xf'),_0x391056,_0x39b9f1[_0x32d4('0x14')][_0x32d4('0x16')]);return _0x55b857(_0x39b9f1[_0x32d4('0x14')]['message']);}logger[_0x32d4('0x14')](_0x32d4('0xf'),_0x391056,_0x39b9f1[_0x32d4('0x14')][_0x32d4('0x16')]);return _0x14ed42(_0x39b9f1[_0x32d4('0x14')][_0x32d4('0x16')]);}else{logger['info'](_0x32d4('0xf'),_0x391056,_0x32d4('0x10'));_0x14ed42(_0x39b9f1[_0x32d4('0x17')][_0x32d4('0x16')]);}})[_0x32d4('0x18')](function(_0x255fd4){logger[_0x32d4('0x14')](_0x32d4('0xf'),_0x391056,_0x255fd4);_0x55b857(_0x255fd4);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 394d2d8..6af473f 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 _0x6aa7=['/:id','show','post','isAuthenticated','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2469f9,_0x6107eb){var _0x5844ad=function(_0x104a42){while(--_0x104a42){_0x2469f9['push'](_0x2469f9['shift']());}};_0x5844ad(++_0x6107eb);}(_0x6aa7,0x178));var _0x76aa=function(_0x7890a9,_0x2ac8a9){_0x7890a9=_0x7890a9-0x0;var _0xd7ed3e=_0x6aa7[_0x7890a9];return _0xd7ed3e;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./chatProactiveAction.controller');router['get'](_0x76aa('0x8'),auth['isAuthenticated'](),controller[_0x76aa('0x9')]);router[_0x76aa('0xa')]('/',auth[_0x76aa('0xb')](),controller['create']);router[_0x76aa('0xc')](_0x76aa('0x8'),auth[_0x76aa('0xb')](),controller['update']);router[_0x76aa('0xd')](_0x76aa('0x8'),auth[_0x76aa('0xb')](),controller[_0x76aa('0xe')]);module[_0x76aa('0xf')]=router; \ No newline at end of file +var _0x1cb9=['get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller'];(function(_0x2ec498,_0xe698dd){var _0x156726=function(_0x258a4a){while(--_0x258a4a){_0x2ec498['push'](_0x2ec498['shift']());}};_0x156726(++_0xe698dd);}(_0x1cb9,0x14e));var _0x91cb=function(_0x460e2d,_0x292b87){_0x460e2d=_0x460e2d-0x0;var _0x2eb6fe=_0x1cb9[_0x460e2d];return _0x2eb6fe;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')](_0x91cb('0x9'),auth[_0x91cb('0xa')](),controller[_0x91cb('0xb')]);router[_0x91cb('0xc')]('/',auth['isAuthenticated'](),controller[_0x91cb('0xd')]);router['put'](_0x91cb('0x9'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')](_0x91cb('0x9'),auth[_0x91cb('0xa')](),controller[_0x91cb('0x10')]);module[_0x91cb('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 2b5c9f8..c93867b 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 _0x77a1=['beepall','roundrobin','sequelize','exports','name','STRING','ENUM','rrmemory'];(function(_0x4c4fbe,_0x483482){var _0x39b3b9=function(_0x803f56){while(--_0x803f56){_0x4c4fbe['push'](_0x4c4fbe['shift']());}};_0x39b3b9(++_0x483482);}(_0x77a1,0xfa));var _0x177a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x77a1[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x177a('0x0'));module[_0x177a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x177a('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x177a('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x177a('0x4')](_0x177a('0x5'),_0x177a('0x6'),_0x177a('0x7'))}}; \ No newline at end of file +var _0xd238=['STRING','name','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0xd238,0x1e2));var _0x8d23=function(_0x391005,_0x4ef92a){_0x391005=_0x391005-0x0;var _0x1a531d=_0xd238[_0x391005];return _0x1a531d;};'use strict';var Sequelize=require(_0x8d23('0x0'));module['exports']={'name':{'type':Sequelize[_0x8d23('0x1')],'unique':_0x8d23('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8d23('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8d23('0x3')](_0x8d23('0x4'),_0x8d23('0x5'),_0x8d23('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index e0c9d90..07d2b9c 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 _0x3cd8=['filter','where','merge','options','show','params','rawAttributes','length','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','describe','getMembers','findOne','UserChatQueue','findAll','User','updatedAt','format','%s/%s','SIP','chatPause','createdAt','Team','getTeams','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userChatQueue:save','removeTeams','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','get','ChatQueues','UserProfileResource','sendStatus','stack','send','index','map','ChatQueue','type','key','name','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x5cfd01,_0x353313){var _0x6e3957=function(_0x248d8d){while(--_0x248d8d){_0x5cfd01['push'](_0x5cfd01['shift']());}};_0x6e3957(++_0x353313);}(_0x3cd8,0x172));var _0x83cd=function(_0x4f217f,_0x313163){_0x4f217f=_0x4f217f-0x0;var _0x3b583a=_0x3cd8[_0x4f217f];return _0x3b583a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x83cd('0x0'));var zipdir=require(_0x83cd('0x1'));var jsonpatch=require(_0x83cd('0x2'));var rp=require(_0x83cd('0x3'));var moment=require('moment');var BPromise=require(_0x83cd('0x4'));var Mustache=require('mustache');var util=require(_0x83cd('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x83cd('0x6'));var ejs=require(_0x83cd('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x83cd('0x8'));var squel=require(_0x83cd('0x9'));var crypto=require(_0x83cd('0xa'));var jsforce=require(_0x83cd('0xb'));var deskjs=require(_0x83cd('0xc'));var toCsv=require('to-csv');var querystring=require(_0x83cd('0xd'));var Papa=require(_0x83cd('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x83cd('0xf'));var as=require(_0x83cd('0x10'));var hardwareService=require(_0x83cd('0x11'));var logger=require('../../config/logger')(_0x83cd('0x12'));var utils=require(_0x83cd('0x13'));var config=require(_0x83cd('0x14'));var licenseUtil=require(_0x83cd('0x15'));var db=require(_0x83cd('0x16'))['db'];config[_0x83cd('0x17')]=_[_0x83cd('0x18')](config['redis'],{'host':_0x83cd('0x19'),'port':0x18eb});var socket=require(_0x83cd('0x1a'))(new Redis(config[_0x83cd('0x17')]));require(_0x83cd('0x1b'))[_0x83cd('0x1c')](socket);var jayson=require(_0x83cd('0x1d'));var client=jayson[_0x83cd('0x1e')][_0x83cd('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x30ad67,_0x23a0d9,_0x5c6c27,_0x569d5d){return new BPromise(function(_0x1bf29,_0x4390e3){var _0x1cefb2=_0x569d5d||client;return _0x1cefb2[_0x83cd('0x20')](_0x30ad67,_0x5c6c27)[_0x83cd('0x21')](function(_0x1706f9){logger['info'](_0x83cd('0x22'),_0x23a0d9,'request\x20sent');logger['debug'](_0x83cd('0x23'),_0x23a0d9,_0x83cd('0x24'),JSON[_0x83cd('0x25')](_0x1706f9));if(_0x1706f9[_0x83cd('0x26')]){if(_0x1706f9[_0x83cd('0x26')][_0x83cd('0x27')]===0x1f4){logger[_0x83cd('0x26')](_0x83cd('0x22'),_0x23a0d9,_0x1706f9[_0x83cd('0x26')][_0x83cd('0x28')]);return _0x4390e3(_0x1706f9[_0x83cd('0x26')][_0x83cd('0x28')]);}logger[_0x83cd('0x26')](_0x83cd('0x22'),_0x23a0d9,_0x1706f9[_0x83cd('0x26')]['message']);return _0x1bf29(_0x1706f9[_0x83cd('0x26')][_0x83cd('0x28')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x23a0d9,_0x83cd('0x24'));_0x1bf29(_0x1706f9[_0x83cd('0x29')][_0x83cd('0x28')]);}})[_0x83cd('0x2a')](function(_0x44f239){logger[_0x83cd('0x26')](_0x83cd('0x22'),_0x23a0d9,_0x44f239);_0x4390e3(_0x44f239);});});}function respondWithStatusCode(_0x22f1ce,_0x5b82a8){_0x5b82a8=_0x5b82a8||0xcc;return function(_0x17b0d9){if(_0x17b0d9){return _0x22f1ce['sendStatus'](_0x5b82a8);}return _0x22f1ce[_0x83cd('0x2b')](_0x5b82a8)[_0x83cd('0x2c')]();};}function respondWithResult(_0x3472f6,_0x22f183){_0x22f183=_0x22f183||0xc8;return function(_0x41faf3){if(_0x41faf3){return _0x3472f6['status'](_0x22f183)[_0x83cd('0x2d')](_0x41faf3);}};}function respondWithFilteredResult(_0x3633cf,_0x16327d){return function(_0x21f7bc){if(_0x21f7bc){var _0x1d9e7b=typeof _0x16327d[_0x83cd('0x2e')]===_0x83cd('0x2f')&&typeof _0x16327d['limit']==='undefined';var _0x5ec82c=_0x21f7bc[_0x83cd('0x30')];var _0x32eee8=_0x1d9e7b?0x0:_0x16327d['offset'];var _0x185f47=_0x1d9e7b?_0x21f7bc[_0x83cd('0x30')]:_0x16327d[_0x83cd('0x2e')]+_0x16327d[_0x83cd('0x31')];var _0x50080e;if(_0x185f47>=_0x5ec82c){_0x185f47=_0x5ec82c;_0x50080e=0xc8;}else{_0x50080e=0xce;}_0x3633cf['status'](_0x50080e);return _0x3633cf[_0x83cd('0x32')](_0x83cd('0x33'),_0x32eee8+'-'+_0x185f47+'/'+_0x5ec82c)[_0x83cd('0x2d')](_0x21f7bc);}return null;};}function patchUpdates(_0x3f5eb2){return function(_0x519d3b){try{jsonpatch[_0x83cd('0x34')](_0x519d3b,_0x3f5eb2,!![]);}catch(_0x5855d8){return BPromise['reject'](_0x5855d8);}return _0x519d3b[_0x83cd('0x35')]();};}function saveUpdates(_0x478fb3,_0x4a27f7){return function(_0x2fd9f1){if(_0x2fd9f1){return _0x2fd9f1[_0x83cd('0x36')](_0x478fb3)[_0x83cd('0x21')](function(_0x172948){return _0x172948;});}return null;};}function removeEntity(_0x3a7774,_0x4d2b3c){return function(_0x5e3d7a){if(_0x5e3d7a){return _0x5e3d7a[_0x83cd('0x37')]()[_0x83cd('0x21')](function(){var _0x50580c=_0x5e3d7a[_0x83cd('0x38')]({'plain':!![]});var _0x1156b1=_0x83cd('0x39');return db[_0x83cd('0x3a')]['destroy']({'where':{'type':_0x1156b1,'resourceId':_0x50580c['id']}})[_0x83cd('0x21')](function(){return _0x5e3d7a;});})['then'](function(){_0x3a7774[_0x83cd('0x2b')](0xcc)[_0x83cd('0x2c')]();});}};}function handleEntityNotFound(_0x4c76fe,_0x80851d){return function(_0x3ed40f){if(!_0x3ed40f){_0x4c76fe[_0x83cd('0x3b')](0x194);}return _0x3ed40f;};}function handleError(_0x79d788,_0x2d03a6){_0x2d03a6=_0x2d03a6||0x1f4;return function(_0x87e4b6){logger[_0x83cd('0x26')](_0x87e4b6[_0x83cd('0x3c')]);if(_0x87e4b6['name']){delete _0x87e4b6['name'];}_0x79d788[_0x83cd('0x2b')](_0x2d03a6)[_0x83cd('0x3d')](_0x87e4b6);};}exports[_0x83cd('0x3e')]=function(_0x4fa559,_0x5d130f){var _0x9ef2f1={},_0x55ba19={},_0x74dd47={'count':0x0,'rows':[]};var _0xc1ded4=_[_0x83cd('0x3f')](db[_0x83cd('0x40')]['rawAttributes'],function(_0x51634b){return{'name':_0x51634b['fieldName'],'type':_0x51634b[_0x83cd('0x41')][_0x83cd('0x42')]};});_0x55ba19['model']=_['map'](_0xc1ded4,_0x83cd('0x43'));_0x55ba19[_0x83cd('0x44')]=_[_0x83cd('0x45')](_0x4fa559[_0x83cd('0x44')]);_0x55ba19[_0x83cd('0x46')]=_[_0x83cd('0x47')](_0x55ba19[_0x83cd('0x48')],_0x55ba19[_0x83cd('0x44')]);_0x9ef2f1['attributes']=_['intersection'](_0x55ba19[_0x83cd('0x48')],qs[_0x83cd('0x49')](_0x4fa559[_0x83cd('0x44')][_0x83cd('0x49')]));_0x9ef2f1[_0x83cd('0x4a')]=_0x9ef2f1[_0x83cd('0x4a')]['length']?_0x9ef2f1[_0x83cd('0x4a')]:_0x55ba19[_0x83cd('0x48')];if(!_0x4fa559[_0x83cd('0x44')][_0x83cd('0x4b')](_0x83cd('0x4c'))){_0x9ef2f1[_0x83cd('0x31')]=qs[_0x83cd('0x31')](_0x4fa559['query'][_0x83cd('0x31')]);_0x9ef2f1[_0x83cd('0x2e')]=qs[_0x83cd('0x2e')](_0x4fa559['query'][_0x83cd('0x2e')]);}_0x9ef2f1[_0x83cd('0x4d')]=qs['sort'](_0x4fa559['query'][_0x83cd('0x4e')]);_0x9ef2f1['where']=qs[_0x83cd('0x46')](_[_0x83cd('0x4f')](_0x4fa559[_0x83cd('0x44')],_0x55ba19[_0x83cd('0x46')]),_0xc1ded4);if(_0x4fa559['query'][_0x83cd('0x50')]){_0x9ef2f1[_0x83cd('0x51')]=_[_0x83cd('0x52')](_0x9ef2f1[_0x83cd('0x51')],{'$or':_['map'](_0xc1ded4,function(_0x38b098){if(_0x38b098[_0x83cd('0x41')]!=='VIRTUAL'){var _0x1bb7f4={};_0x1bb7f4[_0x38b098[_0x83cd('0x43')]]={'$like':'%'+_0x4fa559['query'][_0x83cd('0x50')]+'%'};return _0x1bb7f4;}})});}_0x9ef2f1=_[_0x83cd('0x52')]({},_0x9ef2f1,_0x4fa559[_0x83cd('0x53')]);var _0x5d854c={'where':_0x9ef2f1[_0x83cd('0x51')]};return db[_0x83cd('0x40')]['count'](_0x5d854c)['then'](function(_0x4b04a2){_0x74dd47[_0x83cd('0x30')]=_0x4b04a2;if(_0x4fa559[_0x83cd('0x44')]['includeAll']){_0x9ef2f1['include']=[{'all':!![]}];}return db[_0x83cd('0x40')]['findAll'](_0x9ef2f1);})['then'](function(_0xb05b40){_0x74dd47['rows']=_0xb05b40;return _0x74dd47;})[_0x83cd('0x21')](respondWithFilteredResult(_0x5d130f,_0x9ef2f1))[_0x83cd('0x2a')](handleError(_0x5d130f,null));};exports[_0x83cd('0x54')]=function(_0x2d832c,_0x2f5de9){var _0x4148e7={'raw':!![],'where':{'id':_0x2d832c[_0x83cd('0x55')]['id']}},_0x5dd84e={};_0x5dd84e[_0x83cd('0x48')]=_[_0x83cd('0x45')](db['ChatQueue'][_0x83cd('0x56')]);_0x5dd84e[_0x83cd('0x44')]=_[_0x83cd('0x45')](_0x2d832c['query']);_0x5dd84e[_0x83cd('0x46')]=_[_0x83cd('0x47')](_0x5dd84e['model'],_0x5dd84e[_0x83cd('0x44')]);_0x4148e7[_0x83cd('0x4a')]=_['intersection'](_0x5dd84e['model'],qs[_0x83cd('0x49')](_0x2d832c[_0x83cd('0x44')]['fields']));_0x4148e7[_0x83cd('0x4a')]=_0x4148e7[_0x83cd('0x4a')][_0x83cd('0x57')]?_0x4148e7[_0x83cd('0x4a')]:_0x5dd84e['model'];if(_0x2d832c[_0x83cd('0x44')][_0x83cd('0x58')]){_0x4148e7['include']=[{'all':!![]}];}_0x4148e7=_[_0x83cd('0x52')]({},_0x4148e7,_0x2d832c[_0x83cd('0x53')]);return db[_0x83cd('0x40')]['find'](_0x4148e7)[_0x83cd('0x21')](handleEntityNotFound(_0x2f5de9,null))['then'](respondWithResult(_0x2f5de9,null))['catch'](handleError(_0x2f5de9,null));};exports[_0x83cd('0x59')]=function(_0x1f7059,_0x5a7054){return db[_0x83cd('0x40')][_0x83cd('0x59')](_0x1f7059[_0x83cd('0x5a')],{})[_0x83cd('0x21')](function(_0xeb8a13){var _0x874a0e=_0x1f7059[_0x83cd('0x5b')][_0x83cd('0x38')]({'plain':!![]});if(!_0x874a0e)throw new Error(_0x83cd('0x5c'));if(_0x874a0e[_0x83cd('0x5d')]===_0x83cd('0x5b')){var _0x4571cf=_0xeb8a13[_0x83cd('0x38')]({'plain':!![]});var _0x21f503=_0x83cd('0x39');return db[_0x83cd('0x5e')][_0x83cd('0x5f')]({'where':{'name':_0x21f503,'userProfileId':_0x874a0e[_0x83cd('0x60')]},'raw':!![]})[_0x83cd('0x21')](function(_0x2df9d0){if(_0x2df9d0&&_0x2df9d0[_0x83cd('0x61')]===0x0){return db[_0x83cd('0x3a')][_0x83cd('0x59')]({'name':_0x4571cf['name'],'resourceId':_0x4571cf['id'],'type':_0x2df9d0[_0x83cd('0x43')],'sectionId':_0x2df9d0['id']},{})[_0x83cd('0x21')](function(){return _0xeb8a13;});}else{return _0xeb8a13;}})[_0x83cd('0x2a')](function(_0xb8c623){logger[_0x83cd('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb8c623);throw _0xb8c623;});}return _0xeb8a13;})[_0x83cd('0x21')](respondWithResult(_0x5a7054,0xc9))[_0x83cd('0x2a')](handleError(_0x5a7054,null));};exports[_0x83cd('0x36')]=function(_0x512075,_0x92cc13){if(_0x512075[_0x83cd('0x5a')]['id']){delete _0x512075[_0x83cd('0x5a')]['id'];}return db[_0x83cd('0x40')]['find']({'where':{'id':_0x512075[_0x83cd('0x55')]['id']}})[_0x83cd('0x21')](handleEntityNotFound(_0x92cc13,null))['then'](saveUpdates(_0x512075[_0x83cd('0x5a')],null))['then'](respondWithResult(_0x92cc13,null))[_0x83cd('0x2a')](handleError(_0x92cc13,null));};exports[_0x83cd('0x37')]=function(_0x5d41d9,_0x9e595f){return db[_0x83cd('0x40')][_0x83cd('0x5f')]({'where':{'id':_0x5d41d9['params']['id']}})[_0x83cd('0x21')](handleEntityNotFound(_0x9e595f,null))[_0x83cd('0x21')](removeEntity(_0x9e595f,null))[_0x83cd('0x2a')](handleError(_0x9e595f,null));};exports[_0x83cd('0x62')]=function(_0x42184a,_0x3fbdfa){return db[_0x83cd('0x40')][_0x83cd('0x62')]()['then'](respondWithResult(_0x3fbdfa,null))[_0x83cd('0x2a')](handleError(_0x3fbdfa,null));};exports[_0x83cd('0x63')]=function(_0x45700b,_0x421830,_0x1e5cf0){var _0x3cd5aa={'raw':!![],'where':{}},_0xe81b34={},_0x2b0c3c;return db[_0x83cd('0x40')][_0x83cd('0x64')]({'where':{'id':_0x45700b[_0x83cd('0x55')]['id']}})[_0x83cd('0x21')](handleEntityNotFound(_0x421830,null))['then'](function(_0x203c7e){if(_0x203c7e){_0x2b0c3c=_0x203c7e[_0x83cd('0x38')]({'plain':!![]});_0xe81b34[_0x83cd('0x48')]=_[_0x83cd('0x45')](db[_0x83cd('0x65')][_0x83cd('0x56')]);_0xe81b34[_0x83cd('0x44')]=_[_0x83cd('0x45')](_0x45700b[_0x83cd('0x44')]);_0xe81b34['filters']=_[_0x83cd('0x47')](_0xe81b34['model'],_0xe81b34['query']);_0x3cd5aa[_0x83cd('0x4a')]=_[_0x83cd('0x47')](_0xe81b34[_0x83cd('0x48')],qs['fields'](_0x45700b[_0x83cd('0x44')][_0x83cd('0x49')]));_0x3cd5aa[_0x83cd('0x4a')]=_0x3cd5aa[_0x83cd('0x4a')][_0x83cd('0x57')]?_0x3cd5aa[_0x83cd('0x4a')]:_0xe81b34[_0x83cd('0x48')];if(!_0x45700b[_0x83cd('0x44')][_0x83cd('0x4b')](_0x83cd('0x4c'))){_0x3cd5aa['limit']=qs['limit'](_0x45700b[_0x83cd('0x44')]['limit']);_0x3cd5aa['offset']=qs[_0x83cd('0x2e')](_0x45700b[_0x83cd('0x44')]['offset']);}_0x3cd5aa[_0x83cd('0x4d')]=qs[_0x83cd('0x4e')](_0x45700b[_0x83cd('0x44')][_0x83cd('0x4e')]);_0x3cd5aa[_0x83cd('0x51')]=qs[_0x83cd('0x46')](_[_0x83cd('0x4f')](_0x45700b[_0x83cd('0x44')],_0xe81b34[_0x83cd('0x46')]));_0x3cd5aa[_0x83cd('0x51')]['ChatQueueId']=_0x203c7e['id'];if(_0x45700b[_0x83cd('0x44')]['filter']){_0x3cd5aa['where']=_['merge'](_0x3cd5aa['where'],{'$or':_[_0x83cd('0x3f')](_0x3cd5aa['attributes'],function(_0x1d3cb6){var _0x1b567b={};_0x1b567b[_0x1d3cb6]={'$like':'%'+_0x45700b[_0x83cd('0x44')][_0x83cd('0x50')]+'%'};return _0x1b567b;})});}_0x3cd5aa=_[_0x83cd('0x52')]({},_0x3cd5aa,_0x45700b[_0x83cd('0x53')]);return db[_0x83cd('0x65')][_0x83cd('0x66')](_0x3cd5aa);}})[_0x83cd('0x21')](function(_0x1d0401){if(_0x1d0401){return db[_0x83cd('0x67')]['findAndCountAll']({'where':{'id':_['map'](_0x1d0401,'UserId'),'role':'agent'},'attributes':['id','name','chatPause',_0x83cd('0x68'),'createdAt']});}})['then'](function(_0x534ccb){if(_0x534ccb){return{'count':_0x534ccb['count'],'rows':_[_0x83cd('0x3f')](_0x534ccb['rows'],function(_0x11b53d){return{'membername':_0x11b53d[_0x83cd('0x43')],'UserId':_0x11b53d['id'],'queue_name':_0x2b0c3c[_0x83cd('0x43')],'ChatQueueId':_0x2b0c3c['id'],'interface':util[_0x83cd('0x69')](_0x83cd('0x6a'),_0x83cd('0x6b'),_0x11b53d['name']),'penalty':0x0,'paused':_0x11b53d[_0x83cd('0x6c')],'createdAt':_0x11b53d[_0x83cd('0x6d')],'updatedAt':_0x11b53d[_0x83cd('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x83cd('0x21')](respondWithFilteredResult(_0x421830,_0x3cd5aa))[_0x83cd('0x2a')](handleError(_0x421830,null));};exports['getTeams']=function(_0x574be4,_0x1501e0,_0x138666){var _0x2aab10={};var _0x15deb9={};var _0x453960;var _0x534387;return db[_0x83cd('0x40')][_0x83cd('0x64')]({'where':{'id':_0x574be4[_0x83cd('0x55')]['id']}})[_0x83cd('0x21')](handleEntityNotFound(_0x1501e0,null))[_0x83cd('0x21')](function(_0x2af5b1){if(_0x2af5b1){_0x453960=_0x2af5b1;_0x15deb9[_0x83cd('0x48')]=_[_0x83cd('0x45')](db[_0x83cd('0x6e')]['rawAttributes']);_0x15deb9[_0x83cd('0x44')]=_['keys'](_0x574be4[_0x83cd('0x44')]);_0x15deb9[_0x83cd('0x46')]=_[_0x83cd('0x47')](_0x15deb9['model'],_0x15deb9[_0x83cd('0x44')]);_0x2aab10['attributes']=_['intersection'](_0x15deb9[_0x83cd('0x48')],qs[_0x83cd('0x49')](_0x574be4[_0x83cd('0x44')][_0x83cd('0x49')]));_0x2aab10['attributes']=_0x2aab10[_0x83cd('0x4a')][_0x83cd('0x57')]?_0x2aab10[_0x83cd('0x4a')]:_0x15deb9[_0x83cd('0x48')];_0x2aab10[_0x83cd('0x4d')]=qs['sort'](_0x574be4[_0x83cd('0x44')][_0x83cd('0x4e')]);_0x2aab10[_0x83cd('0x51')]=qs['filters'](_[_0x83cd('0x4f')](_0x574be4[_0x83cd('0x44')],_0x15deb9[_0x83cd('0x46')]));if(_0x574be4[_0x83cd('0x44')][_0x83cd('0x50')]){_0x2aab10[_0x83cd('0x51')]=_['merge'](_0x2aab10['where'],{'$or':_[_0x83cd('0x3f')](_0x2aab10[_0x83cd('0x4a')],function(_0x4e09fd){var _0x3b88c7={};_0x3b88c7[_0x4e09fd]={'$like':'%'+_0x574be4['query']['filter']+'%'};return _0x3b88c7;})});}_0x2aab10=_[_0x83cd('0x52')]({},_0x2aab10,_0x574be4[_0x83cd('0x53')]);return _0x453960[_0x83cd('0x6f')](_0x2aab10);}})[_0x83cd('0x21')](function(_0x16af4f){if(_0x16af4f){_0x534387=_0x16af4f[_0x83cd('0x57')];if(!_0x574be4[_0x83cd('0x44')][_0x83cd('0x4b')](_0x83cd('0x4c'))){_0x2aab10[_0x83cd('0x31')]=qs[_0x83cd('0x31')](_0x574be4[_0x83cd('0x44')][_0x83cd('0x31')]);_0x2aab10[_0x83cd('0x2e')]=qs[_0x83cd('0x2e')](_0x574be4['query']['offset']);}return _0x453960[_0x83cd('0x6f')](_0x2aab10);}})[_0x83cd('0x21')](function(_0x320837){if(_0x320837){return _0x320837?{'count':_0x534387,'rows':_0x320837}:null;}})[_0x83cd('0x21')](respondWithResult(_0x1501e0,null))['catch'](handleError(_0x1501e0,null));};exports[_0x83cd('0x70')]=function(_0x3a67c9,_0x3032ce,_0x33a2cb){var _0x4cb95c=_0x3a67c9[_0x83cd('0x5a')][_0x83cd('0x71')];return db['Team'][_0x83cd('0x66')]({'where':{'id':_0x4cb95c},'attributes':['id'],'include':[{'model':db[_0x83cd('0x67')],'as':_0x83cd('0x72'),'attributes':['id',_0x83cd('0x43'),'online',_0x83cd('0x73'),_0x83cd('0x74')],'raw':!![]}]})[_0x83cd('0x21')](function(_0xbc05c6){if(_0xbc05c6){var _0x5d91fe=_[_0x83cd('0x75')](_0xbc05c6,function(_0x126ef4){var _0x1c5ec8=_0x126ef4['get']({'plain':!![]});return _0x1c5ec8['Agents'];});return db[_0x83cd('0x40')][_0x83cd('0x5f')]({'where':{'id':_0x3a67c9[_0x83cd('0x55')]['id']}})['then'](function(_0x5cdd4f){return db[_0x83cd('0x76')][_0x83cd('0x77')](function(_0x381e0c){return _0x5cdd4f[_0x83cd('0x70')](_0x4cb95c,{'transaction':_0x381e0c})[_0x83cd('0x21')](function(){return BPromise[_0x83cd('0x78')](_0x5d91fe,function(_0x3f7d7b){return db[_0x83cd('0x65')][_0x83cd('0x79')]({'where':{'UserId':_0x3f7d7b['id'],'ChatQueueId':_0x3a67c9[_0x83cd('0x55')]['id']},'transaction':_0x381e0c});});})[_0x83cd('0x21')](function(){_0x5d91fe[_0x83cd('0x7a')](function(_0xf3b4e3){socket['emit'](_0x83cd('0x7b'),{'UserId':_0xf3b4e3['id'],'ChatQueueId':_0x5cdd4f['id']});});});});});}})[_0x83cd('0x21')](respondWithStatusCode(_0x3032ce,null))['catch'](handleError(_0x3032ce,null));};exports[_0x83cd('0x7c')]=function(_0x367188,_0x2b72c8,_0x49048a){return db['Team'][_0x83cd('0x66')]({'where':{'id':_0x367188[_0x83cd('0x44')][_0x83cd('0x71')]},'attributes':['id'],'include':[{'model':db[_0x83cd('0x67')],'as':_0x83cd('0x72'),'attributes':['id'],'raw':!![]}]})[_0x83cd('0x21')](handleEntityNotFound(_0x2b72c8,null))[_0x83cd('0x21')](function(_0x505a8b){var _0x5adf86=_['map'](_0x505a8b,'id');var _0x27894c=[];var _0x409bf4=[];var _0x8f7acb=squel['select']();_0x8f7acb['field'](_0x83cd('0x7d'))['from'](_0x83cd('0x7e'),'tq')[_0x83cd('0x7f')](_0x83cd('0x80'),'ut',_0x83cd('0x81'))[_0x83cd('0x51')](_0x83cd('0x82'),_0x367188[_0x83cd('0x55')]['id']);for(var _0x3ffc4a=0x0;_0x3ffc4a<_0x505a8b[_0x83cd('0x57')];_0x3ffc4a+=0x1){let _0x1d047e=_0x505a8b[_0x3ffc4a];for(var _0x232d81=0x0;_0x232d81<_0x1d047e[_0x83cd('0x72')]['length'];_0x232d81+=0x1){let _0x1a6b54=_0x1d047e[_0x83cd('0x72')][_0x232d81];var _0x4c5d65=_0x8f7acb['clone']();_0x4c5d65['where'](_0x83cd('0x83'),_0x1a6b54['id']);_0x409bf4[_0x83cd('0x84')](db[_0x83cd('0x76')]['query'](_0x4c5d65[_0x83cd('0x85')](),{'type':db[_0x83cd('0x76')]['QueryTypes'][_0x83cd('0x86')]})[_0x83cd('0x21')](function(_0x3fd183){if(_0x3fd183['length']===0x1){return _0x1a6b54['id'];}else{var _0x51b12b=_[_0x83cd('0x87')](_[_0x83cd('0x3f')](_0x3fd183,_0x83cd('0x88')),function(_0x286041){return _[_0x83cd('0x89')](_0x5adf86,_0x286041);});if(_0x51b12b){return _0x1a6b54['id'];}}}));}}return BPromise['all'](_0x409bf4)[_0x83cd('0x21')](function(_0xc8402a){_0x27894c=_(_0x27894c)[_0x83cd('0x8a')](_0xc8402a)[_0x83cd('0x8b')]()[_0x83cd('0x8c')]();return db[_0x83cd('0x40')][_0x83cd('0x5f')]({'where':{'id':_0x367188[_0x83cd('0x55')]['id']}})[_0x83cd('0x21')](function(_0x40f9c5){return db[_0x83cd('0x76')][_0x83cd('0x77')](function(_0x489162){return _0x40f9c5[_0x83cd('0x7c')](_0x367188[_0x83cd('0x44')]['ids'],{'transaction':_0x489162})[_0x83cd('0x21')](function(){if(!_[_0x83cd('0x8d')](_0x27894c)){return _0x40f9c5[_0x83cd('0x8e')](_0x27894c,{'transaction':_0x489162});}})[_0x83cd('0x21')](function(){_0x27894c[_0x83cd('0x7a')](function(_0x4bbbd4){socket[_0x83cd('0x8f')](_0x83cd('0x90'),{'UserId':_0x4bbbd4,'ChatQueueId':_0x40f9c5['id']});});});});});});})[_0x83cd('0x21')](respondWithStatusCode(_0x2b72c8,null))['catch'](handleError(_0x2b72c8,null));};exports[_0x83cd('0x91')]=function(_0xa38183,_0x303d8b,_0xc4b5a7){return db[_0x83cd('0x40')][_0x83cd('0x5f')]({'where':{'id':_0xa38183[_0x83cd('0x55')]['id']}})[_0x83cd('0x21')](handleEntityNotFound(_0x303d8b,null))['then'](function(_0x58f70b){if(_0x58f70b){return _0x58f70b[_0x83cd('0x91')](_0xa38183['body']['ids'],_[_0x83cd('0x92')](_0xa38183[_0x83cd('0x5a')],[_0x83cd('0x71'),'id'])||{})[_0x83cd('0x93')](function(_0x59d638){for(var _0x2319cf=0x0;_0x2319cf<_0xa38183[_0x83cd('0x5a')]['ids'][_0x83cd('0x57')];_0x2319cf+=0x1){socket['emit'](_0x83cd('0x7b'),{'UserId':Number(_0xa38183[_0x83cd('0x5a')]['ids'][_0x2319cf]),'ChatQueueId':Number(_0xa38183[_0x83cd('0x55')]['id'])});}return _0x59d638;});}})[_0x83cd('0x21')](respondWithResult(_0x303d8b,null))[_0x83cd('0x2a')](handleError(_0x303d8b,null));};exports[_0x83cd('0x8e')]=function(_0x3e6046,_0x29ec35,_0x4974d4){return db[_0x83cd('0x40')]['find']({'where':{'id':_0x3e6046[_0x83cd('0x55')]['id']}})[_0x83cd('0x21')](handleEntityNotFound(_0x29ec35,null))[_0x83cd('0x21')](function(_0x1be8d7){if(_0x1be8d7){return _0x1be8d7[_0x83cd('0x8e')](_0x3e6046[_0x83cd('0x44')]['ids'])[_0x83cd('0x21')](function(){if(_[_0x83cd('0x94')](_0x3e6046[_0x83cd('0x44')][_0x83cd('0x71')])){for(var _0xb77beb=0x0;_0xb77beb<_0x3e6046[_0x83cd('0x44')][_0x83cd('0x71')][_0x83cd('0x57')];_0xb77beb+=0x1){socket[_0x83cd('0x8f')]('userChatQueue:remove',{'UserId':Number(_0x3e6046[_0x83cd('0x44')][_0x83cd('0x71')][_0xb77beb]),'ChatQueueId':Number(_0x3e6046[_0x83cd('0x55')]['id'])});}}else{socket[_0x83cd('0x8f')](_0x83cd('0x90'),{'UserId':Number(_0x3e6046[_0x83cd('0x44')][_0x83cd('0x71')]),'ChatQueueId':Number(_0x3e6046[_0x83cd('0x55')]['id'])});}});}})[_0x83cd('0x21')](respondWithStatusCode(_0x29ec35,null))[_0x83cd('0x2a')](handleError(_0x29ec35,null));};exports[_0x83cd('0x95')]=function(_0x31d8b,_0x399a3b,_0x3f76dd){var _0xb98480={};var _0x2d6482={};var _0x41b1da;var _0x2d1477;return db[_0x83cd('0x40')][_0x83cd('0x64')]({'where':{'id':_0x31d8b[_0x83cd('0x55')]['id']}})[_0x83cd('0x21')](handleEntityNotFound(_0x399a3b,null))['then'](function(_0x577287){if(_0x577287){_0x41b1da=_0x577287;_0x2d6482[_0x83cd('0x48')]=_[_0x83cd('0x45')](db['User']['rawAttributes']);_0x2d6482['query']=_['keys'](_0x31d8b[_0x83cd('0x44')]);_0x2d6482[_0x83cd('0x46')]=_[_0x83cd('0x47')](_0x2d6482['model'],_0x2d6482[_0x83cd('0x44')]);_0xb98480['attributes']=_[_0x83cd('0x47')](_0x2d6482[_0x83cd('0x48')],qs[_0x83cd('0x49')](_0x31d8b['query'][_0x83cd('0x49')]));_0xb98480[_0x83cd('0x4a')]=_0xb98480['attributes'][_0x83cd('0x57')]?_0xb98480[_0x83cd('0x4a')]:_0x2d6482['model'];_0xb98480[_0x83cd('0x4d')]=qs[_0x83cd('0x4e')](_0x31d8b[_0x83cd('0x44')][_0x83cd('0x4e')]);_0xb98480[_0x83cd('0x51')]=qs[_0x83cd('0x46')](_[_0x83cd('0x4f')](_0x31d8b[_0x83cd('0x44')],_0x2d6482['filters']));if(_0x31d8b['query'][_0x83cd('0x50')]){_0xb98480[_0x83cd('0x51')]=_[_0x83cd('0x52')](_0xb98480[_0x83cd('0x51')],{'$or':_['map'](_0xb98480[_0x83cd('0x4a')],function(_0x1f0f82){var _0x16178d={};_0x16178d[_0x1f0f82]={'$like':'%'+_0x31d8b[_0x83cd('0x44')][_0x83cd('0x50')]+'%'};return _0x16178d;})});}_0xb98480=_['merge']({},_0xb98480,_0x31d8b['options']);return _0x41b1da['getAgents'](_0xb98480);}})[_0x83cd('0x21')](function(_0x18dfb7){if(_0x18dfb7){_0x2d1477=_0x18dfb7[_0x83cd('0x57')];if(!_0x31d8b[_0x83cd('0x44')][_0x83cd('0x4b')](_0x83cd('0x4c'))){_0xb98480[_0x83cd('0x31')]=qs[_0x83cd('0x31')](_0x31d8b[_0x83cd('0x44')][_0x83cd('0x31')]);_0xb98480[_0x83cd('0x2e')]=qs[_0x83cd('0x2e')](_0x31d8b[_0x83cd('0x44')]['offset']);}return _0x41b1da['getAgents'](_0xb98480);}})[_0x83cd('0x21')](function(_0x5352ed){if(_0x5352ed){return _0x5352ed?{'count':_0x2d1477,'rows':_0x5352ed}:null;}})[_0x83cd('0x21')](respondWithResult(_0x399a3b,null))['catch'](handleError(_0x399a3b,null));}; \ No newline at end of file +var _0xcc60=['sox','ejs','squel','crypto','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','redis','defaults','./chatQueue.socket','register','client','http','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','ChatQueues','UserProfileResource','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','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','describe','findOne','UserChatQueue','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','addTeams','ids','Team','Agents','interface','flatMap','sequelize','each','findOrCreate','emit','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','push','QueryTypes','every','TeamId','includes','all','union','compact','transaction','removeTeams','isEmpty','forEach','userChatQueue:remove','addAgents','omit','userChatQueue:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path'];(function(_0x251ff5,_0x46ec67){var _0x3f07c5=function(_0xb89ff9){while(--_0xb89ff9){_0x251ff5['push'](_0x251ff5['shift']());}};_0x3f07c5(++_0x46ec67);}(_0xcc60,0x94));var _0x0cc6=function(_0x5ad22d,_0x24208f){_0x5ad22d=_0x5ad22d-0x0;var _0x4390e8=_0xcc60[_0x5ad22d];return _0x4390e8;};'use strict';var emlformat=require(_0x0cc6('0x0'));var rimraf=require(_0x0cc6('0x1'));var zipdir=require(_0x0cc6('0x2'));var jsonpatch=require(_0x0cc6('0x3'));var rp=require(_0x0cc6('0x4'));var moment=require(_0x0cc6('0x5'));var BPromise=require(_0x0cc6('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0cc6('0x7'));var sox=require(_0x0cc6('0x8'));var csv=require('to-csv');var ejs=require(_0x0cc6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0cc6('0xa'));var crypto=require(_0x0cc6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0cc6('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0cc6('0xd'));var Papa=require(_0x0cc6('0xe'));var Redis=require(_0x0cc6('0xf'));var authService=require(_0x0cc6('0x10'));var qs=require(_0x0cc6('0x11'));var as=require(_0x0cc6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0cc6('0x13'))(_0x0cc6('0x14'));var utils=require(_0x0cc6('0x15'));var config=require(_0x0cc6('0x16'));var licenseUtil=require(_0x0cc6('0x17'));var db=require(_0x0cc6('0x18'))['db'];config[_0x0cc6('0x19')]=_[_0x0cc6('0x1a')](config[_0x0cc6('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0cc6('0x19')]));require(_0x0cc6('0x1b'))[_0x0cc6('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0cc6('0x1d')][_0x0cc6('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2f5279,_0x10fb57,_0x37aa80,_0x4bb856){return new BPromise(function(_0x495a24,_0x7b84a7){var _0x3b0b00=_0x4bb856||client;return _0x3b0b00[_0x0cc6('0x1f')](_0x2f5279,_0x37aa80)['then'](function(_0x453120){logger['info'](_0x0cc6('0x20'),_0x10fb57,_0x0cc6('0x21'));logger[_0x0cc6('0x22')](_0x0cc6('0x23'),_0x10fb57,_0x0cc6('0x21'),JSON[_0x0cc6('0x24')](_0x453120));if(_0x453120[_0x0cc6('0x25')]){if(_0x453120[_0x0cc6('0x25')][_0x0cc6('0x26')]===0x1f4){logger[_0x0cc6('0x25')](_0x0cc6('0x20'),_0x10fb57,_0x453120[_0x0cc6('0x25')]['message']);return _0x7b84a7(_0x453120[_0x0cc6('0x25')][_0x0cc6('0x27')]);}logger[_0x0cc6('0x25')](_0x0cc6('0x20'),_0x10fb57,_0x453120[_0x0cc6('0x25')]['message']);return _0x495a24(_0x453120[_0x0cc6('0x25')]['message']);}else{logger[_0x0cc6('0x28')](_0x0cc6('0x20'),_0x10fb57,_0x0cc6('0x21'));_0x495a24(_0x453120[_0x0cc6('0x29')][_0x0cc6('0x27')]);}})['catch'](function(_0x4cac90){logger['error'](_0x0cc6('0x20'),_0x10fb57,_0x4cac90);_0x7b84a7(_0x4cac90);});});}function respondWithStatusCode(_0x5b7cec,_0x14b259){_0x14b259=_0x14b259||0xcc;return function(_0x5d6a39){if(_0x5d6a39){return _0x5b7cec[_0x0cc6('0x2a')](_0x14b259);}return _0x5b7cec[_0x0cc6('0x2b')](_0x14b259)[_0x0cc6('0x2c')]();};}function respondWithResult(_0xf78e8d,_0x4e78b1){_0x4e78b1=_0x4e78b1||0xc8;return function(_0x16c020){if(_0x16c020){return _0xf78e8d[_0x0cc6('0x2b')](_0x4e78b1)[_0x0cc6('0x2d')](_0x16c020);}};}function respondWithFilteredResult(_0x4c171d,_0x32ef11){return function(_0x2f563a){if(_0x2f563a){var _0x5affc4=typeof _0x32ef11[_0x0cc6('0x2e')]===_0x0cc6('0x2f')&&typeof _0x32ef11[_0x0cc6('0x30')]===_0x0cc6('0x2f');var _0x1e899f=_0x2f563a[_0x0cc6('0x31')];var _0x3b603e=_0x5affc4?0x0:_0x32ef11[_0x0cc6('0x2e')];var _0x1bbb4a=_0x5affc4?_0x2f563a['count']:_0x32ef11['offset']+_0x32ef11[_0x0cc6('0x30')];var _0x1bec41;if(_0x1bbb4a>=_0x1e899f){_0x1bbb4a=_0x1e899f;_0x1bec41=0xc8;}else{_0x1bec41=0xce;}_0x4c171d[_0x0cc6('0x2b')](_0x1bec41);return _0x4c171d[_0x0cc6('0x32')](_0x0cc6('0x33'),_0x3b603e+'-'+_0x1bbb4a+'/'+_0x1e899f)[_0x0cc6('0x2d')](_0x2f563a);}return null;};}function patchUpdates(_0x250c85){return function(_0x67d9f8){try{jsonpatch[_0x0cc6('0x34')](_0x67d9f8,_0x250c85,!![]);}catch(_0x1392fb){return BPromise[_0x0cc6('0x35')](_0x1392fb);}return _0x67d9f8[_0x0cc6('0x36')]();};}function saveUpdates(_0x54b978,_0x47cfd3){return function(_0x1448a9){if(_0x1448a9){return _0x1448a9[_0x0cc6('0x37')](_0x54b978)['then'](function(_0xceb24b){return _0xceb24b;});}return null;};}function removeEntity(_0x19c39d,_0xf0e452){return function(_0x2b6b43){if(_0x2b6b43){return _0x2b6b43[_0x0cc6('0x38')]()[_0x0cc6('0x39')](function(){var _0x155345=_0x2b6b43[_0x0cc6('0x3a')]({'plain':!![]});var _0x39f575=_0x0cc6('0x3b');return db[_0x0cc6('0x3c')][_0x0cc6('0x38')]({'where':{'type':_0x39f575,'resourceId':_0x155345['id']}})['then'](function(){return _0x2b6b43;});})[_0x0cc6('0x39')](function(){_0x19c39d[_0x0cc6('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42a49e,_0x3facf5){return function(_0x998a75){if(!_0x998a75){_0x42a49e['sendStatus'](0x194);}return _0x998a75;};}function handleError(_0x5a359a,_0x148728){_0x148728=_0x148728||0x1f4;return function(_0x3cb381){logger[_0x0cc6('0x25')](_0x3cb381[_0x0cc6('0x3d')]);if(_0x3cb381[_0x0cc6('0x3e')]){delete _0x3cb381[_0x0cc6('0x3e')];}_0x5a359a[_0x0cc6('0x2b')](_0x148728)[_0x0cc6('0x3f')](_0x3cb381);};}exports[_0x0cc6('0x40')]=function(_0x452f4d,_0x9fabb1){var _0x1b88b7={},_0x226bb8={},_0x5920d1={'count':0x0,'rows':[]};var _0x208540=_[_0x0cc6('0x41')](db[_0x0cc6('0x42')][_0x0cc6('0x43')],function(_0x52136e){return{'name':_0x52136e[_0x0cc6('0x44')],'type':_0x52136e['type']['key']};});_0x226bb8[_0x0cc6('0x45')]=_[_0x0cc6('0x41')](_0x208540,'name');_0x226bb8['query']=_[_0x0cc6('0x46')](_0x452f4d[_0x0cc6('0x47')]);_0x226bb8['filters']=_[_0x0cc6('0x48')](_0x226bb8['model'],_0x226bb8['query']);_0x1b88b7[_0x0cc6('0x49')]=_[_0x0cc6('0x48')](_0x226bb8['model'],qs[_0x0cc6('0x4a')](_0x452f4d['query']['fields']));_0x1b88b7[_0x0cc6('0x49')]=_0x1b88b7['attributes'][_0x0cc6('0x4b')]?_0x1b88b7['attributes']:_0x226bb8[_0x0cc6('0x45')];if(!_0x452f4d[_0x0cc6('0x47')][_0x0cc6('0x4c')](_0x0cc6('0x4d'))){_0x1b88b7[_0x0cc6('0x30')]=qs[_0x0cc6('0x30')](_0x452f4d[_0x0cc6('0x47')]['limit']);_0x1b88b7['offset']=qs[_0x0cc6('0x2e')](_0x452f4d[_0x0cc6('0x47')]['offset']);}_0x1b88b7[_0x0cc6('0x4e')]=qs[_0x0cc6('0x4f')](_0x452f4d['query'][_0x0cc6('0x4f')]);_0x1b88b7[_0x0cc6('0x50')]=qs[_0x0cc6('0x51')](_[_0x0cc6('0x52')](_0x452f4d[_0x0cc6('0x47')],_0x226bb8[_0x0cc6('0x51')]),_0x208540);if(_0x452f4d[_0x0cc6('0x47')][_0x0cc6('0x53')]){_0x1b88b7[_0x0cc6('0x50')]=_[_0x0cc6('0x54')](_0x1b88b7[_0x0cc6('0x50')],{'$or':_[_0x0cc6('0x41')](_0x208540,function(_0x248dc1){if(_0x248dc1[_0x0cc6('0x55')]!==_0x0cc6('0x56')){var _0x1c232a={};_0x1c232a[_0x248dc1['name']]={'$like':'%'+_0x452f4d[_0x0cc6('0x47')][_0x0cc6('0x53')]+'%'};return _0x1c232a;}})});}_0x1b88b7=_[_0x0cc6('0x54')]({},_0x1b88b7,_0x452f4d[_0x0cc6('0x57')]);var _0x535510={'where':_0x1b88b7['where']};return db['ChatQueue'][_0x0cc6('0x31')](_0x535510)['then'](function(_0x1ed7e4){_0x5920d1[_0x0cc6('0x31')]=_0x1ed7e4;if(_0x452f4d['query'][_0x0cc6('0x58')]){_0x1b88b7['include']=[{'all':!![]}];}return db[_0x0cc6('0x42')][_0x0cc6('0x59')](_0x1b88b7);})[_0x0cc6('0x39')](function(_0x5efff3){_0x5920d1[_0x0cc6('0x5a')]=_0x5efff3;return _0x5920d1;})['then'](respondWithFilteredResult(_0x9fabb1,_0x1b88b7))[_0x0cc6('0x5b')](handleError(_0x9fabb1,null));};exports[_0x0cc6('0x5c')]=function(_0x49a132,_0xbe1f65){var _0x58f9d9={'raw':!![],'where':{'id':_0x49a132[_0x0cc6('0x5d')]['id']}},_0x3e78e9={};_0x3e78e9['model']=_[_0x0cc6('0x46')](db[_0x0cc6('0x42')][_0x0cc6('0x43')]);_0x3e78e9[_0x0cc6('0x47')]=_[_0x0cc6('0x46')](_0x49a132[_0x0cc6('0x47')]);_0x3e78e9[_0x0cc6('0x51')]=_[_0x0cc6('0x48')](_0x3e78e9[_0x0cc6('0x45')],_0x3e78e9[_0x0cc6('0x47')]);_0x58f9d9[_0x0cc6('0x49')]=_[_0x0cc6('0x48')](_0x3e78e9[_0x0cc6('0x45')],qs[_0x0cc6('0x4a')](_0x49a132['query'][_0x0cc6('0x4a')]));_0x58f9d9[_0x0cc6('0x49')]=_0x58f9d9[_0x0cc6('0x49')][_0x0cc6('0x4b')]?_0x58f9d9[_0x0cc6('0x49')]:_0x3e78e9[_0x0cc6('0x45')];if(_0x49a132[_0x0cc6('0x47')]['includeAll']){_0x58f9d9['include']=[{'all':!![]}];}_0x58f9d9=_[_0x0cc6('0x54')]({},_0x58f9d9,_0x49a132['options']);return db[_0x0cc6('0x42')][_0x0cc6('0x5e')](_0x58f9d9)[_0x0cc6('0x39')](handleEntityNotFound(_0xbe1f65,null))[_0x0cc6('0x39')](respondWithResult(_0xbe1f65,null))[_0x0cc6('0x5b')](handleError(_0xbe1f65,null));};exports['create']=function(_0x12cd7e,_0x3ffaa8){return db['ChatQueue'][_0x0cc6('0x5f')](_0x12cd7e[_0x0cc6('0x60')],{})[_0x0cc6('0x39')](function(_0x45dd2f){var _0x328b5f=_0x12cd7e[_0x0cc6('0x61')][_0x0cc6('0x3a')]({'plain':!![]});if(!_0x328b5f)throw new Error(_0x0cc6('0x62'));if(_0x328b5f[_0x0cc6('0x63')]===_0x0cc6('0x61')){var _0x2918c6=_0x45dd2f[_0x0cc6('0x3a')]({'plain':!![]});var _0xe239db=_0x0cc6('0x3b');return db[_0x0cc6('0x64')]['find']({'where':{'name':_0xe239db,'userProfileId':_0x328b5f[_0x0cc6('0x65')]},'raw':!![]})['then'](function(_0x2a79ea){if(_0x2a79ea&&_0x2a79ea[_0x0cc6('0x66')]===0x0){return db[_0x0cc6('0x3c')][_0x0cc6('0x5f')]({'name':_0x2918c6[_0x0cc6('0x3e')],'resourceId':_0x2918c6['id'],'type':_0x2a79ea[_0x0cc6('0x3e')],'sectionId':_0x2a79ea['id']},{})['then'](function(){return _0x45dd2f;});}else{return _0x45dd2f;}})['catch'](function(_0x513d28){logger[_0x0cc6('0x25')](_0x0cc6('0x67'),_0x513d28);throw _0x513d28;});}return _0x45dd2f;})['then'](respondWithResult(_0x3ffaa8,0xc9))[_0x0cc6('0x5b')](handleError(_0x3ffaa8,null));};exports['update']=function(_0x19de41,_0x3439a8){if(_0x19de41[_0x0cc6('0x60')]['id']){delete _0x19de41[_0x0cc6('0x60')]['id'];}return db[_0x0cc6('0x42')][_0x0cc6('0x5e')]({'where':{'id':_0x19de41[_0x0cc6('0x5d')]['id']}})[_0x0cc6('0x39')](handleEntityNotFound(_0x3439a8,null))[_0x0cc6('0x39')](saveUpdates(_0x19de41[_0x0cc6('0x60')],null))[_0x0cc6('0x39')](respondWithResult(_0x3439a8,null))[_0x0cc6('0x5b')](handleError(_0x3439a8,null));};exports['destroy']=function(_0x261574,_0x4d3132){return db['ChatQueue'][_0x0cc6('0x5e')]({'where':{'id':_0x261574[_0x0cc6('0x5d')]['id']}})[_0x0cc6('0x39')](handleEntityNotFound(_0x4d3132,null))[_0x0cc6('0x39')](removeEntity(_0x4d3132,null))[_0x0cc6('0x5b')](handleError(_0x4d3132,null));};exports['describe']=function(_0x23499e,_0x56280d){return db['ChatQueue'][_0x0cc6('0x68')]()[_0x0cc6('0x39')](respondWithResult(_0x56280d,null))[_0x0cc6('0x5b')](handleError(_0x56280d,null));};exports['getMembers']=function(_0x9a9088,_0x3a7fee,_0xaa4539){var _0x433d55={'raw':!![],'where':{}},_0x5b2e8d={},_0x1fc77d;return db[_0x0cc6('0x42')][_0x0cc6('0x69')]({'where':{'id':_0x9a9088[_0x0cc6('0x5d')]['id']}})[_0x0cc6('0x39')](handleEntityNotFound(_0x3a7fee,null))[_0x0cc6('0x39')](function(_0x488d15){if(_0x488d15){_0x1fc77d=_0x488d15[_0x0cc6('0x3a')]({'plain':!![]});_0x5b2e8d['model']=_[_0x0cc6('0x46')](db[_0x0cc6('0x6a')][_0x0cc6('0x43')]);_0x5b2e8d[_0x0cc6('0x47')]=_[_0x0cc6('0x46')](_0x9a9088['query']);_0x5b2e8d[_0x0cc6('0x51')]=_[_0x0cc6('0x48')](_0x5b2e8d[_0x0cc6('0x45')],_0x5b2e8d[_0x0cc6('0x47')]);_0x433d55[_0x0cc6('0x49')]=_[_0x0cc6('0x48')](_0x5b2e8d[_0x0cc6('0x45')],qs[_0x0cc6('0x4a')](_0x9a9088[_0x0cc6('0x47')]['fields']));_0x433d55['attributes']=_0x433d55['attributes'][_0x0cc6('0x4b')]?_0x433d55['attributes']:_0x5b2e8d[_0x0cc6('0x45')];if(!_0x9a9088[_0x0cc6('0x47')][_0x0cc6('0x4c')](_0x0cc6('0x4d'))){_0x433d55[_0x0cc6('0x30')]=qs['limit'](_0x9a9088[_0x0cc6('0x47')][_0x0cc6('0x30')]);_0x433d55[_0x0cc6('0x2e')]=qs[_0x0cc6('0x2e')](_0x9a9088['query'][_0x0cc6('0x2e')]);}_0x433d55[_0x0cc6('0x4e')]=qs[_0x0cc6('0x4f')](_0x9a9088[_0x0cc6('0x47')][_0x0cc6('0x4f')]);_0x433d55[_0x0cc6('0x50')]=qs[_0x0cc6('0x51')](_['pick'](_0x9a9088[_0x0cc6('0x47')],_0x5b2e8d[_0x0cc6('0x51')]));_0x433d55[_0x0cc6('0x50')][_0x0cc6('0x6b')]=_0x488d15['id'];if(_0x9a9088['query'][_0x0cc6('0x53')]){_0x433d55[_0x0cc6('0x50')]=_['merge'](_0x433d55['where'],{'$or':_['map'](_0x433d55['attributes'],function(_0x3678ef){var _0x38c1a2={};_0x38c1a2[_0x3678ef]={'$like':'%'+_0x9a9088['query']['filter']+'%'};return _0x38c1a2;})});}_0x433d55=_['merge']({},_0x433d55,_0x9a9088[_0x0cc6('0x57')]);return db['UserChatQueue'][_0x0cc6('0x59')](_0x433d55);}})['then'](function(_0x2ba199){if(_0x2ba199){return db[_0x0cc6('0x6c')][_0x0cc6('0x6d')]({'where':{'id':_[_0x0cc6('0x41')](_0x2ba199,_0x0cc6('0x6e')),'role':_0x0cc6('0x6f')},'attributes':['id',_0x0cc6('0x3e'),_0x0cc6('0x70'),'updatedAt','createdAt']});}})['then'](function(_0x1a5541){if(_0x1a5541){return{'count':_0x1a5541[_0x0cc6('0x31')],'rows':_['map'](_0x1a5541[_0x0cc6('0x5a')],function(_0x4663b4){return{'membername':_0x4663b4['name'],'UserId':_0x4663b4['id'],'queue_name':_0x1fc77d[_0x0cc6('0x3e')],'ChatQueueId':_0x1fc77d['id'],'interface':util[_0x0cc6('0x71')](_0x0cc6('0x72'),_0x0cc6('0x73'),_0x4663b4[_0x0cc6('0x3e')]),'penalty':0x0,'paused':_0x4663b4[_0x0cc6('0x70')],'createdAt':_0x4663b4[_0x0cc6('0x74')],'updatedAt':_0x4663b4[_0x0cc6('0x75')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0cc6('0x39')](respondWithFilteredResult(_0x3a7fee,_0x433d55))[_0x0cc6('0x5b')](handleError(_0x3a7fee,null));};exports['getTeams']=function(_0x24b210,_0x4b4df1,_0x96cc34){var _0x132dc7={};var _0x3b68db={};var _0x3d351f;var _0x24aa76;return db[_0x0cc6('0x42')][_0x0cc6('0x69')]({'where':{'id':_0x24b210[_0x0cc6('0x5d')]['id']}})[_0x0cc6('0x39')](handleEntityNotFound(_0x4b4df1,null))[_0x0cc6('0x39')](function(_0x53dc6e){if(_0x53dc6e){_0x3d351f=_0x53dc6e;_0x3b68db[_0x0cc6('0x45')]=_[_0x0cc6('0x46')](db['Team'][_0x0cc6('0x43')]);_0x3b68db['query']=_[_0x0cc6('0x46')](_0x24b210['query']);_0x3b68db[_0x0cc6('0x51')]=_[_0x0cc6('0x48')](_0x3b68db[_0x0cc6('0x45')],_0x3b68db[_0x0cc6('0x47')]);_0x132dc7[_0x0cc6('0x49')]=_[_0x0cc6('0x48')](_0x3b68db['model'],qs[_0x0cc6('0x4a')](_0x24b210['query'][_0x0cc6('0x4a')]));_0x132dc7[_0x0cc6('0x49')]=_0x132dc7[_0x0cc6('0x49')]['length']?_0x132dc7[_0x0cc6('0x49')]:_0x3b68db[_0x0cc6('0x45')];_0x132dc7[_0x0cc6('0x4e')]=qs['sort'](_0x24b210[_0x0cc6('0x47')][_0x0cc6('0x4f')]);_0x132dc7[_0x0cc6('0x50')]=qs['filters'](_[_0x0cc6('0x52')](_0x24b210[_0x0cc6('0x47')],_0x3b68db[_0x0cc6('0x51')]));if(_0x24b210[_0x0cc6('0x47')]['filter']){_0x132dc7[_0x0cc6('0x50')]=_[_0x0cc6('0x54')](_0x132dc7[_0x0cc6('0x50')],{'$or':_['map'](_0x132dc7[_0x0cc6('0x49')],function(_0x1c9b55){var _0x57afb2={};_0x57afb2[_0x1c9b55]={'$like':'%'+_0x24b210[_0x0cc6('0x47')][_0x0cc6('0x53')]+'%'};return _0x57afb2;})});}_0x132dc7=_[_0x0cc6('0x54')]({},_0x132dc7,_0x24b210[_0x0cc6('0x57')]);return _0x3d351f[_0x0cc6('0x76')](_0x132dc7);}})[_0x0cc6('0x39')](function(_0x109107){if(_0x109107){_0x24aa76=_0x109107[_0x0cc6('0x4b')];if(!_0x24b210[_0x0cc6('0x47')][_0x0cc6('0x4c')](_0x0cc6('0x4d'))){_0x132dc7[_0x0cc6('0x30')]=qs[_0x0cc6('0x30')](_0x24b210['query'][_0x0cc6('0x30')]);_0x132dc7[_0x0cc6('0x2e')]=qs[_0x0cc6('0x2e')](_0x24b210[_0x0cc6('0x47')][_0x0cc6('0x2e')]);}return _0x3d351f[_0x0cc6('0x76')](_0x132dc7);}})[_0x0cc6('0x39')](function(_0x21fd8a){if(_0x21fd8a){return _0x21fd8a?{'count':_0x24aa76,'rows':_0x21fd8a}:null;}})[_0x0cc6('0x39')](respondWithResult(_0x4b4df1,null))['catch'](handleError(_0x4b4df1,null));};exports[_0x0cc6('0x77')]=function(_0x338fe5,_0x501436,_0x2d297c){var _0x7a4ac6=_0x338fe5[_0x0cc6('0x60')][_0x0cc6('0x78')];return db[_0x0cc6('0x79')]['findAll']({'where':{'id':_0x7a4ac6},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0cc6('0x7a'),'attributes':['id',_0x0cc6('0x3e'),'online','voicePause',_0x0cc6('0x7b')],'raw':!![]}]})[_0x0cc6('0x39')](function(_0x4c4015){if(_0x4c4015){var _0x2c93e5=_[_0x0cc6('0x7c')](_0x4c4015,function(_0x577502){var _0x353341=_0x577502['get']({'plain':!![]});return _0x353341['Agents'];});return db[_0x0cc6('0x42')]['find']({'where':{'id':_0x338fe5[_0x0cc6('0x5d')]['id']}})['then'](function(_0x929cbd){return db[_0x0cc6('0x7d')]['transaction'](function(_0x54cee5){return _0x929cbd[_0x0cc6('0x77')](_0x7a4ac6,{'transaction':_0x54cee5})['then'](function(){return BPromise[_0x0cc6('0x7e')](_0x2c93e5,function(_0x5acc13){return db[_0x0cc6('0x6a')][_0x0cc6('0x7f')]({'where':{'UserId':_0x5acc13['id'],'ChatQueueId':_0x338fe5[_0x0cc6('0x5d')]['id']},'transaction':_0x54cee5});});})[_0x0cc6('0x39')](function(){_0x2c93e5['forEach'](function(_0xe52298){socket[_0x0cc6('0x80')]('userChatQueue:save',{'UserId':_0xe52298['id'],'ChatQueueId':_0x929cbd['id']});});});});});}})[_0x0cc6('0x39')](respondWithStatusCode(_0x501436,null))['catch'](handleError(_0x501436,null));};exports['removeTeams']=function(_0x80d2a5,_0x253fc9,_0x4d7687){return db['Team'][_0x0cc6('0x59')]({'where':{'id':_0x80d2a5['query'][_0x0cc6('0x78')]},'attributes':['id'],'include':[{'model':db[_0x0cc6('0x6c')],'as':_0x0cc6('0x7a'),'attributes':['id'],'raw':!![]}]})[_0x0cc6('0x39')](handleEntityNotFound(_0x253fc9,null))[_0x0cc6('0x39')](function(_0x553289){var _0x4271a8=_[_0x0cc6('0x41')](_0x553289,'id');var _0x4c211b=[];var _0x12d2ee=[];var _0x49ae8e=squel['select']();_0x49ae8e[_0x0cc6('0x81')](_0x0cc6('0x82'))[_0x0cc6('0x83')](_0x0cc6('0x84'),'tq')[_0x0cc6('0x85')](_0x0cc6('0x86'),'ut',_0x0cc6('0x87'))[_0x0cc6('0x50')](_0x0cc6('0x88'),_0x80d2a5['params']['id']);for(var _0x204208=0x0;_0x204208<_0x553289[_0x0cc6('0x4b')];_0x204208+=0x1){let _0x3d1d0c=_0x553289[_0x204208];for(var _0xc75e94=0x0;_0xc75e94<_0x3d1d0c[_0x0cc6('0x7a')][_0x0cc6('0x4b')];_0xc75e94+=0x1){let _0x13b041=_0x3d1d0c[_0x0cc6('0x7a')][_0xc75e94];var _0x1124e3=_0x49ae8e['clone']();_0x1124e3['where']('ut.UserId\x20=\x20?',_0x13b041['id']);_0x12d2ee[_0x0cc6('0x89')](db[_0x0cc6('0x7d')][_0x0cc6('0x47')](_0x1124e3['toString'](),{'type':db[_0x0cc6('0x7d')][_0x0cc6('0x8a')]['SELECT']})[_0x0cc6('0x39')](function(_0x47266d){if(_0x47266d['length']===0x1){return _0x13b041['id'];}else{var _0x351687=_[_0x0cc6('0x8b')](_[_0x0cc6('0x41')](_0x47266d,_0x0cc6('0x8c')),function(_0x361675){return _[_0x0cc6('0x8d')](_0x4271a8,_0x361675);});if(_0x351687){return _0x13b041['id'];}}}));}}return BPromise[_0x0cc6('0x8e')](_0x12d2ee)[_0x0cc6('0x39')](function(_0x23d0cc){_0x4c211b=_(_0x4c211b)[_0x0cc6('0x8f')](_0x23d0cc)[_0x0cc6('0x90')]()['value']();return db[_0x0cc6('0x42')][_0x0cc6('0x5e')]({'where':{'id':_0x80d2a5[_0x0cc6('0x5d')]['id']}})[_0x0cc6('0x39')](function(_0x3f00e0){return db['sequelize'][_0x0cc6('0x91')](function(_0x4d4a7c){return _0x3f00e0[_0x0cc6('0x92')](_0x80d2a5[_0x0cc6('0x47')][_0x0cc6('0x78')],{'transaction':_0x4d4a7c})[_0x0cc6('0x39')](function(){if(!_[_0x0cc6('0x93')](_0x4c211b)){return _0x3f00e0['removeAgents'](_0x4c211b,{'transaction':_0x4d4a7c});}})['then'](function(){_0x4c211b[_0x0cc6('0x94')](function(_0x1eba48){socket[_0x0cc6('0x80')](_0x0cc6('0x95'),{'UserId':_0x1eba48,'ChatQueueId':_0x3f00e0['id']});});});});});});})[_0x0cc6('0x39')](respondWithStatusCode(_0x253fc9,null))[_0x0cc6('0x5b')](handleError(_0x253fc9,null));};exports[_0x0cc6('0x96')]=function(_0x303ca0,_0x4ee39f,_0x34f021){return db[_0x0cc6('0x42')]['find']({'where':{'id':_0x303ca0[_0x0cc6('0x5d')]['id']}})[_0x0cc6('0x39')](handleEntityNotFound(_0x4ee39f,null))['then'](function(_0x53e011){if(_0x53e011){return _0x53e011['addAgents'](_0x303ca0[_0x0cc6('0x60')][_0x0cc6('0x78')],_[_0x0cc6('0x97')](_0x303ca0['body'],[_0x0cc6('0x78'),'id'])||{})['spread'](function(_0x38994e){for(var _0x3d3d3a=0x0;_0x3d3d3a<_0x303ca0[_0x0cc6('0x60')][_0x0cc6('0x78')][_0x0cc6('0x4b')];_0x3d3d3a+=0x1){socket['emit'](_0x0cc6('0x98'),{'UserId':Number(_0x303ca0[_0x0cc6('0x60')][_0x0cc6('0x78')][_0x3d3d3a]),'ChatQueueId':Number(_0x303ca0[_0x0cc6('0x5d')]['id'])});}return _0x38994e;});}})[_0x0cc6('0x39')](respondWithResult(_0x4ee39f,null))[_0x0cc6('0x5b')](handleError(_0x4ee39f,null));};exports[_0x0cc6('0x99')]=function(_0x3fbd8c,_0x38cafe,_0x26cf7c){return db[_0x0cc6('0x42')][_0x0cc6('0x5e')]({'where':{'id':_0x3fbd8c[_0x0cc6('0x5d')]['id']}})[_0x0cc6('0x39')](handleEntityNotFound(_0x38cafe,null))[_0x0cc6('0x39')](function(_0x4ab36b){if(_0x4ab36b){return _0x4ab36b['removeAgents'](_0x3fbd8c[_0x0cc6('0x47')][_0x0cc6('0x78')])['then'](function(){if(_[_0x0cc6('0x9a')](_0x3fbd8c[_0x0cc6('0x47')][_0x0cc6('0x78')])){for(var _0xb2058=0x0;_0xb2058<_0x3fbd8c[_0x0cc6('0x47')]['ids'][_0x0cc6('0x4b')];_0xb2058+=0x1){socket[_0x0cc6('0x80')](_0x0cc6('0x95'),{'UserId':Number(_0x3fbd8c[_0x0cc6('0x47')][_0x0cc6('0x78')][_0xb2058]),'ChatQueueId':Number(_0x3fbd8c[_0x0cc6('0x5d')]['id'])});}}else{socket[_0x0cc6('0x80')](_0x0cc6('0x95'),{'UserId':Number(_0x3fbd8c[_0x0cc6('0x47')][_0x0cc6('0x78')]),'ChatQueueId':Number(_0x3fbd8c[_0x0cc6('0x5d')]['id'])});}});}})[_0x0cc6('0x39')](respondWithStatusCode(_0x38cafe,null))[_0x0cc6('0x5b')](handleError(_0x38cafe,null));};exports[_0x0cc6('0x9b')]=function(_0x375707,_0x54610d,_0x3c1e40){var _0x455bc0={};var _0xd80d03={};var _0x50eb10;var _0xaecbdd;return db[_0x0cc6('0x42')][_0x0cc6('0x69')]({'where':{'id':_0x375707[_0x0cc6('0x5d')]['id']}})[_0x0cc6('0x39')](handleEntityNotFound(_0x54610d,null))[_0x0cc6('0x39')](function(_0x3305f3){if(_0x3305f3){_0x50eb10=_0x3305f3;_0xd80d03[_0x0cc6('0x45')]=_[_0x0cc6('0x46')](db[_0x0cc6('0x6c')][_0x0cc6('0x43')]);_0xd80d03[_0x0cc6('0x47')]=_['keys'](_0x375707[_0x0cc6('0x47')]);_0xd80d03[_0x0cc6('0x51')]=_[_0x0cc6('0x48')](_0xd80d03[_0x0cc6('0x45')],_0xd80d03[_0x0cc6('0x47')]);_0x455bc0['attributes']=_[_0x0cc6('0x48')](_0xd80d03[_0x0cc6('0x45')],qs[_0x0cc6('0x4a')](_0x375707[_0x0cc6('0x47')][_0x0cc6('0x4a')]));_0x455bc0[_0x0cc6('0x49')]=_0x455bc0[_0x0cc6('0x49')][_0x0cc6('0x4b')]?_0x455bc0[_0x0cc6('0x49')]:_0xd80d03[_0x0cc6('0x45')];_0x455bc0['order']=qs[_0x0cc6('0x4f')](_0x375707['query']['sort']);_0x455bc0[_0x0cc6('0x50')]=qs[_0x0cc6('0x51')](_[_0x0cc6('0x52')](_0x375707[_0x0cc6('0x47')],_0xd80d03['filters']));if(_0x375707['query'][_0x0cc6('0x53')]){_0x455bc0[_0x0cc6('0x50')]=_['merge'](_0x455bc0[_0x0cc6('0x50')],{'$or':_[_0x0cc6('0x41')](_0x455bc0[_0x0cc6('0x49')],function(_0x3223d3){var _0x7d4d86={};_0x7d4d86[_0x3223d3]={'$like':'%'+_0x375707['query']['filter']+'%'};return _0x7d4d86;})});}_0x455bc0=_[_0x0cc6('0x54')]({},_0x455bc0,_0x375707[_0x0cc6('0x57')]);return _0x50eb10['getAgents'](_0x455bc0);}})[_0x0cc6('0x39')](function(_0x41b937){if(_0x41b937){_0xaecbdd=_0x41b937[_0x0cc6('0x4b')];if(!_0x375707['query'][_0x0cc6('0x4c')](_0x0cc6('0x4d'))){_0x455bc0[_0x0cc6('0x30')]=qs[_0x0cc6('0x30')](_0x375707[_0x0cc6('0x47')][_0x0cc6('0x30')]);_0x455bc0[_0x0cc6('0x2e')]=qs[_0x0cc6('0x2e')](_0x375707[_0x0cc6('0x47')][_0x0cc6('0x2e')]);}return _0x50eb10[_0x0cc6('0x9b')](_0x455bc0);}})['then'](function(_0x365ee2){if(_0x365ee2){return _0x365ee2?{'count':_0xaecbdd,'rows':_0x365ee2}:null;}})[_0x0cc6('0x39')](respondWithResult(_0x54610d,null))[_0x0cc6('0x5b')](handleError(_0x54610d,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 3be1ce3..ff421ed 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 _0xc4ed=['setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xc4ed,0x67));var _0xdc4e=function(_0x32c98a,_0x5e6eb0){_0x32c98a=_0x32c98a-0x0;var _0x1796d3=_0xc4ed[_0x32c98a];return _0x1796d3;};'use strict';var EventEmitter=require(_0xdc4e('0x0'));var ChatQueue=require('../../mysqldb')['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xdc4e('0x1')](0x0);var events={'afterCreate':_0xdc4e('0x2'),'afterUpdate':_0xdc4e('0x3'),'afterDestroy':_0xdc4e('0x4')};function emitEvent(_0x2bea13){return function(_0x3685a9,_0x290a17,_0x49934b){ChatQueueEvents[_0xdc4e('0x5')](_0x2bea13+':'+_0x3685a9['id'],_0x3685a9);ChatQueueEvents[_0xdc4e('0x5')](_0x2bea13,_0x3685a9);_0x49934b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0xdc4e('0x6')](e,emitEvent(event));}}module[_0xdc4e('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0xca44=['ChatQueue','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1ba1f4,_0x2a4699){var _0x8924ff=function(_0x33ab3c){while(--_0x33ab3c){_0x1ba1f4['push'](_0x1ba1f4['shift']());}};_0x8924ff(++_0x2a4699);}(_0xca44,0xb3));var _0x4ca4=function(_0x3518f4,_0x32ef4a){_0x3518f4=_0x3518f4-0x0;var _0x5e6e7a=_0xca44[_0x3518f4];return _0x5e6e7a;};'use strict';var EventEmitter=require(_0x4ca4('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x4ca4('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4ca4('0x2'),'afterUpdate':_0x4ca4('0x3'),'afterDestroy':_0x4ca4('0x4')};function emitEvent(_0x3af75d){return function(_0x55267e,_0x35c500,_0x2bbed3){ChatQueueEvents['emit'](_0x3af75d+':'+_0x55267e['id'],_0x55267e);ChatQueueEvents[_0x4ca4('0x5')](_0x3af75d,_0x55267e);_0x2bbed3(null);};}for(var e in events){if(events[_0x4ca4('0x6')](e)){var event=events[e];ChatQueue[_0x4ca4('0x7')](e,emitEvent(event));}}module[_0x4ca4('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 26484de..27462a6 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 _0x5028=['request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x46bb29,_0x472588){var _0x4c2e73=function(_0x3c3db9){while(--_0x3c3db9){_0x46bb29['push'](_0x46bb29['shift']());}};_0x4c2e73(++_0x472588);}(_0x5028,0xea));var _0x8502=function(_0x163109,_0x2cf43a){_0x163109=_0x163109-0x0;var _0x734812=_0x5028[_0x163109];return _0x734812;};'use strict';var _=require(_0x8502('0x0'));var util=require(_0x8502('0x1'));var logger=require(_0x8502('0x2'))(_0x8502('0x3'));var moment=require(_0x8502('0x4'));var BPromise=require(_0x8502('0x5'));var rp=require(_0x8502('0x6'));var fs=require('fs');var path=require(_0x8502('0x7'));var rimraf=require(_0x8502('0x8'));var config=require(_0x8502('0x9'));var attributes=require(_0x8502('0xa'));module[_0x8502('0xb')]=function(_0x49ff66,_0x247444){return _0x49ff66[_0x8502('0xc')](_0x8502('0xd'),attributes,{'tableName':_0x8502('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4a5=['api','moment','request-promise','rimraf','exports','define','chat_queues','lodash','util','../../config/logger'];(function(_0x29d822,_0x403b48){var _0x474901=function(_0x214132){while(--_0x214132){_0x29d822['push'](_0x29d822['shift']());}};_0x474901(++_0x403b48);}(_0xb4a5,0x1d3));var _0x5b4a=function(_0x1ccaed,_0x385b01){_0x1ccaed=_0x1ccaed-0x0;var _0x49d58b=_0xb4a5[_0x1ccaed];return _0x49d58b;};'use strict';var _=require(_0x5b4a('0x0'));var util=require(_0x5b4a('0x1'));var logger=require(_0x5b4a('0x2'))(_0x5b4a('0x3'));var moment=require(_0x5b4a('0x4'));var BPromise=require('bluebird');var rp=require(_0x5b4a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5b4a('0x6'));var config=require('../../config/environment');var attributes=require('./chatQueue.attributes');module[_0x5b4a('0x7')]=function(_0x58e58e,_0x49d463){return _0x58e58e[_0x5b4a('0x8')]('ChatQueue',attributes,{'tableName':_0x5b4a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 3b35bc4..356e145 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 _0xf5b6=['code','message','info','result','catch','findAll','options','raw','where','attributes','limit','model','include','map','GetChatQueue','ShowChatQueue','ChatQueue','find','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x579dbf,_0x513bc5){var _0x25121f=function(_0x30baa7){while(--_0x30baa7){_0x579dbf['push'](_0x579dbf['shift']());}};_0x25121f(++_0x513bc5);}(_0xf5b6,0x1b4));var _0x6f5b=function(_0x2f019a,_0x27cc99){_0x2f019a=_0x2f019a-0x0;var _0x577fa6=_0xf5b6[_0x2f019a];return _0x577fa6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6f5b('0x0'));var BPromise=require(_0x6f5b('0x1'));var rs=require(_0x6f5b('0x2'));var fs=require('fs');var Redis=require(_0x6f5b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f5b('0x4'));var logger=require(_0x6f5b('0x5'))(_0x6f5b('0x6'));var config=require(_0x6f5b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6f5b('0x8')]({'port':0x232a});config[_0x6f5b('0x9')]=_['defaults'](config['redis'],{'host':_0x6f5b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f5b('0x9')]));require(_0x6f5b('0xb'))[_0x6f5b('0xc')](socket);function respondWithRpcPromise(_0x484da9,_0x39748e,_0x4ce327){return new BPromise(function(_0x2fde5b,_0xc629e){return client[_0x6f5b('0xd')](_0x484da9,_0x4ce327)[_0x6f5b('0xe')](function(_0x3aa611){logger['info'](_0x6f5b('0xf'),_0x39748e,_0x6f5b('0x10'));logger[_0x6f5b('0x11')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x39748e,'request\x20sent',JSON[_0x6f5b('0x12')](_0x3aa611));if(_0x3aa611[_0x6f5b('0x13')]){if(_0x3aa611[_0x6f5b('0x13')][_0x6f5b('0x14')]===0x1f4){logger[_0x6f5b('0x13')](_0x6f5b('0xf'),_0x39748e,_0x3aa611[_0x6f5b('0x13')]['message']);return _0xc629e(_0x3aa611[_0x6f5b('0x13')][_0x6f5b('0x15')]);}logger['error'](_0x6f5b('0xf'),_0x39748e,_0x3aa611[_0x6f5b('0x13')][_0x6f5b('0x15')]);return _0x2fde5b(_0x3aa611[_0x6f5b('0x13')][_0x6f5b('0x15')]);}else{logger[_0x6f5b('0x16')](_0x6f5b('0xf'),_0x39748e,_0x6f5b('0x10'));_0x2fde5b(_0x3aa611[_0x6f5b('0x17')][_0x6f5b('0x15')]);}})[_0x6f5b('0x18')](function(_0x2739b1){logger[_0x6f5b('0x13')](_0x6f5b('0xf'),_0x39748e,_0x2739b1);_0xc629e(_0x2739b1);});});}exports['GetChatQueue']=function(_0x297d04){var _0x13362f=this;return new Promise(function(_0x3c18fd,_0x448a8a){return db['ChatQueue'][_0x6f5b('0x19')]({'raw':_0x297d04[_0x6f5b('0x1a')]?_0x297d04['options'][_0x6f5b('0x1b')]===undefined?!![]:![]:!![],'where':_0x297d04[_0x6f5b('0x1a')]?_0x297d04[_0x6f5b('0x1a')][_0x6f5b('0x1c')]||null:null,'attributes':_0x297d04['options']?_0x297d04[_0x6f5b('0x1a')][_0x6f5b('0x1d')]||null:null,'limit':_0x297d04[_0x6f5b('0x1a')]?_0x297d04[_0x6f5b('0x1a')][_0x6f5b('0x1e')]||null:null,'include':_0x297d04[_0x6f5b('0x1a')]?_0x297d04['options']['include']?_['map'](_0x297d04['options']['include'],function(_0x4fc1d6){return{'model':db[_0x4fc1d6[_0x6f5b('0x1f')]],'as':_0x4fc1d6['as'],'attributes':_0x4fc1d6['attributes'],'include':_0x4fc1d6[_0x6f5b('0x20')]?_[_0x6f5b('0x21')](_0x4fc1d6[_0x6f5b('0x20')],function(_0x5347cc){return{'model':db[_0x5347cc[_0x6f5b('0x1f')]],'as':_0x5347cc['as'],'attributes':_0x5347cc[_0x6f5b('0x1d')],'include':_0x5347cc['include']?_[_0x6f5b('0x21')](_0x5347cc[_0x6f5b('0x20')],function(_0x4fa5de){return{'model':db[_0x4fa5de[_0x6f5b('0x1f')]],'as':_0x4fa5de['as'],'attributes':_0x4fa5de[_0x6f5b('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5835c1){logger[_0x6f5b('0x16')](_0x6f5b('0x22'),_0x297d04);logger[_0x6f5b('0x11')](_0x6f5b('0x22'),_0x297d04,JSON[_0x6f5b('0x12')](_0x5835c1));_0x3c18fd(_0x5835c1);})[_0x6f5b('0x18')](function(_0x40aef8){logger['error'](_0x6f5b('0x22'),_0x40aef8[_0x6f5b('0x15')],_0x297d04);_0x448a8a(_0x13362f[_0x6f5b('0x13')](0x1f4,_0x40aef8[_0x6f5b('0x15')]));});});};exports[_0x6f5b('0x23')]=function(_0x30c349){var _0x5d609c=this;return new Promise(function(_0x487334,_0x19499c){return db[_0x6f5b('0x24')][_0x6f5b('0x25')]({'raw':_0x30c349['options']?_0x30c349[_0x6f5b('0x1a')][_0x6f5b('0x1b')]===undefined?!![]:![]:!![],'where':_0x30c349[_0x6f5b('0x1a')]?_0x30c349[_0x6f5b('0x1a')][_0x6f5b('0x1c')]||null:null,'attributes':_0x30c349[_0x6f5b('0x1a')]?_0x30c349['options'][_0x6f5b('0x1d')]||null:null,'include':_0x30c349[_0x6f5b('0x1a')]?_0x30c349[_0x6f5b('0x1a')][_0x6f5b('0x20')]?_[_0x6f5b('0x21')](_0x30c349['options'][_0x6f5b('0x20')],function(_0x4b7cbb){return{'model':db[_0x4b7cbb[_0x6f5b('0x1f')]],'as':_0x4b7cbb['as'],'attributes':_0x4b7cbb['attributes'],'include':_0x4b7cbb['include']?_[_0x6f5b('0x21')](_0x4b7cbb['include'],function(_0x393f54){return{'model':db[_0x393f54[_0x6f5b('0x1f')]],'as':_0x393f54['as'],'attributes':_0x393f54['attributes'],'include':_0x393f54[_0x6f5b('0x20')]?_[_0x6f5b('0x21')](_0x393f54[_0x6f5b('0x20')],function(_0x4e70ac){return{'model':db[_0x4e70ac['model']],'as':_0x4e70ac['as'],'attributes':_0x4e70ac[_0x6f5b('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bb1f9){logger['info'](_0x6f5b('0x23'),_0x30c349);logger[_0x6f5b('0x11')](_0x6f5b('0x23'),_0x30c349,JSON['stringify'](_0x2bb1f9));_0x487334(_0x2bb1f9);})[_0x6f5b('0x18')](function(_0x5175d5){logger[_0x6f5b('0x13')](_0x6f5b('0x23'),_0x5175d5[_0x6f5b('0x15')],_0x30c349);_0x19499c(_0x5d609c[_0x6f5b('0x13')](0x1f4,_0x5175d5[_0x6f5b('0x15')]));});});}; \ No newline at end of file +var _0x1f20=['request\x20sent','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','include','model','ShowChatQueue','map','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x255915,_0x5c75fd){var _0xd3a1bd=function(_0xaf402f){while(--_0xaf402f){_0x255915['push'](_0x255915['shift']());}};_0xd3a1bd(++_0x5c75fd);}(_0x1f20,0x11c));var _0x01f2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1f20[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x01f2('0x0'));var util=require(_0x01f2('0x1'));var moment=require('moment');var BPromise=require(_0x01f2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x01f2('0x3'));var db=require(_0x01f2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x01f2('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x01f2('0x6'));var client=jayson[_0x01f2('0x7')][_0x01f2('0x8')]({'port':0x232a});config[_0x01f2('0x9')]=_[_0x01f2('0xa')](config[_0x01f2('0x9')],{'host':_0x01f2('0xb'),'port':0x18eb});var socket=require(_0x01f2('0xc'))(new Redis(config[_0x01f2('0x9')]));require(_0x01f2('0xd'))[_0x01f2('0xe')](socket);function respondWithRpcPromise(_0xd7815a,_0x33fd40,_0x497a3a){return new BPromise(function(_0x30abe8,_0x4a56a5){return client['request'](_0xd7815a,_0x497a3a)[_0x01f2('0xf')](function(_0xe57cbe){logger[_0x01f2('0x10')](_0x01f2('0x11'),_0x33fd40,'request\x20sent');logger[_0x01f2('0x12')](_0x01f2('0x13'),_0x33fd40,_0x01f2('0x14'),JSON[_0x01f2('0x15')](_0xe57cbe));if(_0xe57cbe['error']){if(_0xe57cbe[_0x01f2('0x16')][_0x01f2('0x17')]===0x1f4){logger[_0x01f2('0x16')]('ChatQueue,\x20%s,\x20%s',_0x33fd40,_0xe57cbe[_0x01f2('0x16')]['message']);return _0x4a56a5(_0xe57cbe[_0x01f2('0x16')][_0x01f2('0x18')]);}logger[_0x01f2('0x16')]('ChatQueue,\x20%s,\x20%s',_0x33fd40,_0xe57cbe[_0x01f2('0x16')]['message']);return _0x30abe8(_0xe57cbe['error'][_0x01f2('0x18')]);}else{logger[_0x01f2('0x10')](_0x01f2('0x11'),_0x33fd40,_0x01f2('0x14'));_0x30abe8(_0xe57cbe[_0x01f2('0x19')]['message']);}})[_0x01f2('0x1a')](function(_0x42a224){logger[_0x01f2('0x16')](_0x01f2('0x11'),_0x33fd40,_0x42a224);_0x4a56a5(_0x42a224);});});}exports[_0x01f2('0x1b')]=function(_0x136f5e){var _0x5e7a9a=this;return new Promise(function(_0x3cac5a,_0xf56702){return db[_0x01f2('0x1c')][_0x01f2('0x1d')]({'raw':_0x136f5e[_0x01f2('0x1e')]?_0x136f5e[_0x01f2('0x1e')][_0x01f2('0x1f')]===undefined?!![]:![]:!![],'where':_0x136f5e[_0x01f2('0x1e')]?_0x136f5e[_0x01f2('0x1e')][_0x01f2('0x20')]||null:null,'attributes':_0x136f5e[_0x01f2('0x1e')]?_0x136f5e[_0x01f2('0x1e')][_0x01f2('0x21')]||null:null,'limit':_0x136f5e['options']?_0x136f5e['options']['limit']||null:null,'include':_0x136f5e['options']?_0x136f5e['options'][_0x01f2('0x22')]?_['map'](_0x136f5e[_0x01f2('0x1e')][_0x01f2('0x22')],function(_0x4b4958){return{'model':db[_0x4b4958[_0x01f2('0x23')]],'as':_0x4b4958['as'],'attributes':_0x4b4958['attributes'],'include':_0x4b4958[_0x01f2('0x22')]?_['map'](_0x4b4958[_0x01f2('0x22')],function(_0x510bdb){return{'model':db[_0x510bdb['model']],'as':_0x510bdb['as'],'attributes':_0x510bdb[_0x01f2('0x21')],'include':_0x510bdb[_0x01f2('0x22')]?_['map'](_0x510bdb[_0x01f2('0x22')],function(_0x3c2e83){return{'model':db[_0x3c2e83[_0x01f2('0x23')]],'as':_0x3c2e83['as'],'attributes':_0x3c2e83[_0x01f2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x01f2('0xf')](function(_0x13c51a){logger['info'](_0x01f2('0x1b'),_0x136f5e);logger[_0x01f2('0x12')](_0x01f2('0x1b'),_0x136f5e,JSON[_0x01f2('0x15')](_0x13c51a));_0x3cac5a(_0x13c51a);})[_0x01f2('0x1a')](function(_0x57d333){logger['error'](_0x01f2('0x1b'),_0x57d333['message'],_0x136f5e);_0xf56702(_0x5e7a9a['error'](0x1f4,_0x57d333[_0x01f2('0x18')]));});});};exports[_0x01f2('0x24')]=function(_0x258786){var _0xd23135=this;return new Promise(function(_0x2a8d55,_0x5db326){return db[_0x01f2('0x1c')]['find']({'raw':_0x258786[_0x01f2('0x1e')]?_0x258786[_0x01f2('0x1e')][_0x01f2('0x1f')]===undefined?!![]:![]:!![],'where':_0x258786[_0x01f2('0x1e')]?_0x258786[_0x01f2('0x1e')][_0x01f2('0x20')]||null:null,'attributes':_0x258786['options']?_0x258786[_0x01f2('0x1e')]['attributes']||null:null,'include':_0x258786[_0x01f2('0x1e')]?_0x258786[_0x01f2('0x1e')][_0x01f2('0x22')]?_[_0x01f2('0x25')](_0x258786[_0x01f2('0x1e')][_0x01f2('0x22')],function(_0x201dc4){return{'model':db[_0x201dc4[_0x01f2('0x23')]],'as':_0x201dc4['as'],'attributes':_0x201dc4[_0x01f2('0x21')],'include':_0x201dc4[_0x01f2('0x22')]?_[_0x01f2('0x25')](_0x201dc4[_0x01f2('0x22')],function(_0x8f4c6c){return{'model':db[_0x8f4c6c[_0x01f2('0x23')]],'as':_0x8f4c6c['as'],'attributes':_0x8f4c6c['attributes'],'include':_0x8f4c6c[_0x01f2('0x22')]?_[_0x01f2('0x25')](_0x8f4c6c[_0x01f2('0x22')],function(_0x59de04){return{'model':db[_0x59de04[_0x01f2('0x23')]],'as':_0x59de04['as'],'attributes':_0x59de04[_0x01f2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x01f2('0xf')](function(_0x371271){logger[_0x01f2('0x10')](_0x01f2('0x24'),_0x258786);logger[_0x01f2('0x12')](_0x01f2('0x24'),_0x258786,JSON['stringify'](_0x371271));_0x2a8d55(_0x371271);})['catch'](function(_0x228c7d){logger['error'](_0x01f2('0x24'),_0x228c7d['message'],_0x258786);_0x5db326(_0xd23135[_0x01f2('0x16')](0x1f4,_0x228c7d[_0x01f2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index bb9b779..9696909 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 _0xf72b=['removeListener','register','length','chatQueue:','./chatQueue.events','remove','emit'];(function(_0x584da3,_0x388a44){var _0x37aeb9=function(_0x1f5b77){while(--_0x1f5b77){_0x584da3['push'](_0x584da3['shift']());}};_0x37aeb9(++_0x388a44);}(_0xf72b,0x1d9));var _0xbf72=function(_0x2e6e3d,_0x3101ea){_0x2e6e3d=_0x2e6e3d-0x0;var _0x226edf=_0xf72b[_0x2e6e3d];return _0x226edf;};'use strict';var ChatQueueEvents=require(_0xbf72('0x0'));var events=['save',_0xbf72('0x1'),'update'];function createListener(_0xd09dd2,_0x1880d0){return function(_0x5a9feb){_0x1880d0[_0xbf72('0x2')](_0xd09dd2,_0x5a9feb);};}function removeListener(_0x550a9e,_0x37afc8){return function(){ChatQueueEvents[_0xbf72('0x3')](_0x550a9e,_0x37afc8);};}exports[_0xbf72('0x4')]=function(_0x2b8440){for(var _0x5ee060=0x0,_0x41c11d=events[_0xbf72('0x5')];_0x5ee060<_0x41c11d;_0x5ee060++){var _0x119807=events[_0x5ee060];var _0xd0402c=createListener(_0xbf72('0x6')+_0x119807,_0x2b8440);ChatQueueEvents['on'](_0x119807,_0xd0402c);}}; \ No newline at end of file +var _0x8d0e=['save','remove','update','emit','removeListener','length','chatQueue:','./chatQueue.events'];(function(_0x150e2e,_0x4ee6e8){var _0x4cd254=function(_0x1ea07e){while(--_0x1ea07e){_0x150e2e['push'](_0x150e2e['shift']());}};_0x4cd254(++_0x4ee6e8);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x384502,_0x5d8247){_0x384502=_0x384502-0x0;var _0x3d38a8=_0x8d0e[_0x384502];return _0x3d38a8;};'use strict';var ChatQueueEvents=require(_0xe8d0('0x0'));var events=[_0xe8d0('0x1'),_0xe8d0('0x2'),_0xe8d0('0x3')];function createListener(_0x2eae0c,_0x3584ab){return function(_0x15521e){_0x3584ab[_0xe8d0('0x4')](_0x2eae0c,_0x15521e);};}function removeListener(_0x32cee9,_0x579cb9){return function(){ChatQueueEvents[_0xe8d0('0x5')](_0x32cee9,_0x579cb9);};}exports['register']=function(_0x560dab){for(var _0x2e2985=0x0,_0x92483d=events[_0xe8d0('0x6')];_0x2e2985<_0x92483d;_0x2e2985++){var _0xcc03d0=events[_0x2e2985];var _0x2b6dce=createListener(_0xe8d0('0x7')+_0xcc03d0,_0x560dab);ChatQueueEvents['on'](_0xcc03d0,_0x2b6dce);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 1061e1d..f89dcb8 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3e74,0x175));var _0x43e7=function(_0x184915,_0xba2d5e){_0x184915=_0x184915-0x0;var _0x8f3925=_0x3e74[_0x184915];return _0x8f3925;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x184930,_0x2d6fa8){var _0x4046c4=function(_0x389976){while(--_0x389976){_0x184930['push'](_0x184930['shift']());}};_0x4046c4(++_0x2d6fa8);}(_0xe14b,0x93));var _0xbe14=function(_0xb7ad75,_0x5de261){_0xb7ad75=_0xb7ad75-0x0;var _0x14698e=_0xe14b[_0xb7ad75];return _0x14698e;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 8776d89..19dbef8 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 _0x64cb=['exports','STRING','DATE','sequelize'];(function(_0x5477b0,_0x55d062){var _0x2b6995=function(_0x38b82b){while(--_0x38b82b){_0x5477b0['push'](_0x5477b0['shift']());}};_0x2b6995(++_0x55d062);}(_0x64cb,0x163));var _0xb64c=function(_0x41aaf4,_0x23f663){_0x41aaf4=_0x41aaf4-0x0;var _0x1cc64c=_0x64cb[_0x41aaf4];return _0x1cc64c;};'use strict';var moment=require('moment');var Sequelize=require(_0xb64c('0x0'));module[_0xb64c('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xb64c('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb64c('0x3')]},'acceptAt':{'type':Sequelize[_0xb64c('0x3')]},'exitAt':{'type':Sequelize[_0xb64c('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x65ba=['moment','sequelize','STRING','DATE'];(function(_0x2148df,_0x7e65dd){var _0x2c62a9=function(_0x130253){while(--_0x130253){_0x2148df['push'](_0x2148df['shift']());}};_0x2c62a9(++_0x7e65dd);}(_0x65ba,0x13c));var _0xa65b=function(_0x2ddbf6,_0x439dbe){_0x2ddbf6=_0x2ddbf6-0x0;var _0x187a79=_0x65ba[_0x2ddbf6];return _0x187a79;};'use strict';var moment=require(_0xa65b('0x0'));var Sequelize=require(_0xa65b('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xa65b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa65b('0x2')]},'joinAt':{'type':Sequelize[_0xa65b('0x3')]},'leaveAt':{'type':Sequelize[_0xa65b('0x3')]},'acceptAt':{'type':Sequelize[_0xa65b('0x3')]},'exitAt':{'type':Sequelize[_0xa65b('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 6e7c3b0..79bc0ca 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 _0xf19c=['name','send','index','map','rawAttributes','fieldName','model','query','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','ChatQueueReport','findAll','show','params','keys','fields','includeAll','include','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','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/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack'];(function(_0x34af4f,_0x22fdf5){var _0x5f07a9=function(_0x5d48af){while(--_0x5d48af){_0x34af4f['push'](_0x34af4f['shift']());}};_0x5f07a9(++_0x22fdf5);}(_0xf19c,0x10b));var _0xcf19=function(_0x5e3a7d,_0x36254f){_0x5e3a7d=_0x5e3a7d-0x0;var _0x180b3a=_0xf19c[_0x5e3a7d];return _0x180b3a;};'use strict';var emlformat=require(_0xcf19('0x0'));var rimraf=require(_0xcf19('0x1'));var zipdir=require(_0xcf19('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcf19('0x3'));var moment=require(_0xcf19('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcf19('0x5'));var util=require(_0xcf19('0x6'));var path=require(_0xcf19('0x7'));var sox=require(_0xcf19('0x8'));var csv=require(_0xcf19('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcf19('0xa'));var _=require(_0xcf19('0xb'));var squel=require(_0xcf19('0xc'));var crypto=require(_0xcf19('0xd'));var jsforce=require(_0xcf19('0xe'));var deskjs=require(_0xcf19('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcf19('0x10'));var Papa=require(_0xcf19('0x11'));var Redis=require(_0xcf19('0x12'));var authService=require(_0xcf19('0x13'));var qs=require(_0xcf19('0x14'));var as=require(_0xcf19('0x15'));var hardwareService=require(_0xcf19('0x16'));var logger=require(_0xcf19('0x17'))(_0xcf19('0x18'));var utils=require('../../config/utils');var config=require(_0xcf19('0x19'));var licenseUtil=require(_0xcf19('0x1a'));var db=require(_0xcf19('0x1b'))['db'];function respondWithStatusCode(_0x1d6396,_0x226339){_0x226339=_0x226339||0xcc;return function(_0x241547){if(_0x241547){return _0x1d6396[_0xcf19('0x1c')](_0x226339);}return _0x1d6396[_0xcf19('0x1d')](_0x226339)[_0xcf19('0x1e')]();};}function respondWithResult(_0x687a12,_0x993b68){_0x993b68=_0x993b68||0xc8;return function(_0x1c196a){if(_0x1c196a){return _0x687a12[_0xcf19('0x1d')](_0x993b68)[_0xcf19('0x1f')](_0x1c196a);}};}function respondWithFilteredResult(_0xff426b,_0x144a57){return function(_0x562e1a){if(_0x562e1a){var _0x5c932c=typeof _0x144a57[_0xcf19('0x20')]===_0xcf19('0x21')&&typeof _0x144a57[_0xcf19('0x22')]===_0xcf19('0x21');var _0x22d313=_0x562e1a[_0xcf19('0x23')];var _0x5f3fc0=_0x5c932c?0x0:_0x144a57[_0xcf19('0x20')];var _0x43d9be=_0x5c932c?_0x562e1a['count']:_0x144a57[_0xcf19('0x20')]+_0x144a57['limit'];var _0x3ccc9f;if(_0x43d9be>=_0x22d313){_0x43d9be=_0x22d313;_0x3ccc9f=0xc8;}else{_0x3ccc9f=0xce;}_0xff426b['status'](_0x3ccc9f);return _0xff426b[_0xcf19('0x24')](_0xcf19('0x25'),_0x5f3fc0+'-'+_0x43d9be+'/'+_0x22d313)[_0xcf19('0x1f')](_0x562e1a);}return null;};}function patchUpdates(_0x2658b9){return function(_0x410135){try{jsonpatch[_0xcf19('0x26')](_0x410135,_0x2658b9,!![]);}catch(_0x4d68ad){return BPromise['reject'](_0x4d68ad);}return _0x410135[_0xcf19('0x27')]();};}function saveUpdates(_0x1deb93,_0x2aa822){return function(_0x58ed76){if(_0x58ed76){return _0x58ed76[_0xcf19('0x28')](_0x1deb93)[_0xcf19('0x29')](function(_0x3cc7a1){return _0x3cc7a1;});}return null;};}function removeEntity(_0x9e18a0,_0x5c8863){return function(_0x5d4004){if(_0x5d4004){return _0x5d4004[_0xcf19('0x2a')]()[_0xcf19('0x29')](function(){_0x9e18a0[_0xcf19('0x1d')](0xcc)[_0xcf19('0x1e')]();});}};}function handleEntityNotFound(_0x237e8b,_0x1e87d8){return function(_0x1d9742){if(!_0x1d9742){_0x237e8b['sendStatus'](0x194);}return _0x1d9742;};}function handleError(_0x5361df,_0x1dcbb3){_0x1dcbb3=_0x1dcbb3||0x1f4;return function(_0x3c3c44){logger[_0xcf19('0x2b')](_0x3c3c44[_0xcf19('0x2c')]);if(_0x3c3c44[_0xcf19('0x2d')]){delete _0x3c3c44[_0xcf19('0x2d')];}_0x5361df[_0xcf19('0x1d')](_0x1dcbb3)[_0xcf19('0x2e')](_0x3c3c44);};}exports[_0xcf19('0x2f')]=function(_0x64481,_0x552b9f){var _0x5bc90e={},_0x419b8f={},_0x4cadb4={'count':0x0,'rows':[]};var _0x26256e=_[_0xcf19('0x30')](db['ChatQueueReport'][_0xcf19('0x31')],function(_0x1a47a1){return{'name':_0x1a47a1[_0xcf19('0x32')],'type':_0x1a47a1['type']['key']};});_0x419b8f[_0xcf19('0x33')]=_[_0xcf19('0x30')](_0x26256e,_0xcf19('0x2d'));_0x419b8f[_0xcf19('0x34')]=_['keys'](_0x64481[_0xcf19('0x34')]);_0x419b8f[_0xcf19('0x35')]=_['intersection'](_0x419b8f[_0xcf19('0x33')],_0x419b8f[_0xcf19('0x34')]);_0x5bc90e[_0xcf19('0x36')]=_[_0xcf19('0x37')](_0x419b8f['model'],qs['fields'](_0x64481[_0xcf19('0x34')]['fields']));_0x5bc90e[_0xcf19('0x36')]=_0x5bc90e[_0xcf19('0x36')]['length']?_0x5bc90e[_0xcf19('0x36')]:_0x419b8f[_0xcf19('0x33')];if(!_0x64481[_0xcf19('0x34')][_0xcf19('0x38')](_0xcf19('0x39'))){_0x5bc90e[_0xcf19('0x22')]=qs[_0xcf19('0x22')](_0x64481[_0xcf19('0x34')][_0xcf19('0x22')]);_0x5bc90e['offset']=qs[_0xcf19('0x20')](_0x64481['query'][_0xcf19('0x20')]);}_0x5bc90e[_0xcf19('0x3a')]=qs[_0xcf19('0x3b')](_0x64481[_0xcf19('0x34')]['sort']);_0x5bc90e[_0xcf19('0x3c')]=qs[_0xcf19('0x35')](_[_0xcf19('0x3d')](_0x64481[_0xcf19('0x34')],_0x419b8f[_0xcf19('0x35')]),_0x26256e);if(_0x64481['query']['filter']){_0x5bc90e['where']=_['merge'](_0x5bc90e[_0xcf19('0x3c')],{'$or':_[_0xcf19('0x30')](_0x26256e,function(_0x1438bd){if(_0x1438bd[_0xcf19('0x3e')]!==_0xcf19('0x3f')){var _0x53e83b={};_0x53e83b[_0x1438bd['name']]={'$like':'%'+_0x64481['query']['filter']+'%'};return _0x53e83b;}})});}_0x5bc90e=_['merge']({},_0x5bc90e,_0x64481['options']);var _0x19668a={'where':_0x5bc90e[_0xcf19('0x3c')]};return db[_0xcf19('0x40')][_0xcf19('0x23')](_0x19668a)[_0xcf19('0x29')](function(_0x19ab29){_0x4cadb4[_0xcf19('0x23')]=_0x19ab29;if(_0x64481[_0xcf19('0x34')]['includeAll']){_0x5bc90e['include']=[{'all':!![]}];}return db[_0xcf19('0x40')][_0xcf19('0x41')](_0x5bc90e);})[_0xcf19('0x29')](function(_0x3a3a14){_0x4cadb4['rows']=_0x3a3a14;return _0x4cadb4;})['then'](respondWithFilteredResult(_0x552b9f,_0x5bc90e))['catch'](handleError(_0x552b9f,null));};exports[_0xcf19('0x42')]=function(_0x250163,_0x4b0880){var _0x28cb11={'raw':!![],'where':{'id':_0x250163[_0xcf19('0x43')]['id']}},_0x3bb253={};_0x3bb253[_0xcf19('0x33')]=_[_0xcf19('0x44')](db[_0xcf19('0x40')][_0xcf19('0x31')]);_0x3bb253['query']=_[_0xcf19('0x44')](_0x250163[_0xcf19('0x34')]);_0x3bb253[_0xcf19('0x35')]=_['intersection'](_0x3bb253[_0xcf19('0x33')],_0x3bb253[_0xcf19('0x34')]);_0x28cb11['attributes']=_[_0xcf19('0x37')](_0x3bb253[_0xcf19('0x33')],qs[_0xcf19('0x45')](_0x250163[_0xcf19('0x34')][_0xcf19('0x45')]));_0x28cb11['attributes']=_0x28cb11[_0xcf19('0x36')]['length']?_0x28cb11[_0xcf19('0x36')]:_0x3bb253[_0xcf19('0x33')];if(_0x250163[_0xcf19('0x34')][_0xcf19('0x46')]){_0x28cb11[_0xcf19('0x47')]=[{'all':!![]}];}_0x28cb11=_['merge']({},_0x28cb11,_0x250163[_0xcf19('0x48')]);return db['ChatQueueReport'][_0xcf19('0x49')](_0x28cb11)[_0xcf19('0x29')](handleEntityNotFound(_0x4b0880,null))[_0xcf19('0x29')](respondWithResult(_0x4b0880,null))[_0xcf19('0x4a')](handleError(_0x4b0880,null));};exports[_0xcf19('0x4b')]=function(_0x59c910,_0x5e6523){return db['ChatQueueReport'][_0xcf19('0x4b')](_0x59c910['body'],{})[_0xcf19('0x29')](respondWithResult(_0x5e6523,0xc9))['catch'](handleError(_0x5e6523,null));};exports[_0xcf19('0x28')]=function(_0x38c833,_0x5f1801){if(_0x38c833[_0xcf19('0x4c')]['id']){delete _0x38c833[_0xcf19('0x4c')]['id'];}return db['ChatQueueReport'][_0xcf19('0x49')]({'where':{'id':_0x38c833[_0xcf19('0x43')]['id']}})[_0xcf19('0x29')](handleEntityNotFound(_0x5f1801,null))[_0xcf19('0x29')](saveUpdates(_0x38c833[_0xcf19('0x4c')],null))['then'](respondWithResult(_0x5f1801,null))[_0xcf19('0x4a')](handleError(_0x5f1801,null));};exports[_0xcf19('0x2a')]=function(_0x368483,_0x18fd3a){return db['ChatQueueReport']['find']({'where':{'id':_0x368483[_0xcf19('0x43')]['id']}})['then'](handleEntityNotFound(_0x18fd3a,null))[_0xcf19('0x29')](removeEntity(_0x18fd3a,null))[_0xcf19('0x4a')](handleError(_0x18fd3a,null));};exports[_0xcf19('0x4d')]=function(_0x46b592,_0x245c65){return db[_0xcf19('0x40')][_0xcf19('0x4d')]()['then'](respondWithResult(_0x245c65,null))[_0xcf19('0x4a')](handleError(_0x245c65,null));}; \ No newline at end of file +var _0x7b84=['sendStatus','status','end','json','offset','undefined','count','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','where','pick','merge','VIRTUAL','filter','ChatQueueReport','includeAll','findAll','rows','catch','show','params','include','options','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4c0a9c,_0x37daaf){var _0x89b51c=function(_0x420d47){while(--_0x420d47){_0x4c0a9c['push'](_0x4c0a9c['shift']());}};_0x89b51c(++_0x37daaf);}(_0x7b84,0x17c));var _0x47b8=function(_0x15c462,_0x46cbdb){_0x15c462=_0x15c462-0x0;var _0x495721=_0x7b84[_0x15c462];return _0x495721;};'use strict';var emlformat=require(_0x47b8('0x0'));var rimraf=require(_0x47b8('0x1'));var zipdir=require(_0x47b8('0x2'));var jsonpatch=require(_0x47b8('0x3'));var rp=require(_0x47b8('0x4'));var moment=require(_0x47b8('0x5'));var BPromise=require(_0x47b8('0x6'));var Mustache=require('mustache');var util=require(_0x47b8('0x7'));var path=require(_0x47b8('0x8'));var sox=require(_0x47b8('0x9'));var csv=require(_0x47b8('0xa'));var ejs=require(_0x47b8('0xb'));var fs=require('fs');var fs_extra=require(_0x47b8('0xc'));var _=require('lodash');var squel=require(_0x47b8('0xd'));var crypto=require(_0x47b8('0xe'));var jsforce=require(_0x47b8('0xf'));var deskjs=require(_0x47b8('0x10'));var toCsv=require(_0x47b8('0xa'));var querystring=require(_0x47b8('0x11'));var Papa=require(_0x47b8('0x12'));var Redis=require(_0x47b8('0x13'));var authService=require(_0x47b8('0x14'));var qs=require(_0x47b8('0x15'));var as=require(_0x47b8('0x16'));var hardwareService=require(_0x47b8('0x17'));var logger=require(_0x47b8('0x18'))(_0x47b8('0x19'));var utils=require(_0x47b8('0x1a'));var config=require(_0x47b8('0x1b'));var licenseUtil=require(_0x47b8('0x1c'));var db=require(_0x47b8('0x1d'))['db'];function respondWithStatusCode(_0x25a224,_0x289ac7){_0x289ac7=_0x289ac7||0xcc;return function(_0x1edb4b){if(_0x1edb4b){return _0x25a224[_0x47b8('0x1e')](_0x289ac7);}return _0x25a224[_0x47b8('0x1f')](_0x289ac7)[_0x47b8('0x20')]();};}function respondWithResult(_0x173015,_0x223121){_0x223121=_0x223121||0xc8;return function(_0xf66dd6){if(_0xf66dd6){return _0x173015['status'](_0x223121)[_0x47b8('0x21')](_0xf66dd6);}};}function respondWithFilteredResult(_0x340da0,_0x3e760a){return function(_0x1217a4){if(_0x1217a4){var _0x34d5a5=typeof _0x3e760a[_0x47b8('0x22')]===_0x47b8('0x23')&&typeof _0x3e760a['limit']===_0x47b8('0x23');var _0x5c2b2c=_0x1217a4['count'];var _0x4f7317=_0x34d5a5?0x0:_0x3e760a[_0x47b8('0x22')];var _0x36faf1=_0x34d5a5?_0x1217a4[_0x47b8('0x24')]:_0x3e760a['offset']+_0x3e760a['limit'];var _0x4f6716;if(_0x36faf1>=_0x5c2b2c){_0x36faf1=_0x5c2b2c;_0x4f6716=0xc8;}else{_0x4f6716=0xce;}_0x340da0[_0x47b8('0x1f')](_0x4f6716);return _0x340da0['set'](_0x47b8('0x25'),_0x4f7317+'-'+_0x36faf1+'/'+_0x5c2b2c)[_0x47b8('0x21')](_0x1217a4);}return null;};}function patchUpdates(_0x303f19){return function(_0xfccf56){try{jsonpatch['apply'](_0xfccf56,_0x303f19,!![]);}catch(_0xc20df1){return BPromise[_0x47b8('0x26')](_0xc20df1);}return _0xfccf56[_0x47b8('0x27')]();};}function saveUpdates(_0x2f75d2,_0x168cde){return function(_0x232708){if(_0x232708){return _0x232708['update'](_0x2f75d2)[_0x47b8('0x28')](function(_0x2a22e3){return _0x2a22e3;});}return null;};}function removeEntity(_0x5301f8,_0x22e7dd){return function(_0x247429){if(_0x247429){return _0x247429[_0x47b8('0x29')]()[_0x47b8('0x28')](function(){_0x5301f8['status'](0xcc)[_0x47b8('0x20')]();});}};}function handleEntityNotFound(_0x332c23,_0x319d17){return function(_0x3e3de0){if(!_0x3e3de0){_0x332c23[_0x47b8('0x1e')](0x194);}return _0x3e3de0;};}function handleError(_0xbf5ce9,_0x40918f){_0x40918f=_0x40918f||0x1f4;return function(_0x568c1e){logger[_0x47b8('0x2a')](_0x568c1e[_0x47b8('0x2b')]);if(_0x568c1e['name']){delete _0x568c1e[_0x47b8('0x2c')];}_0xbf5ce9[_0x47b8('0x1f')](_0x40918f)[_0x47b8('0x2d')](_0x568c1e);};}exports[_0x47b8('0x2e')]=function(_0x4da0e0,_0x162d96){var _0x5c347f={},_0x2c89fc={},_0x2255ab={'count':0x0,'rows':[]};var _0x33e653=_[_0x47b8('0x2f')](db['ChatQueueReport'][_0x47b8('0x30')],function(_0x264dd9){return{'name':_0x264dd9[_0x47b8('0x31')],'type':_0x264dd9[_0x47b8('0x32')][_0x47b8('0x33')]};});_0x2c89fc[_0x47b8('0x34')]=_['map'](_0x33e653,'name');_0x2c89fc['query']=_[_0x47b8('0x35')](_0x4da0e0[_0x47b8('0x36')]);_0x2c89fc[_0x47b8('0x37')]=_['intersection'](_0x2c89fc['model'],_0x2c89fc['query']);_0x5c347f['attributes']=_[_0x47b8('0x38')](_0x2c89fc[_0x47b8('0x34')],qs[_0x47b8('0x39')](_0x4da0e0[_0x47b8('0x36')][_0x47b8('0x39')]));_0x5c347f[_0x47b8('0x3a')]=_0x5c347f[_0x47b8('0x3a')][_0x47b8('0x3b')]?_0x5c347f[_0x47b8('0x3a')]:_0x2c89fc['model'];if(!_0x4da0e0['query'][_0x47b8('0x3c')](_0x47b8('0x3d'))){_0x5c347f['limit']=qs['limit'](_0x4da0e0[_0x47b8('0x36')][_0x47b8('0x3e')]);_0x5c347f[_0x47b8('0x22')]=qs['offset'](_0x4da0e0[_0x47b8('0x36')][_0x47b8('0x22')]);}_0x5c347f['order']=qs['sort'](_0x4da0e0['query']['sort']);_0x5c347f[_0x47b8('0x3f')]=qs[_0x47b8('0x37')](_[_0x47b8('0x40')](_0x4da0e0[_0x47b8('0x36')],_0x2c89fc[_0x47b8('0x37')]),_0x33e653);if(_0x4da0e0[_0x47b8('0x36')]['filter']){_0x5c347f['where']=_[_0x47b8('0x41')](_0x5c347f[_0x47b8('0x3f')],{'$or':_[_0x47b8('0x2f')](_0x33e653,function(_0x4a9ed6){if(_0x4a9ed6['type']!==_0x47b8('0x42')){var _0x2c89bc={};_0x2c89bc[_0x4a9ed6['name']]={'$like':'%'+_0x4da0e0[_0x47b8('0x36')][_0x47b8('0x43')]+'%'};return _0x2c89bc;}})});}_0x5c347f=_['merge']({},_0x5c347f,_0x4da0e0['options']);var _0x493b69={'where':_0x5c347f['where']};return db[_0x47b8('0x44')][_0x47b8('0x24')](_0x493b69)[_0x47b8('0x28')](function(_0x28cf2c){_0x2255ab[_0x47b8('0x24')]=_0x28cf2c;if(_0x4da0e0['query'][_0x47b8('0x45')]){_0x5c347f['include']=[{'all':!![]}];}return db[_0x47b8('0x44')][_0x47b8('0x46')](_0x5c347f);})[_0x47b8('0x28')](function(_0x5bede8){_0x2255ab[_0x47b8('0x47')]=_0x5bede8;return _0x2255ab;})[_0x47b8('0x28')](respondWithFilteredResult(_0x162d96,_0x5c347f))[_0x47b8('0x48')](handleError(_0x162d96,null));};exports[_0x47b8('0x49')]=function(_0x3eaf01,_0x15b9a1){var _0x2d2971={'raw':!![],'where':{'id':_0x3eaf01[_0x47b8('0x4a')]['id']}},_0x569d29={};_0x569d29['model']=_[_0x47b8('0x35')](db[_0x47b8('0x44')][_0x47b8('0x30')]);_0x569d29[_0x47b8('0x36')]=_[_0x47b8('0x35')](_0x3eaf01[_0x47b8('0x36')]);_0x569d29['filters']=_['intersection'](_0x569d29[_0x47b8('0x34')],_0x569d29[_0x47b8('0x36')]);_0x2d2971[_0x47b8('0x3a')]=_['intersection'](_0x569d29[_0x47b8('0x34')],qs['fields'](_0x3eaf01[_0x47b8('0x36')][_0x47b8('0x39')]));_0x2d2971[_0x47b8('0x3a')]=_0x2d2971[_0x47b8('0x3a')][_0x47b8('0x3b')]?_0x2d2971['attributes']:_0x569d29[_0x47b8('0x34')];if(_0x3eaf01[_0x47b8('0x36')][_0x47b8('0x45')]){_0x2d2971[_0x47b8('0x4b')]=[{'all':!![]}];}_0x2d2971=_[_0x47b8('0x41')]({},_0x2d2971,_0x3eaf01[_0x47b8('0x4c')]);return db[_0x47b8('0x44')]['find'](_0x2d2971)[_0x47b8('0x28')](handleEntityNotFound(_0x15b9a1,null))['then'](respondWithResult(_0x15b9a1,null))[_0x47b8('0x48')](handleError(_0x15b9a1,null));};exports[_0x47b8('0x4d')]=function(_0x4a46eb,_0x132e9a){return db[_0x47b8('0x44')][_0x47b8('0x4d')](_0x4a46eb[_0x47b8('0x4e')],{})[_0x47b8('0x28')](respondWithResult(_0x132e9a,0xc9))[_0x47b8('0x48')](handleError(_0x132e9a,null));};exports[_0x47b8('0x4f')]=function(_0x381d3a,_0x4ad8a8){if(_0x381d3a[_0x47b8('0x4e')]['id']){delete _0x381d3a[_0x47b8('0x4e')]['id'];}return db[_0x47b8('0x44')]['find']({'where':{'id':_0x381d3a[_0x47b8('0x4a')]['id']}})[_0x47b8('0x28')](handleEntityNotFound(_0x4ad8a8,null))[_0x47b8('0x28')](saveUpdates(_0x381d3a[_0x47b8('0x4e')],null))['then'](respondWithResult(_0x4ad8a8,null))[_0x47b8('0x48')](handleError(_0x4ad8a8,null));};exports[_0x47b8('0x29')]=function(_0x51ac62,_0x270054){return db[_0x47b8('0x44')][_0x47b8('0x50')]({'where':{'id':_0x51ac62['params']['id']}})[_0x47b8('0x28')](handleEntityNotFound(_0x270054,null))['then'](removeEntity(_0x270054,null))[_0x47b8('0x48')](handleError(_0x270054,null));};exports['describe']=function(_0x2a03c2,_0x498512){return db[_0x47b8('0x44')][_0x47b8('0x51')]()[_0x47b8('0x28')](respondWithResult(_0x498512,null))[_0x47b8('0x48')](handleError(_0x498512,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index f4909b7..edbbb47 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x1617a3,_0x3414ce){var _0x14198a=function(_0x28104d){while(--_0x28104d){_0x1617a3['push'](_0x1617a3['shift']());}};_0x14198a(++_0x3414ce);}(_0x757a,0xde));var _0xa757=function(_0x4a00d9,_0x390b37){_0x4a00d9=_0x4a00d9-0x0;var _0x282b56=_0x757a[_0x4a00d9];return _0x282b56;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0xe1c535,_0x2f9ce5){var _0x1a1475=function(_0x53714f){while(--_0x53714f){_0xe1c535['push'](_0xe1c535['shift']());}};_0x1a1475(++_0x2f9ce5);}(_0x757a,0xde));var _0xa757=function(_0x4de6c2,_0x104304){_0x4de6c2=_0x4de6c2-0x0;var _0x150a89=_0x757a[_0x4de6c2];return _0x150a89;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 47e7dd3..16b046a 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 _0x486e=['body','options','CreateChatQueueReport','update','raw','where','attributes','UpdateChatQueueReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','catch','ChatQueueReport'];(function(_0x3bb5b4,_0x128455){var _0x586c60=function(_0x179226){while(--_0x179226){_0x3bb5b4['push'](_0x3bb5b4['shift']());}};_0x586c60(++_0x128455);}(_0x486e,0xb2));var _0xe486=function(_0x5639b1,_0x1b4b77){_0x5639b1=_0x5639b1-0x0;var _0x2760b0=_0x486e[_0x5639b1];return _0x2760b0;};'use strict';var _=require(_0xe486('0x0'));var util=require(_0xe486('0x1'));var moment=require('moment');var BPromise=require(_0xe486('0x2'));var rs=require(_0xe486('0x3'));var fs=require('fs');var Redis=require(_0xe486('0x4'));var db=require(_0xe486('0x5'))['db'];var utils=require(_0xe486('0x6'));var logger=require(_0xe486('0x7'))(_0xe486('0x8'));var config=require(_0xe486('0x9'));var jayson=require(_0xe486('0xa'));var client=jayson[_0xe486('0xb')][_0xe486('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4fac5d,_0x2d0712,_0xea849d){return new BPromise(function(_0x8a85c7,_0x2114a5){return client[_0xe486('0xd')](_0x4fac5d,_0xea849d)[_0xe486('0xe')](function(_0x42c4b3){logger[_0xe486('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x2d0712,'request\x20sent');logger[_0xe486('0x10')](_0xe486('0x11'),_0x2d0712,_0xe486('0x12'),JSON[_0xe486('0x13')](_0x42c4b3));if(_0x42c4b3[_0xe486('0x14')]){if(_0x42c4b3[_0xe486('0x14')][_0xe486('0x15')]===0x1f4){logger[_0xe486('0x14')](_0xe486('0x16'),_0x2d0712,_0x42c4b3['error']['message']);return _0x2114a5(_0x42c4b3[_0xe486('0x14')][_0xe486('0x17')]);}logger[_0xe486('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x2d0712,_0x42c4b3['error'][_0xe486('0x17')]);return _0x8a85c7(_0x42c4b3['error'][_0xe486('0x17')]);}else{logger[_0xe486('0xf')](_0xe486('0x16'),_0x2d0712,_0xe486('0x12'));_0x8a85c7(_0x42c4b3['result']['message']);}})[_0xe486('0x18')](function(_0x21fca9){logger['error'](_0xe486('0x16'),_0x2d0712,_0x21fca9);_0x2114a5(_0x21fca9);});});}exports['CreateChatQueueReport']=function(_0x25e946){var _0x1ec65f=this;return new Promise(function(_0x5d209a,_0xf57047){return db[_0xe486('0x19')]['create'](_0x25e946[_0xe486('0x1a')],{'raw':_0x25e946[_0xe486('0x1b')]?_0x25e946[_0xe486('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xe486('0xe')](function(_0x301344){logger[_0xe486('0xf')](_0xe486('0x1c'),_0x25e946);logger[_0xe486('0x10')](_0xe486('0x1c'),_0x25e946,JSON[_0xe486('0x13')](_0x301344));_0x5d209a(_0x301344);})[_0xe486('0x18')](function(_0x5b61cc){logger[_0xe486('0x14')]('CreateChatQueueReport',_0x5b61cc[_0xe486('0x17')],_0x25e946);_0xf57047(_0x1ec65f['error'](0x1f4,_0x5b61cc[_0xe486('0x17')]));});});};exports['UpdateChatQueueReport']=function(_0x39113f){var _0x1f48c7=this;return new Promise(function(_0x3436a5,_0x9f77fc){return db['ChatQueueReport'][_0xe486('0x1d')](_0x39113f[_0xe486('0x1a')],{'raw':_0x39113f[_0xe486('0x1b')]?_0x39113f[_0xe486('0x1b')][_0xe486('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39113f[_0xe486('0x1b')]?_0x39113f['options'][_0xe486('0x1f')]||null:null,'attributes':_0x39113f[_0xe486('0x1b')]?_0x39113f['options'][_0xe486('0x20')]||null:null,'limit':_0x39113f['options']?_0x39113f[_0xe486('0x1b')]['limit']||null:null})[_0xe486('0xe')](function(_0x360ab7){logger[_0xe486('0xf')]('UpdateChatQueueReport',_0x39113f);logger[_0xe486('0x10')]('UpdateChatQueueReport',_0x39113f,JSON['stringify'](_0x360ab7));_0x3436a5(_0x360ab7);})[_0xe486('0x18')](function(_0x1c6d22){logger[_0xe486('0x14')](_0xe486('0x21'),_0x1c6d22[_0xe486('0x17')],_0x39113f);_0x9f77fc(_0x1f48c7[_0xe486('0x14')](0x1f4,_0x1c6d22[_0xe486('0x17')]));});});}; \ No newline at end of file +var _0x4f66=['request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateChatQueueReport','create','body','options','raw','UpdateChatQueueReport','ChatQueueReport','update','where','limit','util','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x1cbe88,_0x1878c9){var _0x479592=function(_0x342866){while(--_0x342866){_0x1cbe88['push'](_0x1cbe88['shift']());}};_0x479592(++_0x1878c9);}(_0x4f66,0x1c9));var _0x64f6=function(_0x1346f1,_0x2a49ce){_0x1346f1=_0x1346f1-0x0;var _0x46b84c=_0x4f66[_0x1346f1];return _0x46b84c;};'use strict';var _=require('lodash');var util=require(_0x64f6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x64f6('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x64f6('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x64f6('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x64f6('0x4'));var client=jayson[_0x64f6('0x5')][_0x64f6('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4347bb,_0x131746,_0x5dc5ba){return new BPromise(function(_0x9f5dce,_0x3493a6){return client[_0x64f6('0x7')](_0x4347bb,_0x5dc5ba)[_0x64f6('0x8')](function(_0x45b217){logger['info'](_0x64f6('0x9'),_0x131746,_0x64f6('0xa'));logger[_0x64f6('0xb')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x131746,_0x64f6('0xa'),JSON[_0x64f6('0xc')](_0x45b217));if(_0x45b217[_0x64f6('0xd')]){if(_0x45b217['error'][_0x64f6('0xe')]===0x1f4){logger[_0x64f6('0xd')](_0x64f6('0x9'),_0x131746,_0x45b217[_0x64f6('0xd')][_0x64f6('0xf')]);return _0x3493a6(_0x45b217[_0x64f6('0xd')][_0x64f6('0xf')]);}logger[_0x64f6('0xd')](_0x64f6('0x9'),_0x131746,_0x45b217[_0x64f6('0xd')]['message']);return _0x9f5dce(_0x45b217[_0x64f6('0xd')][_0x64f6('0xf')]);}else{logger[_0x64f6('0x10')](_0x64f6('0x9'),_0x131746,'request\x20sent');_0x9f5dce(_0x45b217[_0x64f6('0x11')][_0x64f6('0xf')]);}})[_0x64f6('0x12')](function(_0x15e487){logger['error'](_0x64f6('0x9'),_0x131746,_0x15e487);_0x3493a6(_0x15e487);});});}exports[_0x64f6('0x13')]=function(_0x232f99){var _0x1a40c3=this;return new Promise(function(_0x50f227,_0x52c05e){return db['ChatQueueReport'][_0x64f6('0x14')](_0x232f99[_0x64f6('0x15')],{'raw':_0x232f99[_0x64f6('0x16')]?_0x232f99[_0x64f6('0x16')][_0x64f6('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x3a42b2){logger['info'](_0x64f6('0x13'),_0x232f99);logger['debug'](_0x64f6('0x13'),_0x232f99,JSON['stringify'](_0x3a42b2));_0x50f227(_0x3a42b2);})[_0x64f6('0x12')](function(_0x21e741){logger[_0x64f6('0xd')](_0x64f6('0x13'),_0x21e741[_0x64f6('0xf')],_0x232f99);_0x52c05e(_0x1a40c3['error'](0x1f4,_0x21e741[_0x64f6('0xf')]));});});};exports[_0x64f6('0x18')]=function(_0x2ac9c7){var _0x4e3534=this;return new Promise(function(_0x244c9a,_0x5c6f9c){return db[_0x64f6('0x19')][_0x64f6('0x1a')](_0x2ac9c7[_0x64f6('0x15')],{'raw':_0x2ac9c7[_0x64f6('0x16')]?_0x2ac9c7['options'][_0x64f6('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ac9c7[_0x64f6('0x16')]?_0x2ac9c7[_0x64f6('0x16')][_0x64f6('0x1b')]||null:null,'attributes':_0x2ac9c7[_0x64f6('0x16')]?_0x2ac9c7['options']['attributes']||null:null,'limit':_0x2ac9c7[_0x64f6('0x16')]?_0x2ac9c7['options'][_0x64f6('0x1c')]||null:null})[_0x64f6('0x8')](function(_0xf43c2e){logger[_0x64f6('0x10')]('UpdateChatQueueReport',_0x2ac9c7);logger['debug'](_0x64f6('0x18'),_0x2ac9c7,JSON[_0x64f6('0xc')](_0xf43c2e));_0x244c9a(_0xf43c2e);})[_0x64f6('0x12')](function(_0x3c55b9){logger[_0x64f6('0xd')](_0x64f6('0x18'),_0x3c55b9[_0x64f6('0xf')],_0x2ac9c7);_0x5c6f9c(_0x4e3534[_0x64f6('0xd')](0x1f4,_0x3c55b9[_0x64f6('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 180bb32..f7fbd2b 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 _0x8e1b=['post','create','put','/:id','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','get','/describe','describe','show'];(function(_0x11a45,_0x1e40c3){var _0x48d1e6=function(_0x1bd617){while(--_0x1bd617){_0x11a45['push'](_0x11a45['shift']());}};_0x48d1e6(++_0x1e40c3);}(_0x8e1b,0x85));var _0xb8e1=function(_0x215fe7,_0x541d89){_0x215fe7=_0x215fe7-0x0;var _0x5e90bd=_0x8e1b[_0x215fe7];return _0x5e90bd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb8e1('0x0'));var timeout=require(_0xb8e1('0x1'));var express=require(_0xb8e1('0x2'));var router=express[_0xb8e1('0x3')]();var fs_extra=require(_0xb8e1('0x4'));var auth=require(_0xb8e1('0x5'));var interaction=require(_0xb8e1('0x6'));var config=require(_0xb8e1('0x7'));var controller=require(_0xb8e1('0x8'));router['get']('/',auth[_0xb8e1('0x9')](),controller['index']);router[_0xb8e1('0xa')](_0xb8e1('0xb'),auth['isAuthenticated'](),controller[_0xb8e1('0xc')]);router[_0xb8e1('0xa')]('/:id',auth[_0xb8e1('0x9')](),controller[_0xb8e1('0xd')]);router[_0xb8e1('0xe')]('/',auth[_0xb8e1('0x9')](),controller[_0xb8e1('0xf')]);router[_0xb8e1('0x10')](_0xb8e1('0x11'),auth[_0xb8e1('0x9')](),controller['update']);router[_0xb8e1('0x12')](_0xb8e1('0x11'),auth['isAuthenticated'](),controller[_0xb8e1('0x13')]);module[_0xb8e1('0x14')]=router; \ No newline at end of file +var _0x0cfc=['/:id','post','create','put','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x33576d,_0x5188f6){var _0x24b199=function(_0x6b750b){while(--_0x6b750b){_0x33576d['push'](_0x33576d['shift']());}};_0x24b199(++_0x5188f6);}(_0x0cfc,0xfd));var _0xc0cf=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0cfc[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xc0cf('0x0'));var util=require(_0xc0cf('0x1'));var path=require(_0xc0cf('0x2'));var timeout=require(_0xc0cf('0x3'));var express=require(_0xc0cf('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc0cf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc0cf('0x6'));var controller=require(_0xc0cf('0x7'));router[_0xc0cf('0x8')]('/',auth[_0xc0cf('0x9')](),controller[_0xc0cf('0xa')]);router[_0xc0cf('0x8')](_0xc0cf('0xb'),auth[_0xc0cf('0x9')](),controller[_0xc0cf('0xc')]);router[_0xc0cf('0x8')](_0xc0cf('0xd'),auth[_0xc0cf('0x9')](),controller['show']);router[_0xc0cf('0xe')]('/',auth['isAuthenticated'](),controller[_0xc0cf('0xf')]);router[_0xc0cf('0x10')](_0xc0cf('0xd'),auth[_0xc0cf('0x9')](),controller['update']);router[_0xc0cf('0x11')]('/:id',auth[_0xc0cf('0x9')](),controller['destroy']);module[_0xc0cf('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index c846fb7..34393f8 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x25aba0,_0x32c66c){var _0x4cd4e0=function(_0xa4405e){while(--_0xa4405e){_0x25aba0['push'](_0x25aba0['shift']());}};_0x4cd4e0(++_0x32c66c);}(_0x70e0,0x17b));var _0x070e=function(_0x28a5af,_0x3bbf46){_0x28a5af=_0x28a5af-0x0;var _0x2a6a87=_0x70e0[_0x28a5af];return _0x2a6a87;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x23adde,_0x191be0){var _0x2ac852=function(_0x362dc0){while(--_0x362dc0){_0x23adde['push'](_0x23adde['shift']());}};_0x2ac852(++_0x191be0);}(_0xe706,0xa3));var _0x6e70=function(_0x1d0c7e,_0x40b36c){_0x1d0c7e=_0x1d0c7e-0x0;var _0x30cf02=_0xe706[_0x1d0c7e];return _0x30cf02;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 800b9eb..686431c 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 _0xab37=['bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','ChatTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','show','params','include','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3df660,_0x304ff0){var _0x4ae9bf=function(_0x4ce36c){while(--_0x4ce36c){_0x3df660['push'](_0x3df660['shift']());}};_0x4ae9bf(++_0x304ff0);}(_0xab37,0x16c));var _0x7ab3=function(_0x27fa4b,_0x4e9de2){_0x27fa4b=_0x27fa4b-0x0;var _0x51fe06=_0xab37[_0x27fa4b];return _0x51fe06;};'use strict';var emlformat=require(_0x7ab3('0x0'));var rimraf=require(_0x7ab3('0x1'));var zipdir=require(_0x7ab3('0x2'));var jsonpatch=require(_0x7ab3('0x3'));var rp=require(_0x7ab3('0x4'));var moment=require(_0x7ab3('0x5'));var BPromise=require(_0x7ab3('0x6'));var Mustache=require(_0x7ab3('0x7'));var util=require(_0x7ab3('0x8'));var path=require(_0x7ab3('0x9'));var sox=require(_0x7ab3('0xa'));var csv=require('to-csv');var ejs=require(_0x7ab3('0xb'));var fs=require('fs');var fs_extra=require(_0x7ab3('0xc'));var _=require(_0x7ab3('0xd'));var squel=require(_0x7ab3('0xe'));var crypto=require(_0x7ab3('0xf'));var jsforce=require(_0x7ab3('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x7ab3('0x11'));var querystring=require(_0x7ab3('0x12'));var Papa=require(_0x7ab3('0x13'));var Redis=require(_0x7ab3('0x14'));var authService=require(_0x7ab3('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ab3('0x16'));var logger=require(_0x7ab3('0x17'))('api');var utils=require(_0x7ab3('0x18'));var config=require(_0x7ab3('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d5220,_0xfa17ca){_0xfa17ca=_0xfa17ca||0xcc;return function(_0x3be9cc){if(_0x3be9cc){return _0x5d5220[_0x7ab3('0x1a')](_0xfa17ca);}return _0x5d5220['status'](_0xfa17ca)[_0x7ab3('0x1b')]();};}function respondWithResult(_0x398274,_0x155085){_0x155085=_0x155085||0xc8;return function(_0x5d57b9){if(_0x5d57b9){return _0x398274['status'](_0x155085)['json'](_0x5d57b9);}};}function respondWithFilteredResult(_0x480c0b,_0x5633a1){return function(_0x4917fa){if(_0x4917fa){var _0x4877a9=typeof _0x5633a1['offset']==='undefined'&&typeof _0x5633a1[_0x7ab3('0x1c')]==='undefined';var _0x58e6ab=_0x4917fa[_0x7ab3('0x1d')];var _0x1fe522=_0x4877a9?0x0:_0x5633a1[_0x7ab3('0x1e')];var _0x13273b=_0x4877a9?_0x4917fa[_0x7ab3('0x1d')]:_0x5633a1[_0x7ab3('0x1e')]+_0x5633a1['limit'];var _0x2a31d3;if(_0x13273b>=_0x58e6ab){_0x13273b=_0x58e6ab;_0x2a31d3=0xc8;}else{_0x2a31d3=0xce;}_0x480c0b[_0x7ab3('0x1f')](_0x2a31d3);return _0x480c0b[_0x7ab3('0x20')](_0x7ab3('0x21'),_0x1fe522+'-'+_0x13273b+'/'+_0x58e6ab)['json'](_0x4917fa);}return null;};}function patchUpdates(_0x57e264){return function(_0x4a4136){try{jsonpatch[_0x7ab3('0x22')](_0x4a4136,_0x57e264,!![]);}catch(_0x3641f2){return BPromise[_0x7ab3('0x23')](_0x3641f2);}return _0x4a4136[_0x7ab3('0x24')]();};}function saveUpdates(_0x28f344,_0x40df94){return function(_0x1abf16){if(_0x1abf16){return _0x1abf16[_0x7ab3('0x25')](_0x28f344)[_0x7ab3('0x26')](function(_0x1a3516){return _0x1a3516;});}return null;};}function removeEntity(_0x13fc84,_0x331285){return function(_0x388e2){if(_0x388e2){return _0x388e2[_0x7ab3('0x27')]()['then'](function(){_0x13fc84['status'](0xcc)[_0x7ab3('0x1b')]();});}};}function handleEntityNotFound(_0x1d1c17,_0x2bde19){return function(_0x41d3a4){if(!_0x41d3a4){_0x1d1c17[_0x7ab3('0x1a')](0x194);}return _0x41d3a4;};}function handleError(_0x13caa1,_0x4408dc){_0x4408dc=_0x4408dc||0x1f4;return function(_0x1af495){logger[_0x7ab3('0x28')](_0x1af495[_0x7ab3('0x29')]);if(_0x1af495[_0x7ab3('0x2a')]){delete _0x1af495[_0x7ab3('0x2a')];}_0x13caa1[_0x7ab3('0x1f')](_0x4408dc)[_0x7ab3('0x2b')](_0x1af495);};}exports['index']=function(_0x66c253,_0x3fbbd0){var _0x5b8b23={},_0x53dbe8={},_0x5bb2d4={'count':0x0,'rows':[]};var _0x560163=_[_0x7ab3('0x2c')](db[_0x7ab3('0x2d')][_0x7ab3('0x2e')],function(_0xdd3d92){return{'name':_0xdd3d92[_0x7ab3('0x2f')],'type':_0xdd3d92[_0x7ab3('0x30')]['key']};});_0x53dbe8[_0x7ab3('0x31')]=_[_0x7ab3('0x2c')](_0x560163,_0x7ab3('0x2a'));_0x53dbe8[_0x7ab3('0x32')]=_[_0x7ab3('0x33')](_0x66c253[_0x7ab3('0x32')]);_0x53dbe8[_0x7ab3('0x34')]=_[_0x7ab3('0x35')](_0x53dbe8[_0x7ab3('0x31')],_0x53dbe8[_0x7ab3('0x32')]);_0x5b8b23[_0x7ab3('0x36')]=_[_0x7ab3('0x35')](_0x53dbe8[_0x7ab3('0x31')],qs[_0x7ab3('0x37')](_0x66c253[_0x7ab3('0x32')][_0x7ab3('0x37')]));_0x5b8b23[_0x7ab3('0x36')]=_0x5b8b23[_0x7ab3('0x36')]['length']?_0x5b8b23['attributes']:_0x53dbe8[_0x7ab3('0x31')];if(!_0x66c253[_0x7ab3('0x32')]['hasOwnProperty']('nolimit')){_0x5b8b23[_0x7ab3('0x1c')]=qs[_0x7ab3('0x1c')](_0x66c253['query']['limit']);_0x5b8b23[_0x7ab3('0x1e')]=qs[_0x7ab3('0x1e')](_0x66c253[_0x7ab3('0x32')]['offset']);}_0x5b8b23[_0x7ab3('0x38')]=qs[_0x7ab3('0x39')](_0x66c253[_0x7ab3('0x32')]['sort']);_0x5b8b23[_0x7ab3('0x3a')]=qs[_0x7ab3('0x34')](_[_0x7ab3('0x3b')](_0x66c253[_0x7ab3('0x32')],_0x53dbe8[_0x7ab3('0x34')]),_0x560163);if(_0x66c253[_0x7ab3('0x32')]['filter']){_0x5b8b23[_0x7ab3('0x3a')]=_[_0x7ab3('0x3c')](_0x5b8b23[_0x7ab3('0x3a')],{'$or':_[_0x7ab3('0x2c')](_0x560163,function(_0x24dcdc){if(_0x24dcdc[_0x7ab3('0x30')]!==_0x7ab3('0x3d')){var _0x267f93={};_0x267f93[_0x24dcdc['name']]={'$like':'%'+_0x66c253[_0x7ab3('0x32')][_0x7ab3('0x3e')]+'%'};return _0x267f93;}})});}_0x5b8b23=_[_0x7ab3('0x3c')]({},_0x5b8b23,_0x66c253[_0x7ab3('0x3f')]);var _0x14b2cb={'where':_0x5b8b23[_0x7ab3('0x3a')]};return db[_0x7ab3('0x2d')]['count'](_0x14b2cb)['then'](function(_0x517ae0){_0x5bb2d4[_0x7ab3('0x1d')]=_0x517ae0;if(_0x66c253['query'][_0x7ab3('0x40')]){_0x5b8b23['include']=[{'all':!![]}];}return db[_0x7ab3('0x2d')][_0x7ab3('0x41')](_0x5b8b23);})[_0x7ab3('0x26')](function(_0x16b9e0){_0x5bb2d4['rows']=_0x16b9e0;return _0x5bb2d4;})[_0x7ab3('0x26')](respondWithFilteredResult(_0x3fbbd0,_0x5b8b23))['catch'](handleError(_0x3fbbd0,null));};exports[_0x7ab3('0x42')]=function(_0x1d5c64,_0xee31ec){var _0x10546b={'raw':!![],'where':{'id':_0x1d5c64[_0x7ab3('0x43')]['id']}},_0x2b38b8={};_0x2b38b8['model']=_[_0x7ab3('0x33')](db[_0x7ab3('0x2d')][_0x7ab3('0x2e')]);_0x2b38b8[_0x7ab3('0x32')]=_[_0x7ab3('0x33')](_0x1d5c64[_0x7ab3('0x32')]);_0x2b38b8[_0x7ab3('0x34')]=_[_0x7ab3('0x35')](_0x2b38b8[_0x7ab3('0x31')],_0x2b38b8[_0x7ab3('0x32')]);_0x10546b[_0x7ab3('0x36')]=_[_0x7ab3('0x35')](_0x2b38b8[_0x7ab3('0x31')],qs[_0x7ab3('0x37')](_0x1d5c64[_0x7ab3('0x32')]['fields']));_0x10546b[_0x7ab3('0x36')]=_0x10546b[_0x7ab3('0x36')]['length']?_0x10546b['attributes']:_0x2b38b8[_0x7ab3('0x31')];if(_0x1d5c64['query'][_0x7ab3('0x40')]){_0x10546b[_0x7ab3('0x44')]=[{'all':!![]}];}_0x10546b=_[_0x7ab3('0x3c')]({},_0x10546b,_0x1d5c64[_0x7ab3('0x3f')]);return db[_0x7ab3('0x2d')][_0x7ab3('0x45')](_0x10546b)['then'](handleEntityNotFound(_0xee31ec,null))[_0x7ab3('0x26')](respondWithResult(_0xee31ec,null))['catch'](handleError(_0xee31ec,null));};exports[_0x7ab3('0x46')]=function(_0x36391b,_0x8b0cba){return db[_0x7ab3('0x2d')][_0x7ab3('0x46')](_0x36391b[_0x7ab3('0x47')],{})[_0x7ab3('0x26')](respondWithResult(_0x8b0cba,0xc9))['catch'](handleError(_0x8b0cba,null));};exports[_0x7ab3('0x25')]=function(_0x4dd958,_0x4b874d){if(_0x4dd958[_0x7ab3('0x47')]['id']){delete _0x4dd958[_0x7ab3('0x47')]['id'];}return db[_0x7ab3('0x2d')]['find']({'where':{'id':_0x4dd958['params']['id']}})[_0x7ab3('0x26')](handleEntityNotFound(_0x4b874d,null))[_0x7ab3('0x26')](saveUpdates(_0x4dd958[_0x7ab3('0x47')],null))['then'](respondWithResult(_0x4b874d,null))[_0x7ab3('0x48')](handleError(_0x4b874d,null));};exports['destroy']=function(_0x438835,_0x343cb6){return db['ChatTransferReport'][_0x7ab3('0x45')]({'where':{'id':_0x438835[_0x7ab3('0x43')]['id']}})[_0x7ab3('0x26')](handleEntityNotFound(_0x343cb6,null))[_0x7ab3('0x26')](removeEntity(_0x343cb6,null))['catch'](handleError(_0x343cb6,null));};exports[_0x7ab3('0x49')]=function(_0x525f88,_0x449088){return db[_0x7ab3('0x2d')][_0x7ab3('0x49')]()[_0x7ab3('0x26')](respondWithResult(_0x449088,null))[_0x7ab3('0x48')](handleError(_0x449088,null));}; \ No newline at end of file +var _0xc5fd=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','../../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','save','update','then','destroy','error','stack','name','index','map','ChatTransferReport','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','includeAll','include','findAll','show','params','keys','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x594307,_0xcd9986){var _0xd720cf=function(_0x30c49f){while(--_0x30c49f){_0x594307['push'](_0x594307['shift']());}};_0xd720cf(++_0xcd9986);}(_0xc5fd,0x92));var _0xdc5f=function(_0x349148,_0x31eabb){_0x349148=_0x349148-0x0;var _0x2f2b0f=_0xc5fd[_0x349148];return _0x2f2b0f;};'use strict';var emlformat=require(_0xdc5f('0x0'));var rimraf=require(_0xdc5f('0x1'));var zipdir=require(_0xdc5f('0x2'));var jsonpatch=require(_0xdc5f('0x3'));var rp=require(_0xdc5f('0x4'));var moment=require(_0xdc5f('0x5'));var BPromise=require(_0xdc5f('0x6'));var Mustache=require(_0xdc5f('0x7'));var util=require(_0xdc5f('0x8'));var path=require(_0xdc5f('0x9'));var sox=require(_0xdc5f('0xa'));var csv=require(_0xdc5f('0xb'));var ejs=require(_0xdc5f('0xc'));var fs=require('fs');var fs_extra=require(_0xdc5f('0xd'));var _=require('lodash');var squel=require(_0xdc5f('0xe'));var crypto=require(_0xdc5f('0xf'));var jsforce=require(_0xdc5f('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xdc5f('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdc5f('0x11'));var qs=require(_0xdc5f('0x12'));var as=require(_0xdc5f('0x13'));var hardwareService=require(_0xdc5f('0x14'));var logger=require('../../config/logger')(_0xdc5f('0x15'));var utils=require(_0xdc5f('0x16'));var config=require(_0xdc5f('0x17'));var licenseUtil=require(_0xdc5f('0x18'));var db=require(_0xdc5f('0x19'))['db'];function respondWithStatusCode(_0x4e08c3,_0x8e5062){_0x8e5062=_0x8e5062||0xcc;return function(_0x47dbca){if(_0x47dbca){return _0x4e08c3[_0xdc5f('0x1a')](_0x8e5062);}return _0x4e08c3[_0xdc5f('0x1b')](_0x8e5062)['end']();};}function respondWithResult(_0x2e25d1,_0x2a171c){_0x2a171c=_0x2a171c||0xc8;return function(_0x3d2f77){if(_0x3d2f77){return _0x2e25d1[_0xdc5f('0x1b')](_0x2a171c)['json'](_0x3d2f77);}};}function respondWithFilteredResult(_0x53efd6,_0x42e511){return function(_0x1e387c){if(_0x1e387c){var _0x2dc556=typeof _0x42e511[_0xdc5f('0x1c')]===_0xdc5f('0x1d')&&typeof _0x42e511[_0xdc5f('0x1e')]===_0xdc5f('0x1d');var _0x2b87a7=_0x1e387c[_0xdc5f('0x1f')];var _0xbfbdd2=_0x2dc556?0x0:_0x42e511[_0xdc5f('0x1c')];var _0x4c35ec=_0x2dc556?_0x1e387c[_0xdc5f('0x1f')]:_0x42e511[_0xdc5f('0x1c')]+_0x42e511['limit'];var _0x203318;if(_0x4c35ec>=_0x2b87a7){_0x4c35ec=_0x2b87a7;_0x203318=0xc8;}else{_0x203318=0xce;}_0x53efd6[_0xdc5f('0x1b')](_0x203318);return _0x53efd6[_0xdc5f('0x20')](_0xdc5f('0x21'),_0xbfbdd2+'-'+_0x4c35ec+'/'+_0x2b87a7)[_0xdc5f('0x22')](_0x1e387c);}return null;};}function patchUpdates(_0x495c18){return function(_0x2e02bd){try{jsonpatch[_0xdc5f('0x23')](_0x2e02bd,_0x495c18,!![]);}catch(_0x9ceb97){return BPromise[_0xdc5f('0x24')](_0x9ceb97);}return _0x2e02bd[_0xdc5f('0x25')]();};}function saveUpdates(_0x19e695,_0x4b26a0){return function(_0x3130a3){if(_0x3130a3){return _0x3130a3[_0xdc5f('0x26')](_0x19e695)[_0xdc5f('0x27')](function(_0x1365b0){return _0x1365b0;});}return null;};}function removeEntity(_0x1a59d2,_0x4ade2a){return function(_0x4bb076){if(_0x4bb076){return _0x4bb076[_0xdc5f('0x28')]()[_0xdc5f('0x27')](function(){_0x1a59d2[_0xdc5f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x305c91,_0x25d42a){return function(_0xe3a937){if(!_0xe3a937){_0x305c91[_0xdc5f('0x1a')](0x194);}return _0xe3a937;};}function handleError(_0x280577,_0x2d3db7){_0x2d3db7=_0x2d3db7||0x1f4;return function(_0x1179a8){logger[_0xdc5f('0x29')](_0x1179a8[_0xdc5f('0x2a')]);if(_0x1179a8[_0xdc5f('0x2b')]){delete _0x1179a8[_0xdc5f('0x2b')];}_0x280577[_0xdc5f('0x1b')](_0x2d3db7)['send'](_0x1179a8);};}exports[_0xdc5f('0x2c')]=function(_0x4861aa,_0x30f83d){var _0x11ccc8={},_0x48c163={},_0x6a941c={'count':0x0,'rows':[]};var _0x1a8b48=_[_0xdc5f('0x2d')](db[_0xdc5f('0x2e')][_0xdc5f('0x2f')],function(_0x3e7514){return{'name':_0x3e7514[_0xdc5f('0x30')],'type':_0x3e7514['type'][_0xdc5f('0x31')]};});_0x48c163[_0xdc5f('0x32')]=_[_0xdc5f('0x2d')](_0x1a8b48,_0xdc5f('0x2b'));_0x48c163[_0xdc5f('0x33')]=_['keys'](_0x4861aa['query']);_0x48c163['filters']=_[_0xdc5f('0x34')](_0x48c163[_0xdc5f('0x32')],_0x48c163[_0xdc5f('0x33')]);_0x11ccc8['attributes']=_[_0xdc5f('0x34')](_0x48c163[_0xdc5f('0x32')],qs[_0xdc5f('0x35')](_0x4861aa[_0xdc5f('0x33')]['fields']));_0x11ccc8[_0xdc5f('0x36')]=_0x11ccc8[_0xdc5f('0x36')][_0xdc5f('0x37')]?_0x11ccc8[_0xdc5f('0x36')]:_0x48c163[_0xdc5f('0x32')];if(!_0x4861aa[_0xdc5f('0x33')][_0xdc5f('0x38')](_0xdc5f('0x39'))){_0x11ccc8[_0xdc5f('0x1e')]=qs[_0xdc5f('0x1e')](_0x4861aa[_0xdc5f('0x33')][_0xdc5f('0x1e')]);_0x11ccc8[_0xdc5f('0x1c')]=qs[_0xdc5f('0x1c')](_0x4861aa['query'][_0xdc5f('0x1c')]);}_0x11ccc8['order']=qs['sort'](_0x4861aa[_0xdc5f('0x33')][_0xdc5f('0x3a')]);_0x11ccc8[_0xdc5f('0x3b')]=qs[_0xdc5f('0x3c')](_[_0xdc5f('0x3d')](_0x4861aa[_0xdc5f('0x33')],_0x48c163['filters']),_0x1a8b48);if(_0x4861aa[_0xdc5f('0x33')][_0xdc5f('0x3e')]){_0x11ccc8[_0xdc5f('0x3b')]=_[_0xdc5f('0x3f')](_0x11ccc8[_0xdc5f('0x3b')],{'$or':_['map'](_0x1a8b48,function(_0x5d48ff){if(_0x5d48ff[_0xdc5f('0x40')]!=='VIRTUAL'){var _0x48b56c={};_0x48b56c[_0x5d48ff[_0xdc5f('0x2b')]]={'$like':'%'+_0x4861aa[_0xdc5f('0x33')][_0xdc5f('0x3e')]+'%'};return _0x48b56c;}})});}_0x11ccc8=_[_0xdc5f('0x3f')]({},_0x11ccc8,_0x4861aa['options']);var _0x4297a1={'where':_0x11ccc8['where']};return db[_0xdc5f('0x2e')][_0xdc5f('0x1f')](_0x4297a1)[_0xdc5f('0x27')](function(_0x69235c){_0x6a941c[_0xdc5f('0x1f')]=_0x69235c;if(_0x4861aa[_0xdc5f('0x33')][_0xdc5f('0x41')]){_0x11ccc8[_0xdc5f('0x42')]=[{'all':!![]}];}return db[_0xdc5f('0x2e')][_0xdc5f('0x43')](_0x11ccc8);})['then'](function(_0x2da9ca){_0x6a941c['rows']=_0x2da9ca;return _0x6a941c;})['then'](respondWithFilteredResult(_0x30f83d,_0x11ccc8))['catch'](handleError(_0x30f83d,null));};exports[_0xdc5f('0x44')]=function(_0x47da3a,_0x58bfd9){var _0x588feb={'raw':!![],'where':{'id':_0x47da3a[_0xdc5f('0x45')]['id']}},_0x4a98c8={};_0x4a98c8[_0xdc5f('0x32')]=_[_0xdc5f('0x46')](db[_0xdc5f('0x2e')][_0xdc5f('0x2f')]);_0x4a98c8[_0xdc5f('0x33')]=_[_0xdc5f('0x46')](_0x47da3a[_0xdc5f('0x33')]);_0x4a98c8[_0xdc5f('0x3c')]=_['intersection'](_0x4a98c8['model'],_0x4a98c8['query']);_0x588feb['attributes']=_[_0xdc5f('0x34')](_0x4a98c8[_0xdc5f('0x32')],qs[_0xdc5f('0x35')](_0x47da3a['query']['fields']));_0x588feb[_0xdc5f('0x36')]=_0x588feb['attributes'][_0xdc5f('0x37')]?_0x588feb[_0xdc5f('0x36')]:_0x4a98c8['model'];if(_0x47da3a[_0xdc5f('0x33')][_0xdc5f('0x41')]){_0x588feb['include']=[{'all':!![]}];}_0x588feb=_[_0xdc5f('0x3f')]({},_0x588feb,_0x47da3a['options']);return db['ChatTransferReport'][_0xdc5f('0x47')](_0x588feb)[_0xdc5f('0x27')](handleEntityNotFound(_0x58bfd9,null))['then'](respondWithResult(_0x58bfd9,null))[_0xdc5f('0x48')](handleError(_0x58bfd9,null));};exports[_0xdc5f('0x49')]=function(_0x286691,_0x4a0866){return db[_0xdc5f('0x2e')][_0xdc5f('0x49')](_0x286691[_0xdc5f('0x4a')],{})[_0xdc5f('0x27')](respondWithResult(_0x4a0866,0xc9))[_0xdc5f('0x48')](handleError(_0x4a0866,null));};exports[_0xdc5f('0x26')]=function(_0x459868,_0x5682f9){if(_0x459868[_0xdc5f('0x4a')]['id']){delete _0x459868[_0xdc5f('0x4a')]['id'];}return db[_0xdc5f('0x2e')][_0xdc5f('0x47')]({'where':{'id':_0x459868[_0xdc5f('0x45')]['id']}})[_0xdc5f('0x27')](handleEntityNotFound(_0x5682f9,null))[_0xdc5f('0x27')](saveUpdates(_0x459868['body'],null))['then'](respondWithResult(_0x5682f9,null))['catch'](handleError(_0x5682f9,null));};exports[_0xdc5f('0x28')]=function(_0x1c544b,_0x5a5b80){return db[_0xdc5f('0x2e')]['find']({'where':{'id':_0x1c544b[_0xdc5f('0x45')]['id']}})[_0xdc5f('0x27')](handleEntityNotFound(_0x5a5b80,null))[_0xdc5f('0x27')](removeEntity(_0x5a5b80,null))[_0xdc5f('0x48')](handleError(_0x5a5b80,null));};exports[_0xdc5f('0x4b')]=function(_0x39b52f,_0x2682f9){return db['ChatTransferReport'][_0xdc5f('0x4b')]()['then'](respondWithResult(_0x2682f9,null))[_0xdc5f('0x48')](handleError(_0x2682f9,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 00aac8b..99549e6 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 _0xf9a3=['path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x34b64f,_0x2cbd48){var _0x40c2c7=function(_0x3693c1){while(--_0x3693c1){_0x34b64f['push'](_0x34b64f['shift']());}};_0x40c2c7(++_0x2cbd48);}(_0xf9a3,0xc2));var _0x3f9a=function(_0x385bdc,_0x1b7c90){_0x385bdc=_0x385bdc-0x0;var _0x156aae=_0xf9a3[_0x385bdc];return _0x156aae;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3f9a('0x0'))(_0x3f9a('0x1'));var moment=require(_0x3f9a('0x2'));var BPromise=require(_0x3f9a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f9a('0x4'));var rimraf=require(_0x3f9a('0x5'));var config=require(_0x3f9a('0x6'));var attributes=require(_0x3f9a('0x7'));module[_0x3f9a('0x8')]=function(_0x5cab5f,_0x475aa8){return _0x5cab5f[_0x3f9a('0x9')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x3f9a('0xa'),'fields':[_0x3f9a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ace=['rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x338454,_0x568b99){var _0x1810ff=function(_0x3a742d){while(--_0x3a742d){_0x338454['push'](_0x338454['shift']());}};_0x1810ff(++_0x568b99);}(_0x2ace,0x148));var _0xe2ac=function(_0x16fd68,_0x3d394d){_0x16fd68=_0x16fd68-0x0;var _0x12cf8e=_0x2ace[_0x16fd68];return _0x12cf8e;};'use strict';var _=require(_0xe2ac('0x0'));var util=require(_0xe2ac('0x1'));var logger=require(_0xe2ac('0x2'))(_0xe2ac('0x3'));var moment=require(_0xe2ac('0x4'));var BPromise=require(_0xe2ac('0x5'));var rp=require(_0xe2ac('0x6'));var fs=require('fs');var path=require(_0xe2ac('0x7'));var rimraf=require(_0xe2ac('0x8'));var config=require(_0xe2ac('0x9'));var attributes=require(_0xe2ac('0xa'));module[_0xe2ac('0xb')]=function(_0x44cb63,_0x168f0f){return _0x44cb63[_0xe2ac('0xc')](_0xe2ac('0xd'),attributes,{'tableName':_0xe2ac('0xe'),'paranoid':![],'indexes':[{'name':_0xe2ac('0xf'),'fields':[_0xe2ac('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 193b247..2a48ee2 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 _0x68e5=['stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x496dc6,_0x569b88){var _0x3f0310=function(_0x560bed){while(--_0x560bed){_0x496dc6['push'](_0x496dc6['shift']());}};_0x3f0310(++_0x569b88);}(_0x68e5,0x1d4));var _0x568e=function(_0x1bd5e9,_0x2dd9d8){_0x1bd5e9=_0x1bd5e9-0x0;var _0x2c802c=_0x68e5[_0x1bd5e9];return _0x2c802c;};'use strict';var _=require('lodash');var util=require(_0x568e('0x0'));var moment=require('moment');var BPromise=require(_0x568e('0x1'));var rs=require(_0x568e('0x2'));var fs=require('fs');var Redis=require(_0x568e('0x3'));var db=require(_0x568e('0x4'))['db'];var utils=require(_0x568e('0x5'));var logger=require('../../config/logger')(_0x568e('0x6'));var config=require(_0x568e('0x7'));var jayson=require(_0x568e('0x8'));var client=jayson['client'][_0x568e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdf4c93,_0x989aae,_0x3c6f66){return new BPromise(function(_0x25532a,_0x3ff90c){return client[_0x568e('0xa')](_0xdf4c93,_0x3c6f66)[_0x568e('0xb')](function(_0x448e9e){logger[_0x568e('0xc')](_0x568e('0xd'),_0x989aae,_0x568e('0xe'));logger[_0x568e('0xf')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x989aae,_0x568e('0xe'),JSON[_0x568e('0x10')](_0x448e9e));if(_0x448e9e[_0x568e('0x11')]){if(_0x448e9e[_0x568e('0x11')][_0x568e('0x12')]===0x1f4){logger[_0x568e('0x11')](_0x568e('0xd'),_0x989aae,_0x448e9e[_0x568e('0x11')][_0x568e('0x13')]);return _0x3ff90c(_0x448e9e['error'][_0x568e('0x13')]);}logger[_0x568e('0x11')](_0x568e('0xd'),_0x989aae,_0x448e9e['error'][_0x568e('0x13')]);return _0x25532a(_0x448e9e[_0x568e('0x11')][_0x568e('0x13')]);}else{logger[_0x568e('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x989aae,_0x568e('0xe'));_0x25532a(_0x448e9e[_0x568e('0x14')][_0x568e('0x13')]);}})[_0x568e('0x15')](function(_0x33e457){logger[_0x568e('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x989aae,_0x33e457);_0x3ff90c(_0x33e457);});});} \ No newline at end of file +var _0x22bf=['then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x10280a,_0x46fa19){var _0x519acd=function(_0x467591){while(--_0x467591){_0x10280a['push'](_0x10280a['shift']());}};_0x519acd(++_0x46fa19);}(_0x22bf,0x199));var _0xf22b=function(_0x52c820,_0x81c4e2){_0x52c820=_0x52c820-0x0;var _0x1e9d87=_0x22bf[_0x52c820];return _0x1e9d87;};'use strict';var _=require(_0xf22b('0x0'));var util=require(_0xf22b('0x1'));var moment=require(_0xf22b('0x2'));var BPromise=require(_0xf22b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf22b('0x4'));var db=require(_0xf22b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf22b('0x6'))(_0xf22b('0x7'));var config=require(_0xf22b('0x8'));var jayson=require(_0xf22b('0x9'));var client=jayson[_0xf22b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53644b,_0x22bb99,_0x46bd81){return new BPromise(function(_0x424c46,_0x270095){return client['request'](_0x53644b,_0x46bd81)[_0xf22b('0xb')](function(_0x962f81){logger[_0xf22b('0xc')](_0xf22b('0xd'),_0x22bb99,_0xf22b('0xe'));logger['debug'](_0xf22b('0xf'),_0x22bb99,_0xf22b('0xe'),JSON['stringify'](_0x962f81));if(_0x962f81[_0xf22b('0x10')]){if(_0x962f81[_0xf22b('0x10')][_0xf22b('0x11')]===0x1f4){logger[_0xf22b('0x10')](_0xf22b('0xd'),_0x22bb99,_0x962f81[_0xf22b('0x10')][_0xf22b('0x12')]);return _0x270095(_0x962f81['error']['message']);}logger[_0xf22b('0x10')](_0xf22b('0xd'),_0x22bb99,_0x962f81[_0xf22b('0x10')][_0xf22b('0x12')]);return _0x424c46(_0x962f81[_0xf22b('0x10')][_0xf22b('0x12')]);}else{logger[_0xf22b('0xc')](_0xf22b('0xd'),_0x22bb99,'request\x20sent');_0x424c46(_0x962f81[_0xf22b('0x13')]['message']);}})['catch'](function(_0x280681){logger[_0xf22b('0x10')](_0xf22b('0xd'),_0x22bb99,_0x280681);_0x270095(_0x280681);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 137fa3e..f951059 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 _0x3473=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','put','update','destroy','multer','path','connect-timeout','express','Router'];(function(_0x530afa,_0xa8524d){var _0x4a3377=function(_0x211fed){while(--_0x211fed){_0x530afa['push'](_0x530afa['shift']());}};_0x4a3377(++_0xa8524d);}(_0x3473,0x177));var _0x3347=function(_0x40b13e,_0x2837ab){_0x40b13e=_0x40b13e-0x0;var _0x3a949a=_0x3473[_0x40b13e];return _0x3a949a;};'use strict';var multer=require(_0x3347('0x0'));var util=require('util');var path=require(_0x3347('0x1'));var timeout=require(_0x3347('0x2'));var express=require(_0x3347('0x3'));var router=express[_0x3347('0x4')]();var fs_extra=require(_0x3347('0x5'));var auth=require(_0x3347('0x6'));var interaction=require(_0x3347('0x7'));var config=require(_0x3347('0x8'));var controller=require(_0x3347('0x9'));router[_0x3347('0xa')]('/',auth['isAuthenticated'](),controller[_0x3347('0xb')]);router[_0x3347('0xa')](_0x3347('0xc'),auth[_0x3347('0xd')](),controller[_0x3347('0xe')]);router['get'](_0x3347('0xf'),auth[_0x3347('0xd')](),controller['show']);router['post']('/',auth[_0x3347('0xd')](),controller['create']);router[_0x3347('0x10')](_0x3347('0xf'),auth[_0x3347('0xd')](),controller[_0x3347('0x11')]);router['delete']('/:id',auth[_0x3347('0xd')](),controller[_0x3347('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa6a7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','exports','util','path','express','fs-extra'];(function(_0x543084,_0x44eeb2){var _0x14bacc=function(_0xe70f9f){while(--_0xe70f9f){_0x543084['push'](_0x543084['shift']());}};_0x14bacc(++_0x44eeb2);}(_0xa6a7,0x8f));var _0x7a6a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa6a7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x7a6a('0x0'));var path=require(_0x7a6a('0x1'));var timeout=require('connect-timeout');var express=require(_0x7a6a('0x2'));var router=express['Router']();var fs_extra=require(_0x7a6a('0x3'));var auth=require(_0x7a6a('0x4'));var interaction=require(_0x7a6a('0x5'));var config=require(_0x7a6a('0x6'));var controller=require(_0x7a6a('0x7'));router[_0x7a6a('0x8')]('/',auth['isAuthenticated'](),controller[_0x7a6a('0x9')]);router['get'](_0x7a6a('0xa'),auth[_0x7a6a('0xb')](),controller[_0x7a6a('0xc')]);router[_0x7a6a('0x8')](_0x7a6a('0xd'),auth['isAuthenticated'](),controller[_0x7a6a('0xe')]);router[_0x7a6a('0xf')]('/',auth[_0x7a6a('0xb')](),controller[_0x7a6a('0x10')]);router['put'](_0x7a6a('0xd'),auth[_0x7a6a('0xb')](),controller[_0x7a6a('0x11')]);router[_0x7a6a('0x12')](_0x7a6a('0xd'),auth[_0x7a6a('0xb')](),controller[_0x7a6a('0x13')]);module[_0x7a6a('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 5b530c6..a71ed54 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 _0xac4a=['Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','Chat','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!','Send','Skip','Feedback','star','stringify','input','name','getDataValue','onlineForm','textarea','Comments','offlineForm','parse','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion'];(function(_0x6429c0,_0x1471c1){var _0x4b91a6=function(_0x12bd82){while(--_0x12bd82){_0x6429c0['push'](_0x6429c0['shift']());}};_0x4b91a6(++_0x1471c1);}(_0xac4a,0x13f));var _0xaac4=function(_0x5030b8,_0x28c03a){_0x5030b8=_0x5030b8-0x0;var _0xf27858=_0xac4a[_0x5030b8];return _0xf27858;};'use strict';var Sequelize=require(_0xaac4('0x0'));var rs=require(_0xaac4('0x1'));module[_0xaac4('0x2')]={'name':{'type':Sequelize[_0xaac4('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xaac4('0x3')],'allowNull':![],'unique':_0xaac4('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xaac4('0x5')},'mapKeyOffline':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':_0xaac4('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xaac4('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xaac4('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xaac4('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xaac4('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xaac4('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xaac4('0x9')](_0xaac4('0xa'),_0xaac4('0xb')),'defaultValue':_0xaac4('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':_0xaac4('0xc')},'offline_chat_button':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':_0xaac4('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xaac4('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':_0xaac4('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xaac4('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xaac4('0x10')]},'closingQuestion':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':_0xaac4('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':_0xaac4('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':_0xaac4('0x13')},'noteTitle':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':_0xaac4('0x14')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xaac4('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xaac4('0x16')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xaac4('0x17')},'skipMessageButton':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':_0xaac4('0x18')},'conditionAgreement':{'type':Sequelize[_0xaac4('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xaac4('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xaac4('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xaac4('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':_0xaac4('0x19')},'ratingType':{'type':Sequelize['ENUM'](_0xaac4('0x1a'),'thumb'),'defaultValue':_0xaac4('0x1a')},'ratingStarsNumber':{'type':Sequelize[_0xaac4('0xe')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xaac4('0x10')],'defaultValue':function(){return JSON[_0xaac4('0x1b')]({'items':[{'type':_0xaac4('0x1c'),'variable':null,'config':{'placeholder':_0xaac4('0x1d'),'type':'text','required':!![]},'props':{'title':_0xaac4('0x1d'),'helpText':''}},{'type':_0xaac4('0x1c'),'props':{'title':_0xaac4('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xaac4('0x5'),'type':_0xaac4('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xaac4('0x1e')](_0xaac4('0x1f'))?JSON['parse'](this[_0xaac4('0x1e')]('onlineForm')):{};},'set':function(_0x54203b){return this['setDataValue']('onlineForm',JSON[_0xaac4('0x1b')](_0x54203b));}},'offlineForm':{'type':Sequelize[_0xaac4('0x10')],'defaultValue':function(){return JSON[_0xaac4('0x1b')]({'items':[{'type':_0xaac4('0x1c'),'props':{'title':_0xaac4('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xaac4('0x5'),'type':_0xaac4('0x5')},'variable':null},{'type':_0xaac4('0x20'),'config':{'placeholder':_0xaac4('0x21')},'props':{'title':_0xaac4('0x21'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xaac4('0x1e')](_0xaac4('0x22'))?JSON[_0xaac4('0x23')](this[_0xaac4('0x1e')](_0xaac4('0x22'))):{};},'set':function(_0x442b87){return this['setDataValue'](_0xaac4('0x22'),JSON['stringify'](_0x442b87));}},'token':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':function(){return rs[_0xaac4('0x24')]();}},'autoclose':{'type':Sequelize[_0xaac4('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xaac4('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xaac4('0x3')]},'waitingTitle':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':_0xaac4('0x25')},'waitingMessage':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':_0xaac4('0x26')},'offlineMessageSubject':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':_0xaac4('0x27')},'offlineMessageBody':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':_0xaac4('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0xaac4('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':_0xaac4('0x29')},'skipUnmanaged':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':_0xaac4('0x18')},'sendUnmanaged':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xaac4('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xaac4('0x10')]},'showAgentAvatar':{'type':Sequelize[_0xaac4('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xaac4('0x10')],'defaultValue':function(){return _0xaac4('0x2a');}},'notificationSound':{'type':Sequelize[_0xaac4('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xaac4('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xaac4('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':_0xaac4('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':_0xaac4('0x2c')},'verticalAlignment':{'type':Sequelize[_0xaac4('0xe')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0xaac4('0x2d')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xaac4('0x3')]},'customerAvatar':{'type':Sequelize[_0xaac4('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0xaac4('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xaac4('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xaac4('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xaac4('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xaac4('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xaac4('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xaac4('0xe')],'comment':_0xaac4('0x2f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xaac4('0x30'),'set':function(_0xdea3a0){if(!_0xdea3a0)this[_0xaac4('0x31')]('mandatoryDispositionPauseId',null);this[_0xaac4('0x31')](_0xaac4('0x32'),_0xdea3a0);}},'vidaooEscalation':{'type':Sequelize[_0xaac4('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xaac4('0x3')],'allowNull':![],'defaultValue':_0xaac4('0x33')},'vidaooNote':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':function(){return _0xaac4('0x34');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xaac4('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x6324=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Feedback','star','thumb','INTEGER','stringify','input','name','text','email','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x31efa8,_0x526bdf){var _0x43fd22=function(_0x2494d2){while(--_0x2494d2){_0x31efa8['push'](_0x31efa8['shift']());}};_0x43fd22(++_0x526bdf);}(_0x6324,0x142));var _0x4632=function(_0x912e23,_0x15f457){_0x912e23=_0x912e23-0x0;var _0x453f72=_0x6324[_0x912e23];return _0x453f72;};'use strict';var Sequelize=require(_0x4632('0x0'));var rs=require(_0x4632('0x1'));module[_0x4632('0x2')]={'name':{'type':Sequelize[_0x4632('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4632('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x4632('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x4632('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x4632('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0x5')},'customerAlias':{'type':Sequelize[_0x4632('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4632('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x4632('0x3')],'allowNull':![],'defaultValue':_0x4632('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4632('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x4632('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x4632('0x3')]},'animation':{'type':Sequelize[_0x4632('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x4632('0x9')](_0x4632('0xa'),_0x4632('0xb')),'defaultValue':_0x4632('0xa')},'header_online':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0xc')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x4632('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x4632('0xe')},'header_offline':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0xf')},'download_transcript':{'type':Sequelize[_0x4632('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x4632('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x4632('0x11')]},'closingQuestion':{'type':Sequelize[_0x4632('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4632('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0x13')},'noteTitle':{'type':Sequelize[_0x4632('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0x14')},'closingMessage':{'type':Sequelize[_0x4632('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0xe')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x4632('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x4632('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x4632('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x4632('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0x15')},'ratingType':{'type':Sequelize[_0x4632('0x9')](_0x4632('0x16'),_0x4632('0x17')),'defaultValue':_0x4632('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x4632('0x18')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x4632('0x11')],'defaultValue':function(){return JSON[_0x4632('0x19')]({'items':[{'type':_0x4632('0x1a'),'variable':null,'config':{'placeholder':_0x4632('0x1b'),'type':_0x4632('0x1c'),'required':!![]},'props':{'title':_0x4632('0x1b'),'helpText':''}},{'type':_0x4632('0x1a'),'props':{'title':_0x4632('0x1d'),'helpText':''},'config':{'required':!![],'placeholder':_0x4632('0x1d'),'type':_0x4632('0x1d')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x4632('0x1e')](_0x4632('0x1f'))?JSON[_0x4632('0x20')](this[_0x4632('0x1e')](_0x4632('0x1f'))):{};},'set':function(_0x4af026){return this[_0x4632('0x21')](_0x4632('0x1f'),JSON[_0x4632('0x19')](_0x4af026));}},'offlineForm':{'type':Sequelize[_0x4632('0x11')],'defaultValue':function(){return JSON[_0x4632('0x19')]({'items':[{'type':_0x4632('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x4632('0x1d')},'variable':null},{'type':_0x4632('0x22'),'config':{'placeholder':_0x4632('0x23')},'props':{'title':_0x4632('0x23'),'helpText':_0x4632('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0x4632('0x1e')](_0x4632('0x25'))?JSON['parse'](this[_0x4632('0x1e')](_0x4632('0x25'))):{};},'set':function(_0x48f5fb){return this[_0x4632('0x21')]('offlineForm',JSON[_0x4632('0x19')](_0x48f5fb));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x4632('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x4632('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x4632('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x4632('0x3')]},'waitingTitle':{'type':Sequelize[_0x4632('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4632('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x4632('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x4632('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0x28')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x4632('0x29')},'sendUnmanaged':{'type':Sequelize[_0x4632('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x4632('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x4632('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x4632('0x2a');}},'notificationSound':{'type':Sequelize[_0x4632('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4632('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x4632('0x18')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0x2c')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x4632('0x2d')},'messagesAlignment':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0x2e')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x4632('0x18')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x4632('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x4632('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4632('0x18')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4632('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4632('0x18')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0x2f')},'systemAvatar':{'type':Sequelize[_0x4632('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4632('0x18')],'comment':_0x4632('0x30')},'mandatoryDisposition':{'type':Sequelize[_0x4632('0x8')],'defaultValue':![],'comment':_0x4632('0x31'),'set':function(_0x3b6258){if(!_0x3b6258)this['setDataValue'](_0x4632('0x32'),null);this[_0x4632('0x21')]('mandatoryDisposition',_0x3b6258);}},'vidaooEscalation':{'type':Sequelize[_0x4632('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x4632('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4632('0x33')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x4632('0x34');}},'vidaooMetadata':{'type':Sequelize[_0x4632('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x4632('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x4632('0x11')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 7b38e57..9483b05 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 _0xab34=['online','false','offlineForm','onlineForm','fromKey','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','request','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','sendStatus','status','json','offset','undefined','limit','count','set','update','then','destroy','get','ChatWebsites','UserProfileResource','end','name','send','mandatoryDispositionPause','map','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','ChatWebsite','include','findAll','rows','show','params','keys','rawAttributes','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Pause','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','includeAll','removeDispositions','ids','addAnswer','getAnswers','pick','CannedAnswer','removeAnswers','sitepic','file','addAvatar','agentAvatar','filename','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','join','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','isNil','notify','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','difference','createdAt','CompanyId','ListId','from','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','updatedAt','DESC','ChatApplication','account','applications','Applications','orderBy','asc','contact','cf-connecting-ip','x-forwarded-for','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','firstName','lastName','messageId','created','autoclose','push','close','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','EventManager','offline','no\x20available\x20attributes','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','mimetype','server','attachments','offline-chat','openNewInteraction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','SendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','MailAccountId','originalname','subjectOffline','offlineMessageSubject','NotifyMailAccount','remove','Could\x20not\x20remove\x20attachment\x20file','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','getSnippet','timezone','interval','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','x-real-ip','replace','alignment','verticalAlignment','textColor','textButtonColor','color_button','hideWhenOffline','IntervalId','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findAndCountAll','priority','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields'];(function(_0x2bcf3b,_0x2443d7){var _0x1d2898=function(_0x328100){while(--_0x328100){_0x2bcf3b['push'](_0x2bcf3b['shift']());}};_0x1d2898(++_0x2443d7);}(_0xab34,0x12e));var _0x4ab3=function(_0x1ec78e,_0x57fd2a){_0x1ec78e=_0x1ec78e-0x0;var _0x429cd0=_0xab34[_0x1ec78e];return _0x429cd0;};'use strict';var BPromise=require(_0x4ab3('0x0'));var Mustache=require(_0x4ab3('0x1'));var util=require(_0x4ab3('0x2'));var path=require(_0x4ab3('0x3'));var ejs=require(_0x4ab3('0x4'));var fs=require('fs');var fs_extra=require(_0x4ab3('0x5'));var _=require(_0x4ab3('0x6'));var querystring=require(_0x4ab3('0x7'));var Redis=require(_0x4ab3('0x8'));var qs=require(_0x4ab3('0x9'));var logger=require('../../config/logger')(_0x4ab3('0xa'));var config=require('../../config/environment');var db=require(_0x4ab3('0xb'))['db'];config[_0x4ab3('0xc')]=_['defaults'](config[_0x4ab3('0xc')],{'host':_0x4ab3('0xd'),'port':0x18eb});var socket=require(_0x4ab3('0xe'))(new Redis(config[_0x4ab3('0xc')]));require('./chatWebsite.socket')[_0x4ab3('0xf')](socket);var htmlToText=require('html-to-text');var jayson=require('jayson/promise');var client=jayson[_0x4ab3('0x10')][_0x4ab3('0x11')]({'port':0x232c});var client9002=jayson[_0x4ab3('0x10')][_0x4ab3('0x11')]({'port':0x232a});var client9003=jayson[_0x4ab3('0x10')]['http']({'port':0x232b});var client9001=jayson['client'][_0x4ab3('0x11')]({'port':0x2329});function respondWithRpcPromise(_0x2179c1,_0x2f9c37,_0x113578,_0x588740){return new BPromise(function(_0x47dd54,_0x42e735){var _0x34340a=_0x588740||client;return _0x34340a[_0x4ab3('0x12')](_0x2179c1,_0x113578)['then'](function(_0x46c6f7){logger['info'](_0x4ab3('0x13'),_0x2f9c37,'request\x20sent');logger['debug'](_0x4ab3('0x14'),_0x2f9c37,_0x4ab3('0x15'),JSON['stringify'](_0x46c6f7));if(_0x46c6f7[_0x4ab3('0x16')]){if(_0x46c6f7[_0x4ab3('0x16')][_0x4ab3('0x17')]===0x1f4){logger['error'](_0x4ab3('0x13'),_0x2f9c37,_0x46c6f7['error'][_0x4ab3('0x18')]);return _0x42e735(_0x46c6f7[_0x4ab3('0x16')][_0x4ab3('0x18')]);}logger[_0x4ab3('0x16')](_0x4ab3('0x13'),_0x2f9c37,_0x46c6f7[_0x4ab3('0x16')][_0x4ab3('0x18')]);return _0x47dd54(_0x46c6f7[_0x4ab3('0x16')][_0x4ab3('0x18')]);}else{logger[_0x4ab3('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x2f9c37,_0x4ab3('0x15'));_0x47dd54(_0x46c6f7['result']['message']);}})[_0x4ab3('0x1a')](function(_0x2015b6){logger[_0x4ab3('0x16')](_0x4ab3('0x13'),_0x2f9c37,_0x2015b6);_0x42e735(_0x2015b6);});});}function respondWithStatusCode(_0xe39039,_0x2d4416){_0x2d4416=_0x2d4416||0xcc;return function(_0xbf2c1f){if(_0xbf2c1f){return _0xe39039[_0x4ab3('0x1b')](_0x2d4416);}return _0xe39039['status'](_0x2d4416)['end']();};}function respondWithResult(_0x475800,_0x12e5bb){_0x12e5bb=_0x12e5bb||0xc8;return function(_0x13eed2){if(_0x13eed2){return _0x475800[_0x4ab3('0x1c')](_0x12e5bb)[_0x4ab3('0x1d')](_0x13eed2);}};}function respondWithFilteredResult(_0x1a0977,_0xe08697){return function(_0x1c856c){if(_0x1c856c){var _0x4d8242=typeof _0xe08697[_0x4ab3('0x1e')]===_0x4ab3('0x1f')&&typeof _0xe08697[_0x4ab3('0x20')]==='undefined';var _0x14739f=_0x1c856c['count'];var _0x2be991=_0x4d8242?0x0:_0xe08697['offset'];var _0x363292=_0x4d8242?_0x1c856c[_0x4ab3('0x21')]:_0xe08697[_0x4ab3('0x1e')]+_0xe08697[_0x4ab3('0x20')];var _0x401e30;if(_0x363292>=_0x14739f){_0x363292=_0x14739f;_0x401e30=0xc8;}else{_0x401e30=0xce;}_0x1a0977[_0x4ab3('0x1c')](_0x401e30);return _0x1a0977[_0x4ab3('0x22')]('Content-Range',_0x2be991+'-'+_0x363292+'/'+_0x14739f)[_0x4ab3('0x1d')](_0x1c856c);}return null;};}function saveUpdates(_0x2c5780){return function(_0x20fcdb){if(_0x20fcdb){return _0x20fcdb[_0x4ab3('0x23')](_0x2c5780)[_0x4ab3('0x24')](function(_0x6e7651){return _0x6e7651;});}return null;};}function removeEntity(_0x3ddeb2){return function(_0x5bc9ae){if(_0x5bc9ae){return _0x5bc9ae[_0x4ab3('0x25')]()[_0x4ab3('0x24')](function(){var _0x3d281e=_0x5bc9ae[_0x4ab3('0x26')]({'plain':!![]});var _0x19087b=_0x4ab3('0x27');return db[_0x4ab3('0x28')][_0x4ab3('0x25')]({'where':{'type':_0x19087b,'resourceId':_0x3d281e['id']}})['then'](function(){return _0x5bc9ae;});})['then'](function(){_0x3ddeb2[_0x4ab3('0x1c')](0xcc)[_0x4ab3('0x29')]();});}};}function handleEntityNotFound(_0x28fff5){return function(_0x37eead){if(!_0x37eead){_0x28fff5[_0x4ab3('0x1b')](0x194);}return _0x37eead;};}function handleError(_0x4421b8,_0x244077){_0x244077=_0x244077||0x1f4;return function(_0x186e0b){logger[_0x4ab3('0x16')](_0x186e0b['stack']);if(_0x186e0b['name']){delete _0x186e0b[_0x4ab3('0x2a')];}_0x4421b8['status'](_0x244077)[_0x4ab3('0x2b')](_0x186e0b);};}exports['index']=function(_0x1b1072,_0xb75c39){var _0x56da23={'include':[{'model':db['Pause'],'as':_0x4ab3('0x2c')}]},_0x33875c={},_0x92a7ad={'count':0x0,'rows':[]};var _0x40eedf=_[_0x4ab3('0x2d')](db['ChatWebsite']['rawAttributes'],function(_0x492f87){return{'name':_0x492f87['fieldName'],'type':_0x492f87['type'][_0x4ab3('0x2e')]};});_0x33875c['model']=_['map'](_0x40eedf,_0x4ab3('0x2a'));_0x33875c[_0x4ab3('0x2f')]=_['keys'](_0x1b1072[_0x4ab3('0x2f')]);_0x33875c[_0x4ab3('0x30')]=_[_0x4ab3('0x31')](_0x33875c[_0x4ab3('0x32')],_0x33875c[_0x4ab3('0x2f')]);_0x56da23[_0x4ab3('0x33')]=_[_0x4ab3('0x31')](_0x33875c[_0x4ab3('0x32')],qs[_0x4ab3('0x34')](_0x1b1072[_0x4ab3('0x2f')]['fields']));_0x56da23[_0x4ab3('0x33')]=_0x56da23[_0x4ab3('0x33')][_0x4ab3('0x35')]?_0x56da23['attributes']:_0x33875c[_0x4ab3('0x32')];if(!_0x1b1072[_0x4ab3('0x2f')][_0x4ab3('0x36')](_0x4ab3('0x37'))){_0x56da23[_0x4ab3('0x20')]=qs[_0x4ab3('0x20')](_0x1b1072[_0x4ab3('0x2f')]['limit']);_0x56da23[_0x4ab3('0x1e')]=qs['offset'](_0x1b1072[_0x4ab3('0x2f')]['offset']);}_0x56da23[_0x4ab3('0x38')]=qs['sort'](_0x1b1072[_0x4ab3('0x2f')][_0x4ab3('0x39')]);_0x56da23[_0x4ab3('0x3a')]=qs[_0x4ab3('0x30')](_['pick'](_0x1b1072[_0x4ab3('0x2f')],_0x33875c[_0x4ab3('0x30')]),_0x40eedf);if(_0x1b1072[_0x4ab3('0x2f')][_0x4ab3('0x3b')]){_0x56da23[_0x4ab3('0x3a')]=_['merge'](_0x56da23[_0x4ab3('0x3a')],{'$or':_[_0x4ab3('0x2d')](_0x40eedf,function(_0x28be60){if(_0x28be60[_0x4ab3('0x3c')]!==_0x4ab3('0x3d')){var _0x1fc9ff={};_0x1fc9ff[_0x28be60[_0x4ab3('0x2a')]]={'$like':'%'+_0x1b1072[_0x4ab3('0x2f')][_0x4ab3('0x3b')]+'%'};return _0x1fc9ff;}})});}_0x56da23=_[_0x4ab3('0x3e')]({},_0x56da23,_0x1b1072[_0x4ab3('0x3f')]);var _0x3dcdfe={'where':_0x56da23['where']};return db[_0x4ab3('0x40')][_0x4ab3('0x21')](_0x3dcdfe)[_0x4ab3('0x24')](function(_0xfe76e1){_0x92a7ad['count']=_0xfe76e1;if(_0x1b1072[_0x4ab3('0x2f')]['includeAll']){_0x56da23[_0x4ab3('0x41')]=[{'all':!![]}];}return db[_0x4ab3('0x40')][_0x4ab3('0x42')](_0x56da23);})[_0x4ab3('0x24')](function(_0x5a6f3c){_0x92a7ad[_0x4ab3('0x43')]=_0x5a6f3c;return _0x92a7ad;})[_0x4ab3('0x24')](respondWithFilteredResult(_0xb75c39,_0x56da23))['catch'](handleError(_0xb75c39,null));};exports[_0x4ab3('0x44')]=function(_0x34e93e,_0x1e841f){var _0x1e2749={'raw':![],'where':{'id':_0x34e93e[_0x4ab3('0x45')]['id']},'include':[{'model':db['Pause'],'as':_0x4ab3('0x2c')}]},_0x1c5987={};_0x1c5987[_0x4ab3('0x32')]=_[_0x4ab3('0x46')](db['ChatWebsite'][_0x4ab3('0x47')]);_0x1c5987['query']=_[_0x4ab3('0x46')](_0x34e93e[_0x4ab3('0x2f')]);_0x1c5987[_0x4ab3('0x30')]=_[_0x4ab3('0x31')](_0x1c5987[_0x4ab3('0x32')],_0x1c5987[_0x4ab3('0x2f')]);_0x1e2749[_0x4ab3('0x33')]=_[_0x4ab3('0x31')](_0x1c5987[_0x4ab3('0x32')],qs[_0x4ab3('0x34')](_0x34e93e[_0x4ab3('0x2f')][_0x4ab3('0x34')]));_0x1e2749[_0x4ab3('0x33')]=_0x1e2749['attributes'][_0x4ab3('0x35')]?_0x1e2749[_0x4ab3('0x33')]:_0x1c5987[_0x4ab3('0x32')];if(_0x34e93e[_0x4ab3('0x2f')]['includeAll']){_0x1e2749['include']=[{'all':!![]}];}_0x1e2749=_[_0x4ab3('0x3e')]({},_0x1e2749,_0x34e93e[_0x4ab3('0x3f')]);return db['ChatWebsite']['find'](_0x1e2749)[_0x4ab3('0x24')](handleEntityNotFound(_0x1e841f,null))[_0x4ab3('0x24')](respondWithResult(_0x1e841f,null))[_0x4ab3('0x1a')](handleError(_0x1e841f,null));};exports[_0x4ab3('0x48')]=function(_0x307236,_0x45a4c9){return db[_0x4ab3('0x40')][_0x4ab3('0x48')](_0x307236['body'],{})[_0x4ab3('0x24')](function(_0x500bdf){var _0x3d367d=_0x307236[_0x4ab3('0x49')][_0x4ab3('0x26')]({'plain':!![]});if(!_0x3d367d)throw new Error(_0x4ab3('0x4a'));if(_0x3d367d[_0x4ab3('0x4b')]===_0x4ab3('0x49')){var _0x4b6621=_0x500bdf[_0x4ab3('0x26')]({'plain':!![]});var _0x36b44d=_0x4ab3('0x27');return db['UserProfileSection'][_0x4ab3('0x4c')]({'where':{'name':_0x36b44d,'userProfileId':_0x3d367d[_0x4ab3('0x4d')]},'raw':!![]})['then'](function(_0x823ac5){if(_0x823ac5&&_0x823ac5['autoAssociation']===0x0){return db[_0x4ab3('0x28')]['create']({'name':_0x4b6621[_0x4ab3('0x2a')],'resourceId':_0x4b6621['id'],'type':_0x823ac5[_0x4ab3('0x2a')],'sectionId':_0x823ac5['id']},{})[_0x4ab3('0x24')](function(){return _0x500bdf;});}else{return _0x500bdf;}})[_0x4ab3('0x1a')](function(_0x2e3e2b){logger[_0x4ab3('0x16')](_0x4ab3('0x4e'),_0x2e3e2b);throw _0x2e3e2b;});}return _0x500bdf;})[_0x4ab3('0x24')](respondWithResult(_0x45a4c9,0xc9))[_0x4ab3('0x1a')](handleError(_0x45a4c9,null));};exports['update']=function(_0x4b85f9,_0x57fa88){if(_0x4b85f9[_0x4ab3('0x4f')]['id']){delete _0x4b85f9['body']['id'];}return db['ChatWebsite'][_0x4ab3('0x4c')]({'where':{'id':_0x4b85f9['params']['id']},'include':[{'model':db[_0x4ab3('0x50')],'as':_0x4ab3('0x2c')}]})[_0x4ab3('0x24')](handleEntityNotFound(_0x57fa88,null))['then'](saveUpdates(_0x4b85f9[_0x4ab3('0x4f')],null))[_0x4ab3('0x24')](respondWithResult(_0x57fa88,null))[_0x4ab3('0x1a')](handleError(_0x57fa88,null));};exports[_0x4ab3('0x25')]=function(_0x6ba9f6,_0x1c744d){return db['ChatWebsite'][_0x4ab3('0x4c')]({'where':{'id':_0x6ba9f6[_0x4ab3('0x45')]['id']}})[_0x4ab3('0x24')](handleEntityNotFound(_0x1c744d,null))[_0x4ab3('0x24')](removeEntity(_0x1c744d,null))['catch'](handleError(_0x1c744d,null));};exports[_0x4ab3('0x51')]=function(_0x3a9d4f,_0x178fd1){return db[_0x4ab3('0x40')][_0x4ab3('0x51')]()[_0x4ab3('0x24')](respondWithResult(_0x178fd1,null))[_0x4ab3('0x1a')](handleError(_0x178fd1,null));};exports[_0x4ab3('0x52')]=function(_0x5471d7,_0x464734){if(_0x5471d7[_0x4ab3('0x4f')]['id']){delete _0x5471d7[_0x4ab3('0x4f')]['id'];}return db['ChatWebsite'][_0x4ab3('0x4c')]({'where':{'id':_0x5471d7[_0x4ab3('0x45')]['id']}})[_0x4ab3('0x24')](handleEntityNotFound(_0x464734,null))[_0x4ab3('0x24')](function(_0xa7674c){if(_0xa7674c){_0x5471d7[_0x4ab3('0x4f')][_0x4ab3('0x53')]=_0xa7674c['id'];return db[_0x4ab3('0x54')][_0x4ab3('0x48')](_0x5471d7[_0x4ab3('0x4f')]);}})[_0x4ab3('0x24')](respondWithResult(_0x464734,null))[_0x4ab3('0x1a')](handleError(_0x464734,null));};exports[_0x4ab3('0x55')]=function(_0x41930f,_0x103a75){var _0x2cbcdb={'raw':![],'where':{}};var _0x17da96={};var _0x255772={'count':0x0,'rows':[]};return db[_0x4ab3('0x40')][_0x4ab3('0x56')]({'where':{'id':_0x41930f[_0x4ab3('0x45')]['id']}})[_0x4ab3('0x24')](handleEntityNotFound(_0x103a75,null))[_0x4ab3('0x24')](function(_0x3fa3b3){if(_0x3fa3b3){_0x17da96[_0x4ab3('0x32')]=_['keys'](db[_0x4ab3('0x54')][_0x4ab3('0x47')]);_0x17da96[_0x4ab3('0x2f')]=_[_0x4ab3('0x46')](_0x41930f[_0x4ab3('0x2f')]);_0x17da96[_0x4ab3('0x30')]=_[_0x4ab3('0x31')](_0x17da96[_0x4ab3('0x32')],_0x17da96['query']);_0x2cbcdb[_0x4ab3('0x33')]=_[_0x4ab3('0x31')](_0x17da96['model'],qs[_0x4ab3('0x34')](_0x41930f[_0x4ab3('0x2f')][_0x4ab3('0x34')]));_0x2cbcdb['attributes']=_0x2cbcdb['attributes'][_0x4ab3('0x35')]?_0x2cbcdb['attributes']:_0x17da96[_0x4ab3('0x32')];if(!_0x41930f[_0x4ab3('0x2f')][_0x4ab3('0x36')](_0x4ab3('0x37'))){_0x2cbcdb[_0x4ab3('0x20')]=qs['limit'](_0x41930f[_0x4ab3('0x2f')][_0x4ab3('0x20')]);_0x2cbcdb[_0x4ab3('0x1e')]=qs[_0x4ab3('0x1e')](_0x41930f[_0x4ab3('0x2f')][_0x4ab3('0x1e')]);}_0x2cbcdb[_0x4ab3('0x38')]=qs[_0x4ab3('0x39')](_0x41930f[_0x4ab3('0x2f')]['sort']);_0x2cbcdb['where']=qs[_0x4ab3('0x30')](_['pick'](_0x41930f[_0x4ab3('0x2f')],_0x17da96[_0x4ab3('0x30')]));_0x2cbcdb[_0x4ab3('0x3a')][_0x4ab3('0x53')]=_0x3fa3b3['id'];if(_0x41930f['query'][_0x4ab3('0x3b')]){_0x2cbcdb['where']=_[_0x4ab3('0x3e')](_0x2cbcdb[_0x4ab3('0x3a')],{'$or':_[_0x4ab3('0x2d')](_0x2cbcdb[_0x4ab3('0x33')],function(_0xcc3134){var _0x34b571={};_0x34b571[_0xcc3134]={'$like':'%'+_0x41930f['query'][_0x4ab3('0x3b')]+'%'};return _0x34b571;})});}_0x2cbcdb=_[_0x4ab3('0x3e')]({},_0x2cbcdb,_0x41930f['options']);return db['Disposition'][_0x4ab3('0x21')]({'where':_0x2cbcdb[_0x4ab3('0x3a')]})['then'](function(_0x1b7382){_0x255772['count']=_0x1b7382;if(_0x41930f[_0x4ab3('0x2f')][_0x4ab3('0x57')]){_0x2cbcdb['include']=[{'all':!![]}];}return db[_0x4ab3('0x54')][_0x4ab3('0x42')](_0x2cbcdb);})['then'](function(_0x3579cf){_0x255772['rows']=_0x3579cf;return _0x255772;});}})[_0x4ab3('0x24')](respondWithFilteredResult(_0x103a75,_0x2cbcdb))['catch'](handleError(_0x103a75,null));};exports[_0x4ab3('0x58')]=function(_0x21bd0c,_0x373752){return db[_0x4ab3('0x40')][_0x4ab3('0x4c')]({'where':{'id':_0x21bd0c[_0x4ab3('0x45')]['id']}})[_0x4ab3('0x24')](handleEntityNotFound(_0x373752,null))[_0x4ab3('0x24')](function(_0x467a7b){if(_0x467a7b){return _0x467a7b['removeDispositions'](_0x21bd0c['query'][_0x4ab3('0x59')]);}})[_0x4ab3('0x24')](respondWithStatusCode(_0x373752,null))[_0x4ab3('0x1a')](handleError(_0x373752,null));};exports[_0x4ab3('0x5a')]=function(_0x479bde,_0x59eb47){if(_0x479bde[_0x4ab3('0x4f')]['id']){delete _0x479bde[_0x4ab3('0x4f')]['id'];}return db['ChatWebsite'][_0x4ab3('0x4c')]({'where':{'id':_0x479bde[_0x4ab3('0x45')]['id']}})[_0x4ab3('0x24')](handleEntityNotFound(_0x59eb47,null))['then'](function(_0x290321){if(_0x290321){_0x479bde['body']['ChatWebsiteId']=_0x290321['id'];return db['CannedAnswer'][_0x4ab3('0x48')](_0x479bde['body']);}})[_0x4ab3('0x24')](respondWithResult(_0x59eb47,null))[_0x4ab3('0x1a')](handleError(_0x59eb47,null));};exports[_0x4ab3('0x5b')]=function(_0x4ad36c,_0x5a6e30){var _0x4db383={'raw':![],'where':{}};var _0x287b58={};var _0xac8403={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x4ab3('0x56')]({'where':{'id':_0x4ad36c[_0x4ab3('0x45')]['id']}})['then'](handleEntityNotFound(_0x5a6e30,null))[_0x4ab3('0x24')](function(_0x5783e2){if(_0x5783e2){_0x287b58[_0x4ab3('0x32')]=_['keys'](db['CannedAnswer'][_0x4ab3('0x47')]);_0x287b58[_0x4ab3('0x2f')]=_[_0x4ab3('0x46')](_0x4ad36c[_0x4ab3('0x2f')]);_0x287b58[_0x4ab3('0x30')]=_[_0x4ab3('0x31')](_0x287b58[_0x4ab3('0x32')],_0x287b58[_0x4ab3('0x2f')]);_0x4db383[_0x4ab3('0x33')]=_[_0x4ab3('0x31')](_0x287b58['model'],qs[_0x4ab3('0x34')](_0x4ad36c[_0x4ab3('0x2f')][_0x4ab3('0x34')]));_0x4db383[_0x4ab3('0x33')]=_0x4db383['attributes'][_0x4ab3('0x35')]?_0x4db383[_0x4ab3('0x33')]:_0x287b58[_0x4ab3('0x32')];if(!_0x4ad36c[_0x4ab3('0x2f')]['hasOwnProperty'](_0x4ab3('0x37'))){_0x4db383[_0x4ab3('0x20')]=qs[_0x4ab3('0x20')](_0x4ad36c[_0x4ab3('0x2f')]['limit']);_0x4db383['offset']=qs[_0x4ab3('0x1e')](_0x4ad36c[_0x4ab3('0x2f')]['offset']);}_0x4db383[_0x4ab3('0x38')]=qs[_0x4ab3('0x39')](_0x4ad36c['query'][_0x4ab3('0x39')]);_0x4db383[_0x4ab3('0x3a')]=qs[_0x4ab3('0x30')](_[_0x4ab3('0x5c')](_0x4ad36c['query'],_0x287b58['filters']));_0x4db383[_0x4ab3('0x3a')][_0x4ab3('0x53')]=_0x5783e2['id'];if(_0x4ad36c[_0x4ab3('0x2f')][_0x4ab3('0x3b')]){_0x4db383[_0x4ab3('0x3a')]=_[_0x4ab3('0x3e')](_0x4db383[_0x4ab3('0x3a')],{'$or':_[_0x4ab3('0x2d')](_0x4db383['attributes'],function(_0x1d494d){var _0x3c2ea9={};_0x3c2ea9[_0x1d494d]={'$like':'%'+_0x4ad36c[_0x4ab3('0x2f')][_0x4ab3('0x3b')]+'%'};return _0x3c2ea9;})});}_0x4db383=_['merge']({},_0x4db383,_0x4ad36c['options']);return db[_0x4ab3('0x5d')][_0x4ab3('0x21')]({'where':_0x4db383[_0x4ab3('0x3a')]})['then'](function(_0xb66b54){_0xac8403[_0x4ab3('0x21')]=_0xb66b54;if(_0x4ad36c[_0x4ab3('0x2f')][_0x4ab3('0x57')]){_0x4db383[_0x4ab3('0x41')]=[{'all':!![]}];}return db[_0x4ab3('0x5d')]['findAll'](_0x4db383);})['then'](function(_0x1a5b80){_0xac8403[_0x4ab3('0x43')]=_0x1a5b80;return _0xac8403;});}})[_0x4ab3('0x24')](respondWithFilteredResult(_0x5a6e30,_0x4db383))[_0x4ab3('0x1a')](handleError(_0x5a6e30,null));};exports['removeAnswers']=function(_0x24704e,_0x2eccef){return db['ChatWebsite']['find']({'where':{'id':_0x24704e['params']['id']}})[_0x4ab3('0x24')](handleEntityNotFound(_0x2eccef,null))['then'](function(_0x237893){if(_0x237893){return _0x237893[_0x4ab3('0x5e')](_0x24704e[_0x4ab3('0x2f')]['ids']);}})[_0x4ab3('0x24')](respondWithStatusCode(_0x2eccef,null))[_0x4ab3('0x1a')](handleError(_0x2eccef,null));};exports['addLogo']=function(_0x253091,_0x574e57){_0x253091['body'][_0x4ab3('0x5f')]=_0x253091[_0x4ab3('0x60')]['filename'];return db[_0x4ab3('0x40')][_0x4ab3('0x4c')]({'where':{'id':_0x253091[_0x4ab3('0x45')]['id']}})[_0x4ab3('0x24')](handleEntityNotFound(_0x574e57,null))[_0x4ab3('0x24')](saveUpdates(_0x253091[_0x4ab3('0x4f')],null))[_0x4ab3('0x24')](respondWithResult(_0x574e57,null))[_0x4ab3('0x1a')](handleError(_0x574e57,null));};exports[_0x4ab3('0x61')]=function(_0x5b807d,_0x3b80f7){_0x5b807d['body'][_0x4ab3('0x62')]=_0x5b807d[_0x4ab3('0x60')][_0x4ab3('0x63')];return db['ChatWebsite'][_0x4ab3('0x4c')]({'where':{'id':_0x5b807d[_0x4ab3('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b80f7,null))[_0x4ab3('0x24')](saveUpdates(_0x5b807d[_0x4ab3('0x4f')],null))[_0x4ab3('0x24')](respondWithResult(_0x3b80f7,null))[_0x4ab3('0x1a')](handleError(_0x3b80f7,null));};exports['addCustomerAvatar']=function(_0x156150,_0x5a5957){_0x156150['body'][_0x4ab3('0x64')]=_0x156150['file'][_0x4ab3('0x63')];return db['ChatWebsite'][_0x4ab3('0x4c')]({'where':{'id':_0x156150['params']['id']}})[_0x4ab3('0x24')](handleEntityNotFound(_0x5a5957,null))['then'](saveUpdates(_0x156150['body'],null))[_0x4ab3('0x24')](respondWithResult(_0x5a5957,null))[_0x4ab3('0x1a')](handleError(_0x5a5957,null));};exports[_0x4ab3('0x65')]=function(_0x5d795d,_0x7c165a){_0x5d795d[_0x4ab3('0x4f')][_0x4ab3('0x66')]=_0x5d795d[_0x4ab3('0x60')][_0x4ab3('0x63')];return db[_0x4ab3('0x40')][_0x4ab3('0x4c')]({'where':{'id':_0x5d795d[_0x4ab3('0x45')]['id']}})[_0x4ab3('0x24')](handleEntityNotFound(_0x7c165a,null))[_0x4ab3('0x24')](saveUpdates(_0x5d795d['body'],null))['then'](respondWithResult(_0x7c165a,null))[_0x4ab3('0x1a')](handleError(_0x7c165a,null));};exports[_0x4ab3('0x67')]=function(_0x576f6a,_0x53b2eb){var _0x1ef264=path['join'](config[_0x4ab3('0x68')],_0x4ab3('0x69'));var _0x3fb72a={'where':{'id':_0x576f6a['params']['id']},'attributes':['id',_0x4ab3('0x5f')],'raw':!![]};var _0x146a61=![];return require(_0x4ab3('0x6a'))[_0x4ab3('0x6b')]()[_0x4ab3('0x24')](function(_0x48a557){if(_0x48a557){_0x146a61=_0x48a557[_0x4ab3('0x6c')];}})[_0x4ab3('0x24')](function(){return db[_0x4ab3('0x40')][_0x4ab3('0x4c')](_0x3fb72a);})['then'](handleEntityNotFound(_0x53b2eb,null))['then'](function(_0x2b6151){if(_0x2b6151){if(!_['isNil'](_0x2b6151[_0x4ab3('0x5f')])){if(fs['existsSync'](path[_0x4ab3('0x6d')](config[_0x4ab3('0x68')],'server/files/images/logos/',_0x2b6151[_0x4ab3('0x5f')]))&&_0x146a61){_0x1ef264=path[_0x4ab3('0x6d')](config['root'],'server/files/images/logos/',_0x2b6151[_0x4ab3('0x5f')]);}}return _0x53b2eb['download'](_0x1ef264);}})[_0x4ab3('0x1a')](handleError(_0x53b2eb,null));};exports[_0x4ab3('0x6e')]=function(_0x2e6f81,_0x5d7c50){var _0x25b480=path['join'](config[_0x4ab3('0x68')],_0x4ab3('0x6f'));var _0x588af5={'where':{'id':_0x2e6f81['params']['id']},'attributes':['id',_0x4ab3('0x62')],'raw':!![]};return db['ChatWebsite'][_0x4ab3('0x4c')](_0x588af5)[_0x4ab3('0x24')](handleEntityNotFound(_0x5d7c50,null))[_0x4ab3('0x24')](function(_0x3261ca){if(_0x3261ca){if(!_['isNil'](_0x3261ca[_0x4ab3('0x62')])){if(fs[_0x4ab3('0x70')](path['join'](config[_0x4ab3('0x68')],_0x4ab3('0x71'),_0x3261ca[_0x4ab3('0x62')]))){_0x25b480=path[_0x4ab3('0x6d')](config[_0x4ab3('0x68')],_0x4ab3('0x71'),_0x3261ca[_0x4ab3('0x62')]);}}return _0x5d7c50[_0x4ab3('0x72')](_0x25b480);}})[_0x4ab3('0x1a')](handleError(_0x5d7c50,null));};exports[_0x4ab3('0x73')]=function(_0x16efb8,_0x14e7ad){var _0x3c376e=path['join'](config[_0x4ab3('0x68')],_0x4ab3('0x74'));var _0x390861={'where':{'id':_0x16efb8[_0x4ab3('0x45')]['id']},'attributes':['id',_0x4ab3('0x64'),_0x4ab3('0x75')],'raw':!![]};return db[_0x4ab3('0x40')][_0x4ab3('0x4c')](_0x390861)[_0x4ab3('0x24')](handleEntityNotFound(_0x14e7ad,null))[_0x4ab3('0x24')](function(_0x930e6){if(_0x930e6){if(!_['isNil'](_0x930e6[_0x4ab3('0x64')])){if(fs[_0x4ab3('0x70')](path[_0x4ab3('0x6d')](config[_0x4ab3('0x68')],_0x4ab3('0x71'),_0x930e6[_0x4ab3('0x64')]))&&_0x930e6['showCustomerAvatar']){_0x3c376e=path['join'](config[_0x4ab3('0x68')],_0x4ab3('0x71'),_0x930e6[_0x4ab3('0x64')]);}}return _0x14e7ad[_0x4ab3('0x72')](_0x3c376e);}})[_0x4ab3('0x1a')](handleError(_0x14e7ad,null));};exports['getSystemAvatar']=function(_0x421b78,_0x4cdce1){var _0x3a9b7f=path[_0x4ab3('0x6d')](config[_0x4ab3('0x68')],_0x4ab3('0x76'));var _0x143eab={'where':{'id':_0x421b78[_0x4ab3('0x45')]['id']},'attributes':['id',_0x4ab3('0x66')],'raw':!![]};return db[_0x4ab3('0x40')][_0x4ab3('0x4c')](_0x143eab)[_0x4ab3('0x24')](handleEntityNotFound(_0x4cdce1,null))[_0x4ab3('0x24')](function(_0x57b502){if(_0x57b502){if(!_[_0x4ab3('0x77')](_0x57b502[_0x4ab3('0x66')])){if(fs[_0x4ab3('0x70')](path[_0x4ab3('0x6d')](config['root'],_0x4ab3('0x71'),_0x57b502[_0x4ab3('0x66')]))){_0x3a9b7f=path[_0x4ab3('0x6d')](config[_0x4ab3('0x68')],'server/files/images/avatars/',_0x57b502[_0x4ab3('0x66')]);}}return _0x4cdce1[_0x4ab3('0x72')](_0x3a9b7f);}})[_0x4ab3('0x1a')](handleError(_0x4cdce1,null));};exports[_0x4ab3('0x78')]=function(_0x48beda,_0x526c3e){var _0x284d03=require('user-agent-parser');var _0x138ca9=new _0x284d03();var _0xf69f7d=_0x138ca9[_0x4ab3('0x79')](_0x48beda[_0x4ab3('0x7a')][_0x4ab3('0x7b')])[_0x4ab3('0x7c')]();var _0x2b24d3={'body':_0x48beda[_0x4ab3('0x4f')],'channel':_0x4ab3('0x7d')};var _0x34b4f7=[];var _0x499f7f=[];var _0x58388c={};var _0xee4e45=![];return db[_0x4ab3('0x7e')][_0x4ab3('0x51')]()[_0x4ab3('0x24')](function(_0x18fceb){if(!_0x18fceb){throw new db[(_0x4ab3('0x7f'))]['ValidationError']('no\x20available\x20attributes');}_0x34b4f7=_[_0x4ab3('0x80')](_[_0x4ab3('0x46')](_0x18fceb),['createdAt','updatedAt']);_0x499f7f=_[_0x4ab3('0x80')](_[_0x4ab3('0x46')](_0x18fceb),[_0x4ab3('0x81'),'updatedAt',_0x4ab3('0x82'),_0x4ab3('0x83')]);if(_0x48beda[_0x4ab3('0x4f')]['id']){delete _0x48beda[_0x4ab3('0x4f')]['id'];}if(_[_0x4ab3('0x77')](_0x48beda['body'][_0x4ab3('0x84')])){throw new db[(_0x4ab3('0x7f'))][(_0x4ab3('0x85'))](_0x4ab3('0x86'));}if(_['isNil'](_0x48beda[_0x4ab3('0x4f')]['body'])||_0x48beda[_0x4ab3('0x4f')][_0x4ab3('0x4f')]===''){throw new db[(_0x4ab3('0x7f'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x48beda[_0x4ab3('0x4f')][_0x4ab3('0x87')])){throw new db[(_0x4ab3('0x7f'))][(_0x4ab3('0x85'))](_0x4ab3('0x88')+_0x499f7f);}if(!_[_0x4ab3('0x89')](_0x499f7f,_0x48beda[_0x4ab3('0x4f')][_0x4ab3('0x87')])){throw new db['Sequelize'][(_0x4ab3('0x85'))](_0x4ab3('0x8a')+_0x499f7f);}_0x58388c[_0x48beda[_0x4ab3('0x4f')][_0x4ab3('0x87')]]=_0x48beda[_0x4ab3('0x4f')][_0x4ab3('0x84')];})[_0x4ab3('0x24')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x48beda[_0x4ab3('0x45')]['id']},'include':[{'model':db[_0x4ab3('0x8b')],'as':_0x4ab3('0x8c'),'include':[{'model':db[_0x4ab3('0x7e')],'as':_0x4ab3('0x8d'),'where':_0x58388c,'limit':0x1,'order':[[_0x4ab3('0x8e'),_0x4ab3('0x8f')]]}]},{'model':db[_0x4ab3('0x90')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x526c3e,null))[_0x4ab3('0x24')](function(_0x19260d){if(_0x19260d&&_0x19260d[_0x4ab3('0x8c')]){_0x2b24d3[_0x4ab3('0x91')]=_0x19260d;_0x2b24d3[_0x4ab3('0x92')]=_0x19260d[_0x4ab3('0x93')];_0x2b24d3['list']=_0x19260d['List'];_0x2b24d3[_0x4ab3('0x92')]=_[_0x4ab3('0x94')](_0x2b24d3[_0x4ab3('0x92')],['priority'],[_0x4ab3('0x95')]);if(_0x2b24d3[_0x4ab3('0x91')][_0x4ab3('0x93')]){delete _0x2b24d3[_0x4ab3('0x91')][_0x4ab3('0x93')];}if(_0x2b24d3[_0x4ab3('0x91')]['List']&&_0x2b24d3['account'][_0x4ab3('0x8c')][_0x4ab3('0x8d')]['length']){return _0x2b24d3[_0x4ab3('0x91')]['List'][_0x4ab3('0x8d')][0x0];}var _0x56d085=_['defaults'](_0x48beda[_0x4ab3('0x4f')],{'firstName':_0x48beda[_0x4ab3('0x4f')][_0x4ab3('0x84')],'ListId':_0x19260d[_0x4ab3('0x83')]});_0x56d085[_0x48beda[_0x4ab3('0x4f')]['mapKey']]=_0x48beda[_0x4ab3('0x4f')]['from'];return db[_0x4ab3('0x7e')]['create'](_0x56d085,{'fields':_0x34b4f7,'raw':!![]});}})[_0x4ab3('0x24')](handleEntityNotFound(_0x526c3e,null))[_0x4ab3('0x24')](function(_0x8b6f91){_0x2b24d3[_0x4ab3('0x96')]=_0x8b6f91;var _0x59dd77=_0x48beda[_0x4ab3('0x4f')]['customerIp'];if(_0x48beda['headers'][_0x4ab3('0x97')]){_0x59dd77=_0x48beda[_0x4ab3('0x7a')][_0x4ab3('0x97')];}else if(_0x48beda[_0x4ab3('0x7a')]['x-forwarded-for']){_0x59dd77=_['first'](_0x48beda[_0x4ab3('0x7a')][_0x4ab3('0x98')]['split'](','));}if(_0x8b6f91){var _0x5dc0c6={'ContactId':_0x8b6f91['id'],'ChatWebsiteId':_0x48beda[_0x4ab3('0x45')]['id'],'from':(_0x8b6f91['firstName']||'')+'\x20'+(_0x8b6f91['lastName']||''),'customerIp':_0x59dd77,'customerPort':_0x48beda[_0x4ab3('0x7a')][_0x4ab3('0x99')]?_0x48beda[_0x4ab3('0x7a')][_0x4ab3('0x99')]:null,'referer':_0x48beda[_0x4ab3('0x4f')][_0x4ab3('0x9a')],'browserName':_0xf69f7d[_0x4ab3('0x9b')][_0x4ab3('0x2a')]&&_0xf69f7d['browser'][_0x4ab3('0x9c')]?util[_0x4ab3('0x9d')](_0x4ab3('0x9e'),_0xf69f7d[_0x4ab3('0x9b')][_0x4ab3('0x2a')],_0xf69f7d['browser'][_0x4ab3('0x9c')]):_0x4ab3('0x9f'),'browserVersion':_0xf69f7d['browser'][_0x4ab3('0x9c')]||'unknown','osName':util[_0x4ab3('0x9d')](_0x4ab3('0x9e'),_0xf69f7d['os'][_0x4ab3('0x2a')],_0xf69f7d['os'][_0x4ab3('0x9c')]),'osVersion':_0xf69f7d['os']['version'],'deviceModel':_0xf69f7d[_0x4ab3('0xa0')][_0x4ab3('0x32')]&&_0xf69f7d[_0x4ab3('0xa0')][_0x4ab3('0xa1')]?util['format'](_0x4ab3('0xa2'),_0xf69f7d[_0x4ab3('0xa0')][_0x4ab3('0x32')],_0xf69f7d[_0x4ab3('0xa0')][_0x4ab3('0xa1')],_0xf69f7d['device'][_0x4ab3('0x3c')]):null,'deviceVendor':_0xf69f7d[_0x4ab3('0xa0')][_0x4ab3('0xa1')],'deviceType':_0xf69f7d['device'][_0x4ab3('0x3c')],'formData':JSON[_0x4ab3('0xa3')](_0x48beda[_0x4ab3('0x4f')])};var _0x4ef300={'ChatWebsiteId':_0x48beda[_0x4ab3('0x45')]['id'],'closed':![]};if(_0x48beda[_0x4ab3('0x4f')][_0x4ab3('0xa4')]){_0x4ef300[_0x4ab3('0xa4')]=_0x48beda[_0x4ab3('0x4f')][_0x4ab3('0xa4')];return db[_0x4ab3('0xa5')][_0x4ab3('0x4c')]({'where':_0x4ef300})['then'](function(_0x14f9c1){if(_0x14f9c1){return[_0x14f9c1,![]];}_0x5dc0c6[_0x4ab3('0xa4')]=_0x48beda[_0x4ab3('0x4f')][_0x4ab3('0xa4')];_0x5dc0c6[_0x4ab3('0xa6')]=_0x48beda['body'][_0x4ab3('0xa6')];return db[_0x4ab3('0xa5')]['create'](_0x5dc0c6)[_0x4ab3('0x24')](function(_0x565186){return[_0x565186,!![]];});});}_0x4ef300[_0x4ab3('0xa7')]=_0x8b6f91['id'];if(_0x48beda[_0x4ab3('0x4f')][_0x4ab3('0xa8')]&&_0x48beda[_0x4ab3('0x4f')][_0x4ab3('0xa8')]['id']){_0x4ef300['id']=_0x48beda[_0x4ab3('0x4f')]['interaction']['id'];return db['ChatInteraction'][_0x4ab3('0x4c')]({'where':_0x4ef300})[_0x4ab3('0x24')](function(_0x39ed29){if(_0x39ed29){return[_0x39ed29,![]];}return db[_0x4ab3('0xa5')]['create'](_0x5dc0c6)[_0x4ab3('0x24')](function(_0x45e7a6){return[_0x45e7a6,!![]];});});}return db[_0x4ab3('0xa5')][_0x4ab3('0x48')](_0x5dc0c6)[_0x4ab3('0x24')](function(_0x36cf15){return[_0x36cf15,!![]];});}})[_0x4ab3('0xa9')](function(_0x50a857,_0x32c696){if(_0x50a857){_0xee4e45=_0x32c696;if(!_0x32c696){var _0x1e1e83={'from':(_0x2b24d3[_0x4ab3('0x96')][_0x4ab3('0xaa')]||'')+'\x20'+(_0x2b24d3[_0x4ab3('0x96')][_0x4ab3('0xab')]||'')};if(_0x48beda[_0x4ab3('0x4f')]['threadId']&&_0x48beda['body'][_0x4ab3('0xac')]&&_0x48beda['body']['threadId']!=_0x48beda[_0x4ab3('0x4f')][_0x4ab3('0xac')]){_0x1e1e83[_0x4ab3('0xa4')]=_0x48beda[_0x4ab3('0x4f')]['messageId'];}return _0x50a857[_0x4ab3('0x23')](_0x1e1e83);}else{return _0x50a857;}}})['then'](function(_0x3ffee5){_0x2b24d3[_0x4ab3('0xa8')]=_0x3ffee5[_0x4ab3('0x26')]({'plain':!![]});_0x2b24d3['interaction'][_0x4ab3('0xad')]=_0xee4e45;if(_0x2b24d3[_0x4ab3('0xa8')][_0x4ab3('0xad')]){if(_0x2b24d3['account'][_0x4ab3('0xae')]){_0x2b24d3['applications'][_0x4ab3('0xaf')]({'id':0x0,'priority':_0x2b24d3[_0x4ab3('0x92')][_0x4ab3('0x35')]+0x1,'app':_0x4ab3('0xb0'),'appdata':'unmanaged','interval':_0x4ab3('0xb1')});}}return db[_0x4ab3('0xb2')]['create']({'body':_0x48beda[_0x4ab3('0x4f')]['body'],'ChatWebsiteId':_0x48beda[_0x4ab3('0x45')]['id'],'ChatInteractionId':_0x3ffee5['id'],'direction':'in','ContactId':_0x2b24d3['contact']['id'],'AttachmentId':_0x48beda[_0x4ab3('0x4f')][_0x4ab3('0xb3')]});})[_0x4ab3('0x24')](function(_0x1a4fbe){_0x2b24d3[_0x4ab3('0x18')]=_0x1a4fbe;if(_0x2b24d3[_0x4ab3('0xa8')][_0x4ab3('0xb4')]){return db[_0x4ab3('0xb5')][_0x4ab3('0x4c')]({'attributes':['id',_0x4ab3('0x2a')],'where':{'id':_0x2b24d3[_0x4ab3('0xa8')]['UserId']}})[_0x4ab3('0x24')](function(_0xfb163b){if(_0xfb163b){_0x2b24d3['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x4ab3('0xb6'),'appdata':_0xfb163b[_0x4ab3('0x2a')]+','+(_0x2b24d3[_0x4ab3('0x91')][_0x4ab3('0xb7')]||0xa),'interval':_0x4ab3('0xb1')});_0x2b24d3[_0x4ab3('0xb8')]=!![];}return respondWithRpcPromise(_0x4ab3('0xb9'),'startRouting',_0x2b24d3);});}return respondWithRpcPromise('Start','startRouting',_0x2b24d3);})[_0x4ab3('0x24')](function(_0x460de7){respondWithRpcPromise(_0x4ab3('0xba'),'EventManager',{'event':_0x4ab3('0x78'),'message':_0x460de7},client9002);return _0x460de7;})[_0x4ab3('0x24')](respondWithResult(_0x526c3e,null))[_0x4ab3('0x1a')](handleError(_0x526c3e,null));};exports[_0x4ab3('0xbb')]=function(_0x57c382,_0xce9fdf){var _0x5bdb45,_0x128512,_0x4623b4;var _0x43b49a=[];var _0x2b666a={};var _0x7b7f16=_0x57c382['files']||[];var _0x398b53=[];var _0x3beff5;return db[_0x4ab3('0x7e')][_0x4ab3('0x51')]()[_0x4ab3('0x24')](function(_0xd721c5){if(!_0xd721c5){throw new db['Sequelize']['ValidationError'](_0x4ab3('0xbc'));}_0x43b49a=_[_0x4ab3('0x80')](_[_0x4ab3('0x46')](_0xd721c5),[_0x4ab3('0x81'),_0x4ab3('0x8e'),_0x4ab3('0x82'),_0x4ab3('0x83')]);if(_0x57c382[_0x4ab3('0x4f')]['id']){delete _0x57c382[_0x4ab3('0x4f')]['id'];}if(_[_0x4ab3('0x77')](_0x57c382[_0x4ab3('0x4f')][_0x4ab3('0x84')])){throw _0xce9fdf[_0x4ab3('0x1c')](0x1f4)[_0x4ab3('0x2b')](new db[(_0x4ab3('0x7f'))][(_0x4ab3('0x85'))](_0x4ab3('0x86')));}if(_['isNil'](_0x57c382[_0x4ab3('0x4f')][_0x4ab3('0x4f')])||_0x57c382[_0x4ab3('0x4f')][_0x4ab3('0x4f')]===''){throw _0xce9fdf[_0x4ab3('0x1c')](0x1f4)[_0x4ab3('0x2b')](new db['Sequelize'][(_0x4ab3('0x85'))](_0x4ab3('0xbd')));}if(_[_0x4ab3('0x77')](_0x57c382[_0x4ab3('0x4f')][_0x4ab3('0xbe')])){throw _0xce9fdf[_0x4ab3('0x1c')](0x1f4)[_0x4ab3('0x2b')](new db['Sequelize'][(_0x4ab3('0x85'))](_0x4ab3('0xbf')+_0x43b49a));}if(!_[_0x4ab3('0x89')](_0x43b49a,_0x57c382[_0x4ab3('0x4f')][_0x4ab3('0xbe')])){throw _0xce9fdf[_0x4ab3('0x1c')](0x1f4)['send'](new db[(_0x4ab3('0x7f'))][(_0x4ab3('0x85'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x43b49a));}_0x2b666a[_0x57c382['body']['mapKeyOffline']]=_0x57c382[_0x4ab3('0x4f')]['from'];})[_0x4ab3('0x24')](function(){return db[_0x4ab3('0x40')]['find']({'where':{'id':_0x57c382[_0x4ab3('0x45')]['id']},'include':[{'model':db[_0x4ab3('0x8b')],'as':_0x4ab3('0x8c')},{'model':db[_0x4ab3('0xc0')],'as':_0x4ab3('0xc0')}]});})[_0x4ab3('0x24')](handleEntityNotFound(_0xce9fdf,null))[_0x4ab3('0x24')](function(_0x2ca408){if(_0x2ca408&&_0x2ca408[_0x4ab3('0x8c')]){_0x128512=_0x2ca408;var _0x5883c7=_['defaults'](_0x57c382['body'],{'firstName':_0x57c382['body'][_0x4ab3('0x84')],'phone':_0x57c382[_0x4ab3('0x4f')]['from'],'ListId':_0x2ca408['ListId']});_0x5883c7[_0x57c382[_0x4ab3('0x4f')][_0x4ab3('0xbe')]]=_0x57c382[_0x4ab3('0x4f')]['from'];return db[_0x4ab3('0x7e')][_0x4ab3('0xc1')]({'where':_0x2b666a,'defaults':_0x5883c7});}})[_0x4ab3('0xa9')](function(_0x41cc8b){if(_0x41cc8b){_0x4623b4=_0x41cc8b;var _0x321c73=fs[_0x4ab3('0xc2')](path[_0x4ab3('0x6d')](config[_0x4ab3('0x68')],_0x4ab3('0xc3')),_0x4ab3('0xc4'));var _0x50a95f=ejs[_0x4ab3('0xc5')](_0x321c73,{'body':_[_0x4ab3('0xc6')](_0x57c382[_0x4ab3('0x4f')][_0x4ab3('0x4f')]),'bodyTitle':_0x128512[_0x4ab3('0xc7')]});return db[_0x4ab3('0xc8')][_0x4ab3('0x48')]({'body':_0x50a95f,'plainBody':htmlToText[_0x4ab3('0xc9')](_0x50a95f),'ContactId':_0x41cc8b['id'],'ChatWebsiteId':_0x128512['id']});}})['then'](function(_0x3a0b10){_0x3beff5=_0x3a0b10;if(_0x7b7f16[_0x4ab3('0x35')]){var _0x1cf2a0=_0x7b7f16[_0x4ab3('0x2d')](function(_0x4eca02){return{'name':_0x4eca02['originalname'],'basename':_0x4eca02[_0x4ab3('0x63')],'type':_0x4eca02[_0x4ab3('0xca')],'ChatOfflineMessageId':_0x3a0b10['id']};});_0x398b53=_0x1cf2a0[_0x4ab3('0x2d')](_0x4d24bc=>{var _0x130cad={'filename':_0x4d24bc[_0x4ab3('0x2a')],'path':path[_0x4ab3('0x6d')](config[_0x4ab3('0x68')],_0x4ab3('0xcb'),'files',_0x4ab3('0xcc'),_0x4ab3('0xcd'),_0x4d24bc['basename'])};return _0x130cad;});if(!_0x128512[_0x4ab3('0xce')]){return db['sequelize']['transaction'](function(_0x159753){return db[_0x4ab3('0xcf')][_0x4ab3('0xd0')](_0x1cf2a0,{'transaction':_0x159753});});}}})[_0x4ab3('0x24')](function(){if(_0x3beff5){_0x5bdb45=_0x3beff5;return db[_0x4ab3('0xc0')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x4ab3('0xd1')],'as':_0x4ab3('0xd2'),'raw':!![],'include':[{'model':db[_0x4ab3('0xd3')],'as':_0x4ab3('0xd3'),'raw':!![]}]}]});}})[_0x4ab3('0x24')](function(_0x50b99e){if(_0x50b99e&&_0x50b99e['Smtp']&&_0x128512[_0x4ab3('0xd4')]&&_0x128512['forwardOfflineAddress']){var _0x3f0ee4=_0x50b99e['getSmtpOptions']();return respondWithRpcPromise(_0x4ab3('0xd5'),'sendMail',{'account':_0x3f0ee4,'message':{'from':util[_0x4ab3('0x9d')](_0x4ab3('0xd6'),_0x50b99e[_0x4ab3('0x2a')],_0x50b99e[_0x4ab3('0xd7')]||_0x50b99e[_0x4ab3('0xd2')][_0x4ab3('0x49')]),'to':_0x128512[_0x4ab3('0xd8')],'subject':_0x128512['offlineMessageSubject'],'html':_0x5bdb45[_0x4ab3('0x4f')],'attachments':_0x398b53}},client9003)['then'](function(){return _0x5bdb45;})[_0x4ab3('0x1a')](function(_0x43cf8d){logger[_0x4ab3('0x16')](_0x43cf8d);});}})[_0x4ab3('0x24')](function(){if(_0x128512&&_0x128512[_0x4ab3('0xce')]&&_0x128512[_0x4ab3('0xd9')]){var _0x5173d8=[];if(_0x7b7f16[_0x4ab3('0x35')]){_0x5173d8=_0x7b7f16[_0x4ab3('0x2d')](function(_0x3b9124){return{'name':_0x3b9124[_0x4ab3('0xda')],'basename':_0x3b9124[_0x4ab3('0x63')],'type':_0x3b9124[_0x4ab3('0xca')],'ChatOfflineMessageId':_0x3beff5['id']};});}var _0x50fb24;if(!_[_0x4ab3('0x77')](_0x128512[_0x4ab3('0xdb')])){var _0x236bb6=_[_0x4ab3('0x2d')](_0x57c382[_0x4ab3('0x4f')],function(_0xb08463){return _0xb08463;});var _0xe6d1be=_['toPairsIn'](_0x236bb6)[0x0];var _0x2c1f61=_['mapValues'](_0xe6d1be,function(_0x4b7249){return _0x4b7249;});_0x50fb24=_0x2c1f61[0x1][_0x128512['subjectOffline']];}var _0x275bd7={'from':_0x4623b4[_0x4ab3('0xd7')],'firstName':_0x4623b4[_0x4ab3('0xaa')],'lastName':_0x4623b4[_0x4ab3('0xab')],'mapKey':_0x4ab3('0xd7'),'message':{'from':_0x4623b4[_0x4ab3('0xd7')],'to':_0x128512[_0x4ab3('0xc0')][_0x4ab3('0xd7')],'cc':'','subject':_[_0x4ab3('0x77')](_0x50fb24)?_0x128512[_0x4ab3('0xdc')]:_0x50fb24,'messageId':'','sentAt':new Date(),'attach':_0x5173d8['length'],'attachments':_0x5173d8,'originChannel':'Chat','ChatWebsiteId':_0x128512['id'],'ChatOfflineMessageId':_0x5bdb45['id'],'originTo':_0x128512[_0x4ab3('0xc0')][_0x4ab3('0xd7')]},'body':_0x5bdb45[_0x4ab3('0x4f')]};var _0x4fb591={'account':{'id':_0x128512['MailAccountId']},'body':_0x275bd7,'log':_0x4ab3('0xdd')};return respondWithRpcPromise(_0x4ab3('0xdd'),'notifyMail',_0x4fb591,client9001)['then'](function(){return _0x5bdb45;})[_0x4ab3('0x1a')](function(_0x314778){logger['error'](_0x314778);});}return;})['then'](function(){if(_0x5bdb45){return _0x5bdb45;}})['then'](respondWithResult(_0xce9fdf,null))['catch'](function(_0x339331){logger['error'](_0x4ab3('0x1a'),_0x339331);for(var _0x4bcd57 of _0x7b7f16){var _0x9c5dbb=path[_0x4ab3('0x6d')](config['root'],_0x4ab3('0xcb'),'files','attachments',_0x4ab3('0xcd'),_0x4bcd57[_0x4ab3('0x63')]);fs_extra[_0x4ab3('0xde')](_0x9c5dbb)[_0x4ab3('0x1a')](function(_0x9712db){logger[_0x4ab3('0x16')](_0x4ab3('0xdf'),_0x9c5dbb,_0x9712db);});}});};exports['addInteraction']=function(_0x57b8dd,_0x207d91){return db[_0x4ab3('0xa5')][_0x4ab3('0x4c')]({'where':{'id':_0x57b8dd[_0x4ab3('0x45')]['id']}})[_0x4ab3('0x24')](handleEntityNotFound(_0x207d91,null))['then'](function(_0x59ca70){if(_0x59ca70){return _0x59ca70['addInteraction'](_0x57b8dd[_0x4ab3('0x4f')][_0x4ab3('0x59')],_[_0x4ab3('0xe0')](_0x57b8dd['body'],['ids','id'])||{});}})[_0x4ab3('0x24')](respondWithResult(_0x207d91,null))[_0x4ab3('0x1a')](handleError(_0x207d91,null));};exports[_0x4ab3('0xe1')]=function(_0x367bcc,_0x1a32c6){var _0x481908={'raw':![],'where':{}};var _0x27d3bc={};var _0x33d214={'count':0x0,'rows':[]};return db[_0x4ab3('0x40')][_0x4ab3('0x56')]({'where':{'id':_0x367bcc['params']['id']}})[_0x4ab3('0x24')](handleEntityNotFound(_0x1a32c6,null))[_0x4ab3('0x24')](function(_0x46522b){if(_0x46522b){_0x27d3bc[_0x4ab3('0x32')]=_[_0x4ab3('0x46')](db[_0x4ab3('0xa5')][_0x4ab3('0x47')]);_0x27d3bc[_0x4ab3('0x2f')]=_[_0x4ab3('0x46')](_0x367bcc[_0x4ab3('0x2f')]);_0x27d3bc[_0x4ab3('0x30')]=_[_0x4ab3('0x31')](_0x27d3bc[_0x4ab3('0x32')],_0x27d3bc['query']);_0x481908[_0x4ab3('0x33')]=_[_0x4ab3('0x31')](_0x27d3bc['model'],qs['fields'](_0x367bcc['query']['fields']));_0x481908[_0x4ab3('0x33')]=_0x481908[_0x4ab3('0x33')][_0x4ab3('0x35')]?_0x481908[_0x4ab3('0x33')]:_0x27d3bc[_0x4ab3('0x32')];if(!_0x367bcc['query'][_0x4ab3('0x36')]('nolimit')){_0x481908[_0x4ab3('0x20')]=qs[_0x4ab3('0x20')](_0x367bcc['query'][_0x4ab3('0x20')]);_0x481908[_0x4ab3('0x1e')]=qs[_0x4ab3('0x1e')](_0x367bcc[_0x4ab3('0x2f')][_0x4ab3('0x1e')]);}_0x481908[_0x4ab3('0x38')]=qs[_0x4ab3('0x39')](_0x367bcc[_0x4ab3('0x2f')][_0x4ab3('0x39')]);_0x481908[_0x4ab3('0x3a')]=qs[_0x4ab3('0x30')](_['pick'](_0x367bcc['query'],_0x27d3bc[_0x4ab3('0x30')]));_0x481908[_0x4ab3('0x3a')]['ChatWebsiteId']=_0x46522b['id'];if(_0x367bcc[_0x4ab3('0x2f')][_0x4ab3('0x3b')]){_0x481908[_0x4ab3('0x3a')]=_[_0x4ab3('0x3e')](_0x481908[_0x4ab3('0x3a')],{'$or':_[_0x4ab3('0x2d')](_0x481908[_0x4ab3('0x33')],function(_0x24e4da){var _0x56b40e={};_0x56b40e[_0x24e4da]={'$like':'%'+_0x367bcc[_0x4ab3('0x2f')][_0x4ab3('0x3b')]+'%'};return _0x56b40e;})});}_0x481908=_[_0x4ab3('0x3e')]({},_0x481908,_0x367bcc[_0x4ab3('0x3f')]);return db[_0x4ab3('0xa5')][_0x4ab3('0x21')]({'where':_0x481908[_0x4ab3('0x3a')]})['then'](function(_0x5acf61){_0x33d214[_0x4ab3('0x21')]=_0x5acf61;if(_0x367bcc['query']['includeAll']){_0x481908[_0x4ab3('0x41')]=[{'model':db[_0x4ab3('0x7e')],'as':_0x4ab3('0xe2'),'required':![]},{'model':db['User'],'as':_0x4ab3('0xe3'),'attributes':[_0x4ab3('0x2a'),_0x4ab3('0xe4'),_0x4ab3('0xe5')],'required':![]},{'model':db[_0x4ab3('0xe6')],'as':_0x4ab3('0xe7'),'attributes':['id',_0x4ab3('0x2a'),_0x4ab3('0xe8')],'where':_0x367bcc[_0x4ab3('0x2f')][_0x4ab3('0xe9')]?{'id':_0x367bcc[_0x4ab3('0x2f')][_0x4ab3('0xe9')]}:undefined,'required':_0x367bcc[_0x4ab3('0x2f')][_0x4ab3('0xe9')]?!![]:![]}];}return db[_0x4ab3('0xa5')][_0x4ab3('0x42')](_0x481908);})['then'](function(_0x545a0c){_0x33d214[_0x4ab3('0x43')]=_0x545a0c;return _0x33d214;});}})[_0x4ab3('0x24')](respondWithFilteredResult(_0x1a32c6,_0x481908))[_0x4ab3('0x1a')](handleError(_0x1a32c6,null));};function iftimePromise(_0x23d569,_0x4114e2){return respondWithRpcPromise('Command',_0x4ab3('0xea'),{'command':_0x4114e2[_0x4ab3('0xeb')]?util[_0x4ab3('0x9d')]('iftime\x20%s,%s',_0x23d569[_0x4ab3('0xec')],_0x4114e2['timezone']):util['format'](_0x4ab3('0xed'),_0x23d569['interval'])},client9002)[_0x4ab3('0x24')](function(_0x51612e){var _0x2f0bda=_0x51612e&&_0x51612e[_0x4ab3('0xee')]('true')>=0x0?!![]:![];logger[_0x4ab3('0x19')](_0x4ab3('0xef'),_0x4114e2['id'],_0x23d569['id'],_0x23d569[_0x4ab3('0xec')],_0x2f0bda?'ONLINE':_0x4ab3('0xf0'),_0x4114e2[_0x4ab3('0xeb')]?_0x4114e2[_0x4ab3('0xeb')]:_0x4ab3('0xf1'));return _0x2f0bda;})[_0x4ab3('0x1a')](function(_0x3c4d60){logger[_0x4ab3('0x16')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x4114e2['id'],_0x23d569['id'],_0x23d569[_0x4ab3('0xec')],util[_0x4ab3('0xf2')](_0x3c4d60,{'showHidden':![],'depth':null}),_0x4114e2[_0x4ab3('0xeb')]?_0x4114e2[_0x4ab3('0xeb')]:_0x4ab3('0xf1'));return![];});}exports['getSnippet']=function(_0x406403,_0x3542c6){var _0x53027b=0x0;var _0x121d72=0x0;var _0x1c6a7f=![];var _0x3c752f;var _0x300b3c;return db[_0x4ab3('0x40')][_0x4ab3('0x4c')]({'where':{'id':_0x406403[_0x4ab3('0x45')]['id']},'include':[{'model':db['Interval'],'as':_0x4ab3('0xf3'),'include':[{'model':db[_0x4ab3('0xf3')],'as':_0x4ab3('0xf4'),'attributes':['id',_0x4ab3('0xec')],'raw':!![]}]}]})[_0x4ab3('0x24')](handleEntityNotFound(_0x3542c6,null))[_0x4ab3('0x24')](function(_0x222384){if(_0x222384){_0x3c752f=_0x222384;return _0x222384[_0x4ab3('0xf5')]({'raw':!![]});}})[_0x4ab3('0x24')](function(_0x4333cc){if(_0x3c752f){if(_0x4333cc){_0x300b3c=_0x4333cc;}}return require('../../config/license/util')[_0x4ab3('0x6b')]();})[_0x4ab3('0x24')](function(_0x72e7b0){if(_0x72e7b0){_0x121d72=_0x72e7b0[_0x4ab3('0xf6')];_0x1c6a7f=_0x72e7b0[_0x4ab3('0x6c')];}})[_0x4ab3('0x24')](function(){return db[_0x4ab3('0xa5')]['count']({'where':{'closed':![]}});})[_0x4ab3('0x24')](function(_0x36542a){_0x53027b=_0x36542a;if(_0x121d72&&_0x36542a>_0x121d72){return db[_0x4ab3('0xf7')]['findOne']({'where':{'id':0x1}})['then'](function(_0x2e940a){if(_0x2e940a){_0x2e940a[_0x4ab3('0xf8')](_0x4ab3('0xf9'));}});}})[_0x4ab3('0x24')](function(){if(_0x3c752f['Interval']&&_0x3c752f['Interval']['Intervals']){var _0x894ac1=[];for(var _0x2e276e=0x0;_0x2e276e<_0x3c752f[_0x4ab3('0xf3')][_0x4ab3('0xf4')]['length'];_0x2e276e++){var _0x4346fa=_0x3c752f[_0x4ab3('0xf3')][_0x4ab3('0xf4')][_0x2e276e][_0x4ab3('0x26')]({'plain':!![]});_0x894ac1[_0x4ab3('0xaf')](iftimePromise(_0x4346fa,_0x3c752f));}return BPromise[_0x4ab3('0xfa')](_0x894ac1)[_0x4ab3('0x24')](function(_0x38f49e){return _[_0x4ab3('0xfb')](_0x38f49e);});}else{return!![];}})['then'](function(_0x31c70b){var _0x20a636=fs['readFileSync'](path[_0x4ab3('0x6d')](config[_0x4ab3('0x68')],_0x4ab3('0xfc')),'utf8');var _0x485528={'remote':_0x3c752f['remote'],'query':querystring[_0x4ab3('0xa3')](_['merge'](_0x3c752f[_0x4ab3('0x26')]({'plain':!![]}),{'customerIp':_0x406403['headers'][_0x4ab3('0x98')]||_0x406403[_0x4ab3('0x7a')][_0x4ab3('0xfd')]||_0x406403['connection']['remoteAddress']||_0x406403['ip'],'referer':_0x406403['headers'][_0x4ab3('0x9a')],'openedInteractions':_0x53027b,'maxInteractions':_0x121d72,'virtual':_0x1c6a7f[_0x4ab3('0xf6')],'online':_0x31c70b,'custom':_0x1c6a7f}))[_0x4ab3('0xfe')](/'/g,'\x5c\x27')};_0x3542c6['send'](ejs['render'](Mustache[_0x4ab3('0xc5')](_0x20a636,_0x485528),{'proactiveActions':_0x300b3c,'alignment':_0x3c752f[_0x4ab3('0xff')],'verticalAlignment':_0x3c752f[_0x4ab3('0x100')],'div_color':_0x3c752f[_0x4ab3('0xe8')],'labelText':_0x3c752f['labelText'],'text_color':_0x3c752f[_0x4ab3('0x101')],'text_button_color':_0x3c752f[_0x4ab3('0x102')],'button_color':_0x3c752f[_0x4ab3('0x103')],'background_color':_0x3c752f['backgroundColor'],'hideWhenOffline':_0x3c752f[_0x4ab3('0x104')],'interval':_0x3c752f[_0x4ab3('0x105')]}));})['catch'](handleError(_0x3542c6,null));};exports[_0x4ab3('0x106')]=function(_0x1aa0b6,_0x26a57e){var _0x1b9437=_0x1aa0b6['params']['id'];var _0x224b85=_0x1aa0b6['body'];var _0x49a458=0xc8;var _0x39c9a8=null;return db[_0x4ab3('0x107')][_0x4ab3('0x108')]({'isolationLevel':db[_0x4ab3('0x107')][_0x4ab3('0x109')][_0x4ab3('0x10a')]['READ_COMMITTED']},function(_0xe416ab){return db['ChatWebsite'][_0x4ab3('0x56')]({'where':{'id':_0x1b9437},'transaction':_0xe416ab})['then'](function(_0x4b4b49){if(_0x4b4b49){return db[_0x4ab3('0x90')]['destroy']({'where':{'ChatWebsiteId':_0x1b9437},'transaction':_0xe416ab})[_0x4ab3('0x24')](function(){var _0x293a0d=_['map'](_0x224b85,function(_0x4d08db){_0x4d08db['ChatWebsiteId']=_0x1b9437;return _0x4d08db;});return db[_0x4ab3('0x90')][_0x4ab3('0xd0')](_0x293a0d,{'transaction':_0xe416ab});});}else{_0x49a458=0x194;_0x39c9a8=[];}});})['then'](function(){if(_0x49a458!==0x194){return db['ChatApplication'][_0x4ab3('0x10b')]({'where':{'ChatWebsiteId':_0x1b9437},'order':_0x4ab3('0x10c')})[_0x4ab3('0x24')](function(_0x1f1d20){_0x39c9a8=_0x1f1d20;});}})[_0x4ab3('0x1a')](function(_0x2ba93d){_0x49a458=0x1f4;logger[_0x4ab3('0x16')](_0x2ba93d['stack']);if(_0x2ba93d[_0x4ab3('0x2a')]){delete _0x2ba93d[_0x4ab3('0x2a')];}_0x39c9a8=_0x2ba93d;})[_0x4ab3('0x10d')](function(){if(_0x39c9a8===null){_0x26a57e['sendStatus'](_0x49a458);}else{if(_0x49a458===0x1f4){_0x26a57e['status'](_0x49a458)[_0x4ab3('0x2b')](_0x39c9a8);}else{_0x26a57e[_0x4ab3('0x1c')](_0x49a458)['json'](_0x39c9a8);}}});};exports[_0x4ab3('0x10e')]=function(_0x51c9db,_0x47638b){var _0x8082b9={};var _0x492198={};var _0x100f37;var _0x3ac841;return db['ChatWebsite']['findOne']({'where':{'id':_0x51c9db['params']['id']}})[_0x4ab3('0x24')](handleEntityNotFound(_0x47638b,null))[_0x4ab3('0x24')](function(_0x4aa220){if(_0x4aa220){_0x100f37=_0x4aa220;_0x492198[_0x4ab3('0x32')]=_[_0x4ab3('0x46')](db[_0x4ab3('0x90')][_0x4ab3('0x47')]);_0x492198[_0x4ab3('0x2f')]=_[_0x4ab3('0x46')](_0x51c9db['query']);_0x492198[_0x4ab3('0x30')]=_[_0x4ab3('0x31')](_0x492198[_0x4ab3('0x32')],_0x492198[_0x4ab3('0x2f')]);_0x8082b9['attributes']=_[_0x4ab3('0x31')](_0x492198['model'],qs['fields'](_0x51c9db['query']['fields']));_0x8082b9['attributes']=_0x8082b9[_0x4ab3('0x33')][_0x4ab3('0x35')]?_0x8082b9['attributes']:_0x492198[_0x4ab3('0x32')];_0x8082b9['order']=qs[_0x4ab3('0x39')](_0x51c9db[_0x4ab3('0x2f')][_0x4ab3('0x39')]);_0x8082b9[_0x4ab3('0x3a')]=qs[_0x4ab3('0x30')](_[_0x4ab3('0x5c')](_0x51c9db[_0x4ab3('0x2f')],_0x492198[_0x4ab3('0x30')]));if(_0x51c9db[_0x4ab3('0x2f')]['filter']){_0x8082b9[_0x4ab3('0x3a')]=_[_0x4ab3('0x3e')](_0x8082b9[_0x4ab3('0x3a')],{'$or':_[_0x4ab3('0x2d')](_0x8082b9['attributes'],function(_0x388d3c){var _0x5de0e3={};_0x5de0e3[_0x388d3c]={'$like':'%'+_0x51c9db[_0x4ab3('0x2f')]['filter']+'%'};return _0x5de0e3;})});}_0x8082b9=_['merge']({},_0x8082b9,_0x51c9db[_0x4ab3('0x3f')]);return _0x100f37[_0x4ab3('0x10e')](_0x8082b9);}})[_0x4ab3('0x24')](function(_0x8ec110){if(_0x8ec110){_0x3ac841=_0x8ec110[_0x4ab3('0x35')];if(!_0x51c9db['query'][_0x4ab3('0x36')](_0x4ab3('0x37'))){_0x8082b9[_0x4ab3('0x20')]=qs[_0x4ab3('0x20')](_0x51c9db[_0x4ab3('0x2f')][_0x4ab3('0x20')]);_0x8082b9[_0x4ab3('0x1e')]=qs[_0x4ab3('0x1e')](_0x51c9db[_0x4ab3('0x2f')][_0x4ab3('0x1e')]);}return _0x100f37['getApplications'](_0x8082b9);}})[_0x4ab3('0x24')](function(_0x8d750d){if(_0x8d750d){return _0x8d750d?{'count':_0x3ac841,'rows':_0x8d750d}:null;}})[_0x4ab3('0x24')](respondWithResult(_0x47638b,null))[_0x4ab3('0x1a')](handleError(_0x47638b,null));};exports[_0x4ab3('0x10f')]=function(_0x3ec8c8,_0x389909){return db['chatProactiveAction'][_0x4ab3('0x4c')]({'where':{'id':_0x3ec8c8[_0x4ab3('0x45')]['id']}})[_0x4ab3('0x24')](handleEntityNotFound(_0x389909,null))[_0x4ab3('0x24')](function(_0x374029){if(_0x374029){return _0x374029[_0x4ab3('0x10f')](_0x3ec8c8[_0x4ab3('0x4f')][_0x4ab3('0x59')],_[_0x4ab3('0xe0')](_0x3ec8c8[_0x4ab3('0x4f')],['ids','id'])||{});}})[_0x4ab3('0x24')](respondWithResult(_0x389909,null))[_0x4ab3('0x1a')](handleError(_0x389909,null));};exports['getProactiveActions']=function(_0x30a999,_0x567161){var _0x554a5e={};var _0x446ea2={};var _0x1d5c92;var _0x41d7fd;return db[_0x4ab3('0x40')][_0x4ab3('0x56')]({'where':{'id':_0x30a999[_0x4ab3('0x45')]['id']}})[_0x4ab3('0x24')](handleEntityNotFound(_0x567161,null))['then'](function(_0x3db9d9){if(_0x3db9d9){_0x1d5c92=_0x3db9d9;_0x446ea2[_0x4ab3('0x32')]=_['keys'](db[_0x4ab3('0x110')]['rawAttributes']);_0x446ea2[_0x4ab3('0x2f')]=_['keys'](_0x30a999['query']);_0x446ea2['filters']=_[_0x4ab3('0x31')](_0x446ea2[_0x4ab3('0x32')],_0x446ea2[_0x4ab3('0x2f')]);_0x554a5e[_0x4ab3('0x33')]=_[_0x4ab3('0x31')](_0x446ea2[_0x4ab3('0x32')],qs[_0x4ab3('0x34')](_0x30a999[_0x4ab3('0x2f')][_0x4ab3('0x34')]));_0x554a5e[_0x4ab3('0x33')]=_0x554a5e[_0x4ab3('0x33')][_0x4ab3('0x35')]?_0x554a5e['attributes']:_0x446ea2['model'];_0x554a5e['order']=qs[_0x4ab3('0x39')](_0x30a999['query']['sort']);_0x554a5e[_0x4ab3('0x3a')]=qs['filters'](_[_0x4ab3('0x5c')](_0x30a999['query'],_0x446ea2['filters']));if(_0x30a999[_0x4ab3('0x2f')]['filter']){_0x554a5e[_0x4ab3('0x3a')]=_['merge'](_0x554a5e[_0x4ab3('0x3a')],{'$or':_['map'](_0x554a5e[_0x4ab3('0x33')],function(_0x2ef9ee){var _0x35f80f={};_0x35f80f[_0x2ef9ee]={'$like':'%'+_0x30a999['query'][_0x4ab3('0x3b')]+'%'};return _0x35f80f;})});}_0x554a5e=_[_0x4ab3('0x3e')]({},_0x554a5e,_0x30a999[_0x4ab3('0x3f')]);return _0x1d5c92['getProactiveActions'](_0x554a5e);}})['then'](function(_0x20a387){if(_0x20a387){_0x41d7fd=_0x20a387[_0x4ab3('0x35')];if(!_0x30a999[_0x4ab3('0x2f')]['hasOwnProperty'](_0x4ab3('0x37'))){_0x554a5e[_0x4ab3('0x20')]=qs[_0x4ab3('0x20')](_0x30a999[_0x4ab3('0x2f')][_0x4ab3('0x20')]);_0x554a5e[_0x4ab3('0x1e')]=qs[_0x4ab3('0x1e')](_0x30a999['query'][_0x4ab3('0x1e')]);}return _0x1d5c92[_0x4ab3('0xf5')](_0x554a5e);}})[_0x4ab3('0x24')](function(_0x24e01a){if(_0x24e01a){return _0x24e01a?{'count':_0x41d7fd,'rows':_0x24e01a}:null;}})[_0x4ab3('0x24')](respondWithResult(_0x567161,null))[_0x4ab3('0x1a')](handleError(_0x567161,null));};exports[_0x4ab3('0x111')]=function(_0x382a65,_0x232198){var _0x1bfd27=_0x382a65[_0x4ab3('0x2f')][_0x4ab3('0x112')]===_0x4ab3('0x113')?_0x4ab3('0x114'):_0x4ab3('0x115');return db[_0x4ab3('0x40')][_0x4ab3('0x4c')]({'attributes':['id',_0x1bfd27],'where':{'id':_0x382a65[_0x4ab3('0x45')]['id']}})[_0x4ab3('0x24')](handleEntityNotFound(_0x232198,null))[_0x4ab3('0x24')](function(_0x51ec8a){if(_0x51ec8a){var _0x5ad9dd=_0x51ec8a[_0x1bfd27];var _0x45e5aa=_0x5ad9dd&&_0x5ad9dd['items']?_0x5ad9dd['items']:[];_0x232198[_0x4ab3('0x2b')]({'fromKey':_[_0x4ab3('0x77')](_0x5ad9dd[_0x4ab3('0x116')])?undefined:_0x5ad9dd['fromKey'],'count':_0x45e5aa['length'],'rows':_0x45e5aa});}})['catch'](handleError(_0x232198,null));};exports[_0x4ab3('0x117')]=function(_0x582d11,_0x5d7002){var _0x257197={'raw':![],'where':{}};var _0x1ac0e1={};var _0x114c4={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x4ab3('0x56')]({'where':{'id':_0x582d11[_0x4ab3('0x45')]['id']}})[_0x4ab3('0x24')](handleEntityNotFound(_0x5d7002,null))[_0x4ab3('0x24')](function(_0x53d9c3){if(_0x53d9c3){_0x1ac0e1['model']=_[_0x4ab3('0x46')](db[_0x4ab3('0xc8')][_0x4ab3('0x47')]);_0x1ac0e1['query']=_[_0x4ab3('0x46')](_0x582d11[_0x4ab3('0x2f')]);_0x1ac0e1[_0x4ab3('0x30')]=_[_0x4ab3('0x31')](_0x1ac0e1[_0x4ab3('0x32')],_0x1ac0e1[_0x4ab3('0x2f')]);_0x257197['attributes']=_[_0x4ab3('0x31')](_0x1ac0e1[_0x4ab3('0x32')],qs[_0x4ab3('0x34')](_0x582d11[_0x4ab3('0x2f')][_0x4ab3('0x34')]));_0x257197['attributes']=_0x257197['attributes'][_0x4ab3('0x35')]?_0x257197['attributes']:_0x1ac0e1['model'];if(!_0x582d11[_0x4ab3('0x2f')]['hasOwnProperty'](_0x4ab3('0x37'))){_0x257197[_0x4ab3('0x20')]=qs[_0x4ab3('0x20')](_0x582d11[_0x4ab3('0x2f')][_0x4ab3('0x20')]);_0x257197[_0x4ab3('0x1e')]=qs['offset'](_0x582d11[_0x4ab3('0x2f')][_0x4ab3('0x1e')]);}_0x257197[_0x4ab3('0x38')]=qs['sort'](_0x582d11[_0x4ab3('0x2f')][_0x4ab3('0x39')]);_0x257197[_0x4ab3('0x3a')]=qs[_0x4ab3('0x30')](_[_0x4ab3('0x5c')](_0x582d11[_0x4ab3('0x2f')],_0x1ac0e1['filters']));_0x257197[_0x4ab3('0x3a')][_0x4ab3('0x53')]=_0x53d9c3['id'];if(_0x582d11['query'][_0x4ab3('0x3b')]){_0x257197[_0x4ab3('0x3a')]=_[_0x4ab3('0x3e')](_0x257197[_0x4ab3('0x3a')],{'$or':_['map'](_0x257197[_0x4ab3('0x33')],function(_0x42db7a){var _0x27fb70={};_0x27fb70[_0x42db7a]={'$like':'%'+_0x582d11['query'][_0x4ab3('0x3b')]+'%'};return _0x27fb70;})});}_0x257197=_['merge']({},_0x257197,_0x582d11[_0x4ab3('0x3f')]);return db[_0x4ab3('0xc8')][_0x4ab3('0x21')]({'where':_0x257197[_0x4ab3('0x3a')]})[_0x4ab3('0x24')](function(_0x5b91e2){_0x114c4[_0x4ab3('0x21')]=_0x5b91e2;if(_0x582d11[_0x4ab3('0x2f')]['includeAll']){_0x257197[_0x4ab3('0x41')]=[{'all':!![]}];}else{_0x257197[_0x4ab3('0x41')]=[{'model':db[_0x4ab3('0x7e')],'as':_0x4ab3('0xe2'),'required':![]},{'model':db[_0x4ab3('0xcf')],'as':_0x4ab3('0x118'),'required':![]}];}return db[_0x4ab3('0xc8')][_0x4ab3('0x42')](_0x257197);})[_0x4ab3('0x24')](function(_0x6f2016){_0x114c4[_0x4ab3('0x43')]=_0x6f2016;return _0x114c4;});}})[_0x4ab3('0x24')](respondWithFilteredResult(_0x5d7002,_0x257197))[_0x4ab3('0x1a')](handleError(_0x5d7002,null));};exports[_0x4ab3('0x119')]=function(_0x2e4780,_0x24a10e){return db[_0x4ab3('0x40')][_0x4ab3('0x4c')]({'where':{'id':_0x2e4780[_0x4ab3('0x45')]['id']}})['then'](handleEntityNotFound(_0x24a10e,null))[_0x4ab3('0x24')](function(_0x42d5e8){if(_0x42d5e8){return _0x42d5e8[_0x4ab3('0x119')](_0x2e4780['body'][_0x4ab3('0x59')],_[_0x4ab3('0xe0')](_0x2e4780[_0x4ab3('0x4f')],[_0x4ab3('0x59'),'id'])||{})[_0x4ab3('0xa9')](function(_0x4f0d5f){for(var _0x3e671e=0x0;_0x3e671e<_0x2e4780[_0x4ab3('0x4f')][_0x4ab3('0x59')][_0x4ab3('0x35')];_0x3e671e+=0x1){socket['emit'](_0x4ab3('0x11a'),{'UserId':Number(_0x2e4780['body']['ids'][_0x3e671e]),'ChatWebsiteId':Number(_0x2e4780[_0x4ab3('0x45')]['id'])});}return _0x4f0d5f;});}})[_0x4ab3('0x24')](respondWithResult(_0x24a10e,null))[_0x4ab3('0x1a')](handleError(_0x24a10e,null));};exports[_0x4ab3('0x11b')]=function(_0x4463e6,_0x478d54){return db[_0x4ab3('0x40')][_0x4ab3('0x4c')]({'where':{'id':_0x4463e6[_0x4ab3('0x45')]['id']}})[_0x4ab3('0x24')](handleEntityNotFound(_0x478d54,null))['then'](function(_0x45f047){if(_0x45f047){return _0x45f047['removeAgents'](_0x4463e6['query'][_0x4ab3('0x59')])[_0x4ab3('0x24')](function(){if(_[_0x4ab3('0x11c')](_0x4463e6[_0x4ab3('0x2f')][_0x4ab3('0x59')])){for(var _0x41a1dd=0x0;_0x41a1dd<_0x4463e6[_0x4ab3('0x2f')]['ids'][_0x4ab3('0x35')];_0x41a1dd+=0x1){socket[_0x4ab3('0x11d')](_0x4ab3('0x11e'),{'UserId':Number(_0x4463e6['query'][_0x4ab3('0x59')][_0x41a1dd]),'ChatWebsiteId':Number(_0x4463e6[_0x4ab3('0x45')]['id'])});}}else{socket[_0x4ab3('0x11d')](_0x4ab3('0x11e'),{'UserId':Number(_0x4463e6['query'][_0x4ab3('0x59')]),'ChatWebsiteId':Number(_0x4463e6[_0x4ab3('0x45')]['id'])});}});}})[_0x4ab3('0x24')](respondWithStatusCode(_0x478d54,null))[_0x4ab3('0x1a')](handleError(_0x478d54,null));};exports[_0x4ab3('0x11f')]=function(_0x5f5047,_0x80484b){var _0x3d80c8={};var _0xfbe57b={};var _0x20e098;var _0x16949b;return db['ChatWebsite'][_0x4ab3('0x56')]({'where':{'id':_0x5f5047[_0x4ab3('0x45')]['id']}})[_0x4ab3('0x24')](handleEntityNotFound(_0x80484b,null))[_0x4ab3('0x24')](function(_0x3a597a){if(_0x3a597a){_0x20e098=_0x3a597a;_0xfbe57b[_0x4ab3('0x32')]=_[_0x4ab3('0x46')](db[_0x4ab3('0xb5')][_0x4ab3('0x47')]);_0xfbe57b['query']=_[_0x4ab3('0x46')](_0x5f5047[_0x4ab3('0x2f')]);_0xfbe57b[_0x4ab3('0x30')]=_[_0x4ab3('0x31')](_0xfbe57b[_0x4ab3('0x32')],_0xfbe57b[_0x4ab3('0x2f')]);_0x3d80c8[_0x4ab3('0x33')]=_['intersection'](_0xfbe57b[_0x4ab3('0x32')],qs['fields'](_0x5f5047[_0x4ab3('0x2f')][_0x4ab3('0x34')]));_0x3d80c8['attributes']=_0x3d80c8[_0x4ab3('0x33')][_0x4ab3('0x35')]?_0x3d80c8[_0x4ab3('0x33')]:_0xfbe57b[_0x4ab3('0x32')];_0x3d80c8[_0x4ab3('0x38')]=qs['sort'](_0x5f5047[_0x4ab3('0x2f')][_0x4ab3('0x39')]);_0x3d80c8[_0x4ab3('0x3a')]=qs[_0x4ab3('0x30')](_[_0x4ab3('0x5c')](_0x5f5047[_0x4ab3('0x2f')],_0xfbe57b[_0x4ab3('0x30')]));if(_0x5f5047[_0x4ab3('0x2f')][_0x4ab3('0x3b')]){_0x3d80c8[_0x4ab3('0x3a')]=_[_0x4ab3('0x3e')](_0x3d80c8[_0x4ab3('0x3a')],{'$or':_[_0x4ab3('0x2d')](_0x3d80c8[_0x4ab3('0x33')],function(_0x29cda7){var _0xc64a24={};_0xc64a24[_0x29cda7]={'$like':'%'+_0x5f5047['query'][_0x4ab3('0x3b')]+'%'};return _0xc64a24;})});}_0x3d80c8=_[_0x4ab3('0x3e')]({},_0x3d80c8,_0x5f5047['options']);return _0x20e098[_0x4ab3('0x11f')](_0x3d80c8);}})['then'](function(_0x55bb8e){if(_0x55bb8e){_0x16949b=_0x55bb8e[_0x4ab3('0x35')];if(!_0x5f5047[_0x4ab3('0x2f')]['hasOwnProperty']('nolimit')){_0x3d80c8[_0x4ab3('0x20')]=qs[_0x4ab3('0x20')](_0x5f5047[_0x4ab3('0x2f')][_0x4ab3('0x20')]);_0x3d80c8[_0x4ab3('0x1e')]=qs[_0x4ab3('0x1e')](_0x5f5047[_0x4ab3('0x2f')][_0x4ab3('0x1e')]);}return _0x20e098[_0x4ab3('0x11f')](_0x3d80c8);}})['then'](function(_0x444b41){if(_0x444b41){return _0x444b41?{'count':_0x16949b,'rows':_0x444b41}:null;}})[_0x4ab3('0x24')](respondWithResult(_0x80484b,null))[_0x4ab3('0x1a')](handleError(_0x80484b,null));}; \ No newline at end of file +var _0xd5b7=['UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','findOne','hasOwnProperty','ChatWebsiteId','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','addLogo','sitepic','file','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','existsSync','server/files/images/logos/','download','root','server/files/images/avatars/default_avatar.png','agentAvatar','isNil','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','notify','setUA','headers','user-agent','getResult','chat','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','Sequelize','ValidationError','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','list','applications','orderBy','priority','CmContact','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','interaction','spread','messageId','created','autoclose','push','close','unmanaged','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','files','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','fromString','originalname','mimetype','server','basename','openNewInteraction','Attachment','bulkCreate','CloudProvider','Smtp','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','forwardOfflineAddress','MailAccountId','subjectOffline','mapValues','email','Chat','NotifyMailAccount','notifyMail','attachments','remove','addInteraction','getInteractions','Owner','fullname','internal','Tags','color','tag','Command','getSnippet','timezone','interval','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','virtual','License','increment','chatLicenseExceeded','some','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textColor','textButtonColor','backgroundColor','hideWhenOffline','IntervalId','sequelize','transaction','Transaction','ISOLATION_LEVELS','findAndCountAll','finally','getApplications','addProactiveActions','omit','getProactiveActions','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','removeAgents','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','ChatWebsite,\x20%s,\x20%s','message','sendStatus','status','end','json','offset','undefined','limit','count','update','then','get','ChatWebsites','UserProfileResource','destroy','stack','name','send','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','params','Pause','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xd5b7,0x1f2));var _0x7d5b=function(_0x242a4f,_0x369c57){_0x242a4f=_0x242a4f-0x0;var _0x122117=_0xd5b7[_0x242a4f];return _0x122117;};'use strict';var BPromise=require(_0x7d5b('0x0'));var Mustache=require(_0x7d5b('0x1'));var util=require(_0x7d5b('0x2'));var path=require(_0x7d5b('0x3'));var ejs=require(_0x7d5b('0x4'));var fs=require('fs');var fs_extra=require(_0x7d5b('0x5'));var _=require(_0x7d5b('0x6'));var querystring=require(_0x7d5b('0x7'));var Redis=require(_0x7d5b('0x8'));var qs=require(_0x7d5b('0x9'));var logger=require(_0x7d5b('0xa'))(_0x7d5b('0xb'));var config=require(_0x7d5b('0xc'));var db=require(_0x7d5b('0xd'))['db'];config['redis']=_[_0x7d5b('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7d5b('0xf'))(new Redis(config['redis']));require(_0x7d5b('0x10'))[_0x7d5b('0x11')](socket);var htmlToText=require(_0x7d5b('0x12'));var jayson=require(_0x7d5b('0x13'));var client=jayson[_0x7d5b('0x14')][_0x7d5b('0x15')]({'port':0x232c});var client9002=jayson[_0x7d5b('0x14')][_0x7d5b('0x15')]({'port':0x232a});var client9003=jayson[_0x7d5b('0x14')][_0x7d5b('0x15')]({'port':0x232b});var client9001=jayson[_0x7d5b('0x14')][_0x7d5b('0x15')]({'port':0x2329});function respondWithRpcPromise(_0x1465b3,_0x1172f5,_0xc19d79,_0x52d30c){return new BPromise(function(_0x5c6246,_0x1dfd41){var _0x43253a=_0x52d30c||client;return _0x43253a[_0x7d5b('0x16')](_0x1465b3,_0xc19d79)['then'](function(_0x1c4513){logger[_0x7d5b('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x1172f5,_0x7d5b('0x18'));logger[_0x7d5b('0x19')](_0x7d5b('0x1a'),_0x1172f5,_0x7d5b('0x18'),JSON[_0x7d5b('0x1b')](_0x1c4513));if(_0x1c4513[_0x7d5b('0x1c')]){if(_0x1c4513[_0x7d5b('0x1c')]['code']===0x1f4){logger['error'](_0x7d5b('0x1d'),_0x1172f5,_0x1c4513[_0x7d5b('0x1c')]['message']);return _0x1dfd41(_0x1c4513[_0x7d5b('0x1c')][_0x7d5b('0x1e')]);}logger[_0x7d5b('0x1c')](_0x7d5b('0x1d'),_0x1172f5,_0x1c4513['error'][_0x7d5b('0x1e')]);return _0x5c6246(_0x1c4513[_0x7d5b('0x1c')][_0x7d5b('0x1e')]);}else{logger['info'](_0x7d5b('0x1d'),_0x1172f5,'request\x20sent');_0x5c6246(_0x1c4513['result'][_0x7d5b('0x1e')]);}})['catch'](function(_0x43741d){logger[_0x7d5b('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x1172f5,_0x43741d);_0x1dfd41(_0x43741d);});});}function respondWithStatusCode(_0x5978ce,_0x1addb0){_0x1addb0=_0x1addb0||0xcc;return function(_0x4176d0){if(_0x4176d0){return _0x5978ce[_0x7d5b('0x1f')](_0x1addb0);}return _0x5978ce[_0x7d5b('0x20')](_0x1addb0)[_0x7d5b('0x21')]();};}function respondWithResult(_0x341044,_0x41097f){_0x41097f=_0x41097f||0xc8;return function(_0x2983f4){if(_0x2983f4){return _0x341044[_0x7d5b('0x20')](_0x41097f)[_0x7d5b('0x22')](_0x2983f4);}};}function respondWithFilteredResult(_0x152ee6,_0x187d34){return function(_0x1090df){if(_0x1090df){var _0x16724c=typeof _0x187d34[_0x7d5b('0x23')]===_0x7d5b('0x24')&&typeof _0x187d34[_0x7d5b('0x25')]===_0x7d5b('0x24');var _0x56b839=_0x1090df[_0x7d5b('0x26')];var _0x19c072=_0x16724c?0x0:_0x187d34['offset'];var _0xeef78c=_0x16724c?_0x1090df[_0x7d5b('0x26')]:_0x187d34[_0x7d5b('0x23')]+_0x187d34[_0x7d5b('0x25')];var _0x4e78d4;if(_0xeef78c>=_0x56b839){_0xeef78c=_0x56b839;_0x4e78d4=0xc8;}else{_0x4e78d4=0xce;}_0x152ee6[_0x7d5b('0x20')](_0x4e78d4);return _0x152ee6['set']('Content-Range',_0x19c072+'-'+_0xeef78c+'/'+_0x56b839)['json'](_0x1090df);}return null;};}function saveUpdates(_0x27fe27){return function(_0x125c67){if(_0x125c67){return _0x125c67[_0x7d5b('0x27')](_0x27fe27)[_0x7d5b('0x28')](function(_0x27a367){return _0x27a367;});}return null;};}function removeEntity(_0x20aeb9){return function(_0x49dd33){if(_0x49dd33){return _0x49dd33['destroy']()['then'](function(){var _0x31e5a2=_0x49dd33[_0x7d5b('0x29')]({'plain':!![]});var _0x184422=_0x7d5b('0x2a');return db[_0x7d5b('0x2b')][_0x7d5b('0x2c')]({'where':{'type':_0x184422,'resourceId':_0x31e5a2['id']}})[_0x7d5b('0x28')](function(){return _0x49dd33;});})[_0x7d5b('0x28')](function(){_0x20aeb9[_0x7d5b('0x20')](0xcc)[_0x7d5b('0x21')]();});}};}function handleEntityNotFound(_0x3a8423){return function(_0x65340e){if(!_0x65340e){_0x3a8423[_0x7d5b('0x1f')](0x194);}return _0x65340e;};}function handleError(_0x553c93,_0x1fecff){_0x1fecff=_0x1fecff||0x1f4;return function(_0x53be20){logger['error'](_0x53be20[_0x7d5b('0x2d')]);if(_0x53be20['name']){delete _0x53be20[_0x7d5b('0x2e')];}_0x553c93[_0x7d5b('0x20')](_0x1fecff)[_0x7d5b('0x2f')](_0x53be20);};}exports[_0x7d5b('0x30')]=function(_0x844d13,_0x33f80b){var _0x7d3ad2={'include':[{'model':db['Pause'],'as':_0x7d5b('0x31')}]},_0x109c6f={},_0x5e4c09={'count':0x0,'rows':[]};var _0xf9382e=_[_0x7d5b('0x32')](db[_0x7d5b('0x33')][_0x7d5b('0x34')],function(_0x2f8dbb){return{'name':_0x2f8dbb[_0x7d5b('0x35')],'type':_0x2f8dbb[_0x7d5b('0x36')][_0x7d5b('0x37')]};});_0x109c6f[_0x7d5b('0x38')]=_[_0x7d5b('0x32')](_0xf9382e,_0x7d5b('0x2e'));_0x109c6f['query']=_['keys'](_0x844d13[_0x7d5b('0x39')]);_0x109c6f[_0x7d5b('0x3a')]=_[_0x7d5b('0x3b')](_0x109c6f[_0x7d5b('0x38')],_0x109c6f[_0x7d5b('0x39')]);_0x7d3ad2[_0x7d5b('0x3c')]=_[_0x7d5b('0x3b')](_0x109c6f['model'],qs[_0x7d5b('0x3d')](_0x844d13['query'][_0x7d5b('0x3d')]));_0x7d3ad2[_0x7d5b('0x3c')]=_0x7d3ad2[_0x7d5b('0x3c')][_0x7d5b('0x3e')]?_0x7d3ad2[_0x7d5b('0x3c')]:_0x109c6f[_0x7d5b('0x38')];if(!_0x844d13[_0x7d5b('0x39')]['hasOwnProperty'](_0x7d5b('0x3f'))){_0x7d3ad2['limit']=qs[_0x7d5b('0x25')](_0x844d13[_0x7d5b('0x39')][_0x7d5b('0x25')]);_0x7d3ad2[_0x7d5b('0x23')]=qs[_0x7d5b('0x23')](_0x844d13[_0x7d5b('0x39')][_0x7d5b('0x23')]);}_0x7d3ad2[_0x7d5b('0x40')]=qs[_0x7d5b('0x41')](_0x844d13[_0x7d5b('0x39')][_0x7d5b('0x41')]);_0x7d3ad2[_0x7d5b('0x42')]=qs[_0x7d5b('0x3a')](_[_0x7d5b('0x43')](_0x844d13[_0x7d5b('0x39')],_0x109c6f[_0x7d5b('0x3a')]),_0xf9382e);if(_0x844d13[_0x7d5b('0x39')][_0x7d5b('0x44')]){_0x7d3ad2['where']=_[_0x7d5b('0x45')](_0x7d3ad2[_0x7d5b('0x42')],{'$or':_[_0x7d5b('0x32')](_0xf9382e,function(_0x1ed37c){if(_0x1ed37c[_0x7d5b('0x36')]!==_0x7d5b('0x46')){var _0x2162a5={};_0x2162a5[_0x1ed37c['name']]={'$like':'%'+_0x844d13[_0x7d5b('0x39')][_0x7d5b('0x44')]+'%'};return _0x2162a5;}})});}_0x7d3ad2=_['merge']({},_0x7d3ad2,_0x844d13[_0x7d5b('0x47')]);var _0x366450={'where':_0x7d3ad2[_0x7d5b('0x42')]};return db[_0x7d5b('0x33')][_0x7d5b('0x26')](_0x366450)[_0x7d5b('0x28')](function(_0x265db0){_0x5e4c09['count']=_0x265db0;if(_0x844d13['query'][_0x7d5b('0x48')]){_0x7d3ad2[_0x7d5b('0x49')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x7d3ad2);})[_0x7d5b('0x28')](function(_0x230df5){_0x5e4c09['rows']=_0x230df5;return _0x5e4c09;})['then'](respondWithFilteredResult(_0x33f80b,_0x7d3ad2))['catch'](handleError(_0x33f80b,null));};exports['show']=function(_0x3decdf,_0x29e848){var _0x500a85={'raw':![],'where':{'id':_0x3decdf[_0x7d5b('0x4a')]['id']},'include':[{'model':db[_0x7d5b('0x4b')],'as':'mandatoryDispositionPause'}]},_0x2f0247={};_0x2f0247['model']=_[_0x7d5b('0x4c')](db[_0x7d5b('0x33')][_0x7d5b('0x34')]);_0x2f0247[_0x7d5b('0x39')]=_['keys'](_0x3decdf['query']);_0x2f0247[_0x7d5b('0x3a')]=_[_0x7d5b('0x3b')](_0x2f0247[_0x7d5b('0x38')],_0x2f0247['query']);_0x500a85[_0x7d5b('0x3c')]=_[_0x7d5b('0x3b')](_0x2f0247[_0x7d5b('0x38')],qs[_0x7d5b('0x3d')](_0x3decdf[_0x7d5b('0x39')]['fields']));_0x500a85['attributes']=_0x500a85['attributes'][_0x7d5b('0x3e')]?_0x500a85[_0x7d5b('0x3c')]:_0x2f0247[_0x7d5b('0x38')];if(_0x3decdf[_0x7d5b('0x39')]['includeAll']){_0x500a85['include']=[{'all':!![]}];}_0x500a85=_[_0x7d5b('0x45')]({},_0x500a85,_0x3decdf['options']);return db['ChatWebsite'][_0x7d5b('0x4d')](_0x500a85)[_0x7d5b('0x28')](handleEntityNotFound(_0x29e848,null))[_0x7d5b('0x28')](respondWithResult(_0x29e848,null))[_0x7d5b('0x4e')](handleError(_0x29e848,null));};exports[_0x7d5b('0x4f')]=function(_0x50cb99,_0x2df641){return db[_0x7d5b('0x33')][_0x7d5b('0x4f')](_0x50cb99[_0x7d5b('0x50')],{})[_0x7d5b('0x28')](function(_0x2a4443){var _0x3c97b5=_0x50cb99[_0x7d5b('0x51')]['get']({'plain':!![]});if(!_0x3c97b5)throw new Error(_0x7d5b('0x52'));if(_0x3c97b5[_0x7d5b('0x53')]===_0x7d5b('0x51')){var _0x46b08c=_0x2a4443[_0x7d5b('0x29')]({'plain':!![]});var _0x9001d1='ChatWebsites';return db[_0x7d5b('0x54')][_0x7d5b('0x4d')]({'where':{'name':_0x9001d1,'userProfileId':_0x3c97b5['userProfileId']},'raw':!![]})[_0x7d5b('0x28')](function(_0x4a775b){if(_0x4a775b&&_0x4a775b[_0x7d5b('0x55')]===0x0){return db[_0x7d5b('0x2b')][_0x7d5b('0x4f')]({'name':_0x46b08c[_0x7d5b('0x2e')],'resourceId':_0x46b08c['id'],'type':_0x4a775b[_0x7d5b('0x2e')],'sectionId':_0x4a775b['id']},{})[_0x7d5b('0x28')](function(){return _0x2a4443;});}else{return _0x2a4443;}})['catch'](function(_0x35ca6e){logger[_0x7d5b('0x1c')](_0x7d5b('0x56'),_0x35ca6e);throw _0x35ca6e;});}return _0x2a4443;})['then'](respondWithResult(_0x2df641,0xc9))[_0x7d5b('0x4e')](handleError(_0x2df641,null));};exports[_0x7d5b('0x27')]=function(_0x296582,_0xe81499){if(_0x296582[_0x7d5b('0x50')]['id']){delete _0x296582[_0x7d5b('0x50')]['id'];}return db[_0x7d5b('0x33')]['find']({'where':{'id':_0x296582[_0x7d5b('0x4a')]['id']},'include':[{'model':db[_0x7d5b('0x4b')],'as':_0x7d5b('0x31')}]})['then'](handleEntityNotFound(_0xe81499,null))[_0x7d5b('0x28')](saveUpdates(_0x296582[_0x7d5b('0x50')],null))['then'](respondWithResult(_0xe81499,null))[_0x7d5b('0x4e')](handleError(_0xe81499,null));};exports[_0x7d5b('0x2c')]=function(_0x4643a3,_0x25db8f){return db[_0x7d5b('0x33')][_0x7d5b('0x4d')]({'where':{'id':_0x4643a3[_0x7d5b('0x4a')]['id']}})[_0x7d5b('0x28')](handleEntityNotFound(_0x25db8f,null))[_0x7d5b('0x28')](removeEntity(_0x25db8f,null))[_0x7d5b('0x4e')](handleError(_0x25db8f,null));};exports['describe']=function(_0xefd85c,_0x28c0d8){return db['ChatWebsite'][_0x7d5b('0x57')]()[_0x7d5b('0x28')](respondWithResult(_0x28c0d8,null))[_0x7d5b('0x4e')](handleError(_0x28c0d8,null));};exports[_0x7d5b('0x58')]=function(_0x12058c,_0x164d50){if(_0x12058c[_0x7d5b('0x50')]['id']){delete _0x12058c[_0x7d5b('0x50')]['id'];}return db[_0x7d5b('0x33')][_0x7d5b('0x4d')]({'where':{'id':_0x12058c['params']['id']}})['then'](handleEntityNotFound(_0x164d50,null))['then'](function(_0x3192d3){if(_0x3192d3){_0x12058c[_0x7d5b('0x50')]['ChatWebsiteId']=_0x3192d3['id'];return db[_0x7d5b('0x59')][_0x7d5b('0x4f')](_0x12058c[_0x7d5b('0x50')]);}})[_0x7d5b('0x28')](respondWithResult(_0x164d50,null))[_0x7d5b('0x4e')](handleError(_0x164d50,null));};exports['getDispositions']=function(_0x492f70,_0x3b9936){var _0x2db190={'raw':![],'where':{}};var _0x1ba299={};var _0x3ffeac={'count':0x0,'rows':[]};return db[_0x7d5b('0x33')][_0x7d5b('0x5a')]({'where':{'id':_0x492f70[_0x7d5b('0x4a')]['id']}})[_0x7d5b('0x28')](handleEntityNotFound(_0x3b9936,null))[_0x7d5b('0x28')](function(_0x1963d0){if(_0x1963d0){_0x1ba299[_0x7d5b('0x38')]=_['keys'](db[_0x7d5b('0x59')][_0x7d5b('0x34')]);_0x1ba299[_0x7d5b('0x39')]=_[_0x7d5b('0x4c')](_0x492f70[_0x7d5b('0x39')]);_0x1ba299['filters']=_[_0x7d5b('0x3b')](_0x1ba299['model'],_0x1ba299[_0x7d5b('0x39')]);_0x2db190[_0x7d5b('0x3c')]=_[_0x7d5b('0x3b')](_0x1ba299['model'],qs[_0x7d5b('0x3d')](_0x492f70['query'][_0x7d5b('0x3d')]));_0x2db190[_0x7d5b('0x3c')]=_0x2db190[_0x7d5b('0x3c')]['length']?_0x2db190[_0x7d5b('0x3c')]:_0x1ba299['model'];if(!_0x492f70[_0x7d5b('0x39')][_0x7d5b('0x5b')](_0x7d5b('0x3f'))){_0x2db190[_0x7d5b('0x25')]=qs[_0x7d5b('0x25')](_0x492f70['query'][_0x7d5b('0x25')]);_0x2db190[_0x7d5b('0x23')]=qs[_0x7d5b('0x23')](_0x492f70[_0x7d5b('0x39')][_0x7d5b('0x23')]);}_0x2db190['order']=qs['sort'](_0x492f70[_0x7d5b('0x39')]['sort']);_0x2db190[_0x7d5b('0x42')]=qs[_0x7d5b('0x3a')](_[_0x7d5b('0x43')](_0x492f70[_0x7d5b('0x39')],_0x1ba299['filters']));_0x2db190[_0x7d5b('0x42')][_0x7d5b('0x5c')]=_0x1963d0['id'];if(_0x492f70[_0x7d5b('0x39')][_0x7d5b('0x44')]){_0x2db190[_0x7d5b('0x42')]=_[_0x7d5b('0x45')](_0x2db190[_0x7d5b('0x42')],{'$or':_[_0x7d5b('0x32')](_0x2db190[_0x7d5b('0x3c')],function(_0x51149d){var _0x5261bc={};_0x5261bc[_0x51149d]={'$like':'%'+_0x492f70[_0x7d5b('0x39')][_0x7d5b('0x44')]+'%'};return _0x5261bc;})});}_0x2db190=_[_0x7d5b('0x45')]({},_0x2db190,_0x492f70[_0x7d5b('0x47')]);return db[_0x7d5b('0x59')][_0x7d5b('0x26')]({'where':_0x2db190['where']})[_0x7d5b('0x28')](function(_0x1e5424){_0x3ffeac[_0x7d5b('0x26')]=_0x1e5424;if(_0x492f70[_0x7d5b('0x39')][_0x7d5b('0x48')]){_0x2db190[_0x7d5b('0x49')]=[{'all':!![]}];}return db[_0x7d5b('0x59')]['findAll'](_0x2db190);})[_0x7d5b('0x28')](function(_0x31ab6d){_0x3ffeac[_0x7d5b('0x5d')]=_0x31ab6d;return _0x3ffeac;});}})[_0x7d5b('0x28')](respondWithFilteredResult(_0x3b9936,_0x2db190))['catch'](handleError(_0x3b9936,null));};exports['removeDispositions']=function(_0xe4c8f7,_0xa20e13){return db[_0x7d5b('0x33')][_0x7d5b('0x4d')]({'where':{'id':_0xe4c8f7[_0x7d5b('0x4a')]['id']}})[_0x7d5b('0x28')](handleEntityNotFound(_0xa20e13,null))[_0x7d5b('0x28')](function(_0x574ffa){if(_0x574ffa){return _0x574ffa[_0x7d5b('0x5e')](_0xe4c8f7['query'][_0x7d5b('0x5f')]);}})[_0x7d5b('0x28')](respondWithStatusCode(_0xa20e13,null))[_0x7d5b('0x4e')](handleError(_0xa20e13,null));};exports[_0x7d5b('0x60')]=function(_0x56c726,_0x295e20){if(_0x56c726[_0x7d5b('0x50')]['id']){delete _0x56c726[_0x7d5b('0x50')]['id'];}return db[_0x7d5b('0x33')]['find']({'where':{'id':_0x56c726[_0x7d5b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x295e20,null))[_0x7d5b('0x28')](function(_0x3af6d6){if(_0x3af6d6){_0x56c726['body'][_0x7d5b('0x5c')]=_0x3af6d6['id'];return db[_0x7d5b('0x61')][_0x7d5b('0x4f')](_0x56c726[_0x7d5b('0x50')]);}})[_0x7d5b('0x28')](respondWithResult(_0x295e20,null))[_0x7d5b('0x4e')](handleError(_0x295e20,null));};exports[_0x7d5b('0x62')]=function(_0x54d950,_0x3a224f){var _0x4d9ac5={'raw':![],'where':{}};var _0x30b16b={};var _0x41c3aa={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x54d950[_0x7d5b('0x4a')]['id']}})[_0x7d5b('0x28')](handleEntityNotFound(_0x3a224f,null))['then'](function(_0x202ecd){if(_0x202ecd){_0x30b16b[_0x7d5b('0x38')]=_[_0x7d5b('0x4c')](db['CannedAnswer']['rawAttributes']);_0x30b16b[_0x7d5b('0x39')]=_[_0x7d5b('0x4c')](_0x54d950[_0x7d5b('0x39')]);_0x30b16b[_0x7d5b('0x3a')]=_[_0x7d5b('0x3b')](_0x30b16b[_0x7d5b('0x38')],_0x30b16b[_0x7d5b('0x39')]);_0x4d9ac5[_0x7d5b('0x3c')]=_['intersection'](_0x30b16b[_0x7d5b('0x38')],qs[_0x7d5b('0x3d')](_0x54d950[_0x7d5b('0x39')][_0x7d5b('0x3d')]));_0x4d9ac5['attributes']=_0x4d9ac5[_0x7d5b('0x3c')]['length']?_0x4d9ac5[_0x7d5b('0x3c')]:_0x30b16b[_0x7d5b('0x38')];if(!_0x54d950[_0x7d5b('0x39')]['hasOwnProperty'](_0x7d5b('0x3f'))){_0x4d9ac5[_0x7d5b('0x25')]=qs[_0x7d5b('0x25')](_0x54d950['query'][_0x7d5b('0x25')]);_0x4d9ac5[_0x7d5b('0x23')]=qs[_0x7d5b('0x23')](_0x54d950['query']['offset']);}_0x4d9ac5['order']=qs[_0x7d5b('0x41')](_0x54d950[_0x7d5b('0x39')][_0x7d5b('0x41')]);_0x4d9ac5['where']=qs[_0x7d5b('0x3a')](_['pick'](_0x54d950[_0x7d5b('0x39')],_0x30b16b[_0x7d5b('0x3a')]));_0x4d9ac5['where'][_0x7d5b('0x5c')]=_0x202ecd['id'];if(_0x54d950[_0x7d5b('0x39')]['filter']){_0x4d9ac5['where']=_[_0x7d5b('0x45')](_0x4d9ac5[_0x7d5b('0x42')],{'$or':_[_0x7d5b('0x32')](_0x4d9ac5[_0x7d5b('0x3c')],function(_0x5e8afc){var _0xea193d={};_0xea193d[_0x5e8afc]={'$like':'%'+_0x54d950[_0x7d5b('0x39')]['filter']+'%'};return _0xea193d;})});}_0x4d9ac5=_[_0x7d5b('0x45')]({},_0x4d9ac5,_0x54d950[_0x7d5b('0x47')]);return db[_0x7d5b('0x61')][_0x7d5b('0x26')]({'where':_0x4d9ac5['where']})[_0x7d5b('0x28')](function(_0x384921){_0x41c3aa[_0x7d5b('0x26')]=_0x384921;if(_0x54d950['query'][_0x7d5b('0x48')]){_0x4d9ac5[_0x7d5b('0x49')]=[{'all':!![]}];}return db[_0x7d5b('0x61')][_0x7d5b('0x63')](_0x4d9ac5);})[_0x7d5b('0x28')](function(_0x171b0f){_0x41c3aa['rows']=_0x171b0f;return _0x41c3aa;});}})['then'](respondWithFilteredResult(_0x3a224f,_0x4d9ac5))[_0x7d5b('0x4e')](handleError(_0x3a224f,null));};exports[_0x7d5b('0x64')]=function(_0x5169b8,_0x322ae2){return db['ChatWebsite'][_0x7d5b('0x4d')]({'where':{'id':_0x5169b8[_0x7d5b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x322ae2,null))[_0x7d5b('0x28')](function(_0x254637){if(_0x254637){return _0x254637['removeAnswers'](_0x5169b8[_0x7d5b('0x39')][_0x7d5b('0x5f')]);}})[_0x7d5b('0x28')](respondWithStatusCode(_0x322ae2,null))[_0x7d5b('0x4e')](handleError(_0x322ae2,null));};exports[_0x7d5b('0x65')]=function(_0x558d0b,_0x27f4b2){_0x558d0b[_0x7d5b('0x50')][_0x7d5b('0x66')]=_0x558d0b[_0x7d5b('0x67')][_0x7d5b('0x68')];return db[_0x7d5b('0x33')][_0x7d5b('0x4d')]({'where':{'id':_0x558d0b[_0x7d5b('0x4a')]['id']}})[_0x7d5b('0x28')](handleEntityNotFound(_0x27f4b2,null))['then'](saveUpdates(_0x558d0b[_0x7d5b('0x50')],null))[_0x7d5b('0x28')](respondWithResult(_0x27f4b2,null))[_0x7d5b('0x4e')](handleError(_0x27f4b2,null));};exports['addAvatar']=function(_0x14e964,_0x328e34){_0x14e964['body']['agentAvatar']=_0x14e964[_0x7d5b('0x67')]['filename'];return db[_0x7d5b('0x33')][_0x7d5b('0x4d')]({'where':{'id':_0x14e964[_0x7d5b('0x4a')]['id']}})[_0x7d5b('0x28')](handleEntityNotFound(_0x328e34,null))[_0x7d5b('0x28')](saveUpdates(_0x14e964[_0x7d5b('0x50')],null))[_0x7d5b('0x28')](respondWithResult(_0x328e34,null))[_0x7d5b('0x4e')](handleError(_0x328e34,null));};exports[_0x7d5b('0x69')]=function(_0x194349,_0x40c33d){_0x194349[_0x7d5b('0x50')][_0x7d5b('0x6a')]=_0x194349[_0x7d5b('0x67')][_0x7d5b('0x68')];return db['ChatWebsite'][_0x7d5b('0x4d')]({'where':{'id':_0x194349[_0x7d5b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x40c33d,null))[_0x7d5b('0x28')](saveUpdates(_0x194349[_0x7d5b('0x50')],null))['then'](respondWithResult(_0x40c33d,null))['catch'](handleError(_0x40c33d,null));};exports[_0x7d5b('0x6b')]=function(_0x1c38d7,_0x3ed7fa){_0x1c38d7[_0x7d5b('0x50')][_0x7d5b('0x6c')]=_0x1c38d7[_0x7d5b('0x67')][_0x7d5b('0x68')];return db['ChatWebsite'][_0x7d5b('0x4d')]({'where':{'id':_0x1c38d7['params']['id']}})[_0x7d5b('0x28')](handleEntityNotFound(_0x3ed7fa,null))[_0x7d5b('0x28')](saveUpdates(_0x1c38d7[_0x7d5b('0x50')],null))[_0x7d5b('0x28')](respondWithResult(_0x3ed7fa,null))[_0x7d5b('0x4e')](handleError(_0x3ed7fa,null));};exports[_0x7d5b('0x6d')]=function(_0x3e2361,_0x59b3eb){var _0x25a757=path[_0x7d5b('0x6e')](config['root'],_0x7d5b('0x6f'));var _0x2c0d65={'where':{'id':_0x3e2361[_0x7d5b('0x4a')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x99835c=![];return require(_0x7d5b('0x70'))[_0x7d5b('0x71')]()[_0x7d5b('0x28')](function(_0x1fa75b){if(_0x1fa75b){_0x99835c=_0x1fa75b['custom'];}})['then'](function(){return db[_0x7d5b('0x33')][_0x7d5b('0x4d')](_0x2c0d65);})[_0x7d5b('0x28')](handleEntityNotFound(_0x59b3eb,null))[_0x7d5b('0x28')](function(_0x4ea337){if(_0x4ea337){if(!_['isNil'](_0x4ea337['sitepic'])){if(fs[_0x7d5b('0x72')](path['join'](config['root'],_0x7d5b('0x73'),_0x4ea337[_0x7d5b('0x66')]))&&_0x99835c){_0x25a757=path['join'](config['root'],_0x7d5b('0x73'),_0x4ea337['sitepic']);}}return _0x59b3eb[_0x7d5b('0x74')](_0x25a757);}})[_0x7d5b('0x4e')](handleError(_0x59b3eb,null));};exports['getAvatar']=function(_0x5245e2,_0x3be615){var _0x5d67e6=path[_0x7d5b('0x6e')](config[_0x7d5b('0x75')],_0x7d5b('0x76'));var _0x34475a={'where':{'id':_0x5245e2[_0x7d5b('0x4a')]['id']},'attributes':['id',_0x7d5b('0x77')],'raw':!![]};return db[_0x7d5b('0x33')][_0x7d5b('0x4d')](_0x34475a)['then'](handleEntityNotFound(_0x3be615,null))[_0x7d5b('0x28')](function(_0x43154c){if(_0x43154c){if(!_[_0x7d5b('0x78')](_0x43154c['agentAvatar'])){if(fs[_0x7d5b('0x72')](path[_0x7d5b('0x6e')](config[_0x7d5b('0x75')],_0x7d5b('0x79'),_0x43154c[_0x7d5b('0x77')]))){_0x5d67e6=path[_0x7d5b('0x6e')](config[_0x7d5b('0x75')],'server/files/images/avatars/',_0x43154c[_0x7d5b('0x77')]);}}return _0x3be615[_0x7d5b('0x74')](_0x5d67e6);}})[_0x7d5b('0x4e')](handleError(_0x3be615,null));};exports[_0x7d5b('0x7a')]=function(_0x4f9b53,_0x397a7e){var _0x4835f2=path['join'](config[_0x7d5b('0x75')],'server/files/images/avatars/customer_avatar.png');var _0x55475a={'where':{'id':_0x4f9b53[_0x7d5b('0x4a')]['id']},'attributes':['id',_0x7d5b('0x6a'),_0x7d5b('0x7b')],'raw':!![]};return db[_0x7d5b('0x33')]['find'](_0x55475a)['then'](handleEntityNotFound(_0x397a7e,null))[_0x7d5b('0x28')](function(_0x178b32){if(_0x178b32){if(!_[_0x7d5b('0x78')](_0x178b32[_0x7d5b('0x6a')])){if(fs[_0x7d5b('0x72')](path[_0x7d5b('0x6e')](config[_0x7d5b('0x75')],_0x7d5b('0x79'),_0x178b32[_0x7d5b('0x6a')]))&&_0x178b32[_0x7d5b('0x7b')]){_0x4835f2=path[_0x7d5b('0x6e')](config['root'],_0x7d5b('0x79'),_0x178b32[_0x7d5b('0x6a')]);}}return _0x397a7e[_0x7d5b('0x74')](_0x4835f2);}})[_0x7d5b('0x4e')](handleError(_0x397a7e,null));};exports[_0x7d5b('0x7c')]=function(_0x1ddc2c,_0x5d5d7b){var _0x401b2b=path['join'](config['root'],'server/files/images/avatars/system_avatar.png');var _0x25f9f3={'where':{'id':_0x1ddc2c[_0x7d5b('0x4a')]['id']},'attributes':['id',_0x7d5b('0x6c')],'raw':!![]};return db[_0x7d5b('0x33')][_0x7d5b('0x4d')](_0x25f9f3)[_0x7d5b('0x28')](handleEntityNotFound(_0x5d5d7b,null))['then'](function(_0x3b4a45){if(_0x3b4a45){if(!_[_0x7d5b('0x78')](_0x3b4a45['systemAvatar'])){if(fs['existsSync'](path['join'](config[_0x7d5b('0x75')],'server/files/images/avatars/',_0x3b4a45[_0x7d5b('0x6c')]))){_0x401b2b=path['join'](config[_0x7d5b('0x75')],_0x7d5b('0x79'),_0x3b4a45[_0x7d5b('0x6c')]);}}return _0x5d5d7b[_0x7d5b('0x74')](_0x401b2b);}})['catch'](handleError(_0x5d5d7b,null));};exports[_0x7d5b('0x7d')]=function(_0x13ffab,_0x370729){var _0x529451=require('user-agent-parser');var _0x5359dd=new _0x529451();var _0x49e25f=_0x5359dd[_0x7d5b('0x7e')](_0x13ffab[_0x7d5b('0x7f')][_0x7d5b('0x80')])[_0x7d5b('0x81')]();var _0x43ad13={'body':_0x13ffab[_0x7d5b('0x50')],'channel':_0x7d5b('0x82')};var _0x296f73=[];var _0xdba99f=[];var _0x5c1ea1={};var _0x653d23=![];return db['CmContact']['describe']()[_0x7d5b('0x28')](function(_0x1da310){if(!_0x1da310){throw new db['Sequelize']['ValidationError'](_0x7d5b('0x83'));}_0x296f73=_[_0x7d5b('0x84')](_[_0x7d5b('0x4c')](_0x1da310),['createdAt','updatedAt']);_0xdba99f=_['difference'](_[_0x7d5b('0x4c')](_0x1da310),[_0x7d5b('0x85'),_0x7d5b('0x86'),_0x7d5b('0x87'),'ListId']);if(_0x13ffab['body']['id']){delete _0x13ffab[_0x7d5b('0x50')]['id'];}if(_['isNil'](_0x13ffab[_0x7d5b('0x50')][_0x7d5b('0x88')])){throw new db[(_0x7d5b('0x89'))][(_0x7d5b('0x8a'))]('from\x20is\x20mandatory');}if(_[_0x7d5b('0x78')](_0x13ffab[_0x7d5b('0x50')][_0x7d5b('0x50')])||_0x13ffab[_0x7d5b('0x50')]['body']===''){throw new db[(_0x7d5b('0x89'))][(_0x7d5b('0x8a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7d5b('0x78')](_0x13ffab[_0x7d5b('0x50')][_0x7d5b('0x8b')])){throw new db[(_0x7d5b('0x89'))]['ValidationError'](_0x7d5b('0x8c')+_0xdba99f);}if(!_['includes'](_0xdba99f,_0x13ffab[_0x7d5b('0x50')][_0x7d5b('0x8b')])){throw new db[(_0x7d5b('0x89'))]['ValidationError'](_0x7d5b('0x8d')+_0xdba99f);}_0x5c1ea1[_0x13ffab[_0x7d5b('0x50')][_0x7d5b('0x8b')]]=_0x13ffab[_0x7d5b('0x50')][_0x7d5b('0x88')];})[_0x7d5b('0x28')](function(){return db[_0x7d5b('0x33')][_0x7d5b('0x4d')]({'where':{'id':_0x13ffab['params']['id']},'include':[{'model':db[_0x7d5b('0x8e')],'as':_0x7d5b('0x8f'),'include':[{'model':db['CmContact'],'as':_0x7d5b('0x90'),'where':_0x5c1ea1,'limit':0x1,'order':[[_0x7d5b('0x86'),_0x7d5b('0x91')]]}]},{'model':db[_0x7d5b('0x92')],'as':_0x7d5b('0x93')}]});})[_0x7d5b('0x28')](handleEntityNotFound(_0x370729,null))['then'](function(_0xc77b3a){if(_0xc77b3a&&_0xc77b3a[_0x7d5b('0x8f')]){_0x43ad13[_0x7d5b('0x94')]=_0xc77b3a;_0x43ad13['applications']=_0xc77b3a['Applications'];_0x43ad13[_0x7d5b('0x95')]=_0xc77b3a[_0x7d5b('0x8f')];_0x43ad13[_0x7d5b('0x96')]=_[_0x7d5b('0x97')](_0x43ad13['applications'],[_0x7d5b('0x98')],['asc']);if(_0x43ad13[_0x7d5b('0x94')][_0x7d5b('0x93')]){delete _0x43ad13[_0x7d5b('0x94')][_0x7d5b('0x93')];}if(_0x43ad13[_0x7d5b('0x94')][_0x7d5b('0x8f')]&&_0x43ad13[_0x7d5b('0x94')][_0x7d5b('0x8f')][_0x7d5b('0x90')][_0x7d5b('0x3e')]){return _0x43ad13['account'][_0x7d5b('0x8f')][_0x7d5b('0x90')][0x0];}var _0x31b07b=_['defaults'](_0x13ffab['body'],{'firstName':_0x13ffab['body'][_0x7d5b('0x88')],'ListId':_0xc77b3a['ListId']});_0x31b07b[_0x13ffab[_0x7d5b('0x50')][_0x7d5b('0x8b')]]=_0x13ffab[_0x7d5b('0x50')][_0x7d5b('0x88')];return db[_0x7d5b('0x99')]['create'](_0x31b07b,{'fields':_0x296f73,'raw':!![]});}})[_0x7d5b('0x28')](handleEntityNotFound(_0x370729,null))[_0x7d5b('0x28')](function(_0x5d212e){_0x43ad13[_0x7d5b('0x9a')]=_0x5d212e;var _0x319530=_0x13ffab[_0x7d5b('0x50')][_0x7d5b('0x9b')];if(_0x13ffab[_0x7d5b('0x7f')][_0x7d5b('0x9c')]){_0x319530=_0x13ffab[_0x7d5b('0x7f')]['cf-connecting-ip'];}else if(_0x13ffab[_0x7d5b('0x7f')][_0x7d5b('0x9d')]){_0x319530=_[_0x7d5b('0x9e')](_0x13ffab[_0x7d5b('0x7f')][_0x7d5b('0x9d')][_0x7d5b('0x9f')](','));}if(_0x5d212e){var _0x59d416={'ContactId':_0x5d212e['id'],'ChatWebsiteId':_0x13ffab['params']['id'],'from':(_0x5d212e[_0x7d5b('0xa0')]||'')+'\x20'+(_0x5d212e[_0x7d5b('0xa1')]||''),'customerIp':_0x319530,'customerPort':_0x13ffab[_0x7d5b('0x7f')][_0x7d5b('0xa2')]?_0x13ffab[_0x7d5b('0x7f')][_0x7d5b('0xa2')]:null,'referer':_0x13ffab[_0x7d5b('0x50')][_0x7d5b('0xa3')],'browserName':_0x49e25f[_0x7d5b('0xa4')][_0x7d5b('0x2e')]&&_0x49e25f[_0x7d5b('0xa4')][_0x7d5b('0xa5')]?util[_0x7d5b('0xa6')](_0x7d5b('0xa7'),_0x49e25f[_0x7d5b('0xa4')][_0x7d5b('0x2e')],_0x49e25f[_0x7d5b('0xa4')][_0x7d5b('0xa5')]):_0x7d5b('0xa8'),'browserVersion':_0x49e25f[_0x7d5b('0xa4')][_0x7d5b('0xa5')]||_0x7d5b('0xa8'),'osName':util[_0x7d5b('0xa6')](_0x7d5b('0xa7'),_0x49e25f['os'][_0x7d5b('0x2e')],_0x49e25f['os']['version']),'osVersion':_0x49e25f['os'][_0x7d5b('0xa5')],'deviceModel':_0x49e25f[_0x7d5b('0xa9')][_0x7d5b('0x38')]&&_0x49e25f['device']['vendor']?util[_0x7d5b('0xa6')](_0x7d5b('0xaa'),_0x49e25f['device']['model'],_0x49e25f['device'][_0x7d5b('0xab')],_0x49e25f[_0x7d5b('0xa9')][_0x7d5b('0x36')]):null,'deviceVendor':_0x49e25f[_0x7d5b('0xa9')][_0x7d5b('0xab')],'deviceType':_0x49e25f[_0x7d5b('0xa9')][_0x7d5b('0x36')],'formData':JSON['stringify'](_0x13ffab['body'])};var _0x542665={'ChatWebsiteId':_0x13ffab[_0x7d5b('0x4a')]['id'],'closed':![]};if(_0x13ffab[_0x7d5b('0x50')][_0x7d5b('0xac')]){_0x542665[_0x7d5b('0xac')]=_0x13ffab['body'][_0x7d5b('0xac')];return db[_0x7d5b('0xad')][_0x7d5b('0x4d')]({'where':_0x542665})[_0x7d5b('0x28')](function(_0x249d92){if(_0x249d92){return[_0x249d92,![]];}_0x59d416[_0x7d5b('0xac')]=_0x13ffab[_0x7d5b('0x50')][_0x7d5b('0xac')];_0x59d416[_0x7d5b('0xae')]=_0x13ffab[_0x7d5b('0x50')][_0x7d5b('0xae')];return db[_0x7d5b('0xad')][_0x7d5b('0x4f')](_0x59d416)[_0x7d5b('0x28')](function(_0x55d363){return[_0x55d363,!![]];});});}_0x542665['ContactId']=_0x5d212e['id'];if(_0x13ffab[_0x7d5b('0x50')][_0x7d5b('0xaf')]&&_0x13ffab['body']['interaction']['id']){_0x542665['id']=_0x13ffab['body']['interaction']['id'];return db['ChatInteraction'][_0x7d5b('0x4d')]({'where':_0x542665})[_0x7d5b('0x28')](function(_0x3b40d7){if(_0x3b40d7){return[_0x3b40d7,![]];}return db['ChatInteraction'][_0x7d5b('0x4f')](_0x59d416)[_0x7d5b('0x28')](function(_0x27f984){return[_0x27f984,!![]];});});}return db[_0x7d5b('0xad')][_0x7d5b('0x4f')](_0x59d416)[_0x7d5b('0x28')](function(_0x10a108){return[_0x10a108,!![]];});}})[_0x7d5b('0xb0')](function(_0x57cd25,_0x268beb){if(_0x57cd25){_0x653d23=_0x268beb;if(!_0x268beb){var _0x5bb378={'from':(_0x43ad13['contact']['firstName']||'')+'\x20'+(_0x43ad13[_0x7d5b('0x9a')][_0x7d5b('0xa1')]||'')};if(_0x13ffab['body'][_0x7d5b('0xac')]&&_0x13ffab[_0x7d5b('0x50')]['messageId']&&_0x13ffab[_0x7d5b('0x50')][_0x7d5b('0xac')]!=_0x13ffab[_0x7d5b('0x50')][_0x7d5b('0xb1')]){_0x5bb378[_0x7d5b('0xac')]=_0x13ffab[_0x7d5b('0x50')][_0x7d5b('0xb1')];}return _0x57cd25[_0x7d5b('0x27')](_0x5bb378);}else{return _0x57cd25;}}})[_0x7d5b('0x28')](function(_0x46ee51){_0x43ad13[_0x7d5b('0xaf')]=_0x46ee51[_0x7d5b('0x29')]({'plain':!![]});_0x43ad13[_0x7d5b('0xaf')][_0x7d5b('0xb2')]=_0x653d23;if(_0x43ad13[_0x7d5b('0xaf')][_0x7d5b('0xb2')]){if(_0x43ad13[_0x7d5b('0x94')][_0x7d5b('0xb3')]){_0x43ad13[_0x7d5b('0x96')][_0x7d5b('0xb4')]({'id':0x0,'priority':_0x43ad13[_0x7d5b('0x96')][_0x7d5b('0x3e')]+0x1,'app':_0x7d5b('0xb5'),'appdata':_0x7d5b('0xb6'),'interval':'*,*,*,*'});}}return db['ChatMessage'][_0x7d5b('0x4f')]({'body':_0x13ffab[_0x7d5b('0x50')][_0x7d5b('0x50')],'ChatWebsiteId':_0x13ffab['params']['id'],'ChatInteractionId':_0x46ee51['id'],'direction':'in','ContactId':_0x43ad13[_0x7d5b('0x9a')]['id'],'AttachmentId':_0x13ffab[_0x7d5b('0x50')][_0x7d5b('0xb7')]});})['then'](function(_0x19473c){_0x43ad13[_0x7d5b('0x1e')]=_0x19473c;if(_0x43ad13[_0x7d5b('0xaf')][_0x7d5b('0xb8')]){return db[_0x7d5b('0xb9')][_0x7d5b('0x4d')]({'attributes':['id',_0x7d5b('0x2e')],'where':{'id':_0x43ad13[_0x7d5b('0xaf')][_0x7d5b('0xb8')]}})[_0x7d5b('0x28')](function(_0x3c1259){if(_0x3c1259){_0x43ad13[_0x7d5b('0x96')]['unshift']({'id':0x0,'priority':0x0,'app':_0x7d5b('0xba'),'appdata':_0x3c1259[_0x7d5b('0x2e')]+','+(_0x43ad13['account'][_0x7d5b('0xbb')]||0xa),'interval':_0x7d5b('0xbc')});_0x43ad13[_0x7d5b('0xbd')]=!![];}return respondWithRpcPromise('Start','startRouting',_0x43ad13);});}return respondWithRpcPromise(_0x7d5b('0xbe'),_0x7d5b('0xbf'),_0x43ad13);})[_0x7d5b('0x28')](function(_0x5005d1){respondWithRpcPromise(_0x7d5b('0xc0'),_0x7d5b('0xc0'),{'event':_0x7d5b('0x7d'),'message':_0x5005d1},client9002);return _0x5005d1;})[_0x7d5b('0x28')](respondWithResult(_0x370729,null))['catch'](handleError(_0x370729,null));};exports[_0x7d5b('0xc1')]=function(_0x4395fa,_0x4609e2){var _0x7e775,_0xa04144,_0x470f88;var _0x77166d=[];var _0x3e9923={};var _0x4fc613=_0x4395fa[_0x7d5b('0xc2')]||[];var _0xf371ff=[];var _0x3487f3;return db['CmContact'][_0x7d5b('0x57')]()[_0x7d5b('0x28')](function(_0x479458){if(!_0x479458){throw new db[(_0x7d5b('0x89'))][(_0x7d5b('0x8a'))](_0x7d5b('0x83'));}_0x77166d=_[_0x7d5b('0x84')](_[_0x7d5b('0x4c')](_0x479458),['createdAt',_0x7d5b('0x86'),_0x7d5b('0x87'),_0x7d5b('0xc3')]);if(_0x4395fa[_0x7d5b('0x50')]['id']){delete _0x4395fa[_0x7d5b('0x50')]['id'];}if(_[_0x7d5b('0x78')](_0x4395fa[_0x7d5b('0x50')]['from'])){throw _0x4609e2[_0x7d5b('0x20')](0x1f4)['send'](new db[(_0x7d5b('0x89'))][(_0x7d5b('0x8a'))](_0x7d5b('0xc4')));}if(_[_0x7d5b('0x78')](_0x4395fa[_0x7d5b('0x50')]['body'])||_0x4395fa[_0x7d5b('0x50')][_0x7d5b('0x50')]===''){throw _0x4609e2[_0x7d5b('0x20')](0x1f4)[_0x7d5b('0x2f')](new db[(_0x7d5b('0x89'))]['ValidationError'](_0x7d5b('0xc5')));}if(_[_0x7d5b('0x78')](_0x4395fa[_0x7d5b('0x50')]['mapKeyOffline'])){throw _0x4609e2[_0x7d5b('0x20')](0x1f4)[_0x7d5b('0x2f')](new db[(_0x7d5b('0x89'))][(_0x7d5b('0x8a'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x77166d));}if(!_['includes'](_0x77166d,_0x4395fa[_0x7d5b('0x50')][_0x7d5b('0xc6')])){throw _0x4609e2[_0x7d5b('0x20')](0x1f4)['send'](new db[(_0x7d5b('0x89'))]['ValidationError'](_0x7d5b('0xc7')+_0x77166d));}_0x3e9923[_0x4395fa[_0x7d5b('0x50')][_0x7d5b('0xc6')]]=_0x4395fa[_0x7d5b('0x50')][_0x7d5b('0x88')];})['then'](function(){return db[_0x7d5b('0x33')][_0x7d5b('0x4d')]({'where':{'id':_0x4395fa[_0x7d5b('0x4a')]['id']},'include':[{'model':db['CmList'],'as':_0x7d5b('0x8f')},{'model':db[_0x7d5b('0xc8')],'as':'MailAccount'}]});})[_0x7d5b('0x28')](handleEntityNotFound(_0x4609e2,null))['then'](function(_0x1a2e7e){if(_0x1a2e7e&&_0x1a2e7e[_0x7d5b('0x8f')]){_0xa04144=_0x1a2e7e;var _0x564ae6=_[_0x7d5b('0xe')](_0x4395fa[_0x7d5b('0x50')],{'firstName':_0x4395fa[_0x7d5b('0x50')][_0x7d5b('0x88')],'phone':_0x4395fa['body'][_0x7d5b('0x88')],'ListId':_0x1a2e7e[_0x7d5b('0xc3')]});_0x564ae6[_0x4395fa[_0x7d5b('0x50')][_0x7d5b('0xc6')]]=_0x4395fa['body'][_0x7d5b('0x88')];return db[_0x7d5b('0x99')][_0x7d5b('0xc9')]({'where':_0x3e9923,'defaults':_0x564ae6});}})['spread'](function(_0x38a60f){if(_0x38a60f){_0x470f88=_0x38a60f;var _0x231995=fs[_0x7d5b('0xca')](path[_0x7d5b('0x6e')](config[_0x7d5b('0x75')],_0x7d5b('0xcb')),_0x7d5b('0xcc'));var _0x2a267a=ejs[_0x7d5b('0xcd')](_0x231995,{'body':_[_0x7d5b('0xce')](_0x4395fa[_0x7d5b('0x50')][_0x7d5b('0x50')]),'bodyTitle':_0xa04144['offlineMessageBody']});return db[_0x7d5b('0xcf')][_0x7d5b('0x4f')]({'body':_0x2a267a,'plainBody':htmlToText[_0x7d5b('0xd0')](_0x2a267a),'ContactId':_0x38a60f['id'],'ChatWebsiteId':_0xa04144['id']});}})[_0x7d5b('0x28')](function(_0x117f51){_0x3487f3=_0x117f51;if(_0x4fc613[_0x7d5b('0x3e')]){var _0x1d20c4=_0x4fc613[_0x7d5b('0x32')](function(_0x4ed28a){return{'name':_0x4ed28a[_0x7d5b('0xd1')],'basename':_0x4ed28a[_0x7d5b('0x68')],'type':_0x4ed28a[_0x7d5b('0xd2')],'ChatOfflineMessageId':_0x117f51['id']};});_0xf371ff=_0x1d20c4[_0x7d5b('0x32')](_0x429ee8=>{var _0x2b28da={'filename':_0x429ee8[_0x7d5b('0x2e')],'path':path['join'](config['root'],_0x7d5b('0xd3'),'files','attachments','offline-chat',_0x429ee8[_0x7d5b('0xd4')])};return _0x2b28da;});if(!_0xa04144[_0x7d5b('0xd5')]){return db['sequelize']['transaction'](function(_0x3595f8){return db[_0x7d5b('0xd6')][_0x7d5b('0xd7')](_0x1d20c4,{'transaction':_0x3595f8});});}}})['then'](function(){if(_0x3487f3){_0x7e775=_0x3487f3;return db[_0x7d5b('0xc8')][_0x7d5b('0x5a')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x7d5b('0xd8')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x7d5b('0x28')](function(_0x13b06e){if(_0x13b06e&&_0x13b06e[_0x7d5b('0xd9')]&&_0xa04144['forwardOffline']&&_0xa04144['forwardOfflineAddress']){var _0xb9050a=_0x13b06e[_0x7d5b('0xda')]();return respondWithRpcPromise(_0x7d5b('0xdb'),'sendMail',{'account':_0xb9050a,'message':{'from':util[_0x7d5b('0xa6')](_0x7d5b('0xdc'),_0x13b06e[_0x7d5b('0x2e')],_0x13b06e['email']||_0x13b06e[_0x7d5b('0xd9')][_0x7d5b('0x51')]),'to':_0xa04144[_0x7d5b('0xdd')],'subject':_0xa04144['offlineMessageSubject'],'html':_0x7e775['body'],'attachments':_0xf371ff}},client9003)[_0x7d5b('0x28')](function(){return _0x7e775;})['catch'](function(_0x3b5e5b){logger[_0x7d5b('0x1c')](_0x3b5e5b);});}})[_0x7d5b('0x28')](function(){if(_0xa04144&&_0xa04144[_0x7d5b('0xd5')]&&_0xa04144[_0x7d5b('0xde')]){var _0x478e1f=[];if(_0x4fc613[_0x7d5b('0x3e')]){_0x478e1f=_0x4fc613[_0x7d5b('0x32')](function(_0x1b4495){return{'name':_0x1b4495[_0x7d5b('0xd1')],'basename':_0x1b4495[_0x7d5b('0x68')],'type':_0x1b4495['mimetype'],'ChatOfflineMessageId':_0x3487f3['id']};});}var _0x59f835;if(!_[_0x7d5b('0x78')](_0xa04144[_0x7d5b('0xdf')])){var _0x32be09=_['map'](_0x4395fa[_0x7d5b('0x50')],function(_0x2a47b6){return _0x2a47b6;});var _0x15eea5=_['toPairsIn'](_0x32be09)[0x0];var _0xd16589=_[_0x7d5b('0xe0')](_0x15eea5,function(_0x58cc8b){return _0x58cc8b;});_0x59f835=_0xd16589[0x1][_0xa04144[_0x7d5b('0xdf')]];}var _0x33110c={'from':_0x470f88[_0x7d5b('0xe1')],'firstName':_0x470f88[_0x7d5b('0xa0')],'lastName':_0x470f88['lastName'],'mapKey':_0x7d5b('0xe1'),'message':{'from':_0x470f88[_0x7d5b('0xe1')],'to':_0xa04144[_0x7d5b('0xc8')][_0x7d5b('0xe1')],'cc':'','subject':_[_0x7d5b('0x78')](_0x59f835)?_0xa04144['offlineMessageSubject']:_0x59f835,'messageId':'','sentAt':new Date(),'attach':_0x478e1f[_0x7d5b('0x3e')],'attachments':_0x478e1f,'originChannel':_0x7d5b('0xe2'),'ChatWebsiteId':_0xa04144['id'],'ChatOfflineMessageId':_0x7e775['id'],'originTo':_0xa04144[_0x7d5b('0xc8')][_0x7d5b('0xe1')]},'body':_0x7e775[_0x7d5b('0x50')]};var _0x5a25a2={'account':{'id':_0xa04144[_0x7d5b('0xde')]},'body':_0x33110c,'log':_0x7d5b('0xe3')};return respondWithRpcPromise('NotifyMailAccount',_0x7d5b('0xe4'),_0x5a25a2,client9001)[_0x7d5b('0x28')](function(){return _0x7e775;})[_0x7d5b('0x4e')](function(_0xfdb0a){logger[_0x7d5b('0x1c')](_0xfdb0a);});}return;})['then'](function(){if(_0x7e775){return _0x7e775;}})[_0x7d5b('0x28')](respondWithResult(_0x4609e2,null))[_0x7d5b('0x4e')](function(_0x37be22){logger[_0x7d5b('0x1c')]('catch',_0x37be22);for(var _0x5ce4eb of _0x4fc613){var _0x55a8e8=path[_0x7d5b('0x6e')](config[_0x7d5b('0x75')],'server',_0x7d5b('0xc2'),_0x7d5b('0xe5'),'offline-chat',_0x5ce4eb[_0x7d5b('0x68')]);fs_extra[_0x7d5b('0xe6')](_0x55a8e8)['catch'](function(_0x262d91){logger[_0x7d5b('0x1c')]('Could\x20not\x20remove\x20attachment\x20file',_0x55a8e8,_0x262d91);});}});};exports[_0x7d5b('0xe7')]=function(_0x492d9b,_0x1fe7fe){return db[_0x7d5b('0xad')][_0x7d5b('0x4d')]({'where':{'id':_0x492d9b[_0x7d5b('0x4a')]['id']}})[_0x7d5b('0x28')](handleEntityNotFound(_0x1fe7fe,null))[_0x7d5b('0x28')](function(_0x10101a){if(_0x10101a){return _0x10101a[_0x7d5b('0xe7')](_0x492d9b[_0x7d5b('0x50')][_0x7d5b('0x5f')],_['omit'](_0x492d9b[_0x7d5b('0x50')],[_0x7d5b('0x5f'),'id'])||{});}})[_0x7d5b('0x28')](respondWithResult(_0x1fe7fe,null))[_0x7d5b('0x4e')](handleError(_0x1fe7fe,null));};exports[_0x7d5b('0xe8')]=function(_0x4b9b23,_0x2341db){var _0xb0b319={'raw':![],'where':{}};var _0x860997={};var _0x1b7039={'count':0x0,'rows':[]};return db[_0x7d5b('0x33')]['findOne']({'where':{'id':_0x4b9b23['params']['id']}})[_0x7d5b('0x28')](handleEntityNotFound(_0x2341db,null))[_0x7d5b('0x28')](function(_0x59f752){if(_0x59f752){_0x860997['model']=_[_0x7d5b('0x4c')](db['ChatInteraction'][_0x7d5b('0x34')]);_0x860997[_0x7d5b('0x39')]=_[_0x7d5b('0x4c')](_0x4b9b23[_0x7d5b('0x39')]);_0x860997[_0x7d5b('0x3a')]=_[_0x7d5b('0x3b')](_0x860997[_0x7d5b('0x38')],_0x860997['query']);_0xb0b319[_0x7d5b('0x3c')]=_[_0x7d5b('0x3b')](_0x860997['model'],qs['fields'](_0x4b9b23[_0x7d5b('0x39')][_0x7d5b('0x3d')]));_0xb0b319[_0x7d5b('0x3c')]=_0xb0b319[_0x7d5b('0x3c')][_0x7d5b('0x3e')]?_0xb0b319[_0x7d5b('0x3c')]:_0x860997[_0x7d5b('0x38')];if(!_0x4b9b23['query'][_0x7d5b('0x5b')](_0x7d5b('0x3f'))){_0xb0b319['limit']=qs[_0x7d5b('0x25')](_0x4b9b23[_0x7d5b('0x39')][_0x7d5b('0x25')]);_0xb0b319[_0x7d5b('0x23')]=qs['offset'](_0x4b9b23[_0x7d5b('0x39')][_0x7d5b('0x23')]);}_0xb0b319[_0x7d5b('0x40')]=qs[_0x7d5b('0x41')](_0x4b9b23[_0x7d5b('0x39')][_0x7d5b('0x41')]);_0xb0b319['where']=qs['filters'](_['pick'](_0x4b9b23[_0x7d5b('0x39')],_0x860997[_0x7d5b('0x3a')]));_0xb0b319[_0x7d5b('0x42')][_0x7d5b('0x5c')]=_0x59f752['id'];if(_0x4b9b23[_0x7d5b('0x39')][_0x7d5b('0x44')]){_0xb0b319[_0x7d5b('0x42')]=_['merge'](_0xb0b319[_0x7d5b('0x42')],{'$or':_[_0x7d5b('0x32')](_0xb0b319[_0x7d5b('0x3c')],function(_0x26d987){var _0x28b6b1={};_0x28b6b1[_0x26d987]={'$like':'%'+_0x4b9b23[_0x7d5b('0x39')][_0x7d5b('0x44')]+'%'};return _0x28b6b1;})});}_0xb0b319=_[_0x7d5b('0x45')]({},_0xb0b319,_0x4b9b23['options']);return db[_0x7d5b('0xad')]['count']({'where':_0xb0b319[_0x7d5b('0x42')]})[_0x7d5b('0x28')](function(_0x1d4a97){_0x1b7039['count']=_0x1d4a97;if(_0x4b9b23[_0x7d5b('0x39')][_0x7d5b('0x48')]){_0xb0b319[_0x7d5b('0x49')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0x7d5b('0xe9'),'attributes':[_0x7d5b('0x2e'),_0x7d5b('0xea'),_0x7d5b('0xeb')],'required':![]},{'model':db['Tag'],'as':_0x7d5b('0xec'),'attributes':['id',_0x7d5b('0x2e'),_0x7d5b('0xed')],'where':_0x4b9b23['query']['tag']?{'id':_0x4b9b23[_0x7d5b('0x39')][_0x7d5b('0xee')]}:undefined,'required':_0x4b9b23[_0x7d5b('0x39')]['tag']?!![]:![]}];}return db[_0x7d5b('0xad')]['findAll'](_0xb0b319);})[_0x7d5b('0x28')](function(_0x3d5934){_0x1b7039[_0x7d5b('0x5d')]=_0x3d5934;return _0x1b7039;});}})[_0x7d5b('0x28')](respondWithFilteredResult(_0x2341db,_0xb0b319))[_0x7d5b('0x4e')](handleError(_0x2341db,null));};function iftimePromise(_0x1d0840,_0x2653a7){return respondWithRpcPromise(_0x7d5b('0xef'),_0x7d5b('0xf0'),{'command':_0x2653a7[_0x7d5b('0xf1')]?util[_0x7d5b('0xa6')]('iftime\x20%s,%s',_0x1d0840['interval'],_0x2653a7[_0x7d5b('0xf1')]):util[_0x7d5b('0xa6')]('iftime\x20%s',_0x1d0840[_0x7d5b('0xf2')])},client9002)[_0x7d5b('0x28')](function(_0x4b3fc2){var _0x280f2a=_0x4b3fc2&&_0x4b3fc2['indexOf'](_0x7d5b('0xf3'))>=0x0?!![]:![];logger[_0x7d5b('0x17')](_0x7d5b('0xf4'),_0x2653a7['id'],_0x1d0840['id'],_0x1d0840[_0x7d5b('0xf2')],_0x280f2a?_0x7d5b('0xf5'):_0x7d5b('0xf6'),_0x2653a7[_0x7d5b('0xf1')]?_0x2653a7[_0x7d5b('0xf1')]:_0x7d5b('0xf7'));return _0x280f2a;})[_0x7d5b('0x4e')](function(_0x1bb0e8){logger[_0x7d5b('0x1c')](_0x7d5b('0xf4'),_0x2653a7['id'],_0x1d0840['id'],_0x1d0840['interval'],util[_0x7d5b('0xf8')](_0x1bb0e8,{'showHidden':![],'depth':null}),_0x2653a7[_0x7d5b('0xf1')]?_0x2653a7[_0x7d5b('0xf1')]:_0x7d5b('0xf7'));return![];});}exports[_0x7d5b('0xf0')]=function(_0x3aaae9,_0x5d6acd){var _0x22180e=0x0;var _0x57f20b=0x0;var _0xecbc42=![];var _0x1e5386;var _0x1b4764;return db[_0x7d5b('0x33')][_0x7d5b('0x4d')]({'where':{'id':_0x3aaae9['params']['id']},'include':[{'model':db[_0x7d5b('0xf9')],'as':_0x7d5b('0xf9'),'include':[{'model':db[_0x7d5b('0xf9')],'as':_0x7d5b('0xfa'),'attributes':['id',_0x7d5b('0xf2')],'raw':!![]}]}]})[_0x7d5b('0x28')](handleEntityNotFound(_0x5d6acd,null))['then'](function(_0x13cb1b){if(_0x13cb1b){_0x1e5386=_0x13cb1b;return _0x13cb1b['getProactiveActions']({'raw':!![]});}})[_0x7d5b('0x28')](function(_0x21a496){if(_0x1e5386){if(_0x21a496){_0x1b4764=_0x21a496;}}return require(_0x7d5b('0x70'))['getLicense']();})[_0x7d5b('0x28')](function(_0x1a396b){if(_0x1a396b){_0x57f20b=_0x1a396b[_0x7d5b('0xfb')];_0xecbc42=_0x1a396b['custom'];}})[_0x7d5b('0x28')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0x7d5b('0x28')](function(_0x751045){_0x22180e=_0x751045;if(_0x57f20b&&_0x751045>_0x57f20b){return db[_0x7d5b('0xfc')][_0x7d5b('0x5a')]({'where':{'id':0x1}})[_0x7d5b('0x28')](function(_0x435a9b){if(_0x435a9b){_0x435a9b[_0x7d5b('0xfd')](_0x7d5b('0xfe'));}});}})[_0x7d5b('0x28')](function(){if(_0x1e5386[_0x7d5b('0xf9')]&&_0x1e5386['Interval']['Intervals']){var _0x52354e=[];for(var _0x465a48=0x0;_0x465a48<_0x1e5386[_0x7d5b('0xf9')][_0x7d5b('0xfa')]['length'];_0x465a48++){var _0x3fb163=_0x1e5386[_0x7d5b('0xf9')]['Intervals'][_0x465a48][_0x7d5b('0x29')]({'plain':!![]});_0x52354e[_0x7d5b('0xb4')](iftimePromise(_0x3fb163,_0x1e5386));}return BPromise['all'](_0x52354e)['then'](function(_0x489fa6){return _[_0x7d5b('0xff')](_0x489fa6);});}else{return!![];}})[_0x7d5b('0x28')](function(_0x4461e1){var _0x27aa15=fs[_0x7d5b('0xca')](path[_0x7d5b('0x6e')](config[_0x7d5b('0x75')],'server/files/chat/iframe.ejs'),'utf8');var _0x26902f={'remote':_0x1e5386[_0x7d5b('0x100')],'query':querystring[_0x7d5b('0x1b')](_[_0x7d5b('0x45')](_0x1e5386[_0x7d5b('0x29')]({'plain':!![]}),{'customerIp':_0x3aaae9[_0x7d5b('0x7f')][_0x7d5b('0x9d')]||_0x3aaae9[_0x7d5b('0x7f')][_0x7d5b('0x101')]||_0x3aaae9[_0x7d5b('0x102')][_0x7d5b('0x103')]||_0x3aaae9['ip'],'referer':_0x3aaae9[_0x7d5b('0x7f')][_0x7d5b('0xa3')],'openedInteractions':_0x22180e,'maxInteractions':_0x57f20b,'virtual':_0xecbc42[_0x7d5b('0xfb')],'online':_0x4461e1,'custom':_0xecbc42}))[_0x7d5b('0x104')](/'/g,'\x5c\x27')};_0x5d6acd[_0x7d5b('0x2f')](ejs['render'](Mustache[_0x7d5b('0xcd')](_0x27aa15,_0x26902f),{'proactiveActions':_0x1b4764,'alignment':_0x1e5386[_0x7d5b('0x105')],'verticalAlignment':_0x1e5386[_0x7d5b('0x106')],'div_color':_0x1e5386[_0x7d5b('0xed')],'labelText':_0x1e5386[_0x7d5b('0x107')],'text_color':_0x1e5386[_0x7d5b('0x108')],'text_button_color':_0x1e5386[_0x7d5b('0x109')],'button_color':_0x1e5386['color_button'],'background_color':_0x1e5386[_0x7d5b('0x10a')],'hideWhenOffline':_0x1e5386[_0x7d5b('0x10b')],'interval':_0x1e5386[_0x7d5b('0x10c')]}));})['catch'](handleError(_0x5d6acd,null));};exports['addApplications']=function(_0x5b50f1,_0x413094){var _0x126ddd=_0x5b50f1[_0x7d5b('0x4a')]['id'];var _0x106afb=_0x5b50f1['body'];var _0x2de2ce=0xc8;var _0x502704=null;return db[_0x7d5b('0x10d')][_0x7d5b('0x10e')]({'isolationLevel':db['sequelize'][_0x7d5b('0x10f')][_0x7d5b('0x110')]['READ_COMMITTED']},function(_0x155d5e){return db[_0x7d5b('0x33')][_0x7d5b('0x5a')]({'where':{'id':_0x126ddd},'transaction':_0x155d5e})[_0x7d5b('0x28')](function(_0x132c68){if(_0x132c68){return db[_0x7d5b('0x92')]['destroy']({'where':{'ChatWebsiteId':_0x126ddd},'transaction':_0x155d5e})[_0x7d5b('0x28')](function(){var _0x478aed=_['map'](_0x106afb,function(_0xc33e94){_0xc33e94[_0x7d5b('0x5c')]=_0x126ddd;return _0xc33e94;});return db[_0x7d5b('0x92')][_0x7d5b('0xd7')](_0x478aed,{'transaction':_0x155d5e});});}else{_0x2de2ce=0x194;_0x502704=[];}});})['then'](function(){if(_0x2de2ce!==0x194){return db[_0x7d5b('0x92')][_0x7d5b('0x111')]({'where':{'ChatWebsiteId':_0x126ddd},'order':_0x7d5b('0x98')})[_0x7d5b('0x28')](function(_0x4d5bbb){_0x502704=_0x4d5bbb;});}})[_0x7d5b('0x4e')](function(_0x4cdc91){_0x2de2ce=0x1f4;logger[_0x7d5b('0x1c')](_0x4cdc91[_0x7d5b('0x2d')]);if(_0x4cdc91[_0x7d5b('0x2e')]){delete _0x4cdc91[_0x7d5b('0x2e')];}_0x502704=_0x4cdc91;})[_0x7d5b('0x112')](function(){if(_0x502704===null){_0x413094[_0x7d5b('0x1f')](_0x2de2ce);}else{if(_0x2de2ce===0x1f4){_0x413094[_0x7d5b('0x20')](_0x2de2ce)[_0x7d5b('0x2f')](_0x502704);}else{_0x413094[_0x7d5b('0x20')](_0x2de2ce)['json'](_0x502704);}}});};exports['getApplications']=function(_0x1a4321,_0x5114f1){var _0x25efc9={};var _0x2d05a4={};var _0x5da40f;var _0xa9f75;return db[_0x7d5b('0x33')][_0x7d5b('0x5a')]({'where':{'id':_0x1a4321['params']['id']}})[_0x7d5b('0x28')](handleEntityNotFound(_0x5114f1,null))[_0x7d5b('0x28')](function(_0x91fcc4){if(_0x91fcc4){_0x5da40f=_0x91fcc4;_0x2d05a4[_0x7d5b('0x38')]=_[_0x7d5b('0x4c')](db['ChatApplication'][_0x7d5b('0x34')]);_0x2d05a4[_0x7d5b('0x39')]=_[_0x7d5b('0x4c')](_0x1a4321['query']);_0x2d05a4[_0x7d5b('0x3a')]=_[_0x7d5b('0x3b')](_0x2d05a4[_0x7d5b('0x38')],_0x2d05a4[_0x7d5b('0x39')]);_0x25efc9['attributes']=_['intersection'](_0x2d05a4[_0x7d5b('0x38')],qs[_0x7d5b('0x3d')](_0x1a4321[_0x7d5b('0x39')][_0x7d5b('0x3d')]));_0x25efc9[_0x7d5b('0x3c')]=_0x25efc9[_0x7d5b('0x3c')]['length']?_0x25efc9['attributes']:_0x2d05a4[_0x7d5b('0x38')];_0x25efc9[_0x7d5b('0x40')]=qs[_0x7d5b('0x41')](_0x1a4321[_0x7d5b('0x39')][_0x7d5b('0x41')]);_0x25efc9[_0x7d5b('0x42')]=qs[_0x7d5b('0x3a')](_[_0x7d5b('0x43')](_0x1a4321[_0x7d5b('0x39')],_0x2d05a4[_0x7d5b('0x3a')]));if(_0x1a4321['query'][_0x7d5b('0x44')]){_0x25efc9['where']=_[_0x7d5b('0x45')](_0x25efc9[_0x7d5b('0x42')],{'$or':_['map'](_0x25efc9['attributes'],function(_0x5a7f89){var _0x20b10b={};_0x20b10b[_0x5a7f89]={'$like':'%'+_0x1a4321[_0x7d5b('0x39')][_0x7d5b('0x44')]+'%'};return _0x20b10b;})});}_0x25efc9=_[_0x7d5b('0x45')]({},_0x25efc9,_0x1a4321[_0x7d5b('0x47')]);return _0x5da40f[_0x7d5b('0x113')](_0x25efc9);}})[_0x7d5b('0x28')](function(_0x11c285){if(_0x11c285){_0xa9f75=_0x11c285[_0x7d5b('0x3e')];if(!_0x1a4321['query'][_0x7d5b('0x5b')](_0x7d5b('0x3f'))){_0x25efc9[_0x7d5b('0x25')]=qs[_0x7d5b('0x25')](_0x1a4321[_0x7d5b('0x39')][_0x7d5b('0x25')]);_0x25efc9[_0x7d5b('0x23')]=qs['offset'](_0x1a4321[_0x7d5b('0x39')][_0x7d5b('0x23')]);}return _0x5da40f[_0x7d5b('0x113')](_0x25efc9);}})[_0x7d5b('0x28')](function(_0x35ffa5){if(_0x35ffa5){return _0x35ffa5?{'count':_0xa9f75,'rows':_0x35ffa5}:null;}})[_0x7d5b('0x28')](respondWithResult(_0x5114f1,null))[_0x7d5b('0x4e')](handleError(_0x5114f1,null));};exports[_0x7d5b('0x114')]=function(_0x319b47,_0x5684a8){return db['chatProactiveAction']['find']({'where':{'id':_0x319b47[_0x7d5b('0x4a')]['id']}})[_0x7d5b('0x28')](handleEntityNotFound(_0x5684a8,null))[_0x7d5b('0x28')](function(_0x128aec){if(_0x128aec){return _0x128aec[_0x7d5b('0x114')](_0x319b47[_0x7d5b('0x50')]['ids'],_[_0x7d5b('0x115')](_0x319b47[_0x7d5b('0x50')],[_0x7d5b('0x5f'),'id'])||{});}})[_0x7d5b('0x28')](respondWithResult(_0x5684a8,null))[_0x7d5b('0x4e')](handleError(_0x5684a8,null));};exports[_0x7d5b('0x116')]=function(_0x5aceef,_0x3e9602){var _0x118ff9={};var _0x15b6a6={};var _0x1c0ec9;var _0x23f666;return db[_0x7d5b('0x33')]['findOne']({'where':{'id':_0x5aceef[_0x7d5b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3e9602,null))[_0x7d5b('0x28')](function(_0x20e26c){if(_0x20e26c){_0x1c0ec9=_0x20e26c;_0x15b6a6[_0x7d5b('0x38')]=_['keys'](db['ChatProactiveAction'][_0x7d5b('0x34')]);_0x15b6a6[_0x7d5b('0x39')]=_[_0x7d5b('0x4c')](_0x5aceef[_0x7d5b('0x39')]);_0x15b6a6[_0x7d5b('0x3a')]=_[_0x7d5b('0x3b')](_0x15b6a6['model'],_0x15b6a6[_0x7d5b('0x39')]);_0x118ff9[_0x7d5b('0x3c')]=_[_0x7d5b('0x3b')](_0x15b6a6[_0x7d5b('0x38')],qs['fields'](_0x5aceef[_0x7d5b('0x39')]['fields']));_0x118ff9['attributes']=_0x118ff9['attributes']['length']?_0x118ff9[_0x7d5b('0x3c')]:_0x15b6a6['model'];_0x118ff9[_0x7d5b('0x40')]=qs[_0x7d5b('0x41')](_0x5aceef[_0x7d5b('0x39')][_0x7d5b('0x41')]);_0x118ff9['where']=qs[_0x7d5b('0x3a')](_[_0x7d5b('0x43')](_0x5aceef[_0x7d5b('0x39')],_0x15b6a6[_0x7d5b('0x3a')]));if(_0x5aceef[_0x7d5b('0x39')][_0x7d5b('0x44')]){_0x118ff9[_0x7d5b('0x42')]=_[_0x7d5b('0x45')](_0x118ff9[_0x7d5b('0x42')],{'$or':_[_0x7d5b('0x32')](_0x118ff9[_0x7d5b('0x3c')],function(_0x543330){var _0x237044={};_0x237044[_0x543330]={'$like':'%'+_0x5aceef[_0x7d5b('0x39')][_0x7d5b('0x44')]+'%'};return _0x237044;})});}_0x118ff9=_['merge']({},_0x118ff9,_0x5aceef[_0x7d5b('0x47')]);return _0x1c0ec9[_0x7d5b('0x116')](_0x118ff9);}})['then'](function(_0x59ef6f){if(_0x59ef6f){_0x23f666=_0x59ef6f[_0x7d5b('0x3e')];if(!_0x5aceef[_0x7d5b('0x39')][_0x7d5b('0x5b')](_0x7d5b('0x3f'))){_0x118ff9['limit']=qs['limit'](_0x5aceef['query']['limit']);_0x118ff9[_0x7d5b('0x23')]=qs[_0x7d5b('0x23')](_0x5aceef[_0x7d5b('0x39')][_0x7d5b('0x23')]);}return _0x1c0ec9[_0x7d5b('0x116')](_0x118ff9);}})['then'](function(_0x529bfd){if(_0x529bfd){return _0x529bfd?{'count':_0x23f666,'rows':_0x529bfd}:null;}})[_0x7d5b('0x28')](respondWithResult(_0x3e9602,null))['catch'](handleError(_0x3e9602,null));};exports['getFields']=function(_0x50b66e,_0x543a57){var _0x1f22f3=_0x50b66e[_0x7d5b('0x39')][_0x7d5b('0x117')]===_0x7d5b('0x118')?_0x7d5b('0x119'):_0x7d5b('0x11a');return db[_0x7d5b('0x33')][_0x7d5b('0x4d')]({'attributes':['id',_0x1f22f3],'where':{'id':_0x50b66e[_0x7d5b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x543a57,null))['then'](function(_0x2afb50){if(_0x2afb50){var _0xc41c9e=_0x2afb50[_0x1f22f3];var _0x47a638=_0xc41c9e&&_0xc41c9e[_0x7d5b('0x11b')]?_0xc41c9e[_0x7d5b('0x11b')]:[];_0x543a57[_0x7d5b('0x2f')]({'fromKey':_[_0x7d5b('0x78')](_0xc41c9e[_0x7d5b('0x11c')])?undefined:_0xc41c9e[_0x7d5b('0x11c')],'count':_0x47a638[_0x7d5b('0x3e')],'rows':_0x47a638});}})[_0x7d5b('0x4e')](handleError(_0x543a57,null));};exports[_0x7d5b('0x11d')]=function(_0x4d4d03,_0x3bffb5){var _0x86c9c7={'raw':![],'where':{}};var _0x33f3f0={};var _0x4c0f8c={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x7d5b('0x5a')]({'where':{'id':_0x4d4d03['params']['id']}})[_0x7d5b('0x28')](handleEntityNotFound(_0x3bffb5,null))[_0x7d5b('0x28')](function(_0x17f41a){if(_0x17f41a){_0x33f3f0['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x33f3f0[_0x7d5b('0x39')]=_[_0x7d5b('0x4c')](_0x4d4d03['query']);_0x33f3f0[_0x7d5b('0x3a')]=_[_0x7d5b('0x3b')](_0x33f3f0[_0x7d5b('0x38')],_0x33f3f0['query']);_0x86c9c7[_0x7d5b('0x3c')]=_['intersection'](_0x33f3f0[_0x7d5b('0x38')],qs['fields'](_0x4d4d03[_0x7d5b('0x39')][_0x7d5b('0x3d')]));_0x86c9c7[_0x7d5b('0x3c')]=_0x86c9c7[_0x7d5b('0x3c')][_0x7d5b('0x3e')]?_0x86c9c7[_0x7d5b('0x3c')]:_0x33f3f0[_0x7d5b('0x38')];if(!_0x4d4d03[_0x7d5b('0x39')][_0x7d5b('0x5b')]('nolimit')){_0x86c9c7[_0x7d5b('0x25')]=qs[_0x7d5b('0x25')](_0x4d4d03[_0x7d5b('0x39')][_0x7d5b('0x25')]);_0x86c9c7[_0x7d5b('0x23')]=qs['offset'](_0x4d4d03[_0x7d5b('0x39')][_0x7d5b('0x23')]);}_0x86c9c7[_0x7d5b('0x40')]=qs[_0x7d5b('0x41')](_0x4d4d03['query'][_0x7d5b('0x41')]);_0x86c9c7[_0x7d5b('0x42')]=qs[_0x7d5b('0x3a')](_[_0x7d5b('0x43')](_0x4d4d03['query'],_0x33f3f0[_0x7d5b('0x3a')]));_0x86c9c7[_0x7d5b('0x42')][_0x7d5b('0x5c')]=_0x17f41a['id'];if(_0x4d4d03['query'][_0x7d5b('0x44')]){_0x86c9c7[_0x7d5b('0x42')]=_[_0x7d5b('0x45')](_0x86c9c7[_0x7d5b('0x42')],{'$or':_[_0x7d5b('0x32')](_0x86c9c7[_0x7d5b('0x3c')],function(_0x366d6a){var _0x38141f={};_0x38141f[_0x366d6a]={'$like':'%'+_0x4d4d03[_0x7d5b('0x39')][_0x7d5b('0x44')]+'%'};return _0x38141f;})});}_0x86c9c7=_[_0x7d5b('0x45')]({},_0x86c9c7,_0x4d4d03[_0x7d5b('0x47')]);return db[_0x7d5b('0xcf')][_0x7d5b('0x26')]({'where':_0x86c9c7[_0x7d5b('0x42')]})[_0x7d5b('0x28')](function(_0x2453b3){_0x4c0f8c[_0x7d5b('0x26')]=_0x2453b3;if(_0x4d4d03[_0x7d5b('0x39')][_0x7d5b('0x48')]){_0x86c9c7[_0x7d5b('0x49')]=[{'all':!![]}];}else{_0x86c9c7[_0x7d5b('0x49')]=[{'model':db[_0x7d5b('0x99')],'as':'Contact','required':![]},{'model':db[_0x7d5b('0xd6')],'as':_0x7d5b('0x11e'),'required':![]}];}return db[_0x7d5b('0xcf')]['findAll'](_0x86c9c7);})[_0x7d5b('0x28')](function(_0x36ff00){_0x4c0f8c[_0x7d5b('0x5d')]=_0x36ff00;return _0x4c0f8c;});}})[_0x7d5b('0x28')](respondWithFilteredResult(_0x3bffb5,_0x86c9c7))[_0x7d5b('0x4e')](handleError(_0x3bffb5,null));};exports[_0x7d5b('0x11f')]=function(_0x5efe6f,_0x8067e1){return db[_0x7d5b('0x33')][_0x7d5b('0x4d')]({'where':{'id':_0x5efe6f['params']['id']}})['then'](handleEntityNotFound(_0x8067e1,null))['then'](function(_0x4ecb2a){if(_0x4ecb2a){return _0x4ecb2a[_0x7d5b('0x11f')](_0x5efe6f['body']['ids'],_[_0x7d5b('0x115')](_0x5efe6f['body'],[_0x7d5b('0x5f'),'id'])||{})[_0x7d5b('0xb0')](function(_0xfc4ab3){for(var _0x5eaf8f=0x0;_0x5eaf8f<_0x5efe6f['body'][_0x7d5b('0x5f')][_0x7d5b('0x3e')];_0x5eaf8f+=0x1){socket[_0x7d5b('0x120')]('userChatWebsite:save',{'UserId':Number(_0x5efe6f[_0x7d5b('0x50')]['ids'][_0x5eaf8f]),'ChatWebsiteId':Number(_0x5efe6f[_0x7d5b('0x4a')]['id'])});}return _0xfc4ab3;});}})[_0x7d5b('0x28')](respondWithResult(_0x8067e1,null))[_0x7d5b('0x4e')](handleError(_0x8067e1,null));};exports[_0x7d5b('0x121')]=function(_0x1a5f46,_0x577aa3){return db['ChatWebsite']['find']({'where':{'id':_0x1a5f46[_0x7d5b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x577aa3,null))['then'](function(_0x3cb5a4){if(_0x3cb5a4){return _0x3cb5a4[_0x7d5b('0x121')](_0x1a5f46[_0x7d5b('0x39')][_0x7d5b('0x5f')])['then'](function(){if(_['isArray'](_0x1a5f46[_0x7d5b('0x39')][_0x7d5b('0x5f')])){for(var _0x395904=0x0;_0x395904<_0x1a5f46[_0x7d5b('0x39')]['ids']['length'];_0x395904+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x1a5f46[_0x7d5b('0x39')][_0x7d5b('0x5f')][_0x395904]),'ChatWebsiteId':Number(_0x1a5f46[_0x7d5b('0x4a')]['id'])});}}else{socket[_0x7d5b('0x120')]('userChatWebsite:remove',{'UserId':Number(_0x1a5f46['query'][_0x7d5b('0x5f')]),'ChatWebsiteId':Number(_0x1a5f46['params']['id'])});}});}})[_0x7d5b('0x28')](respondWithStatusCode(_0x577aa3,null))[_0x7d5b('0x4e')](handleError(_0x577aa3,null));};exports[_0x7d5b('0x122')]=function(_0x191386,_0x5cd5ea){var _0x81f8c2={};var _0x56638d={};var _0x4867e0;var _0x263bfb;return db[_0x7d5b('0x33')]['findOne']({'where':{'id':_0x191386['params']['id']}})[_0x7d5b('0x28')](handleEntityNotFound(_0x5cd5ea,null))[_0x7d5b('0x28')](function(_0xcf8fe1){if(_0xcf8fe1){_0x4867e0=_0xcf8fe1;_0x56638d[_0x7d5b('0x38')]=_[_0x7d5b('0x4c')](db[_0x7d5b('0xb9')][_0x7d5b('0x34')]);_0x56638d[_0x7d5b('0x39')]=_[_0x7d5b('0x4c')](_0x191386[_0x7d5b('0x39')]);_0x56638d[_0x7d5b('0x3a')]=_['intersection'](_0x56638d[_0x7d5b('0x38')],_0x56638d[_0x7d5b('0x39')]);_0x81f8c2[_0x7d5b('0x3c')]=_[_0x7d5b('0x3b')](_0x56638d[_0x7d5b('0x38')],qs[_0x7d5b('0x3d')](_0x191386[_0x7d5b('0x39')]['fields']));_0x81f8c2[_0x7d5b('0x3c')]=_0x81f8c2[_0x7d5b('0x3c')][_0x7d5b('0x3e')]?_0x81f8c2['attributes']:_0x56638d[_0x7d5b('0x38')];_0x81f8c2[_0x7d5b('0x40')]=qs[_0x7d5b('0x41')](_0x191386['query'][_0x7d5b('0x41')]);_0x81f8c2[_0x7d5b('0x42')]=qs['filters'](_[_0x7d5b('0x43')](_0x191386['query'],_0x56638d['filters']));if(_0x191386[_0x7d5b('0x39')][_0x7d5b('0x44')]){_0x81f8c2[_0x7d5b('0x42')]=_[_0x7d5b('0x45')](_0x81f8c2[_0x7d5b('0x42')],{'$or':_['map'](_0x81f8c2[_0x7d5b('0x3c')],function(_0x641bc4){var _0x419a35={};_0x419a35[_0x641bc4]={'$like':'%'+_0x191386['query'][_0x7d5b('0x44')]+'%'};return _0x419a35;})});}_0x81f8c2=_[_0x7d5b('0x45')]({},_0x81f8c2,_0x191386['options']);return _0x4867e0[_0x7d5b('0x122')](_0x81f8c2);}})[_0x7d5b('0x28')](function(_0x3e7ff6){if(_0x3e7ff6){_0x263bfb=_0x3e7ff6[_0x7d5b('0x3e')];if(!_0x191386['query'][_0x7d5b('0x5b')](_0x7d5b('0x3f'))){_0x81f8c2[_0x7d5b('0x25')]=qs[_0x7d5b('0x25')](_0x191386['query'][_0x7d5b('0x25')]);_0x81f8c2[_0x7d5b('0x23')]=qs[_0x7d5b('0x23')](_0x191386[_0x7d5b('0x39')]['offset']);}return _0x4867e0['getAgents'](_0x81f8c2);}})[_0x7d5b('0x28')](function(_0x5e7b5a){if(_0x5e7b5a){return _0x5e7b5a?{'count':_0x263bfb,'rows':_0x5e7b5a}:null;}})[_0x7d5b('0x28')](respondWithResult(_0x5cd5ea,null))[_0x7d5b('0x4e')](handleError(_0x5cd5ea,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 34f4b92..489d542 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 _0x6dac=['save','update','remove','emit','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x43233b,_0x556240){var _0x2d6014=function(_0x140a16){while(--_0x140a16){_0x43233b['push'](_0x43233b['shift']());}};_0x2d6014(++_0x556240);}(_0x6dac,0x16e));var _0xc6da=function(_0x33bccf,_0x2809fa){_0x33bccf=_0x33bccf-0x0;var _0x3dba4e=_0x6dac[_0x33bccf];return _0x3dba4e;};'use strict';var EventEmitter=require(_0xc6da('0x0'));var ChatWebsite=require(_0xc6da('0x1'))['db'][_0xc6da('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xc6da('0x3')](0x0);var events={'afterCreate':_0xc6da('0x4'),'afterUpdate':_0xc6da('0x5'),'afterDestroy':_0xc6da('0x6')};function emitEvent(_0x2fc6e0){return function(_0x28663f,_0x338470,_0x18ee4e){ChatWebsiteEvents[_0xc6da('0x7')](_0x2fc6e0+':'+_0x28663f['id'],_0x28663f);ChatWebsiteEvents[_0xc6da('0x7')](_0x2fc6e0,_0x28663f);_0x18ee4e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xc6da('0x8')](e,emitEvent(event));}}module[_0xc6da('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0xf350=['hasOwnProperty','hook','events','setMaxListeners','save','update','remove'];(function(_0x3a1256,_0x1fe2db){var _0x1bd352=function(_0x509c54){while(--_0x509c54){_0x3a1256['push'](_0x3a1256['shift']());}};_0x1bd352(++_0x1fe2db);}(_0xf350,0x105));var _0x0f35=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf350[_0x57b54c];return _0x59cc19;};'use strict';var EventEmitter=require(_0x0f35('0x0'));var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x0f35('0x1')](0x0);var events={'afterCreate':_0x0f35('0x2'),'afterUpdate':_0x0f35('0x3'),'afterDestroy':_0x0f35('0x4')};function emitEvent(_0xf411f3){return function(_0x42652f,_0x25060b,_0x4ee889){ChatWebsiteEvents['emit'](_0xf411f3+':'+_0x42652f['id'],_0x42652f);ChatWebsiteEvents['emit'](_0xf411f3,_0x42652f);_0x4ee889(null);};}for(var e in events){if(events[_0x0f35('0x5')](e)){var event=events[e];ChatWebsite[_0x0f35('0x6')](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 c6f5792..2ea7475 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 _0x3a08=['util','api','bluebird','rimraf','../../config/environment','exports','ChatWebsite','chat_websites','lodash'];(function(_0x2b76de,_0x2c174c){var _0x4bbf3e=function(_0x422977){while(--_0x422977){_0x2b76de['push'](_0x2b76de['shift']());}};_0x4bbf3e(++_0x2c174c);}(_0x3a08,0x1ca));var _0x83a0=function(_0x179e98,_0xdc217d){_0x179e98=_0x179e98-0x0;var _0x4f5e7e=_0x3a08[_0x179e98];return _0x4f5e7e;};'use strict';var _=require(_0x83a0('0x0'));var util=require(_0x83a0('0x1'));var logger=require('../../config/logger')(_0x83a0('0x2'));var moment=require('moment');var BPromise=require(_0x83a0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x83a0('0x4'));var config=require(_0x83a0('0x5'));var attributes=require('./chatWebsite.attributes');module[_0x83a0('0x6')]=function(_0x24cf5d,_0x2261c5){return _0x24cf5d['define'](_0x83a0('0x7'),attributes,{'tableName':_0x83a0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x847d=['../../config/logger','api','moment','request-promise','path','../../config/environment','ChatWebsite','chat_websites','util'];(function(_0x157ba4,_0x13a7b7){var _0x5e3bb3=function(_0x329b71){while(--_0x329b71){_0x157ba4['push'](_0x157ba4['shift']());}};_0x5e3bb3(++_0x13a7b7);}(_0x847d,0x1b8));var _0xd847=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x847d[_0x59befa];return _0x1dd63d;};'use strict';var _=require('lodash');var util=require(_0xd847('0x0'));var logger=require(_0xd847('0x1'))(_0xd847('0x2'));var moment=require(_0xd847('0x3'));var BPromise=require('bluebird');var rp=require(_0xd847('0x4'));var fs=require('fs');var path=require(_0xd847('0x5'));var rimraf=require('rimraf');var config=require(_0xd847('0x6'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x4a321a,_0x2e0d17){return _0x4a321a['define'](_0xd847('0x7'),attributes,{'tableName':_0xd847('0x8'),'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 0026f3b..6fbb209 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 _0x695c=['client','redis','localhost','socket.io-emitter','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x267d42,_0x4e6dd6){var _0x3a1861=function(_0x1cab5a){while(--_0x1cab5a){_0x267d42['push'](_0x267d42['shift']());}};_0x3a1861(++_0x4e6dd6);}(_0x695c,0x149));var _0xc695=function(_0x5d9dfb,_0x2f0680){_0x5d9dfb=_0x5d9dfb-0x0;var _0xdd3e6d=_0x695c[_0x5d9dfb];return _0xdd3e6d;};'use strict';var _=require('lodash');var util=require(_0xc695('0x0'));var moment=require(_0xc695('0x1'));var BPromise=require(_0xc695('0x2'));var rs=require(_0xc695('0x3'));var fs=require('fs');var Redis=require(_0xc695('0x4'));var db=require(_0xc695('0x5'))['db'];var utils=require(_0xc695('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc695('0x7'));var jayson=require(_0xc695('0x8'));var client=jayson[_0xc695('0x9')]['http']({'port':0x232a});config[_0xc695('0xa')]=_['defaults'](config[_0xc695('0xa')],{'host':_0xc695('0xb'),'port':0x18eb});var socket=require(_0xc695('0xc'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0xc695('0xd')](socket);function respondWithRpcPromise(_0x181346,_0x1050ae,_0x39d676){return new BPromise(function(_0xa0e64e,_0x300727){return client[_0xc695('0xe')](_0x181346,_0x39d676)[_0xc695('0xf')](function(_0x1e8e67){logger[_0xc695('0x10')](_0xc695('0x11'),_0x1050ae,_0xc695('0x12'));logger[_0xc695('0x13')](_0xc695('0x14'),_0x1050ae,'request\x20sent',JSON[_0xc695('0x15')](_0x1e8e67));if(_0x1e8e67['error']){if(_0x1e8e67[_0xc695('0x16')][_0xc695('0x17')]===0x1f4){logger[_0xc695('0x16')](_0xc695('0x11'),_0x1050ae,_0x1e8e67[_0xc695('0x16')][_0xc695('0x18')]);return _0x300727(_0x1e8e67['error'][_0xc695('0x18')]);}logger[_0xc695('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x1050ae,_0x1e8e67[_0xc695('0x16')][_0xc695('0x18')]);return _0xa0e64e(_0x1e8e67['error'][_0xc695('0x18')]);}else{logger['info'](_0xc695('0x11'),_0x1050ae,'request\x20sent');_0xa0e64e(_0x1e8e67[_0xc695('0x19')][_0xc695('0x18')]);}})['catch'](function(_0x100a02){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x1050ae,_0x100a02);_0x300727(_0x100a02);});});} \ No newline at end of file +var _0x1548=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','localhost','redis','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x151262,_0x3fd888){var _0x2ec73e=function(_0x13d608){while(--_0x13d608){_0x151262['push'](_0x151262['shift']());}};_0x2ec73e(++_0x3fd888);}(_0x1548,0xa4));var _0x8154=function(_0x24052a,_0x4d4e69){_0x24052a=_0x24052a-0x0;var _0x595386=_0x1548[_0x24052a];return _0x595386;};'use strict';var _=require(_0x8154('0x0'));var util=require(_0x8154('0x1'));var moment=require(_0x8154('0x2'));var BPromise=require(_0x8154('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8154('0x4'))['db'];var utils=require(_0x8154('0x5'));var logger=require(_0x8154('0x6'))(_0x8154('0x7'));var config=require(_0x8154('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8154('0x9')][_0x8154('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x8154('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8154('0xc')]));require(_0x8154('0xd'))[_0x8154('0xe')](socket);function respondWithRpcPromise(_0x24a909,_0x1e5814,_0x25970b){return new BPromise(function(_0x34135e,_0x2ced47){return client[_0x8154('0xf')](_0x24a909,_0x25970b)[_0x8154('0x10')](function(_0x5aea19){logger['info'](_0x8154('0x11'),_0x1e5814,_0x8154('0x12'));logger[_0x8154('0x13')](_0x8154('0x14'),_0x1e5814,_0x8154('0x12'),JSON[_0x8154('0x15')](_0x5aea19));if(_0x5aea19['error']){if(_0x5aea19[_0x8154('0x16')][_0x8154('0x17')]===0x1f4){logger[_0x8154('0x16')](_0x8154('0x11'),_0x1e5814,_0x5aea19[_0x8154('0x16')][_0x8154('0x18')]);return _0x2ced47(_0x5aea19[_0x8154('0x16')]['message']);}logger[_0x8154('0x16')](_0x8154('0x11'),_0x1e5814,_0x5aea19[_0x8154('0x16')][_0x8154('0x18')]);return _0x34135e(_0x5aea19[_0x8154('0x16')]['message']);}else{logger['info'](_0x8154('0x11'),_0x1e5814,_0x8154('0x12'));_0x34135e(_0x5aea19[_0x8154('0x19')][_0x8154('0x18')]);}})[_0x8154('0x1a')](function(_0x35bce4){logger[_0x8154('0x16')](_0x8154('0x11'),_0x1e5814,_0x35bce4);_0x2ced47(_0x35bce4);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 7284b4e..1715ef6 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 _0x3dda=['./chatWebsite.events','save','remove','update','removeListener','register','length'];(function(_0x2341c6,_0x3af092){var _0x54c34d=function(_0x3091f9){while(--_0x3091f9){_0x2341c6['push'](_0x2341c6['shift']());}};_0x54c34d(++_0x3af092);}(_0x3dda,0xe7));var _0xa3dd=function(_0x4e6b3c,_0x2ad9db){_0x4e6b3c=_0x4e6b3c-0x0;var _0x344aaf=_0x3dda[_0x4e6b3c];return _0x344aaf;};'use strict';var ChatWebsiteEvents=require(_0xa3dd('0x0'));var events=[_0xa3dd('0x1'),_0xa3dd('0x2'),_0xa3dd('0x3')];function createListener(_0x30758a,_0x516296){return function(_0x245a68){_0x516296['emit'](_0x30758a,_0x245a68);};}function removeListener(_0x3eb586,_0x8c25b8){return function(){ChatWebsiteEvents[_0xa3dd('0x4')](_0x3eb586,_0x8c25b8);};}exports[_0xa3dd('0x5')]=function(_0x2288e6){for(var _0x25f16b=0x0,_0x299791=events[_0xa3dd('0x6')];_0x25f16b<_0x299791;_0x25f16b++){var _0x80c741=events[_0x25f16b];var _0x4f0539=createListener('chatWebsite:'+_0x80c741,_0x2288e6);ChatWebsiteEvents['on'](_0x80c741,_0x4f0539);}}; \ No newline at end of file +var _0xce96=['update','emit','register','length','chatWebsite:','./chatWebsite.events','save','remove'];(function(_0x14007e,_0x3a64ec){var _0x56b82f=function(_0x235cef){while(--_0x235cef){_0x14007e['push'](_0x14007e['shift']());}};_0x56b82f(++_0x3a64ec);}(_0xce96,0x15d));var _0x6ce9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xce96[_0x14add3];return _0x4a174f;};'use strict';var ChatWebsiteEvents=require(_0x6ce9('0x0'));var events=[_0x6ce9('0x1'),_0x6ce9('0x2'),_0x6ce9('0x3')];function createListener(_0x42713f,_0x4d00c2){return function(_0x1b2fee){_0x4d00c2[_0x6ce9('0x4')](_0x42713f,_0x1b2fee);};}function removeListener(_0xe4fe33,_0x59e1fb){return function(){ChatWebsiteEvents['removeListener'](_0xe4fe33,_0x59e1fb);};}exports[_0x6ce9('0x5')]=function(_0x463384){for(var _0x4939d0=0x0,_0x4235bc=events[_0x6ce9('0x6')];_0x4939d0<_0x4235bc;_0x4939d0++){var _0x511061=events[_0x4939d0];var _0x34a443=createListener(_0x6ce9('0x7')+_0x511061,_0x463384);ChatWebsiteEvents['on'](_0x511061,_0x34a443);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index e75b232..58c5097 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 _0x6596=['post','diskStorage','join','server/files/images/logos/','format','now','originalname','single','addLogo','root','server/files/images/avatars/','%s-%s','file','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','attachments','offline-chat','ensureDir','replace','extname','any','addApplications','addProactiveActions','delete','removeDispositions','removeAnswers','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','/:id/users','getAgents'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6596,0x1e5));var _0x6659=function(_0x4f5f85,_0x35d05e){_0x4f5f85=_0x4f5f85-0x0;var _0x13ff8d=_0x6596[_0x4f5f85];return _0x13ff8d;};'use strict';var multer=require(_0x6659('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6659('0x1'));var express=require(_0x6659('0x2'));var router=express[_0x6659('0x3')]();var fs_extra=require(_0x6659('0x4'));var auth=require(_0x6659('0x5'));var interaction=require(_0x6659('0x6'));var config=require(_0x6659('0x7'));var controller=require(_0x6659('0x8'));router[_0x6659('0x9')]('/',auth[_0x6659('0xa')](),controller[_0x6659('0xb')]);router['get'](_0x6659('0xc'),auth[_0x6659('0xa')](),controller[_0x6659('0xd')]);router['get'](_0x6659('0xe'),auth['isAuthenticated'](),controller[_0x6659('0xf')]);router['get'](_0x6659('0x10'),auth[_0x6659('0xa')](),controller['getDispositions']);router[_0x6659('0x9')](_0x6659('0x11'),auth[_0x6659('0xa')](),controller['getAnswers']);router[_0x6659('0x9')](_0x6659('0x12'),controller[_0x6659('0x13')]);router[_0x6659('0x9')]('/:id/avatar',controller[_0x6659('0x14')]);router[_0x6659('0x9')](_0x6659('0x15'),controller['getCustomerAvatar']);router[_0x6659('0x9')](_0x6659('0x16'),controller[_0x6659('0x17')]);router['get'](_0x6659('0x18'),auth[_0x6659('0xa')](),controller[_0x6659('0x19')]);router[_0x6659('0x9')]('/:id/snippet',controller[_0x6659('0x1a')]);router[_0x6659('0x9')]('/:id/applications',auth[_0x6659('0xa')](),controller[_0x6659('0x1b')]);router[_0x6659('0x9')](_0x6659('0x1c'),auth['isAuthenticated'](),controller[_0x6659('0x1d')]);router['get'](_0x6659('0x1e'),controller[_0x6659('0x1f')]);router[_0x6659('0x9')]('/:id/offline_messages',auth[_0x6659('0xa')](),controller[_0x6659('0x20')]);router[_0x6659('0x9')](_0x6659('0x21'),auth['isAuthenticated'](),controller[_0x6659('0x22')]);router[_0x6659('0x23')]('/',auth[_0x6659('0xa')](),controller['create']);router[_0x6659('0x23')](_0x6659('0x10'),auth[_0x6659('0xa')](),controller['addDisposition']);router[_0x6659('0x23')](_0x6659('0x11'),auth[_0x6659('0xa')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x6659('0x24')]({'destination':function(_0x27d9c4,_0x1322de,_0x933a0c){_0x933a0c(null,path[_0x6659('0x25')](config['root'],_0x6659('0x26')));},'filename':function(_0x2d6f6c,_0xfaf6a9,_0x3ec1ff){_0x3ec1ff(null,util[_0x6659('0x27')]('%s-%s',Date[_0x6659('0x28')](),_0xfaf6a9[_0x6659('0x29')]));}})});router[_0x6659('0x23')](_0x6659('0x12'),upload[_0x6659('0x2a')]('file'),controller[_0x6659('0x2b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xeab677,_0x5b12ad,_0x34aadf){_0x34aadf(null,path[_0x6659('0x25')](config[_0x6659('0x2c')],_0x6659('0x2d')));},'filename':function(_0xdfa481,_0xf5f67,_0x3dfbbb){_0x3dfbbb(null,util['format'](_0x6659('0x2e'),Date[_0x6659('0x28')](),_0xf5f67['originalname']));}})});router[_0x6659('0x23')]('/:id/avatar',upload['single'](_0x6659('0x2f')),controller[_0x6659('0x30')]);var upload=multer({'storage':multer[_0x6659('0x24')]({'destination':function(_0x8ed208,_0x3a5c9f,_0x19660a){_0x19660a(null,path[_0x6659('0x25')](config[_0x6659('0x2c')],_0x6659('0x2d')));},'filename':function(_0x3c953e,_0x5e3fc0,_0x2446e5){_0x2446e5(null,util[_0x6659('0x27')](_0x6659('0x2e'),Date['now'](),_0x5e3fc0[_0x6659('0x29')]));}})});router[_0x6659('0x23')](_0x6659('0x15'),upload[_0x6659('0x2a')](_0x6659('0x2f')),controller[_0x6659('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x44829c,_0x30b1ee,_0x334145){_0x334145(null,path[_0x6659('0x25')](config['root'],_0x6659('0x2d')));},'filename':function(_0x5942f6,_0x303d54,_0x512fbb){_0x512fbb(null,util[_0x6659('0x27')](_0x6659('0x2e'),Date[_0x6659('0x28')](),_0x303d54[_0x6659('0x29')]));}})});router['post'](_0x6659('0x16'),upload[_0x6659('0x2a')](_0x6659('0x2f')),controller[_0x6659('0x32')]);router[_0x6659('0x23')](_0x6659('0x33'),controller[_0x6659('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0x6659('0x24')]({'destination':function(_0xf210ea,_0xfb6e57,_0xcba878){const _0x99ed20=path[_0x6659('0x25')](config[_0x6659('0x2c')],'server/files',_0x6659('0x35'),_0x6659('0x36'));fs_extra[_0x6659('0x37')](_0x99ed20,function(){_0xcba878(null,_0x99ed20);});},'filename':function(_0x110287,_0x13de6f,_0x23bb0c){const _0x21a792=_0x13de6f[_0x6659('0x29')][_0x6659('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4aa223=path[_0x6659('0x39')](_0x21a792);const _0x5d06fa=Date[_0x6659('0x28')]()+'-'+_0x21a792[_0x6659('0x38')](_0x4aa223,'')+_0x4aa223;_0x23bb0c(null,_0x5d06fa);}})});router['post']('/:id/offline',offlineUploadMulter[_0x6659('0x3a')](),controller['offline']);router[_0x6659('0x23')](_0x6659('0x18'),auth[_0x6659('0xa')](),controller['addInteraction']);router[_0x6659('0x23')]('/:id/applications',auth['isAuthenticated'](),controller[_0x6659('0x3b')]);router[_0x6659('0x23')](_0x6659('0x1c'),auth[_0x6659('0xa')](),controller[_0x6659('0x3c')]);router[_0x6659('0x23')](_0x6659('0x21'),auth[_0x6659('0xa')](),controller['addAgents']);router['put'](_0x6659('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6659('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x6659('0x3d')](_0x6659('0x10'),auth[_0x6659('0xa')](),controller[_0x6659('0x3e')]);router[_0x6659('0x3d')]('/:id/canned_answers',auth[_0x6659('0xa')](),controller[_0x6659('0x3f')]);router[_0x6659('0x3d')](_0x6659('0x21'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x6659('0x40')]=router; \ No newline at end of file +var _0xf7f8=['getOfflineMessages','/:id/users','getAgents','post','diskStorage','join','root','%s-%s','now','originalname','/:id/logo','single','addLogo','/:id/avatar','file','format','addCustomerAvatar','server/files/images/avatars/','addSystemAvatar','/:id/notify','notify','ensureDir','replace','any','offline','addInteraction','addApplications','addProactiveActions','put','update','destroy','delete','removeDispositions','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages'];(function(_0x55c819,_0x2b16aa){var _0x28e5f4=function(_0x8a716b){while(--_0x8a716b){_0x55c819['push'](_0x55c819['shift']());}};_0x28e5f4(++_0x2b16aa);}(_0xf7f8,0x12d));var _0x8f7f=function(_0x4b5346,_0x1ea7c9){_0x4b5346=_0x4b5346-0x0;var _0x1ae6b7=_0xf7f8[_0x4b5346];return _0x1ae6b7;};'use strict';var multer=require(_0x8f7f('0x0'));var util=require(_0x8f7f('0x1'));var path=require(_0x8f7f('0x2'));var timeout=require(_0x8f7f('0x3'));var express=require(_0x8f7f('0x4'));var router=express[_0x8f7f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8f7f('0x6'));var config=require(_0x8f7f('0x7'));var controller=require(_0x8f7f('0x8'));router[_0x8f7f('0x9')]('/',auth[_0x8f7f('0xa')](),controller[_0x8f7f('0xb')]);router[_0x8f7f('0x9')](_0x8f7f('0xc'),auth['isAuthenticated'](),controller[_0x8f7f('0xd')]);router['get'](_0x8f7f('0xe'),auth[_0x8f7f('0xa')](),controller[_0x8f7f('0xf')]);router[_0x8f7f('0x9')](_0x8f7f('0x10'),auth[_0x8f7f('0xa')](),controller[_0x8f7f('0x11')]);router[_0x8f7f('0x9')](_0x8f7f('0x12'),auth[_0x8f7f('0xa')](),controller[_0x8f7f('0x13')]);router[_0x8f7f('0x9')]('/:id/logo',controller[_0x8f7f('0x14')]);router[_0x8f7f('0x9')]('/:id/avatar',controller['getAvatar']);router[_0x8f7f('0x9')](_0x8f7f('0x15'),controller['getCustomerAvatar']);router[_0x8f7f('0x9')](_0x8f7f('0x16'),controller[_0x8f7f('0x17')]);router[_0x8f7f('0x9')](_0x8f7f('0x18'),auth[_0x8f7f('0xa')](),controller[_0x8f7f('0x19')]);router['get'](_0x8f7f('0x1a'),controller[_0x8f7f('0x1b')]);router['get'](_0x8f7f('0x1c'),auth['isAuthenticated'](),controller[_0x8f7f('0x1d')]);router[_0x8f7f('0x9')](_0x8f7f('0x1e'),auth[_0x8f7f('0xa')](),controller['getProactiveActions']);router[_0x8f7f('0x9')](_0x8f7f('0x1f'),controller[_0x8f7f('0x20')]);router[_0x8f7f('0x9')](_0x8f7f('0x21'),auth[_0x8f7f('0xa')](),controller[_0x8f7f('0x22')]);router['get'](_0x8f7f('0x23'),auth[_0x8f7f('0xa')](),controller[_0x8f7f('0x24')]);router[_0x8f7f('0x25')]('/',auth[_0x8f7f('0xa')](),controller['create']);router[_0x8f7f('0x25')](_0x8f7f('0x10'),auth[_0x8f7f('0xa')](),controller['addDisposition']);router[_0x8f7f('0x25')](_0x8f7f('0x12'),auth[_0x8f7f('0xa')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x8f7f('0x26')]({'destination':function(_0x345927,_0xa944cd,_0x4a7da7){_0x4a7da7(null,path[_0x8f7f('0x27')](config[_0x8f7f('0x28')],'server/files/images/logos/'));},'filename':function(_0x20d521,_0x90f0f7,_0x44f68b){_0x44f68b(null,util['format'](_0x8f7f('0x29'),Date[_0x8f7f('0x2a')](),_0x90f0f7[_0x8f7f('0x2b')]));}})});router[_0x8f7f('0x25')](_0x8f7f('0x2c'),upload[_0x8f7f('0x2d')]('file'),controller[_0x8f7f('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4441bf,_0x39fbea,_0x39c29f){_0x39c29f(null,path[_0x8f7f('0x27')](config[_0x8f7f('0x28')],'server/files/images/avatars/'));},'filename':function(_0x31482d,_0x4f92dc,_0x2b15c9){_0x2b15c9(null,util['format']('%s-%s',Date[_0x8f7f('0x2a')](),_0x4f92dc['originalname']));}})});router[_0x8f7f('0x25')](_0x8f7f('0x2f'),upload['single'](_0x8f7f('0x30')),controller['addAvatar']);var upload=multer({'storage':multer[_0x8f7f('0x26')]({'destination':function(_0x5617c8,_0x1d076b,_0x36b555){_0x36b555(null,path[_0x8f7f('0x27')](config[_0x8f7f('0x28')],'server/files/images/avatars/'));},'filename':function(_0x32e1fc,_0x3279df,_0x2c8187){_0x2c8187(null,util[_0x8f7f('0x31')](_0x8f7f('0x29'),Date[_0x8f7f('0x2a')](),_0x3279df['originalname']));}})});router[_0x8f7f('0x25')](_0x8f7f('0x15'),upload['single'](_0x8f7f('0x30')),controller[_0x8f7f('0x32')]);var upload=multer({'storage':multer[_0x8f7f('0x26')]({'destination':function(_0x47cdbb,_0x23d490,_0x5095fe){_0x5095fe(null,path[_0x8f7f('0x27')](config[_0x8f7f('0x28')],_0x8f7f('0x33')));},'filename':function(_0x2b64e2,_0x536ff9,_0xf12ae2){_0xf12ae2(null,util[_0x8f7f('0x31')]('%s-%s',Date[_0x8f7f('0x2a')](),_0x536ff9[_0x8f7f('0x2b')]));}})});router[_0x8f7f('0x25')]('/:id/system_avatar',upload[_0x8f7f('0x2d')]('file'),controller[_0x8f7f('0x34')]);router[_0x8f7f('0x25')](_0x8f7f('0x35'),controller[_0x8f7f('0x36')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0xb47d79,_0x1993e2,_0x30fcc8){const _0x58d837=path[_0x8f7f('0x27')](config[_0x8f7f('0x28')],'server/files','attachments','offline-chat');fs_extra[_0x8f7f('0x37')](_0x58d837,function(){_0x30fcc8(null,_0x58d837);});},'filename':function(_0x1046ef,_0x365e97,_0x2f6cbe){const _0x21e399=_0x365e97[_0x8f7f('0x2b')][_0x8f7f('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4a6abe=path['extname'](_0x21e399);const _0x3889f2=Date[_0x8f7f('0x2a')]()+'-'+_0x21e399['replace'](_0x4a6abe,'')+_0x4a6abe;_0x2f6cbe(null,_0x3889f2);}})});router[_0x8f7f('0x25')]('/:id/offline',offlineUploadMulter[_0x8f7f('0x39')](),controller[_0x8f7f('0x3a')]);router['post']('/:id/interactions',auth['isAuthenticated'](),controller[_0x8f7f('0x3b')]);router['post'](_0x8f7f('0x1c'),auth[_0x8f7f('0xa')](),controller[_0x8f7f('0x3c')]);router[_0x8f7f('0x25')](_0x8f7f('0x1e'),auth[_0x8f7f('0xa')](),controller[_0x8f7f('0x3d')]);router[_0x8f7f('0x25')](_0x8f7f('0x23'),auth[_0x8f7f('0xa')](),controller['addAgents']);router[_0x8f7f('0x3e')](_0x8f7f('0xe'),auth['isAuthenticated'](),controller[_0x8f7f('0x3f')]);router['delete'](_0x8f7f('0xe'),auth[_0x8f7f('0xa')](),controller[_0x8f7f('0x40')]);router[_0x8f7f('0x41')]('/:id/dispositions',auth[_0x8f7f('0xa')](),controller[_0x8f7f('0x42')]);router[_0x8f7f('0x41')](_0x8f7f('0x12'),auth[_0x8f7f('0xa')](),controller['removeAnswers']);router[_0x8f7f('0x41')](_0x8f7f('0x23'),auth[_0x8f7f('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 2e77bf1..3aa5159 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f43=['../components/auth/service','../config/environment','Router','env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','exports','beaver-logger/server','express'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x0f43,0xc2));var _0x30f4=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x0f43[_0x1deb03];return _0x189fe7;};var beaverLogger=require(_0x30f4('0x0'));var express=require(_0x30f4('0x1'));var auth=require(_0x30f4('0x2'));var config=require(_0x30f4('0x3'));var router=express[_0x30f4('0x4')]();var isProduction=config[_0x30f4('0x5')]===_0x30f4('0x6')||![];function clientSideLogs(_0x147af7,_0xe1926c,_0xe3f566){var _0x371a3c=_0x147af7[_0x30f4('0x7')][_0x30f4('0x8')](_0x30f4('0x9'));if(!_0x371a3c){throw new Error(_0x30f4('0xa'));}return beaverLogger[_0x30f4('0xb')]({'uri':'/client-logs','logger':_0x371a3c,'enableCors':!isProduction})(_0x147af7,_0xe1926c,_0xe3f566);}router[_0x30f4('0xc')](auth['isAuthenticated'](),clientSideLogs);module[_0x30f4('0xd')]=router; \ No newline at end of file +var _0x8998=['beaver-logger/server','express','../components/auth/service','../config/environment','Router','production','app','expressEndpoint','/client-logs','use','isAuthenticated','exports'];(function(_0xbd22c3,_0x239e51){var _0x2633ab=function(_0x476efc){while(--_0x476efc){_0xbd22c3['push'](_0xbd22c3['shift']());}};_0x2633ab(++_0x239e51);}(_0x8998,0xfc));var _0x8899=function(_0x30eee7,_0x251e54){_0x30eee7=_0x30eee7-0x0;var _0x14bba2=_0x8998[_0x30eee7];return _0x14bba2;};var beaverLogger=require(_0x8899('0x0'));var express=require(_0x8899('0x1'));var auth=require(_0x8899('0x2'));var config=require(_0x8899('0x3'));var router=express[_0x8899('0x4')]();var isProduction=config['env']===_0x8899('0x5')||![];function clientSideLogs(_0x263cbb,_0x30da16,_0x53cecc){var _0x280399=_0x263cbb[_0x8899('0x6')]['get']('client-side-logger');if(!_0x280399){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x8899('0x7')]({'uri':_0x8899('0x8'),'logger':_0x280399,'enableCors':!isProduction})(_0x263cbb,_0x30da16,_0x53cecc);}router[_0x8899('0x9')](auth[_0x8899('0xa')](),clientSideLogs);module[_0x8899('0xb')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 30304a1..75e1605 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 _0x63a6=['MicrosoftAzure\x20=>\x20refresh_token','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure\x20=>\x20tenant','TEXT','MicrosoftAzure\x20=>\x20access_token'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x63a6,0xbe));var _0x663a=function(_0x5a30fb,_0x206270){_0x5a30fb=_0x5a30fb-0x0;var _0x3b86aa=_0x63a6[_0x5a30fb];return _0x3b86aa;};'use strict';var Sequelize=require('sequelize');module[_0x663a('0x0')]={'name':{'type':Sequelize[_0x663a('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x663a('0x2')](_0x663a('0x3'),_0x663a('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x663a('0x2')]('Outlook365','Dynamics365')},'data1':{'type':Sequelize[_0x663a('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize['STRING'],'comment':_0x663a('0x5')},'data3':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x663a('0x6')],'comment':_0x663a('0x7')},'data6':{'type':Sequelize[_0x663a('0x6')],'comment':_0x663a('0x8')},'data7':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0x2bda=['Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365'];(function(_0x20437c,_0x5d8aac){var _0x1c438f=function(_0x13a3b4){while(--_0x13a3b4){_0x20437c['push'](_0x20437c['shift']());}};_0x1c438f(++_0x5d8aac);}(_0x2bda,0x1f4));var _0xa2bd=function(_0x408d22,_0x53eef9){_0x408d22=_0x408d22-0x0;var _0x58effd=_0x2bda[_0x408d22];return _0x58effd;};'use strict';var Sequelize=require('sequelize');module[_0xa2bd('0x0')]={'name':{'type':Sequelize[_0xa2bd('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xa2bd('0x2')](_0xa2bd('0x3'),_0xa2bd('0x4'),_0xa2bd('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xa2bd('0x6'),_0xa2bd('0x7'))},'data1':{'type':Sequelize[_0xa2bd('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xa2bd('0x1')],'comment':_0xa2bd('0x8')},'data3':{'type':Sequelize[_0xa2bd('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0xa2bd('0x1')],'comment':_0xa2bd('0x9')},'data5':{'type':Sequelize[_0xa2bd('0xa')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0xa2bd('0xa')],'comment':_0xa2bd('0xb')},'data7':{'type':Sequelize['TEXT'],'comment':_0xa2bd('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index c5966a5..a9f49f9 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 _0xa3d9=['rows','service','decryptString','data3','catch','params','rawAttributes','MicrosoftAzure','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','encryptString','find','destroy','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback','get','state','parse','from','toString','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','data5','access_token','data6','refresh_token','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','sendStatus','error','stack','send','slice','index','map','CloudProvider','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll'];(function(_0x386525,_0xefae6){var _0x14d015=function(_0x4a45c1){while(--_0x4a45c1){_0x386525['push'](_0x386525['shift']());}};_0x14d015(++_0xefae6);}(_0xa3d9,0x1aa));var _0x9a3d=function(_0x5f6b51,_0x3902eb){_0x5f6b51=_0x5f6b51-0x0;var _0x316d99=_0xa3d9[_0x5f6b51];return _0x316d99;};'use strict';var _=require(_0x9a3d('0x0'));var Redis=require(_0x9a3d('0x1'));var qs=require(_0x9a3d('0x2'));var encryptor=require(_0x9a3d('0x3'));var config=require(_0x9a3d('0x4'));var logger=require(_0x9a3d('0x5'))(_0x9a3d('0x6'));var db=require(_0x9a3d('0x7'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x9a3d('0x8')]=_[_0x9a3d('0x9')](config[_0x9a3d('0x8')],{'host':_0x9a3d('0xa'),'port':0x18eb});var socket=require(_0x9a3d('0xb'))(new Redis(config['redis']));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x4e8151,_0x378a7a){_0x378a7a=_0x378a7a||0xcc;return function(_0x37d408){if(_0x37d408){return _0x4e8151['sendStatus'](_0x378a7a);}return _0x4e8151[_0x9a3d('0xc')](_0x378a7a)['end']();};}function respondWithResult(_0x584281,_0x473216){_0x473216=_0x473216||0xc8;return function(_0x4d09fa){if(_0x4d09fa){return _0x584281[_0x9a3d('0xc')](_0x473216)[_0x9a3d('0xd')](_0x4d09fa);}};}function respondWithFilteredResult(_0x4646b4,_0x30f804){return function(_0x32138d){if(_0x32138d){var _0x3aa270=typeof _0x30f804[_0x9a3d('0xe')]===_0x9a3d('0xf')&&typeof _0x30f804[_0x9a3d('0x10')]===_0x9a3d('0xf');var _0x42377a=_0x32138d[_0x9a3d('0x11')];var _0x36a689=_0x3aa270?0x0:_0x30f804[_0x9a3d('0xe')];var _0xef882d=_0x3aa270?_0x32138d['count']:_0x30f804[_0x9a3d('0xe')]+_0x30f804['limit'];var _0x1e5019;if(_0xef882d>=_0x42377a){_0xef882d=_0x42377a;_0x1e5019=0xc8;}else{_0x1e5019=0xce;}_0x4646b4[_0x9a3d('0xc')](_0x1e5019);return _0x4646b4[_0x9a3d('0x12')](_0x9a3d('0x13'),_0x36a689+'-'+_0xef882d+'/'+_0x42377a)['json'](_0x32138d);}return null;};}function saveUpdates(_0xef5221){return function(_0x4618b9){if(_0x4618b9){return _0x4618b9[_0x9a3d('0x14')](_0xef5221)[_0x9a3d('0x15')](function(_0x59fa05){return _0x59fa05;});}return null;};}function removeEntity(_0x512d0c){return function(_0x480e19){if(_0x480e19){return _0x480e19['destroy']()[_0x9a3d('0x15')](function(){_0x512d0c[_0x9a3d('0xc')](0xcc)[_0x9a3d('0x16')]();});}};}function handleEntityNotFound(_0x187564){return function(_0x1c9bc1){if(!_0x1c9bc1){_0x187564[_0x9a3d('0x17')](0x194);}return _0x1c9bc1;};}function handleError(_0x212aea,_0xf31db7){_0xf31db7=_0xf31db7||0x1f4;return function(_0x4fef34){logger[_0x9a3d('0x18')](_0x4fef34[_0x9a3d('0x19')]);if(_0x4fef34['name']){delete _0x4fef34['name'];}_0x212aea['status'](_0xf31db7)[_0x9a3d('0x1a')](_0x4fef34);};}function maskClientSecret(_0x4edf89){return _['padEnd'](_0x4edf89[_0x9a3d('0x1b')](0x0,0x3),0x14,'*');}exports[_0x9a3d('0x1c')]=function(_0x2e50ad,_0x47f073){var _0xe14f20={},_0x846e30={},_0xe57a31={'count':0x0,'rows':[]};var _0x4030f7=_[_0x9a3d('0x1d')](db[_0x9a3d('0x1e')]['rawAttributes'],function(_0x589a4a){return{'name':_0x589a4a[_0x9a3d('0x1f')],'type':_0x589a4a[_0x9a3d('0x20')][_0x9a3d('0x21')]};});_0x846e30[_0x9a3d('0x22')]=_[_0x9a3d('0x1d')](_0x4030f7,_0x9a3d('0x23'));_0x846e30[_0x9a3d('0x24')]=_[_0x9a3d('0x25')](_0x2e50ad[_0x9a3d('0x24')]);_0x846e30['filters']=_[_0x9a3d('0x26')](_0x846e30[_0x9a3d('0x22')],_0x846e30[_0x9a3d('0x24')]);_0xe14f20[_0x9a3d('0x27')]=_[_0x9a3d('0x26')](_0x846e30['model'],qs[_0x9a3d('0x28')](_0x2e50ad[_0x9a3d('0x24')][_0x9a3d('0x28')]));_0xe14f20[_0x9a3d('0x27')]=_0xe14f20[_0x9a3d('0x27')][_0x9a3d('0x29')]?_0xe14f20[_0x9a3d('0x27')]:_0x846e30[_0x9a3d('0x22')];if(!_0x2e50ad['query'][_0x9a3d('0x2a')]('nolimit')){_0xe14f20[_0x9a3d('0x10')]=qs[_0x9a3d('0x10')](_0x2e50ad[_0x9a3d('0x24')][_0x9a3d('0x10')]);_0xe14f20['offset']=qs[_0x9a3d('0xe')](_0x2e50ad['query'][_0x9a3d('0xe')]);}_0xe14f20[_0x9a3d('0x2b')]=qs[_0x9a3d('0x2c')](_0x2e50ad[_0x9a3d('0x24')][_0x9a3d('0x2c')]);_0xe14f20[_0x9a3d('0x2d')]=qs[_0x9a3d('0x2e')](_[_0x9a3d('0x2f')](_0x2e50ad[_0x9a3d('0x24')],_0x846e30[_0x9a3d('0x2e')]),_0x4030f7);if(_0x2e50ad['query'][_0x9a3d('0x30')]){_0xe14f20['where']=_['merge'](_0xe14f20[_0x9a3d('0x2d')],{'$or':_[_0x9a3d('0x1d')](_0x4030f7,function(_0x215ead){if(_0x215ead[_0x9a3d('0x20')]!=='VIRTUAL'){var _0x570bda={};_0x570bda[_0x215ead[_0x9a3d('0x23')]]={'$like':'%'+_0x2e50ad[_0x9a3d('0x24')][_0x9a3d('0x30')]+'%'};return _0x570bda;}})});}_0xe14f20=_[_0x9a3d('0x31')]({},_0xe14f20,_0x2e50ad[_0x9a3d('0x32')]);var _0x4fc1e9={'where':_0xe14f20[_0x9a3d('0x2d')]};return db[_0x9a3d('0x1e')][_0x9a3d('0x11')](_0x4fc1e9)[_0x9a3d('0x15')](function(_0x24d60c){_0xe57a31[_0x9a3d('0x11')]=_0x24d60c;if(_0x2e50ad[_0x9a3d('0x24')][_0x9a3d('0x33')]){_0xe14f20[_0x9a3d('0x34')]=[{'all':!![]}];}return db[_0x9a3d('0x1e')][_0x9a3d('0x35')](_0xe14f20);})[_0x9a3d('0x15')](function(_0x24adf6){_0xe57a31[_0x9a3d('0x36')]=_[_0x9a3d('0x1d')](_0x24adf6,function(_0x597a60){if(_0x597a60[_0x9a3d('0x37')]==='MicrosoftAzure'){var _0x44ad01=encryptor[_0x9a3d('0x38')](_0x597a60[_0x9a3d('0x39')]);_0x597a60[_0x9a3d('0x39')]=maskClientSecret(_0x44ad01);}return _0x597a60;});return _0xe57a31;})[_0x9a3d('0x15')](respondWithFilteredResult(_0x47f073,_0xe14f20))[_0x9a3d('0x3a')](handleError(_0x47f073,null));};exports['show']=function(_0x4eb4e2,_0x9c9e69){var _0x31cc43={'raw':!![],'where':{'id':_0x4eb4e2[_0x9a3d('0x3b')]['id']}},_0x432941={};_0x432941[_0x9a3d('0x22')]=_[_0x9a3d('0x25')](db['CloudProvider'][_0x9a3d('0x3c')]);_0x432941[_0x9a3d('0x24')]=_[_0x9a3d('0x25')](_0x4eb4e2[_0x9a3d('0x24')]);_0x432941[_0x9a3d('0x2e')]=_[_0x9a3d('0x26')](_0x432941['model'],_0x432941[_0x9a3d('0x24')]);_0x31cc43[_0x9a3d('0x27')]=_['intersection'](_0x432941['model'],qs['fields'](_0x4eb4e2[_0x9a3d('0x24')][_0x9a3d('0x28')]));_0x31cc43['attributes']=_0x31cc43[_0x9a3d('0x27')][_0x9a3d('0x29')]?_0x31cc43[_0x9a3d('0x27')]:_0x432941['model'];if(_0x4eb4e2[_0x9a3d('0x24')][_0x9a3d('0x33')]){_0x31cc43['include']=[{'all':!![]}];}_0x31cc43=_[_0x9a3d('0x31')]({},_0x31cc43,_0x4eb4e2[_0x9a3d('0x32')]);return db['CloudProvider']['find'](_0x31cc43)[_0x9a3d('0x15')](handleEntityNotFound(_0x9c9e69,null))['then'](function(_0x208099){if(_0x208099[_0x9a3d('0x37')]===_0x9a3d('0x3d')){var _0x5df0d9=encryptor[_0x9a3d('0x38')](_0x208099['data3']);_0x208099['data3']=maskClientSecret(_0x5df0d9);}return _0x208099;})[_0x9a3d('0x15')](respondWithResult(_0x9c9e69,null))[_0x9a3d('0x3a')](handleError(_0x9c9e69,null));};exports['create']=function(_0x2876fa,_0x1a2df7){if(!_0x2876fa[_0x9a3d('0x3e')][_0x9a3d('0x23')])throw new Error(_0x9a3d('0x3f'));if(!_0x2876fa[_0x9a3d('0x3e')][_0x9a3d('0x37')])throw new Error(_0x9a3d('0x40'));var _0x6662d6=db[_0x9a3d('0x1e')][_0x9a3d('0x3c')][_0x9a3d('0x37')][_0x9a3d('0x41')];if(!_0x6662d6[_0x9a3d('0x42')](_0x2876fa['body'][_0x9a3d('0x37')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x6662d6['join'](',\x20'));if(_0x2876fa[_0x9a3d('0x3e')][_0x9a3d('0x37')]==='MicrosoftAzure'&&_0x2876fa['body'][_0x9a3d('0x39')]){_0x2876fa[_0x9a3d('0x3e')][_0x9a3d('0x39')]=encryptor[_0x9a3d('0x43')](_0x2876fa['body']['data3']);}return db[_0x9a3d('0x1e')]['create'](_0x2876fa[_0x9a3d('0x3e')],{})[_0x9a3d('0x15')](respondWithResult(_0x1a2df7,0xc9))['catch'](handleError(_0x1a2df7,null));};exports['update']=function(_0x2189ce,_0x50965e){if(_0x2189ce[_0x9a3d('0x3e')]['id']){delete _0x2189ce[_0x9a3d('0x3e')]['id'];}return db[_0x9a3d('0x1e')][_0x9a3d('0x44')]({'where':{'id':_0x2189ce[_0x9a3d('0x3b')]['id']}})[_0x9a3d('0x15')](handleEntityNotFound(_0x50965e,null))[_0x9a3d('0x15')](function(_0x9aaa78){if(_0x9aaa78[_0x9a3d('0x37')]===_0x9a3d('0x3d')&&_0x2189ce[_0x9a3d('0x3e')][_0x9a3d('0x39')]){_0x2189ce['body'][_0x9a3d('0x39')]=encryptor['encryptString'](_0x2189ce['body'][_0x9a3d('0x39')]);}return _0x9aaa78;})[_0x9a3d('0x15')](saveUpdates(_0x2189ce[_0x9a3d('0x3e')],null))['then'](respondWithResult(_0x50965e,null))[_0x9a3d('0x3a')](handleError(_0x50965e,null));};exports[_0x9a3d('0x45')]=function(_0x105aea,_0x2d1563){return db[_0x9a3d('0x1e')]['find']({'where':{'id':_0x105aea[_0x9a3d('0x3b')]['id']}})[_0x9a3d('0x15')](handleEntityNotFound(_0x2d1563,null))['then'](removeEntity(_0x2d1563,null))[_0x9a3d('0x3a')](handleError(_0x2d1563,null));};exports[_0x9a3d('0x46')]=function(_0x290086,_0xfd146){return db[_0x9a3d('0x1e')][_0x9a3d('0x47')]({'where':{'id':_0x290086['params']['id']},'raw':!![]})['then'](function(_0x408465){if(!_0x408465)return _0xfd146[_0x9a3d('0x17')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x408465,_0x290086[_0x9a3d('0x48')]['id'])};})['then'](respondWithResult(_0xfd146,null))['catch'](handleError(_0xfd146,null));};exports[_0x9a3d('0x49')]=function(_0x3a7c47,_0x454b19){var _0x3c78c4=_0x3a7c47['body'];var _0x5d5881;var _0x42cacb;if(_0x3c78c4[_0x9a3d('0x18')])throw _0x3c78c4;redis[_0x9a3d('0x4a')](_0x3c78c4[_0x9a3d('0x4b')])[_0x9a3d('0x15')](function(_0xdb4ce2){if(!_0xdb4ce2)throw new Error('Invalid\x20state\x20parameter');_0x5d5881=JSON[_0x9a3d('0x4c')](_0xdb4ce2);var _0xcb2859=Buffer[_0x9a3d('0x4d')](_0x3c78c4[_0x9a3d('0x4b')],'base64')[_0x9a3d('0x4e')](_0x9a3d('0x4f'));_0x42cacb=JSON[_0x9a3d('0x4c')](_0xcb2859);if(!oauth['isValidIdToken'](_0x3c78c4[_0x9a3d('0x50')],_0x5d5881[_0x9a3d('0x51')]))throw new Error(_0x9a3d('0x52'));redis[_0x9a3d('0x53')](_0x3c78c4[_0x9a3d('0x4b')]);return oauth[_0x9a3d('0x54')](_0x3c78c4['code'],_0x5d5881);})['then'](function(_0x54c822){_0x5d5881[_0x9a3d('0x55')]=_0x54c822[_0x9a3d('0x56')];_0x5d5881[_0x9a3d('0x57')]=_0x54c822[_0x9a3d('0x58')];return db[_0x9a3d('0x1e')][_0x9a3d('0x14')]({'data5':_0x5d5881['data5'],'data6':_0x5d5881[_0x9a3d('0x57')]},{'where':{'id':_0x5d5881['id']}});})[_0x9a3d('0x15')](function(){oauth['startRefreshInterval'](_0x5d5881);socket[_0x9a3d('0x59')](_0x9a3d('0x5a'),{'id':_0x42cacb['id']});return;})[_0x9a3d('0x15')](respondWithStatusCode(_0x454b19,null))['catch'](function(_0x5cbbf3){if(_0x42cacb){socket[_0x9a3d('0x59')](_0x9a3d('0x5b'),{'id':_0x42cacb['id']});}if(!_0x5d5881){logger[_0x9a3d('0x18')](_0x9a3d('0x5c'),_0x5cbbf3);return _0x454b19['status'](0x1f4)[_0x9a3d('0x1a')](_0x5cbbf3[_0x9a3d('0x5d')]);}logger[_0x9a3d('0x18')](_0x9a3d('0x5e'),_0x5d5881['id'],JSON[_0x9a3d('0x5f')](_0x5cbbf3));});}; \ No newline at end of file +var _0x6cd1=['limit','Content-Range','update','then','destroy','error','stack','name','send','padEnd','index','map','CloudProvider','rawAttributes','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','service','MicrosoftAzure','decryptString','data3','show','params','keys','length','includeAll','find','catch','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','create','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','from','toString','ascii','parse','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../components/encryptor','../../config/environment','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count'];(function(_0x3496ae,_0x4f33fd){var _0x4badff=function(_0x7fd4ea){while(--_0x7fd4ea){_0x3496ae['push'](_0x3496ae['shift']());}};_0x4badff(++_0x4f33fd);}(_0x6cd1,0x163));var _0x16cd=function(_0x1ca993,_0x243c1e){_0x1ca993=_0x1ca993-0x0;var _0x150e5e=_0x6cd1[_0x1ca993];return _0x150e5e;};'use strict';var _=require(_0x16cd('0x0'));var Redis=require(_0x16cd('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0x16cd('0x2'));var config=require(_0x16cd('0x3'));var logger=require('../../config/logger')(_0x16cd('0x4'));var db=require(_0x16cd('0x5'))['db'];var oauth=require(_0x16cd('0x6'));config[_0x16cd('0x7')]=_[_0x16cd('0x8')](config[_0x16cd('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x16cd('0x9'))(new Redis(config[_0x16cd('0x7')]));var redis=new Redis(config[_0x16cd('0x7')]);function respondWithStatusCode(_0x19ce6a,_0xd93c70){_0xd93c70=_0xd93c70||0xcc;return function(_0xb2625a){if(_0xb2625a){return _0x19ce6a[_0x16cd('0xa')](_0xd93c70);}return _0x19ce6a[_0x16cd('0xb')](_0xd93c70)[_0x16cd('0xc')]();};}function respondWithResult(_0x2d5860,_0x24b2d0){_0x24b2d0=_0x24b2d0||0xc8;return function(_0x3ca908){if(_0x3ca908){return _0x2d5860['status'](_0x24b2d0)[_0x16cd('0xd')](_0x3ca908);}};}function respondWithFilteredResult(_0x27fc0b,_0x440a22){return function(_0x43abbd){if(_0x43abbd){var _0x44e87a=typeof _0x440a22[_0x16cd('0xe')]===_0x16cd('0xf')&&typeof _0x440a22['limit']===_0x16cd('0xf');var _0x213c24=_0x43abbd[_0x16cd('0x10')];var _0x2ccd64=_0x44e87a?0x0:_0x440a22[_0x16cd('0xe')];var _0x1db161=_0x44e87a?_0x43abbd[_0x16cd('0x10')]:_0x440a22[_0x16cd('0xe')]+_0x440a22[_0x16cd('0x11')];var _0x44907a;if(_0x1db161>=_0x213c24){_0x1db161=_0x213c24;_0x44907a=0xc8;}else{_0x44907a=0xce;}_0x27fc0b[_0x16cd('0xb')](_0x44907a);return _0x27fc0b['set'](_0x16cd('0x12'),_0x2ccd64+'-'+_0x1db161+'/'+_0x213c24)[_0x16cd('0xd')](_0x43abbd);}return null;};}function saveUpdates(_0x2e8647){return function(_0x29653e){if(_0x29653e){return _0x29653e[_0x16cd('0x13')](_0x2e8647)[_0x16cd('0x14')](function(_0x29beeb){return _0x29beeb;});}return null;};}function removeEntity(_0x46c4ad){return function(_0x5ed2af){if(_0x5ed2af){return _0x5ed2af[_0x16cd('0x15')]()[_0x16cd('0x14')](function(){_0x46c4ad['status'](0xcc)[_0x16cd('0xc')]();});}};}function handleEntityNotFound(_0x5cc783){return function(_0x28c3a6){if(!_0x28c3a6){_0x5cc783['sendStatus'](0x194);}return _0x28c3a6;};}function handleError(_0x7a7791,_0x2378b7){_0x2378b7=_0x2378b7||0x1f4;return function(_0x557cf2){logger[_0x16cd('0x16')](_0x557cf2[_0x16cd('0x17')]);if(_0x557cf2[_0x16cd('0x18')]){delete _0x557cf2[_0x16cd('0x18')];}_0x7a7791[_0x16cd('0xb')](_0x2378b7)[_0x16cd('0x19')](_0x557cf2);};}function maskClientSecret(_0x30daa0){return _[_0x16cd('0x1a')](_0x30daa0['slice'](0x0,0x3),0x14,'*');}exports[_0x16cd('0x1b')]=function(_0x3a6fa1,_0x2cf76f){var _0x394f92={},_0xfe248e={},_0x20ed89={'count':0x0,'rows':[]};var _0x2b1d4c=_[_0x16cd('0x1c')](db[_0x16cd('0x1d')][_0x16cd('0x1e')],function(_0xa978e3){return{'name':_0xa978e3['fieldName'],'type':_0xa978e3[_0x16cd('0x1f')]['key']};});_0xfe248e[_0x16cd('0x20')]=_[_0x16cd('0x1c')](_0x2b1d4c,_0x16cd('0x18'));_0xfe248e[_0x16cd('0x21')]=_['keys'](_0x3a6fa1[_0x16cd('0x21')]);_0xfe248e[_0x16cd('0x22')]=_[_0x16cd('0x23')](_0xfe248e['model'],_0xfe248e[_0x16cd('0x21')]);_0x394f92[_0x16cd('0x24')]=_[_0x16cd('0x23')](_0xfe248e[_0x16cd('0x20')],qs[_0x16cd('0x25')](_0x3a6fa1['query'][_0x16cd('0x25')]));_0x394f92[_0x16cd('0x24')]=_0x394f92['attributes']['length']?_0x394f92[_0x16cd('0x24')]:_0xfe248e['model'];if(!_0x3a6fa1[_0x16cd('0x21')][_0x16cd('0x26')](_0x16cd('0x27'))){_0x394f92[_0x16cd('0x11')]=qs[_0x16cd('0x11')](_0x3a6fa1[_0x16cd('0x21')][_0x16cd('0x11')]);_0x394f92[_0x16cd('0xe')]=qs[_0x16cd('0xe')](_0x3a6fa1['query'][_0x16cd('0xe')]);}_0x394f92[_0x16cd('0x28')]=qs[_0x16cd('0x29')](_0x3a6fa1['query'][_0x16cd('0x29')]);_0x394f92['where']=qs[_0x16cd('0x22')](_[_0x16cd('0x2a')](_0x3a6fa1[_0x16cd('0x21')],_0xfe248e['filters']),_0x2b1d4c);if(_0x3a6fa1[_0x16cd('0x21')][_0x16cd('0x2b')]){_0x394f92[_0x16cd('0x2c')]=_[_0x16cd('0x2d')](_0x394f92[_0x16cd('0x2c')],{'$or':_[_0x16cd('0x1c')](_0x2b1d4c,function(_0x286935){if(_0x286935[_0x16cd('0x1f')]!=='VIRTUAL'){var _0x1cd3cc={};_0x1cd3cc[_0x286935[_0x16cd('0x18')]]={'$like':'%'+_0x3a6fa1['query'][_0x16cd('0x2b')]+'%'};return _0x1cd3cc;}})});}_0x394f92=_[_0x16cd('0x2d')]({},_0x394f92,_0x3a6fa1[_0x16cd('0x2e')]);var _0x374ae2={'where':_0x394f92[_0x16cd('0x2c')]};return db[_0x16cd('0x1d')][_0x16cd('0x10')](_0x374ae2)[_0x16cd('0x14')](function(_0x4f7ab2){_0x20ed89[_0x16cd('0x10')]=_0x4f7ab2;if(_0x3a6fa1[_0x16cd('0x21')]['includeAll']){_0x394f92[_0x16cd('0x2f')]=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x394f92);})[_0x16cd('0x14')](function(_0x5e416f){_0x20ed89['rows']=_[_0x16cd('0x1c')](_0x5e416f,function(_0x1f55a4){if(_0x1f55a4[_0x16cd('0x30')]===_0x16cd('0x31')){var _0x599d5e=encryptor[_0x16cd('0x32')](_0x1f55a4[_0x16cd('0x33')]);_0x1f55a4['data3']=maskClientSecret(_0x599d5e);}return _0x1f55a4;});return _0x20ed89;})[_0x16cd('0x14')](respondWithFilteredResult(_0x2cf76f,_0x394f92))['catch'](handleError(_0x2cf76f,null));};exports[_0x16cd('0x34')]=function(_0x47e3b7,_0x4f5b17){var _0x45d8f9={'raw':!![],'where':{'id':_0x47e3b7[_0x16cd('0x35')]['id']}},_0x41bc55={};_0x41bc55['model']=_[_0x16cd('0x36')](db['CloudProvider'][_0x16cd('0x1e')]);_0x41bc55[_0x16cd('0x21')]=_[_0x16cd('0x36')](_0x47e3b7[_0x16cd('0x21')]);_0x41bc55[_0x16cd('0x22')]=_[_0x16cd('0x23')](_0x41bc55[_0x16cd('0x20')],_0x41bc55[_0x16cd('0x21')]);_0x45d8f9[_0x16cd('0x24')]=_['intersection'](_0x41bc55['model'],qs[_0x16cd('0x25')](_0x47e3b7[_0x16cd('0x21')][_0x16cd('0x25')]));_0x45d8f9[_0x16cd('0x24')]=_0x45d8f9[_0x16cd('0x24')][_0x16cd('0x37')]?_0x45d8f9['attributes']:_0x41bc55[_0x16cd('0x20')];if(_0x47e3b7[_0x16cd('0x21')][_0x16cd('0x38')]){_0x45d8f9[_0x16cd('0x2f')]=[{'all':!![]}];}_0x45d8f9=_[_0x16cd('0x2d')]({},_0x45d8f9,_0x47e3b7['options']);return db[_0x16cd('0x1d')][_0x16cd('0x39')](_0x45d8f9)['then'](handleEntityNotFound(_0x4f5b17,null))['then'](function(_0x552500){if(_0x552500[_0x16cd('0x30')]==='MicrosoftAzure'){var _0x43f314=encryptor[_0x16cd('0x32')](_0x552500[_0x16cd('0x33')]);_0x552500['data3']=maskClientSecret(_0x43f314);}return _0x552500;})['then'](respondWithResult(_0x4f5b17,null))[_0x16cd('0x3a')](handleError(_0x4f5b17,null));};exports['create']=function(_0x483ba4,_0x2800c9){if(!_0x483ba4[_0x16cd('0x3b')]['name'])throw new Error(_0x16cd('0x3c'));if(!_0x483ba4[_0x16cd('0x3b')]['service'])throw new Error(_0x16cd('0x3d'));var _0x2d2cc3=db[_0x16cd('0x1d')][_0x16cd('0x1e')][_0x16cd('0x30')][_0x16cd('0x3e')];if(!_0x2d2cc3[_0x16cd('0x3f')](_0x483ba4[_0x16cd('0x3b')]['service']))throw new Error(_0x16cd('0x40')+_0x2d2cc3['join'](',\x20'));if(_0x483ba4[_0x16cd('0x3b')]['service']==='MicrosoftAzure'&&_0x483ba4['body']['data3']){_0x483ba4[_0x16cd('0x3b')][_0x16cd('0x33')]=encryptor['encryptString'](_0x483ba4[_0x16cd('0x3b')][_0x16cd('0x33')]);}return db[_0x16cd('0x1d')][_0x16cd('0x41')](_0x483ba4[_0x16cd('0x3b')],{})[_0x16cd('0x14')](respondWithResult(_0x2800c9,0xc9))[_0x16cd('0x3a')](handleError(_0x2800c9,null));};exports[_0x16cd('0x13')]=function(_0x323fb0,_0x21d295){if(_0x323fb0['body']['id']){delete _0x323fb0['body']['id'];}return db[_0x16cd('0x1d')][_0x16cd('0x39')]({'where':{'id':_0x323fb0[_0x16cd('0x35')]['id']}})[_0x16cd('0x14')](handleEntityNotFound(_0x21d295,null))[_0x16cd('0x14')](function(_0x4b9f41){if(_0x4b9f41[_0x16cd('0x30')]===_0x16cd('0x31')&&_0x323fb0[_0x16cd('0x3b')][_0x16cd('0x33')]){_0x323fb0[_0x16cd('0x3b')]['data3']=encryptor['encryptString'](_0x323fb0[_0x16cd('0x3b')][_0x16cd('0x33')]);}return _0x4b9f41;})[_0x16cd('0x14')](saveUpdates(_0x323fb0[_0x16cd('0x3b')],null))[_0x16cd('0x14')](respondWithResult(_0x21d295,null))['catch'](handleError(_0x21d295,null));};exports[_0x16cd('0x15')]=function(_0x51b1fe,_0x1b9a8a){return db['CloudProvider'][_0x16cd('0x39')]({'where':{'id':_0x51b1fe[_0x16cd('0x35')]['id']}})[_0x16cd('0x14')](handleEntityNotFound(_0x1b9a8a,null))[_0x16cd('0x14')](removeEntity(_0x1b9a8a,null))[_0x16cd('0x3a')](handleError(_0x1b9a8a,null));};exports[_0x16cd('0x42')]=function(_0x266aa8,_0xa55fd5){return db[_0x16cd('0x1d')][_0x16cd('0x43')]({'where':{'id':_0x266aa8['params']['id']},'raw':!![]})[_0x16cd('0x14')](function(_0x4c7636){if(!_0x4c7636)return _0xa55fd5['sendStatus'](0x194);return{'url':oauth[_0x16cd('0x44')](_0x4c7636,_0x266aa8[_0x16cd('0x45')]['id'])};})[_0x16cd('0x14')](respondWithResult(_0xa55fd5,null))[_0x16cd('0x3a')](handleError(_0xa55fd5,null));};exports[_0x16cd('0x46')]=function(_0x4668d4,_0x31baa6){var _0x29f14e=_0x4668d4[_0x16cd('0x3b')];var _0x2e1f7f;var _0x386cc8;if(_0x29f14e[_0x16cd('0x16')])throw _0x29f14e;redis[_0x16cd('0x47')](_0x29f14e[_0x16cd('0x48')])[_0x16cd('0x14')](function(_0x2e9207){if(!_0x2e9207)throw new Error(_0x16cd('0x49'));_0x2e1f7f=JSON['parse'](_0x2e9207);var _0x2d5f83=Buffer[_0x16cd('0x4a')](_0x29f14e[_0x16cd('0x48')],'base64')[_0x16cd('0x4b')](_0x16cd('0x4c'));_0x386cc8=JSON[_0x16cd('0x4d')](_0x2d5f83);if(!oauth[_0x16cd('0x4e')](_0x29f14e[_0x16cd('0x4f')],_0x2e1f7f[_0x16cd('0x50')]))throw new Error(_0x16cd('0x51'));redis['del'](_0x29f14e[_0x16cd('0x48')]);return oauth[_0x16cd('0x52')](_0x29f14e[_0x16cd('0x53')],_0x2e1f7f);})[_0x16cd('0x14')](function(_0x27d005){_0x2e1f7f[_0x16cd('0x54')]=_0x27d005[_0x16cd('0x55')];_0x2e1f7f['data6']=_0x27d005['refresh_token'];return db['CloudProvider'][_0x16cd('0x13')]({'data5':_0x2e1f7f[_0x16cd('0x54')],'data6':_0x2e1f7f[_0x16cd('0x56')]},{'where':{'id':_0x2e1f7f['id']}});})[_0x16cd('0x14')](function(){oauth[_0x16cd('0x57')](_0x2e1f7f);socket[_0x16cd('0x58')](_0x16cd('0x59'),{'id':_0x386cc8['id']});return;})[_0x16cd('0x14')](respondWithStatusCode(_0x31baa6,null))[_0x16cd('0x3a')](function(_0x93d89){if(_0x386cc8){socket['emit'](_0x16cd('0x5a'),{'id':_0x386cc8['id']});}if(!_0x2e1f7f){logger[_0x16cd('0x16')](_0x16cd('0x5b'),_0x93d89);return _0x31baa6[_0x16cd('0xb')](0x1f4)[_0x16cd('0x19')](_0x93d89['message']);}logger[_0x16cd('0x16')](_0x16cd('0x5c'),_0x2e1f7f['id'],JSON['stringify'](_0x93d89));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 164057a..4ff686c 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 _0x1395=['cloud_providers','util','../../config/logger','moment','request-promise','rimraf','exports','define','CloudProvider'];(function(_0x297d07,_0x449e85){var _0x5994fa=function(_0x2cd4a3){while(--_0x2cd4a3){_0x297d07['push'](_0x297d07['shift']());}};_0x5994fa(++_0x449e85);}(_0x1395,0x10f));var _0x5139=function(_0x3bcd7f,_0x3d9594){_0x3bcd7f=_0x3bcd7f-0x0;var _0xc45ea1=_0x1395[_0x3bcd7f];return _0xc45ea1;};'use strict';var _=require('lodash');var util=require(_0x5139('0x0'));var logger=require(_0x5139('0x1'))('api');var moment=require(_0x5139('0x2'));var BPromise=require('bluebird');var rp=require(_0x5139('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5139('0x4'));var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module[_0x5139('0x5')]=function(_0x197510,_0x38d7ab){return _0x197510[_0x5139('0x6')](_0x5139('0x7'),attributes,{'tableName':_0x5139('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41f4=['cloud_providers','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','CloudProvider'];(function(_0x15c5a3,_0xffa9f){var _0x8847df=function(_0x12526c){while(--_0x12526c){_0x15c5a3['push'](_0x15c5a3['shift']());}};_0x8847df(++_0xffa9f);}(_0x41f4,0x175));var _0x441f=function(_0x25600d,_0x1b8c6c){_0x25600d=_0x25600d-0x0;var _0x2249dd=_0x41f4[_0x25600d];return _0x2249dd;};'use strict';var _=require(_0x441f('0x0'));var util=require(_0x441f('0x1'));var logger=require(_0x441f('0x2'))(_0x441f('0x3'));var moment=require(_0x441f('0x4'));var BPromise=require('bluebird');var rp=require(_0x441f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x441f('0x6'));var config=require(_0x441f('0x7'));var attributes=require('./cloudProvider.attributes');module[_0x441f('0x8')]=function(_0x6c4f5,_0x292970){return _0x6c4f5[_0x441f('0x9')](_0x441f('0xa'),attributes,{'tableName':_0x441f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index b64ede1..9065a5d 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22d8=['map','type','Dynamics365','push','data7','/.default','join','Outlook365','code','id_token','from','toString','base64','hex','client_id','data4','response_mode','scope','nonce','login','oauth2Claims','replace','oauth2/','data1','set','stringify','decode','payload','iss','issuer','isAfter','unix','exp','resolve','then','data3','data6','decryptString','POST','data5','access_token','refresh_token','CloudProvider','update','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','{TENANT_ID}','data2','intervals','bind','findAll','all','catch','inspect','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','../../config/logger','api','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize'];(function(_0x341329,_0x426b37){var _0x1a79e5=function(_0xd51086){while(--_0xd51086){_0x341329['push'](_0x341329['shift']());}};_0x1a79e5(++_0x426b37);}(_0x22d8,0x83));var _0x822d=function(_0x2b3501,_0x2e5ed3){_0x2b3501=_0x2b3501-0x0;var _0x3642a3=_0x22d8[_0x2b3501];return _0x3642a3;};'use strict';var _=require(_0x822d('0x0'));var crypto=require(_0x822d('0x1'));var jwt=require(_0x822d('0x2'));var moment=require(_0x822d('0x3'));var Redis=require(_0x822d('0x4'));var rp=require(_0x822d('0x5'));var util=require('util');var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x822d('0x6'))(_0x822d('0x7'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x822d('0x8'))['db'];config[_0x822d('0x9')]=_[_0x822d('0xa')](config[_0x822d('0x9')],{'host':_0x822d('0xb'),'port':0x18eb});var redis=new Redis(config[_0x822d('0x9')]);var MICROSOFT_AUTH_URL=_0x822d('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0x822d('0xd'),_0x822d('0xe'),_0x822d('0xf'),_0x822d('0x10'),_0x822d('0x11'),_0x822d('0x12'),_0x822d('0x13')],'Dynamics365':[_0x822d('0xd'),_0x822d('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0x822d('0x14');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x224509){var _0x2f8b72=_[_0x822d('0x15')](AZURE_AUTH_SCOPES[_0x224509[_0x822d('0x16')]]);if(_0x224509[_0x822d('0x16')]===_0x822d('0x17'))_0x2f8b72[_0x822d('0x18')](_0x224509[_0x822d('0x19')]+_0x822d('0x1a'));return _0x2f8b72[_0x822d('0x1b')]('\x20');}function getAccessTokenScope(_0x321ce7){if(_0x321ce7['type']===_0x822d('0x1c'))return _0x822d('0x11');if(_0x321ce7[_0x822d('0x16')]==='Dynamics365')return _0x321ce7[_0x822d('0x19')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x5b0ccd,_0x59c831){var _0x109563=MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x5b0ccd['data2']);var _0x1fdb4d=[_0x822d('0x1d'),_0x822d('0x1e')];var _0x4822bc=Buffer[_0x822d('0x1f')](JSON['stringify']({'id':_0x59c831}))[_0x822d('0x20')](_0x822d('0x21'));var _0x4cee91=crypto['randomBytes'](0x10)[_0x822d('0x20')](_0x822d('0x22'));var _0x222fde=getAuthorizationScopes(_0x5b0ccd);var _0x3f0c5b=[{'key':_0x822d('0x23'),'value':_0x5b0ccd['data1']},{'key':'response_type','value':encodeURIComponent(_0x1fdb4d[_0x822d('0x1b')]('\x20'))},{'key':'redirect_uri','value':_0x5b0ccd[_0x822d('0x24')]},{'key':_0x822d('0x25'),'value':'form_post'},{'key':_0x822d('0x26'),'value':encodeURIComponent(_0x222fde)},{'key':'state','value':_0x4822bc},{'key':_0x822d('0x27'),'value':_0x4cee91},{'key':'prompt','value':_0x822d('0x28')}];var _0x3cb751=_0x109563+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x822d('0x15')](_0x3f0c5b,function(_0x42831d){return _0x42831d['key']+'='+_0x42831d['value'];})[_0x822d('0x1b')]('&');_0x5b0ccd[_0x822d('0x29')]={'issuer':_0x109563[_0x822d('0x2a')](_0x822d('0x2b'),''),'audience':_0x5b0ccd[_0x822d('0x2c')],'state':_0x4822bc,'nonce':_0x4cee91};redis[_0x822d('0x2d')](_0x4822bc,JSON[_0x822d('0x2e')](_0x5b0ccd));return _0x3cb751;}function isValidIdToken(_0x1251d5,_0x34f60f){try{var _0x1e6f24=jwt[_0x822d('0x2f')](_0x1251d5,{'complete':!![]});var _0x40bb88=_0x1e6f24[_0x822d('0x30')];if(_0x40bb88[_0x822d('0x31')]!==_0x34f60f[_0x822d('0x32')])return![];if(_0x40bb88['aud']!==_0x34f60f['audience'])return![];if(_0x40bb88[_0x822d('0x27')]!==_0x34f60f[_0x822d('0x27')])return![];if(moment()[_0x822d('0x33')](moment[_0x822d('0x34')](_0x40bb88[_0x822d('0x35')])))return![];return!![];}catch(_0x5a1ca6){throw _0x5a1ca6;}}function refreshOauth2MicrosoftAccessToken(_0x441923){return Promise[_0x822d('0x36')]()[_0x822d('0x37')](function(){if(_0x441923[_0x822d('0x38')])return _0x441923;return db['CloudProvider']['findOne']({'where':{'id':_0x441923['id']},'raw':!![]});})[_0x822d('0x37')](function(_0x202557){var _0x4f429d={'grant_type':'refresh_token','refresh_token':_0x202557[_0x822d('0x39')],'scope':getAccessTokenScope(_0x202557),'redirect_uri':_0x202557['data4'],'client_id':_0x202557[_0x822d('0x2c')],'client_secret':encryptor[_0x822d('0x3a')](_0x202557[_0x822d('0x38')])};var _0x1d367f={'method':_0x822d('0x3b'),'uri':MICROSOFT_AUTH_URL[_0x822d('0x2a')]('{TENANT_ID}',_0x202557['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4f429d,'json':!![]};return rp(_0x1d367f);})['then'](function(_0x1a8c30){_0x441923[_0x822d('0x3c')]=_0x1a8c30[_0x822d('0x3d')];_0x441923['data6']=_0x1a8c30[_0x822d('0x3e')];return db[_0x822d('0x3f')][_0x822d('0x40')]({'data5':_0x441923[_0x822d('0x3c')],'data6':_0x441923['data6']},{'where':{'id':_0x441923['id']}});})[_0x822d('0x37')](function(){return _0x441923;})['catch'](function(_0x4927b4){logger[_0x822d('0x41')](_0x822d('0x42'),_0x441923['id'],_0x4927b4);});}function getOauth2MicrosoftAccessToken(_0x5a80ef,_0x20bf48){var _0x5ea3d6={'grant_type':'authorization_code','code':_0x5a80ef,'scope':getAccessTokenScope(_0x20bf48),'redirect_uri':_0x20bf48[_0x822d('0x24')],'client_id':_0x20bf48[_0x822d('0x2c')],'client_secret':encryptor['decryptString'](_0x20bf48['data3'])};var _0x43d00b={'method':_0x822d('0x3b'),'uri':MICROSOFT_AUTH_URL[_0x822d('0x2a')](_0x822d('0x43'),_0x20bf48[_0x822d('0x44')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5ea3d6,'json':!![]};return rp(_0x43d00b);}function startRefreshInterval(_0x162862){var _0x3dcbf5=schedule[_0x822d('0x45')];if(_0x3dcbf5[_0x162862['id']])clearInterval(_0x3dcbf5[_0x162862['id']]);_0x3dcbf5[_0x162862['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x822d('0x46')](this,{'id':_0x162862['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x3dcbf5;}function startAllRefreshIntervals(){return db[_0x822d('0x3f')][_0x822d('0x47')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x1d0e1f){var _0x1dc137=_0x1d0e1f[_0x822d('0x15')](function(_0x5163ff){return refreshOauth2MicrosoftAccessToken(_0x5163ff)['then'](function(_0x53e1a4){startRefreshInterval(_0x53e1a4);});});return Promise[_0x822d('0x48')](_0x1dc137);})[_0x822d('0x49')](function(_0x15156a){var _0x429d3f=_0x15156a?util[_0x822d('0x4a')](_0x15156a,{'showHidden':![],'depth':null}):'';logger[_0x822d('0x41')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x429d3f);});}module[_0x822d('0x4b')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x9151=['payload','iss','issuer','aud','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','refresh_token','data6','decryptString','POST','{TENANT_ID}','access_token','update','data5','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','intervals','bind','findAll','all','inspect','exports','lodash','crypto','jsonwebtoken','request-promise','util','../../config/logger','api','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/token','map','type','Dynamics365','data7','/.default','join','Outlook365','replace','data2','id_token','from','stringify','toString','randomBytes','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','scope','nonce','prompt','login','value','oauth2Claims','oauth2/','set'];(function(_0x373c94,_0x4b857e){var _0x4a9043=function(_0x5af69e){while(--_0x5af69e){_0x373c94['push'](_0x373c94['shift']());}};_0x4a9043(++_0x4b857e);}(_0x9151,0x14c));var _0x1915=function(_0x29e7fb,_0x5b2ff3){_0x29e7fb=_0x29e7fb-0x0;var _0x171dad=_0x9151[_0x29e7fb];return _0x171dad;};'use strict';var _=require(_0x1915('0x0'));var crypto=require(_0x1915('0x1'));var jwt=require(_0x1915('0x2'));var moment=require('moment');var Redis=require('ioredis');var rp=require(_0x1915('0x3'));var util=require(_0x1915('0x4'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x1915('0x5'))(_0x1915('0x6'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x1915('0x7'))['db'];config[_0x1915('0x8')]=_[_0x1915('0x9')](config[_0x1915('0x8')],{'host':_0x1915('0xa'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x1915('0xb');var AZURE_AUTH_SCOPES={'Outlook365':[_0x1915('0xc'),'profile',_0x1915('0xd'),'offline_access',_0x1915('0xe'),_0x1915('0xf'),_0x1915('0x10')],'Dynamics365':[_0x1915('0xc'),_0x1915('0x11')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x1915('0x12');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x3f1309){var _0x345762=_[_0x1915('0x13')](AZURE_AUTH_SCOPES[_0x3f1309[_0x1915('0x14')]]);if(_0x3f1309['type']===_0x1915('0x15'))_0x345762['push'](_0x3f1309[_0x1915('0x16')]+_0x1915('0x17'));return _0x345762[_0x1915('0x18')]('\x20');}function getAccessTokenScope(_0x46ccab){if(_0x46ccab[_0x1915('0x14')]===_0x1915('0x19'))return _0x1915('0xe');if(_0x46ccab[_0x1915('0x14')]===_0x1915('0x15'))return _0x46ccab[_0x1915('0x16')]+_0x1915('0x17');}function generateMicrosoftAuthorizationUrl(_0x90529c,_0x2974e2){var _0x1cc56c=MICROSOFT_AUTH_URL[_0x1915('0x1a')]('{TENANT_ID}',_0x90529c[_0x1915('0x1b')]);var _0x59bcb9=['code',_0x1915('0x1c')];var _0x29d4a4=Buffer[_0x1915('0x1d')](JSON[_0x1915('0x1e')]({'id':_0x2974e2}))[_0x1915('0x1f')]('base64');var _0x32f79f=crypto[_0x1915('0x20')](0x10)['toString'](_0x1915('0x21'));var _0x41c09a=getAuthorizationScopes(_0x90529c);var _0x35c0b5=[{'key':_0x1915('0x22'),'value':_0x90529c[_0x1915('0x23')]},{'key':_0x1915('0x24'),'value':encodeURIComponent(_0x59bcb9[_0x1915('0x18')]('\x20'))},{'key':_0x1915('0x25'),'value':_0x90529c[_0x1915('0x26')]},{'key':_0x1915('0x27'),'value':'form_post'},{'key':_0x1915('0x28'),'value':encodeURIComponent(_0x41c09a)},{'key':'state','value':_0x29d4a4},{'key':_0x1915('0x29'),'value':_0x32f79f},{'key':_0x1915('0x2a'),'value':_0x1915('0x2b')}];var _0x53b093=_0x1cc56c+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x1915('0x13')](_0x35c0b5,function(_0x322109){return _0x322109['key']+'='+_0x322109[_0x1915('0x2c')];})[_0x1915('0x18')]('&');_0x90529c[_0x1915('0x2d')]={'issuer':_0x1cc56c[_0x1915('0x1a')](_0x1915('0x2e'),''),'audience':_0x90529c[_0x1915('0x23')],'state':_0x29d4a4,'nonce':_0x32f79f};redis[_0x1915('0x2f')](_0x29d4a4,JSON[_0x1915('0x1e')](_0x90529c));return _0x53b093;}function isValidIdToken(_0x4205ce,_0x2aeb37){try{var _0x3347e4=jwt['decode'](_0x4205ce,{'complete':!![]});var _0x268c92=_0x3347e4[_0x1915('0x30')];if(_0x268c92[_0x1915('0x31')]!==_0x2aeb37[_0x1915('0x32')])return![];if(_0x268c92[_0x1915('0x33')]!==_0x2aeb37[_0x1915('0x34')])return![];if(_0x268c92['nonce']!==_0x2aeb37[_0x1915('0x29')])return![];if(moment()[_0x1915('0x35')](moment[_0x1915('0x36')](_0x268c92[_0x1915('0x37')])))return![];return!![];}catch(_0x410a64){throw _0x410a64;}}function refreshOauth2MicrosoftAccessToken(_0x2c8b8f){return Promise[_0x1915('0x38')]()[_0x1915('0x39')](function(){if(_0x2c8b8f[_0x1915('0x3a')])return _0x2c8b8f;return db[_0x1915('0x3b')]['findOne']({'where':{'id':_0x2c8b8f['id']},'raw':!![]});})[_0x1915('0x39')](function(_0x2b964e){var _0x1bdbf5={'grant_type':_0x1915('0x3c'),'refresh_token':_0x2b964e[_0x1915('0x3d')],'scope':getAccessTokenScope(_0x2b964e),'redirect_uri':_0x2b964e[_0x1915('0x26')],'client_id':_0x2b964e['data1'],'client_secret':encryptor[_0x1915('0x3e')](_0x2b964e[_0x1915('0x3a')])};var _0x3b87af={'method':_0x1915('0x3f'),'uri':MICROSOFT_AUTH_URL[_0x1915('0x1a')](_0x1915('0x40'),_0x2b964e[_0x1915('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1bdbf5,'json':!![]};return rp(_0x3b87af);})['then'](function(_0x1eff4d){_0x2c8b8f['data5']=_0x1eff4d[_0x1915('0x41')];_0x2c8b8f[_0x1915('0x3d')]=_0x1eff4d[_0x1915('0x3c')];return db['CloudProvider'][_0x1915('0x42')]({'data5':_0x2c8b8f[_0x1915('0x43')],'data6':_0x2c8b8f[_0x1915('0x3d')]},{'where':{'id':_0x2c8b8f['id']}});})[_0x1915('0x39')](function(){return _0x2c8b8f;})[_0x1915('0x44')](function(_0x865a1e){logger['error'](_0x1915('0x45'),_0x2c8b8f['id'],_0x865a1e);});}function getOauth2MicrosoftAccessToken(_0x2e73ec,_0x514081){var _0x474c1c={'grant_type':'authorization_code','code':_0x2e73ec,'scope':getAccessTokenScope(_0x514081),'redirect_uri':_0x514081[_0x1915('0x26')],'client_id':_0x514081[_0x1915('0x23')],'client_secret':encryptor[_0x1915('0x3e')](_0x514081[_0x1915('0x3a')])};var _0x275f04={'method':_0x1915('0x3f'),'uri':MICROSOFT_AUTH_URL[_0x1915('0x1a')]('{TENANT_ID}',_0x514081[_0x1915('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x474c1c,'json':!![]};return rp(_0x275f04);}function startRefreshInterval(_0x1a77c4){var _0x165812=schedule[_0x1915('0x46')];if(_0x165812[_0x1a77c4['id']])clearInterval(_0x165812[_0x1a77c4['id']]);_0x165812[_0x1a77c4['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x1915('0x47')](this,{'id':_0x1a77c4['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x1915('0x46')]=_0x165812;}function startAllRefreshIntervals(){return db[_0x1915('0x3b')][_0x1915('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x1915('0x39')](function(_0x5aaeab){var _0x5b71e4=_0x5aaeab[_0x1915('0x13')](function(_0x5b7407){return refreshOauth2MicrosoftAccessToken(_0x5b7407)[_0x1915('0x39')](function(_0x564829){startRefreshInterval(_0x564829);});});return Promise[_0x1915('0x49')](_0x5b71e4);})['catch'](function(_0x4233be){var _0x354b0c=_0x4233be?util[_0x1915('0x4a')](_0x4233be,{'showHidden':![],'depth':null}):'';logger['error']('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x354b0c);});}module[_0x1915('0x4b')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index b99603e..c78a016 100644 --- a/server/api/cloudProvider/cloudProvider.rpc.js +++ b/server/api/cloudProvider/cloudProvider.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1122=['CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code'];(function(_0xa33e84,_0x47c796){var _0x492104=function(_0x2b51f6){while(--_0x2b51f6){_0xa33e84['push'](_0xa33e84['shift']());}};_0x492104(++_0x47c796);}(_0x1122,0xac));var _0x2112=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1122[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2112('0x0'));var util=require('util');var moment=require(_0x2112('0x1'));var BPromise=require(_0x2112('0x2'));var rs=require(_0x2112('0x3'));var fs=require('fs');var Redis=require(_0x2112('0x4'));var db=require(_0x2112('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2112('0x6'));var config=require('../../config/environment');var jayson=require(_0x2112('0x7'));var client=jayson[_0x2112('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcca285,_0x2ad731,_0x3f0a81){return new BPromise(function(_0x272bdb,_0x4190c7){return client[_0x2112('0x9')](_0xcca285,_0x3f0a81)[_0x2112('0xa')](function(_0x2f7142){logger[_0x2112('0xb')]('CloudProvider,\x20%s,\x20%s',_0x2ad731,_0x2112('0xc'));logger[_0x2112('0xd')](_0x2112('0xe'),_0x2ad731,_0x2112('0xc'),JSON['stringify'](_0x2f7142));if(_0x2f7142[_0x2112('0xf')]){if(_0x2f7142[_0x2112('0xf')][_0x2112('0x10')]===0x1f4){logger[_0x2112('0xf')](_0x2112('0x11'),_0x2ad731,_0x2f7142[_0x2112('0xf')][_0x2112('0x12')]);return _0x4190c7(_0x2f7142['error'][_0x2112('0x12')]);}logger['error'](_0x2112('0x11'),_0x2ad731,_0x2f7142[_0x2112('0xf')]['message']);return _0x272bdb(_0x2f7142[_0x2112('0xf')]['message']);}else{logger[_0x2112('0xb')]('CloudProvider,\x20%s,\x20%s',_0x2ad731,_0x2112('0xc'));_0x272bdb(_0x2f7142[_0x2112('0x13')]['message']);}})[_0x2112('0x14')](function(_0x4db5c3){logger[_0x2112('0xf')]('CloudProvider,\x20%s,\x20%s',_0x2ad731,_0x4db5c3);_0x4190c7(_0x4db5c3);});});} \ No newline at end of file +var _0x6f75=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5a27e8,_0x492a2f){var _0x4e38f7=function(_0x2a4048){while(--_0x2a4048){_0x5a27e8['push'](_0x5a27e8['shift']());}};_0x4e38f7(++_0x492a2f);}(_0x6f75,0x71));var _0x56f7=function(_0x8f42d8,_0x1c9063){_0x8f42d8=_0x8f42d8-0x0;var _0x4f169c=_0x6f75[_0x8f42d8];return _0x4f169c;};'use strict';var _=require(_0x56f7('0x0'));var util=require(_0x56f7('0x1'));var moment=require(_0x56f7('0x2'));var BPromise=require(_0x56f7('0x3'));var rs=require(_0x56f7('0x4'));var fs=require('fs');var Redis=require(_0x56f7('0x5'));var db=require(_0x56f7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x56f7('0x7'))(_0x56f7('0x8'));var config=require(_0x56f7('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x137d14,_0xcc51b1,_0x4b5dcc){return new BPromise(function(_0x184bf7,_0x5155ff){return client['request'](_0x137d14,_0x4b5dcc)[_0x56f7('0xa')](function(_0x1e607c){logger[_0x56f7('0xb')](_0x56f7('0xc'),_0xcc51b1,_0x56f7('0xd'));logger[_0x56f7('0xe')](_0x56f7('0xf'),_0xcc51b1,_0x56f7('0xd'),JSON[_0x56f7('0x10')](_0x1e607c));if(_0x1e607c[_0x56f7('0x11')]){if(_0x1e607c[_0x56f7('0x11')][_0x56f7('0x12')]===0x1f4){logger[_0x56f7('0x11')](_0x56f7('0xc'),_0xcc51b1,_0x1e607c['error'][_0x56f7('0x13')]);return _0x5155ff(_0x1e607c[_0x56f7('0x11')][_0x56f7('0x13')]);}logger[_0x56f7('0x11')](_0x56f7('0xc'),_0xcc51b1,_0x1e607c[_0x56f7('0x11')][_0x56f7('0x13')]);return _0x184bf7(_0x1e607c[_0x56f7('0x11')][_0x56f7('0x13')]);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0xcc51b1,_0x56f7('0xd'));_0x184bf7(_0x1e607c[_0x56f7('0x14')][_0x56f7('0x13')]);}})[_0x56f7('0x15')](function(_0x40fb77){logger[_0x56f7('0x11')]('CloudProvider,\x20%s,\x20%s',_0xcc51b1,_0x40fb77);_0x5155ff(_0x40fb77);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 93aaf85..e11b3c7 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 _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x7a54,0x106));var _0x47a5=function(_0x300fec,_0x401c14){_0x300fec=_0x300fec-0x0;var _0x4611c1=_0x7a54[_0x300fec];return _0x4611c1;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=router; \ No newline at end of file +var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x25753e,_0x3efa56){var _0x36d510=function(_0x2cc1f3){while(--_0x2cc1f3){_0x25753e['push'](_0x25753e['shift']());}};_0x36d510(++_0x3efa56);}(_0x2ef3,0xba));var _0x32ef=function(_0x49c993,_0x3d14d2){_0x49c993=_0x49c993-0x0;var _0x30a4f8=_0x2ef3[_0x49c993];return _0x30a4f8;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 220545e..2c7a53f 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 _0x823d=['exports','STRING'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x823d,0x166));var _0xd823=function(_0x5947f8,_0x305779){_0x5947f8=_0x5947f8-0x0;var _0x43888e=_0x823d[_0x5947f8];return _0x43888e;};'use strict';var Sequelize=require('sequelize');module[_0xd823('0x0')]={'name':{'type':Sequelize[_0xd823('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xd823('0x1')]},'companyId':{'type':Sequelize[_0xd823('0x1')]},'website':{'type':Sequelize[_0xd823('0x1')]},'phone':{'type':Sequelize[_0xd823('0x1')]},'fax':{'type':Sequelize[_0xd823('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xd823('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xd823('0x1')]},'sStreet':{'type':Sequelize[_0xd823('0x1')]},'sPostalCode':{'type':Sequelize[_0xd823('0x1')]},'sCity':{'type':Sequelize[_0xd823('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd823('0x1')]}}; \ No newline at end of file +var _0xa2ad=['exports','STRING','name','sequelize'];(function(_0x1dc670,_0x3e48bf){var _0x269320=function(_0x198d92){while(--_0x198d92){_0x1dc670['push'](_0x1dc670['shift']());}};_0x269320(++_0x3e48bf);}(_0xa2ad,0xa3));var _0xda2a=function(_0x509d9e,_0x2d1197){_0x509d9e=_0x509d9e-0x0;var _0x56b488=_0xa2ad[_0x509d9e];return _0x56b488;};'use strict';var Sequelize=require(_0xda2a('0x0'));module[_0xda2a('0x1')]={'name':{'type':Sequelize[_0xda2a('0x2')],'unique':_0xda2a('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xda2a('0x2')]},'companyId':{'type':Sequelize[_0xda2a('0x2')]},'website':{'type':Sequelize[_0xda2a('0x2')]},'phone':{'type':Sequelize[_0xda2a('0x2')]},'fax':{'type':Sequelize[_0xda2a('0x2')]},'type':{'type':Sequelize[_0xda2a('0x2')]},'street':{'type':Sequelize[_0xda2a('0x2')]},'postalCode':{'type':Sequelize[_0xda2a('0x2')]},'city':{'type':Sequelize[_0xda2a('0x2')]},'country':{'type':Sequelize[_0xda2a('0x2')]},'email':{'type':Sequelize[_0xda2a('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xda2a('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xda2a('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xda2a('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 5ec25c6..16d6bd8 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 _0x7055=['get','UserProfileResource','error','name','send','index','CmCompany','describe','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Companies','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','addContacts','CmContact','omit','ids','getContacts','map','options','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy'];(function(_0x29cd52,_0x4f5b1f){var _0x56d686=function(_0x331302){while(--_0x331302){_0x29cd52['push'](_0x29cd52['shift']());}};_0x56d686(++_0x4f5b1f);}(_0x7055,0x189));var _0x5705=function(_0x23f8c8,_0xb536b9){_0x23f8c8=_0x23f8c8-0x0;var _0x3dc718=_0x7055[_0x23f8c8];return _0x3dc718;};'use strict';var emlformat=require(_0x5705('0x0'));var rimraf=require(_0x5705('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5705('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5705('0x3'));var Mustache=require(_0x5705('0x4'));var util=require('util');var path=require(_0x5705('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5705('0x6'));var _=require(_0x5705('0x7'));var squel=require(_0x5705('0x8'));var crypto=require('crypto');var jsforce=require(_0x5705('0x9'));var deskjs=require(_0x5705('0xa'));var toCsv=require(_0x5705('0xb'));var querystring=require(_0x5705('0xc'));var Papa=require(_0x5705('0xd'));var Redis=require(_0x5705('0xe'));var authService=require(_0x5705('0xf'));var qs=require(_0x5705('0x10'));var as=require(_0x5705('0x11'));var hardwareService=require(_0x5705('0x12'));var logger=require(_0x5705('0x13'))(_0x5705('0x14'));var utils=require(_0x5705('0x15'));var config=require(_0x5705('0x16'));var licenseUtil=require(_0x5705('0x17'));var db=require(_0x5705('0x18'))['db'];function respondWithStatusCode(_0x1222d7,_0x277278){_0x277278=_0x277278||0xcc;return function(_0x3d4602){if(_0x3d4602){return _0x1222d7['sendStatus'](_0x277278);}return _0x1222d7[_0x5705('0x19')](_0x277278)[_0x5705('0x1a')]();};}function respondWithResult(_0x47dd73,_0x2ab7b0){_0x2ab7b0=_0x2ab7b0||0xc8;return function(_0xe3c58c){if(_0xe3c58c){return _0x47dd73[_0x5705('0x19')](_0x2ab7b0)[_0x5705('0x1b')](_0xe3c58c);}};}function respondWithFilteredResult(_0x50715d,_0xea3b3e){return function(_0x240c9b){if(_0x240c9b){var _0x287198=typeof _0xea3b3e[_0x5705('0x1c')]===_0x5705('0x1d')&&typeof _0xea3b3e[_0x5705('0x1e')]===_0x5705('0x1d');var _0x65c6d2=_0x240c9b['count'];var _0xb35e87=_0x287198?0x0:_0xea3b3e[_0x5705('0x1c')];var _0x4b3404=_0x287198?_0x240c9b[_0x5705('0x1f')]:_0xea3b3e['offset']+_0xea3b3e[_0x5705('0x1e')];var _0x3aa4e6;if(_0x4b3404>=_0x65c6d2){_0x4b3404=_0x65c6d2;_0x3aa4e6=0xc8;}else{_0x3aa4e6=0xce;}_0x50715d['status'](_0x3aa4e6);return _0x50715d['set'](_0x5705('0x20'),_0xb35e87+'-'+_0x4b3404+'/'+_0x65c6d2)[_0x5705('0x1b')](_0x240c9b);}return null;};}function patchUpdates(_0x12e33b){return function(_0x236a77){try{jsonpatch['apply'](_0x236a77,_0x12e33b,!![]);}catch(_0x5c8b97){return BPromise[_0x5705('0x21')](_0x5c8b97);}return _0x236a77[_0x5705('0x22')]();};}function saveUpdates(_0x3407ec,_0x56d9a8){return function(_0xf7a5fa){if(_0xf7a5fa){return _0xf7a5fa['update'](_0x3407ec)[_0x5705('0x23')](function(_0x5c24a5){return _0x5c24a5;});}return null;};}function removeEntity(_0x42f099,_0x26898c){return function(_0x2c5945){if(_0x2c5945){return _0x2c5945[_0x5705('0x24')]()[_0x5705('0x23')](function(){var _0x3be7c2=_0x2c5945[_0x5705('0x25')]({'plain':!![]});var _0x3ad855='Companies';return db[_0x5705('0x26')][_0x5705('0x24')]({'where':{'type':_0x3ad855,'resourceId':_0x3be7c2['id']}})[_0x5705('0x23')](function(){return _0x2c5945;});})['then'](function(){_0x42f099['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f643d,_0xa46eaa){return function(_0x281a3a){if(!_0x281a3a){_0x4f643d['sendStatus'](0x194);}return _0x281a3a;};}function handleError(_0x561dea,_0x3fc7da){_0x3fc7da=_0x3fc7da||0x1f4;return function(_0x2dc691){logger[_0x5705('0x27')](_0x2dc691['stack']);if(_0x2dc691[_0x5705('0x28')]){delete _0x2dc691['name'];}_0x561dea['status'](_0x3fc7da)[_0x5705('0x29')](_0x2dc691);};}exports[_0x5705('0x2a')]=function(_0x2f9b71,_0x1ede1a){var _0xce5818={},_0x4e2e29={},_0x87c2e9={'count':0x0,'rows':[]};return db[_0x5705('0x2b')][_0x5705('0x2c')]()[_0x5705('0x23')](function(_0x2e6f8e){_0x4e2e29[_0x5705('0x2d')]=_['keys'](_0x2e6f8e);_0x4e2e29[_0x5705('0x2e')]=_[_0x5705('0x2f')](_0x2f9b71['query']);_0x4e2e29['filters']=_[_0x5705('0x30')](_0x4e2e29[_0x5705('0x2d')],_0x4e2e29['query']);_0xce5818[_0x5705('0x31')]=_[_0x5705('0x30')](_0x4e2e29[_0x5705('0x2d')],qs[_0x5705('0x32')](_0x2f9b71['query'][_0x5705('0x32')]));_0xce5818['attributes']=_0xce5818['attributes'][_0x5705('0x33')]?_0xce5818[_0x5705('0x31')]:_0x4e2e29['model'];if(!_0x2f9b71['query'][_0x5705('0x34')](_0x5705('0x35'))){_0xce5818[_0x5705('0x1e')]=qs['limit'](_0x2f9b71['query'][_0x5705('0x1e')]);_0xce5818[_0x5705('0x1c')]=qs[_0x5705('0x1c')](_0x2f9b71[_0x5705('0x2e')][_0x5705('0x1c')]);}_0xce5818[_0x5705('0x36')]=qs[_0x5705('0x37')](_0x2f9b71[_0x5705('0x2e')][_0x5705('0x37')]);_0xce5818['where']=qs[_0x5705('0x38')](_[_0x5705('0x39')](_0x2f9b71[_0x5705('0x2e')],_0x4e2e29[_0x5705('0x38')]),_0x2e6f8e);if(_0x2f9b71['query'][_0x5705('0x3a')]){_0xce5818['where']=_[_0x5705('0x3b')](_0xce5818[_0x5705('0x3c')],{'$or':_['map'](_0xce5818['attributes'],function(_0x437735){var _0x3bdf17={};_0x3bdf17[_0x437735]={'$like':'%'+_0x2f9b71[_0x5705('0x2e')][_0x5705('0x3a')]+'%'};return _0x3bdf17;})});}_0xce5818=_['merge']({},_0xce5818,_0x2f9b71['options']);var _0x2e4b94={'where':_0xce5818[_0x5705('0x3c')]};return db[_0x5705('0x2b')][_0x5705('0x1f')](_0x2e4b94)[_0x5705('0x23')](function(_0x153070){_0x87c2e9['count']=_0x153070;if(_0x2f9b71[_0x5705('0x2e')][_0x5705('0x3d')]){_0xce5818[_0x5705('0x3e')]=[{'all':!![]}];}return db[_0x5705('0x2b')][_0x5705('0x3f')](_0xce5818);})[_0x5705('0x23')](function(_0x25597e){_0x87c2e9[_0x5705('0x40')]=_0x25597e;return _0x87c2e9;})[_0x5705('0x23')](respondWithFilteredResult(_0x1ede1a,_0xce5818))[_0x5705('0x41')](handleError(_0x1ede1a,null));})[_0x5705('0x41')](handleError(_0x1ede1a,null));};exports[_0x5705('0x42')]=function(_0x37a507,_0x45118f){var _0x412326={'raw':![],'where':{'id':_0x37a507[_0x5705('0x43')]['id']}},_0x4fe9dc={};_0x4fe9dc['model']=_[_0x5705('0x2f')](db[_0x5705('0x2b')][_0x5705('0x44')]);_0x4fe9dc[_0x5705('0x2e')]=_['keys'](_0x37a507[_0x5705('0x2e')]);_0x4fe9dc['filters']=_[_0x5705('0x30')](_0x4fe9dc[_0x5705('0x2d')],_0x4fe9dc[_0x5705('0x2e')]);_0x412326[_0x5705('0x31')]=_[_0x5705('0x30')](_0x4fe9dc[_0x5705('0x2d')],qs['fields'](_0x37a507['query'][_0x5705('0x32')]));_0x412326[_0x5705('0x31')]=_0x412326[_0x5705('0x31')][_0x5705('0x33')]?_0x412326[_0x5705('0x31')]:_0x4fe9dc['model'];if(_0x37a507[_0x5705('0x2e')][_0x5705('0x3d')]){_0x412326[_0x5705('0x3e')]=[{'all':!![]}];}_0x412326=_[_0x5705('0x3b')]({},_0x412326,_0x37a507['options']);return db[_0x5705('0x2b')]['find'](_0x412326)[_0x5705('0x23')](handleEntityNotFound(_0x45118f,null))[_0x5705('0x23')](respondWithResult(_0x45118f,null))[_0x5705('0x41')](handleError(_0x45118f,null));};exports[_0x5705('0x45')]=function(_0x1f10a2,_0xac3a75){return db[_0x5705('0x2b')][_0x5705('0x45')](_0x1f10a2[_0x5705('0x46')],{})[_0x5705('0x23')](function(_0x922d23){var _0x2c6350=_0x1f10a2['user'][_0x5705('0x25')]({'plain':!![]});if(!_0x2c6350)throw new Error(_0x5705('0x47'));if(_0x2c6350['role']===_0x5705('0x48')){var _0x1a4b4b=_0x922d23[_0x5705('0x25')]({'plain':!![]});var _0x47c341=_0x5705('0x49');return db[_0x5705('0x4a')]['find']({'where':{'name':_0x47c341,'userProfileId':_0x2c6350['userProfileId']},'raw':!![]})[_0x5705('0x23')](function(_0x42d68a){if(_0x42d68a&&_0x42d68a[_0x5705('0x4b')]===0x0){return db['UserProfileResource'][_0x5705('0x45')]({'name':_0x1a4b4b[_0x5705('0x28')],'resourceId':_0x1a4b4b['id'],'type':_0x42d68a[_0x5705('0x28')],'sectionId':_0x42d68a['id']},{})['then'](function(){return _0x922d23;});}else{return _0x922d23;}})[_0x5705('0x41')](function(_0x31fd99){logger['error'](_0x5705('0x4c'),_0x31fd99);throw _0x31fd99;});}return _0x922d23;})[_0x5705('0x23')](respondWithResult(_0xac3a75,0xc9))[_0x5705('0x41')](handleError(_0xac3a75,null));};exports[_0x5705('0x4d')]=function(_0x43c083,_0x49930d){if(_0x43c083['body']['id']){delete _0x43c083[_0x5705('0x46')]['id'];}return db[_0x5705('0x2b')]['find']({'where':{'id':_0x43c083['params']['id']}})[_0x5705('0x23')](handleEntityNotFound(_0x49930d,null))[_0x5705('0x23')](saveUpdates(_0x43c083[_0x5705('0x46')],null))[_0x5705('0x23')](respondWithResult(_0x49930d,null))[_0x5705('0x41')](handleError(_0x49930d,null));};exports['destroy']=function(_0xce0d1c,_0x9e334f){return db['CmCompany'][_0x5705('0x4e')]({'where':{'id':_0xce0d1c[_0x5705('0x43')]['id']}})[_0x5705('0x23')](handleEntityNotFound(_0x9e334f,null))[_0x5705('0x23')](removeEntity(_0x9e334f,null))['catch'](handleError(_0x9e334f,null));};exports['describe']=function(_0x1b394a,_0x284c0a){return db['CmCompany'][_0x5705('0x2c')]()['then'](respondWithResult(_0x284c0a,null))['catch'](handleError(_0x284c0a,null));};exports[_0x5705('0x4f')]=function(_0x3aa8b2,_0x5dd37b,_0x54d42e){return db[_0x5705('0x50')][_0x5705('0x4e')]({'where':{'id':_0x3aa8b2['params']['id']}})[_0x5705('0x23')](handleEntityNotFound(_0x5dd37b,null))['then'](function(_0x1a8818){if(_0x1a8818){return _0x1a8818[_0x5705('0x4f')](_0x3aa8b2[_0x5705('0x46')]['ids'],_[_0x5705('0x51')](_0x3aa8b2[_0x5705('0x46')],[_0x5705('0x52'),'id'])||{});}})[_0x5705('0x23')](respondWithResult(_0x5dd37b,null))[_0x5705('0x41')](handleError(_0x5dd37b,null));};exports[_0x5705('0x53')]=function(_0x23af88,_0x590fa5,_0xce1cd4){var _0x5b26b1={};var _0x189504={};var _0x5d2c90;var _0x539bc8;return db[_0x5705('0x2b')]['findOne']({'where':{'id':_0x23af88[_0x5705('0x43')]['id']}})['then'](handleEntityNotFound(_0x590fa5,null))['then'](function(_0x15a4f2){if(_0x15a4f2){_0x5d2c90=_0x15a4f2;_0x189504[_0x5705('0x2d')]=_[_0x5705('0x2f')](db[_0x5705('0x50')][_0x5705('0x44')]);_0x189504[_0x5705('0x2e')]=_[_0x5705('0x2f')](_0x23af88[_0x5705('0x2e')]);_0x189504[_0x5705('0x38')]=_[_0x5705('0x30')](_0x189504[_0x5705('0x2d')],_0x189504[_0x5705('0x2e')]);_0x5b26b1[_0x5705('0x31')]=_[_0x5705('0x30')](_0x189504['model'],qs[_0x5705('0x32')](_0x23af88[_0x5705('0x2e')]['fields']));_0x5b26b1[_0x5705('0x31')]=_0x5b26b1[_0x5705('0x31')][_0x5705('0x33')]?_0x5b26b1['attributes']:_0x189504['model'];_0x5b26b1[_0x5705('0x36')]=qs[_0x5705('0x37')](_0x23af88['query'][_0x5705('0x37')]);_0x5b26b1[_0x5705('0x3c')]=qs['filters'](_[_0x5705('0x39')](_0x23af88[_0x5705('0x2e')],_0x189504[_0x5705('0x38')]));if(_0x23af88['query']['filter']){_0x5b26b1[_0x5705('0x3c')]=_['merge'](_0x5b26b1[_0x5705('0x3c')],{'$or':_[_0x5705('0x54')](_0x5b26b1['attributes'],function(_0x2f38e5){var _0x34be88={};_0x34be88[_0x2f38e5]={'$like':'%'+_0x23af88[_0x5705('0x2e')]['filter']+'%'};return _0x34be88;})});}_0x5b26b1=_[_0x5705('0x3b')]({},_0x5b26b1,_0x23af88[_0x5705('0x55')]);return _0x5d2c90[_0x5705('0x53')](_0x5b26b1);}})['then'](function(_0x5b1db8){if(_0x5b1db8){_0x539bc8=_0x5b1db8[_0x5705('0x33')];if(!_0x23af88[_0x5705('0x2e')][_0x5705('0x34')](_0x5705('0x35'))){_0x5b26b1[_0x5705('0x1e')]=qs['limit'](_0x23af88[_0x5705('0x2e')]['limit']);_0x5b26b1[_0x5705('0x1c')]=qs['offset'](_0x23af88[_0x5705('0x2e')]['offset']);}return _0x5d2c90['getContacts'](_0x5b26b1);}})[_0x5705('0x23')](function(_0x4f92cf){if(_0x4f92cf){return _0x4f92cf?{'count':_0x539bc8,'rows':_0x4f92cf}:null;}})[_0x5705('0x23')](respondWithResult(_0x590fa5,null))[_0x5705('0x41')](handleError(_0x590fa5,null));}; \ No newline at end of file +var _0x5aca=['offset','undefined','limit','count','apply','reject','save','update','destroy','then','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','map','options','includeAll','include','findAll','catch','show','find','create','body','get','role','user','Companies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addContacts','CmContact','ids','omit','getContacts','findOne','order','pick','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x1b5792,_0x16b34b){var _0xc25239=function(_0x21808f){while(--_0x21808f){_0x1b5792['push'](_0x1b5792['shift']());}};_0xc25239(++_0x16b34b);}(_0x5aca,0x96));var _0xa5ac=function(_0x2bd2b6,_0x1cc448){_0x2bd2b6=_0x2bd2b6-0x0;var _0x3aedf4=_0x5aca[_0x2bd2b6];return _0x3aedf4;};'use strict';var emlformat=require(_0xa5ac('0x0'));var rimraf=require(_0xa5ac('0x1'));var zipdir=require(_0xa5ac('0x2'));var jsonpatch=require(_0xa5ac('0x3'));var rp=require('request-promise');var moment=require(_0xa5ac('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa5ac('0x5'));var util=require(_0xa5ac('0x6'));var path=require(_0xa5ac('0x7'));var sox=require(_0xa5ac('0x8'));var csv=require(_0xa5ac('0x9'));var ejs=require(_0xa5ac('0xa'));var fs=require('fs');var fs_extra=require(_0xa5ac('0xb'));var _=require(_0xa5ac('0xc'));var squel=require(_0xa5ac('0xd'));var crypto=require(_0xa5ac('0xe'));var jsforce=require(_0xa5ac('0xf'));var deskjs=require(_0xa5ac('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa5ac('0x11'));var Papa=require(_0xa5ac('0x12'));var Redis=require(_0xa5ac('0x13'));var authService=require(_0xa5ac('0x14'));var qs=require(_0xa5ac('0x15'));var as=require(_0xa5ac('0x16'));var hardwareService=require(_0xa5ac('0x17'));var logger=require(_0xa5ac('0x18'))(_0xa5ac('0x19'));var utils=require('../../config/utils');var config=require(_0xa5ac('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xa5ac('0x1b'))['db'];function respondWithStatusCode(_0x43db19,_0x3458bc){_0x3458bc=_0x3458bc||0xcc;return function(_0x711f4b){if(_0x711f4b){return _0x43db19[_0xa5ac('0x1c')](_0x3458bc);}return _0x43db19[_0xa5ac('0x1d')](_0x3458bc)[_0xa5ac('0x1e')]();};}function respondWithResult(_0x21e15a,_0x503daa){_0x503daa=_0x503daa||0xc8;return function(_0x3dd52a){if(_0x3dd52a){return _0x21e15a[_0xa5ac('0x1d')](_0x503daa)[_0xa5ac('0x1f')](_0x3dd52a);}};}function respondWithFilteredResult(_0x3bd91b,_0x57c50f){return function(_0x340b3c){if(_0x340b3c){var _0x5eeef2=typeof _0x57c50f[_0xa5ac('0x20')]===_0xa5ac('0x21')&&typeof _0x57c50f[_0xa5ac('0x22')]===_0xa5ac('0x21');var _0x30d2c2=_0x340b3c[_0xa5ac('0x23')];var _0x2cd5ff=_0x5eeef2?0x0:_0x57c50f[_0xa5ac('0x20')];var _0xccb16b=_0x5eeef2?_0x340b3c[_0xa5ac('0x23')]:_0x57c50f[_0xa5ac('0x20')]+_0x57c50f['limit'];var _0x3cd657;if(_0xccb16b>=_0x30d2c2){_0xccb16b=_0x30d2c2;_0x3cd657=0xc8;}else{_0x3cd657=0xce;}_0x3bd91b['status'](_0x3cd657);return _0x3bd91b['set']('Content-Range',_0x2cd5ff+'-'+_0xccb16b+'/'+_0x30d2c2)['json'](_0x340b3c);}return null;};}function patchUpdates(_0x3e0589){return function(_0xbed903){try{jsonpatch[_0xa5ac('0x24')](_0xbed903,_0x3e0589,!![]);}catch(_0x5bc417){return BPromise[_0xa5ac('0x25')](_0x5bc417);}return _0xbed903[_0xa5ac('0x26')]();};}function saveUpdates(_0x35142a,_0x1e9240){return function(_0x4ff72d){if(_0x4ff72d){return _0x4ff72d[_0xa5ac('0x27')](_0x35142a)['then'](function(_0x304d7f){return _0x304d7f;});}return null;};}function removeEntity(_0x35909b,_0x36dfb4){return function(_0x5b6f46){if(_0x5b6f46){return _0x5b6f46[_0xa5ac('0x28')]()[_0xa5ac('0x29')](function(){var _0x257907=_0x5b6f46['get']({'plain':!![]});var _0x568680='Companies';return db[_0xa5ac('0x2a')][_0xa5ac('0x28')]({'where':{'type':_0x568680,'resourceId':_0x257907['id']}})[_0xa5ac('0x29')](function(){return _0x5b6f46;});})[_0xa5ac('0x29')](function(){_0x35909b['status'](0xcc)[_0xa5ac('0x1e')]();});}};}function handleEntityNotFound(_0x2624be,_0x3e07a3){return function(_0x1720ae){if(!_0x1720ae){_0x2624be[_0xa5ac('0x1c')](0x194);}return _0x1720ae;};}function handleError(_0x3e69d7,_0x588723){_0x588723=_0x588723||0x1f4;return function(_0x1fd7d0){logger[_0xa5ac('0x2b')](_0x1fd7d0[_0xa5ac('0x2c')]);if(_0x1fd7d0['name']){delete _0x1fd7d0[_0xa5ac('0x2d')];}_0x3e69d7[_0xa5ac('0x1d')](_0x588723)[_0xa5ac('0x2e')](_0x1fd7d0);};}exports[_0xa5ac('0x2f')]=function(_0x2f7eeb,_0x1f0463){var _0xdf167f={},_0x3136ad={},_0xf185f4={'count':0x0,'rows':[]};return db[_0xa5ac('0x30')][_0xa5ac('0x31')]()['then'](function(_0x4aa342){_0x3136ad[_0xa5ac('0x32')]=_[_0xa5ac('0x33')](_0x4aa342);_0x3136ad[_0xa5ac('0x34')]=_[_0xa5ac('0x33')](_0x2f7eeb[_0xa5ac('0x34')]);_0x3136ad[_0xa5ac('0x35')]=_[_0xa5ac('0x36')](_0x3136ad[_0xa5ac('0x32')],_0x3136ad[_0xa5ac('0x34')]);_0xdf167f[_0xa5ac('0x37')]=_[_0xa5ac('0x36')](_0x3136ad[_0xa5ac('0x32')],qs[_0xa5ac('0x38')](_0x2f7eeb[_0xa5ac('0x34')]['fields']));_0xdf167f[_0xa5ac('0x37')]=_0xdf167f[_0xa5ac('0x37')][_0xa5ac('0x39')]?_0xdf167f[_0xa5ac('0x37')]:_0x3136ad[_0xa5ac('0x32')];if(!_0x2f7eeb[_0xa5ac('0x34')]['hasOwnProperty'](_0xa5ac('0x3a'))){_0xdf167f['limit']=qs[_0xa5ac('0x22')](_0x2f7eeb['query'][_0xa5ac('0x22')]);_0xdf167f[_0xa5ac('0x20')]=qs['offset'](_0x2f7eeb['query']['offset']);}_0xdf167f['order']=qs[_0xa5ac('0x3b')](_0x2f7eeb[_0xa5ac('0x34')]['sort']);_0xdf167f[_0xa5ac('0x3c')]=qs[_0xa5ac('0x35')](_['pick'](_0x2f7eeb[_0xa5ac('0x34')],_0x3136ad[_0xa5ac('0x35')]),_0x4aa342);if(_0x2f7eeb[_0xa5ac('0x34')][_0xa5ac('0x3d')]){_0xdf167f[_0xa5ac('0x3c')]=_[_0xa5ac('0x3e')](_0xdf167f[_0xa5ac('0x3c')],{'$or':_[_0xa5ac('0x3f')](_0xdf167f[_0xa5ac('0x37')],function(_0x1b4672){var _0x3ecaa8={};_0x3ecaa8[_0x1b4672]={'$like':'%'+_0x2f7eeb[_0xa5ac('0x34')][_0xa5ac('0x3d')]+'%'};return _0x3ecaa8;})});}_0xdf167f=_[_0xa5ac('0x3e')]({},_0xdf167f,_0x2f7eeb[_0xa5ac('0x40')]);var _0x1e0936={'where':_0xdf167f[_0xa5ac('0x3c')]};return db[_0xa5ac('0x30')][_0xa5ac('0x23')](_0x1e0936)[_0xa5ac('0x29')](function(_0x4803b6){_0xf185f4[_0xa5ac('0x23')]=_0x4803b6;if(_0x2f7eeb[_0xa5ac('0x34')][_0xa5ac('0x41')]){_0xdf167f[_0xa5ac('0x42')]=[{'all':!![]}];}return db['CmCompany'][_0xa5ac('0x43')](_0xdf167f);})[_0xa5ac('0x29')](function(_0x42ec75){_0xf185f4['rows']=_0x42ec75;return _0xf185f4;})['then'](respondWithFilteredResult(_0x1f0463,_0xdf167f))[_0xa5ac('0x44')](handleError(_0x1f0463,null));})[_0xa5ac('0x44')](handleError(_0x1f0463,null));};exports[_0xa5ac('0x45')]=function(_0x46f687,_0x218236){var _0x1bbdca={'raw':![],'where':{'id':_0x46f687['params']['id']}},_0x13c028={};_0x13c028[_0xa5ac('0x32')]=_[_0xa5ac('0x33')](db[_0xa5ac('0x30')]['rawAttributes']);_0x13c028[_0xa5ac('0x34')]=_[_0xa5ac('0x33')](_0x46f687[_0xa5ac('0x34')]);_0x13c028[_0xa5ac('0x35')]=_[_0xa5ac('0x36')](_0x13c028['model'],_0x13c028[_0xa5ac('0x34')]);_0x1bbdca[_0xa5ac('0x37')]=_['intersection'](_0x13c028[_0xa5ac('0x32')],qs[_0xa5ac('0x38')](_0x46f687[_0xa5ac('0x34')][_0xa5ac('0x38')]));_0x1bbdca[_0xa5ac('0x37')]=_0x1bbdca[_0xa5ac('0x37')][_0xa5ac('0x39')]?_0x1bbdca['attributes']:_0x13c028['model'];if(_0x46f687[_0xa5ac('0x34')][_0xa5ac('0x41')]){_0x1bbdca[_0xa5ac('0x42')]=[{'all':!![]}];}_0x1bbdca=_[_0xa5ac('0x3e')]({},_0x1bbdca,_0x46f687[_0xa5ac('0x40')]);return db['CmCompany'][_0xa5ac('0x46')](_0x1bbdca)[_0xa5ac('0x29')](handleEntityNotFound(_0x218236,null))['then'](respondWithResult(_0x218236,null))[_0xa5ac('0x44')](handleError(_0x218236,null));};exports[_0xa5ac('0x47')]=function(_0x23c348,_0x48010e){return db[_0xa5ac('0x30')][_0xa5ac('0x47')](_0x23c348[_0xa5ac('0x48')],{})[_0xa5ac('0x29')](function(_0x36c09){var _0x30ae95=_0x23c348['user'][_0xa5ac('0x49')]({'plain':!![]});if(!_0x30ae95)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30ae95[_0xa5ac('0x4a')]===_0xa5ac('0x4b')){var _0xd51e0d=_0x36c09[_0xa5ac('0x49')]({'plain':!![]});var _0x468fe1=_0xa5ac('0x4c');return db[_0xa5ac('0x4d')][_0xa5ac('0x46')]({'where':{'name':_0x468fe1,'userProfileId':_0x30ae95[_0xa5ac('0x4e')]},'raw':!![]})[_0xa5ac('0x29')](function(_0x13d432){if(_0x13d432&&_0x13d432[_0xa5ac('0x4f')]===0x0){return db[_0xa5ac('0x2a')][_0xa5ac('0x47')]({'name':_0xd51e0d[_0xa5ac('0x2d')],'resourceId':_0xd51e0d['id'],'type':_0x13d432[_0xa5ac('0x2d')],'sectionId':_0x13d432['id']},{})[_0xa5ac('0x29')](function(){return _0x36c09;});}else{return _0x36c09;}})[_0xa5ac('0x44')](function(_0xa56d17){logger[_0xa5ac('0x2b')](_0xa5ac('0x50'),_0xa56d17);throw _0xa56d17;});}return _0x36c09;})[_0xa5ac('0x29')](respondWithResult(_0x48010e,0xc9))[_0xa5ac('0x44')](handleError(_0x48010e,null));};exports[_0xa5ac('0x27')]=function(_0x1d08d8,_0x5341ad){if(_0x1d08d8[_0xa5ac('0x48')]['id']){delete _0x1d08d8['body']['id'];}return db['CmCompany'][_0xa5ac('0x46')]({'where':{'id':_0x1d08d8[_0xa5ac('0x51')]['id']}})[_0xa5ac('0x29')](handleEntityNotFound(_0x5341ad,null))[_0xa5ac('0x29')](saveUpdates(_0x1d08d8[_0xa5ac('0x48')],null))['then'](respondWithResult(_0x5341ad,null))['catch'](handleError(_0x5341ad,null));};exports[_0xa5ac('0x28')]=function(_0x507bf6,_0x1ffb37){return db[_0xa5ac('0x30')]['find']({'where':{'id':_0x507bf6[_0xa5ac('0x51')]['id']}})[_0xa5ac('0x29')](handleEntityNotFound(_0x1ffb37,null))[_0xa5ac('0x29')](removeEntity(_0x1ffb37,null))[_0xa5ac('0x44')](handleError(_0x1ffb37,null));};exports[_0xa5ac('0x31')]=function(_0x1a717c,_0x204ce9){return db[_0xa5ac('0x30')][_0xa5ac('0x31')]()[_0xa5ac('0x29')](respondWithResult(_0x204ce9,null))[_0xa5ac('0x44')](handleError(_0x204ce9,null));};exports[_0xa5ac('0x52')]=function(_0x59d500,_0x49aa0e,_0xa2fee5){return db[_0xa5ac('0x53')]['find']({'where':{'id':_0x59d500['params']['id']}})[_0xa5ac('0x29')](handleEntityNotFound(_0x49aa0e,null))['then'](function(_0x35e42f){if(_0x35e42f){return _0x35e42f[_0xa5ac('0x52')](_0x59d500['body'][_0xa5ac('0x54')],_[_0xa5ac('0x55')](_0x59d500[_0xa5ac('0x48')],['ids','id'])||{});}})[_0xa5ac('0x29')](respondWithResult(_0x49aa0e,null))['catch'](handleError(_0x49aa0e,null));};exports[_0xa5ac('0x56')]=function(_0xdbb0b2,_0xd310a5,_0x1c433a){var _0x2cc559={};var _0x4b4ec2={};var _0x497708;var _0x5b222f;return db[_0xa5ac('0x30')][_0xa5ac('0x57')]({'where':{'id':_0xdbb0b2['params']['id']}})[_0xa5ac('0x29')](handleEntityNotFound(_0xd310a5,null))[_0xa5ac('0x29')](function(_0x486b6b){if(_0x486b6b){_0x497708=_0x486b6b;_0x4b4ec2[_0xa5ac('0x32')]=_[_0xa5ac('0x33')](db[_0xa5ac('0x53')]['rawAttributes']);_0x4b4ec2[_0xa5ac('0x34')]=_[_0xa5ac('0x33')](_0xdbb0b2[_0xa5ac('0x34')]);_0x4b4ec2[_0xa5ac('0x35')]=_[_0xa5ac('0x36')](_0x4b4ec2['model'],_0x4b4ec2[_0xa5ac('0x34')]);_0x2cc559[_0xa5ac('0x37')]=_[_0xa5ac('0x36')](_0x4b4ec2[_0xa5ac('0x32')],qs[_0xa5ac('0x38')](_0xdbb0b2[_0xa5ac('0x34')][_0xa5ac('0x38')]));_0x2cc559[_0xa5ac('0x37')]=_0x2cc559[_0xa5ac('0x37')]['length']?_0x2cc559[_0xa5ac('0x37')]:_0x4b4ec2[_0xa5ac('0x32')];_0x2cc559[_0xa5ac('0x58')]=qs[_0xa5ac('0x3b')](_0xdbb0b2[_0xa5ac('0x34')]['sort']);_0x2cc559[_0xa5ac('0x3c')]=qs[_0xa5ac('0x35')](_[_0xa5ac('0x59')](_0xdbb0b2['query'],_0x4b4ec2[_0xa5ac('0x35')]));if(_0xdbb0b2[_0xa5ac('0x34')]['filter']){_0x2cc559[_0xa5ac('0x3c')]=_[_0xa5ac('0x3e')](_0x2cc559['where'],{'$or':_[_0xa5ac('0x3f')](_0x2cc559[_0xa5ac('0x37')],function(_0x40de58){var _0x349c1f={};_0x349c1f[_0x40de58]={'$like':'%'+_0xdbb0b2['query'][_0xa5ac('0x3d')]+'%'};return _0x349c1f;})});}_0x2cc559=_[_0xa5ac('0x3e')]({},_0x2cc559,_0xdbb0b2['options']);return _0x497708[_0xa5ac('0x56')](_0x2cc559);}})[_0xa5ac('0x29')](function(_0x4eecfc){if(_0x4eecfc){_0x5b222f=_0x4eecfc[_0xa5ac('0x39')];if(!_0xdbb0b2[_0xa5ac('0x34')][_0xa5ac('0x5a')](_0xa5ac('0x3a'))){_0x2cc559[_0xa5ac('0x22')]=qs[_0xa5ac('0x22')](_0xdbb0b2[_0xa5ac('0x34')][_0xa5ac('0x22')]);_0x2cc559[_0xa5ac('0x20')]=qs[_0xa5ac('0x20')](_0xdbb0b2[_0xa5ac('0x34')][_0xa5ac('0x20')]);}return _0x497708['getContacts'](_0x2cc559);}})['then'](function(_0xdbfb07){if(_0xdbfb07){return _0xdbfb07?{'count':_0x5b222f,'rows':_0xdbfb07}:null;}})[_0xa5ac('0x29')](respondWithResult(_0xd310a5,null))['catch'](handleError(_0xd310a5,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 9a06f1c..fc80a39 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 _0xaa8a=['CmCompany','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x4db53c,_0x5e7ef6){var _0x2ece87=function(_0x323acb){while(--_0x323acb){_0x4db53c['push'](_0x4db53c['shift']());}};_0x2ece87(++_0x5e7ef6);}(_0xaa8a,0x1b9));var _0xaaa8=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xaa8a[_0x3826ad];return _0x17b900;};'use strict';var _=require(_0xaaa8('0x0'));var util=require(_0xaaa8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xaaa8('0x2'));var BPromise=require(_0xaaa8('0x3'));var rp=require(_0xaaa8('0x4'));var fs=require('fs');var path=require(_0xaaa8('0x5'));var rimraf=require(_0xaaa8('0x6'));var config=require(_0xaaa8('0x7'));var attributes=require('./cmCompany.attributes');module[_0xaaa8('0x8')]=function(_0x2ecaa0,_0x303a51){return _0x2ecaa0[_0xaaa8('0x9')](_0xaaa8('0xa'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ba3=['cm_companies','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./cmCompany.attributes','exports'];(function(_0x3b8f3d,_0x3783f0){var _0x3c4cd3=function(_0x572ef2){while(--_0x572ef2){_0x3b8f3d['push'](_0x3b8f3d['shift']());}};_0x3c4cd3(++_0x3783f0);}(_0x8ba3,0xfb));var _0x38ba=function(_0x16535d,_0xe13222){_0x16535d=_0x16535d-0x0;var _0x4a0239=_0x8ba3[_0x16535d];return _0x4a0239;};'use strict';var _=require(_0x38ba('0x0'));var util=require('util');var logger=require(_0x38ba('0x1'))(_0x38ba('0x2'));var moment=require('moment');var BPromise=require(_0x38ba('0x3'));var rp=require(_0x38ba('0x4'));var fs=require('fs');var path=require(_0x38ba('0x5'));var rimraf=require(_0x38ba('0x6'));var config=require('../../config/environment');var attributes=require(_0x38ba('0x7'));module[_0x38ba('0x8')]=function(_0x2317e4,_0x3155e5){return _0x2317e4['define']('CmCompany',attributes,{'tableName':_0x38ba('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 37c7297..a9b1d88 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 _0x0341=['CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','CmCompany,\x20%s,\x20%s','request\x20sent'];(function(_0x3550b4,_0x59b309){var _0x237bca=function(_0x9624f9){while(--_0x9624f9){_0x3550b4['push'](_0x3550b4['shift']());}};_0x237bca(++_0x59b309);}(_0x0341,0x1be));var _0x1034=function(_0xfe7bbe,_0x43a803){_0xfe7bbe=_0xfe7bbe-0x0;var _0x2b3349=_0x0341[_0xfe7bbe];return _0x2b3349;};'use strict';var _=require(_0x1034('0x0'));var util=require(_0x1034('0x1'));var moment=require(_0x1034('0x2'));var BPromise=require(_0x1034('0x3'));var rs=require(_0x1034('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1034('0x5'));var logger=require(_0x1034('0x6'))(_0x1034('0x7'));var config=require('../../config/environment');var jayson=require(_0x1034('0x8'));var client=jayson[_0x1034('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x193450,_0xd154a0,_0x5a9d7d){return new BPromise(function(_0x1e95cd,_0x2210c1){return client[_0x1034('0xa')](_0x193450,_0x5a9d7d)['then'](function(_0x4cc4e1){logger[_0x1034('0xb')](_0x1034('0xc'),_0xd154a0,_0x1034('0xd'));logger['debug'](_0x1034('0xe'),_0xd154a0,'request\x20sent',JSON[_0x1034('0xf')](_0x4cc4e1));if(_0x4cc4e1[_0x1034('0x10')]){if(_0x4cc4e1[_0x1034('0x10')][_0x1034('0x11')]===0x1f4){logger['error'](_0x1034('0xc'),_0xd154a0,_0x4cc4e1['error']['message']);return _0x2210c1(_0x4cc4e1[_0x1034('0x10')][_0x1034('0x12')]);}logger['error'](_0x1034('0xc'),_0xd154a0,_0x4cc4e1[_0x1034('0x10')][_0x1034('0x12')]);return _0x1e95cd(_0x4cc4e1[_0x1034('0x10')][_0x1034('0x12')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0xd154a0,'request\x20sent');_0x1e95cd(_0x4cc4e1['result'][_0x1034('0x12')]);}})[_0x1034('0x13')](function(_0x17a0c8){logger[_0x1034('0x10')](_0x1034('0xc'),_0xd154a0,_0x17a0c8);_0x2210c1(_0x17a0c8);});});} \ No newline at end of file +var _0x750a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x2f2c8f,_0x3cbb72){var _0x34fbad=function(_0xd8cd34){while(--_0xd8cd34){_0x2f2c8f['push'](_0x2f2c8f['shift']());}};_0x34fbad(++_0x3cbb72);}(_0x750a,0x1bf));var _0xa750=function(_0x4d8035,_0x2e5a0c){_0x4d8035=_0x4d8035-0x0;var _0x500d86=_0x750a[_0x4d8035];return _0x500d86;};'use strict';var _=require(_0xa750('0x0'));var util=require(_0xa750('0x1'));var moment=require(_0xa750('0x2'));var BPromise=require(_0xa750('0x3'));var rs=require(_0xa750('0x4'));var fs=require('fs');var Redis=require(_0xa750('0x5'));var db=require(_0xa750('0x6'))['db'];var utils=require(_0xa750('0x7'));var logger=require(_0xa750('0x8'))(_0xa750('0x9'));var config=require(_0xa750('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xa750('0xb')][_0xa750('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x10a8a1,_0x549eef,_0x3ad520){return new BPromise(function(_0x3fb8ec,_0x15ec5f){return client[_0xa750('0xd')](_0x10a8a1,_0x3ad520)[_0xa750('0xe')](function(_0x233b4e){logger[_0xa750('0xf')](_0xa750('0x10'),_0x549eef,_0xa750('0x11'));logger[_0xa750('0x12')](_0xa750('0x13'),_0x549eef,_0xa750('0x11'),JSON[_0xa750('0x14')](_0x233b4e));if(_0x233b4e[_0xa750('0x15')]){if(_0x233b4e['error']['code']===0x1f4){logger[_0xa750('0x15')](_0xa750('0x10'),_0x549eef,_0x233b4e['error']['message']);return _0x15ec5f(_0x233b4e[_0xa750('0x15')][_0xa750('0x16')]);}logger['error']('CmCompany,\x20%s,\x20%s',_0x549eef,_0x233b4e['error']['message']);return _0x3fb8ec(_0x233b4e[_0xa750('0x15')][_0xa750('0x16')]);}else{logger[_0xa750('0xf')](_0xa750('0x10'),_0x549eef,_0xa750('0x11'));_0x3fb8ec(_0x233b4e[_0xa750('0x17')][_0xa750('0x16')]);}})[_0xa750('0x18')](function(_0x4c935b){logger[_0xa750('0x15')]('CmCompany,\x20%s,\x20%s',_0x549eef,_0x4c935b);_0x15ec5f(_0x4c935b);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index c477e4b..5e10b15 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 _0x052d=['../../components/auth/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','get','/describe','describe','show','/:id/contacts','create','post','addContacts','put','update','delete','/:id','destroy','multer','util','express','fs-extra'];(function(_0x658f12,_0x420e3b){var _0x3f8bd2=function(_0x40043e){while(--_0x40043e){_0x658f12['push'](_0x658f12['shift']());}};_0x3f8bd2(++_0x420e3b);}(_0x052d,0xee));var _0xd052=function(_0x30061f,_0x333731){_0x30061f=_0x30061f-0x0;var _0x4d76bf=_0x052d[_0x30061f];return _0x4d76bf;};'use strict';var multer=require(_0xd052('0x0'));var util=require(_0xd052('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd052('0x2'));var router=express['Router']();var fs_extra=require(_0xd052('0x3'));var auth=require(_0xd052('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd052('0x5'));var controller=require(_0xd052('0x6'));router['get']('/',auth[_0xd052('0x7')](),controller[_0xd052('0x8')]);router[_0xd052('0x9')](_0xd052('0xa'),auth[_0xd052('0x7')](),controller[_0xd052('0xb')]);router[_0xd052('0x9')]('/:id',auth[_0xd052('0x7')](),controller[_0xd052('0xc')]);router['get'](_0xd052('0xd'),auth[_0xd052('0x7')](),controller['getContacts']);router['post']('/',auth[_0xd052('0x7')](),controller[_0xd052('0xe')]);router[_0xd052('0xf')](_0xd052('0xd'),auth[_0xd052('0x7')](),controller[_0xd052('0x10')]);router[_0xd052('0x11')]('/:id',auth[_0xd052('0x7')](),controller[_0xd052('0x12')]);router[_0xd052('0x13')](_0xd052('0x14'),auth[_0xd052('0x7')](),controller[_0xd052('0x15')]);module['exports']=router; \ No newline at end of file +var _0x4db1=['index','/describe','describe','show','/:id/contacts','getContacts','post','addContacts','/:id','update','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4db1,0xa6));var _0x14db=function(_0x186d17,_0x9fa8ef){_0x186d17=_0x186d17-0x0;var _0x5d4b89=_0x4db1[_0x186d17];return _0x5d4b89;};'use strict';var multer=require(_0x14db('0x0'));var util=require(_0x14db('0x1'));var path=require(_0x14db('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x14db('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x14db('0x4'));var interaction=require(_0x14db('0x5'));var config=require(_0x14db('0x6'));var controller=require(_0x14db('0x7'));router[_0x14db('0x8')]('/',auth[_0x14db('0x9')](),controller[_0x14db('0xa')]);router[_0x14db('0x8')](_0x14db('0xb'),auth[_0x14db('0x9')](),controller[_0x14db('0xc')]);router[_0x14db('0x8')]('/:id',auth[_0x14db('0x9')](),controller[_0x14db('0xd')]);router[_0x14db('0x8')](_0x14db('0xe'),auth['isAuthenticated'](),controller[_0x14db('0xf')]);router[_0x14db('0x10')]('/',auth[_0x14db('0x9')](),controller['create']);router[_0x14db('0x10')]('/:id/contacts',auth[_0x14db('0x9')](),controller[_0x14db('0x11')]);router['put'](_0x14db('0x12'),auth[_0x14db('0x9')](),controller[_0x14db('0x13')]);router[_0x14db('0x14')](_0x14db('0x12'),auth['isAuthenticated'](),controller[_0x14db('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index cfd4aac..593306e 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 _0x56c4=['DATE','NOW','lodash','sequelize','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x1d70db,_0x142b63){var _0x3060c6=function(_0x347866){while(--_0x347866){_0x1d70db['push'](_0x1d70db['shift']());}};_0x3060c6(++_0x142b63);}(_0x56c4,0x1aa));var _0x456c=function(_0x2105a5,_0x1afbdd){_0x2105a5=_0x2105a5-0x0;var _0x5bfc3d=_0x56c4[_0x2105a5];return _0x5bfc3d;};'use strict';var _=require(_0x456c('0x0'));var Sequelize=require(_0x456c('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x456c('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x456c('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x456c('0x2')]},'description':{'type':Sequelize[_0x456c('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x456c('0x2')]},'fax':{'type':Sequelize[_0x456c('0x2')]},'email':{'type':Sequelize[_0x456c('0x2')]},'url':{'type':Sequelize[_0x456c('0x2')]},'facebook':{'type':Sequelize[_0x456c('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x456c('0x2')]},'skype':{'type':Sequelize[_0x456c('0x2')]},'teams':{'type':Sequelize[_0x456c('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x456c('0x2')]},'wechat':{'type':Sequelize[_0x456c('0x2')]},'telegram':{'type':Sequelize[_0x456c('0x2')]},'UserId':{'type':Sequelize[_0x456c('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x456c('0x2')]},'priority':{'type':Sequelize[_0x456c('0x4')](0x2)[_0x456c('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x456c('0x6')],'defaultValue':Sequelize[_0x456c('0x7')]},'dialTimezone':{'type':Sequelize[_0x456c('0x2')]},'utcOffset':{'type':Sequelize[_0x456c('0x4')]}}; \ No newline at end of file +var _0x7c29=['TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','exports','STRING'];(function(_0x23976a,_0x11b9ea){var _0x150374=function(_0x2668dd){while(--_0x2668dd){_0x23976a['push'](_0x23976a['shift']());}};_0x150374(++_0x11b9ea);}(_0x7c29,0xdd));var _0x97c2=function(_0x4da681,_0x56ead2){_0x4da681=_0x4da681-0x0;var _0x1643b4=_0x7c29[_0x4da681];return _0x1643b4;};'use strict';var _=require(_0x97c2('0x0'));var Sequelize=require('sequelize');module[_0x97c2('0x1')]={'firstName':{'type':Sequelize[_0x97c2('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x97c2('0x2')]},'street':{'type':Sequelize[_0x97c2('0x2')]},'postalCode':{'type':Sequelize[_0x97c2('0x2')]},'city':{'type':Sequelize[_0x97c2('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x97c2('0x3')]},'phone':{'type':Sequelize[_0x97c2('0x2')]},'mobile':{'type':Sequelize[_0x97c2('0x2')]},'fax':{'type':Sequelize[_0x97c2('0x2')]},'email':{'type':Sequelize[_0x97c2('0x2')]},'url':{'type':Sequelize[_0x97c2('0x2')]},'facebook':{'type':Sequelize[_0x97c2('0x2')]},'fb_data':{'type':Sequelize[_0x97c2('0x2')]},'twitter':{'type':Sequelize[_0x97c2('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x97c2('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x97c2('0x2')]},'telegram':{'type':Sequelize[_0x97c2('0x2')]},'UserId':{'type':Sequelize[_0x97c2('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x97c2('0x2')]},'priority':{'type':Sequelize[_0x97c2('0x4')](0x2)[_0x97c2('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x97c2('0x6')],'defaultValue':Sequelize[_0x97c2('0x7')]},'dialTimezone':{'type':Sequelize[_0x97c2('0x2')]},'utcOffset':{'type':Sequelize[_0x97c2('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index c9574e1..fcac012 100644 --- a/server/api/cmContact/cmContact.controller.js +++ b/server/api/cmContact/cmContact.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x5c2a2b,_0x22c94e){var _0x19921f=function(_0x3fb937){while(--_0x3fb937){_0x5c2a2b['push'](_0x5c2a2b['shift']());}};_0x19921f(++_0x22c94e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index bc7edb0..7d8020a 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x75db=['hook','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x5da67d,_0x52437d){var _0x4fe8fa=function(_0x36e703){while(--_0x36e703){_0x5da67d['push'](_0x5da67d['shift']());}};_0x4fe8fa(++_0x52437d);}(_0x75db,0x181));var _0xb75d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75db[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var CmContact=require(_0xb75d('0x0'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0xb75d('0x1')](0x0);var events={'afterCreate':_0xb75d('0x2'),'afterUpdate':'update','afterDestroy':_0xb75d('0x3')};function emitEvent(_0x1e7806){return function(_0xf073f5,_0x2d72fe,_0x38acbb){CmContactEvents[_0xb75d('0x4')](_0x1e7806+':'+_0xf073f5['id'],_0xf073f5);CmContactEvents['emit'](_0x1e7806,_0xf073f5);_0x38acbb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xb75d('0x5')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0x56dc=['exports','events','../../mysqldb','CmContact','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x542a37,_0xd60f29){var _0x51c4a0=function(_0x2b7baa){while(--_0x2b7baa){_0x542a37['push'](_0x542a37['shift']());}};_0x51c4a0(++_0xd60f29);}(_0x56dc,0xe7));var _0xc56d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56dc[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xc56d('0x0'));var CmContact=require(_0xc56d('0x1'))['db'][_0xc56d('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xc56d('0x3')](0x0);var events={'afterCreate':_0xc56d('0x4'),'afterUpdate':_0xc56d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x25bb50){return function(_0x3eddd3,_0x530ebd,_0x4fb2ce){CmContactEvents['emit'](_0x25bb50+':'+_0x3eddd3['id'],_0x3eddd3);CmContactEvents[_0xc56d('0x6')](_0x25bb50,_0x3eddd3);_0x4fb2ce(null);};}for(var e in events){if(events[_0xc56d('0x7')](e)){var event=events[e];CmContact[_0xc56d('0x8')](e,emitEvent(event));}}module[_0xc56d('0x9')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 4426c5e..f95c53d 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe480=['\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','Lists','always','BlackLists','length','CmHopperBlack','message','CmList','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','inspect','YYYY-MM-DD\x20HH:mm:ss','isNil','VoiceQueue','findOne','then','dialTimezone','utcOffset','scheduledat','add','CmHopper','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','format','callbackUniqueid','ret','cmContact,\x20afterCreate\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','Campaign','timezones','minutes','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','catch'];(function(_0x297c7d,_0xc89ded){var _0x128bdb=function(_0x46092c){while(--_0x46092c){_0x297c7d['push'](_0x297c7d['shift']());}};_0x128bdb(++_0xc89ded);}(_0xe480,0x100));var _0x0e48=function(_0x14b4ff,_0x510865){_0x14b4ff=_0x14b4ff-0x0;var _0x257699=_0xe480[_0x14b4ff];return _0x257699;};'use strict';var _=require(_0x0e48('0x0'));var util=require(_0x0e48('0x1'));var logger=require(_0x0e48('0x2'))(_0x0e48('0x3'));var moment=require(_0x0e48('0x4'));var BPromise=require(_0x0e48('0x5'));var rp=require(_0x0e48('0x6'));var fs=require('fs');var path=require(_0x0e48('0x7'));var rimraf=require(_0x0e48('0x8'));var config=require(_0x0e48('0x9'));var shared=require(_0x0e48('0xa'));var attributes=require(_0x0e48('0xb'));module[_0x0e48('0xc')]=function(_0x1c2bef,_0x26bec4){return _0x1c2bef[_0x0e48('0xd')](_0x0e48('0xe'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0x0e48('0xf'),'fields':['phone']},{'name':_0x0e48('0x10'),'fields':[_0x0e48('0x11'),_0x0e48('0x12'),_0x0e48('0xf'),_0x0e48('0x13'),_0x0e48('0x14'),_0x0e48('0x15')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0x0e48('0x16'),'collate':_0x0e48('0x17'),'hooks':{'afterCreate':function(_0x372804,_0x4d8190,_0x252af6){var _0x3930fa=_0x1c2bef[_0x0e48('0x18')];var _0x1a2514=_0x372804[_0x0e48('0x19')]({'plain':!![]});function _0x4a042d(){return function(_0x1a71aa){logger[_0x0e48('0x1a')](_0x0e48('0x1b'),_0x0e48('0x1c'),util[_0x0e48('0x1d')](_0x1a71aa,{'showHidden':![],'depth':null}));};}function _0x3003da(_0x55eae0,_0x4f14b3){var _0x302533=_0x4f14b3['scheduledat']?_0x4f14b3['scheduledat']:moment()['format'](_0x0e48('0x1e'));return new BPromise(function(_0x44ab41,_0x5d540c){if(_[_0x0e48('0x1f')](_0x4f14b3['dialTimezone'])){_0x44ab41({'ret':_0x302533});}else{_0x3930fa[_0x0e48('0x20')][_0x0e48('0x21')]({'where':{'id':_0x55eae0['id']}})[_0x0e48('0x22')](function(_0x3fc7ce){if(!_[_0x0e48('0x1f')](_0x3fc7ce)){var _0x36e44b=_0x3fc7ce[_0x0e48('0x23')];if(!_[_0x0e48('0x1f')](_0x36e44b)){var _0xe67488=shared['timezones'];var _0x1148b0=_0xe67488[_0x36e44b];var _0x198f58=_0xe67488[_0x4f14b3[_0x0e48('0x23')]];if(!_[_0x0e48('0x1f')](_0x1148b0)&&!_[_0x0e48('0x1f')](_0x198f58)){var _0x14daf1=_0x1148b0[_0x0e48('0x24')]-_0x198f58[_0x0e48('0x24')];_0x302533=_0x4f14b3[_0x0e48('0x25')]?_0x4f14b3['scheduledat']:moment();var _0x1c5315=moment(_0x302533)[_0x0e48('0x26')](_0x14daf1,'minutes');_0x44ab41({'ret':_0x1c5315['format'](_0x0e48('0x1e'))});}else _0x44ab41({'ret':_0x302533});}else _0x44ab41({'ret':_0x302533});}else{_0x44ab41({'ret':_0x302533});}});}});return 0xa;}var _0x5aaf45=function(_0x129e9b){return new BPromise(function(_0x136217,_0xa412c1){_0x3003da(_0x129e9b,_0x1a2514)[_0x0e48('0x22')](function(_0x126c6c){_0x1a2514['scheduledat']=_0x126c6c['ret'];_0x3930fa[_0x0e48('0x27')][_0x0e48('0x21')]({'where':{'phone':_0x1a2514[_0x0e48('0xf')],'VoiceQueueId':_0x129e9b['id']}})['then'](function(_0x4369fd){if(!_[_0x0e48('0x1f')](_0x4369fd)){throw new Error('cmContact,\x20afterCreate\x20'+_0x1a2514[_0x0e48('0xf')]+_0x0e48('0x28')+_0x129e9b['id']);}return _0x3930fa[_0x0e48('0x27')][_0x0e48('0x29')]({'phone':_0x1a2514[_0x0e48('0xf')],'ContactId':_0x1a2514['id'],'ListId':_0x1a2514[_0x0e48('0x2a')],'priority':_0x1a2514[_0x0e48('0x2b')]?_0x1a2514[_0x0e48('0x2b')]:0x2,'scheduledat':_0x1a2514[_0x0e48('0x25')]?_0x1a2514[_0x0e48('0x25')]:moment()[_0x0e48('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x1a2514[_0x0e48('0x2d')]?!![]:![],'callbackuniqueid':_0x1a2514[_0x0e48('0x2d')]?_0x1a2514[_0x0e48('0x2d')]:undefined,'callbackat':_0x1a2514['callbackUniqueid']?moment()[_0x0e48('0x2c')](_0x0e48('0x1e')):undefined,'VoiceQueueId':_0x129e9b['id']});})['catch'](function(_0xc10e02){_0xa412c1(_0xc10e02);});});});};var _0x1224e1=function(_0x591e0f){return new BPromise(function(_0x2adbd9,_0x3b2b57){_0x3003da(_0x591e0f,_0x1a2514)[_0x0e48('0x22')](function(_0x180424){_0x1a2514[_0x0e48('0x25')]=_0x180424[_0x0e48('0x2e')];_0x3930fa['CmHopper'][_0x0e48('0x21')]({'where':{'phone':_0x1a2514['phone'],'VoiceQueueId':_0x591e0f['id']}})['then'](function(_0x4113d5){if(!_[_0x0e48('0x1f')](_0x4113d5)){throw new Error(_0x0e48('0x2f')+_0x1a2514[_0x0e48('0xf')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x591e0f['id']);}return _0x3930fa[_0x0e48('0x30')][_0x0e48('0x21')]({'where':{'calleridnum':_0x1a2514[_0x0e48('0xf')],'VoiceQueueId':_0x591e0f['id']}});})[_0x0e48('0x22')](function(_0x12ff7c){if(!_['isNil'](_0x12ff7c)){throw new Error(_0x0e48('0x31')+_0x1a2514['phone']+_0x0e48('0x32')+_0x591e0f['id']);}return _0x3930fa[_0x0e48('0x27')][_0x0e48('0x29')]({'phone':_0x1a2514[_0x0e48('0xf')],'ContactId':_0x1a2514['id'],'ListId':_0x1a2514['ListId'],'priority':_0x1a2514[_0x0e48('0x2b')]?_0x1a2514['priority']:0x2,'scheduledat':_0x1a2514[_0x0e48('0x25')]?_0x1a2514[_0x0e48('0x25')]:moment()[_0x0e48('0x2c')](_0x0e48('0x1e')),'callback':_0x1a2514[_0x0e48('0x2d')]?!![]:![],'callbackuniqueid':_0x1a2514['callbackUniqueid']?_0x1a2514[_0x0e48('0x2d')]:undefined,'callbackat':_0x1a2514[_0x0e48('0x2d')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x591e0f['id']});})['catch'](function(_0x4b5750){_0x3b2b57(_0x4b5750);});});});};function _0x1355be(){return function(_0x4ebfe8){logger[_0x0e48('0x1a')](_0x0e48('0x1b'),'afterCreate',util[_0x0e48('0x1d')](_0x4ebfe8,{'showHidden':![],'depth':null}));};}function _0xa41871(_0x4e4c7d,_0x31c84f){var _0x125839=_0x31c84f[_0x0e48('0x25')]?_0x31c84f[_0x0e48('0x25')]:moment()['format'](_0x0e48('0x1e'));return new BPromise(function(_0x72f7d,_0x2879a0){if(_[_0x0e48('0x1f')](_0x31c84f[_0x0e48('0x23')])){_0x72f7d({'ret':_0x125839});}else{_0x3930fa[_0x0e48('0x33')][_0x0e48('0x21')]({'where':{'id':_0x4e4c7d['id']}})['then'](function(_0x117ce7){if(!_[_0x0e48('0x1f')](_0x117ce7)){var _0xd9e24a=_0x117ce7[_0x0e48('0x23')];if(!_['isNil'](_0xd9e24a)){var _0x13ef46=shared[_0x0e48('0x34')];var _0x45448e=_0x13ef46[_0xd9e24a];var _0x247bda=_0x13ef46[_0x31c84f[_0x0e48('0x23')]];if(!_[_0x0e48('0x1f')](_0x45448e)&&!_['isNil'](_0x247bda)){var _0x36664d=_0x45448e[_0x0e48('0x24')]-_0x247bda[_0x0e48('0x24')];_0x125839=_0x31c84f[_0x0e48('0x25')]?_0x31c84f[_0x0e48('0x25')]:moment();var _0x50c93c=moment(_0x125839)['add'](_0x36664d,_0x0e48('0x35'));_0x72f7d({'ret':_0x50c93c['format'](_0x0e48('0x1e'))});}else _0x72f7d({'ret':_0x125839});}else _0x72f7d({'ret':_0x125839});}else{_0x72f7d({'ret':_0x125839});}});}});return 0xa;}var _0x848636=function(_0x18651c){return new BPromise(function(_0x45e13e,_0x434c61){_0xa41871(_0x18651c,_0x1a2514)[_0x0e48('0x22')](function(_0x2181e3){_0x1a2514['scheduledat']=_0x2181e3[_0x0e48('0x2e')];_0x3930fa[_0x0e48('0x27')][_0x0e48('0x21')]({'where':{'phone':_0x1a2514['phone'],'CampaignId':_0x18651c['id']}})[_0x0e48('0x22')](function(_0x53ca51){if(!_[_0x0e48('0x1f')](_0x53ca51)){throw new Error(_0x0e48('0x2f')+_0x1a2514[_0x0e48('0xf')]+_0x0e48('0x36')+_0x18651c['id']);}return _0x3930fa[_0x0e48('0x27')][_0x0e48('0x29')]({'phone':_0x1a2514[_0x0e48('0xf')],'ContactId':_0x1a2514['id'],'ListId':_0x1a2514[_0x0e48('0x2a')],'priority':_0x1a2514[_0x0e48('0x2b')]?_0x1a2514[_0x0e48('0x2b')]:0x2,'scheduledat':_0x1a2514[_0x0e48('0x25')]?_0x1a2514[_0x0e48('0x25')]:moment()[_0x0e48('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x1a2514['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1a2514[_0x0e48('0x2d')]?_0x1a2514[_0x0e48('0x2d')]:undefined,'callbackat':_0x1a2514[_0x0e48('0x2d')]?moment()[_0x0e48('0x2c')](_0x0e48('0x1e')):undefined,'CampaignId':_0x18651c['id']});})[_0x0e48('0x37')](function(_0x1f03c9){_0x434c61(_0x1f03c9);});});});};var _0x2cafb7=function(_0x5be84a){return new BPromise(function(_0xe3fcfc,_0xea25be){_0xa41871(_0x5be84a,_0x1a2514)[_0x0e48('0x22')](function(_0x25c4e1){_0x1a2514['scheduledat']=_0x25c4e1[_0x0e48('0x2e')];_0x3930fa[_0x0e48('0x27')][_0x0e48('0x21')]({'where':{'phone':_0x1a2514[_0x0e48('0xf')],'CampaignId':_0x5be84a['id']}})[_0x0e48('0x22')](function(_0x411e6c){if(!_[_0x0e48('0x1f')](_0x411e6c)){throw new Error(_0x0e48('0x2f')+_0x1a2514[_0x0e48('0xf')]+_0x0e48('0x38')+_0x5be84a['id']);}return _0x3930fa[_0x0e48('0x30')]['findOne']({'where':{'calleridnum':_0x1a2514['phone'],'CampaignId':_0x5be84a['id']}});})['then'](function(_0x5dbdf2){if(!_[_0x0e48('0x1f')](_0x5dbdf2)){throw new Error(_0x0e48('0x31')+_0x1a2514['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x5be84a['id']);}return _0x3930fa[_0x0e48('0x27')]['create']({'phone':_0x1a2514[_0x0e48('0xf')],'ContactId':_0x1a2514['id'],'ListId':_0x1a2514[_0x0e48('0x2a')],'priority':_0x1a2514[_0x0e48('0x2b')]?_0x1a2514['priority']:0x2,'scheduledat':_0x1a2514[_0x0e48('0x25')]?_0x1a2514[_0x0e48('0x25')]:moment()[_0x0e48('0x2c')](_0x0e48('0x1e')),'callback':_0x1a2514['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1a2514[_0x0e48('0x2d')]?_0x1a2514[_0x0e48('0x2d')]:undefined,'callbackat':_0x1a2514[_0x0e48('0x2d')]?moment()[_0x0e48('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x5be84a['id']});})[_0x0e48('0x37')](function(_0x5ddd89){_0xea25be(_0x5ddd89);});});});};if(_0x1a2514['ListId']){_0x3930fa[_0x0e48('0x20')][_0x0e48('0x39')]({'where':{'type':_0x0e48('0x3a')},'attributes':['id',_0x0e48('0x3b'),_0x0e48('0x23')],'include':[{'model':_0x3930fa['CmList'],'as':_0x0e48('0x3c'),'where':{'id':_0x1a2514[_0x0e48('0x2a')]}}]})['then'](function(_0x213335){if(_0x213335){var _0x274945=[];for(var _0x1b501c=0x0,_0x48e23b;_0x1b501c<_0x213335['length'];_0x1b501c+=0x1){_0x48e23b=_0x213335[_0x1b501c]['get']({'plain':!![]});switch(_0x48e23b[_0x0e48('0x3b')]){case _0x0e48('0x3d'):_0x1224e1(_0x48e23b)[_0x0e48('0x37')](_0x4a042d());break;case'onlyIfOpen':_0x5aaf45(_0x48e23b)[_0x0e48('0x37')](_0x4a042d());break;default:_0xa41871(_0x48e23b,_0x1a2514)[_0x0e48('0x22')](function(_0x1d62c7){_0x1a2514['scheduledat']=_0x1d62c7[_0x0e48('0x2e')];_0x3930fa[_0x0e48('0x27')]['create']({'phone':_0x1a2514['phone'],'ContactId':_0x1a2514['id'],'ListId':_0x1a2514['ListId'],'scheduledat':_0x1a2514[_0x0e48('0x25')]?_0x1a2514['scheduledat']:moment()[_0x0e48('0x2c')](_0x0e48('0x1e')),'priority':_0x1a2514[_0x0e48('0x2b')]?_0x1a2514[_0x0e48('0x2b')]:0x2,'callback':_0x1a2514[_0x0e48('0x2d')]?!![]:![],'callbackuniqueid':_0x1a2514[_0x0e48('0x2d')]?_0x1a2514[_0x0e48('0x2d')]:undefined,'callbackat':_0x1a2514[_0x0e48('0x2d')]?moment()[_0x0e48('0x2c')](_0x0e48('0x1e')):undefined,'VoiceQueueId':_0x48e23b['id']})[_0x0e48('0x37')](_0x4a042d());});}}}})[_0x0e48('0x22')](function(){return _0x3930fa['VoiceQueue'][_0x0e48('0x39')]({'where':{'type':_0x0e48('0x3a')},'attributes':['id'],'include':[{'model':_0x3930fa['CmList'],'as':_0x0e48('0x3e'),'where':{'id':_0x1a2514[_0x0e48('0x2a')]}}]})[_0x0e48('0x22')](function(_0x348a49){if(_0x348a49){var _0x16baeb=[];for(var _0x147ac4=0x0,_0x3a4b94;_0x147ac4<_0x348a49[_0x0e48('0x3f')];_0x147ac4+=0x1){_0x3a4b94=_0x348a49[_0x147ac4][_0x0e48('0x19')]({'plain':!![]});_0x3930fa[_0x0e48('0x40')]['create']({'phone':_0x1a2514[_0x0e48('0xf')],'ContactId':_0x1a2514['id'],'ListId':_0x1a2514['ListId'],'VoiceQueueId':_0x3a4b94['id']})['catch'](function(_0x1f9697){logger['error']('cmContact,\x20%s,\x20%s',_0x0e48('0x1c'),_0x1f9697[_0x0e48('0x41')]);});}}});})[_0x0e48('0x22')](function(){return _0x3930fa[_0x0e48('0x33')]['findAll']({'attributes':['id',_0x0e48('0x3b'),_0x0e48('0x23')],'include':[{'model':_0x3930fa[_0x0e48('0x42')],'as':'Lists','where':{'id':_0x1a2514[_0x0e48('0x2a')]}}]})['then'](function(_0x586f56){if(_0x586f56){var _0x5b5567=[];for(var _0xa6a925=0x0,_0x215ef6;_0xa6a925<_0x586f56['length'];_0xa6a925+=0x1){_0x215ef6=_0x586f56[_0xa6a925][_0x0e48('0x19')]({'plain':!![]});switch(_0x215ef6[_0x0e48('0x3b')]){case _0x0e48('0x3d'):_0x2cafb7(_0x215ef6)[_0x0e48('0x37')](_0x1355be());break;case'onlyIfOpen':_0x848636(_0x215ef6)[_0x0e48('0x37')](_0x1355be());break;default:_0x3930fa[_0x0e48('0x27')][_0x0e48('0x29')]({'phone':_0x1a2514[_0x0e48('0xf')],'ContactId':_0x1a2514['id'],'ListId':_0x1a2514[_0x0e48('0x2a')],'scheduledat':_0x1a2514[_0x0e48('0x25')]?_0x1a2514[_0x0e48('0x25')]:moment()[_0x0e48('0x2c')](_0x0e48('0x1e')),'priority':_0x1a2514[_0x0e48('0x2b')]?_0x1a2514[_0x0e48('0x2b')]:0x2,'callback':_0x1a2514[_0x0e48('0x2d')]?!![]:![],'callbackuniqueid':_0x1a2514[_0x0e48('0x2d')]?_0x1a2514[_0x0e48('0x2d')]:undefined,'callbackat':_0x1a2514[_0x0e48('0x2d')]?moment()[_0x0e48('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x215ef6['id']})[_0x0e48('0x37')](_0x1355be());}}}});})[_0x0e48('0x22')](function(){return _0x3930fa[_0x0e48('0x33')][_0x0e48('0x39')]({'attributes':['id'],'include':[{'model':_0x3930fa['CmList'],'as':_0x0e48('0x3e'),'where':{'id':_0x1a2514[_0x0e48('0x2a')]}}]})['then'](function(_0x16d19b){if(_0x16d19b){var _0x1767df=[];for(var _0x2db7d3=0x0,_0x334d84;_0x2db7d3<_0x16d19b['length'];_0x2db7d3+=0x1){_0x334d84=_0x16d19b[_0x2db7d3][_0x0e48('0x19')]({'plain':!![]});_0x3930fa[_0x0e48('0x40')][_0x0e48('0x29')]({'phone':_0x1a2514['phone'],'ContactId':_0x1a2514['id'],'ListId':_0x1a2514[_0x0e48('0x2a')],'CampaignId':_0x334d84['id']})[_0x0e48('0x37')](function(_0x2d6c6b){logger[_0x0e48('0x1a')](_0x0e48('0x43'),_0x0e48('0x1c'),_0x2d6c6b[_0x0e48('0x41')]);});}}});})['then'](function(){_0x252af6();})[_0x0e48('0x37')](function(_0x271418){logger[_0x0e48('0x1a')](_0x0e48('0x43'),_0x0e48('0x1c'),_0x271418[_0x0e48('0x41')]);_0x252af6(_0x271418);});}else{_0x252af6(new Error(_0x0e48('0x44')));}},'afterDestroy':function(_0x584a4a,_0x1c7a94,_0x167e21){var _0x48d149=_0x1c2bef[_0x0e48('0x18')];var _0x5f311c=_0x584a4a[_0x0e48('0x19')]({'plain':!![]});return _0x48d149[_0x0e48('0x27')][_0x0e48('0x39')]({'raw':!![],'where':{'ListId':_0x5f311c[_0x0e48('0x2a')],'ContactId':_0x5f311c['id']}})[_0x0e48('0x22')](function(_0x1825cd){if(!_[_0x0e48('0x45')](_0x1825cd)){var _0x1491c0=[];for(var _0x8cf46a=0x0;_0x8cf46a<_0x1825cd[_0x0e48('0x3f')];_0x8cf46a+=0x1){var _0x4c05d4=_0x48d149[_0x0e48('0x27')][_0x0e48('0x46')]({'where':{'ListId':_0x1825cd[_0x8cf46a][_0x0e48('0x2a')],'ContactId':_0x1825cd[_0x8cf46a][_0x0e48('0x47')],'VoiceQueueId':_0x1825cd[_0x8cf46a][_0x0e48('0x48')],'CampaignId':_0x1825cd[_0x8cf46a][_0x0e48('0x49')]}});_0x1491c0[_0x0e48('0x4a')](_0x4c05d4);}return BPromise[_0x0e48('0x4b')](_0x1491c0);}})['then'](function(_0x5ecc58){logger['info'](_0x0e48('0x4c'),util[_0x0e48('0x1d')](_0x5ecc58,{'showHidden':![],'depth':null}));_0x167e21();})[_0x0e48('0x37')](function(_0x4c91a3){logger[_0x0e48('0x1a')](_0x0e48('0x4d'),util[_0x0e48('0x1d')](_0x4c91a3,{'showHidden':![],'depth':null}));_0x167e21(_0x4c91a3);});}}});}; \ No newline at end of file +var _0xbf36=['CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','priority','callbackUniqueid','catch','ret','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','afterCreate','Campaign','utcOffset','ListId','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','dialCheckDuplicateType','Lists','length','get','always','BlackLists','CmHopperBlack','message','findAll','CmList','onlyIfOpen','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','VoiceQueueId','CampaignId','push','info','[CmContact][afterDestroy][Error]','lodash','api','bluebird','request-promise','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','error','cmContact','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','add','minutes'];(function(_0xdb4e73,_0x30b446){var _0x4578b4=function(_0x119eb5){while(--_0x119eb5){_0xdb4e73['push'](_0xdb4e73['shift']());}};_0x4578b4(++_0x30b446);}(_0xbf36,0xfd));var _0x6bf3=function(_0x5513c7,_0x57de58){_0x5513c7=_0x5513c7-0x0;var _0x5cb310=_0xbf36[_0x5513c7];return _0x5cb310;};'use strict';var _=require(_0x6bf3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6bf3('0x1'));var moment=require('moment');var BPromise=require(_0x6bf3('0x2'));var rp=require(_0x6bf3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6bf3('0x4'));var config=require(_0x6bf3('0x5'));var shared=require(_0x6bf3('0x6'));var attributes=require(_0x6bf3('0x7'));module['exports']=function(_0x216d21,_0x45340f){return _0x216d21[_0x6bf3('0x8')](_0x6bf3('0x9'),attributes,{'tableName':_0x6bf3('0xa'),'paranoid':!![],'indexes':[{'name':_0x6bf3('0xb'),'fields':[_0x6bf3('0xb')]},{'name':_0x6bf3('0xc'),'fields':[_0x6bf3('0xd'),_0x6bf3('0xe'),_0x6bf3('0xb'),_0x6bf3('0xf'),_0x6bf3('0x10'),'email'],'type':_0x6bf3('0x11')}],'timestamps':!![],'charset':_0x6bf3('0x12'),'collate':_0x6bf3('0x13'),'hooks':{'afterCreate':function(_0xededeb,_0x4bfd7b,_0x1e4561){var _0x266208=_0x216d21[_0x6bf3('0x14')];var _0x574480=_0xededeb['get']({'plain':!![]});function _0x172794(){return function(_0x1fde92){logger[_0x6bf3('0x15')](_0x6bf3('0x16'),'afterCreate',util[_0x6bf3('0x17')](_0x1fde92,{'showHidden':![],'depth':null}));};}function _0x5186b3(_0x52f937,_0x19912a){var _0x34d006=_0x19912a[_0x6bf3('0x18')]?_0x19912a[_0x6bf3('0x18')]:moment()[_0x6bf3('0x19')](_0x6bf3('0x1a'));return new BPromise(function(_0x55c607,_0x2eec52){if(_[_0x6bf3('0x1b')](_0x19912a[_0x6bf3('0x1c')])){_0x55c607({'ret':_0x34d006});}else{_0x266208[_0x6bf3('0x1d')][_0x6bf3('0x1e')]({'where':{'id':_0x52f937['id']}})[_0x6bf3('0x1f')](function(_0xccf58b){if(!_['isNil'](_0xccf58b)){var _0x395e16=_0xccf58b[_0x6bf3('0x1c')];if(!_['isNil'](_0x395e16)){var _0x59d1af=shared[_0x6bf3('0x20')];var _0x3f071a=_0x59d1af[_0x395e16];var _0xfec0c2=_0x59d1af[_0x19912a[_0x6bf3('0x1c')]];if(!_[_0x6bf3('0x1b')](_0x3f071a)&&!_[_0x6bf3('0x1b')](_0xfec0c2)){var _0x275e3c=_0x3f071a['utcOffset']-_0xfec0c2['utcOffset'];_0x34d006=_0x19912a[_0x6bf3('0x18')]?_0x19912a[_0x6bf3('0x18')]:moment();var _0x593327=moment(_0x34d006)[_0x6bf3('0x21')](_0x275e3c,_0x6bf3('0x22'));_0x55c607({'ret':_0x593327[_0x6bf3('0x19')](_0x6bf3('0x1a'))});}else _0x55c607({'ret':_0x34d006});}else _0x55c607({'ret':_0x34d006});}else{_0x55c607({'ret':_0x34d006});}});}});return 0xa;}var _0x520858=function(_0x1a5590){return new BPromise(function(_0xbb7e38,_0x2163d8){_0x5186b3(_0x1a5590,_0x574480)[_0x6bf3('0x1f')](function(_0x540214){_0x574480[_0x6bf3('0x18')]=_0x540214['ret'];_0x266208[_0x6bf3('0x23')]['findOne']({'where':{'phone':_0x574480[_0x6bf3('0xb')],'VoiceQueueId':_0x1a5590['id']}})['then'](function(_0x3d04b2){if(!_[_0x6bf3('0x1b')](_0x3d04b2)){throw new Error(_0x6bf3('0x24')+_0x574480[_0x6bf3('0xb')]+_0x6bf3('0x25')+_0x1a5590['id']);}return _0x266208[_0x6bf3('0x23')][_0x6bf3('0x26')]({'phone':_0x574480[_0x6bf3('0xb')],'ContactId':_0x574480['id'],'ListId':_0x574480['ListId'],'priority':_0x574480['priority']?_0x574480[_0x6bf3('0x27')]:0x2,'scheduledat':_0x574480['scheduledat']?_0x574480['scheduledat']:moment()['format'](_0x6bf3('0x1a')),'callback':_0x574480[_0x6bf3('0x28')]?!![]:![],'callbackuniqueid':_0x574480[_0x6bf3('0x28')]?_0x574480[_0x6bf3('0x28')]:undefined,'callbackat':_0x574480[_0x6bf3('0x28')]?moment()[_0x6bf3('0x19')](_0x6bf3('0x1a')):undefined,'VoiceQueueId':_0x1a5590['id']});})[_0x6bf3('0x29')](function(_0x15e914){_0x2163d8(_0x15e914);});});});};var _0x1e0e76=function(_0x123b59){return new BPromise(function(_0x1eb260,_0x41f3e2){_0x5186b3(_0x123b59,_0x574480)[_0x6bf3('0x1f')](function(_0x1ee3f6){_0x574480[_0x6bf3('0x18')]=_0x1ee3f6[_0x6bf3('0x2a')];_0x266208[_0x6bf3('0x23')]['findOne']({'where':{'phone':_0x574480['phone'],'VoiceQueueId':_0x123b59['id']}})[_0x6bf3('0x1f')](function(_0x37266d){if(!_[_0x6bf3('0x1b')](_0x37266d)){throw new Error(_0x6bf3('0x24')+_0x574480['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x123b59['id']);}return _0x266208[_0x6bf3('0x2b')][_0x6bf3('0x1e')]({'where':{'calleridnum':_0x574480[_0x6bf3('0xb')],'VoiceQueueId':_0x123b59['id']}});})[_0x6bf3('0x1f')](function(_0xd850c3){if(!_[_0x6bf3('0x1b')](_0xd850c3)){throw new Error(_0x6bf3('0x2c')+_0x574480[_0x6bf3('0xb')]+_0x6bf3('0x2d')+_0x123b59['id']);}return _0x266208['CmHopper']['create']({'phone':_0x574480[_0x6bf3('0xb')],'ContactId':_0x574480['id'],'ListId':_0x574480['ListId'],'priority':_0x574480[_0x6bf3('0x27')]?_0x574480['priority']:0x2,'scheduledat':_0x574480[_0x6bf3('0x18')]?_0x574480[_0x6bf3('0x18')]:moment()[_0x6bf3('0x19')](_0x6bf3('0x1a')),'callback':_0x574480['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x574480[_0x6bf3('0x28')]?_0x574480[_0x6bf3('0x28')]:undefined,'callbackat':_0x574480[_0x6bf3('0x28')]?moment()[_0x6bf3('0x19')](_0x6bf3('0x1a')):undefined,'VoiceQueueId':_0x123b59['id']});})[_0x6bf3('0x29')](function(_0x2a3a4b){_0x41f3e2(_0x2a3a4b);});});});};function _0x15c0d4(){return function(_0x187e6e){logger[_0x6bf3('0x15')]('cmContact',_0x6bf3('0x2e'),util[_0x6bf3('0x17')](_0x187e6e,{'showHidden':![],'depth':null}));};}function _0x55cd55(_0x4acbd3,_0x5698a4){var _0x6b1cec=_0x5698a4[_0x6bf3('0x18')]?_0x5698a4[_0x6bf3('0x18')]:moment()['format'](_0x6bf3('0x1a'));return new BPromise(function(_0x4a862d,_0x44bea1){if(_[_0x6bf3('0x1b')](_0x5698a4[_0x6bf3('0x1c')])){_0x4a862d({'ret':_0x6b1cec});}else{_0x266208[_0x6bf3('0x2f')][_0x6bf3('0x1e')]({'where':{'id':_0x4acbd3['id']}})[_0x6bf3('0x1f')](function(_0x477323){if(!_[_0x6bf3('0x1b')](_0x477323)){var _0x3e11e7=_0x477323[_0x6bf3('0x1c')];if(!_[_0x6bf3('0x1b')](_0x3e11e7)){var _0x27fcb7=shared[_0x6bf3('0x20')];var _0x234e10=_0x27fcb7[_0x3e11e7];var _0x372af2=_0x27fcb7[_0x5698a4['dialTimezone']];if(!_[_0x6bf3('0x1b')](_0x234e10)&&!_[_0x6bf3('0x1b')](_0x372af2)){var _0x789d12=_0x234e10[_0x6bf3('0x30')]-_0x372af2[_0x6bf3('0x30')];_0x6b1cec=_0x5698a4['scheduledat']?_0x5698a4[_0x6bf3('0x18')]:moment();var _0x3b312b=moment(_0x6b1cec)[_0x6bf3('0x21')](_0x789d12,_0x6bf3('0x22'));_0x4a862d({'ret':_0x3b312b['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x4a862d({'ret':_0x6b1cec});}else _0x4a862d({'ret':_0x6b1cec});}else{_0x4a862d({'ret':_0x6b1cec});}});}});return 0xa;}var _0x139eb1=function(_0x42d7c1){return new BPromise(function(_0x10ee0c,_0x41f2a5){_0x55cd55(_0x42d7c1,_0x574480)[_0x6bf3('0x1f')](function(_0x5804c0){_0x574480[_0x6bf3('0x18')]=_0x5804c0[_0x6bf3('0x2a')];_0x266208[_0x6bf3('0x23')]['findOne']({'where':{'phone':_0x574480[_0x6bf3('0xb')],'CampaignId':_0x42d7c1['id']}})['then'](function(_0x3e408d){if(!_[_0x6bf3('0x1b')](_0x3e408d)){throw new Error(_0x6bf3('0x24')+_0x574480['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x42d7c1['id']);}return _0x266208[_0x6bf3('0x23')][_0x6bf3('0x26')]({'phone':_0x574480[_0x6bf3('0xb')],'ContactId':_0x574480['id'],'ListId':_0x574480[_0x6bf3('0x31')],'priority':_0x574480[_0x6bf3('0x27')]?_0x574480[_0x6bf3('0x27')]:0x2,'scheduledat':_0x574480[_0x6bf3('0x18')]?_0x574480[_0x6bf3('0x18')]:moment()[_0x6bf3('0x19')](_0x6bf3('0x1a')),'callback':_0x574480[_0x6bf3('0x28')]?!![]:![],'callbackuniqueid':_0x574480['callbackUniqueid']?_0x574480[_0x6bf3('0x28')]:undefined,'callbackat':_0x574480[_0x6bf3('0x28')]?moment()[_0x6bf3('0x19')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x42d7c1['id']});})[_0x6bf3('0x29')](function(_0x1bbd46){_0x41f2a5(_0x1bbd46);});});});};var _0x359be1=function(_0x18dcba){return new BPromise(function(_0xafcc07,_0x1fcb13){_0x55cd55(_0x18dcba,_0x574480)[_0x6bf3('0x1f')](function(_0x103a64){_0x574480[_0x6bf3('0x18')]=_0x103a64['ret'];_0x266208[_0x6bf3('0x23')][_0x6bf3('0x1e')]({'where':{'phone':_0x574480[_0x6bf3('0xb')],'CampaignId':_0x18dcba['id']}})[_0x6bf3('0x1f')](function(_0x15cfd7){if(!_[_0x6bf3('0x1b')](_0x15cfd7)){throw new Error(_0x6bf3('0x24')+_0x574480['phone']+_0x6bf3('0x32')+_0x18dcba['id']);}return _0x266208[_0x6bf3('0x2b')][_0x6bf3('0x1e')]({'where':{'calleridnum':_0x574480[_0x6bf3('0xb')],'CampaignId':_0x18dcba['id']}});})['then'](function(_0xdd83c3){if(!_[_0x6bf3('0x1b')](_0xdd83c3)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x574480[_0x6bf3('0xb')]+_0x6bf3('0x33')+_0x18dcba['id']);}return _0x266208[_0x6bf3('0x23')]['create']({'phone':_0x574480[_0x6bf3('0xb')],'ContactId':_0x574480['id'],'ListId':_0x574480[_0x6bf3('0x31')],'priority':_0x574480[_0x6bf3('0x27')]?_0x574480[_0x6bf3('0x27')]:0x2,'scheduledat':_0x574480[_0x6bf3('0x18')]?_0x574480[_0x6bf3('0x18')]:moment()[_0x6bf3('0x19')](_0x6bf3('0x1a')),'callback':_0x574480['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x574480[_0x6bf3('0x28')]?_0x574480[_0x6bf3('0x28')]:undefined,'callbackat':_0x574480[_0x6bf3('0x28')]?moment()[_0x6bf3('0x19')](_0x6bf3('0x1a')):undefined,'CampaignId':_0x18dcba['id']});})['catch'](function(_0x58dfe0){_0x1fcb13(_0x58dfe0);});});});};if(_0x574480[_0x6bf3('0x31')]){_0x266208[_0x6bf3('0x1d')]['findAll']({'where':{'type':_0x6bf3('0x34')},'attributes':['id',_0x6bf3('0x35'),_0x6bf3('0x1c')],'include':[{'model':_0x266208['CmList'],'as':_0x6bf3('0x36'),'where':{'id':_0x574480['ListId']}}]})[_0x6bf3('0x1f')](function(_0xb3f352){if(_0xb3f352){var _0x456264=[];for(var _0x566e13=0x0,_0x4807aa;_0x566e13<_0xb3f352[_0x6bf3('0x37')];_0x566e13+=0x1){_0x4807aa=_0xb3f352[_0x566e13][_0x6bf3('0x38')]({'plain':!![]});switch(_0x4807aa['dialCheckDuplicateType']){case _0x6bf3('0x39'):_0x1e0e76(_0x4807aa)[_0x6bf3('0x29')](_0x172794());break;case'onlyIfOpen':_0x520858(_0x4807aa)[_0x6bf3('0x29')](_0x172794());break;default:_0x55cd55(_0x4807aa,_0x574480)['then'](function(_0xf15f93){_0x574480['scheduledat']=_0xf15f93[_0x6bf3('0x2a')];_0x266208[_0x6bf3('0x23')][_0x6bf3('0x26')]({'phone':_0x574480['phone'],'ContactId':_0x574480['id'],'ListId':_0x574480['ListId'],'scheduledat':_0x574480[_0x6bf3('0x18')]?_0x574480[_0x6bf3('0x18')]:moment()[_0x6bf3('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x574480[_0x6bf3('0x27')]?_0x574480[_0x6bf3('0x27')]:0x2,'callback':_0x574480[_0x6bf3('0x28')]?!![]:![],'callbackuniqueid':_0x574480[_0x6bf3('0x28')]?_0x574480[_0x6bf3('0x28')]:undefined,'callbackat':_0x574480[_0x6bf3('0x28')]?moment()[_0x6bf3('0x19')](_0x6bf3('0x1a')):undefined,'VoiceQueueId':_0x4807aa['id']})['catch'](_0x172794());});}}}})[_0x6bf3('0x1f')](function(){return _0x266208['VoiceQueue']['findAll']({'where':{'type':_0x6bf3('0x34')},'attributes':['id'],'include':[{'model':_0x266208['CmList'],'as':_0x6bf3('0x3a'),'where':{'id':_0x574480[_0x6bf3('0x31')]}}]})[_0x6bf3('0x1f')](function(_0x170deb){if(_0x170deb){var _0x55cfeb=[];for(var _0x246956=0x0,_0x32b227;_0x246956<_0x170deb[_0x6bf3('0x37')];_0x246956+=0x1){_0x32b227=_0x170deb[_0x246956][_0x6bf3('0x38')]({'plain':!![]});_0x266208[_0x6bf3('0x3b')][_0x6bf3('0x26')]({'phone':_0x574480['phone'],'ContactId':_0x574480['id'],'ListId':_0x574480[_0x6bf3('0x31')],'VoiceQueueId':_0x32b227['id']})[_0x6bf3('0x29')](function(_0x40ced4){logger['error']('cmContact,\x20%s,\x20%s',_0x6bf3('0x2e'),_0x40ced4[_0x6bf3('0x3c')]);});}}});})['then'](function(){return _0x266208[_0x6bf3('0x2f')][_0x6bf3('0x3d')]({'attributes':['id','dialCheckDuplicateType',_0x6bf3('0x1c')],'include':[{'model':_0x266208[_0x6bf3('0x3e')],'as':'Lists','where':{'id':_0x574480[_0x6bf3('0x31')]}}]})[_0x6bf3('0x1f')](function(_0x235411){if(_0x235411){var _0x17c16d=[];for(var _0x1ae40e=0x0,_0x3a8127;_0x1ae40e<_0x235411[_0x6bf3('0x37')];_0x1ae40e+=0x1){_0x3a8127=_0x235411[_0x1ae40e][_0x6bf3('0x38')]({'plain':!![]});switch(_0x3a8127[_0x6bf3('0x35')]){case _0x6bf3('0x39'):_0x359be1(_0x3a8127)[_0x6bf3('0x29')](_0x15c0d4());break;case _0x6bf3('0x3f'):_0x139eb1(_0x3a8127)[_0x6bf3('0x29')](_0x15c0d4());break;default:_0x266208['CmHopper'][_0x6bf3('0x26')]({'phone':_0x574480[_0x6bf3('0xb')],'ContactId':_0x574480['id'],'ListId':_0x574480[_0x6bf3('0x31')],'scheduledat':_0x574480[_0x6bf3('0x18')]?_0x574480[_0x6bf3('0x18')]:moment()[_0x6bf3('0x19')](_0x6bf3('0x1a')),'priority':_0x574480[_0x6bf3('0x27')]?_0x574480[_0x6bf3('0x27')]:0x2,'callback':_0x574480[_0x6bf3('0x28')]?!![]:![],'callbackuniqueid':_0x574480['callbackUniqueid']?_0x574480[_0x6bf3('0x28')]:undefined,'callbackat':_0x574480[_0x6bf3('0x28')]?moment()[_0x6bf3('0x19')](_0x6bf3('0x1a')):undefined,'CampaignId':_0x3a8127['id']})[_0x6bf3('0x29')](_0x15c0d4());}}}});})[_0x6bf3('0x1f')](function(){return _0x266208['Campaign'][_0x6bf3('0x3d')]({'attributes':['id'],'include':[{'model':_0x266208['CmList'],'as':_0x6bf3('0x3a'),'where':{'id':_0x574480['ListId']}}]})[_0x6bf3('0x1f')](function(_0x4d6586){if(_0x4d6586){var _0x252717=[];for(var _0x226614=0x0,_0x2841;_0x226614<_0x4d6586[_0x6bf3('0x37')];_0x226614+=0x1){_0x2841=_0x4d6586[_0x226614][_0x6bf3('0x38')]({'plain':!![]});_0x266208[_0x6bf3('0x3b')][_0x6bf3('0x26')]({'phone':_0x574480['phone'],'ContactId':_0x574480['id'],'ListId':_0x574480[_0x6bf3('0x31')],'CampaignId':_0x2841['id']})[_0x6bf3('0x29')](function(_0x3aeec2){logger['error'](_0x6bf3('0x40'),'afterCreate',_0x3aeec2[_0x6bf3('0x3c')]);});}}});})['then'](function(){_0x1e4561();})[_0x6bf3('0x29')](function(_0x441be7){logger[_0x6bf3('0x15')](_0x6bf3('0x40'),_0x6bf3('0x2e'),_0x441be7[_0x6bf3('0x3c')]);_0x1e4561(_0x441be7);});}else{_0x1e4561(new Error(_0x6bf3('0x41')));}},'afterDestroy':function(_0x462087,_0x434719,_0x4b8c62){var _0x5d096e=_0x216d21['models'];var _0x5ade06=_0x462087[_0x6bf3('0x38')]({'plain':!![]});return _0x5d096e['CmHopper']['findAll']({'raw':!![],'where':{'ListId':_0x5ade06[_0x6bf3('0x31')],'ContactId':_0x5ade06['id']}})[_0x6bf3('0x1f')](function(_0x1d2da9){if(!_[_0x6bf3('0x42')](_0x1d2da9)){var _0x237f38=[];for(var _0x2ab9e8=0x0;_0x2ab9e8<_0x1d2da9[_0x6bf3('0x37')];_0x2ab9e8+=0x1){var _0x577dcf=_0x5d096e[_0x6bf3('0x23')]['destroy']({'where':{'ListId':_0x1d2da9[_0x2ab9e8][_0x6bf3('0x31')],'ContactId':_0x1d2da9[_0x2ab9e8]['ContactId'],'VoiceQueueId':_0x1d2da9[_0x2ab9e8][_0x6bf3('0x43')],'CampaignId':_0x1d2da9[_0x2ab9e8][_0x6bf3('0x44')]}});_0x237f38[_0x6bf3('0x45')](_0x577dcf);}return BPromise['all'](_0x237f38);}})[_0x6bf3('0x1f')](function(_0x59b22b){logger[_0x6bf3('0x46')]('[CmContact][afterDestroy][Succesfull]',util[_0x6bf3('0x17')](_0x59b22b,{'showHidden':![],'depth':null}));_0x4b8c62();})['catch'](function(_0x53ccd4){logger['error'](_0x6bf3('0x47'),util['inspect'](_0x53ccd4,{'showHidden':![],'depth':null}));_0x4b8c62(_0x53ccd4);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index cff5ede..bde4ade 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x22cec8,_0x27e08a){var _0x5d236f=function(_0x39b75c){while(--_0x39b75c){_0x22cec8['push'](_0x22cec8['shift']());}};_0x5d236f(++_0x27e08a);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0xc295e1,_0x28b398){var _0x3ea7fd=function(_0x10ca9d){while(--_0x10ca9d){_0xc295e1['push'](_0xc295e1['shift']());}};_0x3ea7fd(++_0x28b398);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index fbf5bad..4fb942d 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb26e=['sequelize','INTEGER','STRING'];(function(_0x1c558d,_0x1bf3f1){var _0x4c47f2=function(_0x69e2c0){while(--_0x69e2c0){_0x1c558d['push'](_0x1c558d['shift']());}};_0x4c47f2(++_0x1bf3f1);}(_0xb26e,0x11d));var _0xeb26=function(_0xe67e22,_0x547e07){_0xe67e22=_0xe67e22-0x0;var _0x39ff12=_0xb26e[_0xe67e22];return _0x39ff12;};'use strict';var Sequelize=require(_0xeb26('0x0'));module['exports']={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xeb26('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xeb26('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xeb26('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xeb26('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0xae7b=['sequelize','exports','INTEGER','STRING','PHONE'];(function(_0x3a4a22,_0x217aff){var _0xec204=function(_0x125c6c){while(--_0x125c6c){_0x3a4a22['push'](_0x3a4a22['shift']());}};_0xec204(++_0x217aff);}(_0xae7b,0xbe));var _0xbae7=function(_0x392e1d,_0x125aed){_0x392e1d=_0x392e1d-0x0;var _0x486d9b=_0xae7b[_0x392e1d];return _0x486d9b;};'use strict';var Sequelize=require(_0xbae7('0x0'));module[_0xbae7('0x1')]={'CmContactId':{'type':Sequelize[_0xbae7('0x2')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xbae7('0x3')],'defaultValue':_0xbae7('0x4')},'OrderBy':{'type':Sequelize[_0xbae7('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0xbae7('0x3')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 219d869..c802539 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6c0=['mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','get','CmContactHasItems','UserProfileResource','destroy','sendStatus','error','stack','name','send','map','CmContactHasItem','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','eml-format','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x28c453,_0xb4109a){var _0xbbc87c=function(_0x5e13d2){while(--_0x5e13d2){_0x28c453['push'](_0x28c453['shift']());}};_0xbbc87c(++_0xb4109a);}(_0xc6c0,0xa1));var _0x0c6c=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0xc6c0[_0x51fe5f];return _0x4abce9;};'use strict';var emlformat=require(_0x0c6c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0c6c('0x1'));var jsonpatch=require(_0x0c6c('0x2'));var rp=require('request-promise');var moment=require(_0x0c6c('0x3'));var BPromise=require(_0x0c6c('0x4'));var Mustache=require(_0x0c6c('0x5'));var util=require(_0x0c6c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0c6c('0x7'));var ejs=require(_0x0c6c('0x8'));var fs=require('fs');var fs_extra=require(_0x0c6c('0x9'));var _=require(_0x0c6c('0xa'));var squel=require(_0x0c6c('0xb'));var crypto=require(_0x0c6c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0c6c('0xd'));var toCsv=require(_0x0c6c('0x7'));var querystring=require(_0x0c6c('0xe'));var Papa=require(_0x0c6c('0xf'));var Redis=require(_0x0c6c('0x10'));var authService=require(_0x0c6c('0x11'));var qs=require(_0x0c6c('0x12'));var as=require(_0x0c6c('0x13'));var hardwareService=require(_0x0c6c('0x14'));var logger=require(_0x0c6c('0x15'))('api');var utils=require(_0x0c6c('0x16'));var config=require(_0x0c6c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c6c('0x18'))['db'];function respondWithStatusCode(_0x11d08a,_0x51cd60){_0x51cd60=_0x51cd60||0xcc;return function(_0x6a1fdd){if(_0x6a1fdd){return _0x11d08a['sendStatus'](_0x51cd60);}return _0x11d08a[_0x0c6c('0x19')](_0x51cd60)[_0x0c6c('0x1a')]();};}function respondWithResult(_0x2c964c,_0x2c65db){_0x2c65db=_0x2c65db||0xc8;return function(_0x4b5047){if(_0x4b5047){return _0x2c964c[_0x0c6c('0x19')](_0x2c65db)['json'](_0x4b5047);}};}function respondWithFilteredResult(_0xa80e8,_0x2d37e9){return function(_0x2e453c){if(_0x2e453c){var _0x7ac78b=typeof _0x2d37e9[_0x0c6c('0x1b')]===_0x0c6c('0x1c')&&typeof _0x2d37e9[_0x0c6c('0x1d')]===_0x0c6c('0x1c');var _0x2d9940=_0x2e453c[_0x0c6c('0x1e')];var _0x9b7f6a=_0x7ac78b?0x0:_0x2d37e9['offset'];var _0x51c7a3=_0x7ac78b?_0x2e453c[_0x0c6c('0x1e')]:_0x2d37e9['offset']+_0x2d37e9['limit'];var _0x18a9a2;if(_0x51c7a3>=_0x2d9940){_0x51c7a3=_0x2d9940;_0x18a9a2=0xc8;}else{_0x18a9a2=0xce;}_0xa80e8['status'](_0x18a9a2);return _0xa80e8[_0x0c6c('0x1f')](_0x0c6c('0x20'),_0x9b7f6a+'-'+_0x51c7a3+'/'+_0x2d9940)[_0x0c6c('0x21')](_0x2e453c);}return null;};}function patchUpdates(_0x4ec1d2){return function(_0x113aad){try{jsonpatch['apply'](_0x113aad,_0x4ec1d2,!![]);}catch(_0x757da8){return BPromise[_0x0c6c('0x22')](_0x757da8);}return _0x113aad[_0x0c6c('0x23')]();};}function saveUpdates(_0x1b4c8b,_0x2258e8){return function(_0x5d75f0){if(_0x5d75f0){return _0x5d75f0[_0x0c6c('0x24')](_0x1b4c8b)[_0x0c6c('0x25')](function(_0x469973){return _0x469973;});}return null;};}function removeEntity(_0x188c0f,_0x3651e9){return function(_0x4b9446){if(_0x4b9446){return _0x4b9446['destroy']()[_0x0c6c('0x25')](function(){var _0x5b9dbf=_0x4b9446[_0x0c6c('0x26')]({'plain':!![]});var _0x1ee70d=_0x0c6c('0x27');return db[_0x0c6c('0x28')][_0x0c6c('0x29')]({'where':{'type':_0x1ee70d,'resourceId':_0x5b9dbf['id']}})[_0x0c6c('0x25')](function(){return _0x4b9446;});})[_0x0c6c('0x25')](function(){_0x188c0f[_0x0c6c('0x19')](0xcc)[_0x0c6c('0x1a')]();});}};}function handleEntityNotFound(_0x325745,_0x167505){return function(_0x5cf394){if(!_0x5cf394){_0x325745[_0x0c6c('0x2a')](0x194);}return _0x5cf394;};}function handleError(_0x5cf5d6,_0x2eb047){_0x2eb047=_0x2eb047||0x1f4;return function(_0x1b7bf8){logger[_0x0c6c('0x2b')](_0x1b7bf8[_0x0c6c('0x2c')]);if(_0x1b7bf8[_0x0c6c('0x2d')]){delete _0x1b7bf8[_0x0c6c('0x2d')];}_0x5cf5d6[_0x0c6c('0x19')](_0x2eb047)[_0x0c6c('0x2e')](_0x1b7bf8);};}exports['index']=function(_0x440d6a,_0x20ac4d){var _0x10dc4a={},_0xad9f32={},_0x362c25={'count':0x0,'rows':[]};var _0x8eaff8=_[_0x0c6c('0x2f')](db[_0x0c6c('0x30')]['rawAttributes'],function(_0x589a19){return{'name':_0x589a19['fieldName'],'type':_0x589a19[_0x0c6c('0x31')]['key']};});_0xad9f32[_0x0c6c('0x32')]=_[_0x0c6c('0x2f')](_0x8eaff8,'name');_0xad9f32[_0x0c6c('0x33')]=_[_0x0c6c('0x34')](_0x440d6a[_0x0c6c('0x33')]);_0xad9f32['filters']=_['intersection'](_0xad9f32[_0x0c6c('0x32')],_0xad9f32['query']);_0x10dc4a[_0x0c6c('0x35')]=_[_0x0c6c('0x36')](_0xad9f32[_0x0c6c('0x32')],qs[_0x0c6c('0x37')](_0x440d6a[_0x0c6c('0x33')]['fields']));_0x10dc4a['attributes']=_0x10dc4a[_0x0c6c('0x35')][_0x0c6c('0x38')]?_0x10dc4a[_0x0c6c('0x35')]:_0xad9f32[_0x0c6c('0x32')];if(!_0x440d6a[_0x0c6c('0x33')][_0x0c6c('0x39')](_0x0c6c('0x3a'))){_0x10dc4a[_0x0c6c('0x1d')]=qs[_0x0c6c('0x1d')](_0x440d6a[_0x0c6c('0x33')][_0x0c6c('0x1d')]);_0x10dc4a['offset']=qs['offset'](_0x440d6a[_0x0c6c('0x33')][_0x0c6c('0x1b')]);}_0x10dc4a['order']=qs[_0x0c6c('0x3b')](_0x440d6a[_0x0c6c('0x33')]['sort']);_0x10dc4a['where']=qs['filters'](_[_0x0c6c('0x3c')](_0x440d6a[_0x0c6c('0x33')],_0xad9f32[_0x0c6c('0x3d')]),_0x8eaff8);if(_0x440d6a[_0x0c6c('0x33')][_0x0c6c('0x3e')]){_0x10dc4a['where']=_[_0x0c6c('0x3f')](_0x10dc4a[_0x0c6c('0x40')],{'$or':_[_0x0c6c('0x2f')](_0x8eaff8,function(_0x175534){if(_0x175534[_0x0c6c('0x31')]!==_0x0c6c('0x41')){var _0x547d06={};_0x547d06[_0x175534[_0x0c6c('0x2d')]]={'$like':'%'+_0x440d6a['query'][_0x0c6c('0x3e')]+'%'};return _0x547d06;}})});}_0x10dc4a=_['merge']({},_0x10dc4a,_0x440d6a[_0x0c6c('0x42')]);var _0x4f49ee={'where':_0x10dc4a[_0x0c6c('0x40')]};return db['CmContactHasItem'][_0x0c6c('0x1e')](_0x4f49ee)[_0x0c6c('0x25')](function(_0x584a6a){_0x362c25['count']=_0x584a6a;if(_0x440d6a[_0x0c6c('0x33')][_0x0c6c('0x43')]){_0x10dc4a[_0x0c6c('0x44')]=[{'all':!![]}];}return db[_0x0c6c('0x30')][_0x0c6c('0x45')](_0x10dc4a);})[_0x0c6c('0x25')](function(_0x3e41a5){_0x362c25[_0x0c6c('0x46')]=_0x3e41a5;return _0x362c25;})[_0x0c6c('0x25')](respondWithFilteredResult(_0x20ac4d,_0x10dc4a))['catch'](handleError(_0x20ac4d,null));};exports[_0x0c6c('0x47')]=function(_0x5998e8,_0x3a9ca6){var _0x3ac431={'raw':!![],'where':{'id':_0x5998e8[_0x0c6c('0x48')]['id']}},_0x149c11={};_0x149c11[_0x0c6c('0x32')]=_[_0x0c6c('0x34')](db[_0x0c6c('0x30')]['rawAttributes']);_0x149c11[_0x0c6c('0x33')]=_[_0x0c6c('0x34')](_0x5998e8[_0x0c6c('0x33')]);_0x149c11[_0x0c6c('0x3d')]=_[_0x0c6c('0x36')](_0x149c11[_0x0c6c('0x32')],_0x149c11[_0x0c6c('0x33')]);_0x3ac431[_0x0c6c('0x35')]=_[_0x0c6c('0x36')](_0x149c11[_0x0c6c('0x32')],qs[_0x0c6c('0x37')](_0x5998e8[_0x0c6c('0x33')][_0x0c6c('0x37')]));_0x3ac431[_0x0c6c('0x35')]=_0x3ac431[_0x0c6c('0x35')][_0x0c6c('0x38')]?_0x3ac431[_0x0c6c('0x35')]:_0x149c11[_0x0c6c('0x32')];if(_0x5998e8['query'][_0x0c6c('0x43')]){_0x3ac431[_0x0c6c('0x44')]=[{'all':!![]}];}_0x3ac431=_[_0x0c6c('0x3f')]({},_0x3ac431,_0x5998e8[_0x0c6c('0x42')]);return db[_0x0c6c('0x30')][_0x0c6c('0x49')](_0x3ac431)[_0x0c6c('0x25')](handleEntityNotFound(_0x3a9ca6,null))['then'](respondWithResult(_0x3a9ca6,null))['catch'](handleError(_0x3a9ca6,null));};exports[_0x0c6c('0x4a')]=function(_0x35730b,_0x325e97){return db[_0x0c6c('0x30')][_0x0c6c('0x4a')](_0x35730b[_0x0c6c('0x4b')],{})[_0x0c6c('0x25')](function(_0x25ca03){var _0x311410=_0x35730b[_0x0c6c('0x4c')][_0x0c6c('0x26')]({'plain':!![]});if(!_0x311410)throw new Error(_0x0c6c('0x4d'));if(_0x311410[_0x0c6c('0x4e')]===_0x0c6c('0x4c')){var _0x29ad8c=_0x25ca03[_0x0c6c('0x26')]({'plain':!![]});var _0x11257c=_0x0c6c('0x27');return db[_0x0c6c('0x4f')][_0x0c6c('0x49')]({'where':{'name':_0x11257c,'userProfileId':_0x311410[_0x0c6c('0x50')]},'raw':!![]})[_0x0c6c('0x25')](function(_0x225a89){if(_0x225a89&&_0x225a89['autoAssociation']===0x0){return db[_0x0c6c('0x28')][_0x0c6c('0x4a')]({'name':_0x29ad8c['name'],'resourceId':_0x29ad8c['id'],'type':_0x225a89[_0x0c6c('0x2d')],'sectionId':_0x225a89['id']},{})[_0x0c6c('0x25')](function(){return _0x25ca03;});}else{return _0x25ca03;}})['catch'](function(_0x422918){logger[_0x0c6c('0x2b')](_0x0c6c('0x51'),_0x422918);throw _0x422918;});}return _0x25ca03;})['then'](respondWithResult(_0x325e97,0xc9))[_0x0c6c('0x52')](handleError(_0x325e97,null));};exports[_0x0c6c('0x24')]=function(_0x4e71cf,_0x182a45){if(_0x4e71cf[_0x0c6c('0x4b')]['id']){delete _0x4e71cf[_0x0c6c('0x4b')]['id'];}return db['CmContactHasItem'][_0x0c6c('0x49')]({'where':{'id':_0x4e71cf['params']['id']}})[_0x0c6c('0x25')](handleEntityNotFound(_0x182a45,null))[_0x0c6c('0x25')](saveUpdates(_0x4e71cf['body'],null))[_0x0c6c('0x25')](respondWithResult(_0x182a45,null))['catch'](handleError(_0x182a45,null));};exports[_0x0c6c('0x29')]=function(_0x55fa82,_0x24ed2d){return db[_0x0c6c('0x30')][_0x0c6c('0x49')]({'where':{'id':_0x55fa82['params']['id']}})['then'](handleEntityNotFound(_0x24ed2d,null))[_0x0c6c('0x25')](removeEntity(_0x24ed2d,null))[_0x0c6c('0x52')](handleError(_0x24ed2d,null));}; \ No newline at end of file +var _0xaa09=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','CmContactHasItems','UserProfileResource','destroy','end','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','order','sort','where','filter','VIRTUAL','merge','includeAll','include','CmContactHasItem','findAll','catch','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xaa09,0x8e));var _0x9aa0=function(_0x4f1140,_0xdd3e4d){_0x4f1140=_0x4f1140-0x0;var _0x3e8bbe=_0xaa09[_0x4f1140];return _0x3e8bbe;};'use strict';var emlformat=require(_0x9aa0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9aa0('0x1'));var rp=require(_0x9aa0('0x2'));var moment=require(_0x9aa0('0x3'));var BPromise=require(_0x9aa0('0x4'));var Mustache=require(_0x9aa0('0x5'));var util=require('util');var path=require(_0x9aa0('0x6'));var sox=require(_0x9aa0('0x7'));var csv=require(_0x9aa0('0x8'));var ejs=require(_0x9aa0('0x9'));var fs=require('fs');var fs_extra=require(_0x9aa0('0xa'));var _=require(_0x9aa0('0xb'));var squel=require('squel');var crypto=require(_0x9aa0('0xc'));var jsforce=require(_0x9aa0('0xd'));var deskjs=require(_0x9aa0('0xe'));var toCsv=require(_0x9aa0('0x8'));var querystring=require(_0x9aa0('0xf'));var Papa=require(_0x9aa0('0x10'));var Redis=require(_0x9aa0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9aa0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9aa0('0x13'));var logger=require(_0x9aa0('0x14'))('api');var utils=require(_0x9aa0('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9aa0('0x16'));var db=require(_0x9aa0('0x17'))['db'];function respondWithStatusCode(_0x4fe8cc,_0x444786){_0x444786=_0x444786||0xcc;return function(_0x2bb4be){if(_0x2bb4be){return _0x4fe8cc[_0x9aa0('0x18')](_0x444786);}return _0x4fe8cc['status'](_0x444786)['end']();};}function respondWithResult(_0x32981a,_0x1c462f){_0x1c462f=_0x1c462f||0xc8;return function(_0x20d311){if(_0x20d311){return _0x32981a[_0x9aa0('0x19')](_0x1c462f)['json'](_0x20d311);}};}function respondWithFilteredResult(_0x114cd3,_0x343647){return function(_0x48c2f9){if(_0x48c2f9){var _0x2bfe73=typeof _0x343647[_0x9aa0('0x1a')]===_0x9aa0('0x1b')&&typeof _0x343647[_0x9aa0('0x1c')]===_0x9aa0('0x1b');var _0x2c896a=_0x48c2f9['count'];var _0x41f74c=_0x2bfe73?0x0:_0x343647[_0x9aa0('0x1a')];var _0x57a342=_0x2bfe73?_0x48c2f9[_0x9aa0('0x1d')]:_0x343647[_0x9aa0('0x1a')]+_0x343647[_0x9aa0('0x1c')];var _0x487990;if(_0x57a342>=_0x2c896a){_0x57a342=_0x2c896a;_0x487990=0xc8;}else{_0x487990=0xce;}_0x114cd3[_0x9aa0('0x19')](_0x487990);return _0x114cd3[_0x9aa0('0x1e')](_0x9aa0('0x1f'),_0x41f74c+'-'+_0x57a342+'/'+_0x2c896a)['json'](_0x48c2f9);}return null;};}function patchUpdates(_0x3a6beb){return function(_0x494cc1){try{jsonpatch[_0x9aa0('0x20')](_0x494cc1,_0x3a6beb,!![]);}catch(_0x10a272){return BPromise[_0x9aa0('0x21')](_0x10a272);}return _0x494cc1[_0x9aa0('0x22')]();};}function saveUpdates(_0x270c15,_0x4e6b56){return function(_0x5a33e7){if(_0x5a33e7){return _0x5a33e7[_0x9aa0('0x23')](_0x270c15)[_0x9aa0('0x24')](function(_0x174df0){return _0x174df0;});}return null;};}function removeEntity(_0x10931b,_0xe08bf1){return function(_0x52428c){if(_0x52428c){return _0x52428c['destroy']()['then'](function(){var _0x69e85a=_0x52428c['get']({'plain':!![]});var _0x521050=_0x9aa0('0x25');return db[_0x9aa0('0x26')][_0x9aa0('0x27')]({'where':{'type':_0x521050,'resourceId':_0x69e85a['id']}})[_0x9aa0('0x24')](function(){return _0x52428c;});})['then'](function(){_0x10931b[_0x9aa0('0x19')](0xcc)[_0x9aa0('0x28')]();});}};}function handleEntityNotFound(_0xce7025,_0x110f2b){return function(_0x5d9afa){if(!_0x5d9afa){_0xce7025['sendStatus'](0x194);}return _0x5d9afa;};}function handleError(_0x38e4c3,_0x3ca195){_0x3ca195=_0x3ca195||0x1f4;return function(_0x5e94b0){logger[_0x9aa0('0x29')](_0x5e94b0[_0x9aa0('0x2a')]);if(_0x5e94b0[_0x9aa0('0x2b')]){delete _0x5e94b0[_0x9aa0('0x2b')];}_0x38e4c3[_0x9aa0('0x19')](_0x3ca195)[_0x9aa0('0x2c')](_0x5e94b0);};}exports[_0x9aa0('0x2d')]=function(_0x593963,_0x3d1a40){var _0x5a5321={},_0x4ac8fd={},_0x309075={'count':0x0,'rows':[]};var _0x546eb2=_[_0x9aa0('0x2e')](db['CmContactHasItem'][_0x9aa0('0x2f')],function(_0x47762c){return{'name':_0x47762c['fieldName'],'type':_0x47762c[_0x9aa0('0x30')][_0x9aa0('0x31')]};});_0x4ac8fd['model']=_[_0x9aa0('0x2e')](_0x546eb2,_0x9aa0('0x2b'));_0x4ac8fd[_0x9aa0('0x32')]=_[_0x9aa0('0x33')](_0x593963['query']);_0x4ac8fd[_0x9aa0('0x34')]=_[_0x9aa0('0x35')](_0x4ac8fd['model'],_0x4ac8fd[_0x9aa0('0x32')]);_0x5a5321['attributes']=_[_0x9aa0('0x35')](_0x4ac8fd[_0x9aa0('0x36')],qs[_0x9aa0('0x37')](_0x593963[_0x9aa0('0x32')]['fields']));_0x5a5321[_0x9aa0('0x38')]=_0x5a5321[_0x9aa0('0x38')]['length']?_0x5a5321['attributes']:_0x4ac8fd[_0x9aa0('0x36')];if(!_0x593963[_0x9aa0('0x32')]['hasOwnProperty']('nolimit')){_0x5a5321[_0x9aa0('0x1c')]=qs[_0x9aa0('0x1c')](_0x593963[_0x9aa0('0x32')][_0x9aa0('0x1c')]);_0x5a5321['offset']=qs[_0x9aa0('0x1a')](_0x593963[_0x9aa0('0x32')][_0x9aa0('0x1a')]);}_0x5a5321[_0x9aa0('0x39')]=qs[_0x9aa0('0x3a')](_0x593963[_0x9aa0('0x32')]['sort']);_0x5a5321[_0x9aa0('0x3b')]=qs[_0x9aa0('0x34')](_['pick'](_0x593963[_0x9aa0('0x32')],_0x4ac8fd[_0x9aa0('0x34')]),_0x546eb2);if(_0x593963[_0x9aa0('0x32')][_0x9aa0('0x3c')]){_0x5a5321['where']=_['merge'](_0x5a5321['where'],{'$or':_[_0x9aa0('0x2e')](_0x546eb2,function(_0x37907f){if(_0x37907f['type']!==_0x9aa0('0x3d')){var _0x519046={};_0x519046[_0x37907f[_0x9aa0('0x2b')]]={'$like':'%'+_0x593963[_0x9aa0('0x32')]['filter']+'%'};return _0x519046;}})});}_0x5a5321=_[_0x9aa0('0x3e')]({},_0x5a5321,_0x593963['options']);var _0x6d7401={'where':_0x5a5321['where']};return db['CmContactHasItem']['count'](_0x6d7401)[_0x9aa0('0x24')](function(_0x4fe4bf){_0x309075[_0x9aa0('0x1d')]=_0x4fe4bf;if(_0x593963[_0x9aa0('0x32')][_0x9aa0('0x3f')]){_0x5a5321[_0x9aa0('0x40')]=[{'all':!![]}];}return db[_0x9aa0('0x41')][_0x9aa0('0x42')](_0x5a5321);})['then'](function(_0x1d5b94){_0x309075['rows']=_0x1d5b94;return _0x309075;})[_0x9aa0('0x24')](respondWithFilteredResult(_0x3d1a40,_0x5a5321))[_0x9aa0('0x43')](handleError(_0x3d1a40,null));};exports['show']=function(_0x1e8d07,_0x1787ae){var _0x58e133={'raw':!![],'where':{'id':_0x1e8d07['params']['id']}},_0xc5df8a={};_0xc5df8a[_0x9aa0('0x36')]=_[_0x9aa0('0x33')](db[_0x9aa0('0x41')][_0x9aa0('0x2f')]);_0xc5df8a[_0x9aa0('0x32')]=_[_0x9aa0('0x33')](_0x1e8d07[_0x9aa0('0x32')]);_0xc5df8a[_0x9aa0('0x34')]=_[_0x9aa0('0x35')](_0xc5df8a[_0x9aa0('0x36')],_0xc5df8a[_0x9aa0('0x32')]);_0x58e133['attributes']=_[_0x9aa0('0x35')](_0xc5df8a[_0x9aa0('0x36')],qs[_0x9aa0('0x37')](_0x1e8d07[_0x9aa0('0x32')][_0x9aa0('0x37')]));_0x58e133[_0x9aa0('0x38')]=_0x58e133[_0x9aa0('0x38')]['length']?_0x58e133[_0x9aa0('0x38')]:_0xc5df8a[_0x9aa0('0x36')];if(_0x1e8d07[_0x9aa0('0x32')][_0x9aa0('0x3f')]){_0x58e133[_0x9aa0('0x40')]=[{'all':!![]}];}_0x58e133=_[_0x9aa0('0x3e')]({},_0x58e133,_0x1e8d07[_0x9aa0('0x44')]);return db['CmContactHasItem'][_0x9aa0('0x45')](_0x58e133)['then'](handleEntityNotFound(_0x1787ae,null))[_0x9aa0('0x24')](respondWithResult(_0x1787ae,null))[_0x9aa0('0x43')](handleError(_0x1787ae,null));};exports[_0x9aa0('0x46')]=function(_0x5bad13,_0x4fd124){return db[_0x9aa0('0x41')][_0x9aa0('0x46')](_0x5bad13[_0x9aa0('0x47')],{})[_0x9aa0('0x24')](function(_0x49f765){var _0x2f3288=_0x5bad13[_0x9aa0('0x48')][_0x9aa0('0x49')]({'plain':!![]});if(!_0x2f3288)throw new Error(_0x9aa0('0x4a'));if(_0x2f3288[_0x9aa0('0x4b')]==='user'){var _0x40a37d=_0x49f765['get']({'plain':!![]});var _0x5b62df='CmContactHasItems';return db[_0x9aa0('0x4c')][_0x9aa0('0x45')]({'where':{'name':_0x5b62df,'userProfileId':_0x2f3288['userProfileId']},'raw':!![]})['then'](function(_0x15d988){if(_0x15d988&&_0x15d988[_0x9aa0('0x4d')]===0x0){return db[_0x9aa0('0x26')][_0x9aa0('0x46')]({'name':_0x40a37d[_0x9aa0('0x2b')],'resourceId':_0x40a37d['id'],'type':_0x15d988[_0x9aa0('0x2b')],'sectionId':_0x15d988['id']},{})[_0x9aa0('0x24')](function(){return _0x49f765;});}else{return _0x49f765;}})[_0x9aa0('0x43')](function(_0x4e5a2f){logger[_0x9aa0('0x29')](_0x9aa0('0x4e'),_0x4e5a2f);throw _0x4e5a2f;});}return _0x49f765;})['then'](respondWithResult(_0x4fd124,0xc9))[_0x9aa0('0x43')](handleError(_0x4fd124,null));};exports[_0x9aa0('0x23')]=function(_0xbfbb42,_0x25dd26){if(_0xbfbb42[_0x9aa0('0x47')]['id']){delete _0xbfbb42['body']['id'];}return db[_0x9aa0('0x41')][_0x9aa0('0x45')]({'where':{'id':_0xbfbb42[_0x9aa0('0x4f')]['id']}})[_0x9aa0('0x24')](handleEntityNotFound(_0x25dd26,null))[_0x9aa0('0x24')](saveUpdates(_0xbfbb42[_0x9aa0('0x47')],null))[_0x9aa0('0x24')](respondWithResult(_0x25dd26,null))[_0x9aa0('0x43')](handleError(_0x25dd26,null));};exports[_0x9aa0('0x27')]=function(_0x19c037,_0x6588ae){return db['CmContactHasItem'][_0x9aa0('0x45')]({'where':{'id':_0x19c037[_0x9aa0('0x4f')]['id']}})['then'](handleEntityNotFound(_0x6588ae,null))['then'](removeEntity(_0x6588ae,null))[_0x9aa0('0x43')](handleError(_0x6588ae,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 71ffd17..f5b39be 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc70=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','CmContactHasItem','cm_contact_has_items'];(function(_0xf57f40,_0x2cf64d){var _0x3d9ebf=function(_0x235b7e){while(--_0x235b7e){_0xf57f40['push'](_0xf57f40['shift']());}};_0x3d9ebf(++_0x2cf64d);}(_0xfc70,0x78));var _0x0fc7=function(_0xe81dec,_0x48a7ea){_0xe81dec=_0xe81dec-0x0;var _0x495d06=_0xfc70[_0xe81dec];return _0x495d06;};'use strict';var _=require(_0x0fc7('0x0'));var util=require(_0x0fc7('0x1'));var logger=require(_0x0fc7('0x2'))(_0x0fc7('0x3'));var moment=require('moment');var BPromise=require(_0x0fc7('0x4'));var rp=require(_0x0fc7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fc7('0x6'));var config=require(_0x0fc7('0x7'));var attributes=require(_0x0fc7('0x8'));module[_0x0fc7('0x9')]=function(_0x105919,_0x55a326){return _0x105919['define'](_0x0fc7('0xa'),attributes,{'tableName':_0x0fc7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe658=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items'];(function(_0x466c17,_0x68fc5b){var _0x158a6a=function(_0x596177){while(--_0x596177){_0x466c17['push'](_0x466c17['shift']());}};_0x158a6a(++_0x68fc5b);}(_0xe658,0x90));var _0x8e65=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe658[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x8e65('0x0'));var logger=require(_0x8e65('0x1'))(_0x8e65('0x2'));var moment=require('moment');var BPromise=require(_0x8e65('0x3'));var rp=require(_0x8e65('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8e65('0x5'));var config=require(_0x8e65('0x6'));var attributes=require(_0x8e65('0x7'));module[_0x8e65('0x8')]=function(_0x433ef8,_0x3feac1){return _0x433ef8[_0x8e65('0x9')](_0x8e65('0xa'),attributes,{'tableName':_0x8e65('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index c9f069f..1845cd4 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1993=['rpc','../../config/environment','http','request','then','CmContactHasItem,\x20%s,\x20%s','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x2f7892,_0x1c26c5){var _0x2f9e9c=function(_0x2755ba){while(--_0x2755ba){_0x2f7892['push'](_0x2f7892['shift']());}};_0x2f9e9c(++_0x1c26c5);}(_0x1993,0x19e));var _0x3199=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x1993[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x3199('0x0'));var moment=require(_0x3199('0x1'));var BPromise=require(_0x3199('0x2'));var rs=require(_0x3199('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3199('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3199('0x5'))(_0x3199('0x6'));var config=require(_0x3199('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3199('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x528771,_0xb93ce5,_0x23353a){return new BPromise(function(_0x2ba654,_0x4b09f8){return client[_0x3199('0x9')](_0x528771,_0x23353a)[_0x3199('0xa')](function(_0x406bac){logger['info'](_0x3199('0xb'),_0xb93ce5,'request\x20sent');logger['debug'](_0x3199('0xc'),_0xb93ce5,'request\x20sent',JSON[_0x3199('0xd')](_0x406bac));if(_0x406bac['error']){if(_0x406bac[_0x3199('0xe')][_0x3199('0xf')]===0x1f4){logger[_0x3199('0xe')](_0x3199('0xb'),_0xb93ce5,_0x406bac[_0x3199('0xe')][_0x3199('0x10')]);return _0x4b09f8(_0x406bac['error'][_0x3199('0x10')]);}logger[_0x3199('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0xb93ce5,_0x406bac[_0x3199('0xe')]['message']);return _0x2ba654(_0x406bac[_0x3199('0xe')][_0x3199('0x10')]);}else{logger[_0x3199('0x11')](_0x3199('0xb'),_0xb93ce5,_0x3199('0x12'));_0x2ba654(_0x406bac[_0x3199('0x13')]['message']);}})[_0x3199('0x14')](function(_0x47f3d7){logger[_0x3199('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0xb93ce5,_0x47f3d7);_0x4b09f8(_0x47f3d7);});});} \ No newline at end of file +var _0xfc79=['CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','info','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x334074,_0x576384){var _0x4f8bdd=function(_0x377cc4){while(--_0x377cc4){_0x334074['push'](_0x334074['shift']());}};_0x4f8bdd(++_0x576384);}(_0xfc79,0x1ec));var _0x9fc7=function(_0x14666b,_0x13cc15){_0x14666b=_0x14666b-0x0;var _0x4aa848=_0xfc79[_0x14666b];return _0x4aa848;};'use strict';var _=require(_0x9fc7('0x0'));var util=require(_0x9fc7('0x1'));var moment=require(_0x9fc7('0x2'));var BPromise=require('bluebird');var rs=require(_0x9fc7('0x3'));var fs=require('fs');var Redis=require(_0x9fc7('0x4'));var db=require(_0x9fc7('0x5'))['db'];var utils=require(_0x9fc7('0x6'));var logger=require(_0x9fc7('0x7'))(_0x9fc7('0x8'));var config=require('../../config/environment');var jayson=require(_0x9fc7('0x9'));var client=jayson[_0x9fc7('0xa')][_0x9fc7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31250d,_0x5dee9e,_0x530782){return new BPromise(function(_0x28217d,_0x4ef996){return client[_0x9fc7('0xc')](_0x31250d,_0x530782)[_0x9fc7('0xd')](function(_0x3b43e6){logger['info'](_0x9fc7('0xe'),_0x5dee9e,_0x9fc7('0xf'));logger[_0x9fc7('0x10')](_0x9fc7('0x11'),_0x5dee9e,_0x9fc7('0xf'),JSON[_0x9fc7('0x12')](_0x3b43e6));if(_0x3b43e6[_0x9fc7('0x13')]){if(_0x3b43e6['error']['code']===0x1f4){logger[_0x9fc7('0x13')]('CmContactHasItem,\x20%s,\x20%s',_0x5dee9e,_0x3b43e6['error'][_0x9fc7('0x14')]);return _0x4ef996(_0x3b43e6[_0x9fc7('0x13')][_0x9fc7('0x14')]);}logger[_0x9fc7('0x13')](_0x9fc7('0xe'),_0x5dee9e,_0x3b43e6[_0x9fc7('0x13')][_0x9fc7('0x14')]);return _0x28217d(_0x3b43e6['error'][_0x9fc7('0x14')]);}else{logger[_0x9fc7('0x15')]('CmContactHasItem,\x20%s,\x20%s',_0x5dee9e,_0x9fc7('0xf'));_0x28217d(_0x3b43e6['result'][_0x9fc7('0x14')]);}})['catch'](function(_0x40df97){logger[_0x9fc7('0x13')](_0x9fc7('0xe'),_0x5dee9e,_0x40df97);_0x4ef996(_0x40df97);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index f965d20..ab1d835 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcaa8=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','post','create','put'];(function(_0xa55649,_0x458c1d){var _0x238363=function(_0x1da3b1){while(--_0x1da3b1){_0xa55649['push'](_0xa55649['shift']());}};_0x238363(++_0x458c1d);}(_0xcaa8,0x6a));var _0x8caa=function(_0x1772fb,_0x3eeb99){_0x1772fb=_0x1772fb-0x0;var _0x1b899a=_0xcaa8[_0x1772fb];return _0x1b899a;};'use strict';var multer=require(_0x8caa('0x0'));var util=require(_0x8caa('0x1'));var path=require(_0x8caa('0x2'));var timeout=require('connect-timeout');var express=require(_0x8caa('0x3'));var router=express[_0x8caa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8caa('0x5'));var interaction=require(_0x8caa('0x6'));var config=require('../../config/environment');var controller=require('./cmContactHasItem.controller');router[_0x8caa('0x7')]('/',auth['isAuthenticated'](),controller[_0x8caa('0x8')]);router[_0x8caa('0x7')](_0x8caa('0x9'),auth[_0x8caa('0xa')](),controller['show']);router[_0x8caa('0xb')]('/',auth[_0x8caa('0xa')](),controller[_0x8caa('0xc')]);router[_0x8caa('0xd')](_0x8caa('0x9'),auth[_0x8caa('0xa')](),controller['update']);router['delete'](_0x8caa('0x9'),auth[_0x8caa('0xa')](),controller['destroy']);module[_0x8caa('0xe')]=router; \ No newline at end of file +var _0xea70=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','isAuthenticated','index','get','/:id','post','create','update'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xea70,0xe7));var _0x0ea7=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xea70[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x0ea7('0x0'));var path=require(_0x0ea7('0x1'));var timeout=require(_0x0ea7('0x2'));var express=require(_0x0ea7('0x3'));var router=express[_0x0ea7('0x4')]();var fs_extra=require(_0x0ea7('0x5'));var auth=require(_0x0ea7('0x6'));var interaction=require(_0x0ea7('0x7'));var config=require('../../config/environment');var controller=require(_0x0ea7('0x8'));router['get']('/',auth[_0x0ea7('0x9')](),controller[_0x0ea7('0xa')]);router[_0x0ea7('0xb')](_0x0ea7('0xc'),auth[_0x0ea7('0x9')](),controller['show']);router[_0x0ea7('0xd')]('/',auth[_0x0ea7('0x9')](),controller[_0x0ea7('0xe')]);router['put'](_0x0ea7('0xc'),auth[_0x0ea7('0x9')](),controller[_0x0ea7('0xf')]);router[_0x0ea7('0x10')]('/:id',auth[_0x0ea7('0x9')](),controller[_0x0ea7('0x11')]);module[_0x0ea7('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 2ce1c07..e91c8b4 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 _0xdf26=['alias','name','TEXT','long','select','parse','values','setDataValue','stringify','BOOLEAN','voice','sequelize','lodash','exports','VIRTUAL','getDataValue'];(function(_0x74115b,_0x31f752){var _0x57ebbd=function(_0x234873){while(--_0x234873){_0x74115b['push'](_0x74115b['shift']());}};_0x57ebbd(++_0x31f752);}(_0xdf26,0x1ab));var _0x6df2=function(_0x4d399b,_0x3bd4a4){_0x4d399b=_0x4d399b-0x0;var _0x4435e5=_0xdf26[_0x4d399b];return _0x4435e5;};'use strict';var Sequelize=require(_0x6df2('0x0'));var _=require(_0x6df2('0x1'));module[_0x6df2('0x2')]={'name':{'type':Sequelize[_0x6df2('0x3')],'get':function(_0x174b19){return this[_0x6df2('0x4')](_0x6df2('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x1227c3){this['setDataValue']('alias',_0x1227c3?_0x1227c3:this[_0x6df2('0x4')](_0x6df2('0x6')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x6df2('0x7')](_0x6df2('0x8')),'get':function(){if(this[_0x6df2('0x4')]('type')===_0x6df2('0x9')){return JSON[_0x6df2('0xa')](this[_0x6df2('0x4')]('values'));}else{return this['getDataValue'](_0x6df2('0xb'));}},'set':function(_0x57aaf4){if(Array['isArray'](_0x57aaf4)){this[_0x6df2('0xc')](_0x6df2('0xb'),JSON[_0x6df2('0xd')](_0x57aaf4));}else{this[_0x6df2('0xc')](_0x6df2('0xb'),_0x57aaf4);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x6df2('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x6df2('0xf'))}}; \ No newline at end of file +var _0x367d=['voice','sequelize','lodash','exports','VIRTUAL','getDataValue','STRING','alias','name','TEXT','type','select','values','isArray','setDataValue','stringify','BOOLEAN','ENUM'];(function(_0x40bf00,_0x3e799f){var _0xe13f42=function(_0x298c97){while(--_0x298c97){_0x40bf00['push'](_0x40bf00['shift']());}};_0xe13f42(++_0x3e799f);}(_0x367d,0x1b1));var _0xd367=function(_0x44fcd2,_0x26e9ba){_0x44fcd2=_0x44fcd2-0x0;var _0x36d054=_0x367d[_0x44fcd2];return _0x36d054;};'use strict';var Sequelize=require(_0xd367('0x0'));var _=require(_0xd367('0x1'));module[_0xd367('0x2')]={'name':{'type':Sequelize[_0xd367('0x3')],'get':function(_0x401e1c){return this[_0xd367('0x4')]('alias');}},'alias':{'type':Sequelize[_0xd367('0x5')],'allowNull':![],'set':function(_0x4568a8){this['setDataValue'](_0xd367('0x6'),_0x4568a8?_0x4568a8:this['getDataValue'](_0xd367('0x7')));}},'type':{'type':Sequelize[_0xd367('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xd367('0x8')]('long'),'get':function(){if(this[_0xd367('0x4')](_0xd367('0x9'))===_0xd367('0xa')){return JSON['parse'](this['getDataValue'](_0xd367('0xb')));}else{return this['getDataValue'](_0xd367('0xb'));}},'set':function(_0x54583c){if(Array[_0xd367('0xc')](_0x54583c)){this[_0xd367('0xd')](_0xd367('0xb'),JSON[_0xd367('0xe')](_0x54583c));}else{this[_0xd367('0xd')](_0xd367('0xb'),_0x54583c);}}},'required':{'type':Sequelize[_0xd367('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xd367('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xd367('0x10')](_0xd367('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index aaf6bef..62090cd 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 _0x9467=['ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','CmCustomField','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','find','body','transaction','create','Sequelize','TEXT','text','number','INTEGER','switch','sequelize','queryInterface','addColumn','cm_contacts','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x132eb3,_0x211909){var _0x22dac1=function(_0x51eca6){while(--_0x51eca6){_0x132eb3['push'](_0x132eb3['shift']());}};_0x22dac1(++_0x211909);}(_0x9467,0xee));var _0x7946=function(_0x3913e9,_0x358630){_0x3913e9=_0x3913e9-0x0;var _0x59c7f2=_0x9467[_0x3913e9];return _0x59c7f2;};'use strict';var emlformat=require(_0x7946('0x0'));var rimraf=require(_0x7946('0x1'));var zipdir=require(_0x7946('0x2'));var jsonpatch=require(_0x7946('0x3'));var rp=require(_0x7946('0x4'));var moment=require(_0x7946('0x5'));var BPromise=require(_0x7946('0x6'));var Mustache=require(_0x7946('0x7'));var util=require('util');var path=require(_0x7946('0x8'));var sox=require(_0x7946('0x9'));var csv=require(_0x7946('0xa'));var ejs=require(_0x7946('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7946('0xc'));var crypto=require(_0x7946('0xd'));var jsforce=require(_0x7946('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7946('0xa'));var querystring=require('querystring');var Papa=require(_0x7946('0xf'));var Redis=require(_0x7946('0x10'));var authService=require(_0x7946('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7946('0x12'));var hardwareService=require(_0x7946('0x13'));var logger=require('../../config/logger')(_0x7946('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7946('0x15'));var db=require(_0x7946('0x16'))['db'];function respondWithStatusCode(_0x1dd9a9,_0x5a48ff){_0x5a48ff=_0x5a48ff||0xcc;return function(_0x29cd4d){if(_0x29cd4d){return _0x1dd9a9[_0x7946('0x17')](_0x5a48ff);}return _0x1dd9a9[_0x7946('0x18')](_0x5a48ff)[_0x7946('0x19')]();};}function respondWithResult(_0x4713cb,_0x14b756){_0x14b756=_0x14b756||0xc8;return function(_0x435b26){if(_0x435b26){return _0x4713cb[_0x7946('0x18')](_0x14b756)[_0x7946('0x1a')](_0x435b26);}};}function respondWithFilteredResult(_0x493053,_0x365a61){return function(_0x4577d){if(_0x4577d){var _0x286075=typeof _0x365a61[_0x7946('0x1b')]===_0x7946('0x1c')&&typeof _0x365a61[_0x7946('0x1d')]===_0x7946('0x1c');var _0x19c439=_0x4577d[_0x7946('0x1e')];var _0x349043=_0x286075?0x0:_0x365a61[_0x7946('0x1b')];var _0xaaf9b9=_0x286075?_0x4577d['count']:_0x365a61['offset']+_0x365a61[_0x7946('0x1d')];var _0x59e09;if(_0xaaf9b9>=_0x19c439){_0xaaf9b9=_0x19c439;_0x59e09=0xc8;}else{_0x59e09=0xce;}_0x493053['status'](_0x59e09);return _0x493053[_0x7946('0x1f')](_0x7946('0x20'),_0x349043+'-'+_0xaaf9b9+'/'+_0x19c439)[_0x7946('0x1a')](_0x4577d);}return null;};}function patchUpdates(_0x4af28d){return function(_0x7ecc2b){try{jsonpatch[_0x7946('0x21')](_0x7ecc2b,_0x4af28d,!![]);}catch(_0x39e9c9){return BPromise[_0x7946('0x22')](_0x39e9c9);}return _0x7ecc2b[_0x7946('0x23')]();};}function saveUpdates(_0x45742f,_0x1025e6){return function(_0x943e86){if(_0x943e86){return _0x943e86[_0x7946('0x24')](_0x45742f)[_0x7946('0x25')](function(_0x5a5109){return _0x5a5109;});}return null;};}function removeEntity(_0x513c30,_0x456578){return function(_0x1df7e9){if(_0x1df7e9){return _0x1df7e9['destroy']()[_0x7946('0x25')](function(){_0x513c30[_0x7946('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f4222,_0x58001f){return function(_0x38f763){if(!_0x38f763){_0x1f4222[_0x7946('0x17')](0x194);}return _0x38f763;};}function handleError(_0x269e5c,_0x2d2e08){_0x2d2e08=_0x2d2e08||0x1f4;return function(_0x39dcc2){logger[_0x7946('0x26')](_0x39dcc2['stack']);if(_0x39dcc2[_0x7946('0x27')]){delete _0x39dcc2[_0x7946('0x27')];}_0x269e5c['status'](_0x2d2e08)[_0x7946('0x28')](_0x39dcc2);};}exports['index']=function(_0x493995,_0x59e62f){var _0x320287={},_0x3aeeee={},_0x2b067f={'count':0x0,'rows':[]};var _0x1c76d6=_['map'](db[_0x7946('0x29')][_0x7946('0x2a')],function(_0x24f4e8){return{'name':_0x24f4e8['fieldName'],'type':_0x24f4e8[_0x7946('0x2b')][_0x7946('0x2c')]};});_0x3aeeee[_0x7946('0x2d')]=_['differenceBy'](_[_0x7946('0x2e')](_0x1c76d6,_0x7946('0x27')),[_0x7946('0x27')]);_0x3aeeee['query']=_[_0x7946('0x2f')](_0x493995[_0x7946('0x30')]);_0x3aeeee[_0x7946('0x31')]=_[_0x7946('0x32')](_0x3aeeee['model'],_0x3aeeee['query']);_0x320287['attributes']=_['intersection'](_0x3aeeee['model'],qs[_0x7946('0x33')](_0x493995['query'][_0x7946('0x33')]));_0x320287['attributes']=_0x320287['attributes'][_0x7946('0x34')]?_0x320287[_0x7946('0x35')]:_0x3aeeee[_0x7946('0x2d')];if(!_0x493995[_0x7946('0x30')][_0x7946('0x36')]('nolimit')){_0x320287[_0x7946('0x1d')]=qs[_0x7946('0x1d')](_0x493995[_0x7946('0x30')][_0x7946('0x1d')]);_0x320287[_0x7946('0x1b')]=qs[_0x7946('0x1b')](_0x493995[_0x7946('0x30')]['offset']);}_0x320287[_0x7946('0x37')]=qs[_0x7946('0x38')](_0x493995[_0x7946('0x30')][_0x7946('0x38')]);_0x320287['where']=qs['filters'](_[_0x7946('0x39')](_0x493995[_0x7946('0x30')],_0x3aeeee[_0x7946('0x31')]),_0x1c76d6);if(_0x493995[_0x7946('0x30')][_0x7946('0x3a')]){_0x320287['where']=_[_0x7946('0x3b')](_0x320287['where'],{'$or':_[_0x7946('0x2e')](_0x1c76d6,function(_0x2d8653){if(_0x2d8653[_0x7946('0x2b')]!==_0x7946('0x3c')){var _0x291779={};_0x291779[_0x2d8653['name']]={'$like':'%'+_0x493995[_0x7946('0x30')][_0x7946('0x3a')]+'%'};return _0x291779;}})});}_0x320287=_['merge']({},_0x320287,_0x493995[_0x7946('0x3d')]);var _0x48e24f={'where':_0x320287[_0x7946('0x3e')]};return db[_0x7946('0x29')][_0x7946('0x1e')](_0x48e24f)[_0x7946('0x25')](function(_0x2e1031){_0x2b067f['count']=_0x2e1031;if(_0x493995['query'][_0x7946('0x3f')]){_0x320287[_0x7946('0x40')]=[{'all':!![]}];}return db[_0x7946('0x29')][_0x7946('0x41')](_0x320287);})[_0x7946('0x25')](function(_0x2514de){_0x2b067f[_0x7946('0x42')]=_0x2514de;return _0x2b067f;})['then'](respondWithFilteredResult(_0x59e62f,_0x320287))[_0x7946('0x43')](handleError(_0x59e62f,null));};exports['show']=function(_0x375bdc,_0x8f3aca){var _0x402e4f={'raw':!![],'where':{'id':_0x375bdc['params']['id']}},_0x8fbb9c={};_0x8fbb9c[_0x7946('0x2d')]=_[_0x7946('0x2f')](db[_0x7946('0x29')]['rawAttributes']);_0x8fbb9c[_0x7946('0x30')]=_['keys'](_0x375bdc[_0x7946('0x30')]);_0x8fbb9c[_0x7946('0x31')]=_[_0x7946('0x32')](_0x8fbb9c[_0x7946('0x2d')],_0x8fbb9c[_0x7946('0x30')]);_0x402e4f[_0x7946('0x35')]=_[_0x7946('0x32')](_0x8fbb9c[_0x7946('0x2d')],qs[_0x7946('0x33')](_0x375bdc[_0x7946('0x30')][_0x7946('0x33')]));_0x402e4f['attributes']=_0x402e4f[_0x7946('0x35')]['length']?_0x402e4f[_0x7946('0x35')]:_0x8fbb9c[_0x7946('0x2d')];if(_0x375bdc[_0x7946('0x30')][_0x7946('0x3f')]){_0x402e4f[_0x7946('0x40')]=[{'all':!![]}];}_0x402e4f=_[_0x7946('0x3b')]({},_0x402e4f,_0x375bdc[_0x7946('0x3d')]);return db[_0x7946('0x29')][_0x7946('0x44')](_0x402e4f)['then'](handleEntityNotFound(_0x8f3aca,null))[_0x7946('0x25')](respondWithResult(_0x8f3aca,null))[_0x7946('0x43')](handleError(_0x8f3aca,null));};exports['update']=function(_0x47ff4,_0x17607c){if(_0x47ff4[_0x7946('0x45')]['id']){delete _0x47ff4[_0x7946('0x45')]['id'];}return db[_0x7946('0x29')][_0x7946('0x44')]({'where':{'id':_0x47ff4['params']['id']}})['then'](handleEntityNotFound(_0x17607c,null))[_0x7946('0x25')](saveUpdates(_0x47ff4[_0x7946('0x45')],null))[_0x7946('0x25')](respondWithResult(_0x17607c,null))[_0x7946('0x43')](handleError(_0x17607c,null));};exports['destroy']=function(_0x275ae,_0x2aa21f){return db[_0x7946('0x29')][_0x7946('0x44')]({'where':{'id':_0x275ae['params']['id']}})[_0x7946('0x25')](handleEntityNotFound(_0x2aa21f,null))['then'](removeEntity(_0x2aa21f,null))[_0x7946('0x43')](handleError(_0x2aa21f,null));};exports['create']=function(_0x3da80d,_0x26f45a){var _0x4491c3;return db['sequelize'][_0x7946('0x46')](function(_0x3b3f02){return db[_0x7946('0x29')][_0x7946('0x47')](_0x3da80d['body'],{'transaction':_0x3b3f02})[_0x7946('0x25')](function(_0x29de80){_0x4491c3=_0x29de80;var _0x49d075={'type':db[_0x7946('0x48')][_0x7946('0x49')],'transaction':_0x3b3f02};switch(_0x3da80d[_0x7946('0x45')][_0x7946('0x2b')]){case _0x7946('0x4a'):_0x49d075[_0x7946('0x2b')]=db[_0x7946('0x48')]['TEXT'];break;case _0x7946('0x4b'):_0x49d075['type']=db[_0x7946('0x48')][_0x7946('0x4c')];break;case _0x7946('0x4d'):_0x49d075['type']=db['Sequelize']['BOOLEAN'];_0x49d075['defaultValue']=![];break;default:}return db[_0x7946('0x4e')][_0x7946('0x4f')][_0x7946('0x50')](_0x7946('0x51'),util[_0x7946('0x52')]('cf_%d',_0x4491c3['id']),_0x49d075);})[_0x7946('0x25')](function(){return _0x4491c3;});})[_0x7946('0x25')](respondWithResult(_0x26f45a,0xc9))[_0x7946('0x43')](handleError(_0x26f45a,null));}; \ No newline at end of file +var _0x07aa=['body','find','create','TEXT','text','Sequelize','INTEGER','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','Content-Range','json','reject','then','destroy','end','error','name','send','map','CmCustomField','fieldName','type','differenceBy','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','include','catch','show','params','keys','rawAttributes','includeAll','merge','options','update'];(function(_0x287a4f,_0x210124){var _0x384858=function(_0x360bee){while(--_0x360bee){_0x287a4f['push'](_0x287a4f['shift']());}};_0x384858(++_0x210124);}(_0x07aa,0x112));var _0xa07a=function(_0x36b404,_0x2a6c3f){_0x36b404=_0x36b404-0x0;var _0x3139e2=_0x07aa[_0x36b404];return _0x3139e2;};'use strict';var emlformat=require(_0xa07a('0x0'));var rimraf=require(_0xa07a('0x1'));var zipdir=require(_0xa07a('0x2'));var jsonpatch=require(_0xa07a('0x3'));var rp=require(_0xa07a('0x4'));var moment=require(_0xa07a('0x5'));var BPromise=require(_0xa07a('0x6'));var Mustache=require(_0xa07a('0x7'));var util=require(_0xa07a('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xa07a('0x9'));var ejs=require(_0xa07a('0xa'));var fs=require('fs');var fs_extra=require(_0xa07a('0xb'));var _=require(_0xa07a('0xc'));var squel=require(_0xa07a('0xd'));var crypto=require(_0xa07a('0xe'));var jsforce=require(_0xa07a('0xf'));var deskjs=require(_0xa07a('0x10'));var toCsv=require(_0xa07a('0x9'));var querystring=require(_0xa07a('0x11'));var Papa=require(_0xa07a('0x12'));var Redis=require('ioredis');var authService=require(_0xa07a('0x13'));var qs=require(_0xa07a('0x14'));var as=require(_0xa07a('0x15'));var hardwareService=require(_0xa07a('0x16'));var logger=require(_0xa07a('0x17'))(_0xa07a('0x18'));var utils=require(_0xa07a('0x19'));var config=require(_0xa07a('0x1a'));var licenseUtil=require(_0xa07a('0x1b'));var db=require(_0xa07a('0x1c'))['db'];function respondWithStatusCode(_0x377339,_0x5de33a){_0x5de33a=_0x5de33a||0xcc;return function(_0x35f50b){if(_0x35f50b){return _0x377339[_0xa07a('0x1d')](_0x5de33a);}return _0x377339[_0xa07a('0x1e')](_0x5de33a)['end']();};}function respondWithResult(_0x264386,_0x48b09c){_0x48b09c=_0x48b09c||0xc8;return function(_0xccc20){if(_0xccc20){return _0x264386[_0xa07a('0x1e')](_0x48b09c)['json'](_0xccc20);}};}function respondWithFilteredResult(_0x18ccde,_0x58e5c1){return function(_0x3b57b5){if(_0x3b57b5){var _0x3e22dc=typeof _0x58e5c1[_0xa07a('0x1f')]===_0xa07a('0x20')&&typeof _0x58e5c1['limit']==='undefined';var _0x22a327=_0x3b57b5['count'];var _0x4a61ff=_0x3e22dc?0x0:_0x58e5c1['offset'];var _0x1ce42a=_0x3e22dc?_0x3b57b5[_0xa07a('0x21')]:_0x58e5c1[_0xa07a('0x1f')]+_0x58e5c1[_0xa07a('0x22')];var _0x13acad;if(_0x1ce42a>=_0x22a327){_0x1ce42a=_0x22a327;_0x13acad=0xc8;}else{_0x13acad=0xce;}_0x18ccde[_0xa07a('0x1e')](_0x13acad);return _0x18ccde['set'](_0xa07a('0x23'),_0x4a61ff+'-'+_0x1ce42a+'/'+_0x22a327)[_0xa07a('0x24')](_0x3b57b5);}return null;};}function patchUpdates(_0x40e995){return function(_0x1da14d){try{jsonpatch['apply'](_0x1da14d,_0x40e995,!![]);}catch(_0x424d1b){return BPromise[_0xa07a('0x25')](_0x424d1b);}return _0x1da14d['save']();};}function saveUpdates(_0x757554,_0x5a5aa3){return function(_0x39a12c){if(_0x39a12c){return _0x39a12c['update'](_0x757554)[_0xa07a('0x26')](function(_0x44d067){return _0x44d067;});}return null;};}function removeEntity(_0x4b537b,_0x431e58){return function(_0x54d70f){if(_0x54d70f){return _0x54d70f[_0xa07a('0x27')]()['then'](function(){_0x4b537b[_0xa07a('0x1e')](0xcc)[_0xa07a('0x28')]();});}};}function handleEntityNotFound(_0x562739,_0x212787){return function(_0xcd1412){if(!_0xcd1412){_0x562739[_0xa07a('0x1d')](0x194);}return _0xcd1412;};}function handleError(_0x42251e,_0x63abf4){_0x63abf4=_0x63abf4||0x1f4;return function(_0x1b7a6d){logger[_0xa07a('0x29')](_0x1b7a6d['stack']);if(_0x1b7a6d[_0xa07a('0x2a')]){delete _0x1b7a6d[_0xa07a('0x2a')];}_0x42251e['status'](_0x63abf4)[_0xa07a('0x2b')](_0x1b7a6d);};}exports['index']=function(_0x3ba58f,_0x570f97){var _0x4d7828={},_0x762ac1={},_0x226f4c={'count':0x0,'rows':[]};var _0x35f6a9=_[_0xa07a('0x2c')](db[_0xa07a('0x2d')]['rawAttributes'],function(_0x108e27){return{'name':_0x108e27[_0xa07a('0x2e')],'type':_0x108e27[_0xa07a('0x2f')]['key']};});_0x762ac1['model']=_[_0xa07a('0x30')](_[_0xa07a('0x2c')](_0x35f6a9,'name'),[_0xa07a('0x2a')]);_0x762ac1[_0xa07a('0x31')]=_['keys'](_0x3ba58f['query']);_0x762ac1[_0xa07a('0x32')]=_[_0xa07a('0x33')](_0x762ac1['model'],_0x762ac1[_0xa07a('0x31')]);_0x4d7828[_0xa07a('0x34')]=_['intersection'](_0x762ac1[_0xa07a('0x35')],qs[_0xa07a('0x36')](_0x3ba58f['query'][_0xa07a('0x36')]));_0x4d7828[_0xa07a('0x34')]=_0x4d7828[_0xa07a('0x34')][_0xa07a('0x37')]?_0x4d7828[_0xa07a('0x34')]:_0x762ac1[_0xa07a('0x35')];if(!_0x3ba58f[_0xa07a('0x31')][_0xa07a('0x38')](_0xa07a('0x39'))){_0x4d7828[_0xa07a('0x22')]=qs[_0xa07a('0x22')](_0x3ba58f[_0xa07a('0x31')]['limit']);_0x4d7828[_0xa07a('0x1f')]=qs[_0xa07a('0x1f')](_0x3ba58f[_0xa07a('0x31')][_0xa07a('0x1f')]);}_0x4d7828[_0xa07a('0x3a')]=qs['sort'](_0x3ba58f['query'][_0xa07a('0x3b')]);_0x4d7828[_0xa07a('0x3c')]=qs[_0xa07a('0x32')](_[_0xa07a('0x3d')](_0x3ba58f[_0xa07a('0x31')],_0x762ac1['filters']),_0x35f6a9);if(_0x3ba58f[_0xa07a('0x31')][_0xa07a('0x3e')]){_0x4d7828[_0xa07a('0x3c')]=_['merge'](_0x4d7828['where'],{'$or':_[_0xa07a('0x2c')](_0x35f6a9,function(_0xa3c2be){if(_0xa3c2be[_0xa07a('0x2f')]!==_0xa07a('0x3f')){var _0x5caeec={};_0x5caeec[_0xa3c2be['name']]={'$like':'%'+_0x3ba58f[_0xa07a('0x31')][_0xa07a('0x3e')]+'%'};return _0x5caeec;}})});}_0x4d7828=_['merge']({},_0x4d7828,_0x3ba58f['options']);var _0x2fc715={'where':_0x4d7828[_0xa07a('0x3c')]};return db['CmCustomField'][_0xa07a('0x21')](_0x2fc715)['then'](function(_0x383674){_0x226f4c[_0xa07a('0x21')]=_0x383674;if(_0x3ba58f[_0xa07a('0x31')]['includeAll']){_0x4d7828[_0xa07a('0x40')]=[{'all':!![]}];}return db[_0xa07a('0x2d')]['findAll'](_0x4d7828);})[_0xa07a('0x26')](function(_0x144d33){_0x226f4c['rows']=_0x144d33;return _0x226f4c;})[_0xa07a('0x26')](respondWithFilteredResult(_0x570f97,_0x4d7828))[_0xa07a('0x41')](handleError(_0x570f97,null));};exports[_0xa07a('0x42')]=function(_0x3d0421,_0x4e480a){var _0x43df41={'raw':!![],'where':{'id':_0x3d0421[_0xa07a('0x43')]['id']}},_0x3040a0={};_0x3040a0[_0xa07a('0x35')]=_[_0xa07a('0x44')](db[_0xa07a('0x2d')][_0xa07a('0x45')]);_0x3040a0[_0xa07a('0x31')]=_[_0xa07a('0x44')](_0x3d0421[_0xa07a('0x31')]);_0x3040a0['filters']=_[_0xa07a('0x33')](_0x3040a0[_0xa07a('0x35')],_0x3040a0['query']);_0x43df41['attributes']=_[_0xa07a('0x33')](_0x3040a0[_0xa07a('0x35')],qs['fields'](_0x3d0421['query']['fields']));_0x43df41[_0xa07a('0x34')]=_0x43df41[_0xa07a('0x34')][_0xa07a('0x37')]?_0x43df41[_0xa07a('0x34')]:_0x3040a0[_0xa07a('0x35')];if(_0x3d0421[_0xa07a('0x31')][_0xa07a('0x46')]){_0x43df41['include']=[{'all':!![]}];}_0x43df41=_[_0xa07a('0x47')]({},_0x43df41,_0x3d0421[_0xa07a('0x48')]);return db[_0xa07a('0x2d')]['find'](_0x43df41)[_0xa07a('0x26')](handleEntityNotFound(_0x4e480a,null))[_0xa07a('0x26')](respondWithResult(_0x4e480a,null))[_0xa07a('0x41')](handleError(_0x4e480a,null));};exports[_0xa07a('0x49')]=function(_0x47255b,_0x211f0d){if(_0x47255b[_0xa07a('0x4a')]['id']){delete _0x47255b[_0xa07a('0x4a')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x47255b[_0xa07a('0x43')]['id']}})[_0xa07a('0x26')](handleEntityNotFound(_0x211f0d,null))[_0xa07a('0x26')](saveUpdates(_0x47255b[_0xa07a('0x4a')],null))['then'](respondWithResult(_0x211f0d,null))[_0xa07a('0x41')](handleError(_0x211f0d,null));};exports[_0xa07a('0x27')]=function(_0x5139b8,_0xfd1ea1){return db[_0xa07a('0x2d')][_0xa07a('0x4b')]({'where':{'id':_0x5139b8[_0xa07a('0x43')]['id']}})[_0xa07a('0x26')](handleEntityNotFound(_0xfd1ea1,null))['then'](removeEntity(_0xfd1ea1,null))[_0xa07a('0x41')](handleError(_0xfd1ea1,null));};exports[_0xa07a('0x4c')]=function(_0x5b4e9a,_0x12c56a){var _0x5c0b17;return db['sequelize']['transaction'](function(_0xf6c2b3){return db[_0xa07a('0x2d')][_0xa07a('0x4c')](_0x5b4e9a[_0xa07a('0x4a')],{'transaction':_0xf6c2b3})[_0xa07a('0x26')](function(_0x18363f){_0x5c0b17=_0x18363f;var _0x155b7b={'type':db['Sequelize'][_0xa07a('0x4d')],'transaction':_0xf6c2b3};switch(_0x5b4e9a[_0xa07a('0x4a')][_0xa07a('0x2f')]){case _0xa07a('0x4e'):_0x155b7b[_0xa07a('0x2f')]=db[_0xa07a('0x4f')][_0xa07a('0x4d')];break;case'number':_0x155b7b[_0xa07a('0x2f')]=db['Sequelize'][_0xa07a('0x50')];break;case'switch':_0x155b7b[_0xa07a('0x2f')]=db[_0xa07a('0x4f')]['BOOLEAN'];_0x155b7b[_0xa07a('0x51')]=![];break;default:}return db['sequelize'][_0xa07a('0x52')][_0xa07a('0x53')](_0xa07a('0x54'),util[_0xa07a('0x55')](_0xa07a('0x56'),_0x5c0b17['id']),_0x155b7b);})[_0xa07a('0x26')](function(){return _0x5c0b17;});})['then'](respondWithResult(_0x12c56a,0xc9))[_0xa07a('0x41')](handleError(_0x12c56a,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 58c1ac2..3cdb727 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 _0x9615=['rimraf','./cmCustomField.attributes','exports','define','CmCustomField','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x9615,0x10d));var _0x5961=function(_0x5c4047,_0x56882b){_0x5c4047=_0x5c4047-0x0;var _0x5108c9=_0x9615[_0x5c4047];return _0x5108c9;};'use strict';var _=require(_0x5961('0x0'));var util=require(_0x5961('0x1'));var logger=require(_0x5961('0x2'))('api');var moment=require(_0x5961('0x3'));var BPromise=require(_0x5961('0x4'));var rp=require(_0x5961('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5961('0x6'));var config=require('../../config/environment');var attributes=require(_0x5961('0x7'));module[_0x5961('0x8')]=function(_0x504d46,_0x10312e){return _0x504d46[_0x5961('0x9')](_0x5961('0xa'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9487=['util','api','path','../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields'];(function(_0x1fc19f,_0x5cb582){var _0x3a8412=function(_0xfbda6){while(--_0xfbda6){_0x1fc19f['push'](_0x1fc19f['shift']());}};_0x3a8412(++_0x5cb582);}(_0x9487,0x70));var _0x7948=function(_0x1493cb,_0x5711f1){_0x1493cb=_0x1493cb-0x0;var _0x3a6357=_0x9487[_0x1493cb];return _0x3a6357;};'use strict';var _=require('lodash');var util=require(_0x7948('0x0'));var logger=require('../../config/logger')(_0x7948('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7948('0x2'));var rimraf=require('rimraf');var config=require(_0x7948('0x3'));var attributes=require(_0x7948('0x4'));module[_0x7948('0x5')]=function(_0x3aecb7,_0x54be77){return _0x3aecb7['define'](_0x7948('0x6'),attributes,{'tableName':_0x7948('0x7'),'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 18bd3f6..98eedcf 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 _0xd88f=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x400cdf,_0x1f5dcf){var _0x46120d=function(_0x44ee51){while(--_0x44ee51){_0x400cdf['push'](_0x400cdf['shift']());}};_0x46120d(++_0x1f5dcf);}(_0xd88f,0x1e3));var _0xfd88=function(_0x33080e,_0x1c600a){_0x33080e=_0x33080e-0x0;var _0x407395=_0xd88f[_0x33080e];return _0x407395;};'use strict';var _=require(_0xfd88('0x0'));var util=require(_0xfd88('0x1'));var moment=require(_0xfd88('0x2'));var BPromise=require(_0xfd88('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd88('0x4'));var db=require(_0xfd88('0x5'))['db'];var utils=require(_0xfd88('0x6'));var logger=require(_0xfd88('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfd88('0x8')][_0xfd88('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf115c3,_0x214667,_0x667eb){return new BPromise(function(_0x38841e,_0x152dc9){return client[_0xfd88('0xa')](_0xf115c3,_0x667eb)[_0xfd88('0xb')](function(_0x4072ea){logger[_0xfd88('0xc')](_0xfd88('0xd'),_0x214667,_0xfd88('0xe'));logger['debug'](_0xfd88('0xf'),_0x214667,'request\x20sent',JSON[_0xfd88('0x10')](_0x4072ea));if(_0x4072ea[_0xfd88('0x11')]){if(_0x4072ea[_0xfd88('0x11')][_0xfd88('0x12')]===0x1f4){logger[_0xfd88('0x11')](_0xfd88('0xd'),_0x214667,_0x4072ea[_0xfd88('0x11')][_0xfd88('0x13')]);return _0x152dc9(_0x4072ea[_0xfd88('0x11')][_0xfd88('0x13')]);}logger[_0xfd88('0x11')](_0xfd88('0xd'),_0x214667,_0x4072ea[_0xfd88('0x11')]['message']);return _0x38841e(_0x4072ea[_0xfd88('0x11')][_0xfd88('0x13')]);}else{logger[_0xfd88('0xc')](_0xfd88('0xd'),_0x214667,_0xfd88('0xe'));_0x38841e(_0x4072ea[_0xfd88('0x14')][_0xfd88('0x13')]);}})[_0xfd88('0x15')](function(_0x4942b0){logger[_0xfd88('0x11')](_0xfd88('0xd'),_0x214667,_0x4942b0);_0x152dc9(_0x4942b0);});});} \ No newline at end of file +var _0x9481=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmCustomField,\x20%s,\x20%s'];(function(_0x4e3e87,_0x23a5b7){var _0xae6d5f=function(_0x5b014e){while(--_0x5b014e){_0x4e3e87['push'](_0x4e3e87['shift']());}};_0xae6d5f(++_0x23a5b7);}(_0x9481,0xe4));var _0x1948=function(_0x3fa0d9,_0x4041d8){_0x3fa0d9=_0x3fa0d9-0x0;var _0x468716=_0x9481[_0x3fa0d9];return _0x468716;};'use strict';var _=require(_0x1948('0x0'));var util=require(_0x1948('0x1'));var moment=require(_0x1948('0x2'));var BPromise=require(_0x1948('0x3'));var rs=require(_0x1948('0x4'));var fs=require('fs');var Redis=require(_0x1948('0x5'));var db=require(_0x1948('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1948('0x7'))(_0x1948('0x8'));var config=require(_0x1948('0x9'));var jayson=require(_0x1948('0xa'));var client=jayson['client'][_0x1948('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26e952,_0x1f52d2,_0x135c36){return new BPromise(function(_0x377730,_0x26d21a){return client[_0x1948('0xc')](_0x26e952,_0x135c36)[_0x1948('0xd')](function(_0x26bd89){logger[_0x1948('0xe')]('CmCustomField,\x20%s,\x20%s',_0x1f52d2,'request\x20sent');logger[_0x1948('0xf')](_0x1948('0x10'),_0x1f52d2,_0x1948('0x11'),JSON[_0x1948('0x12')](_0x26bd89));if(_0x26bd89[_0x1948('0x13')]){if(_0x26bd89[_0x1948('0x13')][_0x1948('0x14')]===0x1f4){logger[_0x1948('0x13')](_0x1948('0x15'),_0x1f52d2,_0x26bd89[_0x1948('0x13')][_0x1948('0x16')]);return _0x26d21a(_0x26bd89[_0x1948('0x13')]['message']);}logger[_0x1948('0x13')](_0x1948('0x15'),_0x1f52d2,_0x26bd89[_0x1948('0x13')][_0x1948('0x16')]);return _0x377730(_0x26bd89[_0x1948('0x13')][_0x1948('0x16')]);}else{logger[_0x1948('0xe')](_0x1948('0x15'),_0x1f52d2,'request\x20sent');_0x377730(_0x26bd89[_0x1948('0x17')]['message']);}})[_0x1948('0x18')](function(_0x1fa523){logger[_0x1948('0x13')](_0x1948('0x15'),_0x1f52d2,_0x1fa523);_0x26d21a(_0x1fa523);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 218a7de..a5eefbf 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 _0xb7a8=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','util','path'];(function(_0x5e509a,_0xaf5ac4){var _0x1b33ad=function(_0x49e726){while(--_0x49e726){_0x5e509a['push'](_0x5e509a['shift']());}};_0x1b33ad(++_0xaf5ac4);}(_0xb7a8,0xec));var _0x8b7a=function(_0x4f5274,_0x240b1a){_0x4f5274=_0x4f5274-0x0;var _0x44afa1=_0xb7a8[_0x4f5274];return _0x44afa1;};'use strict';var multer=require('multer');var util=require(_0x8b7a('0x0'));var path=require(_0x8b7a('0x1'));var timeout=require('connect-timeout');var express=require(_0x8b7a('0x2'));var router=express[_0x8b7a('0x3')]();var fs_extra=require(_0x8b7a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8b7a('0x5'));var config=require(_0x8b7a('0x6'));var controller=require(_0x8b7a('0x7'));router[_0x8b7a('0x8')]('/',auth[_0x8b7a('0x9')](),controller[_0x8b7a('0xa')]);router[_0x8b7a('0x8')](_0x8b7a('0xb'),auth[_0x8b7a('0x9')](),controller[_0x8b7a('0xc')]);router[_0x8b7a('0xd')]('/',auth[_0x8b7a('0x9')](),controller['create']);router[_0x8b7a('0xe')]('/:id',auth[_0x8b7a('0x9')](),controller[_0x8b7a('0xf')]);router['delete'](_0x8b7a('0xb'),auth[_0x8b7a('0x9')](),controller[_0x8b7a('0x10')]);module['exports']=router; \ No newline at end of file +var _0xf494=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','exports','multer','util','path','express','Router','fs-extra'];(function(_0x4fbb15,_0x21be0c){var _0x436338=function(_0x3b5a05){while(--_0x3b5a05){_0x4fbb15['push'](_0x4fbb15['shift']());}};_0x436338(++_0x21be0c);}(_0xf494,0x1c6));var _0x4f49=function(_0x520c13,_0x567205){_0x520c13=_0x520c13-0x0;var _0xb4c009=_0xf494[_0x520c13];return _0xb4c009;};'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')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xe')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0x10')](_0x4f49('0x11'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x12')]);router['delete'](_0x4f49('0x11'),auth[_0x4f49('0xb')](),controller['destroy']);module[_0x4f49('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 3f08d3d..55981b1 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 _0x9b88=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN'];(function(_0x553997,_0x46f7ac){var _0x425cad=function(_0x3abfe1){while(--_0x3abfe1){_0x553997['push'](_0x553997['shift']());}};_0x425cad(++_0x46f7ac);}(_0x9b88,0x8a));var _0x89b8=function(_0xfefdd1,_0x24c906){_0xfefdd1=_0xfefdd1-0x0;var _0x14b117=_0x9b88[_0xfefdd1];return _0x14b117;};'use strict';var moment=require(_0x89b8('0x0'));var Sequelize=require(_0x89b8('0x1'));module[_0x89b8('0x2')]={'phone':{'type':Sequelize[_0x89b8('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x89b8('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x89b8('0x5')],'defaultValue':moment()[_0x89b8('0x6')](_0x89b8('0x7'))},'countbusyretry':{'type':Sequelize[_0x89b8('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x89b8('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x89b8('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x89b8('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x89b8('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x89b8('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x89b8('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x89b8('0x8')],'unique':_0x89b8('0xa')},'ListId':{'type':Sequelize[_0x89b8('0x8')],'unique':_0x89b8('0xa')},'UserId':{'type':Sequelize[_0x89b8('0x8')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x89b8('0x8')]},'countnosuchnumberretry':{'type':Sequelize[_0x89b8('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x89b8('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x89b8('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x89b8('0x8')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x89b8('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0x89b8('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x40e2=['BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','contactListQueue','moment','STRING'];(function(_0x125fde,_0x305989){var _0x1744f1=function(_0x29200a){while(--_0x29200a){_0x125fde['push'](_0x125fde['shift']());}};_0x1744f1(++_0x305989);}(_0x40e2,0xfe));var _0x240e=function(_0x287006,_0x1142de){_0x287006=_0x287006-0x0;var _0x3e1a27=_0x40e2[_0x287006];return _0x3e1a27;};'use strict';var moment=require(_0x240e('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x240e('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x240e('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x240e('0x3')](_0x240e('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x240e('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x240e('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x240e('0x6')]},'priority':{'type':Sequelize[_0x240e('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x240e('0x5')],'unique':_0x240e('0x7')},'ListId':{'type':Sequelize[_0x240e('0x5')],'unique':_0x240e('0x7')},'UserId':{'type':Sequelize[_0x240e('0x5')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x240e('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x240e('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x240e('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x240e('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x240e('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x240e('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x240e('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0x240e('0x6')],'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 3f74e9c..d9623ab 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 _0x1b20=['$ne','$not','$between','$notBetween','$in','$like','$iLike','$notILike','$overlap','$any','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','then','rows','show','params','find','catch','create','body','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','updatedAt','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','ivr','CmContact','firstName','isNil','lastName','calleridname','finally','CmHopperAdditionalPhone','end','getPreview','keys','outbound','preview','dialOrderByScheduledAt','transaction','dialPreviewAutoRecallMe','direction','prev','priority','scheduledAt','DESC','ASC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','hopperIds','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','phone','LOCK','UPDATE','Contact','CmCompany','Company','VoiceQueue','Queue','dialActive','recallme','CmList','List','getOpenContacts','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getTimezones','timezones','utcOffset','getTimezone','lodash','../../components/parsers/qs','../../config/environment','../../mysqldb','status','json','offset','limit','count','Content-Range','update','sendStatus','error','stack','send','map','CmHopper','rawAttributes','fieldName','key','name','query','filters','intersection','model','concat','$or','$gt','$gte','$lt','$lte'];(function(_0x365c4c,_0x3fbe03){var _0x49b766=function(_0x376727){while(--_0x376727){_0x365c4c['push'](_0x365c4c['shift']());}};_0x49b766(++_0x3fbe03);}(_0x1b20,0x66));var _0x01b2=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1b20[_0x502c7d];return _0x30b7ed;};'use strict';var moment=require('moment');var _=require(_0x01b2('0x0'));var qs=require(_0x01b2('0x1'));var logger=require('../../config/logger')('api');var shared=require(_0x01b2('0x2'));var db=require(_0x01b2('0x3'))['db'];function respondWithResult(_0x2d6e99,_0x1150fc){_0x1150fc=_0x1150fc||0xc8;return function(_0x1cf757){if(_0x1cf757){return _0x2d6e99[_0x01b2('0x4')](_0x1150fc)[_0x01b2('0x5')](_0x1cf757);}};}function respondWithFilteredResult(_0x28de4a,_0x46e745){return function(_0xa64ad1){if(_0xa64ad1){var _0x43d561=typeof _0x46e745[_0x01b2('0x6')]==='undefined'&&typeof _0x46e745[_0x01b2('0x7')]==='undefined';var _0x2e975d=_0xa64ad1[_0x01b2('0x8')];var _0x3bad99=_0x43d561?0x0:_0x46e745[_0x01b2('0x6')];var _0x9c411f=_0x43d561?_0xa64ad1[_0x01b2('0x8')]:_0x46e745[_0x01b2('0x6')]+_0x46e745[_0x01b2('0x7')];var _0x55804c;if(_0x9c411f>=_0x2e975d){_0x9c411f=_0x2e975d;_0x55804c=0xc8;}else{_0x55804c=0xce;}_0x28de4a[_0x01b2('0x4')](_0x55804c);return _0x28de4a['set'](_0x01b2('0x9'),_0x3bad99+'-'+_0x9c411f+'/'+_0x2e975d)['json'](_0xa64ad1);}return null;};}function saveUpdates(_0x41a618,_0x8ac569){return function(_0x2c6d4d){if(_0x2c6d4d){return _0x2c6d4d[_0x01b2('0xa')](_0x41a618)['then'](function(_0x2f97d1){return _0x2f97d1;});}return null;};}function handleEntityNotFound(_0x2e7b31,_0x4f1c15){return function(_0x1626ba){if(!_0x1626ba){_0x2e7b31[_0x01b2('0xb')](0x194);}return _0x1626ba;};}function handleError(_0x5a36de,_0x299d0c){_0x299d0c=_0x299d0c||0x1f4;return function(_0x3d5833){logger[_0x01b2('0xc')](_0x3d5833[_0x01b2('0xd')]);if(_0x3d5833['name']){delete _0x3d5833['name'];}_0x5a36de[_0x01b2('0x4')](_0x299d0c)[_0x01b2('0xe')](_0x3d5833);};}exports['index']=function(_0x1eafc4,_0x444236){var _0x27a0bc={},_0x5986f5={},_0x25c55f={'count':0x0,'rows':[]};var _0x9f182b=_[_0x01b2('0xf')](db[_0x01b2('0x10')][_0x01b2('0x11')],function(_0x56ea3c){return{'name':_0x56ea3c[_0x01b2('0x12')],'type':_0x56ea3c['type'][_0x01b2('0x13')]};});_0x5986f5['model']=_[_0x01b2('0xf')](_0x9f182b,_0x01b2('0x14'));_0x5986f5[_0x01b2('0x15')]=_['keys'](_0x1eafc4[_0x01b2('0x15')]);_0x5986f5[_0x01b2('0x16')]=_[_0x01b2('0x17')](_0x5986f5[_0x01b2('0x18')],_0x5986f5[_0x01b2('0x15')]);_0x5986f5['filters']=_[_0x01b2('0x19')](_0x5986f5['filters'],['$and',_0x01b2('0x1a'),_0x01b2('0x1b'),_0x01b2('0x1c'),_0x01b2('0x1d'),_0x01b2('0x1e'),_0x01b2('0x1f'),'$eq',_0x01b2('0x20'),_0x01b2('0x21'),_0x01b2('0x22'),_0x01b2('0x23'),'$notIn',_0x01b2('0x24'),'$notLike',_0x01b2('0x25'),_0x01b2('0x26'),'$like',_0x01b2('0x27'),'$contains','$contained',_0x01b2('0x28')]);_0x27a0bc[_0x01b2('0x29')]=_['intersection'](_0x5986f5[_0x01b2('0x18')],qs[_0x01b2('0x2a')](_0x1eafc4[_0x01b2('0x15')][_0x01b2('0x2a')]));_0x27a0bc[_0x01b2('0x29')]=_0x27a0bc[_0x01b2('0x29')][_0x01b2('0x2b')]?_0x27a0bc[_0x01b2('0x29')]:_0x5986f5[_0x01b2('0x18')];if(!_0x1eafc4[_0x01b2('0x15')][_0x01b2('0x2c')]('nolimit')){_0x27a0bc[_0x01b2('0x7')]=qs[_0x01b2('0x7')](_0x1eafc4[_0x01b2('0x15')][_0x01b2('0x7')]);_0x27a0bc[_0x01b2('0x6')]=qs[_0x01b2('0x6')](_0x1eafc4['query']['offset']);}_0x27a0bc[_0x01b2('0x2d')]=qs['sort'](_0x1eafc4['query'][_0x01b2('0x2e')]);_0x27a0bc[_0x01b2('0x2f')]=qs[_0x01b2('0x16')](_[_0x01b2('0x30')](_0x1eafc4['query'],_0x5986f5[_0x01b2('0x16')]),_0x9f182b);if(_0x1eafc4['query'][_0x01b2('0x31')]){_0x27a0bc['where']=_['merge'](_0x27a0bc['where'],{'$or':_[_0x01b2('0xf')](_0x9f182b,function(_0x29532e){if(_0x29532e[_0x01b2('0x32')]!==_0x01b2('0x33')){var _0x4d80d0={};_0x4d80d0[_0x29532e[_0x01b2('0x14')]]={'$like':'%'+_0x1eafc4[_0x01b2('0x15')]['filter']+'%'};return _0x4d80d0;}})});}_0x27a0bc=_[_0x01b2('0x34')]({},_0x27a0bc,_0x1eafc4[_0x01b2('0x35')]);var _0x13dbb4={'where':_0x27a0bc[_0x01b2('0x2f')]};return db[_0x01b2('0x10')][_0x01b2('0x8')](_0x13dbb4)['then'](function(_0x2fb530){_0x25c55f[_0x01b2('0x8')]=_0x2fb530;if(_0x1eafc4['query']['includeAll']){_0x27a0bc[_0x01b2('0x36')]=[{'all':!![]}];}return db[_0x01b2('0x10')][_0x01b2('0x37')](_0x27a0bc);})[_0x01b2('0x38')](function(_0x34fdb2){_0x25c55f[_0x01b2('0x39')]=_0x34fdb2;return _0x25c55f;})['then'](respondWithFilteredResult(_0x444236,_0x27a0bc))['catch'](handleError(_0x444236,null));};exports[_0x01b2('0x3a')]=function(_0x4ba89b,_0xbd7259){var _0x31878={'raw':!![],'where':{'id':_0x4ba89b[_0x01b2('0x3b')]['id']}},_0x1a1e3b={};_0x1a1e3b[_0x01b2('0x18')]=_['keys'](db[_0x01b2('0x10')][_0x01b2('0x11')]);_0x1a1e3b[_0x01b2('0x15')]=_['keys'](_0x4ba89b[_0x01b2('0x15')]);_0x1a1e3b[_0x01b2('0x16')]=_[_0x01b2('0x17')](_0x1a1e3b['model'],_0x1a1e3b[_0x01b2('0x15')]);_0x31878['attributes']=_[_0x01b2('0x17')](_0x1a1e3b[_0x01b2('0x18')],qs['fields'](_0x4ba89b[_0x01b2('0x15')][_0x01b2('0x2a')]));_0x31878['attributes']=_0x31878[_0x01b2('0x29')][_0x01b2('0x2b')]?_0x31878[_0x01b2('0x29')]:_0x1a1e3b[_0x01b2('0x18')];if(_0x4ba89b[_0x01b2('0x15')]['includeAll']){_0x31878[_0x01b2('0x36')]=[{'all':!![]}];}_0x31878=_[_0x01b2('0x34')]({},_0x31878,_0x4ba89b[_0x01b2('0x35')]);return db['CmHopper'][_0x01b2('0x3c')](_0x31878)[_0x01b2('0x38')](handleEntityNotFound(_0xbd7259,null))[_0x01b2('0x38')](respondWithResult(_0xbd7259,null))[_0x01b2('0x3d')](handleError(_0xbd7259,null));};exports[_0x01b2('0x3e')]=function(_0x3f9451,_0x3eda44){return db[_0x01b2('0x10')]['create'](_0x3f9451[_0x01b2('0x3f')],{})[_0x01b2('0x38')](respondWithResult(_0x3eda44,0xc9))[_0x01b2('0x3d')](handleError(_0x3eda44,null));};exports[_0x01b2('0xa')]=function(_0xf36d42,_0x3469b3){if(_0xf36d42[_0x01b2('0x3f')]['id']){delete _0xf36d42['body']['id'];}return db[_0x01b2('0x10')][_0x01b2('0x3c')]({'where':{'id':_0xf36d42[_0x01b2('0x3b')]['id']}})[_0x01b2('0x38')](handleEntityNotFound(_0x3469b3,null))['then'](saveUpdates(_0xf36d42['body'],null))[_0x01b2('0x38')](respondWithResult(_0x3469b3,null))[_0x01b2('0x3d')](handleError(_0x3469b3,null));};exports[_0x01b2('0x40')]=function(_0x49370d,_0x7a6cae){return db[_0x01b2('0x10')][_0x01b2('0x40')]()[_0x01b2('0x38')](respondWithResult(_0x7a6cae,null))[_0x01b2('0x3d')](handleError(_0x7a6cae,null));};exports[_0x01b2('0x41')]=function(_0x5b54c5,_0x2a8b8d){var _0x5e0e70;var _0x272d0d=_0x5b54c5['params']['id'];return db['CmHopper'][_0x01b2('0x3c')]({'where':{'id':_0x5b54c5[_0x01b2('0x3b')]['id']}})[_0x01b2('0x38')](handleEntityNotFound(_0x2a8b8d,null))[_0x01b2('0x38')](function(_0x20cc59){if(_0x20cc59){return _0x20cc59['destroy']()['then'](function(_0x387954){return _0x387954;});}})[_0x01b2('0x38')](function(_0x3ee05b){_0x5e0e70=_0x3ee05b;if(_0x3ee05b){if(_0x3ee05b[_0x01b2('0x42')]||_0x3ee05b[_0x01b2('0x43')]){return db[_0x3ee05b[_0x01b2('0x42')]?'VoiceQueue':_0x01b2('0x44')][_0x01b2('0x3c')]({'where':{'id':_0x3ee05b[_0x01b2('0x42')]?_0x3ee05b[_0x01b2('0x42')]:_0x3ee05b[_0x01b2('0x43')]},'attributes':['id',_0x01b2('0x14')],'raw':!![]});}}})[_0x01b2('0x38')](function(_0x5dcafc){var _0x445fb2={};if(_0x5dcafc){_[_0x01b2('0x34')](_0x445fb2,_[_0x01b2('0x45')](_0x5e0e70[_0x01b2('0x46')],[_0x01b2('0x47'),_0x01b2('0x48'),'id']));_0x445fb2['state']=0x15;_0x445fb2[_0x01b2('0x49')]=_0x01b2('0x4a');_0x445fb2[_0x01b2('0x4b')]=_0x5dcafc[_0x01b2('0x14')];_0x445fb2[_0x01b2('0x4c')]=_0x5b54c5[_0x01b2('0x4d')][_0x01b2('0x14')];_0x445fb2[_0x01b2('0x4e')]=_0x5b54c5[_0x01b2('0x4d')]['id'];_0x445fb2[_0x01b2('0x4a')]=!![];_0x445fb2[_0x01b2('0x4f')]=moment()[_0x01b2('0x50')](_0x01b2('0x51'));_0x445fb2[_0x01b2('0x52')]=_0x5e0e70['phone'];_0x445fb2['campaigntype']=_0x5e0e70['VoiceQueueId']?'queue':_0x01b2('0x53');return db[_0x01b2('0x54')][_0x01b2('0x3c')]({'where':{'id':_0x445fb2['ContactId']},'attributes':[_0x01b2('0x55'),'lastName']})[_0x01b2('0x38')](function(_0x32371b){if(!_[_0x01b2('0x56')](_0x2a8b8d)&&!_[_0x01b2('0x56')](_0x32371b[_0x01b2('0x55')])){_0x445fb2['calleridname']=_0x32371b[_0x01b2('0x55')];if(!_['isNil'](_0x32371b[_0x01b2('0x57')])){_0x445fb2[_0x01b2('0x58')]+='\x20'+_0x32371b['lastName'];}}})[_0x01b2('0x59')](function(){return db['CmHopperFinal'][_0x01b2('0x3e')](_0x445fb2);});}})[_0x01b2('0x38')](function(_0x42c5b8){return db[_0x01b2('0x5a')][_0x01b2('0x41')]({'where':{'CmHopperId':_0x272d0d}});})[_0x01b2('0x38')](function(){return _0x2a8b8d[_0x01b2('0x4')](0xcc)[_0x01b2('0x5b')]();})[_0x01b2('0x3d')](handleError(_0x2a8b8d,null));};exports[_0x01b2('0x5c')]=function(_0x5d7da3,_0x2eb448){var _0x5655b6=[];return db[_0x01b2('0x54')][_0x01b2('0x40')]()[_0x01b2('0x38')](function(_0x58c8de){_0x5655b6=_[_0x01b2('0x5d')](_0x58c8de);return _0x5d7da3['user']['getVoiceQueues']({'where':{'type':_0x01b2('0x5e'),'dialActive':!![],'dialMethod':_0x01b2('0x5f')},'attributes':['id',_0x01b2('0x60'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x01b2('0x38')](function(_0x330cb4){if(_0x330cb4&&_0x330cb4[_0x01b2('0x2b')]){return db['sequelize'][_0x01b2('0x61')](function(_0x429b89){var _0xcbef9c={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x01b2('0x50')](_0x01b2('0x51'))},'VoiceQueueId':{'$in':_[_0x01b2('0xf')](_0x330cb4,'id')},'$or':[{'UserId':null},{'UserId':_0x5d7da3[_0x01b2('0x4d')]['id']}]};var _0x56c794={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x330cb4)['filter']([_0x01b2('0x62'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x5d7da3[_0x01b2('0x4d')]['id']}]};var _0x4ca277={'$or':[_0xcbef9c,_0x56c794]};var _0xbe104b=[];if(_0x5d7da3['body'][_0x01b2('0x63')]&&_0x5d7da3[_0x01b2('0x3f')][_0x01b2('0x63')]===_0x01b2('0x64')){if(!_['isEmpty'](_0x5d7da3[_0x01b2('0x3f')]['hopperIds'])){_0x4ca277['id']={'$in':_0x5d7da3[_0x01b2('0x3f')]['hopperIds']};}_0xbe104b=[[_0x01b2('0x65'),'ASC'],[_0x01b2('0x66'),_0x330cb4[0x0][_0x01b2('0x60')]==='ASC'?_0x01b2('0x67'):_0x01b2('0x68')],db[_0x01b2('0x69')][_0x01b2('0x6a')](_0x01b2('0x6b')),['id',_0x01b2('0x67')]];}else{if(!_[_0x01b2('0x6c')](_0x5d7da3[_0x01b2('0x3f')][_0x01b2('0x6d')])){_0x4ca277['id']={'$notIn':_0x5d7da3[_0x01b2('0x3f')][_0x01b2('0x6d')]};}_0xbe104b=[[_0x01b2('0x65'),_0x01b2('0x67')],['scheduledAt',_0x330cb4[0x0]['dialOrderByScheduledAt']],db[_0x01b2('0x69')][_0x01b2('0x6a')](_0x01b2('0x6e')),['id',_0x01b2('0x68')]];}return db[_0x01b2('0x10')][_0x01b2('0x6f')]({'attributes':['id',_0x01b2('0x70'),_0x01b2('0x71'),'recallme'],'where':_0x4ca277,'order':_0xbe104b,'transaction':_0x429b89,'lock':_0x429b89[_0x01b2('0x72')][_0x01b2('0x73')],'include':[{'model':db[_0x01b2('0x54')],'as':_0x01b2('0x74'),'attributes':_0x5655b6,'include':[{'model':db[_0x01b2('0x75')],'as':_0x01b2('0x76'),'attributes':['id',_0x01b2('0x14')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x01b2('0x14')]},{'model':db[_0x01b2('0x77')],'as':_0x01b2('0x78'),'attributes':['id','name',_0x01b2('0x79')]}]})[_0x01b2('0x38')](function(_0x240558){if(_0x240558){return _0x240558['update']({'UserId':_0x5d7da3[_0x01b2('0x4d')]['id']},{'transaction':_0x429b89});}});});}})[_0x01b2('0x38')](handleEntityNotFound(_0x2eb448,null))[_0x01b2('0x38')](respondWithResult(_0x2eb448,null))['catch'](handleError(_0x2eb448,null));};exports['getPreviewRecall']=function(_0x2a820d,_0x4f1d6a,_0x1e1155){var _0x10d19f=[];var _0x2f41b6=_0x2a820d[_0x01b2('0x3b')]['id'];var _0x19a417=_0x2a820d[_0x01b2('0x4d')]['id'];return db['CmContact'][_0x01b2('0x40')]()[_0x01b2('0x38')](function(_0x45caa2){_0x10d19f=_[_0x01b2('0x5d')](_0x45caa2);return db[_0x01b2('0x69')][_0x01b2('0x61')](function(_0x5038b2){const _0x12f5ed={'id':_0x2f41b6};return db[_0x01b2('0x10')][_0x01b2('0x6f')]({'attributes':['id',_0x01b2('0x70'),_0x01b2('0x7a')],'where':_0x12f5ed,'transaction':_0x5038b2,'lock':_0x5038b2[_0x01b2('0x72')]['UPDATE'],'include':[{'model':db[_0x01b2('0x54')],'as':'Contact','attributes':_0x10d19f,'include':[{'model':db[_0x01b2('0x75')],'as':'Company','attributes':['id','name']}]},{'model':db[_0x01b2('0x7b')],'as':_0x01b2('0x7c'),'attributes':['id','name']},{'model':db[_0x01b2('0x77')],'as':_0x01b2('0x78'),'attributes':['id',_0x01b2('0x14'),_0x01b2('0x79')]}]})['then'](function(_0x4095c2){if(_0x4095c2){return _0x4095c2[_0x01b2('0xa')]({'UserId':_0x19a417},{'transaction':_0x5038b2});}});});})[_0x01b2('0x38')](handleEntityNotFound(_0x4f1d6a,null))[_0x01b2('0x38')](respondWithResult(_0x4f1d6a,null))[_0x01b2('0x3d')](handleError(_0x4f1d6a,null));};exports[_0x01b2('0x7d')]=function(_0x27de72,_0x44034b){return _0x27de72[_0x01b2('0x4d')][_0x01b2('0x7e')]({'where':{'type':_0x01b2('0x5e'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x01b2('0x38')](function(_0x3e17c3){if(_0x3e17c3&&_0x3e17c3[_0x01b2('0x2b')]){return db[_0x01b2('0x10')][_0x01b2('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x01b2('0x50')](_0x01b2('0x51'))},'VoiceQueueId':{'$in':_[_0x01b2('0xf')](_0x3e17c3,'id')},'$or':[{'UserId':null},{'UserId':_0x27de72['user']['id']}]}});}return 0x0;})['then'](function(_0xd37088){if(!_[_0x01b2('0x56')](_0xd37088)&&_[_0x01b2('0x7f')](_0xd37088)){return _0x44034b[_0x01b2('0x4')](0xc8)[_0x01b2('0x5')]({'contacts':_0xd37088});}else{logger[_0x01b2('0xc')](_0x01b2('0x80'),_0x01b2('0x7d'),0x194,'entity\x20not\x20found');_0x44034b[_0x01b2('0xb')](0x194);}})[_0x01b2('0x3d')](handleError(_0x44034b,null));};exports[_0x01b2('0x81')]=function(_0x54ccc5,_0x24f9d4){var _0x2dec32=shared[_0x01b2('0x82')];var _0x35aef9=[];_['map'](_0x2dec32,function(_0x5b8abf){_0x35aef9['push']({'id':_0x5b8abf[_0x01b2('0x14')],'name':_0x5b8abf['name'],'utcOffset':_0x5b8abf[_0x01b2('0x83')]});});return _0x24f9d4[_0x01b2('0x4')](0xc8)[_0x01b2('0x5')]({'tz':_0x35aef9});};exports[_0x01b2('0x84')]=function(_0x176ef,_0x372585){var _0x46e1ef=shared[_0x01b2('0x82')];var _0x3fb15f={};if(!_[_0x01b2('0x56')](_0x46e1ef[_0x176ef['body']['id']]))_0x3fb15f=_0x46e1ef[_0x176ef[_0x01b2('0x3f')]['id']];return _0x372585[_0x01b2('0x4')](0xc8)[_0x01b2('0x5')](_0x3fb15f);}; \ No newline at end of file +var _0x9335=['outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','recallme','UPDATE','Contact','CmCompany','Company','CmList','List','getPreviewRecall','Queue','dialActive','getOpenContacts','isNil','isNumber','entity\x20not\x20found','getTimezones','timezones','utcOffset','getTimezone','moment','lodash','../../config/logger','api','../../config/environment','../../mysqldb','json','offset','limit','undefined','count','status','set','update','sendStatus','error','stack','name','send','index','map','CmHopper','fieldName','type','model','keys','filters','concat','$and','$gte','$lt','$lte','$eq','$not','$between','$in','$notIn','$notLike','$iLike','$like','$contains','$contained','$any','intersection','fields','query','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','then','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','dataValues','updatedAt','state','statedesc','deleted','campaign','user','UserId','format','calleridnum','phone','campaigntype','ContactId','firstName','lastName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','CmContact','getVoiceQueues'];(function(_0x5a91d0,_0x3450e7){var _0x3e7d07=function(_0x2b6729){while(--_0x2b6729){_0x5a91d0['push'](_0x5a91d0['shift']());}};_0x3e7d07(++_0x3450e7);}(_0x9335,0xab));var _0x5933=function(_0x5841f6,_0x33cdf9){_0x5841f6=_0x5841f6-0x0;var _0x57e7f9=_0x9335[_0x5841f6];return _0x57e7f9;};'use strict';var moment=require(_0x5933('0x0'));var _=require(_0x5933('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x5933('0x2'))(_0x5933('0x3'));var shared=require(_0x5933('0x4'));var db=require(_0x5933('0x5'))['db'];function respondWithResult(_0x934663,_0xc3fbd1){_0xc3fbd1=_0xc3fbd1||0xc8;return function(_0x310370){if(_0x310370){return _0x934663['status'](_0xc3fbd1)[_0x5933('0x6')](_0x310370);}};}function respondWithFilteredResult(_0x4de024,_0x553710){return function(_0x21f4c1){if(_0x21f4c1){var _0x3f15fc=typeof _0x553710[_0x5933('0x7')]==='undefined'&&typeof _0x553710[_0x5933('0x8')]===_0x5933('0x9');var _0x412540=_0x21f4c1[_0x5933('0xa')];var _0x3b0447=_0x3f15fc?0x0:_0x553710[_0x5933('0x7')];var _0x23758b=_0x3f15fc?_0x21f4c1[_0x5933('0xa')]:_0x553710[_0x5933('0x7')]+_0x553710[_0x5933('0x8')];var _0x27b823;if(_0x23758b>=_0x412540){_0x23758b=_0x412540;_0x27b823=0xc8;}else{_0x27b823=0xce;}_0x4de024[_0x5933('0xb')](_0x27b823);return _0x4de024[_0x5933('0xc')]('Content-Range',_0x3b0447+'-'+_0x23758b+'/'+_0x412540)[_0x5933('0x6')](_0x21f4c1);}return null;};}function saveUpdates(_0x5af679,_0x8b6bad){return function(_0x1b4428){if(_0x1b4428){return _0x1b4428[_0x5933('0xd')](_0x5af679)['then'](function(_0x104825){return _0x104825;});}return null;};}function handleEntityNotFound(_0x542448,_0x1ab3d0){return function(_0x4fc51d){if(!_0x4fc51d){_0x542448[_0x5933('0xe')](0x194);}return _0x4fc51d;};}function handleError(_0x5d0457,_0xf6321f){_0xf6321f=_0xf6321f||0x1f4;return function(_0x5e91da){logger[_0x5933('0xf')](_0x5e91da[_0x5933('0x10')]);if(_0x5e91da[_0x5933('0x11')]){delete _0x5e91da['name'];}_0x5d0457['status'](_0xf6321f)[_0x5933('0x12')](_0x5e91da);};}exports[_0x5933('0x13')]=function(_0x3fb0e1,_0x51a525){var _0x4a4d3f={},_0x15263f={},_0x480e67={'count':0x0,'rows':[]};var _0x2cad67=_[_0x5933('0x14')](db[_0x5933('0x15')]['rawAttributes'],function(_0x41acb9){return{'name':_0x41acb9[_0x5933('0x16')],'type':_0x41acb9[_0x5933('0x17')]['key']};});_0x15263f[_0x5933('0x18')]=_['map'](_0x2cad67,_0x5933('0x11'));_0x15263f['query']=_[_0x5933('0x19')](_0x3fb0e1['query']);_0x15263f[_0x5933('0x1a')]=_['intersection'](_0x15263f['model'],_0x15263f['query']);_0x15263f['filters']=_[_0x5933('0x1b')](_0x15263f['filters'],[_0x5933('0x1c'),'$or','$gt',_0x5933('0x1d'),_0x5933('0x1e'),_0x5933('0x1f'),'$ne',_0x5933('0x20'),_0x5933('0x21'),_0x5933('0x22'),'$notBetween',_0x5933('0x23'),_0x5933('0x24'),'$like',_0x5933('0x25'),_0x5933('0x26'),'$notILike',_0x5933('0x27'),'$overlap',_0x5933('0x28'),_0x5933('0x29'),_0x5933('0x2a')]);_0x4a4d3f['attributes']=_[_0x5933('0x2b')](_0x15263f['model'],qs[_0x5933('0x2c')](_0x3fb0e1[_0x5933('0x2d')]['fields']));_0x4a4d3f['attributes']=_0x4a4d3f['attributes'][_0x5933('0x2e')]?_0x4a4d3f[_0x5933('0x2f')]:_0x15263f['model'];if(!_0x3fb0e1[_0x5933('0x2d')][_0x5933('0x30')](_0x5933('0x31'))){_0x4a4d3f[_0x5933('0x8')]=qs['limit'](_0x3fb0e1[_0x5933('0x2d')]['limit']);_0x4a4d3f[_0x5933('0x7')]=qs['offset'](_0x3fb0e1[_0x5933('0x2d')][_0x5933('0x7')]);}_0x4a4d3f[_0x5933('0x32')]=qs[_0x5933('0x33')](_0x3fb0e1['query'][_0x5933('0x33')]);_0x4a4d3f[_0x5933('0x34')]=qs['filters'](_['pick'](_0x3fb0e1[_0x5933('0x2d')],_0x15263f['filters']),_0x2cad67);if(_0x3fb0e1['query'][_0x5933('0x35')]){_0x4a4d3f[_0x5933('0x34')]=_[_0x5933('0x36')](_0x4a4d3f[_0x5933('0x34')],{'$or':_['map'](_0x2cad67,function(_0x5e3a34){if(_0x5e3a34['type']!=='VIRTUAL'){var _0x27ac93={};_0x27ac93[_0x5e3a34['name']]={'$like':'%'+_0x3fb0e1['query']['filter']+'%'};return _0x27ac93;}})});}_0x4a4d3f=_[_0x5933('0x36')]({},_0x4a4d3f,_0x3fb0e1[_0x5933('0x37')]);var _0x2054dd={'where':_0x4a4d3f[_0x5933('0x34')]};return db[_0x5933('0x15')][_0x5933('0xa')](_0x2054dd)[_0x5933('0x38')](function(_0xbd088d){_0x480e67[_0x5933('0xa')]=_0xbd088d;if(_0x3fb0e1[_0x5933('0x2d')]['includeAll']){_0x4a4d3f[_0x5933('0x39')]=[{'all':!![]}];}return db[_0x5933('0x15')][_0x5933('0x3a')](_0x4a4d3f);})[_0x5933('0x38')](function(_0x25ee17){_0x480e67[_0x5933('0x3b')]=_0x25ee17;return _0x480e67;})[_0x5933('0x38')](respondWithFilteredResult(_0x51a525,_0x4a4d3f))[_0x5933('0x3c')](handleError(_0x51a525,null));};exports[_0x5933('0x3d')]=function(_0x22ab5d,_0x51e82b){var _0x5c2bd0={'raw':!![],'where':{'id':_0x22ab5d[_0x5933('0x3e')]['id']}},_0x2016e0={};_0x2016e0[_0x5933('0x18')]=_['keys'](db['CmHopper'][_0x5933('0x3f')]);_0x2016e0[_0x5933('0x2d')]=_['keys'](_0x22ab5d[_0x5933('0x2d')]);_0x2016e0[_0x5933('0x1a')]=_[_0x5933('0x2b')](_0x2016e0[_0x5933('0x18')],_0x2016e0[_0x5933('0x2d')]);_0x5c2bd0[_0x5933('0x2f')]=_['intersection'](_0x2016e0['model'],qs[_0x5933('0x2c')](_0x22ab5d[_0x5933('0x2d')][_0x5933('0x2c')]));_0x5c2bd0[_0x5933('0x2f')]=_0x5c2bd0[_0x5933('0x2f')][_0x5933('0x2e')]?_0x5c2bd0['attributes']:_0x2016e0[_0x5933('0x18')];if(_0x22ab5d[_0x5933('0x2d')][_0x5933('0x40')]){_0x5c2bd0['include']=[{'all':!![]}];}_0x5c2bd0=_[_0x5933('0x36')]({},_0x5c2bd0,_0x22ab5d[_0x5933('0x37')]);return db[_0x5933('0x15')][_0x5933('0x41')](_0x5c2bd0)[_0x5933('0x38')](handleEntityNotFound(_0x51e82b,null))[_0x5933('0x38')](respondWithResult(_0x51e82b,null))[_0x5933('0x3c')](handleError(_0x51e82b,null));};exports[_0x5933('0x42')]=function(_0x1d8303,_0x3fcb34){return db['CmHopper'][_0x5933('0x42')](_0x1d8303['body'],{})['then'](respondWithResult(_0x3fcb34,0xc9))['catch'](handleError(_0x3fcb34,null));};exports[_0x5933('0xd')]=function(_0x5aa428,_0x5e8e5a){if(_0x5aa428[_0x5933('0x43')]['id']){delete _0x5aa428[_0x5933('0x43')]['id'];}return db['CmHopper'][_0x5933('0x41')]({'where':{'id':_0x5aa428['params']['id']}})[_0x5933('0x38')](handleEntityNotFound(_0x5e8e5a,null))[_0x5933('0x38')](saveUpdates(_0x5aa428['body'],null))['then'](respondWithResult(_0x5e8e5a,null))[_0x5933('0x3c')](handleError(_0x5e8e5a,null));};exports[_0x5933('0x44')]=function(_0x38e713,_0x10148d){return db[_0x5933('0x15')]['describe']()[_0x5933('0x38')](respondWithResult(_0x10148d,null))[_0x5933('0x3c')](handleError(_0x10148d,null));};exports[_0x5933('0x45')]=function(_0x4c2e69,_0x2d5fd4){var _0x9f2a15;var _0x1c808f=_0x4c2e69[_0x5933('0x3e')]['id'];return db['CmHopper'][_0x5933('0x41')]({'where':{'id':_0x4c2e69[_0x5933('0x3e')]['id']}})[_0x5933('0x38')](handleEntityNotFound(_0x2d5fd4,null))[_0x5933('0x38')](function(_0x56a748){if(_0x56a748){return _0x56a748[_0x5933('0x45')]()[_0x5933('0x38')](function(_0x41be67){return _0x41be67;});}})[_0x5933('0x38')](function(_0x40b672){_0x9f2a15=_0x40b672;if(_0x40b672){if(_0x40b672[_0x5933('0x46')]||_0x40b672[_0x5933('0x47')]){return db[_0x40b672[_0x5933('0x46')]?_0x5933('0x48'):_0x5933('0x49')]['find']({'where':{'id':_0x40b672[_0x5933('0x46')]?_0x40b672['VoiceQueueId']:_0x40b672[_0x5933('0x47')]},'attributes':['id','name'],'raw':!![]});}}})[_0x5933('0x38')](function(_0x5e1029){var _0x1aabbc={};if(_0x5e1029){_[_0x5933('0x36')](_0x1aabbc,_['omit'](_0x9f2a15[_0x5933('0x4a')],['createdAt',_0x5933('0x4b'),'id']));_0x1aabbc[_0x5933('0x4c')]=0x15;_0x1aabbc[_0x5933('0x4d')]=_0x5933('0x4e');_0x1aabbc[_0x5933('0x4f')]=_0x5e1029[_0x5933('0x11')];_0x1aabbc['membername']=_0x4c2e69[_0x5933('0x50')][_0x5933('0x11')];_0x1aabbc[_0x5933('0x51')]=_0x4c2e69['user']['id'];_0x1aabbc[_0x5933('0x4e')]=!![];_0x1aabbc['deletedat']=moment()[_0x5933('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x1aabbc[_0x5933('0x53')]=_0x9f2a15[_0x5933('0x54')];_0x1aabbc[_0x5933('0x55')]=_0x9f2a15[_0x5933('0x46')]?'queue':'ivr';return db['CmContact'][_0x5933('0x41')]({'where':{'id':_0x1aabbc[_0x5933('0x56')]},'attributes':[_0x5933('0x57'),_0x5933('0x58')]})[_0x5933('0x38')](function(_0xacf93){if(!_['isNil'](_0x2d5fd4)&&!_['isNil'](_0xacf93[_0x5933('0x57')])){_0x1aabbc[_0x5933('0x59')]=_0xacf93[_0x5933('0x57')];if(!_['isNil'](_0xacf93[_0x5933('0x58')])){_0x1aabbc[_0x5933('0x59')]+='\x20'+_0xacf93[_0x5933('0x58')];}}})[_0x5933('0x5a')](function(){return db[_0x5933('0x5b')][_0x5933('0x42')](_0x1aabbc);});}})[_0x5933('0x38')](function(_0x377d24){return db[_0x5933('0x5c')][_0x5933('0x45')]({'where':{'CmHopperId':_0x1c808f}});})[_0x5933('0x38')](function(){return _0x2d5fd4[_0x5933('0xb')](0xcc)[_0x5933('0x5d')]();})['catch'](handleError(_0x2d5fd4,null));};exports[_0x5933('0x5e')]=function(_0x79dd3,_0x14cc36){var _0x3699b6=[];return db[_0x5933('0x5f')][_0x5933('0x44')]()[_0x5933('0x38')](function(_0x3d1ae7){_0x3699b6=_[_0x5933('0x19')](_0x3d1ae7);return _0x79dd3[_0x5933('0x50')][_0x5933('0x60')]({'where':{'type':_0x5933('0x61'),'dialActive':!![],'dialMethod':_0x5933('0x62')},'attributes':['id',_0x5933('0x63'),_0x5933('0x64')],'raw':!![]});})[_0x5933('0x38')](function(_0x50c938){if(_0x50c938&&_0x50c938['length']){return db[_0x5933('0x65')][_0x5933('0x66')](function(_0x43998c){var _0x1852df={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5933('0x52')](_0x5933('0x67'))},'VoiceQueueId':{'$in':_[_0x5933('0x14')](_0x50c938,'id')},'$or':[{'UserId':null},{'UserId':_0x79dd3[_0x5933('0x50')]['id']}]};var _0x948ae9={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x50c938)['filter'](['dialPreviewAutoRecallMe',0x0])[_0x5933('0x14')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x79dd3[_0x5933('0x50')]['id']}]};var _0x577458={'$or':[_0x1852df,_0x948ae9]};var _0x5989d6=[];if(_0x79dd3[_0x5933('0x43')]['direction']&&_0x79dd3['body'][_0x5933('0x68')]===_0x5933('0x69')){if(!_[_0x5933('0x6a')](_0x79dd3[_0x5933('0x43')][_0x5933('0x6b')])){_0x577458['id']={'$in':_0x79dd3['body'][_0x5933('0x6b')]};}_0x5989d6=[['priority',_0x5933('0x6c')],[_0x5933('0x6d'),_0x50c938[0x0][_0x5933('0x63')]===_0x5933('0x6c')?_0x5933('0x6e'):_0x5933('0x6c')],db[_0x5933('0x65')][_0x5933('0x6f')](_0x5933('0x70')),['id',_0x5933('0x6e')]];}else{if(!_[_0x5933('0x6a')](_0x79dd3[_0x5933('0x43')]['hopperIds'])){_0x577458['id']={'$notIn':_0x79dd3[_0x5933('0x43')][_0x5933('0x6b')]};}_0x5989d6=[[_0x5933('0x71'),'DESC'],['scheduledAt',_0x50c938[0x0][_0x5933('0x63')]],db[_0x5933('0x65')][_0x5933('0x6f')](_0x5933('0x72')),['id',_0x5933('0x6c')]];}return db[_0x5933('0x15')][_0x5933('0x73')]({'attributes':['id','scheduledat',_0x5933('0x54'),_0x5933('0x74')],'where':_0x577458,'order':_0x5989d6,'transaction':_0x43998c,'lock':_0x43998c['LOCK'][_0x5933('0x75')],'include':[{'model':db[_0x5933('0x5f')],'as':_0x5933('0x76'),'attributes':_0x3699b6,'include':[{'model':db[_0x5933('0x77')],'as':_0x5933('0x78'),'attributes':['id',_0x5933('0x11')]}]},{'model':db[_0x5933('0x79')],'as':_0x5933('0x7a'),'attributes':['id',_0x5933('0x11')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id','name','dialActive']}]})[_0x5933('0x38')](function(_0xfc5f8d){if(_0xfc5f8d){return _0xfc5f8d['update']({'UserId':_0x79dd3['user']['id']},{'transaction':_0x43998c});}});});}})[_0x5933('0x38')](handleEntityNotFound(_0x14cc36,null))['then'](respondWithResult(_0x14cc36,null))[_0x5933('0x3c')](handleError(_0x14cc36,null));};exports[_0x5933('0x7b')]=function(_0x1f0690,_0x5d7c48,_0x35195f){var _0x529b4b=[];var _0xc0bef8=_0x1f0690[_0x5933('0x3e')]['id'];var _0x577129=_0x1f0690[_0x5933('0x50')]['id'];return db[_0x5933('0x5f')][_0x5933('0x44')]()[_0x5933('0x38')](function(_0x4da10c){_0x529b4b=_[_0x5933('0x19')](_0x4da10c);return db[_0x5933('0x65')]['transaction'](function(_0x2edb6e){const _0x1fe93b={'id':_0xc0bef8};return db['CmHopper']['findOne']({'attributes':['id','scheduledat',_0x5933('0x74')],'where':_0x1fe93b,'transaction':_0x2edb6e,'lock':_0x2edb6e['LOCK'][_0x5933('0x75')],'include':[{'model':db['CmContact'],'as':_0x5933('0x76'),'attributes':_0x529b4b,'include':[{'model':db[_0x5933('0x77')],'as':_0x5933('0x78'),'attributes':['id',_0x5933('0x11')]}]},{'model':db['CmList'],'as':_0x5933('0x7a'),'attributes':['id',_0x5933('0x11')]},{'model':db[_0x5933('0x48')],'as':_0x5933('0x7c'),'attributes':['id',_0x5933('0x11'),_0x5933('0x7d')]}]})['then'](function(_0x16fa53){if(_0x16fa53){return _0x16fa53['update']({'UserId':_0x577129},{'transaction':_0x2edb6e});}});});})[_0x5933('0x38')](handleEntityNotFound(_0x5d7c48,null))[_0x5933('0x38')](respondWithResult(_0x5d7c48,null))[_0x5933('0x3c')](handleError(_0x5d7c48,null));};exports[_0x5933('0x7e')]=function(_0x241160,_0x1caabb){return _0x241160['user'][_0x5933('0x60')]({'where':{'type':_0x5933('0x61'),'dialActive':!![],'dialMethod':_0x5933('0x62')},'attributes':['id'],'raw':!![]})[_0x5933('0x38')](function(_0x16fd6f){if(_0x16fd6f&&_0x16fd6f[_0x5933('0x2e')]){return db[_0x5933('0x15')][_0x5933('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5933('0x52')](_0x5933('0x67'))},'VoiceQueueId':{'$in':_[_0x5933('0x14')](_0x16fd6f,'id')},'$or':[{'UserId':null},{'UserId':_0x241160[_0x5933('0x50')]['id']}]}});}return 0x0;})[_0x5933('0x38')](function(_0x351202){if(!_[_0x5933('0x7f')](_0x351202)&&_[_0x5933('0x80')](_0x351202)){return _0x1caabb[_0x5933('0xb')](0xc8)[_0x5933('0x6')]({'contacts':_0x351202});}else{logger[_0x5933('0xf')]('CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts',0x194,_0x5933('0x81'));_0x1caabb[_0x5933('0xe')](0x194);}})[_0x5933('0x3c')](handleError(_0x1caabb,null));};exports[_0x5933('0x82')]=function(_0xfb586d,_0x2913b7){var _0x1d4f6b=shared[_0x5933('0x83')];var _0x500bc9=[];_['map'](_0x1d4f6b,function(_0x47b7b4){_0x500bc9['push']({'id':_0x47b7b4[_0x5933('0x11')],'name':_0x47b7b4[_0x5933('0x11')],'utcOffset':_0x47b7b4[_0x5933('0x84')]});});return _0x2913b7[_0x5933('0xb')](0xc8)[_0x5933('0x6')]({'tz':_0x500bc9});};exports[_0x5933('0x85')]=function(_0x1fd53d,_0x100936){var _0x34a26e=shared[_0x5933('0x83')];var _0x603974={};if(!_[_0x5933('0x7f')](_0x34a26e[_0x1fd53d['body']['id']]))_0x603974=_0x34a26e[_0x1fd53d['body']['id']];return _0x100936['status'](0xc8)[_0x5933('0x6')](_0x603974);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 89c55ea..b86a4a4 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 _0x5fab=['./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x44edac,_0x296573){var _0x50d63f=function(_0x2b8c6c){while(--_0x2b8c6c){_0x44edac['push'](_0x44edac['shift']());}};_0x50d63f(++_0x296573);}(_0x5fab,0x177));var _0xb5fa=function(_0x266ddc,_0x45aa52){_0x266ddc=_0x266ddc-0x0;var _0x39c1d7=_0x5fab[_0x266ddc];return _0x39c1d7;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['scheduledat']},{'name':_0xb5fa('0xe'),'fields':[_0xb5fa('0xe')]},{'name':_0xb5fa('0xf'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe2fe=['CmHopper','scheduledat','phone','priority','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x8de950,_0x2693be){var _0x587a48=function(_0xefd05c){while(--_0xefd05c){_0x8de950['push'](_0x8de950['shift']());}};_0x587a48(++_0x2693be);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./cmHopper.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xee2f('0xa'),'fields':['scheduledat']},{'name':_0xee2f('0xb'),'fields':[_0xee2f('0xb')]},{'name':'priority','fields':[_0xee2f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 59a7b8c..a38daaf 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 _0xd0db=['map','model','info','debug','stringify','catch','error','message','find','then','ShowCmHopper','CmHopper','body','CreateCmHopper','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','findAll','order','LOCK','UPDATE','keys','User','Agent','name','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','create','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','Contact','GetContactByPhone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','transaction','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','\x20MINUTE','NOW()','CmList','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','options','raw','where','attributes','limit','include'];(function(_0x532f04,_0x1e0b5c){var _0x16f716=function(_0x10a941){while(--_0x10a941){_0x532f04['push'](_0x532f04['shift']());}};_0x16f716(++_0x1e0b5c);}(_0xd0db,0x1cc));var _0xbd0d=function(_0x33a71b,_0x1bf978){_0x33a71b=_0x33a71b-0x0;var _0x16cd00=_0xd0db[_0x33a71b];return _0x16cd00;};'use strict';var _=require(_0xbd0d('0x0'));var util=require(_0xbd0d('0x1'));var moment=require(_0xbd0d('0x2'));var BPromise=require(_0xbd0d('0x3'));var db=require(_0xbd0d('0x4'))['db'];var logger=require(_0xbd0d('0x5'))(_0xbd0d('0x6'));exports[_0xbd0d('0x7')]=function(_0x842de6){var _0x34fafd=this;return new Promise(function(_0x3aaa4d,_0x3e813f){return db['CmHopper']['findAll']({'raw':_0x842de6[_0xbd0d('0x8')]?_0x842de6['options'][_0xbd0d('0x9')]===undefined?!![]:![]:!![],'where':_0x842de6[_0xbd0d('0x8')]?_0x842de6[_0xbd0d('0x8')][_0xbd0d('0xa')]||null:null,'attributes':_0x842de6['options']?_0x842de6[_0xbd0d('0x8')][_0xbd0d('0xb')]||null:null,'limit':_0x842de6[_0xbd0d('0x8')]?_0x842de6[_0xbd0d('0x8')][_0xbd0d('0xc')]||null:null,'include':_0x842de6[_0xbd0d('0x8')]?_0x842de6[_0xbd0d('0x8')][_0xbd0d('0xd')]?_[_0xbd0d('0xe')](_0x842de6[_0xbd0d('0x8')][_0xbd0d('0xd')],function(_0x486a05){return{'model':db[_0x486a05[_0xbd0d('0xf')]],'as':_0x486a05['as'],'attributes':_0x486a05[_0xbd0d('0xb')],'include':_0x486a05[_0xbd0d('0xd')]?_[_0xbd0d('0xe')](_0x486a05[_0xbd0d('0xd')],function(_0x93fb0e){return{'model':db[_0x93fb0e[_0xbd0d('0xf')]],'as':_0x93fb0e['as'],'attributes':_0x93fb0e['attributes'],'include':_0x93fb0e[_0xbd0d('0xd')]?_[_0xbd0d('0xe')](_0x93fb0e[_0xbd0d('0xd')],function(_0x4163ee){return{'model':db[_0x4163ee[_0xbd0d('0xf')]],'as':_0x4163ee['as'],'attributes':_0x4163ee[_0xbd0d('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf1747e){logger[_0xbd0d('0x10')]('GetCmHopper',_0x842de6);logger[_0xbd0d('0x11')](_0xbd0d('0x7'),_0x842de6,JSON[_0xbd0d('0x12')](_0xf1747e));_0x3aaa4d(_0xf1747e);})[_0xbd0d('0x13')](function(_0x102e83){logger[_0xbd0d('0x14')]('GetCmHopper',_0x102e83[_0xbd0d('0x15')],_0x842de6);_0x3e813f(_0x34fafd[_0xbd0d('0x14')](0x1f4,_0x102e83['message']));});});};exports['ShowCmHopper']=function(_0x1ca405){var _0x51e099=this;return new Promise(function(_0x2d7f6e,_0x378e89){return db['CmHopper'][_0xbd0d('0x16')]({'raw':_0x1ca405[_0xbd0d('0x8')]?_0x1ca405[_0xbd0d('0x8')][_0xbd0d('0x9')]===undefined?!![]:![]:!![],'where':_0x1ca405[_0xbd0d('0x8')]?_0x1ca405[_0xbd0d('0x8')][_0xbd0d('0xa')]||null:null,'attributes':_0x1ca405[_0xbd0d('0x8')]?_0x1ca405[_0xbd0d('0x8')][_0xbd0d('0xb')]||null:null,'include':_0x1ca405['options']?_0x1ca405['options']['include']?_['map'](_0x1ca405[_0xbd0d('0x8')][_0xbd0d('0xd')],function(_0x5b9220){return{'model':db[_0x5b9220[_0xbd0d('0xf')]],'as':_0x5b9220['as'],'attributes':_0x5b9220['attributes'],'include':_0x5b9220[_0xbd0d('0xd')]?_[_0xbd0d('0xe')](_0x5b9220['include'],function(_0x120be0){return{'model':db[_0x120be0[_0xbd0d('0xf')]],'as':_0x120be0['as'],'attributes':_0x120be0[_0xbd0d('0xb')],'include':_0x120be0[_0xbd0d('0xd')]?_[_0xbd0d('0xe')](_0x120be0[_0xbd0d('0xd')],function(_0x4fdc9a){return{'model':db[_0x4fdc9a[_0xbd0d('0xf')]],'as':_0x4fdc9a['as'],'attributes':_0x4fdc9a[_0xbd0d('0xb')]};}):[]};}):[]};}):[]:[]})[_0xbd0d('0x17')](function(_0x258790){logger[_0xbd0d('0x10')](_0xbd0d('0x18'),_0x1ca405);logger[_0xbd0d('0x11')]('ShowCmHopper',_0x1ca405,JSON[_0xbd0d('0x12')](_0x258790));_0x2d7f6e(_0x258790);})['catch'](function(_0x36f7bc){logger[_0xbd0d('0x14')]('ShowCmHopper',_0x36f7bc['message'],_0x1ca405);_0x378e89(_0x51e099[_0xbd0d('0x14')](0x1f4,_0x36f7bc[_0xbd0d('0x15')]));});});};exports['CreateCmHopper']=function(_0x3cffbc){var _0x21ebad=this;return new Promise(function(_0x536921,_0x51d13b){return db[_0xbd0d('0x19')]['create'](_0x3cffbc[_0xbd0d('0x1a')],{'raw':_0x3cffbc[_0xbd0d('0x8')]?_0x3cffbc[_0xbd0d('0x8')]['raw']===undefined?!![]:![]:!![]})[_0xbd0d('0x17')](function(_0x2779b7){logger['info'](_0xbd0d('0x1b'),_0x3cffbc);logger[_0xbd0d('0x11')](_0xbd0d('0x1b'),_0x3cffbc,JSON[_0xbd0d('0x12')](_0x2779b7));_0x536921(_0x2779b7);})[_0xbd0d('0x13')](function(_0x4c6ad9){logger[_0xbd0d('0x14')](_0xbd0d('0x1b'),_0x4c6ad9['message'],_0x3cffbc);_0x51d13b(_0x21ebad[_0xbd0d('0x14')](0x1f4,_0x4c6ad9[_0xbd0d('0x15')]));});});};exports[_0xbd0d('0x1c')]=function(_0x339a24){var _0xc9a395=this;return new Promise(function(_0x46dea4,_0x4f04b8){return db['CmHopper'][_0xbd0d('0x1d')](_0x339a24[_0xbd0d('0x1a')],{'raw':_0x339a24[_0xbd0d('0x8')]?_0x339a24[_0xbd0d('0x8')][_0xbd0d('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x339a24[_0xbd0d('0x8')]?_0x339a24[_0xbd0d('0x8')][_0xbd0d('0xa')]||null:null,'attributes':_0x339a24[_0xbd0d('0x8')]?_0x339a24[_0xbd0d('0x8')][_0xbd0d('0xb')]||null:null,'limit':_0x339a24['options']?_0x339a24[_0xbd0d('0x8')][_0xbd0d('0xc')]||null:null})[_0xbd0d('0x17')](function(_0x3059d5){logger[_0xbd0d('0x10')](_0xbd0d('0x1c'),_0x339a24);logger[_0xbd0d('0x10')](_0xbd0d('0x1e'),JSON['stringify'](_0x339a24[_0xbd0d('0x8')][_0xbd0d('0xa')]),_0x339a24[_0xbd0d('0x1a')]['active']);logger[_0xbd0d('0x11')](_0xbd0d('0x1c'),_0x339a24,JSON[_0xbd0d('0x12')](_0x3059d5));_0x46dea4(_0x3059d5);})['catch'](function(_0x1a968d){logger[_0xbd0d('0x14')](_0xbd0d('0x1c'),_0x1a968d['message'],_0x339a24);_0x4f04b8(_0xc9a395['error'](0x1f4,_0x1a968d['message']));});});};exports[_0xbd0d('0x1f')]=function(_0x1716e1){var _0x41cda3=this;return new Promise(function(_0x4bf010,_0x2e3539){return db['CmHopper'][_0xbd0d('0x20')]({'where':_0x1716e1[_0xbd0d('0x8')]?_0x1716e1['options'][_0xbd0d('0xa')]||null:null})[_0xbd0d('0x17')](function(_0x5f5b50){logger[_0xbd0d('0x10')](_0xbd0d('0x1f'),_0x1716e1);logger[_0xbd0d('0x11')]('DestroyCmHopper',_0x1716e1,JSON[_0xbd0d('0x12')](_0x5f5b50));_0x4bf010(_0x5f5b50);})[_0xbd0d('0x13')](function(_0x2565c7){logger[_0xbd0d('0x14')](_0xbd0d('0x1f'),_0x2565c7[_0xbd0d('0x15')],_0x1716e1);_0x2e3539(_0x41cda3[_0xbd0d('0x14')](0x1f4,_0x2565c7[_0xbd0d('0x15')]));});});};exports[_0xbd0d('0x21')]=function(_0x15eecb){var _0x128f07=this;return new Promise(function(_0x403e65,_0x289061){return db[_0xbd0d('0x22')][_0xbd0d('0x23')]()[_0xbd0d('0x17')](function(_0x10ce29){return db[_0xbd0d('0x24')]['transaction'](function(_0x754581){return db['CmHopper'][_0xbd0d('0x25')]({'where':_0x15eecb[_0xbd0d('0x8')]?_0x15eecb[_0xbd0d('0x8')][_0xbd0d('0xa')]||null:null,'attributes':_0x15eecb['options']?_0x15eecb[_0xbd0d('0x8')]['attributes']||null:null,'limit':_0x15eecb[_0xbd0d('0x8')]?_0x15eecb[_0xbd0d('0x8')][_0xbd0d('0xc')]||null:null,'order':_0x15eecb[_0xbd0d('0x8')]?_0x15eecb[_0xbd0d('0x8')][_0xbd0d('0x26')]||null:null,'transaction':_0x754581,'lock':_0x754581[_0xbd0d('0x27')][_0xbd0d('0x28')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_[_0xbd0d('0x29')](_0x10ce29)},{'model':db[_0xbd0d('0x2a')],'as':_0xbd0d('0x2b'),'attributes':['id',_0xbd0d('0x2c'),_0xbd0d('0x2d')]}]})[_0xbd0d('0x17')](function(_0x19d7e5){var _0x27ad77=[];var _0x4bc6c6=[];for(var _0x290096=0x0;_0x290096<_0x19d7e5[_0xbd0d('0x2e')];_0x290096+=0x1){var _0x5ed1ea=_0x19d7e5[_0x290096][_0xbd0d('0x2f')];if(_0x5ed1ea===null){_0x27ad77[_0xbd0d('0x30')](_0x19d7e5[_0x290096][_0xbd0d('0x1d')](_0x15eecb['body'],{'transaction':_0x754581}));}else if(!_0x4bc6c6[_0xbd0d('0x31')](_0x5ed1ea)){_0x4bc6c6[_0xbd0d('0x30')](_0x5ed1ea);_0x27ad77['push'](_0x19d7e5[_0x290096][_0xbd0d('0x1d')](_0x15eecb[_0xbd0d('0x1a')],{'transaction':_0x754581}));}}return BPromise[_0xbd0d('0x32')](_0x27ad77);});})[_0xbd0d('0x17')](function(_0x5a8774){logger[_0xbd0d('0x10')]('GetContactDialer',_0x15eecb);if(_0x5a8774[_0xbd0d('0x2e')]>0x0){logger[_0xbd0d('0x10')](_0xbd0d('0x33'),_0x5a8774[0x0][_0xbd0d('0x34')]['id'],_0x5a8774[0x0]['dataValues'][_0xbd0d('0x35')],_0x5a8774[0x0][_0xbd0d('0x34')][_0xbd0d('0x36')]);}logger[_0xbd0d('0x11')](_0xbd0d('0x21'),_0x15eecb,JSON[_0xbd0d('0x12')](_0x5a8774));_0x403e65(_0x5a8774);})[_0xbd0d('0x13')](function(_0x27b6f1){logger[_0xbd0d('0x14')](_0xbd0d('0x21'),_0x27b6f1[_0xbd0d('0x15')],_0x15eecb);_0x289061(_0x128f07[_0xbd0d('0x14')](0x1f4,_0x27b6f1[_0xbd0d('0x15')]));});});});};exports['MoveContactManagedDialer']=function(_0x3ca949){var _0x58e00b=this;return new Promise(function(_0x34a3f1,_0x8a997b){return db['sequelize']['transaction'](function(_0x131c26){return db['CmHopperFinal'][_0xbd0d('0x37')](_0x3ca949[_0xbd0d('0x1a')],{'raw':_0x3ca949[_0xbd0d('0x8')]?_0x3ca949[_0xbd0d('0x8')]['raw']===undefined?!![]:![]:!![],'transaction':_0x131c26})[_0xbd0d('0x17')](function(){logger[_0xbd0d('0x10')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xbd0d('0x12')](_0x3ca949[_0xbd0d('0x8')][_0xbd0d('0xa')]),_0x3ca949['options'][_0xbd0d('0xa')][_0xbd0d('0x36')]);return db[_0xbd0d('0x19')][_0xbd0d('0x20')]({'where':_0x3ca949[_0xbd0d('0x8')]?_0x3ca949[_0xbd0d('0x8')][_0xbd0d('0xa')]||null:null,'transaction':_0x131c26});});})[_0xbd0d('0x17')](function(_0x1a9ca6){logger['info'](_0xbd0d('0x38'),_0x3ca949);logger[_0xbd0d('0x11')](_0xbd0d('0x38'),_0x3ca949,JSON[_0xbd0d('0x12')](_0x1a9ca6));_0x34a3f1(_0x1a9ca6);})[_0xbd0d('0x13')](function(_0x4b788e){logger[_0xbd0d('0x14')](_0xbd0d('0x38'),_0x4b788e[_0xbd0d('0x15')],_0x3ca949);_0x8a997b(_0x58e00b[_0xbd0d('0x14')](0x1f4,_0x4b788e[_0xbd0d('0x15')]));});});};exports[_0xbd0d('0x39')]=function(_0xa17996){var _0x58790a=this;return new Promise(function(_0x5a7d28,_0x29ced5){return db['CmHopper'][_0xbd0d('0x25')]({'raw':_0xa17996[_0xbd0d('0x8')]?_0xa17996['options'][_0xbd0d('0x9')]===undefined?!![]:![]:!![],'where':_0xa17996[_0xbd0d('0x8')]?_0xa17996[_0xbd0d('0x8')][_0xbd0d('0xa')]||null:null,'attributes':[[db[_0xbd0d('0x24')]['fn'](_0xbd0d('0x3a'),db['sequelize']['fn']('IF',db[_0xbd0d('0x24')][_0xbd0d('0x3b')](_0xbd0d('0x3c')+util['format'](_0xbd0d('0x3d'),moment()[_0xbd0d('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xbd0d('0x3f')))),_0xbd0d('0x40')]]})['then'](function(_0xb19400){logger[_0xbd0d('0x10')](_0xbd0d('0x39'),_0xa17996);logger[_0xbd0d('0x11')](_0xbd0d('0x39'),_0xa17996,JSON[_0xbd0d('0x12')](_0xb19400));_0x5a7d28(_0xb19400);})[_0xbd0d('0x13')](function(_0x2baf9e){logger['error'](_0xbd0d('0x39'),_0x2baf9e[_0xbd0d('0x15')],_0xa17996);_0x29ced5(_0x58790a[_0xbd0d('0x14')](0x1f4,_0x2baf9e[_0xbd0d('0x15')]));});});};exports['GetContactRecallMe']=function(_0x5ea9a5){var _0x1ae203=this;return new Promise(function(_0xe4c42c,_0x2e7144){return db[_0xbd0d('0x22')]['describe']()[_0xbd0d('0x17')](function(){return db[_0xbd0d('0x24')]['transaction'](function(_0x405d52){return db[_0xbd0d('0x19')][_0xbd0d('0x25')]({'where':_0x5ea9a5['options']?_0x5ea9a5[_0xbd0d('0x8')]['where']||null:null,'attributes':_0x5ea9a5[_0xbd0d('0x8')]?_0x5ea9a5['options'][_0xbd0d('0xb')]||null:null,'limit':0x1,'order':_0x5ea9a5['options']?_0x5ea9a5[_0xbd0d('0x8')][_0xbd0d('0x26')]||null:null,'group':db[_0xbd0d('0x19')][_0xbd0d('0x2f')],'transaction':_0x405d52,'lock':_0x405d52[_0xbd0d('0x27')][_0xbd0d('0x28')],'include':_0x5ea9a5[_0xbd0d('0x8')]?_0x5ea9a5[_0xbd0d('0x8')][_0xbd0d('0xd')]?_[_0xbd0d('0xe')](_0x5ea9a5['options'][_0xbd0d('0xd')],function(_0x706116){return{'model':db[_0x706116['model']],'as':_0x706116['as'],'attributes':_0x706116[_0xbd0d('0xb')],'include':_0x706116[_0xbd0d('0xd')]?_[_0xbd0d('0xe')](_0x706116[_0xbd0d('0xd')],function(_0x174e27){return{'model':db[_0x174e27[_0xbd0d('0xf')]],'as':_0x174e27['as'],'attributes':_0x174e27[_0xbd0d('0xb')],'include':_0x174e27[_0xbd0d('0xd')]?_[_0xbd0d('0xe')](_0x174e27[_0xbd0d('0xd')],function(_0x54b1ac){return{'model':db[_0x54b1ac[_0xbd0d('0xf')]],'as':_0x54b1ac['as'],'attributes':_0x54b1ac[_0xbd0d('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3759ba){var _0x5dd301=[];for(var _0x482808=0x0;_0x482808<_0x3759ba[_0xbd0d('0x2e')];_0x482808+=0x1){_0x5dd301[_0xbd0d('0x30')](_0x3759ba[_0x482808]['update'](_0x5ea9a5['body'],{'transaction':_0x405d52}));}return BPromise['all'](_0x5dd301);});})['then'](function(_0x1c630d){logger['info'](_0xbd0d('0x41'),_0x5ea9a5);logger[_0xbd0d('0x11')](_0xbd0d('0x41'),_0x5ea9a5,JSON[_0xbd0d('0x12')](_0x1c630d));_0xe4c42c(_0x1c630d);})[_0xbd0d('0x13')](function(_0x3edd83){logger['error'](_0xbd0d('0x41'),_0x3edd83['message'],_0x5ea9a5);_0x2e7144(_0x1ae203[_0xbd0d('0x14')](0x1f4,_0x3edd83[_0xbd0d('0x15')]));});});});};exports['GetCmHopperPreview']=function(_0x1e2b8e){var _0x541eb8=this;return new Promise(function(_0xc2f10e,_0x423234){db[_0xbd0d('0x22')][_0xbd0d('0x23')]()[_0xbd0d('0x17')](function(_0x15e3e9){return db[_0xbd0d('0x19')][_0xbd0d('0x25')]({'raw':_0x1e2b8e['options']?_0x1e2b8e[_0xbd0d('0x8')][_0xbd0d('0x9')]===undefined?!![]:![]:!![],'where':_0x1e2b8e['options']?_0x1e2b8e[_0xbd0d('0x8')][_0xbd0d('0xa')]||null:null,'attributes':_0x1e2b8e['options']?_0x1e2b8e['options'][_0xbd0d('0xb')]||null:null,'limit':_0x1e2b8e[_0xbd0d('0x8')]?_0x1e2b8e[_0xbd0d('0x8')]['limit']||null:null,'include':_0x1e2b8e[_0xbd0d('0x8')]?_0x1e2b8e[_0xbd0d('0x8')]['include']?_['map'](_0x1e2b8e[_0xbd0d('0x8')]['include'],function(_0x239a24){return{'model':db[_0x239a24[_0xbd0d('0xf')]],'as':_0x239a24['as'],'attributes':_0x239a24['as']===_0xbd0d('0x42')?_[_0xbd0d('0x29')](_0x15e3e9):_0x239a24[_0xbd0d('0xb')],'include':_0x239a24[_0xbd0d('0xd')]?_['map'](_0x239a24[_0xbd0d('0xd')],function(_0x412f02){return{'model':db[_0x412f02[_0xbd0d('0xf')]],'as':_0x412f02['as'],'attributes':_0x412f02[_0xbd0d('0xb')],'include':_0x412f02['include']?_[_0xbd0d('0xe')](_0x412f02['include'],function(_0x511d4c){return{'model':db[_0x511d4c[_0xbd0d('0xf')]],'as':_0x511d4c['as'],'attributes':_0x511d4c[_0xbd0d('0xb')]};}):[]};}):[]};}):[]:[]})[_0xbd0d('0x17')](function(_0x2effc1){logger['info']('GetCmHopper',_0x1e2b8e);logger[_0xbd0d('0x11')](_0xbd0d('0x7'),_0x1e2b8e,JSON['stringify'](_0x2effc1));_0xc2f10e(_0x2effc1);})['catch'](function(_0xfa2e98){logger['error'](_0xbd0d('0x7'),_0xfa2e98[_0xbd0d('0x15')],_0x1e2b8e);_0x423234(_0x541eb8[_0xbd0d('0x14')](0x1f4,_0xfa2e98[_0xbd0d('0x15')]));});});});};exports[_0xbd0d('0x43')]=function(_0x4d78b2){var _0x3a2469=this;return new Promise(function(_0x264720,_0x10e701){return db[_0xbd0d('0x22')]['findOne']({'raw':!![],'where':{'phone':_0x4d78b2[_0xbd0d('0x8')][_0xbd0d('0xa')]['phone']},'attributes':['id',_0xbd0d('0x44')],'order':[['id',_0xbd0d('0x45')]]})['then'](function(_0x19f1d1){logger[_0xbd0d('0x10')](_0xbd0d('0x46'),_0x4d78b2);logger[_0xbd0d('0x11')](_0xbd0d('0x46'),_0x4d78b2,JSON[_0xbd0d('0x12')](_0x19f1d1));_0x264720(_0x19f1d1);})[_0xbd0d('0x13')](function(_0xce3f4d){logger[_0xbd0d('0x14')](_0xbd0d('0x46'),_0xce3f4d[_0xbd0d('0x15')],_0x4d78b2);_0x10e701(_0x3a2469['error'](0x1f4,_0xce3f4d[_0xbd0d('0x15')]));});});};exports[_0xbd0d('0x47')]=function(_0x2449f3){var _0x308839=this;return new Promise(function(_0x4e0e43,_0x58e98e){return db[_0xbd0d('0x24')][_0xbd0d('0x48')](function(_0x524a1c){var _0x180fe9=_0x2449f3[_0xbd0d('0x8')]&&_0x2449f3[_0xbd0d('0x8')][_0xbd0d('0xa')]?_0x2449f3[_0xbd0d('0x8')][_0xbd0d('0xa')]:{};return db['CmHopper'][_0xbd0d('0x1d')](_0x2449f3['body'],{'where':_0x180fe9,'transaction':_0x524a1c})[_0xbd0d('0x17')](function(_0x24b3fc){logger[_0xbd0d('0x10')](_0xbd0d('0x47'),_0x2449f3);logger[_0xbd0d('0x11')](_0xbd0d('0x47'),_0x2449f3,JSON[_0xbd0d('0x12')](_0x24b3fc));_0x4e0e43(_0x24b3fc);})[_0xbd0d('0x13')](function(_0x145222){logger[_0xbd0d('0x14')]('ResetActiveCalls',_0x145222['message'],_0x2449f3);_0x58e98e(_0x308839[_0xbd0d('0x14')](0x1f4,_0x145222[_0xbd0d('0x15')]));});});});};exports[_0xbd0d('0x49')]=function(_0x114ab7){var _0x494eba=this;var _0x1c4bc3=_0x114ab7[_0xbd0d('0x1a')][_0xbd0d('0xa')]['voiceQueueIds'];var _0x4cfefa=_0x114ab7[_0xbd0d('0x1a')]['where'][_0xbd0d('0x4a')];var _0x136a2f=_0x114ab7[_0xbd0d('0x1a')][_0xbd0d('0xa')][_0xbd0d('0x4b')];return new Promise(function(_0x2ca7f5,_0xc90cb5){return db[_0xbd0d('0x19')][_0xbd0d('0x25')]({'where':{'voiceQueueId':{'$in':_0x1c4bc3},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xbd0d('0x24')][_0xbd0d('0x3b')]('NOW()\x20+\x20INTERVAL\x20'+_0x4cfefa+_0xbd0d('0x4c')),'$gt':db['sequelize'][_0xbd0d('0x3b')](_0xbd0d('0x4d'))}},'UserId':{'$in':_0x136a2f}},'include':[{'model':db['CmContact'],'as':'Contact'},{'model':db[_0xbd0d('0x2a')],'as':_0xbd0d('0x2b'),'attributes':['id',_0xbd0d('0x2c'),'voicePause']},{'model':db[_0xbd0d('0x4e')],'as':'List'}]})[_0xbd0d('0x17')](function(_0x1f2cd8){if(_0x1f2cd8[_0xbd0d('0x2e')]>0x0){return db[_0xbd0d('0x24')][_0xbd0d('0x48')](function(_0x2a86af){return db[_0xbd0d('0x19')]['update']({'recallmeNotifiedDate':db[_0xbd0d('0x24')][_0xbd0d('0x3b')](_0xbd0d('0x4d'))},{'where':{'id':{'$in':_[_0xbd0d('0xe')](_0x1f2cd8,'id')}},'transaction':_0x2a86af})[_0xbd0d('0x17')](function(){_0x2ca7f5(_0x1f2cd8);})[_0xbd0d('0x13')](function(_0xd70876){logger[_0xbd0d('0x14')](_0xbd0d('0x49'),_0xd70876[_0xbd0d('0x15')],_0x114ab7);_0xc90cb5(_0x494eba[_0xbd0d('0x14')](0x1f4,_0xd70876[_0xbd0d('0x15')]));});})[_0xbd0d('0x13')](function(_0x454745){logger[_0xbd0d('0x14')]('CmHopperHandlePreviewRecallNotifications',_0x454745[_0xbd0d('0x15')],_0x114ab7);_0xc90cb5(_0x494eba[_0xbd0d('0x14')](0x1f4,_0x454745[_0xbd0d('0x15')]));});}else{_0x2ca7f5(_0x1f2cd8);}});});}; \ No newline at end of file +var _0x65f0=['attributes','info','GetCmHopper','debug','error','message','ShowCmHopper','find','then','stringify','catch','CreateCmHopper','UpdateCmHopper','update','body','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','order','UPDATE','Contact','User','Agent','name','voicePause','UserId','push','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','findAll','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','LOCK','GetContactByPhone','findOne','phone','dialTimezone','DESC','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','List','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','CmHopper','options','raw','where','include','map','model'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x65f0,0x8f));var _0x065f=function(_0xf574e7,_0x59eb74){_0xf574e7=_0xf574e7-0x0;var _0x455a3d=_0x65f0[_0xf574e7];return _0x455a3d;};'use strict';var _=require('lodash');var util=require(_0x065f('0x0'));var moment=require(_0x065f('0x1'));var BPromise=require(_0x065f('0x2'));var db=require(_0x065f('0x3'))['db'];var logger=require(_0x065f('0x4'))(_0x065f('0x5'));exports['GetCmHopper']=function(_0x2835cb){var _0x22b2f0=this;return new Promise(function(_0x3aaa5e,_0x3b3ba6){return db[_0x065f('0x6')]['findAll']({'raw':_0x2835cb['options']?_0x2835cb[_0x065f('0x7')][_0x065f('0x8')]===undefined?!![]:![]:!![],'where':_0x2835cb[_0x065f('0x7')]?_0x2835cb['options'][_0x065f('0x9')]||null:null,'attributes':_0x2835cb['options']?_0x2835cb[_0x065f('0x7')]['attributes']||null:null,'limit':_0x2835cb[_0x065f('0x7')]?_0x2835cb[_0x065f('0x7')]['limit']||null:null,'include':_0x2835cb[_0x065f('0x7')]?_0x2835cb[_0x065f('0x7')][_0x065f('0xa')]?_[_0x065f('0xb')](_0x2835cb[_0x065f('0x7')]['include'],function(_0xe4cf00){return{'model':db[_0xe4cf00[_0x065f('0xc')]],'as':_0xe4cf00['as'],'attributes':_0xe4cf00[_0x065f('0xd')],'include':_0xe4cf00['include']?_[_0x065f('0xb')](_0xe4cf00['include'],function(_0xacd69b){return{'model':db[_0xacd69b[_0x065f('0xc')]],'as':_0xacd69b['as'],'attributes':_0xacd69b[_0x065f('0xd')],'include':_0xacd69b['include']?_[_0x065f('0xb')](_0xacd69b['include'],function(_0x1fee80){return{'model':db[_0x1fee80['model']],'as':_0x1fee80['as'],'attributes':_0x1fee80['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5783df){logger[_0x065f('0xe')](_0x065f('0xf'),_0x2835cb);logger[_0x065f('0x10')](_0x065f('0xf'),_0x2835cb,JSON['stringify'](_0x5783df));_0x3aaa5e(_0x5783df);})['catch'](function(_0x5f36fc){logger[_0x065f('0x11')](_0x065f('0xf'),_0x5f36fc[_0x065f('0x12')],_0x2835cb);_0x3b3ba6(_0x22b2f0['error'](0x1f4,_0x5f36fc[_0x065f('0x12')]));});});};exports[_0x065f('0x13')]=function(_0x286f37){var _0x22aac8=this;return new Promise(function(_0x1b7c87,_0xf29215){return db[_0x065f('0x6')][_0x065f('0x14')]({'raw':_0x286f37[_0x065f('0x7')]?_0x286f37[_0x065f('0x7')][_0x065f('0x8')]===undefined?!![]:![]:!![],'where':_0x286f37['options']?_0x286f37[_0x065f('0x7')][_0x065f('0x9')]||null:null,'attributes':_0x286f37[_0x065f('0x7')]?_0x286f37[_0x065f('0x7')]['attributes']||null:null,'include':_0x286f37[_0x065f('0x7')]?_0x286f37[_0x065f('0x7')][_0x065f('0xa')]?_[_0x065f('0xb')](_0x286f37[_0x065f('0x7')]['include'],function(_0x5eb61d){return{'model':db[_0x5eb61d[_0x065f('0xc')]],'as':_0x5eb61d['as'],'attributes':_0x5eb61d[_0x065f('0xd')],'include':_0x5eb61d[_0x065f('0xa')]?_[_0x065f('0xb')](_0x5eb61d[_0x065f('0xa')],function(_0x278f69){return{'model':db[_0x278f69[_0x065f('0xc')]],'as':_0x278f69['as'],'attributes':_0x278f69[_0x065f('0xd')],'include':_0x278f69[_0x065f('0xa')]?_['map'](_0x278f69[_0x065f('0xa')],function(_0x33d8fb){return{'model':db[_0x33d8fb[_0x065f('0xc')]],'as':_0x33d8fb['as'],'attributes':_0x33d8fb[_0x065f('0xd')]};}):[]};}):[]};}):[]:[]})[_0x065f('0x15')](function(_0x1d2318){logger[_0x065f('0xe')](_0x065f('0x13'),_0x286f37);logger[_0x065f('0x10')](_0x065f('0x13'),_0x286f37,JSON[_0x065f('0x16')](_0x1d2318));_0x1b7c87(_0x1d2318);})[_0x065f('0x17')](function(_0x51036b){logger[_0x065f('0x11')](_0x065f('0x13'),_0x51036b[_0x065f('0x12')],_0x286f37);_0xf29215(_0x22aac8[_0x065f('0x11')](0x1f4,_0x51036b['message']));});});};exports[_0x065f('0x18')]=function(_0x49bf38){var _0x19f168=this;return new Promise(function(_0x54060e,_0x401cbc){return db[_0x065f('0x6')]['create'](_0x49bf38['body'],{'raw':_0x49bf38['options']?_0x49bf38['options']['raw']===undefined?!![]:![]:!![]})[_0x065f('0x15')](function(_0x13ca17){logger[_0x065f('0xe')](_0x065f('0x18'),_0x49bf38);logger[_0x065f('0x10')](_0x065f('0x18'),_0x49bf38,JSON[_0x065f('0x16')](_0x13ca17));_0x54060e(_0x13ca17);})[_0x065f('0x17')](function(_0xbd3819){logger[_0x065f('0x11')](_0x065f('0x18'),_0xbd3819[_0x065f('0x12')],_0x49bf38);_0x401cbc(_0x19f168[_0x065f('0x11')](0x1f4,_0xbd3819['message']));});});};exports[_0x065f('0x19')]=function(_0x441420){var _0x44a606=this;return new Promise(function(_0x12342a,_0x2606d1){return db[_0x065f('0x6')][_0x065f('0x1a')](_0x441420[_0x065f('0x1b')],{'raw':_0x441420[_0x065f('0x7')]?_0x441420[_0x065f('0x7')][_0x065f('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x441420[_0x065f('0x7')]?_0x441420[_0x065f('0x7')]['where']||null:null,'attributes':_0x441420[_0x065f('0x7')]?_0x441420[_0x065f('0x7')][_0x065f('0xd')]||null:null,'limit':_0x441420['options']?_0x441420[_0x065f('0x7')][_0x065f('0x1c')]||null:null})[_0x065f('0x15')](function(_0x4219ec){logger['info'](_0x065f('0x19'),_0x441420);logger[_0x065f('0xe')](_0x065f('0x1d'),JSON['stringify'](_0x441420['options'][_0x065f('0x9')]),_0x441420['body'][_0x065f('0x1e')]);logger[_0x065f('0x10')]('UpdateCmHopper',_0x441420,JSON[_0x065f('0x16')](_0x4219ec));_0x12342a(_0x4219ec);})['catch'](function(_0x4ac169){logger['error'](_0x065f('0x19'),_0x4ac169[_0x065f('0x12')],_0x441420);_0x2606d1(_0x44a606[_0x065f('0x11')](0x1f4,_0x4ac169[_0x065f('0x12')]));});});};exports[_0x065f('0x1f')]=function(_0x4d5392){var _0x563b97=this;return new Promise(function(_0x39d314,_0x361b4b){return db['CmHopper']['destroy']({'where':_0x4d5392[_0x065f('0x7')]?_0x4d5392[_0x065f('0x7')][_0x065f('0x9')]||null:null})[_0x065f('0x15')](function(_0xd6af2c){logger[_0x065f('0xe')]('DestroyCmHopper',_0x4d5392);logger['debug'](_0x065f('0x1f'),_0x4d5392,JSON[_0x065f('0x16')](_0xd6af2c));_0x39d314(_0xd6af2c);})[_0x065f('0x17')](function(_0xdce713){logger[_0x065f('0x11')](_0x065f('0x1f'),_0xdce713[_0x065f('0x12')],_0x4d5392);_0x361b4b(_0x563b97['error'](0x1f4,_0xdce713['message']));});});};exports[_0x065f('0x20')]=function(_0xb359ef){var _0x195503=this;return new Promise(function(_0x220f97,_0x49796c){return db[_0x065f('0x21')][_0x065f('0x22')]()[_0x065f('0x15')](function(_0x57df1e){return db[_0x065f('0x23')]['transaction'](function(_0x4ca517){return db[_0x065f('0x6')]['findAll']({'where':_0xb359ef[_0x065f('0x7')]?_0xb359ef[_0x065f('0x7')][_0x065f('0x9')]||null:null,'attributes':_0xb359ef[_0x065f('0x7')]?_0xb359ef[_0x065f('0x7')][_0x065f('0xd')]||null:null,'limit':_0xb359ef['options']?_0xb359ef['options'][_0x065f('0x1c')]||null:null,'order':_0xb359ef[_0x065f('0x7')]?_0xb359ef[_0x065f('0x7')][_0x065f('0x24')]||null:null,'transaction':_0x4ca517,'lock':_0x4ca517['LOCK'][_0x065f('0x25')],'include':[{'model':db[_0x065f('0x21')],'as':_0x065f('0x26'),'attributes':_['keys'](_0x57df1e)},{'model':db[_0x065f('0x27')],'as':_0x065f('0x28'),'attributes':['id',_0x065f('0x29'),_0x065f('0x2a')]}]})[_0x065f('0x15')](function(_0x3ed843){var _0x3ea7e6=[];var _0x136f34=[];for(var _0x4f9e68=0x0;_0x4f9e68<_0x3ed843['length'];_0x4f9e68+=0x1){var _0x23742e=_0x3ed843[_0x4f9e68][_0x065f('0x2b')];if(_0x23742e===null){_0x3ea7e6[_0x065f('0x2c')](_0x3ed843[_0x4f9e68][_0x065f('0x1a')](_0xb359ef[_0x065f('0x1b')],{'transaction':_0x4ca517}));}else if(!_0x136f34['includes'](_0x23742e)){_0x136f34[_0x065f('0x2c')](_0x23742e);_0x3ea7e6[_0x065f('0x2c')](_0x3ed843[_0x4f9e68][_0x065f('0x1a')](_0xb359ef[_0x065f('0x1b')],{'transaction':_0x4ca517}));}}return BPromise[_0x065f('0x2d')](_0x3ea7e6);});})[_0x065f('0x15')](function(_0x28a6d0){logger['info'](_0x065f('0x20'),_0xb359ef);if(_0x28a6d0[_0x065f('0x2e')]>0x0){logger[_0x065f('0xe')](_0x065f('0x2f'),_0x28a6d0[0x0]['dataValues']['id'],_0x28a6d0[0x0][_0x065f('0x30')][_0x065f('0x31')],_0x28a6d0[0x0]['dataValues'][_0x065f('0x1e')]);}logger['debug'](_0x065f('0x20'),_0xb359ef,JSON[_0x065f('0x16')](_0x28a6d0));_0x220f97(_0x28a6d0);})[_0x065f('0x17')](function(_0x5a9904){logger[_0x065f('0x11')](_0x065f('0x20'),_0x5a9904[_0x065f('0x12')],_0xb359ef);_0x49796c(_0x195503[_0x065f('0x11')](0x1f4,_0x5a9904['message']));});});});};exports['MoveContactManagedDialer']=function(_0x1bf3cd){var _0x468b11=this;return new Promise(function(_0x3ec701,_0x3a17b5){return db[_0x065f('0x23')][_0x065f('0x32')](function(_0x4a17e4){return db[_0x065f('0x33')]['create'](_0x1bf3cd[_0x065f('0x1b')],{'raw':_0x1bf3cd[_0x065f('0x7')]?_0x1bf3cd['options'][_0x065f('0x8')]===undefined?!![]:![]:!![],'transaction':_0x4a17e4})[_0x065f('0x15')](function(){logger[_0x065f('0xe')](_0x065f('0x34'),JSON['stringify'](_0x1bf3cd[_0x065f('0x7')][_0x065f('0x9')]),_0x1bf3cd[_0x065f('0x7')][_0x065f('0x9')][_0x065f('0x1e')]);return db[_0x065f('0x6')]['destroy']({'where':_0x1bf3cd[_0x065f('0x7')]?_0x1bf3cd[_0x065f('0x7')][_0x065f('0x9')]||null:null,'transaction':_0x4a17e4});});})['then'](function(_0x1671e1){logger[_0x065f('0xe')]('MoveContactManagedDialer',_0x1bf3cd);logger[_0x065f('0x10')](_0x065f('0x35'),_0x1bf3cd,JSON[_0x065f('0x16')](_0x1671e1));_0x3ec701(_0x1671e1);})['catch'](function(_0x58490e){logger[_0x065f('0x11')](_0x065f('0x35'),_0x58490e['message'],_0x1bf3cd);_0x3a17b5(_0x468b11['error'](0x1f4,_0x58490e[_0x065f('0x12')]));});});};exports[_0x065f('0x36')]=function(_0x4220a5){var _0x3a28b4=this;return new Promise(function(_0x13807b,_0x28ba96){return db['CmHopper'][_0x065f('0x37')]({'raw':_0x4220a5['options']?_0x4220a5[_0x065f('0x7')][_0x065f('0x8')]===undefined?!![]:![]:!![],'where':_0x4220a5[_0x065f('0x7')]?_0x4220a5['options'][_0x065f('0x9')]||null:null,'attributes':[[db['sequelize']['fn'](_0x065f('0x38'),db['sequelize']['fn']('IF',db[_0x065f('0x23')][_0x065f('0x39')](_0x065f('0x3a')+util[_0x065f('0x3b')](_0x065f('0x3c'),moment()[_0x065f('0x3b')](_0x065f('0x3d')))+'\x20,\x201,\x20null'))),_0x065f('0x3e')]]})[_0x065f('0x15')](function(_0x58033e){logger[_0x065f('0xe')]('CountReScheduled',_0x4220a5);logger['debug'](_0x065f('0x36'),_0x4220a5,JSON[_0x065f('0x16')](_0x58033e));_0x13807b(_0x58033e);})[_0x065f('0x17')](function(_0x4452cb){logger[_0x065f('0x11')](_0x065f('0x36'),_0x4452cb[_0x065f('0x12')],_0x4220a5);_0x28ba96(_0x3a28b4[_0x065f('0x11')](0x1f4,_0x4452cb[_0x065f('0x12')]));});});};exports[_0x065f('0x3f')]=function(_0x3b2c6a){var _0x362614=this;return new Promise(function(_0x41ea08,_0x9b23cf){return db[_0x065f('0x21')][_0x065f('0x22')]()['then'](function(){return db[_0x065f('0x23')]['transaction'](function(_0x588413){return db[_0x065f('0x6')][_0x065f('0x37')]({'where':_0x3b2c6a['options']?_0x3b2c6a[_0x065f('0x7')][_0x065f('0x9')]||null:null,'attributes':_0x3b2c6a[_0x065f('0x7')]?_0x3b2c6a[_0x065f('0x7')]['attributes']||null:null,'limit':0x1,'order':_0x3b2c6a[_0x065f('0x7')]?_0x3b2c6a[_0x065f('0x7')][_0x065f('0x24')]||null:null,'group':db[_0x065f('0x6')][_0x065f('0x2b')],'transaction':_0x588413,'lock':_0x588413[_0x065f('0x40')][_0x065f('0x25')],'include':_0x3b2c6a[_0x065f('0x7')]?_0x3b2c6a[_0x065f('0x7')][_0x065f('0xa')]?_['map'](_0x3b2c6a['options'][_0x065f('0xa')],function(_0x42dd16){return{'model':db[_0x42dd16['model']],'as':_0x42dd16['as'],'attributes':_0x42dd16['attributes'],'include':_0x42dd16[_0x065f('0xa')]?_['map'](_0x42dd16[_0x065f('0xa')],function(_0x5ce17b){return{'model':db[_0x5ce17b[_0x065f('0xc')]],'as':_0x5ce17b['as'],'attributes':_0x5ce17b[_0x065f('0xd')],'include':_0x5ce17b[_0x065f('0xa')]?_[_0x065f('0xb')](_0x5ce17b[_0x065f('0xa')],function(_0x2f96f5){return{'model':db[_0x2f96f5[_0x065f('0xc')]],'as':_0x2f96f5['as'],'attributes':_0x2f96f5[_0x065f('0xd')]};}):[]};}):[]};}):[]:[]})[_0x065f('0x15')](function(_0x555da4){var _0x5c283b=[];for(var _0x5e1fcd=0x0;_0x5e1fcd<_0x555da4[_0x065f('0x2e')];_0x5e1fcd+=0x1){_0x5c283b[_0x065f('0x2c')](_0x555da4[_0x5e1fcd]['update'](_0x3b2c6a[_0x065f('0x1b')],{'transaction':_0x588413}));}return BPromise[_0x065f('0x2d')](_0x5c283b);});})['then'](function(_0x301f9a){logger['info'](_0x065f('0x3f'),_0x3b2c6a);logger[_0x065f('0x10')](_0x065f('0x3f'),_0x3b2c6a,JSON['stringify'](_0x301f9a));_0x41ea08(_0x301f9a);})['catch'](function(_0x4692f9){logger[_0x065f('0x11')](_0x065f('0x3f'),_0x4692f9[_0x065f('0x12')],_0x3b2c6a);_0x9b23cf(_0x362614[_0x065f('0x11')](0x1f4,_0x4692f9[_0x065f('0x12')]));});});});};exports['GetCmHopperPreview']=function(_0x2b5d28){var _0x4ad36e=this;return new Promise(function(_0xbe54a,_0x14e2e7){db[_0x065f('0x21')][_0x065f('0x22')]()['then'](function(_0x28ee21){return db[_0x065f('0x6')]['findAll']({'raw':_0x2b5d28[_0x065f('0x7')]?_0x2b5d28['options']['raw']===undefined?!![]:![]:!![],'where':_0x2b5d28[_0x065f('0x7')]?_0x2b5d28['options'][_0x065f('0x9')]||null:null,'attributes':_0x2b5d28[_0x065f('0x7')]?_0x2b5d28[_0x065f('0x7')]['attributes']||null:null,'limit':_0x2b5d28[_0x065f('0x7')]?_0x2b5d28['options'][_0x065f('0x1c')]||null:null,'include':_0x2b5d28[_0x065f('0x7')]?_0x2b5d28[_0x065f('0x7')][_0x065f('0xa')]?_[_0x065f('0xb')](_0x2b5d28[_0x065f('0x7')]['include'],function(_0x238f1b){return{'model':db[_0x238f1b[_0x065f('0xc')]],'as':_0x238f1b['as'],'attributes':_0x238f1b['as']===_0x065f('0x26')?_['keys'](_0x28ee21):_0x238f1b['attributes'],'include':_0x238f1b[_0x065f('0xa')]?_[_0x065f('0xb')](_0x238f1b[_0x065f('0xa')],function(_0x598152){return{'model':db[_0x598152[_0x065f('0xc')]],'as':_0x598152['as'],'attributes':_0x598152[_0x065f('0xd')],'include':_0x598152['include']?_[_0x065f('0xb')](_0x598152[_0x065f('0xa')],function(_0x4bd85c){return{'model':db[_0x4bd85c[_0x065f('0xc')]],'as':_0x4bd85c['as'],'attributes':_0x4bd85c[_0x065f('0xd')]};}):[]};}):[]};}):[]:[]})[_0x065f('0x15')](function(_0x32544f){logger[_0x065f('0xe')](_0x065f('0xf'),_0x2b5d28);logger[_0x065f('0x10')]('GetCmHopper',_0x2b5d28,JSON[_0x065f('0x16')](_0x32544f));_0xbe54a(_0x32544f);})[_0x065f('0x17')](function(_0x5661af){logger[_0x065f('0x11')]('GetCmHopper',_0x5661af['message'],_0x2b5d28);_0x14e2e7(_0x4ad36e[_0x065f('0x11')](0x1f4,_0x5661af[_0x065f('0x12')]));});});});};exports[_0x065f('0x41')]=function(_0x3a6e58){var _0x3ecab5=this;return new Promise(function(_0x40fe6e,_0x50913f){return db[_0x065f('0x21')][_0x065f('0x42')]({'raw':!![],'where':{'phone':_0x3a6e58[_0x065f('0x7')][_0x065f('0x9')][_0x065f('0x43')]},'attributes':['id',_0x065f('0x44')],'order':[['id',_0x065f('0x45')]]})[_0x065f('0x15')](function(_0x5db027){logger[_0x065f('0xe')]('getContactByPhone',_0x3a6e58);logger[_0x065f('0x10')]('getContactByPhone',_0x3a6e58,JSON[_0x065f('0x16')](_0x5db027));_0x40fe6e(_0x5db027);})[_0x065f('0x17')](function(_0x106969){logger[_0x065f('0x11')]('getContactByPhone',_0x106969['message'],_0x3a6e58);_0x50913f(_0x3ecab5['error'](0x1f4,_0x106969[_0x065f('0x12')]));});});};exports['ResetActiveCalls']=function(_0x4ab0c2){var _0x117aa1=this;return new Promise(function(_0x37f408,_0x5bdf5a){return db[_0x065f('0x23')][_0x065f('0x32')](function(_0x239d4a){var _0x3c07a1=_0x4ab0c2[_0x065f('0x7')]&&_0x4ab0c2[_0x065f('0x7')][_0x065f('0x9')]?_0x4ab0c2['options']['where']:{};return db[_0x065f('0x6')][_0x065f('0x1a')](_0x4ab0c2[_0x065f('0x1b')],{'where':_0x3c07a1,'transaction':_0x239d4a})[_0x065f('0x15')](function(_0x2f0621){logger[_0x065f('0xe')]('ResetActiveCalls',_0x4ab0c2);logger['debug'](_0x065f('0x46'),_0x4ab0c2,JSON['stringify'](_0x2f0621));_0x37f408(_0x2f0621);})[_0x065f('0x17')](function(_0xf3c8ba){logger[_0x065f('0x11')]('ResetActiveCalls',_0xf3c8ba[_0x065f('0x12')],_0x4ab0c2);_0x5bdf5a(_0x117aa1[_0x065f('0x11')](0x1f4,_0xf3c8ba[_0x065f('0x12')]));});});});};exports[_0x065f('0x47')]=function(_0x400095){var _0x2ca8d3=this;var _0x4ab31d=_0x400095[_0x065f('0x1b')][_0x065f('0x9')]['voiceQueueIds'];var _0x576af6=_0x400095['body']['where'][_0x065f('0x48')];var _0x2f5b50=_0x400095[_0x065f('0x1b')][_0x065f('0x9')][_0x065f('0x49')];return new Promise(function(_0x4ca48a,_0x1e0fec){return db[_0x065f('0x6')][_0x065f('0x37')]({'where':{'voiceQueueId':{'$in':_0x4ab31d},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x065f('0x23')]['literal'](_0x065f('0x4a')+_0x576af6+_0x065f('0x4b')),'$gt':db[_0x065f('0x23')][_0x065f('0x39')](_0x065f('0x4c'))}},'UserId':{'$in':_0x2f5b50}},'include':[{'model':db[_0x065f('0x21')],'as':_0x065f('0x26')},{'model':db[_0x065f('0x27')],'as':'Agent','attributes':['id',_0x065f('0x29'),_0x065f('0x2a')]},{'model':db['CmList'],'as':_0x065f('0x4d')}]})['then'](function(_0x55cc4f){if(_0x55cc4f[_0x065f('0x2e')]>0x0){return db[_0x065f('0x23')][_0x065f('0x32')](function(_0x5069ee){return db[_0x065f('0x6')][_0x065f('0x1a')]({'recallmeNotifiedDate':db['sequelize'][_0x065f('0x39')]('NOW()')},{'where':{'id':{'$in':_['map'](_0x55cc4f,'id')}},'transaction':_0x5069ee})['then'](function(){_0x4ca48a(_0x55cc4f);})[_0x065f('0x17')](function(_0x27a068){logger[_0x065f('0x11')]('CmHopperHandlePreviewRecallNotifications',_0x27a068['message'],_0x400095);_0x1e0fec(_0x2ca8d3['error'](0x1f4,_0x27a068[_0x065f('0x12')]));});})[_0x065f('0x17')](function(_0x16c731){logger[_0x065f('0x11')](_0x065f('0x47'),_0x16c731['message'],_0x400095);_0x1e0fec(_0x2ca8d3[_0x065f('0x11')](0x1f4,_0x16c731[_0x065f('0x12')]));});}else{_0x4ca48a(_0x55cc4f);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index dd6fc55..f11c247 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 _0x9015=['create','/preview','getPreview','post','getTimezone','put','delete','exports','express','../../components/auth/service','get','isAuthenticated','/describe','describe','/opencontacts','getOpenContacts','/timezones','/:id','show','/:id/previewrecall','getPreviewRecall'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9015,0x158));var _0x5901=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x9015[_0x17d9e3];return _0x14192d;};'use strict';var express=require(_0x5901('0x0'));var router=express['Router']();var auth=require(_0x5901('0x1'));var controller=require('./cmHopper.controller');router[_0x5901('0x2')]('/',auth[_0x5901('0x3')](),controller['index']);router[_0x5901('0x2')](_0x5901('0x4'),auth[_0x5901('0x3')](),controller[_0x5901('0x5')]);router[_0x5901('0x2')](_0x5901('0x6'),auth[_0x5901('0x3')](),controller[_0x5901('0x7')]);router[_0x5901('0x2')](_0x5901('0x8'),auth['isAuthenticated'](),controller['getTimezones']);router[_0x5901('0x2')](_0x5901('0x9'),auth[_0x5901('0x3')](),controller[_0x5901('0xa')]);router[_0x5901('0x2')](_0x5901('0xb'),auth[_0x5901('0x3')](),controller[_0x5901('0xc')]);router['post']('/',auth[_0x5901('0x3')](),controller[_0x5901('0xd')]);router['post'](_0x5901('0xe'),auth[_0x5901('0x3')](),controller[_0x5901('0xf')]);router[_0x5901('0x10')]('/timezone',auth[_0x5901('0x3')](),controller[_0x5901('0x11')]);router[_0x5901('0x12')](_0x5901('0x9'),auth[_0x5901('0x3')](),controller['update']);router[_0x5901('0x13')](_0x5901('0x9'),auth[_0x5901('0x3')](),controller['destroy']);module[_0x5901('0x14')]=router; \ No newline at end of file +var _0xc0a6=['/describe','describe','/opencontacts','getOpenContacts','/:id','show','/:id/previewrecall','getPreviewRecall','create','post','/preview','getPreview','/timezone','getTimezone','put','update','delete','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index'];(function(_0x35e019,_0x383ecf){var _0x1d1a35=function(_0xdd884){while(--_0xdd884){_0x35e019['push'](_0x35e019['shift']());}};_0x1d1a35(++_0x383ecf);}(_0xc0a6,0x170));var _0x6c0a=function(_0x308944,_0x1c462e){_0x308944=_0x308944-0x0;var _0x2bf805=_0xc0a6[_0x308944];return _0x2bf805;};'use strict';var express=require(_0x6c0a('0x0'));var router=express[_0x6c0a('0x1')]();var auth=require(_0x6c0a('0x2'));var controller=require(_0x6c0a('0x3'));router[_0x6c0a('0x4')]('/',auth[_0x6c0a('0x5')](),controller[_0x6c0a('0x6')]);router[_0x6c0a('0x4')](_0x6c0a('0x7'),auth[_0x6c0a('0x5')](),controller[_0x6c0a('0x8')]);router[_0x6c0a('0x4')](_0x6c0a('0x9'),auth[_0x6c0a('0x5')](),controller[_0x6c0a('0xa')]);router[_0x6c0a('0x4')]('/timezones',auth[_0x6c0a('0x5')](),controller['getTimezones']);router['get'](_0x6c0a('0xb'),auth[_0x6c0a('0x5')](),controller[_0x6c0a('0xc')]);router['get'](_0x6c0a('0xd'),auth['isAuthenticated'](),controller[_0x6c0a('0xe')]);router['post']('/',auth[_0x6c0a('0x5')](),controller[_0x6c0a('0xf')]);router[_0x6c0a('0x10')](_0x6c0a('0x11'),auth[_0x6c0a('0x5')](),controller[_0x6c0a('0x12')]);router[_0x6c0a('0x10')](_0x6c0a('0x13'),auth[_0x6c0a('0x5')](),controller[_0x6c0a('0x14')]);router[_0x6c0a('0x15')](_0x6c0a('0xb'),auth[_0x6c0a('0x5')](),controller[_0x6c0a('0x16')]);router[_0x6c0a('0x17')](_0x6c0a('0xb'),auth[_0x6c0a('0x5')](),controller['destroy']);module[_0x6c0a('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 896aa49..7292343 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5025=['format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','INTEGER','DATE'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5025,0x1dc));var _0x5502=function(_0xf0f9ae,_0x3b02ef){_0xf0f9ae=_0xf0f9ae-0x0;var _0x46b898=_0x5025[_0xf0f9ae];return _0x46b898;};'use strict';var moment=require(_0x5502('0x0'));var Sequelize=require(_0x5502('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0x5502('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x5502('0x3')],'defaultValue':moment()[_0x5502('0x4')](_0x5502('0x5'))},'countbusyretry':{'type':Sequelize[_0x5502('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5502('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x5502('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5502('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5502('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5502('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xad7f=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','INTEGER','STRING','format'];(function(_0x49dde0,_0x201f76){var _0xca4e5=function(_0xe5e963){while(--_0xe5e963){_0x49dde0['push'](_0x49dde0['shift']());}};_0xca4e5(++_0x201f76);}(_0xad7f,0x1a5));var _0xfad7=function(_0x5393a6,_0x3c972d){_0x5393a6=_0x5393a6-0x0;var _0x477463=_0xad7f[_0x5393a6];return _0x477463;};'use strict';var moment=require(_0xfad7('0x0'));var Sequelize=require(_0xfad7('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0xfad7('0x2')]},'phone':{'type':Sequelize[_0xfad7('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xfad7('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xfad7('0x4')](_0xfad7('0x5'))},'countbusyretry':{'type':Sequelize[_0xfad7('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xfad7('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xfad7('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfad7('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfad7('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfad7('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfad7('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index a9a37a9..08ba457 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2cc6=['count','offset','set','Content-Range','apply','reject','save','update','then','CmHopperAdditionalPhones','destroy','error','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','type','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','include','findAll','rows','show','params','keys','includeAll','find','catch','create','user','role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','end','json','limit'];(function(_0x1a7159,_0x7df95a){var _0x394328=function(_0x714cf){while(--_0x714cf){_0x1a7159['push'](_0x1a7159['shift']());}};_0x394328(++_0x7df95a);}(_0x2cc6,0xce));var _0x62cc=function(_0x75267d,_0x5d286c){_0x75267d=_0x75267d-0x0;var _0x21ccec=_0x2cc6[_0x75267d];return _0x21ccec;};'use strict';var emlformat=require(_0x62cc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x62cc('0x1'));var jsonpatch=require(_0x62cc('0x2'));var rp=require(_0x62cc('0x3'));var moment=require(_0x62cc('0x4'));var BPromise=require(_0x62cc('0x5'));var Mustache=require('mustache');var util=require(_0x62cc('0x6'));var path=require(_0x62cc('0x7'));var sox=require(_0x62cc('0x8'));var csv=require(_0x62cc('0x9'));var ejs=require(_0x62cc('0xa'));var fs=require('fs');var fs_extra=require(_0x62cc('0xb'));var _=require(_0x62cc('0xc'));var squel=require(_0x62cc('0xd'));var crypto=require(_0x62cc('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x62cc('0xf'));var toCsv=require(_0x62cc('0x9'));var querystring=require('querystring');var Papa=require(_0x62cc('0x10'));var Redis=require(_0x62cc('0x11'));var authService=require(_0x62cc('0x12'));var qs=require(_0x62cc('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x62cc('0x14'));var logger=require('../../config/logger')(_0x62cc('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x62cc('0x16'));var db=require(_0x62cc('0x17'))['db'];function respondWithStatusCode(_0x238cee,_0x25ac65){_0x25ac65=_0x25ac65||0xcc;return function(_0x542ffa){if(_0x542ffa){return _0x238cee['sendStatus'](_0x25ac65);}return _0x238cee[_0x62cc('0x18')](_0x25ac65)[_0x62cc('0x19')]();};}function respondWithResult(_0x34596a,_0x35799b){_0x35799b=_0x35799b||0xc8;return function(_0x19f4a7){if(_0x19f4a7){return _0x34596a['status'](_0x35799b)[_0x62cc('0x1a')](_0x19f4a7);}};}function respondWithFilteredResult(_0x523431,_0x2b34f1){return function(_0x125922){if(_0x125922){var _0xf6c104=typeof _0x2b34f1['offset']==='undefined'&&typeof _0x2b34f1[_0x62cc('0x1b')]==='undefined';var _0x55e773=_0x125922[_0x62cc('0x1c')];var _0x385749=_0xf6c104?0x0:_0x2b34f1[_0x62cc('0x1d')];var _0x5be90e=_0xf6c104?_0x125922[_0x62cc('0x1c')]:_0x2b34f1[_0x62cc('0x1d')]+_0x2b34f1[_0x62cc('0x1b')];var _0x42df72;if(_0x5be90e>=_0x55e773){_0x5be90e=_0x55e773;_0x42df72=0xc8;}else{_0x42df72=0xce;}_0x523431[_0x62cc('0x18')](_0x42df72);return _0x523431[_0x62cc('0x1e')](_0x62cc('0x1f'),_0x385749+'-'+_0x5be90e+'/'+_0x55e773)['json'](_0x125922);}return null;};}function patchUpdates(_0x3eaa99){return function(_0x2d140a){try{jsonpatch[_0x62cc('0x20')](_0x2d140a,_0x3eaa99,!![]);}catch(_0x902323){return BPromise[_0x62cc('0x21')](_0x902323);}return _0x2d140a[_0x62cc('0x22')]();};}function saveUpdates(_0x34d187,_0x4551db){return function(_0x5e368a){if(_0x5e368a){return _0x5e368a[_0x62cc('0x23')](_0x34d187)[_0x62cc('0x24')](function(_0x5c5ccc){return _0x5c5ccc;});}return null;};}function removeEntity(_0x26b6a8,_0x2a384f){return function(_0x34fb82){if(_0x34fb82){return _0x34fb82['destroy']()[_0x62cc('0x24')](function(){var _0x577500=_0x34fb82['get']({'plain':!![]});var _0x4fecd2=_0x62cc('0x25');return db['UserProfileResource'][_0x62cc('0x26')]({'where':{'type':_0x4fecd2,'resourceId':_0x577500['id']}})[_0x62cc('0x24')](function(){return _0x34fb82;});})[_0x62cc('0x24')](function(){_0x26b6a8[_0x62cc('0x18')](0xcc)[_0x62cc('0x19')]();});}};}function handleEntityNotFound(_0x47e8f2,_0x33ff47){return function(_0x130947){if(!_0x130947){_0x47e8f2['sendStatus'](0x194);}return _0x130947;};}function handleError(_0x32e3af,_0x21f2a4){_0x21f2a4=_0x21f2a4||0x1f4;return function(_0x5c3d25){logger[_0x62cc('0x27')](_0x5c3d25['stack']);if(_0x5c3d25[_0x62cc('0x28')]){delete _0x5c3d25[_0x62cc('0x28')];}_0x32e3af['status'](_0x21f2a4)[_0x62cc('0x29')](_0x5c3d25);};}exports[_0x62cc('0x2a')]=function(_0x3f65a7,_0x204236){var _0x2f5c19={},_0x37264b={},_0x9b67fd={'count':0x0,'rows':[]};var _0x17a812=_[_0x62cc('0x2b')](db[_0x62cc('0x2c')][_0x62cc('0x2d')],function(_0x32f739){return{'name':_0x32f739['fieldName'],'type':_0x32f739[_0x62cc('0x2e')]['key']};});_0x37264b['model']=_['map'](_0x17a812,_0x62cc('0x28'));_0x37264b['query']=_['keys'](_0x3f65a7['query']);_0x37264b[_0x62cc('0x2f')]=_[_0x62cc('0x30')](_0x37264b[_0x62cc('0x31')],_0x37264b[_0x62cc('0x32')]);_0x2f5c19[_0x62cc('0x33')]=_[_0x62cc('0x30')](_0x37264b['model'],qs['fields'](_0x3f65a7[_0x62cc('0x32')][_0x62cc('0x34')]));_0x2f5c19[_0x62cc('0x33')]=_0x2f5c19[_0x62cc('0x33')][_0x62cc('0x35')]?_0x2f5c19[_0x62cc('0x33')]:_0x37264b['model'];if(!_0x3f65a7[_0x62cc('0x32')][_0x62cc('0x36')]('nolimit')){_0x2f5c19[_0x62cc('0x1b')]=qs[_0x62cc('0x1b')](_0x3f65a7[_0x62cc('0x32')][_0x62cc('0x1b')]);_0x2f5c19['offset']=qs['offset'](_0x3f65a7[_0x62cc('0x32')][_0x62cc('0x1d')]);}_0x2f5c19[_0x62cc('0x37')]=qs[_0x62cc('0x38')](_0x3f65a7[_0x62cc('0x32')][_0x62cc('0x38')]);_0x2f5c19[_0x62cc('0x39')]=qs['filters'](_['pick'](_0x3f65a7['query'],_0x37264b[_0x62cc('0x2f')]),_0x17a812);if(_0x3f65a7[_0x62cc('0x32')]['filter']){_0x2f5c19['where']=_[_0x62cc('0x3a')](_0x2f5c19['where'],{'$or':_[_0x62cc('0x2b')](_0x17a812,function(_0x59654c){if(_0x59654c[_0x62cc('0x2e')]!==_0x62cc('0x3b')){var _0x3b8677={};_0x3b8677[_0x59654c[_0x62cc('0x28')]]={'$like':'%'+_0x3f65a7[_0x62cc('0x32')][_0x62cc('0x3c')]+'%'};return _0x3b8677;}})});}_0x2f5c19=_[_0x62cc('0x3a')]({},_0x2f5c19,_0x3f65a7['options']);var _0x2b4086={'where':_0x2f5c19[_0x62cc('0x39')]};return db[_0x62cc('0x2c')]['count'](_0x2b4086)[_0x62cc('0x24')](function(_0x864f9f){_0x9b67fd[_0x62cc('0x1c')]=_0x864f9f;if(_0x3f65a7['query']['includeAll']){_0x2f5c19[_0x62cc('0x3d')]=[{'all':!![]}];}return db[_0x62cc('0x2c')][_0x62cc('0x3e')](_0x2f5c19);})[_0x62cc('0x24')](function(_0x4ca0f2){_0x9b67fd[_0x62cc('0x3f')]=_0x4ca0f2;return _0x9b67fd;})[_0x62cc('0x24')](respondWithFilteredResult(_0x204236,_0x2f5c19))['catch'](handleError(_0x204236,null));};exports[_0x62cc('0x40')]=function(_0x56cb57,_0x132c2d){var _0x5776e5={'raw':!![],'where':{'id':_0x56cb57[_0x62cc('0x41')]['id']}},_0xb7bbe7={};_0xb7bbe7[_0x62cc('0x31')]=_[_0x62cc('0x42')](db[_0x62cc('0x2c')][_0x62cc('0x2d')]);_0xb7bbe7[_0x62cc('0x32')]=_[_0x62cc('0x42')](_0x56cb57[_0x62cc('0x32')]);_0xb7bbe7['filters']=_[_0x62cc('0x30')](_0xb7bbe7[_0x62cc('0x31')],_0xb7bbe7[_0x62cc('0x32')]);_0x5776e5[_0x62cc('0x33')]=_[_0x62cc('0x30')](_0xb7bbe7['model'],qs[_0x62cc('0x34')](_0x56cb57[_0x62cc('0x32')][_0x62cc('0x34')]));_0x5776e5[_0x62cc('0x33')]=_0x5776e5[_0x62cc('0x33')][_0x62cc('0x35')]?_0x5776e5[_0x62cc('0x33')]:_0xb7bbe7['model'];if(_0x56cb57[_0x62cc('0x32')][_0x62cc('0x43')]){_0x5776e5['include']=[{'all':!![]}];}_0x5776e5=_['merge']({},_0x5776e5,_0x56cb57['options']);return db[_0x62cc('0x2c')][_0x62cc('0x44')](_0x5776e5)[_0x62cc('0x24')](handleEntityNotFound(_0x132c2d,null))[_0x62cc('0x24')](respondWithResult(_0x132c2d,null))[_0x62cc('0x45')](handleError(_0x132c2d,null));};exports['create']=function(_0x2a6309,_0x72cd8){return db[_0x62cc('0x2c')][_0x62cc('0x46')](_0x2a6309['body'],{})['then'](function(_0x425c65){var _0x2325d2=_0x2a6309[_0x62cc('0x47')]['get']({'plain':!![]});if(!_0x2325d2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2325d2[_0x62cc('0x48')]===_0x62cc('0x47')){var _0x977ce=_0x425c65[_0x62cc('0x49')]({'plain':!![]});var _0x12157d=_0x62cc('0x25');return db[_0x62cc('0x4a')]['find']({'where':{'name':_0x12157d,'userProfileId':_0x2325d2[_0x62cc('0x4b')]},'raw':!![]})[_0x62cc('0x24')](function(_0x4314b2){if(_0x4314b2&&_0x4314b2['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x977ce[_0x62cc('0x28')],'resourceId':_0x977ce['id'],'type':_0x4314b2[_0x62cc('0x28')],'sectionId':_0x4314b2['id']},{})['then'](function(){return _0x425c65;});}else{return _0x425c65;}})[_0x62cc('0x45')](function(_0x2117e1){logger[_0x62cc('0x27')](_0x62cc('0x4c'),_0x2117e1);throw _0x2117e1;});}return _0x425c65;})[_0x62cc('0x24')](respondWithResult(_0x72cd8,0xc9))[_0x62cc('0x45')](handleError(_0x72cd8,null));};exports[_0x62cc('0x23')]=function(_0x53cd86,_0x3a05da){if(_0x53cd86[_0x62cc('0x4d')]['id']){delete _0x53cd86[_0x62cc('0x4d')]['id'];}return db[_0x62cc('0x2c')][_0x62cc('0x44')]({'where':{'id':_0x53cd86[_0x62cc('0x41')]['id']}})[_0x62cc('0x24')](handleEntityNotFound(_0x3a05da,null))[_0x62cc('0x24')](saveUpdates(_0x53cd86[_0x62cc('0x4d')],null))['then'](respondWithResult(_0x3a05da,null))[_0x62cc('0x45')](handleError(_0x3a05da,null));};exports[_0x62cc('0x26')]=function(_0xcd4b64,_0xee97fb){return db[_0x62cc('0x2c')][_0x62cc('0x44')]({'where':{'id':_0xcd4b64[_0x62cc('0x41')]['id']}})[_0x62cc('0x24')](handleEntityNotFound(_0xee97fb,null))[_0x62cc('0x24')](removeEntity(_0xee97fb,null))[_0x62cc('0x45')](handleError(_0xee97fb,null));}; \ No newline at end of file +var _0x090a=['squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','status','end','json','limit','count','offset','apply','update','then','destroy','CmHopperAdditionalPhones','UserProfileResource','sendStatus','error','stack','name','send','map','CmHopperAdditionalPhone','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','findAll','rows','catch','show','rawAttributes','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs'];(function(_0x5d8e61,_0x3a13f7){var _0x9742f=function(_0x145724){while(--_0x145724){_0x5d8e61['push'](_0x5d8e61['shift']());}};_0x9742f(++_0x3a13f7);}(_0x090a,0x123));var _0xa090=function(_0x3bcf9b,_0x295a40){_0x3bcf9b=_0x3bcf9b-0x0;var _0xe21b97=_0x090a[_0x3bcf9b];return _0xe21b97;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa090('0x0'));var zipdir=require(_0xa090('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa090('0x2'));var moment=require(_0xa090('0x3'));var BPromise=require(_0xa090('0x4'));var Mustache=require(_0xa090('0x5'));var util=require(_0xa090('0x6'));var path=require(_0xa090('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa090('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa090('0x9'));var crypto=require(_0xa090('0xa'));var jsforce=require(_0xa090('0xb'));var deskjs=require(_0xa090('0xc'));var toCsv=require(_0xa090('0xd'));var querystring=require(_0xa090('0xe'));var Papa=require('papaparse');var Redis=require(_0xa090('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa090('0x10'));var as=require(_0xa090('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa090('0x12'));var utils=require(_0xa090('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa090('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f323c,_0x2a04d1){_0x2a04d1=_0x2a04d1||0xcc;return function(_0x5d4032){if(_0x5d4032){return _0x5f323c['sendStatus'](_0x2a04d1);}return _0x5f323c[_0xa090('0x15')](_0x2a04d1)[_0xa090('0x16')]();};}function respondWithResult(_0x2365e0,_0x18d62b){_0x18d62b=_0x18d62b||0xc8;return function(_0x13b8d2){if(_0x13b8d2){return _0x2365e0[_0xa090('0x15')](_0x18d62b)[_0xa090('0x17')](_0x13b8d2);}};}function respondWithFilteredResult(_0x731178,_0x4566ad){return function(_0x305784){if(_0x305784){var _0x168212=typeof _0x4566ad['offset']==='undefined'&&typeof _0x4566ad[_0xa090('0x18')]==='undefined';var _0x54f70d=_0x305784[_0xa090('0x19')];var _0x115692=_0x168212?0x0:_0x4566ad[_0xa090('0x1a')];var _0x11fb44=_0x168212?_0x305784[_0xa090('0x19')]:_0x4566ad[_0xa090('0x1a')]+_0x4566ad[_0xa090('0x18')];var _0x4638ad;if(_0x11fb44>=_0x54f70d){_0x11fb44=_0x54f70d;_0x4638ad=0xc8;}else{_0x4638ad=0xce;}_0x731178[_0xa090('0x15')](_0x4638ad);return _0x731178['set']('Content-Range',_0x115692+'-'+_0x11fb44+'/'+_0x54f70d)[_0xa090('0x17')](_0x305784);}return null;};}function patchUpdates(_0x25ad09){return function(_0x90eadf){try{jsonpatch[_0xa090('0x1b')](_0x90eadf,_0x25ad09,!![]);}catch(_0x1d3cb2){return BPromise['reject'](_0x1d3cb2);}return _0x90eadf['save']();};}function saveUpdates(_0x26df15,_0x21878f){return function(_0x57f571){if(_0x57f571){return _0x57f571[_0xa090('0x1c')](_0x26df15)[_0xa090('0x1d')](function(_0x3ca87b){return _0x3ca87b;});}return null;};}function removeEntity(_0x255517,_0x4be5bd){return function(_0x3fb059){if(_0x3fb059){return _0x3fb059[_0xa090('0x1e')]()[_0xa090('0x1d')](function(){var _0xd79fd4=_0x3fb059['get']({'plain':!![]});var _0x30f708=_0xa090('0x1f');return db[_0xa090('0x20')][_0xa090('0x1e')]({'where':{'type':_0x30f708,'resourceId':_0xd79fd4['id']}})['then'](function(){return _0x3fb059;});})[_0xa090('0x1d')](function(){_0x255517[_0xa090('0x15')](0xcc)[_0xa090('0x16')]();});}};}function handleEntityNotFound(_0x17b91b,_0x1d1e3b){return function(_0x55cb05){if(!_0x55cb05){_0x17b91b[_0xa090('0x21')](0x194);}return _0x55cb05;};}function handleError(_0x32d4ee,_0x6e725b){_0x6e725b=_0x6e725b||0x1f4;return function(_0x2f8a62){logger[_0xa090('0x22')](_0x2f8a62[_0xa090('0x23')]);if(_0x2f8a62[_0xa090('0x24')]){delete _0x2f8a62[_0xa090('0x24')];}_0x32d4ee[_0xa090('0x15')](_0x6e725b)[_0xa090('0x25')](_0x2f8a62);};}exports['index']=function(_0x4c4dbf,_0x321c6d){var _0x3604f6={},_0x28cffd={},_0x44d3cc={'count':0x0,'rows':[]};var _0x36cee6=_[_0xa090('0x26')](db[_0xa090('0x27')]['rawAttributes'],function(_0x1aab36){return{'name':_0x1aab36['fieldName'],'type':_0x1aab36[_0xa090('0x28')][_0xa090('0x29')]};});_0x28cffd[_0xa090('0x2a')]=_[_0xa090('0x26')](_0x36cee6,_0xa090('0x24'));_0x28cffd[_0xa090('0x2b')]=_[_0xa090('0x2c')](_0x4c4dbf[_0xa090('0x2b')]);_0x28cffd['filters']=_['intersection'](_0x28cffd[_0xa090('0x2a')],_0x28cffd['query']);_0x3604f6['attributes']=_[_0xa090('0x2d')](_0x28cffd[_0xa090('0x2a')],qs[_0xa090('0x2e')](_0x4c4dbf[_0xa090('0x2b')][_0xa090('0x2e')]));_0x3604f6[_0xa090('0x2f')]=_0x3604f6['attributes'][_0xa090('0x30')]?_0x3604f6[_0xa090('0x2f')]:_0x28cffd[_0xa090('0x2a')];if(!_0x4c4dbf[_0xa090('0x2b')][_0xa090('0x31')](_0xa090('0x32'))){_0x3604f6[_0xa090('0x18')]=qs['limit'](_0x4c4dbf['query'][_0xa090('0x18')]);_0x3604f6['offset']=qs['offset'](_0x4c4dbf[_0xa090('0x2b')][_0xa090('0x1a')]);}_0x3604f6[_0xa090('0x33')]=qs['sort'](_0x4c4dbf[_0xa090('0x2b')][_0xa090('0x34')]);_0x3604f6[_0xa090('0x35')]=qs[_0xa090('0x36')](_[_0xa090('0x37')](_0x4c4dbf[_0xa090('0x2b')],_0x28cffd[_0xa090('0x36')]),_0x36cee6);if(_0x4c4dbf['query'][_0xa090('0x38')]){_0x3604f6[_0xa090('0x35')]=_[_0xa090('0x39')](_0x3604f6['where'],{'$or':_[_0xa090('0x26')](_0x36cee6,function(_0x1eaec7){if(_0x1eaec7['type']!=='VIRTUAL'){var _0x356433={};_0x356433[_0x1eaec7[_0xa090('0x24')]]={'$like':'%'+_0x4c4dbf['query'][_0xa090('0x38')]+'%'};return _0x356433;}})});}_0x3604f6=_['merge']({},_0x3604f6,_0x4c4dbf['options']);var _0x25be9e={'where':_0x3604f6[_0xa090('0x35')]};return db[_0xa090('0x27')][_0xa090('0x19')](_0x25be9e)[_0xa090('0x1d')](function(_0x42a500){_0x44d3cc[_0xa090('0x19')]=_0x42a500;if(_0x4c4dbf[_0xa090('0x2b')][_0xa090('0x3a')]){_0x3604f6['include']=[{'all':!![]}];}return db[_0xa090('0x27')][_0xa090('0x3b')](_0x3604f6);})[_0xa090('0x1d')](function(_0x6468a3){_0x44d3cc[_0xa090('0x3c')]=_0x6468a3;return _0x44d3cc;})[_0xa090('0x1d')](respondWithFilteredResult(_0x321c6d,_0x3604f6))[_0xa090('0x3d')](handleError(_0x321c6d,null));};exports[_0xa090('0x3e')]=function(_0x1c6b73,_0x4b1bb8){var _0x529d95={'raw':!![],'where':{'id':_0x1c6b73['params']['id']}},_0x4fb809={};_0x4fb809['model']=_['keys'](db[_0xa090('0x27')][_0xa090('0x3f')]);_0x4fb809[_0xa090('0x2b')]=_['keys'](_0x1c6b73[_0xa090('0x2b')]);_0x4fb809[_0xa090('0x36')]=_[_0xa090('0x2d')](_0x4fb809[_0xa090('0x2a')],_0x4fb809[_0xa090('0x2b')]);_0x529d95[_0xa090('0x2f')]=_['intersection'](_0x4fb809[_0xa090('0x2a')],qs[_0xa090('0x2e')](_0x1c6b73[_0xa090('0x2b')][_0xa090('0x2e')]));_0x529d95[_0xa090('0x2f')]=_0x529d95[_0xa090('0x2f')]['length']?_0x529d95[_0xa090('0x2f')]:_0x4fb809[_0xa090('0x2a')];if(_0x1c6b73[_0xa090('0x2b')][_0xa090('0x3a')]){_0x529d95['include']=[{'all':!![]}];}_0x529d95=_[_0xa090('0x39')]({},_0x529d95,_0x1c6b73[_0xa090('0x40')]);return db['CmHopperAdditionalPhone']['find'](_0x529d95)[_0xa090('0x1d')](handleEntityNotFound(_0x4b1bb8,null))[_0xa090('0x1d')](respondWithResult(_0x4b1bb8,null))[_0xa090('0x3d')](handleError(_0x4b1bb8,null));};exports[_0xa090('0x41')]=function(_0xaefe3b,_0x47f8f2){return db[_0xa090('0x27')][_0xa090('0x41')](_0xaefe3b[_0xa090('0x42')],{})[_0xa090('0x1d')](function(_0x381c3a){var _0x134e22=_0xaefe3b['user']['get']({'plain':!![]});if(!_0x134e22)throw new Error(_0xa090('0x43'));if(_0x134e22[_0xa090('0x44')]==='user'){var _0x44cf0d=_0x381c3a[_0xa090('0x45')]({'plain':!![]});var _0x40ce60=_0xa090('0x1f');return db[_0xa090('0x46')][_0xa090('0x47')]({'where':{'name':_0x40ce60,'userProfileId':_0x134e22[_0xa090('0x48')]},'raw':!![]})[_0xa090('0x1d')](function(_0x340c24){if(_0x340c24&&_0x340c24['autoAssociation']===0x0){return db[_0xa090('0x20')]['create']({'name':_0x44cf0d[_0xa090('0x24')],'resourceId':_0x44cf0d['id'],'type':_0x340c24[_0xa090('0x24')],'sectionId':_0x340c24['id']},{})[_0xa090('0x1d')](function(){return _0x381c3a;});}else{return _0x381c3a;}})[_0xa090('0x3d')](function(_0x1ee583){logger['error'](_0xa090('0x49'),_0x1ee583);throw _0x1ee583;});}return _0x381c3a;})[_0xa090('0x1d')](respondWithResult(_0x47f8f2,0xc9))[_0xa090('0x3d')](handleError(_0x47f8f2,null));};exports[_0xa090('0x1c')]=function(_0x337265,_0x1f810a){if(_0x337265['body']['id']){delete _0x337265[_0xa090('0x42')]['id'];}return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x337265[_0xa090('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1f810a,null))[_0xa090('0x1d')](saveUpdates(_0x337265[_0xa090('0x42')],null))['then'](respondWithResult(_0x1f810a,null))[_0xa090('0x3d')](handleError(_0x1f810a,null));};exports[_0xa090('0x1e')]=function(_0x17d366,_0x13c607){return db[_0xa090('0x27')][_0xa090('0x47')]({'where':{'id':_0x17d366[_0xa090('0x4a')]['id']}})[_0xa090('0x1d')](handleEntityNotFound(_0x13c607,null))[_0xa090('0x1d')](removeEntity(_0x13c607,null))['catch'](handleError(_0x13c607,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 5509d83..2820045 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e22=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','cm_hopper_additional_phones'];(function(_0xdf00d0,_0x2a6605){var _0x2fff6e=function(_0x88809b){while(--_0x88809b){_0xdf00d0['push'](_0xdf00d0['shift']());}};_0x2fff6e(++_0x2a6605);}(_0x3e22,0x104));var _0x23e2=function(_0x4e0d45,_0x55f937){_0x4e0d45=_0x4e0d45-0x0;var _0xb25758=_0x3e22[_0x4e0d45];return _0xb25758;};'use strict';var _=require(_0x23e2('0x0'));var util=require(_0x23e2('0x1'));var logger=require(_0x23e2('0x2'))(_0x23e2('0x3'));var moment=require(_0x23e2('0x4'));var BPromise=require(_0x23e2('0x5'));var rp=require(_0x23e2('0x6'));var fs=require('fs');var path=require(_0x23e2('0x7'));var rimraf=require('rimraf');var config=require(_0x23e2('0x8'));var attributes=require(_0x23e2('0x9'));module['exports']=function(_0x4a9058,_0x569c6b){return _0x4a9058[_0x23e2('0xa')](_0x23e2('0xb'),attributes,{'tableName':_0x23e2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5af9=['lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','exports','define','CmHopperAdditionalPhone'];(function(_0x1f404a,_0x5088b2){var _0x2cdcd5=function(_0xe30d8c){while(--_0xe30d8c){_0x1f404a['push'](_0x1f404a['shift']());}};_0x2cdcd5(++_0x5088b2);}(_0x5af9,0xdc));var _0x95af=function(_0x49f8c2,_0x5166b7){_0x49f8c2=_0x49f8c2-0x0;var _0x3e63ec=_0x5af9[_0x49f8c2];return _0x3e63ec;};'use strict';var _=require(_0x95af('0x0'));var util=require(_0x95af('0x1'));var logger=require(_0x95af('0x2'))('api');var moment=require(_0x95af('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x95af('0x4'));var rimraf=require(_0x95af('0x5'));var config=require(_0x95af('0x6'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x95af('0x7')]=function(_0xf2e7d9,_0x1480c4){return _0xf2e7d9[_0x95af('0x8')](_0x95af('0x9'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 25c4804..15f1faa 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0caf=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','CmHopperAdditionalPhone,\x20%s,\x20%s','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countnoanswerretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','countnosuchnumberretry','countdropretry','countmachineretry','catch','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','countcongestionretry','createdAt','phone','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','field','util','moment','randomstring','ioredis'];(function(_0x46532c,_0x2d4695){var _0x345e8b=function(_0x3d1848){while(--_0x3d1848){_0x46532c['push'](_0x46532c['shift']());}};_0x345e8b(++_0x2d4695);}(_0x0caf,0xa7));var _0xf0ca=function(_0x11230c,_0x172c56){_0x11230c=_0x11230c-0x0;var _0xe46f61=_0x0caf[_0x11230c];return _0xe46f61;};'use strict';var _=require('lodash');var util=require(_0xf0ca('0x0'));var moment=require(_0xf0ca('0x1'));var BPromise=require('bluebird');var rs=require(_0xf0ca('0x2'));var fs=require('fs');var Redis=require(_0xf0ca('0x3'));var db=require(_0xf0ca('0x4'))['db'];var utils=require(_0xf0ca('0x5'));var logger=require(_0xf0ca('0x6'))(_0xf0ca('0x7'));var config=require(_0xf0ca('0x8'));var jayson=require(_0xf0ca('0x9'));var client=jayson[_0xf0ca('0xa')][_0xf0ca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d95e2,_0x302062,_0x2b0c22){return new BPromise(function(_0x43fc6d,_0xab4961){return client[_0xf0ca('0xc')](_0x4d95e2,_0x2b0c22)['then'](function(_0x159382){logger[_0xf0ca('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x302062,_0xf0ca('0xe'));logger['debug'](_0xf0ca('0xf'),_0x302062,_0xf0ca('0xe'),JSON['stringify'](_0x159382));if(_0x159382[_0xf0ca('0x10')]){if(_0x159382[_0xf0ca('0x10')][_0xf0ca('0x11')]===0x1f4){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x302062,_0x159382['error']['message']);return _0xab4961(_0x159382[_0xf0ca('0x10')][_0xf0ca('0x12')]);}logger[_0xf0ca('0x10')](_0xf0ca('0x13'),_0x302062,_0x159382[_0xf0ca('0x10')][_0xf0ca('0x12')]);return _0x43fc6d(_0x159382['error'][_0xf0ca('0x12')]);}else{logger[_0xf0ca('0xd')](_0xf0ca('0x13'),_0x302062,_0xf0ca('0xe'));_0x43fc6d(_0x159382['result']['message']);}})['catch'](function(_0x16d9e1){logger[_0xf0ca('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x302062,_0x16d9e1);_0xab4961(_0x16d9e1);});});}exports[_0xf0ca('0x14')]=function(_0x112dc2){var _0x44e33a=this;return new Promise(function(_0x24fe24,_0x2bd10a){return db[_0xf0ca('0x15')][_0xf0ca('0x16')]({'raw':!![],'where':{'ContactId':_0x112dc2[_0xf0ca('0x17')][_0xf0ca('0x18')],'ListId':_0x112dc2[_0xf0ca('0x17')][_0xf0ca('0x19')],'VoiceQueueId':_0x112dc2[_0xf0ca('0x17')]['VoiceQueueId']===undefined?null:_0x112dc2[_0xf0ca('0x17')][_0xf0ca('0x1a')],'CampaignId':_0x112dc2[_0xf0ca('0x17')][_0xf0ca('0x1b')]===undefined?null:_0x112dc2[_0xf0ca('0x17')][_0xf0ca('0x1b')]}})[_0xf0ca('0x1c')](function(_0x47ac6f){if(_0x47ac6f!=null){return db[_0xf0ca('0x1d')][_0xf0ca('0x16')]({'raw':!![],'where':{'CmHopperId':_0x47ac6f['id'],'OrderBy':{'$gt':_0x47ac6f['OrderBy']}},'order':[[_0xf0ca('0x1e'),_0xf0ca('0x1f')]]})[_0xf0ca('0x1c')](function(_0x23cb6b){var _0xe8997f=0x0;if(_0x23cb6b){if(_0x23cb6b[_0xf0ca('0x20')]+_0x23cb6b['countcongestionretry']+_0x23cb6b[_0xf0ca('0x21')]+_0x23cb6b['countnosuchnumberretry']+_0x23cb6b['countdropretry']+_0x23cb6b[_0xf0ca('0x22')]+_0x23cb6b['countmachineretry']+_0x23cb6b[_0xf0ca('0x23')]<_0x112dc2[_0xf0ca('0x24')][_0xf0ca('0x25')])_0xe8997f=0x1;_0x24fe24({'additional':_0xe8997f});}else{return db[_0xf0ca('0x1d')][_0xf0ca('0x16')]({'raw':!![],'where':{'CmHopperId':_0x47ac6f['id']},'order':[[_0xf0ca('0x1e'),'ASC']]})[_0xf0ca('0x1c')](function(_0x446a8b){var _0x5b72cc=0x0;if(_0x446a8b){if(_0x446a8b[_0xf0ca('0x20')]+_0x446a8b['countcongestionretry']+_0x446a8b[_0xf0ca('0x21')]+_0x446a8b[_0xf0ca('0x26')]+_0x446a8b[_0xf0ca('0x27')]+_0x446a8b[_0xf0ca('0x22')]+_0x446a8b[_0xf0ca('0x28')]+_0x446a8b[_0xf0ca('0x23')]<_0x112dc2['entity']['dialGlobalMaxRetry'])_0x5b72cc=0x1;_0x24fe24({'additional':_0x5b72cc});}else{_0x24fe24({'additional':0x0});}})['catch'](function(_0x43b9ee){logger[_0xf0ca('0x10')](_0xf0ca('0x14'),_0x43b9ee[_0xf0ca('0x12')]);_0x2bd10a(_0x44e33a['error'](0x1f4,_0x43b9ee['message']));});}})[_0xf0ca('0x29')](function(_0x18e50a){logger[_0xf0ca('0x10')]('VerifyAdditionalPhones',_0x18e50a['message']);_0x2bd10a(_0x44e33a['error'](0x1f4,_0x18e50a[_0xf0ca('0x12')]));});}else _0x24fe24({'additional':0x0});});});};exports[_0xf0ca('0x2a')]=function(_0x3df01c){var _0x470e1f=this;return new Promise(function(_0x25f47b,_0xd4f84){return db[_0xf0ca('0x15')][_0xf0ca('0x16')]({'raw':!![],'where':{'ContactId':_0x3df01c['body']['ContactId'],'ListId':_0x3df01c[_0xf0ca('0x17')][_0xf0ca('0x19')],'VoiceQueueId':_0x3df01c[_0xf0ca('0x17')][_0xf0ca('0x1a')]===undefined?null:_0x3df01c[_0xf0ca('0x17')][_0xf0ca('0x1a')],'CampaignId':_0x3df01c['body']['CampaignId']===undefined?null:_0x3df01c['body'][_0xf0ca('0x1b')]}})['then'](function(_0x4f71dc){if(_0x4f71dc!=null){return db['CmHopperAdditionalPhone'][_0xf0ca('0x16')]({'raw':!![],'where':{'CmHopperId':_0x4f71dc['id'],'OrderBy':{'$gte':_0x4f71dc[_0xf0ca('0x1e')]}},'order':[[_0xf0ca('0x1e'),'ASC']]})[_0xf0ca('0x1c')](function(_0xf45cd8){if(_0xf45cd8)return activateAdditionalPhone(_0x4f71dc,_0x3df01c[_0xf0ca('0x17')],_0xf45cd8,_0x3df01c[_0xf0ca('0x2b')],_0x3df01c[_0xf0ca('0x2c')])[_0xf0ca('0x1c')](function(_0x415042){_0x25f47b(_0x415042);});else{return db[_0xf0ca('0x1d')][_0xf0ca('0x16')]({'raw':!![],'where':{'CmHopperId':_0x4f71dc['id']},'order':[[_0xf0ca('0x1e'),_0xf0ca('0x1f')]]})['then'](function(_0x3cbc6d){if(_0x3cbc6d)return activateAdditionalPhone(_0x4f71dc,_0x3df01c[_0xf0ca('0x17')],_0x3cbc6d,_0x3df01c[_0xf0ca('0x2b')],_0x3df01c[_0xf0ca('0x2c')])[_0xf0ca('0x1c')](function(_0x1d4e85){_0x25f47b(_0x1d4e85);});else{_0x25f47b({'id':_0x4f71dc['id'],'phone':''});}})[_0xf0ca('0x29')](function(_0xe21da6){logger[_0xf0ca('0x10')](_0xf0ca('0x14'),_0xe21da6[_0xf0ca('0x12')]);_0xd4f84(_0x470e1f[_0xf0ca('0x10')](0x1f4,_0xe21da6[_0xf0ca('0x12')]));});}})[_0xf0ca('0x29')](function(_0x521525){logger['error'](_0xf0ca('0x14'),_0x521525[_0xf0ca('0x12')]);_0xd4f84(_0x470e1f[_0xf0ca('0x10')](0x1f4,_0x521525[_0xf0ca('0x12')]));});}else _0x25f47b(0x1);});});};function activateAdditionalPhone(_0x365dbd,_0x3c8f77,_0xdb0a11,_0x569a6a,_0x2ac4a5){return new Promise(function(_0x5d5acf,_0xb7f407){var _0x563a1d;if(_[_0xf0ca('0x2d')](_0xdb0a11['scheduledat'])){_0xdb0a11[_0xf0ca('0x2e')]=moment();}if(moment()>moment(_0xdb0a11['scheduledat'])){_0x563a1d=moment()['add'](_0x2ac4a5||0x3,'minutes');}else{if(_0xdb0a11['OrderBy']==0x0){_0x563a1d=moment(_0xdb0a11['scheduledat']);}else{_0x563a1d=moment()[_0xf0ca('0x2f')](_0x2ac4a5||0x3,_0xf0ca('0x30'));}}if(_[_0xf0ca('0x2d')](_0x563a1d)){_0x563a1d=moment()[_0xf0ca('0x2f')](_0x2ac4a5||0x3,'minutes');}var _0xc37392={'phone':_0x365dbd['phone'],'active':0x0,'OrderBy':_[_0xf0ca('0x2d')](_0x365dbd[_0xf0ca('0x1e')])?0x0:_0x365dbd[_0xf0ca('0x1e')],'scheduledat':moment()['add'](_0x569a6a||0x1,'minutes'),'countbusyretry':_0x3c8f77[_0xf0ca('0x20')],'countcongestionretry':_0x3c8f77[_0xf0ca('0x31')],'countnoanswerretry':_0x3c8f77[_0xf0ca('0x21')],'countnosuchnumberretry':_0x3c8f77[_0xf0ca('0x26')],'countdropretry':_0x3c8f77['countdropretry'],'countabandonedretry':_0x3c8f77[_0xf0ca('0x22')],'countmachineretry':_0x3c8f77[_0xf0ca('0x28')],'countagentrejectretry':_0x3c8f77[_0xf0ca('0x23')],'createdAt':_0x3c8f77[_0xf0ca('0x32')],'updatedAt':_0x3c8f77['updatedAt']};var _0x551c5b={'CmHopperId':_0x365dbd['id'],'phone':_0xdb0a11[_0xf0ca('0x33')],'active':0x0,'OrderBy':_[_0xf0ca('0x2d')](_0xdb0a11[_0xf0ca('0x1e')])?0x0:_0xdb0a11[_0xf0ca('0x1e')],'scheduledat':_0x563a1d,'countbusyretry':_0xdb0a11[_0xf0ca('0x20')],'countcongestionretry':_0xdb0a11[_0xf0ca('0x31')],'countnoanswerretry':_0xdb0a11[_0xf0ca('0x21')],'countnosuchnumberretry':_0xdb0a11[_0xf0ca('0x26')],'countdropretry':_0xdb0a11[_0xf0ca('0x27')],'countabandonedretry':_0xdb0a11['countabandonedretry'],'countmachineretry':_0xdb0a11[_0xf0ca('0x28')],'countagentrejectretry':_0xdb0a11['countagentrejectretry'],'createdAt':_0xdb0a11['createdAt'],'updatedAt':_0xdb0a11['updatedAt']};return db[_0xf0ca('0x34')]['transaction'](function(_0x31ecb3){return db['CmHopperAdditionalPhone'][_0xf0ca('0x35')](_0xc37392,{'where':{'id':_0xdb0a11['id']}},{'transaction':_0x31ecb3})[_0xf0ca('0x1c')](function(){return db['CmHopper'][_0xf0ca('0x35')](_0x551c5b,{'where':{'id':_0x365dbd['id']}},{'transaction':_0x31ecb3});});})[_0xf0ca('0x1c')](function(_0x4beb21){_0x5d5acf({'id':_0x365dbd['id'],'phone':_0xdb0a11[_0xf0ca('0x33')]});})['catch'](function(_0x290927){logger[_0xf0ca('0x10')](_0xf0ca('0x36'),_0x290927[_0xf0ca('0x12')]);_0xb7f407({'error':_0x290927['message']});});});}exports[_0xf0ca('0x37')]=function(_0x888252){var _0x163447=this;return new Promise(function(_0x25e408,_0xd77544){return db['CmHopper'][_0xf0ca('0x35')](_0x888252[_0xf0ca('0x17')][_0xf0ca('0x38')],{'where':{'id':_0x888252[_0xf0ca('0x17')]['id']}})[_0xf0ca('0x1c')](function(_0x1e654c){_0x25e408(_0x1e654c);})[_0xf0ca('0x29')](function(_0x238355){logger[_0xf0ca('0x10')](_0xf0ca('0x37'),_0x238355['message']);_0xd77544(_0x163447[_0xf0ca('0x10')](0x1f4,_0x238355[_0xf0ca('0x12')]));});});}; \ No newline at end of file +var _0xdbb9=['request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ASC','countmachineretry','entity','catch','SwapAdditionalPhones','VoiceQueueId','duration','waitTime','scheduledat','add','minutes','phone','isNil','updatedAt','createdAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s'];(function(_0x19c2fd,_0x499c2c){var _0x2c89d3=function(_0x536a8e){while(--_0x536a8e){_0x19c2fd['push'](_0x19c2fd['shift']());}};_0x2c89d3(++_0x499c2c);}(_0xdbb9,0x14e));var _0x9dbb=function(_0x1bf84d,_0x14389a){_0x1bf84d=_0x1bf84d-0x0;var _0x3aa98e=_0xdbb9[_0x1bf84d];return _0x3aa98e;};'use strict';var _=require(_0x9dbb('0x0'));var util=require(_0x9dbb('0x1'));var moment=require('moment');var BPromise=require(_0x9dbb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dbb('0x3'));var db=require(_0x9dbb('0x4'))['db'];var utils=require(_0x9dbb('0x5'));var logger=require(_0x9dbb('0x6'))(_0x9dbb('0x7'));var config=require(_0x9dbb('0x8'));var jayson=require(_0x9dbb('0x9'));var client=jayson['client'][_0x9dbb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x382963,_0x3b9a5b,_0x11e9a9){return new BPromise(function(_0xca6c60,_0x43a336){return client[_0x9dbb('0xb')](_0x382963,_0x11e9a9)[_0x9dbb('0xc')](function(_0x5c4506){logger['info'](_0x9dbb('0xd'),_0x3b9a5b,_0x9dbb('0xe'));logger['debug'](_0x9dbb('0xf'),_0x3b9a5b,_0x9dbb('0xe'),JSON[_0x9dbb('0x10')](_0x5c4506));if(_0x5c4506[_0x9dbb('0x11')]){if(_0x5c4506['error'][_0x9dbb('0x12')]===0x1f4){logger[_0x9dbb('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3b9a5b,_0x5c4506[_0x9dbb('0x11')][_0x9dbb('0x13')]);return _0x43a336(_0x5c4506['error'][_0x9dbb('0x13')]);}logger[_0x9dbb('0x11')](_0x9dbb('0xd'),_0x3b9a5b,_0x5c4506[_0x9dbb('0x11')]['message']);return _0xca6c60(_0x5c4506['error']['message']);}else{logger[_0x9dbb('0x14')](_0x9dbb('0xd'),_0x3b9a5b,'request\x20sent');_0xca6c60(_0x5c4506[_0x9dbb('0x15')][_0x9dbb('0x13')]);}})['catch'](function(_0xeb256e){logger[_0x9dbb('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3b9a5b,_0xeb256e);_0x43a336(_0xeb256e);});});}exports[_0x9dbb('0x16')]=function(_0x497bf9){var _0x27382b=this;return new Promise(function(_0x183641,_0x2d8c34){return db[_0x9dbb('0x17')][_0x9dbb('0x18')]({'raw':!![],'where':{'ContactId':_0x497bf9[_0x9dbb('0x19')][_0x9dbb('0x1a')],'ListId':_0x497bf9[_0x9dbb('0x19')][_0x9dbb('0x1b')],'VoiceQueueId':_0x497bf9[_0x9dbb('0x19')]['VoiceQueueId']===undefined?null:_0x497bf9[_0x9dbb('0x19')]['VoiceQueueId'],'CampaignId':_0x497bf9[_0x9dbb('0x19')][_0x9dbb('0x1c')]===undefined?null:_0x497bf9[_0x9dbb('0x19')][_0x9dbb('0x1c')]}})[_0x9dbb('0xc')](function(_0x48452c){if(_0x48452c!=null){return db[_0x9dbb('0x1d')][_0x9dbb('0x18')]({'raw':!![],'where':{'CmHopperId':_0x48452c['id'],'OrderBy':{'$gt':_0x48452c[_0x9dbb('0x1e')]}},'order':[[_0x9dbb('0x1e'),'ASC']]})['then'](function(_0x3e7a57){var _0x25f531=0x0;if(_0x3e7a57){if(_0x3e7a57[_0x9dbb('0x1f')]+_0x3e7a57[_0x9dbb('0x20')]+_0x3e7a57[_0x9dbb('0x21')]+_0x3e7a57[_0x9dbb('0x22')]+_0x3e7a57[_0x9dbb('0x23')]+_0x3e7a57[_0x9dbb('0x24')]+_0x3e7a57['countmachineretry']+_0x3e7a57[_0x9dbb('0x25')]<_0x497bf9['entity']['dialGlobalMaxRetry'])_0x25f531=0x1;_0x183641({'additional':_0x25f531});}else{return db[_0x9dbb('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x48452c['id']},'order':[[_0x9dbb('0x1e'),_0x9dbb('0x26')]]})[_0x9dbb('0xc')](function(_0x37d9f0){var _0x47161a=0x0;if(_0x37d9f0){if(_0x37d9f0[_0x9dbb('0x1f')]+_0x37d9f0[_0x9dbb('0x20')]+_0x37d9f0['countnoanswerretry']+_0x37d9f0[_0x9dbb('0x22')]+_0x37d9f0[_0x9dbb('0x23')]+_0x37d9f0[_0x9dbb('0x24')]+_0x37d9f0[_0x9dbb('0x27')]+_0x37d9f0[_0x9dbb('0x25')]<_0x497bf9[_0x9dbb('0x28')]['dialGlobalMaxRetry'])_0x47161a=0x1;_0x183641({'additional':_0x47161a});}else{_0x183641({'additional':0x0});}})[_0x9dbb('0x29')](function(_0x9ebda0){logger[_0x9dbb('0x11')]('VerifyAdditionalPhones',_0x9ebda0[_0x9dbb('0x13')]);_0x2d8c34(_0x27382b[_0x9dbb('0x11')](0x1f4,_0x9ebda0[_0x9dbb('0x13')]));});}})[_0x9dbb('0x29')](function(_0x16182c){logger[_0x9dbb('0x11')]('VerifyAdditionalPhones',_0x16182c[_0x9dbb('0x13')]);_0x2d8c34(_0x27382b[_0x9dbb('0x11')](0x1f4,_0x16182c[_0x9dbb('0x13')]));});}else _0x183641({'additional':0x0});});});};exports[_0x9dbb('0x2a')]=function(_0x4972a7){var _0x3ff725=this;return new Promise(function(_0x3ea62c,_0x4767b7){return db['CmHopper'][_0x9dbb('0x18')]({'raw':!![],'where':{'ContactId':_0x4972a7[_0x9dbb('0x19')][_0x9dbb('0x1a')],'ListId':_0x4972a7[_0x9dbb('0x19')][_0x9dbb('0x1b')],'VoiceQueueId':_0x4972a7['body']['VoiceQueueId']===undefined?null:_0x4972a7[_0x9dbb('0x19')][_0x9dbb('0x2b')],'CampaignId':_0x4972a7[_0x9dbb('0x19')][_0x9dbb('0x1c')]===undefined?null:_0x4972a7['body'][_0x9dbb('0x1c')]}})['then'](function(_0x187a8e){if(_0x187a8e!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x187a8e['id'],'OrderBy':{'$gte':_0x187a8e[_0x9dbb('0x1e')]}},'order':[[_0x9dbb('0x1e'),_0x9dbb('0x26')]]})[_0x9dbb('0xc')](function(_0x194365){if(_0x194365)return activateAdditionalPhone(_0x187a8e,_0x4972a7['body'],_0x194365,_0x4972a7[_0x9dbb('0x2c')],_0x4972a7[_0x9dbb('0x2d')])[_0x9dbb('0xc')](function(_0x86c2fa){_0x3ea62c(_0x86c2fa);});else{return db[_0x9dbb('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x187a8e['id']},'order':[[_0x9dbb('0x1e'),_0x9dbb('0x26')]]})[_0x9dbb('0xc')](function(_0xc7667e){if(_0xc7667e)return activateAdditionalPhone(_0x187a8e,_0x4972a7[_0x9dbb('0x19')],_0xc7667e,_0x4972a7[_0x9dbb('0x2c')],_0x4972a7['waitTime'])[_0x9dbb('0xc')](function(_0xa9547a){_0x3ea62c(_0xa9547a);});else{_0x3ea62c({'id':_0x187a8e['id'],'phone':''});}})[_0x9dbb('0x29')](function(_0x4e81ec){logger['error']('VerifyAdditionalPhones',_0x4e81ec['message']);_0x4767b7(_0x3ff725[_0x9dbb('0x11')](0x1f4,_0x4e81ec['message']));});}})['catch'](function(_0x5be32d){logger[_0x9dbb('0x11')](_0x9dbb('0x16'),_0x5be32d[_0x9dbb('0x13')]);_0x4767b7(_0x3ff725[_0x9dbb('0x11')](0x1f4,_0x5be32d['message']));});}else _0x3ea62c(0x1);});});};function activateAdditionalPhone(_0x15699a,_0x1b190f,_0x45e6b9,_0x27de55,_0xd9da26){return new Promise(function(_0x504c5c,_0x1d3347){var _0x45dfd0;if(_['isNil'](_0x45e6b9[_0x9dbb('0x2e')])){_0x45e6b9[_0x9dbb('0x2e')]=moment();}if(moment()>moment(_0x45e6b9[_0x9dbb('0x2e')])){_0x45dfd0=moment()[_0x9dbb('0x2f')](_0xd9da26||0x3,_0x9dbb('0x30'));}else{if(_0x45e6b9[_0x9dbb('0x1e')]==0x0){_0x45dfd0=moment(_0x45e6b9[_0x9dbb('0x2e')]);}else{_0x45dfd0=moment()[_0x9dbb('0x2f')](_0xd9da26||0x3,'minutes');}}if(_['isNil'](_0x45dfd0)){_0x45dfd0=moment()[_0x9dbb('0x2f')](_0xd9da26||0x3,_0x9dbb('0x30'));}var _0xc7e0f4={'phone':_0x15699a[_0x9dbb('0x31')],'active':0x0,'OrderBy':_[_0x9dbb('0x32')](_0x15699a[_0x9dbb('0x1e')])?0x0:_0x15699a['OrderBy'],'scheduledat':moment()[_0x9dbb('0x2f')](_0x27de55||0x1,_0x9dbb('0x30')),'countbusyretry':_0x1b190f[_0x9dbb('0x1f')],'countcongestionretry':_0x1b190f['countcongestionretry'],'countnoanswerretry':_0x1b190f['countnoanswerretry'],'countnosuchnumberretry':_0x1b190f[_0x9dbb('0x22')],'countdropretry':_0x1b190f['countdropretry'],'countabandonedretry':_0x1b190f['countabandonedretry'],'countmachineretry':_0x1b190f['countmachineretry'],'countagentrejectretry':_0x1b190f[_0x9dbb('0x25')],'createdAt':_0x1b190f['createdAt'],'updatedAt':_0x1b190f[_0x9dbb('0x33')]};var _0x3172f4={'CmHopperId':_0x15699a['id'],'phone':_0x45e6b9[_0x9dbb('0x31')],'active':0x0,'OrderBy':_[_0x9dbb('0x32')](_0x45e6b9[_0x9dbb('0x1e')])?0x0:_0x45e6b9[_0x9dbb('0x1e')],'scheduledat':_0x45dfd0,'countbusyretry':_0x45e6b9[_0x9dbb('0x1f')],'countcongestionretry':_0x45e6b9[_0x9dbb('0x20')],'countnoanswerretry':_0x45e6b9[_0x9dbb('0x21')],'countnosuchnumberretry':_0x45e6b9[_0x9dbb('0x22')],'countdropretry':_0x45e6b9[_0x9dbb('0x23')],'countabandonedretry':_0x45e6b9[_0x9dbb('0x24')],'countmachineretry':_0x45e6b9[_0x9dbb('0x27')],'countagentrejectretry':_0x45e6b9['countagentrejectretry'],'createdAt':_0x45e6b9[_0x9dbb('0x34')],'updatedAt':_0x45e6b9[_0x9dbb('0x33')]};return db[_0x9dbb('0x35')][_0x9dbb('0x36')](function(_0x43cce8){return db[_0x9dbb('0x1d')]['update'](_0xc7e0f4,{'where':{'id':_0x45e6b9['id']}},{'transaction':_0x43cce8})[_0x9dbb('0xc')](function(){return db[_0x9dbb('0x17')][_0x9dbb('0x37')](_0x3172f4,{'where':{'id':_0x15699a['id']}},{'transaction':_0x43cce8});});})[_0x9dbb('0xc')](function(_0x30839d){_0x504c5c({'id':_0x15699a['id'],'phone':_0x45e6b9['phone']});})[_0x9dbb('0x29')](function(_0x2909d6){logger[_0x9dbb('0x11')](_0x9dbb('0x38'),_0x2909d6[_0x9dbb('0x13')]);_0x1d3347({'error':_0x2909d6[_0x9dbb('0x13')]});});});}exports[_0x9dbb('0x39')]=function(_0x27e628){var _0x3cb39c=this;return new Promise(function(_0x4b2fa3,_0x2228cc){return db['CmHopper'][_0x9dbb('0x37')](_0x27e628['body']['field'],{'where':{'id':_0x27e628[_0x9dbb('0x19')]['id']}})['then'](function(_0x914309){_0x4b2fa3(_0x914309);})['catch'](function(_0x1c3e62){logger['error'](_0x9dbb('0x39'),_0x1c3e62[_0x9dbb('0x13')]);_0x2228cc(_0x3cb39c[_0x9dbb('0x11')](0x1f4,_0x1c3e62[_0x9dbb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 9c31b38..574b2e1 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8481=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x8481,0x1c7));var _0x1848=function(_0xf5d71c,_0x2613a6){_0xf5d71c=_0xf5d71c-0x0;var _0x5af672=_0x8481[_0xf5d71c];return _0x5af672;};'use strict';var multer=require(_0x1848('0x0'));var util=require('util');var path=require(_0x1848('0x1'));var timeout=require(_0x1848('0x2'));var express=require(_0x1848('0x3'));var router=express[_0x1848('0x4')]();var fs_extra=require(_0x1848('0x5'));var auth=require(_0x1848('0x6'));var interaction=require(_0x1848('0x7'));var config=require(_0x1848('0x8'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x1848('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x1848('0xa')](),controller[_0x1848('0xb')]);router[_0x1848('0xc')]('/',auth[_0x1848('0xa')](),controller[_0x1848('0xd')]);router['put'](_0x1848('0xe'),auth[_0x1848('0xa')](),controller[_0x1848('0xf')]);router[_0x1848('0x10')](_0x1848('0xe'),auth[_0x1848('0xa')](),controller[_0x1848('0x11')]);module[_0x1848('0x12')]=router; \ No newline at end of file +var _0x70ba=['delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','update'];(function(_0x563a69,_0x816a66){var _0x361661=function(_0x2399d0){while(--_0x2399d0){_0x563a69['push'](_0x563a69['shift']());}};_0x361661(++_0x816a66);}(_0x70ba,0xc2));var _0xa70b=function(_0x1cc405,_0x2aa784){_0x1cc405=_0x1cc405-0x0;var _0x18d815=_0x70ba[_0x1cc405];return _0x18d815;};'use strict';var multer=require('multer');var util=require(_0xa70b('0x0'));var path=require(_0xa70b('0x1'));var timeout=require(_0xa70b('0x2'));var express=require('express');var router=express[_0xa70b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa70b('0x4'));var interaction=require(_0xa70b('0x5'));var config=require(_0xa70b('0x6'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0xa70b('0x7')]('/',auth[_0xa70b('0x8')](),controller[_0xa70b('0x9')]);router[_0xa70b('0x7')](_0xa70b('0xa'),auth[_0xa70b('0x8')](),controller['show']);router[_0xa70b('0xb')]('/',auth['isAuthenticated'](),controller[_0xa70b('0xc')]);router['put'](_0xa70b('0xa'),auth['isAuthenticated'](),controller[_0xa70b('0xd')]);router[_0xa70b('0xe')](_0xa70b('0xa'),auth[_0xa70b('0x8')](),controller['destroy']);module[_0xa70b('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index af5a997..a123ba1 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 _0xad78=['contactListQueue','moment','STRING','INTEGER'];(function(_0x381379,_0x3f3b86){var _0x3e1063=function(_0x4c282d){while(--_0x4c282d){_0x381379['push'](_0x381379['shift']());}};_0x3e1063(++_0x3f3b86);}(_0xad78,0x149));var _0x8ad7=function(_0xe2af64,_0x4552b0){_0xe2af64=_0xe2af64-0x0;var _0x5942b2=_0xad78[_0xe2af64];return _0x5942b2;};'use strict';var moment=require(_0x8ad7('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x8ad7('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x8ad7('0x2')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x8ad7('0x2')],'unique':_0x8ad7('0x3')},'VoiceQueueId':{'type':Sequelize[_0x8ad7('0x2')],'unique':_0x8ad7('0x3')}}; \ No newline at end of file +var _0x077e=['moment','sequelize','exports','STRING','contactListQueue','INTEGER'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x077e,0x14a));var _0xe077=function(_0x2186e4,_0x44ed5c){_0x2186e4=_0x2186e4-0x0;var _0x1d8c88=_0x077e[_0x2186e4];return _0x1d8c88;};'use strict';var moment=require(_0xe077('0x0'));var Sequelize=require(_0xe077('0x1'));module[_0xe077('0x2')]={'phone':{'type':Sequelize[_0xe077('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xe077('0x4')},'ListId':{'type':Sequelize[_0xe077('0x5')],'unique':_0xe077('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xe077('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index b38019d..63b6c9c 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 _0x8d2f=['fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','CmHopperBlack','includeAll','include','findAll','rows','catch','find','update','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','rawAttributes'];(function(_0x151d9b,_0x5da004){var _0x510a88=function(_0x50648c){while(--_0x50648c){_0x151d9b['push'](_0x151d9b['shift']());}};_0x510a88(++_0x5da004);}(_0x8d2f,0xb8));var _0xf8d2=function(_0x4f4535,_0x49f160){_0x4f4535=_0x4f4535-0x0;var _0x1d5c3e=_0x8d2f[_0x4f4535];return _0x1d5c3e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf8d2('0x0'));var zipdir=require(_0xf8d2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf8d2('0x2'));var moment=require(_0xf8d2('0x3'));var BPromise=require(_0xf8d2('0x4'));var Mustache=require(_0xf8d2('0x5'));var util=require(_0xf8d2('0x6'));var path=require(_0xf8d2('0x7'));var sox=require(_0xf8d2('0x8'));var csv=require(_0xf8d2('0x9'));var ejs=require(_0xf8d2('0xa'));var fs=require('fs');var fs_extra=require(_0xf8d2('0xb'));var _=require(_0xf8d2('0xc'));var squel=require(_0xf8d2('0xd'));var crypto=require(_0xf8d2('0xe'));var jsforce=require(_0xf8d2('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf8d2('0x10'));var Papa=require(_0xf8d2('0x11'));var Redis=require(_0xf8d2('0x12'));var authService=require(_0xf8d2('0x13'));var qs=require(_0xf8d2('0x14'));var as=require(_0xf8d2('0x15'));var hardwareService=require(_0xf8d2('0x16'));var logger=require('../../config/logger')(_0xf8d2('0x17'));var utils=require(_0xf8d2('0x18'));var config=require(_0xf8d2('0x19'));var licenseUtil=require(_0xf8d2('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x572fdd,_0x345828){_0x345828=_0x345828||0xcc;return function(_0x56a5bd){if(_0x56a5bd){return _0x572fdd['sendStatus'](_0x345828);}return _0x572fdd['status'](_0x345828)[_0xf8d2('0x1b')]();};}function respondWithResult(_0x3586c4,_0x975651){_0x975651=_0x975651||0xc8;return function(_0x34dc76){if(_0x34dc76){return _0x3586c4['status'](_0x975651)[_0xf8d2('0x1c')](_0x34dc76);}};}function respondWithFilteredResult(_0x2b8dfb,_0x4e50d8){return function(_0x52f8ef){if(_0x52f8ef){var _0x17f097=typeof _0x4e50d8[_0xf8d2('0x1d')]===_0xf8d2('0x1e')&&typeof _0x4e50d8[_0xf8d2('0x1f')]===_0xf8d2('0x1e');var _0x12bf23=_0x52f8ef[_0xf8d2('0x20')];var _0x14a111=_0x17f097?0x0:_0x4e50d8['offset'];var _0x3ee067=_0x17f097?_0x52f8ef[_0xf8d2('0x20')]:_0x4e50d8[_0xf8d2('0x1d')]+_0x4e50d8[_0xf8d2('0x1f')];var _0x49ae40;if(_0x3ee067>=_0x12bf23){_0x3ee067=_0x12bf23;_0x49ae40=0xc8;}else{_0x49ae40=0xce;}_0x2b8dfb[_0xf8d2('0x21')](_0x49ae40);return _0x2b8dfb[_0xf8d2('0x22')](_0xf8d2('0x23'),_0x14a111+'-'+_0x3ee067+'/'+_0x12bf23)[_0xf8d2('0x1c')](_0x52f8ef);}return null;};}function patchUpdates(_0x4f8eab){return function(_0x1c1c53){try{jsonpatch[_0xf8d2('0x24')](_0x1c1c53,_0x4f8eab,!![]);}catch(_0x266e52){return BPromise[_0xf8d2('0x25')](_0x266e52);}return _0x1c1c53[_0xf8d2('0x26')]();};}function saveUpdates(_0x2f2f7c,_0x5d91cc){return function(_0x2ef091){if(_0x2ef091){return _0x2ef091['update'](_0x2f2f7c)['then'](function(_0x3a96ad){return _0x3a96ad;});}return null;};}function removeEntity(_0x3a2c20,_0xd5ef77){return function(_0x111806){if(_0x111806){return _0x111806[_0xf8d2('0x27')]()[_0xf8d2('0x28')](function(){_0x3a2c20[_0xf8d2('0x21')](0xcc)[_0xf8d2('0x1b')]();});}};}function handleEntityNotFound(_0x5f0df7,_0x4b29be){return function(_0x5c3f08){if(!_0x5c3f08){_0x5f0df7['sendStatus'](0x194);}return _0x5c3f08;};}function handleError(_0x2d6335,_0xb7340f){_0xb7340f=_0xb7340f||0x1f4;return function(_0x268098){logger[_0xf8d2('0x29')](_0x268098['stack']);if(_0x268098['name']){delete _0x268098[_0xf8d2('0x2a')];}_0x2d6335[_0xf8d2('0x21')](_0xb7340f)[_0xf8d2('0x2b')](_0x268098);};}exports[_0xf8d2('0x2c')]=function(_0x594a8d,_0x2855a2){var _0x3130ab={},_0x38070d={},_0x115f59={'count':0x0,'rows':[]};var _0x40b27f=_[_0xf8d2('0x2d')](db['CmHopperBlack'][_0xf8d2('0x2e')],function(_0x3a2f8d){return{'name':_0x3a2f8d[_0xf8d2('0x2f')],'type':_0x3a2f8d['type'][_0xf8d2('0x30')]};});_0x38070d['model']=_['map'](_0x40b27f,_0xf8d2('0x2a'));_0x38070d[_0xf8d2('0x31')]=_[_0xf8d2('0x32')](_0x594a8d[_0xf8d2('0x31')]);_0x38070d[_0xf8d2('0x33')]=_[_0xf8d2('0x34')](_0x38070d[_0xf8d2('0x35')],_0x38070d['query']);_0x3130ab['attributes']=_[_0xf8d2('0x34')](_0x38070d['model'],qs[_0xf8d2('0x36')](_0x594a8d[_0xf8d2('0x31')][_0xf8d2('0x36')]));_0x3130ab[_0xf8d2('0x37')]=_0x3130ab[_0xf8d2('0x37')][_0xf8d2('0x38')]?_0x3130ab[_0xf8d2('0x37')]:_0x38070d['model'];if(!_0x594a8d[_0xf8d2('0x31')]['hasOwnProperty'](_0xf8d2('0x39'))){_0x3130ab[_0xf8d2('0x1f')]=qs[_0xf8d2('0x1f')](_0x594a8d['query'][_0xf8d2('0x1f')]);_0x3130ab[_0xf8d2('0x1d')]=qs[_0xf8d2('0x1d')](_0x594a8d[_0xf8d2('0x31')][_0xf8d2('0x1d')]);}_0x3130ab[_0xf8d2('0x3a')]=qs[_0xf8d2('0x3b')](_0x594a8d[_0xf8d2('0x31')][_0xf8d2('0x3b')]);_0x3130ab[_0xf8d2('0x3c')]=qs['filters'](_[_0xf8d2('0x3d')](_0x594a8d['query'],_0x38070d['filters']),_0x40b27f);if(_0x594a8d[_0xf8d2('0x31')][_0xf8d2('0x3e')]){_0x3130ab[_0xf8d2('0x3c')]=_[_0xf8d2('0x3f')](_0x3130ab['where'],{'$or':_['map'](_0x40b27f,function(_0xd3bfaf){if(_0xd3bfaf[_0xf8d2('0x40')]!==_0xf8d2('0x41')){var _0x41f219={};_0x41f219[_0xd3bfaf['name']]={'$like':'%'+_0x594a8d['query'][_0xf8d2('0x3e')]+'%'};return _0x41f219;}})});}_0x3130ab=_[_0xf8d2('0x3f')]({},_0x3130ab,_0x594a8d[_0xf8d2('0x42')]);var _0x57dcea={'where':_0x3130ab[_0xf8d2('0x3c')]};return db[_0xf8d2('0x43')][_0xf8d2('0x20')](_0x57dcea)[_0xf8d2('0x28')](function(_0x34437b){_0x115f59[_0xf8d2('0x20')]=_0x34437b;if(_0x594a8d['query'][_0xf8d2('0x44')]){_0x3130ab[_0xf8d2('0x45')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xf8d2('0x46')](_0x3130ab);})[_0xf8d2('0x28')](function(_0xb34058){_0x115f59[_0xf8d2('0x47')]=_0xb34058;return _0x115f59;})[_0xf8d2('0x28')](respondWithFilteredResult(_0x2855a2,_0x3130ab))[_0xf8d2('0x48')](handleError(_0x2855a2,null));};exports['show']=function(_0x220078,_0x18f344){var _0x11848f={'raw':!![],'where':{'id':_0x220078['params']['id']}},_0x1fe373={};_0x1fe373[_0xf8d2('0x35')]=_[_0xf8d2('0x32')](db[_0xf8d2('0x43')][_0xf8d2('0x2e')]);_0x1fe373[_0xf8d2('0x31')]=_['keys'](_0x220078['query']);_0x1fe373['filters']=_[_0xf8d2('0x34')](_0x1fe373['model'],_0x1fe373['query']);_0x11848f[_0xf8d2('0x37')]=_[_0xf8d2('0x34')](_0x1fe373[_0xf8d2('0x35')],qs['fields'](_0x220078[_0xf8d2('0x31')][_0xf8d2('0x36')]));_0x11848f['attributes']=_0x11848f[_0xf8d2('0x37')][_0xf8d2('0x38')]?_0x11848f[_0xf8d2('0x37')]:_0x1fe373[_0xf8d2('0x35')];if(_0x220078[_0xf8d2('0x31')][_0xf8d2('0x44')]){_0x11848f[_0xf8d2('0x45')]=[{'all':!![]}];}_0x11848f=_[_0xf8d2('0x3f')]({},_0x11848f,_0x220078[_0xf8d2('0x42')]);return db['CmHopperBlack'][_0xf8d2('0x49')](_0x11848f)[_0xf8d2('0x28')](handleEntityNotFound(_0x18f344,null))[_0xf8d2('0x28')](respondWithResult(_0x18f344,null))[_0xf8d2('0x48')](handleError(_0x18f344,null));};exports[_0xf8d2('0x4a')]=function(_0x4fde5f,_0xf26424){if(_0x4fde5f[_0xf8d2('0x4b')]['id']){delete _0x4fde5f['body']['id'];}return db[_0xf8d2('0x43')][_0xf8d2('0x49')]({'where':{'id':_0x4fde5f['params']['id']}})[_0xf8d2('0x28')](handleEntityNotFound(_0xf26424,null))[_0xf8d2('0x28')](saveUpdates(_0x4fde5f['body'],null))[_0xf8d2('0x28')](respondWithResult(_0xf26424,null))[_0xf8d2('0x48')](handleError(_0xf26424,null));};exports[_0xf8d2('0x27')]=function(_0x390254,_0xc3b914){return db['CmHopperBlack'][_0xf8d2('0x49')]({'where':{'id':_0x390254['params']['id']}})[_0xf8d2('0x28')](handleEntityNotFound(_0xc3b914,null))[_0xf8d2('0x28')](removeEntity(_0xc3b914,null))[_0xf8d2('0x48')](handleError(_0xc3b914,null));};exports[_0xf8d2('0x4c')]=function(_0x44c4c9,_0x345836){return db[_0xf8d2('0x43')]['describe']()[_0xf8d2('0x28')](respondWithResult(_0x345836,null))[_0xf8d2('0x48')](handleError(_0x345836,null));}; \ No newline at end of file +var _0xb8f0=['reject','destroy','then','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','CmHopperBlack','findAll','catch','show','find','update','body','describe','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply'];(function(_0x2458ce,_0x2ae1a4){var _0x4d8053=function(_0x5b75bd){while(--_0x5b75bd){_0x2458ce['push'](_0x2458ce['shift']());}};_0x4d8053(++_0x2ae1a4);}(_0xb8f0,0x6d));var _0x0b8f=function(_0x51de7d,_0x49dc29){_0x51de7d=_0x51de7d-0x0;var _0x454bea=_0xb8f0[_0x51de7d];return _0x454bea;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0b8f('0x0'));var jsonpatch=require(_0x0b8f('0x1'));var rp=require(_0x0b8f('0x2'));var moment=require(_0x0b8f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0b8f('0x4'));var sox=require(_0x0b8f('0x5'));var csv=require(_0x0b8f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0b8f('0x7'));var _=require(_0x0b8f('0x8'));var squel=require(_0x0b8f('0x9'));var crypto=require('crypto');var jsforce=require(_0x0b8f('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x0b8f('0x6'));var querystring=require(_0x0b8f('0xb'));var Papa=require(_0x0b8f('0xc'));var Redis=require(_0x0b8f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x0b8f('0xe'));var as=require(_0x0b8f('0xf'));var hardwareService=require(_0x0b8f('0x10'));var logger=require(_0x0b8f('0x11'))('api');var utils=require(_0x0b8f('0x12'));var config=require(_0x0b8f('0x13'));var licenseUtil=require(_0x0b8f('0x14'));var db=require(_0x0b8f('0x15'))['db'];function respondWithStatusCode(_0x2611ff,_0x3da90b){_0x3da90b=_0x3da90b||0xcc;return function(_0x467754){if(_0x467754){return _0x2611ff[_0x0b8f('0x16')](_0x3da90b);}return _0x2611ff['status'](_0x3da90b)[_0x0b8f('0x17')]();};}function respondWithResult(_0x3bb078,_0x1141aa){_0x1141aa=_0x1141aa||0xc8;return function(_0x2e5a86){if(_0x2e5a86){return _0x3bb078[_0x0b8f('0x18')](_0x1141aa)[_0x0b8f('0x19')](_0x2e5a86);}};}function respondWithFilteredResult(_0xccede8,_0x43fddc){return function(_0x2d0b32){if(_0x2d0b32){var _0x3db2ca=typeof _0x43fddc[_0x0b8f('0x1a')]==='undefined'&&typeof _0x43fddc[_0x0b8f('0x1b')]===_0x0b8f('0x1c');var _0x6534dc=_0x2d0b32[_0x0b8f('0x1d')];var _0x250a42=_0x3db2ca?0x0:_0x43fddc[_0x0b8f('0x1a')];var _0x4a42ec=_0x3db2ca?_0x2d0b32['count']:_0x43fddc[_0x0b8f('0x1a')]+_0x43fddc['limit'];var _0x1cbe18;if(_0x4a42ec>=_0x6534dc){_0x4a42ec=_0x6534dc;_0x1cbe18=0xc8;}else{_0x1cbe18=0xce;}_0xccede8['status'](_0x1cbe18);return _0xccede8[_0x0b8f('0x1e')](_0x0b8f('0x1f'),_0x250a42+'-'+_0x4a42ec+'/'+_0x6534dc)[_0x0b8f('0x19')](_0x2d0b32);}return null;};}function patchUpdates(_0x2eab8e){return function(_0x5cb0b6){try{jsonpatch[_0x0b8f('0x20')](_0x5cb0b6,_0x2eab8e,!![]);}catch(_0x5917ef){return BPromise[_0x0b8f('0x21')](_0x5917ef);}return _0x5cb0b6['save']();};}function saveUpdates(_0x3f3904,_0x36c5a4){return function(_0xad44fe){if(_0xad44fe){return _0xad44fe['update'](_0x3f3904)['then'](function(_0x4d5584){return _0x4d5584;});}return null;};}function removeEntity(_0x2fca24,_0x31af88){return function(_0x1df9e1){if(_0x1df9e1){return _0x1df9e1[_0x0b8f('0x22')]()[_0x0b8f('0x23')](function(){_0x2fca24[_0x0b8f('0x18')](0xcc)[_0x0b8f('0x17')]();});}};}function handleEntityNotFound(_0x5b47d1,_0x303484){return function(_0xe58b70){if(!_0xe58b70){_0x5b47d1[_0x0b8f('0x16')](0x194);}return _0xe58b70;};}function handleError(_0x16f167,_0xf4afda){_0xf4afda=_0xf4afda||0x1f4;return function(_0x1c2800){logger[_0x0b8f('0x24')](_0x1c2800['stack']);if(_0x1c2800['name']){delete _0x1c2800[_0x0b8f('0x25')];}_0x16f167['status'](_0xf4afda)[_0x0b8f('0x26')](_0x1c2800);};}exports[_0x0b8f('0x27')]=function(_0x194c7b,_0x19ae44){var _0x422a60={},_0x54649b={},_0x2f2aea={'count':0x0,'rows':[]};var _0x1e842b=_[_0x0b8f('0x28')](db['CmHopperBlack'][_0x0b8f('0x29')],function(_0x45c7c6){return{'name':_0x45c7c6[_0x0b8f('0x2a')],'type':_0x45c7c6['type'][_0x0b8f('0x2b')]};});_0x54649b[_0x0b8f('0x2c')]=_['map'](_0x1e842b,_0x0b8f('0x25'));_0x54649b[_0x0b8f('0x2d')]=_[_0x0b8f('0x2e')](_0x194c7b['query']);_0x54649b['filters']=_[_0x0b8f('0x2f')](_0x54649b[_0x0b8f('0x2c')],_0x54649b[_0x0b8f('0x2d')]);_0x422a60[_0x0b8f('0x30')]=_[_0x0b8f('0x2f')](_0x54649b[_0x0b8f('0x2c')],qs[_0x0b8f('0x31')](_0x194c7b['query']['fields']));_0x422a60['attributes']=_0x422a60[_0x0b8f('0x30')]['length']?_0x422a60[_0x0b8f('0x30')]:_0x54649b[_0x0b8f('0x2c')];if(!_0x194c7b['query'][_0x0b8f('0x32')](_0x0b8f('0x33'))){_0x422a60[_0x0b8f('0x1b')]=qs['limit'](_0x194c7b[_0x0b8f('0x2d')][_0x0b8f('0x1b')]);_0x422a60[_0x0b8f('0x1a')]=qs[_0x0b8f('0x1a')](_0x194c7b['query'][_0x0b8f('0x1a')]);}_0x422a60[_0x0b8f('0x34')]=qs[_0x0b8f('0x35')](_0x194c7b[_0x0b8f('0x2d')][_0x0b8f('0x35')]);_0x422a60[_0x0b8f('0x36')]=qs[_0x0b8f('0x37')](_['pick'](_0x194c7b[_0x0b8f('0x2d')],_0x54649b[_0x0b8f('0x37')]),_0x1e842b);if(_0x194c7b['query'][_0x0b8f('0x38')]){_0x422a60[_0x0b8f('0x36')]=_[_0x0b8f('0x39')](_0x422a60['where'],{'$or':_[_0x0b8f('0x28')](_0x1e842b,function(_0x3ed392){if(_0x3ed392[_0x0b8f('0x3a')]!==_0x0b8f('0x3b')){var _0x67af49={};_0x67af49[_0x3ed392[_0x0b8f('0x25')]]={'$like':'%'+_0x194c7b[_0x0b8f('0x2d')][_0x0b8f('0x38')]+'%'};return _0x67af49;}})});}_0x422a60=_['merge']({},_0x422a60,_0x194c7b[_0x0b8f('0x3c')]);var _0x263bda={'where':_0x422a60[_0x0b8f('0x36')]};return db['CmHopperBlack']['count'](_0x263bda)[_0x0b8f('0x23')](function(_0x3c8285){_0x2f2aea[_0x0b8f('0x1d')]=_0x3c8285;if(_0x194c7b[_0x0b8f('0x2d')][_0x0b8f('0x3d')]){_0x422a60[_0x0b8f('0x3e')]=[{'all':!![]}];}return db[_0x0b8f('0x3f')][_0x0b8f('0x40')](_0x422a60);})[_0x0b8f('0x23')](function(_0x17c70d){_0x2f2aea['rows']=_0x17c70d;return _0x2f2aea;})['then'](respondWithFilteredResult(_0x19ae44,_0x422a60))[_0x0b8f('0x41')](handleError(_0x19ae44,null));};exports[_0x0b8f('0x42')]=function(_0x27b598,_0x4a2f8b){var _0xfb3f8e={'raw':!![],'where':{'id':_0x27b598['params']['id']}},_0x3198df={};_0x3198df[_0x0b8f('0x2c')]=_[_0x0b8f('0x2e')](db[_0x0b8f('0x3f')][_0x0b8f('0x29')]);_0x3198df[_0x0b8f('0x2d')]=_['keys'](_0x27b598[_0x0b8f('0x2d')]);_0x3198df[_0x0b8f('0x37')]=_[_0x0b8f('0x2f')](_0x3198df[_0x0b8f('0x2c')],_0x3198df[_0x0b8f('0x2d')]);_0xfb3f8e['attributes']=_[_0x0b8f('0x2f')](_0x3198df[_0x0b8f('0x2c')],qs['fields'](_0x27b598[_0x0b8f('0x2d')][_0x0b8f('0x31')]));_0xfb3f8e[_0x0b8f('0x30')]=_0xfb3f8e[_0x0b8f('0x30')]['length']?_0xfb3f8e['attributes']:_0x3198df[_0x0b8f('0x2c')];if(_0x27b598[_0x0b8f('0x2d')][_0x0b8f('0x3d')]){_0xfb3f8e[_0x0b8f('0x3e')]=[{'all':!![]}];}_0xfb3f8e=_[_0x0b8f('0x39')]({},_0xfb3f8e,_0x27b598[_0x0b8f('0x3c')]);return db['CmHopperBlack'][_0x0b8f('0x43')](_0xfb3f8e)[_0x0b8f('0x23')](handleEntityNotFound(_0x4a2f8b,null))['then'](respondWithResult(_0x4a2f8b,null))['catch'](handleError(_0x4a2f8b,null));};exports[_0x0b8f('0x44')]=function(_0x1905de,_0x616422){if(_0x1905de[_0x0b8f('0x45')]['id']){delete _0x1905de[_0x0b8f('0x45')]['id'];}return db[_0x0b8f('0x3f')][_0x0b8f('0x43')]({'where':{'id':_0x1905de['params']['id']}})[_0x0b8f('0x23')](handleEntityNotFound(_0x616422,null))[_0x0b8f('0x23')](saveUpdates(_0x1905de[_0x0b8f('0x45')],null))['then'](respondWithResult(_0x616422,null))[_0x0b8f('0x41')](handleError(_0x616422,null));};exports[_0x0b8f('0x22')]=function(_0x3de668,_0x3fd2ae){return db[_0x0b8f('0x3f')][_0x0b8f('0x43')]({'where':{'id':_0x3de668['params']['id']}})[_0x0b8f('0x23')](handleEntityNotFound(_0x3fd2ae,null))[_0x0b8f('0x23')](removeEntity(_0x3fd2ae,null))[_0x0b8f('0x41')](handleError(_0x3fd2ae,null));};exports[_0x0b8f('0x46')]=function(_0x520459,_0x3f86d5){return db[_0x0b8f('0x3f')]['describe']()['then'](respondWithResult(_0x3f86d5,null))[_0x0b8f('0x41')](handleError(_0x3f86d5,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 0877d88..db5f9d1 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 _0xeaad=['CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define'];(function(_0x23a4b,_0x3144c7){var _0x2eba74=function(_0x33c5e2){while(--_0x33c5e2){_0x23a4b['push'](_0x23a4b['shift']());}};_0x2eba74(++_0x3144c7);}(_0xeaad,0x84));var _0xdeaa=function(_0x350d98,_0x964da8){_0x350d98=_0x350d98-0x0;var _0x4218d9=_0xeaad[_0x350d98];return _0x4218d9;};'use strict';var _=require(_0xdeaa('0x0'));var util=require(_0xdeaa('0x1'));var logger=require(_0xdeaa('0x2'))('api');var moment=require(_0xdeaa('0x3'));var BPromise=require(_0xdeaa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdeaa('0x5'));var rimraf=require(_0xdeaa('0x6'));var config=require(_0xdeaa('0x7'));var attributes=require(_0xdeaa('0x8'));module[_0xdeaa('0x9')]=function(_0xdf0859,_0x5cd553){return _0xdf0859[_0xdeaa('0xa')](_0xdeaa('0xb'),attributes,{'tableName':_0xdeaa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc5c1=['path','rimraf','../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x5eefb7,_0x49eb5b){var _0x5675a7=function(_0x506702){while(--_0x506702){_0x5eefb7['push'](_0x5eefb7['shift']());}};_0x5675a7(++_0x49eb5b);}(_0xc5c1,0x19a));var _0x1c5c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc5c1[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x1c5c('0x0'));var util=require(_0x1c5c('0x1'));var logger=require(_0x1c5c('0x2'))(_0x1c5c('0x3'));var moment=require(_0x1c5c('0x4'));var BPromise=require('bluebird');var rp=require(_0x1c5c('0x5'));var fs=require('fs');var path=require(_0x1c5c('0x6'));var rimraf=require(_0x1c5c('0x7'));var config=require(_0x1c5c('0x8'));var attributes=require(_0x1c5c('0x9'));module['exports']=function(_0x3cf9b1,_0x3cd94c){return _0x3cf9b1[_0x1c5c('0xa')](_0x1c5c('0xb'),attributes,{'tableName':_0x1c5c('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 3d4cfe4..402dae5 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 _0x4b0b=['code','CmHopperBlack,\x20%s,\x20%s','message','info','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','include','model','map','stringify','update','body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','error'];(function(_0x1563e0,_0x44d75a){var _0x540923=function(_0x584162){while(--_0x584162){_0x1563e0['push'](_0x1563e0['shift']());}};_0x540923(++_0x44d75a);}(_0x4b0b,0x1de));var _0xb4b0=function(_0x333f2c,_0x662158){_0x333f2c=_0x333f2c-0x0;var _0x33e61c=_0x4b0b[_0x333f2c];return _0x33e61c;};'use strict';var _=require('lodash');var util=require(_0xb4b0('0x0'));var moment=require(_0xb4b0('0x1'));var BPromise=require(_0xb4b0('0x2'));var rs=require(_0xb4b0('0x3'));var fs=require('fs');var Redis=require(_0xb4b0('0x4'));var db=require(_0xb4b0('0x5'))['db'];var utils=require(_0xb4b0('0x6'));var logger=require('../../config/logger')(_0xb4b0('0x7'));var config=require(_0xb4b0('0x8'));var jayson=require(_0xb4b0('0x9'));var client=jayson['client'][_0xb4b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ef4e9,_0xd8d3e,_0x3f1ab7){return new BPromise(function(_0x36e1ab,_0x4ca2b9){return client[_0xb4b0('0xb')](_0x5ef4e9,_0x3f1ab7)[_0xb4b0('0xc')](function(_0x4e962f){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0xd8d3e,_0xb4b0('0xd'));logger[_0xb4b0('0xe')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0xd8d3e,_0xb4b0('0xd'),JSON['stringify'](_0x4e962f));if(_0x4e962f[_0xb4b0('0xf')]){if(_0x4e962f[_0xb4b0('0xf')][_0xb4b0('0x10')]===0x1f4){logger[_0xb4b0('0xf')](_0xb4b0('0x11'),_0xd8d3e,_0x4e962f[_0xb4b0('0xf')][_0xb4b0('0x12')]);return _0x4ca2b9(_0x4e962f[_0xb4b0('0xf')][_0xb4b0('0x12')]);}logger[_0xb4b0('0xf')](_0xb4b0('0x11'),_0xd8d3e,_0x4e962f[_0xb4b0('0xf')][_0xb4b0('0x12')]);return _0x36e1ab(_0x4e962f[_0xb4b0('0xf')][_0xb4b0('0x12')]);}else{logger[_0xb4b0('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0xd8d3e,_0xb4b0('0xd'));_0x36e1ab(_0x4e962f[_0xb4b0('0x14')][_0xb4b0('0x12')]);}})[_0xb4b0('0x15')](function(_0x1c37b1){logger['error'](_0xb4b0('0x11'),_0xd8d3e,_0x1c37b1);_0x4ca2b9(_0x1c37b1);});});}exports[_0xb4b0('0x16')]=function(_0x55846b){var _0x38089b=this;return new Promise(function(_0x1ec325,_0x52a02d){return db[_0xb4b0('0x17')]['findAll']({'raw':_0x55846b[_0xb4b0('0x18')]?_0x55846b[_0xb4b0('0x18')][_0xb4b0('0x19')]===undefined?!![]:![]:!![],'where':_0x55846b[_0xb4b0('0x18')]?_0x55846b[_0xb4b0('0x18')][_0xb4b0('0x1a')]||null:null,'attributes':_0x55846b[_0xb4b0('0x18')]?_0x55846b[_0xb4b0('0x18')][_0xb4b0('0x1b')]||null:null,'limit':_0x55846b[_0xb4b0('0x18')]?_0x55846b[_0xb4b0('0x18')][_0xb4b0('0x1c')]||null:null,'include':_0x55846b[_0xb4b0('0x18')]?_0x55846b['options']['include']?_['map'](_0x55846b[_0xb4b0('0x18')][_0xb4b0('0x1d')],function(_0x1b26b0){return{'model':db[_0x1b26b0[_0xb4b0('0x1e')]],'as':_0x1b26b0['as'],'attributes':_0x1b26b0[_0xb4b0('0x1b')],'include':_0x1b26b0[_0xb4b0('0x1d')]?_[_0xb4b0('0x1f')](_0x1b26b0[_0xb4b0('0x1d')],function(_0x38da2a){return{'model':db[_0x38da2a[_0xb4b0('0x1e')]],'as':_0x38da2a['as'],'attributes':_0x38da2a[_0xb4b0('0x1b')],'include':_0x38da2a[_0xb4b0('0x1d')]?_[_0xb4b0('0x1f')](_0x38da2a['include'],function(_0x250736){return{'model':db[_0x250736[_0xb4b0('0x1e')]],'as':_0x250736['as'],'attributes':_0x250736[_0xb4b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb4b0('0xc')](function(_0x21c739){logger['info'](_0xb4b0('0x16'),_0x55846b);logger['debug']('GetCmHopperBlack',_0x55846b,JSON[_0xb4b0('0x20')](_0x21c739));_0x1ec325(_0x21c739);})[_0xb4b0('0x15')](function(_0x4554f5){logger[_0xb4b0('0xf')](_0xb4b0('0x16'),_0x4554f5['message'],_0x55846b);_0x52a02d(_0x38089b['error'](0x1f4,_0x4554f5[_0xb4b0('0x12')]));});});};exports['UpdateCmHopperBlack']=function(_0x38aa6d){var _0x45554e=this;return new Promise(function(_0x3fada4,_0x16a00e){return db[_0xb4b0('0x17')][_0xb4b0('0x21')](_0x38aa6d[_0xb4b0('0x22')],{'raw':_0x38aa6d[_0xb4b0('0x18')]?_0x38aa6d[_0xb4b0('0x18')][_0xb4b0('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38aa6d[_0xb4b0('0x18')]?_0x38aa6d[_0xb4b0('0x18')][_0xb4b0('0x1a')]||null:null,'attributes':_0x38aa6d['options']?_0x38aa6d[_0xb4b0('0x18')]['attributes']||null:null,'limit':_0x38aa6d[_0xb4b0('0x18')]?_0x38aa6d[_0xb4b0('0x18')]['limit']||null:null})[_0xb4b0('0xc')](function(_0x3dec3b){logger['info'](_0xb4b0('0x23'),_0x38aa6d);logger[_0xb4b0('0xe')]('UpdateCmHopperBlack',_0x38aa6d,JSON['stringify'](_0x3dec3b));_0x3fada4(_0x3dec3b);})[_0xb4b0('0x15')](function(_0x5ac55a){logger[_0xb4b0('0xf')]('UpdateCmHopperBlack',_0x5ac55a[_0xb4b0('0x12')],_0x38aa6d);_0x16a00e(_0x45554e['error'](0x1f4,_0x5ac55a[_0xb4b0('0x12')]));});});};exports[_0xb4b0('0x24')]=function(_0xa7cec){var _0x4dbb67=this;return new Promise(function(_0x10d22f,_0x87d020){return db[_0xb4b0('0x17')][_0xb4b0('0x25')]({'where':_0xa7cec['options']?_0xa7cec['options'][_0xb4b0('0x1a')]||null:null})[_0xb4b0('0xc')](function(_0x4b8f2e){logger[_0xb4b0('0x13')](_0xb4b0('0x24'),_0xa7cec);logger[_0xb4b0('0xe')](_0xb4b0('0x24'),_0xa7cec,JSON[_0xb4b0('0x20')](_0x4b8f2e));_0x10d22f(_0x4b8f2e);})[_0xb4b0('0x15')](function(_0x24140d){logger[_0xb4b0('0xf')](_0xb4b0('0x24'),_0x24140d['message'],_0xa7cec);_0x87d020(_0x4dbb67[_0xb4b0('0xf')](0x1f4,_0x24140d[_0xb4b0('0x12')]));});});}; \ No newline at end of file +var _0xec40=['limit','include','map','model','then','debug','UpdateCmHopperBlack','body','raw','DestroyCmHopperBlack','destroy','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','request','info','CmHopperBlack,\x20%s,\x20%s','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','where','attributes'];(function(_0x1836be,_0x3443d8){var _0xcebc12=function(_0x1238f6){while(--_0x1238f6){_0x1836be['push'](_0x1836be['shift']());}};_0xcebc12(++_0x3443d8);}(_0xec40,0x1d2));var _0x0ec4=function(_0x3058bc,_0x391ddb){_0x3058bc=_0x3058bc-0x0;var _0x586a60=_0xec40[_0x3058bc];return _0x586a60;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0ec4('0x0'));var BPromise=require(_0x0ec4('0x1'));var rs=require(_0x0ec4('0x2'));var fs=require('fs');var Redis=require(_0x0ec4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0ec4('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x0ec4('0x5'));var jayson=require(_0x0ec4('0x6'));var client=jayson[_0x0ec4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x96aa3d,_0x5a23e7,_0x120844){return new BPromise(function(_0x20713e,_0x50c9ed){return client[_0x0ec4('0x8')](_0x96aa3d,_0x120844)['then'](function(_0x2eecc7){logger[_0x0ec4('0x9')](_0x0ec4('0xa'),_0x5a23e7,'request\x20sent');logger['debug'](_0x0ec4('0xb'),_0x5a23e7,'request\x20sent',JSON[_0x0ec4('0xc')](_0x2eecc7));if(_0x2eecc7[_0x0ec4('0xd')]){if(_0x2eecc7['error']['code']===0x1f4){logger[_0x0ec4('0xd')](_0x0ec4('0xa'),_0x5a23e7,_0x2eecc7['error'][_0x0ec4('0xe')]);return _0x50c9ed(_0x2eecc7[_0x0ec4('0xd')][_0x0ec4('0xe')]);}logger[_0x0ec4('0xd')](_0x0ec4('0xa'),_0x5a23e7,_0x2eecc7[_0x0ec4('0xd')][_0x0ec4('0xe')]);return _0x20713e(_0x2eecc7[_0x0ec4('0xd')][_0x0ec4('0xe')]);}else{logger[_0x0ec4('0x9')](_0x0ec4('0xa'),_0x5a23e7,_0x0ec4('0xf'));_0x20713e(_0x2eecc7[_0x0ec4('0x10')][_0x0ec4('0xe')]);}})[_0x0ec4('0x11')](function(_0x1d8eaa){logger[_0x0ec4('0xd')](_0x0ec4('0xa'),_0x5a23e7,_0x1d8eaa);_0x50c9ed(_0x1d8eaa);});});}exports[_0x0ec4('0x12')]=function(_0x491be5){var _0x1ccba0=this;return new Promise(function(_0xda159b,_0x464391){return db[_0x0ec4('0x13')][_0x0ec4('0x14')]({'raw':_0x491be5['options']?_0x491be5[_0x0ec4('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x491be5[_0x0ec4('0x15')]?_0x491be5['options'][_0x0ec4('0x16')]||null:null,'attributes':_0x491be5[_0x0ec4('0x15')]?_0x491be5[_0x0ec4('0x15')][_0x0ec4('0x17')]||null:null,'limit':_0x491be5[_0x0ec4('0x15')]?_0x491be5[_0x0ec4('0x15')][_0x0ec4('0x18')]||null:null,'include':_0x491be5[_0x0ec4('0x15')]?_0x491be5[_0x0ec4('0x15')][_0x0ec4('0x19')]?_['map'](_0x491be5[_0x0ec4('0x15')][_0x0ec4('0x19')],function(_0x5ee5d8){return{'model':db[_0x5ee5d8['model']],'as':_0x5ee5d8['as'],'attributes':_0x5ee5d8[_0x0ec4('0x17')],'include':_0x5ee5d8['include']?_[_0x0ec4('0x1a')](_0x5ee5d8['include'],function(_0x11ccce){return{'model':db[_0x11ccce[_0x0ec4('0x1b')]],'as':_0x11ccce['as'],'attributes':_0x11ccce[_0x0ec4('0x17')],'include':_0x11ccce[_0x0ec4('0x19')]?_[_0x0ec4('0x1a')](_0x11ccce[_0x0ec4('0x19')],function(_0x697f5a){return{'model':db[_0x697f5a[_0x0ec4('0x1b')]],'as':_0x697f5a['as'],'attributes':_0x697f5a[_0x0ec4('0x17')]};}):[]};}):[]};}):[]:[]})[_0x0ec4('0x1c')](function(_0x20b2ba){logger[_0x0ec4('0x9')](_0x0ec4('0x12'),_0x491be5);logger[_0x0ec4('0x1d')](_0x0ec4('0x12'),_0x491be5,JSON[_0x0ec4('0xc')](_0x20b2ba));_0xda159b(_0x20b2ba);})['catch'](function(_0x7c0574){logger[_0x0ec4('0xd')]('GetCmHopperBlack',_0x7c0574[_0x0ec4('0xe')],_0x491be5);_0x464391(_0x1ccba0['error'](0x1f4,_0x7c0574[_0x0ec4('0xe')]));});});};exports[_0x0ec4('0x1e')]=function(_0x4a78f2){var _0x360ed9=this;return new Promise(function(_0x3bc4e1,_0xf668fa){return db[_0x0ec4('0x13')]['update'](_0x4a78f2[_0x0ec4('0x1f')],{'raw':_0x4a78f2[_0x0ec4('0x15')]?_0x4a78f2[_0x0ec4('0x15')][_0x0ec4('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a78f2[_0x0ec4('0x15')]?_0x4a78f2['options'][_0x0ec4('0x16')]||null:null,'attributes':_0x4a78f2['options']?_0x4a78f2['options'][_0x0ec4('0x17')]||null:null,'limit':_0x4a78f2[_0x0ec4('0x15')]?_0x4a78f2[_0x0ec4('0x15')][_0x0ec4('0x18')]||null:null})[_0x0ec4('0x1c')](function(_0x6c3ddd){logger[_0x0ec4('0x9')](_0x0ec4('0x1e'),_0x4a78f2);logger[_0x0ec4('0x1d')](_0x0ec4('0x1e'),_0x4a78f2,JSON[_0x0ec4('0xc')](_0x6c3ddd));_0x3bc4e1(_0x6c3ddd);})[_0x0ec4('0x11')](function(_0x50ff64){logger['error'](_0x0ec4('0x1e'),_0x50ff64['message'],_0x4a78f2);_0xf668fa(_0x360ed9['error'](0x1f4,_0x50ff64[_0x0ec4('0xe')]));});});};exports[_0x0ec4('0x21')]=function(_0x51bbd0){var _0x3e40cb=this;return new Promise(function(_0x2e7d7c,_0x10eeca){return db[_0x0ec4('0x13')][_0x0ec4('0x22')]({'where':_0x51bbd0[_0x0ec4('0x15')]?_0x51bbd0[_0x0ec4('0x15')][_0x0ec4('0x16')]||null:null})[_0x0ec4('0x1c')](function(_0x14a7d9){logger[_0x0ec4('0x9')](_0x0ec4('0x21'),_0x51bbd0);logger[_0x0ec4('0x1d')](_0x0ec4('0x21'),_0x51bbd0,JSON[_0x0ec4('0xc')](_0x14a7d9));_0x2e7d7c(_0x14a7d9);})[_0x0ec4('0x11')](function(_0x266b92){logger[_0x0ec4('0xd')](_0x0ec4('0x21'),_0x266b92[_0x0ec4('0xe')],_0x51bbd0);_0x10eeca(_0x3e40cb[_0x0ec4('0xd')](0x1f4,_0x266b92[_0x0ec4('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index f14d8f2..27d9ed0 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 _0xc2c7=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','update','delete'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0xc2c7,0x134));var _0x7c2c=function(_0x138343,_0x3791ba){_0x138343=_0x138343-0x0;var _0x1fc80c=_0xc2c7[_0x138343];return _0x1fc80c;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var fs_extra=require(_0x7c2c('0x5'));var auth=require(_0x7c2c('0x6'));var interaction=require(_0x7c2c('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0x7c2c('0x8')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0x8')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xd')]);router['put'](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xe')]);router[_0x7c2c('0xf')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x10')]);module[_0x7c2c('0x11')]=router; \ No newline at end of file +var _0xabce=['show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe'];(function(_0x1a160b,_0x2d0aa4){var _0x214166=function(_0x546d34){while(--_0x546d34){_0x1a160b['push'](_0x1a160b['shift']());}};_0x214166(++_0x2d0aa4);}(_0xabce,0x103));var _0xeabc=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xabce[_0x47b58b];return _0x46bebe;};'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('./cmHopperBlack.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('0xc')](_0xeabc('0xd'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xe')]);router[_0xeabc('0xf')](_0xeabc('0xd'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);module[_0xeabc('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 9cb4a09..e9b59f9 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 _0x673f=['STRING','DATE','getDataValue','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment','INTEGER'];(function(_0x2a7812,_0x1ce83a){var _0x3e1342=function(_0x3ff9fb){while(--_0x3ff9fb){_0x2a7812['push'](_0x2a7812['shift']());}};_0x3e1342(++_0x1ce83a);}(_0x673f,0x6b));var _0xf673=function(_0x4277b0,_0x2b2cf6){_0x4277b0=_0x4277b0-0x0;var _0x57c93f=_0x673f[_0x4277b0];return _0x57c93f;};'use strict';var Sequelize=require(_0xf673('0x0'));var moment=require(_0xf673('0x1'));module['exports']={'state':{'type':Sequelize[_0xf673('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf673('0x3')]},'scheduledat':{'type':Sequelize[_0xf673('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf673('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf673('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xf673('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xf673('0x3')]},'originatecalleridname':{'type':Sequelize[_0xf673('0x3')]},'calleridnum':{'type':Sequelize[_0xf673('0x3')]},'calleridname':{'type':Sequelize[_0xf673('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xf673('0x4')]},'answertime':{'type':Sequelize[_0xf673('0x4')]},'droptime':{'type':Sequelize[_0xf673('0x4')]},'endtime':{'type':Sequelize[_0xf673('0x4')]},'ringtime':{'type':Sequelize[_0xf673('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf673('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xf673('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf673('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xf673('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xf673('0x3')]},'disposition':{'type':Sequelize[_0xf673('0x3')]},'secondDisposition':{'type':Sequelize[_0xf673('0x3')]},'thirdDisposition':{'type':Sequelize[_0xf673('0x3')]},'dispositionat':{'type':Sequelize[_0xf673('0x4')],'set':function(_0x3f2125){var _0x2a3ef4=this[_0xf673('0x5')]('endtime');if(_0x2a3ef4&&_0x3f2125){this[_0xf673('0x6')](_0xf673('0x7'),moment(_0x3f2125)[_0xf673('0x8')](moment(_0x2a3ef4),_0xf673('0x9')));}}},'amd':{'type':Sequelize[_0xf673('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xf673('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xf673('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xf673('0x4')]},'callback':{'type':Sequelize[_0xf673('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf673('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xf673('0x4')]},'recallme':{'type':Sequelize[_0xf673('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf673('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf673('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8428=['DATE','INTEGER','getDataValue','setDataValue','followuptime','diff','seconds','BOOLEAN','exports','STRING'];(function(_0x495a57,_0x5cf0ef){var _0x4230b6=function(_0x1f05d1){while(--_0x1f05d1){_0x495a57['push'](_0x495a57['shift']());}};_0x4230b6(++_0x5cf0ef);}(_0x8428,0x10c));var _0x8842=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8428[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x8842('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x8842('0x1')]},'scheduledat':{'type':Sequelize[_0x8842('0x2')]},'countbusyretry':{'type':Sequelize[_0x8842('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8842('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8842('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8842('0x1')]},'originatecalleridnum':{'type':Sequelize[_0x8842('0x1')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x8842('0x1')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x8842('0x2')]},'responsetime':{'type':Sequelize[_0x8842('0x2')]},'answertime':{'type':Sequelize[_0x8842('0x2')]},'droptime':{'type':Sequelize[_0x8842('0x2')]},'endtime':{'type':Sequelize[_0x8842('0x2')]},'ringtime':{'type':Sequelize[_0x8842('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8842('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8842('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x8842('0x1')]},'membername':{'type':Sequelize[_0x8842('0x1')]},'reason':{'type':Sequelize[_0x8842('0x1')]},'disposition':{'type':Sequelize[_0x8842('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8842('0x1')]},'dispositionat':{'type':Sequelize[_0x8842('0x2')],'set':function(_0x432bc1){var _0x4b7080=this[_0x8842('0x4')]('endtime');if(_0x4b7080&&_0x432bc1){this[_0x8842('0x5')](_0x8842('0x6'),moment(_0x432bc1)[_0x8842('0x7')](moment(_0x4b7080),_0x8842('0x8')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x8842('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x8842('0x2')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8842('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x8842('0x1')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x8842('0x2')]},'recallme':{'type':Sequelize[_0x8842('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x8842('0x2')]},'countnosuchnumberretry':{'type':Sequelize[_0x8842('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8842('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8842('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8842('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8842('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index eb59a5c..ed98ef5 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 _0x5fab=['json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','name','send','index','map','CmHopperFinal','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','describe','body','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','dropContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','select','field','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','NOW()','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','Campaign','insert','CampaignId','createdAt','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','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','status'];(function(_0x3dac0e,_0x5532f7){var _0x273bc2=function(_0x5a8062){while(--_0x5a8062){_0x3dac0e['push'](_0x3dac0e['shift']());}};_0x273bc2(++_0x5532f7);}(_0x5fab,0x177));var _0xb5fa=function(_0x80544e,_0x37a3f3){_0x80544e=_0x80544e-0x0;var _0x4f9b90=_0x5fab[_0x80544e];return _0x4f9b90;};'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['CmHopperFinal'][_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')]()[_0xb5fa('0x43')](respondWithResult(_0x20f5f5,null))[_0xb5fa('0x4b')](handleError(_0x20f5f5,null));};exports[_0xb5fa('0x25')]=function(_0x42a359,_0x3a39f2){if(_0x42a359['body']['uniqueid']){delete _0x42a359[_0xb5fa('0x4d')]['uniqueid'];}return db[_0xb5fa('0x2d')][_0xb5fa('0x4a')]({'where':{'uniqueid':_0x42a359['params']['id']}})[_0xb5fa('0x43')](handleEntityNotFound(_0x3a39f2,null))[_0xb5fa('0x43')](saveUpdates(_0x42a359[_0xb5fa('0x4d')],null))[_0xb5fa('0x43')](respondWithResult(_0x3a39f2,null))[_0xb5fa('0x4b')](handleError(_0x3a39f2,null));};exports[_0xb5fa('0x4e')]=function(_0x51d5f7,_0x27a651,_0x4fd5bf){return db[_0xb5fa('0x2d')][_0xb5fa('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x51d5f7[_0xb5fa('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db['sequelize']['literal'](_0xb5fa('0x51')))),_0xb5fa('0x52')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x54')))),_0xb5fa('0x55')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x56')))),_0xb5fa('0x57')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db['sequelize']['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x58')))),_0xb5fa('0x59')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x5a')))),'dropContacts'],[db['sequelize']['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')]['literal'](_0xb5fa('0x5b')))),_0xb5fa('0x5c')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')]('`state`\x20=\x2022,\x201,\x20null'))),_0xb5fa('0x5d')],[db[_0xb5fa('0x50')]['fn']('COUNT',db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')]['literal'](_0xb5fa('0x5e')))),_0xb5fa('0x5f')]]})[_0xb5fa('0x43')](handleEntityNotFound(_0x27a651,null))[_0xb5fa('0x43')](respondWithResult(_0x27a651,null))[_0xb5fa('0x4b')](handleError(_0x27a651,null));};exports[_0xb5fa('0x60')]=function(_0x18cde9,_0x40d7d5,_0xd2ba4e){return db[_0xb5fa('0x2d')][_0xb5fa('0x42')]({'raw':![],'where':{'CampaignId':_0x18cde9[_0xb5fa('0x46')]['id']},'attributes':[[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x51')))),_0xb5fa('0x52')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db['sequelize'][_0xb5fa('0x53')](_0xb5fa('0x54')))),_0xb5fa('0x55')],[db['sequelize']['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db['sequelize'][_0xb5fa('0x53')](_0xb5fa('0x56')))),_0xb5fa('0x57')],[db['sequelize']['fn']('COUNT',db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')]('`state`\x20=\x208,\x201,\x20null'))),_0xb5fa('0x59')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xb5fa('0x61')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db['sequelize']['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x5b')))),_0xb5fa('0x5c')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x62')))),_0xb5fa('0x5d')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')]['literal'](_0xb5fa('0x5e')))),'answeringMachine']]})[_0xb5fa('0x43')](handleEntityNotFound(_0x40d7d5,null))[_0xb5fa('0x43')](respondWithResult(_0x40d7d5,null))[_0xb5fa('0x4b')](handleError(_0x40d7d5,null));};exports[_0xb5fa('0x63')]=function(_0x339dfb,_0x56e6b0,_0x1585cd){return db['VoiceQueue'][_0xb5fa('0x4a')]({'where':{'id':_0x339dfb[_0xb5fa('0x46')]['id']}})[_0xb5fa('0x43')](handleEntityNotFound(_0x56e6b0,null))[_0xb5fa('0x43')](function(_0x5e44d8){var _0x4d1117;if(_0x5e44d8){_0x4d1117=squel['insert']()[_0xb5fa('0x64')](_0xb5fa('0x65'))[_0xb5fa('0x66')]([_0xb5fa('0x67'),_0xb5fa('0x68'),_0xb5fa('0x69'),'ListId',_0xb5fa('0x6a'),'createdAt','updatedAt'],squel[_0xb5fa('0x6b')]()['field']('ANY_VALUE(calleridnum)','phone')[_0xb5fa('0x6c')]('NOW()',_0xb5fa('0x68'))[_0xb5fa('0x6c')](_0xb5fa('0x6d'),'ContactId')['field'](_0xb5fa('0x6e'),_0xb5fa('0x6f'))['field'](_0xb5fa('0x70'),_0xb5fa('0x6a'))[_0xb5fa('0x6c')](_0xb5fa('0x71'),'createdAt')[_0xb5fa('0x6c')](_0xb5fa('0x71'),_0xb5fa('0x72'))[_0xb5fa('0x73')](_0xb5fa('0x74'))[_0xb5fa('0x3c')](_0xb5fa('0x75'),_0x339dfb['params']['id'][_0xb5fa('0x76')]())['where'](_0xb5fa('0x77'),_0x339dfb[_0xb5fa('0x4d')]['state'][_0xb5fa('0x76')]())[_0xb5fa('0x3c')](_0xb5fa('0x78'))[_0xb5fa('0x3c')](_0xb5fa('0x79'),squel[_0xb5fa('0x6b')]()[_0xb5fa('0x6c')](_0xb5fa('0x67'))['from'](_0xb5fa('0x65'))[_0xb5fa('0x3c')](_0xb5fa('0x75'),_0x339dfb[_0xb5fa('0x46')]['id']['toString']()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0xb5fa('0x6c')](_0xb5fa('0x7a'))[_0xb5fa('0x73')](_0xb5fa('0x74'))['where']('VoiceQueueId\x20=\x20?',_0x339dfb[_0xb5fa('0x46')]['id']['toString']())[_0xb5fa('0x3c')](_0xb5fa('0x7b')))[_0xb5fa('0x7c')](_0xb5fa('0x69')))['toString']();return db[_0xb5fa('0x50')]['query'](_0x4d1117);}return[];})[_0xb5fa('0x43')](respondWithResult(_0x56e6b0,null))[_0xb5fa('0x4b')](handleError(_0x56e6b0,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x5e6852,_0x391412,_0x3150ac){return db[_0xb5fa('0x7d')][_0xb5fa('0x4a')]({'where':{'id':_0x5e6852[_0xb5fa('0x46')]['id']}})[_0xb5fa('0x43')](handleEntityNotFound(_0x391412,null))[_0xb5fa('0x43')](function(_0x25b278){var _0x1a0255;if(_0x25b278){_0x1a0255=squel[_0xb5fa('0x7e')]()[_0xb5fa('0x64')](_0xb5fa('0x65'))[_0xb5fa('0x66')](['phone','scheduledAt',_0xb5fa('0x69'),'ListId',_0xb5fa('0x7f'),_0xb5fa('0x80'),'updatedAt'],squel[_0xb5fa('0x6b')]()[_0xb5fa('0x6c')]('ANY_VALUE(calleridnum)',_0xb5fa('0x67'))[_0xb5fa('0x6c')]('NOW()',_0xb5fa('0x68'))[_0xb5fa('0x6c')](_0xb5fa('0x6d'),'ContactId')['field'](_0xb5fa('0x6e'),_0xb5fa('0x6f'))[_0xb5fa('0x6c')](_0xb5fa('0x81'),_0xb5fa('0x7f'))[_0xb5fa('0x6c')](_0xb5fa('0x71'),_0xb5fa('0x80'))[_0xb5fa('0x6c')](_0xb5fa('0x71'),'updatedAt')['from'](_0xb5fa('0x74'))[_0xb5fa('0x3c')](_0xb5fa('0x82'),_0x5e6852[_0xb5fa('0x46')]['id']['toString']())[_0xb5fa('0x3c')](_0xb5fa('0x77'),_0x5e6852[_0xb5fa('0x4d')]['state'][_0xb5fa('0x76')]())[_0xb5fa('0x3c')](_0xb5fa('0x78'))[_0xb5fa('0x3c')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb5fa('0x6b')]()[_0xb5fa('0x6c')](_0xb5fa('0x67'))[_0xb5fa('0x73')](_0xb5fa('0x65'))[_0xb5fa('0x3c')](_0xb5fa('0x82'),_0x5e6852[_0xb5fa('0x46')]['id'][_0xb5fa('0x76')]()))[_0xb5fa('0x3c')](_0xb5fa('0x79'),squel[_0xb5fa('0x6b')]()[_0xb5fa('0x6c')](_0xb5fa('0x7a'))[_0xb5fa('0x73')]('cm_hopper_final')[_0xb5fa('0x3c')](_0xb5fa('0x82'),_0x5e6852[_0xb5fa('0x46')]['id'][_0xb5fa('0x76')]())[_0xb5fa('0x3c')](_0xb5fa('0x7b')))[_0xb5fa('0x7c')](_0xb5fa('0x69')))['toString']();return db['sequelize'][_0xb5fa('0x33')](_0x1a0255);}return[];})['then'](respondWithResult(_0x391412,null))['catch'](handleError(_0x391412,null));};exports[_0xb5fa('0x83')]=function(_0x27dbe8,_0x2faf23,_0x4d607d){return db[_0xb5fa('0x84')][_0xb5fa('0x85')]({'where':{'VoiceQueueId':_0x27dbe8[_0xb5fa('0x4d')]['VoiceQueueId'],'CampaignId':_0x27dbe8[_0xb5fa('0x4d')][_0xb5fa('0x7f')],'ContactId':_0x27dbe8['body'][_0xb5fa('0x69')]}})[_0xb5fa('0x43')](handleEntityNotFound(_0x2faf23,null))[_0xb5fa('0x43')](function(_0xf15d5c){if(_0xf15d5c){return _0xf15d5c;}return null;})[_0xb5fa('0x43')](respondWithResult(_0x2faf23,null))[_0xb5fa('0x4b')](handleError(_0x2faf23,null));}; \ No newline at end of file +var _0x1623=['reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','dropContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','phone','scheduledAt','ListId','createdAt','select','ANY_VALUE(calleridnum)','field','NOW()','ContactId','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','from','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','updatedAt','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','CmHopperFinal','findAll','rows','catch','show','params','length','find','describe','body','uniqueid','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts'];(function(_0x3aafda,_0x2066b0){var _0x21549e=function(_0x29328e){while(--_0x29328e){_0x3aafda['push'](_0x3aafda['shift']());}};_0x21549e(++_0x2066b0);}(_0x1623,0xab));var _0x3162=function(_0x431aee,_0x1c4695){_0x431aee=_0x431aee-0x0;var _0x827b95=_0x1623[_0x431aee];return _0x827b95;};'use strict';var emlformat=require(_0x3162('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3162('0x1'));var rp=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var BPromise=require(_0x3162('0x4'));var Mustache=require(_0x3162('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3162('0x6'));var csv=require('to-csv');var ejs=require(_0x3162('0x7'));var fs=require('fs');var fs_extra=require(_0x3162('0x8'));var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0xd'));var querystring=require(_0x3162('0xe'));var Papa=require(_0x3162('0xf'));var Redis=require(_0x3162('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x11'));var hardwareService=require(_0x3162('0x12'));var logger=require(_0x3162('0x13'))(_0x3162('0x14'));var utils=require(_0x3162('0x15'));var config=require(_0x3162('0x16'));var licenseUtil=require(_0x3162('0x17'));var db=require(_0x3162('0x18'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x19')](_0x4c3625)[_0x3162('0x1a')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x19')](_0x4a393a)[_0x3162('0x1b')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=typeof _0x15e348['offset']===_0x3162('0x1c')&&typeof _0x15e348[_0x3162('0x1d')]===_0x3162('0x1c');var _0xc3ee06=_0x3d0bea[_0x3162('0x1e')];var _0x1eed46=_0x2705d1?0x0:_0x15e348[_0x3162('0x1f')];var _0x4b2bf3=_0x2705d1?_0x3d0bea[_0x3162('0x1e')]:_0x15e348[_0x3162('0x1f')]+_0x15e348[_0x3162('0x1d')];var _0x36ca97;if(_0x4b2bf3>=_0xc3ee06){_0x4b2bf3=_0xc3ee06;_0x36ca97=0xc8;}else{_0x36ca97=0xce;}_0x4b8a3b['status'](_0x36ca97);return _0x4b8a3b[_0x3162('0x20')]('Content-Range',_0x1eed46+'-'+_0x4b2bf3+'/'+_0xc3ee06)['json'](_0x3d0bea);}return null;};}function patchUpdates(_0xa5c62b){return function(_0x3e4d23){try{jsonpatch[_0x3162('0x21')](_0x3e4d23,_0xa5c62b,!![]);}catch(_0x523fab){return BPromise['reject'](_0x523fab);}return _0x3e4d23[_0x3162('0x22')]();};}function saveUpdates(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x23')](_0x396372)[_0x3162('0x24')](function(_0x52ae25){return _0x52ae25;});}return null;};}function removeEntity(_0x1b2713,_0x5a4994){return function(_0xd283d6){if(_0xd283d6){return _0xd283d6[_0x3162('0x25')]()[_0x3162('0x24')](function(){_0x1b2713[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x3c543e,_0x30552f){return function(_0x5f8f7){if(!_0x5f8f7){_0x3c543e[_0x3162('0x26')](0x194);}return _0x5f8f7;};}function handleError(_0x356c5d,_0x8fa09f){_0x8fa09f=_0x8fa09f||0x1f4;return function(_0x2f62d7){logger[_0x3162('0x27')](_0x2f62d7['stack']);if(_0x2f62d7[_0x3162('0x28')]){delete _0x2f62d7['name'];}_0x356c5d[_0x3162('0x19')](_0x8fa09f)[_0x3162('0x29')](_0x2f62d7);};}exports[_0x3162('0x2a')]=function(_0x57f567,_0x4903e7){var _0xda0389={},_0xaa1f35={},_0x14df16={'count':0x0,'rows':[]};var _0x399148=_[_0x3162('0x2b')](db['CmHopperFinal'][_0x3162('0x2c')],function(_0x4e3cc2){return{'name':_0x4e3cc2[_0x3162('0x2d')],'type':_0x4e3cc2[_0x3162('0x2e')][_0x3162('0x2f')]};});_0xaa1f35[_0x3162('0x30')]=_[_0x3162('0x2b')](_0x399148,_0x3162('0x28'));_0xaa1f35[_0x3162('0x31')]=_[_0x3162('0x32')](_0x57f567['query']);_0xaa1f35[_0x3162('0x33')]=_[_0x3162('0x34')](_0xaa1f35['model'],_0xaa1f35[_0x3162('0x31')]);_0xda0389[_0x3162('0x35')]=_['intersection'](_0xaa1f35['model'],qs[_0x3162('0x36')](_0x57f567['query'][_0x3162('0x36')]));_0xda0389[_0x3162('0x35')]=_0xda0389[_0x3162('0x35')]['length']?_0xda0389['attributes']:_0xaa1f35[_0x3162('0x30')];if(!_0x57f567[_0x3162('0x31')]['hasOwnProperty'](_0x3162('0x37'))){_0xda0389['limit']=qs[_0x3162('0x1d')](_0x57f567[_0x3162('0x31')][_0x3162('0x1d')]);_0xda0389[_0x3162('0x1f')]=qs[_0x3162('0x1f')](_0x57f567[_0x3162('0x31')][_0x3162('0x1f')]);}_0xda0389[_0x3162('0x38')]=qs[_0x3162('0x39')](_0x57f567[_0x3162('0x31')][_0x3162('0x39')]);_0xda0389['where']=qs[_0x3162('0x33')](_[_0x3162('0x3a')](_0x57f567[_0x3162('0x31')],_0xaa1f35['filters']),_0x399148);if(_0x57f567['query'][_0x3162('0x3b')]){_0xda0389[_0x3162('0x3c')]=_[_0x3162('0x3d')](_0xda0389[_0x3162('0x3c')],{'$or':_['map'](_0x399148,function(_0x4186b6){if(_0x4186b6['type']!=='VIRTUAL'){var _0x5dee49={};_0x5dee49[_0x4186b6[_0x3162('0x28')]]={'$like':'%'+_0x57f567[_0x3162('0x31')][_0x3162('0x3b')]+'%'};return _0x5dee49;}})});}_0xda0389=_['merge']({},_0xda0389,_0x57f567[_0x3162('0x3e')]);var _0x2ce9c6={'where':_0xda0389[_0x3162('0x3c')]};return db[_0x3162('0x3f')][_0x3162('0x1e')](_0x2ce9c6)['then'](function(_0x5447d6){_0x14df16[_0x3162('0x1e')]=_0x5447d6;if(_0x57f567[_0x3162('0x31')]['includeAll']){_0xda0389['include']=[{'all':!![]}];}return db[_0x3162('0x3f')][_0x3162('0x40')](_0xda0389);})[_0x3162('0x24')](function(_0x4883ac){_0x14df16[_0x3162('0x41')]=_0x4883ac;return _0x14df16;})[_0x3162('0x24')](respondWithFilteredResult(_0x4903e7,_0xda0389))[_0x3162('0x42')](handleError(_0x4903e7,null));};exports[_0x3162('0x43')]=function(_0x534708,_0x2617d3){var _0x282e3e={'raw':!![],'where':{'id':_0x534708[_0x3162('0x44')]['id']}},_0x522cce={};_0x522cce[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3f')][_0x3162('0x2c')]);_0x522cce['query']=_[_0x3162('0x32')](_0x534708['query']);_0x522cce[_0x3162('0x33')]=_[_0x3162('0x34')](_0x522cce[_0x3162('0x30')],_0x522cce[_0x3162('0x31')]);_0x282e3e[_0x3162('0x35')]=_[_0x3162('0x34')](_0x522cce['model'],qs[_0x3162('0x36')](_0x534708[_0x3162('0x31')][_0x3162('0x36')]));_0x282e3e['attributes']=_0x282e3e[_0x3162('0x35')][_0x3162('0x45')]?_0x282e3e['attributes']:_0x522cce[_0x3162('0x30')];if(_0x534708['query']['includeAll']){_0x282e3e['include']=[{'all':!![]}];}_0x282e3e=_[_0x3162('0x3d')]({},_0x282e3e,_0x534708[_0x3162('0x3e')]);return db[_0x3162('0x3f')][_0x3162('0x46')](_0x282e3e)[_0x3162('0x24')](handleEntityNotFound(_0x2617d3,null))[_0x3162('0x24')](respondWithResult(_0x2617d3,null))[_0x3162('0x42')](handleError(_0x2617d3,null));};exports[_0x3162('0x47')]=function(_0x3d2958,_0x28865c){return db[_0x3162('0x3f')][_0x3162('0x47')]()[_0x3162('0x24')](respondWithResult(_0x28865c,null))['catch'](handleError(_0x28865c,null));};exports[_0x3162('0x23')]=function(_0x48cb8f,_0x4f1dde){if(_0x48cb8f[_0x3162('0x48')][_0x3162('0x49')]){delete _0x48cb8f[_0x3162('0x48')][_0x3162('0x49')];}return db['CmHopperFinal'][_0x3162('0x46')]({'where':{'uniqueid':_0x48cb8f['params']['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x4f1dde,null))[_0x3162('0x24')](saveUpdates(_0x48cb8f['body'],null))[_0x3162('0x24')](respondWithResult(_0x4f1dde,null))['catch'](handleError(_0x4f1dde,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x13e7c4,_0x22c0a2,_0x160364){return db[_0x3162('0x3f')][_0x3162('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x13e7c4[_0x3162('0x44')]['id']},'attributes':[[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x3162('0x4c')))),_0x3162('0x4d')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')]('`state`\x20=\x203,\x201,\x20null'))),_0x3162('0x4f')],[db['sequelize']['fn'](_0x3162('0x4b'),db['sequelize']['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x50')))),_0x3162('0x51')],[db['sequelize']['fn']('COUNT',db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x52')))),_0x3162('0x53')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db['sequelize'][_0x3162('0x4e')](_0x3162('0x54')))),'dropContacts'],[db['sequelize']['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x55')))),_0x3162('0x56')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db['sequelize']['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3162('0x57')],[db['sequelize']['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x58')))),_0x3162('0x59')]]})[_0x3162('0x24')](handleEntityNotFound(_0x22c0a2,null))[_0x3162('0x24')](respondWithResult(_0x22c0a2,null))[_0x3162('0x42')](handleError(_0x22c0a2,null));};exports[_0x3162('0x5a')]=function(_0x4b5729,_0x4a42ea,_0x520b1a){return db[_0x3162('0x3f')]['findAll']({'raw':![],'where':{'CampaignId':_0x4b5729[_0x3162('0x44')]['id']},'attributes':[[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x3162('0x4d')],[db[_0x3162('0x4a')]['fn']('COUNT',db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x5b')))),_0x3162('0x4f')],[db['sequelize']['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x50')))),'busyContacts'],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x52')))),_0x3162('0x53')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x54')))),_0x3162('0x5c')],[db[_0x3162('0x4a')]['fn']('COUNT',db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x55')))),'abandonedContacts'],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x5d')))),'reCallContacts'],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x58')))),'answeringMachine']]})[_0x3162('0x24')](handleEntityNotFound(_0x4a42ea,null))[_0x3162('0x24')](respondWithResult(_0x4a42ea,null))[_0x3162('0x42')](handleError(_0x4a42ea,null));};exports[_0x3162('0x5e')]=function(_0x8a75ca,_0x33c39d,_0xb3d824){return db['VoiceQueue']['find']({'where':{'id':_0x8a75ca['params']['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x33c39d,null))[_0x3162('0x24')](function(_0x59b3f7){var _0x129005;if(_0x59b3f7){_0x129005=squel[_0x3162('0x5f')]()[_0x3162('0x60')](_0x3162('0x61'))['fromQuery']([_0x3162('0x62'),_0x3162('0x63'),'ContactId',_0x3162('0x64'),'VoiceQueueId',_0x3162('0x65'),'updatedAt'],squel[_0x3162('0x66')]()['field'](_0x3162('0x67'),_0x3162('0x62'))[_0x3162('0x68')](_0x3162('0x69'),_0x3162('0x63'))[_0x3162('0x68')]('ANY_VALUE(ContactId)',_0x3162('0x6a'))[_0x3162('0x68')](_0x3162('0x6b'),'ListId')[_0x3162('0x68')](_0x3162('0x6c'),_0x3162('0x6d'))[_0x3162('0x68')](_0x3162('0x69'),'createdAt')[_0x3162('0x68')](_0x3162('0x69'),'updatedAt')['from'](_0x3162('0x6e'))[_0x3162('0x3c')]('VoiceQueueId\x20=\x20?',_0x8a75ca[_0x3162('0x44')]['id'][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x70'),_0x8a75ca[_0x3162('0x48')][_0x3162('0x71')][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x72'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x3162('0x66')]()[_0x3162('0x68')]('phone')[_0x3162('0x73')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x8a75ca[_0x3162('0x44')]['id']['toString']()))[_0x3162('0x3c')](_0x3162('0x74'),squel[_0x3162('0x66')]()[_0x3162('0x68')](_0x3162('0x75'))[_0x3162('0x73')](_0x3162('0x6e'))[_0x3162('0x3c')](_0x3162('0x76'),_0x8a75ca[_0x3162('0x44')]['id'][_0x3162('0x6f')]())['where'](_0x3162('0x77')))[_0x3162('0x78')](_0x3162('0x6a')))[_0x3162('0x6f')]();return db[_0x3162('0x4a')][_0x3162('0x31')](_0x129005);}return[];})[_0x3162('0x24')](respondWithResult(_0x33c39d,null))[_0x3162('0x42')](handleError(_0x33c39d,null));};exports[_0x3162('0x79')]=function(_0x3f37fa,_0x1d242f,_0x190f91){return db['Campaign'][_0x3162('0x46')]({'where':{'id':_0x3f37fa[_0x3162('0x44')]['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x1d242f,null))['then'](function(_0x3d7bd1){var _0x5cdbb0;if(_0x3d7bd1){_0x5cdbb0=squel[_0x3162('0x5f')]()[_0x3162('0x60')]('cm_hopper')['fromQuery']([_0x3162('0x62'),_0x3162('0x63'),'ContactId',_0x3162('0x64'),'CampaignId',_0x3162('0x65'),_0x3162('0x7a')],squel[_0x3162('0x66')]()[_0x3162('0x68')](_0x3162('0x67'),_0x3162('0x62'))[_0x3162('0x68')](_0x3162('0x69'),_0x3162('0x63'))['field'](_0x3162('0x7b'),'ContactId')[_0x3162('0x68')](_0x3162('0x6b'),'ListId')[_0x3162('0x68')](_0x3162('0x7c'),_0x3162('0x7d'))[_0x3162('0x68')](_0x3162('0x69'),_0x3162('0x65'))[_0x3162('0x68')]('NOW()',_0x3162('0x7a'))[_0x3162('0x73')](_0x3162('0x6e'))['where'](_0x3162('0x7e'),_0x3f37fa[_0x3162('0x44')]['id'][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x70'),_0x3f37fa[_0x3162('0x48')]['state'][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x72'))[_0x3162('0x3c')](_0x3162('0x74'),squel['select']()[_0x3162('0x68')]('phone')[_0x3162('0x73')](_0x3162('0x61'))['where'](_0x3162('0x7e'),_0x3f37fa[_0x3162('0x44')]['id'][_0x3162('0x6f')]()))['where'](_0x3162('0x74'),squel['select']()['field'](_0x3162('0x75'))[_0x3162('0x73')](_0x3162('0x6e'))[_0x3162('0x3c')](_0x3162('0x7e'),_0x3f37fa[_0x3162('0x44')]['id'][_0x3162('0x6f')]())['where']('state\x20=\x204'))['group'](_0x3162('0x6a')))[_0x3162('0x6f')]();return db['sequelize']['query'](_0x5cdbb0);}return[];})[_0x3162('0x24')](respondWithResult(_0x1d242f,null))['catch'](handleError(_0x1d242f,null));};exports[_0x3162('0x7f')]=function(_0x35d9f0,_0x4408db,_0x377edb){return db['CmHopper'][_0x3162('0x80')]({'where':{'VoiceQueueId':_0x35d9f0[_0x3162('0x48')][_0x3162('0x6d')],'CampaignId':_0x35d9f0['body'][_0x3162('0x7d')],'ContactId':_0x35d9f0['body'][_0x3162('0x6a')]}})['then'](handleEntityNotFound(_0x4408db,null))[_0x3162('0x24')](function(_0x3d414f){if(_0x3d414f){return _0x3d414f;}return null;})[_0x3162('0x24')](respondWithResult(_0x4408db,null))['catch'](handleError(_0x4408db,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 3bbf4d3..7e1b5d7 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 _0x333b=['uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0x333b,0xf1));var _0xb333=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0x333b[_0x3b231a];return _0x18d67a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb333('0x0'))(_0xb333('0x1'));var moment=require(_0xb333('0x2'));var BPromise=require(_0xb333('0x3'));var rp=require(_0xb333('0x4'));var fs=require('fs');var path=require(_0xb333('0x5'));var rimraf=require(_0xb333('0x6'));var config=require(_0xb333('0x7'));var attributes=require(_0xb333('0x8'));module[_0xb333('0x9')]=function(_0x571fc6,_0x36a5ef){return _0x571fc6[_0xb333('0xa')](_0xb333('0xb'),attributes,{'tableName':_0xb333('0xc'),'paranoid':![],'indexes':[{'name':_0xb333('0xd'),'fields':['calleridnum']},{'name':_0xb333('0xe'),'fields':[_0xb333('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa5d9=['./cmHopperFinal.attributes','exports','define','calleridnum','uniqueid','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x54a9b9,_0x31352f){var _0x2a34ef=function(_0x50f592){while(--_0x50f592){_0x54a9b9['push'](_0x54a9b9['shift']());}};_0x2a34ef(++_0x31352f);}(_0xa5d9,0xad));var _0x9a5d=function(_0x4b9393,_0x2f7fc1){_0x4b9393=_0x4b9393-0x0;var _0xad6480=_0xa5d9[_0x4b9393];return _0xad6480;};'use strict';var _=require('lodash');var util=require(_0x9a5d('0x0'));var logger=require('../../config/logger')(_0x9a5d('0x1'));var moment=require(_0x9a5d('0x2'));var BPromise=require(_0x9a5d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a5d('0x4'));var rimraf=require(_0x9a5d('0x5'));var config=require(_0x9a5d('0x6'));var attributes=require(_0x9a5d('0x7'));module[_0x9a5d('0x8')]=function(_0x4bae03,_0x25ecf7){return _0x4bae03[_0x9a5d('0x9')]('CmHopperFinal',attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x9a5d('0xa'),'fields':[_0x9a5d('0xa')]},{'name':_0x9a5d('0xb'),'fields':[_0x9a5d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 434ef67..50c6a5c 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x34c90d,_0x3db2ac){var _0x1c6701=function(_0xf3aba){while(--_0xf3aba){_0x34c90d['push'](_0x34c90d['shift']());}};_0x1c6701(++_0x3db2ac);}(_0x7a54,0x106));var _0x47a5=function(_0x34446b,_0x39dce7){_0x34446b=_0x34446b-0x0;var _0x8ac4f2=_0x7a54[_0x34446b];return _0x8ac4f2;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0xee97c7,_0x17c4f7){var _0x1379ba=function(_0x7d4efa){while(--_0x7d4efa){_0xee97c7['push'](_0xee97c7['shift']());}};_0x1379ba(++_0x17c4f7);}(_0xb10b,0x12a));var _0xbb10=function(_0x55c97d,_0x228ffc){_0x55c97d=_0x55c97d-0x0;var _0x1d5112=_0xb10b[_0x55c97d];return _0x1d5112;};'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 aabedfd..16731ea 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 _0xa540=['checkContactHopper','put','update','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','/describe','isAuthenticated','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper'];(function(_0x28f0ae,_0x1fb1d7){var _0x81a4ec=function(_0x283629){while(--_0x283629){_0x28f0ae['push'](_0x28f0ae['shift']());}};_0x81a4ec(++_0x1fb1d7);}(_0xa540,0x155));var _0x0a54=function(_0x382c73,_0x199cab){_0x382c73=_0x382c73-0x0;var _0x1dd0bf=_0xa540[_0x382c73];return _0x1dd0bf;};'use strict';var multer=require('multer');var util=require(_0x0a54('0x0'));var path=require(_0x0a54('0x1'));var timeout=require('connect-timeout');var express=require(_0x0a54('0x2'));var router=express[_0x0a54('0x3')]();var fs_extra=require(_0x0a54('0x4'));var auth=require(_0x0a54('0x5'));var interaction=require(_0x0a54('0x6'));var config=require(_0x0a54('0x7'));var controller=require(_0x0a54('0x8'));router[_0x0a54('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0a54('0x9')](_0x0a54('0xa'),auth[_0x0a54('0xb')](),controller[_0x0a54('0xc')]);router[_0x0a54('0x9')](_0x0a54('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x0a54('0xe'),auth[_0x0a54('0xb')](),controller[_0x0a54('0xf')]);router[_0x0a54('0x9')](_0x0a54('0x10'),auth[_0x0a54('0xb')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0x0a54('0x11'),auth[_0x0a54('0xb')](),controller[_0x0a54('0x12')]);router[_0x0a54('0x13')](_0x0a54('0x14'),auth[_0x0a54('0xb')](),controller[_0x0a54('0x15')]);router[_0x0a54('0x13')](_0x0a54('0x16'),auth[_0x0a54('0xb')](),controller[_0x0a54('0x17')]);router[_0x0a54('0x18')](_0x0a54('0xd'),auth[_0x0a54('0xb')](),controller[_0x0a54('0x19')]);module['exports']=router; \ No newline at end of file +var _0x0b8c=['/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','index','describe','/:id','isAuthenticated','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x0b8c,0x1ae));var _0xc0b8=function(_0x872b02,_0x4f4458){_0x872b02=_0x872b02-0x0;var _0x1a6b24=_0x0b8c[_0x872b02];return _0x1a6b24;};'use strict';var multer=require(_0xc0b8('0x0'));var util=require(_0xc0b8('0x1'));var path=require(_0xc0b8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xc0b8('0x3'));var auth=require(_0xc0b8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc0b8('0x5'));var controller=require(_0xc0b8('0x6'));router[_0xc0b8('0x7')]('/',auth['isAuthenticated'](),controller[_0xc0b8('0x8')]);router[_0xc0b8('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xc0b8('0x9')]);router[_0xc0b8('0x7')](_0xc0b8('0xa'),auth[_0xc0b8('0xb')](),controller['show']);router[_0xc0b8('0x7')](_0xc0b8('0xc'),auth['isAuthenticated'](),controller[_0xc0b8('0xd')]);router['get'](_0xc0b8('0xe'),auth['isAuthenticated'](),controller[_0xc0b8('0xf')]);router[_0xc0b8('0x10')](_0xc0b8('0x11'),auth[_0xc0b8('0xb')](),controller[_0xc0b8('0x12')]);router['post']('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller[_0xc0b8('0x13')]);router[_0xc0b8('0x10')](_0xc0b8('0x14'),auth[_0xc0b8('0xb')](),controller[_0xc0b8('0x15')]);router[_0xc0b8('0x16')](_0xc0b8('0xa'),auth[_0xc0b8('0xb')](),controller[_0xc0b8('0x17')]);module[_0xc0b8('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index a64ddf1..ea576ec 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 _0xe641=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x39f836,_0x588272){var _0x56ab8f=function(_0x2d65c1){while(--_0x2d65c1){_0x39f836['push'](_0x39f836['shift']());}};_0x56ab8f(++_0x588272);}(_0xe641,0x1ec));var _0x1e64=function(_0x3f2570,_0x1de5ba){_0x3f2570=_0x3f2570-0x0;var _0x3cdc22=_0xe641[_0x3f2570];return _0x3cdc22;};'use strict';var Sequelize=require(_0x1e64('0x0'));module[_0x1e64('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x1e64('0x2')]},'scheduledat':{'type':Sequelize[_0x1e64('0x3')]},'countbusyretry':{'type':Sequelize[_0x1e64('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1e64('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1e64('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1e64('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1e64('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x1e64('0x2')]},'originatecalleridname':{'type':Sequelize[_0x1e64('0x2')]},'calleridnum':{'type':Sequelize[_0x1e64('0x2')]},'calleridname':{'type':Sequelize[_0x1e64('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x1e64('0x3')]},'droptime':{'type':Sequelize[_0x1e64('0x3')]},'endtime':{'type':Sequelize[_0x1e64('0x3')]},'ringtime':{'type':Sequelize[_0x1e64('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1e64('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1e64('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1e64('0x2')]},'campaign':{'type':Sequelize[_0x1e64('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x1e64('0x2')]},'amd':{'type':Sequelize[_0x1e64('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1e64('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x1e64('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1e64('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x1e64('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x1e64('0x3')]},'edited':{'type':Sequelize[_0x1e64('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x1e64('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1e64('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1e64('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1e64('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1e64('0x4')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x88d7=['INTEGER','DATE','STRING','BOOLEAN','sequelize','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x88d7,0x70));var _0x788d=function(_0x36f6d1,_0x5db069){_0x36f6d1=_0x36f6d1-0x0;var _0x31737d=_0x88d7[_0x36f6d1];return _0x31737d;};'use strict';var Sequelize=require(_0x788d('0x0'));module[_0x788d('0x1')]={'state':{'type':Sequelize[_0x788d('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x788d('0x3')]},'countbusyretry':{'type':Sequelize[_0x788d('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x788d('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x788d('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x788d('0x4')]},'originatecalleridname':{'type':Sequelize[_0x788d('0x4')]},'calleridnum':{'type':Sequelize[_0x788d('0x4')]},'calleridname':{'type':Sequelize[_0x788d('0x4')]},'starttime':{'type':Sequelize[_0x788d('0x3')]},'responsetime':{'type':Sequelize[_0x788d('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x788d('0x3')]},'endtime':{'type':Sequelize[_0x788d('0x3')]},'ringtime':{'type':Sequelize[_0x788d('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x788d('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x788d('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x788d('0x4')]},'membername':{'type':Sequelize[_0x788d('0x4')]},'reason':{'type':Sequelize[_0x788d('0x4')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x788d('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x788d('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x788d('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x788d('0x3')]},'recallme':{'type':Sequelize[_0x788d('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x788d('0x3')]},'edited':{'type':Sequelize[_0x788d('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x788d('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x788d('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x788d('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x788d('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x788d('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index a2c0db7..11b3d14 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 _0x0c09=['type','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','body','describe','update','uniqueid','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','end','error','name','map','CmHopperHistory','rawAttributes','fieldName'];(function(_0x2dced9,_0x3b9cb5){var _0x9bd531=function(_0x435592){while(--_0x435592){_0x2dced9['push'](_0x2dced9['shift']());}};_0x9bd531(++_0x3b9cb5);}(_0x0c09,0x1e6));var _0x90c0=function(_0x31516e,_0x39e6a5){_0x31516e=_0x31516e-0x0;var _0x3fc4b5=_0x0c09[_0x31516e];return _0x3fc4b5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x90c0('0x0'));var zipdir=require(_0x90c0('0x1'));var jsonpatch=require(_0x90c0('0x2'));var rp=require(_0x90c0('0x3'));var moment=require('moment');var BPromise=require(_0x90c0('0x4'));var Mustache=require(_0x90c0('0x5'));var util=require(_0x90c0('0x6'));var path=require(_0x90c0('0x7'));var sox=require(_0x90c0('0x8'));var csv=require(_0x90c0('0x9'));var ejs=require(_0x90c0('0xa'));var fs=require('fs');var fs_extra=require(_0x90c0('0xb'));var _=require(_0x90c0('0xc'));var squel=require(_0x90c0('0xd'));var crypto=require(_0x90c0('0xe'));var jsforce=require(_0x90c0('0xf'));var deskjs=require(_0x90c0('0x10'));var toCsv=require(_0x90c0('0x9'));var querystring=require(_0x90c0('0x11'));var Papa=require('papaparse');var Redis=require(_0x90c0('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x90c0('0x13'));var as=require(_0x90c0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x90c0('0x15'))('api');var utils=require(_0x90c0('0x16'));var config=require(_0x90c0('0x17'));var licenseUtil=require(_0x90c0('0x18'));var db=require(_0x90c0('0x19'))['db'];function respondWithStatusCode(_0x54119e,_0x183ea3){_0x183ea3=_0x183ea3||0xcc;return function(_0x555816){if(_0x555816){return _0x54119e[_0x90c0('0x1a')](_0x183ea3);}return _0x54119e[_0x90c0('0x1b')](_0x183ea3)['end']();};}function respondWithResult(_0x4cc3b6,_0x2e90e3){_0x2e90e3=_0x2e90e3||0xc8;return function(_0x26010c){if(_0x26010c){return _0x4cc3b6['status'](_0x2e90e3)[_0x90c0('0x1c')](_0x26010c);}};}function respondWithFilteredResult(_0x17f2c2,_0x13d326){return function(_0x4e5abe){if(_0x4e5abe){var _0x254597=typeof _0x13d326[_0x90c0('0x1d')]===_0x90c0('0x1e')&&typeof _0x13d326[_0x90c0('0x1f')]==='undefined';var _0x1b1de1=_0x4e5abe[_0x90c0('0x20')];var _0x319889=_0x254597?0x0:_0x13d326['offset'];var _0x838e53=_0x254597?_0x4e5abe[_0x90c0('0x20')]:_0x13d326[_0x90c0('0x1d')]+_0x13d326[_0x90c0('0x1f')];var _0x449153;if(_0x838e53>=_0x1b1de1){_0x838e53=_0x1b1de1;_0x449153=0xc8;}else{_0x449153=0xce;}_0x17f2c2[_0x90c0('0x1b')](_0x449153);return _0x17f2c2[_0x90c0('0x21')](_0x90c0('0x22'),_0x319889+'-'+_0x838e53+'/'+_0x1b1de1)[_0x90c0('0x1c')](_0x4e5abe);}return null;};}function patchUpdates(_0x5afbe2){return function(_0x358171){try{jsonpatch['apply'](_0x358171,_0x5afbe2,!![]);}catch(_0x11fa07){return BPromise[_0x90c0('0x23')](_0x11fa07);}return _0x358171[_0x90c0('0x24')]();};}function saveUpdates(_0x35375f,_0x1951f4){return function(_0x34ec68){if(_0x34ec68){return _0x34ec68['update'](_0x35375f)[_0x90c0('0x25')](function(_0x4e12ca){return _0x4e12ca;});}return null;};}function removeEntity(_0x5788fe,_0x22e58f){return function(_0x329f63){if(_0x329f63){return _0x329f63[_0x90c0('0x26')]()[_0x90c0('0x25')](function(){_0x5788fe[_0x90c0('0x1b')](0xcc)[_0x90c0('0x27')]();});}};}function handleEntityNotFound(_0x502009,_0x199288){return function(_0x5f3e26){if(!_0x5f3e26){_0x502009[_0x90c0('0x1a')](0x194);}return _0x5f3e26;};}function handleError(_0x4672ad,_0x2a92ba){_0x2a92ba=_0x2a92ba||0x1f4;return function(_0x2b9477){logger[_0x90c0('0x28')](_0x2b9477['stack']);if(_0x2b9477[_0x90c0('0x29')]){delete _0x2b9477[_0x90c0('0x29')];}_0x4672ad[_0x90c0('0x1b')](_0x2a92ba)['send'](_0x2b9477);};}exports['index']=function(_0x471d6d,_0x4dfab1){var _0x1e782c={},_0x43716c={},_0x168c30={'count':0x0,'rows':[]};var _0x4a8e6b=_[_0x90c0('0x2a')](db[_0x90c0('0x2b')][_0x90c0('0x2c')],function(_0x43c379){return{'name':_0x43c379[_0x90c0('0x2d')],'type':_0x43c379[_0x90c0('0x2e')]['key']};});_0x43716c['model']=_[_0x90c0('0x2a')](_0x4a8e6b,_0x90c0('0x29'));_0x43716c[_0x90c0('0x2f')]=_['keys'](_0x471d6d[_0x90c0('0x2f')]);_0x43716c[_0x90c0('0x30')]=_[_0x90c0('0x31')](_0x43716c['model'],_0x43716c[_0x90c0('0x2f')]);_0x1e782c[_0x90c0('0x32')]=_['intersection'](_0x43716c[_0x90c0('0x33')],qs[_0x90c0('0x34')](_0x471d6d['query'][_0x90c0('0x34')]));_0x1e782c['attributes']=_0x1e782c[_0x90c0('0x32')][_0x90c0('0x35')]?_0x1e782c[_0x90c0('0x32')]:_0x43716c[_0x90c0('0x33')];if(!_0x471d6d[_0x90c0('0x2f')][_0x90c0('0x36')]('nolimit')){_0x1e782c[_0x90c0('0x1f')]=qs[_0x90c0('0x1f')](_0x471d6d['query']['limit']);_0x1e782c['offset']=qs['offset'](_0x471d6d[_0x90c0('0x2f')][_0x90c0('0x1d')]);}_0x1e782c[_0x90c0('0x37')]=qs[_0x90c0('0x38')](_0x471d6d[_0x90c0('0x2f')]['sort']);_0x1e782c[_0x90c0('0x39')]=qs['filters'](_[_0x90c0('0x3a')](_0x471d6d[_0x90c0('0x2f')],_0x43716c[_0x90c0('0x30')]),_0x4a8e6b);if(_0x471d6d[_0x90c0('0x2f')][_0x90c0('0x3b')]){_0x1e782c[_0x90c0('0x39')]=_[_0x90c0('0x3c')](_0x1e782c['where'],{'$or':_[_0x90c0('0x2a')](_0x4a8e6b,function(_0x55873a){if(_0x55873a['type']!==_0x90c0('0x3d')){var _0x20512c={};_0x20512c[_0x55873a[_0x90c0('0x29')]]={'$like':'%'+_0x471d6d['query'][_0x90c0('0x3b')]+'%'};return _0x20512c;}})});}_0x1e782c=_[_0x90c0('0x3c')]({},_0x1e782c,_0x471d6d[_0x90c0('0x3e')]);var _0x1dc4e6={'where':_0x1e782c[_0x90c0('0x39')]};return db[_0x90c0('0x2b')][_0x90c0('0x20')](_0x1dc4e6)['then'](function(_0x3f54ff){_0x168c30[_0x90c0('0x20')]=_0x3f54ff;if(_0x471d6d[_0x90c0('0x2f')][_0x90c0('0x3f')]){_0x1e782c[_0x90c0('0x40')]=[{'all':!![]}];}return db[_0x90c0('0x2b')][_0x90c0('0x41')](_0x1e782c);})[_0x90c0('0x25')](function(_0x5b2684){_0x168c30[_0x90c0('0x42')]=_0x5b2684;return _0x168c30;})[_0x90c0('0x25')](respondWithFilteredResult(_0x4dfab1,_0x1e782c))[_0x90c0('0x43')](handleError(_0x4dfab1,null));};exports[_0x90c0('0x44')]=function(_0x5d6e75,_0x235077){var _0x13f4ee={'raw':!![],'where':{'id':_0x5d6e75['params']['id']}},_0x207c06={};_0x207c06[_0x90c0('0x33')]=_[_0x90c0('0x45')](db[_0x90c0('0x2b')][_0x90c0('0x2c')]);_0x207c06[_0x90c0('0x2f')]=_[_0x90c0('0x45')](_0x5d6e75[_0x90c0('0x2f')]);_0x207c06['filters']=_['intersection'](_0x207c06['model'],_0x207c06[_0x90c0('0x2f')]);_0x13f4ee[_0x90c0('0x32')]=_[_0x90c0('0x31')](_0x207c06[_0x90c0('0x33')],qs[_0x90c0('0x34')](_0x5d6e75[_0x90c0('0x2f')][_0x90c0('0x34')]));_0x13f4ee[_0x90c0('0x32')]=_0x13f4ee[_0x90c0('0x32')][_0x90c0('0x35')]?_0x13f4ee['attributes']:_0x207c06['model'];if(_0x5d6e75[_0x90c0('0x2f')][_0x90c0('0x3f')]){_0x13f4ee[_0x90c0('0x40')]=[{'all':!![]}];}_0x13f4ee=_['merge']({},_0x13f4ee,_0x5d6e75[_0x90c0('0x3e')]);return db['CmHopperHistory'][_0x90c0('0x46')](_0x13f4ee)[_0x90c0('0x25')](handleEntityNotFound(_0x235077,null))[_0x90c0('0x25')](respondWithResult(_0x235077,null))[_0x90c0('0x43')](handleError(_0x235077,null));};exports['create']=function(_0x1b166c,_0x180555){return db[_0x90c0('0x2b')]['create'](_0x1b166c[_0x90c0('0x47')],{})[_0x90c0('0x25')](respondWithResult(_0x180555,0xc9))[_0x90c0('0x43')](handleError(_0x180555,null));};exports['describe']=function(_0x169b07,_0x2fa4e4){return db[_0x90c0('0x2b')][_0x90c0('0x48')]()[_0x90c0('0x25')](respondWithResult(_0x2fa4e4,null))['catch'](handleError(_0x2fa4e4,null));};exports[_0x90c0('0x49')]=function(_0x50d5c2,_0x4bc78e){if(_0x50d5c2[_0x90c0('0x47')][_0x90c0('0x4a')]){delete _0x50d5c2[_0x90c0('0x47')][_0x90c0('0x4a')];}return db['CmHopperHistory'][_0x90c0('0x46')]({'where':{'uniqueid':_0x50d5c2[_0x90c0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4bc78e,null))['then'](saveUpdates(_0x50d5c2['body'],null))['then'](respondWithResult(_0x4bc78e,null))[_0x90c0('0x43')](handleError(_0x4bc78e,null));}; \ No newline at end of file +var _0xea4f=['error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','filter','where','merge','VIRTUAL','options','CmHopperHistory','include','rows','show','includeAll','find','create','body','catch','describe','uniqueid','params','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy'];(function(_0x5b1771,_0x2b7826){var _0xc8fb68=function(_0x37d7d8){while(--_0x37d7d8){_0x5b1771['push'](_0x5b1771['shift']());}};_0xc8fb68(++_0x2b7826);}(_0xea4f,0x1b0));var _0xfea4=function(_0x4285a8,_0x118459){_0x4285a8=_0x4285a8-0x0;var _0x541a51=_0xea4f[_0x4285a8];return _0x541a51;};'use strict';var emlformat=require(_0xfea4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfea4('0x1'));var jsonpatch=require(_0xfea4('0x2'));var rp=require(_0xfea4('0x3'));var moment=require(_0xfea4('0x4'));var BPromise=require(_0xfea4('0x5'));var Mustache=require(_0xfea4('0x6'));var util=require(_0xfea4('0x7'));var path=require(_0xfea4('0x8'));var sox=require('sox');var csv=require(_0xfea4('0x9'));var ejs=require(_0xfea4('0xa'));var fs=require('fs');var fs_extra=require(_0xfea4('0xb'));var _=require(_0xfea4('0xc'));var squel=require(_0xfea4('0xd'));var crypto=require(_0xfea4('0xe'));var jsforce=require(_0xfea4('0xf'));var deskjs=require(_0xfea4('0x10'));var toCsv=require(_0xfea4('0x9'));var querystring=require('querystring');var Papa=require(_0xfea4('0x11'));var Redis=require(_0xfea4('0x12'));var authService=require(_0xfea4('0x13'));var qs=require(_0xfea4('0x14'));var as=require(_0xfea4('0x15'));var hardwareService=require(_0xfea4('0x16'));var logger=require(_0xfea4('0x17'))(_0xfea4('0x18'));var utils=require(_0xfea4('0x19'));var config=require(_0xfea4('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xfea4('0x1b'))['db'];function respondWithStatusCode(_0x36ef67,_0x14da96){_0x14da96=_0x14da96||0xcc;return function(_0x54e56c){if(_0x54e56c){return _0x36ef67[_0xfea4('0x1c')](_0x14da96);}return _0x36ef67[_0xfea4('0x1d')](_0x14da96)[_0xfea4('0x1e')]();};}function respondWithResult(_0x5ae668,_0x4fcd0a){_0x4fcd0a=_0x4fcd0a||0xc8;return function(_0x4bc0ff){if(_0x4bc0ff){return _0x5ae668[_0xfea4('0x1d')](_0x4fcd0a)[_0xfea4('0x1f')](_0x4bc0ff);}};}function respondWithFilteredResult(_0x316bd3,_0x837fdd){return function(_0x174b13){if(_0x174b13){var _0x3ea094=typeof _0x837fdd[_0xfea4('0x20')]===_0xfea4('0x21')&&typeof _0x837fdd[_0xfea4('0x22')]==='undefined';var _0xcf6e4b=_0x174b13[_0xfea4('0x23')];var _0x26e4cd=_0x3ea094?0x0:_0x837fdd[_0xfea4('0x20')];var _0x3bf0d4=_0x3ea094?_0x174b13[_0xfea4('0x23')]:_0x837fdd[_0xfea4('0x20')]+_0x837fdd[_0xfea4('0x22')];var _0x460a28;if(_0x3bf0d4>=_0xcf6e4b){_0x3bf0d4=_0xcf6e4b;_0x460a28=0xc8;}else{_0x460a28=0xce;}_0x316bd3[_0xfea4('0x1d')](_0x460a28);return _0x316bd3[_0xfea4('0x24')]('Content-Range',_0x26e4cd+'-'+_0x3bf0d4+'/'+_0xcf6e4b)[_0xfea4('0x1f')](_0x174b13);}return null;};}function patchUpdates(_0x2d4c0f){return function(_0xef0b){try{jsonpatch[_0xfea4('0x25')](_0xef0b,_0x2d4c0f,!![]);}catch(_0x42d496){return BPromise['reject'](_0x42d496);}return _0xef0b[_0xfea4('0x26')]();};}function saveUpdates(_0x5b7dc8,_0x2dee50){return function(_0x1e7fd8){if(_0x1e7fd8){return _0x1e7fd8[_0xfea4('0x27')](_0x5b7dc8)[_0xfea4('0x28')](function(_0x2f29cc){return _0x2f29cc;});}return null;};}function removeEntity(_0x1b5dc4,_0x275047){return function(_0x2c21cd){if(_0x2c21cd){return _0x2c21cd[_0xfea4('0x29')]()[_0xfea4('0x28')](function(){_0x1b5dc4[_0xfea4('0x1d')](0xcc)[_0xfea4('0x1e')]();});}};}function handleEntityNotFound(_0x9b8aca,_0x256ea1){return function(_0x185294){if(!_0x185294){_0x9b8aca[_0xfea4('0x1c')](0x194);}return _0x185294;};}function handleError(_0xece88,_0x516641){_0x516641=_0x516641||0x1f4;return function(_0x1f6e3e){logger[_0xfea4('0x2a')](_0x1f6e3e[_0xfea4('0x2b')]);if(_0x1f6e3e[_0xfea4('0x2c')]){delete _0x1f6e3e[_0xfea4('0x2c')];}_0xece88['status'](_0x516641)[_0xfea4('0x2d')](_0x1f6e3e);};}exports[_0xfea4('0x2e')]=function(_0x559d7a,_0x3f181b){var _0x3dfccf={},_0x5d52e2={},_0x1c3841={'count':0x0,'rows':[]};var _0xff39ac=_[_0xfea4('0x2f')](db['CmHopperHistory'][_0xfea4('0x30')],function(_0x3f8f05){return{'name':_0x3f8f05[_0xfea4('0x31')],'type':_0x3f8f05[_0xfea4('0x32')][_0xfea4('0x33')]};});_0x5d52e2[_0xfea4('0x34')]=_[_0xfea4('0x2f')](_0xff39ac,_0xfea4('0x2c'));_0x5d52e2[_0xfea4('0x35')]=_[_0xfea4('0x36')](_0x559d7a[_0xfea4('0x35')]);_0x5d52e2[_0xfea4('0x37')]=_[_0xfea4('0x38')](_0x5d52e2['model'],_0x5d52e2[_0xfea4('0x35')]);_0x3dfccf['attributes']=_[_0xfea4('0x38')](_0x5d52e2[_0xfea4('0x34')],qs['fields'](_0x559d7a['query'][_0xfea4('0x39')]));_0x3dfccf[_0xfea4('0x3a')]=_0x3dfccf['attributes'][_0xfea4('0x3b')]?_0x3dfccf[_0xfea4('0x3a')]:_0x5d52e2[_0xfea4('0x34')];if(!_0x559d7a[_0xfea4('0x35')]['hasOwnProperty'](_0xfea4('0x3c'))){_0x3dfccf[_0xfea4('0x22')]=qs[_0xfea4('0x22')](_0x559d7a[_0xfea4('0x35')][_0xfea4('0x22')]);_0x3dfccf['offset']=qs['offset'](_0x559d7a['query'][_0xfea4('0x20')]);}_0x3dfccf['order']=qs[_0xfea4('0x3d')](_0x559d7a[_0xfea4('0x35')][_0xfea4('0x3d')]);_0x3dfccf['where']=qs[_0xfea4('0x37')](_['pick'](_0x559d7a['query'],_0x5d52e2['filters']),_0xff39ac);if(_0x559d7a[_0xfea4('0x35')][_0xfea4('0x3e')]){_0x3dfccf[_0xfea4('0x3f')]=_[_0xfea4('0x40')](_0x3dfccf[_0xfea4('0x3f')],{'$or':_['map'](_0xff39ac,function(_0xaa4404){if(_0xaa4404[_0xfea4('0x32')]!==_0xfea4('0x41')){var _0x54d9a0={};_0x54d9a0[_0xaa4404[_0xfea4('0x2c')]]={'$like':'%'+_0x559d7a['query']['filter']+'%'};return _0x54d9a0;}})});}_0x3dfccf=_[_0xfea4('0x40')]({},_0x3dfccf,_0x559d7a[_0xfea4('0x42')]);var _0x3d2211={'where':_0x3dfccf[_0xfea4('0x3f')]};return db[_0xfea4('0x43')][_0xfea4('0x23')](_0x3d2211)[_0xfea4('0x28')](function(_0x5a1c30){_0x1c3841['count']=_0x5a1c30;if(_0x559d7a[_0xfea4('0x35')]['includeAll']){_0x3dfccf[_0xfea4('0x44')]=[{'all':!![]}];}return db[_0xfea4('0x43')]['findAll'](_0x3dfccf);})[_0xfea4('0x28')](function(_0x48082b){_0x1c3841[_0xfea4('0x45')]=_0x48082b;return _0x1c3841;})['then'](respondWithFilteredResult(_0x3f181b,_0x3dfccf))['catch'](handleError(_0x3f181b,null));};exports[_0xfea4('0x46')]=function(_0x120a8,_0x355f89){var _0x3d189b={'raw':!![],'where':{'id':_0x120a8['params']['id']}},_0x12fb23={};_0x12fb23[_0xfea4('0x34')]=_['keys'](db[_0xfea4('0x43')][_0xfea4('0x30')]);_0x12fb23[_0xfea4('0x35')]=_['keys'](_0x120a8[_0xfea4('0x35')]);_0x12fb23[_0xfea4('0x37')]=_[_0xfea4('0x38')](_0x12fb23['model'],_0x12fb23[_0xfea4('0x35')]);_0x3d189b[_0xfea4('0x3a')]=_[_0xfea4('0x38')](_0x12fb23['model'],qs[_0xfea4('0x39')](_0x120a8[_0xfea4('0x35')][_0xfea4('0x39')]));_0x3d189b[_0xfea4('0x3a')]=_0x3d189b[_0xfea4('0x3a')]['length']?_0x3d189b[_0xfea4('0x3a')]:_0x12fb23[_0xfea4('0x34')];if(_0x120a8[_0xfea4('0x35')][_0xfea4('0x47')]){_0x3d189b[_0xfea4('0x44')]=[{'all':!![]}];}_0x3d189b=_[_0xfea4('0x40')]({},_0x3d189b,_0x120a8[_0xfea4('0x42')]);return db[_0xfea4('0x43')][_0xfea4('0x48')](_0x3d189b)[_0xfea4('0x28')](handleEntityNotFound(_0x355f89,null))['then'](respondWithResult(_0x355f89,null))['catch'](handleError(_0x355f89,null));};exports[_0xfea4('0x49')]=function(_0x35954e,_0x1f4c83){return db['CmHopperHistory'][_0xfea4('0x49')](_0x35954e[_0xfea4('0x4a')],{})[_0xfea4('0x28')](respondWithResult(_0x1f4c83,0xc9))[_0xfea4('0x4b')](handleError(_0x1f4c83,null));};exports[_0xfea4('0x4c')]=function(_0x3c0882,_0x51b9db){return db[_0xfea4('0x43')]['describe']()[_0xfea4('0x28')](respondWithResult(_0x51b9db,null))['catch'](handleError(_0x51b9db,null));};exports[_0xfea4('0x27')]=function(_0x4c167e,_0x46bec5){if(_0x4c167e[_0xfea4('0x4a')]['uniqueid']){delete _0x4c167e['body'][_0xfea4('0x4d')];}return db[_0xfea4('0x43')][_0xfea4('0x48')]({'where':{'uniqueid':_0x4c167e[_0xfea4('0x4e')]['id']}})[_0xfea4('0x28')](handleEntityNotFound(_0x46bec5,null))[_0xfea4('0x28')](saveUpdates(_0x4c167e['body'],null))['then'](respondWithResult(_0x46bec5,null))[_0xfea4('0x4b')](handleError(_0x46bec5,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index f04fe31..8cfb3f8 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 _0x18b2=['api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','../../config/logger'];(function(_0x4f4c53,_0x58ba7b){var _0x568ff1=function(_0x1b6013){while(--_0x1b6013){_0x4f4c53['push'](_0x4f4c53['shift']());}};_0x568ff1(++_0x58ba7b);}(_0x18b2,0x85));var _0x218b=function(_0x35e839,_0x2bfbd7){_0x35e839=_0x35e839-0x0;var _0x4eccc0=_0x18b2[_0x35e839];return _0x4eccc0;};'use strict';var _=require('lodash');var util=require(_0x218b('0x0'));var logger=require(_0x218b('0x1'))(_0x218b('0x2'));var moment=require('moment');var BPromise=require(_0x218b('0x3'));var rp=require(_0x218b('0x4'));var fs=require('fs');var path=require(_0x218b('0x5'));var rimraf=require(_0x218b('0x6'));var config=require(_0x218b('0x7'));var attributes=require(_0x218b('0x8'));module[_0x218b('0x9')]=function(_0x3a9261,_0x1c2c17){return _0x3a9261[_0x218b('0xa')](_0x218b('0xb'),attributes,{'tableName':_0x218b('0xc'),'paranoid':![],'indexes':[{'name':_0x218b('0xd'),'fields':[_0x218b('0xd')]},{'name':_0x218b('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xcf37=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','cm_hopper_history','endtime','uniqueid','util'];(function(_0x3768c7,_0x4f583b){var _0x31cca8=function(_0x2eb3c9){while(--_0x2eb3c9){_0x3768c7['push'](_0x3768c7['shift']());}};_0x31cca8(++_0x4f583b);}(_0xcf37,0xdc));var _0x7cf3=function(_0x21fee0,_0x2bf75f){_0x21fee0=_0x21fee0-0x0;var _0x4ecdbb=_0xcf37[_0x21fee0];return _0x4ecdbb;};'use strict';var _=require('lodash');var util=require(_0x7cf3('0x0'));var logger=require(_0x7cf3('0x1'))(_0x7cf3('0x2'));var moment=require(_0x7cf3('0x3'));var BPromise=require(_0x7cf3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7cf3('0x5'));var rimraf=require(_0x7cf3('0x6'));var config=require(_0x7cf3('0x7'));var attributes=require(_0x7cf3('0x8'));module[_0x7cf3('0x9')]=function(_0x48c7cf,_0x488938){return _0x48c7cf['define']('CmHopperHistory',attributes,{'tableName':_0x7cf3('0xa'),'paranoid':![],'indexes':[{'name':_0x7cf3('0xb'),'fields':[_0x7cf3('0xb')]},{'name':'uniqueid','fields':[_0x7cf3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 8339814..d48ef28 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 _0x063e=['catch','CreateCmHopperHistory','create','body','options','raw','info','CmHopperHistory','where','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','AvgHandleTime','GetVoiceQueueHopperHistory','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x063e,0x111));var _0xe063=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x063e[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0xe063('0x0'));var util=require(_0xe063('0x1'));var moment=require(_0xe063('0x2'));var BPromise=require(_0xe063('0x3'));var rs=require(_0xe063('0x4'));var fs=require('fs');var Redis=require(_0xe063('0x5'));var db=require(_0xe063('0x6'))['db'];var utils=require(_0xe063('0x7'));var logger=require(_0xe063('0x8'))(_0xe063('0x9'));var config=require(_0xe063('0xa'));var jayson=require(_0xe063('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x561d7b,_0x3a046c,_0x661f34){return new BPromise(function(_0x1c48ea,_0x5b10ce){return client[_0xe063('0xc')](_0x561d7b,_0x661f34)[_0xe063('0xd')](function(_0x4bb52b){logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x3a046c,_0xe063('0xe'));logger[_0xe063('0xf')](_0xe063('0x10'),_0x3a046c,'request\x20sent',JSON[_0xe063('0x11')](_0x4bb52b));if(_0x4bb52b[_0xe063('0x12')]){if(_0x4bb52b[_0xe063('0x12')][_0xe063('0x13')]===0x1f4){logger[_0xe063('0x12')](_0xe063('0x14'),_0x3a046c,_0x4bb52b[_0xe063('0x12')][_0xe063('0x15')]);return _0x5b10ce(_0x4bb52b[_0xe063('0x12')][_0xe063('0x15')]);}logger[_0xe063('0x12')](_0xe063('0x14'),_0x3a046c,_0x4bb52b['error']['message']);return _0x1c48ea(_0x4bb52b['error'][_0xe063('0x15')]);}else{logger['info'](_0xe063('0x14'),_0x3a046c,_0xe063('0xe'));_0x1c48ea(_0x4bb52b[_0xe063('0x16')][_0xe063('0x15')]);}})[_0xe063('0x17')](function(_0x29f4ae){logger[_0xe063('0x12')](_0xe063('0x14'),_0x3a046c,_0x29f4ae);_0x5b10ce(_0x29f4ae);});});}exports[_0xe063('0x18')]=function(_0x53cf50){var _0x133d22=this;return new Promise(function(_0x543a8c,_0x1c4ac7){return db['CmHopperHistory'][_0xe063('0x19')](_0x53cf50[_0xe063('0x1a')],{'raw':_0x53cf50[_0xe063('0x1b')]?_0x53cf50[_0xe063('0x1b')][_0xe063('0x1c')]===undefined?!![]:![]:!![]})[_0xe063('0xd')](function(_0x36b19a){logger[_0xe063('0x1d')](_0xe063('0x18'),_0x53cf50);logger[_0xe063('0xf')]('CreateCmHopperHistory',_0x53cf50,JSON[_0xe063('0x11')](_0x36b19a));_0x543a8c(_0x36b19a);})[_0xe063('0x17')](function(_0x206e6c){logger[_0xe063('0x12')](_0xe063('0x18'),_0x206e6c[_0xe063('0x15')],_0x53cf50);_0x1c4ac7(_0x133d22[_0xe063('0x12')](0x1f4,_0x206e6c['message']));});});};exports['AvgHandleTime']=function(_0x20cde8){var _0x4b49e6=this;return new Promise(function(_0xf0c348,_0x26b67b){return db[_0xe063('0x1e')]['findAll']({'raw':_0x20cde8[_0xe063('0x1b')]?_0x20cde8[_0xe063('0x1b')][_0xe063('0x1c')]===undefined?!![]:![]:!![],'where':_0x20cde8[_0xe063('0x1b')]?_0x20cde8[_0xe063('0x1b')][_0xe063('0x1f')]||null:null,'attributes':[[db['sequelize']['fn'](_0xe063('0x20'),db[_0xe063('0x21')][_0xe063('0x22')]('id')),_0xe063('0x23')],[db['sequelize']['fn']('COUNT',db[_0xe063('0x21')]['fn']('IF',db[_0xe063('0x21')][_0xe063('0x24')](_0xe063('0x25')))),_0xe063('0x26')],[db['sequelize']['fn'](_0xe063('0x20'),db[_0xe063('0x21')]['fn']('IF',db[_0xe063('0x21')][_0xe063('0x24')](_0xe063('0x27')))),_0xe063('0x28')],[db['sequelize']['fn'](_0xe063('0x20'),db[_0xe063('0x21')]['fn']('IF',db[_0xe063('0x21')][_0xe063('0x24')](_0xe063('0x29')))),_0xe063('0x2a')],[db[_0xe063('0x21')]['fn'](_0xe063('0x2b'),db[_0xe063('0x21')]['fn']('IF',db['sequelize'][_0xe063('0x24')](_0xe063('0x2c')))),_0xe063('0x2d')],[db[_0xe063('0x21')]['fn'](_0xe063('0x2b'),db[_0xe063('0x21')]['fn']('IF',db[_0xe063('0x21')][_0xe063('0x24')](_0xe063('0x2e')))),'predictiveIntervalAvgTalktime']]})[_0xe063('0xd')](function(_0x4e55b5){logger['info']('AvgHandleTime',_0x20cde8);logger['debug'](_0xe063('0x2f'),_0x20cde8,JSON['stringify'](_0x4e55b5));_0xf0c348(_0x4e55b5);})[_0xe063('0x17')](function(_0x48899b){logger['error'](_0xe063('0x2f'),_0x48899b[_0xe063('0x15')],_0x20cde8);_0x26b67b(_0x4b49e6[_0xe063('0x12')](0x1f4,_0x48899b[_0xe063('0x15')]));});});};exports[_0xe063('0x30')]=function(_0x523a1c){var _0x3e98d8=this;return new Promise(function(_0xe2bbd7,_0x414ebd){return db[_0xe063('0x1e')][_0xe063('0x31')]({'raw':_0x523a1c[_0xe063('0x1b')]?_0x523a1c[_0xe063('0x1b')][_0xe063('0x1c')]===undefined?!![]:![]:!![],'where':_0x523a1c['options']?_0x523a1c[_0xe063('0x1b')][_0xe063('0x1f')]||null:null,'attributes':[[_0xe063('0x32'),_0xe063('0x33')],[db['sequelize']['fn'](_0xe063('0x20'),db[_0xe063('0x21')]['fn']('IF',db[_0xe063('0x21')][_0xe063('0x24')](_0xe063('0x34')))),_0xe063('0x35')],[db[_0xe063('0x21')]['fn'](_0xe063('0x20'),db[_0xe063('0x21')]['fn']('IF',db[_0xe063('0x21')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0xe063('0x36')],[db[_0xe063('0x21')]['fn'](_0xe063('0x20'),db[_0xe063('0x21')]['fn']('IF',db[_0xe063('0x21')]['literal'](_0xe063('0x25')))),_0xe063('0x37')],[db[_0xe063('0x21')]['fn']('COUNT',db[_0xe063('0x21')]['fn']('IF',db[_0xe063('0x21')][_0xe063('0x24')](_0xe063('0x38')))),_0xe063('0x39')],[db[_0xe063('0x21')]['fn'](_0xe063('0x20'),db[_0xe063('0x21')]['fn']('IF',db[_0xe063('0x21')][_0xe063('0x24')]('`state`\x20=\x208,\x201,\x20null'))),_0xe063('0x3a')],[db[_0xe063('0x21')]['fn']('COUNT',db[_0xe063('0x21')]['fn']('IF',db[_0xe063('0x21')][_0xe063('0x24')](_0xe063('0x3b')))),_0xe063('0x3c')],[db[_0xe063('0x21')]['fn']('COUNT',db[_0xe063('0x21')]['fn']('IF',db['sequelize'][_0xe063('0x24')](_0xe063('0x3d')))),_0xe063('0x3e')],[db[_0xe063('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xe063('0x24')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0xe063('0x20'),db[_0xe063('0x21')]['fn']('IF',db[_0xe063('0x21')][_0xe063('0x24')]('`state`\x20=\x2013,\x201,\x20null'))),_0xe063('0x3f')],[db[_0xe063('0x21')]['fn'](_0xe063('0x20'),db[_0xe063('0x21')]['fn']('IF',db[_0xe063('0x21')][_0xe063('0x24')]('`state`\x20=\x2014,\x201,\x20null'))),_0xe063('0x40')],[db[_0xe063('0x21')]['fn'](_0xe063('0x20'),db[_0xe063('0x21')]['fn']('IF',db[_0xe063('0x21')]['literal'](_0xe063('0x41')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0xe063('0x20'),db[_0xe063('0x21')]['fn']('IF',db['sequelize'][_0xe063('0x24')](_0xe063('0x42')))),_0xe063('0x43')],[db['sequelize']['fn'](_0xe063('0x20'),db[_0xe063('0x21')]['fn']('IF',db[_0xe063('0x21')][_0xe063('0x24')](_0xe063('0x44')))),_0xe063('0x45')],[db['sequelize']['fn'](_0xe063('0x20'),db[_0xe063('0x21')]['fn']('IF',db['sequelize'][_0xe063('0x24')](_0xe063('0x46')))),_0xe063('0x47')]],'group':['campaign']})[_0xe063('0xd')](function(_0x15adcf){logger[_0xe063('0x1d')]('GetVoiceQueueHopperHistory',_0x523a1c);logger['debug'](_0xe063('0x30'),_0x523a1c,JSON[_0xe063('0x11')](_0x15adcf));_0xe2bbd7(_0x15adcf);})[_0xe063('0x17')](function(_0x11d0bc){logger['error']('GetVoiceQueueHopperHistory',_0x11d0bc['message'],_0x523a1c);_0x414ebd(_0x3e98d8['error'](0x1f4,_0x11d0bc[_0xe063('0x15')]));});});};exports[_0xe063('0x48')]=function(_0x137b1e){var _0x4fd6d1=this;return new Promise(function(_0x1058b1,_0x390d83){return db[_0xe063('0x1e')]['findAll']({'raw':_0x137b1e[_0xe063('0x1b')]?_0x137b1e[_0xe063('0x1b')][_0xe063('0x1c')]===undefined?!![]:![]:!![],'where':_0x137b1e[_0xe063('0x1b')]?_0x137b1e[_0xe063('0x1b')]['where']||null:null,'attributes':[[_0xe063('0x32'),'name'],[db[_0xe063('0x21')]['fn'](_0xe063('0x20'),db['sequelize'][_0xe063('0x22')]('id')),'ivrTotalCallsDays'],[db[_0xe063('0x21')]['fn'](_0xe063('0x20'),db[_0xe063('0x21')]['fn']('IF',db[_0xe063('0x21')][_0xe063('0x24')](_0xe063('0x25')))),_0xe063('0x49')]],'group':['campaign']})[_0xe063('0xd')](function(_0x46cd64){logger[_0xe063('0x1d')](_0xe063('0x48'),_0x137b1e);logger[_0xe063('0xf')](_0xe063('0x48'),_0x137b1e,JSON[_0xe063('0x11')](_0x46cd64));_0x1058b1(_0x46cd64);})[_0xe063('0x17')](function(_0x8dfdfa){logger[_0xe063('0x12')]('GetCampaignHopperHistory',_0x8dfdfa['message'],_0x137b1e);_0x390d83(_0x4fd6d1['error'](0x1f4,_0x8dfdfa[_0xe063('0x15')]));});});}; \ No newline at end of file +var _0xeb5e=['`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','AvgHandleTime','findAll','raw','col','predictiveIntervalTotalCalls','sequelize','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','COUNT','literal','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout'];(function(_0x40fc07,_0x2627f4){var _0x30bded=function(_0x5b87fa){while(--_0x5b87fa){_0x40fc07['push'](_0x40fc07['shift']());}};_0x30bded(++_0x2627f4);}(_0xeb5e,0x17c));var _0xeeb5=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xeb5e[_0x160c73];return _0xd9302;};'use strict';var _=require(_0xeeb5('0x0'));var util=require('util');var moment=require(_0xeeb5('0x1'));var BPromise=require(_0xeeb5('0x2'));var rs=require(_0xeeb5('0x3'));var fs=require('fs');var Redis=require(_0xeeb5('0x4'));var db=require(_0xeeb5('0x5'))['db'];var utils=require(_0xeeb5('0x6'));var logger=require(_0xeeb5('0x7'))(_0xeeb5('0x8'));var config=require(_0xeeb5('0x9'));var jayson=require(_0xeeb5('0xa'));var client=jayson['client'][_0xeeb5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fd719,_0x3cb2b8,_0x1c5c83){return new BPromise(function(_0x240b01,_0x5338b2){return client[_0xeeb5('0xc')](_0x4fd719,_0x1c5c83)[_0xeeb5('0xd')](function(_0x52b50d){logger[_0xeeb5('0xe')](_0xeeb5('0xf'),_0x3cb2b8,'request\x20sent');logger[_0xeeb5('0x10')](_0xeeb5('0x11'),_0x3cb2b8,_0xeeb5('0x12'),JSON[_0xeeb5('0x13')](_0x52b50d));if(_0x52b50d[_0xeeb5('0x14')]){if(_0x52b50d[_0xeeb5('0x14')][_0xeeb5('0x15')]===0x1f4){logger[_0xeeb5('0x14')](_0xeeb5('0xf'),_0x3cb2b8,_0x52b50d['error'][_0xeeb5('0x16')]);return _0x5338b2(_0x52b50d['error']['message']);}logger['error'](_0xeeb5('0xf'),_0x3cb2b8,_0x52b50d['error']['message']);return _0x240b01(_0x52b50d[_0xeeb5('0x14')][_0xeeb5('0x16')]);}else{logger[_0xeeb5('0xe')](_0xeeb5('0xf'),_0x3cb2b8,'request\x20sent');_0x240b01(_0x52b50d[_0xeeb5('0x17')][_0xeeb5('0x16')]);}})[_0xeeb5('0x18')](function(_0x5f2487){logger[_0xeeb5('0x14')](_0xeeb5('0xf'),_0x3cb2b8,_0x5f2487);_0x5338b2(_0x5f2487);});});}exports[_0xeeb5('0x19')]=function(_0x579896){var _0x483ea4=this;return new Promise(function(_0x46fe75,_0x538b7a){return db[_0xeeb5('0x1a')][_0xeeb5('0x1b')](_0x579896[_0xeeb5('0x1c')],{'raw':_0x579896['options']?_0x579896[_0xeeb5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xeeb5('0xd')](function(_0x151490){logger[_0xeeb5('0xe')](_0xeeb5('0x19'),_0x579896);logger[_0xeeb5('0x10')]('CreateCmHopperHistory',_0x579896,JSON['stringify'](_0x151490));_0x46fe75(_0x151490);})[_0xeeb5('0x18')](function(_0x5c76c8){logger[_0xeeb5('0x14')]('CreateCmHopperHistory',_0x5c76c8[_0xeeb5('0x16')],_0x579896);_0x538b7a(_0x483ea4[_0xeeb5('0x14')](0x1f4,_0x5c76c8[_0xeeb5('0x16')]));});});};exports[_0xeeb5('0x1e')]=function(_0x5022be){var _0x5ba5ba=this;return new Promise(function(_0x2676fe,_0x427a5e){return db['CmHopperHistory'][_0xeeb5('0x1f')]({'raw':_0x5022be[_0xeeb5('0x1d')]?_0x5022be[_0xeeb5('0x1d')][_0xeeb5('0x20')]===undefined?!![]:![]:!![],'where':_0x5022be[_0xeeb5('0x1d')]?_0x5022be[_0xeeb5('0x1d')]['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize'][_0xeeb5('0x21')]('id')),_0xeeb5('0x22')],[db[_0xeeb5('0x23')]['fn']('COUNT',db[_0xeeb5('0x23')]['fn']('IF',db[_0xeeb5('0x23')]['literal'](_0xeeb5('0x24')))),_0xeeb5('0x25')],[db[_0xeeb5('0x23')]['fn'](_0xeeb5('0x26'),db[_0xeeb5('0x23')]['fn']('IF',db[_0xeeb5('0x23')][_0xeeb5('0x27')](_0xeeb5('0x28')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xeeb5('0x23')]['fn']('COUNT',db[_0xeeb5('0x23')]['fn']('IF',db[_0xeeb5('0x23')]['literal'](_0xeeb5('0x29')))),_0xeeb5('0x2a')],[db[_0xeeb5('0x23')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0xeeb5('0x23')][_0xeeb5('0x27')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xeeb5('0x2b')],[db[_0xeeb5('0x23')]['fn'](_0xeeb5('0x2c'),db[_0xeeb5('0x23')]['fn']('IF',db[_0xeeb5('0x23')][_0xeeb5('0x27')](_0xeeb5('0x2d')))),'predictiveIntervalAvgTalktime']]})[_0xeeb5('0xd')](function(_0xf9e3bd){logger[_0xeeb5('0xe')]('AvgHandleTime',_0x5022be);logger[_0xeeb5('0x10')](_0xeeb5('0x1e'),_0x5022be,JSON[_0xeeb5('0x13')](_0xf9e3bd));_0x2676fe(_0xf9e3bd);})['catch'](function(_0x5cac71){logger[_0xeeb5('0x14')](_0xeeb5('0x1e'),_0x5cac71[_0xeeb5('0x16')],_0x5022be);_0x427a5e(_0x5ba5ba[_0xeeb5('0x14')](0x1f4,_0x5cac71[_0xeeb5('0x16')]));});});};exports[_0xeeb5('0x2e')]=function(_0x477f37){var _0xdb5ff1=this;return new Promise(function(_0xece98b,_0x1ba3af){return db[_0xeeb5('0x1a')][_0xeeb5('0x1f')]({'raw':_0x477f37['options']?_0x477f37['options'][_0xeeb5('0x20')]===undefined?!![]:![]:!![],'where':_0x477f37['options']?_0x477f37[_0xeeb5('0x1d')][_0xeeb5('0x2f')]||null:null,'attributes':[[_0xeeb5('0x30'),_0xeeb5('0x31')],[db[_0xeeb5('0x23')]['fn'](_0xeeb5('0x26'),db[_0xeeb5('0x23')]['fn']('IF',db[_0xeeb5('0x23')]['literal'](_0xeeb5('0x32')))),_0xeeb5('0x33')],[db['sequelize']['fn'](_0xeeb5('0x26'),db[_0xeeb5('0x23')]['fn']('IF',db['sequelize'][_0xeeb5('0x27')](_0xeeb5('0x34')))),'outboundNoAnswerCallsDay'],[db[_0xeeb5('0x23')]['fn'](_0xeeb5('0x26'),db[_0xeeb5('0x23')]['fn']('IF',db[_0xeeb5('0x23')][_0xeeb5('0x27')](_0xeeb5('0x24')))),'outboundAnswerCallsDay'],[db[_0xeeb5('0x23')]['fn']('COUNT',db[_0xeeb5('0x23')]['fn']('IF',db[_0xeeb5('0x23')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xeeb5('0x35')],[db[_0xeeb5('0x23')]['fn'](_0xeeb5('0x26'),db[_0xeeb5('0x23')]['fn']('IF',db[_0xeeb5('0x23')][_0xeeb5('0x27')](_0xeeb5('0x36')))),_0xeeb5('0x37')],[db[_0xeeb5('0x23')]['fn'](_0xeeb5('0x26'),db[_0xeeb5('0x23')]['fn']('IF',db['sequelize'][_0xeeb5('0x27')](_0xeeb5('0x38')))),_0xeeb5('0x39')],[db[_0xeeb5('0x23')]['fn'](_0xeeb5('0x26'),db['sequelize']['fn']('IF',db['sequelize'][_0xeeb5('0x27')](_0xeeb5('0x3a')))),_0xeeb5('0x3b')],[db[_0xeeb5('0x23')]['fn']('COUNT',db[_0xeeb5('0x23')]['fn']('IF',db[_0xeeb5('0x23')][_0xeeb5('0x27')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db[_0xeeb5('0x23')]['fn'](_0xeeb5('0x26'),db['sequelize']['fn']('IF',db[_0xeeb5('0x23')][_0xeeb5('0x27')](_0xeeb5('0x3c')))),_0xeeb5('0x3d')],[db[_0xeeb5('0x23')]['fn'](_0xeeb5('0x26'),db[_0xeeb5('0x23')]['fn']('IF',db[_0xeeb5('0x23')][_0xeeb5('0x27')](_0xeeb5('0x3e')))),_0xeeb5('0x3f')],[db[_0xeeb5('0x23')]['fn'](_0xeeb5('0x26'),db['sequelize']['fn']('IF',db['sequelize'][_0xeeb5('0x27')](_0xeeb5('0x40')))),_0xeeb5('0x41')],[db[_0xeeb5('0x23')]['fn'](_0xeeb5('0x26'),db['sequelize']['fn']('IF',db[_0xeeb5('0x23')]['literal'](_0xeeb5('0x42')))),_0xeeb5('0x43')],[db[_0xeeb5('0x23')]['fn'](_0xeeb5('0x26'),db[_0xeeb5('0x23')]['fn']('IF',db['sequelize'][_0xeeb5('0x27')](_0xeeb5('0x44')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0xeeb5('0x26'),db[_0xeeb5('0x23')]['fn']('IF',db[_0xeeb5('0x23')][_0xeeb5('0x27')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xeeb5('0x45')]],'group':[_0xeeb5('0x30')]})[_0xeeb5('0xd')](function(_0x64abee){logger[_0xeeb5('0xe')](_0xeeb5('0x2e'),_0x477f37);logger['debug'](_0xeeb5('0x2e'),_0x477f37,JSON[_0xeeb5('0x13')](_0x64abee));_0xece98b(_0x64abee);})[_0xeeb5('0x18')](function(_0x3f9007){logger[_0xeeb5('0x14')](_0xeeb5('0x2e'),_0x3f9007[_0xeeb5('0x16')],_0x477f37);_0x1ba3af(_0xdb5ff1[_0xeeb5('0x14')](0x1f4,_0x3f9007[_0xeeb5('0x16')]));});});};exports['GetCampaignHopperHistory']=function(_0x3b3809){var _0x1ae091=this;return new Promise(function(_0x4d57e8,_0x195fbc){return db[_0xeeb5('0x1a')]['findAll']({'raw':_0x3b3809[_0xeeb5('0x1d')]?_0x3b3809[_0xeeb5('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3b3809[_0xeeb5('0x1d')]?_0x3b3809[_0xeeb5('0x1d')][_0xeeb5('0x2f')]||null:null,'attributes':[[_0xeeb5('0x30'),_0xeeb5('0x31')],[db[_0xeeb5('0x23')]['fn'](_0xeeb5('0x26'),db[_0xeeb5('0x23')][_0xeeb5('0x21')]('id')),_0xeeb5('0x46')],[db[_0xeeb5('0x23')]['fn']('COUNT',db[_0xeeb5('0x23')]['fn']('IF',db[_0xeeb5('0x23')][_0xeeb5('0x27')](_0xeeb5('0x24')))),_0xeeb5('0x47')]],'group':[_0xeeb5('0x30')]})[_0xeeb5('0xd')](function(_0x27a64a){logger[_0xeeb5('0xe')](_0xeeb5('0x48'),_0x3b3809);logger[_0xeeb5('0x10')](_0xeeb5('0x48'),_0x3b3809,JSON[_0xeeb5('0x13')](_0x27a64a));_0x4d57e8(_0x27a64a);})[_0xeeb5('0x18')](function(_0x334c38){logger[_0xeeb5('0x14')](_0xeeb5('0x48'),_0x334c38[_0xeeb5('0x16')],_0x3b3809);_0x195fbc(_0x1ae091['error'](0x1f4,_0x334c38[_0xeeb5('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 186d470..f7d77f1 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 _0xe15b=['create','put','update','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','/:id','isAuthenticated','show','post'];(function(_0x22d7c8,_0x25d347){var _0x3af78e=function(_0x4b403b){while(--_0x4b403b){_0x22d7c8['push'](_0x22d7c8['shift']());}};_0x3af78e(++_0x25d347);}(_0xe15b,0x147));var _0xbe15=function(_0x1428d9,_0xded63c){_0x1428d9=_0x1428d9-0x0;var _0x438019=_0xe15b[_0x1428d9];return _0x438019;};'use strict';var multer=require(_0xbe15('0x0'));var util=require(_0xbe15('0x1'));var path=require('path');var timeout=require(_0xbe15('0x2'));var express=require(_0xbe15('0x3'));var router=express[_0xbe15('0x4')]();var fs_extra=require(_0xbe15('0x5'));var auth=require(_0xbe15('0x6'));var interaction=require(_0xbe15('0x7'));var config=require(_0xbe15('0x8'));var controller=require('./cmHopperHistory.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xbe15('0x9')](_0xbe15('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xbe15('0xb'),auth[_0xbe15('0xc')](),controller[_0xbe15('0xd')]);router[_0xbe15('0xe')]('/',auth[_0xbe15('0xc')](),controller[_0xbe15('0xf')]);router[_0xbe15('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xbe15('0x11')]);module['exports']=router; \ No newline at end of file +var _0x29c0=['/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x408988,_0xf8d2be){var _0x277402=function(_0x4ff4ff){while(--_0x4ff4ff){_0x408988['push'](_0x408988['shift']());}};_0x277402(++_0xf8d2be);}(_0x29c0,0x1bf));var _0x029c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x29c0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x029c('0x0'));var util=require(_0x029c('0x1'));var path=require(_0x029c('0x2'));var timeout=require(_0x029c('0x3'));var express=require(_0x029c('0x4'));var router=express[_0x029c('0x5')]();var fs_extra=require(_0x029c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x029c('0x7'));var config=require(_0x029c('0x8'));var controller=require(_0x029c('0x9'));router[_0x029c('0xa')]('/',auth[_0x029c('0xb')](),controller[_0x029c('0xc')]);router['get'](_0x029c('0xd'),auth[_0x029c('0xb')](),controller[_0x029c('0xe')]);router['get'](_0x029c('0xf'),auth[_0x029c('0xb')](),controller[_0x029c('0x10')]);router[_0x029c('0x11')]('/',auth[_0x029c('0xb')](),controller[_0x029c('0x12')]);router[_0x029c('0x13')](_0x029c('0xf'),auth[_0x029c('0xb')](),controller[_0x029c('0x14')]);module[_0x029c('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index da2cf9e..10d945a 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 _0xe8f7=['STRING','name','sequelize'];(function(_0x7016ab,_0x53210c){var _0x4754cb=function(_0x39e476){while(--_0x39e476){_0x7016ab['push'](_0x7016ab['shift']());}};_0x4754cb(++_0x53210c);}(_0xe8f7,0x137));var _0x7e8f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe8f7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7e8f('0x0'));module['exports']={'name':{'type':Sequelize[_0x7e8f('0x1')],'unique':_0x7e8f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7e8f('0x1')]},'dialPrefix':{'type':Sequelize[_0x7e8f('0x1')]}}; \ No newline at end of file +var _0xb1d3=['sequelize','STRING'];(function(_0x8cb2f9,_0x2b8706){var _0x164887=function(_0x1812cc){while(--_0x1812cc){_0x8cb2f9['push'](_0x8cb2f9['shift']());}};_0x164887(++_0x2b8706);}(_0xb1d3,0xe8));var _0x3b1d=function(_0x36ab6c,_0xfa9f28){_0x36ab6c=_0x36ab6c-0x0;var _0x3609de=_0xb1d3[_0x36ab6c];return _0x3609de;};'use strict';var Sequelize=require(_0x3b1d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3b1d('0x1')]},'dialPrefix':{'type':Sequelize[_0x3b1d('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 2988021..adb2a50 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 _0xcdc3=['moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','destroy','then','get','Lists','UserProfileResource','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','CmList','include','findAll','rows','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','getDispositions','findOne','Disposition','pick','includeAll','ids','addContacts','CmContact','tags','isArray','join','each','push','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContacts','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','item','ItemTypeId\x20=\x20?','additionalPhone_','description','cm_contact_has_items','CmContactId\x20=\x20c.id','toString','isEmpty','now','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','transaction','addCustomFields','Sequelize','TEXT','text','INTEGER','switch','sequelize','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3db190,_0x5d563d){var _0x3b5468=function(_0x42b6e9){while(--_0x42b6e9){_0x3db190['push'](_0x3db190['shift']());}};_0x3b5468(++_0x5d563d);}(_0xcdc3,0x1ed));var _0x3cdc=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xcdc3[_0x2dadb9];return _0x2f0097;};'use strict';var emlformat=require(_0x3cdc('0x0'));var rimraf=require(_0x3cdc('0x1'));var zipdir=require(_0x3cdc('0x2'));var jsonpatch=require(_0x3cdc('0x3'));var rp=require(_0x3cdc('0x4'));var moment=require(_0x3cdc('0x5'));var BPromise=require(_0x3cdc('0x6'));var Mustache=require(_0x3cdc('0x7'));var util=require(_0x3cdc('0x8'));var path=require(_0x3cdc('0x9'));var sox=require(_0x3cdc('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3cdc('0xb'));var squel=require(_0x3cdc('0xc'));var crypto=require(_0x3cdc('0xd'));var jsforce=require(_0x3cdc('0xe'));var deskjs=require(_0x3cdc('0xf'));var toCsv=require(_0x3cdc('0x10'));var querystring=require(_0x3cdc('0x11'));var Papa=require(_0x3cdc('0x12'));var Redis=require(_0x3cdc('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x3cdc('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3cdc('0x15'));var logger=require(_0x3cdc('0x16'))(_0x3cdc('0x17'));var utils=require(_0x3cdc('0x18'));var config=require(_0x3cdc('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x3cdc('0x1a'))['db'];var csv_results;config[_0x3cdc('0x1b')]=_[_0x3cdc('0x1c')](config[_0x3cdc('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x3cdc('0x1d'))(new Redis(config['redis']));require('./cmList.socket')[_0x3cdc('0x1e')](socket);function respondWithStatusCode(_0x5c6185,_0x134416){_0x134416=_0x134416||0xcc;return function(_0x16717d){if(_0x16717d){return _0x5c6185[_0x3cdc('0x1f')](_0x134416);}return _0x5c6185[_0x3cdc('0x20')](_0x134416)[_0x3cdc('0x21')]();};}function respondWithResult(_0x3ad3ea,_0x59c54a){_0x59c54a=_0x59c54a||0xc8;return function(_0x1da1ac){if(_0x1da1ac){return _0x3ad3ea['status'](_0x59c54a)[_0x3cdc('0x22')](_0x1da1ac);}};}function respondWithFilteredResult(_0x83f908,_0x14c398){return function(_0x1a8aec){if(_0x1a8aec){var _0x3bc81f=typeof _0x14c398[_0x3cdc('0x23')]===_0x3cdc('0x24')&&typeof _0x14c398['limit']===_0x3cdc('0x24');var _0x4ee6b3=_0x1a8aec[_0x3cdc('0x25')];var _0x289166=_0x3bc81f?0x0:_0x14c398[_0x3cdc('0x23')];var _0x2b631d=_0x3bc81f?_0x1a8aec[_0x3cdc('0x25')]:_0x14c398[_0x3cdc('0x23')]+_0x14c398[_0x3cdc('0x26')];var _0x3e49c8;if(_0x2b631d>=_0x4ee6b3){_0x2b631d=_0x4ee6b3;_0x3e49c8=0xc8;}else{_0x3e49c8=0xce;}_0x83f908[_0x3cdc('0x20')](_0x3e49c8);return _0x83f908['set'](_0x3cdc('0x27'),_0x289166+'-'+_0x2b631d+'/'+_0x4ee6b3)[_0x3cdc('0x22')](_0x1a8aec);}return null;};}function patchUpdates(_0x38878f){return function(_0x1583a9){try{jsonpatch[_0x3cdc('0x28')](_0x1583a9,_0x38878f,!![]);}catch(_0x423610){return BPromise[_0x3cdc('0x29')](_0x423610);}return _0x1583a9['save']();};}function saveUpdates(_0x21a215,_0x19c885){return function(_0x442919){if(_0x442919){return _0x442919[_0x3cdc('0x2a')](_0x21a215)['then'](function(_0x1e0139){return _0x1e0139;});}return null;};}function removeEntity(_0x15beab,_0x4aa840){return function(_0x87b9e0){if(_0x87b9e0){return _0x87b9e0[_0x3cdc('0x2b')]()[_0x3cdc('0x2c')](function(){var _0x2ef809=_0x87b9e0[_0x3cdc('0x2d')]({'plain':!![]});var _0x265d8c=_0x3cdc('0x2e');return db[_0x3cdc('0x2f')][_0x3cdc('0x2b')]({'where':{'type':_0x265d8c,'resourceId':_0x2ef809['id']}})[_0x3cdc('0x2c')](function(){return _0x87b9e0;});})[_0x3cdc('0x2c')](function(){_0x15beab[_0x3cdc('0x20')](0xcc)[_0x3cdc('0x21')]();});}};}function handleEntityNotFound(_0x57cf6c,_0x23c18a){return function(_0x4c77bb){if(!_0x4c77bb){_0x57cf6c[_0x3cdc('0x1f')](0x194);}return _0x4c77bb;};}function handleError(_0x3905e3,_0x1b6640){_0x1b6640=_0x1b6640||0x1f4;return function(_0x530bd5){logger[_0x3cdc('0x30')](_0x530bd5[_0x3cdc('0x31')]);if(_0x530bd5[_0x3cdc('0x32')]){delete _0x530bd5[_0x3cdc('0x32')];}_0x3905e3[_0x3cdc('0x20')](_0x1b6640)[_0x3cdc('0x33')](_0x530bd5);};}exports[_0x3cdc('0x34')]=function(_0xf477ea,_0x3fda3f){var _0x2a551a={},_0xd17b50={},_0x33eb76={'count':0x0,'rows':[]};var _0x3e07d3=_['map'](db['CmList'][_0x3cdc('0x35')],function(_0x455697){return{'name':_0x455697['fieldName'],'type':_0x455697[_0x3cdc('0x36')][_0x3cdc('0x37')]};});_0xd17b50[_0x3cdc('0x38')]=_[_0x3cdc('0x39')](_0x3e07d3,_0x3cdc('0x32'));_0xd17b50[_0x3cdc('0x3a')]=_[_0x3cdc('0x3b')](_0xf477ea['query']);_0xd17b50[_0x3cdc('0x3c')]=_[_0x3cdc('0x3d')](_0xd17b50['model'],_0xd17b50['query']);_0x2a551a['attributes']=_['intersection'](_0xd17b50[_0x3cdc('0x38')],qs[_0x3cdc('0x3e')](_0xf477ea['query'][_0x3cdc('0x3e')]));_0x2a551a[_0x3cdc('0x3f')]=_0x2a551a[_0x3cdc('0x3f')][_0x3cdc('0x40')]?_0x2a551a[_0x3cdc('0x3f')]:_0xd17b50[_0x3cdc('0x38')];if(!_0xf477ea[_0x3cdc('0x3a')][_0x3cdc('0x41')](_0x3cdc('0x42'))){_0x2a551a[_0x3cdc('0x26')]=qs[_0x3cdc('0x26')](_0xf477ea[_0x3cdc('0x3a')][_0x3cdc('0x26')]);_0x2a551a[_0x3cdc('0x23')]=qs[_0x3cdc('0x23')](_0xf477ea[_0x3cdc('0x3a')]['offset']);}_0x2a551a[_0x3cdc('0x43')]=qs[_0x3cdc('0x44')](_0xf477ea[_0x3cdc('0x3a')][_0x3cdc('0x44')]);_0x2a551a[_0x3cdc('0x45')]=qs[_0x3cdc('0x3c')](_['pick'](_0xf477ea[_0x3cdc('0x3a')],_0xd17b50['filters']),_0x3e07d3);if(_0xf477ea[_0x3cdc('0x3a')]['filter']){_0x2a551a[_0x3cdc('0x45')]=_[_0x3cdc('0x46')](_0x2a551a['where'],{'$or':_['map'](_0x3e07d3,function(_0x2bedc8){if(_0x2bedc8[_0x3cdc('0x36')]!==_0x3cdc('0x47')){var _0x51ee98={};_0x51ee98[_0x2bedc8[_0x3cdc('0x32')]]={'$like':'%'+_0xf477ea['query'][_0x3cdc('0x48')]+'%'};return _0x51ee98;}})});}_0x2a551a=_[_0x3cdc('0x46')]({},_0x2a551a,_0xf477ea[_0x3cdc('0x49')]);var _0x52bdab={'where':_0x2a551a[_0x3cdc('0x45')]};return db[_0x3cdc('0x4a')][_0x3cdc('0x25')](_0x52bdab)[_0x3cdc('0x2c')](function(_0x4858b5){_0x33eb76[_0x3cdc('0x25')]=_0x4858b5;if(_0xf477ea[_0x3cdc('0x3a')]['includeAll']){_0x2a551a[_0x3cdc('0x4b')]=[{'all':!![]}];}return db[_0x3cdc('0x4a')][_0x3cdc('0x4c')](_0x2a551a);})[_0x3cdc('0x2c')](function(_0x47b2a4){_0x33eb76[_0x3cdc('0x4d')]=_0x47b2a4;return _0x33eb76;})[_0x3cdc('0x2c')](respondWithFilteredResult(_0x3fda3f,_0x2a551a))['catch'](handleError(_0x3fda3f,null));};exports['show']=function(_0xa6824,_0x661816){var _0x2dc148={'raw':![],'where':{'id':_0xa6824[_0x3cdc('0x4e')]['id']}},_0x4b76eb={};_0x4b76eb['model']=_[_0x3cdc('0x3b')](db['CmList'][_0x3cdc('0x35')]);_0x4b76eb[_0x3cdc('0x3a')]=_['keys'](_0xa6824[_0x3cdc('0x3a')]);_0x4b76eb[_0x3cdc('0x3c')]=_[_0x3cdc('0x3d')](_0x4b76eb['model'],_0x4b76eb[_0x3cdc('0x3a')]);_0x2dc148[_0x3cdc('0x3f')]=_['intersection'](_0x4b76eb['model'],qs[_0x3cdc('0x3e')](_0xa6824[_0x3cdc('0x3a')][_0x3cdc('0x3e')]));_0x2dc148[_0x3cdc('0x3f')]=_0x2dc148[_0x3cdc('0x3f')]['length']?_0x2dc148['attributes']:_0x4b76eb[_0x3cdc('0x38')];if(_0xa6824[_0x3cdc('0x3a')]['includeAll']){_0x2dc148[_0x3cdc('0x4b')]=[{'all':!![]}];}_0x2dc148=_['merge']({},_0x2dc148,_0xa6824[_0x3cdc('0x49')]);return db[_0x3cdc('0x4a')]['find'](_0x2dc148)['then'](handleEntityNotFound(_0x661816,null))[_0x3cdc('0x2c')](respondWithResult(_0x661816,null))[_0x3cdc('0x4f')](handleError(_0x661816,null));};exports[_0x3cdc('0x50')]=function(_0x4afae1,_0x5e1036){return db[_0x3cdc('0x4a')][_0x3cdc('0x50')](_0x4afae1[_0x3cdc('0x51')],{})[_0x3cdc('0x2c')](function(_0x2be048){var _0x2c0af7=_0x4afae1[_0x3cdc('0x52')][_0x3cdc('0x2d')]({'plain':!![]});if(!_0x2c0af7)throw new Error(_0x3cdc('0x53'));if(_0x2c0af7[_0x3cdc('0x54')]==='user'){var _0x46ebec=_0x2be048[_0x3cdc('0x2d')]({'plain':!![]});var _0x4deeaa='Lists';return db[_0x3cdc('0x55')][_0x3cdc('0x56')]({'where':{'name':_0x4deeaa,'userProfileId':_0x2c0af7[_0x3cdc('0x57')]},'raw':!![]})[_0x3cdc('0x2c')](function(_0x57310c){if(_0x57310c&&_0x57310c[_0x3cdc('0x58')]===0x0){return db[_0x3cdc('0x2f')][_0x3cdc('0x50')]({'name':_0x46ebec[_0x3cdc('0x32')],'resourceId':_0x46ebec['id'],'type':_0x57310c[_0x3cdc('0x32')],'sectionId':_0x57310c['id']},{})['then'](function(){return _0x2be048;});}else{return _0x2be048;}})[_0x3cdc('0x4f')](function(_0x42db21){logger['error'](_0x3cdc('0x59'),_0x42db21);throw _0x42db21;});}return _0x2be048;})['then'](respondWithResult(_0x5e1036,0xc9))['catch'](handleError(_0x5e1036,null));};exports['update']=function(_0x268747,_0x3f21fd){if(_0x268747[_0x3cdc('0x51')]['id']){delete _0x268747['body']['id'];}return db['CmList'][_0x3cdc('0x56')]({'where':{'id':_0x268747['params']['id']}})[_0x3cdc('0x2c')](handleEntityNotFound(_0x3f21fd,null))[_0x3cdc('0x2c')](saveUpdates(_0x268747['body'],null))[_0x3cdc('0x2c')](respondWithResult(_0x3f21fd,null))[_0x3cdc('0x4f')](handleError(_0x3f21fd,null));};exports[_0x3cdc('0x2b')]=function(_0x185f7e,_0xcee8a6){return db[_0x3cdc('0x4a')][_0x3cdc('0x56')]({'where':{'id':_0x185f7e[_0x3cdc('0x4e')]['id']}})[_0x3cdc('0x2c')](handleEntityNotFound(_0xcee8a6,null))[_0x3cdc('0x2c')](removeEntity(_0xcee8a6,null))[_0x3cdc('0x4f')](handleError(_0xcee8a6,null));};exports[_0x3cdc('0x5a')]=function(_0x49ed2b,_0x3670b4){return db[_0x3cdc('0x4a')]['describe']()[_0x3cdc('0x2c')](respondWithResult(_0x3670b4,null))['catch'](handleError(_0x3670b4,null));};exports[_0x3cdc('0x5b')]=function(_0x1eb61c,_0x211881,_0x255f7a){if(_0x1eb61c['body']['id']){delete _0x1eb61c[_0x3cdc('0x51')]['id'];}return db[_0x3cdc('0x4a')][_0x3cdc('0x56')]({'where':{'id':_0x1eb61c[_0x3cdc('0x4e')]['id']}})[_0x3cdc('0x2c')](handleEntityNotFound(_0x211881,null))[_0x3cdc('0x2c')](function(_0x400632){if(_0x400632){_0x1eb61c[_0x3cdc('0x51')][_0x3cdc('0x5c')]=_0x400632['id'];return db['Disposition'][_0x3cdc('0x50')](_0x1eb61c[_0x3cdc('0x51')]);}})[_0x3cdc('0x2c')](respondWithResult(_0x211881,null))[_0x3cdc('0x4f')](handleError(_0x211881,null));};exports[_0x3cdc('0x5d')]=function(_0x2c7901,_0x2c5823,_0x1159d3){var _0x3de5c3={'raw':![],'where':{}};var _0x20169a={};var _0x287a6b={'count':0x0,'rows':[]};return db[_0x3cdc('0x4a')][_0x3cdc('0x5e')]({'where':{'id':_0x2c7901[_0x3cdc('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2c5823,null))[_0x3cdc('0x2c')](function(_0x28463e){if(_0x28463e){_0x20169a[_0x3cdc('0x38')]=_[_0x3cdc('0x3b')](db[_0x3cdc('0x5f')]['rawAttributes']);_0x20169a['query']=_[_0x3cdc('0x3b')](_0x2c7901['query']);_0x20169a[_0x3cdc('0x3c')]=_[_0x3cdc('0x3d')](_0x20169a['model'],_0x20169a[_0x3cdc('0x3a')]);_0x3de5c3[_0x3cdc('0x3f')]=_[_0x3cdc('0x3d')](_0x20169a[_0x3cdc('0x38')],qs[_0x3cdc('0x3e')](_0x2c7901[_0x3cdc('0x3a')]['fields']));_0x3de5c3[_0x3cdc('0x3f')]=_0x3de5c3['attributes'][_0x3cdc('0x40')]?_0x3de5c3[_0x3cdc('0x3f')]:_0x20169a[_0x3cdc('0x38')];if(!_0x2c7901[_0x3cdc('0x3a')][_0x3cdc('0x41')](_0x3cdc('0x42'))){_0x3de5c3[_0x3cdc('0x26')]=qs[_0x3cdc('0x26')](_0x2c7901[_0x3cdc('0x3a')][_0x3cdc('0x26')]);_0x3de5c3[_0x3cdc('0x23')]=qs[_0x3cdc('0x23')](_0x2c7901[_0x3cdc('0x3a')][_0x3cdc('0x23')]);}_0x3de5c3[_0x3cdc('0x43')]=qs[_0x3cdc('0x44')](_0x2c7901['query'][_0x3cdc('0x44')]);_0x3de5c3[_0x3cdc('0x45')]=qs[_0x3cdc('0x3c')](_[_0x3cdc('0x60')](_0x2c7901[_0x3cdc('0x3a')],_0x20169a[_0x3cdc('0x3c')]));_0x3de5c3[_0x3cdc('0x45')][_0x3cdc('0x5c')]=_0x28463e['id'];if(_0x2c7901['query'][_0x3cdc('0x48')]){_0x3de5c3[_0x3cdc('0x45')]=_['merge'](_0x3de5c3['where'],{'$or':_['map'](_0x3de5c3[_0x3cdc('0x3f')],function(_0x51d242){var _0x4da842={};_0x4da842[_0x51d242]={'$like':'%'+_0x2c7901[_0x3cdc('0x3a')][_0x3cdc('0x48')]+'%'};return _0x4da842;})});}_0x3de5c3=_['merge']({},_0x3de5c3,_0x2c7901[_0x3cdc('0x49')]);return db[_0x3cdc('0x5f')]['count']({'where':_0x3de5c3['where']})['then'](function(_0x1d5093){_0x287a6b[_0x3cdc('0x25')]=_0x1d5093;if(_0x2c7901[_0x3cdc('0x3a')][_0x3cdc('0x61')]){_0x3de5c3[_0x3cdc('0x4b')]=[{'all':!![]}];}return db[_0x3cdc('0x5f')][_0x3cdc('0x4c')](_0x3de5c3);})[_0x3cdc('0x2c')](function(_0x222921){_0x287a6b[_0x3cdc('0x4d')]=_0x222921;return _0x287a6b;});}})['then'](respondWithFilteredResult(_0x2c5823,_0x3de5c3))[_0x3cdc('0x4f')](handleError(_0x2c5823,null));};exports['removeDispositions']=function(_0x3ba2b3,_0x529c7f,_0x2028a3){return db[_0x3cdc('0x4a')][_0x3cdc('0x56')]({'where':{'id':_0x3ba2b3[_0x3cdc('0x4e')]['id']}})[_0x3cdc('0x2c')](handleEntityNotFound(_0x529c7f,null))[_0x3cdc('0x2c')](function(_0x5060c4){if(_0x5060c4){return _0x5060c4['removeDispositions'](_0x3ba2b3[_0x3cdc('0x3a')][_0x3cdc('0x62')]);}})[_0x3cdc('0x2c')](respondWithStatusCode(_0x529c7f,null))['catch'](handleError(_0x529c7f,null));};exports[_0x3cdc('0x63')]=function(_0x36f1a5,_0x2c3bf9,_0x585972){return db[_0x3cdc('0x4a')][_0x3cdc('0x56')]({'where':{'id':_0x36f1a5['params']['id']}})[_0x3cdc('0x2c')](handleEntityNotFound(_0x2c3bf9,null))[_0x3cdc('0x2c')](function(_0x57638f){if(_0x57638f){var _0x310ef2=[];var _0x26b017={'success':[],'errors':[]};return db[_0x3cdc('0x64')]['describe']()[_0x3cdc('0x2c')](function(_0x3145c8){if(_0x36f1a5['body'][_0x3cdc('0x65')]&&_[_0x3cdc('0x66')](_0x36f1a5[_0x3cdc('0x51')]['tags'])){if(_0x36f1a5[_0x3cdc('0x51')][_0x3cdc('0x65')][_0x3cdc('0x40')]){_0x36f1a5['body']['tags']=_0x36f1a5[_0x3cdc('0x51')][_0x3cdc('0x65')][_0x3cdc('0x67')](';')+';';}else{_0x36f1a5['body'][_0x3cdc('0x65')]=null;}}else{_0x36f1a5[_0x3cdc('0x51')][_0x3cdc('0x65')]=null;}if(_0x36f1a5[_0x3cdc('0x51')]&&_[_0x3cdc('0x66')](_0x36f1a5[_0x3cdc('0x51')])){for(var _0x48571d=0x0;_0x48571d<_0x36f1a5[_0x3cdc('0x51')][_0x3cdc('0x40')];_0x48571d+=0x1){_0x36f1a5[_0x3cdc('0x51')][_0x48571d][_0x3cdc('0x5c')]=_0x36f1a5[_0x3cdc('0x4e')]['id'];_0x310ef2['push'](_0x36f1a5[_0x3cdc('0x51')][_0x48571d]);}return BPromise[_0x3cdc('0x68')](_0x310ef2,function(_0x4043f2){return db[_0x3cdc('0x64')][_0x3cdc('0x50')](_['omit'](_0x4043f2,[_0x3cdc('0x62'),'id'])||{},{'fields':_['keys'](_0x3145c8),'raw':!![]})[_0x3cdc('0x2c')](function(_0x24db21){_0x26b017['success'][_0x3cdc('0x69')](_0x24db21['dataValues']);})['catch'](function(_0x4ec509){_0x26b017[_0x3cdc('0x6a')][_0x3cdc('0x69')]({'data':_0x4043f2,'error':_0x4ec509[_0x3cdc('0x6b')]});});})[_0x3cdc('0x2c')](function(_0x220b14){return _0x26b017;})[_0x3cdc('0x4f')](function(_0x5f27af){return _0x5f27af;});}else{_0x2c3bf9[_0x3cdc('0x20')](0x190)[_0x3cdc('0x22')]({'message':_0x3cdc('0x6c')});}});}})['then'](respondWithResult(_0x2c3bf9,null))[_0x3cdc('0x4f')](handleError(_0x2c3bf9,null));};exports['getContacts']=function(_0x3f45c8,_0x35351a,_0x185257){var _0x24b275;return db[_0x3cdc('0x4a')][_0x3cdc('0x56')]({'where':{'id':_0x3f45c8[_0x3cdc('0x4e')]['id']},'include':[{'model':db[_0x3cdc('0x6d')],'as':_0x3cdc('0x6e')}]})[_0x3cdc('0x2c')](handleEntityNotFound(_0x35351a,null))[_0x3cdc('0x2c')](function(_0x2bb7c6){if(_0x2bb7c6){_0x24b275=_0x2bb7c6;return db[_0x3cdc('0x64')][_0x3cdc('0x35')];}})[_0x3cdc('0x2c')](function(_0xc888d0){if(_0xc888d0){var _0xb18f85={};var _0x39b6b5={};_0x39b6b5[_0x3cdc('0x38')]=_[_0x3cdc('0x6f')](_[_0x3cdc('0x3b')](_0xc888d0),_[_0x3cdc('0x39')](_0x24b275[_0x3cdc('0x6e')],function(_0x39f559){return util[_0x3cdc('0x70')](_0x3cdc('0x71'),_0x39f559['id']);}));_0x39b6b5[_0x3cdc('0x3a')]=_['keys'](_0x3f45c8[_0x3cdc('0x3a')]);_0x39b6b5[_0x3cdc('0x3c')]=_[_0x3cdc('0x3d')](_0x39b6b5[_0x3cdc('0x38')],_0x39b6b5[_0x3cdc('0x3a')]);_0xb18f85['attributes']=_[_0x3cdc('0x3d')](_0x39b6b5[_0x3cdc('0x38')],qs[_0x3cdc('0x3e')](_0x3f45c8[_0x3cdc('0x3a')]['fields']));_0xb18f85[_0x3cdc('0x3f')]=_0xb18f85[_0x3cdc('0x3f')][_0x3cdc('0x40')]?_0xb18f85[_0x3cdc('0x3f')]:_0x39b6b5[_0x3cdc('0x38')];if(!_0x3f45c8['query'][_0x3cdc('0x41')]('nolimit')){_0xb18f85[_0x3cdc('0x26')]=qs[_0x3cdc('0x26')](_0x3f45c8[_0x3cdc('0x3a')][_0x3cdc('0x26')]);_0xb18f85[_0x3cdc('0x23')]=qs[_0x3cdc('0x23')](_0x3f45c8[_0x3cdc('0x3a')]['offset']);}_0xb18f85[_0x3cdc('0x43')]=qs['sort'](_0x3f45c8['query'][_0x3cdc('0x44')]);_0xb18f85[_0x3cdc('0x45')]=qs['filters'](_[_0x3cdc('0x60')](_0x3f45c8[_0x3cdc('0x3a')],_0x39b6b5[_0x3cdc('0x3c')]));_0xb18f85[_0x3cdc('0x72')]=!![];if(_0x3f45c8[_0x3cdc('0x3a')][_0x3cdc('0x48')]){_0xb18f85['where']=_[_0x3cdc('0x46')](_0xb18f85['where'],{'$or':_[_0x3cdc('0x39')](_0xb18f85[_0x3cdc('0x3f')],function(_0x487422){var _0x31b637={};_0x31b637[_0x487422]={'$like':'%'+_0x3f45c8[_0x3cdc('0x3a')][_0x3cdc('0x48')]+'%'};return _0x31b637;})});}_0xb18f85=_[_0x3cdc('0x46')]({},_0xb18f85,_0x3f45c8['options']);return _0x24b275[_0x3cdc('0x73')](_0xb18f85);}})[_0x3cdc('0x2c')](respondWithResult(_0x35351a,null))['catch'](handleError(_0x35351a,null));};exports['getContactsCsv']=function(_0x5cd2af,_0x1ce3bf,_0x4d05f9){var _0x49e59c;var _0x317faf;var _0x8bea26;var _0x38942a=_0x5cd2af['params']['id'];csv_results=[];return db[_0x3cdc('0x74')][_0x3cdc('0x4c')]({'attributes':['id',_0x3cdc('0x32')],'raw':!![],'order':[_0x3cdc('0x75')]})[_0x3cdc('0x2c')](function(_0x56ee20){_0x49e59c=_0x56ee20;var _0x1bf29b=_[_0x3cdc('0x3b')](db[_0x3cdc('0x64')][_0x3cdc('0x35')]);return db[_0x3cdc('0x6d')][_0x3cdc('0x4c')]({'raw':!![],'attributes':['id',_0x3cdc('0x76')]})['then'](function(_0x474890){_0x317faf=_0x474890;var _0x3817f0=squel[_0x3cdc('0x77')]()[_0x3cdc('0x3e')](_0x1bf29b)[_0x3cdc('0x78')](_0x3cdc('0x79'),'c')['where'](_0x3cdc('0x7a'),_0x38942a)[_0x3cdc('0x45')](_0x3cdc('0x7b'))[_0x3cdc('0x7c')]();for(var _0x5d4d2b=0x0;_0x5d4d2b<_0x317faf[_0x3cdc('0x40')];_0x5d4d2b++){_0x3817f0[_0x3cdc('0x7d')](_0x3cdc('0x7e')+_0x317faf[_0x5d4d2b]['id'],'customField_'+_0x317faf[_0x5d4d2b]['alias']);}for(var _0x5d4d2b=0x0;_0x5d4d2b<_0x49e59c[_0x3cdc('0x40')];_0x5d4d2b++){_0x3817f0[_0x3cdc('0x7d')](squel[_0x3cdc('0x77')]()[_0x3cdc('0x7d')](_0x3cdc('0x7f'))[_0x3cdc('0x78')]('cm_contact_has_items')[_0x3cdc('0x45')](_0x3cdc('0x80'),_0x49e59c[_0x5d4d2b]['id'])[_0x3cdc('0x45')]('CmContactId\x20=\x20c.id'),_0x3cdc('0x81')+_0x49e59c[_0x5d4d2b][_0x3cdc('0x32')]);_0x3817f0['field'](squel[_0x3cdc('0x77')]()[_0x3cdc('0x7d')](_0x3cdc('0x82'))[_0x3cdc('0x78')](_0x3cdc('0x83'))[_0x3cdc('0x45')](_0x3cdc('0x80'),_0x49e59c[_0x5d4d2b]['id'])['where'](_0x3cdc('0x84')),'description_additionalPhone_'+_0x49e59c[_0x5d4d2b]['name']);}var _0x56ba4a=[];_0x56ba4a[_0x3cdc('0x69')](_0x3817f0[_0x3cdc('0x85')]());BPromise[_0x3cdc('0x68')](_0x56ba4a,handleQuery)[_0x3cdc('0x2c')](function(_0x333178){handleQuery(_0x3817f0['toString']());var _0x260550=csv_results[0x0];if(!_[_0x3cdc('0x86')](_0x260550)){var _0x22f47e=toCsv(_0x260550);var _0xdfdc8b=Date[_0x3cdc('0x87')]();fs['writeFileSync'](util[_0x3cdc('0x70')]('/tmp/list_%d_%s.csv',_0x38942a,_0xdfdc8b),_0x22f47e);_0x1ce3bf[_0x3cdc('0x88')](_0x3cdc('0x89'),'attachment;\x20filename='+util[_0x3cdc('0x70')](_0x3cdc('0x8a'),_0x38942a,_0xdfdc8b));_0x1ce3bf[_0x3cdc('0x88')](_0x3cdc('0x8b'),_0x3cdc('0x8c'));return _0x1ce3bf[_0x3cdc('0x8d')](util[_0x3cdc('0x70')](_0x3cdc('0x8e'),_0x38942a,_0xdfdc8b));}else{return _0x1ce3bf[_0x3cdc('0x1f')](0xcc);}});});});};exports[_0x3cdc('0x8f')]=function(_0x156e09,_0x525855,_0x1c0518){var _0x6c2288;delete _0x156e09[_0x3cdc('0x51')]['id'];return db[_0x3cdc('0x4a')]['findOne']({'where':{'id':_0x156e09['params']['id']}})[_0x3cdc('0x2c')](handleEntityNotFound(_0x525855,null))['then'](function(_0xb405ac){if(_0xb405ac){return db['sequelize'][_0x3cdc('0x90')](function(_0x48dce2){return db[_0x3cdc('0x6d')]['create'](_0x156e09[_0x3cdc('0x51')],{'transaction':_0x48dce2})['then'](function(_0x58781a){_0x6c2288=_0x58781a;return _0xb405ac[_0x3cdc('0x91')](_0x58781a,{'transaction':_0x48dce2});})[_0x3cdc('0x2c')](function(){var _0x6636d2={'type':db[_0x3cdc('0x92')][_0x3cdc('0x93')],'transaction':_0x48dce2};switch(_0x156e09['body']['type']){case _0x3cdc('0x94'):_0x6636d2[_0x3cdc('0x36')]=db[_0x3cdc('0x92')][_0x3cdc('0x93')];break;case'number':_0x6636d2[_0x3cdc('0x36')]=db[_0x3cdc('0x92')][_0x3cdc('0x95')];break;case _0x3cdc('0x96'):_0x6636d2['type']=db[_0x3cdc('0x92')]['BOOLEAN'];_0x6636d2['defaultValue']=![];break;default:}return db[_0x3cdc('0x97')][_0x3cdc('0x98')][_0x3cdc('0x99')](_0x3cdc('0x79'),util[_0x3cdc('0x70')](_0x3cdc('0x9a'),_0x6c2288['id']),_0x6636d2);})['then'](function(){return _0x6c2288;});});}})[_0x3cdc('0x2c')](respondWithResult(_0x525855,null))['catch'](handleError(_0x525855,null));};exports[_0x3cdc('0x9b')]=function(_0x5cca04,_0x51e862,_0x2faefb){var _0x1e5b71={};var _0x256182={};var _0x53de3e;var _0x5d91d3;return db[_0x3cdc('0x4a')]['findOne']({'where':{'id':_0x5cca04[_0x3cdc('0x4e')]['id']}})[_0x3cdc('0x2c')](handleEntityNotFound(_0x51e862,null))[_0x3cdc('0x2c')](function(_0x250ac3){if(_0x250ac3){_0x53de3e=_0x250ac3;_0x256182[_0x3cdc('0x38')]=_[_0x3cdc('0x3b')](db[_0x3cdc('0x6d')][_0x3cdc('0x35')]);_0x256182[_0x3cdc('0x3a')]=_[_0x3cdc('0x3b')](_0x5cca04[_0x3cdc('0x3a')]);_0x256182[_0x3cdc('0x3c')]=_[_0x3cdc('0x3d')](_0x256182[_0x3cdc('0x38')],_0x256182[_0x3cdc('0x3a')]);_0x1e5b71[_0x3cdc('0x3f')]=_[_0x3cdc('0x3d')](_0x256182[_0x3cdc('0x38')],qs[_0x3cdc('0x3e')](_0x5cca04[_0x3cdc('0x3a')][_0x3cdc('0x3e')]));_0x1e5b71[_0x3cdc('0x3f')]=_0x1e5b71[_0x3cdc('0x3f')][_0x3cdc('0x40')]?_0x1e5b71[_0x3cdc('0x3f')]:_0x256182[_0x3cdc('0x38')];_0x1e5b71[_0x3cdc('0x43')]=qs[_0x3cdc('0x44')](_0x5cca04[_0x3cdc('0x3a')][_0x3cdc('0x44')]);_0x1e5b71['where']=qs[_0x3cdc('0x3c')](_[_0x3cdc('0x60')](_0x5cca04[_0x3cdc('0x3a')],_0x256182[_0x3cdc('0x3c')]));_0x1e5b71[_0x3cdc('0x45')]=_['merge'](_0x1e5b71[_0x3cdc('0x45')],{'$or':[{'ListId':_0x250ac3['id']},{'ListId':null}]});if(_0x5cca04[_0x3cdc('0x3a')][_0x3cdc('0x48')]){_0x1e5b71[_0x3cdc('0x45')]=_['merge'](_0x1e5b71[_0x3cdc('0x45')],{'$or':_[_0x3cdc('0x39')](_0x1e5b71['attributes'],function(_0x2023e6){var _0x6b26c={};_0x6b26c[_0x2023e6]={'$like':'%'+_0x5cca04[_0x3cdc('0x3a')][_0x3cdc('0x48')]+'%'};return _0x6b26c;})});}_0x1e5b71=_[_0x3cdc('0x46')]({},_0x1e5b71,_0x5cca04['options']);return db['CmCustomField'][_0x3cdc('0x9c')](_0x1e5b71);}})['then'](respondWithResult(_0x51e862,null))[_0x3cdc('0x4f')](handleError(_0x51e862,null));};exports['getGlobalCustomFields']=function(_0x288729,_0x495749){return db[_0x3cdc('0x6d')]['findAndCountAll']({'where':{'ListId':null}})[_0x3cdc('0x2c')](handleEntityNotFound(_0x495749,null))['then'](function(_0x17331a){return _0x17331a;})[_0x3cdc('0x2c')](respondWithResult(_0x495749,null))[_0x3cdc('0x4f')](handleError(_0x495749,null));};exports['addAgents']=function(_0x115017,_0x502fad,_0x4b42bb){return db[_0x3cdc('0x4a')][_0x3cdc('0x56')]({'where':{'id':_0x115017['params']['id']}})[_0x3cdc('0x2c')](handleEntityNotFound(_0x502fad,null))[_0x3cdc('0x2c')](function(_0xeffc86){if(_0xeffc86){return _0xeffc86[_0x3cdc('0x9d')](_0x115017[_0x3cdc('0x51')][_0x3cdc('0x62')],_['omit'](_0x115017['body'],[_0x3cdc('0x62'),'id'])||{})[_0x3cdc('0x9e')](function(_0x5f5be1){for(var _0x2f1b75=0x0;_0x2f1b75<_0x115017[_0x3cdc('0x51')][_0x3cdc('0x62')]['length'];_0x2f1b75+=0x1){socket[_0x3cdc('0x9f')](_0x3cdc('0xa0'),{'UserId':Number(_0x115017[_0x3cdc('0x51')][_0x3cdc('0x62')][_0x2f1b75]),'CmListId':Number(_0x115017['params']['id'])});}return _0x5f5be1;});}})[_0x3cdc('0x2c')](respondWithResult(_0x502fad,null))[_0x3cdc('0x4f')](handleError(_0x502fad,null));};exports['removeAgents']=function(_0x2b8c65,_0x39bf86,_0x1e8d89){return db[_0x3cdc('0x4a')][_0x3cdc('0x56')]({'where':{'id':_0x2b8c65['params']['id']}})['then'](handleEntityNotFound(_0x39bf86,null))['then'](function(_0x5cbc5b){if(_0x5cbc5b){return _0x5cbc5b[_0x3cdc('0xa1')](_0x2b8c65['query'][_0x3cdc('0x62')])['then'](function(){if(_[_0x3cdc('0x66')](_0x2b8c65[_0x3cdc('0x3a')][_0x3cdc('0x62')])){for(var _0x25c40b=0x0;_0x25c40b<_0x2b8c65[_0x3cdc('0x3a')][_0x3cdc('0x62')][_0x3cdc('0x40')];_0x25c40b+=0x1){socket[_0x3cdc('0x9f')](_0x3cdc('0xa2'),{'UserId':Number(_0x2b8c65[_0x3cdc('0x3a')][_0x3cdc('0x62')][_0x25c40b]),'CmListId':Number(_0x2b8c65[_0x3cdc('0x4e')]['id'])});}}else{socket['emit'](_0x3cdc('0xa2'),{'UserId':Number(_0x2b8c65[_0x3cdc('0x3a')][_0x3cdc('0x62')]),'CmListId':Number(_0x2b8c65[_0x3cdc('0x4e')]['id'])});}});}})[_0x3cdc('0x2c')](respondWithStatusCode(_0x39bf86,null))[_0x3cdc('0x4f')](handleError(_0x39bf86,null));};exports[_0x3cdc('0xa3')]=function(_0x3926a4,_0x4823dd,_0xa92413){var _0x3ec46b={};var _0x2d4039={};var _0x5b64ac;var _0x2fb065;return db[_0x3cdc('0x4a')][_0x3cdc('0x5e')]({'where':{'id':_0x3926a4['params']['id']}})[_0x3cdc('0x2c')](handleEntityNotFound(_0x4823dd,null))[_0x3cdc('0x2c')](function(_0x43f6e1){if(_0x43f6e1){_0x5b64ac=_0x43f6e1;_0x2d4039['model']=_[_0x3cdc('0x3b')](db[_0x3cdc('0xa4')]['rawAttributes']);_0x2d4039[_0x3cdc('0x3a')]=_[_0x3cdc('0x3b')](_0x3926a4[_0x3cdc('0x3a')]);_0x2d4039[_0x3cdc('0x3c')]=_[_0x3cdc('0x3d')](_0x2d4039[_0x3cdc('0x38')],_0x2d4039[_0x3cdc('0x3a')]);_0x3ec46b[_0x3cdc('0x3f')]=_[_0x3cdc('0x3d')](_0x2d4039[_0x3cdc('0x38')],qs[_0x3cdc('0x3e')](_0x3926a4[_0x3cdc('0x3a')][_0x3cdc('0x3e')]));_0x3ec46b[_0x3cdc('0x3f')]=_0x3ec46b[_0x3cdc('0x3f')][_0x3cdc('0x40')]?_0x3ec46b['attributes']:_0x2d4039['model'];_0x3ec46b[_0x3cdc('0x43')]=qs['sort'](_0x3926a4['query'][_0x3cdc('0x44')]);_0x3ec46b[_0x3cdc('0x45')]=qs[_0x3cdc('0x3c')](_[_0x3cdc('0x60')](_0x3926a4[_0x3cdc('0x3a')],_0x2d4039[_0x3cdc('0x3c')]));if(_0x3926a4[_0x3cdc('0x3a')]['filter']){_0x3ec46b[_0x3cdc('0x45')]=_[_0x3cdc('0x46')](_0x3ec46b[_0x3cdc('0x45')],{'$or':_[_0x3cdc('0x39')](_0x3ec46b[_0x3cdc('0x3f')],function(_0x35f63d){var _0x3843ed={};_0x3843ed[_0x35f63d]={'$like':'%'+_0x3926a4['query']['filter']+'%'};return _0x3843ed;})});}_0x3ec46b=_[_0x3cdc('0x46')]({},_0x3ec46b,_0x3926a4[_0x3cdc('0x49')]);return _0x5b64ac[_0x3cdc('0xa3')](_0x3ec46b);}})[_0x3cdc('0x2c')](function(_0x22ecf0){if(_0x22ecf0){_0x2fb065=_0x22ecf0['length'];if(!_0x3926a4[_0x3cdc('0x3a')][_0x3cdc('0x41')]('nolimit')){_0x3ec46b[_0x3cdc('0x26')]=qs[_0x3cdc('0x26')](_0x3926a4[_0x3cdc('0x3a')]['limit']);_0x3ec46b[_0x3cdc('0x23')]=qs['offset'](_0x3926a4[_0x3cdc('0x3a')]['offset']);}return _0x5b64ac[_0x3cdc('0xa3')](_0x3ec46b);}})[_0x3cdc('0x2c')](function(_0x491ae4){if(_0x491ae4){return _0x491ae4?{'count':_0x2fb065,'rows':_0x491ae4}:null;}})[_0x3cdc('0x2c')](respondWithResult(_0x4823dd,null))[_0x3cdc('0x4f')](handleError(_0x4823dd,null));};function handleQuery(_0xb07de8){logger[_0x3cdc('0xa5')](_0xb07de8);return db[_0x3cdc('0x97')][_0x3cdc('0x3a')](_0xb07de8)['spread'](function(_0x141562){csv_results[_0x3cdc('0x69')](_0x141562);})[_0x3cdc('0x4f')](function(_0x41a256){logger[_0x3cdc('0x30')](_0x41a256[_0x3cdc('0x6b')]);});} \ No newline at end of file +var _0x3240=['update','then','destroy','get','Lists','UserProfileResource','sendStatus','error','stack','name','send','map','CmList','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','user','role','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ListId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','addContacts','tags','isArray','join','push','omit','success','dataValues','errors','message','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','getContactsCsv','alias','select','from','cm_contacts','distinct','field','c.cf_','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','toString','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','Sequelize','TEXT','text','number','BOOLEAN','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','info','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save'];(function(_0x18af13,_0x1a0693){var _0x37a567=function(_0x2e42e3){while(--_0x2e42e3){_0x18af13['push'](_0x18af13['shift']());}};_0x37a567(++_0x1a0693);}(_0x3240,0x119));var _0x0324=function(_0x35ac14,_0x59bbe3){_0x35ac14=_0x35ac14-0x0;var _0x65343=_0x3240[_0x35ac14];return _0x65343;};'use strict';var emlformat=require(_0x0324('0x0'));var rimraf=require(_0x0324('0x1'));var zipdir=require(_0x0324('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0324('0x3'));var moment=require(_0x0324('0x4'));var BPromise=require(_0x0324('0x5'));var Mustache=require(_0x0324('0x6'));var util=require(_0x0324('0x7'));var path=require(_0x0324('0x8'));var sox=require('sox');var csv=require(_0x0324('0x9'));var ejs=require(_0x0324('0xa'));var fs=require('fs');var fs_extra=require(_0x0324('0xb'));var _=require(_0x0324('0xc'));var squel=require(_0x0324('0xd'));var crypto=require(_0x0324('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0324('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0324('0x10'));var Redis=require(_0x0324('0x11'));var authService=require(_0x0324('0x12'));var qs=require(_0x0324('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0324('0x14'));var utils=require(_0x0324('0x15'));var config=require(_0x0324('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0324('0x17'))['db'];var csv_results;config[_0x0324('0x18')]=_[_0x0324('0x19')](config[_0x0324('0x18')],{'host':_0x0324('0x1a'),'port':0x18eb});var socket=require(_0x0324('0x1b'))(new Redis(config[_0x0324('0x18')]));require(_0x0324('0x1c'))[_0x0324('0x1d')](socket);function respondWithStatusCode(_0x597e87,_0x5dab05){_0x5dab05=_0x5dab05||0xcc;return function(_0x1ae094){if(_0x1ae094){return _0x597e87['sendStatus'](_0x5dab05);}return _0x597e87[_0x0324('0x1e')](_0x5dab05)[_0x0324('0x1f')]();};}function respondWithResult(_0x7ac30e,_0x14571b){_0x14571b=_0x14571b||0xc8;return function(_0x4db1f7){if(_0x4db1f7){return _0x7ac30e[_0x0324('0x1e')](_0x14571b)[_0x0324('0x20')](_0x4db1f7);}};}function respondWithFilteredResult(_0x17f6a2,_0x5b59a7){return function(_0x25a966){if(_0x25a966){var _0x20d75d=typeof _0x5b59a7[_0x0324('0x21')]==='undefined'&&typeof _0x5b59a7[_0x0324('0x22')]===_0x0324('0x23');var _0x32a68f=_0x25a966['count'];var _0x8595c=_0x20d75d?0x0:_0x5b59a7[_0x0324('0x21')];var _0x56dfca=_0x20d75d?_0x25a966[_0x0324('0x24')]:_0x5b59a7[_0x0324('0x21')]+_0x5b59a7['limit'];var _0x5ef781;if(_0x56dfca>=_0x32a68f){_0x56dfca=_0x32a68f;_0x5ef781=0xc8;}else{_0x5ef781=0xce;}_0x17f6a2[_0x0324('0x1e')](_0x5ef781);return _0x17f6a2[_0x0324('0x25')](_0x0324('0x26'),_0x8595c+'-'+_0x56dfca+'/'+_0x32a68f)[_0x0324('0x20')](_0x25a966);}return null;};}function patchUpdates(_0x46f2c5){return function(_0x288d1f){try{jsonpatch['apply'](_0x288d1f,_0x46f2c5,!![]);}catch(_0x4ce4a7){return BPromise[_0x0324('0x27')](_0x4ce4a7);}return _0x288d1f[_0x0324('0x28')]();};}function saveUpdates(_0x325468,_0x168919){return function(_0x49e7aa){if(_0x49e7aa){return _0x49e7aa[_0x0324('0x29')](_0x325468)[_0x0324('0x2a')](function(_0x30c381){return _0x30c381;});}return null;};}function removeEntity(_0x7113d7,_0x128218){return function(_0x42e10c){if(_0x42e10c){return _0x42e10c[_0x0324('0x2b')]()['then'](function(){var _0x4c9531=_0x42e10c[_0x0324('0x2c')]({'plain':!![]});var _0x3707d0=_0x0324('0x2d');return db[_0x0324('0x2e')][_0x0324('0x2b')]({'where':{'type':_0x3707d0,'resourceId':_0x4c9531['id']}})['then'](function(){return _0x42e10c;});})[_0x0324('0x2a')](function(){_0x7113d7[_0x0324('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9e96fe,_0x5612f0){return function(_0xc45ee2){if(!_0xc45ee2){_0x9e96fe[_0x0324('0x2f')](0x194);}return _0xc45ee2;};}function handleError(_0x1c99d3,_0x38c85e){_0x38c85e=_0x38c85e||0x1f4;return function(_0x54c2bf){logger[_0x0324('0x30')](_0x54c2bf[_0x0324('0x31')]);if(_0x54c2bf[_0x0324('0x32')]){delete _0x54c2bf[_0x0324('0x32')];}_0x1c99d3[_0x0324('0x1e')](_0x38c85e)[_0x0324('0x33')](_0x54c2bf);};}exports['index']=function(_0x9fcd46,_0x1ecee8){var _0x4a6662={},_0x49abe4={},_0x2aaa9c={'count':0x0,'rows':[]};var _0x4f3332=_[_0x0324('0x34')](db[_0x0324('0x35')][_0x0324('0x36')],function(_0x297cbf){return{'name':_0x297cbf[_0x0324('0x37')],'type':_0x297cbf['type'][_0x0324('0x38')]};});_0x49abe4[_0x0324('0x39')]=_[_0x0324('0x34')](_0x4f3332,_0x0324('0x32'));_0x49abe4[_0x0324('0x3a')]=_[_0x0324('0x3b')](_0x9fcd46['query']);_0x49abe4[_0x0324('0x3c')]=_[_0x0324('0x3d')](_0x49abe4[_0x0324('0x39')],_0x49abe4[_0x0324('0x3a')]);_0x4a6662[_0x0324('0x3e')]=_[_0x0324('0x3d')](_0x49abe4['model'],qs['fields'](_0x9fcd46[_0x0324('0x3a')][_0x0324('0x3f')]));_0x4a6662[_0x0324('0x3e')]=_0x4a6662['attributes'][_0x0324('0x40')]?_0x4a6662['attributes']:_0x49abe4[_0x0324('0x39')];if(!_0x9fcd46['query'][_0x0324('0x41')]('nolimit')){_0x4a6662[_0x0324('0x22')]=qs[_0x0324('0x22')](_0x9fcd46[_0x0324('0x3a')][_0x0324('0x22')]);_0x4a6662[_0x0324('0x21')]=qs[_0x0324('0x21')](_0x9fcd46[_0x0324('0x3a')][_0x0324('0x21')]);}_0x4a6662[_0x0324('0x42')]=qs[_0x0324('0x43')](_0x9fcd46[_0x0324('0x3a')]['sort']);_0x4a6662[_0x0324('0x44')]=qs[_0x0324('0x3c')](_[_0x0324('0x45')](_0x9fcd46[_0x0324('0x3a')],_0x49abe4[_0x0324('0x3c')]),_0x4f3332);if(_0x9fcd46[_0x0324('0x3a')][_0x0324('0x46')]){_0x4a6662[_0x0324('0x44')]=_[_0x0324('0x47')](_0x4a6662[_0x0324('0x44')],{'$or':_[_0x0324('0x34')](_0x4f3332,function(_0x3e4d38){if(_0x3e4d38[_0x0324('0x48')]!==_0x0324('0x49')){var _0x52b4f4={};_0x52b4f4[_0x3e4d38[_0x0324('0x32')]]={'$like':'%'+_0x9fcd46[_0x0324('0x3a')]['filter']+'%'};return _0x52b4f4;}})});}_0x4a6662=_[_0x0324('0x47')]({},_0x4a6662,_0x9fcd46[_0x0324('0x4a')]);var _0x59bd20={'where':_0x4a6662[_0x0324('0x44')]};return db[_0x0324('0x35')]['count'](_0x59bd20)[_0x0324('0x2a')](function(_0xeaedd2){_0x2aaa9c[_0x0324('0x24')]=_0xeaedd2;if(_0x9fcd46[_0x0324('0x3a')][_0x0324('0x4b')]){_0x4a6662['include']=[{'all':!![]}];}return db[_0x0324('0x35')][_0x0324('0x4c')](_0x4a6662);})[_0x0324('0x2a')](function(_0x4cebb8){_0x2aaa9c[_0x0324('0x4d')]=_0x4cebb8;return _0x2aaa9c;})['then'](respondWithFilteredResult(_0x1ecee8,_0x4a6662))[_0x0324('0x4e')](handleError(_0x1ecee8,null));};exports[_0x0324('0x4f')]=function(_0x380cc4,_0x1cf34b){var _0x3a7c38={'raw':![],'where':{'id':_0x380cc4[_0x0324('0x50')]['id']}},_0x21eb4f={};_0x21eb4f[_0x0324('0x39')]=_['keys'](db[_0x0324('0x35')][_0x0324('0x36')]);_0x21eb4f[_0x0324('0x3a')]=_[_0x0324('0x3b')](_0x380cc4[_0x0324('0x3a')]);_0x21eb4f[_0x0324('0x3c')]=_[_0x0324('0x3d')](_0x21eb4f['model'],_0x21eb4f[_0x0324('0x3a')]);_0x3a7c38[_0x0324('0x3e')]=_[_0x0324('0x3d')](_0x21eb4f[_0x0324('0x39')],qs['fields'](_0x380cc4[_0x0324('0x3a')]['fields']));_0x3a7c38[_0x0324('0x3e')]=_0x3a7c38['attributes']['length']?_0x3a7c38[_0x0324('0x3e')]:_0x21eb4f[_0x0324('0x39')];if(_0x380cc4['query'][_0x0324('0x4b')]){_0x3a7c38[_0x0324('0x51')]=[{'all':!![]}];}_0x3a7c38=_[_0x0324('0x47')]({},_0x3a7c38,_0x380cc4['options']);return db['CmList'][_0x0324('0x52')](_0x3a7c38)[_0x0324('0x2a')](handleEntityNotFound(_0x1cf34b,null))['then'](respondWithResult(_0x1cf34b,null))['catch'](handleError(_0x1cf34b,null));};exports['create']=function(_0x8ed02f,_0x33758c){return db['CmList']['create'](_0x8ed02f['body'],{})[_0x0324('0x2a')](function(_0x26a84d){var _0x2cd8f7=_0x8ed02f[_0x0324('0x53')]['get']({'plain':!![]});if(!_0x2cd8f7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2cd8f7[_0x0324('0x54')]===_0x0324('0x53')){var _0x42eaf0=_0x26a84d[_0x0324('0x2c')]({'plain':!![]});var _0x4267cb='Lists';return db[_0x0324('0x55')][_0x0324('0x52')]({'where':{'name':_0x4267cb,'userProfileId':_0x2cd8f7['userProfileId']},'raw':!![]})[_0x0324('0x2a')](function(_0x209dd4){if(_0x209dd4&&_0x209dd4[_0x0324('0x56')]===0x0){return db[_0x0324('0x2e')][_0x0324('0x57')]({'name':_0x42eaf0[_0x0324('0x32')],'resourceId':_0x42eaf0['id'],'type':_0x209dd4['name'],'sectionId':_0x209dd4['id']},{})[_0x0324('0x2a')](function(){return _0x26a84d;});}else{return _0x26a84d;}})[_0x0324('0x4e')](function(_0x4bb495){logger[_0x0324('0x30')](_0x0324('0x58'),_0x4bb495);throw _0x4bb495;});}return _0x26a84d;})[_0x0324('0x2a')](respondWithResult(_0x33758c,0xc9))[_0x0324('0x4e')](handleError(_0x33758c,null));};exports[_0x0324('0x29')]=function(_0x5e15f2,_0xb7a713){if(_0x5e15f2[_0x0324('0x59')]['id']){delete _0x5e15f2[_0x0324('0x59')]['id'];}return db[_0x0324('0x35')][_0x0324('0x52')]({'where':{'id':_0x5e15f2[_0x0324('0x50')]['id']}})['then'](handleEntityNotFound(_0xb7a713,null))[_0x0324('0x2a')](saveUpdates(_0x5e15f2['body'],null))[_0x0324('0x2a')](respondWithResult(_0xb7a713,null))[_0x0324('0x4e')](handleError(_0xb7a713,null));};exports[_0x0324('0x2b')]=function(_0x827799,_0x5b5af8){return db[_0x0324('0x35')]['find']({'where':{'id':_0x827799['params']['id']}})[_0x0324('0x2a')](handleEntityNotFound(_0x5b5af8,null))[_0x0324('0x2a')](removeEntity(_0x5b5af8,null))['catch'](handleError(_0x5b5af8,null));};exports[_0x0324('0x5a')]=function(_0x14a1cd,_0x1b8aba){return db[_0x0324('0x35')][_0x0324('0x5a')]()['then'](respondWithResult(_0x1b8aba,null))[_0x0324('0x4e')](handleError(_0x1b8aba,null));};exports[_0x0324('0x5b')]=function(_0x4fe6a6,_0x197b31,_0x2210f8){if(_0x4fe6a6['body']['id']){delete _0x4fe6a6['body']['id'];}return db[_0x0324('0x35')][_0x0324('0x52')]({'where':{'id':_0x4fe6a6[_0x0324('0x50')]['id']}})[_0x0324('0x2a')](handleEntityNotFound(_0x197b31,null))[_0x0324('0x2a')](function(_0x7ceeb8){if(_0x7ceeb8){_0x4fe6a6[_0x0324('0x59')][_0x0324('0x5c')]=_0x7ceeb8['id'];return db[_0x0324('0x5d')][_0x0324('0x57')](_0x4fe6a6[_0x0324('0x59')]);}})[_0x0324('0x2a')](respondWithResult(_0x197b31,null))[_0x0324('0x4e')](handleError(_0x197b31,null));};exports[_0x0324('0x5e')]=function(_0x59a5d4,_0x654881,_0x50a191){var _0x29086c={'raw':![],'where':{}};var _0x2a5ebd={};var _0x4b2844={'count':0x0,'rows':[]};return db[_0x0324('0x35')][_0x0324('0x5f')]({'where':{'id':_0x59a5d4[_0x0324('0x50')]['id']}})[_0x0324('0x2a')](handleEntityNotFound(_0x654881,null))[_0x0324('0x2a')](function(_0x45b991){if(_0x45b991){_0x2a5ebd[_0x0324('0x39')]=_[_0x0324('0x3b')](db[_0x0324('0x5d')][_0x0324('0x36')]);_0x2a5ebd[_0x0324('0x3a')]=_[_0x0324('0x3b')](_0x59a5d4[_0x0324('0x3a')]);_0x2a5ebd['filters']=_[_0x0324('0x3d')](_0x2a5ebd[_0x0324('0x39')],_0x2a5ebd[_0x0324('0x3a')]);_0x29086c[_0x0324('0x3e')]=_['intersection'](_0x2a5ebd[_0x0324('0x39')],qs[_0x0324('0x3f')](_0x59a5d4['query'][_0x0324('0x3f')]));_0x29086c[_0x0324('0x3e')]=_0x29086c[_0x0324('0x3e')][_0x0324('0x40')]?_0x29086c[_0x0324('0x3e')]:_0x2a5ebd['model'];if(!_0x59a5d4['query'][_0x0324('0x41')](_0x0324('0x60'))){_0x29086c[_0x0324('0x22')]=qs[_0x0324('0x22')](_0x59a5d4[_0x0324('0x3a')][_0x0324('0x22')]);_0x29086c[_0x0324('0x21')]=qs[_0x0324('0x21')](_0x59a5d4[_0x0324('0x3a')]['offset']);}_0x29086c[_0x0324('0x42')]=qs['sort'](_0x59a5d4[_0x0324('0x3a')][_0x0324('0x43')]);_0x29086c[_0x0324('0x44')]=qs[_0x0324('0x3c')](_['pick'](_0x59a5d4['query'],_0x2a5ebd[_0x0324('0x3c')]));_0x29086c[_0x0324('0x44')][_0x0324('0x5c')]=_0x45b991['id'];if(_0x59a5d4[_0x0324('0x3a')][_0x0324('0x46')]){_0x29086c[_0x0324('0x44')]=_[_0x0324('0x47')](_0x29086c['where'],{'$or':_['map'](_0x29086c[_0x0324('0x3e')],function(_0x3edf65){var _0x4c49d5={};_0x4c49d5[_0x3edf65]={'$like':'%'+_0x59a5d4['query'][_0x0324('0x46')]+'%'};return _0x4c49d5;})});}_0x29086c=_[_0x0324('0x47')]({},_0x29086c,_0x59a5d4[_0x0324('0x4a')]);return db[_0x0324('0x5d')]['count']({'where':_0x29086c['where']})['then'](function(_0x2800f1){_0x4b2844[_0x0324('0x24')]=_0x2800f1;if(_0x59a5d4[_0x0324('0x3a')][_0x0324('0x4b')]){_0x29086c[_0x0324('0x51')]=[{'all':!![]}];}return db[_0x0324('0x5d')][_0x0324('0x4c')](_0x29086c);})[_0x0324('0x2a')](function(_0x489a0b){_0x4b2844[_0x0324('0x4d')]=_0x489a0b;return _0x4b2844;});}})[_0x0324('0x2a')](respondWithFilteredResult(_0x654881,_0x29086c))['catch'](handleError(_0x654881,null));};exports[_0x0324('0x61')]=function(_0x191a1e,_0x462ca9,_0x5be1da){return db[_0x0324('0x35')]['find']({'where':{'id':_0x191a1e[_0x0324('0x50')]['id']}})[_0x0324('0x2a')](handleEntityNotFound(_0x462ca9,null))['then'](function(_0x4118d7){if(_0x4118d7){return _0x4118d7[_0x0324('0x61')](_0x191a1e[_0x0324('0x3a')][_0x0324('0x62')]);}})['then'](respondWithStatusCode(_0x462ca9,null))[_0x0324('0x4e')](handleError(_0x462ca9,null));};exports[_0x0324('0x63')]=function(_0x4d1662,_0x75eea9,_0xad93ee){return db[_0x0324('0x35')]['find']({'where':{'id':_0x4d1662[_0x0324('0x50')]['id']}})[_0x0324('0x2a')](handleEntityNotFound(_0x75eea9,null))[_0x0324('0x2a')](function(_0xae085c){if(_0xae085c){var _0x10f127=[];var _0x282993={'success':[],'errors':[]};return db['CmContact'][_0x0324('0x5a')]()[_0x0324('0x2a')](function(_0x35bf1a){if(_0x4d1662['body'][_0x0324('0x64')]&&_[_0x0324('0x65')](_0x4d1662['body'][_0x0324('0x64')])){if(_0x4d1662[_0x0324('0x59')][_0x0324('0x64')]['length']){_0x4d1662[_0x0324('0x59')]['tags']=_0x4d1662[_0x0324('0x59')][_0x0324('0x64')][_0x0324('0x66')](';')+';';}else{_0x4d1662[_0x0324('0x59')][_0x0324('0x64')]=null;}}else{_0x4d1662[_0x0324('0x59')][_0x0324('0x64')]=null;}if(_0x4d1662[_0x0324('0x59')]&&_['isArray'](_0x4d1662['body'])){for(var _0x5888f0=0x0;_0x5888f0<_0x4d1662['body'][_0x0324('0x40')];_0x5888f0+=0x1){_0x4d1662[_0x0324('0x59')][_0x5888f0][_0x0324('0x5c')]=_0x4d1662['params']['id'];_0x10f127[_0x0324('0x67')](_0x4d1662[_0x0324('0x59')][_0x5888f0]);}return BPromise['each'](_0x10f127,function(_0x28717b){return db['CmContact']['create'](_[_0x0324('0x68')](_0x28717b,[_0x0324('0x62'),'id'])||{},{'fields':_[_0x0324('0x3b')](_0x35bf1a),'raw':!![]})[_0x0324('0x2a')](function(_0x7e5c0e){_0x282993[_0x0324('0x69')][_0x0324('0x67')](_0x7e5c0e[_0x0324('0x6a')]);})[_0x0324('0x4e')](function(_0x459ffb){_0x282993[_0x0324('0x6b')][_0x0324('0x67')]({'data':_0x28717b,'error':_0x459ffb[_0x0324('0x6c')]});});})['then'](function(_0x460a8c){return _0x282993;})['catch'](function(_0x171b7b){return _0x171b7b;});}else{_0x75eea9[_0x0324('0x1e')](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x75eea9,null))['catch'](handleError(_0x75eea9,null));};exports[_0x0324('0x6d')]=function(_0x1ac839,_0x1c7db8,_0x249a6d){var _0x312ccd;return db[_0x0324('0x35')][_0x0324('0x52')]({'where':{'id':_0x1ac839[_0x0324('0x50')]['id']},'include':[{'model':db[_0x0324('0x6e')],'as':_0x0324('0x6f')}]})[_0x0324('0x2a')](handleEntityNotFound(_0x1c7db8,null))[_0x0324('0x2a')](function(_0x29f7a5){if(_0x29f7a5){_0x312ccd=_0x29f7a5;return db['CmContact'][_0x0324('0x36')];}})[_0x0324('0x2a')](function(_0x236c55){if(_0x236c55){var _0x203c92={};var _0x5df832={};_0x5df832[_0x0324('0x39')]=_[_0x0324('0x70')](_[_0x0324('0x3b')](_0x236c55),_[_0x0324('0x34')](_0x312ccd[_0x0324('0x6f')],function(_0x24e449){return util[_0x0324('0x71')](_0x0324('0x72'),_0x24e449['id']);}));_0x5df832[_0x0324('0x3a')]=_[_0x0324('0x3b')](_0x1ac839[_0x0324('0x3a')]);_0x5df832[_0x0324('0x3c')]=_[_0x0324('0x3d')](_0x5df832[_0x0324('0x39')],_0x5df832[_0x0324('0x3a')]);_0x203c92[_0x0324('0x3e')]=_[_0x0324('0x3d')](_0x5df832['model'],qs[_0x0324('0x3f')](_0x1ac839['query']['fields']));_0x203c92[_0x0324('0x3e')]=_0x203c92[_0x0324('0x3e')][_0x0324('0x40')]?_0x203c92[_0x0324('0x3e')]:_0x5df832[_0x0324('0x39')];if(!_0x1ac839[_0x0324('0x3a')][_0x0324('0x41')]('nolimit')){_0x203c92[_0x0324('0x22')]=qs['limit'](_0x1ac839[_0x0324('0x3a')]['limit']);_0x203c92[_0x0324('0x21')]=qs[_0x0324('0x21')](_0x1ac839[_0x0324('0x3a')][_0x0324('0x21')]);}_0x203c92[_0x0324('0x42')]=qs[_0x0324('0x43')](_0x1ac839['query'][_0x0324('0x43')]);_0x203c92['where']=qs[_0x0324('0x3c')](_['pick'](_0x1ac839['query'],_0x5df832['filters']));_0x203c92['raw']=!![];if(_0x1ac839['query'][_0x0324('0x46')]){_0x203c92[_0x0324('0x44')]=_[_0x0324('0x47')](_0x203c92[_0x0324('0x44')],{'$or':_[_0x0324('0x34')](_0x203c92['attributes'],function(_0x528550){var _0x1b543d={};_0x1b543d[_0x528550]={'$like':'%'+_0x1ac839[_0x0324('0x3a')][_0x0324('0x46')]+'%'};return _0x1b543d;})});}_0x203c92=_[_0x0324('0x47')]({},_0x203c92,_0x1ac839[_0x0324('0x4a')]);return _0x312ccd[_0x0324('0x6d')](_0x203c92);}})['then'](respondWithResult(_0x1c7db8,null))[_0x0324('0x4e')](handleError(_0x1c7db8,null));};exports[_0x0324('0x73')]=function(_0x32edd9,_0x312f77,_0x21f843){var _0x23e243;var _0x5910ed;var _0x424d4d;var _0x3c908e=_0x32edd9[_0x0324('0x50')]['id'];csv_results=[];return db['ContactItemType'][_0x0324('0x4c')]({'attributes':['id',_0x0324('0x32')],'raw':!![],'order':['OrderBy']})['then'](function(_0x120ac8){_0x23e243=_0x120ac8;var _0x47f02c=_[_0x0324('0x3b')](db['CmContact']['rawAttributes']);return db[_0x0324('0x6e')][_0x0324('0x4c')]({'raw':!![],'attributes':['id',_0x0324('0x74')]})[_0x0324('0x2a')](function(_0x58bec1){_0x5910ed=_0x58bec1;var _0x10ccb5=squel[_0x0324('0x75')]()[_0x0324('0x3f')](_0x47f02c)[_0x0324('0x76')](_0x0324('0x77'),'c')[_0x0324('0x44')]('c.ListId\x20=\x20?',_0x3c908e)['where']('c.deletedAt\x20is\x20null')[_0x0324('0x78')]();for(var _0x41e4cd=0x0;_0x41e4cd<_0x5910ed[_0x0324('0x40')];_0x41e4cd++){_0x10ccb5[_0x0324('0x79')](_0x0324('0x7a')+_0x5910ed[_0x41e4cd]['id'],'customField_'+_0x5910ed[_0x41e4cd][_0x0324('0x74')]);}for(var _0x41e4cd=0x0;_0x41e4cd<_0x23e243['length'];_0x41e4cd++){_0x10ccb5[_0x0324('0x79')](squel[_0x0324('0x75')]()[_0x0324('0x79')]('item')[_0x0324('0x76')](_0x0324('0x7b'))[_0x0324('0x44')](_0x0324('0x7c'),_0x23e243[_0x41e4cd]['id'])[_0x0324('0x44')](_0x0324('0x7d')),_0x0324('0x7e')+_0x23e243[_0x41e4cd][_0x0324('0x32')]);_0x10ccb5[_0x0324('0x79')](squel[_0x0324('0x75')]()[_0x0324('0x79')](_0x0324('0x7f'))[_0x0324('0x76')](_0x0324('0x7b'))[_0x0324('0x44')](_0x0324('0x7c'),_0x23e243[_0x41e4cd]['id'])['where']('CmContactId\x20=\x20c.id'),'description_additionalPhone_'+_0x23e243[_0x41e4cd][_0x0324('0x32')]);}var _0x110a58=[];_0x110a58[_0x0324('0x67')](_0x10ccb5[_0x0324('0x80')]());BPromise['each'](_0x110a58,handleQuery)[_0x0324('0x2a')](function(_0x43d96a){handleQuery(_0x10ccb5[_0x0324('0x80')]());var _0x39260b=csv_results[0x0];if(!_['isEmpty'](_0x39260b)){var _0x10f00d=toCsv(_0x39260b);var _0x23d3fb=Date['now']();fs[_0x0324('0x81')](util[_0x0324('0x71')]('/tmp/list_%d_%s.csv',_0x3c908e,_0x23d3fb),_0x10f00d);_0x312f77[_0x0324('0x82')](_0x0324('0x83'),_0x0324('0x84')+util[_0x0324('0x71')](_0x0324('0x85'),_0x3c908e,_0x23d3fb));_0x312f77[_0x0324('0x82')](_0x0324('0x86'),_0x0324('0x87'));return _0x312f77[_0x0324('0x88')](util['format'](_0x0324('0x89'),_0x3c908e,_0x23d3fb));}else{return _0x312f77[_0x0324('0x2f')](0xcc);}});});});};exports[_0x0324('0x8a')]=function(_0x485a1c,_0x286245,_0x118a52){var _0x384f4e;delete _0x485a1c['body']['id'];return db[_0x0324('0x35')][_0x0324('0x5f')]({'where':{'id':_0x485a1c[_0x0324('0x50')]['id']}})[_0x0324('0x2a')](handleEntityNotFound(_0x286245,null))[_0x0324('0x2a')](function(_0x21b234){if(_0x21b234){return db[_0x0324('0x8b')][_0x0324('0x8c')](function(_0xefdeac){return db[_0x0324('0x6e')]['create'](_0x485a1c[_0x0324('0x59')],{'transaction':_0xefdeac})['then'](function(_0x1c0db5){_0x384f4e=_0x1c0db5;return _0x21b234['addCustomFields'](_0x1c0db5,{'transaction':_0xefdeac});})[_0x0324('0x2a')](function(){var _0x53cb08={'type':db[_0x0324('0x8d')][_0x0324('0x8e')],'transaction':_0xefdeac};switch(_0x485a1c[_0x0324('0x59')][_0x0324('0x48')]){case _0x0324('0x8f'):_0x53cb08[_0x0324('0x48')]=db[_0x0324('0x8d')]['TEXT'];break;case _0x0324('0x90'):_0x53cb08[_0x0324('0x48')]=db[_0x0324('0x8d')]['INTEGER'];break;case'switch':_0x53cb08[_0x0324('0x48')]=db[_0x0324('0x8d')][_0x0324('0x91')];_0x53cb08['defaultValue']=![];break;default:}return db[_0x0324('0x8b')][_0x0324('0x92')][_0x0324('0x93')]('cm_contacts',util[_0x0324('0x71')](_0x0324('0x94'),_0x384f4e['id']),_0x53cb08);})['then'](function(){return _0x384f4e;});});}})['then'](respondWithResult(_0x286245,null))['catch'](handleError(_0x286245,null));};exports[_0x0324('0x95')]=function(_0x1036d4,_0x5dcbf1,_0x5cf044){var _0x223f18={};var _0x135393={};var _0x3dcd99;var _0xc63dbf;return db[_0x0324('0x35')][_0x0324('0x5f')]({'where':{'id':_0x1036d4[_0x0324('0x50')]['id']}})['then'](handleEntityNotFound(_0x5dcbf1,null))['then'](function(_0x4359e1){if(_0x4359e1){_0x3dcd99=_0x4359e1;_0x135393[_0x0324('0x39')]=_[_0x0324('0x3b')](db['CmCustomField'][_0x0324('0x36')]);_0x135393[_0x0324('0x3a')]=_[_0x0324('0x3b')](_0x1036d4[_0x0324('0x3a')]);_0x135393[_0x0324('0x3c')]=_[_0x0324('0x3d')](_0x135393[_0x0324('0x39')],_0x135393['query']);_0x223f18[_0x0324('0x3e')]=_[_0x0324('0x3d')](_0x135393[_0x0324('0x39')],qs['fields'](_0x1036d4['query'][_0x0324('0x3f')]));_0x223f18[_0x0324('0x3e')]=_0x223f18['attributes'][_0x0324('0x40')]?_0x223f18[_0x0324('0x3e')]:_0x135393[_0x0324('0x39')];_0x223f18[_0x0324('0x42')]=qs[_0x0324('0x43')](_0x1036d4[_0x0324('0x3a')][_0x0324('0x43')]);_0x223f18[_0x0324('0x44')]=qs[_0x0324('0x3c')](_[_0x0324('0x45')](_0x1036d4[_0x0324('0x3a')],_0x135393['filters']));_0x223f18[_0x0324('0x44')]=_[_0x0324('0x47')](_0x223f18[_0x0324('0x44')],{'$or':[{'ListId':_0x4359e1['id']},{'ListId':null}]});if(_0x1036d4[_0x0324('0x3a')][_0x0324('0x46')]){_0x223f18[_0x0324('0x44')]=_[_0x0324('0x47')](_0x223f18[_0x0324('0x44')],{'$or':_['map'](_0x223f18['attributes'],function(_0x41b9c7){var _0x3a6f8c={};_0x3a6f8c[_0x41b9c7]={'$like':'%'+_0x1036d4['query'][_0x0324('0x46')]+'%'};return _0x3a6f8c;})});}_0x223f18=_[_0x0324('0x47')]({},_0x223f18,_0x1036d4[_0x0324('0x4a')]);return db[_0x0324('0x6e')][_0x0324('0x96')](_0x223f18);}})[_0x0324('0x2a')](respondWithResult(_0x5dcbf1,null))[_0x0324('0x4e')](handleError(_0x5dcbf1,null));};exports[_0x0324('0x97')]=function(_0x4826f0,_0x1e8662){return db['CmCustomField']['findAndCountAll']({'where':{'ListId':null}})[_0x0324('0x2a')](handleEntityNotFound(_0x1e8662,null))[_0x0324('0x2a')](function(_0x354f00){return _0x354f00;})[_0x0324('0x2a')](respondWithResult(_0x1e8662,null))[_0x0324('0x4e')](handleError(_0x1e8662,null));};exports['addAgents']=function(_0x4db739,_0x182a15,_0x29b182){return db['CmList']['find']({'where':{'id':_0x4db739[_0x0324('0x50')]['id']}})[_0x0324('0x2a')](handleEntityNotFound(_0x182a15,null))[_0x0324('0x2a')](function(_0x582732){if(_0x582732){return _0x582732[_0x0324('0x98')](_0x4db739[_0x0324('0x59')]['ids'],_[_0x0324('0x68')](_0x4db739[_0x0324('0x59')],[_0x0324('0x62'),'id'])||{})[_0x0324('0x99')](function(_0x36607f){for(var _0x22d044=0x0;_0x22d044<_0x4db739['body'][_0x0324('0x62')][_0x0324('0x40')];_0x22d044+=0x1){socket['emit'](_0x0324('0x9a'),{'UserId':Number(_0x4db739[_0x0324('0x59')][_0x0324('0x62')][_0x22d044]),'CmListId':Number(_0x4db739[_0x0324('0x50')]['id'])});}return _0x36607f;});}})[_0x0324('0x2a')](respondWithResult(_0x182a15,null))[_0x0324('0x4e')](handleError(_0x182a15,null));};exports[_0x0324('0x9b')]=function(_0x35d608,_0x1866c4,_0x3ccad7){return db[_0x0324('0x35')][_0x0324('0x52')]({'where':{'id':_0x35d608['params']['id']}})[_0x0324('0x2a')](handleEntityNotFound(_0x1866c4,null))[_0x0324('0x2a')](function(_0x1a64dc){if(_0x1a64dc){return _0x1a64dc[_0x0324('0x9b')](_0x35d608[_0x0324('0x3a')]['ids'])[_0x0324('0x2a')](function(){if(_['isArray'](_0x35d608[_0x0324('0x3a')][_0x0324('0x62')])){for(var _0x430376=0x0;_0x430376<_0x35d608[_0x0324('0x3a')][_0x0324('0x62')]['length'];_0x430376+=0x1){socket[_0x0324('0x9c')]('userCmList:remove',{'UserId':Number(_0x35d608['query'][_0x0324('0x62')][_0x430376]),'CmListId':Number(_0x35d608[_0x0324('0x50')]['id'])});}}else{socket[_0x0324('0x9c')](_0x0324('0x9d'),{'UserId':Number(_0x35d608['query']['ids']),'CmListId':Number(_0x35d608[_0x0324('0x50')]['id'])});}});}})[_0x0324('0x2a')](respondWithStatusCode(_0x1866c4,null))[_0x0324('0x4e')](handleError(_0x1866c4,null));};exports[_0x0324('0x9e')]=function(_0xce1ae9,_0x3e2d1b,_0xef48a9){var _0x43ed13={};var _0x59d88c={};var _0x4612cd;var _0x521c24;return db[_0x0324('0x35')][_0x0324('0x5f')]({'where':{'id':_0xce1ae9[_0x0324('0x50')]['id']}})[_0x0324('0x2a')](handleEntityNotFound(_0x3e2d1b,null))['then'](function(_0x57becd){if(_0x57becd){_0x4612cd=_0x57becd;_0x59d88c[_0x0324('0x39')]=_['keys'](db[_0x0324('0x9f')][_0x0324('0x36')]);_0x59d88c[_0x0324('0x3a')]=_['keys'](_0xce1ae9[_0x0324('0x3a')]);_0x59d88c[_0x0324('0x3c')]=_[_0x0324('0x3d')](_0x59d88c[_0x0324('0x39')],_0x59d88c[_0x0324('0x3a')]);_0x43ed13[_0x0324('0x3e')]=_['intersection'](_0x59d88c[_0x0324('0x39')],qs['fields'](_0xce1ae9[_0x0324('0x3a')][_0x0324('0x3f')]));_0x43ed13[_0x0324('0x3e')]=_0x43ed13[_0x0324('0x3e')]['length']?_0x43ed13['attributes']:_0x59d88c[_0x0324('0x39')];_0x43ed13[_0x0324('0x42')]=qs[_0x0324('0x43')](_0xce1ae9[_0x0324('0x3a')]['sort']);_0x43ed13['where']=qs[_0x0324('0x3c')](_[_0x0324('0x45')](_0xce1ae9[_0x0324('0x3a')],_0x59d88c['filters']));if(_0xce1ae9[_0x0324('0x3a')][_0x0324('0x46')]){_0x43ed13[_0x0324('0x44')]=_['merge'](_0x43ed13[_0x0324('0x44')],{'$or':_[_0x0324('0x34')](_0x43ed13[_0x0324('0x3e')],function(_0x5c8f77){var _0x5c7fac={};_0x5c7fac[_0x5c8f77]={'$like':'%'+_0xce1ae9[_0x0324('0x3a')][_0x0324('0x46')]+'%'};return _0x5c7fac;})});}_0x43ed13=_[_0x0324('0x47')]({},_0x43ed13,_0xce1ae9[_0x0324('0x4a')]);return _0x4612cd[_0x0324('0x9e')](_0x43ed13);}})['then'](function(_0x7e6292){if(_0x7e6292){_0x521c24=_0x7e6292['length'];if(!_0xce1ae9[_0x0324('0x3a')][_0x0324('0x41')](_0x0324('0x60'))){_0x43ed13['limit']=qs[_0x0324('0x22')](_0xce1ae9[_0x0324('0x3a')][_0x0324('0x22')]);_0x43ed13['offset']=qs[_0x0324('0x21')](_0xce1ae9[_0x0324('0x3a')][_0x0324('0x21')]);}return _0x4612cd[_0x0324('0x9e')](_0x43ed13);}})[_0x0324('0x2a')](function(_0x132f34){if(_0x132f34){return _0x132f34?{'count':_0x521c24,'rows':_0x132f34}:null;}})[_0x0324('0x2a')](respondWithResult(_0x3e2d1b,null))[_0x0324('0x4e')](handleError(_0x3e2d1b,null));};function handleQuery(_0x29cdbf){logger[_0x0324('0xa0')](_0x29cdbf);return db[_0x0324('0x8b')]['query'](_0x29cdbf)[_0x0324('0x99')](function(_0x424132){csv_results[_0x0324('0x67')](_0x424132);})[_0x0324('0x4e')](function(_0x4fe48c){logger[_0x0324('0x30')](_0x4fe48c[_0x0324('0x6c')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 394ba3c..d287c1a 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(_0x17f339,_0x1c4422){var _0x529dc2=function(_0x3ff2fd){while(--_0x3ff2fd){_0x17f339['push'](_0x17f339['shift']());}};_0x529dc2(++_0x1c4422);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe14b,0x93));var _0xbe14=function(_0x1464d8,_0x49a7a6){_0x1464d8=_0x1464d8-0x0;var _0x4913f1=_0xe14b[_0x1464d8];return _0x4913f1;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 7ef2beb..78e5ac1 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 _0xe5b5=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash'];(function(_0x56c490,_0x488303){var _0x2c3bf9=function(_0xd8a18f){while(--_0xd8a18f){_0x56c490['push'](_0x56c490['shift']());}};_0x2c3bf9(++_0x488303);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x466247,_0x5d69e3){_0x466247=_0x466247-0x0;var _0x4b352e=_0xe5b5[_0x466247];return _0x4b352e;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var logger=require(_0x5e5b('0x2'))(_0x5e5b('0x3'));var moment=require(_0x5e5b('0x4'));var BPromise=require(_0x5e5b('0x5'));var rp=require(_0x5e5b('0x6'));var fs=require('fs');var path=require(_0x5e5b('0x7'));var rimraf=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var attributes=require(_0x5e5b('0xa'));module[_0x5e5b('0xb')]=function(_0xf1fbe2,_0x11e0e0){return _0xf1fbe2[_0x5e5b('0xc')](_0x5e5b('0xd'),attributes,{'tableName':_0x5e5b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ea3=['CmList','cm_lists','lodash','util','../../config/logger','api','bluebird','path','./cmList.attributes','exports','define'];(function(_0x54defc,_0x627178){var _0x1955d3=function(_0x299afe){while(--_0x299afe){_0x54defc['push'](_0x54defc['shift']());}};_0x1955d3(++_0x627178);}(_0x4ea3,0x70));var _0x34ea=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4ea3[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var logger=require(_0x34ea('0x2'))(_0x34ea('0x3'));var moment=require('moment');var BPromise=require(_0x34ea('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34ea('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x34ea('0x6'));module[_0x34ea('0x7')]=function(_0x962596,_0x123d48){return _0x962596[_0x34ea('0x8')](_0x34ea('0x9'),attributes,{'tableName':_0x34ea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index ce7ea3f..93a68a9 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 _0x73d5=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x6dc268,_0x1a7327){var _0x41c1cb=function(_0x43aab9){while(--_0x43aab9){_0x6dc268['push'](_0x6dc268['shift']());}};_0x41c1cb(++_0x1a7327);}(_0x73d5,0x106));var _0x573d=function(_0x3b7e6f,_0x1565b5){_0x3b7e6f=_0x3b7e6f-0x0;var _0x4873c3=_0x73d5[_0x3b7e6f];return _0x4873c3;};'use strict';var _=require(_0x573d('0x0'));var util=require(_0x573d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x573d('0x2'));var fs=require('fs');var Redis=require(_0x573d('0x3'));var db=require(_0x573d('0x4'))['db'];var utils=require(_0x573d('0x5'));var logger=require(_0x573d('0x6'))(_0x573d('0x7'));var config=require(_0x573d('0x8'));var jayson=require(_0x573d('0x9'));var client=jayson[_0x573d('0xa')][_0x573d('0xb')]({'port':0x232a});config[_0x573d('0xc')]=_[_0x573d('0xd')](config[_0x573d('0xc')],{'host':_0x573d('0xe'),'port':0x18eb});var socket=require(_0x573d('0xf'))(new Redis(config['redis']));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x4a54c4,_0x3c524f,_0x5342aa){return new BPromise(function(_0x507dfe,_0x43dbf9){return client[_0x573d('0x10')](_0x4a54c4,_0x5342aa)[_0x573d('0x11')](function(_0x200f56){logger[_0x573d('0x12')](_0x573d('0x13'),_0x3c524f,_0x573d('0x14'));logger[_0x573d('0x15')]('CmList,\x20%s,\x20%s,\x20%s',_0x3c524f,_0x573d('0x14'),JSON['stringify'](_0x200f56));if(_0x200f56['error']){if(_0x200f56[_0x573d('0x16')][_0x573d('0x17')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x3c524f,_0x200f56['error'][_0x573d('0x18')]);return _0x43dbf9(_0x200f56[_0x573d('0x16')][_0x573d('0x18')]);}logger[_0x573d('0x16')]('CmList,\x20%s,\x20%s',_0x3c524f,_0x200f56[_0x573d('0x16')][_0x573d('0x18')]);return _0x507dfe(_0x200f56[_0x573d('0x16')][_0x573d('0x18')]);}else{logger[_0x573d('0x12')]('CmList,\x20%s,\x20%s',_0x3c524f,_0x573d('0x14'));_0x507dfe(_0x200f56[_0x573d('0x19')][_0x573d('0x18')]);}})[_0x573d('0x1a')](function(_0xa89950){logger[_0x573d('0x16')]('CmList,\x20%s,\x20%s',_0x3c524f,_0xa89950);_0x43dbf9(_0xa89950);});});} \ No newline at end of file +var _0x7311=['defaults','localhost','socket.io-emitter','register','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x56e004,_0x1d9ee2){var _0x1e3fc2=function(_0x209284){while(--_0x209284){_0x56e004['push'](_0x56e004['shift']());}};_0x1e3fc2(++_0x1d9ee2);}(_0x7311,0x71));var _0x1731=function(_0x467b23,_0x35e52f){_0x467b23=_0x467b23-0x0;var _0x18f4f9=_0x7311[_0x467b23];return _0x18f4f9;};'use strict';var _=require('lodash');var util=require(_0x1731('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1731('0x1'));var fs=require('fs');var Redis=require(_0x1731('0x2'));var db=require(_0x1731('0x3'))['db'];var utils=require(_0x1731('0x4'));var logger=require(_0x1731('0x5'))(_0x1731('0x6'));var config=require(_0x1731('0x7'));var jayson=require(_0x1731('0x8'));var client=jayson[_0x1731('0x9')][_0x1731('0xa')]({'port':0x232a});config[_0x1731('0xb')]=_[_0x1731('0xc')](config[_0x1731('0xb')],{'host':_0x1731('0xd'),'port':0x18eb});var socket=require(_0x1731('0xe'))(new Redis(config[_0x1731('0xb')]));require('./cmList.socket')[_0x1731('0xf')](socket);function respondWithRpcPromise(_0x195a1f,_0x3e5a41,_0x5c98ad){return new BPromise(function(_0xe8f395,_0x2f96bf){return client['request'](_0x195a1f,_0x5c98ad)['then'](function(_0x121600){logger[_0x1731('0x10')](_0x1731('0x11'),_0x3e5a41,_0x1731('0x12'));logger[_0x1731('0x13')](_0x1731('0x14'),_0x3e5a41,'request\x20sent',JSON['stringify'](_0x121600));if(_0x121600[_0x1731('0x15')]){if(_0x121600[_0x1731('0x15')][_0x1731('0x16')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x3e5a41,_0x121600[_0x1731('0x15')][_0x1731('0x17')]);return _0x2f96bf(_0x121600['error'][_0x1731('0x17')]);}logger['error'](_0x1731('0x11'),_0x3e5a41,_0x121600[_0x1731('0x15')][_0x1731('0x17')]);return _0xe8f395(_0x121600[_0x1731('0x15')][_0x1731('0x17')]);}else{logger['info'](_0x1731('0x11'),_0x3e5a41,_0x1731('0x12'));_0xe8f395(_0x121600['result']['message']);}})[_0x1731('0x18')](function(_0x25e001){logger['error'](_0x1731('0x11'),_0x3e5a41,_0x25e001);_0x2f96bf(_0x25e001);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 5498598..3c301e7 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 _0x8cec=['removeListener','cmList:','./cmList.events','save','remove','update','emit'];(function(_0x2fa9ef,_0x11eb49){var _0x40a7db=function(_0x387c7c){while(--_0x387c7c){_0x2fa9ef['push'](_0x2fa9ef['shift']());}};_0x40a7db(++_0x11eb49);}(_0x8cec,0x1f3));var _0xc8ce=function(_0x3f577f,_0x20a9bd){_0x3f577f=_0x3f577f-0x0;var _0x392a7a=_0x8cec[_0x3f577f];return _0x392a7a;};'use strict';var CmListEvents=require(_0xc8ce('0x0'));var events=[_0xc8ce('0x1'),_0xc8ce('0x2'),_0xc8ce('0x3')];function createListener(_0xfc1cdf,_0x3c8fec){return function(_0x430869){_0x3c8fec[_0xc8ce('0x4')](_0xfc1cdf,_0x430869);};}function removeListener(_0x3b0767,_0x181370){return function(){CmListEvents[_0xc8ce('0x5')](_0x3b0767,_0x181370);};}exports['register']=function(_0x868d35){for(var _0x14d084=0x0,_0x4bac6b=events['length'];_0x14d084<_0x4bac6b;_0x14d084++){var _0x3ec7b1=events[_0x14d084];var _0x23974f=createListener(_0xc8ce('0x6')+_0x3ec7b1,_0x868d35);CmListEvents['on'](_0x3ec7b1,_0x23974f);}}; \ No newline at end of file +var _0x4124=['./cmList.events','remove','update','emit','removeListener','register','length','cmList:'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x4124,0x128));var _0x4412=function(_0x1c1bdd,_0x4f8d96){_0x1c1bdd=_0x1c1bdd-0x0;var _0x290665=_0x4124[_0x1c1bdd];return _0x290665;};'use strict';var CmListEvents=require(_0x4412('0x0'));var events=['save',_0x4412('0x1'),_0x4412('0x2')];function createListener(_0x50bddf,_0x56ca89){return function(_0x2180db){_0x56ca89[_0x4412('0x3')](_0x50bddf,_0x2180db);};}function removeListener(_0x5876e3,_0x57fc4c){return function(){CmListEvents[_0x4412('0x4')](_0x5876e3,_0x57fc4c);};}exports[_0x4412('0x5')]=function(_0x315c4a){for(var _0x5efbec=0x0,_0x2725d8=events[_0x4412('0x6')];_0x5efbec<_0x2725d8;_0x5efbec++){var _0x5ea94f=events[_0x5efbec];var _0x487e7b=createListener(_0x4412('0x7')+_0x5ea94f,_0x315c4a);CmListEvents['on'](_0x5ea94f,_0x487e7b);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 9671d8e..c7890e9 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 _0x3d56=['show','getDispositions','/:id/contacts','getContacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','/:id/dispositions','addContacts','addAgents','put','delete','destroy','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/auth/service','./cmList.controller','get','/describe','isAuthenticated','describe','/global_fields','/:id'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x3d56,0xd3));var _0x63d5=function(_0x5d3b11,_0x4c3b8d){_0x5d3b11=_0x5d3b11-0x0;var _0x29806f=_0x3d56[_0x5d3b11];return _0x29806f;};'use strict';var multer=require(_0x63d5('0x0'));var util=require('util');var path=require(_0x63d5('0x1'));var timeout=require('connect-timeout');var express=require(_0x63d5('0x2'));var router=express[_0x63d5('0x3')]();var fs_extra=require(_0x63d5('0x4'));var auth=require(_0x63d5('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x63d5('0x6'));router[_0x63d5('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x63d5('0x7')](_0x63d5('0x8'),auth[_0x63d5('0x9')](),controller[_0x63d5('0xa')]);router[_0x63d5('0x7')](_0x63d5('0xb'),auth['isAuthenticated'](),controller['getGlobalCustomFields']);router[_0x63d5('0x7')](_0x63d5('0xc'),auth[_0x63d5('0x9')](),controller[_0x63d5('0xd')]);router['get']('/:id/dispositions',auth[_0x63d5('0x9')](),controller[_0x63d5('0xe')]);router[_0x63d5('0x7')](_0x63d5('0xf'),auth[_0x63d5('0x9')](),controller[_0x63d5('0x10')]);router['get']('/:id/contacts/csv',auth[_0x63d5('0x9')](),controller[_0x63d5('0x11')]);router['get'](_0x63d5('0x12'),auth[_0x63d5('0x9')](),controller[_0x63d5('0x13')]);router[_0x63d5('0x7')](_0x63d5('0x14'),auth['isAuthenticated'](),controller[_0x63d5('0x15')]);router[_0x63d5('0x16')]('/',auth['isAuthenticated'](),controller[_0x63d5('0x17')]);router[_0x63d5('0x16')](_0x63d5('0x18'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x63d5('0x16')](_0x63d5('0xf'),auth[_0x63d5('0x9')](),controller[_0x63d5('0x19')]);router['post'](_0x63d5('0x12'),auth[_0x63d5('0x9')](),controller['addCustomField']);router[_0x63d5('0x16')](_0x63d5('0x14'),auth[_0x63d5('0x9')](),controller[_0x63d5('0x1a')]);router[_0x63d5('0x1b')](_0x63d5('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x63d5('0x1c')](_0x63d5('0xc'),auth['isAuthenticated'](),controller[_0x63d5('0x1d')]);router[_0x63d5('0x1c')]('/:id/dispositions',auth[_0x63d5('0x9')](),controller['removeDispositions']);router['delete'](_0x63d5('0x14'),auth[_0x63d5('0x9')](),controller[_0x63d5('0x1e')]);module[_0x63d5('0x1f')]=router; \ No newline at end of file +var _0xc404=['addDisposition','addContacts','addCustomField','put','update','destroy','delete','removeDispositions','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','index','/describe','isAuthenticated','describe','/global_fields','/:id','show','/:id/dispositions','/:id/contacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create'];(function(_0x90f34f,_0x404021){var _0x4b18cf=function(_0x25112d){while(--_0x25112d){_0x90f34f['push'](_0x90f34f['shift']());}};_0x4b18cf(++_0x404021);}(_0xc404,0xe2));var _0x4c40=function(_0x189a2f,_0x363a90){_0x189a2f=_0x189a2f-0x0;var _0x406106=_0xc404[_0x189a2f];return _0x406106;};'use strict';var multer=require(_0x4c40('0x0'));var util=require(_0x4c40('0x1'));var path=require(_0x4c40('0x2'));var timeout=require('connect-timeout');var express=require(_0x4c40('0x3'));var router=express[_0x4c40('0x4')]();var fs_extra=require(_0x4c40('0x5'));var auth=require(_0x4c40('0x6'));var interaction=require(_0x4c40('0x7'));var config=require('../../config/environment');var controller=require(_0x4c40('0x8'));router[_0x4c40('0x9')]('/',auth['isAuthenticated'](),controller[_0x4c40('0xa')]);router['get'](_0x4c40('0xb'),auth[_0x4c40('0xc')](),controller[_0x4c40('0xd')]);router['get'](_0x4c40('0xe'),auth[_0x4c40('0xc')](),controller['getGlobalCustomFields']);router[_0x4c40('0x9')](_0x4c40('0xf'),auth[_0x4c40('0xc')](),controller[_0x4c40('0x10')]);router['get'](_0x4c40('0x11'),auth[_0x4c40('0xc')](),controller['getDispositions']);router[_0x4c40('0x9')](_0x4c40('0x12'),auth[_0x4c40('0xc')](),controller['getContacts']);router[_0x4c40('0x9')](_0x4c40('0x13'),auth[_0x4c40('0xc')](),controller['getContactsCsv']);router['get'](_0x4c40('0x14'),auth[_0x4c40('0xc')](),controller[_0x4c40('0x15')]);router[_0x4c40('0x9')](_0x4c40('0x16'),auth[_0x4c40('0xc')](),controller[_0x4c40('0x17')]);router[_0x4c40('0x18')]('/',auth['isAuthenticated'](),controller[_0x4c40('0x19')]);router[_0x4c40('0x18')]('/:id/dispositions',auth[_0x4c40('0xc')](),controller[_0x4c40('0x1a')]);router[_0x4c40('0x18')](_0x4c40('0x12'),auth[_0x4c40('0xc')](),controller[_0x4c40('0x1b')]);router[_0x4c40('0x18')](_0x4c40('0x14'),auth[_0x4c40('0xc')](),controller[_0x4c40('0x1c')]);router[_0x4c40('0x18')](_0x4c40('0x16'),auth[_0x4c40('0xc')](),controller['addAgents']);router[_0x4c40('0x1d')](_0x4c40('0xf'),auth[_0x4c40('0xc')](),controller[_0x4c40('0x1e')]);router['delete'](_0x4c40('0xf'),auth['isAuthenticated'](),controller[_0x4c40('0x1f')]);router[_0x4c40('0x20')]('/:id/dispositions',auth[_0x4c40('0xc')](),controller[_0x4c40('0x21')]);router[_0x4c40('0x20')](_0x4c40('0x16'),auth[_0x4c40('0xc')](),controller[_0x4c40('0x22')]);module[_0x4c40('0x23')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 4ba9377..fb2dced 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 _0x3316=['sequelize','exports','getDataValue','field','STRING'];(function(_0x44640e,_0x34b18c){var _0x407f98=function(_0x3a7120){while(--_0x3a7120){_0x44640e['push'](_0x44640e['shift']());}};_0x407f98(++_0x34b18c);}(_0x3316,0x87));var _0x6331=function(_0x2f1753,_0x458f6d){_0x2f1753=_0x2f1753-0x0;var _0x56a164=_0x3316[_0x2f1753];return _0x56a164;};'use strict';var Sequelize=require(_0x6331('0x0'));module[_0x6331('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3d40d2){return this[_0x6331('0x2')](_0x6331('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x6331('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x6331('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x8208=['getDataValue','STRING','exports','VIRTUAL'];(function(_0x525182,_0x4ab63f){var _0x169b5c=function(_0x23d4cf){while(--_0x23d4cf){_0x525182['push'](_0x525182['shift']());}};_0x169b5c(++_0x4ab63f);}(_0x8208,0xa6));var _0x8820=function(_0x244e9f,_0x4ef83c){_0x244e9f=_0x244e9f-0x0;var _0x1d6825=_0x8208[_0x244e9f];return _0x1d6825;};'use strict';var Sequelize=require('sequelize');module[_0x8820('0x0')]={'name':{'type':Sequelize[_0x8820('0x1')],'get':function(_0x18abbd){return this[_0x8820('0x2')]('field');}},'field':{'type':Sequelize[_0x8820('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x8820('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x8820('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 60cddef..889ae7f 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x43e5d7,_0x3f9c5a){var _0x5ee31f=function(_0x106fb8){while(--_0x106fb8){_0x43e5d7['push'](_0x43e5d7['shift']());}};_0x5ee31f(++_0x3f9c5a);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x1718bd,_0x2be6a0){var _0x35ebe7=function(_0x2aea0f){while(--_0x2aea0f){_0x1718bd['push'](_0x1718bd['shift']());}};_0x35ebe7(++_0x2be6a0);}(_0x7a54,0x106));var _0x47a5=function(_0x280817,_0xc76a63){_0x280817=_0x280817-0x0;var _0x3a8811=_0x7a54[_0x280817];return _0x3a8811;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 14ba11b..84d02c2 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 _0x81e5=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','tools_conditions'];(function(_0xaf025d,_0x586d7a){var _0x1c77cb=function(_0x560b3a){while(--_0x560b3a){_0xaf025d['push'](_0xaf025d['shift']());}};_0x1c77cb(++_0x586d7a);}(_0x81e5,0x14a));var _0x581e=function(_0x2b030e,_0xa9f078){_0x2b030e=_0x2b030e-0x0;var _0x130723=_0x81e5[_0x2b030e];return _0x130723;};'use strict';var _=require('lodash');var util=require(_0x581e('0x0'));var logger=require(_0x581e('0x1'))('api');var moment=require(_0x581e('0x2'));var BPromise=require(_0x581e('0x3'));var rp=require(_0x581e('0x4'));var fs=require('fs');var path=require(_0x581e('0x5'));var rimraf=require(_0x581e('0x6'));var config=require(_0x581e('0x7'));var attributes=require(_0x581e('0x8'));module[_0x581e('0x9')]=function(_0x12e807,_0x21eae7){return _0x12e807['define']('Condition',attributes,{'tableName':_0x581e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x18fc=['exports','tools_conditions','lodash','util','../../config/logger','moment','bluebird','rimraf','./condition.attributes'];(function(_0x1a010f,_0x1fca92){var _0xa53730=function(_0x1270d1){while(--_0x1270d1){_0x1a010f['push'](_0x1a010f['shift']());}};_0xa53730(++_0x1fca92);}(_0x18fc,0x9b));var _0xc18f=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x18fc[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0xc18f('0x0'));var util=require(_0xc18f('0x1'));var logger=require(_0xc18f('0x2'))('api');var moment=require(_0xc18f('0x3'));var BPromise=require(_0xc18f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc18f('0x5'));var config=require('../../config/environment');var attributes=require(_0xc18f('0x6'));module[_0xc18f('0x7')]=function(_0x44ff73,_0x2622bc){return _0x44ff73['define']('Condition',attributes,{'tableName':_0xc18f('0x8'),'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 d5771ea..2138d9e 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 _0xebe2=['jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xebe2,0x1d8));var _0x2ebe=function(_0x5a5aca,_0x368fbb){_0x5a5aca=_0x5a5aca-0x0;var _0x1cb523=_0xebe2[_0x5a5aca];return _0x1cb523;};'use strict';var _=require('lodash');var util=require(_0x2ebe('0x0'));var moment=require(_0x2ebe('0x1'));var BPromise=require('bluebird');var rs=require(_0x2ebe('0x2'));var fs=require('fs');var Redis=require(_0x2ebe('0x3'));var db=require(_0x2ebe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ebe('0x5'))(_0x2ebe('0x6'));var config=require(_0x2ebe('0x7'));var jayson=require(_0x2ebe('0x8'));var client=jayson[_0x2ebe('0x9')][_0x2ebe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bab63,_0x7a550,_0x51ce35){return new BPromise(function(_0x3a6ffd,_0x1d4aac){return client[_0x2ebe('0xb')](_0x3bab63,_0x51ce35)[_0x2ebe('0xc')](function(_0x9f9a11){logger[_0x2ebe('0xd')](_0x2ebe('0xe'),_0x7a550,'request\x20sent');logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x7a550,'request\x20sent',JSON[_0x2ebe('0xf')](_0x9f9a11));if(_0x9f9a11[_0x2ebe('0x10')]){if(_0x9f9a11[_0x2ebe('0x10')]['code']===0x1f4){logger['error'](_0x2ebe('0xe'),_0x7a550,_0x9f9a11['error']['message']);return _0x1d4aac(_0x9f9a11[_0x2ebe('0x10')]['message']);}logger[_0x2ebe('0x10')](_0x2ebe('0xe'),_0x7a550,_0x9f9a11['error'][_0x2ebe('0x11')]);return _0x3a6ffd(_0x9f9a11[_0x2ebe('0x10')][_0x2ebe('0x11')]);}else{logger[_0x2ebe('0xd')](_0x2ebe('0xe'),_0x7a550,_0x2ebe('0x12'));_0x3a6ffd(_0x9f9a11['result'][_0x2ebe('0x11')]);}})[_0x2ebe('0x13')](function(_0x3f618e){logger[_0x2ebe('0x10')]('Condition,\x20%s,\x20%s',_0x7a550,_0x3f618e);_0x1d4aac(_0x3f618e);});});} \ No newline at end of file +var _0x16fb=['result','Condition,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3ef2b8,_0xa9382c){var _0x304b28=function(_0x2b0bd7){while(--_0x2b0bd7){_0x3ef2b8['push'](_0x3ef2b8['shift']());}};_0x304b28(++_0xa9382c);}(_0x16fb,0xc2));var _0xb16f=function(_0x8b8564,_0x162976){_0x8b8564=_0x8b8564-0x0;var _0x360c61=_0x16fb[_0x8b8564];return _0x360c61;};'use strict';var _=require(_0xb16f('0x0'));var util=require(_0xb16f('0x1'));var moment=require(_0xb16f('0x2'));var BPromise=require(_0xb16f('0x3'));var rs=require(_0xb16f('0x4'));var fs=require('fs');var Redis=require(_0xb16f('0x5'));var db=require(_0xb16f('0x6'))['db'];var utils=require(_0xb16f('0x7'));var logger=require(_0xb16f('0x8'))(_0xb16f('0x9'));var config=require(_0xb16f('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xb16f('0xb')][_0xb16f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ad4ec,_0x175cdc,_0x498da6){return new BPromise(function(_0x3280c3,_0x2c2ceb){return client['request'](_0x1ad4ec,_0x498da6)[_0xb16f('0xd')](function(_0x27db4a){logger[_0xb16f('0xe')]('Condition,\x20%s,\x20%s',_0x175cdc,_0xb16f('0xf'));logger[_0xb16f('0x10')](_0xb16f('0x11'),_0x175cdc,_0xb16f('0xf'),JSON[_0xb16f('0x12')](_0x27db4a));if(_0x27db4a[_0xb16f('0x13')]){if(_0x27db4a['error'][_0xb16f('0x14')]===0x1f4){logger[_0xb16f('0x13')]('Condition,\x20%s,\x20%s',_0x175cdc,_0x27db4a['error'][_0xb16f('0x15')]);return _0x2c2ceb(_0x27db4a[_0xb16f('0x13')]['message']);}logger['error']('Condition,\x20%s,\x20%s',_0x175cdc,_0x27db4a[_0xb16f('0x13')][_0xb16f('0x15')]);return _0x3280c3(_0x27db4a[_0xb16f('0x13')][_0xb16f('0x15')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0x175cdc,_0xb16f('0xf'));_0x3280c3(_0x27db4a[_0xb16f('0x16')][_0xb16f('0x15')]);}})['catch'](function(_0x249302){logger[_0xb16f('0x13')](_0xb16f('0x17'),_0x175cdc,_0x249302);_0x2c2ceb(_0x249302);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 493f047..32583da 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 _0xc623=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','multer','util','path'];(function(_0x11c356,_0x49a877){var _0x5c469c=function(_0x5872dd){while(--_0x5872dd){_0x11c356['push'](_0x11c356['shift']());}};_0x5c469c(++_0x49a877);}(_0xc623,0xcd));var _0x3c62=function(_0x11c067,_0xecab5a){_0x11c067=_0x11c067-0x0;var _0x3ede6e=_0xc623[_0x11c067];return _0x3ede6e;};'use strict';var multer=require(_0x3c62('0x0'));var util=require(_0x3c62('0x1'));var path=require(_0x3c62('0x2'));var timeout=require(_0x3c62('0x3'));var express=require(_0x3c62('0x4'));var router=express[_0x3c62('0x5')]();var fs_extra=require(_0x3c62('0x6'));var auth=require(_0x3c62('0x7'));var interaction=require(_0x3c62('0x8'));var config=require(_0x3c62('0x9'));var controller=require('./condition.controller');router[_0x3c62('0xa')](_0x3c62('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x3c62('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4f49=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./condition.controller','put','isAuthenticated','/:id'];(function(_0x54f2a2,_0x592ad5){var _0x312d73=function(_0x1dcf6e){while(--_0x1dcf6e){_0x54f2a2['push'](_0x54f2a2['shift']());}};_0x312d73(++_0x592ad5);}(_0x4f49,0xdf));var _0x94f4=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4f49[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x94f4('0x0'));var util=require(_0x94f4('0x1'));var path=require(_0x94f4('0x2'));var timeout=require(_0x94f4('0x3'));var express=require('express');var router=express[_0x94f4('0x4')]();var fs_extra=require(_0x94f4('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x94f4('0x6'));var controller=require(_0x94f4('0x7'));router[_0x94f4('0x8')]('/:id',auth[_0x94f4('0x9')](),controller['update']);router['delete'](_0x94f4('0xa'),auth[_0x94f4('0x9')](),controller[_0x94f4('0xb')]);module[_0x94f4('0xc')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 5de1d92..dfb88ff 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8745=['name','INTEGER','sequelize','exports','STRING'];(function(_0x1ece28,_0x5555f4){var _0x3182d6=function(_0x11d2e8){while(--_0x11d2e8){_0x1ece28['push'](_0x1ece28['shift']());}};_0x3182d6(++_0x5555f4);}(_0x8745,0x124));var _0x5874=function(_0x4b93fc,_0x3f3ec9){_0x4b93fc=_0x4b93fc-0x0;var _0x5e18e1=_0x8745[_0x4b93fc];return _0x5e18e1;};'use strict';var Sequelize=require(_0x5874('0x0'));module[_0x5874('0x1')]={'name':{'type':Sequelize[_0x5874('0x2')],'allowNull':![],'unique':_0x5874('0x3')},'OrderBy':{'type':Sequelize[_0x5874('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x5874('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xd44f=['STRING','INTEGER'];(function(_0x468e0b,_0xe2bef5){var _0x25ac96=function(_0x57f3b9){while(--_0x57f3b9){_0x468e0b['push'](_0x468e0b['shift']());}};_0x25ac96(++_0xe2bef5);}(_0xd44f,0x1c4));var _0xfd44=function(_0x80bea0,_0x4c30f4){_0x80bea0=_0x80bea0-0x0;var _0x50fb90=_0xd44f[_0x80bea0];return _0x50fb90;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfd44('0x0')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xfd44('0x1')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xfd44('0x0')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 72f2bc8..aebf34a 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4991=['lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ContactItemTypes','end','error','stack','name','send','ContactItemType','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra'];(function(_0x1fe890,_0xae102b){var _0x226c9d=function(_0x4722fe){while(--_0x4722fe){_0x1fe890['push'](_0x1fe890['shift']());}};_0x226c9d(++_0xae102b);}(_0x4991,0xf7));var _0x1499=function(_0x5d7b14,_0x141fe5){_0x5d7b14=_0x5d7b14-0x0;var _0x3ff343=_0x4991[_0x5d7b14];return _0x3ff343;};'use strict';var emlformat=require(_0x1499('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1499('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1499('0x2'));var moment=require(_0x1499('0x3'));var BPromise=require(_0x1499('0x4'));var Mustache=require(_0x1499('0x5'));var util=require(_0x1499('0x6'));var path=require(_0x1499('0x7'));var sox=require(_0x1499('0x8'));var csv=require(_0x1499('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1499('0xa'));var _=require(_0x1499('0xb'));var squel=require(_0x1499('0xc'));var crypto=require(_0x1499('0xd'));var jsforce=require(_0x1499('0xe'));var deskjs=require(_0x1499('0xf'));var toCsv=require(_0x1499('0x9'));var querystring=require(_0x1499('0x10'));var Papa=require('papaparse');var Redis=require(_0x1499('0x11'));var authService=require(_0x1499('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1499('0x13'));var hardwareService=require(_0x1499('0x14'));var logger=require('../../config/logger')(_0x1499('0x15'));var utils=require(_0x1499('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3039ce,_0x274bc1){_0x274bc1=_0x274bc1||0xcc;return function(_0x34a928){if(_0x34a928){return _0x3039ce[_0x1499('0x17')](_0x274bc1);}return _0x3039ce[_0x1499('0x18')](_0x274bc1)['end']();};}function respondWithResult(_0x5f34f2,_0x308177){_0x308177=_0x308177||0xc8;return function(_0x4e5195){if(_0x4e5195){return _0x5f34f2[_0x1499('0x18')](_0x308177)[_0x1499('0x19')](_0x4e5195);}};}function respondWithFilteredResult(_0x308318,_0x3ab605){return function(_0x48f654){if(_0x48f654){var _0x1ed43b=typeof _0x3ab605[_0x1499('0x1a')]==='undefined'&&typeof _0x3ab605[_0x1499('0x1b')]===_0x1499('0x1c');var _0x46b364=_0x48f654[_0x1499('0x1d')];var _0x1e45a9=_0x1ed43b?0x0:_0x3ab605[_0x1499('0x1a')];var _0x5b9859=_0x1ed43b?_0x48f654['count']:_0x3ab605['offset']+_0x3ab605[_0x1499('0x1b')];var _0xad534b;if(_0x5b9859>=_0x46b364){_0x5b9859=_0x46b364;_0xad534b=0xc8;}else{_0xad534b=0xce;}_0x308318['status'](_0xad534b);return _0x308318[_0x1499('0x1e')](_0x1499('0x1f'),_0x1e45a9+'-'+_0x5b9859+'/'+_0x46b364)[_0x1499('0x19')](_0x48f654);}return null;};}function patchUpdates(_0x18e4a6){return function(_0x21e887){try{jsonpatch[_0x1499('0x20')](_0x21e887,_0x18e4a6,!![]);}catch(_0x2b0458){return BPromise[_0x1499('0x21')](_0x2b0458);}return _0x21e887[_0x1499('0x22')]();};}function saveUpdates(_0x15bcd4,_0x2bb71f){return function(_0x836081){if(_0x836081){return _0x836081[_0x1499('0x23')](_0x15bcd4)[_0x1499('0x24')](function(_0x4ec57a){return _0x4ec57a;});}return null;};}function removeEntity(_0x1e2c51,_0x2c7f57){return function(_0x5615b4){if(_0x5615b4){return _0x5615b4[_0x1499('0x25')]()[_0x1499('0x24')](function(){var _0x30f014=_0x5615b4[_0x1499('0x26')]({'plain':!![]});var _0x3968e0=_0x1499('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x3968e0,'resourceId':_0x30f014['id']}})[_0x1499('0x24')](function(){return _0x5615b4;});})[_0x1499('0x24')](function(){_0x1e2c51[_0x1499('0x18')](0xcc)[_0x1499('0x28')]();});}};}function handleEntityNotFound(_0x32782a,_0x525d6f){return function(_0x3e5ed1){if(!_0x3e5ed1){_0x32782a['sendStatus'](0x194);}return _0x3e5ed1;};}function handleError(_0x5022a4,_0x516f29){_0x516f29=_0x516f29||0x1f4;return function(_0x21d204){logger[_0x1499('0x29')](_0x21d204[_0x1499('0x2a')]);if(_0x21d204[_0x1499('0x2b')]){delete _0x21d204[_0x1499('0x2b')];}_0x5022a4[_0x1499('0x18')](_0x516f29)[_0x1499('0x2c')](_0x21d204);};}exports['index']=function(_0x180171,_0x1a2c99){var _0x39995b={},_0x5b59ea={},_0x2dae84={'count':0x0,'rows':[]};var _0x16466c=_['map'](db[_0x1499('0x2d')][_0x1499('0x2e')],function(_0x497efd){return{'name':_0x497efd[_0x1499('0x2f')],'type':_0x497efd[_0x1499('0x30')][_0x1499('0x31')]};});_0x5b59ea[_0x1499('0x32')]=_[_0x1499('0x33')](_0x16466c,_0x1499('0x2b'));_0x5b59ea[_0x1499('0x34')]=_[_0x1499('0x35')](_0x180171[_0x1499('0x34')]);_0x5b59ea[_0x1499('0x36')]=_[_0x1499('0x37')](_0x5b59ea[_0x1499('0x32')],_0x5b59ea[_0x1499('0x34')]);_0x39995b[_0x1499('0x38')]=_[_0x1499('0x37')](_0x5b59ea[_0x1499('0x32')],qs[_0x1499('0x39')](_0x180171[_0x1499('0x34')][_0x1499('0x39')]));_0x39995b[_0x1499('0x38')]=_0x39995b['attributes'][_0x1499('0x3a')]?_0x39995b[_0x1499('0x38')]:_0x5b59ea[_0x1499('0x32')];if(!_0x180171[_0x1499('0x34')][_0x1499('0x3b')](_0x1499('0x3c'))){_0x39995b[_0x1499('0x1b')]=qs[_0x1499('0x1b')](_0x180171[_0x1499('0x34')][_0x1499('0x1b')]);_0x39995b[_0x1499('0x1a')]=qs['offset'](_0x180171['query'][_0x1499('0x1a')]);}_0x39995b['order']=qs[_0x1499('0x3d')](_0x180171['query'][_0x1499('0x3d')]);_0x39995b[_0x1499('0x3e')]=qs[_0x1499('0x36')](_[_0x1499('0x3f')](_0x180171['query'],_0x5b59ea[_0x1499('0x36')]),_0x16466c);if(_0x180171['query'][_0x1499('0x40')]){_0x39995b[_0x1499('0x3e')]=_[_0x1499('0x41')](_0x39995b[_0x1499('0x3e')],{'$or':_['map'](_0x16466c,function(_0x61f5ce){if(_0x61f5ce[_0x1499('0x30')]!==_0x1499('0x42')){var _0x3b67a7={};_0x3b67a7[_0x61f5ce['name']]={'$like':'%'+_0x180171[_0x1499('0x34')]['filter']+'%'};return _0x3b67a7;}})});}_0x39995b=_[_0x1499('0x41')]({},_0x39995b,_0x180171[_0x1499('0x43')]);var _0x2a2441={'where':_0x39995b[_0x1499('0x3e')]};return db[_0x1499('0x2d')][_0x1499('0x1d')](_0x2a2441)[_0x1499('0x24')](function(_0xcb85eb){_0x2dae84[_0x1499('0x1d')]=_0xcb85eb;if(_0x180171[_0x1499('0x34')]['includeAll']){_0x39995b[_0x1499('0x44')]=[{'all':!![]}];}return db['ContactItemType'][_0x1499('0x45')](_0x39995b);})[_0x1499('0x24')](function(_0x5646cf){_0x2dae84[_0x1499('0x46')]=_0x5646cf;return _0x2dae84;})[_0x1499('0x24')](respondWithFilteredResult(_0x1a2c99,_0x39995b))[_0x1499('0x47')](handleError(_0x1a2c99,null));};exports[_0x1499('0x48')]=function(_0x43e76c,_0x4db5a1){var _0x5d1e9f={'raw':!![],'where':{'id':_0x43e76c[_0x1499('0x49')]['id']}},_0x368fdb={};_0x368fdb['model']=_[_0x1499('0x35')](db[_0x1499('0x2d')]['rawAttributes']);_0x368fdb['query']=_[_0x1499('0x35')](_0x43e76c[_0x1499('0x34')]);_0x368fdb[_0x1499('0x36')]=_['intersection'](_0x368fdb[_0x1499('0x32')],_0x368fdb[_0x1499('0x34')]);_0x5d1e9f[_0x1499('0x38')]=_[_0x1499('0x37')](_0x368fdb['model'],qs[_0x1499('0x39')](_0x43e76c[_0x1499('0x34')][_0x1499('0x39')]));_0x5d1e9f[_0x1499('0x38')]=_0x5d1e9f['attributes'][_0x1499('0x3a')]?_0x5d1e9f[_0x1499('0x38')]:_0x368fdb[_0x1499('0x32')];if(_0x43e76c['query']['includeAll']){_0x5d1e9f[_0x1499('0x44')]=[{'all':!![]}];}_0x5d1e9f=_['merge']({},_0x5d1e9f,_0x43e76c[_0x1499('0x43')]);return db[_0x1499('0x2d')][_0x1499('0x4a')](_0x5d1e9f)[_0x1499('0x24')](handleEntityNotFound(_0x4db5a1,null))[_0x1499('0x24')](respondWithResult(_0x4db5a1,null))[_0x1499('0x47')](handleError(_0x4db5a1,null));};exports[_0x1499('0x4b')]=function(_0x591aa8,_0x420d16){return db['ContactItemType'][_0x1499('0x4b')](_0x591aa8[_0x1499('0x4c')],{})['then'](function(_0x23fb7f){var _0xd4ac1a=_0x591aa8[_0x1499('0x4d')]['get']({'plain':!![]});if(!_0xd4ac1a)throw new Error(_0x1499('0x4e'));if(_0xd4ac1a[_0x1499('0x4f')]===_0x1499('0x4d')){var _0x29ac0f=_0x23fb7f[_0x1499('0x26')]({'plain':!![]});var _0x11aafe=_0x1499('0x27');return db[_0x1499('0x50')][_0x1499('0x4a')]({'where':{'name':_0x11aafe,'userProfileId':_0xd4ac1a[_0x1499('0x51')]},'raw':!![]})['then'](function(_0x13770a){if(_0x13770a&&_0x13770a[_0x1499('0x52')]===0x0){return db[_0x1499('0x53')]['create']({'name':_0x29ac0f[_0x1499('0x2b')],'resourceId':_0x29ac0f['id'],'type':_0x13770a[_0x1499('0x2b')],'sectionId':_0x13770a['id']},{})['then'](function(){return _0x23fb7f;});}else{return _0x23fb7f;}})[_0x1499('0x47')](function(_0x162ddb){logger['error'](_0x1499('0x54'),_0x162ddb);throw _0x162ddb;});}return _0x23fb7f;})[_0x1499('0x24')](respondWithResult(_0x420d16,0xc9))[_0x1499('0x47')](handleError(_0x420d16,null));};exports[_0x1499('0x23')]=function(_0xa870e,_0x16d97c){if(_0xa870e[_0x1499('0x4c')]['id']){delete _0xa870e['body']['id'];}return db[_0x1499('0x2d')][_0x1499('0x4a')]({'where':{'id':_0xa870e[_0x1499('0x49')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x16d97c,null))['then'](saveUpdates(_0xa870e['body'],null))[_0x1499('0x24')](respondWithResult(_0x16d97c,null))[_0x1499('0x47')](handleError(_0x16d97c,null));};exports['destroy']=function(_0x3c3a20,_0x1ddb13){return db[_0x1499('0x2d')]['find']({'where':{'id':_0x3c3a20['params']['id']}})['then'](handleEntityNotFound(_0x1ddb13,null))[_0x1499('0x24')](db[_0x1499('0x55')][_0x1499('0x23')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x3c3a20['params']['id']}}))[_0x1499('0x24')](removeEntity(_0x1ddb13,null))['catch'](handleError(_0x1ddb13,null));}; \ No newline at end of file +var _0x0120=['intersection','attributes','fields','length','nolimit','order','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','limit','undefined','count','offset','set','Content-Range','json','reject','save','update','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','ContactItemType','rawAttributes','type','key','model','query','keys','filters'];(function(_0x4a7fcf,_0x2543b6){var _0x198071=function(_0x39421a){while(--_0x39421a){_0x4a7fcf['push'](_0x4a7fcf['shift']());}};_0x198071(++_0x2543b6);}(_0x0120,0x6f));var _0x0012=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x0120[_0xefd519];return _0x4bb882;};'use strict';var emlformat=require(_0x0012('0x0'));var rimraf=require(_0x0012('0x1'));var zipdir=require(_0x0012('0x2'));var jsonpatch=require(_0x0012('0x3'));var rp=require(_0x0012('0x4'));var moment=require(_0x0012('0x5'));var BPromise=require(_0x0012('0x6'));var Mustache=require(_0x0012('0x7'));var util=require(_0x0012('0x8'));var path=require(_0x0012('0x9'));var sox=require(_0x0012('0xa'));var csv=require(_0x0012('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0012('0xc'));var crypto=require(_0x0012('0xd'));var jsforce=require(_0x0012('0xe'));var deskjs=require(_0x0012('0xf'));var toCsv=require(_0x0012('0xb'));var querystring=require('querystring');var Papa=require(_0x0012('0x10'));var Redis=require(_0x0012('0x11'));var authService=require(_0x0012('0x12'));var qs=require(_0x0012('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0012('0x14'));var logger=require('../../config/logger')(_0x0012('0x15'));var utils=require(_0x0012('0x16'));var config=require(_0x0012('0x17'));var licenseUtil=require(_0x0012('0x18'));var db=require(_0x0012('0x19'))['db'];function respondWithStatusCode(_0x4d3e7a,_0x6d4a1a){_0x6d4a1a=_0x6d4a1a||0xcc;return function(_0x4f0ee1){if(_0x4f0ee1){return _0x4d3e7a['sendStatus'](_0x6d4a1a);}return _0x4d3e7a['status'](_0x6d4a1a)['end']();};}function respondWithResult(_0x3a7d50,_0x496a2b){_0x496a2b=_0x496a2b||0xc8;return function(_0x3995fd){if(_0x3995fd){return _0x3a7d50[_0x0012('0x1a')](_0x496a2b)['json'](_0x3995fd);}};}function respondWithFilteredResult(_0x24f4ed,_0x1a0c0d){return function(_0x348810){if(_0x348810){var _0x3b8dfc=typeof _0x1a0c0d['offset']==='undefined'&&typeof _0x1a0c0d[_0x0012('0x1b')]===_0x0012('0x1c');var _0x3948bf=_0x348810[_0x0012('0x1d')];var _0x1d0423=_0x3b8dfc?0x0:_0x1a0c0d[_0x0012('0x1e')];var _0x1e78ee=_0x3b8dfc?_0x348810[_0x0012('0x1d')]:_0x1a0c0d['offset']+_0x1a0c0d[_0x0012('0x1b')];var _0x56b0e1;if(_0x1e78ee>=_0x3948bf){_0x1e78ee=_0x3948bf;_0x56b0e1=0xc8;}else{_0x56b0e1=0xce;}_0x24f4ed['status'](_0x56b0e1);return _0x24f4ed[_0x0012('0x1f')](_0x0012('0x20'),_0x1d0423+'-'+_0x1e78ee+'/'+_0x3948bf)[_0x0012('0x21')](_0x348810);}return null;};}function patchUpdates(_0x2c837e){return function(_0x53ac2d){try{jsonpatch['apply'](_0x53ac2d,_0x2c837e,!![]);}catch(_0x460d82){return BPromise[_0x0012('0x22')](_0x460d82);}return _0x53ac2d[_0x0012('0x23')]();};}function saveUpdates(_0x7177bc,_0x190f07){return function(_0x2e6a2c){if(_0x2e6a2c){return _0x2e6a2c[_0x0012('0x24')](_0x7177bc)[_0x0012('0x25')](function(_0x57487e){return _0x57487e;});}return null;};}function removeEntity(_0x24674c,_0x24a280){return function(_0x4cf4bd){if(_0x4cf4bd){return _0x4cf4bd[_0x0012('0x26')]()[_0x0012('0x25')](function(){var _0x340622=_0x4cf4bd[_0x0012('0x27')]({'plain':!![]});var _0x42bcd7='ContactItemTypes';return db[_0x0012('0x28')][_0x0012('0x26')]({'where':{'type':_0x42bcd7,'resourceId':_0x340622['id']}})[_0x0012('0x25')](function(){return _0x4cf4bd;});})[_0x0012('0x25')](function(){_0x24674c[_0x0012('0x1a')](0xcc)[_0x0012('0x29')]();});}};}function handleEntityNotFound(_0x15d48a,_0xf3781e){return function(_0x300e13){if(!_0x300e13){_0x15d48a[_0x0012('0x2a')](0x194);}return _0x300e13;};}function handleError(_0x34efc7,_0x20b78f){_0x20b78f=_0x20b78f||0x1f4;return function(_0x45c3ca){logger[_0x0012('0x2b')](_0x45c3ca[_0x0012('0x2c')]);if(_0x45c3ca[_0x0012('0x2d')]){delete _0x45c3ca[_0x0012('0x2d')];}_0x34efc7[_0x0012('0x1a')](_0x20b78f)[_0x0012('0x2e')](_0x45c3ca);};}exports[_0x0012('0x2f')]=function(_0x1bb14d,_0x4d0998){var _0x283134={},_0x1bb49b={},_0x4c2601={'count':0x0,'rows':[]};var _0x2fa6a2=_[_0x0012('0x30')](db[_0x0012('0x31')][_0x0012('0x32')],function(_0x287b05){return{'name':_0x287b05['fieldName'],'type':_0x287b05[_0x0012('0x33')][_0x0012('0x34')]};});_0x1bb49b[_0x0012('0x35')]=_['map'](_0x2fa6a2,_0x0012('0x2d'));_0x1bb49b[_0x0012('0x36')]=_[_0x0012('0x37')](_0x1bb14d[_0x0012('0x36')]);_0x1bb49b[_0x0012('0x38')]=_[_0x0012('0x39')](_0x1bb49b['model'],_0x1bb49b[_0x0012('0x36')]);_0x283134[_0x0012('0x3a')]=_[_0x0012('0x39')](_0x1bb49b[_0x0012('0x35')],qs['fields'](_0x1bb14d['query'][_0x0012('0x3b')]));_0x283134[_0x0012('0x3a')]=_0x283134[_0x0012('0x3a')][_0x0012('0x3c')]?_0x283134[_0x0012('0x3a')]:_0x1bb49b[_0x0012('0x35')];if(!_0x1bb14d[_0x0012('0x36')]['hasOwnProperty'](_0x0012('0x3d'))){_0x283134[_0x0012('0x1b')]=qs['limit'](_0x1bb14d[_0x0012('0x36')][_0x0012('0x1b')]);_0x283134[_0x0012('0x1e')]=qs[_0x0012('0x1e')](_0x1bb14d[_0x0012('0x36')][_0x0012('0x1e')]);}_0x283134[_0x0012('0x3e')]=qs['sort'](_0x1bb14d[_0x0012('0x36')]['sort']);_0x283134[_0x0012('0x3f')]=qs['filters'](_['pick'](_0x1bb14d[_0x0012('0x36')],_0x1bb49b[_0x0012('0x38')]),_0x2fa6a2);if(_0x1bb14d[_0x0012('0x36')]['filter']){_0x283134[_0x0012('0x3f')]=_[_0x0012('0x40')](_0x283134[_0x0012('0x3f')],{'$or':_[_0x0012('0x30')](_0x2fa6a2,function(_0x3d81ed){if(_0x3d81ed[_0x0012('0x33')]!==_0x0012('0x41')){var _0x11f001={};_0x11f001[_0x3d81ed['name']]={'$like':'%'+_0x1bb14d[_0x0012('0x36')][_0x0012('0x42')]+'%'};return _0x11f001;}})});}_0x283134=_[_0x0012('0x40')]({},_0x283134,_0x1bb14d[_0x0012('0x43')]);var _0x42e01c={'where':_0x283134[_0x0012('0x3f')]};return db[_0x0012('0x31')]['count'](_0x42e01c)['then'](function(_0x1c54de){_0x4c2601['count']=_0x1c54de;if(_0x1bb14d[_0x0012('0x36')][_0x0012('0x44')]){_0x283134[_0x0012('0x45')]=[{'all':!![]}];}return db[_0x0012('0x31')][_0x0012('0x46')](_0x283134);})['then'](function(_0x1bd93a){_0x4c2601[_0x0012('0x47')]=_0x1bd93a;return _0x4c2601;})['then'](respondWithFilteredResult(_0x4d0998,_0x283134))[_0x0012('0x48')](handleError(_0x4d0998,null));};exports[_0x0012('0x49')]=function(_0x422c06,_0x207b61){var _0x5259c2={'raw':!![],'where':{'id':_0x422c06[_0x0012('0x4a')]['id']}},_0x4ba00e={};_0x4ba00e['model']=_[_0x0012('0x37')](db['ContactItemType'][_0x0012('0x32')]);_0x4ba00e[_0x0012('0x36')]=_[_0x0012('0x37')](_0x422c06[_0x0012('0x36')]);_0x4ba00e['filters']=_[_0x0012('0x39')](_0x4ba00e['model'],_0x4ba00e[_0x0012('0x36')]);_0x5259c2[_0x0012('0x3a')]=_[_0x0012('0x39')](_0x4ba00e[_0x0012('0x35')],qs[_0x0012('0x3b')](_0x422c06[_0x0012('0x36')][_0x0012('0x3b')]));_0x5259c2['attributes']=_0x5259c2[_0x0012('0x3a')][_0x0012('0x3c')]?_0x5259c2[_0x0012('0x3a')]:_0x4ba00e[_0x0012('0x35')];if(_0x422c06[_0x0012('0x36')][_0x0012('0x44')]){_0x5259c2['include']=[{'all':!![]}];}_0x5259c2=_['merge']({},_0x5259c2,_0x422c06['options']);return db['ContactItemType'][_0x0012('0x4b')](_0x5259c2)[_0x0012('0x25')](handleEntityNotFound(_0x207b61,null))[_0x0012('0x25')](respondWithResult(_0x207b61,null))[_0x0012('0x48')](handleError(_0x207b61,null));};exports[_0x0012('0x4c')]=function(_0x53d552,_0x44ffaf){return db[_0x0012('0x31')][_0x0012('0x4c')](_0x53d552[_0x0012('0x4d')],{})[_0x0012('0x25')](function(_0x564bc4){var _0x156490=_0x53d552[_0x0012('0x4e')][_0x0012('0x27')]({'plain':!![]});if(!_0x156490)throw new Error(_0x0012('0x4f'));if(_0x156490[_0x0012('0x50')]==='user'){var _0x2389cd=_0x564bc4[_0x0012('0x27')]({'plain':!![]});var _0x46e6d9='ContactItemTypes';return db[_0x0012('0x51')][_0x0012('0x4b')]({'where':{'name':_0x46e6d9,'userProfileId':_0x156490[_0x0012('0x52')]},'raw':!![]})[_0x0012('0x25')](function(_0x27a650){if(_0x27a650&&_0x27a650['autoAssociation']===0x0){return db[_0x0012('0x28')]['create']({'name':_0x2389cd[_0x0012('0x2d')],'resourceId':_0x2389cd['id'],'type':_0x27a650[_0x0012('0x2d')],'sectionId':_0x27a650['id']},{})['then'](function(){return _0x564bc4;});}else{return _0x564bc4;}})[_0x0012('0x48')](function(_0x19cf31){logger[_0x0012('0x2b')](_0x0012('0x53'),_0x19cf31);throw _0x19cf31;});}return _0x564bc4;})[_0x0012('0x25')](respondWithResult(_0x44ffaf,0xc9))[_0x0012('0x48')](handleError(_0x44ffaf,null));};exports['update']=function(_0x14ac2d,_0x1a91eb){if(_0x14ac2d[_0x0012('0x4d')]['id']){delete _0x14ac2d[_0x0012('0x4d')]['id'];}return db['ContactItemType'][_0x0012('0x4b')]({'where':{'id':_0x14ac2d[_0x0012('0x4a')]['id']}})[_0x0012('0x25')](handleEntityNotFound(_0x1a91eb,null))['then'](saveUpdates(_0x14ac2d[_0x0012('0x4d')],null))[_0x0012('0x25')](respondWithResult(_0x1a91eb,null))[_0x0012('0x48')](handleError(_0x1a91eb,null));};exports[_0x0012('0x26')]=function(_0x1a48d9,_0x53e967){return db[_0x0012('0x31')][_0x0012('0x4b')]({'where':{'id':_0x1a48d9[_0x0012('0x4a')]['id']}})[_0x0012('0x25')](handleEntityNotFound(_0x53e967,null))[_0x0012('0x25')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x1a48d9[_0x0012('0x4a')]['id']}}))[_0x0012('0x25')](removeEntity(_0x53e967,null))[_0x0012('0x48')](handleError(_0x53e967,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index db51774..1ac219d 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a38=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','ContactItemType','lodash'];(function(_0xa76db3,_0xf8fd0){var _0x47338e=function(_0x3163b6){while(--_0x3163b6){_0xa76db3['push'](_0xa76db3['shift']());}};_0x47338e(++_0xf8fd0);}(_0x0a38,0x143));var _0x80a3=function(_0x6e0de5,_0x31099e){_0x6e0de5=_0x6e0de5-0x0;var _0x468c82=_0x0a38[_0x6e0de5];return _0x468c82;};'use strict';var _=require(_0x80a3('0x0'));var util=require(_0x80a3('0x1'));var logger=require(_0x80a3('0x2'))(_0x80a3('0x3'));var moment=require(_0x80a3('0x4'));var BPromise=require(_0x80a3('0x5'));var rp=require(_0x80a3('0x6'));var fs=require('fs');var path=require(_0x80a3('0x7'));var rimraf=require(_0x80a3('0x8'));var config=require(_0x80a3('0x9'));var attributes=require('./contactItemType.attributes');module[_0x80a3('0xa')]=function(_0x2f274a,_0x40bc4d){return _0x2f274a['define'](_0x80a3('0xb'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8470=['./contactItemType.attributes','exports','define','ContactItemType','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x44d624,_0x22c9cb){var _0x47d457=function(_0x1347f2){while(--_0x1347f2){_0x44d624['push'](_0x44d624['shift']());}};_0x47d457(++_0x22c9cb);}(_0x8470,0x1b1));var _0x0847=function(_0x581b30,_0x299548){_0x581b30=_0x581b30-0x0;var _0x248401=_0x8470[_0x581b30];return _0x248401;};'use strict';var _=require(_0x0847('0x0'));var util=require('util');var logger=require(_0x0847('0x1'))(_0x0847('0x2'));var moment=require(_0x0847('0x3'));var BPromise=require(_0x0847('0x4'));var rp=require(_0x0847('0x5'));var fs=require('fs');var path=require(_0x0847('0x6'));var rimraf=require(_0x0847('0x7'));var config=require(_0x0847('0x8'));var attributes=require(_0x0847('0x9'));module[_0x0847('0xa')]=function(_0x1ec52d,_0x597a3a){return _0x1ec52d[_0x0847('0xb')](_0x0847('0xc'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 1595908..79d93df 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa446=['lodash','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x5b0f18,_0x5d2a47){var _0x2136ee=function(_0x452582){while(--_0x452582){_0x5b0f18['push'](_0x5b0f18['shift']());}};_0x2136ee(++_0x5d2a47);}(_0xa446,0xc6));var _0x6a44=function(_0x25c1be,_0x278415){_0x25c1be=_0x25c1be-0x0;var _0x22a24d=_0xa446[_0x25c1be];return _0x22a24d;};'use strict';var _=require(_0x6a44('0x0'));var util=require(_0x6a44('0x1'));var moment=require('moment');var BPromise=require(_0x6a44('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a44('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6a44('0x4'));var logger=require('../../config/logger')(_0x6a44('0x5'));var config=require(_0x6a44('0x6'));var jayson=require(_0x6a44('0x7'));var client=jayson[_0x6a44('0x8')][_0x6a44('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x417c8c,_0x58be49,_0x1569ec){return new BPromise(function(_0x36a426,_0x4f72f8){return client[_0x6a44('0xa')](_0x417c8c,_0x1569ec)[_0x6a44('0xb')](function(_0x5596eb){logger[_0x6a44('0xc')](_0x6a44('0xd'),_0x58be49,_0x6a44('0xe'));logger[_0x6a44('0xf')](_0x6a44('0x10'),_0x58be49,_0x6a44('0xe'),JSON[_0x6a44('0x11')](_0x5596eb));if(_0x5596eb['error']){if(_0x5596eb[_0x6a44('0x12')][_0x6a44('0x13')]===0x1f4){logger['error'](_0x6a44('0xd'),_0x58be49,_0x5596eb[_0x6a44('0x12')][_0x6a44('0x14')]);return _0x4f72f8(_0x5596eb['error'][_0x6a44('0x14')]);}logger[_0x6a44('0x12')](_0x6a44('0xd'),_0x58be49,_0x5596eb[_0x6a44('0x12')][_0x6a44('0x14')]);return _0x36a426(_0x5596eb[_0x6a44('0x12')]['message']);}else{logger['info'](_0x6a44('0xd'),_0x58be49,_0x6a44('0xe'));_0x36a426(_0x5596eb['result'][_0x6a44('0x14')]);}})[_0x6a44('0x15')](function(_0x41af8f){logger[_0x6a44('0x12')](_0x6a44('0xd'),_0x58be49,_0x41af8f);_0x4f72f8(_0x41af8f);});});} \ No newline at end of file +var _0x95e4=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x427d3a,_0x23724c){var _0xe5c521=function(_0x77b277){while(--_0x77b277){_0x427d3a['push'](_0x427d3a['shift']());}};_0xe5c521(++_0x23724c);}(_0x95e4,0xb1));var _0x495e=function(_0x7f4b0d,_0x1c9e86){_0x7f4b0d=_0x7f4b0d-0x0;var _0x19d705=_0x95e4[_0x7f4b0d];return _0x19d705;};'use strict';var _=require(_0x495e('0x0'));var util=require(_0x495e('0x1'));var moment=require(_0x495e('0x2'));var BPromise=require(_0x495e('0x3'));var rs=require(_0x495e('0x4'));var fs=require('fs');var Redis=require(_0x495e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x495e('0x6'));var logger=require(_0x495e('0x7'))('rpc');var config=require(_0x495e('0x8'));var jayson=require(_0x495e('0x9'));var client=jayson[_0x495e('0xa')][_0x495e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x502bb1,_0x373fb3,_0x2721c9){return new BPromise(function(_0x3bead3,_0x184b71){return client[_0x495e('0xc')](_0x502bb1,_0x2721c9)[_0x495e('0xd')](function(_0x531ba6){logger[_0x495e('0xe')](_0x495e('0xf'),_0x373fb3,_0x495e('0x10'));logger[_0x495e('0x11')](_0x495e('0x12'),_0x373fb3,'request\x20sent',JSON['stringify'](_0x531ba6));if(_0x531ba6[_0x495e('0x13')]){if(_0x531ba6['error'][_0x495e('0x14')]===0x1f4){logger[_0x495e('0x13')]('ContactItemType,\x20%s,\x20%s',_0x373fb3,_0x531ba6[_0x495e('0x13')][_0x495e('0x15')]);return _0x184b71(_0x531ba6['error'][_0x495e('0x15')]);}logger[_0x495e('0x13')](_0x495e('0xf'),_0x373fb3,_0x531ba6['error'][_0x495e('0x15')]);return _0x3bead3(_0x531ba6[_0x495e('0x13')][_0x495e('0x15')]);}else{logger[_0x495e('0xe')]('ContactItemType,\x20%s,\x20%s',_0x373fb3,_0x495e('0x10'));_0x3bead3(_0x531ba6['result'][_0x495e('0x15')]);}})[_0x495e('0x16')](function(_0x107be9){logger[_0x495e('0x13')]('ContactItemType,\x20%s,\x20%s',_0x373fb3,_0x107be9);_0x184b71(_0x107be9);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 2777c54..c74d3a5 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd95f=['path','connect-timeout','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','multer','util'];(function(_0xf16d40,_0x1671b7){var _0xb54cd2=function(_0x117031){while(--_0x117031){_0xf16d40['push'](_0xf16d40['shift']());}};_0xb54cd2(++_0x1671b7);}(_0xd95f,0x10c));var _0xfd95=function(_0x1f3dd0,_0x51865d){_0x1f3dd0=_0x1f3dd0-0x0;var _0x3234ad=_0xd95f[_0x1f3dd0];return _0x3234ad;};'use strict';var multer=require(_0xfd95('0x0'));var util=require(_0xfd95('0x1'));var path=require(_0xfd95('0x2'));var timeout=require(_0xfd95('0x3'));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(_0xfd95('0x4'));var controller=require(_0xfd95('0x5'));router[_0xfd95('0x6')]('/',auth[_0xfd95('0x7')](),controller[_0xfd95('0x8')]);router[_0xfd95('0x6')](_0xfd95('0x9'),auth[_0xfd95('0x7')](),controller[_0xfd95('0xa')]);router[_0xfd95('0xb')]('/',auth[_0xfd95('0x7')](),controller['create']);router[_0xfd95('0xc')](_0xfd95('0x9'),auth[_0xfd95('0x7')](),controller[_0xfd95('0xd')]);router[_0xfd95('0xe')]('/:id',auth[_0xfd95('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8955=['update','delete','destroy','exports','multer','util','express','../../config/environment','./contactItemType.controller','get','isAuthenticated','show','post','create','put','/:id'];(function(_0x23a48b,_0x18f276){var _0x461cbf=function(_0x4467df){while(--_0x4467df){_0x23a48b['push'](_0x23a48b['shift']());}};_0x461cbf(++_0x18f276);}(_0x8955,0x1c4));var _0x5895=function(_0xcccb2d,_0x143aef){_0xcccb2d=_0xcccb2d-0x0;var _0xcc1e2a=_0x8955[_0xcccb2d];return _0xcc1e2a;};'use strict';var multer=require(_0x5895('0x0'));var util=require(_0x5895('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5895('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5895('0x3'));var controller=require(_0x5895('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5895('0x5')]('/:id',auth[_0x5895('0x6')](),controller[_0x5895('0x7')]);router[_0x5895('0x8')]('/',auth['isAuthenticated'](),controller[_0x5895('0x9')]);router[_0x5895('0xa')](_0x5895('0xb'),auth[_0x5895('0x6')](),controller[_0x5895('0xc')]);router[_0x5895('0xd')]('/:id',auth[_0x5895('0x6')](),controller[_0x5895('0xe')]);module[_0x5895('0xf')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index e9e83df..8388d14 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['STRING','name'];(function(_0x122542,_0x34da71){var _0x2d13d0=function(_0x3fe71b){while(--_0x3fe71b){_0x122542['push'](_0x122542['shift']());}};_0x2d13d0(++_0x34da71);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xb7e7[_0x1c8c28];return _0x1f59b4;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index ed37b07..d3edf94 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 _0xb99d=['order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','iframe','attrUrl','attrs','value','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie3','attrChannel','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','getItems','DashboardItem','pick','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','localhost','socket.io-emitter','redis','./dashboard.socket','register','sendStatus','end','status','json','offset','undefined','count','Content-Range','apply','reject','save','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb99d,0x141));var _0xdb99=function(_0xa4f047,_0x30cffe){_0xa4f047=_0xa4f047-0x0;var _0x280a03=_0xb99d[_0xa4f047];return _0x280a03;};'use strict';var emlformat=require(_0xdb99('0x0'));var rimraf=require(_0xdb99('0x1'));var zipdir=require(_0xdb99('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdb99('0x3'));var moment=require(_0xdb99('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdb99('0x5'));var util=require(_0xdb99('0x6'));var path=require(_0xdb99('0x7'));var sox=require(_0xdb99('0x8'));var csv=require(_0xdb99('0x9'));var ejs=require(_0xdb99('0xa'));var fs=require('fs');var fs_extra=require(_0xdb99('0xb'));var _=require(_0xdb99('0xc'));var squel=require(_0xdb99('0xd'));var crypto=require('crypto');var jsforce=require(_0xdb99('0xe'));var deskjs=require(_0xdb99('0xf'));var toCsv=require(_0xdb99('0x9'));var querystring=require(_0xdb99('0x10'));var Papa=require(_0xdb99('0x11'));var Redis=require('ioredis');var authService=require(_0xdb99('0x12'));var qs=require(_0xdb99('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb99('0x14'));var logger=require('../../config/logger')(_0xdb99('0x15'));var utils=require(_0xdb99('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdb99('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xdb99('0x18'),'port':0x18eb});var socket=require(_0xdb99('0x19'))(new Redis(config[_0xdb99('0x1a')]));require(_0xdb99('0x1b'))[_0xdb99('0x1c')](socket);function respondWithStatusCode(_0x264c18,_0x43a663){_0x43a663=_0x43a663||0xcc;return function(_0x3692fb){if(_0x3692fb){return _0x264c18[_0xdb99('0x1d')](_0x43a663);}return _0x264c18['status'](_0x43a663)[_0xdb99('0x1e')]();};}function respondWithResult(_0x379072,_0x341115){_0x341115=_0x341115||0xc8;return function(_0x4205f2){if(_0x4205f2){return _0x379072[_0xdb99('0x1f')](_0x341115)[_0xdb99('0x20')](_0x4205f2);}};}function respondWithFilteredResult(_0x1bf747,_0x11e7fc){return function(_0x26bba7){if(_0x26bba7){var _0x406f8b=typeof _0x11e7fc[_0xdb99('0x21')]===_0xdb99('0x22')&&typeof _0x11e7fc['limit']===_0xdb99('0x22');var _0x4c828a=_0x26bba7[_0xdb99('0x23')];var _0x587a6a=_0x406f8b?0x0:_0x11e7fc['offset'];var _0x18fbf4=_0x406f8b?_0x26bba7[_0xdb99('0x23')]:_0x11e7fc[_0xdb99('0x21')]+_0x11e7fc['limit'];var _0x16d7ff;if(_0x18fbf4>=_0x4c828a){_0x18fbf4=_0x4c828a;_0x16d7ff=0xc8;}else{_0x16d7ff=0xce;}_0x1bf747['status'](_0x16d7ff);return _0x1bf747['set'](_0xdb99('0x24'),_0x587a6a+'-'+_0x18fbf4+'/'+_0x4c828a)['json'](_0x26bba7);}return null;};}function patchUpdates(_0x3d3fa4){return function(_0x1410d5){try{jsonpatch[_0xdb99('0x25')](_0x1410d5,_0x3d3fa4,!![]);}catch(_0x1711d7){return BPromise[_0xdb99('0x26')](_0x1711d7);}return _0x1410d5[_0xdb99('0x27')]();};}function saveUpdates(_0x4cb99b,_0x3ac731){return function(_0x29f79c){if(_0x29f79c){return _0x29f79c['update'](_0x4cb99b)[_0xdb99('0x28')](function(_0x1b8e84){return _0x1b8e84;});}return null;};}function removeEntity(_0x121760,_0x1028e9){return function(_0x187a31){if(_0x187a31){return _0x187a31[_0xdb99('0x29')]()[_0xdb99('0x28')](function(){var _0x4a58fc=_0x187a31[_0xdb99('0x2a')]({'plain':!![]});var _0x47c300=_0xdb99('0x2b');return db[_0xdb99('0x2c')][_0xdb99('0x29')]({'where':{'type':_0x47c300,'resourceId':_0x4a58fc['id']}})[_0xdb99('0x28')](function(){return _0x187a31;});})[_0xdb99('0x28')](function(){_0x121760['status'](0xcc)[_0xdb99('0x1e')]();});}};}function handleEntityNotFound(_0x2de503,_0xa3e8f5){return function(_0x525c6f){if(!_0x525c6f){_0x2de503['sendStatus'](0x194);}return _0x525c6f;};}function handleError(_0x401e1d,_0x73091c){_0x73091c=_0x73091c||0x1f4;return function(_0x4669b7){logger[_0xdb99('0x2d')](_0x4669b7[_0xdb99('0x2e')]);if(_0x4669b7['name']){delete _0x4669b7[_0xdb99('0x2f')];}_0x401e1d[_0xdb99('0x1f')](_0x73091c)[_0xdb99('0x30')](_0x4669b7);};}exports[_0xdb99('0x31')]=function(_0x130ee1,_0x1b8c57){var _0x187ecc={},_0x5d2faa={},_0xd96983={'count':0x0,'rows':[]};var _0x232cff=_[_0xdb99('0x32')](db[_0xdb99('0x33')][_0xdb99('0x34')],function(_0x5d8d79){return{'name':_0x5d8d79[_0xdb99('0x35')],'type':_0x5d8d79[_0xdb99('0x36')][_0xdb99('0x37')]};});_0x5d2faa[_0xdb99('0x38')]=_[_0xdb99('0x32')](_0x232cff,_0xdb99('0x2f'));_0x5d2faa[_0xdb99('0x39')]=_['keys'](_0x130ee1[_0xdb99('0x39')]);_0x5d2faa[_0xdb99('0x3a')]=_[_0xdb99('0x3b')](_0x5d2faa['model'],_0x5d2faa[_0xdb99('0x39')]);_0x187ecc['attributes']=_[_0xdb99('0x3b')](_0x5d2faa[_0xdb99('0x38')],qs[_0xdb99('0x3c')](_0x130ee1[_0xdb99('0x39')]['fields']));_0x187ecc['attributes']=_0x187ecc[_0xdb99('0x3d')][_0xdb99('0x3e')]?_0x187ecc[_0xdb99('0x3d')]:_0x5d2faa[_0xdb99('0x38')];if(!_0x130ee1[_0xdb99('0x39')][_0xdb99('0x3f')](_0xdb99('0x40'))){_0x187ecc['limit']=qs[_0xdb99('0x41')](_0x130ee1['query'][_0xdb99('0x41')]);_0x187ecc[_0xdb99('0x21')]=qs['offset'](_0x130ee1[_0xdb99('0x39')][_0xdb99('0x21')]);}_0x187ecc[_0xdb99('0x42')]=qs['sort'](_0x130ee1[_0xdb99('0x39')][_0xdb99('0x43')]);_0x187ecc[_0xdb99('0x44')]=qs[_0xdb99('0x3a')](_['pick'](_0x130ee1['query'],_0x5d2faa[_0xdb99('0x3a')]),_0x232cff);if(_0x130ee1[_0xdb99('0x39')][_0xdb99('0x45')]){_0x187ecc[_0xdb99('0x44')]=_[_0xdb99('0x46')](_0x187ecc[_0xdb99('0x44')],{'$or':_[_0xdb99('0x32')](_0x232cff,function(_0x586b4f){if(_0x586b4f[_0xdb99('0x36')]!==_0xdb99('0x47')){var _0x2737bf={};_0x2737bf[_0x586b4f[_0xdb99('0x2f')]]={'$like':'%'+_0x130ee1[_0xdb99('0x39')]['filter']+'%'};return _0x2737bf;}})});}_0x187ecc=_[_0xdb99('0x46')]({},_0x187ecc,_0x130ee1[_0xdb99('0x48')]);var _0x1f7803={'where':_0x187ecc[_0xdb99('0x44')]};return db['Dashboard'][_0xdb99('0x23')](_0x1f7803)[_0xdb99('0x28')](function(_0x4d6dba){_0xd96983[_0xdb99('0x23')]=_0x4d6dba;if(_0x130ee1[_0xdb99('0x39')][_0xdb99('0x49')]){_0x187ecc[_0xdb99('0x4a')]=[{'all':!![]}];}return db[_0xdb99('0x33')][_0xdb99('0x4b')](_0x187ecc);})['then'](function(_0x1d9895){_0xd96983[_0xdb99('0x4c')]=_0x1d9895;return _0xd96983;})[_0xdb99('0x28')](respondWithFilteredResult(_0x1b8c57,_0x187ecc))[_0xdb99('0x4d')](handleError(_0x1b8c57,null));};exports[_0xdb99('0x4e')]=function(_0x2172a9,_0x5d232e){var _0x4cd561={'raw':![],'where':{'id':_0x2172a9[_0xdb99('0x4f')]['id']}},_0x5c051e={};_0x5c051e['model']=_[_0xdb99('0x50')](db[_0xdb99('0x33')]['rawAttributes']);_0x5c051e[_0xdb99('0x39')]=_[_0xdb99('0x50')](_0x2172a9[_0xdb99('0x39')]);_0x5c051e[_0xdb99('0x3a')]=_[_0xdb99('0x3b')](_0x5c051e[_0xdb99('0x38')],_0x5c051e[_0xdb99('0x39')]);_0x4cd561['attributes']=_['intersection'](_0x5c051e[_0xdb99('0x38')],qs[_0xdb99('0x3c')](_0x2172a9['query'][_0xdb99('0x3c')]));_0x4cd561[_0xdb99('0x3d')]=_0x4cd561[_0xdb99('0x3d')][_0xdb99('0x3e')]?_0x4cd561[_0xdb99('0x3d')]:_0x5c051e[_0xdb99('0x38')];if(_0x2172a9[_0xdb99('0x39')]['includeAll']){_0x4cd561[_0xdb99('0x4a')]=[{'all':!![]}];}_0x4cd561=_['merge']({},_0x4cd561,_0x2172a9['options']);return db['Dashboard']['find'](_0x4cd561)[_0xdb99('0x28')](handleEntityNotFound(_0x5d232e,null))['then'](respondWithResult(_0x5d232e,null))[_0xdb99('0x4d')](handleError(_0x5d232e,null));};exports[_0xdb99('0x51')]=function(_0x50e7b5,_0x40a41c){return db[_0xdb99('0x33')][_0xdb99('0x51')](_0x50e7b5[_0xdb99('0x52')],{})[_0xdb99('0x28')](function(_0x46df96){var _0x1fd2db=_0x50e7b5[_0xdb99('0x53')][_0xdb99('0x2a')]({'plain':!![]});if(!_0x1fd2db)throw new Error(_0xdb99('0x54'));if(_0x1fd2db[_0xdb99('0x55')]===_0xdb99('0x53')){var _0xfb7f34=_0x46df96[_0xdb99('0x2a')]({'plain':!![]});var _0x2bc95c='CustomDashboards';return db['UserProfileSection']['find']({'where':{'name':_0x2bc95c,'userProfileId':_0x1fd2db[_0xdb99('0x56')]},'raw':!![]})['then'](function(_0x45d2c3){if(_0x45d2c3&&_0x45d2c3[_0xdb99('0x57')]===0x0){return db[_0xdb99('0x2c')][_0xdb99('0x51')]({'name':_0xfb7f34[_0xdb99('0x2f')],'resourceId':_0xfb7f34['id'],'type':_0x45d2c3[_0xdb99('0x2f')],'sectionId':_0x45d2c3['id']},{})[_0xdb99('0x28')](function(){return _0x46df96;});}else{return _0x46df96;}})[_0xdb99('0x4d')](function(_0x59ddfc){logger[_0xdb99('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59ddfc);throw _0x59ddfc;});}return _0x46df96;})[_0xdb99('0x28')](respondWithResult(_0x40a41c,0xc9))[_0xdb99('0x4d')](handleError(_0x40a41c,null));};exports[_0xdb99('0x58')]=function(_0xc50f4b,_0xe32c3c){var _0x1a9963={'where':{'id':_0xc50f4b[_0xdb99('0x4f')]['id']}},_0x31d5cf={};_0x31d5cf['model']=_[_0xdb99('0x50')](db[_0xdb99('0x33')]['rawAttributes']);_0x1a9963[_0xdb99('0x3d')]=_[_0xdb99('0x3b')](_0x31d5cf['model'],qs['fields'](_0xc50f4b[_0xdb99('0x39')][_0xdb99('0x3c')]));_0x1a9963[_0xdb99('0x3d')]=_0x1a9963['attributes']['length']?_0x1a9963[_0xdb99('0x3d')]:_0x31d5cf['model'];if(_0xc50f4b[_0xdb99('0x39')][_0xdb99('0x49')]){_0x1a9963[_0xdb99('0x4a')]=[{'all':!![]}];}_0x1a9963=_[_0xdb99('0x46')]({},_0x1a9963,_0xc50f4b[_0xdb99('0x48')]);return db[_0xdb99('0x33')]['find'](_0x1a9963)[_0xdb99('0x28')](handleEntityNotFound(_0xe32c3c,null))[_0xdb99('0x28')](function(_0x394586){if(_0x394586){var _0x3bbef8=_0x394586[_0xdb99('0x2a')]({'plain':!![]});_0x3bbef8=qs[_0xdb99('0x59')](_0x3bbef8,['id',_0xdb99('0x5a'),_0xdb99('0x5b')]);_0xc50f4b[_0xdb99('0x52')]=_['omit'](_0xc50f4b[_0xdb99('0x52')],['id',_0xdb99('0x5a'),_0xdb99('0x5b')]);return db[_0xdb99('0x33')][_0xdb99('0x51')](_[_0xdb99('0x46')](_0x3bbef8,_0xc50f4b['body']),{'include':_0xc50f4b[_0xdb99('0x39')][_0xdb99('0x49')]?[{'all':!![]}]:undefined})[_0xdb99('0x28')](function(_0x8a04ec){var _0x34258c=_0xc50f4b[_0xdb99('0x53')][_0xdb99('0x2a')]({'plain':!![]});if(!_0x34258c)throw new Error(_0xdb99('0x54'));if(_0x34258c[_0xdb99('0x55')]==='user'){var _0x479bfe=_0x8a04ec[_0xdb99('0x2a')]({'plain':!![]});var _0xecc24b='CustomDashboards';return db['UserProfileSection']['find']({'where':{'name':_0xecc24b,'userProfileId':_0x34258c[_0xdb99('0x56')]},'raw':!![]})[_0xdb99('0x28')](function(_0x3e960a){if(_0x3e960a&&_0x3e960a['autoAssociation']===0x0){return db[_0xdb99('0x2c')][_0xdb99('0x51')]({'name':_0x479bfe[_0xdb99('0x2f')],'resourceId':_0x479bfe['id'],'type':_0x3e960a[_0xdb99('0x2f')],'sectionId':_0x3e960a['id']},{})[_0xdb99('0x28')](function(){return _0x8a04ec;});}else{return _0x8a04ec;}})[_0xdb99('0x4d')](function(_0x1a9709){logger[_0xdb99('0x2d')](_0xdb99('0x5c'),_0x1a9709);throw _0x1a9709;});}return _0x8a04ec;});}})[_0xdb99('0x28')](respondWithResult(_0xe32c3c,0xc9))['catch'](handleError(_0xe32c3c,null));};exports['update']=function(_0x475819,_0x31bbf6){if(_0x475819[_0xdb99('0x52')]['id']){delete _0x475819[_0xdb99('0x52')]['id'];}return db[_0xdb99('0x33')][_0xdb99('0x5d')]({'where':{'id':_0x475819[_0xdb99('0x4f')]['id']}})[_0xdb99('0x28')](handleEntityNotFound(_0x31bbf6,null))[_0xdb99('0x28')](saveUpdates(_0x475819[_0xdb99('0x52')],null))['then'](respondWithResult(_0x31bbf6,null))['catch'](handleError(_0x31bbf6,null));};exports[_0xdb99('0x29')]=function(_0x534683,_0x524c05){return db[_0xdb99('0x33')][_0xdb99('0x5d')]({'where':{'id':_0x534683[_0xdb99('0x4f')]['id']}})[_0xdb99('0x28')](handleEntityNotFound(_0x524c05,null))[_0xdb99('0x28')](removeEntity(_0x524c05,null))[_0xdb99('0x4d')](handleError(_0x524c05,null));};function widgetAttributes(_0x548a46){try{switch(_0x548a46[_0xdb99('0x36')]){case _0xdb99('0x5e'):return[{'name':'attrUrl','value':_0x548a46[_0xdb99('0x5f')]||(_0x548a46[_0xdb99('0x60')]&&_0x548a46[_0xdb99('0x60')][0x0]?_0x548a46[_0xdb99('0x60')][0x0][_0xdb99('0x61')]:undefined)||'https://'}];case _0xdb99('0x62'):return[{'name':_0xdb99('0x63'),'value':_0x548a46['attrPath']||(_0x548a46[_0xdb99('0x60')]&&_0x548a46[_0xdb99('0x60')][0x0]?_0x548a46['attrs'][0x0][_0xdb99('0x61')]:undefined)||''}];case'clock':return[{'name':_0xdb99('0x64'),'value':_0x548a46[_0xdb99('0x64')]||(_0x548a46[_0xdb99('0x60')]&&_0x548a46[_0xdb99('0x60')][0x0]?_0x548a46[_0xdb99('0x60')][0x0]['value']:undefined)||_0xdb99('0x65')},{'name':_0xdb99('0x66'),'value':_0x548a46[_0xdb99('0x66')]||(_0x548a46['attrs']&&_0x548a46[_0xdb99('0x60')][0x1]?_0x548a46['attrs'][0x1][_0xdb99('0x61')]:undefined)||_0xdb99('0x67')},{'name':_0xdb99('0x68'),'value':_0x548a46[_0xdb99('0x68')]||(_0x548a46[_0xdb99('0x60')]&&_0x548a46[_0xdb99('0x60')][0x2]?_0x548a46[_0xdb99('0x60')][0x2][_0xdb99('0x61')]:undefined)||0xc}];case _0xdb99('0x69'):return[{'name':_0xdb99('0x6a'),'value':_0x548a46['attrMetric']||(_0x548a46[_0xdb99('0x60')]&&_0x548a46['attrs'][0x0]?_0x548a46[_0xdb99('0x60')][0x0][_0xdb99('0x61')]:undefined)||_0xdb99('0x6b')},{'name':_0xdb99('0x6c'),'value':_0x548a46[_0xdb99('0x6c')]||(_0x548a46[_0xdb99('0x60')]&&_0x548a46[_0xdb99('0x60')][0x1]?_0x548a46[_0xdb99('0x60')][0x1][_0xdb99('0x61')]:undefined)||[]},{'name':_0xdb99('0x68'),'value':_0x548a46[_0xdb99('0x68')]||(_0x548a46[_0xdb99('0x60')]&&_0x548a46[_0xdb99('0x60')][0x2]?_0x548a46[_0xdb99('0x60')][0x2][_0xdb99('0x61')]:undefined)||0x14},{'name':'attrChannel','value':_0x548a46['attrChannel']||(_0x548a46['attrs']&&_0x548a46[_0xdb99('0x60')][0x3]?_0x548a46[_0xdb99('0x60')][0x3][_0xdb99('0x61')]:undefined)||_0xdb99('0x6d')},{'name':'attrEmailAccounts','value':_0x548a46[_0xdb99('0x6e')]||(_0x548a46[_0xdb99('0x60')]&&_0x548a46[_0xdb99('0x60')][0x4]?_0x548a46['attrs'][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x548a46[_0xdb99('0x6f')]||(_0x548a46[_0xdb99('0x60')]&&_0x548a46[_0xdb99('0x60')][0x5]?_0x548a46[_0xdb99('0x60')][0x5]['value']:undefined)||''},{'name':_0xdb99('0x70'),'value':_0x548a46[_0xdb99('0x70')]||(_0x548a46['attrs']&&_0x548a46[_0xdb99('0x60')][0x6]?_0x548a46['attrs'][0x6][_0xdb99('0x61')]:undefined)||''},{'name':_0xdb99('0x71'),'value':_0x548a46[_0xdb99('0x71')]||(_0x548a46[_0xdb99('0x60')]&&_0x548a46['attrs'][0x7]?_0x548a46['attrs'][0x7][_0xdb99('0x61')]:undefined)||''},{'name':_0xdb99('0x72'),'value':_0x548a46['attrWhatsappAccounts']||(_0x548a46[_0xdb99('0x60')]&&_0x548a46[_0xdb99('0x60')][0x8]?_0x548a46[_0xdb99('0x60')][0x8]['value']:undefined)||''},{'name':_0xdb99('0x73'),'value':_0x548a46['attrChatWebsites']||(_0x548a46['attrs']&&_0x548a46[_0xdb99('0x60')][0x9]?_0x548a46['attrs'][0x9][_0xdb99('0x61')]:undefined)||''}];case'multibar-chart':case _0xdb99('0x74'):return[{'name':_0xdb99('0x75'),'value':_0x548a46['attrSerie1']||(_0x548a46[_0xdb99('0x60')]&&_0x548a46['attrs'][0x0]?_0x548a46[_0xdb99('0x60')][0x0][_0xdb99('0x61')]:undefined)||_0xdb99('0x6b')},{'name':'attrSerie2','value':_0x548a46['attrSerie2']||(_0x548a46['attrs']&&_0x548a46[_0xdb99('0x60')][0x1]?_0x548a46['attrs'][0x1][_0xdb99('0x61')]:undefined)||null},{'name':_0xdb99('0x76'),'value':_0x548a46[_0xdb99('0x76')]||(_0x548a46['attrs']&&_0x548a46['attrs'][0x2]?_0x548a46[_0xdb99('0x60')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x548a46[_0xdb99('0x6c')]||(_0x548a46['attrs']&&_0x548a46[_0xdb99('0x60')][0x3]?_0x548a46[_0xdb99('0x60')][0x3]['value']:undefined)||[]},{'name':_0xdb99('0x77'),'value':_0x548a46['attrChannel']||(_0x548a46[_0xdb99('0x60')]&&_0x548a46[_0xdb99('0x60')][0x4]?_0x548a46['attrs'][0x4]['value']:undefined)||_0xdb99('0x6d')},{'name':_0xdb99('0x6e'),'value':_0x548a46[_0xdb99('0x6e')]||(_0x548a46['attrs']&&_0x548a46[_0xdb99('0x60')][0x5]?_0x548a46[_0xdb99('0x60')][0x5][_0xdb99('0x61')]:undefined)||''},{'name':_0xdb99('0x6f'),'value':_0x548a46[_0xdb99('0x6f')]||(_0x548a46[_0xdb99('0x60')]&&_0x548a46[_0xdb99('0x60')][0x6]?_0x548a46[_0xdb99('0x60')][0x6][_0xdb99('0x61')]:undefined)||''},{'name':_0xdb99('0x70'),'value':_0x548a46[_0xdb99('0x70')]||(_0x548a46[_0xdb99('0x60')]&&_0x548a46[_0xdb99('0x60')][0x7]?_0x548a46[_0xdb99('0x60')][0x7][_0xdb99('0x61')]:undefined)||''},{'name':_0xdb99('0x71'),'value':_0x548a46[_0xdb99('0x71')]||(_0x548a46['attrs']&&_0x548a46['attrs'][0x8]?_0x548a46['attrs'][0x8][_0xdb99('0x61')]:undefined)||''},{'name':_0xdb99('0x72'),'value':_0x548a46[_0xdb99('0x72')]||(_0x548a46[_0xdb99('0x60')]&&_0x548a46[_0xdb99('0x60')][0x9]?_0x548a46['attrs'][0x9][_0xdb99('0x61')]:undefined)||''},{'name':'attrChatWebsites','value':_0x548a46[_0xdb99('0x73')]||(_0x548a46[_0xdb99('0x60')]&&_0x548a46[_0xdb99('0x60')][0xa]?_0x548a46[_0xdb99('0x60')][0xa][_0xdb99('0x61')]:undefined)||''}];case _0xdb99('0x78'):return[{'name':_0xdb99('0x79'),'type':_0x548a46['reportType']||(_0x548a46[_0xdb99('0x60')]&&_0x548a46[_0xdb99('0x60')][0x0]?_0x548a46[_0xdb99('0x60')][0x0][_0xdb99('0x36')]:undefined)||null,'value':_0x548a46[_0xdb99('0x79')]||(_0x548a46[_0xdb99('0x60')]&&_0x548a46[_0xdb99('0x60')][0x0]?_0x548a46[_0xdb99('0x60')][0x0]['value']:undefined)||null},{'name':_0xdb99('0x7a'),'value':_0x548a46[_0xdb99('0x7a')]||(_0x548a46[_0xdb99('0x60')]&&_0x548a46[_0xdb99('0x60')][0x1]?_0x548a46['attrs'][0x1][_0xdb99('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x5b626c){logger[_0xdb99('0x2d')](_0xdb99('0x7b'),JSON[_0xdb99('0x7c')](_0x5b626c));return[];}}exports[_0xdb99('0x7d')]=function(_0x3942fd,_0x174df5,_0x20594b){if(_0x3942fd['body']['id']){delete _0x3942fd['body']['id'];}return db[_0xdb99('0x33')][_0xdb99('0x5d')]({'where':{'id':_0x3942fd[_0xdb99('0x4f')]['id']}})[_0xdb99('0x28')](handleEntityNotFound(_0x174df5,null))[_0xdb99('0x28')](function(_0xaad4d5){if(_0xaad4d5){_0x3942fd[_0xdb99('0x52')]['DashboardId']=_0xaad4d5['id'];_0x3942fd['body']['attrs']=widgetAttributes(_0x3942fd[_0xdb99('0x52')]);return db['DashboardItem'][_0xdb99('0x51')](_0x3942fd[_0xdb99('0x52')]);}})[_0xdb99('0x28')](respondWithResult(_0x174df5,null))[_0xdb99('0x4d')](handleError(_0x174df5,null));};exports[_0xdb99('0x7e')]=function(_0x13ff34,_0x4408f1,_0x556144){var _0x866007={};var _0x5f3e1e={};var _0x355f79;var _0x35872c;return db[_0xdb99('0x33')]['findOne']({'where':{'id':_0x13ff34[_0xdb99('0x4f')]['id']}})[_0xdb99('0x28')](handleEntityNotFound(_0x4408f1,null))[_0xdb99('0x28')](function(_0x3b9e8f){if(_0x3b9e8f){_0x355f79=_0x3b9e8f;_0x5f3e1e['model']=_[_0xdb99('0x50')](db[_0xdb99('0x7f')][_0xdb99('0x34')]);_0x5f3e1e[_0xdb99('0x39')]=_[_0xdb99('0x50')](_0x13ff34[_0xdb99('0x39')]);_0x5f3e1e[_0xdb99('0x3a')]=_[_0xdb99('0x3b')](_0x5f3e1e['model'],_0x5f3e1e[_0xdb99('0x39')]);_0x866007[_0xdb99('0x3d')]=_['intersection'](_0x5f3e1e[_0xdb99('0x38')],qs[_0xdb99('0x3c')](_0x13ff34[_0xdb99('0x39')]['fields']));_0x866007[_0xdb99('0x3d')]=_0x866007[_0xdb99('0x3d')][_0xdb99('0x3e')]?_0x866007[_0xdb99('0x3d')]:_0x5f3e1e[_0xdb99('0x38')];_0x866007['order']=qs[_0xdb99('0x43')](_0x13ff34[_0xdb99('0x39')][_0xdb99('0x43')]);_0x866007[_0xdb99('0x44')]=qs[_0xdb99('0x3a')](_[_0xdb99('0x80')](_0x13ff34[_0xdb99('0x39')],_0x5f3e1e[_0xdb99('0x3a')]));if(_0x13ff34['query']['filter']){_0x866007[_0xdb99('0x44')]=_['merge'](_0x866007[_0xdb99('0x44')],{'$or':_['map'](_0x866007[_0xdb99('0x3d')],function(_0x3c006a){var _0x437a7f={};_0x437a7f[_0x3c006a]={'$like':'%'+_0x13ff34[_0xdb99('0x39')][_0xdb99('0x45')]+'%'};return _0x437a7f;})});}_0x866007=_[_0xdb99('0x46')]({},_0x866007,_0x13ff34[_0xdb99('0x48')]);return _0x355f79[_0xdb99('0x7e')](_0x866007);}})[_0xdb99('0x28')](function(_0x5dd417){if(_0x5dd417){_0x35872c=_0x5dd417['length'];if(!_0x13ff34[_0xdb99('0x39')]['hasOwnProperty'](_0xdb99('0x40'))){_0x866007[_0xdb99('0x41')]=qs[_0xdb99('0x41')](_0x13ff34['query']['limit']);_0x866007['offset']=qs['offset'](_0x13ff34[_0xdb99('0x39')]['offset']);}return _0x355f79[_0xdb99('0x7e')](_0x866007);}})[_0xdb99('0x28')](function(_0x182c7b){if(_0x182c7b){return _0x182c7b?{'count':_0x35872c,'rows':_0x182c7b}:null;}})['then'](respondWithResult(_0x4408f1,null))[_0xdb99('0x4d')](handleError(_0x4408f1,null));}; \ No newline at end of file +var _0x9e8e=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','attrUrl','attrs','value','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrVoiceQueues','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','Dashboard','rawAttributes','fieldName','type','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user'];(function(_0x4328b2,_0x311e15){var _0x4d76d6=function(_0x3eec55){while(--_0x3eec55){_0x4328b2['push'](_0x4328b2['shift']());}};_0x4d76d6(++_0x311e15);}(_0x9e8e,0x132));var _0xe9e8=function(_0x6a386b,_0x563602){_0x6a386b=_0x6a386b-0x0;var _0x4c3e70=_0x9e8e[_0x6a386b];return _0x4c3e70;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9e8('0x0'));var zipdir=require(_0xe9e8('0x1'));var jsonpatch=require(_0xe9e8('0x2'));var rp=require(_0xe9e8('0x3'));var moment=require(_0xe9e8('0x4'));var BPromise=require(_0xe9e8('0x5'));var Mustache=require(_0xe9e8('0x6'));var util=require(_0xe9e8('0x7'));var path=require(_0xe9e8('0x8'));var sox=require(_0xe9e8('0x9'));var csv=require(_0xe9e8('0xa'));var ejs=require(_0xe9e8('0xb'));var fs=require('fs');var fs_extra=require(_0xe9e8('0xc'));var _=require(_0xe9e8('0xd'));var squel=require(_0xe9e8('0xe'));var crypto=require(_0xe9e8('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xe9e8('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe9e8('0x11'));var Papa=require(_0xe9e8('0x12'));var Redis=require(_0xe9e8('0x13'));var authService=require(_0xe9e8('0x14'));var qs=require(_0xe9e8('0x15'));var as=require(_0xe9e8('0x16'));var hardwareService=require(_0xe9e8('0x17'));var logger=require('../../config/logger')(_0xe9e8('0x18'));var utils=require('../../config/utils');var config=require(_0xe9e8('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe9e8('0x1a')]=_[_0xe9e8('0x1b')](config[_0xe9e8('0x1a')],{'host':_0xe9e8('0x1c'),'port':0x18eb});var socket=require(_0xe9e8('0x1d'))(new Redis(config[_0xe9e8('0x1a')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x20ea9b,_0x4029e1){_0x4029e1=_0x4029e1||0xcc;return function(_0x318e9e){if(_0x318e9e){return _0x20ea9b[_0xe9e8('0x1e')](_0x4029e1);}return _0x20ea9b[_0xe9e8('0x1f')](_0x4029e1)[_0xe9e8('0x20')]();};}function respondWithResult(_0x39bc12,_0x4ad1f4){_0x4ad1f4=_0x4ad1f4||0xc8;return function(_0x221fcb){if(_0x221fcb){return _0x39bc12[_0xe9e8('0x1f')](_0x4ad1f4)[_0xe9e8('0x21')](_0x221fcb);}};}function respondWithFilteredResult(_0xf7619d,_0x1ffc74){return function(_0x2b15a1){if(_0x2b15a1){var _0x39ff66=typeof _0x1ffc74['offset']==='undefined'&&typeof _0x1ffc74['limit']===_0xe9e8('0x22');var _0x3494a8=_0x2b15a1['count'];var _0x3f103e=_0x39ff66?0x0:_0x1ffc74[_0xe9e8('0x23')];var _0x147fca=_0x39ff66?_0x2b15a1[_0xe9e8('0x24')]:_0x1ffc74[_0xe9e8('0x23')]+_0x1ffc74[_0xe9e8('0x25')];var _0x49f641;if(_0x147fca>=_0x3494a8){_0x147fca=_0x3494a8;_0x49f641=0xc8;}else{_0x49f641=0xce;}_0xf7619d[_0xe9e8('0x1f')](_0x49f641);return _0xf7619d[_0xe9e8('0x26')](_0xe9e8('0x27'),_0x3f103e+'-'+_0x147fca+'/'+_0x3494a8)[_0xe9e8('0x21')](_0x2b15a1);}return null;};}function patchUpdates(_0x8f3336){return function(_0x31cbac){try{jsonpatch[_0xe9e8('0x28')](_0x31cbac,_0x8f3336,!![]);}catch(_0x5ef510){return BPromise[_0xe9e8('0x29')](_0x5ef510);}return _0x31cbac[_0xe9e8('0x2a')]();};}function saveUpdates(_0x5d9ff1,_0x4643bf){return function(_0x49ff0b){if(_0x49ff0b){return _0x49ff0b[_0xe9e8('0x2b')](_0x5d9ff1)[_0xe9e8('0x2c')](function(_0x6ec2f3){return _0x6ec2f3;});}return null;};}function removeEntity(_0x43da01,_0x4b55b7){return function(_0x4974a2){if(_0x4974a2){return _0x4974a2[_0xe9e8('0x2d')]()[_0xe9e8('0x2c')](function(){var _0x1e6637=_0x4974a2[_0xe9e8('0x2e')]({'plain':!![]});var _0x55faaf=_0xe9e8('0x2f');return db[_0xe9e8('0x30')][_0xe9e8('0x2d')]({'where':{'type':_0x55faaf,'resourceId':_0x1e6637['id']}})[_0xe9e8('0x2c')](function(){return _0x4974a2;});})['then'](function(){_0x43da01['status'](0xcc)[_0xe9e8('0x20')]();});}};}function handleEntityNotFound(_0x3f0d6e,_0x36223c){return function(_0x258e16){if(!_0x258e16){_0x3f0d6e[_0xe9e8('0x1e')](0x194);}return _0x258e16;};}function handleError(_0xa80179,_0x2736c0){_0x2736c0=_0x2736c0||0x1f4;return function(_0x5d1cc9){logger[_0xe9e8('0x31')](_0x5d1cc9[_0xe9e8('0x32')]);if(_0x5d1cc9[_0xe9e8('0x33')]){delete _0x5d1cc9['name'];}_0xa80179[_0xe9e8('0x1f')](_0x2736c0)[_0xe9e8('0x34')](_0x5d1cc9);};}exports['index']=function(_0x32f22a,_0x34fa52){var _0x28f97d={},_0x273330={},_0x41ebfa={'count':0x0,'rows':[]};var _0x1f2d2a=_['map'](db[_0xe9e8('0x35')][_0xe9e8('0x36')],function(_0x4fbd7a){return{'name':_0x4fbd7a[_0xe9e8('0x37')],'type':_0x4fbd7a[_0xe9e8('0x38')]['key']};});_0x273330['model']=_[_0xe9e8('0x39')](_0x1f2d2a,_0xe9e8('0x33'));_0x273330[_0xe9e8('0x3a')]=_[_0xe9e8('0x3b')](_0x32f22a['query']);_0x273330['filters']=_[_0xe9e8('0x3c')](_0x273330[_0xe9e8('0x3d')],_0x273330['query']);_0x28f97d['attributes']=_[_0xe9e8('0x3c')](_0x273330[_0xe9e8('0x3d')],qs[_0xe9e8('0x3e')](_0x32f22a[_0xe9e8('0x3a')][_0xe9e8('0x3e')]));_0x28f97d[_0xe9e8('0x3f')]=_0x28f97d[_0xe9e8('0x3f')][_0xe9e8('0x40')]?_0x28f97d['attributes']:_0x273330[_0xe9e8('0x3d')];if(!_0x32f22a[_0xe9e8('0x3a')][_0xe9e8('0x41')](_0xe9e8('0x42'))){_0x28f97d[_0xe9e8('0x25')]=qs[_0xe9e8('0x25')](_0x32f22a[_0xe9e8('0x3a')][_0xe9e8('0x25')]);_0x28f97d[_0xe9e8('0x23')]=qs[_0xe9e8('0x23')](_0x32f22a['query'][_0xe9e8('0x23')]);}_0x28f97d[_0xe9e8('0x43')]=qs[_0xe9e8('0x44')](_0x32f22a[_0xe9e8('0x3a')][_0xe9e8('0x44')]);_0x28f97d['where']=qs[_0xe9e8('0x45')](_[_0xe9e8('0x46')](_0x32f22a['query'],_0x273330[_0xe9e8('0x45')]),_0x1f2d2a);if(_0x32f22a[_0xe9e8('0x3a')]['filter']){_0x28f97d['where']=_['merge'](_0x28f97d[_0xe9e8('0x47')],{'$or':_[_0xe9e8('0x39')](_0x1f2d2a,function(_0x19a454){if(_0x19a454[_0xe9e8('0x38')]!==_0xe9e8('0x48')){var _0x4ca144={};_0x4ca144[_0x19a454[_0xe9e8('0x33')]]={'$like':'%'+_0x32f22a['query'][_0xe9e8('0x49')]+'%'};return _0x4ca144;}})});}_0x28f97d=_[_0xe9e8('0x4a')]({},_0x28f97d,_0x32f22a[_0xe9e8('0x4b')]);var _0x34a886={'where':_0x28f97d['where']};return db['Dashboard']['count'](_0x34a886)[_0xe9e8('0x2c')](function(_0x51b22a){_0x41ebfa[_0xe9e8('0x24')]=_0x51b22a;if(_0x32f22a[_0xe9e8('0x3a')][_0xe9e8('0x4c')]){_0x28f97d[_0xe9e8('0x4d')]=[{'all':!![]}];}return db[_0xe9e8('0x35')][_0xe9e8('0x4e')](_0x28f97d);})[_0xe9e8('0x2c')](function(_0xfdc1f7){_0x41ebfa[_0xe9e8('0x4f')]=_0xfdc1f7;return _0x41ebfa;})[_0xe9e8('0x2c')](respondWithFilteredResult(_0x34fa52,_0x28f97d))[_0xe9e8('0x50')](handleError(_0x34fa52,null));};exports[_0xe9e8('0x51')]=function(_0x2be9b7,_0x20d304){var _0x29d081={'raw':![],'where':{'id':_0x2be9b7[_0xe9e8('0x52')]['id']}},_0x175926={};_0x175926['model']=_['keys'](db['Dashboard'][_0xe9e8('0x36')]);_0x175926['query']=_[_0xe9e8('0x3b')](_0x2be9b7[_0xe9e8('0x3a')]);_0x175926['filters']=_[_0xe9e8('0x3c')](_0x175926[_0xe9e8('0x3d')],_0x175926['query']);_0x29d081['attributes']=_['intersection'](_0x175926[_0xe9e8('0x3d')],qs['fields'](_0x2be9b7['query'][_0xe9e8('0x3e')]));_0x29d081['attributes']=_0x29d081[_0xe9e8('0x3f')]['length']?_0x29d081[_0xe9e8('0x3f')]:_0x175926[_0xe9e8('0x3d')];if(_0x2be9b7[_0xe9e8('0x3a')]['includeAll']){_0x29d081['include']=[{'all':!![]}];}_0x29d081=_[_0xe9e8('0x4a')]({},_0x29d081,_0x2be9b7[_0xe9e8('0x4b')]);return db[_0xe9e8('0x35')][_0xe9e8('0x53')](_0x29d081)['then'](handleEntityNotFound(_0x20d304,null))[_0xe9e8('0x2c')](respondWithResult(_0x20d304,null))[_0xe9e8('0x50')](handleError(_0x20d304,null));};exports[_0xe9e8('0x54')]=function(_0x348985,_0x567459){return db['Dashboard'][_0xe9e8('0x54')](_0x348985[_0xe9e8('0x55')],{})[_0xe9e8('0x2c')](function(_0x12ef70){var _0x369e24=_0x348985[_0xe9e8('0x56')][_0xe9e8('0x2e')]({'plain':!![]});if(!_0x369e24)throw new Error(_0xe9e8('0x57'));if(_0x369e24[_0xe9e8('0x58')]==='user'){var _0x23a429=_0x12ef70[_0xe9e8('0x2e')]({'plain':!![]});var _0x46f92f='CustomDashboards';return db[_0xe9e8('0x59')][_0xe9e8('0x53')]({'where':{'name':_0x46f92f,'userProfileId':_0x369e24['userProfileId']},'raw':!![]})[_0xe9e8('0x2c')](function(_0x4de7ba){if(_0x4de7ba&&_0x4de7ba[_0xe9e8('0x5a')]===0x0){return db['UserProfileResource'][_0xe9e8('0x54')]({'name':_0x23a429['name'],'resourceId':_0x23a429['id'],'type':_0x4de7ba[_0xe9e8('0x33')],'sectionId':_0x4de7ba['id']},{})[_0xe9e8('0x2c')](function(){return _0x12ef70;});}else{return _0x12ef70;}})[_0xe9e8('0x50')](function(_0xb1dc0e){logger[_0xe9e8('0x31')](_0xe9e8('0x5b'),_0xb1dc0e);throw _0xb1dc0e;});}return _0x12ef70;})[_0xe9e8('0x2c')](respondWithResult(_0x567459,0xc9))[_0xe9e8('0x50')](handleError(_0x567459,null));};exports[_0xe9e8('0x5c')]=function(_0x3e16a8,_0x4f4c5e){var _0xb32914={'where':{'id':_0x3e16a8['params']['id']}},_0x4614de={};_0x4614de['model']=_[_0xe9e8('0x3b')](db[_0xe9e8('0x35')][_0xe9e8('0x36')]);_0xb32914['attributes']=_[_0xe9e8('0x3c')](_0x4614de[_0xe9e8('0x3d')],qs['fields'](_0x3e16a8[_0xe9e8('0x3a')][_0xe9e8('0x3e')]));_0xb32914[_0xe9e8('0x3f')]=_0xb32914[_0xe9e8('0x3f')][_0xe9e8('0x40')]?_0xb32914[_0xe9e8('0x3f')]:_0x4614de['model'];if(_0x3e16a8[_0xe9e8('0x3a')]['includeAll']){_0xb32914['include']=[{'all':!![]}];}_0xb32914=_[_0xe9e8('0x4a')]({},_0xb32914,_0x3e16a8[_0xe9e8('0x4b')]);return db[_0xe9e8('0x35')][_0xe9e8('0x53')](_0xb32914)[_0xe9e8('0x2c')](handleEntityNotFound(_0x4f4c5e,null))[_0xe9e8('0x2c')](function(_0x21e3b2){if(_0x21e3b2){var _0x2722b3=_0x21e3b2[_0xe9e8('0x2e')]({'plain':!![]});_0x2722b3=qs[_0xe9e8('0x5d')](_0x2722b3,['id',_0xe9e8('0x5e'),_0xe9e8('0x5f')]);_0x3e16a8[_0xe9e8('0x55')]=_[_0xe9e8('0x5d')](_0x3e16a8[_0xe9e8('0x55')],['id','createdAt','updatedAt']);return db['Dashboard']['create'](_[_0xe9e8('0x4a')](_0x2722b3,_0x3e16a8[_0xe9e8('0x55')]),{'include':_0x3e16a8[_0xe9e8('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0xe9e8('0x2c')](function(_0x1c015d){var _0x327873=_0x3e16a8[_0xe9e8('0x56')][_0xe9e8('0x2e')]({'plain':!![]});if(!_0x327873)throw new Error(_0xe9e8('0x57'));if(_0x327873[_0xe9e8('0x58')]===_0xe9e8('0x56')){var _0x242efd=_0x1c015d[_0xe9e8('0x2e')]({'plain':!![]});var _0x1dca15='CustomDashboards';return db['UserProfileSection']['find']({'where':{'name':_0x1dca15,'userProfileId':_0x327873[_0xe9e8('0x60')]},'raw':!![]})[_0xe9e8('0x2c')](function(_0x55826a){if(_0x55826a&&_0x55826a['autoAssociation']===0x0){return db[_0xe9e8('0x30')][_0xe9e8('0x54')]({'name':_0x242efd[_0xe9e8('0x33')],'resourceId':_0x242efd['id'],'type':_0x55826a[_0xe9e8('0x33')],'sectionId':_0x55826a['id']},{})[_0xe9e8('0x2c')](function(){return _0x1c015d;});}else{return _0x1c015d;}})[_0xe9e8('0x50')](function(_0x39b017){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x39b017);throw _0x39b017;});}return _0x1c015d;});}})[_0xe9e8('0x2c')](respondWithResult(_0x4f4c5e,0xc9))['catch'](handleError(_0x4f4c5e,null));};exports['update']=function(_0x4ad91a,_0x173779){if(_0x4ad91a[_0xe9e8('0x55')]['id']){delete _0x4ad91a[_0xe9e8('0x55')]['id'];}return db[_0xe9e8('0x35')]['find']({'where':{'id':_0x4ad91a[_0xe9e8('0x52')]['id']}})['then'](handleEntityNotFound(_0x173779,null))[_0xe9e8('0x2c')](saveUpdates(_0x4ad91a[_0xe9e8('0x55')],null))[_0xe9e8('0x2c')](respondWithResult(_0x173779,null))[_0xe9e8('0x50')](handleError(_0x173779,null));};exports[_0xe9e8('0x2d')]=function(_0x59fb0a,_0x4bc413){return db['Dashboard'][_0xe9e8('0x53')]({'where':{'id':_0x59fb0a['params']['id']}})['then'](handleEntityNotFound(_0x4bc413,null))[_0xe9e8('0x2c')](removeEntity(_0x4bc413,null))[_0xe9e8('0x50')](handleError(_0x4bc413,null));};function widgetAttributes(_0x567ba5){try{switch(_0x567ba5[_0xe9e8('0x38')]){case'iframe':return[{'name':_0xe9e8('0x61'),'value':_0x567ba5[_0xe9e8('0x61')]||(_0x567ba5[_0xe9e8('0x62')]&&_0x567ba5[_0xe9e8('0x62')][0x0]?_0x567ba5['attrs'][0x0][_0xe9e8('0x63')]:undefined)||'https://'}];case'custom':return[{'name':_0xe9e8('0x64'),'value':_0x567ba5['attrPath']||(_0x567ba5['attrs']&&_0x567ba5['attrs'][0x0]?_0x567ba5[_0xe9e8('0x62')][0x0]['value']:undefined)||''}];case _0xe9e8('0x65'):return[{'name':_0xe9e8('0x66'),'value':_0x567ba5[_0xe9e8('0x66')]||(_0x567ba5[_0xe9e8('0x62')]&&_0x567ba5[_0xe9e8('0x62')][0x0]?_0x567ba5[_0xe9e8('0x62')][0x0][_0xe9e8('0x63')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x567ba5[_0xe9e8('0x67')]||(_0x567ba5[_0xe9e8('0x62')]&&_0x567ba5['attrs'][0x1]?_0x567ba5[_0xe9e8('0x62')][0x1][_0xe9e8('0x63')]:undefined)||_0xe9e8('0x68')},{'name':_0xe9e8('0x69'),'value':_0x567ba5[_0xe9e8('0x69')]||(_0x567ba5['attrs']&&_0x567ba5[_0xe9e8('0x62')][0x2]?_0x567ba5[_0xe9e8('0x62')][0x2][_0xe9e8('0x63')]:undefined)||0xc}];case'counter':return[{'name':_0xe9e8('0x6a'),'value':_0x567ba5[_0xe9e8('0x6a')]||(_0x567ba5[_0xe9e8('0x62')]&&_0x567ba5['attrs'][0x0]?_0x567ba5['attrs'][0x0][_0xe9e8('0x63')]:undefined)||_0xe9e8('0x6b')},{'name':'attrVoiceQueues','value':_0x567ba5['attrVoiceQueues']||(_0x567ba5[_0xe9e8('0x62')]&&_0x567ba5['attrs'][0x1]?_0x567ba5[_0xe9e8('0x62')][0x1][_0xe9e8('0x63')]:undefined)||[]},{'name':_0xe9e8('0x69'),'value':_0x567ba5[_0xe9e8('0x69')]||(_0x567ba5['attrs']&&_0x567ba5[_0xe9e8('0x62')][0x2]?_0x567ba5[_0xe9e8('0x62')][0x2][_0xe9e8('0x63')]:undefined)||0x14},{'name':_0xe9e8('0x6c'),'value':_0x567ba5[_0xe9e8('0x6c')]||(_0x567ba5['attrs']&&_0x567ba5[_0xe9e8('0x62')][0x3]?_0x567ba5['attrs'][0x3][_0xe9e8('0x63')]:undefined)||_0xe9e8('0x6d')},{'name':_0xe9e8('0x6e'),'value':_0x567ba5[_0xe9e8('0x6e')]||(_0x567ba5[_0xe9e8('0x62')]&&_0x567ba5[_0xe9e8('0x62')][0x4]?_0x567ba5['attrs'][0x4][_0xe9e8('0x63')]:undefined)||''},{'name':_0xe9e8('0x6f'),'value':_0x567ba5[_0xe9e8('0x6f')]||(_0x567ba5[_0xe9e8('0x62')]&&_0x567ba5[_0xe9e8('0x62')][0x5]?_0x567ba5['attrs'][0x5]['value']:undefined)||''},{'name':_0xe9e8('0x70'),'value':_0x567ba5['attrSmsAccounts']||(_0x567ba5[_0xe9e8('0x62')]&&_0x567ba5[_0xe9e8('0x62')][0x6]?_0x567ba5[_0xe9e8('0x62')][0x6]['value']:undefined)||''},{'name':_0xe9e8('0x71'),'value':_0x567ba5[_0xe9e8('0x71')]||(_0x567ba5[_0xe9e8('0x62')]&&_0x567ba5[_0xe9e8('0x62')][0x7]?_0x567ba5['attrs'][0x7][_0xe9e8('0x63')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x567ba5[_0xe9e8('0x72')]||(_0x567ba5['attrs']&&_0x567ba5[_0xe9e8('0x62')][0x8]?_0x567ba5[_0xe9e8('0x62')][0x8][_0xe9e8('0x63')]:undefined)||''},{'name':_0xe9e8('0x73'),'value':_0x567ba5[_0xe9e8('0x73')]||(_0x567ba5['attrs']&&_0x567ba5[_0xe9e8('0x62')][0x9]?_0x567ba5[_0xe9e8('0x62')][0x9]['value']:undefined)||''}];case _0xe9e8('0x74'):case _0xe9e8('0x75'):return[{'name':_0xe9e8('0x76'),'value':_0x567ba5[_0xe9e8('0x76')]||(_0x567ba5[_0xe9e8('0x62')]&&_0x567ba5[_0xe9e8('0x62')][0x0]?_0x567ba5[_0xe9e8('0x62')][0x0][_0xe9e8('0x63')]:undefined)||_0xe9e8('0x6b')},{'name':_0xe9e8('0x77'),'value':_0x567ba5[_0xe9e8('0x77')]||(_0x567ba5['attrs']&&_0x567ba5['attrs'][0x1]?_0x567ba5[_0xe9e8('0x62')][0x1][_0xe9e8('0x63')]:undefined)||null},{'name':'attrSerie3','value':_0x567ba5['attrSerie3']||(_0x567ba5[_0xe9e8('0x62')]&&_0x567ba5[_0xe9e8('0x62')][0x2]?_0x567ba5['attrs'][0x2][_0xe9e8('0x63')]:undefined)||null},{'name':_0xe9e8('0x78'),'value':_0x567ba5[_0xe9e8('0x78')]||(_0x567ba5[_0xe9e8('0x62')]&&_0x567ba5['attrs'][0x3]?_0x567ba5[_0xe9e8('0x62')][0x3][_0xe9e8('0x63')]:undefined)||[]},{'name':_0xe9e8('0x6c'),'value':_0x567ba5[_0xe9e8('0x6c')]||(_0x567ba5[_0xe9e8('0x62')]&&_0x567ba5['attrs'][0x4]?_0x567ba5[_0xe9e8('0x62')][0x4][_0xe9e8('0x63')]:undefined)||_0xe9e8('0x6d')},{'name':_0xe9e8('0x6e'),'value':_0x567ba5['attrEmailAccounts']||(_0x567ba5['attrs']&&_0x567ba5[_0xe9e8('0x62')][0x5]?_0x567ba5[_0xe9e8('0x62')][0x5]['value']:undefined)||''},{'name':_0xe9e8('0x6f'),'value':_0x567ba5[_0xe9e8('0x6f')]||(_0x567ba5[_0xe9e8('0x62')]&&_0x567ba5[_0xe9e8('0x62')][0x6]?_0x567ba5[_0xe9e8('0x62')][0x6][_0xe9e8('0x63')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x567ba5[_0xe9e8('0x70')]||(_0x567ba5[_0xe9e8('0x62')]&&_0x567ba5[_0xe9e8('0x62')][0x7]?_0x567ba5[_0xe9e8('0x62')][0x7]['value']:undefined)||''},{'name':_0xe9e8('0x71'),'value':_0x567ba5['attrOpenchannelAccounts']||(_0x567ba5[_0xe9e8('0x62')]&&_0x567ba5['attrs'][0x8]?_0x567ba5[_0xe9e8('0x62')][0x8][_0xe9e8('0x63')]:undefined)||''},{'name':_0xe9e8('0x72'),'value':_0x567ba5[_0xe9e8('0x72')]||(_0x567ba5['attrs']&&_0x567ba5[_0xe9e8('0x62')][0x9]?_0x567ba5['attrs'][0x9][_0xe9e8('0x63')]:undefined)||''},{'name':_0xe9e8('0x73'),'value':_0x567ba5[_0xe9e8('0x73')]||(_0x567ba5['attrs']&&_0x567ba5['attrs'][0xa]?_0x567ba5[_0xe9e8('0x62')][0xa][_0xe9e8('0x63')]:undefined)||''}];case _0xe9e8('0x79'):return[{'name':_0xe9e8('0x7a'),'type':_0x567ba5[_0xe9e8('0x7b')]||(_0x567ba5['attrs']&&_0x567ba5[_0xe9e8('0x62')][0x0]?_0x567ba5[_0xe9e8('0x62')][0x0]['type']:undefined)||null,'value':_0x567ba5[_0xe9e8('0x7a')]||(_0x567ba5[_0xe9e8('0x62')]&&_0x567ba5[_0xe9e8('0x62')][0x0]?_0x567ba5['attrs'][0x0][_0xe9e8('0x63')]:undefined)||null},{'name':_0xe9e8('0x7c'),'value':_0x567ba5[_0xe9e8('0x7c')]||(_0x567ba5[_0xe9e8('0x62')]&&_0x567ba5['attrs'][0x1]?_0x567ba5['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x425caa){logger[_0xe9e8('0x31')](_0xe9e8('0x7d'),JSON[_0xe9e8('0x7e')](_0x425caa));return[];}}exports[_0xe9e8('0x7f')]=function(_0x3d6e4f,_0x1494e8,_0x51c42b){if(_0x3d6e4f[_0xe9e8('0x55')]['id']){delete _0x3d6e4f['body']['id'];}return db[_0xe9e8('0x35')][_0xe9e8('0x53')]({'where':{'id':_0x3d6e4f[_0xe9e8('0x52')]['id']}})[_0xe9e8('0x2c')](handleEntityNotFound(_0x1494e8,null))[_0xe9e8('0x2c')](function(_0x34dd78){if(_0x34dd78){_0x3d6e4f[_0xe9e8('0x55')][_0xe9e8('0x80')]=_0x34dd78['id'];_0x3d6e4f[_0xe9e8('0x55')]['attrs']=widgetAttributes(_0x3d6e4f[_0xe9e8('0x55')]);return db['DashboardItem'][_0xe9e8('0x54')](_0x3d6e4f['body']);}})[_0xe9e8('0x2c')](respondWithResult(_0x1494e8,null))[_0xe9e8('0x50')](handleError(_0x1494e8,null));};exports[_0xe9e8('0x81')]=function(_0x5f1483,_0x53e2bd,_0x26df47){var _0x12d882={};var _0xb7b974={};var _0x39382f;var _0x356f94;return db[_0xe9e8('0x35')][_0xe9e8('0x82')]({'where':{'id':_0x5f1483[_0xe9e8('0x52')]['id']}})[_0xe9e8('0x2c')](handleEntityNotFound(_0x53e2bd,null))[_0xe9e8('0x2c')](function(_0x4ede0d){if(_0x4ede0d){_0x39382f=_0x4ede0d;_0xb7b974[_0xe9e8('0x3d')]=_[_0xe9e8('0x3b')](db['DashboardItem']['rawAttributes']);_0xb7b974[_0xe9e8('0x3a')]=_[_0xe9e8('0x3b')](_0x5f1483[_0xe9e8('0x3a')]);_0xb7b974[_0xe9e8('0x45')]=_[_0xe9e8('0x3c')](_0xb7b974[_0xe9e8('0x3d')],_0xb7b974['query']);_0x12d882[_0xe9e8('0x3f')]=_[_0xe9e8('0x3c')](_0xb7b974[_0xe9e8('0x3d')],qs['fields'](_0x5f1483['query'][_0xe9e8('0x3e')]));_0x12d882['attributes']=_0x12d882['attributes'][_0xe9e8('0x40')]?_0x12d882['attributes']:_0xb7b974['model'];_0x12d882['order']=qs['sort'](_0x5f1483[_0xe9e8('0x3a')][_0xe9e8('0x44')]);_0x12d882[_0xe9e8('0x47')]=qs['filters'](_[_0xe9e8('0x46')](_0x5f1483[_0xe9e8('0x3a')],_0xb7b974[_0xe9e8('0x45')]));if(_0x5f1483['query'][_0xe9e8('0x49')]){_0x12d882[_0xe9e8('0x47')]=_[_0xe9e8('0x4a')](_0x12d882['where'],{'$or':_[_0xe9e8('0x39')](_0x12d882[_0xe9e8('0x3f')],function(_0x511ec7){var _0x24a9cc={};_0x24a9cc[_0x511ec7]={'$like':'%'+_0x5f1483[_0xe9e8('0x3a')]['filter']+'%'};return _0x24a9cc;})});}_0x12d882=_[_0xe9e8('0x4a')]({},_0x12d882,_0x5f1483[_0xe9e8('0x4b')]);return _0x39382f[_0xe9e8('0x81')](_0x12d882);}})[_0xe9e8('0x2c')](function(_0x3a26d4){if(_0x3a26d4){_0x356f94=_0x3a26d4[_0xe9e8('0x40')];if(!_0x5f1483['query'][_0xe9e8('0x41')]('nolimit')){_0x12d882[_0xe9e8('0x25')]=qs['limit'](_0x5f1483[_0xe9e8('0x3a')][_0xe9e8('0x25')]);_0x12d882[_0xe9e8('0x23')]=qs[_0xe9e8('0x23')](_0x5f1483[_0xe9e8('0x3a')][_0xe9e8('0x23')]);}return _0x39382f[_0xe9e8('0x81')](_0x12d882);}})['then'](function(_0x29ef05){if(_0x29ef05){return _0x29ef05?{'count':_0x356f94,'rows':_0x29ef05}:null;}})['then'](respondWithResult(_0x53e2bd,null))[_0xe9e8('0x50')](handleError(_0x53e2bd,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 3889db3..1d4ad19 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 _0x0a4d=['hook','exports','../../mysqldb','Dashboard','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x1eb5d2,_0x5b27f6){var _0x3c4cc7=function(_0x317588){while(--_0x317588){_0x1eb5d2['push'](_0x1eb5d2['shift']());}};_0x3c4cc7(++_0x5b27f6);}(_0x0a4d,0xad));var _0xd0a4=function(_0x2f47e2,_0x100a2a){_0x2f47e2=_0x2f47e2-0x0;var _0xce5c0a=_0x0a4d[_0x2f47e2];return _0xce5c0a;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xd0a4('0x0'))['db'][_0xd0a4('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xd0a4('0x2')](0x0);var events={'afterCreate':_0xd0a4('0x3'),'afterUpdate':'update','afterDestroy':_0xd0a4('0x4')};function emitEvent(_0x49d978){return function(_0x350de7,_0x48585e,_0x3d120b){DashboardEvents[_0xd0a4('0x5')](_0x49d978+':'+_0x350de7['id'],_0x350de7);DashboardEvents[_0xd0a4('0x5')](_0x49d978,_0x350de7);_0x3d120b(null);};}for(var e in events){if(events[_0xd0a4('0x6')](e)){var event=events[e];Dashboard[_0xd0a4('0x7')](e,emitEvent(event));}}module[_0xd0a4('0x8')]=DashboardEvents; \ No newline at end of file +var _0x41f6=['emit','hasOwnProperty','hook','exports','events','Dashboard','setMaxListeners','save','update'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x41f6,0x94));var _0x641f=function(_0x10c16d,_0x2b3e14){_0x10c16d=_0x10c16d-0x0;var _0x5896f4=_0x41f6[_0x10c16d];return _0x5896f4;};'use strict';var EventEmitter=require(_0x641f('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x641f('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x641f('0x2')](0x0);var events={'afterCreate':_0x641f('0x3'),'afterUpdate':_0x641f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4c8200){return function(_0x4081a8,_0x129e9d,_0x35cf0d){DashboardEvents[_0x641f('0x5')](_0x4c8200+':'+_0x4081a8['id'],_0x4081a8);DashboardEvents[_0x641f('0x5')](_0x4c8200,_0x4081a8);_0x35cf0d(null);};}for(var e in events){if(events[_0x641f('0x6')](e)){var event=events[e];Dashboard[_0x641f('0x7')](e,emitEvent(event));}}module[_0x641f('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 bb8cafa..83e1edc 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 _0xfea4=['dashboards','util','api','path','rimraf','../../config/environment','./dashboard.attributes','define','Dashboard'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xfea4,0x1a8));var _0x4fea=function(_0x2b8077,_0x453634){_0x2b8077=_0x2b8077-0x0;var _0x308091=_0xfea4[_0x2b8077];return _0x308091;};'use strict';var _=require('lodash');var util=require(_0x4fea('0x0'));var logger=require('../../config/logger')(_0x4fea('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4fea('0x2'));var rimraf=require(_0x4fea('0x3'));var config=require(_0x4fea('0x4'));var attributes=require(_0x4fea('0x5'));module['exports']=function(_0xcb4409,_0x3f100b){return _0xcb4409[_0x4fea('0x6')](_0x4fea('0x7'),attributes,{'tableName':_0x4fea('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92d7=['dashboards','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard'];(function(_0x3a541f,_0x210baa){var _0x1e913f=function(_0x47cee1){while(--_0x47cee1){_0x3a541f['push'](_0x3a541f['shift']());}};_0x1e913f(++_0x210baa);}(_0x92d7,0x17b));var _0x792d=function(_0x5bdf39,_0x35883e){_0x5bdf39=_0x5bdf39-0x0;var _0x28eb17=_0x92d7[_0x5bdf39];return _0x28eb17;};'use strict';var _=require(_0x792d('0x0'));var util=require('util');var logger=require(_0x792d('0x1'))(_0x792d('0x2'));var moment=require(_0x792d('0x3'));var BPromise=require(_0x792d('0x4'));var rp=require(_0x792d('0x5'));var fs=require('fs');var path=require(_0x792d('0x6'));var rimraf=require(_0x792d('0x7'));var config=require(_0x792d('0x8'));var attributes=require(_0x792d('0x9'));module[_0x792d('0xa')]=function(_0x54374f,_0x3e95c4){return _0x54374f[_0x792d('0xb')](_0x792d('0xc'),attributes,{'tableName':_0x792d('0xd'),'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 a711641..c81183a 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 _0xa055=['message','Dashboard,\x20%s,\x20%s','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','redis','localhost','./dashboard.socket','register','request','info','request\x20sent','debug','stringify','error','code'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xa055,0x1b9));var _0x5a05=function(_0xb47dc0,_0x407032){_0xb47dc0=_0xb47dc0-0x0;var _0x57f0b0=_0xa055[_0xb47dc0];return _0x57f0b0;};'use strict';var _=require(_0x5a05('0x0'));var util=require(_0x5a05('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5a05('0x2'));var fs=require('fs');var Redis=require(_0x5a05('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5a05('0x4'));var logger=require(_0x5a05('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5a05('0x6'));var client=jayson[_0x5a05('0x7')]['http']({'port':0x232a});config[_0x5a05('0x8')]=_['defaults'](config['redis'],{'host':_0x5a05('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5a05('0x8')]));require(_0x5a05('0xa'))[_0x5a05('0xb')](socket);function respondWithRpcPromise(_0x36cf6d,_0x50cc57,_0xd3adfc){return new BPromise(function(_0xfd4d33,_0x3a84ea){return client[_0x5a05('0xc')](_0x36cf6d,_0xd3adfc)['then'](function(_0x433543){logger[_0x5a05('0xd')]('Dashboard,\x20%s,\x20%s',_0x50cc57,_0x5a05('0xe'));logger[_0x5a05('0xf')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x50cc57,_0x5a05('0xe'),JSON[_0x5a05('0x10')](_0x433543));if(_0x433543['error']){if(_0x433543[_0x5a05('0x11')][_0x5a05('0x12')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x50cc57,_0x433543[_0x5a05('0x11')][_0x5a05('0x13')]);return _0x3a84ea(_0x433543['error']['message']);}logger[_0x5a05('0x11')](_0x5a05('0x14'),_0x50cc57,_0x433543['error'][_0x5a05('0x13')]);return _0xfd4d33(_0x433543[_0x5a05('0x11')]['message']);}else{logger['info'](_0x5a05('0x14'),_0x50cc57,'request\x20sent');_0xfd4d33(_0x433543[_0x5a05('0x15')][_0x5a05('0x13')]);}})[_0x5a05('0x16')](function(_0x65790c){logger[_0x5a05('0x11')](_0x5a05('0x14'),_0x50cc57,_0x65790c);_0x3a84ea(_0x65790c);});});} \ No newline at end of file +var _0x21b4=['info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./dashboard.socket','register','request','then'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x21b4,0x72));var _0x421b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x21b4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x421b('0x0'));var moment=require('moment');var BPromise=require(_0x421b('0x1'));var rs=require(_0x421b('0x2'));var fs=require('fs');var Redis=require(_0x421b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x421b('0x4'));var logger=require(_0x421b('0x5'))('rpc');var config=require(_0x421b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x421b('0x7')][_0x421b('0x8')]({'port':0x232a});config[_0x421b('0x9')]=_[_0x421b('0xa')](config[_0x421b('0x9')],{'host':_0x421b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x421b('0x9')]));require(_0x421b('0xc'))[_0x421b('0xd')](socket);function respondWithRpcPromise(_0x39f1e4,_0x451727,_0x7bceea){return new BPromise(function(_0x59daae,_0x33e18d){return client[_0x421b('0xe')](_0x39f1e4,_0x7bceea)[_0x421b('0xf')](function(_0x3eabff){logger[_0x421b('0x10')](_0x421b('0x11'),_0x451727,_0x421b('0x12'));logger[_0x421b('0x13')](_0x421b('0x14'),_0x451727,_0x421b('0x12'),JSON['stringify'](_0x3eabff));if(_0x3eabff['error']){if(_0x3eabff[_0x421b('0x15')][_0x421b('0x16')]===0x1f4){logger['error'](_0x421b('0x11'),_0x451727,_0x3eabff[_0x421b('0x15')][_0x421b('0x17')]);return _0x33e18d(_0x3eabff[_0x421b('0x15')][_0x421b('0x17')]);}logger[_0x421b('0x15')](_0x421b('0x11'),_0x451727,_0x3eabff[_0x421b('0x15')][_0x421b('0x17')]);return _0x59daae(_0x3eabff['error'][_0x421b('0x17')]);}else{logger[_0x421b('0x10')]('Dashboard,\x20%s,\x20%s',_0x451727,'request\x20sent');_0x59daae(_0x3eabff[_0x421b('0x18')][_0x421b('0x17')]);}})[_0x421b('0x19')](function(_0x193a98){logger[_0x421b('0x15')](_0x421b('0x11'),_0x451727,_0x193a98);_0x33e18d(_0x193a98);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index eac4130..aaf0d6f 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 _0x3df3=['length','dashboard:','./dashboard.events','save','remove','update','emit','removeListener','register'];(function(_0x5df1a2,_0x5ff830){var _0x1280b9=function(_0x4bcb84){while(--_0x4bcb84){_0x5df1a2['push'](_0x5df1a2['shift']());}};_0x1280b9(++_0x5ff830);}(_0x3df3,0xad));var _0x33df=function(_0x364b32,_0x4dec35){_0x364b32=_0x364b32-0x0;var _0x3f3ea0=_0x3df3[_0x364b32];return _0x3f3ea0;};'use strict';var DashboardEvents=require(_0x33df('0x0'));var events=[_0x33df('0x1'),_0x33df('0x2'),_0x33df('0x3')];function createListener(_0x57721f,_0x107a9b){return function(_0x49c40d){_0x107a9b[_0x33df('0x4')](_0x57721f,_0x49c40d);};}function removeListener(_0x2eb7e4,_0x3d0306){return function(){DashboardEvents[_0x33df('0x5')](_0x2eb7e4,_0x3d0306);};}exports[_0x33df('0x6')]=function(_0x542816){for(var _0x2f463c=0x0,_0x1c2245=events[_0x33df('0x7')];_0x2f463c<_0x1c2245;_0x2f463c++){var _0x553500=events[_0x2f463c];var _0x19275b=createListener(_0x33df('0x8')+_0x553500,_0x542816);DashboardEvents['on'](_0x553500,_0x19275b);}}; \ No newline at end of file +var _0x828f=['removeListener','register','length','save','remove','update','emit'];(function(_0x41a3ec,_0x26ddd0){var _0x4dbaf8=function(_0x2902e1){while(--_0x2902e1){_0x41a3ec['push'](_0x41a3ec['shift']());}};_0x4dbaf8(++_0x26ddd0);}(_0x828f,0x11b));var _0xf828=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x828f[_0x36884e];return _0x1cc367;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xf828('0x0'),_0xf828('0x1'),_0xf828('0x2')];function createListener(_0x4cfa6f,_0x3a36e8){return function(_0x15df06){_0x3a36e8[_0xf828('0x3')](_0x4cfa6f,_0x15df06);};}function removeListener(_0x51a297,_0x1484ff){return function(){DashboardEvents[_0xf828('0x4')](_0x51a297,_0x1484ff);};}exports[_0xf828('0x5')]=function(_0x51e1a9){for(var _0x121556=0x0,_0x532f09=events[_0xf828('0x6')];_0x121556<_0x532f09;_0x121556++){var _0x576b7c=events[_0x121556];var _0x58514d=createListener('dashboard:'+_0x576b7c,_0x51e1a9);DashboardEvents['on'](_0x576b7c,_0x58514d);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index d46aba9..57bf8af 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 _0xc093=['create','post','/:id/clone','clone','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./dashboard.controller','isAuthenticated','index','/:id','/:id/items'];(function(_0x4c4087,_0x289f36){var _0x319fe7=function(_0x4d8d8d){while(--_0x4d8d8d){_0x4c4087['push'](_0x4c4087['shift']());}};_0x319fe7(++_0x289f36);}(_0xc093,0x11a));var _0x3c09=function(_0x33155c,_0x3fdde1){_0x33155c=_0x33155c-0x0;var _0x5becf7=_0xc093[_0x33155c];return _0x5becf7;};'use strict';var multer=require(_0x3c09('0x0'));var util=require('util');var path=require(_0x3c09('0x1'));var timeout=require(_0x3c09('0x2'));var express=require(_0x3c09('0x3'));var router=express[_0x3c09('0x4')]();var fs_extra=require(_0x3c09('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3c09('0x6'));var config=require('../../config/environment');var controller=require(_0x3c09('0x7'));router['get']('/',auth[_0x3c09('0x8')](),controller[_0x3c09('0x9')]);router['get'](_0x3c09('0xa'),auth[_0x3c09('0x8')](),controller['show']);router['get'](_0x3c09('0xb'),auth[_0x3c09('0x8')](),controller['getItems']);router['post']('/',auth['isAuthenticated'](),controller[_0x3c09('0xc')]);router[_0x3c09('0xd')](_0x3c09('0xe'),auth[_0x3c09('0x8')](),controller[_0x3c09('0xf')]);router[_0x3c09('0xd')](_0x3c09('0xb'),auth[_0x3c09('0x8')](),controller['addItem']);router[_0x3c09('0x10')](_0x3c09('0xa'),auth['isAuthenticated'](),controller[_0x3c09('0x11')]);router[_0x3c09('0x12')](_0x3c09('0xa'),auth['isAuthenticated'](),controller[_0x3c09('0x13')]);module[_0x3c09('0x14')]=router; \ No newline at end of file +var _0x1f68=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/items','post','clone','addItem','put','delete','destroy'];(function(_0x38c119,_0x3348d9){var _0x4e63c8=function(_0x25346b){while(--_0x25346b){_0x38c119['push'](_0x38c119['shift']());}};_0x4e63c8(++_0x3348d9);}(_0x1f68,0x1b8));var _0x81f6=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x1f68[_0x4baae2];return _0x1a2285;};'use strict';var multer=require(_0x81f6('0x0'));var util=require(_0x81f6('0x1'));var path=require('path');var timeout=require(_0x81f6('0x2'));var express=require(_0x81f6('0x3'));var router=express['Router']();var fs_extra=require(_0x81f6('0x4'));var auth=require(_0x81f6('0x5'));var interaction=require(_0x81f6('0x6'));var config=require(_0x81f6('0x7'));var controller=require('./dashboard.controller');router[_0x81f6('0x8')]('/',auth[_0x81f6('0x9')](),controller[_0x81f6('0xa')]);router[_0x81f6('0x8')](_0x81f6('0xb'),auth['isAuthenticated'](),controller[_0x81f6('0xc')]);router['get'](_0x81f6('0xd'),auth[_0x81f6('0x9')](),controller['getItems']);router[_0x81f6('0xe')]('/',auth[_0x81f6('0x9')](),controller['create']);router[_0x81f6('0xe')]('/:id/clone',auth['isAuthenticated'](),controller[_0x81f6('0xf')]);router[_0x81f6('0xe')](_0x81f6('0xd'),auth[_0x81f6('0x9')](),controller[_0x81f6('0x10')]);router[_0x81f6('0x11')](_0x81f6('0xb'),auth[_0x81f6('0x9')](),controller['update']);router[_0x81f6('0x12')]('/:id',auth[_0x81f6('0x9')](),controller[_0x81f6('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index d0ff900..c5e6d86 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 _0x01d9=['INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x901d('0x0'));var squel=require(_0x901d('0x1'));var _=require(_0x901d('0x2'));module[_0x901d('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x901d('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x901d('0x5')](_0x901d('0x6')),'get':function(){try{return JSON[_0x901d('0x7')](this[_0x901d('0x8')](_0x901d('0x9')));}catch(_0xb96b86){return[];}},'set':function(_0x4e7842){try{this[_0x901d('0xa')](_0x901d('0x9'),JSON[_0x901d('0xb')](_0x4e7842));}catch(_0x12c39f){this[_0x901d('0xa')](_0x901d('0x9'),JSON[_0x901d('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0x901d('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x901d('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x901d('0xc')]},'col':{'type':Sequelize[_0x901d('0xc')]},'background':{'type':Sequelize[_0x901d('0x4')],'allowNull':![],'defaultValue':_0x901d('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x901d('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x901d('0xc')],'defaultValue':0xc}}; \ No newline at end of file +var _0x31f0=['INTEGER','#ffffff','#2196f3','sequelize','lodash','STRING','TEXT','long','getDataValue','attrs','setDataValue','stringify'];(function(_0x258954,_0x2ee2eb){var _0x567ad6=function(_0x473124){while(--_0x473124){_0x258954['push'](_0x258954['shift']());}};_0x567ad6(++_0x2ee2eb);}(_0x31f0,0xb7));var _0x031f=function(_0x2e53fc,_0x56fe0f){_0x2e53fc=_0x2e53fc-0x0;var _0x115e22=_0x31f0[_0x2e53fc];return _0x115e22;};'use strict';var Sequelize=require(_0x031f('0x0'));var squel=require('squel');var _=require(_0x031f('0x1'));module['exports']={'title':{'type':Sequelize[_0x031f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x031f('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x031f('0x3')](_0x031f('0x4')),'get':function(){try{return JSON['parse'](this[_0x031f('0x5')](_0x031f('0x6')));}catch(_0x4f6059){return[];}},'set':function(_0x4c0f94){try{this['setDataValue'](_0x031f('0x6'),JSON['stringify'](_0x4c0f94));}catch(_0x365f59){this[_0x031f('0x7')](_0x031f('0x6'),JSON[_0x031f('0x8')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x031f('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x031f('0x9')]},'col':{'type':Sequelize[_0x031f('0x9')]},'background':{'type':Sequelize[_0x031f('0x2')],'allowNull':![],'defaultValue':_0x031f('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x031f('0x2')],'allowNull':![],'defaultValue':_0x031f('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x031f('0x2')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index b119dac..942b7a2 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 _0x872a=['destroy','error','name','send','params','keys','DashboardItem','rawAttributes','query','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','catch','type','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','body','create','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x872a,0x100));var _0xa872=function(_0x49350b,_0x4540ac){_0x49350b=_0x49350b-0x0;var _0x292c24=_0x872a[_0x49350b];return _0x292c24;};'use strict';var emlformat=require(_0xa872('0x0'));var rimraf=require(_0xa872('0x1'));var zipdir=require(_0xa872('0x2'));var jsonpatch=require(_0xa872('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa872('0x4'));var util=require(_0xa872('0x5'));var path=require(_0xa872('0x6'));var sox=require(_0xa872('0x7'));var csv=require(_0xa872('0x8'));var ejs=require(_0xa872('0x9'));var fs=require('fs');var fs_extra=require(_0xa872('0xa'));var _=require('lodash');var squel=require(_0xa872('0xb'));var crypto=require(_0xa872('0xc'));var jsforce=require(_0xa872('0xd'));var deskjs=require(_0xa872('0xe'));var toCsv=require(_0xa872('0x8'));var querystring=require(_0xa872('0xf'));var Papa=require(_0xa872('0x10'));var Redis=require(_0xa872('0x11'));var authService=require(_0xa872('0x12'));var qs=require(_0xa872('0x13'));var as=require(_0xa872('0x14'));var hardwareService=require(_0xa872('0x15'));var logger=require(_0xa872('0x16'))(_0xa872('0x17'));var utils=require('../../config/utils');var config=require(_0xa872('0x18'));var licenseUtil=require(_0xa872('0x19'));var db=require(_0xa872('0x1a'))['db'];config['redis']=_[_0xa872('0x1b')](config[_0xa872('0x1c')],{'host':_0xa872('0x1d'),'port':0x18eb});var socket=require(_0xa872('0x1e'))(new Redis(config[_0xa872('0x1c')]));require('./dashboardItem.socket')[_0xa872('0x1f')](socket);function respondWithStatusCode(_0x5cd621,_0x3f1bd6){_0x3f1bd6=_0x3f1bd6||0xcc;return function(_0x2cb82e){if(_0x2cb82e){return _0x5cd621[_0xa872('0x20')](_0x3f1bd6);}return _0x5cd621[_0xa872('0x21')](_0x3f1bd6)['end']();};}function respondWithResult(_0x2619b1,_0xb8c0a2){_0xb8c0a2=_0xb8c0a2||0xc8;return function(_0x54a74e){if(_0x54a74e){return _0x2619b1[_0xa872('0x21')](_0xb8c0a2)[_0xa872('0x22')](_0x54a74e);}};}function respondWithFilteredResult(_0x3f5dc6,_0x5d68e4){return function(_0xa61ab3){if(_0xa61ab3){var _0x377107=typeof _0x5d68e4[_0xa872('0x23')]===_0xa872('0x24')&&typeof _0x5d68e4[_0xa872('0x25')]==='undefined';var _0x26cc07=_0xa61ab3['count'];var _0x28adef=_0x377107?0x0:_0x5d68e4['offset'];var _0x382146=_0x377107?_0xa61ab3['count']:_0x5d68e4[_0xa872('0x23')]+_0x5d68e4['limit'];var _0xe589b5;if(_0x382146>=_0x26cc07){_0x382146=_0x26cc07;_0xe589b5=0xc8;}else{_0xe589b5=0xce;}_0x3f5dc6[_0xa872('0x21')](_0xe589b5);return _0x3f5dc6['set'](_0xa872('0x26'),_0x28adef+'-'+_0x382146+'/'+_0x26cc07)[_0xa872('0x22')](_0xa61ab3);}return null;};}function patchUpdates(_0x5ad012){return function(_0x346466){try{jsonpatch[_0xa872('0x27')](_0x346466,_0x5ad012,!![]);}catch(_0x1b24f7){return BPromise[_0xa872('0x28')](_0x1b24f7);}return _0x346466[_0xa872('0x29')]();};}function saveUpdates(_0x28db80,_0x24c301){return function(_0x562988){if(_0x562988){return _0x562988[_0xa872('0x2a')](_0x28db80)[_0xa872('0x2b')](function(_0x28876a){return _0x28876a;});}return null;};}function removeEntity(_0x180dfb,_0x2cc427){return function(_0x2024ac){if(_0x2024ac){return _0x2024ac[_0xa872('0x2c')]()['then'](function(){_0x180dfb[_0xa872('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dd475,_0x4053c0){return function(_0x1e24c7){if(!_0x1e24c7){_0x1dd475['sendStatus'](0x194);}return _0x1e24c7;};}function handleError(_0x149f8d,_0x7c7f13){_0x7c7f13=_0x7c7f13||0x1f4;return function(_0x25322d){logger[_0xa872('0x2d')](_0x25322d['stack']);if(_0x25322d[_0xa872('0x2e')]){delete _0x25322d['name'];}_0x149f8d['status'](_0x7c7f13)[_0xa872('0x2f')](_0x25322d);};}exports['show']=function(_0x215a61,_0x408bdf){var _0x45131d={'raw':![],'where':{'id':_0x215a61[_0xa872('0x30')]['id']}},_0x252831={};_0x252831['model']=_[_0xa872('0x31')](db[_0xa872('0x32')][_0xa872('0x33')]);_0x252831['query']=_[_0xa872('0x31')](_0x215a61[_0xa872('0x34')]);_0x252831[_0xa872('0x35')]=_[_0xa872('0x36')](_0x252831[_0xa872('0x37')],_0x252831[_0xa872('0x34')]);_0x45131d['attributes']=_[_0xa872('0x36')](_0x252831[_0xa872('0x37')],qs[_0xa872('0x38')](_0x215a61[_0xa872('0x34')]['fields']));_0x45131d[_0xa872('0x39')]=_0x45131d[_0xa872('0x39')][_0xa872('0x3a')]?_0x45131d[_0xa872('0x39')]:_0x252831[_0xa872('0x37')];if(_0x215a61[_0xa872('0x34')][_0xa872('0x3b')]){_0x45131d[_0xa872('0x3c')]=[{'all':!![]}];}_0x45131d=_[_0xa872('0x3d')]({},_0x45131d,_0x215a61[_0xa872('0x3e')]);return db[_0xa872('0x32')][_0xa872('0x3f')](_0x45131d)[_0xa872('0x2b')](handleEntityNotFound(_0x408bdf,null))[_0xa872('0x2b')](respondWithResult(_0x408bdf,null))[_0xa872('0x40')](handleError(_0x408bdf,null));};exports[_0xa872('0x2c')]=function(_0x2dfaff,_0x1e0d39){return db[_0xa872('0x32')]['find']({'where':{'id':_0x2dfaff['params']['id']}})['then'](handleEntityNotFound(_0x1e0d39,null))['then'](removeEntity(_0x1e0d39,null))[_0xa872('0x40')](handleError(_0x1e0d39,null));};function widgetAttributes(_0x113c70){try{switch(_0x113c70[_0xa872('0x41')]){case'iframe':return[{'name':_0xa872('0x42'),'value':_0x113c70[_0xa872('0x42')]||(_0x113c70['attrs']&&_0x113c70[_0xa872('0x43')][0x0]?_0x113c70[_0xa872('0x43')][0x0][_0xa872('0x44')]:undefined)||'https://'}];case _0xa872('0x45'):return[{'name':_0xa872('0x46'),'value':_0x113c70[_0xa872('0x46')]||(_0x113c70['attrs']&&_0x113c70[_0xa872('0x43')][0x0]?_0x113c70[_0xa872('0x43')][0x0][_0xa872('0x44')]:undefined)||''}];case _0xa872('0x47'):return[{'name':_0xa872('0x48'),'value':_0x113c70[_0xa872('0x48')]||(_0x113c70[_0xa872('0x43')]&&_0x113c70['attrs'][0x0]?_0x113c70['attrs'][0x0][_0xa872('0x44')]:undefined)||_0xa872('0x49')},{'name':_0xa872('0x4a'),'value':_0x113c70['attrTimezone']||(_0x113c70[_0xa872('0x43')]&&_0x113c70[_0xa872('0x43')][0x1]?_0x113c70['attrs'][0x1]['value']:undefined)||_0xa872('0x4b')},{'name':_0xa872('0x4c'),'value':_0x113c70[_0xa872('0x4c')]||(_0x113c70[_0xa872('0x43')]&&_0x113c70['attrs'][0x2]?_0x113c70[_0xa872('0x43')][0x2][_0xa872('0x44')]:undefined)||0xc}];case'counter':return[{'name':_0xa872('0x4d'),'value':_0x113c70['attrMetric']||(_0x113c70[_0xa872('0x43')]&&_0x113c70[_0xa872('0x43')][0x0]?_0x113c70[_0xa872('0x43')][0x0][_0xa872('0x44')]:undefined)||_0xa872('0x4e')},{'name':_0xa872('0x4f'),'value':_0x113c70[_0xa872('0x4f')]||(_0x113c70['attrs']&&_0x113c70[_0xa872('0x43')][0x1]?_0x113c70[_0xa872('0x43')][0x1]['value']:undefined)||[]},{'name':_0xa872('0x4c'),'value':_0x113c70['attrFontSize']||(_0x113c70[_0xa872('0x43')]&&_0x113c70[_0xa872('0x43')][0x2]?_0x113c70['attrs'][0x2][_0xa872('0x44')]:undefined)||0x14},{'name':_0xa872('0x50'),'value':_0x113c70['attrChannel']||(_0x113c70[_0xa872('0x43')]&&_0x113c70[_0xa872('0x43')][0x3]?_0x113c70[_0xa872('0x43')][0x3][_0xa872('0x44')]:undefined)||_0xa872('0x51')},{'name':'attrEmailAccounts','value':_0x113c70[_0xa872('0x52')]||(_0x113c70[_0xa872('0x43')]&&_0x113c70[_0xa872('0x43')][0x4]?_0x113c70['attrs'][0x4][_0xa872('0x44')]:undefined)||''},{'name':_0xa872('0x53'),'value':_0x113c70['attrFaxAccounts']||(_0x113c70[_0xa872('0x43')]&&_0x113c70[_0xa872('0x43')][0x5]?_0x113c70[_0xa872('0x43')][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x113c70[_0xa872('0x54')]||(_0x113c70[_0xa872('0x43')]&&_0x113c70[_0xa872('0x43')][0x6]?_0x113c70['attrs'][0x6][_0xa872('0x44')]:undefined)||''},{'name':_0xa872('0x55'),'value':_0x113c70['attrOpenchannelAccounts']||(_0x113c70[_0xa872('0x43')]&&_0x113c70[_0xa872('0x43')][0x7]?_0x113c70['attrs'][0x7][_0xa872('0x44')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x113c70[_0xa872('0x56')]||(_0x113c70['attrs']&&_0x113c70[_0xa872('0x43')][0x8]?_0x113c70[_0xa872('0x43')][0x8][_0xa872('0x44')]:undefined)||''},{'name':_0xa872('0x57'),'value':_0x113c70[_0xa872('0x57')]||(_0x113c70[_0xa872('0x43')]&&_0x113c70[_0xa872('0x43')][0x9]?_0x113c70[_0xa872('0x43')][0x9][_0xa872('0x44')]:undefined)||''}];case _0xa872('0x58'):case _0xa872('0x59'):return[{'name':_0xa872('0x5a'),'value':_0x113c70[_0xa872('0x5a')]||(_0x113c70[_0xa872('0x43')]&&_0x113c70['attrs'][0x0]?_0x113c70['attrs'][0x0][_0xa872('0x44')]:undefined)||_0xa872('0x4e')},{'name':_0xa872('0x5b'),'value':_0x113c70['attrSerie2']||(_0x113c70['attrs']&&_0x113c70[_0xa872('0x43')][0x1]?_0x113c70[_0xa872('0x43')][0x1][_0xa872('0x44')]:undefined)||null},{'name':_0xa872('0x5c'),'value':_0x113c70[_0xa872('0x5c')]||(_0x113c70[_0xa872('0x43')]&&_0x113c70[_0xa872('0x43')][0x2]?_0x113c70[_0xa872('0x43')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x113c70[_0xa872('0x4f')]||(_0x113c70[_0xa872('0x43')]&&_0x113c70[_0xa872('0x43')][0x3]?_0x113c70[_0xa872('0x43')][0x3][_0xa872('0x44')]:undefined)||[]},{'name':_0xa872('0x50'),'value':_0x113c70[_0xa872('0x50')]||(_0x113c70[_0xa872('0x43')]&&_0x113c70[_0xa872('0x43')][0x4]?_0x113c70['attrs'][0x4][_0xa872('0x44')]:undefined)||_0xa872('0x51')},{'name':_0xa872('0x52'),'value':_0x113c70[_0xa872('0x52')]||(_0x113c70[_0xa872('0x43')]&&_0x113c70[_0xa872('0x43')][0x5]?_0x113c70['attrs'][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x113c70[_0xa872('0x53')]||(_0x113c70['attrs']&&_0x113c70['attrs'][0x6]?_0x113c70[_0xa872('0x43')][0x6][_0xa872('0x44')]:undefined)||''},{'name':_0xa872('0x54'),'value':_0x113c70[_0xa872('0x54')]||(_0x113c70[_0xa872('0x43')]&&_0x113c70['attrs'][0x7]?_0x113c70[_0xa872('0x43')][0x7][_0xa872('0x44')]:undefined)||''},{'name':_0xa872('0x55'),'value':_0x113c70[_0xa872('0x55')]||(_0x113c70[_0xa872('0x43')]&&_0x113c70[_0xa872('0x43')][0x8]?_0x113c70[_0xa872('0x43')][0x8][_0xa872('0x44')]:undefined)||''},{'name':_0xa872('0x56'),'value':_0x113c70[_0xa872('0x56')]||(_0x113c70[_0xa872('0x43')]&&_0x113c70['attrs'][0x9]?_0x113c70[_0xa872('0x43')][0x9][_0xa872('0x44')]:undefined)||''},{'name':_0xa872('0x57'),'value':_0x113c70[_0xa872('0x57')]||(_0x113c70[_0xa872('0x43')]&&_0x113c70[_0xa872('0x43')][0xa]?_0x113c70['attrs'][0xa][_0xa872('0x44')]:undefined)||''}];case _0xa872('0x5d'):return[{'name':_0xa872('0x5e'),'type':_0x113c70[_0xa872('0x5f')]||(_0x113c70['attrs']&&_0x113c70[_0xa872('0x43')][0x0]?_0x113c70['attrs'][0x0][_0xa872('0x41')]:undefined)||null,'value':_0x113c70['attrReport']||(_0x113c70[_0xa872('0x43')]&&_0x113c70['attrs'][0x0]?_0x113c70[_0xa872('0x43')][0x0][_0xa872('0x44')]:undefined)||null},{'name':_0xa872('0x60'),'value':_0x113c70[_0xa872('0x60')]||(_0x113c70[_0xa872('0x43')]&&_0x113c70[_0xa872('0x43')][0x1]?_0x113c70[_0xa872('0x43')][0x1][_0xa872('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x2f0403){logger[_0xa872('0x2d')]('widgetAttributes:\x20%s',JSON[_0xa872('0x61')](_0x2f0403));return[];}}exports['create']=function(_0x361739,_0x63b1a4){if(_0x361739[_0xa872('0x62')]){_0x361739[_0xa872('0x62')]['attrs']=widgetAttributes(_0x361739[_0xa872('0x62')]);}return db[_0xa872('0x32')][_0xa872('0x63')](_0x361739['body'],{})[_0xa872('0x2b')](respondWithResult(_0x63b1a4,0xc9))['catch'](handleError(_0x63b1a4,null));};exports[_0xa872('0x2a')]=function(_0x21a20b,_0x229ca4){if(_0x21a20b[_0xa872('0x62')]['id']){delete _0x21a20b[_0xa872('0x62')]['id'];}_0x21a20b[_0xa872('0x62')][_0xa872('0x43')]=widgetAttributes(_0x21a20b[_0xa872('0x62')]);return db[_0xa872('0x32')][_0xa872('0x3f')]({'where':{'id':_0x21a20b[_0xa872('0x30')]['id']}})[_0xa872('0x2b')](handleEntityNotFound(_0x229ca4,null))['then'](saveUpdates(_0x21a20b[_0xa872('0x62')],null))['then'](respondWithResult(_0x229ca4,null))[_0xa872('0x40')](handleError(_0x229ca4,null));}; \ No newline at end of file +var _0xb491=['attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','register','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','show','params','model','keys','query','intersection','attributes','fields','length','include','merge','options','DashboardItem','catch','destroy','find','type','attrUrl','attrs','value','https://','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0xb491,0x18c));var _0x1b49=function(_0x545a3a,_0x3123aa){_0x545a3a=_0x545a3a-0x0;var _0x5a5493=_0xb491[_0x545a3a];return _0x5a5493;};'use strict';var emlformat=require(_0x1b49('0x0'));var rimraf=require(_0x1b49('0x1'));var zipdir=require(_0x1b49('0x2'));var jsonpatch=require(_0x1b49('0x3'));var rp=require(_0x1b49('0x4'));var moment=require(_0x1b49('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1b49('0x6'));var util=require(_0x1b49('0x7'));var path=require('path');var sox=require(_0x1b49('0x8'));var csv=require(_0x1b49('0x9'));var ejs=require(_0x1b49('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1b49('0xb'));var squel=require('squel');var crypto=require(_0x1b49('0xc'));var jsforce=require(_0x1b49('0xd'));var deskjs=require(_0x1b49('0xe'));var toCsv=require(_0x1b49('0x9'));var querystring=require(_0x1b49('0xf'));var Papa=require(_0x1b49('0x10'));var Redis=require(_0x1b49('0x11'));var authService=require(_0x1b49('0x12'));var qs=require(_0x1b49('0x13'));var as=require(_0x1b49('0x14'));var hardwareService=require(_0x1b49('0x15'));var logger=require(_0x1b49('0x16'))(_0x1b49('0x17'));var utils=require(_0x1b49('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1b49('0x19'))['db'];config[_0x1b49('0x1a')]=_[_0x1b49('0x1b')](config[_0x1b49('0x1a')],{'host':_0x1b49('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1b49('0x1a')]));require('./dashboardItem.socket')[_0x1b49('0x1d')](socket);function respondWithStatusCode(_0x118c8d,_0x78f5a9){_0x78f5a9=_0x78f5a9||0xcc;return function(_0x35f837){if(_0x35f837){return _0x118c8d['sendStatus'](_0x78f5a9);}return _0x118c8d[_0x1b49('0x1e')](_0x78f5a9)[_0x1b49('0x1f')]();};}function respondWithResult(_0x13ea8d,_0x251f41){_0x251f41=_0x251f41||0xc8;return function(_0x2bec09){if(_0x2bec09){return _0x13ea8d[_0x1b49('0x1e')](_0x251f41)[_0x1b49('0x20')](_0x2bec09);}};}function respondWithFilteredResult(_0x3a5572,_0x5b2b4e){return function(_0x363678){if(_0x363678){var _0xe47400=typeof _0x5b2b4e['offset']===_0x1b49('0x21')&&typeof _0x5b2b4e[_0x1b49('0x22')]===_0x1b49('0x21');var _0x275ec9=_0x363678[_0x1b49('0x23')];var _0x1e75ee=_0xe47400?0x0:_0x5b2b4e[_0x1b49('0x24')];var _0xf8170c=_0xe47400?_0x363678[_0x1b49('0x23')]:_0x5b2b4e[_0x1b49('0x24')]+_0x5b2b4e['limit'];var _0x516aab;if(_0xf8170c>=_0x275ec9){_0xf8170c=_0x275ec9;_0x516aab=0xc8;}else{_0x516aab=0xce;}_0x3a5572[_0x1b49('0x1e')](_0x516aab);return _0x3a5572[_0x1b49('0x25')](_0x1b49('0x26'),_0x1e75ee+'-'+_0xf8170c+'/'+_0x275ec9)[_0x1b49('0x20')](_0x363678);}return null;};}function patchUpdates(_0x510748){return function(_0x8174ac){try{jsonpatch[_0x1b49('0x27')](_0x8174ac,_0x510748,!![]);}catch(_0x4f3d44){return BPromise[_0x1b49('0x28')](_0x4f3d44);}return _0x8174ac[_0x1b49('0x29')]();};}function saveUpdates(_0x3ee60c,_0x59fecd){return function(_0x723210){if(_0x723210){return _0x723210[_0x1b49('0x2a')](_0x3ee60c)[_0x1b49('0x2b')](function(_0x4ab79e){return _0x4ab79e;});}return null;};}function removeEntity(_0x39f5d1,_0x565b2c){return function(_0x37314d){if(_0x37314d){return _0x37314d['destroy']()[_0x1b49('0x2b')](function(){_0x39f5d1[_0x1b49('0x1e')](0xcc)[_0x1b49('0x1f')]();});}};}function handleEntityNotFound(_0x4ecb6d,_0x2f81fa){return function(_0x4953be){if(!_0x4953be){_0x4ecb6d['sendStatus'](0x194);}return _0x4953be;};}function handleError(_0x4ace77,_0x2f2e71){_0x2f2e71=_0x2f2e71||0x1f4;return function(_0x56eb42){logger[_0x1b49('0x2c')](_0x56eb42[_0x1b49('0x2d')]);if(_0x56eb42['name']){delete _0x56eb42[_0x1b49('0x2e')];}_0x4ace77[_0x1b49('0x1e')](_0x2f2e71)[_0x1b49('0x2f')](_0x56eb42);};}exports[_0x1b49('0x30')]=function(_0x2b4459,_0x1d2a5f){var _0x2e87dc={'raw':![],'where':{'id':_0x2b4459[_0x1b49('0x31')]['id']}},_0x59a859={};_0x59a859[_0x1b49('0x32')]=_[_0x1b49('0x33')](db['DashboardItem']['rawAttributes']);_0x59a859[_0x1b49('0x34')]=_['keys'](_0x2b4459[_0x1b49('0x34')]);_0x59a859['filters']=_[_0x1b49('0x35')](_0x59a859[_0x1b49('0x32')],_0x59a859[_0x1b49('0x34')]);_0x2e87dc[_0x1b49('0x36')]=_['intersection'](_0x59a859[_0x1b49('0x32')],qs[_0x1b49('0x37')](_0x2b4459[_0x1b49('0x34')][_0x1b49('0x37')]));_0x2e87dc[_0x1b49('0x36')]=_0x2e87dc[_0x1b49('0x36')][_0x1b49('0x38')]?_0x2e87dc[_0x1b49('0x36')]:_0x59a859['model'];if(_0x2b4459[_0x1b49('0x34')]['includeAll']){_0x2e87dc[_0x1b49('0x39')]=[{'all':!![]}];}_0x2e87dc=_[_0x1b49('0x3a')]({},_0x2e87dc,_0x2b4459[_0x1b49('0x3b')]);return db[_0x1b49('0x3c')]['find'](_0x2e87dc)['then'](handleEntityNotFound(_0x1d2a5f,null))['then'](respondWithResult(_0x1d2a5f,null))[_0x1b49('0x3d')](handleError(_0x1d2a5f,null));};exports[_0x1b49('0x3e')]=function(_0x51be72,_0x1b44bc){return db[_0x1b49('0x3c')][_0x1b49('0x3f')]({'where':{'id':_0x51be72[_0x1b49('0x31')]['id']}})[_0x1b49('0x2b')](handleEntityNotFound(_0x1b44bc,null))['then'](removeEntity(_0x1b44bc,null))[_0x1b49('0x3d')](handleError(_0x1b44bc,null));};function widgetAttributes(_0x4bdc88){try{switch(_0x4bdc88[_0x1b49('0x40')]){case'iframe':return[{'name':_0x1b49('0x41'),'value':_0x4bdc88['attrUrl']||(_0x4bdc88[_0x1b49('0x42')]&&_0x4bdc88['attrs'][0x0]?_0x4bdc88[_0x1b49('0x42')][0x0][_0x1b49('0x43')]:undefined)||_0x1b49('0x44')}];case'custom':return[{'name':_0x1b49('0x45'),'value':_0x4bdc88[_0x1b49('0x45')]||(_0x4bdc88[_0x1b49('0x42')]&&_0x4bdc88[_0x1b49('0x42')][0x0]?_0x4bdc88['attrs'][0x0][_0x1b49('0x43')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x4bdc88[_0x1b49('0x46')]||(_0x4bdc88['attrs']&&_0x4bdc88[_0x1b49('0x42')][0x0]?_0x4bdc88[_0x1b49('0x42')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x1b49('0x47'),'value':_0x4bdc88[_0x1b49('0x47')]||(_0x4bdc88[_0x1b49('0x42')]&&_0x4bdc88[_0x1b49('0x42')][0x1]?_0x4bdc88[_0x1b49('0x42')][0x1][_0x1b49('0x43')]:undefined)||_0x1b49('0x48')},{'name':_0x1b49('0x49'),'value':_0x4bdc88['attrFontSize']||(_0x4bdc88[_0x1b49('0x42')]&&_0x4bdc88[_0x1b49('0x42')][0x2]?_0x4bdc88[_0x1b49('0x42')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x1b49('0x4a'),'value':_0x4bdc88[_0x1b49('0x4a')]||(_0x4bdc88[_0x1b49('0x42')]&&_0x4bdc88[_0x1b49('0x42')][0x0]?_0x4bdc88['attrs'][0x0][_0x1b49('0x43')]:undefined)||_0x1b49('0x4b')},{'name':_0x1b49('0x4c'),'value':_0x4bdc88['attrVoiceQueues']||(_0x4bdc88[_0x1b49('0x42')]&&_0x4bdc88[_0x1b49('0x42')][0x1]?_0x4bdc88[_0x1b49('0x42')][0x1][_0x1b49('0x43')]:undefined)||[]},{'name':_0x1b49('0x49'),'value':_0x4bdc88[_0x1b49('0x49')]||(_0x4bdc88[_0x1b49('0x42')]&&_0x4bdc88[_0x1b49('0x42')][0x2]?_0x4bdc88['attrs'][0x2][_0x1b49('0x43')]:undefined)||0x14},{'name':_0x1b49('0x4d'),'value':_0x4bdc88[_0x1b49('0x4d')]||(_0x4bdc88[_0x1b49('0x42')]&&_0x4bdc88[_0x1b49('0x42')][0x3]?_0x4bdc88[_0x1b49('0x42')][0x3][_0x1b49('0x43')]:undefined)||_0x1b49('0x4e')},{'name':_0x1b49('0x4f'),'value':_0x4bdc88[_0x1b49('0x4f')]||(_0x4bdc88[_0x1b49('0x42')]&&_0x4bdc88[_0x1b49('0x42')][0x4]?_0x4bdc88[_0x1b49('0x42')][0x4][_0x1b49('0x43')]:undefined)||''},{'name':_0x1b49('0x50'),'value':_0x4bdc88['attrFaxAccounts']||(_0x4bdc88['attrs']&&_0x4bdc88['attrs'][0x5]?_0x4bdc88['attrs'][0x5]['value']:undefined)||''},{'name':_0x1b49('0x51'),'value':_0x4bdc88[_0x1b49('0x51')]||(_0x4bdc88[_0x1b49('0x42')]&&_0x4bdc88[_0x1b49('0x42')][0x6]?_0x4bdc88[_0x1b49('0x42')][0x6][_0x1b49('0x43')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4bdc88[_0x1b49('0x52')]||(_0x4bdc88[_0x1b49('0x42')]&&_0x4bdc88[_0x1b49('0x42')][0x7]?_0x4bdc88[_0x1b49('0x42')][0x7]['value']:undefined)||''},{'name':_0x1b49('0x53'),'value':_0x4bdc88[_0x1b49('0x53')]||(_0x4bdc88[_0x1b49('0x42')]&&_0x4bdc88[_0x1b49('0x42')][0x8]?_0x4bdc88[_0x1b49('0x42')][0x8][_0x1b49('0x43')]:undefined)||''},{'name':'attrChatWebsites','value':_0x4bdc88[_0x1b49('0x54')]||(_0x4bdc88['attrs']&&_0x4bdc88[_0x1b49('0x42')][0x9]?_0x4bdc88[_0x1b49('0x42')][0x9][_0x1b49('0x43')]:undefined)||''}];case _0x1b49('0x55'):case _0x1b49('0x56'):return[{'name':'attrSerie1','value':_0x4bdc88[_0x1b49('0x57')]||(_0x4bdc88[_0x1b49('0x42')]&&_0x4bdc88[_0x1b49('0x42')][0x0]?_0x4bdc88[_0x1b49('0x42')][0x0]['value']:undefined)||_0x1b49('0x4b')},{'name':_0x1b49('0x58'),'value':_0x4bdc88[_0x1b49('0x58')]||(_0x4bdc88[_0x1b49('0x42')]&&_0x4bdc88[_0x1b49('0x42')][0x1]?_0x4bdc88[_0x1b49('0x42')][0x1][_0x1b49('0x43')]:undefined)||null},{'name':_0x1b49('0x59'),'value':_0x4bdc88['attrSerie3']||(_0x4bdc88[_0x1b49('0x42')]&&_0x4bdc88[_0x1b49('0x42')][0x2]?_0x4bdc88[_0x1b49('0x42')][0x2][_0x1b49('0x43')]:undefined)||null},{'name':_0x1b49('0x4c'),'value':_0x4bdc88[_0x1b49('0x4c')]||(_0x4bdc88[_0x1b49('0x42')]&&_0x4bdc88[_0x1b49('0x42')][0x3]?_0x4bdc88[_0x1b49('0x42')][0x3][_0x1b49('0x43')]:undefined)||[]},{'name':_0x1b49('0x4d'),'value':_0x4bdc88['attrChannel']||(_0x4bdc88[_0x1b49('0x42')]&&_0x4bdc88[_0x1b49('0x42')][0x4]?_0x4bdc88[_0x1b49('0x42')][0x4][_0x1b49('0x43')]:undefined)||_0x1b49('0x4e')},{'name':'attrEmailAccounts','value':_0x4bdc88[_0x1b49('0x4f')]||(_0x4bdc88[_0x1b49('0x42')]&&_0x4bdc88[_0x1b49('0x42')][0x5]?_0x4bdc88['attrs'][0x5]['value']:undefined)||''},{'name':_0x1b49('0x50'),'value':_0x4bdc88[_0x1b49('0x50')]||(_0x4bdc88[_0x1b49('0x42')]&&_0x4bdc88[_0x1b49('0x42')][0x6]?_0x4bdc88[_0x1b49('0x42')][0x6][_0x1b49('0x43')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x4bdc88[_0x1b49('0x51')]||(_0x4bdc88[_0x1b49('0x42')]&&_0x4bdc88[_0x1b49('0x42')][0x7]?_0x4bdc88[_0x1b49('0x42')][0x7][_0x1b49('0x43')]:undefined)||''},{'name':_0x1b49('0x52'),'value':_0x4bdc88[_0x1b49('0x52')]||(_0x4bdc88[_0x1b49('0x42')]&&_0x4bdc88[_0x1b49('0x42')][0x8]?_0x4bdc88[_0x1b49('0x42')][0x8][_0x1b49('0x43')]:undefined)||''},{'name':_0x1b49('0x53'),'value':_0x4bdc88[_0x1b49('0x53')]||(_0x4bdc88['attrs']&&_0x4bdc88['attrs'][0x9]?_0x4bdc88[_0x1b49('0x42')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x4bdc88[_0x1b49('0x54')]||(_0x4bdc88[_0x1b49('0x42')]&&_0x4bdc88[_0x1b49('0x42')][0xa]?_0x4bdc88['attrs'][0xa]['value']:undefined)||''}];case _0x1b49('0x5a'):return[{'name':_0x1b49('0x5b'),'type':_0x4bdc88[_0x1b49('0x5c')]||(_0x4bdc88[_0x1b49('0x42')]&&_0x4bdc88[_0x1b49('0x42')][0x0]?_0x4bdc88['attrs'][0x0][_0x1b49('0x40')]:undefined)||null,'value':_0x4bdc88['attrReport']||(_0x4bdc88['attrs']&&_0x4bdc88[_0x1b49('0x42')][0x0]?_0x4bdc88[_0x1b49('0x42')][0x0][_0x1b49('0x43')]:undefined)||null},{'name':'attrRefresh','value':_0x4bdc88[_0x1b49('0x5d')]||(_0x4bdc88[_0x1b49('0x42')]&&_0x4bdc88[_0x1b49('0x42')][0x1]?_0x4bdc88[_0x1b49('0x42')][0x1][_0x1b49('0x43')]:undefined)||0x0}];default:return[];}}catch(_0xcae79d){logger[_0x1b49('0x2c')](_0x1b49('0x5e'),JSON['stringify'](_0xcae79d));return[];}}exports[_0x1b49('0x5f')]=function(_0x5c1b1e,_0x3d6bf9){if(_0x5c1b1e[_0x1b49('0x60')]){_0x5c1b1e[_0x1b49('0x60')][_0x1b49('0x42')]=widgetAttributes(_0x5c1b1e['body']);}return db[_0x1b49('0x3c')][_0x1b49('0x5f')](_0x5c1b1e[_0x1b49('0x60')],{})['then'](respondWithResult(_0x3d6bf9,0xc9))[_0x1b49('0x3d')](handleError(_0x3d6bf9,null));};exports[_0x1b49('0x2a')]=function(_0x4e1590,_0x2d3f5c){if(_0x4e1590['body']['id']){delete _0x4e1590[_0x1b49('0x60')]['id'];}_0x4e1590[_0x1b49('0x60')]['attrs']=widgetAttributes(_0x4e1590['body']);return db[_0x1b49('0x3c')][_0x1b49('0x3f')]({'where':{'id':_0x4e1590[_0x1b49('0x31')]['id']}})[_0x1b49('0x2b')](handleEntityNotFound(_0x2d3f5c,null))[_0x1b49('0x2b')](saveUpdates(_0x4e1590['body'],null))[_0x1b49('0x2b')](respondWithResult(_0x2d3f5c,null))[_0x1b49('0x3d')](handleError(_0x2d3f5c,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index aa37648..b3eed5f 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 _0xa1cc=['../../mysqldb','DashboardItem','save','update','remove','emit','hasOwnProperty','events'];(function(_0x5c625c,_0x1e77fc){var _0x32a3da=function(_0x419a94){while(--_0x419a94){_0x5c625c['push'](_0x5c625c['shift']());}};_0x32a3da(++_0x1e77fc);}(_0xa1cc,0x10f));var _0xca1c=function(_0x7d3a42,_0xf59a02){_0x7d3a42=_0x7d3a42-0x0;var _0x17874a=_0xa1cc[_0x7d3a42];return _0x17874a;};'use strict';var EventEmitter=require(_0xca1c('0x0'));var DashboardItem=require(_0xca1c('0x1'))['db'][_0xca1c('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xca1c('0x3'),'afterUpdate':_0xca1c('0x4'),'afterDestroy':_0xca1c('0x5')};function emitEvent(_0x5d49d7){return function(_0x371991,_0x4c430d,_0x45d9ee){DashboardItemEvents[_0xca1c('0x6')](_0x5d49d7+':'+_0x371991['id'],_0x371991);DashboardItemEvents[_0xca1c('0x6')](_0x5d49d7,_0x371991);_0x45d9ee(null);};}for(var e in events){if(events[_0xca1c('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0xceb2=['hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit'];(function(_0x4b1de6,_0x565741){var _0x25a495=function(_0x164e94){while(--_0x164e94){_0x4b1de6['push'](_0x4b1de6['shift']());}};_0x25a495(++_0x565741);}(_0xceb2,0xa2));var _0x2ceb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xceb2[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x2ceb('0x0'));var DashboardItem=require(_0x2ceb('0x1'))['db'][_0x2ceb('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x2ceb('0x3')](0x0);var events={'afterCreate':_0x2ceb('0x4'),'afterUpdate':_0x2ceb('0x5'),'afterDestroy':_0x2ceb('0x6')};function emitEvent(_0x2e54fe){return function(_0xf5d1b9,_0x10eac1,_0x203861){DashboardItemEvents[_0x2ceb('0x7')](_0x2e54fe+':'+_0xf5d1b9['id'],_0xf5d1b9);DashboardItemEvents[_0x2ceb('0x7')](_0x2e54fe,_0xf5d1b9);_0x203861(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x2ceb('0x8')](e,emitEvent(event));}}module[_0x2ceb('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 2de4e63..c573c15 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 _0xf3bb=['request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','../../config/logger','api','moment','bluebird'];(function(_0x4afd40,_0x6781da){var _0x4112e2=function(_0x2881eb){while(--_0x2881eb){_0x4afd40['push'](_0x4afd40['shift']());}};_0x4112e2(++_0x6781da);}(_0xf3bb,0x1e0));var _0xbf3b=function(_0x431fe4,_0x31d024){_0x431fe4=_0x431fe4-0x0;var _0x178e9b=_0xf3bb[_0x431fe4];return _0x178e9b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbf3b('0x0'))(_0xbf3b('0x1'));var moment=require(_0xbf3b('0x2'));var BPromise=require(_0xbf3b('0x3'));var rp=require(_0xbf3b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbf3b('0x5'));var config=require(_0xbf3b('0x6'));var attributes=require(_0xbf3b('0x7'));module[_0xbf3b('0x8')]=function(_0x1bca30,_0x255a12){return _0x1bca30[_0xbf3b('0x9')](_0xbf3b('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd64b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util'];(function(_0x1a1c30,_0x1e1209){var _0x2dec3c=function(_0x4471da){while(--_0x4471da){_0x1a1c30['push'](_0x1a1c30['shift']());}};_0x2dec3c(++_0x1e1209);}(_0xd64b,0x140));var _0xbd64=function(_0x25d3cb,_0x201a7d){_0x25d3cb=_0x25d3cb-0x0;var _0x53a675=_0xd64b[_0x25d3cb];return _0x53a675;};'use strict';var _=require(_0xbd64('0x0'));var util=require(_0xbd64('0x1'));var logger=require('../../config/logger')(_0xbd64('0x2'));var moment=require(_0xbd64('0x3'));var BPromise=require(_0xbd64('0x4'));var rp=require(_0xbd64('0x5'));var fs=require('fs');var path=require(_0xbd64('0x6'));var rimraf=require(_0xbd64('0x7'));var config=require(_0xbd64('0x8'));var attributes=require(_0xbd64('0x9'));module[_0xbd64('0xa')]=function(_0x18b56a,_0x577486){return _0x18b56a[_0xbd64('0xb')](_0xbd64('0xc'),attributes,{'tableName':_0xbd64('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 2de8bc7..8f6f2b9 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 _0xee00=['defaults','localhost','./dashboardItem.socket','register','request','info','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis'];(function(_0x237ade,_0x2a8491){var _0x4108f4=function(_0x1d31fc){while(--_0x1d31fc){_0x237ade['push'](_0x237ade['shift']());}};_0x4108f4(++_0x2a8491);}(_0xee00,0xcd));var _0x0ee0=function(_0x4a8ea4,_0x4ee1a1){_0x4a8ea4=_0x4a8ea4-0x0;var _0x3ece14=_0xee00[_0x4a8ea4];return _0x3ece14;};'use strict';var _=require(_0x0ee0('0x0'));var util=require(_0x0ee0('0x1'));var moment=require('moment');var BPromise=require(_0x0ee0('0x2'));var rs=require(_0x0ee0('0x3'));var fs=require('fs');var Redis=require(_0x0ee0('0x4'));var db=require(_0x0ee0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ee0('0x6'))('rpc');var config=require(_0x0ee0('0x7'));var jayson=require(_0x0ee0('0x8'));var client=jayson['client'][_0x0ee0('0x9')]({'port':0x232a});config[_0x0ee0('0xa')]=_[_0x0ee0('0xb')](config['redis'],{'host':_0x0ee0('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0ee0('0xa')]));require(_0x0ee0('0xd'))[_0x0ee0('0xe')](socket);function respondWithRpcPromise(_0x2a67a5,_0x447706,_0x3b7ee9){return new BPromise(function(_0x25b071,_0x206173){return client[_0x0ee0('0xf')](_0x2a67a5,_0x3b7ee9)['then'](function(_0x3ad7e3){logger[_0x0ee0('0x10')]('DashboardItem,\x20%s,\x20%s',_0x447706,'request\x20sent');logger[_0x0ee0('0x11')](_0x0ee0('0x12'),_0x447706,'request\x20sent',JSON[_0x0ee0('0x13')](_0x3ad7e3));if(_0x3ad7e3[_0x0ee0('0x14')]){if(_0x3ad7e3['error'][_0x0ee0('0x15')]===0x1f4){logger[_0x0ee0('0x14')](_0x0ee0('0x16'),_0x447706,_0x3ad7e3[_0x0ee0('0x14')][_0x0ee0('0x17')]);return _0x206173(_0x3ad7e3[_0x0ee0('0x14')][_0x0ee0('0x17')]);}logger[_0x0ee0('0x14')](_0x0ee0('0x16'),_0x447706,_0x3ad7e3[_0x0ee0('0x14')][_0x0ee0('0x17')]);return _0x25b071(_0x3ad7e3[_0x0ee0('0x14')][_0x0ee0('0x17')]);}else{logger[_0x0ee0('0x10')](_0x0ee0('0x16'),_0x447706,_0x0ee0('0x18'));_0x25b071(_0x3ad7e3[_0x0ee0('0x19')][_0x0ee0('0x17')]);}})[_0x0ee0('0x1a')](function(_0x551229){logger[_0x0ee0('0x14')](_0x0ee0('0x16'),_0x447706,_0x551229);_0x206173(_0x551229);});});} \ No newline at end of file +var _0x5f3a=['info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','then'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5f3a,0x169));var _0xa5f3=function(_0x460a7f,_0x2fb6c5){_0x460a7f=_0x460a7f-0x0;var _0x2ed206=_0x5f3a[_0x460a7f];return _0x2ed206;};'use strict';var _=require(_0xa5f3('0x0'));var util=require('util');var moment=require(_0xa5f3('0x1'));var BPromise=require(_0xa5f3('0x2'));var rs=require(_0xa5f3('0x3'));var fs=require('fs');var Redis=require(_0xa5f3('0x4'));var db=require(_0xa5f3('0x5'))['db'];var utils=require(_0xa5f3('0x6'));var logger=require(_0xa5f3('0x7'))(_0xa5f3('0x8'));var config=require(_0xa5f3('0x9'));var jayson=require(_0xa5f3('0xa'));var client=jayson[_0xa5f3('0xb')][_0xa5f3('0xc')]({'port':0x232a});config[_0xa5f3('0xd')]=_['defaults'](config[_0xa5f3('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xa5f3('0xe'))(new Redis(config[_0xa5f3('0xd')]));require('./dashboardItem.socket')[_0xa5f3('0xf')](socket);function respondWithRpcPromise(_0x202f82,_0x3dec2b,_0x4ce4c7){return new BPromise(function(_0x1068c9,_0x196b6c){return client['request'](_0x202f82,_0x4ce4c7)[_0xa5f3('0x10')](function(_0x10b269){logger[_0xa5f3('0x11')](_0xa5f3('0x12'),_0x3dec2b,_0xa5f3('0x13'));logger['debug'](_0xa5f3('0x14'),_0x3dec2b,_0xa5f3('0x13'),JSON[_0xa5f3('0x15')](_0x10b269));if(_0x10b269[_0xa5f3('0x16')]){if(_0x10b269[_0xa5f3('0x16')][_0xa5f3('0x17')]===0x1f4){logger[_0xa5f3('0x16')](_0xa5f3('0x12'),_0x3dec2b,_0x10b269[_0xa5f3('0x16')][_0xa5f3('0x18')]);return _0x196b6c(_0x10b269[_0xa5f3('0x16')]['message']);}logger[_0xa5f3('0x16')](_0xa5f3('0x12'),_0x3dec2b,_0x10b269[_0xa5f3('0x16')][_0xa5f3('0x18')]);return _0x1068c9(_0x10b269[_0xa5f3('0x16')]['message']);}else{logger['info'](_0xa5f3('0x12'),_0x3dec2b,'request\x20sent');_0x1068c9(_0x10b269[_0xa5f3('0x19')][_0xa5f3('0x18')]);}})[_0xa5f3('0x1a')](function(_0x3348e3){logger[_0xa5f3('0x16')]('DashboardItem,\x20%s,\x20%s',_0x3dec2b,_0x3348e3);_0x196b6c(_0x3348e3);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index a09660c..75e434d 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 _0x54e8=['removeListener','register','length','dashboardItem:','save','remove','update','emit'];(function(_0x4ca4f9,_0x164d23){var _0x33c072=function(_0x50ffbc){while(--_0x50ffbc){_0x4ca4f9['push'](_0x4ca4f9['shift']());}};_0x33c072(++_0x164d23);}(_0x54e8,0xac));var _0x854e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x54e8[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x854e('0x0'),_0x854e('0x1'),_0x854e('0x2')];function createListener(_0x1b8983,_0x59f432){return function(_0x3ddd59){_0x59f432[_0x854e('0x3')](_0x1b8983,_0x3ddd59);};}function removeListener(_0x128cc7,_0x11e520){return function(){DashboardItemEvents[_0x854e('0x4')](_0x128cc7,_0x11e520);};}exports[_0x854e('0x5')]=function(_0x303a11){for(var _0x4c4abd=0x0,_0x1a8359=events[_0x854e('0x6')];_0x4c4abd<_0x1a8359;_0x4c4abd++){var _0x494c3f=events[_0x4c4abd];var _0x988447=createListener(_0x854e('0x7')+_0x494c3f,_0x303a11);DashboardItemEvents['on'](_0x494c3f,_0x988447);}}; \ No newline at end of file +var _0xd4f1=['update','emit','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd4f1,0x185));var _0x1d4f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd4f1[_0x20a584];return _0x4b41a8;};'use strict';var DashboardItemEvents=require(_0x1d4f('0x0'));var events=[_0x1d4f('0x1'),_0x1d4f('0x2'),_0x1d4f('0x3')];function createListener(_0x40cc19,_0x397cf9){return function(_0x39123f){_0x397cf9[_0x1d4f('0x4')](_0x40cc19,_0x39123f);};}function removeListener(_0x2675f6,_0x346ea9){return function(){DashboardItemEvents['removeListener'](_0x2675f6,_0x346ea9);};}exports['register']=function(_0x373336){for(var _0x166597=0x0,_0x242e9c=events[_0x1d4f('0x5')];_0x166597<_0x242e9c;_0x166597++){var _0x4b583c=events[_0x166597];var _0x21a415=createListener(_0x1d4f('0x6')+_0x4b583c,_0x373336);DashboardItemEvents['on'](_0x4b583c,_0x21a415);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index fd55eb1..9199162 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 _0xdc7b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','show','update','delete','isAuthenticated','destroy','exports','multer','util','path','express','Router'];(function(_0x3210f7,_0xecec0e){var _0x32f551=function(_0x1e5b54){while(--_0x1e5b54){_0x3210f7['push'](_0x3210f7['shift']());}};_0x32f551(++_0xecec0e);}(_0xdc7b,0x1bb));var _0xbdc7=function(_0x3da048,_0xdbcc23){_0x3da048=_0x3da048-0x0;var _0x3b3ea8=_0xdc7b[_0x3da048];return _0x3b3ea8;};'use strict';var multer=require(_0xbdc7('0x0'));var util=require(_0xbdc7('0x1'));var path=require(_0xbdc7('0x2'));var timeout=require('connect-timeout');var express=require(_0xbdc7('0x3'));var router=express[_0xbdc7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbdc7('0x5'));var interaction=require(_0xbdc7('0x6'));var config=require(_0xbdc7('0x7'));var controller=require(_0xbdc7('0x8'));router['get'](_0xbdc7('0x9'),auth['isAuthenticated'](),controller[_0xbdc7('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xbdc7('0x9'),auth['isAuthenticated'](),controller[_0xbdc7('0xb')]);router[_0xbdc7('0xc')](_0xbdc7('0x9'),auth[_0xbdc7('0xd')](),controller[_0xbdc7('0xe')]);module[_0xbdc7('0xf')]=router; \ No newline at end of file +var _0x83c8=['exports','multer','util','path','fs-extra','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','post','create','put','delete'];(function(_0x1055ce,_0x6eb49b){var _0x28fcf8=function(_0x2c9905){while(--_0x2c9905){_0x1055ce['push'](_0x1055ce['shift']());}};_0x28fcf8(++_0x6eb49b);}(_0x83c8,0xc5));var _0x883c=function(_0x298374,_0x4d34c4){_0x298374=_0x298374-0x0;var _0x42ada1=_0x83c8[_0x298374];return _0x42ada1;};'use strict';var multer=require(_0x883c('0x0'));var util=require(_0x883c('0x1'));var path=require(_0x883c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x883c('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x883c('0x4'));var controller=require(_0x883c('0x5'));router['get'](_0x883c('0x6'),auth[_0x883c('0x7')](),controller[_0x883c('0x8')]);router[_0x883c('0x9')]('/',auth[_0x883c('0x7')](),controller[_0x883c('0xa')]);router[_0x883c('0xb')](_0x883c('0x6'),auth[_0x883c('0x7')](),controller['update']);router[_0x883c('0xc')]('/:id',auth[_0x883c('0x7')](),controller['destroy']);module[_0x883c('0xd')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index b9c0abe..d37549a 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 _0xe09e=['sequelize','exports','ENUM','first','second','third','STRING'];(function(_0x3fdce0,_0x530a43){var _0x36d552=function(_0x2d1593){while(--_0x2d1593){_0x3fdce0['push'](_0x3fdce0['shift']());}};_0x36d552(++_0x530a43);}(_0xe09e,0x10a));var _0xee09=function(_0x536f9f,_0x50116a){_0x536f9f=_0x536f9f-0x0;var _0x2012bc=_0xe09e[_0x536f9f];return _0x2012bc;};'use strict';var Sequelize=require(_0xee09('0x0'));module[_0xee09('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xee09('0x2')](_0xee09('0x3'),_0xee09('0x4'),_0xee09('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xee09('0x6')]}}; \ No newline at end of file +var _0xf4c1=['ENUM','first','third','sequelize','exports','STRING'];(function(_0x1e4f2f,_0x35edfa){var _0xccea89=function(_0x164386){while(--_0x164386){_0x1e4f2f['push'](_0x1e4f2f['shift']());}};_0xccea89(++_0x35edfa);}(_0xf4c1,0xa5));var _0x1f4c=function(_0x244f1f,_0x27b839){_0x244f1f=_0x244f1f-0x0;var _0x237b65=_0xf4c1[_0x244f1f];return _0x237b65;};'use strict';var Sequelize=require(_0x1f4c('0x0'));module[_0x1f4c('0x1')]={'name':{'type':Sequelize[_0x1f4c('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x1f4c('0x3')](_0x1f4c('0x4'),'second',_0x1f4c('0x5')),'allowNull':![],'defaultValue':_0x1f4c('0x4')},'description':{'type':Sequelize[_0x1f4c('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index b53c9cd..1f9e744 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 _0x544f=['attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Dispositions','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','Content-Range','reject','update','then','destroy','get','UserProfileResource','stack','name','send','index','Disposition','fieldName','type','key','model','map','query','keys','filters','intersection'];(function(_0x33ae2e,_0x1435c4){var _0xaa1728=function(_0x2e9730){while(--_0x2e9730){_0x33ae2e['push'](_0x33ae2e['shift']());}};_0xaa1728(++_0x1435c4);}(_0x544f,0xbc));var _0xf544=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x544f[_0x7e2eb0];return _0xd92de4;};'use strict';var emlformat=require(_0xf544('0x0'));var rimraf=require(_0xf544('0x1'));var zipdir=require(_0xf544('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf544('0x3'));var moment=require(_0xf544('0x4'));var BPromise=require(_0xf544('0x5'));var Mustache=require(_0xf544('0x6'));var util=require('util');var path=require('path');var sox=require(_0xf544('0x7'));var csv=require(_0xf544('0x8'));var ejs=require(_0xf544('0x9'));var fs=require('fs');var fs_extra=require(_0xf544('0xa'));var _=require('lodash');var squel=require(_0xf544('0xb'));var crypto=require(_0xf544('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf544('0xd'));var toCsv=require(_0xf544('0x8'));var querystring=require('querystring');var Papa=require(_0xf544('0xe'));var Redis=require(_0xf544('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf544('0x10'));var logger=require(_0xf544('0x11'))(_0xf544('0x12'));var utils=require(_0xf544('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf544('0x14'))['db'];function respondWithStatusCode(_0x4b9236,_0x44d8cd){_0x44d8cd=_0x44d8cd||0xcc;return function(_0x506a6c){if(_0x506a6c){return _0x4b9236[_0xf544('0x15')](_0x44d8cd);}return _0x4b9236[_0xf544('0x16')](_0x44d8cd)[_0xf544('0x17')]();};}function respondWithResult(_0xb4e95f,_0x13f2b7){_0x13f2b7=_0x13f2b7||0xc8;return function(_0x240f07){if(_0x240f07){return _0xb4e95f[_0xf544('0x16')](_0x13f2b7)[_0xf544('0x18')](_0x240f07);}};}function respondWithFilteredResult(_0x1e1844,_0x2b14e6){return function(_0x4a4b7f){if(_0x4a4b7f){var _0xcd9325=typeof _0x2b14e6[_0xf544('0x19')]==='undefined'&&typeof _0x2b14e6[_0xf544('0x1a')]===_0xf544('0x1b');var _0x442b9b=_0x4a4b7f['count'];var _0x5aee58=_0xcd9325?0x0:_0x2b14e6[_0xf544('0x19')];var _0xdead4e=_0xcd9325?_0x4a4b7f['count']:_0x2b14e6['offset']+_0x2b14e6['limit'];var _0x33f8b7;if(_0xdead4e>=_0x442b9b){_0xdead4e=_0x442b9b;_0x33f8b7=0xc8;}else{_0x33f8b7=0xce;}_0x1e1844[_0xf544('0x16')](_0x33f8b7);return _0x1e1844['set'](_0xf544('0x1c'),_0x5aee58+'-'+_0xdead4e+'/'+_0x442b9b)[_0xf544('0x18')](_0x4a4b7f);}return null;};}function patchUpdates(_0xe7f123){return function(_0x385c9d){try{jsonpatch['apply'](_0x385c9d,_0xe7f123,!![]);}catch(_0xae3ca9){return BPromise[_0xf544('0x1d')](_0xae3ca9);}return _0x385c9d['save']();};}function saveUpdates(_0x40afa5,_0x389223){return function(_0x563856){if(_0x563856){return _0x563856[_0xf544('0x1e')](_0x40afa5)[_0xf544('0x1f')](function(_0x108b30){return _0x108b30;});}return null;};}function removeEntity(_0x39912b,_0x5d28c0){return function(_0x87affc){if(_0x87affc){return _0x87affc[_0xf544('0x20')]()[_0xf544('0x1f')](function(){var _0x1b63b5=_0x87affc[_0xf544('0x21')]({'plain':!![]});var _0x1ddcf2='Dispositions';return db[_0xf544('0x22')][_0xf544('0x20')]({'where':{'type':_0x1ddcf2,'resourceId':_0x1b63b5['id']}})[_0xf544('0x1f')](function(){return _0x87affc;});})['then'](function(){_0x39912b[_0xf544('0x16')](0xcc)[_0xf544('0x17')]();});}};}function handleEntityNotFound(_0x3f3a9e,_0x4bdd21){return function(_0x2b9759){if(!_0x2b9759){_0x3f3a9e['sendStatus'](0x194);}return _0x2b9759;};}function handleError(_0x25241b,_0x46e9d8){_0x46e9d8=_0x46e9d8||0x1f4;return function(_0x1a94d8){logger['error'](_0x1a94d8[_0xf544('0x23')]);if(_0x1a94d8['name']){delete _0x1a94d8[_0xf544('0x24')];}_0x25241b['status'](_0x46e9d8)[_0xf544('0x25')](_0x1a94d8);};}exports[_0xf544('0x26')]=function(_0x12210a,_0x2d4af4){var _0x56a7f2={},_0x1495aa={},_0x455b67={'count':0x0,'rows':[]};var _0x2c2313=_['map'](db[_0xf544('0x27')]['rawAttributes'],function(_0x233c39){return{'name':_0x233c39[_0xf544('0x28')],'type':_0x233c39[_0xf544('0x29')][_0xf544('0x2a')]};});_0x1495aa[_0xf544('0x2b')]=_[_0xf544('0x2c')](_0x2c2313,'name');_0x1495aa[_0xf544('0x2d')]=_[_0xf544('0x2e')](_0x12210a[_0xf544('0x2d')]);_0x1495aa[_0xf544('0x2f')]=_[_0xf544('0x30')](_0x1495aa[_0xf544('0x2b')],_0x1495aa['query']);_0x56a7f2[_0xf544('0x31')]=_[_0xf544('0x30')](_0x1495aa[_0xf544('0x2b')],qs[_0xf544('0x32')](_0x12210a['query'][_0xf544('0x32')]));_0x56a7f2['attributes']=_0x56a7f2[_0xf544('0x31')]['length']?_0x56a7f2[_0xf544('0x31')]:_0x1495aa['model'];if(!_0x12210a[_0xf544('0x2d')]['hasOwnProperty'](_0xf544('0x33'))){_0x56a7f2[_0xf544('0x1a')]=qs['limit'](_0x12210a[_0xf544('0x2d')][_0xf544('0x1a')]);_0x56a7f2[_0xf544('0x19')]=qs['offset'](_0x12210a[_0xf544('0x2d')][_0xf544('0x19')]);}_0x56a7f2['order']=qs[_0xf544('0x34')](_0x12210a[_0xf544('0x2d')][_0xf544('0x34')]);_0x56a7f2[_0xf544('0x35')]=qs[_0xf544('0x2f')](_[_0xf544('0x36')](_0x12210a[_0xf544('0x2d')],_0x1495aa['filters']),_0x2c2313);if(_0x12210a[_0xf544('0x2d')][_0xf544('0x37')]){_0x56a7f2[_0xf544('0x35')]=_[_0xf544('0x38')](_0x56a7f2['where'],{'$or':_[_0xf544('0x2c')](_0x2c2313,function(_0x51e8d2){if(_0x51e8d2['type']!==_0xf544('0x39')){var _0xe397f6={};_0xe397f6[_0x51e8d2['name']]={'$like':'%'+_0x12210a[_0xf544('0x2d')][_0xf544('0x37')]+'%'};return _0xe397f6;}})});}_0x56a7f2=_['merge']({},_0x56a7f2,_0x12210a[_0xf544('0x3a')]);var _0x520ab4={'where':_0x56a7f2[_0xf544('0x35')]};return db['Disposition']['count'](_0x520ab4)[_0xf544('0x1f')](function(_0x4e8ed1){_0x455b67[_0xf544('0x3b')]=_0x4e8ed1;if(_0x12210a[_0xf544('0x2d')][_0xf544('0x3c')]){_0x56a7f2[_0xf544('0x3d')]=[{'all':!![]}];}return db[_0xf544('0x27')][_0xf544('0x3e')](_0x56a7f2);})[_0xf544('0x1f')](function(_0x422980){_0x455b67['rows']=_0x422980;return _0x455b67;})[_0xf544('0x1f')](respondWithFilteredResult(_0x2d4af4,_0x56a7f2))[_0xf544('0x3f')](handleError(_0x2d4af4,null));};exports[_0xf544('0x40')]=function(_0x30141c,_0x499cb2){var _0x4152dc={'raw':!![],'where':{'id':_0x30141c[_0xf544('0x41')]['id']}},_0x3fb105={};_0x3fb105[_0xf544('0x2b')]=_[_0xf544('0x2e')](db[_0xf544('0x27')][_0xf544('0x42')]);_0x3fb105['query']=_[_0xf544('0x2e')](_0x30141c[_0xf544('0x2d')]);_0x3fb105[_0xf544('0x2f')]=_[_0xf544('0x30')](_0x3fb105[_0xf544('0x2b')],_0x3fb105[_0xf544('0x2d')]);_0x4152dc['attributes']=_['intersection'](_0x3fb105[_0xf544('0x2b')],qs['fields'](_0x30141c[_0xf544('0x2d')]['fields']));_0x4152dc['attributes']=_0x4152dc['attributes'][_0xf544('0x43')]?_0x4152dc['attributes']:_0x3fb105['model'];if(_0x30141c['query'][_0xf544('0x3c')]){_0x4152dc[_0xf544('0x3d')]=[{'all':!![]}];}_0x4152dc=_[_0xf544('0x38')]({},_0x4152dc,_0x30141c[_0xf544('0x3a')]);return db[_0xf544('0x27')][_0xf544('0x44')](_0x4152dc)[_0xf544('0x1f')](handleEntityNotFound(_0x499cb2,null))['then'](respondWithResult(_0x499cb2,null))[_0xf544('0x3f')](handleError(_0x499cb2,null));};exports[_0xf544('0x45')]=function(_0x2282a1,_0x108b0f){return db[_0xf544('0x27')][_0xf544('0x45')](_0x2282a1[_0xf544('0x46')],{})[_0xf544('0x1f')](function(_0x1dcc36){var _0x2363ef=_0x2282a1[_0xf544('0x47')]['get']({'plain':!![]});if(!_0x2363ef)throw new Error(_0xf544('0x48'));if(_0x2363ef['role']==='user'){var _0x171e45=_0x1dcc36['get']({'plain':!![]});var _0x3ebf8f=_0xf544('0x49');return db[_0xf544('0x4a')][_0xf544('0x44')]({'where':{'name':_0x3ebf8f,'userProfileId':_0x2363ef[_0xf544('0x4b')]},'raw':!![]})[_0xf544('0x1f')](function(_0x348cf2){if(_0x348cf2&&_0x348cf2[_0xf544('0x4c')]===0x0){return db[_0xf544('0x22')][_0xf544('0x45')]({'name':_0x171e45[_0xf544('0x24')],'resourceId':_0x171e45['id'],'type':_0x348cf2[_0xf544('0x24')],'sectionId':_0x348cf2['id']},{})[_0xf544('0x1f')](function(){return _0x1dcc36;});}else{return _0x1dcc36;}})['catch'](function(_0x5426ae){logger[_0xf544('0x4d')](_0xf544('0x4e'),_0x5426ae);throw _0x5426ae;});}return _0x1dcc36;})[_0xf544('0x1f')](respondWithResult(_0x108b0f,0xc9))[_0xf544('0x3f')](handleError(_0x108b0f,null));};exports['update']=function(_0x258302,_0xa1e5d0){if(_0x258302[_0xf544('0x46')]['id']){delete _0x258302[_0xf544('0x46')]['id'];}return db[_0xf544('0x27')]['find']({'where':{'id':_0x258302[_0xf544('0x41')]['id']}})[_0xf544('0x1f')](handleEntityNotFound(_0xa1e5d0,null))[_0xf544('0x1f')](saveUpdates(_0x258302['body'],null))['then'](respondWithResult(_0xa1e5d0,null))['catch'](handleError(_0xa1e5d0,null));};exports[_0xf544('0x20')]=function(_0x152493,_0x5f4a25){return db[_0xf544('0x27')][_0xf544('0x44')]({'where':{'id':_0x152493[_0xf544('0x41')]['id']}})['then'](handleEntityNotFound(_0x5f4a25,null))[_0xf544('0x1f')](removeEntity(_0x5f4a25,null))[_0xf544('0x3f')](handleError(_0x5f4a25,null));}; \ No newline at end of file +var _0x43d6=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','moment','bluebird','mustache','util','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','apply','reject','update','destroy','get','Dispositions','then','stack','send','index','map','Disposition','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','name','filter','options','includeAll','rows','params','rawAttributes','include','find','catch','create'];(function(_0x4c9350,_0x1d4ad4){var _0x54dbca=function(_0x22f645){while(--_0x22f645){_0x4c9350['push'](_0x4c9350['shift']());}};_0x54dbca(++_0x1d4ad4);}(_0x43d6,0xe9));var _0x643d=function(_0x3a74a9,_0x5ec5b3){_0x3a74a9=_0x3a74a9-0x0;var _0x3e9bbf=_0x43d6[_0x3a74a9];return _0x3e9bbf;};'use strict';var emlformat=require(_0x643d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x643d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x643d('0x2'));var BPromise=require(_0x643d('0x3'));var Mustache=require(_0x643d('0x4'));var util=require(_0x643d('0x5'));var path=require('path');var sox=require(_0x643d('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x643d('0x7'));var _=require(_0x643d('0x8'));var squel=require('squel');var crypto=require(_0x643d('0x9'));var jsforce=require(_0x643d('0xa'));var deskjs=require(_0x643d('0xb'));var toCsv=require(_0x643d('0xc'));var querystring=require(_0x643d('0xd'));var Papa=require(_0x643d('0xe'));var Redis=require(_0x643d('0xf'));var authService=require(_0x643d('0x10'));var qs=require(_0x643d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x643d('0x12'));var utils=require(_0x643d('0x13'));var config=require(_0x643d('0x14'));var licenseUtil=require(_0x643d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47ea38,_0x4bdcaa){_0x4bdcaa=_0x4bdcaa||0xcc;return function(_0xdb302e){if(_0xdb302e){return _0x47ea38[_0x643d('0x16')](_0x4bdcaa);}return _0x47ea38['status'](_0x4bdcaa)[_0x643d('0x17')]();};}function respondWithResult(_0x1c3202,_0x5941c7){_0x5941c7=_0x5941c7||0xc8;return function(_0x4ac391){if(_0x4ac391){return _0x1c3202[_0x643d('0x18')](_0x5941c7)[_0x643d('0x19')](_0x4ac391);}};}function respondWithFilteredResult(_0x3903b3,_0x465796){return function(_0x1b1129){if(_0x1b1129){var _0x239e3f=typeof _0x465796['offset']===_0x643d('0x1a')&&typeof _0x465796[_0x643d('0x1b')]===_0x643d('0x1a');var _0x416f6d=_0x1b1129[_0x643d('0x1c')];var _0x51cd4c=_0x239e3f?0x0:_0x465796[_0x643d('0x1d')];var _0x1c0116=_0x239e3f?_0x1b1129[_0x643d('0x1c')]:_0x465796[_0x643d('0x1d')]+_0x465796[_0x643d('0x1b')];var _0x20b02a;if(_0x1c0116>=_0x416f6d){_0x1c0116=_0x416f6d;_0x20b02a=0xc8;}else{_0x20b02a=0xce;}_0x3903b3[_0x643d('0x18')](_0x20b02a);return _0x3903b3['set']('Content-Range',_0x51cd4c+'-'+_0x1c0116+'/'+_0x416f6d)[_0x643d('0x19')](_0x1b1129);}return null;};}function patchUpdates(_0x2c4582){return function(_0x338372){try{jsonpatch[_0x643d('0x1e')](_0x338372,_0x2c4582,!![]);}catch(_0x4556d7){return BPromise[_0x643d('0x1f')](_0x4556d7);}return _0x338372['save']();};}function saveUpdates(_0x48513,_0x367b1c){return function(_0x2ea6ee){if(_0x2ea6ee){return _0x2ea6ee[_0x643d('0x20')](_0x48513)['then'](function(_0x559197){return _0x559197;});}return null;};}function removeEntity(_0x299dcf,_0x51ec05){return function(_0x26507c){if(_0x26507c){return _0x26507c[_0x643d('0x21')]()['then'](function(){var _0x59309d=_0x26507c[_0x643d('0x22')]({'plain':!![]});var _0x5ebcb6=_0x643d('0x23');return db['UserProfileResource'][_0x643d('0x21')]({'where':{'type':_0x5ebcb6,'resourceId':_0x59309d['id']}})[_0x643d('0x24')](function(){return _0x26507c;});})[_0x643d('0x24')](function(){_0x299dcf[_0x643d('0x18')](0xcc)[_0x643d('0x17')]();});}};}function handleEntityNotFound(_0x483ee4,_0x25cfee){return function(_0x38b160){if(!_0x38b160){_0x483ee4[_0x643d('0x16')](0x194);}return _0x38b160;};}function handleError(_0x375bda,_0x5a6bdb){_0x5a6bdb=_0x5a6bdb||0x1f4;return function(_0x5f9dc4){logger['error'](_0x5f9dc4[_0x643d('0x25')]);if(_0x5f9dc4['name']){delete _0x5f9dc4['name'];}_0x375bda['status'](_0x5a6bdb)[_0x643d('0x26')](_0x5f9dc4);};}exports[_0x643d('0x27')]=function(_0x33cf63,_0x26ba91){var _0x46c2a9={},_0x3727c9={},_0x1f9e27={'count':0x0,'rows':[]};var _0x225dd7=_[_0x643d('0x28')](db[_0x643d('0x29')]['rawAttributes'],function(_0x45fd13){return{'name':_0x45fd13[_0x643d('0x2a')],'type':_0x45fd13[_0x643d('0x2b')][_0x643d('0x2c')]};});_0x3727c9[_0x643d('0x2d')]=_[_0x643d('0x28')](_0x225dd7,'name');_0x3727c9[_0x643d('0x2e')]=_[_0x643d('0x2f')](_0x33cf63[_0x643d('0x2e')]);_0x3727c9[_0x643d('0x30')]=_[_0x643d('0x31')](_0x3727c9[_0x643d('0x2d')],_0x3727c9[_0x643d('0x2e')]);_0x46c2a9[_0x643d('0x32')]=_[_0x643d('0x31')](_0x3727c9[_0x643d('0x2d')],qs[_0x643d('0x33')](_0x33cf63[_0x643d('0x2e')][_0x643d('0x33')]));_0x46c2a9['attributes']=_0x46c2a9[_0x643d('0x32')][_0x643d('0x34')]?_0x46c2a9['attributes']:_0x3727c9[_0x643d('0x2d')];if(!_0x33cf63['query']['hasOwnProperty']('nolimit')){_0x46c2a9[_0x643d('0x1b')]=qs['limit'](_0x33cf63[_0x643d('0x2e')]['limit']);_0x46c2a9[_0x643d('0x1d')]=qs[_0x643d('0x1d')](_0x33cf63[_0x643d('0x2e')][_0x643d('0x1d')]);}_0x46c2a9[_0x643d('0x35')]=qs[_0x643d('0x36')](_0x33cf63[_0x643d('0x2e')][_0x643d('0x36')]);_0x46c2a9[_0x643d('0x37')]=qs[_0x643d('0x30')](_['pick'](_0x33cf63[_0x643d('0x2e')],_0x3727c9[_0x643d('0x30')]),_0x225dd7);if(_0x33cf63[_0x643d('0x2e')]['filter']){_0x46c2a9[_0x643d('0x37')]=_['merge'](_0x46c2a9['where'],{'$or':_[_0x643d('0x28')](_0x225dd7,function(_0x5cb2ad){if(_0x5cb2ad[_0x643d('0x2b')]!=='VIRTUAL'){var _0x1d5f00={};_0x1d5f00[_0x5cb2ad[_0x643d('0x38')]]={'$like':'%'+_0x33cf63[_0x643d('0x2e')][_0x643d('0x39')]+'%'};return _0x1d5f00;}})});}_0x46c2a9=_['merge']({},_0x46c2a9,_0x33cf63[_0x643d('0x3a')]);var _0x3114ed={'where':_0x46c2a9[_0x643d('0x37')]};return db[_0x643d('0x29')][_0x643d('0x1c')](_0x3114ed)[_0x643d('0x24')](function(_0x25ecac){_0x1f9e27['count']=_0x25ecac;if(_0x33cf63[_0x643d('0x2e')][_0x643d('0x3b')]){_0x46c2a9['include']=[{'all':!![]}];}return db[_0x643d('0x29')]['findAll'](_0x46c2a9);})[_0x643d('0x24')](function(_0x1df554){_0x1f9e27[_0x643d('0x3c')]=_0x1df554;return _0x1f9e27;})[_0x643d('0x24')](respondWithFilteredResult(_0x26ba91,_0x46c2a9))['catch'](handleError(_0x26ba91,null));};exports['show']=function(_0xd875ce,_0x1ded46){var _0x474fee={'raw':!![],'where':{'id':_0xd875ce[_0x643d('0x3d')]['id']}},_0x4ccb0a={};_0x4ccb0a[_0x643d('0x2d')]=_[_0x643d('0x2f')](db[_0x643d('0x29')][_0x643d('0x3e')]);_0x4ccb0a[_0x643d('0x2e')]=_['keys'](_0xd875ce[_0x643d('0x2e')]);_0x4ccb0a['filters']=_[_0x643d('0x31')](_0x4ccb0a[_0x643d('0x2d')],_0x4ccb0a[_0x643d('0x2e')]);_0x474fee['attributes']=_[_0x643d('0x31')](_0x4ccb0a[_0x643d('0x2d')],qs[_0x643d('0x33')](_0xd875ce['query'][_0x643d('0x33')]));_0x474fee[_0x643d('0x32')]=_0x474fee[_0x643d('0x32')][_0x643d('0x34')]?_0x474fee['attributes']:_0x4ccb0a['model'];if(_0xd875ce['query'][_0x643d('0x3b')]){_0x474fee[_0x643d('0x3f')]=[{'all':!![]}];}_0x474fee=_['merge']({},_0x474fee,_0xd875ce['options']);return db[_0x643d('0x29')][_0x643d('0x40')](_0x474fee)[_0x643d('0x24')](handleEntityNotFound(_0x1ded46,null))[_0x643d('0x24')](respondWithResult(_0x1ded46,null))[_0x643d('0x41')](handleError(_0x1ded46,null));};exports[_0x643d('0x42')]=function(_0x5c05db,_0x41d171){return db[_0x643d('0x29')][_0x643d('0x42')](_0x5c05db['body'],{})['then'](function(_0x2ca69a){var _0x49e4d4=_0x5c05db[_0x643d('0x43')][_0x643d('0x22')]({'plain':!![]});if(!_0x49e4d4)throw new Error(_0x643d('0x44'));if(_0x49e4d4[_0x643d('0x45')]==='user'){var _0x27e606=_0x2ca69a['get']({'plain':!![]});var _0x1b2d8b='Dispositions';return db['UserProfileSection'][_0x643d('0x40')]({'where':{'name':_0x1b2d8b,'userProfileId':_0x49e4d4['userProfileId']},'raw':!![]})[_0x643d('0x24')](function(_0x28376e){if(_0x28376e&&_0x28376e[_0x643d('0x46')]===0x0){return db[_0x643d('0x47')][_0x643d('0x42')]({'name':_0x27e606[_0x643d('0x38')],'resourceId':_0x27e606['id'],'type':_0x28376e[_0x643d('0x38')],'sectionId':_0x28376e['id']},{})[_0x643d('0x24')](function(){return _0x2ca69a;});}else{return _0x2ca69a;}})[_0x643d('0x41')](function(_0x64e3ac){logger[_0x643d('0x48')](_0x643d('0x49'),_0x64e3ac);throw _0x64e3ac;});}return _0x2ca69a;})[_0x643d('0x24')](respondWithResult(_0x41d171,0xc9))[_0x643d('0x41')](handleError(_0x41d171,null));};exports[_0x643d('0x20')]=function(_0x5d6ec0,_0x487fd7){if(_0x5d6ec0[_0x643d('0x4a')]['id']){delete _0x5d6ec0[_0x643d('0x4a')]['id'];}return db[_0x643d('0x29')]['find']({'where':{'id':_0x5d6ec0['params']['id']}})[_0x643d('0x24')](handleEntityNotFound(_0x487fd7,null))[_0x643d('0x24')](saveUpdates(_0x5d6ec0['body'],null))[_0x643d('0x24')](respondWithResult(_0x487fd7,null))[_0x643d('0x41')](handleError(_0x487fd7,null));};exports[_0x643d('0x21')]=function(_0x1ddd96,_0x26a84b){return db['Disposition'][_0x643d('0x40')]({'where':{'id':_0x1ddd96['params']['id']}})[_0x643d('0x24')](handleEntityNotFound(_0x26a84b,null))[_0x643d('0x24')](removeEntity(_0x26a84b,null))[_0x643d('0x41')](handleError(_0x26a84b,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 46b6153..207e7e4 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 _0x627c=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','Disposition','name','name_mail','SmsAccountId','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x627c,0x1c1));var _0xc627=function(_0x4cf2f1,_0x2d940f){_0x4cf2f1=_0x4cf2f1-0x0;var _0x42ac18=_0x627c[_0x4cf2f1];return _0x42ac18;};'use strict';var _=require('lodash');var util=require(_0xc627('0x0'));var logger=require(_0xc627('0x1'))(_0xc627('0x2'));var moment=require(_0xc627('0x3'));var BPromise=require(_0xc627('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc627('0x5'));var rimraf=require(_0xc627('0x6'));var config=require(_0xc627('0x7'));var attributes=require('./disposition.attributes');module[_0xc627('0x8')]=function(_0x34c310,_0x5e3e25){return _0x34c310[_0xc627('0x9')](_0xc627('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xc627('0xb'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0xc627('0xb'),'ChatWebsiteId']},{'unique':!![],'name':_0xc627('0xc'),'fields':[_0xc627('0xb'),'MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0xc627('0xb'),_0xc627('0xd')]},{'unique':!![],'name':'name_fax','fields':[_0xc627('0xb'),_0xc627('0xe')]},{'unique':!![],'name':_0xc627('0xf'),'fields':[_0xc627('0xb'),'OpenchannelAccountId']},{'unique':!![],'name':_0xc627('0x10'),'fields':['name',_0xc627('0x11')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x52be=['../../config/environment','./disposition.attributes','exports','name_voice','name','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','path','rimraf'];(function(_0x47ab4f,_0x5713f4){var _0x46b98f=function(_0x474c70){while(--_0x474c70){_0x47ab4f['push'](_0x47ab4f['shift']());}};_0x46b98f(++_0x5713f4);}(_0x52be,0x1db));var _0xe52b=function(_0x1fd675,_0x165dfe){_0x1fd675=_0x1fd675-0x0;var _0x16b554=_0x52be[_0x1fd675];return _0x16b554;};'use strict';var _=require(_0xe52b('0x0'));var util=require('util');var logger=require(_0xe52b('0x1'))(_0xe52b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe52b('0x3'));var rimraf=require(_0xe52b('0x4'));var config=require(_0xe52b('0x5'));var attributes=require(_0xe52b('0x6'));module[_0xe52b('0x7')]=function(_0x1de9f1,_0x1b12bc){return _0x1de9f1['define']('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xe52b('0x8'),'fields':[_0xe52b('0x9'),'ListId']},{'unique':!![],'name':'name_chat','fields':['name',_0xe52b('0xa')]},{'unique':!![],'name':_0xe52b('0xb'),'fields':['name',_0xe52b('0xc')]},{'unique':!![],'name':'name_sms','fields':[_0xe52b('0x9'),_0xe52b('0xd')]},{'unique':!![],'name':_0xe52b('0xe'),'fields':[_0xe52b('0x9'),_0xe52b('0xf')]},{'unique':!![],'name':_0xe52b('0x10'),'fields':[_0xe52b('0x9'),_0xe52b('0x11')]},{'unique':!![],'name':_0xe52b('0x12'),'fields':[_0xe52b('0x9'),_0xe52b('0x13')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 2703e7c..1dd253d 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(_0x4a8f34,_0xa40f89){var _0x533296=function(_0x115ea1){while(--_0x115ea1){_0x4a8f34['push'](_0x4a8f34['shift']());}};_0x533296(++_0xa40f89);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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(_0x52d986,_0x5b9187){var _0x13eb57=function(_0x31c67b){while(--_0x31c67b){_0x52d986['push'](_0x52d986['shift']());}};_0x13eb57(++_0x5b9187);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 2e9b6cf..6198bf3 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 _0x38f1=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x3e8ad8,_0x25b42b){var _0x557c2a=function(_0x2573da){while(--_0x2573da){_0x3e8ad8['push'](_0x3e8ad8['shift']());}};_0x557c2a(++_0x25b42b);}(_0x38f1,0x140));var _0x138f=function(_0x3bbd7a,_0x381a73){_0x3bbd7a=_0x3bbd7a-0x0;var _0x3d3166=_0x38f1[_0x3bbd7a];return _0x3d3166;};'use strict';var multer=require(_0x138f('0x0'));var util=require(_0x138f('0x1'));var path=require(_0x138f('0x2'));var timeout=require(_0x138f('0x3'));var express=require(_0x138f('0x4'));var router=express[_0x138f('0x5')]();var fs_extra=require(_0x138f('0x6'));var auth=require(_0x138f('0x7'));var interaction=require(_0x138f('0x8'));var config=require(_0x138f('0x9'));var controller=require('./disposition.controller');router['get']('/',auth[_0x138f('0xa')](),controller['index']);router[_0x138f('0xb')](_0x138f('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x138f('0xd')]('/',auth[_0x138f('0xa')](),controller[_0x138f('0xe')]);router[_0x138f('0xf')](_0x138f('0xc'),auth[_0x138f('0xa')](),controller[_0x138f('0x10')]);router[_0x138f('0x11')](_0x138f('0xc'),auth[_0x138f('0xa')](),controller[_0x138f('0x12')]);module[_0x138f('0x13')]=router; \ No newline at end of file +var _0x1500=['get','index','isAuthenticated','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x485840,_0x122071){var _0x41ec7d=function(_0x1e45d0){while(--_0x1e45d0){_0x485840['push'](_0x485840['shift']());}};_0x41ec7d(++_0x122071);}(_0x1500,0xbf));var _0x0150=function(_0x2b3c4f,_0x930450){_0x2b3c4f=_0x2b3c4f-0x0;var _0x47c070=_0x1500[_0x2b3c4f];return _0x47c070;};'use strict';var multer=require(_0x0150('0x0'));var util=require(_0x0150('0x1'));var path=require(_0x0150('0x2'));var timeout=require('connect-timeout');var express=require(_0x0150('0x3'));var router=express['Router']();var fs_extra=require(_0x0150('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0150('0x5'));var config=require(_0x0150('0x6'));var controller=require('./disposition.controller');router[_0x0150('0x7')]('/',auth['isAuthenticated'](),controller[_0x0150('0x8')]);router[_0x0150('0x7')]('/:id',auth[_0x0150('0x9')](),controller[_0x0150('0xa')]);router[_0x0150('0xb')]('/',auth['isAuthenticated'](),controller[_0x0150('0xc')]);router[_0x0150('0xd')](_0x0150('0xe'),auth[_0x0150('0x9')](),controller['update']);router[_0x0150('0xf')](_0x0150('0xe'),auth[_0x0150('0x9')](),controller[_0x0150('0x10')]);module[_0x0150('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 230b492..e0421b9 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 _0xd360=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','4800','7200','9600','12000','14400','2400','v17,v27,v29','INTEGER','DADHI','SIP'];(function(_0x2ddf91,_0x3da038){var _0x28f92d=function(_0x420b57){while(--_0x420b57){_0x2ddf91['push'](_0x2ddf91['shift']());}};_0x28f92d(++_0x3da038);}(_0xd360,0x14a));var _0x0d36=function(_0x9cbc27,_0x159396){_0x9cbc27=_0x9cbc27-0x0;var _0xeac199=_0xd360[_0x9cbc27];return _0xeac199;};'use strict';var Sequelize=require(_0x0d36('0x0'));module[_0x0d36('0x1')]={'name':{'type':Sequelize[_0x0d36('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0d36('0x2')]},'ecm':{'type':Sequelize[_0x0d36('0x3')](_0x0d36('0x4'),'no'),'defaultValue':_0x0d36('0x4')},'headerinfo':{'type':Sequelize[_0x0d36('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x0d36('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM']('2400',_0x0d36('0x5'),_0x0d36('0x6'),_0x0d36('0x7'),_0x0d36('0x8'),_0x0d36('0x9')),'defaultValue':_0x0d36('0x5')},'maxrate':{'type':Sequelize[_0x0d36('0x3')](_0x0d36('0xa'),_0x0d36('0x5'),_0x0d36('0x6'),'9600',_0x0d36('0x8'),_0x0d36('0x9')),'defaultValue':_0x0d36('0x9')},'modem':{'type':Sequelize[_0x0d36('0x2')],'defaultValue':_0x0d36('0xb')},'gateway':{'type':Sequelize[_0x0d36('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x0d36('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x0d36('0x3')]('SIP','IAX',_0x0d36('0xd'),'KHOMP'),'defaultValue':_0x0d36('0xe')},'key':{'type':Sequelize[_0x0d36('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0d36('0xf')],'defaultValue':function(){return _0x0d36('0x10');}},'notificationSound':{'type':Sequelize[_0x0d36('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0d36('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0d36('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0d36('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0d36('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0d36('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0d36('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0d36('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x0d36('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0d36('0x13'),'set':function(_0x55cf84){if(!_0x55cf84)this[_0x0d36('0x14')](_0x0d36('0x15'),null);this[_0x0d36('0x14')](_0x0d36('0x16'),_0x55cf84);}}}; \ No newline at end of file +var _0x3c72=['14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','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','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','9600','7200'];(function(_0x3a4890,_0x56069f){var _0x4bc8c6=function(_0x13523c){while(--_0x13523c){_0x3a4890['push'](_0x3a4890['shift']());}};_0x4bc8c6(++_0x56069f);}(_0x3c72,0xdc));var _0x23c7=function(_0xb1f5b2,_0x4c47bb){_0xb1f5b2=_0xb1f5b2-0x0;var _0xea632d=_0x3c72[_0xb1f5b2];return _0xea632d;};'use strict';var Sequelize=require(_0x23c7('0x0'));module[_0x23c7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x23c7('0x2')]},'ecm':{'type':Sequelize[_0x23c7('0x3')]('yes','no'),'defaultValue':_0x23c7('0x4')},'headerinfo':{'type':Sequelize[_0x23c7('0x2')],'defaultValue':_0x23c7('0x5')},'localstationid':{'type':Sequelize[_0x23c7('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x23c7('0x3')](_0x23c7('0x6'),_0x23c7('0x7'),'7200',_0x23c7('0x8'),'12000','14400'),'defaultValue':_0x23c7('0x7')},'maxrate':{'type':Sequelize[_0x23c7('0x3')](_0x23c7('0x6'),'4800',_0x23c7('0x9'),'9600','12000','14400'),'defaultValue':_0x23c7('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x23c7('0xb')},'gateway':{'type':Sequelize[_0x23c7('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x23c7('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x23c7('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x23c7('0x3')](_0x23c7('0xd'),_0x23c7('0xe'),_0x23c7('0xf'),_0x23c7('0x10')),'defaultValue':_0x23c7('0xd')},'key':{'type':Sequelize[_0x23c7('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x23c7('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x23c7('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x23c7('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x23c7('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x23c7('0xc')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x23c7('0x12')],'defaultValue':![],'comment':_0x23c7('0x13'),'set':function(_0x553d28){if(!_0x553d28)this[_0x23c7('0x14')](_0x23c7('0x15'),null);this[_0x23c7('0x14')](_0x23c7('0x16'),_0x553d28);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index d856eea..282f184 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 _0xfaf1=['rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','FaxAccountId','Disposition','getDispositions','includeAll','removeDispositions','getAnswers','findOne','CannedAnswer','removeAnswers','ids','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','from-voip-provider','exten','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','localstationid','gateway','faxdetect','headerinfo','minrate','modem','Wait','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','createdAt','ListId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','isArray','userFaxAccount:remove','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','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','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','get','UserProfileResource','destroy','end','stack','name','send','index','Pause','mandatoryDispositionPause','fieldName','key','map','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','FaxAccount','include','findAll','rows','params'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfaf1,0x12e));var _0x1faf=function(_0x4aa303,_0x478f8b){_0x4aa303=_0x4aa303-0x0;var _0x19d607=_0xfaf1[_0x4aa303];return _0x19d607;};'use strict';var emlformat=require(_0x1faf('0x0'));var rimraf=require(_0x1faf('0x1'));var zipdir=require(_0x1faf('0x2'));var jsonpatch=require(_0x1faf('0x3'));var rp=require(_0x1faf('0x4'));var moment=require(_0x1faf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1faf('0x6'));var util=require('util');var path=require(_0x1faf('0x7'));var sox=require('sox');var csv=require(_0x1faf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1faf('0x9'));var _=require('lodash');var squel=require(_0x1faf('0xa'));var crypto=require(_0x1faf('0xb'));var jsforce=require(_0x1faf('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1faf('0x8'));var querystring=require(_0x1faf('0xd'));var Papa=require('papaparse');var Redis=require(_0x1faf('0xe'));var authService=require(_0x1faf('0xf'));var qs=require(_0x1faf('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1faf('0x11'));var logger=require(_0x1faf('0x12'))(_0x1faf('0x13'));var utils=require(_0x1faf('0x14'));var config=require(_0x1faf('0x15'));var licenseUtil=require(_0x1faf('0x16'));var db=require(_0x1faf('0x17'))['db'];config[_0x1faf('0x18')]=_[_0x1faf('0x19')](config[_0x1faf('0x18')],{'host':_0x1faf('0x1a'),'port':0x18eb});var socket=require(_0x1faf('0x1b'))(new Redis(config[_0x1faf('0x18')]));require(_0x1faf('0x1c'))[_0x1faf('0x1d')](socket);var jayson=require(_0x1faf('0x1e'));var client=jayson[_0x1faf('0x1f')][_0x1faf('0x20')]({'port':0x232c});var client9002=jayson[_0x1faf('0x1f')][_0x1faf('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x42a457,_0x103fc9,_0x2d607e,_0x59f60f){return new BPromise(function(_0x36631b,_0x3821f0){var _0x3d063d=_0x59f60f||client;return _0x3d063d[_0x1faf('0x21')](_0x42a457,_0x2d607e)[_0x1faf('0x22')](function(_0x323a0f){logger[_0x1faf('0x23')](_0x1faf('0x24'),_0x103fc9,_0x1faf('0x25'));logger[_0x1faf('0x26')](_0x1faf('0x27'),_0x103fc9,_0x1faf('0x25'),JSON[_0x1faf('0x28')](_0x323a0f));if(_0x323a0f[_0x1faf('0x29')]){if(_0x323a0f[_0x1faf('0x29')][_0x1faf('0x2a')]===0x1f4){logger['error'](_0x1faf('0x24'),_0x103fc9,_0x323a0f[_0x1faf('0x29')][_0x1faf('0x2b')]);return _0x3821f0(_0x323a0f['error'][_0x1faf('0x2b')]);}logger[_0x1faf('0x29')]('FaxAccount,\x20%s,\x20%s',_0x103fc9,_0x323a0f['error'][_0x1faf('0x2b')]);return _0x36631b(_0x323a0f[_0x1faf('0x29')][_0x1faf('0x2b')]);}else{logger['info'](_0x1faf('0x24'),_0x103fc9,'request\x20sent');_0x36631b(_0x323a0f[_0x1faf('0x2c')][_0x1faf('0x2b')]);}})[_0x1faf('0x2d')](function(_0x45bdd7){logger[_0x1faf('0x29')](_0x1faf('0x24'),_0x103fc9,_0x45bdd7);_0x3821f0(_0x45bdd7);});});}function respondWithStatusCode(_0x5429a7,_0x17b05f){_0x17b05f=_0x17b05f||0xcc;return function(_0x4a44ce){if(_0x4a44ce){return _0x5429a7[_0x1faf('0x2e')](_0x17b05f);}return _0x5429a7['status'](_0x17b05f)['end']();};}function respondWithResult(_0x2099ce,_0x54aabd){_0x54aabd=_0x54aabd||0xc8;return function(_0x2619a4){if(_0x2619a4){return _0x2099ce[_0x1faf('0x2f')](_0x54aabd)[_0x1faf('0x30')](_0x2619a4);}};}function respondWithFilteredResult(_0x467c63,_0x348bb5){return function(_0x2aef10){if(_0x2aef10){var _0x2fc9a2=typeof _0x348bb5[_0x1faf('0x31')]==='undefined'&&typeof _0x348bb5[_0x1faf('0x32')]===_0x1faf('0x33');var _0x587d33=_0x2aef10[_0x1faf('0x34')];var _0x103478=_0x2fc9a2?0x0:_0x348bb5[_0x1faf('0x31')];var _0x68c359=_0x2fc9a2?_0x2aef10['count']:_0x348bb5[_0x1faf('0x31')]+_0x348bb5[_0x1faf('0x32')];var _0x27dfa1;if(_0x68c359>=_0x587d33){_0x68c359=_0x587d33;_0x27dfa1=0xc8;}else{_0x27dfa1=0xce;}_0x467c63[_0x1faf('0x2f')](_0x27dfa1);return _0x467c63[_0x1faf('0x35')]('Content-Range',_0x103478+'-'+_0x68c359+'/'+_0x587d33)[_0x1faf('0x30')](_0x2aef10);}return null;};}function patchUpdates(_0x53bdc1){return function(_0x249470){try{jsonpatch[_0x1faf('0x36')](_0x249470,_0x53bdc1,!![]);}catch(_0x912641){return BPromise[_0x1faf('0x37')](_0x912641);}return _0x249470[_0x1faf('0x38')]();};}function saveUpdates(_0x41e698,_0x144b93){return function(_0x180d7c){if(_0x180d7c){return _0x180d7c['update'](_0x41e698)['then'](function(_0x41f703){return _0x41f703;});}return null;};}function removeEntity(_0x2ad962,_0x5a8e22){return function(_0x5ac266){if(_0x5ac266){return _0x5ac266['destroy']()[_0x1faf('0x22')](function(){var _0x3a4326=_0x5ac266[_0x1faf('0x39')]({'plain':!![]});var _0x1c1390='FaxAccounts';return db[_0x1faf('0x3a')][_0x1faf('0x3b')]({'where':{'type':_0x1c1390,'resourceId':_0x3a4326['id']}})['then'](function(){return _0x5ac266;});})[_0x1faf('0x22')](function(){_0x2ad962[_0x1faf('0x2f')](0xcc)[_0x1faf('0x3c')]();});}};}function handleEntityNotFound(_0x46d5d8,_0x50dd18){return function(_0x1e2d71){if(!_0x1e2d71){_0x46d5d8[_0x1faf('0x2e')](0x194);}return _0x1e2d71;};}function handleError(_0x2e0fcd,_0x478c95){_0x478c95=_0x478c95||0x1f4;return function(_0x70bd67){logger[_0x1faf('0x29')](_0x70bd67[_0x1faf('0x3d')]);if(_0x70bd67[_0x1faf('0x3e')]){delete _0x70bd67[_0x1faf('0x3e')];}_0x2e0fcd[_0x1faf('0x2f')](_0x478c95)[_0x1faf('0x3f')](_0x70bd67);};}exports[_0x1faf('0x40')]=function(_0x100e19,_0x17122f){var _0xad8cee={'include':[{'model':db[_0x1faf('0x41')],'as':_0x1faf('0x42')}]},_0x2f2270={},_0x599a24={'count':0x0,'rows':[]};var _0x2bde41=_['map'](db['FaxAccount']['rawAttributes'],function(_0x2614cc){return{'name':_0x2614cc[_0x1faf('0x43')],'type':_0x2614cc['type'][_0x1faf('0x44')]};});_0x2f2270['model']=_[_0x1faf('0x45')](_0x2bde41,_0x1faf('0x3e'));_0x2f2270[_0x1faf('0x46')]=_[_0x1faf('0x47')](_0x100e19['query']);_0x2f2270[_0x1faf('0x48')]=_['intersection'](_0x2f2270['model'],_0x2f2270[_0x1faf('0x46')]);_0xad8cee[_0x1faf('0x49')]=_[_0x1faf('0x4a')](_0x2f2270[_0x1faf('0x4b')],qs[_0x1faf('0x4c')](_0x100e19[_0x1faf('0x46')]['fields']));_0xad8cee[_0x1faf('0x49')]=_0xad8cee[_0x1faf('0x49')][_0x1faf('0x4d')]?_0xad8cee[_0x1faf('0x49')]:_0x2f2270['model'];if(!_0x100e19[_0x1faf('0x46')][_0x1faf('0x4e')](_0x1faf('0x4f'))){_0xad8cee[_0x1faf('0x32')]=qs[_0x1faf('0x32')](_0x100e19[_0x1faf('0x46')][_0x1faf('0x32')]);_0xad8cee[_0x1faf('0x31')]=qs[_0x1faf('0x31')](_0x100e19[_0x1faf('0x46')][_0x1faf('0x31')]);}_0xad8cee[_0x1faf('0x50')]=qs[_0x1faf('0x51')](_0x100e19[_0x1faf('0x46')][_0x1faf('0x51')]);_0xad8cee[_0x1faf('0x52')]=qs[_0x1faf('0x48')](_[_0x1faf('0x53')](_0x100e19[_0x1faf('0x46')],_0x2f2270[_0x1faf('0x48')]),_0x2bde41);if(_0x100e19[_0x1faf('0x46')][_0x1faf('0x54')]){_0xad8cee[_0x1faf('0x52')]=_[_0x1faf('0x55')](_0xad8cee[_0x1faf('0x52')],{'$or':_['map'](_0x2bde41,function(_0x2563fa){if(_0x2563fa[_0x1faf('0x56')]!==_0x1faf('0x57')){var _0x59af4c={};_0x59af4c[_0x2563fa[_0x1faf('0x3e')]]={'$like':'%'+_0x100e19['query'][_0x1faf('0x54')]+'%'};return _0x59af4c;}})});}_0xad8cee=_[_0x1faf('0x55')]({},_0xad8cee,_0x100e19[_0x1faf('0x58')]);var _0x535d2b={'where':_0xad8cee[_0x1faf('0x52')]};return db[_0x1faf('0x59')][_0x1faf('0x34')](_0x535d2b)['then'](function(_0x154559){_0x599a24[_0x1faf('0x34')]=_0x154559;if(_0x100e19[_0x1faf('0x46')]['includeAll']){_0xad8cee[_0x1faf('0x5a')]=[{'all':!![]}];}return db[_0x1faf('0x59')][_0x1faf('0x5b')](_0xad8cee);})['then'](function(_0x2d878d){_0x599a24[_0x1faf('0x5c')]=_0x2d878d;return _0x599a24;})['then'](respondWithFilteredResult(_0x17122f,_0xad8cee))['catch'](handleError(_0x17122f,null));};exports['show']=function(_0x40de41,_0x223779){var _0x4d39c5={'raw':![],'where':{'id':_0x40de41[_0x1faf('0x5d')]['id']},'include':[{'model':db[_0x1faf('0x41')],'as':_0x1faf('0x42')}]},_0x123531={};_0x123531[_0x1faf('0x4b')]=_[_0x1faf('0x47')](db['FaxAccount'][_0x1faf('0x5e')]);_0x123531[_0x1faf('0x46')]=_[_0x1faf('0x47')](_0x40de41[_0x1faf('0x46')]);_0x123531[_0x1faf('0x48')]=_[_0x1faf('0x4a')](_0x123531[_0x1faf('0x4b')],_0x123531[_0x1faf('0x46')]);_0x4d39c5[_0x1faf('0x49')]=_[_0x1faf('0x4a')](_0x123531[_0x1faf('0x4b')],qs[_0x1faf('0x4c')](_0x40de41[_0x1faf('0x46')][_0x1faf('0x4c')]));_0x4d39c5['attributes']=_0x4d39c5[_0x1faf('0x49')][_0x1faf('0x4d')]?_0x4d39c5[_0x1faf('0x49')]:_0x123531['model'];if(_0x40de41[_0x1faf('0x46')]['includeAll']){_0x4d39c5[_0x1faf('0x5a')]=[{'all':!![]}];}_0x4d39c5=_[_0x1faf('0x55')]({},_0x4d39c5,_0x40de41[_0x1faf('0x58')]);return db[_0x1faf('0x59')][_0x1faf('0x5f')](_0x4d39c5)[_0x1faf('0x22')](handleEntityNotFound(_0x223779,null))[_0x1faf('0x22')](respondWithResult(_0x223779,null))['catch'](handleError(_0x223779,null));};exports[_0x1faf('0x60')]=function(_0x3c07bb,_0x60a171){return db[_0x1faf('0x59')][_0x1faf('0x60')](_0x3c07bb[_0x1faf('0x61')],{})[_0x1faf('0x22')](function(_0x38cdc5){var _0x2de46e=_0x3c07bb[_0x1faf('0x62')]['get']({'plain':!![]});if(!_0x2de46e)throw new Error(_0x1faf('0x63'));if(_0x2de46e[_0x1faf('0x64')]===_0x1faf('0x62')){var _0x1a8d98=_0x38cdc5[_0x1faf('0x39')]({'plain':!![]});var _0x71ef3d=_0x1faf('0x65');return db['UserProfileSection'][_0x1faf('0x5f')]({'where':{'name':_0x71ef3d,'userProfileId':_0x2de46e[_0x1faf('0x66')]},'raw':!![]})['then'](function(_0x3cb820){if(_0x3cb820&&_0x3cb820[_0x1faf('0x67')]===0x0){return db[_0x1faf('0x3a')][_0x1faf('0x60')]({'name':_0x1a8d98[_0x1faf('0x3e')],'resourceId':_0x1a8d98['id'],'type':_0x3cb820[_0x1faf('0x3e')],'sectionId':_0x3cb820['id']},{})[_0x1faf('0x22')](function(){return _0x38cdc5;});}else{return _0x38cdc5;}})[_0x1faf('0x2d')](function(_0x28feac){logger[_0x1faf('0x29')](_0x1faf('0x68'),_0x28feac);throw _0x28feac;});}return _0x38cdc5;})['then'](respondWithResult(_0x60a171,0xc9))[_0x1faf('0x2d')](handleError(_0x60a171,null));};exports[_0x1faf('0x69')]=function(_0x40c776,_0x474f40){if(_0x40c776[_0x1faf('0x61')]['id']){delete _0x40c776[_0x1faf('0x61')]['id'];}return db[_0x1faf('0x59')]['find']({'where':{'id':_0x40c776[_0x1faf('0x5d')]['id']},'include':[{'model':db[_0x1faf('0x41')],'as':'mandatoryDispositionPause'}]})[_0x1faf('0x22')](handleEntityNotFound(_0x474f40,null))[_0x1faf('0x22')](saveUpdates(_0x40c776['body'],null))['then'](respondWithResult(_0x474f40,null))[_0x1faf('0x2d')](handleError(_0x474f40,null));};exports[_0x1faf('0x3b')]=function(_0x2c572a,_0x1ad76e){return db[_0x1faf('0x59')][_0x1faf('0x5f')]({'where':{'id':_0x2c572a[_0x1faf('0x5d')]['id']}})[_0x1faf('0x22')](handleEntityNotFound(_0x1ad76e,null))['then'](removeEntity(_0x1ad76e,null))[_0x1faf('0x2d')](handleError(_0x1ad76e,null));};exports[_0x1faf('0x6a')]=function(_0x1ce9fc,_0x410aa8){return db['FaxAccount']['describe']()['then'](respondWithResult(_0x410aa8,null))[_0x1faf('0x2d')](handleError(_0x410aa8,null));};exports[_0x1faf('0x6b')]=function(_0x997b93,_0x5427c6,_0x493633){if(_0x997b93[_0x1faf('0x61')]['id']){delete _0x997b93[_0x1faf('0x61')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x997b93[_0x1faf('0x5d')]['id']}})[_0x1faf('0x22')](handleEntityNotFound(_0x5427c6,null))[_0x1faf('0x22')](function(_0x4a8175){if(_0x4a8175){_0x997b93[_0x1faf('0x61')][_0x1faf('0x6c')]=_0x4a8175['id'];return db[_0x1faf('0x6d')][_0x1faf('0x60')](_0x997b93[_0x1faf('0x61')]);}})[_0x1faf('0x22')](respondWithResult(_0x5427c6,null))[_0x1faf('0x2d')](handleError(_0x5427c6,null));};exports[_0x1faf('0x6e')]=function(_0x106ac9,_0xe9e5ee,_0x1577c6){var _0x359ca3={'raw':![],'where':{}};var _0x2c6931={};var _0x467e57={'count':0x0,'rows':[]};return db[_0x1faf('0x59')]['findOne']({'where':{'id':_0x106ac9[_0x1faf('0x5d')]['id']}})[_0x1faf('0x22')](handleEntityNotFound(_0xe9e5ee,null))[_0x1faf('0x22')](function(_0x1e186b){if(_0x1e186b){_0x2c6931[_0x1faf('0x4b')]=_[_0x1faf('0x47')](db[_0x1faf('0x6d')]['rawAttributes']);_0x2c6931[_0x1faf('0x46')]=_[_0x1faf('0x47')](_0x106ac9[_0x1faf('0x46')]);_0x2c6931[_0x1faf('0x48')]=_[_0x1faf('0x4a')](_0x2c6931[_0x1faf('0x4b')],_0x2c6931[_0x1faf('0x46')]);_0x359ca3['attributes']=_[_0x1faf('0x4a')](_0x2c6931[_0x1faf('0x4b')],qs[_0x1faf('0x4c')](_0x106ac9[_0x1faf('0x46')][_0x1faf('0x4c')]));_0x359ca3[_0x1faf('0x49')]=_0x359ca3['attributes'][_0x1faf('0x4d')]?_0x359ca3['attributes']:_0x2c6931[_0x1faf('0x4b')];if(!_0x106ac9[_0x1faf('0x46')]['hasOwnProperty'](_0x1faf('0x4f'))){_0x359ca3[_0x1faf('0x32')]=qs['limit'](_0x106ac9[_0x1faf('0x46')][_0x1faf('0x32')]);_0x359ca3[_0x1faf('0x31')]=qs[_0x1faf('0x31')](_0x106ac9[_0x1faf('0x46')][_0x1faf('0x31')]);}_0x359ca3[_0x1faf('0x50')]=qs['sort'](_0x106ac9[_0x1faf('0x46')][_0x1faf('0x51')]);_0x359ca3[_0x1faf('0x52')]=qs['filters'](_['pick'](_0x106ac9[_0x1faf('0x46')],_0x2c6931['filters']));_0x359ca3[_0x1faf('0x52')][_0x1faf('0x6c')]=_0x1e186b['id'];if(_0x106ac9[_0x1faf('0x46')][_0x1faf('0x54')]){_0x359ca3[_0x1faf('0x52')]=_[_0x1faf('0x55')](_0x359ca3[_0x1faf('0x52')],{'$or':_[_0x1faf('0x45')](_0x359ca3[_0x1faf('0x49')],function(_0x485b7a){var _0x224e97={};_0x224e97[_0x485b7a]={'$like':'%'+_0x106ac9[_0x1faf('0x46')][_0x1faf('0x54')]+'%'};return _0x224e97;})});}_0x359ca3=_[_0x1faf('0x55')]({},_0x359ca3,_0x106ac9[_0x1faf('0x58')]);return db['Disposition'][_0x1faf('0x34')]({'where':_0x359ca3[_0x1faf('0x52')]})[_0x1faf('0x22')](function(_0x165858){_0x467e57[_0x1faf('0x34')]=_0x165858;if(_0x106ac9[_0x1faf('0x46')][_0x1faf('0x6f')]){_0x359ca3[_0x1faf('0x5a')]=[{'all':!![]}];}return db[_0x1faf('0x6d')][_0x1faf('0x5b')](_0x359ca3);})[_0x1faf('0x22')](function(_0x767cd8){_0x467e57[_0x1faf('0x5c')]=_0x767cd8;return _0x467e57;});}})[_0x1faf('0x22')](respondWithFilteredResult(_0xe9e5ee,_0x359ca3))[_0x1faf('0x2d')](handleError(_0xe9e5ee,null));};exports[_0x1faf('0x70')]=function(_0x303a13,_0x364d1d,_0x1cfc70){return db[_0x1faf('0x59')][_0x1faf('0x5f')]({'where':{'id':_0x303a13[_0x1faf('0x5d')]['id']}})[_0x1faf('0x22')](handleEntityNotFound(_0x364d1d,null))[_0x1faf('0x22')](function(_0x5ae252){if(_0x5ae252){return _0x5ae252[_0x1faf('0x70')](_0x303a13[_0x1faf('0x46')]['ids']);}})[_0x1faf('0x22')](respondWithStatusCode(_0x364d1d,null))['catch'](handleError(_0x364d1d,null));};exports['addAnswer']=function(_0xe07b6b,_0xed111d,_0x4b6ada){if(_0xe07b6b[_0x1faf('0x61')]['id']){delete _0xe07b6b['body']['id'];}return db[_0x1faf('0x59')]['find']({'where':{'id':_0xe07b6b[_0x1faf('0x5d')]['id']}})[_0x1faf('0x22')](handleEntityNotFound(_0xed111d,null))[_0x1faf('0x22')](function(_0x457370){if(_0x457370){_0xe07b6b['body']['FaxAccountId']=_0x457370['id'];return db['CannedAnswer'][_0x1faf('0x60')](_0xe07b6b[_0x1faf('0x61')]);}})['then'](respondWithResult(_0xed111d,null))['catch'](handleError(_0xed111d,null));};exports[_0x1faf('0x71')]=function(_0x305202,_0x45ff22,_0x539c2b){var _0x1d17e8={'raw':![],'where':{}};var _0xe41f32={};var _0x5dfe80={'count':0x0,'rows':[]};return db['FaxAccount'][_0x1faf('0x72')]({'where':{'id':_0x305202[_0x1faf('0x5d')]['id']}})['then'](handleEntityNotFound(_0x45ff22,null))[_0x1faf('0x22')](function(_0x1edd61){if(_0x1edd61){_0xe41f32[_0x1faf('0x4b')]=_['keys'](db['CannedAnswer'][_0x1faf('0x5e')]);_0xe41f32[_0x1faf('0x46')]=_[_0x1faf('0x47')](_0x305202[_0x1faf('0x46')]);_0xe41f32['filters']=_[_0x1faf('0x4a')](_0xe41f32[_0x1faf('0x4b')],_0xe41f32[_0x1faf('0x46')]);_0x1d17e8[_0x1faf('0x49')]=_[_0x1faf('0x4a')](_0xe41f32['model'],qs[_0x1faf('0x4c')](_0x305202[_0x1faf('0x46')][_0x1faf('0x4c')]));_0x1d17e8[_0x1faf('0x49')]=_0x1d17e8[_0x1faf('0x49')][_0x1faf('0x4d')]?_0x1d17e8[_0x1faf('0x49')]:_0xe41f32[_0x1faf('0x4b')];if(!_0x305202['query']['hasOwnProperty'](_0x1faf('0x4f'))){_0x1d17e8[_0x1faf('0x32')]=qs['limit'](_0x305202[_0x1faf('0x46')]['limit']);_0x1d17e8[_0x1faf('0x31')]=qs['offset'](_0x305202[_0x1faf('0x46')][_0x1faf('0x31')]);}_0x1d17e8['order']=qs['sort'](_0x305202[_0x1faf('0x46')][_0x1faf('0x51')]);_0x1d17e8[_0x1faf('0x52')]=qs[_0x1faf('0x48')](_[_0x1faf('0x53')](_0x305202[_0x1faf('0x46')],_0xe41f32['filters']));_0x1d17e8[_0x1faf('0x52')][_0x1faf('0x6c')]=_0x1edd61['id'];if(_0x305202['query'][_0x1faf('0x54')]){_0x1d17e8[_0x1faf('0x52')]=_[_0x1faf('0x55')](_0x1d17e8['where'],{'$or':_[_0x1faf('0x45')](_0x1d17e8[_0x1faf('0x49')],function(_0x536cf2){var _0x274eca={};_0x274eca[_0x536cf2]={'$like':'%'+_0x305202[_0x1faf('0x46')][_0x1faf('0x54')]+'%'};return _0x274eca;})});}_0x1d17e8=_['merge']({},_0x1d17e8,_0x305202[_0x1faf('0x58')]);return db[_0x1faf('0x73')][_0x1faf('0x34')]({'where':_0x1d17e8[_0x1faf('0x52')]})['then'](function(_0x23e9c9){_0x5dfe80[_0x1faf('0x34')]=_0x23e9c9;if(_0x305202[_0x1faf('0x46')][_0x1faf('0x6f')]){_0x1d17e8['include']=[{'all':!![]}];}return db[_0x1faf('0x73')][_0x1faf('0x5b')](_0x1d17e8);})['then'](function(_0x349894){_0x5dfe80[_0x1faf('0x5c')]=_0x349894;return _0x5dfe80;});}})[_0x1faf('0x22')](respondWithFilteredResult(_0x45ff22,_0x1d17e8))[_0x1faf('0x2d')](handleError(_0x45ff22,null));};exports[_0x1faf('0x74')]=function(_0x213993,_0x16f83e,_0x489959){return db[_0x1faf('0x59')][_0x1faf('0x5f')]({'where':{'id':_0x213993[_0x1faf('0x5d')]['id']}})[_0x1faf('0x22')](handleEntityNotFound(_0x16f83e,null))[_0x1faf('0x22')](function(_0x3a2720){if(_0x3a2720){return _0x3a2720[_0x1faf('0x74')](_0x213993[_0x1faf('0x46')][_0x1faf('0x75')]);}})['then'](respondWithStatusCode(_0x16f83e,null))[_0x1faf('0x2d')](handleError(_0x16f83e,null));};exports[_0x1faf('0x76')]=function(_0x15e382,_0x2cef53,_0x4f1abf){return db['FaxInteraction'][_0x1faf('0x5f')]({'where':{'id':_0x15e382[_0x1faf('0x5d')]['id']}})[_0x1faf('0x22')](handleEntityNotFound(_0x2cef53,null))['then'](function(_0x230a02){if(_0x230a02){return _0x230a02[_0x1faf('0x76')](_0x15e382[_0x1faf('0x61')][_0x1faf('0x75')],_[_0x1faf('0x77')](_0x15e382[_0x1faf('0x61')],[_0x1faf('0x75'),'id'])||{});}})[_0x1faf('0x22')](respondWithResult(_0x2cef53,null))['catch'](handleError(_0x2cef53,null));};exports[_0x1faf('0x78')]=function(_0x274b31,_0x369d33,_0x2626b5){var _0x404cf2={'raw':![],'where':{}};var _0x3efa71={};var _0x2a418a={'count':0x0,'rows':[]};return db[_0x1faf('0x59')]['findOne']({'where':{'id':_0x274b31[_0x1faf('0x5d')]['id']}})[_0x1faf('0x22')](handleEntityNotFound(_0x369d33,null))[_0x1faf('0x22')](function(_0x8222aa){if(_0x8222aa){_0x3efa71[_0x1faf('0x4b')]=_['keys'](db[_0x1faf('0x79')][_0x1faf('0x5e')]);_0x3efa71[_0x1faf('0x46')]=_['keys'](_0x274b31[_0x1faf('0x46')]);_0x3efa71[_0x1faf('0x48')]=_[_0x1faf('0x4a')](_0x3efa71['model'],_0x3efa71[_0x1faf('0x46')]);_0x404cf2[_0x1faf('0x49')]=_[_0x1faf('0x4a')](_0x3efa71[_0x1faf('0x4b')],qs[_0x1faf('0x4c')](_0x274b31[_0x1faf('0x46')]['fields']));_0x404cf2['attributes']=_0x404cf2[_0x1faf('0x49')][_0x1faf('0x4d')]?_0x404cf2[_0x1faf('0x49')]:_0x3efa71[_0x1faf('0x4b')];if(!_0x274b31['query']['hasOwnProperty'](_0x1faf('0x4f'))){_0x404cf2['limit']=qs[_0x1faf('0x32')](_0x274b31[_0x1faf('0x46')][_0x1faf('0x32')]);_0x404cf2[_0x1faf('0x31')]=qs[_0x1faf('0x31')](_0x274b31[_0x1faf('0x46')][_0x1faf('0x31')]);}_0x404cf2[_0x1faf('0x50')]=qs[_0x1faf('0x51')](_0x274b31[_0x1faf('0x46')][_0x1faf('0x51')]);_0x404cf2[_0x1faf('0x52')]=qs['filters'](_['pick'](_0x274b31[_0x1faf('0x46')],_0x3efa71[_0x1faf('0x48')]));_0x404cf2['where'][_0x1faf('0x6c')]=_0x8222aa['id'];if(_0x274b31[_0x1faf('0x46')][_0x1faf('0x54')]){_0x404cf2['where']=_[_0x1faf('0x55')](_0x404cf2[_0x1faf('0x52')],{'$or':_[_0x1faf('0x45')](_0x404cf2[_0x1faf('0x49')],function(_0x37b5e5){var _0x3b8982={};_0x3b8982[_0x37b5e5]={'$like':'%'+_0x274b31[_0x1faf('0x46')]['filter']+'%'};return _0x3b8982;})});}_0x404cf2=_[_0x1faf('0x55')]({},_0x404cf2,_0x274b31[_0x1faf('0x58')]);return db[_0x1faf('0x79')][_0x1faf('0x34')]({'where':_0x404cf2[_0x1faf('0x52')]})['then'](function(_0x329bf8){_0x2a418a['count']=_0x329bf8;if(_0x274b31['query'][_0x1faf('0x6f')]){_0x404cf2[_0x1faf('0x5a')]=[{'model':db[_0x1faf('0x7a')],'as':_0x1faf('0x7b'),'required':![]},{'model':db['User'],'as':_0x1faf('0x7c'),'attributes':['name',_0x1faf('0x7d'),_0x1faf('0x7e')],'required':![]},{'model':db[_0x1faf('0x7f')],'as':_0x1faf('0x80'),'attributes':['id',_0x1faf('0x3e'),'color'],'where':_0x274b31[_0x1faf('0x46')][_0x1faf('0x81')]?{'id':_0x274b31[_0x1faf('0x46')][_0x1faf('0x81')]}:undefined,'required':_0x274b31[_0x1faf('0x46')][_0x1faf('0x81')]?!![]:![]}];}return db[_0x1faf('0x79')]['findAll'](_0x404cf2);})[_0x1faf('0x22')](function(_0x7a375f){_0x2a418a[_0x1faf('0x5c')]=_0x7a375f;return _0x2a418a;});}})[_0x1faf('0x22')](respondWithFilteredResult(_0x369d33,_0x404cf2))[_0x1faf('0x2d')](handleError(_0x369d33,null));};exports[_0x1faf('0x82')]=function(_0x1c1711,_0x29b07c){var _0x1b11f8=_0x1c1711['params']['id'];var _0x4fc179=_0x1c1711[_0x1faf('0x61')];var _0x53bf92=0xc8;var _0x25a9c0=null;return db[_0x1faf('0x83')][_0x1faf('0x84')]({'isolationLevel':db[_0x1faf('0x83')][_0x1faf('0x85')][_0x1faf('0x86')]['READ_COMMITTED']},function(_0x1d13c8){return db[_0x1faf('0x59')]['findOne']({'where':{'id':_0x1b11f8},'transaction':_0x1d13c8})[_0x1faf('0x22')](function(_0x2d3636){if(_0x2d3636){return db[_0x1faf('0x87')][_0x1faf('0x3b')]({'where':{'FaxAccountId':_0x1b11f8},'transaction':_0x1d13c8})[_0x1faf('0x22')](function(){var _0x4e8bba=_['map'](_0x4fc179,function(_0x463702){_0x463702[_0x1faf('0x6c')]=_0x1b11f8;return _0x463702;});return db['FaxApplication'][_0x1faf('0x88')](_0x4e8bba,{'transaction':_0x1d13c8});});}else{_0x53bf92=0x194;_0x25a9c0=[];}});})['then'](function(){if(_0x53bf92!==0x194){return db['FaxApplication'][_0x1faf('0x89')]({'where':{'FaxAccountId':_0x1b11f8},'order':_0x1faf('0x8a')})[_0x1faf('0x22')](function(_0x280d61){_0x25a9c0=_0x280d61;});}})[_0x1faf('0x2d')](function(_0x35f40c){_0x53bf92=0x1f4;logger[_0x1faf('0x29')](_0x35f40c[_0x1faf('0x3d')]);if(_0x35f40c[_0x1faf('0x3e')]){delete _0x35f40c[_0x1faf('0x3e')];}_0x25a9c0=_0x35f40c;})[_0x1faf('0x8b')](function(){if(_0x25a9c0===null){_0x29b07c[_0x1faf('0x2e')](_0x53bf92);}else{if(_0x53bf92===0x1f4){_0x29b07c['status'](_0x53bf92)[_0x1faf('0x3f')](_0x25a9c0);}else{_0x29b07c[_0x1faf('0x2f')](_0x53bf92)['json'](_0x25a9c0);}}});};exports['getApplications']=function(_0x1a734e,_0x3b1614,_0x487534){var _0x37065a={};var _0x4e5869={};var _0x499869;var _0x55c5a1;return db['FaxAccount'][_0x1faf('0x72')]({'where':{'id':_0x1a734e[_0x1faf('0x5d')]['id']}})[_0x1faf('0x22')](handleEntityNotFound(_0x3b1614,null))[_0x1faf('0x22')](function(_0x8e9f77){if(_0x8e9f77){_0x499869=_0x8e9f77;_0x4e5869[_0x1faf('0x4b')]=_[_0x1faf('0x47')](db[_0x1faf('0x87')][_0x1faf('0x5e')]);_0x4e5869['query']=_['keys'](_0x1a734e[_0x1faf('0x46')]);_0x4e5869[_0x1faf('0x48')]=_[_0x1faf('0x4a')](_0x4e5869[_0x1faf('0x4b')],_0x4e5869['query']);_0x37065a[_0x1faf('0x49')]=_[_0x1faf('0x4a')](_0x4e5869['model'],qs['fields'](_0x1a734e[_0x1faf('0x46')][_0x1faf('0x4c')]));_0x37065a[_0x1faf('0x49')]=_0x37065a[_0x1faf('0x49')]['length']?_0x37065a['attributes']:_0x4e5869['model'];_0x37065a[_0x1faf('0x50')]=qs[_0x1faf('0x51')](_0x1a734e['query']['sort']);_0x37065a[_0x1faf('0x52')]=qs['filters'](_[_0x1faf('0x53')](_0x1a734e[_0x1faf('0x46')],_0x4e5869['filters']));if(_0x1a734e[_0x1faf('0x46')][_0x1faf('0x54')]){_0x37065a[_0x1faf('0x52')]=_[_0x1faf('0x55')](_0x37065a['where'],{'$or':_[_0x1faf('0x45')](_0x37065a['attributes'],function(_0xeb76a8){var _0x506b4e={};_0x506b4e[_0xeb76a8]={'$like':'%'+_0x1a734e[_0x1faf('0x46')]['filter']+'%'};return _0x506b4e;})});}_0x37065a=_['merge']({},_0x37065a,_0x1a734e[_0x1faf('0x58')]);return _0x499869[_0x1faf('0x8c')](_0x37065a);}})[_0x1faf('0x22')](function(_0x586851){if(_0x586851){_0x55c5a1=_0x586851[_0x1faf('0x4d')];if(!_0x1a734e[_0x1faf('0x46')][_0x1faf('0x4e')](_0x1faf('0x4f'))){_0x37065a[_0x1faf('0x32')]=qs['limit'](_0x1a734e['query'][_0x1faf('0x32')]);_0x37065a[_0x1faf('0x31')]=qs[_0x1faf('0x31')](_0x1a734e[_0x1faf('0x46')][_0x1faf('0x31')]);}return _0x499869['getApplications'](_0x37065a);}})[_0x1faf('0x22')](function(_0x4c03fe){if(_0x4c03fe){return _0x4c03fe?{'count':_0x55c5a1,'rows':_0x4c03fe}:null;}})[_0x1faf('0x22')](respondWithResult(_0x3b1614,null))['catch'](handleError(_0x3b1614,null));};function Extension(_0x5b1d21,_0x1cf7c8,_0x598b29,_0x57c6f2){this['context']=_0x1faf('0x8d');this[_0x1faf('0x8e')]=_0x5b1d21['localstationid'];this[_0x1faf('0x8f')]=_0x57c6f2;this[_0x1faf('0x56')]=_0x1faf('0x90');this[_0x1faf('0x91')]=_0x1faf('0x92');this[_0x1faf('0x6c')]=_0x5b1d21['id'];this[_0x1faf('0x8a')]=_0x1cf7c8;this[_0x1faf('0x93')]=_0x598b29;}function createExtensionsReciveFax(_0x35dc18){var _0xb960a7=0x1;var _0x15e43b=[];_0x15e43b[_0x1faf('0x94')](new Extension(_0x35dc18,_0xb960a7,'',_0x1faf('0x95')));_0xb960a7+=0x1;_0x15e43b[_0x1faf('0x94')](new Extension(_0x35dc18,_0xb960a7,_0x1faf('0x96'),_0x1faf('0x97')));_0xb960a7+=0x1;for(var _0x2701b1 in _0x35dc18){if(_0x35dc18[_0x1faf('0x4e')](_0x2701b1)&&(_0x2701b1==='ecm'||_0x2701b1===_0x1faf('0x98')||_0x2701b1===_0x1faf('0x99')||_0x2701b1===_0x1faf('0x9a')||_0x2701b1===_0x1faf('0x9b')||_0x2701b1==='maxrate'||_0x2701b1===_0x1faf('0x9c')||_0x2701b1===_0x1faf('0x9d')||_0x2701b1==='t38timeout')){_0x15e43b[_0x1faf('0x94')](new Extension(_0x35dc18,_0xb960a7,'FAXOPT('+_0x2701b1+')='+_0x35dc18[_0x2701b1],_0x1faf('0x97')));_0xb960a7+=0x1;}}_0x15e43b[_0x1faf('0x94')](new Extension(_0x35dc18,_0xb960a7,'6',_0x1faf('0x9e')));_0xb960a7+=0x1;_0x15e43b[_0x1faf('0x94')](new Extension(_0x35dc18,_0xb960a7,'/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',_0x1faf('0x9f')));_0xb960a7=0x0;return _0x15e43b;}exports[_0x1faf('0xa0')]=function(_0x258bc5,_0x407be0,_0x3cb445){var _0x2d91b2;return db[_0x1faf('0x83')]['transaction'](function(_0x5192fe){return db[_0x1faf('0x59')][_0x1faf('0x60')](_0x258bc5[_0x1faf('0x61')],{'transaction':_0x5192fe})[_0x1faf('0x22')](function(_0x566d3a){_0x2d91b2=_0x566d3a[_0x1faf('0x39')]({'plain':!![]});return db[_0x1faf('0xa1')][_0x1faf('0x88')](createExtensionsReciveFax(_0x2d91b2),{'transaction':_0x5192fe});});})[_0x1faf('0x22')](function(){return _0x2d91b2;})[_0x1faf('0x22')](respondWithResult(_0x407be0,null))[_0x1faf('0x2d')](handleError(_0x407be0,null));};exports[_0x1faf('0xa2')]=function(_0x3bce0c,_0x428eb7,_0x3f82c3){var _0x57dadc;return db[_0x1faf('0x83')][_0x1faf('0x84')](function(_0xb7898a){return db[_0x1faf('0x59')]['update'](_0x3bce0c[_0x1faf('0x61')],{'where':{'id':_0x3bce0c[_0x1faf('0x61')]['id']},'transaction':_0xb7898a})[_0x1faf('0x22')](function(_0x447a5f){return db[_0x1faf('0xa1')][_0x1faf('0x3b')]({'where':{'FaxAccountId':_0x3bce0c[_0x1faf('0x61')]['id']},'transaction':_0xb7898a})[_0x1faf('0x22')](function(_0x369ef3){return db[_0x1faf('0xa1')]['bulkCreate'](createExtensionsReciveFax(_[_0x1faf('0x77')](_0x3bce0c[_0x1faf('0x61')],['tech',_0x1faf('0x44'),_0x1faf('0xa3'),'updatedAt','TrunkId',_0x1faf('0xa4')])),{'transaction':_0xb7898a});});});})['then'](function(){return db['FaxAccount'][_0x1faf('0xa5')](_0x3bce0c['body']['id']);})['then'](respondWithResult(_0x428eb7,null))[_0x1faf('0x2d')](handleError(_0x428eb7,null));};exports['getMessages']=function(_0xadd197,_0x2e57d1,_0x4c8fe5){var _0x33c58e={'raw':!![],'where':{}};var _0x55d64f={};var _0x1eeac9={'count':0x0,'rows':[]};return db[_0x1faf('0x59')][_0x1faf('0x72')]({'where':{'id':_0xadd197['params']['id']}})['then'](handleEntityNotFound(_0x2e57d1,null))[_0x1faf('0x22')](function(_0x693738){if(_0x693738){_0x55d64f[_0x1faf('0x4b')]=_['keys'](db[_0x1faf('0xa6')][_0x1faf('0x5e')]);_0x55d64f[_0x1faf('0x46')]=_[_0x1faf('0x47')](_0xadd197[_0x1faf('0x46')]);_0x55d64f[_0x1faf('0x48')]=_[_0x1faf('0x4a')](_0x55d64f[_0x1faf('0x4b')],_0x55d64f[_0x1faf('0x46')]);_0x33c58e[_0x1faf('0x49')]=_[_0x1faf('0x4a')](_0x55d64f[_0x1faf('0x4b')],qs[_0x1faf('0x4c')](_0xadd197[_0x1faf('0x46')][_0x1faf('0x4c')]));_0x33c58e[_0x1faf('0x49')]=_0x33c58e[_0x1faf('0x49')]['length']?_0x33c58e[_0x1faf('0x49')]:_0x55d64f[_0x1faf('0x4b')];if(!_0xadd197['query'][_0x1faf('0x4e')](_0x1faf('0x4f'))){_0x33c58e[_0x1faf('0x32')]=qs[_0x1faf('0x32')](_0xadd197[_0x1faf('0x46')][_0x1faf('0x32')]);_0x33c58e[_0x1faf('0x31')]=qs[_0x1faf('0x31')](_0xadd197[_0x1faf('0x46')]['offset']);}_0x33c58e[_0x1faf('0x50')]=qs[_0x1faf('0x51')](_0xadd197[_0x1faf('0x46')][_0x1faf('0x51')]);_0x33c58e[_0x1faf('0x52')]=qs[_0x1faf('0x48')](_[_0x1faf('0x53')](_0xadd197[_0x1faf('0x46')],_0x55d64f[_0x1faf('0x48')]));_0x33c58e[_0x1faf('0x52')]['FaxAccountId']=_0x693738['id'];if(_0xadd197['query']['filter']){_0x33c58e[_0x1faf('0x52')]=_[_0x1faf('0x55')](_0x33c58e[_0x1faf('0x52')],{'$or':_[_0x1faf('0x45')](_0x33c58e['attributes'],function(_0x29ac21){var _0x5a935e={};_0x5a935e[_0x29ac21]={'$like':'%'+_0xadd197[_0x1faf('0x46')]['filter']+'%'};return _0x5a935e;})});}if(_0xadd197[_0x1faf('0x46')]['$gte']){var _0x16a7ca=_0xadd197[_0x1faf('0x46')][_0x1faf('0xa7')][_0x1faf('0xa8')](',');var _0x56614c={};_0x56614c[_0x16a7ca[0x0]]={'$gte':moment(_0x16a7ca[0x1])[_0x1faf('0xa9')](_0x1faf('0xaa'))};_0x33c58e[_0x1faf('0x52')]=_['merge'](_0x33c58e[_0x1faf('0x52')],_0x56614c);}_0x33c58e=_['merge']({},_0x33c58e,_0xadd197['options']);return db[_0x1faf('0xa6')][_0x1faf('0x34')]({'where':_0x33c58e[_0x1faf('0x52')]})[_0x1faf('0x22')](function(_0x339293){_0x1eeac9[_0x1faf('0x34')]=_0x339293;if(_0xadd197[_0x1faf('0x46')][_0x1faf('0x6f')]){_0x33c58e[_0x1faf('0x5a')]=[{'all':!![]}];}return db[_0x1faf('0xa6')]['findAll'](_0x33c58e);})[_0x1faf('0x22')](function(_0x5bb2ed){_0x1eeac9[_0x1faf('0x5c')]=_0x5bb2ed;return _0x1eeac9;});}})[_0x1faf('0x22')](respondWithFilteredResult(_0x2e57d1,_0x33c58e))[_0x1faf('0x2d')](handleError(_0x2e57d1,null));};exports[_0x1faf('0x3f')]=function(_0xfbec4f,_0xd10f6f,_0x4de93e){var _0xfa1ecb,_0x4e1a0d={},_0x454876;if(_0xfbec4f[_0x1faf('0x61')]['to']){_0x454876=_0xfbec4f[_0x1faf('0x61')]['to'][0x0];}return db[_0x1faf('0x59')][_0x1faf('0x5f')]({'where':{'id':_0xfbec4f[_0x1faf('0x5d')]['id']},'include':[{'model':db[_0x1faf('0xab')],'as':_0x1faf('0xac'),'include':[{'model':db['CmContact'],'as':_0x1faf('0xad'),'where':{'fax':_0x454876},'limit':0x1,'order':[[_0x1faf('0xae'),'DESC']]}]}]})['then'](handleEntityNotFound(_0xd10f6f,null))['then'](function(_0x19c4de){_0xfa1ecb=_0x19c4de;if(_0xfbec4f['body'][_0x1faf('0xaf')]&&_0xfbec4f[_0x1faf('0x61')][_0x1faf('0xaf')][_0x1faf('0x4d')]){for(var _0x27dd84=0x0;_0x27dd84<_0xfbec4f[_0x1faf('0x61')][_0x1faf('0xaf')][_0x1faf('0x4d')];_0x27dd84+=0x1){_0xfbec4f[_0x1faf('0x61')][_0x1faf('0xaf')][_0x27dd84]={'filename':_0xfbec4f[_0x1faf('0x61')][_0x1faf('0xaf')][_0x27dd84][_0x1faf('0x3e')],'id':_0xfbec4f['body'][_0x1faf('0xaf')][_0x27dd84]['id'],'path':path[_0x1faf('0xb0')](config[_0x1faf('0xb1')],_0x1faf('0xb2'),_0xfbec4f['body'][_0x1faf('0xaf')][_0x27dd84]['basename'])};}}return respondWithRpcPromise('CheckAfterSend',_0x1faf('0xb3'),{'FaxAccountId':_[_0x1faf('0xb4')](_0xfbec4f['params']['id'])?undefined:_0xfbec4f['params']['id'],'path':_[_0x1faf('0xb4')](_0xfbec4f[_0x1faf('0x61')][_0x1faf('0xaf')][0x0]['path'])?undefined:_0xfbec4f['body'][_0x1faf('0xaf')][0x0][_0x1faf('0x7')],'fax':_[_0x1faf('0xb4')](_0xfbec4f[_0x1faf('0x61')]['to'][0x0])?undefined:_0xfbec4f[_0x1faf('0x61')]['to'][0x0]},client9002);})[_0x1faf('0x22')](function(){if(_0xfa1ecb){if(_['isNil'](_0xfbec4f['body'][_0x1faf('0xb5')])){_0xfbec4f[_0x1faf('0x61')][_0x1faf('0xb5')]=util[_0x1faf('0xa9')](_0x1faf('0xb6'),_0xfa1ecb['name'],_0xfa1ecb[_0x1faf('0xb7')]);}if(_0xfa1ecb[_0x1faf('0xac')]){if(_0xfa1ecb[_0x1faf('0xac')][_0x1faf('0xad')][_0x1faf('0x4d')]){return _0xfa1ecb['List'][_0x1faf('0xad')][0x0];}else{return db[_0x1faf('0x7a')][_0x1faf('0x60')](_[_0x1faf('0x19')](_0xfbec4f[_0x1faf('0x61')],{'firstName':_0xfbec4f[_0x1faf('0x61')]['to'][0x0],'phone':_0xfbec4f[_0x1faf('0x61')]['to'][0x0],'fax':_0xfbec4f[_0x1faf('0x61')]['to'][0x0],'ListId':_0xfa1ecb[_0x1faf('0xa4')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x1faf('0x22')](function(_0x26ab3f){if(_0x26ab3f){return db[_0x1faf('0x79')][_0x1faf('0x5f')]({'where':{'ContactId':_0x26ab3f['id'],'closed':![],'FaxAccountId':_0xfa1ecb['id']}})['then'](function(_0x3348eb){if(_0x3348eb){return[_0x3348eb,![]];}return db[_0x1faf('0x79')]['create']({'UserId':_0xfbec4f[_0x1faf('0x62')]['id'],'ContactId':_0x26ab3f['id'],'FaxAccountId':_0xfa1ecb['id'],'fax':_0xfbec4f[_0x1faf('0x61')]['to'][0x0],'firstMsgDirection':_0x1faf('0xb8'),'Messages':[_[_0x1faf('0x55')](_0xfbec4f['body'],{'read':![],'body':_0xfbec4f[_0x1faf('0x61')]['attachments'][0x0][_0x1faf('0xb9')],'FaxAccountId':_0xfa1ecb['id'],'UserId':_0xfbec4f['user']['id'],'ContactId':_0x26ab3f['id'],'AttachmentId':_0xfbec4f[_0x1faf('0x61')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x1faf('0xa6')],'as':_0x1faf('0xba')}]})[_0x1faf('0x22')](function(_0x16dc7d){return[_0x16dc7d,!![]];});});}else{throw new Error(_0x1faf('0xbb'));}})[_0x1faf('0xbc')](function(_0x17e226,_0xa9467c){if(_0xa9467c){return _0x17e226;}return db['FaxMessage'][_0x1faf('0x60')]({'direction':_0x1faf('0xb8'),'read':![],'body':_0xfbec4f[_0x1faf('0x61')][_0x1faf('0xaf')][0x0][_0x1faf('0xb9')],'FaxAccountId':_0xfa1ecb['id'],'FaxInteractionId':_0x17e226['id'],'UserId':_0xfbec4f[_0x1faf('0x62')]['id'],'ContactId':_0x17e226[_0x1faf('0xbd')],'AttachmentId':_0xfbec4f[_0x1faf('0x61')][_0x1faf('0xaf')][0x0]['id']})[_0x1faf('0x22')](function(_0x382df0){_0x17e226[_0x1faf('0xbe')][_0x1faf('0xba')]=[];_0x17e226['dataValues']['Messages'][_0x1faf('0x94')](_0x382df0[_0x1faf('0xbe')]);return _0x17e226;});})[_0x1faf('0x22')](function(_0x2d6286){respondWithRpcPromise(_0x1faf('0xbf'),_0x1faf('0xbf'),{'FaxAccountId':_[_0x1faf('0xb4')](_0xfbec4f[_0x1faf('0x5d')]['id'])?undefined:_0xfbec4f[_0x1faf('0x5d')]['id'],'path':_[_0x1faf('0xb4')](_0xfbec4f[_0x1faf('0x61')][_0x1faf('0xaf')][0x0][_0x1faf('0x7')])?undefined:_0xfbec4f['body'][_0x1faf('0xaf')][0x0]['path'],'fax':_[_0x1faf('0xb4')](_0xfbec4f[_0x1faf('0x61')]['to'][0x0])?undefined:_0xfbec4f[_0x1faf('0x61')]['to'][0x0],'AttachmentId':_0xfbec4f[_0x1faf('0x61')]['attachments'][0x0]['id']},client9002)['then'](function(_0x2db69d){logger[_0x1faf('0x23')](_0x1faf('0xc0'),_0x2db69d);})[_0x1faf('0x2d')](function(_0x21ff73){logger[_0x1faf('0x23')]('SendFaxRpc,\x20%s',_0x21ff73);});return _0x2d6286;})[_0x1faf('0x22')](respondWithResult(_0xd10f6f,null))[_0x1faf('0x2d')](handleError(_0xd10f6f,null));};exports[_0x1faf('0xc1')]=function(_0x5269ca,_0x54bdbf,_0x3c8110){return db[_0x1faf('0x59')][_0x1faf('0x5f')]({'where':{'id':_0x5269ca[_0x1faf('0x5d')]['id']}})[_0x1faf('0x22')](handleEntityNotFound(_0x54bdbf,null))[_0x1faf('0x22')](function(_0x15f698){if(_0x15f698){return _0x15f698['addAgents'](_0x5269ca[_0x1faf('0x61')][_0x1faf('0x75')],_['omit'](_0x5269ca[_0x1faf('0x61')],[_0x1faf('0x75'),'id'])||{})[_0x1faf('0xbc')](function(_0x1da4ce){for(var _0x5f107c=0x0;_0x5f107c<_0x5269ca[_0x1faf('0x61')][_0x1faf('0x75')][_0x1faf('0x4d')];_0x5f107c+=0x1){socket[_0x1faf('0xc2')]('userFaxAccount:save',{'UserId':Number(_0x5269ca[_0x1faf('0x61')][_0x1faf('0x75')][_0x5f107c]),'FaxAccountId':Number(_0x5269ca[_0x1faf('0x5d')]['id'])});}return _0x1da4ce;});}})[_0x1faf('0x22')](respondWithResult(_0x54bdbf,null))[_0x1faf('0x2d')](handleError(_0x54bdbf,null));};exports['removeAgents']=function(_0x3eb1eb,_0x3e0e7c,_0x15d9d7){return db['FaxAccount'][_0x1faf('0x5f')]({'where':{'id':_0x3eb1eb[_0x1faf('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3e0e7c,null))['then'](function(_0x4be84a){if(_0x4be84a){return _0x4be84a['removeAgents'](_0x3eb1eb[_0x1faf('0x46')][_0x1faf('0x75')])[_0x1faf('0x22')](function(){if(_[_0x1faf('0xc3')](_0x3eb1eb[_0x1faf('0x46')][_0x1faf('0x75')])){for(var _0x10f319=0x0;_0x10f319<_0x3eb1eb[_0x1faf('0x46')][_0x1faf('0x75')][_0x1faf('0x4d')];_0x10f319+=0x1){socket[_0x1faf('0xc2')]('userFaxAccount:remove',{'UserId':Number(_0x3eb1eb['query'][_0x1faf('0x75')][_0x10f319]),'FaxAccountId':Number(_0x3eb1eb['params']['id'])});}}else{socket['emit'](_0x1faf('0xc4'),{'UserId':Number(_0x3eb1eb[_0x1faf('0x46')][_0x1faf('0x75')]),'FaxAccountId':Number(_0x3eb1eb[_0x1faf('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x3e0e7c,null))[_0x1faf('0x2d')](handleError(_0x3e0e7c,null));};exports['getAgents']=function(_0x188fe7,_0x4470c2,_0x5865ff){var _0x333e20={};var _0x4c73b5={};var _0x25b6d6;var _0x571447;return db[_0x1faf('0x59')][_0x1faf('0x72')]({'where':{'id':_0x188fe7[_0x1faf('0x5d')]['id']}})[_0x1faf('0x22')](handleEntityNotFound(_0x4470c2,null))[_0x1faf('0x22')](function(_0x10d69c){if(_0x10d69c){_0x25b6d6=_0x10d69c;_0x4c73b5['model']=_['keys'](db[_0x1faf('0xc5')][_0x1faf('0x5e')]);_0x4c73b5[_0x1faf('0x46')]=_[_0x1faf('0x47')](_0x188fe7['query']);_0x4c73b5[_0x1faf('0x48')]=_[_0x1faf('0x4a')](_0x4c73b5['model'],_0x4c73b5[_0x1faf('0x46')]);_0x333e20[_0x1faf('0x49')]=_['intersection'](_0x4c73b5[_0x1faf('0x4b')],qs[_0x1faf('0x4c')](_0x188fe7['query'][_0x1faf('0x4c')]));_0x333e20[_0x1faf('0x49')]=_0x333e20[_0x1faf('0x49')]['length']?_0x333e20[_0x1faf('0x49')]:_0x4c73b5[_0x1faf('0x4b')];_0x333e20[_0x1faf('0x50')]=qs['sort'](_0x188fe7[_0x1faf('0x46')]['sort']);_0x333e20[_0x1faf('0x52')]=qs[_0x1faf('0x48')](_['pick'](_0x188fe7[_0x1faf('0x46')],_0x4c73b5['filters']));if(_0x188fe7[_0x1faf('0x46')]['filter']){_0x333e20[_0x1faf('0x52')]=_[_0x1faf('0x55')](_0x333e20[_0x1faf('0x52')],{'$or':_[_0x1faf('0x45')](_0x333e20[_0x1faf('0x49')],function(_0x4d17d6){var _0x209bf6={};_0x209bf6[_0x4d17d6]={'$like':'%'+_0x188fe7[_0x1faf('0x46')][_0x1faf('0x54')]+'%'};return _0x209bf6;})});}_0x333e20=_['merge']({},_0x333e20,_0x188fe7['options']);return _0x25b6d6['getAgents'](_0x333e20);}})['then'](function(_0x4cf193){if(_0x4cf193){_0x571447=_0x4cf193[_0x1faf('0x4d')];if(!_0x188fe7[_0x1faf('0x46')][_0x1faf('0x4e')](_0x1faf('0x4f'))){_0x333e20[_0x1faf('0x32')]=qs['limit'](_0x188fe7[_0x1faf('0x46')][_0x1faf('0x32')]);_0x333e20[_0x1faf('0x31')]=qs[_0x1faf('0x31')](_0x188fe7[_0x1faf('0x46')][_0x1faf('0x31')]);}return _0x25b6d6['getAgents'](_0x333e20);}})[_0x1faf('0x22')](function(_0x5dba40){if(_0x5dba40){return _0x5dba40?{'count':_0x571447,'rows':_0x5dba40}:null;}})[_0x1faf('0x22')](respondWithResult(_0x4470c2,null))['catch'](handleError(_0x4470c2,null));}; \ No newline at end of file +var _0x0612=['keys','filters','attributes','fields','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','intersection','length','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','body','describe','addDisposition','getDispositions','Disposition','FaxAccountId','options','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','addInteraction','omit','getInteractions','findOne','FaxInteraction','CmContact','Contact','User','Owner','Tag','color','tag','transaction','sequelize','READ_COMMITTED','FaxApplication','bulkCreate','priority','finally','getApplications','context','app','system','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','VoiceExtension','updateAccountApplications','tech','updatedAt','TrunkId','ListId','getMessages','FaxMessage','$gte','split','CmList','List','Contacts','DESC','attachments','join','root','basename','CheckAfterSend','isNil','path','from','format','\x22%s\x22\x20<%s>','List\x20not\x20found','out','filename','Messages','spread','ContactId','dataValues','SendFax','info','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','localhost','redis','register','jayson/promise','client','http','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','status','end','json','undefined','count','offset','set','Content-Range','apply','save','update','destroy','FaxAccounts','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query'];(function(_0x7a3247,_0x15cb12){var _0x1bfde5=function(_0x62bbef){while(--_0x62bbef){_0x7a3247['push'](_0x7a3247['shift']());}};_0x1bfde5(++_0x15cb12);}(_0x0612,0x7e));var _0x2061=function(_0x39f58d,_0x55b618){_0x39f58d=_0x39f58d-0x0;var _0x46ae95=_0x0612[_0x39f58d];return _0x46ae95;};'use strict';var emlformat=require(_0x2061('0x0'));var rimraf=require(_0x2061('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2061('0x2'));var rp=require(_0x2061('0x3'));var moment=require(_0x2061('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2061('0x5'));var util=require('util');var path=require('path');var sox=require(_0x2061('0x6'));var csv=require(_0x2061('0x7'));var ejs=require(_0x2061('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2061('0x9'));var squel=require(_0x2061('0xa'));var crypto=require(_0x2061('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2061('0xc'));var toCsv=require(_0x2061('0x7'));var querystring=require(_0x2061('0xd'));var Papa=require(_0x2061('0xe'));var Redis=require('ioredis');var authService=require(_0x2061('0xf'));var qs=require(_0x2061('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2061('0x11'));var logger=require(_0x2061('0x12'))(_0x2061('0x13'));var utils=require(_0x2061('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2061('0x15'))['db'];config['redis']=_[_0x2061('0x16')](config['redis'],{'host':_0x2061('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2061('0x18')]));require('./faxAccount.socket')[_0x2061('0x19')](socket);var jayson=require(_0x2061('0x1a'));var client=jayson[_0x2061('0x1b')][_0x2061('0x1c')]({'port':0x232c});var client9002=jayson[_0x2061('0x1b')][_0x2061('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x518139,_0x1c44ea,_0x5a1ff4,_0x18ba28){return new BPromise(function(_0x41dcce,_0x851071){var _0x8da341=_0x18ba28||client;return _0x8da341[_0x2061('0x1d')](_0x518139,_0x5a1ff4)[_0x2061('0x1e')](function(_0x334622){logger['info'](_0x2061('0x1f'),_0x1c44ea,_0x2061('0x20'));logger[_0x2061('0x21')](_0x2061('0x22'),_0x1c44ea,_0x2061('0x20'),JSON[_0x2061('0x23')](_0x334622));if(_0x334622['error']){if(_0x334622['error'][_0x2061('0x24')]===0x1f4){logger[_0x2061('0x25')](_0x2061('0x1f'),_0x1c44ea,_0x334622[_0x2061('0x25')][_0x2061('0x26')]);return _0x851071(_0x334622[_0x2061('0x25')]['message']);}logger[_0x2061('0x25')]('FaxAccount,\x20%s,\x20%s',_0x1c44ea,_0x334622[_0x2061('0x25')][_0x2061('0x26')]);return _0x41dcce(_0x334622[_0x2061('0x25')]['message']);}else{logger['info'](_0x2061('0x1f'),_0x1c44ea,_0x2061('0x20'));_0x41dcce(_0x334622[_0x2061('0x27')][_0x2061('0x26')]);}})['catch'](function(_0x304c8b){logger[_0x2061('0x25')]('FaxAccount,\x20%s,\x20%s',_0x1c44ea,_0x304c8b);_0x851071(_0x304c8b);});});}function respondWithStatusCode(_0x221995,_0x19d84b){_0x19d84b=_0x19d84b||0xcc;return function(_0x39e3bd){if(_0x39e3bd){return _0x221995['sendStatus'](_0x19d84b);}return _0x221995[_0x2061('0x28')](_0x19d84b)[_0x2061('0x29')]();};}function respondWithResult(_0x2888f9,_0x425cf6){_0x425cf6=_0x425cf6||0xc8;return function(_0x2e7d43){if(_0x2e7d43){return _0x2888f9[_0x2061('0x28')](_0x425cf6)[_0x2061('0x2a')](_0x2e7d43);}};}function respondWithFilteredResult(_0x52034a,_0x25ec80){return function(_0x4949b2){if(_0x4949b2){var _0x54d757=typeof _0x25ec80['offset']==='undefined'&&typeof _0x25ec80['limit']===_0x2061('0x2b');var _0x4ad46c=_0x4949b2[_0x2061('0x2c')];var _0x323132=_0x54d757?0x0:_0x25ec80[_0x2061('0x2d')];var _0x269099=_0x54d757?_0x4949b2[_0x2061('0x2c')]:_0x25ec80[_0x2061('0x2d')]+_0x25ec80['limit'];var _0x46c5ed;if(_0x269099>=_0x4ad46c){_0x269099=_0x4ad46c;_0x46c5ed=0xc8;}else{_0x46c5ed=0xce;}_0x52034a[_0x2061('0x28')](_0x46c5ed);return _0x52034a[_0x2061('0x2e')](_0x2061('0x2f'),_0x323132+'-'+_0x269099+'/'+_0x4ad46c)['json'](_0x4949b2);}return null;};}function patchUpdates(_0x44b2f1){return function(_0x3dff1a){try{jsonpatch[_0x2061('0x30')](_0x3dff1a,_0x44b2f1,!![]);}catch(_0x5032df){return BPromise['reject'](_0x5032df);}return _0x3dff1a[_0x2061('0x31')]();};}function saveUpdates(_0x178d11,_0xf04c5a){return function(_0x27c248){if(_0x27c248){return _0x27c248[_0x2061('0x32')](_0x178d11)[_0x2061('0x1e')](function(_0x33a2e5){return _0x33a2e5;});}return null;};}function removeEntity(_0x452a0a,_0x490623){return function(_0x2e7ef9){if(_0x2e7ef9){return _0x2e7ef9[_0x2061('0x33')]()[_0x2061('0x1e')](function(){var _0x24c8ca=_0x2e7ef9['get']({'plain':!![]});var _0x309ff9=_0x2061('0x34');return db['UserProfileResource'][_0x2061('0x33')]({'where':{'type':_0x309ff9,'resourceId':_0x24c8ca['id']}})['then'](function(){return _0x2e7ef9;});})[_0x2061('0x1e')](function(){_0x452a0a['status'](0xcc)[_0x2061('0x29')]();});}};}function handleEntityNotFound(_0x4d3a69,_0x282eb0){return function(_0x1ccc7e){if(!_0x1ccc7e){_0x4d3a69[_0x2061('0x35')](0x194);}return _0x1ccc7e;};}function handleError(_0x438f15,_0x33a469){_0x33a469=_0x33a469||0x1f4;return function(_0x80b4ba){logger[_0x2061('0x25')](_0x80b4ba[_0x2061('0x36')]);if(_0x80b4ba[_0x2061('0x37')]){delete _0x80b4ba[_0x2061('0x37')];}_0x438f15['status'](_0x33a469)[_0x2061('0x38')](_0x80b4ba);};}exports[_0x2061('0x39')]=function(_0x30b7fe,_0x2406ef){var _0x4f37cd={'include':[{'model':db[_0x2061('0x3a')],'as':_0x2061('0x3b')}]},_0x2fd2b3={},_0xb5a82f={'count':0x0,'rows':[]};var _0x11af62=_[_0x2061('0x3c')](db[_0x2061('0x3d')][_0x2061('0x3e')],function(_0x56f930){return{'name':_0x56f930[_0x2061('0x3f')],'type':_0x56f930[_0x2061('0x40')][_0x2061('0x41')]};});_0x2fd2b3[_0x2061('0x42')]=_[_0x2061('0x3c')](_0x11af62,_0x2061('0x37'));_0x2fd2b3[_0x2061('0x43')]=_[_0x2061('0x44')](_0x30b7fe['query']);_0x2fd2b3[_0x2061('0x45')]=_['intersection'](_0x2fd2b3['model'],_0x2fd2b3['query']);_0x4f37cd[_0x2061('0x46')]=_['intersection'](_0x2fd2b3[_0x2061('0x42')],qs[_0x2061('0x47')](_0x30b7fe[_0x2061('0x43')]['fields']));_0x4f37cd[_0x2061('0x46')]=_0x4f37cd[_0x2061('0x46')]['length']?_0x4f37cd[_0x2061('0x46')]:_0x2fd2b3['model'];if(!_0x30b7fe[_0x2061('0x43')]['hasOwnProperty'](_0x2061('0x48'))){_0x4f37cd['limit']=qs[_0x2061('0x49')](_0x30b7fe[_0x2061('0x43')][_0x2061('0x49')]);_0x4f37cd['offset']=qs[_0x2061('0x2d')](_0x30b7fe[_0x2061('0x43')]['offset']);}_0x4f37cd[_0x2061('0x4a')]=qs['sort'](_0x30b7fe[_0x2061('0x43')][_0x2061('0x4b')]);_0x4f37cd[_0x2061('0x4c')]=qs[_0x2061('0x45')](_[_0x2061('0x4d')](_0x30b7fe[_0x2061('0x43')],_0x2fd2b3[_0x2061('0x45')]),_0x11af62);if(_0x30b7fe['query'][_0x2061('0x4e')]){_0x4f37cd[_0x2061('0x4c')]=_[_0x2061('0x4f')](_0x4f37cd[_0x2061('0x4c')],{'$or':_[_0x2061('0x3c')](_0x11af62,function(_0x4f96ab){if(_0x4f96ab[_0x2061('0x40')]!==_0x2061('0x50')){var _0x3bc550={};_0x3bc550[_0x4f96ab[_0x2061('0x37')]]={'$like':'%'+_0x30b7fe['query'][_0x2061('0x4e')]+'%'};return _0x3bc550;}})});}_0x4f37cd=_[_0x2061('0x4f')]({},_0x4f37cd,_0x30b7fe['options']);var _0x2a8f86={'where':_0x4f37cd[_0x2061('0x4c')]};return db['FaxAccount'][_0x2061('0x2c')](_0x2a8f86)[_0x2061('0x1e')](function(_0x48f0e8){_0xb5a82f[_0x2061('0x2c')]=_0x48f0e8;if(_0x30b7fe[_0x2061('0x43')][_0x2061('0x51')]){_0x4f37cd[_0x2061('0x52')]=[{'all':!![]}];}return db[_0x2061('0x3d')][_0x2061('0x53')](_0x4f37cd);})['then'](function(_0x2ffe0d){_0xb5a82f['rows']=_0x2ffe0d;return _0xb5a82f;})['then'](respondWithFilteredResult(_0x2406ef,_0x4f37cd))[_0x2061('0x54')](handleError(_0x2406ef,null));};exports[_0x2061('0x55')]=function(_0x4dece7,_0x20e253){var _0x1f6b97={'raw':![],'where':{'id':_0x4dece7[_0x2061('0x56')]['id']},'include':[{'model':db[_0x2061('0x3a')],'as':_0x2061('0x3b')}]},_0xc12dc7={};_0xc12dc7['model']=_[_0x2061('0x44')](db['FaxAccount'][_0x2061('0x3e')]);_0xc12dc7[_0x2061('0x43')]=_['keys'](_0x4dece7[_0x2061('0x43')]);_0xc12dc7[_0x2061('0x45')]=_[_0x2061('0x57')](_0xc12dc7[_0x2061('0x42')],_0xc12dc7['query']);_0x1f6b97[_0x2061('0x46')]=_[_0x2061('0x57')](_0xc12dc7[_0x2061('0x42')],qs['fields'](_0x4dece7['query'][_0x2061('0x47')]));_0x1f6b97[_0x2061('0x46')]=_0x1f6b97[_0x2061('0x46')][_0x2061('0x58')]?_0x1f6b97['attributes']:_0xc12dc7['model'];if(_0x4dece7['query'][_0x2061('0x51')]){_0x1f6b97['include']=[{'all':!![]}];}_0x1f6b97=_[_0x2061('0x4f')]({},_0x1f6b97,_0x4dece7['options']);return db[_0x2061('0x3d')]['find'](_0x1f6b97)['then'](handleEntityNotFound(_0x20e253,null))[_0x2061('0x1e')](respondWithResult(_0x20e253,null))[_0x2061('0x54')](handleError(_0x20e253,null));};exports[_0x2061('0x59')]=function(_0x5eb0f4,_0x3e7024){return db[_0x2061('0x3d')]['create'](_0x5eb0f4['body'],{})[_0x2061('0x1e')](function(_0x37b9f2){var _0x599a99=_0x5eb0f4[_0x2061('0x5a')][_0x2061('0x5b')]({'plain':!![]});if(!_0x599a99)throw new Error(_0x2061('0x5c'));if(_0x599a99[_0x2061('0x5d')]===_0x2061('0x5a')){var _0x3194f2=_0x37b9f2[_0x2061('0x5b')]({'plain':!![]});var _0x4cb5bf=_0x2061('0x34');return db[_0x2061('0x5e')][_0x2061('0x5f')]({'where':{'name':_0x4cb5bf,'userProfileId':_0x599a99[_0x2061('0x60')]},'raw':!![]})[_0x2061('0x1e')](function(_0x236270){if(_0x236270&&_0x236270[_0x2061('0x61')]===0x0){return db[_0x2061('0x62')][_0x2061('0x59')]({'name':_0x3194f2['name'],'resourceId':_0x3194f2['id'],'type':_0x236270[_0x2061('0x37')],'sectionId':_0x236270['id']},{})[_0x2061('0x1e')](function(){return _0x37b9f2;});}else{return _0x37b9f2;}})[_0x2061('0x54')](function(_0xa5114c){logger[_0x2061('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa5114c);throw _0xa5114c;});}return _0x37b9f2;})[_0x2061('0x1e')](respondWithResult(_0x3e7024,0xc9))['catch'](handleError(_0x3e7024,null));};exports[_0x2061('0x32')]=function(_0x3b39ca,_0x54c333){if(_0x3b39ca[_0x2061('0x63')]['id']){delete _0x3b39ca[_0x2061('0x63')]['id'];}return db[_0x2061('0x3d')][_0x2061('0x5f')]({'where':{'id':_0x3b39ca['params']['id']},'include':[{'model':db[_0x2061('0x3a')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x54c333,null))[_0x2061('0x1e')](saveUpdates(_0x3b39ca['body'],null))['then'](respondWithResult(_0x54c333,null))['catch'](handleError(_0x54c333,null));};exports[_0x2061('0x33')]=function(_0x211e6b,_0x1aa0c8){return db[_0x2061('0x3d')][_0x2061('0x5f')]({'where':{'id':_0x211e6b[_0x2061('0x56')]['id']}})['then'](handleEntityNotFound(_0x1aa0c8,null))[_0x2061('0x1e')](removeEntity(_0x1aa0c8,null))[_0x2061('0x54')](handleError(_0x1aa0c8,null));};exports[_0x2061('0x64')]=function(_0x2fd20b,_0x2e5335){return db[_0x2061('0x3d')][_0x2061('0x64')]()[_0x2061('0x1e')](respondWithResult(_0x2e5335,null))[_0x2061('0x54')](handleError(_0x2e5335,null));};exports[_0x2061('0x65')]=function(_0x4caccb,_0x1c3e20,_0x3a0194){if(_0x4caccb[_0x2061('0x63')]['id']){delete _0x4caccb['body']['id'];}return db[_0x2061('0x3d')][_0x2061('0x5f')]({'where':{'id':_0x4caccb[_0x2061('0x56')]['id']}})[_0x2061('0x1e')](handleEntityNotFound(_0x1c3e20,null))[_0x2061('0x1e')](function(_0x2238c9){if(_0x2238c9){_0x4caccb[_0x2061('0x63')]['FaxAccountId']=_0x2238c9['id'];return db['Disposition'][_0x2061('0x59')](_0x4caccb[_0x2061('0x63')]);}})['then'](respondWithResult(_0x1c3e20,null))[_0x2061('0x54')](handleError(_0x1c3e20,null));};exports[_0x2061('0x66')]=function(_0x475fe7,_0x40f053,_0x2e19d8){var _0x24ae03={'raw':![],'where':{}};var _0x30fab2={};var _0x4f018f={'count':0x0,'rows':[]};return db[_0x2061('0x3d')]['findOne']({'where':{'id':_0x475fe7[_0x2061('0x56')]['id']}})['then'](handleEntityNotFound(_0x40f053,null))[_0x2061('0x1e')](function(_0x11d6e1){if(_0x11d6e1){_0x30fab2[_0x2061('0x42')]=_['keys'](db[_0x2061('0x67')][_0x2061('0x3e')]);_0x30fab2[_0x2061('0x43')]=_['keys'](_0x475fe7[_0x2061('0x43')]);_0x30fab2[_0x2061('0x45')]=_['intersection'](_0x30fab2['model'],_0x30fab2['query']);_0x24ae03['attributes']=_[_0x2061('0x57')](_0x30fab2[_0x2061('0x42')],qs['fields'](_0x475fe7[_0x2061('0x43')][_0x2061('0x47')]));_0x24ae03[_0x2061('0x46')]=_0x24ae03[_0x2061('0x46')][_0x2061('0x58')]?_0x24ae03['attributes']:_0x30fab2[_0x2061('0x42')];if(!_0x475fe7[_0x2061('0x43')]['hasOwnProperty'](_0x2061('0x48'))){_0x24ae03['limit']=qs[_0x2061('0x49')](_0x475fe7['query'][_0x2061('0x49')]);_0x24ae03[_0x2061('0x2d')]=qs[_0x2061('0x2d')](_0x475fe7[_0x2061('0x43')][_0x2061('0x2d')]);}_0x24ae03['order']=qs[_0x2061('0x4b')](_0x475fe7[_0x2061('0x43')][_0x2061('0x4b')]);_0x24ae03['where']=qs['filters'](_[_0x2061('0x4d')](_0x475fe7['query'],_0x30fab2[_0x2061('0x45')]));_0x24ae03[_0x2061('0x4c')][_0x2061('0x68')]=_0x11d6e1['id'];if(_0x475fe7[_0x2061('0x43')][_0x2061('0x4e')]){_0x24ae03[_0x2061('0x4c')]=_[_0x2061('0x4f')](_0x24ae03[_0x2061('0x4c')],{'$or':_[_0x2061('0x3c')](_0x24ae03[_0x2061('0x46')],function(_0x1b199d){var _0x3e4c6d={};_0x3e4c6d[_0x1b199d]={'$like':'%'+_0x475fe7[_0x2061('0x43')][_0x2061('0x4e')]+'%'};return _0x3e4c6d;})});}_0x24ae03=_[_0x2061('0x4f')]({},_0x24ae03,_0x475fe7[_0x2061('0x69')]);return db[_0x2061('0x67')][_0x2061('0x2c')]({'where':_0x24ae03[_0x2061('0x4c')]})[_0x2061('0x1e')](function(_0x47afe7){_0x4f018f[_0x2061('0x2c')]=_0x47afe7;if(_0x475fe7[_0x2061('0x43')]['includeAll']){_0x24ae03['include']=[{'all':!![]}];}return db[_0x2061('0x67')][_0x2061('0x53')](_0x24ae03);})[_0x2061('0x1e')](function(_0x546935){_0x4f018f[_0x2061('0x6a')]=_0x546935;return _0x4f018f;});}})[_0x2061('0x1e')](respondWithFilteredResult(_0x40f053,_0x24ae03))['catch'](handleError(_0x40f053,null));};exports[_0x2061('0x6b')]=function(_0x4b8d21,_0x5e8324,_0x29bb9f){return db[_0x2061('0x3d')]['find']({'where':{'id':_0x4b8d21[_0x2061('0x56')]['id']}})[_0x2061('0x1e')](handleEntityNotFound(_0x5e8324,null))[_0x2061('0x1e')](function(_0x14f973){if(_0x14f973){return _0x14f973[_0x2061('0x6b')](_0x4b8d21[_0x2061('0x43')][_0x2061('0x6c')]);}})[_0x2061('0x1e')](respondWithStatusCode(_0x5e8324,null))[_0x2061('0x54')](handleError(_0x5e8324,null));};exports[_0x2061('0x6d')]=function(_0xca3333,_0x46b9ec,_0x5017a2){if(_0xca3333['body']['id']){delete _0xca3333[_0x2061('0x63')]['id'];}return db[_0x2061('0x3d')][_0x2061('0x5f')]({'where':{'id':_0xca3333['params']['id']}})['then'](handleEntityNotFound(_0x46b9ec,null))[_0x2061('0x1e')](function(_0xf4b8af){if(_0xf4b8af){_0xca3333[_0x2061('0x63')][_0x2061('0x68')]=_0xf4b8af['id'];return db[_0x2061('0x6e')][_0x2061('0x59')](_0xca3333[_0x2061('0x63')]);}})[_0x2061('0x1e')](respondWithResult(_0x46b9ec,null))[_0x2061('0x54')](handleError(_0x46b9ec,null));};exports[_0x2061('0x6f')]=function(_0x3b7331,_0x46f88f,_0x118233){var _0x1835fd={'raw':![],'where':{}};var _0x224b76={};var _0x2e0400={'count':0x0,'rows':[]};return db[_0x2061('0x3d')]['findOne']({'where':{'id':_0x3b7331[_0x2061('0x56')]['id']}})[_0x2061('0x1e')](handleEntityNotFound(_0x46f88f,null))[_0x2061('0x1e')](function(_0x2bf924){if(_0x2bf924){_0x224b76['model']=_[_0x2061('0x44')](db[_0x2061('0x6e')]['rawAttributes']);_0x224b76[_0x2061('0x43')]=_[_0x2061('0x44')](_0x3b7331[_0x2061('0x43')]);_0x224b76[_0x2061('0x45')]=_[_0x2061('0x57')](_0x224b76[_0x2061('0x42')],_0x224b76[_0x2061('0x43')]);_0x1835fd[_0x2061('0x46')]=_[_0x2061('0x57')](_0x224b76[_0x2061('0x42')],qs['fields'](_0x3b7331['query'][_0x2061('0x47')]));_0x1835fd[_0x2061('0x46')]=_0x1835fd[_0x2061('0x46')]['length']?_0x1835fd['attributes']:_0x224b76[_0x2061('0x42')];if(!_0x3b7331[_0x2061('0x43')][_0x2061('0x70')](_0x2061('0x48'))){_0x1835fd[_0x2061('0x49')]=qs[_0x2061('0x49')](_0x3b7331[_0x2061('0x43')]['limit']);_0x1835fd[_0x2061('0x2d')]=qs[_0x2061('0x2d')](_0x3b7331['query'][_0x2061('0x2d')]);}_0x1835fd[_0x2061('0x4a')]=qs[_0x2061('0x4b')](_0x3b7331['query'][_0x2061('0x4b')]);_0x1835fd[_0x2061('0x4c')]=qs[_0x2061('0x45')](_[_0x2061('0x4d')](_0x3b7331[_0x2061('0x43')],_0x224b76[_0x2061('0x45')]));_0x1835fd['where'][_0x2061('0x68')]=_0x2bf924['id'];if(_0x3b7331[_0x2061('0x43')]['filter']){_0x1835fd['where']=_[_0x2061('0x4f')](_0x1835fd[_0x2061('0x4c')],{'$or':_[_0x2061('0x3c')](_0x1835fd[_0x2061('0x46')],function(_0x4ab776){var _0x3e7710={};_0x3e7710[_0x4ab776]={'$like':'%'+_0x3b7331[_0x2061('0x43')][_0x2061('0x4e')]+'%'};return _0x3e7710;})});}_0x1835fd=_[_0x2061('0x4f')]({},_0x1835fd,_0x3b7331[_0x2061('0x69')]);return db['CannedAnswer'][_0x2061('0x2c')]({'where':_0x1835fd[_0x2061('0x4c')]})[_0x2061('0x1e')](function(_0x4916fb){_0x2e0400[_0x2061('0x2c')]=_0x4916fb;if(_0x3b7331[_0x2061('0x43')][_0x2061('0x51')]){_0x1835fd[_0x2061('0x52')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x1835fd);})[_0x2061('0x1e')](function(_0x4b1138){_0x2e0400[_0x2061('0x6a')]=_0x4b1138;return _0x2e0400;});}})[_0x2061('0x1e')](respondWithFilteredResult(_0x46f88f,_0x1835fd))[_0x2061('0x54')](handleError(_0x46f88f,null));};exports[_0x2061('0x71')]=function(_0x2ec379,_0x3b890f,_0x465aae){return db[_0x2061('0x3d')][_0x2061('0x5f')]({'where':{'id':_0x2ec379[_0x2061('0x56')]['id']}})[_0x2061('0x1e')](handleEntityNotFound(_0x3b890f,null))[_0x2061('0x1e')](function(_0xcba3e7){if(_0xcba3e7){return _0xcba3e7['removeAnswers'](_0x2ec379['query'][_0x2061('0x6c')]);}})[_0x2061('0x1e')](respondWithStatusCode(_0x3b890f,null))[_0x2061('0x54')](handleError(_0x3b890f,null));};exports[_0x2061('0x72')]=function(_0x17631a,_0x32294d,_0x453087){return db['FaxInteraction'][_0x2061('0x5f')]({'where':{'id':_0x17631a['params']['id']}})[_0x2061('0x1e')](handleEntityNotFound(_0x32294d,null))[_0x2061('0x1e')](function(_0x540001){if(_0x540001){return _0x540001[_0x2061('0x72')](_0x17631a['body'][_0x2061('0x6c')],_[_0x2061('0x73')](_0x17631a[_0x2061('0x63')],[_0x2061('0x6c'),'id'])||{});}})[_0x2061('0x1e')](respondWithResult(_0x32294d,null))[_0x2061('0x54')](handleError(_0x32294d,null));};exports[_0x2061('0x74')]=function(_0x5f0bc0,_0x163540,_0x600c9){var _0x37c228={'raw':![],'where':{}};var _0x212f87={};var _0x5116a1={'count':0x0,'rows':[]};return db['FaxAccount'][_0x2061('0x75')]({'where':{'id':_0x5f0bc0[_0x2061('0x56')]['id']}})[_0x2061('0x1e')](handleEntityNotFound(_0x163540,null))[_0x2061('0x1e')](function(_0x2c93c0){if(_0x2c93c0){_0x212f87[_0x2061('0x42')]=_['keys'](db[_0x2061('0x76')][_0x2061('0x3e')]);_0x212f87['query']=_[_0x2061('0x44')](_0x5f0bc0[_0x2061('0x43')]);_0x212f87[_0x2061('0x45')]=_['intersection'](_0x212f87['model'],_0x212f87[_0x2061('0x43')]);_0x37c228[_0x2061('0x46')]=_[_0x2061('0x57')](_0x212f87[_0x2061('0x42')],qs[_0x2061('0x47')](_0x5f0bc0[_0x2061('0x43')][_0x2061('0x47')]));_0x37c228[_0x2061('0x46')]=_0x37c228['attributes'][_0x2061('0x58')]?_0x37c228[_0x2061('0x46')]:_0x212f87[_0x2061('0x42')];if(!_0x5f0bc0[_0x2061('0x43')][_0x2061('0x70')](_0x2061('0x48'))){_0x37c228[_0x2061('0x49')]=qs['limit'](_0x5f0bc0[_0x2061('0x43')]['limit']);_0x37c228[_0x2061('0x2d')]=qs['offset'](_0x5f0bc0['query'][_0x2061('0x2d')]);}_0x37c228[_0x2061('0x4a')]=qs[_0x2061('0x4b')](_0x5f0bc0[_0x2061('0x43')][_0x2061('0x4b')]);_0x37c228['where']=qs[_0x2061('0x45')](_[_0x2061('0x4d')](_0x5f0bc0[_0x2061('0x43')],_0x212f87[_0x2061('0x45')]));_0x37c228['where']['FaxAccountId']=_0x2c93c0['id'];if(_0x5f0bc0[_0x2061('0x43')][_0x2061('0x4e')]){_0x37c228['where']=_[_0x2061('0x4f')](_0x37c228[_0x2061('0x4c')],{'$or':_[_0x2061('0x3c')](_0x37c228[_0x2061('0x46')],function(_0x140e54){var _0x476e4c={};_0x476e4c[_0x140e54]={'$like':'%'+_0x5f0bc0[_0x2061('0x43')][_0x2061('0x4e')]+'%'};return _0x476e4c;})});}_0x37c228=_[_0x2061('0x4f')]({},_0x37c228,_0x5f0bc0['options']);return db[_0x2061('0x76')][_0x2061('0x2c')]({'where':_0x37c228[_0x2061('0x4c')]})[_0x2061('0x1e')](function(_0x268054){_0x5116a1[_0x2061('0x2c')]=_0x268054;if(_0x5f0bc0[_0x2061('0x43')][_0x2061('0x51')]){_0x37c228[_0x2061('0x52')]=[{'model':db[_0x2061('0x77')],'as':_0x2061('0x78'),'required':![]},{'model':db[_0x2061('0x79')],'as':_0x2061('0x7a'),'attributes':[_0x2061('0x37'),'fullname','internal'],'required':![]},{'model':db[_0x2061('0x7b')],'as':'Tags','attributes':['id',_0x2061('0x37'),_0x2061('0x7c')],'where':_0x5f0bc0[_0x2061('0x43')]['tag']?{'id':_0x5f0bc0['query'][_0x2061('0x7d')]}:undefined,'required':_0x5f0bc0[_0x2061('0x43')][_0x2061('0x7d')]?!![]:![]}];}return db[_0x2061('0x76')][_0x2061('0x53')](_0x37c228);})['then'](function(_0x4eed33){_0x5116a1[_0x2061('0x6a')]=_0x4eed33;return _0x5116a1;});}})[_0x2061('0x1e')](respondWithFilteredResult(_0x163540,_0x37c228))[_0x2061('0x54')](handleError(_0x163540,null));};exports['addApplications']=function(_0x54daae,_0x27ab2b){var _0x1e60b5=_0x54daae[_0x2061('0x56')]['id'];var _0x425526=_0x54daae[_0x2061('0x63')];var _0x5cef92=0xc8;var _0x30c188=null;return db['sequelize'][_0x2061('0x7e')]({'isolationLevel':db[_0x2061('0x7f')]['Transaction']['ISOLATION_LEVELS'][_0x2061('0x80')]},function(_0xe8ec84){return db['FaxAccount'][_0x2061('0x75')]({'where':{'id':_0x1e60b5},'transaction':_0xe8ec84})[_0x2061('0x1e')](function(_0x1702d4){if(_0x1702d4){return db[_0x2061('0x81')][_0x2061('0x33')]({'where':{'FaxAccountId':_0x1e60b5},'transaction':_0xe8ec84})[_0x2061('0x1e')](function(){var _0x3a0d38=_['map'](_0x425526,function(_0x14b892){_0x14b892[_0x2061('0x68')]=_0x1e60b5;return _0x14b892;});return db[_0x2061('0x81')][_0x2061('0x82')](_0x3a0d38,{'transaction':_0xe8ec84});});}else{_0x5cef92=0x194;_0x30c188=[];}});})[_0x2061('0x1e')](function(){if(_0x5cef92!==0x194){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x1e60b5},'order':_0x2061('0x83')})['then'](function(_0x3b5656){_0x30c188=_0x3b5656;});}})[_0x2061('0x54')](function(_0x3d022c){_0x5cef92=0x1f4;logger[_0x2061('0x25')](_0x3d022c[_0x2061('0x36')]);if(_0x3d022c[_0x2061('0x37')]){delete _0x3d022c['name'];}_0x30c188=_0x3d022c;})[_0x2061('0x84')](function(){if(_0x30c188===null){_0x27ab2b['sendStatus'](_0x5cef92);}else{if(_0x5cef92===0x1f4){_0x27ab2b[_0x2061('0x28')](_0x5cef92)[_0x2061('0x38')](_0x30c188);}else{_0x27ab2b['status'](_0x5cef92)[_0x2061('0x2a')](_0x30c188);}}});};exports[_0x2061('0x85')]=function(_0x6a512c,_0x3dd969,_0x2da8ef){var _0x3ef81e={};var _0x5703f2={};var _0x170e2c;var _0x19aacb;return db[_0x2061('0x3d')][_0x2061('0x75')]({'where':{'id':_0x6a512c[_0x2061('0x56')]['id']}})[_0x2061('0x1e')](handleEntityNotFound(_0x3dd969,null))[_0x2061('0x1e')](function(_0x3ce659){if(_0x3ce659){_0x170e2c=_0x3ce659;_0x5703f2[_0x2061('0x42')]=_[_0x2061('0x44')](db[_0x2061('0x81')][_0x2061('0x3e')]);_0x5703f2['query']=_[_0x2061('0x44')](_0x6a512c[_0x2061('0x43')]);_0x5703f2[_0x2061('0x45')]=_[_0x2061('0x57')](_0x5703f2[_0x2061('0x42')],_0x5703f2[_0x2061('0x43')]);_0x3ef81e['attributes']=_[_0x2061('0x57')](_0x5703f2[_0x2061('0x42')],qs[_0x2061('0x47')](_0x6a512c['query'][_0x2061('0x47')]));_0x3ef81e[_0x2061('0x46')]=_0x3ef81e['attributes'][_0x2061('0x58')]?_0x3ef81e[_0x2061('0x46')]:_0x5703f2[_0x2061('0x42')];_0x3ef81e[_0x2061('0x4a')]=qs['sort'](_0x6a512c[_0x2061('0x43')]['sort']);_0x3ef81e['where']=qs[_0x2061('0x45')](_[_0x2061('0x4d')](_0x6a512c[_0x2061('0x43')],_0x5703f2[_0x2061('0x45')]));if(_0x6a512c['query'][_0x2061('0x4e')]){_0x3ef81e[_0x2061('0x4c')]=_[_0x2061('0x4f')](_0x3ef81e['where'],{'$or':_['map'](_0x3ef81e[_0x2061('0x46')],function(_0x190bc9){var _0x438078={};_0x438078[_0x190bc9]={'$like':'%'+_0x6a512c[_0x2061('0x43')]['filter']+'%'};return _0x438078;})});}_0x3ef81e=_[_0x2061('0x4f')]({},_0x3ef81e,_0x6a512c['options']);return _0x170e2c[_0x2061('0x85')](_0x3ef81e);}})[_0x2061('0x1e')](function(_0x28d642){if(_0x28d642){_0x19aacb=_0x28d642[_0x2061('0x58')];if(!_0x6a512c[_0x2061('0x43')][_0x2061('0x70')](_0x2061('0x48'))){_0x3ef81e[_0x2061('0x49')]=qs[_0x2061('0x49')](_0x6a512c[_0x2061('0x43')][_0x2061('0x49')]);_0x3ef81e[_0x2061('0x2d')]=qs['offset'](_0x6a512c['query'][_0x2061('0x2d')]);}return _0x170e2c['getApplications'](_0x3ef81e);}})[_0x2061('0x1e')](function(_0x227947){if(_0x227947){return _0x227947?{'count':_0x19aacb,'rows':_0x227947}:null;}})[_0x2061('0x1e')](respondWithResult(_0x3dd969,null))[_0x2061('0x54')](handleError(_0x3dd969,null));};function Extension(_0x4aab18,_0x2ff3c2,_0x1ddb12,_0x43f23e){this[_0x2061('0x86')]='from-voip-provider';this['exten']=_0x4aab18['localstationid'];this[_0x2061('0x87')]=_0x43f23e;this[_0x2061('0x40')]=_0x2061('0x88');this['description']=_0x2061('0x89');this[_0x2061('0x68')]=_0x4aab18['id'];this['priority']=_0x2ff3c2;this[_0x2061('0x8a')]=_0x1ddb12;}function createExtensionsReciveFax(_0x2f7c73){var _0x5474d1=0x1;var _0x59e6ea=[];_0x59e6ea[_0x2061('0x8b')](new Extension(_0x2f7c73,_0x5474d1,'',_0x2061('0x8c')));_0x5474d1+=0x1;_0x59e6ea[_0x2061('0x8b')](new Extension(_0x2f7c73,_0x5474d1,_0x2061('0x8d'),'Set'));_0x5474d1+=0x1;for(var _0x38e7d7 in _0x2f7c73){if(_0x2f7c73[_0x2061('0x70')](_0x38e7d7)&&(_0x38e7d7===_0x2061('0x8e')||_0x38e7d7===_0x2061('0x8f')||_0x38e7d7===_0x2061('0x90')||_0x38e7d7===_0x2061('0x91')||_0x38e7d7===_0x2061('0x92')||_0x38e7d7===_0x2061('0x93')||_0x38e7d7===_0x2061('0x94')||_0x38e7d7===_0x2061('0x95')||_0x38e7d7===_0x2061('0x96'))){_0x59e6ea[_0x2061('0x8b')](new Extension(_0x2f7c73,_0x5474d1,'FAXOPT('+_0x38e7d7+')='+_0x2f7c73[_0x38e7d7],_0x2061('0x97')));_0x5474d1+=0x1;}}_0x59e6ea['push'](new Extension(_0x2f7c73,_0x5474d1,'6',_0x2061('0x98')));_0x5474d1+=0x1;_0x59e6ea['push'](new Extension(_0x2f7c73,_0x5474d1,_0x2061('0x99'),'ReceiveFax'));_0x5474d1=0x0;return _0x59e6ea;}exports[_0x2061('0x9a')]=function(_0x5327a2,_0xf04fae,_0xf7db6){var _0x361e9d;return db['sequelize'][_0x2061('0x7e')](function(_0x268cb0){return db['FaxAccount'][_0x2061('0x59')](_0x5327a2[_0x2061('0x63')],{'transaction':_0x268cb0})[_0x2061('0x1e')](function(_0x386dba){_0x361e9d=_0x386dba[_0x2061('0x5b')]({'plain':!![]});return db[_0x2061('0x9b')][_0x2061('0x82')](createExtensionsReciveFax(_0x361e9d),{'transaction':_0x268cb0});});})[_0x2061('0x1e')](function(){return _0x361e9d;})[_0x2061('0x1e')](respondWithResult(_0xf04fae,null))['catch'](handleError(_0xf04fae,null));};exports[_0x2061('0x9c')]=function(_0x3b2264,_0x4ff91b,_0xbb8c19){var _0x329172;return db['sequelize'][_0x2061('0x7e')](function(_0x58af13){return db[_0x2061('0x3d')][_0x2061('0x32')](_0x3b2264[_0x2061('0x63')],{'where':{'id':_0x3b2264[_0x2061('0x63')]['id']},'transaction':_0x58af13})[_0x2061('0x1e')](function(_0x590886){return db[_0x2061('0x9b')][_0x2061('0x33')]({'where':{'FaxAccountId':_0x3b2264[_0x2061('0x63')]['id']},'transaction':_0x58af13})[_0x2061('0x1e')](function(_0x5231e3){return db[_0x2061('0x9b')][_0x2061('0x82')](createExtensionsReciveFax(_[_0x2061('0x73')](_0x3b2264['body'],[_0x2061('0x9d'),'key','createdAt',_0x2061('0x9e'),_0x2061('0x9f'),_0x2061('0xa0')])),{'transaction':_0x58af13});});});})[_0x2061('0x1e')](function(){return db[_0x2061('0x3d')]['findById'](_0x3b2264[_0x2061('0x63')]['id']);})[_0x2061('0x1e')](respondWithResult(_0x4ff91b,null))[_0x2061('0x54')](handleError(_0x4ff91b,null));};exports[_0x2061('0xa1')]=function(_0x2ead48,_0x296e07,_0x11105a){var _0x5a526b={'raw':!![],'where':{}};var _0x5e564e={};var _0x54e59d={'count':0x0,'rows':[]};return db['FaxAccount'][_0x2061('0x75')]({'where':{'id':_0x2ead48[_0x2061('0x56')]['id']}})[_0x2061('0x1e')](handleEntityNotFound(_0x296e07,null))[_0x2061('0x1e')](function(_0x36ebad){if(_0x36ebad){_0x5e564e[_0x2061('0x42')]=_[_0x2061('0x44')](db[_0x2061('0xa2')][_0x2061('0x3e')]);_0x5e564e[_0x2061('0x43')]=_[_0x2061('0x44')](_0x2ead48[_0x2061('0x43')]);_0x5e564e[_0x2061('0x45')]=_[_0x2061('0x57')](_0x5e564e[_0x2061('0x42')],_0x5e564e[_0x2061('0x43')]);_0x5a526b['attributes']=_[_0x2061('0x57')](_0x5e564e['model'],qs[_0x2061('0x47')](_0x2ead48[_0x2061('0x43')][_0x2061('0x47')]));_0x5a526b[_0x2061('0x46')]=_0x5a526b[_0x2061('0x46')][_0x2061('0x58')]?_0x5a526b['attributes']:_0x5e564e[_0x2061('0x42')];if(!_0x2ead48[_0x2061('0x43')]['hasOwnProperty'](_0x2061('0x48'))){_0x5a526b[_0x2061('0x49')]=qs['limit'](_0x2ead48[_0x2061('0x43')][_0x2061('0x49')]);_0x5a526b[_0x2061('0x2d')]=qs[_0x2061('0x2d')](_0x2ead48['query']['offset']);}_0x5a526b['order']=qs[_0x2061('0x4b')](_0x2ead48[_0x2061('0x43')]['sort']);_0x5a526b[_0x2061('0x4c')]=qs[_0x2061('0x45')](_[_0x2061('0x4d')](_0x2ead48['query'],_0x5e564e[_0x2061('0x45')]));_0x5a526b[_0x2061('0x4c')][_0x2061('0x68')]=_0x36ebad['id'];if(_0x2ead48[_0x2061('0x43')][_0x2061('0x4e')]){_0x5a526b[_0x2061('0x4c')]=_['merge'](_0x5a526b[_0x2061('0x4c')],{'$or':_[_0x2061('0x3c')](_0x5a526b[_0x2061('0x46')],function(_0x41e6c1){var _0x5a7e53={};_0x5a7e53[_0x41e6c1]={'$like':'%'+_0x2ead48[_0x2061('0x43')]['filter']+'%'};return _0x5a7e53;})});}if(_0x2ead48[_0x2061('0x43')][_0x2061('0xa3')]){var _0x3ac80e=_0x2ead48[_0x2061('0x43')][_0x2061('0xa3')][_0x2061('0xa4')](',');var _0x30dc25={};_0x30dc25[_0x3ac80e[0x0]]={'$gte':moment(_0x3ac80e[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x5a526b[_0x2061('0x4c')]=_['merge'](_0x5a526b[_0x2061('0x4c')],_0x30dc25);}_0x5a526b=_[_0x2061('0x4f')]({},_0x5a526b,_0x2ead48[_0x2061('0x69')]);return db['FaxMessage'][_0x2061('0x2c')]({'where':_0x5a526b[_0x2061('0x4c')]})['then'](function(_0x2f7036){_0x54e59d[_0x2061('0x2c')]=_0x2f7036;if(_0x2ead48[_0x2061('0x43')]['includeAll']){_0x5a526b[_0x2061('0x52')]=[{'all':!![]}];}return db[_0x2061('0xa2')][_0x2061('0x53')](_0x5a526b);})[_0x2061('0x1e')](function(_0x57e72d){_0x54e59d[_0x2061('0x6a')]=_0x57e72d;return _0x54e59d;});}})[_0x2061('0x1e')](respondWithFilteredResult(_0x296e07,_0x5a526b))[_0x2061('0x54')](handleError(_0x296e07,null));};exports[_0x2061('0x38')]=function(_0x494d9d,_0x2bf3af,_0x78e2eb){var _0x3dec62,_0x44cd66={},_0x5998ee;if(_0x494d9d[_0x2061('0x63')]['to']){_0x5998ee=_0x494d9d[_0x2061('0x63')]['to'][0x0];}return db['FaxAccount'][_0x2061('0x5f')]({'where':{'id':_0x494d9d[_0x2061('0x56')]['id']},'include':[{'model':db[_0x2061('0xa5')],'as':_0x2061('0xa6'),'include':[{'model':db[_0x2061('0x77')],'as':_0x2061('0xa7'),'where':{'fax':_0x5998ee},'limit':0x1,'order':[['updatedAt',_0x2061('0xa8')]]}]}]})[_0x2061('0x1e')](handleEntityNotFound(_0x2bf3af,null))[_0x2061('0x1e')](function(_0x37e95a){_0x3dec62=_0x37e95a;if(_0x494d9d[_0x2061('0x63')][_0x2061('0xa9')]&&_0x494d9d['body']['attachments'][_0x2061('0x58')]){for(var _0x3abfe9=0x0;_0x3abfe9<_0x494d9d[_0x2061('0x63')]['attachments'][_0x2061('0x58')];_0x3abfe9+=0x1){_0x494d9d[_0x2061('0x63')][_0x2061('0xa9')][_0x3abfe9]={'filename':_0x494d9d[_0x2061('0x63')][_0x2061('0xa9')][_0x3abfe9][_0x2061('0x37')],'id':_0x494d9d[_0x2061('0x63')][_0x2061('0xa9')][_0x3abfe9]['id'],'path':path[_0x2061('0xaa')](config[_0x2061('0xab')],'server/files/attachments',_0x494d9d[_0x2061('0x63')][_0x2061('0xa9')][_0x3abfe9][_0x2061('0xac')])};}}return respondWithRpcPromise(_0x2061('0xad'),'CheckAfterSend',{'FaxAccountId':_[_0x2061('0xae')](_0x494d9d['params']['id'])?undefined:_0x494d9d[_0x2061('0x56')]['id'],'path':_[_0x2061('0xae')](_0x494d9d[_0x2061('0x63')][_0x2061('0xa9')][0x0][_0x2061('0xaf')])?undefined:_0x494d9d[_0x2061('0x63')][_0x2061('0xa9')][0x0][_0x2061('0xaf')],'fax':_[_0x2061('0xae')](_0x494d9d['body']['to'][0x0])?undefined:_0x494d9d[_0x2061('0x63')]['to'][0x0]},client9002);})['then'](function(){if(_0x3dec62){if(_[_0x2061('0xae')](_0x494d9d[_0x2061('0x63')][_0x2061('0xb0')])){_0x494d9d['body']['from']=util[_0x2061('0xb1')](_0x2061('0xb2'),_0x3dec62[_0x2061('0x37')],_0x3dec62['fax']);}if(_0x3dec62[_0x2061('0xa6')]){if(_0x3dec62[_0x2061('0xa6')][_0x2061('0xa7')][_0x2061('0x58')]){return _0x3dec62[_0x2061('0xa6')][_0x2061('0xa7')][0x0];}else{return db['CmContact'][_0x2061('0x59')](_[_0x2061('0x16')](_0x494d9d[_0x2061('0x63')],{'firstName':_0x494d9d[_0x2061('0x63')]['to'][0x0],'phone':_0x494d9d['body']['to'][0x0],'fax':_0x494d9d[_0x2061('0x63')]['to'][0x0],'ListId':_0x3dec62[_0x2061('0xa0')]}));}}else{throw new Error(_0x2061('0xb3'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x2061('0x1e')](function(_0x44bb73){if(_0x44bb73){return db[_0x2061('0x76')]['find']({'where':{'ContactId':_0x44bb73['id'],'closed':![],'FaxAccountId':_0x3dec62['id']}})[_0x2061('0x1e')](function(_0x270d3a){if(_0x270d3a){return[_0x270d3a,![]];}return db[_0x2061('0x76')][_0x2061('0x59')]({'UserId':_0x494d9d[_0x2061('0x5a')]['id'],'ContactId':_0x44bb73['id'],'FaxAccountId':_0x3dec62['id'],'fax':_0x494d9d['body']['to'][0x0],'firstMsgDirection':_0x2061('0xb4'),'Messages':[_[_0x2061('0x4f')](_0x494d9d[_0x2061('0x63')],{'read':![],'body':_0x494d9d[_0x2061('0x63')][_0x2061('0xa9')][0x0][_0x2061('0xb5')],'FaxAccountId':_0x3dec62['id'],'UserId':_0x494d9d[_0x2061('0x5a')]['id'],'ContactId':_0x44bb73['id'],'AttachmentId':_0x494d9d['body']['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x2061('0xa2')],'as':_0x2061('0xb6')}]})[_0x2061('0x1e')](function(_0xbbc9a7){return[_0xbbc9a7,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x2061('0xb7')](function(_0x1c4769,_0x24fa83){if(_0x24fa83){return _0x1c4769;}return db[_0x2061('0xa2')][_0x2061('0x59')]({'direction':_0x2061('0xb4'),'read':![],'body':_0x494d9d[_0x2061('0x63')][_0x2061('0xa9')][0x0][_0x2061('0xb5')],'FaxAccountId':_0x3dec62['id'],'FaxInteractionId':_0x1c4769['id'],'UserId':_0x494d9d[_0x2061('0x5a')]['id'],'ContactId':_0x1c4769[_0x2061('0xb8')],'AttachmentId':_0x494d9d[_0x2061('0x63')][_0x2061('0xa9')][0x0]['id']})[_0x2061('0x1e')](function(_0x53b35d){_0x1c4769[_0x2061('0xb9')][_0x2061('0xb6')]=[];_0x1c4769[_0x2061('0xb9')][_0x2061('0xb6')]['push'](_0x53b35d[_0x2061('0xb9')]);return _0x1c4769;});})[_0x2061('0x1e')](function(_0x13f385){respondWithRpcPromise(_0x2061('0xba'),'SendFax',{'FaxAccountId':_[_0x2061('0xae')](_0x494d9d['params']['id'])?undefined:_0x494d9d[_0x2061('0x56')]['id'],'path':_[_0x2061('0xae')](_0x494d9d[_0x2061('0x63')]['attachments'][0x0]['path'])?undefined:_0x494d9d[_0x2061('0x63')][_0x2061('0xa9')][0x0][_0x2061('0xaf')],'fax':_[_0x2061('0xae')](_0x494d9d['body']['to'][0x0])?undefined:_0x494d9d[_0x2061('0x63')]['to'][0x0],'AttachmentId':_0x494d9d[_0x2061('0x63')][_0x2061('0xa9')][0x0]['id']},client9002)[_0x2061('0x1e')](function(_0x433259){logger[_0x2061('0xbb')]('SendFaxRpc,\x20%s',_0x433259);})['catch'](function(_0x19c3d8){logger[_0x2061('0xbb')]('SendFaxRpc,\x20%s',_0x19c3d8);});return _0x13f385;})[_0x2061('0x1e')](respondWithResult(_0x2bf3af,null))[_0x2061('0x54')](handleError(_0x2bf3af,null));};exports[_0x2061('0xbc')]=function(_0x1c49f3,_0x8fb5a5,_0xb7d030){return db[_0x2061('0x3d')][_0x2061('0x5f')]({'where':{'id':_0x1c49f3[_0x2061('0x56')]['id']}})[_0x2061('0x1e')](handleEntityNotFound(_0x8fb5a5,null))[_0x2061('0x1e')](function(_0x183075){if(_0x183075){return _0x183075[_0x2061('0xbc')](_0x1c49f3[_0x2061('0x63')][_0x2061('0x6c')],_[_0x2061('0x73')](_0x1c49f3[_0x2061('0x63')],[_0x2061('0x6c'),'id'])||{})[_0x2061('0xb7')](function(_0x3050bd){for(var _0x286f77=0x0;_0x286f77<_0x1c49f3[_0x2061('0x63')][_0x2061('0x6c')][_0x2061('0x58')];_0x286f77+=0x1){socket[_0x2061('0xbd')](_0x2061('0xbe'),{'UserId':Number(_0x1c49f3[_0x2061('0x63')][_0x2061('0x6c')][_0x286f77]),'FaxAccountId':Number(_0x1c49f3[_0x2061('0x56')]['id'])});}return _0x3050bd;});}})['then'](respondWithResult(_0x8fb5a5,null))[_0x2061('0x54')](handleError(_0x8fb5a5,null));};exports[_0x2061('0xbf')]=function(_0x5d210d,_0x571f02,_0x322fa9){return db[_0x2061('0x3d')]['find']({'where':{'id':_0x5d210d[_0x2061('0x56')]['id']}})[_0x2061('0x1e')](handleEntityNotFound(_0x571f02,null))[_0x2061('0x1e')](function(_0x288848){if(_0x288848){return _0x288848[_0x2061('0xbf')](_0x5d210d[_0x2061('0x43')][_0x2061('0x6c')])['then'](function(){if(_['isArray'](_0x5d210d['query']['ids'])){for(var _0x4f33e6=0x0;_0x4f33e6<_0x5d210d[_0x2061('0x43')]['ids'][_0x2061('0x58')];_0x4f33e6+=0x1){socket[_0x2061('0xbd')](_0x2061('0xc0'),{'UserId':Number(_0x5d210d[_0x2061('0x43')][_0x2061('0x6c')][_0x4f33e6]),'FaxAccountId':Number(_0x5d210d['params']['id'])});}}else{socket[_0x2061('0xbd')](_0x2061('0xc0'),{'UserId':Number(_0x5d210d['query']['ids']),'FaxAccountId':Number(_0x5d210d[_0x2061('0x56')]['id'])});}});}})[_0x2061('0x1e')](respondWithStatusCode(_0x571f02,null))[_0x2061('0x54')](handleError(_0x571f02,null));};exports[_0x2061('0xc1')]=function(_0x3ec2e0,_0x3357cf,_0xbe1c6d){var _0x3adb43={};var _0x6a814f={};var _0x57a9d3;var _0x5f0a92;return db[_0x2061('0x3d')][_0x2061('0x75')]({'where':{'id':_0x3ec2e0[_0x2061('0x56')]['id']}})[_0x2061('0x1e')](handleEntityNotFound(_0x3357cf,null))[_0x2061('0x1e')](function(_0x533779){if(_0x533779){_0x57a9d3=_0x533779;_0x6a814f[_0x2061('0x42')]=_[_0x2061('0x44')](db[_0x2061('0x79')][_0x2061('0x3e')]);_0x6a814f[_0x2061('0x43')]=_['keys'](_0x3ec2e0[_0x2061('0x43')]);_0x6a814f[_0x2061('0x45')]=_[_0x2061('0x57')](_0x6a814f['model'],_0x6a814f['query']);_0x3adb43[_0x2061('0x46')]=_['intersection'](_0x6a814f[_0x2061('0x42')],qs[_0x2061('0x47')](_0x3ec2e0[_0x2061('0x43')][_0x2061('0x47')]));_0x3adb43['attributes']=_0x3adb43[_0x2061('0x46')]['length']?_0x3adb43['attributes']:_0x6a814f[_0x2061('0x42')];_0x3adb43[_0x2061('0x4a')]=qs['sort'](_0x3ec2e0[_0x2061('0x43')][_0x2061('0x4b')]);_0x3adb43['where']=qs[_0x2061('0x45')](_[_0x2061('0x4d')](_0x3ec2e0[_0x2061('0x43')],_0x6a814f[_0x2061('0x45')]));if(_0x3ec2e0[_0x2061('0x43')][_0x2061('0x4e')]){_0x3adb43[_0x2061('0x4c')]=_[_0x2061('0x4f')](_0x3adb43[_0x2061('0x4c')],{'$or':_[_0x2061('0x3c')](_0x3adb43['attributes'],function(_0x324ae0){var _0x2eff26={};_0x2eff26[_0x324ae0]={'$like':'%'+_0x3ec2e0[_0x2061('0x43')][_0x2061('0x4e')]+'%'};return _0x2eff26;})});}_0x3adb43=_[_0x2061('0x4f')]({},_0x3adb43,_0x3ec2e0[_0x2061('0x69')]);return _0x57a9d3[_0x2061('0xc1')](_0x3adb43);}})[_0x2061('0x1e')](function(_0x1a25af){if(_0x1a25af){_0x5f0a92=_0x1a25af['length'];if(!_0x3ec2e0[_0x2061('0x43')][_0x2061('0x70')]('nolimit')){_0x3adb43[_0x2061('0x49')]=qs[_0x2061('0x49')](_0x3ec2e0[_0x2061('0x43')][_0x2061('0x49')]);_0x3adb43['offset']=qs['offset'](_0x3ec2e0['query'][_0x2061('0x2d')]);}return _0x57a9d3[_0x2061('0xc1')](_0x3adb43);}})[_0x2061('0x1e')](function(_0x3467e8){if(_0x3467e8){return _0x3467e8?{'count':_0x5f0a92,'rows':_0x3467e8}:null;}})['then'](respondWithResult(_0x3357cf,null))['catch'](handleError(_0x3357cf,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index bfaa5b2..99d1800 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 _0x6b09=['exports','events','../../mysqldb','FaxAccount','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x5a15d9,_0x10d8da){var _0x2a5998=function(_0xbff3be){while(--_0xbff3be){_0x5a15d9['push'](_0x5a15d9['shift']());}};_0x2a5998(++_0x10d8da);}(_0x6b09,0x17d));var _0x96b0=function(_0x503950,_0x5022eb){_0x503950=_0x503950-0x0;var _0x1657a9=_0x6b09[_0x503950];return _0x1657a9;};'use strict';var EventEmitter=require(_0x96b0('0x0'));var FaxAccount=require(_0x96b0('0x1'))['db'][_0x96b0('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x96b0('0x3'),'afterUpdate':_0x96b0('0x4'),'afterDestroy':_0x96b0('0x5')};function emitEvent(_0x45c7da){return function(_0x31fc97,_0xa76b50,_0x16e3bd){FaxAccountEvents['emit'](_0x45c7da+':'+_0x31fc97['id'],_0x31fc97);FaxAccountEvents[_0x96b0('0x6')](_0x45c7da,_0x31fc97);_0x16e3bd(null);};}for(var e in events){if(events[_0x96b0('0x7')](e)){var event=events[e];FaxAccount[_0x96b0('0x8')](e,emitEvent(event));}}module[_0x96b0('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0xff2e=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0xd655a4,_0x307c48){var _0x4a0e92=function(_0x406625){while(--_0x406625){_0xd655a4['push'](_0xd655a4['shift']());}};_0x4a0e92(++_0x307c48);}(_0xff2e,0xff));var _0xeff2=function(_0x20b8ce,_0x4cd2e8){_0x20b8ce=_0x20b8ce-0x0;var _0x11646e=_0xff2e[_0x20b8ce];return _0x11646e;};'use strict';var EventEmitter=require(_0xeff2('0x0'));var FaxAccount=require(_0xeff2('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xeff2('0x2')](0x0);var events={'afterCreate':_0xeff2('0x3'),'afterUpdate':_0xeff2('0x4'),'afterDestroy':_0xeff2('0x5')};function emitEvent(_0x2618c4){return function(_0x35c4ec,_0x21a56f,_0x1255dc){FaxAccountEvents[_0xeff2('0x6')](_0x2618c4+':'+_0x35c4ec['id'],_0x35c4ec);FaxAccountEvents[_0xeff2('0x6')](_0x2618c4,_0x35c4ec);_0x1255dc(null);};}for(var e in events){if(events[_0xeff2('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xeff2('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 55bd04e..0b2cdda 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 _0x9f56=['api','moment','request-promise','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger'];(function(_0x1a252b,_0x2f6434){var _0x1269d4=function(_0x5b7a14){while(--_0x5b7a14){_0x1a252b['push'](_0x1a252b['shift']());}};_0x1269d4(++_0x2f6434);}(_0x9f56,0xcd));var _0x69f5=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x9f56[_0x4e7d25];return _0x526fe6;};'use strict';var _=require(_0x69f5('0x0'));var util=require(_0x69f5('0x1'));var logger=require(_0x69f5('0x2'))(_0x69f5('0x3'));var moment=require(_0x69f5('0x4'));var BPromise=require('bluebird');var rp=require(_0x69f5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x69f5('0x6'));var config=require(_0x69f5('0x7'));var attributes=require(_0x69f5('0x8'));module[_0x69f5('0x9')]=function(_0x46bca3,_0xb3bf6f){return _0x46bca3[_0x69f5('0xa')](_0x69f5('0xb'),attributes,{'tableName':_0x69f5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f3f=['util','../../config/logger','api','moment','bluebird','path','./faxAccount.attributes','FaxAccount','fax_accounts','lodash'];(function(_0x3e8ad8,_0x25b42b){var _0x557c2a=function(_0x2573da){while(--_0x2573da){_0x3e8ad8['push'](_0x3e8ad8['shift']());}};_0x557c2a(++_0x25b42b);}(_0x0f3f,0x171));var _0xf0f3=function(_0x237da8,_0x37b77a){_0x237da8=_0x237da8-0x0;var _0x558825=_0x0f3f[_0x237da8];return _0x558825;};'use strict';var _=require(_0xf0f3('0x0'));var util=require(_0xf0f3('0x1'));var logger=require(_0xf0f3('0x2'))(_0xf0f3('0x3'));var moment=require(_0xf0f3('0x4'));var BPromise=require(_0xf0f3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0f3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf0f3('0x7'));module['exports']=function(_0x246256,_0x56d8e9){return _0x246256['define'](_0xf0f3('0x8'),attributes,{'tableName':_0xf0f3('0x9'),'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 c8c3de8..346d89a 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 _0xacfe=['account','CmList','Contacts','FaxApplication','List','get','applications','Applications','priority','length','from','create','FaxInteraction','Contact\x20not\x20found','spread','autoclose','close','unmanaged','created','interaction','FaxMessage','AttachmentId','UserId','User','name','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./faxAccount.socket','register','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','result','catch','GetFaxAccount','FaxAccount','options','raw','where','attributes','limit','include','map','model','info','NotifyFaxAccount','body','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find'];(function(_0x54ea7a,_0x19df9b){var _0x65a10d=function(_0x1bf936){while(--_0x1bf936){_0x54ea7a['push'](_0x54ea7a['shift']());}};_0x65a10d(++_0x19df9b);}(_0xacfe,0x181));var _0xeacf=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xacfe[_0x13e741];return _0x3f8bb3;};'use strict';var _=require('lodash');var util=require(_0xeacf('0x0'));var moment=require(_0xeacf('0x1'));var BPromise=require(_0xeacf('0x2'));var rs=require(_0xeacf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeacf('0x4'))['db'];var utils=require(_0xeacf('0x5'));var logger=require('../../config/logger')(_0xeacf('0x6'));var config=require(_0xeacf('0x7'));var jayson=require(_0xeacf('0x8'));var client=jayson['client'][_0xeacf('0x9')]({'port':0x232c});config[_0xeacf('0xa')]=_[_0xeacf('0xb')](config[_0xeacf('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xeacf('0xc'))(new Redis(config[_0xeacf('0xa')]));require(_0xeacf('0xd'))[_0xeacf('0xe')](socket);function respondWithRpcPromise(_0x529221,_0x2cb4c1,_0x4ff5b0){return new BPromise(function(_0x377eeb,_0x5b0454){return client[_0xeacf('0xf')](_0x529221,_0x4ff5b0)[_0xeacf('0x10')](function(_0x1bf9c6){logger['info']('FaxAccount,\x20%s,\x20%s',_0x2cb4c1,_0xeacf('0x11'));logger[_0xeacf('0x12')](_0xeacf('0x13'),_0x2cb4c1,'request\x20sent',JSON[_0xeacf('0x14')](_0x1bf9c6));if(_0x1bf9c6[_0xeacf('0x15')]){if(_0x1bf9c6[_0xeacf('0x15')][_0xeacf('0x16')]===0x1f4){logger[_0xeacf('0x15')]('FaxAccount,\x20%s,\x20%s',_0x2cb4c1,_0x1bf9c6[_0xeacf('0x15')]['message']);return _0x5b0454(_0x1bf9c6['error'][_0xeacf('0x17')]);}logger[_0xeacf('0x15')](_0xeacf('0x18'),_0x2cb4c1,_0x1bf9c6[_0xeacf('0x15')]['message']);return _0x377eeb(_0x1bf9c6[_0xeacf('0x15')][_0xeacf('0x17')]);}else{logger['info'](_0xeacf('0x18'),_0x2cb4c1,_0xeacf('0x11'));_0x377eeb(_0x1bf9c6[_0xeacf('0x19')][_0xeacf('0x17')]);}})[_0xeacf('0x1a')](function(_0x3bd014){logger[_0xeacf('0x15')]('FaxAccount,\x20%s,\x20%s',_0x2cb4c1,_0x3bd014);_0x5b0454(_0x3bd014);});});}exports[_0xeacf('0x1b')]=function(_0x5b1532){var _0x9379cb=this;return new Promise(function(_0x167646,_0x3d1cf){return db[_0xeacf('0x1c')]['findAll']({'raw':_0x5b1532[_0xeacf('0x1d')]?_0x5b1532[_0xeacf('0x1d')][_0xeacf('0x1e')]===undefined?!![]:![]:!![],'where':_0x5b1532[_0xeacf('0x1d')]?_0x5b1532[_0xeacf('0x1d')][_0xeacf('0x1f')]||null:null,'attributes':_0x5b1532[_0xeacf('0x1d')]?_0x5b1532['options'][_0xeacf('0x20')]||null:null,'limit':_0x5b1532[_0xeacf('0x1d')]?_0x5b1532['options'][_0xeacf('0x21')]||null:null,'include':_0x5b1532[_0xeacf('0x1d')]?_0x5b1532['options'][_0xeacf('0x22')]?_[_0xeacf('0x23')](_0x5b1532['options']['include'],function(_0x46f0fa){return{'model':db[_0x46f0fa[_0xeacf('0x24')]],'as':_0x46f0fa['as'],'attributes':_0x46f0fa[_0xeacf('0x20')],'include':_0x46f0fa['include']?_[_0xeacf('0x23')](_0x46f0fa[_0xeacf('0x22')],function(_0x220b66){return{'model':db[_0x220b66[_0xeacf('0x24')]],'as':_0x220b66['as'],'attributes':_0x220b66['attributes'],'include':_0x220b66[_0xeacf('0x22')]?_[_0xeacf('0x23')](_0x220b66[_0xeacf('0x22')],function(_0x2b48cd){return{'model':db[_0x2b48cd[_0xeacf('0x24')]],'as':_0x2b48cd['as'],'attributes':_0x2b48cd[_0xeacf('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x582e93){logger[_0xeacf('0x25')]('GetFaxAccount',_0x5b1532);logger[_0xeacf('0x12')](_0xeacf('0x1b'),_0x5b1532,JSON['stringify'](_0x582e93));_0x167646(_0x582e93);})[_0xeacf('0x1a')](function(_0x29b4bc){logger[_0xeacf('0x15')](_0xeacf('0x1b'),_0x29b4bc[_0xeacf('0x17')],_0x5b1532);_0x3d1cf(_0x9379cb['error'](0x1f4,_0x29b4bc['message']));});});};exports[_0xeacf('0x26')]=function(_0x222209,_0x1f20f1,_0xeed1e9){var _0x3e9f4d=this;return new Promise(function(_0xc10585,_0x8214dd){var _0x2cf8f1={'body':_0x222209[_0xeacf('0x27')],'channel':_0xeacf('0x28')};var _0x5f2e20=[];var _0x15a1d2=[];var _0x27a229={};return db[_0xeacf('0x29')][_0xeacf('0x2a')]()[_0xeacf('0x10')](function(_0x34c74c){if(!_0x34c74c){throw new db['Sequelize'][(_0xeacf('0x2b'))](_0xeacf('0x2c'));}_0x5f2e20=_[_0xeacf('0x2d')](_[_0xeacf('0x2e')](_0x34c74c),[_0xeacf('0x2f'),'updatedAt']);_0x15a1d2=_[_0xeacf('0x2d')](_[_0xeacf('0x2e')](_0x34c74c),['createdAt',_0xeacf('0x30'),_0xeacf('0x31'),_0xeacf('0x32')]);if(_0x222209[_0xeacf('0x27')]['id']){delete _0x222209[_0xeacf('0x27')]['id'];}if(_['isNil'](_0x222209[_0xeacf('0x27')]['from'])){throw new db[(_0xeacf('0x33'))][(_0xeacf('0x2b'))](_0xeacf('0x34'));}if(_[_0xeacf('0x35')](_0x222209['body'][_0xeacf('0x27')])||_0x222209['body'][_0xeacf('0x27')]===''){throw new db[(_0xeacf('0x33'))][(_0xeacf('0x2b'))](_0xeacf('0x36'));}if(_[_0xeacf('0x35')](_0x222209[_0xeacf('0x27')][_0xeacf('0x37')])){throw new db['Sequelize'][(_0xeacf('0x2b'))](_0xeacf('0x38')+_0x15a1d2);}if(!_[_0xeacf('0x39')](_0x15a1d2,_0x222209[_0xeacf('0x27')]['mapKey'])){throw new db[(_0xeacf('0x33'))][(_0xeacf('0x2b'))](_0xeacf('0x3a')+_0x15a1d2);}_0x27a229[_0x222209[_0xeacf('0x27')][_0xeacf('0x37')]]=_0x222209[_0xeacf('0x27')]['from'];})['then'](function(){return db[_0xeacf('0x1c')][_0xeacf('0x3b')]({'where':{'id':_0x222209[_0xeacf('0x3c')]['id']},'include':[{'model':db[_0xeacf('0x3d')],'as':'List','include':[{'model':db[_0xeacf('0x29')],'as':_0xeacf('0x3e'),'where':_0x27a229,'limit':0x1,'order':[[_0xeacf('0x30'),'DESC']]}]},{'model':db[_0xeacf('0x3f')],'as':'Applications'}]});})['then'](function(_0x1e55d7){if(_0x1e55d7&&_0x1e55d7[_0xeacf('0x40')]){var _0x1bd13e=_0x1e55d7[_0xeacf('0x41')]({'plain':!![]});_0x2cf8f1[_0xeacf('0x3c')]=_0x1bd13e;_0x2cf8f1[_0xeacf('0x42')]=_0x1bd13e[_0xeacf('0x43')];_0x2cf8f1['list']=_0x1bd13e[_0xeacf('0x40')];_0x2cf8f1['applications']=_['orderBy'](_0x2cf8f1['applications'],[_0xeacf('0x44')],['asc']);if(_0x2cf8f1[_0xeacf('0x3c')][_0xeacf('0x43')]){delete _0x2cf8f1['account'][_0xeacf('0x43')];}if(_0x2cf8f1['account']['List']&&_0x2cf8f1[_0xeacf('0x3c')][_0xeacf('0x40')][_0xeacf('0x3e')][_0xeacf('0x45')]){return _0x2cf8f1[_0xeacf('0x3c')][_0xeacf('0x40')][_0xeacf('0x3e')][0x0];}var _0x8aab81=_[_0xeacf('0xb')](_0x222209[_0xeacf('0x27')],{'firstName':_0x222209[_0xeacf('0x27')]['from'],'ListId':_0x1bd13e['ListId']});_0x8aab81[_0x222209[_0xeacf('0x27')][_0xeacf('0x37')]]=_0x222209['body'][_0xeacf('0x46')];return db[_0xeacf('0x29')][_0xeacf('0x47')](_0x8aab81,{'fields':_0x5f2e20,'raw':!![]});}})['then'](function(_0x440411){_0x2cf8f1['contact']=_0x440411;if(_0x440411){var _0x6415b8={'ContactId':_0x440411['id'],'FaxAccountId':_0x222209[_0xeacf('0x3c')]['id'],'fax':_0x440411['fax']};return db[_0xeacf('0x48')][_0xeacf('0x3b')]({'where':{'ContactId':_0x440411['id'],'closed':![],'FaxAccountId':_0x222209[_0xeacf('0x3c')]['id']}})['then'](function(_0x42236b){if(_0x42236b){return[_0x42236b,![]];}return db[_0xeacf('0x48')][_0xeacf('0x47')](_0x6415b8)[_0xeacf('0x10')](function(_0x13ab71){return[_0x13ab71,!![]];});});}else{throw new Error(_0xeacf('0x49'));}})[_0xeacf('0x4a')](function(_0x5eff45,_0x3d0a83){var _0x2aa820=_0x5eff45['get']({'plain':!![]});if(_0x3d0a83){if(_0x2cf8f1[_0xeacf('0x3c')][_0xeacf('0x4b')]){_0x2cf8f1[_0xeacf('0x42')]['push']({'id':0x0,'priority':_0x2cf8f1[_0xeacf('0x42')][_0xeacf('0x45')]+0x1,'app':_0xeacf('0x4c'),'appdata':_0xeacf('0x4d'),'interval':'*,*,*,*'});}_0x2aa820[_0xeacf('0x4e')]=!![];}else{_0x2aa820[_0xeacf('0x4e')]=![];}_0x2cf8f1[_0xeacf('0x4f')]=_0x2aa820;return db[_0xeacf('0x50')][_0xeacf('0x47')]({'body':_0x222209[_0xeacf('0x27')][_0xeacf('0x27')],'FaxAccountId':_0x222209[_0xeacf('0x3c')]['id'],'FaxInteractionId':_0x5eff45['id'],'direction':'in','ContactId':_0x5eff45['ContactId'],'AttachmentId':_0x222209[_0xeacf('0x27')][_0xeacf('0x51')]});})[_0xeacf('0x10')](function(_0x570d67){_0x2cf8f1[_0xeacf('0x17')]=_0x570d67;if(_0x2cf8f1[_0xeacf('0x4f')][_0xeacf('0x52')]){return db[_0xeacf('0x53')][_0xeacf('0x3b')]({'attributes':['id','name'],'where':{'id':_0x2cf8f1[_0xeacf('0x4f')]['UserId']}})['then'](function(_0x117ea7){if(_0x117ea7){_0x2cf8f1[_0xeacf('0x42')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x117ea7[_0xeacf('0x54')]+','+(_0x2cf8f1[_0xeacf('0x3c')][_0xeacf('0x55')]||0xa),'interval':_0xeacf('0x56')});}return respondWithRpcPromise(_0xeacf('0x57'),_0xeacf('0x58'),_0x2cf8f1);});}return respondWithRpcPromise(_0xeacf('0x57'),_0xeacf('0x58'),_0x2cf8f1);})[_0xeacf('0x10')](function(_0x469bfd){_0xc10585(_0x469bfd);})['catch'](function(_0x1a7d52){_0x8214dd(_0x3e9f4d[_0xeacf('0x15')](0x1f4,_0x1a7d52['message']));});});}; \ No newline at end of file +var _0xf583=['findAll','options','raw','where','limit','include','map','model','attributes','stringify','NotifyFaxAccount','body','fax','CmContact','describe','then','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','account','List','Contacts','FaxApplication','Applications','list','applications','orderBy','priority','create','FaxInteraction','find','Contact\x20not\x20found','spread','get','autoclose','push','length','close','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','User','UserId','agent','name','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxAccount.socket','register','request','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','GetFaxAccount'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf583,0x1b2));var _0x3f58=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0xf583[_0x397cfb];return _0x15fed9;};'use strict';var _=require(_0x3f58('0x0'));var util=require(_0x3f58('0x1'));var moment=require(_0x3f58('0x2'));var BPromise=require(_0x3f58('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f58('0x4'));var db=require(_0x3f58('0x5'))['db'];var utils=require(_0x3f58('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3f58('0x7'));var client=jayson[_0x3f58('0x8')][_0x3f58('0x9')]({'port':0x232c});config[_0x3f58('0xa')]=_[_0x3f58('0xb')](config[_0x3f58('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3f58('0xc'))(new Redis(config[_0x3f58('0xa')]));require(_0x3f58('0xd'))[_0x3f58('0xe')](socket);function respondWithRpcPromise(_0x196c5c,_0x17438d,_0x2dd0f6){return new BPromise(function(_0xb4ea34,_0x4c2ccf){return client[_0x3f58('0xf')](_0x196c5c,_0x2dd0f6)['then'](function(_0x3ea2de){logger['info'](_0x3f58('0x10'),_0x17438d,_0x3f58('0x11'));logger[_0x3f58('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x17438d,'request\x20sent',JSON['stringify'](_0x3ea2de));if(_0x3ea2de[_0x3f58('0x13')]){if(_0x3ea2de[_0x3f58('0x13')][_0x3f58('0x14')]===0x1f4){logger[_0x3f58('0x13')]('FaxAccount,\x20%s,\x20%s',_0x17438d,_0x3ea2de[_0x3f58('0x13')][_0x3f58('0x15')]);return _0x4c2ccf(_0x3ea2de[_0x3f58('0x13')][_0x3f58('0x15')]);}logger[_0x3f58('0x13')](_0x3f58('0x10'),_0x17438d,_0x3ea2de['error']['message']);return _0xb4ea34(_0x3ea2de['error'][_0x3f58('0x15')]);}else{logger[_0x3f58('0x16')](_0x3f58('0x10'),_0x17438d,_0x3f58('0x11'));_0xb4ea34(_0x3ea2de[_0x3f58('0x17')][_0x3f58('0x15')]);}})[_0x3f58('0x18')](function(_0x4a3882){logger[_0x3f58('0x13')]('FaxAccount,\x20%s,\x20%s',_0x17438d,_0x4a3882);_0x4c2ccf(_0x4a3882);});});}exports[_0x3f58('0x19')]=function(_0xa63d01){var _0x1b4e2d=this;return new Promise(function(_0x34545c,_0x5a0f65){return db['FaxAccount'][_0x3f58('0x1a')]({'raw':_0xa63d01[_0x3f58('0x1b')]?_0xa63d01['options'][_0x3f58('0x1c')]===undefined?!![]:![]:!![],'where':_0xa63d01[_0x3f58('0x1b')]?_0xa63d01[_0x3f58('0x1b')][_0x3f58('0x1d')]||null:null,'attributes':_0xa63d01['options']?_0xa63d01['options']['attributes']||null:null,'limit':_0xa63d01[_0x3f58('0x1b')]?_0xa63d01[_0x3f58('0x1b')][_0x3f58('0x1e')]||null:null,'include':_0xa63d01[_0x3f58('0x1b')]?_0xa63d01[_0x3f58('0x1b')][_0x3f58('0x1f')]?_[_0x3f58('0x20')](_0xa63d01['options']['include'],function(_0x268600){return{'model':db[_0x268600[_0x3f58('0x21')]],'as':_0x268600['as'],'attributes':_0x268600[_0x3f58('0x22')],'include':_0x268600[_0x3f58('0x1f')]?_['map'](_0x268600['include'],function(_0x43f3d7){return{'model':db[_0x43f3d7['model']],'as':_0x43f3d7['as'],'attributes':_0x43f3d7[_0x3f58('0x22')],'include':_0x43f3d7[_0x3f58('0x1f')]?_[_0x3f58('0x20')](_0x43f3d7[_0x3f58('0x1f')],function(_0x42d077){return{'model':db[_0x42d077['model']],'as':_0x42d077['as'],'attributes':_0x42d077[_0x3f58('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c6fbd){logger['info'](_0x3f58('0x19'),_0xa63d01);logger[_0x3f58('0x12')]('GetFaxAccount',_0xa63d01,JSON[_0x3f58('0x23')](_0x4c6fbd));_0x34545c(_0x4c6fbd);})['catch'](function(_0x665ce0){logger['error'](_0x3f58('0x19'),_0x665ce0[_0x3f58('0x15')],_0xa63d01);_0x5a0f65(_0x1b4e2d[_0x3f58('0x13')](0x1f4,_0x665ce0['message']));});});};exports[_0x3f58('0x24')]=function(_0x14dfac,_0x5491c6,_0x151954){var _0x3861e0=this;return new Promise(function(_0x1216ee,_0x3f5fae){var _0x404ad4={'body':_0x14dfac[_0x3f58('0x25')],'channel':_0x3f58('0x26')};var _0x41438a=[];var _0x271a3b=[];var _0xa11904={};return db[_0x3f58('0x27')][_0x3f58('0x28')]()[_0x3f58('0x29')](function(_0x5819c3){if(!_0x5819c3){throw new db[(_0x3f58('0x2a'))][(_0x3f58('0x2b'))](_0x3f58('0x2c'));}_0x41438a=_[_0x3f58('0x2d')](_['keys'](_0x5819c3),[_0x3f58('0x2e'),_0x3f58('0x2f')]);_0x271a3b=_[_0x3f58('0x2d')](_['keys'](_0x5819c3),[_0x3f58('0x2e'),'updatedAt',_0x3f58('0x30'),_0x3f58('0x31')]);if(_0x14dfac[_0x3f58('0x25')]['id']){delete _0x14dfac['body']['id'];}if(_[_0x3f58('0x32')](_0x14dfac[_0x3f58('0x25')][_0x3f58('0x33')])){throw new db[(_0x3f58('0x2a'))][(_0x3f58('0x2b'))](_0x3f58('0x34'));}if(_[_0x3f58('0x32')](_0x14dfac[_0x3f58('0x25')][_0x3f58('0x25')])||_0x14dfac['body']['body']===''){throw new db['Sequelize'][(_0x3f58('0x2b'))](_0x3f58('0x35'));}if(_[_0x3f58('0x32')](_0x14dfac['body'][_0x3f58('0x36')])){throw new db[(_0x3f58('0x2a'))][(_0x3f58('0x2b'))](_0x3f58('0x37')+_0x271a3b);}if(!_[_0x3f58('0x38')](_0x271a3b,_0x14dfac['body'][_0x3f58('0x36')])){throw new db[(_0x3f58('0x2a'))][(_0x3f58('0x2b'))](_0x3f58('0x39')+_0x271a3b);}_0xa11904[_0x14dfac[_0x3f58('0x25')][_0x3f58('0x36')]]=_0x14dfac[_0x3f58('0x25')][_0x3f58('0x33')];})[_0x3f58('0x29')](function(){return db[_0x3f58('0x3a')]['find']({'where':{'id':_0x14dfac[_0x3f58('0x3b')]['id']},'include':[{'model':db['CmList'],'as':_0x3f58('0x3c'),'include':[{'model':db[_0x3f58('0x27')],'as':_0x3f58('0x3d'),'where':_0xa11904,'limit':0x1,'order':[[_0x3f58('0x2f'),'DESC']]}]},{'model':db[_0x3f58('0x3e')],'as':'Applications'}]});})['then'](function(_0x393540){if(_0x393540&&_0x393540['List']){var _0x4c1bd9=_0x393540['get']({'plain':!![]});_0x404ad4['account']=_0x4c1bd9;_0x404ad4['applications']=_0x4c1bd9[_0x3f58('0x3f')];_0x404ad4[_0x3f58('0x40')]=_0x4c1bd9[_0x3f58('0x3c')];_0x404ad4[_0x3f58('0x41')]=_[_0x3f58('0x42')](_0x404ad4[_0x3f58('0x41')],[_0x3f58('0x43')],['asc']);if(_0x404ad4[_0x3f58('0x3b')][_0x3f58('0x3f')]){delete _0x404ad4[_0x3f58('0x3b')][_0x3f58('0x3f')];}if(_0x404ad4['account'][_0x3f58('0x3c')]&&_0x404ad4[_0x3f58('0x3b')][_0x3f58('0x3c')][_0x3f58('0x3d')]['length']){return _0x404ad4[_0x3f58('0x3b')]['List'][_0x3f58('0x3d')][0x0];}var _0xad9152=_[_0x3f58('0xb')](_0x14dfac[_0x3f58('0x25')],{'firstName':_0x14dfac[_0x3f58('0x25')]['from'],'ListId':_0x4c1bd9[_0x3f58('0x31')]});_0xad9152[_0x14dfac[_0x3f58('0x25')]['mapKey']]=_0x14dfac[_0x3f58('0x25')][_0x3f58('0x33')];return db['CmContact'][_0x3f58('0x44')](_0xad9152,{'fields':_0x41438a,'raw':!![]});}})[_0x3f58('0x29')](function(_0x42f9aa){_0x404ad4['contact']=_0x42f9aa;if(_0x42f9aa){var _0x3c86b5={'ContactId':_0x42f9aa['id'],'FaxAccountId':_0x14dfac[_0x3f58('0x3b')]['id'],'fax':_0x42f9aa[_0x3f58('0x26')]};return db[_0x3f58('0x45')][_0x3f58('0x46')]({'where':{'ContactId':_0x42f9aa['id'],'closed':![],'FaxAccountId':_0x14dfac[_0x3f58('0x3b')]['id']}})[_0x3f58('0x29')](function(_0x5b4a89){if(_0x5b4a89){return[_0x5b4a89,![]];}return db[_0x3f58('0x45')]['create'](_0x3c86b5)[_0x3f58('0x29')](function(_0x48c8ee){return[_0x48c8ee,!![]];});});}else{throw new Error(_0x3f58('0x47'));}})[_0x3f58('0x48')](function(_0x139585,_0x497dcb){var _0x35c974=_0x139585[_0x3f58('0x49')]({'plain':!![]});if(_0x497dcb){if(_0x404ad4[_0x3f58('0x3b')][_0x3f58('0x4a')]){_0x404ad4[_0x3f58('0x41')][_0x3f58('0x4b')]({'id':0x0,'priority':_0x404ad4[_0x3f58('0x41')][_0x3f58('0x4c')]+0x1,'app':_0x3f58('0x4d'),'appdata':_0x3f58('0x4e'),'interval':'*,*,*,*'});}_0x35c974['created']=!![];}else{_0x35c974[_0x3f58('0x4f')]=![];}_0x404ad4[_0x3f58('0x50')]=_0x35c974;return db[_0x3f58('0x51')][_0x3f58('0x44')]({'body':_0x14dfac['body'][_0x3f58('0x25')],'FaxAccountId':_0x14dfac[_0x3f58('0x3b')]['id'],'FaxInteractionId':_0x139585['id'],'direction':'in','ContactId':_0x139585[_0x3f58('0x52')],'AttachmentId':_0x14dfac['body'][_0x3f58('0x53')]});})[_0x3f58('0x29')](function(_0x3e6837){_0x404ad4['message']=_0x3e6837;if(_0x404ad4[_0x3f58('0x50')]['UserId']){return db[_0x3f58('0x54')][_0x3f58('0x46')]({'attributes':['id','name'],'where':{'id':_0x404ad4['interaction'][_0x3f58('0x55')]}})['then'](function(_0x4548d1){if(_0x4548d1){_0x404ad4[_0x3f58('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':_0x3f58('0x56'),'appdata':_0x4548d1[_0x3f58('0x57')]+','+(_0x404ad4[_0x3f58('0x3b')][_0x3f58('0x58')]||0xa),'interval':_0x3f58('0x59')});}return respondWithRpcPromise('Start','startRouting',_0x404ad4);});}return respondWithRpcPromise(_0x3f58('0x5a'),_0x3f58('0x5b'),_0x404ad4);})[_0x3f58('0x29')](function(_0xcf562a){_0x1216ee(_0xcf562a);})['catch'](function(_0x28f3b5){_0x3f5fae(_0x3861e0['error'](0x1f4,_0x28f3b5[_0x3f58('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index aefcdab..6c64f0b 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 _0xafbd=['faxAccount:','./faxAccount.events','save'];(function(_0x4e55a9,_0x241b22){var _0x4a9b67=function(_0x2a3bd1){while(--_0x2a3bd1){_0x4e55a9['push'](_0x4e55a9['shift']());}};_0x4a9b67(++_0x241b22);}(_0xafbd,0x11e));var _0xdafb=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xafbd[_0x1cc8fe];return _0x230054;};'use strict';var FaxAccountEvents=require(_0xdafb('0x0'));var events=[_0xdafb('0x1'),'remove','update'];function createListener(_0x2493d1,_0x1048b7){return function(_0x5ad61d){_0x1048b7['emit'](_0x2493d1,_0x5ad61d);};}function removeListener(_0x3cdb55,_0x258445){return function(){FaxAccountEvents['removeListener'](_0x3cdb55,_0x258445);};}exports['register']=function(_0x541e56){for(var _0x2d76b8=0x0,_0x59d680=events['length'];_0x2d76b8<_0x59d680;_0x2d76b8++){var _0x5df280=events[_0x2d76b8];var _0x5c3feb=createListener(_0xdafb('0x2')+_0x5df280,_0x541e56);FaxAccountEvents['on'](_0x5df280,_0x5c3feb);}}; \ No newline at end of file +var _0xf8a8=['removeListener','length','./faxAccount.events','save','remove','update'];(function(_0x2906e6,_0x5ccd59){var _0x12517a=function(_0x36d576){while(--_0x36d576){_0x2906e6['push'](_0x2906e6['shift']());}};_0x12517a(++_0x5ccd59);}(_0xf8a8,0xaa));var _0x8f8a=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xf8a8[_0x92c450];return _0x2a9599;};'use strict';var FaxAccountEvents=require(_0x8f8a('0x0'));var events=[_0x8f8a('0x1'),_0x8f8a('0x2'),_0x8f8a('0x3')];function createListener(_0x393613,_0x192c5f){return function(_0x32a955){_0x192c5f['emit'](_0x393613,_0x32a955);};}function removeListener(_0x1643cd,_0x338516){return function(){FaxAccountEvents[_0x8f8a('0x4')](_0x1643cd,_0x338516);};}exports['register']=function(_0x4b1ac6){for(var _0x32affd=0x0,_0xf62f3f=events[_0x8f8a('0x5')];_0x32affd<_0xf62f3f;_0x32affd++){var _0x195ee9=events[_0x32affd];var _0x16bba8=createListener('faxAccount:'+_0x195ee9,_0x4b1ac6);FaxAccountEvents['on'](_0x195ee9,_0x16bba8);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 84c2400..5b7e1e7 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(_0x3b48bc,_0x572105){var _0x27b95d=function(_0x1949cb){while(--_0x1949cb){_0x3b48bc['push'](_0x3b48bc['shift']());}};_0x27b95d(++_0x572105);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x3ea372,_0x1172d1){var _0x898a34=function(_0xbe9f96){while(--_0xbe9f96){_0x3ea372['push'](_0x3ea372['shift']());}};_0x898a34(++_0x1172d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 81e589c..0d05020 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 _0x7c87=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x1f6704,_0x106f36){var _0x4acab6=function(_0x398633){while(--_0x398633){_0x1f6704['push'](_0x1f6704['shift']());}};_0x4acab6(++_0x106f36);}(_0x7c87,0x1a1));var _0x77c8=function(_0x7e55f5,_0x37c99f){_0x7e55f5=_0x7e55f5-0x0;var _0x531d68=_0x7c87[_0x7e55f5];return _0x531d68;};'use strict';var Sequelize=require(_0x77c8('0x0'));module[_0x77c8('0x1')]={'priority':{'type':Sequelize[_0x77c8('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x77c8('0x3')],'allowNull':![],'defaultValue':_0x77c8('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x77c8('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x77c8('0x5')}}; \ No newline at end of file +var _0x32a0=['STRING','sequelize','INTEGER'];(function(_0x29e8d5,_0x122f8e){var _0x353dbd=function(_0x49c8af){while(--_0x49c8af){_0x29e8d5['push'](_0x29e8d5['shift']());}};_0x353dbd(++_0x122f8e);}(_0x32a0,0x193));var _0x032a=function(_0x4fa892,_0x4e66a0){_0x4fa892=_0x4fa892-0x0;var _0x260ef6=_0x32a0[_0x4fa892];return _0x260ef6;};'use strict';var Sequelize=require(_0x032a('0x0'));module['exports']={'priority':{'type':Sequelize[_0x032a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x032a('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x032a('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 6f7d263..ca23913 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 _0x06b8=['map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','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','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x06b8,0x1e2));var _0x806b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x06b8[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x806b('0x0'));var rimraf=require(_0x806b('0x1'));var zipdir=require(_0x806b('0x2'));var jsonpatch=require(_0x806b('0x3'));var rp=require('request-promise');var moment=require(_0x806b('0x4'));var BPromise=require(_0x806b('0x5'));var Mustache=require(_0x806b('0x6'));var util=require('util');var path=require(_0x806b('0x7'));var sox=require(_0x806b('0x8'));var csv=require(_0x806b('0x9'));var ejs=require(_0x806b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x806b('0xb'));var squel=require(_0x806b('0xc'));var crypto=require('crypto');var jsforce=require(_0x806b('0xd'));var deskjs=require(_0x806b('0xe'));var toCsv=require(_0x806b('0x9'));var querystring=require('querystring');var Papa=require(_0x806b('0xf'));var Redis=require('ioredis');var authService=require(_0x806b('0x10'));var qs=require(_0x806b('0x11'));var as=require(_0x806b('0x12'));var hardwareService=require(_0x806b('0x13'));var logger=require('../../config/logger')(_0x806b('0x14'));var utils=require('../../config/utils');var config=require(_0x806b('0x15'));var licenseUtil=require(_0x806b('0x16'));var db=require(_0x806b('0x17'))['db'];function respondWithStatusCode(_0x21a9f5,_0xd4d9ec){_0xd4d9ec=_0xd4d9ec||0xcc;return function(_0x4c4dc6){if(_0x4c4dc6){return _0x21a9f5[_0x806b('0x18')](_0xd4d9ec);}return _0x21a9f5['status'](_0xd4d9ec)[_0x806b('0x19')]();};}function respondWithResult(_0x38afdc,_0x3008d8){_0x3008d8=_0x3008d8||0xc8;return function(_0x537b1e){if(_0x537b1e){return _0x38afdc['status'](_0x3008d8)[_0x806b('0x1a')](_0x537b1e);}};}function respondWithFilteredResult(_0x1ad802,_0x46ba33){return function(_0x32552c){if(_0x32552c){var _0x1beab0=typeof _0x46ba33['offset']===_0x806b('0x1b')&&typeof _0x46ba33[_0x806b('0x1c')]===_0x806b('0x1b');var _0x16b181=_0x32552c[_0x806b('0x1d')];var _0x4bbd39=_0x1beab0?0x0:_0x46ba33[_0x806b('0x1e')];var _0x353c71=_0x1beab0?_0x32552c[_0x806b('0x1d')]:_0x46ba33['offset']+_0x46ba33[_0x806b('0x1c')];var _0x56b675;if(_0x353c71>=_0x16b181){_0x353c71=_0x16b181;_0x56b675=0xc8;}else{_0x56b675=0xce;}_0x1ad802[_0x806b('0x1f')](_0x56b675);return _0x1ad802[_0x806b('0x20')](_0x806b('0x21'),_0x4bbd39+'-'+_0x353c71+'/'+_0x16b181)[_0x806b('0x1a')](_0x32552c);}return null;};}function patchUpdates(_0x5d07c6){return function(_0xcb460){try{jsonpatch[_0x806b('0x22')](_0xcb460,_0x5d07c6,!![]);}catch(_0x4b9b22){return BPromise[_0x806b('0x23')](_0x4b9b22);}return _0xcb460['save']();};}function saveUpdates(_0x34367d,_0x203934){return function(_0x1f314c){if(_0x1f314c){return _0x1f314c[_0x806b('0x24')](_0x34367d)[_0x806b('0x25')](function(_0x55910a){return _0x55910a;});}return null;};}function removeEntity(_0x4579e3,_0x1b33b0){return function(_0x4624c6){if(_0x4624c6){return _0x4624c6[_0x806b('0x26')]()[_0x806b('0x25')](function(){_0x4579e3[_0x806b('0x1f')](0xcc)[_0x806b('0x19')]();});}};}function handleEntityNotFound(_0x1866fe,_0x3d3600){return function(_0x4e9ea2){if(!_0x4e9ea2){_0x1866fe[_0x806b('0x18')](0x194);}return _0x4e9ea2;};}function handleError(_0x3c1b77,_0x1d9d1c){_0x1d9d1c=_0x1d9d1c||0x1f4;return function(_0x2ec1a3){logger[_0x806b('0x27')](_0x2ec1a3['stack']);if(_0x2ec1a3[_0x806b('0x28')]){delete _0x2ec1a3[_0x806b('0x28')];}_0x3c1b77[_0x806b('0x1f')](_0x1d9d1c)[_0x806b('0x29')](_0x2ec1a3);};}exports[_0x806b('0x2a')]=function(_0x30b8a5,_0xb18a70){var _0x4ed6df={},_0x2f3aae={},_0x2d190b={'count':0x0,'rows':[]};var _0x5ffd0=_[_0x806b('0x2b')](db[_0x806b('0x2c')][_0x806b('0x2d')],function(_0x2f370e){return{'name':_0x2f370e[_0x806b('0x2e')],'type':_0x2f370e[_0x806b('0x2f')][_0x806b('0x30')]};});_0x2f3aae[_0x806b('0x31')]=_[_0x806b('0x2b')](_0x5ffd0,_0x806b('0x28'));_0x2f3aae[_0x806b('0x32')]=_[_0x806b('0x33')](_0x30b8a5[_0x806b('0x32')]);_0x2f3aae[_0x806b('0x34')]=_[_0x806b('0x35')](_0x2f3aae[_0x806b('0x31')],_0x2f3aae[_0x806b('0x32')]);_0x4ed6df[_0x806b('0x36')]=_[_0x806b('0x35')](_0x2f3aae['model'],qs[_0x806b('0x37')](_0x30b8a5['query']['fields']));_0x4ed6df['attributes']=_0x4ed6df[_0x806b('0x36')][_0x806b('0x38')]?_0x4ed6df[_0x806b('0x36')]:_0x2f3aae[_0x806b('0x31')];if(!_0x30b8a5[_0x806b('0x32')]['hasOwnProperty'](_0x806b('0x39'))){_0x4ed6df[_0x806b('0x1c')]=qs[_0x806b('0x1c')](_0x30b8a5['query'][_0x806b('0x1c')]);_0x4ed6df[_0x806b('0x1e')]=qs[_0x806b('0x1e')](_0x30b8a5[_0x806b('0x32')][_0x806b('0x1e')]);}_0x4ed6df[_0x806b('0x3a')]=qs[_0x806b('0x3b')](_0x30b8a5[_0x806b('0x32')]['sort']);_0x4ed6df[_0x806b('0x3c')]=qs['filters'](_[_0x806b('0x3d')](_0x30b8a5[_0x806b('0x32')],_0x2f3aae[_0x806b('0x34')]),_0x5ffd0);if(_0x30b8a5[_0x806b('0x32')][_0x806b('0x3e')]){_0x4ed6df[_0x806b('0x3c')]=_[_0x806b('0x3f')](_0x4ed6df['where'],{'$or':_[_0x806b('0x2b')](_0x5ffd0,function(_0x5869af){if(_0x5869af['type']!=='VIRTUAL'){var _0x7c127a={};_0x7c127a[_0x5869af['name']]={'$like':'%'+_0x30b8a5[_0x806b('0x32')][_0x806b('0x3e')]+'%'};return _0x7c127a;}})});}_0x4ed6df=_[_0x806b('0x3f')]({},_0x4ed6df,_0x30b8a5[_0x806b('0x40')]);var _0x19dec7={'where':_0x4ed6df[_0x806b('0x3c')]};return db[_0x806b('0x2c')]['count'](_0x19dec7)['then'](function(_0x582277){_0x2d190b[_0x806b('0x1d')]=_0x582277;if(_0x30b8a5[_0x806b('0x32')][_0x806b('0x41')]){_0x4ed6df[_0x806b('0x42')]=[{'all':!![]}];}return db[_0x806b('0x2c')][_0x806b('0x43')](_0x4ed6df);})['then'](function(_0x7250fd){_0x2d190b[_0x806b('0x44')]=_0x7250fd;return _0x2d190b;})['then'](respondWithFilteredResult(_0xb18a70,_0x4ed6df))[_0x806b('0x45')](handleError(_0xb18a70,null));};exports[_0x806b('0x46')]=function(_0x4e8e9c,_0x348cec){var _0x4f8183={'raw':!![],'where':{'id':_0x4e8e9c['params']['id']}},_0x5f1eba={};_0x5f1eba['model']=_[_0x806b('0x33')](db[_0x806b('0x2c')]['rawAttributes']);_0x5f1eba[_0x806b('0x32')]=_[_0x806b('0x33')](_0x4e8e9c['query']);_0x5f1eba['filters']=_[_0x806b('0x35')](_0x5f1eba['model'],_0x5f1eba['query']);_0x4f8183[_0x806b('0x36')]=_[_0x806b('0x35')](_0x5f1eba['model'],qs['fields'](_0x4e8e9c['query'][_0x806b('0x37')]));_0x4f8183[_0x806b('0x36')]=_0x4f8183[_0x806b('0x36')][_0x806b('0x38')]?_0x4f8183['attributes']:_0x5f1eba['model'];if(_0x4e8e9c[_0x806b('0x32')][_0x806b('0x41')]){_0x4f8183['include']=[{'all':!![]}];}_0x4f8183=_[_0x806b('0x3f')]({},_0x4f8183,_0x4e8e9c[_0x806b('0x40')]);return db['FaxApplication'][_0x806b('0x47')](_0x4f8183)[_0x806b('0x25')](handleEntityNotFound(_0x348cec,null))[_0x806b('0x25')](respondWithResult(_0x348cec,null))[_0x806b('0x45')](handleError(_0x348cec,null));};exports[_0x806b('0x48')]=function(_0x5c5fa7,_0x688916){return db['FaxApplication'][_0x806b('0x48')](_0x5c5fa7[_0x806b('0x49')],{})[_0x806b('0x25')](respondWithResult(_0x688916,0xc9))[_0x806b('0x45')](handleError(_0x688916,null));};exports[_0x806b('0x24')]=function(_0x3c466d,_0x3dc63d){if(_0x3c466d[_0x806b('0x49')]['id']){delete _0x3c466d[_0x806b('0x49')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x3c466d[_0x806b('0x4a')]['id']}})[_0x806b('0x25')](handleEntityNotFound(_0x3dc63d,null))[_0x806b('0x25')](saveUpdates(_0x3c466d['body'],null))[_0x806b('0x25')](respondWithResult(_0x3dc63d,null))[_0x806b('0x45')](handleError(_0x3dc63d,null));};exports['destroy']=function(_0x748240,_0xd44ad2){return db[_0x806b('0x2c')][_0x806b('0x47')]({'where':{'id':_0x748240[_0x806b('0x4a')]['id']}})[_0x806b('0x25')](handleEntityNotFound(_0xd44ad2,null))[_0x806b('0x25')](removeEntity(_0xd44ad2,null))[_0x806b('0x45')](handleError(_0xd44ad2,null));}; \ No newline at end of file +var _0x4c9f=['rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','FaxApplication','fieldName','key','model','query','attributes','intersection','fields','length','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys'];(function(_0x558e1e,_0x3fd803){var _0x5ba193=function(_0x1c2975){while(--_0x1c2975){_0x558e1e['push'](_0x558e1e['shift']());}};_0x5ba193(++_0x3fd803);}(_0x4c9f,0x1d2));var _0xf4c9=function(_0x41a9ab,_0x488015){_0x41a9ab=_0x41a9ab-0x0;var _0x3682ae=_0x4c9f[_0x41a9ab];return _0x3682ae;};'use strict';var emlformat=require(_0xf4c9('0x0'));var rimraf=require(_0xf4c9('0x1'));var zipdir=require(_0xf4c9('0x2'));var jsonpatch=require(_0xf4c9('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf4c9('0x4'));var Mustache=require(_0xf4c9('0x5'));var util=require(_0xf4c9('0x6'));var path=require(_0xf4c9('0x7'));var sox=require(_0xf4c9('0x8'));var csv=require(_0xf4c9('0x9'));var ejs=require(_0xf4c9('0xa'));var fs=require('fs');var fs_extra=require(_0xf4c9('0xb'));var _=require(_0xf4c9('0xc'));var squel=require(_0xf4c9('0xd'));var crypto=require(_0xf4c9('0xe'));var jsforce=require(_0xf4c9('0xf'));var deskjs=require(_0xf4c9('0x10'));var toCsv=require(_0xf4c9('0x9'));var querystring=require('querystring');var Papa=require(_0xf4c9('0x11'));var Redis=require(_0xf4c9('0x12'));var authService=require(_0xf4c9('0x13'));var qs=require(_0xf4c9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf4c9('0x15'));var logger=require('../../config/logger')(_0xf4c9('0x16'));var utils=require(_0xf4c9('0x17'));var config=require(_0xf4c9('0x18'));var licenseUtil=require(_0xf4c9('0x19'));var db=require(_0xf4c9('0x1a'))['db'];function respondWithStatusCode(_0x10172a,_0x2c0c14){_0x2c0c14=_0x2c0c14||0xcc;return function(_0x2c48e5){if(_0x2c48e5){return _0x10172a['sendStatus'](_0x2c0c14);}return _0x10172a[_0xf4c9('0x1b')](_0x2c0c14)[_0xf4c9('0x1c')]();};}function respondWithResult(_0x4d5217,_0x3f9557){_0x3f9557=_0x3f9557||0xc8;return function(_0x73cdd6){if(_0x73cdd6){return _0x4d5217[_0xf4c9('0x1b')](_0x3f9557)[_0xf4c9('0x1d')](_0x73cdd6);}};}function respondWithFilteredResult(_0x2aba09,_0x591aef){return function(_0x2caad3){if(_0x2caad3){var _0x59a635=typeof _0x591aef[_0xf4c9('0x1e')]===_0xf4c9('0x1f')&&typeof _0x591aef[_0xf4c9('0x20')]===_0xf4c9('0x1f');var _0x164254=_0x2caad3[_0xf4c9('0x21')];var _0x23c20c=_0x59a635?0x0:_0x591aef['offset'];var _0x27bae6=_0x59a635?_0x2caad3[_0xf4c9('0x21')]:_0x591aef[_0xf4c9('0x1e')]+_0x591aef[_0xf4c9('0x20')];var _0x2c6cd0;if(_0x27bae6>=_0x164254){_0x27bae6=_0x164254;_0x2c6cd0=0xc8;}else{_0x2c6cd0=0xce;}_0x2aba09[_0xf4c9('0x1b')](_0x2c6cd0);return _0x2aba09[_0xf4c9('0x22')]('Content-Range',_0x23c20c+'-'+_0x27bae6+'/'+_0x164254)[_0xf4c9('0x1d')](_0x2caad3);}return null;};}function patchUpdates(_0x76c49a){return function(_0x36e624){try{jsonpatch[_0xf4c9('0x23')](_0x36e624,_0x76c49a,!![]);}catch(_0x2d85a7){return BPromise[_0xf4c9('0x24')](_0x2d85a7);}return _0x36e624[_0xf4c9('0x25')]();};}function saveUpdates(_0x161632,_0x53c7ec){return function(_0x19ba45){if(_0x19ba45){return _0x19ba45[_0xf4c9('0x26')](_0x161632)[_0xf4c9('0x27')](function(_0x701567){return _0x701567;});}return null;};}function removeEntity(_0x39e08a,_0x52315c){return function(_0x3ec50d){if(_0x3ec50d){return _0x3ec50d[_0xf4c9('0x28')]()['then'](function(){_0x39e08a[_0xf4c9('0x1b')](0xcc)[_0xf4c9('0x1c')]();});}};}function handleEntityNotFound(_0x4173da,_0x28a614){return function(_0x343d1a){if(!_0x343d1a){_0x4173da['sendStatus'](0x194);}return _0x343d1a;};}function handleError(_0x3425d9,_0x1af0e7){_0x1af0e7=_0x1af0e7||0x1f4;return function(_0x17a3c3){logger[_0xf4c9('0x29')](_0x17a3c3[_0xf4c9('0x2a')]);if(_0x17a3c3[_0xf4c9('0x2b')]){delete _0x17a3c3[_0xf4c9('0x2b')];}_0x3425d9[_0xf4c9('0x1b')](_0x1af0e7)['send'](_0x17a3c3);};}exports[_0xf4c9('0x2c')]=function(_0x4d60ce,_0x489c60){var _0x37f1af={},_0x2915c2={},_0x561b8b={'count':0x0,'rows':[]};var _0x13b857=_[_0xf4c9('0x2d')](db[_0xf4c9('0x2e')]['rawAttributes'],function(_0x45e3fe){return{'name':_0x45e3fe[_0xf4c9('0x2f')],'type':_0x45e3fe['type'][_0xf4c9('0x30')]};});_0x2915c2[_0xf4c9('0x31')]=_[_0xf4c9('0x2d')](_0x13b857,'name');_0x2915c2[_0xf4c9('0x32')]=_['keys'](_0x4d60ce[_0xf4c9('0x32')]);_0x2915c2['filters']=_['intersection'](_0x2915c2[_0xf4c9('0x31')],_0x2915c2[_0xf4c9('0x32')]);_0x37f1af[_0xf4c9('0x33')]=_[_0xf4c9('0x34')](_0x2915c2[_0xf4c9('0x31')],qs[_0xf4c9('0x35')](_0x4d60ce[_0xf4c9('0x32')][_0xf4c9('0x35')]));_0x37f1af[_0xf4c9('0x33')]=_0x37f1af[_0xf4c9('0x33')][_0xf4c9('0x36')]?_0x37f1af[_0xf4c9('0x33')]:_0x2915c2['model'];if(!_0x4d60ce[_0xf4c9('0x32')]['hasOwnProperty'](_0xf4c9('0x37'))){_0x37f1af[_0xf4c9('0x20')]=qs[_0xf4c9('0x20')](_0x4d60ce[_0xf4c9('0x32')][_0xf4c9('0x20')]);_0x37f1af[_0xf4c9('0x1e')]=qs[_0xf4c9('0x1e')](_0x4d60ce[_0xf4c9('0x32')]['offset']);}_0x37f1af['order']=qs[_0xf4c9('0x38')](_0x4d60ce[_0xf4c9('0x32')][_0xf4c9('0x38')]);_0x37f1af[_0xf4c9('0x39')]=qs[_0xf4c9('0x3a')](_[_0xf4c9('0x3b')](_0x4d60ce[_0xf4c9('0x32')],_0x2915c2[_0xf4c9('0x3a')]),_0x13b857);if(_0x4d60ce[_0xf4c9('0x32')][_0xf4c9('0x3c')]){_0x37f1af[_0xf4c9('0x39')]=_[_0xf4c9('0x3d')](_0x37f1af['where'],{'$or':_['map'](_0x13b857,function(_0x51dad0){if(_0x51dad0[_0xf4c9('0x3e')]!==_0xf4c9('0x3f')){var _0x31d621={};_0x31d621[_0x51dad0[_0xf4c9('0x2b')]]={'$like':'%'+_0x4d60ce[_0xf4c9('0x32')][_0xf4c9('0x3c')]+'%'};return _0x31d621;}})});}_0x37f1af=_[_0xf4c9('0x3d')]({},_0x37f1af,_0x4d60ce[_0xf4c9('0x40')]);var _0x4bde36={'where':_0x37f1af[_0xf4c9('0x39')]};return db['FaxApplication']['count'](_0x4bde36)[_0xf4c9('0x27')](function(_0x1c293a){_0x561b8b[_0xf4c9('0x21')]=_0x1c293a;if(_0x4d60ce[_0xf4c9('0x32')][_0xf4c9('0x41')]){_0x37f1af[_0xf4c9('0x42')]=[{'all':!![]}];}return db[_0xf4c9('0x2e')][_0xf4c9('0x43')](_0x37f1af);})['then'](function(_0x9d74f0){_0x561b8b[_0xf4c9('0x44')]=_0x9d74f0;return _0x561b8b;})['then'](respondWithFilteredResult(_0x489c60,_0x37f1af))[_0xf4c9('0x45')](handleError(_0x489c60,null));};exports[_0xf4c9('0x46')]=function(_0x24e6a0,_0x2b9f50){var _0x4bee51={'raw':!![],'where':{'id':_0x24e6a0[_0xf4c9('0x47')]['id']}},_0x40014b={};_0x40014b[_0xf4c9('0x31')]=_[_0xf4c9('0x48')](db[_0xf4c9('0x2e')][_0xf4c9('0x49')]);_0x40014b[_0xf4c9('0x32')]=_[_0xf4c9('0x48')](_0x24e6a0[_0xf4c9('0x32')]);_0x40014b[_0xf4c9('0x3a')]=_[_0xf4c9('0x34')](_0x40014b[_0xf4c9('0x31')],_0x40014b[_0xf4c9('0x32')]);_0x4bee51[_0xf4c9('0x33')]=_['intersection'](_0x40014b[_0xf4c9('0x31')],qs[_0xf4c9('0x35')](_0x24e6a0[_0xf4c9('0x32')]['fields']));_0x4bee51[_0xf4c9('0x33')]=_0x4bee51[_0xf4c9('0x33')]['length']?_0x4bee51[_0xf4c9('0x33')]:_0x40014b[_0xf4c9('0x31')];if(_0x24e6a0['query'][_0xf4c9('0x41')]){_0x4bee51[_0xf4c9('0x42')]=[{'all':!![]}];}_0x4bee51=_['merge']({},_0x4bee51,_0x24e6a0[_0xf4c9('0x40')]);return db[_0xf4c9('0x2e')][_0xf4c9('0x4a')](_0x4bee51)['then'](handleEntityNotFound(_0x2b9f50,null))['then'](respondWithResult(_0x2b9f50,null))[_0xf4c9('0x45')](handleError(_0x2b9f50,null));};exports[_0xf4c9('0x4b')]=function(_0x6da2db,_0x43b948){return db[_0xf4c9('0x2e')][_0xf4c9('0x4b')](_0x6da2db[_0xf4c9('0x4c')],{})[_0xf4c9('0x27')](respondWithResult(_0x43b948,0xc9))['catch'](handleError(_0x43b948,null));};exports[_0xf4c9('0x26')]=function(_0x11dd5a,_0x541692){if(_0x11dd5a[_0xf4c9('0x4c')]['id']){delete _0x11dd5a[_0xf4c9('0x4c')]['id'];}return db[_0xf4c9('0x2e')][_0xf4c9('0x4a')]({'where':{'id':_0x11dd5a['params']['id']}})[_0xf4c9('0x27')](handleEntityNotFound(_0x541692,null))[_0xf4c9('0x27')](saveUpdates(_0x11dd5a[_0xf4c9('0x4c')],null))[_0xf4c9('0x27')](respondWithResult(_0x541692,null))[_0xf4c9('0x45')](handleError(_0x541692,null));};exports[_0xf4c9('0x28')]=function(_0x37365b,_0x29037a){return db[_0xf4c9('0x2e')][_0xf4c9('0x4a')]({'where':{'id':_0x37365b[_0xf4c9('0x47')]['id']}})['then'](handleEntityNotFound(_0x29037a,null))['then'](removeEntity(_0x29037a,null))[_0xf4c9('0x45')](handleError(_0x29037a,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 2616779..0f5e4d2 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 _0xccb5=['define','FaxApplication','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./faxApplication.attributes','exports'];(function(_0x511bd1,_0x223e5b){var _0x4c48ec=function(_0x31814e){while(--_0x31814e){_0x511bd1['push'](_0x511bd1['shift']());}};_0x4c48ec(++_0x223e5b);}(_0xccb5,0x1ca));var _0x5ccb=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xccb5[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x5ccb('0x0'));var util=require(_0x5ccb('0x1'));var logger=require('../../config/logger')(_0x5ccb('0x2'));var moment=require(_0x5ccb('0x3'));var BPromise=require(_0x5ccb('0x4'));var rp=require(_0x5ccb('0x5'));var fs=require('fs');var path=require(_0x5ccb('0x6'));var rimraf=require('rimraf');var config=require(_0x5ccb('0x7'));var attributes=require(_0x5ccb('0x8'));module[_0x5ccb('0x9')]=function(_0x5142fd,_0x553e5a){return _0x5142fd[_0x5ccb('0xa')](_0x5ccb('0xb'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x16b8=['request-promise','rimraf','../../config/environment','exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x58ad1d,_0xefa109){var _0x57c158=function(_0x5c85af){while(--_0x5c85af){_0x58ad1d['push'](_0x58ad1d['shift']());}};_0x57c158(++_0xefa109);}(_0x16b8,0x126));var _0x816b=function(_0x5db0fc,_0x1702bf){_0x5db0fc=_0x5db0fc-0x0;var _0x1cdcf1=_0x16b8[_0x5db0fc];return _0x1cdcf1;};'use strict';var _=require(_0x816b('0x0'));var util=require(_0x816b('0x1'));var logger=require(_0x816b('0x2'))(_0x816b('0x3'));var moment=require('moment');var BPromise=require(_0x816b('0x4'));var rp=require(_0x816b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x816b('0x6'));var config=require(_0x816b('0x7'));var attributes=require('./faxApplication.attributes');module[_0x816b('0x8')]=function(_0x177914,_0x4c5019){return _0x177914[_0x816b('0x9')]('FaxApplication',attributes,{'tableName':_0x816b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x816b('0xb'),'collate':_0x816b('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 4ce38c3..117de83 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 _0xc159=['limit','stringify','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes'];(function(_0x3c882c,_0x46076e){var _0x2fc329=function(_0x1eb5cf){while(--_0x1eb5cf){_0x3c882c['push'](_0x3c882c['shift']());}};_0x2fc329(++_0x46076e);}(_0xc159,0x1a6));var _0x9c15=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0xc159[_0x3f5dca];return _0x5b833a;};'use strict';var _=require(_0x9c15('0x0'));var util=require(_0x9c15('0x1'));var moment=require('moment');var BPromise=require(_0x9c15('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c15('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9c15('0x4'))(_0x9c15('0x5'));var config=require(_0x9c15('0x6'));var jayson=require(_0x9c15('0x7'));var client=jayson[_0x9c15('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x684eb,_0x466e4f,_0x247c04){return new BPromise(function(_0x3dc02e,_0x25f3a4){return client[_0x9c15('0x9')](_0x684eb,_0x247c04)[_0x9c15('0xa')](function(_0x525e4e){logger['info'](_0x9c15('0xb'),_0x466e4f,_0x9c15('0xc'));logger['debug'](_0x9c15('0xd'),_0x466e4f,_0x9c15('0xc'),JSON['stringify'](_0x525e4e));if(_0x525e4e[_0x9c15('0xe')]){if(_0x525e4e[_0x9c15('0xe')][_0x9c15('0xf')]===0x1f4){logger[_0x9c15('0xe')](_0x9c15('0xb'),_0x466e4f,_0x525e4e['error'][_0x9c15('0x10')]);return _0x25f3a4(_0x525e4e['error'][_0x9c15('0x10')]);}logger[_0x9c15('0xe')](_0x9c15('0xb'),_0x466e4f,_0x525e4e[_0x9c15('0xe')][_0x9c15('0x10')]);return _0x3dc02e(_0x525e4e[_0x9c15('0xe')][_0x9c15('0x10')]);}else{logger[_0x9c15('0x11')](_0x9c15('0xb'),_0x466e4f,'request\x20sent');_0x3dc02e(_0x525e4e[_0x9c15('0x12')][_0x9c15('0x10')]);}})[_0x9c15('0x13')](function(_0x28d2d2){logger['error'](_0x9c15('0xb'),_0x466e4f,_0x28d2d2);_0x25f3a4(_0x28d2d2);});});}exports[_0x9c15('0x14')]=function(_0x2fae16){var _0x5751d7=this;return new Promise(function(_0x54cb5d,_0x268dec){return db[_0x9c15('0x15')][_0x9c15('0x16')](_0x2fae16[_0x9c15('0x17')],{'raw':_0x2fae16[_0x9c15('0x18')]?_0x2fae16['options'][_0x9c15('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fae16['options']?_0x2fae16['options'][_0x9c15('0x1a')]||null:null,'attributes':_0x2fae16['options']?_0x2fae16[_0x9c15('0x18')][_0x9c15('0x1b')]||null:null,'limit':_0x2fae16[_0x9c15('0x18')]?_0x2fae16['options'][_0x9c15('0x1c')]||null:null})[_0x9c15('0xa')](function(_0x45c6f1){logger[_0x9c15('0x11')]('UpdateFaxApplication',_0x2fae16);logger['debug'](_0x9c15('0x14'),_0x2fae16,JSON[_0x9c15('0x1d')](_0x45c6f1));_0x54cb5d(_0x45c6f1);})['catch'](function(_0x3ac48a){logger[_0x9c15('0xe')](_0x9c15('0x14'),_0x3ac48a['message'],_0x2fae16);_0x268dec(_0x5751d7['error'](0x1f4,_0x3ac48a[_0x9c15('0x10')]));});});}; \ No newline at end of file +var _0xd406=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxApplication','body','options','limit','UpdateFaxApplication','debug','lodash'];(function(_0x47ed69,_0x371e69){var _0x538158=function(_0x2ac7e8){while(--_0x2ac7e8){_0x47ed69['push'](_0x47ed69['shift']());}};_0x538158(++_0x371e69);}(_0xd406,0x90));var _0x6d40=function(_0x2f5b77,_0x3b8e0c){_0x2f5b77=_0x2f5b77-0x0;var _0x3d48fc=_0xd406[_0x2f5b77];return _0x3d48fc;};'use strict';var _=require(_0x6d40('0x0'));var util=require(_0x6d40('0x1'));var moment=require(_0x6d40('0x2'));var BPromise=require('bluebird');var rs=require(_0x6d40('0x3'));var fs=require('fs');var Redis=require(_0x6d40('0x4'));var db=require(_0x6d40('0x5'))['db'];var utils=require(_0x6d40('0x6'));var logger=require(_0x6d40('0x7'))('rpc');var config=require(_0x6d40('0x8'));var jayson=require(_0x6d40('0x9'));var client=jayson[_0x6d40('0xa')][_0x6d40('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5aa973,_0x23f6fd,_0x598bc6){return new BPromise(function(_0x5bdeac,_0x5419d9){return client[_0x6d40('0xc')](_0x5aa973,_0x598bc6)['then'](function(_0x2929cc){logger[_0x6d40('0xd')](_0x6d40('0xe'),_0x23f6fd,_0x6d40('0xf'));logger['debug'](_0x6d40('0x10'),_0x23f6fd,_0x6d40('0xf'),JSON[_0x6d40('0x11')](_0x2929cc));if(_0x2929cc['error']){if(_0x2929cc[_0x6d40('0x12')][_0x6d40('0x13')]===0x1f4){logger[_0x6d40('0x12')](_0x6d40('0xe'),_0x23f6fd,_0x2929cc[_0x6d40('0x12')][_0x6d40('0x14')]);return _0x5419d9(_0x2929cc[_0x6d40('0x12')][_0x6d40('0x14')]);}logger['error'](_0x6d40('0xe'),_0x23f6fd,_0x2929cc['error']['message']);return _0x5bdeac(_0x2929cc[_0x6d40('0x12')][_0x6d40('0x14')]);}else{logger[_0x6d40('0xd')](_0x6d40('0xe'),_0x23f6fd,'request\x20sent');_0x5bdeac(_0x2929cc[_0x6d40('0x15')][_0x6d40('0x14')]);}})[_0x6d40('0x16')](function(_0x458c5c){logger[_0x6d40('0x12')](_0x6d40('0xe'),_0x23f6fd,_0x458c5c);_0x5419d9(_0x458c5c);});});}exports['UpdateFaxApplication']=function(_0x4bb8e0){var _0x133e47=this;return new Promise(function(_0x29237f,_0x42e788){return db[_0x6d40('0x17')]['update'](_0x4bb8e0[_0x6d40('0x18')],{'raw':_0x4bb8e0['options']?_0x4bb8e0[_0x6d40('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bb8e0[_0x6d40('0x19')]?_0x4bb8e0[_0x6d40('0x19')]['where']||null:null,'attributes':_0x4bb8e0[_0x6d40('0x19')]?_0x4bb8e0[_0x6d40('0x19')]['attributes']||null:null,'limit':_0x4bb8e0[_0x6d40('0x19')]?_0x4bb8e0[_0x6d40('0x19')][_0x6d40('0x1a')]||null:null})['then'](function(_0x130926){logger[_0x6d40('0xd')](_0x6d40('0x1b'),_0x4bb8e0);logger[_0x6d40('0x1c')](_0x6d40('0x1b'),_0x4bb8e0,JSON[_0x6d40('0x11')](_0x130926));_0x29237f(_0x130926);})[_0x6d40('0x16')](function(_0x49f9a0){logger[_0x6d40('0x12')]('UpdateFaxApplication',_0x49f9a0[_0x6d40('0x14')],_0x4bb8e0);_0x42e788(_0x133e47[_0x6d40('0x12')](0x1f4,_0x49f9a0[_0x6d40('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 7d562aa..a0dccc8 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 _0x34b7=['express','Router','fs-extra','../../components/auth/service','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','path','connect-timeout'];(function(_0x27d1cf,_0x4cc473){var _0x4b3d38=function(_0x238f81){while(--_0x238f81){_0x27d1cf['push'](_0x27d1cf['shift']());}};_0x4b3d38(++_0x4cc473);}(_0x34b7,0x196));var _0x734b=function(_0x495c52,_0x53c0cc){_0x495c52=_0x495c52-0x0;var _0x2b4bb2=_0x34b7[_0x495c52];return _0x2b4bb2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x734b('0x0'));var timeout=require(_0x734b('0x1'));var express=require(_0x734b('0x2'));var router=express[_0x734b('0x3')]();var fs_extra=require(_0x734b('0x4'));var auth=require(_0x734b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x734b('0x6'));router[_0x734b('0x7')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x9')]);router[_0x734b('0x7')](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xb')]);router[_0x734b('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xd')]);router[_0x734b('0xe')](_0x734b('0xa'),auth[_0x734b('0x8')](),controller[_0x734b('0xf')]);module[_0x734b('0x10')]=router; \ No newline at end of file +var _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./faxApplication.controller'];(function(_0x1d8f4c,_0xc90b78){var _0x224b44=function(_0x31db61){while(--_0x31db61){_0x1d8f4c['push'](_0x1d8f4c['shift']());}};_0x224b44(++_0xc90b78);}(_0x14a0,0x8e));var _0x014a=function(_0x2131e7,_0x1e6729){_0x2131e7=_0x2131e7-0x0;var _0x44f695=_0x14a0[_0x2131e7];return _0x44f695;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x014a('0xd')]('/:id',auth[_0x014a('0x9')](),controller[_0x014a('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index a5b7c9f..725dca3 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 _0x181e=['STRING','ENUM','sequelize','BOOLEAN','DATE'];(function(_0x504803,_0x2f1bf3){var _0xc65bba=function(_0x4ba165){while(--_0x4ba165){_0x504803['push'](_0x504803['shift']());}};_0xc65bba(++_0x2f1bf3);}(_0x181e,0x66));var _0xe181=function(_0x532e5a,_0x1a223c){_0x532e5a=_0x532e5a-0x0;var _0x8967ea=_0x181e[_0x532e5a];return _0x8967ea;};'use strict';var Sequelize=require(_0xe181('0x0'));module['exports']={'closed':{'type':Sequelize[_0xe181('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe181('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xe181('0x3')]},'thirdDisposition':{'type':Sequelize[_0xe181('0x3')]},'note':{'type':Sequelize[_0xe181('0x3')]},'read1stAt':{'type':Sequelize[_0xe181('0x2')]},'fax':{'type':Sequelize[_0xe181('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe181('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe181('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xe181('0x4')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xbe9a=['BOOLEAN','DATE','STRING','ENUM','out','exports'];(function(_0x3055ab,_0x4d1f74){var _0x31d336=function(_0x207a6a){while(--_0x207a6a){_0x3055ab['push'](_0x3055ab['shift']());}};_0x31d336(++_0x4d1f74);}(_0xbe9a,0xa1));var _0xabe9=function(_0x551f62,_0x43f876){_0x551f62=_0x551f62-0x0;var _0x125fbf=_0xbe9a[_0x551f62];return _0x125fbf;};'use strict';var Sequelize=require('sequelize');module[_0xabe9('0x0')]={'closed':{'type':Sequelize[_0xabe9('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xabe9('0x2')]},'disposition':{'type':Sequelize[_0xabe9('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xabe9('0x3')]},'note':{'type':Sequelize[_0xabe9('0x3')]},'read1stAt':{'type':Sequelize[_0xabe9('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xabe9('0x4')]('in',_0xabe9('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xabe9('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xabe9('0x4')]('in',_0xabe9('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 b588f05..8965f42 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 _0xcfcd=['spread','Tag','color','emit','removeTags','download','unix','toString','server','tmp','files','transcript-%d-%s.zip','join','Attachment','Messages','createdAt','basename','existsSync','createReadStream','createWriteStream','resolve','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','then','error','stack','name','send','index','FaxInteraction','rawAttributes','fieldName','type','fax','user','catch','show','params','keys','query','filters','model','attributes','intersection','fields','includeAll','include','merge','options','find','create','body','update','destroy','describe','ids','omit','getMessages','findOne','FaxMessage','hasOwnProperty','nolimit','order','where','pick','FaxInteractionId','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows'];(function(_0x5bfc2e,_0x19844b){var _0x5f5472=function(_0x2a522b){while(--_0x2a522b){_0x5bfc2e['push'](_0x5bfc2e['shift']());}};_0x5f5472(++_0x19844b);}(_0xcfcd,0x7c));var _0xdcfc=function(_0x1babf2,_0x1b369a){_0x1babf2=_0x1babf2-0x0;var _0x1d1be9=_0xcfcd[_0x1babf2];return _0x1d1be9;};'use strict';var rimraf=require(_0xdcfc('0x0'));var zipdir=require(_0xdcfc('0x1'));var moment=require(_0xdcfc('0x2'));var BPromise=require(_0xdcfc('0x3'));var util=require(_0xdcfc('0x4'));var path=require(_0xdcfc('0x5'));var fs=require('fs');var _=require(_0xdcfc('0x6'));var Redis=require(_0xdcfc('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0xdcfc('0x8'));var logger=require('../../config/logger')('api');var config=require(_0xdcfc('0x9'));var db=require('../../mysqldb')['db'];config[_0xdcfc('0xa')]=_[_0xdcfc('0xb')](config['redis'],{'host':_0xdcfc('0xc'),'port':0x18eb});var socket=require(_0xdcfc('0xd'))(new Redis(config[_0xdcfc('0xa')]));require(_0xdcfc('0xe'))[_0xdcfc('0xf')](socket);function respondWithStatusCode(_0xfc997c,_0xe800f0){_0xe800f0=_0xe800f0||0xcc;return function(_0x5e7365){if(_0x5e7365){return _0xfc997c[_0xdcfc('0x10')](_0xe800f0);}return _0xfc997c['status'](_0xe800f0)[_0xdcfc('0x11')]();};}function respondWithResult(_0x557a1a,_0x4f6688){_0x4f6688=_0x4f6688||0xc8;return function(_0x1e7d5a){if(_0x1e7d5a){return _0x557a1a[_0xdcfc('0x12')](_0x4f6688)['json'](_0x1e7d5a);}};}function respondWithFilteredResult(_0x20eb71,_0x192307){return function(_0x38a893){if(_0x38a893){var _0x5d9f26=typeof _0x192307[_0xdcfc('0x13')]===_0xdcfc('0x14')&&typeof _0x192307[_0xdcfc('0x15')]==='undefined';var _0x1fdb13=_0x38a893[_0xdcfc('0x16')];var _0x1262e0=_0x5d9f26?0x0:_0x192307[_0xdcfc('0x13')];var _0x1f0041=_0x5d9f26?_0x38a893[_0xdcfc('0x16')]:_0x192307[_0xdcfc('0x13')]+_0x192307['limit'];var _0x149515;if(_0x1f0041>=_0x1fdb13){_0x1f0041=_0x1fdb13;_0x149515=0xc8;}else{_0x149515=0xce;}_0x20eb71[_0xdcfc('0x12')](_0x149515);return _0x20eb71[_0xdcfc('0x17')](_0xdcfc('0x18'),_0x1262e0+'-'+_0x1f0041+'/'+_0x1fdb13)[_0xdcfc('0x19')](_0x38a893);}return null;};}function saveUpdates(_0x3965c4){return function(_0x1e6d5a){if(_0x1e6d5a){return _0x1e6d5a['update'](_0x3965c4)[_0xdcfc('0x1a')](function(_0x1987a3){return _0x1987a3;});}return null;};}function removeEntity(_0xe00665){return function(_0x21d57b){if(_0x21d57b){return _0x21d57b['destroy']()['then'](function(){_0xe00665[_0xdcfc('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f7555){return function(_0x134392){if(!_0x134392){_0x1f7555[_0xdcfc('0x10')](0x194);}return _0x134392;};}function handleError(_0x353619,_0x48c9e7){_0x48c9e7=_0x48c9e7||0x1f4;return function(_0x2f2b9f){logger[_0xdcfc('0x1b')](_0x2f2b9f[_0xdcfc('0x1c')]);if(_0x2f2b9f[_0xdcfc('0x1d')]){delete _0x2f2b9f[_0xdcfc('0x1d')];}_0x353619['status'](_0x48c9e7)[_0xdcfc('0x1e')](_0x2f2b9f);};}exports[_0xdcfc('0x1f')]=function(_0x2e5ecd,_0x1f16f4){var _0xd7e131={};var _0x292511=_['map'](db[_0xdcfc('0x20')][_0xdcfc('0x21')],function(_0x3f8593){return{'name':_0x3f8593[_0xdcfc('0x22')],'type':_0x3f8593[_0xdcfc('0x23')]['key']};});_0xd7e131=qs['getOptions'](_0x292511,_0x2e5ecd);return interaction['findAll'](_0xdcfc('0x24'),_0x2e5ecd['query'],_0x2e5ecd[_0xdcfc('0x25')],_0xd7e131,_0x292511)[_0xdcfc('0x1a')](respondWithFilteredResult(_0x1f16f4,_0xd7e131))[_0xdcfc('0x26')](handleError(_0x1f16f4,null));};exports[_0xdcfc('0x27')]=function(_0x5f4c2a,_0x371420){var _0x112e0e={'raw':![],'where':{'id':_0x5f4c2a[_0xdcfc('0x28')]['id']}},_0x323287={};_0x323287['model']=_[_0xdcfc('0x29')](db[_0xdcfc('0x20')][_0xdcfc('0x21')]);_0x323287[_0xdcfc('0x2a')]=_[_0xdcfc('0x29')](_0x5f4c2a[_0xdcfc('0x2a')]);_0x323287[_0xdcfc('0x2b')]=_['intersection'](_0x323287[_0xdcfc('0x2c')],_0x323287['query']);_0x112e0e[_0xdcfc('0x2d')]=_[_0xdcfc('0x2e')](_0x323287['model'],qs['fields'](_0x5f4c2a['query'][_0xdcfc('0x2f')]));_0x112e0e[_0xdcfc('0x2d')]=_0x112e0e['attributes']['length']?_0x112e0e[_0xdcfc('0x2d')]:_0x323287['model'];if(_0x5f4c2a[_0xdcfc('0x2a')][_0xdcfc('0x30')]){_0x112e0e[_0xdcfc('0x31')]=[{'all':!![]}];}_0x112e0e=_[_0xdcfc('0x32')]({},_0x112e0e,_0x5f4c2a[_0xdcfc('0x33')]);return db[_0xdcfc('0x20')][_0xdcfc('0x34')](_0x112e0e)[_0xdcfc('0x1a')](handleEntityNotFound(_0x371420,null))['then'](respondWithResult(_0x371420,null))[_0xdcfc('0x26')](handleError(_0x371420,null));};exports[_0xdcfc('0x35')]=function(_0x4c700b,_0xef1b79){return db[_0xdcfc('0x20')][_0xdcfc('0x35')](_0x4c700b[_0xdcfc('0x36')],{})[_0xdcfc('0x1a')](respondWithResult(_0xef1b79,0xc9))[_0xdcfc('0x26')](handleError(_0xef1b79,null));};exports[_0xdcfc('0x37')]=function(_0x3ebf65,_0x1502ea){if(_0x3ebf65[_0xdcfc('0x36')]['id']){delete _0x3ebf65[_0xdcfc('0x36')]['id'];}return db[_0xdcfc('0x20')][_0xdcfc('0x34')]({'where':{'id':_0x3ebf65[_0xdcfc('0x28')]['id']}})[_0xdcfc('0x1a')](handleEntityNotFound(_0x1502ea,null))[_0xdcfc('0x1a')](saveUpdates(_0x3ebf65['body'],null))[_0xdcfc('0x1a')](respondWithResult(_0x1502ea,null))[_0xdcfc('0x26')](handleError(_0x1502ea,null));};exports[_0xdcfc('0x38')]=function(_0x1bb897,_0x102663){return db[_0xdcfc('0x20')]['find']({'where':{'id':_0x1bb897[_0xdcfc('0x28')]['id']}})['then'](handleEntityNotFound(_0x102663,null))[_0xdcfc('0x1a')](removeEntity(_0x102663,null))[_0xdcfc('0x26')](handleError(_0x102663,null));};exports[_0xdcfc('0x39')]=function(_0x1e515c,_0x1ac63d){return db[_0xdcfc('0x20')][_0xdcfc('0x39')]()[_0xdcfc('0x1a')](respondWithResult(_0x1ac63d,null))[_0xdcfc('0x26')](handleError(_0x1ac63d,null));};exports['addMessage']=function(_0x430707,_0xbccafc){return db['FaxMessage']['find']({'where':{'id':_0x430707['params']['id']}})[_0xdcfc('0x1a')](handleEntityNotFound(_0xbccafc,null))[_0xdcfc('0x1a')](function(_0x27fe12){if(_0x27fe12){return _0x27fe12['addMessage'](_0x430707[_0xdcfc('0x36')][_0xdcfc('0x3a')],_[_0xdcfc('0x3b')](_0x430707[_0xdcfc('0x36')],[_0xdcfc('0x3a'),'id'])||{});}})[_0xdcfc('0x1a')](respondWithResult(_0xbccafc,null))[_0xdcfc('0x26')](handleError(_0xbccafc,null));};exports[_0xdcfc('0x3c')]=function(_0x392333,_0x2dd992){var _0x5948a3={'raw':![],'where':{}};var _0x2d0408={};var _0x302dca={'count':0x0,'rows':[]};return db[_0xdcfc('0x20')][_0xdcfc('0x3d')]({'where':{'id':_0x392333['params']['id']}})[_0xdcfc('0x1a')](handleEntityNotFound(_0x2dd992,null))['then'](function(_0xc81cd0){if(_0xc81cd0){_0x2d0408[_0xdcfc('0x2c')]=_[_0xdcfc('0x29')](db[_0xdcfc('0x3e')][_0xdcfc('0x21')]);_0x2d0408[_0xdcfc('0x2a')]=_[_0xdcfc('0x29')](_0x392333['query']);_0x2d0408[_0xdcfc('0x2b')]=_[_0xdcfc('0x2e')](_0x2d0408[_0xdcfc('0x2c')],_0x2d0408[_0xdcfc('0x2a')]);_0x5948a3[_0xdcfc('0x2d')]=_[_0xdcfc('0x2e')](_0x2d0408[_0xdcfc('0x2c')],qs[_0xdcfc('0x2f')](_0x392333[_0xdcfc('0x2a')][_0xdcfc('0x2f')]));_0x5948a3[_0xdcfc('0x2d')]=_0x5948a3[_0xdcfc('0x2d')]['length']?_0x5948a3[_0xdcfc('0x2d')]:_0x2d0408['model'];if(!_0x392333[_0xdcfc('0x2a')][_0xdcfc('0x3f')](_0xdcfc('0x40'))){_0x5948a3[_0xdcfc('0x15')]=qs[_0xdcfc('0x15')](_0x392333[_0xdcfc('0x2a')][_0xdcfc('0x15')]);_0x5948a3['offset']=qs[_0xdcfc('0x13')](_0x392333['query'][_0xdcfc('0x13')]);}_0x5948a3[_0xdcfc('0x41')]=qs['sort'](_0x392333[_0xdcfc('0x2a')]['sort']);_0x5948a3[_0xdcfc('0x42')]=qs['filters'](_[_0xdcfc('0x43')](_0x392333[_0xdcfc('0x2a')],_0x2d0408[_0xdcfc('0x2b')]));_0x5948a3[_0xdcfc('0x42')][_0xdcfc('0x44')]=_0xc81cd0['id'];if(_0x392333['query']['filter']){_0x5948a3[_0xdcfc('0x42')]=_[_0xdcfc('0x32')](_0x5948a3[_0xdcfc('0x42')],{'$or':_[_0xdcfc('0x45')](_0x5948a3['attributes'],function(_0x497112){var _0x3f1cd6={};_0x3f1cd6[_0x497112]={'$like':'%'+_0x392333[_0xdcfc('0x2a')]['filter']+'%'};return _0x3f1cd6;})});}if(_0x392333[_0xdcfc('0x2a')][_0xdcfc('0x46')]){var _0x38060e=_0x392333[_0xdcfc('0x2a')][_0xdcfc('0x46')][_0xdcfc('0x47')](',');var _0x37b11d={};_0x37b11d[_0x38060e[0x0]]={'$gte':moment(_0x38060e[0x1])[_0xdcfc('0x48')](_0xdcfc('0x49'))};_0x5948a3['where']=_['merge'](_0x5948a3[_0xdcfc('0x42')],_0x37b11d);}_0x5948a3=_['merge']({},_0x5948a3,_0x392333[_0xdcfc('0x33')]);return db['FaxMessage']['count']({'where':_0x5948a3['where']})[_0xdcfc('0x1a')](function(_0x3cae7e){_0x302dca[_0xdcfc('0x16')]=_0x3cae7e;if(_0x392333[_0xdcfc('0x2a')][_0xdcfc('0x30')]){_0x5948a3[_0xdcfc('0x31')]=[{'all':!![]}];}return db[_0xdcfc('0x3e')][_0xdcfc('0x4a')](_0x5948a3);})['then'](function(_0x79a317){_0x302dca[_0xdcfc('0x4b')]=_0x79a317;return _0x302dca;});}})['then'](respondWithFilteredResult(_0x2dd992,_0x5948a3))[_0xdcfc('0x26')](handleError(_0x2dd992,null));};exports['addTags']=function(_0x3aab23,_0x1a6f4f){return db['FaxInteraction']['find']({'where':{'id':_0x3aab23[_0xdcfc('0x28')]['id']}})[_0xdcfc('0x1a')](handleEntityNotFound(_0x1a6f4f,null))['then'](function(_0x52ebfb){if(_0x52ebfb){return _0x52ebfb['setTags'](_0x3aab23[_0xdcfc('0x36')][_0xdcfc('0x3a')],_['omit'](_0x3aab23[_0xdcfc('0x36')],[_0xdcfc('0x3a'),'id'])||{})[_0xdcfc('0x4c')](function(){return db[_0xdcfc('0x4d')][_0xdcfc('0x4a')]({'attributes':['id','name',_0xdcfc('0x4e')],'where':{'id':_0x3aab23[_0xdcfc('0x36')][_0xdcfc('0x3a')]}});})[_0xdcfc('0x1a')](function(_0x1b124d){socket[_0xdcfc('0x4f')]('faxInteractionTags:save',{'id':Number(_0x3aab23['params']['id']),'tags':_0x1b124d||[]});return{'id':Number(_0x3aab23['params']['id']),'tags':_0x1b124d||[]};});}})[_0xdcfc('0x1a')](respondWithResult(_0x1a6f4f,null))[_0xdcfc('0x26')](handleError(_0x1a6f4f,null));};exports[_0xdcfc('0x50')]=function(_0x3ff4c0,_0x523a78){return db[_0xdcfc('0x20')][_0xdcfc('0x34')]({'where':{'id':_0x3ff4c0[_0xdcfc('0x28')]['id']}})['then'](handleEntityNotFound(_0x523a78,null))[_0xdcfc('0x1a')](function(_0x24bb28){if(_0x24bb28){return _0x24bb28[_0xdcfc('0x50')](_0x3ff4c0[_0xdcfc('0x2a')][_0xdcfc('0x3a')]);}})['then'](respondWithStatusCode(_0x523a78,null))[_0xdcfc('0x26')](handleError(_0x523a78,null));};exports[_0xdcfc('0x51')]=function(_0x215c32,_0x35a72e){var _0x24e88c=moment()[_0xdcfc('0x52')]()[_0xdcfc('0x53')]();var _0x324185=path['join'](config['root'],_0xdcfc('0x54'),'files',_0xdcfc('0x55'));var _0x19b0b4=path['join'](config['root'],'server',_0xdcfc('0x56'),'attachments');var _0x52c7a3=path['join'](_0x324185,_0x24e88c);var _0x2f0534=util[_0xdcfc('0x48')](_0xdcfc('0x57'),_0x215c32['params']['id'],_0x24e88c);var _0x514906=path[_0xdcfc('0x58')](_0x324185,_0x2f0534);var _0x50cf75=[];_0x50cf75['push']({'model':db[_0xdcfc('0x59')],'as':_0xdcfc('0x59'),'raw':!![]});var _0x46f789=[{'model':db[_0xdcfc('0x3e')],'as':_0xdcfc('0x5a'),'attributes':['id','body',_0xdcfc('0x5b')],'include':_0x50cf75}];return db[_0xdcfc('0x20')]['find']({'where':{'id':_0x215c32['params']['id']},'include':_0x46f789})[_0xdcfc('0x1a')](handleEntityNotFound(_0x35a72e,null))[_0xdcfc('0x1a')](function(_0x319af){if(_0x319af&&_0x319af['Messages']){var _0x50ef98=_0x319af['get']({'plain':!![]});fs['mkdirSync'](_0x52c7a3);for(var _0x4f8e44=0x0;_0x4f8e44<_0x50ef98[_0xdcfc('0x5a')]['length'];_0x4f8e44++){var _0x417c92=_0x50ef98['Messages'][_0x4f8e44][_0xdcfc('0x59')];if(_0x417c92){var _0x127328=path[_0xdcfc('0x58')](_0x19b0b4,_0x417c92[_0xdcfc('0x5c')]);if(fs[_0xdcfc('0x5d')](_0x127328)){fs[_0xdcfc('0x5e')](_0x127328)['pipe'](fs[_0xdcfc('0x5f')](path[_0xdcfc('0x58')](_0x52c7a3,_0x417c92[_0xdcfc('0x5c')])));}}}return BPromise[_0xdcfc('0x60')]()[_0xdcfc('0x1a')](function(){return new BPromise(function(_0x132734,_0x25e792){zipdir(_0x52c7a3,{'saveTo':_0x514906},function(_0xdb4c2c,_0x172645){if(_0xdb4c2c)return _0x25e792(_0xdb4c2c);return _0x132734(_0x172645);});})[_0xdcfc('0x1a')](function(){return new BPromise(function(_0xe72325,_0x38c42a){rimraf(_0x52c7a3,function(_0x515822){if(_0x515822)_0x38c42a(_0x515822);return _0xe72325();});});})[_0xdcfc('0x1a')](function(){return _0x35a72e[_0xdcfc('0x51')](_0x514906,_0x2f0534,function(_0x525143){if(_0x525143){console[_0xdcfc('0x61')](_0xdcfc('0x62'),_0x525143);}else{fs[_0xdcfc('0x63')](_0x514906);}});});});}else{return _0x35a72e[_0xdcfc('0x10')](0xc8);}})['catch'](handleError(_0x35a72e,null));}; \ No newline at end of file +var _0x1713=['order','sort','where','pick','FaxInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','rows','setTags','spread','Tag','color','faxInteractionTags:save','removeTags','download','unix','toString','join','root','tmp','server','attachments','format','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createWriteStream','resolve','log','unlinkSync','rimraf','zip-dir','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','status','json','undefined','limit','count','Content-Range','update','then','destroy','sendStatus','stack','name','index','FaxInteraction','rawAttributes','fieldName','key','getOptions','findAll','query','user','show','params','model','keys','intersection','attributes','fields','length','includeAll','include','merge','find','catch','create','body','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','filters','hasOwnProperty','nolimit','offset'];(function(_0x1e393b,_0x355f6b){var _0x3d0bfe=function(_0x320830){while(--_0x320830){_0x1e393b['push'](_0x1e393b['shift']());}};_0x3d0bfe(++_0x355f6b);}(_0x1713,0x152));var _0x3171=function(_0x3f34a3,_0x5476d6){_0x3f34a3=_0x3f34a3-0x0;var _0x39b8ab=_0x1713[_0x3f34a3];return _0x39b8ab;};'use strict';var rimraf=require(_0x3171('0x0'));var zipdir=require(_0x3171('0x1'));var moment=require('moment');var BPromise=require(_0x3171('0x2'));var util=require(_0x3171('0x3'));var path=require(_0x3171('0x4'));var fs=require('fs');var _=require(_0x3171('0x5'));var Redis=require(_0x3171('0x6'));var interaction=require(_0x3171('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0x3171('0x8'))(_0x3171('0x9'));var config=require('../../config/environment');var db=require(_0x3171('0xa'))['db'];config[_0x3171('0xb')]=_[_0x3171('0xc')](config[_0x3171('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3171('0xd'))(new Redis(config['redis']));require(_0x3171('0xe'))['register'](socket);function respondWithStatusCode(_0x3b915e,_0x54dab4){_0x54dab4=_0x54dab4||0xcc;return function(_0x380aa1){if(_0x380aa1){return _0x3b915e['sendStatus'](_0x54dab4);}return _0x3b915e[_0x3171('0xf')](_0x54dab4)['end']();};}function respondWithResult(_0x494509,_0x1dc023){_0x1dc023=_0x1dc023||0xc8;return function(_0xde8c9){if(_0xde8c9){return _0x494509[_0x3171('0xf')](_0x1dc023)[_0x3171('0x10')](_0xde8c9);}};}function respondWithFilteredResult(_0x12db41,_0x51695b){return function(_0x5a7e7e){if(_0x5a7e7e){var _0x5860fc=typeof _0x51695b['offset']===_0x3171('0x11')&&typeof _0x51695b[_0x3171('0x12')]===_0x3171('0x11');var _0x34be22=_0x5a7e7e[_0x3171('0x13')];var _0x387c3e=_0x5860fc?0x0:_0x51695b['offset'];var _0x43c003=_0x5860fc?_0x5a7e7e[_0x3171('0x13')]:_0x51695b['offset']+_0x51695b['limit'];var _0x37da91;if(_0x43c003>=_0x34be22){_0x43c003=_0x34be22;_0x37da91=0xc8;}else{_0x37da91=0xce;}_0x12db41[_0x3171('0xf')](_0x37da91);return _0x12db41['set'](_0x3171('0x14'),_0x387c3e+'-'+_0x43c003+'/'+_0x34be22)[_0x3171('0x10')](_0x5a7e7e);}return null;};}function saveUpdates(_0x174ae8){return function(_0x524637){if(_0x524637){return _0x524637[_0x3171('0x15')](_0x174ae8)[_0x3171('0x16')](function(_0x3503a6){return _0x3503a6;});}return null;};}function removeEntity(_0x14d84c){return function(_0x2dfcf7){if(_0x2dfcf7){return _0x2dfcf7[_0x3171('0x17')]()[_0x3171('0x16')](function(){_0x14d84c[_0x3171('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ff8b2){return function(_0x93c662){if(!_0x93c662){_0x3ff8b2[_0x3171('0x18')](0x194);}return _0x93c662;};}function handleError(_0x3533d5,_0x26610f){_0x26610f=_0x26610f||0x1f4;return function(_0x18a82f){logger['error'](_0x18a82f[_0x3171('0x19')]);if(_0x18a82f[_0x3171('0x1a')]){delete _0x18a82f[_0x3171('0x1a')];}_0x3533d5['status'](_0x26610f)['send'](_0x18a82f);};}exports[_0x3171('0x1b')]=function(_0x4de918,_0x21a389){var _0x3ed66d={};var _0x2050ae=_['map'](db[_0x3171('0x1c')][_0x3171('0x1d')],function(_0x2d66ef){return{'name':_0x2d66ef[_0x3171('0x1e')],'type':_0x2d66ef['type'][_0x3171('0x1f')]};});_0x3ed66d=qs[_0x3171('0x20')](_0x2050ae,_0x4de918);return interaction[_0x3171('0x21')]('fax',_0x4de918[_0x3171('0x22')],_0x4de918[_0x3171('0x23')],_0x3ed66d,_0x2050ae)[_0x3171('0x16')](respondWithFilteredResult(_0x21a389,_0x3ed66d))['catch'](handleError(_0x21a389,null));};exports[_0x3171('0x24')]=function(_0x15b83c,_0x371509){var _0x3257e7={'raw':![],'where':{'id':_0x15b83c[_0x3171('0x25')]['id']}},_0x959d4d={};_0x959d4d[_0x3171('0x26')]=_['keys'](db[_0x3171('0x1c')][_0x3171('0x1d')]);_0x959d4d[_0x3171('0x22')]=_[_0x3171('0x27')](_0x15b83c[_0x3171('0x22')]);_0x959d4d['filters']=_[_0x3171('0x28')](_0x959d4d[_0x3171('0x26')],_0x959d4d[_0x3171('0x22')]);_0x3257e7[_0x3171('0x29')]=_[_0x3171('0x28')](_0x959d4d[_0x3171('0x26')],qs['fields'](_0x15b83c[_0x3171('0x22')][_0x3171('0x2a')]));_0x3257e7[_0x3171('0x29')]=_0x3257e7[_0x3171('0x29')][_0x3171('0x2b')]?_0x3257e7[_0x3171('0x29')]:_0x959d4d[_0x3171('0x26')];if(_0x15b83c[_0x3171('0x22')][_0x3171('0x2c')]){_0x3257e7[_0x3171('0x2d')]=[{'all':!![]}];}_0x3257e7=_[_0x3171('0x2e')]({},_0x3257e7,_0x15b83c['options']);return db[_0x3171('0x1c')][_0x3171('0x2f')](_0x3257e7)[_0x3171('0x16')](handleEntityNotFound(_0x371509,null))['then'](respondWithResult(_0x371509,null))[_0x3171('0x30')](handleError(_0x371509,null));};exports[_0x3171('0x31')]=function(_0x3eb6e7,_0xfb028d){return db['FaxInteraction']['create'](_0x3eb6e7['body'],{})[_0x3171('0x16')](respondWithResult(_0xfb028d,0xc9))[_0x3171('0x30')](handleError(_0xfb028d,null));};exports[_0x3171('0x15')]=function(_0xab744d,_0x343ab4){if(_0xab744d[_0x3171('0x32')]['id']){delete _0xab744d[_0x3171('0x32')]['id'];}return db[_0x3171('0x1c')][_0x3171('0x2f')]({'where':{'id':_0xab744d[_0x3171('0x25')]['id']}})[_0x3171('0x16')](handleEntityNotFound(_0x343ab4,null))[_0x3171('0x16')](saveUpdates(_0xab744d[_0x3171('0x32')],null))[_0x3171('0x16')](respondWithResult(_0x343ab4,null))[_0x3171('0x30')](handleError(_0x343ab4,null));};exports[_0x3171('0x17')]=function(_0x364a73,_0x4b686c){return db[_0x3171('0x1c')][_0x3171('0x2f')]({'where':{'id':_0x364a73[_0x3171('0x25')]['id']}})[_0x3171('0x16')](handleEntityNotFound(_0x4b686c,null))[_0x3171('0x16')](removeEntity(_0x4b686c,null))['catch'](handleError(_0x4b686c,null));};exports[_0x3171('0x33')]=function(_0x41d880,_0x12055b){return db[_0x3171('0x1c')][_0x3171('0x33')]()['then'](respondWithResult(_0x12055b,null))['catch'](handleError(_0x12055b,null));};exports[_0x3171('0x34')]=function(_0x29f38b,_0x1da73f){return db[_0x3171('0x35')][_0x3171('0x2f')]({'where':{'id':_0x29f38b[_0x3171('0x25')]['id']}})[_0x3171('0x16')](handleEntityNotFound(_0x1da73f,null))[_0x3171('0x16')](function(_0x5e502d){if(_0x5e502d){return _0x5e502d[_0x3171('0x34')](_0x29f38b[_0x3171('0x32')][_0x3171('0x36')],_[_0x3171('0x37')](_0x29f38b['body'],[_0x3171('0x36'),'id'])||{});}})['then'](respondWithResult(_0x1da73f,null))[_0x3171('0x30')](handleError(_0x1da73f,null));};exports[_0x3171('0x38')]=function(_0x49e809,_0xe89d15){var _0x384cbe={'raw':![],'where':{}};var _0x531784={};var _0x54847e={'count':0x0,'rows':[]};return db[_0x3171('0x1c')][_0x3171('0x39')]({'where':{'id':_0x49e809['params']['id']}})[_0x3171('0x16')](handleEntityNotFound(_0xe89d15,null))[_0x3171('0x16')](function(_0x734318){if(_0x734318){_0x531784[_0x3171('0x26')]=_[_0x3171('0x27')](db[_0x3171('0x35')][_0x3171('0x1d')]);_0x531784[_0x3171('0x22')]=_['keys'](_0x49e809[_0x3171('0x22')]);_0x531784[_0x3171('0x3a')]=_['intersection'](_0x531784[_0x3171('0x26')],_0x531784[_0x3171('0x22')]);_0x384cbe['attributes']=_[_0x3171('0x28')](_0x531784[_0x3171('0x26')],qs['fields'](_0x49e809['query'][_0x3171('0x2a')]));_0x384cbe['attributes']=_0x384cbe[_0x3171('0x29')][_0x3171('0x2b')]?_0x384cbe[_0x3171('0x29')]:_0x531784[_0x3171('0x26')];if(!_0x49e809[_0x3171('0x22')][_0x3171('0x3b')](_0x3171('0x3c'))){_0x384cbe['limit']=qs[_0x3171('0x12')](_0x49e809['query'][_0x3171('0x12')]);_0x384cbe[_0x3171('0x3d')]=qs[_0x3171('0x3d')](_0x49e809['query']['offset']);}_0x384cbe[_0x3171('0x3e')]=qs[_0x3171('0x3f')](_0x49e809[_0x3171('0x22')][_0x3171('0x3f')]);_0x384cbe[_0x3171('0x40')]=qs[_0x3171('0x3a')](_[_0x3171('0x41')](_0x49e809['query'],_0x531784[_0x3171('0x3a')]));_0x384cbe['where'][_0x3171('0x42')]=_0x734318['id'];if(_0x49e809[_0x3171('0x22')][_0x3171('0x43')]){_0x384cbe['where']=_[_0x3171('0x2e')](_0x384cbe[_0x3171('0x40')],{'$or':_['map'](_0x384cbe['attributes'],function(_0x5d2d09){var _0x4a0ce4={};_0x4a0ce4[_0x5d2d09]={'$like':'%'+_0x49e809[_0x3171('0x22')][_0x3171('0x43')]+'%'};return _0x4a0ce4;})});}if(_0x49e809[_0x3171('0x22')][_0x3171('0x44')]){var _0x14cee3=_0x49e809[_0x3171('0x22')][_0x3171('0x44')][_0x3171('0x45')](',');var _0x41797e={};_0x41797e[_0x14cee3[0x0]]={'$gte':moment(_0x14cee3[0x1])['format'](_0x3171('0x46'))};_0x384cbe[_0x3171('0x40')]=_[_0x3171('0x2e')](_0x384cbe[_0x3171('0x40')],_0x41797e);}_0x384cbe=_['merge']({},_0x384cbe,_0x49e809[_0x3171('0x47')]);return db[_0x3171('0x35')][_0x3171('0x13')]({'where':_0x384cbe[_0x3171('0x40')]})[_0x3171('0x16')](function(_0x50f638){_0x54847e['count']=_0x50f638;if(_0x49e809[_0x3171('0x22')][_0x3171('0x2c')]){_0x384cbe['include']=[{'all':!![]}];}return db['FaxMessage'][_0x3171('0x21')](_0x384cbe);})[_0x3171('0x16')](function(_0x38388b){_0x54847e[_0x3171('0x48')]=_0x38388b;return _0x54847e;});}})['then'](respondWithFilteredResult(_0xe89d15,_0x384cbe))[_0x3171('0x30')](handleError(_0xe89d15,null));};exports['addTags']=function(_0x513110,_0x1417f2){return db[_0x3171('0x1c')][_0x3171('0x2f')]({'where':{'id':_0x513110[_0x3171('0x25')]['id']}})[_0x3171('0x16')](handleEntityNotFound(_0x1417f2,null))['then'](function(_0xdaada2){if(_0xdaada2){return _0xdaada2[_0x3171('0x49')](_0x513110['body'][_0x3171('0x36')],_[_0x3171('0x37')](_0x513110['body'],['ids','id'])||{})[_0x3171('0x4a')](function(){return db[_0x3171('0x4b')][_0x3171('0x21')]({'attributes':['id',_0x3171('0x1a'),_0x3171('0x4c')],'where':{'id':_0x513110[_0x3171('0x32')]['ids']}});})[_0x3171('0x16')](function(_0x50146d){socket['emit'](_0x3171('0x4d'),{'id':Number(_0x513110['params']['id']),'tags':_0x50146d||[]});return{'id':Number(_0x513110[_0x3171('0x25')]['id']),'tags':_0x50146d||[]};});}})[_0x3171('0x16')](respondWithResult(_0x1417f2,null))[_0x3171('0x30')](handleError(_0x1417f2,null));};exports[_0x3171('0x4e')]=function(_0x15dd46,_0x16002e){return db[_0x3171('0x1c')]['find']({'where':{'id':_0x15dd46[_0x3171('0x25')]['id']}})['then'](handleEntityNotFound(_0x16002e,null))[_0x3171('0x16')](function(_0x43636b){if(_0x43636b){return _0x43636b[_0x3171('0x4e')](_0x15dd46[_0x3171('0x22')][_0x3171('0x36')]);}})['then'](respondWithStatusCode(_0x16002e,null))[_0x3171('0x30')](handleError(_0x16002e,null));};exports[_0x3171('0x4f')]=function(_0x2bc81e,_0x52e980){var _0x9fc15b=moment()[_0x3171('0x50')]()[_0x3171('0x51')]();var _0x33f337=path[_0x3171('0x52')](config[_0x3171('0x53')],'server','files',_0x3171('0x54'));var _0x52e881=path[_0x3171('0x52')](config['root'],_0x3171('0x55'),'files',_0x3171('0x56'));var _0x278ef9=path[_0x3171('0x52')](_0x33f337,_0x9fc15b);var _0x134ed8=util[_0x3171('0x57')](_0x3171('0x58'),_0x2bc81e[_0x3171('0x25')]['id'],_0x9fc15b);var _0x26ade0=path[_0x3171('0x52')](_0x33f337,_0x134ed8);var _0x516283=[];_0x516283['push']({'model':db[_0x3171('0x59')],'as':_0x3171('0x59'),'raw':!![]});var _0x55aa68=[{'model':db[_0x3171('0x35')],'as':_0x3171('0x5a'),'attributes':['id',_0x3171('0x32'),_0x3171('0x5b')],'include':_0x516283}];return db[_0x3171('0x1c')][_0x3171('0x2f')]({'where':{'id':_0x2bc81e[_0x3171('0x25')]['id']},'include':_0x55aa68})[_0x3171('0x16')](handleEntityNotFound(_0x52e980,null))[_0x3171('0x16')](function(_0x319dde){if(_0x319dde&&_0x319dde[_0x3171('0x5a')]){var _0x2ecb9c=_0x319dde[_0x3171('0x5c')]({'plain':!![]});fs[_0x3171('0x5d')](_0x278ef9);for(var _0x35501e=0x0;_0x35501e<_0x2ecb9c['Messages'][_0x3171('0x2b')];_0x35501e++){var _0x55a3d0=_0x2ecb9c['Messages'][_0x35501e][_0x3171('0x59')];if(_0x55a3d0){var _0x48bf05=path[_0x3171('0x52')](_0x52e881,_0x55a3d0[_0x3171('0x5e')]);if(fs[_0x3171('0x5f')](_0x48bf05)){fs['createReadStream'](_0x48bf05)['pipe'](fs[_0x3171('0x60')](path[_0x3171('0x52')](_0x278ef9,_0x55a3d0[_0x3171('0x5e')])));}}}return BPromise[_0x3171('0x61')]()['then'](function(){return new BPromise(function(_0x165b47,_0x185bed){zipdir(_0x278ef9,{'saveTo':_0x26ade0},function(_0x9794e,_0x2dd39e){if(_0x9794e)return _0x185bed(_0x9794e);return _0x165b47(_0x2dd39e);});})[_0x3171('0x16')](function(){return new BPromise(function(_0x587602,_0x584b77){rimraf(_0x278ef9,function(_0x5736e4){if(_0x5736e4)_0x584b77(_0x5736e4);return _0x587602();});});})[_0x3171('0x16')](function(){return _0x52e980[_0x3171('0x4f')](_0x26ade0,_0x134ed8,function(_0x179e3b){if(_0x179e3b){console[_0x3171('0x62')]('err',_0x179e3b);}else{fs[_0x3171('0x63')](_0x26ade0);}});});});}else{return _0x52e980[_0x3171('0x18')](0xc8);}})['catch'](handleError(_0x52e980,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index f59f19d..8b389e6 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 _0x180c=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch'];(function(_0x5cc751,_0x3bdb0f){var _0x27a21b=function(_0x26675c){while(--_0x26675c){_0x5cc751['push'](_0x5cc751['shift']());}};_0x27a21b(++_0x3bdb0f);}(_0x180c,0x146));var _0xc180=function(_0x51c7b4,_0x17b35a){_0x51c7b4=_0x51c7b4-0x0;var _0x38c7e9=_0x180c[_0x51c7b4];return _0x38c7e9;};'use strict';var EventEmitter=require(_0xc180('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xc180('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xc180('0x2')](0x0);var events={'afterCreate':_0xc180('0x3'),'afterUpdate':_0xc180('0x4'),'afterDestroy':'remove'};function emitEvent(_0xed247f){return function(_0x2c144f,_0xdcf386,_0x9ea4dd){_0x2c144f[_0xc180('0x5')]({'attributes':['id'],'raw':!![]})[_0xc180('0x6')](function(_0x34b7d0){_0x2c144f[_0xc180('0x7')](_0xc180('0x8'),_0x34b7d0[_0xc180('0x9')](function(_0x56fcab){return{'id':_0x56fcab['id']};}));return FaxMessage[_0xc180('0xa')]({'where':{'FaxInteractionId':_0x2c144f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc180('0x6')](function(_0x4cf4c4){_0x2c144f[_0xc180('0x7')](_0xc180('0xb'),_0x4cf4c4['length']);FaxInteractionEvents[_0xc180('0xc')](_0xed247f+':'+_0x2c144f['id'],_0x2c144f);FaxInteractionEvents[_0xc180('0xc')](_0xed247f,_0x2c144f);_0x9ea4dd(null);})[_0xc180('0xd')](_0x9ea4dd(null));};}for(var e in events){if(events[_0xc180('0xe')](e)){var event=events[e];FaxInteraction[_0xc180('0xf')](e,emitEvent(event));}}module[_0xc180('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0xa095=['Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','then','setDataValue'];(function(_0x27604f,_0x5ae336){var _0x40d189=function(_0xebacde){while(--_0xebacde){_0x27604f['push'](_0x27604f['shift']());}};_0x40d189(++_0x5ae336);}(_0xa095,0xaa));var _0x5a09=function(_0x3a19d4,_0x3f19a4){_0x3a19d4=_0x3a19d4-0x0;var _0x5b858b=_0xa095[_0x3a19d4];return _0x5b858b;};'use strict';var EventEmitter=require(_0x5a09('0x0'));var FaxInteraction=require(_0x5a09('0x1'))['db'][_0x5a09('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x5a09('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x5a09('0x4')](0x0);var events={'afterCreate':_0x5a09('0x5'),'afterUpdate':_0x5a09('0x6'),'afterDestroy':_0x5a09('0x7')};function emitEvent(_0x56acab){return function(_0x18c92b,_0x2bc810,_0x39de66){_0x18c92b['getUsers']({'attributes':['id'],'raw':!![]})[_0x5a09('0x8')](function(_0x49b788){_0x18c92b[_0x5a09('0x9')](_0x5a09('0xa'),_0x49b788[_0x5a09('0xb')](function(_0x12e525){return{'id':_0x12e525['id']};}));return FaxMessage[_0x5a09('0xc')]({'where':{'FaxInteractionId':_0x18c92b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x22f85d){_0x18c92b[_0x5a09('0x9')](_0x5a09('0xd'),_0x22f85d[_0x5a09('0xe')]);FaxInteractionEvents[_0x5a09('0xf')](_0x56acab+':'+_0x18c92b['id'],_0x18c92b);FaxInteractionEvents[_0x5a09('0xf')](_0x56acab,_0x18c92b);_0x39de66(null);})[_0x5a09('0x10')](_0x39de66(null));};}for(var e in events){if(events[_0x5a09('0x11')](e)){var event=events[e];FaxInteraction[_0x5a09('0x12')](e,emitEvent(event));}}module[_0x5a09('0x13')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 0886bee..cc4d77d 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 _0x48e4=['fax_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','FaxInteraction'];(function(_0x5f2da8,_0x3cf047){var _0x230317=function(_0x5c6271){while(--_0x5c6271){_0x5f2da8['push'](_0x5f2da8['shift']());}};_0x230317(++_0x3cf047);}(_0x48e4,0x126));var _0x448e=function(_0x5eb6ac,_0x47fb0f){_0x5eb6ac=_0x5eb6ac-0x0;var _0x42eaf9=_0x48e4[_0x5eb6ac];return _0x42eaf9;};'use strict';var _=require(_0x448e('0x0'));var util=require(_0x448e('0x1'));var logger=require(_0x448e('0x2'))(_0x448e('0x3'));var moment=require(_0x448e('0x4'));var BPromise=require(_0x448e('0x5'));var rp=require(_0x448e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x448e('0x7'));var config=require(_0x448e('0x8'));var attributes=require('./faxInteraction.attributes');module[_0x448e('0x9')]=function(_0x20a235,_0xbd24d4){return _0x20a235[_0x448e('0xa')](_0x448e('0xb'),attributes,{'tableName':_0x448e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x45ac8e,_0x1a3538,_0x5423fc){if(_0x45ac8e['changed'](_0x448e('0xd'))){_0x45ac8e[_0x448e('0xe')]=moment()[_0x448e('0xf')](_0x448e('0x10'));}_0x5423fc(null,_0x45ac8e);}}});}; \ No newline at end of file +var _0x9613=['./faxInteraction.attributes','define','FaxInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x4060db,_0x4f7e89){var _0x20280e=function(_0x585ed4){while(--_0x585ed4){_0x4060db['push'](_0x4060db['shift']());}};_0x20280e(++_0x4f7e89);}(_0x9613,0x1c9));var _0x3961=function(_0x25430c,_0x4f6d27){_0x25430c=_0x25430c-0x0;var _0x57c3cf=_0x9613[_0x25430c];return _0x57c3cf;};'use strict';var _=require(_0x3961('0x0'));var util=require(_0x3961('0x1'));var logger=require(_0x3961('0x2'))(_0x3961('0x3'));var moment=require('moment');var BPromise=require(_0x3961('0x4'));var rp=require(_0x3961('0x5'));var fs=require('fs');var path=require(_0x3961('0x6'));var rimraf=require(_0x3961('0x7'));var config=require('../../config/environment');var attributes=require(_0x3961('0x8'));module['exports']=function(_0x5c8e55,_0x38178c){return _0x5c8e55[_0x3961('0x9')](_0x3961('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3a0772,_0x492ee8,_0x1a5b9c){if(_0x3a0772[_0x3961('0xb')](_0x3961('0xc'))){_0x3a0772[_0x3961('0xd')]=moment()['format'](_0x3961('0xe'));}_0x1a5b9c(null,_0x3a0772);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 07be44d..93fe03c 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 _0x0d3b=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','AddTagsToFaxInteraction','find','ids','omit','AddTags'];(function(_0x15a69f,_0x5f0a94){var _0xe8dc83=function(_0xe41bd4){while(--_0xe41bd4){_0x15a69f['push'](_0x15a69f['shift']());}};_0xe8dc83(++_0x5f0a94);}(_0x0d3b,0x81));var _0xb0d3=function(_0xfbede6,_0x425e0e){_0xfbede6=_0xfbede6-0x0;var _0x192f6f=_0x0d3b[_0xfbede6];return _0x192f6f;};'use strict';var _=require(_0xb0d3('0x0'));var util=require(_0xb0d3('0x1'));var moment=require('moment');var BPromise=require(_0xb0d3('0x2'));var rs=require(_0xb0d3('0x3'));var fs=require('fs');var Redis=require(_0xb0d3('0x4'));var db=require(_0xb0d3('0x5'))['db'];var utils=require(_0xb0d3('0x6'));var logger=require(_0xb0d3('0x7'))(_0xb0d3('0x8'));var config=require(_0xb0d3('0x9'));var jayson=require(_0xb0d3('0xa'));var client=jayson[_0xb0d3('0xb')]['http']({'port':0x232a});config[_0xb0d3('0xc')]=_[_0xb0d3('0xd')](config[_0xb0d3('0xc')],{'host':_0xb0d3('0xe'),'port':0x18eb});var socket=require(_0xb0d3('0xf'))(new Redis(config[_0xb0d3('0xc')]));require(_0xb0d3('0x10'))[_0xb0d3('0x11')](socket);function respondWithRpcPromise(_0x23881c,_0x1aacd6,_0x5694e3){return new BPromise(function(_0x4cf835,_0x3f09bb){return client[_0xb0d3('0x12')](_0x23881c,_0x5694e3)[_0xb0d3('0x13')](function(_0x26d9b7){logger[_0xb0d3('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x1aacd6,_0xb0d3('0x15'));logger[_0xb0d3('0x16')](_0xb0d3('0x17'),_0x1aacd6,'request\x20sent',JSON[_0xb0d3('0x18')](_0x26d9b7));if(_0x26d9b7[_0xb0d3('0x19')]){if(_0x26d9b7[_0xb0d3('0x19')]['code']===0x1f4){logger[_0xb0d3('0x19')](_0xb0d3('0x1a'),_0x1aacd6,_0x26d9b7[_0xb0d3('0x19')][_0xb0d3('0x1b')]);return _0x3f09bb(_0x26d9b7[_0xb0d3('0x19')][_0xb0d3('0x1b')]);}logger[_0xb0d3('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x1aacd6,_0x26d9b7['error'][_0xb0d3('0x1b')]);return _0x4cf835(_0x26d9b7[_0xb0d3('0x19')][_0xb0d3('0x1b')]);}else{logger[_0xb0d3('0x14')](_0xb0d3('0x1a'),_0x1aacd6,_0xb0d3('0x15'));_0x4cf835(_0x26d9b7[_0xb0d3('0x1c')][_0xb0d3('0x1b')]);}})[_0xb0d3('0x1d')](function(_0x2bcce9){logger[_0xb0d3('0x19')](_0xb0d3('0x1a'),_0x1aacd6,_0x2bcce9);_0x3f09bb(_0x2bcce9);});});}exports[_0xb0d3('0x1e')]=function(_0x3f5dd3){var _0x296c82=this;return new Promise(function(_0x18982f,_0x55103f){return db[_0xb0d3('0x1f')][_0xb0d3('0x20')](_0x3f5dd3[_0xb0d3('0x21')],{'raw':_0x3f5dd3[_0xb0d3('0x22')]?_0x3f5dd3[_0xb0d3('0x22')][_0xb0d3('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f5dd3[_0xb0d3('0x22')]?_0x3f5dd3['options'][_0xb0d3('0x24')]||null:null,'attributes':_0x3f5dd3['options']?_0x3f5dd3[_0xb0d3('0x22')][_0xb0d3('0x25')]||null:null,'limit':_0x3f5dd3['options']?_0x3f5dd3[_0xb0d3('0x22')]['limit']||null:null})['then'](function(_0x124dff){logger[_0xb0d3('0x14')](_0xb0d3('0x1e'),_0x3f5dd3);logger['debug'](_0xb0d3('0x1e'),_0x3f5dd3,JSON[_0xb0d3('0x18')](_0x124dff));_0x18982f(_0x124dff);})[_0xb0d3('0x1d')](function(_0x50f6f4){logger[_0xb0d3('0x19')]('UpdateFaxInteraction',_0x50f6f4['message'],_0x3f5dd3);_0x55103f(_0x296c82[_0xb0d3('0x19')](0x1f4,_0x50f6f4[_0xb0d3('0x1b')]));});});};exports[_0xb0d3('0x26')]=function(_0x16e428){return new Promise(function(_0x312fdf,_0x501ae1){return db[_0xb0d3('0x1f')][_0xb0d3('0x27')]({'where':_0x16e428['options']?_0x16e428[_0xb0d3('0x22')][_0xb0d3('0x24')]||null:null})[_0xb0d3('0x13')](function(_0xd6ef60){if(_0xd6ef60){return _0xd6ef60['addTags'](_0x16e428[_0xb0d3('0x21')][_0xb0d3('0x28')],_[_0xb0d3('0x29')](_0x16e428[_0xb0d3('0x21')],[_0xb0d3('0x28'),'id'])||{});}})['spread'](function(_0x4bf885){logger['info']('AddTags',_0x16e428);logger[_0xb0d3('0x16')](_0xb0d3('0x2a'),_0x16e428,JSON['stringify'](_0x4bf885));_0x312fdf(_0x4bf885);})[_0xb0d3('0x1d')](function(_0x1e6a0f){logger[_0xb0d3('0x19')]('AddTags',_0x1e6a0f[_0xb0d3('0x1b')],_0x16e428);_0x501ae1(_this['error'](0x1f4,_0x1e6a0f[_0xb0d3('0x1b')]));});});}; \ No newline at end of file +var _0xb634=['where','limit','debug','AddTagsToFaxInteraction','find','addTags','ids','spread','AddTags','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw'];(function(_0x37ed66,_0x25f859){var _0x15d0bc=function(_0x3386f6){while(--_0x3386f6){_0x37ed66['push'](_0x37ed66['shift']());}};_0x15d0bc(++_0x25f859);}(_0xb634,0x87));var _0x4b63=function(_0x306812,_0x384ca9){_0x306812=_0x306812-0x0;var _0x37d18a=_0xb634[_0x306812];return _0x37d18a;};'use strict';var _=require('lodash');var util=require(_0x4b63('0x0'));var moment=require('moment');var BPromise=require(_0x4b63('0x1'));var rs=require(_0x4b63('0x2'));var fs=require('fs');var Redis=require(_0x4b63('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4b63('0x4'));var logger=require('../../config/logger')(_0x4b63('0x5'));var config=require(_0x4b63('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4b63('0x7')][_0x4b63('0x8')]({'port':0x232a});config[_0x4b63('0x9')]=_[_0x4b63('0xa')](config[_0x4b63('0x9')],{'host':_0x4b63('0xb'),'port':0x18eb});var socket=require(_0x4b63('0xc'))(new Redis(config['redis']));require(_0x4b63('0xd'))[_0x4b63('0xe')](socket);function respondWithRpcPromise(_0x59f16a,_0x1002aa,_0xb040f){return new BPromise(function(_0x3cb9a0,_0x557714){return client[_0x4b63('0xf')](_0x59f16a,_0xb040f)[_0x4b63('0x10')](function(_0x3909d1){logger[_0x4b63('0x11')](_0x4b63('0x12'),_0x1002aa,'request\x20sent');logger['debug'](_0x4b63('0x13'),_0x1002aa,_0x4b63('0x14'),JSON[_0x4b63('0x15')](_0x3909d1));if(_0x3909d1['error']){if(_0x3909d1[_0x4b63('0x16')][_0x4b63('0x17')]===0x1f4){logger[_0x4b63('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x1002aa,_0x3909d1[_0x4b63('0x16')][_0x4b63('0x18')]);return _0x557714(_0x3909d1['error'][_0x4b63('0x18')]);}logger['error'](_0x4b63('0x12'),_0x1002aa,_0x3909d1[_0x4b63('0x16')][_0x4b63('0x18')]);return _0x3cb9a0(_0x3909d1[_0x4b63('0x16')][_0x4b63('0x18')]);}else{logger[_0x4b63('0x11')](_0x4b63('0x12'),_0x1002aa,_0x4b63('0x14'));_0x3cb9a0(_0x3909d1[_0x4b63('0x19')][_0x4b63('0x18')]);}})[_0x4b63('0x1a')](function(_0x597eeb){logger['error'](_0x4b63('0x12'),_0x1002aa,_0x597eeb);_0x557714(_0x597eeb);});});}exports[_0x4b63('0x1b')]=function(_0x223842){var _0x304e35=this;return new Promise(function(_0x550352,_0x449d15){return db[_0x4b63('0x1c')][_0x4b63('0x1d')](_0x223842[_0x4b63('0x1e')],{'raw':_0x223842[_0x4b63('0x1f')]?_0x223842[_0x4b63('0x1f')][_0x4b63('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x223842[_0x4b63('0x1f')]?_0x223842[_0x4b63('0x1f')][_0x4b63('0x21')]||null:null,'attributes':_0x223842[_0x4b63('0x1f')]?_0x223842[_0x4b63('0x1f')]['attributes']||null:null,'limit':_0x223842[_0x4b63('0x1f')]?_0x223842[_0x4b63('0x1f')][_0x4b63('0x22')]||null:null})['then'](function(_0x169bba){logger[_0x4b63('0x11')](_0x4b63('0x1b'),_0x223842);logger[_0x4b63('0x23')](_0x4b63('0x1b'),_0x223842,JSON[_0x4b63('0x15')](_0x169bba));_0x550352(_0x169bba);})['catch'](function(_0x3d1e61){logger[_0x4b63('0x16')](_0x4b63('0x1b'),_0x3d1e61['message'],_0x223842);_0x449d15(_0x304e35[_0x4b63('0x16')](0x1f4,_0x3d1e61['message']));});});};exports[_0x4b63('0x24')]=function(_0x1fd6bd){return new Promise(function(_0x235fea,_0x42be71){return db[_0x4b63('0x1c')][_0x4b63('0x25')]({'where':_0x1fd6bd['options']?_0x1fd6bd[_0x4b63('0x1f')][_0x4b63('0x21')]||null:null})[_0x4b63('0x10')](function(_0x43832e){if(_0x43832e){return _0x43832e[_0x4b63('0x26')](_0x1fd6bd[_0x4b63('0x1e')][_0x4b63('0x27')],_['omit'](_0x1fd6bd[_0x4b63('0x1e')],['ids','id'])||{});}})[_0x4b63('0x28')](function(_0x10083b){logger[_0x4b63('0x11')](_0x4b63('0x29'),_0x1fd6bd);logger[_0x4b63('0x23')](_0x4b63('0x29'),_0x1fd6bd,JSON['stringify'](_0x10083b));_0x235fea(_0x10083b);})[_0x4b63('0x1a')](function(_0x5c9e1){logger[_0x4b63('0x16')](_0x4b63('0x29'),_0x5c9e1[_0x4b63('0x18')],_0x1fd6bd);_0x42be71(_this[_0x4b63('0x16')](0x1f4,_0x5c9e1[_0x4b63('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 5aab1af..02b605a 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 _0x45ad=['faxInteraction:','save','update','register','length'];(function(_0x2089b3,_0x31fbde){var _0x181087=function(_0x31d19b){while(--_0x31d19b){_0x2089b3['push'](_0x2089b3['shift']());}};_0x181087(++_0x31fbde);}(_0x45ad,0x1e1));var _0xd45a=function(_0x489250,_0x5e9468){_0x489250=_0x489250-0x0;var _0x1283e5=_0x45ad[_0x489250];return _0x1283e5;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xd45a('0x0'),'remove',_0xd45a('0x1')];function createListener(_0x594bac,_0x150af4){return function(_0x4586ab){_0x150af4['emit'](_0x594bac,_0x4586ab);};}function removeListener(_0x5408e9,_0x1538e5){return function(){FaxInteractionEvents['removeListener'](_0x5408e9,_0x1538e5);};}exports[_0xd45a('0x2')]=function(_0xb621f7){for(var _0x89823f=0x0,_0x2aa659=events[_0xd45a('0x3')];_0x89823f<_0x2aa659;_0x89823f++){var _0x5b2c91=events[_0x89823f];var _0x77286e=createListener(_0xd45a('0x4')+_0x5b2c91,_0xb621f7);FaxInteractionEvents['on'](_0x5b2c91,_0x77286e);}}; \ No newline at end of file +var _0x6d8a=['update','emit','register','faxInteraction:','./faxInteraction.events','remove'];(function(_0x3ebbae,_0x243013){var _0x3d8391=function(_0x212f92){while(--_0x212f92){_0x3ebbae['push'](_0x3ebbae['shift']());}};_0x3d8391(++_0x243013);}(_0x6d8a,0xb8));var _0xa6d8=function(_0x2b8077,_0x453634){_0x2b8077=_0x2b8077-0x0;var _0x308091=_0x6d8a[_0x2b8077];return _0x308091;};'use strict';var FaxInteractionEvents=require(_0xa6d8('0x0'));var events=['save',_0xa6d8('0x1'),_0xa6d8('0x2')];function createListener(_0x484418,_0x2fb00c){return function(_0x394872){_0x2fb00c[_0xa6d8('0x3')](_0x484418,_0x394872);};}function removeListener(_0x1cd224,_0x4bd9f5){return function(){FaxInteractionEvents['removeListener'](_0x1cd224,_0x4bd9f5);};}exports[_0xa6d8('0x4')]=function(_0x2bd008){for(var _0x20ced6=0x0,_0x32ee1a=events['length'];_0x20ced6<_0x32ee1a;_0x20ced6++){var _0x93b66=events[_0x20ced6];var _0x3db357=createListener(_0xa6d8('0x5')+_0x93b66,_0x2bd008);FaxInteractionEvents['on'](_0x93b66,_0x3db357);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index fa69997..8b4e9db 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 _0x8824=['update','faxinteraction:destroy','destroy','delete','removeTags','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxInteraction.controller','isAuthenticated','index','get','/describe','describe','show','/:id/download','post','create','/:id/messages','addMessage','/:id/tags','fax','faxinteraction:addtags','addTags','put','/:id','tracked','faxinteraction:update'];(function(_0x157647,_0x47fbed){var _0x534346=function(_0x4ba8f7){while(--_0x4ba8f7){_0x157647['push'](_0x157647['shift']());}};_0x534346(++_0x47fbed);}(_0x8824,0x1b3));var _0x4882=function(_0x4faf6e,_0x45bace){_0x4faf6e=_0x4faf6e-0x0;var _0xa2ab78=_0x8824[_0x4faf6e];return _0xa2ab78;};'use strict';var multer=require('multer');var util=require(_0x4882('0x0'));var path=require(_0x4882('0x1'));var timeout=require(_0x4882('0x2'));var express=require(_0x4882('0x3'));var router=express[_0x4882('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4882('0x5'));var config=require(_0x4882('0x6'));var controller=require(_0x4882('0x7'));router['get']('/',auth[_0x4882('0x8')](),controller[_0x4882('0x9')]);router[_0x4882('0xa')](_0x4882('0xb'),auth[_0x4882('0x8')](),controller[_0x4882('0xc')]);router['get']('/:id',auth[_0x4882('0x8')](),controller[_0x4882('0xd')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x4882('0xa')](_0x4882('0xe'),auth[_0x4882('0x8')](),controller['download']);router[_0x4882('0xf')]('/',auth['isAuthenticated'](),controller[_0x4882('0x10')]);router[_0x4882('0xf')](_0x4882('0x11'),auth[_0x4882('0x8')](),controller[_0x4882('0x12')]);router[_0x4882('0xf')](_0x4882('0x13'),auth[_0x4882('0x8')](),interaction['tracked'](_0x4882('0x14'),_0x4882('0x15')),controller[_0x4882('0x16')]);router[_0x4882('0x17')](_0x4882('0x18'),auth[_0x4882('0x8')](),interaction[_0x4882('0x19')]('fax',_0x4882('0x1a')),controller[_0x4882('0x1b')]);router['delete'](_0x4882('0x18'),auth['isAuthenticated'](),interaction[_0x4882('0x19')](_0x4882('0x14'),_0x4882('0x1c')),controller[_0x4882('0x1d')]);router[_0x4882('0x1e')](_0x4882('0x13'),auth[_0x4882('0x8')](),controller[_0x4882('0x1f')]);module[_0x4882('0x20')]=router; \ No newline at end of file +var _0xf244=['addMessage','/:id/tags','tracked','fax','addTags','put','faxinteraction:update','update','delete','faxinteraction:destroy','removeTags','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create'];(function(_0x352b7c,_0xf3c28b){var _0x2f96ff=function(_0x393352){while(--_0x393352){_0x352b7c['push'](_0x352b7c['shift']());}};_0x2f96ff(++_0xf3c28b);}(_0xf244,0x160));var _0x4f24=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xf244[_0x45d3f0];return _0x314b79;};'use strict';var multer=require(_0x4f24('0x0'));var util=require('util');var path=require(_0x4f24('0x1'));var timeout=require(_0x4f24('0x2'));var express=require(_0x4f24('0x3'));var router=express['Router']();var fs_extra=require(_0x4f24('0x4'));var auth=require(_0x4f24('0x5'));var interaction=require(_0x4f24('0x6'));var config=require('../../config/environment');var controller=require(_0x4f24('0x7'));router[_0x4f24('0x8')]('/',auth[_0x4f24('0x9')](),controller[_0x4f24('0xa')]);router[_0x4f24('0x8')](_0x4f24('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x4f24('0xc'),auth['isAuthenticated'](),controller[_0x4f24('0xd')]);router[_0x4f24('0x8')](_0x4f24('0xe'),auth[_0x4f24('0x9')](),controller[_0x4f24('0xf')]);router['get'](_0x4f24('0x10'),auth[_0x4f24('0x9')](),controller[_0x4f24('0x11')]);router[_0x4f24('0x12')]('/',auth[_0x4f24('0x9')](),controller[_0x4f24('0x13')]);router[_0x4f24('0x12')](_0x4f24('0xe'),auth[_0x4f24('0x9')](),controller[_0x4f24('0x14')]);router[_0x4f24('0x12')](_0x4f24('0x15'),auth[_0x4f24('0x9')](),interaction[_0x4f24('0x16')](_0x4f24('0x17'),'faxinteraction:addtags'),controller[_0x4f24('0x18')]);router[_0x4f24('0x19')](_0x4f24('0xc'),auth[_0x4f24('0x9')](),interaction['tracked'](_0x4f24('0x17'),_0x4f24('0x1a')),controller[_0x4f24('0x1b')]);router[_0x4f24('0x1c')](_0x4f24('0xc'),auth[_0x4f24('0x9')](),interaction[_0x4f24('0x16')]('fax',_0x4f24('0x1d')),controller['destroy']);router[_0x4f24('0x1c')](_0x4f24('0x15'),auth[_0x4f24('0x9')](),controller[_0x4f24('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index dd59095..a4858c4 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 _0xd52a=['medium','BOOLEAN','ENUM','out','TEXT','DATE','exports'];(function(_0x117913,_0x4fd262){var _0xb8eacb=function(_0x1e8b58){while(--_0x1e8b58){_0x117913['push'](_0x117913['shift']());}};_0xb8eacb(++_0x4fd262);}(_0xd52a,0xca));var _0xad52=function(_0x35217d,_0x570ebc){_0x35217d=_0x35217d-0x0;var _0x46663e=_0xd52a[_0x35217d];return _0x46663e;};'use strict';var Sequelize=require('sequelize');module[_0xad52('0x0')]={'body':{'type':Sequelize['TEXT'](_0xad52('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xad52('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xad52('0x3')]('in','out'),'defaultValue':_0xad52('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xad52('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0xad52('0x6')]}}; \ No newline at end of file +var _0x3d6d=['ENUM','out','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x3d6d,0xb3));var _0xd3d6=function(_0xcfc44,_0x179bc1){_0xcfc44=_0xcfc44-0x0;var _0x307a25=_0x3d6d[_0xcfc44];return _0x307a25;};'use strict';var Sequelize=require(_0xd3d6('0x0'));module[_0xd3d6('0x1')]={'body':{'type':Sequelize[_0xd3d6('0x2')](_0xd3d6('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xd3d6('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd3d6('0x5')]('in',_0xd3d6('0x6')),'defaultValue':_0xd3d6('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xd3d6('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xd3d6('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 34058fc..f653027 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 _0x0b59=['event','EventManager','acceptmessage','FaxInteraction','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','fullname','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','isNil','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','files','attachments','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./faxMessage.socket','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','code','error','message','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','update','then','destroy','stack','name','index','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','body','describe','../../config/logger','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','SIP/%s','channel','motionChannel'];(function(_0x5050ce,_0x5f10d5){var _0x20c610=function(_0x375327){while(--_0x375327){_0x5050ce['push'](_0x5050ce['shift']());}};_0x20c610(++_0x5f10d5);}(_0x0b59,0xad));var _0x90b5=function(_0x1faef2,_0x18d428){_0x1faef2=_0x1faef2-0x0;var _0x53c860=_0x0b59[_0x1faef2];return _0x53c860;};'use strict';var emlformat=require(_0x90b5('0x0'));var rimraf=require(_0x90b5('0x1'));var zipdir=require(_0x90b5('0x2'));var jsonpatch=require(_0x90b5('0x3'));var rp=require(_0x90b5('0x4'));var moment=require('moment');var BPromise=require(_0x90b5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x90b5('0x6'));var sox=require(_0x90b5('0x7'));var csv=require(_0x90b5('0x8'));var ejs=require(_0x90b5('0x9'));var fs=require('fs');var fs_extra=require(_0x90b5('0xa'));var _=require(_0x90b5('0xb'));var squel=require(_0x90b5('0xc'));var crypto=require(_0x90b5('0xd'));var jsforce=require(_0x90b5('0xe'));var deskjs=require(_0x90b5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x90b5('0x10'));var Papa=require(_0x90b5('0x11'));var Redis=require('ioredis');var authService=require(_0x90b5('0x12'));var qs=require(_0x90b5('0x13'));var as=require(_0x90b5('0x14'));var hardwareService=require(_0x90b5('0x15'));var logger=require('../../config/logger')(_0x90b5('0x16'));var utils=require(_0x90b5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x90b5('0x18'));var db=require('../../mysqldb')['db'];config[_0x90b5('0x19')]=_[_0x90b5('0x1a')](config[_0x90b5('0x19')],{'host':_0x90b5('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x90b5('0x19')]));require(_0x90b5('0x1c'))[_0x90b5('0x1d')](socket);var jayson=require(_0x90b5('0x1e'));var client=jayson[_0x90b5('0x1f')][_0x90b5('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x90b5('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1c32b5,_0x5db7f7,_0x84fe57,_0x3b7935){return new BPromise(function(_0x5c71e5,_0x1c0daf){var _0x589fce=_0x3b7935||client;return _0x589fce[_0x90b5('0x21')](_0x1c32b5,_0x84fe57)['then'](function(_0x416fd6){logger[_0x90b5('0x22')](_0x90b5('0x23'),_0x5db7f7,_0x90b5('0x24'));logger[_0x90b5('0x25')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5db7f7,_0x90b5('0x24'),JSON['stringify'](_0x416fd6));if(_0x416fd6['error']){if(_0x416fd6['error'][_0x90b5('0x26')]===0x1f4){logger[_0x90b5('0x27')]('FaxMessage,\x20%s,\x20%s',_0x5db7f7,_0x416fd6[_0x90b5('0x27')][_0x90b5('0x28')]);return _0x1c0daf(_0x416fd6[_0x90b5('0x27')]['message']);}logger[_0x90b5('0x27')](_0x90b5('0x23'),_0x5db7f7,_0x416fd6[_0x90b5('0x27')][_0x90b5('0x28')]);return _0x5c71e5(_0x416fd6[_0x90b5('0x27')][_0x90b5('0x28')]);}else{logger[_0x90b5('0x22')](_0x90b5('0x23'),_0x5db7f7,_0x90b5('0x24'));_0x5c71e5(_0x416fd6['result']['message']);}})['catch'](function(_0x450765){logger[_0x90b5('0x27')](_0x90b5('0x23'),_0x5db7f7,_0x450765);_0x1c0daf(_0x450765);});});}function respondWithStatusCode(_0x141f95,_0x5eb4c6){_0x5eb4c6=_0x5eb4c6||0xcc;return function(_0x4999d1){if(_0x4999d1){return _0x141f95[_0x90b5('0x29')](_0x5eb4c6);}return _0x141f95[_0x90b5('0x2a')](_0x5eb4c6)[_0x90b5('0x2b')]();};}function respondWithResult(_0x4a7549,_0x3d87f7){_0x3d87f7=_0x3d87f7||0xc8;return function(_0x48a135){if(_0x48a135){return _0x4a7549[_0x90b5('0x2a')](_0x3d87f7)['json'](_0x48a135);}};}function respondWithFilteredResult(_0x2a77f6,_0x1d9e24){return function(_0x2a0c08){if(_0x2a0c08){var _0x4d43aa=typeof _0x1d9e24[_0x90b5('0x2c')]===_0x90b5('0x2d')&&typeof _0x1d9e24['limit']===_0x90b5('0x2d');var _0x264c9b=_0x2a0c08[_0x90b5('0x2e')];var _0x5dc693=_0x4d43aa?0x0:_0x1d9e24[_0x90b5('0x2c')];var _0x57060b=_0x4d43aa?_0x2a0c08['count']:_0x1d9e24[_0x90b5('0x2c')]+_0x1d9e24[_0x90b5('0x2f')];var _0x2d9a95;if(_0x57060b>=_0x264c9b){_0x57060b=_0x264c9b;_0x2d9a95=0xc8;}else{_0x2d9a95=0xce;}_0x2a77f6[_0x90b5('0x2a')](_0x2d9a95);return _0x2a77f6['set'](_0x90b5('0x30'),_0x5dc693+'-'+_0x57060b+'/'+_0x264c9b)[_0x90b5('0x31')](_0x2a0c08);}return null;};}function patchUpdates(_0x42f81f){return function(_0x27178d){try{jsonpatch[_0x90b5('0x32')](_0x27178d,_0x42f81f,!![]);}catch(_0x49609e){return BPromise[_0x90b5('0x33')](_0x49609e);}return _0x27178d['save']();};}function saveUpdates(_0x61a205,_0x8b0dfe){return function(_0x337bde){if(_0x337bde){return _0x337bde[_0x90b5('0x34')](_0x61a205)[_0x90b5('0x35')](function(_0x3a20fe){return _0x3a20fe;});}return null;};}function removeEntity(_0x162781,_0x380486){return function(_0x2bb764){if(_0x2bb764){return _0x2bb764[_0x90b5('0x36')]()['then'](function(){_0x162781[_0x90b5('0x2a')](0xcc)[_0x90b5('0x2b')]();});}};}function handleEntityNotFound(_0xa39e4c,_0x56d1bb){return function(_0x3e2d5e){if(!_0x3e2d5e){_0xa39e4c[_0x90b5('0x29')](0x194);}return _0x3e2d5e;};}function handleError(_0x29a37f,_0x5df5fe){_0x5df5fe=_0x5df5fe||0x1f4;return function(_0x493612){logger[_0x90b5('0x27')](_0x493612[_0x90b5('0x37')]);if(_0x493612[_0x90b5('0x38')]){delete _0x493612[_0x90b5('0x38')];}_0x29a37f['status'](_0x5df5fe)['send'](_0x493612);};}exports[_0x90b5('0x39')]=function(_0x1d1f69,_0x198099){var _0x423d1b={},_0x1bab32={},_0x6b2a97={'count':0x0,'rows':[]};var _0xc9c972=_['map'](db[_0x90b5('0x3a')][_0x90b5('0x3b')],function(_0x53e0e1){return{'name':_0x53e0e1[_0x90b5('0x3c')],'type':_0x53e0e1[_0x90b5('0x3d')][_0x90b5('0x3e')]};});_0x1bab32[_0x90b5('0x3f')]=_['map'](_0xc9c972,_0x90b5('0x38'));_0x1bab32[_0x90b5('0x40')]=_[_0x90b5('0x41')](_0x1d1f69[_0x90b5('0x40')]);_0x1bab32['filters']=_[_0x90b5('0x42')](_0x1bab32[_0x90b5('0x3f')],_0x1bab32[_0x90b5('0x40')]);_0x423d1b[_0x90b5('0x43')]=_[_0x90b5('0x42')](_0x1bab32[_0x90b5('0x3f')],qs[_0x90b5('0x44')](_0x1d1f69['query'][_0x90b5('0x44')]));_0x423d1b['attributes']=_0x423d1b[_0x90b5('0x43')]['length']?_0x423d1b[_0x90b5('0x43')]:_0x1bab32[_0x90b5('0x3f')];if(!_0x1d1f69[_0x90b5('0x40')][_0x90b5('0x45')](_0x90b5('0x46'))){_0x423d1b[_0x90b5('0x2f')]=qs[_0x90b5('0x2f')](_0x1d1f69[_0x90b5('0x40')]['limit']);_0x423d1b['offset']=qs[_0x90b5('0x2c')](_0x1d1f69[_0x90b5('0x40')][_0x90b5('0x2c')]);}_0x423d1b['order']=qs[_0x90b5('0x47')](_0x1d1f69[_0x90b5('0x40')][_0x90b5('0x47')]);_0x423d1b[_0x90b5('0x48')]=qs[_0x90b5('0x49')](_[_0x90b5('0x4a')](_0x1d1f69[_0x90b5('0x40')],_0x1bab32[_0x90b5('0x49')]),_0xc9c972);if(_0x1d1f69['query'][_0x90b5('0x4b')]){_0x423d1b[_0x90b5('0x48')]=_['merge'](_0x423d1b[_0x90b5('0x48')],{'$or':_[_0x90b5('0x4c')](_0xc9c972,function(_0x3b1f06){if(_0x3b1f06['type']!==_0x90b5('0x4d')){var _0x38fe19={};_0x38fe19[_0x3b1f06[_0x90b5('0x38')]]={'$like':'%'+_0x1d1f69[_0x90b5('0x40')]['filter']+'%'};return _0x38fe19;}})});}_0x423d1b=_[_0x90b5('0x4e')]({},_0x423d1b,_0x1d1f69[_0x90b5('0x4f')]);var _0x381961={'where':_0x423d1b['where']};return db['FaxMessage'][_0x90b5('0x2e')](_0x381961)[_0x90b5('0x35')](function(_0x8e42cc){_0x6b2a97[_0x90b5('0x2e')]=_0x8e42cc;if(_0x1d1f69[_0x90b5('0x40')][_0x90b5('0x50')]){_0x423d1b[_0x90b5('0x51')]=[{'all':!![]}];}return db[_0x90b5('0x3a')][_0x90b5('0x52')](_0x423d1b);})[_0x90b5('0x35')](function(_0x562483){_0x6b2a97[_0x90b5('0x53')]=_0x562483;return _0x6b2a97;})[_0x90b5('0x35')](respondWithFilteredResult(_0x198099,_0x423d1b))[_0x90b5('0x54')](handleError(_0x198099,null));};exports[_0x90b5('0x55')]=function(_0x167cbd,_0x24cf40){var _0x1b63cb={'raw':!![],'where':{'id':_0x167cbd[_0x90b5('0x56')]['id']}},_0x509aff={};_0x509aff['model']=_[_0x90b5('0x41')](db[_0x90b5('0x3a')][_0x90b5('0x3b')]);_0x509aff[_0x90b5('0x40')]=_[_0x90b5('0x41')](_0x167cbd[_0x90b5('0x40')]);_0x509aff[_0x90b5('0x49')]=_[_0x90b5('0x42')](_0x509aff['model'],_0x509aff[_0x90b5('0x40')]);_0x1b63cb['attributes']=_[_0x90b5('0x42')](_0x509aff[_0x90b5('0x3f')],qs[_0x90b5('0x44')](_0x167cbd[_0x90b5('0x40')][_0x90b5('0x44')]));_0x1b63cb[_0x90b5('0x43')]=_0x1b63cb[_0x90b5('0x43')][_0x90b5('0x57')]?_0x1b63cb[_0x90b5('0x43')]:_0x509aff[_0x90b5('0x3f')];if(_0x167cbd['query'][_0x90b5('0x50')]){_0x1b63cb['include']=[{'all':!![]}];}_0x1b63cb=_[_0x90b5('0x4e')]({},_0x1b63cb,_0x167cbd[_0x90b5('0x4f')]);return db['FaxMessage'][_0x90b5('0x58')](_0x1b63cb)[_0x90b5('0x35')](handleEntityNotFound(_0x24cf40,null))[_0x90b5('0x35')](respondWithResult(_0x24cf40,null))[_0x90b5('0x54')](handleError(_0x24cf40,null));};exports[_0x90b5('0x34')]=function(_0x196696,_0x48dee6){if(_0x196696['body']['id']){delete _0x196696[_0x90b5('0x59')]['id'];}return db[_0x90b5('0x3a')][_0x90b5('0x58')]({'where':{'id':_0x196696[_0x90b5('0x56')]['id']}})[_0x90b5('0x35')](handleEntityNotFound(_0x48dee6,null))['then'](saveUpdates(_0x196696['body'],null))[_0x90b5('0x35')](respondWithResult(_0x48dee6,null))[_0x90b5('0x54')](handleError(_0x48dee6,null));};exports[_0x90b5('0x36')]=function(_0x5a6d12,_0x3f2c62){return db[_0x90b5('0x3a')][_0x90b5('0x58')]({'where':{'id':_0x5a6d12[_0x90b5('0x56')]['id']}})[_0x90b5('0x35')](handleEntityNotFound(_0x3f2c62,null))[_0x90b5('0x35')](removeEntity(_0x3f2c62,null))[_0x90b5('0x54')](handleError(_0x3f2c62,null));};exports['describe']=function(_0x33f415,_0x1e1662){return db[_0x90b5('0x3a')][_0x90b5('0x5a')]()[_0x90b5('0x35')](respondWithResult(_0x1e1662,null))[_0x90b5('0x54')](handleError(_0x1e1662,null));};var interaction_log=require(_0x90b5('0x5b'))(_0x90b5('0x5c'));exports[_0x90b5('0x5d')]=function(_0x1a88d2,_0x2d0c33,_0x530abc){var _0x17f47e={'agent':{},'channel':_0x90b5('0x5e')};if(_0x1a88d2['body']['id']){delete _0x1a88d2[_0x90b5('0x59')]['id'];}_0x1a88d2[_0x90b5('0x59')][_0x90b5('0x5f')]=!![];_0x1a88d2[_0x90b5('0x59')][_0x90b5('0x60')]=moment()[_0x90b5('0x61')](_0x90b5('0x62'));_0x1a88d2[_0x90b5('0x59')][_0x90b5('0x63')]=_0x1a88d2['body']['UserId']||_0x1a88d2[_0x90b5('0x64')]['id'];_0x17f47e[_0x90b5('0x65')]['id']=_0x1a88d2[_0x90b5('0x59')][_0x90b5('0x63')];return db[_0x90b5('0x3a')][_0x90b5('0x58')]({'where':{'id':_0x1a88d2[_0x90b5('0x56')]['id'],'UserId':null}})[_0x90b5('0x35')](handleEntityNotFound(_0x2d0c33,null))['then'](saveUpdates(_0x1a88d2[_0x90b5('0x59')],null))[_0x90b5('0x35')](function(_0x4ff248){if(_0x4ff248){_0x17f47e[_0x90b5('0x28')]=_0x4ff248[_0x90b5('0x66')]({'plain':!![]});return db['FaxInteraction'][_0x90b5('0x58')]({'where':{'id':_0x4ff248['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2d0c33,null))[_0x90b5('0x35')](function(_0xe0d8db){if(_0xe0d8db){return _0xe0d8db[_0x90b5('0x34')]({'UserId':_0x1a88d2[_0x90b5('0x59')]['UserId'],'read1stAt':_['isNil'](_0xe0d8db['read1stAt'])?moment()[_0x90b5('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x90b5('0x35')](function(_0x15affa){if(_0x15affa){_0x17f47e[_0x90b5('0x67')]=_0x15affa['get']({'plain':!![]});interaction_log[_0x90b5('0x22')](_0x90b5('0x68'),_0x1a88d2[_0x90b5('0x64')]['id'],_0x1a88d2[_0x90b5('0x64')]['name'],_0x1a88d2[_0x90b5('0x64')][_0x90b5('0x69')],_0x17f47e[_0x90b5('0x67')]['id'],_0x1a88d2[_0x90b5('0x59')]?JSON[_0x90b5('0x6a')](_0x1a88d2[_0x90b5('0x59')]):_0x90b5('0x6b'));return respondWithRpcPromise(_0x90b5('0x6c'),_0x90b5('0x6d'),_0x17f47e);}return null;})[_0x90b5('0x35')](function(_0x4a3d1e){var _0x198d03=_0x90b5('0x6e')+_0x4a3d1e[_0x90b5('0x28')][_0x90b5('0x6f')];return db[_0x90b5('0x70')][_0x90b5('0x40')](_0x198d03,{'type':db[_0x90b5('0x71')][_0x90b5('0x72')][_0x90b5('0x73')],'raw':!![]})['then'](function(_0x9ea7ac){return _0x9ea7ac;});})[_0x90b5('0x35')](function(_0x46b6cb){if(_0x46b6cb){_0x17f47e[_0x90b5('0x28')][_0x90b5('0x74')]=_0x46b6cb[0x0];if(!_0x1a88d2['body']['UserId'])return;return db[_0x90b5('0x75')][_0x90b5('0x58')]({'where':{'id':_0x1a88d2[_0x90b5('0x59')][_0x90b5('0x63')],'role':_0x90b5('0x65')},'attributes':['id',_0x90b5('0x38'),'fullname',_0x90b5('0x76'),_0x90b5('0x77')],'raw':!![]});}return null;})['then'](function(_0xeaf4c9){if(!_0xeaf4c9)return null;_0x17f47e[_0x90b5('0x28')][_0x90b5('0x65')]=_0xeaf4c9;return _0x17f47e;})[_0x90b5('0x35')](function(_0x39cfd9){if(_0x39cfd9){if(_0x1a88d2[_0x90b5('0x59')][_0x90b5('0x78')]){_0x17f47e['message'][_0x90b5('0x79')]=util[_0x90b5('0x61')](_0x90b5('0x7a'),_0x1a88d2[_0x90b5('0x64')][_0x90b5('0x38')]);_0x17f47e[_0x90b5('0x28')][_0x90b5('0x7b')]=_0x17f47e[_0x90b5('0x7b')];_0x17f47e[_0x90b5('0x28')][_0x90b5('0x7c')]=_0x17f47e['channel'];_0x17f47e[_0x90b5('0x28')][_0x90b5('0x7d')]='accept';return respondWithRpcPromise(_0x90b5('0x7e'),_0x90b5('0x7e'),{'event':_0x90b5('0x7f'),'message':_0x17f47e[_0x90b5('0x28')]},client9002)[_0x90b5('0x35')](function(){return _0x17f47e;});}return _0x17f47e;}return null;})[_0x90b5('0x35')](respondWithResult(_0x2d0c33,null))[_0x90b5('0x54')](handleError(_0x2d0c33,null));};var interaction_log=require(_0x90b5('0x5b'))('fax-interactions');exports[_0x90b5('0x33')]=function(_0x4b4606,_0x54221f,_0x4619be){var _0x121202={'agent':{},'channel':_0x90b5('0x5e')};if(_0x4b4606[_0x90b5('0x59')]['id']){delete _0x4b4606['body']['id'];}_0x4b4606['body'][_0x90b5('0x63')]=_0x4b4606[_0x90b5('0x59')][_0x90b5('0x63')]||_0x4b4606['user']['id'];_0x121202[_0x90b5('0x65')]['id']=_0x4b4606[_0x90b5('0x59')][_0x90b5('0x63')];return db[_0x90b5('0x3a')]['find']({'where':{'id':_0x4b4606[_0x90b5('0x56')]['id'],'UserId':null}})[_0x90b5('0x35')](handleEntityNotFound(_0x54221f,null))[_0x90b5('0x35')](function(_0x22410c){if(_0x22410c){_0x121202[_0x90b5('0x28')]=_0x22410c[_0x90b5('0x66')]({'plain':!![]});return db[_0x90b5('0x80')]['find']({'where':{'id':_0x22410c[_0x90b5('0x81')]}});}return null;})['then'](handleEntityNotFound(_0x54221f,null))['then'](function(_0x10f732){if(_0x10f732){_0x121202[_0x90b5('0x67')]=_0x10f732[_0x90b5('0x66')]({'plain':!![]});interaction_log['info'](_0x90b5('0x82'),_0x4b4606[_0x90b5('0x64')]['id'],_0x4b4606[_0x90b5('0x64')][_0x90b5('0x38')],_0x4b4606[_0x90b5('0x64')]['role'],_0x121202[_0x90b5('0x67')]['id'],_0x4b4606[_0x90b5('0x59')]?JSON[_0x90b5('0x6a')](_0x4b4606[_0x90b5('0x59')]):'null');return respondWithRpcPromise(_0x90b5('0x83'),'rejectMessage',_0x121202);}return null;})[_0x90b5('0x35')](function(_0x4bffc8){var _0x3b5a8f=_0x90b5('0x6e')+_0x4bffc8[_0x90b5('0x28')]['ContactId'];return db[_0x90b5('0x70')][_0x90b5('0x40')](_0x3b5a8f,{'type':db[_0x90b5('0x71')][_0x90b5('0x72')]['SELECT'],'raw':!![]})[_0x90b5('0x35')](function(_0x4625fa){return _0x4625fa;});})[_0x90b5('0x35')](function(_0x3560b2){if(_0x3560b2){_0x121202[_0x90b5('0x28')][_0x90b5('0x74')]=_0x3560b2[0x0];if(!_0x4b4606[_0x90b5('0x59')][_0x90b5('0x63')])return;return db[_0x90b5('0x75')][_0x90b5('0x58')]({'where':{'id':_0x4b4606[_0x90b5('0x59')][_0x90b5('0x63')],'role':'agent'},'attributes':['id',_0x90b5('0x38'),_0x90b5('0x84'),_0x90b5('0x76'),_0x90b5('0x77')],'raw':!![]});}return null;})[_0x90b5('0x35')](function(_0x30d2f2){if(!_0x30d2f2)return null;_0x121202[_0x90b5('0x28')][_0x90b5('0x65')]=_0x30d2f2;return _0x121202;})[_0x90b5('0x35')](function(_0x46287d){if(_0x46287d){_0x46287d[_0x90b5('0x28')]['interface']=util['format'](_0x90b5('0x7a'),_0x4b4606[_0x90b5('0x64')][_0x90b5('0x38')]);_0x46287d['message'][_0x90b5('0x7b')]=_0x121202['channel'];_0x46287d[_0x90b5('0x28')]['motionChannel']=_0x121202[_0x90b5('0x7b')];_0x46287d[_0x90b5('0x28')][_0x90b5('0x7d')]='reject';respondWithRpcPromise(_0x90b5('0x7e'),_0x90b5('0x7e'),{'event':_0x90b5('0x85'),'message':_0x46287d[_0x90b5('0x28')]},client9002);return _0x121202;}return null;})[_0x90b5('0x35')](respondWithResult(_0x54221f,null))['catch'](handleError(_0x54221f,null));};exports[_0x90b5('0x86')]=function(_0x11e21e,_0x46e1f3){var _0x736c32;return db[_0x90b5('0x3a')][_0x90b5('0x86')](_0x11e21e[_0x90b5('0x59')],{})[_0x90b5('0x35')](function(_0x12f4e0){_0x736c32=_0x12f4e0;return db[_0x90b5('0x87')][_0x90b5('0x88')]({'where':{'id':_0x736c32[_0x90b5('0x6f')]}});})[_0x90b5('0x35')](function(_0x4f2b75){if(_['isNil'](_0x4f2b75)){return;}else{_0x736c32[_0x90b5('0x5e')]=_0x4f2b75[_0x90b5('0x5e')];return db[_0x90b5('0x89')]['findOne']({'where':{'id':_0x736c32[_0x90b5('0x8a')]}});}})['then'](function(_0x230f56){return respondWithRpcPromise('SendFax',_0x90b5('0x8b'),{'FaxAccountId':_['isNil'](_0x11e21e[_0x90b5('0x59')])?undefined:_0x11e21e['body']['FaxAccountId'],'path':_[_0x90b5('0x8c')](_0x230f56)?undefined:util[_0x90b5('0x61')](_0x90b5('0x8d'),_0x230f56[_0x90b5('0x8e')]),'fax':_[_0x90b5('0x8c')](_0x736c32['fax'])?undefined:_0x736c32[_0x90b5('0x5e')],'AttachmentId':_0x736c32[_0x90b5('0x8a')]},client9002);})['then'](respondWithResult(_0x46e1f3,0xc9))['catch'](handleError(_0x46e1f3,null));};exports['download']=function(_0x121544,_0x189ae7){var _0x1cfaaf=path[_0x90b5('0x8f')](config[_0x90b5('0x90')],_0x90b5('0x91'),_0x90b5('0x92'),_0x90b5('0x93'));return db[_0x90b5('0x3a')][_0x90b5('0x58')]({'where':{'id':_0x121544[_0x90b5('0x56')]['id']},'include':[{'model':db[_0x90b5('0x89')],'as':_0x90b5('0x89')}]})[_0x90b5('0x35')](handleEntityNotFound(_0x189ae7,null))['then'](function(_0x1d07d7){if(_0x1d07d7){return _0x189ae7[_0x90b5('0x94')](path['join'](_0x1cfaaf,_0x1d07d7[_0x90b5('0x89')]['basename']));}})['catch'](handleError(_0x189ae7,null));}; \ No newline at end of file +var _0x3b31=['offset','undefined','limit','count','set','Content-Range','save','destroy','end','stack','name','index','FaxMessage','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','params','length','include','options','find','update','body','describe','fax','read','readAt','format','UserId','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','email','manual','channel','motionChannel','accept','EventManager','acceptmessage','fax-interactions','reject','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','Sequelize','fullname','internal','interface','SIP/%s','event','rejectmessage','create','Attachment','findOne','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','join','root','attachments','download','eml-format','rimraf','request-promise','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','http','client','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','sendStatus','status','json'];(function(_0x599f1d,_0x3c4855){var _0x22c5e8=function(_0x593c3e){while(--_0x593c3e){_0x599f1d['push'](_0x599f1d['shift']());}};_0x22c5e8(++_0x3c4855);}(_0x3b31,0x64));var _0x13b3=function(_0x457fbb,_0x48e91c){_0x457fbb=_0x457fbb-0x0;var _0x80c8ec=_0x3b31[_0x457fbb];return _0x80c8ec;};'use strict';var emlformat=require(_0x13b3('0x0'));var rimraf=require(_0x13b3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x13b3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x13b3('0x3'));var util=require(_0x13b3('0x4'));var path=require(_0x13b3('0x5'));var sox=require('sox');var csv=require(_0x13b3('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x13b3('0x7'));var squel=require(_0x13b3('0x8'));var crypto=require(_0x13b3('0x9'));var jsforce=require(_0x13b3('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x13b3('0x6'));var querystring=require(_0x13b3('0xb'));var Papa=require(_0x13b3('0xc'));var Redis=require(_0x13b3('0xd'));var authService=require(_0x13b3('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x13b3('0xf'));var logger=require(_0x13b3('0x10'))(_0x13b3('0x11'));var utils=require(_0x13b3('0x12'));var config=require(_0x13b3('0x13'));var licenseUtil=require(_0x13b3('0x14'));var db=require(_0x13b3('0x15'))['db'];config['redis']=_[_0x13b3('0x16')](config[_0x13b3('0x17')],{'host':_0x13b3('0x18'),'port':0x18eb});var socket=require(_0x13b3('0x19'))(new Redis(config[_0x13b3('0x17')]));require('./faxMessage.socket')[_0x13b3('0x1a')](socket);var jayson=require(_0x13b3('0x1b'));var client=jayson['client'][_0x13b3('0x1c')]({'port':0x232c});var client9002=jayson[_0x13b3('0x1d')][_0x13b3('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x92a17d,_0x3dbe7a,_0x3c4834,_0x416ebb){return new BPromise(function(_0x1cd762,_0xf3e4df){var _0x402879=_0x416ebb||client;return _0x402879[_0x13b3('0x1e')](_0x92a17d,_0x3c4834)[_0x13b3('0x1f')](function(_0x45d0e9){logger['info'](_0x13b3('0x20'),_0x3dbe7a,_0x13b3('0x21'));logger[_0x13b3('0x22')](_0x13b3('0x23'),_0x3dbe7a,_0x13b3('0x21'),JSON['stringify'](_0x45d0e9));if(_0x45d0e9[_0x13b3('0x24')]){if(_0x45d0e9[_0x13b3('0x24')][_0x13b3('0x25')]===0x1f4){logger[_0x13b3('0x24')]('FaxMessage,\x20%s,\x20%s',_0x3dbe7a,_0x45d0e9[_0x13b3('0x24')][_0x13b3('0x26')]);return _0xf3e4df(_0x45d0e9[_0x13b3('0x24')][_0x13b3('0x26')]);}logger['error'](_0x13b3('0x20'),_0x3dbe7a,_0x45d0e9[_0x13b3('0x24')]['message']);return _0x1cd762(_0x45d0e9[_0x13b3('0x24')][_0x13b3('0x26')]);}else{logger[_0x13b3('0x27')](_0x13b3('0x20'),_0x3dbe7a,'request\x20sent');_0x1cd762(_0x45d0e9['result']['message']);}})['catch'](function(_0x3246b4){logger[_0x13b3('0x24')](_0x13b3('0x20'),_0x3dbe7a,_0x3246b4);_0xf3e4df(_0x3246b4);});});}function respondWithStatusCode(_0x28fdaf,_0x380747){_0x380747=_0x380747||0xcc;return function(_0xa8f30f){if(_0xa8f30f){return _0x28fdaf[_0x13b3('0x28')](_0x380747);}return _0x28fdaf['status'](_0x380747)['end']();};}function respondWithResult(_0x301079,_0x3ec464){_0x3ec464=_0x3ec464||0xc8;return function(_0x197b00){if(_0x197b00){return _0x301079[_0x13b3('0x29')](_0x3ec464)[_0x13b3('0x2a')](_0x197b00);}};}function respondWithFilteredResult(_0x563443,_0x429dcf){return function(_0x93d985){if(_0x93d985){var _0x47fa68=typeof _0x429dcf[_0x13b3('0x2b')]===_0x13b3('0x2c')&&typeof _0x429dcf[_0x13b3('0x2d')]===_0x13b3('0x2c');var _0x5babdc=_0x93d985[_0x13b3('0x2e')];var _0x43d4b4=_0x47fa68?0x0:_0x429dcf['offset'];var _0x46d0a1=_0x47fa68?_0x93d985[_0x13b3('0x2e')]:_0x429dcf[_0x13b3('0x2b')]+_0x429dcf[_0x13b3('0x2d')];var _0xa78083;if(_0x46d0a1>=_0x5babdc){_0x46d0a1=_0x5babdc;_0xa78083=0xc8;}else{_0xa78083=0xce;}_0x563443['status'](_0xa78083);return _0x563443[_0x13b3('0x2f')](_0x13b3('0x30'),_0x43d4b4+'-'+_0x46d0a1+'/'+_0x5babdc)[_0x13b3('0x2a')](_0x93d985);}return null;};}function patchUpdates(_0x321c37){return function(_0x745ea9){try{jsonpatch['apply'](_0x745ea9,_0x321c37,!![]);}catch(_0x48e261){return BPromise['reject'](_0x48e261);}return _0x745ea9[_0x13b3('0x31')]();};}function saveUpdates(_0x14906d,_0x41618b){return function(_0x2fa39c){if(_0x2fa39c){return _0x2fa39c['update'](_0x14906d)['then'](function(_0x31feba){return _0x31feba;});}return null;};}function removeEntity(_0x2fddc7,_0x54335d){return function(_0x2d7182){if(_0x2d7182){return _0x2d7182[_0x13b3('0x32')]()[_0x13b3('0x1f')](function(){_0x2fddc7[_0x13b3('0x29')](0xcc)[_0x13b3('0x33')]();});}};}function handleEntityNotFound(_0xd7dc20,_0x33873a){return function(_0x2de517){if(!_0x2de517){_0xd7dc20[_0x13b3('0x28')](0x194);}return _0x2de517;};}function handleError(_0x55f5d4,_0x55219a){_0x55219a=_0x55219a||0x1f4;return function(_0x152fa5){logger[_0x13b3('0x24')](_0x152fa5[_0x13b3('0x34')]);if(_0x152fa5['name']){delete _0x152fa5[_0x13b3('0x35')];}_0x55f5d4['status'](_0x55219a)['send'](_0x152fa5);};}exports[_0x13b3('0x36')]=function(_0x39c842,_0x32ec0e){var _0x3b76bd={},_0x6eb1af={},_0xdc904b={'count':0x0,'rows':[]};var _0x586681=_['map'](db[_0x13b3('0x37')][_0x13b3('0x38')],function(_0x4b6058){return{'name':_0x4b6058[_0x13b3('0x39')],'type':_0x4b6058[_0x13b3('0x3a')]['key']};});_0x6eb1af[_0x13b3('0x3b')]=_[_0x13b3('0x3c')](_0x586681,_0x13b3('0x35'));_0x6eb1af[_0x13b3('0x3d')]=_[_0x13b3('0x3e')](_0x39c842['query']);_0x6eb1af[_0x13b3('0x3f')]=_[_0x13b3('0x40')](_0x6eb1af[_0x13b3('0x3b')],_0x6eb1af[_0x13b3('0x3d')]);_0x3b76bd[_0x13b3('0x41')]=_['intersection'](_0x6eb1af[_0x13b3('0x3b')],qs[_0x13b3('0x42')](_0x39c842[_0x13b3('0x3d')][_0x13b3('0x42')]));_0x3b76bd[_0x13b3('0x41')]=_0x3b76bd['attributes']['length']?_0x3b76bd[_0x13b3('0x41')]:_0x6eb1af[_0x13b3('0x3b')];if(!_0x39c842['query'][_0x13b3('0x43')]('nolimit')){_0x3b76bd[_0x13b3('0x2d')]=qs[_0x13b3('0x2d')](_0x39c842[_0x13b3('0x3d')][_0x13b3('0x2d')]);_0x3b76bd[_0x13b3('0x2b')]=qs[_0x13b3('0x2b')](_0x39c842[_0x13b3('0x3d')][_0x13b3('0x2b')]);}_0x3b76bd[_0x13b3('0x44')]=qs[_0x13b3('0x45')](_0x39c842['query'][_0x13b3('0x45')]);_0x3b76bd[_0x13b3('0x46')]=qs[_0x13b3('0x3f')](_[_0x13b3('0x47')](_0x39c842['query'],_0x6eb1af[_0x13b3('0x3f')]),_0x586681);if(_0x39c842['query'][_0x13b3('0x48')]){_0x3b76bd[_0x13b3('0x46')]=_[_0x13b3('0x49')](_0x3b76bd[_0x13b3('0x46')],{'$or':_['map'](_0x586681,function(_0x151bec){if(_0x151bec[_0x13b3('0x3a')]!=='VIRTUAL'){var _0x37ae6e={};_0x37ae6e[_0x151bec[_0x13b3('0x35')]]={'$like':'%'+_0x39c842[_0x13b3('0x3d')][_0x13b3('0x48')]+'%'};return _0x37ae6e;}})});}_0x3b76bd=_[_0x13b3('0x49')]({},_0x3b76bd,_0x39c842['options']);var _0x1a1d06={'where':_0x3b76bd[_0x13b3('0x46')]};return db[_0x13b3('0x37')][_0x13b3('0x2e')](_0x1a1d06)[_0x13b3('0x1f')](function(_0xb26ca4){_0xdc904b['count']=_0xb26ca4;if(_0x39c842[_0x13b3('0x3d')][_0x13b3('0x4a')]){_0x3b76bd['include']=[{'all':!![]}];}return db[_0x13b3('0x37')][_0x13b3('0x4b')](_0x3b76bd);})[_0x13b3('0x1f')](function(_0x3e8079){_0xdc904b[_0x13b3('0x4c')]=_0x3e8079;return _0xdc904b;})['then'](respondWithFilteredResult(_0x32ec0e,_0x3b76bd))[_0x13b3('0x4d')](handleError(_0x32ec0e,null));};exports[_0x13b3('0x4e')]=function(_0x4910fb,_0xc448c7){var _0x1627c4={'raw':!![],'where':{'id':_0x4910fb[_0x13b3('0x4f')]['id']}},_0x22aab4={};_0x22aab4[_0x13b3('0x3b')]=_['keys'](db[_0x13b3('0x37')][_0x13b3('0x38')]);_0x22aab4[_0x13b3('0x3d')]=_[_0x13b3('0x3e')](_0x4910fb[_0x13b3('0x3d')]);_0x22aab4[_0x13b3('0x3f')]=_['intersection'](_0x22aab4[_0x13b3('0x3b')],_0x22aab4[_0x13b3('0x3d')]);_0x1627c4[_0x13b3('0x41')]=_[_0x13b3('0x40')](_0x22aab4[_0x13b3('0x3b')],qs[_0x13b3('0x42')](_0x4910fb['query'][_0x13b3('0x42')]));_0x1627c4['attributes']=_0x1627c4[_0x13b3('0x41')][_0x13b3('0x50')]?_0x1627c4[_0x13b3('0x41')]:_0x22aab4[_0x13b3('0x3b')];if(_0x4910fb[_0x13b3('0x3d')][_0x13b3('0x4a')]){_0x1627c4[_0x13b3('0x51')]=[{'all':!![]}];}_0x1627c4=_['merge']({},_0x1627c4,_0x4910fb[_0x13b3('0x52')]);return db[_0x13b3('0x37')][_0x13b3('0x53')](_0x1627c4)[_0x13b3('0x1f')](handleEntityNotFound(_0xc448c7,null))[_0x13b3('0x1f')](respondWithResult(_0xc448c7,null))[_0x13b3('0x4d')](handleError(_0xc448c7,null));};exports[_0x13b3('0x54')]=function(_0x394a36,_0x522229){if(_0x394a36[_0x13b3('0x55')]['id']){delete _0x394a36[_0x13b3('0x55')]['id'];}return db[_0x13b3('0x37')]['find']({'where':{'id':_0x394a36[_0x13b3('0x4f')]['id']}})[_0x13b3('0x1f')](handleEntityNotFound(_0x522229,null))[_0x13b3('0x1f')](saveUpdates(_0x394a36[_0x13b3('0x55')],null))[_0x13b3('0x1f')](respondWithResult(_0x522229,null))[_0x13b3('0x4d')](handleError(_0x522229,null));};exports[_0x13b3('0x32')]=function(_0x3d1597,_0xda451e){return db[_0x13b3('0x37')][_0x13b3('0x53')]({'where':{'id':_0x3d1597[_0x13b3('0x4f')]['id']}})[_0x13b3('0x1f')](handleEntityNotFound(_0xda451e,null))[_0x13b3('0x1f')](removeEntity(_0xda451e,null))[_0x13b3('0x4d')](handleError(_0xda451e,null));};exports['describe']=function(_0x2fa894,_0x32183f){return db[_0x13b3('0x37')][_0x13b3('0x56')]()['then'](respondWithResult(_0x32183f,null))['catch'](handleError(_0x32183f,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports['accept']=function(_0x4bd2f6,_0x118d00,_0x4f41f4){var _0x4e5cb5={'agent':{},'channel':_0x13b3('0x57')};if(_0x4bd2f6['body']['id']){delete _0x4bd2f6[_0x13b3('0x55')]['id'];}_0x4bd2f6[_0x13b3('0x55')][_0x13b3('0x58')]=!![];_0x4bd2f6[_0x13b3('0x55')][_0x13b3('0x59')]=moment()[_0x13b3('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x4bd2f6[_0x13b3('0x55')][_0x13b3('0x5b')]=_0x4bd2f6['body']['UserId']||_0x4bd2f6['user']['id'];_0x4e5cb5[_0x13b3('0x5c')]['id']=_0x4bd2f6[_0x13b3('0x55')][_0x13b3('0x5b')];return db['FaxMessage'][_0x13b3('0x53')]({'where':{'id':_0x4bd2f6[_0x13b3('0x4f')]['id'],'UserId':null}})[_0x13b3('0x1f')](handleEntityNotFound(_0x118d00,null))['then'](saveUpdates(_0x4bd2f6['body'],null))[_0x13b3('0x1f')](function(_0x4cca0e){if(_0x4cca0e){_0x4e5cb5[_0x13b3('0x26')]=_0x4cca0e[_0x13b3('0x5d')]({'plain':!![]});return db[_0x13b3('0x5e')][_0x13b3('0x53')]({'where':{'id':_0x4cca0e[_0x13b3('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x118d00,null))[_0x13b3('0x1f')](function(_0x4b29f8){if(_0x4b29f8){return _0x4b29f8[_0x13b3('0x54')]({'UserId':_0x4bd2f6[_0x13b3('0x55')]['UserId'],'read1stAt':_[_0x13b3('0x60')](_0x4b29f8[_0x13b3('0x61')])?moment()[_0x13b3('0x5a')](_0x13b3('0x62')):undefined});}return null;})[_0x13b3('0x1f')](function(_0x476390){if(_0x476390){_0x4e5cb5[_0x13b3('0x63')]=_0x476390[_0x13b3('0x5d')]({'plain':!![]});interaction_log[_0x13b3('0x27')](_0x13b3('0x64'),_0x4bd2f6[_0x13b3('0x65')]['id'],_0x4bd2f6[_0x13b3('0x65')][_0x13b3('0x35')],_0x4bd2f6['user'][_0x13b3('0x66')],_0x4e5cb5[_0x13b3('0x63')]['id'],_0x4bd2f6[_0x13b3('0x55')]?JSON[_0x13b3('0x67')](_0x4bd2f6[_0x13b3('0x55')]):_0x13b3('0x68'));return respondWithRpcPromise(_0x13b3('0x69'),_0x13b3('0x6a'),_0x4e5cb5);}return null;})[_0x13b3('0x1f')](function(_0x45d012){var _0x2d5759=_0x13b3('0x6b')+_0x45d012[_0x13b3('0x26')][_0x13b3('0x6c')];return db[_0x13b3('0x6d')][_0x13b3('0x3d')](_0x2d5759,{'type':db['Sequelize'][_0x13b3('0x6e')][_0x13b3('0x6f')],'raw':!![]})['then'](function(_0x3db232){return _0x3db232;});})[_0x13b3('0x1f')](function(_0x28f943){if(_0x28f943){_0x4e5cb5[_0x13b3('0x26')][_0x13b3('0x70')]=_0x28f943[0x0];if(!_0x4bd2f6[_0x13b3('0x55')][_0x13b3('0x5b')])return;return db[_0x13b3('0x71')]['find']({'where':{'id':_0x4bd2f6[_0x13b3('0x55')][_0x13b3('0x5b')],'role':'agent'},'attributes':['id',_0x13b3('0x35'),'fullname',_0x13b3('0x72'),'internal'],'raw':!![]});}return null;})['then'](function(_0x2f61e8){if(!_0x2f61e8)return null;_0x4e5cb5['message'][_0x13b3('0x5c')]=_0x2f61e8;return _0x4e5cb5;})[_0x13b3('0x1f')](function(_0x52cd7d){if(_0x52cd7d){if(_0x4bd2f6[_0x13b3('0x55')][_0x13b3('0x73')]){_0x4e5cb5['message']['interface']=util[_0x13b3('0x5a')]('SIP/%s',_0x4bd2f6[_0x13b3('0x65')][_0x13b3('0x35')]);_0x4e5cb5['message'][_0x13b3('0x74')]=_0x4e5cb5[_0x13b3('0x74')];_0x4e5cb5[_0x13b3('0x26')][_0x13b3('0x75')]=_0x4e5cb5[_0x13b3('0x74')];_0x4e5cb5['message']['event']=_0x13b3('0x76');return respondWithRpcPromise(_0x13b3('0x77'),_0x13b3('0x77'),{'event':_0x13b3('0x78'),'message':_0x4e5cb5[_0x13b3('0x26')]},client9002)[_0x13b3('0x1f')](function(){return _0x4e5cb5;});}return _0x4e5cb5;}return null;})[_0x13b3('0x1f')](respondWithResult(_0x118d00,null))['catch'](handleError(_0x118d00,null));};var interaction_log=require('../../config/logger')(_0x13b3('0x79'));exports[_0x13b3('0x7a')]=function(_0x3028b3,_0x56f08b,_0x3e34b8){var _0x15b4d9={'agent':{},'channel':'fax'};if(_0x3028b3[_0x13b3('0x55')]['id']){delete _0x3028b3[_0x13b3('0x55')]['id'];}_0x3028b3[_0x13b3('0x55')][_0x13b3('0x5b')]=_0x3028b3['body'][_0x13b3('0x5b')]||_0x3028b3['user']['id'];_0x15b4d9[_0x13b3('0x5c')]['id']=_0x3028b3['body']['UserId'];return db[_0x13b3('0x37')][_0x13b3('0x53')]({'where':{'id':_0x3028b3[_0x13b3('0x4f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x56f08b,null))[_0x13b3('0x1f')](function(_0x2d663f){if(_0x2d663f){_0x15b4d9[_0x13b3('0x26')]=_0x2d663f[_0x13b3('0x5d')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x2d663f[_0x13b3('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x56f08b,null))[_0x13b3('0x1f')](function(_0x579ea7){if(_0x579ea7){_0x15b4d9[_0x13b3('0x63')]=_0x579ea7['get']({'plain':!![]});interaction_log[_0x13b3('0x27')](_0x13b3('0x7b'),_0x3028b3[_0x13b3('0x65')]['id'],_0x3028b3[_0x13b3('0x65')][_0x13b3('0x35')],_0x3028b3[_0x13b3('0x65')][_0x13b3('0x66')],_0x15b4d9['interaction']['id'],_0x3028b3['body']?JSON['stringify'](_0x3028b3[_0x13b3('0x55')]):_0x13b3('0x68'));return respondWithRpcPromise(_0x13b3('0x7c'),'rejectMessage',_0x15b4d9);}return null;})[_0x13b3('0x1f')](function(_0x512fba){var _0x2b48fe=_0x13b3('0x6b')+_0x512fba[_0x13b3('0x26')][_0x13b3('0x6c')];return db[_0x13b3('0x6d')][_0x13b3('0x3d')](_0x2b48fe,{'type':db[_0x13b3('0x7d')][_0x13b3('0x6e')][_0x13b3('0x6f')],'raw':!![]})[_0x13b3('0x1f')](function(_0x36a83f){return _0x36a83f;});})['then'](function(_0x4c7861){if(_0x4c7861){_0x15b4d9[_0x13b3('0x26')][_0x13b3('0x70')]=_0x4c7861[0x0];if(!_0x3028b3[_0x13b3('0x55')][_0x13b3('0x5b')])return;return db[_0x13b3('0x71')]['find']({'where':{'id':_0x3028b3[_0x13b3('0x55')][_0x13b3('0x5b')],'role':'agent'},'attributes':['id',_0x13b3('0x35'),_0x13b3('0x7e'),'email',_0x13b3('0x7f')],'raw':!![]});}return null;})[_0x13b3('0x1f')](function(_0x386281){if(!_0x386281)return null;_0x15b4d9['message'][_0x13b3('0x5c')]=_0x386281;return _0x15b4d9;})[_0x13b3('0x1f')](function(_0x2eb878){if(_0x2eb878){_0x2eb878[_0x13b3('0x26')][_0x13b3('0x80')]=util[_0x13b3('0x5a')](_0x13b3('0x81'),_0x3028b3['user']['name']);_0x2eb878[_0x13b3('0x26')]['channel']=_0x15b4d9[_0x13b3('0x74')];_0x2eb878[_0x13b3('0x26')][_0x13b3('0x75')]=_0x15b4d9[_0x13b3('0x74')];_0x2eb878[_0x13b3('0x26')][_0x13b3('0x82')]='reject';respondWithRpcPromise(_0x13b3('0x77'),_0x13b3('0x77'),{'event':_0x13b3('0x83'),'message':_0x2eb878[_0x13b3('0x26')]},client9002);return _0x15b4d9;}return null;})[_0x13b3('0x1f')](respondWithResult(_0x56f08b,null))[_0x13b3('0x4d')](handleError(_0x56f08b,null));};exports[_0x13b3('0x84')]=function(_0x454ff0,_0x1dcf8e){var _0x40540f;return db['FaxMessage']['create'](_0x454ff0[_0x13b3('0x55')],{})[_0x13b3('0x1f')](function(_0x5adf61){_0x40540f=_0x5adf61;return db['CmContact']['findOne']({'where':{'id':_0x40540f[_0x13b3('0x6c')]}});})[_0x13b3('0x1f')](function(_0x5da398){if(_[_0x13b3('0x60')](_0x5da398)){return;}else{_0x40540f[_0x13b3('0x57')]=_0x5da398[_0x13b3('0x57')];return db[_0x13b3('0x85')][_0x13b3('0x86')]({'where':{'id':_0x40540f['AttachmentId']}});}})[_0x13b3('0x1f')](function(_0x102e04){return respondWithRpcPromise(_0x13b3('0x87'),_0x13b3('0x87'),{'FaxAccountId':_['isNil'](_0x454ff0['body'])?undefined:_0x454ff0[_0x13b3('0x55')]['FaxAccountId'],'path':_[_0x13b3('0x60')](_0x102e04)?undefined:util[_0x13b3('0x5a')](_0x13b3('0x88'),_0x102e04[_0x13b3('0x89')]),'fax':_['isNil'](_0x40540f[_0x13b3('0x57')])?undefined:_0x40540f[_0x13b3('0x57')],'AttachmentId':_0x40540f[_0x13b3('0x8a')]},client9002);})[_0x13b3('0x1f')](respondWithResult(_0x1dcf8e,0xc9))['catch'](handleError(_0x1dcf8e,null));};exports['download']=function(_0x20cd02,_0x3aa24d){var _0x55e082=path[_0x13b3('0x8b')](config[_0x13b3('0x8c')],'server','files',_0x13b3('0x8d'));return db[_0x13b3('0x37')][_0x13b3('0x53')]({'where':{'id':_0x20cd02[_0x13b3('0x4f')]['id']},'include':[{'model':db[_0x13b3('0x85')],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x3aa24d,null))[_0x13b3('0x1f')](function(_0x2a1080){if(_0x2a1080){return _0x3aa24d[_0x13b3('0x8e')](path[_0x13b3('0x8b')](_0x55e082,_0x2a1080[_0x13b3('0x85')]['basename']));}})['catch'](handleError(_0x3aa24d,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 2622640..17ac773 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 _0xa3e8=['FaxMessage','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x541a67,_0x50728d){var _0x45da2a=function(_0x158929){while(--_0x158929){_0x541a67['push'](_0x541a67['shift']());}};_0x45da2a(++_0x50728d);}(_0xa3e8,0x127));var _0x8a3e=function(_0x234a96,_0x55e516){_0x234a96=_0x234a96-0x0;var _0x2f0db0=_0xa3e8[_0x234a96];return _0x2f0db0;};'use strict';var EventEmitter=require(_0x8a3e('0x0'));var FaxMessage=require(_0x8a3e('0x1'))['db'][_0x8a3e('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8a3e('0x3'),'afterUpdate':_0x8a3e('0x4'),'afterDestroy':_0x8a3e('0x5')};function emitEvent(_0xe6cae2){return function(_0x109d7a,_0x5a81bb,_0x4889a0){FaxMessageEvents['emit'](_0xe6cae2+':'+_0x109d7a['id'],_0x109d7a);FaxMessageEvents[_0x8a3e('0x6')](_0xe6cae2,_0x109d7a);_0x4889a0(null);};}for(var e in events){if(events[_0x8a3e('0x7')](e)){var event=events[e];FaxMessage[_0x8a3e('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0xed54=['../../mysqldb','FaxMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x362294,_0x97ed88){var _0x277a51=function(_0x27d774){while(--_0x27d774){_0x362294['push'](_0x362294['shift']());}};_0x277a51(++_0x97ed88);}(_0xed54,0xfc));var _0x4ed5=function(_0x2c3ad9,_0x757aa3){_0x2c3ad9=_0x2c3ad9-0x0;var _0x268ca8=_0xed54[_0x2c3ad9];return _0x268ca8;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x4ed5('0x0'))['db'][_0x4ed5('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x4ed5('0x2')](0x0);var events={'afterCreate':_0x4ed5('0x3'),'afterUpdate':'update','afterDestroy':_0x4ed5('0x4')};function emitEvent(_0x39d4d7){return function(_0x5f4777,_0x5c6d8b,_0xf1fb13){FaxMessageEvents[_0x4ed5('0x5')](_0x39d4d7+':'+_0x5f4777['id'],_0x5f4777);FaxMessageEvents[_0x4ed5('0x5')](_0x39d4d7,_0x5f4777);_0xf1fb13(null);};}for(var e in events){if(events[_0x4ed5('0x6')](e)){var event=events[e];FaxMessage[_0x4ed5('0x7')](e,emitEvent(event));}}module[_0x4ed5('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 8362387..66fd7b7 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 _0x8312=['body','FULLTEXT','models','get','toLowerCase','direction','out','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fax_messages'];(function(_0x5cc4b6,_0x2dd6a0){var _0x1e52b1=function(_0x1edb0d){while(--_0x1edb0d){_0x5cc4b6['push'](_0x5cc4b6['shift']());}};_0x1e52b1(++_0x2dd6a0);}(_0x8312,0x168));var _0x2831=function(_0x559a88,_0x175005){_0x559a88=_0x559a88-0x0;var _0x5a1e6f=_0x8312[_0x559a88];return _0x5a1e6f;};'use strict';var _=require('lodash');var util=require(_0x2831('0x0'));var logger=require(_0x2831('0x1'))(_0x2831('0x2'));var moment=require('moment');var BPromise=require(_0x2831('0x3'));var rp=require(_0x2831('0x4'));var fs=require('fs');var path=require(_0x2831('0x5'));var rimraf=require(_0x2831('0x6'));var config=require('../../config/environment');var attributes=require(_0x2831('0x7'));module[_0x2831('0x8')]=function(_0x19f14c,_0x1a5b58){return _0x19f14c[_0x2831('0x9')](_0x2831('0xa'),attributes,{'tableName':_0x2831('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x2831('0xc')],'type':_0x2831('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x93700f,_0x24b566,_0x3cfde5){var _0x35e93f=_0x19f14c[_0x2831('0xe')];var _0xce67bd=_0x93700f[_0x2831('0xf')]({'plain':!![]});if(_0xce67bd['direction'][_0x2831('0x10')]()==='in'||_0xce67bd[_0x2831('0x11')]['toLowerCase']()===_0x2831('0x12')&&!_0xce67bd['secret']&&!_[_0x2831('0x13')](_0xce67bd[_0x2831('0x14')])){_0x35e93f[_0x2831('0x15')][_0x2831('0x16')]({'where':{'id':_0xce67bd[_0x2831('0x17')]}})[_0x2831('0x18')](function(_0x222c80){if(_0x222c80){_0x222c80[_0x2831('0x19')]({'lastMsgAt':_0xce67bd[_0x2831('0x1a')],'lastMsgDirection':_0xce67bd[_0x2831('0x11')][_0x2831('0x10')]()});}})[_0x2831('0x1b')](function(_0x4cc54c){console[_0x2831('0x1c')](_0x4cc54c);});}_0x3cfde5();}},'charset':_0x2831('0x1d'),'collate':_0x2831('0x1e')});}; \ No newline at end of file +var _0x006b=['path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x006b,0x1ba));var _0xb006=function(_0x115865,_0x1f62c0){_0x115865=_0x115865-0x0;var _0x218bfa=_0x006b[_0x115865];return _0x218bfa;};'use strict';var _=require(_0xb006('0x0'));var util=require(_0xb006('0x1'));var logger=require('../../config/logger')(_0xb006('0x2'));var moment=require(_0xb006('0x3'));var BPromise=require(_0xb006('0x4'));var rp=require(_0xb006('0x5'));var fs=require('fs');var path=require(_0xb006('0x6'));var rimraf=require(_0xb006('0x7'));var config=require(_0xb006('0x8'));var attributes=require(_0xb006('0x9'));module[_0xb006('0xa')]=function(_0x2e62e4,_0xfe970f){return _0x2e62e4[_0xb006('0xb')](_0xb006('0xc'),attributes,{'tableName':_0xb006('0xd'),'paranoid':![],'indexes':[{'name':_0xb006('0xe'),'fields':[_0xb006('0xf')],'type':_0xb006('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x184188,_0x4b99f6,_0x1ad1b2){var _0x591e2e=_0x2e62e4[_0xb006('0x11')];var _0x4dcaf3=_0x184188[_0xb006('0x12')]({'plain':!![]});if(_0x4dcaf3[_0xb006('0x13')][_0xb006('0x14')]()==='in'||_0x4dcaf3[_0xb006('0x13')][_0xb006('0x14')]()===_0xb006('0x15')&&!_0x4dcaf3[_0xb006('0x16')]&&!_[_0xb006('0x17')](_0x4dcaf3[_0xb006('0x18')])){_0x591e2e['FaxInteraction']['findOne']({'where':{'id':_0x4dcaf3['FaxInteractionId']}})[_0xb006('0x19')](function(_0x3f4980){if(_0x3f4980){_0x3f4980[_0xb006('0x1a')]({'lastMsgAt':_0x4dcaf3[_0xb006('0x1b')],'lastMsgDirection':_0x4dcaf3[_0xb006('0x13')]['toLowerCase']()});}})[_0xb006('0x1c')](function(_0x3467d1){console[_0xb006('0x1d')](_0x3467d1);});}_0x1ad1b2();}},'charset':_0xb006('0x1e'),'collate':_0xb006('0x1f')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index b9ce6b2..ac7d68d 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 _0x2dae=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxMessage,\x20%s,\x20%s','result','catch','CreateFaxMessage','FaxMessage','create','body','options','debug','UpdateFaxMessage','update','raw','attributes'];(function(_0x280f4a,_0x2ed8d6){var _0x1bb157=function(_0x37de94){while(--_0x37de94){_0x280f4a['push'](_0x280f4a['shift']());}};_0x1bb157(++_0x2ed8d6);}(_0x2dae,0xc3));var _0xe2da=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0x2dae[_0x11a220];return _0x20d8fe;};'use strict';var _=require(_0xe2da('0x0'));var util=require('util');var moment=require(_0xe2da('0x1'));var BPromise=require(_0xe2da('0x2'));var rs=require(_0xe2da('0x3'));var fs=require('fs');var Redis=require(_0xe2da('0x4'));var db=require(_0xe2da('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe2da('0x6'))(_0xe2da('0x7'));var config=require(_0xe2da('0x8'));var jayson=require(_0xe2da('0x9'));var client=jayson['client'][_0xe2da('0xa')]({'port':0x232a});config[_0xe2da('0xb')]=_[_0xe2da('0xc')](config[_0xe2da('0xb')],{'host':_0xe2da('0xd'),'port':0x18eb});var socket=require(_0xe2da('0xe'))(new Redis(config[_0xe2da('0xb')]));require(_0xe2da('0xf'))[_0xe2da('0x10')](socket);function respondWithRpcPromise(_0x5a2fc5,_0x52e650,_0x3baaa8){return new BPromise(function(_0x104fb3,_0x17086c){return client[_0xe2da('0x11')](_0x5a2fc5,_0x3baaa8)[_0xe2da('0x12')](function(_0x1a29b9){logger[_0xe2da('0x13')]('FaxMessage,\x20%s,\x20%s',_0x52e650,_0xe2da('0x14'));logger['debug'](_0xe2da('0x15'),_0x52e650,_0xe2da('0x14'),JSON[_0xe2da('0x16')](_0x1a29b9));if(_0x1a29b9[_0xe2da('0x17')]){if(_0x1a29b9[_0xe2da('0x17')][_0xe2da('0x18')]===0x1f4){logger[_0xe2da('0x17')]('FaxMessage,\x20%s,\x20%s',_0x52e650,_0x1a29b9[_0xe2da('0x17')]['message']);return _0x17086c(_0x1a29b9['error'][_0xe2da('0x19')]);}logger[_0xe2da('0x17')](_0xe2da('0x1a'),_0x52e650,_0x1a29b9['error'][_0xe2da('0x19')]);return _0x104fb3(_0x1a29b9[_0xe2da('0x17')][_0xe2da('0x19')]);}else{logger[_0xe2da('0x13')]('FaxMessage,\x20%s,\x20%s',_0x52e650,_0xe2da('0x14'));_0x104fb3(_0x1a29b9[_0xe2da('0x1b')][_0xe2da('0x19')]);}})[_0xe2da('0x1c')](function(_0x329ffe){logger['error'](_0xe2da('0x1a'),_0x52e650,_0x329ffe);_0x17086c(_0x329ffe);});});}exports[_0xe2da('0x1d')]=function(_0x538d96){var _0x1a9324=this;return new Promise(function(_0x254b37,_0x332193){return db[_0xe2da('0x1e')][_0xe2da('0x1f')](_0x538d96[_0xe2da('0x20')],{'raw':_0x538d96['options']?_0x538d96[_0xe2da('0x21')]['raw']===undefined?!![]:![]:!![]})[_0xe2da('0x12')](function(_0x191d38){logger[_0xe2da('0x13')](_0xe2da('0x1d'),_0x538d96);logger[_0xe2da('0x22')](_0xe2da('0x1d'),_0x538d96,JSON[_0xe2da('0x16')](_0x191d38));_0x254b37(_0x191d38);})[_0xe2da('0x1c')](function(_0x5a08d6){logger[_0xe2da('0x17')](_0xe2da('0x1d'),_0x5a08d6[_0xe2da('0x19')],_0x538d96);_0x332193(_0x1a9324[_0xe2da('0x17')](0x1f4,_0x5a08d6[_0xe2da('0x19')]));});});};exports[_0xe2da('0x23')]=function(_0x124d93){var _0x56c37e=this;return new Promise(function(_0x2adc49,_0x3e23d7){return db[_0xe2da('0x1e')][_0xe2da('0x24')](_0x124d93[_0xe2da('0x20')],{'raw':_0x124d93[_0xe2da('0x21')]?_0x124d93[_0xe2da('0x21')][_0xe2da('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x124d93['options']?_0x124d93['options']['where']||null:null,'attributes':_0x124d93[_0xe2da('0x21')]?_0x124d93[_0xe2da('0x21')][_0xe2da('0x26')]||null:null,'limit':_0x124d93[_0xe2da('0x21')]?_0x124d93['options']['limit']||null:null})[_0xe2da('0x12')](function(_0x1ec8ca){logger[_0xe2da('0x13')](_0xe2da('0x23'),_0x124d93);logger[_0xe2da('0x22')](_0xe2da('0x23'),_0x124d93,JSON[_0xe2da('0x16')](_0x1ec8ca));_0x2adc49(_0x1ec8ca);})[_0xe2da('0x1c')](function(_0x461610){logger['error']('UpdateFaxMessage',_0x461610[_0xe2da('0x19')],_0x124d93);_0x3e23d7(_0x56c37e[_0xe2da('0x17')](0x1f4,_0x461610[_0xe2da('0x19')]));});});}; \ No newline at end of file +var _0xfd28=['message','info','catch','create','body','options','then','CreateFaxMessage','UpdateFaxMessage','FaxMessage','raw','where','attributes','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3f504f,_0xcc28dc){var _0x5ca3ba=function(_0x5e79da){while(--_0x5e79da){_0x3f504f['push'](_0x3f504f['shift']());}};_0x5ca3ba(++_0xcc28dc);}(_0xfd28,0x148));var _0x8fd2=function(_0x1e9424,_0x191cba){_0x1e9424=_0x1e9424-0x0;var _0x1bd96c=_0xfd28[_0x1e9424];return _0x1bd96c;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var moment=require(_0x8fd2('0x1'));var BPromise=require('bluebird');var rs=require(_0x8fd2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fd2('0x3'))['db'];var utils=require(_0x8fd2('0x4'));var logger=require(_0x8fd2('0x5'))('rpc');var config=require(_0x8fd2('0x6'));var jayson=require(_0x8fd2('0x7'));var client=jayson[_0x8fd2('0x8')][_0x8fd2('0x9')]({'port':0x232a});config[_0x8fd2('0xa')]=_['defaults'](config['redis'],{'host':_0x8fd2('0xb'),'port':0x18eb});var socket=require(_0x8fd2('0xc'))(new Redis(config[_0x8fd2('0xa')]));require('./faxMessage.socket')[_0x8fd2('0xd')](socket);function respondWithRpcPromise(_0x49ca87,_0x2842f3,_0x5aabf0){return new BPromise(function(_0x34ae5c,_0x4fdf0b){return client[_0x8fd2('0xe')](_0x49ca87,_0x5aabf0)['then'](function(_0x1b6558){logger['info'](_0x8fd2('0xf'),_0x2842f3,_0x8fd2('0x10'));logger[_0x8fd2('0x11')](_0x8fd2('0x12'),_0x2842f3,_0x8fd2('0x10'),JSON[_0x8fd2('0x13')](_0x1b6558));if(_0x1b6558[_0x8fd2('0x14')]){if(_0x1b6558[_0x8fd2('0x14')][_0x8fd2('0x15')]===0x1f4){logger[_0x8fd2('0x14')](_0x8fd2('0xf'),_0x2842f3,_0x1b6558[_0x8fd2('0x14')][_0x8fd2('0x16')]);return _0x4fdf0b(_0x1b6558[_0x8fd2('0x14')][_0x8fd2('0x16')]);}logger['error'](_0x8fd2('0xf'),_0x2842f3,_0x1b6558['error']['message']);return _0x34ae5c(_0x1b6558['error'][_0x8fd2('0x16')]);}else{logger[_0x8fd2('0x17')](_0x8fd2('0xf'),_0x2842f3,_0x8fd2('0x10'));_0x34ae5c(_0x1b6558['result'][_0x8fd2('0x16')]);}})[_0x8fd2('0x18')](function(_0x411943){logger[_0x8fd2('0x14')](_0x8fd2('0xf'),_0x2842f3,_0x411943);_0x4fdf0b(_0x411943);});});}exports['CreateFaxMessage']=function(_0x48ad51){var _0x3a0939=this;return new Promise(function(_0x4a2002,_0x3c03de){return db['FaxMessage'][_0x8fd2('0x19')](_0x48ad51[_0x8fd2('0x1a')],{'raw':_0x48ad51['options']?_0x48ad51[_0x8fd2('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x8fd2('0x1c')](function(_0x44ee7a){logger['info'](_0x8fd2('0x1d'),_0x48ad51);logger[_0x8fd2('0x11')](_0x8fd2('0x1d'),_0x48ad51,JSON['stringify'](_0x44ee7a));_0x4a2002(_0x44ee7a);})[_0x8fd2('0x18')](function(_0x3b9e2f){logger[_0x8fd2('0x14')](_0x8fd2('0x1d'),_0x3b9e2f[_0x8fd2('0x16')],_0x48ad51);_0x3c03de(_0x3a0939[_0x8fd2('0x14')](0x1f4,_0x3b9e2f[_0x8fd2('0x16')]));});});};exports[_0x8fd2('0x1e')]=function(_0x1456b4){var _0xbc5945=this;return new Promise(function(_0x3392fb,_0x1f3237){return db[_0x8fd2('0x1f')]['update'](_0x1456b4['body'],{'raw':_0x1456b4[_0x8fd2('0x1b')]?_0x1456b4[_0x8fd2('0x1b')][_0x8fd2('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1456b4['options']?_0x1456b4[_0x8fd2('0x1b')][_0x8fd2('0x21')]||null:null,'attributes':_0x1456b4[_0x8fd2('0x1b')]?_0x1456b4[_0x8fd2('0x1b')][_0x8fd2('0x22')]||null:null,'limit':_0x1456b4[_0x8fd2('0x1b')]?_0x1456b4[_0x8fd2('0x1b')]['limit']||null:null})[_0x8fd2('0x1c')](function(_0x13c9b9){logger[_0x8fd2('0x17')](_0x8fd2('0x1e'),_0x1456b4);logger[_0x8fd2('0x11')](_0x8fd2('0x1e'),_0x1456b4,JSON[_0x8fd2('0x13')](_0x13c9b9));_0x3392fb(_0x13c9b9);})['catch'](function(_0x5b992a){logger['error'](_0x8fd2('0x1e'),_0x5b992a[_0x8fd2('0x16')],_0x1456b4);_0x1f3237(_0xbc5945[_0x8fd2('0x14')](0x1f4,_0x5b992a[_0x8fd2('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index ec8b3ba..e3049f8 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 _0x6593=['faxMessage:','save','remove','update','emit','removeListener','register','length'];(function(_0x50ac48,_0x3e9330){var _0x3cc7b6=function(_0x38bbfb){while(--_0x38bbfb){_0x50ac48['push'](_0x50ac48['shift']());}};_0x3cc7b6(++_0x3e9330);}(_0x6593,0x131));var _0x3659=function(_0x1da8f5,_0xc052c4){_0x1da8f5=_0x1da8f5-0x0;var _0x2973a4=_0x6593[_0x1da8f5];return _0x2973a4;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x3659('0x0'),_0x3659('0x1'),_0x3659('0x2')];function createListener(_0x1ddbec,_0x5042dc){return function(_0x356705){_0x5042dc[_0x3659('0x3')](_0x1ddbec,_0x356705);};}function removeListener(_0x3a1c7e,_0x18d11c){return function(){FaxMessageEvents[_0x3659('0x4')](_0x3a1c7e,_0x18d11c);};}exports[_0x3659('0x5')]=function(_0x56cd3d){for(var _0x27be0=0x0,_0x1d9bfa=events[_0x3659('0x6')];_0x27be0<_0x1d9bfa;_0x27be0++){var _0x58866c=events[_0x27be0];var _0x156604=createListener(_0x3659('0x7')+_0x58866c,_0x56cd3d);FaxMessageEvents['on'](_0x58866c,_0x156604);}}; \ No newline at end of file +var _0x273d=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x21d479,_0x27a287){var _0xd0bf02=function(_0x3b5d74){while(--_0x3b5d74){_0x21d479['push'](_0x21d479['shift']());}};_0xd0bf02(++_0x27a287);}(_0x273d,0x1e9));var _0xd273=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x273d[_0xc6be3a];return _0x56a310;};'use strict';var FaxMessageEvents=require(_0xd273('0x0'));var events=[_0xd273('0x1'),_0xd273('0x2'),_0xd273('0x3')];function createListener(_0x177a1a,_0x1b5f2a){return function(_0x3c2900){_0x1b5f2a[_0xd273('0x4')](_0x177a1a,_0x3c2900);};}function removeListener(_0x464e3f,_0x49bb0c){return function(){FaxMessageEvents[_0xd273('0x5')](_0x464e3f,_0x49bb0c);};}exports[_0xd273('0x6')]=function(_0x3c21a6){for(var _0x338851=0x0,_0x4efaa9=events[_0xd273('0x7')];_0x338851<_0x4efaa9;_0x338851++){var _0x1f4f21=events[_0x338851];var _0x11db7d=createListener(_0xd273('0x8')+_0x1f4f21,_0x3c21a6);FaxMessageEvents['on'](_0x1f4f21,_0x11db7d);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 0ebd17c..c0dbe5e 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 _0xeffd=['./faxMessage.controller','get','isAuthenticated','index','/describe','describe','show','download','post','tracked','fax','faxmessage:create','create','/:id','put','accept','/:id/reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4e01fe,_0x314f7f){var _0x15a34a=function(_0x3af2e7){while(--_0x3af2e7){_0x4e01fe['push'](_0x4e01fe['shift']());}};_0x15a34a(++_0x314f7f);}(_0xeffd,0x6b));var _0xdeff=function(_0x282e87,_0x251766){_0x282e87=_0x282e87-0x0;var _0x286148=_0xeffd[_0x282e87];return _0x286148;};'use strict';var multer=require(_0xdeff('0x0'));var util=require('util');var path=require(_0xdeff('0x1'));var timeout=require(_0xdeff('0x2'));var express=require(_0xdeff('0x3'));var router=express[_0xdeff('0x4')]();var fs_extra=require(_0xdeff('0x5'));var auth=require(_0xdeff('0x6'));var interaction=require(_0xdeff('0x7'));var config=require(_0xdeff('0x8'));var controller=require(_0xdeff('0x9'));router[_0xdeff('0xa')]('/',auth[_0xdeff('0xb')](),controller[_0xdeff('0xc')]);router[_0xdeff('0xa')](_0xdeff('0xd'),auth[_0xdeff('0xb')](),controller[_0xdeff('0xe')]);router[_0xdeff('0xa')]('/:id',auth[_0xdeff('0xb')](),controller[_0xdeff('0xf')]);router[_0xdeff('0xa')]('/:id/download',auth[_0xdeff('0xb')](),controller[_0xdeff('0x10')]);router[_0xdeff('0x11')]('/',auth[_0xdeff('0xb')](),interaction[_0xdeff('0x12')](_0xdeff('0x13'),_0xdeff('0x14')),controller[_0xdeff('0x15')]);router['put'](_0xdeff('0x16'),auth[_0xdeff('0xb')](),controller['update']);router[_0xdeff('0x17')]('/:id/accept',auth['isAuthenticated'](),controller[_0xdeff('0x18')]);router[_0xdeff('0x17')](_0xdeff('0x19'),auth[_0xdeff('0xb')](),controller['reject']);router[_0xdeff('0x1a')](_0xdeff('0x16'),auth[_0xdeff('0xb')](),controller[_0xdeff('0x1b')]);module[_0xdeff('0x1c')]=router; \ No newline at end of file +var _0xca66=['faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','tracked','fax'];(function(_0x519d1f,_0xead156){var _0x52aa37=function(_0x4d00c2){while(--_0x4d00c2){_0x519d1f['push'](_0x519d1f['shift']());}};_0x52aa37(++_0xead156);}(_0xca66,0x8b));var _0x6ca6=function(_0x2b2b4b,_0x5e47ba){_0x2b2b4b=_0x2b2b4b-0x0;var _0x18c3fb=_0xca66[_0x2b2b4b];return _0x18c3fb;};'use strict';var multer=require(_0x6ca6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6ca6('0x1'));var express=require(_0x6ca6('0x2'));var router=express[_0x6ca6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6ca6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6ca6('0x5'));var controller=require('./faxMessage.controller');router[_0x6ca6('0x6')]('/',auth[_0x6ca6('0x7')](),controller[_0x6ca6('0x8')]);router[_0x6ca6('0x6')](_0x6ca6('0x9'),auth[_0x6ca6('0x7')](),controller[_0x6ca6('0xa')]);router['get'](_0x6ca6('0xb'),auth[_0x6ca6('0x7')](),controller[_0x6ca6('0xc')]);router[_0x6ca6('0x6')](_0x6ca6('0xd'),auth[_0x6ca6('0x7')](),controller[_0x6ca6('0xe')]);router['post']('/',auth[_0x6ca6('0x7')](),interaction[_0x6ca6('0xf')](_0x6ca6('0x10'),_0x6ca6('0x11')),controller[_0x6ca6('0x12')]);router[_0x6ca6('0x13')]('/:id',auth[_0x6ca6('0x7')](),controller[_0x6ca6('0x14')]);router['put'](_0x6ca6('0x15'),auth[_0x6ca6('0x7')](),controller[_0x6ca6('0x16')]);router[_0x6ca6('0x13')](_0x6ca6('0x17'),auth[_0x6ca6('0x7')](),controller['reject']);router['delete']('/:id',auth[_0x6ca6('0x7')](),controller[_0x6ca6('0x18')]);module[_0x6ca6('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 527ae5c..05a5765 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 _0x2ae9=['sequelize','exports','STRING','name','INTEGER','ENUM','beepall','roundrobin'];(function(_0x16bc7d,_0x2f0914){var _0x757631=function(_0x27d81a){while(--_0x27d81a){_0x16bc7d['push'](_0x16bc7d['shift']());}};_0x757631(++_0x2f0914);}(_0x2ae9,0x90));var _0x92ae=function(_0x459ee0,_0x1e950d){_0x459ee0=_0x459ee0-0x0;var _0x1b87c8=_0x2ae9[_0x459ee0];return _0x1b87c8;};'use strict';var Sequelize=require(_0x92ae('0x0'));module[_0x92ae('0x1')]={'name':{'type':Sequelize[_0x92ae('0x2')],'unique':_0x92ae('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x92ae('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x92ae('0x5')]('rrmemory',_0x92ae('0x6'),_0x92ae('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x92ae('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfe89=['name','ENUM','beepall','roundrobin','INTEGER','exports','STRING'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xfe89,0x12b));var _0x9fe8=function(_0x2092b3,_0x5e835a){_0x2092b3=_0x2092b3-0x0;var _0x3f9471=_0xfe89[_0x2092b3];return _0x3f9471;};'use strict';var Sequelize=require('sequelize');module[_0x9fe8('0x0')]={'name':{'type':Sequelize[_0x9fe8('0x1')],'unique':_0x9fe8('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9fe8('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9fe8('0x3')]('rrmemory',_0x9fe8('0x4'),_0x9fe8('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9fe8('0x6')],'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 44cc874..cfe28d7 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 _0x7995=['jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','sendStatus','error','stack','send','index','FaxQueue','type','key','model','map','name','query','filters','attributes','intersection','length','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','rows','show','keys','rawAttributes','fields','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserFaxQueue','order','findAll','User','findAndCountAll','agent','createdAt','%s/%s','SIP','updatedAt','getTeams','Team','hasOwnProperty','nolimit','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','userFaxQueue:save','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel'];(function(_0x25be37,_0x59af02){var _0x5408b6=function(_0x5b5009){while(--_0x5b5009){_0x25be37['push'](_0x25be37['shift']());}};_0x5408b6(++_0x59af02);}(_0x7995,0x80));var _0x5799=function(_0x1c70ed,_0x46ba61){_0x1c70ed=_0x1c70ed-0x0;var _0x25ddc3=_0x7995[_0x1c70ed];return _0x25ddc3;};'use strict';var emlformat=require(_0x5799('0x0'));var rimraf=require(_0x5799('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5799('0x2'));var rp=require(_0x5799('0x3'));var moment=require(_0x5799('0x4'));var BPromise=require(_0x5799('0x5'));var Mustache=require('mustache');var util=require(_0x5799('0x6'));var path=require(_0x5799('0x7'));var sox=require(_0x5799('0x8'));var csv=require(_0x5799('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5799('0xa'));var _=require(_0x5799('0xb'));var squel=require(_0x5799('0xc'));var crypto=require('crypto');var jsforce=require(_0x5799('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5799('0x9'));var querystring=require('querystring');var Papa=require(_0x5799('0xe'));var Redis=require(_0x5799('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5799('0x10'));var hardwareService=require(_0x5799('0x11'));var logger=require('../../config/logger')(_0x5799('0x12'));var utils=require(_0x5799('0x13'));var config=require(_0x5799('0x14'));var licenseUtil=require(_0x5799('0x15'));var db=require(_0x5799('0x16'))['db'];config['redis']=_['defaults'](config[_0x5799('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x5799('0x18'))(new Redis(config[_0x5799('0x17')]));require('./faxQueue.socket')['register'](socket);function respondWithStatusCode(_0x5338d1,_0x375083){_0x375083=_0x375083||0xcc;return function(_0x44c135){if(_0x44c135){return _0x5338d1['sendStatus'](_0x375083);}return _0x5338d1[_0x5799('0x19')](_0x375083)[_0x5799('0x1a')]();};}function respondWithResult(_0x564604,_0x170ebe){_0x170ebe=_0x170ebe||0xc8;return function(_0x452952){if(_0x452952){return _0x564604['status'](_0x170ebe)[_0x5799('0x1b')](_0x452952);}};}function respondWithFilteredResult(_0x2e2a70,_0x1493ec){return function(_0x566134){if(_0x566134){var _0x13b789=typeof _0x1493ec[_0x5799('0x1c')]===_0x5799('0x1d')&&typeof _0x1493ec[_0x5799('0x1e')]===_0x5799('0x1d');var _0x2278fa=_0x566134['count'];var _0x5dce51=_0x13b789?0x0:_0x1493ec[_0x5799('0x1c')];var _0x4c4e8e=_0x13b789?_0x566134['count']:_0x1493ec[_0x5799('0x1c')]+_0x1493ec['limit'];var _0x148e25;if(_0x4c4e8e>=_0x2278fa){_0x4c4e8e=_0x2278fa;_0x148e25=0xc8;}else{_0x148e25=0xce;}_0x2e2a70['status'](_0x148e25);return _0x2e2a70['set'](_0x5799('0x1f'),_0x5dce51+'-'+_0x4c4e8e+'/'+_0x2278fa)[_0x5799('0x1b')](_0x566134);}return null;};}function patchUpdates(_0x545271){return function(_0x4d1f67){try{jsonpatch[_0x5799('0x20')](_0x4d1f67,_0x545271,!![]);}catch(_0xdc0966){return BPromise[_0x5799('0x21')](_0xdc0966);}return _0x4d1f67[_0x5799('0x22')]();};}function saveUpdates(_0x3e01a1,_0x26fe99){return function(_0x3c9208){if(_0x3c9208){return _0x3c9208[_0x5799('0x23')](_0x3e01a1)[_0x5799('0x24')](function(_0x4c7c67){return _0x4c7c67;});}return null;};}function removeEntity(_0xa12bdf,_0x3b8416){return function(_0x1cab7d){if(_0x1cab7d){return _0x1cab7d[_0x5799('0x25')]()[_0x5799('0x24')](function(){var _0x4ec88a=_0x1cab7d[_0x5799('0x26')]({'plain':!![]});var _0x131d50=_0x5799('0x27');return db[_0x5799('0x28')][_0x5799('0x25')]({'where':{'type':_0x131d50,'resourceId':_0x4ec88a['id']}})[_0x5799('0x24')](function(){return _0x1cab7d;});})[_0x5799('0x24')](function(){_0xa12bdf['status'](0xcc)[_0x5799('0x1a')]();});}};}function handleEntityNotFound(_0x2440a6,_0x511355){return function(_0x4be1b5){if(!_0x4be1b5){_0x2440a6[_0x5799('0x29')](0x194);}return _0x4be1b5;};}function handleError(_0x401347,_0x4d283f){_0x4d283f=_0x4d283f||0x1f4;return function(_0x484b83){logger[_0x5799('0x2a')](_0x484b83[_0x5799('0x2b')]);if(_0x484b83['name']){delete _0x484b83['name'];}_0x401347[_0x5799('0x19')](_0x4d283f)[_0x5799('0x2c')](_0x484b83);};}exports[_0x5799('0x2d')]=function(_0x599690,_0x15587c){var _0xe15bc0={},_0x56f362={},_0x3d474b={'count':0x0,'rows':[]};var _0x1fc478=_['map'](db[_0x5799('0x2e')]['rawAttributes'],function(_0x5e7e35){return{'name':_0x5e7e35['fieldName'],'type':_0x5e7e35[_0x5799('0x2f')][_0x5799('0x30')]};});_0x56f362[_0x5799('0x31')]=_[_0x5799('0x32')](_0x1fc478,_0x5799('0x33'));_0x56f362['query']=_['keys'](_0x599690[_0x5799('0x34')]);_0x56f362[_0x5799('0x35')]=_['intersection'](_0x56f362[_0x5799('0x31')],_0x56f362[_0x5799('0x34')]);_0xe15bc0[_0x5799('0x36')]=_[_0x5799('0x37')](_0x56f362[_0x5799('0x31')],qs['fields'](_0x599690[_0x5799('0x34')]['fields']));_0xe15bc0[_0x5799('0x36')]=_0xe15bc0[_0x5799('0x36')][_0x5799('0x38')]?_0xe15bc0[_0x5799('0x36')]:_0x56f362[_0x5799('0x31')];if(!_0x599690[_0x5799('0x34')]['hasOwnProperty']('nolimit')){_0xe15bc0[_0x5799('0x1e')]=qs[_0x5799('0x1e')](_0x599690['query']['limit']);_0xe15bc0[_0x5799('0x1c')]=qs[_0x5799('0x1c')](_0x599690['query'][_0x5799('0x1c')]);}_0xe15bc0['order']=qs['sort'](_0x599690[_0x5799('0x34')][_0x5799('0x39')]);_0xe15bc0[_0x5799('0x3a')]=qs[_0x5799('0x35')](_[_0x5799('0x3b')](_0x599690[_0x5799('0x34')],_0x56f362[_0x5799('0x35')]),_0x1fc478);if(_0x599690['query'][_0x5799('0x3c')]){_0xe15bc0['where']=_['merge'](_0xe15bc0[_0x5799('0x3a')],{'$or':_[_0x5799('0x32')](_0x1fc478,function(_0x395ee4){if(_0x395ee4[_0x5799('0x2f')]!==_0x5799('0x3d')){var _0x5a51c8={};_0x5a51c8[_0x395ee4[_0x5799('0x33')]]={'$like':'%'+_0x599690[_0x5799('0x34')]['filter']+'%'};return _0x5a51c8;}})});}_0xe15bc0=_[_0x5799('0x3e')]({},_0xe15bc0,_0x599690[_0x5799('0x3f')]);var _0x4c353a={'where':_0xe15bc0[_0x5799('0x3a')]};return db[_0x5799('0x2e')][_0x5799('0x40')](_0x4c353a)[_0x5799('0x24')](function(_0x48fcfa){_0x3d474b[_0x5799('0x40')]=_0x48fcfa;if(_0x599690['query'][_0x5799('0x41')]){_0xe15bc0[_0x5799('0x42')]=[{'all':!![]}];}return db['FaxQueue']['findAll'](_0xe15bc0);})[_0x5799('0x24')](function(_0x43d885){_0x3d474b[_0x5799('0x43')]=_0x43d885;return _0x3d474b;})[_0x5799('0x24')](respondWithFilteredResult(_0x15587c,_0xe15bc0))['catch'](handleError(_0x15587c,null));};exports[_0x5799('0x44')]=function(_0x437f0a,_0x20ddfe){var _0x90f88={'raw':!![],'where':{'id':_0x437f0a['params']['id']}},_0x1f9f91={};_0x1f9f91[_0x5799('0x31')]=_[_0x5799('0x45')](db[_0x5799('0x2e')][_0x5799('0x46')]);_0x1f9f91[_0x5799('0x34')]=_[_0x5799('0x45')](_0x437f0a['query']);_0x1f9f91[_0x5799('0x35')]=_['intersection'](_0x1f9f91[_0x5799('0x31')],_0x1f9f91['query']);_0x90f88[_0x5799('0x36')]=_['intersection'](_0x1f9f91[_0x5799('0x31')],qs['fields'](_0x437f0a[_0x5799('0x34')][_0x5799('0x47')]));_0x90f88[_0x5799('0x36')]=_0x90f88[_0x5799('0x36')][_0x5799('0x38')]?_0x90f88[_0x5799('0x36')]:_0x1f9f91['model'];if(_0x437f0a[_0x5799('0x34')][_0x5799('0x41')]){_0x90f88[_0x5799('0x42')]=[{'all':!![]}];}_0x90f88=_[_0x5799('0x3e')]({},_0x90f88,_0x437f0a[_0x5799('0x3f')]);return db['FaxQueue'][_0x5799('0x48')](_0x90f88)[_0x5799('0x24')](handleEntityNotFound(_0x20ddfe,null))['then'](respondWithResult(_0x20ddfe,null))['catch'](handleError(_0x20ddfe,null));};exports[_0x5799('0x49')]=function(_0x3c7ce9,_0x33ac2b){return db[_0x5799('0x2e')]['create'](_0x3c7ce9[_0x5799('0x4a')],{})[_0x5799('0x24')](function(_0x48e7c6){var _0x44dd8e=_0x3c7ce9['user'][_0x5799('0x26')]({'plain':!![]});if(!_0x44dd8e)throw new Error(_0x5799('0x4b'));if(_0x44dd8e[_0x5799('0x4c')]===_0x5799('0x4d')){var _0x574ded=_0x48e7c6['get']({'plain':!![]});var _0x72e3df='FaxQueues';return db[_0x5799('0x4e')][_0x5799('0x48')]({'where':{'name':_0x72e3df,'userProfileId':_0x44dd8e[_0x5799('0x4f')]},'raw':!![]})[_0x5799('0x24')](function(_0x49874f){if(_0x49874f&&_0x49874f[_0x5799('0x50')]===0x0){return db['UserProfileResource'][_0x5799('0x49')]({'name':_0x574ded[_0x5799('0x33')],'resourceId':_0x574ded['id'],'type':_0x49874f[_0x5799('0x33')],'sectionId':_0x49874f['id']},{})[_0x5799('0x24')](function(){return _0x48e7c6;});}else{return _0x48e7c6;}})[_0x5799('0x51')](function(_0x5b07d6){logger[_0x5799('0x2a')](_0x5799('0x52'),_0x5b07d6);throw _0x5b07d6;});}return _0x48e7c6;})['then'](respondWithResult(_0x33ac2b,0xc9))['catch'](handleError(_0x33ac2b,null));};exports['update']=function(_0x433e19,_0x49898e){if(_0x433e19['body']['id']){delete _0x433e19[_0x5799('0x4a')]['id'];}return db['FaxQueue'][_0x5799('0x48')]({'where':{'id':_0x433e19[_0x5799('0x53')]['id']}})[_0x5799('0x24')](handleEntityNotFound(_0x49898e,null))[_0x5799('0x24')](saveUpdates(_0x433e19[_0x5799('0x4a')],null))['then'](respondWithResult(_0x49898e,null))[_0x5799('0x51')](handleError(_0x49898e,null));};exports['destroy']=function(_0x3dd17b,_0x3134bc){return db[_0x5799('0x2e')][_0x5799('0x48')]({'where':{'id':_0x3dd17b['params']['id']}})['then'](handleEntityNotFound(_0x3134bc,null))['then'](removeEntity(_0x3134bc,null))['catch'](handleError(_0x3134bc,null));};exports[_0x5799('0x54')]=function(_0x547508,_0x587ee7){return db['FaxQueue'][_0x5799('0x54')]()[_0x5799('0x24')](respondWithResult(_0x587ee7,null))['catch'](handleError(_0x587ee7,null));};exports[_0x5799('0x55')]=function(_0x2e1d04,_0x102b5a,_0x5c5399){var _0x371e6e={'raw':!![],'where':{}},_0x589dd0={},_0x5ac301;return db['FaxQueue'][_0x5799('0x56')]({'where':{'id':_0x2e1d04[_0x5799('0x53')]['id']}})[_0x5799('0x24')](handleEntityNotFound(_0x102b5a,null))[_0x5799('0x24')](function(_0x94f2f1){if(_0x94f2f1){_0x5ac301=_0x94f2f1[_0x5799('0x26')]({'plain':!![]});_0x589dd0[_0x5799('0x31')]=_[_0x5799('0x45')](db[_0x5799('0x57')][_0x5799('0x46')]);_0x589dd0['query']=_[_0x5799('0x45')](_0x2e1d04[_0x5799('0x34')]);_0x589dd0[_0x5799('0x35')]=_['intersection'](_0x589dd0[_0x5799('0x31')],_0x589dd0[_0x5799('0x34')]);_0x371e6e[_0x5799('0x36')]=_['intersection'](_0x589dd0[_0x5799('0x31')],qs['fields'](_0x2e1d04[_0x5799('0x34')][_0x5799('0x47')]));_0x371e6e[_0x5799('0x36')]=_0x371e6e[_0x5799('0x36')][_0x5799('0x38')]?_0x371e6e[_0x5799('0x36')]:_0x589dd0['model'];if(!_0x2e1d04[_0x5799('0x34')]['hasOwnProperty']('nolimit')){_0x371e6e['limit']=qs[_0x5799('0x1e')](_0x2e1d04[_0x5799('0x34')]['limit']);_0x371e6e[_0x5799('0x1c')]=qs[_0x5799('0x1c')](_0x2e1d04[_0x5799('0x34')]['offset']);}_0x371e6e[_0x5799('0x58')]=qs[_0x5799('0x39')](_0x2e1d04['query'][_0x5799('0x39')]);_0x371e6e[_0x5799('0x3a')]=qs[_0x5799('0x35')](_[_0x5799('0x3b')](_0x2e1d04[_0x5799('0x34')],_0x589dd0[_0x5799('0x35')]));_0x371e6e[_0x5799('0x3a')]['FaxQueueId']=_0x94f2f1['id'];if(_0x2e1d04[_0x5799('0x34')][_0x5799('0x3c')]){_0x371e6e['where']=_[_0x5799('0x3e')](_0x371e6e[_0x5799('0x3a')],{'$or':_[_0x5799('0x32')](_0x371e6e['attributes'],function(_0x57ea12){var _0x1eb1f6={};_0x1eb1f6[_0x57ea12]={'$like':'%'+_0x2e1d04['query'][_0x5799('0x3c')]+'%'};return _0x1eb1f6;})});}_0x371e6e=_[_0x5799('0x3e')]({},_0x371e6e,_0x2e1d04['options']);return db[_0x5799('0x57')][_0x5799('0x59')](_0x371e6e);}})[_0x5799('0x24')](function(_0x10ac6){if(_0x10ac6){return db[_0x5799('0x5a')][_0x5799('0x5b')]({'where':{'id':_[_0x5799('0x32')](_0x10ac6,'UserId'),'role':_0x5799('0x5c')},'attributes':['id',_0x5799('0x33'),'faxPause','updatedAt',_0x5799('0x5d')]});}})[_0x5799('0x24')](function(_0x4fd337){if(_0x4fd337){return{'count':_0x4fd337[_0x5799('0x40')],'rows':_[_0x5799('0x32')](_0x4fd337[_0x5799('0x43')],function(_0x2f8ecb){return{'membername':_0x2f8ecb[_0x5799('0x33')],'UserId':_0x2f8ecb['id'],'queue_name':_0x5ac301[_0x5799('0x33')],'FaxQueueId':_0x5ac301['id'],'interface':util['format'](_0x5799('0x5e'),_0x5799('0x5f'),_0x2f8ecb[_0x5799('0x33')]),'penalty':0x0,'paused':_0x2f8ecb['faxPause'],'createdAt':_0x2f8ecb[_0x5799('0x5d')],'updatedAt':_0x2f8ecb[_0x5799('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5799('0x24')](respondWithFilteredResult(_0x102b5a,_0x371e6e))[_0x5799('0x51')](handleError(_0x102b5a,null));};exports[_0x5799('0x61')]=function(_0x35844e,_0x16281f,_0x2405db){var _0x582e92={};var _0x851544={};var _0x31ffed;var _0x190656;return db[_0x5799('0x2e')][_0x5799('0x56')]({'where':{'id':_0x35844e[_0x5799('0x53')]['id']}})[_0x5799('0x24')](handleEntityNotFound(_0x16281f,null))[_0x5799('0x24')](function(_0x5c58a3){if(_0x5c58a3){_0x31ffed=_0x5c58a3;_0x851544['model']=_[_0x5799('0x45')](db[_0x5799('0x62')]['rawAttributes']);_0x851544['query']=_[_0x5799('0x45')](_0x35844e['query']);_0x851544[_0x5799('0x35')]=_['intersection'](_0x851544['model'],_0x851544['query']);_0x582e92[_0x5799('0x36')]=_['intersection'](_0x851544[_0x5799('0x31')],qs[_0x5799('0x47')](_0x35844e[_0x5799('0x34')]['fields']));_0x582e92['attributes']=_0x582e92[_0x5799('0x36')][_0x5799('0x38')]?_0x582e92[_0x5799('0x36')]:_0x851544['model'];_0x582e92[_0x5799('0x58')]=qs[_0x5799('0x39')](_0x35844e[_0x5799('0x34')][_0x5799('0x39')]);_0x582e92[_0x5799('0x3a')]=qs['filters'](_['pick'](_0x35844e[_0x5799('0x34')],_0x851544[_0x5799('0x35')]));if(_0x35844e[_0x5799('0x34')][_0x5799('0x3c')]){_0x582e92['where']=_['merge'](_0x582e92[_0x5799('0x3a')],{'$or':_[_0x5799('0x32')](_0x582e92['attributes'],function(_0x5199e2){var _0x16139c={};_0x16139c[_0x5199e2]={'$like':'%'+_0x35844e[_0x5799('0x34')][_0x5799('0x3c')]+'%'};return _0x16139c;})});}_0x582e92=_[_0x5799('0x3e')]({},_0x582e92,_0x35844e[_0x5799('0x3f')]);return _0x31ffed[_0x5799('0x61')](_0x582e92);}})[_0x5799('0x24')](function(_0x449133){if(_0x449133){_0x190656=_0x449133[_0x5799('0x38')];if(!_0x35844e[_0x5799('0x34')][_0x5799('0x63')](_0x5799('0x64'))){_0x582e92[_0x5799('0x1e')]=qs[_0x5799('0x1e')](_0x35844e[_0x5799('0x34')][_0x5799('0x1e')]);_0x582e92[_0x5799('0x1c')]=qs[_0x5799('0x1c')](_0x35844e[_0x5799('0x34')][_0x5799('0x1c')]);}return _0x31ffed[_0x5799('0x61')](_0x582e92);}})[_0x5799('0x24')](function(_0x78a1ac){if(_0x78a1ac){return _0x78a1ac?{'count':_0x190656,'rows':_0x78a1ac}:null;}})[_0x5799('0x24')](respondWithResult(_0x16281f,null))[_0x5799('0x51')](handleError(_0x16281f,null));};exports[_0x5799('0x65')]=function(_0x1d3789,_0x59cd4e,_0x30de8b){var _0x224721=_0x1d3789[_0x5799('0x4a')][_0x5799('0x66')];return db[_0x5799('0x62')]['findAll']({'where':{'id':_0x224721},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5799('0x67'),'attributes':['id',_0x5799('0x33'),_0x5799('0x68'),_0x5799('0x69'),_0x5799('0x6a')],'raw':!![]}]})[_0x5799('0x24')](function(_0x5811fe){if(_0x5811fe){var _0x4de9ff=_[_0x5799('0x6b')](_0x5811fe,function(_0x2f3a0a){var _0x1c26a6=_0x2f3a0a[_0x5799('0x26')]({'plain':!![]});return _0x1c26a6[_0x5799('0x67')];});return db[_0x5799('0x2e')][_0x5799('0x48')]({'where':{'id':_0x1d3789[_0x5799('0x53')]['id']}})['then'](function(_0xb2a16d){return db[_0x5799('0x6c')][_0x5799('0x6d')](function(_0x347489){return _0xb2a16d[_0x5799('0x65')](_0x224721,{'transaction':_0x347489})[_0x5799('0x24')](function(){return BPromise[_0x5799('0x6e')](_0x4de9ff,function(_0x1a1e8e){return db[_0x5799('0x57')][_0x5799('0x6f')]({'where':{'UserId':_0x1a1e8e['id'],'FaxQueueId':_0x1d3789[_0x5799('0x53')]['id']},'transaction':_0x347489});});})[_0x5799('0x24')](function(){_0x4de9ff[_0x5799('0x70')](function(_0x562695){socket[_0x5799('0x71')]('userFaxQueue:save',{'UserId':_0x562695['id'],'FaxQueueId':_0xb2a16d['id']});});});});});}})['then'](respondWithStatusCode(_0x59cd4e,null))[_0x5799('0x51')](handleError(_0x59cd4e,null));};exports[_0x5799('0x72')]=function(_0x3916b8,_0x25f682,_0x268681){return db['Team'][_0x5799('0x59')]({'where':{'id':_0x3916b8[_0x5799('0x34')][_0x5799('0x66')]},'attributes':['id'],'include':[{'model':db[_0x5799('0x5a')],'as':_0x5799('0x67'),'attributes':['id'],'raw':!![]}]})[_0x5799('0x24')](handleEntityNotFound(_0x25f682,null))[_0x5799('0x24')](function(_0x1f1717){var _0x36e0e2=_[_0x5799('0x32')](_0x1f1717,'id');var _0x2131b0=[];var _0x4cdb3b=[];var _0xec9ce9=squel[_0x5799('0x73')]();_0xec9ce9[_0x5799('0x74')](_0x5799('0x75'))['from'](_0x5799('0x76'),'tq')[_0x5799('0x77')](_0x5799('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x5799('0x3a')](_0x5799('0x79'),_0x3916b8['params']['id']);for(var _0x4f59d9=0x0;_0x4f59d9<_0x1f1717[_0x5799('0x38')];_0x4f59d9+=0x1){let _0x208929=_0x1f1717[_0x4f59d9];for(var _0x338b10=0x0;_0x338b10<_0x208929[_0x5799('0x67')]['length'];_0x338b10+=0x1){let _0x3d74cf=_0x208929[_0x5799('0x67')][_0x338b10];var _0x4127fb=_0xec9ce9[_0x5799('0x7a')]();_0x4127fb['where'](_0x5799('0x7b'),_0x3d74cf['id']);_0x4cdb3b['push'](db[_0x5799('0x6c')][_0x5799('0x34')](_0x4127fb[_0x5799('0x7c')](),{'type':db[_0x5799('0x6c')]['QueryTypes'][_0x5799('0x7d')]})[_0x5799('0x24')](function(_0x582365){if(_0x582365[_0x5799('0x38')]===0x1){return _0x3d74cf['id'];}else{var _0x195375=_['every'](_[_0x5799('0x32')](_0x582365,_0x5799('0x7e')),function(_0x22de1b){return _[_0x5799('0x7f')](_0x36e0e2,_0x22de1b);});if(_0x195375){return _0x3d74cf['id'];}}}));}}return BPromise[_0x5799('0x80')](_0x4cdb3b)['then'](function(_0x491201){_0x2131b0=_(_0x2131b0)[_0x5799('0x81')](_0x491201)[_0x5799('0x82')]()[_0x5799('0x83')]();return db['FaxQueue']['find']({'where':{'id':_0x3916b8['params']['id']}})[_0x5799('0x24')](function(_0x49382f){return db[_0x5799('0x6c')][_0x5799('0x6d')](function(_0x392cac){return _0x49382f[_0x5799('0x72')](_0x3916b8[_0x5799('0x34')][_0x5799('0x66')],{'transaction':_0x392cac})[_0x5799('0x24')](function(){if(!_[_0x5799('0x84')](_0x2131b0)){return _0x49382f[_0x5799('0x85')](_0x2131b0,{'transaction':_0x392cac});}})[_0x5799('0x24')](function(){_0x2131b0[_0x5799('0x70')](function(_0x2b9bff){socket['emit']('userFaxQueue:remove',{'UserId':_0x2b9bff,'FaxQueueId':_0x49382f['id']});});});});});});})['then'](respondWithStatusCode(_0x25f682,null))[_0x5799('0x51')](handleError(_0x25f682,null));};exports[_0x5799('0x86')]=function(_0x1c420c,_0x6626ac,_0x5e0a91){return db[_0x5799('0x2e')][_0x5799('0x48')]({'where':{'id':_0x1c420c['params']['id']}})[_0x5799('0x24')](handleEntityNotFound(_0x6626ac,null))[_0x5799('0x24')](function(_0x4c4848){if(_0x4c4848){return _0x4c4848[_0x5799('0x86')](_0x1c420c[_0x5799('0x4a')][_0x5799('0x66')],_[_0x5799('0x87')](_0x1c420c[_0x5799('0x4a')],[_0x5799('0x66'),'id'])||{})[_0x5799('0x88')](function(_0xab7c31){for(var _0x289746=0x0;_0x289746<_0x1c420c[_0x5799('0x4a')]['ids'][_0x5799('0x38')];_0x289746+=0x1){socket[_0x5799('0x71')](_0x5799('0x89'),{'UserId':Number(_0x1c420c[_0x5799('0x4a')]['ids'][_0x289746]),'FaxQueueId':Number(_0x1c420c[_0x5799('0x53')]['id'])});}return _0xab7c31;});}})[_0x5799('0x24')](respondWithResult(_0x6626ac,null))[_0x5799('0x51')](handleError(_0x6626ac,null));};exports[_0x5799('0x85')]=function(_0x44f252,_0x1e5f20,_0x2a01e9){return db['FaxQueue'][_0x5799('0x48')]({'where':{'id':_0x44f252['params']['id']}})[_0x5799('0x24')](handleEntityNotFound(_0x1e5f20,null))[_0x5799('0x24')](function(_0x151718){if(_0x151718){return _0x151718['removeAgents'](_0x44f252[_0x5799('0x34')][_0x5799('0x66')])[_0x5799('0x24')](function(){if(_[_0x5799('0x8a')](_0x44f252[_0x5799('0x34')]['ids'])){for(var _0x24c2bc=0x0;_0x24c2bc<_0x44f252[_0x5799('0x34')]['ids'][_0x5799('0x38')];_0x24c2bc+=0x1){socket[_0x5799('0x71')]('userFaxQueue:remove',{'UserId':Number(_0x44f252[_0x5799('0x34')]['ids'][_0x24c2bc]),'FaxQueueId':Number(_0x44f252[_0x5799('0x53')]['id'])});}}else{socket[_0x5799('0x71')](_0x5799('0x8b'),{'UserId':Number(_0x44f252['query'][_0x5799('0x66')]),'FaxQueueId':Number(_0x44f252[_0x5799('0x53')]['id'])});}});}})[_0x5799('0x24')](respondWithStatusCode(_0x1e5f20,null))[_0x5799('0x51')](handleError(_0x1e5f20,null));};exports['getAgents']=function(_0xf9d93e,_0x2bbe26,_0x31c1e8){var _0x3714f9={};var _0x12cf15={};var _0x3f95d2;var _0x4c09d4;return db[_0x5799('0x2e')][_0x5799('0x56')]({'where':{'id':_0xf9d93e[_0x5799('0x53')]['id']}})['then'](handleEntityNotFound(_0x2bbe26,null))['then'](function(_0x20094a){if(_0x20094a){_0x3f95d2=_0x20094a;_0x12cf15[_0x5799('0x31')]=_[_0x5799('0x45')](db[_0x5799('0x5a')][_0x5799('0x46')]);_0x12cf15[_0x5799('0x34')]=_[_0x5799('0x45')](_0xf9d93e[_0x5799('0x34')]);_0x12cf15['filters']=_[_0x5799('0x37')](_0x12cf15[_0x5799('0x31')],_0x12cf15[_0x5799('0x34')]);_0x3714f9['attributes']=_[_0x5799('0x37')](_0x12cf15[_0x5799('0x31')],qs[_0x5799('0x47')](_0xf9d93e['query'][_0x5799('0x47')]));_0x3714f9[_0x5799('0x36')]=_0x3714f9['attributes'][_0x5799('0x38')]?_0x3714f9[_0x5799('0x36')]:_0x12cf15[_0x5799('0x31')];_0x3714f9[_0x5799('0x58')]=qs['sort'](_0xf9d93e[_0x5799('0x34')][_0x5799('0x39')]);_0x3714f9['where']=qs[_0x5799('0x35')](_[_0x5799('0x3b')](_0xf9d93e[_0x5799('0x34')],_0x12cf15[_0x5799('0x35')]));if(_0xf9d93e[_0x5799('0x34')][_0x5799('0x3c')]){_0x3714f9[_0x5799('0x3a')]=_[_0x5799('0x3e')](_0x3714f9[_0x5799('0x3a')],{'$or':_['map'](_0x3714f9[_0x5799('0x36')],function(_0x29c196){var _0x186517={};_0x186517[_0x29c196]={'$like':'%'+_0xf9d93e['query'][_0x5799('0x3c')]+'%'};return _0x186517;})});}_0x3714f9=_[_0x5799('0x3e')]({},_0x3714f9,_0xf9d93e[_0x5799('0x3f')]);return _0x3f95d2[_0x5799('0x8c')](_0x3714f9);}})[_0x5799('0x24')](function(_0xeb67f0){if(_0xeb67f0){_0x4c09d4=_0xeb67f0[_0x5799('0x38')];if(!_0xf9d93e['query'][_0x5799('0x63')](_0x5799('0x64'))){_0x3714f9['limit']=qs['limit'](_0xf9d93e[_0x5799('0x34')][_0x5799('0x1e')]);_0x3714f9[_0x5799('0x1c')]=qs[_0x5799('0x1c')](_0xf9d93e[_0x5799('0x34')][_0x5799('0x1c')]);}return _0x3f95d2['getAgents'](_0x3714f9);}})[_0x5799('0x24')](function(_0x3783f3){if(_0x3783f3){return _0x3783f3?{'count':_0x4c09d4,'rows':_0x3783f3}:null;}})['then'](respondWithResult(_0x2bbe26,null))[_0x5799('0x51')](handleError(_0x2bbe26,null));}; \ No newline at end of file +var _0xe35b=['create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','getMembers','findOne','UserFaxQueue','length','FaxQueueId','User','UserId','faxPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','ids','findAll','Agents','online','interface','flatMap','sequelize','transaction','addTeams','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','TeamId','all','union','compact','value','isEmpty','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','register','status','offset','undefined','limit','count','Content-Range','json','apply','save','then','destroy','get','FaxQueues','UserProfileResource','end','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','keys','include','find'];(function(_0x20e52f,_0x34f03e){var _0x519069=function(_0x29a0ef){while(--_0x29a0ef){_0x20e52f['push'](_0x20e52f['shift']());}};_0x519069(++_0x34f03e);}(_0xe35b,0x15b));var _0xbe35=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xe35b[_0x47b58b];return _0x46bebe;};'use strict';var emlformat=require(_0xbe35('0x0'));var rimraf=require(_0xbe35('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbe35('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbe35('0x3'));var Mustache=require(_0xbe35('0x4'));var util=require('util');var path=require(_0xbe35('0x5'));var sox=require('sox');var csv=require(_0xbe35('0x6'));var ejs=require(_0xbe35('0x7'));var fs=require('fs');var fs_extra=require(_0xbe35('0x8'));var _=require(_0xbe35('0x9'));var squel=require(_0xbe35('0xa'));var crypto=require(_0xbe35('0xb'));var jsforce=require(_0xbe35('0xc'));var deskjs=require(_0xbe35('0xd'));var toCsv=require(_0xbe35('0x6'));var querystring=require('querystring');var Papa=require(_0xbe35('0xe'));var Redis=require(_0xbe35('0xf'));var authService=require(_0xbe35('0x10'));var qs=require(_0xbe35('0x11'));var as=require(_0xbe35('0x12'));var hardwareService=require(_0xbe35('0x13'));var logger=require('../../config/logger')(_0xbe35('0x14'));var utils=require(_0xbe35('0x15'));var config=require(_0xbe35('0x16'));var licenseUtil=require(_0xbe35('0x17'));var db=require(_0xbe35('0x18'))['db'];config[_0xbe35('0x19')]=_[_0xbe35('0x1a')](config[_0xbe35('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xbe35('0x1b'))(new Redis(config['redis']));require(_0xbe35('0x1c'))[_0xbe35('0x1d')](socket);function respondWithStatusCode(_0x42941b,_0x384b71){_0x384b71=_0x384b71||0xcc;return function(_0x2f7bc9){if(_0x2f7bc9){return _0x42941b['sendStatus'](_0x384b71);}return _0x42941b['status'](_0x384b71)['end']();};}function respondWithResult(_0x362409,_0x3a27bf){_0x3a27bf=_0x3a27bf||0xc8;return function(_0x3da1ef){if(_0x3da1ef){return _0x362409[_0xbe35('0x1e')](_0x3a27bf)['json'](_0x3da1ef);}};}function respondWithFilteredResult(_0x1709ec,_0x234eb7){return function(_0x46d52d){if(_0x46d52d){var _0x40e0fc=typeof _0x234eb7[_0xbe35('0x1f')]===_0xbe35('0x20')&&typeof _0x234eb7[_0xbe35('0x21')]===_0xbe35('0x20');var _0x2e27b6=_0x46d52d[_0xbe35('0x22')];var _0x4ee042=_0x40e0fc?0x0:_0x234eb7[_0xbe35('0x1f')];var _0x1429b6=_0x40e0fc?_0x46d52d[_0xbe35('0x22')]:_0x234eb7['offset']+_0x234eb7[_0xbe35('0x21')];var _0x4139a8;if(_0x1429b6>=_0x2e27b6){_0x1429b6=_0x2e27b6;_0x4139a8=0xc8;}else{_0x4139a8=0xce;}_0x1709ec['status'](_0x4139a8);return _0x1709ec['set'](_0xbe35('0x23'),_0x4ee042+'-'+_0x1429b6+'/'+_0x2e27b6)[_0xbe35('0x24')](_0x46d52d);}return null;};}function patchUpdates(_0x4611ab){return function(_0x52e20e){try{jsonpatch[_0xbe35('0x25')](_0x52e20e,_0x4611ab,!![]);}catch(_0x126c39){return BPromise['reject'](_0x126c39);}return _0x52e20e[_0xbe35('0x26')]();};}function saveUpdates(_0x120455,_0x23fa04){return function(_0x466a33){if(_0x466a33){return _0x466a33['update'](_0x120455)[_0xbe35('0x27')](function(_0x106d31){return _0x106d31;});}return null;};}function removeEntity(_0x34c3ce,_0x533d1d){return function(_0x4f7d23){if(_0x4f7d23){return _0x4f7d23[_0xbe35('0x28')]()['then'](function(){var _0x38b3d4=_0x4f7d23[_0xbe35('0x29')]({'plain':!![]});var _0x2efe5e=_0xbe35('0x2a');return db[_0xbe35('0x2b')][_0xbe35('0x28')]({'where':{'type':_0x2efe5e,'resourceId':_0x38b3d4['id']}})['then'](function(){return _0x4f7d23;});})['then'](function(){_0x34c3ce[_0xbe35('0x1e')](0xcc)[_0xbe35('0x2c')]();});}};}function handleEntityNotFound(_0x1a2011,_0x454384){return function(_0x3c83c3){if(!_0x3c83c3){_0x1a2011['sendStatus'](0x194);}return _0x3c83c3;};}function handleError(_0x73d8a0,_0x54f49a){_0x54f49a=_0x54f49a||0x1f4;return function(_0x801970){logger[_0xbe35('0x2d')](_0x801970[_0xbe35('0x2e')]);if(_0x801970[_0xbe35('0x2f')]){delete _0x801970[_0xbe35('0x2f')];}_0x73d8a0[_0xbe35('0x1e')](_0x54f49a)[_0xbe35('0x30')](_0x801970);};}exports[_0xbe35('0x31')]=function(_0x35eac4,_0x91d2a8){var _0x11256d={},_0x34924a={},_0x3e71cd={'count':0x0,'rows':[]};var _0x3c602e=_[_0xbe35('0x32')](db[_0xbe35('0x33')][_0xbe35('0x34')],function(_0x362d8f){return{'name':_0x362d8f[_0xbe35('0x35')],'type':_0x362d8f[_0xbe35('0x36')][_0xbe35('0x37')]};});_0x34924a[_0xbe35('0x38')]=_[_0xbe35('0x32')](_0x3c602e,_0xbe35('0x2f'));_0x34924a[_0xbe35('0x39')]=_['keys'](_0x35eac4['query']);_0x34924a['filters']=_[_0xbe35('0x3a')](_0x34924a['model'],_0x34924a['query']);_0x11256d[_0xbe35('0x3b')]=_[_0xbe35('0x3a')](_0x34924a[_0xbe35('0x38')],qs['fields'](_0x35eac4['query'][_0xbe35('0x3c')]));_0x11256d['attributes']=_0x11256d[_0xbe35('0x3b')]['length']?_0x11256d[_0xbe35('0x3b')]:_0x34924a['model'];if(!_0x35eac4[_0xbe35('0x39')][_0xbe35('0x3d')](_0xbe35('0x3e'))){_0x11256d[_0xbe35('0x21')]=qs[_0xbe35('0x21')](_0x35eac4[_0xbe35('0x39')][_0xbe35('0x21')]);_0x11256d[_0xbe35('0x1f')]=qs[_0xbe35('0x1f')](_0x35eac4[_0xbe35('0x39')][_0xbe35('0x1f')]);}_0x11256d[_0xbe35('0x3f')]=qs[_0xbe35('0x40')](_0x35eac4[_0xbe35('0x39')]['sort']);_0x11256d[_0xbe35('0x41')]=qs[_0xbe35('0x42')](_[_0xbe35('0x43')](_0x35eac4[_0xbe35('0x39')],_0x34924a[_0xbe35('0x42')]),_0x3c602e);if(_0x35eac4[_0xbe35('0x39')][_0xbe35('0x44')]){_0x11256d[_0xbe35('0x41')]=_[_0xbe35('0x45')](_0x11256d[_0xbe35('0x41')],{'$or':_['map'](_0x3c602e,function(_0x305f60){if(_0x305f60[_0xbe35('0x36')]!==_0xbe35('0x46')){var _0x4db638={};_0x4db638[_0x305f60[_0xbe35('0x2f')]]={'$like':'%'+_0x35eac4[_0xbe35('0x39')][_0xbe35('0x44')]+'%'};return _0x4db638;}})});}_0x11256d=_[_0xbe35('0x45')]({},_0x11256d,_0x35eac4[_0xbe35('0x47')]);var _0x1ac60f={'where':_0x11256d[_0xbe35('0x41')]};return db[_0xbe35('0x33')][_0xbe35('0x22')](_0x1ac60f)[_0xbe35('0x27')](function(_0x5ec61d){_0x3e71cd[_0xbe35('0x22')]=_0x5ec61d;if(_0x35eac4[_0xbe35('0x39')][_0xbe35('0x48')]){_0x11256d['include']=[{'all':!![]}];}return db[_0xbe35('0x33')]['findAll'](_0x11256d);})['then'](function(_0x34c196){_0x3e71cd[_0xbe35('0x49')]=_0x34c196;return _0x3e71cd;})[_0xbe35('0x27')](respondWithFilteredResult(_0x91d2a8,_0x11256d))[_0xbe35('0x4a')](handleError(_0x91d2a8,null));};exports[_0xbe35('0x4b')]=function(_0x4acd4,_0x3412e4){var _0x49fd79={'raw':!![],'where':{'id':_0x4acd4['params']['id']}},_0x16f8ab={};_0x16f8ab[_0xbe35('0x38')]=_[_0xbe35('0x4c')](db[_0xbe35('0x33')][_0xbe35('0x34')]);_0x16f8ab[_0xbe35('0x39')]=_['keys'](_0x4acd4[_0xbe35('0x39')]);_0x16f8ab['filters']=_['intersection'](_0x16f8ab[_0xbe35('0x38')],_0x16f8ab[_0xbe35('0x39')]);_0x49fd79['attributes']=_['intersection'](_0x16f8ab[_0xbe35('0x38')],qs['fields'](_0x4acd4[_0xbe35('0x39')][_0xbe35('0x3c')]));_0x49fd79['attributes']=_0x49fd79[_0xbe35('0x3b')]['length']?_0x49fd79[_0xbe35('0x3b')]:_0x16f8ab[_0xbe35('0x38')];if(_0x4acd4[_0xbe35('0x39')]['includeAll']){_0x49fd79[_0xbe35('0x4d')]=[{'all':!![]}];}_0x49fd79=_['merge']({},_0x49fd79,_0x4acd4[_0xbe35('0x47')]);return db[_0xbe35('0x33')][_0xbe35('0x4e')](_0x49fd79)[_0xbe35('0x27')](handleEntityNotFound(_0x3412e4,null))[_0xbe35('0x27')](respondWithResult(_0x3412e4,null))[_0xbe35('0x4a')](handleError(_0x3412e4,null));};exports[_0xbe35('0x4f')]=function(_0x56134d,_0x38faea){return db['FaxQueue'][_0xbe35('0x4f')](_0x56134d['body'],{})[_0xbe35('0x27')](function(_0x431a0d){var _0x9c8b6f=_0x56134d[_0xbe35('0x50')]['get']({'plain':!![]});if(!_0x9c8b6f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9c8b6f[_0xbe35('0x51')]===_0xbe35('0x50')){var _0x1066d2=_0x431a0d[_0xbe35('0x29')]({'plain':!![]});var _0x133beb=_0xbe35('0x2a');return db[_0xbe35('0x52')][_0xbe35('0x4e')]({'where':{'name':_0x133beb,'userProfileId':_0x9c8b6f['userProfileId']},'raw':!![]})[_0xbe35('0x27')](function(_0x57daa1){if(_0x57daa1&&_0x57daa1[_0xbe35('0x53')]===0x0){return db['UserProfileResource'][_0xbe35('0x4f')]({'name':_0x1066d2[_0xbe35('0x2f')],'resourceId':_0x1066d2['id'],'type':_0x57daa1[_0xbe35('0x2f')],'sectionId':_0x57daa1['id']},{})[_0xbe35('0x27')](function(){return _0x431a0d;});}else{return _0x431a0d;}})['catch'](function(_0x52a633){logger[_0xbe35('0x2d')](_0xbe35('0x54'),_0x52a633);throw _0x52a633;});}return _0x431a0d;})['then'](respondWithResult(_0x38faea,0xc9))[_0xbe35('0x4a')](handleError(_0x38faea,null));};exports[_0xbe35('0x55')]=function(_0x51afb6,_0x14e90b){if(_0x51afb6['body']['id']){delete _0x51afb6[_0xbe35('0x56')]['id'];}return db['FaxQueue']['find']({'where':{'id':_0x51afb6[_0xbe35('0x57')]['id']}})[_0xbe35('0x27')](handleEntityNotFound(_0x14e90b,null))[_0xbe35('0x27')](saveUpdates(_0x51afb6[_0xbe35('0x56')],null))[_0xbe35('0x27')](respondWithResult(_0x14e90b,null))['catch'](handleError(_0x14e90b,null));};exports[_0xbe35('0x28')]=function(_0x951696,_0x3783a1){return db[_0xbe35('0x33')][_0xbe35('0x4e')]({'where':{'id':_0x951696['params']['id']}})['then'](handleEntityNotFound(_0x3783a1,null))[_0xbe35('0x27')](removeEntity(_0x3783a1,null))[_0xbe35('0x4a')](handleError(_0x3783a1,null));};exports[_0xbe35('0x58')]=function(_0x43a8c0,_0x57a627){return db[_0xbe35('0x33')]['describe']()[_0xbe35('0x27')](respondWithResult(_0x57a627,null))['catch'](handleError(_0x57a627,null));};exports[_0xbe35('0x59')]=function(_0x39e925,_0x2c64ff,_0x2556de){var _0x56a776={'raw':!![],'where':{}},_0x29edbe={},_0x4a2d7d;return db[_0xbe35('0x33')][_0xbe35('0x5a')]({'where':{'id':_0x39e925['params']['id']}})[_0xbe35('0x27')](handleEntityNotFound(_0x2c64ff,null))['then'](function(_0x26df6f){if(_0x26df6f){_0x4a2d7d=_0x26df6f[_0xbe35('0x29')]({'plain':!![]});_0x29edbe['model']=_[_0xbe35('0x4c')](db[_0xbe35('0x5b')][_0xbe35('0x34')]);_0x29edbe['query']=_[_0xbe35('0x4c')](_0x39e925[_0xbe35('0x39')]);_0x29edbe[_0xbe35('0x42')]=_['intersection'](_0x29edbe['model'],_0x29edbe[_0xbe35('0x39')]);_0x56a776['attributes']=_[_0xbe35('0x3a')](_0x29edbe['model'],qs[_0xbe35('0x3c')](_0x39e925['query']['fields']));_0x56a776['attributes']=_0x56a776['attributes'][_0xbe35('0x5c')]?_0x56a776[_0xbe35('0x3b')]:_0x29edbe[_0xbe35('0x38')];if(!_0x39e925[_0xbe35('0x39')]['hasOwnProperty'](_0xbe35('0x3e'))){_0x56a776[_0xbe35('0x21')]=qs[_0xbe35('0x21')](_0x39e925[_0xbe35('0x39')][_0xbe35('0x21')]);_0x56a776[_0xbe35('0x1f')]=qs['offset'](_0x39e925[_0xbe35('0x39')]['offset']);}_0x56a776['order']=qs[_0xbe35('0x40')](_0x39e925['query'][_0xbe35('0x40')]);_0x56a776[_0xbe35('0x41')]=qs[_0xbe35('0x42')](_[_0xbe35('0x43')](_0x39e925[_0xbe35('0x39')],_0x29edbe[_0xbe35('0x42')]));_0x56a776[_0xbe35('0x41')][_0xbe35('0x5d')]=_0x26df6f['id'];if(_0x39e925[_0xbe35('0x39')][_0xbe35('0x44')]){_0x56a776[_0xbe35('0x41')]=_[_0xbe35('0x45')](_0x56a776[_0xbe35('0x41')],{'$or':_[_0xbe35('0x32')](_0x56a776[_0xbe35('0x3b')],function(_0x615b4d){var _0x25d652={};_0x25d652[_0x615b4d]={'$like':'%'+_0x39e925['query'][_0xbe35('0x44')]+'%'};return _0x25d652;})});}_0x56a776=_[_0xbe35('0x45')]({},_0x56a776,_0x39e925[_0xbe35('0x47')]);return db['UserFaxQueue']['findAll'](_0x56a776);}})['then'](function(_0x1af730){if(_0x1af730){return db[_0xbe35('0x5e')]['findAndCountAll']({'where':{'id':_[_0xbe35('0x32')](_0x1af730,_0xbe35('0x5f')),'role':'agent'},'attributes':['id',_0xbe35('0x2f'),_0xbe35('0x60'),'updatedAt','createdAt']});}})[_0xbe35('0x27')](function(_0x2a8711){if(_0x2a8711){return{'count':_0x2a8711[_0xbe35('0x22')],'rows':_[_0xbe35('0x32')](_0x2a8711[_0xbe35('0x49')],function(_0x5d2428){return{'membername':_0x5d2428[_0xbe35('0x2f')],'UserId':_0x5d2428['id'],'queue_name':_0x4a2d7d[_0xbe35('0x2f')],'FaxQueueId':_0x4a2d7d['id'],'interface':util[_0xbe35('0x61')](_0xbe35('0x62'),_0xbe35('0x63'),_0x5d2428[_0xbe35('0x2f')]),'penalty':0x0,'paused':_0x5d2428['faxPause'],'createdAt':_0x5d2428[_0xbe35('0x64')],'updatedAt':_0x5d2428[_0xbe35('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbe35('0x27')](respondWithFilteredResult(_0x2c64ff,_0x56a776))['catch'](handleError(_0x2c64ff,null));};exports[_0xbe35('0x66')]=function(_0x33316a,_0x374efe,_0x4d914b){var _0x5281b5={};var _0xe13c6d={};var _0x113eb0;var _0x4f5f09;return db['FaxQueue'][_0xbe35('0x5a')]({'where':{'id':_0x33316a[_0xbe35('0x57')]['id']}})[_0xbe35('0x27')](handleEntityNotFound(_0x374efe,null))[_0xbe35('0x27')](function(_0x45da4b){if(_0x45da4b){_0x113eb0=_0x45da4b;_0xe13c6d[_0xbe35('0x38')]=_[_0xbe35('0x4c')](db[_0xbe35('0x67')]['rawAttributes']);_0xe13c6d['query']=_['keys'](_0x33316a['query']);_0xe13c6d[_0xbe35('0x42')]=_[_0xbe35('0x3a')](_0xe13c6d['model'],_0xe13c6d[_0xbe35('0x39')]);_0x5281b5['attributes']=_['intersection'](_0xe13c6d[_0xbe35('0x38')],qs[_0xbe35('0x3c')](_0x33316a[_0xbe35('0x39')][_0xbe35('0x3c')]));_0x5281b5[_0xbe35('0x3b')]=_0x5281b5['attributes'][_0xbe35('0x5c')]?_0x5281b5[_0xbe35('0x3b')]:_0xe13c6d['model'];_0x5281b5[_0xbe35('0x3f')]=qs[_0xbe35('0x40')](_0x33316a[_0xbe35('0x39')][_0xbe35('0x40')]);_0x5281b5[_0xbe35('0x41')]=qs[_0xbe35('0x42')](_['pick'](_0x33316a[_0xbe35('0x39')],_0xe13c6d[_0xbe35('0x42')]));if(_0x33316a[_0xbe35('0x39')]['filter']){_0x5281b5[_0xbe35('0x41')]=_['merge'](_0x5281b5[_0xbe35('0x41')],{'$or':_[_0xbe35('0x32')](_0x5281b5[_0xbe35('0x3b')],function(_0x134b0f){var _0x547c7b={};_0x547c7b[_0x134b0f]={'$like':'%'+_0x33316a[_0xbe35('0x39')][_0xbe35('0x44')]+'%'};return _0x547c7b;})});}_0x5281b5=_[_0xbe35('0x45')]({},_0x5281b5,_0x33316a[_0xbe35('0x47')]);return _0x113eb0[_0xbe35('0x66')](_0x5281b5);}})[_0xbe35('0x27')](function(_0x2e4086){if(_0x2e4086){_0x4f5f09=_0x2e4086[_0xbe35('0x5c')];if(!_0x33316a[_0xbe35('0x39')]['hasOwnProperty'](_0xbe35('0x3e'))){_0x5281b5['limit']=qs['limit'](_0x33316a[_0xbe35('0x39')]['limit']);_0x5281b5[_0xbe35('0x1f')]=qs[_0xbe35('0x1f')](_0x33316a[_0xbe35('0x39')][_0xbe35('0x1f')]);}return _0x113eb0[_0xbe35('0x66')](_0x5281b5);}})[_0xbe35('0x27')](function(_0x3128b4){if(_0x3128b4){return _0x3128b4?{'count':_0x4f5f09,'rows':_0x3128b4}:null;}})[_0xbe35('0x27')](respondWithResult(_0x374efe,null))[_0xbe35('0x4a')](handleError(_0x374efe,null));};exports['addTeams']=function(_0x1d2e70,_0x36aafc,_0x4e74a5){var _0x1dfc49=_0x1d2e70[_0xbe35('0x56')][_0xbe35('0x68')];return db['Team'][_0xbe35('0x69')]({'where':{'id':_0x1dfc49},'attributes':['id'],'include':[{'model':db[_0xbe35('0x5e')],'as':_0xbe35('0x6a'),'attributes':['id',_0xbe35('0x2f'),_0xbe35('0x6b'),'voicePause',_0xbe35('0x6c')],'raw':!![]}]})[_0xbe35('0x27')](function(_0x3ced80){if(_0x3ced80){var _0x2fcbae=_[_0xbe35('0x6d')](_0x3ced80,function(_0x1c57eb){var _0x4b3338=_0x1c57eb[_0xbe35('0x29')]({'plain':!![]});return _0x4b3338[_0xbe35('0x6a')];});return db[_0xbe35('0x33')][_0xbe35('0x4e')]({'where':{'id':_0x1d2e70['params']['id']}})[_0xbe35('0x27')](function(_0x1eac8e){return db[_0xbe35('0x6e')][_0xbe35('0x6f')](function(_0x3c4739){return _0x1eac8e[_0xbe35('0x70')](_0x1dfc49,{'transaction':_0x3c4739})['then'](function(){return BPromise['each'](_0x2fcbae,function(_0xabf845){return db[_0xbe35('0x5b')][_0xbe35('0x71')]({'where':{'UserId':_0xabf845['id'],'FaxQueueId':_0x1d2e70[_0xbe35('0x57')]['id']},'transaction':_0x3c4739});});})['then'](function(){_0x2fcbae[_0xbe35('0x72')](function(_0x41821e){socket[_0xbe35('0x73')](_0xbe35('0x74'),{'UserId':_0x41821e['id'],'FaxQueueId':_0x1eac8e['id']});});});});});}})[_0xbe35('0x27')](respondWithStatusCode(_0x36aafc,null))[_0xbe35('0x4a')](handleError(_0x36aafc,null));};exports[_0xbe35('0x75')]=function(_0x47bb6e,_0x2e1852,_0x1a00dc){return db['Team']['findAll']({'where':{'id':_0x47bb6e['query'][_0xbe35('0x68')]},'attributes':['id'],'include':[{'model':db[_0xbe35('0x5e')],'as':_0xbe35('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xbe35('0x27')](handleEntityNotFound(_0x2e1852,null))[_0xbe35('0x27')](function(_0x5075c4){var _0x4ab38d=_[_0xbe35('0x32')](_0x5075c4,'id');var _0x219f90=[];var _0x5bed43=[];var _0x3c9676=squel[_0xbe35('0x76')]();_0x3c9676['field'](_0xbe35('0x77'))[_0xbe35('0x78')]('team_has_fax_queues','tq')[_0xbe35('0x79')](_0xbe35('0x7a'),'ut',_0xbe35('0x7b'))[_0xbe35('0x41')](_0xbe35('0x7c'),_0x47bb6e[_0xbe35('0x57')]['id']);for(var _0x4eaaeb=0x0;_0x4eaaeb<_0x5075c4[_0xbe35('0x5c')];_0x4eaaeb+=0x1){let _0x190747=_0x5075c4[_0x4eaaeb];for(var _0x16d3c3=0x0;_0x16d3c3<_0x190747[_0xbe35('0x6a')]['length'];_0x16d3c3+=0x1){let _0x46faf9=_0x190747[_0xbe35('0x6a')][_0x16d3c3];var _0x40acbf=_0x3c9676[_0xbe35('0x7d')]();_0x40acbf[_0xbe35('0x41')]('ut.UserId\x20=\x20?',_0x46faf9['id']);_0x5bed43['push'](db[_0xbe35('0x6e')][_0xbe35('0x39')](_0x40acbf[_0xbe35('0x7e')](),{'type':db[_0xbe35('0x6e')][_0xbe35('0x7f')][_0xbe35('0x80')]})[_0xbe35('0x27')](function(_0x12fcbc){if(_0x12fcbc[_0xbe35('0x5c')]===0x1){return _0x46faf9['id'];}else{var _0x30856d=_['every'](_['map'](_0x12fcbc,_0xbe35('0x81')),function(_0x49f2fb){return _['includes'](_0x4ab38d,_0x49f2fb);});if(_0x30856d){return _0x46faf9['id'];}}}));}}return BPromise[_0xbe35('0x82')](_0x5bed43)['then'](function(_0x3f3658){_0x219f90=_(_0x219f90)[_0xbe35('0x83')](_0x3f3658)[_0xbe35('0x84')]()[_0xbe35('0x85')]();return db[_0xbe35('0x33')][_0xbe35('0x4e')]({'where':{'id':_0x47bb6e[_0xbe35('0x57')]['id']}})[_0xbe35('0x27')](function(_0x2b74a7){return db[_0xbe35('0x6e')][_0xbe35('0x6f')](function(_0x5b0a2d){return _0x2b74a7[_0xbe35('0x75')](_0x47bb6e['query']['ids'],{'transaction':_0x5b0a2d})[_0xbe35('0x27')](function(){if(!_[_0xbe35('0x86')](_0x219f90)){return _0x2b74a7['removeAgents'](_0x219f90,{'transaction':_0x5b0a2d});}})[_0xbe35('0x27')](function(){_0x219f90[_0xbe35('0x72')](function(_0x2697d0){socket['emit'](_0xbe35('0x87'),{'UserId':_0x2697d0,'FaxQueueId':_0x2b74a7['id']});});});});});});})[_0xbe35('0x27')](respondWithStatusCode(_0x2e1852,null))[_0xbe35('0x4a')](handleError(_0x2e1852,null));};exports[_0xbe35('0x88')]=function(_0xc21987,_0x519654,_0x4d148f){return db[_0xbe35('0x33')][_0xbe35('0x4e')]({'where':{'id':_0xc21987[_0xbe35('0x57')]['id']}})[_0xbe35('0x27')](handleEntityNotFound(_0x519654,null))[_0xbe35('0x27')](function(_0xab4002){if(_0xab4002){return _0xab4002[_0xbe35('0x88')](_0xc21987['body'][_0xbe35('0x68')],_[_0xbe35('0x89')](_0xc21987[_0xbe35('0x56')],[_0xbe35('0x68'),'id'])||{})[_0xbe35('0x8a')](function(_0x3dfc92){for(var _0x59c877=0x0;_0x59c877<_0xc21987[_0xbe35('0x56')]['ids'][_0xbe35('0x5c')];_0x59c877+=0x1){socket[_0xbe35('0x73')](_0xbe35('0x74'),{'UserId':Number(_0xc21987[_0xbe35('0x56')][_0xbe35('0x68')][_0x59c877]),'FaxQueueId':Number(_0xc21987[_0xbe35('0x57')]['id'])});}return _0x3dfc92;});}})[_0xbe35('0x27')](respondWithResult(_0x519654,null))['catch'](handleError(_0x519654,null));};exports[_0xbe35('0x8b')]=function(_0x309746,_0x3e1a35,_0x398274){return db[_0xbe35('0x33')][_0xbe35('0x4e')]({'where':{'id':_0x309746['params']['id']}})[_0xbe35('0x27')](handleEntityNotFound(_0x3e1a35,null))[_0xbe35('0x27')](function(_0x1cd8f6){if(_0x1cd8f6){return _0x1cd8f6[_0xbe35('0x8b')](_0x309746[_0xbe35('0x39')][_0xbe35('0x68')])[_0xbe35('0x27')](function(){if(_[_0xbe35('0x8c')](_0x309746[_0xbe35('0x39')][_0xbe35('0x68')])){for(var _0x450722=0x0;_0x450722<_0x309746[_0xbe35('0x39')]['ids'][_0xbe35('0x5c')];_0x450722+=0x1){socket['emit'](_0xbe35('0x87'),{'UserId':Number(_0x309746[_0xbe35('0x39')]['ids'][_0x450722]),'FaxQueueId':Number(_0x309746[_0xbe35('0x57')]['id'])});}}else{socket['emit'](_0xbe35('0x87'),{'UserId':Number(_0x309746[_0xbe35('0x39')][_0xbe35('0x68')]),'FaxQueueId':Number(_0x309746[_0xbe35('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x3e1a35,null))['catch'](handleError(_0x3e1a35,null));};exports['getAgents']=function(_0x332d4d,_0x56fff3,_0x4f0472){var _0x5890ce={};var _0x1193f0={};var _0x3c8d55;var _0x4e264e;return db[_0xbe35('0x33')]['findOne']({'where':{'id':_0x332d4d['params']['id']}})['then'](handleEntityNotFound(_0x56fff3,null))['then'](function(_0x5be8ab){if(_0x5be8ab){_0x3c8d55=_0x5be8ab;_0x1193f0[_0xbe35('0x38')]=_[_0xbe35('0x4c')](db[_0xbe35('0x5e')][_0xbe35('0x34')]);_0x1193f0[_0xbe35('0x39')]=_[_0xbe35('0x4c')](_0x332d4d[_0xbe35('0x39')]);_0x1193f0[_0xbe35('0x42')]=_[_0xbe35('0x3a')](_0x1193f0[_0xbe35('0x38')],_0x1193f0[_0xbe35('0x39')]);_0x5890ce[_0xbe35('0x3b')]=_['intersection'](_0x1193f0[_0xbe35('0x38')],qs[_0xbe35('0x3c')](_0x332d4d[_0xbe35('0x39')][_0xbe35('0x3c')]));_0x5890ce['attributes']=_0x5890ce[_0xbe35('0x3b')][_0xbe35('0x5c')]?_0x5890ce[_0xbe35('0x3b')]:_0x1193f0[_0xbe35('0x38')];_0x5890ce[_0xbe35('0x3f')]=qs[_0xbe35('0x40')](_0x332d4d[_0xbe35('0x39')]['sort']);_0x5890ce[_0xbe35('0x41')]=qs[_0xbe35('0x42')](_[_0xbe35('0x43')](_0x332d4d[_0xbe35('0x39')],_0x1193f0[_0xbe35('0x42')]));if(_0x332d4d[_0xbe35('0x39')][_0xbe35('0x44')]){_0x5890ce[_0xbe35('0x41')]=_[_0xbe35('0x45')](_0x5890ce[_0xbe35('0x41')],{'$or':_[_0xbe35('0x32')](_0x5890ce['attributes'],function(_0x15112c){var _0x2be73e={};_0x2be73e[_0x15112c]={'$like':'%'+_0x332d4d[_0xbe35('0x39')][_0xbe35('0x44')]+'%'};return _0x2be73e;})});}_0x5890ce=_[_0xbe35('0x45')]({},_0x5890ce,_0x332d4d[_0xbe35('0x47')]);return _0x3c8d55['getAgents'](_0x5890ce);}})[_0xbe35('0x27')](function(_0x2e044e){if(_0x2e044e){_0x4e264e=_0x2e044e['length'];if(!_0x332d4d[_0xbe35('0x39')][_0xbe35('0x3d')](_0xbe35('0x3e'))){_0x5890ce[_0xbe35('0x21')]=qs['limit'](_0x332d4d[_0xbe35('0x39')][_0xbe35('0x21')]);_0x5890ce[_0xbe35('0x1f')]=qs[_0xbe35('0x1f')](_0x332d4d[_0xbe35('0x39')]['offset']);}return _0x3c8d55[_0xbe35('0x8d')](_0x5890ce);}})[_0xbe35('0x27')](function(_0x2e0431){if(_0x2e0431){return _0x2e0431?{'count':_0x4e264e,'rows':_0x2e0431}:null;}})[_0xbe35('0x27')](respondWithResult(_0x56fff3,null))[_0xbe35('0x4a')](handleError(_0x56fff3,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 918f1a3..d275ebe 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 _0x0c1f=['../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1a2a82,_0x4afcc3){var _0x363418=function(_0x496a15){while(--_0x496a15){_0x1a2a82['push'](_0x1a2a82['shift']());}};_0x363418(++_0x4afcc3);}(_0x0c1f,0x1c2));var _0xf0c1=function(_0x170994,_0x5adc66){_0x170994=_0x170994-0x0;var _0x3c89a3=_0x0c1f[_0x170994];return _0x3c89a3;};'use strict';var EventEmitter=require(_0xf0c1('0x0'));var FaxQueue=require(_0xf0c1('0x1'))['db'][_0xf0c1('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xf0c1('0x3')](0x0);var events={'afterCreate':_0xf0c1('0x4'),'afterUpdate':_0xf0c1('0x5'),'afterDestroy':_0xf0c1('0x6')};function emitEvent(_0x9c7f78){return function(_0x4146e4,_0x422324,_0x35ba93){FaxQueueEvents[_0xf0c1('0x7')](_0x9c7f78+':'+_0x4146e4['id'],_0x4146e4);FaxQueueEvents[_0xf0c1('0x7')](_0x9c7f78,_0x4146e4);_0x35ba93(null);};}for(var e in events){if(events[_0xf0c1('0x8')](e)){var event=events[e];FaxQueue[_0xf0c1('0x9')](e,emitEvent(event));}}module[_0xf0c1('0xa')]=FaxQueueEvents; \ No newline at end of file +var _0xa045=['../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x429a84,_0x43a55d){var _0x1d7e28=function(_0x1deec4){while(--_0x1deec4){_0x429a84['push'](_0x429a84['shift']());}};_0x1d7e28(++_0x43a55d);}(_0xa045,0x81));var _0x5a04=function(_0x4d7ea6,_0x463467){_0x4d7ea6=_0x4d7ea6-0x0;var _0x30d4ef=_0xa045[_0x4d7ea6];return _0x30d4ef;};'use strict';var EventEmitter=require(_0x5a04('0x0'));var FaxQueue=require(_0x5a04('0x1'))['db'][_0x5a04('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x5a04('0x3')](0x0);var events={'afterCreate':_0x5a04('0x4'),'afterUpdate':_0x5a04('0x5'),'afterDestroy':_0x5a04('0x6')};function emitEvent(_0x5d2745){return function(_0x563809,_0x2b435c,_0x58c570){FaxQueueEvents[_0x5a04('0x7')](_0x5d2745+':'+_0x563809['id'],_0x563809);FaxQueueEvents[_0x5a04('0x7')](_0x5d2745,_0x563809);_0x58c570(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x5a04('0x8')](e,emitEvent(event));}}module[_0x5a04('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 3d1e88d..169f6b5 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 _0x36dc=['define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','path','./faxQueue.attributes','exports'];(function(_0x206192,_0x111bb2){var _0x27e778=function(_0x34c63c){while(--_0x34c63c){_0x206192['push'](_0x206192['shift']());}};_0x27e778(++_0x111bb2);}(_0x36dc,0x6f));var _0xc36d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36dc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc36d('0x0'));var util=require(_0xc36d('0x1'));var logger=require(_0xc36d('0x2'))(_0xc36d('0x3'));var moment=require(_0xc36d('0x4'));var BPromise=require(_0xc36d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc36d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc36d('0x7'));module[_0xc36d('0x8')]=function(_0x4c64f3,_0x3085f4){return _0x4c64f3[_0xc36d('0x9')](_0xc36d('0xa'),attributes,{'tableName':_0xc36d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11b3=['rimraf','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','util','../../config/logger','bluebird','request-promise','path'];(function(_0x812d11,_0x4cb3be){var _0x29a80f=function(_0x18ecbd){while(--_0x18ecbd){_0x812d11['push'](_0x812d11['shift']());}};_0x29a80f(++_0x4cb3be);}(_0x11b3,0x103));var _0x311b=function(_0x37890e,_0x3a1168){_0x37890e=_0x37890e-0x0;var _0x20f70e=_0x11b3[_0x37890e];return _0x20f70e;};'use strict';var _=require('lodash');var util=require(_0x311b('0x0'));var logger=require(_0x311b('0x1'))('api');var moment=require('moment');var BPromise=require(_0x311b('0x2'));var rp=require(_0x311b('0x3'));var fs=require('fs');var path=require(_0x311b('0x4'));var rimraf=require(_0x311b('0x5'));var config=require(_0x311b('0x6'));var attributes=require(_0x311b('0x7'));module[_0x311b('0x8')]=function(_0xfd4a9e,_0x11b52e){return _0xfd4a9e[_0x311b('0x9')]('FaxQueue',attributes,{'tableName':_0x311b('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 8293718..5c89eaa 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 _0xed52=['include','map','model','ShowFaxQueue','find','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit'];(function(_0x17fe76,_0x43007a){var _0x175979=function(_0x1c859f){while(--_0x1c859f){_0x17fe76['push'](_0x17fe76['shift']());}};_0x175979(++_0x43007a);}(_0xed52,0x11d));var _0x2ed5=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xed52[_0x543084];return _0x306a57;};'use strict';var _=require('lodash');var util=require(_0x2ed5('0x0'));var moment=require(_0x2ed5('0x1'));var BPromise=require('bluebird');var rs=require(_0x2ed5('0x2'));var fs=require('fs');var Redis=require(_0x2ed5('0x3'));var db=require(_0x2ed5('0x4'))['db'];var utils=require(_0x2ed5('0x5'));var logger=require(_0x2ed5('0x6'))(_0x2ed5('0x7'));var config=require('../../config/environment');var jayson=require(_0x2ed5('0x8'));var client=jayson['client'][_0x2ed5('0x9')]({'port':0x232a});config[_0x2ed5('0xa')]=_[_0x2ed5('0xb')](config[_0x2ed5('0xa')],{'host':_0x2ed5('0xc'),'port':0x18eb});var socket=require(_0x2ed5('0xd'))(new Redis(config[_0x2ed5('0xa')]));require(_0x2ed5('0xe'))[_0x2ed5('0xf')](socket);function respondWithRpcPromise(_0x1b83eb,_0x1a59fa,_0x4a91d0){return new BPromise(function(_0x445e38,_0x15af8b){return client[_0x2ed5('0x10')](_0x1b83eb,_0x4a91d0)[_0x2ed5('0x11')](function(_0x2b816f){logger[_0x2ed5('0x12')]('FaxQueue,\x20%s,\x20%s',_0x1a59fa,_0x2ed5('0x13'));logger[_0x2ed5('0x14')](_0x2ed5('0x15'),_0x1a59fa,_0x2ed5('0x13'),JSON[_0x2ed5('0x16')](_0x2b816f));if(_0x2b816f['error']){if(_0x2b816f[_0x2ed5('0x17')][_0x2ed5('0x18')]===0x1f4){logger['error'](_0x2ed5('0x19'),_0x1a59fa,_0x2b816f[_0x2ed5('0x17')][_0x2ed5('0x1a')]);return _0x15af8b(_0x2b816f[_0x2ed5('0x17')][_0x2ed5('0x1a')]);}logger[_0x2ed5('0x17')](_0x2ed5('0x19'),_0x1a59fa,_0x2b816f['error'][_0x2ed5('0x1a')]);return _0x445e38(_0x2b816f[_0x2ed5('0x17')][_0x2ed5('0x1a')]);}else{logger['info'](_0x2ed5('0x19'),_0x1a59fa,'request\x20sent');_0x445e38(_0x2b816f['result'][_0x2ed5('0x1a')]);}})[_0x2ed5('0x1b')](function(_0x566361){logger[_0x2ed5('0x17')](_0x2ed5('0x19'),_0x1a59fa,_0x566361);_0x15af8b(_0x566361);});});}exports[_0x2ed5('0x1c')]=function(_0x256793){var _0x701944=this;return new Promise(function(_0x3e7724,_0x42fb62){return db[_0x2ed5('0x1d')]['findAll']({'raw':_0x256793['options']?_0x256793[_0x2ed5('0x1e')][_0x2ed5('0x1f')]===undefined?!![]:![]:!![],'where':_0x256793[_0x2ed5('0x1e')]?_0x256793[_0x2ed5('0x1e')][_0x2ed5('0x20')]||null:null,'attributes':_0x256793[_0x2ed5('0x1e')]?_0x256793[_0x2ed5('0x1e')][_0x2ed5('0x21')]||null:null,'limit':_0x256793['options']?_0x256793[_0x2ed5('0x1e')][_0x2ed5('0x22')]||null:null,'include':_0x256793[_0x2ed5('0x1e')]?_0x256793[_0x2ed5('0x1e')][_0x2ed5('0x23')]?_[_0x2ed5('0x24')](_0x256793[_0x2ed5('0x1e')]['include'],function(_0x46423d){return{'model':db[_0x46423d['model']],'as':_0x46423d['as'],'attributes':_0x46423d[_0x2ed5('0x21')],'include':_0x46423d[_0x2ed5('0x23')]?_['map'](_0x46423d[_0x2ed5('0x23')],function(_0x38d04f){return{'model':db[_0x38d04f[_0x2ed5('0x25')]],'as':_0x38d04f['as'],'attributes':_0x38d04f[_0x2ed5('0x21')],'include':_0x38d04f[_0x2ed5('0x23')]?_[_0x2ed5('0x24')](_0x38d04f[_0x2ed5('0x23')],function(_0x5f592f){return{'model':db[_0x5f592f[_0x2ed5('0x25')]],'as':_0x5f592f['as'],'attributes':_0x5f592f['attributes']};}):[]};}):[]};}):[]:[]})[_0x2ed5('0x11')](function(_0x1ea8da){logger[_0x2ed5('0x12')](_0x2ed5('0x1c'),_0x256793);logger['debug'](_0x2ed5('0x1c'),_0x256793,JSON[_0x2ed5('0x16')](_0x1ea8da));_0x3e7724(_0x1ea8da);})[_0x2ed5('0x1b')](function(_0x463aef){logger[_0x2ed5('0x17')](_0x2ed5('0x1c'),_0x463aef['message'],_0x256793);_0x42fb62(_0x701944[_0x2ed5('0x17')](0x1f4,_0x463aef[_0x2ed5('0x1a')]));});});};exports[_0x2ed5('0x26')]=function(_0x34b155){var _0x11b3b5=this;return new Promise(function(_0x2e182c,_0x143f1f){return db[_0x2ed5('0x1d')][_0x2ed5('0x27')]({'raw':_0x34b155[_0x2ed5('0x1e')]?_0x34b155['options'][_0x2ed5('0x1f')]===undefined?!![]:![]:!![],'where':_0x34b155[_0x2ed5('0x1e')]?_0x34b155[_0x2ed5('0x1e')][_0x2ed5('0x20')]||null:null,'attributes':_0x34b155[_0x2ed5('0x1e')]?_0x34b155['options'][_0x2ed5('0x21')]||null:null,'include':_0x34b155[_0x2ed5('0x1e')]?_0x34b155['options']['include']?_[_0x2ed5('0x24')](_0x34b155[_0x2ed5('0x1e')][_0x2ed5('0x23')],function(_0x4334c1){return{'model':db[_0x4334c1[_0x2ed5('0x25')]],'as':_0x4334c1['as'],'attributes':_0x4334c1[_0x2ed5('0x21')],'include':_0x4334c1[_0x2ed5('0x23')]?_[_0x2ed5('0x24')](_0x4334c1[_0x2ed5('0x23')],function(_0x4d0ec0){return{'model':db[_0x4d0ec0[_0x2ed5('0x25')]],'as':_0x4d0ec0['as'],'attributes':_0x4d0ec0[_0x2ed5('0x21')],'include':_0x4d0ec0[_0x2ed5('0x23')]?_['map'](_0x4d0ec0[_0x2ed5('0x23')],function(_0x37ec70){return{'model':db[_0x37ec70[_0x2ed5('0x25')]],'as':_0x37ec70['as'],'attributes':_0x37ec70[_0x2ed5('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2ed5('0x11')](function(_0x3e5497){logger[_0x2ed5('0x12')](_0x2ed5('0x26'),_0x34b155);logger[_0x2ed5('0x14')](_0x2ed5('0x26'),_0x34b155,JSON[_0x2ed5('0x16')](_0x3e5497));_0x2e182c(_0x3e5497);})[_0x2ed5('0x1b')](function(_0x5264ab){logger[_0x2ed5('0x17')]('ShowFaxQueue',_0x5264ab[_0x2ed5('0x1a')],_0x34b155);_0x143f1f(_0x11b3b5['error'](0x1f4,_0x5264ab[_0x2ed5('0x1a')]));});});}; \ No newline at end of file +var _0x6dff=['FaxQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','attributes','limit','include','model','map','info','ShowFaxQueue','find','lodash','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1793de,_0x4d7233){var _0x4f0309=function(_0x229ee7){while(--_0x229ee7){_0x1793de['push'](_0x1793de['shift']());}};_0x4f0309(++_0x4d7233);}(_0x6dff,0x125));var _0xf6df=function(_0x282a4d,_0x31c277){_0x282a4d=_0x282a4d-0x0;var _0x91b3b=_0x6dff[_0x282a4d];return _0x91b3b;};'use strict';var _=require(_0xf6df('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf6df('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf6df('0x2'))['db'];var utils=require(_0xf6df('0x3'));var logger=require('../../config/logger')(_0xf6df('0x4'));var config=require(_0xf6df('0x5'));var jayson=require(_0xf6df('0x6'));var client=jayson[_0xf6df('0x7')][_0xf6df('0x8')]({'port':0x232a});config[_0xf6df('0x9')]=_[_0xf6df('0xa')](config[_0xf6df('0x9')],{'host':_0xf6df('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf6df('0x9')]));require(_0xf6df('0xc'))[_0xf6df('0xd')](socket);function respondWithRpcPromise(_0x5a56e3,_0xd7520b,_0x10c300){return new BPromise(function(_0x28ab18,_0x2e7706){return client[_0xf6df('0xe')](_0x5a56e3,_0x10c300)[_0xf6df('0xf')](function(_0x2459ee){logger['info'](_0xf6df('0x10'),_0xd7520b,_0xf6df('0x11'));logger[_0xf6df('0x12')](_0xf6df('0x13'),_0xd7520b,'request\x20sent',JSON[_0xf6df('0x14')](_0x2459ee));if(_0x2459ee['error']){if(_0x2459ee['error'][_0xf6df('0x15')]===0x1f4){logger[_0xf6df('0x16')](_0xf6df('0x10'),_0xd7520b,_0x2459ee[_0xf6df('0x16')]['message']);return _0x2e7706(_0x2459ee[_0xf6df('0x16')]['message']);}logger['error'](_0xf6df('0x10'),_0xd7520b,_0x2459ee[_0xf6df('0x16')][_0xf6df('0x17')]);return _0x28ab18(_0x2459ee[_0xf6df('0x16')]['message']);}else{logger['info'](_0xf6df('0x10'),_0xd7520b,_0xf6df('0x11'));_0x28ab18(_0x2459ee[_0xf6df('0x18')][_0xf6df('0x17')]);}})[_0xf6df('0x19')](function(_0x108929){logger[_0xf6df('0x16')](_0xf6df('0x10'),_0xd7520b,_0x108929);_0x2e7706(_0x108929);});});}exports[_0xf6df('0x1a')]=function(_0x5ce219){var _0x1e8de8=this;return new Promise(function(_0x29b28b,_0x3637df){return db[_0xf6df('0x1b')][_0xf6df('0x1c')]({'raw':_0x5ce219[_0xf6df('0x1d')]?_0x5ce219['options'][_0xf6df('0x1e')]===undefined?!![]:![]:!![],'where':_0x5ce219[_0xf6df('0x1d')]?_0x5ce219[_0xf6df('0x1d')]['where']||null:null,'attributes':_0x5ce219[_0xf6df('0x1d')]?_0x5ce219[_0xf6df('0x1d')][_0xf6df('0x1f')]||null:null,'limit':_0x5ce219[_0xf6df('0x1d')]?_0x5ce219[_0xf6df('0x1d')][_0xf6df('0x20')]||null:null,'include':_0x5ce219['options']?_0x5ce219[_0xf6df('0x1d')][_0xf6df('0x21')]?_['map'](_0x5ce219[_0xf6df('0x1d')][_0xf6df('0x21')],function(_0x2fa644){return{'model':db[_0x2fa644['model']],'as':_0x2fa644['as'],'attributes':_0x2fa644[_0xf6df('0x1f')],'include':_0x2fa644[_0xf6df('0x21')]?_['map'](_0x2fa644['include'],function(_0x5b860c){return{'model':db[_0x5b860c[_0xf6df('0x22')]],'as':_0x5b860c['as'],'attributes':_0x5b860c[_0xf6df('0x1f')],'include':_0x5b860c['include']?_[_0xf6df('0x23')](_0x5b860c[_0xf6df('0x21')],function(_0x42e035){return{'model':db[_0x42e035[_0xf6df('0x22')]],'as':_0x42e035['as'],'attributes':_0x42e035[_0xf6df('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf6df('0xf')](function(_0x5cd47c){logger[_0xf6df('0x24')](_0xf6df('0x1a'),_0x5ce219);logger[_0xf6df('0x12')](_0xf6df('0x1a'),_0x5ce219,JSON['stringify'](_0x5cd47c));_0x29b28b(_0x5cd47c);})[_0xf6df('0x19')](function(_0x372ab4){logger[_0xf6df('0x16')](_0xf6df('0x1a'),_0x372ab4['message'],_0x5ce219);_0x3637df(_0x1e8de8[_0xf6df('0x16')](0x1f4,_0x372ab4[_0xf6df('0x17')]));});});};exports[_0xf6df('0x25')]=function(_0x5a5e5d){var _0x1cf3bb=this;return new Promise(function(_0x12ddb1,_0x558604){return db[_0xf6df('0x1b')][_0xf6df('0x26')]({'raw':_0x5a5e5d[_0xf6df('0x1d')]?_0x5a5e5d['options'][_0xf6df('0x1e')]===undefined?!![]:![]:!![],'where':_0x5a5e5d['options']?_0x5a5e5d[_0xf6df('0x1d')]['where']||null:null,'attributes':_0x5a5e5d[_0xf6df('0x1d')]?_0x5a5e5d[_0xf6df('0x1d')]['attributes']||null:null,'include':_0x5a5e5d[_0xf6df('0x1d')]?_0x5a5e5d[_0xf6df('0x1d')][_0xf6df('0x21')]?_[_0xf6df('0x23')](_0x5a5e5d[_0xf6df('0x1d')]['include'],function(_0x2335ff){return{'model':db[_0x2335ff[_0xf6df('0x22')]],'as':_0x2335ff['as'],'attributes':_0x2335ff[_0xf6df('0x1f')],'include':_0x2335ff[_0xf6df('0x21')]?_[_0xf6df('0x23')](_0x2335ff['include'],function(_0x2da658){return{'model':db[_0x2da658['model']],'as':_0x2da658['as'],'attributes':_0x2da658['attributes'],'include':_0x2da658[_0xf6df('0x21')]?_[_0xf6df('0x23')](_0x2da658[_0xf6df('0x21')],function(_0x3e7d77){return{'model':db[_0x3e7d77['model']],'as':_0x3e7d77['as'],'attributes':_0x3e7d77['attributes']};}):[]};}):[]};}):[]:[]})[_0xf6df('0xf')](function(_0x1e27e1){logger['info'](_0xf6df('0x25'),_0x5a5e5d);logger[_0xf6df('0x12')](_0xf6df('0x25'),_0x5a5e5d,JSON[_0xf6df('0x14')](_0x1e27e1));_0x12ddb1(_0x1e27e1);})['catch'](function(_0x1532e4){logger['error']('ShowFaxQueue',_0x1532e4[_0xf6df('0x17')],_0x5a5e5d);_0x558604(_0x1cf3bb['error'](0x1f4,_0x1532e4['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 720a3a7..e20431a 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 _0x51a8=['update','emit','removeListener','register','length','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x51a8,0xfa));var _0x851a=function(_0x474250,_0x1891fd){_0x474250=_0x474250-0x0;var _0x71002b=_0x51a8[_0x474250];return _0x71002b;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x851a('0x0'),_0x851a('0x1'),_0x851a('0x2')];function createListener(_0x57a2b9,_0x319094){return function(_0x543403){_0x319094[_0x851a('0x3')](_0x57a2b9,_0x543403);};}function removeListener(_0x209a86,_0x52c568){return function(){FaxQueueEvents[_0x851a('0x4')](_0x209a86,_0x52c568);};}exports[_0x851a('0x5')]=function(_0x5224fe){for(var _0x18e04c=0x0,_0x26aa61=events[_0x851a('0x6')];_0x18e04c<_0x26aa61;_0x18e04c++){var _0x1bf8ec=events[_0x18e04c];var _0x5653f3=createListener('faxQueue:'+_0x1bf8ec,_0x5224fe);FaxQueueEvents['on'](_0x1bf8ec,_0x5653f3);}}; \ No newline at end of file +var _0xf9d9=['length','faxQueue:','remove','update','emit','register'];(function(_0x34d2a5,_0x443fbe){var _0x174ea8=function(_0x30144f){while(--_0x30144f){_0x34d2a5['push'](_0x34d2a5['shift']());}};_0x174ea8(++_0x443fbe);}(_0xf9d9,0x182));var _0x9f9d=function(_0x14a79a,_0x281ce9){_0x14a79a=_0x14a79a-0x0;var _0x55d55b=_0xf9d9[_0x14a79a];return _0x55d55b;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save',_0x9f9d('0x0'),_0x9f9d('0x1')];function createListener(_0x527ea0,_0x4841b4){return function(_0x1ed179){_0x4841b4[_0x9f9d('0x2')](_0x527ea0,_0x1ed179);};}function removeListener(_0x1bc781,_0x537805){return function(){FaxQueueEvents['removeListener'](_0x1bc781,_0x537805);};}exports[_0x9f9d('0x3')]=function(_0x34e5be){for(var _0x2bccae=0x0,_0x5b39f0=events[_0x9f9d('0x4')];_0x2bccae<_0x5b39f0;_0x2bccae++){var _0x18203c=events[_0x2bccae];var _0x5a4620=createListener(_0x9f9d('0x5')+_0x18203c,_0x34e5be);FaxQueueEvents['on'](_0x18203c,_0x5a4620);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index f7c81c8..c5889c8 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 _0x13f5=['util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','put','update','delete','removeTeams','exports','multer'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x13f5,0xc3));var _0x513f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x13f5[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x513f('0x0'));var util=require(_0x513f('0x1'));var path=require(_0x513f('0x2'));var timeout=require(_0x513f('0x3'));var express=require('express');var router=express[_0x513f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x513f('0x5'));var config=require(_0x513f('0x6'));var controller=require(_0x513f('0x7'));router[_0x513f('0x8')]('/',auth[_0x513f('0x9')](),controller[_0x513f('0xa')]);router[_0x513f('0x8')](_0x513f('0xb'),auth[_0x513f('0x9')](),controller[_0x513f('0xc')]);router[_0x513f('0x8')](_0x513f('0xd'),auth['isAuthenticated'](),controller[_0x513f('0xe')]);router[_0x513f('0x8')](_0x513f('0xf'),auth[_0x513f('0x9')](),controller[_0x513f('0x10')]);router['get'](_0x513f('0x11'),auth[_0x513f('0x9')](),controller['getTeams']);router[_0x513f('0x8')](_0x513f('0x12'),auth[_0x513f('0x9')](),controller[_0x513f('0x13')]);router[_0x513f('0x14')]('/',auth[_0x513f('0x9')](),controller[_0x513f('0x15')]);router[_0x513f('0x14')](_0x513f('0x11'),auth[_0x513f('0x9')](),controller[_0x513f('0x16')]);router[_0x513f('0x14')](_0x513f('0x12'),auth[_0x513f('0x9')](),controller['addAgents']);router[_0x513f('0x17')]('/:id',auth[_0x513f('0x9')](),controller[_0x513f('0x18')]);router[_0x513f('0x19')](_0x513f('0xd'),auth[_0x513f('0x9')](),controller['destroy']);router[_0x513f('0x19')](_0x513f('0x11'),auth['isAuthenticated'](),controller[_0x513f('0x1a')]);router['delete'](_0x513f('0x12'),auth[_0x513f('0x9')](),controller['removeAgents']);module[_0x513f('0x1b')]=router; \ No newline at end of file +var _0xfb11=['Router','../../components/auth/service','../../config/environment','./faxQueue.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/members','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout'];(function(_0x330265,_0x4b6ddf){var _0x4ed8d6=function(_0x799144){while(--_0x799144){_0x330265['push'](_0x330265['shift']());}};_0x4ed8d6(++_0x4b6ddf);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xfb11[_0x1d9aa0];return _0x226868;};'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('0xb')](_0x1fb1('0xe'),auth[_0x1fb1('0x7')](),controller['getMembers']);router[_0x1fb1('0xb')]('/:id/teams',auth[_0x1fb1('0x7')](),controller['getTeams']);router[_0x1fb1('0xb')](_0x1fb1('0xf'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x10')]);router[_0x1fb1('0x11')]('/',auth[_0x1fb1('0x7')](),controller['create']);router[_0x1fb1('0x11')](_0x1fb1('0x12'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x13')]);router[_0x1fb1('0x11')](_0x1fb1('0xf'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x14')]);router[_0x1fb1('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x1fb1('0x16')]);router[_0x1fb1('0x17')](_0x1fb1('0xc'),auth['isAuthenticated'](),controller[_0x1fb1('0x18')]);router[_0x1fb1('0x17')](_0x1fb1('0x12'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x19')]);router[_0x1fb1('0x17')](_0x1fb1('0xf'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 50b6c1d..94658aa 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 _0x995a=['moment','sequelize','exports','STRING','DATE'];(function(_0x2eef8c,_0x15a03d){var _0x1bec99=function(_0x193a31){while(--_0x193a31){_0x2eef8c['push'](_0x2eef8c['shift']());}};_0x1bec99(++_0x15a03d);}(_0x995a,0xa0));var _0xa995=function(_0x373a0f,_0x444f58){_0x373a0f=_0x373a0f-0x0;var _0x35401a=_0x995a[_0x373a0f];return _0x35401a;};'use strict';var moment=require(_0xa995('0x0'));var Sequelize=require(_0xa995('0x1'));module[_0xa995('0x2')]={'uniqueid':{'type':Sequelize[_0xa995('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa995('0x3')]},'joinAt':{'type':Sequelize[_0xa995('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa995('0x4')]},'exitAt':{'type':Sequelize[_0xa995('0x4')]},'reason':{'type':Sequelize[_0xa995('0x3')]}}; \ No newline at end of file +var _0x8892=['sequelize','exports','STRING','DATE'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x8892,0x1e0));var _0x2889=function(_0x3d3425,_0x10dbd6){_0x3d3425=_0x3d3425-0x0;var _0x31068b=_0x8892[_0x3d3425];return _0x31068b;};'use strict';var moment=require('moment');var Sequelize=require(_0x2889('0x0'));module[_0x2889('0x1')]={'uniqueid':{'type':Sequelize[_0x2889('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x2889('0x3')]},'leaveAt':{'type':Sequelize[_0x2889('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x2889('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 652c46f..652152b 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 _0x4ded=['squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject','save','update','then','destroy','stack','name','index','FaxQueueReport','rawAttributes','key','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','model','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash'];(function(_0xd878c8,_0x32adc0){var _0x4800ba=function(_0x304dc1){while(--_0x304dc1){_0xd878c8['push'](_0xd878c8['shift']());}};_0x4800ba(++_0x32adc0);}(_0x4ded,0x116));var _0xd4de=function(_0x500a6e,_0x3dd849){_0x500a6e=_0x500a6e-0x0;var _0x38af82=_0x4ded[_0x500a6e];return _0x38af82;};'use strict';var emlformat=require(_0xd4de('0x0'));var rimraf=require(_0xd4de('0x1'));var zipdir=require(_0xd4de('0x2'));var jsonpatch=require(_0xd4de('0x3'));var rp=require(_0xd4de('0x4'));var moment=require(_0xd4de('0x5'));var BPromise=require(_0xd4de('0x6'));var Mustache=require(_0xd4de('0x7'));var util=require(_0xd4de('0x8'));var path=require(_0xd4de('0x9'));var sox=require(_0xd4de('0xa'));var csv=require(_0xd4de('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd4de('0xc'));var _=require(_0xd4de('0xd'));var squel=require(_0xd4de('0xe'));var crypto=require(_0xd4de('0xf'));var jsforce=require(_0xd4de('0x10'));var deskjs=require(_0xd4de('0x11'));var toCsv=require('to-csv');var querystring=require(_0xd4de('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd4de('0x13'));var as=require(_0xd4de('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd4de('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd4de('0x16'));var db=require(_0xd4de('0x17'))['db'];function respondWithStatusCode(_0x104dad,_0x2aa09d){_0x2aa09d=_0x2aa09d||0xcc;return function(_0x3ffc72){if(_0x3ffc72){return _0x104dad[_0xd4de('0x18')](_0x2aa09d);}return _0x104dad[_0xd4de('0x19')](_0x2aa09d)[_0xd4de('0x1a')]();};}function respondWithResult(_0x3e3735,_0x37cb9f){_0x37cb9f=_0x37cb9f||0xc8;return function(_0x691ba9){if(_0x691ba9){return _0x3e3735[_0xd4de('0x19')](_0x37cb9f)[_0xd4de('0x1b')](_0x691ba9);}};}function respondWithFilteredResult(_0xbb4f7e,_0x102e5b){return function(_0xa7c18b){if(_0xa7c18b){var _0x325fba=typeof _0x102e5b['offset']==='undefined'&&typeof _0x102e5b[_0xd4de('0x1c')]===_0xd4de('0x1d');var _0x17b377=_0xa7c18b[_0xd4de('0x1e')];var _0x5b1d1c=_0x325fba?0x0:_0x102e5b['offset'];var _0x1e91d5=_0x325fba?_0xa7c18b['count']:_0x102e5b[_0xd4de('0x1f')]+_0x102e5b[_0xd4de('0x1c')];var _0x50b9e3;if(_0x1e91d5>=_0x17b377){_0x1e91d5=_0x17b377;_0x50b9e3=0xc8;}else{_0x50b9e3=0xce;}_0xbb4f7e[_0xd4de('0x19')](_0x50b9e3);return _0xbb4f7e['set'](_0xd4de('0x20'),_0x5b1d1c+'-'+_0x1e91d5+'/'+_0x17b377)[_0xd4de('0x1b')](_0xa7c18b);}return null;};}function patchUpdates(_0x2bad14){return function(_0x8e8712){try{jsonpatch['apply'](_0x8e8712,_0x2bad14,!![]);}catch(_0x318658){return BPromise[_0xd4de('0x21')](_0x318658);}return _0x8e8712[_0xd4de('0x22')]();};}function saveUpdates(_0xdb3fc,_0x1c631a){return function(_0x2d092a){if(_0x2d092a){return _0x2d092a[_0xd4de('0x23')](_0xdb3fc)[_0xd4de('0x24')](function(_0x2f9de6){return _0x2f9de6;});}return null;};}function removeEntity(_0x413f68,_0x534b37){return function(_0xad333f){if(_0xad333f){return _0xad333f[_0xd4de('0x25')]()[_0xd4de('0x24')](function(){_0x413f68[_0xd4de('0x19')](0xcc)[_0xd4de('0x1a')]();});}};}function handleEntityNotFound(_0x984904,_0xffe1cc){return function(_0x36308c){if(!_0x36308c){_0x984904[_0xd4de('0x18')](0x194);}return _0x36308c;};}function handleError(_0x260c5c,_0x2ea712){_0x2ea712=_0x2ea712||0x1f4;return function(_0xb2d8a1){logger['error'](_0xb2d8a1[_0xd4de('0x26')]);if(_0xb2d8a1[_0xd4de('0x27')]){delete _0xb2d8a1['name'];}_0x260c5c[_0xd4de('0x19')](_0x2ea712)['send'](_0xb2d8a1);};}exports[_0xd4de('0x28')]=function(_0x32e407,_0x15d2b7){var _0x4fa53a={},_0xd4de93={},_0x36f2f1={'count':0x0,'rows':[]};var _0x17f0a=_['map'](db[_0xd4de('0x29')][_0xd4de('0x2a')],function(_0x55f9f9){return{'name':_0x55f9f9['fieldName'],'type':_0x55f9f9['type'][_0xd4de('0x2b')]};});_0xd4de93['model']=_[_0xd4de('0x2c')](_0x17f0a,_0xd4de('0x27'));_0xd4de93[_0xd4de('0x2d')]=_[_0xd4de('0x2e')](_0x32e407['query']);_0xd4de93[_0xd4de('0x2f')]=_[_0xd4de('0x30')](_0xd4de93['model'],_0xd4de93[_0xd4de('0x2d')]);_0x4fa53a[_0xd4de('0x31')]=_['intersection'](_0xd4de93['model'],qs[_0xd4de('0x32')](_0x32e407[_0xd4de('0x2d')][_0xd4de('0x32')]));_0x4fa53a[_0xd4de('0x31')]=_0x4fa53a['attributes'][_0xd4de('0x33')]?_0x4fa53a[_0xd4de('0x31')]:_0xd4de93['model'];if(!_0x32e407[_0xd4de('0x2d')][_0xd4de('0x34')](_0xd4de('0x35'))){_0x4fa53a[_0xd4de('0x1c')]=qs[_0xd4de('0x1c')](_0x32e407[_0xd4de('0x2d')]['limit']);_0x4fa53a['offset']=qs[_0xd4de('0x1f')](_0x32e407[_0xd4de('0x2d')][_0xd4de('0x1f')]);}_0x4fa53a['order']=qs[_0xd4de('0x36')](_0x32e407[_0xd4de('0x2d')]['sort']);_0x4fa53a[_0xd4de('0x37')]=qs[_0xd4de('0x2f')](_[_0xd4de('0x38')](_0x32e407[_0xd4de('0x2d')],_0xd4de93['filters']),_0x17f0a);if(_0x32e407['query'][_0xd4de('0x39')]){_0x4fa53a['where']=_[_0xd4de('0x3a')](_0x4fa53a['where'],{'$or':_[_0xd4de('0x2c')](_0x17f0a,function(_0xcc1d7){if(_0xcc1d7[_0xd4de('0x3b')]!==_0xd4de('0x3c')){var _0x4e6843={};_0x4e6843[_0xcc1d7[_0xd4de('0x27')]]={'$like':'%'+_0x32e407['query'][_0xd4de('0x39')]+'%'};return _0x4e6843;}})});}_0x4fa53a=_[_0xd4de('0x3a')]({},_0x4fa53a,_0x32e407[_0xd4de('0x3d')]);var _0x4517a6={'where':_0x4fa53a[_0xd4de('0x37')]};return db[_0xd4de('0x29')][_0xd4de('0x1e')](_0x4517a6)['then'](function(_0x2333f6){_0x36f2f1[_0xd4de('0x1e')]=_0x2333f6;if(_0x32e407[_0xd4de('0x2d')][_0xd4de('0x3e')]){_0x4fa53a[_0xd4de('0x3f')]=[{'all':!![]}];}return db['FaxQueueReport'][_0xd4de('0x40')](_0x4fa53a);})[_0xd4de('0x24')](function(_0x2294e2){_0x36f2f1['rows']=_0x2294e2;return _0x36f2f1;})[_0xd4de('0x24')](respondWithFilteredResult(_0x15d2b7,_0x4fa53a))[_0xd4de('0x41')](handleError(_0x15d2b7,null));};exports[_0xd4de('0x42')]=function(_0x516542,_0x3b9026){var _0x10a42c={'raw':!![],'where':{'id':_0x516542[_0xd4de('0x43')]['id']}},_0x419c49={};_0x419c49[_0xd4de('0x44')]=_[_0xd4de('0x2e')](db[_0xd4de('0x29')]['rawAttributes']);_0x419c49[_0xd4de('0x2d')]=_[_0xd4de('0x2e')](_0x516542[_0xd4de('0x2d')]);_0x419c49['filters']=_[_0xd4de('0x30')](_0x419c49[_0xd4de('0x44')],_0x419c49[_0xd4de('0x2d')]);_0x10a42c['attributes']=_['intersection'](_0x419c49[_0xd4de('0x44')],qs[_0xd4de('0x32')](_0x516542['query'][_0xd4de('0x32')]));_0x10a42c[_0xd4de('0x31')]=_0x10a42c[_0xd4de('0x31')][_0xd4de('0x33')]?_0x10a42c['attributes']:_0x419c49[_0xd4de('0x44')];if(_0x516542[_0xd4de('0x2d')][_0xd4de('0x3e')]){_0x10a42c[_0xd4de('0x3f')]=[{'all':!![]}];}_0x10a42c=_[_0xd4de('0x3a')]({},_0x10a42c,_0x516542[_0xd4de('0x3d')]);return db['FaxQueueReport'][_0xd4de('0x45')](_0x10a42c)[_0xd4de('0x24')](handleEntityNotFound(_0x3b9026,null))[_0xd4de('0x24')](respondWithResult(_0x3b9026,null))[_0xd4de('0x41')](handleError(_0x3b9026,null));};exports[_0xd4de('0x46')]=function(_0x1a2bc3,_0x40bf55){return db[_0xd4de('0x29')][_0xd4de('0x46')](_0x1a2bc3[_0xd4de('0x47')],{})['then'](respondWithResult(_0x40bf55,0xc9))[_0xd4de('0x41')](handleError(_0x40bf55,null));};exports[_0xd4de('0x23')]=function(_0x178daf,_0x518bfe){if(_0x178daf[_0xd4de('0x47')]['id']){delete _0x178daf[_0xd4de('0x47')]['id'];}return db[_0xd4de('0x29')][_0xd4de('0x45')]({'where':{'id':_0x178daf[_0xd4de('0x43')]['id']}})[_0xd4de('0x24')](handleEntityNotFound(_0x518bfe,null))[_0xd4de('0x24')](saveUpdates(_0x178daf[_0xd4de('0x47')],null))[_0xd4de('0x24')](respondWithResult(_0x518bfe,null))[_0xd4de('0x41')](handleError(_0x518bfe,null));};exports['destroy']=function(_0x3e4c7f,_0x26d032){return db[_0xd4de('0x29')][_0xd4de('0x45')]({'where':{'id':_0x3e4c7f[_0xd4de('0x43')]['id']}})['then'](handleEntityNotFound(_0x26d032,null))['then'](removeEntity(_0x26d032,null))[_0xd4de('0x41')](handleError(_0x26d032,null));};exports[_0xd4de('0x48')]=function(_0x4f9b6b,_0x48cb7d){return db[_0xd4de('0x29')][_0xd4de('0x48')]()[_0xd4de('0x24')](respondWithResult(_0x48cb7d,null))[_0xd4de('0x41')](handleError(_0x48cb7d,null));}; \ No newline at end of file +var _0x8278=['zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','count','save','update','destroy','end','error','stack','name','send','FaxQueueReport','fieldName','type','key','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','then','findAll','rows','catch','params','model','includeAll','find','create','body','describe','eml-format','rimraf'];(function(_0x46b22a,_0x5bf83a){var _0x44c2e8=function(_0x21b6fc){while(--_0x21b6fc){_0x46b22a['push'](_0x46b22a['shift']());}};_0x44c2e8(++_0x5bf83a);}(_0x8278,0x1ae));var _0x8827=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8278[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x8827('0x0'));var rimraf=require(_0x8827('0x1'));var zipdir=require(_0x8827('0x2'));var jsonpatch=require(_0x8827('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8827('0x4'));var Mustache=require(_0x8827('0x5'));var util=require(_0x8827('0x6'));var path=require(_0x8827('0x7'));var sox=require('sox');var csv=require(_0x8827('0x8'));var ejs=require(_0x8827('0x9'));var fs=require('fs');var fs_extra=require(_0x8827('0xa'));var _=require(_0x8827('0xb'));var squel=require(_0x8827('0xc'));var crypto=require(_0x8827('0xd'));var jsforce=require(_0x8827('0xe'));var deskjs=require(_0x8827('0xf'));var toCsv=require(_0x8827('0x8'));var querystring=require(_0x8827('0x10'));var Papa=require(_0x8827('0x11'));var Redis=require(_0x8827('0x12'));var authService=require(_0x8827('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8827('0x14'));var hardwareService=require(_0x8827('0x15'));var logger=require('../../config/logger')(_0x8827('0x16'));var utils=require(_0x8827('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8827('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a180c,_0x2cce86){_0x2cce86=_0x2cce86||0xcc;return function(_0x449408){if(_0x449408){return _0x4a180c[_0x8827('0x19')](_0x2cce86);}return _0x4a180c[_0x8827('0x1a')](_0x2cce86)['end']();};}function respondWithResult(_0x2334cb,_0xc0b479){_0xc0b479=_0xc0b479||0xc8;return function(_0x29639d){if(_0x29639d){return _0x2334cb[_0x8827('0x1a')](_0xc0b479)[_0x8827('0x1b')](_0x29639d);}};}function respondWithFilteredResult(_0x16fd76,_0x20c6b7){return function(_0x560fba){if(_0x560fba){var _0x4456e3=typeof _0x20c6b7[_0x8827('0x1c')]===_0x8827('0x1d')&&typeof _0x20c6b7['limit']===_0x8827('0x1d');var _0xa8569a=_0x560fba[_0x8827('0x1e')];var _0x4c7bbb=_0x4456e3?0x0:_0x20c6b7['offset'];var _0x4484ba=_0x4456e3?_0x560fba[_0x8827('0x1e')]:_0x20c6b7['offset']+_0x20c6b7['limit'];var _0x32fd04;if(_0x4484ba>=_0xa8569a){_0x4484ba=_0xa8569a;_0x32fd04=0xc8;}else{_0x32fd04=0xce;}_0x16fd76['status'](_0x32fd04);return _0x16fd76['set']('Content-Range',_0x4c7bbb+'-'+_0x4484ba+'/'+_0xa8569a)[_0x8827('0x1b')](_0x560fba);}return null;};}function patchUpdates(_0x161283){return function(_0x35ffe0){try{jsonpatch['apply'](_0x35ffe0,_0x161283,!![]);}catch(_0x14f344){return BPromise['reject'](_0x14f344);}return _0x35ffe0[_0x8827('0x1f')]();};}function saveUpdates(_0x186787,_0x5df50d){return function(_0x47efe7){if(_0x47efe7){return _0x47efe7[_0x8827('0x20')](_0x186787)['then'](function(_0x2915b6){return _0x2915b6;});}return null;};}function removeEntity(_0x52e0d6,_0x43f846){return function(_0xc7069d){if(_0xc7069d){return _0xc7069d[_0x8827('0x21')]()['then'](function(){_0x52e0d6[_0x8827('0x1a')](0xcc)[_0x8827('0x22')]();});}};}function handleEntityNotFound(_0xa8216,_0x5ecafa){return function(_0x44de19){if(!_0x44de19){_0xa8216['sendStatus'](0x194);}return _0x44de19;};}function handleError(_0x4210c7,_0x363a48){_0x363a48=_0x363a48||0x1f4;return function(_0x544a0a){logger[_0x8827('0x23')](_0x544a0a[_0x8827('0x24')]);if(_0x544a0a[_0x8827('0x25')]){delete _0x544a0a[_0x8827('0x25')];}_0x4210c7[_0x8827('0x1a')](_0x363a48)[_0x8827('0x26')](_0x544a0a);};}exports['index']=function(_0x58e238,_0x455b17){var _0x5e2ed4={},_0xf84db2={},_0x115267={'count':0x0,'rows':[]};var _0x5322a4=_['map'](db[_0x8827('0x27')]['rawAttributes'],function(_0x6fb312){return{'name':_0x6fb312[_0x8827('0x28')],'type':_0x6fb312[_0x8827('0x29')][_0x8827('0x2a')]};});_0xf84db2['model']=_[_0x8827('0x2b')](_0x5322a4,'name');_0xf84db2['query']=_[_0x8827('0x2c')](_0x58e238[_0x8827('0x2d')]);_0xf84db2[_0x8827('0x2e')]=_[_0x8827('0x2f')](_0xf84db2['model'],_0xf84db2[_0x8827('0x2d')]);_0x5e2ed4[_0x8827('0x30')]=_[_0x8827('0x2f')](_0xf84db2['model'],qs[_0x8827('0x31')](_0x58e238['query'][_0x8827('0x31')]));_0x5e2ed4[_0x8827('0x30')]=_0x5e2ed4['attributes'][_0x8827('0x32')]?_0x5e2ed4[_0x8827('0x30')]:_0xf84db2['model'];if(!_0x58e238['query'][_0x8827('0x33')](_0x8827('0x34'))){_0x5e2ed4['limit']=qs['limit'](_0x58e238['query'][_0x8827('0x35')]);_0x5e2ed4['offset']=qs[_0x8827('0x1c')](_0x58e238[_0x8827('0x2d')][_0x8827('0x1c')]);}_0x5e2ed4[_0x8827('0x36')]=qs[_0x8827('0x37')](_0x58e238[_0x8827('0x2d')]['sort']);_0x5e2ed4[_0x8827('0x38')]=qs[_0x8827('0x2e')](_[_0x8827('0x39')](_0x58e238['query'],_0xf84db2[_0x8827('0x2e')]),_0x5322a4);if(_0x58e238[_0x8827('0x2d')]['filter']){_0x5e2ed4['where']=_[_0x8827('0x3a')](_0x5e2ed4[_0x8827('0x38')],{'$or':_[_0x8827('0x2b')](_0x5322a4,function(_0x32fead){if(_0x32fead[_0x8827('0x29')]!==_0x8827('0x3b')){var _0x2dd883={};_0x2dd883[_0x32fead['name']]={'$like':'%'+_0x58e238[_0x8827('0x2d')]['filter']+'%'};return _0x2dd883;}})});}_0x5e2ed4=_[_0x8827('0x3a')]({},_0x5e2ed4,_0x58e238[_0x8827('0x3c')]);var _0x13b8f0={'where':_0x5e2ed4[_0x8827('0x38')]};return db[_0x8827('0x27')][_0x8827('0x1e')](_0x13b8f0)[_0x8827('0x3d')](function(_0x40436a){_0x115267[_0x8827('0x1e')]=_0x40436a;if(_0x58e238[_0x8827('0x2d')]['includeAll']){_0x5e2ed4['include']=[{'all':!![]}];}return db[_0x8827('0x27')][_0x8827('0x3e')](_0x5e2ed4);})[_0x8827('0x3d')](function(_0x37da4a){_0x115267[_0x8827('0x3f')]=_0x37da4a;return _0x115267;})[_0x8827('0x3d')](respondWithFilteredResult(_0x455b17,_0x5e2ed4))[_0x8827('0x40')](handleError(_0x455b17,null));};exports['show']=function(_0x576a9d,_0x10cd30){var _0x5d812c={'raw':!![],'where':{'id':_0x576a9d[_0x8827('0x41')]['id']}},_0x5da6dc={};_0x5da6dc[_0x8827('0x42')]=_[_0x8827('0x2c')](db[_0x8827('0x27')]['rawAttributes']);_0x5da6dc['query']=_[_0x8827('0x2c')](_0x576a9d[_0x8827('0x2d')]);_0x5da6dc[_0x8827('0x2e')]=_[_0x8827('0x2f')](_0x5da6dc[_0x8827('0x42')],_0x5da6dc[_0x8827('0x2d')]);_0x5d812c['attributes']=_[_0x8827('0x2f')](_0x5da6dc[_0x8827('0x42')],qs[_0x8827('0x31')](_0x576a9d['query'][_0x8827('0x31')]));_0x5d812c['attributes']=_0x5d812c[_0x8827('0x30')][_0x8827('0x32')]?_0x5d812c[_0x8827('0x30')]:_0x5da6dc['model'];if(_0x576a9d['query'][_0x8827('0x43')]){_0x5d812c['include']=[{'all':!![]}];}_0x5d812c=_[_0x8827('0x3a')]({},_0x5d812c,_0x576a9d[_0x8827('0x3c')]);return db['FaxQueueReport'][_0x8827('0x44')](_0x5d812c)[_0x8827('0x3d')](handleEntityNotFound(_0x10cd30,null))[_0x8827('0x3d')](respondWithResult(_0x10cd30,null))[_0x8827('0x40')](handleError(_0x10cd30,null));};exports[_0x8827('0x45')]=function(_0x5b3e20,_0x989745){return db[_0x8827('0x27')]['create'](_0x5b3e20['body'],{})[_0x8827('0x3d')](respondWithResult(_0x989745,0xc9))[_0x8827('0x40')](handleError(_0x989745,null));};exports['update']=function(_0x361a03,_0x12916c){if(_0x361a03[_0x8827('0x46')]['id']){delete _0x361a03['body']['id'];}return db[_0x8827('0x27')][_0x8827('0x44')]({'where':{'id':_0x361a03[_0x8827('0x41')]['id']}})[_0x8827('0x3d')](handleEntityNotFound(_0x12916c,null))[_0x8827('0x3d')](saveUpdates(_0x361a03[_0x8827('0x46')],null))[_0x8827('0x3d')](respondWithResult(_0x12916c,null))[_0x8827('0x40')](handleError(_0x12916c,null));};exports[_0x8827('0x21')]=function(_0x3d1004,_0x272d1d){return db[_0x8827('0x27')]['find']({'where':{'id':_0x3d1004[_0x8827('0x41')]['id']}})[_0x8827('0x3d')](handleEntityNotFound(_0x272d1d,null))['then'](removeEntity(_0x272d1d,null))[_0x8827('0x40')](handleError(_0x272d1d,null));};exports['describe']=function(_0x91273e,_0x1e6bb6){return db[_0x8827('0x27')][_0x8827('0x47')]()[_0x8827('0x3d')](respondWithResult(_0x1e6bb6,null))[_0x8827('0x40')](handleError(_0x1e6bb6,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 3375880..edae0ce 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(_0x110a06,_0xd7ef07){var _0x50f669=function(_0x2d1c32){while(--_0x2d1c32){_0x110a06['push'](_0x110a06['shift']());}};_0x50f669(++_0xd7ef07);}(_0x1261,0x144));var _0x1126=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x1261[_0xb24a3e];return _0x4038d7;};'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 _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x5525bd,_0x3d54fc){var _0x460c05=function(_0xd84dc3){while(--_0xd84dc3){_0x5525bd['push'](_0x5525bd['shift']());}};_0x460c05(++_0x3d54fc);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xc4aa[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 0655c73..0f9dd8d 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 _0xd362=['catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','then','update','where','limit','UpdateFaxQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','info','request\x20sent','debug','stringify','error','message','FaxQueueReport,\x20%s,\x20%s','result'];(function(_0x210603,_0x4adbac){var _0x1bcb7d=function(_0x2cdf89){while(--_0x2cdf89){_0x210603['push'](_0x210603['shift']());}};_0x1bcb7d(++_0x4adbac);}(_0xd362,0xa1));var _0x2d36=function(_0x1ca890,_0x21d0d3){_0x1ca890=_0x1ca890-0x0;var _0x3f8e01=_0xd362[_0x1ca890];return _0x3f8e01;};'use strict';var _=require('lodash');var util=require(_0x2d36('0x0'));var moment=require(_0x2d36('0x1'));var BPromise=require(_0x2d36('0x2'));var rs=require(_0x2d36('0x3'));var fs=require('fs');var Redis=require(_0x2d36('0x4'));var db=require(_0x2d36('0x5'))['db'];var utils=require(_0x2d36('0x6'));var logger=require('../../config/logger')(_0x2d36('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2d36('0x8')][_0x2d36('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ae7bb,_0x5d5ac6,_0x488265){return new BPromise(function(_0x48d370,_0x67b141){return client[_0x2d36('0xa')](_0x1ae7bb,_0x488265)['then'](function(_0x4fe6b6){logger[_0x2d36('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x5d5ac6,_0x2d36('0xc'));logger[_0x2d36('0xd')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x5d5ac6,_0x2d36('0xc'),JSON[_0x2d36('0xe')](_0x4fe6b6));if(_0x4fe6b6['error']){if(_0x4fe6b6[_0x2d36('0xf')]['code']===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x5d5ac6,_0x4fe6b6[_0x2d36('0xf')][_0x2d36('0x10')]);return _0x67b141(_0x4fe6b6['error'][_0x2d36('0x10')]);}logger[_0x2d36('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x5d5ac6,_0x4fe6b6[_0x2d36('0xf')][_0x2d36('0x10')]);return _0x48d370(_0x4fe6b6['error'][_0x2d36('0x10')]);}else{logger[_0x2d36('0xb')](_0x2d36('0x11'),_0x5d5ac6,_0x2d36('0xc'));_0x48d370(_0x4fe6b6[_0x2d36('0x12')]['message']);}})[_0x2d36('0x13')](function(_0x1dbbae){logger[_0x2d36('0xf')](_0x2d36('0x11'),_0x5d5ac6,_0x1dbbae);_0x67b141(_0x1dbbae);});});}exports[_0x2d36('0x14')]=function(_0x3d8322){var _0x5795ed=this;return new Promise(function(_0x366adf,_0x5aba27){return db[_0x2d36('0x15')][_0x2d36('0x16')](_0x3d8322['body'],{'raw':_0x3d8322[_0x2d36('0x17')]?_0x3d8322[_0x2d36('0x17')][_0x2d36('0x18')]===undefined?!![]:![]:!![]})[_0x2d36('0x19')](function(_0x1407a9){logger[_0x2d36('0xb')]('CreateFaxQueueReport',_0x3d8322);logger[_0x2d36('0xd')]('CreateFaxQueueReport',_0x3d8322,JSON['stringify'](_0x1407a9));_0x366adf(_0x1407a9);})[_0x2d36('0x13')](function(_0x2a8593){logger[_0x2d36('0xf')](_0x2d36('0x14'),_0x2a8593[_0x2d36('0x10')],_0x3d8322);_0x5aba27(_0x5795ed[_0x2d36('0xf')](0x1f4,_0x2a8593[_0x2d36('0x10')]));});});};exports['UpdateFaxQueueReport']=function(_0x5c6692){var _0x1375e3=this;return new Promise(function(_0x4c2a43,_0x19c37d){return db[_0x2d36('0x15')][_0x2d36('0x1a')](_0x5c6692['body'],{'raw':_0x5c6692['options']?_0x5c6692[_0x2d36('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c6692['options']?_0x5c6692[_0x2d36('0x17')][_0x2d36('0x1b')]||null:null,'attributes':_0x5c6692[_0x2d36('0x17')]?_0x5c6692[_0x2d36('0x17')]['attributes']||null:null,'limit':_0x5c6692[_0x2d36('0x17')]?_0x5c6692[_0x2d36('0x17')][_0x2d36('0x1c')]||null:null})[_0x2d36('0x19')](function(_0x113685){logger['info'](_0x2d36('0x1d'),_0x5c6692);logger[_0x2d36('0xd')](_0x2d36('0x1d'),_0x5c6692,JSON[_0x2d36('0xe')](_0x113685));_0x4c2a43(_0x113685);})[_0x2d36('0x13')](function(_0xfd857e){logger[_0x2d36('0xf')](_0x2d36('0x1d'),_0xfd857e[_0x2d36('0x10')],_0x5c6692);_0x19c37d(_0x1375e3[_0x2d36('0xf')](0x1f4,_0xfd857e['message']));});});}; \ No newline at end of file +var _0xbe19=['debug','update','where','attributes','limit','UpdateFaxQueueReport','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','FaxQueueReport,\x20%s,\x20%s','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then'];(function(_0x266219,_0x3428b4){var _0x4c79df=function(_0x49044c){while(--_0x49044c){_0x266219['push'](_0x266219['shift']());}};_0x4c79df(++_0x3428b4);}(_0xbe19,0xd2));var _0x9be1=function(_0x6ddde8,_0x4384a5){_0x6ddde8=_0x6ddde8-0x0;var _0x415afb=_0xbe19[_0x6ddde8];return _0x415afb;};'use strict';var _=require(_0x9be1('0x0'));var util=require(_0x9be1('0x1'));var moment=require(_0x9be1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9be1('0x3'));var db=require(_0x9be1('0x4'))['db'];var utils=require(_0x9be1('0x5'));var logger=require(_0x9be1('0x6'))('rpc');var config=require(_0x9be1('0x7'));var jayson=require(_0x9be1('0x8'));var client=jayson[_0x9be1('0x9')][_0x9be1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22ac96,_0x2f1961,_0x5544fa){return new BPromise(function(_0x4a146c,_0xabd2b4){return client[_0x9be1('0xb')](_0x22ac96,_0x5544fa)['then'](function(_0x527e5c){logger[_0x9be1('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x2f1961,_0x9be1('0xd'));logger['debug'](_0x9be1('0xe'),_0x2f1961,_0x9be1('0xd'),JSON[_0x9be1('0xf')](_0x527e5c));if(_0x527e5c['error']){if(_0x527e5c[_0x9be1('0x10')]['code']===0x1f4){logger[_0x9be1('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x2f1961,_0x527e5c[_0x9be1('0x10')]['message']);return _0xabd2b4(_0x527e5c[_0x9be1('0x10')][_0x9be1('0x11')]);}logger[_0x9be1('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x2f1961,_0x527e5c['error'][_0x9be1('0x11')]);return _0x4a146c(_0x527e5c[_0x9be1('0x10')][_0x9be1('0x11')]);}else{logger['info'](_0x9be1('0x12'),_0x2f1961,'request\x20sent');_0x4a146c(_0x527e5c[_0x9be1('0x13')]['message']);}})[_0x9be1('0x14')](function(_0x2de7ff){logger[_0x9be1('0x10')](_0x9be1('0x12'),_0x2f1961,_0x2de7ff);_0xabd2b4(_0x2de7ff);});});}exports[_0x9be1('0x15')]=function(_0x50195e){var _0x16d5fb=this;return new Promise(function(_0x539753,_0x260fe2){return db[_0x9be1('0x16')][_0x9be1('0x17')](_0x50195e[_0x9be1('0x18')],{'raw':_0x50195e[_0x9be1('0x19')]?_0x50195e['options'][_0x9be1('0x1a')]===undefined?!![]:![]:!![]})[_0x9be1('0x1b')](function(_0x277346){logger[_0x9be1('0xc')]('CreateFaxQueueReport',_0x50195e);logger[_0x9be1('0x1c')]('CreateFaxQueueReport',_0x50195e,JSON[_0x9be1('0xf')](_0x277346));_0x539753(_0x277346);})['catch'](function(_0x215d04){logger[_0x9be1('0x10')](_0x9be1('0x15'),_0x215d04[_0x9be1('0x11')],_0x50195e);_0x260fe2(_0x16d5fb['error'](0x1f4,_0x215d04[_0x9be1('0x11')]));});});};exports['UpdateFaxQueueReport']=function(_0x5b23ae){var _0xf90b3c=this;return new Promise(function(_0x2027d2,_0x358a5a){return db[_0x9be1('0x16')][_0x9be1('0x1d')](_0x5b23ae[_0x9be1('0x18')],{'raw':_0x5b23ae[_0x9be1('0x19')]?_0x5b23ae[_0x9be1('0x19')][_0x9be1('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b23ae['options']?_0x5b23ae[_0x9be1('0x19')][_0x9be1('0x1e')]||null:null,'attributes':_0x5b23ae[_0x9be1('0x19')]?_0x5b23ae[_0x9be1('0x19')][_0x9be1('0x1f')]||null:null,'limit':_0x5b23ae['options']?_0x5b23ae[_0x9be1('0x19')][_0x9be1('0x20')]||null:null})['then'](function(_0x267c76){logger[_0x9be1('0xc')](_0x9be1('0x21'),_0x5b23ae);logger[_0x9be1('0x1c')]('UpdateFaxQueueReport',_0x5b23ae,JSON[_0x9be1('0xf')](_0x267c76));_0x2027d2(_0x267c76);})[_0x9be1('0x14')](function(_0x51584c){logger[_0x9be1('0x10')](_0x9be1('0x21'),_0x51584c[_0x9be1('0x11')],_0x5b23ae);_0x358a5a(_0xf90b3c[_0x9be1('0x10')](0x1f4,_0x51584c[_0x9be1('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 25da766..5c4c922 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 _0x3c2a=['./faxQueueReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','fs-extra'];(function(_0xded36,_0x1462cb){var _0x39e06c=function(_0x3068dc){while(--_0x3068dc){_0xded36['push'](_0xded36['shift']());}};_0x39e06c(++_0x1462cb);}(_0x3c2a,0x176));var _0xa3c2=function(_0x4c8641,_0x350c5a){_0x4c8641=_0x4c8641-0x0;var _0x2c99a5=_0x3c2a[_0x4c8641];return _0x2c99a5;};'use strict';var multer=require('multer');var util=require(_0xa3c2('0x0'));var path=require(_0xa3c2('0x1'));var timeout=require(_0xa3c2('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa3c2('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa3c2('0x4'));router[_0xa3c2('0x5')]('/',auth['isAuthenticated'](),controller[_0xa3c2('0x6')]);router[_0xa3c2('0x5')](_0xa3c2('0x7'),auth['isAuthenticated'](),controller[_0xa3c2('0x8')]);router[_0xa3c2('0x5')](_0xa3c2('0x9'),auth[_0xa3c2('0xa')](),controller[_0xa3c2('0xb')]);router['post']('/',auth[_0xa3c2('0xa')](),controller[_0xa3c2('0xc')]);router[_0xa3c2('0xd')](_0xa3c2('0x9'),auth[_0xa3c2('0xa')](),controller[_0xa3c2('0xe')]);router[_0xa3c2('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa3c2('0x10')]);module[_0xa3c2('0x11')]=router; \ No newline at end of file +var _0x5f9b=['isAuthenticated','index','/describe','describe','/:id','post','put','update','delete','multer','path','fs-extra','../../components/interaction/service','./faxQueueReport.controller','get'];(function(_0x2d8efc,_0x58e635){var _0x4a7f2d=function(_0x5404e7){while(--_0x5404e7){_0x2d8efc['push'](_0x2d8efc['shift']());}};_0x4a7f2d(++_0x58e635);}(_0x5f9b,0x117));var _0xb5f9=function(_0xac0d3,_0x3d1441){_0xac0d3=_0xac0d3-0x0;var _0x277107=_0x5f9b[_0xac0d3];return _0x277107;};'use strict';var multer=require(_0xb5f9('0x0'));var util=require('util');var path=require(_0xb5f9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xb5f9('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xb5f9('0x3'));var config=require('../../config/environment');var controller=require(_0xb5f9('0x4'));router[_0xb5f9('0x5')]('/',auth[_0xb5f9('0x6')](),controller[_0xb5f9('0x7')]);router['get'](_0xb5f9('0x8'),auth[_0xb5f9('0x6')](),controller[_0xb5f9('0x9')]);router[_0xb5f9('0x5')](_0xb5f9('0xa'),auth[_0xb5f9('0x6')](),controller['show']);router[_0xb5f9('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb5f9('0xc')](_0xb5f9('0xa'),auth[_0xb5f9('0x6')](),controller[_0xb5f9('0xd')]);router[_0xb5f9('0xe')]('/:id',auth[_0xb5f9('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 049d891..d003a69 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x3840dd,_0x5e281c){var _0x1ebf26=function(_0x4d54c8){while(--_0x4d54c8){_0x3840dd['push'](_0x3840dd['shift']());}};_0x1ebf26(++_0x5e281c);}(_0x00bb,0x1d8));var _0xb00b=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x00bb[_0x433a86];return _0x23000c;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x3a90b6,_0x258d6b){var _0x1da466=function(_0x3c0f35){while(--_0x3c0f35){_0x3a90b6['push'](_0x3a90b6['shift']());}};_0x1da466(++_0x258d6b);}(_0xaa88,0x137));var _0x8aa8=function(_0x11ba83,_0xd5611a){_0x11ba83=_0x11ba83-0x0;var _0x3f3925=_0xaa88[_0x11ba83];return _0x3f3925;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index d033c14..a98a6cf 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 _0xbe87=['apply','reject','save','then','destroy','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','include','create','body','update','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range'];(function(_0x1865d4,_0x569a81){var _0x1f0e1c=function(_0x57887d){while(--_0x57887d){_0x1865d4['push'](_0x1865d4['shift']());}};_0x1f0e1c(++_0x569a81);}(_0xbe87,0x7a));var _0x7be8=function(_0x163400,_0xe2c9d0){_0x163400=_0x163400-0x0;var _0x58c424=_0xbe87[_0x163400];return _0x58c424;};'use strict';var emlformat=require(_0x7be8('0x0'));var rimraf=require(_0x7be8('0x1'));var zipdir=require(_0x7be8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7be8('0x3'));var moment=require(_0x7be8('0x4'));var BPromise=require(_0x7be8('0x5'));var Mustache=require('mustache');var util=require(_0x7be8('0x6'));var path=require('path');var sox=require(_0x7be8('0x7'));var csv=require(_0x7be8('0x8'));var ejs=require(_0x7be8('0x9'));var fs=require('fs');var fs_extra=require(_0x7be8('0xa'));var _=require(_0x7be8('0xb'));var squel=require('squel');var crypto=require(_0x7be8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7be8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7be8('0xe'));var Papa=require(_0x7be8('0xf'));var Redis=require(_0x7be8('0x10'));var authService=require(_0x7be8('0x11'));var qs=require(_0x7be8('0x12'));var as=require(_0x7be8('0x13'));var hardwareService=require(_0x7be8('0x14'));var logger=require(_0x7be8('0x15'))(_0x7be8('0x16'));var utils=require(_0x7be8('0x17'));var config=require(_0x7be8('0x18'));var licenseUtil=require(_0x7be8('0x19'));var db=require(_0x7be8('0x1a'))['db'];function respondWithStatusCode(_0x2f8abf,_0xfcc8e1){_0xfcc8e1=_0xfcc8e1||0xcc;return function(_0xda7316){if(_0xda7316){return _0x2f8abf[_0x7be8('0x1b')](_0xfcc8e1);}return _0x2f8abf[_0x7be8('0x1c')](_0xfcc8e1)[_0x7be8('0x1d')]();};}function respondWithResult(_0x2841bb,_0x10e6e5){_0x10e6e5=_0x10e6e5||0xc8;return function(_0x4d4d49){if(_0x4d4d49){return _0x2841bb[_0x7be8('0x1c')](_0x10e6e5)[_0x7be8('0x1e')](_0x4d4d49);}};}function respondWithFilteredResult(_0x4dc391,_0x30c332){return function(_0x41d833){if(_0x41d833){var _0x4ffe4b=typeof _0x30c332['offset']==='undefined'&&typeof _0x30c332['limit']===_0x7be8('0x1f');var _0x35e201=_0x41d833[_0x7be8('0x20')];var _0x1f2581=_0x4ffe4b?0x0:_0x30c332[_0x7be8('0x21')];var _0x3fdc90=_0x4ffe4b?_0x41d833[_0x7be8('0x20')]:_0x30c332[_0x7be8('0x21')]+_0x30c332[_0x7be8('0x22')];var _0x48a6d7;if(_0x3fdc90>=_0x35e201){_0x3fdc90=_0x35e201;_0x48a6d7=0xc8;}else{_0x48a6d7=0xce;}_0x4dc391[_0x7be8('0x1c')](_0x48a6d7);return _0x4dc391['set'](_0x7be8('0x23'),_0x1f2581+'-'+_0x3fdc90+'/'+_0x35e201)[_0x7be8('0x1e')](_0x41d833);}return null;};}function patchUpdates(_0x53c00f){return function(_0x3650d2){try{jsonpatch[_0x7be8('0x24')](_0x3650d2,_0x53c00f,!![]);}catch(_0x66fb68){return BPromise[_0x7be8('0x25')](_0x66fb68);}return _0x3650d2[_0x7be8('0x26')]();};}function saveUpdates(_0x31894c,_0x5851b4){return function(_0x43b394){if(_0x43b394){return _0x43b394['update'](_0x31894c)[_0x7be8('0x27')](function(_0x37e475){return _0x37e475;});}return null;};}function removeEntity(_0x4ddf66,_0x4eb454){return function(_0x50643e){if(_0x50643e){return _0x50643e[_0x7be8('0x28')]()['then'](function(){_0x4ddf66[_0x7be8('0x1c')](0xcc)[_0x7be8('0x1d')]();});}};}function handleEntityNotFound(_0x218837,_0x1c29af){return function(_0x57a476){if(!_0x57a476){_0x218837['sendStatus'](0x194);}return _0x57a476;};}function handleError(_0x2ad699,_0x172e42){_0x172e42=_0x172e42||0x1f4;return function(_0x2549da){logger[_0x7be8('0x29')](_0x2549da[_0x7be8('0x2a')]);if(_0x2549da['name']){delete _0x2549da[_0x7be8('0x2b')];}_0x2ad699[_0x7be8('0x1c')](_0x172e42)[_0x7be8('0x2c')](_0x2549da);};}exports[_0x7be8('0x2d')]=function(_0x1f8664,_0x49f9fb){var _0x5de46f={},_0x519ff3={},_0x2710bc={'count':0x0,'rows':[]};var _0x106605=_[_0x7be8('0x2e')](db[_0x7be8('0x2f')][_0x7be8('0x30')],function(_0x36a1bc){return{'name':_0x36a1bc[_0x7be8('0x31')],'type':_0x36a1bc[_0x7be8('0x32')][_0x7be8('0x33')]};});_0x519ff3[_0x7be8('0x34')]=_[_0x7be8('0x2e')](_0x106605,_0x7be8('0x2b'));_0x519ff3[_0x7be8('0x35')]=_['keys'](_0x1f8664[_0x7be8('0x35')]);_0x519ff3[_0x7be8('0x36')]=_[_0x7be8('0x37')](_0x519ff3['model'],_0x519ff3[_0x7be8('0x35')]);_0x5de46f[_0x7be8('0x38')]=_[_0x7be8('0x37')](_0x519ff3[_0x7be8('0x34')],qs[_0x7be8('0x39')](_0x1f8664['query'][_0x7be8('0x39')]));_0x5de46f['attributes']=_0x5de46f['attributes'][_0x7be8('0x3a')]?_0x5de46f['attributes']:_0x519ff3['model'];if(!_0x1f8664['query'][_0x7be8('0x3b')](_0x7be8('0x3c'))){_0x5de46f[_0x7be8('0x22')]=qs[_0x7be8('0x22')](_0x1f8664[_0x7be8('0x35')]['limit']);_0x5de46f[_0x7be8('0x21')]=qs[_0x7be8('0x21')](_0x1f8664['query'][_0x7be8('0x21')]);}_0x5de46f[_0x7be8('0x3d')]=qs[_0x7be8('0x3e')](_0x1f8664[_0x7be8('0x35')][_0x7be8('0x3e')]);_0x5de46f['where']=qs[_0x7be8('0x36')](_['pick'](_0x1f8664['query'],_0x519ff3[_0x7be8('0x36')]),_0x106605);if(_0x1f8664[_0x7be8('0x35')][_0x7be8('0x3f')]){_0x5de46f[_0x7be8('0x40')]=_[_0x7be8('0x41')](_0x5de46f['where'],{'$or':_[_0x7be8('0x2e')](_0x106605,function(_0x2b3a91){if(_0x2b3a91[_0x7be8('0x32')]!==_0x7be8('0x42')){var _0x10617c={};_0x10617c[_0x2b3a91[_0x7be8('0x2b')]]={'$like':'%'+_0x1f8664[_0x7be8('0x35')]['filter']+'%'};return _0x10617c;}})});}_0x5de46f=_[_0x7be8('0x41')]({},_0x5de46f,_0x1f8664['options']);var _0x24da58={'where':_0x5de46f['where']};return db[_0x7be8('0x2f')][_0x7be8('0x20')](_0x24da58)['then'](function(_0x2bf450){_0x2710bc[_0x7be8('0x20')]=_0x2bf450;if(_0x1f8664['query'][_0x7be8('0x43')]){_0x5de46f['include']=[{'all':!![]}];}return db[_0x7be8('0x2f')]['findAll'](_0x5de46f);})[_0x7be8('0x27')](function(_0x564e65){_0x2710bc[_0x7be8('0x44')]=_0x564e65;return _0x2710bc;})['then'](respondWithFilteredResult(_0x49f9fb,_0x5de46f))[_0x7be8('0x45')](handleError(_0x49f9fb,null));};exports[_0x7be8('0x46')]=function(_0x27e6fc,_0x383052){var _0x17bcdd={'raw':!![],'where':{'id':_0x27e6fc[_0x7be8('0x47')]['id']}},_0x51d6e4={};_0x51d6e4[_0x7be8('0x34')]=_['keys'](db[_0x7be8('0x2f')][_0x7be8('0x30')]);_0x51d6e4[_0x7be8('0x35')]=_[_0x7be8('0x48')](_0x27e6fc[_0x7be8('0x35')]);_0x51d6e4[_0x7be8('0x36')]=_['intersection'](_0x51d6e4[_0x7be8('0x34')],_0x51d6e4[_0x7be8('0x35')]);_0x17bcdd[_0x7be8('0x38')]=_[_0x7be8('0x37')](_0x51d6e4[_0x7be8('0x34')],qs[_0x7be8('0x39')](_0x27e6fc[_0x7be8('0x35')][_0x7be8('0x39')]));_0x17bcdd[_0x7be8('0x38')]=_0x17bcdd[_0x7be8('0x38')][_0x7be8('0x3a')]?_0x17bcdd[_0x7be8('0x38')]:_0x51d6e4[_0x7be8('0x34')];if(_0x27e6fc[_0x7be8('0x35')][_0x7be8('0x43')]){_0x17bcdd[_0x7be8('0x49')]=[{'all':!![]}];}_0x17bcdd=_[_0x7be8('0x41')]({},_0x17bcdd,_0x27e6fc['options']);return db[_0x7be8('0x2f')]['find'](_0x17bcdd)['then'](handleEntityNotFound(_0x383052,null))[_0x7be8('0x27')](respondWithResult(_0x383052,null))[_0x7be8('0x45')](handleError(_0x383052,null));};exports[_0x7be8('0x4a')]=function(_0x1489a8,_0xaedd98){return db[_0x7be8('0x2f')]['create'](_0x1489a8[_0x7be8('0x4b')],{})[_0x7be8('0x27')](respondWithResult(_0xaedd98,0xc9))[_0x7be8('0x45')](handleError(_0xaedd98,null));};exports[_0x7be8('0x4c')]=function(_0x1a720f,_0x207899){if(_0x1a720f[_0x7be8('0x4b')]['id']){delete _0x1a720f[_0x7be8('0x4b')]['id'];}return db[_0x7be8('0x2f')][_0x7be8('0x4d')]({'where':{'id':_0x1a720f[_0x7be8('0x47')]['id']}})[_0x7be8('0x27')](handleEntityNotFound(_0x207899,null))[_0x7be8('0x27')](saveUpdates(_0x1a720f[_0x7be8('0x4b')],null))[_0x7be8('0x27')](respondWithResult(_0x207899,null))[_0x7be8('0x45')](handleError(_0x207899,null));};exports[_0x7be8('0x28')]=function(_0xe04f17,_0x2bc543){return db[_0x7be8('0x2f')]['find']({'where':{'id':_0xe04f17[_0x7be8('0x47')]['id']}})[_0x7be8('0x27')](handleEntityNotFound(_0x2bc543,null))[_0x7be8('0x27')](removeEntity(_0x2bc543,null))[_0x7be8('0x45')](handleError(_0x2bc543,null));};exports['describe']=function(_0x47bd7f,_0x294ceb){return db[_0x7be8('0x2f')][_0x7be8('0x4e')]()['then'](respondWithResult(_0x294ceb,null))[_0x7be8('0x45')](handleError(_0x294ceb,null));}; \ No newline at end of file +var _0x98e6=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','options','find','create','body','destroy','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','name','send','FaxTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys'];(function(_0xef9861,_0x58aad7){var _0x4b2fe7=function(_0x16ab6c){while(--_0x16ab6c){_0xef9861['push'](_0xef9861['shift']());}};_0x4b2fe7(++_0x58aad7);}(_0x98e6,0x67));var _0x698e=function(_0x3a09e5,_0x22b07d){_0x3a09e5=_0x3a09e5-0x0;var _0x47f87d=_0x98e6[_0x3a09e5];return _0x47f87d;};'use strict';var emlformat=require(_0x698e('0x0'));var rimraf=require(_0x698e('0x1'));var zipdir=require(_0x698e('0x2'));var jsonpatch=require(_0x698e('0x3'));var rp=require(_0x698e('0x4'));var moment=require(_0x698e('0x5'));var BPromise=require(_0x698e('0x6'));var Mustache=require(_0x698e('0x7'));var util=require(_0x698e('0x8'));var path=require(_0x698e('0x9'));var sox=require(_0x698e('0xa'));var csv=require(_0x698e('0xb'));var ejs=require(_0x698e('0xc'));var fs=require('fs');var fs_extra=require(_0x698e('0xd'));var _=require('lodash');var squel=require(_0x698e('0xe'));var crypto=require(_0x698e('0xf'));var jsforce=require(_0x698e('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x698e('0xb'));var querystring=require(_0x698e('0x11'));var Papa=require(_0x698e('0x12'));var Redis=require(_0x698e('0x13'));var authService=require(_0x698e('0x14'));var qs=require(_0x698e('0x15'));var as=require(_0x698e('0x16'));var hardwareService=require(_0x698e('0x17'));var logger=require('../../config/logger')(_0x698e('0x18'));var utils=require(_0x698e('0x19'));var config=require(_0x698e('0x1a'));var licenseUtil=require(_0x698e('0x1b'));var db=require(_0x698e('0x1c'))['db'];function respondWithStatusCode(_0xa672f8,_0x30a1e0){_0x30a1e0=_0x30a1e0||0xcc;return function(_0x421142){if(_0x421142){return _0xa672f8[_0x698e('0x1d')](_0x30a1e0);}return _0xa672f8[_0x698e('0x1e')](_0x30a1e0)['end']();};}function respondWithResult(_0x410c10,_0x4376b0){_0x4376b0=_0x4376b0||0xc8;return function(_0x260147){if(_0x260147){return _0x410c10[_0x698e('0x1e')](_0x4376b0)[_0x698e('0x1f')](_0x260147);}};}function respondWithFilteredResult(_0x5a4ae4,_0x4ef975){return function(_0xf8409b){if(_0xf8409b){var _0x5f0a23=typeof _0x4ef975[_0x698e('0x20')]==='undefined'&&typeof _0x4ef975[_0x698e('0x21')]==='undefined';var _0x1dfe1f=_0xf8409b[_0x698e('0x22')];var _0x1a4d18=_0x5f0a23?0x0:_0x4ef975[_0x698e('0x20')];var _0xff7d22=_0x5f0a23?_0xf8409b[_0x698e('0x22')]:_0x4ef975[_0x698e('0x20')]+_0x4ef975['limit'];var _0x568a15;if(_0xff7d22>=_0x1dfe1f){_0xff7d22=_0x1dfe1f;_0x568a15=0xc8;}else{_0x568a15=0xce;}_0x5a4ae4[_0x698e('0x1e')](_0x568a15);return _0x5a4ae4[_0x698e('0x23')](_0x698e('0x24'),_0x1a4d18+'-'+_0xff7d22+'/'+_0x1dfe1f)['json'](_0xf8409b);}return null;};}function patchUpdates(_0x3d0418){return function(_0x1d0a52){try{jsonpatch[_0x698e('0x25')](_0x1d0a52,_0x3d0418,!![]);}catch(_0x3ec77e){return BPromise[_0x698e('0x26')](_0x3ec77e);}return _0x1d0a52[_0x698e('0x27')]();};}function saveUpdates(_0x1dcc88,_0x504cf6){return function(_0x34d30d){if(_0x34d30d){return _0x34d30d[_0x698e('0x28')](_0x1dcc88)[_0x698e('0x29')](function(_0x133349){return _0x133349;});}return null;};}function removeEntity(_0x4822a3,_0x46acfa){return function(_0x2a399a){if(_0x2a399a){return _0x2a399a['destroy']()['then'](function(){_0x4822a3[_0x698e('0x1e')](0xcc)[_0x698e('0x2a')]();});}};}function handleEntityNotFound(_0x5478b0,_0x5dacd9){return function(_0x5d3141){if(!_0x5d3141){_0x5478b0[_0x698e('0x1d')](0x194);}return _0x5d3141;};}function handleError(_0x434f87,_0xfe27b3){_0xfe27b3=_0xfe27b3||0x1f4;return function(_0x3021fd){logger[_0x698e('0x2b')](_0x3021fd['stack']);if(_0x3021fd[_0x698e('0x2c')]){delete _0x3021fd[_0x698e('0x2c')];}_0x434f87[_0x698e('0x1e')](_0xfe27b3)[_0x698e('0x2d')](_0x3021fd);};}exports['index']=function(_0xfb6de,_0x3fb47a){var _0x34411d={},_0x5eab3d={},_0x3d6564={'count':0x0,'rows':[]};var _0x52dcdc=_['map'](db[_0x698e('0x2e')][_0x698e('0x2f')],function(_0x2f27c0){return{'name':_0x2f27c0[_0x698e('0x30')],'type':_0x2f27c0[_0x698e('0x31')][_0x698e('0x32')]};});_0x5eab3d[_0x698e('0x33')]=_[_0x698e('0x34')](_0x52dcdc,_0x698e('0x2c'));_0x5eab3d[_0x698e('0x35')]=_[_0x698e('0x36')](_0xfb6de['query']);_0x5eab3d[_0x698e('0x37')]=_[_0x698e('0x38')](_0x5eab3d[_0x698e('0x33')],_0x5eab3d['query']);_0x34411d[_0x698e('0x39')]=_[_0x698e('0x38')](_0x5eab3d['model'],qs[_0x698e('0x3a')](_0xfb6de[_0x698e('0x35')][_0x698e('0x3a')]));_0x34411d[_0x698e('0x39')]=_0x34411d[_0x698e('0x39')][_0x698e('0x3b')]?_0x34411d['attributes']:_0x5eab3d[_0x698e('0x33')];if(!_0xfb6de[_0x698e('0x35')][_0x698e('0x3c')]('nolimit')){_0x34411d[_0x698e('0x21')]=qs[_0x698e('0x21')](_0xfb6de[_0x698e('0x35')][_0x698e('0x21')]);_0x34411d[_0x698e('0x20')]=qs[_0x698e('0x20')](_0xfb6de[_0x698e('0x35')][_0x698e('0x20')]);}_0x34411d[_0x698e('0x3d')]=qs['sort'](_0xfb6de[_0x698e('0x35')][_0x698e('0x3e')]);_0x34411d[_0x698e('0x3f')]=qs['filters'](_[_0x698e('0x40')](_0xfb6de[_0x698e('0x35')],_0x5eab3d[_0x698e('0x37')]),_0x52dcdc);if(_0xfb6de['query'][_0x698e('0x41')]){_0x34411d[_0x698e('0x3f')]=_[_0x698e('0x42')](_0x34411d[_0x698e('0x3f')],{'$or':_[_0x698e('0x34')](_0x52dcdc,function(_0x910d73){if(_0x910d73[_0x698e('0x31')]!==_0x698e('0x43')){var _0x385554={};_0x385554[_0x910d73['name']]={'$like':'%'+_0xfb6de[_0x698e('0x35')][_0x698e('0x41')]+'%'};return _0x385554;}})});}_0x34411d=_[_0x698e('0x42')]({},_0x34411d,_0xfb6de['options']);var _0x10912e={'where':_0x34411d[_0x698e('0x3f')]};return db[_0x698e('0x2e')][_0x698e('0x22')](_0x10912e)[_0x698e('0x29')](function(_0x487672){_0x3d6564['count']=_0x487672;if(_0xfb6de[_0x698e('0x35')][_0x698e('0x44')]){_0x34411d[_0x698e('0x45')]=[{'all':!![]}];}return db['FaxTransferReport']['findAll'](_0x34411d);})[_0x698e('0x29')](function(_0x5b6bb5){_0x3d6564[_0x698e('0x46')]=_0x5b6bb5;return _0x3d6564;})[_0x698e('0x29')](respondWithFilteredResult(_0x3fb47a,_0x34411d))[_0x698e('0x47')](handleError(_0x3fb47a,null));};exports['show']=function(_0x3e8bf8,_0x47da63){var _0x34783c={'raw':!![],'where':{'id':_0x3e8bf8['params']['id']}},_0x3e68dd={};_0x3e68dd[_0x698e('0x33')]=_[_0x698e('0x36')](db[_0x698e('0x2e')][_0x698e('0x2f')]);_0x3e68dd['query']=_['keys'](_0x3e8bf8[_0x698e('0x35')]);_0x3e68dd['filters']=_[_0x698e('0x38')](_0x3e68dd['model'],_0x3e68dd['query']);_0x34783c[_0x698e('0x39')]=_[_0x698e('0x38')](_0x3e68dd[_0x698e('0x33')],qs[_0x698e('0x3a')](_0x3e8bf8['query'][_0x698e('0x3a')]));_0x34783c[_0x698e('0x39')]=_0x34783c['attributes'][_0x698e('0x3b')]?_0x34783c['attributes']:_0x3e68dd[_0x698e('0x33')];if(_0x3e8bf8[_0x698e('0x35')]['includeAll']){_0x34783c[_0x698e('0x45')]=[{'all':!![]}];}_0x34783c=_[_0x698e('0x42')]({},_0x34783c,_0x3e8bf8[_0x698e('0x48')]);return db[_0x698e('0x2e')][_0x698e('0x49')](_0x34783c)['then'](handleEntityNotFound(_0x47da63,null))[_0x698e('0x29')](respondWithResult(_0x47da63,null))[_0x698e('0x47')](handleError(_0x47da63,null));};exports[_0x698e('0x4a')]=function(_0x46f718,_0x2f5f2a){return db[_0x698e('0x2e')][_0x698e('0x4a')](_0x46f718['body'],{})[_0x698e('0x29')](respondWithResult(_0x2f5f2a,0xc9))[_0x698e('0x47')](handleError(_0x2f5f2a,null));};exports[_0x698e('0x28')]=function(_0x1259ad,_0x1e1fbe){if(_0x1259ad[_0x698e('0x4b')]['id']){delete _0x1259ad['body']['id'];}return db[_0x698e('0x2e')]['find']({'where':{'id':_0x1259ad['params']['id']}})[_0x698e('0x29')](handleEntityNotFound(_0x1e1fbe,null))['then'](saveUpdates(_0x1259ad[_0x698e('0x4b')],null))[_0x698e('0x29')](respondWithResult(_0x1e1fbe,null))[_0x698e('0x47')](handleError(_0x1e1fbe,null));};exports[_0x698e('0x4c')]=function(_0x4ae5f2,_0x5dbb77){return db['FaxTransferReport']['find']({'where':{'id':_0x4ae5f2[_0x698e('0x4d')]['id']}})[_0x698e('0x29')](handleEntityNotFound(_0x5dbb77,null))[_0x698e('0x29')](removeEntity(_0x5dbb77,null))[_0x698e('0x47')](handleError(_0x5dbb77,null));};exports[_0x698e('0x4e')]=function(_0x12cc56,_0x26987d){return db[_0x698e('0x2e')][_0x698e('0x4e')]()[_0x698e('0x29')](respondWithResult(_0x26987d,null))[_0x698e('0x47')](handleError(_0x26987d,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 0fe25bb..dd1953c 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 _0x16a2=['moment','request-promise','path','rimraf','exports','define','report_fax_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x16a2,0x105));var _0x216a=function(_0x4d674b,_0x176474){_0x4d674b=_0x4d674b-0x0;var _0x535a1f=_0x16a2[_0x4d674b];return _0x535a1f;};'use strict';var _=require(_0x216a('0x0'));var util=require(_0x216a('0x1'));var logger=require(_0x216a('0x2'))('api');var moment=require(_0x216a('0x3'));var BPromise=require('bluebird');var rp=require(_0x216a('0x4'));var fs=require('fs');var path=require(_0x216a('0x5'));var rimraf=require(_0x216a('0x6'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module[_0x216a('0x7')]=function(_0x5c2115,_0x5b5043){return _0x5c2115[_0x216a('0x8')]('FaxTransferReport',attributes,{'tableName':_0x216a('0x9'),'paranoid':![],'indexes':[{'name':_0x216a('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfa6d=['request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','bluebird'];(function(_0x50cfc3,_0x526cc6){var _0x5c11ef=function(_0xeaf96a){while(--_0xeaf96a){_0x50cfc3['push'](_0x50cfc3['shift']());}};_0x5c11ef(++_0x526cc6);}(_0xfa6d,0x105));var _0xdfa6=function(_0x1ce8d3,_0x50e99a){_0x1ce8d3=_0x1ce8d3-0x0;var _0x38ead4=_0xfa6d[_0x1ce8d3];return _0x38ead4;};'use strict';var _=require(_0xdfa6('0x0'));var util=require(_0xdfa6('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xdfa6('0x2'));var rp=require(_0xdfa6('0x3'));var fs=require('fs');var path=require(_0xdfa6('0x4'));var rimraf=require(_0xdfa6('0x5'));var config=require(_0xdfa6('0x6'));var attributes=require(_0xdfa6('0x7'));module['exports']=function(_0x4a766d,_0x25e7db){return _0x4a766d[_0xdfa6('0x8')](_0xdfa6('0x9'),attributes,{'tableName':_0xdfa6('0xa'),'paranoid':![],'indexes':[{'name':_0xdfa6('0xb'),'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 e8aa3f7..411ee91 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 _0x5c3a=['FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request','then','info','request\x20sent','debug'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x5c3a,0x1c0));var _0xa5c3=function(_0x4077de,_0x51eeb4){_0x4077de=_0x4077de-0x0;var _0x37e6d5=_0x5c3a[_0x4077de];return _0x37e6d5;};'use strict';var _=require(_0xa5c3('0x0'));var util=require(_0xa5c3('0x1'));var moment=require('moment');var BPromise=require(_0xa5c3('0x2'));var rs=require(_0xa5c3('0x3'));var fs=require('fs');var Redis=require(_0xa5c3('0x4'));var db=require(_0xa5c3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa5c3('0x6'))('rpc');var config=require(_0xa5c3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa5c3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21b612,_0x934a97,_0x2b0cde){return new BPromise(function(_0x1ff4b8,_0x187652){return client[_0xa5c3('0x9')](_0x21b612,_0x2b0cde)[_0xa5c3('0xa')](function(_0x47b43c){logger[_0xa5c3('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x934a97,_0xa5c3('0xc'));logger[_0xa5c3('0xd')](_0xa5c3('0xe'),_0x934a97,_0xa5c3('0xc'),JSON[_0xa5c3('0xf')](_0x47b43c));if(_0x47b43c['error']){if(_0x47b43c[_0xa5c3('0x10')]['code']===0x1f4){logger[_0xa5c3('0x10')](_0xa5c3('0x11'),_0x934a97,_0x47b43c[_0xa5c3('0x10')][_0xa5c3('0x12')]);return _0x187652(_0x47b43c['error'][_0xa5c3('0x12')]);}logger[_0xa5c3('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x934a97,_0x47b43c['error']['message']);return _0x1ff4b8(_0x47b43c[_0xa5c3('0x10')][_0xa5c3('0x12')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x934a97,_0xa5c3('0xc'));_0x1ff4b8(_0x47b43c[_0xa5c3('0x13')][_0xa5c3('0x12')]);}})[_0xa5c3('0x14')](function(_0x53d662){logger[_0xa5c3('0x10')](_0xa5c3('0x11'),_0x934a97,_0x53d662);_0x187652(_0x53d662);});});} \ No newline at end of file +var _0xb0a0=['jayson/promise','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x34910f,_0x18fa83){var _0x32a601=function(_0x4d6a67){while(--_0x4d6a67){_0x34910f['push'](_0x34910f['shift']());}};_0x32a601(++_0x18fa83);}(_0xb0a0,0x1b2));var _0x0b0a=function(_0x29e871,_0x330b98){_0x29e871=_0x29e871-0x0;var _0x3380e3=_0xb0a0[_0x29e871];return _0x3380e3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0b0a('0x0'));var BPromise=require(_0x0b0a('0x1'));var rs=require(_0x0b0a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b0a('0x3'))['db'];var utils=require(_0x0b0a('0x4'));var logger=require('../../config/logger')(_0x0b0a('0x5'));var config=require(_0x0b0a('0x6'));var jayson=require(_0x0b0a('0x7'));var client=jayson[_0x0b0a('0x8')][_0x0b0a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28e2cb,_0x507aba,_0x25553b){return new BPromise(function(_0x416f6b,_0x98d810){return client[_0x0b0a('0xa')](_0x28e2cb,_0x25553b)[_0x0b0a('0xb')](function(_0x3af69f){logger['info'](_0x0b0a('0xc'),_0x507aba,_0x0b0a('0xd'));logger[_0x0b0a('0xe')](_0x0b0a('0xf'),_0x507aba,'request\x20sent',JSON[_0x0b0a('0x10')](_0x3af69f));if(_0x3af69f['error']){if(_0x3af69f[_0x0b0a('0x11')]['code']===0x1f4){logger[_0x0b0a('0x11')](_0x0b0a('0xc'),_0x507aba,_0x3af69f[_0x0b0a('0x11')][_0x0b0a('0x12')]);return _0x98d810(_0x3af69f[_0x0b0a('0x11')]['message']);}logger['error'](_0x0b0a('0xc'),_0x507aba,_0x3af69f['error'][_0x0b0a('0x12')]);return _0x416f6b(_0x3af69f[_0x0b0a('0x11')][_0x0b0a('0x12')]);}else{logger[_0x0b0a('0x13')](_0x0b0a('0xc'),_0x507aba,_0x0b0a('0xd'));_0x416f6b(_0x3af69f[_0x0b0a('0x14')][_0x0b0a('0x12')]);}})['catch'](function(_0x5c9fd9){logger[_0x0b0a('0x11')](_0x0b0a('0xc'),_0x507aba,_0x5c9fd9);_0x98d810(_0x5c9fd9);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index e2bac1b..69e0dff 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 _0x2173=['delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x231b67,_0x46f88f){var _0x455903=function(_0x4d1eb1){while(--_0x4d1eb1){_0x231b67['push'](_0x231b67['shift']());}};_0x455903(++_0x46f88f);}(_0x2173,0x8a));var _0x3217=function(_0x5906ba,_0xc0e1e6){_0x5906ba=_0x5906ba-0x0;var _0x11e417=_0x2173[_0x5906ba];return _0x11e417;};'use strict';var multer=require(_0x3217('0x0'));var util=require(_0x3217('0x1'));var path=require('path');var timeout=require(_0x3217('0x2'));var express=require('express');var router=express[_0x3217('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3217('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3217('0x5'));var controller=require(_0x3217('0x6'));router[_0x3217('0x7')]('/',auth[_0x3217('0x8')](),controller['index']);router[_0x3217('0x7')](_0x3217('0x9'),auth[_0x3217('0x8')](),controller[_0x3217('0xa')]);router[_0x3217('0x7')](_0x3217('0xb'),auth[_0x3217('0x8')](),controller[_0x3217('0xc')]);router[_0x3217('0xd')]('/',auth[_0x3217('0x8')](),controller[_0x3217('0xe')]);router['put'](_0x3217('0xb'),auth[_0x3217('0x8')](),controller['update']);router[_0x3217('0xf')]('/:id',auth[_0x3217('0x8')](),controller[_0x3217('0x10')]);module['exports']=router; \ No newline at end of file +var _0x7951=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','/:id','isAuthenticated','show','post','put','update','delete','destroy','util','path'];(function(_0x130782,_0x27eb50){var _0x1b9234=function(_0x4eadb0){while(--_0x4eadb0){_0x130782['push'](_0x130782['shift']());}};_0x1b9234(++_0x27eb50);}(_0x7951,0x12a));var _0x1795=function(_0x1514b2,_0x180a60){_0x1514b2=_0x1514b2-0x0;var _0x3f9843=_0x7951[_0x1514b2];return _0x3f9843;};'use strict';var multer=require('multer');var util=require(_0x1795('0x0'));var path=require(_0x1795('0x1'));var timeout=require(_0x1795('0x2'));var express=require('express');var router=express[_0x1795('0x3')]();var fs_extra=require(_0x1795('0x4'));var auth=require(_0x1795('0x5'));var interaction=require(_0x1795('0x6'));var config=require(_0x1795('0x7'));var controller=require(_0x1795('0x8'));router[_0x1795('0x9')]('/',auth['isAuthenticated'](),controller[_0x1795('0xa')]);router[_0x1795('0x9')](_0x1795('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x1795('0x9')](_0x1795('0xc'),auth[_0x1795('0xd')](),controller[_0x1795('0xe')]);router[_0x1795('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1795('0x10')](_0x1795('0xc'),auth[_0x1795('0xd')](),controller[_0x1795('0x11')]);router[_0x1795('0x12')]('/:id',auth[_0x1795('0xd')](),controller[_0x1795('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index a39550c..3553a9c 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 _0xff14=['get','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xff14,0x115));var _0x4ff1=function(_0x12d744,_0x3c6bff){_0x12d744=_0x12d744-0x0;var _0x91c8a9=_0xff14[_0x12d744];return _0x91c8a9;};'use strict';var multer=require(_0x4ff1('0x0'));var util=require(_0x4ff1('0x1'));var path=require(_0x4ff1('0x2'));var timeout=require(_0x4ff1('0x3'));var express=require(_0x4ff1('0x4'));var router=express[_0x4ff1('0x5')]();var fs_extra=require(_0x4ff1('0x6'));var auth=require(_0x4ff1('0x7'));var interaction=require(_0x4ff1('0x8'));var config=require(_0x4ff1('0x9'));var controller=require(_0x4ff1('0xa'));router[_0x4ff1('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4ff1('0xb')](_0x4ff1('0xc'),auth[_0x4ff1('0xd')](),controller[_0x4ff1('0xe')]);router[_0x4ff1('0xb')](_0x4ff1('0xf'),auth[_0x4ff1('0xd')](),controller['getConfigurations']);router[_0x4ff1('0xb')](_0x4ff1('0x10'),auth[_0x4ff1('0xd')](),controller[_0x4ff1('0x11')]);router[_0x4ff1('0x12')]('/',auth[_0x4ff1('0xd')](),controller[_0x4ff1('0x13')]);router[_0x4ff1('0x12')](_0x4ff1('0xf'),auth[_0x4ff1('0xd')](),controller[_0x4ff1('0x14')]);router[_0x4ff1('0x15')](_0x4ff1('0xc'),auth[_0x4ff1('0xd')](),controller[_0x4ff1('0x16')]);router['delete'](_0x4ff1('0xc'),auth[_0x4ff1('0xd')](),controller['destroy']);module[_0x4ff1('0x17')]=router; \ No newline at end of file +var _0x8418=['isAuthenticated','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','index','/:id'];(function(_0x31a13b,_0x20d917){var _0x5b9c4e=function(_0x52b4ca){while(--_0x52b4ca){_0x31a13b['push'](_0x31a13b['shift']());}};_0x5b9c4e(++_0x20d917);}(_0x8418,0x18c));var _0x8841=function(_0x838813,_0x448f0f){_0x838813=_0x838813-0x0;var _0x2bd32d=_0x8418[_0x838813];return _0x2bd32d;};'use strict';var multer=require(_0x8841('0x0'));var util=require('util');var path=require(_0x8841('0x1'));var timeout=require('connect-timeout');var express=require(_0x8841('0x2'));var router=express[_0x8841('0x3')]();var fs_extra=require(_0x8841('0x4'));var auth=require(_0x8841('0x5'));var interaction=require(_0x8841('0x6'));var config=require(_0x8841('0x7'));var controller=require(_0x8841('0x8'));router[_0x8841('0x9')]('/',auth['isAuthenticated'](),controller[_0x8841('0xa')]);router[_0x8841('0x9')](_0x8841('0xb'),auth[_0x8841('0xc')](),controller['show']);router['get']('/:id/configurations',auth[_0x8841('0xc')](),controller['getConfigurations']);router['get'](_0x8841('0xd'),auth[_0x8841('0xc')](),controller[_0x8841('0xe')]);router[_0x8841('0xf')]('/',auth[_0x8841('0xc')](),controller[_0x8841('0x10')]);router[_0x8841('0xf')](_0x8841('0x11'),auth[_0x8841('0xc')](),controller[_0x8841('0x12')]);router[_0x8841('0x13')](_0x8841('0xb'),auth['isAuthenticated'](),controller[_0x8841('0x14')]);router[_0x8841('0x15')](_0x8841('0xb'),auth[_0x8841('0xc')](),controller[_0x8841('0x16')]);module[_0x8841('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 2bf94a7..b682282 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 _0x45a1=['basic','newTab','sequelize','exports','STRING','ENUM'];(function(_0x24bb2a,_0x3650a1){var _0x274817=function(_0x5be338){while(--_0x5be338){_0x24bb2a['push'](_0x24bb2a['shift']());}};_0x274817(++_0x3650a1);}(_0x45a1,0x68));var _0x145a=function(_0x375331,_0x9ccfd5){_0x375331=_0x375331-0x0;var _0x1c5873=_0x45a1[_0x375331];return _0x1c5873;};'use strict';var Sequelize=require(_0x145a('0x0'));module[_0x145a('0x1')]={'name':{'type':Sequelize[_0x145a('0x2')]},'description':{'type':Sequelize[_0x145a('0x2')]},'username':{'type':Sequelize[_0x145a('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x145a('0x3')]('basic'),'defaultValue':_0x145a('0x4')},'password':{'type':Sequelize[_0x145a('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x145a('0x2')]},'token':{'type':Sequelize[_0x145a('0x2')]},'tokenSecret':{'type':Sequelize[_0x145a('0x2')]},'serverUrl':{'type':Sequelize[_0x145a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x145a('0x3')]('integrationTab',_0x145a('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x0e86=['STRING','ENUM','basic','newTab','integrationTab'];(function(_0x1aadc5,_0x5eebc0){var _0xe8aff1=function(_0x55bc82){while(--_0x55bc82){_0x1aadc5['push'](_0x1aadc5['shift']());}};_0xe8aff1(++_0x5eebc0);}(_0x0e86,0xdc));var _0x60e8=function(_0xa6df52,_0x1b8584){_0xa6df52=_0xa6df52-0x0;var _0x5edd57=_0x0e86[_0xa6df52];return _0x5edd57;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x60e8('0x0')]},'description':{'type':Sequelize[_0x60e8('0x0')]},'username':{'type':Sequelize[_0x60e8('0x0')]},'remoteUri':{'type':Sequelize[_0x60e8('0x0')]},'authType':{'type':Sequelize[_0x60e8('0x1')](_0x60e8('0x2')),'defaultValue':_0x60e8('0x2')},'password':{'type':Sequelize[_0x60e8('0x0')]},'consumerKey':{'type':Sequelize[_0x60e8('0x0')]},'consumerSecret':{'type':Sequelize[_0x60e8('0x0')]},'token':{'type':Sequelize[_0x60e8('0x0')]},'tokenSecret':{'type':Sequelize[_0x60e8('0x0')]},'serverUrl':{'type':Sequelize[_0x60e8('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x60e8('0x1')]('integrationTab',_0x60e8('0x3')),'defaultValue':_0x60e8('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index f3420d3..7c06184 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 _0x2b30=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../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','update','destroy','error','stack','name','send','index','DeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','then','includeAll','findAll','rows','show','include','find','create','body','catch','params','pick','getConfigurations','nolimit','addConfiguration','Subjects','Descriptions','getDescriptions','channel','DeskField','priority','findOne','remoteUri','authType','username','password','consumerSecret','token','tokenSecret','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','toString','concat','_embedded','active','label','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','statusCode'];(function(_0x3a0685,_0x248c35){var _0x2edf3d=function(_0x3fb7c6){while(--_0x3fb7c6){_0x3a0685['push'](_0x3a0685['shift']());}};_0x2edf3d(++_0x248c35);}(_0x2b30,0x1c8));var _0x02b3=function(_0x499115,_0x49638e){_0x499115=_0x499115-0x0;var _0x37453d=_0x2b30[_0x499115];return _0x37453d;};'use strict';var emlformat=require(_0x02b3('0x0'));var rimraf=require(_0x02b3('0x1'));var zipdir=require(_0x02b3('0x2'));var jsonpatch=require(_0x02b3('0x3'));var rp=require(_0x02b3('0x4'));var moment=require(_0x02b3('0x5'));var BPromise=require(_0x02b3('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x02b3('0x7'));var sox=require(_0x02b3('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x02b3('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x02b3('0xa'));var jsforce=require(_0x02b3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x02b3('0xc'));var querystring=require(_0x02b3('0xd'));var Papa=require(_0x02b3('0xe'));var Redis=require('ioredis');var authService=require(_0x02b3('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x02b3('0x10'));var hardwareService=require(_0x02b3('0x11'));var logger=require('../../config/logger')(_0x02b3('0x12'));var utils=require(_0x02b3('0x13'));var config=require(_0x02b3('0x14'));var licenseUtil=require(_0x02b3('0x15'));var db=require(_0x02b3('0x16'))['db'];var integrations=require(_0x02b3('0x17'));function respondWithStatusCode(_0x330608,_0x14eae1){_0x14eae1=_0x14eae1||0xcc;return function(_0x339a48){if(_0x339a48){return _0x330608[_0x02b3('0x18')](_0x14eae1);}return _0x330608[_0x02b3('0x19')](_0x14eae1)[_0x02b3('0x1a')]();};}function respondWithResult(_0x13ff88,_0x4fe3c7){_0x4fe3c7=_0x4fe3c7||0xc8;return function(_0x2349cf){if(_0x2349cf){return _0x13ff88[_0x02b3('0x19')](_0x4fe3c7)[_0x02b3('0x1b')](_0x2349cf);}};}function respondWithFilteredResult(_0x4ad74b,_0xd4b5b9){return function(_0x49f669){if(_0x49f669){var _0x9497c=typeof _0xd4b5b9[_0x02b3('0x1c')]===_0x02b3('0x1d')&&typeof _0xd4b5b9[_0x02b3('0x1e')]==='undefined';var _0x14d75b=_0x49f669['count'];var _0x3ea98e=_0x9497c?0x0:_0xd4b5b9[_0x02b3('0x1c')];var _0x51ab32=_0x9497c?_0x49f669[_0x02b3('0x1f')]:_0xd4b5b9[_0x02b3('0x1c')]+_0xd4b5b9[_0x02b3('0x1e')];var _0x3cc8e4;if(_0x51ab32>=_0x14d75b){_0x51ab32=_0x14d75b;_0x3cc8e4=0xc8;}else{_0x3cc8e4=0xce;}_0x4ad74b[_0x02b3('0x19')](_0x3cc8e4);return _0x4ad74b[_0x02b3('0x20')](_0x02b3('0x21'),_0x3ea98e+'-'+_0x51ab32+'/'+_0x14d75b)[_0x02b3('0x1b')](_0x49f669);}return null;};}function patchUpdates(_0xb09de0){return function(_0x14e16f){try{jsonpatch[_0x02b3('0x22')](_0x14e16f,_0xb09de0,!![]);}catch(_0x5ec3ff){return BPromise[_0x02b3('0x23')](_0x5ec3ff);}return _0x14e16f[_0x02b3('0x24')]();};}function saveUpdates(_0x405537,_0x292a4c){return function(_0x571aff){if(_0x571aff){return _0x571aff[_0x02b3('0x25')](_0x405537)['then'](function(_0x258988){return _0x258988;});}return null;};}function removeEntity(_0x2c2896,_0x4126bc){return function(_0x54615a){if(_0x54615a){return _0x54615a[_0x02b3('0x26')]()['then'](function(){_0x2c2896['status'](0xcc)[_0x02b3('0x1a')]();});}};}function handleEntityNotFound(_0x1f3b1b,_0x157aa5){return function(_0x3f1754){if(!_0x3f1754){_0x1f3b1b[_0x02b3('0x18')](0x194);}return _0x3f1754;};}function handleError(_0x38c7c1,_0xd99133){_0xd99133=_0xd99133||0x1f4;return function(_0x5e6db4){logger[_0x02b3('0x27')](_0x5e6db4[_0x02b3('0x28')]);if(_0x5e6db4[_0x02b3('0x29')]){delete _0x5e6db4[_0x02b3('0x29')];}_0x38c7c1[_0x02b3('0x19')](_0xd99133)[_0x02b3('0x2a')](_0x5e6db4);};}exports[_0x02b3('0x2b')]=function(_0x67129c,_0x360a1b){var _0x4da5d9={},_0x590e86={},_0xd38abf={'count':0x0,'rows':[]};var _0x5b81d1=_['map'](db[_0x02b3('0x2c')][_0x02b3('0x2d')],function(_0x794bfc){return{'name':_0x794bfc[_0x02b3('0x2e')],'type':_0x794bfc[_0x02b3('0x2f')][_0x02b3('0x30')]};});_0x590e86[_0x02b3('0x31')]=_[_0x02b3('0x32')](_0x5b81d1,_0x02b3('0x29'));_0x590e86[_0x02b3('0x33')]=_[_0x02b3('0x34')](_0x67129c['query']);_0x590e86[_0x02b3('0x35')]=_['intersection'](_0x590e86['model'],_0x590e86[_0x02b3('0x33')]);_0x4da5d9[_0x02b3('0x36')]=_[_0x02b3('0x37')](_0x590e86[_0x02b3('0x31')],qs[_0x02b3('0x38')](_0x67129c['query'][_0x02b3('0x38')]));_0x4da5d9[_0x02b3('0x36')]=_0x4da5d9[_0x02b3('0x36')][_0x02b3('0x39')]?_0x4da5d9['attributes']:_0x590e86[_0x02b3('0x31')];if(!_0x67129c[_0x02b3('0x33')][_0x02b3('0x3a')]('nolimit')){_0x4da5d9[_0x02b3('0x1e')]=qs[_0x02b3('0x1e')](_0x67129c[_0x02b3('0x33')][_0x02b3('0x1e')]);_0x4da5d9['offset']=qs['offset'](_0x67129c['query'][_0x02b3('0x1c')]);}_0x4da5d9[_0x02b3('0x3b')]=qs[_0x02b3('0x3c')](_0x67129c[_0x02b3('0x33')][_0x02b3('0x3c')]);_0x4da5d9[_0x02b3('0x3d')]=qs[_0x02b3('0x35')](_['pick'](_0x67129c[_0x02b3('0x33')],_0x590e86[_0x02b3('0x35')]),_0x5b81d1);if(_0x67129c['query'][_0x02b3('0x3e')]){_0x4da5d9[_0x02b3('0x3d')]=_['merge'](_0x4da5d9[_0x02b3('0x3d')],{'$or':_['map'](_0x5b81d1,function(_0x5b7ad3){if(_0x5b7ad3[_0x02b3('0x2f')]!==_0x02b3('0x3f')){var _0x5d88ff={};_0x5d88ff[_0x5b7ad3[_0x02b3('0x29')]]={'$like':'%'+_0x67129c[_0x02b3('0x33')][_0x02b3('0x3e')]+'%'};return _0x5d88ff;}})});}_0x4da5d9=_[_0x02b3('0x40')]({},_0x4da5d9,_0x67129c[_0x02b3('0x41')]);var _0x534fd9={'where':_0x4da5d9[_0x02b3('0x3d')]};return db[_0x02b3('0x2c')]['count'](_0x534fd9)[_0x02b3('0x42')](function(_0x592881){_0xd38abf[_0x02b3('0x1f')]=_0x592881;if(_0x67129c[_0x02b3('0x33')][_0x02b3('0x43')]){_0x4da5d9['include']=[{'all':!![]}];}return db[_0x02b3('0x2c')][_0x02b3('0x44')](_0x4da5d9);})[_0x02b3('0x42')](function(_0x59cab7){_0xd38abf[_0x02b3('0x45')]=_0x59cab7;return _0xd38abf;})[_0x02b3('0x42')](respondWithFilteredResult(_0x360a1b,_0x4da5d9))['catch'](handleError(_0x360a1b,null));};exports[_0x02b3('0x46')]=function(_0x10781b,_0x4d659b){var _0x215cb6={'raw':![],'where':{'id':_0x10781b['params']['id']}},_0x2cc71b={};_0x2cc71b['model']=_[_0x02b3('0x34')](db[_0x02b3('0x2c')]['rawAttributes']);_0x2cc71b[_0x02b3('0x33')]=_[_0x02b3('0x34')](_0x10781b['query']);_0x2cc71b[_0x02b3('0x35')]=_[_0x02b3('0x37')](_0x2cc71b['model'],_0x2cc71b[_0x02b3('0x33')]);_0x215cb6[_0x02b3('0x36')]=_[_0x02b3('0x37')](_0x2cc71b[_0x02b3('0x31')],qs['fields'](_0x10781b[_0x02b3('0x33')][_0x02b3('0x38')]));_0x215cb6[_0x02b3('0x36')]=_0x215cb6[_0x02b3('0x36')][_0x02b3('0x39')]?_0x215cb6[_0x02b3('0x36')]:_0x2cc71b[_0x02b3('0x31')];if(_0x10781b[_0x02b3('0x33')][_0x02b3('0x43')]){_0x215cb6[_0x02b3('0x47')]=[{'all':!![]}];}_0x215cb6=_[_0x02b3('0x40')]({},_0x215cb6,_0x10781b[_0x02b3('0x41')]);return db['DeskAccount'][_0x02b3('0x48')](_0x215cb6)[_0x02b3('0x42')](handleEntityNotFound(_0x4d659b,null))[_0x02b3('0x42')](respondWithResult(_0x4d659b,null))['catch'](handleError(_0x4d659b,null));};exports[_0x02b3('0x49')]=function(_0x120de2,_0x6cda37){return db[_0x02b3('0x2c')][_0x02b3('0x49')](_0x120de2[_0x02b3('0x4a')],{})[_0x02b3('0x42')](respondWithResult(_0x6cda37,0xc9))[_0x02b3('0x4b')](handleError(_0x6cda37,null));};exports[_0x02b3('0x25')]=function(_0x4f7de8,_0xf9b685){if(_0x4f7de8[_0x02b3('0x4a')]['id']){delete _0x4f7de8['body']['id'];}return db[_0x02b3('0x2c')][_0x02b3('0x48')]({'where':{'id':_0x4f7de8[_0x02b3('0x4c')]['id']}})['then'](handleEntityNotFound(_0xf9b685,null))[_0x02b3('0x42')](saveUpdates(_0x4f7de8[_0x02b3('0x4a')],null))[_0x02b3('0x42')](respondWithResult(_0xf9b685,null))['catch'](handleError(_0xf9b685,null));};exports[_0x02b3('0x26')]=function(_0x527f21,_0x6b6e0a){return db['DeskAccount'][_0x02b3('0x48')]({'where':{'id':_0x527f21['params']['id']}})['then'](handleEntityNotFound(_0x6b6e0a,null))['then'](removeEntity(_0x6b6e0a,null))[_0x02b3('0x4b')](handleError(_0x6b6e0a,null));};exports['getConfigurations']=function(_0x171e6b,_0x378b5f,_0x2cdc7d){var _0x35d866={};var _0xdc9888={};var _0x247eea;var _0x1f4c45;return db[_0x02b3('0x2c')]['findOne']({'where':{'id':_0x171e6b[_0x02b3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x378b5f,null))['then'](function(_0x2daf31){if(_0x2daf31){_0x247eea=_0x2daf31;_0xdc9888[_0x02b3('0x31')]=_[_0x02b3('0x34')](db['DeskConfiguration'][_0x02b3('0x2d')]);_0xdc9888['query']=_[_0x02b3('0x34')](_0x171e6b['query']);_0xdc9888[_0x02b3('0x35')]=_[_0x02b3('0x37')](_0xdc9888[_0x02b3('0x31')],_0xdc9888['query']);_0x35d866[_0x02b3('0x36')]=_[_0x02b3('0x37')](_0xdc9888[_0x02b3('0x31')],qs[_0x02b3('0x38')](_0x171e6b[_0x02b3('0x33')]['fields']));_0x35d866[_0x02b3('0x36')]=_0x35d866[_0x02b3('0x36')]['length']?_0x35d866[_0x02b3('0x36')]:_0xdc9888[_0x02b3('0x31')];_0x35d866[_0x02b3('0x3b')]=qs[_0x02b3('0x3c')](_0x171e6b[_0x02b3('0x33')]['sort']);_0x35d866[_0x02b3('0x3d')]=qs['filters'](_[_0x02b3('0x4d')](_0x171e6b[_0x02b3('0x33')],_0xdc9888[_0x02b3('0x35')]));if(_0x171e6b[_0x02b3('0x33')][_0x02b3('0x3e')]){_0x35d866[_0x02b3('0x3d')]=_[_0x02b3('0x40')](_0x35d866[_0x02b3('0x3d')],{'$or':_[_0x02b3('0x32')](_0x35d866[_0x02b3('0x36')],function(_0x10976c){var _0x17800a={};_0x17800a[_0x10976c]={'$like':'%'+_0x171e6b[_0x02b3('0x33')][_0x02b3('0x3e')]+'%'};return _0x17800a;})});}_0x35d866=_[_0x02b3('0x40')]({},_0x35d866,_0x171e6b[_0x02b3('0x41')]);return _0x247eea[_0x02b3('0x4e')](_0x35d866);}})[_0x02b3('0x42')](function(_0x17501a){if(_0x17501a){_0x1f4c45=_0x17501a[_0x02b3('0x39')];if(!_0x171e6b['query'][_0x02b3('0x3a')](_0x02b3('0x4f'))){_0x35d866[_0x02b3('0x1e')]=qs[_0x02b3('0x1e')](_0x171e6b[_0x02b3('0x33')]['limit']);_0x35d866[_0x02b3('0x1c')]=qs[_0x02b3('0x1c')](_0x171e6b[_0x02b3('0x33')][_0x02b3('0x1c')]);}return _0x247eea[_0x02b3('0x4e')](_0x35d866);}})[_0x02b3('0x42')](function(_0x2a20c0){if(_0x2a20c0){return _0x2a20c0?{'count':_0x1f4c45,'rows':_0x2a20c0}:null;}})['then'](respondWithResult(_0x378b5f,null))[_0x02b3('0x4b')](handleError(_0x378b5f,null));};exports[_0x02b3('0x50')]=function(_0x14f947,_0xf6728b,_0x94fddb){if(_0x14f947[_0x02b3('0x4a')]['id']){delete _0x14f947[_0x02b3('0x4a')]['id'];}return db[_0x02b3('0x2c')]['findOne']({'where':{'id':_0x14f947[_0x02b3('0x4c')]['id']}})[_0x02b3('0x42')](handleEntityNotFound(_0xf6728b,null))[_0x02b3('0x42')](function(_0x58db35){if(_0x58db35){_0x14f947[_0x02b3('0x4a')]['AccountId']=_0x58db35['id'];_0x14f947[_0x02b3('0x4a')][_0x02b3('0x51')]=integrations['getSubjects'](_0x14f947[_0x02b3('0x4a')]['channel'],_0x14f947[_0x02b3('0x4a')][_0x02b3('0x2f')]);_0x14f947[_0x02b3('0x4a')][_0x02b3('0x52')]=integrations[_0x02b3('0x53')](_0x14f947[_0x02b3('0x4a')][_0x02b3('0x54')],_0x14f947[_0x02b3('0x4a')][_0x02b3('0x2f')]);return db['DeskConfiguration']['create'](_0x14f947[_0x02b3('0x4a')],{'include':[{'model':db[_0x02b3('0x55')],'as':'Subjects'},{'model':db[_0x02b3('0x55')],'as':'Descriptions'}]});}return null;})[_0x02b3('0x42')](respondWithResult(_0xf6728b,null))['catch'](handleError(_0xf6728b,null));};exports['getFields']=function(_0x27a88b,_0x372388,_0x41f1d0){var _0x292ba4=[{'name':'priority','label':_0x02b3('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 _0x2fa64e='';return db['DeskAccount'][_0x02b3('0x57')]({'where':{'id':_0x27a88b[_0x02b3('0x4c')]['id']},'attributes':['id',_0x02b3('0x58'),_0x02b3('0x59'),_0x02b3('0x5a'),_0x02b3('0x5b'),'consumerKey',_0x02b3('0x5c'),_0x02b3('0x5d'),_0x02b3('0x5e')]})['then'](handleEntityNotFound(_0x372388,null))[_0x02b3('0x42')](function(_0x355cac){if(_0x355cac){_0x2fa64e=_0x355cac['remoteUri'];var _0x807553=_0x2fa64e[_0x02b3('0x5f')](-0x1);if(_0x807553==='/'){_0x2fa64e=_0x2fa64e['substring'](0x0,_0x2fa64e[_0x02b3('0x60')](_0x807553));}var _0x1c8559={'method':_0x02b3('0x61'),'uri':util[_0x02b3('0x62')](_0x02b3('0x63'),_0x2fa64e),'headers':{'Content-Type':_0x02b3('0x64'),'Accept':_0x02b3('0x64')},'json':!![]};if(_0x355cac['authType']===_0x02b3('0x65')){_0x1c8559['headers'][_0x02b3('0x66')]=util[_0x02b3('0x62')](_0x02b3('0x67'),new Buffer(util[_0x02b3('0x62')]('%s:%s',_0x355cac['username'],_0x355cac[_0x02b3('0x5b')]))[_0x02b3('0x68')]('base64'));}return rp(_0x1c8559)['then'](function(_0x5f46b8){return _0x292ba4[_0x02b3('0x69')](_[_0x02b3('0x32')](_0x5f46b8[_0x02b3('0x6a')]['entries'],function(_0x5e6a8b){return{'id':_0x5e6a8b[_0x02b3('0x29')],'name':_0x5e6a8b[_0x02b3('0x29')],'type':_0x5e6a8b[_0x02b3('0x2f')],'active':_0x5e6a8b[_0x02b3('0x6b')],'label':_0x5e6a8b[_0x02b3('0x6c')],'custom':!![]};}));});}})[_0x02b3('0x42')](function(_0x4825a2){return{'count':_0x4825a2['length'],'rows':_0x4825a2};})['then'](respondWithResult(_0x372388,null))['catch'](function(_0xc8ffe0){var _0xfdbeb0=_0x27a88b['query']['test']?0x1f4:_0xc8ffe0['statusCode']||0x1f4;logger[_0x02b3('0x27')](_0x02b3('0x6d'),_0x02b3('0x6e'),_0xfdbeb0,JSON[_0x02b3('0x6f')](_0xc8ffe0));delete _0xc8ffe0['name'];if(_0xfdbeb0===0x191){_0xfdbeb0=0x190;}_0x372388['status'](_0xfdbeb0)['send'](_0x27a88b['query'][_0x02b3('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0xc8ffe0[_0x02b3('0x71')]}:_0xc8ffe0);});}; \ No newline at end of file +var _0x50a5=['key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','then','rows','catch','show','create','body','find','params','findOne','DeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','username','consumerKey','consumerSecret','token','slice','substring','lastIndexOf','format','application/json','authType','basic','headers','Basic\x20%s','%s:%s','password','base64','concat','_embedded','entries','active','label','test','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','DeskAccount','rawAttributes','fieldName','type'];(function(_0x4464de,_0x12824e){var _0x6a2772=function(_0x141a12){while(--_0x141a12){_0x4464de['push'](_0x4464de['shift']());}};_0x6a2772(++_0x12824e);}(_0x50a5,0x1a5));var _0x550a=function(_0x41d7d1,_0x44912d){_0x41d7d1=_0x41d7d1-0x0;var _0x14a1e1=_0x50a5[_0x41d7d1];return _0x14a1e1;};'use strict';var emlformat=require(_0x550a('0x0'));var rimraf=require(_0x550a('0x1'));var zipdir=require(_0x550a('0x2'));var jsonpatch=require(_0x550a('0x3'));var rp=require(_0x550a('0x4'));var moment=require(_0x550a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x550a('0x6'));var util=require(_0x550a('0x7'));var path=require(_0x550a('0x8'));var sox=require(_0x550a('0x9'));var csv=require('to-csv');var ejs=require(_0x550a('0xa'));var fs=require('fs');var fs_extra=require(_0x550a('0xb'));var _=require(_0x550a('0xc'));var squel=require(_0x550a('0xd'));var crypto=require(_0x550a('0xe'));var jsforce=require(_0x550a('0xf'));var deskjs=require(_0x550a('0x10'));var toCsv=require(_0x550a('0x11'));var querystring=require('querystring');var Papa=require(_0x550a('0x12'));var Redis=require('ioredis');var authService=require(_0x550a('0x13'));var qs=require(_0x550a('0x14'));var as=require(_0x550a('0x15'));var hardwareService=require(_0x550a('0x16'));var logger=require(_0x550a('0x17'))('api');var utils=require(_0x550a('0x18'));var config=require(_0x550a('0x19'));var licenseUtil=require(_0x550a('0x1a'));var db=require(_0x550a('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5b8819,_0x52d47e){_0x52d47e=_0x52d47e||0xcc;return function(_0x4834a1){if(_0x4834a1){return _0x5b8819[_0x550a('0x1c')](_0x52d47e);}return _0x5b8819[_0x550a('0x1d')](_0x52d47e)[_0x550a('0x1e')]();};}function respondWithResult(_0x298d55,_0x22a19f){_0x22a19f=_0x22a19f||0xc8;return function(_0xc60ea3){if(_0xc60ea3){return _0x298d55['status'](_0x22a19f)[_0x550a('0x1f')](_0xc60ea3);}};}function respondWithFilteredResult(_0x503be0,_0x533501){return function(_0x35bd57){if(_0x35bd57){var _0x357df5=typeof _0x533501[_0x550a('0x20')]==='undefined'&&typeof _0x533501[_0x550a('0x21')]===_0x550a('0x22');var _0x361d44=_0x35bd57[_0x550a('0x23')];var _0x15d9f8=_0x357df5?0x0:_0x533501[_0x550a('0x20')];var _0x58bf1a=_0x357df5?_0x35bd57['count']:_0x533501['offset']+_0x533501['limit'];var _0x45b072;if(_0x58bf1a>=_0x361d44){_0x58bf1a=_0x361d44;_0x45b072=0xc8;}else{_0x45b072=0xce;}_0x503be0[_0x550a('0x1d')](_0x45b072);return _0x503be0[_0x550a('0x24')](_0x550a('0x25'),_0x15d9f8+'-'+_0x58bf1a+'/'+_0x361d44)['json'](_0x35bd57);}return null;};}function patchUpdates(_0x764b14){return function(_0x1d4ee9){try{jsonpatch[_0x550a('0x26')](_0x1d4ee9,_0x764b14,!![]);}catch(_0x41029c){return BPromise[_0x550a('0x27')](_0x41029c);}return _0x1d4ee9[_0x550a('0x28')]();};}function saveUpdates(_0x2df8ea,_0x4b3b61){return function(_0x1786ff){if(_0x1786ff){return _0x1786ff[_0x550a('0x29')](_0x2df8ea)['then'](function(_0x32c765){return _0x32c765;});}return null;};}function removeEntity(_0x2cb531,_0x27fa9f){return function(_0x13c812){if(_0x13c812){return _0x13c812[_0x550a('0x2a')]()['then'](function(){_0x2cb531[_0x550a('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x931d00,_0x403c1c){return function(_0x28db90){if(!_0x28db90){_0x931d00[_0x550a('0x1c')](0x194);}return _0x28db90;};}function handleError(_0x3872cb,_0x475c87){_0x475c87=_0x475c87||0x1f4;return function(_0x37cd68){logger['error'](_0x37cd68[_0x550a('0x2b')]);if(_0x37cd68['name']){delete _0x37cd68[_0x550a('0x2c')];}_0x3872cb[_0x550a('0x1d')](_0x475c87)[_0x550a('0x2d')](_0x37cd68);};}exports['index']=function(_0x39e5dc,_0x46b8ea){var _0x47aad7={},_0x104be5={},_0x15d286={'count':0x0,'rows':[]};var _0x3cf0a3=_[_0x550a('0x2e')](db[_0x550a('0x2f')][_0x550a('0x30')],function(_0x2e1877){return{'name':_0x2e1877[_0x550a('0x31')],'type':_0x2e1877[_0x550a('0x32')][_0x550a('0x33')]};});_0x104be5[_0x550a('0x34')]=_[_0x550a('0x2e')](_0x3cf0a3,'name');_0x104be5[_0x550a('0x35')]=_[_0x550a('0x36')](_0x39e5dc[_0x550a('0x35')]);_0x104be5['filters']=_[_0x550a('0x37')](_0x104be5[_0x550a('0x34')],_0x104be5[_0x550a('0x35')]);_0x47aad7[_0x550a('0x38')]=_['intersection'](_0x104be5[_0x550a('0x34')],qs[_0x550a('0x39')](_0x39e5dc[_0x550a('0x35')][_0x550a('0x39')]));_0x47aad7[_0x550a('0x38')]=_0x47aad7[_0x550a('0x38')][_0x550a('0x3a')]?_0x47aad7[_0x550a('0x38')]:_0x104be5[_0x550a('0x34')];if(!_0x39e5dc[_0x550a('0x35')][_0x550a('0x3b')](_0x550a('0x3c'))){_0x47aad7[_0x550a('0x21')]=qs['limit'](_0x39e5dc[_0x550a('0x35')][_0x550a('0x21')]);_0x47aad7[_0x550a('0x20')]=qs[_0x550a('0x20')](_0x39e5dc[_0x550a('0x35')]['offset']);}_0x47aad7[_0x550a('0x3d')]=qs[_0x550a('0x3e')](_0x39e5dc[_0x550a('0x35')][_0x550a('0x3e')]);_0x47aad7['where']=qs[_0x550a('0x3f')](_[_0x550a('0x40')](_0x39e5dc['query'],_0x104be5['filters']),_0x3cf0a3);if(_0x39e5dc['query'][_0x550a('0x41')]){_0x47aad7['where']=_[_0x550a('0x42')](_0x47aad7[_0x550a('0x43')],{'$or':_[_0x550a('0x2e')](_0x3cf0a3,function(_0x170d4a){if(_0x170d4a[_0x550a('0x32')]!==_0x550a('0x44')){var _0x16fd2e={};_0x16fd2e[_0x170d4a['name']]={'$like':'%'+_0x39e5dc['query'][_0x550a('0x41')]+'%'};return _0x16fd2e;}})});}_0x47aad7=_[_0x550a('0x42')]({},_0x47aad7,_0x39e5dc[_0x550a('0x45')]);var _0x40011c={'where':_0x47aad7['where']};return db[_0x550a('0x2f')][_0x550a('0x23')](_0x40011c)['then'](function(_0x2d30da){_0x15d286[_0x550a('0x23')]=_0x2d30da;if(_0x39e5dc['query'][_0x550a('0x46')]){_0x47aad7[_0x550a('0x47')]=[{'all':!![]}];}return db[_0x550a('0x2f')][_0x550a('0x48')](_0x47aad7);})[_0x550a('0x49')](function(_0x5cfa9b){_0x15d286[_0x550a('0x4a')]=_0x5cfa9b;return _0x15d286;})[_0x550a('0x49')](respondWithFilteredResult(_0x46b8ea,_0x47aad7))[_0x550a('0x4b')](handleError(_0x46b8ea,null));};exports[_0x550a('0x4c')]=function(_0x26eaf0,_0x47e10d){var _0x4c5dc5={'raw':![],'where':{'id':_0x26eaf0['params']['id']}},_0x20287d={};_0x20287d[_0x550a('0x34')]=_[_0x550a('0x36')](db['DeskAccount'][_0x550a('0x30')]);_0x20287d[_0x550a('0x35')]=_[_0x550a('0x36')](_0x26eaf0[_0x550a('0x35')]);_0x20287d[_0x550a('0x3f')]=_['intersection'](_0x20287d[_0x550a('0x34')],_0x20287d[_0x550a('0x35')]);_0x4c5dc5[_0x550a('0x38')]=_['intersection'](_0x20287d[_0x550a('0x34')],qs[_0x550a('0x39')](_0x26eaf0[_0x550a('0x35')][_0x550a('0x39')]));_0x4c5dc5[_0x550a('0x38')]=_0x4c5dc5[_0x550a('0x38')]['length']?_0x4c5dc5[_0x550a('0x38')]:_0x20287d[_0x550a('0x34')];if(_0x26eaf0['query']['includeAll']){_0x4c5dc5[_0x550a('0x47')]=[{'all':!![]}];}_0x4c5dc5=_['merge']({},_0x4c5dc5,_0x26eaf0[_0x550a('0x45')]);return db[_0x550a('0x2f')]['find'](_0x4c5dc5)[_0x550a('0x49')](handleEntityNotFound(_0x47e10d,null))[_0x550a('0x49')](respondWithResult(_0x47e10d,null))[_0x550a('0x4b')](handleError(_0x47e10d,null));};exports[_0x550a('0x4d')]=function(_0x3f3bce,_0x5730be){return db[_0x550a('0x2f')]['create'](_0x3f3bce['body'],{})['then'](respondWithResult(_0x5730be,0xc9))['catch'](handleError(_0x5730be,null));};exports[_0x550a('0x29')]=function(_0x41dfe5,_0x4eeeb9){if(_0x41dfe5[_0x550a('0x4e')]['id']){delete _0x41dfe5[_0x550a('0x4e')]['id'];}return db[_0x550a('0x2f')][_0x550a('0x4f')]({'where':{'id':_0x41dfe5[_0x550a('0x50')]['id']}})['then'](handleEntityNotFound(_0x4eeeb9,null))[_0x550a('0x49')](saveUpdates(_0x41dfe5[_0x550a('0x4e')],null))[_0x550a('0x49')](respondWithResult(_0x4eeeb9,null))['catch'](handleError(_0x4eeeb9,null));};exports[_0x550a('0x2a')]=function(_0x2d38db,_0x4ca222){return db[_0x550a('0x2f')][_0x550a('0x4f')]({'where':{'id':_0x2d38db['params']['id']}})[_0x550a('0x49')](handleEntityNotFound(_0x4ca222,null))[_0x550a('0x49')](removeEntity(_0x4ca222,null))['catch'](handleError(_0x4ca222,null));};exports['getConfigurations']=function(_0x473c82,_0x258fe4,_0x2204ac){var _0x56c287={};var _0x514f3c={};var _0x403564;var _0x3aa1a2;return db[_0x550a('0x2f')][_0x550a('0x51')]({'where':{'id':_0x473c82[_0x550a('0x50')]['id']}})[_0x550a('0x49')](handleEntityNotFound(_0x258fe4,null))['then'](function(_0x4205f3){if(_0x4205f3){_0x403564=_0x4205f3;_0x514f3c['model']=_[_0x550a('0x36')](db[_0x550a('0x52')]['rawAttributes']);_0x514f3c['query']=_['keys'](_0x473c82['query']);_0x514f3c[_0x550a('0x3f')]=_[_0x550a('0x37')](_0x514f3c[_0x550a('0x34')],_0x514f3c[_0x550a('0x35')]);_0x56c287[_0x550a('0x38')]=_[_0x550a('0x37')](_0x514f3c[_0x550a('0x34')],qs[_0x550a('0x39')](_0x473c82[_0x550a('0x35')][_0x550a('0x39')]));_0x56c287['attributes']=_0x56c287[_0x550a('0x38')]['length']?_0x56c287[_0x550a('0x38')]:_0x514f3c['model'];_0x56c287[_0x550a('0x3d')]=qs['sort'](_0x473c82['query'][_0x550a('0x3e')]);_0x56c287[_0x550a('0x43')]=qs[_0x550a('0x3f')](_[_0x550a('0x40')](_0x473c82['query'],_0x514f3c[_0x550a('0x3f')]));if(_0x473c82[_0x550a('0x35')][_0x550a('0x41')]){_0x56c287[_0x550a('0x43')]=_[_0x550a('0x42')](_0x56c287[_0x550a('0x43')],{'$or':_[_0x550a('0x2e')](_0x56c287[_0x550a('0x38')],function(_0x551bb3){var _0x27e26a={};_0x27e26a[_0x551bb3]={'$like':'%'+_0x473c82[_0x550a('0x35')][_0x550a('0x41')]+'%'};return _0x27e26a;})});}_0x56c287=_[_0x550a('0x42')]({},_0x56c287,_0x473c82[_0x550a('0x45')]);return _0x403564[_0x550a('0x53')](_0x56c287);}})['then'](function(_0x427fe2){if(_0x427fe2){_0x3aa1a2=_0x427fe2[_0x550a('0x3a')];if(!_0x473c82[_0x550a('0x35')][_0x550a('0x3b')](_0x550a('0x3c'))){_0x56c287[_0x550a('0x21')]=qs[_0x550a('0x21')](_0x473c82[_0x550a('0x35')][_0x550a('0x21')]);_0x56c287[_0x550a('0x20')]=qs[_0x550a('0x20')](_0x473c82['query']['offset']);}return _0x403564[_0x550a('0x53')](_0x56c287);}})['then'](function(_0x279cd4){if(_0x279cd4){return _0x279cd4?{'count':_0x3aa1a2,'rows':_0x279cd4}:null;}})[_0x550a('0x49')](respondWithResult(_0x258fe4,null))[_0x550a('0x4b')](handleError(_0x258fe4,null));};exports[_0x550a('0x54')]=function(_0x1e5c9e,_0x52452a,_0x1720e1){if(_0x1e5c9e['body']['id']){delete _0x1e5c9e['body']['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x1e5c9e['params']['id']}})['then'](handleEntityNotFound(_0x52452a,null))['then'](function(_0xcedb7b){if(_0xcedb7b){_0x1e5c9e[_0x550a('0x4e')][_0x550a('0x55')]=_0xcedb7b['id'];_0x1e5c9e[_0x550a('0x4e')][_0x550a('0x56')]=integrations[_0x550a('0x57')](_0x1e5c9e[_0x550a('0x4e')][_0x550a('0x58')],_0x1e5c9e[_0x550a('0x4e')][_0x550a('0x32')]);_0x1e5c9e['body'][_0x550a('0x59')]=integrations[_0x550a('0x5a')](_0x1e5c9e['body'][_0x550a('0x58')],_0x1e5c9e['body'][_0x550a('0x32')]);return db[_0x550a('0x52')][_0x550a('0x4d')](_0x1e5c9e[_0x550a('0x4e')],{'include':[{'model':db[_0x550a('0x5b')],'as':'Subjects'},{'model':db[_0x550a('0x5b')],'as':_0x550a('0x59')}]});}return null;})[_0x550a('0x49')](respondWithResult(_0x52452a,null))[_0x550a('0x4b')](handleError(_0x52452a,null));};exports[_0x550a('0x5c')]=function(_0x32fbe4,_0x3a949a,_0x37f7a2){var _0x297a30=[{'name':_0x550a('0x5d'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x4b6203='';return db[_0x550a('0x2f')]['findOne']({'where':{'id':_0x32fbe4[_0x550a('0x50')]['id']},'attributes':['id','remoteUri','authType',_0x550a('0x5e'),'password',_0x550a('0x5f'),_0x550a('0x60'),_0x550a('0x61'),'tokenSecret']})['then'](handleEntityNotFound(_0x3a949a,null))[_0x550a('0x49')](function(_0x4812d7){if(_0x4812d7){_0x4b6203=_0x4812d7['remoteUri'];var _0x4947ec=_0x4b6203[_0x550a('0x62')](-0x1);if(_0x4947ec==='/'){_0x4b6203=_0x4b6203[_0x550a('0x63')](0x0,_0x4b6203[_0x550a('0x64')](_0x4947ec));}var _0x1a498c={'method':'GET','uri':util[_0x550a('0x65')]('%s/custom_fields',_0x4b6203),'headers':{'Content-Type':_0x550a('0x66'),'Accept':_0x550a('0x66')},'json':!![]};if(_0x4812d7[_0x550a('0x67')]===_0x550a('0x68')){_0x1a498c[_0x550a('0x69')]['Authorization']=util[_0x550a('0x65')](_0x550a('0x6a'),new Buffer(util['format'](_0x550a('0x6b'),_0x4812d7['username'],_0x4812d7[_0x550a('0x6c')]))['toString'](_0x550a('0x6d')));}return rp(_0x1a498c)[_0x550a('0x49')](function(_0x46f0bd){return _0x297a30[_0x550a('0x6e')](_['map'](_0x46f0bd[_0x550a('0x6f')][_0x550a('0x70')],function(_0x1d668f){return{'id':_0x1d668f[_0x550a('0x2c')],'name':_0x1d668f[_0x550a('0x2c')],'type':_0x1d668f[_0x550a('0x32')],'active':_0x1d668f[_0x550a('0x71')],'label':_0x1d668f[_0x550a('0x72')],'custom':!![]};}));});}})[_0x550a('0x49')](function(_0x5224b1){return{'count':_0x5224b1[_0x550a('0x3a')],'rows':_0x5224b1};})[_0x550a('0x49')](respondWithResult(_0x3a949a,null))[_0x550a('0x4b')](function(_0x5a813b){var _0x32460e=_0x32fbe4[_0x550a('0x35')][_0x550a('0x73')]?0x1f4:_0x5a813b['statusCode']||0x1f4;logger['error'](_0x550a('0x74'),'getFields',_0x32460e,JSON[_0x550a('0x75')](_0x5a813b));delete _0x5a813b[_0x550a('0x2c')];if(_0x32460e===0x191){_0x32460e=0x190;}_0x3a949a[_0x550a('0x1d')](_0x32460e)[_0x550a('0x2d')](_0x32fbe4[_0x550a('0x35')][_0x550a('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x5a813b['statusCode']}:_0x5a813b);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 954e4b6..5aef609 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 _0x2c06=['int_desk_accounts','util','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount'];(function(_0x3ab540,_0x31a460){var _0x1ff269=function(_0xa7bd71){while(--_0xa7bd71){_0x3ab540['push'](_0x3ab540['shift']());}};_0x1ff269(++_0x31a460);}(_0x2c06,0x182));var _0x62c0=function(_0x5d8cf3,_0x5f3f41){_0x5d8cf3=_0x5d8cf3-0x0;var _0x1a93f9=_0x2c06[_0x5d8cf3];return _0x1a93f9;};'use strict';var _=require('lodash');var util=require(_0x62c0('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x62c0('0x1'));var fs=require('fs');var path=require(_0x62c0('0x2'));var rimraf=require(_0x62c0('0x3'));var config=require(_0x62c0('0x4'));var attributes=require(_0x62c0('0x5'));var integrations=require(_0x62c0('0x6'));module[_0x62c0('0x7')]=function(_0x524071,_0xb7d1b2){return _0x524071[_0x62c0('0x8')](_0x62c0('0x9'),attributes,{'tableName':_0x62c0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa62c=['rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','int_desk_accounts','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x15d865,_0x31d35d){var _0x166727=function(_0x4644b7){while(--_0x4644b7){_0x15d865['push'](_0x15d865['shift']());}};_0x166727(++_0x31d35d);}(_0xa62c,0x1da));var _0xca62=function(_0x53afa6,_0x59e786){_0x53afa6=_0x53afa6-0x0;var _0x51f86a=_0xa62c[_0x53afa6];return _0x51f86a;};'use strict';var _=require(_0xca62('0x0'));var util=require(_0xca62('0x1'));var logger=require(_0xca62('0x2'))(_0xca62('0x3'));var moment=require(_0xca62('0x4'));var BPromise=require('bluebird');var rp=require(_0xca62('0x5'));var fs=require('fs');var path=require(_0xca62('0x6'));var rimraf=require(_0xca62('0x7'));var config=require(_0xca62('0x8'));var attributes=require(_0xca62('0x9'));var integrations=require(_0xca62('0xa'));module['exports']=function(_0x43605b,_0x459bb3){return _0x43605b[_0xca62('0xb')]('DeskAccount',attributes,{'tableName':_0xca62('0xc'),'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 400e4f6..f09354e 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 _0xedbe=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','GetDeskAccount','stringify','ShowDeskAccount','find','lodash','util','moment','bluebird'];(function(_0x208256,_0x23c68){var _0x33e740=function(_0x49bfac){while(--_0x49bfac){_0x208256['push'](_0x208256['shift']());}};_0x33e740(++_0x23c68);}(_0xedbe,0x152));var _0xeedb=function(_0x5b4b67,_0x5355f7){_0x5b4b67=_0x5b4b67-0x0;var _0x4ecec4=_0xedbe[_0x5b4b67];return _0x4ecec4;};'use strict';var _=require(_0xeedb('0x0'));var util=require(_0xeedb('0x1'));var moment=require(_0xeedb('0x2'));var BPromise=require(_0xeedb('0x3'));var rs=require(_0xeedb('0x4'));var fs=require('fs');var Redis=require(_0xeedb('0x5'));var db=require(_0xeedb('0x6'))['db'];var utils=require(_0xeedb('0x7'));var logger=require(_0xeedb('0x8'))(_0xeedb('0x9'));var config=require(_0xeedb('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xeedb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3546e6,_0x17bf6e,_0x8d4a9a){return new BPromise(function(_0x1e14a9,_0xbe67d2){return client[_0xeedb('0xc')](_0x3546e6,_0x8d4a9a)[_0xeedb('0xd')](function(_0x523805){logger[_0xeedb('0xe')](_0xeedb('0xf'),_0x17bf6e,_0xeedb('0x10'));logger['debug'](_0xeedb('0x11'),_0x17bf6e,_0xeedb('0x10'),JSON['stringify'](_0x523805));if(_0x523805[_0xeedb('0x12')]){if(_0x523805[_0xeedb('0x12')][_0xeedb('0x13')]===0x1f4){logger[_0xeedb('0x12')]('DeskAccount,\x20%s,\x20%s',_0x17bf6e,_0x523805[_0xeedb('0x12')][_0xeedb('0x14')]);return _0xbe67d2(_0x523805[_0xeedb('0x12')][_0xeedb('0x14')]);}logger[_0xeedb('0x12')](_0xeedb('0xf'),_0x17bf6e,_0x523805[_0xeedb('0x12')][_0xeedb('0x14')]);return _0x1e14a9(_0x523805['error']['message']);}else{logger['info'](_0xeedb('0xf'),_0x17bf6e,_0xeedb('0x10'));_0x1e14a9(_0x523805[_0xeedb('0x15')]['message']);}})[_0xeedb('0x16')](function(_0x1492d9){logger[_0xeedb('0x12')](_0xeedb('0xf'),_0x17bf6e,_0x1492d9);_0xbe67d2(_0x1492d9);});});}exports['GetDeskAccount']=function(_0x7147b8){var _0x4b95c4=this;return new Promise(function(_0x1ef59f,_0x2e18c9){return db[_0xeedb('0x17')][_0xeedb('0x18')]({'raw':_0x7147b8[_0xeedb('0x19')]?_0x7147b8[_0xeedb('0x19')][_0xeedb('0x1a')]===undefined?!![]:![]:!![],'where':_0x7147b8[_0xeedb('0x19')]?_0x7147b8[_0xeedb('0x19')][_0xeedb('0x1b')]||null:null,'attributes':_0x7147b8['options']?_0x7147b8['options'][_0xeedb('0x1c')]||null:null,'limit':_0x7147b8['options']?_0x7147b8[_0xeedb('0x19')][_0xeedb('0x1d')]||null:null,'include':_0x7147b8[_0xeedb('0x19')]?_0x7147b8[_0xeedb('0x19')][_0xeedb('0x1e')]?_[_0xeedb('0x1f')](_0x7147b8['options'][_0xeedb('0x1e')],function(_0x301035){return{'model':db[_0x301035['model']],'as':_0x301035['as'],'attributes':_0x301035['attributes'],'include':_0x301035['include']?_[_0xeedb('0x1f')](_0x301035[_0xeedb('0x1e')],function(_0xdffbc7){return{'model':db[_0xdffbc7[_0xeedb('0x20')]],'as':_0xdffbc7['as'],'attributes':_0xdffbc7[_0xeedb('0x1c')],'include':_0xdffbc7['include']?_[_0xeedb('0x1f')](_0xdffbc7[_0xeedb('0x1e')],function(_0x2f4d43){return{'model':db[_0x2f4d43[_0xeedb('0x20')]],'as':_0x2f4d43['as'],'attributes':_0x2f4d43[_0xeedb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xeedb('0xd')](function(_0x12aa5f){logger[_0xeedb('0xe')]('GetDeskAccount',_0x7147b8);logger[_0xeedb('0x21')](_0xeedb('0x22'),_0x7147b8,JSON[_0xeedb('0x23')](_0x12aa5f));_0x1ef59f(_0x12aa5f);})[_0xeedb('0x16')](function(_0x912768){logger[_0xeedb('0x12')](_0xeedb('0x22'),_0x912768[_0xeedb('0x14')],_0x7147b8);_0x2e18c9(_0x4b95c4['error'](0x1f4,_0x912768[_0xeedb('0x14')]));});});};exports[_0xeedb('0x24')]=function(_0x53a15a){var _0x15ee48=this;return new Promise(function(_0x37f48c,_0x3bb53f){return db['DeskAccount'][_0xeedb('0x25')]({'raw':_0x53a15a[_0xeedb('0x19')]?_0x53a15a[_0xeedb('0x19')][_0xeedb('0x1a')]===undefined?!![]:![]:!![],'where':_0x53a15a[_0xeedb('0x19')]?_0x53a15a[_0xeedb('0x19')][_0xeedb('0x1b')]||null:null,'attributes':_0x53a15a[_0xeedb('0x19')]?_0x53a15a['options'][_0xeedb('0x1c')]||null:null,'include':_0x53a15a[_0xeedb('0x19')]?_0x53a15a[_0xeedb('0x19')][_0xeedb('0x1e')]?_[_0xeedb('0x1f')](_0x53a15a[_0xeedb('0x19')][_0xeedb('0x1e')],function(_0x494a88){return{'model':db[_0x494a88['model']],'as':_0x494a88['as'],'attributes':_0x494a88[_0xeedb('0x1c')],'include':_0x494a88[_0xeedb('0x1e')]?_[_0xeedb('0x1f')](_0x494a88[_0xeedb('0x1e')],function(_0xf2c42c){return{'model':db[_0xf2c42c[_0xeedb('0x20')]],'as':_0xf2c42c['as'],'attributes':_0xf2c42c[_0xeedb('0x1c')],'include':_0xf2c42c[_0xeedb('0x1e')]?_[_0xeedb('0x1f')](_0xf2c42c[_0xeedb('0x1e')],function(_0x2d120a){return{'model':db[_0x2d120a['model']],'as':_0x2d120a['as'],'attributes':_0x2d120a[_0xeedb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xeedb('0xd')](function(_0x17a33a){logger['info'](_0xeedb('0x24'),_0x53a15a);logger[_0xeedb('0x21')](_0xeedb('0x24'),_0x53a15a,JSON[_0xeedb('0x23')](_0x17a33a));_0x37f48c(_0x17a33a);})[_0xeedb('0x16')](function(_0x30df92){logger['error'](_0xeedb('0x24'),_0x30df92['message'],_0x53a15a);_0x3bb53f(_0x15ee48[_0xeedb('0x12')](0x1f4,_0x30df92[_0xeedb('0x14')]));});});}; \ No newline at end of file +var _0x4f95=['DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','where','attributes','limit','include','map','model','find','raw','ShowDeskAccount','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x47442f,_0x3d40c7){var _0x48cb22=function(_0x5a07ab){while(--_0x5a07ab){_0x47442f['push'](_0x47442f['shift']());}};_0x48cb22(++_0x3d40c7);}(_0x4f95,0x17f));var _0x54f9=function(_0x30fdcf,_0x47e96d){_0x30fdcf=_0x30fdcf-0x0;var _0x266f7f=_0x4f95[_0x30fdcf];return _0x266f7f;};'use strict';var _=require(_0x54f9('0x0'));var util=require(_0x54f9('0x1'));var moment=require(_0x54f9('0x2'));var BPromise=require(_0x54f9('0x3'));var rs=require(_0x54f9('0x4'));var fs=require('fs');var Redis=require(_0x54f9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x54f9('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x54f9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1fd4b4,_0x41684f,_0x4b97bf){return new BPromise(function(_0x7bdc87,_0x596df0){return client[_0x54f9('0x8')](_0x1fd4b4,_0x4b97bf)[_0x54f9('0x9')](function(_0x2492cb){logger[_0x54f9('0xa')](_0x54f9('0xb'),_0x41684f,_0x54f9('0xc'));logger['debug'](_0x54f9('0xd'),_0x41684f,_0x54f9('0xc'),JSON[_0x54f9('0xe')](_0x2492cb));if(_0x2492cb['error']){if(_0x2492cb[_0x54f9('0xf')]['code']===0x1f4){logger[_0x54f9('0xf')](_0x54f9('0xb'),_0x41684f,_0x2492cb['error']['message']);return _0x596df0(_0x2492cb[_0x54f9('0xf')][_0x54f9('0x10')]);}logger[_0x54f9('0xf')](_0x54f9('0xb'),_0x41684f,_0x2492cb[_0x54f9('0xf')][_0x54f9('0x10')]);return _0x7bdc87(_0x2492cb[_0x54f9('0xf')][_0x54f9('0x10')]);}else{logger[_0x54f9('0xa')](_0x54f9('0xb'),_0x41684f,_0x54f9('0xc'));_0x7bdc87(_0x2492cb[_0x54f9('0x11')][_0x54f9('0x10')]);}})[_0x54f9('0x12')](function(_0x3044f2){logger[_0x54f9('0xf')](_0x54f9('0xb'),_0x41684f,_0x3044f2);_0x596df0(_0x3044f2);});});}exports[_0x54f9('0x13')]=function(_0x4217dc){var _0x29be77=this;return new Promise(function(_0x1129f2,_0x100321){return db[_0x54f9('0x14')][_0x54f9('0x15')]({'raw':_0x4217dc['options']?_0x4217dc[_0x54f9('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4217dc[_0x54f9('0x16')]?_0x4217dc[_0x54f9('0x16')][_0x54f9('0x17')]||null:null,'attributes':_0x4217dc[_0x54f9('0x16')]?_0x4217dc[_0x54f9('0x16')][_0x54f9('0x18')]||null:null,'limit':_0x4217dc[_0x54f9('0x16')]?_0x4217dc[_0x54f9('0x16')][_0x54f9('0x19')]||null:null,'include':_0x4217dc['options']?_0x4217dc[_0x54f9('0x16')][_0x54f9('0x1a')]?_[_0x54f9('0x1b')](_0x4217dc[_0x54f9('0x16')][_0x54f9('0x1a')],function(_0x4348b0){return{'model':db[_0x4348b0[_0x54f9('0x1c')]],'as':_0x4348b0['as'],'attributes':_0x4348b0[_0x54f9('0x18')],'include':_0x4348b0[_0x54f9('0x1a')]?_[_0x54f9('0x1b')](_0x4348b0[_0x54f9('0x1a')],function(_0xf33aea){return{'model':db[_0xf33aea[_0x54f9('0x1c')]],'as':_0xf33aea['as'],'attributes':_0xf33aea[_0x54f9('0x18')],'include':_0xf33aea[_0x54f9('0x1a')]?_[_0x54f9('0x1b')](_0xf33aea[_0x54f9('0x1a')],function(_0x407cbb){return{'model':db[_0x407cbb[_0x54f9('0x1c')]],'as':_0x407cbb['as'],'attributes':_0x407cbb[_0x54f9('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5266ed){logger[_0x54f9('0xa')](_0x54f9('0x13'),_0x4217dc);logger['debug'](_0x54f9('0x13'),_0x4217dc,JSON['stringify'](_0x5266ed));_0x1129f2(_0x5266ed);})[_0x54f9('0x12')](function(_0x370f31){logger[_0x54f9('0xf')]('GetDeskAccount',_0x370f31[_0x54f9('0x10')],_0x4217dc);_0x100321(_0x29be77['error'](0x1f4,_0x370f31[_0x54f9('0x10')]));});});};exports['ShowDeskAccount']=function(_0x2793e8){var _0x238949=this;return new Promise(function(_0x5e3df2,_0x515992){return db['DeskAccount'][_0x54f9('0x1d')]({'raw':_0x2793e8[_0x54f9('0x16')]?_0x2793e8[_0x54f9('0x16')][_0x54f9('0x1e')]===undefined?!![]:![]:!![],'where':_0x2793e8[_0x54f9('0x16')]?_0x2793e8['options'][_0x54f9('0x17')]||null:null,'attributes':_0x2793e8[_0x54f9('0x16')]?_0x2793e8[_0x54f9('0x16')][_0x54f9('0x18')]||null:null,'include':_0x2793e8[_0x54f9('0x16')]?_0x2793e8['options'][_0x54f9('0x1a')]?_['map'](_0x2793e8['options']['include'],function(_0x6e5c8){return{'model':db[_0x6e5c8[_0x54f9('0x1c')]],'as':_0x6e5c8['as'],'attributes':_0x6e5c8[_0x54f9('0x18')],'include':_0x6e5c8[_0x54f9('0x1a')]?_['map'](_0x6e5c8['include'],function(_0x2f00ba){return{'model':db[_0x2f00ba[_0x54f9('0x1c')]],'as':_0x2f00ba['as'],'attributes':_0x2f00ba[_0x54f9('0x18')],'include':_0x2f00ba[_0x54f9('0x1a')]?_[_0x54f9('0x1b')](_0x2f00ba[_0x54f9('0x1a')],function(_0x1b4320){return{'model':db[_0x1b4320[_0x54f9('0x1c')]],'as':_0x1b4320['as'],'attributes':_0x1b4320[_0x54f9('0x18')]};}):[]};}):[]};}):[]:[]})[_0x54f9('0x9')](function(_0x2512be){logger[_0x54f9('0xa')](_0x54f9('0x1f'),_0x2793e8);logger[_0x54f9('0x20')](_0x54f9('0x1f'),_0x2793e8,JSON[_0x54f9('0xe')](_0x2512be));_0x5e3df2(_0x2512be);})[_0x54f9('0x12')](function(_0x1b8af7){logger[_0x54f9('0xf')](_0x54f9('0x1f'),_0x1b8af7['message'],_0x2793e8);_0x515992(_0x238949[_0x54f9('0xf')](0x1f4,_0x1b8af7[_0x54f9('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index a56c3e9..77aa213 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(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x55ca,0x126));var _0xa55c=function(_0x2cacef,_0xba1573){_0x2cacef=_0x2cacef-0x0;var _0x289ba6=_0x55ca[_0x2cacef];return _0x289ba6;};'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 _0x7217=['getDescriptions','/:id/tags','post','setTags','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x3fd7ae,_0x4bea20){var _0x29699e=function(_0x2f8c1b){while(--_0x2f8c1b){_0x3fd7ae['push'](_0x3fd7ae['shift']());}};_0x29699e(++_0x4bea20);}(_0x7217,0x19e));var _0x7721=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x7217[_0x12d033];return _0x3b4e80;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getTags']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['put'](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router['delete']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index b28090e..dfc40f2 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 _0x7635=['sequelize'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x7635,0x67));var _0x5763=function(_0x21ad36,_0x5aba39){_0x21ad36=_0x21ad36-0x0;var _0x29eb95=_0x7635[_0x21ad36];return _0x29eb95;};'use strict';var Sequelize=require(_0x5763('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9ac0=['STRING','sequelize','exports'];(function(_0x57c811,_0x32b7b8){var _0x2ec69e=function(_0x258ed2){while(--_0x258ed2){_0x57c811['push'](_0x57c811['shift']());}};_0x2ec69e(++_0x32b7b8);}(_0x9ac0,0xdc));var _0x09ac=function(_0x329fd7,_0x259e3d){_0x329fd7=_0x329fd7-0x0;var _0x498910=_0x9ac0[_0x329fd7];return _0x498910;};'use strict';var Sequelize=require(_0x09ac('0x0'));module[_0x09ac('0x1')]={'name':{'type':Sequelize[_0x09ac('0x2')]},'description':{'type':Sequelize[_0x09ac('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index bc5a119..cebc8ff 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 _0xe257=['show','length','find','catch','create','body','getFields','params','DeskField','getSubjects','pick','merge','getDescriptions','findOne','getTags','Tag','setTags','ids','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filter','options','includeAll','include','DeskConfiguration','rows'];(function(_0x446a9b,_0x48468a){var _0x371972=function(_0x473733){while(--_0x473733){_0x446a9b['push'](_0x446a9b['shift']());}};_0x371972(++_0x48468a);}(_0xe257,0xc2));var _0x7e25=function(_0x20aadb,_0x5a607a){_0x20aadb=_0x20aadb-0x0;var _0x520018=_0xe257[_0x20aadb];return _0x520018;};'use strict';var emlformat=require(_0x7e25('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7e25('0x1'));var rp=require(_0x7e25('0x2'));var moment=require(_0x7e25('0x3'));var BPromise=require(_0x7e25('0x4'));var Mustache=require(_0x7e25('0x5'));var util=require(_0x7e25('0x6'));var path=require(_0x7e25('0x7'));var sox=require(_0x7e25('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e25('0x9'));var _=require(_0x7e25('0xa'));var squel=require(_0x7e25('0xb'));var crypto=require(_0x7e25('0xc'));var jsforce=require(_0x7e25('0xd'));var deskjs=require(_0x7e25('0xe'));var toCsv=require(_0x7e25('0xf'));var querystring=require(_0x7e25('0x10'));var Papa=require(_0x7e25('0x11'));var Redis=require(_0x7e25('0x12'));var authService=require(_0x7e25('0x13'));var qs=require(_0x7e25('0x14'));var as=require(_0x7e25('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e25('0x16'))(_0x7e25('0x17'));var utils=require(_0x7e25('0x18'));var config=require(_0x7e25('0x19'));var licenseUtil=require(_0x7e25('0x1a'));var db=require(_0x7e25('0x1b'))['db'];function respondWithStatusCode(_0x16db58,_0x16c9e8){_0x16c9e8=_0x16c9e8||0xcc;return function(_0x253213){if(_0x253213){return _0x16db58[_0x7e25('0x1c')](_0x16c9e8);}return _0x16db58[_0x7e25('0x1d')](_0x16c9e8)['end']();};}function respondWithResult(_0x1a8c9f,_0x5dedf5){_0x5dedf5=_0x5dedf5||0xc8;return function(_0x105808){if(_0x105808){return _0x1a8c9f[_0x7e25('0x1d')](_0x5dedf5)['json'](_0x105808);}};}function respondWithFilteredResult(_0x558dab,_0x18b957){return function(_0x34d032){if(_0x34d032){var _0x1e11c1=typeof _0x18b957['offset']===_0x7e25('0x1e')&&typeof _0x18b957['limit']==='undefined';var _0x1d48a2=_0x34d032[_0x7e25('0x1f')];var _0x2aa7e4=_0x1e11c1?0x0:_0x18b957[_0x7e25('0x20')];var _0x58dea6=_0x1e11c1?_0x34d032[_0x7e25('0x1f')]:_0x18b957[_0x7e25('0x20')]+_0x18b957['limit'];var _0x15216c;if(_0x58dea6>=_0x1d48a2){_0x58dea6=_0x1d48a2;_0x15216c=0xc8;}else{_0x15216c=0xce;}_0x558dab[_0x7e25('0x1d')](_0x15216c);return _0x558dab[_0x7e25('0x21')](_0x7e25('0x22'),_0x2aa7e4+'-'+_0x58dea6+'/'+_0x1d48a2)[_0x7e25('0x23')](_0x34d032);}return null;};}function patchUpdates(_0x2769cb){return function(_0x339c96){try{jsonpatch[_0x7e25('0x24')](_0x339c96,_0x2769cb,!![]);}catch(_0x429f5d){return BPromise[_0x7e25('0x25')](_0x429f5d);}return _0x339c96[_0x7e25('0x26')]();};}function saveUpdates(_0x2017d0,_0x39e0e0){return function(_0x207dbe){if(_0x207dbe){return _0x207dbe[_0x7e25('0x27')](_0x2017d0)[_0x7e25('0x28')](function(_0x135682){return _0x135682;});}return null;};}function removeEntity(_0x53f496,_0x5da162){return function(_0x2ef5b5){if(_0x2ef5b5){return _0x2ef5b5[_0x7e25('0x29')]()[_0x7e25('0x28')](function(){_0x53f496[_0x7e25('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fe052,_0x5352e){return function(_0x23954a){if(!_0x23954a){_0x2fe052['sendStatus'](0x194);}return _0x23954a;};}function handleError(_0x481371,_0x5bd6bb){_0x5bd6bb=_0x5bd6bb||0x1f4;return function(_0x36d931){logger[_0x7e25('0x2a')](_0x36d931[_0x7e25('0x2b')]);if(_0x36d931[_0x7e25('0x2c')]){delete _0x36d931[_0x7e25('0x2c')];}_0x481371[_0x7e25('0x1d')](_0x5bd6bb)[_0x7e25('0x2d')](_0x36d931);};}exports[_0x7e25('0x2e')]=function(_0x35df8c,_0x29aea2){var _0x184495={},_0x2679a6={},_0x5a555a={'count':0x0,'rows':[]};var _0x5ed7aa=_['map'](db['DeskConfiguration'][_0x7e25('0x2f')],function(_0x1d1d80){return{'name':_0x1d1d80['fieldName'],'type':_0x1d1d80[_0x7e25('0x30')][_0x7e25('0x31')]};});_0x2679a6[_0x7e25('0x32')]=_[_0x7e25('0x33')](_0x5ed7aa,_0x7e25('0x2c'));_0x2679a6['query']=_[_0x7e25('0x34')](_0x35df8c[_0x7e25('0x35')]);_0x2679a6[_0x7e25('0x36')]=_[_0x7e25('0x37')](_0x2679a6[_0x7e25('0x32')],_0x2679a6[_0x7e25('0x35')]);_0x184495['attributes']=_[_0x7e25('0x37')](_0x2679a6[_0x7e25('0x32')],qs[_0x7e25('0x38')](_0x35df8c[_0x7e25('0x35')][_0x7e25('0x38')]));_0x184495[_0x7e25('0x39')]=_0x184495[_0x7e25('0x39')]['length']?_0x184495['attributes']:_0x2679a6[_0x7e25('0x32')];if(!_0x35df8c['query'][_0x7e25('0x3a')](_0x7e25('0x3b'))){_0x184495[_0x7e25('0x3c')]=qs[_0x7e25('0x3c')](_0x35df8c[_0x7e25('0x35')]['limit']);_0x184495[_0x7e25('0x20')]=qs[_0x7e25('0x20')](_0x35df8c[_0x7e25('0x35')][_0x7e25('0x20')]);}_0x184495[_0x7e25('0x3d')]=qs[_0x7e25('0x3e')](_0x35df8c[_0x7e25('0x35')]['sort']);_0x184495[_0x7e25('0x3f')]=qs[_0x7e25('0x36')](_['pick'](_0x35df8c['query'],_0x2679a6[_0x7e25('0x36')]),_0x5ed7aa);if(_0x35df8c[_0x7e25('0x35')][_0x7e25('0x40')]){_0x184495[_0x7e25('0x3f')]=_['merge'](_0x184495[_0x7e25('0x3f')],{'$or':_[_0x7e25('0x33')](_0x5ed7aa,function(_0x4c5184){if(_0x4c5184[_0x7e25('0x30')]!=='VIRTUAL'){var _0x4ea9c0={};_0x4ea9c0[_0x4c5184['name']]={'$like':'%'+_0x35df8c[_0x7e25('0x35')][_0x7e25('0x40')]+'%'};return _0x4ea9c0;}})});}_0x184495=_['merge']({},_0x184495,_0x35df8c[_0x7e25('0x41')]);var _0x256cce={'where':_0x184495['where']};return db['DeskConfiguration'][_0x7e25('0x1f')](_0x256cce)[_0x7e25('0x28')](function(_0x5c02ab){_0x5a555a[_0x7e25('0x1f')]=_0x5c02ab;if(_0x35df8c['query'][_0x7e25('0x42')]){_0x184495[_0x7e25('0x43')]=[{'all':!![]}];}return db[_0x7e25('0x44')]['findAll'](_0x184495);})[_0x7e25('0x28')](function(_0xdaea6){_0x5a555a[_0x7e25('0x45')]=_0xdaea6;return _0x5a555a;})[_0x7e25('0x28')](respondWithFilteredResult(_0x29aea2,_0x184495))['catch'](handleError(_0x29aea2,null));};exports[_0x7e25('0x46')]=function(_0x4b3084,_0x1ec2b0){var _0x2eb684={'raw':![],'where':{'id':_0x4b3084['params']['id']}},_0x396e6b={};_0x396e6b[_0x7e25('0x32')]=_['keys'](db['DeskConfiguration'][_0x7e25('0x2f')]);_0x396e6b[_0x7e25('0x35')]=_[_0x7e25('0x34')](_0x4b3084[_0x7e25('0x35')]);_0x396e6b[_0x7e25('0x36')]=_[_0x7e25('0x37')](_0x396e6b[_0x7e25('0x32')],_0x396e6b[_0x7e25('0x35')]);_0x2eb684[_0x7e25('0x39')]=_[_0x7e25('0x37')](_0x396e6b[_0x7e25('0x32')],qs[_0x7e25('0x38')](_0x4b3084[_0x7e25('0x35')][_0x7e25('0x38')]));_0x2eb684[_0x7e25('0x39')]=_0x2eb684[_0x7e25('0x39')][_0x7e25('0x47')]?_0x2eb684['attributes']:_0x396e6b[_0x7e25('0x32')];if(_0x4b3084[_0x7e25('0x35')][_0x7e25('0x42')]){_0x2eb684['include']=[{'all':!![]}];}_0x2eb684=_['merge']({},_0x2eb684,_0x4b3084[_0x7e25('0x41')]);return db[_0x7e25('0x44')][_0x7e25('0x48')](_0x2eb684)['then'](handleEntityNotFound(_0x1ec2b0,null))[_0x7e25('0x28')](respondWithResult(_0x1ec2b0,null))[_0x7e25('0x49')](handleError(_0x1ec2b0,null));};exports[_0x7e25('0x4a')]=function(_0x230b8f,_0x46a379){return db[_0x7e25('0x44')][_0x7e25('0x4a')](_0x230b8f[_0x7e25('0x4b')],{})[_0x7e25('0x28')](respondWithResult(_0x46a379,0xc9))[_0x7e25('0x49')](handleError(_0x46a379,null));};exports['update']=function(_0x5b04af,_0x4f3d89){if(_0x5b04af[_0x7e25('0x4b')]['id']){delete _0x5b04af[_0x7e25('0x4b')]['id'];}return db[_0x7e25('0x44')][_0x7e25('0x48')]({'where':{'id':_0x5b04af['params']['id']}})[_0x7e25('0x28')](handleEntityNotFound(_0x4f3d89,null))[_0x7e25('0x28')](saveUpdates(_0x5b04af['body'],null))['then'](respondWithResult(_0x4f3d89,null))[_0x7e25('0x49')](handleError(_0x4f3d89,null));};exports['destroy']=function(_0x439b1c,_0x11dfa0){return db['DeskConfiguration'][_0x7e25('0x48')]({'where':{'id':_0x439b1c['params']['id']}})[_0x7e25('0x28')](handleEntityNotFound(_0x11dfa0,null))[_0x7e25('0x28')](removeEntity(_0x11dfa0,null))['catch'](handleError(_0x11dfa0,null));};exports[_0x7e25('0x4c')]=function(_0x536911,_0x3058c1,_0x27e870){var _0x10b8aa={};var _0xdb98bd={};var _0x3f3564;var _0x42df82;return db[_0x7e25('0x44')]['findOne']({'where':{'id':_0x536911[_0x7e25('0x4d')]['id']}})[_0x7e25('0x28')](handleEntityNotFound(_0x3058c1,null))[_0x7e25('0x28')](function(_0xe0a9ed){if(_0xe0a9ed){_0x3f3564=_0xe0a9ed;_0xdb98bd[_0x7e25('0x32')]=_[_0x7e25('0x34')](db[_0x7e25('0x4e')][_0x7e25('0x2f')]);_0xdb98bd[_0x7e25('0x35')]=_[_0x7e25('0x34')](_0x536911['query']);_0xdb98bd[_0x7e25('0x36')]=_[_0x7e25('0x37')](_0xdb98bd[_0x7e25('0x32')],_0xdb98bd['query']);_0x10b8aa[_0x7e25('0x39')]=_['intersection'](_0xdb98bd[_0x7e25('0x32')],qs[_0x7e25('0x38')](_0x536911['query'][_0x7e25('0x38')]));_0x10b8aa[_0x7e25('0x39')]=_0x10b8aa[_0x7e25('0x39')][_0x7e25('0x47')]?_0x10b8aa[_0x7e25('0x39')]:_0xdb98bd['model'];_0x10b8aa[_0x7e25('0x3d')]=qs[_0x7e25('0x3e')](_0x536911[_0x7e25('0x35')][_0x7e25('0x3e')]);_0x10b8aa[_0x7e25('0x3f')]=qs[_0x7e25('0x36')](_['pick'](_0x536911[_0x7e25('0x35')],_0xdb98bd['filters']));if(_0x536911[_0x7e25('0x35')][_0x7e25('0x40')]){_0x10b8aa[_0x7e25('0x3f')]=_['merge'](_0x10b8aa[_0x7e25('0x3f')],{'$or':_[_0x7e25('0x33')](_0x10b8aa['attributes'],function(_0x90d91e){var _0xf7dd88={};_0xf7dd88[_0x90d91e]={'$like':'%'+_0x536911[_0x7e25('0x35')]['filter']+'%'};return _0xf7dd88;})});}_0x10b8aa=_['merge']({},_0x10b8aa,_0x536911[_0x7e25('0x41')]);return _0x3f3564[_0x7e25('0x4c')](_0x10b8aa);}})['then'](function(_0x5a47a8){if(_0x5a47a8){_0x42df82=_0x5a47a8[_0x7e25('0x47')];if(!_0x536911[_0x7e25('0x35')][_0x7e25('0x3a')](_0x7e25('0x3b'))){_0x10b8aa[_0x7e25('0x3c')]=qs[_0x7e25('0x3c')](_0x536911[_0x7e25('0x35')][_0x7e25('0x3c')]);_0x10b8aa['offset']=qs[_0x7e25('0x20')](_0x536911[_0x7e25('0x35')][_0x7e25('0x20')]);}return _0x3f3564[_0x7e25('0x4c')](_0x10b8aa);}})[_0x7e25('0x28')](function(_0x377b01){if(_0x377b01){return _0x377b01?{'count':_0x42df82,'rows':_0x377b01}:null;}})[_0x7e25('0x28')](respondWithResult(_0x3058c1,null))['catch'](handleError(_0x3058c1,null));};exports[_0x7e25('0x4f')]=function(_0x388000,_0x28ed78,_0x46896e){var _0x2709c2={};var _0x1dd450={};var _0x454109;var _0x98c32a;return db['DeskConfiguration']['findOne']({'where':{'id':_0x388000['params']['id']}})[_0x7e25('0x28')](handleEntityNotFound(_0x28ed78,null))[_0x7e25('0x28')](function(_0x237c8b){if(_0x237c8b){_0x454109=_0x237c8b;_0x1dd450['model']=_[_0x7e25('0x34')](db[_0x7e25('0x4e')][_0x7e25('0x2f')]);_0x1dd450['query']=_['keys'](_0x388000['query']);_0x1dd450['filters']=_['intersection'](_0x1dd450[_0x7e25('0x32')],_0x1dd450[_0x7e25('0x35')]);_0x2709c2['attributes']=_[_0x7e25('0x37')](_0x1dd450['model'],qs[_0x7e25('0x38')](_0x388000['query'][_0x7e25('0x38')]));_0x2709c2[_0x7e25('0x39')]=_0x2709c2['attributes'][_0x7e25('0x47')]?_0x2709c2[_0x7e25('0x39')]:_0x1dd450[_0x7e25('0x32')];_0x2709c2['order']=qs[_0x7e25('0x3e')](_0x388000[_0x7e25('0x35')][_0x7e25('0x3e')]);_0x2709c2['where']=qs[_0x7e25('0x36')](_[_0x7e25('0x50')](_0x388000[_0x7e25('0x35')],_0x1dd450[_0x7e25('0x36')]));if(_0x388000[_0x7e25('0x35')][_0x7e25('0x40')]){_0x2709c2[_0x7e25('0x3f')]=_[_0x7e25('0x51')](_0x2709c2[_0x7e25('0x3f')],{'$or':_[_0x7e25('0x33')](_0x2709c2['attributes'],function(_0xf35569){var _0x363cf3={};_0x363cf3[_0xf35569]={'$like':'%'+_0x388000[_0x7e25('0x35')][_0x7e25('0x40')]+'%'};return _0x363cf3;})});}_0x2709c2=_['merge']({},_0x2709c2,_0x388000[_0x7e25('0x41')]);return _0x454109['getSubjects'](_0x2709c2);}})[_0x7e25('0x28')](function(_0x50e9ea){if(_0x50e9ea){_0x98c32a=_0x50e9ea[_0x7e25('0x47')];if(!_0x388000[_0x7e25('0x35')][_0x7e25('0x3a')](_0x7e25('0x3b'))){_0x2709c2[_0x7e25('0x3c')]=qs['limit'](_0x388000['query'][_0x7e25('0x3c')]);_0x2709c2[_0x7e25('0x20')]=qs['offset'](_0x388000[_0x7e25('0x35')]['offset']);}return _0x454109[_0x7e25('0x4f')](_0x2709c2);}})[_0x7e25('0x28')](function(_0x33ffc4){if(_0x33ffc4){return _0x33ffc4?{'count':_0x98c32a,'rows':_0x33ffc4}:null;}})[_0x7e25('0x28')](respondWithResult(_0x28ed78,null))[_0x7e25('0x49')](handleError(_0x28ed78,null));};exports[_0x7e25('0x52')]=function(_0x2b008e,_0x2dbc6c,_0x49bbd9){var _0x36c2d3={};var _0x2f4f78={};var _0x5bbeb6;var _0x3171ba;return db[_0x7e25('0x44')][_0x7e25('0x53')]({'where':{'id':_0x2b008e[_0x7e25('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2dbc6c,null))[_0x7e25('0x28')](function(_0x804597){if(_0x804597){_0x5bbeb6=_0x804597;_0x2f4f78[_0x7e25('0x32')]=_[_0x7e25('0x34')](db[_0x7e25('0x4e')][_0x7e25('0x2f')]);_0x2f4f78['query']=_[_0x7e25('0x34')](_0x2b008e[_0x7e25('0x35')]);_0x2f4f78['filters']=_['intersection'](_0x2f4f78[_0x7e25('0x32')],_0x2f4f78[_0x7e25('0x35')]);_0x36c2d3[_0x7e25('0x39')]=_[_0x7e25('0x37')](_0x2f4f78[_0x7e25('0x32')],qs[_0x7e25('0x38')](_0x2b008e['query']['fields']));_0x36c2d3[_0x7e25('0x39')]=_0x36c2d3['attributes'][_0x7e25('0x47')]?_0x36c2d3[_0x7e25('0x39')]:_0x2f4f78['model'];_0x36c2d3[_0x7e25('0x3d')]=qs[_0x7e25('0x3e')](_0x2b008e['query'][_0x7e25('0x3e')]);_0x36c2d3[_0x7e25('0x3f')]=qs['filters'](_['pick'](_0x2b008e[_0x7e25('0x35')],_0x2f4f78['filters']));if(_0x2b008e[_0x7e25('0x35')][_0x7e25('0x40')]){_0x36c2d3[_0x7e25('0x3f')]=_[_0x7e25('0x51')](_0x36c2d3['where'],{'$or':_['map'](_0x36c2d3['attributes'],function(_0x5e4751){var _0x308e45={};_0x308e45[_0x5e4751]={'$like':'%'+_0x2b008e['query'][_0x7e25('0x40')]+'%'};return _0x308e45;})});}_0x36c2d3=_[_0x7e25('0x51')]({},_0x36c2d3,_0x2b008e[_0x7e25('0x41')]);return _0x5bbeb6['getDescriptions'](_0x36c2d3);}})[_0x7e25('0x28')](function(_0x5918be){if(_0x5918be){_0x3171ba=_0x5918be[_0x7e25('0x47')];if(!_0x2b008e['query']['hasOwnProperty'](_0x7e25('0x3b'))){_0x36c2d3[_0x7e25('0x3c')]=qs[_0x7e25('0x3c')](_0x2b008e[_0x7e25('0x35')][_0x7e25('0x3c')]);_0x36c2d3[_0x7e25('0x20')]=qs[_0x7e25('0x20')](_0x2b008e[_0x7e25('0x35')][_0x7e25('0x20')]);}return _0x5bbeb6[_0x7e25('0x52')](_0x36c2d3);}})[_0x7e25('0x28')](function(_0x4240ee){if(_0x4240ee){return _0x4240ee?{'count':_0x3171ba,'rows':_0x4240ee}:null;}})[_0x7e25('0x28')](respondWithResult(_0x2dbc6c,null))[_0x7e25('0x49')](handleError(_0x2dbc6c,null));};exports[_0x7e25('0x54')]=function(_0x35c821,_0x3312bb,_0x128a16){var _0x493e74={};var _0x203356={};var _0x6c063b;var _0x3adf2e;return db[_0x7e25('0x44')][_0x7e25('0x53')]({'where':{'id':_0x35c821[_0x7e25('0x4d')]['id']}})[_0x7e25('0x28')](handleEntityNotFound(_0x3312bb,null))[_0x7e25('0x28')](function(_0x1ff0c9){if(_0x1ff0c9){_0x6c063b=_0x1ff0c9;_0x203356[_0x7e25('0x32')]=_[_0x7e25('0x34')](db[_0x7e25('0x55')][_0x7e25('0x2f')]);_0x203356[_0x7e25('0x35')]=_[_0x7e25('0x34')](_0x35c821[_0x7e25('0x35')]);_0x203356[_0x7e25('0x36')]=_['intersection'](_0x203356['model'],_0x203356[_0x7e25('0x35')]);_0x493e74[_0x7e25('0x39')]=_['intersection'](_0x203356[_0x7e25('0x32')],qs[_0x7e25('0x38')](_0x35c821['query'][_0x7e25('0x38')]));_0x493e74[_0x7e25('0x39')]=_0x493e74[_0x7e25('0x39')][_0x7e25('0x47')]?_0x493e74[_0x7e25('0x39')]:_0x203356[_0x7e25('0x32')];_0x493e74['order']=qs[_0x7e25('0x3e')](_0x35c821['query'][_0x7e25('0x3e')]);_0x493e74[_0x7e25('0x3f')]=qs[_0x7e25('0x36')](_[_0x7e25('0x50')](_0x35c821[_0x7e25('0x35')],_0x203356[_0x7e25('0x36')]));if(_0x35c821[_0x7e25('0x35')][_0x7e25('0x40')]){_0x493e74[_0x7e25('0x3f')]=_['merge'](_0x493e74[_0x7e25('0x3f')],{'$or':_[_0x7e25('0x33')](_0x493e74[_0x7e25('0x39')],function(_0x165aca){var _0x55d867={};_0x55d867[_0x165aca]={'$like':'%'+_0x35c821[_0x7e25('0x35')][_0x7e25('0x40')]+'%'};return _0x55d867;})});}_0x493e74=_['merge']({},_0x493e74,_0x35c821[_0x7e25('0x41')]);return _0x6c063b[_0x7e25('0x54')](_0x493e74);}})[_0x7e25('0x28')](function(_0x410e0c){if(_0x410e0c){_0x3adf2e=_0x410e0c[_0x7e25('0x47')];if(!_0x35c821[_0x7e25('0x35')][_0x7e25('0x3a')](_0x7e25('0x3b'))){_0x493e74['limit']=qs[_0x7e25('0x3c')](_0x35c821[_0x7e25('0x35')][_0x7e25('0x3c')]);_0x493e74[_0x7e25('0x20')]=qs[_0x7e25('0x20')](_0x35c821[_0x7e25('0x35')][_0x7e25('0x20')]);}return _0x6c063b[_0x7e25('0x54')](_0x493e74);}})['then'](function(_0xbebe8){if(_0xbebe8){return _0xbebe8?{'count':_0x3adf2e,'rows':_0xbebe8}:null;}})[_0x7e25('0x28')](respondWithResult(_0x3312bb,null))[_0x7e25('0x49')](handleError(_0x3312bb,null));};exports[_0x7e25('0x56')]=function(_0x415c2b,_0xf30eda,_0x40b958){if(_0x415c2b[_0x7e25('0x4b')]['id']){delete _0x415c2b[_0x7e25('0x4b')]['id'];}return db['DeskConfiguration'][_0x7e25('0x53')]({'where':{'id':_0x415c2b[_0x7e25('0x4d')]['id']}})[_0x7e25('0x28')](handleEntityNotFound(_0xf30eda,null))[_0x7e25('0x28')](function(_0xff3aac){if(_0xff3aac){return _0xff3aac[_0x7e25('0x56')](_0x415c2b['body'][_0x7e25('0x57')]||[]);}return null;})[_0x7e25('0x28')](respondWithResult(_0xf30eda,null))['catch'](handleError(_0xf30eda,null));}; \ No newline at end of file +var _0xaa01=['count','limit','set','apply','reject','save','then','destroy','end','error','stack','name','send','DeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','rows','catch','show','params','length','find','create','body','update','getFields','DeskField','findOne','getSubjects','getDescriptions','Tag','getTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xaa01,0x1cf));var _0x1aa0=function(_0x5895b8,_0x5bd8a1){_0x5895b8=_0x5895b8-0x0;var _0x521d54=_0xaa01[_0x5895b8];return _0x521d54;};'use strict';var emlformat=require(_0x1aa0('0x0'));var rimraf=require(_0x1aa0('0x1'));var zipdir=require(_0x1aa0('0x2'));var jsonpatch=require(_0x1aa0('0x3'));var rp=require(_0x1aa0('0x4'));var moment=require(_0x1aa0('0x5'));var BPromise=require(_0x1aa0('0x6'));var Mustache=require(_0x1aa0('0x7'));var util=require('util');var path=require(_0x1aa0('0x8'));var sox=require(_0x1aa0('0x9'));var csv=require('to-csv');var ejs=require(_0x1aa0('0xa'));var fs=require('fs');var fs_extra=require(_0x1aa0('0xb'));var _=require(_0x1aa0('0xc'));var squel=require(_0x1aa0('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1aa0('0xe'));var toCsv=require(_0x1aa0('0xf'));var querystring=require(_0x1aa0('0x10'));var Papa=require(_0x1aa0('0x11'));var Redis=require(_0x1aa0('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1aa0('0x13'));var hardwareService=require(_0x1aa0('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x1aa0('0x15'));var licenseUtil=require(_0x1aa0('0x16'));var db=require(_0x1aa0('0x17'))['db'];function respondWithStatusCode(_0x3711ca,_0x804f7a){_0x804f7a=_0x804f7a||0xcc;return function(_0x124374){if(_0x124374){return _0x3711ca[_0x1aa0('0x18')](_0x804f7a);}return _0x3711ca[_0x1aa0('0x19')](_0x804f7a)['end']();};}function respondWithResult(_0x33ee8d,_0x247f5f){_0x247f5f=_0x247f5f||0xc8;return function(_0x35843f){if(_0x35843f){return _0x33ee8d[_0x1aa0('0x19')](_0x247f5f)[_0x1aa0('0x1a')](_0x35843f);}};}function respondWithFilteredResult(_0x4203bc,_0x40f45e){return function(_0x79bdcc){if(_0x79bdcc){var _0x3a2570=typeof _0x40f45e[_0x1aa0('0x1b')]===_0x1aa0('0x1c')&&typeof _0x40f45e['limit']==='undefined';var _0x80b627=_0x79bdcc[_0x1aa0('0x1d')];var _0x14d411=_0x3a2570?0x0:_0x40f45e[_0x1aa0('0x1b')];var _0x4253e7=_0x3a2570?_0x79bdcc[_0x1aa0('0x1d')]:_0x40f45e[_0x1aa0('0x1b')]+_0x40f45e[_0x1aa0('0x1e')];var _0x349592;if(_0x4253e7>=_0x80b627){_0x4253e7=_0x80b627;_0x349592=0xc8;}else{_0x349592=0xce;}_0x4203bc[_0x1aa0('0x19')](_0x349592);return _0x4203bc[_0x1aa0('0x1f')]('Content-Range',_0x14d411+'-'+_0x4253e7+'/'+_0x80b627)[_0x1aa0('0x1a')](_0x79bdcc);}return null;};}function patchUpdates(_0x2fe378){return function(_0x58394f){try{jsonpatch[_0x1aa0('0x20')](_0x58394f,_0x2fe378,!![]);}catch(_0xa13ebb){return BPromise[_0x1aa0('0x21')](_0xa13ebb);}return _0x58394f[_0x1aa0('0x22')]();};}function saveUpdates(_0x509746,_0xadf191){return function(_0x2dbfe7){if(_0x2dbfe7){return _0x2dbfe7['update'](_0x509746)[_0x1aa0('0x23')](function(_0x5a3047){return _0x5a3047;});}return null;};}function removeEntity(_0x38ff98,_0x5a7888){return function(_0x5a8959){if(_0x5a8959){return _0x5a8959[_0x1aa0('0x24')]()[_0x1aa0('0x23')](function(){_0x38ff98[_0x1aa0('0x19')](0xcc)[_0x1aa0('0x25')]();});}};}function handleEntityNotFound(_0x33c234,_0x5d74ee){return function(_0x27387e){if(!_0x27387e){_0x33c234['sendStatus'](0x194);}return _0x27387e;};}function handleError(_0x1f3a05,_0x421d0e){_0x421d0e=_0x421d0e||0x1f4;return function(_0x346669){logger[_0x1aa0('0x26')](_0x346669[_0x1aa0('0x27')]);if(_0x346669['name']){delete _0x346669[_0x1aa0('0x28')];}_0x1f3a05['status'](_0x421d0e)[_0x1aa0('0x29')](_0x346669);};}exports['index']=function(_0xbda941,_0x51cc52){var _0xbda00a={},_0x417c49={},_0x22f541={'count':0x0,'rows':[]};var _0x3fecbb=_['map'](db[_0x1aa0('0x2a')][_0x1aa0('0x2b')],function(_0x46eb8c){return{'name':_0x46eb8c[_0x1aa0('0x2c')],'type':_0x46eb8c[_0x1aa0('0x2d')]['key']};});_0x417c49[_0x1aa0('0x2e')]=_['map'](_0x3fecbb,'name');_0x417c49[_0x1aa0('0x2f')]=_[_0x1aa0('0x30')](_0xbda941['query']);_0x417c49[_0x1aa0('0x31')]=_[_0x1aa0('0x32')](_0x417c49[_0x1aa0('0x2e')],_0x417c49[_0x1aa0('0x2f')]);_0xbda00a['attributes']=_[_0x1aa0('0x32')](_0x417c49[_0x1aa0('0x2e')],qs[_0x1aa0('0x33')](_0xbda941['query'][_0x1aa0('0x33')]));_0xbda00a['attributes']=_0xbda00a[_0x1aa0('0x34')]['length']?_0xbda00a['attributes']:_0x417c49['model'];if(!_0xbda941[_0x1aa0('0x2f')][_0x1aa0('0x35')](_0x1aa0('0x36'))){_0xbda00a[_0x1aa0('0x1e')]=qs[_0x1aa0('0x1e')](_0xbda941[_0x1aa0('0x2f')][_0x1aa0('0x1e')]);_0xbda00a[_0x1aa0('0x1b')]=qs[_0x1aa0('0x1b')](_0xbda941[_0x1aa0('0x2f')]['offset']);}_0xbda00a[_0x1aa0('0x37')]=qs[_0x1aa0('0x38')](_0xbda941[_0x1aa0('0x2f')][_0x1aa0('0x38')]);_0xbda00a[_0x1aa0('0x39')]=qs[_0x1aa0('0x31')](_[_0x1aa0('0x3a')](_0xbda941[_0x1aa0('0x2f')],_0x417c49['filters']),_0x3fecbb);if(_0xbda941[_0x1aa0('0x2f')][_0x1aa0('0x3b')]){_0xbda00a['where']=_[_0x1aa0('0x3c')](_0xbda00a[_0x1aa0('0x39')],{'$or':_[_0x1aa0('0x3d')](_0x3fecbb,function(_0x417f64){if(_0x417f64[_0x1aa0('0x2d')]!==_0x1aa0('0x3e')){var _0x505840={};_0x505840[_0x417f64[_0x1aa0('0x28')]]={'$like':'%'+_0xbda941[_0x1aa0('0x2f')][_0x1aa0('0x3b')]+'%'};return _0x505840;}})});}_0xbda00a=_[_0x1aa0('0x3c')]({},_0xbda00a,_0xbda941[_0x1aa0('0x3f')]);var _0x2d41cf={'where':_0xbda00a['where']};return db['DeskConfiguration'][_0x1aa0('0x1d')](_0x2d41cf)[_0x1aa0('0x23')](function(_0x47f031){_0x22f541[_0x1aa0('0x1d')]=_0x47f031;if(_0xbda941[_0x1aa0('0x2f')]['includeAll']){_0xbda00a[_0x1aa0('0x40')]=[{'all':!![]}];}return db[_0x1aa0('0x2a')]['findAll'](_0xbda00a);})[_0x1aa0('0x23')](function(_0x28c24d){_0x22f541[_0x1aa0('0x41')]=_0x28c24d;return _0x22f541;})[_0x1aa0('0x23')](respondWithFilteredResult(_0x51cc52,_0xbda00a))[_0x1aa0('0x42')](handleError(_0x51cc52,null));};exports[_0x1aa0('0x43')]=function(_0x44247b,_0x3255fe){var _0x276ce5={'raw':![],'where':{'id':_0x44247b[_0x1aa0('0x44')]['id']}},_0x1ce883={};_0x1ce883[_0x1aa0('0x2e')]=_[_0x1aa0('0x30')](db[_0x1aa0('0x2a')][_0x1aa0('0x2b')]);_0x1ce883[_0x1aa0('0x2f')]=_[_0x1aa0('0x30')](_0x44247b[_0x1aa0('0x2f')]);_0x1ce883[_0x1aa0('0x31')]=_[_0x1aa0('0x32')](_0x1ce883[_0x1aa0('0x2e')],_0x1ce883[_0x1aa0('0x2f')]);_0x276ce5['attributes']=_[_0x1aa0('0x32')](_0x1ce883[_0x1aa0('0x2e')],qs[_0x1aa0('0x33')](_0x44247b[_0x1aa0('0x2f')][_0x1aa0('0x33')]));_0x276ce5[_0x1aa0('0x34')]=_0x276ce5[_0x1aa0('0x34')][_0x1aa0('0x45')]?_0x276ce5[_0x1aa0('0x34')]:_0x1ce883[_0x1aa0('0x2e')];if(_0x44247b[_0x1aa0('0x2f')]['includeAll']){_0x276ce5[_0x1aa0('0x40')]=[{'all':!![]}];}_0x276ce5=_['merge']({},_0x276ce5,_0x44247b[_0x1aa0('0x3f')]);return db['DeskConfiguration'][_0x1aa0('0x46')](_0x276ce5)[_0x1aa0('0x23')](handleEntityNotFound(_0x3255fe,null))[_0x1aa0('0x23')](respondWithResult(_0x3255fe,null))[_0x1aa0('0x42')](handleError(_0x3255fe,null));};exports[_0x1aa0('0x47')]=function(_0x5efb82,_0x4208e6){return db['DeskConfiguration'][_0x1aa0('0x47')](_0x5efb82[_0x1aa0('0x48')],{})['then'](respondWithResult(_0x4208e6,0xc9))[_0x1aa0('0x42')](handleError(_0x4208e6,null));};exports[_0x1aa0('0x49')]=function(_0x4bda29,_0x2165bd){if(_0x4bda29[_0x1aa0('0x48')]['id']){delete _0x4bda29[_0x1aa0('0x48')]['id'];}return db[_0x1aa0('0x2a')][_0x1aa0('0x46')]({'where':{'id':_0x4bda29[_0x1aa0('0x44')]['id']}})[_0x1aa0('0x23')](handleEntityNotFound(_0x2165bd,null))[_0x1aa0('0x23')](saveUpdates(_0x4bda29[_0x1aa0('0x48')],null))[_0x1aa0('0x23')](respondWithResult(_0x2165bd,null))['catch'](handleError(_0x2165bd,null));};exports[_0x1aa0('0x24')]=function(_0x536a79,_0x458130){return db[_0x1aa0('0x2a')]['find']({'where':{'id':_0x536a79[_0x1aa0('0x44')]['id']}})['then'](handleEntityNotFound(_0x458130,null))[_0x1aa0('0x23')](removeEntity(_0x458130,null))['catch'](handleError(_0x458130,null));};exports[_0x1aa0('0x4a')]=function(_0x23ad1f,_0x1f07a3,_0x12e294){var _0x74cd98={};var _0x47a364={};var _0x179417;var _0x55b97e;return db[_0x1aa0('0x2a')]['findOne']({'where':{'id':_0x23ad1f['params']['id']}})['then'](handleEntityNotFound(_0x1f07a3,null))[_0x1aa0('0x23')](function(_0x5be7ca){if(_0x5be7ca){_0x179417=_0x5be7ca;_0x47a364[_0x1aa0('0x2e')]=_[_0x1aa0('0x30')](db[_0x1aa0('0x4b')]['rawAttributes']);_0x47a364[_0x1aa0('0x2f')]=_[_0x1aa0('0x30')](_0x23ad1f[_0x1aa0('0x2f')]);_0x47a364['filters']=_[_0x1aa0('0x32')](_0x47a364[_0x1aa0('0x2e')],_0x47a364[_0x1aa0('0x2f')]);_0x74cd98[_0x1aa0('0x34')]=_[_0x1aa0('0x32')](_0x47a364['model'],qs[_0x1aa0('0x33')](_0x23ad1f[_0x1aa0('0x2f')][_0x1aa0('0x33')]));_0x74cd98[_0x1aa0('0x34')]=_0x74cd98[_0x1aa0('0x34')][_0x1aa0('0x45')]?_0x74cd98[_0x1aa0('0x34')]:_0x47a364[_0x1aa0('0x2e')];_0x74cd98[_0x1aa0('0x37')]=qs[_0x1aa0('0x38')](_0x23ad1f[_0x1aa0('0x2f')][_0x1aa0('0x38')]);_0x74cd98[_0x1aa0('0x39')]=qs[_0x1aa0('0x31')](_[_0x1aa0('0x3a')](_0x23ad1f[_0x1aa0('0x2f')],_0x47a364[_0x1aa0('0x31')]));if(_0x23ad1f[_0x1aa0('0x2f')][_0x1aa0('0x3b')]){_0x74cd98[_0x1aa0('0x39')]=_[_0x1aa0('0x3c')](_0x74cd98[_0x1aa0('0x39')],{'$or':_[_0x1aa0('0x3d')](_0x74cd98['attributes'],function(_0x31ffd2){var _0x11d31a={};_0x11d31a[_0x31ffd2]={'$like':'%'+_0x23ad1f[_0x1aa0('0x2f')][_0x1aa0('0x3b')]+'%'};return _0x11d31a;})});}_0x74cd98=_[_0x1aa0('0x3c')]({},_0x74cd98,_0x23ad1f['options']);return _0x179417[_0x1aa0('0x4a')](_0x74cd98);}})[_0x1aa0('0x23')](function(_0x3655bf){if(_0x3655bf){_0x55b97e=_0x3655bf[_0x1aa0('0x45')];if(!_0x23ad1f[_0x1aa0('0x2f')][_0x1aa0('0x35')](_0x1aa0('0x36'))){_0x74cd98[_0x1aa0('0x1e')]=qs[_0x1aa0('0x1e')](_0x23ad1f[_0x1aa0('0x2f')][_0x1aa0('0x1e')]);_0x74cd98['offset']=qs[_0x1aa0('0x1b')](_0x23ad1f['query'][_0x1aa0('0x1b')]);}return _0x179417[_0x1aa0('0x4a')](_0x74cd98);}})[_0x1aa0('0x23')](function(_0x272a92){if(_0x272a92){return _0x272a92?{'count':_0x55b97e,'rows':_0x272a92}:null;}})[_0x1aa0('0x23')](respondWithResult(_0x1f07a3,null))['catch'](handleError(_0x1f07a3,null));};exports['getSubjects']=function(_0x226052,_0x3fd6e3,_0x52dd0c){var _0x1fd3e0={};var _0x1ec789={};var _0x170a43;var _0x54e3c6;return db[_0x1aa0('0x2a')][_0x1aa0('0x4c')]({'where':{'id':_0x226052['params']['id']}})['then'](handleEntityNotFound(_0x3fd6e3,null))['then'](function(_0x27dc1b){if(_0x27dc1b){_0x170a43=_0x27dc1b;_0x1ec789[_0x1aa0('0x2e')]=_[_0x1aa0('0x30')](db['DeskField'][_0x1aa0('0x2b')]);_0x1ec789['query']=_[_0x1aa0('0x30')](_0x226052[_0x1aa0('0x2f')]);_0x1ec789[_0x1aa0('0x31')]=_['intersection'](_0x1ec789[_0x1aa0('0x2e')],_0x1ec789['query']);_0x1fd3e0['attributes']=_[_0x1aa0('0x32')](_0x1ec789['model'],qs[_0x1aa0('0x33')](_0x226052[_0x1aa0('0x2f')][_0x1aa0('0x33')]));_0x1fd3e0[_0x1aa0('0x34')]=_0x1fd3e0[_0x1aa0('0x34')]['length']?_0x1fd3e0['attributes']:_0x1ec789[_0x1aa0('0x2e')];_0x1fd3e0['order']=qs[_0x1aa0('0x38')](_0x226052[_0x1aa0('0x2f')][_0x1aa0('0x38')]);_0x1fd3e0[_0x1aa0('0x39')]=qs[_0x1aa0('0x31')](_[_0x1aa0('0x3a')](_0x226052['query'],_0x1ec789[_0x1aa0('0x31')]));if(_0x226052[_0x1aa0('0x2f')][_0x1aa0('0x3b')]){_0x1fd3e0[_0x1aa0('0x39')]=_[_0x1aa0('0x3c')](_0x1fd3e0['where'],{'$or':_[_0x1aa0('0x3d')](_0x1fd3e0['attributes'],function(_0xba9e88){var _0x16a838={};_0x16a838[_0xba9e88]={'$like':'%'+_0x226052[_0x1aa0('0x2f')][_0x1aa0('0x3b')]+'%'};return _0x16a838;})});}_0x1fd3e0=_[_0x1aa0('0x3c')]({},_0x1fd3e0,_0x226052[_0x1aa0('0x3f')]);return _0x170a43['getSubjects'](_0x1fd3e0);}})['then'](function(_0x2fa91a){if(_0x2fa91a){_0x54e3c6=_0x2fa91a[_0x1aa0('0x45')];if(!_0x226052[_0x1aa0('0x2f')][_0x1aa0('0x35')](_0x1aa0('0x36'))){_0x1fd3e0[_0x1aa0('0x1e')]=qs[_0x1aa0('0x1e')](_0x226052[_0x1aa0('0x2f')][_0x1aa0('0x1e')]);_0x1fd3e0['offset']=qs['offset'](_0x226052[_0x1aa0('0x2f')][_0x1aa0('0x1b')]);}return _0x170a43[_0x1aa0('0x4d')](_0x1fd3e0);}})['then'](function(_0x3b4871){if(_0x3b4871){return _0x3b4871?{'count':_0x54e3c6,'rows':_0x3b4871}:null;}})[_0x1aa0('0x23')](respondWithResult(_0x3fd6e3,null))['catch'](handleError(_0x3fd6e3,null));};exports[_0x1aa0('0x4e')]=function(_0x22db8c,_0x2143fd,_0x37bae){var _0x1f4132={};var _0x2e444a={};var _0x3587a8;var _0x3184a2;return db[_0x1aa0('0x2a')]['findOne']({'where':{'id':_0x22db8c[_0x1aa0('0x44')]['id']}})[_0x1aa0('0x23')](handleEntityNotFound(_0x2143fd,null))[_0x1aa0('0x23')](function(_0x5662d2){if(_0x5662d2){_0x3587a8=_0x5662d2;_0x2e444a[_0x1aa0('0x2e')]=_[_0x1aa0('0x30')](db[_0x1aa0('0x4b')][_0x1aa0('0x2b')]);_0x2e444a[_0x1aa0('0x2f')]=_[_0x1aa0('0x30')](_0x22db8c[_0x1aa0('0x2f')]);_0x2e444a[_0x1aa0('0x31')]=_[_0x1aa0('0x32')](_0x2e444a[_0x1aa0('0x2e')],_0x2e444a[_0x1aa0('0x2f')]);_0x1f4132[_0x1aa0('0x34')]=_['intersection'](_0x2e444a['model'],qs[_0x1aa0('0x33')](_0x22db8c['query']['fields']));_0x1f4132['attributes']=_0x1f4132[_0x1aa0('0x34')][_0x1aa0('0x45')]?_0x1f4132[_0x1aa0('0x34')]:_0x2e444a[_0x1aa0('0x2e')];_0x1f4132[_0x1aa0('0x37')]=qs['sort'](_0x22db8c[_0x1aa0('0x2f')]['sort']);_0x1f4132[_0x1aa0('0x39')]=qs[_0x1aa0('0x31')](_[_0x1aa0('0x3a')](_0x22db8c['query'],_0x2e444a['filters']));if(_0x22db8c['query'][_0x1aa0('0x3b')]){_0x1f4132[_0x1aa0('0x39')]=_[_0x1aa0('0x3c')](_0x1f4132[_0x1aa0('0x39')],{'$or':_[_0x1aa0('0x3d')](_0x1f4132[_0x1aa0('0x34')],function(_0x305cf5){var _0x5ab7a5={};_0x5ab7a5[_0x305cf5]={'$like':'%'+_0x22db8c[_0x1aa0('0x2f')][_0x1aa0('0x3b')]+'%'};return _0x5ab7a5;})});}_0x1f4132=_[_0x1aa0('0x3c')]({},_0x1f4132,_0x22db8c[_0x1aa0('0x3f')]);return _0x3587a8['getDescriptions'](_0x1f4132);}})['then'](function(_0x21c382){if(_0x21c382){_0x3184a2=_0x21c382[_0x1aa0('0x45')];if(!_0x22db8c['query']['hasOwnProperty'](_0x1aa0('0x36'))){_0x1f4132['limit']=qs[_0x1aa0('0x1e')](_0x22db8c['query'][_0x1aa0('0x1e')]);_0x1f4132[_0x1aa0('0x1b')]=qs['offset'](_0x22db8c[_0x1aa0('0x2f')][_0x1aa0('0x1b')]);}return _0x3587a8[_0x1aa0('0x4e')](_0x1f4132);}})[_0x1aa0('0x23')](function(_0x60f6be){if(_0x60f6be){return _0x60f6be?{'count':_0x3184a2,'rows':_0x60f6be}:null;}})[_0x1aa0('0x23')](respondWithResult(_0x2143fd,null))[_0x1aa0('0x42')](handleError(_0x2143fd,null));};exports['getTags']=function(_0x34e11d,_0x17552f,_0x5d6f7){var _0x169697={};var _0x121c37={};var _0x2a507d;var _0x4d8654;return db[_0x1aa0('0x2a')][_0x1aa0('0x4c')]({'where':{'id':_0x34e11d[_0x1aa0('0x44')]['id']}})[_0x1aa0('0x23')](handleEntityNotFound(_0x17552f,null))['then'](function(_0x6852a9){if(_0x6852a9){_0x2a507d=_0x6852a9;_0x121c37['model']=_[_0x1aa0('0x30')](db[_0x1aa0('0x4f')][_0x1aa0('0x2b')]);_0x121c37[_0x1aa0('0x2f')]=_[_0x1aa0('0x30')](_0x34e11d[_0x1aa0('0x2f')]);_0x121c37[_0x1aa0('0x31')]=_['intersection'](_0x121c37[_0x1aa0('0x2e')],_0x121c37[_0x1aa0('0x2f')]);_0x169697[_0x1aa0('0x34')]=_[_0x1aa0('0x32')](_0x121c37[_0x1aa0('0x2e')],qs[_0x1aa0('0x33')](_0x34e11d['query'][_0x1aa0('0x33')]));_0x169697[_0x1aa0('0x34')]=_0x169697[_0x1aa0('0x34')][_0x1aa0('0x45')]?_0x169697[_0x1aa0('0x34')]:_0x121c37[_0x1aa0('0x2e')];_0x169697[_0x1aa0('0x37')]=qs[_0x1aa0('0x38')](_0x34e11d[_0x1aa0('0x2f')][_0x1aa0('0x38')]);_0x169697['where']=qs['filters'](_[_0x1aa0('0x3a')](_0x34e11d['query'],_0x121c37[_0x1aa0('0x31')]));if(_0x34e11d[_0x1aa0('0x2f')][_0x1aa0('0x3b')]){_0x169697[_0x1aa0('0x39')]=_[_0x1aa0('0x3c')](_0x169697['where'],{'$or':_[_0x1aa0('0x3d')](_0x169697['attributes'],function(_0x1d1375){var _0x37e013={};_0x37e013[_0x1d1375]={'$like':'%'+_0x34e11d[_0x1aa0('0x2f')]['filter']+'%'};return _0x37e013;})});}_0x169697=_[_0x1aa0('0x3c')]({},_0x169697,_0x34e11d[_0x1aa0('0x3f')]);return _0x2a507d[_0x1aa0('0x50')](_0x169697);}})[_0x1aa0('0x23')](function(_0x10a38f){if(_0x10a38f){_0x4d8654=_0x10a38f[_0x1aa0('0x45')];if(!_0x34e11d[_0x1aa0('0x2f')][_0x1aa0('0x35')](_0x1aa0('0x36'))){_0x169697[_0x1aa0('0x1e')]=qs[_0x1aa0('0x1e')](_0x34e11d[_0x1aa0('0x2f')][_0x1aa0('0x1e')]);_0x169697['offset']=qs[_0x1aa0('0x1b')](_0x34e11d[_0x1aa0('0x2f')][_0x1aa0('0x1b')]);}return _0x2a507d[_0x1aa0('0x50')](_0x169697);}})[_0x1aa0('0x23')](function(_0x8636a2){if(_0x8636a2){return _0x8636a2?{'count':_0x4d8654,'rows':_0x8636a2}:null;}})['then'](respondWithResult(_0x17552f,null))[_0x1aa0('0x42')](handleError(_0x17552f,null));};exports['setTags']=function(_0x5c9fde,_0x5e48fe,_0x2ab3df){if(_0x5c9fde[_0x1aa0('0x48')]['id']){delete _0x5c9fde['body']['id'];}return db[_0x1aa0('0x2a')][_0x1aa0('0x4c')]({'where':{'id':_0x5c9fde[_0x1aa0('0x44')]['id']}})[_0x1aa0('0x23')](handleEntityNotFound(_0x5e48fe,null))[_0x1aa0('0x23')](function(_0x5bcd42){if(_0x5bcd42){return _0x5bcd42['setTags'](_0x5c9fde['body'][_0x1aa0('0x51')]||[]);}return null;})[_0x1aa0('0x23')](respondWithResult(_0x5e48fe,null))['catch'](handleError(_0x5e48fe,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 549f99b..7f8ba05 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 _0x1bdd=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x4bb651,_0x1bb1d1){var _0x5763bf=function(_0x492001){while(--_0x492001){_0x4bb651['push'](_0x4bb651['shift']());}};_0x5763bf(++_0x1bb1d1);}(_0x1bdd,0x143));var _0xd1bd=function(_0x5a3ece,_0x5a5745){_0x5a3ece=_0x5a3ece-0x0;var _0x1e8f40=_0x1bdd[_0x5a3ece];return _0x1e8f40;};'use strict';var _=require(_0xd1bd('0x0'));var util=require(_0xd1bd('0x1'));var logger=require(_0xd1bd('0x2'))(_0xd1bd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd1bd('0x4'));var fs=require('fs');var path=require(_0xd1bd('0x5'));var rimraf=require(_0xd1bd('0x6'));var config=require(_0xd1bd('0x7'));var attributes=require(_0xd1bd('0x8'));module['exports']=function(_0x23db60,_0x2fc380){return _0x23db60[_0xd1bd('0x9')](_0xd1bd('0xa'),attributes,{'tableName':_0xd1bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1fbe=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','int_desk_configurations','lodash','util'];(function(_0x10bcc4,_0x4400e2){var _0x2da988=function(_0x2ee849){while(--_0x2ee849){_0x10bcc4['push'](_0x10bcc4['shift']());}};_0x2da988(++_0x4400e2);}(_0x1fbe,0x177));var _0xe1fb=function(_0x3b0515,_0x1fa41d){_0x3b0515=_0x3b0515-0x0;var _0x198d7a=_0x1fbe[_0x3b0515];return _0x198d7a;};'use strict';var _=require(_0xe1fb('0x0'));var util=require(_0xe1fb('0x1'));var logger=require(_0xe1fb('0x2'))(_0xe1fb('0x3'));var moment=require('moment');var BPromise=require(_0xe1fb('0x4'));var rp=require(_0xe1fb('0x5'));var fs=require('fs');var path=require(_0xe1fb('0x6'));var rimraf=require(_0xe1fb('0x7'));var config=require(_0xe1fb('0x8'));var attributes=require(_0xe1fb('0x9'));module[_0xe1fb('0xa')]=function(_0x2b4c71,_0x38acc6){return _0x2b4c71[_0xe1fb('0xb')]('DeskConfiguration',attributes,{'tableName':_0xe1fb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 6b74f25..38c4e71 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 _0xcac3=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x318e32,_0x455b37){var _0x380b93=function(_0x3be37e){while(--_0x3be37e){_0x318e32['push'](_0x318e32['shift']());}};_0x380b93(++_0x455b37);}(_0xcac3,0x193));var _0x3cac=function(_0x21c23e,_0x1d33e3){_0x21c23e=_0x21c23e-0x0;var _0xa7b7e2=_0xcac3[_0x21c23e];return _0xa7b7e2;};'use strict';var _=require('lodash');var util=require(_0x3cac('0x0'));var moment=require(_0x3cac('0x1'));var BPromise=require(_0x3cac('0x2'));var rs=require(_0x3cac('0x3'));var fs=require('fs');var Redis=require(_0x3cac('0x4'));var db=require(_0x3cac('0x5'))['db'];var utils=require(_0x3cac('0x6'));var logger=require(_0x3cac('0x7'))(_0x3cac('0x8'));var config=require(_0x3cac('0x9'));var jayson=require(_0x3cac('0xa'));var client=jayson[_0x3cac('0xb')][_0x3cac('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e2560,_0x14562c,_0x21365c){return new BPromise(function(_0x13c1b9,_0x55670d){return client[_0x3cac('0xd')](_0x1e2560,_0x21365c)[_0x3cac('0xe')](function(_0x3bcbed){logger[_0x3cac('0xf')](_0x3cac('0x10'),_0x14562c,'request\x20sent');logger[_0x3cac('0x11')](_0x3cac('0x12'),_0x14562c,_0x3cac('0x13'),JSON[_0x3cac('0x14')](_0x3bcbed));if(_0x3bcbed[_0x3cac('0x15')]){if(_0x3bcbed['error']['code']===0x1f4){logger[_0x3cac('0x15')](_0x3cac('0x10'),_0x14562c,_0x3bcbed[_0x3cac('0x15')][_0x3cac('0x16')]);return _0x55670d(_0x3bcbed[_0x3cac('0x15')][_0x3cac('0x16')]);}logger[_0x3cac('0x15')]('DeskConfiguration,\x20%s,\x20%s',_0x14562c,_0x3bcbed[_0x3cac('0x15')][_0x3cac('0x16')]);return _0x13c1b9(_0x3bcbed[_0x3cac('0x15')][_0x3cac('0x16')]);}else{logger[_0x3cac('0xf')](_0x3cac('0x10'),_0x14562c,_0x3cac('0x13'));_0x13c1b9(_0x3bcbed[_0x3cac('0x17')][_0x3cac('0x16')]);}})[_0x3cac('0x18')](function(_0x4173ca){logger[_0x3cac('0x15')](_0x3cac('0x10'),_0x14562c,_0x4173ca);_0x55670d(_0x4173ca);});});} \ No newline at end of file +var _0xe230=['stringify','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x466e89,_0x237ae3){var _0x580986=function(_0x1ca46d){while(--_0x1ca46d){_0x466e89['push'](_0x466e89['shift']());}};_0x580986(++_0x237ae3);}(_0xe230,0x85));var _0x0e23=function(_0x3e986d,_0x59cd5f){_0x3e986d=_0x3e986d-0x0;var _0x1e4f74=_0xe230[_0x3e986d];return _0x1e4f74;};'use strict';var _=require(_0x0e23('0x0'));var util=require(_0x0e23('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0e23('0x2'));var fs=require('fs');var Redis=require(_0x0e23('0x3'));var db=require(_0x0e23('0x4'))['db'];var utils=require(_0x0e23('0x5'));var logger=require(_0x0e23('0x6'))('rpc');var config=require(_0x0e23('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0e23('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4fee1e,_0x823ef0,_0x40d80e){return new BPromise(function(_0x18968b,_0x38690b){return client[_0x0e23('0x9')](_0x4fee1e,_0x40d80e)['then'](function(_0x44ff1f){logger['info'](_0x0e23('0xa'),_0x823ef0,'request\x20sent');logger[_0x0e23('0xb')](_0x0e23('0xc'),_0x823ef0,_0x0e23('0xd'),JSON[_0x0e23('0xe')](_0x44ff1f));if(_0x44ff1f[_0x0e23('0xf')]){if(_0x44ff1f['error'][_0x0e23('0x10')]===0x1f4){logger[_0x0e23('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x823ef0,_0x44ff1f[_0x0e23('0xf')]['message']);return _0x38690b(_0x44ff1f[_0x0e23('0xf')]['message']);}logger[_0x0e23('0xf')](_0x0e23('0xa'),_0x823ef0,_0x44ff1f[_0x0e23('0xf')][_0x0e23('0x11')]);return _0x18968b(_0x44ff1f[_0x0e23('0xf')][_0x0e23('0x11')]);}else{logger[_0x0e23('0x12')](_0x0e23('0xa'),_0x823ef0,'request\x20sent');_0x18968b(_0x44ff1f[_0x0e23('0x13')][_0x0e23('0x11')]);}})[_0x0e23('0x14')](function(_0x21870a){logger[_0x0e23('0xf')](_0x0e23('0xa'),_0x823ef0,_0x21870a);_0x38690b(_0x21870a);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 3557ea4..2d789ee 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 _0xf663=['get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','util','path','connect-timeout','express','../../config/environment','./intDeskField.controller'];(function(_0x3309fd,_0x3684bd){var _0x3e6d7b=function(_0x57cf70){while(--_0x57cf70){_0x3309fd['push'](_0x3309fd['shift']());}};_0x3e6d7b(++_0x3684bd);}(_0xf663,0x1aa));var _0x3f66=function(_0x34e379,_0x451678){_0x34e379=_0x34e379-0x0;var _0x30171d=_0xf663[_0x34e379];return _0x30171d;};'use strict';var multer=require('multer');var util=require(_0x3f66('0x0'));var path=require(_0x3f66('0x1'));var timeout=require(_0x3f66('0x2'));var express=require(_0x3f66('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3f66('0x4'));var controller=require(_0x3f66('0x5'));router[_0x3f66('0x6')]('/',auth[_0x3f66('0x7')](),controller[_0x3f66('0x8')]);router[_0x3f66('0x6')](_0x3f66('0x9'),auth[_0x3f66('0x7')](),controller['show']);router[_0x3f66('0xa')]('/',auth[_0x3f66('0x7')](),controller[_0x3f66('0xb')]);router[_0x3f66('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x3f66('0xd')]);router[_0x3f66('0xe')]('/:id',auth[_0x3f66('0x7')](),controller[_0x3f66('0xf')]);module['exports']=router; \ No newline at end of file +var _0x7257=['get','isAuthenticated','index','/:id','show','post','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5e9175,_0x1100ed){var _0x2e49e1=function(_0xed95de){while(--_0xed95de){_0x5e9175['push'](_0x5e9175['shift']());}};_0x2e49e1(++_0x1100ed);}(_0x7257,0x7b));var _0x7725=function(_0x5ab238,_0x4ddda9){_0x5ab238=_0x5ab238-0x0;var _0x236db6=_0x7257[_0x5ab238];return _0x236db6;};'use strict';var multer=require(_0x7725('0x0'));var util=require(_0x7725('0x1'));var path=require(_0x7725('0x2'));var timeout=require(_0x7725('0x3'));var express=require(_0x7725('0x4'));var router=express[_0x7725('0x5')]();var fs_extra=require(_0x7725('0x6'));var auth=require(_0x7725('0x7'));var interaction=require(_0x7725('0x8'));var config=require(_0x7725('0x9'));var controller=require('./intDeskField.controller');router[_0x7725('0xa')]('/',auth[_0x7725('0xb')](),controller[_0x7725('0xc')]);router[_0x7725('0xa')](_0x7725('0xd'),auth[_0x7725('0xb')](),controller[_0x7725('0xe')]);router[_0x7725('0xf')]('/',auth[_0x7725('0xb')](),controller['create']);router[_0x7725('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7725('0x11')]('/:id',auth[_0x7725('0xb')](),controller[_0x7725('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 312e494..5cefacb 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 _0x0afa=['STRING','ENUM','BOOLEAN','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0afa,0x66));var _0xa0af=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x0afa[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require('sequelize');module[_0xa0af('0x0')]={'type':{'type':Sequelize['ENUM'](_0xa0af('0x1'),_0xa0af('0x2'),_0xa0af('0x3'),_0xa0af('0x4'),_0xa0af('0x5')),'defaultValue':_0xa0af('0x1')},'content':{'type':Sequelize[_0xa0af('0x6')]},'key':{'type':Sequelize[_0xa0af('0x6')]},'keyType':{'type':Sequelize[_0xa0af('0x7')](_0xa0af('0x1'),_0xa0af('0x2'),_0xa0af('0x3'))},'keyContent':{'type':Sequelize[_0xa0af('0x6')]},'idField':{'type':Sequelize[_0xa0af('0x6')]},'nameField':{'type':Sequelize[_0xa0af('0x6')]},'customField':{'type':Sequelize[_0xa0af('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa0af('0x6')]}}; \ No newline at end of file +var _0x4b22=['variable','customVariable','keyValue','STRING','string','BOOLEAN','exports','ENUM'];(function(_0x3c1d96,_0x1ae172){var _0x1fd3ac=function(_0xbddcf0){while(--_0xbddcf0){_0x3c1d96['push'](_0x3c1d96['shift']());}};_0x1fd3ac(++_0x1ae172);}(_0x4b22,0x11e));var _0x24b2=function(_0x3b6f75,_0x5bc47f){_0x3b6f75=_0x3b6f75-0x0;var _0x43a7c1=_0x4b22[_0x3b6f75];return _0x43a7c1;};'use strict';var Sequelize=require('sequelize');module[_0x24b2('0x0')]={'type':{'type':Sequelize[_0x24b2('0x1')]('string',_0x24b2('0x2'),_0x24b2('0x3'),_0x24b2('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x24b2('0x5')]},'key':{'type':Sequelize[_0x24b2('0x5')]},'keyType':{'type':Sequelize[_0x24b2('0x1')](_0x24b2('0x6'),'variable',_0x24b2('0x3'))},'keyContent':{'type':Sequelize[_0x24b2('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x24b2('0x5')]},'customField':{'type':Sequelize[_0x24b2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x24b2('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 3da98c2..1228ebc 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 _0x7f05=['show','rawAttributes','attributes','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','DeskField','fieldName','type','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch'];(function(_0x50e001,_0x45aa55){var _0x3fe4a2=function(_0x42dd11){while(--_0x42dd11){_0x50e001['push'](_0x50e001['shift']());}};_0x3fe4a2(++_0x45aa55);}(_0x7f05,0xdc));var _0x57f0=function(_0x141d56,_0x134135){_0x141d56=_0x141d56-0x0;var _0x2dea98=_0x7f05[_0x141d56];return _0x2dea98;};'use strict';var emlformat=require(_0x57f0('0x0'));var rimraf=require(_0x57f0('0x1'));var zipdir=require(_0x57f0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x57f0('0x3'));var moment=require('moment');var BPromise=require(_0x57f0('0x4'));var Mustache=require(_0x57f0('0x5'));var util=require('util');var path=require(_0x57f0('0x6'));var sox=require(_0x57f0('0x7'));var csv=require('to-csv');var ejs=require(_0x57f0('0x8'));var fs=require('fs');var fs_extra=require(_0x57f0('0x9'));var _=require('lodash');var squel=require(_0x57f0('0xa'));var crypto=require(_0x57f0('0xb'));var jsforce=require(_0x57f0('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x57f0('0xd'));var Papa=require('papaparse');var Redis=require(_0x57f0('0xe'));var authService=require(_0x57f0('0xf'));var qs=require(_0x57f0('0x10'));var as=require(_0x57f0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x57f0('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cd266,_0x5615ff){_0x5615ff=_0x5615ff||0xcc;return function(_0x1aa9c8){if(_0x1aa9c8){return _0x5cd266[_0x57f0('0x13')](_0x5615ff);}return _0x5cd266[_0x57f0('0x14')](_0x5615ff)[_0x57f0('0x15')]();};}function respondWithResult(_0x599a6b,_0x4d8d89){_0x4d8d89=_0x4d8d89||0xc8;return function(_0x471f97){if(_0x471f97){return _0x599a6b[_0x57f0('0x14')](_0x4d8d89)[_0x57f0('0x16')](_0x471f97);}};}function respondWithFilteredResult(_0x2e57df,_0x238245){return function(_0x2130ca){if(_0x2130ca){var _0x555e18=typeof _0x238245['offset']===_0x57f0('0x17')&&typeof _0x238245['limit']==='undefined';var _0x48eadd=_0x2130ca['count'];var _0x20d0ba=_0x555e18?0x0:_0x238245[_0x57f0('0x18')];var _0x124f9e=_0x555e18?_0x2130ca['count']:_0x238245[_0x57f0('0x18')]+_0x238245[_0x57f0('0x19')];var _0x3d0cf6;if(_0x124f9e>=_0x48eadd){_0x124f9e=_0x48eadd;_0x3d0cf6=0xc8;}else{_0x3d0cf6=0xce;}_0x2e57df['status'](_0x3d0cf6);return _0x2e57df[_0x57f0('0x1a')](_0x57f0('0x1b'),_0x20d0ba+'-'+_0x124f9e+'/'+_0x48eadd)['json'](_0x2130ca);}return null;};}function patchUpdates(_0x589c18){return function(_0x1f8483){try{jsonpatch[_0x57f0('0x1c')](_0x1f8483,_0x589c18,!![]);}catch(_0x599aa2){return BPromise[_0x57f0('0x1d')](_0x599aa2);}return _0x1f8483['save']();};}function saveUpdates(_0x3a5b6f,_0x9c498){return function(_0x426a09){if(_0x426a09){return _0x426a09[_0x57f0('0x1e')](_0x3a5b6f)['then'](function(_0x5d16a6){return _0x5d16a6;});}return null;};}function removeEntity(_0x43a679,_0x56ceb5){return function(_0x1279ae){if(_0x1279ae){return _0x1279ae[_0x57f0('0x1f')]()[_0x57f0('0x20')](function(){_0x43a679[_0x57f0('0x14')](0xcc)[_0x57f0('0x15')]();});}};}function handleEntityNotFound(_0x1c2cae,_0x4de0f5){return function(_0x941a03){if(!_0x941a03){_0x1c2cae['sendStatus'](0x194);}return _0x941a03;};}function handleError(_0x44a353,_0x5a176f){_0x5a176f=_0x5a176f||0x1f4;return function(_0x563fa5){logger[_0x57f0('0x21')](_0x563fa5['stack']);if(_0x563fa5[_0x57f0('0x22')]){delete _0x563fa5['name'];}_0x44a353['status'](_0x5a176f)[_0x57f0('0x23')](_0x563fa5);};}exports[_0x57f0('0x24')]=function(_0x16c711,_0x3ac9d3){var _0x1858ea={},_0x114b1d={},_0xb3ef4e={'count':0x0,'rows':[]};var _0x43699b=_[_0x57f0('0x25')](db[_0x57f0('0x26')]['rawAttributes'],function(_0x2c61af){return{'name':_0x2c61af[_0x57f0('0x27')],'type':_0x2c61af[_0x57f0('0x28')][_0x57f0('0x29')]};});_0x114b1d[_0x57f0('0x2a')]=_[_0x57f0('0x25')](_0x43699b,_0x57f0('0x22'));_0x114b1d[_0x57f0('0x2b')]=_[_0x57f0('0x2c')](_0x16c711[_0x57f0('0x2b')]);_0x114b1d[_0x57f0('0x2d')]=_[_0x57f0('0x2e')](_0x114b1d[_0x57f0('0x2a')],_0x114b1d[_0x57f0('0x2b')]);_0x1858ea['attributes']=_[_0x57f0('0x2e')](_0x114b1d[_0x57f0('0x2a')],qs[_0x57f0('0x2f')](_0x16c711[_0x57f0('0x2b')]['fields']));_0x1858ea['attributes']=_0x1858ea['attributes'][_0x57f0('0x30')]?_0x1858ea['attributes']:_0x114b1d[_0x57f0('0x2a')];if(!_0x16c711[_0x57f0('0x2b')][_0x57f0('0x31')]('nolimit')){_0x1858ea[_0x57f0('0x19')]=qs[_0x57f0('0x19')](_0x16c711[_0x57f0('0x2b')][_0x57f0('0x19')]);_0x1858ea[_0x57f0('0x18')]=qs[_0x57f0('0x18')](_0x16c711[_0x57f0('0x2b')][_0x57f0('0x18')]);}_0x1858ea[_0x57f0('0x32')]=qs[_0x57f0('0x33')](_0x16c711[_0x57f0('0x2b')][_0x57f0('0x33')]);_0x1858ea[_0x57f0('0x34')]=qs[_0x57f0('0x2d')](_[_0x57f0('0x35')](_0x16c711[_0x57f0('0x2b')],_0x114b1d[_0x57f0('0x2d')]),_0x43699b);if(_0x16c711[_0x57f0('0x2b')][_0x57f0('0x36')]){_0x1858ea['where']=_['merge'](_0x1858ea[_0x57f0('0x34')],{'$or':_[_0x57f0('0x25')](_0x43699b,function(_0x382436){if(_0x382436['type']!==_0x57f0('0x37')){var _0x294756={};_0x294756[_0x382436[_0x57f0('0x22')]]={'$like':'%'+_0x16c711[_0x57f0('0x2b')][_0x57f0('0x36')]+'%'};return _0x294756;}})});}_0x1858ea=_[_0x57f0('0x38')]({},_0x1858ea,_0x16c711[_0x57f0('0x39')]);var _0x2cf365={'where':_0x1858ea[_0x57f0('0x34')]};return db['DeskField'][_0x57f0('0x3a')](_0x2cf365)[_0x57f0('0x20')](function(_0x44d630){_0xb3ef4e[_0x57f0('0x3a')]=_0x44d630;if(_0x16c711['query'][_0x57f0('0x3b')]){_0x1858ea[_0x57f0('0x3c')]=[{'all':!![]}];}return db['DeskField'][_0x57f0('0x3d')](_0x1858ea);})[_0x57f0('0x20')](function(_0x2c3dbd){_0xb3ef4e[_0x57f0('0x3e')]=_0x2c3dbd;return _0xb3ef4e;})[_0x57f0('0x20')](respondWithFilteredResult(_0x3ac9d3,_0x1858ea))[_0x57f0('0x3f')](handleError(_0x3ac9d3,null));};exports[_0x57f0('0x40')]=function(_0x4f3271,_0x42379c){var _0x4e0abe={'raw':!![],'where':{'id':_0x4f3271['params']['id']}},_0x3dd680={};_0x3dd680[_0x57f0('0x2a')]=_[_0x57f0('0x2c')](db[_0x57f0('0x26')][_0x57f0('0x41')]);_0x3dd680[_0x57f0('0x2b')]=_[_0x57f0('0x2c')](_0x4f3271[_0x57f0('0x2b')]);_0x3dd680[_0x57f0('0x2d')]=_[_0x57f0('0x2e')](_0x3dd680[_0x57f0('0x2a')],_0x3dd680[_0x57f0('0x2b')]);_0x4e0abe['attributes']=_[_0x57f0('0x2e')](_0x3dd680[_0x57f0('0x2a')],qs['fields'](_0x4f3271['query'][_0x57f0('0x2f')]));_0x4e0abe['attributes']=_0x4e0abe[_0x57f0('0x42')][_0x57f0('0x30')]?_0x4e0abe[_0x57f0('0x42')]:_0x3dd680['model'];if(_0x4f3271[_0x57f0('0x2b')][_0x57f0('0x3b')]){_0x4e0abe['include']=[{'all':!![]}];}_0x4e0abe=_[_0x57f0('0x38')]({},_0x4e0abe,_0x4f3271[_0x57f0('0x39')]);return db[_0x57f0('0x26')][_0x57f0('0x43')](_0x4e0abe)[_0x57f0('0x20')](handleEntityNotFound(_0x42379c,null))[_0x57f0('0x20')](respondWithResult(_0x42379c,null))['catch'](handleError(_0x42379c,null));};exports[_0x57f0('0x44')]=function(_0x390119,_0x4b93e5){return db[_0x57f0('0x26')]['create'](_0x390119[_0x57f0('0x45')],{})['then'](respondWithResult(_0x4b93e5,0xc9))[_0x57f0('0x3f')](handleError(_0x4b93e5,null));};exports['update']=function(_0x4c6eb1,_0x22abb2){if(_0x4c6eb1[_0x57f0('0x45')]['id']){delete _0x4c6eb1[_0x57f0('0x45')]['id'];}return db['DeskField'][_0x57f0('0x43')]({'where':{'id':_0x4c6eb1[_0x57f0('0x46')]['id']}})[_0x57f0('0x20')](handleEntityNotFound(_0x22abb2,null))[_0x57f0('0x20')](saveUpdates(_0x4c6eb1[_0x57f0('0x45')],null))[_0x57f0('0x20')](respondWithResult(_0x22abb2,null))[_0x57f0('0x3f')](handleError(_0x22abb2,null));};exports[_0x57f0('0x1f')]=function(_0x7f6cf5,_0x5bdd21){return db[_0x57f0('0x26')][_0x57f0('0x43')]({'where':{'id':_0x7f6cf5['params']['id']}})[_0x57f0('0x20')](handleEntityNotFound(_0x5bdd21,null))[_0x57f0('0x20')](removeEntity(_0x5bdd21,null))['catch'](handleError(_0x5bdd21,null));}; \ No newline at end of file +var _0x1bb4=['sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x6d4cee,_0x295b67){var _0x2602b0=function(_0x712d39){while(--_0x712d39){_0x6d4cee['push'](_0x6d4cee['shift']());}};_0x2602b0(++_0x295b67);}(_0x1bb4,0x1c7));var _0x41bb=function(_0x4106eb,_0x3eba3f){_0x4106eb=_0x4106eb-0x0;var _0x2db64d=_0x1bb4[_0x4106eb];return _0x2db64d;};'use strict';var emlformat=require(_0x41bb('0x0'));var rimraf=require(_0x41bb('0x1'));var zipdir=require(_0x41bb('0x2'));var jsonpatch=require(_0x41bb('0x3'));var rp=require(_0x41bb('0x4'));var moment=require('moment');var BPromise=require(_0x41bb('0x5'));var Mustache=require('mustache');var util=require(_0x41bb('0x6'));var path=require('path');var sox=require(_0x41bb('0x7'));var csv=require('to-csv');var ejs=require(_0x41bb('0x8'));var fs=require('fs');var fs_extra=require(_0x41bb('0x9'));var _=require(_0x41bb('0xa'));var squel=require('squel');var crypto=require(_0x41bb('0xb'));var jsforce=require(_0x41bb('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x41bb('0xd'));var querystring=require(_0x41bb('0xe'));var Papa=require(_0x41bb('0xf'));var Redis=require('ioredis');var authService=require(_0x41bb('0x10'));var qs=require(_0x41bb('0x11'));var as=require(_0x41bb('0x12'));var hardwareService=require(_0x41bb('0x13'));var logger=require(_0x41bb('0x14'))('api');var utils=require(_0x41bb('0x15'));var config=require(_0x41bb('0x16'));var licenseUtil=require(_0x41bb('0x17'));var db=require(_0x41bb('0x18'))['db'];function respondWithStatusCode(_0x28c08a,_0x233473){_0x233473=_0x233473||0xcc;return function(_0x1f4b78){if(_0x1f4b78){return _0x28c08a[_0x41bb('0x19')](_0x233473);}return _0x28c08a['status'](_0x233473)['end']();};}function respondWithResult(_0x4bfeae,_0x43fd1f){_0x43fd1f=_0x43fd1f||0xc8;return function(_0x46a7ec){if(_0x46a7ec){return _0x4bfeae[_0x41bb('0x1a')](_0x43fd1f)['json'](_0x46a7ec);}};}function respondWithFilteredResult(_0x514d8f,_0x18bf70){return function(_0xa66c46){if(_0xa66c46){var _0xfa8f14=typeof _0x18bf70[_0x41bb('0x1b')]===_0x41bb('0x1c')&&typeof _0x18bf70['limit']===_0x41bb('0x1c');var _0x5a8de5=_0xa66c46[_0x41bb('0x1d')];var _0x3fa4a4=_0xfa8f14?0x0:_0x18bf70['offset'];var _0xc202d0=_0xfa8f14?_0xa66c46[_0x41bb('0x1d')]:_0x18bf70['offset']+_0x18bf70['limit'];var _0x3755d7;if(_0xc202d0>=_0x5a8de5){_0xc202d0=_0x5a8de5;_0x3755d7=0xc8;}else{_0x3755d7=0xce;}_0x514d8f['status'](_0x3755d7);return _0x514d8f[_0x41bb('0x1e')](_0x41bb('0x1f'),_0x3fa4a4+'-'+_0xc202d0+'/'+_0x5a8de5)[_0x41bb('0x20')](_0xa66c46);}return null;};}function patchUpdates(_0x2be518){return function(_0x2765e7){try{jsonpatch[_0x41bb('0x21')](_0x2765e7,_0x2be518,!![]);}catch(_0x44d02d){return BPromise[_0x41bb('0x22')](_0x44d02d);}return _0x2765e7[_0x41bb('0x23')]();};}function saveUpdates(_0x407480,_0x5bd58f){return function(_0x29b356){if(_0x29b356){return _0x29b356[_0x41bb('0x24')](_0x407480)[_0x41bb('0x25')](function(_0x177209){return _0x177209;});}return null;};}function removeEntity(_0x54ec2a,_0x4d065e){return function(_0x1a43ad){if(_0x1a43ad){return _0x1a43ad[_0x41bb('0x26')]()[_0x41bb('0x25')](function(){_0x54ec2a['status'](0xcc)[_0x41bb('0x27')]();});}};}function handleEntityNotFound(_0x19bd28,_0x592239){return function(_0x310f09){if(!_0x310f09){_0x19bd28[_0x41bb('0x19')](0x194);}return _0x310f09;};}function handleError(_0x20ebe6,_0x2fba16){_0x2fba16=_0x2fba16||0x1f4;return function(_0x440d33){logger[_0x41bb('0x28')](_0x440d33[_0x41bb('0x29')]);if(_0x440d33[_0x41bb('0x2a')]){delete _0x440d33[_0x41bb('0x2a')];}_0x20ebe6[_0x41bb('0x1a')](_0x2fba16)[_0x41bb('0x2b')](_0x440d33);};}exports[_0x41bb('0x2c')]=function(_0x430131,_0x16b1f6){var _0x148ea5={},_0x4645c8={},_0x501f78={'count':0x0,'rows':[]};var _0x32af99=_[_0x41bb('0x2d')](db[_0x41bb('0x2e')][_0x41bb('0x2f')],function(_0x3a3d23){return{'name':_0x3a3d23[_0x41bb('0x30')],'type':_0x3a3d23[_0x41bb('0x31')][_0x41bb('0x32')]};});_0x4645c8[_0x41bb('0x33')]=_[_0x41bb('0x2d')](_0x32af99,_0x41bb('0x2a'));_0x4645c8[_0x41bb('0x34')]=_[_0x41bb('0x35')](_0x430131[_0x41bb('0x34')]);_0x4645c8[_0x41bb('0x36')]=_[_0x41bb('0x37')](_0x4645c8['model'],_0x4645c8[_0x41bb('0x34')]);_0x148ea5[_0x41bb('0x38')]=_[_0x41bb('0x37')](_0x4645c8[_0x41bb('0x33')],qs[_0x41bb('0x39')](_0x430131[_0x41bb('0x34')][_0x41bb('0x39')]));_0x148ea5['attributes']=_0x148ea5['attributes'][_0x41bb('0x3a')]?_0x148ea5[_0x41bb('0x38')]:_0x4645c8[_0x41bb('0x33')];if(!_0x430131[_0x41bb('0x34')][_0x41bb('0x3b')](_0x41bb('0x3c'))){_0x148ea5[_0x41bb('0x3d')]=qs[_0x41bb('0x3d')](_0x430131['query']['limit']);_0x148ea5['offset']=qs[_0x41bb('0x1b')](_0x430131[_0x41bb('0x34')][_0x41bb('0x1b')]);}_0x148ea5[_0x41bb('0x3e')]=qs[_0x41bb('0x3f')](_0x430131['query'][_0x41bb('0x3f')]);_0x148ea5[_0x41bb('0x40')]=qs[_0x41bb('0x36')](_[_0x41bb('0x41')](_0x430131[_0x41bb('0x34')],_0x4645c8[_0x41bb('0x36')]),_0x32af99);if(_0x430131[_0x41bb('0x34')][_0x41bb('0x42')]){_0x148ea5[_0x41bb('0x40')]=_[_0x41bb('0x43')](_0x148ea5['where'],{'$or':_['map'](_0x32af99,function(_0x5f22eb){if(_0x5f22eb[_0x41bb('0x31')]!==_0x41bb('0x44')){var _0x3ac009={};_0x3ac009[_0x5f22eb[_0x41bb('0x2a')]]={'$like':'%'+_0x430131['query'][_0x41bb('0x42')]+'%'};return _0x3ac009;}})});}_0x148ea5=_[_0x41bb('0x43')]({},_0x148ea5,_0x430131['options']);var _0x4df15e={'where':_0x148ea5[_0x41bb('0x40')]};return db[_0x41bb('0x2e')]['count'](_0x4df15e)[_0x41bb('0x25')](function(_0x4aa5dc){_0x501f78[_0x41bb('0x1d')]=_0x4aa5dc;if(_0x430131[_0x41bb('0x34')][_0x41bb('0x45')]){_0x148ea5[_0x41bb('0x46')]=[{'all':!![]}];}return db[_0x41bb('0x2e')][_0x41bb('0x47')](_0x148ea5);})[_0x41bb('0x25')](function(_0x4e0c7d){_0x501f78[_0x41bb('0x48')]=_0x4e0c7d;return _0x501f78;})[_0x41bb('0x25')](respondWithFilteredResult(_0x16b1f6,_0x148ea5))['catch'](handleError(_0x16b1f6,null));};exports[_0x41bb('0x49')]=function(_0x14a908,_0x6a5364){var _0x59ed00={'raw':!![],'where':{'id':_0x14a908[_0x41bb('0x4a')]['id']}},_0x2deafc={};_0x2deafc[_0x41bb('0x33')]=_['keys'](db[_0x41bb('0x2e')][_0x41bb('0x2f')]);_0x2deafc[_0x41bb('0x34')]=_[_0x41bb('0x35')](_0x14a908[_0x41bb('0x34')]);_0x2deafc[_0x41bb('0x36')]=_[_0x41bb('0x37')](_0x2deafc[_0x41bb('0x33')],_0x2deafc['query']);_0x59ed00[_0x41bb('0x38')]=_[_0x41bb('0x37')](_0x2deafc[_0x41bb('0x33')],qs['fields'](_0x14a908[_0x41bb('0x34')][_0x41bb('0x39')]));_0x59ed00[_0x41bb('0x38')]=_0x59ed00[_0x41bb('0x38')][_0x41bb('0x3a')]?_0x59ed00[_0x41bb('0x38')]:_0x2deafc['model'];if(_0x14a908['query']['includeAll']){_0x59ed00[_0x41bb('0x46')]=[{'all':!![]}];}_0x59ed00=_[_0x41bb('0x43')]({},_0x59ed00,_0x14a908[_0x41bb('0x4b')]);return db['DeskField']['find'](_0x59ed00)['then'](handleEntityNotFound(_0x6a5364,null))[_0x41bb('0x25')](respondWithResult(_0x6a5364,null))[_0x41bb('0x4c')](handleError(_0x6a5364,null));};exports[_0x41bb('0x4d')]=function(_0x239a67,_0x69292a){return db[_0x41bb('0x2e')]['create'](_0x239a67[_0x41bb('0x4e')],{})[_0x41bb('0x25')](respondWithResult(_0x69292a,0xc9))[_0x41bb('0x4c')](handleError(_0x69292a,null));};exports['update']=function(_0x590f8f,_0x5d2e2e){if(_0x590f8f[_0x41bb('0x4e')]['id']){delete _0x590f8f[_0x41bb('0x4e')]['id'];}return db[_0x41bb('0x2e')][_0x41bb('0x4f')]({'where':{'id':_0x590f8f[_0x41bb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5d2e2e,null))[_0x41bb('0x25')](saveUpdates(_0x590f8f[_0x41bb('0x4e')],null))['then'](respondWithResult(_0x5d2e2e,null))[_0x41bb('0x4c')](handleError(_0x5d2e2e,null));};exports[_0x41bb('0x26')]=function(_0x45ef28,_0x57cd4c){return db[_0x41bb('0x2e')]['find']({'where':{'id':_0x45ef28[_0x41bb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x57cd4c,null))[_0x41bb('0x25')](removeEntity(_0x57cd4c,null))[_0x41bb('0x4c')](handleError(_0x57cd4c,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 922578f..9c3cab1 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 _0xbc13=['exports','define','int_desk_fields','desk_unique_index','idField','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./intDeskField.attributes'];(function(_0x58aacb,_0x5b84ba){var _0x561c6a=function(_0x24ed4e){while(--_0x24ed4e){_0x58aacb['push'](_0x58aacb['shift']());}};_0x561c6a(++_0x5b84ba);}(_0xbc13,0xc8));var _0x3bc1=function(_0x2a7c2a,_0x37cc9e){_0x2a7c2a=_0x2a7c2a-0x0;var _0x195732=_0xbc13[_0x2a7c2a];return _0x195732;};'use strict';var _=require(_0x3bc1('0x0'));var util=require(_0x3bc1('0x1'));var logger=require('../../config/logger')(_0x3bc1('0x2'));var moment=require(_0x3bc1('0x3'));var BPromise=require(_0x3bc1('0x4'));var rp=require(_0x3bc1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3bc1('0x6'));var attributes=require(_0x3bc1('0x7'));module[_0x3bc1('0x8')]=function(_0x29f036,_0x4937e6){return _0x29f036[_0x3bc1('0x9')]('DeskField',attributes,{'tableName':_0x3bc1('0xa'),'paranoid':![],'indexes':[{'name':_0x3bc1('0xb'),'fields':[_0x3bc1('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x51e9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x2f49ca,_0x2aa81d){var _0x242793=function(_0x2ecd76){while(--_0x2ecd76){_0x2f49ca['push'](_0x2f49ca['shift']());}};_0x242793(++_0x2aa81d);}(_0x51e9,0x19d));var _0x951e=function(_0x46fdd3,_0x168b51){_0x46fdd3=_0x46fdd3-0x0;var _0x58e14e=_0x51e9[_0x46fdd3];return _0x58e14e;};'use strict';var _=require(_0x951e('0x0'));var util=require(_0x951e('0x1'));var logger=require(_0x951e('0x2'))('api');var moment=require(_0x951e('0x3'));var BPromise=require(_0x951e('0x4'));var rp=require(_0x951e('0x5'));var fs=require('fs');var path=require(_0x951e('0x6'));var rimraf=require(_0x951e('0x7'));var config=require(_0x951e('0x8'));var attributes=require(_0x951e('0x9'));module['exports']=function(_0x4c9f4e,_0x3b7b5e){return _0x4c9f4e[_0x951e('0xa')](_0x951e('0xb'),attributes,{'tableName':_0x951e('0xc'),'paranoid':![],'indexes':[{'name':_0x951e('0xd'),'fields':[_0x951e('0xe'),_0x951e('0xf')],'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 391e01b..25c2b0c 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 _0xde46=['jayson/promise','client','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x37d0bc,_0x109b96){var _0x170e60=function(_0xae2ad){while(--_0xae2ad){_0x37d0bc['push'](_0x37d0bc['shift']());}};_0x170e60(++_0x109b96);}(_0xde46,0x19a));var _0x6de4=function(_0x268623,_0x5936ff){_0x268623=_0x268623-0x0;var _0x2e5bc1=_0xde46[_0x268623];return _0x2e5bc1;};'use strict';var _=require(_0x6de4('0x0'));var util=require(_0x6de4('0x1'));var moment=require('moment');var BPromise=require(_0x6de4('0x2'));var rs=require(_0x6de4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6de4('0x4'))['db'];var utils=require(_0x6de4('0x5'));var logger=require('../../config/logger')(_0x6de4('0x6'));var config=require(_0x6de4('0x7'));var jayson=require(_0x6de4('0x8'));var client=jayson[_0x6de4('0x9')][_0x6de4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45aea9,_0x183a45,_0x2258a9){return new BPromise(function(_0x2dea88,_0x33d14c){return client[_0x6de4('0xb')](_0x45aea9,_0x2258a9)[_0x6de4('0xc')](function(_0x2afb76){logger['info'](_0x6de4('0xd'),_0x183a45,_0x6de4('0xe'));logger[_0x6de4('0xf')]('DeskField,\x20%s,\x20%s,\x20%s',_0x183a45,'request\x20sent',JSON['stringify'](_0x2afb76));if(_0x2afb76[_0x6de4('0x10')]){if(_0x2afb76[_0x6de4('0x10')][_0x6de4('0x11')]===0x1f4){logger[_0x6de4('0x10')]('DeskField,\x20%s,\x20%s',_0x183a45,_0x2afb76[_0x6de4('0x10')]['message']);return _0x33d14c(_0x2afb76['error'][_0x6de4('0x12')]);}logger[_0x6de4('0x10')](_0x6de4('0xd'),_0x183a45,_0x2afb76[_0x6de4('0x10')][_0x6de4('0x12')]);return _0x2dea88(_0x2afb76['error'][_0x6de4('0x12')]);}else{logger[_0x6de4('0x13')](_0x6de4('0xd'),_0x183a45,_0x6de4('0xe'));_0x2dea88(_0x2afb76[_0x6de4('0x14')][_0x6de4('0x12')]);}})[_0x6de4('0x15')](function(_0x1fb286){logger[_0x6de4('0x10')](_0x6de4('0xd'),_0x183a45,_0x1fb286);_0x33d14c(_0x1fb286);});});} \ No newline at end of file +var _0x4988=['debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','DeskField,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','info','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4988,0x1ca));var _0x8498=function(_0x59ec8a,_0x17b62c){_0x59ec8a=_0x59ec8a-0x0;var _0x329c26=_0x4988[_0x59ec8a];return _0x329c26;};'use strict';var _=require(_0x8498('0x0'));var util=require('util');var moment=require(_0x8498('0x1'));var BPromise=require('bluebird');var rs=require(_0x8498('0x2'));var fs=require('fs');var Redis=require(_0x8498('0x3'));var db=require(_0x8498('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8498('0x5'))('rpc');var config=require(_0x8498('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8498('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x393375,_0x355cb3,_0x202502){return new BPromise(function(_0x1264b8,_0x2fe24f){return client['request'](_0x393375,_0x202502)['then'](function(_0xbc470e){logger[_0x8498('0x8')]('DeskField,\x20%s,\x20%s',_0x355cb3,_0x8498('0x9'));logger[_0x8498('0xa')](_0x8498('0xb'),_0x355cb3,_0x8498('0x9'),JSON['stringify'](_0xbc470e));if(_0xbc470e['error']){if(_0xbc470e[_0x8498('0xc')][_0x8498('0xd')]===0x1f4){logger[_0x8498('0xc')](_0x8498('0xe'),_0x355cb3,_0xbc470e['error'][_0x8498('0xf')]);return _0x2fe24f(_0xbc470e['error'][_0x8498('0xf')]);}logger['error'](_0x8498('0xe'),_0x355cb3,_0xbc470e[_0x8498('0xc')][_0x8498('0xf')]);return _0x1264b8(_0xbc470e[_0x8498('0xc')][_0x8498('0xf')]);}else{logger[_0x8498('0x8')](_0x8498('0xe'),_0x355cb3,_0x8498('0x9'));_0x1264b8(_0xbc470e[_0x8498('0x10')]['message']);}})[_0x8498('0x11')](function(_0xd8f690){logger[_0x8498('0xc')](_0x8498('0xe'),_0x355cb3,_0xd8f690);_0x2fe24f(_0xd8f690);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index deb7e0e..22872e7 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 _0x2166=['destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','index','/:id/configurations','isAuthenticated','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update'];(function(_0x44fb72,_0x5f1687){var _0x350627=function(_0x88352b){while(--_0x88352b){_0x44fb72['push'](_0x44fb72['shift']());}};_0x350627(++_0x5f1687);}(_0x2166,0x75));var _0x6216=function(_0x2b31a8,_0x28b862){_0x2b31a8=_0x2b31a8-0x0;var _0x1175a5=_0x2166[_0x2b31a8];return _0x1175a5;};'use strict';var multer=require(_0x6216('0x0'));var util=require(_0x6216('0x1'));var path=require('path');var timeout=require(_0x6216('0x2'));var express=require(_0x6216('0x3'));var router=express['Router']();var fs_extra=require(_0x6216('0x4'));var auth=require(_0x6216('0x5'));var interaction=require(_0x6216('0x6'));var config=require(_0x6216('0x7'));var controller=require(_0x6216('0x8'));router[_0x6216('0x9')]('/',auth['isAuthenticated'](),controller[_0x6216('0xa')]);router[_0x6216('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x6216('0xb'),auth[_0x6216('0xc')](),controller['getConfigurations']);router[_0x6216('0x9')](_0x6216('0xd'),auth[_0x6216('0xc')](),controller[_0x6216('0xe')]);router[_0x6216('0xf')]('/',auth[_0x6216('0xc')](),controller[_0x6216('0x10')]);router[_0x6216('0xf')](_0x6216('0xb'),auth[_0x6216('0xc')](),controller[_0x6216('0x11')]);router[_0x6216('0x12')](_0x6216('0x13'),auth[_0x6216('0xc')](),controller[_0x6216('0x14')]);router['delete'](_0x6216('0x13'),auth[_0x6216('0xc')](),controller[_0x6216('0x15')]);module[_0x6216('0x16')]=router; \ No newline at end of file +var _0xd33c=['show','/:id/configurations','getConfigurations','getFields','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','index','/:id','isAuthenticated'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xd33c,0xef));var _0xcd33=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xd33c[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require('multer');var util=require(_0xcd33('0x0'));var path=require(_0xcd33('0x1'));var timeout=require(_0xcd33('0x2'));var express=require(_0xcd33('0x3'));var router=express[_0xcd33('0x4')]();var fs_extra=require(_0xcd33('0x5'));var auth=require(_0xcd33('0x6'));var interaction=require(_0xcd33('0x7'));var config=require(_0xcd33('0x8'));var controller=require(_0xcd33('0x9'));router[_0xcd33('0xa')]('/',auth['isAuthenticated'](),controller[_0xcd33('0xb')]);router[_0xcd33('0xa')](_0xcd33('0xc'),auth[_0xcd33('0xd')](),controller[_0xcd33('0xe')]);router[_0xcd33('0xa')](_0xcd33('0xf'),auth[_0xcd33('0xd')](),controller[_0xcd33('0x10')]);router[_0xcd33('0xa')]('/:id/fields',auth[_0xcd33('0xd')](),controller[_0xcd33('0x11')]);router['post']('/',auth[_0xcd33('0xd')](),controller[_0xcd33('0x12')]);router['post']('/:id/configurations',auth[_0xcd33('0xd')](),controller['addConfiguration']);router[_0xcd33('0x13')](_0xcd33('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xcd33('0x14')](_0xcd33('0xc'),auth[_0xcd33('0xd')](),controller[_0xcd33('0x15')]);module[_0xcd33('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 2533000..af298a0 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 _0x2494=['sequelize','STRING'];(function(_0x39d6e5,_0x697729){var _0x561344=function(_0x1b8fff){while(--_0x1b8fff){_0x39d6e5['push'](_0x39d6e5['shift']());}};_0x561344(++_0x697729);}(_0x2494,0x82));var _0x4249=function(_0x47a017,_0x51e32f){_0x47a017=_0x47a017-0x0;var _0x17f70c=_0x2494[_0x47a017];return _0x17f70c;};'use strict';var Sequelize=require(_0x4249('0x0'));module['exports']={'name':{'type':Sequelize[_0x4249('0x1')]},'username':{'type':Sequelize[_0x4249('0x1')]},'password':{'type':Sequelize[_0x4249('0x1')]},'remoteUri':{'type':Sequelize[_0x4249('0x1')]},'tenantId':{'type':Sequelize[_0x4249('0x1')]},'clientId':{'type':Sequelize[_0x4249('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x4249('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x5447=['BOOLEAN','sequelize','STRING'];(function(_0x33fda5,_0x4fb38d){var _0x49e6c2=function(_0x1c2236){while(--_0x1c2236){_0x33fda5['push'](_0x33fda5['shift']());}};_0x49e6c2(++_0x4fb38d);}(_0x5447,0xf1));var _0x7544=function(_0x1390b0,_0x2b4ae8){_0x1390b0=_0x1390b0-0x0;var _0x23a217=_0x5447[_0x1390b0];return _0x23a217;};'use strict';var Sequelize=require(_0x7544('0x0'));module['exports']={'name':{'type':Sequelize[_0x7544('0x1')]},'username':{'type':Sequelize[_0x7544('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7544('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x7544('0x1')]},'clientSecret':{'type':Sequelize[_0x7544('0x1')]},'serverUrl':{'type':Sequelize[_0x7544('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7544('0x1')]},'modernAuthentication':{'type':Sequelize[_0x7544('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 45205e8..b0cde9e 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 _0x8c2e=['modernAuthentication','access_token','https://login.microsoftonline.com/','/oauth2/token','clientSecret','Bearer\x20',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','MetadataId','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','statusCode','stack','send','test','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Value','DisplayName','EntityDefinitions(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','Label','true','FalseOption','GET','?$select=DisplayName,LogicalName','request-promise','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','limit','count','update','then','destroy','status','end','sendStatus','error','name','index','map','Dynamics365Account','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','create','catch','body','find','getConfigurations','findOne','Dynamics365Configuration','order','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','PhoneCall','title','description','customerid','caseorigincode','subject','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','clientId','CloudProvider','data5','data7'];(function(_0x3508d2,_0x5a3695){var _0x548601=function(_0x3e5067){while(--_0x3e5067){_0x3508d2['push'](_0x3508d2['shift']());}};_0x548601(++_0x5a3695);}(_0x8c2e,0xec));var _0xe8c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8c2e[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0xe8c2('0x0'));var util=require('util');var _=require(_0xe8c2('0x1'));var qs=require(_0xe8c2('0x2'));var logger=require(_0xe8c2('0x3'))(_0xe8c2('0x4'));var db=require(_0xe8c2('0x5'))['db'];var integrations=require(_0xe8c2('0x6'));function respondWithResult(_0x1603a7,_0x14de48){_0x14de48=_0x14de48||0xc8;return function(_0x52da4e){if(_0x52da4e){return _0x1603a7['status'](_0x14de48)[_0xe8c2('0x7')](_0x52da4e);}};}function respondWithFilteredResult(_0x9041b,_0x49f3ac){return function(_0x1600c6){if(_0x1600c6){var _0x4b3318=typeof _0x49f3ac[_0xe8c2('0x8')]===_0xe8c2('0x9')&&typeof _0x49f3ac[_0xe8c2('0xa')]==='undefined';var _0xad00b6=_0x1600c6[_0xe8c2('0xb')];var _0x4e0299=_0x4b3318?0x0:_0x49f3ac[_0xe8c2('0x8')];var _0x3b0d15=_0x4b3318?_0x1600c6[_0xe8c2('0xb')]:_0x49f3ac[_0xe8c2('0x8')]+_0x49f3ac[_0xe8c2('0xa')];var _0x2b0b9e;if(_0x3b0d15>=_0xad00b6){_0x3b0d15=_0xad00b6;_0x2b0b9e=0xc8;}else{_0x2b0b9e=0xce;}_0x9041b['status'](_0x2b0b9e);return _0x9041b['set']('Content-Range',_0x4e0299+'-'+_0x3b0d15+'/'+_0xad00b6)[_0xe8c2('0x7')](_0x1600c6);}return null;};}function saveUpdates(_0x487dbc){return function(_0x58dec0){if(_0x58dec0){return _0x58dec0[_0xe8c2('0xc')](_0x487dbc)[_0xe8c2('0xd')](function(_0x29183e){return _0x29183e;});}return null;};}function removeEntity(_0x11bb41){return function(_0x4f4644){if(_0x4f4644){return _0x4f4644[_0xe8c2('0xe')]()[_0xe8c2('0xd')](function(){_0x11bb41[_0xe8c2('0xf')](0xcc)[_0xe8c2('0x10')]();});}};}function handleEntityNotFound(_0xa7bdc){return function(_0x41847e){if(!_0x41847e){_0xa7bdc[_0xe8c2('0x11')](0x194);}return _0x41847e;};}function handleError(_0x334767,_0x47d4e7){_0x47d4e7=_0x47d4e7||0x1f4;return function(_0x5aaf80){logger[_0xe8c2('0x12')](_0x5aaf80['stack']);if(_0x5aaf80['name']){delete _0x5aaf80[_0xe8c2('0x13')];}_0x334767[_0xe8c2('0xf')](_0x47d4e7)['send'](_0x5aaf80);};}exports[_0xe8c2('0x14')]=function(_0x219190,_0x4fed86){var _0x85abc5={},_0x2e8da9={},_0xa1bf={'count':0x0,'rows':[]};var _0xbdca93=_[_0xe8c2('0x15')](db[_0xe8c2('0x16')][_0xe8c2('0x17')],function(_0x122a09){return{'name':_0x122a09['fieldName'],'type':_0x122a09[_0xe8c2('0x18')][_0xe8c2('0x19')]};});_0x2e8da9[_0xe8c2('0x1a')]=_[_0xe8c2('0x15')](_0xbdca93,_0xe8c2('0x13'));_0x2e8da9[_0xe8c2('0x1b')]=_[_0xe8c2('0x1c')](_0x219190['query']);_0x2e8da9[_0xe8c2('0x1d')]=_[_0xe8c2('0x1e')](_0x2e8da9[_0xe8c2('0x1a')],_0x2e8da9['query']);_0x85abc5[_0xe8c2('0x1f')]=_['intersection'](_0x2e8da9[_0xe8c2('0x1a')],qs[_0xe8c2('0x20')](_0x219190[_0xe8c2('0x1b')][_0xe8c2('0x20')]));_0x85abc5[_0xe8c2('0x1f')]=_0x85abc5['attributes'][_0xe8c2('0x21')]?_0x85abc5[_0xe8c2('0x1f')]:_0x2e8da9[_0xe8c2('0x1a')];if(!_0x219190[_0xe8c2('0x1b')][_0xe8c2('0x22')](_0xe8c2('0x23'))){_0x85abc5[_0xe8c2('0xa')]=qs['limit'](_0x219190[_0xe8c2('0x1b')][_0xe8c2('0xa')]);_0x85abc5[_0xe8c2('0x8')]=qs[_0xe8c2('0x8')](_0x219190['query']['offset']);}_0x85abc5['order']=qs[_0xe8c2('0x24')](_0x219190[_0xe8c2('0x1b')][_0xe8c2('0x24')]);_0x85abc5[_0xe8c2('0x25')]=qs['filters'](_['pick'](_0x219190[_0xe8c2('0x1b')],_0x2e8da9[_0xe8c2('0x1d')]),_0xbdca93);if(_0x219190[_0xe8c2('0x1b')][_0xe8c2('0x26')]){_0x85abc5[_0xe8c2('0x25')]=_[_0xe8c2('0x27')](_0x85abc5['where'],{'$or':_[_0xe8c2('0x15')](_0xbdca93,function(_0x287e27){if(_0x287e27[_0xe8c2('0x18')]!==_0xe8c2('0x28')){var _0x128d43={};_0x128d43[_0x287e27[_0xe8c2('0x13')]]={'$like':'%'+_0x219190[_0xe8c2('0x1b')][_0xe8c2('0x26')]+'%'};return _0x128d43;}})});}_0x85abc5=_['merge']({},_0x85abc5,_0x219190[_0xe8c2('0x29')]);var _0x7271cc={'where':_0x85abc5[_0xe8c2('0x25')]};return db['Dynamics365Account'][_0xe8c2('0xb')](_0x7271cc)[_0xe8c2('0xd')](function(_0x5aae4a){_0xa1bf[_0xe8c2('0xb')]=_0x5aae4a;if(_0x219190['query'][_0xe8c2('0x2a')]){_0x85abc5['include']=[{'all':!![]}];}return db[_0xe8c2('0x16')][_0xe8c2('0x2b')](_0x85abc5);})[_0xe8c2('0xd')](function(_0x279f3f){_0xa1bf[_0xe8c2('0x2c')]=_0x279f3f;return _0xa1bf;})[_0xe8c2('0xd')](respondWithFilteredResult(_0x4fed86,_0x85abc5))['catch'](handleError(_0x4fed86,null));};exports[_0xe8c2('0x2d')]=function(_0x48d41b,_0x3e0b48){var _0x32e050={'raw':![],'where':{'id':_0x48d41b[_0xe8c2('0x2e')]['id']}},_0x2baaf8={};_0x2baaf8[_0xe8c2('0x1a')]=_['keys'](db[_0xe8c2('0x16')][_0xe8c2('0x17')]);_0x2baaf8[_0xe8c2('0x1b')]=_[_0xe8c2('0x1c')](_0x48d41b['query']);_0x2baaf8['filters']=_[_0xe8c2('0x1e')](_0x2baaf8[_0xe8c2('0x1a')],_0x2baaf8[_0xe8c2('0x1b')]);_0x32e050[_0xe8c2('0x1f')]=_[_0xe8c2('0x1e')](_0x2baaf8['model'],qs[_0xe8c2('0x20')](_0x48d41b['query'][_0xe8c2('0x20')]));_0x32e050[_0xe8c2('0x1f')]=_0x32e050['attributes'][_0xe8c2('0x21')]?_0x32e050[_0xe8c2('0x1f')]:_0x2baaf8[_0xe8c2('0x1a')];if(_0x48d41b[_0xe8c2('0x1b')][_0xe8c2('0x2a')]){_0x32e050[_0xe8c2('0x2f')]=[{'all':!![]}];}_0x32e050=_[_0xe8c2('0x27')]({},_0x32e050,_0x48d41b[_0xe8c2('0x29')]);return db[_0xe8c2('0x16')]['find'](_0x32e050)['then'](handleEntityNotFound(_0x3e0b48,null))[_0xe8c2('0xd')](respondWithResult(_0x3e0b48,null))['catch'](handleError(_0x3e0b48,null));};exports[_0xe8c2('0x30')]=function(_0x42d743,_0x5b0151){return db[_0xe8c2('0x16')][_0xe8c2('0x30')](_0x42d743['body'],{})[_0xe8c2('0xd')](respondWithResult(_0x5b0151,0xc9))[_0xe8c2('0x31')](handleError(_0x5b0151,null));};exports[_0xe8c2('0xc')]=function(_0x244499,_0x478c7c){if(_0x244499[_0xe8c2('0x32')]['id']){delete _0x244499[_0xe8c2('0x32')]['id'];}return db[_0xe8c2('0x16')][_0xe8c2('0x33')]({'where':{'id':_0x244499['params']['id']}})[_0xe8c2('0xd')](handleEntityNotFound(_0x478c7c,null))[_0xe8c2('0xd')](saveUpdates(_0x244499['body'],null))[_0xe8c2('0xd')](respondWithResult(_0x478c7c,null))['catch'](handleError(_0x478c7c,null));};exports[_0xe8c2('0xe')]=function(_0x2811d7,_0x157980){return db[_0xe8c2('0x16')][_0xe8c2('0x33')]({'where':{'id':_0x2811d7[_0xe8c2('0x2e')]['id']}})[_0xe8c2('0xd')](handleEntityNotFound(_0x157980,null))['then'](removeEntity(_0x157980,null))[_0xe8c2('0x31')](handleError(_0x157980,null));};exports[_0xe8c2('0x34')]=function(_0x1e0a54,_0x30f133){var _0xad0b72={};var _0xce0c0b={};var _0x666202;var _0x4be222;return db[_0xe8c2('0x16')][_0xe8c2('0x35')]({'where':{'id':_0x1e0a54[_0xe8c2('0x2e')]['id']}})[_0xe8c2('0xd')](handleEntityNotFound(_0x30f133,null))['then'](function(_0x52d1fb){if(_0x52d1fb){_0x666202=_0x52d1fb;_0xce0c0b[_0xe8c2('0x1a')]=_[_0xe8c2('0x1c')](db[_0xe8c2('0x36')][_0xe8c2('0x17')]);_0xce0c0b[_0xe8c2('0x1b')]=_[_0xe8c2('0x1c')](_0x1e0a54['query']);_0xce0c0b[_0xe8c2('0x1d')]=_[_0xe8c2('0x1e')](_0xce0c0b[_0xe8c2('0x1a')],_0xce0c0b[_0xe8c2('0x1b')]);_0xad0b72['attributes']=_[_0xe8c2('0x1e')](_0xce0c0b[_0xe8c2('0x1a')],qs['fields'](_0x1e0a54[_0xe8c2('0x1b')][_0xe8c2('0x20')]));_0xad0b72[_0xe8c2('0x1f')]=_0xad0b72[_0xe8c2('0x1f')]['length']?_0xad0b72['attributes']:_0xce0c0b[_0xe8c2('0x1a')];_0xad0b72[_0xe8c2('0x37')]=qs[_0xe8c2('0x24')](_0x1e0a54['query']['sort']);_0xad0b72['where']=qs[_0xe8c2('0x1d')](_[_0xe8c2('0x38')](_0x1e0a54['query'],_0xce0c0b[_0xe8c2('0x1d')]));if(_0x1e0a54[_0xe8c2('0x1b')][_0xe8c2('0x26')]){_0xad0b72[_0xe8c2('0x25')]=_[_0xe8c2('0x27')](_0xad0b72[_0xe8c2('0x25')],{'$or':_[_0xe8c2('0x15')](_0xad0b72['attributes'],function(_0x2aa590){var _0xe7e69d={};_0xe7e69d[_0x2aa590]={'$like':'%'+_0x1e0a54[_0xe8c2('0x1b')][_0xe8c2('0x26')]+'%'};return _0xe7e69d;})});}_0xad0b72=_['merge']({},_0xad0b72,_0x1e0a54['options']);return _0x666202[_0xe8c2('0x34')](_0xad0b72);}})[_0xe8c2('0xd')](function(_0x1c7a75){if(_0x1c7a75){_0x4be222=_0x1c7a75[_0xe8c2('0x21')];if(!_0x1e0a54['query'][_0xe8c2('0x22')]('nolimit')){_0xad0b72[_0xe8c2('0xa')]=qs[_0xe8c2('0xa')](_0x1e0a54[_0xe8c2('0x1b')]['limit']);_0xad0b72[_0xe8c2('0x8')]=qs[_0xe8c2('0x8')](_0x1e0a54[_0xe8c2('0x1b')][_0xe8c2('0x8')]);}return _0x666202['getConfigurations'](_0xad0b72);}})[_0xe8c2('0xd')](function(_0x6515a1){if(_0x6515a1){return _0x6515a1?{'count':_0x4be222,'rows':_0x6515a1}:null;}})[_0xe8c2('0xd')](respondWithResult(_0x30f133,null))[_0xe8c2('0x31')](handleError(_0x30f133,null));};exports[_0xe8c2('0x39')]=function(_0x1fdddd,_0x4cf4ba){if(_0x1fdddd[_0xe8c2('0x32')]['id']){delete _0x1fdddd[_0xe8c2('0x32')]['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x1fdddd[_0xe8c2('0x2e')]['id']}})[_0xe8c2('0xd')](handleEntityNotFound(_0x4cf4ba,null))['then'](function(_0xe55beb){if(_0xe55beb){_0x1fdddd[_0xe8c2('0x32')][_0xe8c2('0x3a')]=_0xe55beb['id'];_0x1fdddd[_0xe8c2('0x32')][_0xe8c2('0x3b')]=integrations[_0xe8c2('0x3c')](_0x1fdddd[_0xe8c2('0x32')][_0xe8c2('0x3d')],_0x1fdddd[_0xe8c2('0x32')][_0xe8c2('0x18')]);_0x1fdddd[_0xe8c2('0x32')]['Descriptions']=integrations[_0xe8c2('0x3e')](_0x1fdddd[_0xe8c2('0x32')][_0xe8c2('0x3d')],_0x1fdddd['body']['type']);return db[_0xe8c2('0x36')][_0xe8c2('0x30')](_0x1fdddd['body'],{'include':[{'model':db[_0xe8c2('0x3f')],'as':_0xe8c2('0x3b')},{'model':db[_0xe8c2('0x3f')],'as':_0xe8c2('0x40')}]});}return null;})[_0xe8c2('0xd')](respondWithResult(_0x4cf4ba,null))[_0xe8c2('0x31')](handleError(_0x4cf4ba,null));};function sanitizeRemoteUri(_0x16099d){var _0xf3a96a=_0x16099d[_0xe8c2('0x41')](-0x1);if(_0xf3a96a==='/')return _0x16099d[_0xe8c2('0x42')](0x0,_0x16099d[_0xe8c2('0x43')](_0xf3a96a));return _0x16099d;}function getWebApiUrl(_0x46877e){return util[_0xe8c2('0x44')](_0xe8c2('0x45'),_0x46877e);}exports[_0xe8c2('0x46')]=function(_0x31a75f,_0x555b8e){var _0x2e8343=_0x31a75f[_0xe8c2('0x1b')][_0xe8c2('0x47')];var _0x4da3d8=_0x2e8343===_0xe8c2('0x48')?'Incident':_0xe8c2('0x49');var _0x4cac98='';var _0x3cf982='';var _0xfafdc3='';var _0x266201='';var _0x284603='';var _0xd2964c='';var _0x52d15e='';var _0x139f05='';var _0x2fcbb5=[_0xe8c2('0x4a'),_0xe8c2('0x4b'),_0xe8c2('0x4c'),'ownerid',_0xe8c2('0x4d'),_0xe8c2('0x4e'),'phonenumber',_0xe8c2('0x4f'),_0xe8c2('0x50'),'phonecall_activity_parties'];var _0x182e6c=[_0xe8c2('0x51'),_0xe8c2('0x52'),_0xe8c2('0x53'),_0xe8c2('0x54'),_0xe8c2('0x55'),_0xe8c2('0x56'),_0xe8c2('0x57'),_0xe8c2('0x58'),_0xe8c2('0x59'),_0xe8c2('0x5a'),_0xe8c2('0x5b'),_0xe8c2('0x5c'),_0xe8c2('0x5d'),_0xe8c2('0x5e'),'createdonbehalfbyyominame','customeridname',_0xe8c2('0x5f'),'customeridyominame',_0xe8c2('0x60'),_0xe8c2('0x61'),_0xe8c2('0x62'),_0xe8c2('0x63'),_0xe8c2('0x64'),_0xe8c2('0x65'),_0xe8c2('0x66'),_0xe8c2('0x67'),_0xe8c2('0x68'),_0xe8c2('0x69'),_0xe8c2('0x6a'),_0xe8c2('0x6b'),_0xe8c2('0x6c'),_0xe8c2('0x6d'),'modifiedbyexternalpartyyominame','modifiedbyname',_0xe8c2('0x6e'),_0xe8c2('0x6f'),_0xe8c2('0x70'),_0xe8c2('0x71'),'msdyn_incidenttypename',_0xe8c2('0x72'),_0xe8c2('0x73'),_0xe8c2('0x74'),'overriddencreatedon',_0xe8c2('0x75'),_0xe8c2('0x76'),'owneridyominame',_0xe8c2('0x77'),'primarycontactidname',_0xe8c2('0x78'),_0xe8c2('0x79'),_0xe8c2('0x7a'),_0xe8c2('0x7b'),_0xe8c2('0x7c'),_0xe8c2('0x7d'),_0xe8c2('0x7e'),_0xe8c2('0x7f'),_0xe8c2('0x80'),_0xe8c2('0x81'),_0xe8c2('0x82'),_0xe8c2('0x83'),_0xe8c2('0x84'),'statecode',_0xe8c2('0x85'),_0xe8c2('0x86'),_0xe8c2('0x87'),'timezoneruleversionnumber',_0xe8c2('0x88'),_0xe8c2('0x89'),_0xe8c2('0x8a'),_0xe8c2('0x8b')];var _0x396029=_0x2fcbb5[_0xe8c2('0x8c')](_0x182e6c);return db[_0xe8c2('0x16')][_0xe8c2('0x35')]({'where':{'id':_0x31a75f[_0xe8c2('0x2e')]['id']},'attributes':['id',_0xe8c2('0x8d'),_0xe8c2('0x8e'),_0xe8c2('0x8f'),'tenantId',_0xe8c2('0x90'),'clientSecret','modernAuthentication'],'include':[{'model':db[_0xe8c2('0x91')],'as':_0xe8c2('0x91'),'attributes':['id',_0xe8c2('0x92'),_0xe8c2('0x93')]}]})[_0xe8c2('0xd')](handleEntityNotFound(_0x555b8e,null))[_0xe8c2('0xd')](function(_0xf035dd){if(_0xf035dd){if(_0xf035dd[_0xe8c2('0x94')]){_0xf035dd[_0xe8c2('0x95')]=_0xf035dd[_0xe8c2('0x91')][_0xe8c2('0x92')];_0x139f05=sanitizeRemoteUri(_0xf035dd[_0xe8c2('0x91')]['data7']);_0x52d15e=getWebApiUrl(_0x139f05);return _0xf035dd;}_0x139f05=sanitizeRemoteUri(_0xf035dd[_0xe8c2('0x8f')]);_0x52d15e=getWebApiUrl(_0x139f05);var _0xb9b70a={'method':'POST','uri':_0xe8c2('0x96')+_0xf035dd['tenantId']+_0xe8c2('0x97'),'form':{'client_id':_0xf035dd[_0xe8c2('0x90')],'resource':_0x139f05,'username':_0xf035dd[_0xe8c2('0x8d')],'password':_0xf035dd[_0xe8c2('0x8e')],'grant_type':_0xe8c2('0x8e'),'client_secret':_0xf035dd[_0xe8c2('0x98')]},'json':!![]};return rp(_0xb9b70a);}})[_0xe8c2('0xd')](function(_0x17571f){_0xd2964c=_0x17571f['access_token'];var _0x3f2bab={'method':'GET','uri':encodeURI(_0x52d15e+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x4da3d8+'\x27'),'headers':{'Authorization':_0xe8c2('0x99')+_0xd2964c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3f2bab);})[_0xe8c2('0xd')](function(_0xdaf81){var _0x54a3d9=_0xdaf81['value'][0x0];var _0x23244c=_0x54a3d9['MetadataId'];var _0x510717={'method':'GET','uri':_0x52d15e+'EntityDefinitions('+_0x23244c+_0xe8c2('0x9a'),'headers':{'Authorization':_0xe8c2('0x99')+_0xd2964c,'If-None-Match':null,'OData-Version':_0xe8c2('0x9b')},'json':!![]};return rp(_0x510717);})[_0xe8c2('0xd')](function(_0x22ac49){_0x4cac98=_0x22ac49;_0x3cf982=_0x4cac98['Attributes'];_0x3cf982=_['remove'](_0x3cf982,function(_0x17de7e){return!_0x396029[_0xe8c2('0x9c')](_0x17de7e[_0xe8c2('0x9d')]);});var _0x86ce=[];var _0xb7dfb9=[];_0x3cf982[_0xe8c2('0x9e')](function(_0x8f0914){if(_0x8f0914[_0xe8c2('0x9f')]){var _0x49d4b9=_0x8f0914[_0xe8c2('0x9f')]['substring'](_0x8f0914[_0xe8c2('0x9f')][_0xe8c2('0x43')]('.')+0x1);if(_0x49d4b9===_0xe8c2('0xa0')){_0x86ce[_0xe8c2('0xa1')](getSelectList(_0x52d15e,_0x2e8343,_0xb7dfb9,_0x4cac98[_0xe8c2('0xa2')],_0x8f0914[_0xe8c2('0xa2')],_0xd2964c));}}});return Promise[_0xe8c2('0xa3')](_0x86ce);})['then'](function(_0x4220ea){_0xfafdc3=_0x4220ea[0x0];var _0x45706f=[];var _0x1bda30=[];_0x3cf982[_0xe8c2('0x9e')](function(_0x506217){if(!_[_0xe8c2('0xa4')](_0x506217['@odata.type'])){var _0xf3ebd1=_0x506217[_0xe8c2('0x9f')][_0xe8c2('0x42')](_0x506217[_0xe8c2('0x9f')][_0xe8c2('0x43')]('.')+0x1);if(_0xf3ebd1===_0xe8c2('0xa5')){_0x45706f[_0xe8c2('0xa1')](getBooleanList(_0x52d15e,_0x2e8343,_0x1bda30,_0x4cac98[_0xe8c2('0xa2')],_0x506217[_0xe8c2('0xa2')],_0xd2964c));}}});return Promise['all'](_0x45706f);})[_0xe8c2('0xd')](function(_0xf318e3){_0x266201=_0xf318e3[0x0];var _0x2b46d0=[];var _0x385669=[];_0x3cf982[_0xe8c2('0x9e')](function(_0x30a4f0){if(_0x30a4f0[_0xe8c2('0x9f')]){var _0x46cc5b=_0x30a4f0[_0xe8c2('0x9f')][_0xe8c2('0x42')](_0x30a4f0['@odata.type'][_0xe8c2('0x43')]('.')+0x1);if(_0x46cc5b===_0xe8c2('0xa6')||_0x46cc5b==='DoubleAttributeMetadata'||_0x46cc5b==='BigIntAttributeMetadata'||_0x46cc5b===_0xe8c2('0xa7')||_0x46cc5b===_0xe8c2('0xa8')||_0x46cc5b==='DateTimeAttributeMetadata'||_0x46cc5b===_0xe8c2('0xa9')||_0x46cc5b==='EntityNameAttributeMetadata'||_0x46cc5b===_0xe8c2('0xaa')||_0x46cc5b==='DecimalAttributeMetadata'){_0x2b46d0[_0xe8c2('0xa1')](getInputList(_0x52d15e,_0x2e8343,_0x46cc5b,_0x385669,_0x4cac98[_0xe8c2('0xa2')],_0x30a4f0[_0xe8c2('0xa2')],_0xd2964c));}}});return Promise[_0xe8c2('0xa3')](_0x2b46d0);})[_0xe8c2('0xd')](function(_0x4c2da7){_0x284603=_0x4c2da7[0x0];var _0x5f519c=_0xfafdc3['concat'](_0x266201)[_0xe8c2('0x8c')](_0x284603);var _0x5396ea={'count':_0x5f519c[_0xe8c2('0x21')],'rows':_0x5f519c};return _0x5396ea;})[_0xe8c2('0xd')](respondWithResult(_0x555b8e,null))[_0xe8c2('0x31')](function(_0x4fa0aa){var _0x4adbf6=_0x31a75f[_0xe8c2('0x1b')]['test']?0x1f4:_0x4fa0aa[_0xe8c2('0xab')]||0x1f4;logger[_0xe8c2('0x12')](_0x4fa0aa[_0xe8c2('0xac')]);delete _0x4fa0aa[_0xe8c2('0x13')];if(_0x4adbf6===0x191){_0x4adbf6=0x190;}_0x555b8e[_0xe8c2('0xf')](_0x4adbf6)[_0xe8c2('0xad')](_0x31a75f[_0xe8c2('0x1b')][_0xe8c2('0xae')]?{'message':_0xe8c2('0xaf'),'statusCode':_0x4fa0aa[_0xe8c2('0xab')]}:_0x4fa0aa);});};function getSelectList(_0x34a10c,_0x4f8ffc,_0x30be97,_0x38a342,_0x4fb191,_0x4b2580){var _0x4b73ed={'method':'GET','uri':_0x34a10c+'EntityDefinitions('+_0x38a342+_0xe8c2('0xb0')+_0x4fb191+_0xe8c2('0xb1')+_0xe8c2('0xb2'),'headers':{'Authorization':_0xe8c2('0x99')+_0x4b2580,'If-None-Match':null,'OData-Version':_0xe8c2('0x9b')},'json':!![]};return rp(_0x4b73ed)['then'](function(_0x4ff9ec){var _0x3d5ddb=[];var _0x284ed1=_0x4ff9ec[_0xe8c2('0xb3')][_0xe8c2('0xb4')];_0x284ed1[_0xe8c2('0x9e')](function(_0x27691c){_0x3d5ddb[_0xe8c2('0xa1')]({'name':_0x27691c['Label'][_0xe8c2('0xb5')]['Label'],'value':String(_0x27691c[_0xe8c2('0xb6')])});});var _0x9871e7={'id':_0x4f8ffc+'_'+_0x4ff9ec[_0xe8c2('0x9d')],'name':_0x4ff9ec[_0xe8c2('0xb7')][_0xe8c2('0xb5')]['Label'],'custom':![],'options':_0x3d5ddb};_0x30be97[_0xe8c2('0xa1')](_0x9871e7);return _0x30be97;});}function getBooleanList(_0x236829,_0xfd90a1,_0x4365f6,_0x3f76a9,_0x360a57,_0x6e9235){var _0x1d6656={'method':'GET','uri':_0x236829+_0xe8c2('0xb8')+_0x3f76a9+_0xe8c2('0xb0')+_0x360a57+_0xe8c2('0xb9'),'headers':{'Authorization':_0xe8c2('0x99')+_0x6e9235,'If-None-Match':null,'OData-Version':_0xe8c2('0x9b')},'json':!![]};return rp(_0x1d6656)[_0xe8c2('0xd')](function(_0x27b21d){var _0x1a9a4b=[];_0x1a9a4b[_0xe8c2('0xa1')]({'name':_0x27b21d[_0xe8c2('0xb3')][_0xe8c2('0xba')][_0xe8c2('0xbb')][_0xe8c2('0xb5')][_0xe8c2('0xbb')],'value':_0xe8c2('0xbc')},{'name':_0x27b21d['OptionSet'][_0xe8c2('0xbd')][_0xe8c2('0xbb')][_0xe8c2('0xb5')][_0xe8c2('0xbb')],'value':'false'});var _0x421546={'id':_0xfd90a1+'_'+_0x27b21d[_0xe8c2('0x9d')],'name':_0x27b21d[_0xe8c2('0xb7')][_0xe8c2('0xb5')]['Label'],'custom':![],'options':_0x1a9a4b};_0x4365f6['push'](_0x421546);return _0x4365f6;});}function getInputList(_0x5d762a,_0x4f81a6,_0x5a4db7,_0x453362,_0x4df406,_0x4ed585,_0x5b42e9){var _0x134f02={'method':_0xe8c2('0xbe'),'uri':_0x5d762a+'EntityDefinitions('+_0x4df406+_0xe8c2('0xb0')+_0x4ed585+')/Microsoft.Dynamics.CRM.'+_0x5a4db7+_0xe8c2('0xbf'),'headers':{'Authorization':_0xe8c2('0x99')+_0x5b42e9,'If-None-Match':null,'OData-Version':_0xe8c2('0x9b')},'json':!![]};return rp(_0x134f02)[_0xe8c2('0xd')](function(_0x1b82b8){var _0x2d5fff={'id':_0x4f81a6+'_'+_0x1b82b8[_0xe8c2('0x9d')],'name':_0x1b82b8['DisplayName']['UserLocalizedLabel']?_0x1b82b8[_0xe8c2('0xb7')]['UserLocalizedLabel']['Label']:_0x1b82b8[_0xe8c2('0x9d')],'custom':![],'options':[]};_0x453362[_0xe8c2('0xa1')](_0x2d5fff);return _0x453362;});} \ No newline at end of file +var _0x339d=['limit','offset','count','status','Content-Range','update','then','end','sendStatus','error','name','map','Dynamics365Account','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','rawAttributes','options','create','body','find','destroy','getConfigurations','findOne','hasOwnProperty','nolimit','addConfiguration','AccountId','getSubjects','channel','type','Descriptions','Dynamics365Configuration','Dynamics365Field','Subjects','slice','substring','lastIndexOf','%s/api/data/v9.0/','incident','Incident','PhoneCall','description','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','remoteUri','POST','https://login.microsoftonline.com/','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode','stack','send',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName','TrueOption','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','lodash','../../components/parsers/qs','../../components/integrations/configuration','json','undefined'];(function(_0x147731,_0x45ab72){var _0x20fd7c=function(_0x2c5557){while(--_0x2c5557){_0x147731['push'](_0x147731['shift']());}};_0x20fd7c(++_0x45ab72);}(_0x339d,0xb2));var _0xd339=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x339d[_0x5f309e];return _0x487b5e;};'use strict';var rp=require('request-promise');var util=require(_0xd339('0x0'));var _=require(_0xd339('0x1'));var qs=require(_0xd339('0x2'));var logger=require('../../config/logger')('api');var db=require('../../mysqldb')['db'];var integrations=require(_0xd339('0x3'));function respondWithResult(_0x459c0e,_0x1ff8e0){_0x1ff8e0=_0x1ff8e0||0xc8;return function(_0x57169f){if(_0x57169f){return _0x459c0e['status'](_0x1ff8e0)[_0xd339('0x4')](_0x57169f);}};}function respondWithFilteredResult(_0x4db33a,_0x172fed){return function(_0x57762b){if(_0x57762b){var _0x472558=typeof _0x172fed['offset']===_0xd339('0x5')&&typeof _0x172fed[_0xd339('0x6')]==='undefined';var _0x4a1bf7=_0x57762b['count'];var _0x5a0f95=_0x472558?0x0:_0x172fed[_0xd339('0x7')];var _0xa785d=_0x472558?_0x57762b[_0xd339('0x8')]:_0x172fed[_0xd339('0x7')]+_0x172fed[_0xd339('0x6')];var _0x4310d3;if(_0xa785d>=_0x4a1bf7){_0xa785d=_0x4a1bf7;_0x4310d3=0xc8;}else{_0x4310d3=0xce;}_0x4db33a[_0xd339('0x9')](_0x4310d3);return _0x4db33a['set'](_0xd339('0xa'),_0x5a0f95+'-'+_0xa785d+'/'+_0x4a1bf7)[_0xd339('0x4')](_0x57762b);}return null;};}function saveUpdates(_0x24d292){return function(_0x4e8411){if(_0x4e8411){return _0x4e8411[_0xd339('0xb')](_0x24d292)[_0xd339('0xc')](function(_0x4a310d){return _0x4a310d;});}return null;};}function removeEntity(_0x7ad0fe){return function(_0x510d90){if(_0x510d90){return _0x510d90['destroy']()[_0xd339('0xc')](function(){_0x7ad0fe[_0xd339('0x9')](0xcc)[_0xd339('0xd')]();});}};}function handleEntityNotFound(_0x53de7e){return function(_0x35ca2d){if(!_0x35ca2d){_0x53de7e[_0xd339('0xe')](0x194);}return _0x35ca2d;};}function handleError(_0x466b71,_0x58b2ef){_0x58b2ef=_0x58b2ef||0x1f4;return function(_0x6dba82){logger[_0xd339('0xf')](_0x6dba82['stack']);if(_0x6dba82[_0xd339('0x10')]){delete _0x6dba82[_0xd339('0x10')];}_0x466b71['status'](_0x58b2ef)['send'](_0x6dba82);};}exports['index']=function(_0x2d9255,_0x522908){var _0x4b5619={},_0x4f6281={},_0x311bc7={'count':0x0,'rows':[]};var _0x474e0e=_[_0xd339('0x11')](db[_0xd339('0x12')]['rawAttributes'],function(_0x6b4465){return{'name':_0x6b4465['fieldName'],'type':_0x6b4465['type'][_0xd339('0x13')]};});_0x4f6281[_0xd339('0x14')]=_[_0xd339('0x11')](_0x474e0e,'name');_0x4f6281[_0xd339('0x15')]=_[_0xd339('0x16')](_0x2d9255[_0xd339('0x15')]);_0x4f6281[_0xd339('0x17')]=_['intersection'](_0x4f6281[_0xd339('0x14')],_0x4f6281[_0xd339('0x15')]);_0x4b5619['attributes']=_[_0xd339('0x18')](_0x4f6281[_0xd339('0x14')],qs[_0xd339('0x19')](_0x2d9255[_0xd339('0x15')][_0xd339('0x19')]));_0x4b5619[_0xd339('0x1a')]=_0x4b5619[_0xd339('0x1a')][_0xd339('0x1b')]?_0x4b5619[_0xd339('0x1a')]:_0x4f6281['model'];if(!_0x2d9255[_0xd339('0x15')]['hasOwnProperty']('nolimit')){_0x4b5619[_0xd339('0x6')]=qs['limit'](_0x2d9255[_0xd339('0x15')]['limit']);_0x4b5619[_0xd339('0x7')]=qs[_0xd339('0x7')](_0x2d9255[_0xd339('0x15')][_0xd339('0x7')]);}_0x4b5619[_0xd339('0x1c')]=qs[_0xd339('0x1d')](_0x2d9255[_0xd339('0x15')]['sort']);_0x4b5619[_0xd339('0x1e')]=qs['filters'](_[_0xd339('0x1f')](_0x2d9255[_0xd339('0x15')],_0x4f6281['filters']),_0x474e0e);if(_0x2d9255[_0xd339('0x15')]['filter']){_0x4b5619[_0xd339('0x1e')]=_[_0xd339('0x20')](_0x4b5619[_0xd339('0x1e')],{'$or':_[_0xd339('0x11')](_0x474e0e,function(_0x44b37e){if(_0x44b37e['type']!==_0xd339('0x21')){var _0x1e403a={};_0x1e403a[_0x44b37e['name']]={'$like':'%'+_0x2d9255[_0xd339('0x15')][_0xd339('0x22')]+'%'};return _0x1e403a;}})});}_0x4b5619=_[_0xd339('0x20')]({},_0x4b5619,_0x2d9255['options']);var _0x442fc0={'where':_0x4b5619[_0xd339('0x1e')]};return db['Dynamics365Account'][_0xd339('0x8')](_0x442fc0)['then'](function(_0x395b34){_0x311bc7[_0xd339('0x8')]=_0x395b34;if(_0x2d9255['query'][_0xd339('0x23')]){_0x4b5619[_0xd339('0x24')]=[{'all':!![]}];}return db[_0xd339('0x12')][_0xd339('0x25')](_0x4b5619);})[_0xd339('0xc')](function(_0x5c2fcd){_0x311bc7['rows']=_0x5c2fcd;return _0x311bc7;})[_0xd339('0xc')](respondWithFilteredResult(_0x522908,_0x4b5619))[_0xd339('0x26')](handleError(_0x522908,null));};exports[_0xd339('0x27')]=function(_0x2c9708,_0x24da29){var _0x4d8a0b={'raw':![],'where':{'id':_0x2c9708[_0xd339('0x28')]['id']}},_0x442d04={};_0x442d04['model']=_[_0xd339('0x16')](db['Dynamics365Account'][_0xd339('0x29')]);_0x442d04[_0xd339('0x15')]=_[_0xd339('0x16')](_0x2c9708[_0xd339('0x15')]);_0x442d04[_0xd339('0x17')]=_['intersection'](_0x442d04['model'],_0x442d04[_0xd339('0x15')]);_0x4d8a0b[_0xd339('0x1a')]=_[_0xd339('0x18')](_0x442d04[_0xd339('0x14')],qs['fields'](_0x2c9708['query']['fields']));_0x4d8a0b[_0xd339('0x1a')]=_0x4d8a0b[_0xd339('0x1a')][_0xd339('0x1b')]?_0x4d8a0b[_0xd339('0x1a')]:_0x442d04[_0xd339('0x14')];if(_0x2c9708[_0xd339('0x15')][_0xd339('0x23')]){_0x4d8a0b[_0xd339('0x24')]=[{'all':!![]}];}_0x4d8a0b=_[_0xd339('0x20')]({},_0x4d8a0b,_0x2c9708[_0xd339('0x2a')]);return db[_0xd339('0x12')]['find'](_0x4d8a0b)[_0xd339('0xc')](handleEntityNotFound(_0x24da29,null))[_0xd339('0xc')](respondWithResult(_0x24da29,null))[_0xd339('0x26')](handleError(_0x24da29,null));};exports[_0xd339('0x2b')]=function(_0x3e057d,_0x4ad8e5){return db['Dynamics365Account'][_0xd339('0x2b')](_0x3e057d[_0xd339('0x2c')],{})[_0xd339('0xc')](respondWithResult(_0x4ad8e5,0xc9))[_0xd339('0x26')](handleError(_0x4ad8e5,null));};exports['update']=function(_0x202da9,_0x2e9b2f){if(_0x202da9['body']['id']){delete _0x202da9[_0xd339('0x2c')]['id'];}return db[_0xd339('0x12')][_0xd339('0x2d')]({'where':{'id':_0x202da9['params']['id']}})['then'](handleEntityNotFound(_0x2e9b2f,null))[_0xd339('0xc')](saveUpdates(_0x202da9[_0xd339('0x2c')],null))[_0xd339('0xc')](respondWithResult(_0x2e9b2f,null))[_0xd339('0x26')](handleError(_0x2e9b2f,null));};exports[_0xd339('0x2e')]=function(_0x52ede2,_0x688b90){return db[_0xd339('0x12')][_0xd339('0x2d')]({'where':{'id':_0x52ede2[_0xd339('0x28')]['id']}})[_0xd339('0xc')](handleEntityNotFound(_0x688b90,null))[_0xd339('0xc')](removeEntity(_0x688b90,null))['catch'](handleError(_0x688b90,null));};exports[_0xd339('0x2f')]=function(_0x1c882a,_0x438258){var _0x34c7c3={};var _0x29c2d2={};var _0x240a8a;var _0x280440;return db[_0xd339('0x12')][_0xd339('0x30')]({'where':{'id':_0x1c882a[_0xd339('0x28')]['id']}})[_0xd339('0xc')](handleEntityNotFound(_0x438258,null))['then'](function(_0x3cd61d){if(_0x3cd61d){_0x240a8a=_0x3cd61d;_0x29c2d2['model']=_[_0xd339('0x16')](db['Dynamics365Configuration'][_0xd339('0x29')]);_0x29c2d2[_0xd339('0x15')]=_[_0xd339('0x16')](_0x1c882a['query']);_0x29c2d2[_0xd339('0x17')]=_['intersection'](_0x29c2d2['model'],_0x29c2d2['query']);_0x34c7c3[_0xd339('0x1a')]=_[_0xd339('0x18')](_0x29c2d2[_0xd339('0x14')],qs[_0xd339('0x19')](_0x1c882a[_0xd339('0x15')][_0xd339('0x19')]));_0x34c7c3[_0xd339('0x1a')]=_0x34c7c3[_0xd339('0x1a')][_0xd339('0x1b')]?_0x34c7c3[_0xd339('0x1a')]:_0x29c2d2[_0xd339('0x14')];_0x34c7c3['order']=qs[_0xd339('0x1d')](_0x1c882a[_0xd339('0x15')][_0xd339('0x1d')]);_0x34c7c3[_0xd339('0x1e')]=qs[_0xd339('0x17')](_[_0xd339('0x1f')](_0x1c882a['query'],_0x29c2d2['filters']));if(_0x1c882a[_0xd339('0x15')]['filter']){_0x34c7c3[_0xd339('0x1e')]=_['merge'](_0x34c7c3['where'],{'$or':_['map'](_0x34c7c3[_0xd339('0x1a')],function(_0x40fbbf){var _0x5ecdd0={};_0x5ecdd0[_0x40fbbf]={'$like':'%'+_0x1c882a[_0xd339('0x15')][_0xd339('0x22')]+'%'};return _0x5ecdd0;})});}_0x34c7c3=_['merge']({},_0x34c7c3,_0x1c882a[_0xd339('0x2a')]);return _0x240a8a[_0xd339('0x2f')](_0x34c7c3);}})[_0xd339('0xc')](function(_0x412084){if(_0x412084){_0x280440=_0x412084['length'];if(!_0x1c882a['query'][_0xd339('0x31')](_0xd339('0x32'))){_0x34c7c3[_0xd339('0x6')]=qs[_0xd339('0x6')](_0x1c882a[_0xd339('0x15')][_0xd339('0x6')]);_0x34c7c3[_0xd339('0x7')]=qs['offset'](_0x1c882a[_0xd339('0x15')]['offset']);}return _0x240a8a[_0xd339('0x2f')](_0x34c7c3);}})[_0xd339('0xc')](function(_0x1f3747){if(_0x1f3747){return _0x1f3747?{'count':_0x280440,'rows':_0x1f3747}:null;}})[_0xd339('0xc')](respondWithResult(_0x438258,null))['catch'](handleError(_0x438258,null));};exports[_0xd339('0x33')]=function(_0x547ec7,_0x4a00ae){if(_0x547ec7[_0xd339('0x2c')]['id']){delete _0x547ec7[_0xd339('0x2c')]['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x547ec7['params']['id']}})[_0xd339('0xc')](handleEntityNotFound(_0x4a00ae,null))['then'](function(_0x3e81e4){if(_0x3e81e4){_0x547ec7[_0xd339('0x2c')][_0xd339('0x34')]=_0x3e81e4['id'];_0x547ec7[_0xd339('0x2c')]['Subjects']=integrations[_0xd339('0x35')](_0x547ec7[_0xd339('0x2c')][_0xd339('0x36')],_0x547ec7['body'][_0xd339('0x37')]);_0x547ec7['body'][_0xd339('0x38')]=integrations['getDescriptions'](_0x547ec7[_0xd339('0x2c')][_0xd339('0x36')],_0x547ec7[_0xd339('0x2c')][_0xd339('0x37')]);return db[_0xd339('0x39')][_0xd339('0x2b')](_0x547ec7['body'],{'include':[{'model':db[_0xd339('0x3a')],'as':_0xd339('0x3b')},{'model':db[_0xd339('0x3a')],'as':_0xd339('0x38')}]});}return null;})[_0xd339('0xc')](respondWithResult(_0x4a00ae,null))[_0xd339('0x26')](handleError(_0x4a00ae,null));};function sanitizeRemoteUri(_0x14fa63){var _0x3c19b4=_0x14fa63[_0xd339('0x3c')](-0x1);if(_0x3c19b4==='/')return _0x14fa63[_0xd339('0x3d')](0x0,_0x14fa63[_0xd339('0x3e')](_0x3c19b4));return _0x14fa63;}function getWebApiUrl(_0x10fef1){return util['format'](_0xd339('0x3f'),_0x10fef1);}exports['getFields']=function(_0x3bea88,_0x5ceff4){var _0xe0793c=_0x3bea88[_0xd339('0x15')]['ticketType'];var _0x4bf480=_0xe0793c===_0xd339('0x40')?_0xd339('0x41'):_0xd339('0x42');var _0x1ea969='';var _0x1fe2d3='';var _0x40549c='';var _0x520b7a='';var _0x4bb130='';var _0x2ff4df='';var _0x4d810d='';var _0x39943f='';var _0x2fa4eb=['title',_0xd339('0x43'),'customerid',_0xd339('0x44'),_0xd339('0x45'),_0xd339('0x46'),_0xd339('0x47'),_0xd339('0x48'),'directioncode',_0xd339('0x49')];var _0x44549d=[_0xd339('0x4a'),_0xd339('0x4b'),_0xd339('0x4c'),_0xd339('0x4d'),_0xd339('0x4e'),'contactidyominame',_0xd339('0x4f'),_0xd339('0x50'),_0xd339('0x51'),'createdbyexternalpartyyominame',_0xd339('0x52'),_0xd339('0x53'),'createdon',_0xd339('0x54'),'createdonbehalfbyyominame',_0xd339('0x55'),_0xd339('0x56'),_0xd339('0x57'),'emailaddress',_0xd339('0x58'),_0xd339('0x59'),'entityimage_url',_0xd339('0x5a'),_0xd339('0x5b'),_0xd339('0x5c'),_0xd339('0x5d'),_0xd339('0x5e'),_0xd339('0x5f'),_0xd339('0x60'),_0xd339('0x61'),_0xd339('0x62'),'modifiedbyexternalpartyname','modifiedbyexternalpartyyominame',_0xd339('0x63'),_0xd339('0x64'),'modifiedon',_0xd339('0x65'),'modifiedonbehalfbyyominame','msdyn_incidenttypename',_0xd339('0x66'),_0xd339('0x67'),_0xd339('0x68'),_0xd339('0x69'),_0xd339('0x6a'),'owneridtype',_0xd339('0x6b'),'parentcaseidname','primarycontactidname',_0xd339('0x6c'),_0xd339('0x6d'),_0xd339('0x6e'),'productserialnumber',_0xd339('0x6f'),_0xd339('0x70'),_0xd339('0x71'),'responsiblecontactidname',_0xd339('0x72'),_0xd339('0x73'),_0xd339('0x74'),'slaname',_0xd339('0x75'),_0xd339('0x76'),_0xd339('0x77'),_0xd339('0x78'),_0xd339('0x79'),_0xd339('0x7a'),_0xd339('0x7b'),_0xd339('0x7c'),_0xd339('0x7d'),_0xd339('0x7e')];var _0x194514=_0x2fa4eb[_0xd339('0x7f')](_0x44549d);return db['Dynamics365Account'][_0xd339('0x30')]({'where':{'id':_0x3bea88[_0xd339('0x28')]['id']},'attributes':['id',_0xd339('0x80'),_0xd339('0x81'),'remoteUri',_0xd339('0x82'),_0xd339('0x83'),_0xd339('0x84'),_0xd339('0x85')],'include':[{'model':db[_0xd339('0x86')],'as':'CloudProvider','attributes':['id',_0xd339('0x87'),_0xd339('0x88')]}]})['then'](handleEntityNotFound(_0x5ceff4,null))[_0xd339('0xc')](function(_0xb2d901){if(_0xb2d901){if(_0xb2d901[_0xd339('0x85')]){_0xb2d901[_0xd339('0x89')]=_0xb2d901['CloudProvider'][_0xd339('0x87')];_0x39943f=sanitizeRemoteUri(_0xb2d901['CloudProvider']['data7']);_0x4d810d=getWebApiUrl(_0x39943f);return _0xb2d901;}_0x39943f=sanitizeRemoteUri(_0xb2d901[_0xd339('0x8a')]);_0x4d810d=getWebApiUrl(_0x39943f);var _0x5c65e8={'method':_0xd339('0x8b'),'uri':_0xd339('0x8c')+_0xb2d901['tenantId']+_0xd339('0x8d'),'form':{'client_id':_0xb2d901[_0xd339('0x83')],'resource':_0x39943f,'username':_0xb2d901['username'],'password':_0xb2d901[_0xd339('0x81')],'grant_type':'password','client_secret':_0xb2d901[_0xd339('0x84')]},'json':!![]};return rp(_0x5c65e8);}})[_0xd339('0xc')](function(_0x484312){_0x2ff4df=_0x484312['access_token'];var _0x3cbf19={'method':_0xd339('0x8e'),'uri':encodeURI(_0x4d810d+_0xd339('0x8f')+_0x4bf480+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x2ff4df,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3cbf19);})[_0xd339('0xc')](function(_0x5d468b){var _0x232520=_0x5d468b[_0xd339('0x90')][0x0];var _0x3482a0=_0x232520[_0xd339('0x91')];var _0x137bd2={'method':_0xd339('0x8e'),'uri':_0x4d810d+_0xd339('0x92')+_0x3482a0+_0xd339('0x93'),'headers':{'Authorization':'Bearer\x20'+_0x2ff4df,'If-None-Match':null,'OData-Version':_0xd339('0x94')},'json':!![]};return rp(_0x137bd2);})['then'](function(_0xe8b48){_0x1ea969=_0xe8b48;_0x1fe2d3=_0x1ea969['Attributes'];_0x1fe2d3=_[_0xd339('0x95')](_0x1fe2d3,function(_0x40e41e){return!_0x194514[_0xd339('0x96')](_0x40e41e['LogicalName']);});var _0x4ca94e=[];var _0x1f2a1a=[];_0x1fe2d3[_0xd339('0x97')](function(_0x216ebb){if(_0x216ebb[_0xd339('0x98')]){var _0xbd0e05=_0x216ebb['@odata.type'][_0xd339('0x3d')](_0x216ebb[_0xd339('0x98')][_0xd339('0x3e')]('.')+0x1);if(_0xbd0e05===_0xd339('0x99')){_0x4ca94e[_0xd339('0x9a')](getSelectList(_0x4d810d,_0xe0793c,_0x1f2a1a,_0x1ea969['MetadataId'],_0x216ebb[_0xd339('0x91')],_0x2ff4df));}}});return Promise[_0xd339('0x9b')](_0x4ca94e);})[_0xd339('0xc')](function(_0x2800d4){_0x40549c=_0x2800d4[0x0];var _0x5dda16=[];var _0x51c48c=[];_0x1fe2d3[_0xd339('0x97')](function(_0x2edfc0){if(!_['isNil'](_0x2edfc0[_0xd339('0x98')])){var _0x4e0abc=_0x2edfc0['@odata.type'][_0xd339('0x3d')](_0x2edfc0[_0xd339('0x98')][_0xd339('0x3e')]('.')+0x1);if(_0x4e0abc===_0xd339('0x9c')){_0x5dda16['push'](getBooleanList(_0x4d810d,_0xe0793c,_0x51c48c,_0x1ea969[_0xd339('0x91')],_0x2edfc0[_0xd339('0x91')],_0x2ff4df));}}});return Promise['all'](_0x5dda16);})[_0xd339('0xc')](function(_0x17bdf8){_0x520b7a=_0x17bdf8[0x0];var _0x7ad92c=[];var _0x4a9229=[];_0x1fe2d3[_0xd339('0x97')](function(_0x2aa4d7){if(_0x2aa4d7['@odata.type']){var _0x2e0c6e=_0x2aa4d7['@odata.type'][_0xd339('0x3d')](_0x2aa4d7[_0xd339('0x98')][_0xd339('0x3e')]('.')+0x1);if(_0x2e0c6e===_0xd339('0x9d')||_0x2e0c6e===_0xd339('0x9e')||_0x2e0c6e===_0xd339('0x9f')||_0x2e0c6e===_0xd339('0xa0')||_0x2e0c6e===_0xd339('0xa1')||_0x2e0c6e===_0xd339('0xa2')||_0x2e0c6e==='StatusAttributeMetadata'||_0x2e0c6e===_0xd339('0xa3')||_0x2e0c6e===_0xd339('0xa4')||_0x2e0c6e==='DecimalAttributeMetadata'){_0x7ad92c[_0xd339('0x9a')](getInputList(_0x4d810d,_0xe0793c,_0x2e0c6e,_0x4a9229,_0x1ea969[_0xd339('0x91')],_0x2aa4d7[_0xd339('0x91')],_0x2ff4df));}}});return Promise[_0xd339('0x9b')](_0x7ad92c);})[_0xd339('0xc')](function(_0x2f33f0){_0x4bb130=_0x2f33f0[0x0];var _0x1bc483=_0x40549c['concat'](_0x520b7a)['concat'](_0x4bb130);var _0x599f8f={'count':_0x1bc483['length'],'rows':_0x1bc483};return _0x599f8f;})[_0xd339('0xc')](respondWithResult(_0x5ceff4,null))[_0xd339('0x26')](function(_0x2e62ef){var _0x44754d=_0x3bea88['query'][_0xd339('0xa5')]?0x1f4:_0x2e62ef[_0xd339('0xa6')]||0x1f4;logger['error'](_0x2e62ef[_0xd339('0xa7')]);delete _0x2e62ef['name'];if(_0x44754d===0x191){_0x44754d=0x190;}_0x5ceff4[_0xd339('0x9')](_0x44754d)[_0xd339('0xa8')](_0x3bea88[_0xd339('0x15')][_0xd339('0xa5')]?{'message':'Wrong\x20credentials','statusCode':_0x2e62ef[_0xd339('0xa6')]}:_0x2e62ef);});};function getSelectList(_0x484638,_0x498e06,_0x351a83,_0x4da18f,_0x5d93c1,_0x39d9cb){var _0x5a290b={'method':_0xd339('0x8e'),'uri':_0x484638+_0xd339('0x92')+_0x4da18f+_0xd339('0xa9')+_0x5d93c1+_0xd339('0xaa')+_0xd339('0xab'),'headers':{'Authorization':_0xd339('0xac')+_0x39d9cb,'If-None-Match':null,'OData-Version':_0xd339('0x94')},'json':!![]};return rp(_0x5a290b)['then'](function(_0x260a71){var _0x214cc8=[];var _0x110a14=_0x260a71[_0xd339('0xad')][_0xd339('0xae')];_0x110a14[_0xd339('0x97')](function(_0xa61c82){_0x214cc8[_0xd339('0x9a')]({'name':_0xa61c82[_0xd339('0xaf')][_0xd339('0xb0')][_0xd339('0xaf')],'value':String(_0xa61c82[_0xd339('0xb1')])});});var _0x564732={'id':_0x498e06+'_'+_0x260a71[_0xd339('0xb2')],'name':_0x260a71[_0xd339('0xb3')]['UserLocalizedLabel'][_0xd339('0xaf')],'custom':![],'options':_0x214cc8};_0x351a83[_0xd339('0x9a')](_0x564732);return _0x351a83;});}function getBooleanList(_0xf07c39,_0x3cdb07,_0x31f03a,_0x249d92,_0x5f5525,_0x3037de){var _0x58262c={'method':_0xd339('0x8e'),'uri':_0xf07c39+_0xd339('0x92')+_0x249d92+_0xd339('0xa9')+_0x5f5525+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xd339('0xac')+_0x3037de,'If-None-Match':null,'OData-Version':_0xd339('0x94')},'json':!![]};return rp(_0x58262c)[_0xd339('0xc')](function(_0x41f713){var _0x37e662=[];_0x37e662[_0xd339('0x9a')]({'name':_0x41f713[_0xd339('0xad')][_0xd339('0xb4')][_0xd339('0xaf')][_0xd339('0xb0')][_0xd339('0xaf')],'value':'true'},{'name':_0x41f713[_0xd339('0xad')][_0xd339('0xb5')][_0xd339('0xaf')][_0xd339('0xb0')]['Label'],'value':'false'});var _0x118d76={'id':_0x3cdb07+'_'+_0x41f713['LogicalName'],'name':_0x41f713[_0xd339('0xb3')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x37e662};_0x31f03a[_0xd339('0x9a')](_0x118d76);return _0x31f03a;});}function getInputList(_0x389a5a,_0x47d751,_0x1d5ff9,_0x2c8a00,_0x3b5e47,_0x5b57d5,_0x36fc7d){var _0x2cff30={'method':_0xd339('0x8e'),'uri':_0x389a5a+_0xd339('0x92')+_0x3b5e47+_0xd339('0xa9')+_0x5b57d5+_0xd339('0xb6')+_0x1d5ff9+_0xd339('0xb7'),'headers':{'Authorization':_0xd339('0xac')+_0x36fc7d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2cff30)[_0xd339('0xc')](function(_0x26f7bb){var _0x442f73={'id':_0x47d751+'_'+_0x26f7bb[_0xd339('0xb2')],'name':_0x26f7bb['DisplayName'][_0xd339('0xb0')]?_0x26f7bb[_0xd339('0xb3')][_0xd339('0xb0')][_0xd339('0xaf')]:_0x26f7bb[_0xd339('0xb2')],'custom':![],'options':[]};_0x2c8a00[_0xd339('0x9a')](_0x442f73);return _0x2c8a00;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 5da173a..601640b 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0xb83ec2,_0x18e73b){var _0x4d2fbf=function(_0x16538a){while(--_0x16538a){_0xb83ec2['push'](_0xb83ec2['shift']());}};_0x4d2fbf(++_0x18e73b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x2208c2,_0x19f845){var _0xf73523=function(_0x15c0f7){while(--_0x15c0f7){_0x2208c2['push'](_0x2208c2['shift']());}};_0xf73523(++_0x19f845);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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'));var integrations=require(_0x0a9e('0x8'));module['exports']=function(_0x219af0,_0x441e3a){return _0x219af0[_0x0a9e('0x9')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','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 1b617be..75a745d 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 _0x91d6=['attributes','include','map','model','stringify','GetDynamics365Account','ShowDynamics365Account','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','Dynamics365Account','findAll','options','where'];(function(_0x13152a,_0x1334fc){var _0x63b0a4=function(_0x1dbd86){while(--_0x1dbd86){_0x13152a['push'](_0x13152a['shift']());}};_0x63b0a4(++_0x1334fc);}(_0x91d6,0x11f));var _0x691d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x91d6[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x691d('0x0'));var BPromise=require(_0x691d('0x1'));var rs=require(_0x691d('0x2'));var fs=require('fs');var Redis=require(_0x691d('0x3'));var db=require(_0x691d('0x4'))['db'];var utils=require(_0x691d('0x5'));var logger=require('../../config/logger')(_0x691d('0x6'));var config=require(_0x691d('0x7'));var jayson=require(_0x691d('0x8'));var client=jayson[_0x691d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c6c8e,_0x50780c,_0x25c5d1){return new BPromise(function(_0x432d2d,_0x3a9dca){return client['request'](_0x3c6c8e,_0x25c5d1)[_0x691d('0xa')](function(_0x317a44){logger['info'](_0x691d('0xb'),_0x50780c,_0x691d('0xc'));logger['debug'](_0x691d('0xd'),_0x50780c,'request\x20sent',JSON['stringify'](_0x317a44));if(_0x317a44['error']){if(_0x317a44[_0x691d('0xe')]['code']===0x1f4){logger['error'](_0x691d('0xb'),_0x50780c,_0x317a44['error']['message']);return _0x3a9dca(_0x317a44[_0x691d('0xe')]['message']);}logger[_0x691d('0xe')](_0x691d('0xb'),_0x50780c,_0x317a44[_0x691d('0xe')][_0x691d('0xf')]);return _0x432d2d(_0x317a44[_0x691d('0xe')][_0x691d('0xf')]);}else{logger[_0x691d('0x10')](_0x691d('0xb'),_0x50780c,_0x691d('0xc'));_0x432d2d(_0x317a44[_0x691d('0x11')][_0x691d('0xf')]);}})[_0x691d('0x12')](function(_0x3c5073){logger[_0x691d('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x50780c,_0x3c5073);_0x3a9dca(_0x3c5073);});});}exports['GetDynamics365Account']=function(_0x522fc3){var _0x534741=this;return new Promise(function(_0x219b66,_0xe3e9bf){return db[_0x691d('0x13')][_0x691d('0x14')]({'raw':_0x522fc3[_0x691d('0x15')]?_0x522fc3[_0x691d('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x522fc3[_0x691d('0x15')]?_0x522fc3['options'][_0x691d('0x16')]||null:null,'attributes':_0x522fc3['options']?_0x522fc3[_0x691d('0x15')][_0x691d('0x17')]||null:null,'limit':_0x522fc3[_0x691d('0x15')]?_0x522fc3[_0x691d('0x15')]['limit']||null:null,'include':_0x522fc3[_0x691d('0x15')]?_0x522fc3['options'][_0x691d('0x18')]?_[_0x691d('0x19')](_0x522fc3[_0x691d('0x15')][_0x691d('0x18')],function(_0x537723){return{'model':db[_0x537723['model']],'as':_0x537723['as'],'attributes':_0x537723[_0x691d('0x17')],'include':_0x537723[_0x691d('0x18')]?_[_0x691d('0x19')](_0x537723['include'],function(_0x3f88e8){return{'model':db[_0x3f88e8[_0x691d('0x1a')]],'as':_0x3f88e8['as'],'attributes':_0x3f88e8['attributes'],'include':_0x3f88e8[_0x691d('0x18')]?_[_0x691d('0x19')](_0x3f88e8[_0x691d('0x18')],function(_0x24674a){return{'model':db[_0x24674a[_0x691d('0x1a')]],'as':_0x24674a['as'],'attributes':_0x24674a[_0x691d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x691d('0xa')](function(_0x5a4db4){logger[_0x691d('0x10')]('GetDynamics365Account',_0x522fc3);logger['debug']('GetDynamics365Account',_0x522fc3,JSON[_0x691d('0x1b')](_0x5a4db4));_0x219b66(_0x5a4db4);})[_0x691d('0x12')](function(_0x297736){logger[_0x691d('0xe')](_0x691d('0x1c'),_0x297736[_0x691d('0xf')],_0x522fc3);_0xe3e9bf(_0x534741[_0x691d('0xe')](0x1f4,_0x297736[_0x691d('0xf')]));});});};exports[_0x691d('0x1d')]=function(_0x35f8de){var _0x2094d8=this;return new Promise(function(_0x2ef8e9,_0x118fae){return db[_0x691d('0x13')][_0x691d('0x1e')]({'raw':_0x35f8de['options']?_0x35f8de['options']['raw']===undefined?!![]:![]:!![],'where':_0x35f8de[_0x691d('0x15')]?_0x35f8de[_0x691d('0x15')]['where']||null:null,'attributes':_0x35f8de[_0x691d('0x15')]?_0x35f8de['options'][_0x691d('0x17')]||null:null,'include':_0x35f8de[_0x691d('0x15')]?_0x35f8de[_0x691d('0x15')][_0x691d('0x18')]?_[_0x691d('0x19')](_0x35f8de[_0x691d('0x15')][_0x691d('0x18')],function(_0x5861f9){return{'model':db[_0x5861f9[_0x691d('0x1a')]],'as':_0x5861f9['as'],'attributes':_0x5861f9[_0x691d('0x17')],'include':_0x5861f9['include']?_[_0x691d('0x19')](_0x5861f9['include'],function(_0x4407ff){return{'model':db[_0x4407ff[_0x691d('0x1a')]],'as':_0x4407ff['as'],'attributes':_0x4407ff[_0x691d('0x17')],'include':_0x4407ff[_0x691d('0x18')]?_[_0x691d('0x19')](_0x4407ff[_0x691d('0x18')],function(_0x52675e){return{'model':db[_0x52675e['model']],'as':_0x52675e['as'],'attributes':_0x52675e[_0x691d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x691d('0xa')](function(_0x29a625){logger[_0x691d('0x10')](_0x691d('0x1d'),_0x35f8de);logger['debug'](_0x691d('0x1d'),_0x35f8de,JSON[_0x691d('0x1b')](_0x29a625));_0x2ef8e9(_0x29a625);})['catch'](function(_0x391882){logger[_0x691d('0xe')](_0x691d('0x1d'),_0x391882[_0x691d('0xf')],_0x35f8de);_0x118fae(_0x2094d8['error'](0x1f4,_0x391882['message']));});});}; \ No newline at end of file +var _0xfff9=['stringify','code','error','message','result','GetDynamics365Account','options','raw','where','attributes','include','map','model','catch','ShowDynamics365Account','lodash','util','moment','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s'];(function(_0x40e442,_0x3f5f5e){var _0x1e3687=function(_0x12a70d){while(--_0x12a70d){_0x40e442['push'](_0x40e442['shift']());}};_0x1e3687(++_0x3f5f5e);}(_0xfff9,0xa5));var _0x9fff=function(_0x7f5123,_0x3062c5){_0x7f5123=_0x7f5123-0x0;var _0x10a02a=_0xfff9[_0x7f5123];return _0x10a02a;};'use strict';var _=require(_0x9fff('0x0'));var util=require(_0x9fff('0x1'));var moment=require(_0x9fff('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('../../config/utils');var logger=require(_0x9fff('0x3'))(_0x9fff('0x4'));var config=require(_0x9fff('0x5'));var jayson=require(_0x9fff('0x6'));var client=jayson[_0x9fff('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42f24a,_0x1974dd,_0x586fac){return new BPromise(function(_0x3101c3,_0xef54be){return client[_0x9fff('0x8')](_0x42f24a,_0x586fac)[_0x9fff('0x9')](function(_0x395905){logger[_0x9fff('0xa')](_0x9fff('0xb'),_0x1974dd,_0x9fff('0xc'));logger[_0x9fff('0xd')](_0x9fff('0xe'),_0x1974dd,'request\x20sent',JSON[_0x9fff('0xf')](_0x395905));if(_0x395905['error']){if(_0x395905['error'][_0x9fff('0x10')]===0x1f4){logger[_0x9fff('0x11')](_0x9fff('0xb'),_0x1974dd,_0x395905[_0x9fff('0x11')]['message']);return _0xef54be(_0x395905['error'][_0x9fff('0x12')]);}logger[_0x9fff('0x11')](_0x9fff('0xb'),_0x1974dd,_0x395905[_0x9fff('0x11')]['message']);return _0x3101c3(_0x395905[_0x9fff('0x11')][_0x9fff('0x12')]);}else{logger[_0x9fff('0xa')](_0x9fff('0xb'),_0x1974dd,'request\x20sent');_0x3101c3(_0x395905[_0x9fff('0x13')][_0x9fff('0x12')]);}})['catch'](function(_0x3f4a80){logger['error'](_0x9fff('0xb'),_0x1974dd,_0x3f4a80);_0xef54be(_0x3f4a80);});});}exports[_0x9fff('0x14')]=function(_0x21ee30){var _0x3742ed=this;return new Promise(function(_0x122cf7,_0x3abe5c){return db['Dynamics365Account']['findAll']({'raw':_0x21ee30[_0x9fff('0x15')]?_0x21ee30[_0x9fff('0x15')][_0x9fff('0x16')]===undefined?!![]:![]:!![],'where':_0x21ee30[_0x9fff('0x15')]?_0x21ee30[_0x9fff('0x15')][_0x9fff('0x17')]||null:null,'attributes':_0x21ee30[_0x9fff('0x15')]?_0x21ee30[_0x9fff('0x15')][_0x9fff('0x18')]||null:null,'limit':_0x21ee30[_0x9fff('0x15')]?_0x21ee30[_0x9fff('0x15')]['limit']||null:null,'include':_0x21ee30[_0x9fff('0x15')]?_0x21ee30[_0x9fff('0x15')][_0x9fff('0x19')]?_[_0x9fff('0x1a')](_0x21ee30[_0x9fff('0x15')]['include'],function(_0x1bbacc){return{'model':db[_0x1bbacc[_0x9fff('0x1b')]],'as':_0x1bbacc['as'],'attributes':_0x1bbacc['attributes'],'include':_0x1bbacc['include']?_[_0x9fff('0x1a')](_0x1bbacc[_0x9fff('0x19')],function(_0x293ee9){return{'model':db[_0x293ee9[_0x9fff('0x1b')]],'as':_0x293ee9['as'],'attributes':_0x293ee9[_0x9fff('0x18')],'include':_0x293ee9[_0x9fff('0x19')]?_[_0x9fff('0x1a')](_0x293ee9[_0x9fff('0x19')],function(_0x12f9c0){return{'model':db[_0x12f9c0['model']],'as':_0x12f9c0['as'],'attributes':_0x12f9c0[_0x9fff('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x340d0c){logger[_0x9fff('0xa')](_0x9fff('0x14'),_0x21ee30);logger['debug']('GetDynamics365Account',_0x21ee30,JSON['stringify'](_0x340d0c));_0x122cf7(_0x340d0c);})[_0x9fff('0x1c')](function(_0x4b57fc){logger['error']('GetDynamics365Account',_0x4b57fc['message'],_0x21ee30);_0x3abe5c(_0x3742ed[_0x9fff('0x11')](0x1f4,_0x4b57fc[_0x9fff('0x12')]));});});};exports[_0x9fff('0x1d')]=function(_0x8db71){var _0x3ec46b=this;return new Promise(function(_0x318c38,_0x1ef6b7){return db['Dynamics365Account']['find']({'raw':_0x8db71['options']?_0x8db71[_0x9fff('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x8db71[_0x9fff('0x15')]?_0x8db71[_0x9fff('0x15')][_0x9fff('0x17')]||null:null,'attributes':_0x8db71['options']?_0x8db71['options'][_0x9fff('0x18')]||null:null,'include':_0x8db71[_0x9fff('0x15')]?_0x8db71[_0x9fff('0x15')][_0x9fff('0x19')]?_[_0x9fff('0x1a')](_0x8db71['options'][_0x9fff('0x19')],function(_0x694912){return{'model':db[_0x694912[_0x9fff('0x1b')]],'as':_0x694912['as'],'attributes':_0x694912[_0x9fff('0x18')],'include':_0x694912[_0x9fff('0x19')]?_[_0x9fff('0x1a')](_0x694912[_0x9fff('0x19')],function(_0x33d43b){return{'model':db[_0x33d43b[_0x9fff('0x1b')]],'as':_0x33d43b['as'],'attributes':_0x33d43b[_0x9fff('0x18')],'include':_0x33d43b[_0x9fff('0x19')]?_[_0x9fff('0x1a')](_0x33d43b[_0x9fff('0x19')],function(_0x3961ad){return{'model':db[_0x3961ad['model']],'as':_0x3961ad['as'],'attributes':_0x3961ad[_0x9fff('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9fff('0x9')](function(_0x4e274b){logger['info'](_0x9fff('0x1d'),_0x8db71);logger[_0x9fff('0xd')](_0x9fff('0x1d'),_0x8db71,JSON[_0x9fff('0xf')](_0x4e274b));_0x318c38(_0x4e274b);})[_0x9fff('0x1c')](function(_0x2435bf){logger[_0x9fff('0x11')](_0x9fff('0x1d'),_0x2435bf[_0x9fff('0x12')],_0x8db71);_0x1ef6b7(_0x3ec46b['error'](0x1f4,_0x2435bf[_0x9fff('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 7e9fa38..580c623 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 _0x1275=['create','put','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','post'];(function(_0x5d6392,_0x271a01){var _0x5808ab=function(_0x1851a6){while(--_0x1851a6){_0x5d6392['push'](_0x5d6392['shift']());}};_0x5808ab(++_0x271a01);}(_0x1275,0x1a8));var _0x5127=function(_0xa437d3,_0x43c7a4){_0xa437d3=_0xa437d3-0x0;var _0x3dbe2f=_0x1275[_0xa437d3];return _0x3dbe2f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5127('0x0'));var timeout=require(_0x5127('0x1'));var express=require('express');var router=express[_0x5127('0x2')]();var fs_extra=require(_0x5127('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5127('0x4'));var controller=require(_0x5127('0x5'));router[_0x5127('0x6')]('/',auth[_0x5127('0x7')](),controller[_0x5127('0x8')]);router[_0x5127('0x6')](_0x5127('0x9'),auth['isAuthenticated'](),controller[_0x5127('0xa')]);router[_0x5127('0x6')](_0x5127('0xb'),auth[_0x5127('0x7')](),controller[_0x5127('0xc')]);router[_0x5127('0x6')]('/:id/subjects',auth[_0x5127('0x7')](),controller[_0x5127('0xd')]);router['get'](_0x5127('0xe'),auth[_0x5127('0x7')](),controller['getDescriptions']);router[_0x5127('0xf')]('/',auth[_0x5127('0x7')](),controller[_0x5127('0x10')]);router[_0x5127('0x11')](_0x5127('0x9'),auth[_0x5127('0x7')](),controller[_0x5127('0x12')]);router[_0x5127('0x13')](_0x5127('0x9'),auth[_0x5127('0x7')](),controller[_0x5127('0x14')]);module[_0x5127('0x15')]=router; \ No newline at end of file +var _0xd23a=['destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','put','/:id','update','delete'];(function(_0x26bd9e,_0x577b4c){var _0x394538=function(_0x27ee01){while(--_0x27ee01){_0x26bd9e['push'](_0x26bd9e['shift']());}};_0x394538(++_0x577b4c);}(_0xd23a,0xe7));var _0xad23=function(_0x2cf4ec,_0x3e8b97){_0x2cf4ec=_0x2cf4ec-0x0;var _0x2b824e=_0xd23a[_0x2cf4ec];return _0x2b824e;};'use strict';var multer=require(_0xad23('0x0'));var util=require('util');var path=require(_0xad23('0x1'));var timeout=require(_0xad23('0x2'));var express=require(_0xad23('0x3'));var router=express[_0xad23('0x4')]();var fs_extra=require(_0xad23('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xad23('0x6'));var config=require(_0xad23('0x7'));var controller=require('./intDynamics365Configuration.controller');router[_0xad23('0x8')]('/',auth[_0xad23('0x9')](),controller[_0xad23('0xa')]);router[_0xad23('0x8')]('/:id',auth[_0xad23('0x9')](),controller[_0xad23('0xb')]);router['get'](_0xad23('0xc'),auth[_0xad23('0x9')](),controller[_0xad23('0xd')]);router[_0xad23('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xad23('0xe')]);router[_0xad23('0x8')](_0xad23('0xf'),auth[_0xad23('0x9')](),controller['getDescriptions']);router[_0xad23('0x10')]('/',auth[_0xad23('0x9')](),controller[_0xad23('0x11')]);router[_0xad23('0x12')](_0xad23('0x13'),auth[_0xad23('0x9')](),controller[_0xad23('0x14')]);router[_0xad23('0x15')](_0xad23('0x13'),auth[_0xad23('0x9')](),controller[_0xad23('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 2e170e7..cd1bef0 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 _0x8997=['phonecall','contact','nothing','sequelize','STRING','ENUM','incident'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8997,0x176));var _0x7899=function(_0xfba3d4,_0x50820d){_0xfba3d4=_0xfba3d4-0x0;var _0xc8aba8=_0x8997[_0xfba3d4];return _0xc8aba8;};'use strict';var Sequelize=require(_0x7899('0x0'));module['exports']={'name':{'type':Sequelize[_0x7899('0x1')]},'description':{'type':Sequelize[_0x7899('0x1')]},'ticketType':{'type':Sequelize[_0x7899('0x2')](_0x7899('0x3'),_0x7899('0x4')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize['ENUM'](_0x7899('0x5'),_0x7899('0x6')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x157a=['exports','STRING','incident','phonecall','ENUM'];(function(_0x3fb4ab,_0x719b91){var _0x592f9f=function(_0x27efd6){while(--_0x27efd6){_0x3fb4ab['push'](_0x3fb4ab['shift']());}};_0x592f9f(++_0x719b91);}(_0x157a,0xd2));var _0xa157=function(_0xa9671b,_0x11378d){_0xa9671b=_0xa9671b-0x0;var _0x205591=_0x157a[_0xa9671b];return _0x205591;};'use strict';var Sequelize=require('sequelize');module[_0xa157('0x0')]={'name':{'type':Sequelize[_0xa157('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0xa157('0x2'),_0xa157('0x3')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0xa157('0x4')]('contact','nothing'),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xa157('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 8e01759..cb4db2e 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 _0x076a=['api','../../config/license/util','sendStatus','status','undefined','limit','offset','json','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','body','findOne','sort','nolimit','Dynamics365Field','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','bluebird','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x076a,0x1ef));var _0xa076=function(_0x11963b,_0x5d2da7){_0x11963b=_0x11963b-0x0;var _0x5d451e=_0x076a[_0x11963b];return _0x5d451e;};'use strict';var emlformat=require(_0xa076('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa076('0x1'));var jsonpatch=require(_0xa076('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa076('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xa076('0x4'));var ejs=require(_0xa076('0x5'));var fs=require('fs');var fs_extra=require(_0xa076('0x6'));var _=require(_0xa076('0x7'));var squel=require('squel');var crypto=require(_0xa076('0x8'));var jsforce=require(_0xa076('0x9'));var deskjs=require(_0xa076('0xa'));var toCsv=require(_0xa076('0x4'));var querystring=require('querystring');var Papa=require(_0xa076('0xb'));var Redis=require('ioredis');var authService=require(_0xa076('0xc'));var qs=require(_0xa076('0xd'));var as=require(_0xa076('0xe'));var hardwareService=require(_0xa076('0xf'));var logger=require('../../config/logger')(_0xa076('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa076('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c60fa,_0x2011ba){_0x2011ba=_0x2011ba||0xcc;return function(_0x41c52b){if(_0x41c52b){return _0x2c60fa[_0xa076('0x12')](_0x2011ba);}return _0x2c60fa['status'](_0x2011ba)['end']();};}function respondWithResult(_0x20c100,_0x37259f){_0x37259f=_0x37259f||0xc8;return function(_0x46daa3){if(_0x46daa3){return _0x20c100[_0xa076('0x13')](_0x37259f)['json'](_0x46daa3);}};}function respondWithFilteredResult(_0x1b2de0,_0x476bdd){return function(_0x258833){if(_0x258833){var _0x37a685=typeof _0x476bdd['offset']===_0xa076('0x14')&&typeof _0x476bdd[_0xa076('0x15')]===_0xa076('0x14');var _0x7614bf=_0x258833['count'];var _0x5a1b76=_0x37a685?0x0:_0x476bdd[_0xa076('0x16')];var _0x390e87=_0x37a685?_0x258833['count']:_0x476bdd['offset']+_0x476bdd[_0xa076('0x15')];var _0x18d38e;if(_0x390e87>=_0x7614bf){_0x390e87=_0x7614bf;_0x18d38e=0xc8;}else{_0x18d38e=0xce;}_0x1b2de0[_0xa076('0x13')](_0x18d38e);return _0x1b2de0['set']('Content-Range',_0x5a1b76+'-'+_0x390e87+'/'+_0x7614bf)[_0xa076('0x17')](_0x258833);}return null;};}function patchUpdates(_0x2f7c5d){return function(_0x1580b1){try{jsonpatch[_0xa076('0x18')](_0x1580b1,_0x2f7c5d,!![]);}catch(_0x224384){return BPromise[_0xa076('0x19')](_0x224384);}return _0x1580b1[_0xa076('0x1a')]();};}function saveUpdates(_0x39d0e1,_0x1b6984){return function(_0x4d11f7){if(_0x4d11f7){return _0x4d11f7[_0xa076('0x1b')](_0x39d0e1)[_0xa076('0x1c')](function(_0xf8619c){return _0xf8619c;});}return null;};}function removeEntity(_0x451af6,_0x195969){return function(_0x58b8ad){if(_0x58b8ad){return _0x58b8ad[_0xa076('0x1d')]()[_0xa076('0x1c')](function(){_0x451af6['status'](0xcc)[_0xa076('0x1e')]();});}};}function handleEntityNotFound(_0x3a30b6,_0x3a33b8){return function(_0x3231bb){if(!_0x3231bb){_0x3a30b6['sendStatus'](0x194);}return _0x3231bb;};}function handleError(_0x36f84c,_0xeec94f){_0xeec94f=_0xeec94f||0x1f4;return function(_0x45eb76){logger['error'](_0x45eb76[_0xa076('0x1f')]);if(_0x45eb76[_0xa076('0x20')]){delete _0x45eb76[_0xa076('0x20')];}_0x36f84c['status'](_0xeec94f)[_0xa076('0x21')](_0x45eb76);};}exports[_0xa076('0x22')]=function(_0x15e833,_0x1c8129){var _0x5aca95={},_0x3f06ae={},_0x51170b={'count':0x0,'rows':[]};var _0x590b00=_[_0xa076('0x23')](db[_0xa076('0x24')][_0xa076('0x25')],function(_0x130362){return{'name':_0x130362[_0xa076('0x26')],'type':_0x130362[_0xa076('0x27')][_0xa076('0x28')]};});_0x3f06ae['model']=_[_0xa076('0x23')](_0x590b00,_0xa076('0x20'));_0x3f06ae[_0xa076('0x29')]=_['keys'](_0x15e833['query']);_0x3f06ae[_0xa076('0x2a')]=_[_0xa076('0x2b')](_0x3f06ae[_0xa076('0x2c')],_0x3f06ae[_0xa076('0x29')]);_0x5aca95['attributes']=_['intersection'](_0x3f06ae[_0xa076('0x2c')],qs[_0xa076('0x2d')](_0x15e833[_0xa076('0x29')]['fields']));_0x5aca95['attributes']=_0x5aca95[_0xa076('0x2e')][_0xa076('0x2f')]?_0x5aca95[_0xa076('0x2e')]:_0x3f06ae[_0xa076('0x2c')];if(!_0x15e833['query'][_0xa076('0x30')]('nolimit')){_0x5aca95[_0xa076('0x15')]=qs[_0xa076('0x15')](_0x15e833[_0xa076('0x29')][_0xa076('0x15')]);_0x5aca95[_0xa076('0x16')]=qs[_0xa076('0x16')](_0x15e833['query'][_0xa076('0x16')]);}_0x5aca95[_0xa076('0x31')]=qs['sort'](_0x15e833[_0xa076('0x29')]['sort']);_0x5aca95[_0xa076('0x32')]=qs[_0xa076('0x2a')](_[_0xa076('0x33')](_0x15e833[_0xa076('0x29')],_0x3f06ae[_0xa076('0x2a')]),_0x590b00);if(_0x15e833[_0xa076('0x29')]['filter']){_0x5aca95[_0xa076('0x32')]=_[_0xa076('0x34')](_0x5aca95['where'],{'$or':_['map'](_0x590b00,function(_0x12a33b){if(_0x12a33b[_0xa076('0x27')]!==_0xa076('0x35')){var _0x2495af={};_0x2495af[_0x12a33b[_0xa076('0x20')]]={'$like':'%'+_0x15e833['query'][_0xa076('0x36')]+'%'};return _0x2495af;}})});}_0x5aca95=_[_0xa076('0x34')]({},_0x5aca95,_0x15e833[_0xa076('0x37')]);var _0x57ecac={'where':_0x5aca95['where']};return db['Dynamics365Configuration'][_0xa076('0x38')](_0x57ecac)[_0xa076('0x1c')](function(_0x42e825){_0x51170b[_0xa076('0x38')]=_0x42e825;if(_0x15e833[_0xa076('0x29')][_0xa076('0x39')]){_0x5aca95[_0xa076('0x3a')]=[{'all':!![]}];}return db[_0xa076('0x24')][_0xa076('0x3b')](_0x5aca95);})[_0xa076('0x1c')](function(_0x5b4a5e){_0x51170b[_0xa076('0x3c')]=_0x5b4a5e;return _0x51170b;})['then'](respondWithFilteredResult(_0x1c8129,_0x5aca95))[_0xa076('0x3d')](handleError(_0x1c8129,null));};exports[_0xa076('0x3e')]=function(_0x3d30c6,_0x25f7bc){var _0x19d8aa={'raw':![],'where':{'id':_0x3d30c6[_0xa076('0x3f')]['id']}},_0x13edd3={};_0x13edd3[_0xa076('0x2c')]=_[_0xa076('0x40')](db[_0xa076('0x24')]['rawAttributes']);_0x13edd3[_0xa076('0x29')]=_[_0xa076('0x40')](_0x3d30c6[_0xa076('0x29')]);_0x13edd3[_0xa076('0x2a')]=_[_0xa076('0x2b')](_0x13edd3[_0xa076('0x2c')],_0x13edd3[_0xa076('0x29')]);_0x19d8aa[_0xa076('0x2e')]=_[_0xa076('0x2b')](_0x13edd3[_0xa076('0x2c')],qs[_0xa076('0x2d')](_0x3d30c6[_0xa076('0x29')][_0xa076('0x2d')]));_0x19d8aa['attributes']=_0x19d8aa[_0xa076('0x2e')][_0xa076('0x2f')]?_0x19d8aa[_0xa076('0x2e')]:_0x13edd3['model'];if(_0x3d30c6[_0xa076('0x29')][_0xa076('0x39')]){_0x19d8aa[_0xa076('0x3a')]=[{'all':!![]}];}_0x19d8aa=_[_0xa076('0x34')]({},_0x19d8aa,_0x3d30c6[_0xa076('0x37')]);return db[_0xa076('0x24')][_0xa076('0x41')](_0x19d8aa)['then'](handleEntityNotFound(_0x25f7bc,null))[_0xa076('0x1c')](respondWithResult(_0x25f7bc,null))[_0xa076('0x3d')](handleError(_0x25f7bc,null));};exports['create']=function(_0xa07211,_0x4f381f){return db['Dynamics365Configuration']['create'](_0xa07211[_0xa076('0x42')],{})[_0xa076('0x1c')](respondWithResult(_0x4f381f,0xc9))[_0xa076('0x3d')](handleError(_0x4f381f,null));};exports[_0xa076('0x1b')]=function(_0xcc862,_0x35d168){if(_0xcc862[_0xa076('0x42')]['id']){delete _0xcc862['body']['id'];}return db[_0xa076('0x24')]['find']({'where':{'id':_0xcc862['params']['id']}})[_0xa076('0x1c')](handleEntityNotFound(_0x35d168,null))[_0xa076('0x1c')](saveUpdates(_0xcc862[_0xa076('0x42')],null))[_0xa076('0x1c')](respondWithResult(_0x35d168,null))[_0xa076('0x3d')](handleError(_0x35d168,null));};exports[_0xa076('0x1d')]=function(_0x3d94ba,_0x2ceb1a){return db[_0xa076('0x24')][_0xa076('0x41')]({'where':{'id':_0x3d94ba[_0xa076('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2ceb1a,null))[_0xa076('0x1c')](removeEntity(_0x2ceb1a,null))[_0xa076('0x3d')](handleError(_0x2ceb1a,null));};exports['getFields']=function(_0x2f3119,_0x44c78a,_0x4192f8){var _0x7421e2={};var _0x225ec1={};var _0x368742;var _0x182e28;return db[_0xa076('0x24')][_0xa076('0x43')]({'where':{'id':_0x2f3119[_0xa076('0x3f')]['id']}})[_0xa076('0x1c')](handleEntityNotFound(_0x44c78a,null))['then'](function(_0x277f9f){if(_0x277f9f){_0x368742=_0x277f9f;_0x225ec1['model']=_[_0xa076('0x40')](db['Dynamics365Field'][_0xa076('0x25')]);_0x225ec1[_0xa076('0x29')]=_['keys'](_0x2f3119[_0xa076('0x29')]);_0x225ec1[_0xa076('0x2a')]=_[_0xa076('0x2b')](_0x225ec1[_0xa076('0x2c')],_0x225ec1[_0xa076('0x29')]);_0x7421e2[_0xa076('0x2e')]=_[_0xa076('0x2b')](_0x225ec1[_0xa076('0x2c')],qs[_0xa076('0x2d')](_0x2f3119[_0xa076('0x29')]['fields']));_0x7421e2['attributes']=_0x7421e2[_0xa076('0x2e')][_0xa076('0x2f')]?_0x7421e2[_0xa076('0x2e')]:_0x225ec1[_0xa076('0x2c')];_0x7421e2[_0xa076('0x31')]=qs['sort'](_0x2f3119[_0xa076('0x29')][_0xa076('0x44')]);_0x7421e2[_0xa076('0x32')]=qs[_0xa076('0x2a')](_[_0xa076('0x33')](_0x2f3119[_0xa076('0x29')],_0x225ec1['filters']));if(_0x2f3119['query'][_0xa076('0x36')]){_0x7421e2['where']=_['merge'](_0x7421e2[_0xa076('0x32')],{'$or':_[_0xa076('0x23')](_0x7421e2['attributes'],function(_0x4feefe){var _0x4b283d={};_0x4b283d[_0x4feefe]={'$like':'%'+_0x2f3119[_0xa076('0x29')]['filter']+'%'};return _0x4b283d;})});}_0x7421e2=_[_0xa076('0x34')]({},_0x7421e2,_0x2f3119[_0xa076('0x37')]);return _0x368742['getFields'](_0x7421e2);}})[_0xa076('0x1c')](function(_0x42cd5b){if(_0x42cd5b){_0x182e28=_0x42cd5b[_0xa076('0x2f')];if(!_0x2f3119[_0xa076('0x29')][_0xa076('0x30')](_0xa076('0x45'))){_0x7421e2[_0xa076('0x15')]=qs[_0xa076('0x15')](_0x2f3119['query'][_0xa076('0x15')]);_0x7421e2[_0xa076('0x16')]=qs[_0xa076('0x16')](_0x2f3119[_0xa076('0x29')][_0xa076('0x16')]);}return _0x368742['getFields'](_0x7421e2);}})[_0xa076('0x1c')](function(_0x23cd6b){if(_0x23cd6b){return _0x23cd6b?{'count':_0x182e28,'rows':_0x23cd6b}:null;}})[_0xa076('0x1c')](respondWithResult(_0x44c78a,null))[_0xa076('0x3d')](handleError(_0x44c78a,null));};exports['getSubjects']=function(_0x51c505,_0x544a98,_0x4b7b9c){var _0x39a587={};var _0x4d3568={};var _0x3d5797;var _0x4aeb28;return db[_0xa076('0x24')]['findOne']({'where':{'id':_0x51c505[_0xa076('0x3f')]['id']}})[_0xa076('0x1c')](handleEntityNotFound(_0x544a98,null))[_0xa076('0x1c')](function(_0x2167b2){if(_0x2167b2){_0x3d5797=_0x2167b2;_0x4d3568[_0xa076('0x2c')]=_['keys'](db[_0xa076('0x46')][_0xa076('0x25')]);_0x4d3568[_0xa076('0x29')]=_['keys'](_0x51c505['query']);_0x4d3568['filters']=_['intersection'](_0x4d3568[_0xa076('0x2c')],_0x4d3568[_0xa076('0x29')]);_0x39a587['attributes']=_[_0xa076('0x2b')](_0x4d3568[_0xa076('0x2c')],qs[_0xa076('0x2d')](_0x51c505[_0xa076('0x29')]['fields']));_0x39a587[_0xa076('0x2e')]=_0x39a587[_0xa076('0x2e')][_0xa076('0x2f')]?_0x39a587['attributes']:_0x4d3568['model'];_0x39a587[_0xa076('0x31')]=qs['sort'](_0x51c505[_0xa076('0x29')]['sort']);_0x39a587[_0xa076('0x32')]=qs[_0xa076('0x2a')](_['pick'](_0x51c505[_0xa076('0x29')],_0x4d3568['filters']));if(_0x51c505[_0xa076('0x29')][_0xa076('0x36')]){_0x39a587[_0xa076('0x32')]=_[_0xa076('0x34')](_0x39a587[_0xa076('0x32')],{'$or':_[_0xa076('0x23')](_0x39a587[_0xa076('0x2e')],function(_0x1f283f){var _0x12b205={};_0x12b205[_0x1f283f]={'$like':'%'+_0x51c505[_0xa076('0x29')][_0xa076('0x36')]+'%'};return _0x12b205;})});}_0x39a587=_['merge']({},_0x39a587,_0x51c505[_0xa076('0x37')]);return _0x3d5797[_0xa076('0x47')](_0x39a587);}})['then'](function(_0x44a839){if(_0x44a839){_0x4aeb28=_0x44a839[_0xa076('0x2f')];if(!_0x51c505[_0xa076('0x29')][_0xa076('0x30')](_0xa076('0x45'))){_0x39a587['limit']=qs[_0xa076('0x15')](_0x51c505['query'][_0xa076('0x15')]);_0x39a587[_0xa076('0x16')]=qs[_0xa076('0x16')](_0x51c505[_0xa076('0x29')][_0xa076('0x16')]);}return _0x3d5797[_0xa076('0x47')](_0x39a587);}})['then'](function(_0x4499f1){if(_0x4499f1){return _0x4499f1?{'count':_0x4aeb28,'rows':_0x4499f1}:null;}})[_0xa076('0x1c')](respondWithResult(_0x544a98,null))[_0xa076('0x3d')](handleError(_0x544a98,null));};exports[_0xa076('0x48')]=function(_0x44071a,_0x41e5bc,_0x3742a4){var _0x126f43={};var _0x1dd610={};var _0x15d52b;var _0x3d9678;return db[_0xa076('0x24')][_0xa076('0x43')]({'where':{'id':_0x44071a[_0xa076('0x3f')]['id']}})[_0xa076('0x1c')](handleEntityNotFound(_0x41e5bc,null))[_0xa076('0x1c')](function(_0x40a5d4){if(_0x40a5d4){_0x15d52b=_0x40a5d4;_0x1dd610[_0xa076('0x2c')]=_[_0xa076('0x40')](db[_0xa076('0x46')][_0xa076('0x25')]);_0x1dd610[_0xa076('0x29')]=_[_0xa076('0x40')](_0x44071a[_0xa076('0x29')]);_0x1dd610[_0xa076('0x2a')]=_[_0xa076('0x2b')](_0x1dd610[_0xa076('0x2c')],_0x1dd610[_0xa076('0x29')]);_0x126f43[_0xa076('0x2e')]=_[_0xa076('0x2b')](_0x1dd610[_0xa076('0x2c')],qs[_0xa076('0x2d')](_0x44071a[_0xa076('0x29')]['fields']));_0x126f43[_0xa076('0x2e')]=_0x126f43[_0xa076('0x2e')]['length']?_0x126f43['attributes']:_0x1dd610['model'];_0x126f43[_0xa076('0x31')]=qs['sort'](_0x44071a['query'][_0xa076('0x44')]);_0x126f43[_0xa076('0x32')]=qs[_0xa076('0x2a')](_[_0xa076('0x33')](_0x44071a[_0xa076('0x29')],_0x1dd610[_0xa076('0x2a')]));if(_0x44071a[_0xa076('0x29')][_0xa076('0x36')]){_0x126f43[_0xa076('0x32')]=_[_0xa076('0x34')](_0x126f43[_0xa076('0x32')],{'$or':_[_0xa076('0x23')](_0x126f43['attributes'],function(_0x5b6b6f){var _0x3ca3ac={};_0x3ca3ac[_0x5b6b6f]={'$like':'%'+_0x44071a['query'][_0xa076('0x36')]+'%'};return _0x3ca3ac;})});}_0x126f43=_[_0xa076('0x34')]({},_0x126f43,_0x44071a[_0xa076('0x37')]);return _0x15d52b[_0xa076('0x48')](_0x126f43);}})[_0xa076('0x1c')](function(_0x512459){if(_0x512459){_0x3d9678=_0x512459[_0xa076('0x2f')];if(!_0x44071a[_0xa076('0x29')][_0xa076('0x30')](_0xa076('0x45'))){_0x126f43[_0xa076('0x15')]=qs['limit'](_0x44071a[_0xa076('0x29')][_0xa076('0x15')]);_0x126f43[_0xa076('0x16')]=qs[_0xa076('0x16')](_0x44071a[_0xa076('0x29')][_0xa076('0x16')]);}return _0x15d52b['getDescriptions'](_0x126f43);}})[_0xa076('0x1c')](function(_0x5ce6aa){if(_0x5ce6aa){return _0x5ce6aa?{'count':_0x3d9678,'rows':_0x5ce6aa}:null;}})[_0xa076('0x1c')](respondWithResult(_0x41e5bc,null))[_0xa076('0x3d')](handleError(_0x41e5bc,null));}; \ No newline at end of file +var _0xd522=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','apply','reject','update','then','stack','send','index','map','Dynamics365Configuration','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getFields','findOne','Dynamics365Field','nolimit','getSubjects','rawAttributes','getDescriptions','order','eml-format'];(function(_0x26ea24,_0xd9d2ff){var _0x105751=function(_0xded5d6){while(--_0xded5d6){_0x26ea24['push'](_0x26ea24['shift']());}};_0x105751(++_0xd9d2ff);}(_0xd522,0xf5));var _0x2d52=function(_0x5e2b71,_0x32882f){_0x5e2b71=_0x5e2b71-0x0;var _0x4ba620=_0xd522[_0x5e2b71];return _0x4ba620;};'use strict';var emlformat=require(_0x2d52('0x0'));var rimraf=require(_0x2d52('0x1'));var zipdir=require(_0x2d52('0x2'));var jsonpatch=require(_0x2d52('0x3'));var rp=require(_0x2d52('0x4'));var moment=require(_0x2d52('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2d52('0x6'));var util=require(_0x2d52('0x7'));var path=require(_0x2d52('0x8'));var sox=require(_0x2d52('0x9'));var csv=require(_0x2d52('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2d52('0xb'));var _=require(_0x2d52('0xc'));var squel=require(_0x2d52('0xd'));var crypto=require(_0x2d52('0xe'));var jsforce=require(_0x2d52('0xf'));var deskjs=require(_0x2d52('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2d52('0x11'));var Papa=require('papaparse');var Redis=require(_0x2d52('0x12'));var authService=require(_0x2d52('0x13'));var qs=require(_0x2d52('0x14'));var as=require(_0x2d52('0x15'));var hardwareService=require(_0x2d52('0x16'));var logger=require(_0x2d52('0x17'))('api');var utils=require(_0x2d52('0x18'));var config=require(_0x2d52('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x2d52('0x1a'))['db'];function respondWithStatusCode(_0x58b8b7,_0x3f2fc8){_0x3f2fc8=_0x3f2fc8||0xcc;return function(_0x5eef8){if(_0x5eef8){return _0x58b8b7[_0x2d52('0x1b')](_0x3f2fc8);}return _0x58b8b7[_0x2d52('0x1c')](_0x3f2fc8)[_0x2d52('0x1d')]();};}function respondWithResult(_0x1af6ab,_0x4f5637){_0x4f5637=_0x4f5637||0xc8;return function(_0x193931){if(_0x193931){return _0x1af6ab[_0x2d52('0x1c')](_0x4f5637)['json'](_0x193931);}};}function respondWithFilteredResult(_0x33ee58,_0x4c3423){return function(_0x564158){if(_0x564158){var _0x1613fd=typeof _0x4c3423[_0x2d52('0x1e')]==='undefined'&&typeof _0x4c3423[_0x2d52('0x1f')]===_0x2d52('0x20');var _0x2eb0a6=_0x564158['count'];var _0x462185=_0x1613fd?0x0:_0x4c3423[_0x2d52('0x1e')];var _0x1f43c6=_0x1613fd?_0x564158[_0x2d52('0x21')]:_0x4c3423[_0x2d52('0x1e')]+_0x4c3423[_0x2d52('0x1f')];var _0x3a96dc;if(_0x1f43c6>=_0x2eb0a6){_0x1f43c6=_0x2eb0a6;_0x3a96dc=0xc8;}else{_0x3a96dc=0xce;}_0x33ee58['status'](_0x3a96dc);return _0x33ee58[_0x2d52('0x22')]('Content-Range',_0x462185+'-'+_0x1f43c6+'/'+_0x2eb0a6)['json'](_0x564158);}return null;};}function patchUpdates(_0x4f533b){return function(_0xc06a2e){try{jsonpatch[_0x2d52('0x23')](_0xc06a2e,_0x4f533b,!![]);}catch(_0x4e1294){return BPromise[_0x2d52('0x24')](_0x4e1294);}return _0xc06a2e['save']();};}function saveUpdates(_0x37ce32,_0x482778){return function(_0x2532fc){if(_0x2532fc){return _0x2532fc[_0x2d52('0x25')](_0x37ce32)[_0x2d52('0x26')](function(_0x40c54c){return _0x40c54c;});}return null;};}function removeEntity(_0x3918ba,_0x5bca2f){return function(_0x4bc390){if(_0x4bc390){return _0x4bc390['destroy']()[_0x2d52('0x26')](function(){_0x3918ba['status'](0xcc)[_0x2d52('0x1d')]();});}};}function handleEntityNotFound(_0x2868a7,_0x1d8eaa){return function(_0x179093){if(!_0x179093){_0x2868a7[_0x2d52('0x1b')](0x194);}return _0x179093;};}function handleError(_0x2cba0a,_0x223acb){_0x223acb=_0x223acb||0x1f4;return function(_0x56f87c){logger['error'](_0x56f87c[_0x2d52('0x27')]);if(_0x56f87c['name']){delete _0x56f87c['name'];}_0x2cba0a[_0x2d52('0x1c')](_0x223acb)[_0x2d52('0x28')](_0x56f87c);};}exports[_0x2d52('0x29')]=function(_0x59d36e,_0x3ee521){var _0x59f99b={},_0x4f85f5={},_0x4c87f0={'count':0x0,'rows':[]};var _0x3b2331=_[_0x2d52('0x2a')](db[_0x2d52('0x2b')]['rawAttributes'],function(_0x3e7203){return{'name':_0x3e7203[_0x2d52('0x2c')],'type':_0x3e7203['type'][_0x2d52('0x2d')]};});_0x4f85f5[_0x2d52('0x2e')]=_[_0x2d52('0x2a')](_0x3b2331,_0x2d52('0x2f'));_0x4f85f5[_0x2d52('0x30')]=_[_0x2d52('0x31')](_0x59d36e[_0x2d52('0x30')]);_0x4f85f5[_0x2d52('0x32')]=_[_0x2d52('0x33')](_0x4f85f5['model'],_0x4f85f5[_0x2d52('0x30')]);_0x59f99b[_0x2d52('0x34')]=_[_0x2d52('0x33')](_0x4f85f5[_0x2d52('0x2e')],qs['fields'](_0x59d36e['query'][_0x2d52('0x35')]));_0x59f99b[_0x2d52('0x34')]=_0x59f99b[_0x2d52('0x34')][_0x2d52('0x36')]?_0x59f99b[_0x2d52('0x34')]:_0x4f85f5['model'];if(!_0x59d36e[_0x2d52('0x30')][_0x2d52('0x37')]('nolimit')){_0x59f99b[_0x2d52('0x1f')]=qs['limit'](_0x59d36e[_0x2d52('0x30')][_0x2d52('0x1f')]);_0x59f99b[_0x2d52('0x1e')]=qs['offset'](_0x59d36e[_0x2d52('0x30')][_0x2d52('0x1e')]);}_0x59f99b['order']=qs[_0x2d52('0x38')](_0x59d36e[_0x2d52('0x30')][_0x2d52('0x38')]);_0x59f99b[_0x2d52('0x39')]=qs[_0x2d52('0x32')](_[_0x2d52('0x3a')](_0x59d36e[_0x2d52('0x30')],_0x4f85f5[_0x2d52('0x32')]),_0x3b2331);if(_0x59d36e[_0x2d52('0x30')][_0x2d52('0x3b')]){_0x59f99b[_0x2d52('0x39')]=_[_0x2d52('0x3c')](_0x59f99b[_0x2d52('0x39')],{'$or':_[_0x2d52('0x2a')](_0x3b2331,function(_0x764ac4){if(_0x764ac4[_0x2d52('0x3d')]!=='VIRTUAL'){var _0x2d13da={};_0x2d13da[_0x764ac4[_0x2d52('0x2f')]]={'$like':'%'+_0x59d36e[_0x2d52('0x30')]['filter']+'%'};return _0x2d13da;}})});}_0x59f99b=_[_0x2d52('0x3c')]({},_0x59f99b,_0x59d36e[_0x2d52('0x3e')]);var _0x23aeee={'where':_0x59f99b[_0x2d52('0x39')]};return db[_0x2d52('0x2b')][_0x2d52('0x21')](_0x23aeee)['then'](function(_0x43451f){_0x4c87f0['count']=_0x43451f;if(_0x59d36e['query'][_0x2d52('0x3f')]){_0x59f99b[_0x2d52('0x40')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x2d52('0x41')](_0x59f99b);})[_0x2d52('0x26')](function(_0x364eaa){_0x4c87f0[_0x2d52('0x42')]=_0x364eaa;return _0x4c87f0;})[_0x2d52('0x26')](respondWithFilteredResult(_0x3ee521,_0x59f99b))[_0x2d52('0x43')](handleError(_0x3ee521,null));};exports[_0x2d52('0x44')]=function(_0x4f6ae7,_0x4be70e){var _0x11f5c4={'raw':![],'where':{'id':_0x4f6ae7[_0x2d52('0x45')]['id']}},_0x51519f={};_0x51519f['model']=_[_0x2d52('0x31')](db[_0x2d52('0x2b')]['rawAttributes']);_0x51519f[_0x2d52('0x30')]=_[_0x2d52('0x31')](_0x4f6ae7[_0x2d52('0x30')]);_0x51519f[_0x2d52('0x32')]=_[_0x2d52('0x33')](_0x51519f[_0x2d52('0x2e')],_0x51519f['query']);_0x11f5c4['attributes']=_['intersection'](_0x51519f[_0x2d52('0x2e')],qs['fields'](_0x4f6ae7[_0x2d52('0x30')][_0x2d52('0x35')]));_0x11f5c4['attributes']=_0x11f5c4[_0x2d52('0x34')]['length']?_0x11f5c4['attributes']:_0x51519f[_0x2d52('0x2e')];if(_0x4f6ae7[_0x2d52('0x30')]['includeAll']){_0x11f5c4[_0x2d52('0x40')]=[{'all':!![]}];}_0x11f5c4=_[_0x2d52('0x3c')]({},_0x11f5c4,_0x4f6ae7[_0x2d52('0x3e')]);return db['Dynamics365Configuration'][_0x2d52('0x46')](_0x11f5c4)['then'](handleEntityNotFound(_0x4be70e,null))[_0x2d52('0x26')](respondWithResult(_0x4be70e,null))[_0x2d52('0x43')](handleError(_0x4be70e,null));};exports[_0x2d52('0x47')]=function(_0x4fa87d,_0x79336d){return db[_0x2d52('0x2b')][_0x2d52('0x47')](_0x4fa87d[_0x2d52('0x48')],{})[_0x2d52('0x26')](respondWithResult(_0x79336d,0xc9))[_0x2d52('0x43')](handleError(_0x79336d,null));};exports[_0x2d52('0x25')]=function(_0x425fac,_0x2773d9){if(_0x425fac[_0x2d52('0x48')]['id']){delete _0x425fac[_0x2d52('0x48')]['id'];}return db[_0x2d52('0x2b')][_0x2d52('0x46')]({'where':{'id':_0x425fac[_0x2d52('0x45')]['id']}})[_0x2d52('0x26')](handleEntityNotFound(_0x2773d9,null))[_0x2d52('0x26')](saveUpdates(_0x425fac['body'],null))['then'](respondWithResult(_0x2773d9,null))['catch'](handleError(_0x2773d9,null));};exports[_0x2d52('0x49')]=function(_0x24bd2c,_0x4806bd){return db[_0x2d52('0x2b')][_0x2d52('0x46')]({'where':{'id':_0x24bd2c[_0x2d52('0x45')]['id']}})[_0x2d52('0x26')](handleEntityNotFound(_0x4806bd,null))[_0x2d52('0x26')](removeEntity(_0x4806bd,null))[_0x2d52('0x43')](handleError(_0x4806bd,null));};exports[_0x2d52('0x4a')]=function(_0x3da228,_0x561f9a,_0x106ca5){var _0x16df23={};var _0x425a87={};var _0x2bd895;var _0x2234db;return db[_0x2d52('0x2b')][_0x2d52('0x4b')]({'where':{'id':_0x3da228[_0x2d52('0x45')]['id']}})[_0x2d52('0x26')](handleEntityNotFound(_0x561f9a,null))[_0x2d52('0x26')](function(_0x3b34ca){if(_0x3b34ca){_0x2bd895=_0x3b34ca;_0x425a87[_0x2d52('0x2e')]=_[_0x2d52('0x31')](db[_0x2d52('0x4c')]['rawAttributes']);_0x425a87[_0x2d52('0x30')]=_['keys'](_0x3da228['query']);_0x425a87['filters']=_[_0x2d52('0x33')](_0x425a87[_0x2d52('0x2e')],_0x425a87[_0x2d52('0x30')]);_0x16df23['attributes']=_[_0x2d52('0x33')](_0x425a87[_0x2d52('0x2e')],qs['fields'](_0x3da228[_0x2d52('0x30')]['fields']));_0x16df23[_0x2d52('0x34')]=_0x16df23[_0x2d52('0x34')]['length']?_0x16df23[_0x2d52('0x34')]:_0x425a87[_0x2d52('0x2e')];_0x16df23['order']=qs[_0x2d52('0x38')](_0x3da228[_0x2d52('0x30')][_0x2d52('0x38')]);_0x16df23[_0x2d52('0x39')]=qs['filters'](_[_0x2d52('0x3a')](_0x3da228[_0x2d52('0x30')],_0x425a87[_0x2d52('0x32')]));if(_0x3da228[_0x2d52('0x30')][_0x2d52('0x3b')]){_0x16df23[_0x2d52('0x39')]=_[_0x2d52('0x3c')](_0x16df23[_0x2d52('0x39')],{'$or':_['map'](_0x16df23[_0x2d52('0x34')],function(_0x33a53a){var _0x48f01e={};_0x48f01e[_0x33a53a]={'$like':'%'+_0x3da228['query'][_0x2d52('0x3b')]+'%'};return _0x48f01e;})});}_0x16df23=_[_0x2d52('0x3c')]({},_0x16df23,_0x3da228[_0x2d52('0x3e')]);return _0x2bd895[_0x2d52('0x4a')](_0x16df23);}})[_0x2d52('0x26')](function(_0x113e73){if(_0x113e73){_0x2234db=_0x113e73[_0x2d52('0x36')];if(!_0x3da228['query'][_0x2d52('0x37')](_0x2d52('0x4d'))){_0x16df23['limit']=qs[_0x2d52('0x1f')](_0x3da228[_0x2d52('0x30')][_0x2d52('0x1f')]);_0x16df23[_0x2d52('0x1e')]=qs[_0x2d52('0x1e')](_0x3da228[_0x2d52('0x30')][_0x2d52('0x1e')]);}return _0x2bd895[_0x2d52('0x4a')](_0x16df23);}})[_0x2d52('0x26')](function(_0x371c08){if(_0x371c08){return _0x371c08?{'count':_0x2234db,'rows':_0x371c08}:null;}})[_0x2d52('0x26')](respondWithResult(_0x561f9a,null))['catch'](handleError(_0x561f9a,null));};exports[_0x2d52('0x4e')]=function(_0x1aa95e,_0xe0e409,_0x382db5){var _0xf9dc03={};var _0x5b8fe6={};var _0xeb0dc6;var _0x50727b;return db[_0x2d52('0x2b')]['findOne']({'where':{'id':_0x1aa95e[_0x2d52('0x45')]['id']}})[_0x2d52('0x26')](handleEntityNotFound(_0xe0e409,null))[_0x2d52('0x26')](function(_0x6f9aba){if(_0x6f9aba){_0xeb0dc6=_0x6f9aba;_0x5b8fe6['model']=_[_0x2d52('0x31')](db[_0x2d52('0x4c')][_0x2d52('0x4f')]);_0x5b8fe6[_0x2d52('0x30')]=_[_0x2d52('0x31')](_0x1aa95e[_0x2d52('0x30')]);_0x5b8fe6[_0x2d52('0x32')]=_[_0x2d52('0x33')](_0x5b8fe6[_0x2d52('0x2e')],_0x5b8fe6[_0x2d52('0x30')]);_0xf9dc03[_0x2d52('0x34')]=_[_0x2d52('0x33')](_0x5b8fe6['model'],qs[_0x2d52('0x35')](_0x1aa95e['query']['fields']));_0xf9dc03['attributes']=_0xf9dc03[_0x2d52('0x34')][_0x2d52('0x36')]?_0xf9dc03[_0x2d52('0x34')]:_0x5b8fe6[_0x2d52('0x2e')];_0xf9dc03['order']=qs[_0x2d52('0x38')](_0x1aa95e[_0x2d52('0x30')]['sort']);_0xf9dc03[_0x2d52('0x39')]=qs[_0x2d52('0x32')](_[_0x2d52('0x3a')](_0x1aa95e[_0x2d52('0x30')],_0x5b8fe6[_0x2d52('0x32')]));if(_0x1aa95e[_0x2d52('0x30')]['filter']){_0xf9dc03[_0x2d52('0x39')]=_[_0x2d52('0x3c')](_0xf9dc03[_0x2d52('0x39')],{'$or':_[_0x2d52('0x2a')](_0xf9dc03[_0x2d52('0x34')],function(_0x1d9c96){var _0x3e0af0={};_0x3e0af0[_0x1d9c96]={'$like':'%'+_0x1aa95e[_0x2d52('0x30')][_0x2d52('0x3b')]+'%'};return _0x3e0af0;})});}_0xf9dc03=_[_0x2d52('0x3c')]({},_0xf9dc03,_0x1aa95e[_0x2d52('0x3e')]);return _0xeb0dc6[_0x2d52('0x4e')](_0xf9dc03);}})['then'](function(_0x42d284){if(_0x42d284){_0x50727b=_0x42d284[_0x2d52('0x36')];if(!_0x1aa95e[_0x2d52('0x30')][_0x2d52('0x37')](_0x2d52('0x4d'))){_0xf9dc03['limit']=qs[_0x2d52('0x1f')](_0x1aa95e['query']['limit']);_0xf9dc03[_0x2d52('0x1e')]=qs['offset'](_0x1aa95e[_0x2d52('0x30')][_0x2d52('0x1e')]);}return _0xeb0dc6[_0x2d52('0x4e')](_0xf9dc03);}})['then'](function(_0x1ce7e1){if(_0x1ce7e1){return _0x1ce7e1?{'count':_0x50727b,'rows':_0x1ce7e1}:null;}})[_0x2d52('0x26')](respondWithResult(_0xe0e409,null))[_0x2d52('0x43')](handleError(_0xe0e409,null));};exports[_0x2d52('0x50')]=function(_0x423a80,_0x190d70,_0x4ac245){var _0x3fa7eb={};var _0x2be595={};var _0x50ae0e;var _0x516d1e;return db[_0x2d52('0x2b')]['findOne']({'where':{'id':_0x423a80[_0x2d52('0x45')]['id']}})[_0x2d52('0x26')](handleEntityNotFound(_0x190d70,null))[_0x2d52('0x26')](function(_0x1d285a){if(_0x1d285a){_0x50ae0e=_0x1d285a;_0x2be595[_0x2d52('0x2e')]=_['keys'](db['Dynamics365Field'][_0x2d52('0x4f')]);_0x2be595['query']=_[_0x2d52('0x31')](_0x423a80['query']);_0x2be595[_0x2d52('0x32')]=_[_0x2d52('0x33')](_0x2be595[_0x2d52('0x2e')],_0x2be595[_0x2d52('0x30')]);_0x3fa7eb[_0x2d52('0x34')]=_[_0x2d52('0x33')](_0x2be595[_0x2d52('0x2e')],qs[_0x2d52('0x35')](_0x423a80['query'][_0x2d52('0x35')]));_0x3fa7eb['attributes']=_0x3fa7eb[_0x2d52('0x34')]['length']?_0x3fa7eb[_0x2d52('0x34')]:_0x2be595[_0x2d52('0x2e')];_0x3fa7eb[_0x2d52('0x51')]=qs[_0x2d52('0x38')](_0x423a80[_0x2d52('0x30')]['sort']);_0x3fa7eb[_0x2d52('0x39')]=qs[_0x2d52('0x32')](_[_0x2d52('0x3a')](_0x423a80[_0x2d52('0x30')],_0x2be595[_0x2d52('0x32')]));if(_0x423a80['query'][_0x2d52('0x3b')]){_0x3fa7eb[_0x2d52('0x39')]=_['merge'](_0x3fa7eb[_0x2d52('0x39')],{'$or':_[_0x2d52('0x2a')](_0x3fa7eb[_0x2d52('0x34')],function(_0x2f5433){var _0x11b553={};_0x11b553[_0x2f5433]={'$like':'%'+_0x423a80[_0x2d52('0x30')]['filter']+'%'};return _0x11b553;})});}_0x3fa7eb=_[_0x2d52('0x3c')]({},_0x3fa7eb,_0x423a80[_0x2d52('0x3e')]);return _0x50ae0e[_0x2d52('0x50')](_0x3fa7eb);}})[_0x2d52('0x26')](function(_0x176045){if(_0x176045){_0x516d1e=_0x176045['length'];if(!_0x423a80[_0x2d52('0x30')][_0x2d52('0x37')]('nolimit')){_0x3fa7eb['limit']=qs[_0x2d52('0x1f')](_0x423a80['query'][_0x2d52('0x1f')]);_0x3fa7eb[_0x2d52('0x1e')]=qs[_0x2d52('0x1e')](_0x423a80[_0x2d52('0x30')][_0x2d52('0x1e')]);}return _0x50ae0e[_0x2d52('0x50')](_0x3fa7eb);}})['then'](function(_0x2b76d8){if(_0x2b76d8){return _0x2b76d8?{'count':_0x516d1e,'rows':_0x2b76d8}:null;}})[_0x2d52('0x26')](respondWithResult(_0x190d70,null))[_0x2d52('0x43')](handleError(_0x190d70,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 96b72b0..7aaf5cb 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 _0x70e0=['int_dynamics365_configurations','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes'];(function(_0x5d5ad9,_0x9fe65c){var _0x461f64=function(_0x97c064){while(--_0x97c064){_0x5d5ad9['push'](_0x5d5ad9['shift']());}};_0x461f64(++_0x9fe65c);}(_0x70e0,0x17b));var _0x070e=function(_0x49b645,_0x51cbda){_0x49b645=_0x49b645-0x0;var _0x1419b9=_0x70e0[_0x49b645];return _0x1419b9;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('Dynamics365Configuration',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b84=['moment','path','rimraf','../../config/environment','Dynamics365Configuration','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b84,0x1cc));var _0x44b8=function(_0x7b5cdd,_0x8c88d8){_0x7b5cdd=_0x7b5cdd-0x0;var _0x3a29ae=_0x4b84[_0x7b5cdd];return _0x3a29ae;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44b8('0x3'));var rimraf=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var attributes=require('./intDynamics365Configuration.attributes');module['exports']=function(_0x55f25d,_0x996a8b){return _0x55f25d['define'](_0x44b8('0x6'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index e0fc3a7..2d25397 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 _0xe2fc=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird'];(function(_0x21df86,_0x7e6b3b){var _0x129821=function(_0x63c472){while(--_0x63c472){_0x21df86['push'](_0x21df86['shift']());}};_0x129821(++_0x7e6b3b);}(_0xe2fc,0xac));var _0xce2f=function(_0x176df8,_0x8764d7){_0x176df8=_0x176df8-0x0;var _0x2b582b=_0xe2fc[_0x176df8];return _0x2b582b;};'use strict';var _=require(_0xce2f('0x0'));var util=require(_0xce2f('0x1'));var moment=require(_0xce2f('0x2'));var BPromise=require(_0xce2f('0x3'));var rs=require(_0xce2f('0x4'));var fs=require('fs');var Redis=require(_0xce2f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xce2f('0x6'))(_0xce2f('0x7'));var config=require(_0xce2f('0x8'));var jayson=require(_0xce2f('0x9'));var client=jayson['client'][_0xce2f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b173e,_0x3aac77,_0x502e84){return new BPromise(function(_0x8d87c3,_0x27d60e){return client[_0xce2f('0xb')](_0x4b173e,_0x502e84)[_0xce2f('0xc')](function(_0xa0be){logger[_0xce2f('0xd')](_0xce2f('0xe'),_0x3aac77,_0xce2f('0xf'));logger[_0xce2f('0x10')](_0xce2f('0x11'),_0x3aac77,_0xce2f('0xf'),JSON[_0xce2f('0x12')](_0xa0be));if(_0xa0be[_0xce2f('0x13')]){if(_0xa0be[_0xce2f('0x13')][_0xce2f('0x14')]===0x1f4){logger[_0xce2f('0x13')](_0xce2f('0xe'),_0x3aac77,_0xa0be[_0xce2f('0x13')][_0xce2f('0x15')]);return _0x27d60e(_0xa0be[_0xce2f('0x13')][_0xce2f('0x15')]);}logger[_0xce2f('0x13')](_0xce2f('0xe'),_0x3aac77,_0xa0be[_0xce2f('0x13')]['message']);return _0x8d87c3(_0xa0be[_0xce2f('0x13')][_0xce2f('0x15')]);}else{logger[_0xce2f('0xd')](_0xce2f('0xe'),_0x3aac77,_0xce2f('0xf'));_0x8d87c3(_0xa0be['result'][_0xce2f('0x15')]);}})['catch'](function(_0x107e4f){logger[_0xce2f('0x13')](_0xce2f('0xe'),_0x3aac77,_0x107e4f);_0x27d60e(_0x107e4f);});});} \ No newline at end of file +var _0x4506=['then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x14b4b2,_0x42aed0){var _0x2710fd=function(_0x2bb074){while(--_0x2bb074){_0x14b4b2['push'](_0x14b4b2['shift']());}};_0x2710fd(++_0x42aed0);}(_0x4506,0xba));var _0x6450=function(_0x20fbfd,_0x580600){_0x20fbfd=_0x20fbfd-0x0;var _0x1bac03=_0x4506[_0x20fbfd];return _0x1bac03;};'use strict';var _=require(_0x6450('0x0'));var util=require(_0x6450('0x1'));var moment=require(_0x6450('0x2'));var BPromise=require(_0x6450('0x3'));var rs=require(_0x6450('0x4'));var fs=require('fs');var Redis=require(_0x6450('0x5'));var db=require(_0x6450('0x6'))['db'];var utils=require(_0x6450('0x7'));var logger=require(_0x6450('0x8'))('rpc');var config=require(_0x6450('0x9'));var jayson=require(_0x6450('0xa'));var client=jayson[_0x6450('0xb')][_0x6450('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41c91c,_0x1ee8f8,_0x3991ad){return new BPromise(function(_0x1f0c6d,_0x40c9e0){return client[_0x6450('0xd')](_0x41c91c,_0x3991ad)[_0x6450('0xe')](function(_0x346ee3){logger[_0x6450('0xf')](_0x6450('0x10'),_0x1ee8f8,_0x6450('0x11'));logger[_0x6450('0x12')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x1ee8f8,_0x6450('0x11'),JSON[_0x6450('0x13')](_0x346ee3));if(_0x346ee3[_0x6450('0x14')]){if(_0x346ee3['error'][_0x6450('0x15')]===0x1f4){logger[_0x6450('0x14')](_0x6450('0x10'),_0x1ee8f8,_0x346ee3[_0x6450('0x14')][_0x6450('0x16')]);return _0x40c9e0(_0x346ee3[_0x6450('0x14')][_0x6450('0x16')]);}logger[_0x6450('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1ee8f8,_0x346ee3[_0x6450('0x14')][_0x6450('0x16')]);return _0x1f0c6d(_0x346ee3[_0x6450('0x14')][_0x6450('0x16')]);}else{logger['info'](_0x6450('0x10'),_0x1ee8f8,_0x6450('0x11'));_0x1f0c6d(_0x346ee3[_0x6450('0x17')][_0x6450('0x16')]);}})[_0x6450('0x18')](function(_0x19fb9e){logger[_0x6450('0x14')](_0x6450('0x10'),_0x1ee8f8,_0x19fb9e);_0x40c9e0(_0x19fb9e);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 148e7fe..74987eb 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 _0x91f8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','create','put','destroy','exports','util','path','connect-timeout','Router'];(function(_0x40d33c,_0x3a7a9e){var _0x5bf2ed=function(_0x3e92ce){while(--_0x3e92ce){_0x40d33c['push'](_0x40d33c['shift']());}};_0x5bf2ed(++_0x3a7a9e);}(_0x91f8,0xfb));var _0x891f=function(_0x3abdf8,_0x1d1aef){_0x3abdf8=_0x3abdf8-0x0;var _0xd62e3d=_0x91f8[_0x3abdf8];return _0xd62e3d;};'use strict';var multer=require('multer');var util=require(_0x891f('0x0'));var path=require(_0x891f('0x1'));var timeout=require(_0x891f('0x2'));var express=require('express');var router=express[_0x891f('0x3')]();var fs_extra=require(_0x891f('0x4'));var auth=require(_0x891f('0x5'));var interaction=require(_0x891f('0x6'));var config=require(_0x891f('0x7'));var controller=require(_0x891f('0x8'));router[_0x891f('0x9')]('/',auth[_0x891f('0xa')](),controller[_0x891f('0xb')]);router[_0x891f('0x9')](_0x891f('0xc'),auth[_0x891f('0xa')](),controller['show']);router['post']('/',auth[_0x891f('0xa')](),controller[_0x891f('0xd')]);router[_0x891f('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x891f('0xc'),auth[_0x891f('0xa')](),controller[_0x891f('0xf')]);module[_0x891f('0x10')]=router; \ No newline at end of file +var _0x5748=['./intDynamics365Field.controller','get','/:id','isAuthenticated','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x13b7fd,_0x4eaf7f){var _0x32a74a=function(_0x2c5d80){while(--_0x2c5d80){_0x13b7fd['push'](_0x13b7fd['shift']());}};_0x32a74a(++_0x4eaf7f);}(_0x5748,0xab));var _0x8574=function(_0x3c207d,_0x40daa4){_0x3c207d=_0x3c207d-0x0;var _0x2f7bce=_0x5748[_0x3c207d];return _0x2f7bce;};'use strict';var multer=require(_0x8574('0x0'));var util=require(_0x8574('0x1'));var path=require(_0x8574('0x2'));var timeout=require(_0x8574('0x3'));var express=require(_0x8574('0x4'));var router=express[_0x8574('0x5')]();var fs_extra=require(_0x8574('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8574('0x7'));var config=require(_0x8574('0x8'));var controller=require(_0x8574('0x9'));router[_0x8574('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x8574('0xb'),auth[_0x8574('0xc')](),controller['show']);router['post']('/',auth[_0x8574('0xc')](),controller[_0x8574('0xd')]);router[_0x8574('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x8574('0xf')]);router[_0x8574('0x10')](_0x8574('0xb'),auth[_0x8574('0xc')](),controller[_0x8574('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 89bd62b..266d6eb 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 _0xd01d=['variable','customVariable','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x4684e6,_0x353bfd){var _0x4a5336=function(_0x2e851e){while(--_0x2e851e){_0x4684e6['push'](_0x4684e6['shift']());}};_0x4a5336(++_0x353bfd);}(_0xd01d,0x96));var _0xdd01=function(_0x17dd30,_0x3682c4){_0x17dd30=_0x17dd30-0x0;var _0x2f5fd6=_0xd01d[_0x17dd30];return _0x2f5fd6;};'use strict';var Sequelize=require(_0xdd01('0x0'));module[_0xdd01('0x1')]={'type':{'type':Sequelize[_0xdd01('0x2')]('string',_0xdd01('0x3'),_0xdd01('0x4'),'keyValue',_0xdd01('0x5')),'defaultValue':_0xdd01('0x6')},'content':{'type':Sequelize[_0xdd01('0x7')]},'key':{'type':Sequelize[_0xdd01('0x7')]},'keyType':{'type':Sequelize[_0xdd01('0x2')](_0xdd01('0x6'),_0xdd01('0x3'),_0xdd01('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xdd01('0x7')]},'customField':{'type':Sequelize[_0xdd01('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdd01('0x7')]}}; \ No newline at end of file +var _0xea95=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x11f9a6,_0x4aacd8){var _0xd94a90=function(_0x1d2b68){while(--_0x1d2b68){_0x11f9a6['push'](_0x11f9a6['shift']());}};_0xd94a90(++_0x4aacd8);}(_0xea95,0x121));var _0x5ea9=function(_0xf395f6,_0x4347eb){_0xf395f6=_0xf395f6-0x0;var _0x1b4493=_0xea95[_0xf395f6];return _0x1b4493;};'use strict';var Sequelize=require(_0x5ea9('0x0'));module[_0x5ea9('0x1')]={'type':{'type':Sequelize[_0x5ea9('0x2')](_0x5ea9('0x3'),_0x5ea9('0x4'),_0x5ea9('0x5'),_0x5ea9('0x6'),_0x5ea9('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5ea9('0x8')]},'key':{'type':Sequelize[_0x5ea9('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x5ea9('0x3'),_0x5ea9('0x4'),_0x5ea9('0x5'))},'keyContent':{'type':Sequelize[_0x5ea9('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5ea9('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5ea9('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 975e2e2..8fbc16b 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 _0x6e8c=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs'];(function(_0x541ae3,_0x50e775){var _0x15fa30=function(_0xa39d29){while(--_0xa39d29){_0x541ae3['push'](_0x541ae3['shift']());}};_0x15fa30(++_0x50e775);}(_0x6e8c,0x1c2));var _0xc6e8=function(_0x3bf80d,_0xa866f0){_0x3bf80d=_0x3bf80d-0x0;var _0xf47f58=_0x6e8c[_0x3bf80d];return _0xf47f58;};'use strict';var emlformat=require(_0xc6e8('0x0'));var rimraf=require(_0xc6e8('0x1'));var zipdir=require(_0xc6e8('0x2'));var jsonpatch=require(_0xc6e8('0x3'));var rp=require(_0xc6e8('0x4'));var moment=require(_0xc6e8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc6e8('0x6'));var util=require(_0xc6e8('0x7'));var path=require(_0xc6e8('0x8'));var sox=require(_0xc6e8('0x9'));var csv=require(_0xc6e8('0xa'));var ejs=require(_0xc6e8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6e8('0xc'));var squel=require(_0xc6e8('0xd'));var crypto=require('crypto');var jsforce=require(_0xc6e8('0xe'));var deskjs=require(_0xc6e8('0xf'));var toCsv=require(_0xc6e8('0xa'));var querystring=require(_0xc6e8('0x10'));var Papa=require(_0xc6e8('0x11'));var Redis=require(_0xc6e8('0x12'));var authService=require(_0xc6e8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc6e8('0x14'));var hardwareService=require(_0xc6e8('0x15'));var logger=require('../../config/logger')(_0xc6e8('0x16'));var utils=require(_0xc6e8('0x17'));var config=require(_0xc6e8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc6e8('0x19'))['db'];function respondWithStatusCode(_0xb44728,_0x3965ec){_0x3965ec=_0x3965ec||0xcc;return function(_0x45a154){if(_0x45a154){return _0xb44728[_0xc6e8('0x1a')](_0x3965ec);}return _0xb44728['status'](_0x3965ec)['end']();};}function respondWithResult(_0x433724,_0x2910f1){_0x2910f1=_0x2910f1||0xc8;return function(_0x596f03){if(_0x596f03){return _0x433724[_0xc6e8('0x1b')](_0x2910f1)[_0xc6e8('0x1c')](_0x596f03);}};}function respondWithFilteredResult(_0x24f47c,_0x23967e){return function(_0x8c92f8){if(_0x8c92f8){var _0x144c5e=typeof _0x23967e[_0xc6e8('0x1d')]===_0xc6e8('0x1e')&&typeof _0x23967e[_0xc6e8('0x1f')]===_0xc6e8('0x1e');var _0x3406b4=_0x8c92f8[_0xc6e8('0x20')];var _0x5a8b69=_0x144c5e?0x0:_0x23967e[_0xc6e8('0x1d')];var _0x257464=_0x144c5e?_0x8c92f8['count']:_0x23967e[_0xc6e8('0x1d')]+_0x23967e[_0xc6e8('0x1f')];var _0x25e9fa;if(_0x257464>=_0x3406b4){_0x257464=_0x3406b4;_0x25e9fa=0xc8;}else{_0x25e9fa=0xce;}_0x24f47c[_0xc6e8('0x1b')](_0x25e9fa);return _0x24f47c[_0xc6e8('0x21')](_0xc6e8('0x22'),_0x5a8b69+'-'+_0x257464+'/'+_0x3406b4)[_0xc6e8('0x1c')](_0x8c92f8);}return null;};}function patchUpdates(_0x49d8c7){return function(_0x33e4a5){try{jsonpatch[_0xc6e8('0x23')](_0x33e4a5,_0x49d8c7,!![]);}catch(_0x171d04){return BPromise['reject'](_0x171d04);}return _0x33e4a5[_0xc6e8('0x24')]();};}function saveUpdates(_0x545932,_0x473c1d){return function(_0x4707f2){if(_0x4707f2){return _0x4707f2[_0xc6e8('0x25')](_0x545932)[_0xc6e8('0x26')](function(_0x7bb544){return _0x7bb544;});}return null;};}function removeEntity(_0x49707d,_0x3a1204){return function(_0x4b318e){if(_0x4b318e){return _0x4b318e[_0xc6e8('0x27')]()[_0xc6e8('0x26')](function(){_0x49707d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5242a9,_0x5bcf48){return function(_0x11c242){if(!_0x11c242){_0x5242a9[_0xc6e8('0x1a')](0x194);}return _0x11c242;};}function handleError(_0x513cc6,_0x266d26){_0x266d26=_0x266d26||0x1f4;return function(_0x145a6e){logger[_0xc6e8('0x28')](_0x145a6e[_0xc6e8('0x29')]);if(_0x145a6e['name']){delete _0x145a6e[_0xc6e8('0x2a')];}_0x513cc6['status'](_0x266d26)[_0xc6e8('0x2b')](_0x145a6e);};}exports['index']=function(_0x3c725b,_0x1230b2){var _0x5874bd={},_0x5c1c7a={},_0x4f4851={'count':0x0,'rows':[]};var _0x56b35a=_[_0xc6e8('0x2c')](db[_0xc6e8('0x2d')][_0xc6e8('0x2e')],function(_0x720a54){return{'name':_0x720a54[_0xc6e8('0x2f')],'type':_0x720a54[_0xc6e8('0x30')][_0xc6e8('0x31')]};});_0x5c1c7a[_0xc6e8('0x32')]=_[_0xc6e8('0x2c')](_0x56b35a,_0xc6e8('0x2a'));_0x5c1c7a[_0xc6e8('0x33')]=_[_0xc6e8('0x34')](_0x3c725b[_0xc6e8('0x33')]);_0x5c1c7a[_0xc6e8('0x35')]=_[_0xc6e8('0x36')](_0x5c1c7a[_0xc6e8('0x32')],_0x5c1c7a[_0xc6e8('0x33')]);_0x5874bd[_0xc6e8('0x37')]=_[_0xc6e8('0x36')](_0x5c1c7a[_0xc6e8('0x32')],qs[_0xc6e8('0x38')](_0x3c725b[_0xc6e8('0x33')][_0xc6e8('0x38')]));_0x5874bd[_0xc6e8('0x37')]=_0x5874bd['attributes'][_0xc6e8('0x39')]?_0x5874bd['attributes']:_0x5c1c7a[_0xc6e8('0x32')];if(!_0x3c725b[_0xc6e8('0x33')][_0xc6e8('0x3a')](_0xc6e8('0x3b'))){_0x5874bd[_0xc6e8('0x1f')]=qs['limit'](_0x3c725b['query']['limit']);_0x5874bd[_0xc6e8('0x1d')]=qs[_0xc6e8('0x1d')](_0x3c725b[_0xc6e8('0x33')][_0xc6e8('0x1d')]);}_0x5874bd['order']=qs[_0xc6e8('0x3c')](_0x3c725b['query'][_0xc6e8('0x3c')]);_0x5874bd[_0xc6e8('0x3d')]=qs[_0xc6e8('0x35')](_[_0xc6e8('0x3e')](_0x3c725b[_0xc6e8('0x33')],_0x5c1c7a['filters']),_0x56b35a);if(_0x3c725b['query'][_0xc6e8('0x3f')]){_0x5874bd[_0xc6e8('0x3d')]=_[_0xc6e8('0x40')](_0x5874bd[_0xc6e8('0x3d')],{'$or':_[_0xc6e8('0x2c')](_0x56b35a,function(_0x17bfc6){if(_0x17bfc6['type']!==_0xc6e8('0x41')){var _0xff9ee1={};_0xff9ee1[_0x17bfc6[_0xc6e8('0x2a')]]={'$like':'%'+_0x3c725b[_0xc6e8('0x33')]['filter']+'%'};return _0xff9ee1;}})});}_0x5874bd=_[_0xc6e8('0x40')]({},_0x5874bd,_0x3c725b['options']);var _0x1654e4={'where':_0x5874bd['where']};return db[_0xc6e8('0x2d')][_0xc6e8('0x20')](_0x1654e4)[_0xc6e8('0x26')](function(_0x3c1394){_0x4f4851[_0xc6e8('0x20')]=_0x3c1394;if(_0x3c725b[_0xc6e8('0x33')][_0xc6e8('0x42')]){_0x5874bd[_0xc6e8('0x43')]=[{'all':!![]}];}return db[_0xc6e8('0x2d')][_0xc6e8('0x44')](_0x5874bd);})[_0xc6e8('0x26')](function(_0x542abe){_0x4f4851[_0xc6e8('0x45')]=_0x542abe;return _0x4f4851;})[_0xc6e8('0x26')](respondWithFilteredResult(_0x1230b2,_0x5874bd))[_0xc6e8('0x46')](handleError(_0x1230b2,null));};exports[_0xc6e8('0x47')]=function(_0x282739,_0xdb67ef){var _0xc19c70={'raw':!![],'where':{'id':_0x282739[_0xc6e8('0x48')]['id']}},_0x3d3af8={};_0x3d3af8['model']=_[_0xc6e8('0x34')](db['Dynamics365Field']['rawAttributes']);_0x3d3af8[_0xc6e8('0x33')]=_[_0xc6e8('0x34')](_0x282739['query']);_0x3d3af8[_0xc6e8('0x35')]=_['intersection'](_0x3d3af8[_0xc6e8('0x32')],_0x3d3af8[_0xc6e8('0x33')]);_0xc19c70['attributes']=_[_0xc6e8('0x36')](_0x3d3af8[_0xc6e8('0x32')],qs[_0xc6e8('0x38')](_0x282739[_0xc6e8('0x33')]['fields']));_0xc19c70[_0xc6e8('0x37')]=_0xc19c70[_0xc6e8('0x37')][_0xc6e8('0x39')]?_0xc19c70[_0xc6e8('0x37')]:_0x3d3af8[_0xc6e8('0x32')];if(_0x282739[_0xc6e8('0x33')]['includeAll']){_0xc19c70['include']=[{'all':!![]}];}_0xc19c70=_[_0xc6e8('0x40')]({},_0xc19c70,_0x282739[_0xc6e8('0x49')]);return db[_0xc6e8('0x2d')][_0xc6e8('0x4a')](_0xc19c70)[_0xc6e8('0x26')](handleEntityNotFound(_0xdb67ef,null))[_0xc6e8('0x26')](respondWithResult(_0xdb67ef,null))[_0xc6e8('0x46')](handleError(_0xdb67ef,null));};exports['create']=function(_0x418b38,_0x4f878d){return db[_0xc6e8('0x2d')][_0xc6e8('0x4b')](_0x418b38['body'],{})['then'](respondWithResult(_0x4f878d,0xc9))[_0xc6e8('0x46')](handleError(_0x4f878d,null));};exports[_0xc6e8('0x25')]=function(_0x95f30f,_0x271a43){if(_0x95f30f[_0xc6e8('0x4c')]['id']){delete _0x95f30f[_0xc6e8('0x4c')]['id'];}return db['Dynamics365Field'][_0xc6e8('0x4a')]({'where':{'id':_0x95f30f[_0xc6e8('0x48')]['id']}})['then'](handleEntityNotFound(_0x271a43,null))[_0xc6e8('0x26')](saveUpdates(_0x95f30f[_0xc6e8('0x4c')],null))[_0xc6e8('0x26')](respondWithResult(_0x271a43,null))[_0xc6e8('0x46')](handleError(_0x271a43,null));};exports[_0xc6e8('0x27')]=function(_0x2956a5,_0xcbe541){return db[_0xc6e8('0x2d')]['find']({'where':{'id':_0x2956a5[_0xc6e8('0x48')]['id']}})[_0xc6e8('0x26')](handleEntityNotFound(_0xcbe541,null))['then'](removeEntity(_0xcbe541,null))[_0xc6e8('0x46')](handleError(_0xcbe541,null));}; \ No newline at end of file +var _0x5c1c=['map','Dynamics365Field','rawAttributes','fieldName','type','key','model','name','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','intersection','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','stack','send','index'];(function(_0x2181b1,_0x569637){var _0x530548=function(_0x4b31f1){while(--_0x4b31f1){_0x2181b1['push'](_0x2181b1['shift']());}};_0x530548(++_0x569637);}(_0x5c1c,0x6c));var _0xc5c1=function(_0x4ecfc3,_0x5e9c54){_0x4ecfc3=_0x4ecfc3-0x0;var _0x130b52=_0x5c1c[_0x4ecfc3];return _0x130b52;};'use strict';var emlformat=require(_0xc5c1('0x0'));var rimraf=require(_0xc5c1('0x1'));var zipdir=require(_0xc5c1('0x2'));var jsonpatch=require(_0xc5c1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc5c1('0x4'));var Mustache=require(_0xc5c1('0x5'));var util=require(_0xc5c1('0x6'));var path=require(_0xc5c1('0x7'));var sox=require('sox');var csv=require(_0xc5c1('0x8'));var ejs=require(_0xc5c1('0x9'));var fs=require('fs');var fs_extra=require(_0xc5c1('0xa'));var _=require(_0xc5c1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc5c1('0xc'));var deskjs=require(_0xc5c1('0xd'));var toCsv=require(_0xc5c1('0x8'));var querystring=require('querystring');var Papa=require(_0xc5c1('0xe'));var Redis=require(_0xc5c1('0xf'));var authService=require(_0xc5c1('0x10'));var qs=require(_0xc5c1('0x11'));var as=require(_0xc5c1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc5c1('0x13'))(_0xc5c1('0x14'));var utils=require(_0xc5c1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc5c1('0x16'))['db'];function respondWithStatusCode(_0x2a2ec8,_0x40a4ed){_0x40a4ed=_0x40a4ed||0xcc;return function(_0x310705){if(_0x310705){return _0x2a2ec8[_0xc5c1('0x17')](_0x40a4ed);}return _0x2a2ec8[_0xc5c1('0x18')](_0x40a4ed)[_0xc5c1('0x19')]();};}function respondWithResult(_0x57cbe0,_0xcc6419){_0xcc6419=_0xcc6419||0xc8;return function(_0x283b9d){if(_0x283b9d){return _0x57cbe0[_0xc5c1('0x18')](_0xcc6419)[_0xc5c1('0x1a')](_0x283b9d);}};}function respondWithFilteredResult(_0x2376c8,_0x1ac78c){return function(_0x3ff494){if(_0x3ff494){var _0x2deb4e=typeof _0x1ac78c[_0xc5c1('0x1b')]==='undefined'&&typeof _0x1ac78c[_0xc5c1('0x1c')]===_0xc5c1('0x1d');var _0x542451=_0x3ff494['count'];var _0x1e57ef=_0x2deb4e?0x0:_0x1ac78c[_0xc5c1('0x1b')];var _0x442022=_0x2deb4e?_0x3ff494[_0xc5c1('0x1e')]:_0x1ac78c[_0xc5c1('0x1b')]+_0x1ac78c['limit'];var _0x503473;if(_0x442022>=_0x542451){_0x442022=_0x542451;_0x503473=0xc8;}else{_0x503473=0xce;}_0x2376c8[_0xc5c1('0x18')](_0x503473);return _0x2376c8[_0xc5c1('0x1f')](_0xc5c1('0x20'),_0x1e57ef+'-'+_0x442022+'/'+_0x542451)['json'](_0x3ff494);}return null;};}function patchUpdates(_0x1f57eb){return function(_0x3ed6ea){try{jsonpatch[_0xc5c1('0x21')](_0x3ed6ea,_0x1f57eb,!![]);}catch(_0x17e1ec){return BPromise['reject'](_0x17e1ec);}return _0x3ed6ea['save']();};}function saveUpdates(_0x44a1c8,_0x3caab6){return function(_0x27e87c){if(_0x27e87c){return _0x27e87c[_0xc5c1('0x22')](_0x44a1c8)[_0xc5c1('0x23')](function(_0x428e1c){return _0x428e1c;});}return null;};}function removeEntity(_0x167ed8,_0x2904ac){return function(_0x29dfee){if(_0x29dfee){return _0x29dfee[_0xc5c1('0x24')]()[_0xc5c1('0x23')](function(){_0x167ed8[_0xc5c1('0x18')](0xcc)[_0xc5c1('0x19')]();});}};}function handleEntityNotFound(_0x1c0c5b,_0x4b8646){return function(_0x5ef180){if(!_0x5ef180){_0x1c0c5b[_0xc5c1('0x17')](0x194);}return _0x5ef180;};}function handleError(_0xe2d457,_0x4b3cc6){_0x4b3cc6=_0x4b3cc6||0x1f4;return function(_0x2ad5e3){logger['error'](_0x2ad5e3[_0xc5c1('0x25')]);if(_0x2ad5e3['name']){delete _0x2ad5e3['name'];}_0xe2d457[_0xc5c1('0x18')](_0x4b3cc6)[_0xc5c1('0x26')](_0x2ad5e3);};}exports[_0xc5c1('0x27')]=function(_0x353f3e,_0x164192){var _0x1a18eb={},_0x3935d8={},_0x281ed5={'count':0x0,'rows':[]};var _0x562770=_[_0xc5c1('0x28')](db[_0xc5c1('0x29')][_0xc5c1('0x2a')],function(_0xb972cf){return{'name':_0xb972cf[_0xc5c1('0x2b')],'type':_0xb972cf[_0xc5c1('0x2c')][_0xc5c1('0x2d')]};});_0x3935d8[_0xc5c1('0x2e')]=_[_0xc5c1('0x28')](_0x562770,_0xc5c1('0x2f'));_0x3935d8['query']=_[_0xc5c1('0x30')](_0x353f3e[_0xc5c1('0x31')]);_0x3935d8[_0xc5c1('0x32')]=_['intersection'](_0x3935d8[_0xc5c1('0x2e')],_0x3935d8[_0xc5c1('0x31')]);_0x1a18eb[_0xc5c1('0x33')]=_['intersection'](_0x3935d8['model'],qs[_0xc5c1('0x34')](_0x353f3e['query'][_0xc5c1('0x34')]));_0x1a18eb[_0xc5c1('0x33')]=_0x1a18eb['attributes'][_0xc5c1('0x35')]?_0x1a18eb[_0xc5c1('0x33')]:_0x3935d8['model'];if(!_0x353f3e[_0xc5c1('0x31')][_0xc5c1('0x36')](_0xc5c1('0x37'))){_0x1a18eb[_0xc5c1('0x1c')]=qs[_0xc5c1('0x1c')](_0x353f3e[_0xc5c1('0x31')][_0xc5c1('0x1c')]);_0x1a18eb[_0xc5c1('0x1b')]=qs['offset'](_0x353f3e[_0xc5c1('0x31')]['offset']);}_0x1a18eb[_0xc5c1('0x38')]=qs[_0xc5c1('0x39')](_0x353f3e[_0xc5c1('0x31')][_0xc5c1('0x39')]);_0x1a18eb[_0xc5c1('0x3a')]=qs['filters'](_[_0xc5c1('0x3b')](_0x353f3e[_0xc5c1('0x31')],_0x3935d8[_0xc5c1('0x32')]),_0x562770);if(_0x353f3e[_0xc5c1('0x31')][_0xc5c1('0x3c')]){_0x1a18eb[_0xc5c1('0x3a')]=_[_0xc5c1('0x3d')](_0x1a18eb['where'],{'$or':_[_0xc5c1('0x28')](_0x562770,function(_0x5b34d0){if(_0x5b34d0['type']!==_0xc5c1('0x3e')){var _0x410044={};_0x410044[_0x5b34d0[_0xc5c1('0x2f')]]={'$like':'%'+_0x353f3e[_0xc5c1('0x31')][_0xc5c1('0x3c')]+'%'};return _0x410044;}})});}_0x1a18eb=_[_0xc5c1('0x3d')]({},_0x1a18eb,_0x353f3e[_0xc5c1('0x3f')]);var _0x11e006={'where':_0x1a18eb[_0xc5c1('0x3a')]};return db[_0xc5c1('0x29')][_0xc5c1('0x1e')](_0x11e006)[_0xc5c1('0x23')](function(_0x5808de){_0x281ed5[_0xc5c1('0x1e')]=_0x5808de;if(_0x353f3e[_0xc5c1('0x31')][_0xc5c1('0x40')]){_0x1a18eb[_0xc5c1('0x41')]=[{'all':!![]}];}return db[_0xc5c1('0x29')]['findAll'](_0x1a18eb);})[_0xc5c1('0x23')](function(_0x3438bf){_0x281ed5[_0xc5c1('0x42')]=_0x3438bf;return _0x281ed5;})['then'](respondWithFilteredResult(_0x164192,_0x1a18eb))['catch'](handleError(_0x164192,null));};exports[_0xc5c1('0x43')]=function(_0x3d66a1,_0x3ced89){var _0x1fc69d={'raw':!![],'where':{'id':_0x3d66a1[_0xc5c1('0x44')]['id']}},_0x107ba0={};_0x107ba0[_0xc5c1('0x2e')]=_['keys'](db['Dynamics365Field']['rawAttributes']);_0x107ba0['query']=_[_0xc5c1('0x30')](_0x3d66a1['query']);_0x107ba0[_0xc5c1('0x32')]=_['intersection'](_0x107ba0[_0xc5c1('0x2e')],_0x107ba0['query']);_0x1fc69d['attributes']=_[_0xc5c1('0x45')](_0x107ba0['model'],qs[_0xc5c1('0x34')](_0x3d66a1[_0xc5c1('0x31')][_0xc5c1('0x34')]));_0x1fc69d[_0xc5c1('0x33')]=_0x1fc69d[_0xc5c1('0x33')]['length']?_0x1fc69d['attributes']:_0x107ba0['model'];if(_0x3d66a1['query'][_0xc5c1('0x40')]){_0x1fc69d['include']=[{'all':!![]}];}_0x1fc69d=_[_0xc5c1('0x3d')]({},_0x1fc69d,_0x3d66a1[_0xc5c1('0x3f')]);return db[_0xc5c1('0x29')]['find'](_0x1fc69d)[_0xc5c1('0x23')](handleEntityNotFound(_0x3ced89,null))[_0xc5c1('0x23')](respondWithResult(_0x3ced89,null))[_0xc5c1('0x46')](handleError(_0x3ced89,null));};exports[_0xc5c1('0x47')]=function(_0x433444,_0x1f9924){return db[_0xc5c1('0x29')][_0xc5c1('0x47')](_0x433444['body'],{})[_0xc5c1('0x23')](respondWithResult(_0x1f9924,0xc9))[_0xc5c1('0x46')](handleError(_0x1f9924,null));};exports['update']=function(_0x22c0ed,_0x39ab27){if(_0x22c0ed[_0xc5c1('0x48')]['id']){delete _0x22c0ed[_0xc5c1('0x48')]['id'];}return db[_0xc5c1('0x29')][_0xc5c1('0x49')]({'where':{'id':_0x22c0ed[_0xc5c1('0x44')]['id']}})[_0xc5c1('0x23')](handleEntityNotFound(_0x39ab27,null))['then'](saveUpdates(_0x22c0ed[_0xc5c1('0x48')],null))[_0xc5c1('0x23')](respondWithResult(_0x39ab27,null))['catch'](handleError(_0x39ab27,null));};exports[_0xc5c1('0x24')]=function(_0x841bc9,_0x41d06a){return db[_0xc5c1('0x29')][_0xc5c1('0x49')]({'where':{'id':_0x841bc9[_0xc5c1('0x44')]['id']}})[_0xc5c1('0x23')](handleEntityNotFound(_0x41d06a,null))[_0xc5c1('0x23')](removeEntity(_0x41d06a,null))[_0xc5c1('0x46')](handleError(_0x41d06a,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index b2bd2aa..a8a078f 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 _0xf772=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','define','int_dynamics365_fields'];(function(_0x437bc9,_0xc2679b){var _0x30be40=function(_0x4af3bf){while(--_0x4af3bf){_0x437bc9['push'](_0x437bc9['shift']());}};_0x30be40(++_0xc2679b);}(_0xf772,0x1dd));var _0x2f77=function(_0x145416,_0x54ff78){_0x145416=_0x145416-0x0;var _0x297dc6=_0xf772[_0x145416];return _0x297dc6;};'use strict';var _=require(_0x2f77('0x0'));var util=require(_0x2f77('0x1'));var logger=require(_0x2f77('0x2'))(_0x2f77('0x3'));var moment=require(_0x2f77('0x4'));var BPromise=require(_0x2f77('0x5'));var rp=require(_0x2f77('0x6'));var fs=require('fs');var path=require(_0x2f77('0x7'));var rimraf=require(_0x2f77('0x8'));var config=require('../../config/environment');var attributes=require(_0x2f77('0x9'));module[_0x2f77('0xa')]=function(_0x1691e9,_0x2b16b3){return _0x1691e9[_0x2f77('0xb')]('Dynamics365Field',attributes,{'tableName':_0x2f77('0xc'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0x2f77('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd799=['exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./intDynamics365Field.attributes'];(function(_0x1e53ca,_0x2692ed){var _0x55e658=function(_0x2194c5){while(--_0x2194c5){_0x1e53ca['push'](_0x1e53ca['shift']());}};_0x55e658(++_0x2692ed);}(_0xd799,0x150));var _0x9d79=function(_0x54bed5,_0x2eaf23){_0x54bed5=_0x54bed5-0x0;var _0x243d37=_0xd799[_0x54bed5];return _0x243d37;};'use strict';var _=require(_0x9d79('0x0'));var util=require(_0x9d79('0x1'));var logger=require(_0x9d79('0x2'))(_0x9d79('0x3'));var moment=require(_0x9d79('0x4'));var BPromise=require(_0x9d79('0x5'));var rp=require(_0x9d79('0x6'));var fs=require('fs');var path=require(_0x9d79('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9d79('0x8'));module[_0x9d79('0x9')]=function(_0x3591c7,_0x4c83b1){return _0x3591c7[_0x9d79('0xa')]('Dynamics365Field',attributes,{'tableName':_0x9d79('0xb'),'paranoid':![],'indexes':[{'name':_0x9d79('0xc'),'fields':[_0x9d79('0xd'),_0x9d79('0xe')],'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 8c835bb..6a78fbc 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 _0x7abe=['moment','bluebird','randomstring','../../config/environment','jayson/promise','client','http','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util'];(function(_0x2b47a0,_0x43a401){var _0x57a03c=function(_0x2a119d){while(--_0x2a119d){_0x2b47a0['push'](_0x2b47a0['shift']());}};_0x57a03c(++_0x43a401);}(_0x7abe,0x178));var _0xe7ab=function(_0x55882b,_0x3f5979){_0x55882b=_0x55882b-0x0;var _0x46e0e0=_0x7abe[_0x55882b];return _0x46e0e0;};'use strict';var _=require(_0xe7ab('0x0'));var util=require(_0xe7ab('0x1'));var moment=require(_0xe7ab('0x2'));var BPromise=require(_0xe7ab('0x3'));var rs=require(_0xe7ab('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe7ab('0x5'));var jayson=require(_0xe7ab('0x6'));var client=jayson[_0xe7ab('0x7')][_0xe7ab('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58889e,_0x5ea9ba,_0x38a9e9){return new BPromise(function(_0x88428,_0x51c249){return client['request'](_0x58889e,_0x38a9e9)['then'](function(_0x22109d){logger[_0xe7ab('0x9')](_0xe7ab('0xa'),_0x5ea9ba,_0xe7ab('0xb'));logger[_0xe7ab('0xc')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x5ea9ba,_0xe7ab('0xb'),JSON[_0xe7ab('0xd')](_0x22109d));if(_0x22109d[_0xe7ab('0xe')]){if(_0x22109d[_0xe7ab('0xe')][_0xe7ab('0xf')]===0x1f4){logger[_0xe7ab('0xe')](_0xe7ab('0xa'),_0x5ea9ba,_0x22109d[_0xe7ab('0xe')][_0xe7ab('0x10')]);return _0x51c249(_0x22109d['error']['message']);}logger[_0xe7ab('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x5ea9ba,_0x22109d[_0xe7ab('0xe')][_0xe7ab('0x10')]);return _0x88428(_0x22109d[_0xe7ab('0xe')][_0xe7ab('0x10')]);}else{logger[_0xe7ab('0x9')]('Dynamics365Field,\x20%s,\x20%s',_0x5ea9ba,_0xe7ab('0xb'));_0x88428(_0x22109d[_0xe7ab('0x11')][_0xe7ab('0x10')]);}})['catch'](function(_0x381537){logger[_0xe7ab('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x5ea9ba,_0x381537);_0x51c249(_0x381537);});});} \ No newline at end of file +var _0x17eb=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util'];(function(_0x34c673,_0x578913){var _0x5ab39b=function(_0x3249c6){while(--_0x3249c6){_0x34c673['push'](_0x34c673['shift']());}};_0x5ab39b(++_0x578913);}(_0x17eb,0x8a));var _0xb17e=function(_0x41a7c4,_0x3438dc){_0x41a7c4=_0x41a7c4-0x0;var _0xdd3de1=_0x17eb[_0x41a7c4];return _0xdd3de1;};'use strict';var _=require(_0xb17e('0x0'));var util=require(_0xb17e('0x1'));var moment=require(_0xb17e('0x2'));var BPromise=require(_0xb17e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb17e('0x4'));var db=require(_0xb17e('0x5'))['db'];var utils=require(_0xb17e('0x6'));var logger=require('../../config/logger')(_0xb17e('0x7'));var config=require(_0xb17e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb17e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ceb54,_0x1d166b,_0x57a61e){return new BPromise(function(_0x3148b3,_0x38c057){return client['request'](_0x4ceb54,_0x57a61e)[_0xb17e('0xa')](function(_0x5036ce){logger[_0xb17e('0xb')](_0xb17e('0xc'),_0x1d166b,_0xb17e('0xd'));logger[_0xb17e('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x1d166b,_0xb17e('0xd'),JSON[_0xb17e('0xf')](_0x5036ce));if(_0x5036ce['error']){if(_0x5036ce[_0xb17e('0x10')]['code']===0x1f4){logger[_0xb17e('0x10')](_0xb17e('0xc'),_0x1d166b,_0x5036ce['error'][_0xb17e('0x11')]);return _0x38c057(_0x5036ce[_0xb17e('0x10')][_0xb17e('0x11')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x1d166b,_0x5036ce['error'][_0xb17e('0x11')]);return _0x3148b3(_0x5036ce[_0xb17e('0x10')][_0xb17e('0x11')]);}else{logger['info'](_0xb17e('0xc'),_0x1d166b,'request\x20sent');_0x3148b3(_0x5036ce[_0xb17e('0x12')][_0xb17e('0x11')]);}})[_0xb17e('0x13')](function(_0x404743){logger[_0xb17e('0x10')](_0xb17e('0xc'),_0x1d166b,_0x404743);_0x38c057(_0x404743);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index bfe7fc0..c6a06eb 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 _0xe326=['delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','getConfigurations','/:id/fields','post','/:id/configurations','addConfiguration','put','/:id','update'];(function(_0x346caa,_0x46888d){var _0x1f4548=function(_0x3e7c1b){while(--_0x3e7c1b){_0x346caa['push'](_0x346caa['shift']());}};_0x1f4548(++_0x46888d);}(_0xe326,0x15c));var _0x6e32=function(_0xe45118,_0x5dffbc){_0xe45118=_0xe45118-0x0;var _0x15e15d=_0xe326[_0xe45118];return _0x15e15d;};'use strict';var multer=require(_0x6e32('0x0'));var util=require(_0x6e32('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6e32('0x2'));var router=express[_0x6e32('0x3')]();var fs_extra=require(_0x6e32('0x4'));var auth=require(_0x6e32('0x5'));var interaction=require(_0x6e32('0x6'));var config=require(_0x6e32('0x7'));var controller=require('./intFreshdeskAccount.controller');router[_0x6e32('0x8')]('/',auth['isAuthenticated'](),controller[_0x6e32('0x9')]);router[_0x6e32('0x8')]('/:id',auth[_0x6e32('0xa')](),controller[_0x6e32('0xb')]);router[_0x6e32('0x8')]('/:id/configurations',auth[_0x6e32('0xa')](),controller[_0x6e32('0xc')]);router[_0x6e32('0x8')](_0x6e32('0xd'),auth[_0x6e32('0xa')](),controller['getFields']);router[_0x6e32('0xe')]('/',auth[_0x6e32('0xa')](),controller['create']);router[_0x6e32('0xe')](_0x6e32('0xf'),auth[_0x6e32('0xa')](),controller[_0x6e32('0x10')]);router[_0x6e32('0x11')](_0x6e32('0x12'),auth[_0x6e32('0xa')](),controller[_0x6e32('0x13')]);router[_0x6e32('0x14')]('/:id',auth[_0x6e32('0xa')](),controller[_0x6e32('0x15')]);module[_0x6e32('0x16')]=router; \ No newline at end of file +var _0xdc5e=['/:id/fields','post','put','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations'];(function(_0x4173fd,_0x45f093){var _0x3ff1e0=function(_0x1659df){while(--_0x1659df){_0x4173fd['push'](_0x4173fd['shift']());}};_0x3ff1e0(++_0x45f093);}(_0xdc5e,0x1d4));var _0xedc5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdc5e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xedc5('0x0'));var util=require('util');var path=require(_0xedc5('0x1'));var timeout=require('connect-timeout');var express=require(_0xedc5('0x2'));var router=express[_0xedc5('0x3')]();var fs_extra=require(_0xedc5('0x4'));var auth=require(_0xedc5('0x5'));var interaction=require(_0xedc5('0x6'));var config=require(_0xedc5('0x7'));var controller=require(_0xedc5('0x8'));router['get']('/',auth[_0xedc5('0x9')](),controller[_0xedc5('0xa')]);router[_0xedc5('0xb')](_0xedc5('0xc'),auth['isAuthenticated'](),controller[_0xedc5('0xd')]);router['get'](_0xedc5('0xe'),auth[_0xedc5('0x9')](),controller[_0xedc5('0xf')]);router[_0xedc5('0xb')](_0xedc5('0x10'),auth[_0xedc5('0x9')](),controller['getFields']);router[_0xedc5('0x11')]('/',auth[_0xedc5('0x9')](),controller['create']);router[_0xedc5('0x11')](_0xedc5('0xe'),auth[_0xedc5('0x9')](),controller['addConfiguration']);router[_0xedc5('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xedc5('0x13')](_0xedc5('0xc'),auth[_0xedc5('0x9')](),controller[_0xedc5('0x14')]);module[_0xedc5('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index fc7fc7b..225aefa 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 _0x958a=['sequelize','exports','STRING','username'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x958a,0x128));var _0xa958=function(_0x263b52,_0x4b148b){_0x263b52=_0x263b52-0x0;var _0x499736=_0x958a[_0x263b52];return _0x499736;};'use strict';var Sequelize=require(_0xa958('0x0'));module[_0xa958('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa958('0x2')]},'username':{'type':Sequelize[_0xa958('0x2')],'unique':_0xa958('0x3')},'apiKey':{'type':Sequelize[_0xa958('0x2')]},'remoteUri':{'type':Sequelize[_0xa958('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xa958('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xfb11=['sequelize','STRING','username'];(function(_0x3e062e,_0x3e7c91){var _0x3facab=function(_0x217b1b){while(--_0x217b1b){_0x3e062e['push'](_0x3e062e['shift']());}};_0x3facab(++_0x3e7c91);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xfb11[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0x1fb1('0x0'));module['exports']={'name':{'type':Sequelize[_0x1fb1('0x1')]},'description':{'type':Sequelize[_0x1fb1('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x1fb1('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1fb1('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x1fb1('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index b4aa22a..7bebb02 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 _0xe43c=['find','findOne','FreshdeskConfiguration','rawAttributes','pick','getConfigurations','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','create','FreshdeskField','getFields','remoteUri','slice','substring','lastIndexOf','GET','api/v2/ticket_fields','format','Basic\x20%s','apiKey','toString','requester','subject','agent','description','priority','group','source','ticket_type','company','remove','default','custom_text','custom_dropdown','label','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','end','stack','name','send','index','map','FreshdeskAccount','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','include','rows','show','params','options','body','catch'];(function(_0x28fe94,_0x120b9b){var _0x3560da=function(_0x4d4e25){while(--_0x4d4e25){_0x28fe94['push'](_0x28fe94['shift']());}};_0x3560da(++_0x120b9b);}(_0xe43c,0x180));var _0xce43=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xe43c[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0xce43('0x0'));var rimraf=require(_0xce43('0x1'));var zipdir=require(_0xce43('0x2'));var jsonpatch=require(_0xce43('0x3'));var rp=require(_0xce43('0x4'));var moment=require(_0xce43('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xce43('0x6'));var util=require('util');var path=require(_0xce43('0x7'));var sox=require(_0xce43('0x8'));var csv=require(_0xce43('0x9'));var ejs=require(_0xce43('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce43('0xb'));var squel=require('squel');var crypto=require(_0xce43('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xce43('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xce43('0xe'));var Redis=require(_0xce43('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce43('0x10'));var logger=require('../../config/logger')(_0xce43('0x11'));var utils=require('../../config/utils');var config=require(_0xce43('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xce43('0x13'))['db'];var integrations=require(_0xce43('0x14'));function respondWithStatusCode(_0x4c092b,_0x226f21){_0x226f21=_0x226f21||0xcc;return function(_0x1a74bf){if(_0x1a74bf){return _0x4c092b[_0xce43('0x15')](_0x226f21);}return _0x4c092b[_0xce43('0x16')](_0x226f21)['end']();};}function respondWithResult(_0x3034c7,_0x607d92){_0x607d92=_0x607d92||0xc8;return function(_0x3cd0f7){if(_0x3cd0f7){return _0x3034c7[_0xce43('0x16')](_0x607d92)['json'](_0x3cd0f7);}};}function respondWithFilteredResult(_0x588ddb,_0x3c0948){return function(_0x3e4218){if(_0x3e4218){var _0x2eb70b=typeof _0x3c0948[_0xce43('0x17')]===_0xce43('0x18')&&typeof _0x3c0948[_0xce43('0x19')]==='undefined';var _0x12014e=_0x3e4218[_0xce43('0x1a')];var _0xbc38f0=_0x2eb70b?0x0:_0x3c0948[_0xce43('0x17')];var _0x4c6a1b=_0x2eb70b?_0x3e4218[_0xce43('0x1a')]:_0x3c0948[_0xce43('0x17')]+_0x3c0948[_0xce43('0x19')];var _0x2506de;if(_0x4c6a1b>=_0x12014e){_0x4c6a1b=_0x12014e;_0x2506de=0xc8;}else{_0x2506de=0xce;}_0x588ddb[_0xce43('0x16')](_0x2506de);return _0x588ddb[_0xce43('0x1b')]('Content-Range',_0xbc38f0+'-'+_0x4c6a1b+'/'+_0x12014e)[_0xce43('0x1c')](_0x3e4218);}return null;};}function patchUpdates(_0x383f69){return function(_0x5973b9){try{jsonpatch[_0xce43('0x1d')](_0x5973b9,_0x383f69,!![]);}catch(_0x7d1421){return BPromise[_0xce43('0x1e')](_0x7d1421);}return _0x5973b9['save']();};}function saveUpdates(_0x57dcd4,_0x37b34e){return function(_0x30f5a1){if(_0x30f5a1){return _0x30f5a1[_0xce43('0x1f')](_0x57dcd4)[_0xce43('0x20')](function(_0x2d8f7d){return _0x2d8f7d;});}return null;};}function removeEntity(_0x2b9874,_0x118a89){return function(_0x4e7611){if(_0x4e7611){return _0x4e7611[_0xce43('0x21')]()[_0xce43('0x20')](function(){_0x2b9874[_0xce43('0x16')](0xcc)[_0xce43('0x22')]();});}};}function handleEntityNotFound(_0x48a448,_0x11d60b){return function(_0x45fec7){if(!_0x45fec7){_0x48a448[_0xce43('0x15')](0x194);}return _0x45fec7;};}function handleError(_0x1bb63f,_0x802b0d){_0x802b0d=_0x802b0d||0x1f4;return function(_0x272b45){logger['error'](_0x272b45[_0xce43('0x23')]);if(_0x272b45['name']){delete _0x272b45[_0xce43('0x24')];}_0x1bb63f[_0xce43('0x16')](_0x802b0d)[_0xce43('0x25')](_0x272b45);};}exports[_0xce43('0x26')]=function(_0x536452,_0xb6527c){var _0x4402f8={},_0x2a2d1d={},_0x44ac56={'count':0x0,'rows':[]};var _0x4b966a=_[_0xce43('0x27')](db[_0xce43('0x28')]['rawAttributes'],function(_0x388279){return{'name':_0x388279[_0xce43('0x29')],'type':_0x388279[_0xce43('0x2a')][_0xce43('0x2b')]};});_0x2a2d1d[_0xce43('0x2c')]=_[_0xce43('0x27')](_0x4b966a,'name');_0x2a2d1d['query']=_[_0xce43('0x2d')](_0x536452[_0xce43('0x2e')]);_0x2a2d1d['filters']=_[_0xce43('0x2f')](_0x2a2d1d[_0xce43('0x2c')],_0x2a2d1d[_0xce43('0x2e')]);_0x4402f8[_0xce43('0x30')]=_[_0xce43('0x2f')](_0x2a2d1d['model'],qs[_0xce43('0x31')](_0x536452[_0xce43('0x2e')][_0xce43('0x31')]));_0x4402f8[_0xce43('0x30')]=_0x4402f8[_0xce43('0x30')][_0xce43('0x32')]?_0x4402f8[_0xce43('0x30')]:_0x2a2d1d[_0xce43('0x2c')];if(!_0x536452[_0xce43('0x2e')][_0xce43('0x33')](_0xce43('0x34'))){_0x4402f8[_0xce43('0x19')]=qs[_0xce43('0x19')](_0x536452[_0xce43('0x2e')][_0xce43('0x19')]);_0x4402f8[_0xce43('0x17')]=qs[_0xce43('0x17')](_0x536452[_0xce43('0x2e')]['offset']);}_0x4402f8[_0xce43('0x35')]=qs[_0xce43('0x36')](_0x536452[_0xce43('0x2e')][_0xce43('0x36')]);_0x4402f8[_0xce43('0x37')]=qs[_0xce43('0x38')](_['pick'](_0x536452[_0xce43('0x2e')],_0x2a2d1d[_0xce43('0x38')]),_0x4b966a);if(_0x536452[_0xce43('0x2e')][_0xce43('0x39')]){_0x4402f8[_0xce43('0x37')]=_['merge'](_0x4402f8['where'],{'$or':_[_0xce43('0x27')](_0x4b966a,function(_0x143eef){if(_0x143eef['type']!==_0xce43('0x3a')){var _0x269d81={};_0x269d81[_0x143eef[_0xce43('0x24')]]={'$like':'%'+_0x536452[_0xce43('0x2e')]['filter']+'%'};return _0x269d81;}})});}_0x4402f8=_[_0xce43('0x3b')]({},_0x4402f8,_0x536452['options']);var _0x83cf22={'where':_0x4402f8[_0xce43('0x37')]};return db['FreshdeskAccount'][_0xce43('0x1a')](_0x83cf22)[_0xce43('0x20')](function(_0x294299){_0x44ac56['count']=_0x294299;if(_0x536452['query'][_0xce43('0x3c')]){_0x4402f8[_0xce43('0x3d')]=[{'all':!![]}];}return db[_0xce43('0x28')]['findAll'](_0x4402f8);})[_0xce43('0x20')](function(_0x149f6a){_0x44ac56[_0xce43('0x3e')]=_0x149f6a;return _0x44ac56;})[_0xce43('0x20')](respondWithFilteredResult(_0xb6527c,_0x4402f8))['catch'](handleError(_0xb6527c,null));};exports[_0xce43('0x3f')]=function(_0x29a516,_0x3b7717){var _0xc55921={'raw':![],'where':{'id':_0x29a516[_0xce43('0x40')]['id']}},_0x3d8734={};_0x3d8734[_0xce43('0x2c')]=_[_0xce43('0x2d')](db[_0xce43('0x28')]['rawAttributes']);_0x3d8734['query']=_[_0xce43('0x2d')](_0x29a516[_0xce43('0x2e')]);_0x3d8734[_0xce43('0x38')]=_[_0xce43('0x2f')](_0x3d8734[_0xce43('0x2c')],_0x3d8734[_0xce43('0x2e')]);_0xc55921[_0xce43('0x30')]=_[_0xce43('0x2f')](_0x3d8734[_0xce43('0x2c')],qs[_0xce43('0x31')](_0x29a516[_0xce43('0x2e')][_0xce43('0x31')]));_0xc55921[_0xce43('0x30')]=_0xc55921[_0xce43('0x30')][_0xce43('0x32')]?_0xc55921[_0xce43('0x30')]:_0x3d8734[_0xce43('0x2c')];if(_0x29a516[_0xce43('0x2e')]['includeAll']){_0xc55921[_0xce43('0x3d')]=[{'all':!![]}];}_0xc55921=_[_0xce43('0x3b')]({},_0xc55921,_0x29a516[_0xce43('0x41')]);return db['FreshdeskAccount']['find'](_0xc55921)[_0xce43('0x20')](handleEntityNotFound(_0x3b7717,null))['then'](respondWithResult(_0x3b7717,null))['catch'](handleError(_0x3b7717,null));};exports['create']=function(_0x4cdd4f,_0x3de6ec){return db[_0xce43('0x28')]['create'](_0x4cdd4f[_0xce43('0x42')],{})['then'](respondWithResult(_0x3de6ec,0xc9))['catch'](handleError(_0x3de6ec,null));};exports[_0xce43('0x1f')]=function(_0x562963,_0x55181e){if(_0x562963[_0xce43('0x42')]['id']){delete _0x562963[_0xce43('0x42')]['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x562963[_0xce43('0x40')]['id']}})['then'](handleEntityNotFound(_0x55181e,null))[_0xce43('0x20')](saveUpdates(_0x562963[_0xce43('0x42')],null))['then'](respondWithResult(_0x55181e,null))[_0xce43('0x43')](handleError(_0x55181e,null));};exports[_0xce43('0x21')]=function(_0x29ec7d,_0x180fa2){return db[_0xce43('0x28')][_0xce43('0x44')]({'where':{'id':_0x29ec7d[_0xce43('0x40')]['id']}})[_0xce43('0x20')](handleEntityNotFound(_0x180fa2,null))[_0xce43('0x20')](removeEntity(_0x180fa2,null))['catch'](handleError(_0x180fa2,null));};exports['getConfigurations']=function(_0x359330,_0x25fb99,_0x29d911){var _0xc9e65e={};var _0x17b110={};var _0x43ba4f;var _0x59a74d;return db[_0xce43('0x28')][_0xce43('0x45')]({'where':{'id':_0x359330[_0xce43('0x40')]['id']}})[_0xce43('0x20')](handleEntityNotFound(_0x25fb99,null))[_0xce43('0x20')](function(_0x46905b){if(_0x46905b){_0x43ba4f=_0x46905b;_0x17b110[_0xce43('0x2c')]=_[_0xce43('0x2d')](db[_0xce43('0x46')][_0xce43('0x47')]);_0x17b110[_0xce43('0x2e')]=_['keys'](_0x359330[_0xce43('0x2e')]);_0x17b110[_0xce43('0x38')]=_[_0xce43('0x2f')](_0x17b110['model'],_0x17b110[_0xce43('0x2e')]);_0xc9e65e[_0xce43('0x30')]=_[_0xce43('0x2f')](_0x17b110['model'],qs['fields'](_0x359330[_0xce43('0x2e')]['fields']));_0xc9e65e[_0xce43('0x30')]=_0xc9e65e[_0xce43('0x30')][_0xce43('0x32')]?_0xc9e65e['attributes']:_0x17b110['model'];_0xc9e65e['order']=qs['sort'](_0x359330['query']['sort']);_0xc9e65e[_0xce43('0x37')]=qs[_0xce43('0x38')](_[_0xce43('0x48')](_0x359330[_0xce43('0x2e')],_0x17b110['filters']));if(_0x359330['query'][_0xce43('0x39')]){_0xc9e65e[_0xce43('0x37')]=_[_0xce43('0x3b')](_0xc9e65e[_0xce43('0x37')],{'$or':_['map'](_0xc9e65e[_0xce43('0x30')],function(_0xdb94a7){var _0x4b3017={};_0x4b3017[_0xdb94a7]={'$like':'%'+_0x359330[_0xce43('0x2e')][_0xce43('0x39')]+'%'};return _0x4b3017;})});}_0xc9e65e=_[_0xce43('0x3b')]({},_0xc9e65e,_0x359330['options']);return _0x43ba4f[_0xce43('0x49')](_0xc9e65e);}})[_0xce43('0x20')](function(_0x5eba18){if(_0x5eba18){_0x59a74d=_0x5eba18['length'];if(!_0x359330['query'][_0xce43('0x33')]('nolimit')){_0xc9e65e[_0xce43('0x19')]=qs['limit'](_0x359330[_0xce43('0x2e')]['limit']);_0xc9e65e['offset']=qs[_0xce43('0x17')](_0x359330['query'][_0xce43('0x17')]);}return _0x43ba4f[_0xce43('0x49')](_0xc9e65e);}})[_0xce43('0x20')](function(_0x37cadd){if(_0x37cadd){return _0x37cadd?{'count':_0x59a74d,'rows':_0x37cadd}:null;}})[_0xce43('0x20')](respondWithResult(_0x25fb99,null))[_0xce43('0x43')](handleError(_0x25fb99,null));};exports[_0xce43('0x4a')]=function(_0x2e2680,_0x1aa98f,_0x3514fd){if(_0x2e2680[_0xce43('0x42')]['id']){delete _0x2e2680['body']['id'];}return db[_0xce43('0x28')][_0xce43('0x45')]({'where':{'id':_0x2e2680[_0xce43('0x40')]['id']}})[_0xce43('0x20')](handleEntityNotFound(_0x1aa98f,null))[_0xce43('0x20')](function(_0x41c26e){if(_0x41c26e){_0x2e2680[_0xce43('0x42')][_0xce43('0x4b')]=_0x41c26e['id'];_0x2e2680['body']['Subjects']=integrations[_0xce43('0x4c')](_0x2e2680[_0xce43('0x42')]['channel'],_0x2e2680[_0xce43('0x42')]['type']);_0x2e2680['body'][_0xce43('0x4d')]=integrations[_0xce43('0x4e')](_0x2e2680[_0xce43('0x42')][_0xce43('0x4f')],_0x2e2680[_0xce43('0x42')]['type']);return db[_0xce43('0x46')][_0xce43('0x50')](_0x2e2680['body'],{'include':[{'model':db[_0xce43('0x51')],'as':'Subjects'},{'model':db[_0xce43('0x51')],'as':_0xce43('0x4d')}]});}return null;})[_0xce43('0x20')](respondWithResult(_0x1aa98f,null))['catch'](handleError(_0x1aa98f,null));};exports[_0xce43('0x52')]=function(_0x48d113,_0xbaf075,_0x596da4){var _0x29c768='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x48d113['params']['id']},'attributes':['id',_0xce43('0x53'),'apiKey']})['then'](handleEntityNotFound(_0xbaf075,null))[_0xce43('0x20')](function(_0x320f71){if(_0x320f71){_0x29c768=_0x320f71[_0xce43('0x53')];var _0x529064=_0x29c768[_0xce43('0x54')](-0x1);if(_0x529064==='/'){_0x29c768=_0x29c768[_0xce43('0x55')](0x0,_0x29c768[_0xce43('0x56')](_0x529064));}return rp({'method':_0xce43('0x57'),'uri':util['format']('%s/%s',_0x29c768,_0xce43('0x58')),'headers':{'Authorization':util[_0xce43('0x59')](_0xce43('0x5a'),new Buffer(util[_0xce43('0x59')]('%s:X',_0x320f71[_0xce43('0x5b')]))[_0xce43('0x5c')]('base64'))},'json':!![]});}})[_0xce43('0x20')](function(_0x578b38){if(_0x578b38){var _0x2d1bfb=[_0xce43('0x5d'),_0xce43('0x5e'),_0xce43('0x5f'),_0xce43('0x60'),_0xce43('0x16'),_0xce43('0x61'),_0xce43('0x62'),_0xce43('0x63'),_0xce43('0x64'),_0xce43('0x62'),_0xce43('0x65')];_[_0xce43('0x66')](_0x578b38,function(_0x161a06){return _0x2d1bfb['includes'](_0x161a06['name'])||!_0x161a06[_0xce43('0x67')]&&_0x161a06[_0xce43('0x2a')]!==_0xce43('0x68')&&_0x161a06['type']!==_0xce43('0x69');});return{'count':_0x578b38['length'],'rows':_[_0xce43('0x27')](_0x578b38,function(_0x8fd118){return{'id':_0x8fd118['name'],'name':_0x8fd118[_0xce43('0x6a')],'custom':!_0x8fd118[_0xce43('0x67')],'options':_0x8fd118['choices']?_[_0xce43('0x27')](_0x8fd118['choices'],function(_0x41f4a7){return{'name':_[_0xce43('0x6b')](_0x41f4a7),'value':_0x41f4a7};}):[]};})};}})[_0xce43('0x20')](respondWithResult(_0xbaf075,null))[_0xce43('0x43')](function(_0x7f4104){var _0x632fa6=_0x48d113[_0xce43('0x2e')][_0xce43('0x6c')]?0x1f4:_0x7f4104[_0xce43('0x6d')]||0x1f4;logger[_0xce43('0x6e')](_0xce43('0x6f'),'getFields',_0x632fa6,JSON['stringify'](_0x7f4104));delete _0x7f4104['name'];if(_0x632fa6===0x191){_0x632fa6=0x190;}_0xbaf075[_0xce43('0x16')](_0x632fa6)[_0xce43('0x25')](_0x48d113[_0xce43('0x2e')][_0xce43('0x6c')]?{'message':_0xce43('0x70'),'statusCode':_0x7f4104[_0xce43('0x6d')]}:_0x7f4104);});}; \ No newline at end of file +var _0xa45b=['Content-Range','reject','save','update','then','send','index','map','FreshdeskAccount','rawAttributes','fieldName','key','model','name','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','slice','substring','format','api/v2/ticket_fields','%s:X','toString','base64','subject','agent','description','source','group','company','remove','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','rimraf','zip-dir','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set'];(function(_0x3244db,_0x59e851){var _0x3815e7=function(_0x24c491){while(--_0x24c491){_0x3244db['push'](_0x3244db['shift']());}};_0x3815e7(++_0x59e851);}(_0xa45b,0x199));var _0xba45=function(_0x5483f4,_0x7ad579){_0x5483f4=_0x5483f4-0x0;var _0x20ab57=_0xa45b[_0x5483f4];return _0x20ab57;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba45('0x0'));var zipdir=require(_0xba45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xba45('0x2'));var Mustache=require(_0xba45('0x3'));var util=require(_0xba45('0x4'));var path=require(_0xba45('0x5'));var sox=require('sox');var csv=require(_0xba45('0x6'));var ejs=require(_0xba45('0x7'));var fs=require('fs');var fs_extra=require(_0xba45('0x8'));var _=require(_0xba45('0x9'));var squel=require(_0xba45('0xa'));var crypto=require(_0xba45('0xb'));var jsforce=require(_0xba45('0xc'));var deskjs=require(_0xba45('0xd'));var toCsv=require('to-csv');var querystring=require(_0xba45('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xba45('0xf'));var hardwareService=require(_0xba45('0x10'));var logger=require('../../config/logger')(_0xba45('0x11'));var utils=require(_0xba45('0x12'));var config=require(_0xba45('0x13'));var licenseUtil=require(_0xba45('0x14'));var db=require(_0xba45('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2d8063,_0x33ed14){_0x33ed14=_0x33ed14||0xcc;return function(_0x36ef72){if(_0x36ef72){return _0x2d8063[_0xba45('0x16')](_0x33ed14);}return _0x2d8063['status'](_0x33ed14)[_0xba45('0x17')]();};}function respondWithResult(_0x4d2ec5,_0x1972d7){_0x1972d7=_0x1972d7||0xc8;return function(_0x13a8fb){if(_0x13a8fb){return _0x4d2ec5[_0xba45('0x18')](_0x1972d7)[_0xba45('0x19')](_0x13a8fb);}};}function respondWithFilteredResult(_0x734d93,_0x13f291){return function(_0x298d62){if(_0x298d62){var _0x1ed1e1=typeof _0x13f291[_0xba45('0x1a')]===_0xba45('0x1b')&&typeof _0x13f291['limit']===_0xba45('0x1b');var _0x407473=_0x298d62[_0xba45('0x1c')];var _0x1970eb=_0x1ed1e1?0x0:_0x13f291['offset'];var _0x153f04=_0x1ed1e1?_0x298d62['count']:_0x13f291[_0xba45('0x1a')]+_0x13f291[_0xba45('0x1d')];var _0x1c17eb;if(_0x153f04>=_0x407473){_0x153f04=_0x407473;_0x1c17eb=0xc8;}else{_0x1c17eb=0xce;}_0x734d93[_0xba45('0x18')](_0x1c17eb);return _0x734d93[_0xba45('0x1e')](_0xba45('0x1f'),_0x1970eb+'-'+_0x153f04+'/'+_0x407473)['json'](_0x298d62);}return null;};}function patchUpdates(_0x1f5979){return function(_0x248ef7){try{jsonpatch['apply'](_0x248ef7,_0x1f5979,!![]);}catch(_0x412b61){return BPromise[_0xba45('0x20')](_0x412b61);}return _0x248ef7[_0xba45('0x21')]();};}function saveUpdates(_0x3e31b9,_0x11894d){return function(_0x273f5d){if(_0x273f5d){return _0x273f5d[_0xba45('0x22')](_0x3e31b9)[_0xba45('0x23')](function(_0x35185e){return _0x35185e;});}return null;};}function removeEntity(_0x274f1b,_0x5e840e){return function(_0x4dca68){if(_0x4dca68){return _0x4dca68['destroy']()[_0xba45('0x23')](function(){_0x274f1b[_0xba45('0x18')](0xcc)[_0xba45('0x17')]();});}};}function handleEntityNotFound(_0x2efbe4,_0x2c17df){return function(_0x2c3020){if(!_0x2c3020){_0x2efbe4['sendStatus'](0x194);}return _0x2c3020;};}function handleError(_0xe0f621,_0x373390){_0x373390=_0x373390||0x1f4;return function(_0x3f90ea){logger['error'](_0x3f90ea['stack']);if(_0x3f90ea['name']){delete _0x3f90ea['name'];}_0xe0f621[_0xba45('0x18')](_0x373390)[_0xba45('0x24')](_0x3f90ea);};}exports[_0xba45('0x25')]=function(_0x2cdd1c,_0x554c5c){var _0x119b34={},_0xf6fa7={},_0x5dadba={'count':0x0,'rows':[]};var _0x560adf=_[_0xba45('0x26')](db[_0xba45('0x27')][_0xba45('0x28')],function(_0x18a04e){return{'name':_0x18a04e[_0xba45('0x29')],'type':_0x18a04e['type'][_0xba45('0x2a')]};});_0xf6fa7[_0xba45('0x2b')]=_[_0xba45('0x26')](_0x560adf,_0xba45('0x2c'));_0xf6fa7[_0xba45('0x2d')]=_[_0xba45('0x2e')](_0x2cdd1c[_0xba45('0x2d')]);_0xf6fa7[_0xba45('0x2f')]=_['intersection'](_0xf6fa7[_0xba45('0x2b')],_0xf6fa7[_0xba45('0x2d')]);_0x119b34[_0xba45('0x30')]=_[_0xba45('0x31')](_0xf6fa7['model'],qs[_0xba45('0x32')](_0x2cdd1c['query'][_0xba45('0x32')]));_0x119b34[_0xba45('0x30')]=_0x119b34[_0xba45('0x30')][_0xba45('0x33')]?_0x119b34['attributes']:_0xf6fa7[_0xba45('0x2b')];if(!_0x2cdd1c[_0xba45('0x2d')]['hasOwnProperty'](_0xba45('0x34'))){_0x119b34['limit']=qs[_0xba45('0x1d')](_0x2cdd1c[_0xba45('0x2d')]['limit']);_0x119b34[_0xba45('0x1a')]=qs[_0xba45('0x1a')](_0x2cdd1c[_0xba45('0x2d')]['offset']);}_0x119b34[_0xba45('0x35')]=qs[_0xba45('0x36')](_0x2cdd1c['query'][_0xba45('0x36')]);_0x119b34[_0xba45('0x37')]=qs[_0xba45('0x2f')](_[_0xba45('0x38')](_0x2cdd1c[_0xba45('0x2d')],_0xf6fa7[_0xba45('0x2f')]),_0x560adf);if(_0x2cdd1c[_0xba45('0x2d')][_0xba45('0x39')]){_0x119b34[_0xba45('0x37')]=_[_0xba45('0x3a')](_0x119b34['where'],{'$or':_[_0xba45('0x26')](_0x560adf,function(_0x4a9682){if(_0x4a9682[_0xba45('0x3b')]!==_0xba45('0x3c')){var _0xdf4f5={};_0xdf4f5[_0x4a9682[_0xba45('0x2c')]]={'$like':'%'+_0x2cdd1c[_0xba45('0x2d')][_0xba45('0x39')]+'%'};return _0xdf4f5;}})});}_0x119b34=_['merge']({},_0x119b34,_0x2cdd1c[_0xba45('0x3d')]);var _0x5a3a79={'where':_0x119b34[_0xba45('0x37')]};return db[_0xba45('0x27')][_0xba45('0x1c')](_0x5a3a79)[_0xba45('0x23')](function(_0x2d8b18){_0x5dadba[_0xba45('0x1c')]=_0x2d8b18;if(_0x2cdd1c[_0xba45('0x2d')]['includeAll']){_0x119b34[_0xba45('0x3e')]=[{'all':!![]}];}return db[_0xba45('0x27')][_0xba45('0x3f')](_0x119b34);})['then'](function(_0x3e82bb){_0x5dadba[_0xba45('0x40')]=_0x3e82bb;return _0x5dadba;})[_0xba45('0x23')](respondWithFilteredResult(_0x554c5c,_0x119b34))[_0xba45('0x41')](handleError(_0x554c5c,null));};exports['show']=function(_0x14e540,_0x1587be){var _0x969ca7={'raw':![],'where':{'id':_0x14e540[_0xba45('0x42')]['id']}},_0x167333={};_0x167333[_0xba45('0x2b')]=_[_0xba45('0x2e')](db[_0xba45('0x27')][_0xba45('0x28')]);_0x167333['query']=_[_0xba45('0x2e')](_0x14e540[_0xba45('0x2d')]);_0x167333[_0xba45('0x2f')]=_[_0xba45('0x31')](_0x167333[_0xba45('0x2b')],_0x167333[_0xba45('0x2d')]);_0x969ca7[_0xba45('0x30')]=_[_0xba45('0x31')](_0x167333[_0xba45('0x2b')],qs[_0xba45('0x32')](_0x14e540['query']['fields']));_0x969ca7[_0xba45('0x30')]=_0x969ca7[_0xba45('0x30')][_0xba45('0x33')]?_0x969ca7[_0xba45('0x30')]:_0x167333[_0xba45('0x2b')];if(_0x14e540['query'][_0xba45('0x43')]){_0x969ca7['include']=[{'all':!![]}];}_0x969ca7=_[_0xba45('0x3a')]({},_0x969ca7,_0x14e540[_0xba45('0x3d')]);return db[_0xba45('0x27')][_0xba45('0x44')](_0x969ca7)[_0xba45('0x23')](handleEntityNotFound(_0x1587be,null))[_0xba45('0x23')](respondWithResult(_0x1587be,null))['catch'](handleError(_0x1587be,null));};exports[_0xba45('0x45')]=function(_0x43b081,_0x43d785){return db[_0xba45('0x27')][_0xba45('0x45')](_0x43b081[_0xba45('0x46')],{})[_0xba45('0x23')](respondWithResult(_0x43d785,0xc9))['catch'](handleError(_0x43d785,null));};exports[_0xba45('0x22')]=function(_0x185cad,_0x51bdd1){if(_0x185cad[_0xba45('0x46')]['id']){delete _0x185cad[_0xba45('0x46')]['id'];}return db[_0xba45('0x27')]['find']({'where':{'id':_0x185cad[_0xba45('0x42')]['id']}})['then'](handleEntityNotFound(_0x51bdd1,null))[_0xba45('0x23')](saveUpdates(_0x185cad['body'],null))[_0xba45('0x23')](respondWithResult(_0x51bdd1,null))[_0xba45('0x41')](handleError(_0x51bdd1,null));};exports['destroy']=function(_0x598b1c,_0x2e82dc){return db[_0xba45('0x27')]['find']({'where':{'id':_0x598b1c['params']['id']}})[_0xba45('0x23')](handleEntityNotFound(_0x2e82dc,null))[_0xba45('0x23')](removeEntity(_0x2e82dc,null))[_0xba45('0x41')](handleError(_0x2e82dc,null));};exports[_0xba45('0x47')]=function(_0x248141,_0x386c82,_0x3f837b){var _0x2bcf4c={};var _0x18a89f={};var _0x43bb55;var _0x14fa7d;return db[_0xba45('0x27')][_0xba45('0x48')]({'where':{'id':_0x248141[_0xba45('0x42')]['id']}})[_0xba45('0x23')](handleEntityNotFound(_0x386c82,null))[_0xba45('0x23')](function(_0x3f33fe){if(_0x3f33fe){_0x43bb55=_0x3f33fe;_0x18a89f['model']=_[_0xba45('0x2e')](db[_0xba45('0x49')][_0xba45('0x28')]);_0x18a89f[_0xba45('0x2d')]=_['keys'](_0x248141[_0xba45('0x2d')]);_0x18a89f[_0xba45('0x2f')]=_[_0xba45('0x31')](_0x18a89f[_0xba45('0x2b')],_0x18a89f[_0xba45('0x2d')]);_0x2bcf4c[_0xba45('0x30')]=_[_0xba45('0x31')](_0x18a89f[_0xba45('0x2b')],qs[_0xba45('0x32')](_0x248141[_0xba45('0x2d')]['fields']));_0x2bcf4c[_0xba45('0x30')]=_0x2bcf4c[_0xba45('0x30')]['length']?_0x2bcf4c['attributes']:_0x18a89f[_0xba45('0x2b')];_0x2bcf4c[_0xba45('0x35')]=qs[_0xba45('0x36')](_0x248141[_0xba45('0x2d')][_0xba45('0x36')]);_0x2bcf4c[_0xba45('0x37')]=qs[_0xba45('0x2f')](_[_0xba45('0x38')](_0x248141['query'],_0x18a89f[_0xba45('0x2f')]));if(_0x248141[_0xba45('0x2d')][_0xba45('0x39')]){_0x2bcf4c[_0xba45('0x37')]=_[_0xba45('0x3a')](_0x2bcf4c[_0xba45('0x37')],{'$or':_['map'](_0x2bcf4c[_0xba45('0x30')],function(_0x2a7056){var _0x2e057a={};_0x2e057a[_0x2a7056]={'$like':'%'+_0x248141[_0xba45('0x2d')][_0xba45('0x39')]+'%'};return _0x2e057a;})});}_0x2bcf4c=_[_0xba45('0x3a')]({},_0x2bcf4c,_0x248141[_0xba45('0x3d')]);return _0x43bb55[_0xba45('0x47')](_0x2bcf4c);}})['then'](function(_0x5b2dea){if(_0x5b2dea){_0x14fa7d=_0x5b2dea[_0xba45('0x33')];if(!_0x248141[_0xba45('0x2d')][_0xba45('0x4a')](_0xba45('0x34'))){_0x2bcf4c[_0xba45('0x1d')]=qs[_0xba45('0x1d')](_0x248141['query'][_0xba45('0x1d')]);_0x2bcf4c[_0xba45('0x1a')]=qs[_0xba45('0x1a')](_0x248141['query'][_0xba45('0x1a')]);}return _0x43bb55['getConfigurations'](_0x2bcf4c);}})[_0xba45('0x23')](function(_0x228376){if(_0x228376){return _0x228376?{'count':_0x14fa7d,'rows':_0x228376}:null;}})[_0xba45('0x23')](respondWithResult(_0x386c82,null))['catch'](handleError(_0x386c82,null));};exports[_0xba45('0x4b')]=function(_0x4a40ca,_0x38c457,_0x5545cd){if(_0x4a40ca[_0xba45('0x46')]['id']){delete _0x4a40ca[_0xba45('0x46')]['id'];}return db[_0xba45('0x27')][_0xba45('0x48')]({'where':{'id':_0x4a40ca[_0xba45('0x42')]['id']}})[_0xba45('0x23')](handleEntityNotFound(_0x38c457,null))[_0xba45('0x23')](function(_0xd9e844){if(_0xd9e844){_0x4a40ca['body'][_0xba45('0x4c')]=_0xd9e844['id'];_0x4a40ca[_0xba45('0x46')][_0xba45('0x4d')]=integrations[_0xba45('0x4e')](_0x4a40ca[_0xba45('0x46')][_0xba45('0x4f')],_0x4a40ca[_0xba45('0x46')]['type']);_0x4a40ca[_0xba45('0x46')][_0xba45('0x50')]=integrations[_0xba45('0x51')](_0x4a40ca[_0xba45('0x46')]['channel'],_0x4a40ca[_0xba45('0x46')]['type']);return db['FreshdeskConfiguration'][_0xba45('0x45')](_0x4a40ca[_0xba45('0x46')],{'include':[{'model':db[_0xba45('0x52')],'as':_0xba45('0x4d')},{'model':db[_0xba45('0x52')],'as':_0xba45('0x50')}]});}return null;})[_0xba45('0x23')](respondWithResult(_0x38c457,null))['catch'](handleError(_0x38c457,null));};exports[_0xba45('0x53')]=function(_0x29049f,_0x4b4e35,_0x3aac8d){var _0x20a431='';return db['FreshdeskAccount'][_0xba45('0x48')]({'where':{'id':_0x29049f['params']['id']},'attributes':['id','remoteUri','apiKey']})[_0xba45('0x23')](handleEntityNotFound(_0x4b4e35,null))[_0xba45('0x23')](function(_0x50d8a3){if(_0x50d8a3){_0x20a431=_0x50d8a3[_0xba45('0x54')];var _0x20f3ab=_0x20a431[_0xba45('0x55')](-0x1);if(_0x20f3ab==='/'){_0x20a431=_0x20a431[_0xba45('0x56')](0x0,_0x20a431['lastIndexOf'](_0x20f3ab));}return rp({'method':'GET','uri':util[_0xba45('0x57')]('%s/%s',_0x20a431,_0xba45('0x58')),'headers':{'Authorization':util[_0xba45('0x57')]('Basic\x20%s',new Buffer(util[_0xba45('0x57')](_0xba45('0x59'),_0x50d8a3['apiKey']))[_0xba45('0x5a')](_0xba45('0x5b')))},'json':!![]});}})[_0xba45('0x23')](function(_0x1a7af8){if(_0x1a7af8){var _0x5a2e05=['requester',_0xba45('0x5c'),_0xba45('0x5d'),_0xba45('0x5e'),_0xba45('0x18'),'priority','group',_0xba45('0x5f'),'ticket_type',_0xba45('0x60'),_0xba45('0x61')];_[_0xba45('0x62')](_0x1a7af8,function(_0x100725){return _0x5a2e05['includes'](_0x100725[_0xba45('0x2c')])||!_0x100725[_0xba45('0x63')]&&_0x100725['type']!==_0xba45('0x64')&&_0x100725[_0xba45('0x3b')]!==_0xba45('0x65');});return{'count':_0x1a7af8[_0xba45('0x33')],'rows':_[_0xba45('0x26')](_0x1a7af8,function(_0xcf457c){return{'id':_0xcf457c['name'],'name':_0xcf457c[_0xba45('0x66')],'custom':!_0xcf457c['default'],'options':_0xcf457c['choices']?_['map'](_0xcf457c[_0xba45('0x67')],function(_0x15fc57){return{'name':_[_0xba45('0x68')](_0x15fc57),'value':_0x15fc57};}):[]};})};}})[_0xba45('0x23')](respondWithResult(_0x4b4e35,null))[_0xba45('0x41')](function(_0x10bdaf){var _0x2c7e2b=_0x29049f['query']['test']?0x1f4:_0x10bdaf[_0xba45('0x69')]||0x1f4;logger[_0xba45('0x6a')](_0xba45('0x6b'),_0xba45('0x53'),_0x2c7e2b,JSON[_0xba45('0x6c')](_0x10bdaf));delete _0x10bdaf[_0xba45('0x2c')];if(_0x2c7e2b===0x191){_0x2c7e2b=0x190;}_0x4b4e35['status'](_0x2c7e2b)[_0xba45('0x24')](_0x29049f[_0xba45('0x2d')][_0xba45('0x6d')]?{'message':'Wrong\x20credentials','statusCode':_0x10bdaf[_0xba45('0x69')]}:_0x10bdaf);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index cfd8a3b..4a0d434 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 _0xc837=['define','int_freshdesk_accounts','lodash','util','api','bluebird','rimraf','../../components/integrations/configuration'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc837,0x112));var _0x7c83=function(_0x25cd7b,_0xa1d66c){_0x25cd7b=_0x25cd7b-0x0;var _0x3a16ab=_0xc837[_0x25cd7b];return _0x3a16ab;};'use strict';var _=require(_0x7c83('0x0'));var util=require(_0x7c83('0x1'));var logger=require('../../config/logger')(_0x7c83('0x2'));var moment=require('moment');var BPromise=require(_0x7c83('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7c83('0x4'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x7c83('0x5'));module['exports']=function(_0x45559e,_0x271d13){return _0x45559e[_0x7c83('0x6')]('FreshdeskAccount',attributes,{'tableName':_0x7c83('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf760=['rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','api','bluebird','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf760,0x1b5));var _0x0f76=function(_0x2c3dd2,_0x405f9d){_0x2c3dd2=_0x2c3dd2-0x0;var _0x1a3389=_0xf760[_0x2c3dd2];return _0x1a3389;};'use strict';var _=require(_0x0f76('0x0'));var util=require('util');var logger=require(_0x0f76('0x1'))(_0x0f76('0x2'));var moment=require('moment');var BPromise=require(_0x0f76('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f76('0x4'));var rimraf=require(_0x0f76('0x5'));var config=require(_0x0f76('0x6'));var attributes=require(_0x0f76('0x7'));var integrations=require(_0x0f76('0x8'));module[_0x0f76('0x9')]=function(_0x54ee5d,_0x2514ac){return _0x54ee5d[_0x0f76('0xa')](_0x0f76('0xb'),attributes,{'tableName':_0x0f76('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 56374bd..52e34fb 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 _0x4256=['FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowFreshdeskAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4a45a1,_0x427203){var _0x181d90=function(_0x246ba1){while(--_0x246ba1){_0x4a45a1['push'](_0x4a45a1['shift']());}};_0x181d90(++_0x427203);}(_0x4256,0xce));var _0x6425=function(_0x4fda88,_0x1a4d19){_0x4fda88=_0x4fda88-0x0;var _0xe37511=_0x4256[_0x4fda88];return _0xe37511;};'use strict';var _=require('lodash');var util=require(_0x6425('0x0'));var moment=require(_0x6425('0x1'));var BPromise=require(_0x6425('0x2'));var rs=require(_0x6425('0x3'));var fs=require('fs');var Redis=require(_0x6425('0x4'));var db=require(_0x6425('0x5'))['db'];var utils=require(_0x6425('0x6'));var logger=require(_0x6425('0x7'))(_0x6425('0x8'));var config=require(_0x6425('0x9'));var jayson=require(_0x6425('0xa'));var client=jayson[_0x6425('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa12cf3,_0x31881c,_0x16b7a6){return new BPromise(function(_0x13cf4a,_0x7c561f){return client['request'](_0xa12cf3,_0x16b7a6)['then'](function(_0x53635e){logger[_0x6425('0xc')](_0x6425('0xd'),_0x31881c,_0x6425('0xe'));logger[_0x6425('0xf')](_0x6425('0x10'),_0x31881c,_0x6425('0xe'),JSON[_0x6425('0x11')](_0x53635e));if(_0x53635e[_0x6425('0x12')]){if(_0x53635e[_0x6425('0x12')][_0x6425('0x13')]===0x1f4){logger[_0x6425('0x12')](_0x6425('0xd'),_0x31881c,_0x53635e['error']['message']);return _0x7c561f(_0x53635e[_0x6425('0x12')][_0x6425('0x14')]);}logger[_0x6425('0x12')](_0x6425('0xd'),_0x31881c,_0x53635e[_0x6425('0x12')][_0x6425('0x14')]);return _0x13cf4a(_0x53635e[_0x6425('0x12')][_0x6425('0x14')]);}else{logger[_0x6425('0xc')](_0x6425('0xd'),_0x31881c,'request\x20sent');_0x13cf4a(_0x53635e[_0x6425('0x15')][_0x6425('0x14')]);}})[_0x6425('0x16')](function(_0x36d190){logger[_0x6425('0x12')](_0x6425('0xd'),_0x31881c,_0x36d190);_0x7c561f(_0x36d190);});});}exports[_0x6425('0x17')]=function(_0x15bb2d){var _0x482772=this;return new Promise(function(_0x58b3f8,_0x1bfffe){return db[_0x6425('0x18')][_0x6425('0x19')]({'raw':_0x15bb2d[_0x6425('0x1a')]?_0x15bb2d['options'][_0x6425('0x1b')]===undefined?!![]:![]:!![],'where':_0x15bb2d[_0x6425('0x1a')]?_0x15bb2d['options'][_0x6425('0x1c')]||null:null,'attributes':_0x15bb2d[_0x6425('0x1a')]?_0x15bb2d[_0x6425('0x1a')][_0x6425('0x1d')]||null:null,'limit':_0x15bb2d['options']?_0x15bb2d[_0x6425('0x1a')][_0x6425('0x1e')]||null:null,'include':_0x15bb2d[_0x6425('0x1a')]?_0x15bb2d[_0x6425('0x1a')][_0x6425('0x1f')]?_[_0x6425('0x20')](_0x15bb2d[_0x6425('0x1a')][_0x6425('0x1f')],function(_0xfdde6){return{'model':db[_0xfdde6[_0x6425('0x21')]],'as':_0xfdde6['as'],'attributes':_0xfdde6[_0x6425('0x1d')],'include':_0xfdde6[_0x6425('0x1f')]?_['map'](_0xfdde6[_0x6425('0x1f')],function(_0x9b777f){return{'model':db[_0x9b777f[_0x6425('0x21')]],'as':_0x9b777f['as'],'attributes':_0x9b777f[_0x6425('0x1d')],'include':_0x9b777f[_0x6425('0x1f')]?_[_0x6425('0x20')](_0x9b777f[_0x6425('0x1f')],function(_0x56743e){return{'model':db[_0x56743e[_0x6425('0x21')]],'as':_0x56743e['as'],'attributes':_0x56743e['attributes']};}):[]};}):[]};}):[]:[]})[_0x6425('0x22')](function(_0x187a7c){logger[_0x6425('0xc')](_0x6425('0x17'),_0x15bb2d);logger[_0x6425('0xf')](_0x6425('0x17'),_0x15bb2d,JSON[_0x6425('0x11')](_0x187a7c));_0x58b3f8(_0x187a7c);})[_0x6425('0x16')](function(_0x2bff13){logger['error'](_0x6425('0x17'),_0x2bff13['message'],_0x15bb2d);_0x1bfffe(_0x482772[_0x6425('0x12')](0x1f4,_0x2bff13[_0x6425('0x14')]));});});};exports[_0x6425('0x23')]=function(_0x28e586){var _0x52b257=this;return new Promise(function(_0x308521,_0x9c5714){return db[_0x6425('0x18')][_0x6425('0x24')]({'raw':_0x28e586[_0x6425('0x1a')]?_0x28e586[_0x6425('0x1a')][_0x6425('0x1b')]===undefined?!![]:![]:!![],'where':_0x28e586[_0x6425('0x1a')]?_0x28e586['options']['where']||null:null,'attributes':_0x28e586['options']?_0x28e586['options'][_0x6425('0x1d')]||null:null,'include':_0x28e586[_0x6425('0x1a')]?_0x28e586[_0x6425('0x1a')][_0x6425('0x1f')]?_[_0x6425('0x20')](_0x28e586[_0x6425('0x1a')][_0x6425('0x1f')],function(_0x412446){return{'model':db[_0x412446[_0x6425('0x21')]],'as':_0x412446['as'],'attributes':_0x412446[_0x6425('0x1d')],'include':_0x412446[_0x6425('0x1f')]?_[_0x6425('0x20')](_0x412446[_0x6425('0x1f')],function(_0x108758){return{'model':db[_0x108758[_0x6425('0x21')]],'as':_0x108758['as'],'attributes':_0x108758[_0x6425('0x1d')],'include':_0x108758[_0x6425('0x1f')]?_[_0x6425('0x20')](_0x108758['include'],function(_0x41fb7c){return{'model':db[_0x41fb7c[_0x6425('0x21')]],'as':_0x41fb7c['as'],'attributes':_0x41fb7c[_0x6425('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6425('0x22')](function(_0x3c4e17){logger[_0x6425('0xc')](_0x6425('0x23'),_0x28e586);logger['debug'](_0x6425('0x23'),_0x28e586,JSON[_0x6425('0x11')](_0x3c4e17));_0x308521(_0x3c4e17);})['catch'](function(_0x261720){logger['error']('ShowFreshdeskAccount',_0x261720[_0x6425('0x14')],_0x28e586);_0x9c5714(_0x52b257[_0x6425('0x12')](0x1f4,_0x261720[_0x6425('0x14')]));});});}; \ No newline at end of file +var _0xdc6f=['then','lodash','util','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','debug','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','info','request\x20sent','catch','GetFreshdeskAccount','findAll','options','raw','where','limit','include','model','attributes','map','ShowFreshdeskAccount','FreshdeskAccount','find'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xdc6f,0xf9));var _0xfdc6=function(_0x2ce715,_0x22e80c){_0x2ce715=_0x2ce715-0x0;var _0x41c7bb=_0xdc6f[_0x2ce715];return _0x41c7bb;};'use strict';var _=require(_0xfdc6('0x0'));var util=require(_0xfdc6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfdc6('0x2'));var fs=require('fs');var Redis=require(_0xfdc6('0x3'));var db=require(_0xfdc6('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfdc6('0x5'));var config=require('../../config/environment');var jayson=require(_0xfdc6('0x6'));var client=jayson[_0xfdc6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe2e18e,_0x2769ae,_0x13f1e3){return new BPromise(function(_0x1d38be,_0x18c91c){return client[_0xfdc6('0x8')](_0xe2e18e,_0x13f1e3)['then'](function(_0x5bcac1){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x2769ae,'request\x20sent');logger[_0xfdc6('0x9')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x2769ae,'request\x20sent',JSON[_0xfdc6('0xa')](_0x5bcac1));if(_0x5bcac1[_0xfdc6('0xb')]){if(_0x5bcac1[_0xfdc6('0xb')]['code']===0x1f4){logger[_0xfdc6('0xb')](_0xfdc6('0xc'),_0x2769ae,_0x5bcac1[_0xfdc6('0xb')][_0xfdc6('0xd')]);return _0x18c91c(_0x5bcac1[_0xfdc6('0xb')]['message']);}logger[_0xfdc6('0xb')](_0xfdc6('0xc'),_0x2769ae,_0x5bcac1[_0xfdc6('0xb')][_0xfdc6('0xd')]);return _0x1d38be(_0x5bcac1[_0xfdc6('0xb')]['message']);}else{logger[_0xfdc6('0xe')](_0xfdc6('0xc'),_0x2769ae,_0xfdc6('0xf'));_0x1d38be(_0x5bcac1['result'][_0xfdc6('0xd')]);}})[_0xfdc6('0x10')](function(_0x448114){logger['error'](_0xfdc6('0xc'),_0x2769ae,_0x448114);_0x18c91c(_0x448114);});});}exports[_0xfdc6('0x11')]=function(_0x1f490c){var _0x5cf58a=this;return new Promise(function(_0x41e541,_0xf11cdb){return db['FreshdeskAccount'][_0xfdc6('0x12')]({'raw':_0x1f490c[_0xfdc6('0x13')]?_0x1f490c[_0xfdc6('0x13')][_0xfdc6('0x14')]===undefined?!![]:![]:!![],'where':_0x1f490c[_0xfdc6('0x13')]?_0x1f490c[_0xfdc6('0x13')][_0xfdc6('0x15')]||null:null,'attributes':_0x1f490c[_0xfdc6('0x13')]?_0x1f490c[_0xfdc6('0x13')]['attributes']||null:null,'limit':_0x1f490c[_0xfdc6('0x13')]?_0x1f490c['options'][_0xfdc6('0x16')]||null:null,'include':_0x1f490c[_0xfdc6('0x13')]?_0x1f490c[_0xfdc6('0x13')]['include']?_['map'](_0x1f490c[_0xfdc6('0x13')][_0xfdc6('0x17')],function(_0x548739){return{'model':db[_0x548739[_0xfdc6('0x18')]],'as':_0x548739['as'],'attributes':_0x548739[_0xfdc6('0x19')],'include':_0x548739[_0xfdc6('0x17')]?_['map'](_0x548739[_0xfdc6('0x17')],function(_0x4a280c){return{'model':db[_0x4a280c[_0xfdc6('0x18')]],'as':_0x4a280c['as'],'attributes':_0x4a280c['attributes'],'include':_0x4a280c[_0xfdc6('0x17')]?_[_0xfdc6('0x1a')](_0x4a280c[_0xfdc6('0x17')],function(_0x523207){return{'model':db[_0x523207[_0xfdc6('0x18')]],'as':_0x523207['as'],'attributes':_0x523207['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x56867d){logger[_0xfdc6('0xe')](_0xfdc6('0x11'),_0x1f490c);logger[_0xfdc6('0x9')](_0xfdc6('0x11'),_0x1f490c,JSON['stringify'](_0x56867d));_0x41e541(_0x56867d);})[_0xfdc6('0x10')](function(_0x466623){logger[_0xfdc6('0xb')](_0xfdc6('0x11'),_0x466623[_0xfdc6('0xd')],_0x1f490c);_0xf11cdb(_0x5cf58a[_0xfdc6('0xb')](0x1f4,_0x466623['message']));});});};exports[_0xfdc6('0x1b')]=function(_0x1a5d9f){var _0x5ddffc=this;return new Promise(function(_0x29713a,_0x22da92){return db[_0xfdc6('0x1c')][_0xfdc6('0x1d')]({'raw':_0x1a5d9f[_0xfdc6('0x13')]?_0x1a5d9f['options'][_0xfdc6('0x14')]===undefined?!![]:![]:!![],'where':_0x1a5d9f[_0xfdc6('0x13')]?_0x1a5d9f[_0xfdc6('0x13')][_0xfdc6('0x15')]||null:null,'attributes':_0x1a5d9f[_0xfdc6('0x13')]?_0x1a5d9f[_0xfdc6('0x13')][_0xfdc6('0x19')]||null:null,'include':_0x1a5d9f[_0xfdc6('0x13')]?_0x1a5d9f['options']['include']?_[_0xfdc6('0x1a')](_0x1a5d9f[_0xfdc6('0x13')][_0xfdc6('0x17')],function(_0x4c5f6e){return{'model':db[_0x4c5f6e['model']],'as':_0x4c5f6e['as'],'attributes':_0x4c5f6e[_0xfdc6('0x19')],'include':_0x4c5f6e['include']?_[_0xfdc6('0x1a')](_0x4c5f6e['include'],function(_0x301da2){return{'model':db[_0x301da2['model']],'as':_0x301da2['as'],'attributes':_0x301da2[_0xfdc6('0x19')],'include':_0x301da2[_0xfdc6('0x17')]?_[_0xfdc6('0x1a')](_0x301da2[_0xfdc6('0x17')],function(_0x3e658a){return{'model':db[_0x3e658a['model']],'as':_0x3e658a['as'],'attributes':_0x3e658a[_0xfdc6('0x19')]};}):[]};}):[]};}):[]:[]})[_0xfdc6('0x1e')](function(_0x230d26){logger[_0xfdc6('0xe')]('ShowFreshdeskAccount',_0x1a5d9f);logger[_0xfdc6('0x9')](_0xfdc6('0x1b'),_0x1a5d9f,JSON['stringify'](_0x230d26));_0x29713a(_0x230d26);})['catch'](function(_0x15c5eb){logger[_0xfdc6('0xb')](_0xfdc6('0x1b'),_0x15c5eb['message'],_0x1a5d9f);_0x22da92(_0x5ddffc[_0xfdc6('0xb')](0x1f4,_0x15c5eb[_0xfdc6('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 9dfce3e..ae55a6b 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 _0xdf65=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','getTags','post','create','/:id/tags','put','update','delete','exports','multer','util'];(function(_0x5c088b,_0x160b69){var _0x9bd4c2=function(_0x487434){while(--_0x487434){_0x5c088b['push'](_0x5c088b['shift']());}};_0x9bd4c2(++_0x160b69);}(_0xdf65,0x185));var _0x5df6=function(_0x5b079e,_0x442580){_0x5b079e=_0x5b079e-0x0;var _0x36bd5e=_0xdf65[_0x5b079e];return _0x36bd5e;};'use strict';var multer=require(_0x5df6('0x0'));var util=require(_0x5df6('0x1'));var path=require(_0x5df6('0x2'));var timeout=require(_0x5df6('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5df6('0x4'));var interaction=require(_0x5df6('0x5'));var config=require('../../config/environment');var controller=require(_0x5df6('0x6'));router[_0x5df6('0x7')]('/',auth[_0x5df6('0x8')](),controller['index']);router[_0x5df6('0x7')](_0x5df6('0x9'),auth[_0x5df6('0x8')](),controller[_0x5df6('0xa')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x5df6('0xb')]);router[_0x5df6('0x7')](_0x5df6('0xc'),auth[_0x5df6('0x8')](),controller[_0x5df6('0xd')]);router[_0x5df6('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x5df6('0xe')]);router[_0x5df6('0x7')]('/:id/tags',auth[_0x5df6('0x8')](),controller[_0x5df6('0xf')]);router[_0x5df6('0x10')]('/',auth['isAuthenticated'](),controller[_0x5df6('0x11')]);router[_0x5df6('0x10')](_0x5df6('0x12'),auth[_0x5df6('0x8')](),controller['setTags']);router[_0x5df6('0x13')](_0x5df6('0x9'),auth[_0x5df6('0x8')](),controller[_0x5df6('0x14')]);router[_0x5df6('0x15')]('/:id',auth[_0x5df6('0x8')](),controller['destroy']);module[_0x5df6('0x16')]=router; \ No newline at end of file +var _0x246e=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put'];(function(_0x404957,_0x5192a4){var _0x4e0365=function(_0x4f6cd7){while(--_0x4f6cd7){_0x404957['push'](_0x404957['shift']());}};_0x4e0365(++_0x5192a4);}(_0x246e,0x18c));var _0xe246=function(_0x1835e6,_0x38dcec){_0x1835e6=_0x1835e6-0x0;var _0x245606=_0x246e[_0x1835e6];return _0x245606;};'use strict';var multer=require('multer');var util=require(_0xe246('0x0'));var path=require(_0xe246('0x1'));var timeout=require(_0xe246('0x2'));var express=require(_0xe246('0x3'));var router=express[_0xe246('0x4')]();var fs_extra=require(_0xe246('0x5'));var auth=require(_0xe246('0x6'));var interaction=require(_0xe246('0x7'));var config=require(_0xe246('0x8'));var controller=require(_0xe246('0x9'));router[_0xe246('0xa')]('/',auth[_0xe246('0xb')](),controller['index']);router[_0xe246('0xa')](_0xe246('0xc'),auth[_0xe246('0xb')](),controller[_0xe246('0xd')]);router[_0xe246('0xa')]('/:id/fields',auth[_0xe246('0xb')](),controller[_0xe246('0xe')]);router[_0xe246('0xa')](_0xe246('0xf'),auth['isAuthenticated'](),controller[_0xe246('0x10')]);router['get']('/:id/descriptions',auth[_0xe246('0xb')](),controller[_0xe246('0x11')]);router[_0xe246('0xa')](_0xe246('0x12'),auth[_0xe246('0xb')](),controller[_0xe246('0x13')]);router[_0xe246('0x14')]('/',auth['isAuthenticated'](),controller[_0xe246('0x15')]);router[_0xe246('0x14')]('/:id/tags',auth[_0xe246('0xb')](),controller[_0xe246('0x16')]);router[_0xe246('0x17')]('/:id',auth[_0xe246('0xb')](),controller[_0xe246('0x18')]);router[_0xe246('0x19')](_0xe246('0xc'),auth[_0xe246('0xb')](),controller[_0xe246('0x1a')]);module[_0xe246('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index b717518..8a0cf6f 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 _0x7f7c=['exports','STRING','sequelize'];(function(_0x1df154,_0x1ce557){var _0x5d5d79=function(_0x85718e){while(--_0x85718e){_0x1df154['push'](_0x1df154['shift']());}};_0x5d5d79(++_0x1ce557);}(_0x7f7c,0x7d));var _0xc7f7=function(_0x573f76,_0xdd4e6d){_0x573f76=_0x573f76-0x0;var _0x288ca4=_0x7f7c[_0x573f76];return _0x288ca4;};'use strict';var Sequelize=require(_0xc7f7('0x0'));module[_0xc7f7('0x1')]={'name':{'type':Sequelize[_0xc7f7('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x909c=['STRING','exports'];(function(_0x14b268,_0xc29a1a){var _0x58fd2a=function(_0x533ed7){while(--_0x533ed7){_0x14b268['push'](_0x14b268['shift']());}};_0x58fd2a(++_0xc29a1a);}(_0x909c,0x77));var _0xc909=function(_0x3d0098,_0x22ee82){_0x3d0098=_0x3d0098-0x0;var _0x3ef587=_0x909c[_0x3d0098];return _0x3ef587;};'use strict';var Sequelize=require('sequelize');module[_0xc909('0x0')]={'name':{'type':Sequelize[_0xc909('0x1')]},'description':{'type':Sequelize[_0xc909('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 94272f4..1340a00 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 _0x2b37=['zip-dir','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','Content-Range','apply','update','then','destroy','end','sendStatus','error','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','include','findAll','catch','show','params','find','create','body','findOne','FreshdeskField','getFields','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x2b37,0xa0));var _0x72b3=function(_0x2d6391,_0x4b7ec8){_0x2d6391=_0x2d6391-0x0;var _0x5e2ee6=_0x2b37[_0x2d6391];return _0x5e2ee6;};'use strict';var emlformat=require(_0x72b3('0x0'));var rimraf=require(_0x72b3('0x1'));var zipdir=require(_0x72b3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x72b3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x72b3('0x4'));var util=require(_0x72b3('0x5'));var path=require('path');var sox=require(_0x72b3('0x6'));var csv=require(_0x72b3('0x7'));var ejs=require(_0x72b3('0x8'));var fs=require('fs');var fs_extra=require(_0x72b3('0x9'));var _=require(_0x72b3('0xa'));var squel=require(_0x72b3('0xb'));var crypto=require('crypto');var jsforce=require(_0x72b3('0xc'));var deskjs=require(_0x72b3('0xd'));var toCsv=require(_0x72b3('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x72b3('0xe'));var authService=require(_0x72b3('0xf'));var qs=require(_0x72b3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72b3('0x11'));var logger=require(_0x72b3('0x12'))('api');var utils=require(_0x72b3('0x13'));var config=require(_0x72b3('0x14'));var licenseUtil=require(_0x72b3('0x15'));var db=require(_0x72b3('0x16'))['db'];function respondWithStatusCode(_0x4fab44,_0x255443){_0x255443=_0x255443||0xcc;return function(_0x2d74e5){if(_0x2d74e5){return _0x4fab44['sendStatus'](_0x255443);}return _0x4fab44[_0x72b3('0x17')](_0x255443)['end']();};}function respondWithResult(_0x3008f8,_0x3f9f5b){_0x3f9f5b=_0x3f9f5b||0xc8;return function(_0xb70cdb){if(_0xb70cdb){return _0x3008f8[_0x72b3('0x17')](_0x3f9f5b)[_0x72b3('0x18')](_0xb70cdb);}};}function respondWithFilteredResult(_0x3a08c9,_0x24b303){return function(_0x4d6f4b){if(_0x4d6f4b){var _0x6776bb=typeof _0x24b303[_0x72b3('0x19')]===_0x72b3('0x1a')&&typeof _0x24b303[_0x72b3('0x1b')]==='undefined';var _0x13380d=_0x4d6f4b['count'];var _0x723a98=_0x6776bb?0x0:_0x24b303[_0x72b3('0x19')];var _0x46fceb=_0x6776bb?_0x4d6f4b['count']:_0x24b303['offset']+_0x24b303[_0x72b3('0x1b')];var _0x2cac9a;if(_0x46fceb>=_0x13380d){_0x46fceb=_0x13380d;_0x2cac9a=0xc8;}else{_0x2cac9a=0xce;}_0x3a08c9['status'](_0x2cac9a);return _0x3a08c9['set'](_0x72b3('0x1c'),_0x723a98+'-'+_0x46fceb+'/'+_0x13380d)['json'](_0x4d6f4b);}return null;};}function patchUpdates(_0x3b9db5){return function(_0x91a8d3){try{jsonpatch[_0x72b3('0x1d')](_0x91a8d3,_0x3b9db5,!![]);}catch(_0xb2fb43){return BPromise['reject'](_0xb2fb43);}return _0x91a8d3['save']();};}function saveUpdates(_0x4a4e04,_0x5c11a9){return function(_0x521ff3){if(_0x521ff3){return _0x521ff3[_0x72b3('0x1e')](_0x4a4e04)[_0x72b3('0x1f')](function(_0xa6789e){return _0xa6789e;});}return null;};}function removeEntity(_0x3da85b,_0x4b115f){return function(_0x1a3140){if(_0x1a3140){return _0x1a3140[_0x72b3('0x20')]()[_0x72b3('0x1f')](function(){_0x3da85b['status'](0xcc)[_0x72b3('0x21')]();});}};}function handleEntityNotFound(_0x40c248,_0x5b10de){return function(_0x7a2dd0){if(!_0x7a2dd0){_0x40c248[_0x72b3('0x22')](0x194);}return _0x7a2dd0;};}function handleError(_0xd3a2b4,_0x691629){_0x691629=_0x691629||0x1f4;return function(_0x121786){logger[_0x72b3('0x23')](_0x121786['stack']);if(_0x121786[_0x72b3('0x24')]){delete _0x121786[_0x72b3('0x24')];}_0xd3a2b4[_0x72b3('0x17')](_0x691629)[_0x72b3('0x25')](_0x121786);};}exports[_0x72b3('0x26')]=function(_0x30a1b9,_0x1827a9){var _0x54d114={},_0x4caaf6={},_0x1d9940={'count':0x0,'rows':[]};var _0x285874=_[_0x72b3('0x27')](db[_0x72b3('0x28')][_0x72b3('0x29')],function(_0x3ea8ad){return{'name':_0x3ea8ad[_0x72b3('0x2a')],'type':_0x3ea8ad[_0x72b3('0x2b')][_0x72b3('0x2c')]};});_0x4caaf6[_0x72b3('0x2d')]=_['map'](_0x285874,_0x72b3('0x24'));_0x4caaf6[_0x72b3('0x2e')]=_[_0x72b3('0x2f')](_0x30a1b9['query']);_0x4caaf6[_0x72b3('0x30')]=_[_0x72b3('0x31')](_0x4caaf6[_0x72b3('0x2d')],_0x4caaf6[_0x72b3('0x2e')]);_0x54d114[_0x72b3('0x32')]=_[_0x72b3('0x31')](_0x4caaf6[_0x72b3('0x2d')],qs[_0x72b3('0x33')](_0x30a1b9[_0x72b3('0x2e')][_0x72b3('0x33')]));_0x54d114[_0x72b3('0x32')]=_0x54d114['attributes'][_0x72b3('0x34')]?_0x54d114[_0x72b3('0x32')]:_0x4caaf6[_0x72b3('0x2d')];if(!_0x30a1b9['query']['hasOwnProperty'](_0x72b3('0x35'))){_0x54d114['limit']=qs['limit'](_0x30a1b9['query'][_0x72b3('0x1b')]);_0x54d114[_0x72b3('0x19')]=qs[_0x72b3('0x19')](_0x30a1b9[_0x72b3('0x2e')]['offset']);}_0x54d114[_0x72b3('0x36')]=qs[_0x72b3('0x37')](_0x30a1b9[_0x72b3('0x2e')][_0x72b3('0x37')]);_0x54d114[_0x72b3('0x38')]=qs[_0x72b3('0x30')](_[_0x72b3('0x39')](_0x30a1b9['query'],_0x4caaf6['filters']),_0x285874);if(_0x30a1b9[_0x72b3('0x2e')]['filter']){_0x54d114['where']=_[_0x72b3('0x3a')](_0x54d114[_0x72b3('0x38')],{'$or':_['map'](_0x285874,function(_0x32573d){if(_0x32573d['type']!==_0x72b3('0x3b')){var _0x1646f9={};_0x1646f9[_0x32573d[_0x72b3('0x24')]]={'$like':'%'+_0x30a1b9['query'][_0x72b3('0x3c')]+'%'};return _0x1646f9;}})});}_0x54d114=_[_0x72b3('0x3a')]({},_0x54d114,_0x30a1b9[_0x72b3('0x3d')]);var _0x5517d0={'where':_0x54d114['where']};return db[_0x72b3('0x28')]['count'](_0x5517d0)[_0x72b3('0x1f')](function(_0x39ee4a){_0x1d9940[_0x72b3('0x3e')]=_0x39ee4a;if(_0x30a1b9['query']['includeAll']){_0x54d114[_0x72b3('0x3f')]=[{'all':!![]}];}return db[_0x72b3('0x28')][_0x72b3('0x40')](_0x54d114);})[_0x72b3('0x1f')](function(_0x843855){_0x1d9940['rows']=_0x843855;return _0x1d9940;})[_0x72b3('0x1f')](respondWithFilteredResult(_0x1827a9,_0x54d114))[_0x72b3('0x41')](handleError(_0x1827a9,null));};exports[_0x72b3('0x42')]=function(_0x5e9135,_0x31b27a){var _0x5bf262={'raw':![],'where':{'id':_0x5e9135[_0x72b3('0x43')]['id']}},_0xcebd1a={};_0xcebd1a[_0x72b3('0x2d')]=_['keys'](db[_0x72b3('0x28')][_0x72b3('0x29')]);_0xcebd1a[_0x72b3('0x2e')]=_[_0x72b3('0x2f')](_0x5e9135[_0x72b3('0x2e')]);_0xcebd1a[_0x72b3('0x30')]=_[_0x72b3('0x31')](_0xcebd1a[_0x72b3('0x2d')],_0xcebd1a[_0x72b3('0x2e')]);_0x5bf262[_0x72b3('0x32')]=_[_0x72b3('0x31')](_0xcebd1a['model'],qs['fields'](_0x5e9135[_0x72b3('0x2e')][_0x72b3('0x33')]));_0x5bf262[_0x72b3('0x32')]=_0x5bf262[_0x72b3('0x32')][_0x72b3('0x34')]?_0x5bf262['attributes']:_0xcebd1a[_0x72b3('0x2d')];if(_0x5e9135['query']['includeAll']){_0x5bf262['include']=[{'all':!![]}];}_0x5bf262=_[_0x72b3('0x3a')]({},_0x5bf262,_0x5e9135[_0x72b3('0x3d')]);return db[_0x72b3('0x28')][_0x72b3('0x44')](_0x5bf262)[_0x72b3('0x1f')](handleEntityNotFound(_0x31b27a,null))['then'](respondWithResult(_0x31b27a,null))[_0x72b3('0x41')](handleError(_0x31b27a,null));};exports[_0x72b3('0x45')]=function(_0x409020,_0x16b8ee){return db[_0x72b3('0x28')][_0x72b3('0x45')](_0x409020['body'],{})[_0x72b3('0x1f')](respondWithResult(_0x16b8ee,0xc9))[_0x72b3('0x41')](handleError(_0x16b8ee,null));};exports[_0x72b3('0x1e')]=function(_0x3fb754,_0x2275b5){if(_0x3fb754[_0x72b3('0x46')]['id']){delete _0x3fb754[_0x72b3('0x46')]['id'];}return db[_0x72b3('0x28')][_0x72b3('0x44')]({'where':{'id':_0x3fb754[_0x72b3('0x43')]['id']}})[_0x72b3('0x1f')](handleEntityNotFound(_0x2275b5,null))['then'](saveUpdates(_0x3fb754[_0x72b3('0x46')],null))[_0x72b3('0x1f')](respondWithResult(_0x2275b5,null))['catch'](handleError(_0x2275b5,null));};exports[_0x72b3('0x20')]=function(_0x2dff1b,_0x590cef){return db[_0x72b3('0x28')][_0x72b3('0x44')]({'where':{'id':_0x2dff1b[_0x72b3('0x43')]['id']}})[_0x72b3('0x1f')](handleEntityNotFound(_0x590cef,null))[_0x72b3('0x1f')](removeEntity(_0x590cef,null))[_0x72b3('0x41')](handleError(_0x590cef,null));};exports['getFields']=function(_0x8f71e7,_0x5d1a21,_0x4948f4){var _0xb17538={};var _0x46fe2c={};var _0x2529e6;var _0x553a9e;return db['FreshdeskConfiguration'][_0x72b3('0x47')]({'where':{'id':_0x8f71e7[_0x72b3('0x43')]['id']}})[_0x72b3('0x1f')](handleEntityNotFound(_0x5d1a21,null))['then'](function(_0x470823){if(_0x470823){_0x2529e6=_0x470823;_0x46fe2c[_0x72b3('0x2d')]=_['keys'](db[_0x72b3('0x48')][_0x72b3('0x29')]);_0x46fe2c[_0x72b3('0x2e')]=_[_0x72b3('0x2f')](_0x8f71e7[_0x72b3('0x2e')]);_0x46fe2c[_0x72b3('0x30')]=_['intersection'](_0x46fe2c[_0x72b3('0x2d')],_0x46fe2c[_0x72b3('0x2e')]);_0xb17538['attributes']=_[_0x72b3('0x31')](_0x46fe2c['model'],qs[_0x72b3('0x33')](_0x8f71e7['query'][_0x72b3('0x33')]));_0xb17538[_0x72b3('0x32')]=_0xb17538[_0x72b3('0x32')]['length']?_0xb17538[_0x72b3('0x32')]:_0x46fe2c[_0x72b3('0x2d')];_0xb17538[_0x72b3('0x36')]=qs[_0x72b3('0x37')](_0x8f71e7[_0x72b3('0x2e')]['sort']);_0xb17538[_0x72b3('0x38')]=qs[_0x72b3('0x30')](_[_0x72b3('0x39')](_0x8f71e7[_0x72b3('0x2e')],_0x46fe2c['filters']));if(_0x8f71e7['query']['filter']){_0xb17538[_0x72b3('0x38')]=_['merge'](_0xb17538[_0x72b3('0x38')],{'$or':_[_0x72b3('0x27')](_0xb17538[_0x72b3('0x32')],function(_0xc607c5){var _0x3baed5={};_0x3baed5[_0xc607c5]={'$like':'%'+_0x8f71e7[_0x72b3('0x2e')][_0x72b3('0x3c')]+'%'};return _0x3baed5;})});}_0xb17538=_['merge']({},_0xb17538,_0x8f71e7[_0x72b3('0x3d')]);return _0x2529e6[_0x72b3('0x49')](_0xb17538);}})['then'](function(_0x5c3892){if(_0x5c3892){_0x553a9e=_0x5c3892[_0x72b3('0x34')];if(!_0x8f71e7[_0x72b3('0x2e')][_0x72b3('0x4a')]('nolimit')){_0xb17538[_0x72b3('0x1b')]=qs[_0x72b3('0x1b')](_0x8f71e7[_0x72b3('0x2e')]['limit']);_0xb17538[_0x72b3('0x19')]=qs[_0x72b3('0x19')](_0x8f71e7[_0x72b3('0x2e')]['offset']);}return _0x2529e6[_0x72b3('0x49')](_0xb17538);}})[_0x72b3('0x1f')](function(_0x458b54){if(_0x458b54){return _0x458b54?{'count':_0x553a9e,'rows':_0x458b54}:null;}})[_0x72b3('0x1f')](respondWithResult(_0x5d1a21,null))[_0x72b3('0x41')](handleError(_0x5d1a21,null));};exports[_0x72b3('0x4b')]=function(_0x22f4ed,_0x46fde5,_0x1c5135){var _0xa6ccf7={};var _0x409366={};var _0x286475;var _0x5a86a5;return db[_0x72b3('0x28')][_0x72b3('0x47')]({'where':{'id':_0x22f4ed[_0x72b3('0x43')]['id']}})[_0x72b3('0x1f')](handleEntityNotFound(_0x46fde5,null))['then'](function(_0x3ad851){if(_0x3ad851){_0x286475=_0x3ad851;_0x409366[_0x72b3('0x2d')]=_[_0x72b3('0x2f')](db[_0x72b3('0x48')][_0x72b3('0x29')]);_0x409366[_0x72b3('0x2e')]=_[_0x72b3('0x2f')](_0x22f4ed[_0x72b3('0x2e')]);_0x409366[_0x72b3('0x30')]=_['intersection'](_0x409366[_0x72b3('0x2d')],_0x409366[_0x72b3('0x2e')]);_0xa6ccf7[_0x72b3('0x32')]=_[_0x72b3('0x31')](_0x409366[_0x72b3('0x2d')],qs[_0x72b3('0x33')](_0x22f4ed['query']['fields']));_0xa6ccf7['attributes']=_0xa6ccf7[_0x72b3('0x32')][_0x72b3('0x34')]?_0xa6ccf7[_0x72b3('0x32')]:_0x409366[_0x72b3('0x2d')];_0xa6ccf7[_0x72b3('0x36')]=qs[_0x72b3('0x37')](_0x22f4ed[_0x72b3('0x2e')]['sort']);_0xa6ccf7[_0x72b3('0x38')]=qs[_0x72b3('0x30')](_['pick'](_0x22f4ed[_0x72b3('0x2e')],_0x409366[_0x72b3('0x30')]));if(_0x22f4ed['query'][_0x72b3('0x3c')]){_0xa6ccf7[_0x72b3('0x38')]=_[_0x72b3('0x3a')](_0xa6ccf7['where'],{'$or':_['map'](_0xa6ccf7[_0x72b3('0x32')],function(_0x57f891){var _0x4bfe4e={};_0x4bfe4e[_0x57f891]={'$like':'%'+_0x22f4ed[_0x72b3('0x2e')][_0x72b3('0x3c')]+'%'};return _0x4bfe4e;})});}_0xa6ccf7=_['merge']({},_0xa6ccf7,_0x22f4ed[_0x72b3('0x3d')]);return _0x286475[_0x72b3('0x4b')](_0xa6ccf7);}})['then'](function(_0xe2b45){if(_0xe2b45){_0x5a86a5=_0xe2b45[_0x72b3('0x34')];if(!_0x22f4ed[_0x72b3('0x2e')][_0x72b3('0x4a')](_0x72b3('0x35'))){_0xa6ccf7['limit']=qs['limit'](_0x22f4ed['query']['limit']);_0xa6ccf7[_0x72b3('0x19')]=qs[_0x72b3('0x19')](_0x22f4ed['query'][_0x72b3('0x19')]);}return _0x286475[_0x72b3('0x4b')](_0xa6ccf7);}})[_0x72b3('0x1f')](function(_0x40d76b){if(_0x40d76b){return _0x40d76b?{'count':_0x5a86a5,'rows':_0x40d76b}:null;}})[_0x72b3('0x1f')](respondWithResult(_0x46fde5,null))[_0x72b3('0x41')](handleError(_0x46fde5,null));};exports[_0x72b3('0x4c')]=function(_0x5cc8f4,_0x4f3922,_0x550e96){var _0x5745d2={};var _0x535c64={};var _0x5eef0b;var _0x5d8bd5;return db['FreshdeskConfiguration'][_0x72b3('0x47')]({'where':{'id':_0x5cc8f4[_0x72b3('0x43')]['id']}})['then'](handleEntityNotFound(_0x4f3922,null))[_0x72b3('0x1f')](function(_0x190c31){if(_0x190c31){_0x5eef0b=_0x190c31;_0x535c64[_0x72b3('0x2d')]=_['keys'](db[_0x72b3('0x48')][_0x72b3('0x29')]);_0x535c64[_0x72b3('0x2e')]=_[_0x72b3('0x2f')](_0x5cc8f4['query']);_0x535c64[_0x72b3('0x30')]=_[_0x72b3('0x31')](_0x535c64['model'],_0x535c64[_0x72b3('0x2e')]);_0x5745d2[_0x72b3('0x32')]=_[_0x72b3('0x31')](_0x535c64[_0x72b3('0x2d')],qs[_0x72b3('0x33')](_0x5cc8f4['query'][_0x72b3('0x33')]));_0x5745d2[_0x72b3('0x32')]=_0x5745d2[_0x72b3('0x32')][_0x72b3('0x34')]?_0x5745d2['attributes']:_0x535c64[_0x72b3('0x2d')];_0x5745d2[_0x72b3('0x36')]=qs[_0x72b3('0x37')](_0x5cc8f4[_0x72b3('0x2e')]['sort']);_0x5745d2['where']=qs[_0x72b3('0x30')](_['pick'](_0x5cc8f4[_0x72b3('0x2e')],_0x535c64[_0x72b3('0x30')]));if(_0x5cc8f4['query'][_0x72b3('0x3c')]){_0x5745d2[_0x72b3('0x38')]=_['merge'](_0x5745d2[_0x72b3('0x38')],{'$or':_[_0x72b3('0x27')](_0x5745d2[_0x72b3('0x32')],function(_0x4ee332){var _0x3bd05b={};_0x3bd05b[_0x4ee332]={'$like':'%'+_0x5cc8f4['query']['filter']+'%'};return _0x3bd05b;})});}_0x5745d2=_[_0x72b3('0x3a')]({},_0x5745d2,_0x5cc8f4[_0x72b3('0x3d')]);return _0x5eef0b['getDescriptions'](_0x5745d2);}})[_0x72b3('0x1f')](function(_0x1a5668){if(_0x1a5668){_0x5d8bd5=_0x1a5668[_0x72b3('0x34')];if(!_0x5cc8f4['query'][_0x72b3('0x4a')](_0x72b3('0x35'))){_0x5745d2[_0x72b3('0x1b')]=qs[_0x72b3('0x1b')](_0x5cc8f4[_0x72b3('0x2e')][_0x72b3('0x1b')]);_0x5745d2[_0x72b3('0x19')]=qs[_0x72b3('0x19')](_0x5cc8f4[_0x72b3('0x2e')][_0x72b3('0x19')]);}return _0x5eef0b[_0x72b3('0x4c')](_0x5745d2);}})[_0x72b3('0x1f')](function(_0xcb383e){if(_0xcb383e){return _0xcb383e?{'count':_0x5d8bd5,'rows':_0xcb383e}:null;}})['then'](respondWithResult(_0x4f3922,null))[_0x72b3('0x41')](handleError(_0x4f3922,null));};exports[_0x72b3('0x4d')]=function(_0x58730b,_0x47ab5a,_0x4e35a1){var _0x2c92e1={};var _0x3b7259={};var _0xb3981e;var _0x2b9d88;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x58730b[_0x72b3('0x43')]['id']}})[_0x72b3('0x1f')](handleEntityNotFound(_0x47ab5a,null))[_0x72b3('0x1f')](function(_0x3e6241){if(_0x3e6241){_0xb3981e=_0x3e6241;_0x3b7259['model']=_['keys'](db[_0x72b3('0x4e')][_0x72b3('0x29')]);_0x3b7259[_0x72b3('0x2e')]=_['keys'](_0x58730b[_0x72b3('0x2e')]);_0x3b7259[_0x72b3('0x30')]=_['intersection'](_0x3b7259[_0x72b3('0x2d')],_0x3b7259[_0x72b3('0x2e')]);_0x2c92e1[_0x72b3('0x32')]=_[_0x72b3('0x31')](_0x3b7259[_0x72b3('0x2d')],qs[_0x72b3('0x33')](_0x58730b['query']['fields']));_0x2c92e1[_0x72b3('0x32')]=_0x2c92e1[_0x72b3('0x32')][_0x72b3('0x34')]?_0x2c92e1[_0x72b3('0x32')]:_0x3b7259[_0x72b3('0x2d')];_0x2c92e1[_0x72b3('0x36')]=qs[_0x72b3('0x37')](_0x58730b[_0x72b3('0x2e')][_0x72b3('0x37')]);_0x2c92e1['where']=qs[_0x72b3('0x30')](_[_0x72b3('0x39')](_0x58730b['query'],_0x3b7259[_0x72b3('0x30')]));if(_0x58730b[_0x72b3('0x2e')]['filter']){_0x2c92e1[_0x72b3('0x38')]=_[_0x72b3('0x3a')](_0x2c92e1['where'],{'$or':_[_0x72b3('0x27')](_0x2c92e1[_0x72b3('0x32')],function(_0x5a27fc){var _0x1b124d={};_0x1b124d[_0x5a27fc]={'$like':'%'+_0x58730b[_0x72b3('0x2e')][_0x72b3('0x3c')]+'%'};return _0x1b124d;})});}_0x2c92e1=_[_0x72b3('0x3a')]({},_0x2c92e1,_0x58730b['options']);return _0xb3981e[_0x72b3('0x4d')](_0x2c92e1);}})['then'](function(_0x5f254f){if(_0x5f254f){_0x2b9d88=_0x5f254f['length'];if(!_0x58730b[_0x72b3('0x2e')][_0x72b3('0x4a')](_0x72b3('0x35'))){_0x2c92e1[_0x72b3('0x1b')]=qs[_0x72b3('0x1b')](_0x58730b[_0x72b3('0x2e')][_0x72b3('0x1b')]);_0x2c92e1[_0x72b3('0x19')]=qs[_0x72b3('0x19')](_0x58730b[_0x72b3('0x2e')][_0x72b3('0x19')]);}return _0xb3981e['getTags'](_0x2c92e1);}})[_0x72b3('0x1f')](function(_0x2cf319){if(_0x2cf319){return _0x2cf319?{'count':_0x2b9d88,'rows':_0x2cf319}:null;}})[_0x72b3('0x1f')](respondWithResult(_0x47ab5a,null))[_0x72b3('0x41')](handleError(_0x47ab5a,null));};exports[_0x72b3('0x4f')]=function(_0x1ebcdc,_0x30b527,_0x32de01){if(_0x1ebcdc['body']['id']){delete _0x1ebcdc[_0x72b3('0x46')]['id'];}return db[_0x72b3('0x28')][_0x72b3('0x47')]({'where':{'id':_0x1ebcdc[_0x72b3('0x43')]['id']}})[_0x72b3('0x1f')](handleEntityNotFound(_0x30b527,null))['then'](function(_0x3a6f2e){if(_0x3a6f2e){return _0x3a6f2e[_0x72b3('0x4f')](_0x1ebcdc[_0x72b3('0x46')][_0x72b3('0x50')]||[]);}return null;})[_0x72b3('0x1f')](respondWithResult(_0x30b527,null))[_0x72b3('0x41')](handleError(_0x30b527,null));}; \ No newline at end of file +var _0xc5de=['order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','keys','length','find','create','body','params','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status','offset','limit','count','set','Content-Range','save','update','then','destroy','end','sendStatus','error','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x4251fd,_0x42c3e0){var _0x2aba9a=function(_0x4ed38e){while(--_0x4ed38e){_0x4251fd['push'](_0x4251fd['shift']());}};_0x2aba9a(++_0x42c3e0);}(_0xc5de,0xbf));var _0xec5d=function(_0x203cf5,_0x8421e0){_0x203cf5=_0x203cf5-0x0;var _0x17a51d=_0xc5de[_0x203cf5];return _0x17a51d;};'use strict';var emlformat=require(_0xec5d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xec5d('0x1'));var jsonpatch=require(_0xec5d('0x2'));var rp=require(_0xec5d('0x3'));var moment=require(_0xec5d('0x4'));var BPromise=require(_0xec5d('0x5'));var Mustache=require('mustache');var util=require(_0xec5d('0x6'));var path=require(_0xec5d('0x7'));var sox=require(_0xec5d('0x8'));var csv=require('to-csv');var ejs=require(_0xec5d('0x9'));var fs=require('fs');var fs_extra=require(_0xec5d('0xa'));var _=require(_0xec5d('0xb'));var squel=require(_0xec5d('0xc'));var crypto=require('crypto');var jsforce=require(_0xec5d('0xd'));var deskjs=require(_0xec5d('0xe'));var toCsv=require(_0xec5d('0xf'));var querystring=require('querystring');var Papa=require(_0xec5d('0x10'));var Redis=require('ioredis');var authService=require(_0xec5d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xec5d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xec5d('0x13'))(_0xec5d('0x14'));var utils=require('../../config/utils');var config=require(_0xec5d('0x15'));var licenseUtil=require(_0xec5d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x84b0fc,_0x10c022){_0x10c022=_0x10c022||0xcc;return function(_0x1f8913){if(_0x1f8913){return _0x84b0fc['sendStatus'](_0x10c022);}return _0x84b0fc['status'](_0x10c022)['end']();};}function respondWithResult(_0x25d2c0,_0x2f2ca0){_0x2f2ca0=_0x2f2ca0||0xc8;return function(_0x451741){if(_0x451741){return _0x25d2c0[_0xec5d('0x17')](_0x2f2ca0)['json'](_0x451741);}};}function respondWithFilteredResult(_0x22fad7,_0x51fe7c){return function(_0x5cba44){if(_0x5cba44){var _0x27e361=typeof _0x51fe7c[_0xec5d('0x18')]==='undefined'&&typeof _0x51fe7c[_0xec5d('0x19')]==='undefined';var _0x1e929d=_0x5cba44[_0xec5d('0x1a')];var _0x1feb62=_0x27e361?0x0:_0x51fe7c['offset'];var _0x1a2db5=_0x27e361?_0x5cba44[_0xec5d('0x1a')]:_0x51fe7c[_0xec5d('0x18')]+_0x51fe7c[_0xec5d('0x19')];var _0x1ade43;if(_0x1a2db5>=_0x1e929d){_0x1a2db5=_0x1e929d;_0x1ade43=0xc8;}else{_0x1ade43=0xce;}_0x22fad7['status'](_0x1ade43);return _0x22fad7[_0xec5d('0x1b')](_0xec5d('0x1c'),_0x1feb62+'-'+_0x1a2db5+'/'+_0x1e929d)['json'](_0x5cba44);}return null;};}function patchUpdates(_0x250fba){return function(_0x181c02){try{jsonpatch['apply'](_0x181c02,_0x250fba,!![]);}catch(_0x24573a){return BPromise['reject'](_0x24573a);}return _0x181c02[_0xec5d('0x1d')]();};}function saveUpdates(_0x362c44,_0x18573c){return function(_0x54c71d){if(_0x54c71d){return _0x54c71d[_0xec5d('0x1e')](_0x362c44)[_0xec5d('0x1f')](function(_0x5cebff){return _0x5cebff;});}return null;};}function removeEntity(_0x5cb15e,_0x25e770){return function(_0x37f8d4){if(_0x37f8d4){return _0x37f8d4[_0xec5d('0x20')]()[_0xec5d('0x1f')](function(){_0x5cb15e['status'](0xcc)[_0xec5d('0x21')]();});}};}function handleEntityNotFound(_0x34f88e,_0x21a709){return function(_0x19df31){if(!_0x19df31){_0x34f88e[_0xec5d('0x22')](0x194);}return _0x19df31;};}function handleError(_0x3d3591,_0x51c100){_0x51c100=_0x51c100||0x1f4;return function(_0x290859){logger[_0xec5d('0x23')](_0x290859[_0xec5d('0x24')]);if(_0x290859[_0xec5d('0x25')]){delete _0x290859['name'];}_0x3d3591[_0xec5d('0x17')](_0x51c100)[_0xec5d('0x26')](_0x290859);};}exports['index']=function(_0x1dc597,_0x19ccb5){var _0x5be7dd={},_0x739d8d={},_0x54af4e={'count':0x0,'rows':[]};var _0x25a4d3=_[_0xec5d('0x27')](db[_0xec5d('0x28')][_0xec5d('0x29')],function(_0x438d2b){return{'name':_0x438d2b[_0xec5d('0x2a')],'type':_0x438d2b['type'][_0xec5d('0x2b')]};});_0x739d8d[_0xec5d('0x2c')]=_[_0xec5d('0x27')](_0x25a4d3,_0xec5d('0x25'));_0x739d8d[_0xec5d('0x2d')]=_['keys'](_0x1dc597[_0xec5d('0x2d')]);_0x739d8d[_0xec5d('0x2e')]=_[_0xec5d('0x2f')](_0x739d8d[_0xec5d('0x2c')],_0x739d8d[_0xec5d('0x2d')]);_0x5be7dd[_0xec5d('0x30')]=_[_0xec5d('0x2f')](_0x739d8d[_0xec5d('0x2c')],qs[_0xec5d('0x31')](_0x1dc597[_0xec5d('0x2d')][_0xec5d('0x31')]));_0x5be7dd[_0xec5d('0x30')]=_0x5be7dd[_0xec5d('0x30')]['length']?_0x5be7dd['attributes']:_0x739d8d['model'];if(!_0x1dc597['query'][_0xec5d('0x32')](_0xec5d('0x33'))){_0x5be7dd[_0xec5d('0x19')]=qs['limit'](_0x1dc597['query'][_0xec5d('0x19')]);_0x5be7dd[_0xec5d('0x18')]=qs['offset'](_0x1dc597['query']['offset']);}_0x5be7dd[_0xec5d('0x34')]=qs[_0xec5d('0x35')](_0x1dc597['query']['sort']);_0x5be7dd[_0xec5d('0x36')]=qs[_0xec5d('0x2e')](_[_0xec5d('0x37')](_0x1dc597[_0xec5d('0x2d')],_0x739d8d['filters']),_0x25a4d3);if(_0x1dc597[_0xec5d('0x2d')]['filter']){_0x5be7dd[_0xec5d('0x36')]=_[_0xec5d('0x38')](_0x5be7dd[_0xec5d('0x36')],{'$or':_[_0xec5d('0x27')](_0x25a4d3,function(_0x122ab9){if(_0x122ab9[_0xec5d('0x39')]!=='VIRTUAL'){var _0x18857d={};_0x18857d[_0x122ab9[_0xec5d('0x25')]]={'$like':'%'+_0x1dc597[_0xec5d('0x2d')][_0xec5d('0x3a')]+'%'};return _0x18857d;}})});}_0x5be7dd=_[_0xec5d('0x38')]({},_0x5be7dd,_0x1dc597[_0xec5d('0x3b')]);var _0x21b711={'where':_0x5be7dd[_0xec5d('0x36')]};return db[_0xec5d('0x28')]['count'](_0x21b711)[_0xec5d('0x1f')](function(_0x11c1e0){_0x54af4e['count']=_0x11c1e0;if(_0x1dc597['query'][_0xec5d('0x3c')]){_0x5be7dd[_0xec5d('0x3d')]=[{'all':!![]}];}return db[_0xec5d('0x28')][_0xec5d('0x3e')](_0x5be7dd);})[_0xec5d('0x1f')](function(_0x1ebc14){_0x54af4e[_0xec5d('0x3f')]=_0x1ebc14;return _0x54af4e;})['then'](respondWithFilteredResult(_0x19ccb5,_0x5be7dd))[_0xec5d('0x40')](handleError(_0x19ccb5,null));};exports[_0xec5d('0x41')]=function(_0x44ed62,_0x4f01fe){var _0x1ada98={'raw':![],'where':{'id':_0x44ed62['params']['id']}},_0x1a2adb={};_0x1a2adb['model']=_['keys'](db[_0xec5d('0x28')]['rawAttributes']);_0x1a2adb[_0xec5d('0x2d')]=_[_0xec5d('0x42')](_0x44ed62[_0xec5d('0x2d')]);_0x1a2adb['filters']=_[_0xec5d('0x2f')](_0x1a2adb[_0xec5d('0x2c')],_0x1a2adb['query']);_0x1ada98[_0xec5d('0x30')]=_[_0xec5d('0x2f')](_0x1a2adb[_0xec5d('0x2c')],qs[_0xec5d('0x31')](_0x44ed62[_0xec5d('0x2d')][_0xec5d('0x31')]));_0x1ada98[_0xec5d('0x30')]=_0x1ada98['attributes'][_0xec5d('0x43')]?_0x1ada98['attributes']:_0x1a2adb['model'];if(_0x44ed62[_0xec5d('0x2d')][_0xec5d('0x3c')]){_0x1ada98['include']=[{'all':!![]}];}_0x1ada98=_['merge']({},_0x1ada98,_0x44ed62[_0xec5d('0x3b')]);return db['FreshdeskConfiguration'][_0xec5d('0x44')](_0x1ada98)[_0xec5d('0x1f')](handleEntityNotFound(_0x4f01fe,null))[_0xec5d('0x1f')](respondWithResult(_0x4f01fe,null))[_0xec5d('0x40')](handleError(_0x4f01fe,null));};exports['create']=function(_0x46083b,_0x37532f){return db[_0xec5d('0x28')][_0xec5d('0x45')](_0x46083b['body'],{})[_0xec5d('0x1f')](respondWithResult(_0x37532f,0xc9))[_0xec5d('0x40')](handleError(_0x37532f,null));};exports[_0xec5d('0x1e')]=function(_0x289a8b,_0x23ae5c){if(_0x289a8b[_0xec5d('0x46')]['id']){delete _0x289a8b[_0xec5d('0x46')]['id'];}return db[_0xec5d('0x28')][_0xec5d('0x44')]({'where':{'id':_0x289a8b[_0xec5d('0x47')]['id']}})[_0xec5d('0x1f')](handleEntityNotFound(_0x23ae5c,null))[_0xec5d('0x1f')](saveUpdates(_0x289a8b[_0xec5d('0x46')],null))[_0xec5d('0x1f')](respondWithResult(_0x23ae5c,null))[_0xec5d('0x40')](handleError(_0x23ae5c,null));};exports[_0xec5d('0x20')]=function(_0x50bf38,_0x967a78){return db[_0xec5d('0x28')][_0xec5d('0x44')]({'where':{'id':_0x50bf38[_0xec5d('0x47')]['id']}})[_0xec5d('0x1f')](handleEntityNotFound(_0x967a78,null))[_0xec5d('0x1f')](removeEntity(_0x967a78,null))[_0xec5d('0x40')](handleError(_0x967a78,null));};exports[_0xec5d('0x48')]=function(_0x2010d0,_0x3b1369,_0x77bd22){var _0x1f8e35={};var _0x490b6d={};var _0x3ca834;var _0x2ad36a;return db['FreshdeskConfiguration'][_0xec5d('0x49')]({'where':{'id':_0x2010d0[_0xec5d('0x47')]['id']}})[_0xec5d('0x1f')](handleEntityNotFound(_0x3b1369,null))['then'](function(_0x1fdd0b){if(_0x1fdd0b){_0x3ca834=_0x1fdd0b;_0x490b6d[_0xec5d('0x2c')]=_[_0xec5d('0x42')](db[_0xec5d('0x4a')][_0xec5d('0x29')]);_0x490b6d[_0xec5d('0x2d')]=_[_0xec5d('0x42')](_0x2010d0[_0xec5d('0x2d')]);_0x490b6d[_0xec5d('0x2e')]=_['intersection'](_0x490b6d[_0xec5d('0x2c')],_0x490b6d[_0xec5d('0x2d')]);_0x1f8e35[_0xec5d('0x30')]=_[_0xec5d('0x2f')](_0x490b6d[_0xec5d('0x2c')],qs[_0xec5d('0x31')](_0x2010d0[_0xec5d('0x2d')][_0xec5d('0x31')]));_0x1f8e35[_0xec5d('0x30')]=_0x1f8e35['attributes'][_0xec5d('0x43')]?_0x1f8e35['attributes']:_0x490b6d[_0xec5d('0x2c')];_0x1f8e35[_0xec5d('0x34')]=qs['sort'](_0x2010d0[_0xec5d('0x2d')][_0xec5d('0x35')]);_0x1f8e35[_0xec5d('0x36')]=qs['filters'](_[_0xec5d('0x37')](_0x2010d0['query'],_0x490b6d[_0xec5d('0x2e')]));if(_0x2010d0['query'][_0xec5d('0x3a')]){_0x1f8e35[_0xec5d('0x36')]=_[_0xec5d('0x38')](_0x1f8e35['where'],{'$or':_[_0xec5d('0x27')](_0x1f8e35[_0xec5d('0x30')],function(_0x50a65c){var _0xd707e4={};_0xd707e4[_0x50a65c]={'$like':'%'+_0x2010d0[_0xec5d('0x2d')][_0xec5d('0x3a')]+'%'};return _0xd707e4;})});}_0x1f8e35=_[_0xec5d('0x38')]({},_0x1f8e35,_0x2010d0['options']);return _0x3ca834[_0xec5d('0x48')](_0x1f8e35);}})[_0xec5d('0x1f')](function(_0x231bdf){if(_0x231bdf){_0x2ad36a=_0x231bdf[_0xec5d('0x43')];if(!_0x2010d0[_0xec5d('0x2d')][_0xec5d('0x32')](_0xec5d('0x33'))){_0x1f8e35[_0xec5d('0x19')]=qs[_0xec5d('0x19')](_0x2010d0[_0xec5d('0x2d')][_0xec5d('0x19')]);_0x1f8e35[_0xec5d('0x18')]=qs[_0xec5d('0x18')](_0x2010d0[_0xec5d('0x2d')]['offset']);}return _0x3ca834[_0xec5d('0x48')](_0x1f8e35);}})[_0xec5d('0x1f')](function(_0x5a7830){if(_0x5a7830){return _0x5a7830?{'count':_0x2ad36a,'rows':_0x5a7830}:null;}})[_0xec5d('0x1f')](respondWithResult(_0x3b1369,null))[_0xec5d('0x40')](handleError(_0x3b1369,null));};exports['getSubjects']=function(_0x320f9c,_0x4de27f,_0xea029a){var _0x2f6753={};var _0x37740d={};var _0xfcc396;var _0x1a6e9a;return db[_0xec5d('0x28')][_0xec5d('0x49')]({'where':{'id':_0x320f9c[_0xec5d('0x47')]['id']}})[_0xec5d('0x1f')](handleEntityNotFound(_0x4de27f,null))[_0xec5d('0x1f')](function(_0x5548ca){if(_0x5548ca){_0xfcc396=_0x5548ca;_0x37740d[_0xec5d('0x2c')]=_[_0xec5d('0x42')](db[_0xec5d('0x4a')][_0xec5d('0x29')]);_0x37740d[_0xec5d('0x2d')]=_[_0xec5d('0x42')](_0x320f9c[_0xec5d('0x2d')]);_0x37740d[_0xec5d('0x2e')]=_[_0xec5d('0x2f')](_0x37740d[_0xec5d('0x2c')],_0x37740d[_0xec5d('0x2d')]);_0x2f6753[_0xec5d('0x30')]=_['intersection'](_0x37740d[_0xec5d('0x2c')],qs['fields'](_0x320f9c[_0xec5d('0x2d')]['fields']));_0x2f6753[_0xec5d('0x30')]=_0x2f6753['attributes'][_0xec5d('0x43')]?_0x2f6753[_0xec5d('0x30')]:_0x37740d[_0xec5d('0x2c')];_0x2f6753[_0xec5d('0x34')]=qs[_0xec5d('0x35')](_0x320f9c[_0xec5d('0x2d')][_0xec5d('0x35')]);_0x2f6753[_0xec5d('0x36')]=qs['filters'](_['pick'](_0x320f9c['query'],_0x37740d[_0xec5d('0x2e')]));if(_0x320f9c[_0xec5d('0x2d')][_0xec5d('0x3a')]){_0x2f6753[_0xec5d('0x36')]=_[_0xec5d('0x38')](_0x2f6753['where'],{'$or':_[_0xec5d('0x27')](_0x2f6753[_0xec5d('0x30')],function(_0x3f13a3){var _0x158986={};_0x158986[_0x3f13a3]={'$like':'%'+_0x320f9c[_0xec5d('0x2d')][_0xec5d('0x3a')]+'%'};return _0x158986;})});}_0x2f6753=_['merge']({},_0x2f6753,_0x320f9c[_0xec5d('0x3b')]);return _0xfcc396[_0xec5d('0x4b')](_0x2f6753);}})['then'](function(_0x40e42c){if(_0x40e42c){_0x1a6e9a=_0x40e42c['length'];if(!_0x320f9c['query'][_0xec5d('0x32')](_0xec5d('0x33'))){_0x2f6753[_0xec5d('0x19')]=qs[_0xec5d('0x19')](_0x320f9c['query']['limit']);_0x2f6753[_0xec5d('0x18')]=qs[_0xec5d('0x18')](_0x320f9c['query'][_0xec5d('0x18')]);}return _0xfcc396[_0xec5d('0x4b')](_0x2f6753);}})['then'](function(_0x2e821f){if(_0x2e821f){return _0x2e821f?{'count':_0x1a6e9a,'rows':_0x2e821f}:null;}})[_0xec5d('0x1f')](respondWithResult(_0x4de27f,null))[_0xec5d('0x40')](handleError(_0x4de27f,null));};exports[_0xec5d('0x4c')]=function(_0x5c3246,_0xbc3bd4,_0x53c5ca){var _0x354bc7={};var _0x4eabd9={};var _0x2eea92;var _0x1ac8e7;return db[_0xec5d('0x28')][_0xec5d('0x49')]({'where':{'id':_0x5c3246[_0xec5d('0x47')]['id']}})['then'](handleEntityNotFound(_0xbc3bd4,null))['then'](function(_0x2b2c25){if(_0x2b2c25){_0x2eea92=_0x2b2c25;_0x4eabd9[_0xec5d('0x2c')]=_[_0xec5d('0x42')](db[_0xec5d('0x4a')][_0xec5d('0x29')]);_0x4eabd9[_0xec5d('0x2d')]=_[_0xec5d('0x42')](_0x5c3246[_0xec5d('0x2d')]);_0x4eabd9['filters']=_['intersection'](_0x4eabd9[_0xec5d('0x2c')],_0x4eabd9[_0xec5d('0x2d')]);_0x354bc7['attributes']=_[_0xec5d('0x2f')](_0x4eabd9[_0xec5d('0x2c')],qs[_0xec5d('0x31')](_0x5c3246['query'][_0xec5d('0x31')]));_0x354bc7[_0xec5d('0x30')]=_0x354bc7['attributes'][_0xec5d('0x43')]?_0x354bc7['attributes']:_0x4eabd9['model'];_0x354bc7[_0xec5d('0x34')]=qs[_0xec5d('0x35')](_0x5c3246[_0xec5d('0x2d')][_0xec5d('0x35')]);_0x354bc7['where']=qs[_0xec5d('0x2e')](_[_0xec5d('0x37')](_0x5c3246[_0xec5d('0x2d')],_0x4eabd9[_0xec5d('0x2e')]));if(_0x5c3246[_0xec5d('0x2d')][_0xec5d('0x3a')]){_0x354bc7[_0xec5d('0x36')]=_[_0xec5d('0x38')](_0x354bc7[_0xec5d('0x36')],{'$or':_[_0xec5d('0x27')](_0x354bc7['attributes'],function(_0x3d8907){var _0x2d2f35={};_0x2d2f35[_0x3d8907]={'$like':'%'+_0x5c3246['query']['filter']+'%'};return _0x2d2f35;})});}_0x354bc7=_[_0xec5d('0x38')]({},_0x354bc7,_0x5c3246[_0xec5d('0x3b')]);return _0x2eea92['getDescriptions'](_0x354bc7);}})[_0xec5d('0x1f')](function(_0x197575){if(_0x197575){_0x1ac8e7=_0x197575['length'];if(!_0x5c3246['query'][_0xec5d('0x32')](_0xec5d('0x33'))){_0x354bc7[_0xec5d('0x19')]=qs[_0xec5d('0x19')](_0x5c3246[_0xec5d('0x2d')][_0xec5d('0x19')]);_0x354bc7[_0xec5d('0x18')]=qs[_0xec5d('0x18')](_0x5c3246[_0xec5d('0x2d')][_0xec5d('0x18')]);}return _0x2eea92['getDescriptions'](_0x354bc7);}})[_0xec5d('0x1f')](function(_0x3cc7ed){if(_0x3cc7ed){return _0x3cc7ed?{'count':_0x1ac8e7,'rows':_0x3cc7ed}:null;}})['then'](respondWithResult(_0xbc3bd4,null))['catch'](handleError(_0xbc3bd4,null));};exports[_0xec5d('0x4d')]=function(_0x496257,_0x2d4c81,_0x237978){var _0x19ddfc={};var _0x4b61b4={};var _0x4f15a8;var _0x53087b;return db['FreshdeskConfiguration'][_0xec5d('0x49')]({'where':{'id':_0x496257['params']['id']}})[_0xec5d('0x1f')](handleEntityNotFound(_0x2d4c81,null))[_0xec5d('0x1f')](function(_0x2c1dd9){if(_0x2c1dd9){_0x4f15a8=_0x2c1dd9;_0x4b61b4[_0xec5d('0x2c')]=_['keys'](db[_0xec5d('0x4e')][_0xec5d('0x29')]);_0x4b61b4[_0xec5d('0x2d')]=_[_0xec5d('0x42')](_0x496257[_0xec5d('0x2d')]);_0x4b61b4[_0xec5d('0x2e')]=_[_0xec5d('0x2f')](_0x4b61b4[_0xec5d('0x2c')],_0x4b61b4[_0xec5d('0x2d')]);_0x19ddfc[_0xec5d('0x30')]=_[_0xec5d('0x2f')](_0x4b61b4[_0xec5d('0x2c')],qs[_0xec5d('0x31')](_0x496257[_0xec5d('0x2d')][_0xec5d('0x31')]));_0x19ddfc[_0xec5d('0x30')]=_0x19ddfc[_0xec5d('0x30')][_0xec5d('0x43')]?_0x19ddfc['attributes']:_0x4b61b4[_0xec5d('0x2c')];_0x19ddfc[_0xec5d('0x34')]=qs[_0xec5d('0x35')](_0x496257[_0xec5d('0x2d')][_0xec5d('0x35')]);_0x19ddfc[_0xec5d('0x36')]=qs[_0xec5d('0x2e')](_[_0xec5d('0x37')](_0x496257[_0xec5d('0x2d')],_0x4b61b4[_0xec5d('0x2e')]));if(_0x496257[_0xec5d('0x2d')][_0xec5d('0x3a')]){_0x19ddfc[_0xec5d('0x36')]=_[_0xec5d('0x38')](_0x19ddfc[_0xec5d('0x36')],{'$or':_[_0xec5d('0x27')](_0x19ddfc[_0xec5d('0x30')],function(_0x615c26){var _0x3d0d1d={};_0x3d0d1d[_0x615c26]={'$like':'%'+_0x496257['query'][_0xec5d('0x3a')]+'%'};return _0x3d0d1d;})});}_0x19ddfc=_[_0xec5d('0x38')]({},_0x19ddfc,_0x496257[_0xec5d('0x3b')]);return _0x4f15a8['getTags'](_0x19ddfc);}})[_0xec5d('0x1f')](function(_0x228ed1){if(_0x228ed1){_0x53087b=_0x228ed1[_0xec5d('0x43')];if(!_0x496257[_0xec5d('0x2d')][_0xec5d('0x32')](_0xec5d('0x33'))){_0x19ddfc[_0xec5d('0x19')]=qs[_0xec5d('0x19')](_0x496257[_0xec5d('0x2d')][_0xec5d('0x19')]);_0x19ddfc[_0xec5d('0x18')]=qs[_0xec5d('0x18')](_0x496257[_0xec5d('0x2d')][_0xec5d('0x18')]);}return _0x4f15a8['getTags'](_0x19ddfc);}})[_0xec5d('0x1f')](function(_0x15b970){if(_0x15b970){return _0x15b970?{'count':_0x53087b,'rows':_0x15b970}:null;}})['then'](respondWithResult(_0x2d4c81,null))[_0xec5d('0x40')](handleError(_0x2d4c81,null));};exports[_0xec5d('0x4f')]=function(_0x5085ef,_0x5ed92e,_0x562f95){if(_0x5085ef[_0xec5d('0x46')]['id']){delete _0x5085ef[_0xec5d('0x46')]['id'];}return db[_0xec5d('0x28')]['findOne']({'where':{'id':_0x5085ef[_0xec5d('0x47')]['id']}})[_0xec5d('0x1f')](handleEntityNotFound(_0x5ed92e,null))['then'](function(_0x1556e1){if(_0x1556e1){return _0x1556e1[_0xec5d('0x4f')](_0x5085ef[_0xec5d('0x46')][_0xec5d('0x50')]||[]);}return null;})[_0xec5d('0x1f')](respondWithResult(_0x5ed92e,null))[_0xec5d('0x40')](handleError(_0x5ed92e,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 97b98f1..6d5fee8 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 _0x4de6=['rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x169429,_0xca72fb){var _0x419023=function(_0x556652){while(--_0x556652){_0x169429['push'](_0x169429['shift']());}};_0x419023(++_0xca72fb);}(_0x4de6,0x1bc));var _0x64de=function(_0x13afca,_0x527229){_0x13afca=_0x13afca-0x0;var _0x5adea1=_0x4de6[_0x13afca];return _0x5adea1;};'use strict';var _=require(_0x64de('0x0'));var util=require(_0x64de('0x1'));var logger=require(_0x64de('0x2'))(_0x64de('0x3'));var moment=require(_0x64de('0x4'));var BPromise=require('bluebird');var rp=require(_0x64de('0x5'));var fs=require('fs');var path=require(_0x64de('0x6'));var rimraf=require(_0x64de('0x7'));var config=require(_0x64de('0x8'));var attributes=require(_0x64de('0x9'));module['exports']=function(_0x3bfd10,_0x3bbbb4){return _0x3bfd10['define']('FreshdeskConfiguration',attributes,{'tableName':_0x64de('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7a2=['../../config/environment','exports','define','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x14cb63,_0x5ac86f){var _0x576db6=function(_0x34fe6d){while(--_0x34fe6d){_0x14cb63['push'](_0x14cb63['shift']());}};_0x576db6(++_0x5ac86f);}(_0xc7a2,0x1c0));var _0x2c7a=function(_0x1ea170,_0x28d157){_0x1ea170=_0x1ea170-0x0;var _0x32487e=_0xc7a2[_0x1ea170];return _0x32487e;};'use strict';var _=require(_0x2c7a('0x0'));var util=require(_0x2c7a('0x1'));var logger=require(_0x2c7a('0x2'))(_0x2c7a('0x3'));var moment=require(_0x2c7a('0x4'));var BPromise=require(_0x2c7a('0x5'));var rp=require(_0x2c7a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2c7a('0x7'));var config=require(_0x2c7a('0x8'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x2c7a('0x9')]=function(_0x4313b7,_0xb694d8){return _0x4313b7[_0x2c7a('0xa')]('FreshdeskConfiguration',attributes,{'tableName':_0x2c7a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index a0a6297..c3b4bb9 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 _0x00a8=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x126442,_0x4b01e3){var _0x128741=function(_0x15ac49){while(--_0x15ac49){_0x126442['push'](_0x126442['shift']());}};_0x128741(++_0x4b01e3);}(_0x00a8,0xed));var _0x800a=function(_0x3eeb84,_0x470865){_0x3eeb84=_0x3eeb84-0x0;var _0x34cd6e=_0x00a8[_0x3eeb84];return _0x34cd6e;};'use strict';var _=require('lodash');var util=require(_0x800a('0x0'));var moment=require(_0x800a('0x1'));var BPromise=require(_0x800a('0x2'));var rs=require(_0x800a('0x3'));var fs=require('fs');var Redis=require(_0x800a('0x4'));var db=require(_0x800a('0x5'))['db'];var utils=require(_0x800a('0x6'));var logger=require(_0x800a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x800a('0x8'));var client=jayson[_0x800a('0x9')][_0x800a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2af29d,_0x1eb189,_0x4cc9e7){return new BPromise(function(_0x5af89d,_0x234b9f){return client['request'](_0x2af29d,_0x4cc9e7)[_0x800a('0xb')](function(_0x337df3){logger[_0x800a('0xc')](_0x800a('0xd'),_0x1eb189,_0x800a('0xe'));logger[_0x800a('0xf')](_0x800a('0x10'),_0x1eb189,_0x800a('0xe'),JSON['stringify'](_0x337df3));if(_0x337df3['error']){if(_0x337df3[_0x800a('0x11')][_0x800a('0x12')]===0x1f4){logger[_0x800a('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1eb189,_0x337df3[_0x800a('0x11')][_0x800a('0x13')]);return _0x234b9f(_0x337df3['error']['message']);}logger[_0x800a('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1eb189,_0x337df3['error'][_0x800a('0x13')]);return _0x5af89d(_0x337df3[_0x800a('0x11')][_0x800a('0x13')]);}else{logger['info'](_0x800a('0xd'),_0x1eb189,_0x800a('0xe'));_0x5af89d(_0x337df3[_0x800a('0x14')]['message']);}})[_0x800a('0x15')](function(_0x3c6e6a){logger[_0x800a('0x11')](_0x800a('0xd'),_0x1eb189,_0x3c6e6a);_0x234b9f(_0x3c6e6a);});});} \ No newline at end of file +var _0x5a8f=['jayson/promise','client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0x5a8f,0x16d));var _0xf5a8=function(_0x1a5721,_0x1e1ff1){_0x1a5721=_0x1a5721-0x0;var _0x16cb24=_0x5a8f[_0x1a5721];return _0x16cb24;};'use strict';var _=require(_0xf5a8('0x0'));var util=require('util');var moment=require(_0xf5a8('0x1'));var BPromise=require(_0xf5a8('0x2'));var rs=require(_0xf5a8('0x3'));var fs=require('fs');var Redis=require(_0xf5a8('0x4'));var db=require(_0xf5a8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf5a8('0x6'))(_0xf5a8('0x7'));var config=require(_0xf5a8('0x8'));var jayson=require(_0xf5a8('0x9'));var client=jayson[_0xf5a8('0xa')][_0xf5a8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2289f4,_0x47d1a6,_0x1b79f8){return new BPromise(function(_0x44a08e,_0x3de0af){return client['request'](_0x2289f4,_0x1b79f8)[_0xf5a8('0xc')](function(_0x5c6a85){logger[_0xf5a8('0xd')](_0xf5a8('0xe'),_0x47d1a6,'request\x20sent');logger['debug'](_0xf5a8('0xf'),_0x47d1a6,_0xf5a8('0x10'),JSON[_0xf5a8('0x11')](_0x5c6a85));if(_0x5c6a85[_0xf5a8('0x12')]){if(_0x5c6a85['error'][_0xf5a8('0x13')]===0x1f4){logger[_0xf5a8('0x12')](_0xf5a8('0xe'),_0x47d1a6,_0x5c6a85[_0xf5a8('0x12')][_0xf5a8('0x14')]);return _0x3de0af(_0x5c6a85[_0xf5a8('0x12')][_0xf5a8('0x14')]);}logger[_0xf5a8('0x12')](_0xf5a8('0xe'),_0x47d1a6,_0x5c6a85[_0xf5a8('0x12')][_0xf5a8('0x14')]);return _0x44a08e(_0x5c6a85['error'][_0xf5a8('0x14')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x47d1a6,_0xf5a8('0x10'));_0x44a08e(_0x5c6a85['result'][_0xf5a8('0x14')]);}})[_0xf5a8('0x15')](function(_0x3b9f8d){logger[_0xf5a8('0x12')](_0xf5a8('0xe'),_0x47d1a6,_0x3b9f8d);_0x3de0af(_0x3b9f8d);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index fd7623b..2186043 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 _0x43b7=['index','/:id','show','create','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0xa5d9f9,_0x17c6bf){var _0x40e9f6=function(_0x1c2585){while(--_0x1c2585){_0xa5d9f9['push'](_0xa5d9f9['shift']());}};_0x40e9f6(++_0x17c6bf);}(_0x43b7,0x16d));var _0x743b=function(_0x49ec0b,_0x1d58a3){_0x49ec0b=_0x49ec0b-0x0;var _0x449cab=_0x43b7[_0x49ec0b];return _0x449cab;};'use strict';var multer=require(_0x743b('0x0'));var util=require(_0x743b('0x1'));var path=require('path');var timeout=require(_0x743b('0x2'));var express=require(_0x743b('0x3'));var router=express['Router']();var fs_extra=require(_0x743b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x743b('0x5'));var config=require(_0x743b('0x6'));var controller=require('./intFreshdeskField.controller');router[_0x743b('0x7')]('/',auth[_0x743b('0x8')](),controller[_0x743b('0x9')]);router[_0x743b('0x7')](_0x743b('0xa'),auth['isAuthenticated'](),controller[_0x743b('0xb')]);router['post']('/',auth[_0x743b('0x8')](),controller[_0x743b('0xc')]);router['put'](_0x743b('0xa'),auth[_0x743b('0x8')](),controller[_0x743b('0xd')]);router[_0x743b('0xe')](_0x743b('0xa'),auth[_0x743b('0x8')](),controller[_0x743b('0xf')]);module[_0x743b('0x10')]=router; \ No newline at end of file +var _0x512a=['delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','show','post','create','/:id','isAuthenticated','update'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x512a,0x6f));var _0xa512=function(_0x3d5b63,_0x5eb480){_0x3d5b63=_0x3d5b63-0x0;var _0x20fe0e=_0x512a[_0x3d5b63];return _0x20fe0e;};'use strict';var multer=require(_0xa512('0x0'));var util=require(_0xa512('0x1'));var path=require(_0xa512('0x2'));var timeout=require('connect-timeout');var express=require(_0xa512('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa512('0x4'));var interaction=require(_0xa512('0x5'));var config=require(_0xa512('0x6'));var controller=require(_0xa512('0x7'));router[_0xa512('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa512('0x9')]);router[_0xa512('0xa')]('/',auth['isAuthenticated'](),controller[_0xa512('0xb')]);router['put'](_0xa512('0xc'),auth[_0xa512('0xd')](),controller[_0xa512('0xe')]);router[_0xa512('0xf')](_0xa512('0xc'),auth[_0xa512('0xd')](),controller[_0xa512('0x10')]);module[_0xa512('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index c306572..ae897eb 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 _0xff1f=['sequelize','exports','string','variable','customVariable','STRING','ENUM','BOOLEAN'];(function(_0x428aad,_0x98e43b){var _0x3efbf6=function(_0x3abf74){while(--_0x3abf74){_0x428aad['push'](_0x428aad['shift']());}};_0x3efbf6(++_0x98e43b);}(_0xff1f,0x1d8));var _0xfff1=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0xff1f[_0x307d86];return _0x361745;};'use strict';var Sequelize=require(_0xfff1('0x0'));module[_0xfff1('0x1')]={'type':{'type':Sequelize['ENUM'](_0xfff1('0x2'),_0xfff1('0x3'),_0xfff1('0x4'),'keyValue','picklist'),'defaultValue':_0xfff1('0x2')},'content':{'type':Sequelize[_0xfff1('0x5')]},'key':{'type':Sequelize[_0xfff1('0x5')]},'keyType':{'type':Sequelize[_0xfff1('0x6')](_0xfff1('0x2'),'variable',_0xfff1('0x4'))},'keyContent':{'type':Sequelize[_0xfff1('0x5')]},'idField':{'type':Sequelize[_0xfff1('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xfff1('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7619=['STRING','BOOLEAN','ENUM','string','variable','customVariable','picklist'];(function(_0x362192,_0x23dc35){var _0x5b254e=function(_0xeff5c1){while(--_0xeff5c1){_0x362192['push'](_0x362192['shift']());}};_0x5b254e(++_0x23dc35);}(_0x7619,0xc6));var _0x9761=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7619[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x9761('0x0')](_0x9761('0x1'),_0x9761('0x2'),_0x9761('0x3'),'keyValue',_0x9761('0x4')),'defaultValue':_0x9761('0x1')},'content':{'type':Sequelize[_0x9761('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9761('0x0')]('string','variable',_0x9761('0x3'))},'keyContent':{'type':Sequelize[_0x9761('0x5')]},'idField':{'type':Sequelize[_0x9761('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9761('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9761('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index aecd535..324d944 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 _0xf45e=['Content-Range','json','apply','reject','save','destroy','then','sendStatus','stack','index','map','rawAttributes','type','key','model','name','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','FreshdeskField','includeAll','include','findAll','rows','show','params','keys','length','merge','find','create','body','update','catch','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set'];(function(_0xb2083a,_0x2095e7){var _0x3e9cad=function(_0x175ead){while(--_0x175ead){_0xb2083a['push'](_0xb2083a['shift']());}};_0x3e9cad(++_0x2095e7);}(_0xf45e,0x115));var _0xef45=function(_0x2f3ccc,_0x4ce1be){_0x2f3ccc=_0x2f3ccc-0x0;var _0x233521=_0xf45e[_0x2f3ccc];return _0x233521;};'use strict';var emlformat=require(_0xef45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef45('0x2'));var moment=require(_0xef45('0x3'));var BPromise=require(_0xef45('0x4'));var Mustache=require(_0xef45('0x5'));var util=require(_0xef45('0x6'));var path=require(_0xef45('0x7'));var sox=require(_0xef45('0x8'));var csv=require(_0xef45('0x9'));var ejs=require(_0xef45('0xa'));var fs=require('fs');var fs_extra=require(_0xef45('0xb'));var _=require(_0xef45('0xc'));var squel=require(_0xef45('0xd'));var crypto=require(_0xef45('0xe'));var jsforce=require(_0xef45('0xf'));var deskjs=require(_0xef45('0x10'));var toCsv=require(_0xef45('0x9'));var querystring=require(_0xef45('0x11'));var Papa=require(_0xef45('0x12'));var Redis=require(_0xef45('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xef45('0x14'));var as=require(_0xef45('0x15'));var hardwareService=require(_0xef45('0x16'));var logger=require(_0xef45('0x17'))(_0xef45('0x18'));var utils=require(_0xef45('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xef45('0x1a'));var db=require(_0xef45('0x1b'))['db'];function respondWithStatusCode(_0x30babb,_0x433be9){_0x433be9=_0x433be9||0xcc;return function(_0x476739){if(_0x476739){return _0x30babb['sendStatus'](_0x433be9);}return _0x30babb['status'](_0x433be9)[_0xef45('0x1c')]();};}function respondWithResult(_0x47fd96,_0x2ae89a){_0x2ae89a=_0x2ae89a||0xc8;return function(_0xb0fc43){if(_0xb0fc43){return _0x47fd96[_0xef45('0x1d')](_0x2ae89a)['json'](_0xb0fc43);}};}function respondWithFilteredResult(_0x5b3136,_0x29c0c4){return function(_0x5530e6){if(_0x5530e6){var _0x11cd3a=typeof _0x29c0c4[_0xef45('0x1e')]===_0xef45('0x1f')&&typeof _0x29c0c4[_0xef45('0x20')]==='undefined';var _0x560b2f=_0x5530e6[_0xef45('0x21')];var _0x219778=_0x11cd3a?0x0:_0x29c0c4[_0xef45('0x1e')];var _0x258785=_0x11cd3a?_0x5530e6['count']:_0x29c0c4['offset']+_0x29c0c4[_0xef45('0x20')];var _0x20ef26;if(_0x258785>=_0x560b2f){_0x258785=_0x560b2f;_0x20ef26=0xc8;}else{_0x20ef26=0xce;}_0x5b3136[_0xef45('0x1d')](_0x20ef26);return _0x5b3136[_0xef45('0x22')](_0xef45('0x23'),_0x219778+'-'+_0x258785+'/'+_0x560b2f)[_0xef45('0x24')](_0x5530e6);}return null;};}function patchUpdates(_0x375cbd){return function(_0x4a6217){try{jsonpatch[_0xef45('0x25')](_0x4a6217,_0x375cbd,!![]);}catch(_0x3e2a47){return BPromise[_0xef45('0x26')](_0x3e2a47);}return _0x4a6217[_0xef45('0x27')]();};}function saveUpdates(_0x27322f,_0x5205bf){return function(_0x40abc8){if(_0x40abc8){return _0x40abc8['update'](_0x27322f)['then'](function(_0x7707a1){return _0x7707a1;});}return null;};}function removeEntity(_0x2b41d8,_0xbb859b){return function(_0x7817d0){if(_0x7817d0){return _0x7817d0[_0xef45('0x28')]()[_0xef45('0x29')](function(){_0x2b41d8[_0xef45('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x208b35,_0x5f0593){return function(_0x38b470){if(!_0x38b470){_0x208b35[_0xef45('0x2a')](0x194);}return _0x38b470;};}function handleError(_0x578f03,_0x46e423){_0x46e423=_0x46e423||0x1f4;return function(_0x2c356d){logger['error'](_0x2c356d[_0xef45('0x2b')]);if(_0x2c356d['name']){delete _0x2c356d['name'];}_0x578f03['status'](_0x46e423)['send'](_0x2c356d);};}exports[_0xef45('0x2c')]=function(_0x2f72ef,_0x217e8d){var _0x15ad38={},_0x5782d0={},_0x18f304={'count':0x0,'rows':[]};var _0x4f028c=_[_0xef45('0x2d')](db['FreshdeskField'][_0xef45('0x2e')],function(_0x5bfd2d){return{'name':_0x5bfd2d['fieldName'],'type':_0x5bfd2d[_0xef45('0x2f')][_0xef45('0x30')]};});_0x5782d0[_0xef45('0x31')]=_[_0xef45('0x2d')](_0x4f028c,_0xef45('0x32'));_0x5782d0['query']=_['keys'](_0x2f72ef['query']);_0x5782d0[_0xef45('0x33')]=_[_0xef45('0x34')](_0x5782d0[_0xef45('0x31')],_0x5782d0[_0xef45('0x35')]);_0x15ad38[_0xef45('0x36')]=_[_0xef45('0x34')](_0x5782d0[_0xef45('0x31')],qs['fields'](_0x2f72ef['query'][_0xef45('0x37')]));_0x15ad38['attributes']=_0x15ad38[_0xef45('0x36')]['length']?_0x15ad38[_0xef45('0x36')]:_0x5782d0[_0xef45('0x31')];if(!_0x2f72ef[_0xef45('0x35')][_0xef45('0x38')](_0xef45('0x39'))){_0x15ad38['limit']=qs[_0xef45('0x20')](_0x2f72ef[_0xef45('0x35')][_0xef45('0x20')]);_0x15ad38['offset']=qs['offset'](_0x2f72ef[_0xef45('0x35')][_0xef45('0x1e')]);}_0x15ad38['order']=qs[_0xef45('0x3a')](_0x2f72ef['query']['sort']);_0x15ad38[_0xef45('0x3b')]=qs[_0xef45('0x33')](_[_0xef45('0x3c')](_0x2f72ef['query'],_0x5782d0[_0xef45('0x33')]),_0x4f028c);if(_0x2f72ef[_0xef45('0x35')][_0xef45('0x3d')]){_0x15ad38[_0xef45('0x3b')]=_['merge'](_0x15ad38['where'],{'$or':_[_0xef45('0x2d')](_0x4f028c,function(_0x474be1){if(_0x474be1[_0xef45('0x2f')]!==_0xef45('0x3e')){var _0x269a11={};_0x269a11[_0x474be1[_0xef45('0x32')]]={'$like':'%'+_0x2f72ef[_0xef45('0x35')][_0xef45('0x3d')]+'%'};return _0x269a11;}})});}_0x15ad38=_['merge']({},_0x15ad38,_0x2f72ef['options']);var _0x13f8b2={'where':_0x15ad38[_0xef45('0x3b')]};return db[_0xef45('0x3f')][_0xef45('0x21')](_0x13f8b2)[_0xef45('0x29')](function(_0x3bcada){_0x18f304[_0xef45('0x21')]=_0x3bcada;if(_0x2f72ef[_0xef45('0x35')][_0xef45('0x40')]){_0x15ad38[_0xef45('0x41')]=[{'all':!![]}];}return db[_0xef45('0x3f')][_0xef45('0x42')](_0x15ad38);})[_0xef45('0x29')](function(_0xd7d217){_0x18f304[_0xef45('0x43')]=_0xd7d217;return _0x18f304;})[_0xef45('0x29')](respondWithFilteredResult(_0x217e8d,_0x15ad38))['catch'](handleError(_0x217e8d,null));};exports[_0xef45('0x44')]=function(_0x5bdfad,_0x1b9d45){var _0x82c123={'raw':!![],'where':{'id':_0x5bdfad[_0xef45('0x45')]['id']}},_0x54ccb8={};_0x54ccb8['model']=_[_0xef45('0x46')](db['FreshdeskField'][_0xef45('0x2e')]);_0x54ccb8[_0xef45('0x35')]=_[_0xef45('0x46')](_0x5bdfad[_0xef45('0x35')]);_0x54ccb8[_0xef45('0x33')]=_[_0xef45('0x34')](_0x54ccb8[_0xef45('0x31')],_0x54ccb8['query']);_0x82c123[_0xef45('0x36')]=_[_0xef45('0x34')](_0x54ccb8[_0xef45('0x31')],qs[_0xef45('0x37')](_0x5bdfad[_0xef45('0x35')][_0xef45('0x37')]));_0x82c123[_0xef45('0x36')]=_0x82c123[_0xef45('0x36')][_0xef45('0x47')]?_0x82c123[_0xef45('0x36')]:_0x54ccb8[_0xef45('0x31')];if(_0x5bdfad[_0xef45('0x35')][_0xef45('0x40')]){_0x82c123[_0xef45('0x41')]=[{'all':!![]}];}_0x82c123=_[_0xef45('0x48')]({},_0x82c123,_0x5bdfad['options']);return db[_0xef45('0x3f')][_0xef45('0x49')](_0x82c123)[_0xef45('0x29')](handleEntityNotFound(_0x1b9d45,null))['then'](respondWithResult(_0x1b9d45,null))['catch'](handleError(_0x1b9d45,null));};exports['create']=function(_0x29aeab,_0x18143c){return db[_0xef45('0x3f')][_0xef45('0x4a')](_0x29aeab[_0xef45('0x4b')],{})[_0xef45('0x29')](respondWithResult(_0x18143c,0xc9))['catch'](handleError(_0x18143c,null));};exports[_0xef45('0x4c')]=function(_0x463796,_0x2b2419){if(_0x463796['body']['id']){delete _0x463796['body']['id'];}return db[_0xef45('0x3f')][_0xef45('0x49')]({'where':{'id':_0x463796['params']['id']}})[_0xef45('0x29')](handleEntityNotFound(_0x2b2419,null))[_0xef45('0x29')](saveUpdates(_0x463796[_0xef45('0x4b')],null))[_0xef45('0x29')](respondWithResult(_0x2b2419,null))[_0xef45('0x4d')](handleError(_0x2b2419,null));};exports[_0xef45('0x28')]=function(_0x23581f,_0xfa5fdd){return db[_0xef45('0x3f')][_0xef45('0x49')]({'where':{'id':_0x23581f[_0xef45('0x45')]['id']}})[_0xef45('0x29')](handleEntityNotFound(_0xfa5fdd,null))[_0xef45('0x29')](removeEntity(_0xfa5fdd,null))[_0xef45('0x4d')](handleError(_0xfa5fdd,null));}; \ No newline at end of file +var _0xcea2=['undefined','limit','count','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','VIRTUAL','filter','merge','options','where','FreshdeskField','includeAll','include','findAll','rows','catch','params','length','find','create','body','update','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x1e279b,_0x13418c){var _0x178479=function(_0x12e15e){while(--_0x12e15e){_0x1e279b['push'](_0x1e279b['shift']());}};_0x178479(++_0x13418c);}(_0xcea2,0x15a));var _0x2cea=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xcea2[_0x122096];return _0x3d1966;};'use strict';var emlformat=require(_0x2cea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2cea('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2cea('0x2'));var moment=require(_0x2cea('0x3'));var BPromise=require(_0x2cea('0x4'));var Mustache=require('mustache');var util=require(_0x2cea('0x5'));var path=require(_0x2cea('0x6'));var sox=require(_0x2cea('0x7'));var csv=require('to-csv');var ejs=require(_0x2cea('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2cea('0x9'));var squel=require(_0x2cea('0xa'));var crypto=require(_0x2cea('0xb'));var jsforce=require(_0x2cea('0xc'));var deskjs=require(_0x2cea('0xd'));var toCsv=require(_0x2cea('0xe'));var querystring=require('querystring');var Papa=require(_0x2cea('0xf'));var Redis=require(_0x2cea('0x10'));var authService=require(_0x2cea('0x11'));var qs=require(_0x2cea('0x12'));var as=require(_0x2cea('0x13'));var hardwareService=require(_0x2cea('0x14'));var logger=require(_0x2cea('0x15'))(_0x2cea('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2cea('0x17'));var db=require(_0x2cea('0x18'))['db'];function respondWithStatusCode(_0x528c1d,_0x4bd265){_0x4bd265=_0x4bd265||0xcc;return function(_0x160eaf){if(_0x160eaf){return _0x528c1d['sendStatus'](_0x4bd265);}return _0x528c1d[_0x2cea('0x19')](_0x4bd265)[_0x2cea('0x1a')]();};}function respondWithResult(_0x4377b1,_0x5cf805){_0x5cf805=_0x5cf805||0xc8;return function(_0x4d7f8b){if(_0x4d7f8b){return _0x4377b1['status'](_0x5cf805)[_0x2cea('0x1b')](_0x4d7f8b);}};}function respondWithFilteredResult(_0x586ad5,_0x3c7130){return function(_0x338669){if(_0x338669){var _0x981e3f=typeof _0x3c7130[_0x2cea('0x1c')]===_0x2cea('0x1d')&&typeof _0x3c7130[_0x2cea('0x1e')]===_0x2cea('0x1d');var _0x1ead4c=_0x338669['count'];var _0x19927a=_0x981e3f?0x0:_0x3c7130[_0x2cea('0x1c')];var _0x20c46c=_0x981e3f?_0x338669[_0x2cea('0x1f')]:_0x3c7130[_0x2cea('0x1c')]+_0x3c7130[_0x2cea('0x1e')];var _0x5d75c4;if(_0x20c46c>=_0x1ead4c){_0x20c46c=_0x1ead4c;_0x5d75c4=0xc8;}else{_0x5d75c4=0xce;}_0x586ad5[_0x2cea('0x19')](_0x5d75c4);return _0x586ad5['set'](_0x2cea('0x20'),_0x19927a+'-'+_0x20c46c+'/'+_0x1ead4c)[_0x2cea('0x1b')](_0x338669);}return null;};}function patchUpdates(_0xa73bea){return function(_0x4fd3d5){try{jsonpatch[_0x2cea('0x21')](_0x4fd3d5,_0xa73bea,!![]);}catch(_0x22249e){return BPromise[_0x2cea('0x22')](_0x22249e);}return _0x4fd3d5[_0x2cea('0x23')]();};}function saveUpdates(_0x3246bc,_0x3f6f0e){return function(_0x10f13a){if(_0x10f13a){return _0x10f13a['update'](_0x3246bc)[_0x2cea('0x24')](function(_0x5e5b46){return _0x5e5b46;});}return null;};}function removeEntity(_0x7d88b9,_0x4926ff){return function(_0x3966d5){if(_0x3966d5){return _0x3966d5[_0x2cea('0x25')]()['then'](function(){_0x7d88b9[_0x2cea('0x19')](0xcc)[_0x2cea('0x1a')]();});}};}function handleEntityNotFound(_0x101314,_0xf0bfbe){return function(_0x3f3ee0){if(!_0x3f3ee0){_0x101314[_0x2cea('0x26')](0x194);}return _0x3f3ee0;};}function handleError(_0x5d032f,_0x4ec9b3){_0x4ec9b3=_0x4ec9b3||0x1f4;return function(_0x32b6a3){logger[_0x2cea('0x27')](_0x32b6a3[_0x2cea('0x28')]);if(_0x32b6a3[_0x2cea('0x29')]){delete _0x32b6a3[_0x2cea('0x29')];}_0x5d032f[_0x2cea('0x19')](_0x4ec9b3)[_0x2cea('0x2a')](_0x32b6a3);};}exports['index']=function(_0xff69ad,_0x128863){var _0x5f3fb4={},_0xfeb8bd={},_0xc398c5={'count':0x0,'rows':[]};var _0x271b2f=_[_0x2cea('0x2b')](db['FreshdeskField'][_0x2cea('0x2c')],function(_0x128934){return{'name':_0x128934['fieldName'],'type':_0x128934[_0x2cea('0x2d')][_0x2cea('0x2e')]};});_0xfeb8bd[_0x2cea('0x2f')]=_[_0x2cea('0x2b')](_0x271b2f,_0x2cea('0x29'));_0xfeb8bd[_0x2cea('0x30')]=_[_0x2cea('0x31')](_0xff69ad[_0x2cea('0x30')]);_0xfeb8bd[_0x2cea('0x32')]=_[_0x2cea('0x33')](_0xfeb8bd[_0x2cea('0x2f')],_0xfeb8bd['query']);_0x5f3fb4[_0x2cea('0x34')]=_[_0x2cea('0x33')](_0xfeb8bd[_0x2cea('0x2f')],qs[_0x2cea('0x35')](_0xff69ad['query']['fields']));_0x5f3fb4[_0x2cea('0x34')]=_0x5f3fb4[_0x2cea('0x34')]['length']?_0x5f3fb4[_0x2cea('0x34')]:_0xfeb8bd['model'];if(!_0xff69ad[_0x2cea('0x30')]['hasOwnProperty'](_0x2cea('0x36'))){_0x5f3fb4['limit']=qs[_0x2cea('0x1e')](_0xff69ad[_0x2cea('0x30')]['limit']);_0x5f3fb4[_0x2cea('0x1c')]=qs[_0x2cea('0x1c')](_0xff69ad['query'][_0x2cea('0x1c')]);}_0x5f3fb4[_0x2cea('0x37')]=qs[_0x2cea('0x38')](_0xff69ad[_0x2cea('0x30')][_0x2cea('0x38')]);_0x5f3fb4['where']=qs[_0x2cea('0x32')](_[_0x2cea('0x39')](_0xff69ad['query'],_0xfeb8bd['filters']),_0x271b2f);if(_0xff69ad[_0x2cea('0x30')]['filter']){_0x5f3fb4['where']=_['merge'](_0x5f3fb4['where'],{'$or':_[_0x2cea('0x2b')](_0x271b2f,function(_0xb5b358){if(_0xb5b358['type']!==_0x2cea('0x3a')){var _0x3e0683={};_0x3e0683[_0xb5b358[_0x2cea('0x29')]]={'$like':'%'+_0xff69ad['query'][_0x2cea('0x3b')]+'%'};return _0x3e0683;}})});}_0x5f3fb4=_[_0x2cea('0x3c')]({},_0x5f3fb4,_0xff69ad[_0x2cea('0x3d')]);var _0x37d175={'where':_0x5f3fb4[_0x2cea('0x3e')]};return db[_0x2cea('0x3f')][_0x2cea('0x1f')](_0x37d175)[_0x2cea('0x24')](function(_0x2cfa0e){_0xc398c5[_0x2cea('0x1f')]=_0x2cfa0e;if(_0xff69ad[_0x2cea('0x30')][_0x2cea('0x40')]){_0x5f3fb4[_0x2cea('0x41')]=[{'all':!![]}];}return db[_0x2cea('0x3f')][_0x2cea('0x42')](_0x5f3fb4);})[_0x2cea('0x24')](function(_0x36efa8){_0xc398c5[_0x2cea('0x43')]=_0x36efa8;return _0xc398c5;})['then'](respondWithFilteredResult(_0x128863,_0x5f3fb4))[_0x2cea('0x44')](handleError(_0x128863,null));};exports['show']=function(_0x29ab58,_0x1afbb9){var _0x22ce6b={'raw':!![],'where':{'id':_0x29ab58[_0x2cea('0x45')]['id']}},_0x5b5d71={};_0x5b5d71[_0x2cea('0x2f')]=_[_0x2cea('0x31')](db[_0x2cea('0x3f')][_0x2cea('0x2c')]);_0x5b5d71[_0x2cea('0x30')]=_['keys'](_0x29ab58['query']);_0x5b5d71[_0x2cea('0x32')]=_[_0x2cea('0x33')](_0x5b5d71['model'],_0x5b5d71[_0x2cea('0x30')]);_0x22ce6b['attributes']=_[_0x2cea('0x33')](_0x5b5d71['model'],qs[_0x2cea('0x35')](_0x29ab58[_0x2cea('0x30')][_0x2cea('0x35')]));_0x22ce6b[_0x2cea('0x34')]=_0x22ce6b[_0x2cea('0x34')][_0x2cea('0x46')]?_0x22ce6b[_0x2cea('0x34')]:_0x5b5d71[_0x2cea('0x2f')];if(_0x29ab58[_0x2cea('0x30')][_0x2cea('0x40')]){_0x22ce6b['include']=[{'all':!![]}];}_0x22ce6b=_[_0x2cea('0x3c')]({},_0x22ce6b,_0x29ab58[_0x2cea('0x3d')]);return db[_0x2cea('0x3f')][_0x2cea('0x47')](_0x22ce6b)['then'](handleEntityNotFound(_0x1afbb9,null))['then'](respondWithResult(_0x1afbb9,null))[_0x2cea('0x44')](handleError(_0x1afbb9,null));};exports[_0x2cea('0x48')]=function(_0xd922c6,_0x510e0f){return db[_0x2cea('0x3f')][_0x2cea('0x48')](_0xd922c6[_0x2cea('0x49')],{})[_0x2cea('0x24')](respondWithResult(_0x510e0f,0xc9))['catch'](handleError(_0x510e0f,null));};exports[_0x2cea('0x4a')]=function(_0x526e92,_0x4d1b77){if(_0x526e92[_0x2cea('0x49')]['id']){delete _0x526e92[_0x2cea('0x49')]['id'];}return db[_0x2cea('0x3f')][_0x2cea('0x47')]({'where':{'id':_0x526e92['params']['id']}})['then'](handleEntityNotFound(_0x4d1b77,null))[_0x2cea('0x24')](saveUpdates(_0x526e92[_0x2cea('0x49')],null))[_0x2cea('0x24')](respondWithResult(_0x4d1b77,null))[_0x2cea('0x44')](handleError(_0x4d1b77,null));};exports['destroy']=function(_0x4ec462,_0x5d7cb6){return db[_0x2cea('0x3f')][_0x2cea('0x47')]({'where':{'id':_0x4ec462[_0x2cea('0x45')]['id']}})[_0x2cea('0x24')](handleEntityNotFound(_0x5d7cb6,null))[_0x2cea('0x24')](removeEntity(_0x5d7cb6,null))[_0x2cea('0x44')](handleError(_0x5d7cb6,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 59fce2e..6bc6512 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 _0x6726=['../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','util','../../config/logger','moment','bluebird','path'];(function(_0x3b8371,_0xfa8ed9){var _0x1a4c76=function(_0x3a1f24){while(--_0x3a1f24){_0x3b8371['push'](_0x3b8371['shift']());}};_0x1a4c76(++_0xfa8ed9);}(_0x6726,0xdb));var _0x6672=function(_0x7cb10c,_0x2fcc3a){_0x7cb10c=_0x7cb10c-0x0;var _0x11df59=_0x6726[_0x7cb10c];return _0x11df59;};'use strict';var _=require('lodash');var util=require(_0x6672('0x0'));var logger=require(_0x6672('0x1'))('api');var moment=require(_0x6672('0x2'));var BPromise=require(_0x6672('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6672('0x4'));var rimraf=require('rimraf');var config=require(_0x6672('0x5'));var attributes=require(_0x6672('0x6'));module[_0x6672('0x7')]=function(_0x40ba7e,_0x5701b9){return _0x40ba7e[_0x6672('0x8')](_0x6672('0x9'),attributes,{'tableName':_0x6672('0xa'),'paranoid':![],'indexes':[{'name':_0x6672('0xb'),'fields':[_0x6672('0xc'),_0x6672('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb9bb=['idField','FieldId','../../config/logger','api','path','./intFreshdeskField.attributes','exports','FreshdeskField','freshdesk_unique_index'];(function(_0x25efd2,_0x22ff9d){var _0x507e82=function(_0x2dfc38){while(--_0x2dfc38){_0x25efd2['push'](_0x25efd2['shift']());}};_0x507e82(++_0x22ff9d);}(_0xb9bb,0xa4));var _0xbb9b=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb9bb[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbb9b('0x0'))(_0xbb9b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb9b('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbb9b('0x3'));module[_0xbb9b('0x4')]=function(_0x1afa70,_0x224710){return _0x1afa70['define'](_0xbb9b('0x5'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xbb9b('0x6'),'fields':[_0xbb9b('0x7'),_0xbb9b('0x8')],'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 f9d64a9..0c39e5c 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 _0x2dcd=['error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','http','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x50b3fa,_0x322c75){var _0x3318fe=function(_0x316bd5){while(--_0x316bd5){_0x50b3fa['push'](_0x50b3fa['shift']());}};_0x3318fe(++_0x322c75);}(_0x2dcd,0xb3));var _0xd2dc=function(_0x53afe9,_0x2c9f40){_0x53afe9=_0x53afe9-0x0;var _0x396396=_0x2dcd[_0x53afe9];return _0x396396;};'use strict';var _=require(_0xd2dc('0x0'));var util=require(_0xd2dc('0x1'));var moment=require(_0xd2dc('0x2'));var BPromise=require(_0xd2dc('0x3'));var rs=require(_0xd2dc('0x4'));var fs=require('fs');var Redis=require(_0xd2dc('0x5'));var db=require(_0xd2dc('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd2dc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x149254,_0x1f6da8,_0x492296){return new BPromise(function(_0x21b594,_0x20a737){return client['request'](_0x149254,_0x492296)[_0xd2dc('0x8')](function(_0x526744){logger[_0xd2dc('0x9')](_0xd2dc('0xa'),_0x1f6da8,'request\x20sent');logger['debug'](_0xd2dc('0xb'),_0x1f6da8,_0xd2dc('0xc'),JSON['stringify'](_0x526744));if(_0x526744[_0xd2dc('0xd')]){if(_0x526744['error'][_0xd2dc('0xe')]===0x1f4){logger['error'](_0xd2dc('0xa'),_0x1f6da8,_0x526744['error']['message']);return _0x20a737(_0x526744[_0xd2dc('0xd')][_0xd2dc('0xf')]);}logger[_0xd2dc('0xd')](_0xd2dc('0xa'),_0x1f6da8,_0x526744[_0xd2dc('0xd')]['message']);return _0x21b594(_0x526744[_0xd2dc('0xd')]['message']);}else{logger[_0xd2dc('0x9')]('FreshdeskField,\x20%s,\x20%s',_0x1f6da8,_0xd2dc('0xc'));_0x21b594(_0x526744['result'][_0xd2dc('0xf')]);}})['catch'](function(_0x1c9bfa){logger[_0xd2dc('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x1f6da8,_0x1c9bfa);_0x20a737(_0x1c9bfa);});});} \ No newline at end of file +var _0x5c18=['stringify','code','error','FreshdeskField,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','debug','FreshdeskField,\x20%s,\x20%s,\x20%s'];(function(_0x2962d5,_0x38deda){var _0x273406=function(_0x3e0775){while(--_0x3e0775){_0x2962d5['push'](_0x2962d5['shift']());}};_0x273406(++_0x38deda);}(_0x5c18,0x1bd));var _0x85c1=function(_0x5d3f26,_0x57b395){_0x5d3f26=_0x5d3f26-0x0;var _0x59dec7=_0x5c18[_0x5d3f26];return _0x59dec7;};'use strict';var _=require(_0x85c1('0x0'));var util=require('util');var moment=require(_0x85c1('0x1'));var BPromise=require(_0x85c1('0x2'));var rs=require(_0x85c1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x85c1('0x4'))['db'];var utils=require(_0x85c1('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x85c1('0x6'));var jayson=require(_0x85c1('0x7'));var client=jayson[_0x85c1('0x8')][_0x85c1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe25565,_0x4ee056,_0x106933){return new BPromise(function(_0x3c0644,_0x293eda){return client[_0x85c1('0xa')](_0xe25565,_0x106933)[_0x85c1('0xb')](function(_0x456318){logger[_0x85c1('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x4ee056,'request\x20sent');logger[_0x85c1('0xd')](_0x85c1('0xe'),_0x4ee056,'request\x20sent',JSON[_0x85c1('0xf')](_0x456318));if(_0x456318['error']){if(_0x456318['error'][_0x85c1('0x10')]===0x1f4){logger[_0x85c1('0x11')](_0x85c1('0x12'),_0x4ee056,_0x456318['error'][_0x85c1('0x13')]);return _0x293eda(_0x456318[_0x85c1('0x11')][_0x85c1('0x13')]);}logger[_0x85c1('0x11')](_0x85c1('0x12'),_0x4ee056,_0x456318['error']['message']);return _0x3c0644(_0x456318[_0x85c1('0x11')]['message']);}else{logger[_0x85c1('0xc')](_0x85c1('0x12'),_0x4ee056,_0x85c1('0x14'));_0x3c0644(_0x456318[_0x85c1('0x15')]['message']);}})[_0x85c1('0x16')](function(_0x3a09a2){logger[_0x85c1('0x11')](_0x85c1('0x12'),_0x4ee056,_0x3a09a2);_0x293eda(_0x3a09a2);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index f798e4f..e7a0333 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 _0x34b7=['getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x34b7,0x196));var _0x734b=function(_0x2dc367,_0x591c8a){_0x2dc367=_0x2dc367-0x0;var _0x14845a=_0x34b7[_0x2dc367];return _0x14845a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x734b('0x0'));var timeout=require(_0x734b('0x1'));var express=require(_0x734b('0x2'));var router=express[_0x734b('0x3')]();var fs_extra=require(_0x734b('0x4'));var auth=require(_0x734b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x734b('0x6'));router[_0x734b('0x7')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x9')]);router[_0x734b('0x7')](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xb')]);router[_0x734b('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x734b('0x7')]('/:id/fields',auth[_0x734b('0x8')](),controller[_0x734b('0xc')]);router[_0x734b('0xd')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0xe')]);router[_0x734b('0xd')](_0x734b('0xf'),auth[_0x734b('0x8')](),controller[_0x734b('0x10')]);router[_0x734b('0x11')](_0x734b('0xa'),auth[_0x734b('0x8')](),controller[_0x734b('0x12')]);router[_0x734b('0x13')]('/:id',auth[_0x734b('0x8')](),controller[_0x734b('0x14')]);module[_0x734b('0x15')]=router; \ No newline at end of file +var _0xf7b4=['destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','put','update'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xf7b4,0x152));var _0x4f7b=function(_0x2d304b,_0x331dc7){_0x2d304b=_0x2d304b-0x0;var _0x203f1b=_0xf7b4[_0x2d304b];return _0x203f1b;};'use strict';var multer=require(_0x4f7b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f7b('0x1'));var express=require(_0x4f7b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4f7b('0x3'));var interaction=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var controller=require(_0x4f7b('0x6'));router[_0x4f7b('0x7')]('/',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x9')]);router[_0x4f7b('0x7')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xb')]);router[_0x4f7b('0x7')](_0x4f7b('0xc'),auth['isAuthenticated'](),controller[_0x4f7b('0xd')]);router[_0x4f7b('0x7')]('/:id/fields',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xe')]);router[_0x4f7b('0xf')]('/',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x10')]);router['post'](_0x4f7b('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x4f7b('0x11')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x12')]);router['delete'](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x13')]);module[_0x4f7b('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index fefd4c9..35b593c 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 _0xd4a2=['STRING','username','sequelize'];(function(_0x5573df,_0x41ca00){var _0x144c6c=function(_0x4bae02){while(--_0x4bae02){_0x5573df['push'](_0x5573df['shift']());}};_0x144c6c(++_0x41ca00);}(_0xd4a2,0x173));var _0x2d4a=function(_0x13aec3,_0x290058){_0x13aec3=_0x13aec3-0x0;var _0x5f2a2a=_0xd4a2[_0x13aec3];return _0x5f2a2a;};'use strict';var Sequelize=require(_0x2d4a('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2d4a('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x2d4a('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2d4a('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x2d4a('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x5430=['STRING','username','remoteUri','sequelize','exports'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x5430,0x10c));var _0x0543=function(_0x253e0b,_0x419e52){_0x253e0b=_0x253e0b-0x0;var _0x1ddb36=_0x5430[_0x253e0b];return _0x1ddb36;};'use strict';var Sequelize=require(_0x0543('0x0'));module[_0x0543('0x1')]={'name':{'type':Sequelize[_0x0543('0x2')]},'description':{'type':Sequelize[_0x0543('0x2')]},'username':{'type':Sequelize[_0x0543('0x2')],'unique':_0x0543('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x0543('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 3725ffc..d7f518e 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 _0x1f92=['ioredis','../../components/parsers/qs','../../config/logger','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','update','then','destroy','error','stack','name','send','index','rawAttributes','type','map','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','FreshsalesAccount','findAll','catch','params','length','includeAll','include','find','create','body','getConfigurations','pick','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','format','/api/selector/owners','Token\x20token=','users','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1f92,0xb7));var _0x21f9=function(_0x16f009,_0xc3f705){_0x16f009=_0x16f009-0x0;var _0x1fca13=_0x1f92[_0x16f009];return _0x1fca13;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21f9('0x0'));var zipdir=require(_0x21f9('0x1'));var jsonpatch=require(_0x21f9('0x2'));var rp=require(_0x21f9('0x3'));var moment=require('moment');var BPromise=require(_0x21f9('0x4'));var Mustache=require(_0x21f9('0x5'));var util=require('util');var path=require('path');var sox=require(_0x21f9('0x6'));var csv=require(_0x21f9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x21f9('0x8'));var squel=require('squel');var crypto=require(_0x21f9('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x21f9('0xa'));var toCsv=require('to-csv');var querystring=require(_0x21f9('0xb'));var Papa=require(_0x21f9('0xc'));var Redis=require(_0x21f9('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x21f9('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x21f9('0xf'))(_0x21f9('0x10'));var utils=require(_0x21f9('0x11'));var config=require(_0x21f9('0x12'));var licenseUtil=require(_0x21f9('0x13'));var db=require(_0x21f9('0x14'))['db'];var integrations=require(_0x21f9('0x15'));function respondWithStatusCode(_0x259b5e,_0x27ae91){_0x27ae91=_0x27ae91||0xcc;return function(_0x4fc881){if(_0x4fc881){return _0x259b5e[_0x21f9('0x16')](_0x27ae91);}return _0x259b5e[_0x21f9('0x17')](_0x27ae91)[_0x21f9('0x18')]();};}function respondWithResult(_0x3f14ac,_0xe469c6){_0xe469c6=_0xe469c6||0xc8;return function(_0x10d1a5){if(_0x10d1a5){return _0x3f14ac['status'](_0xe469c6)[_0x21f9('0x19')](_0x10d1a5);}};}function respondWithFilteredResult(_0x2a3ade,_0x3be50e){return function(_0x1fae57){if(_0x1fae57){var _0x17b043=typeof _0x3be50e[_0x21f9('0x1a')]===_0x21f9('0x1b')&&typeof _0x3be50e[_0x21f9('0x1c')]===_0x21f9('0x1b');var _0x1311e4=_0x1fae57[_0x21f9('0x1d')];var _0x5d91a8=_0x17b043?0x0:_0x3be50e[_0x21f9('0x1a')];var _0x59cfb6=_0x17b043?_0x1fae57[_0x21f9('0x1d')]:_0x3be50e[_0x21f9('0x1a')]+_0x3be50e[_0x21f9('0x1c')];var _0xa01a14;if(_0x59cfb6>=_0x1311e4){_0x59cfb6=_0x1311e4;_0xa01a14=0xc8;}else{_0xa01a14=0xce;}_0x2a3ade[_0x21f9('0x17')](_0xa01a14);return _0x2a3ade[_0x21f9('0x1e')](_0x21f9('0x1f'),_0x5d91a8+'-'+_0x59cfb6+'/'+_0x1311e4)[_0x21f9('0x19')](_0x1fae57);}return null;};}function patchUpdates(_0x3f03a4){return function(_0x29afef){try{jsonpatch[_0x21f9('0x20')](_0x29afef,_0x3f03a4,!![]);}catch(_0x52e239){return BPromise[_0x21f9('0x21')](_0x52e239);}return _0x29afef[_0x21f9('0x22')]();};}function saveUpdates(_0x2d2201,_0x5e787b){return function(_0x57fba3){if(_0x57fba3){return _0x57fba3[_0x21f9('0x23')](_0x2d2201)[_0x21f9('0x24')](function(_0x436a38){return _0x436a38;});}return null;};}function removeEntity(_0x3377f4,_0x2e1c4e){return function(_0x561a52){if(_0x561a52){return _0x561a52[_0x21f9('0x25')]()[_0x21f9('0x24')](function(){_0x3377f4[_0x21f9('0x17')](0xcc)[_0x21f9('0x18')]();});}};}function handleEntityNotFound(_0x184d77,_0x12bf2d){return function(_0x2c41d0){if(!_0x2c41d0){_0x184d77[_0x21f9('0x16')](0x194);}return _0x2c41d0;};}function handleError(_0x233ed8,_0x4989e6){_0x4989e6=_0x4989e6||0x1f4;return function(_0x38dced){logger[_0x21f9('0x26')](_0x38dced[_0x21f9('0x27')]);if(_0x38dced[_0x21f9('0x28')]){delete _0x38dced['name'];}_0x233ed8['status'](_0x4989e6)[_0x21f9('0x29')](_0x38dced);};}exports[_0x21f9('0x2a')]=function(_0x134e86,_0x20ea3b){var _0x31d352={},_0x1311d0={},_0xfd8585={'count':0x0,'rows':[]};var _0x5b01e8=_['map'](db['FreshsalesAccount'][_0x21f9('0x2b')],function(_0x254dc7){return{'name':_0x254dc7['fieldName'],'type':_0x254dc7[_0x21f9('0x2c')]['key']};});_0x1311d0['model']=_[_0x21f9('0x2d')](_0x5b01e8,_0x21f9('0x28'));_0x1311d0['query']=_[_0x21f9('0x2e')](_0x134e86[_0x21f9('0x2f')]);_0x1311d0[_0x21f9('0x30')]=_[_0x21f9('0x31')](_0x1311d0[_0x21f9('0x32')],_0x1311d0[_0x21f9('0x2f')]);_0x31d352[_0x21f9('0x33')]=_[_0x21f9('0x31')](_0x1311d0[_0x21f9('0x32')],qs[_0x21f9('0x34')](_0x134e86[_0x21f9('0x2f')][_0x21f9('0x34')]));_0x31d352[_0x21f9('0x33')]=_0x31d352[_0x21f9('0x33')]['length']?_0x31d352['attributes']:_0x1311d0[_0x21f9('0x32')];if(!_0x134e86['query'][_0x21f9('0x35')](_0x21f9('0x36'))){_0x31d352[_0x21f9('0x1c')]=qs['limit'](_0x134e86[_0x21f9('0x2f')][_0x21f9('0x1c')]);_0x31d352[_0x21f9('0x1a')]=qs[_0x21f9('0x1a')](_0x134e86[_0x21f9('0x2f')]['offset']);}_0x31d352[_0x21f9('0x37')]=qs[_0x21f9('0x38')](_0x134e86[_0x21f9('0x2f')][_0x21f9('0x38')]);_0x31d352['where']=qs[_0x21f9('0x30')](_['pick'](_0x134e86[_0x21f9('0x2f')],_0x1311d0[_0x21f9('0x30')]),_0x5b01e8);if(_0x134e86[_0x21f9('0x2f')]['filter']){_0x31d352[_0x21f9('0x39')]=_['merge'](_0x31d352['where'],{'$or':_['map'](_0x5b01e8,function(_0x2abf9d){if(_0x2abf9d['type']!==_0x21f9('0x3a')){var _0x85449b={};_0x85449b[_0x2abf9d[_0x21f9('0x28')]]={'$like':'%'+_0x134e86[_0x21f9('0x2f')][_0x21f9('0x3b')]+'%'};return _0x85449b;}})});}_0x31d352=_[_0x21f9('0x3c')]({},_0x31d352,_0x134e86[_0x21f9('0x3d')]);var _0x384a37={'where':_0x31d352[_0x21f9('0x39')]};return db['FreshsalesAccount'][_0x21f9('0x1d')](_0x384a37)[_0x21f9('0x24')](function(_0x298d16){_0xfd8585[_0x21f9('0x1d')]=_0x298d16;if(_0x134e86['query']['includeAll']){_0x31d352['include']=[{'all':!![]}];}return db[_0x21f9('0x3e')][_0x21f9('0x3f')](_0x31d352);})[_0x21f9('0x24')](function(_0x5093f8){_0xfd8585['rows']=_0x5093f8;return _0xfd8585;})[_0x21f9('0x24')](respondWithFilteredResult(_0x20ea3b,_0x31d352))[_0x21f9('0x40')](handleError(_0x20ea3b,null));};exports['show']=function(_0x4ce35c,_0x25ec1b){var _0x5be575={'raw':![],'where':{'id':_0x4ce35c[_0x21f9('0x41')]['id']}},_0x6f6a2b={};_0x6f6a2b[_0x21f9('0x32')]=_[_0x21f9('0x2e')](db['FreshsalesAccount'][_0x21f9('0x2b')]);_0x6f6a2b[_0x21f9('0x2f')]=_[_0x21f9('0x2e')](_0x4ce35c['query']);_0x6f6a2b[_0x21f9('0x30')]=_[_0x21f9('0x31')](_0x6f6a2b[_0x21f9('0x32')],_0x6f6a2b[_0x21f9('0x2f')]);_0x5be575['attributes']=_[_0x21f9('0x31')](_0x6f6a2b['model'],qs[_0x21f9('0x34')](_0x4ce35c['query'][_0x21f9('0x34')]));_0x5be575['attributes']=_0x5be575[_0x21f9('0x33')][_0x21f9('0x42')]?_0x5be575[_0x21f9('0x33')]:_0x6f6a2b[_0x21f9('0x32')];if(_0x4ce35c['query'][_0x21f9('0x43')]){_0x5be575[_0x21f9('0x44')]=[{'all':!![]}];}_0x5be575=_[_0x21f9('0x3c')]({},_0x5be575,_0x4ce35c[_0x21f9('0x3d')]);return db[_0x21f9('0x3e')][_0x21f9('0x45')](_0x5be575)[_0x21f9('0x24')](handleEntityNotFound(_0x25ec1b,null))[_0x21f9('0x24')](respondWithResult(_0x25ec1b,null))[_0x21f9('0x40')](handleError(_0x25ec1b,null));};exports[_0x21f9('0x46')]=function(_0x3707f4,_0x32b7ef){return db['FreshsalesAccount'][_0x21f9('0x46')](_0x3707f4[_0x21f9('0x47')],{})[_0x21f9('0x24')](respondWithResult(_0x32b7ef,0xc9))[_0x21f9('0x40')](handleError(_0x32b7ef,null));};exports[_0x21f9('0x23')]=function(_0x377bfc,_0x1c57e4){if(_0x377bfc[_0x21f9('0x47')]['id']){delete _0x377bfc[_0x21f9('0x47')]['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x377bfc[_0x21f9('0x41')]['id']}})[_0x21f9('0x24')](handleEntityNotFound(_0x1c57e4,null))['then'](saveUpdates(_0x377bfc[_0x21f9('0x47')],null))[_0x21f9('0x24')](respondWithResult(_0x1c57e4,null))[_0x21f9('0x40')](handleError(_0x1c57e4,null));};exports[_0x21f9('0x25')]=function(_0x4aef2f,_0x4e6a22){return db['FreshsalesAccount'][_0x21f9('0x45')]({'where':{'id':_0x4aef2f[_0x21f9('0x41')]['id']}})[_0x21f9('0x24')](handleEntityNotFound(_0x4e6a22,null))[_0x21f9('0x24')](removeEntity(_0x4e6a22,null))[_0x21f9('0x40')](handleError(_0x4e6a22,null));};exports[_0x21f9('0x48')]=function(_0x5414bb,_0x37b983,_0x50564d){var _0x3284cd={};var _0x465af4={};var _0x61f0d6;var _0x52be30;return db[_0x21f9('0x3e')]['findOne']({'where':{'id':_0x5414bb[_0x21f9('0x41')]['id']}})['then'](handleEntityNotFound(_0x37b983,null))['then'](function(_0x5ad726){if(_0x5ad726){_0x61f0d6=_0x5ad726;_0x465af4[_0x21f9('0x32')]=_[_0x21f9('0x2e')](db['FreshsalesConfiguration'][_0x21f9('0x2b')]);_0x465af4['query']=_[_0x21f9('0x2e')](_0x5414bb['query']);_0x465af4[_0x21f9('0x30')]=_[_0x21f9('0x31')](_0x465af4['model'],_0x465af4[_0x21f9('0x2f')]);_0x3284cd[_0x21f9('0x33')]=_['intersection'](_0x465af4[_0x21f9('0x32')],qs[_0x21f9('0x34')](_0x5414bb['query'][_0x21f9('0x34')]));_0x3284cd[_0x21f9('0x33')]=_0x3284cd[_0x21f9('0x33')][_0x21f9('0x42')]?_0x3284cd[_0x21f9('0x33')]:_0x465af4[_0x21f9('0x32')];_0x3284cd[_0x21f9('0x37')]=qs[_0x21f9('0x38')](_0x5414bb[_0x21f9('0x2f')][_0x21f9('0x38')]);_0x3284cd[_0x21f9('0x39')]=qs[_0x21f9('0x30')](_[_0x21f9('0x49')](_0x5414bb[_0x21f9('0x2f')],_0x465af4[_0x21f9('0x30')]));if(_0x5414bb[_0x21f9('0x2f')][_0x21f9('0x3b')]){_0x3284cd[_0x21f9('0x39')]=_[_0x21f9('0x3c')](_0x3284cd[_0x21f9('0x39')],{'$or':_[_0x21f9('0x2d')](_0x3284cd[_0x21f9('0x33')],function(_0x15dd5e){var _0x44660d={};_0x44660d[_0x15dd5e]={'$like':'%'+_0x5414bb['query'][_0x21f9('0x3b')]+'%'};return _0x44660d;})});}_0x3284cd=_[_0x21f9('0x3c')]({},_0x3284cd,_0x5414bb[_0x21f9('0x3d')]);return _0x61f0d6[_0x21f9('0x48')](_0x3284cd);}})['then'](function(_0x1e89d2){if(_0x1e89d2){_0x52be30=_0x1e89d2[_0x21f9('0x42')];if(!_0x5414bb[_0x21f9('0x2f')]['hasOwnProperty'](_0x21f9('0x36'))){_0x3284cd['limit']=qs[_0x21f9('0x1c')](_0x5414bb['query']['limit']);_0x3284cd['offset']=qs[_0x21f9('0x1a')](_0x5414bb[_0x21f9('0x2f')][_0x21f9('0x1a')]);}return _0x61f0d6[_0x21f9('0x48')](_0x3284cd);}})[_0x21f9('0x24')](function(_0x5b4fcb){if(_0x5b4fcb){return _0x5b4fcb?{'count':_0x52be30,'rows':_0x5b4fcb}:null;}})[_0x21f9('0x24')](respondWithResult(_0x37b983,null))[_0x21f9('0x40')](handleError(_0x37b983,null));};exports['addConfiguration']=function(_0x155c33,_0x36e459,_0xa09b2){if(_0x155c33[_0x21f9('0x47')]['id']){delete _0x155c33['body']['id'];}return db[_0x21f9('0x3e')][_0x21f9('0x4a')]({'where':{'id':_0x155c33[_0x21f9('0x41')]['id']}})[_0x21f9('0x24')](handleEntityNotFound(_0x36e459,null))[_0x21f9('0x24')](function(_0x3cd029){if(_0x3cd029){_0x155c33['body']['AccountId']=_0x3cd029['id'];_0x155c33[_0x21f9('0x47')][_0x21f9('0x4b')]=integrations[_0x21f9('0x4c')](_0x155c33[_0x21f9('0x47')][_0x21f9('0x4d')],_0x155c33[_0x21f9('0x47')][_0x21f9('0x2c')]);_0x155c33[_0x21f9('0x47')][_0x21f9('0x4e')]=integrations[_0x21f9('0x4f')](_0x155c33[_0x21f9('0x47')][_0x21f9('0x4d')],_0x155c33[_0x21f9('0x47')][_0x21f9('0x2c')]);return db[_0x21f9('0x50')]['create'](_0x155c33[_0x21f9('0x47')],{'include':[{'model':db[_0x21f9('0x51')],'as':_0x21f9('0x4b')},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})[_0x21f9('0x24')](respondWithResult(_0x36e459,null))[_0x21f9('0x40')](handleError(_0x36e459,null));};exports[_0x21f9('0x52')]=function(_0x5433ec,_0x479d4e,_0x53c57c){var _0x444f20='';var _0x329bb0='';return db[_0x21f9('0x3e')]['findOne']({'where':{'id':_0x5433ec[_0x21f9('0x41')]['id']},'attributes':['id',_0x21f9('0x53'),_0x21f9('0x54'),_0x21f9('0x55')]})[_0x21f9('0x24')](handleEntityNotFound(_0x479d4e,null))['then'](function(_0x40be4c){if(_0x40be4c){_0x329bb0=_0x40be4c[_0x21f9('0x53')];_0x444f20=_0x40be4c[_0x21f9('0x54')];var _0x1b369a=_0x40be4c[_0x21f9('0x54')][_0x21f9('0x56')](-0x1);if(_0x1b369a==='/'){_0x444f20=_0x444f20[_0x21f9('0x57')](0x0,_0x444f20[_0x21f9('0x58')](_0x1b369a));}return rp({'method':'GET','uri':util[_0x21f9('0x59')]('%s%s',_0x444f20,_0x21f9('0x5a')),'headers':{'Authorization':_0x21f9('0x5b')+_0x40be4c[_0x21f9('0x55')]},'json':!![]});}})[_0x21f9('0x24')](function(_0x4311c6){if(_0x4311c6){var _0x2e497f=_0x4311c6[_0x21f9('0x5c')];var _0x5ddb0b=![];var _0x2a5a3d=null;for(_0x2a5a3d=0x0;_0x2a5a3d<_0x2e497f['length'];_0x2a5a3d++){if(_0x2e497f[_0x2a5a3d][_0x21f9('0x5d')]===_0x329bb0){_0x5ddb0b=!![];}}if(_0x5ddb0b){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x21f9('0x24')](respondWithResult(_0x479d4e,null))['catch'](function(_0x4b0cda){var _0x1e5a8f=_0x5433ec['query'][_0x21f9('0x5e')]?0x1f4:_0x4b0cda[_0x21f9('0x5f')]||0x1f4;logger[_0x21f9('0x26')](_0x21f9('0x60'),_0x21f9('0x52'),_0x1e5a8f,JSON[_0x21f9('0x61')](_0x4b0cda));delete _0x4b0cda[_0x21f9('0x28')];if(_0x1e5a8f===0x191){_0x1e5a8f=0x190;}_0x479d4e['status'](_0x1e5a8f)[_0x21f9('0x29')](_0x5433ec[_0x21f9('0x2f')][_0x21f9('0x5e')]?{'message':'Wrong\x20credentials','statusCode':_0x4b0cda[_0x21f9('0x5f')]}:_0x4b0cda);});}; \ No newline at end of file +var _0x48b7=['apiKey','GET','format','%s%s','/api/selector/owners','Token\x20token=','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','sendStatus','error','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','filter','where','merge','VIRTUAL','options','includeAll','catch','params','keys','filters','include','body','find','destroy','getConfigurations','findOne','FreshsalesConfiguration','sort','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri'];(function(_0x2b1cac,_0x31933e){var _0x4a8186=function(_0x1fad8d){while(--_0x1fad8d){_0x2b1cac['push'](_0x2b1cac['shift']());}};_0x4a8186(++_0x31933e);}(_0x48b7,0xd5));var _0x748b=function(_0x229626,_0x5d273d){_0x229626=_0x229626-0x0;var _0xc08680=_0x48b7[_0x229626];return _0xc08680;};'use strict';var emlformat=require(_0x748b('0x0'));var rimraf=require(_0x748b('0x1'));var zipdir=require(_0x748b('0x2'));var jsonpatch=require(_0x748b('0x3'));var rp=require(_0x748b('0x4'));var moment=require(_0x748b('0x5'));var BPromise=require(_0x748b('0x6'));var Mustache=require(_0x748b('0x7'));var util=require(_0x748b('0x8'));var path=require(_0x748b('0x9'));var sox=require('sox');var csv=require(_0x748b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x748b('0xb'));var _=require(_0x748b('0xc'));var squel=require(_0x748b('0xd'));var crypto=require(_0x748b('0xe'));var jsforce=require(_0x748b('0xf'));var deskjs=require(_0x748b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x748b('0x11'));var Papa=require('papaparse');var Redis=require(_0x748b('0x12'));var authService=require(_0x748b('0x13'));var qs=require(_0x748b('0x14'));var as=require(_0x748b('0x15'));var hardwareService=require(_0x748b('0x16'));var logger=require(_0x748b('0x17'))(_0x748b('0x18'));var utils=require(_0x748b('0x19'));var config=require(_0x748b('0x1a'));var licenseUtil=require(_0x748b('0x1b'));var db=require(_0x748b('0x1c'))['db'];var integrations=require(_0x748b('0x1d'));function respondWithStatusCode(_0x223dcc,_0x4cedfa){_0x4cedfa=_0x4cedfa||0xcc;return function(_0x216fdb){if(_0x216fdb){return _0x223dcc['sendStatus'](_0x4cedfa);}return _0x223dcc[_0x748b('0x1e')](_0x4cedfa)[_0x748b('0x1f')]();};}function respondWithResult(_0x167668,_0x15a7a7){_0x15a7a7=_0x15a7a7||0xc8;return function(_0x58b2e1){if(_0x58b2e1){return _0x167668[_0x748b('0x1e')](_0x15a7a7)[_0x748b('0x20')](_0x58b2e1);}};}function respondWithFilteredResult(_0x32c395,_0x2e9df9){return function(_0x3abbe9){if(_0x3abbe9){var _0x1c9075=typeof _0x2e9df9[_0x748b('0x21')]===_0x748b('0x22')&&typeof _0x2e9df9[_0x748b('0x23')]==='undefined';var _0x14b13a=_0x3abbe9['count'];var _0x39119b=_0x1c9075?0x0:_0x2e9df9[_0x748b('0x21')];var _0x384588=_0x1c9075?_0x3abbe9[_0x748b('0x24')]:_0x2e9df9['offset']+_0x2e9df9[_0x748b('0x23')];var _0x50820b;if(_0x384588>=_0x14b13a){_0x384588=_0x14b13a;_0x50820b=0xc8;}else{_0x50820b=0xce;}_0x32c395[_0x748b('0x1e')](_0x50820b);return _0x32c395[_0x748b('0x25')](_0x748b('0x26'),_0x39119b+'-'+_0x384588+'/'+_0x14b13a)[_0x748b('0x20')](_0x3abbe9);}return null;};}function patchUpdates(_0x4d5c61){return function(_0x4794d0){try{jsonpatch[_0x748b('0x27')](_0x4794d0,_0x4d5c61,!![]);}catch(_0x5ab456){return BPromise[_0x748b('0x28')](_0x5ab456);}return _0x4794d0['save']();};}function saveUpdates(_0x2288bb,_0x5d660e){return function(_0x593ffe){if(_0x593ffe){return _0x593ffe[_0x748b('0x29')](_0x2288bb)[_0x748b('0x2a')](function(_0x1caa56){return _0x1caa56;});}return null;};}function removeEntity(_0x3389e1,_0x1ee752){return function(_0x1d7cdc){if(_0x1d7cdc){return _0x1d7cdc['destroy']()['then'](function(){_0x3389e1[_0x748b('0x1e')](0xcc)[_0x748b('0x1f')]();});}};}function handleEntityNotFound(_0x512489,_0x59436b){return function(_0x2e7e3b){if(!_0x2e7e3b){_0x512489[_0x748b('0x2b')](0x194);}return _0x2e7e3b;};}function handleError(_0x5093fa,_0x28797d){_0x28797d=_0x28797d||0x1f4;return function(_0x335edd){logger[_0x748b('0x2c')](_0x335edd['stack']);if(_0x335edd[_0x748b('0x2d')]){delete _0x335edd['name'];}_0x5093fa['status'](_0x28797d)[_0x748b('0x2e')](_0x335edd);};}exports[_0x748b('0x2f')]=function(_0x56f6a6,_0x126de5){var _0x23d596={},_0x159335={},_0x20865a={'count':0x0,'rows':[]};var _0x16c449=_[_0x748b('0x30')](db[_0x748b('0x31')][_0x748b('0x32')],function(_0x31d8cf){return{'name':_0x31d8cf[_0x748b('0x33')],'type':_0x31d8cf[_0x748b('0x34')][_0x748b('0x35')]};});_0x159335[_0x748b('0x36')]=_[_0x748b('0x30')](_0x16c449,'name');_0x159335[_0x748b('0x37')]=_['keys'](_0x56f6a6[_0x748b('0x37')]);_0x159335['filters']=_['intersection'](_0x159335[_0x748b('0x36')],_0x159335['query']);_0x23d596[_0x748b('0x38')]=_[_0x748b('0x39')](_0x159335[_0x748b('0x36')],qs[_0x748b('0x3a')](_0x56f6a6[_0x748b('0x37')][_0x748b('0x3a')]));_0x23d596['attributes']=_0x23d596['attributes'][_0x748b('0x3b')]?_0x23d596['attributes']:_0x159335[_0x748b('0x36')];if(!_0x56f6a6['query'][_0x748b('0x3c')](_0x748b('0x3d'))){_0x23d596[_0x748b('0x23')]=qs['limit'](_0x56f6a6[_0x748b('0x37')][_0x748b('0x23')]);_0x23d596[_0x748b('0x21')]=qs['offset'](_0x56f6a6['query'][_0x748b('0x21')]);}_0x23d596[_0x748b('0x3e')]=qs['sort'](_0x56f6a6[_0x748b('0x37')]['sort']);_0x23d596['where']=qs['filters'](_['pick'](_0x56f6a6[_0x748b('0x37')],_0x159335['filters']),_0x16c449);if(_0x56f6a6[_0x748b('0x37')][_0x748b('0x3f')]){_0x23d596[_0x748b('0x40')]=_[_0x748b('0x41')](_0x23d596[_0x748b('0x40')],{'$or':_[_0x748b('0x30')](_0x16c449,function(_0x1260f8){if(_0x1260f8[_0x748b('0x34')]!==_0x748b('0x42')){var _0x62bac2={};_0x62bac2[_0x1260f8['name']]={'$like':'%'+_0x56f6a6[_0x748b('0x37')][_0x748b('0x3f')]+'%'};return _0x62bac2;}})});}_0x23d596=_[_0x748b('0x41')]({},_0x23d596,_0x56f6a6[_0x748b('0x43')]);var _0x37fda9={'where':_0x23d596['where']};return db[_0x748b('0x31')]['count'](_0x37fda9)[_0x748b('0x2a')](function(_0x54ea8b){_0x20865a[_0x748b('0x24')]=_0x54ea8b;if(_0x56f6a6[_0x748b('0x37')][_0x748b('0x44')]){_0x23d596['include']=[{'all':!![]}];}return db[_0x748b('0x31')]['findAll'](_0x23d596);})[_0x748b('0x2a')](function(_0x3d7624){_0x20865a['rows']=_0x3d7624;return _0x20865a;})['then'](respondWithFilteredResult(_0x126de5,_0x23d596))[_0x748b('0x45')](handleError(_0x126de5,null));};exports['show']=function(_0x1644cd,_0x51b284){var _0x3199fd={'raw':![],'where':{'id':_0x1644cd[_0x748b('0x46')]['id']}},_0x38aac0={};_0x38aac0[_0x748b('0x36')]=_[_0x748b('0x47')](db['FreshsalesAccount'][_0x748b('0x32')]);_0x38aac0['query']=_[_0x748b('0x47')](_0x1644cd[_0x748b('0x37')]);_0x38aac0[_0x748b('0x48')]=_[_0x748b('0x39')](_0x38aac0[_0x748b('0x36')],_0x38aac0['query']);_0x3199fd[_0x748b('0x38')]=_['intersection'](_0x38aac0['model'],qs[_0x748b('0x3a')](_0x1644cd[_0x748b('0x37')][_0x748b('0x3a')]));_0x3199fd[_0x748b('0x38')]=_0x3199fd['attributes'][_0x748b('0x3b')]?_0x3199fd[_0x748b('0x38')]:_0x38aac0['model'];if(_0x1644cd['query'][_0x748b('0x44')]){_0x3199fd[_0x748b('0x49')]=[{'all':!![]}];}_0x3199fd=_[_0x748b('0x41')]({},_0x3199fd,_0x1644cd[_0x748b('0x43')]);return db[_0x748b('0x31')]['find'](_0x3199fd)[_0x748b('0x2a')](handleEntityNotFound(_0x51b284,null))[_0x748b('0x2a')](respondWithResult(_0x51b284,null))['catch'](handleError(_0x51b284,null));};exports['create']=function(_0x3333ef,_0x2b5c22){return db[_0x748b('0x31')]['create'](_0x3333ef[_0x748b('0x4a')],{})[_0x748b('0x2a')](respondWithResult(_0x2b5c22,0xc9))['catch'](handleError(_0x2b5c22,null));};exports['update']=function(_0x2eabd3,_0x36eed0){if(_0x2eabd3['body']['id']){delete _0x2eabd3[_0x748b('0x4a')]['id'];}return db[_0x748b('0x31')][_0x748b('0x4b')]({'where':{'id':_0x2eabd3[_0x748b('0x46')]['id']}})['then'](handleEntityNotFound(_0x36eed0,null))[_0x748b('0x2a')](saveUpdates(_0x2eabd3[_0x748b('0x4a')],null))[_0x748b('0x2a')](respondWithResult(_0x36eed0,null))[_0x748b('0x45')](handleError(_0x36eed0,null));};exports[_0x748b('0x4c')]=function(_0x53c9c6,_0x9071b8){return db['FreshsalesAccount'][_0x748b('0x4b')]({'where':{'id':_0x53c9c6[_0x748b('0x46')]['id']}})[_0x748b('0x2a')](handleEntityNotFound(_0x9071b8,null))['then'](removeEntity(_0x9071b8,null))[_0x748b('0x45')](handleError(_0x9071b8,null));};exports[_0x748b('0x4d')]=function(_0x543d32,_0x376b89,_0x367aa1){var _0x153fc2={};var _0x14af82={};var _0x545e9b;var _0x437c16;return db['FreshsalesAccount'][_0x748b('0x4e')]({'where':{'id':_0x543d32[_0x748b('0x46')]['id']}})[_0x748b('0x2a')](handleEntityNotFound(_0x376b89,null))[_0x748b('0x2a')](function(_0x27d5f0){if(_0x27d5f0){_0x545e9b=_0x27d5f0;_0x14af82[_0x748b('0x36')]=_[_0x748b('0x47')](db[_0x748b('0x4f')][_0x748b('0x32')]);_0x14af82[_0x748b('0x37')]=_[_0x748b('0x47')](_0x543d32[_0x748b('0x37')]);_0x14af82[_0x748b('0x48')]=_[_0x748b('0x39')](_0x14af82['model'],_0x14af82[_0x748b('0x37')]);_0x153fc2[_0x748b('0x38')]=_[_0x748b('0x39')](_0x14af82[_0x748b('0x36')],qs[_0x748b('0x3a')](_0x543d32[_0x748b('0x37')][_0x748b('0x3a')]));_0x153fc2[_0x748b('0x38')]=_0x153fc2[_0x748b('0x38')][_0x748b('0x3b')]?_0x153fc2[_0x748b('0x38')]:_0x14af82[_0x748b('0x36')];_0x153fc2[_0x748b('0x3e')]=qs[_0x748b('0x50')](_0x543d32[_0x748b('0x37')]['sort']);_0x153fc2[_0x748b('0x40')]=qs[_0x748b('0x48')](_['pick'](_0x543d32[_0x748b('0x37')],_0x14af82[_0x748b('0x48')]));if(_0x543d32[_0x748b('0x37')][_0x748b('0x3f')]){_0x153fc2['where']=_[_0x748b('0x41')](_0x153fc2[_0x748b('0x40')],{'$or':_['map'](_0x153fc2[_0x748b('0x38')],function(_0x52402b){var _0x34e8ac={};_0x34e8ac[_0x52402b]={'$like':'%'+_0x543d32[_0x748b('0x37')][_0x748b('0x3f')]+'%'};return _0x34e8ac;})});}_0x153fc2=_['merge']({},_0x153fc2,_0x543d32[_0x748b('0x43')]);return _0x545e9b[_0x748b('0x4d')](_0x153fc2);}})[_0x748b('0x2a')](function(_0x4edf27){if(_0x4edf27){_0x437c16=_0x4edf27[_0x748b('0x3b')];if(!_0x543d32[_0x748b('0x37')][_0x748b('0x3c')](_0x748b('0x3d'))){_0x153fc2['limit']=qs['limit'](_0x543d32['query'][_0x748b('0x23')]);_0x153fc2['offset']=qs[_0x748b('0x21')](_0x543d32[_0x748b('0x37')][_0x748b('0x21')]);}return _0x545e9b[_0x748b('0x4d')](_0x153fc2);}})[_0x748b('0x2a')](function(_0x30e57d){if(_0x30e57d){return _0x30e57d?{'count':_0x437c16,'rows':_0x30e57d}:null;}})[_0x748b('0x2a')](respondWithResult(_0x376b89,null))[_0x748b('0x45')](handleError(_0x376b89,null));};exports['addConfiguration']=function(_0x27fb0a,_0x118a54,_0x1ee719){if(_0x27fb0a[_0x748b('0x4a')]['id']){delete _0x27fb0a[_0x748b('0x4a')]['id'];}return db[_0x748b('0x31')][_0x748b('0x4e')]({'where':{'id':_0x27fb0a[_0x748b('0x46')]['id']}})[_0x748b('0x2a')](handleEntityNotFound(_0x118a54,null))[_0x748b('0x2a')](function(_0x1e0d3b){if(_0x1e0d3b){_0x27fb0a[_0x748b('0x4a')][_0x748b('0x51')]=_0x1e0d3b['id'];_0x27fb0a[_0x748b('0x4a')][_0x748b('0x52')]=integrations['getSubjects'](_0x27fb0a[_0x748b('0x4a')][_0x748b('0x53')],_0x27fb0a[_0x748b('0x4a')][_0x748b('0x34')]);_0x27fb0a['body'][_0x748b('0x54')]=integrations[_0x748b('0x55')](_0x27fb0a[_0x748b('0x4a')][_0x748b('0x53')],_0x27fb0a['body']['type']);return db[_0x748b('0x4f')]['create'](_0x27fb0a[_0x748b('0x4a')],{'include':[{'model':db[_0x748b('0x56')],'as':_0x748b('0x52')},{'model':db[_0x748b('0x56')],'as':_0x748b('0x54')}]});}return null;})[_0x748b('0x2a')](respondWithResult(_0x118a54,null))[_0x748b('0x45')](handleError(_0x118a54,null));};exports[_0x748b('0x57')]=function(_0x5514d1,_0x29b9ba,_0x472289){var _0x3a9347='';var _0x2bf133='';return db[_0x748b('0x31')][_0x748b('0x4e')]({'where':{'id':_0x5514d1[_0x748b('0x46')]['id']},'attributes':['id',_0x748b('0x58'),_0x748b('0x59'),_0x748b('0x5a')]})[_0x748b('0x2a')](handleEntityNotFound(_0x29b9ba,null))['then'](function(_0x5e549e){if(_0x5e549e){_0x2bf133=_0x5e549e[_0x748b('0x58')];_0x3a9347=_0x5e549e[_0x748b('0x59')];var _0xc274a4=_0x5e549e[_0x748b('0x59')]['slice'](-0x1);if(_0xc274a4==='/'){_0x3a9347=_0x3a9347['substring'](0x0,_0x3a9347['lastIndexOf'](_0xc274a4));}return rp({'method':_0x748b('0x5b'),'uri':util[_0x748b('0x5c')](_0x748b('0x5d'),_0x3a9347,_0x748b('0x5e')),'headers':{'Authorization':_0x748b('0x5f')+_0x5e549e[_0x748b('0x5a')]},'json':!![]});}})[_0x748b('0x2a')](function(_0x25047e){if(_0x25047e){var _0x539d4e=_0x25047e['users'];var _0x340ab4=![];var _0x263032=null;for(_0x263032=0x0;_0x263032<_0x539d4e[_0x748b('0x3b')];_0x263032++){if(_0x539d4e[_0x263032]['email']===_0x2bf133){_0x340ab4=!![];}}if(_0x340ab4){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x748b('0x2a')](respondWithResult(_0x29b9ba,null))[_0x748b('0x45')](function(_0x3d920f){var _0x4515d9=_0x5514d1[_0x748b('0x37')][_0x748b('0x60')]?0x1f4:_0x3d920f[_0x748b('0x61')]||0x1f4;logger['error'](_0x748b('0x62'),_0x748b('0x57'),_0x4515d9,JSON[_0x748b('0x63')](_0x3d920f));delete _0x3d920f['name'];if(_0x4515d9===0x191){_0x4515d9=0x190;}_0x29b9ba['status'](_0x4515d9)[_0x748b('0x2e')](_0x5514d1[_0x748b('0x37')][_0x748b('0x60')]?{'message':_0x748b('0x64'),'statusCode':_0x3d920f[_0x748b('0x61')]}:_0x3d920f);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 28d4c75..95bfcb4 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 _0xafb9=['moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x28d088,_0x28e831){var _0x591932=function(_0x3b7508){while(--_0x3b7508){_0x28d088['push'](_0x28d088['shift']());}};_0x591932(++_0x28e831);}(_0xafb9,0x68));var _0x9afb=function(_0x1b0a4d,_0x5930d){_0x1b0a4d=_0x1b0a4d-0x0;var _0x55e78c=_0xafb9[_0x1b0a4d];return _0x55e78c;};'use strict';var _=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var logger=require(_0x9afb('0x2'))(_0x9afb('0x3'));var moment=require(_0x9afb('0x4'));var BPromise=require(_0x9afb('0x5'));var rp=require(_0x9afb('0x6'));var fs=require('fs');var path=require(_0x9afb('0x7'));var rimraf=require(_0x9afb('0x8'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x9afb('0x9'));module['exports']=function(_0x1ccf93,_0x548b24){return _0x1ccf93['define'](_0x9afb('0xa'),attributes,{'tableName':_0x9afb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6b0=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2af245,_0x1395f9){var _0x129078=function(_0x302181){while(--_0x302181){_0x2af245['push'](_0x2af245['shift']());}};_0x129078(++_0x1395f9);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x5db8fc,_0x129138){_0x5db8fc=_0x5db8fc-0x0;var _0x352082=_0xa6b0[_0x5db8fc];return _0x352082;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a6b('0x2'));var BPromise=require(_0x0a6b('0x3'));var rp=require(_0x0a6b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a6b('0x5'));var config=require(_0x0a6b('0x6'));var attributes=require(_0x0a6b('0x7'));var integrations=require(_0x0a6b('0x8'));module[_0x0a6b('0x9')]=function(_0x3b6967,_0x1b5fb5){return _0x3b6967[_0x0a6b('0xa')](_0x0a6b('0xb'),attributes,{'tableName':_0x0a6b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 94232ee..d9024c1 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 _0x1893=['request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','catch','ShowFreshsalesAccount','find','then','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','FreshsalesAccount,\x20%s,\x20%s'];(function(_0x4f30ae,_0x1f83c4){var _0x4d7126=function(_0x224473){while(--_0x224473){_0x4f30ae['push'](_0x4f30ae['shift']());}};_0x4d7126(++_0x1f83c4);}(_0x1893,0xa2));var _0x3189=function(_0x9e1d73,_0xcf6479){_0x9e1d73=_0x9e1d73-0x0;var _0x1ba603=_0x1893[_0x9e1d73];return _0x1ba603;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3189('0x0'));var BPromise=require(_0x3189('0x1'));var rs=require(_0x3189('0x2'));var fs=require('fs');var Redis=require(_0x3189('0x3'));var db=require(_0x3189('0x4'))['db'];var utils=require(_0x3189('0x5'));var logger=require(_0x3189('0x6'))('rpc');var config=require(_0x3189('0x7'));var jayson=require(_0x3189('0x8'));var client=jayson[_0x3189('0x9')][_0x3189('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x77c566,_0x118970,_0x14d84b){return new BPromise(function(_0x1f6764,_0x5312a3){return client[_0x3189('0xb')](_0x77c566,_0x14d84b)['then'](function(_0x127449){logger['info'](_0x3189('0xc'),_0x118970,_0x3189('0xd'));logger[_0x3189('0xe')](_0x3189('0xf'),_0x118970,'request\x20sent',JSON[_0x3189('0x10')](_0x127449));if(_0x127449[_0x3189('0x11')]){if(_0x127449[_0x3189('0x11')][_0x3189('0x12')]===0x1f4){logger[_0x3189('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x118970,_0x127449[_0x3189('0x11')][_0x3189('0x13')]);return _0x5312a3(_0x127449[_0x3189('0x11')][_0x3189('0x13')]);}logger[_0x3189('0x11')](_0x3189('0xc'),_0x118970,_0x127449[_0x3189('0x11')][_0x3189('0x13')]);return _0x1f6764(_0x127449['error'][_0x3189('0x13')]);}else{logger[_0x3189('0x14')](_0x3189('0xc'),_0x118970,_0x3189('0xd'));_0x1f6764(_0x127449['result'][_0x3189('0x13')]);}})['catch'](function(_0x55f432){logger[_0x3189('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x118970,_0x55f432);_0x5312a3(_0x55f432);});});}exports[_0x3189('0x15')]=function(_0xf8aed7){var _0x22c7ba=this;return new Promise(function(_0x9905c4,_0x4c4d9b){return db[_0x3189('0x16')][_0x3189('0x17')]({'raw':_0xf8aed7[_0x3189('0x18')]?_0xf8aed7['options'][_0x3189('0x19')]===undefined?!![]:![]:!![],'where':_0xf8aed7[_0x3189('0x18')]?_0xf8aed7[_0x3189('0x18')][_0x3189('0x1a')]||null:null,'attributes':_0xf8aed7[_0x3189('0x18')]?_0xf8aed7['options'][_0x3189('0x1b')]||null:null,'limit':_0xf8aed7[_0x3189('0x18')]?_0xf8aed7[_0x3189('0x18')]['limit']||null:null,'include':_0xf8aed7[_0x3189('0x18')]?_0xf8aed7['options'][_0x3189('0x1c')]?_[_0x3189('0x1d')](_0xf8aed7[_0x3189('0x18')][_0x3189('0x1c')],function(_0x1cbe33){return{'model':db[_0x1cbe33[_0x3189('0x1e')]],'as':_0x1cbe33['as'],'attributes':_0x1cbe33['attributes'],'include':_0x1cbe33['include']?_[_0x3189('0x1d')](_0x1cbe33[_0x3189('0x1c')],function(_0x1dc1c8){return{'model':db[_0x1dc1c8[_0x3189('0x1e')]],'as':_0x1dc1c8['as'],'attributes':_0x1dc1c8[_0x3189('0x1b')],'include':_0x1dc1c8[_0x3189('0x1c')]?_[_0x3189('0x1d')](_0x1dc1c8[_0x3189('0x1c')],function(_0x17b540){return{'model':db[_0x17b540[_0x3189('0x1e')]],'as':_0x17b540['as'],'attributes':_0x17b540['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5aa34a){logger[_0x3189('0x14')](_0x3189('0x15'),_0xf8aed7);logger[_0x3189('0xe')](_0x3189('0x15'),_0xf8aed7,JSON[_0x3189('0x10')](_0x5aa34a));_0x9905c4(_0x5aa34a);})[_0x3189('0x1f')](function(_0x4d453a){logger[_0x3189('0x11')](_0x3189('0x15'),_0x4d453a['message'],_0xf8aed7);_0x4c4d9b(_0x22c7ba[_0x3189('0x11')](0x1f4,_0x4d453a[_0x3189('0x13')]));});});};exports[_0x3189('0x20')]=function(_0x5c7a36){var _0x168dc2=this;return new Promise(function(_0x32bba1,_0x23798e){return db['FreshsalesAccount'][_0x3189('0x21')]({'raw':_0x5c7a36[_0x3189('0x18')]?_0x5c7a36['options'][_0x3189('0x19')]===undefined?!![]:![]:!![],'where':_0x5c7a36[_0x3189('0x18')]?_0x5c7a36[_0x3189('0x18')][_0x3189('0x1a')]||null:null,'attributes':_0x5c7a36[_0x3189('0x18')]?_0x5c7a36['options']['attributes']||null:null,'include':_0x5c7a36[_0x3189('0x18')]?_0x5c7a36['options'][_0x3189('0x1c')]?_[_0x3189('0x1d')](_0x5c7a36[_0x3189('0x18')][_0x3189('0x1c')],function(_0x231d72){return{'model':db[_0x231d72[_0x3189('0x1e')]],'as':_0x231d72['as'],'attributes':_0x231d72[_0x3189('0x1b')],'include':_0x231d72[_0x3189('0x1c')]?_[_0x3189('0x1d')](_0x231d72['include'],function(_0x453e4b){return{'model':db[_0x453e4b[_0x3189('0x1e')]],'as':_0x453e4b['as'],'attributes':_0x453e4b[_0x3189('0x1b')],'include':_0x453e4b[_0x3189('0x1c')]?_[_0x3189('0x1d')](_0x453e4b[_0x3189('0x1c')],function(_0xd1ee0){return{'model':db[_0xd1ee0['model']],'as':_0xd1ee0['as'],'attributes':_0xd1ee0['attributes']};}):[]};}):[]};}):[]:[]})[_0x3189('0x22')](function(_0x580064){logger[_0x3189('0x14')](_0x3189('0x20'),_0x5c7a36);logger['debug'](_0x3189('0x20'),_0x5c7a36,JSON[_0x3189('0x10')](_0x580064));_0x32bba1(_0x580064);})[_0x3189('0x1f')](function(_0x254135){logger['error'](_0x3189('0x20'),_0x254135['message'],_0x5c7a36);_0x23798e(_0x168dc2['error'](0x1f4,_0x254135[_0x3189('0x13')]));});});}; \ No newline at end of file +var _0x2da6=['info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FreshsalesAccount','options','raw','where','attributes','include','map','model','GetFreshsalesAccount','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then'];(function(_0x2f6629,_0x1b013c){var _0x317739=function(_0xc44c27){while(--_0xc44c27){_0x2f6629['push'](_0x2f6629['shift']());}};_0x317739(++_0x1b013c);}(_0x2da6,0x1dd));var _0x62da=function(_0xf7db3f,_0x3e7559){_0xf7db3f=_0xf7db3f-0x0;var _0x500f56=_0x2da6[_0xf7db3f];return _0x500f56;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var moment=require(_0x62da('0x2'));var BPromise=require(_0x62da('0x3'));var rs=require(_0x62da('0x4'));var fs=require('fs');var Redis=require(_0x62da('0x5'));var db=require(_0x62da('0x6'))['db'];var utils=require(_0x62da('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x62da('0x8'));var jayson=require(_0x62da('0x9'));var client=jayson[_0x62da('0xa')][_0x62da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x100e73,_0x9d9139,_0x310c15){return new BPromise(function(_0x16f919,_0xbfd2b0){return client['request'](_0x100e73,_0x310c15)[_0x62da('0xc')](function(_0x2a3937){logger[_0x62da('0xd')](_0x62da('0xe'),_0x9d9139,'request\x20sent');logger[_0x62da('0xf')](_0x62da('0x10'),_0x9d9139,_0x62da('0x11'),JSON[_0x62da('0x12')](_0x2a3937));if(_0x2a3937[_0x62da('0x13')]){if(_0x2a3937['error'][_0x62da('0x14')]===0x1f4){logger[_0x62da('0x13')](_0x62da('0xe'),_0x9d9139,_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);return _0xbfd2b0(_0x2a3937['error']['message']);}logger[_0x62da('0x13')](_0x62da('0xe'),_0x9d9139,_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);return _0x16f919(_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);}else{logger[_0x62da('0xd')](_0x62da('0xe'),_0x9d9139,_0x62da('0x11'));_0x16f919(_0x2a3937[_0x62da('0x16')][_0x62da('0x15')]);}})[_0x62da('0x17')](function(_0x1f6bc8){logger[_0x62da('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x9d9139,_0x1f6bc8);_0xbfd2b0(_0x1f6bc8);});});}exports['GetFreshsalesAccount']=function(_0xa7050b){var _0x4ae4fb=this;return new Promise(function(_0x4d6482,_0x264366){return db[_0x62da('0x18')]['findAll']({'raw':_0xa7050b[_0x62da('0x19')]?_0xa7050b['options'][_0x62da('0x1a')]===undefined?!![]:![]:!![],'where':_0xa7050b[_0x62da('0x19')]?_0xa7050b[_0x62da('0x19')][_0x62da('0x1b')]||null:null,'attributes':_0xa7050b[_0x62da('0x19')]?_0xa7050b[_0x62da('0x19')][_0x62da('0x1c')]||null:null,'limit':_0xa7050b[_0x62da('0x19')]?_0xa7050b[_0x62da('0x19')]['limit']||null:null,'include':_0xa7050b[_0x62da('0x19')]?_0xa7050b[_0x62da('0x19')][_0x62da('0x1d')]?_[_0x62da('0x1e')](_0xa7050b[_0x62da('0x19')][_0x62da('0x1d')],function(_0x24298a){return{'model':db[_0x24298a['model']],'as':_0x24298a['as'],'attributes':_0x24298a['attributes'],'include':_0x24298a['include']?_[_0x62da('0x1e')](_0x24298a[_0x62da('0x1d')],function(_0x14897c){return{'model':db[_0x14897c[_0x62da('0x1f')]],'as':_0x14897c['as'],'attributes':_0x14897c['attributes'],'include':_0x14897c[_0x62da('0x1d')]?_[_0x62da('0x1e')](_0x14897c['include'],function(_0x3ccf96){return{'model':db[_0x3ccf96[_0x62da('0x1f')]],'as':_0x3ccf96['as'],'attributes':_0x3ccf96[_0x62da('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41de3a){logger[_0x62da('0xd')](_0x62da('0x20'),_0xa7050b);logger['debug']('GetFreshsalesAccount',_0xa7050b,JSON[_0x62da('0x12')](_0x41de3a));_0x4d6482(_0x41de3a);})[_0x62da('0x17')](function(_0x220ffc){logger['error'](_0x62da('0x20'),_0x220ffc[_0x62da('0x15')],_0xa7050b);_0x264366(_0x4ae4fb[_0x62da('0x13')](0x1f4,_0x220ffc[_0x62da('0x15')]));});});};exports[_0x62da('0x21')]=function(_0x1cf765){var _0x592c6c=this;return new Promise(function(_0xbe398f,_0x4f71bc){return db[_0x62da('0x18')][_0x62da('0x22')]({'raw':_0x1cf765[_0x62da('0x19')]?_0x1cf765[_0x62da('0x19')][_0x62da('0x1a')]===undefined?!![]:![]:!![],'where':_0x1cf765[_0x62da('0x19')]?_0x1cf765['options'][_0x62da('0x1b')]||null:null,'attributes':_0x1cf765[_0x62da('0x19')]?_0x1cf765[_0x62da('0x19')]['attributes']||null:null,'include':_0x1cf765[_0x62da('0x19')]?_0x1cf765[_0x62da('0x19')][_0x62da('0x1d')]?_['map'](_0x1cf765[_0x62da('0x19')][_0x62da('0x1d')],function(_0x55eda7){return{'model':db[_0x55eda7[_0x62da('0x1f')]],'as':_0x55eda7['as'],'attributes':_0x55eda7[_0x62da('0x1c')],'include':_0x55eda7['include']?_[_0x62da('0x1e')](_0x55eda7[_0x62da('0x1d')],function(_0x11bf73){return{'model':db[_0x11bf73[_0x62da('0x1f')]],'as':_0x11bf73['as'],'attributes':_0x11bf73[_0x62da('0x1c')],'include':_0x11bf73[_0x62da('0x1d')]?_[_0x62da('0x1e')](_0x11bf73[_0x62da('0x1d')],function(_0x2f1115){return{'model':db[_0x2f1115[_0x62da('0x1f')]],'as':_0x2f1115['as'],'attributes':_0x2f1115[_0x62da('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x62da('0xc')](function(_0x3057f6){logger[_0x62da('0xd')](_0x62da('0x21'),_0x1cf765);logger[_0x62da('0xf')](_0x62da('0x21'),_0x1cf765,JSON['stringify'](_0x3057f6));_0xbe398f(_0x3057f6);})[_0x62da('0x17')](function(_0x5e9295){logger[_0x62da('0x13')](_0x62da('0x21'),_0x5e9295[_0x62da('0x15')],_0x1cf765);_0x4f71bc(_0x592c6c['error'](0x1f4,_0x5e9295[_0x62da('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 0b79561..a1a8826 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 _0x2983=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','getFields','create','put','update','delete','destroy','exports','util','path'];(function(_0x3861ba,_0x536fd0){var _0x71bbea=function(_0x1ed3dc){while(--_0x1ed3dc){_0x3861ba['push'](_0x3861ba['shift']());}};_0x71bbea(++_0x536fd0);}(_0x2983,0xd6));var _0x3298=function(_0x1e233e,_0x1d97c8){_0x1e233e=_0x1e233e-0x0;var _0x378169=_0x2983[_0x1e233e];return _0x378169;};'use strict';var multer=require('multer');var util=require(_0x3298('0x0'));var path=require(_0x3298('0x1'));var timeout=require(_0x3298('0x2'));var express=require(_0x3298('0x3'));var router=express[_0x3298('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3298('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3298('0x6'));var controller=require(_0x3298('0x7'));router[_0x3298('0x8')]('/',auth['isAuthenticated'](),controller[_0x3298('0x9')]);router[_0x3298('0x8')](_0x3298('0xa'),auth[_0x3298('0xb')](),controller[_0x3298('0xc')]);router[_0x3298('0x8')](_0x3298('0xd'),auth[_0x3298('0xb')](),controller[_0x3298('0xe')]);router[_0x3298('0x8')](_0x3298('0xf'),auth[_0x3298('0xb')](),controller['getDescriptions']);router[_0x3298('0x8')](_0x3298('0x10'),auth[_0x3298('0xb')](),controller[_0x3298('0x11')]);router['post']('/',auth[_0x3298('0xb')](),controller[_0x3298('0x12')]);router[_0x3298('0x13')](_0x3298('0xa'),auth[_0x3298('0xb')](),controller[_0x3298('0x14')]);router[_0x3298('0x15')](_0x3298('0xa'),auth[_0x3298('0xb')](),controller[_0x3298('0x16')]);module[_0x3298('0x17')]=router; \ No newline at end of file +var _0x00d9=['multer','util','connect-timeout','Router','../../components/auth/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post','put','update','delete','exports'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x00d9,0x1a4));var _0x900d=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x00d9[_0x40220a];return _0x3903cc;};'use strict';var multer=require(_0x900d('0x0'));var util=require(_0x900d('0x1'));var path=require('path');var timeout=require(_0x900d('0x2'));var express=require('express');var router=express[_0x900d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x900d('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x900d('0x5'));router[_0x900d('0x6')]('/',auth[_0x900d('0x7')](),controller[_0x900d('0x8')]);router[_0x900d('0x6')](_0x900d('0x9'),auth[_0x900d('0x7')](),controller[_0x900d('0xa')]);router[_0x900d('0x6')]('/:id/subjects',auth[_0x900d('0x7')](),controller[_0x900d('0xb')]);router[_0x900d('0x6')](_0x900d('0xc'),auth[_0x900d('0x7')](),controller[_0x900d('0xd')]);router[_0x900d('0x6')](_0x900d('0xe'),auth[_0x900d('0x7')](),controller['getFields']);router[_0x900d('0xf')]('/',auth[_0x900d('0x7')](),controller['create']);router[_0x900d('0x10')](_0x900d('0x9'),auth[_0x900d('0x7')](),controller[_0x900d('0x11')]);router[_0x900d('0x12')]('/:id',auth[_0x900d('0x7')](),controller['destroy']);module[_0x900d('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 8148b43..588b863 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 _0x24b8=['sequelize','exports','STRING'];(function(_0x5f5b7a,_0x563e61){var _0x7d276d=function(_0x5edde1){while(--_0x5edde1){_0x5f5b7a['push'](_0x5f5b7a['shift']());}};_0x7d276d(++_0x563e61);}(_0x24b8,0x1c8));var _0x824b=function(_0x403496,_0x396061){_0x403496=_0x403496-0x0;var _0x20078d=_0x24b8[_0x403496];return _0x20078d;};'use strict';var Sequelize=require(_0x824b('0x0'));module[_0x824b('0x1')]={'name':{'type':Sequelize[_0x824b('0x2')]},'description':{'type':Sequelize[_0x824b('0x2')]}}; \ No newline at end of file +var _0x58a7=['exports','STRING'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0x58a7,0x1b6));var _0x758a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x58a7[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x758a('0x0')]={'name':{'type':Sequelize[_0x758a('0x1')]},'description':{'type':Sequelize[_0x758a('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 4ec55f8..f7d0fcb 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 _0x35cd=['then','destroy','error','name','index','map','FreshsalesConfiguration','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','update','keys','FreshsalesField','sort','pick','getSubjects','hasOwnProperty','getDescriptions','findOne','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply'];(function(_0x55795a,_0x53d9b5){var _0x26ffa5=function(_0x4a3519){while(--_0x4a3519){_0x55795a['push'](_0x55795a['shift']());}};_0x26ffa5(++_0x53d9b5);}(_0x35cd,0xc6));var _0xd35c=function(_0x3364f9,_0x453544){_0x3364f9=_0x3364f9-0x0;var _0x5370e6=_0x35cd[_0x3364f9];return _0x5370e6;};'use strict';var emlformat=require(_0xd35c('0x0'));var rimraf=require(_0xd35c('0x1'));var zipdir=require(_0xd35c('0x2'));var jsonpatch=require(_0xd35c('0x3'));var rp=require(_0xd35c('0x4'));var moment=require(_0xd35c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd35c('0x6'));var path=require('path');var sox=require(_0xd35c('0x7'));var csv=require(_0xd35c('0x8'));var ejs=require(_0xd35c('0x9'));var fs=require('fs');var fs_extra=require(_0xd35c('0xa'));var _=require('lodash');var squel=require(_0xd35c('0xb'));var crypto=require(_0xd35c('0xc'));var jsforce=require(_0xd35c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd35c('0x8'));var querystring=require(_0xd35c('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd35c('0xf'));var qs=require(_0xd35c('0x10'));var as=require(_0xd35c('0x11'));var hardwareService=require(_0xd35c('0x12'));var logger=require('../../config/logger')(_0xd35c('0x13'));var utils=require('../../config/utils');var config=require(_0xd35c('0x14'));var licenseUtil=require(_0xd35c('0x15'));var db=require(_0xd35c('0x16'))['db'];function respondWithStatusCode(_0x4bde04,_0xf5d55a){_0xf5d55a=_0xf5d55a||0xcc;return function(_0x134ac4){if(_0x134ac4){return _0x4bde04[_0xd35c('0x17')](_0xf5d55a);}return _0x4bde04[_0xd35c('0x18')](_0xf5d55a)[_0xd35c('0x19')]();};}function respondWithResult(_0x170e18,_0x31e0af){_0x31e0af=_0x31e0af||0xc8;return function(_0x3f5113){if(_0x3f5113){return _0x170e18[_0xd35c('0x18')](_0x31e0af)['json'](_0x3f5113);}};}function respondWithFilteredResult(_0x2485b7,_0x9ae290){return function(_0x24a15c){if(_0x24a15c){var _0xc46868=typeof _0x9ae290[_0xd35c('0x1a')]==='undefined'&&typeof _0x9ae290['limit']===_0xd35c('0x1b');var _0x463f1f=_0x24a15c[_0xd35c('0x1c')];var _0x12f76f=_0xc46868?0x0:_0x9ae290[_0xd35c('0x1a')];var _0x2ad100=_0xc46868?_0x24a15c['count']:_0x9ae290[_0xd35c('0x1a')]+_0x9ae290['limit'];var _0x42635e;if(_0x2ad100>=_0x463f1f){_0x2ad100=_0x463f1f;_0x42635e=0xc8;}else{_0x42635e=0xce;}_0x2485b7[_0xd35c('0x18')](_0x42635e);return _0x2485b7[_0xd35c('0x1d')](_0xd35c('0x1e'),_0x12f76f+'-'+_0x2ad100+'/'+_0x463f1f)[_0xd35c('0x1f')](_0x24a15c);}return null;};}function patchUpdates(_0x83e247){return function(_0x2d5da2){try{jsonpatch[_0xd35c('0x20')](_0x2d5da2,_0x83e247,!![]);}catch(_0x4db124){return BPromise['reject'](_0x4db124);}return _0x2d5da2['save']();};}function saveUpdates(_0x44a041,_0x2b779c){return function(_0x5c9795){if(_0x5c9795){return _0x5c9795['update'](_0x44a041)[_0xd35c('0x21')](function(_0x5ee86b){return _0x5ee86b;});}return null;};}function removeEntity(_0x450d8d,_0x108cf7){return function(_0x5ee8c3){if(_0x5ee8c3){return _0x5ee8c3[_0xd35c('0x22')]()['then'](function(){_0x450d8d[_0xd35c('0x18')](0xcc)[_0xd35c('0x19')]();});}};}function handleEntityNotFound(_0x35b179,_0x501ca1){return function(_0x10dbad){if(!_0x10dbad){_0x35b179[_0xd35c('0x17')](0x194);}return _0x10dbad;};}function handleError(_0x39e289,_0x32830c){_0x32830c=_0x32830c||0x1f4;return function(_0x2cec49){logger[_0xd35c('0x23')](_0x2cec49['stack']);if(_0x2cec49['name']){delete _0x2cec49[_0xd35c('0x24')];}_0x39e289[_0xd35c('0x18')](_0x32830c)['send'](_0x2cec49);};}exports[_0xd35c('0x25')]=function(_0x57e411,_0xc3bb72){var _0x3e5d07={},_0x1ae03c={},_0x360153={'count':0x0,'rows':[]};var _0x1251c0=_[_0xd35c('0x26')](db[_0xd35c('0x27')]['rawAttributes'],function(_0x335179){return{'name':_0x335179['fieldName'],'type':_0x335179[_0xd35c('0x28')][_0xd35c('0x29')]};});_0x1ae03c[_0xd35c('0x2a')]=_[_0xd35c('0x26')](_0x1251c0,_0xd35c('0x24'));_0x1ae03c[_0xd35c('0x2b')]=_['keys'](_0x57e411['query']);_0x1ae03c[_0xd35c('0x2c')]=_[_0xd35c('0x2d')](_0x1ae03c['model'],_0x1ae03c['query']);_0x3e5d07[_0xd35c('0x2e')]=_[_0xd35c('0x2d')](_0x1ae03c['model'],qs['fields'](_0x57e411[_0xd35c('0x2b')][_0xd35c('0x2f')]));_0x3e5d07[_0xd35c('0x2e')]=_0x3e5d07[_0xd35c('0x2e')][_0xd35c('0x30')]?_0x3e5d07['attributes']:_0x1ae03c[_0xd35c('0x2a')];if(!_0x57e411['query']['hasOwnProperty'](_0xd35c('0x31'))){_0x3e5d07[_0xd35c('0x32')]=qs[_0xd35c('0x32')](_0x57e411['query'][_0xd35c('0x32')]);_0x3e5d07[_0xd35c('0x1a')]=qs[_0xd35c('0x1a')](_0x57e411[_0xd35c('0x2b')][_0xd35c('0x1a')]);}_0x3e5d07[_0xd35c('0x33')]=qs['sort'](_0x57e411[_0xd35c('0x2b')]['sort']);_0x3e5d07[_0xd35c('0x34')]=qs[_0xd35c('0x2c')](_['pick'](_0x57e411[_0xd35c('0x2b')],_0x1ae03c['filters']),_0x1251c0);if(_0x57e411[_0xd35c('0x2b')][_0xd35c('0x35')]){_0x3e5d07[_0xd35c('0x34')]=_[_0xd35c('0x36')](_0x3e5d07[_0xd35c('0x34')],{'$or':_[_0xd35c('0x26')](_0x1251c0,function(_0x2c4570){if(_0x2c4570['type']!==_0xd35c('0x37')){var _0x2385f8={};_0x2385f8[_0x2c4570[_0xd35c('0x24')]]={'$like':'%'+_0x57e411[_0xd35c('0x2b')][_0xd35c('0x35')]+'%'};return _0x2385f8;}})});}_0x3e5d07=_[_0xd35c('0x36')]({},_0x3e5d07,_0x57e411[_0xd35c('0x38')]);var _0x579bfa={'where':_0x3e5d07[_0xd35c('0x34')]};return db[_0xd35c('0x27')]['count'](_0x579bfa)['then'](function(_0x2daa0d){_0x360153[_0xd35c('0x1c')]=_0x2daa0d;if(_0x57e411[_0xd35c('0x2b')][_0xd35c('0x39')]){_0x3e5d07[_0xd35c('0x3a')]=[{'all':!![]}];}return db[_0xd35c('0x27')][_0xd35c('0x3b')](_0x3e5d07);})[_0xd35c('0x21')](function(_0x3420a0){_0x360153[_0xd35c('0x3c')]=_0x3420a0;return _0x360153;})[_0xd35c('0x21')](respondWithFilteredResult(_0xc3bb72,_0x3e5d07))[_0xd35c('0x3d')](handleError(_0xc3bb72,null));};exports['show']=function(_0x41aa7f,_0x20f314){var _0x588cac={'raw':![],'where':{'id':_0x41aa7f[_0xd35c('0x3e')]['id']}},_0x5a9999={};_0x5a9999[_0xd35c('0x2a')]=_['keys'](db['FreshsalesConfiguration'][_0xd35c('0x3f')]);_0x5a9999[_0xd35c('0x2b')]=_['keys'](_0x41aa7f['query']);_0x5a9999[_0xd35c('0x2c')]=_[_0xd35c('0x2d')](_0x5a9999[_0xd35c('0x2a')],_0x5a9999[_0xd35c('0x2b')]);_0x588cac['attributes']=_[_0xd35c('0x2d')](_0x5a9999[_0xd35c('0x2a')],qs[_0xd35c('0x2f')](_0x41aa7f[_0xd35c('0x2b')]['fields']));_0x588cac[_0xd35c('0x2e')]=_0x588cac[_0xd35c('0x2e')]['length']?_0x588cac['attributes']:_0x5a9999[_0xd35c('0x2a')];if(_0x41aa7f[_0xd35c('0x2b')][_0xd35c('0x39')]){_0x588cac[_0xd35c('0x3a')]=[{'all':!![]}];}_0x588cac=_[_0xd35c('0x36')]({},_0x588cac,_0x41aa7f['options']);return db[_0xd35c('0x27')][_0xd35c('0x40')](_0x588cac)[_0xd35c('0x21')](handleEntityNotFound(_0x20f314,null))['then'](respondWithResult(_0x20f314,null))[_0xd35c('0x3d')](handleError(_0x20f314,null));};exports[_0xd35c('0x41')]=function(_0x37e97b,_0x287209){return db[_0xd35c('0x27')][_0xd35c('0x41')](_0x37e97b[_0xd35c('0x42')],{})['then'](respondWithResult(_0x287209,0xc9))[_0xd35c('0x3d')](handleError(_0x287209,null));};exports[_0xd35c('0x43')]=function(_0x19b797,_0x1ec3ab){if(_0x19b797['body']['id']){delete _0x19b797[_0xd35c('0x42')]['id'];}return db[_0xd35c('0x27')]['find']({'where':{'id':_0x19b797['params']['id']}})['then'](handleEntityNotFound(_0x1ec3ab,null))[_0xd35c('0x21')](saveUpdates(_0x19b797[_0xd35c('0x42')],null))[_0xd35c('0x21')](respondWithResult(_0x1ec3ab,null))[_0xd35c('0x3d')](handleError(_0x1ec3ab,null));};exports[_0xd35c('0x22')]=function(_0x1b6b5d,_0x32d154){return db['FreshsalesConfiguration'][_0xd35c('0x40')]({'where':{'id':_0x1b6b5d[_0xd35c('0x3e')]['id']}})[_0xd35c('0x21')](handleEntityNotFound(_0x32d154,null))[_0xd35c('0x21')](removeEntity(_0x32d154,null))[_0xd35c('0x3d')](handleError(_0x32d154,null));};exports['getSubjects']=function(_0x5307be,_0x159c19,_0x114283){var _0x51d865={};var _0x32b460={};var _0x3e60e0;var _0x451ba2;return db[_0xd35c('0x27')]['findOne']({'where':{'id':_0x5307be[_0xd35c('0x3e')]['id']}})[_0xd35c('0x21')](handleEntityNotFound(_0x159c19,null))[_0xd35c('0x21')](function(_0x1e85a7){if(_0x1e85a7){_0x3e60e0=_0x1e85a7;_0x32b460[_0xd35c('0x2a')]=_[_0xd35c('0x44')](db[_0xd35c('0x45')][_0xd35c('0x3f')]);_0x32b460['query']=_['keys'](_0x5307be['query']);_0x32b460['filters']=_[_0xd35c('0x2d')](_0x32b460[_0xd35c('0x2a')],_0x32b460['query']);_0x51d865['attributes']=_[_0xd35c('0x2d')](_0x32b460[_0xd35c('0x2a')],qs[_0xd35c('0x2f')](_0x5307be[_0xd35c('0x2b')]['fields']));_0x51d865[_0xd35c('0x2e')]=_0x51d865[_0xd35c('0x2e')]['length']?_0x51d865[_0xd35c('0x2e')]:_0x32b460[_0xd35c('0x2a')];_0x51d865[_0xd35c('0x33')]=qs[_0xd35c('0x46')](_0x5307be['query'][_0xd35c('0x46')]);_0x51d865[_0xd35c('0x34')]=qs[_0xd35c('0x2c')](_[_0xd35c('0x47')](_0x5307be['query'],_0x32b460[_0xd35c('0x2c')]));if(_0x5307be[_0xd35c('0x2b')]['filter']){_0x51d865[_0xd35c('0x34')]=_[_0xd35c('0x36')](_0x51d865[_0xd35c('0x34')],{'$or':_['map'](_0x51d865[_0xd35c('0x2e')],function(_0x58c13c){var _0x291315={};_0x291315[_0x58c13c]={'$like':'%'+_0x5307be[_0xd35c('0x2b')][_0xd35c('0x35')]+'%'};return _0x291315;})});}_0x51d865=_['merge']({},_0x51d865,_0x5307be['options']);return _0x3e60e0[_0xd35c('0x48')](_0x51d865);}})[_0xd35c('0x21')](function(_0x38caaa){if(_0x38caaa){_0x451ba2=_0x38caaa['length'];if(!_0x5307be['query'][_0xd35c('0x49')](_0xd35c('0x31'))){_0x51d865[_0xd35c('0x32')]=qs['limit'](_0x5307be['query']['limit']);_0x51d865['offset']=qs[_0xd35c('0x1a')](_0x5307be['query'][_0xd35c('0x1a')]);}return _0x3e60e0[_0xd35c('0x48')](_0x51d865);}})[_0xd35c('0x21')](function(_0x3d1626){if(_0x3d1626){return _0x3d1626?{'count':_0x451ba2,'rows':_0x3d1626}:null;}})[_0xd35c('0x21')](respondWithResult(_0x159c19,null))['catch'](handleError(_0x159c19,null));};exports[_0xd35c('0x4a')]=function(_0x41c76e,_0x20ee7c,_0x17a0fd){var _0x25d22d={};var _0x340d3f={};var _0x4f3e86;var _0x3aaeab;return db[_0xd35c('0x27')][_0xd35c('0x4b')]({'where':{'id':_0x41c76e[_0xd35c('0x3e')]['id']}})[_0xd35c('0x21')](handleEntityNotFound(_0x20ee7c,null))['then'](function(_0x4b2707){if(_0x4b2707){_0x4f3e86=_0x4b2707;_0x340d3f[_0xd35c('0x2a')]=_[_0xd35c('0x44')](db[_0xd35c('0x45')]['rawAttributes']);_0x340d3f[_0xd35c('0x2b')]=_[_0xd35c('0x44')](_0x41c76e[_0xd35c('0x2b')]);_0x340d3f[_0xd35c('0x2c')]=_[_0xd35c('0x2d')](_0x340d3f[_0xd35c('0x2a')],_0x340d3f[_0xd35c('0x2b')]);_0x25d22d['attributes']=_['intersection'](_0x340d3f[_0xd35c('0x2a')],qs['fields'](_0x41c76e[_0xd35c('0x2b')][_0xd35c('0x2f')]));_0x25d22d[_0xd35c('0x2e')]=_0x25d22d[_0xd35c('0x2e')][_0xd35c('0x30')]?_0x25d22d[_0xd35c('0x2e')]:_0x340d3f['model'];_0x25d22d[_0xd35c('0x33')]=qs[_0xd35c('0x46')](_0x41c76e[_0xd35c('0x2b')][_0xd35c('0x46')]);_0x25d22d[_0xd35c('0x34')]=qs['filters'](_[_0xd35c('0x47')](_0x41c76e[_0xd35c('0x2b')],_0x340d3f[_0xd35c('0x2c')]));if(_0x41c76e[_0xd35c('0x2b')][_0xd35c('0x35')]){_0x25d22d[_0xd35c('0x34')]=_[_0xd35c('0x36')](_0x25d22d[_0xd35c('0x34')],{'$or':_['map'](_0x25d22d[_0xd35c('0x2e')],function(_0x2eff76){var _0x480954={};_0x480954[_0x2eff76]={'$like':'%'+_0x41c76e['query'][_0xd35c('0x35')]+'%'};return _0x480954;})});}_0x25d22d=_[_0xd35c('0x36')]({},_0x25d22d,_0x41c76e['options']);return _0x4f3e86[_0xd35c('0x4a')](_0x25d22d);}})[_0xd35c('0x21')](function(_0x1ff3d0){if(_0x1ff3d0){_0x3aaeab=_0x1ff3d0['length'];if(!_0x41c76e[_0xd35c('0x2b')][_0xd35c('0x49')](_0xd35c('0x31'))){_0x25d22d[_0xd35c('0x32')]=qs[_0xd35c('0x32')](_0x41c76e[_0xd35c('0x2b')][_0xd35c('0x32')]);_0x25d22d[_0xd35c('0x1a')]=qs[_0xd35c('0x1a')](_0x41c76e['query'][_0xd35c('0x1a')]);}return _0x4f3e86[_0xd35c('0x4a')](_0x25d22d);}})[_0xd35c('0x21')](function(_0x10793f){if(_0x10793f){return _0x10793f?{'count':_0x3aaeab,'rows':_0x10793f}:null;}})['then'](respondWithResult(_0x20ee7c,null))['catch'](handleError(_0x20ee7c,null));};exports[_0xd35c('0x4c')]=function(_0x2b6156,_0x3bbd5c,_0xc1d78d){var _0x53c864={};var _0x5115a2={};var _0x398aa7;var _0x334cb6;return db[_0xd35c('0x27')][_0xd35c('0x4b')]({'where':{'id':_0x2b6156[_0xd35c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3bbd5c,null))[_0xd35c('0x21')](function(_0x7d88dc){if(_0x7d88dc){_0x398aa7=_0x7d88dc;_0x5115a2[_0xd35c('0x2a')]=_[_0xd35c('0x44')](db['FreshsalesField'][_0xd35c('0x3f')]);_0x5115a2[_0xd35c('0x2b')]=_['keys'](_0x2b6156[_0xd35c('0x2b')]);_0x5115a2['filters']=_['intersection'](_0x5115a2['model'],_0x5115a2[_0xd35c('0x2b')]);_0x53c864[_0xd35c('0x2e')]=_[_0xd35c('0x2d')](_0x5115a2[_0xd35c('0x2a')],qs[_0xd35c('0x2f')](_0x2b6156['query'][_0xd35c('0x2f')]));_0x53c864[_0xd35c('0x2e')]=_0x53c864[_0xd35c('0x2e')]['length']?_0x53c864[_0xd35c('0x2e')]:_0x5115a2[_0xd35c('0x2a')];_0x53c864[_0xd35c('0x33')]=qs['sort'](_0x2b6156[_0xd35c('0x2b')][_0xd35c('0x46')]);_0x53c864[_0xd35c('0x34')]=qs['filters'](_[_0xd35c('0x47')](_0x2b6156[_0xd35c('0x2b')],_0x5115a2[_0xd35c('0x2c')]));if(_0x2b6156[_0xd35c('0x2b')]['filter']){_0x53c864[_0xd35c('0x34')]=_[_0xd35c('0x36')](_0x53c864[_0xd35c('0x34')],{'$or':_[_0xd35c('0x26')](_0x53c864[_0xd35c('0x2e')],function(_0x64f8aa){var _0x6ea4db={};_0x6ea4db[_0x64f8aa]={'$like':'%'+_0x2b6156[_0xd35c('0x2b')][_0xd35c('0x35')]+'%'};return _0x6ea4db;})});}_0x53c864=_[_0xd35c('0x36')]({},_0x53c864,_0x2b6156[_0xd35c('0x38')]);return _0x398aa7[_0xd35c('0x4c')](_0x53c864);}})[_0xd35c('0x21')](function(_0x2c85a7){if(_0x2c85a7){_0x334cb6=_0x2c85a7[_0xd35c('0x30')];if(!_0x2b6156[_0xd35c('0x2b')][_0xd35c('0x49')](_0xd35c('0x31'))){_0x53c864[_0xd35c('0x32')]=qs['limit'](_0x2b6156[_0xd35c('0x2b')][_0xd35c('0x32')]);_0x53c864[_0xd35c('0x1a')]=qs[_0xd35c('0x1a')](_0x2b6156[_0xd35c('0x2b')]['offset']);}return _0x398aa7['getFields'](_0x53c864);}})[_0xd35c('0x21')](function(_0x390ad1){if(_0x390ad1){return _0x390ad1?{'count':_0x334cb6,'rows':_0x390ad1}:null;}})[_0xd35c('0x21')](respondWithResult(_0x3bbd5c,null))['catch'](handleError(_0x3bbd5c,null));}; \ No newline at end of file +var _0x7987=['bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','error','name','send','index','map','FreshsalesConfiguration','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','options','findAll','show','params','includeAll','find','create','body','catch','destroy','getSubjects','findOne','FreshsalesField','filter','getDescriptions','order','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x19849a,_0x4354f9){var _0x112958=function(_0x472c44){while(--_0x472c44){_0x19849a['push'](_0x19849a['shift']());}};_0x112958(++_0x4354f9);}(_0x7987,0x181));var _0x7798=function(_0x5c14f6,_0x2979d8){_0x5c14f6=_0x5c14f6-0x0;var _0x4949b3=_0x7987[_0x5c14f6];return _0x4949b3;};'use strict';var emlformat=require(_0x7798('0x0'));var rimraf=require(_0x7798('0x1'));var zipdir=require(_0x7798('0x2'));var jsonpatch=require(_0x7798('0x3'));var rp=require(_0x7798('0x4'));var moment=require('moment');var BPromise=require(_0x7798('0x5'));var Mustache=require('mustache');var util=require(_0x7798('0x6'));var path=require(_0x7798('0x7'));var sox=require(_0x7798('0x8'));var csv=require('to-csv');var ejs=require(_0x7798('0x9'));var fs=require('fs');var fs_extra=require(_0x7798('0xa'));var _=require(_0x7798('0xb'));var squel=require(_0x7798('0xc'));var crypto=require(_0x7798('0xd'));var jsforce=require(_0x7798('0xe'));var deskjs=require(_0x7798('0xf'));var toCsv=require(_0x7798('0x10'));var querystring=require(_0x7798('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7798('0x12'));var as=require(_0x7798('0x13'));var hardwareService=require(_0x7798('0x14'));var logger=require(_0x7798('0x15'))(_0x7798('0x16'));var utils=require(_0x7798('0x17'));var config=require(_0x7798('0x18'));var licenseUtil=require(_0x7798('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x86f43d,_0x39442d){_0x39442d=_0x39442d||0xcc;return function(_0x4ece59){if(_0x4ece59){return _0x86f43d[_0x7798('0x1a')](_0x39442d);}return _0x86f43d[_0x7798('0x1b')](_0x39442d)['end']();};}function respondWithResult(_0x163ae1,_0x419622){_0x419622=_0x419622||0xc8;return function(_0x2fd573){if(_0x2fd573){return _0x163ae1[_0x7798('0x1b')](_0x419622)['json'](_0x2fd573);}};}function respondWithFilteredResult(_0x4b4654,_0x1ae84d){return function(_0x415ae5){if(_0x415ae5){var _0xbc97b6=typeof _0x1ae84d[_0x7798('0x1c')]===_0x7798('0x1d')&&typeof _0x1ae84d[_0x7798('0x1e')]===_0x7798('0x1d');var _0x4d6b9c=_0x415ae5[_0x7798('0x1f')];var _0xa49d8a=_0xbc97b6?0x0:_0x1ae84d['offset'];var _0x3a64b4=_0xbc97b6?_0x415ae5[_0x7798('0x1f')]:_0x1ae84d[_0x7798('0x1c')]+_0x1ae84d[_0x7798('0x1e')];var _0x393802;if(_0x3a64b4>=_0x4d6b9c){_0x3a64b4=_0x4d6b9c;_0x393802=0xc8;}else{_0x393802=0xce;}_0x4b4654[_0x7798('0x1b')](_0x393802);return _0x4b4654[_0x7798('0x20')](_0x7798('0x21'),_0xa49d8a+'-'+_0x3a64b4+'/'+_0x4d6b9c)[_0x7798('0x22')](_0x415ae5);}return null;};}function patchUpdates(_0x37c718){return function(_0x43d800){try{jsonpatch['apply'](_0x43d800,_0x37c718,!![]);}catch(_0x5d2727){return BPromise[_0x7798('0x23')](_0x5d2727);}return _0x43d800['save']();};}function saveUpdates(_0x32a065,_0x27acc4){return function(_0x552967){if(_0x552967){return _0x552967[_0x7798('0x24')](_0x32a065)[_0x7798('0x25')](function(_0x410f79){return _0x410f79;});}return null;};}function removeEntity(_0x1802fe,_0x1129e3){return function(_0x2fb4e6){if(_0x2fb4e6){return _0x2fb4e6['destroy']()['then'](function(){_0x1802fe[_0x7798('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe598fd,_0x5b5035){return function(_0x17e95c){if(!_0x17e95c){_0xe598fd['sendStatus'](0x194);}return _0x17e95c;};}function handleError(_0x3f3ded,_0xef2490){_0xef2490=_0xef2490||0x1f4;return function(_0x11a6e6){logger[_0x7798('0x26')](_0x11a6e6['stack']);if(_0x11a6e6[_0x7798('0x27')]){delete _0x11a6e6[_0x7798('0x27')];}_0x3f3ded[_0x7798('0x1b')](_0xef2490)[_0x7798('0x28')](_0x11a6e6);};}exports[_0x7798('0x29')]=function(_0x58496d,_0x10fca7){var _0x10c1bb={},_0x387c73={},_0xf8b31={'count':0x0,'rows':[]};var _0x3e33ac=_[_0x7798('0x2a')](db[_0x7798('0x2b')][_0x7798('0x2c')],function(_0x3c8cd7){return{'name':_0x3c8cd7['fieldName'],'type':_0x3c8cd7['type'][_0x7798('0x2d')]};});_0x387c73[_0x7798('0x2e')]=_[_0x7798('0x2a')](_0x3e33ac,_0x7798('0x27'));_0x387c73[_0x7798('0x2f')]=_[_0x7798('0x30')](_0x58496d['query']);_0x387c73[_0x7798('0x31')]=_[_0x7798('0x32')](_0x387c73[_0x7798('0x2e')],_0x387c73[_0x7798('0x2f')]);_0x10c1bb['attributes']=_['intersection'](_0x387c73[_0x7798('0x2e')],qs[_0x7798('0x33')](_0x58496d['query'][_0x7798('0x33')]));_0x10c1bb[_0x7798('0x34')]=_0x10c1bb[_0x7798('0x34')][_0x7798('0x35')]?_0x10c1bb[_0x7798('0x34')]:_0x387c73[_0x7798('0x2e')];if(!_0x58496d[_0x7798('0x2f')][_0x7798('0x36')](_0x7798('0x37'))){_0x10c1bb[_0x7798('0x1e')]=qs[_0x7798('0x1e')](_0x58496d[_0x7798('0x2f')][_0x7798('0x1e')]);_0x10c1bb[_0x7798('0x1c')]=qs['offset'](_0x58496d[_0x7798('0x2f')][_0x7798('0x1c')]);}_0x10c1bb['order']=qs[_0x7798('0x38')](_0x58496d['query']['sort']);_0x10c1bb[_0x7798('0x39')]=qs[_0x7798('0x31')](_['pick'](_0x58496d[_0x7798('0x2f')],_0x387c73[_0x7798('0x31')]),_0x3e33ac);if(_0x58496d[_0x7798('0x2f')]['filter']){_0x10c1bb[_0x7798('0x39')]=_[_0x7798('0x3a')](_0x10c1bb[_0x7798('0x39')],{'$or':_['map'](_0x3e33ac,function(_0x68abe4){if(_0x68abe4[_0x7798('0x3b')]!==_0x7798('0x3c')){var _0x283947={};_0x283947[_0x68abe4[_0x7798('0x27')]]={'$like':'%'+_0x58496d[_0x7798('0x2f')]['filter']+'%'};return _0x283947;}})});}_0x10c1bb=_[_0x7798('0x3a')]({},_0x10c1bb,_0x58496d[_0x7798('0x3d')]);var _0x21d119={'where':_0x10c1bb[_0x7798('0x39')]};return db['FreshsalesConfiguration'][_0x7798('0x1f')](_0x21d119)['then'](function(_0x5f4be2){_0xf8b31[_0x7798('0x1f')]=_0x5f4be2;if(_0x58496d[_0x7798('0x2f')]['includeAll']){_0x10c1bb['include']=[{'all':!![]}];}return db[_0x7798('0x2b')][_0x7798('0x3e')](_0x10c1bb);})[_0x7798('0x25')](function(_0x5102b1){_0xf8b31['rows']=_0x5102b1;return _0xf8b31;})[_0x7798('0x25')](respondWithFilteredResult(_0x10fca7,_0x10c1bb))['catch'](handleError(_0x10fca7,null));};exports[_0x7798('0x3f')]=function(_0x108b3b,_0x5d2819){var _0x4b5a94={'raw':![],'where':{'id':_0x108b3b[_0x7798('0x40')]['id']}},_0x3d9ef6={};_0x3d9ef6[_0x7798('0x2e')]=_[_0x7798('0x30')](db[_0x7798('0x2b')][_0x7798('0x2c')]);_0x3d9ef6[_0x7798('0x2f')]=_[_0x7798('0x30')](_0x108b3b[_0x7798('0x2f')]);_0x3d9ef6[_0x7798('0x31')]=_[_0x7798('0x32')](_0x3d9ef6['model'],_0x3d9ef6[_0x7798('0x2f')]);_0x4b5a94[_0x7798('0x34')]=_[_0x7798('0x32')](_0x3d9ef6[_0x7798('0x2e')],qs[_0x7798('0x33')](_0x108b3b[_0x7798('0x2f')][_0x7798('0x33')]));_0x4b5a94[_0x7798('0x34')]=_0x4b5a94[_0x7798('0x34')][_0x7798('0x35')]?_0x4b5a94[_0x7798('0x34')]:_0x3d9ef6[_0x7798('0x2e')];if(_0x108b3b['query'][_0x7798('0x41')]){_0x4b5a94['include']=[{'all':!![]}];}_0x4b5a94=_['merge']({},_0x4b5a94,_0x108b3b[_0x7798('0x3d')]);return db[_0x7798('0x2b')][_0x7798('0x42')](_0x4b5a94)['then'](handleEntityNotFound(_0x5d2819,null))[_0x7798('0x25')](respondWithResult(_0x5d2819,null))['catch'](handleError(_0x5d2819,null));};exports[_0x7798('0x43')]=function(_0x2c16e5,_0x13770b){return db[_0x7798('0x2b')][_0x7798('0x43')](_0x2c16e5[_0x7798('0x44')],{})[_0x7798('0x25')](respondWithResult(_0x13770b,0xc9))[_0x7798('0x45')](handleError(_0x13770b,null));};exports[_0x7798('0x24')]=function(_0x2792ef,_0x4cd8da){if(_0x2792ef[_0x7798('0x44')]['id']){delete _0x2792ef['body']['id'];}return db['FreshsalesConfiguration'][_0x7798('0x42')]({'where':{'id':_0x2792ef['params']['id']}})[_0x7798('0x25')](handleEntityNotFound(_0x4cd8da,null))[_0x7798('0x25')](saveUpdates(_0x2792ef[_0x7798('0x44')],null))['then'](respondWithResult(_0x4cd8da,null))['catch'](handleError(_0x4cd8da,null));};exports[_0x7798('0x46')]=function(_0x40485b,_0x5859f5){return db[_0x7798('0x2b')][_0x7798('0x42')]({'where':{'id':_0x40485b[_0x7798('0x40')]['id']}})['then'](handleEntityNotFound(_0x5859f5,null))['then'](removeEntity(_0x5859f5,null))[_0x7798('0x45')](handleError(_0x5859f5,null));};exports[_0x7798('0x47')]=function(_0x51b080,_0x205e58,_0x2e4e26){var _0x56e6b7={};var _0x3d8a71={};var _0x103a05;var _0x16fb8c;return db['FreshsalesConfiguration'][_0x7798('0x48')]({'where':{'id':_0x51b080[_0x7798('0x40')]['id']}})[_0x7798('0x25')](handleEntityNotFound(_0x205e58,null))['then'](function(_0x327f71){if(_0x327f71){_0x103a05=_0x327f71;_0x3d8a71[_0x7798('0x2e')]=_['keys'](db[_0x7798('0x49')][_0x7798('0x2c')]);_0x3d8a71[_0x7798('0x2f')]=_[_0x7798('0x30')](_0x51b080[_0x7798('0x2f')]);_0x3d8a71[_0x7798('0x31')]=_[_0x7798('0x32')](_0x3d8a71['model'],_0x3d8a71['query']);_0x56e6b7[_0x7798('0x34')]=_[_0x7798('0x32')](_0x3d8a71[_0x7798('0x2e')],qs[_0x7798('0x33')](_0x51b080[_0x7798('0x2f')]['fields']));_0x56e6b7[_0x7798('0x34')]=_0x56e6b7[_0x7798('0x34')][_0x7798('0x35')]?_0x56e6b7[_0x7798('0x34')]:_0x3d8a71[_0x7798('0x2e')];_0x56e6b7['order']=qs[_0x7798('0x38')](_0x51b080[_0x7798('0x2f')][_0x7798('0x38')]);_0x56e6b7[_0x7798('0x39')]=qs[_0x7798('0x31')](_['pick'](_0x51b080[_0x7798('0x2f')],_0x3d8a71['filters']));if(_0x51b080['query'][_0x7798('0x4a')]){_0x56e6b7[_0x7798('0x39')]=_[_0x7798('0x3a')](_0x56e6b7[_0x7798('0x39')],{'$or':_['map'](_0x56e6b7['attributes'],function(_0x4e8ef5){var _0x167a03={};_0x167a03[_0x4e8ef5]={'$like':'%'+_0x51b080[_0x7798('0x2f')]['filter']+'%'};return _0x167a03;})});}_0x56e6b7=_['merge']({},_0x56e6b7,_0x51b080[_0x7798('0x3d')]);return _0x103a05[_0x7798('0x47')](_0x56e6b7);}})[_0x7798('0x25')](function(_0x174364){if(_0x174364){_0x16fb8c=_0x174364[_0x7798('0x35')];if(!_0x51b080[_0x7798('0x2f')][_0x7798('0x36')](_0x7798('0x37'))){_0x56e6b7['limit']=qs[_0x7798('0x1e')](_0x51b080[_0x7798('0x2f')][_0x7798('0x1e')]);_0x56e6b7[_0x7798('0x1c')]=qs[_0x7798('0x1c')](_0x51b080[_0x7798('0x2f')][_0x7798('0x1c')]);}return _0x103a05[_0x7798('0x47')](_0x56e6b7);}})[_0x7798('0x25')](function(_0x12a590){if(_0x12a590){return _0x12a590?{'count':_0x16fb8c,'rows':_0x12a590}:null;}})['then'](respondWithResult(_0x205e58,null))['catch'](handleError(_0x205e58,null));};exports[_0x7798('0x4b')]=function(_0x393fb3,_0x2817bc,_0x3f2a13){var _0x438d5c={};var _0x15e4e7={};var _0x2417ea;var _0x46ccfb;return db[_0x7798('0x2b')][_0x7798('0x48')]({'where':{'id':_0x393fb3[_0x7798('0x40')]['id']}})['then'](handleEntityNotFound(_0x2817bc,null))[_0x7798('0x25')](function(_0x75be2c){if(_0x75be2c){_0x2417ea=_0x75be2c;_0x15e4e7[_0x7798('0x2e')]=_[_0x7798('0x30')](db[_0x7798('0x49')][_0x7798('0x2c')]);_0x15e4e7[_0x7798('0x2f')]=_['keys'](_0x393fb3[_0x7798('0x2f')]);_0x15e4e7['filters']=_['intersection'](_0x15e4e7[_0x7798('0x2e')],_0x15e4e7['query']);_0x438d5c[_0x7798('0x34')]=_[_0x7798('0x32')](_0x15e4e7[_0x7798('0x2e')],qs['fields'](_0x393fb3[_0x7798('0x2f')][_0x7798('0x33')]));_0x438d5c['attributes']=_0x438d5c[_0x7798('0x34')][_0x7798('0x35')]?_0x438d5c['attributes']:_0x15e4e7[_0x7798('0x2e')];_0x438d5c[_0x7798('0x4c')]=qs['sort'](_0x393fb3[_0x7798('0x2f')][_0x7798('0x38')]);_0x438d5c['where']=qs[_0x7798('0x31')](_['pick'](_0x393fb3[_0x7798('0x2f')],_0x15e4e7[_0x7798('0x31')]));if(_0x393fb3[_0x7798('0x2f')]['filter']){_0x438d5c['where']=_[_0x7798('0x3a')](_0x438d5c[_0x7798('0x39')],{'$or':_[_0x7798('0x2a')](_0x438d5c['attributes'],function(_0x3ca3fc){var _0x4d90fe={};_0x4d90fe[_0x3ca3fc]={'$like':'%'+_0x393fb3[_0x7798('0x2f')]['filter']+'%'};return _0x4d90fe;})});}_0x438d5c=_[_0x7798('0x3a')]({},_0x438d5c,_0x393fb3[_0x7798('0x3d')]);return _0x2417ea['getDescriptions'](_0x438d5c);}})[_0x7798('0x25')](function(_0x375453){if(_0x375453){_0x46ccfb=_0x375453[_0x7798('0x35')];if(!_0x393fb3[_0x7798('0x2f')][_0x7798('0x36')](_0x7798('0x37'))){_0x438d5c['limit']=qs[_0x7798('0x1e')](_0x393fb3[_0x7798('0x2f')][_0x7798('0x1e')]);_0x438d5c[_0x7798('0x1c')]=qs[_0x7798('0x1c')](_0x393fb3['query'][_0x7798('0x1c')]);}return _0x2417ea[_0x7798('0x4b')](_0x438d5c);}})['then'](function(_0x5460ac){if(_0x5460ac){return _0x5460ac?{'count':_0x46ccfb,'rows':_0x5460ac}:null;}})[_0x7798('0x25')](respondWithResult(_0x2817bc,null))['catch'](handleError(_0x2817bc,null));};exports['getFields']=function(_0x3e3f23,_0xedd4af,_0x11b6e4){var _0x3dc1d8={};var _0x56e061={};var _0x257486;var _0x2999b8;return db[_0x7798('0x2b')][_0x7798('0x48')]({'where':{'id':_0x3e3f23[_0x7798('0x40')]['id']}})[_0x7798('0x25')](handleEntityNotFound(_0xedd4af,null))['then'](function(_0x503dbe){if(_0x503dbe){_0x257486=_0x503dbe;_0x56e061[_0x7798('0x2e')]=_[_0x7798('0x30')](db[_0x7798('0x49')][_0x7798('0x2c')]);_0x56e061[_0x7798('0x2f')]=_[_0x7798('0x30')](_0x3e3f23['query']);_0x56e061['filters']=_[_0x7798('0x32')](_0x56e061[_0x7798('0x2e')],_0x56e061[_0x7798('0x2f')]);_0x3dc1d8['attributes']=_[_0x7798('0x32')](_0x56e061[_0x7798('0x2e')],qs['fields'](_0x3e3f23[_0x7798('0x2f')][_0x7798('0x33')]));_0x3dc1d8['attributes']=_0x3dc1d8['attributes'][_0x7798('0x35')]?_0x3dc1d8['attributes']:_0x56e061[_0x7798('0x2e')];_0x3dc1d8[_0x7798('0x4c')]=qs[_0x7798('0x38')](_0x3e3f23[_0x7798('0x2f')][_0x7798('0x38')]);_0x3dc1d8[_0x7798('0x39')]=qs[_0x7798('0x31')](_['pick'](_0x3e3f23[_0x7798('0x2f')],_0x56e061[_0x7798('0x31')]));if(_0x3e3f23['query'][_0x7798('0x4a')]){_0x3dc1d8['where']=_[_0x7798('0x3a')](_0x3dc1d8[_0x7798('0x39')],{'$or':_[_0x7798('0x2a')](_0x3dc1d8[_0x7798('0x34')],function(_0x5c33ab){var _0x45ecf9={};_0x45ecf9[_0x5c33ab]={'$like':'%'+_0x3e3f23['query']['filter']+'%'};return _0x45ecf9;})});}_0x3dc1d8=_['merge']({},_0x3dc1d8,_0x3e3f23['options']);return _0x257486[_0x7798('0x4d')](_0x3dc1d8);}})[_0x7798('0x25')](function(_0x3f4a39){if(_0x3f4a39){_0x2999b8=_0x3f4a39[_0x7798('0x35')];if(!_0x3e3f23[_0x7798('0x2f')][_0x7798('0x36')](_0x7798('0x37'))){_0x3dc1d8[_0x7798('0x1e')]=qs[_0x7798('0x1e')](_0x3e3f23[_0x7798('0x2f')][_0x7798('0x1e')]);_0x3dc1d8[_0x7798('0x1c')]=qs[_0x7798('0x1c')](_0x3e3f23[_0x7798('0x2f')][_0x7798('0x1c')]);}return _0x257486[_0x7798('0x4d')](_0x3dc1d8);}})[_0x7798('0x25')](function(_0x1e1226){if(_0x1e1226){return _0x1e1226?{'count':_0x2999b8,'rows':_0x1e1226}:null;}})['then'](respondWithResult(_0xedd4af,null))[_0x7798('0x45')](handleError(_0xedd4af,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 915403e..e30ab63 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 _0x137f=['bluebird','request-promise','rimraf','exports','define','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger','api'];(function(_0x3282ba,_0x4e1ef1){var _0x44f222=function(_0x3829ca){while(--_0x3829ca){_0x3282ba['push'](_0x3282ba['shift']());}};_0x44f222(++_0x4e1ef1);}(_0x137f,0x165));var _0xf137=function(_0x3b0a98,_0x5f15a7){_0x3b0a98=_0x3b0a98-0x0;var _0x3c4760=_0x137f[_0x3b0a98];return _0x3c4760;};'use strict';var _=require('lodash');var util=require(_0xf137('0x0'));var logger=require(_0xf137('0x1'))(_0xf137('0x2'));var moment=require('moment');var BPromise=require(_0xf137('0x3'));var rp=require(_0xf137('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf137('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xf137('0x6')]=function(_0x11f2ca,_0x2d88d4){return _0x11f2ca[_0xf137('0x7')](_0xf137('0x8'),attributes,{'tableName':_0xf137('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72c7=['int_freshsales_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration'];(function(_0x810e4d,_0x909ef4){var _0x13f01c=function(_0x12fd89){while(--_0x12fd89){_0x810e4d['push'](_0x810e4d['shift']());}};_0x13f01c(++_0x909ef4);}(_0x72c7,0x112));var _0x772c=function(_0x5eeb5b,_0x55c909){_0x5eeb5b=_0x5eeb5b-0x0;var _0x31471c=_0x72c7[_0x5eeb5b];return _0x31471c;};'use strict';var _=require(_0x772c('0x0'));var util=require(_0x772c('0x1'));var logger=require(_0x772c('0x2'))('api');var moment=require(_0x772c('0x3'));var BPromise=require(_0x772c('0x4'));var rp=require(_0x772c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x772c('0x6'));var config=require(_0x772c('0x7'));var attributes=require(_0x772c('0x8'));module[_0x772c('0x9')]=function(_0x544f99,_0x562e84){return _0x544f99[_0x772c('0xa')](_0x772c('0xb'),attributes,{'tableName':_0x772c('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 ac08696..e248f39 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 _0xce78=['request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xce78,0x177));var _0x8ce7=function(_0x86f938,_0x5701fd){_0x86f938=_0x86f938-0x0;var _0x3feeaa=_0xce78[_0x86f938];return _0x3feeaa;};'use strict';var _=require(_0x8ce7('0x0'));var util=require(_0x8ce7('0x1'));var moment=require(_0x8ce7('0x2'));var BPromise=require(_0x8ce7('0x3'));var rs=require(_0x8ce7('0x4'));var fs=require('fs');var Redis=require(_0x8ce7('0x5'));var db=require(_0x8ce7('0x6'))['db'];var utils=require(_0x8ce7('0x7'));var logger=require(_0x8ce7('0x8'))(_0x8ce7('0x9'));var config=require('../../config/environment');var jayson=require(_0x8ce7('0xa'));var client=jayson[_0x8ce7('0xb')][_0x8ce7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f4822,_0x2c259b,_0x4fdaec){return new BPromise(function(_0x129f72,_0x31c633){return client['request'](_0x4f4822,_0x4fdaec)[_0x8ce7('0xd')](function(_0x42004c){logger[_0x8ce7('0xe')](_0x8ce7('0xf'),_0x2c259b,_0x8ce7('0x10'));logger[_0x8ce7('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x2c259b,_0x8ce7('0x10'),JSON['stringify'](_0x42004c));if(_0x42004c[_0x8ce7('0x12')]){if(_0x42004c['error'][_0x8ce7('0x13')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x2c259b,_0x42004c['error']['message']);return _0x31c633(_0x42004c[_0x8ce7('0x12')][_0x8ce7('0x14')]);}logger[_0x8ce7('0x12')](_0x8ce7('0xf'),_0x2c259b,_0x42004c['error'][_0x8ce7('0x14')]);return _0x129f72(_0x42004c[_0x8ce7('0x12')][_0x8ce7('0x14')]);}else{logger[_0x8ce7('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2c259b,_0x8ce7('0x10'));_0x129f72(_0x42004c[_0x8ce7('0x15')][_0x8ce7('0x14')]);}})[_0x8ce7('0x16')](function(_0x296eb4){logger[_0x8ce7('0x12')](_0x8ce7('0xf'),_0x2c259b,_0x296eb4);_0x31c633(_0x296eb4);});});} \ No newline at end of file +var _0x6cfa=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','FreshsalesConfiguration,\x20%s,\x20%s','message','result','lodash','moment'];(function(_0x4aa6b1,_0x4db3e3){var _0x4f922b=function(_0x1098e6){while(--_0x1098e6){_0x4aa6b1['push'](_0x4aa6b1['shift']());}};_0x4f922b(++_0x4db3e3);}(_0x6cfa,0x178));var _0xa6cf=function(_0x48b724,_0x5a8e26){_0x48b724=_0x48b724-0x0;var _0x4d38b3=_0x6cfa[_0x48b724];return _0x4d38b3;};'use strict';var _=require(_0xa6cf('0x0'));var util=require('util');var moment=require(_0xa6cf('0x1'));var BPromise=require(_0xa6cf('0x2'));var rs=require(_0xa6cf('0x3'));var fs=require('fs');var Redis=require(_0xa6cf('0x4'));var db=require(_0xa6cf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa6cf('0x6'))(_0xa6cf('0x7'));var config=require(_0xa6cf('0x8'));var jayson=require(_0xa6cf('0x9'));var client=jayson[_0xa6cf('0xa')][_0xa6cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c47ad,_0x491137,_0x4e3f1d){return new BPromise(function(_0x4a50e7,_0x4b6b2f){return client['request'](_0x3c47ad,_0x4e3f1d)['then'](function(_0x1d1033){logger[_0xa6cf('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x491137,_0xa6cf('0xd'));logger['debug'](_0xa6cf('0xe'),_0x491137,_0xa6cf('0xd'),JSON[_0xa6cf('0xf')](_0x1d1033));if(_0x1d1033['error']){if(_0x1d1033['error'][_0xa6cf('0x10')]===0x1f4){logger[_0xa6cf('0x11')](_0xa6cf('0x12'),_0x491137,_0x1d1033[_0xa6cf('0x11')][_0xa6cf('0x13')]);return _0x4b6b2f(_0x1d1033['error'][_0xa6cf('0x13')]);}logger[_0xa6cf('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x491137,_0x1d1033[_0xa6cf('0x11')][_0xa6cf('0x13')]);return _0x4a50e7(_0x1d1033['error']['message']);}else{logger[_0xa6cf('0xc')](_0xa6cf('0x12'),_0x491137,_0xa6cf('0xd'));_0x4a50e7(_0x1d1033[_0xa6cf('0x14')][_0xa6cf('0x13')]);}})['catch'](function(_0x26f060){logger[_0xa6cf('0x11')](_0xa6cf('0x12'),_0x491137,_0x26f060);_0x4b6b2f(_0x26f060);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 7819226..919e884 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 _0x3d9c=['destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','/:id','show','create','put','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3d9c,0x134));var _0xc3d9=function(_0x1da60b,_0x3a5a87){_0x1da60b=_0x1da60b-0x0;var _0x3c326f=_0x3d9c[_0x1da60b];return _0x3c326f;};'use strict';var multer=require(_0xc3d9('0x0'));var util=require('util');var path=require(_0xc3d9('0x1'));var timeout=require(_0xc3d9('0x2'));var express=require(_0xc3d9('0x3'));var router=express['Router']();var fs_extra=require(_0xc3d9('0x4'));var auth=require(_0xc3d9('0x5'));var interaction=require(_0xc3d9('0x6'));var config=require(_0xc3d9('0x7'));var controller=require(_0xc3d9('0x8'));router[_0xc3d9('0x9')]('/',auth[_0xc3d9('0xa')](),controller['index']);router[_0xc3d9('0x9')](_0xc3d9('0xb'),auth['isAuthenticated'](),controller[_0xc3d9('0xc')]);router['post']('/',auth[_0xc3d9('0xa')](),controller[_0xc3d9('0xd')]);router[_0xc3d9('0xe')]('/:id',auth[_0xc3d9('0xa')](),controller[_0xc3d9('0xf')]);router['delete'](_0xc3d9('0xb'),auth[_0xc3d9('0xa')](),controller[_0xc3d9('0x10')]);module[_0xc3d9('0x11')]=router; \ No newline at end of file +var _0x765b=['put','/:id','destroy','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create'];(function(_0xb99421,_0xaab133){var _0x4b3ec7=function(_0x591d1a){while(--_0x591d1a){_0xb99421['push'](_0xb99421['shift']());}};_0x4b3ec7(++_0xaab133);}(_0x765b,0x18c));var _0xb765=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x765b[_0x4fde08];return _0x12e725;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb765('0x0'));var express=require('express');var router=express[_0xb765('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xb765('0x2'));var interaction=require(_0xb765('0x3'));var config=require(_0xb765('0x4'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb765('0x5')]('/:id',auth[_0xb765('0x6')](),controller[_0xb765('0x7')]);router[_0xb765('0x8')]('/',auth['isAuthenticated'](),controller[_0xb765('0x9')]);router[_0xb765('0xa')](_0xb765('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xb765('0xb'),auth[_0xb765('0x6')](),controller[_0xb765('0xc')]);module[_0xb765('0xd')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index d26aceb..fd13f8e 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 _0xfee3=['STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist'];(function(_0x1ba43c,_0x5bd2e8){var _0x2f60eb=function(_0x349dff){while(--_0x349dff){_0x1ba43c['push'](_0x1ba43c['shift']());}};_0x2f60eb(++_0x5bd2e8);}(_0xfee3,0xad));var _0x3fee=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0xfee3[_0x576266];return _0x18234f;};'use strict';var Sequelize=require(_0x3fee('0x0'));module[_0x3fee('0x1')]={'type':{'type':Sequelize[_0x3fee('0x2')](_0x3fee('0x3'),_0x3fee('0x4'),'customVariable',_0x3fee('0x5'),_0x3fee('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3fee('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0x3fee('0x4'),_0x3fee('0x8'))},'keyContent':{'type':Sequelize[_0x3fee('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3fee('0x7')]},'customField':{'type':Sequelize[_0x3fee('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3fee('0x7')]}}; \ No newline at end of file +var _0xab90=['ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','exports'];(function(_0x244946,_0x3916d1){var _0x4d1912=function(_0x2f4f85){while(--_0x2f4f85){_0x244946['push'](_0x244946['shift']());}};_0x4d1912(++_0x3916d1);}(_0xab90,0x16f));var _0x0ab9=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xab90[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require('sequelize');module[_0x0ab9('0x0')]={'type':{'type':Sequelize[_0x0ab9('0x1')](_0x0ab9('0x2'),_0x0ab9('0x3'),_0x0ab9('0x4'),'keyValue',_0x0ab9('0x5')),'defaultValue':_0x0ab9('0x2')},'content':{'type':Sequelize[_0x0ab9('0x6')]},'key':{'type':Sequelize[_0x0ab9('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x0ab9('0x2'),_0x0ab9('0x3'),_0x0ab9('0x4'))},'keyContent':{'type':Sequelize[_0x0ab9('0x6')]},'idField':{'type':Sequelize[_0x0ab9('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0ab9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0ab9('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 09a32d4..9bb91ef 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 _0x6954=['map','FreshsalesField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','then','include','rows','show','params','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','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','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','index'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0x6954,0x151));var _0x4695=function(_0x207ee1,_0x3885ce){_0x207ee1=_0x207ee1-0x0;var _0x437189=_0x6954[_0x207ee1];return _0x437189;};'use strict';var emlformat=require(_0x4695('0x0'));var rimraf=require(_0x4695('0x1'));var zipdir=require(_0x4695('0x2'));var jsonpatch=require(_0x4695('0x3'));var rp=require(_0x4695('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4695('0x5'));var util=require(_0x4695('0x6'));var path=require('path');var sox=require(_0x4695('0x7'));var csv=require(_0x4695('0x8'));var ejs=require(_0x4695('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4695('0xa'));var squel=require(_0x4695('0xb'));var crypto=require(_0x4695('0xc'));var jsforce=require(_0x4695('0xd'));var deskjs=require(_0x4695('0xe'));var toCsv=require(_0x4695('0x8'));var querystring=require('querystring');var Papa=require(_0x4695('0xf'));var Redis=require(_0x4695('0x10'));var authService=require(_0x4695('0x11'));var qs=require(_0x4695('0x12'));var as=require(_0x4695('0x13'));var hardwareService=require(_0x4695('0x14'));var logger=require(_0x4695('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x4695('0x16'));var licenseUtil=require(_0x4695('0x17'));var db=require(_0x4695('0x18'))['db'];function respondWithStatusCode(_0x1ec23a,_0x227803){_0x227803=_0x227803||0xcc;return function(_0x2c2054){if(_0x2c2054){return _0x1ec23a[_0x4695('0x19')](_0x227803);}return _0x1ec23a['status'](_0x227803)[_0x4695('0x1a')]();};}function respondWithResult(_0x34ecfd,_0x9d03c6){_0x9d03c6=_0x9d03c6||0xc8;return function(_0x145e4c){if(_0x145e4c){return _0x34ecfd[_0x4695('0x1b')](_0x9d03c6)[_0x4695('0x1c')](_0x145e4c);}};}function respondWithFilteredResult(_0x357fcb,_0x24973d){return function(_0x13fe43){if(_0x13fe43){var _0x5d0688=typeof _0x24973d['offset']===_0x4695('0x1d')&&typeof _0x24973d[_0x4695('0x1e')]===_0x4695('0x1d');var _0x5c7d2d=_0x13fe43[_0x4695('0x1f')];var _0x168311=_0x5d0688?0x0:_0x24973d[_0x4695('0x20')];var _0xc50dc2=_0x5d0688?_0x13fe43['count']:_0x24973d[_0x4695('0x20')]+_0x24973d[_0x4695('0x1e')];var _0x474aec;if(_0xc50dc2>=_0x5c7d2d){_0xc50dc2=_0x5c7d2d;_0x474aec=0xc8;}else{_0x474aec=0xce;}_0x357fcb[_0x4695('0x1b')](_0x474aec);return _0x357fcb[_0x4695('0x21')](_0x4695('0x22'),_0x168311+'-'+_0xc50dc2+'/'+_0x5c7d2d)[_0x4695('0x1c')](_0x13fe43);}return null;};}function patchUpdates(_0xafd1f4){return function(_0x203092){try{jsonpatch[_0x4695('0x23')](_0x203092,_0xafd1f4,!![]);}catch(_0x30ce17){return BPromise[_0x4695('0x24')](_0x30ce17);}return _0x203092[_0x4695('0x25')]();};}function saveUpdates(_0x177dea,_0x3a5fcf){return function(_0xea0d52){if(_0xea0d52){return _0xea0d52['update'](_0x177dea)['then'](function(_0x329e23){return _0x329e23;});}return null;};}function removeEntity(_0x52c8d7,_0x3bbb48){return function(_0x518ed8){if(_0x518ed8){return _0x518ed8[_0x4695('0x26')]()['then'](function(){_0x52c8d7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39d78c,_0x22c912){return function(_0x51f6cf){if(!_0x51f6cf){_0x39d78c['sendStatus'](0x194);}return _0x51f6cf;};}function handleError(_0x2dc4cd,_0x446ece){_0x446ece=_0x446ece||0x1f4;return function(_0x37e9e3){logger['error'](_0x37e9e3[_0x4695('0x27')]);if(_0x37e9e3[_0x4695('0x28')]){delete _0x37e9e3[_0x4695('0x28')];}_0x2dc4cd['status'](_0x446ece)[_0x4695('0x29')](_0x37e9e3);};}exports[_0x4695('0x2a')]=function(_0x556110,_0x27382f){var _0x24a77e={},_0x558ea6={},_0xda07bc={'count':0x0,'rows':[]};var _0x35b5f4=_[_0x4695('0x2b')](db[_0x4695('0x2c')][_0x4695('0x2d')],function(_0x32a2ee){return{'name':_0x32a2ee[_0x4695('0x2e')],'type':_0x32a2ee[_0x4695('0x2f')][_0x4695('0x30')]};});_0x558ea6[_0x4695('0x31')]=_[_0x4695('0x2b')](_0x35b5f4,_0x4695('0x28'));_0x558ea6['query']=_[_0x4695('0x32')](_0x556110[_0x4695('0x33')]);_0x558ea6[_0x4695('0x34')]=_[_0x4695('0x35')](_0x558ea6[_0x4695('0x31')],_0x558ea6['query']);_0x24a77e[_0x4695('0x36')]=_['intersection'](_0x558ea6['model'],qs[_0x4695('0x37')](_0x556110[_0x4695('0x33')][_0x4695('0x37')]));_0x24a77e[_0x4695('0x36')]=_0x24a77e['attributes'][_0x4695('0x38')]?_0x24a77e['attributes']:_0x558ea6['model'];if(!_0x556110['query'][_0x4695('0x39')](_0x4695('0x3a'))){_0x24a77e[_0x4695('0x1e')]=qs['limit'](_0x556110[_0x4695('0x33')][_0x4695('0x1e')]);_0x24a77e[_0x4695('0x20')]=qs[_0x4695('0x20')](_0x556110[_0x4695('0x33')]['offset']);}_0x24a77e['order']=qs[_0x4695('0x3b')](_0x556110[_0x4695('0x33')][_0x4695('0x3b')]);_0x24a77e['where']=qs[_0x4695('0x34')](_[_0x4695('0x3c')](_0x556110['query'],_0x558ea6['filters']),_0x35b5f4);if(_0x556110[_0x4695('0x33')][_0x4695('0x3d')]){_0x24a77e[_0x4695('0x3e')]=_[_0x4695('0x3f')](_0x24a77e['where'],{'$or':_['map'](_0x35b5f4,function(_0x31aad9){if(_0x31aad9[_0x4695('0x2f')]!==_0x4695('0x40')){var _0x1a7047={};_0x1a7047[_0x31aad9[_0x4695('0x28')]]={'$like':'%'+_0x556110[_0x4695('0x33')][_0x4695('0x3d')]+'%'};return _0x1a7047;}})});}_0x24a77e=_[_0x4695('0x3f')]({},_0x24a77e,_0x556110[_0x4695('0x41')]);var _0x3d9249={'where':_0x24a77e[_0x4695('0x3e')]};return db['FreshsalesField'][_0x4695('0x1f')](_0x3d9249)[_0x4695('0x42')](function(_0x47a1d9){_0xda07bc[_0x4695('0x1f')]=_0x47a1d9;if(_0x556110[_0x4695('0x33')]['includeAll']){_0x24a77e[_0x4695('0x43')]=[{'all':!![]}];}return db[_0x4695('0x2c')]['findAll'](_0x24a77e);})[_0x4695('0x42')](function(_0x37028a){_0xda07bc[_0x4695('0x44')]=_0x37028a;return _0xda07bc;})[_0x4695('0x42')](respondWithFilteredResult(_0x27382f,_0x24a77e))['catch'](handleError(_0x27382f,null));};exports[_0x4695('0x45')]=function(_0x5ce467,_0x15960c){var _0xe4196f={'raw':!![],'where':{'id':_0x5ce467[_0x4695('0x46')]['id']}},_0x3f08e7={};_0x3f08e7[_0x4695('0x31')]=_[_0x4695('0x32')](db[_0x4695('0x2c')][_0x4695('0x2d')]);_0x3f08e7['query']=_[_0x4695('0x32')](_0x5ce467['query']);_0x3f08e7[_0x4695('0x34')]=_['intersection'](_0x3f08e7[_0x4695('0x31')],_0x3f08e7[_0x4695('0x33')]);_0xe4196f[_0x4695('0x36')]=_['intersection'](_0x3f08e7[_0x4695('0x31')],qs[_0x4695('0x37')](_0x5ce467[_0x4695('0x33')]['fields']));_0xe4196f['attributes']=_0xe4196f[_0x4695('0x36')]['length']?_0xe4196f[_0x4695('0x36')]:_0x3f08e7[_0x4695('0x31')];if(_0x5ce467['query']['includeAll']){_0xe4196f[_0x4695('0x43')]=[{'all':!![]}];}_0xe4196f=_[_0x4695('0x3f')]({},_0xe4196f,_0x5ce467[_0x4695('0x41')]);return db[_0x4695('0x2c')][_0x4695('0x47')](_0xe4196f)[_0x4695('0x42')](handleEntityNotFound(_0x15960c,null))[_0x4695('0x42')](respondWithResult(_0x15960c,null))[_0x4695('0x48')](handleError(_0x15960c,null));};exports[_0x4695('0x49')]=function(_0x5bf9ce,_0x2860d3){return db['FreshsalesField'][_0x4695('0x49')](_0x5bf9ce[_0x4695('0x4a')],{})[_0x4695('0x42')](respondWithResult(_0x2860d3,0xc9))[_0x4695('0x48')](handleError(_0x2860d3,null));};exports[_0x4695('0x4b')]=function(_0x34931a,_0x5033c0){if(_0x34931a[_0x4695('0x4a')]['id']){delete _0x34931a['body']['id'];}return db[_0x4695('0x2c')]['find']({'where':{'id':_0x34931a[_0x4695('0x46')]['id']}})[_0x4695('0x42')](handleEntityNotFound(_0x5033c0,null))[_0x4695('0x42')](saveUpdates(_0x34931a[_0x4695('0x4a')],null))[_0x4695('0x42')](respondWithResult(_0x5033c0,null))[_0x4695('0x48')](handleError(_0x5033c0,null));};exports['destroy']=function(_0x39823e,_0x1cea97){return db[_0x4695('0x2c')]['find']({'where':{'id':_0x39823e[_0x4695('0x46')]['id']}})[_0x4695('0x42')](handleEntityNotFound(_0x1cea97,null))['then'](removeEntity(_0x1cea97,null))[_0x4695('0x48')](handleError(_0x1cea97,null));}; \ No newline at end of file +var _0x52df=['eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','end','json','undefined','limit','count','offset','set','apply','reject','update','destroy','then','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','FreshsalesField','includeAll','include','findAll','rows','catch','show','length','create','body','find','params'];(function(_0x4bd889,_0x450a00){var _0x2e1c49=function(_0x3a17b7){while(--_0x3a17b7){_0x4bd889['push'](_0x4bd889['shift']());}};_0x2e1c49(++_0x450a00);}(_0x52df,0x124));var _0xf52d=function(_0x15da60,_0x3661df){_0x15da60=_0x15da60-0x0;var _0x2709bc=_0x52df[_0x15da60];return _0x2709bc;};'use strict';var emlformat=require(_0xf52d('0x0'));var rimraf=require(_0xf52d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf52d('0x2'));var rp=require('request-promise');var moment=require(_0xf52d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf52d('0x4'));var util=require(_0xf52d('0x5'));var path=require(_0xf52d('0x6'));var sox=require(_0xf52d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf52d('0x8'));var _=require(_0xf52d('0x9'));var squel=require(_0xf52d('0xa'));var crypto=require(_0xf52d('0xb'));var jsforce=require(_0xf52d('0xc'));var deskjs=require(_0xf52d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf52d('0xe'));var Papa=require(_0xf52d('0xf'));var Redis=require(_0xf52d('0x10'));var authService=require(_0xf52d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf52d('0x12'));var hardwareService=require(_0xf52d('0x13'));var logger=require(_0xf52d('0x14'))('api');var utils=require(_0xf52d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf52d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51350f,_0x2b8d87){_0x2b8d87=_0x2b8d87||0xcc;return function(_0x451863){if(_0x451863){return _0x51350f['sendStatus'](_0x2b8d87);}return _0x51350f[_0xf52d('0x17')](_0x2b8d87)[_0xf52d('0x18')]();};}function respondWithResult(_0xa42e22,_0x858ae1){_0x858ae1=_0x858ae1||0xc8;return function(_0x15a775){if(_0x15a775){return _0xa42e22[_0xf52d('0x17')](_0x858ae1)[_0xf52d('0x19')](_0x15a775);}};}function respondWithFilteredResult(_0x483899,_0x57ef1d){return function(_0x15e6ec){if(_0x15e6ec){var _0xaa6789=typeof _0x57ef1d['offset']===_0xf52d('0x1a')&&typeof _0x57ef1d[_0xf52d('0x1b')]==='undefined';var _0x767c9c=_0x15e6ec[_0xf52d('0x1c')];var _0x1442d8=_0xaa6789?0x0:_0x57ef1d[_0xf52d('0x1d')];var _0x4ae87f=_0xaa6789?_0x15e6ec['count']:_0x57ef1d[_0xf52d('0x1d')]+_0x57ef1d[_0xf52d('0x1b')];var _0x249640;if(_0x4ae87f>=_0x767c9c){_0x4ae87f=_0x767c9c;_0x249640=0xc8;}else{_0x249640=0xce;}_0x483899[_0xf52d('0x17')](_0x249640);return _0x483899[_0xf52d('0x1e')]('Content-Range',_0x1442d8+'-'+_0x4ae87f+'/'+_0x767c9c)[_0xf52d('0x19')](_0x15e6ec);}return null;};}function patchUpdates(_0x30de36){return function(_0x521718){try{jsonpatch[_0xf52d('0x1f')](_0x521718,_0x30de36,!![]);}catch(_0x5448c4){return BPromise[_0xf52d('0x20')](_0x5448c4);}return _0x521718['save']();};}function saveUpdates(_0x43451d,_0xd59de2){return function(_0x54d992){if(_0x54d992){return _0x54d992[_0xf52d('0x21')](_0x43451d)['then'](function(_0x349ef7){return _0x349ef7;});}return null;};}function removeEntity(_0x1f41e3,_0x152d5f){return function(_0x164b83){if(_0x164b83){return _0x164b83[_0xf52d('0x22')]()[_0xf52d('0x23')](function(){_0x1f41e3[_0xf52d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12dd00,_0x1ffc44){return function(_0x200966){if(!_0x200966){_0x12dd00[_0xf52d('0x24')](0x194);}return _0x200966;};}function handleError(_0x4d9317,_0x42bdc3){_0x42bdc3=_0x42bdc3||0x1f4;return function(_0x5c7c15){logger['error'](_0x5c7c15[_0xf52d('0x25')]);if(_0x5c7c15['name']){delete _0x5c7c15[_0xf52d('0x26')];}_0x4d9317['status'](_0x42bdc3)['send'](_0x5c7c15);};}exports[_0xf52d('0x27')]=function(_0x319d05,_0x5353f4){var _0x3fc30d={},_0x2b4b6c={},_0x2e9b5a={'count':0x0,'rows':[]};var _0x5ca846=_[_0xf52d('0x28')](db['FreshsalesField'][_0xf52d('0x29')],function(_0x1af9fc){return{'name':_0x1af9fc[_0xf52d('0x2a')],'type':_0x1af9fc[_0xf52d('0x2b')][_0xf52d('0x2c')]};});_0x2b4b6c[_0xf52d('0x2d')]=_['map'](_0x5ca846,_0xf52d('0x26'));_0x2b4b6c['query']=_[_0xf52d('0x2e')](_0x319d05[_0xf52d('0x2f')]);_0x2b4b6c[_0xf52d('0x30')]=_[_0xf52d('0x31')](_0x2b4b6c[_0xf52d('0x2d')],_0x2b4b6c[_0xf52d('0x2f')]);_0x3fc30d['attributes']=_[_0xf52d('0x31')](_0x2b4b6c['model'],qs['fields'](_0x319d05['query'][_0xf52d('0x32')]));_0x3fc30d[_0xf52d('0x33')]=_0x3fc30d[_0xf52d('0x33')]['length']?_0x3fc30d[_0xf52d('0x33')]:_0x2b4b6c['model'];if(!_0x319d05['query'][_0xf52d('0x34')]('nolimit')){_0x3fc30d['limit']=qs[_0xf52d('0x1b')](_0x319d05[_0xf52d('0x2f')][_0xf52d('0x1b')]);_0x3fc30d[_0xf52d('0x1d')]=qs[_0xf52d('0x1d')](_0x319d05[_0xf52d('0x2f')][_0xf52d('0x1d')]);}_0x3fc30d[_0xf52d('0x35')]=qs[_0xf52d('0x36')](_0x319d05['query'][_0xf52d('0x36')]);_0x3fc30d[_0xf52d('0x37')]=qs[_0xf52d('0x30')](_[_0xf52d('0x38')](_0x319d05[_0xf52d('0x2f')],_0x2b4b6c[_0xf52d('0x30')]),_0x5ca846);if(_0x319d05[_0xf52d('0x2f')]['filter']){_0x3fc30d[_0xf52d('0x37')]=_[_0xf52d('0x39')](_0x3fc30d[_0xf52d('0x37')],{'$or':_['map'](_0x5ca846,function(_0x1ee9a2){if(_0x1ee9a2[_0xf52d('0x2b')]!==_0xf52d('0x3a')){var _0x29c247={};_0x29c247[_0x1ee9a2[_0xf52d('0x26')]]={'$like':'%'+_0x319d05[_0xf52d('0x2f')][_0xf52d('0x3b')]+'%'};return _0x29c247;}})});}_0x3fc30d=_['merge']({},_0x3fc30d,_0x319d05[_0xf52d('0x3c')]);var _0x3be084={'where':_0x3fc30d[_0xf52d('0x37')]};return db[_0xf52d('0x3d')]['count'](_0x3be084)[_0xf52d('0x23')](function(_0x4f6240){_0x2e9b5a[_0xf52d('0x1c')]=_0x4f6240;if(_0x319d05['query'][_0xf52d('0x3e')]){_0x3fc30d[_0xf52d('0x3f')]=[{'all':!![]}];}return db[_0xf52d('0x3d')][_0xf52d('0x40')](_0x3fc30d);})[_0xf52d('0x23')](function(_0x5a6ac2){_0x2e9b5a[_0xf52d('0x41')]=_0x5a6ac2;return _0x2e9b5a;})[_0xf52d('0x23')](respondWithFilteredResult(_0x5353f4,_0x3fc30d))[_0xf52d('0x42')](handleError(_0x5353f4,null));};exports[_0xf52d('0x43')]=function(_0x1f76c0,_0x5b333c){var _0x2e6d10={'raw':!![],'where':{'id':_0x1f76c0['params']['id']}},_0x26d990={};_0x26d990[_0xf52d('0x2d')]=_[_0xf52d('0x2e')](db['FreshsalesField'][_0xf52d('0x29')]);_0x26d990['query']=_[_0xf52d('0x2e')](_0x1f76c0[_0xf52d('0x2f')]);_0x26d990[_0xf52d('0x30')]=_[_0xf52d('0x31')](_0x26d990['model'],_0x26d990[_0xf52d('0x2f')]);_0x2e6d10[_0xf52d('0x33')]=_[_0xf52d('0x31')](_0x26d990[_0xf52d('0x2d')],qs[_0xf52d('0x32')](_0x1f76c0[_0xf52d('0x2f')][_0xf52d('0x32')]));_0x2e6d10[_0xf52d('0x33')]=_0x2e6d10[_0xf52d('0x33')][_0xf52d('0x44')]?_0x2e6d10['attributes']:_0x26d990['model'];if(_0x1f76c0[_0xf52d('0x2f')][_0xf52d('0x3e')]){_0x2e6d10[_0xf52d('0x3f')]=[{'all':!![]}];}_0x2e6d10=_[_0xf52d('0x39')]({},_0x2e6d10,_0x1f76c0['options']);return db['FreshsalesField']['find'](_0x2e6d10)[_0xf52d('0x23')](handleEntityNotFound(_0x5b333c,null))[_0xf52d('0x23')](respondWithResult(_0x5b333c,null))[_0xf52d('0x42')](handleError(_0x5b333c,null));};exports[_0xf52d('0x45')]=function(_0x11a12f,_0x4a3738){return db['FreshsalesField'][_0xf52d('0x45')](_0x11a12f['body'],{})[_0xf52d('0x23')](respondWithResult(_0x4a3738,0xc9))['catch'](handleError(_0x4a3738,null));};exports[_0xf52d('0x21')]=function(_0x5ed201,_0x10623d){if(_0x5ed201[_0xf52d('0x46')]['id']){delete _0x5ed201[_0xf52d('0x46')]['id'];}return db[_0xf52d('0x3d')][_0xf52d('0x47')]({'where':{'id':_0x5ed201[_0xf52d('0x48')]['id']}})['then'](handleEntityNotFound(_0x10623d,null))[_0xf52d('0x23')](saveUpdates(_0x5ed201['body'],null))[_0xf52d('0x23')](respondWithResult(_0x10623d,null))[_0xf52d('0x42')](handleError(_0x10623d,null));};exports[_0xf52d('0x22')]=function(_0x511e7c,_0x5f3279){return db[_0xf52d('0x3d')]['find']({'where':{'id':_0x511e7c[_0xf52d('0x48')]['id']}})[_0xf52d('0x23')](handleEntityNotFound(_0x5f3279,null))[_0xf52d('0x23')](removeEntity(_0x5f3279,null))[_0xf52d('0x42')](handleError(_0x5f3279,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index f2f2bf5..d8627b8 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 _0x0ac0=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util'];(function(_0x543341,_0xa88981){var _0x221087=function(_0x2a57d7){while(--_0x2a57d7){_0x543341['push'](_0x543341['shift']());}};_0x221087(++_0xa88981);}(_0x0ac0,0x130));var _0x00ac=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x0ac0[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0x00ac('0x0'));var util=require(_0x00ac('0x1'));var logger=require(_0x00ac('0x2'))('api');var moment=require(_0x00ac('0x3'));var BPromise=require(_0x00ac('0x4'));var rp=require(_0x00ac('0x5'));var fs=require('fs');var path=require(_0x00ac('0x6'));var rimraf=require(_0x00ac('0x7'));var config=require(_0x00ac('0x8'));var attributes=require(_0x00ac('0x9'));module[_0x00ac('0xa')]=function(_0x4caaa8,_0x464817){return _0x4caaa8[_0x00ac('0xb')](_0x00ac('0xc'),attributes,{'tableName':_0x00ac('0xd'),'paranoid':![],'indexes':[{'name':_0x00ac('0xe'),'fields':[_0x00ac('0xf'),_0x00ac('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x235b=['int_freshsales_fields','freshsales_unique_index','idField','lodash','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesField.attributes','exports','define','FreshsalesField'];(function(_0x281db3,_0x1fb084){var _0x4db4a2=function(_0x965e8f){while(--_0x965e8f){_0x281db3['push'](_0x281db3['shift']());}};_0x4db4a2(++_0x1fb084);}(_0x235b,0x1ed));var _0xb235=function(_0x408e21,_0x407fcd){_0x408e21=_0x408e21-0x0;var _0x162aec=_0x235b[_0x408e21];return _0x162aec;};'use strict';var _=require(_0xb235('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb235('0x1'));var moment=require(_0xb235('0x2'));var BPromise=require(_0xb235('0x3'));var rp=require(_0xb235('0x4'));var fs=require('fs');var path=require(_0xb235('0x5'));var rimraf=require(_0xb235('0x6'));var config=require('../../config/environment');var attributes=require(_0xb235('0x7'));module[_0xb235('0x8')]=function(_0x334353,_0x5298de){return _0x334353[_0xb235('0x9')](_0xb235('0xa'),attributes,{'tableName':_0xb235('0xb'),'paranoid':![],'indexes':[{'name':_0xb235('0xc'),'fields':[_0xb235('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 24b9498..45e3ed1 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 _0x5496=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x53f7aa,_0x71f52a){var _0x5851f3=function(_0x3108ee){while(--_0x3108ee){_0x53f7aa['push'](_0x53f7aa['shift']());}};_0x5851f3(++_0x71f52a);}(_0x5496,0x175));var _0x6549=function(_0x263c7d,_0x5031cd){_0x263c7d=_0x263c7d-0x0;var _0x4edc23=_0x5496[_0x263c7d];return _0x4edc23;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var moment=require(_0x6549('0x2'));var BPromise=require(_0x6549('0x3'));var rs=require(_0x6549('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6549('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6549('0x6'))(_0x6549('0x7'));var config=require(_0x6549('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6549('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d8cea,_0x4fcffd,_0x1ca8fc){return new BPromise(function(_0x3442c3,_0x1ef2a6){return client['request'](_0x1d8cea,_0x1ca8fc)[_0x6549('0xa')](function(_0x35d008){logger[_0x6549('0xb')](_0x6549('0xc'),_0x4fcffd,_0x6549('0xd'));logger[_0x6549('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x4fcffd,'request\x20sent',JSON[_0x6549('0xf')](_0x35d008));if(_0x35d008[_0x6549('0x10')]){if(_0x35d008[_0x6549('0x10')][_0x6549('0x11')]===0x1f4){logger[_0x6549('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x4fcffd,_0x35d008['error'][_0x6549('0x12')]);return _0x1ef2a6(_0x35d008[_0x6549('0x10')]['message']);}logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);return _0x3442c3(_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x4fcffd,_0x6549('0xd'));_0x3442c3(_0x35d008[_0x6549('0x13')]['message']);}})[_0x6549('0x14')](function(_0x67acc0){logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x67acc0);_0x1ef2a6(_0x67acc0);});});} \ No newline at end of file +var _0x1967=['then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x1967,0x173));var _0x7196=function(_0x1bc15c,_0x558b4a){_0x1bc15c=_0x1bc15c-0x0;var _0x4115e2=_0x1967[_0x1bc15c];return _0x4115e2;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index b415c78..1d371eb 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(_0x2705e7,_0x26ea82){var _0x4688eb=function(_0x5d6cd0){while(--_0x5d6cd0){_0x2705e7['push'](_0x2705e7['shift']());}};_0x4688eb(++_0x26ea82);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x4611dc,_0x26a568){var _0x4448ff=function(_0x2b48ab){while(--_0x2b48ab){_0x4611dc['push'](_0x4611dc['shift']());}};_0x4448ff(++_0x26a568);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 6c971e4..5347929 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 _0x68fd=['STRING','username','ENUM','integrationTab','sequelize'];(function(_0x54f3e8,_0x3ed493){var _0x267b37=function(_0x58247e){while(--_0x58247e){_0x54f3e8['push'](_0x54f3e8['shift']());}};_0x267b37(++_0x3ed493);}(_0x68fd,0x1e9));var _0xd68f=function(_0xe7fb45,_0x3d0181){_0xe7fb45=_0xe7fb45-0x0;var _0x11928a=_0x68fd[_0xe7fb45];return _0x11928a;};'use strict';var Sequelize=require(_0xd68f('0x0'));module['exports']={'name':{'type':Sequelize[_0xd68f('0x1')]},'description':{'type':Sequelize[_0xd68f('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xd68f('0x2')},'remoteUri':{'type':Sequelize[_0xd68f('0x1')]},'password':{'type':Sequelize[_0xd68f('0x1')]},'clientId':{'type':Sequelize[_0xd68f('0x1')]},'clientSecret':{'type':Sequelize[_0xd68f('0x1')]},'securityToken':{'type':Sequelize[_0xd68f('0x1')]},'serverUrl':{'type':Sequelize[_0xd68f('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xd68f('0x3')](_0xd68f('0x4'),'newTab'),'defaultValue':_0xd68f('0x4')}}; \ No newline at end of file +var _0xcdc2=['STRING','username','newTab','sequelize','exports'];(function(_0x42d5d6,_0xea30c2){var _0x555237=function(_0x1d16ae){while(--_0x1d16ae){_0x42d5d6['push'](_0x42d5d6['shift']());}};_0x555237(++_0xea30c2);}(_0xcdc2,0x19d));var _0x2cdc=function(_0x1a538b,_0x2fb4d8){_0x1a538b=_0x1a538b-0x0;var _0x58db78=_0xcdc2[_0x1a538b];return _0x58db78;};'use strict';var Sequelize=require(_0x2cdc('0x0'));module[_0x2cdc('0x1')]={'name':{'type':Sequelize[_0x2cdc('0x2')]},'description':{'type':Sequelize[_0x2cdc('0x2')]},'username':{'type':Sequelize[_0x2cdc('0x2')],'unique':_0x2cdc('0x3')},'remoteUri':{'type':Sequelize[_0x2cdc('0x2')]},'password':{'type':Sequelize[_0x2cdc('0x2')]},'clientId':{'type':Sequelize[_0x2cdc('0x2')]},'clientSecret':{'type':Sequelize[_0x2cdc('0x2')]},'securityToken':{'type':Sequelize[_0x2cdc('0x2')]},'serverUrl':{'type':Sequelize[_0x2cdc('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x2cdc('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index c1ddee2..f16b721 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 _0xee7f=['username','slice','substring','lastIndexOf','Connection','password','concat','securityToken','isNil','ticketType','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','boolean','email','textarea','phone','remove','includes','custom','picklistValues','label','value','True','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','params','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','Subjects','channel','Descriptions','getDescriptions','SalesforceField','Task','remoteUri','clientId','clientSecret'];(function(_0x39010b,_0x17e844){var _0x3d8797=function(_0x33924a){while(--_0x33924a){_0x39010b['push'](_0x39010b['shift']());}};_0x3d8797(++_0x17e844);}(_0xee7f,0x115));var _0xfee7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xee7f[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xfee7('0x0'));var rimraf=require(_0xfee7('0x1'));var zipdir=require(_0xfee7('0x2'));var jsonpatch=require(_0xfee7('0x3'));var rp=require(_0xfee7('0x4'));var moment=require(_0xfee7('0x5'));var BPromise=require(_0xfee7('0x6'));var Mustache=require(_0xfee7('0x7'));var util=require(_0xfee7('0x8'));var path=require(_0xfee7('0x9'));var sox=require('sox');var csv=require(_0xfee7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfee7('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfee7('0xc'));var jsforce=require(_0xfee7('0xd'));var deskjs=require(_0xfee7('0xe'));var toCsv=require(_0xfee7('0xa'));var querystring=require('querystring');var Papa=require(_0xfee7('0xf'));var Redis=require(_0xfee7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfee7('0x11'));var as=require(_0xfee7('0x12'));var hardwareService=require(_0xfee7('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xfee7('0x14'));var config=require(_0xfee7('0x15'));var licenseUtil=require(_0xfee7('0x16'));var db=require(_0xfee7('0x17'))['db'];var integrations=require(_0xfee7('0x18'));function respondWithStatusCode(_0x10ae90,_0x186ff1){_0x186ff1=_0x186ff1||0xcc;return function(_0x2ef989){if(_0x2ef989){return _0x10ae90[_0xfee7('0x19')](_0x186ff1);}return _0x10ae90[_0xfee7('0x1a')](_0x186ff1)[_0xfee7('0x1b')]();};}function respondWithResult(_0x35df05,_0x1ad412){_0x1ad412=_0x1ad412||0xc8;return function(_0x20b562){if(_0x20b562){return _0x35df05[_0xfee7('0x1a')](_0x1ad412)[_0xfee7('0x1c')](_0x20b562);}};}function respondWithFilteredResult(_0x460174,_0x11f82a){return function(_0xe341fb){if(_0xe341fb){var _0x1ac299=typeof _0x11f82a[_0xfee7('0x1d')]===_0xfee7('0x1e')&&typeof _0x11f82a[_0xfee7('0x1f')]===_0xfee7('0x1e');var _0x5deec8=_0xe341fb[_0xfee7('0x20')];var _0xb92193=_0x1ac299?0x0:_0x11f82a[_0xfee7('0x1d')];var _0x22586d=_0x1ac299?_0xe341fb[_0xfee7('0x20')]:_0x11f82a[_0xfee7('0x1d')]+_0x11f82a['limit'];var _0x3591f6;if(_0x22586d>=_0x5deec8){_0x22586d=_0x5deec8;_0x3591f6=0xc8;}else{_0x3591f6=0xce;}_0x460174[_0xfee7('0x1a')](_0x3591f6);return _0x460174[_0xfee7('0x21')]('Content-Range',_0xb92193+'-'+_0x22586d+'/'+_0x5deec8)[_0xfee7('0x1c')](_0xe341fb);}return null;};}function patchUpdates(_0x4fcb11){return function(_0x3b415c){try{jsonpatch[_0xfee7('0x22')](_0x3b415c,_0x4fcb11,!![]);}catch(_0x5b130c){return BPromise[_0xfee7('0x23')](_0x5b130c);}return _0x3b415c['save']();};}function saveUpdates(_0x372399,_0x4813ed){return function(_0x57ecac){if(_0x57ecac){return _0x57ecac[_0xfee7('0x24')](_0x372399)[_0xfee7('0x25')](function(_0x54897b){return _0x54897b;});}return null;};}function removeEntity(_0x4004b7,_0x5b2105){return function(_0x193c8f){if(_0x193c8f){return _0x193c8f[_0xfee7('0x26')]()['then'](function(){_0x4004b7[_0xfee7('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ff981,_0x3333f9){return function(_0x5ac112){if(!_0x5ac112){_0x3ff981[_0xfee7('0x19')](0x194);}return _0x5ac112;};}function handleError(_0x3ca0d8,_0xd05783){_0xd05783=_0xd05783||0x1f4;return function(_0xf68937){logger[_0xfee7('0x27')](_0xf68937[_0xfee7('0x28')]);if(_0xf68937['name']){delete _0xf68937['name'];}_0x3ca0d8[_0xfee7('0x1a')](_0xd05783)[_0xfee7('0x29')](_0xf68937);};}exports[_0xfee7('0x2a')]=function(_0x4ce113,_0x3efcb7){var _0x5f4c2c={},_0x2ce039={},_0x21c597={'count':0x0,'rows':[]};var _0x5cd8d8=_[_0xfee7('0x2b')](db[_0xfee7('0x2c')][_0xfee7('0x2d')],function(_0x5cb32a){return{'name':_0x5cb32a[_0xfee7('0x2e')],'type':_0x5cb32a[_0xfee7('0x2f')][_0xfee7('0x30')]};});_0x2ce039[_0xfee7('0x31')]=_[_0xfee7('0x2b')](_0x5cd8d8,_0xfee7('0x32'));_0x2ce039['query']=_[_0xfee7('0x33')](_0x4ce113[_0xfee7('0x34')]);_0x2ce039[_0xfee7('0x35')]=_[_0xfee7('0x36')](_0x2ce039[_0xfee7('0x31')],_0x2ce039['query']);_0x5f4c2c['attributes']=_[_0xfee7('0x36')](_0x2ce039[_0xfee7('0x31')],qs['fields'](_0x4ce113[_0xfee7('0x34')][_0xfee7('0x37')]));_0x5f4c2c['attributes']=_0x5f4c2c[_0xfee7('0x38')][_0xfee7('0x39')]?_0x5f4c2c['attributes']:_0x2ce039[_0xfee7('0x31')];if(!_0x4ce113['query'][_0xfee7('0x3a')](_0xfee7('0x3b'))){_0x5f4c2c[_0xfee7('0x1f')]=qs[_0xfee7('0x1f')](_0x4ce113['query']['limit']);_0x5f4c2c[_0xfee7('0x1d')]=qs['offset'](_0x4ce113['query']['offset']);}_0x5f4c2c['order']=qs[_0xfee7('0x3c')](_0x4ce113[_0xfee7('0x34')][_0xfee7('0x3c')]);_0x5f4c2c[_0xfee7('0x3d')]=qs['filters'](_[_0xfee7('0x3e')](_0x4ce113['query'],_0x2ce039[_0xfee7('0x35')]),_0x5cd8d8);if(_0x4ce113[_0xfee7('0x34')][_0xfee7('0x3f')]){_0x5f4c2c[_0xfee7('0x3d')]=_[_0xfee7('0x40')](_0x5f4c2c['where'],{'$or':_[_0xfee7('0x2b')](_0x5cd8d8,function(_0x42ea0c){if(_0x42ea0c[_0xfee7('0x2f')]!==_0xfee7('0x41')){var _0x3452d0={};_0x3452d0[_0x42ea0c[_0xfee7('0x32')]]={'$like':'%'+_0x4ce113[_0xfee7('0x34')]['filter']+'%'};return _0x3452d0;}})});}_0x5f4c2c=_['merge']({},_0x5f4c2c,_0x4ce113[_0xfee7('0x42')]);var _0x5b2b61={'where':_0x5f4c2c['where']};return db[_0xfee7('0x2c')]['count'](_0x5b2b61)[_0xfee7('0x25')](function(_0x10cc2a){_0x21c597[_0xfee7('0x20')]=_0x10cc2a;if(_0x4ce113[_0xfee7('0x34')][_0xfee7('0x43')]){_0x5f4c2c[_0xfee7('0x44')]=[{'all':!![]}];}return db[_0xfee7('0x2c')][_0xfee7('0x45')](_0x5f4c2c);})['then'](function(_0x468f56){_0x21c597[_0xfee7('0x46')]=_0x468f56;return _0x21c597;})[_0xfee7('0x25')](respondWithFilteredResult(_0x3efcb7,_0x5f4c2c))[_0xfee7('0x47')](handleError(_0x3efcb7,null));};exports['show']=function(_0x2c291d,_0x49bb6b){var _0x581f7d={'raw':![],'where':{'id':_0x2c291d['params']['id']}},_0x5c17d5={};_0x5c17d5[_0xfee7('0x31')]=_['keys'](db[_0xfee7('0x2c')][_0xfee7('0x2d')]);_0x5c17d5[_0xfee7('0x34')]=_['keys'](_0x2c291d[_0xfee7('0x34')]);_0x5c17d5['filters']=_['intersection'](_0x5c17d5['model'],_0x5c17d5[_0xfee7('0x34')]);_0x581f7d[_0xfee7('0x38')]=_[_0xfee7('0x36')](_0x5c17d5['model'],qs['fields'](_0x2c291d[_0xfee7('0x34')][_0xfee7('0x37')]));_0x581f7d[_0xfee7('0x38')]=_0x581f7d['attributes'][_0xfee7('0x39')]?_0x581f7d['attributes']:_0x5c17d5['model'];if(_0x2c291d[_0xfee7('0x34')][_0xfee7('0x43')]){_0x581f7d[_0xfee7('0x44')]=[{'all':!![]}];}_0x581f7d=_[_0xfee7('0x40')]({},_0x581f7d,_0x2c291d[_0xfee7('0x42')]);return db[_0xfee7('0x2c')][_0xfee7('0x48')](_0x581f7d)[_0xfee7('0x25')](handleEntityNotFound(_0x49bb6b,null))[_0xfee7('0x25')](respondWithResult(_0x49bb6b,null))[_0xfee7('0x47')](handleError(_0x49bb6b,null));};exports[_0xfee7('0x49')]=function(_0x717305,_0x14dc30){return db[_0xfee7('0x2c')][_0xfee7('0x49')](_0x717305['body'],{})['then'](respondWithResult(_0x14dc30,0xc9))[_0xfee7('0x47')](handleError(_0x14dc30,null));};exports[_0xfee7('0x24')]=function(_0x19c567,_0x587aa9){if(_0x19c567[_0xfee7('0x4a')]['id']){delete _0x19c567[_0xfee7('0x4a')]['id'];}return db[_0xfee7('0x2c')][_0xfee7('0x48')]({'where':{'id':_0x19c567['params']['id']}})['then'](handleEntityNotFound(_0x587aa9,null))[_0xfee7('0x25')](saveUpdates(_0x19c567[_0xfee7('0x4a')],null))[_0xfee7('0x25')](respondWithResult(_0x587aa9,null))[_0xfee7('0x47')](handleError(_0x587aa9,null));};exports[_0xfee7('0x26')]=function(_0x33bb18,_0x5321cc){return db[_0xfee7('0x2c')][_0xfee7('0x48')]({'where':{'id':_0x33bb18[_0xfee7('0x4b')]['id']}})[_0xfee7('0x25')](handleEntityNotFound(_0x5321cc,null))[_0xfee7('0x25')](removeEntity(_0x5321cc,null))[_0xfee7('0x47')](handleError(_0x5321cc,null));};exports[_0xfee7('0x4c')]=function(_0x2b68d9,_0x2857c0,_0x376d58){var _0x29bcd8={};var _0xa35a83={};var _0x26b92b;var _0x4d05b0;return db[_0xfee7('0x2c')][_0xfee7('0x4d')]({'where':{'id':_0x2b68d9['params']['id']}})[_0xfee7('0x25')](handleEntityNotFound(_0x2857c0,null))[_0xfee7('0x25')](function(_0x57f5b2){if(_0x57f5b2){_0x26b92b=_0x57f5b2;_0xa35a83[_0xfee7('0x31')]=_[_0xfee7('0x33')](db[_0xfee7('0x4e')]['rawAttributes']);_0xa35a83[_0xfee7('0x34')]=_[_0xfee7('0x33')](_0x2b68d9[_0xfee7('0x34')]);_0xa35a83[_0xfee7('0x35')]=_[_0xfee7('0x36')](_0xa35a83[_0xfee7('0x31')],_0xa35a83[_0xfee7('0x34')]);_0x29bcd8['attributes']=_['intersection'](_0xa35a83['model'],qs[_0xfee7('0x37')](_0x2b68d9['query'][_0xfee7('0x37')]));_0x29bcd8[_0xfee7('0x38')]=_0x29bcd8['attributes'][_0xfee7('0x39')]?_0x29bcd8[_0xfee7('0x38')]:_0xa35a83[_0xfee7('0x31')];_0x29bcd8['order']=qs[_0xfee7('0x3c')](_0x2b68d9['query'][_0xfee7('0x3c')]);_0x29bcd8['where']=qs[_0xfee7('0x35')](_[_0xfee7('0x3e')](_0x2b68d9[_0xfee7('0x34')],_0xa35a83[_0xfee7('0x35')]));if(_0x2b68d9[_0xfee7('0x34')][_0xfee7('0x3f')]){_0x29bcd8[_0xfee7('0x3d')]=_[_0xfee7('0x40')](_0x29bcd8[_0xfee7('0x3d')],{'$or':_[_0xfee7('0x2b')](_0x29bcd8['attributes'],function(_0x38aa4f){var _0xcb14fd={};_0xcb14fd[_0x38aa4f]={'$like':'%'+_0x2b68d9[_0xfee7('0x34')][_0xfee7('0x3f')]+'%'};return _0xcb14fd;})});}_0x29bcd8=_[_0xfee7('0x40')]({},_0x29bcd8,_0x2b68d9[_0xfee7('0x42')]);return _0x26b92b[_0xfee7('0x4c')](_0x29bcd8);}})[_0xfee7('0x25')](function(_0x480fc1){if(_0x480fc1){_0x4d05b0=_0x480fc1['length'];if(!_0x2b68d9[_0xfee7('0x34')][_0xfee7('0x3a')](_0xfee7('0x3b'))){_0x29bcd8[_0xfee7('0x1f')]=qs[_0xfee7('0x1f')](_0x2b68d9['query'][_0xfee7('0x1f')]);_0x29bcd8[_0xfee7('0x1d')]=qs[_0xfee7('0x1d')](_0x2b68d9[_0xfee7('0x34')][_0xfee7('0x1d')]);}return _0x26b92b[_0xfee7('0x4c')](_0x29bcd8);}})[_0xfee7('0x25')](function(_0x51d958){if(_0x51d958){return _0x51d958?{'count':_0x4d05b0,'rows':_0x51d958}:null;}})['then'](respondWithResult(_0x2857c0,null))[_0xfee7('0x47')](handleError(_0x2857c0,null));};exports[_0xfee7('0x4f')]=function(_0x503ab0,_0x4e7b78,_0x5caa14){if(_0x503ab0[_0xfee7('0x4a')]['id']){delete _0x503ab0[_0xfee7('0x4a')]['id'];}return db['SalesforceAccount'][_0xfee7('0x4d')]({'where':{'id':_0x503ab0[_0xfee7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4e7b78,null))[_0xfee7('0x25')](function(_0x20958d){if(_0x20958d){_0x503ab0['body']['AccountId']=_0x20958d['id'];_0x503ab0[_0xfee7('0x4a')][_0xfee7('0x50')]=integrations['getSubjects'](_0x503ab0[_0xfee7('0x4a')][_0xfee7('0x51')],_0x503ab0[_0xfee7('0x4a')][_0xfee7('0x2f')]);_0x503ab0[_0xfee7('0x4a')][_0xfee7('0x52')]=integrations[_0xfee7('0x53')](_0x503ab0[_0xfee7('0x4a')][_0xfee7('0x51')],_0x503ab0[_0xfee7('0x4a')][_0xfee7('0x2f')]);return db[_0xfee7('0x4e')][_0xfee7('0x49')](_0x503ab0[_0xfee7('0x4a')],{'include':[{'model':db[_0xfee7('0x54')],'as':_0xfee7('0x50')},{'model':db['SalesforceField'],'as':_0xfee7('0x52')}]});}return null;})[_0xfee7('0x25')](respondWithResult(_0x4e7b78,null))[_0xfee7('0x47')](handleError(_0x4e7b78,null));};exports['getFields']=function(_0x3d7fcc,_0x15ed6e,_0x3b9cdc){var _0x5eb427;var _0x771e30='';var _0x7ff394=_0xfee7('0x55');return db[_0xfee7('0x2c')][_0xfee7('0x4d')]({'where':{'id':_0x3d7fcc[_0xfee7('0x4b')]['id']},'attributes':['id',_0xfee7('0x56'),_0xfee7('0x57'),_0xfee7('0x58'),_0xfee7('0x59'),'password','securityToken']})[_0xfee7('0x25')](handleEntityNotFound(_0x15ed6e,null))[_0xfee7('0x25')](function(_0x239080){if(_0x239080){_0x771e30=_0x239080[_0xfee7('0x56')];var _0x338c8c=_0x771e30[_0xfee7('0x5a')](-0x1);if(_0x338c8c==='/'){_0x771e30=_0x771e30[_0xfee7('0x5b')](0x0,_0x771e30[_0xfee7('0x5c')](_0x338c8c));}_0x5eb427=new jsforce[(_0xfee7('0x5d'))]({'oauth2':{'loginUrl':_0x771e30,'clientId':_0x239080[_0xfee7('0x57')],'clientSecret':_0x239080[_0xfee7('0x58')]}});return _0x5eb427['login'](_0x239080[_0xfee7('0x59')],_0x239080[_0xfee7('0x5e')][_0xfee7('0x5f')](_0x239080[_0xfee7('0x60')]));}})[_0xfee7('0x25')](function(_0x52925f){if(_0x52925f){if(!_[_0xfee7('0x61')](_0x3d7fcc[_0xfee7('0x34')]['ticketType'])){_0x7ff394=_0x3d7fcc[_0xfee7('0x34')][_0xfee7('0x62')];}return _0x5eb427['sobject'](_0x7ff394)[_0xfee7('0x63')]();}})[_0xfee7('0x25')](function(_0x184c08){var _0x2dc984=['OwnerId',_0xfee7('0x64'),_0xfee7('0x65'),_0xfee7('0x66'),_0xfee7('0x67'),'Description'];var _0x2b264e=[_0xfee7('0x68'),'int','picklist',_0xfee7('0x69'),_0xfee7('0x6a'),_0xfee7('0x6b'),_0xfee7('0x6c')];if(_0x184c08){_[_0xfee7('0x6d')](_0x184c08[_0xfee7('0x37')],function(_0x32bf3c){return _0x2dc984[_0xfee7('0x6e')](_0x32bf3c[_0xfee7('0x32')])||!_0x2b264e[_0xfee7('0x6e')](_0x32bf3c['type']);});return{'count':_0x184c08[_0xfee7('0x37')][_0xfee7('0x39')],'rows':_[_0xfee7('0x2b')](_0x184c08[_0xfee7('0x37')],function(_0x2d3fd3){return{'id':_0x2d3fd3[_0xfee7('0x32')],'name':_0x2d3fd3['label'],'custom':_0x2d3fd3[_0xfee7('0x6f')],'options':_0x2d3fd3[_0xfee7('0x70')][_0xfee7('0x39')]>0x0?_[_0xfee7('0x2b')](_0x2d3fd3['picklistValues'],function(_0x52510b){return{'name':_0x52510b[_0xfee7('0x71')],'value':_0x52510b[_0xfee7('0x72')]};}):_0x2d3fd3[_0xfee7('0x2f')]==_0xfee7('0x69')?[{'name':_0xfee7('0x73'),'value':_0xfee7('0x74')},{'name':_0xfee7('0x75'),'value':'false'}]:[]};})};}})['then'](respondWithResult(_0x15ed6e,null))[_0xfee7('0x47')](function(_0x37dff5){var _0x4daa94=_0x3d7fcc[_0xfee7('0x34')][_0xfee7('0x76')]?0x1f4:_0x37dff5[_0xfee7('0x77')]||0x1f4;logger[_0xfee7('0x27')](_0xfee7('0x78'),'getFields',_0x4daa94,JSON[_0xfee7('0x79')](_0x37dff5));delete _0x37dff5[_0xfee7('0x32')];if(_0x4daa94===0x191){_0x4daa94=0x190;}_0x15ed6e[_0xfee7('0x1a')](_0x4daa94)[_0xfee7('0x29')](_0x3d7fcc[_0xfee7('0x34')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x37dff5[_0xfee7('0x77')]}:_0x37dff5);});}; \ No newline at end of file +var _0xdfc4=['jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','then','error','stack','name','index','map','SalesforceAccount','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','include','rows','show','includeAll','options','find','catch','create','body','update','params','destroy','getConfigurations','order','addConfiguration','findOne','AccountId','Subjects','channel','SalesforceField','Descriptions','getFields','Task','remoteUri','clientId','clientSecret','username','securityToken','slice','substring','lastIndexOf','password','isNil','ticketType','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x47f0d8,_0x367279){var _0x319d7e=function(_0x3935c5){while(--_0x3935c5){_0x47f0d8['push'](_0x47f0d8['shift']());}};_0x319d7e(++_0x367279);}(_0xdfc4,0x6b));var _0x4dfc=function(_0x4dba4f,_0x5996fc){_0x4dba4f=_0x4dba4f-0x0;var _0x2e1b00=_0xdfc4[_0x4dba4f];return _0x2e1b00;};'use strict';var emlformat=require(_0x4dfc('0x0'));var rimraf=require(_0x4dfc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4dfc('0x2'));var rp=require(_0x4dfc('0x3'));var moment=require(_0x4dfc('0x4'));var BPromise=require(_0x4dfc('0x5'));var Mustache=require(_0x4dfc('0x6'));var util=require(_0x4dfc('0x7'));var path=require('path');var sox=require(_0x4dfc('0x8'));var csv=require(_0x4dfc('0x9'));var ejs=require(_0x4dfc('0xa'));var fs=require('fs');var fs_extra=require(_0x4dfc('0xb'));var _=require(_0x4dfc('0xc'));var squel=require('squel');var crypto=require(_0x4dfc('0xd'));var jsforce=require(_0x4dfc('0xe'));var deskjs=require(_0x4dfc('0xf'));var toCsv=require(_0x4dfc('0x9'));var querystring=require(_0x4dfc('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4dfc('0x11'));var as=require(_0x4dfc('0x12'));var hardwareService=require(_0x4dfc('0x13'));var logger=require(_0x4dfc('0x14'))('api');var utils=require(_0x4dfc('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4dfc('0x16'));var db=require(_0x4dfc('0x17'))['db'];var integrations=require(_0x4dfc('0x18'));function respondWithStatusCode(_0x29bcf1,_0x45734b){_0x45734b=_0x45734b||0xcc;return function(_0x3ea206){if(_0x3ea206){return _0x29bcf1[_0x4dfc('0x19')](_0x45734b);}return _0x29bcf1[_0x4dfc('0x1a')](_0x45734b)[_0x4dfc('0x1b')]();};}function respondWithResult(_0x537345,_0x346848){_0x346848=_0x346848||0xc8;return function(_0x3d0d9e){if(_0x3d0d9e){return _0x537345[_0x4dfc('0x1a')](_0x346848)[_0x4dfc('0x1c')](_0x3d0d9e);}};}function respondWithFilteredResult(_0x9c3452,_0xb75e8d){return function(_0x420fbb){if(_0x420fbb){var _0x2f20c0=typeof _0xb75e8d['offset']==='undefined'&&typeof _0xb75e8d[_0x4dfc('0x1d')]===_0x4dfc('0x1e');var _0x39d490=_0x420fbb[_0x4dfc('0x1f')];var _0x3d5f4c=_0x2f20c0?0x0:_0xb75e8d[_0x4dfc('0x20')];var _0x36b819=_0x2f20c0?_0x420fbb['count']:_0xb75e8d[_0x4dfc('0x20')]+_0xb75e8d[_0x4dfc('0x1d')];var _0x2285d3;if(_0x36b819>=_0x39d490){_0x36b819=_0x39d490;_0x2285d3=0xc8;}else{_0x2285d3=0xce;}_0x9c3452['status'](_0x2285d3);return _0x9c3452[_0x4dfc('0x21')](_0x4dfc('0x22'),_0x3d5f4c+'-'+_0x36b819+'/'+_0x39d490)[_0x4dfc('0x1c')](_0x420fbb);}return null;};}function patchUpdates(_0x3225be){return function(_0x3340fc){try{jsonpatch['apply'](_0x3340fc,_0x3225be,!![]);}catch(_0x503661){return BPromise[_0x4dfc('0x23')](_0x503661);}return _0x3340fc['save']();};}function saveUpdates(_0x72cf1d,_0x22bb88){return function(_0x3b65fc){if(_0x3b65fc){return _0x3b65fc['update'](_0x72cf1d)['then'](function(_0x319525){return _0x319525;});}return null;};}function removeEntity(_0xc2b836,_0x3270ad){return function(_0x488f20){if(_0x488f20){return _0x488f20['destroy']()[_0x4dfc('0x24')](function(){_0xc2b836[_0x4dfc('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x312709,_0x8cbbfe){return function(_0x1a2793){if(!_0x1a2793){_0x312709[_0x4dfc('0x19')](0x194);}return _0x1a2793;};}function handleError(_0x3c57ac,_0x2a3d64){_0x2a3d64=_0x2a3d64||0x1f4;return function(_0x2ee1ea){logger[_0x4dfc('0x25')](_0x2ee1ea[_0x4dfc('0x26')]);if(_0x2ee1ea['name']){delete _0x2ee1ea[_0x4dfc('0x27')];}_0x3c57ac['status'](_0x2a3d64)['send'](_0x2ee1ea);};}exports[_0x4dfc('0x28')]=function(_0x1fe6ff,_0x1cbbdc){var _0x417756={},_0x7b7991={},_0x4e27f6={'count':0x0,'rows':[]};var _0xdbbf57=_[_0x4dfc('0x29')](db[_0x4dfc('0x2a')][_0x4dfc('0x2b')],function(_0x3f6cce){return{'name':_0x3f6cce['fieldName'],'type':_0x3f6cce['type']['key']};});_0x7b7991['model']=_[_0x4dfc('0x29')](_0xdbbf57,'name');_0x7b7991[_0x4dfc('0x2c')]=_[_0x4dfc('0x2d')](_0x1fe6ff['query']);_0x7b7991[_0x4dfc('0x2e')]=_[_0x4dfc('0x2f')](_0x7b7991[_0x4dfc('0x30')],_0x7b7991['query']);_0x417756['attributes']=_['intersection'](_0x7b7991[_0x4dfc('0x30')],qs[_0x4dfc('0x31')](_0x1fe6ff[_0x4dfc('0x2c')][_0x4dfc('0x31')]));_0x417756['attributes']=_0x417756[_0x4dfc('0x32')][_0x4dfc('0x33')]?_0x417756['attributes']:_0x7b7991[_0x4dfc('0x30')];if(!_0x1fe6ff['query'][_0x4dfc('0x34')](_0x4dfc('0x35'))){_0x417756[_0x4dfc('0x1d')]=qs['limit'](_0x1fe6ff[_0x4dfc('0x2c')][_0x4dfc('0x1d')]);_0x417756[_0x4dfc('0x20')]=qs[_0x4dfc('0x20')](_0x1fe6ff[_0x4dfc('0x2c')][_0x4dfc('0x20')]);}_0x417756['order']=qs[_0x4dfc('0x36')](_0x1fe6ff['query'][_0x4dfc('0x36')]);_0x417756[_0x4dfc('0x37')]=qs['filters'](_[_0x4dfc('0x38')](_0x1fe6ff[_0x4dfc('0x2c')],_0x7b7991[_0x4dfc('0x2e')]),_0xdbbf57);if(_0x1fe6ff[_0x4dfc('0x2c')][_0x4dfc('0x39')]){_0x417756[_0x4dfc('0x37')]=_[_0x4dfc('0x3a')](_0x417756[_0x4dfc('0x37')],{'$or':_[_0x4dfc('0x29')](_0xdbbf57,function(_0x471a8b){if(_0x471a8b[_0x4dfc('0x3b')]!=='VIRTUAL'){var _0x240e1e={};_0x240e1e[_0x471a8b['name']]={'$like':'%'+_0x1fe6ff[_0x4dfc('0x2c')][_0x4dfc('0x39')]+'%'};return _0x240e1e;}})});}_0x417756=_[_0x4dfc('0x3a')]({},_0x417756,_0x1fe6ff['options']);var _0x2eba09={'where':_0x417756['where']};return db['SalesforceAccount'][_0x4dfc('0x1f')](_0x2eba09)[_0x4dfc('0x24')](function(_0x3663f6){_0x4e27f6['count']=_0x3663f6;if(_0x1fe6ff[_0x4dfc('0x2c')]['includeAll']){_0x417756[_0x4dfc('0x3c')]=[{'all':!![]}];}return db[_0x4dfc('0x2a')]['findAll'](_0x417756);})[_0x4dfc('0x24')](function(_0x1433cf){_0x4e27f6[_0x4dfc('0x3d')]=_0x1433cf;return _0x4e27f6;})['then'](respondWithFilteredResult(_0x1cbbdc,_0x417756))['catch'](handleError(_0x1cbbdc,null));};exports[_0x4dfc('0x3e')]=function(_0x14412a,_0x5f00eb){var _0x12a753={'raw':![],'where':{'id':_0x14412a['params']['id']}},_0x16286b={};_0x16286b[_0x4dfc('0x30')]=_[_0x4dfc('0x2d')](db[_0x4dfc('0x2a')]['rawAttributes']);_0x16286b['query']=_[_0x4dfc('0x2d')](_0x14412a['query']);_0x16286b[_0x4dfc('0x2e')]=_[_0x4dfc('0x2f')](_0x16286b['model'],_0x16286b['query']);_0x12a753[_0x4dfc('0x32')]=_[_0x4dfc('0x2f')](_0x16286b['model'],qs[_0x4dfc('0x31')](_0x14412a[_0x4dfc('0x2c')][_0x4dfc('0x31')]));_0x12a753[_0x4dfc('0x32')]=_0x12a753[_0x4dfc('0x32')][_0x4dfc('0x33')]?_0x12a753[_0x4dfc('0x32')]:_0x16286b[_0x4dfc('0x30')];if(_0x14412a[_0x4dfc('0x2c')][_0x4dfc('0x3f')]){_0x12a753[_0x4dfc('0x3c')]=[{'all':!![]}];}_0x12a753=_['merge']({},_0x12a753,_0x14412a[_0x4dfc('0x40')]);return db['SalesforceAccount'][_0x4dfc('0x41')](_0x12a753)['then'](handleEntityNotFound(_0x5f00eb,null))['then'](respondWithResult(_0x5f00eb,null))[_0x4dfc('0x42')](handleError(_0x5f00eb,null));};exports[_0x4dfc('0x43')]=function(_0x1bc6bc,_0x4c230d){return db['SalesforceAccount'][_0x4dfc('0x43')](_0x1bc6bc[_0x4dfc('0x44')],{})[_0x4dfc('0x24')](respondWithResult(_0x4c230d,0xc9))[_0x4dfc('0x42')](handleError(_0x4c230d,null));};exports[_0x4dfc('0x45')]=function(_0x3abe58,_0x2a719a){if(_0x3abe58[_0x4dfc('0x44')]['id']){delete _0x3abe58[_0x4dfc('0x44')]['id'];}return db[_0x4dfc('0x2a')][_0x4dfc('0x41')]({'where':{'id':_0x3abe58[_0x4dfc('0x46')]['id']}})[_0x4dfc('0x24')](handleEntityNotFound(_0x2a719a,null))['then'](saveUpdates(_0x3abe58['body'],null))['then'](respondWithResult(_0x2a719a,null))['catch'](handleError(_0x2a719a,null));};exports[_0x4dfc('0x47')]=function(_0x386bec,_0x3acf86){return db[_0x4dfc('0x2a')]['find']({'where':{'id':_0x386bec['params']['id']}})[_0x4dfc('0x24')](handleEntityNotFound(_0x3acf86,null))['then'](removeEntity(_0x3acf86,null))['catch'](handleError(_0x3acf86,null));};exports[_0x4dfc('0x48')]=function(_0x30b30d,_0x1d7240,_0x4a73c4){var _0x1637de={};var _0x3b1c7f={};var _0x5e7300;var _0x221277;return db[_0x4dfc('0x2a')]['findOne']({'where':{'id':_0x30b30d[_0x4dfc('0x46')]['id']}})['then'](handleEntityNotFound(_0x1d7240,null))[_0x4dfc('0x24')](function(_0xb97505){if(_0xb97505){_0x5e7300=_0xb97505;_0x3b1c7f['model']=_[_0x4dfc('0x2d')](db['SalesforceConfiguration'][_0x4dfc('0x2b')]);_0x3b1c7f[_0x4dfc('0x2c')]=_['keys'](_0x30b30d['query']);_0x3b1c7f[_0x4dfc('0x2e')]=_[_0x4dfc('0x2f')](_0x3b1c7f[_0x4dfc('0x30')],_0x3b1c7f[_0x4dfc('0x2c')]);_0x1637de[_0x4dfc('0x32')]=_[_0x4dfc('0x2f')](_0x3b1c7f[_0x4dfc('0x30')],qs[_0x4dfc('0x31')](_0x30b30d[_0x4dfc('0x2c')][_0x4dfc('0x31')]));_0x1637de['attributes']=_0x1637de[_0x4dfc('0x32')][_0x4dfc('0x33')]?_0x1637de['attributes']:_0x3b1c7f[_0x4dfc('0x30')];_0x1637de[_0x4dfc('0x49')]=qs[_0x4dfc('0x36')](_0x30b30d[_0x4dfc('0x2c')][_0x4dfc('0x36')]);_0x1637de['where']=qs[_0x4dfc('0x2e')](_[_0x4dfc('0x38')](_0x30b30d[_0x4dfc('0x2c')],_0x3b1c7f[_0x4dfc('0x2e')]));if(_0x30b30d['query'][_0x4dfc('0x39')]){_0x1637de['where']=_['merge'](_0x1637de[_0x4dfc('0x37')],{'$or':_[_0x4dfc('0x29')](_0x1637de['attributes'],function(_0x531909){var _0x2e90a4={};_0x2e90a4[_0x531909]={'$like':'%'+_0x30b30d[_0x4dfc('0x2c')][_0x4dfc('0x39')]+'%'};return _0x2e90a4;})});}_0x1637de=_['merge']({},_0x1637de,_0x30b30d[_0x4dfc('0x40')]);return _0x5e7300[_0x4dfc('0x48')](_0x1637de);}})[_0x4dfc('0x24')](function(_0x5ac95f){if(_0x5ac95f){_0x221277=_0x5ac95f['length'];if(!_0x30b30d[_0x4dfc('0x2c')][_0x4dfc('0x34')](_0x4dfc('0x35'))){_0x1637de[_0x4dfc('0x1d')]=qs['limit'](_0x30b30d[_0x4dfc('0x2c')][_0x4dfc('0x1d')]);_0x1637de['offset']=qs[_0x4dfc('0x20')](_0x30b30d[_0x4dfc('0x2c')][_0x4dfc('0x20')]);}return _0x5e7300[_0x4dfc('0x48')](_0x1637de);}})[_0x4dfc('0x24')](function(_0x5ad6fa){if(_0x5ad6fa){return _0x5ad6fa?{'count':_0x221277,'rows':_0x5ad6fa}:null;}})[_0x4dfc('0x24')](respondWithResult(_0x1d7240,null))['catch'](handleError(_0x1d7240,null));};exports[_0x4dfc('0x4a')]=function(_0x160ddc,_0x2c9012,_0x1bd096){if(_0x160ddc[_0x4dfc('0x44')]['id']){delete _0x160ddc[_0x4dfc('0x44')]['id'];}return db[_0x4dfc('0x2a')][_0x4dfc('0x4b')]({'where':{'id':_0x160ddc[_0x4dfc('0x46')]['id']}})[_0x4dfc('0x24')](handleEntityNotFound(_0x2c9012,null))[_0x4dfc('0x24')](function(_0x27a5b2){if(_0x27a5b2){_0x160ddc[_0x4dfc('0x44')][_0x4dfc('0x4c')]=_0x27a5b2['id'];_0x160ddc[_0x4dfc('0x44')][_0x4dfc('0x4d')]=integrations['getSubjects'](_0x160ddc[_0x4dfc('0x44')][_0x4dfc('0x4e')],_0x160ddc['body'][_0x4dfc('0x3b')]);_0x160ddc[_0x4dfc('0x44')]['Descriptions']=integrations['getDescriptions'](_0x160ddc[_0x4dfc('0x44')][_0x4dfc('0x4e')],_0x160ddc[_0x4dfc('0x44')][_0x4dfc('0x3b')]);return db['SalesforceConfiguration'][_0x4dfc('0x43')](_0x160ddc[_0x4dfc('0x44')],{'include':[{'model':db[_0x4dfc('0x4f')],'as':'Subjects'},{'model':db[_0x4dfc('0x4f')],'as':_0x4dfc('0x50')}]});}return null;})['then'](respondWithResult(_0x2c9012,null))[_0x4dfc('0x42')](handleError(_0x2c9012,null));};exports[_0x4dfc('0x51')]=function(_0x4619e6,_0x304fe6,_0x2b7761){var _0x5e83bd;var _0x2cb784='';var _0x4b2b34=_0x4dfc('0x52');return db['SalesforceAccount'][_0x4dfc('0x4b')]({'where':{'id':_0x4619e6['params']['id']},'attributes':['id',_0x4dfc('0x53'),_0x4dfc('0x54'),_0x4dfc('0x55'),_0x4dfc('0x56'),'password',_0x4dfc('0x57')]})[_0x4dfc('0x24')](handleEntityNotFound(_0x304fe6,null))[_0x4dfc('0x24')](function(_0x34efcf){if(_0x34efcf){_0x2cb784=_0x34efcf[_0x4dfc('0x53')];var _0x1d5f2d=_0x2cb784[_0x4dfc('0x58')](-0x1);if(_0x1d5f2d==='/'){_0x2cb784=_0x2cb784[_0x4dfc('0x59')](0x0,_0x2cb784[_0x4dfc('0x5a')](_0x1d5f2d));}_0x5e83bd=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2cb784,'clientId':_0x34efcf[_0x4dfc('0x54')],'clientSecret':_0x34efcf[_0x4dfc('0x55')]}});return _0x5e83bd['login'](_0x34efcf[_0x4dfc('0x56')],_0x34efcf[_0x4dfc('0x5b')]['concat'](_0x34efcf[_0x4dfc('0x57')]));}})['then'](function(_0x2b96d0){if(_0x2b96d0){if(!_[_0x4dfc('0x5c')](_0x4619e6[_0x4dfc('0x2c')][_0x4dfc('0x5d')])){_0x4b2b34=_0x4619e6[_0x4dfc('0x2c')][_0x4dfc('0x5d')];}return _0x5e83bd['sobject'](_0x4b2b34)['describe']();}})[_0x4dfc('0x24')](function(_0x462a11){var _0x311448=[_0x4dfc('0x5e'),_0x4dfc('0x5f'),_0x4dfc('0x60'),_0x4dfc('0x61'),_0x4dfc('0x62'),_0x4dfc('0x63')];var _0x3dd3a9=[_0x4dfc('0x64'),'int',_0x4dfc('0x65'),_0x4dfc('0x66'),_0x4dfc('0x67'),_0x4dfc('0x68'),_0x4dfc('0x69')];if(_0x462a11){_[_0x4dfc('0x6a')](_0x462a11['fields'],function(_0x1eb641){return _0x311448[_0x4dfc('0x6b')](_0x1eb641[_0x4dfc('0x27')])||!_0x3dd3a9[_0x4dfc('0x6b')](_0x1eb641[_0x4dfc('0x3b')]);});return{'count':_0x462a11[_0x4dfc('0x31')]['length'],'rows':_[_0x4dfc('0x29')](_0x462a11[_0x4dfc('0x31')],function(_0x2174b0){return{'id':_0x2174b0['name'],'name':_0x2174b0[_0x4dfc('0x6c')],'custom':_0x2174b0[_0x4dfc('0x6d')],'options':_0x2174b0['picklistValues'][_0x4dfc('0x33')]>0x0?_['map'](_0x2174b0[_0x4dfc('0x6e')],function(_0x313bee){return{'name':_0x313bee[_0x4dfc('0x6c')],'value':_0x313bee[_0x4dfc('0x6f')]};}):_0x2174b0[_0x4dfc('0x3b')]=='boolean'?[{'name':'True','value':_0x4dfc('0x70')},{'name':_0x4dfc('0x71'),'value':_0x4dfc('0x72')}]:[]};})};}})[_0x4dfc('0x24')](respondWithResult(_0x304fe6,null))[_0x4dfc('0x42')](function(_0x4ced95){var _0x372cdf=_0x4619e6[_0x4dfc('0x2c')][_0x4dfc('0x73')]?0x1f4:_0x4ced95[_0x4dfc('0x74')]||0x1f4;logger[_0x4dfc('0x25')](_0x4dfc('0x75'),_0x4dfc('0x51'),_0x372cdf,JSON[_0x4dfc('0x76')](_0x4ced95));delete _0x4ced95['name'];if(_0x372cdf===0x191){_0x372cdf=0x190;}_0x304fe6['status'](_0x372cdf)[_0x4dfc('0x77')](_0x4619e6[_0x4dfc('0x2c')][_0x4dfc('0x73')]?{'message':_0x4dfc('0x78'),'statusCode':_0x4ced95[_0x4dfc('0x74')]}:_0x4ced95);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index a04cdc6..f0cfdc0 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 _0x34ad=['request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','bluebird'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x34ad,0x181));var _0xd34a=function(_0x46d14b,_0x147907){_0x46d14b=_0x46d14b-0x0;var _0x367dfd=_0x34ad[_0x46d14b];return _0x367dfd;};'use strict';var _=require(_0xd34a('0x0'));var util=require(_0xd34a('0x1'));var logger=require(_0xd34a('0x2'))(_0xd34a('0x3'));var moment=require('moment');var BPromise=require(_0xd34a('0x4'));var rp=require(_0xd34a('0x5'));var fs=require('fs');var path=require(_0xd34a('0x6'));var rimraf=require('rimraf');var config=require(_0xd34a('0x7'));var attributes=require(_0xd34a('0x8'));var integrations=require(_0xd34a('0x9'));module[_0xd34a('0xa')]=function(_0x533822,_0x4b8326){return _0x533822['define'](_0xd34a('0xb'),attributes,{'tableName':_0xd34a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10d8=['exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x10d8,0xee));var _0x810d=function(_0x51a003,_0x4a3880){_0x51a003=_0x51a003-0x0;var _0x469d6a=_0x10d8[_0x51a003];return _0x469d6a;};'use strict';var _=require(_0x810d('0x0'));var util=require(_0x810d('0x1'));var logger=require(_0x810d('0x2'))('api');var moment=require(_0x810d('0x3'));var BPromise=require(_0x810d('0x4'));var rp=require(_0x810d('0x5'));var fs=require('fs');var path=require(_0x810d('0x6'));var rimraf=require(_0x810d('0x7'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x810d('0x8'));module[_0x810d('0x9')]=function(_0xeebfbe,_0x3a4786){return _0xeebfbe[_0x810d('0xa')](_0x810d('0xb'),attributes,{'tableName':_0x810d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index cd74495..9c8585c 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 _0x4fd6=['http','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSalesforceAccount','findAll','options','raw','where','include','map','model','attributes','SalesforceAccount','find','ShowSalesforceAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x11ef29,_0x504026){var _0x14842c=function(_0x4ccd5c){while(--_0x4ccd5c){_0x11ef29['push'](_0x11ef29['shift']());}};_0x14842c(++_0x504026);}(_0x4fd6,0x84));var _0x64fd=function(_0x77d76e,_0x106ed2){_0x77d76e=_0x77d76e-0x0;var _0x5620c8=_0x4fd6[_0x77d76e];return _0x5620c8;};'use strict';var _=require(_0x64fd('0x0'));var util=require(_0x64fd('0x1'));var moment=require(_0x64fd('0x2'));var BPromise=require('bluebird');var rs=require(_0x64fd('0x3'));var fs=require('fs');var Redis=require(_0x64fd('0x4'));var db=require(_0x64fd('0x5'))['db'];var utils=require(_0x64fd('0x6'));var logger=require(_0x64fd('0x7'))(_0x64fd('0x8'));var config=require(_0x64fd('0x9'));var jayson=require(_0x64fd('0xa'));var client=jayson[_0x64fd('0xb')][_0x64fd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x11ddee,_0x39afc0,_0x527aa1){return new BPromise(function(_0x2a3e1b,_0x2ceb92){return client['request'](_0x11ddee,_0x527aa1)[_0x64fd('0xd')](function(_0x4f24bf){logger[_0x64fd('0xe')](_0x64fd('0xf'),_0x39afc0,_0x64fd('0x10'));logger[_0x64fd('0x11')](_0x64fd('0x12'),_0x39afc0,_0x64fd('0x10'),JSON['stringify'](_0x4f24bf));if(_0x4f24bf[_0x64fd('0x13')]){if(_0x4f24bf[_0x64fd('0x13')][_0x64fd('0x14')]===0x1f4){logger[_0x64fd('0x13')](_0x64fd('0xf'),_0x39afc0,_0x4f24bf[_0x64fd('0x13')][_0x64fd('0x15')]);return _0x2ceb92(_0x4f24bf[_0x64fd('0x13')][_0x64fd('0x15')]);}logger['error'](_0x64fd('0xf'),_0x39afc0,_0x4f24bf['error'][_0x64fd('0x15')]);return _0x2a3e1b(_0x4f24bf['error'][_0x64fd('0x15')]);}else{logger[_0x64fd('0xe')](_0x64fd('0xf'),_0x39afc0,_0x64fd('0x10'));_0x2a3e1b(_0x4f24bf[_0x64fd('0x16')][_0x64fd('0x15')]);}})[_0x64fd('0x17')](function(_0x4cbb67){logger[_0x64fd('0x13')](_0x64fd('0xf'),_0x39afc0,_0x4cbb67);_0x2ceb92(_0x4cbb67);});});}exports[_0x64fd('0x18')]=function(_0x69e149){var _0x5982a2=this;return new Promise(function(_0x245eb9,_0x150906){return db['SalesforceAccount'][_0x64fd('0x19')]({'raw':_0x69e149[_0x64fd('0x1a')]?_0x69e149[_0x64fd('0x1a')][_0x64fd('0x1b')]===undefined?!![]:![]:!![],'where':_0x69e149['options']?_0x69e149['options'][_0x64fd('0x1c')]||null:null,'attributes':_0x69e149[_0x64fd('0x1a')]?_0x69e149[_0x64fd('0x1a')]['attributes']||null:null,'limit':_0x69e149[_0x64fd('0x1a')]?_0x69e149[_0x64fd('0x1a')]['limit']||null:null,'include':_0x69e149[_0x64fd('0x1a')]?_0x69e149['options'][_0x64fd('0x1d')]?_[_0x64fd('0x1e')](_0x69e149[_0x64fd('0x1a')][_0x64fd('0x1d')],function(_0x3976b4){return{'model':db[_0x3976b4[_0x64fd('0x1f')]],'as':_0x3976b4['as'],'attributes':_0x3976b4[_0x64fd('0x20')],'include':_0x3976b4[_0x64fd('0x1d')]?_['map'](_0x3976b4[_0x64fd('0x1d')],function(_0xd1a397){return{'model':db[_0xd1a397[_0x64fd('0x1f')]],'as':_0xd1a397['as'],'attributes':_0xd1a397[_0x64fd('0x20')],'include':_0xd1a397['include']?_['map'](_0xd1a397['include'],function(_0x25ac6c){return{'model':db[_0x25ac6c[_0x64fd('0x1f')]],'as':_0x25ac6c['as'],'attributes':_0x25ac6c[_0x64fd('0x20')]};}):[]};}):[]};}):[]:[]})[_0x64fd('0xd')](function(_0x3d2357){logger['info'](_0x64fd('0x18'),_0x69e149);logger[_0x64fd('0x11')](_0x64fd('0x18'),_0x69e149,JSON['stringify'](_0x3d2357));_0x245eb9(_0x3d2357);})[_0x64fd('0x17')](function(_0x8e5c4f){logger['error']('GetSalesforceAccount',_0x8e5c4f[_0x64fd('0x15')],_0x69e149);_0x150906(_0x5982a2[_0x64fd('0x13')](0x1f4,_0x8e5c4f[_0x64fd('0x15')]));});});};exports['ShowSalesforceAccount']=function(_0x218392){var _0x4e92c1=this;return new Promise(function(_0x529e25,_0x43be12){return db[_0x64fd('0x21')][_0x64fd('0x22')]({'raw':_0x218392[_0x64fd('0x1a')]?_0x218392['options'][_0x64fd('0x1b')]===undefined?!![]:![]:!![],'where':_0x218392[_0x64fd('0x1a')]?_0x218392[_0x64fd('0x1a')][_0x64fd('0x1c')]||null:null,'attributes':_0x218392[_0x64fd('0x1a')]?_0x218392[_0x64fd('0x1a')][_0x64fd('0x20')]||null:null,'include':_0x218392['options']?_0x218392[_0x64fd('0x1a')]['include']?_['map'](_0x218392[_0x64fd('0x1a')][_0x64fd('0x1d')],function(_0x35cd6d){return{'model':db[_0x35cd6d[_0x64fd('0x1f')]],'as':_0x35cd6d['as'],'attributes':_0x35cd6d[_0x64fd('0x20')],'include':_0x35cd6d[_0x64fd('0x1d')]?_['map'](_0x35cd6d[_0x64fd('0x1d')],function(_0x2bbac0){return{'model':db[_0x2bbac0['model']],'as':_0x2bbac0['as'],'attributes':_0x2bbac0['attributes'],'include':_0x2bbac0[_0x64fd('0x1d')]?_[_0x64fd('0x1e')](_0x2bbac0[_0x64fd('0x1d')],function(_0x154381){return{'model':db[_0x154381[_0x64fd('0x1f')]],'as':_0x154381['as'],'attributes':_0x154381[_0x64fd('0x20')]};}):[]};}):[]};}):[]:[]})[_0x64fd('0xd')](function(_0x11d07e){logger['info'](_0x64fd('0x23'),_0x218392);logger[_0x64fd('0x11')](_0x64fd('0x23'),_0x218392,JSON['stringify'](_0x11d07e));_0x529e25(_0x11d07e);})[_0x64fd('0x17')](function(_0x16c12e){logger['error'](_0x64fd('0x23'),_0x16c12e[_0x64fd('0x15')],_0x218392);_0x43be12(_0x4e92c1['error'](0x1f4,_0x16c12e['message']));});});}; \ No newline at end of file +var _0x6dbe=['client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','where','limit','map','include','model','attributes','ShowSalesforceAccount','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1e4151,_0x17d158){var _0x5ab96e=function(_0x49d836){while(--_0x49d836){_0x1e4151['push'](_0x1e4151['shift']());}};_0x5ab96e(++_0x17d158);}(_0x6dbe,0xa2));var _0xe6db=function(_0x137753,_0x2cf9b5){_0x137753=_0x137753-0x0;var _0x458c82=_0x6dbe[_0x137753];return _0x458c82;};'use strict';var _=require('lodash');var util=require(_0xe6db('0x0'));var moment=require(_0xe6db('0x1'));var BPromise=require(_0xe6db('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe6db('0x3'))['db'];var utils=require(_0xe6db('0x4'));var logger=require(_0xe6db('0x5'))('rpc');var config=require(_0xe6db('0x6'));var jayson=require(_0xe6db('0x7'));var client=jayson[_0xe6db('0x8')][_0xe6db('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ac3f2,_0x417d2c,_0x931f73){return new BPromise(function(_0x2b6604,_0xf9fd0){return client[_0xe6db('0xa')](_0x4ac3f2,_0x931f73)[_0xe6db('0xb')](function(_0x281be8){logger[_0xe6db('0xc')](_0xe6db('0xd'),_0x417d2c,_0xe6db('0xe'));logger[_0xe6db('0xf')](_0xe6db('0x10'),_0x417d2c,_0xe6db('0xe'),JSON[_0xe6db('0x11')](_0x281be8));if(_0x281be8[_0xe6db('0x12')]){if(_0x281be8[_0xe6db('0x12')][_0xe6db('0x13')]===0x1f4){logger['error'](_0xe6db('0xd'),_0x417d2c,_0x281be8['error']['message']);return _0xf9fd0(_0x281be8[_0xe6db('0x12')][_0xe6db('0x14')]);}logger[_0xe6db('0x12')](_0xe6db('0xd'),_0x417d2c,_0x281be8[_0xe6db('0x12')][_0xe6db('0x14')]);return _0x2b6604(_0x281be8[_0xe6db('0x12')][_0xe6db('0x14')]);}else{logger[_0xe6db('0xc')](_0xe6db('0xd'),_0x417d2c,_0xe6db('0xe'));_0x2b6604(_0x281be8[_0xe6db('0x15')]['message']);}})[_0xe6db('0x16')](function(_0x5dc2f5){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x417d2c,_0x5dc2f5);_0xf9fd0(_0x5dc2f5);});});}exports[_0xe6db('0x17')]=function(_0x2298bc){var _0x4b7513=this;return new Promise(function(_0x173cc8,_0x347efa){return db[_0xe6db('0x18')]['findAll']({'raw':_0x2298bc[_0xe6db('0x19')]?_0x2298bc[_0xe6db('0x19')][_0xe6db('0x1a')]===undefined?!![]:![]:!![],'where':_0x2298bc[_0xe6db('0x19')]?_0x2298bc[_0xe6db('0x19')][_0xe6db('0x1b')]||null:null,'attributes':_0x2298bc['options']?_0x2298bc['options']['attributes']||null:null,'limit':_0x2298bc[_0xe6db('0x19')]?_0x2298bc[_0xe6db('0x19')][_0xe6db('0x1c')]||null:null,'include':_0x2298bc['options']?_0x2298bc[_0xe6db('0x19')]['include']?_[_0xe6db('0x1d')](_0x2298bc['options'][_0xe6db('0x1e')],function(_0x5d7610){return{'model':db[_0x5d7610[_0xe6db('0x1f')]],'as':_0x5d7610['as'],'attributes':_0x5d7610['attributes'],'include':_0x5d7610[_0xe6db('0x1e')]?_[_0xe6db('0x1d')](_0x5d7610[_0xe6db('0x1e')],function(_0x38464c){return{'model':db[_0x38464c['model']],'as':_0x38464c['as'],'attributes':_0x38464c[_0xe6db('0x20')],'include':_0x38464c['include']?_[_0xe6db('0x1d')](_0x38464c[_0xe6db('0x1e')],function(_0x5b8804){return{'model':db[_0x5b8804[_0xe6db('0x1f')]],'as':_0x5b8804['as'],'attributes':_0x5b8804[_0xe6db('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe6db('0xb')](function(_0xdeed2d){logger[_0xe6db('0xc')](_0xe6db('0x17'),_0x2298bc);logger[_0xe6db('0xf')]('GetSalesforceAccount',_0x2298bc,JSON[_0xe6db('0x11')](_0xdeed2d));_0x173cc8(_0xdeed2d);})[_0xe6db('0x16')](function(_0x50b146){logger[_0xe6db('0x12')](_0xe6db('0x17'),_0x50b146[_0xe6db('0x14')],_0x2298bc);_0x347efa(_0x4b7513[_0xe6db('0x12')](0x1f4,_0x50b146[_0xe6db('0x14')]));});});};exports[_0xe6db('0x21')]=function(_0x20f28e){var _0x578cc5=this;return new Promise(function(_0x1d1e1e,_0x2ae339){return db[_0xe6db('0x18')]['find']({'raw':_0x20f28e[_0xe6db('0x19')]?_0x20f28e[_0xe6db('0x19')][_0xe6db('0x1a')]===undefined?!![]:![]:!![],'where':_0x20f28e[_0xe6db('0x19')]?_0x20f28e[_0xe6db('0x19')][_0xe6db('0x1b')]||null:null,'attributes':_0x20f28e['options']?_0x20f28e[_0xe6db('0x19')]['attributes']||null:null,'include':_0x20f28e[_0xe6db('0x19')]?_0x20f28e[_0xe6db('0x19')]['include']?_[_0xe6db('0x1d')](_0x20f28e[_0xe6db('0x19')][_0xe6db('0x1e')],function(_0x5db076){return{'model':db[_0x5db076['model']],'as':_0x5db076['as'],'attributes':_0x5db076[_0xe6db('0x20')],'include':_0x5db076['include']?_[_0xe6db('0x1d')](_0x5db076[_0xe6db('0x1e')],function(_0x4d33b7){return{'model':db[_0x4d33b7[_0xe6db('0x1f')]],'as':_0x4d33b7['as'],'attributes':_0x4d33b7['attributes'],'include':_0x4d33b7[_0xe6db('0x1e')]?_[_0xe6db('0x1d')](_0x4d33b7[_0xe6db('0x1e')],function(_0x231264){return{'model':db[_0x231264[_0xe6db('0x1f')]],'as':_0x231264['as'],'attributes':_0x231264[_0xe6db('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe6db('0xb')](function(_0x2485a2){logger[_0xe6db('0xc')](_0xe6db('0x21'),_0x20f28e);logger[_0xe6db('0xf')]('ShowSalesforceAccount',_0x20f28e,JSON[_0xe6db('0x11')](_0x2485a2));_0x1d1e1e(_0x2485a2);})[_0xe6db('0x16')](function(_0x1f2d48){logger[_0xe6db('0x12')]('ShowSalesforceAccount',_0x1f2d48[_0xe6db('0x14')],_0x20f28e);_0x2ae339(_0x578cc5[_0xe6db('0x12')](0x1f4,_0x1f2d48['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 045700a..753e898 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 _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x245228,_0x518706){var _0x1723e0=function(_0x39c679){while(--_0x39c679){_0x245228['push'](_0x245228['shift']());}};_0x1723e0(++_0x518706);}(_0x2ef3,0xba));var _0x32ef=function(_0x85ee0d,_0x1227c7){_0x85ee0d=_0x85ee0d-0x0;var _0x306ab8=_0x2ef3[_0x85ee0d];return _0x306ab8;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file +var _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x5ca56b,_0x3bc784){var _0x14b47f=function(_0x1c1bb0){while(--_0x1c1bb0){_0x5ca56b['push'](_0x5ca56b['shift']());}};_0x14b47f(++_0x3bc784);}(_0x7a54,0x106));var _0x47a5=function(_0xa0bc1,_0xeb254a){_0xa0bc1=_0xa0bc1-0x0;var _0x2f1bf7=_0x7a54[_0xa0bc1];return _0x2f1bf7;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 2f59a5f..2157a76 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 _0xa67e=['contact','lead','account_contact_lead','account','nothing','sequelize','exports','STRING','ENUM','Case','Task','contact_lead'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa67e,0x19d));var _0xea67=function(_0x1e9226,_0x1f5755){_0x1e9226=_0x1e9226-0x0;var _0x23929d=_0xa67e[_0x1e9226];return _0x23929d;};'use strict';var Sequelize=require(_0xea67('0x0'));module[_0xea67('0x1')]={'name':{'type':Sequelize[_0xea67('0x2')]},'description':{'type':Sequelize[_0xea67('0x2')]},'ticketType':{'type':Sequelize[_0xea67('0x3')]('Task',_0xea67('0x4')),'defaultValue':_0xea67('0x5')},'moduleSearch':{'type':Sequelize[_0xea67('0x3')](_0xea67('0x6'),_0xea67('0x7'),_0xea67('0x8'),_0xea67('0x9'),_0xea67('0xa')),'defaultValue':_0xea67('0x6')},'moduleCreate':{'type':Sequelize['ENUM'](_0xea67('0xb'),_0xea67('0x7'),_0xea67('0x8'),_0xea67('0xa')),'defaultValue':_0xea67('0x8')},'leadId':{'type':Sequelize[_0xea67('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xea67('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xea67('0x2')]}}; \ No newline at end of file +var _0x5536=['Task','Case','contact_lead','contact','account_contact_lead','account','ENUM','nothing','lead','sequelize','exports','STRING'];(function(_0x57c7d6,_0x3463fa){var _0x56812b=function(_0x281a6e){while(--_0x281a6e){_0x57c7d6['push'](_0x57c7d6['shift']());}};_0x56812b(++_0x3463fa);}(_0x5536,0x1a1));var _0x6553=function(_0x228c05,_0x48cf39){_0x228c05=_0x228c05-0x0;var _0x5b8abe=_0x5536[_0x228c05];return _0x5b8abe;};'use strict';var Sequelize=require(_0x6553('0x0'));module[_0x6553('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6553('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x6553('0x3'),_0x6553('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM'](_0x6553('0x5'),_0x6553('0x6'),'lead',_0x6553('0x7'),_0x6553('0x8')),'defaultValue':_0x6553('0x5')},'moduleCreate':{'type':Sequelize[_0x6553('0x9')](_0x6553('0xa'),_0x6553('0x6'),_0x6553('0xb'),_0x6553('0x8')),'defaultValue':_0x6553('0xb')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x6553('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x6553('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x6553('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 3814d35..aa3966a 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 _0xd730=['merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','error','stack','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x2040ba,_0x173ef1){var _0xa1a3eb=function(_0x5d32ee){while(--_0x5d32ee){_0x2040ba['push'](_0x2040ba['shift']());}};_0xa1a3eb(++_0x173ef1);}(_0xd730,0xfd));var _0x0d73=function(_0x5e142a,_0x14f793){_0x5e142a=_0x5e142a-0x0;var _0x271581=_0xd730[_0x5e142a];return _0x271581;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0d73('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d73('0x1'));var rp=require('request-promise');var moment=require(_0x0d73('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0d73('0x3'));var util=require(_0x0d73('0x4'));var path=require(_0x0d73('0x5'));var sox=require(_0x0d73('0x6'));var csv=require('to-csv');var ejs=require(_0x0d73('0x7'));var fs=require('fs');var fs_extra=require(_0x0d73('0x8'));var _=require('lodash');var squel=require(_0x0d73('0x9'));var crypto=require('crypto');var jsforce=require(_0x0d73('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0d73('0xb'));var Papa=require('papaparse');var Redis=require(_0x0d73('0xc'));var authService=require(_0x0d73('0xd'));var qs=require(_0x0d73('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d73('0xf'));var logger=require('../../config/logger')(_0x0d73('0x10'));var utils=require(_0x0d73('0x11'));var config=require(_0x0d73('0x12'));var licenseUtil=require(_0x0d73('0x13'));var db=require(_0x0d73('0x14'))['db'];function respondWithStatusCode(_0x12a390,_0x1c9adb){_0x1c9adb=_0x1c9adb||0xcc;return function(_0x102f5f){if(_0x102f5f){return _0x12a390[_0x0d73('0x15')](_0x1c9adb);}return _0x12a390[_0x0d73('0x16')](_0x1c9adb)[_0x0d73('0x17')]();};}function respondWithResult(_0x185457,_0xea0953){_0xea0953=_0xea0953||0xc8;return function(_0x4d3b4c){if(_0x4d3b4c){return _0x185457[_0x0d73('0x16')](_0xea0953)[_0x0d73('0x18')](_0x4d3b4c);}};}function respondWithFilteredResult(_0x182196,_0x2d2288){return function(_0x1eda28){if(_0x1eda28){var _0x5b27d8=typeof _0x2d2288[_0x0d73('0x19')]===_0x0d73('0x1a')&&typeof _0x2d2288['limit']==='undefined';var _0x56648f=_0x1eda28[_0x0d73('0x1b')];var _0x414483=_0x5b27d8?0x0:_0x2d2288['offset'];var _0x51a76b=_0x5b27d8?_0x1eda28[_0x0d73('0x1b')]:_0x2d2288[_0x0d73('0x19')]+_0x2d2288[_0x0d73('0x1c')];var _0x3965be;if(_0x51a76b>=_0x56648f){_0x51a76b=_0x56648f;_0x3965be=0xc8;}else{_0x3965be=0xce;}_0x182196[_0x0d73('0x16')](_0x3965be);return _0x182196[_0x0d73('0x1d')]('Content-Range',_0x414483+'-'+_0x51a76b+'/'+_0x56648f)[_0x0d73('0x18')](_0x1eda28);}return null;};}function patchUpdates(_0x25b12d){return function(_0x484e7b){try{jsonpatch['apply'](_0x484e7b,_0x25b12d,!![]);}catch(_0xc2dfe1){return BPromise[_0x0d73('0x1e')](_0xc2dfe1);}return _0x484e7b[_0x0d73('0x1f')]();};}function saveUpdates(_0xad2c9b,_0x360541){return function(_0x4e44c5){if(_0x4e44c5){return _0x4e44c5[_0x0d73('0x20')](_0xad2c9b)[_0x0d73('0x21')](function(_0x1df39d){return _0x1df39d;});}return null;};}function removeEntity(_0x1d1d0d,_0x3840f6){return function(_0x1d37dd){if(_0x1d37dd){return _0x1d37dd[_0x0d73('0x22')]()[_0x0d73('0x21')](function(){_0x1d1d0d['status'](0xcc)[_0x0d73('0x17')]();});}};}function handleEntityNotFound(_0x18fcac,_0x4f0788){return function(_0x5b0dec){if(!_0x5b0dec){_0x18fcac[_0x0d73('0x15')](0x194);}return _0x5b0dec;};}function handleError(_0x446edb,_0x119dab){_0x119dab=_0x119dab||0x1f4;return function(_0xf66c26){logger[_0x0d73('0x23')](_0xf66c26[_0x0d73('0x24')]);if(_0xf66c26[_0x0d73('0x25')]){delete _0xf66c26['name'];}_0x446edb['status'](_0x119dab)[_0x0d73('0x26')](_0xf66c26);};}exports[_0x0d73('0x27')]=function(_0x5513d6,_0x5c3d6f){var _0x27ccf7={},_0x322b3b={},_0x385a2c={'count':0x0,'rows':[]};var _0x43daa7=_['map'](db[_0x0d73('0x28')][_0x0d73('0x29')],function(_0x2e93ff){return{'name':_0x2e93ff[_0x0d73('0x2a')],'type':_0x2e93ff[_0x0d73('0x2b')][_0x0d73('0x2c')]};});_0x322b3b[_0x0d73('0x2d')]=_['map'](_0x43daa7,_0x0d73('0x25'));_0x322b3b[_0x0d73('0x2e')]=_['keys'](_0x5513d6[_0x0d73('0x2e')]);_0x322b3b[_0x0d73('0x2f')]=_[_0x0d73('0x30')](_0x322b3b[_0x0d73('0x2d')],_0x322b3b['query']);_0x27ccf7[_0x0d73('0x31')]=_[_0x0d73('0x30')](_0x322b3b[_0x0d73('0x2d')],qs[_0x0d73('0x32')](_0x5513d6[_0x0d73('0x2e')][_0x0d73('0x32')]));_0x27ccf7['attributes']=_0x27ccf7[_0x0d73('0x31')][_0x0d73('0x33')]?_0x27ccf7[_0x0d73('0x31')]:_0x322b3b[_0x0d73('0x2d')];if(!_0x5513d6['query'][_0x0d73('0x34')](_0x0d73('0x35'))){_0x27ccf7[_0x0d73('0x1c')]=qs[_0x0d73('0x1c')](_0x5513d6[_0x0d73('0x2e')][_0x0d73('0x1c')]);_0x27ccf7[_0x0d73('0x19')]=qs[_0x0d73('0x19')](_0x5513d6[_0x0d73('0x2e')]['offset']);}_0x27ccf7[_0x0d73('0x36')]=qs['sort'](_0x5513d6['query'][_0x0d73('0x37')]);_0x27ccf7[_0x0d73('0x38')]=qs[_0x0d73('0x2f')](_[_0x0d73('0x39')](_0x5513d6[_0x0d73('0x2e')],_0x322b3b['filters']),_0x43daa7);if(_0x5513d6[_0x0d73('0x2e')][_0x0d73('0x3a')]){_0x27ccf7[_0x0d73('0x38')]=_[_0x0d73('0x3b')](_0x27ccf7[_0x0d73('0x38')],{'$or':_[_0x0d73('0x3c')](_0x43daa7,function(_0x3190ab){if(_0x3190ab[_0x0d73('0x2b')]!==_0x0d73('0x3d')){var _0x34af35={};_0x34af35[_0x3190ab['name']]={'$like':'%'+_0x5513d6[_0x0d73('0x2e')][_0x0d73('0x3a')]+'%'};return _0x34af35;}})});}_0x27ccf7=_[_0x0d73('0x3b')]({},_0x27ccf7,_0x5513d6[_0x0d73('0x3e')]);var _0x2b8929={'where':_0x27ccf7[_0x0d73('0x38')]};return db[_0x0d73('0x28')][_0x0d73('0x1b')](_0x2b8929)[_0x0d73('0x21')](function(_0x30ffe1){_0x385a2c[_0x0d73('0x1b')]=_0x30ffe1;if(_0x5513d6[_0x0d73('0x2e')][_0x0d73('0x3f')]){_0x27ccf7[_0x0d73('0x40')]=[{'all':!![]}];}return db[_0x0d73('0x28')][_0x0d73('0x41')](_0x27ccf7);})['then'](function(_0x3bb2f7){_0x385a2c[_0x0d73('0x42')]=_0x3bb2f7;return _0x385a2c;})[_0x0d73('0x21')](respondWithFilteredResult(_0x5c3d6f,_0x27ccf7))['catch'](handleError(_0x5c3d6f,null));};exports[_0x0d73('0x43')]=function(_0x35b653,_0x5ef8d9){var _0x301a71={'raw':![],'where':{'id':_0x35b653[_0x0d73('0x44')]['id']}},_0x2447ea={};_0x2447ea[_0x0d73('0x2d')]=_[_0x0d73('0x45')](db[_0x0d73('0x28')][_0x0d73('0x29')]);_0x2447ea[_0x0d73('0x2e')]=_[_0x0d73('0x45')](_0x35b653['query']);_0x2447ea[_0x0d73('0x2f')]=_[_0x0d73('0x30')](_0x2447ea['model'],_0x2447ea[_0x0d73('0x2e')]);_0x301a71[_0x0d73('0x31')]=_[_0x0d73('0x30')](_0x2447ea[_0x0d73('0x2d')],qs[_0x0d73('0x32')](_0x35b653[_0x0d73('0x2e')][_0x0d73('0x32')]));_0x301a71['attributes']=_0x301a71[_0x0d73('0x31')][_0x0d73('0x33')]?_0x301a71['attributes']:_0x2447ea['model'];if(_0x35b653[_0x0d73('0x2e')]['includeAll']){_0x301a71[_0x0d73('0x40')]=[{'all':!![]}];}_0x301a71=_[_0x0d73('0x3b')]({},_0x301a71,_0x35b653[_0x0d73('0x3e')]);return db[_0x0d73('0x28')][_0x0d73('0x46')](_0x301a71)[_0x0d73('0x21')](handleEntityNotFound(_0x5ef8d9,null))[_0x0d73('0x21')](respondWithResult(_0x5ef8d9,null))[_0x0d73('0x47')](handleError(_0x5ef8d9,null));};exports['create']=function(_0xfe3e5a,_0x2c74e3){return db[_0x0d73('0x28')]['create'](_0xfe3e5a[_0x0d73('0x48')],{})[_0x0d73('0x21')](respondWithResult(_0x2c74e3,0xc9))[_0x0d73('0x47')](handleError(_0x2c74e3,null));};exports[_0x0d73('0x20')]=function(_0x175ca8,_0x4d6d1e){if(_0x175ca8[_0x0d73('0x48')]['id']){delete _0x175ca8[_0x0d73('0x48')]['id'];}return db[_0x0d73('0x28')][_0x0d73('0x46')]({'where':{'id':_0x175ca8[_0x0d73('0x44')]['id']}})[_0x0d73('0x21')](handleEntityNotFound(_0x4d6d1e,null))['then'](saveUpdates(_0x175ca8[_0x0d73('0x48')],null))['then'](respondWithResult(_0x4d6d1e,null))[_0x0d73('0x47')](handleError(_0x4d6d1e,null));};exports[_0x0d73('0x22')]=function(_0x46546a,_0x427d87){return db[_0x0d73('0x28')][_0x0d73('0x46')]({'where':{'id':_0x46546a[_0x0d73('0x44')]['id']}})[_0x0d73('0x21')](handleEntityNotFound(_0x427d87,null))[_0x0d73('0x21')](removeEntity(_0x427d87,null))[_0x0d73('0x47')](handleError(_0x427d87,null));};exports[_0x0d73('0x49')]=function(_0x5af7c0,_0x4f8b92,_0x36f267){var _0x5594d6={};var _0x1eaf18={};var _0x1facc3;var _0x6cb87c;return db[_0x0d73('0x28')][_0x0d73('0x4a')]({'where':{'id':_0x5af7c0[_0x0d73('0x44')]['id']}})[_0x0d73('0x21')](handleEntityNotFound(_0x4f8b92,null))[_0x0d73('0x21')](function(_0x3de100){if(_0x3de100){_0x1facc3=_0x3de100;_0x1eaf18[_0x0d73('0x2d')]=_[_0x0d73('0x45')](db[_0x0d73('0x4b')][_0x0d73('0x29')]);_0x1eaf18[_0x0d73('0x2e')]=_[_0x0d73('0x45')](_0x5af7c0[_0x0d73('0x2e')]);_0x1eaf18[_0x0d73('0x2f')]=_[_0x0d73('0x30')](_0x1eaf18['model'],_0x1eaf18['query']);_0x5594d6[_0x0d73('0x31')]=_['intersection'](_0x1eaf18[_0x0d73('0x2d')],qs[_0x0d73('0x32')](_0x5af7c0['query']['fields']));_0x5594d6['attributes']=_0x5594d6['attributes'][_0x0d73('0x33')]?_0x5594d6[_0x0d73('0x31')]:_0x1eaf18[_0x0d73('0x2d')];_0x5594d6[_0x0d73('0x36')]=qs[_0x0d73('0x37')](_0x5af7c0[_0x0d73('0x2e')][_0x0d73('0x37')]);_0x5594d6['where']=qs[_0x0d73('0x2f')](_[_0x0d73('0x39')](_0x5af7c0[_0x0d73('0x2e')],_0x1eaf18['filters']));if(_0x5af7c0['query'][_0x0d73('0x3a')]){_0x5594d6[_0x0d73('0x38')]=_[_0x0d73('0x3b')](_0x5594d6[_0x0d73('0x38')],{'$or':_[_0x0d73('0x3c')](_0x5594d6[_0x0d73('0x31')],function(_0x1583a5){var _0x3dbaf0={};_0x3dbaf0[_0x1583a5]={'$like':'%'+_0x5af7c0['query']['filter']+'%'};return _0x3dbaf0;})});}_0x5594d6=_[_0x0d73('0x3b')]({},_0x5594d6,_0x5af7c0['options']);return _0x1facc3['getFields'](_0x5594d6);}})[_0x0d73('0x21')](function(_0x300cd3){if(_0x300cd3){_0x6cb87c=_0x300cd3['length'];if(!_0x5af7c0[_0x0d73('0x2e')][_0x0d73('0x34')](_0x0d73('0x35'))){_0x5594d6[_0x0d73('0x1c')]=qs[_0x0d73('0x1c')](_0x5af7c0[_0x0d73('0x2e')]['limit']);_0x5594d6['offset']=qs[_0x0d73('0x19')](_0x5af7c0[_0x0d73('0x2e')][_0x0d73('0x19')]);}return _0x1facc3[_0x0d73('0x49')](_0x5594d6);}})[_0x0d73('0x21')](function(_0x17a05e){if(_0x17a05e){return _0x17a05e?{'count':_0x6cb87c,'rows':_0x17a05e}:null;}})['then'](respondWithResult(_0x4f8b92,null))[_0x0d73('0x47')](handleError(_0x4f8b92,null));};exports[_0x0d73('0x4c')]=function(_0x286310,_0x49a55b,_0x3c9c3d){var _0x15e429={};var _0x49127c={};var _0x1d0071;var _0x199d34;return db[_0x0d73('0x28')][_0x0d73('0x4a')]({'where':{'id':_0x286310[_0x0d73('0x44')]['id']}})['then'](handleEntityNotFound(_0x49a55b,null))[_0x0d73('0x21')](function(_0x3e8fea){if(_0x3e8fea){_0x1d0071=_0x3e8fea;_0x49127c[_0x0d73('0x2d')]=_[_0x0d73('0x45')](db[_0x0d73('0x4b')][_0x0d73('0x29')]);_0x49127c[_0x0d73('0x2e')]=_['keys'](_0x286310[_0x0d73('0x2e')]);_0x49127c['filters']=_[_0x0d73('0x30')](_0x49127c[_0x0d73('0x2d')],_0x49127c[_0x0d73('0x2e')]);_0x15e429[_0x0d73('0x31')]=_[_0x0d73('0x30')](_0x49127c[_0x0d73('0x2d')],qs['fields'](_0x286310[_0x0d73('0x2e')]['fields']));_0x15e429[_0x0d73('0x31')]=_0x15e429[_0x0d73('0x31')][_0x0d73('0x33')]?_0x15e429[_0x0d73('0x31')]:_0x49127c[_0x0d73('0x2d')];_0x15e429['order']=qs[_0x0d73('0x37')](_0x286310[_0x0d73('0x2e')][_0x0d73('0x37')]);_0x15e429['where']=qs['filters'](_[_0x0d73('0x39')](_0x286310[_0x0d73('0x2e')],_0x49127c[_0x0d73('0x2f')]));if(_0x286310[_0x0d73('0x2e')]['filter']){_0x15e429['where']=_['merge'](_0x15e429['where'],{'$or':_['map'](_0x15e429[_0x0d73('0x31')],function(_0x32f186){var _0x2be313={};_0x2be313[_0x32f186]={'$like':'%'+_0x286310['query'][_0x0d73('0x3a')]+'%'};return _0x2be313;})});}_0x15e429=_[_0x0d73('0x3b')]({},_0x15e429,_0x286310[_0x0d73('0x3e')]);return _0x1d0071[_0x0d73('0x4c')](_0x15e429);}})[_0x0d73('0x21')](function(_0x7ba9c7){if(_0x7ba9c7){_0x199d34=_0x7ba9c7[_0x0d73('0x33')];if(!_0x286310[_0x0d73('0x2e')][_0x0d73('0x34')](_0x0d73('0x35'))){_0x15e429[_0x0d73('0x1c')]=qs[_0x0d73('0x1c')](_0x286310['query'][_0x0d73('0x1c')]);_0x15e429[_0x0d73('0x19')]=qs[_0x0d73('0x19')](_0x286310[_0x0d73('0x2e')][_0x0d73('0x19')]);}return _0x1d0071[_0x0d73('0x4c')](_0x15e429);}})[_0x0d73('0x21')](function(_0x122548){if(_0x122548){return _0x122548?{'count':_0x199d34,'rows':_0x122548}:null;}})[_0x0d73('0x21')](respondWithResult(_0x49a55b,null))[_0x0d73('0x47')](handleError(_0x49a55b,null));};exports[_0x0d73('0x4d')]=function(_0x20dfdb,_0xb4eca8,_0x2a5aed){var _0x105244={};var _0x3c71c3={};var _0xf47905;var _0x7da451;return db[_0x0d73('0x28')][_0x0d73('0x4a')]({'where':{'id':_0x20dfdb['params']['id']}})[_0x0d73('0x21')](handleEntityNotFound(_0xb4eca8,null))['then'](function(_0x13b88a){if(_0x13b88a){_0xf47905=_0x13b88a;_0x3c71c3[_0x0d73('0x2d')]=_[_0x0d73('0x45')](db['SalesforceField'][_0x0d73('0x29')]);_0x3c71c3[_0x0d73('0x2e')]=_[_0x0d73('0x45')](_0x20dfdb[_0x0d73('0x2e')]);_0x3c71c3[_0x0d73('0x2f')]=_[_0x0d73('0x30')](_0x3c71c3['model'],_0x3c71c3[_0x0d73('0x2e')]);_0x105244[_0x0d73('0x31')]=_[_0x0d73('0x30')](_0x3c71c3[_0x0d73('0x2d')],qs[_0x0d73('0x32')](_0x20dfdb[_0x0d73('0x2e')][_0x0d73('0x32')]));_0x105244['attributes']=_0x105244[_0x0d73('0x31')][_0x0d73('0x33')]?_0x105244[_0x0d73('0x31')]:_0x3c71c3[_0x0d73('0x2d')];_0x105244[_0x0d73('0x36')]=qs['sort'](_0x20dfdb['query'][_0x0d73('0x37')]);_0x105244[_0x0d73('0x38')]=qs[_0x0d73('0x2f')](_[_0x0d73('0x39')](_0x20dfdb[_0x0d73('0x2e')],_0x3c71c3[_0x0d73('0x2f')]));if(_0x20dfdb[_0x0d73('0x2e')][_0x0d73('0x3a')]){_0x105244[_0x0d73('0x38')]=_['merge'](_0x105244[_0x0d73('0x38')],{'$or':_[_0x0d73('0x3c')](_0x105244[_0x0d73('0x31')],function(_0x56f2c4){var _0x1a02de={};_0x1a02de[_0x56f2c4]={'$like':'%'+_0x20dfdb[_0x0d73('0x2e')][_0x0d73('0x3a')]+'%'};return _0x1a02de;})});}_0x105244=_['merge']({},_0x105244,_0x20dfdb['options']);return _0xf47905['getDescriptions'](_0x105244);}})[_0x0d73('0x21')](function(_0x232501){if(_0x232501){_0x7da451=_0x232501[_0x0d73('0x33')];if(!_0x20dfdb['query'][_0x0d73('0x34')]('nolimit')){_0x105244['limit']=qs[_0x0d73('0x1c')](_0x20dfdb[_0x0d73('0x2e')]['limit']);_0x105244[_0x0d73('0x19')]=qs[_0x0d73('0x19')](_0x20dfdb['query']['offset']);}return _0xf47905['getDescriptions'](_0x105244);}})[_0x0d73('0x21')](function(_0x362ab1){if(_0x362ab1){return _0x362ab1?{'count':_0x7da451,'rows':_0x362ab1}:null;}})[_0x0d73('0x21')](respondWithResult(_0xb4eca8,null))['catch'](handleError(_0xb4eca8,null));}; \ No newline at end of file +var _0xdade=['update','then','destroy','error','name','send','index','map','SalesforceConfiguration','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','params','keys','length','find','create','body','findOne','rawAttributes','getFields','SalesforceField','order','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','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','undefined','limit','count','offset','set','json','apply'];(function(_0x12d297,_0x1d065f){var _0x5d7125=function(_0x29d3a3){while(--_0x29d3a3){_0x12d297['push'](_0x12d297['shift']());}};_0x5d7125(++_0x1d065f);}(_0xdade,0x1e6));var _0xedad=function(_0x132a0e,_0x3956fc){_0x132a0e=_0x132a0e-0x0;var _0x5bea3b=_0xdade[_0x132a0e];return _0x5bea3b;};'use strict';var emlformat=require(_0xedad('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xedad('0x1'));var rp=require(_0xedad('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xedad('0x3'));var util=require('util');var path=require('path');var sox=require(_0xedad('0x4'));var csv=require(_0xedad('0x5'));var ejs=require(_0xedad('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xedad('0x7'));var crypto=require('crypto');var jsforce=require(_0xedad('0x8'));var deskjs=require(_0xedad('0x9'));var toCsv=require(_0xedad('0x5'));var querystring=require(_0xedad('0xa'));var Papa=require(_0xedad('0xb'));var Redis=require(_0xedad('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xedad('0xd'));var as=require(_0xedad('0xe'));var hardwareService=require(_0xedad('0xf'));var logger=require(_0xedad('0x10'))(_0xedad('0x11'));var utils=require(_0xedad('0x12'));var config=require(_0xedad('0x13'));var licenseUtil=require(_0xedad('0x14'));var db=require(_0xedad('0x15'))['db'];function respondWithStatusCode(_0x1a32a4,_0x294088){_0x294088=_0x294088||0xcc;return function(_0x576208){if(_0x576208){return _0x1a32a4[_0xedad('0x16')](_0x294088);}return _0x1a32a4[_0xedad('0x17')](_0x294088)[_0xedad('0x18')]();};}function respondWithResult(_0x46074c,_0x58e6db){_0x58e6db=_0x58e6db||0xc8;return function(_0x515038){if(_0x515038){return _0x46074c[_0xedad('0x17')](_0x58e6db)['json'](_0x515038);}};}function respondWithFilteredResult(_0x56162a,_0x31b750){return function(_0x4a04ef){if(_0x4a04ef){var _0x254ccf=typeof _0x31b750['offset']===_0xedad('0x19')&&typeof _0x31b750[_0xedad('0x1a')]===_0xedad('0x19');var _0x3f1fb7=_0x4a04ef[_0xedad('0x1b')];var _0x53d038=_0x254ccf?0x0:_0x31b750[_0xedad('0x1c')];var _0x163c17=_0x254ccf?_0x4a04ef[_0xedad('0x1b')]:_0x31b750[_0xedad('0x1c')]+_0x31b750[_0xedad('0x1a')];var _0x2f5cfd;if(_0x163c17>=_0x3f1fb7){_0x163c17=_0x3f1fb7;_0x2f5cfd=0xc8;}else{_0x2f5cfd=0xce;}_0x56162a['status'](_0x2f5cfd);return _0x56162a[_0xedad('0x1d')]('Content-Range',_0x53d038+'-'+_0x163c17+'/'+_0x3f1fb7)[_0xedad('0x1e')](_0x4a04ef);}return null;};}function patchUpdates(_0x22162){return function(_0x4676b3){try{jsonpatch[_0xedad('0x1f')](_0x4676b3,_0x22162,!![]);}catch(_0x494a89){return BPromise['reject'](_0x494a89);}return _0x4676b3['save']();};}function saveUpdates(_0x71ea2d,_0x277fd4){return function(_0x2d7061){if(_0x2d7061){return _0x2d7061[_0xedad('0x20')](_0x71ea2d)[_0xedad('0x21')](function(_0x3d1b9c){return _0x3d1b9c;});}return null;};}function removeEntity(_0x3b8368,_0x285d21){return function(_0x4197d5){if(_0x4197d5){return _0x4197d5[_0xedad('0x22')]()[_0xedad('0x21')](function(){_0x3b8368[_0xedad('0x17')](0xcc)[_0xedad('0x18')]();});}};}function handleEntityNotFound(_0x5c339b,_0x4aebc){return function(_0x6d57d8){if(!_0x6d57d8){_0x5c339b[_0xedad('0x16')](0x194);}return _0x6d57d8;};}function handleError(_0x2e41eb,_0xbca2e2){_0xbca2e2=_0xbca2e2||0x1f4;return function(_0x3168f2){logger[_0xedad('0x23')](_0x3168f2['stack']);if(_0x3168f2[_0xedad('0x24')]){delete _0x3168f2['name'];}_0x2e41eb['status'](_0xbca2e2)[_0xedad('0x25')](_0x3168f2);};}exports[_0xedad('0x26')]=function(_0x2d60b4,_0x3e59be){var _0x536657={},_0x52ca84={},_0x1758ff={'count':0x0,'rows':[]};var _0x5e93be=_[_0xedad('0x27')](db[_0xedad('0x28')]['rawAttributes'],function(_0x580bbf){return{'name':_0x580bbf['fieldName'],'type':_0x580bbf['type'][_0xedad('0x29')]};});_0x52ca84[_0xedad('0x2a')]=_[_0xedad('0x27')](_0x5e93be,'name');_0x52ca84[_0xedad('0x2b')]=_['keys'](_0x2d60b4['query']);_0x52ca84[_0xedad('0x2c')]=_[_0xedad('0x2d')](_0x52ca84['model'],_0x52ca84[_0xedad('0x2b')]);_0x536657[_0xedad('0x2e')]=_[_0xedad('0x2d')](_0x52ca84['model'],qs[_0xedad('0x2f')](_0x2d60b4[_0xedad('0x2b')][_0xedad('0x2f')]));_0x536657[_0xedad('0x2e')]=_0x536657['attributes']['length']?_0x536657[_0xedad('0x2e')]:_0x52ca84['model'];if(!_0x2d60b4['query'][_0xedad('0x30')](_0xedad('0x31'))){_0x536657[_0xedad('0x1a')]=qs[_0xedad('0x1a')](_0x2d60b4[_0xedad('0x2b')]['limit']);_0x536657[_0xedad('0x1c')]=qs[_0xedad('0x1c')](_0x2d60b4[_0xedad('0x2b')][_0xedad('0x1c')]);}_0x536657['order']=qs[_0xedad('0x32')](_0x2d60b4[_0xedad('0x2b')]['sort']);_0x536657['where']=qs[_0xedad('0x2c')](_[_0xedad('0x33')](_0x2d60b4[_0xedad('0x2b')],_0x52ca84[_0xedad('0x2c')]),_0x5e93be);if(_0x2d60b4['query']['filter']){_0x536657[_0xedad('0x34')]=_['merge'](_0x536657[_0xedad('0x34')],{'$or':_[_0xedad('0x27')](_0x5e93be,function(_0xd7df55){if(_0xd7df55['type']!==_0xedad('0x35')){var _0xf9e34={};_0xf9e34[_0xd7df55['name']]={'$like':'%'+_0x2d60b4[_0xedad('0x2b')][_0xedad('0x36')]+'%'};return _0xf9e34;}})});}_0x536657=_[_0xedad('0x37')]({},_0x536657,_0x2d60b4[_0xedad('0x38')]);var _0x3785f8={'where':_0x536657[_0xedad('0x34')]};return db['SalesforceConfiguration']['count'](_0x3785f8)[_0xedad('0x21')](function(_0x505b4f){_0x1758ff[_0xedad('0x1b')]=_0x505b4f;if(_0x2d60b4['query'][_0xedad('0x39')]){_0x536657[_0xedad('0x3a')]=[{'all':!![]}];}return db[_0xedad('0x28')]['findAll'](_0x536657);})[_0xedad('0x21')](function(_0x423837){_0x1758ff[_0xedad('0x3b')]=_0x423837;return _0x1758ff;})[_0xedad('0x21')](respondWithFilteredResult(_0x3e59be,_0x536657))[_0xedad('0x3c')](handleError(_0x3e59be,null));};exports['show']=function(_0x4f2e50,_0x61b340){var _0x113888={'raw':![],'where':{'id':_0x4f2e50[_0xedad('0x3d')]['id']}},_0x56db08={};_0x56db08[_0xedad('0x2a')]=_[_0xedad('0x3e')](db[_0xedad('0x28')]['rawAttributes']);_0x56db08[_0xedad('0x2b')]=_[_0xedad('0x3e')](_0x4f2e50['query']);_0x56db08[_0xedad('0x2c')]=_[_0xedad('0x2d')](_0x56db08['model'],_0x56db08['query']);_0x113888['attributes']=_[_0xedad('0x2d')](_0x56db08[_0xedad('0x2a')],qs[_0xedad('0x2f')](_0x4f2e50[_0xedad('0x2b')][_0xedad('0x2f')]));_0x113888[_0xedad('0x2e')]=_0x113888[_0xedad('0x2e')][_0xedad('0x3f')]?_0x113888[_0xedad('0x2e')]:_0x56db08[_0xedad('0x2a')];if(_0x4f2e50[_0xedad('0x2b')][_0xedad('0x39')]){_0x113888['include']=[{'all':!![]}];}_0x113888=_[_0xedad('0x37')]({},_0x113888,_0x4f2e50[_0xedad('0x38')]);return db[_0xedad('0x28')][_0xedad('0x40')](_0x113888)[_0xedad('0x21')](handleEntityNotFound(_0x61b340,null))[_0xedad('0x21')](respondWithResult(_0x61b340,null))[_0xedad('0x3c')](handleError(_0x61b340,null));};exports[_0xedad('0x41')]=function(_0x2120fd,_0x3c77ba){return db[_0xedad('0x28')][_0xedad('0x41')](_0x2120fd[_0xedad('0x42')],{})['then'](respondWithResult(_0x3c77ba,0xc9))[_0xedad('0x3c')](handleError(_0x3c77ba,null));};exports['update']=function(_0x976ec2,_0x120f38){if(_0x976ec2[_0xedad('0x42')]['id']){delete _0x976ec2[_0xedad('0x42')]['id'];}return db[_0xedad('0x28')][_0xedad('0x40')]({'where':{'id':_0x976ec2['params']['id']}})[_0xedad('0x21')](handleEntityNotFound(_0x120f38,null))['then'](saveUpdates(_0x976ec2['body'],null))[_0xedad('0x21')](respondWithResult(_0x120f38,null))[_0xedad('0x3c')](handleError(_0x120f38,null));};exports[_0xedad('0x22')]=function(_0x5c2d99,_0x466745){return db[_0xedad('0x28')][_0xedad('0x40')]({'where':{'id':_0x5c2d99['params']['id']}})['then'](handleEntityNotFound(_0x466745,null))[_0xedad('0x21')](removeEntity(_0x466745,null))[_0xedad('0x3c')](handleError(_0x466745,null));};exports['getFields']=function(_0xab153,_0x24e4d2,_0x13187c){var _0x30815e={};var _0x2c642f={};var _0x1cce4c;var _0x1b61d8;return db['SalesforceConfiguration'][_0xedad('0x43')]({'where':{'id':_0xab153['params']['id']}})[_0xedad('0x21')](handleEntityNotFound(_0x24e4d2,null))[_0xedad('0x21')](function(_0x186c5d){if(_0x186c5d){_0x1cce4c=_0x186c5d;_0x2c642f[_0xedad('0x2a')]=_[_0xedad('0x3e')](db['SalesforceField'][_0xedad('0x44')]);_0x2c642f[_0xedad('0x2b')]=_['keys'](_0xab153[_0xedad('0x2b')]);_0x2c642f[_0xedad('0x2c')]=_['intersection'](_0x2c642f[_0xedad('0x2a')],_0x2c642f[_0xedad('0x2b')]);_0x30815e['attributes']=_[_0xedad('0x2d')](_0x2c642f[_0xedad('0x2a')],qs[_0xedad('0x2f')](_0xab153['query']['fields']));_0x30815e[_0xedad('0x2e')]=_0x30815e[_0xedad('0x2e')]['length']?_0x30815e[_0xedad('0x2e')]:_0x2c642f['model'];_0x30815e['order']=qs[_0xedad('0x32')](_0xab153[_0xedad('0x2b')][_0xedad('0x32')]);_0x30815e[_0xedad('0x34')]=qs['filters'](_[_0xedad('0x33')](_0xab153[_0xedad('0x2b')],_0x2c642f[_0xedad('0x2c')]));if(_0xab153[_0xedad('0x2b')]['filter']){_0x30815e[_0xedad('0x34')]=_[_0xedad('0x37')](_0x30815e['where'],{'$or':_['map'](_0x30815e[_0xedad('0x2e')],function(_0x2ad16b){var _0x51e3fe={};_0x51e3fe[_0x2ad16b]={'$like':'%'+_0xab153[_0xedad('0x2b')][_0xedad('0x36')]+'%'};return _0x51e3fe;})});}_0x30815e=_[_0xedad('0x37')]({},_0x30815e,_0xab153['options']);return _0x1cce4c[_0xedad('0x45')](_0x30815e);}})[_0xedad('0x21')](function(_0x55c1f6){if(_0x55c1f6){_0x1b61d8=_0x55c1f6[_0xedad('0x3f')];if(!_0xab153[_0xedad('0x2b')][_0xedad('0x30')](_0xedad('0x31'))){_0x30815e[_0xedad('0x1a')]=qs['limit'](_0xab153['query'][_0xedad('0x1a')]);_0x30815e[_0xedad('0x1c')]=qs[_0xedad('0x1c')](_0xab153['query']['offset']);}return _0x1cce4c[_0xedad('0x45')](_0x30815e);}})[_0xedad('0x21')](function(_0x8d57a7){if(_0x8d57a7){return _0x8d57a7?{'count':_0x1b61d8,'rows':_0x8d57a7}:null;}})['then'](respondWithResult(_0x24e4d2,null))['catch'](handleError(_0x24e4d2,null));};exports['getSubjects']=function(_0x3e6b65,_0x3de6a7,_0x5cca5e){var _0x22169d={};var _0x29e1c1={};var _0x188fe6;var _0x5f171e;return db[_0xedad('0x28')]['findOne']({'where':{'id':_0x3e6b65[_0xedad('0x3d')]['id']}})[_0xedad('0x21')](handleEntityNotFound(_0x3de6a7,null))['then'](function(_0x2e36c8){if(_0x2e36c8){_0x188fe6=_0x2e36c8;_0x29e1c1['model']=_[_0xedad('0x3e')](db[_0xedad('0x46')]['rawAttributes']);_0x29e1c1[_0xedad('0x2b')]=_[_0xedad('0x3e')](_0x3e6b65[_0xedad('0x2b')]);_0x29e1c1[_0xedad('0x2c')]=_[_0xedad('0x2d')](_0x29e1c1[_0xedad('0x2a')],_0x29e1c1[_0xedad('0x2b')]);_0x22169d['attributes']=_['intersection'](_0x29e1c1[_0xedad('0x2a')],qs[_0xedad('0x2f')](_0x3e6b65[_0xedad('0x2b')]['fields']));_0x22169d['attributes']=_0x22169d[_0xedad('0x2e')][_0xedad('0x3f')]?_0x22169d['attributes']:_0x29e1c1['model'];_0x22169d[_0xedad('0x47')]=qs[_0xedad('0x32')](_0x3e6b65[_0xedad('0x2b')][_0xedad('0x32')]);_0x22169d[_0xedad('0x34')]=qs[_0xedad('0x2c')](_[_0xedad('0x33')](_0x3e6b65[_0xedad('0x2b')],_0x29e1c1['filters']));if(_0x3e6b65['query'][_0xedad('0x36')]){_0x22169d[_0xedad('0x34')]=_[_0xedad('0x37')](_0x22169d[_0xedad('0x34')],{'$or':_[_0xedad('0x27')](_0x22169d[_0xedad('0x2e')],function(_0x307edd){var _0x2599d2={};_0x2599d2[_0x307edd]={'$like':'%'+_0x3e6b65[_0xedad('0x2b')][_0xedad('0x36')]+'%'};return _0x2599d2;})});}_0x22169d=_['merge']({},_0x22169d,_0x3e6b65[_0xedad('0x38')]);return _0x188fe6['getSubjects'](_0x22169d);}})[_0xedad('0x21')](function(_0x3a6899){if(_0x3a6899){_0x5f171e=_0x3a6899[_0xedad('0x3f')];if(!_0x3e6b65[_0xedad('0x2b')][_0xedad('0x30')](_0xedad('0x31'))){_0x22169d[_0xedad('0x1a')]=qs[_0xedad('0x1a')](_0x3e6b65[_0xedad('0x2b')][_0xedad('0x1a')]);_0x22169d[_0xedad('0x1c')]=qs[_0xedad('0x1c')](_0x3e6b65['query'][_0xedad('0x1c')]);}return _0x188fe6[_0xedad('0x48')](_0x22169d);}})[_0xedad('0x21')](function(_0x17ece8){if(_0x17ece8){return _0x17ece8?{'count':_0x5f171e,'rows':_0x17ece8}:null;}})[_0xedad('0x21')](respondWithResult(_0x3de6a7,null))[_0xedad('0x3c')](handleError(_0x3de6a7,null));};exports[_0xedad('0x49')]=function(_0x53f4e6,_0x2764ed,_0x566bb4){var _0x195777={};var _0x31836b={};var _0x34f8f5;var _0x4a0de;return db[_0xedad('0x28')]['findOne']({'where':{'id':_0x53f4e6[_0xedad('0x3d')]['id']}})[_0xedad('0x21')](handleEntityNotFound(_0x2764ed,null))[_0xedad('0x21')](function(_0x4a4f58){if(_0x4a4f58){_0x34f8f5=_0x4a4f58;_0x31836b['model']=_['keys'](db['SalesforceField'][_0xedad('0x44')]);_0x31836b[_0xedad('0x2b')]=_['keys'](_0x53f4e6['query']);_0x31836b[_0xedad('0x2c')]=_[_0xedad('0x2d')](_0x31836b[_0xedad('0x2a')],_0x31836b[_0xedad('0x2b')]);_0x195777['attributes']=_['intersection'](_0x31836b['model'],qs['fields'](_0x53f4e6[_0xedad('0x2b')][_0xedad('0x2f')]));_0x195777['attributes']=_0x195777['attributes'][_0xedad('0x3f')]?_0x195777[_0xedad('0x2e')]:_0x31836b[_0xedad('0x2a')];_0x195777[_0xedad('0x47')]=qs['sort'](_0x53f4e6[_0xedad('0x2b')][_0xedad('0x32')]);_0x195777[_0xedad('0x34')]=qs[_0xedad('0x2c')](_['pick'](_0x53f4e6[_0xedad('0x2b')],_0x31836b['filters']));if(_0x53f4e6[_0xedad('0x2b')][_0xedad('0x36')]){_0x195777[_0xedad('0x34')]=_['merge'](_0x195777[_0xedad('0x34')],{'$or':_[_0xedad('0x27')](_0x195777[_0xedad('0x2e')],function(_0x585317){var _0x5d4b4a={};_0x5d4b4a[_0x585317]={'$like':'%'+_0x53f4e6[_0xedad('0x2b')][_0xedad('0x36')]+'%'};return _0x5d4b4a;})});}_0x195777=_[_0xedad('0x37')]({},_0x195777,_0x53f4e6[_0xedad('0x38')]);return _0x34f8f5['getDescriptions'](_0x195777);}})[_0xedad('0x21')](function(_0x4980d9){if(_0x4980d9){_0x4a0de=_0x4980d9[_0xedad('0x3f')];if(!_0x53f4e6[_0xedad('0x2b')][_0xedad('0x30')](_0xedad('0x31'))){_0x195777[_0xedad('0x1a')]=qs[_0xedad('0x1a')](_0x53f4e6[_0xedad('0x2b')][_0xedad('0x1a')]);_0x195777[_0xedad('0x1c')]=qs[_0xedad('0x1c')](_0x53f4e6['query'][_0xedad('0x1c')]);}return _0x34f8f5[_0xedad('0x49')](_0x195777);}})['then'](function(_0x554a11){if(_0x554a11){return _0x554a11?{'count':_0x4a0de,'rows':_0x554a11}:null;}})[_0xedad('0x21')](respondWithResult(_0x2764ed,null))[_0xedad('0x3c')](handleError(_0x2764ed,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 592d5fd..0bbd799 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 _0xd783=['exports','define','SalesforceConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes'];(function(_0x4fed21,_0x68778e){var _0x552822=function(_0x5de14f){while(--_0x5de14f){_0x4fed21['push'](_0x4fed21['shift']());}};_0x552822(++_0x68778e);}(_0xd783,0x1c3));var _0x3d78=function(_0x311374,_0x132c28){_0x311374=_0x311374-0x0;var _0x1bf041=_0xd783[_0x311374];return _0x1bf041;};'use strict';var _=require(_0x3d78('0x0'));var util=require(_0x3d78('0x1'));var logger=require(_0x3d78('0x2'))(_0x3d78('0x3'));var moment=require(_0x3d78('0x4'));var BPromise=require(_0x3d78('0x5'));var rp=require(_0x3d78('0x6'));var fs=require('fs');var path=require(_0x3d78('0x7'));var rimraf=require(_0x3d78('0x8'));var config=require(_0x3d78('0x9'));var attributes=require(_0x3d78('0xa'));module[_0x3d78('0xb')]=function(_0x16a74b,_0x2f253f){return _0x16a74b[_0x3d78('0xc')](_0x3d78('0xd'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b6c=['request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','util','api','moment','bluebird'];(function(_0x37c903,_0x262457){var _0x56ebe6=function(_0x4cf98e){while(--_0x4cf98e){_0x37c903['push'](_0x37c903['shift']());}};_0x56ebe6(++_0x262457);}(_0x1b6c,0x167));var _0xc1b6=function(_0x5785f5,_0x289cad){_0x5785f5=_0x5785f5-0x0;var _0xb76dee=_0x1b6c[_0x5785f5];return _0xb76dee;};'use strict';var _=require('lodash');var util=require(_0xc1b6('0x0'));var logger=require('../../config/logger')(_0xc1b6('0x1'));var moment=require(_0xc1b6('0x2'));var BPromise=require(_0xc1b6('0x3'));var rp=require(_0xc1b6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc1b6('0x5'));var config=require(_0xc1b6('0x6'));var attributes=require(_0xc1b6('0x7'));module[_0xc1b6('0x8')]=function(_0x52114c,_0x290663){return _0x52114c[_0xc1b6('0x9')]('SalesforceConfiguration',attributes,{'tableName':_0xc1b6('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 279419d..286f5f7 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 _0xbe23=['rpc','../../config/environment','client','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4ff14a,_0x3ebab3){var _0x938339=function(_0x16a697){while(--_0x16a697){_0x4ff14a['push'](_0x4ff14a['shift']());}};_0x938339(++_0x3ebab3);}(_0xbe23,0xb7));var _0x3be2=function(_0xdc262d,_0x59c7be){_0xdc262d=_0xdc262d-0x0;var _0x3c327b=_0xbe23[_0xdc262d];return _0x3c327b;};'use strict';var _=require(_0x3be2('0x0'));var util=require('util');var moment=require(_0x3be2('0x1'));var BPromise=require(_0x3be2('0x2'));var rs=require(_0x3be2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3be2('0x4'))['db'];var utils=require(_0x3be2('0x5'));var logger=require(_0x3be2('0x6'))(_0x3be2('0x7'));var config=require(_0x3be2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3be2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x188f12,_0x193c1a,_0x31660f){return new BPromise(function(_0x4fbd29,_0x256413){return client[_0x3be2('0xa')](_0x188f12,_0x31660f)['then'](function(_0x1182d6){logger[_0x3be2('0xb')](_0x3be2('0xc'),_0x193c1a,_0x3be2('0xd'));logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x193c1a,_0x3be2('0xd'),JSON['stringify'](_0x1182d6));if(_0x1182d6[_0x3be2('0xe')]){if(_0x1182d6[_0x3be2('0xe')][_0x3be2('0xf')]===0x1f4){logger[_0x3be2('0xe')](_0x3be2('0xc'),_0x193c1a,_0x1182d6[_0x3be2('0xe')][_0x3be2('0x10')]);return _0x256413(_0x1182d6['error']['message']);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x193c1a,_0x1182d6[_0x3be2('0xe')][_0x3be2('0x10')]);return _0x4fbd29(_0x1182d6['error'][_0x3be2('0x10')]);}else{logger[_0x3be2('0xb')](_0x3be2('0xc'),_0x193c1a,'request\x20sent');_0x4fbd29(_0x1182d6[_0x3be2('0x11')][_0x3be2('0x10')]);}})[_0x3be2('0x12')](function(_0x314144){logger[_0x3be2('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x193c1a,_0x314144);_0x256413(_0x314144);});});} \ No newline at end of file +var _0xc28f=['code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','stringify','error'];(function(_0x3b7e6f,_0x1565b5){var _0x4873c3=function(_0x3f0ac6){while(--_0x3f0ac6){_0x3b7e6f['push'](_0x3b7e6f['shift']());}};_0x4873c3(++_0x1565b5);}(_0xc28f,0x1d1));var _0xfc28=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xc28f[_0x187ee1];return _0x388160;};'use strict';var _=require(_0xfc28('0x0'));var util=require(_0xfc28('0x1'));var moment=require('moment');var BPromise=require(_0xfc28('0x2'));var rs=require(_0xfc28('0x3'));var fs=require('fs');var Redis=require(_0xfc28('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfc28('0x5'))('rpc');var config=require(_0xfc28('0x6'));var jayson=require(_0xfc28('0x7'));var client=jayson['client'][_0xfc28('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x620663,_0x92c9f9,_0x2a5acb){return new BPromise(function(_0x2a8bfd,_0x8351b4){return client[_0xfc28('0x9')](_0x620663,_0x2a5acb)['then'](function(_0x272977){logger[_0xfc28('0xa')]('SalesforceConfiguration,\x20%s,\x20%s',_0x92c9f9,_0xfc28('0xb'));logger[_0xfc28('0xc')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x92c9f9,_0xfc28('0xb'),JSON[_0xfc28('0xd')](_0x272977));if(_0x272977[_0xfc28('0xe')]){if(_0x272977[_0xfc28('0xe')][_0xfc28('0xf')]===0x1f4){logger[_0xfc28('0xe')](_0xfc28('0x10'),_0x92c9f9,_0x272977[_0xfc28('0xe')][_0xfc28('0x11')]);return _0x8351b4(_0x272977['error'][_0xfc28('0x11')]);}logger[_0xfc28('0xe')](_0xfc28('0x10'),_0x92c9f9,_0x272977[_0xfc28('0xe')][_0xfc28('0x11')]);return _0x2a8bfd(_0x272977['error'][_0xfc28('0x11')]);}else{logger['info'](_0xfc28('0x10'),_0x92c9f9,_0xfc28('0xb'));_0x2a8bfd(_0x272977[_0xfc28('0x12')]['message']);}})[_0xfc28('0x13')](function(_0x1d0a42){logger[_0xfc28('0xe')](_0xfc28('0x10'),_0x92c9f9,_0x1d0a42);_0x8351b4(_0x1d0a42);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 2a17d25..cc9ce7a 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 _0xb286=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x315661,_0x3b9264){var _0x1da1f6=function(_0x2dc10f){while(--_0x2dc10f){_0x315661['push'](_0x315661['shift']());}};_0x1da1f6(++_0x3b9264);}(_0xb286,0x8c));var _0x6b28=function(_0x1b6432,_0x239718){_0x1b6432=_0x1b6432-0x0;var _0x1060a7=_0xb286[_0x1b6432];return _0x1060a7;};'use strict';var multer=require(_0x6b28('0x0'));var util=require(_0x6b28('0x1'));var path=require(_0x6b28('0x2'));var timeout=require(_0x6b28('0x3'));var express=require(_0x6b28('0x4'));var router=express['Router']();var fs_extra=require(_0x6b28('0x5'));var auth=require(_0x6b28('0x6'));var interaction=require(_0x6b28('0x7'));var config=require('../../config/environment');var controller=require(_0x6b28('0x8'));router[_0x6b28('0x9')]('/',auth[_0x6b28('0xa')](),controller['index']);router[_0x6b28('0x9')](_0x6b28('0xb'),auth[_0x6b28('0xa')](),controller[_0x6b28('0xc')]);router[_0x6b28('0xd')]('/',auth[_0x6b28('0xa')](),controller[_0x6b28('0xe')]);router[_0x6b28('0xf')](_0x6b28('0xb'),auth[_0x6b28('0xa')](),controller[_0x6b28('0x10')]);router[_0x6b28('0x11')](_0x6b28('0xb'),auth['isAuthenticated'](),controller[_0x6b28('0x12')]);module[_0x6b28('0x13')]=router; \ No newline at end of file +var _0x93f9=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','isAuthenticated','post','put','delete'];(function(_0x5209b4,_0x2f0f47){var _0x5f3d50=function(_0x1ab6d7){while(--_0x1ab6d7){_0x5209b4['push'](_0x5209b4['shift']());}};_0x5f3d50(++_0x2f0f47);}(_0x93f9,0x156));var _0x993f=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x93f9[_0x5bd426];return _0x23a7eb;};'use strict';var multer=require(_0x993f('0x0'));var util=require(_0x993f('0x1'));var path=require(_0x993f('0x2'));var timeout=require(_0x993f('0x3'));var express=require('express');var router=express[_0x993f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x993f('0x5'));var config=require(_0x993f('0x6'));var controller=require(_0x993f('0x7'));router[_0x993f('0x8')]('/',auth['isAuthenticated'](),controller[_0x993f('0x9')]);router[_0x993f('0x8')](_0x993f('0xa'),auth[_0x993f('0xb')](),controller['show']);router[_0x993f('0xc')]('/',auth[_0x993f('0xb')](),controller['create']);router[_0x993f('0xd')](_0x993f('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x993f('0xe')]('/:id',auth[_0x993f('0xb')](),controller[_0x993f('0xf')]);module[_0x993f('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 30ef768..b06ee42 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 _0xe682=['string','variable','customVariable','keyValue','picklist','STRING','ENUM','sequelize'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0xe682,0xef));var _0x2e68=function(_0x5bce14,_0x46fd0b){_0x5bce14=_0x5bce14-0x0;var _0x276eff=_0xe682[_0x5bce14];return _0x276eff;};'use strict';var Sequelize=require(_0x2e68('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x2e68('0x1'),_0x2e68('0x2'),_0x2e68('0x3'),_0x2e68('0x4'),_0x2e68('0x5')),'defaultValue':_0x2e68('0x1')},'content':{'type':Sequelize[_0x2e68('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2e68('0x7')](_0x2e68('0x1'),_0x2e68('0x2'),_0x2e68('0x3'))},'keyContent':{'type':Sequelize[_0x2e68('0x6')]},'idField':{'type':Sequelize[_0x2e68('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xca77=['picklist','string','STRING','sequelize','exports','ENUM','variable','customVariable','keyValue'];(function(_0x595604,_0x2cc998){var _0x1466f3=function(_0x4e1d9b){while(--_0x4e1d9b){_0x595604['push'](_0x595604['shift']());}};_0x1466f3(++_0x2cc998);}(_0xca77,0x174));var _0x7ca7=function(_0x59e6cb,_0x18b338){_0x59e6cb=_0x59e6cb-0x0;var _0x40c39d=_0xca77[_0x59e6cb];return _0x40c39d;};'use strict';var Sequelize=require(_0x7ca7('0x0'));module[_0x7ca7('0x1')]={'type':{'type':Sequelize[_0x7ca7('0x2')]('string',_0x7ca7('0x3'),_0x7ca7('0x4'),_0x7ca7('0x5'),_0x7ca7('0x6')),'defaultValue':_0x7ca7('0x7')},'content':{'type':Sequelize[_0x7ca7('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7ca7('0x2')](_0x7ca7('0x7'),'variable',_0x7ca7('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7ca7('0x8')]},'variableName':{'type':Sequelize[_0x7ca7('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 2fa8995..93255ed 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 _0xad23=['params','rawAttributes','include','find','create','body','catch','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','update','then','destroy','error','stack','name','index','SalesforceField','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','merge','VIRTUAL','options','where','includeAll','findAll','show'];(function(_0x57cfe0,_0x1d1fd1){var _0x51b798=function(_0x148f59){while(--_0x148f59){_0x57cfe0['push'](_0x57cfe0['shift']());}};_0x51b798(++_0x1d1fd1);}(_0xad23,0x123));var _0x3ad2=function(_0x4e6d1b,_0x8a7f54){_0x4e6d1b=_0x4e6d1b-0x0;var _0x3ead87=_0xad23[_0x4e6d1b];return _0x3ead87;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3ad2('0x0'));var zipdir=require(_0x3ad2('0x1'));var jsonpatch=require(_0x3ad2('0x2'));var rp=require('request-promise');var moment=require(_0x3ad2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3ad2('0x4'));var util=require(_0x3ad2('0x5'));var path=require(_0x3ad2('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3ad2('0x7'));var fs=require('fs');var fs_extra=require(_0x3ad2('0x8'));var _=require(_0x3ad2('0x9'));var squel=require(_0x3ad2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3ad2('0xb'));var toCsv=require(_0x3ad2('0xc'));var querystring=require(_0x3ad2('0xd'));var Papa=require('papaparse');var Redis=require(_0x3ad2('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3ad2('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ad2('0x10'));var logger=require(_0x3ad2('0x11'))(_0x3ad2('0x12'));var utils=require(_0x3ad2('0x13'));var config=require(_0x3ad2('0x14'));var licenseUtil=require(_0x3ad2('0x15'));var db=require(_0x3ad2('0x16'))['db'];function respondWithStatusCode(_0x6ae5f7,_0x454dfd){_0x454dfd=_0x454dfd||0xcc;return function(_0x3dd797){if(_0x3dd797){return _0x6ae5f7[_0x3ad2('0x17')](_0x454dfd);}return _0x6ae5f7[_0x3ad2('0x18')](_0x454dfd)[_0x3ad2('0x19')]();};}function respondWithResult(_0x1de996,_0x41c3b5){_0x41c3b5=_0x41c3b5||0xc8;return function(_0x259a7b){if(_0x259a7b){return _0x1de996['status'](_0x41c3b5)[_0x3ad2('0x1a')](_0x259a7b);}};}function respondWithFilteredResult(_0x268616,_0x3f0fe7){return function(_0x5324e4){if(_0x5324e4){var _0x514442=typeof _0x3f0fe7[_0x3ad2('0x1b')]===_0x3ad2('0x1c')&&typeof _0x3f0fe7['limit']===_0x3ad2('0x1c');var _0x523c64=_0x5324e4[_0x3ad2('0x1d')];var _0x4d800a=_0x514442?0x0:_0x3f0fe7[_0x3ad2('0x1b')];var _0x14d12a=_0x514442?_0x5324e4[_0x3ad2('0x1d')]:_0x3f0fe7[_0x3ad2('0x1b')]+_0x3f0fe7['limit'];var _0x18d642;if(_0x14d12a>=_0x523c64){_0x14d12a=_0x523c64;_0x18d642=0xc8;}else{_0x18d642=0xce;}_0x268616[_0x3ad2('0x18')](_0x18d642);return _0x268616['set'](_0x3ad2('0x1e'),_0x4d800a+'-'+_0x14d12a+'/'+_0x523c64)[_0x3ad2('0x1a')](_0x5324e4);}return null;};}function patchUpdates(_0x1bb692){return function(_0x580833){try{jsonpatch[_0x3ad2('0x1f')](_0x580833,_0x1bb692,!![]);}catch(_0x452fa9){return BPromise['reject'](_0x452fa9);}return _0x580833['save']();};}function saveUpdates(_0x2448a7,_0x23dcc3){return function(_0x1d25e0){if(_0x1d25e0){return _0x1d25e0[_0x3ad2('0x20')](_0x2448a7)[_0x3ad2('0x21')](function(_0x463d43){return _0x463d43;});}return null;};}function removeEntity(_0x122e29,_0x436ac4){return function(_0x20076a){if(_0x20076a){return _0x20076a[_0x3ad2('0x22')]()[_0x3ad2('0x21')](function(){_0x122e29[_0x3ad2('0x18')](0xcc)[_0x3ad2('0x19')]();});}};}function handleEntityNotFound(_0x48bfb6,_0x3b901c){return function(_0x5b8c40){if(!_0x5b8c40){_0x48bfb6[_0x3ad2('0x17')](0x194);}return _0x5b8c40;};}function handleError(_0xa110c5,_0x330927){_0x330927=_0x330927||0x1f4;return function(_0x4c9b59){logger[_0x3ad2('0x23')](_0x4c9b59[_0x3ad2('0x24')]);if(_0x4c9b59[_0x3ad2('0x25')]){delete _0x4c9b59['name'];}_0xa110c5[_0x3ad2('0x18')](_0x330927)['send'](_0x4c9b59);};}exports[_0x3ad2('0x26')]=function(_0x4ac73b,_0x41523b){var _0x164451={},_0x3bb397={},_0x1bbc98={'count':0x0,'rows':[]};var _0x4520db=_['map'](db[_0x3ad2('0x27')]['rawAttributes'],function(_0x2cad6a){return{'name':_0x2cad6a['fieldName'],'type':_0x2cad6a[_0x3ad2('0x28')]['key']};});_0x3bb397[_0x3ad2('0x29')]=_[_0x3ad2('0x2a')](_0x4520db,_0x3ad2('0x25'));_0x3bb397[_0x3ad2('0x2b')]=_[_0x3ad2('0x2c')](_0x4ac73b['query']);_0x3bb397['filters']=_[_0x3ad2('0x2d')](_0x3bb397[_0x3ad2('0x29')],_0x3bb397['query']);_0x164451[_0x3ad2('0x2e')]=_['intersection'](_0x3bb397[_0x3ad2('0x29')],qs['fields'](_0x4ac73b['query'][_0x3ad2('0x2f')]));_0x164451[_0x3ad2('0x2e')]=_0x164451['attributes'][_0x3ad2('0x30')]?_0x164451['attributes']:_0x3bb397['model'];if(!_0x4ac73b[_0x3ad2('0x2b')][_0x3ad2('0x31')](_0x3ad2('0x32'))){_0x164451[_0x3ad2('0x33')]=qs[_0x3ad2('0x33')](_0x4ac73b['query'][_0x3ad2('0x33')]);_0x164451[_0x3ad2('0x1b')]=qs[_0x3ad2('0x1b')](_0x4ac73b['query'][_0x3ad2('0x1b')]);}_0x164451[_0x3ad2('0x34')]=qs[_0x3ad2('0x35')](_0x4ac73b['query'][_0x3ad2('0x35')]);_0x164451['where']=qs[_0x3ad2('0x36')](_[_0x3ad2('0x37')](_0x4ac73b['query'],_0x3bb397[_0x3ad2('0x36')]),_0x4520db);if(_0x4ac73b[_0x3ad2('0x2b')][_0x3ad2('0x38')]){_0x164451['where']=_[_0x3ad2('0x39')](_0x164451['where'],{'$or':_['map'](_0x4520db,function(_0x59b3fa){if(_0x59b3fa[_0x3ad2('0x28')]!==_0x3ad2('0x3a')){var _0x47d48f={};_0x47d48f[_0x59b3fa[_0x3ad2('0x25')]]={'$like':'%'+_0x4ac73b[_0x3ad2('0x2b')][_0x3ad2('0x38')]+'%'};return _0x47d48f;}})});}_0x164451=_['merge']({},_0x164451,_0x4ac73b[_0x3ad2('0x3b')]);var _0x27ec2d={'where':_0x164451[_0x3ad2('0x3c')]};return db[_0x3ad2('0x27')][_0x3ad2('0x1d')](_0x27ec2d)[_0x3ad2('0x21')](function(_0x3bad38){_0x1bbc98[_0x3ad2('0x1d')]=_0x3bad38;if(_0x4ac73b[_0x3ad2('0x2b')][_0x3ad2('0x3d')]){_0x164451['include']=[{'all':!![]}];}return db[_0x3ad2('0x27')][_0x3ad2('0x3e')](_0x164451);})[_0x3ad2('0x21')](function(_0x70f4f8){_0x1bbc98['rows']=_0x70f4f8;return _0x1bbc98;})[_0x3ad2('0x21')](respondWithFilteredResult(_0x41523b,_0x164451))['catch'](handleError(_0x41523b,null));};exports[_0x3ad2('0x3f')]=function(_0x53a7f1,_0x1e7384){var _0x32dd1f={'raw':!![],'where':{'id':_0x53a7f1[_0x3ad2('0x40')]['id']}},_0x4bc0af={};_0x4bc0af[_0x3ad2('0x29')]=_[_0x3ad2('0x2c')](db['SalesforceField'][_0x3ad2('0x41')]);_0x4bc0af[_0x3ad2('0x2b')]=_[_0x3ad2('0x2c')](_0x53a7f1[_0x3ad2('0x2b')]);_0x4bc0af['filters']=_[_0x3ad2('0x2d')](_0x4bc0af[_0x3ad2('0x29')],_0x4bc0af[_0x3ad2('0x2b')]);_0x32dd1f['attributes']=_[_0x3ad2('0x2d')](_0x4bc0af[_0x3ad2('0x29')],qs[_0x3ad2('0x2f')](_0x53a7f1[_0x3ad2('0x2b')][_0x3ad2('0x2f')]));_0x32dd1f['attributes']=_0x32dd1f[_0x3ad2('0x2e')]['length']?_0x32dd1f[_0x3ad2('0x2e')]:_0x4bc0af[_0x3ad2('0x29')];if(_0x53a7f1[_0x3ad2('0x2b')][_0x3ad2('0x3d')]){_0x32dd1f[_0x3ad2('0x42')]=[{'all':!![]}];}_0x32dd1f=_[_0x3ad2('0x39')]({},_0x32dd1f,_0x53a7f1['options']);return db[_0x3ad2('0x27')][_0x3ad2('0x43')](_0x32dd1f)['then'](handleEntityNotFound(_0x1e7384,null))['then'](respondWithResult(_0x1e7384,null))['catch'](handleError(_0x1e7384,null));};exports[_0x3ad2('0x44')]=function(_0x4f6845,_0x169d38){return db[_0x3ad2('0x27')][_0x3ad2('0x44')](_0x4f6845[_0x3ad2('0x45')],{})['then'](respondWithResult(_0x169d38,0xc9))[_0x3ad2('0x46')](handleError(_0x169d38,null));};exports[_0x3ad2('0x20')]=function(_0xc66a7c,_0x462765){if(_0xc66a7c[_0x3ad2('0x45')]['id']){delete _0xc66a7c[_0x3ad2('0x45')]['id'];}return db[_0x3ad2('0x27')][_0x3ad2('0x43')]({'where':{'id':_0xc66a7c['params']['id']}})[_0x3ad2('0x21')](handleEntityNotFound(_0x462765,null))[_0x3ad2('0x21')](saveUpdates(_0xc66a7c['body'],null))[_0x3ad2('0x21')](respondWithResult(_0x462765,null))[_0x3ad2('0x46')](handleError(_0x462765,null));};exports[_0x3ad2('0x22')]=function(_0x4d9ab7,_0xe9efc9){return db['SalesforceField']['find']({'where':{'id':_0x4d9ab7[_0x3ad2('0x40')]['id']}})[_0x3ad2('0x21')](handleEntityNotFound(_0xe9efc9,null))[_0x3ad2('0x21')](removeEntity(_0xe9efc9,null))[_0x3ad2('0x46')](handleError(_0xe9efc9,null));}; \ No newline at end of file +var _0x57ab=['../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','sendStatus','stack','name','send','map','rawAttributes','type','key','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SalesforceField','includeAll','findAll','rows','catch','params','keys','include','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x5e9876,_0x16052d){var _0x576c48=function(_0x338c97){while(--_0x338c97){_0x5e9876['push'](_0x5e9876['shift']());}};_0x576c48(++_0x16052d);}(_0x57ab,0x108));var _0xb57a=function(_0x42ac42,_0x6e6a4b){_0x42ac42=_0x42ac42-0x0;var _0x50dc84=_0x57ab[_0x42ac42];return _0x50dc84;};'use strict';var emlformat=require(_0xb57a('0x0'));var rimraf=require(_0xb57a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb57a('0x2'));var rp=require(_0xb57a('0x3'));var moment=require('moment');var BPromise=require(_0xb57a('0x4'));var Mustache=require(_0xb57a('0x5'));var util=require(_0xb57a('0x6'));var path=require(_0xb57a('0x7'));var sox=require('sox');var csv=require(_0xb57a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb57a('0x9'));var _=require(_0xb57a('0xa'));var squel=require(_0xb57a('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb57a('0x8'));var querystring=require(_0xb57a('0xc'));var Papa=require('papaparse');var Redis=require(_0xb57a('0xd'));var authService=require(_0xb57a('0xe'));var qs=require(_0xb57a('0xf'));var as=require(_0xb57a('0x10'));var hardwareService=require(_0xb57a('0x11'));var logger=require(_0xb57a('0x12'))(_0xb57a('0x13'));var utils=require('../../config/utils');var config=require(_0xb57a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb57a('0x15'))['db'];function respondWithStatusCode(_0x206859,_0x2dee26){_0x2dee26=_0x2dee26||0xcc;return function(_0x2aeb12){if(_0x2aeb12){return _0x206859['sendStatus'](_0x2dee26);}return _0x206859[_0xb57a('0x16')](_0x2dee26)[_0xb57a('0x17')]();};}function respondWithResult(_0x490397,_0x1f1f0b){_0x1f1f0b=_0x1f1f0b||0xc8;return function(_0x3ad4f0){if(_0x3ad4f0){return _0x490397['status'](_0x1f1f0b)[_0xb57a('0x18')](_0x3ad4f0);}};}function respondWithFilteredResult(_0x126cd6,_0x31c4c2){return function(_0x5f3060){if(_0x5f3060){var _0x77eb14=typeof _0x31c4c2[_0xb57a('0x19')]==='undefined'&&typeof _0x31c4c2[_0xb57a('0x1a')]===_0xb57a('0x1b');var _0x5eeb0e=_0x5f3060[_0xb57a('0x1c')];var _0x3b2b71=_0x77eb14?0x0:_0x31c4c2[_0xb57a('0x19')];var _0x478232=_0x77eb14?_0x5f3060['count']:_0x31c4c2[_0xb57a('0x19')]+_0x31c4c2[_0xb57a('0x1a')];var _0x23608e;if(_0x478232>=_0x5eeb0e){_0x478232=_0x5eeb0e;_0x23608e=0xc8;}else{_0x23608e=0xce;}_0x126cd6[_0xb57a('0x16')](_0x23608e);return _0x126cd6[_0xb57a('0x1d')]('Content-Range',_0x3b2b71+'-'+_0x478232+'/'+_0x5eeb0e)[_0xb57a('0x18')](_0x5f3060);}return null;};}function patchUpdates(_0x2ec6d4){return function(_0x4299f3){try{jsonpatch[_0xb57a('0x1e')](_0x4299f3,_0x2ec6d4,!![]);}catch(_0x3f2905){return BPromise['reject'](_0x3f2905);}return _0x4299f3[_0xb57a('0x1f')]();};}function saveUpdates(_0x3a29e4,_0xaa25a){return function(_0x5a92a9){if(_0x5a92a9){return _0x5a92a9[_0xb57a('0x20')](_0x3a29e4)[_0xb57a('0x21')](function(_0x27664e){return _0x27664e;});}return null;};}function removeEntity(_0x5ccfa1,_0x52f3f0){return function(_0x14261c){if(_0x14261c){return _0x14261c[_0xb57a('0x22')]()[_0xb57a('0x21')](function(){_0x5ccfa1['status'](0xcc)[_0xb57a('0x17')]();});}};}function handleEntityNotFound(_0x10952d,_0x3f9f09){return function(_0xee857d){if(!_0xee857d){_0x10952d[_0xb57a('0x23')](0x194);}return _0xee857d;};}function handleError(_0xfacb63,_0x23cc79){_0x23cc79=_0x23cc79||0x1f4;return function(_0x3e7067){logger['error'](_0x3e7067[_0xb57a('0x24')]);if(_0x3e7067['name']){delete _0x3e7067[_0xb57a('0x25')];}_0xfacb63['status'](_0x23cc79)[_0xb57a('0x26')](_0x3e7067);};}exports['index']=function(_0x1bd7ff,_0x33ea48){var _0x302d73={},_0x306cef={},_0xf40724={'count':0x0,'rows':[]};var _0xef548b=_[_0xb57a('0x27')](db['SalesforceField'][_0xb57a('0x28')],function(_0x31dafa){return{'name':_0x31dafa['fieldName'],'type':_0x31dafa[_0xb57a('0x29')][_0xb57a('0x2a')]};});_0x306cef['model']=_[_0xb57a('0x27')](_0xef548b,_0xb57a('0x25'));_0x306cef[_0xb57a('0x2b')]=_['keys'](_0x1bd7ff[_0xb57a('0x2b')]);_0x306cef['filters']=_[_0xb57a('0x2c')](_0x306cef['model'],_0x306cef[_0xb57a('0x2b')]);_0x302d73[_0xb57a('0x2d')]=_[_0xb57a('0x2c')](_0x306cef[_0xb57a('0x2e')],qs[_0xb57a('0x2f')](_0x1bd7ff[_0xb57a('0x2b')]['fields']));_0x302d73['attributes']=_0x302d73[_0xb57a('0x2d')][_0xb57a('0x30')]?_0x302d73['attributes']:_0x306cef[_0xb57a('0x2e')];if(!_0x1bd7ff['query'][_0xb57a('0x31')](_0xb57a('0x32'))){_0x302d73['limit']=qs[_0xb57a('0x1a')](_0x1bd7ff[_0xb57a('0x2b')][_0xb57a('0x1a')]);_0x302d73[_0xb57a('0x19')]=qs[_0xb57a('0x19')](_0x1bd7ff[_0xb57a('0x2b')][_0xb57a('0x19')]);}_0x302d73[_0xb57a('0x33')]=qs[_0xb57a('0x34')](_0x1bd7ff[_0xb57a('0x2b')][_0xb57a('0x34')]);_0x302d73[_0xb57a('0x35')]=qs[_0xb57a('0x36')](_[_0xb57a('0x37')](_0x1bd7ff[_0xb57a('0x2b')],_0x306cef['filters']),_0xef548b);if(_0x1bd7ff[_0xb57a('0x2b')][_0xb57a('0x38')]){_0x302d73[_0xb57a('0x35')]=_[_0xb57a('0x39')](_0x302d73[_0xb57a('0x35')],{'$or':_[_0xb57a('0x27')](_0xef548b,function(_0x30bf43){if(_0x30bf43['type']!==_0xb57a('0x3a')){var _0x43aade={};_0x43aade[_0x30bf43[_0xb57a('0x25')]]={'$like':'%'+_0x1bd7ff[_0xb57a('0x2b')][_0xb57a('0x38')]+'%'};return _0x43aade;}})});}_0x302d73=_[_0xb57a('0x39')]({},_0x302d73,_0x1bd7ff[_0xb57a('0x3b')]);var _0x40f90d={'where':_0x302d73['where']};return db[_0xb57a('0x3c')][_0xb57a('0x1c')](_0x40f90d)[_0xb57a('0x21')](function(_0x617638){_0xf40724['count']=_0x617638;if(_0x1bd7ff[_0xb57a('0x2b')][_0xb57a('0x3d')]){_0x302d73['include']=[{'all':!![]}];}return db[_0xb57a('0x3c')][_0xb57a('0x3e')](_0x302d73);})[_0xb57a('0x21')](function(_0x3f54cf){_0xf40724[_0xb57a('0x3f')]=_0x3f54cf;return _0xf40724;})[_0xb57a('0x21')](respondWithFilteredResult(_0x33ea48,_0x302d73))[_0xb57a('0x40')](handleError(_0x33ea48,null));};exports['show']=function(_0x420d44,_0x26d050){var _0x2abdb0={'raw':!![],'where':{'id':_0x420d44[_0xb57a('0x41')]['id']}},_0x516847={};_0x516847[_0xb57a('0x2e')]=_[_0xb57a('0x42')](db[_0xb57a('0x3c')]['rawAttributes']);_0x516847[_0xb57a('0x2b')]=_[_0xb57a('0x42')](_0x420d44[_0xb57a('0x2b')]);_0x516847['filters']=_['intersection'](_0x516847[_0xb57a('0x2e')],_0x516847[_0xb57a('0x2b')]);_0x2abdb0['attributes']=_[_0xb57a('0x2c')](_0x516847[_0xb57a('0x2e')],qs[_0xb57a('0x2f')](_0x420d44[_0xb57a('0x2b')]['fields']));_0x2abdb0[_0xb57a('0x2d')]=_0x2abdb0['attributes'][_0xb57a('0x30')]?_0x2abdb0['attributes']:_0x516847[_0xb57a('0x2e')];if(_0x420d44[_0xb57a('0x2b')][_0xb57a('0x3d')]){_0x2abdb0[_0xb57a('0x43')]=[{'all':!![]}];}_0x2abdb0=_[_0xb57a('0x39')]({},_0x2abdb0,_0x420d44[_0xb57a('0x3b')]);return db['SalesforceField']['find'](_0x2abdb0)[_0xb57a('0x21')](handleEntityNotFound(_0x26d050,null))[_0xb57a('0x21')](respondWithResult(_0x26d050,null))[_0xb57a('0x40')](handleError(_0x26d050,null));};exports[_0xb57a('0x44')]=function(_0x5a370b,_0x1c7a8d){return db[_0xb57a('0x3c')][_0xb57a('0x44')](_0x5a370b[_0xb57a('0x45')],{})['then'](respondWithResult(_0x1c7a8d,0xc9))[_0xb57a('0x40')](handleError(_0x1c7a8d,null));};exports[_0xb57a('0x20')]=function(_0x19f9c2,_0x349174){if(_0x19f9c2[_0xb57a('0x45')]['id']){delete _0x19f9c2['body']['id'];}return db['SalesforceField'][_0xb57a('0x46')]({'where':{'id':_0x19f9c2[_0xb57a('0x41')]['id']}})['then'](handleEntityNotFound(_0x349174,null))[_0xb57a('0x21')](saveUpdates(_0x19f9c2[_0xb57a('0x45')],null))[_0xb57a('0x21')](respondWithResult(_0x349174,null))[_0xb57a('0x40')](handleError(_0x349174,null));};exports[_0xb57a('0x22')]=function(_0x538dfe,_0x1ccf79){return db['SalesforceField']['find']({'where':{'id':_0x538dfe[_0xb57a('0x41')]['id']}})['then'](handleEntityNotFound(_0x1ccf79,null))['then'](removeEntity(_0x1ccf79,null))[_0xb57a('0x40')](handleError(_0x1ccf79,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index d1081fa..d153ce3 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 _0xd0ed=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intSalesforceField.attributes','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd0ed,0x6b));var _0xdd0e=function(_0x37862a,_0x2bc98e){_0x37862a=_0x37862a-0x0;var _0x5b0104=_0xd0ed[_0x37862a];return _0x5b0104;};'use strict';var _=require(_0xdd0e('0x0'));var util=require('util');var logger=require(_0xdd0e('0x1'))(_0xdd0e('0x2'));var moment=require('moment');var BPromise=require(_0xdd0e('0x3'));var rp=require(_0xdd0e('0x4'));var fs=require('fs');var path=require(_0xdd0e('0x5'));var rimraf=require('rimraf');var config=require(_0xdd0e('0x6'));var attributes=require(_0xdd0e('0x7'));module['exports']=function(_0x1f61fc,_0x2c33a5){return _0x1f61fc['define'](_0xdd0e('0x8'),attributes,{'tableName':_0xdd0e('0x9'),'paranoid':![],'indexes':[{'name':_0xdd0e('0xa'),'fields':['idField',_0xdd0e('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0980=['SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x0980,0x1f2));var _0x0098=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x0980[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0098('0x0'))('api');var moment=require(_0x0098('0x1'));var BPromise=require('bluebird');var rp=require(_0x0098('0x2'));var fs=require('fs');var path=require(_0x0098('0x3'));var rimraf=require(_0x0098('0x4'));var config=require(_0x0098('0x5'));var attributes=require(_0x0098('0x6'));module[_0x0098('0x7')]=function(_0x1febf8,_0x369cde){return _0x1febf8[_0x0098('0x8')](_0x0098('0x9'),attributes,{'tableName':_0x0098('0xa'),'paranoid':![],'indexes':[{'name':_0x0098('0xb'),'fields':[_0x0098('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 0ebdea4..116a3c2 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 _0x1fd6=['client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x59bb1e,_0x2b7589){var _0x2a2c9b=function(_0x2d84b0){while(--_0x2d84b0){_0x59bb1e['push'](_0x59bb1e['shift']());}};_0x2a2c9b(++_0x2b7589);}(_0x1fd6,0x10b));var _0x61fd=function(_0x3e33d6,_0x41396d){_0x3e33d6=_0x3e33d6-0x0;var _0x4b27f2=_0x1fd6[_0x3e33d6];return _0x4b27f2;};'use strict';var _=require(_0x61fd('0x0'));var util=require(_0x61fd('0x1'));var moment=require('moment');var BPromise=require(_0x61fd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x61fd('0x3'));var db=require(_0x61fd('0x4'))['db'];var utils=require(_0x61fd('0x5'));var logger=require(_0x61fd('0x6'))(_0x61fd('0x7'));var config=require(_0x61fd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x61fd('0x9')][_0x61fd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57cc88,_0xc986ce,_0x4f2739){return new BPromise(function(_0x4e60ab,_0xf671a7){return client[_0x61fd('0xb')](_0x57cc88,_0x4f2739)[_0x61fd('0xc')](function(_0x556d34){logger[_0x61fd('0xd')](_0x61fd('0xe'),_0xc986ce,_0x61fd('0xf'));logger[_0x61fd('0x10')](_0x61fd('0x11'),_0xc986ce,_0x61fd('0xf'),JSON[_0x61fd('0x12')](_0x556d34));if(_0x556d34['error']){if(_0x556d34[_0x61fd('0x13')]['code']===0x1f4){logger['error']('SalesforceField,\x20%s,\x20%s',_0xc986ce,_0x556d34[_0x61fd('0x13')]['message']);return _0xf671a7(_0x556d34['error']['message']);}logger['error'](_0x61fd('0xe'),_0xc986ce,_0x556d34[_0x61fd('0x13')]['message']);return _0x4e60ab(_0x556d34[_0x61fd('0x13')][_0x61fd('0x14')]);}else{logger[_0x61fd('0xd')](_0x61fd('0xe'),_0xc986ce,_0x61fd('0xf'));_0x4e60ab(_0x556d34[_0x61fd('0x15')][_0x61fd('0x14')]);}})[_0x61fd('0x16')](function(_0x49258e){logger[_0x61fd('0x13')]('SalesforceField,\x20%s,\x20%s',_0xc986ce,_0x49258e);_0xf671a7(_0x49258e);});});} \ No newline at end of file +var _0x7b9d=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','result'];(function(_0x5c70a1,_0x4a3b8c){var _0x3eb124=function(_0x2570a9){while(--_0x2570a9){_0x5c70a1['push'](_0x5c70a1['shift']());}};_0x3eb124(++_0x4a3b8c);}(_0x7b9d,0xdd));var _0xd7b9=function(_0x1fcbb7,_0x21ff69){_0x1fcbb7=_0x1fcbb7-0x0;var _0x1a5046=_0x7b9d[_0x1fcbb7];return _0x1a5046;};'use strict';var _=require('lodash');var util=require(_0xd7b9('0x0'));var moment=require(_0xd7b9('0x1'));var BPromise=require(_0xd7b9('0x2'));var rs=require(_0xd7b9('0x3'));var fs=require('fs');var Redis=require(_0xd7b9('0x4'));var db=require(_0xd7b9('0x5'))['db'];var utils=require(_0xd7b9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd7b9('0x7'));var jayson=require(_0xd7b9('0x8'));var client=jayson[_0xd7b9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x144e69,_0x531efb,_0x3de5ef){return new BPromise(function(_0x3d5a0f,_0x4893d3){return client[_0xd7b9('0xa')](_0x144e69,_0x3de5ef)[_0xd7b9('0xb')](function(_0xe58312){logger[_0xd7b9('0xc')]('SalesforceField,\x20%s,\x20%s',_0x531efb,_0xd7b9('0xd'));logger[_0xd7b9('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x531efb,_0xd7b9('0xd'),JSON[_0xd7b9('0xf')](_0xe58312));if(_0xe58312[_0xd7b9('0x10')]){if(_0xe58312['error'][_0xd7b9('0x11')]===0x1f4){logger[_0xd7b9('0x10')](_0xd7b9('0x12'),_0x531efb,_0xe58312['error'][_0xd7b9('0x13')]);return _0x4893d3(_0xe58312[_0xd7b9('0x10')][_0xd7b9('0x13')]);}logger['error'](_0xd7b9('0x12'),_0x531efb,_0xe58312[_0xd7b9('0x10')][_0xd7b9('0x13')]);return _0x3d5a0f(_0xe58312[_0xd7b9('0x10')][_0xd7b9('0x13')]);}else{logger[_0xd7b9('0xc')]('SalesforceField,\x20%s,\x20%s',_0x531efb,_0xd7b9('0xd'));_0x3d5a0f(_0xe58312[_0xd7b9('0x14')][_0xd7b9('0x13')]);}})[_0xd7b9('0x15')](function(_0x2168b7){logger[_0xd7b9('0x10')](_0xd7b9('0x12'),_0x531efb,_0x2168b7);_0x4893d3(_0x2168b7);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 36f4544..1b505dd 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 _0x27f2=['/:id/fields','create','post','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations'];(function(_0x252834,_0x55f763){var _0x58c864=function(_0x49080f){while(--_0x49080f){_0x252834['push'](_0x252834['shift']());}};_0x58c864(++_0x55f763);}(_0x27f2,0x6f));var _0x227f=function(_0x4a639c,_0x14c131){_0x4a639c=_0x4a639c-0x0;var _0x118bf4=_0x27f2[_0x4a639c];return _0x118bf4;};'use strict';var multer=require(_0x227f('0x0'));var util=require(_0x227f('0x1'));var path=require(_0x227f('0x2'));var timeout=require(_0x227f('0x3'));var express=require(_0x227f('0x4'));var router=express[_0x227f('0x5')]();var fs_extra=require(_0x227f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x227f('0x7'));var config=require(_0x227f('0x8'));var controller=require(_0x227f('0x9'));router[_0x227f('0xa')]('/',auth['isAuthenticated'](),controller[_0x227f('0xb')]);router[_0x227f('0xa')](_0x227f('0xc'),auth[_0x227f('0xd')](),controller['show']);router[_0x227f('0xa')](_0x227f('0xe'),auth[_0x227f('0xd')](),controller['getConfigurations']);router[_0x227f('0xa')](_0x227f('0xf'),auth[_0x227f('0xd')](),controller['getFields']);router['post']('/',auth[_0x227f('0xd')](),controller[_0x227f('0x10')]);router[_0x227f('0x11')](_0x227f('0xe'),auth[_0x227f('0xd')](),controller['addConfiguration']);router['put'](_0x227f('0xc'),auth[_0x227f('0xd')](),controller[_0x227f('0x12')]);router['delete'](_0x227f('0xc'),auth[_0x227f('0xd')](),controller[_0x227f('0x13')]);module[_0x227f('0x14')]=router; \ No newline at end of file +var _0x1e4f=['../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','index','get','/:id','show','/:id/configurations','isAuthenticated','/:id/fields','getFields','post','create','addConfiguration','update','destroy','multer','path','express','Router'];(function(_0x2bd2f2,_0x577bd3){var _0x1b8a69=function(_0x2d8f6c){while(--_0x2d8f6c){_0x2bd2f2['push'](_0x2bd2f2['shift']());}};_0x1b8a69(++_0x577bd3);}(_0x1e4f,0x1a0));var _0xf1e4=function(_0x4a0c33,_0x5686bb){_0x4a0c33=_0x4a0c33-0x0;var _0x6488f9=_0x1e4f[_0x4a0c33];return _0x6488f9;};'use strict';var multer=require(_0xf1e4('0x0'));var util=require('util');var path=require(_0xf1e4('0x1'));var timeout=require('connect-timeout');var express=require(_0xf1e4('0x2'));var router=express[_0xf1e4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf1e4('0x4'));var interaction=require(_0xf1e4('0x5'));var config=require('../../config/environment');var controller=require(_0xf1e4('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xf1e4('0x7')]);router[_0xf1e4('0x8')](_0xf1e4('0x9'),auth['isAuthenticated'](),controller[_0xf1e4('0xa')]);router[_0xf1e4('0x8')](_0xf1e4('0xb'),auth[_0xf1e4('0xc')](),controller['getConfigurations']);router[_0xf1e4('0x8')](_0xf1e4('0xd'),auth['isAuthenticated'](),controller[_0xf1e4('0xe')]);router[_0xf1e4('0xf')]('/',auth[_0xf1e4('0xc')](),controller[_0xf1e4('0x10')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0xf1e4('0x11')]);router['put'](_0xf1e4('0x9'),auth[_0xf1e4('0xc')](),controller[_0xf1e4('0x12')]);router['delete'](_0xf1e4('0x9'),auth[_0xf1e4('0xc')](),controller[_0xf1e4('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 6e1fa9e..e7da4c9 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 _0x47dc=['exports','STRING','username','remoteUri','sequelize'];(function(_0x871115,_0xd3646b){var _0x2ddfcb=function(_0x3a4e9d){while(--_0x3a4e9d){_0x871115['push'](_0x871115['shift']());}};_0x2ddfcb(++_0xd3646b);}(_0x47dc,0x72));var _0xc47d=function(_0x17aabc,_0x371a5c){_0x17aabc=_0x17aabc-0x0;var _0x262cfe=_0x47dc[_0x17aabc];return _0x262cfe;};'use strict';var Sequelize=require(_0xc47d('0x0'));module[_0xc47d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc47d('0x2')],'unique':_0xc47d('0x3')},'password':{'type':Sequelize[_0xc47d('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc47d('0x2')],'unique':_0xc47d('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x9c79=['STRING','remoteUri','exports'];(function(_0x377a6e,_0x59b99d){var _0x37f751=function(_0x2ed25c){while(--_0x2ed25c){_0x377a6e['push'](_0x377a6e['shift']());}};_0x37f751(++_0x59b99d);}(_0x9c79,0x1c4));var _0x99c7=function(_0x1adb5d,_0x1e36cc){_0x1adb5d=_0x1adb5d-0x0;var _0x3acc58=_0x9c79[_0x1adb5d];return _0x3acc58;};'use strict';var Sequelize=require('sequelize');module[_0x99c7('0x0')]={'name':{'type':Sequelize[_0x99c7('0x1')]},'description':{'type':Sequelize[_0x99c7('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x99c7('0x1')]},'email':{'type':Sequelize[_0x99c7('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x99c7('0x2')},'serverUrl':{'type':Sequelize[_0x99c7('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 1cf4832..d71ce34 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 _0x47bd=['query','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','then','includeAll','include','rows','catch','show','params','options','find','create','update','body','findOne','ServicenowConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','incident_state','severity','category','parent','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_created_by','calendar_stc','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','reopened_time','resolved_at','caller_id','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','notify','sys_class_name','close_notes','parent_incident','sys_id','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','location','username','password','email','remoteUri','serverUrl','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','assign','includes','forEach','internalType','label','push','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','true','False','false','inactive','value','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','destroy','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','keys'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x47bd,0x146));var _0xd47b=function(_0x19205d,_0x4b4a1b){_0x19205d=_0x19205d-0x0;var _0x32fa09=_0x47bd[_0x19205d];return _0x32fa09;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd47b('0x0'));var zipdir=require(_0xd47b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd47b('0x2'));var moment=require('moment');var BPromise=require(_0xd47b('0x3'));var Mustache=require(_0xd47b('0x4'));var util=require(_0xd47b('0x5'));var path=require(_0xd47b('0x6'));var sox=require(_0xd47b('0x7'));var csv=require(_0xd47b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd47b('0x9'));var squel=require('squel');var crypto=require(_0xd47b('0xa'));var jsforce=require(_0xd47b('0xb'));var deskjs=require(_0xd47b('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd47b('0xd'));var Papa=require(_0xd47b('0xe'));var Redis=require('ioredis');var authService=require(_0xd47b('0xf'));var qs=require(_0xd47b('0x10'));var as=require(_0xd47b('0x11'));var hardwareService=require(_0xd47b('0x12'));var logger=require(_0xd47b('0x13'))('api');var utils=require(_0xd47b('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd47b('0x15'))['db'];var integrations=require(_0xd47b('0x16'));function respondWithStatusCode(_0x540639,_0x2fa6dd){_0x2fa6dd=_0x2fa6dd||0xcc;return function(_0xb0e9c6){if(_0xb0e9c6){return _0x540639[_0xd47b('0x17')](_0x2fa6dd);}return _0x540639[_0xd47b('0x18')](_0x2fa6dd)[_0xd47b('0x19')]();};}function respondWithResult(_0x191af8,_0xb5860d){_0xb5860d=_0xb5860d||0xc8;return function(_0x3609f8){if(_0x3609f8){return _0x191af8[_0xd47b('0x18')](_0xb5860d)['json'](_0x3609f8);}};}function respondWithFilteredResult(_0x1c44d6,_0x1c7461){return function(_0x5d536b){if(_0x5d536b){var _0x194848=typeof _0x1c7461['offset']===_0xd47b('0x1a')&&typeof _0x1c7461[_0xd47b('0x1b')]===_0xd47b('0x1a');var _0x3e2c86=_0x5d536b[_0xd47b('0x1c')];var _0x1db6ff=_0x194848?0x0:_0x1c7461[_0xd47b('0x1d')];var _0x316b21=_0x194848?_0x5d536b[_0xd47b('0x1c')]:_0x1c7461[_0xd47b('0x1d')]+_0x1c7461['limit'];var _0x2c16ad;if(_0x316b21>=_0x3e2c86){_0x316b21=_0x3e2c86;_0x2c16ad=0xc8;}else{_0x2c16ad=0xce;}_0x1c44d6['status'](_0x2c16ad);return _0x1c44d6[_0xd47b('0x1e')](_0xd47b('0x1f'),_0x1db6ff+'-'+_0x316b21+'/'+_0x3e2c86)['json'](_0x5d536b);}return null;};}function patchUpdates(_0x125c44){return function(_0x50073d){try{jsonpatch[_0xd47b('0x20')](_0x50073d,_0x125c44,!![]);}catch(_0x5d1fe0){return BPromise[_0xd47b('0x21')](_0x5d1fe0);}return _0x50073d['save']();};}function saveUpdates(_0x59bbb6,_0x498fdc){return function(_0x158543){if(_0x158543){return _0x158543['update'](_0x59bbb6)['then'](function(_0x47b6ba){return _0x47b6ba;});}return null;};}function removeEntity(_0x39173e,_0x1b2bfe){return function(_0x21b7d3){if(_0x21b7d3){return _0x21b7d3[_0xd47b('0x22')]()['then'](function(){_0x39173e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6fbd5e,_0x459f82){return function(_0x43d9e8){if(!_0x43d9e8){_0x6fbd5e['sendStatus'](0x194);}return _0x43d9e8;};}function handleError(_0x33f541,_0x2b21b3){_0x2b21b3=_0x2b21b3||0x1f4;return function(_0x4a0e6a){logger[_0xd47b('0x23')](_0x4a0e6a[_0xd47b('0x24')]);if(_0x4a0e6a[_0xd47b('0x25')]){delete _0x4a0e6a[_0xd47b('0x25')];}_0x33f541[_0xd47b('0x18')](_0x2b21b3)[_0xd47b('0x26')](_0x4a0e6a);};}exports[_0xd47b('0x27')]=function(_0x527afc,_0x446102){var _0x2ae74e={},_0x1d15f4={},_0x44a461={'count':0x0,'rows':[]};var _0x835edc=_[_0xd47b('0x28')](db[_0xd47b('0x29')][_0xd47b('0x2a')],function(_0x5c3029){return{'name':_0x5c3029[_0xd47b('0x2b')],'type':_0x5c3029[_0xd47b('0x2c')]['key']};});_0x1d15f4['model']=_['map'](_0x835edc,_0xd47b('0x25'));_0x1d15f4['query']=_[_0xd47b('0x2d')](_0x527afc[_0xd47b('0x2e')]);_0x1d15f4['filters']=_[_0xd47b('0x2f')](_0x1d15f4[_0xd47b('0x30')],_0x1d15f4[_0xd47b('0x2e')]);_0x2ae74e['attributes']=_[_0xd47b('0x2f')](_0x1d15f4[_0xd47b('0x30')],qs[_0xd47b('0x31')](_0x527afc[_0xd47b('0x2e')][_0xd47b('0x31')]));_0x2ae74e['attributes']=_0x2ae74e['attributes'][_0xd47b('0x32')]?_0x2ae74e[_0xd47b('0x33')]:_0x1d15f4[_0xd47b('0x30')];if(!_0x527afc['query'][_0xd47b('0x34')](_0xd47b('0x35'))){_0x2ae74e[_0xd47b('0x1b')]=qs[_0xd47b('0x1b')](_0x527afc[_0xd47b('0x2e')][_0xd47b('0x1b')]);_0x2ae74e['offset']=qs[_0xd47b('0x1d')](_0x527afc[_0xd47b('0x2e')][_0xd47b('0x1d')]);}_0x2ae74e[_0xd47b('0x36')]=qs[_0xd47b('0x37')](_0x527afc[_0xd47b('0x2e')][_0xd47b('0x37')]);_0x2ae74e[_0xd47b('0x38')]=qs[_0xd47b('0x39')](_[_0xd47b('0x3a')](_0x527afc['query'],_0x1d15f4[_0xd47b('0x39')]),_0x835edc);if(_0x527afc[_0xd47b('0x2e')][_0xd47b('0x3b')]){_0x2ae74e['where']=_[_0xd47b('0x3c')](_0x2ae74e[_0xd47b('0x38')],{'$or':_[_0xd47b('0x28')](_0x835edc,function(_0x45c10e){if(_0x45c10e['type']!==_0xd47b('0x3d')){var _0x46196f={};_0x46196f[_0x45c10e['name']]={'$like':'%'+_0x527afc[_0xd47b('0x2e')][_0xd47b('0x3b')]+'%'};return _0x46196f;}})});}_0x2ae74e=_[_0xd47b('0x3c')]({},_0x2ae74e,_0x527afc['options']);var _0x9981ab={'where':_0x2ae74e[_0xd47b('0x38')]};return db[_0xd47b('0x29')]['count'](_0x9981ab)[_0xd47b('0x3e')](function(_0x16e6b4){_0x44a461['count']=_0x16e6b4;if(_0x527afc['query'][_0xd47b('0x3f')]){_0x2ae74e[_0xd47b('0x40')]=[{'all':!![]}];}return db[_0xd47b('0x29')]['findAll'](_0x2ae74e);})[_0xd47b('0x3e')](function(_0x339580){_0x44a461[_0xd47b('0x41')]=_0x339580;return _0x44a461;})['then'](respondWithFilteredResult(_0x446102,_0x2ae74e))[_0xd47b('0x42')](handleError(_0x446102,null));};exports[_0xd47b('0x43')]=function(_0x13d5a2,_0x3a37fa){var _0xae777={'raw':![],'where':{'id':_0x13d5a2[_0xd47b('0x44')]['id']}},_0x43a244={};_0x43a244[_0xd47b('0x30')]=_[_0xd47b('0x2d')](db[_0xd47b('0x29')][_0xd47b('0x2a')]);_0x43a244[_0xd47b('0x2e')]=_[_0xd47b('0x2d')](_0x13d5a2[_0xd47b('0x2e')]);_0x43a244['filters']=_[_0xd47b('0x2f')](_0x43a244[_0xd47b('0x30')],_0x43a244[_0xd47b('0x2e')]);_0xae777['attributes']=_[_0xd47b('0x2f')](_0x43a244['model'],qs['fields'](_0x13d5a2[_0xd47b('0x2e')][_0xd47b('0x31')]));_0xae777[_0xd47b('0x33')]=_0xae777['attributes'][_0xd47b('0x32')]?_0xae777[_0xd47b('0x33')]:_0x43a244[_0xd47b('0x30')];if(_0x13d5a2[_0xd47b('0x2e')]['includeAll']){_0xae777[_0xd47b('0x40')]=[{'all':!![]}];}_0xae777=_[_0xd47b('0x3c')]({},_0xae777,_0x13d5a2[_0xd47b('0x45')]);return db[_0xd47b('0x29')][_0xd47b('0x46')](_0xae777)['then'](handleEntityNotFound(_0x3a37fa,null))[_0xd47b('0x3e')](respondWithResult(_0x3a37fa,null))['catch'](handleError(_0x3a37fa,null));};exports[_0xd47b('0x47')]=function(_0x47bbb0,_0x2cb695){return db[_0xd47b('0x29')][_0xd47b('0x47')](_0x47bbb0['body'],{})['then'](respondWithResult(_0x2cb695,0xc9))[_0xd47b('0x42')](handleError(_0x2cb695,null));};exports[_0xd47b('0x48')]=function(_0x3c77f2,_0x536a24){if(_0x3c77f2['body']['id']){delete _0x3c77f2[_0xd47b('0x49')]['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0x3c77f2[_0xd47b('0x44')]['id']}})[_0xd47b('0x3e')](handleEntityNotFound(_0x536a24,null))[_0xd47b('0x3e')](saveUpdates(_0x3c77f2[_0xd47b('0x49')],null))[_0xd47b('0x3e')](respondWithResult(_0x536a24,null))[_0xd47b('0x42')](handleError(_0x536a24,null));};exports[_0xd47b('0x22')]=function(_0x1f71ff,_0x5380cf){return db['ServicenowAccount']['find']({'where':{'id':_0x1f71ff[_0xd47b('0x44')]['id']}})[_0xd47b('0x3e')](handleEntityNotFound(_0x5380cf,null))[_0xd47b('0x3e')](removeEntity(_0x5380cf,null))[_0xd47b('0x42')](handleError(_0x5380cf,null));};exports['getConfigurations']=function(_0x183179,_0x266506,_0x302c48){var _0x111fe6={};var _0x4164f5={};var _0x5232c0;var _0x115086;return db[_0xd47b('0x29')][_0xd47b('0x4a')]({'where':{'id':_0x183179[_0xd47b('0x44')]['id']}})['then'](handleEntityNotFound(_0x266506,null))['then'](function(_0x244cd1){if(_0x244cd1){_0x5232c0=_0x244cd1;_0x4164f5[_0xd47b('0x30')]=_['keys'](db[_0xd47b('0x4b')][_0xd47b('0x2a')]);_0x4164f5[_0xd47b('0x2e')]=_[_0xd47b('0x2d')](_0x183179[_0xd47b('0x2e')]);_0x4164f5[_0xd47b('0x39')]=_[_0xd47b('0x2f')](_0x4164f5[_0xd47b('0x30')],_0x4164f5[_0xd47b('0x2e')]);_0x111fe6[_0xd47b('0x33')]=_[_0xd47b('0x2f')](_0x4164f5[_0xd47b('0x30')],qs[_0xd47b('0x31')](_0x183179[_0xd47b('0x2e')]['fields']));_0x111fe6[_0xd47b('0x33')]=_0x111fe6[_0xd47b('0x33')][_0xd47b('0x32')]?_0x111fe6['attributes']:_0x4164f5[_0xd47b('0x30')];_0x111fe6['order']=qs[_0xd47b('0x37')](_0x183179[_0xd47b('0x2e')][_0xd47b('0x37')]);_0x111fe6[_0xd47b('0x38')]=qs['filters'](_[_0xd47b('0x3a')](_0x183179[_0xd47b('0x2e')],_0x4164f5[_0xd47b('0x39')]));if(_0x183179['query']['filter']){_0x111fe6[_0xd47b('0x38')]=_[_0xd47b('0x3c')](_0x111fe6['where'],{'$or':_[_0xd47b('0x28')](_0x111fe6[_0xd47b('0x33')],function(_0x24c132){var _0x30fd73={};_0x30fd73[_0x24c132]={'$like':'%'+_0x183179[_0xd47b('0x2e')][_0xd47b('0x3b')]+'%'};return _0x30fd73;})});}_0x111fe6=_[_0xd47b('0x3c')]({},_0x111fe6,_0x183179[_0xd47b('0x45')]);return _0x5232c0[_0xd47b('0x4c')](_0x111fe6);}})[_0xd47b('0x3e')](function(_0x2ee617){if(_0x2ee617){_0x115086=_0x2ee617[_0xd47b('0x32')];if(!_0x183179[_0xd47b('0x2e')][_0xd47b('0x34')]('nolimit')){_0x111fe6['limit']=qs[_0xd47b('0x1b')](_0x183179[_0xd47b('0x2e')]['limit']);_0x111fe6[_0xd47b('0x1d')]=qs['offset'](_0x183179[_0xd47b('0x2e')]['offset']);}return _0x5232c0['getConfigurations'](_0x111fe6);}})[_0xd47b('0x3e')](function(_0x2e82bc){if(_0x2e82bc){return _0x2e82bc?{'count':_0x115086,'rows':_0x2e82bc}:null;}})[_0xd47b('0x3e')](respondWithResult(_0x266506,null))['catch'](handleError(_0x266506,null));};exports[_0xd47b('0x4d')]=function(_0x2d04f3,_0x5bb123,_0x1adff5){if(_0x2d04f3[_0xd47b('0x49')]['id']){delete _0x2d04f3[_0xd47b('0x49')]['id'];}return db[_0xd47b('0x29')][_0xd47b('0x4a')]({'where':{'id':_0x2d04f3[_0xd47b('0x44')]['id']}})[_0xd47b('0x3e')](handleEntityNotFound(_0x5bb123,null))[_0xd47b('0x3e')](function(_0x4892a6){if(_0x4892a6){_0x2d04f3['body'][_0xd47b('0x4e')]=_0x4892a6['id'];_0x2d04f3[_0xd47b('0x49')][_0xd47b('0x4f')]=integrations['getSubjects'](_0x2d04f3[_0xd47b('0x49')]['channel'],_0x2d04f3['body'][_0xd47b('0x2c')]);_0x2d04f3['body'][_0xd47b('0x50')]=integrations[_0xd47b('0x51')](_0x2d04f3['body'][_0xd47b('0x52')],_0x2d04f3[_0xd47b('0x49')][_0xd47b('0x2c')]);return db[_0xd47b('0x4b')][_0xd47b('0x47')](_0x2d04f3[_0xd47b('0x49')],{'include':[{'model':db[_0xd47b('0x53')],'as':'Subjects'},{'model':db[_0xd47b('0x53')],'as':_0xd47b('0x50')}]});}return null;})[_0xd47b('0x3e')](respondWithResult(_0x5bb123,null))[_0xd47b('0x42')](handleError(_0x5bb123,null));};exports[_0xd47b('0x54')]=function(_0x6745e3,_0x229b12,_0x4b9d48){var _0x59a37e=[_0xd47b('0x55'),_0xd47b('0x56'),_0xd47b('0x57'),_0xd47b('0x58'),_0xd47b('0x59'),'notify',_0xd47b('0x5a'),_0xd47b('0x5b'),_0xd47b('0x5c')];var _0x261e77=[_0xd47b('0x5d'),_0xd47b('0x55'),_0xd47b('0x5e'),_0xd47b('0x5f'),'upon_reject',_0xd47b('0x60'),_0xd47b('0x61'),_0xd47b('0x56'),_0xd47b('0x62'),_0xd47b('0x63'),_0xd47b('0x64'),'sys_updated_by',_0xd47b('0x65'),_0xd47b('0x66'),_0xd47b('0x67'),'sys_domain','state',_0xd47b('0x68'),_0xd47b('0x57'),_0xd47b('0x36'),_0xd47b('0x69'),'closed_at','cmdb_ci',_0xd47b('0x6a'),'impact',_0xd47b('0x6b'),_0xd47b('0x6c'),_0xd47b('0x6d'),_0xd47b('0x6e'),_0xd47b('0x6f'),_0xd47b('0x70'),_0xd47b('0x71'),_0xd47b('0x72'),_0xd47b('0x73'),'business_duration','group_list','work_end',_0xd47b('0x74'),_0xd47b('0x75'),_0xd47b('0x76'),'approval_set',_0xd47b('0x58'),_0xd47b('0x77'),_0xd47b('0x78'),_0xd47b('0x59'),_0xd47b('0x79'),_0xd47b('0x7a'),_0xd47b('0x7b'),_0xd47b('0x7c'),_0xd47b('0x7d'),_0xd47b('0x7e'),_0xd47b('0x7f'),_0xd47b('0x80'),_0xd47b('0x81'),_0xd47b('0x82'),_0xd47b('0x83'),'closed_by','follow_up',_0xd47b('0x84'),_0xd47b('0x85'),'contact_type',_0xd47b('0x86'),'incident_state',_0xd47b('0x87'),_0xd47b('0x88'),_0xd47b('0x89'),_0xd47b('0x8a'),_0xd47b('0x8b'),_0xd47b('0x8c'),_0xd47b('0x5b'),_0xd47b('0x8d'),_0xd47b('0x8e'),_0xd47b('0x8f'),_0xd47b('0x90'),_0xd47b('0x91'),_0xd47b('0x92'),_0xd47b('0x93'),_0xd47b('0x94'),_0xd47b('0x95'),'upon_approval','correlation_id',_0xd47b('0x96'),_0xd47b('0x5c')];var _0x5523ca='';var _0x4b448c='';var _0x24a158=[];var _0x4573c1='';var _0x67882f='';var _0x15399a=[];var _0x25d8a='';var _0x296d5b='';var _0x5eaa05={};var _0x21df89='';return db[_0xd47b('0x29')][_0xd47b('0x4a')]({'where':{'id':_0x6745e3[_0xd47b('0x44')]['id']},'attributes':['id',_0xd47b('0x97'),_0xd47b('0x98'),_0xd47b('0x99'),_0xd47b('0x9a'),_0xd47b('0x9b')]})[_0xd47b('0x3e')](handleEntityNotFound(_0x229b12,null))[_0xd47b('0x3e')](function(_0x209086){if(_0x209086){_0x21df89=_0x209086[_0xd47b('0x9a')];var _0x37f23f=_0x21df89[_0xd47b('0x9c')](-0x1);if(_0x37f23f==='/'){_0x21df89=_0x21df89['substring'](0x0,_0x21df89[_0xd47b('0x9d')](_0x37f23f));}_0x296d5b=util[_0xd47b('0x9e')](_0xd47b('0x9f'),_0x21df89);_0x25d8a=util[_0xd47b('0x9e')](_0xd47b('0xa0'),_0x21df89);_0x5eaa05={'user':_0x209086['username'],'pass':_0x209086[_0xd47b('0x98')]};var _0xb59f40={'method':_0xd47b('0xa1'),'uri':_0x296d5b+'incident?sysparm_display_value=all','auth':_0x5eaa05,'json':!![]};return rp(_0xb59f40);}})[_0xd47b('0x3e')](function(_0x4f66e4){if(_0x4f66e4[_0xd47b('0xa2')][_0xd47b('0x32')]>0x0){_0x5523ca=_0x4f66e4[_0xd47b('0xa2')];}console[_0xd47b('0xa3')](_0xd47b('0xa4'),_0x5523ca);_0x15399a=[];_0x4b448c=Object[_0xd47b('0xa5')]([],_0x5523ca);_['remove'](_0x4b448c,function(_0x40a59a){return!_0x59a37e[_0xd47b('0xa6')](_0x40a59a[_0xd47b('0x25')]);});_0x4b448c[_0xd47b('0xa7')](function(_0x252786){var _0x3531c0=createFieldObject(_0x25d8a,_0x5eaa05,_0x252786[_0xd47b('0xa8')],_0x252786[_0xd47b('0x25')],_0x252786[_0xd47b('0xa9')],![]);_0x15399a[_0xd47b('0xaa')](_0x3531c0);});return Promise[_0xd47b('0xab')](_0x15399a);})[_0xd47b('0x3e')](function(_0x39f875){_0x24a158=_0x39f875;_0x4573c1=Object[_0xd47b('0xa5')]([],_0x5523ca);console[_0xd47b('0xa3')](_0xd47b('0xac'),_0x5523ca);_[_0xd47b('0xad')](_0x4573c1,function(_0x33db30){return _0x261e77[_0xd47b('0xa6')](_0x33db30[_0xd47b('0x25')]);});console[_0xd47b('0xa3')](_0xd47b('0xae'),_0x4573c1);_0x15399a=[];_0x4573c1[_0xd47b('0xa7')](function(_0x3d254b){var _0x5dfb2e=createFieldObject(_0x25d8a,_0x5eaa05,_0x3d254b['internalType'],_0x3d254b['name'],_0x3d254b[_0xd47b('0xa9')],!![]);_0x15399a[_0xd47b('0xaa')](_0x5dfb2e);});return Promise[_0xd47b('0xab')](_0x15399a);})[_0xd47b('0x3e')](function(_0x2ea1ea){_0x67882f=_0x2ea1ea;var _0x49852c=_0x24a158[_0xd47b('0xaf')](_0x67882f);return{'count':_0x49852c[_0xd47b('0x32')],'rows':_0x49852c};})[_0xd47b('0x3e')](respondWithResult(_0x229b12,null))[_0xd47b('0x42')](function(_0x271c06){console['log'](_0xd47b('0xb0')+_0x271c06);var _0x2f05b3=_0x6745e3['query'][_0xd47b('0xb1')]?0x1f4:_0x271c06[_0xd47b('0xb2')]||0x1f4;logger['error'](_0x271c06[_0xd47b('0x24')]);delete _0x271c06[_0xd47b('0x25')];if(_0x2f05b3===0x191){_0x2f05b3=0x190;}_0x229b12[_0xd47b('0x18')](_0x2f05b3)[_0xd47b('0x26')](_0x6745e3[_0xd47b('0x2e')]['test']?{'message':_0xd47b('0xb3'),'statusCode':_0x271c06[_0xd47b('0xb2')]}:_0x271c06);});};function createFieldObject(_0x5d0b99,_0x2267df,_0x335f3f,_0x248228,_0x55150f,_0x134322){return new Promise(function(_0x36d90f,_0x26e598){var _0x1ef8c0={'id':_0x248228,'name':_0x55150f,'custom':_0x134322};if(_0x335f3f===_0xd47b('0xb4')){_0x1ef8c0[_0xd47b('0x45')]=[{'name':'True','value':_0xd47b('0xb5')},{'name':_0xd47b('0xb6'),'value':_0xd47b('0xb7')}];_0x36d90f(_0x1ef8c0);}else{var _0x378846={'method':_0xd47b('0xa1'),'uri':_0x5d0b99+'sys_choice?sysparm_query=name=incident^element='+_0x248228,'auth':_0x2267df,'json':!![]};return rp(_0x378846)[_0xd47b('0x3e')](function(_0x9b1178){var _0x5bc5d0=[];if(_0x9b1178['result'][_0xd47b('0x32')]>0x0){_0x9b1178[_0xd47b('0xa2')][_0xd47b('0xa7')](function(_0x47b1b2){if(_0x47b1b2[_0xd47b('0xb8')]===_0xd47b('0xb7')){var _0x3e1ed3={'name':_0x47b1b2[_0xd47b('0xa9')],'value':_0x47b1b2[_0xd47b('0xb9')]};_0x5bc5d0[_0xd47b('0xaa')](_0x3e1ed3);}});}_0x1ef8c0['options']=_0x5bc5d0;if(_0x1ef8c0['options']['length']>0x0){_0x36d90f(_0x1ef8c0);}else{if(_0x134322==![]){_0x36d90f();}else{_0x36d90f(_0x1ef8c0);}}});}});} \ No newline at end of file +var _0xf657=['set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','ServicenowAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','getConfigurations','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','getFields','hold_reason','knowledge','subcategory','close_code','incident_state','severity','category','parent','made_sla','caused_by','watch_list','upon_reject','child_incidents','approval_history','sys_updated_by','opened_by','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','active','work_notes_list','business_service','priority','rfc','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','notify','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','username','password','email','remoteUri','serverUrl','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','remove','internalType','label','push','all','log','includes','forEach','concat','ServiceNow\x20error:\x20','statusCode','Wrong\x20credentials','boolean','true','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0xc8570d,_0x53d67a){var _0x31967c=function(_0x1fabff){while(--_0x1fabff){_0xc8570d['push'](_0xc8570d['shift']());}};_0x31967c(++_0x53d67a);}(_0xf657,0x99));var _0x7f65=function(_0x468565,_0x5747d6){_0x468565=_0x468565-0x0;var _0x2e7bce=_0xf657[_0x468565];return _0x2e7bce;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7f65('0x0'));var rp=require('request-promise');var moment=require(_0x7f65('0x1'));var BPromise=require(_0x7f65('0x2'));var Mustache=require('mustache');var util=require(_0x7f65('0x3'));var path=require(_0x7f65('0x4'));var sox=require(_0x7f65('0x5'));var csv=require(_0x7f65('0x6'));var ejs=require(_0x7f65('0x7'));var fs=require('fs');var fs_extra=require(_0x7f65('0x8'));var _=require(_0x7f65('0x9'));var squel=require('squel');var crypto=require(_0x7f65('0xa'));var jsforce=require(_0x7f65('0xb'));var deskjs=require(_0x7f65('0xc'));var toCsv=require(_0x7f65('0x6'));var querystring=require(_0x7f65('0xd'));var Papa=require(_0x7f65('0xe'));var Redis=require(_0x7f65('0xf'));var authService=require(_0x7f65('0x10'));var qs=require(_0x7f65('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f65('0x12'))(_0x7f65('0x13'));var utils=require(_0x7f65('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7f65('0x15'));var db=require(_0x7f65('0x16'))['db'];var integrations=require(_0x7f65('0x17'));function respondWithStatusCode(_0x187099,_0x41cb8e){_0x41cb8e=_0x41cb8e||0xcc;return function(_0x468fb3){if(_0x468fb3){return _0x187099[_0x7f65('0x18')](_0x41cb8e);}return _0x187099[_0x7f65('0x19')](_0x41cb8e)[_0x7f65('0x1a')]();};}function respondWithResult(_0x4ee871,_0x4ae801){_0x4ae801=_0x4ae801||0xc8;return function(_0x33a709){if(_0x33a709){return _0x4ee871[_0x7f65('0x19')](_0x4ae801)[_0x7f65('0x1b')](_0x33a709);}};}function respondWithFilteredResult(_0x56591e,_0x2ea740){return function(_0x2321c5){if(_0x2321c5){var _0x2b8a19=typeof _0x2ea740[_0x7f65('0x1c')]===_0x7f65('0x1d')&&typeof _0x2ea740[_0x7f65('0x1e')]==='undefined';var _0x5b8187=_0x2321c5[_0x7f65('0x1f')];var _0x382226=_0x2b8a19?0x0:_0x2ea740[_0x7f65('0x1c')];var _0x303ec7=_0x2b8a19?_0x2321c5[_0x7f65('0x1f')]:_0x2ea740[_0x7f65('0x1c')]+_0x2ea740[_0x7f65('0x1e')];var _0x1c12f2;if(_0x303ec7>=_0x5b8187){_0x303ec7=_0x5b8187;_0x1c12f2=0xc8;}else{_0x1c12f2=0xce;}_0x56591e['status'](_0x1c12f2);return _0x56591e[_0x7f65('0x20')](_0x7f65('0x21'),_0x382226+'-'+_0x303ec7+'/'+_0x5b8187)['json'](_0x2321c5);}return null;};}function patchUpdates(_0x26210d){return function(_0x50e36c){try{jsonpatch[_0x7f65('0x22')](_0x50e36c,_0x26210d,!![]);}catch(_0x2c738f){return BPromise[_0x7f65('0x23')](_0x2c738f);}return _0x50e36c[_0x7f65('0x24')]();};}function saveUpdates(_0x4213a1,_0x22c4f8){return function(_0x516d9f){if(_0x516d9f){return _0x516d9f['update'](_0x4213a1)['then'](function(_0xd563c1){return _0xd563c1;});}return null;};}function removeEntity(_0x5f53e4,_0x25cb1f){return function(_0x796237){if(_0x796237){return _0x796237[_0x7f65('0x25')]()[_0x7f65('0x26')](function(){_0x5f53e4[_0x7f65('0x19')](0xcc)[_0x7f65('0x1a')]();});}};}function handleEntityNotFound(_0xfe72f5,_0x2df570){return function(_0x23a9c1){if(!_0x23a9c1){_0xfe72f5[_0x7f65('0x18')](0x194);}return _0x23a9c1;};}function handleError(_0x59a59e,_0x54e2a1){_0x54e2a1=_0x54e2a1||0x1f4;return function(_0x54aead){logger[_0x7f65('0x27')](_0x54aead[_0x7f65('0x28')]);if(_0x54aead[_0x7f65('0x29')]){delete _0x54aead[_0x7f65('0x29')];}_0x59a59e[_0x7f65('0x19')](_0x54e2a1)[_0x7f65('0x2a')](_0x54aead);};}exports[_0x7f65('0x2b')]=function(_0x47ad1a,_0x284af8){var _0x21da6c={},_0x54bb36={},_0xec896f={'count':0x0,'rows':[]};var _0x398a23=_['map'](db[_0x7f65('0x2c')][_0x7f65('0x2d')],function(_0x1d5838){return{'name':_0x1d5838[_0x7f65('0x2e')],'type':_0x1d5838[_0x7f65('0x2f')][_0x7f65('0x30')]};});_0x54bb36[_0x7f65('0x31')]=_[_0x7f65('0x32')](_0x398a23,'name');_0x54bb36[_0x7f65('0x33')]=_[_0x7f65('0x34')](_0x47ad1a[_0x7f65('0x33')]);_0x54bb36[_0x7f65('0x35')]=_['intersection'](_0x54bb36[_0x7f65('0x31')],_0x54bb36[_0x7f65('0x33')]);_0x21da6c[_0x7f65('0x36')]=_[_0x7f65('0x37')](_0x54bb36[_0x7f65('0x31')],qs[_0x7f65('0x38')](_0x47ad1a[_0x7f65('0x33')]['fields']));_0x21da6c[_0x7f65('0x36')]=_0x21da6c[_0x7f65('0x36')][_0x7f65('0x39')]?_0x21da6c['attributes']:_0x54bb36[_0x7f65('0x31')];if(!_0x47ad1a['query'][_0x7f65('0x3a')](_0x7f65('0x3b'))){_0x21da6c['limit']=qs[_0x7f65('0x1e')](_0x47ad1a[_0x7f65('0x33')]['limit']);_0x21da6c[_0x7f65('0x1c')]=qs[_0x7f65('0x1c')](_0x47ad1a[_0x7f65('0x33')][_0x7f65('0x1c')]);}_0x21da6c[_0x7f65('0x3c')]=qs[_0x7f65('0x3d')](_0x47ad1a[_0x7f65('0x33')][_0x7f65('0x3d')]);_0x21da6c[_0x7f65('0x3e')]=qs[_0x7f65('0x35')](_[_0x7f65('0x3f')](_0x47ad1a[_0x7f65('0x33')],_0x54bb36['filters']),_0x398a23);if(_0x47ad1a['query'][_0x7f65('0x40')]){_0x21da6c[_0x7f65('0x3e')]=_['merge'](_0x21da6c[_0x7f65('0x3e')],{'$or':_[_0x7f65('0x32')](_0x398a23,function(_0x170799){if(_0x170799[_0x7f65('0x2f')]!==_0x7f65('0x41')){var _0x238978={};_0x238978[_0x170799[_0x7f65('0x29')]]={'$like':'%'+_0x47ad1a[_0x7f65('0x33')][_0x7f65('0x40')]+'%'};return _0x238978;}})});}_0x21da6c=_[_0x7f65('0x42')]({},_0x21da6c,_0x47ad1a[_0x7f65('0x43')]);var _0x5021f8={'where':_0x21da6c[_0x7f65('0x3e')]};return db[_0x7f65('0x2c')][_0x7f65('0x1f')](_0x5021f8)[_0x7f65('0x26')](function(_0x1c4556){_0xec896f[_0x7f65('0x1f')]=_0x1c4556;if(_0x47ad1a[_0x7f65('0x33')][_0x7f65('0x44')]){_0x21da6c[_0x7f65('0x45')]=[{'all':!![]}];}return db[_0x7f65('0x2c')][_0x7f65('0x46')](_0x21da6c);})[_0x7f65('0x26')](function(_0xdda4f4){_0xec896f[_0x7f65('0x47')]=_0xdda4f4;return _0xec896f;})[_0x7f65('0x26')](respondWithFilteredResult(_0x284af8,_0x21da6c))['catch'](handleError(_0x284af8,null));};exports[_0x7f65('0x48')]=function(_0x29cf7c,_0x1413eb){var _0x5a3d9f={'raw':![],'where':{'id':_0x29cf7c[_0x7f65('0x49')]['id']}},_0x1f8480={};_0x1f8480['model']=_['keys'](db['ServicenowAccount']['rawAttributes']);_0x1f8480['query']=_[_0x7f65('0x34')](_0x29cf7c['query']);_0x1f8480['filters']=_[_0x7f65('0x37')](_0x1f8480['model'],_0x1f8480[_0x7f65('0x33')]);_0x5a3d9f[_0x7f65('0x36')]=_[_0x7f65('0x37')](_0x1f8480['model'],qs[_0x7f65('0x38')](_0x29cf7c[_0x7f65('0x33')][_0x7f65('0x38')]));_0x5a3d9f[_0x7f65('0x36')]=_0x5a3d9f['attributes'][_0x7f65('0x39')]?_0x5a3d9f[_0x7f65('0x36')]:_0x1f8480['model'];if(_0x29cf7c[_0x7f65('0x33')]['includeAll']){_0x5a3d9f[_0x7f65('0x45')]=[{'all':!![]}];}_0x5a3d9f=_[_0x7f65('0x42')]({},_0x5a3d9f,_0x29cf7c['options']);return db[_0x7f65('0x2c')][_0x7f65('0x4a')](_0x5a3d9f)[_0x7f65('0x26')](handleEntityNotFound(_0x1413eb,null))['then'](respondWithResult(_0x1413eb,null))[_0x7f65('0x4b')](handleError(_0x1413eb,null));};exports[_0x7f65('0x4c')]=function(_0x2a4be4,_0x21da85){return db[_0x7f65('0x2c')][_0x7f65('0x4c')](_0x2a4be4[_0x7f65('0x4d')],{})[_0x7f65('0x26')](respondWithResult(_0x21da85,0xc9))[_0x7f65('0x4b')](handleError(_0x21da85,null));};exports['update']=function(_0x23dc91,_0x5c1059){if(_0x23dc91[_0x7f65('0x4d')]['id']){delete _0x23dc91[_0x7f65('0x4d')]['id'];}return db[_0x7f65('0x2c')]['find']({'where':{'id':_0x23dc91[_0x7f65('0x49')]['id']}})[_0x7f65('0x26')](handleEntityNotFound(_0x5c1059,null))[_0x7f65('0x26')](saveUpdates(_0x23dc91[_0x7f65('0x4d')],null))[_0x7f65('0x26')](respondWithResult(_0x5c1059,null))[_0x7f65('0x4b')](handleError(_0x5c1059,null));};exports['destroy']=function(_0x41f169,_0x15ea6f){return db[_0x7f65('0x2c')][_0x7f65('0x4a')]({'where':{'id':_0x41f169[_0x7f65('0x49')]['id']}})[_0x7f65('0x26')](handleEntityNotFound(_0x15ea6f,null))['then'](removeEntity(_0x15ea6f,null))[_0x7f65('0x4b')](handleError(_0x15ea6f,null));};exports['getConfigurations']=function(_0x1305c4,_0x2dd105,_0x346e56){var _0x16386c={};var _0x8ab762={};var _0x4dfbe8;var _0x20fe37;return db[_0x7f65('0x2c')]['findOne']({'where':{'id':_0x1305c4[_0x7f65('0x49')]['id']}})[_0x7f65('0x26')](handleEntityNotFound(_0x2dd105,null))['then'](function(_0x3e2d75){if(_0x3e2d75){_0x4dfbe8=_0x3e2d75;_0x8ab762[_0x7f65('0x31')]=_[_0x7f65('0x34')](db['ServicenowConfiguration'][_0x7f65('0x2d')]);_0x8ab762[_0x7f65('0x33')]=_['keys'](_0x1305c4['query']);_0x8ab762[_0x7f65('0x35')]=_['intersection'](_0x8ab762[_0x7f65('0x31')],_0x8ab762['query']);_0x16386c['attributes']=_['intersection'](_0x8ab762[_0x7f65('0x31')],qs['fields'](_0x1305c4[_0x7f65('0x33')][_0x7f65('0x38')]));_0x16386c[_0x7f65('0x36')]=_0x16386c[_0x7f65('0x36')]['length']?_0x16386c[_0x7f65('0x36')]:_0x8ab762[_0x7f65('0x31')];_0x16386c[_0x7f65('0x3c')]=qs[_0x7f65('0x3d')](_0x1305c4[_0x7f65('0x33')]['sort']);_0x16386c['where']=qs['filters'](_['pick'](_0x1305c4['query'],_0x8ab762[_0x7f65('0x35')]));if(_0x1305c4[_0x7f65('0x33')][_0x7f65('0x40')]){_0x16386c[_0x7f65('0x3e')]=_[_0x7f65('0x42')](_0x16386c[_0x7f65('0x3e')],{'$or':_[_0x7f65('0x32')](_0x16386c[_0x7f65('0x36')],function(_0x2e0ed6){var _0xb66be4={};_0xb66be4[_0x2e0ed6]={'$like':'%'+_0x1305c4[_0x7f65('0x33')][_0x7f65('0x40')]+'%'};return _0xb66be4;})});}_0x16386c=_[_0x7f65('0x42')]({},_0x16386c,_0x1305c4[_0x7f65('0x43')]);return _0x4dfbe8[_0x7f65('0x4e')](_0x16386c);}})[_0x7f65('0x26')](function(_0x2600d2){if(_0x2600d2){_0x20fe37=_0x2600d2[_0x7f65('0x39')];if(!_0x1305c4[_0x7f65('0x33')][_0x7f65('0x3a')](_0x7f65('0x3b'))){_0x16386c[_0x7f65('0x1e')]=qs[_0x7f65('0x1e')](_0x1305c4[_0x7f65('0x33')]['limit']);_0x16386c[_0x7f65('0x1c')]=qs[_0x7f65('0x1c')](_0x1305c4[_0x7f65('0x33')][_0x7f65('0x1c')]);}return _0x4dfbe8[_0x7f65('0x4e')](_0x16386c);}})[_0x7f65('0x26')](function(_0x28a0aa){if(_0x28a0aa){return _0x28a0aa?{'count':_0x20fe37,'rows':_0x28a0aa}:null;}})['then'](respondWithResult(_0x2dd105,null))['catch'](handleError(_0x2dd105,null));};exports[_0x7f65('0x4f')]=function(_0x349385,_0x324dd0,_0x565d31){if(_0x349385['body']['id']){delete _0x349385[_0x7f65('0x4d')]['id'];}return db[_0x7f65('0x2c')][_0x7f65('0x50')]({'where':{'id':_0x349385[_0x7f65('0x49')]['id']}})['then'](handleEntityNotFound(_0x324dd0,null))[_0x7f65('0x26')](function(_0x37599e){if(_0x37599e){_0x349385['body'][_0x7f65('0x51')]=_0x37599e['id'];_0x349385[_0x7f65('0x4d')][_0x7f65('0x52')]=integrations['getSubjects'](_0x349385[_0x7f65('0x4d')][_0x7f65('0x53')],_0x349385[_0x7f65('0x4d')][_0x7f65('0x2f')]);_0x349385[_0x7f65('0x4d')][_0x7f65('0x54')]=integrations[_0x7f65('0x55')](_0x349385[_0x7f65('0x4d')][_0x7f65('0x53')],_0x349385[_0x7f65('0x4d')][_0x7f65('0x2f')]);return db[_0x7f65('0x56')][_0x7f65('0x4c')](_0x349385['body'],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db['ServicenowField'],'as':_0x7f65('0x54')}]});}return null;})['then'](respondWithResult(_0x324dd0,null))[_0x7f65('0x4b')](handleError(_0x324dd0,null));};exports[_0x7f65('0x57')]=function(_0x1c5aa5,_0x34617a,_0x1430bb){var _0x32b1b1=['made_sla',_0x7f65('0x58'),_0x7f65('0x59'),_0x7f65('0x5a'),_0x7f65('0x5b'),'notify',_0x7f65('0x5c'),_0x7f65('0x5d'),_0x7f65('0x5e')];var _0x4ffefc=[_0x7f65('0x5f'),_0x7f65('0x60'),_0x7f65('0x61'),_0x7f65('0x62'),_0x7f65('0x63'),'sys_updated_on',_0x7f65('0x64'),_0x7f65('0x58'),_0x7f65('0x65'),'number','resolved_by',_0x7f65('0x66'),_0x7f65('0x67'),'user_input','sys_created_on',_0x7f65('0x68'),_0x7f65('0x69'),_0x7f65('0x6a'),_0x7f65('0x59'),'order',_0x7f65('0x6b'),_0x7f65('0x6c'),_0x7f65('0x6d'),'delivery_plan',_0x7f65('0x6e'),_0x7f65('0x6f'),_0x7f65('0x70'),_0x7f65('0x71'),_0x7f65('0x72'),'sys_domain_path',_0x7f65('0x73'),'time_worked',_0x7f65('0x74'),_0x7f65('0x75'),_0x7f65('0x76'),_0x7f65('0x77'),_0x7f65('0x78'),_0x7f65('0x79'),_0x7f65('0x7a'),'caller_id',_0x7f65('0x7b'),'subcategory',_0x7f65('0x7c'),_0x7f65('0x7d'),_0x7f65('0x5b'),_0x7f65('0x7e'),_0x7f65('0x7f'),_0x7f65('0x80'),_0x7f65('0x81'),_0x7f65('0x82'),_0x7f65('0x83'),_0x7f65('0x84'),'calendar_duration',_0x7f65('0x85'),_0x7f65('0x86'),'close_notes',_0x7f65('0x87'),_0x7f65('0x88'),_0x7f65('0x89'),_0x7f65('0x8a'),_0x7f65('0x8b'),_0x7f65('0x8c'),'incident_state',_0x7f65('0x8d'),'problem_id','company',_0x7f65('0x8e'),_0x7f65('0x8f'),_0x7f65('0x90'),'severity',_0x7f65('0x91'),_0x7f65('0x92'),_0x7f65('0x93'),'comments_and_work_notes','due_date',_0x7f65('0x94'),_0x7f65('0x95'),_0x7f65('0x96'),_0x7f65('0x97'),_0x7f65('0x98'),_0x7f65('0x99'),'location',_0x7f65('0x5e')];var _0x4e3215='';var _0x3650dc='';var _0x4c570b=[];var _0x11f396='';var _0x2eefff='';var _0x106d77=[];var _0x3c725d='';var _0x2efbe1='';var _0x4a5c67={};var _0x14d270='';return db[_0x7f65('0x2c')][_0x7f65('0x50')]({'where':{'id':_0x1c5aa5[_0x7f65('0x49')]['id']},'attributes':['id',_0x7f65('0x9a'),_0x7f65('0x9b'),_0x7f65('0x9c'),_0x7f65('0x9d'),_0x7f65('0x9e')]})[_0x7f65('0x26')](handleEntityNotFound(_0x34617a,null))[_0x7f65('0x26')](function(_0xa1cdee){if(_0xa1cdee){_0x14d270=_0xa1cdee[_0x7f65('0x9d')];var _0x2478cf=_0x14d270['slice'](-0x1);if(_0x2478cf==='/'){_0x14d270=_0x14d270[_0x7f65('0x9f')](0x0,_0x14d270[_0x7f65('0xa0')](_0x2478cf));}_0x2efbe1=util[_0x7f65('0xa1')](_0x7f65('0xa2'),_0x14d270);_0x3c725d=util['format']('%s/api/now/table/',_0x14d270);_0x4a5c67={'user':_0xa1cdee['username'],'pass':_0xa1cdee[_0x7f65('0x9b')]};var _0x722894={'method':_0x7f65('0xa3'),'uri':_0x2efbe1+_0x7f65('0xa4'),'auth':_0x4a5c67,'json':!![]};return rp(_0x722894);}})[_0x7f65('0x26')](function(_0x23dd98){if(_0x23dd98['result']['length']>0x0){_0x4e3215=_0x23dd98[_0x7f65('0xa5')];}console['log'](_0x7f65('0xa6'),_0x4e3215);_0x106d77=[];_0x3650dc=Object['assign']([],_0x4e3215);_[_0x7f65('0xa7')](_0x3650dc,function(_0x497f97){return!_0x32b1b1['includes'](_0x497f97[_0x7f65('0x29')]);});_0x3650dc['forEach'](function(_0x1dfc1c){var _0x30c8c7=createFieldObject(_0x3c725d,_0x4a5c67,_0x1dfc1c[_0x7f65('0xa8')],_0x1dfc1c[_0x7f65('0x29')],_0x1dfc1c[_0x7f65('0xa9')],![]);_0x106d77[_0x7f65('0xaa')](_0x30c8c7);});return Promise[_0x7f65('0xab')](_0x106d77);})['then'](function(_0x3d5135){_0x4c570b=_0x3d5135;_0x11f396=Object['assign']([],_0x4e3215);console[_0x7f65('0xac')]('TCL:\x20_object',_0x4e3215);_[_0x7f65('0xa7')](_0x11f396,function(_0x5a5001){return _0x4ffefc[_0x7f65('0xad')](_0x5a5001[_0x7f65('0x29')]);});console[_0x7f65('0xac')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x11f396);_0x106d77=[];_0x11f396[_0x7f65('0xae')](function(_0x5666cd){var _0x25a429=createFieldObject(_0x3c725d,_0x4a5c67,_0x5666cd[_0x7f65('0xa8')],_0x5666cd[_0x7f65('0x29')],_0x5666cd[_0x7f65('0xa9')],!![]);_0x106d77[_0x7f65('0xaa')](_0x25a429);});return Promise['all'](_0x106d77);})[_0x7f65('0x26')](function(_0x12b708){_0x2eefff=_0x12b708;var _0x43c043=_0x4c570b[_0x7f65('0xaf')](_0x2eefff);return{'count':_0x43c043[_0x7f65('0x39')],'rows':_0x43c043};})[_0x7f65('0x26')](respondWithResult(_0x34617a,null))[_0x7f65('0x4b')](function(_0x3a6b1e){console['log'](_0x7f65('0xb0')+_0x3a6b1e);var _0x3b25c7=_0x1c5aa5['query']['test']?0x1f4:_0x3a6b1e[_0x7f65('0xb1')]||0x1f4;logger[_0x7f65('0x27')](_0x3a6b1e[_0x7f65('0x28')]);delete _0x3a6b1e['name'];if(_0x3b25c7===0x191){_0x3b25c7=0x190;}_0x34617a[_0x7f65('0x19')](_0x3b25c7)[_0x7f65('0x2a')](_0x1c5aa5[_0x7f65('0x33')]['test']?{'message':_0x7f65('0xb2'),'statusCode':_0x3a6b1e[_0x7f65('0xb1')]}:_0x3a6b1e);});};function createFieldObject(_0x5b77d7,_0x2e86d0,_0x468d53,_0xaae4d7,_0xd5b0bf,_0x5a3676){return new Promise(function(_0x4f0a50,_0x4eafa9){var _0x150580={'id':_0xaae4d7,'name':_0xd5b0bf,'custom':_0x5a3676};if(_0x468d53===_0x7f65('0xb3')){_0x150580[_0x7f65('0x43')]=[{'name':'True','value':_0x7f65('0xb4')},{'name':'False','value':_0x7f65('0xb5')}];_0x4f0a50(_0x150580);}else{var _0x407b9b={'method':_0x7f65('0xa3'),'uri':_0x5b77d7+_0x7f65('0xb6')+_0xaae4d7,'auth':_0x2e86d0,'json':!![]};return rp(_0x407b9b)['then'](function(_0x5c2009){var _0xf21aee=[];if(_0x5c2009[_0x7f65('0xa5')][_0x7f65('0x39')]>0x0){_0x5c2009[_0x7f65('0xa5')]['forEach'](function(_0x128a38){if(_0x128a38[_0x7f65('0xb7')]===_0x7f65('0xb5')){var _0x2c2a75={'name':_0x128a38[_0x7f65('0xa9')],'value':_0x128a38[_0x7f65('0xb8')]};_0xf21aee[_0x7f65('0xaa')](_0x2c2a75);}});}_0x150580['options']=_0xf21aee;if(_0x150580[_0x7f65('0x43')][_0x7f65('0x39')]>0x0){_0x4f0a50(_0x150580);}else{if(_0x5a3676==![]){_0x4f0a50();}else{_0x4f0a50(_0x150580);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index fc1b945..c7ce950 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 _0xfdbd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowAccount.attributes','exports','int_servicenow_accounts'];(function(_0x43ca9a,_0x320ee8){var _0x29b7ad=function(_0x12e0aa){while(--_0x12e0aa){_0x43ca9a['push'](_0x43ca9a['shift']());}};_0x29b7ad(++_0x320ee8);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x382c73,_0x199cab){_0x382c73=_0x382c73-0x0;var _0x1dd0bf=_0xfdbd[_0x382c73];return _0x1dd0bf;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var logger=require(_0xdfdb('0x2'))(_0xdfdb('0x3'));var moment=require(_0xdfdb('0x4'));var BPromise=require(_0xdfdb('0x5'));var rp=require(_0xdfdb('0x6'));var fs=require('fs');var path=require(_0xdfdb('0x7'));var rimraf=require(_0xdfdb('0x8'));var config=require('../../config/environment');var attributes=require(_0xdfdb('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xdfdb('0xa')]=function(_0x41bd5e,_0x489f19){return _0x41bd5e['define']('ServicenowAccount',attributes,{'tableName':_0xdfdb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb138=['int_servicenow_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','ServicenowAccount'];(function(_0x12791d,_0x305975){var _0x3f48d7=function(_0x3baa47){while(--_0x3baa47){_0x12791d['push'](_0x12791d['shift']());}};_0x3f48d7(++_0x305975);}(_0xb138,0x1dd));var _0x8b13=function(_0x1725d7,_0x4673de){_0x1725d7=_0x1725d7-0x0;var _0x438c25=_0xb138[_0x1725d7];return _0x438c25;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var logger=require(_0x8b13('0x2'))(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var BPromise=require(_0x8b13('0x5'));var rp=require(_0x8b13('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var attributes=require(_0x8b13('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x8b13('0xa')]=function(_0x13f7bd,_0x5d51b1){return _0x13f7bd[_0x8b13('0xb')](_0x8b13('0xc'),attributes,{'tableName':_0x8b13('0xd'),'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 230dbbd..c9c517d 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 _0x7e05=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetServicenowAccount','options','where','include','map','model','attributes','ShowServicenowAccount','find','util'];(function(_0x2cbf69,_0x113339){var _0x122163=function(_0x1c4ef2){while(--_0x1c4ef2){_0x2cbf69['push'](_0x2cbf69['shift']());}};_0x122163(++_0x113339);}(_0x7e05,0x73));var _0x57e0=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7e05[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x57e0('0x0'));var moment=require(_0x57e0('0x1'));var BPromise=require('bluebird');var rs=require(_0x57e0('0x2'));var fs=require('fs');var Redis=require(_0x57e0('0x3'));var db=require(_0x57e0('0x4'))['db'];var utils=require(_0x57e0('0x5'));var logger=require(_0x57e0('0x6'))(_0x57e0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x57e0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc01f90,_0x1d85d8,_0x4f2145){return new BPromise(function(_0x37dad1,_0x3837be){return client[_0x57e0('0x9')](_0xc01f90,_0x4f2145)[_0x57e0('0xa')](function(_0x5682b7){logger[_0x57e0('0xb')](_0x57e0('0xc'),_0x1d85d8,_0x57e0('0xd'));logger[_0x57e0('0xe')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x1d85d8,_0x57e0('0xd'),JSON[_0x57e0('0xf')](_0x5682b7));if(_0x5682b7[_0x57e0('0x10')]){if(_0x5682b7[_0x57e0('0x10')]['code']===0x1f4){logger['error'](_0x57e0('0xc'),_0x1d85d8,_0x5682b7[_0x57e0('0x10')][_0x57e0('0x11')]);return _0x3837be(_0x5682b7['error']['message']);}logger[_0x57e0('0x10')](_0x57e0('0xc'),_0x1d85d8,_0x5682b7[_0x57e0('0x10')][_0x57e0('0x11')]);return _0x37dad1(_0x5682b7[_0x57e0('0x10')][_0x57e0('0x11')]);}else{logger[_0x57e0('0xb')](_0x57e0('0xc'),_0x1d85d8,'request\x20sent');_0x37dad1(_0x5682b7[_0x57e0('0x12')][_0x57e0('0x11')]);}})[_0x57e0('0x13')](function(_0x4da354){logger['error'](_0x57e0('0xc'),_0x1d85d8,_0x4da354);_0x3837be(_0x4da354);});});}exports[_0x57e0('0x14')]=function(_0x353c95){var _0x27ee5c=this;return new Promise(function(_0x76d4e9,_0x4d8f8e){return db['ServicenowAccount']['findAll']({'raw':_0x353c95['options']?_0x353c95[_0x57e0('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x353c95[_0x57e0('0x15')]?_0x353c95[_0x57e0('0x15')][_0x57e0('0x16')]||null:null,'attributes':_0x353c95['options']?_0x353c95[_0x57e0('0x15')]['attributes']||null:null,'limit':_0x353c95['options']?_0x353c95[_0x57e0('0x15')]['limit']||null:null,'include':_0x353c95[_0x57e0('0x15')]?_0x353c95[_0x57e0('0x15')][_0x57e0('0x17')]?_[_0x57e0('0x18')](_0x353c95[_0x57e0('0x15')][_0x57e0('0x17')],function(_0x2f1c1e){return{'model':db[_0x2f1c1e[_0x57e0('0x19')]],'as':_0x2f1c1e['as'],'attributes':_0x2f1c1e['attributes'],'include':_0x2f1c1e[_0x57e0('0x17')]?_[_0x57e0('0x18')](_0x2f1c1e['include'],function(_0x173d94){return{'model':db[_0x173d94[_0x57e0('0x19')]],'as':_0x173d94['as'],'attributes':_0x173d94[_0x57e0('0x1a')],'include':_0x173d94['include']?_[_0x57e0('0x18')](_0x173d94[_0x57e0('0x17')],function(_0x170cc7){return{'model':db[_0x170cc7['model']],'as':_0x170cc7['as'],'attributes':_0x170cc7[_0x57e0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x57e0('0xa')](function(_0x2ec3d0){logger[_0x57e0('0xb')](_0x57e0('0x14'),_0x353c95);logger[_0x57e0('0xe')]('GetServicenowAccount',_0x353c95,JSON['stringify'](_0x2ec3d0));_0x76d4e9(_0x2ec3d0);})[_0x57e0('0x13')](function(_0x3c2ee8){logger[_0x57e0('0x10')](_0x57e0('0x14'),_0x3c2ee8['message'],_0x353c95);_0x4d8f8e(_0x27ee5c['error'](0x1f4,_0x3c2ee8['message']));});});};exports[_0x57e0('0x1b')]=function(_0x111b8a){var _0x241493=this;return new Promise(function(_0x508454,_0x49ddcf){return db['ServicenowAccount'][_0x57e0('0x1c')]({'raw':_0x111b8a['options']?_0x111b8a['options']['raw']===undefined?!![]:![]:!![],'where':_0x111b8a[_0x57e0('0x15')]?_0x111b8a[_0x57e0('0x15')][_0x57e0('0x16')]||null:null,'attributes':_0x111b8a[_0x57e0('0x15')]?_0x111b8a['options'][_0x57e0('0x1a')]||null:null,'include':_0x111b8a[_0x57e0('0x15')]?_0x111b8a[_0x57e0('0x15')][_0x57e0('0x17')]?_['map'](_0x111b8a[_0x57e0('0x15')][_0x57e0('0x17')],function(_0x123fe2){return{'model':db[_0x123fe2[_0x57e0('0x19')]],'as':_0x123fe2['as'],'attributes':_0x123fe2['attributes'],'include':_0x123fe2['include']?_['map'](_0x123fe2[_0x57e0('0x17')],function(_0x4b6840){return{'model':db[_0x4b6840[_0x57e0('0x19')]],'as':_0x4b6840['as'],'attributes':_0x4b6840[_0x57e0('0x1a')],'include':_0x4b6840[_0x57e0('0x17')]?_[_0x57e0('0x18')](_0x4b6840[_0x57e0('0x17')],function(_0x1c84c6){return{'model':db[_0x1c84c6['model']],'as':_0x1c84c6['as'],'attributes':_0x1c84c6['attributes']};}):[]};}):[]};}):[]:[]})[_0x57e0('0xa')](function(_0x13452d){logger[_0x57e0('0xb')](_0x57e0('0x1b'),_0x111b8a);logger['debug'](_0x57e0('0x1b'),_0x111b8a,JSON[_0x57e0('0xf')](_0x13452d));_0x508454(_0x13452d);})['catch'](function(_0x19f5f8){logger[_0x57e0('0x10')]('ShowServicenowAccount',_0x19f5f8[_0x57e0('0x11')],_0x111b8a);_0x49ddcf(_0x241493['error'](0x1f4,_0x19f5f8[_0x57e0('0x11')]));});});}; \ No newline at end of file +var _0xd7d2=['client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetServicenowAccount','ServicenowAccount','options','raw','where','include','map','model','attributes','catch','ShowServicenowAccount','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7d2,0xf7));var _0x2d7d=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xd7d2[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x2d7d('0x0'));var util=require('util');var moment=require(_0x2d7d('0x1'));var BPromise=require('bluebird');var rs=require(_0x2d7d('0x2'));var fs=require('fs');var Redis=require(_0x2d7d('0x3'));var db=require(_0x2d7d('0x4'))['db'];var utils=require(_0x2d7d('0x5'));var logger=require(_0x2d7d('0x6'))(_0x2d7d('0x7'));var config=require('../../config/environment');var jayson=require(_0x2d7d('0x8'));var client=jayson[_0x2d7d('0x9')][_0x2d7d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x259ea3,_0x1aa14b,_0x82b17c){return new BPromise(function(_0x10aed6,_0x443a76){return client[_0x2d7d('0xb')](_0x259ea3,_0x82b17c)[_0x2d7d('0xc')](function(_0x3a1c79){logger[_0x2d7d('0xd')](_0x2d7d('0xe'),_0x1aa14b,_0x2d7d('0xf'));logger[_0x2d7d('0x10')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x1aa14b,_0x2d7d('0xf'),JSON[_0x2d7d('0x11')](_0x3a1c79));if(_0x3a1c79[_0x2d7d('0x12')]){if(_0x3a1c79[_0x2d7d('0x12')][_0x2d7d('0x13')]===0x1f4){logger[_0x2d7d('0x12')](_0x2d7d('0xe'),_0x1aa14b,_0x3a1c79[_0x2d7d('0x12')][_0x2d7d('0x14')]);return _0x443a76(_0x3a1c79[_0x2d7d('0x12')][_0x2d7d('0x14')]);}logger[_0x2d7d('0x12')](_0x2d7d('0xe'),_0x1aa14b,_0x3a1c79[_0x2d7d('0x12')][_0x2d7d('0x14')]);return _0x10aed6(_0x3a1c79[_0x2d7d('0x12')][_0x2d7d('0x14')]);}else{logger['info'](_0x2d7d('0xe'),_0x1aa14b,_0x2d7d('0xf'));_0x10aed6(_0x3a1c79['result'][_0x2d7d('0x14')]);}})['catch'](function(_0x8157d5){logger[_0x2d7d('0x12')](_0x2d7d('0xe'),_0x1aa14b,_0x8157d5);_0x443a76(_0x8157d5);});});}exports[_0x2d7d('0x15')]=function(_0x52bae1){var _0x8cf5d2=this;return new Promise(function(_0x428b5c,_0x9d6ea3){return db[_0x2d7d('0x16')]['findAll']({'raw':_0x52bae1[_0x2d7d('0x17')]?_0x52bae1[_0x2d7d('0x17')][_0x2d7d('0x18')]===undefined?!![]:![]:!![],'where':_0x52bae1[_0x2d7d('0x17')]?_0x52bae1[_0x2d7d('0x17')][_0x2d7d('0x19')]||null:null,'attributes':_0x52bae1[_0x2d7d('0x17')]?_0x52bae1[_0x2d7d('0x17')]['attributes']||null:null,'limit':_0x52bae1[_0x2d7d('0x17')]?_0x52bae1[_0x2d7d('0x17')]['limit']||null:null,'include':_0x52bae1[_0x2d7d('0x17')]?_0x52bae1[_0x2d7d('0x17')][_0x2d7d('0x1a')]?_[_0x2d7d('0x1b')](_0x52bae1[_0x2d7d('0x17')]['include'],function(_0x4882a2){return{'model':db[_0x4882a2[_0x2d7d('0x1c')]],'as':_0x4882a2['as'],'attributes':_0x4882a2[_0x2d7d('0x1d')],'include':_0x4882a2[_0x2d7d('0x1a')]?_[_0x2d7d('0x1b')](_0x4882a2[_0x2d7d('0x1a')],function(_0x724e15){return{'model':db[_0x724e15[_0x2d7d('0x1c')]],'as':_0x724e15['as'],'attributes':_0x724e15[_0x2d7d('0x1d')],'include':_0x724e15['include']?_[_0x2d7d('0x1b')](_0x724e15['include'],function(_0x1d29aa){return{'model':db[_0x1d29aa['model']],'as':_0x1d29aa['as'],'attributes':_0x1d29aa[_0x2d7d('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43af68){logger[_0x2d7d('0xd')]('GetServicenowAccount',_0x52bae1);logger['debug']('GetServicenowAccount',_0x52bae1,JSON['stringify'](_0x43af68));_0x428b5c(_0x43af68);})[_0x2d7d('0x1e')](function(_0xc09257){logger['error'](_0x2d7d('0x15'),_0xc09257['message'],_0x52bae1);_0x9d6ea3(_0x8cf5d2[_0x2d7d('0x12')](0x1f4,_0xc09257[_0x2d7d('0x14')]));});});};exports[_0x2d7d('0x1f')]=function(_0x118014){var _0x433f51=this;return new Promise(function(_0x45fc64,_0x58e23d){return db[_0x2d7d('0x16')]['find']({'raw':_0x118014[_0x2d7d('0x17')]?_0x118014[_0x2d7d('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x118014[_0x2d7d('0x17')]?_0x118014['options'][_0x2d7d('0x19')]||null:null,'attributes':_0x118014['options']?_0x118014[_0x2d7d('0x17')][_0x2d7d('0x1d')]||null:null,'include':_0x118014[_0x2d7d('0x17')]?_0x118014[_0x2d7d('0x17')][_0x2d7d('0x1a')]?_[_0x2d7d('0x1b')](_0x118014[_0x2d7d('0x17')][_0x2d7d('0x1a')],function(_0x34c06f){return{'model':db[_0x34c06f[_0x2d7d('0x1c')]],'as':_0x34c06f['as'],'attributes':_0x34c06f['attributes'],'include':_0x34c06f[_0x2d7d('0x1a')]?_['map'](_0x34c06f[_0x2d7d('0x1a')],function(_0xcd1040){return{'model':db[_0xcd1040[_0x2d7d('0x1c')]],'as':_0xcd1040['as'],'attributes':_0xcd1040[_0x2d7d('0x1d')],'include':_0xcd1040['include']?_[_0x2d7d('0x1b')](_0xcd1040[_0x2d7d('0x1a')],function(_0x4bf7c4){return{'model':db[_0x4bf7c4[_0x2d7d('0x1c')]],'as':_0x4bf7c4['as'],'attributes':_0x4bf7c4[_0x2d7d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2d7d('0xc')](function(_0xebbb7d){logger[_0x2d7d('0xd')](_0x2d7d('0x1f'),_0x118014);logger[_0x2d7d('0x10')]('ShowServicenowAccount',_0x118014,JSON[_0x2d7d('0x11')](_0xebbb7d));_0x45fc64(_0xebbb7d);})[_0x2d7d('0x1e')](function(_0x31df9f){logger[_0x2d7d('0x12')]('ShowServicenowAccount',_0x31df9f[_0x2d7d('0x14')],_0x118014);_0x58e23d(_0x433f51['error'](0x1f4,_0x31df9f[_0x2d7d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 49d31da..7142f06 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 _0x92cd=['/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x4a96d2,_0x689504){var _0x38af04=function(_0x3a67cd){while(--_0x3a67cd){_0x4a96d2['push'](_0x4a96d2['shift']());}};_0x38af04(++_0x689504);}(_0x92cd,0xbe));var _0xd92c=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x92cd[_0x1694f5];return _0x5b4321;};'use strict';var multer=require(_0xd92c('0x0'));var util=require(_0xd92c('0x1'));var path=require(_0xd92c('0x2'));var timeout=require(_0xd92c('0x3'));var express=require(_0xd92c('0x4'));var router=express['Router']();var fs_extra=require(_0xd92c('0x5'));var auth=require(_0xd92c('0x6'));var interaction=require(_0xd92c('0x7'));var config=require(_0xd92c('0x8'));var controller=require(_0xd92c('0x9'));router[_0xd92c('0xa')]('/',auth[_0xd92c('0xb')](),controller['index']);router[_0xd92c('0xa')](_0xd92c('0xc'),auth[_0xd92c('0xb')](),controller[_0xd92c('0xd')]);router['get'](_0xd92c('0xe'),auth[_0xd92c('0xb')](),controller[_0xd92c('0xf')]);router[_0xd92c('0xa')](_0xd92c('0x10'),auth[_0xd92c('0xb')](),controller[_0xd92c('0x11')]);router[_0xd92c('0xa')](_0xd92c('0x12'),auth[_0xd92c('0xb')](),controller[_0xd92c('0x13')]);router[_0xd92c('0x14')]('/',auth[_0xd92c('0xb')](),controller[_0xd92c('0x15')]);router['put'](_0xd92c('0xc'),auth[_0xd92c('0xb')](),controller[_0xd92c('0x16')]);router[_0xd92c('0x17')](_0xd92c('0xc'),auth[_0xd92c('0xb')](),controller[_0xd92c('0x18')]);module[_0xd92c('0x19')]=router; \ No newline at end of file +var _0x6a34=['/:id','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x52e0ee,_0x52f7c1){var _0x32534c=function(_0x535d65){while(--_0x535d65){_0x52e0ee['push'](_0x52e0ee['shift']());}};_0x32534c(++_0x52f7c1);}(_0x6a34,0x117));var _0x46a3=function(_0x20ec6d,_0x349de2){_0x20ec6d=_0x20ec6d-0x0;var _0x155245=_0x6a34[_0x20ec6d];return _0x155245;};'use strict';var multer=require(_0x46a3('0x0'));var util=require(_0x46a3('0x1'));var path=require(_0x46a3('0x2'));var timeout=require(_0x46a3('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x46a3('0x4'));var auth=require(_0x46a3('0x5'));var interaction=require(_0x46a3('0x6'));var config=require(_0x46a3('0x7'));var controller=require(_0x46a3('0x8'));router['get']('/',auth[_0x46a3('0x9')](),controller[_0x46a3('0xa')]);router[_0x46a3('0xb')]('/:id',auth[_0x46a3('0x9')](),controller[_0x46a3('0xc')]);router[_0x46a3('0xb')](_0x46a3('0xd'),auth[_0x46a3('0x9')](),controller[_0x46a3('0xe')]);router[_0x46a3('0xb')](_0x46a3('0xf'),auth['isAuthenticated'](),controller[_0x46a3('0x10')]);router['get'](_0x46a3('0x11'),auth[_0x46a3('0x9')](),controller[_0x46a3('0x12')]);router[_0x46a3('0x13')]('/',auth['isAuthenticated'](),controller[_0x46a3('0x14')]);router['put'](_0x46a3('0x15'),auth['isAuthenticated'](),controller[_0x46a3('0x16')]);router['delete'](_0x46a3('0x15'),auth[_0x46a3('0x9')](),controller[_0x46a3('0x17')]);module[_0x46a3('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index ccc0b47..1ea7b48 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 _0x762a=['exports','STRING','sequelize'];(function(_0x4ad0f7,_0x1920b0){var _0x30f5c8=function(_0x2aa6b6){while(--_0x2aa6b6){_0x4ad0f7['push'](_0x4ad0f7['shift']());}};_0x30f5c8(++_0x1920b0);}(_0x762a,0x140));var _0xa762=function(_0x2fc3df,_0x3f75ca){_0x2fc3df=_0x2fc3df-0x0;var _0x18632a=_0x762a[_0x2fc3df];return _0x18632a;};'use strict';var Sequelize=require(_0xa762('0x0'));module[_0xa762('0x1')]={'name':{'type':Sequelize[_0xa762('0x2')]},'description':{'type':Sequelize[_0xa762('0x2')]}}; \ No newline at end of file +var _0x5236=['STRING','sequelize'];(function(_0x17d651,_0xdb426b){var _0x40e556=function(_0xc7d956){while(--_0xc7d956){_0x17d651['push'](_0x17d651['shift']());}};_0x40e556(++_0xdb426b);}(_0x5236,0x167));var _0x6523=function(_0x5595d2,_0x47e58c){_0x5595d2=_0x5595d2-0x0;var _0x405156=_0x5236[_0x5595d2];return _0x405156;};'use strict';var Sequelize=require(_0x6523('0x0'));module['exports']={'name':{'type':Sequelize[_0x6523('0x1')]},'description':{'type':Sequelize[_0x6523('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index decd0d1..562e27b 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 _0xfdab=['catch','show','include','find','create','update','body','params','getFields','findOne','ServicenowField','order','hasOwnProperty','getSubjects','pick','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','offset','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll'];(function(_0x24ee02,_0xef3eb4){var _0x33cbf3=function(_0x105b68){while(--_0x105b68){_0x24ee02['push'](_0x24ee02['shift']());}};_0x33cbf3(++_0xef3eb4);}(_0xfdab,0x1ea));var _0xbfda=function(_0x1e0fd7,_0x43a6cd){_0x1e0fd7=_0x1e0fd7-0x0;var _0x3255a0=_0xfdab[_0x1e0fd7];return _0x3255a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbfda('0x0'));var zipdir=require(_0xbfda('0x1'));var jsonpatch=require(_0xbfda('0x2'));var rp=require(_0xbfda('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbfda('0x4'));var util=require(_0xbfda('0x5'));var path=require(_0xbfda('0x6'));var sox=require(_0xbfda('0x7'));var csv=require(_0xbfda('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbfda('0x9'));var _=require('lodash');var squel=require(_0xbfda('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbfda('0xb'));var toCsv=require(_0xbfda('0x8'));var querystring=require(_0xbfda('0xc'));var Papa=require('papaparse');var Redis=require(_0xbfda('0xd'));var authService=require(_0xbfda('0xe'));var qs=require(_0xbfda('0xf'));var as=require(_0xbfda('0x10'));var hardwareService=require(_0xbfda('0x11'));var logger=require(_0xbfda('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xbfda('0x13'));var licenseUtil=require(_0xbfda('0x14'));var db=require(_0xbfda('0x15'))['db'];function respondWithStatusCode(_0x2a5ac5,_0x537dfe){_0x537dfe=_0x537dfe||0xcc;return function(_0x1c2cbd){if(_0x1c2cbd){return _0x2a5ac5[_0xbfda('0x16')](_0x537dfe);}return _0x2a5ac5['status'](_0x537dfe)[_0xbfda('0x17')]();};}function respondWithResult(_0x241468,_0x250703){_0x250703=_0x250703||0xc8;return function(_0x215972){if(_0x215972){return _0x241468[_0xbfda('0x18')](_0x250703)[_0xbfda('0x19')](_0x215972);}};}function respondWithFilteredResult(_0x421764,_0x1d0ab6){return function(_0x2f112e){if(_0x2f112e){var _0x4c903b=typeof _0x1d0ab6['offset']===_0xbfda('0x1a')&&typeof _0x1d0ab6[_0xbfda('0x1b')]===_0xbfda('0x1a');var _0x489667=_0x2f112e[_0xbfda('0x1c')];var _0x10943d=_0x4c903b?0x0:_0x1d0ab6['offset'];var _0xcd94a0=_0x4c903b?_0x2f112e[_0xbfda('0x1c')]:_0x1d0ab6['offset']+_0x1d0ab6['limit'];var _0x2e8cee;if(_0xcd94a0>=_0x489667){_0xcd94a0=_0x489667;_0x2e8cee=0xc8;}else{_0x2e8cee=0xce;}_0x421764[_0xbfda('0x18')](_0x2e8cee);return _0x421764[_0xbfda('0x1d')](_0xbfda('0x1e'),_0x10943d+'-'+_0xcd94a0+'/'+_0x489667)['json'](_0x2f112e);}return null;};}function patchUpdates(_0x11c74b){return function(_0xdde856){try{jsonpatch[_0xbfda('0x1f')](_0xdde856,_0x11c74b,!![]);}catch(_0x3b0446){return BPromise['reject'](_0x3b0446);}return _0xdde856[_0xbfda('0x20')]();};}function saveUpdates(_0x15fe3d,_0x340bcd){return function(_0xe3348a){if(_0xe3348a){return _0xe3348a['update'](_0x15fe3d)[_0xbfda('0x21')](function(_0x3dc924){return _0x3dc924;});}return null;};}function removeEntity(_0x410d6b,_0x15eea3){return function(_0x526c86){if(_0x526c86){return _0x526c86[_0xbfda('0x22')]()['then'](function(){_0x410d6b[_0xbfda('0x18')](0xcc)[_0xbfda('0x17')]();});}};}function handleEntityNotFound(_0x2d8932,_0x34c81e){return function(_0x53fe44){if(!_0x53fe44){_0x2d8932[_0xbfda('0x16')](0x194);}return _0x53fe44;};}function handleError(_0x1b2b53,_0x35beb3){_0x35beb3=_0x35beb3||0x1f4;return function(_0x3b2578){logger[_0xbfda('0x23')](_0x3b2578[_0xbfda('0x24')]);if(_0x3b2578['name']){delete _0x3b2578[_0xbfda('0x25')];}_0x1b2b53['status'](_0x35beb3)[_0xbfda('0x26')](_0x3b2578);};}exports[_0xbfda('0x27')]=function(_0x52e09e,_0x5e9ca7){var _0x510d7b={},_0xf7d61={},_0x1a78d8={'count':0x0,'rows':[]};var _0x4c8863=_['map'](db[_0xbfda('0x28')][_0xbfda('0x29')],function(_0x2b9864){return{'name':_0x2b9864[_0xbfda('0x2a')],'type':_0x2b9864[_0xbfda('0x2b')]['key']};});_0xf7d61[_0xbfda('0x2c')]=_[_0xbfda('0x2d')](_0x4c8863,'name');_0xf7d61[_0xbfda('0x2e')]=_[_0xbfda('0x2f')](_0x52e09e[_0xbfda('0x2e')]);_0xf7d61[_0xbfda('0x30')]=_['intersection'](_0xf7d61[_0xbfda('0x2c')],_0xf7d61[_0xbfda('0x2e')]);_0x510d7b[_0xbfda('0x31')]=_[_0xbfda('0x32')](_0xf7d61['model'],qs[_0xbfda('0x33')](_0x52e09e['query'][_0xbfda('0x33')]));_0x510d7b[_0xbfda('0x31')]=_0x510d7b[_0xbfda('0x31')][_0xbfda('0x34')]?_0x510d7b[_0xbfda('0x31')]:_0xf7d61['model'];if(!_0x52e09e[_0xbfda('0x2e')]['hasOwnProperty'](_0xbfda('0x35'))){_0x510d7b[_0xbfda('0x1b')]=qs[_0xbfda('0x1b')](_0x52e09e['query']['limit']);_0x510d7b[_0xbfda('0x36')]=qs[_0xbfda('0x36')](_0x52e09e[_0xbfda('0x2e')][_0xbfda('0x36')]);}_0x510d7b['order']=qs['sort'](_0x52e09e[_0xbfda('0x2e')][_0xbfda('0x37')]);_0x510d7b[_0xbfda('0x38')]=qs[_0xbfda('0x30')](_['pick'](_0x52e09e[_0xbfda('0x2e')],_0xf7d61[_0xbfda('0x30')]),_0x4c8863);if(_0x52e09e[_0xbfda('0x2e')][_0xbfda('0x39')]){_0x510d7b[_0xbfda('0x38')]=_[_0xbfda('0x3a')](_0x510d7b['where'],{'$or':_[_0xbfda('0x2d')](_0x4c8863,function(_0x1b1d94){if(_0x1b1d94[_0xbfda('0x2b')]!==_0xbfda('0x3b')){var _0x306e4c={};_0x306e4c[_0x1b1d94[_0xbfda('0x25')]]={'$like':'%'+_0x52e09e[_0xbfda('0x2e')][_0xbfda('0x39')]+'%'};return _0x306e4c;}})});}_0x510d7b=_[_0xbfda('0x3a')]({},_0x510d7b,_0x52e09e[_0xbfda('0x3c')]);var _0x533409={'where':_0x510d7b[_0xbfda('0x38')]};return db[_0xbfda('0x28')][_0xbfda('0x1c')](_0x533409)[_0xbfda('0x21')](function(_0x3a90f7){_0x1a78d8[_0xbfda('0x1c')]=_0x3a90f7;if(_0x52e09e['query'][_0xbfda('0x3d')]){_0x510d7b['include']=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xbfda('0x3e')](_0x510d7b);})[_0xbfda('0x21')](function(_0x42987b){_0x1a78d8['rows']=_0x42987b;return _0x1a78d8;})[_0xbfda('0x21')](respondWithFilteredResult(_0x5e9ca7,_0x510d7b))[_0xbfda('0x3f')](handleError(_0x5e9ca7,null));};exports[_0xbfda('0x40')]=function(_0x29da07,_0x22ffc2){var _0x3a44a3={'raw':![],'where':{'id':_0x29da07['params']['id']}},_0x41f0f3={};_0x41f0f3[_0xbfda('0x2c')]=_[_0xbfda('0x2f')](db[_0xbfda('0x28')][_0xbfda('0x29')]);_0x41f0f3[_0xbfda('0x2e')]=_[_0xbfda('0x2f')](_0x29da07[_0xbfda('0x2e')]);_0x41f0f3[_0xbfda('0x30')]=_[_0xbfda('0x32')](_0x41f0f3[_0xbfda('0x2c')],_0x41f0f3[_0xbfda('0x2e')]);_0x3a44a3['attributes']=_[_0xbfda('0x32')](_0x41f0f3['model'],qs[_0xbfda('0x33')](_0x29da07[_0xbfda('0x2e')][_0xbfda('0x33')]));_0x3a44a3[_0xbfda('0x31')]=_0x3a44a3[_0xbfda('0x31')][_0xbfda('0x34')]?_0x3a44a3['attributes']:_0x41f0f3[_0xbfda('0x2c')];if(_0x29da07[_0xbfda('0x2e')][_0xbfda('0x3d')]){_0x3a44a3[_0xbfda('0x41')]=[{'all':!![]}];}_0x3a44a3=_[_0xbfda('0x3a')]({},_0x3a44a3,_0x29da07[_0xbfda('0x3c')]);return db['ServicenowConfiguration'][_0xbfda('0x42')](_0x3a44a3)[_0xbfda('0x21')](handleEntityNotFound(_0x22ffc2,null))[_0xbfda('0x21')](respondWithResult(_0x22ffc2,null))[_0xbfda('0x3f')](handleError(_0x22ffc2,null));};exports[_0xbfda('0x43')]=function(_0x3896b0,_0x222400){return db['ServicenowConfiguration'][_0xbfda('0x43')](_0x3896b0['body'],{})[_0xbfda('0x21')](respondWithResult(_0x222400,0xc9))[_0xbfda('0x3f')](handleError(_0x222400,null));};exports[_0xbfda('0x44')]=function(_0x31223b,_0x394308){if(_0x31223b[_0xbfda('0x45')]['id']){delete _0x31223b[_0xbfda('0x45')]['id'];}return db['ServicenowConfiguration'][_0xbfda('0x42')]({'where':{'id':_0x31223b[_0xbfda('0x46')]['id']}})[_0xbfda('0x21')](handleEntityNotFound(_0x394308,null))[_0xbfda('0x21')](saveUpdates(_0x31223b[_0xbfda('0x45')],null))[_0xbfda('0x21')](respondWithResult(_0x394308,null))['catch'](handleError(_0x394308,null));};exports[_0xbfda('0x22')]=function(_0xaa6ac4,_0x5bda42){return db[_0xbfda('0x28')][_0xbfda('0x42')]({'where':{'id':_0xaa6ac4['params']['id']}})[_0xbfda('0x21')](handleEntityNotFound(_0x5bda42,null))[_0xbfda('0x21')](removeEntity(_0x5bda42,null))[_0xbfda('0x3f')](handleError(_0x5bda42,null));};exports[_0xbfda('0x47')]=function(_0x57e381,_0x361110,_0x3463ec){var _0x13da8d={};var _0x5e0a90={};var _0x22ebf3;var _0x74b1d2;return db[_0xbfda('0x28')][_0xbfda('0x48')]({'where':{'id':_0x57e381[_0xbfda('0x46')]['id']}})[_0xbfda('0x21')](handleEntityNotFound(_0x361110,null))[_0xbfda('0x21')](function(_0x1f355d){if(_0x1f355d){_0x22ebf3=_0x1f355d;_0x5e0a90[_0xbfda('0x2c')]=_[_0xbfda('0x2f')](db[_0xbfda('0x49')][_0xbfda('0x29')]);_0x5e0a90[_0xbfda('0x2e')]=_[_0xbfda('0x2f')](_0x57e381[_0xbfda('0x2e')]);_0x5e0a90['filters']=_['intersection'](_0x5e0a90[_0xbfda('0x2c')],_0x5e0a90[_0xbfda('0x2e')]);_0x13da8d[_0xbfda('0x31')]=_['intersection'](_0x5e0a90['model'],qs['fields'](_0x57e381[_0xbfda('0x2e')][_0xbfda('0x33')]));_0x13da8d[_0xbfda('0x31')]=_0x13da8d[_0xbfda('0x31')][_0xbfda('0x34')]?_0x13da8d[_0xbfda('0x31')]:_0x5e0a90[_0xbfda('0x2c')];_0x13da8d[_0xbfda('0x4a')]=qs['sort'](_0x57e381['query'][_0xbfda('0x37')]);_0x13da8d[_0xbfda('0x38')]=qs[_0xbfda('0x30')](_['pick'](_0x57e381['query'],_0x5e0a90[_0xbfda('0x30')]));if(_0x57e381['query'][_0xbfda('0x39')]){_0x13da8d[_0xbfda('0x38')]=_[_0xbfda('0x3a')](_0x13da8d['where'],{'$or':_[_0xbfda('0x2d')](_0x13da8d['attributes'],function(_0xd54c96){var _0x2f7268={};_0x2f7268[_0xd54c96]={'$like':'%'+_0x57e381[_0xbfda('0x2e')][_0xbfda('0x39')]+'%'};return _0x2f7268;})});}_0x13da8d=_[_0xbfda('0x3a')]({},_0x13da8d,_0x57e381[_0xbfda('0x3c')]);return _0x22ebf3[_0xbfda('0x47')](_0x13da8d);}})[_0xbfda('0x21')](function(_0x383222){if(_0x383222){_0x74b1d2=_0x383222['length'];if(!_0x57e381[_0xbfda('0x2e')][_0xbfda('0x4b')](_0xbfda('0x35'))){_0x13da8d['limit']=qs[_0xbfda('0x1b')](_0x57e381[_0xbfda('0x2e')]['limit']);_0x13da8d['offset']=qs[_0xbfda('0x36')](_0x57e381['query'][_0xbfda('0x36')]);}return _0x22ebf3[_0xbfda('0x47')](_0x13da8d);}})[_0xbfda('0x21')](function(_0x22b489){if(_0x22b489){return _0x22b489?{'count':_0x74b1d2,'rows':_0x22b489}:null;}})[_0xbfda('0x21')](respondWithResult(_0x361110,null))[_0xbfda('0x3f')](handleError(_0x361110,null));};exports[_0xbfda('0x4c')]=function(_0x569edc,_0x44efeb,_0x3afad5){var _0x10243c={};var _0x1e87d2={};var _0x46d248;var _0x41bd5d;return db[_0xbfda('0x28')][_0xbfda('0x48')]({'where':{'id':_0x569edc['params']['id']}})[_0xbfda('0x21')](handleEntityNotFound(_0x44efeb,null))[_0xbfda('0x21')](function(_0x2f2798){if(_0x2f2798){_0x46d248=_0x2f2798;_0x1e87d2[_0xbfda('0x2c')]=_[_0xbfda('0x2f')](db['ServicenowField']['rawAttributes']);_0x1e87d2[_0xbfda('0x2e')]=_[_0xbfda('0x2f')](_0x569edc[_0xbfda('0x2e')]);_0x1e87d2[_0xbfda('0x30')]=_[_0xbfda('0x32')](_0x1e87d2[_0xbfda('0x2c')],_0x1e87d2[_0xbfda('0x2e')]);_0x10243c['attributes']=_[_0xbfda('0x32')](_0x1e87d2[_0xbfda('0x2c')],qs[_0xbfda('0x33')](_0x569edc[_0xbfda('0x2e')][_0xbfda('0x33')]));_0x10243c[_0xbfda('0x31')]=_0x10243c[_0xbfda('0x31')][_0xbfda('0x34')]?_0x10243c[_0xbfda('0x31')]:_0x1e87d2[_0xbfda('0x2c')];_0x10243c[_0xbfda('0x4a')]=qs[_0xbfda('0x37')](_0x569edc['query']['sort']);_0x10243c[_0xbfda('0x38')]=qs['filters'](_[_0xbfda('0x4d')](_0x569edc[_0xbfda('0x2e')],_0x1e87d2[_0xbfda('0x30')]));if(_0x569edc[_0xbfda('0x2e')][_0xbfda('0x39')]){_0x10243c['where']=_[_0xbfda('0x3a')](_0x10243c[_0xbfda('0x38')],{'$or':_[_0xbfda('0x2d')](_0x10243c[_0xbfda('0x31')],function(_0x2f5369){var _0x36a3bd={};_0x36a3bd[_0x2f5369]={'$like':'%'+_0x569edc['query'][_0xbfda('0x39')]+'%'};return _0x36a3bd;})});}_0x10243c=_['merge']({},_0x10243c,_0x569edc[_0xbfda('0x3c')]);return _0x46d248[_0xbfda('0x4c')](_0x10243c);}})[_0xbfda('0x21')](function(_0x1a20b4){if(_0x1a20b4){_0x41bd5d=_0x1a20b4[_0xbfda('0x34')];if(!_0x569edc[_0xbfda('0x2e')]['hasOwnProperty']('nolimit')){_0x10243c[_0xbfda('0x1b')]=qs[_0xbfda('0x1b')](_0x569edc[_0xbfda('0x2e')][_0xbfda('0x1b')]);_0x10243c[_0xbfda('0x36')]=qs[_0xbfda('0x36')](_0x569edc['query']['offset']);}return _0x46d248[_0xbfda('0x4c')](_0x10243c);}})[_0xbfda('0x21')](function(_0x402d13){if(_0x402d13){return _0x402d13?{'count':_0x41bd5d,'rows':_0x402d13}:null;}})[_0xbfda('0x21')](respondWithResult(_0x44efeb,null))['catch'](handleError(_0x44efeb,null));};exports[_0xbfda('0x4e')]=function(_0x1fb9ec,_0x7fcecd,_0xec6645){var _0x142eeb={};var _0x4989f1={};var _0x3be0df;var _0x26cb72;return db[_0xbfda('0x28')][_0xbfda('0x48')]({'where':{'id':_0x1fb9ec[_0xbfda('0x46')]['id']}})['then'](handleEntityNotFound(_0x7fcecd,null))[_0xbfda('0x21')](function(_0x17078f){if(_0x17078f){_0x3be0df=_0x17078f;_0x4989f1['model']=_[_0xbfda('0x2f')](db[_0xbfda('0x49')]['rawAttributes']);_0x4989f1[_0xbfda('0x2e')]=_[_0xbfda('0x2f')](_0x1fb9ec[_0xbfda('0x2e')]);_0x4989f1[_0xbfda('0x30')]=_['intersection'](_0x4989f1['model'],_0x4989f1[_0xbfda('0x2e')]);_0x142eeb[_0xbfda('0x31')]=_[_0xbfda('0x32')](_0x4989f1[_0xbfda('0x2c')],qs['fields'](_0x1fb9ec[_0xbfda('0x2e')][_0xbfda('0x33')]));_0x142eeb[_0xbfda('0x31')]=_0x142eeb[_0xbfda('0x31')]['length']?_0x142eeb[_0xbfda('0x31')]:_0x4989f1[_0xbfda('0x2c')];_0x142eeb['order']=qs[_0xbfda('0x37')](_0x1fb9ec[_0xbfda('0x2e')]['sort']);_0x142eeb[_0xbfda('0x38')]=qs[_0xbfda('0x30')](_[_0xbfda('0x4d')](_0x1fb9ec['query'],_0x4989f1['filters']));if(_0x1fb9ec['query'][_0xbfda('0x39')]){_0x142eeb[_0xbfda('0x38')]=_['merge'](_0x142eeb[_0xbfda('0x38')],{'$or':_['map'](_0x142eeb[_0xbfda('0x31')],function(_0x6377e8){var _0x230277={};_0x230277[_0x6377e8]={'$like':'%'+_0x1fb9ec[_0xbfda('0x2e')]['filter']+'%'};return _0x230277;})});}_0x142eeb=_['merge']({},_0x142eeb,_0x1fb9ec['options']);return _0x3be0df[_0xbfda('0x4e')](_0x142eeb);}})[_0xbfda('0x21')](function(_0x36b4b0){if(_0x36b4b0){_0x26cb72=_0x36b4b0['length'];if(!_0x1fb9ec[_0xbfda('0x2e')][_0xbfda('0x4b')]('nolimit')){_0x142eeb[_0xbfda('0x1b')]=qs[_0xbfda('0x1b')](_0x1fb9ec[_0xbfda('0x2e')][_0xbfda('0x1b')]);_0x142eeb[_0xbfda('0x36')]=qs[_0xbfda('0x36')](_0x1fb9ec['query'][_0xbfda('0x36')]);}return _0x3be0df['getDescriptions'](_0x142eeb);}})[_0xbfda('0x21')](function(_0x480760){if(_0x480760){return _0x480760?{'count':_0x26cb72,'rows':_0x480760}:null;}})[_0xbfda('0x21')](respondWithResult(_0x7fcecd,null))[_0xbfda('0x3f')](handleError(_0x7fcecd,null));}; \ No newline at end of file +var _0x9771=['then','end','stack','map','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','ServicenowConfiguration','includeAll','include','findAll','rows','catch','show','find','create','body','getFields','findOne','params','pick','ServicenowField','getDescriptions','eml-format','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','count','offset','set','json','apply','reject','update','destroy'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9771,0x1e5));var _0x1977=function(_0x3c71ec,_0x5cca12){_0x3c71ec=_0x3c71ec-0x0;var _0x5ae4c7=_0x9771[_0x3c71ec];return _0x5ae4c7;};'use strict';var emlformat=require(_0x1977('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1977('0x1'));var BPromise=require(_0x1977('0x2'));var Mustache=require(_0x1977('0x3'));var util=require('util');var path=require(_0x1977('0x4'));var sox=require(_0x1977('0x5'));var csv=require('to-csv');var ejs=require(_0x1977('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1977('0x7'));var squel=require('squel');var crypto=require(_0x1977('0x8'));var jsforce=require(_0x1977('0x9'));var deskjs=require(_0x1977('0xa'));var toCsv=require('to-csv');var querystring=require(_0x1977('0xb'));var Papa=require('papaparse');var Redis=require(_0x1977('0xc'));var authService=require(_0x1977('0xd'));var qs=require(_0x1977('0xe'));var as=require(_0x1977('0xf'));var hardwareService=require(_0x1977('0x10'));var logger=require(_0x1977('0x11'))('api');var utils=require(_0x1977('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x1977('0x13'));var db=require(_0x1977('0x14'))['db'];function respondWithStatusCode(_0x152f1d,_0x1b6808){_0x1b6808=_0x1b6808||0xcc;return function(_0x4bf96f){if(_0x4bf96f){return _0x152f1d[_0x1977('0x15')](_0x1b6808);}return _0x152f1d[_0x1977('0x16')](_0x1b6808)['end']();};}function respondWithResult(_0x1b0ebd,_0x5be435){_0x5be435=_0x5be435||0xc8;return function(_0x4a59b6){if(_0x4a59b6){return _0x1b0ebd['status'](_0x5be435)['json'](_0x4a59b6);}};}function respondWithFilteredResult(_0x478bd2,_0xc03137){return function(_0x25f0bb){if(_0x25f0bb){var _0x4cb185=typeof _0xc03137['offset']==='undefined'&&typeof _0xc03137[_0x1977('0x17')]===_0x1977('0x18');var _0x3cfbac=_0x25f0bb[_0x1977('0x19')];var _0x175795=_0x4cb185?0x0:_0xc03137[_0x1977('0x1a')];var _0x15a3e5=_0x4cb185?_0x25f0bb[_0x1977('0x19')]:_0xc03137[_0x1977('0x1a')]+_0xc03137[_0x1977('0x17')];var _0x57b2e6;if(_0x15a3e5>=_0x3cfbac){_0x15a3e5=_0x3cfbac;_0x57b2e6=0xc8;}else{_0x57b2e6=0xce;}_0x478bd2[_0x1977('0x16')](_0x57b2e6);return _0x478bd2[_0x1977('0x1b')]('Content-Range',_0x175795+'-'+_0x15a3e5+'/'+_0x3cfbac)[_0x1977('0x1c')](_0x25f0bb);}return null;};}function patchUpdates(_0x39041b){return function(_0x297ffb){try{jsonpatch[_0x1977('0x1d')](_0x297ffb,_0x39041b,!![]);}catch(_0x5b60f5){return BPromise[_0x1977('0x1e')](_0x5b60f5);}return _0x297ffb['save']();};}function saveUpdates(_0x362f5a,_0x2b91cf){return function(_0x4eb639){if(_0x4eb639){return _0x4eb639[_0x1977('0x1f')](_0x362f5a)['then'](function(_0x3873fd){return _0x3873fd;});}return null;};}function removeEntity(_0x1ddcbd,_0x12fbb5){return function(_0x3263e6){if(_0x3263e6){return _0x3263e6[_0x1977('0x20')]()[_0x1977('0x21')](function(){_0x1ddcbd['status'](0xcc)[_0x1977('0x22')]();});}};}function handleEntityNotFound(_0x5ab18c,_0x74bd89){return function(_0x423e83){if(!_0x423e83){_0x5ab18c[_0x1977('0x15')](0x194);}return _0x423e83;};}function handleError(_0x96b676,_0x3f5092){_0x3f5092=_0x3f5092||0x1f4;return function(_0x5ad3d8){logger['error'](_0x5ad3d8[_0x1977('0x23')]);if(_0x5ad3d8['name']){delete _0x5ad3d8['name'];}_0x96b676[_0x1977('0x16')](_0x3f5092)['send'](_0x5ad3d8);};}exports['index']=function(_0x185461,_0x3cc654){var _0x242c2b={},_0x418f0a={},_0x26c731={'count':0x0,'rows':[]};var _0x2c0cc7=_[_0x1977('0x24')](db['ServicenowConfiguration'][_0x1977('0x25')],function(_0x2218bb){return{'name':_0x2218bb[_0x1977('0x26')],'type':_0x2218bb[_0x1977('0x27')][_0x1977('0x28')]};});_0x418f0a[_0x1977('0x29')]=_[_0x1977('0x24')](_0x2c0cc7,_0x1977('0x2a'));_0x418f0a['query']=_[_0x1977('0x2b')](_0x185461[_0x1977('0x2c')]);_0x418f0a[_0x1977('0x2d')]=_[_0x1977('0x2e')](_0x418f0a[_0x1977('0x29')],_0x418f0a[_0x1977('0x2c')]);_0x242c2b[_0x1977('0x2f')]=_[_0x1977('0x2e')](_0x418f0a[_0x1977('0x29')],qs[_0x1977('0x30')](_0x185461[_0x1977('0x2c')]['fields']));_0x242c2b[_0x1977('0x2f')]=_0x242c2b[_0x1977('0x2f')][_0x1977('0x31')]?_0x242c2b[_0x1977('0x2f')]:_0x418f0a[_0x1977('0x29')];if(!_0x185461[_0x1977('0x2c')][_0x1977('0x32')](_0x1977('0x33'))){_0x242c2b['limit']=qs['limit'](_0x185461['query'][_0x1977('0x17')]);_0x242c2b['offset']=qs[_0x1977('0x1a')](_0x185461[_0x1977('0x2c')][_0x1977('0x1a')]);}_0x242c2b[_0x1977('0x34')]=qs[_0x1977('0x35')](_0x185461[_0x1977('0x2c')][_0x1977('0x35')]);_0x242c2b[_0x1977('0x36')]=qs[_0x1977('0x2d')](_['pick'](_0x185461[_0x1977('0x2c')],_0x418f0a[_0x1977('0x2d')]),_0x2c0cc7);if(_0x185461['query'][_0x1977('0x37')]){_0x242c2b[_0x1977('0x36')]=_['merge'](_0x242c2b[_0x1977('0x36')],{'$or':_['map'](_0x2c0cc7,function(_0x5b9fd2){if(_0x5b9fd2['type']!=='VIRTUAL'){var _0x2ed261={};_0x2ed261[_0x5b9fd2['name']]={'$like':'%'+_0x185461[_0x1977('0x2c')][_0x1977('0x37')]+'%'};return _0x2ed261;}})});}_0x242c2b=_[_0x1977('0x38')]({},_0x242c2b,_0x185461[_0x1977('0x39')]);var _0x3c7502={'where':_0x242c2b['where']};return db[_0x1977('0x3a')]['count'](_0x3c7502)[_0x1977('0x21')](function(_0x602d25){_0x26c731[_0x1977('0x19')]=_0x602d25;if(_0x185461[_0x1977('0x2c')][_0x1977('0x3b')]){_0x242c2b[_0x1977('0x3c')]=[{'all':!![]}];}return db[_0x1977('0x3a')][_0x1977('0x3d')](_0x242c2b);})[_0x1977('0x21')](function(_0x112af2){_0x26c731[_0x1977('0x3e')]=_0x112af2;return _0x26c731;})[_0x1977('0x21')](respondWithFilteredResult(_0x3cc654,_0x242c2b))[_0x1977('0x3f')](handleError(_0x3cc654,null));};exports[_0x1977('0x40')]=function(_0x5b151f,_0x4c8348){var _0x5cb7ac={'raw':![],'where':{'id':_0x5b151f['params']['id']}},_0x39bccd={};_0x39bccd[_0x1977('0x29')]=_[_0x1977('0x2b')](db[_0x1977('0x3a')]['rawAttributes']);_0x39bccd[_0x1977('0x2c')]=_[_0x1977('0x2b')](_0x5b151f[_0x1977('0x2c')]);_0x39bccd[_0x1977('0x2d')]=_[_0x1977('0x2e')](_0x39bccd[_0x1977('0x29')],_0x39bccd[_0x1977('0x2c')]);_0x5cb7ac[_0x1977('0x2f')]=_[_0x1977('0x2e')](_0x39bccd['model'],qs[_0x1977('0x30')](_0x5b151f['query']['fields']));_0x5cb7ac['attributes']=_0x5cb7ac[_0x1977('0x2f')][_0x1977('0x31')]?_0x5cb7ac[_0x1977('0x2f')]:_0x39bccd[_0x1977('0x29')];if(_0x5b151f['query']['includeAll']){_0x5cb7ac[_0x1977('0x3c')]=[{'all':!![]}];}_0x5cb7ac=_[_0x1977('0x38')]({},_0x5cb7ac,_0x5b151f[_0x1977('0x39')]);return db[_0x1977('0x3a')][_0x1977('0x41')](_0x5cb7ac)[_0x1977('0x21')](handleEntityNotFound(_0x4c8348,null))[_0x1977('0x21')](respondWithResult(_0x4c8348,null))['catch'](handleError(_0x4c8348,null));};exports[_0x1977('0x42')]=function(_0x49860d,_0x51396f){return db[_0x1977('0x3a')][_0x1977('0x42')](_0x49860d[_0x1977('0x43')],{})[_0x1977('0x21')](respondWithResult(_0x51396f,0xc9))[_0x1977('0x3f')](handleError(_0x51396f,null));};exports['update']=function(_0x105357,_0x3464e8){if(_0x105357[_0x1977('0x43')]['id']){delete _0x105357[_0x1977('0x43')]['id'];}return db[_0x1977('0x3a')][_0x1977('0x41')]({'where':{'id':_0x105357['params']['id']}})[_0x1977('0x21')](handleEntityNotFound(_0x3464e8,null))[_0x1977('0x21')](saveUpdates(_0x105357['body'],null))[_0x1977('0x21')](respondWithResult(_0x3464e8,null))[_0x1977('0x3f')](handleError(_0x3464e8,null));};exports['destroy']=function(_0x437caa,_0x3b9681){return db[_0x1977('0x3a')][_0x1977('0x41')]({'where':{'id':_0x437caa['params']['id']}})[_0x1977('0x21')](handleEntityNotFound(_0x3b9681,null))['then'](removeEntity(_0x3b9681,null))[_0x1977('0x3f')](handleError(_0x3b9681,null));};exports[_0x1977('0x44')]=function(_0x25e6d1,_0x28a26f,_0x59eefa){var _0x1dedab={};var _0x23a1e6={};var _0x1bda1a;var _0x5ffa7b;return db['ServicenowConfiguration'][_0x1977('0x45')]({'where':{'id':_0x25e6d1[_0x1977('0x46')]['id']}})['then'](handleEntityNotFound(_0x28a26f,null))[_0x1977('0x21')](function(_0x588c87){if(_0x588c87){_0x1bda1a=_0x588c87;_0x23a1e6[_0x1977('0x29')]=_[_0x1977('0x2b')](db['ServicenowField'][_0x1977('0x25')]);_0x23a1e6[_0x1977('0x2c')]=_[_0x1977('0x2b')](_0x25e6d1[_0x1977('0x2c')]);_0x23a1e6[_0x1977('0x2d')]=_[_0x1977('0x2e')](_0x23a1e6[_0x1977('0x29')],_0x23a1e6[_0x1977('0x2c')]);_0x1dedab[_0x1977('0x2f')]=_[_0x1977('0x2e')](_0x23a1e6[_0x1977('0x29')],qs[_0x1977('0x30')](_0x25e6d1[_0x1977('0x2c')][_0x1977('0x30')]));_0x1dedab[_0x1977('0x2f')]=_0x1dedab['attributes'][_0x1977('0x31')]?_0x1dedab[_0x1977('0x2f')]:_0x23a1e6['model'];_0x1dedab[_0x1977('0x34')]=qs[_0x1977('0x35')](_0x25e6d1[_0x1977('0x2c')]['sort']);_0x1dedab[_0x1977('0x36')]=qs[_0x1977('0x2d')](_[_0x1977('0x47')](_0x25e6d1[_0x1977('0x2c')],_0x23a1e6[_0x1977('0x2d')]));if(_0x25e6d1[_0x1977('0x2c')][_0x1977('0x37')]){_0x1dedab[_0x1977('0x36')]=_[_0x1977('0x38')](_0x1dedab[_0x1977('0x36')],{'$or':_[_0x1977('0x24')](_0x1dedab[_0x1977('0x2f')],function(_0x238c25){var _0x3fcc34={};_0x3fcc34[_0x238c25]={'$like':'%'+_0x25e6d1[_0x1977('0x2c')][_0x1977('0x37')]+'%'};return _0x3fcc34;})});}_0x1dedab=_[_0x1977('0x38')]({},_0x1dedab,_0x25e6d1[_0x1977('0x39')]);return _0x1bda1a[_0x1977('0x44')](_0x1dedab);}})[_0x1977('0x21')](function(_0x586dd0){if(_0x586dd0){_0x5ffa7b=_0x586dd0[_0x1977('0x31')];if(!_0x25e6d1[_0x1977('0x2c')]['hasOwnProperty'](_0x1977('0x33'))){_0x1dedab[_0x1977('0x17')]=qs[_0x1977('0x17')](_0x25e6d1[_0x1977('0x2c')][_0x1977('0x17')]);_0x1dedab[_0x1977('0x1a')]=qs[_0x1977('0x1a')](_0x25e6d1[_0x1977('0x2c')][_0x1977('0x1a')]);}return _0x1bda1a['getFields'](_0x1dedab);}})[_0x1977('0x21')](function(_0x25defe){if(_0x25defe){return _0x25defe?{'count':_0x5ffa7b,'rows':_0x25defe}:null;}})[_0x1977('0x21')](respondWithResult(_0x28a26f,null))[_0x1977('0x3f')](handleError(_0x28a26f,null));};exports['getSubjects']=function(_0x2c5518,_0x3282ec,_0x3c9251){var _0x420425={};var _0x655782={};var _0x59cb85;var _0x32a96e;return db[_0x1977('0x3a')][_0x1977('0x45')]({'where':{'id':_0x2c5518[_0x1977('0x46')]['id']}})[_0x1977('0x21')](handleEntityNotFound(_0x3282ec,null))[_0x1977('0x21')](function(_0x21c0f3){if(_0x21c0f3){_0x59cb85=_0x21c0f3;_0x655782[_0x1977('0x29')]=_['keys'](db[_0x1977('0x48')][_0x1977('0x25')]);_0x655782['query']=_[_0x1977('0x2b')](_0x2c5518[_0x1977('0x2c')]);_0x655782[_0x1977('0x2d')]=_[_0x1977('0x2e')](_0x655782[_0x1977('0x29')],_0x655782['query']);_0x420425['attributes']=_['intersection'](_0x655782[_0x1977('0x29')],qs['fields'](_0x2c5518[_0x1977('0x2c')][_0x1977('0x30')]));_0x420425[_0x1977('0x2f')]=_0x420425['attributes'][_0x1977('0x31')]?_0x420425['attributes']:_0x655782['model'];_0x420425[_0x1977('0x34')]=qs[_0x1977('0x35')](_0x2c5518[_0x1977('0x2c')][_0x1977('0x35')]);_0x420425['where']=qs[_0x1977('0x2d')](_[_0x1977('0x47')](_0x2c5518[_0x1977('0x2c')],_0x655782[_0x1977('0x2d')]));if(_0x2c5518['query']['filter']){_0x420425['where']=_[_0x1977('0x38')](_0x420425[_0x1977('0x36')],{'$or':_[_0x1977('0x24')](_0x420425[_0x1977('0x2f')],function(_0x369dee){var _0x2b450c={};_0x2b450c[_0x369dee]={'$like':'%'+_0x2c5518[_0x1977('0x2c')]['filter']+'%'};return _0x2b450c;})});}_0x420425=_[_0x1977('0x38')]({},_0x420425,_0x2c5518[_0x1977('0x39')]);return _0x59cb85['getSubjects'](_0x420425);}})[_0x1977('0x21')](function(_0x452dba){if(_0x452dba){_0x32a96e=_0x452dba[_0x1977('0x31')];if(!_0x2c5518[_0x1977('0x2c')]['hasOwnProperty'](_0x1977('0x33'))){_0x420425['limit']=qs[_0x1977('0x17')](_0x2c5518[_0x1977('0x2c')]['limit']);_0x420425[_0x1977('0x1a')]=qs[_0x1977('0x1a')](_0x2c5518[_0x1977('0x2c')][_0x1977('0x1a')]);}return _0x59cb85['getSubjects'](_0x420425);}})[_0x1977('0x21')](function(_0x2f07f8){if(_0x2f07f8){return _0x2f07f8?{'count':_0x32a96e,'rows':_0x2f07f8}:null;}})[_0x1977('0x21')](respondWithResult(_0x3282ec,null))[_0x1977('0x3f')](handleError(_0x3282ec,null));};exports[_0x1977('0x49')]=function(_0x3037f6,_0x2bc44b,_0x57bb25){var _0x5df1d1={};var _0x594e11={};var _0x324204;var _0x516f52;return db[_0x1977('0x3a')][_0x1977('0x45')]({'where':{'id':_0x3037f6[_0x1977('0x46')]['id']}})[_0x1977('0x21')](handleEntityNotFound(_0x2bc44b,null))[_0x1977('0x21')](function(_0x4415e2){if(_0x4415e2){_0x324204=_0x4415e2;_0x594e11[_0x1977('0x29')]=_[_0x1977('0x2b')](db['ServicenowField'][_0x1977('0x25')]);_0x594e11[_0x1977('0x2c')]=_['keys'](_0x3037f6['query']);_0x594e11['filters']=_['intersection'](_0x594e11[_0x1977('0x29')],_0x594e11[_0x1977('0x2c')]);_0x5df1d1[_0x1977('0x2f')]=_[_0x1977('0x2e')](_0x594e11[_0x1977('0x29')],qs['fields'](_0x3037f6[_0x1977('0x2c')]['fields']));_0x5df1d1['attributes']=_0x5df1d1[_0x1977('0x2f')][_0x1977('0x31')]?_0x5df1d1['attributes']:_0x594e11[_0x1977('0x29')];_0x5df1d1[_0x1977('0x34')]=qs[_0x1977('0x35')](_0x3037f6[_0x1977('0x2c')]['sort']);_0x5df1d1[_0x1977('0x36')]=qs[_0x1977('0x2d')](_[_0x1977('0x47')](_0x3037f6[_0x1977('0x2c')],_0x594e11[_0x1977('0x2d')]));if(_0x3037f6[_0x1977('0x2c')][_0x1977('0x37')]){_0x5df1d1[_0x1977('0x36')]=_[_0x1977('0x38')](_0x5df1d1['where'],{'$or':_[_0x1977('0x24')](_0x5df1d1[_0x1977('0x2f')],function(_0x3f2cf6){var _0x5abe8b={};_0x5abe8b[_0x3f2cf6]={'$like':'%'+_0x3037f6[_0x1977('0x2c')][_0x1977('0x37')]+'%'};return _0x5abe8b;})});}_0x5df1d1=_[_0x1977('0x38')]({},_0x5df1d1,_0x3037f6[_0x1977('0x39')]);return _0x324204[_0x1977('0x49')](_0x5df1d1);}})['then'](function(_0x61d8db){if(_0x61d8db){_0x516f52=_0x61d8db[_0x1977('0x31')];if(!_0x3037f6['query'][_0x1977('0x32')]('nolimit')){_0x5df1d1[_0x1977('0x17')]=qs[_0x1977('0x17')](_0x3037f6[_0x1977('0x2c')]['limit']);_0x5df1d1['offset']=qs[_0x1977('0x1a')](_0x3037f6['query'][_0x1977('0x1a')]);}return _0x324204[_0x1977('0x49')](_0x5df1d1);}})[_0x1977('0x21')](function(_0x34a043){if(_0x34a043){return _0x34a043?{'count':_0x516f52,'rows':_0x34a043}:null;}})[_0x1977('0x21')](respondWithResult(_0x2bc44b,null))[_0x1977('0x3f')](handleError(_0x2bc44b,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index a406a66..5c0371a 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 _0x61d0=['rimraf','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api','bluebird','path'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x61d0,0x187));var _0x061d=function(_0x16051a,_0x5e4326){_0x16051a=_0x16051a-0x0;var _0x35d20d=_0x61d0[_0x16051a];return _0x35d20d;};'use strict';var _=require(_0x061d('0x0'));var util=require('util');var logger=require(_0x061d('0x1'))(_0x061d('0x2'));var moment=require('moment');var BPromise=require(_0x061d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x061d('0x4'));var rimraf=require(_0x061d('0x5'));var config=require('../../config/environment');var attributes=require(_0x061d('0x6'));module[_0x061d('0x7')]=function(_0x14e976,_0x255478){return _0x14e976[_0x061d('0x8')](_0x061d('0x9'),attributes,{'tableName':_0x061d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcaa3=['bluebird','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x371ac7,_0x585639){var _0x10f5f2=function(_0x481e52){while(--_0x481e52){_0x371ac7['push'](_0x371ac7['shift']());}};_0x10f5f2(++_0x585639);}(_0xcaa3,0xcb));var _0x3caa=function(_0x513f27,_0x1cbc87){_0x513f27=_0x513f27-0x0;var _0xa316b7=_0xcaa3[_0x513f27];return _0xa316b7;};'use strict';var _=require(_0x3caa('0x0'));var util=require(_0x3caa('0x1'));var logger=require(_0x3caa('0x2'))(_0x3caa('0x3'));var moment=require(_0x3caa('0x4'));var BPromise=require(_0x3caa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3caa('0x6'));var config=require(_0x3caa('0x7'));var attributes=require(_0x3caa('0x8'));module[_0x3caa('0x9')]=function(_0x171c56,_0x54ba79){return _0x171c56[_0x3caa('0xa')](_0x3caa('0xb'),attributes,{'tableName':_0x3caa('0xc'),'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 c7e3855..b0ca7a8 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 _0x7beb=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','catch','moment'];(function(_0x195c21,_0x332612){var _0x3576a8=function(_0xa4bde2){while(--_0xa4bde2){_0x195c21['push'](_0x195c21['shift']());}};_0x3576a8(++_0x332612);}(_0x7beb,0xc5));var _0xb7be=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7beb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb7be('0x0'));var BPromise=require(_0xb7be('0x1'));var rs=require(_0xb7be('0x2'));var fs=require('fs');var Redis=require(_0xb7be('0x3'));var db=require(_0xb7be('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb7be('0x5'))(_0xb7be('0x6'));var config=require(_0xb7be('0x7'));var jayson=require(_0xb7be('0x8'));var client=jayson[_0xb7be('0x9')][_0xb7be('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x190537,_0x5e9373,_0x321537){return new BPromise(function(_0x3fa9ba,_0x1f265c){return client[_0xb7be('0xb')](_0x190537,_0x321537)[_0xb7be('0xc')](function(_0x3bd76f){logger[_0xb7be('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5e9373,_0xb7be('0xe'));logger[_0xb7be('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x5e9373,_0xb7be('0xe'),JSON[_0xb7be('0x10')](_0x3bd76f));if(_0x3bd76f[_0xb7be('0x11')]){if(_0x3bd76f[_0xb7be('0x11')][_0xb7be('0x12')]===0x1f4){logger[_0xb7be('0x11')](_0xb7be('0x13'),_0x5e9373,_0x3bd76f[_0xb7be('0x11')][_0xb7be('0x14')]);return _0x1f265c(_0x3bd76f[_0xb7be('0x11')][_0xb7be('0x14')]);}logger['error'](_0xb7be('0x13'),_0x5e9373,_0x3bd76f[_0xb7be('0x11')]['message']);return _0x3fa9ba(_0x3bd76f[_0xb7be('0x11')][_0xb7be('0x14')]);}else{logger['info'](_0xb7be('0x13'),_0x5e9373,_0xb7be('0xe'));_0x3fa9ba(_0x3bd76f['result'][_0xb7be('0x14')]);}})[_0xb7be('0x15')](function(_0x2ec12b){logger[_0xb7be('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5e9373,_0x2ec12b);_0x1f265c(_0x2ec12b);});});} \ No newline at end of file +var _0x61a0=['message','result','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x61a0,0xf4));var _0x061a=function(_0x4318de,_0x32e804){_0x4318de=_0x4318de-0x0;var _0x57b497=_0x61a0[_0x4318de];return _0x57b497;};'use strict';var _=require('lodash');var util=require(_0x061a('0x0'));var moment=require(_0x061a('0x1'));var BPromise=require(_0x061a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x061a('0x3'))['db'];var utils=require(_0x061a('0x4'));var logger=require(_0x061a('0x5'))(_0x061a('0x6'));var config=require(_0x061a('0x7'));var jayson=require(_0x061a('0x8'));var client=jayson[_0x061a('0x9')][_0x061a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x420880,_0x15917d,_0x400505){return new BPromise(function(_0x19f3e8,_0x511da2){return client[_0x061a('0xb')](_0x420880,_0x400505)['then'](function(_0x2fa46a){logger[_0x061a('0xc')](_0x061a('0xd'),_0x15917d,_0x061a('0xe'));logger[_0x061a('0xf')](_0x061a('0x10'),_0x15917d,_0x061a('0xe'),JSON[_0x061a('0x11')](_0x2fa46a));if(_0x2fa46a[_0x061a('0x12')]){if(_0x2fa46a[_0x061a('0x12')][_0x061a('0x13')]===0x1f4){logger['error'](_0x061a('0xd'),_0x15917d,_0x2fa46a[_0x061a('0x12')][_0x061a('0x14')]);return _0x511da2(_0x2fa46a[_0x061a('0x12')][_0x061a('0x14')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x15917d,_0x2fa46a['error']['message']);return _0x19f3e8(_0x2fa46a[_0x061a('0x12')][_0x061a('0x14')]);}else{logger['info'](_0x061a('0xd'),_0x15917d,'request\x20sent');_0x19f3e8(_0x2fa46a[_0x061a('0x15')][_0x061a('0x14')]);}})['catch'](function(_0x567280){logger[_0x061a('0x12')](_0x061a('0xd'),_0x15917d,_0x567280);_0x511da2(_0x567280);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index c688e96..375d12f 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 _0x3809=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','show','post','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3809,0x17f));var _0x9380=function(_0xd1ba2c,_0xb597e0){_0xd1ba2c=_0xd1ba2c-0x0;var _0x3c9194=_0x3809[_0xd1ba2c];return _0x3c9194;};'use strict';var multer=require(_0x9380('0x0'));var util=require(_0x9380('0x1'));var path=require(_0x9380('0x2'));var timeout=require(_0x9380('0x3'));var express=require(_0x9380('0x4'));var router=express[_0x9380('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9380('0x6'));var interaction=require(_0x9380('0x7'));var config=require(_0x9380('0x8'));var controller=require(_0x9380('0x9'));router[_0x9380('0xa')]('/',auth[_0x9380('0xb')](),controller[_0x9380('0xc')]);router[_0x9380('0xa')]('/:id',auth[_0x9380('0xb')](),controller[_0x9380('0xd')]);router[_0x9380('0xe')]('/',auth[_0x9380('0xb')](),controller['create']);router[_0x9380('0xf')](_0x9380('0x10'),auth['isAuthenticated'](),controller[_0x9380('0x11')]);router[_0x9380('0x12')](_0x9380('0x10'),auth[_0x9380('0xb')](),controller[_0x9380('0x13')]);module[_0x9380('0x14')]=router; \ No newline at end of file +var _0x185a=['/:id','post','create','put','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','get'];(function(_0x4276e1,_0x547409){var _0x55cc5c=function(_0x1f0867){while(--_0x1f0867){_0x4276e1['push'](_0x4276e1['shift']());}};_0x55cc5c(++_0x547409);}(_0x185a,0x1e1));var _0xa185=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x185a[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require(_0xa185('0x0'));var path=require(_0xa185('0x1'));var timeout=require(_0xa185('0x2'));var express=require(_0xa185('0x3'));var router=express[_0xa185('0x4')]();var fs_extra=require(_0xa185('0x5'));var auth=require(_0xa185('0x6'));var interaction=require(_0xa185('0x7'));var config=require(_0xa185('0x8'));var controller=require(_0xa185('0x9'));router['get']('/',auth[_0xa185('0xa')](),controller[_0xa185('0xb')]);router[_0xa185('0xc')](_0xa185('0xd'),auth[_0xa185('0xa')](),controller['show']);router[_0xa185('0xe')]('/',auth['isAuthenticated'](),controller[_0xa185('0xf')]);router[_0xa185('0x10')](_0xa185('0xd'),auth[_0xa185('0xa')](),controller['update']);router['delete'](_0xa185('0xd'),auth[_0xa185('0xa')](),controller[_0xa185('0x11')]);module[_0xa185('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index bcac9dc..3f7769d 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 _0x046b=['exports','ENUM','string','variable','keyValue','STRING','customVariable','BOOLEAN','sequelize'];(function(_0xf20abf,_0x4d84d9){var _0x595ecc=function(_0x3c9371){while(--_0x3c9371){_0xf20abf['push'](_0xf20abf['shift']());}};_0x595ecc(++_0x4d84d9);}(_0x046b,0x1dc));var _0xb046=function(_0x20c7f9,_0x1460d5){_0x20c7f9=_0x20c7f9-0x0;var _0x304481=_0x046b[_0x20c7f9];return _0x304481;};'use strict';var Sequelize=require(_0xb046('0x0'));module[_0xb046('0x1')]={'type':{'type':Sequelize[_0xb046('0x2')](_0xb046('0x3'),_0xb046('0x4'),'customVariable',_0xb046('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xb046('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb046('0x2')](_0xb046('0x3'),_0xb046('0x4'),_0xb046('0x7'))},'keyContent':{'type':Sequelize[_0xb046('0x6')]},'idField':{'type':Sequelize[_0xb046('0x6')]},'nameField':{'type':Sequelize[_0xb046('0x6')]},'customField':{'type':Sequelize[_0xb046('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb046('0x6')]}}; \ No newline at end of file +var _0x46d0=['ENUM','customVariable','keyValue','picklist','STRING','string','variable','BOOLEAN','sequelize','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x46d0,0x1ac));var _0x046d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x46d0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x046d('0x0'));module[_0x046d('0x1')]={'type':{'type':Sequelize[_0x046d('0x2')]('string','variable',_0x046d('0x3'),_0x046d('0x4'),_0x046d('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x046d('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x046d('0x7'),_0x046d('0x8'),_0x046d('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x046d('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x046d('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x046d('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 2c94dfb..895a7af 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 _0x054c=['apply','save','update','then','destroy','end','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','keys','query','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x054c,0x154));var _0xc054=function(_0x1318f5,_0x1ace99){_0x1318f5=_0x1318f5-0x0;var _0x58296a=_0x054c[_0x1318f5];return _0x58296a;};'use strict';var emlformat=require(_0xc054('0x0'));var rimraf=require(_0xc054('0x1'));var zipdir=require(_0xc054('0x2'));var jsonpatch=require(_0xc054('0x3'));var rp=require(_0xc054('0x4'));var moment=require(_0xc054('0x5'));var BPromise=require(_0xc054('0x6'));var Mustache=require('mustache');var util=require(_0xc054('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xc054('0x8'));var ejs=require(_0xc054('0x9'));var fs=require('fs');var fs_extra=require(_0xc054('0xa'));var _=require('lodash');var squel=require(_0xc054('0xb'));var crypto=require(_0xc054('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc054('0x8'));var querystring=require('querystring');var Papa=require(_0xc054('0xd'));var Redis=require(_0xc054('0xe'));var authService=require(_0xc054('0xf'));var qs=require(_0xc054('0x10'));var as=require(_0xc054('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc054('0x12'))('api');var utils=require(_0xc054('0x13'));var config=require(_0xc054('0x14'));var licenseUtil=require(_0xc054('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bc832,_0xb0029b){_0xb0029b=_0xb0029b||0xcc;return function(_0x1d9f95){if(_0x1d9f95){return _0x4bc832[_0xc054('0x16')](_0xb0029b);}return _0x4bc832[_0xc054('0x17')](_0xb0029b)['end']();};}function respondWithResult(_0x5dd5a2,_0x427545){_0x427545=_0x427545||0xc8;return function(_0x31e3bf){if(_0x31e3bf){return _0x5dd5a2[_0xc054('0x17')](_0x427545)[_0xc054('0x18')](_0x31e3bf);}};}function respondWithFilteredResult(_0x22fa8a,_0x5f0937){return function(_0x5c46cc){if(_0x5c46cc){var _0x4240b0=typeof _0x5f0937['offset']===_0xc054('0x19')&&typeof _0x5f0937[_0xc054('0x1a')]===_0xc054('0x19');var _0x3491c0=_0x5c46cc[_0xc054('0x1b')];var _0x29a129=_0x4240b0?0x0:_0x5f0937[_0xc054('0x1c')];var _0x534ad8=_0x4240b0?_0x5c46cc[_0xc054('0x1b')]:_0x5f0937[_0xc054('0x1c')]+_0x5f0937[_0xc054('0x1a')];var _0x4e23d9;if(_0x534ad8>=_0x3491c0){_0x534ad8=_0x3491c0;_0x4e23d9=0xc8;}else{_0x4e23d9=0xce;}_0x22fa8a[_0xc054('0x17')](_0x4e23d9);return _0x22fa8a['set'](_0xc054('0x1d'),_0x29a129+'-'+_0x534ad8+'/'+_0x3491c0)['json'](_0x5c46cc);}return null;};}function patchUpdates(_0x2c684b){return function(_0x1b35db){try{jsonpatch[_0xc054('0x1e')](_0x1b35db,_0x2c684b,!![]);}catch(_0x3b3e3c){return BPromise['reject'](_0x3b3e3c);}return _0x1b35db[_0xc054('0x1f')]();};}function saveUpdates(_0x38c9f1,_0x35ac9a){return function(_0x2037fc){if(_0x2037fc){return _0x2037fc[_0xc054('0x20')](_0x38c9f1)[_0xc054('0x21')](function(_0xb673c3){return _0xb673c3;});}return null;};}function removeEntity(_0x1ed335,_0x4e2df1){return function(_0x23fce6){if(_0x23fce6){return _0x23fce6[_0xc054('0x22')]()[_0xc054('0x21')](function(){_0x1ed335[_0xc054('0x17')](0xcc)[_0xc054('0x23')]();});}};}function handleEntityNotFound(_0x33ea49,_0x48aa9a){return function(_0xcb3663){if(!_0xcb3663){_0x33ea49[_0xc054('0x16')](0x194);}return _0xcb3663;};}function handleError(_0x5f2bef,_0x2c1568){_0x2c1568=_0x2c1568||0x1f4;return function(_0x16f1e7){logger[_0xc054('0x24')](_0x16f1e7[_0xc054('0x25')]);if(_0x16f1e7['name']){delete _0x16f1e7[_0xc054('0x26')];}_0x5f2bef[_0xc054('0x17')](_0x2c1568)[_0xc054('0x27')](_0x16f1e7);};}exports[_0xc054('0x28')]=function(_0xd6da39,_0x32ed90){var _0x4dc079={},_0xdb6a94={},_0x2d3bc6={'count':0x0,'rows':[]};var _0x4c7185=_[_0xc054('0x29')](db[_0xc054('0x2a')][_0xc054('0x2b')],function(_0x22f9c9){return{'name':_0x22f9c9[_0xc054('0x2c')],'type':_0x22f9c9[_0xc054('0x2d')][_0xc054('0x2e')]};});_0xdb6a94[_0xc054('0x2f')]=_['map'](_0x4c7185,_0xc054('0x26'));_0xdb6a94['query']=_[_0xc054('0x30')](_0xd6da39[_0xc054('0x31')]);_0xdb6a94['filters']=_['intersection'](_0xdb6a94[_0xc054('0x2f')],_0xdb6a94[_0xc054('0x31')]);_0x4dc079['attributes']=_['intersection'](_0xdb6a94['model'],qs[_0xc054('0x32')](_0xd6da39[_0xc054('0x31')][_0xc054('0x32')]));_0x4dc079['attributes']=_0x4dc079['attributes'][_0xc054('0x33')]?_0x4dc079[_0xc054('0x34')]:_0xdb6a94[_0xc054('0x2f')];if(!_0xd6da39['query'][_0xc054('0x35')](_0xc054('0x36'))){_0x4dc079['limit']=qs['limit'](_0xd6da39[_0xc054('0x31')][_0xc054('0x1a')]);_0x4dc079[_0xc054('0x1c')]=qs[_0xc054('0x1c')](_0xd6da39[_0xc054('0x31')]['offset']);}_0x4dc079[_0xc054('0x37')]=qs[_0xc054('0x38')](_0xd6da39[_0xc054('0x31')][_0xc054('0x38')]);_0x4dc079[_0xc054('0x39')]=qs[_0xc054('0x3a')](_[_0xc054('0x3b')](_0xd6da39[_0xc054('0x31')],_0xdb6a94[_0xc054('0x3a')]),_0x4c7185);if(_0xd6da39[_0xc054('0x31')][_0xc054('0x3c')]){_0x4dc079[_0xc054('0x39')]=_[_0xc054('0x3d')](_0x4dc079[_0xc054('0x39')],{'$or':_[_0xc054('0x29')](_0x4c7185,function(_0x8ba851){if(_0x8ba851[_0xc054('0x2d')]!==_0xc054('0x3e')){var _0x3da7d3={};_0x3da7d3[_0x8ba851[_0xc054('0x26')]]={'$like':'%'+_0xd6da39[_0xc054('0x31')][_0xc054('0x3c')]+'%'};return _0x3da7d3;}})});}_0x4dc079=_[_0xc054('0x3d')]({},_0x4dc079,_0xd6da39[_0xc054('0x3f')]);var _0x3e728a={'where':_0x4dc079[_0xc054('0x39')]};return db['ServicenowField'][_0xc054('0x1b')](_0x3e728a)['then'](function(_0xbcc755){_0x2d3bc6[_0xc054('0x1b')]=_0xbcc755;if(_0xd6da39[_0xc054('0x31')][_0xc054('0x40')]){_0x4dc079[_0xc054('0x41')]=[{'all':!![]}];}return db[_0xc054('0x2a')][_0xc054('0x42')](_0x4dc079);})[_0xc054('0x21')](function(_0x1ff45f){_0x2d3bc6[_0xc054('0x43')]=_0x1ff45f;return _0x2d3bc6;})[_0xc054('0x21')](respondWithFilteredResult(_0x32ed90,_0x4dc079))[_0xc054('0x44')](handleError(_0x32ed90,null));};exports[_0xc054('0x45')]=function(_0x4197ca,_0x23834c){var _0x87f801={'raw':!![],'where':{'id':_0x4197ca[_0xc054('0x46')]['id']}},_0x21881d={};_0x21881d[_0xc054('0x2f')]=_['keys'](db[_0xc054('0x2a')][_0xc054('0x2b')]);_0x21881d[_0xc054('0x31')]=_[_0xc054('0x30')](_0x4197ca['query']);_0x21881d[_0xc054('0x3a')]=_[_0xc054('0x47')](_0x21881d[_0xc054('0x2f')],_0x21881d[_0xc054('0x31')]);_0x87f801[_0xc054('0x34')]=_['intersection'](_0x21881d[_0xc054('0x2f')],qs[_0xc054('0x32')](_0x4197ca[_0xc054('0x31')][_0xc054('0x32')]));_0x87f801[_0xc054('0x34')]=_0x87f801['attributes']['length']?_0x87f801[_0xc054('0x34')]:_0x21881d[_0xc054('0x2f')];if(_0x4197ca['query']['includeAll']){_0x87f801['include']=[{'all':!![]}];}_0x87f801=_[_0xc054('0x3d')]({},_0x87f801,_0x4197ca['options']);return db[_0xc054('0x2a')]['find'](_0x87f801)[_0xc054('0x21')](handleEntityNotFound(_0x23834c,null))[_0xc054('0x21')](respondWithResult(_0x23834c,null))[_0xc054('0x44')](handleError(_0x23834c,null));};exports['create']=function(_0x3db9b2,_0x136513){return db[_0xc054('0x2a')]['create'](_0x3db9b2['body'],{})[_0xc054('0x21')](respondWithResult(_0x136513,0xc9))[_0xc054('0x44')](handleError(_0x136513,null));};exports['update']=function(_0x2324de,_0xf75210){if(_0x2324de[_0xc054('0x48')]['id']){delete _0x2324de[_0xc054('0x48')]['id'];}return db[_0xc054('0x2a')]['find']({'where':{'id':_0x2324de['params']['id']}})['then'](handleEntityNotFound(_0xf75210,null))['then'](saveUpdates(_0x2324de[_0xc054('0x48')],null))[_0xc054('0x21')](respondWithResult(_0xf75210,null))[_0xc054('0x44')](handleError(_0xf75210,null));};exports[_0xc054('0x22')]=function(_0x14bb3d,_0x37b86e){return db[_0xc054('0x2a')][_0xc054('0x49')]({'where':{'id':_0x14bb3d[_0xc054('0x46')]['id']}})[_0xc054('0x21')](handleEntityNotFound(_0x37b86e,null))[_0xc054('0x21')](removeEntity(_0x37b86e,null))['catch'](handleError(_0x37b86e,null));}; \ No newline at end of file +var _0xb095=['index','map','ServicenowField','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','name','options','include','rows','catch','show','params','keys','length','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','send'];(function(_0x2944a3,_0x4a2ce5){var _0x537225=function(_0x4f1f9e){while(--_0x4f1f9e){_0x2944a3['push'](_0x2944a3['shift']());}};_0x537225(++_0x4a2ce5);}(_0xb095,0x144));var _0x5b09=function(_0x2e6950,_0x5baa90){_0x2e6950=_0x2e6950-0x0;var _0x1e0ff2=_0xb095[_0x2e6950];return _0x1e0ff2;};'use strict';var emlformat=require(_0x5b09('0x0'));var rimraf=require(_0x5b09('0x1'));var zipdir=require(_0x5b09('0x2'));var jsonpatch=require(_0x5b09('0x3'));var rp=require(_0x5b09('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5b09('0x5'));var util=require(_0x5b09('0x6'));var path=require(_0x5b09('0x7'));var sox=require(_0x5b09('0x8'));var csv=require(_0x5b09('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5b09('0xa'));var squel=require(_0x5b09('0xb'));var crypto=require(_0x5b09('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5b09('0xd'));var toCsv=require(_0x5b09('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5b09('0xe'));var qs=require(_0x5b09('0xf'));var as=require(_0x5b09('0x10'));var hardwareService=require(_0x5b09('0x11'));var logger=require(_0x5b09('0x12'))(_0x5b09('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5b09('0x14'));var db=require(_0x5b09('0x15'))['db'];function respondWithStatusCode(_0x49d172,_0x22f0ff){_0x22f0ff=_0x22f0ff||0xcc;return function(_0x3644e2){if(_0x3644e2){return _0x49d172[_0x5b09('0x16')](_0x22f0ff);}return _0x49d172[_0x5b09('0x17')](_0x22f0ff)['end']();};}function respondWithResult(_0x3eaa95,_0x452d6a){_0x452d6a=_0x452d6a||0xc8;return function(_0x979cb5){if(_0x979cb5){return _0x3eaa95[_0x5b09('0x17')](_0x452d6a)[_0x5b09('0x18')](_0x979cb5);}};}function respondWithFilteredResult(_0x582a1e,_0x18b638){return function(_0x31be1a){if(_0x31be1a){var _0x31266e=typeof _0x18b638[_0x5b09('0x19')]==='undefined'&&typeof _0x18b638[_0x5b09('0x1a')]===_0x5b09('0x1b');var _0x421951=_0x31be1a[_0x5b09('0x1c')];var _0x467f26=_0x31266e?0x0:_0x18b638[_0x5b09('0x19')];var _0x40fcbe=_0x31266e?_0x31be1a[_0x5b09('0x1c')]:_0x18b638[_0x5b09('0x19')]+_0x18b638[_0x5b09('0x1a')];var _0x59cf7d;if(_0x40fcbe>=_0x421951){_0x40fcbe=_0x421951;_0x59cf7d=0xc8;}else{_0x59cf7d=0xce;}_0x582a1e[_0x5b09('0x17')](_0x59cf7d);return _0x582a1e[_0x5b09('0x1d')](_0x5b09('0x1e'),_0x467f26+'-'+_0x40fcbe+'/'+_0x421951)[_0x5b09('0x18')](_0x31be1a);}return null;};}function patchUpdates(_0x461e07){return function(_0x43a537){try{jsonpatch[_0x5b09('0x1f')](_0x43a537,_0x461e07,!![]);}catch(_0xb345c1){return BPromise[_0x5b09('0x20')](_0xb345c1);}return _0x43a537[_0x5b09('0x21')]();};}function saveUpdates(_0x4404f3,_0x4a6fe6){return function(_0x1fe434){if(_0x1fe434){return _0x1fe434[_0x5b09('0x22')](_0x4404f3)['then'](function(_0xe3a960){return _0xe3a960;});}return null;};}function removeEntity(_0xc6a82,_0x173d33){return function(_0x54f97e){if(_0x54f97e){return _0x54f97e[_0x5b09('0x23')]()[_0x5b09('0x24')](function(){_0xc6a82[_0x5b09('0x17')](0xcc)[_0x5b09('0x25')]();});}};}function handleEntityNotFound(_0x1283ba,_0xe38523){return function(_0x37bd02){if(!_0x37bd02){_0x1283ba[_0x5b09('0x16')](0x194);}return _0x37bd02;};}function handleError(_0x116828,_0x496a5e){_0x496a5e=_0x496a5e||0x1f4;return function(_0x3f6b7a){logger[_0x5b09('0x26')](_0x3f6b7a[_0x5b09('0x27')]);if(_0x3f6b7a['name']){delete _0x3f6b7a['name'];}_0x116828[_0x5b09('0x17')](_0x496a5e)[_0x5b09('0x28')](_0x3f6b7a);};}exports[_0x5b09('0x29')]=function(_0x3fb58b,_0x19d2d3){var _0x2b200c={},_0x3fa685={},_0x1d2dd2={'count':0x0,'rows':[]};var _0x3997f3=_[_0x5b09('0x2a')](db[_0x5b09('0x2b')][_0x5b09('0x2c')],function(_0x41ceab){return{'name':_0x41ceab[_0x5b09('0x2d')],'type':_0x41ceab['type'][_0x5b09('0x2e')]};});_0x3fa685[_0x5b09('0x2f')]=_[_0x5b09('0x2a')](_0x3997f3,'name');_0x3fa685[_0x5b09('0x30')]=_['keys'](_0x3fb58b[_0x5b09('0x30')]);_0x3fa685[_0x5b09('0x31')]=_[_0x5b09('0x32')](_0x3fa685[_0x5b09('0x2f')],_0x3fa685[_0x5b09('0x30')]);_0x2b200c['attributes']=_[_0x5b09('0x32')](_0x3fa685[_0x5b09('0x2f')],qs[_0x5b09('0x33')](_0x3fb58b['query'][_0x5b09('0x33')]));_0x2b200c[_0x5b09('0x34')]=_0x2b200c[_0x5b09('0x34')]['length']?_0x2b200c['attributes']:_0x3fa685[_0x5b09('0x2f')];if(!_0x3fb58b[_0x5b09('0x30')][_0x5b09('0x35')](_0x5b09('0x36'))){_0x2b200c[_0x5b09('0x1a')]=qs['limit'](_0x3fb58b[_0x5b09('0x30')]['limit']);_0x2b200c[_0x5b09('0x19')]=qs[_0x5b09('0x19')](_0x3fb58b[_0x5b09('0x30')][_0x5b09('0x19')]);}_0x2b200c[_0x5b09('0x37')]=qs[_0x5b09('0x38')](_0x3fb58b[_0x5b09('0x30')][_0x5b09('0x38')]);_0x2b200c[_0x5b09('0x39')]=qs[_0x5b09('0x31')](_['pick'](_0x3fb58b[_0x5b09('0x30')],_0x3fa685[_0x5b09('0x31')]),_0x3997f3);if(_0x3fb58b[_0x5b09('0x30')][_0x5b09('0x3a')]){_0x2b200c['where']=_[_0x5b09('0x3b')](_0x2b200c[_0x5b09('0x39')],{'$or':_[_0x5b09('0x2a')](_0x3997f3,function(_0x1516c6){if(_0x1516c6['type']!=='VIRTUAL'){var _0x43a630={};_0x43a630[_0x1516c6[_0x5b09('0x3c')]]={'$like':'%'+_0x3fb58b[_0x5b09('0x30')][_0x5b09('0x3a')]+'%'};return _0x43a630;}})});}_0x2b200c=_['merge']({},_0x2b200c,_0x3fb58b[_0x5b09('0x3d')]);var _0x53e7e6={'where':_0x2b200c[_0x5b09('0x39')]};return db[_0x5b09('0x2b')][_0x5b09('0x1c')](_0x53e7e6)[_0x5b09('0x24')](function(_0x567830){_0x1d2dd2['count']=_0x567830;if(_0x3fb58b[_0x5b09('0x30')]['includeAll']){_0x2b200c[_0x5b09('0x3e')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x2b200c);})[_0x5b09('0x24')](function(_0x179a53){_0x1d2dd2[_0x5b09('0x3f')]=_0x179a53;return _0x1d2dd2;})[_0x5b09('0x24')](respondWithFilteredResult(_0x19d2d3,_0x2b200c))[_0x5b09('0x40')](handleError(_0x19d2d3,null));};exports[_0x5b09('0x41')]=function(_0x1fe70f,_0x1f2350){var _0x55c03e={'raw':!![],'where':{'id':_0x1fe70f[_0x5b09('0x42')]['id']}},_0x5c1f25={};_0x5c1f25['model']=_[_0x5b09('0x43')](db['ServicenowField'][_0x5b09('0x2c')]);_0x5c1f25[_0x5b09('0x30')]=_['keys'](_0x1fe70f[_0x5b09('0x30')]);_0x5c1f25[_0x5b09('0x31')]=_[_0x5b09('0x32')](_0x5c1f25['model'],_0x5c1f25[_0x5b09('0x30')]);_0x55c03e['attributes']=_[_0x5b09('0x32')](_0x5c1f25[_0x5b09('0x2f')],qs[_0x5b09('0x33')](_0x1fe70f[_0x5b09('0x30')][_0x5b09('0x33')]));_0x55c03e['attributes']=_0x55c03e[_0x5b09('0x34')][_0x5b09('0x44')]?_0x55c03e['attributes']:_0x5c1f25[_0x5b09('0x2f')];if(_0x1fe70f[_0x5b09('0x30')][_0x5b09('0x45')]){_0x55c03e['include']=[{'all':!![]}];}_0x55c03e=_[_0x5b09('0x3b')]({},_0x55c03e,_0x1fe70f[_0x5b09('0x3d')]);return db[_0x5b09('0x2b')][_0x5b09('0x46')](_0x55c03e)[_0x5b09('0x24')](handleEntityNotFound(_0x1f2350,null))['then'](respondWithResult(_0x1f2350,null))[_0x5b09('0x40')](handleError(_0x1f2350,null));};exports[_0x5b09('0x47')]=function(_0x4e15b8,_0x5adb05){return db[_0x5b09('0x2b')][_0x5b09('0x47')](_0x4e15b8[_0x5b09('0x48')],{})[_0x5b09('0x24')](respondWithResult(_0x5adb05,0xc9))[_0x5b09('0x40')](handleError(_0x5adb05,null));};exports[_0x5b09('0x22')]=function(_0x3ebcca,_0x44432d){if(_0x3ebcca[_0x5b09('0x48')]['id']){delete _0x3ebcca[_0x5b09('0x48')]['id'];}return db[_0x5b09('0x2b')][_0x5b09('0x46')]({'where':{'id':_0x3ebcca[_0x5b09('0x42')]['id']}})[_0x5b09('0x24')](handleEntityNotFound(_0x44432d,null))[_0x5b09('0x24')](saveUpdates(_0x3ebcca['body'],null))[_0x5b09('0x24')](respondWithResult(_0x44432d,null))[_0x5b09('0x40')](handleError(_0x44432d,null));};exports[_0x5b09('0x23')]=function(_0x2b2758,_0xdc8d26){return db['ServicenowField']['find']({'where':{'id':_0x2b2758['params']['id']}})[_0x5b09('0x24')](handleEntityNotFound(_0xdc8d26,null))['then'](removeEntity(_0xdc8d26,null))[_0x5b09('0x40')](handleError(_0xdc8d26,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 93ad1a7..4aa838f 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 _0x5fb0=['servicenow_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ServicenowField','int_servicenow_fields'];(function(_0x57f3e7,_0x3ab293){var _0x439d7a=function(_0x3588c4){while(--_0x3588c4){_0x57f3e7['push'](_0x57f3e7['shift']());}};_0x439d7a(++_0x3ab293);}(_0x5fb0,0xb7));var _0x05fb=function(_0x48b61b,_0xe542a5){_0x48b61b=_0x48b61b-0x0;var _0x169595=_0x5fb0[_0x48b61b];return _0x169595;};'use strict';var _=require(_0x05fb('0x0'));var util=require('util');var logger=require(_0x05fb('0x1'))(_0x05fb('0x2'));var moment=require(_0x05fb('0x3'));var BPromise=require(_0x05fb('0x4'));var rp=require(_0x05fb('0x5'));var fs=require('fs');var path=require(_0x05fb('0x6'));var rimraf=require('rimraf');var config=require(_0x05fb('0x7'));var attributes=require('./intServicenowField.attributes');module[_0x05fb('0x8')]=function(_0x5b8b96,_0x589f87){return _0x5b8b96[_0x05fb('0x9')](_0x05fb('0xa'),attributes,{'tableName':_0x05fb('0xb'),'paranoid':![],'indexes':[{'name':_0x05fb('0xc'),'fields':[_0x05fb('0xd'),_0x05fb('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7724=['exports','define','ServicenowField','int_servicenow_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7724,0xe6));var _0x4772=function(_0x532d86,_0x2067ff){_0x532d86=_0x532d86-0x0;var _0x152b27=_0x7724[_0x532d86];return _0x152b27;};'use strict';var _=require(_0x4772('0x0'));var util=require(_0x4772('0x1'));var logger=require(_0x4772('0x2'))(_0x4772('0x3'));var moment=require(_0x4772('0x4'));var BPromise=require(_0x4772('0x5'));var rp=require(_0x4772('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4772('0x7'));var config=require(_0x4772('0x8'));var attributes=require(_0x4772('0x9'));module[_0x4772('0xa')]=function(_0x638307,_0x2d9554){return _0x638307[_0x4772('0xb')](_0x4772('0xc'),attributes,{'tableName':_0x4772('0xd'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x4772('0xe'),_0x4772('0xf')],'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 a7b9b29..c835ff5 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(_0x1d99aa,_0x3074c4){var _0x31c336=function(_0xbe3eb4){while(--_0xbe3eb4){_0x1d99aa['push'](_0x1d99aa['shift']());}};_0x31c336(++_0x3074c4);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2513de,_0x5665c7){_0x2513de=_0x2513de-0x0;var _0x3438b4=_0xb43b[_0x2513de];return _0x3438b4;};'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 _0x70e0=['code','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x314a2c,_0x58efd6){var _0x33722b=function(_0x3b75d6){while(--_0x3b75d6){_0x314a2c['push'](_0x314a2c['shift']());}};_0x33722b(++_0x58efd6);}(_0x70e0,0x17b));var _0x070e=function(_0x469d80,_0x51359e){_0x469d80=_0x469d80-0x0;var _0x2c0a9b=_0x70e0[_0x469d80];return _0x2c0a9b;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 956506a..46ab2ba 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x10ad8e,_0x404dd2){var _0xcd245=function(_0x5e8a72){while(--_0x5e8a72){_0x10ad8e['push'](_0x10ad8e['shift']());}};_0xcd245(++_0x404dd2);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _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(_0x9a546f,_0x1665a5){var _0x35b857=function(_0x57a51c){while(--_0x57a51c){_0x9a546f['push'](_0x9a546f['shift']());}};_0x35b857(++_0x1665a5);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/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 7235821..ec544d1 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(_0x5e0fa3,_0x4a77b3){var _0x931caa=function(_0x175c6f){while(--_0x175c6f){_0x5e0fa3['push'](_0x5e0fa3['shift']());}};_0x931caa(++_0x4a77b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x4bb292,_0x104bf5){var _0x11301d=function(_0x3c0ff2){while(--_0x3c0ff2){_0x4bb292['push'](_0x4bb292['shift']());}};_0x11301d(++_0x104bf5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 0fcf3b0..6c3afa6 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 _0xc18b=['fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','SugarcrmAccount','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','body','update','findOne','SugarcrmConfiguration','nolimit','addConfiguration','AccountId','getSubjects','channel','Subjects','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','username','password','remoteUri','slice','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','Password\x20Expired','POST','Calls','values','module_fields','remove','includes','label','value','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs'];(function(_0x5cf52f,_0x2304cc){var _0x5b4b76=function(_0x3c408b){while(--_0x3c408b){_0x5cf52f['push'](_0x5cf52f['shift']());}};_0x5b4b76(++_0x2304cc);}(_0xc18b,0xe0));var _0xbc18=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xc18b[_0x2576d7];return _0x16a08c;};'use strict';var emlformat=require(_0xbc18('0x0'));var rimraf=require(_0xbc18('0x1'));var zipdir=require(_0xbc18('0x2'));var jsonpatch=require(_0xbc18('0x3'));var rp=require(_0xbc18('0x4'));var moment=require(_0xbc18('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbc18('0x6'));var util=require(_0xbc18('0x7'));var path=require(_0xbc18('0x8'));var sox=require(_0xbc18('0x9'));var csv=require(_0xbc18('0xa'));var ejs=require(_0xbc18('0xb'));var fs=require('fs');var fs_extra=require(_0xbc18('0xc'));var _=require('lodash');var squel=require(_0xbc18('0xd'));var crypto=require(_0xbc18('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xbc18('0xf'));var toCsv=require(_0xbc18('0xa'));var querystring=require('querystring');var Papa=require(_0xbc18('0x10'));var Redis=require(_0xbc18('0x11'));var authService=require(_0xbc18('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbc18('0x13'));var logger=require(_0xbc18('0x14'))(_0xbc18('0x15'));var utils=require('../../config/utils');var config=require(_0xbc18('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xbc18('0x17'));function respondWithStatusCode(_0x3f3b0f,_0x1fc513){_0x1fc513=_0x1fc513||0xcc;return function(_0x1a7536){if(_0x1a7536){return _0x3f3b0f[_0xbc18('0x18')](_0x1fc513);}return _0x3f3b0f['status'](_0x1fc513)[_0xbc18('0x19')]();};}function respondWithResult(_0x9cd86d,_0x2d90b1){_0x2d90b1=_0x2d90b1||0xc8;return function(_0x26400b){if(_0x26400b){return _0x9cd86d[_0xbc18('0x1a')](_0x2d90b1)[_0xbc18('0x1b')](_0x26400b);}};}function respondWithFilteredResult(_0x5ef1ab,_0x56a680){return function(_0x40fc85){if(_0x40fc85){var _0x49657b=typeof _0x56a680[_0xbc18('0x1c')]==='undefined'&&typeof _0x56a680[_0xbc18('0x1d')]===_0xbc18('0x1e');var _0x56115a=_0x40fc85[_0xbc18('0x1f')];var _0x1c0485=_0x49657b?0x0:_0x56a680['offset'];var _0x47a5cc=_0x49657b?_0x40fc85[_0xbc18('0x1f')]:_0x56a680['offset']+_0x56a680[_0xbc18('0x1d')];var _0x5ac51a;if(_0x47a5cc>=_0x56115a){_0x47a5cc=_0x56115a;_0x5ac51a=0xc8;}else{_0x5ac51a=0xce;}_0x5ef1ab['status'](_0x5ac51a);return _0x5ef1ab[_0xbc18('0x20')](_0xbc18('0x21'),_0x1c0485+'-'+_0x47a5cc+'/'+_0x56115a)[_0xbc18('0x1b')](_0x40fc85);}return null;};}function patchUpdates(_0x4e5819){return function(_0x285803){try{jsonpatch['apply'](_0x285803,_0x4e5819,!![]);}catch(_0x5455f6){return BPromise[_0xbc18('0x22')](_0x5455f6);}return _0x285803[_0xbc18('0x23')]();};}function saveUpdates(_0x4204c5,_0x31146b){return function(_0x44047d){if(_0x44047d){return _0x44047d['update'](_0x4204c5)[_0xbc18('0x24')](function(_0x529fc9){return _0x529fc9;});}return null;};}function removeEntity(_0x404904,_0x433860){return function(_0x33d968){if(_0x33d968){return _0x33d968[_0xbc18('0x25')]()[_0xbc18('0x24')](function(){_0x404904[_0xbc18('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11e927,_0x55b442){return function(_0x553145){if(!_0x553145){_0x11e927[_0xbc18('0x18')](0x194);}return _0x553145;};}function handleError(_0x48b25d,_0x5c79e2){_0x5c79e2=_0x5c79e2||0x1f4;return function(_0x2068b2){logger[_0xbc18('0x26')](_0x2068b2[_0xbc18('0x27')]);if(_0x2068b2['name']){delete _0x2068b2[_0xbc18('0x28')];}_0x48b25d[_0xbc18('0x1a')](_0x5c79e2)[_0xbc18('0x29')](_0x2068b2);};}exports[_0xbc18('0x2a')]=function(_0x5da8f1,_0x5275d3){var _0x39a50e={},_0xf4e5d={},_0x154b70={'count':0x0,'rows':[]};var _0x26c02e=_['map'](db[_0xbc18('0x2b')][_0xbc18('0x2c')],function(_0x1aa264){return{'name':_0x1aa264[_0xbc18('0x2d')],'type':_0x1aa264[_0xbc18('0x2e')][_0xbc18('0x2f')]};});_0xf4e5d['model']=_[_0xbc18('0x30')](_0x26c02e,'name');_0xf4e5d['query']=_[_0xbc18('0x31')](_0x5da8f1[_0xbc18('0x32')]);_0xf4e5d[_0xbc18('0x33')]=_[_0xbc18('0x34')](_0xf4e5d[_0xbc18('0x35')],_0xf4e5d[_0xbc18('0x32')]);_0x39a50e[_0xbc18('0x36')]=_[_0xbc18('0x34')](_0xf4e5d['model'],qs[_0xbc18('0x37')](_0x5da8f1[_0xbc18('0x32')][_0xbc18('0x37')]));_0x39a50e[_0xbc18('0x36')]=_0x39a50e[_0xbc18('0x36')][_0xbc18('0x38')]?_0x39a50e['attributes']:_0xf4e5d[_0xbc18('0x35')];if(!_0x5da8f1[_0xbc18('0x32')]['hasOwnProperty']('nolimit')){_0x39a50e[_0xbc18('0x1d')]=qs[_0xbc18('0x1d')](_0x5da8f1['query']['limit']);_0x39a50e[_0xbc18('0x1c')]=qs['offset'](_0x5da8f1[_0xbc18('0x32')][_0xbc18('0x1c')]);}_0x39a50e[_0xbc18('0x39')]=qs[_0xbc18('0x3a')](_0x5da8f1[_0xbc18('0x32')][_0xbc18('0x3a')]);_0x39a50e[_0xbc18('0x3b')]=qs[_0xbc18('0x33')](_[_0xbc18('0x3c')](_0x5da8f1['query'],_0xf4e5d[_0xbc18('0x33')]),_0x26c02e);if(_0x5da8f1[_0xbc18('0x32')][_0xbc18('0x3d')]){_0x39a50e[_0xbc18('0x3b')]=_[_0xbc18('0x3e')](_0x39a50e[_0xbc18('0x3b')],{'$or':_[_0xbc18('0x30')](_0x26c02e,function(_0x170b25){if(_0x170b25[_0xbc18('0x2e')]!==_0xbc18('0x3f')){var _0x48dac5={};_0x48dac5[_0x170b25['name']]={'$like':'%'+_0x5da8f1[_0xbc18('0x32')][_0xbc18('0x3d')]+'%'};return _0x48dac5;}})});}_0x39a50e=_[_0xbc18('0x3e')]({},_0x39a50e,_0x5da8f1[_0xbc18('0x40')]);var _0x5498a0={'where':_0x39a50e[_0xbc18('0x3b')]};return db[_0xbc18('0x2b')][_0xbc18('0x1f')](_0x5498a0)['then'](function(_0x428ee2){_0x154b70[_0xbc18('0x1f')]=_0x428ee2;if(_0x5da8f1[_0xbc18('0x32')]['includeAll']){_0x39a50e[_0xbc18('0x41')]=[{'all':!![]}];}return db[_0xbc18('0x2b')]['findAll'](_0x39a50e);})[_0xbc18('0x24')](function(_0x259382){_0x154b70[_0xbc18('0x42')]=_0x259382;return _0x154b70;})['then'](respondWithFilteredResult(_0x5275d3,_0x39a50e))[_0xbc18('0x43')](handleError(_0x5275d3,null));};exports[_0xbc18('0x44')]=function(_0x3f60d8,_0x4d8b32){var _0x53dfee={'raw':![],'where':{'id':_0x3f60d8[_0xbc18('0x45')]['id']}},_0x38be8e={};_0x38be8e[_0xbc18('0x35')]=_[_0xbc18('0x31')](db[_0xbc18('0x2b')][_0xbc18('0x2c')]);_0x38be8e['query']=_[_0xbc18('0x31')](_0x3f60d8[_0xbc18('0x32')]);_0x38be8e[_0xbc18('0x33')]=_[_0xbc18('0x34')](_0x38be8e[_0xbc18('0x35')],_0x38be8e['query']);_0x53dfee[_0xbc18('0x36')]=_['intersection'](_0x38be8e['model'],qs[_0xbc18('0x37')](_0x3f60d8[_0xbc18('0x32')][_0xbc18('0x37')]));_0x53dfee[_0xbc18('0x36')]=_0x53dfee['attributes']['length']?_0x53dfee[_0xbc18('0x36')]:_0x38be8e['model'];if(_0x3f60d8[_0xbc18('0x32')][_0xbc18('0x46')]){_0x53dfee[_0xbc18('0x41')]=[{'all':!![]}];}_0x53dfee=_[_0xbc18('0x3e')]({},_0x53dfee,_0x3f60d8[_0xbc18('0x40')]);return db[_0xbc18('0x2b')][_0xbc18('0x47')](_0x53dfee)[_0xbc18('0x24')](handleEntityNotFound(_0x4d8b32,null))[_0xbc18('0x24')](respondWithResult(_0x4d8b32,null))['catch'](handleError(_0x4d8b32,null));};exports['create']=function(_0x2cd309,_0x25b643){return db['SugarcrmAccount'][_0xbc18('0x48')](_0x2cd309[_0xbc18('0x49')],{})[_0xbc18('0x24')](respondWithResult(_0x25b643,0xc9))[_0xbc18('0x43')](handleError(_0x25b643,null));};exports[_0xbc18('0x4a')]=function(_0x2f8e77,_0x5528bb){if(_0x2f8e77['body']['id']){delete _0x2f8e77['body']['id'];}return db[_0xbc18('0x2b')][_0xbc18('0x47')]({'where':{'id':_0x2f8e77[_0xbc18('0x45')]['id']}})[_0xbc18('0x24')](handleEntityNotFound(_0x5528bb,null))[_0xbc18('0x24')](saveUpdates(_0x2f8e77[_0xbc18('0x49')],null))[_0xbc18('0x24')](respondWithResult(_0x5528bb,null))[_0xbc18('0x43')](handleError(_0x5528bb,null));};exports[_0xbc18('0x25')]=function(_0x44f1b5,_0x20b6b5){return db[_0xbc18('0x2b')][_0xbc18('0x47')]({'where':{'id':_0x44f1b5[_0xbc18('0x45')]['id']}})[_0xbc18('0x24')](handleEntityNotFound(_0x20b6b5,null))[_0xbc18('0x24')](removeEntity(_0x20b6b5,null))[_0xbc18('0x43')](handleError(_0x20b6b5,null));};exports['getConfigurations']=function(_0x38732b,_0x23c96,_0x3dd3cb){var _0x18b832={};var _0x1f61cd={};var _0x2cad82;var _0x439b63;return db[_0xbc18('0x2b')][_0xbc18('0x4b')]({'where':{'id':_0x38732b['params']['id']}})['then'](handleEntityNotFound(_0x23c96,null))['then'](function(_0x23b456){if(_0x23b456){_0x2cad82=_0x23b456;_0x1f61cd[_0xbc18('0x35')]=_[_0xbc18('0x31')](db[_0xbc18('0x4c')][_0xbc18('0x2c')]);_0x1f61cd['query']=_[_0xbc18('0x31')](_0x38732b[_0xbc18('0x32')]);_0x1f61cd[_0xbc18('0x33')]=_[_0xbc18('0x34')](_0x1f61cd[_0xbc18('0x35')],_0x1f61cd['query']);_0x18b832[_0xbc18('0x36')]=_[_0xbc18('0x34')](_0x1f61cd[_0xbc18('0x35')],qs['fields'](_0x38732b[_0xbc18('0x32')][_0xbc18('0x37')]));_0x18b832[_0xbc18('0x36')]=_0x18b832[_0xbc18('0x36')][_0xbc18('0x38')]?_0x18b832[_0xbc18('0x36')]:_0x1f61cd[_0xbc18('0x35')];_0x18b832[_0xbc18('0x39')]=qs[_0xbc18('0x3a')](_0x38732b[_0xbc18('0x32')]['sort']);_0x18b832[_0xbc18('0x3b')]=qs[_0xbc18('0x33')](_['pick'](_0x38732b[_0xbc18('0x32')],_0x1f61cd[_0xbc18('0x33')]));if(_0x38732b['query'][_0xbc18('0x3d')]){_0x18b832[_0xbc18('0x3b')]=_['merge'](_0x18b832[_0xbc18('0x3b')],{'$or':_[_0xbc18('0x30')](_0x18b832[_0xbc18('0x36')],function(_0x4e962a){var _0x17cc5f={};_0x17cc5f[_0x4e962a]={'$like':'%'+_0x38732b[_0xbc18('0x32')]['filter']+'%'};return _0x17cc5f;})});}_0x18b832=_[_0xbc18('0x3e')]({},_0x18b832,_0x38732b[_0xbc18('0x40')]);return _0x2cad82['getConfigurations'](_0x18b832);}})['then'](function(_0x3455df){if(_0x3455df){_0x439b63=_0x3455df[_0xbc18('0x38')];if(!_0x38732b[_0xbc18('0x32')]['hasOwnProperty'](_0xbc18('0x4d'))){_0x18b832[_0xbc18('0x1d')]=qs[_0xbc18('0x1d')](_0x38732b[_0xbc18('0x32')][_0xbc18('0x1d')]);_0x18b832[_0xbc18('0x1c')]=qs[_0xbc18('0x1c')](_0x38732b[_0xbc18('0x32')][_0xbc18('0x1c')]);}return _0x2cad82['getConfigurations'](_0x18b832);}})[_0xbc18('0x24')](function(_0x16cb4d){if(_0x16cb4d){return _0x16cb4d?{'count':_0x439b63,'rows':_0x16cb4d}:null;}})[_0xbc18('0x24')](respondWithResult(_0x23c96,null))['catch'](handleError(_0x23c96,null));};exports[_0xbc18('0x4e')]=function(_0x4112a0,_0x130307,_0x2e254a){if(_0x4112a0['body']['id']){delete _0x4112a0[_0xbc18('0x49')]['id'];}return db[_0xbc18('0x2b')][_0xbc18('0x4b')]({'where':{'id':_0x4112a0['params']['id']}})['then'](handleEntityNotFound(_0x130307,null))['then'](function(_0x144bbe){if(_0x144bbe){_0x4112a0[_0xbc18('0x49')][_0xbc18('0x4f')]=_0x144bbe['id'];_0x4112a0['body']['Subjects']=integrations[_0xbc18('0x50')](_0x4112a0[_0xbc18('0x49')][_0xbc18('0x51')],_0x4112a0['body'][_0xbc18('0x2e')]);_0x4112a0['body']['Descriptions']=integrations['getDescriptions'](_0x4112a0[_0xbc18('0x49')][_0xbc18('0x51')],_0x4112a0['body']['type']);return db['SugarcrmConfiguration']['create'](_0x4112a0['body'],{'include':[{'model':db['SugarcrmField'],'as':_0xbc18('0x52')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0xbc18('0x24')](respondWithResult(_0x130307,null))[_0xbc18('0x43')](handleError(_0x130307,null));};exports[_0xbc18('0x53')]=function(_0x3fdbd0,_0x57c007,_0x55fa44){var _0x46c5cd='';var _0xe0dc92=['id','name',_0xbc18('0x54'),_0xbc18('0x55'),_0xbc18('0x56'),_0xbc18('0x57'),_0xbc18('0x58'),_0xbc18('0x59'),_0xbc18('0x5a'),_0xbc18('0x5b'),_0xbc18('0x5c'),'direction'];return db[_0xbc18('0x2b')]['findOne']({'where':{'id':_0x3fdbd0[_0xbc18('0x45')]['id']},'attributes':['id',_0xbc18('0x5d'),_0xbc18('0x5e'),_0xbc18('0x5f')]})[_0xbc18('0x24')](handleEntityNotFound(_0x57c007,null))[_0xbc18('0x24')](function(_0x247a7e){if(_0x247a7e){_0x46c5cd=_0x247a7e['remoteUri'];var _0x320ac2=_0x46c5cd[_0xbc18('0x60')](-0x1);if(_0x320ac2==='/'){_0x46c5cd=_0x46c5cd[_0xbc18('0x61')](0x0,_0x46c5cd[_0xbc18('0x62')](_0x320ac2));}return rp({'method':'POST','uri':util[_0xbc18('0x63')](_0xbc18('0x64'),_0x46c5cd,_0xbc18('0x65')),'json':!![],'form':{'method':_0xbc18('0x66'),'input_type':_0xbc18('0x67'),'response_type':_0xbc18('0x67'),'rest_data':JSON[_0xbc18('0x68')]({'user_auth':{'user_name':_0x247a7e[_0xbc18('0x5d')],'password':_0x247a7e[_0xbc18('0x5e')],'encryption':_0xbc18('0x69')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xbc18('0x24')](function(_0x1a5e3f){if(_0x1a5e3f&&_0x1a5e3f[_0xbc18('0x28')]!=='Invalid\x20Login'&&_0x1a5e3f['name']!==_0xbc18('0x6a')){return rp({'method':_0xbc18('0x6b'),'uri':util[_0xbc18('0x63')]('%s%s',_0x46c5cd,_0xbc18('0x65')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xbc18('0x67'),'response_type':_0xbc18('0x67'),'rest_data':JSON[_0xbc18('0x68')]({'session':_0x1a5e3f['id'],'module_name':_0xbc18('0x6c')})}})[_0xbc18('0x24')](function(_0x2fb120){if(_0x2fb120){var _0x36e568=_[_0xbc18('0x6d')](_0x2fb120[_0xbc18('0x6e')]);_[_0xbc18('0x6f')](_0x36e568,function(_0x3f28d4){return _0xe0dc92[_0xbc18('0x70')](_0x3f28d4[_0xbc18('0x28')]);});return{'count':_0x36e568['length'],'rows':_[_0xbc18('0x30')](_0x36e568,function(_0x333b6a){return{'id':_0x333b6a[_0xbc18('0x28')],'name':_0x333b6a[_0xbc18('0x71')],'custom':_['endsWith'](_0x333b6a[_0xbc18('0x28')],'_c')?!![]:![],'options':_0x333b6a['options']?_['map'](_[_0xbc18('0x6d')](_0x333b6a[_0xbc18('0x40')]),function(_0x337c10){return{'name':_0x337c10[_0xbc18('0x72')],'value':_0x337c10[_0xbc18('0x28')]};}):[]};})};}})['then'](respondWithResult(_0x57c007,null))[_0xbc18('0x43')](function(_0x5393a3){var _0x2aea7f=_0x3fdbd0[_0xbc18('0x32')][_0xbc18('0x73')]?0x1f4:_0x5393a3['statusCode']||0x1f4;logger[_0xbc18('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0xbc18('0x53'),_0x2aea7f,JSON['stringify'](_0x5393a3));delete _0x5393a3[_0xbc18('0x28')];if(_0x2aea7f===0x191){_0x2aea7f=0x190;}_0x57c007['status'](_0x2aea7f)['send'](_0x3fdbd0[_0xbc18('0x32')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x5393a3[_0xbc18('0x74')]}:_0x5393a3);});}else{var _0x116e56=0x1f4;_0x57c007['status'](_0x116e56)[_0xbc18('0x29')]({'message':_0xbc18('0x75'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x1df1=['created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','direction','username','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','login','JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','/service/v4_1/rest.php','get_module_fields','stringify','Calls','values','module_fields','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','then','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','SugarcrmAccount','includeAll','include','findAll','rows','catch','show','keys','find','create','body','update','params','destroy','getConfigurations','findOne','SugarcrmConfiguration','pick','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id'];(function(_0xc73137,_0x19b6b1){var _0x407693=function(_0x521fdd){while(--_0x521fdd){_0xc73137['push'](_0xc73137['shift']());}};_0x407693(++_0x19b6b1);}(_0x1df1,0x9b));var _0x11df=function(_0x4a5c41,_0x499ded){_0x4a5c41=_0x4a5c41-0x0;var _0x25e01e=_0x1df1[_0x4a5c41];return _0x25e01e;};'use strict';var emlformat=require(_0x11df('0x0'));var rimraf=require(_0x11df('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x11df('0x2'));var rp=require(_0x11df('0x3'));var moment=require(_0x11df('0x4'));var BPromise=require(_0x11df('0x5'));var Mustache=require(_0x11df('0x6'));var util=require('util');var path=require(_0x11df('0x7'));var sox=require(_0x11df('0x8'));var csv=require(_0x11df('0x9'));var ejs=require(_0x11df('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11df('0xb'));var squel=require(_0x11df('0xc'));var crypto=require(_0x11df('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x11df('0xe'));var toCsv=require(_0x11df('0x9'));var querystring=require(_0x11df('0xf'));var Papa=require('papaparse');var Redis=require(_0x11df('0x10'));var authService=require(_0x11df('0x11'));var qs=require(_0x11df('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x11df('0x13'))(_0x11df('0x14'));var utils=require(_0x11df('0x15'));var config=require(_0x11df('0x16'));var licenseUtil=require(_0x11df('0x17'));var db=require(_0x11df('0x18'))['db'];var integrations=require(_0x11df('0x19'));function respondWithStatusCode(_0x36c37e,_0x388b0a){_0x388b0a=_0x388b0a||0xcc;return function(_0x3c6f1e){if(_0x3c6f1e){return _0x36c37e[_0x11df('0x1a')](_0x388b0a);}return _0x36c37e[_0x11df('0x1b')](_0x388b0a)[_0x11df('0x1c')]();};}function respondWithResult(_0x122812,_0x3b3d0c){_0x3b3d0c=_0x3b3d0c||0xc8;return function(_0x9a5614){if(_0x9a5614){return _0x122812['status'](_0x3b3d0c)[_0x11df('0x1d')](_0x9a5614);}};}function respondWithFilteredResult(_0x3ae8ef,_0xafb710){return function(_0x21f48f){if(_0x21f48f){var _0x112a51=typeof _0xafb710[_0x11df('0x1e')]==='undefined'&&typeof _0xafb710[_0x11df('0x1f')]==='undefined';var _0x5122d4=_0x21f48f[_0x11df('0x20')];var _0x1ad192=_0x112a51?0x0:_0xafb710['offset'];var _0x330a2d=_0x112a51?_0x21f48f[_0x11df('0x20')]:_0xafb710[_0x11df('0x1e')]+_0xafb710['limit'];var _0x1873c6;if(_0x330a2d>=_0x5122d4){_0x330a2d=_0x5122d4;_0x1873c6=0xc8;}else{_0x1873c6=0xce;}_0x3ae8ef[_0x11df('0x1b')](_0x1873c6);return _0x3ae8ef[_0x11df('0x21')]('Content-Range',_0x1ad192+'-'+_0x330a2d+'/'+_0x5122d4)['json'](_0x21f48f);}return null;};}function patchUpdates(_0xc2a995){return function(_0x54ed4f){try{jsonpatch[_0x11df('0x22')](_0x54ed4f,_0xc2a995,!![]);}catch(_0x43df0a){return BPromise[_0x11df('0x23')](_0x43df0a);}return _0x54ed4f[_0x11df('0x24')]();};}function saveUpdates(_0x42a053,_0x1ebe93){return function(_0x21fdda){if(_0x21fdda){return _0x21fdda['update'](_0x42a053)[_0x11df('0x25')](function(_0x252f7f){return _0x252f7f;});}return null;};}function removeEntity(_0xa515de,_0x377895){return function(_0x2bc277){if(_0x2bc277){return _0x2bc277['destroy']()[_0x11df('0x25')](function(){_0xa515de[_0x11df('0x1b')](0xcc)[_0x11df('0x1c')]();});}};}function handleEntityNotFound(_0x1beb8c,_0x50f84d){return function(_0x1e13e7){if(!_0x1e13e7){_0x1beb8c[_0x11df('0x1a')](0x194);}return _0x1e13e7;};}function handleError(_0x44f404,_0x337dfa){_0x337dfa=_0x337dfa||0x1f4;return function(_0x6eadc4){logger[_0x11df('0x26')](_0x6eadc4[_0x11df('0x27')]);if(_0x6eadc4[_0x11df('0x28')]){delete _0x6eadc4[_0x11df('0x28')];}_0x44f404[_0x11df('0x1b')](_0x337dfa)[_0x11df('0x29')](_0x6eadc4);};}exports['index']=function(_0x3ad108,_0x40a678){var _0xe59669={},_0x2cbc3e={},_0x431d33={'count':0x0,'rows':[]};var _0x38fb48=_[_0x11df('0x2a')](db['SugarcrmAccount'][_0x11df('0x2b')],function(_0x1eae02){return{'name':_0x1eae02[_0x11df('0x2c')],'type':_0x1eae02['type'][_0x11df('0x2d')]};});_0x2cbc3e[_0x11df('0x2e')]=_[_0x11df('0x2a')](_0x38fb48,_0x11df('0x28'));_0x2cbc3e[_0x11df('0x2f')]=_['keys'](_0x3ad108['query']);_0x2cbc3e[_0x11df('0x30')]=_[_0x11df('0x31')](_0x2cbc3e[_0x11df('0x2e')],_0x2cbc3e[_0x11df('0x2f')]);_0xe59669[_0x11df('0x32')]=_[_0x11df('0x31')](_0x2cbc3e[_0x11df('0x2e')],qs[_0x11df('0x33')](_0x3ad108[_0x11df('0x2f')]['fields']));_0xe59669[_0x11df('0x32')]=_0xe59669[_0x11df('0x32')][_0x11df('0x34')]?_0xe59669[_0x11df('0x32')]:_0x2cbc3e[_0x11df('0x2e')];if(!_0x3ad108[_0x11df('0x2f')]['hasOwnProperty'](_0x11df('0x35'))){_0xe59669[_0x11df('0x1f')]=qs['limit'](_0x3ad108['query'][_0x11df('0x1f')]);_0xe59669[_0x11df('0x1e')]=qs['offset'](_0x3ad108[_0x11df('0x2f')][_0x11df('0x1e')]);}_0xe59669[_0x11df('0x36')]=qs[_0x11df('0x37')](_0x3ad108['query'][_0x11df('0x37')]);_0xe59669[_0x11df('0x38')]=qs['filters'](_['pick'](_0x3ad108['query'],_0x2cbc3e[_0x11df('0x30')]),_0x38fb48);if(_0x3ad108[_0x11df('0x2f')][_0x11df('0x39')]){_0xe59669[_0x11df('0x38')]=_['merge'](_0xe59669[_0x11df('0x38')],{'$or':_[_0x11df('0x2a')](_0x38fb48,function(_0x328708){if(_0x328708[_0x11df('0x3a')]!==_0x11df('0x3b')){var _0x42bce2={};_0x42bce2[_0x328708[_0x11df('0x28')]]={'$like':'%'+_0x3ad108['query'][_0x11df('0x39')]+'%'};return _0x42bce2;}})});}_0xe59669=_[_0x11df('0x3c')]({},_0xe59669,_0x3ad108[_0x11df('0x3d')]);var _0x141380={'where':_0xe59669[_0x11df('0x38')]};return db[_0x11df('0x3e')][_0x11df('0x20')](_0x141380)[_0x11df('0x25')](function(_0x192a17){_0x431d33[_0x11df('0x20')]=_0x192a17;if(_0x3ad108[_0x11df('0x2f')][_0x11df('0x3f')]){_0xe59669[_0x11df('0x40')]=[{'all':!![]}];}return db[_0x11df('0x3e')][_0x11df('0x41')](_0xe59669);})[_0x11df('0x25')](function(_0x256770){_0x431d33[_0x11df('0x42')]=_0x256770;return _0x431d33;})[_0x11df('0x25')](respondWithFilteredResult(_0x40a678,_0xe59669))[_0x11df('0x43')](handleError(_0x40a678,null));};exports[_0x11df('0x44')]=function(_0x26e513,_0x458769){var _0x4af05d={'raw':![],'where':{'id':_0x26e513['params']['id']}},_0x12f3c6={};_0x12f3c6[_0x11df('0x2e')]=_['keys'](db[_0x11df('0x3e')][_0x11df('0x2b')]);_0x12f3c6[_0x11df('0x2f')]=_[_0x11df('0x45')](_0x26e513['query']);_0x12f3c6[_0x11df('0x30')]=_['intersection'](_0x12f3c6[_0x11df('0x2e')],_0x12f3c6[_0x11df('0x2f')]);_0x4af05d[_0x11df('0x32')]=_[_0x11df('0x31')](_0x12f3c6[_0x11df('0x2e')],qs[_0x11df('0x33')](_0x26e513[_0x11df('0x2f')]['fields']));_0x4af05d['attributes']=_0x4af05d['attributes'][_0x11df('0x34')]?_0x4af05d[_0x11df('0x32')]:_0x12f3c6[_0x11df('0x2e')];if(_0x26e513[_0x11df('0x2f')][_0x11df('0x3f')]){_0x4af05d[_0x11df('0x40')]=[{'all':!![]}];}_0x4af05d=_[_0x11df('0x3c')]({},_0x4af05d,_0x26e513['options']);return db['SugarcrmAccount'][_0x11df('0x46')](_0x4af05d)[_0x11df('0x25')](handleEntityNotFound(_0x458769,null))[_0x11df('0x25')](respondWithResult(_0x458769,null))[_0x11df('0x43')](handleError(_0x458769,null));};exports['create']=function(_0x389a7d,_0x481ca4){return db['SugarcrmAccount'][_0x11df('0x47')](_0x389a7d[_0x11df('0x48')],{})[_0x11df('0x25')](respondWithResult(_0x481ca4,0xc9))['catch'](handleError(_0x481ca4,null));};exports[_0x11df('0x49')]=function(_0x1dd469,_0x4789a3){if(_0x1dd469[_0x11df('0x48')]['id']){delete _0x1dd469[_0x11df('0x48')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x1dd469[_0x11df('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4789a3,null))[_0x11df('0x25')](saveUpdates(_0x1dd469[_0x11df('0x48')],null))['then'](respondWithResult(_0x4789a3,null))['catch'](handleError(_0x4789a3,null));};exports[_0x11df('0x4b')]=function(_0x22db8d,_0x59edf2){return db[_0x11df('0x3e')][_0x11df('0x46')]({'where':{'id':_0x22db8d[_0x11df('0x4a')]['id']}})[_0x11df('0x25')](handleEntityNotFound(_0x59edf2,null))[_0x11df('0x25')](removeEntity(_0x59edf2,null))[_0x11df('0x43')](handleError(_0x59edf2,null));};exports[_0x11df('0x4c')]=function(_0x1cfb8d,_0x18c2ab,_0x213671){var _0x390eb6={};var _0x85c2c3={};var _0x382f9c;var _0x265122;return db[_0x11df('0x3e')][_0x11df('0x4d')]({'where':{'id':_0x1cfb8d['params']['id']}})[_0x11df('0x25')](handleEntityNotFound(_0x18c2ab,null))['then'](function(_0x29b667){if(_0x29b667){_0x382f9c=_0x29b667;_0x85c2c3[_0x11df('0x2e')]=_[_0x11df('0x45')](db[_0x11df('0x4e')]['rawAttributes']);_0x85c2c3[_0x11df('0x2f')]=_[_0x11df('0x45')](_0x1cfb8d[_0x11df('0x2f')]);_0x85c2c3[_0x11df('0x30')]=_[_0x11df('0x31')](_0x85c2c3[_0x11df('0x2e')],_0x85c2c3[_0x11df('0x2f')]);_0x390eb6[_0x11df('0x32')]=_[_0x11df('0x31')](_0x85c2c3['model'],qs[_0x11df('0x33')](_0x1cfb8d[_0x11df('0x2f')]['fields']));_0x390eb6[_0x11df('0x32')]=_0x390eb6['attributes'][_0x11df('0x34')]?_0x390eb6[_0x11df('0x32')]:_0x85c2c3['model'];_0x390eb6[_0x11df('0x36')]=qs[_0x11df('0x37')](_0x1cfb8d[_0x11df('0x2f')][_0x11df('0x37')]);_0x390eb6[_0x11df('0x38')]=qs['filters'](_[_0x11df('0x4f')](_0x1cfb8d[_0x11df('0x2f')],_0x85c2c3['filters']));if(_0x1cfb8d['query']['filter']){_0x390eb6['where']=_[_0x11df('0x3c')](_0x390eb6[_0x11df('0x38')],{'$or':_['map'](_0x390eb6['attributes'],function(_0x1bb5b6){var _0x9e0aa={};_0x9e0aa[_0x1bb5b6]={'$like':'%'+_0x1cfb8d[_0x11df('0x2f')][_0x11df('0x39')]+'%'};return _0x9e0aa;})});}_0x390eb6=_['merge']({},_0x390eb6,_0x1cfb8d[_0x11df('0x3d')]);return _0x382f9c['getConfigurations'](_0x390eb6);}})[_0x11df('0x25')](function(_0x52b1a1){if(_0x52b1a1){_0x265122=_0x52b1a1[_0x11df('0x34')];if(!_0x1cfb8d[_0x11df('0x2f')][_0x11df('0x50')](_0x11df('0x35'))){_0x390eb6[_0x11df('0x1f')]=qs[_0x11df('0x1f')](_0x1cfb8d['query'][_0x11df('0x1f')]);_0x390eb6[_0x11df('0x1e')]=qs['offset'](_0x1cfb8d[_0x11df('0x2f')][_0x11df('0x1e')]);}return _0x382f9c[_0x11df('0x4c')](_0x390eb6);}})[_0x11df('0x25')](function(_0x3aa900){if(_0x3aa900){return _0x3aa900?{'count':_0x265122,'rows':_0x3aa900}:null;}})[_0x11df('0x25')](respondWithResult(_0x18c2ab,null))[_0x11df('0x43')](handleError(_0x18c2ab,null));};exports['addConfiguration']=function(_0x255a02,_0x5d5b83,_0x41138e){if(_0x255a02[_0x11df('0x48')]['id']){delete _0x255a02[_0x11df('0x48')]['id'];}return db[_0x11df('0x3e')]['findOne']({'where':{'id':_0x255a02['params']['id']}})[_0x11df('0x25')](handleEntityNotFound(_0x5d5b83,null))[_0x11df('0x25')](function(_0x4b19e2){if(_0x4b19e2){_0x255a02[_0x11df('0x48')][_0x11df('0x51')]=_0x4b19e2['id'];_0x255a02['body'][_0x11df('0x52')]=integrations[_0x11df('0x53')](_0x255a02['body'][_0x11df('0x54')],_0x255a02[_0x11df('0x48')]['type']);_0x255a02[_0x11df('0x48')][_0x11df('0x55')]=integrations['getDescriptions'](_0x255a02[_0x11df('0x48')][_0x11df('0x54')],_0x255a02[_0x11df('0x48')][_0x11df('0x3a')]);return db['SugarcrmConfiguration']['create'](_0x255a02[_0x11df('0x48')],{'include':[{'model':db[_0x11df('0x56')],'as':'Subjects'},{'model':db[_0x11df('0x56')],'as':_0x11df('0x55')}]});}return null;})[_0x11df('0x25')](respondWithResult(_0x5d5b83,null))[_0x11df('0x43')](handleError(_0x5d5b83,null));};exports[_0x11df('0x57')]=function(_0x488388,_0x1f7a03,_0x1bf92d){var _0x274ad3='';var _0x354bcc=['id',_0x11df('0x28'),_0x11df('0x58'),_0x11df('0x59'),'description',_0x11df('0x5a'),_0x11df('0x5b'),_0x11df('0x5c'),_0x11df('0x5d'),_0x11df('0x5e'),'parent_name',_0x11df('0x5f')];return db[_0x11df('0x3e')][_0x11df('0x4d')]({'where':{'id':_0x488388[_0x11df('0x4a')]['id']},'attributes':['id',_0x11df('0x60'),'password','remoteUri']})[_0x11df('0x25')](handleEntityNotFound(_0x1f7a03,null))['then'](function(_0x480132){if(_0x480132){_0x274ad3=_0x480132[_0x11df('0x61')];var _0x13c65d=_0x274ad3[_0x11df('0x62')](-0x1);if(_0x13c65d==='/'){_0x274ad3=_0x274ad3[_0x11df('0x63')](0x0,_0x274ad3[_0x11df('0x64')](_0x13c65d));}return rp({'method':_0x11df('0x65'),'uri':util[_0x11df('0x66')](_0x11df('0x67'),_0x274ad3,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x11df('0x68'),'input_type':_0x11df('0x69'),'response_type':_0x11df('0x69'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x480132[_0x11df('0x60')],'password':_0x480132[_0x11df('0x6a')],'encryption':_0x11df('0x6b')},'application':_0x11df('0x6c')})}});}})[_0x11df('0x25')](function(_0x206a56){if(_0x206a56&&_0x206a56['name']!==_0x11df('0x6d')&&_0x206a56[_0x11df('0x28')]!=='Password\x20Expired'){return rp({'method':_0x11df('0x65'),'uri':util[_0x11df('0x66')](_0x11df('0x67'),_0x274ad3,_0x11df('0x6e')),'json':!![],'form':{'method':_0x11df('0x6f'),'input_type':_0x11df('0x69'),'response_type':_0x11df('0x69'),'rest_data':JSON[_0x11df('0x70')]({'session':_0x206a56['id'],'module_name':_0x11df('0x71')})}})[_0x11df('0x25')](function(_0x44c6e4){if(_0x44c6e4){var _0x47d1a3=_[_0x11df('0x72')](_0x44c6e4[_0x11df('0x73')]);_['remove'](_0x47d1a3,function(_0x5133d3){return _0x354bcc['includes'](_0x5133d3[_0x11df('0x28')]);});return{'count':_0x47d1a3[_0x11df('0x34')],'rows':_[_0x11df('0x2a')](_0x47d1a3,function(_0x176e05){return{'id':_0x176e05[_0x11df('0x28')],'name':_0x176e05['label'],'custom':_[_0x11df('0x74')](_0x176e05[_0x11df('0x28')],'_c')?!![]:![],'options':_0x176e05['options']?_[_0x11df('0x2a')](_[_0x11df('0x72')](_0x176e05['options']),function(_0x64610d){return{'name':_0x64610d[_0x11df('0x75')],'value':_0x64610d[_0x11df('0x28')]};}):[]};})};}})['then'](respondWithResult(_0x1f7a03,null))[_0x11df('0x43')](function(_0x432cee){var _0x4152cc=_0x488388['query'][_0x11df('0x76')]?0x1f4:_0x432cee[_0x11df('0x77')]||0x1f4;logger['error'](_0x11df('0x78'),_0x11df('0x57'),_0x4152cc,JSON[_0x11df('0x70')](_0x432cee));delete _0x432cee[_0x11df('0x28')];if(_0x4152cc===0x191){_0x4152cc=0x190;}_0x1f7a03['status'](_0x4152cc)[_0x11df('0x29')](_0x488388[_0x11df('0x2f')][_0x11df('0x76')]?{'message':_0x11df('0x79'),'statusCode':_0x432cee[_0x11df('0x77')]}:_0x432cee);});}else{var _0x7abeac=0x1f4;_0x1f7a03['status'](_0x7abeac)[_0x11df('0x29')]({'message':_0x11df('0x79'),'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 e6118bc..49770ec 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 _0x8bd1=['../../components/integrations/configuration','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0xbd201,_0x2d26d0){var _0x103c69=function(_0x1dc5c6){while(--_0x1dc5c6){_0xbd201['push'](_0xbd201['shift']());}};_0x103c69(++_0x2d26d0);}(_0x8bd1,0x188));var _0x18bd=function(_0x27652c,_0x3b0104){_0x27652c=_0x27652c-0x0;var _0x3e70e7=_0x8bd1[_0x27652c];return _0x3e70e7;};'use strict';var _=require(_0x18bd('0x0'));var util=require(_0x18bd('0x1'));var logger=require(_0x18bd('0x2'))(_0x18bd('0x3'));var moment=require(_0x18bd('0x4'));var BPromise=require(_0x18bd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x18bd('0x6'));var config=require(_0x18bd('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x18bd('0x8'));module['exports']=function(_0x5dad6a,_0x2a9a74){return _0x5dad6a['define']('SugarcrmAccount',attributes,{'tableName':_0x18bd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6f0=['bluebird','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','../../config/logger','moment'];(function(_0x2ef4fd,_0x352d66){var _0x535da7=function(_0x1e17e9){while(--_0x1e17e9){_0x2ef4fd['push'](_0x2ef4fd['shift']());}};_0x535da7(++_0x352d66);}(_0xf6f0,0xd6));var _0x0f6f=function(_0x1f78cb,_0x58e9f3){_0x1f78cb=_0x1f78cb-0x0;var _0x2cf6b8=_0xf6f0[_0x1f78cb];return _0x2cf6b8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0f6f('0x0'))('api');var moment=require(_0x0f6f('0x1'));var BPromise=require(_0x0f6f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f6f('0x3'));var rimraf=require(_0x0f6f('0x4'));var config=require(_0x0f6f('0x5'));var attributes=require(_0x0f6f('0x6'));var integrations=require(_0x0f6f('0x7'));module[_0x0f6f('0x8')]=function(_0xcaa10b,_0x429de7){return _0xcaa10b[_0x0f6f('0x9')](_0x0f6f('0xa'),attributes,{'tableName':_0x0f6f('0xb'),'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 f93343d..8ce73bc 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 _0x955d=['map','model','debug','ShowSugarcrmAccount','lodash','util','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','request','then','SugarcrmAccount,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x955d,0x1f4));var _0xd955=function(_0xad981,_0x536688){_0xad981=_0xad981-0x0;var _0x1fc46f=_0x955d[_0xad981];return _0x1fc46f;};'use strict';var _=require(_0xd955('0x0'));var util=require(_0xd955('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd955('0x2'));var fs=require('fs');var Redis=require(_0xd955('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd955('0x4'))(_0xd955('0x5'));var config=require('../../config/environment');var jayson=require(_0xd955('0x6'));var client=jayson[_0xd955('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a10de,_0x4de99d,_0x5cb3e7){return new BPromise(function(_0x56b02e,_0x8e55b5){return client[_0xd955('0x8')](_0x2a10de,_0x5cb3e7)[_0xd955('0x9')](function(_0x5bdb0a){logger['info'](_0xd955('0xa'),_0x4de99d,'request\x20sent');logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x4de99d,'request\x20sent',JSON[_0xd955('0xb')](_0x5bdb0a));if(_0x5bdb0a[_0xd955('0xc')]){if(_0x5bdb0a[_0xd955('0xc')]['code']===0x1f4){logger[_0xd955('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x4de99d,_0x5bdb0a[_0xd955('0xc')]['message']);return _0x8e55b5(_0x5bdb0a[_0xd955('0xc')][_0xd955('0xd')]);}logger[_0xd955('0xc')](_0xd955('0xa'),_0x4de99d,_0x5bdb0a[_0xd955('0xc')][_0xd955('0xd')]);return _0x56b02e(_0x5bdb0a['error']['message']);}else{logger[_0xd955('0xe')](_0xd955('0xa'),_0x4de99d,_0xd955('0xf'));_0x56b02e(_0x5bdb0a[_0xd955('0x10')]['message']);}})[_0xd955('0x11')](function(_0x118c0c){logger[_0xd955('0xc')](_0xd955('0xa'),_0x4de99d,_0x118c0c);_0x8e55b5(_0x118c0c);});});}exports[_0xd955('0x12')]=function(_0x2e6fd1){var _0x11bce6=this;return new Promise(function(_0x40a2c6,_0x3af597){return db[_0xd955('0x13')][_0xd955('0x14')]({'raw':_0x2e6fd1['options']?_0x2e6fd1[_0xd955('0x15')][_0xd955('0x16')]===undefined?!![]:![]:!![],'where':_0x2e6fd1[_0xd955('0x15')]?_0x2e6fd1[_0xd955('0x15')][_0xd955('0x17')]||null:null,'attributes':_0x2e6fd1[_0xd955('0x15')]?_0x2e6fd1['options'][_0xd955('0x18')]||null:null,'limit':_0x2e6fd1[_0xd955('0x15')]?_0x2e6fd1[_0xd955('0x15')][_0xd955('0x19')]||null:null,'include':_0x2e6fd1[_0xd955('0x15')]?_0x2e6fd1[_0xd955('0x15')][_0xd955('0x1a')]?_[_0xd955('0x1b')](_0x2e6fd1[_0xd955('0x15')][_0xd955('0x1a')],function(_0x3e9173){return{'model':db[_0x3e9173[_0xd955('0x1c')]],'as':_0x3e9173['as'],'attributes':_0x3e9173[_0xd955('0x18')],'include':_0x3e9173['include']?_[_0xd955('0x1b')](_0x3e9173[_0xd955('0x1a')],function(_0x357339){return{'model':db[_0x357339[_0xd955('0x1c')]],'as':_0x357339['as'],'attributes':_0x357339[_0xd955('0x18')],'include':_0x357339['include']?_[_0xd955('0x1b')](_0x357339['include'],function(_0x24f213){return{'model':db[_0x24f213[_0xd955('0x1c')]],'as':_0x24f213['as'],'attributes':_0x24f213[_0xd955('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1bb986){logger[_0xd955('0xe')](_0xd955('0x12'),_0x2e6fd1);logger[_0xd955('0x1d')](_0xd955('0x12'),_0x2e6fd1,JSON[_0xd955('0xb')](_0x1bb986));_0x40a2c6(_0x1bb986);})[_0xd955('0x11')](function(_0x175ce2){logger[_0xd955('0xc')](_0xd955('0x12'),_0x175ce2['message'],_0x2e6fd1);_0x3af597(_0x11bce6[_0xd955('0xc')](0x1f4,_0x175ce2['message']));});});};exports['ShowSugarcrmAccount']=function(_0x30fc4e){var _0x2da977=this;return new Promise(function(_0x44072a,_0x14a81b){return db[_0xd955('0x13')]['find']({'raw':_0x30fc4e[_0xd955('0x15')]?_0x30fc4e[_0xd955('0x15')][_0xd955('0x16')]===undefined?!![]:![]:!![],'where':_0x30fc4e[_0xd955('0x15')]?_0x30fc4e[_0xd955('0x15')][_0xd955('0x17')]||null:null,'attributes':_0x30fc4e[_0xd955('0x15')]?_0x30fc4e[_0xd955('0x15')][_0xd955('0x18')]||null:null,'include':_0x30fc4e[_0xd955('0x15')]?_0x30fc4e[_0xd955('0x15')]['include']?_[_0xd955('0x1b')](_0x30fc4e['options'][_0xd955('0x1a')],function(_0x1eb778){return{'model':db[_0x1eb778[_0xd955('0x1c')]],'as':_0x1eb778['as'],'attributes':_0x1eb778[_0xd955('0x18')],'include':_0x1eb778[_0xd955('0x1a')]?_[_0xd955('0x1b')](_0x1eb778['include'],function(_0x3f83cc){return{'model':db[_0x3f83cc[_0xd955('0x1c')]],'as':_0x3f83cc['as'],'attributes':_0x3f83cc[_0xd955('0x18')],'include':_0x3f83cc[_0xd955('0x1a')]?_['map'](_0x3f83cc[_0xd955('0x1a')],function(_0x347579){return{'model':db[_0x347579[_0xd955('0x1c')]],'as':_0x347579['as'],'attributes':_0x347579[_0xd955('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd955('0x9')](function(_0x49ace6){logger[_0xd955('0xe')]('ShowSugarcrmAccount',_0x30fc4e);logger[_0xd955('0x1d')](_0xd955('0x1e'),_0x30fc4e,JSON[_0xd955('0xb')](_0x49ace6));_0x44072a(_0x49ace6);})[_0xd955('0x11')](function(_0x445654){logger[_0xd955('0xc')]('ShowSugarcrmAccount',_0x445654[_0xd955('0xd')],_0x30fc4e);_0x14a81b(_0x2da977[_0xd955('0xc')](0x1f4,_0x445654['message']));});});}; \ No newline at end of file +var _0x08d5=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit','include','map','model','attributes','debug','stringify','catch','find','ShowSugarcrmAccount','lodash','util'];(function(_0x10d6f5,_0x140245){var _0x484db4=function(_0x2f7ec4){while(--_0x2f7ec4){_0x10d6f5['push'](_0x10d6f5['shift']());}};_0x484db4(++_0x140245);}(_0x08d5,0x1de));var _0x508d=function(_0xd39dbc,_0xedb09d){_0xd39dbc=_0xd39dbc-0x0;var _0x44e8ec=_0x08d5[_0xd39dbc];return _0x44e8ec;};'use strict';var _=require(_0x508d('0x0'));var util=require(_0x508d('0x1'));var moment=require(_0x508d('0x2'));var BPromise=require(_0x508d('0x3'));var rs=require(_0x508d('0x4'));var fs=require('fs');var Redis=require(_0x508d('0x5'));var db=require(_0x508d('0x6'))['db'];var utils=require(_0x508d('0x7'));var logger=require(_0x508d('0x8'))(_0x508d('0x9'));var config=require(_0x508d('0xa'));var jayson=require(_0x508d('0xb'));var client=jayson[_0x508d('0xc')][_0x508d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4278b7,_0x88451a,_0x56455a){return new BPromise(function(_0x4e6c21,_0x3f40a6){return client[_0x508d('0xe')](_0x4278b7,_0x56455a)[_0x508d('0xf')](function(_0xe6180){logger[_0x508d('0x10')](_0x508d('0x11'),_0x88451a,_0x508d('0x12'));logger['debug'](_0x508d('0x13'),_0x88451a,_0x508d('0x12'),JSON['stringify'](_0xe6180));if(_0xe6180[_0x508d('0x14')]){if(_0xe6180[_0x508d('0x14')][_0x508d('0x15')]===0x1f4){logger['error'](_0x508d('0x11'),_0x88451a,_0xe6180[_0x508d('0x14')][_0x508d('0x16')]);return _0x3f40a6(_0xe6180['error'][_0x508d('0x16')]);}logger[_0x508d('0x14')](_0x508d('0x11'),_0x88451a,_0xe6180['error']['message']);return _0x4e6c21(_0xe6180[_0x508d('0x14')][_0x508d('0x16')]);}else{logger[_0x508d('0x10')](_0x508d('0x11'),_0x88451a,_0x508d('0x12'));_0x4e6c21(_0xe6180[_0x508d('0x17')][_0x508d('0x16')]);}})['catch'](function(_0x1eeb77){logger[_0x508d('0x14')](_0x508d('0x11'),_0x88451a,_0x1eeb77);_0x3f40a6(_0x1eeb77);});});}exports[_0x508d('0x18')]=function(_0x4a7e29){var _0x2ab3a8=this;return new Promise(function(_0x5e1b1c,_0xe3623a){return db[_0x508d('0x19')][_0x508d('0x1a')]({'raw':_0x4a7e29[_0x508d('0x1b')]?_0x4a7e29[_0x508d('0x1b')][_0x508d('0x1c')]===undefined?!![]:![]:!![],'where':_0x4a7e29[_0x508d('0x1b')]?_0x4a7e29[_0x508d('0x1b')][_0x508d('0x1d')]||null:null,'attributes':_0x4a7e29[_0x508d('0x1b')]?_0x4a7e29['options']['attributes']||null:null,'limit':_0x4a7e29['options']?_0x4a7e29[_0x508d('0x1b')][_0x508d('0x1e')]||null:null,'include':_0x4a7e29[_0x508d('0x1b')]?_0x4a7e29[_0x508d('0x1b')][_0x508d('0x1f')]?_[_0x508d('0x20')](_0x4a7e29[_0x508d('0x1b')][_0x508d('0x1f')],function(_0x3321d1){return{'model':db[_0x3321d1[_0x508d('0x21')]],'as':_0x3321d1['as'],'attributes':_0x3321d1['attributes'],'include':_0x3321d1[_0x508d('0x1f')]?_[_0x508d('0x20')](_0x3321d1[_0x508d('0x1f')],function(_0x294069){return{'model':db[_0x294069[_0x508d('0x21')]],'as':_0x294069['as'],'attributes':_0x294069['attributes'],'include':_0x294069[_0x508d('0x1f')]?_[_0x508d('0x20')](_0x294069[_0x508d('0x1f')],function(_0x443460){return{'model':db[_0x443460[_0x508d('0x21')]],'as':_0x443460['as'],'attributes':_0x443460[_0x508d('0x22')]};}):[]};}):[]};}):[]:[]})[_0x508d('0xf')](function(_0x5ef9e0){logger[_0x508d('0x10')](_0x508d('0x18'),_0x4a7e29);logger[_0x508d('0x23')](_0x508d('0x18'),_0x4a7e29,JSON[_0x508d('0x24')](_0x5ef9e0));_0x5e1b1c(_0x5ef9e0);})[_0x508d('0x25')](function(_0x38e806){logger[_0x508d('0x14')](_0x508d('0x18'),_0x38e806[_0x508d('0x16')],_0x4a7e29);_0xe3623a(_0x2ab3a8['error'](0x1f4,_0x38e806[_0x508d('0x16')]));});});};exports['ShowSugarcrmAccount']=function(_0x2ce2fc){var _0xcb177c=this;return new Promise(function(_0x149a6b,_0x4594f8){return db['SugarcrmAccount'][_0x508d('0x26')]({'raw':_0x2ce2fc[_0x508d('0x1b')]?_0x2ce2fc['options']['raw']===undefined?!![]:![]:!![],'where':_0x2ce2fc[_0x508d('0x1b')]?_0x2ce2fc[_0x508d('0x1b')][_0x508d('0x1d')]||null:null,'attributes':_0x2ce2fc[_0x508d('0x1b')]?_0x2ce2fc[_0x508d('0x1b')]['attributes']||null:null,'include':_0x2ce2fc[_0x508d('0x1b')]?_0x2ce2fc[_0x508d('0x1b')][_0x508d('0x1f')]?_[_0x508d('0x20')](_0x2ce2fc[_0x508d('0x1b')][_0x508d('0x1f')],function(_0x4ae142){return{'model':db[_0x4ae142[_0x508d('0x21')]],'as':_0x4ae142['as'],'attributes':_0x4ae142[_0x508d('0x22')],'include':_0x4ae142[_0x508d('0x1f')]?_[_0x508d('0x20')](_0x4ae142['include'],function(_0xd16de9){return{'model':db[_0xd16de9[_0x508d('0x21')]],'as':_0xd16de9['as'],'attributes':_0xd16de9[_0x508d('0x22')],'include':_0xd16de9[_0x508d('0x1f')]?_[_0x508d('0x20')](_0xd16de9['include'],function(_0x5400ec){return{'model':db[_0x5400ec[_0x508d('0x21')]],'as':_0x5400ec['as'],'attributes':_0x5400ec['attributes']};}):[]};}):[]};}):[]:[]})[_0x508d('0xf')](function(_0x1057a2){logger['info'](_0x508d('0x27'),_0x2ce2fc);logger['debug'](_0x508d('0x27'),_0x2ce2fc,JSON[_0x508d('0x24')](_0x1057a2));_0x149a6b(_0x1057a2);})['catch'](function(_0x535457){logger[_0x508d('0x14')]('ShowSugarcrmAccount',_0x535457['message'],_0x2ce2fc);_0x4594f8(_0xcb177c[_0x508d('0x14')](0x1f4,_0x535457[_0x508d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index a48f146..e14ac69 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 _0xedbd=['../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','post','put','update','delete','exports','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x23ff64,_0x37693e){var _0x57f661=function(_0x1c38f2){while(--_0x1c38f2){_0x23ff64['push'](_0x23ff64['shift']());}};_0x57f661(++_0x37693e);}(_0xedbd,0x1ea));var _0xdedb=function(_0x384e10,_0xcff9ef){_0x384e10=_0x384e10-0x0;var _0x2537e4=_0xedbd[_0x384e10];return _0x2537e4;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xdedb('0x0'));var express=require('express');var router=express[_0xdedb('0x1')]();var fs_extra=require(_0xdedb('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xdedb('0x3'));var config=require(_0xdedb('0x4'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xdedb('0x5')]('/',auth[_0xdedb('0x6')](),controller[_0xdedb('0x7')]);router[_0xdedb('0x5')](_0xdedb('0x8'),auth[_0xdedb('0x6')](),controller[_0xdedb('0x9')]);router[_0xdedb('0x5')](_0xdedb('0xa'),auth['isAuthenticated'](),controller[_0xdedb('0xb')]);router[_0xdedb('0x5')](_0xdedb('0xc'),auth[_0xdedb('0x6')](),controller['getSubjects']);router['get'](_0xdedb('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xdedb('0xe')]('/',auth[_0xdedb('0x6')](),controller['create']);router[_0xdedb('0xf')](_0xdedb('0x8'),auth[_0xdedb('0x6')](),controller[_0xdedb('0x10')]);router[_0xdedb('0x11')](_0xdedb('0x8'),auth[_0xdedb('0x6')](),controller['destroy']);module[_0xdedb('0x12')]=router; \ No newline at end of file +var _0x8bb9=['get','/:id','/:id/fields','getSubjects','/:id/descriptions','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','index'];(function(_0x26d8b7,_0x134562){var _0x3af626=function(_0x4e66b4){while(--_0x4e66b4){_0x26d8b7['push'](_0x26d8b7['shift']());}};_0x3af626(++_0x134562);}(_0x8bb9,0x69));var _0x98bb=function(_0x3dc68d,_0x1c1951){_0x3dc68d=_0x3dc68d-0x0;var _0xdf7f94=_0x8bb9[_0x3dc68d];return _0xdf7f94;};'use strict';var multer=require(_0x98bb('0x0'));var util=require(_0x98bb('0x1'));var path=require(_0x98bb('0x2'));var timeout=require(_0x98bb('0x3'));var express=require(_0x98bb('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x98bb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x98bb('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth[_0x98bb('0x7')](),controller[_0x98bb('0x8')]);router[_0x98bb('0x9')](_0x98bb('0xa'),auth[_0x98bb('0x7')](),controller['show']);router[_0x98bb('0x9')](_0x98bb('0xb'),auth[_0x98bb('0x7')](),controller['getFields']);router[_0x98bb('0x9')]('/:id/subjects',auth[_0x98bb('0x7')](),controller[_0x98bb('0xc')]);router[_0x98bb('0x9')](_0x98bb('0xd'),auth[_0x98bb('0x7')](),controller['getDescriptions']);router[_0x98bb('0xe')]('/',auth[_0x98bb('0x7')](),controller[_0x98bb('0xf')]);router[_0x98bb('0x10')]('/:id',auth[_0x98bb('0x7')](),controller['update']);router[_0x98bb('0x11')](_0x98bb('0xa'),auth[_0x98bb('0x7')](),controller[_0x98bb('0x12')]);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 e8611cb..d7d2550 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 _0x3671=['exports','STRING','sequelize'];(function(_0x32dbad,_0x355f11){var _0x5b4991=function(_0xe27054){while(--_0xe27054){_0x32dbad['push'](_0x32dbad['shift']());}};_0x5b4991(++_0x355f11);}(_0x3671,0x7a));var _0x1367=function(_0x5f76e3,_0x977880){_0x5f76e3=_0x5f76e3-0x0;var _0x4a5558=_0x3671[_0x5f76e3];return _0x4a5558;};'use strict';var Sequelize=require(_0x1367('0x0'));module[_0x1367('0x1')]={'name':{'type':Sequelize[_0x1367('0x2')]},'description':{'type':Sequelize[_0x1367('0x2')]}}; \ No newline at end of file +var _0xadac=['sequelize','exports','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xadac,0x81));var _0xcada=function(_0x506172,_0xbc3a3){_0x506172=_0x506172-0x0;var _0x2723c0=_0xadac[_0x506172];return _0x2723c0;};'use strict';var Sequelize=require(_0xcada('0x0'));module[_0xcada('0x1')]={'name':{'type':Sequelize[_0xcada('0x2')]},'description':{'type':Sequelize[_0xcada('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 68ffff8..0ba1874 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 _0xb245=['count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','SugarcrmConfiguration','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','include','find','create','body','destroy','SugarcrmField','rawAttributes','getFields','hasOwnProperty','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','offset'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb245,0x1e1));var _0x5b24=function(_0x3910a7,_0x3a8eb8){_0x3910a7=_0x3910a7-0x0;var _0x15095a=_0xb245[_0x3910a7];return _0x15095a;};'use strict';var emlformat=require(_0x5b24('0x0'));var rimraf=require(_0x5b24('0x1'));var zipdir=require(_0x5b24('0x2'));var jsonpatch=require(_0x5b24('0x3'));var rp=require(_0x5b24('0x4'));var moment=require(_0x5b24('0x5'));var BPromise=require(_0x5b24('0x6'));var Mustache=require(_0x5b24('0x7'));var util=require(_0x5b24('0x8'));var path=require(_0x5b24('0x9'));var sox=require(_0x5b24('0xa'));var csv=require('to-csv');var ejs=require(_0x5b24('0xb'));var fs=require('fs');var fs_extra=require(_0x5b24('0xc'));var _=require(_0x5b24('0xd'));var squel=require(_0x5b24('0xe'));var crypto=require(_0x5b24('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x5b24('0x10'));var toCsv=require(_0x5b24('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5b24('0x12'));var authService=require(_0x5b24('0x13'));var qs=require(_0x5b24('0x14'));var as=require(_0x5b24('0x15'));var hardwareService=require(_0x5b24('0x16'));var logger=require(_0x5b24('0x17'))(_0x5b24('0x18'));var utils=require(_0x5b24('0x19'));var config=require(_0x5b24('0x1a'));var licenseUtil=require(_0x5b24('0x1b'));var db=require(_0x5b24('0x1c'))['db'];function respondWithStatusCode(_0x2cf9ff,_0x5c25f3){_0x5c25f3=_0x5c25f3||0xcc;return function(_0x1933be){if(_0x1933be){return _0x2cf9ff[_0x5b24('0x1d')](_0x5c25f3);}return _0x2cf9ff['status'](_0x5c25f3)[_0x5b24('0x1e')]();};}function respondWithResult(_0x2e9e13,_0x4d5432){_0x4d5432=_0x4d5432||0xc8;return function(_0xefc9eb){if(_0xefc9eb){return _0x2e9e13[_0x5b24('0x1f')](_0x4d5432)[_0x5b24('0x20')](_0xefc9eb);}};}function respondWithFilteredResult(_0x44422b,_0x368079){return function(_0x2be052){if(_0x2be052){var _0x294279=typeof _0x368079['offset']===_0x5b24('0x21')&&typeof _0x368079['limit']===_0x5b24('0x21');var _0xf8b61c=_0x2be052['count'];var _0x4dd14f=_0x294279?0x0:_0x368079[_0x5b24('0x22')];var _0x361300=_0x294279?_0x2be052[_0x5b24('0x23')]:_0x368079[_0x5b24('0x22')]+_0x368079[_0x5b24('0x24')];var _0x1e0933;if(_0x361300>=_0xf8b61c){_0x361300=_0xf8b61c;_0x1e0933=0xc8;}else{_0x1e0933=0xce;}_0x44422b[_0x5b24('0x1f')](_0x1e0933);return _0x44422b[_0x5b24('0x25')](_0x5b24('0x26'),_0x4dd14f+'-'+_0x361300+'/'+_0xf8b61c)[_0x5b24('0x20')](_0x2be052);}return null;};}function patchUpdates(_0x377818){return function(_0x2cb2df){try{jsonpatch[_0x5b24('0x27')](_0x2cb2df,_0x377818,!![]);}catch(_0x6ff458){return BPromise[_0x5b24('0x28')](_0x6ff458);}return _0x2cb2df[_0x5b24('0x29')]();};}function saveUpdates(_0x3096ba,_0x5bb1da){return function(_0x58ae9f){if(_0x58ae9f){return _0x58ae9f[_0x5b24('0x2a')](_0x3096ba)[_0x5b24('0x2b')](function(_0x3b3f43){return _0x3b3f43;});}return null;};}function removeEntity(_0x493965,_0x2e74b9){return function(_0x376f4d){if(_0x376f4d){return _0x376f4d['destroy']()[_0x5b24('0x2b')](function(){_0x493965['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5950fa,_0x1f9d6c){return function(_0x4f0a7a){if(!_0x4f0a7a){_0x5950fa[_0x5b24('0x1d')](0x194);}return _0x4f0a7a;};}function handleError(_0x464087,_0x2ed9ce){_0x2ed9ce=_0x2ed9ce||0x1f4;return function(_0x47a277){logger[_0x5b24('0x2c')](_0x47a277[_0x5b24('0x2d')]);if(_0x47a277['name']){delete _0x47a277[_0x5b24('0x2e')];}_0x464087[_0x5b24('0x1f')](_0x2ed9ce)['send'](_0x47a277);};}exports[_0x5b24('0x2f')]=function(_0x56e091,_0x3ffa62){var _0x44b6c0={},_0x36643d={},_0x487ffa={'count':0x0,'rows':[]};var _0xa8e000=_[_0x5b24('0x30')](db[_0x5b24('0x31')]['rawAttributes'],function(_0x1c1a27){return{'name':_0x1c1a27[_0x5b24('0x32')],'type':_0x1c1a27[_0x5b24('0x33')][_0x5b24('0x34')]};});_0x36643d[_0x5b24('0x35')]=_[_0x5b24('0x30')](_0xa8e000,_0x5b24('0x2e'));_0x36643d[_0x5b24('0x36')]=_[_0x5b24('0x37')](_0x56e091[_0x5b24('0x36')]);_0x36643d[_0x5b24('0x38')]=_['intersection'](_0x36643d[_0x5b24('0x35')],_0x36643d['query']);_0x44b6c0[_0x5b24('0x39')]=_[_0x5b24('0x3a')](_0x36643d[_0x5b24('0x35')],qs[_0x5b24('0x3b')](_0x56e091['query']['fields']));_0x44b6c0[_0x5b24('0x39')]=_0x44b6c0[_0x5b24('0x39')][_0x5b24('0x3c')]?_0x44b6c0[_0x5b24('0x39')]:_0x36643d['model'];if(!_0x56e091[_0x5b24('0x36')]['hasOwnProperty'](_0x5b24('0x3d'))){_0x44b6c0[_0x5b24('0x24')]=qs[_0x5b24('0x24')](_0x56e091['query']['limit']);_0x44b6c0[_0x5b24('0x22')]=qs[_0x5b24('0x22')](_0x56e091[_0x5b24('0x36')][_0x5b24('0x22')]);}_0x44b6c0[_0x5b24('0x3e')]=qs[_0x5b24('0x3f')](_0x56e091['query'][_0x5b24('0x3f')]);_0x44b6c0[_0x5b24('0x40')]=qs[_0x5b24('0x38')](_[_0x5b24('0x41')](_0x56e091[_0x5b24('0x36')],_0x36643d[_0x5b24('0x38')]),_0xa8e000);if(_0x56e091[_0x5b24('0x36')][_0x5b24('0x42')]){_0x44b6c0[_0x5b24('0x40')]=_['merge'](_0x44b6c0[_0x5b24('0x40')],{'$or':_['map'](_0xa8e000,function(_0x52e3b8){if(_0x52e3b8[_0x5b24('0x33')]!=='VIRTUAL'){var _0x3278a5={};_0x3278a5[_0x52e3b8[_0x5b24('0x2e')]]={'$like':'%'+_0x56e091[_0x5b24('0x36')][_0x5b24('0x42')]+'%'};return _0x3278a5;}})});}_0x44b6c0=_[_0x5b24('0x43')]({},_0x44b6c0,_0x56e091[_0x5b24('0x44')]);var _0x4b0d76={'where':_0x44b6c0[_0x5b24('0x40')]};return db[_0x5b24('0x31')][_0x5b24('0x23')](_0x4b0d76)[_0x5b24('0x2b')](function(_0x55b83e){_0x487ffa['count']=_0x55b83e;if(_0x56e091[_0x5b24('0x36')][_0x5b24('0x45')]){_0x44b6c0['include']=[{'all':!![]}];}return db[_0x5b24('0x31')][_0x5b24('0x46')](_0x44b6c0);})[_0x5b24('0x2b')](function(_0x28f250){_0x487ffa['rows']=_0x28f250;return _0x487ffa;})[_0x5b24('0x2b')](respondWithFilteredResult(_0x3ffa62,_0x44b6c0))[_0x5b24('0x47')](handleError(_0x3ffa62,null));};exports[_0x5b24('0x48')]=function(_0x2ca653,_0x575bc8){var _0x4da18f={'raw':![],'where':{'id':_0x2ca653[_0x5b24('0x49')]['id']}},_0x51c07e={};_0x51c07e[_0x5b24('0x35')]=_[_0x5b24('0x37')](db[_0x5b24('0x31')]['rawAttributes']);_0x51c07e['query']=_[_0x5b24('0x37')](_0x2ca653['query']);_0x51c07e[_0x5b24('0x38')]=_[_0x5b24('0x3a')](_0x51c07e[_0x5b24('0x35')],_0x51c07e[_0x5b24('0x36')]);_0x4da18f[_0x5b24('0x39')]=_[_0x5b24('0x3a')](_0x51c07e[_0x5b24('0x35')],qs[_0x5b24('0x3b')](_0x2ca653[_0x5b24('0x36')][_0x5b24('0x3b')]));_0x4da18f[_0x5b24('0x39')]=_0x4da18f[_0x5b24('0x39')]['length']?_0x4da18f['attributes']:_0x51c07e[_0x5b24('0x35')];if(_0x2ca653[_0x5b24('0x36')][_0x5b24('0x45')]){_0x4da18f[_0x5b24('0x4a')]=[{'all':!![]}];}_0x4da18f=_[_0x5b24('0x43')]({},_0x4da18f,_0x2ca653[_0x5b24('0x44')]);return db[_0x5b24('0x31')][_0x5b24('0x4b')](_0x4da18f)[_0x5b24('0x2b')](handleEntityNotFound(_0x575bc8,null))[_0x5b24('0x2b')](respondWithResult(_0x575bc8,null))[_0x5b24('0x47')](handleError(_0x575bc8,null));};exports[_0x5b24('0x4c')]=function(_0x6942e4,_0x2e73ad){return db['SugarcrmConfiguration']['create'](_0x6942e4[_0x5b24('0x4d')],{})[_0x5b24('0x2b')](respondWithResult(_0x2e73ad,0xc9))['catch'](handleError(_0x2e73ad,null));};exports['update']=function(_0x407e65,_0xfa9f2f){if(_0x407e65[_0x5b24('0x4d')]['id']){delete _0x407e65['body']['id'];}return db['SugarcrmConfiguration'][_0x5b24('0x4b')]({'where':{'id':_0x407e65[_0x5b24('0x49')]['id']}})[_0x5b24('0x2b')](handleEntityNotFound(_0xfa9f2f,null))[_0x5b24('0x2b')](saveUpdates(_0x407e65[_0x5b24('0x4d')],null))[_0x5b24('0x2b')](respondWithResult(_0xfa9f2f,null))['catch'](handleError(_0xfa9f2f,null));};exports[_0x5b24('0x4e')]=function(_0x4ef771,_0xfd2b94){return db[_0x5b24('0x31')][_0x5b24('0x4b')]({'where':{'id':_0x4ef771[_0x5b24('0x49')]['id']}})[_0x5b24('0x2b')](handleEntityNotFound(_0xfd2b94,null))['then'](removeEntity(_0xfd2b94,null))[_0x5b24('0x47')](handleError(_0xfd2b94,null));};exports['getFields']=function(_0x1c9014,_0x576eb6,_0x4039c6){var _0x519852={};var _0x2eda44={};var _0x5f1375;var _0x2bf3f0;return db[_0x5b24('0x31')]['findOne']({'where':{'id':_0x1c9014[_0x5b24('0x49')]['id']}})['then'](handleEntityNotFound(_0x576eb6,null))[_0x5b24('0x2b')](function(_0x6b1615){if(_0x6b1615){_0x5f1375=_0x6b1615;_0x2eda44[_0x5b24('0x35')]=_[_0x5b24('0x37')](db[_0x5b24('0x4f')][_0x5b24('0x50')]);_0x2eda44[_0x5b24('0x36')]=_[_0x5b24('0x37')](_0x1c9014[_0x5b24('0x36')]);_0x2eda44[_0x5b24('0x38')]=_['intersection'](_0x2eda44['model'],_0x2eda44[_0x5b24('0x36')]);_0x519852['attributes']=_[_0x5b24('0x3a')](_0x2eda44['model'],qs[_0x5b24('0x3b')](_0x1c9014[_0x5b24('0x36')]['fields']));_0x519852[_0x5b24('0x39')]=_0x519852[_0x5b24('0x39')][_0x5b24('0x3c')]?_0x519852['attributes']:_0x2eda44[_0x5b24('0x35')];_0x519852[_0x5b24('0x3e')]=qs['sort'](_0x1c9014[_0x5b24('0x36')][_0x5b24('0x3f')]);_0x519852[_0x5b24('0x40')]=qs[_0x5b24('0x38')](_[_0x5b24('0x41')](_0x1c9014['query'],_0x2eda44[_0x5b24('0x38')]));if(_0x1c9014['query']['filter']){_0x519852[_0x5b24('0x40')]=_['merge'](_0x519852[_0x5b24('0x40')],{'$or':_[_0x5b24('0x30')](_0x519852[_0x5b24('0x39')],function(_0x54a8e6){var _0x201a47={};_0x201a47[_0x54a8e6]={'$like':'%'+_0x1c9014['query']['filter']+'%'};return _0x201a47;})});}_0x519852=_[_0x5b24('0x43')]({},_0x519852,_0x1c9014[_0x5b24('0x44')]);return _0x5f1375[_0x5b24('0x51')](_0x519852);}})['then'](function(_0xad5d09){if(_0xad5d09){_0x2bf3f0=_0xad5d09[_0x5b24('0x3c')];if(!_0x1c9014[_0x5b24('0x36')][_0x5b24('0x52')](_0x5b24('0x3d'))){_0x519852[_0x5b24('0x24')]=qs[_0x5b24('0x24')](_0x1c9014[_0x5b24('0x36')][_0x5b24('0x24')]);_0x519852['offset']=qs['offset'](_0x1c9014['query'][_0x5b24('0x22')]);}return _0x5f1375['getFields'](_0x519852);}})[_0x5b24('0x2b')](function(_0x41e8fd){if(_0x41e8fd){return _0x41e8fd?{'count':_0x2bf3f0,'rows':_0x41e8fd}:null;}})['then'](respondWithResult(_0x576eb6,null))['catch'](handleError(_0x576eb6,null));};exports['getSubjects']=function(_0x46b58e,_0x464ad9,_0x1ab8c8){var _0x417e19={};var _0xdbe24={};var _0x4b5349;var _0x251d93;return db[_0x5b24('0x31')][_0x5b24('0x53')]({'where':{'id':_0x46b58e[_0x5b24('0x49')]['id']}})['then'](handleEntityNotFound(_0x464ad9,null))['then'](function(_0xc7f3bf){if(_0xc7f3bf){_0x4b5349=_0xc7f3bf;_0xdbe24['model']=_[_0x5b24('0x37')](db[_0x5b24('0x4f')][_0x5b24('0x50')]);_0xdbe24[_0x5b24('0x36')]=_[_0x5b24('0x37')](_0x46b58e[_0x5b24('0x36')]);_0xdbe24[_0x5b24('0x38')]=_[_0x5b24('0x3a')](_0xdbe24['model'],_0xdbe24[_0x5b24('0x36')]);_0x417e19[_0x5b24('0x39')]=_[_0x5b24('0x3a')](_0xdbe24[_0x5b24('0x35')],qs[_0x5b24('0x3b')](_0x46b58e[_0x5b24('0x36')]['fields']));_0x417e19[_0x5b24('0x39')]=_0x417e19[_0x5b24('0x39')][_0x5b24('0x3c')]?_0x417e19[_0x5b24('0x39')]:_0xdbe24[_0x5b24('0x35')];_0x417e19[_0x5b24('0x3e')]=qs['sort'](_0x46b58e[_0x5b24('0x36')][_0x5b24('0x3f')]);_0x417e19[_0x5b24('0x40')]=qs[_0x5b24('0x38')](_['pick'](_0x46b58e[_0x5b24('0x36')],_0xdbe24['filters']));if(_0x46b58e[_0x5b24('0x36')][_0x5b24('0x42')]){_0x417e19[_0x5b24('0x40')]=_[_0x5b24('0x43')](_0x417e19['where'],{'$or':_[_0x5b24('0x30')](_0x417e19[_0x5b24('0x39')],function(_0x4fe3f5){var _0x1ed1e3={};_0x1ed1e3[_0x4fe3f5]={'$like':'%'+_0x46b58e['query'][_0x5b24('0x42')]+'%'};return _0x1ed1e3;})});}_0x417e19=_[_0x5b24('0x43')]({},_0x417e19,_0x46b58e[_0x5b24('0x44')]);return _0x4b5349[_0x5b24('0x54')](_0x417e19);}})[_0x5b24('0x2b')](function(_0x2f65f0){if(_0x2f65f0){_0x251d93=_0x2f65f0[_0x5b24('0x3c')];if(!_0x46b58e[_0x5b24('0x36')][_0x5b24('0x52')](_0x5b24('0x3d'))){_0x417e19[_0x5b24('0x24')]=qs[_0x5b24('0x24')](_0x46b58e[_0x5b24('0x36')]['limit']);_0x417e19[_0x5b24('0x22')]=qs[_0x5b24('0x22')](_0x46b58e[_0x5b24('0x36')]['offset']);}return _0x4b5349[_0x5b24('0x54')](_0x417e19);}})['then'](function(_0xff64aa){if(_0xff64aa){return _0xff64aa?{'count':_0x251d93,'rows':_0xff64aa}:null;}})[_0x5b24('0x2b')](respondWithResult(_0x464ad9,null))[_0x5b24('0x47')](handleError(_0x464ad9,null));};exports[_0x5b24('0x55')]=function(_0x3463a3,_0x40b076,_0x34642f){var _0x3f9828={};var _0x4dc64a={};var _0x295aa7;var _0x8e901d;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x3463a3[_0x5b24('0x49')]['id']}})[_0x5b24('0x2b')](handleEntityNotFound(_0x40b076,null))[_0x5b24('0x2b')](function(_0x2c3b24){if(_0x2c3b24){_0x295aa7=_0x2c3b24;_0x4dc64a['model']=_['keys'](db[_0x5b24('0x4f')][_0x5b24('0x50')]);_0x4dc64a[_0x5b24('0x36')]=_[_0x5b24('0x37')](_0x3463a3[_0x5b24('0x36')]);_0x4dc64a[_0x5b24('0x38')]=_['intersection'](_0x4dc64a[_0x5b24('0x35')],_0x4dc64a['query']);_0x3f9828['attributes']=_[_0x5b24('0x3a')](_0x4dc64a['model'],qs[_0x5b24('0x3b')](_0x3463a3['query'][_0x5b24('0x3b')]));_0x3f9828[_0x5b24('0x39')]=_0x3f9828[_0x5b24('0x39')]['length']?_0x3f9828[_0x5b24('0x39')]:_0x4dc64a[_0x5b24('0x35')];_0x3f9828[_0x5b24('0x3e')]=qs[_0x5b24('0x3f')](_0x3463a3[_0x5b24('0x36')][_0x5b24('0x3f')]);_0x3f9828[_0x5b24('0x40')]=qs[_0x5b24('0x38')](_[_0x5b24('0x41')](_0x3463a3[_0x5b24('0x36')],_0x4dc64a[_0x5b24('0x38')]));if(_0x3463a3[_0x5b24('0x36')]['filter']){_0x3f9828[_0x5b24('0x40')]=_[_0x5b24('0x43')](_0x3f9828[_0x5b24('0x40')],{'$or':_['map'](_0x3f9828[_0x5b24('0x39')],function(_0x3db09e){var _0x2d520b={};_0x2d520b[_0x3db09e]={'$like':'%'+_0x3463a3[_0x5b24('0x36')][_0x5b24('0x42')]+'%'};return _0x2d520b;})});}_0x3f9828=_[_0x5b24('0x43')]({},_0x3f9828,_0x3463a3[_0x5b24('0x44')]);return _0x295aa7[_0x5b24('0x55')](_0x3f9828);}})[_0x5b24('0x2b')](function(_0x4912e8){if(_0x4912e8){_0x8e901d=_0x4912e8['length'];if(!_0x3463a3[_0x5b24('0x36')][_0x5b24('0x52')](_0x5b24('0x3d'))){_0x3f9828[_0x5b24('0x24')]=qs[_0x5b24('0x24')](_0x3463a3[_0x5b24('0x36')]['limit']);_0x3f9828[_0x5b24('0x22')]=qs['offset'](_0x3463a3[_0x5b24('0x36')]['offset']);}return _0x295aa7[_0x5b24('0x55')](_0x3f9828);}})[_0x5b24('0x2b')](function(_0x34bccb){if(_0x34bccb){return _0x34bccb?{'count':_0x8e901d,'rows':_0x34bccb}:null;}})[_0x5b24('0x2b')](respondWithResult(_0x40b076,null))['catch'](handleError(_0x40b076,null));}; \ No newline at end of file +var _0x98a1=['../../mysqldb','sendStatus','status','json','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','fields','include','options','find','body','getFields','findOne','pick','getSubjects','SugarcrmField','getDescriptions','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0xcba883,_0x1c81c0){var _0x2273ac=function(_0x2a6fc2){while(--_0x2a6fc2){_0xcba883['push'](_0xcba883['shift']());}};_0x2273ac(++_0x1c81c0);}(_0x98a1,0x127));var _0x198a=function(_0xb0d4e9,_0x48dfd9){_0xb0d4e9=_0xb0d4e9-0x0;var _0x4a27e8=_0x98a1[_0xb0d4e9];return _0x4a27e8;};'use strict';var emlformat=require(_0x198a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x198a('0x1'));var moment=require(_0x198a('0x2'));var BPromise=require(_0x198a('0x3'));var Mustache=require(_0x198a('0x4'));var util=require(_0x198a('0x5'));var path=require(_0x198a('0x6'));var sox=require(_0x198a('0x7'));var csv=require(_0x198a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x198a('0x9'));var _=require(_0x198a('0xa'));var squel=require(_0x198a('0xb'));var crypto=require(_0x198a('0xc'));var jsforce=require(_0x198a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x198a('0x8'));var querystring=require(_0x198a('0xe'));var Papa=require(_0x198a('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x198a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x198a('0x11'))(_0x198a('0x12'));var utils=require(_0x198a('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x198a('0x14'));var db=require(_0x198a('0x15'))['db'];function respondWithStatusCode(_0x2a8255,_0x362b0c){_0x362b0c=_0x362b0c||0xcc;return function(_0x319c14){if(_0x319c14){return _0x2a8255[_0x198a('0x16')](_0x362b0c);}return _0x2a8255[_0x198a('0x17')](_0x362b0c)['end']();};}function respondWithResult(_0x5e469b,_0x26f0e7){_0x26f0e7=_0x26f0e7||0xc8;return function(_0x235002){if(_0x235002){return _0x5e469b['status'](_0x26f0e7)[_0x198a('0x18')](_0x235002);}};}function respondWithFilteredResult(_0x4ef660,_0x34f5e2){return function(_0x477f42){if(_0x477f42){var _0x50b58f=typeof _0x34f5e2[_0x198a('0x19')]==='undefined'&&typeof _0x34f5e2['limit']===_0x198a('0x1a');var _0x4ac0fa=_0x477f42[_0x198a('0x1b')];var _0x3f6f3a=_0x50b58f?0x0:_0x34f5e2['offset'];var _0x2d58ea=_0x50b58f?_0x477f42['count']:_0x34f5e2[_0x198a('0x19')]+_0x34f5e2['limit'];var _0x1fe46d;if(_0x2d58ea>=_0x4ac0fa){_0x2d58ea=_0x4ac0fa;_0x1fe46d=0xc8;}else{_0x1fe46d=0xce;}_0x4ef660[_0x198a('0x17')](_0x1fe46d);return _0x4ef660['set'](_0x198a('0x1c'),_0x3f6f3a+'-'+_0x2d58ea+'/'+_0x4ac0fa)[_0x198a('0x18')](_0x477f42);}return null;};}function patchUpdates(_0x3808b1){return function(_0xedfb7f){try{jsonpatch[_0x198a('0x1d')](_0xedfb7f,_0x3808b1,!![]);}catch(_0x42e92d){return BPromise[_0x198a('0x1e')](_0x42e92d);}return _0xedfb7f[_0x198a('0x1f')]();};}function saveUpdates(_0x3e4f55,_0x41e406){return function(_0x1ddc6f){if(_0x1ddc6f){return _0x1ddc6f[_0x198a('0x20')](_0x3e4f55)['then'](function(_0x270af5){return _0x270af5;});}return null;};}function removeEntity(_0x4373a0,_0x577f47){return function(_0xb8c7b8){if(_0xb8c7b8){return _0xb8c7b8[_0x198a('0x21')]()[_0x198a('0x22')](function(){_0x4373a0['status'](0xcc)[_0x198a('0x23')]();});}};}function handleEntityNotFound(_0x4d3392,_0x39feb9){return function(_0x176d8f){if(!_0x176d8f){_0x4d3392[_0x198a('0x16')](0x194);}return _0x176d8f;};}function handleError(_0x585fcc,_0x2dac94){_0x2dac94=_0x2dac94||0x1f4;return function(_0x1c13ee){logger[_0x198a('0x24')](_0x1c13ee[_0x198a('0x25')]);if(_0x1c13ee['name']){delete _0x1c13ee['name'];}_0x585fcc[_0x198a('0x17')](_0x2dac94)[_0x198a('0x26')](_0x1c13ee);};}exports['index']=function(_0x26aca5,_0x24f665){var _0x106ee8={},_0xbe773f={},_0x341076={'count':0x0,'rows':[]};var _0x2df731=_[_0x198a('0x27')](db[_0x198a('0x28')][_0x198a('0x29')],function(_0x40403a){return{'name':_0x40403a[_0x198a('0x2a')],'type':_0x40403a[_0x198a('0x2b')][_0x198a('0x2c')]};});_0xbe773f[_0x198a('0x2d')]=_[_0x198a('0x27')](_0x2df731,_0x198a('0x2e'));_0xbe773f[_0x198a('0x2f')]=_[_0x198a('0x30')](_0x26aca5[_0x198a('0x2f')]);_0xbe773f[_0x198a('0x31')]=_[_0x198a('0x32')](_0xbe773f[_0x198a('0x2d')],_0xbe773f[_0x198a('0x2f')]);_0x106ee8[_0x198a('0x33')]=_[_0x198a('0x32')](_0xbe773f[_0x198a('0x2d')],qs['fields'](_0x26aca5[_0x198a('0x2f')]['fields']));_0x106ee8[_0x198a('0x33')]=_0x106ee8[_0x198a('0x33')][_0x198a('0x34')]?_0x106ee8[_0x198a('0x33')]:_0xbe773f[_0x198a('0x2d')];if(!_0x26aca5[_0x198a('0x2f')][_0x198a('0x35')](_0x198a('0x36'))){_0x106ee8['limit']=qs[_0x198a('0x37')](_0x26aca5[_0x198a('0x2f')][_0x198a('0x37')]);_0x106ee8['offset']=qs[_0x198a('0x19')](_0x26aca5[_0x198a('0x2f')][_0x198a('0x19')]);}_0x106ee8[_0x198a('0x38')]=qs[_0x198a('0x39')](_0x26aca5[_0x198a('0x2f')][_0x198a('0x39')]);_0x106ee8[_0x198a('0x3a')]=qs[_0x198a('0x31')](_['pick'](_0x26aca5['query'],_0xbe773f[_0x198a('0x31')]),_0x2df731);if(_0x26aca5[_0x198a('0x2f')][_0x198a('0x3b')]){_0x106ee8[_0x198a('0x3a')]=_[_0x198a('0x3c')](_0x106ee8[_0x198a('0x3a')],{'$or':_[_0x198a('0x27')](_0x2df731,function(_0x51f574){if(_0x51f574[_0x198a('0x2b')]!==_0x198a('0x3d')){var _0x17a81c={};_0x17a81c[_0x51f574['name']]={'$like':'%'+_0x26aca5['query'][_0x198a('0x3b')]+'%'};return _0x17a81c;}})});}_0x106ee8=_[_0x198a('0x3c')]({},_0x106ee8,_0x26aca5['options']);var _0x4e432e={'where':_0x106ee8['where']};return db['SugarcrmConfiguration']['count'](_0x4e432e)[_0x198a('0x22')](function(_0xc7644b){_0x341076[_0x198a('0x1b')]=_0xc7644b;if(_0x26aca5['query'][_0x198a('0x3e')]){_0x106ee8['include']=[{'all':!![]}];}return db[_0x198a('0x28')][_0x198a('0x3f')](_0x106ee8);})[_0x198a('0x22')](function(_0x3ce5fb){_0x341076[_0x198a('0x40')]=_0x3ce5fb;return _0x341076;})['then'](respondWithFilteredResult(_0x24f665,_0x106ee8))[_0x198a('0x41')](handleError(_0x24f665,null));};exports[_0x198a('0x42')]=function(_0x3dc0bc,_0x114d4a){var _0x43bb2f={'raw':![],'where':{'id':_0x3dc0bc[_0x198a('0x43')]['id']}},_0x18af62={};_0x18af62[_0x198a('0x2d')]=_[_0x198a('0x30')](db[_0x198a('0x28')][_0x198a('0x29')]);_0x18af62[_0x198a('0x2f')]=_[_0x198a('0x30')](_0x3dc0bc[_0x198a('0x2f')]);_0x18af62['filters']=_[_0x198a('0x32')](_0x18af62[_0x198a('0x2d')],_0x18af62[_0x198a('0x2f')]);_0x43bb2f[_0x198a('0x33')]=_[_0x198a('0x32')](_0x18af62['model'],qs[_0x198a('0x44')](_0x3dc0bc[_0x198a('0x2f')][_0x198a('0x44')]));_0x43bb2f[_0x198a('0x33')]=_0x43bb2f[_0x198a('0x33')][_0x198a('0x34')]?_0x43bb2f['attributes']:_0x18af62[_0x198a('0x2d')];if(_0x3dc0bc[_0x198a('0x2f')]['includeAll']){_0x43bb2f[_0x198a('0x45')]=[{'all':!![]}];}_0x43bb2f=_[_0x198a('0x3c')]({},_0x43bb2f,_0x3dc0bc[_0x198a('0x46')]);return db[_0x198a('0x28')][_0x198a('0x47')](_0x43bb2f)[_0x198a('0x22')](handleEntityNotFound(_0x114d4a,null))[_0x198a('0x22')](respondWithResult(_0x114d4a,null))['catch'](handleError(_0x114d4a,null));};exports['create']=function(_0x2d2fef,_0x280762){return db[_0x198a('0x28')]['create'](_0x2d2fef['body'],{})['then'](respondWithResult(_0x280762,0xc9))[_0x198a('0x41')](handleError(_0x280762,null));};exports['update']=function(_0x441bc6,_0x43b457){if(_0x441bc6[_0x198a('0x48')]['id']){delete _0x441bc6[_0x198a('0x48')]['id'];}return db['SugarcrmConfiguration'][_0x198a('0x47')]({'where':{'id':_0x441bc6[_0x198a('0x43')]['id']}})[_0x198a('0x22')](handleEntityNotFound(_0x43b457,null))[_0x198a('0x22')](saveUpdates(_0x441bc6[_0x198a('0x48')],null))[_0x198a('0x22')](respondWithResult(_0x43b457,null))[_0x198a('0x41')](handleError(_0x43b457,null));};exports[_0x198a('0x21')]=function(_0x18e9ae,_0x1cf239){return db[_0x198a('0x28')][_0x198a('0x47')]({'where':{'id':_0x18e9ae[_0x198a('0x43')]['id']}})[_0x198a('0x22')](handleEntityNotFound(_0x1cf239,null))[_0x198a('0x22')](removeEntity(_0x1cf239,null))[_0x198a('0x41')](handleError(_0x1cf239,null));};exports[_0x198a('0x49')]=function(_0x292695,_0x32049c,_0x1fbb11){var _0x14aa90={};var _0x30041c={};var _0xfbb8d7;var _0x469d83;return db[_0x198a('0x28')][_0x198a('0x4a')]({'where':{'id':_0x292695['params']['id']}})[_0x198a('0x22')](handleEntityNotFound(_0x32049c,null))[_0x198a('0x22')](function(_0x5abf69){if(_0x5abf69){_0xfbb8d7=_0x5abf69;_0x30041c['model']=_['keys'](db['SugarcrmField'][_0x198a('0x29')]);_0x30041c[_0x198a('0x2f')]=_['keys'](_0x292695[_0x198a('0x2f')]);_0x30041c[_0x198a('0x31')]=_[_0x198a('0x32')](_0x30041c[_0x198a('0x2d')],_0x30041c[_0x198a('0x2f')]);_0x14aa90[_0x198a('0x33')]=_[_0x198a('0x32')](_0x30041c['model'],qs[_0x198a('0x44')](_0x292695[_0x198a('0x2f')][_0x198a('0x44')]));_0x14aa90[_0x198a('0x33')]=_0x14aa90['attributes'][_0x198a('0x34')]?_0x14aa90[_0x198a('0x33')]:_0x30041c[_0x198a('0x2d')];_0x14aa90['order']=qs['sort'](_0x292695[_0x198a('0x2f')][_0x198a('0x39')]);_0x14aa90[_0x198a('0x3a')]=qs[_0x198a('0x31')](_[_0x198a('0x4b')](_0x292695[_0x198a('0x2f')],_0x30041c[_0x198a('0x31')]));if(_0x292695[_0x198a('0x2f')][_0x198a('0x3b')]){_0x14aa90['where']=_[_0x198a('0x3c')](_0x14aa90['where'],{'$or':_[_0x198a('0x27')](_0x14aa90[_0x198a('0x33')],function(_0x1e7917){var _0x58c24c={};_0x58c24c[_0x1e7917]={'$like':'%'+_0x292695[_0x198a('0x2f')]['filter']+'%'};return _0x58c24c;})});}_0x14aa90=_[_0x198a('0x3c')]({},_0x14aa90,_0x292695[_0x198a('0x46')]);return _0xfbb8d7['getFields'](_0x14aa90);}})[_0x198a('0x22')](function(_0x284fa2){if(_0x284fa2){_0x469d83=_0x284fa2['length'];if(!_0x292695[_0x198a('0x2f')][_0x198a('0x35')]('nolimit')){_0x14aa90[_0x198a('0x37')]=qs['limit'](_0x292695[_0x198a('0x2f')][_0x198a('0x37')]);_0x14aa90[_0x198a('0x19')]=qs['offset'](_0x292695[_0x198a('0x2f')][_0x198a('0x19')]);}return _0xfbb8d7['getFields'](_0x14aa90);}})['then'](function(_0x5a6bf0){if(_0x5a6bf0){return _0x5a6bf0?{'count':_0x469d83,'rows':_0x5a6bf0}:null;}})['then'](respondWithResult(_0x32049c,null))['catch'](handleError(_0x32049c,null));};exports[_0x198a('0x4c')]=function(_0x309531,_0x58a63f,_0x52765b){var _0x230d36={};var _0x47af70={};var _0x38216f;var _0x9e55f1;return db[_0x198a('0x28')][_0x198a('0x4a')]({'where':{'id':_0x309531['params']['id']}})[_0x198a('0x22')](handleEntityNotFound(_0x58a63f,null))['then'](function(_0x55807c){if(_0x55807c){_0x38216f=_0x55807c;_0x47af70[_0x198a('0x2d')]=_['keys'](db[_0x198a('0x4d')]['rawAttributes']);_0x47af70[_0x198a('0x2f')]=_[_0x198a('0x30')](_0x309531[_0x198a('0x2f')]);_0x47af70[_0x198a('0x31')]=_[_0x198a('0x32')](_0x47af70[_0x198a('0x2d')],_0x47af70[_0x198a('0x2f')]);_0x230d36['attributes']=_['intersection'](_0x47af70['model'],qs[_0x198a('0x44')](_0x309531[_0x198a('0x2f')][_0x198a('0x44')]));_0x230d36[_0x198a('0x33')]=_0x230d36[_0x198a('0x33')][_0x198a('0x34')]?_0x230d36['attributes']:_0x47af70[_0x198a('0x2d')];_0x230d36[_0x198a('0x38')]=qs[_0x198a('0x39')](_0x309531[_0x198a('0x2f')][_0x198a('0x39')]);_0x230d36[_0x198a('0x3a')]=qs[_0x198a('0x31')](_[_0x198a('0x4b')](_0x309531[_0x198a('0x2f')],_0x47af70['filters']));if(_0x309531['query']['filter']){_0x230d36[_0x198a('0x3a')]=_[_0x198a('0x3c')](_0x230d36[_0x198a('0x3a')],{'$or':_[_0x198a('0x27')](_0x230d36['attributes'],function(_0x2dedd4){var _0x5100d8={};_0x5100d8[_0x2dedd4]={'$like':'%'+_0x309531[_0x198a('0x2f')][_0x198a('0x3b')]+'%'};return _0x5100d8;})});}_0x230d36=_['merge']({},_0x230d36,_0x309531[_0x198a('0x46')]);return _0x38216f[_0x198a('0x4c')](_0x230d36);}})[_0x198a('0x22')](function(_0xdc41e3){if(_0xdc41e3){_0x9e55f1=_0xdc41e3['length'];if(!_0x309531[_0x198a('0x2f')]['hasOwnProperty'](_0x198a('0x36'))){_0x230d36[_0x198a('0x37')]=qs[_0x198a('0x37')](_0x309531[_0x198a('0x2f')][_0x198a('0x37')]);_0x230d36[_0x198a('0x19')]=qs[_0x198a('0x19')](_0x309531['query'][_0x198a('0x19')]);}return _0x38216f[_0x198a('0x4c')](_0x230d36);}})[_0x198a('0x22')](function(_0x111ad7){if(_0x111ad7){return _0x111ad7?{'count':_0x9e55f1,'rows':_0x111ad7}:null;}})[_0x198a('0x22')](respondWithResult(_0x58a63f,null))[_0x198a('0x41')](handleError(_0x58a63f,null));};exports[_0x198a('0x4e')]=function(_0x591b3b,_0xa54e0,_0x382e77){var _0xf086d4={};var _0x4837f1={};var _0x31d618;var _0x895c01;return db[_0x198a('0x28')][_0x198a('0x4a')]({'where':{'id':_0x591b3b['params']['id']}})[_0x198a('0x22')](handleEntityNotFound(_0xa54e0,null))[_0x198a('0x22')](function(_0x563561){if(_0x563561){_0x31d618=_0x563561;_0x4837f1[_0x198a('0x2d')]=_[_0x198a('0x30')](db['SugarcrmField']['rawAttributes']);_0x4837f1[_0x198a('0x2f')]=_['keys'](_0x591b3b['query']);_0x4837f1[_0x198a('0x31')]=_[_0x198a('0x32')](_0x4837f1[_0x198a('0x2d')],_0x4837f1[_0x198a('0x2f')]);_0xf086d4['attributes']=_[_0x198a('0x32')](_0x4837f1['model'],qs[_0x198a('0x44')](_0x591b3b[_0x198a('0x2f')]['fields']));_0xf086d4[_0x198a('0x33')]=_0xf086d4['attributes'][_0x198a('0x34')]?_0xf086d4[_0x198a('0x33')]:_0x4837f1['model'];_0xf086d4['order']=qs[_0x198a('0x39')](_0x591b3b[_0x198a('0x2f')]['sort']);_0xf086d4[_0x198a('0x3a')]=qs[_0x198a('0x31')](_[_0x198a('0x4b')](_0x591b3b[_0x198a('0x2f')],_0x4837f1[_0x198a('0x31')]));if(_0x591b3b[_0x198a('0x2f')][_0x198a('0x3b')]){_0xf086d4[_0x198a('0x3a')]=_[_0x198a('0x3c')](_0xf086d4['where'],{'$or':_[_0x198a('0x27')](_0xf086d4[_0x198a('0x33')],function(_0x106cc5){var _0x2ce00d={};_0x2ce00d[_0x106cc5]={'$like':'%'+_0x591b3b[_0x198a('0x2f')][_0x198a('0x3b')]+'%'};return _0x2ce00d;})});}_0xf086d4=_[_0x198a('0x3c')]({},_0xf086d4,_0x591b3b['options']);return _0x31d618[_0x198a('0x4e')](_0xf086d4);}})[_0x198a('0x22')](function(_0x4c8981){if(_0x4c8981){_0x895c01=_0x4c8981['length'];if(!_0x591b3b[_0x198a('0x2f')]['hasOwnProperty'](_0x198a('0x36'))){_0xf086d4[_0x198a('0x37')]=qs['limit'](_0x591b3b[_0x198a('0x2f')][_0x198a('0x37')]);_0xf086d4['offset']=qs[_0x198a('0x19')](_0x591b3b[_0x198a('0x2f')][_0x198a('0x19')]);}return _0x31d618[_0x198a('0x4e')](_0xf086d4);}})[_0x198a('0x22')](function(_0x495fde){if(_0x495fde){return _0x495fde?{'count':_0x895c01,'rows':_0x495fde}:null;}})[_0x198a('0x22')](respondWithResult(_0xa54e0,null))[_0x198a('0x41')](handleError(_0xa54e0,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 59970fe..c8530f4 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 _0x91ac=['api','request-promise','path','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util'];(function(_0x18ceb7,_0x2e8d2a){var _0x223002=function(_0x27acf8){while(--_0x27acf8){_0x18ceb7['push'](_0x18ceb7['shift']());}};_0x223002(++_0x2e8d2a);}(_0x91ac,0x120));var _0xc91a=function(_0x2a88b8,_0x949464){_0x2a88b8=_0x2a88b8-0x0;var _0xf5c7a5=_0x91ac[_0x2a88b8];return _0xf5c7a5;};'use strict';var _=require(_0xc91a('0x0'));var util=require(_0xc91a('0x1'));var logger=require('../../config/logger')(_0xc91a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc91a('0x3'));var fs=require('fs');var path=require(_0xc91a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc91a('0x5'));module[_0xc91a('0x6')]=function(_0x41da7f,_0x106481){return _0x41da7f[_0xc91a('0x7')](_0xc91a('0x8'),attributes,{'tableName':_0xc91a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce23=['moment','bluebird','path','rimraf','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger'];(function(_0x56a616,_0x5a3c7c){var _0xe94844=function(_0x1d3816){while(--_0x1d3816){_0x56a616['push'](_0x56a616['shift']());}};_0xe94844(++_0x5a3c7c);}(_0xce23,0x76));var _0x3ce2=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xce23[_0x485b5a];return _0xd2b34d;};'use strict';var _=require(_0x3ce2('0x0'));var util=require(_0x3ce2('0x1'));var logger=require(_0x3ce2('0x2'))('api');var moment=require(_0x3ce2('0x3'));var BPromise=require(_0x3ce2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ce2('0x5'));var rimraf=require(_0x3ce2('0x6'));var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x3ce2('0x7')]=function(_0x372362,_0x416e44){return _0x372362[_0x3ce2('0x8')](_0x3ce2('0x9'),attributes,{'tableName':_0x3ce2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index fdf015f..37c3648 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 _0xf1f2=['../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x4702ee,_0xaf6a45){var _0x62ca7d=function(_0x5b3af7){while(--_0x5b3af7){_0x4702ee['push'](_0x4702ee['shift']());}};_0x62ca7d(++_0xaf6a45);}(_0xf1f2,0x1de));var _0x2f1f=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xf1f2[_0x59c301];return _0x3866b9;};'use strict';var _=require(_0x2f1f('0x0'));var util=require(_0x2f1f('0x1'));var moment=require(_0x2f1f('0x2'));var BPromise=require(_0x2f1f('0x3'));var rs=require(_0x2f1f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2f1f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2f1f('0x6'));var jayson=require(_0x2f1f('0x7'));var client=jayson['client'][_0x2f1f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x54ea50,_0xe18713,_0x38b82a){return new BPromise(function(_0x4c4e22,_0x1bd56e){return client[_0x2f1f('0x9')](_0x54ea50,_0x38b82a)[_0x2f1f('0xa')](function(_0x53b172){logger[_0x2f1f('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xe18713,_0x2f1f('0xc'));logger[_0x2f1f('0xd')](_0x2f1f('0xe'),_0xe18713,_0x2f1f('0xc'),JSON[_0x2f1f('0xf')](_0x53b172));if(_0x53b172[_0x2f1f('0x10')]){if(_0x53b172[_0x2f1f('0x10')][_0x2f1f('0x11')]===0x1f4){logger[_0x2f1f('0x10')](_0x2f1f('0x12'),_0xe18713,_0x53b172['error'][_0x2f1f('0x13')]);return _0x1bd56e(_0x53b172[_0x2f1f('0x10')]['message']);}logger[_0x2f1f('0x10')](_0x2f1f('0x12'),_0xe18713,_0x53b172[_0x2f1f('0x10')][_0x2f1f('0x13')]);return _0x4c4e22(_0x53b172['error'][_0x2f1f('0x13')]);}else{logger[_0x2f1f('0xb')](_0x2f1f('0x12'),_0xe18713,_0x2f1f('0xc'));_0x4c4e22(_0x53b172[_0x2f1f('0x14')]['message']);}})[_0x2f1f('0x15')](function(_0x539a48){logger[_0x2f1f('0x10')](_0x2f1f('0x12'),_0xe18713,_0x539a48);_0x1bd56e(_0x539a48);});});} \ No newline at end of file +var _0x8e21=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x127a60,_0x37f33a){var _0xc1f6a3=function(_0x8ed035){while(--_0x8ed035){_0x127a60['push'](_0x127a60['shift']());}};_0xc1f6a3(++_0x37f33a);}(_0x8e21,0x190));var _0x18e2=function(_0x1034bb,_0x4e20b3){_0x1034bb=_0x1034bb-0x0;var _0x453fdb=_0x8e21[_0x1034bb];return _0x453fdb;};'use strict';var _=require(_0x18e2('0x0'));var util=require(_0x18e2('0x1'));var moment=require(_0x18e2('0x2'));var BPromise=require(_0x18e2('0x3'));var rs=require(_0x18e2('0x4'));var fs=require('fs');var Redis=require(_0x18e2('0x5'));var db=require(_0x18e2('0x6'))['db'];var utils=require(_0x18e2('0x7'));var logger=require(_0x18e2('0x8'))(_0x18e2('0x9'));var config=require(_0x18e2('0xa'));var jayson=require(_0x18e2('0xb'));var client=jayson[_0x18e2('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a217e,_0x557df7,_0x2b999e){return new BPromise(function(_0x5dc2af,_0x22e5ab){return client[_0x18e2('0xd')](_0x5a217e,_0x2b999e)[_0x18e2('0xe')](function(_0x4dd1b5){logger['info'](_0x18e2('0xf'),_0x557df7,_0x18e2('0x10'));logger[_0x18e2('0x11')](_0x18e2('0x12'),_0x557df7,_0x18e2('0x10'),JSON[_0x18e2('0x13')](_0x4dd1b5));if(_0x4dd1b5[_0x18e2('0x14')]){if(_0x4dd1b5[_0x18e2('0x14')]['code']===0x1f4){logger[_0x18e2('0x14')](_0x18e2('0xf'),_0x557df7,_0x4dd1b5[_0x18e2('0x14')][_0x18e2('0x15')]);return _0x22e5ab(_0x4dd1b5[_0x18e2('0x14')][_0x18e2('0x15')]);}logger[_0x18e2('0x14')](_0x18e2('0xf'),_0x557df7,_0x4dd1b5[_0x18e2('0x14')][_0x18e2('0x15')]);return _0x5dc2af(_0x4dd1b5['error'][_0x18e2('0x15')]);}else{logger[_0x18e2('0x16')](_0x18e2('0xf'),_0x557df7,_0x18e2('0x10'));_0x5dc2af(_0x4dd1b5['result'][_0x18e2('0x15')]);}})[_0x18e2('0x17')](function(_0x4fa2ee){logger[_0x18e2('0x14')](_0x18e2('0xf'),_0x557df7,_0x4fa2ee);_0x22e5ab(_0x4fa2ee);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index cc48604..721bda3 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 _0x361f=['/:id','post','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x361f,0x116));var _0xf361=function(_0x10ad59,_0x48a861){_0x10ad59=_0x10ad59-0x0;var _0x493227=_0x361f[_0x10ad59];return _0x493227;};'use strict';var multer=require(_0xf361('0x0'));var util=require('util');var path=require(_0xf361('0x1'));var timeout=require(_0xf361('0x2'));var express=require('express');var router=express[_0xf361('0x3')]();var fs_extra=require(_0xf361('0x4'));var auth=require(_0xf361('0x5'));var interaction=require(_0xf361('0x6'));var config=require(_0xf361('0x7'));var controller=require('./intSugarcrmField.controller');router[_0xf361('0x8')]('/',auth[_0xf361('0x9')](),controller[_0xf361('0xa')]);router['get'](_0xf361('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xf361('0xc')]('/',auth[_0xf361('0x9')](),controller['create']);router['put'](_0xf361('0xb'),auth[_0xf361('0x9')](),controller[_0xf361('0xd')]);router[_0xf361('0xe')](_0xf361('0xb'),auth[_0xf361('0x9')](),controller[_0xf361('0xf')]);module[_0xf361('0x10')]=router; \ No newline at end of file +var _0xdc03=['multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','exports'];(function(_0x32d976,_0x1dbfcc){var _0x80d3ff=function(_0x4aa6e6){while(--_0x4aa6e6){_0x32d976['push'](_0x32d976['shift']());}};_0x80d3ff(++_0x1dbfcc);}(_0xdc03,0x90));var _0x3dc0=function(_0x36c2e8,_0x5e5429){_0x36c2e8=_0x36c2e8-0x0;var _0x45f51f=_0xdc03[_0x36c2e8];return _0x45f51f;};'use strict';var multer=require(_0x3dc0('0x0'));var util=require(_0x3dc0('0x1'));var path=require('path');var timeout=require(_0x3dc0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3dc0('0x3'));var auth=require(_0x3dc0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3dc0('0x5'));var controller=require('./intSugarcrmField.controller');router[_0x3dc0('0x6')]('/',auth[_0x3dc0('0x7')](),controller[_0x3dc0('0x8')]);router['get'](_0x3dc0('0x9'),auth['isAuthenticated'](),controller[_0x3dc0('0xa')]);router['post']('/',auth[_0x3dc0('0x7')](),controller[_0x3dc0('0xb')]);router[_0x3dc0('0xc')](_0x3dc0('0x9'),auth['isAuthenticated'](),controller[_0x3dc0('0xd')]);router[_0x3dc0('0xe')](_0x3dc0('0x9'),auth[_0x3dc0('0x7')](),controller['destroy']);module[_0x3dc0('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 760715c..e76474f 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 _0xee8d=['STRING','BOOLEAN','sequelize','exports','string','variable','customVariable','picklist'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee8d,0x1d2));var _0xdee8=function(_0x206dbd,_0x22bc5f){_0x206dbd=_0x206dbd-0x0;var _0x49a63a=_0xee8d[_0x206dbd];return _0x49a63a;};'use strict';var Sequelize=require(_0xdee8('0x0'));module[_0xdee8('0x1')]={'type':{'type':Sequelize['ENUM'](_0xdee8('0x2'),_0xdee8('0x3'),_0xdee8('0x4'),'keyValue',_0xdee8('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xdee8('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xdee8('0x2'),_0xdee8('0x3'),_0xdee8('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xdee8('0x6')]},'customField':{'type':Sequelize[_0xdee8('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdee8('0x6')]}}; \ No newline at end of file +var _0xaae0=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xaae0,0xb6));var _0x0aae=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xaae0[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x0aae('0x0'));module[_0x0aae('0x1')]={'type':{'type':Sequelize[_0x0aae('0x2')](_0x0aae('0x3'),_0x0aae('0x4'),_0x0aae('0x5'),_0x0aae('0x6'),_0x0aae('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0aae('0x8')]},'key':{'type':Sequelize[_0x0aae('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x0aae('0x3'),_0x0aae('0x4'),_0x0aae('0x5'))},'keyContent':{'type':Sequelize[_0x0aae('0x8')]},'idField':{'type':Sequelize[_0x0aae('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0aae('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0aae('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 5bfa974..cc09958 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 _0x97ef=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','error','stack','name','send','index','map','SugarcrmField','fieldName','type','key','model','query','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','keys','rawAttributes','intersection','fields','length','include','find','create','body','update','params','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x34b3a2,_0x52453a){var _0x8715f0=function(_0x1af7af){while(--_0x1af7af){_0x34b3a2['push'](_0x34b3a2['shift']());}};_0x8715f0(++_0x52453a);}(_0x97ef,0x1ca));var _0xf97e=function(_0x556e25,_0x399697){_0x556e25=_0x556e25-0x0;var _0x123ea3=_0x97ef[_0x556e25];return _0x123ea3;};'use strict';var emlformat=require(_0xf97e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf97e('0x1'));var jsonpatch=require(_0xf97e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf97e('0x3'));var Mustache=require(_0xf97e('0x4'));var util=require(_0xf97e('0x5'));var path=require(_0xf97e('0x6'));var sox=require(_0xf97e('0x7'));var csv=require(_0xf97e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf97e('0x9'));var _=require('lodash');var squel=require(_0xf97e('0xa'));var crypto=require(_0xf97e('0xb'));var jsforce=require(_0xf97e('0xc'));var deskjs=require(_0xf97e('0xd'));var toCsv=require(_0xf97e('0x8'));var querystring=require(_0xf97e('0xe'));var Papa=require(_0xf97e('0xf'));var Redis=require('ioredis');var authService=require(_0xf97e('0x10'));var qs=require(_0xf97e('0x11'));var as=require(_0xf97e('0x12'));var hardwareService=require(_0xf97e('0x13'));var logger=require(_0xf97e('0x14'))(_0xf97e('0x15'));var utils=require(_0xf97e('0x16'));var config=require(_0xf97e('0x17'));var licenseUtil=require(_0xf97e('0x18'));var db=require(_0xf97e('0x19'))['db'];function respondWithStatusCode(_0x46970c,_0x25ed5e){_0x25ed5e=_0x25ed5e||0xcc;return function(_0x3fde81){if(_0x3fde81){return _0x46970c[_0xf97e('0x1a')](_0x25ed5e);}return _0x46970c[_0xf97e('0x1b')](_0x25ed5e)['end']();};}function respondWithResult(_0x3203df,_0x1978ce){_0x1978ce=_0x1978ce||0xc8;return function(_0x58a82e){if(_0x58a82e){return _0x3203df[_0xf97e('0x1b')](_0x1978ce)[_0xf97e('0x1c')](_0x58a82e);}};}function respondWithFilteredResult(_0x5d6a48,_0x209689){return function(_0x2c5d84){if(_0x2c5d84){var _0x24c1d9=typeof _0x209689[_0xf97e('0x1d')]===_0xf97e('0x1e')&&typeof _0x209689[_0xf97e('0x1f')]===_0xf97e('0x1e');var _0x1fed87=_0x2c5d84['count'];var _0x459325=_0x24c1d9?0x0:_0x209689['offset'];var _0x16720f=_0x24c1d9?_0x2c5d84[_0xf97e('0x20')]:_0x209689[_0xf97e('0x1d')]+_0x209689['limit'];var _0x4d31a2;if(_0x16720f>=_0x1fed87){_0x16720f=_0x1fed87;_0x4d31a2=0xc8;}else{_0x4d31a2=0xce;}_0x5d6a48[_0xf97e('0x1b')](_0x4d31a2);return _0x5d6a48[_0xf97e('0x21')](_0xf97e('0x22'),_0x459325+'-'+_0x16720f+'/'+_0x1fed87)['json'](_0x2c5d84);}return null;};}function patchUpdates(_0x49164d){return function(_0xb29440){try{jsonpatch[_0xf97e('0x23')](_0xb29440,_0x49164d,!![]);}catch(_0x5e7d0e){return BPromise[_0xf97e('0x24')](_0x5e7d0e);}return _0xb29440[_0xf97e('0x25')]();};}function saveUpdates(_0x115942,_0x609ac3){return function(_0x504bd4){if(_0x504bd4){return _0x504bd4['update'](_0x115942)[_0xf97e('0x26')](function(_0x213de5){return _0x213de5;});}return null;};}function removeEntity(_0x487588,_0x3b32bd){return function(_0x3660d0){if(_0x3660d0){return _0x3660d0['destroy']()[_0xf97e('0x26')](function(){_0x487588[_0xf97e('0x1b')](0xcc)[_0xf97e('0x27')]();});}};}function handleEntityNotFound(_0x4a4736,_0x19b8b7){return function(_0x2ac50f){if(!_0x2ac50f){_0x4a4736[_0xf97e('0x1a')](0x194);}return _0x2ac50f;};}function handleError(_0x215ba8,_0x44cf55){_0x44cf55=_0x44cf55||0x1f4;return function(_0x42d1cd){logger[_0xf97e('0x28')](_0x42d1cd[_0xf97e('0x29')]);if(_0x42d1cd[_0xf97e('0x2a')]){delete _0x42d1cd[_0xf97e('0x2a')];}_0x215ba8[_0xf97e('0x1b')](_0x44cf55)[_0xf97e('0x2b')](_0x42d1cd);};}exports[_0xf97e('0x2c')]=function(_0x3af82b,_0x3ea9ba){var _0x457bdc={},_0x348eac={},_0x113039={'count':0x0,'rows':[]};var _0x121dd2=_[_0xf97e('0x2d')](db[_0xf97e('0x2e')]['rawAttributes'],function(_0x58b032){return{'name':_0x58b032[_0xf97e('0x2f')],'type':_0x58b032[_0xf97e('0x30')][_0xf97e('0x31')]};});_0x348eac[_0xf97e('0x32')]=_[_0xf97e('0x2d')](_0x121dd2,'name');_0x348eac['query']=_['keys'](_0x3af82b[_0xf97e('0x33')]);_0x348eac['filters']=_['intersection'](_0x348eac[_0xf97e('0x32')],_0x348eac[_0xf97e('0x33')]);_0x457bdc[_0xf97e('0x34')]=_['intersection'](_0x348eac['model'],qs['fields'](_0x3af82b[_0xf97e('0x33')]['fields']));_0x457bdc['attributes']=_0x457bdc[_0xf97e('0x34')]['length']?_0x457bdc[_0xf97e('0x34')]:_0x348eac['model'];if(!_0x3af82b[_0xf97e('0x33')][_0xf97e('0x35')](_0xf97e('0x36'))){_0x457bdc[_0xf97e('0x1f')]=qs[_0xf97e('0x1f')](_0x3af82b[_0xf97e('0x33')][_0xf97e('0x1f')]);_0x457bdc[_0xf97e('0x1d')]=qs[_0xf97e('0x1d')](_0x3af82b[_0xf97e('0x33')]['offset']);}_0x457bdc[_0xf97e('0x37')]=qs['sort'](_0x3af82b[_0xf97e('0x33')][_0xf97e('0x38')]);_0x457bdc[_0xf97e('0x39')]=qs[_0xf97e('0x3a')](_[_0xf97e('0x3b')](_0x3af82b['query'],_0x348eac[_0xf97e('0x3a')]),_0x121dd2);if(_0x3af82b[_0xf97e('0x33')][_0xf97e('0x3c')]){_0x457bdc[_0xf97e('0x39')]=_[_0xf97e('0x3d')](_0x457bdc['where'],{'$or':_[_0xf97e('0x2d')](_0x121dd2,function(_0x3c3c97){if(_0x3c3c97['type']!==_0xf97e('0x3e')){var _0x2c0259={};_0x2c0259[_0x3c3c97['name']]={'$like':'%'+_0x3af82b['query']['filter']+'%'};return _0x2c0259;}})});}_0x457bdc=_[_0xf97e('0x3d')]({},_0x457bdc,_0x3af82b[_0xf97e('0x3f')]);var _0x3da0da={'where':_0x457bdc[_0xf97e('0x39')]};return db[_0xf97e('0x2e')][_0xf97e('0x20')](_0x3da0da)['then'](function(_0x5f26df){_0x113039['count']=_0x5f26df;if(_0x3af82b[_0xf97e('0x33')][_0xf97e('0x40')]){_0x457bdc['include']=[{'all':!![]}];}return db[_0xf97e('0x2e')]['findAll'](_0x457bdc);})[_0xf97e('0x26')](function(_0x4d7320){_0x113039[_0xf97e('0x41')]=_0x4d7320;return _0x113039;})[_0xf97e('0x26')](respondWithFilteredResult(_0x3ea9ba,_0x457bdc))[_0xf97e('0x42')](handleError(_0x3ea9ba,null));};exports[_0xf97e('0x43')]=function(_0x2687ad,_0x2d6ede){var _0x525b04={'raw':!![],'where':{'id':_0x2687ad['params']['id']}},_0x2cb9a2={};_0x2cb9a2[_0xf97e('0x32')]=_[_0xf97e('0x44')](db[_0xf97e('0x2e')][_0xf97e('0x45')]);_0x2cb9a2[_0xf97e('0x33')]=_[_0xf97e('0x44')](_0x2687ad[_0xf97e('0x33')]);_0x2cb9a2[_0xf97e('0x3a')]=_[_0xf97e('0x46')](_0x2cb9a2['model'],_0x2cb9a2[_0xf97e('0x33')]);_0x525b04['attributes']=_[_0xf97e('0x46')](_0x2cb9a2[_0xf97e('0x32')],qs[_0xf97e('0x47')](_0x2687ad[_0xf97e('0x33')]['fields']));_0x525b04['attributes']=_0x525b04['attributes'][_0xf97e('0x48')]?_0x525b04[_0xf97e('0x34')]:_0x2cb9a2[_0xf97e('0x32')];if(_0x2687ad[_0xf97e('0x33')][_0xf97e('0x40')]){_0x525b04[_0xf97e('0x49')]=[{'all':!![]}];}_0x525b04=_[_0xf97e('0x3d')]({},_0x525b04,_0x2687ad[_0xf97e('0x3f')]);return db[_0xf97e('0x2e')][_0xf97e('0x4a')](_0x525b04)[_0xf97e('0x26')](handleEntityNotFound(_0x2d6ede,null))[_0xf97e('0x26')](respondWithResult(_0x2d6ede,null))[_0xf97e('0x42')](handleError(_0x2d6ede,null));};exports[_0xf97e('0x4b')]=function(_0x5bc3ac,_0x323a7d){return db[_0xf97e('0x2e')][_0xf97e('0x4b')](_0x5bc3ac[_0xf97e('0x4c')],{})['then'](respondWithResult(_0x323a7d,0xc9))[_0xf97e('0x42')](handleError(_0x323a7d,null));};exports[_0xf97e('0x4d')]=function(_0x42bf9d,_0x9bc663){if(_0x42bf9d[_0xf97e('0x4c')]['id']){delete _0x42bf9d[_0xf97e('0x4c')]['id'];}return db[_0xf97e('0x2e')][_0xf97e('0x4a')]({'where':{'id':_0x42bf9d[_0xf97e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x9bc663,null))[_0xf97e('0x26')](saveUpdates(_0x42bf9d['body'],null))[_0xf97e('0x26')](respondWithResult(_0x9bc663,null))[_0xf97e('0x42')](handleError(_0x9bc663,null));};exports['destroy']=function(_0x47cfaf,_0x515239){return db[_0xf97e('0x2e')]['find']({'where':{'id':_0x47cfaf[_0xf97e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x515239,null))[_0xf97e('0x26')](removeEntity(_0x515239,null))[_0xf97e('0x42')](handleError(_0x515239,null));}; \ No newline at end of file +var _0x7e6f=['to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','findAll','catch','show','params','include','options','find','create','update','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','squel','jsforce','desk.js'];(function(_0x554a2d,_0xdaca66){var _0x15c0d9=function(_0x56109b){while(--_0x56109b){_0x554a2d['push'](_0x554a2d['shift']());}};_0x15c0d9(++_0xdaca66);}(_0x7e6f,0x1ec));var _0xf7e6=function(_0x56a714,_0x37223f){_0x56a714=_0x56a714-0x0;var _0x5544f8=_0x7e6f[_0x56a714];return _0x5544f8;};'use strict';var emlformat=require(_0xf7e6('0x0'));var rimraf=require(_0xf7e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf7e6('0x2'));var moment=require(_0xf7e6('0x3'));var BPromise=require(_0xf7e6('0x4'));var Mustache=require(_0xf7e6('0x5'));var util=require(_0xf7e6('0x6'));var path=require(_0xf7e6('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf7e6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf7e6('0x9'));var crypto=require('crypto');var jsforce=require(_0xf7e6('0xa'));var deskjs=require(_0xf7e6('0xb'));var toCsv=require(_0xf7e6('0xc'));var querystring=require(_0xf7e6('0xd'));var Papa=require(_0xf7e6('0xe'));var Redis=require(_0xf7e6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf7e6('0x10'));var as=require(_0xf7e6('0x11'));var hardwareService=require(_0xf7e6('0x12'));var logger=require(_0xf7e6('0x13'))(_0xf7e6('0x14'));var utils=require(_0xf7e6('0x15'));var config=require(_0xf7e6('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29a486,_0x1f5dbf){_0x1f5dbf=_0x1f5dbf||0xcc;return function(_0x2edb58){if(_0x2edb58){return _0x29a486[_0xf7e6('0x17')](_0x1f5dbf);}return _0x29a486[_0xf7e6('0x18')](_0x1f5dbf)['end']();};}function respondWithResult(_0x2a6e34,_0x15e2ea){_0x15e2ea=_0x15e2ea||0xc8;return function(_0x4196d5){if(_0x4196d5){return _0x2a6e34[_0xf7e6('0x18')](_0x15e2ea)['json'](_0x4196d5);}};}function respondWithFilteredResult(_0x3e15d6,_0x2bcac2){return function(_0xf544f3){if(_0xf544f3){var _0x3270af=typeof _0x2bcac2[_0xf7e6('0x19')]===_0xf7e6('0x1a')&&typeof _0x2bcac2[_0xf7e6('0x1b')]===_0xf7e6('0x1a');var _0x13d2f0=_0xf544f3[_0xf7e6('0x1c')];var _0x22cd99=_0x3270af?0x0:_0x2bcac2[_0xf7e6('0x19')];var _0x4b9717=_0x3270af?_0xf544f3[_0xf7e6('0x1c')]:_0x2bcac2[_0xf7e6('0x19')]+_0x2bcac2['limit'];var _0x5a3900;if(_0x4b9717>=_0x13d2f0){_0x4b9717=_0x13d2f0;_0x5a3900=0xc8;}else{_0x5a3900=0xce;}_0x3e15d6[_0xf7e6('0x18')](_0x5a3900);return _0x3e15d6[_0xf7e6('0x1d')](_0xf7e6('0x1e'),_0x22cd99+'-'+_0x4b9717+'/'+_0x13d2f0)[_0xf7e6('0x1f')](_0xf544f3);}return null;};}function patchUpdates(_0x2cab40){return function(_0xea48f){try{jsonpatch[_0xf7e6('0x20')](_0xea48f,_0x2cab40,!![]);}catch(_0x4bc82c){return BPromise[_0xf7e6('0x21')](_0x4bc82c);}return _0xea48f['save']();};}function saveUpdates(_0x42ef4f,_0x4fa8b7){return function(_0x67c0da){if(_0x67c0da){return _0x67c0da['update'](_0x42ef4f)['then'](function(_0x32ac5f){return _0x32ac5f;});}return null;};}function removeEntity(_0x311fdc,_0x4753af){return function(_0x5ed6bc){if(_0x5ed6bc){return _0x5ed6bc[_0xf7e6('0x22')]()['then'](function(){_0x311fdc[_0xf7e6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x307a5d,_0x3e3fc1){return function(_0x2b5565){if(!_0x2b5565){_0x307a5d[_0xf7e6('0x17')](0x194);}return _0x2b5565;};}function handleError(_0x4c1f1a,_0x3239ac){_0x3239ac=_0x3239ac||0x1f4;return function(_0x57683c){logger[_0xf7e6('0x23')](_0x57683c[_0xf7e6('0x24')]);if(_0x57683c['name']){delete _0x57683c[_0xf7e6('0x25')];}_0x4c1f1a[_0xf7e6('0x18')](_0x3239ac)[_0xf7e6('0x26')](_0x57683c);};}exports[_0xf7e6('0x27')]=function(_0x4c160e,_0x484c32){var _0x30ac70={},_0x3ebc9a={},_0x19770d={'count':0x0,'rows':[]};var _0x14a7d6=_[_0xf7e6('0x28')](db[_0xf7e6('0x29')][_0xf7e6('0x2a')],function(_0x107e16){return{'name':_0x107e16[_0xf7e6('0x2b')],'type':_0x107e16[_0xf7e6('0x2c')][_0xf7e6('0x2d')]};});_0x3ebc9a['model']=_[_0xf7e6('0x28')](_0x14a7d6,_0xf7e6('0x25'));_0x3ebc9a[_0xf7e6('0x2e')]=_['keys'](_0x4c160e['query']);_0x3ebc9a[_0xf7e6('0x2f')]=_[_0xf7e6('0x30')](_0x3ebc9a['model'],_0x3ebc9a['query']);_0x30ac70[_0xf7e6('0x31')]=_['intersection'](_0x3ebc9a[_0xf7e6('0x32')],qs[_0xf7e6('0x33')](_0x4c160e['query'][_0xf7e6('0x33')]));_0x30ac70['attributes']=_0x30ac70['attributes']['length']?_0x30ac70[_0xf7e6('0x31')]:_0x3ebc9a[_0xf7e6('0x32')];if(!_0x4c160e['query']['hasOwnProperty'](_0xf7e6('0x34'))){_0x30ac70[_0xf7e6('0x1b')]=qs[_0xf7e6('0x1b')](_0x4c160e[_0xf7e6('0x2e')][_0xf7e6('0x1b')]);_0x30ac70[_0xf7e6('0x19')]=qs[_0xf7e6('0x19')](_0x4c160e['query']['offset']);}_0x30ac70[_0xf7e6('0x35')]=qs[_0xf7e6('0x36')](_0x4c160e[_0xf7e6('0x2e')]['sort']);_0x30ac70[_0xf7e6('0x37')]=qs[_0xf7e6('0x2f')](_[_0xf7e6('0x38')](_0x4c160e[_0xf7e6('0x2e')],_0x3ebc9a[_0xf7e6('0x2f')]),_0x14a7d6);if(_0x4c160e[_0xf7e6('0x2e')][_0xf7e6('0x39')]){_0x30ac70[_0xf7e6('0x37')]=_[_0xf7e6('0x3a')](_0x30ac70[_0xf7e6('0x37')],{'$or':_[_0xf7e6('0x28')](_0x14a7d6,function(_0x17eed0){if(_0x17eed0[_0xf7e6('0x2c')]!==_0xf7e6('0x3b')){var _0x212145={};_0x212145[_0x17eed0[_0xf7e6('0x25')]]={'$like':'%'+_0x4c160e[_0xf7e6('0x2e')]['filter']+'%'};return _0x212145;}})});}_0x30ac70=_['merge']({},_0x30ac70,_0x4c160e['options']);var _0x5564a2={'where':_0x30ac70['where']};return db[_0xf7e6('0x29')][_0xf7e6('0x1c')](_0x5564a2)[_0xf7e6('0x3c')](function(_0x14ad42){_0x19770d[_0xf7e6('0x1c')]=_0x14ad42;if(_0x4c160e['query'][_0xf7e6('0x3d')]){_0x30ac70['include']=[{'all':!![]}];}return db['SugarcrmField'][_0xf7e6('0x3e')](_0x30ac70);})[_0xf7e6('0x3c')](function(_0x3371ce){_0x19770d['rows']=_0x3371ce;return _0x19770d;})[_0xf7e6('0x3c')](respondWithFilteredResult(_0x484c32,_0x30ac70))[_0xf7e6('0x3f')](handleError(_0x484c32,null));};exports[_0xf7e6('0x40')]=function(_0x54e664,_0x8e67c3){var _0x3b517f={'raw':!![],'where':{'id':_0x54e664[_0xf7e6('0x41')]['id']}},_0x2b70f7={};_0x2b70f7[_0xf7e6('0x32')]=_['keys'](db[_0xf7e6('0x29')][_0xf7e6('0x2a')]);_0x2b70f7[_0xf7e6('0x2e')]=_['keys'](_0x54e664[_0xf7e6('0x2e')]);_0x2b70f7[_0xf7e6('0x2f')]=_[_0xf7e6('0x30')](_0x2b70f7[_0xf7e6('0x32')],_0x2b70f7['query']);_0x3b517f[_0xf7e6('0x31')]=_[_0xf7e6('0x30')](_0x2b70f7[_0xf7e6('0x32')],qs['fields'](_0x54e664[_0xf7e6('0x2e')][_0xf7e6('0x33')]));_0x3b517f[_0xf7e6('0x31')]=_0x3b517f[_0xf7e6('0x31')]['length']?_0x3b517f[_0xf7e6('0x31')]:_0x2b70f7['model'];if(_0x54e664[_0xf7e6('0x2e')][_0xf7e6('0x3d')]){_0x3b517f[_0xf7e6('0x42')]=[{'all':!![]}];}_0x3b517f=_[_0xf7e6('0x3a')]({},_0x3b517f,_0x54e664[_0xf7e6('0x43')]);return db['SugarcrmField'][_0xf7e6('0x44')](_0x3b517f)[_0xf7e6('0x3c')](handleEntityNotFound(_0x8e67c3,null))[_0xf7e6('0x3c')](respondWithResult(_0x8e67c3,null))[_0xf7e6('0x3f')](handleError(_0x8e67c3,null));};exports[_0xf7e6('0x45')]=function(_0xeff1b5,_0x4c5398){return db[_0xf7e6('0x29')][_0xf7e6('0x45')](_0xeff1b5['body'],{})[_0xf7e6('0x3c')](respondWithResult(_0x4c5398,0xc9))[_0xf7e6('0x3f')](handleError(_0x4c5398,null));};exports[_0xf7e6('0x46')]=function(_0x6c43a4,_0x448fc9){if(_0x6c43a4[_0xf7e6('0x47')]['id']){delete _0x6c43a4[_0xf7e6('0x47')]['id'];}return db[_0xf7e6('0x29')][_0xf7e6('0x44')]({'where':{'id':_0x6c43a4[_0xf7e6('0x41')]['id']}})[_0xf7e6('0x3c')](handleEntityNotFound(_0x448fc9,null))[_0xf7e6('0x3c')](saveUpdates(_0x6c43a4[_0xf7e6('0x47')],null))[_0xf7e6('0x3c')](respondWithResult(_0x448fc9,null))[_0xf7e6('0x3f')](handleError(_0x448fc9,null));};exports[_0xf7e6('0x22')]=function(_0x20aa2b,_0x5800f7){return db['SugarcrmField']['find']({'where':{'id':_0x20aa2b[_0xf7e6('0x41')]['id']}})['then'](handleEntityNotFound(_0x5800f7,null))['then'](removeEntity(_0x5800f7,null))[_0xf7e6('0x3f')](handleError(_0x5800f7,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index d020360..17af391 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 _0xb96d=['exports','define','int_sugarcrm_fields','sugarcrm_unique_index','idField','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x20c72d,_0x52fe1c){var _0xec7469=function(_0x236667){while(--_0x236667){_0x20c72d['push'](_0x20c72d['shift']());}};_0xec7469(++_0x52fe1c);}(_0xb96d,0x14a));var _0xdb96=function(_0x515afd,_0x1a1e91){_0x515afd=_0x515afd-0x0;var _0x536d53=_0xb96d[_0x515afd];return _0x536d53;};'use strict';var _=require(_0xdb96('0x0'));var util=require(_0xdb96('0x1'));var logger=require(_0xdb96('0x2'))(_0xdb96('0x3'));var moment=require(_0xdb96('0x4'));var BPromise=require('bluebird');var rp=require(_0xdb96('0x5'));var fs=require('fs');var path=require(_0xdb96('0x6'));var rimraf=require('rimraf');var config=require(_0xdb96('0x7'));var attributes=require('./intSugarcrmField.attributes');module[_0xdb96('0x8')]=function(_0x321deb,_0x50391c){return _0x321deb[_0xdb96('0x9')]('SugarcrmField',attributes,{'tableName':_0xdb96('0xa'),'paranoid':![],'indexes':[{'name':_0xdb96('0xb'),'fields':[_0xdb96('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa143=['bluebird','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','FieldId','lodash','util','../../config/logger','moment'];(function(_0x47d56f,_0x4115dc){var _0x4c66a1=function(_0x318260){while(--_0x318260){_0x47d56f['push'](_0x47d56f['shift']());}};_0x4c66a1(++_0x4115dc);}(_0xa143,0x1eb));var _0x3a14=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa143[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x3a14('0x0'));var util=require(_0x3a14('0x1'));var logger=require(_0x3a14('0x2'))('api');var moment=require(_0x3a14('0x3'));var BPromise=require(_0x3a14('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3a14('0x5'));module[_0x3a14('0x6')]=function(_0x56cb32,_0x3b06e9){return _0x56cb32[_0x3a14('0x7')](_0x3a14('0x8'),attributes,{'tableName':_0x3a14('0x9'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0x3a14('0xa')],'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 ab24636..3de9c52 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 _0x7c24=['SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7c24,0xb0));var _0x47c2=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x7c24[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x47c2('0x0'));var util=require(_0x47c2('0x1'));var moment=require(_0x47c2('0x2'));var BPromise=require('bluebird');var rs=require(_0x47c2('0x3'));var fs=require('fs');var Redis=require(_0x47c2('0x4'));var db=require(_0x47c2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x47c2('0x6'))(_0x47c2('0x7'));var config=require(_0x47c2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x47c2('0x9')][_0x47c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x578d04,_0x2cca71,_0x5a440c){return new BPromise(function(_0x125164,_0x7ebddb){return client[_0x47c2('0xb')](_0x578d04,_0x5a440c)['then'](function(_0x417308){logger[_0x47c2('0xc')](_0x47c2('0xd'),_0x2cca71,_0x47c2('0xe'));logger[_0x47c2('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x2cca71,_0x47c2('0xe'),JSON[_0x47c2('0x10')](_0x417308));if(_0x417308[_0x47c2('0x11')]){if(_0x417308[_0x47c2('0x11')]['code']===0x1f4){logger[_0x47c2('0x11')](_0x47c2('0xd'),_0x2cca71,_0x417308[_0x47c2('0x11')]['message']);return _0x7ebddb(_0x417308[_0x47c2('0x11')][_0x47c2('0x12')]);}logger[_0x47c2('0x11')](_0x47c2('0xd'),_0x2cca71,_0x417308[_0x47c2('0x11')][_0x47c2('0x12')]);return _0x125164(_0x417308[_0x47c2('0x11')]['message']);}else{logger['info'](_0x47c2('0xd'),_0x2cca71,_0x47c2('0xe'));_0x125164(_0x417308[_0x47c2('0x13')][_0x47c2('0x12')]);}})[_0x47c2('0x14')](function(_0x35f790){logger[_0x47c2('0x11')](_0x47c2('0xd'),_0x2cca71,_0x35f790);_0x7ebddb(_0x35f790);});});} \ No newline at end of file +var _0xa601=['message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','SugarcrmField,\x20%s,\x20%s'];(function(_0x275293,_0x31bf61){var _0x539b28=function(_0x36e11c){while(--_0x36e11c){_0x275293['push'](_0x275293['shift']());}};_0x539b28(++_0x31bf61);}(_0xa601,0xea));var _0x1a60=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0xa601[_0x1477ef];return _0x164acd;};'use strict';var _=require('lodash');var util=require(_0x1a60('0x0'));var moment=require(_0x1a60('0x1'));var BPromise=require('bluebird');var rs=require(_0x1a60('0x2'));var fs=require('fs');var Redis=require(_0x1a60('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a60('0x4'));var logger=require(_0x1a60('0x5'))(_0x1a60('0x6'));var config=require('../../config/environment');var jayson=require(_0x1a60('0x7'));var client=jayson[_0x1a60('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a08fe,_0x2d2cb8,_0x1914a0){return new BPromise(function(_0x3ca0a1,_0x41cb6a){return client[_0x1a60('0x9')](_0x4a08fe,_0x1914a0)[_0x1a60('0xa')](function(_0x3b3c64){logger[_0x1a60('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x2d2cb8,_0x1a60('0xc'));logger[_0x1a60('0xd')](_0x1a60('0xe'),_0x2d2cb8,_0x1a60('0xc'),JSON['stringify'](_0x3b3c64));if(_0x3b3c64[_0x1a60('0xf')]){if(_0x3b3c64[_0x1a60('0xf')][_0x1a60('0x10')]===0x1f4){logger[_0x1a60('0xf')](_0x1a60('0x11'),_0x2d2cb8,_0x3b3c64['error'][_0x1a60('0x12')]);return _0x41cb6a(_0x3b3c64['error'][_0x1a60('0x12')]);}logger[_0x1a60('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x2d2cb8,_0x3b3c64[_0x1a60('0xf')]['message']);return _0x3ca0a1(_0x3b3c64[_0x1a60('0xf')]['message']);}else{logger[_0x1a60('0xb')](_0x1a60('0x11'),_0x2d2cb8,_0x1a60('0xc'));_0x3ca0a1(_0x3b3c64[_0x1a60('0x13')][_0x1a60('0x12')]);}})[_0x1a60('0x14')](function(_0x34d8aa){logger['error'](_0x1a60('0x11'),_0x2d2cb8,_0x34d8aa);_0x41cb6a(_0x34d8aa);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 2035093..9c1990a 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 _0x3a12=['addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','/:id','show','get','/:id/configurations','getConfigurations','/:id/fields','post'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x3a12,0x1ce));var _0x23a1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3a12[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x23a1('0x0'));var util=require(_0x23a1('0x1'));var path=require(_0x23a1('0x2'));var timeout=require('connect-timeout');var express=require(_0x23a1('0x3'));var router=express[_0x23a1('0x4')]();var fs_extra=require(_0x23a1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x23a1('0x6'));var config=require(_0x23a1('0x7'));var controller=require(_0x23a1('0x8'));router['get']('/',auth[_0x23a1('0x9')](),controller[_0x23a1('0xa')]);router['get'](_0x23a1('0xb'),auth[_0x23a1('0x9')](),controller[_0x23a1('0xc')]);router[_0x23a1('0xd')](_0x23a1('0xe'),auth[_0x23a1('0x9')](),controller[_0x23a1('0xf')]);router[_0x23a1('0xd')](_0x23a1('0x10'),auth[_0x23a1('0x9')](),controller['getFields']);router[_0x23a1('0x11')]('/',auth[_0x23a1('0x9')](),controller['create']);router[_0x23a1('0x11')]('/:id/configurations',auth[_0x23a1('0x9')](),controller[_0x23a1('0x12')]);router[_0x23a1('0x13')]('/:id',auth[_0x23a1('0x9')](),controller[_0x23a1('0x14')]);router[_0x23a1('0x15')](_0x23a1('0xb'),auth[_0x23a1('0x9')](),controller[_0x23a1('0x16')]);module[_0x23a1('0x17')]=router; \ No newline at end of file +var _0x88c9=['get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','/:id','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./intVtigerAccount.controller'];(function(_0x16d644,_0x46545e){var _0xf808cc=function(_0x4024ef){while(--_0x4024ef){_0x16d644['push'](_0x16d644['shift']());}};_0xf808cc(++_0x46545e);}(_0x88c9,0x1f2));var _0x988c=function(_0x150903,_0x216977){_0x150903=_0x150903-0x0;var _0x35ed81=_0x88c9[_0x150903];return _0x35ed81;};'use strict';var multer=require(_0x988c('0x0'));var util=require(_0x988c('0x1'));var path=require(_0x988c('0x2'));var timeout=require(_0x988c('0x3'));var express=require(_0x988c('0x4'));var router=express['Router']();var fs_extra=require(_0x988c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x988c('0x6'));var controller=require(_0x988c('0x7'));router[_0x988c('0x8')]('/',auth[_0x988c('0x9')](),controller[_0x988c('0xa')]);router['get']('/:id',auth[_0x988c('0x9')](),controller[_0x988c('0xb')]);router[_0x988c('0x8')](_0x988c('0xc'),auth[_0x988c('0x9')](),controller[_0x988c('0xd')]);router[_0x988c('0x8')](_0x988c('0xe'),auth[_0x988c('0x9')](),controller[_0x988c('0xf')]);router['post']('/',auth[_0x988c('0x9')](),controller[_0x988c('0x10')]);router[_0x988c('0x11')](_0x988c('0xc'),auth[_0x988c('0x9')](),controller[_0x988c('0x12')]);router[_0x988c('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x988c('0x14'),auth['isAuthenticated'](),controller['destroy']);module[_0x988c('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 22523ec..9e3b845 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 _0x7d0f=['sequelize','exports','STRING','HelpDesk'];(function(_0x3dab43,_0x5a3b28){var _0x2a24a8=function(_0x2cc200){while(--_0x2cc200){_0x3dab43['push'](_0x3dab43['shift']());}};_0x2a24a8(++_0x5a3b28);}(_0x7d0f,0x144));var _0xf7d0=function(_0x1c4c3a,_0x4bfa79){_0x1c4c3a=_0x1c4c3a-0x0;var _0x429a47=_0x7d0f[_0x1c4c3a];return _0x429a47;};'use strict';var Sequelize=require(_0xf7d0('0x0'));module[_0xf7d0('0x1')]={'name':{'type':Sequelize[_0xf7d0('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf7d0('0x2')]},'username':{'type':Sequelize[_0xf7d0('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xf7d0('0x2')],'allowNull':![],'defaultValue':_0xf7d0('0x3')},'remoteUri':{'type':Sequelize[_0xf7d0('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x5811=['STRING','HelpDesk','sequelize','exports'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x5811,0x15a));var _0x1581=function(_0x46d124,_0x1993dd){_0x46d124=_0x46d124-0x0;var _0x1f2416=_0x5811[_0x46d124];return _0x1f2416;};'use strict';var Sequelize=require(_0x1581('0x0'));module[_0x1581('0x1')]={'name':{'type':Sequelize[_0x1581('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1581('0x2')]},'username':{'type':Sequelize[_0x1581('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x1581('0x2')],'allowNull':![],'defaultValue':_0x1581('0x3')},'remoteUri':{'type':Sequelize[_0x1581('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x1581('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x1581('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index b327c19..e28a32a 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 _0x21c8=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','sendStatus','error','name','send','index','map','VtigerAccount','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','type','filter','options','includeAll','findAll','rows','catch','show','params','include','merge','find','create','body','getConfigurations','VtigerConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','VtigerField','Subjects','md5','getFields','username','description','moduleName','remoteUri','slice','substring','format','GET','getchallenge','POST','login','result','success','sessionName','autogenerated','reference','owner','remove','includes','editable','false','startsWith','cf_','picklist','picklistValues','label','value','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x337651,_0x2af690){var _0x20893c=function(_0x545dcd){while(--_0x545dcd){_0x337651['push'](_0x337651['shift']());}};_0x20893c(++_0x2af690);}(_0x21c8,0x1d3));var _0x821c=function(_0x5a1552,_0x5478df){_0x5a1552=_0x5a1552-0x0;var _0x88e370=_0x21c8[_0x5a1552];return _0x88e370;};'use strict';var emlformat=require(_0x821c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x821c('0x1'));var rp=require('request-promise');var moment=require(_0x821c('0x2'));var BPromise=require(_0x821c('0x3'));var Mustache=require(_0x821c('0x4'));var util=require(_0x821c('0x5'));var path=require(_0x821c('0x6'));var sox=require(_0x821c('0x7'));var csv=require(_0x821c('0x8'));var ejs=require(_0x821c('0x9'));var fs=require('fs');var fs_extra=require(_0x821c('0xa'));var _=require(_0x821c('0xb'));var squel=require(_0x821c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x821c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x821c('0xe'));var Papa=require('papaparse');var Redis=require(_0x821c('0xf'));var authService=require(_0x821c('0x10'));var qs=require(_0x821c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x821c('0x12'));var logger=require(_0x821c('0x13'))('api');var utils=require(_0x821c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x821c('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x821c('0x16'));function respondWithStatusCode(_0x369a62,_0x59799e){_0x59799e=_0x59799e||0xcc;return function(_0x4040c8){if(_0x4040c8){return _0x369a62['sendStatus'](_0x59799e);}return _0x369a62[_0x821c('0x17')](_0x59799e)[_0x821c('0x18')]();};}function respondWithResult(_0x7c69b0,_0x4b0fdb){_0x4b0fdb=_0x4b0fdb||0xc8;return function(_0x20556f){if(_0x20556f){return _0x7c69b0['status'](_0x4b0fdb)[_0x821c('0x19')](_0x20556f);}};}function respondWithFilteredResult(_0x318201,_0xeae81a){return function(_0x9bdbf2){if(_0x9bdbf2){var _0x13f32b=typeof _0xeae81a[_0x821c('0x1a')]===_0x821c('0x1b')&&typeof _0xeae81a[_0x821c('0x1c')]===_0x821c('0x1b');var _0x4d485d=_0x9bdbf2[_0x821c('0x1d')];var _0x59f71d=_0x13f32b?0x0:_0xeae81a[_0x821c('0x1a')];var _0x4668b4=_0x13f32b?_0x9bdbf2[_0x821c('0x1d')]:_0xeae81a[_0x821c('0x1a')]+_0xeae81a[_0x821c('0x1c')];var _0x28a128;if(_0x4668b4>=_0x4d485d){_0x4668b4=_0x4d485d;_0x28a128=0xc8;}else{_0x28a128=0xce;}_0x318201[_0x821c('0x17')](_0x28a128);return _0x318201[_0x821c('0x1e')](_0x821c('0x1f'),_0x59f71d+'-'+_0x4668b4+'/'+_0x4d485d)['json'](_0x9bdbf2);}return null;};}function patchUpdates(_0xd16b63){return function(_0x196026){try{jsonpatch[_0x821c('0x20')](_0x196026,_0xd16b63,!![]);}catch(_0x2a6e61){return BPromise['reject'](_0x2a6e61);}return _0x196026['save']();};}function saveUpdates(_0x10f084,_0x96a41d){return function(_0x2beb8e){if(_0x2beb8e){return _0x2beb8e[_0x821c('0x21')](_0x10f084)[_0x821c('0x22')](function(_0x1876da){return _0x1876da;});}return null;};}function removeEntity(_0x1d947b,_0x150d16){return function(_0x1683df){if(_0x1683df){return _0x1683df[_0x821c('0x23')]()[_0x821c('0x22')](function(){_0x1d947b[_0x821c('0x17')](0xcc)[_0x821c('0x18')]();});}};}function handleEntityNotFound(_0x52fdd9,_0x299667){return function(_0x27033d){if(!_0x27033d){_0x52fdd9[_0x821c('0x24')](0x194);}return _0x27033d;};}function handleError(_0x38e489,_0x195cf1){_0x195cf1=_0x195cf1||0x1f4;return function(_0x52fe75){logger[_0x821c('0x25')](_0x52fe75['stack']);if(_0x52fe75[_0x821c('0x26')]){delete _0x52fe75[_0x821c('0x26')];}_0x38e489[_0x821c('0x17')](_0x195cf1)[_0x821c('0x27')](_0x52fe75);};}exports[_0x821c('0x28')]=function(_0x28a713,_0x4efe6c){var _0x1115f7={},_0x24ac73={},_0x68f89c={'count':0x0,'rows':[]};var _0x5ec8a6=_[_0x821c('0x29')](db[_0x821c('0x2a')][_0x821c('0x2b')],function(_0x3d99dc){return{'name':_0x3d99dc[_0x821c('0x2c')],'type':_0x3d99dc['type'][_0x821c('0x2d')]};});_0x24ac73[_0x821c('0x2e')]=_[_0x821c('0x29')](_0x5ec8a6,_0x821c('0x26'));_0x24ac73[_0x821c('0x2f')]=_[_0x821c('0x30')](_0x28a713[_0x821c('0x2f')]);_0x24ac73[_0x821c('0x31')]=_['intersection'](_0x24ac73['model'],_0x24ac73[_0x821c('0x2f')]);_0x1115f7[_0x821c('0x32')]=_[_0x821c('0x33')](_0x24ac73[_0x821c('0x2e')],qs[_0x821c('0x34')](_0x28a713[_0x821c('0x2f')][_0x821c('0x34')]));_0x1115f7[_0x821c('0x32')]=_0x1115f7[_0x821c('0x32')][_0x821c('0x35')]?_0x1115f7[_0x821c('0x32')]:_0x24ac73[_0x821c('0x2e')];if(!_0x28a713['query']['hasOwnProperty'](_0x821c('0x36'))){_0x1115f7['limit']=qs['limit'](_0x28a713[_0x821c('0x2f')][_0x821c('0x1c')]);_0x1115f7[_0x821c('0x1a')]=qs[_0x821c('0x1a')](_0x28a713[_0x821c('0x2f')][_0x821c('0x1a')]);}_0x1115f7[_0x821c('0x37')]=qs['sort'](_0x28a713['query'][_0x821c('0x38')]);_0x1115f7[_0x821c('0x39')]=qs['filters'](_[_0x821c('0x3a')](_0x28a713[_0x821c('0x2f')],_0x24ac73[_0x821c('0x31')]),_0x5ec8a6);if(_0x28a713[_0x821c('0x2f')]['filter']){_0x1115f7['where']=_['merge'](_0x1115f7[_0x821c('0x39')],{'$or':_[_0x821c('0x29')](_0x5ec8a6,function(_0x90fa24){if(_0x90fa24[_0x821c('0x3b')]!=='VIRTUAL'){var _0x1120f9={};_0x1120f9[_0x90fa24[_0x821c('0x26')]]={'$like':'%'+_0x28a713[_0x821c('0x2f')][_0x821c('0x3c')]+'%'};return _0x1120f9;}})});}_0x1115f7=_['merge']({},_0x1115f7,_0x28a713[_0x821c('0x3d')]);var _0x49ee69={'where':_0x1115f7[_0x821c('0x39')]};return db['VtigerAccount']['count'](_0x49ee69)['then'](function(_0x1ee72c){_0x68f89c[_0x821c('0x1d')]=_0x1ee72c;if(_0x28a713[_0x821c('0x2f')][_0x821c('0x3e')]){_0x1115f7['include']=[{'all':!![]}];}return db['VtigerAccount'][_0x821c('0x3f')](_0x1115f7);})[_0x821c('0x22')](function(_0xc3a620){_0x68f89c[_0x821c('0x40')]=_0xc3a620;return _0x68f89c;})['then'](respondWithFilteredResult(_0x4efe6c,_0x1115f7))[_0x821c('0x41')](handleError(_0x4efe6c,null));};exports[_0x821c('0x42')]=function(_0xfdf53d,_0x5985f8){var _0x7f74f8={'raw':![],'where':{'id':_0xfdf53d[_0x821c('0x43')]['id']}},_0xc4b3b1={};_0xc4b3b1['model']=_['keys'](db['VtigerAccount'][_0x821c('0x2b')]);_0xc4b3b1[_0x821c('0x2f')]=_[_0x821c('0x30')](_0xfdf53d[_0x821c('0x2f')]);_0xc4b3b1['filters']=_['intersection'](_0xc4b3b1[_0x821c('0x2e')],_0xc4b3b1[_0x821c('0x2f')]);_0x7f74f8[_0x821c('0x32')]=_[_0x821c('0x33')](_0xc4b3b1[_0x821c('0x2e')],qs['fields'](_0xfdf53d[_0x821c('0x2f')][_0x821c('0x34')]));_0x7f74f8[_0x821c('0x32')]=_0x7f74f8['attributes'][_0x821c('0x35')]?_0x7f74f8[_0x821c('0x32')]:_0xc4b3b1[_0x821c('0x2e')];if(_0xfdf53d['query'][_0x821c('0x3e')]){_0x7f74f8[_0x821c('0x44')]=[{'all':!![]}];}_0x7f74f8=_[_0x821c('0x45')]({},_0x7f74f8,_0xfdf53d[_0x821c('0x3d')]);return db[_0x821c('0x2a')][_0x821c('0x46')](_0x7f74f8)[_0x821c('0x22')](handleEntityNotFound(_0x5985f8,null))[_0x821c('0x22')](respondWithResult(_0x5985f8,null))[_0x821c('0x41')](handleError(_0x5985f8,null));};exports['create']=function(_0x321907,_0x2500a7){return db[_0x821c('0x2a')][_0x821c('0x47')](_0x321907[_0x821c('0x48')],{})[_0x821c('0x22')](respondWithResult(_0x2500a7,0xc9))[_0x821c('0x41')](handleError(_0x2500a7,null));};exports[_0x821c('0x21')]=function(_0x12f440,_0x3816ce){if(_0x12f440['body']['id']){delete _0x12f440[_0x821c('0x48')]['id'];}return db[_0x821c('0x2a')][_0x821c('0x46')]({'where':{'id':_0x12f440[_0x821c('0x43')]['id']}})[_0x821c('0x22')](handleEntityNotFound(_0x3816ce,null))[_0x821c('0x22')](saveUpdates(_0x12f440[_0x821c('0x48')],null))[_0x821c('0x22')](respondWithResult(_0x3816ce,null))['catch'](handleError(_0x3816ce,null));};exports[_0x821c('0x23')]=function(_0x2f88ff,_0x27902b){return db[_0x821c('0x2a')][_0x821c('0x46')]({'where':{'id':_0x2f88ff[_0x821c('0x43')]['id']}})[_0x821c('0x22')](handleEntityNotFound(_0x27902b,null))['then'](removeEntity(_0x27902b,null))[_0x821c('0x41')](handleError(_0x27902b,null));};exports[_0x821c('0x49')]=function(_0x1f3085,_0x4c341a,_0x39c6e6){var _0x3ff042={};var _0x17d57a={};var _0xf9d74d;var _0x1aa396;return db['VtigerAccount']['findOne']({'where':{'id':_0x1f3085[_0x821c('0x43')]['id']}})[_0x821c('0x22')](handleEntityNotFound(_0x4c341a,null))[_0x821c('0x22')](function(_0x32b7ea){if(_0x32b7ea){_0xf9d74d=_0x32b7ea;_0x17d57a[_0x821c('0x2e')]=_[_0x821c('0x30')](db[_0x821c('0x4a')]['rawAttributes']);_0x17d57a[_0x821c('0x2f')]=_[_0x821c('0x30')](_0x1f3085[_0x821c('0x2f')]);_0x17d57a[_0x821c('0x31')]=_[_0x821c('0x33')](_0x17d57a[_0x821c('0x2e')],_0x17d57a[_0x821c('0x2f')]);_0x3ff042[_0x821c('0x32')]=_[_0x821c('0x33')](_0x17d57a[_0x821c('0x2e')],qs[_0x821c('0x34')](_0x1f3085[_0x821c('0x2f')][_0x821c('0x34')]));_0x3ff042['attributes']=_0x3ff042[_0x821c('0x32')][_0x821c('0x35')]?_0x3ff042[_0x821c('0x32')]:_0x17d57a[_0x821c('0x2e')];_0x3ff042[_0x821c('0x37')]=qs[_0x821c('0x38')](_0x1f3085[_0x821c('0x2f')]['sort']);_0x3ff042[_0x821c('0x39')]=qs[_0x821c('0x31')](_['pick'](_0x1f3085[_0x821c('0x2f')],_0x17d57a[_0x821c('0x31')]));if(_0x1f3085[_0x821c('0x2f')]['filter']){_0x3ff042[_0x821c('0x39')]=_[_0x821c('0x45')](_0x3ff042[_0x821c('0x39')],{'$or':_[_0x821c('0x29')](_0x3ff042[_0x821c('0x32')],function(_0x40155c){var _0x2ccfc0={};_0x2ccfc0[_0x40155c]={'$like':'%'+_0x1f3085[_0x821c('0x2f')][_0x821c('0x3c')]+'%'};return _0x2ccfc0;})});}_0x3ff042=_['merge']({},_0x3ff042,_0x1f3085['options']);return _0xf9d74d[_0x821c('0x49')](_0x3ff042);}})['then'](function(_0x43e797){if(_0x43e797){_0x1aa396=_0x43e797[_0x821c('0x35')];if(!_0x1f3085['query'][_0x821c('0x4b')]('nolimit')){_0x3ff042[_0x821c('0x1c')]=qs[_0x821c('0x1c')](_0x1f3085[_0x821c('0x2f')][_0x821c('0x1c')]);_0x3ff042['offset']=qs[_0x821c('0x1a')](_0x1f3085[_0x821c('0x2f')][_0x821c('0x1a')]);}return _0xf9d74d[_0x821c('0x49')](_0x3ff042);}})[_0x821c('0x22')](function(_0x4de5cb){if(_0x4de5cb){return _0x4de5cb?{'count':_0x1aa396,'rows':_0x4de5cb}:null;}})[_0x821c('0x22')](respondWithResult(_0x4c341a,null))['catch'](handleError(_0x4c341a,null));};exports[_0x821c('0x4c')]=function(_0xbd7cf0,_0x3a55ba,_0x2013ef){if(_0xbd7cf0[_0x821c('0x48')]['id']){delete _0xbd7cf0[_0x821c('0x48')]['id'];}return db[_0x821c('0x2a')][_0x821c('0x4d')]({'where':{'id':_0xbd7cf0[_0x821c('0x43')]['id']}})['then'](handleEntityNotFound(_0x3a55ba,null))[_0x821c('0x22')](function(_0x44a0a1){if(_0x44a0a1){_0xbd7cf0[_0x821c('0x48')][_0x821c('0x4e')]=_0x44a0a1['id'];_0xbd7cf0[_0x821c('0x48')]['Subjects']=integrations[_0x821c('0x4f')](_0xbd7cf0[_0x821c('0x48')][_0x821c('0x50')],_0xbd7cf0[_0x821c('0x48')]['type']);_0xbd7cf0[_0x821c('0x48')][_0x821c('0x51')]=integrations[_0x821c('0x52')](_0xbd7cf0['body'][_0x821c('0x50')],_0xbd7cf0[_0x821c('0x48')][_0x821c('0x3b')]);return db['VtigerConfiguration'][_0x821c('0x47')](_0xbd7cf0['body'],{'include':[{'model':db[_0x821c('0x53')],'as':_0x821c('0x54')},{'model':db[_0x821c('0x53')],'as':_0x821c('0x51')}]});}return null;})[_0x821c('0x22')](respondWithResult(_0x3a55ba,null))[_0x821c('0x41')](handleError(_0x3a55ba,null));};var md5=require(_0x821c('0x55'));exports[_0x821c('0x56')]=function(_0x51abcd,_0x175091,_0x301cbf){var _0x186490=null;var _0x4f3fe5=null;var _0x57f96a=null;var _0xaa86c4=null;var _0x12c4b6='';return db['VtigerAccount'][_0x821c('0x4d')]({'where':{'id':_0x51abcd[_0x821c('0x43')]['id']},'attributes':['id',_0x821c('0x26'),_0x821c('0x57'),_0x821c('0x58'),_0x821c('0x59'),_0x821c('0x5a'),'serverUrl','accessKey']})[_0x821c('0x22')](handleEntityNotFound(_0x175091,null))[_0x821c('0x22')](function(_0x301bd1){if(_0x301bd1){_0x186490=_0x301bd1[_0x821c('0x57')];_0x4f3fe5=_0x301bd1['accessKey'];_0x57f96a=_0x301bd1[_0x821c('0x59')];_0x12c4b6=_0x301bd1['remoteUri'];var _0x47607d=_0x12c4b6[_0x821c('0x5b')](-0x1);if(_0x47607d==='/'){_0x12c4b6=_0x12c4b6[_0x821c('0x5c')](0x0,_0x12c4b6['lastIndexOf'](_0x47607d));}_0xaa86c4=util[_0x821c('0x5d')]('%s/webservice.php',_0x12c4b6);var _0x169a75={'method':_0x821c('0x5e'),'uri':_0xaa86c4,'qs':{'operation':_0x821c('0x5f'),'username':_0x301bd1[_0x821c('0x57')]},'json':!![]};return rp(_0x169a75);}})[_0x821c('0x22')](function(_0x48122d){if(_0x48122d['success']){var _0x1d9d1f={'method':_0x821c('0x60'),'uri':_0xaa86c4,'form':{'operation':_0x821c('0x61'),'username':_0x186490,'accessKey':md5(_0x48122d[_0x821c('0x62')]['token']+_0x4f3fe5)},'json':!![]};return rp(_0x1d9d1f);}})['then'](function(_0x104cb6){if(_0x104cb6[_0x821c('0x63')]){var _0x5b07c6={'method':'GET','uri':_0xaa86c4,'qs':{'operation':'describe','username':_0x186490,'sessionName':_0x104cb6[_0x821c('0x62')][_0x821c('0x64')],'elementType':_0x57f96a},'json':!![]};return rp(_0x5b07c6);}})[_0x821c('0x22')](function(_0x191aa1){if(_0x191aa1[_0x821c('0x63')]){var _0x2b13c2=[_0x821c('0x65'),_0x821c('0x66'),_0x821c('0x67')];_[_0x821c('0x68')](_0x191aa1['result']['fields'],function(_0x23e5f3){return _0x2b13c2[_0x821c('0x69')](_0x23e5f3[_0x821c('0x3b')][_0x821c('0x26')]);});_['remove'](_0x191aa1[_0x821c('0x62')][_0x821c('0x34')],function(_0x1815fb){return _0x1815fb[_0x821c('0x6a')]===_0x821c('0x6b');});return{'count':_0x191aa1['result'][_0x821c('0x34')][_0x821c('0x35')],'rows':_[_0x821c('0x29')](_0x191aa1['result']['fields'],function(_0x1a1aca){return{'id':_0x1a1aca['name'],'name':_0x1a1aca['label'],'custom':_[_0x821c('0x6c')](_0x1a1aca['name'],_0x821c('0x6d'))?!![]:![],'options':_0x1a1aca[_0x821c('0x3b')][_0x821c('0x26')]===_0x821c('0x6e')&&_0x1a1aca[_0x821c('0x3b')][_0x821c('0x6f')][_0x821c('0x35')]>0x0?_[_0x821c('0x29')](_0x1a1aca['type']['picklistValues'],function(_0x35fee8){return{'name':_0x35fee8[_0x821c('0x70')],'value':_0x35fee8[_0x821c('0x71')]};}):[]};})};}})['then'](respondWithResult(_0x175091,null))[_0x821c('0x41')](function(_0x25acfd){console[_0x821c('0x72')](_0x821c('0x73')+_0x25acfd);var _0x1a7766=_0x51abcd['query'][_0x821c('0x74')]?0x1f4:_0x25acfd['statusCode']||0x1f4;logger[_0x821c('0x25')](_0x821c('0x75'),'getFields',_0x1a7766,JSON[_0x821c('0x76')](_0x25acfd));delete _0x25acfd[_0x821c('0x26')];if(_0x1a7766===0x191){_0x1a7766=0x190;}_0x175091['status'](_0x1a7766)['send'](_0x51abcd[_0x821c('0x2f')][_0x821c('0x74')]?{'message':'Wrong\x20credentials','statusCode':_0x25acfd[_0x821c('0x77')]}:_0x25acfd);});}; \ No newline at end of file +var _0xb771=['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','update','then','destroy','error','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','create','body','find','getConfigurations','findOne','VtigerConfiguration','hasOwnProperty','nolimit','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','VtigerField','md5','getFields','username','moduleName','serverUrl','accessKey','remoteUri','slice','substring','lastIndexOf','%s/webservice.php','GET','success','POST','token','autogenerated','owner','remove','result','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x2bc7c6,_0x1881a5){var _0x540b1d=function(_0x4b4d1c){while(--_0x4b4d1c){_0x2bc7c6['push'](_0x2bc7c6['shift']());}};_0x540b1d(++_0x1881a5);}(_0xb771,0x1e0));var _0x1b77=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb771[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x1b77('0x0'));var rimraf=require(_0x1b77('0x1'));var zipdir=require(_0x1b77('0x2'));var jsonpatch=require(_0x1b77('0x3'));var rp=require(_0x1b77('0x4'));var moment=require(_0x1b77('0x5'));var BPromise=require(_0x1b77('0x6'));var Mustache=require(_0x1b77('0x7'));var util=require(_0x1b77('0x8'));var path=require(_0x1b77('0x9'));var sox=require(_0x1b77('0xa'));var csv=require(_0x1b77('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b77('0xc'));var _=require(_0x1b77('0xd'));var squel=require(_0x1b77('0xe'));var crypto=require(_0x1b77('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x1b77('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1b77('0x11'));var Papa=require(_0x1b77('0x12'));var Redis=require(_0x1b77('0x13'));var authService=require(_0x1b77('0x14'));var qs=require(_0x1b77('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b77('0x16'));var logger=require(_0x1b77('0x17'))(_0x1b77('0x18'));var utils=require(_0x1b77('0x19'));var config=require(_0x1b77('0x1a'));var licenseUtil=require(_0x1b77('0x1b'));var db=require(_0x1b77('0x1c'))['db'];var integrations=require(_0x1b77('0x1d'));function respondWithStatusCode(_0x221520,_0x36b2bc){_0x36b2bc=_0x36b2bc||0xcc;return function(_0x3c500f){if(_0x3c500f){return _0x221520[_0x1b77('0x1e')](_0x36b2bc);}return _0x221520[_0x1b77('0x1f')](_0x36b2bc)[_0x1b77('0x20')]();};}function respondWithResult(_0x4d45c1,_0x307072){_0x307072=_0x307072||0xc8;return function(_0x1519e4){if(_0x1519e4){return _0x4d45c1[_0x1b77('0x1f')](_0x307072)[_0x1b77('0x21')](_0x1519e4);}};}function respondWithFilteredResult(_0x34a532,_0x3c68ec){return function(_0x301e58){if(_0x301e58){var _0x32aa96=typeof _0x3c68ec[_0x1b77('0x22')]===_0x1b77('0x23')&&typeof _0x3c68ec[_0x1b77('0x24')]===_0x1b77('0x23');var _0xf65ac2=_0x301e58[_0x1b77('0x25')];var _0x42d235=_0x32aa96?0x0:_0x3c68ec[_0x1b77('0x22')];var _0x200cac=_0x32aa96?_0x301e58['count']:_0x3c68ec[_0x1b77('0x22')]+_0x3c68ec[_0x1b77('0x24')];var _0x3d8fae;if(_0x200cac>=_0xf65ac2){_0x200cac=_0xf65ac2;_0x3d8fae=0xc8;}else{_0x3d8fae=0xce;}_0x34a532[_0x1b77('0x1f')](_0x3d8fae);return _0x34a532[_0x1b77('0x26')](_0x1b77('0x27'),_0x42d235+'-'+_0x200cac+'/'+_0xf65ac2)[_0x1b77('0x21')](_0x301e58);}return null;};}function patchUpdates(_0x38507d){return function(_0x47387b){try{jsonpatch[_0x1b77('0x28')](_0x47387b,_0x38507d,!![]);}catch(_0x5d12e8){return BPromise[_0x1b77('0x29')](_0x5d12e8);}return _0x47387b[_0x1b77('0x2a')]();};}function saveUpdates(_0x93fd3d,_0x2dfd78){return function(_0x100308){if(_0x100308){return _0x100308[_0x1b77('0x2b')](_0x93fd3d)[_0x1b77('0x2c')](function(_0x333df3){return _0x333df3;});}return null;};}function removeEntity(_0x3f78b7,_0x51665a){return function(_0x2d5d59){if(_0x2d5d59){return _0x2d5d59[_0x1b77('0x2d')]()[_0x1b77('0x2c')](function(){_0x3f78b7[_0x1b77('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x541889,_0x51d628){return function(_0x3053b3){if(!_0x3053b3){_0x541889[_0x1b77('0x1e')](0x194);}return _0x3053b3;};}function handleError(_0x5e854f,_0xce0105){_0xce0105=_0xce0105||0x1f4;return function(_0x458a8b){logger[_0x1b77('0x2e')](_0x458a8b[_0x1b77('0x2f')]);if(_0x458a8b['name']){delete _0x458a8b[_0x1b77('0x30')];}_0x5e854f['status'](_0xce0105)[_0x1b77('0x31')](_0x458a8b);};}exports['index']=function(_0xed2da1,_0x516a36){var _0x4b04fd={},_0x3e9d6e={},_0x10840c={'count':0x0,'rows':[]};var _0x519dec=_[_0x1b77('0x32')](db[_0x1b77('0x33')][_0x1b77('0x34')],function(_0x1e5277){return{'name':_0x1e5277[_0x1b77('0x35')],'type':_0x1e5277['type'][_0x1b77('0x36')]};});_0x3e9d6e[_0x1b77('0x37')]=_[_0x1b77('0x32')](_0x519dec,'name');_0x3e9d6e['query']=_[_0x1b77('0x38')](_0xed2da1[_0x1b77('0x39')]);_0x3e9d6e[_0x1b77('0x3a')]=_[_0x1b77('0x3b')](_0x3e9d6e[_0x1b77('0x37')],_0x3e9d6e[_0x1b77('0x39')]);_0x4b04fd[_0x1b77('0x3c')]=_[_0x1b77('0x3b')](_0x3e9d6e['model'],qs['fields'](_0xed2da1[_0x1b77('0x39')][_0x1b77('0x3d')]));_0x4b04fd[_0x1b77('0x3c')]=_0x4b04fd[_0x1b77('0x3c')]['length']?_0x4b04fd[_0x1b77('0x3c')]:_0x3e9d6e[_0x1b77('0x37')];if(!_0xed2da1[_0x1b77('0x39')]['hasOwnProperty']('nolimit')){_0x4b04fd[_0x1b77('0x24')]=qs['limit'](_0xed2da1['query']['limit']);_0x4b04fd['offset']=qs['offset'](_0xed2da1['query'][_0x1b77('0x22')]);}_0x4b04fd[_0x1b77('0x3e')]=qs[_0x1b77('0x3f')](_0xed2da1[_0x1b77('0x39')][_0x1b77('0x3f')]);_0x4b04fd['where']=qs[_0x1b77('0x3a')](_['pick'](_0xed2da1[_0x1b77('0x39')],_0x3e9d6e[_0x1b77('0x3a')]),_0x519dec);if(_0xed2da1[_0x1b77('0x39')][_0x1b77('0x40')]){_0x4b04fd[_0x1b77('0x41')]=_[_0x1b77('0x42')](_0x4b04fd[_0x1b77('0x41')],{'$or':_['map'](_0x519dec,function(_0xa63620){if(_0xa63620['type']!==_0x1b77('0x43')){var _0x20cf52={};_0x20cf52[_0xa63620[_0x1b77('0x30')]]={'$like':'%'+_0xed2da1[_0x1b77('0x39')][_0x1b77('0x40')]+'%'};return _0x20cf52;}})});}_0x4b04fd=_[_0x1b77('0x42')]({},_0x4b04fd,_0xed2da1[_0x1b77('0x44')]);var _0x2c7f44={'where':_0x4b04fd['where']};return db['VtigerAccount'][_0x1b77('0x25')](_0x2c7f44)['then'](function(_0x1d39cd){_0x10840c['count']=_0x1d39cd;if(_0xed2da1[_0x1b77('0x39')][_0x1b77('0x45')]){_0x4b04fd['include']=[{'all':!![]}];}return db[_0x1b77('0x33')][_0x1b77('0x46')](_0x4b04fd);})[_0x1b77('0x2c')](function(_0x17869f){_0x10840c[_0x1b77('0x47')]=_0x17869f;return _0x10840c;})[_0x1b77('0x2c')](respondWithFilteredResult(_0x516a36,_0x4b04fd))[_0x1b77('0x48')](handleError(_0x516a36,null));};exports[_0x1b77('0x49')]=function(_0x2fec49,_0x59ad14){var _0x35f26b={'raw':![],'where':{'id':_0x2fec49[_0x1b77('0x4a')]['id']}},_0x29547b={};_0x29547b['model']=_[_0x1b77('0x38')](db[_0x1b77('0x33')][_0x1b77('0x34')]);_0x29547b[_0x1b77('0x39')]=_[_0x1b77('0x38')](_0x2fec49['query']);_0x29547b['filters']=_['intersection'](_0x29547b[_0x1b77('0x37')],_0x29547b[_0x1b77('0x39')]);_0x35f26b[_0x1b77('0x3c')]=_[_0x1b77('0x3b')](_0x29547b[_0x1b77('0x37')],qs[_0x1b77('0x3d')](_0x2fec49[_0x1b77('0x39')][_0x1b77('0x3d')]));_0x35f26b['attributes']=_0x35f26b['attributes'][_0x1b77('0x4b')]?_0x35f26b['attributes']:_0x29547b[_0x1b77('0x37')];if(_0x2fec49[_0x1b77('0x39')][_0x1b77('0x45')]){_0x35f26b[_0x1b77('0x4c')]=[{'all':!![]}];}_0x35f26b=_['merge']({},_0x35f26b,_0x2fec49[_0x1b77('0x44')]);return db[_0x1b77('0x33')]['find'](_0x35f26b)['then'](handleEntityNotFound(_0x59ad14,null))[_0x1b77('0x2c')](respondWithResult(_0x59ad14,null))[_0x1b77('0x48')](handleError(_0x59ad14,null));};exports[_0x1b77('0x4d')]=function(_0x4001ea,_0x223566){return db[_0x1b77('0x33')][_0x1b77('0x4d')](_0x4001ea[_0x1b77('0x4e')],{})[_0x1b77('0x2c')](respondWithResult(_0x223566,0xc9))[_0x1b77('0x48')](handleError(_0x223566,null));};exports[_0x1b77('0x2b')]=function(_0x596304,_0x29d35e){if(_0x596304[_0x1b77('0x4e')]['id']){delete _0x596304[_0x1b77('0x4e')]['id'];}return db['VtigerAccount']['find']({'where':{'id':_0x596304[_0x1b77('0x4a')]['id']}})[_0x1b77('0x2c')](handleEntityNotFound(_0x29d35e,null))[_0x1b77('0x2c')](saveUpdates(_0x596304[_0x1b77('0x4e')],null))[_0x1b77('0x2c')](respondWithResult(_0x29d35e,null))[_0x1b77('0x48')](handleError(_0x29d35e,null));};exports['destroy']=function(_0x3fc42,_0x1a3cd2){return db[_0x1b77('0x33')][_0x1b77('0x4f')]({'where':{'id':_0x3fc42[_0x1b77('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1a3cd2,null))[_0x1b77('0x2c')](removeEntity(_0x1a3cd2,null))['catch'](handleError(_0x1a3cd2,null));};exports[_0x1b77('0x50')]=function(_0x53d980,_0x52168b,_0x3dfda3){var _0x4a4293={};var _0x2b2c61={};var _0x9ad2da;var _0x1c9a6a;return db[_0x1b77('0x33')][_0x1b77('0x51')]({'where':{'id':_0x53d980['params']['id']}})[_0x1b77('0x2c')](handleEntityNotFound(_0x52168b,null))[_0x1b77('0x2c')](function(_0x19ae94){if(_0x19ae94){_0x9ad2da=_0x19ae94;_0x2b2c61[_0x1b77('0x37')]=_['keys'](db[_0x1b77('0x52')][_0x1b77('0x34')]);_0x2b2c61[_0x1b77('0x39')]=_[_0x1b77('0x38')](_0x53d980[_0x1b77('0x39')]);_0x2b2c61[_0x1b77('0x3a')]=_['intersection'](_0x2b2c61[_0x1b77('0x37')],_0x2b2c61[_0x1b77('0x39')]);_0x4a4293[_0x1b77('0x3c')]=_[_0x1b77('0x3b')](_0x2b2c61[_0x1b77('0x37')],qs[_0x1b77('0x3d')](_0x53d980[_0x1b77('0x39')][_0x1b77('0x3d')]));_0x4a4293[_0x1b77('0x3c')]=_0x4a4293[_0x1b77('0x3c')][_0x1b77('0x4b')]?_0x4a4293['attributes']:_0x2b2c61[_0x1b77('0x37')];_0x4a4293[_0x1b77('0x3e')]=qs[_0x1b77('0x3f')](_0x53d980[_0x1b77('0x39')]['sort']);_0x4a4293[_0x1b77('0x41')]=qs[_0x1b77('0x3a')](_['pick'](_0x53d980[_0x1b77('0x39')],_0x2b2c61['filters']));if(_0x53d980[_0x1b77('0x39')]['filter']){_0x4a4293['where']=_[_0x1b77('0x42')](_0x4a4293[_0x1b77('0x41')],{'$or':_[_0x1b77('0x32')](_0x4a4293['attributes'],function(_0x36f1a0){var _0x197849={};_0x197849[_0x36f1a0]={'$like':'%'+_0x53d980[_0x1b77('0x39')][_0x1b77('0x40')]+'%'};return _0x197849;})});}_0x4a4293=_[_0x1b77('0x42')]({},_0x4a4293,_0x53d980['options']);return _0x9ad2da[_0x1b77('0x50')](_0x4a4293);}})['then'](function(_0x42f3f1){if(_0x42f3f1){_0x1c9a6a=_0x42f3f1['length'];if(!_0x53d980[_0x1b77('0x39')][_0x1b77('0x53')](_0x1b77('0x54'))){_0x4a4293[_0x1b77('0x24')]=qs[_0x1b77('0x24')](_0x53d980[_0x1b77('0x39')]['limit']);_0x4a4293[_0x1b77('0x22')]=qs['offset'](_0x53d980[_0x1b77('0x39')][_0x1b77('0x22')]);}return _0x9ad2da[_0x1b77('0x50')](_0x4a4293);}})[_0x1b77('0x2c')](function(_0x4ea48e){if(_0x4ea48e){return _0x4ea48e?{'count':_0x1c9a6a,'rows':_0x4ea48e}:null;}})['then'](respondWithResult(_0x52168b,null))[_0x1b77('0x48')](handleError(_0x52168b,null));};exports['addConfiguration']=function(_0x55936f,_0x8bb091,_0x4f284a){if(_0x55936f['body']['id']){delete _0x55936f['body']['id'];}return db[_0x1b77('0x33')][_0x1b77('0x51')]({'where':{'id':_0x55936f[_0x1b77('0x4a')]['id']}})[_0x1b77('0x2c')](handleEntityNotFound(_0x8bb091,null))[_0x1b77('0x2c')](function(_0xc598e4){if(_0xc598e4){_0x55936f['body'][_0x1b77('0x55')]=_0xc598e4['id'];_0x55936f[_0x1b77('0x4e')][_0x1b77('0x56')]=integrations[_0x1b77('0x57')](_0x55936f[_0x1b77('0x4e')][_0x1b77('0x58')],_0x55936f['body'][_0x1b77('0x59')]);_0x55936f['body'][_0x1b77('0x5a')]=integrations[_0x1b77('0x5b')](_0x55936f[_0x1b77('0x4e')][_0x1b77('0x58')],_0x55936f[_0x1b77('0x4e')][_0x1b77('0x59')]);return db['VtigerConfiguration'][_0x1b77('0x4d')](_0x55936f[_0x1b77('0x4e')],{'include':[{'model':db['VtigerField'],'as':_0x1b77('0x56')},{'model':db[_0x1b77('0x5c')],'as':'Descriptions'}]});}return null;})[_0x1b77('0x2c')](respondWithResult(_0x8bb091,null))['catch'](handleError(_0x8bb091,null));};var md5=require(_0x1b77('0x5d'));exports[_0x1b77('0x5e')]=function(_0x439a1b,_0x22d2c8,_0x3ce8cc){var _0x59a7f6=null;var _0x540092=null;var _0x42790f=null;var _0x47cf19=null;var _0x23f24c='';return db[_0x1b77('0x33')][_0x1b77('0x51')]({'where':{'id':_0x439a1b[_0x1b77('0x4a')]['id']},'attributes':['id',_0x1b77('0x30'),_0x1b77('0x5f'),'description',_0x1b77('0x60'),'remoteUri',_0x1b77('0x61'),_0x1b77('0x62')]})[_0x1b77('0x2c')](handleEntityNotFound(_0x22d2c8,null))[_0x1b77('0x2c')](function(_0x7d3257){if(_0x7d3257){_0x59a7f6=_0x7d3257[_0x1b77('0x5f')];_0x540092=_0x7d3257[_0x1b77('0x62')];_0x42790f=_0x7d3257[_0x1b77('0x60')];_0x23f24c=_0x7d3257[_0x1b77('0x63')];var _0x29e3ce=_0x23f24c[_0x1b77('0x64')](-0x1);if(_0x29e3ce==='/'){_0x23f24c=_0x23f24c[_0x1b77('0x65')](0x0,_0x23f24c[_0x1b77('0x66')](_0x29e3ce));}_0x47cf19=util['format'](_0x1b77('0x67'),_0x23f24c);var _0x4f6bf6={'method':_0x1b77('0x68'),'uri':_0x47cf19,'qs':{'operation':'getchallenge','username':_0x7d3257['username']},'json':!![]};return rp(_0x4f6bf6);}})[_0x1b77('0x2c')](function(_0x2c35a1){if(_0x2c35a1[_0x1b77('0x69')]){var _0x4e4fe0={'method':_0x1b77('0x6a'),'uri':_0x47cf19,'form':{'operation':'login','username':_0x59a7f6,'accessKey':md5(_0x2c35a1['result'][_0x1b77('0x6b')]+_0x540092)},'json':!![]};return rp(_0x4e4fe0);}})[_0x1b77('0x2c')](function(_0x4a0d5d){if(_0x4a0d5d[_0x1b77('0x69')]){var _0x590c6d={'method':_0x1b77('0x68'),'uri':_0x47cf19,'qs':{'operation':'describe','username':_0x59a7f6,'sessionName':_0x4a0d5d['result']['sessionName'],'elementType':_0x42790f},'json':!![]};return rp(_0x590c6d);}})[_0x1b77('0x2c')](function(_0x52ec39){if(_0x52ec39[_0x1b77('0x69')]){var _0x5b4c59=[_0x1b77('0x6c'),'reference',_0x1b77('0x6d')];_[_0x1b77('0x6e')](_0x52ec39[_0x1b77('0x6f')][_0x1b77('0x3d')],function(_0x7afb66){return _0x5b4c59['includes'](_0x7afb66['type'][_0x1b77('0x30')]);});_[_0x1b77('0x6e')](_0x52ec39[_0x1b77('0x6f')]['fields'],function(_0x34a296){return _0x34a296[_0x1b77('0x70')]===_0x1b77('0x71');});return{'count':_0x52ec39[_0x1b77('0x6f')][_0x1b77('0x3d')][_0x1b77('0x4b')],'rows':_['map'](_0x52ec39[_0x1b77('0x6f')][_0x1b77('0x3d')],function(_0x31a4dc){return{'id':_0x31a4dc[_0x1b77('0x30')],'name':_0x31a4dc[_0x1b77('0x72')],'custom':_[_0x1b77('0x73')](_0x31a4dc[_0x1b77('0x30')],_0x1b77('0x74'))?!![]:![],'options':_0x31a4dc[_0x1b77('0x59')][_0x1b77('0x30')]===_0x1b77('0x75')&&_0x31a4dc[_0x1b77('0x59')][_0x1b77('0x76')][_0x1b77('0x4b')]>0x0?_[_0x1b77('0x32')](_0x31a4dc[_0x1b77('0x59')][_0x1b77('0x76')],function(_0x37bbc7){return{'name':_0x37bbc7[_0x1b77('0x72')],'value':_0x37bbc7[_0x1b77('0x77')]};}):[]};})};}})[_0x1b77('0x2c')](respondWithResult(_0x22d2c8,null))[_0x1b77('0x48')](function(_0x5c4240){console[_0x1b77('0x78')](_0x1b77('0x79')+_0x5c4240);var _0x18934b=_0x439a1b['query'][_0x1b77('0x7a')]?0x1f4:_0x5c4240[_0x1b77('0x7b')]||0x1f4;logger[_0x1b77('0x2e')](_0x1b77('0x7c'),_0x1b77('0x5e'),_0x18934b,JSON['stringify'](_0x5c4240));delete _0x5c4240[_0x1b77('0x30')];if(_0x18934b===0x191){_0x18934b=0x190;}_0x22d2c8[_0x1b77('0x1f')](_0x18934b)[_0x1b77('0x31')](_0x439a1b['query'][_0x1b77('0x7a')]?{'message':_0x1b77('0x7d'),'statusCode':_0x5c4240[_0x1b77('0x7b')]}:_0x5c4240);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 9ffb59c..9acdc6a 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 _0x9bb6=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../components/integrations/configuration','exports','define','VtigerAccount'];(function(_0x5dc5b4,_0x10a848){var _0x23ce5d=function(_0x4f29b8){while(--_0x4f29b8){_0x5dc5b4['push'](_0x5dc5b4['shift']());}};_0x23ce5d(++_0x10a848);}(_0x9bb6,0x176));var _0x69bb=function(_0x216dc9,_0x385e89){_0x216dc9=_0x216dc9-0x0;var _0x51f0c3=_0x9bb6[_0x216dc9];return _0x51f0c3;};'use strict';var _=require(_0x69bb('0x0'));var util=require('util');var logger=require(_0x69bb('0x1'))(_0x69bb('0x2'));var moment=require(_0x69bb('0x3'));var BPromise=require(_0x69bb('0x4'));var rp=require(_0x69bb('0x5'));var fs=require('fs');var path=require(_0x69bb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x69bb('0x7'));module[_0x69bb('0x8')]=function(_0x322591,_0x49db10){return _0x322591[_0x69bb('0x9')](_0x69bb('0xa'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcafa=['util','../../config/logger','bluebird','request-promise','path','rimraf','./intVtigerAccount.attributes','exports','define','VtigerAccount','int_vtiger_accounts','lodash'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0xcafa,0x8f));var _0xacaf=function(_0x2552b4,_0x48216a){_0x2552b4=_0x2552b4-0x0;var _0x3ef342=_0xcafa[_0x2552b4];return _0x3ef342;};'use strict';var _=require(_0xacaf('0x0'));var util=require(_0xacaf('0x1'));var logger=require(_0xacaf('0x2'))('api');var moment=require('moment');var BPromise=require(_0xacaf('0x3'));var rp=require(_0xacaf('0x4'));var fs=require('fs');var path=require(_0xacaf('0x5'));var rimraf=require(_0xacaf('0x6'));var config=require('../../config/environment');var attributes=require(_0xacaf('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xacaf('0x8')]=function(_0xf7f82a,_0x378205){return _0xf7f82a[_0xacaf('0x9')](_0xacaf('0xa'),attributes,{'tableName':_0xacaf('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 ea54073..3497770 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 _0x1c7c=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','limit','include','map','model','attributes','ShowVtigerAccount','raw','lodash','util','moment','bluebird'];(function(_0x1138fd,_0x50c7e4){var _0x4a4806=function(_0xc4d18e){while(--_0xc4d18e){_0x1138fd['push'](_0x1138fd['shift']());}};_0x4a4806(++_0x50c7e4);}(_0x1c7c,0x164));var _0xc1c7=function(_0x2cc21b,_0x193853){_0x2cc21b=_0x2cc21b-0x0;var _0x5be162=_0x1c7c[_0x2cc21b];return _0x5be162;};'use strict';var _=require(_0xc1c7('0x0'));var util=require(_0xc1c7('0x1'));var moment=require(_0xc1c7('0x2'));var BPromise=require(_0xc1c7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc1c7('0x5'));var logger=require(_0xc1c7('0x6'))(_0xc1c7('0x7'));var config=require(_0xc1c7('0x8'));var jayson=require(_0xc1c7('0x9'));var client=jayson[_0xc1c7('0xa')][_0xc1c7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x419138,_0xce5bcd,_0x3b3e9c){return new BPromise(function(_0x434a35,_0x11c7ef){return client[_0xc1c7('0xc')](_0x419138,_0x3b3e9c)[_0xc1c7('0xd')](function(_0x339649){logger[_0xc1c7('0xe')](_0xc1c7('0xf'),_0xce5bcd,'request\x20sent');logger[_0xc1c7('0x10')](_0xc1c7('0x11'),_0xce5bcd,'request\x20sent',JSON[_0xc1c7('0x12')](_0x339649));if(_0x339649[_0xc1c7('0x13')]){if(_0x339649[_0xc1c7('0x13')]['code']===0x1f4){logger[_0xc1c7('0x13')](_0xc1c7('0xf'),_0xce5bcd,_0x339649[_0xc1c7('0x13')][_0xc1c7('0x14')]);return _0x11c7ef(_0x339649[_0xc1c7('0x13')][_0xc1c7('0x14')]);}logger[_0xc1c7('0x13')](_0xc1c7('0xf'),_0xce5bcd,_0x339649[_0xc1c7('0x13')][_0xc1c7('0x14')]);return _0x434a35(_0x339649[_0xc1c7('0x13')][_0xc1c7('0x14')]);}else{logger['info'](_0xc1c7('0xf'),_0xce5bcd,_0xc1c7('0x15'));_0x434a35(_0x339649[_0xc1c7('0x16')]['message']);}})[_0xc1c7('0x17')](function(_0x3939c1){logger[_0xc1c7('0x13')](_0xc1c7('0xf'),_0xce5bcd,_0x3939c1);_0x11c7ef(_0x3939c1);});});}exports[_0xc1c7('0x18')]=function(_0xb42702){var _0x21758a=this;return new Promise(function(_0x2e93e5,_0x5d44e9){return db[_0xc1c7('0x19')][_0xc1c7('0x1a')]({'raw':_0xb42702[_0xc1c7('0x1b')]?_0xb42702[_0xc1c7('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xb42702[_0xc1c7('0x1b')]?_0xb42702['options'][_0xc1c7('0x1c')]||null:null,'attributes':_0xb42702[_0xc1c7('0x1b')]?_0xb42702['options']['attributes']||null:null,'limit':_0xb42702[_0xc1c7('0x1b')]?_0xb42702[_0xc1c7('0x1b')][_0xc1c7('0x1d')]||null:null,'include':_0xb42702['options']?_0xb42702[_0xc1c7('0x1b')][_0xc1c7('0x1e')]?_[_0xc1c7('0x1f')](_0xb42702[_0xc1c7('0x1b')][_0xc1c7('0x1e')],function(_0x3a2483){return{'model':db[_0x3a2483[_0xc1c7('0x20')]],'as':_0x3a2483['as'],'attributes':_0x3a2483[_0xc1c7('0x21')],'include':_0x3a2483[_0xc1c7('0x1e')]?_[_0xc1c7('0x1f')](_0x3a2483[_0xc1c7('0x1e')],function(_0x363fbc){return{'model':db[_0x363fbc[_0xc1c7('0x20')]],'as':_0x363fbc['as'],'attributes':_0x363fbc[_0xc1c7('0x21')],'include':_0x363fbc[_0xc1c7('0x1e')]?_[_0xc1c7('0x1f')](_0x363fbc['include'],function(_0xf0ab9c){return{'model':db[_0xf0ab9c[_0xc1c7('0x20')]],'as':_0xf0ab9c['as'],'attributes':_0xf0ab9c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x352f24){logger['info']('GetVtigerAccount',_0xb42702);logger[_0xc1c7('0x10')](_0xc1c7('0x18'),_0xb42702,JSON[_0xc1c7('0x12')](_0x352f24));_0x2e93e5(_0x352f24);})[_0xc1c7('0x17')](function(_0x461360){logger['error']('GetVtigerAccount',_0x461360[_0xc1c7('0x14')],_0xb42702);_0x5d44e9(_0x21758a[_0xc1c7('0x13')](0x1f4,_0x461360[_0xc1c7('0x14')]));});});};exports[_0xc1c7('0x22')]=function(_0x2e35f1){var _0x4968b0=this;return new Promise(function(_0x50042f,_0x125920){return db[_0xc1c7('0x19')]['find']({'raw':_0x2e35f1[_0xc1c7('0x1b')]?_0x2e35f1[_0xc1c7('0x1b')][_0xc1c7('0x23')]===undefined?!![]:![]:!![],'where':_0x2e35f1[_0xc1c7('0x1b')]?_0x2e35f1[_0xc1c7('0x1b')][_0xc1c7('0x1c')]||null:null,'attributes':_0x2e35f1[_0xc1c7('0x1b')]?_0x2e35f1['options'][_0xc1c7('0x21')]||null:null,'include':_0x2e35f1[_0xc1c7('0x1b')]?_0x2e35f1[_0xc1c7('0x1b')][_0xc1c7('0x1e')]?_[_0xc1c7('0x1f')](_0x2e35f1[_0xc1c7('0x1b')][_0xc1c7('0x1e')],function(_0xef703f){return{'model':db[_0xef703f[_0xc1c7('0x20')]],'as':_0xef703f['as'],'attributes':_0xef703f['attributes'],'include':_0xef703f['include']?_[_0xc1c7('0x1f')](_0xef703f[_0xc1c7('0x1e')],function(_0x263900){return{'model':db[_0x263900[_0xc1c7('0x20')]],'as':_0x263900['as'],'attributes':_0x263900[_0xc1c7('0x21')],'include':_0x263900[_0xc1c7('0x1e')]?_[_0xc1c7('0x1f')](_0x263900[_0xc1c7('0x1e')],function(_0x3bd3b0){return{'model':db[_0x3bd3b0[_0xc1c7('0x20')]],'as':_0x3bd3b0['as'],'attributes':_0x3bd3b0[_0xc1c7('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc1c7('0xd')](function(_0x154476){logger[_0xc1c7('0xe')](_0xc1c7('0x22'),_0x2e35f1);logger[_0xc1c7('0x10')](_0xc1c7('0x22'),_0x2e35f1,JSON[_0xc1c7('0x12')](_0x154476));_0x50042f(_0x154476);})[_0xc1c7('0x17')](function(_0x239a91){logger[_0xc1c7('0x13')]('ShowVtigerAccount',_0x239a91['message'],_0x2e35f1);_0x125920(_0x4968b0['error'](0x1f4,_0x239a91[_0xc1c7('0x14')]));});});}; \ No newline at end of file +var _0x44a3=['code','message','VtigerAccount,\x20%s,\x20%s','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowVtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error'];(function(_0x35cbff,_0x5e41b9){var _0xf110a8=function(_0x1c5aa6){while(--_0x1c5aa6){_0x35cbff['push'](_0x35cbff['shift']());}};_0xf110a8(++_0x5e41b9);}(_0x44a3,0x1a9));var _0x344a=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x44a3[_0x3ce2c4];return _0x4047c1;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var moment=require(_0x344a('0x2'));var BPromise=require(_0x344a('0x3'));var rs=require(_0x344a('0x4'));var fs=require('fs');var Redis=require(_0x344a('0x5'));var db=require(_0x344a('0x6'))['db'];var utils=require(_0x344a('0x7'));var logger=require('../../config/logger')(_0x344a('0x8'));var config=require(_0x344a('0x9'));var jayson=require(_0x344a('0xa'));var client=jayson[_0x344a('0xb')][_0x344a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x504bd1,_0x553d97,_0x55ddca){return new BPromise(function(_0x484661,_0x475dab){return client[_0x344a('0xd')](_0x504bd1,_0x55ddca)[_0x344a('0xe')](function(_0x233ca1){logger[_0x344a('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'));logger[_0x344a('0x11')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'),JSON['stringify'](_0x233ca1));if(_0x233ca1[_0x344a('0x12')]){if(_0x233ca1['error'][_0x344a('0x13')]===0x1f4){logger[_0x344a('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x553d97,_0x233ca1['error'][_0x344a('0x14')]);return _0x475dab(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}logger[_0x344a('0x12')](_0x344a('0x15'),_0x553d97,_0x233ca1[_0x344a('0x12')]['message']);return _0x484661(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}else{logger[_0x344a('0xf')](_0x344a('0x15'),_0x553d97,'request\x20sent');_0x484661(_0x233ca1['result'][_0x344a('0x14')]);}})[_0x344a('0x16')](function(_0x36227e){logger[_0x344a('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x553d97,_0x36227e);_0x475dab(_0x36227e);});});}exports[_0x344a('0x17')]=function(_0x277c06){var _0x49b55f=this;return new Promise(function(_0x9fe854,_0x274016){return db[_0x344a('0x18')][_0x344a('0x19')]({'raw':_0x277c06[_0x344a('0x1a')]?_0x277c06[_0x344a('0x1a')][_0x344a('0x1b')]===undefined?!![]:![]:!![],'where':_0x277c06[_0x344a('0x1a')]?_0x277c06[_0x344a('0x1a')][_0x344a('0x1c')]||null:null,'attributes':_0x277c06['options']?_0x277c06[_0x344a('0x1a')][_0x344a('0x1d')]||null:null,'limit':_0x277c06[_0x344a('0x1a')]?_0x277c06[_0x344a('0x1a')][_0x344a('0x1e')]||null:null,'include':_0x277c06[_0x344a('0x1a')]?_0x277c06[_0x344a('0x1a')][_0x344a('0x1f')]?_[_0x344a('0x20')](_0x277c06[_0x344a('0x1a')][_0x344a('0x1f')],function(_0x3b2ab9){return{'model':db[_0x3b2ab9[_0x344a('0x21')]],'as':_0x3b2ab9['as'],'attributes':_0x3b2ab9[_0x344a('0x1d')],'include':_0x3b2ab9['include']?_[_0x344a('0x20')](_0x3b2ab9['include'],function(_0x2a5e49){return{'model':db[_0x2a5e49['model']],'as':_0x2a5e49['as'],'attributes':_0x2a5e49[_0x344a('0x1d')],'include':_0x2a5e49[_0x344a('0x1f')]?_[_0x344a('0x20')](_0x2a5e49[_0x344a('0x1f')],function(_0x26f059){return{'model':db[_0x26f059[_0x344a('0x21')]],'as':_0x26f059['as'],'attributes':_0x26f059[_0x344a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x344a('0xe')](function(_0x4f2499){logger[_0x344a('0xf')](_0x344a('0x17'),_0x277c06);logger[_0x344a('0x11')](_0x344a('0x17'),_0x277c06,JSON[_0x344a('0x22')](_0x4f2499));_0x9fe854(_0x4f2499);})[_0x344a('0x16')](function(_0x5b877d){logger[_0x344a('0x12')]('GetVtigerAccount',_0x5b877d['message'],_0x277c06);_0x274016(_0x49b55f[_0x344a('0x12')](0x1f4,_0x5b877d[_0x344a('0x14')]));});});};exports[_0x344a('0x23')]=function(_0x4803db){var _0x5cd9c6=this;return new Promise(function(_0x5cafd2,_0x16f490){return db[_0x344a('0x18')][_0x344a('0x24')]({'raw':_0x4803db['options']?_0x4803db[_0x344a('0x1a')][_0x344a('0x1b')]===undefined?!![]:![]:!![],'where':_0x4803db[_0x344a('0x1a')]?_0x4803db[_0x344a('0x1a')][_0x344a('0x1c')]||null:null,'attributes':_0x4803db[_0x344a('0x1a')]?_0x4803db[_0x344a('0x1a')]['attributes']||null:null,'include':_0x4803db[_0x344a('0x1a')]?_0x4803db['options']['include']?_['map'](_0x4803db[_0x344a('0x1a')][_0x344a('0x1f')],function(_0x2b8e71){return{'model':db[_0x2b8e71[_0x344a('0x21')]],'as':_0x2b8e71['as'],'attributes':_0x2b8e71[_0x344a('0x1d')],'include':_0x2b8e71[_0x344a('0x1f')]?_['map'](_0x2b8e71[_0x344a('0x1f')],function(_0x1fbf64){return{'model':db[_0x1fbf64[_0x344a('0x21')]],'as':_0x1fbf64['as'],'attributes':_0x1fbf64['attributes'],'include':_0x1fbf64[_0x344a('0x1f')]?_[_0x344a('0x20')](_0x1fbf64[_0x344a('0x1f')],function(_0x487a9b){return{'model':db[_0x487a9b[_0x344a('0x21')]],'as':_0x487a9b['as'],'attributes':_0x487a9b['attributes']};}):[]};}):[]};}):[]:[]})[_0x344a('0xe')](function(_0xeabc7c){logger[_0x344a('0xf')](_0x344a('0x23'),_0x4803db);logger[_0x344a('0x11')]('ShowVtigerAccount',_0x4803db,JSON[_0x344a('0x22')](_0xeabc7c));_0x5cafd2(_0xeabc7c);})[_0x344a('0x16')](function(_0x11e81f){logger[_0x344a('0x12')](_0x344a('0x23'),_0x11e81f['message'],_0x4803db);_0x16f490(_0x5cd9c6[_0x344a('0x12')](0x1f4,_0x11e81f[_0x344a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index eca6737..bde1b1a 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 _0xde27=['isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get'];(function(_0x481e5a,_0x4cfe56){var _0x35674e=function(_0x554461){while(--_0x554461){_0x481e5a['push'](_0x481e5a['shift']());}};_0x35674e(++_0x4cfe56);}(_0xde27,0x1cb));var _0x7de2=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xde27[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x7de2('0x0'));var util=require(_0x7de2('0x1'));var path=require(_0x7de2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7de2('0x3')]();var fs_extra=require(_0x7de2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7de2('0x5'));var config=require(_0x7de2('0x6'));var controller=require(_0x7de2('0x7'));router[_0x7de2('0x8')]('/',auth[_0x7de2('0x9')](),controller[_0x7de2('0xa')]);router[_0x7de2('0x8')](_0x7de2('0xb'),auth['isAuthenticated'](),controller[_0x7de2('0xc')]);router[_0x7de2('0x8')](_0x7de2('0xd'),auth[_0x7de2('0x9')](),controller[_0x7de2('0xe')]);router[_0x7de2('0x8')](_0x7de2('0xf'),auth[_0x7de2('0x9')](),controller[_0x7de2('0x10')]);router['get'](_0x7de2('0x11'),auth['isAuthenticated'](),controller[_0x7de2('0x12')]);router[_0x7de2('0x13')]('/',auth[_0x7de2('0x9')](),controller[_0x7de2('0x14')]);router[_0x7de2('0x15')](_0x7de2('0xb'),auth['isAuthenticated'](),controller[_0x7de2('0x16')]);router[_0x7de2('0x17')]('/:id',auth[_0x7de2('0x9')](),controller[_0x7de2('0x18')]);module[_0x7de2('0x19')]=router; \ No newline at end of file +var _0x59bf=['./intVtigerConfiguration.controller','isAuthenticated','index','get','show','getFields','getSubjects','getDescriptions','post','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x32c076,_0x11d5bb){var _0xe0f942=function(_0x487edc){while(--_0x487edc){_0x32c076['push'](_0x32c076['shift']());}};_0xe0f942(++_0x11d5bb);}(_0x59bf,0xaf));var _0xf59b=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x59bf[_0x4d07cc];return _0x42de3b;};'use strict';var multer=require(_0xf59b('0x0'));var util=require(_0xf59b('0x1'));var path=require(_0xf59b('0x2'));var timeout=require(_0xf59b('0x3'));var express=require(_0xf59b('0x4'));var router=express[_0xf59b('0x5')]();var fs_extra=require(_0xf59b('0x6'));var auth=require(_0xf59b('0x7'));var interaction=require(_0xf59b('0x8'));var config=require('../../config/environment');var controller=require(_0xf59b('0x9'));router['get']('/',auth[_0xf59b('0xa')](),controller[_0xf59b('0xb')]);router[_0xf59b('0xc')]('/:id',auth[_0xf59b('0xa')](),controller[_0xf59b('0xd')]);router[_0xf59b('0xc')]('/:id/fields',auth['isAuthenticated'](),controller[_0xf59b('0xe')]);router[_0xf59b('0xc')]('/:id/subjects',auth[_0xf59b('0xa')](),controller[_0xf59b('0xf')]);router[_0xf59b('0xc')]('/:id/descriptions',auth[_0xf59b('0xa')](),controller[_0xf59b('0x10')]);router[_0xf59b('0x11')]('/',auth['isAuthenticated'](),controller[_0xf59b('0x12')]);router['put'](_0xf59b('0x13'),auth[_0xf59b('0xa')](),controller[_0xf59b('0x14')]);router[_0xf59b('0x15')](_0xf59b('0x13'),auth[_0xf59b('0xa')](),controller[_0xf59b('0x16')]);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 9fa4950..398670e 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 _0xc08d=['exports','STRING','sequelize'];(function(_0x302b2f,_0x325f07){var _0x3ec9a7=function(_0x5e68eb){while(--_0x5e68eb){_0x302b2f['push'](_0x302b2f['shift']());}};_0x3ec9a7(++_0x325f07);}(_0xc08d,0x92));var _0xdc08=function(_0x2ff238,_0x1811d2){_0x2ff238=_0x2ff238-0x0;var _0x204a56=_0xc08d[_0x2ff238];return _0x204a56;};'use strict';var Sequelize=require(_0xdc08('0x0'));module[_0xdc08('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdc08('0x2')]}}; \ No newline at end of file +var _0x2919=['STRING','sequelize'];(function(_0x14a6c4,_0x53c5ad){var _0x457a93=function(_0x59facf){while(--_0x59facf){_0x14a6c4['push'](_0x14a6c4['shift']());}};_0x457a93(++_0x53c5ad);}(_0x2919,0x1a7));var _0x9291=function(_0x13782e,_0x216b96){_0x13782e=_0x13782e-0x0;var _0x370a59=_0x2919[_0x13782e];return _0x370a59;};'use strict';var Sequelize=require(_0x9291('0x0'));module['exports']={'name':{'type':Sequelize[_0x9291('0x1')]},'description':{'type':Sequelize[_0x9291('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 3bbb2c9..8108ebd 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 _0xf9a2=['lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','VtigerConfiguration','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','findOne','VtigerField','order','getFields','getSubjects','getDescriptions','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra'];(function(_0x266387,_0x2f243c){var _0x28b64f=function(_0x1bc600){while(--_0x1bc600){_0x266387['push'](_0x266387['shift']());}};_0x28b64f(++_0x2f243c);}(_0xf9a2,0x124));var _0x2f9a=function(_0x513f2a,_0x32bc4b){_0x513f2a=_0x513f2a-0x0;var _0x24452a=_0xf9a2[_0x513f2a];return _0x24452a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2f9a('0x0'));var rp=require(_0x2f9a('0x1'));var moment=require(_0x2f9a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2f9a('0x3'));var util=require(_0x2f9a('0x4'));var path=require(_0x2f9a('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2f9a('0x6'));var fs=require('fs');var fs_extra=require(_0x2f9a('0x7'));var _=require(_0x2f9a('0x8'));var squel=require('squel');var crypto=require(_0x2f9a('0x9'));var jsforce=require(_0x2f9a('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2f9a('0xb'));var querystring=require('querystring');var Papa=require(_0x2f9a('0xc'));var Redis=require(_0x2f9a('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2f9a('0xe'));var hardwareService=require(_0x2f9a('0xf'));var logger=require(_0x2f9a('0x10'))(_0x2f9a('0x11'));var utils=require('../../config/utils');var config=require(_0x2f9a('0x12'));var licenseUtil=require(_0x2f9a('0x13'));var db=require(_0x2f9a('0x14'))['db'];function respondWithStatusCode(_0x2ac47c,_0x5526d2){_0x5526d2=_0x5526d2||0xcc;return function(_0x322df8){if(_0x322df8){return _0x2ac47c[_0x2f9a('0x15')](_0x5526d2);}return _0x2ac47c[_0x2f9a('0x16')](_0x5526d2)['end']();};}function respondWithResult(_0x3e0d63,_0x4d117a){_0x4d117a=_0x4d117a||0xc8;return function(_0x1769ed){if(_0x1769ed){return _0x3e0d63[_0x2f9a('0x16')](_0x4d117a)[_0x2f9a('0x17')](_0x1769ed);}};}function respondWithFilteredResult(_0x5b457d,_0x22f212){return function(_0x2606ad){if(_0x2606ad){var _0xf92a85=typeof _0x22f212[_0x2f9a('0x18')]===_0x2f9a('0x19')&&typeof _0x22f212[_0x2f9a('0x1a')]===_0x2f9a('0x19');var _0x131c01=_0x2606ad[_0x2f9a('0x1b')];var _0x425412=_0xf92a85?0x0:_0x22f212[_0x2f9a('0x18')];var _0x366574=_0xf92a85?_0x2606ad[_0x2f9a('0x1b')]:_0x22f212['offset']+_0x22f212['limit'];var _0x1e9f4e;if(_0x366574>=_0x131c01){_0x366574=_0x131c01;_0x1e9f4e=0xc8;}else{_0x1e9f4e=0xce;}_0x5b457d[_0x2f9a('0x16')](_0x1e9f4e);return _0x5b457d[_0x2f9a('0x1c')](_0x2f9a('0x1d'),_0x425412+'-'+_0x366574+'/'+_0x131c01)[_0x2f9a('0x17')](_0x2606ad);}return null;};}function patchUpdates(_0x50fd3d){return function(_0x53452b){try{jsonpatch[_0x2f9a('0x1e')](_0x53452b,_0x50fd3d,!![]);}catch(_0x1b6edc){return BPromise[_0x2f9a('0x1f')](_0x1b6edc);}return _0x53452b['save']();};}function saveUpdates(_0xdc5b30,_0x123979){return function(_0x41930a){if(_0x41930a){return _0x41930a[_0x2f9a('0x20')](_0xdc5b30)['then'](function(_0x4af384){return _0x4af384;});}return null;};}function removeEntity(_0x4c9190,_0x520079){return function(_0x3868e7){if(_0x3868e7){return _0x3868e7[_0x2f9a('0x21')]()[_0x2f9a('0x22')](function(){_0x4c9190[_0x2f9a('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1569c0,_0xaa1298){return function(_0x37183e){if(!_0x37183e){_0x1569c0[_0x2f9a('0x15')](0x194);}return _0x37183e;};}function handleError(_0xe0b001,_0x2e35f3){_0x2e35f3=_0x2e35f3||0x1f4;return function(_0x4d3bbc){logger[_0x2f9a('0x23')](_0x4d3bbc[_0x2f9a('0x24')]);if(_0x4d3bbc[_0x2f9a('0x25')]){delete _0x4d3bbc[_0x2f9a('0x25')];}_0xe0b001[_0x2f9a('0x16')](_0x2e35f3)[_0x2f9a('0x26')](_0x4d3bbc);};}exports[_0x2f9a('0x27')]=function(_0x5ef9d7,_0x3c5e0f){var _0x1dad25={},_0x5c2736={},_0x1cb1e1={'count':0x0,'rows':[]};var _0x17df36=_[_0x2f9a('0x28')](db[_0x2f9a('0x29')]['rawAttributes'],function(_0x145076){return{'name':_0x145076['fieldName'],'type':_0x145076['type'][_0x2f9a('0x2a')]};});_0x5c2736[_0x2f9a('0x2b')]=_['map'](_0x17df36,'name');_0x5c2736[_0x2f9a('0x2c')]=_[_0x2f9a('0x2d')](_0x5ef9d7[_0x2f9a('0x2c')]);_0x5c2736[_0x2f9a('0x2e')]=_[_0x2f9a('0x2f')](_0x5c2736[_0x2f9a('0x2b')],_0x5c2736['query']);_0x1dad25[_0x2f9a('0x30')]=_[_0x2f9a('0x2f')](_0x5c2736[_0x2f9a('0x2b')],qs[_0x2f9a('0x31')](_0x5ef9d7['query'][_0x2f9a('0x31')]));_0x1dad25[_0x2f9a('0x30')]=_0x1dad25[_0x2f9a('0x30')][_0x2f9a('0x32')]?_0x1dad25[_0x2f9a('0x30')]:_0x5c2736[_0x2f9a('0x2b')];if(!_0x5ef9d7['query'][_0x2f9a('0x33')](_0x2f9a('0x34'))){_0x1dad25['limit']=qs[_0x2f9a('0x1a')](_0x5ef9d7[_0x2f9a('0x2c')][_0x2f9a('0x1a')]);_0x1dad25['offset']=qs[_0x2f9a('0x18')](_0x5ef9d7[_0x2f9a('0x2c')][_0x2f9a('0x18')]);}_0x1dad25['order']=qs[_0x2f9a('0x35')](_0x5ef9d7[_0x2f9a('0x2c')]['sort']);_0x1dad25[_0x2f9a('0x36')]=qs[_0x2f9a('0x2e')](_[_0x2f9a('0x37')](_0x5ef9d7[_0x2f9a('0x2c')],_0x5c2736['filters']),_0x17df36);if(_0x5ef9d7['query']['filter']){_0x1dad25[_0x2f9a('0x36')]=_[_0x2f9a('0x38')](_0x1dad25[_0x2f9a('0x36')],{'$or':_[_0x2f9a('0x28')](_0x17df36,function(_0x376609){if(_0x376609['type']!==_0x2f9a('0x39')){var _0x38b30e={};_0x38b30e[_0x376609[_0x2f9a('0x25')]]={'$like':'%'+_0x5ef9d7[_0x2f9a('0x2c')][_0x2f9a('0x3a')]+'%'};return _0x38b30e;}})});}_0x1dad25=_[_0x2f9a('0x38')]({},_0x1dad25,_0x5ef9d7[_0x2f9a('0x3b')]);var _0x3fd37b={'where':_0x1dad25[_0x2f9a('0x36')]};return db[_0x2f9a('0x29')][_0x2f9a('0x1b')](_0x3fd37b)[_0x2f9a('0x22')](function(_0x2bfb1b){_0x1cb1e1[_0x2f9a('0x1b')]=_0x2bfb1b;if(_0x5ef9d7[_0x2f9a('0x2c')][_0x2f9a('0x3c')]){_0x1dad25[_0x2f9a('0x3d')]=[{'all':!![]}];}return db[_0x2f9a('0x29')][_0x2f9a('0x3e')](_0x1dad25);})[_0x2f9a('0x22')](function(_0x5b1677){_0x1cb1e1['rows']=_0x5b1677;return _0x1cb1e1;})[_0x2f9a('0x22')](respondWithFilteredResult(_0x3c5e0f,_0x1dad25))[_0x2f9a('0x3f')](handleError(_0x3c5e0f,null));};exports['show']=function(_0x314291,_0x218968){var _0x43074c={'raw':![],'where':{'id':_0x314291[_0x2f9a('0x40')]['id']}},_0x26c16e={};_0x26c16e[_0x2f9a('0x2b')]=_[_0x2f9a('0x2d')](db[_0x2f9a('0x29')][_0x2f9a('0x41')]);_0x26c16e[_0x2f9a('0x2c')]=_[_0x2f9a('0x2d')](_0x314291['query']);_0x26c16e[_0x2f9a('0x2e')]=_[_0x2f9a('0x2f')](_0x26c16e[_0x2f9a('0x2b')],_0x26c16e['query']);_0x43074c[_0x2f9a('0x30')]=_[_0x2f9a('0x2f')](_0x26c16e[_0x2f9a('0x2b')],qs['fields'](_0x314291[_0x2f9a('0x2c')]['fields']));_0x43074c[_0x2f9a('0x30')]=_0x43074c['attributes'][_0x2f9a('0x32')]?_0x43074c[_0x2f9a('0x30')]:_0x26c16e[_0x2f9a('0x2b')];if(_0x314291[_0x2f9a('0x2c')][_0x2f9a('0x3c')]){_0x43074c[_0x2f9a('0x3d')]=[{'all':!![]}];}_0x43074c=_[_0x2f9a('0x38')]({},_0x43074c,_0x314291[_0x2f9a('0x3b')]);return db[_0x2f9a('0x29')][_0x2f9a('0x42')](_0x43074c)[_0x2f9a('0x22')](handleEntityNotFound(_0x218968,null))[_0x2f9a('0x22')](respondWithResult(_0x218968,null))[_0x2f9a('0x3f')](handleError(_0x218968,null));};exports[_0x2f9a('0x43')]=function(_0xaed53,_0x41b627){return db[_0x2f9a('0x29')][_0x2f9a('0x43')](_0xaed53[_0x2f9a('0x44')],{})[_0x2f9a('0x22')](respondWithResult(_0x41b627,0xc9))['catch'](handleError(_0x41b627,null));};exports[_0x2f9a('0x20')]=function(_0x574275,_0x12a414){if(_0x574275[_0x2f9a('0x44')]['id']){delete _0x574275[_0x2f9a('0x44')]['id'];}return db[_0x2f9a('0x29')][_0x2f9a('0x42')]({'where':{'id':_0x574275['params']['id']}})[_0x2f9a('0x22')](handleEntityNotFound(_0x12a414,null))[_0x2f9a('0x22')](saveUpdates(_0x574275[_0x2f9a('0x44')],null))[_0x2f9a('0x22')](respondWithResult(_0x12a414,null))[_0x2f9a('0x3f')](handleError(_0x12a414,null));};exports[_0x2f9a('0x21')]=function(_0x56855a,_0x21ca5d){return db[_0x2f9a('0x29')][_0x2f9a('0x42')]({'where':{'id':_0x56855a[_0x2f9a('0x40')]['id']}})[_0x2f9a('0x22')](handleEntityNotFound(_0x21ca5d,null))[_0x2f9a('0x22')](removeEntity(_0x21ca5d,null))[_0x2f9a('0x3f')](handleError(_0x21ca5d,null));};exports['getFields']=function(_0x5b7da4,_0x48ac87,_0x263688){var _0x2f8a24={};var _0x26fa78={};var _0x458072;var _0x380347;return db[_0x2f9a('0x29')][_0x2f9a('0x45')]({'where':{'id':_0x5b7da4[_0x2f9a('0x40')]['id']}})[_0x2f9a('0x22')](handleEntityNotFound(_0x48ac87,null))[_0x2f9a('0x22')](function(_0x343be9){if(_0x343be9){_0x458072=_0x343be9;_0x26fa78[_0x2f9a('0x2b')]=_[_0x2f9a('0x2d')](db[_0x2f9a('0x46')][_0x2f9a('0x41')]);_0x26fa78['query']=_[_0x2f9a('0x2d')](_0x5b7da4[_0x2f9a('0x2c')]);_0x26fa78[_0x2f9a('0x2e')]=_['intersection'](_0x26fa78[_0x2f9a('0x2b')],_0x26fa78[_0x2f9a('0x2c')]);_0x2f8a24[_0x2f9a('0x30')]=_[_0x2f9a('0x2f')](_0x26fa78[_0x2f9a('0x2b')],qs['fields'](_0x5b7da4[_0x2f9a('0x2c')][_0x2f9a('0x31')]));_0x2f8a24['attributes']=_0x2f8a24['attributes'][_0x2f9a('0x32')]?_0x2f8a24[_0x2f9a('0x30')]:_0x26fa78['model'];_0x2f8a24[_0x2f9a('0x47')]=qs[_0x2f9a('0x35')](_0x5b7da4[_0x2f9a('0x2c')][_0x2f9a('0x35')]);_0x2f8a24[_0x2f9a('0x36')]=qs[_0x2f9a('0x2e')](_[_0x2f9a('0x37')](_0x5b7da4['query'],_0x26fa78[_0x2f9a('0x2e')]));if(_0x5b7da4[_0x2f9a('0x2c')]['filter']){_0x2f8a24[_0x2f9a('0x36')]=_['merge'](_0x2f8a24[_0x2f9a('0x36')],{'$or':_[_0x2f9a('0x28')](_0x2f8a24[_0x2f9a('0x30')],function(_0x5ce827){var _0x771ad8={};_0x771ad8[_0x5ce827]={'$like':'%'+_0x5b7da4['query']['filter']+'%'};return _0x771ad8;})});}_0x2f8a24=_[_0x2f9a('0x38')]({},_0x2f8a24,_0x5b7da4[_0x2f9a('0x3b')]);return _0x458072[_0x2f9a('0x48')](_0x2f8a24);}})[_0x2f9a('0x22')](function(_0x1e3396){if(_0x1e3396){_0x380347=_0x1e3396['length'];if(!_0x5b7da4[_0x2f9a('0x2c')][_0x2f9a('0x33')](_0x2f9a('0x34'))){_0x2f8a24['limit']=qs['limit'](_0x5b7da4[_0x2f9a('0x2c')][_0x2f9a('0x1a')]);_0x2f8a24[_0x2f9a('0x18')]=qs[_0x2f9a('0x18')](_0x5b7da4[_0x2f9a('0x2c')][_0x2f9a('0x18')]);}return _0x458072[_0x2f9a('0x48')](_0x2f8a24);}})[_0x2f9a('0x22')](function(_0x3aa071){if(_0x3aa071){return _0x3aa071?{'count':_0x380347,'rows':_0x3aa071}:null;}})[_0x2f9a('0x22')](respondWithResult(_0x48ac87,null))[_0x2f9a('0x3f')](handleError(_0x48ac87,null));};exports[_0x2f9a('0x49')]=function(_0x2f4252,_0xa22766,_0x2b86b1){var _0x27363b={};var _0x54cf3={};var _0x44c24b;var _0x4f49bd;return db['VtigerConfiguration'][_0x2f9a('0x45')]({'where':{'id':_0x2f4252[_0x2f9a('0x40')]['id']}})[_0x2f9a('0x22')](handleEntityNotFound(_0xa22766,null))[_0x2f9a('0x22')](function(_0x5eeb2a){if(_0x5eeb2a){_0x44c24b=_0x5eeb2a;_0x54cf3[_0x2f9a('0x2b')]=_['keys'](db[_0x2f9a('0x46')]['rawAttributes']);_0x54cf3[_0x2f9a('0x2c')]=_[_0x2f9a('0x2d')](_0x2f4252[_0x2f9a('0x2c')]);_0x54cf3[_0x2f9a('0x2e')]=_[_0x2f9a('0x2f')](_0x54cf3[_0x2f9a('0x2b')],_0x54cf3['query']);_0x27363b['attributes']=_[_0x2f9a('0x2f')](_0x54cf3['model'],qs[_0x2f9a('0x31')](_0x2f4252[_0x2f9a('0x2c')][_0x2f9a('0x31')]));_0x27363b['attributes']=_0x27363b[_0x2f9a('0x30')][_0x2f9a('0x32')]?_0x27363b[_0x2f9a('0x30')]:_0x54cf3[_0x2f9a('0x2b')];_0x27363b[_0x2f9a('0x47')]=qs[_0x2f9a('0x35')](_0x2f4252[_0x2f9a('0x2c')][_0x2f9a('0x35')]);_0x27363b[_0x2f9a('0x36')]=qs['filters'](_[_0x2f9a('0x37')](_0x2f4252[_0x2f9a('0x2c')],_0x54cf3[_0x2f9a('0x2e')]));if(_0x2f4252[_0x2f9a('0x2c')][_0x2f9a('0x3a')]){_0x27363b[_0x2f9a('0x36')]=_[_0x2f9a('0x38')](_0x27363b[_0x2f9a('0x36')],{'$or':_[_0x2f9a('0x28')](_0x27363b['attributes'],function(_0x27873c){var _0x51ff56={};_0x51ff56[_0x27873c]={'$like':'%'+_0x2f4252[_0x2f9a('0x2c')][_0x2f9a('0x3a')]+'%'};return _0x51ff56;})});}_0x27363b=_[_0x2f9a('0x38')]({},_0x27363b,_0x2f4252[_0x2f9a('0x3b')]);return _0x44c24b[_0x2f9a('0x49')](_0x27363b);}})[_0x2f9a('0x22')](function(_0x52a4c7){if(_0x52a4c7){_0x4f49bd=_0x52a4c7['length'];if(!_0x2f4252[_0x2f9a('0x2c')][_0x2f9a('0x33')]('nolimit')){_0x27363b[_0x2f9a('0x1a')]=qs[_0x2f9a('0x1a')](_0x2f4252[_0x2f9a('0x2c')][_0x2f9a('0x1a')]);_0x27363b['offset']=qs['offset'](_0x2f4252[_0x2f9a('0x2c')]['offset']);}return _0x44c24b['getSubjects'](_0x27363b);}})[_0x2f9a('0x22')](function(_0xb9c227){if(_0xb9c227){return _0xb9c227?{'count':_0x4f49bd,'rows':_0xb9c227}:null;}})[_0x2f9a('0x22')](respondWithResult(_0xa22766,null))[_0x2f9a('0x3f')](handleError(_0xa22766,null));};exports[_0x2f9a('0x4a')]=function(_0x55fffa,_0x8c79,_0x21841b){var _0x297a7d={};var _0x1987a0={};var _0x4442b2;var _0x22bbdb;return db[_0x2f9a('0x29')]['findOne']({'where':{'id':_0x55fffa['params']['id']}})[_0x2f9a('0x22')](handleEntityNotFound(_0x8c79,null))[_0x2f9a('0x22')](function(_0x297744){if(_0x297744){_0x4442b2=_0x297744;_0x1987a0[_0x2f9a('0x2b')]=_[_0x2f9a('0x2d')](db[_0x2f9a('0x46')][_0x2f9a('0x41')]);_0x1987a0[_0x2f9a('0x2c')]=_[_0x2f9a('0x2d')](_0x55fffa['query']);_0x1987a0['filters']=_[_0x2f9a('0x2f')](_0x1987a0[_0x2f9a('0x2b')],_0x1987a0[_0x2f9a('0x2c')]);_0x297a7d[_0x2f9a('0x30')]=_[_0x2f9a('0x2f')](_0x1987a0['model'],qs[_0x2f9a('0x31')](_0x55fffa[_0x2f9a('0x2c')]['fields']));_0x297a7d[_0x2f9a('0x30')]=_0x297a7d[_0x2f9a('0x30')]['length']?_0x297a7d['attributes']:_0x1987a0[_0x2f9a('0x2b')];_0x297a7d[_0x2f9a('0x47')]=qs[_0x2f9a('0x35')](_0x55fffa[_0x2f9a('0x2c')][_0x2f9a('0x35')]);_0x297a7d[_0x2f9a('0x36')]=qs[_0x2f9a('0x2e')](_['pick'](_0x55fffa[_0x2f9a('0x2c')],_0x1987a0[_0x2f9a('0x2e')]));if(_0x55fffa[_0x2f9a('0x2c')]['filter']){_0x297a7d[_0x2f9a('0x36')]=_[_0x2f9a('0x38')](_0x297a7d[_0x2f9a('0x36')],{'$or':_[_0x2f9a('0x28')](_0x297a7d[_0x2f9a('0x30')],function(_0x2b0542){var _0x1fcbe6={};_0x1fcbe6[_0x2b0542]={'$like':'%'+_0x55fffa[_0x2f9a('0x2c')][_0x2f9a('0x3a')]+'%'};return _0x1fcbe6;})});}_0x297a7d=_['merge']({},_0x297a7d,_0x55fffa[_0x2f9a('0x3b')]);return _0x4442b2[_0x2f9a('0x4a')](_0x297a7d);}})['then'](function(_0x44d579){if(_0x44d579){_0x22bbdb=_0x44d579['length'];if(!_0x55fffa['query'][_0x2f9a('0x33')](_0x2f9a('0x34'))){_0x297a7d['limit']=qs[_0x2f9a('0x1a')](_0x55fffa[_0x2f9a('0x2c')]['limit']);_0x297a7d[_0x2f9a('0x18')]=qs[_0x2f9a('0x18')](_0x55fffa[_0x2f9a('0x2c')][_0x2f9a('0x18')]);}return _0x4442b2[_0x2f9a('0x4a')](_0x297a7d);}})[_0x2f9a('0x22')](function(_0xfe0ec8){if(_0xfe0ec8){return _0xfe0ec8?{'count':_0x22bbdb,'rows':_0xfe0ec8}:null;}})[_0x2f9a('0x22')](respondWithResult(_0x8c79,null))[_0x2f9a('0x3f')](handleError(_0x8c79,null));}; \ No newline at end of file +var _0xc1c3=['intersection','model','attributes','fields','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','VtigerConfiguration','findAll','catch','show','params','length','find','create','body','getFields','findOne','VtigerField','map','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','query','keys'];(function(_0x48690b,_0x56f270){var _0x11b1f4=function(_0x211cf2){while(--_0x211cf2){_0x48690b['push'](_0x48690b['shift']());}};_0x11b1f4(++_0x56f270);}(_0xc1c3,0x1b5));var _0x3c1c=function(_0x4482af,_0x2df282){_0x4482af=_0x4482af-0x0;var _0x1874e5=_0xc1c3[_0x4482af];return _0x1874e5;};'use strict';var emlformat=require(_0x3c1c('0x0'));var rimraf=require(_0x3c1c('0x1'));var zipdir=require(_0x3c1c('0x2'));var jsonpatch=require(_0x3c1c('0x3'));var rp=require(_0x3c1c('0x4'));var moment=require(_0x3c1c('0x5'));var BPromise=require(_0x3c1c('0x6'));var Mustache=require(_0x3c1c('0x7'));var util=require(_0x3c1c('0x8'));var path=require('path');var sox=require(_0x3c1c('0x9'));var csv=require('to-csv');var ejs=require(_0x3c1c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3c1c('0xb'));var crypto=require('crypto');var jsforce=require(_0x3c1c('0xc'));var deskjs=require(_0x3c1c('0xd'));var toCsv=require(_0x3c1c('0xe'));var querystring=require(_0x3c1c('0xf'));var Papa=require(_0x3c1c('0x10'));var Redis=require(_0x3c1c('0x11'));var authService=require(_0x3c1c('0x12'));var qs=require(_0x3c1c('0x13'));var as=require(_0x3c1c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3c1c('0x15'));var utils=require(_0x3c1c('0x16'));var config=require(_0x3c1c('0x17'));var licenseUtil=require(_0x3c1c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a3983,_0x477611){_0x477611=_0x477611||0xcc;return function(_0x4fec7a){if(_0x4fec7a){return _0x5a3983[_0x3c1c('0x19')](_0x477611);}return _0x5a3983[_0x3c1c('0x1a')](_0x477611)[_0x3c1c('0x1b')]();};}function respondWithResult(_0x5ae51c,_0x4fc14c){_0x4fc14c=_0x4fc14c||0xc8;return function(_0x1ee596){if(_0x1ee596){return _0x5ae51c['status'](_0x4fc14c)[_0x3c1c('0x1c')](_0x1ee596);}};}function respondWithFilteredResult(_0x1febc0,_0x391f22){return function(_0x2f9b32){if(_0x2f9b32){var _0x9c2908=typeof _0x391f22[_0x3c1c('0x1d')]==='undefined'&&typeof _0x391f22[_0x3c1c('0x1e')]===_0x3c1c('0x1f');var _0x82cb3d=_0x2f9b32[_0x3c1c('0x20')];var _0x377b8e=_0x9c2908?0x0:_0x391f22[_0x3c1c('0x1d')];var _0x17ee10=_0x9c2908?_0x2f9b32[_0x3c1c('0x20')]:_0x391f22[_0x3c1c('0x1d')]+_0x391f22['limit'];var _0x259fb7;if(_0x17ee10>=_0x82cb3d){_0x17ee10=_0x82cb3d;_0x259fb7=0xc8;}else{_0x259fb7=0xce;}_0x1febc0[_0x3c1c('0x1a')](_0x259fb7);return _0x1febc0[_0x3c1c('0x21')]('Content-Range',_0x377b8e+'-'+_0x17ee10+'/'+_0x82cb3d)['json'](_0x2f9b32);}return null;};}function patchUpdates(_0x400213){return function(_0x230b99){try{jsonpatch[_0x3c1c('0x22')](_0x230b99,_0x400213,!![]);}catch(_0x451de6){return BPromise[_0x3c1c('0x23')](_0x451de6);}return _0x230b99[_0x3c1c('0x24')]();};}function saveUpdates(_0x3b34ad,_0x1c6ae1){return function(_0x5a5f9d){if(_0x5a5f9d){return _0x5a5f9d[_0x3c1c('0x25')](_0x3b34ad)[_0x3c1c('0x26')](function(_0x510709){return _0x510709;});}return null;};}function removeEntity(_0x264e76,_0x445d13){return function(_0x3cf412){if(_0x3cf412){return _0x3cf412[_0x3c1c('0x27')]()[_0x3c1c('0x26')](function(){_0x264e76['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa44961,_0x53b7ff){return function(_0x206796){if(!_0x206796){_0xa44961[_0x3c1c('0x19')](0x194);}return _0x206796;};}function handleError(_0x3e9e4a,_0x2c6cd6){_0x2c6cd6=_0x2c6cd6||0x1f4;return function(_0x3c8e94){logger[_0x3c1c('0x28')](_0x3c8e94[_0x3c1c('0x29')]);if(_0x3c8e94[_0x3c1c('0x2a')]){delete _0x3c8e94['name'];}_0x3e9e4a['status'](_0x2c6cd6)[_0x3c1c('0x2b')](_0x3c8e94);};}exports['index']=function(_0x10c2dc,_0x28a137){var _0x57b61f={},_0x2d7e05={},_0x146404={'count':0x0,'rows':[]};var _0x22eb2c=_['map'](db['VtigerConfiguration'][_0x3c1c('0x2c')],function(_0x516768){return{'name':_0x516768[_0x3c1c('0x2d')],'type':_0x516768[_0x3c1c('0x2e')]['key']};});_0x2d7e05['model']=_['map'](_0x22eb2c,_0x3c1c('0x2a'));_0x2d7e05[_0x3c1c('0x2f')]=_[_0x3c1c('0x30')](_0x10c2dc[_0x3c1c('0x2f')]);_0x2d7e05['filters']=_[_0x3c1c('0x31')](_0x2d7e05[_0x3c1c('0x32')],_0x2d7e05[_0x3c1c('0x2f')]);_0x57b61f[_0x3c1c('0x33')]=_[_0x3c1c('0x31')](_0x2d7e05['model'],qs[_0x3c1c('0x34')](_0x10c2dc[_0x3c1c('0x2f')][_0x3c1c('0x34')]));_0x57b61f['attributes']=_0x57b61f['attributes']['length']?_0x57b61f[_0x3c1c('0x33')]:_0x2d7e05['model'];if(!_0x10c2dc[_0x3c1c('0x2f')]['hasOwnProperty'](_0x3c1c('0x35'))){_0x57b61f[_0x3c1c('0x1e')]=qs[_0x3c1c('0x1e')](_0x10c2dc[_0x3c1c('0x2f')][_0x3c1c('0x1e')]);_0x57b61f[_0x3c1c('0x1d')]=qs[_0x3c1c('0x1d')](_0x10c2dc[_0x3c1c('0x2f')][_0x3c1c('0x1d')]);}_0x57b61f[_0x3c1c('0x36')]=qs['sort'](_0x10c2dc[_0x3c1c('0x2f')][_0x3c1c('0x37')]);_0x57b61f[_0x3c1c('0x38')]=qs[_0x3c1c('0x39')](_[_0x3c1c('0x3a')](_0x10c2dc['query'],_0x2d7e05[_0x3c1c('0x39')]),_0x22eb2c);if(_0x10c2dc[_0x3c1c('0x2f')]['filter']){_0x57b61f[_0x3c1c('0x38')]=_[_0x3c1c('0x3b')](_0x57b61f[_0x3c1c('0x38')],{'$or':_['map'](_0x22eb2c,function(_0x3f52ed){if(_0x3f52ed[_0x3c1c('0x2e')]!==_0x3c1c('0x3c')){var _0x4a1cc6={};_0x4a1cc6[_0x3f52ed[_0x3c1c('0x2a')]]={'$like':'%'+_0x10c2dc[_0x3c1c('0x2f')][_0x3c1c('0x3d')]+'%'};return _0x4a1cc6;}})});}_0x57b61f=_[_0x3c1c('0x3b')]({},_0x57b61f,_0x10c2dc[_0x3c1c('0x3e')]);var _0x345e13={'where':_0x57b61f['where']};return db['VtigerConfiguration'][_0x3c1c('0x20')](_0x345e13)[_0x3c1c('0x26')](function(_0x21f63f){_0x146404[_0x3c1c('0x20')]=_0x21f63f;if(_0x10c2dc[_0x3c1c('0x2f')][_0x3c1c('0x3f')]){_0x57b61f[_0x3c1c('0x40')]=[{'all':!![]}];}return db[_0x3c1c('0x41')][_0x3c1c('0x42')](_0x57b61f);})['then'](function(_0x509bd9){_0x146404['rows']=_0x509bd9;return _0x146404;})[_0x3c1c('0x26')](respondWithFilteredResult(_0x28a137,_0x57b61f))[_0x3c1c('0x43')](handleError(_0x28a137,null));};exports[_0x3c1c('0x44')]=function(_0x2599ea,_0x20e9da){var _0xd08c79={'raw':![],'where':{'id':_0x2599ea[_0x3c1c('0x45')]['id']}},_0x57e16e={};_0x57e16e['model']=_[_0x3c1c('0x30')](db[_0x3c1c('0x41')]['rawAttributes']);_0x57e16e[_0x3c1c('0x2f')]=_[_0x3c1c('0x30')](_0x2599ea[_0x3c1c('0x2f')]);_0x57e16e[_0x3c1c('0x39')]=_['intersection'](_0x57e16e[_0x3c1c('0x32')],_0x57e16e[_0x3c1c('0x2f')]);_0xd08c79['attributes']=_[_0x3c1c('0x31')](_0x57e16e['model'],qs[_0x3c1c('0x34')](_0x2599ea[_0x3c1c('0x2f')][_0x3c1c('0x34')]));_0xd08c79[_0x3c1c('0x33')]=_0xd08c79[_0x3c1c('0x33')][_0x3c1c('0x46')]?_0xd08c79[_0x3c1c('0x33')]:_0x57e16e[_0x3c1c('0x32')];if(_0x2599ea[_0x3c1c('0x2f')][_0x3c1c('0x3f')]){_0xd08c79[_0x3c1c('0x40')]=[{'all':!![]}];}_0xd08c79=_[_0x3c1c('0x3b')]({},_0xd08c79,_0x2599ea['options']);return db[_0x3c1c('0x41')][_0x3c1c('0x47')](_0xd08c79)[_0x3c1c('0x26')](handleEntityNotFound(_0x20e9da,null))['then'](respondWithResult(_0x20e9da,null))[_0x3c1c('0x43')](handleError(_0x20e9da,null));};exports[_0x3c1c('0x48')]=function(_0x4929c2,_0x357b0f){return db[_0x3c1c('0x41')][_0x3c1c('0x48')](_0x4929c2[_0x3c1c('0x49')],{})['then'](respondWithResult(_0x357b0f,0xc9))[_0x3c1c('0x43')](handleError(_0x357b0f,null));};exports[_0x3c1c('0x25')]=function(_0x5d7df1,_0x503290){if(_0x5d7df1[_0x3c1c('0x49')]['id']){delete _0x5d7df1[_0x3c1c('0x49')]['id'];}return db[_0x3c1c('0x41')][_0x3c1c('0x47')]({'where':{'id':_0x5d7df1[_0x3c1c('0x45')]['id']}})[_0x3c1c('0x26')](handleEntityNotFound(_0x503290,null))[_0x3c1c('0x26')](saveUpdates(_0x5d7df1['body'],null))[_0x3c1c('0x26')](respondWithResult(_0x503290,null))['catch'](handleError(_0x503290,null));};exports[_0x3c1c('0x27')]=function(_0x21db24,_0x2a9059){return db[_0x3c1c('0x41')]['find']({'where':{'id':_0x21db24[_0x3c1c('0x45')]['id']}})[_0x3c1c('0x26')](handleEntityNotFound(_0x2a9059,null))['then'](removeEntity(_0x2a9059,null))[_0x3c1c('0x43')](handleError(_0x2a9059,null));};exports[_0x3c1c('0x4a')]=function(_0x5d15e5,_0x3be1cf,_0x20d67d){var _0x524404={};var _0x22957f={};var _0x9e739c;var _0x10b631;return db[_0x3c1c('0x41')][_0x3c1c('0x4b')]({'where':{'id':_0x5d15e5[_0x3c1c('0x45')]['id']}})['then'](handleEntityNotFound(_0x3be1cf,null))['then'](function(_0x9cc49e){if(_0x9cc49e){_0x9e739c=_0x9cc49e;_0x22957f[_0x3c1c('0x32')]=_[_0x3c1c('0x30')](db[_0x3c1c('0x4c')][_0x3c1c('0x2c')]);_0x22957f[_0x3c1c('0x2f')]=_['keys'](_0x5d15e5['query']);_0x22957f[_0x3c1c('0x39')]=_[_0x3c1c('0x31')](_0x22957f[_0x3c1c('0x32')],_0x22957f[_0x3c1c('0x2f')]);_0x524404[_0x3c1c('0x33')]=_['intersection'](_0x22957f[_0x3c1c('0x32')],qs[_0x3c1c('0x34')](_0x5d15e5[_0x3c1c('0x2f')][_0x3c1c('0x34')]));_0x524404[_0x3c1c('0x33')]=_0x524404['attributes'][_0x3c1c('0x46')]?_0x524404[_0x3c1c('0x33')]:_0x22957f[_0x3c1c('0x32')];_0x524404[_0x3c1c('0x36')]=qs['sort'](_0x5d15e5[_0x3c1c('0x2f')]['sort']);_0x524404['where']=qs['filters'](_[_0x3c1c('0x3a')](_0x5d15e5['query'],_0x22957f[_0x3c1c('0x39')]));if(_0x5d15e5[_0x3c1c('0x2f')][_0x3c1c('0x3d')]){_0x524404['where']=_[_0x3c1c('0x3b')](_0x524404[_0x3c1c('0x38')],{'$or':_[_0x3c1c('0x4d')](_0x524404[_0x3c1c('0x33')],function(_0x5bdf34){var _0x333635={};_0x333635[_0x5bdf34]={'$like':'%'+_0x5d15e5[_0x3c1c('0x2f')][_0x3c1c('0x3d')]+'%'};return _0x333635;})});}_0x524404=_[_0x3c1c('0x3b')]({},_0x524404,_0x5d15e5['options']);return _0x9e739c[_0x3c1c('0x4a')](_0x524404);}})[_0x3c1c('0x26')](function(_0x26beca){if(_0x26beca){_0x10b631=_0x26beca[_0x3c1c('0x46')];if(!_0x5d15e5[_0x3c1c('0x2f')][_0x3c1c('0x4e')](_0x3c1c('0x35'))){_0x524404['limit']=qs['limit'](_0x5d15e5[_0x3c1c('0x2f')][_0x3c1c('0x1e')]);_0x524404['offset']=qs[_0x3c1c('0x1d')](_0x5d15e5[_0x3c1c('0x2f')]['offset']);}return _0x9e739c[_0x3c1c('0x4a')](_0x524404);}})[_0x3c1c('0x26')](function(_0x2c852d){if(_0x2c852d){return _0x2c852d?{'count':_0x10b631,'rows':_0x2c852d}:null;}})['then'](respondWithResult(_0x3be1cf,null))[_0x3c1c('0x43')](handleError(_0x3be1cf,null));};exports[_0x3c1c('0x4f')]=function(_0x505ec2,_0x26e70e,_0x14eb2a){var _0x324ed4={};var _0x35db58={};var _0x38ec0b;var _0x258214;return db[_0x3c1c('0x41')][_0x3c1c('0x4b')]({'where':{'id':_0x505ec2[_0x3c1c('0x45')]['id']}})[_0x3c1c('0x26')](handleEntityNotFound(_0x26e70e,null))[_0x3c1c('0x26')](function(_0x161951){if(_0x161951){_0x38ec0b=_0x161951;_0x35db58[_0x3c1c('0x32')]=_['keys'](db[_0x3c1c('0x4c')][_0x3c1c('0x2c')]);_0x35db58[_0x3c1c('0x2f')]=_[_0x3c1c('0x30')](_0x505ec2[_0x3c1c('0x2f')]);_0x35db58[_0x3c1c('0x39')]=_[_0x3c1c('0x31')](_0x35db58[_0x3c1c('0x32')],_0x35db58['query']);_0x324ed4[_0x3c1c('0x33')]=_['intersection'](_0x35db58[_0x3c1c('0x32')],qs[_0x3c1c('0x34')](_0x505ec2[_0x3c1c('0x2f')][_0x3c1c('0x34')]));_0x324ed4[_0x3c1c('0x33')]=_0x324ed4['attributes']['length']?_0x324ed4[_0x3c1c('0x33')]:_0x35db58[_0x3c1c('0x32')];_0x324ed4[_0x3c1c('0x36')]=qs[_0x3c1c('0x37')](_0x505ec2[_0x3c1c('0x2f')][_0x3c1c('0x37')]);_0x324ed4[_0x3c1c('0x38')]=qs[_0x3c1c('0x39')](_['pick'](_0x505ec2[_0x3c1c('0x2f')],_0x35db58[_0x3c1c('0x39')]));if(_0x505ec2[_0x3c1c('0x2f')][_0x3c1c('0x3d')]){_0x324ed4[_0x3c1c('0x38')]=_[_0x3c1c('0x3b')](_0x324ed4[_0x3c1c('0x38')],{'$or':_[_0x3c1c('0x4d')](_0x324ed4[_0x3c1c('0x33')],function(_0x5376fd){var _0xf010a3={};_0xf010a3[_0x5376fd]={'$like':'%'+_0x505ec2['query']['filter']+'%'};return _0xf010a3;})});}_0x324ed4=_[_0x3c1c('0x3b')]({},_0x324ed4,_0x505ec2[_0x3c1c('0x3e')]);return _0x38ec0b[_0x3c1c('0x4f')](_0x324ed4);}})[_0x3c1c('0x26')](function(_0x537b63){if(_0x537b63){_0x258214=_0x537b63[_0x3c1c('0x46')];if(!_0x505ec2['query'][_0x3c1c('0x4e')](_0x3c1c('0x35'))){_0x324ed4[_0x3c1c('0x1e')]=qs['limit'](_0x505ec2[_0x3c1c('0x2f')][_0x3c1c('0x1e')]);_0x324ed4[_0x3c1c('0x1d')]=qs[_0x3c1c('0x1d')](_0x505ec2[_0x3c1c('0x2f')][_0x3c1c('0x1d')]);}return _0x38ec0b[_0x3c1c('0x4f')](_0x324ed4);}})[_0x3c1c('0x26')](function(_0x382650){if(_0x382650){return _0x382650?{'count':_0x258214,'rows':_0x382650}:null;}})[_0x3c1c('0x26')](respondWithResult(_0x26e70e,null))[_0x3c1c('0x43')](handleError(_0x26e70e,null));};exports[_0x3c1c('0x50')]=function(_0x5818af,_0x3f130a,_0x546494){var _0x46edc1={};var _0x4e8ff0={};var _0xec4568;var _0x3745e6;return db[_0x3c1c('0x41')][_0x3c1c('0x4b')]({'where':{'id':_0x5818af[_0x3c1c('0x45')]['id']}})['then'](handleEntityNotFound(_0x3f130a,null))[_0x3c1c('0x26')](function(_0x1cfd08){if(_0x1cfd08){_0xec4568=_0x1cfd08;_0x4e8ff0['model']=_['keys'](db[_0x3c1c('0x4c')]['rawAttributes']);_0x4e8ff0[_0x3c1c('0x2f')]=_[_0x3c1c('0x30')](_0x5818af['query']);_0x4e8ff0['filters']=_[_0x3c1c('0x31')](_0x4e8ff0['model'],_0x4e8ff0[_0x3c1c('0x2f')]);_0x46edc1[_0x3c1c('0x33')]=_['intersection'](_0x4e8ff0['model'],qs[_0x3c1c('0x34')](_0x5818af[_0x3c1c('0x2f')]['fields']));_0x46edc1[_0x3c1c('0x33')]=_0x46edc1[_0x3c1c('0x33')][_0x3c1c('0x46')]?_0x46edc1[_0x3c1c('0x33')]:_0x4e8ff0['model'];_0x46edc1[_0x3c1c('0x36')]=qs[_0x3c1c('0x37')](_0x5818af[_0x3c1c('0x2f')][_0x3c1c('0x37')]);_0x46edc1[_0x3c1c('0x38')]=qs['filters'](_[_0x3c1c('0x3a')](_0x5818af[_0x3c1c('0x2f')],_0x4e8ff0[_0x3c1c('0x39')]));if(_0x5818af[_0x3c1c('0x2f')][_0x3c1c('0x3d')]){_0x46edc1['where']=_[_0x3c1c('0x3b')](_0x46edc1[_0x3c1c('0x38')],{'$or':_[_0x3c1c('0x4d')](_0x46edc1[_0x3c1c('0x33')],function(_0x2eb8f2){var _0xcd101={};_0xcd101[_0x2eb8f2]={'$like':'%'+_0x5818af['query']['filter']+'%'};return _0xcd101;})});}_0x46edc1=_[_0x3c1c('0x3b')]({},_0x46edc1,_0x5818af[_0x3c1c('0x3e')]);return _0xec4568['getDescriptions'](_0x46edc1);}})[_0x3c1c('0x26')](function(_0x3c1867){if(_0x3c1867){_0x3745e6=_0x3c1867[_0x3c1c('0x46')];if(!_0x5818af[_0x3c1c('0x2f')]['hasOwnProperty'](_0x3c1c('0x35'))){_0x46edc1['limit']=qs[_0x3c1c('0x1e')](_0x5818af['query']['limit']);_0x46edc1[_0x3c1c('0x1d')]=qs[_0x3c1c('0x1d')](_0x5818af['query']['offset']);}return _0xec4568[_0x3c1c('0x50')](_0x46edc1);}})['then'](function(_0x3d9728){if(_0x3d9728){return _0x3d9728?{'count':_0x3745e6,'rows':_0x3d9728}:null;}})[_0x3c1c('0x26')](respondWithResult(_0x3f130a,null))[_0x3c1c('0x43')](handleError(_0x3f130a,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index b38c38d..14cee9f 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 _0xc90a=['../../config/logger','request-promise','path','rimraf','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash'];(function(_0x4f978b,_0x5f5429){var _0x456974=function(_0x2ee6a7){while(--_0x2ee6a7){_0x4f978b['push'](_0x4f978b['shift']());}};_0x456974(++_0x5f5429);}(_0xc90a,0x171));var _0xac90=function(_0x328430,_0x140059){_0x328430=_0x328430-0x0;var _0x417649=_0xc90a[_0x328430];return _0x417649;};'use strict';var _=require(_0xac90('0x0'));var util=require('util');var logger=require(_0xac90('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xac90('0x2'));var fs=require('fs');var path=require(_0xac90('0x3'));var rimraf=require(_0xac90('0x4'));var config=require('../../config/environment');var attributes=require(_0xac90('0x5'));module[_0xac90('0x6')]=function(_0x1c4532,_0x58f8fa){return _0x1c4532[_0xac90('0x7')](_0xac90('0x8'),attributes,{'tableName':_0xac90('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x782f=['VtigerConfiguration','lodash','util','../../config/logger','api','moment','path','rimraf','./intVtigerConfiguration.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x782f,0xc9));var _0xf782=function(_0x5433fd,_0x14a670){_0x5433fd=_0x5433fd-0x0;var _0x1a3be3=_0x782f[_0x5433fd];return _0x1a3be3;};'use strict';var _=require(_0xf782('0x0'));var util=require(_0xf782('0x1'));var logger=require(_0xf782('0x2'))(_0xf782('0x3'));var moment=require(_0xf782('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf782('0x5'));var rimraf=require(_0xf782('0x6'));var config=require('../../config/environment');var attributes=require(_0xf782('0x7'));module[_0xf782('0x8')]=function(_0x29c80e,_0xd2fe2c){return _0x29c80e['define'](_0xf782('0x9'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 1b51e4b..fba6b96 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 _0xf6f8=['../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xf6f8,0x101));var _0x8f6f=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xf6f8[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0x8f6f('0x0'));var util=require(_0x8f6f('0x1'));var moment=require(_0x8f6f('0x2'));var BPromise=require(_0x8f6f('0x3'));var rs=require(_0x8f6f('0x4'));var fs=require('fs');var Redis=require(_0x8f6f('0x5'));var db=require(_0x8f6f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f6f('0x7'))('rpc');var config=require(_0x8f6f('0x8'));var jayson=require(_0x8f6f('0x9'));var client=jayson[_0x8f6f('0xa')][_0x8f6f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a0011,_0x51862f,_0x42c82a){return new BPromise(function(_0x254d24,_0x3523a7){return client[_0x8f6f('0xc')](_0x2a0011,_0x42c82a)['then'](function(_0x538aa5){logger[_0x8f6f('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x51862f,_0x8f6f('0xe'));logger[_0x8f6f('0xf')](_0x8f6f('0x10'),_0x51862f,_0x8f6f('0xe'),JSON[_0x8f6f('0x11')](_0x538aa5));if(_0x538aa5[_0x8f6f('0x12')]){if(_0x538aa5[_0x8f6f('0x12')][_0x8f6f('0x13')]===0x1f4){logger[_0x8f6f('0x12')](_0x8f6f('0x14'),_0x51862f,_0x538aa5[_0x8f6f('0x12')][_0x8f6f('0x15')]);return _0x3523a7(_0x538aa5['error'][_0x8f6f('0x15')]);}logger['error'](_0x8f6f('0x14'),_0x51862f,_0x538aa5[_0x8f6f('0x12')]['message']);return _0x254d24(_0x538aa5[_0x8f6f('0x12')][_0x8f6f('0x15')]);}else{logger[_0x8f6f('0xd')](_0x8f6f('0x14'),_0x51862f,'request\x20sent');_0x254d24(_0x538aa5[_0x8f6f('0x16')][_0x8f6f('0x15')]);}})[_0x8f6f('0x17')](function(_0x5e14cb){logger['error'](_0x8f6f('0x14'),_0x51862f,_0x5e14cb);_0x3523a7(_0x5e14cb);});});} \ No newline at end of file +var _0x776c=['client','request','then','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','VtigerConfiguration,\x20%s,\x20%s','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0xbb5075,_0x50d7f5){var _0x902d8=function(_0x172f20){while(--_0x172f20){_0xbb5075['push'](_0xbb5075['shift']());}};_0x902d8(++_0x50d7f5);}(_0x776c,0x6f));var _0xc776=function(_0x35763f,_0x5e9146){_0x35763f=_0x35763f-0x0;var _0x38262d=_0x776c[_0x35763f];return _0x38262d;};'use strict';var _=require(_0xc776('0x0'));var util=require(_0xc776('0x1'));var moment=require(_0xc776('0x2'));var BPromise=require(_0xc776('0x3'));var rs=require(_0xc776('0x4'));var fs=require('fs');var Redis=require(_0xc776('0x5'));var db=require(_0xc776('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc776('0x7'))(_0xc776('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc776('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe6e46f,_0x2f0574,_0x38f132){return new BPromise(function(_0x3c6023,_0xb710c0){return client[_0xc776('0xa')](_0xe6e46f,_0x38f132)[_0xc776('0xb')](function(_0x50b510){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x2f0574,_0xc776('0xc'));logger['debug'](_0xc776('0xd'),_0x2f0574,_0xc776('0xc'),JSON[_0xc776('0xe')](_0x50b510));if(_0x50b510[_0xc776('0xf')]){if(_0x50b510[_0xc776('0xf')]['code']===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x2f0574,_0x50b510['error'][_0xc776('0x10')]);return _0xb710c0(_0x50b510[_0xc776('0xf')][_0xc776('0x10')]);}logger[_0xc776('0xf')](_0xc776('0x11'),_0x2f0574,_0x50b510[_0xc776('0xf')][_0xc776('0x10')]);return _0x3c6023(_0x50b510['error'][_0xc776('0x10')]);}else{logger[_0xc776('0x12')](_0xc776('0x11'),_0x2f0574,_0xc776('0xc'));_0x3c6023(_0x50b510[_0xc776('0x13')][_0xc776('0x10')]);}})['catch'](function(_0x2f0b50){logger[_0xc776('0xf')](_0xc776('0x11'),_0x2f0574,_0x2f0b50);_0xb710c0(_0x2f0b50);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 4f63a4e..7fb3328 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 _0x2a18=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','show','post','/:id','update','delete','destroy','exports','multer','util'];(function(_0x4ac10a,_0x26ebd5){var _0x18409d=function(_0xc7cae6){while(--_0xc7cae6){_0x4ac10a['push'](_0x4ac10a['shift']());}};_0x18409d(++_0x26ebd5);}(_0x2a18,0x9e));var _0x82a1=function(_0x2a8cb7,_0x314d29){_0x2a8cb7=_0x2a8cb7-0x0;var _0x183a1f=_0x2a18[_0x2a8cb7];return _0x183a1f;};'use strict';var multer=require(_0x82a1('0x0'));var util=require(_0x82a1('0x1'));var path=require(_0x82a1('0x2'));var timeout=require(_0x82a1('0x3'));var express=require(_0x82a1('0x4'));var router=express['Router']();var fs_extra=require(_0x82a1('0x5'));var auth=require(_0x82a1('0x6'));var interaction=require(_0x82a1('0x7'));var config=require(_0x82a1('0x8'));var controller=require(_0x82a1('0x9'));router['get']('/',auth[_0x82a1('0xa')](),controller[_0x82a1('0xb')]);router[_0x82a1('0xc')]('/:id',auth[_0x82a1('0xa')](),controller[_0x82a1('0xd')]);router[_0x82a1('0xe')]('/',auth[_0x82a1('0xa')](),controller['create']);router['put'](_0x82a1('0xf'),auth['isAuthenticated'](),controller[_0x82a1('0x10')]);router[_0x82a1('0x11')](_0x82a1('0xf'),auth['isAuthenticated'](),controller[_0x82a1('0x12')]);module[_0x82a1('0x13')]=router; \ No newline at end of file +var _0x33b7=['show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','isAuthenticated','index','get','/:id'];(function(_0x14d09b,_0x5e21d2){var _0x286ca9=function(_0x501110){while(--_0x501110){_0x14d09b['push'](_0x14d09b['shift']());}};_0x286ca9(++_0x5e21d2);}(_0x33b7,0x1ab));var _0x733b=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x33b7[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0x733b('0x0'));var util=require(_0x733b('0x1'));var path=require(_0x733b('0x2'));var timeout=require(_0x733b('0x3'));var express=require('express');var router=express[_0x733b('0x4')]();var fs_extra=require(_0x733b('0x5'));var auth=require(_0x733b('0x6'));var interaction=require(_0x733b('0x7'));var config=require('../../config/environment');var controller=require(_0x733b('0x8'));router['get']('/',auth[_0x733b('0x9')](),controller[_0x733b('0xa')]);router[_0x733b('0xb')](_0x733b('0xc'),auth[_0x733b('0x9')](),controller[_0x733b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x733b('0xe')]);router[_0x733b('0xf')](_0x733b('0xc'),auth[_0x733b('0x9')](),controller[_0x733b('0x10')]);router[_0x733b('0x11')]('/:id',auth[_0x733b('0x9')](),controller[_0x733b('0x12')]);module[_0x733b('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 30b0f0b..1b33da6 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 _0x826a=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x369291,_0x57862c){var _0x185c87=function(_0x3e98bb){while(--_0x3e98bb){_0x369291['push'](_0x369291['shift']());}};_0x185c87(++_0x57862c);}(_0x826a,0x135));var _0xa826=function(_0x58570c,_0x21980e){_0x58570c=_0x58570c-0x0;var _0x2c48ce=_0x826a[_0x58570c];return _0x2c48ce;};'use strict';var Sequelize=require(_0xa826('0x0'));module[_0xa826('0x1')]={'type':{'type':Sequelize[_0xa826('0x2')](_0xa826('0x3'),_0xa826('0x4'),_0xa826('0x5'),_0xa826('0x6'),_0xa826('0x7')),'defaultValue':_0xa826('0x3')},'content':{'type':Sequelize[_0xa826('0x8')]},'key':{'type':Sequelize[_0xa826('0x8')]},'keyType':{'type':Sequelize[_0xa826('0x2')](_0xa826('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xa826('0x8')]},'idField':{'type':Sequelize[_0xa826('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf570=['sequelize','exports','string','keyValue','picklist','STRING','ENUM','BOOLEAN'];(function(_0x89d333,_0x24f696){var _0x178eb9=function(_0x4f4b5f){while(--_0x4f4b5f){_0x89d333['push'](_0x89d333['shift']());}};_0x178eb9(++_0x24f696);}(_0xf570,0x1c0));var _0x0f57=function(_0x4f6cec,_0xd708db){_0x4f6cec=_0x4f6cec-0x0;var _0xf08643=_0xf570[_0x4f6cec];return _0xf08643;};'use strict';var Sequelize=require(_0x0f57('0x0'));module[_0x0f57('0x1')]={'type':{'type':Sequelize['ENUM'](_0x0f57('0x2'),'variable','customVariable',_0x0f57('0x3'),_0x0f57('0x4')),'defaultValue':_0x0f57('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0f57('0x5')]},'keyType':{'type':Sequelize[_0x0f57('0x6')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x0f57('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0f57('0x5')]},'customField':{'type':Sequelize[_0x0f57('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 5235404..e9759e6 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 _0x145a=['apply','save','update','destroy','then','name','index','map','VtigerField','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','zip-dir','request-promise','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x59ec91,_0x7a5df){var _0x2241d8=function(_0xf66ceb){while(--_0xf66ceb){_0x59ec91['push'](_0x59ec91['shift']());}};_0x2241d8(++_0x7a5df);}(_0x145a,0x66));var _0xa145=function(_0x226790,_0x295cb0){_0x226790=_0x226790-0x0;var _0x4f6345=_0x145a[_0x226790];return _0x4f6345;};'use strict';var emlformat=require(_0xa145('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa145('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa145('0x2'));var moment=require('moment');var BPromise=require(_0xa145('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa145('0x4'));var csv=require('to-csv');var ejs=require(_0xa145('0x5'));var fs=require('fs');var fs_extra=require(_0xa145('0x6'));var _=require(_0xa145('0x7'));var squel=require(_0xa145('0x8'));var crypto=require(_0xa145('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xa145('0xa'));var toCsv=require(_0xa145('0xb'));var querystring=require(_0xa145('0xc'));var Papa=require(_0xa145('0xd'));var Redis=require('ioredis');var authService=require(_0xa145('0xe'));var qs=require(_0xa145('0xf'));var as=require(_0xa145('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa145('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xa145('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xa145('0x13'))['db'];function respondWithStatusCode(_0x2b879e,_0x5a90c6){_0x5a90c6=_0x5a90c6||0xcc;return function(_0x2c7a54){if(_0x2c7a54){return _0x2b879e[_0xa145('0x14')](_0x5a90c6);}return _0x2b879e[_0xa145('0x15')](_0x5a90c6)[_0xa145('0x16')]();};}function respondWithResult(_0x4529f2,_0x218a44){_0x218a44=_0x218a44||0xc8;return function(_0x94e18c){if(_0x94e18c){return _0x4529f2[_0xa145('0x15')](_0x218a44)[_0xa145('0x17')](_0x94e18c);}};}function respondWithFilteredResult(_0x595b29,_0x5d0641){return function(_0x52f912){if(_0x52f912){var _0x15da7b=typeof _0x5d0641[_0xa145('0x18')]===_0xa145('0x19')&&typeof _0x5d0641[_0xa145('0x1a')]===_0xa145('0x19');var _0x1cc600=_0x52f912[_0xa145('0x1b')];var _0x132a0c=_0x15da7b?0x0:_0x5d0641[_0xa145('0x18')];var _0x54acc7=_0x15da7b?_0x52f912[_0xa145('0x1b')]:_0x5d0641[_0xa145('0x18')]+_0x5d0641[_0xa145('0x1a')];var _0x79ca65;if(_0x54acc7>=_0x1cc600){_0x54acc7=_0x1cc600;_0x79ca65=0xc8;}else{_0x79ca65=0xce;}_0x595b29[_0xa145('0x15')](_0x79ca65);return _0x595b29[_0xa145('0x1c')](_0xa145('0x1d'),_0x132a0c+'-'+_0x54acc7+'/'+_0x1cc600)[_0xa145('0x17')](_0x52f912);}return null;};}function patchUpdates(_0x181c26){return function(_0x598fbc){try{jsonpatch[_0xa145('0x1e')](_0x598fbc,_0x181c26,!![]);}catch(_0x40992f){return BPromise['reject'](_0x40992f);}return _0x598fbc[_0xa145('0x1f')]();};}function saveUpdates(_0xba7804,_0x5a7f67){return function(_0xfb175c){if(_0xfb175c){return _0xfb175c[_0xa145('0x20')](_0xba7804)['then'](function(_0x2becb3){return _0x2becb3;});}return null;};}function removeEntity(_0x499ab2,_0x378cd0){return function(_0x2d7fb1){if(_0x2d7fb1){return _0x2d7fb1[_0xa145('0x21')]()[_0xa145('0x22')](function(){_0x499ab2[_0xa145('0x15')](0xcc)[_0xa145('0x16')]();});}};}function handleEntityNotFound(_0xf458a,_0x2b022e){return function(_0x33fd42){if(!_0x33fd42){_0xf458a['sendStatus'](0x194);}return _0x33fd42;};}function handleError(_0x3df269,_0x40a809){_0x40a809=_0x40a809||0x1f4;return function(_0xb230d9){logger['error'](_0xb230d9['stack']);if(_0xb230d9['name']){delete _0xb230d9[_0xa145('0x23')];}_0x3df269[_0xa145('0x15')](_0x40a809)['send'](_0xb230d9);};}exports[_0xa145('0x24')]=function(_0xf70954,_0x174c02){var _0x513075={},_0x34fe5b={},_0x2a7202={'count':0x0,'rows':[]};var _0x5c550e=_[_0xa145('0x25')](db[_0xa145('0x26')][_0xa145('0x27')],function(_0x576bf2){return{'name':_0x576bf2[_0xa145('0x28')],'type':_0x576bf2[_0xa145('0x29')]['key']};});_0x34fe5b[_0xa145('0x2a')]=_[_0xa145('0x25')](_0x5c550e,_0xa145('0x23'));_0x34fe5b[_0xa145('0x2b')]=_[_0xa145('0x2c')](_0xf70954[_0xa145('0x2b')]);_0x34fe5b[_0xa145('0x2d')]=_['intersection'](_0x34fe5b[_0xa145('0x2a')],_0x34fe5b[_0xa145('0x2b')]);_0x513075[_0xa145('0x2e')]=_[_0xa145('0x2f')](_0x34fe5b['model'],qs[_0xa145('0x30')](_0xf70954[_0xa145('0x2b')]['fields']));_0x513075[_0xa145('0x2e')]=_0x513075[_0xa145('0x2e')][_0xa145('0x31')]?_0x513075[_0xa145('0x2e')]:_0x34fe5b[_0xa145('0x2a')];if(!_0xf70954[_0xa145('0x2b')]['hasOwnProperty'](_0xa145('0x32'))){_0x513075[_0xa145('0x1a')]=qs['limit'](_0xf70954['query'][_0xa145('0x1a')]);_0x513075[_0xa145('0x18')]=qs[_0xa145('0x18')](_0xf70954[_0xa145('0x2b')]['offset']);}_0x513075[_0xa145('0x33')]=qs[_0xa145('0x34')](_0xf70954[_0xa145('0x2b')][_0xa145('0x34')]);_0x513075[_0xa145('0x35')]=qs[_0xa145('0x2d')](_['pick'](_0xf70954['query'],_0x34fe5b[_0xa145('0x2d')]),_0x5c550e);if(_0xf70954[_0xa145('0x2b')][_0xa145('0x36')]){_0x513075['where']=_[_0xa145('0x37')](_0x513075['where'],{'$or':_[_0xa145('0x25')](_0x5c550e,function(_0x139e35){if(_0x139e35[_0xa145('0x29')]!==_0xa145('0x38')){var _0x115cf4={};_0x115cf4[_0x139e35['name']]={'$like':'%'+_0xf70954[_0xa145('0x2b')][_0xa145('0x36')]+'%'};return _0x115cf4;}})});}_0x513075=_[_0xa145('0x37')]({},_0x513075,_0xf70954['options']);var _0x222f37={'where':_0x513075[_0xa145('0x35')]};return db[_0xa145('0x26')][_0xa145('0x1b')](_0x222f37)['then'](function(_0x524d48){_0x2a7202[_0xa145('0x1b')]=_0x524d48;if(_0xf70954['query'][_0xa145('0x39')]){_0x513075[_0xa145('0x3a')]=[{'all':!![]}];}return db[_0xa145('0x26')][_0xa145('0x3b')](_0x513075);})[_0xa145('0x22')](function(_0x22f85f){_0x2a7202['rows']=_0x22f85f;return _0x2a7202;})[_0xa145('0x22')](respondWithFilteredResult(_0x174c02,_0x513075))[_0xa145('0x3c')](handleError(_0x174c02,null));};exports[_0xa145('0x3d')]=function(_0x5ba908,_0x3b1473){var _0x351145={'raw':!![],'where':{'id':_0x5ba908[_0xa145('0x3e')]['id']}},_0x3f1c02={};_0x3f1c02['model']=_['keys'](db[_0xa145('0x26')][_0xa145('0x27')]);_0x3f1c02[_0xa145('0x2b')]=_[_0xa145('0x2c')](_0x5ba908['query']);_0x3f1c02[_0xa145('0x2d')]=_[_0xa145('0x2f')](_0x3f1c02[_0xa145('0x2a')],_0x3f1c02[_0xa145('0x2b')]);_0x351145[_0xa145('0x2e')]=_[_0xa145('0x2f')](_0x3f1c02[_0xa145('0x2a')],qs[_0xa145('0x30')](_0x5ba908[_0xa145('0x2b')][_0xa145('0x30')]));_0x351145[_0xa145('0x2e')]=_0x351145[_0xa145('0x2e')][_0xa145('0x31')]?_0x351145[_0xa145('0x2e')]:_0x3f1c02['model'];if(_0x5ba908[_0xa145('0x2b')][_0xa145('0x39')]){_0x351145['include']=[{'all':!![]}];}_0x351145=_[_0xa145('0x37')]({},_0x351145,_0x5ba908['options']);return db[_0xa145('0x26')][_0xa145('0x3f')](_0x351145)[_0xa145('0x22')](handleEntityNotFound(_0x3b1473,null))[_0xa145('0x22')](respondWithResult(_0x3b1473,null))['catch'](handleError(_0x3b1473,null));};exports[_0xa145('0x40')]=function(_0x230e1e,_0x3baf5e){return db[_0xa145('0x26')][_0xa145('0x40')](_0x230e1e[_0xa145('0x41')],{})['then'](respondWithResult(_0x3baf5e,0xc9))[_0xa145('0x3c')](handleError(_0x3baf5e,null));};exports['update']=function(_0x3da66a,_0x409038){if(_0x3da66a[_0xa145('0x41')]['id']){delete _0x3da66a['body']['id'];}return db[_0xa145('0x26')][_0xa145('0x3f')]({'where':{'id':_0x3da66a[_0xa145('0x3e')]['id']}})[_0xa145('0x22')](handleEntityNotFound(_0x409038,null))['then'](saveUpdates(_0x3da66a['body'],null))['then'](respondWithResult(_0x409038,null))[_0xa145('0x3c')](handleError(_0x409038,null));};exports[_0xa145('0x21')]=function(_0x2fa5ff,_0x23d99c){return db[_0xa145('0x26')][_0xa145('0x3f')]({'where':{'id':_0x2fa5ff['params']['id']}})[_0xa145('0x22')](handleEntityNotFound(_0x23d99c,null))[_0xa145('0x22')](removeEntity(_0x23d99c,null))['catch'](handleError(_0x23d99c,null));}; \ No newline at end of file +var _0x64f6=['index','map','VtigerField','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','error','name'];(function(_0x14c766,_0x33064c){var _0x50120f=function(_0x22bba8){while(--_0x22bba8){_0x14c766['push'](_0x14c766['shift']());}};_0x50120f(++_0x33064c);}(_0x64f6,0xb3));var _0x664f=function(_0x105ccb,_0x550900){_0x105ccb=_0x105ccb-0x0;var _0x1b79c5=_0x64f6[_0x105ccb];return _0x1b79c5;};'use strict';var emlformat=require(_0x664f('0x0'));var rimraf=require(_0x664f('0x1'));var zipdir=require(_0x664f('0x2'));var jsonpatch=require(_0x664f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x664f('0x4'));var Mustache=require(_0x664f('0x5'));var util=require(_0x664f('0x6'));var path=require(_0x664f('0x7'));var sox=require(_0x664f('0x8'));var csv=require(_0x664f('0x9'));var ejs=require(_0x664f('0xa'));var fs=require('fs');var fs_extra=require(_0x664f('0xb'));var _=require(_0x664f('0xc'));var squel=require(_0x664f('0xd'));var crypto=require(_0x664f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x664f('0xf'));var toCsv=require(_0x664f('0x9'));var querystring=require(_0x664f('0x10'));var Papa=require(_0x664f('0x11'));var Redis=require(_0x664f('0x12'));var authService=require(_0x664f('0x13'));var qs=require(_0x664f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x664f('0x15'));var logger=require('../../config/logger')(_0x664f('0x16'));var utils=require(_0x664f('0x17'));var config=require(_0x664f('0x18'));var licenseUtil=require(_0x664f('0x19'));var db=require(_0x664f('0x1a'))['db'];function respondWithStatusCode(_0x56a7c1,_0x19254c){_0x19254c=_0x19254c||0xcc;return function(_0xf46b5d){if(_0xf46b5d){return _0x56a7c1[_0x664f('0x1b')](_0x19254c);}return _0x56a7c1[_0x664f('0x1c')](_0x19254c)[_0x664f('0x1d')]();};}function respondWithResult(_0x1a4f88,_0x3d8ccd){_0x3d8ccd=_0x3d8ccd||0xc8;return function(_0x59496d){if(_0x59496d){return _0x1a4f88[_0x664f('0x1c')](_0x3d8ccd)[_0x664f('0x1e')](_0x59496d);}};}function respondWithFilteredResult(_0x5ef6db,_0x5895ed){return function(_0x1a9913){if(_0x1a9913){var _0x13b02f=typeof _0x5895ed['offset']===_0x664f('0x1f')&&typeof _0x5895ed[_0x664f('0x20')]==='undefined';var _0x497e2a=_0x1a9913[_0x664f('0x21')];var _0x800528=_0x13b02f?0x0:_0x5895ed[_0x664f('0x22')];var _0x4f3204=_0x13b02f?_0x1a9913['count']:_0x5895ed['offset']+_0x5895ed[_0x664f('0x20')];var _0x52a1d4;if(_0x4f3204>=_0x497e2a){_0x4f3204=_0x497e2a;_0x52a1d4=0xc8;}else{_0x52a1d4=0xce;}_0x5ef6db[_0x664f('0x1c')](_0x52a1d4);return _0x5ef6db['set'](_0x664f('0x23'),_0x800528+'-'+_0x4f3204+'/'+_0x497e2a)[_0x664f('0x1e')](_0x1a9913);}return null;};}function patchUpdates(_0x59c83f){return function(_0x2824b4){try{jsonpatch[_0x664f('0x24')](_0x2824b4,_0x59c83f,!![]);}catch(_0x4e441a){return BPromise[_0x664f('0x25')](_0x4e441a);}return _0x2824b4['save']();};}function saveUpdates(_0x2d44f9,_0x31fc52){return function(_0x47dd20){if(_0x47dd20){return _0x47dd20[_0x664f('0x26')](_0x2d44f9)[_0x664f('0x27')](function(_0x343804){return _0x343804;});}return null;};}function removeEntity(_0x4aa8b1,_0x536c2f){return function(_0x19107d){if(_0x19107d){return _0x19107d[_0x664f('0x28')]()[_0x664f('0x27')](function(){_0x4aa8b1[_0x664f('0x1c')](0xcc)[_0x664f('0x1d')]();});}};}function handleEntityNotFound(_0x2df434,_0x136822){return function(_0x5e7be6){if(!_0x5e7be6){_0x2df434[_0x664f('0x1b')](0x194);}return _0x5e7be6;};}function handleError(_0x3d5c88,_0x1c50a1){_0x1c50a1=_0x1c50a1||0x1f4;return function(_0x43ec35){logger[_0x664f('0x29')](_0x43ec35['stack']);if(_0x43ec35['name']){delete _0x43ec35[_0x664f('0x2a')];}_0x3d5c88[_0x664f('0x1c')](_0x1c50a1)['send'](_0x43ec35);};}exports[_0x664f('0x2b')]=function(_0x4522e1,_0x18e342){var _0x4bbe9d={},_0x693b5a={},_0x1208a4={'count':0x0,'rows':[]};var _0x44fad6=_[_0x664f('0x2c')](db[_0x664f('0x2d')]['rawAttributes'],function(_0x2bb72d){return{'name':_0x2bb72d[_0x664f('0x2e')],'type':_0x2bb72d['type'][_0x664f('0x2f')]};});_0x693b5a[_0x664f('0x30')]=_[_0x664f('0x2c')](_0x44fad6,_0x664f('0x2a'));_0x693b5a['query']=_[_0x664f('0x31')](_0x4522e1[_0x664f('0x32')]);_0x693b5a[_0x664f('0x33')]=_[_0x664f('0x34')](_0x693b5a[_0x664f('0x30')],_0x693b5a[_0x664f('0x32')]);_0x4bbe9d[_0x664f('0x35')]=_['intersection'](_0x693b5a['model'],qs[_0x664f('0x36')](_0x4522e1[_0x664f('0x32')][_0x664f('0x36')]));_0x4bbe9d[_0x664f('0x35')]=_0x4bbe9d[_0x664f('0x35')][_0x664f('0x37')]?_0x4bbe9d[_0x664f('0x35')]:_0x693b5a['model'];if(!_0x4522e1[_0x664f('0x32')]['hasOwnProperty'](_0x664f('0x38'))){_0x4bbe9d[_0x664f('0x20')]=qs[_0x664f('0x20')](_0x4522e1[_0x664f('0x32')][_0x664f('0x20')]);_0x4bbe9d[_0x664f('0x22')]=qs['offset'](_0x4522e1[_0x664f('0x32')][_0x664f('0x22')]);}_0x4bbe9d[_0x664f('0x39')]=qs[_0x664f('0x3a')](_0x4522e1[_0x664f('0x32')][_0x664f('0x3a')]);_0x4bbe9d[_0x664f('0x3b')]=qs[_0x664f('0x33')](_[_0x664f('0x3c')](_0x4522e1['query'],_0x693b5a[_0x664f('0x33')]),_0x44fad6);if(_0x4522e1['query'][_0x664f('0x3d')]){_0x4bbe9d[_0x664f('0x3b')]=_[_0x664f('0x3e')](_0x4bbe9d[_0x664f('0x3b')],{'$or':_[_0x664f('0x2c')](_0x44fad6,function(_0x43ed7b){if(_0x43ed7b['type']!=='VIRTUAL'){var _0x53c420={};_0x53c420[_0x43ed7b[_0x664f('0x2a')]]={'$like':'%'+_0x4522e1[_0x664f('0x32')][_0x664f('0x3d')]+'%'};return _0x53c420;}})});}_0x4bbe9d=_[_0x664f('0x3e')]({},_0x4bbe9d,_0x4522e1[_0x664f('0x3f')]);var _0x7358f9={'where':_0x4bbe9d[_0x664f('0x3b')]};return db[_0x664f('0x2d')][_0x664f('0x21')](_0x7358f9)['then'](function(_0x5bf044){_0x1208a4[_0x664f('0x21')]=_0x5bf044;if(_0x4522e1[_0x664f('0x32')][_0x664f('0x40')]){_0x4bbe9d[_0x664f('0x41')]=[{'all':!![]}];}return db['VtigerField'][_0x664f('0x42')](_0x4bbe9d);})[_0x664f('0x27')](function(_0x95f6c7){_0x1208a4['rows']=_0x95f6c7;return _0x1208a4;})['then'](respondWithFilteredResult(_0x18e342,_0x4bbe9d))[_0x664f('0x43')](handleError(_0x18e342,null));};exports[_0x664f('0x44')]=function(_0xc41b36,_0x2021ed){var _0x42441c={'raw':!![],'where':{'id':_0xc41b36[_0x664f('0x45')]['id']}},_0x14135c={};_0x14135c[_0x664f('0x30')]=_['keys'](db[_0x664f('0x2d')][_0x664f('0x46')]);_0x14135c[_0x664f('0x32')]=_[_0x664f('0x31')](_0xc41b36[_0x664f('0x32')]);_0x14135c[_0x664f('0x33')]=_[_0x664f('0x34')](_0x14135c[_0x664f('0x30')],_0x14135c[_0x664f('0x32')]);_0x42441c[_0x664f('0x35')]=_['intersection'](_0x14135c[_0x664f('0x30')],qs[_0x664f('0x36')](_0xc41b36[_0x664f('0x32')][_0x664f('0x36')]));_0x42441c[_0x664f('0x35')]=_0x42441c[_0x664f('0x35')][_0x664f('0x37')]?_0x42441c[_0x664f('0x35')]:_0x14135c[_0x664f('0x30')];if(_0xc41b36[_0x664f('0x32')][_0x664f('0x40')]){_0x42441c[_0x664f('0x41')]=[{'all':!![]}];}_0x42441c=_[_0x664f('0x3e')]({},_0x42441c,_0xc41b36[_0x664f('0x3f')]);return db[_0x664f('0x2d')][_0x664f('0x47')](_0x42441c)['then'](handleEntityNotFound(_0x2021ed,null))[_0x664f('0x27')](respondWithResult(_0x2021ed,null))['catch'](handleError(_0x2021ed,null));};exports[_0x664f('0x48')]=function(_0x4bcb8d,_0x3bac21){return db[_0x664f('0x2d')][_0x664f('0x48')](_0x4bcb8d[_0x664f('0x49')],{})[_0x664f('0x27')](respondWithResult(_0x3bac21,0xc9))[_0x664f('0x43')](handleError(_0x3bac21,null));};exports['update']=function(_0x50c809,_0x2ac94a){if(_0x50c809[_0x664f('0x49')]['id']){delete _0x50c809['body']['id'];}return db[_0x664f('0x2d')][_0x664f('0x47')]({'where':{'id':_0x50c809['params']['id']}})[_0x664f('0x27')](handleEntityNotFound(_0x2ac94a,null))[_0x664f('0x27')](saveUpdates(_0x50c809[_0x664f('0x49')],null))[_0x664f('0x27')](respondWithResult(_0x2ac94a,null))[_0x664f('0x43')](handleError(_0x2ac94a,null));};exports[_0x664f('0x28')]=function(_0x21c4ea,_0x46911c){return db['VtigerField'][_0x664f('0x47')]({'where':{'id':_0x21c4ea[_0x664f('0x45')]['id']}})[_0x664f('0x27')](handleEntityNotFound(_0x46911c,null))['then'](removeEntity(_0x46911c,null))[_0x664f('0x43')](handleError(_0x46911c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index f586963..04d7590 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 _0x3620=['../../config/environment','./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','vtiger_unique_index','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x571c1d,_0x3b0586){var _0x33c609=function(_0x226499){while(--_0x226499){_0x571c1d['push'](_0x571c1d['shift']());}};_0x33c609(++_0x3b0586);}(_0x3620,0xbc));var _0x0362=function(_0x312aa1,_0x3781e1){_0x312aa1=_0x312aa1-0x0;var _0x2b1ea7=_0x3620[_0x312aa1];return _0x2b1ea7;};'use strict';var _=require(_0x0362('0x0'));var util=require(_0x0362('0x1'));var logger=require(_0x0362('0x2'))(_0x0362('0x3'));var moment=require(_0x0362('0x4'));var BPromise=require(_0x0362('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0362('0x6'));var rimraf=require(_0x0362('0x7'));var config=require(_0x0362('0x8'));var attributes=require(_0x0362('0x9'));module[_0x0362('0xa')]=function(_0x4827ce,_0x3af7f0){return _0x4827ce['define'](_0x0362('0xb'),attributes,{'tableName':_0x0362('0xc'),'paranoid':![],'indexes':[{'name':_0x0362('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x688f=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','moment'];(function(_0x935517,_0x50c229){var _0x1a040a=function(_0x206619){while(--_0x206619){_0x935517['push'](_0x935517['shift']());}};_0x1a040a(++_0x50c229);}(_0x688f,0x19b));var _0xf688=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x688f[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0xf688('0x0'));var util=require(_0xf688('0x1'));var logger=require(_0xf688('0x2'))(_0xf688('0x3'));var moment=require(_0xf688('0x4'));var BPromise=require(_0xf688('0x5'));var rp=require(_0xf688('0x6'));var fs=require('fs');var path=require(_0xf688('0x7'));var rimraf=require(_0xf688('0x8'));var config=require(_0xf688('0x9'));var attributes=require(_0xf688('0xa'));module[_0xf688('0xb')]=function(_0x493797,_0x476a34){return _0x493797[_0xf688('0xc')](_0xf688('0xd'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0xf688('0xe'),'fields':[_0xf688('0xf'),'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 3674711..4391078 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 _0xdc88=['VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info'];(function(_0x33649a,_0x3067ff){var _0x4376e2=function(_0x13fc2f){while(--_0x13fc2f){_0x33649a['push'](_0x33649a['shift']());}};_0x4376e2(++_0x3067ff);}(_0xdc88,0x7a));var _0x8dc8=function(_0x16c745,_0x43cb6b){_0x16c745=_0x16c745-0x0;var _0x30ecbd=_0xdc88[_0x16c745];return _0x30ecbd;};'use strict';var _=require(_0x8dc8('0x0'));var util=require('util');var moment=require(_0x8dc8('0x1'));var BPromise=require(_0x8dc8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8dc8('0x3'))['db'];var utils=require(_0x8dc8('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8dc8('0x5'));var client=jayson[_0x8dc8('0x6')][_0x8dc8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x339cc9,_0x472676,_0x4ec8fe){return new BPromise(function(_0x584c04,_0x559c77){return client[_0x8dc8('0x8')](_0x339cc9,_0x4ec8fe)[_0x8dc8('0x9')](function(_0x521d81){logger[_0x8dc8('0xa')](_0x8dc8('0xb'),_0x472676,_0x8dc8('0xc'));logger['debug'](_0x8dc8('0xd'),_0x472676,'request\x20sent',JSON[_0x8dc8('0xe')](_0x521d81));if(_0x521d81['error']){if(_0x521d81[_0x8dc8('0xf')][_0x8dc8('0x10')]===0x1f4){logger[_0x8dc8('0xf')]('VtigerField,\x20%s,\x20%s',_0x472676,_0x521d81[_0x8dc8('0xf')][_0x8dc8('0x11')]);return _0x559c77(_0x521d81['error']['message']);}logger[_0x8dc8('0xf')]('VtigerField,\x20%s,\x20%s',_0x472676,_0x521d81[_0x8dc8('0xf')]['message']);return _0x584c04(_0x521d81[_0x8dc8('0xf')][_0x8dc8('0x11')]);}else{logger[_0x8dc8('0xa')]('VtigerField,\x20%s,\x20%s',_0x472676,_0x8dc8('0xc'));_0x584c04(_0x521d81['result']['message']);}})[_0x8dc8('0x12')](function(_0x28c20d){logger['error'](_0x8dc8('0xb'),_0x472676,_0x28c20d);_0x559c77(_0x28c20d);});});} \ No newline at end of file +var _0x6bc9=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x275fab,_0x1e7bd7){var _0x1a0f2c=function(_0x24de71){while(--_0x24de71){_0x275fab['push'](_0x275fab['shift']());}};_0x1a0f2c(++_0x1e7bd7);}(_0x6bc9,0x1cc));var _0x96bc=function(_0x20beae,_0x5eac6d){_0x20beae=_0x20beae-0x0;var _0xf5725=_0x6bc9[_0x20beae];return _0xf5725;};'use strict';var _=require(_0x96bc('0x0'));var util=require(_0x96bc('0x1'));var moment=require(_0x96bc('0x2'));var BPromise=require(_0x96bc('0x3'));var rs=require(_0x96bc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96bc('0x5'))['db'];var utils=require(_0x96bc('0x6'));var logger=require(_0x96bc('0x7'))(_0x96bc('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x96bc('0x9')][_0x96bc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ed822,_0x362bdc,_0x2c3155){return new BPromise(function(_0x21b35c,_0x4fb65e){return client[_0x96bc('0xb')](_0x1ed822,_0x2c3155)[_0x96bc('0xc')](function(_0x3fd769){logger[_0x96bc('0xd')](_0x96bc('0xe'),_0x362bdc,_0x96bc('0xf'));logger['debug'](_0x96bc('0x10'),_0x362bdc,_0x96bc('0xf'),JSON[_0x96bc('0x11')](_0x3fd769));if(_0x3fd769[_0x96bc('0x12')]){if(_0x3fd769['error'][_0x96bc('0x13')]===0x1f4){logger[_0x96bc('0x12')]('VtigerField,\x20%s,\x20%s',_0x362bdc,_0x3fd769[_0x96bc('0x12')][_0x96bc('0x14')]);return _0x4fb65e(_0x3fd769[_0x96bc('0x12')][_0x96bc('0x14')]);}logger['error'](_0x96bc('0xe'),_0x362bdc,_0x3fd769['error'][_0x96bc('0x14')]);return _0x21b35c(_0x3fd769['error'][_0x96bc('0x14')]);}else{logger[_0x96bc('0xd')](_0x96bc('0xe'),_0x362bdc,_0x96bc('0xf'));_0x21b35c(_0x3fd769[_0x96bc('0x15')][_0x96bc('0x14')]);}})[_0x96bc('0x16')](function(_0x17ee33){logger[_0x96bc('0x12')](_0x96bc('0xe'),_0x362bdc,_0x17ee33);_0x4fb65e(_0x17ee33);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index f5fff79..3e50911 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 _0x8343=['/:id/fields','post','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','./intZendeskAccount.controller','get','isAuthenticated','/:id','show','getConfigurations'];(function(_0x1df0e5,_0x163a8b){var _0x2dcb78=function(_0x1af771){while(--_0x1af771){_0x1df0e5['push'](_0x1df0e5['shift']());}};_0x2dcb78(++_0x163a8b);}(_0x8343,0xa9));var _0x3834=function(_0x3756e4,_0x45dec7){_0x3756e4=_0x3756e4-0x0;var _0x5cbee3=_0x8343[_0x3756e4];return _0x5cbee3;};'use strict';var multer=require(_0x3834('0x0'));var util=require(_0x3834('0x1'));var path=require(_0x3834('0x2'));var timeout=require('connect-timeout');var express=require(_0x3834('0x3'));var router=express['Router']();var fs_extra=require(_0x3834('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3834('0x5'));router[_0x3834('0x6')]('/',auth[_0x3834('0x7')](),controller['index']);router[_0x3834('0x6')](_0x3834('0x8'),auth[_0x3834('0x7')](),controller[_0x3834('0x9')]);router['get']('/:id/configurations',auth[_0x3834('0x7')](),controller[_0x3834('0xa')]);router[_0x3834('0x6')](_0x3834('0xb'),auth[_0x3834('0x7')](),controller['getFields']);router[_0x3834('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x3834('0xd'),auth[_0x3834('0x7')](),controller[_0x3834('0xe')]);router[_0x3834('0xf')](_0x3834('0x8'),auth[_0x3834('0x7')](),controller[_0x3834('0x10')]);router[_0x3834('0x11')](_0x3834('0x8'),auth[_0x3834('0x7')](),controller[_0x3834('0x12')]);module[_0x3834('0x13')]=router; \ No newline at end of file +var _0x7dbe=['get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller'];(function(_0x481342,_0x39c5b0){var _0x47e1ad=function(_0x35e7db){while(--_0x35e7db){_0x481342['push'](_0x481342['shift']());}};_0x47e1ad(++_0x39c5b0);}(_0x7dbe,0xc7));var _0xe7db=function(_0x3972af,_0x4769b3){_0x3972af=_0x3972af-0x0;var _0x1f072c=_0x7dbe[_0x3972af];return _0x1f072c;};'use strict';var multer=require(_0xe7db('0x0'));var util=require(_0xe7db('0x1'));var path=require(_0xe7db('0x2'));var timeout=require('connect-timeout');var express=require(_0xe7db('0x3'));var router=express[_0xe7db('0x4')]();var fs_extra=require(_0xe7db('0x5'));var auth=require(_0xe7db('0x6'));var interaction=require(_0xe7db('0x7'));var config=require('../../config/environment');var controller=require(_0xe7db('0x8'));router[_0xe7db('0x9')]('/',auth[_0xe7db('0xa')](),controller[_0xe7db('0xb')]);router[_0xe7db('0x9')](_0xe7db('0xc'),auth[_0xe7db('0xa')](),controller[_0xe7db('0xd')]);router[_0xe7db('0x9')](_0xe7db('0xe'),auth[_0xe7db('0xa')](),controller[_0xe7db('0xf')]);router[_0xe7db('0x9')](_0xe7db('0x10'),auth['isAuthenticated'](),controller[_0xe7db('0x11')]);router[_0xe7db('0x12')]('/',auth['isAuthenticated'](),controller[_0xe7db('0x13')]);router[_0xe7db('0x12')](_0xe7db('0xe'),auth[_0xe7db('0xa')](),controller[_0xe7db('0x14')]);router[_0xe7db('0x15')](_0xe7db('0xc'),auth['isAuthenticated'](),controller[_0xe7db('0x16')]);router[_0xe7db('0x17')](_0xe7db('0xc'),auth['isAuthenticated'](),controller[_0xe7db('0x18')]);module[_0xe7db('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 3229853..8d37a3f 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 _0xc4aa=['STRING','username','remoteUri','ENUM','password','token','integrationTab','sequelize','exports'];(function(_0x3d74d4,_0x4072c7){var _0x46aa23=function(_0x52f110){while(--_0x52f110){_0x3d74d4['push'](_0x3d74d4['shift']());}};_0x46aa23(++_0x4072c7);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xc4aa[_0x209941];return _0x1e8729;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'name':{'type':Sequelize[_0xac4a('0x2')]},'description':{'type':Sequelize[_0xac4a('0x2')]},'username':{'type':Sequelize[_0xac4a('0x2')],'unique':_0xac4a('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xac4a('0x4')},'authType':{'type':Sequelize[_0xac4a('0x5')](_0xac4a('0x6'),_0xac4a('0x7')),'defaultValue':_0xac4a('0x6')},'serverUrl':{'type':Sequelize[_0xac4a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xac4a('0x5')](_0xac4a('0x8'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x6691=['username','remoteUri','password','token','integrationTab','sequelize','exports','STRING'];(function(_0x4f2c3a,_0x6bde90){var _0x17d91c=function(_0xaaf630){while(--_0xaaf630){_0x4f2c3a['push'](_0x4f2c3a['shift']());}};_0x17d91c(++_0x6bde90);}(_0x6691,0x12d));var _0x1669=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6691[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x1669('0x0'));module[_0x1669('0x1')]={'name':{'type':Sequelize[_0x1669('0x2')]},'description':{'type':Sequelize[_0x1669('0x2')]},'username':{'type':Sequelize[_0x1669('0x2')],'unique':_0x1669('0x3')},'password':{'type':Sequelize[_0x1669('0x2')]},'token':{'type':Sequelize[_0x1669('0x2')]},'remoteUri':{'type':Sequelize[_0x1669('0x2')],'unique':_0x1669('0x4')},'authType':{'type':Sequelize['ENUM'](_0x1669('0x5'),_0x1669('0x6')),'defaultValue':_0x1669('0x5')},'serverUrl':{'type':Sequelize[_0x1669('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab','newTab'),'defaultValue':_0x1669('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 0f78ecb..602e839 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 _0xde2c=['error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','end','stack','name','send','index','map','ZendeskAccount','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','update','destroy','getConfigurations','ZendeskConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','channel','Descriptions','ZendeskField','Subjects','getFields','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','headers','Basic\x20%s','%s:%s','username','base64','%s/token:%s','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','remove','ticket_fields','includes','position','title','custom_field_options','test'];(function(_0x291e4c,_0x27a9c6){var _0x17edee=function(_0x5e2945){while(--_0x5e2945){_0x291e4c['push'](_0x291e4c['shift']());}};_0x17edee(++_0x27a9c6);}(_0xde2c,0x7f));var _0xcde2=function(_0x189305,_0x46c43f){_0x189305=_0x189305-0x0;var _0xea3406=_0xde2c[_0x189305];return _0xea3406;};'use strict';var emlformat=require(_0xcde2('0x0'));var rimraf=require(_0xcde2('0x1'));var zipdir=require(_0xcde2('0x2'));var jsonpatch=require(_0xcde2('0x3'));var rp=require(_0xcde2('0x4'));var moment=require(_0xcde2('0x5'));var BPromise=require(_0xcde2('0x6'));var Mustache=require(_0xcde2('0x7'));var util=require('util');var path=require(_0xcde2('0x8'));var sox=require(_0xcde2('0x9'));var csv=require(_0xcde2('0xa'));var ejs=require(_0xcde2('0xb'));var fs=require('fs');var fs_extra=require(_0xcde2('0xc'));var _=require('lodash');var squel=require(_0xcde2('0xd'));var crypto=require(_0xcde2('0xe'));var jsforce=require(_0xcde2('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcde2('0x10'));var Papa=require(_0xcde2('0x11'));var Redis=require('ioredis');var authService=require(_0xcde2('0x12'));var qs=require(_0xcde2('0x13'));var as=require(_0xcde2('0x14'));var hardwareService=require(_0xcde2('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xcde2('0x16'));var config=require(_0xcde2('0x17'));var licenseUtil=require(_0xcde2('0x18'));var db=require(_0xcde2('0x19'))['db'];var integrations=require(_0xcde2('0x1a'));function respondWithStatusCode(_0x1ea4bb,_0x599294){_0x599294=_0x599294||0xcc;return function(_0x211215){if(_0x211215){return _0x1ea4bb['sendStatus'](_0x599294);}return _0x1ea4bb[_0xcde2('0x1b')](_0x599294)['end']();};}function respondWithResult(_0x4b0e0e,_0x34e079){_0x34e079=_0x34e079||0xc8;return function(_0x1c7103){if(_0x1c7103){return _0x4b0e0e[_0xcde2('0x1b')](_0x34e079)[_0xcde2('0x1c')](_0x1c7103);}};}function respondWithFilteredResult(_0x11665c,_0x5312c7){return function(_0x39b023){if(_0x39b023){var _0x4c558b=typeof _0x5312c7[_0xcde2('0x1d')]===_0xcde2('0x1e')&&typeof _0x5312c7[_0xcde2('0x1f')]===_0xcde2('0x1e');var _0x5223f1=_0x39b023['count'];var _0x4fe586=_0x4c558b?0x0:_0x5312c7[_0xcde2('0x1d')];var _0x582e84=_0x4c558b?_0x39b023[_0xcde2('0x20')]:_0x5312c7[_0xcde2('0x1d')]+_0x5312c7[_0xcde2('0x1f')];var _0x481fc0;if(_0x582e84>=_0x5223f1){_0x582e84=_0x5223f1;_0x481fc0=0xc8;}else{_0x481fc0=0xce;}_0x11665c[_0xcde2('0x1b')](_0x481fc0);return _0x11665c[_0xcde2('0x21')](_0xcde2('0x22'),_0x4fe586+'-'+_0x582e84+'/'+_0x5223f1)[_0xcde2('0x1c')](_0x39b023);}return null;};}function patchUpdates(_0x43df7a){return function(_0x57210d){try{jsonpatch['apply'](_0x57210d,_0x43df7a,!![]);}catch(_0x5a92b9){return BPromise[_0xcde2('0x23')](_0x5a92b9);}return _0x57210d[_0xcde2('0x24')]();};}function saveUpdates(_0x2c9562,_0x4063d4){return function(_0xc86374){if(_0xc86374){return _0xc86374['update'](_0x2c9562)[_0xcde2('0x25')](function(_0x52368b){return _0x52368b;});}return null;};}function removeEntity(_0x280d8c,_0xb2123c){return function(_0x26d18e){if(_0x26d18e){return _0x26d18e['destroy']()['then'](function(){_0x280d8c[_0xcde2('0x1b')](0xcc)[_0xcde2('0x26')]();});}};}function handleEntityNotFound(_0x3e8aaf,_0x217ec9){return function(_0xcadb2){if(!_0xcadb2){_0x3e8aaf['sendStatus'](0x194);}return _0xcadb2;};}function handleError(_0x2d1d17,_0x45275a){_0x45275a=_0x45275a||0x1f4;return function(_0x1dce65){logger['error'](_0x1dce65[_0xcde2('0x27')]);if(_0x1dce65[_0xcde2('0x28')]){delete _0x1dce65[_0xcde2('0x28')];}_0x2d1d17[_0xcde2('0x1b')](_0x45275a)[_0xcde2('0x29')](_0x1dce65);};}exports[_0xcde2('0x2a')]=function(_0x40b12c,_0x3e492f){var _0x5bf1e6={},_0x3c3c01={},_0x4a0826={'count':0x0,'rows':[]};var _0x141072=_[_0xcde2('0x2b')](db[_0xcde2('0x2c')]['rawAttributes'],function(_0xae46dc){return{'name':_0xae46dc[_0xcde2('0x2d')],'type':_0xae46dc['type'][_0xcde2('0x2e')]};});_0x3c3c01[_0xcde2('0x2f')]=_[_0xcde2('0x2b')](_0x141072,_0xcde2('0x28'));_0x3c3c01[_0xcde2('0x30')]=_[_0xcde2('0x31')](_0x40b12c[_0xcde2('0x30')]);_0x3c3c01[_0xcde2('0x32')]=_['intersection'](_0x3c3c01[_0xcde2('0x2f')],_0x3c3c01[_0xcde2('0x30')]);_0x5bf1e6[_0xcde2('0x33')]=_[_0xcde2('0x34')](_0x3c3c01['model'],qs[_0xcde2('0x35')](_0x40b12c[_0xcde2('0x30')][_0xcde2('0x35')]));_0x5bf1e6[_0xcde2('0x33')]=_0x5bf1e6['attributes'][_0xcde2('0x36')]?_0x5bf1e6[_0xcde2('0x33')]:_0x3c3c01[_0xcde2('0x2f')];if(!_0x40b12c[_0xcde2('0x30')]['hasOwnProperty'](_0xcde2('0x37'))){_0x5bf1e6[_0xcde2('0x1f')]=qs[_0xcde2('0x1f')](_0x40b12c[_0xcde2('0x30')][_0xcde2('0x1f')]);_0x5bf1e6['offset']=qs[_0xcde2('0x1d')](_0x40b12c[_0xcde2('0x30')][_0xcde2('0x1d')]);}_0x5bf1e6[_0xcde2('0x38')]=qs['sort'](_0x40b12c['query'][_0xcde2('0x39')]);_0x5bf1e6[_0xcde2('0x3a')]=qs[_0xcde2('0x32')](_[_0xcde2('0x3b')](_0x40b12c[_0xcde2('0x30')],_0x3c3c01[_0xcde2('0x32')]),_0x141072);if(_0x40b12c[_0xcde2('0x30')][_0xcde2('0x3c')]){_0x5bf1e6[_0xcde2('0x3a')]=_['merge'](_0x5bf1e6[_0xcde2('0x3a')],{'$or':_[_0xcde2('0x2b')](_0x141072,function(_0x30f843){if(_0x30f843[_0xcde2('0x3d')]!==_0xcde2('0x3e')){var _0x47b6ee={};_0x47b6ee[_0x30f843['name']]={'$like':'%'+_0x40b12c[_0xcde2('0x30')][_0xcde2('0x3c')]+'%'};return _0x47b6ee;}})});}_0x5bf1e6=_[_0xcde2('0x3f')]({},_0x5bf1e6,_0x40b12c[_0xcde2('0x40')]);var _0x144de9={'where':_0x5bf1e6[_0xcde2('0x3a')]};return db['ZendeskAccount']['count'](_0x144de9)['then'](function(_0x18f723){_0x4a0826[_0xcde2('0x20')]=_0x18f723;if(_0x40b12c[_0xcde2('0x30')][_0xcde2('0x41')]){_0x5bf1e6[_0xcde2('0x42')]=[{'all':!![]}];}return db[_0xcde2('0x2c')][_0xcde2('0x43')](_0x5bf1e6);})['then'](function(_0x48580a){_0x4a0826[_0xcde2('0x44')]=_0x48580a;return _0x4a0826;})['then'](respondWithFilteredResult(_0x3e492f,_0x5bf1e6))[_0xcde2('0x45')](handleError(_0x3e492f,null));};exports['show']=function(_0x1126b2,_0x3239a0){var _0x2cf372={'raw':![],'where':{'id':_0x1126b2[_0xcde2('0x46')]['id']}},_0x5ea9a9={};_0x5ea9a9['model']=_[_0xcde2('0x31')](db[_0xcde2('0x2c')][_0xcde2('0x47')]);_0x5ea9a9[_0xcde2('0x30')]=_[_0xcde2('0x31')](_0x1126b2[_0xcde2('0x30')]);_0x5ea9a9['filters']=_['intersection'](_0x5ea9a9[_0xcde2('0x2f')],_0x5ea9a9['query']);_0x2cf372['attributes']=_[_0xcde2('0x34')](_0x5ea9a9['model'],qs[_0xcde2('0x35')](_0x1126b2[_0xcde2('0x30')]['fields']));_0x2cf372[_0xcde2('0x33')]=_0x2cf372['attributes']['length']?_0x2cf372[_0xcde2('0x33')]:_0x5ea9a9[_0xcde2('0x2f')];if(_0x1126b2['query'][_0xcde2('0x41')]){_0x2cf372['include']=[{'all':!![]}];}_0x2cf372=_[_0xcde2('0x3f')]({},_0x2cf372,_0x1126b2[_0xcde2('0x40')]);return db[_0xcde2('0x2c')][_0xcde2('0x48')](_0x2cf372)[_0xcde2('0x25')](handleEntityNotFound(_0x3239a0,null))['then'](respondWithResult(_0x3239a0,null))[_0xcde2('0x45')](handleError(_0x3239a0,null));};exports[_0xcde2('0x49')]=function(_0x40d14b,_0x2c78a5){return db['ZendeskAccount']['create'](_0x40d14b[_0xcde2('0x4a')],{})['then'](respondWithResult(_0x2c78a5,0xc9))[_0xcde2('0x45')](handleError(_0x2c78a5,null));};exports[_0xcde2('0x4b')]=function(_0x381bd4,_0x16675f){if(_0x381bd4[_0xcde2('0x4a')]['id']){delete _0x381bd4[_0xcde2('0x4a')]['id'];}return db['ZendeskAccount'][_0xcde2('0x48')]({'where':{'id':_0x381bd4['params']['id']}})[_0xcde2('0x25')](handleEntityNotFound(_0x16675f,null))['then'](saveUpdates(_0x381bd4[_0xcde2('0x4a')],null))[_0xcde2('0x25')](respondWithResult(_0x16675f,null))[_0xcde2('0x45')](handleError(_0x16675f,null));};exports[_0xcde2('0x4c')]=function(_0x446cf0,_0x5071ce){return db['ZendeskAccount'][_0xcde2('0x48')]({'where':{'id':_0x446cf0['params']['id']}})[_0xcde2('0x25')](handleEntityNotFound(_0x5071ce,null))[_0xcde2('0x25')](removeEntity(_0x5071ce,null))[_0xcde2('0x45')](handleError(_0x5071ce,null));};exports[_0xcde2('0x4d')]=function(_0x1e1c9e,_0x9067c8,_0x3a0760){var _0x28bd25={};var _0x373cdc={};var _0x21585a;var _0x3c5a17;return db[_0xcde2('0x2c')]['findOne']({'where':{'id':_0x1e1c9e['params']['id']}})['then'](handleEntityNotFound(_0x9067c8,null))[_0xcde2('0x25')](function(_0x59a64d){if(_0x59a64d){_0x21585a=_0x59a64d;_0x373cdc[_0xcde2('0x2f')]=_[_0xcde2('0x31')](db[_0xcde2('0x4e')]['rawAttributes']);_0x373cdc[_0xcde2('0x30')]=_['keys'](_0x1e1c9e[_0xcde2('0x30')]);_0x373cdc['filters']=_[_0xcde2('0x34')](_0x373cdc[_0xcde2('0x2f')],_0x373cdc['query']);_0x28bd25[_0xcde2('0x33')]=_['intersection'](_0x373cdc['model'],qs[_0xcde2('0x35')](_0x1e1c9e[_0xcde2('0x30')][_0xcde2('0x35')]));_0x28bd25[_0xcde2('0x33')]=_0x28bd25[_0xcde2('0x33')][_0xcde2('0x36')]?_0x28bd25['attributes']:_0x373cdc[_0xcde2('0x2f')];_0x28bd25[_0xcde2('0x38')]=qs[_0xcde2('0x39')](_0x1e1c9e[_0xcde2('0x30')][_0xcde2('0x39')]);_0x28bd25[_0xcde2('0x3a')]=qs['filters'](_['pick'](_0x1e1c9e[_0xcde2('0x30')],_0x373cdc[_0xcde2('0x32')]));if(_0x1e1c9e[_0xcde2('0x30')][_0xcde2('0x3c')]){_0x28bd25['where']=_[_0xcde2('0x3f')](_0x28bd25[_0xcde2('0x3a')],{'$or':_[_0xcde2('0x2b')](_0x28bd25[_0xcde2('0x33')],function(_0x5e4733){var _0x35453a={};_0x35453a[_0x5e4733]={'$like':'%'+_0x1e1c9e['query'][_0xcde2('0x3c')]+'%'};return _0x35453a;})});}_0x28bd25=_[_0xcde2('0x3f')]({},_0x28bd25,_0x1e1c9e['options']);return _0x21585a[_0xcde2('0x4d')](_0x28bd25);}})[_0xcde2('0x25')](function(_0x408535){if(_0x408535){_0x3c5a17=_0x408535[_0xcde2('0x36')];if(!_0x1e1c9e[_0xcde2('0x30')][_0xcde2('0x4f')](_0xcde2('0x37'))){_0x28bd25[_0xcde2('0x1f')]=qs[_0xcde2('0x1f')](_0x1e1c9e[_0xcde2('0x30')]['limit']);_0x28bd25[_0xcde2('0x1d')]=qs[_0xcde2('0x1d')](_0x1e1c9e['query'][_0xcde2('0x1d')]);}return _0x21585a[_0xcde2('0x4d')](_0x28bd25);}})[_0xcde2('0x25')](function(_0x5aaa3f){if(_0x5aaa3f){return _0x5aaa3f?{'count':_0x3c5a17,'rows':_0x5aaa3f}:null;}})[_0xcde2('0x25')](respondWithResult(_0x9067c8,null))[_0xcde2('0x45')](handleError(_0x9067c8,null));};exports[_0xcde2('0x50')]=function(_0x3b1ca7,_0x24ddd2,_0x3aa334){if(_0x3b1ca7[_0xcde2('0x4a')]['id']){delete _0x3b1ca7[_0xcde2('0x4a')]['id'];}return db[_0xcde2('0x2c')][_0xcde2('0x51')]({'where':{'id':_0x3b1ca7[_0xcde2('0x46')]['id']}})['then'](handleEntityNotFound(_0x24ddd2,null))['then'](function(_0x39c723){if(_0x39c723){_0x3b1ca7[_0xcde2('0x4a')][_0xcde2('0x52')]=_0x39c723['id'];_0x3b1ca7['body']['Subjects']=integrations['getSubjects'](_0x3b1ca7[_0xcde2('0x4a')][_0xcde2('0x53')],_0x3b1ca7[_0xcde2('0x4a')][_0xcde2('0x3d')]);_0x3b1ca7[_0xcde2('0x4a')][_0xcde2('0x54')]=integrations['getDescriptions'](_0x3b1ca7['body'][_0xcde2('0x53')],_0x3b1ca7[_0xcde2('0x4a')][_0xcde2('0x3d')]);return db[_0xcde2('0x4e')][_0xcde2('0x49')](_0x3b1ca7[_0xcde2('0x4a')],{'include':[{'model':db[_0xcde2('0x55')],'as':_0xcde2('0x56')},{'model':db[_0xcde2('0x55')],'as':_0xcde2('0x54')}]});}return null;})[_0xcde2('0x25')](respondWithResult(_0x24ddd2,null))[_0xcde2('0x45')](handleError(_0x24ddd2,null));};exports[_0xcde2('0x57')]=function(_0x16b6b3,_0x3f46ca,_0xb5e3){var _0x3cf1aa='';return db[_0xcde2('0x2c')][_0xcde2('0x51')]({'where':{'id':_0x16b6b3[_0xcde2('0x46')]['id']},'attributes':['id','username',_0xcde2('0x58'),_0xcde2('0x59'),_0xcde2('0x5a'),_0xcde2('0x5b')]})[_0xcde2('0x25')](handleEntityNotFound(_0x3f46ca,null))['then'](function(_0x2e9714){if(_0x2e9714){_0x3cf1aa=_0x2e9714['remoteUri'];var _0x103932=_0x3cf1aa[_0xcde2('0x5c')](-0x1);if(_0x103932==='/'){_0x3cf1aa=_0x3cf1aa[_0xcde2('0x5d')](0x0,_0x3cf1aa[_0xcde2('0x5e')](_0x103932));}var _0x31815f={'method':_0xcde2('0x5f'),'uri':util[_0xcde2('0x60')]('%s/%s',_0x3cf1aa,'ticket_fields'),'json':!![]};switch(_0x2e9714[_0xcde2('0x5a')]){case'password':_0x31815f[_0xcde2('0x61')]={'Authorization':util[_0xcde2('0x60')](_0xcde2('0x62'),new Buffer(util[_0xcde2('0x60')](_0xcde2('0x63'),_0x2e9714[_0xcde2('0x64')],_0x2e9714[_0xcde2('0x58')]))['toString'](_0xcde2('0x65')))};break;case _0xcde2('0x59'):_0x31815f[_0xcde2('0x61')]={'Authorization':util[_0xcde2('0x60')]('Basic\x20%s',new Buffer(util[_0xcde2('0x60')](_0xcde2('0x66'),_0x2e9714[_0xcde2('0x64')],_0x2e9714[_0xcde2('0x59')]))[_0xcde2('0x67')](_0xcde2('0x65')))};break;default:throw new db[(_0xcde2('0x68'))][(_0xcde2('0x69'))](_0xcde2('0x6a'));}return rp(_0x31815f);}})[_0xcde2('0x25')](function(_0x213901){if(_0x213901){var _0x225ddd=[_0xcde2('0x6b'),'description',_0xcde2('0x6c'),_0xcde2('0x6d')];_[_0xcde2('0x6e')](_0x213901[_0xcde2('0x6f')],function(_0x1f1f71){return _0x225ddd[_0xcde2('0x70')](_0x1f1f71[_0xcde2('0x3d')]);});return{'count':_0x213901[_0xcde2('0x6f')][_0xcde2('0x36')],'rows':_[_0xcde2('0x2b')](_0x213901[_0xcde2('0x6f')],function(_0x18b0a1){return{'id':_0x18b0a1['id'],'name':_0x18b0a1[_0xcde2('0x71')]>0x7?_0x18b0a1[_0xcde2('0x72')]:_0x18b0a1[_0xcde2('0x3d')],'custom':_0x18b0a1[_0xcde2('0x71')]>0x7?!![]:![],'options':_0x18b0a1['system_field_options']?_0x18b0a1['system_field_options']:_0x18b0a1[_0xcde2('0x73')]?_0x18b0a1[_0xcde2('0x73')]:[]};})};}})[_0xcde2('0x25')](respondWithResult(_0x3f46ca,null))[_0xcde2('0x45')](function(_0x4ffd32){var _0x9afade=_0x16b6b3['query'][_0xcde2('0x74')]?0x1f4:_0x4ffd32['statusCode']||0x1f4;logger[_0xcde2('0x75')](_0xcde2('0x76'),'getFields',_0x9afade,JSON[_0xcde2('0x77')](_0x4ffd32));delete _0x4ffd32[_0xcde2('0x28')];if(_0x9afade===0x191){_0x9afade=0x190;}_0x3f46ca[_0xcde2('0x1b')](_0x9afade)['send'](_0x16b6b3[_0xcde2('0x30')][_0xcde2('0x74')]?{'message':_0xcde2('0x78'),'statusCode':_0x4ffd32[_0xcde2('0x79')]}:_0x4ffd32);});}; \ No newline at end of file +var _0xda3f=['description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','getFields','stringify','send','test','statusCode','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','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ZendeskAccount','includeAll','include','params','length','find','catch','create','body','getConfigurations','findOne','ZendeskConfiguration','options','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','username','password','remoteUri','slice','lastIndexOf','GET','format','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','token','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xda3f,0xec));var _0xfda3=function(_0x5c229a,_0x5039a0){_0x5c229a=_0x5c229a-0x0;var _0x4d2b28=_0xda3f[_0x5c229a];return _0x4d2b28;};'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'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x583125,_0x5d7d5b){_0x5d7d5b=_0x5d7d5b||0xcc;return function(_0x3fd031){if(_0x3fd031){return _0x583125[_0xfda3('0x17')](_0x5d7d5b);}return _0x583125['status'](_0x5d7d5b)['end']();};}function respondWithResult(_0x587e9b,_0x227d72){_0x227d72=_0x227d72||0xc8;return function(_0x477fc0){if(_0x477fc0){return _0x587e9b['status'](_0x227d72)['json'](_0x477fc0);}};}function respondWithFilteredResult(_0x533365,_0x80ea80){return function(_0x474707){if(_0x474707){var _0x249dc6=typeof _0x80ea80[_0xfda3('0x18')]===_0xfda3('0x19')&&typeof _0x80ea80[_0xfda3('0x1a')]===_0xfda3('0x19');var _0x93c8ef=_0x474707[_0xfda3('0x1b')];var _0xc62ae6=_0x249dc6?0x0:_0x80ea80['offset'];var _0x15ddb9=_0x249dc6?_0x474707[_0xfda3('0x1b')]:_0x80ea80[_0xfda3('0x18')]+_0x80ea80[_0xfda3('0x1a')];var _0x59a887;if(_0x15ddb9>=_0x93c8ef){_0x15ddb9=_0x93c8ef;_0x59a887=0xc8;}else{_0x59a887=0xce;}_0x533365[_0xfda3('0x1c')](_0x59a887);return _0x533365[_0xfda3('0x1d')](_0xfda3('0x1e'),_0xc62ae6+'-'+_0x15ddb9+'/'+_0x93c8ef)['json'](_0x474707);}return null;};}function patchUpdates(_0x5ad52a){return function(_0xa0449d){try{jsonpatch[_0xfda3('0x1f')](_0xa0449d,_0x5ad52a,!![]);}catch(_0x4ea9f5){return BPromise['reject'](_0x4ea9f5);}return _0xa0449d[_0xfda3('0x20')]();};}function saveUpdates(_0xef2535,_0x1e15a8){return function(_0x2c0ae9){if(_0x2c0ae9){return _0x2c0ae9[_0xfda3('0x21')](_0xef2535)[_0xfda3('0x22')](function(_0x2677f6){return _0x2677f6;});}return null;};}function removeEntity(_0xc6fb9a,_0x16eaa6){return function(_0x5499f5){if(_0x5499f5){return _0x5499f5[_0xfda3('0x23')]()[_0xfda3('0x22')](function(){_0xc6fb9a[_0xfda3('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a977,_0x39e246){return function(_0x172cfb){if(!_0x172cfb){_0x45a977[_0xfda3('0x17')](0x194);}return _0x172cfb;};}function handleError(_0x1cb831,_0xad9f7b){_0xad9f7b=_0xad9f7b||0x1f4;return function(_0x514d2a){logger[_0xfda3('0x24')](_0x514d2a[_0xfda3('0x25')]);if(_0x514d2a[_0xfda3('0x26')]){delete _0x514d2a[_0xfda3('0x26')];}_0x1cb831[_0xfda3('0x1c')](_0xad9f7b)['send'](_0x514d2a);};}exports[_0xfda3('0x27')]=function(_0x4101b1,_0x301509){var _0x474992={},_0xe21ec6={},_0x3cfeb2={'count':0x0,'rows':[]};var _0x26e544=_['map'](db['ZendeskAccount'][_0xfda3('0x28')],function(_0x4fd277){return{'name':_0x4fd277['fieldName'],'type':_0x4fd277[_0xfda3('0x29')][_0xfda3('0x2a')]};});_0xe21ec6[_0xfda3('0x2b')]=_[_0xfda3('0x2c')](_0x26e544,_0xfda3('0x26'));_0xe21ec6[_0xfda3('0x2d')]=_[_0xfda3('0x2e')](_0x4101b1[_0xfda3('0x2d')]);_0xe21ec6[_0xfda3('0x2f')]=_['intersection'](_0xe21ec6[_0xfda3('0x2b')],_0xe21ec6[_0xfda3('0x2d')]);_0x474992[_0xfda3('0x30')]=_[_0xfda3('0x31')](_0xe21ec6[_0xfda3('0x2b')],qs[_0xfda3('0x32')](_0x4101b1[_0xfda3('0x2d')][_0xfda3('0x32')]));_0x474992[_0xfda3('0x30')]=_0x474992['attributes']['length']?_0x474992[_0xfda3('0x30')]:_0xe21ec6[_0xfda3('0x2b')];if(!_0x4101b1['query'][_0xfda3('0x33')](_0xfda3('0x34'))){_0x474992[_0xfda3('0x1a')]=qs['limit'](_0x4101b1[_0xfda3('0x2d')][_0xfda3('0x1a')]);_0x474992[_0xfda3('0x18')]=qs[_0xfda3('0x18')](_0x4101b1[_0xfda3('0x2d')]['offset']);}_0x474992[_0xfda3('0x35')]=qs[_0xfda3('0x36')](_0x4101b1[_0xfda3('0x2d')]['sort']);_0x474992[_0xfda3('0x37')]=qs['filters'](_[_0xfda3('0x38')](_0x4101b1[_0xfda3('0x2d')],_0xe21ec6[_0xfda3('0x2f')]),_0x26e544);if(_0x4101b1[_0xfda3('0x2d')][_0xfda3('0x39')]){_0x474992[_0xfda3('0x37')]=_[_0xfda3('0x3a')](_0x474992[_0xfda3('0x37')],{'$or':_['map'](_0x26e544,function(_0x24c7ad){if(_0x24c7ad[_0xfda3('0x29')]!==_0xfda3('0x3b')){var _0x8ed2ba={};_0x8ed2ba[_0x24c7ad['name']]={'$like':'%'+_0x4101b1[_0xfda3('0x2d')][_0xfda3('0x39')]+'%'};return _0x8ed2ba;}})});}_0x474992=_[_0xfda3('0x3a')]({},_0x474992,_0x4101b1['options']);var _0x5ac61e={'where':_0x474992[_0xfda3('0x37')]};return db[_0xfda3('0x3c')][_0xfda3('0x1b')](_0x5ac61e)[_0xfda3('0x22')](function(_0x2b415d){_0x3cfeb2[_0xfda3('0x1b')]=_0x2b415d;if(_0x4101b1[_0xfda3('0x2d')][_0xfda3('0x3d')]){_0x474992[_0xfda3('0x3e')]=[{'all':!![]}];}return db[_0xfda3('0x3c')]['findAll'](_0x474992);})[_0xfda3('0x22')](function(_0x22b848){_0x3cfeb2['rows']=_0x22b848;return _0x3cfeb2;})[_0xfda3('0x22')](respondWithFilteredResult(_0x301509,_0x474992))['catch'](handleError(_0x301509,null));};exports['show']=function(_0x4e6886,_0x2208bc){var _0x107fb1={'raw':![],'where':{'id':_0x4e6886[_0xfda3('0x3f')]['id']}},_0x260977={};_0x260977['model']=_[_0xfda3('0x2e')](db[_0xfda3('0x3c')][_0xfda3('0x28')]);_0x260977[_0xfda3('0x2d')]=_['keys'](_0x4e6886[_0xfda3('0x2d')]);_0x260977[_0xfda3('0x2f')]=_[_0xfda3('0x31')](_0x260977['model'],_0x260977['query']);_0x107fb1[_0xfda3('0x30')]=_[_0xfda3('0x31')](_0x260977[_0xfda3('0x2b')],qs[_0xfda3('0x32')](_0x4e6886[_0xfda3('0x2d')][_0xfda3('0x32')]));_0x107fb1[_0xfda3('0x30')]=_0x107fb1[_0xfda3('0x30')][_0xfda3('0x40')]?_0x107fb1[_0xfda3('0x30')]:_0x260977[_0xfda3('0x2b')];if(_0x4e6886[_0xfda3('0x2d')][_0xfda3('0x3d')]){_0x107fb1[_0xfda3('0x3e')]=[{'all':!![]}];}_0x107fb1=_['merge']({},_0x107fb1,_0x4e6886['options']);return db[_0xfda3('0x3c')][_0xfda3('0x41')](_0x107fb1)[_0xfda3('0x22')](handleEntityNotFound(_0x2208bc,null))[_0xfda3('0x22')](respondWithResult(_0x2208bc,null))[_0xfda3('0x42')](handleError(_0x2208bc,null));};exports[_0xfda3('0x43')]=function(_0x192133,_0x125f5a){return db[_0xfda3('0x3c')][_0xfda3('0x43')](_0x192133['body'],{})[_0xfda3('0x22')](respondWithResult(_0x125f5a,0xc9))[_0xfda3('0x42')](handleError(_0x125f5a,null));};exports[_0xfda3('0x21')]=function(_0x36aa3a,_0x26496a){if(_0x36aa3a['body']['id']){delete _0x36aa3a[_0xfda3('0x44')]['id'];}return db[_0xfda3('0x3c')][_0xfda3('0x41')]({'where':{'id':_0x36aa3a['params']['id']}})[_0xfda3('0x22')](handleEntityNotFound(_0x26496a,null))[_0xfda3('0x22')](saveUpdates(_0x36aa3a[_0xfda3('0x44')],null))['then'](respondWithResult(_0x26496a,null))[_0xfda3('0x42')](handleError(_0x26496a,null));};exports[_0xfda3('0x23')]=function(_0x2f54eb,_0x2f6e62){return db[_0xfda3('0x3c')]['find']({'where':{'id':_0x2f54eb[_0xfda3('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2f6e62,null))[_0xfda3('0x22')](removeEntity(_0x2f6e62,null))['catch'](handleError(_0x2f6e62,null));};exports[_0xfda3('0x45')]=function(_0x6447,_0x322b66,_0x26ffee){var _0x574f02={};var _0x244c24={};var _0x3b430d;var _0x2f2c32;return db[_0xfda3('0x3c')][_0xfda3('0x46')]({'where':{'id':_0x6447[_0xfda3('0x3f')]['id']}})[_0xfda3('0x22')](handleEntityNotFound(_0x322b66,null))['then'](function(_0x4b1410){if(_0x4b1410){_0x3b430d=_0x4b1410;_0x244c24[_0xfda3('0x2b')]=_[_0xfda3('0x2e')](db[_0xfda3('0x47')]['rawAttributes']);_0x244c24['query']=_[_0xfda3('0x2e')](_0x6447[_0xfda3('0x2d')]);_0x244c24[_0xfda3('0x2f')]=_[_0xfda3('0x31')](_0x244c24[_0xfda3('0x2b')],_0x244c24['query']);_0x574f02[_0xfda3('0x30')]=_[_0xfda3('0x31')](_0x244c24[_0xfda3('0x2b')],qs[_0xfda3('0x32')](_0x6447[_0xfda3('0x2d')][_0xfda3('0x32')]));_0x574f02[_0xfda3('0x30')]=_0x574f02[_0xfda3('0x30')][_0xfda3('0x40')]?_0x574f02[_0xfda3('0x30')]:_0x244c24[_0xfda3('0x2b')];_0x574f02[_0xfda3('0x35')]=qs['sort'](_0x6447[_0xfda3('0x2d')][_0xfda3('0x36')]);_0x574f02[_0xfda3('0x37')]=qs[_0xfda3('0x2f')](_[_0xfda3('0x38')](_0x6447[_0xfda3('0x2d')],_0x244c24[_0xfda3('0x2f')]));if(_0x6447['query']['filter']){_0x574f02[_0xfda3('0x37')]=_[_0xfda3('0x3a')](_0x574f02['where'],{'$or':_[_0xfda3('0x2c')](_0x574f02[_0xfda3('0x30')],function(_0x2a5efe){var _0x38dbc7={};_0x38dbc7[_0x2a5efe]={'$like':'%'+_0x6447['query']['filter']+'%'};return _0x38dbc7;})});}_0x574f02=_[_0xfda3('0x3a')]({},_0x574f02,_0x6447[_0xfda3('0x48')]);return _0x3b430d[_0xfda3('0x45')](_0x574f02);}})['then'](function(_0x23fd20){if(_0x23fd20){_0x2f2c32=_0x23fd20['length'];if(!_0x6447[_0xfda3('0x2d')][_0xfda3('0x33')](_0xfda3('0x34'))){_0x574f02[_0xfda3('0x1a')]=qs[_0xfda3('0x1a')](_0x6447[_0xfda3('0x2d')]['limit']);_0x574f02[_0xfda3('0x18')]=qs[_0xfda3('0x18')](_0x6447[_0xfda3('0x2d')][_0xfda3('0x18')]);}return _0x3b430d[_0xfda3('0x45')](_0x574f02);}})['then'](function(_0x5e9309){if(_0x5e9309){return _0x5e9309?{'count':_0x2f2c32,'rows':_0x5e9309}:null;}})[_0xfda3('0x22')](respondWithResult(_0x322b66,null))[_0xfda3('0x42')](handleError(_0x322b66,null));};exports['addConfiguration']=function(_0x550822,_0x512d7b,_0x248174){if(_0x550822[_0xfda3('0x44')]['id']){delete _0x550822['body']['id'];}return db[_0xfda3('0x3c')][_0xfda3('0x46')]({'where':{'id':_0x550822[_0xfda3('0x3f')]['id']}})[_0xfda3('0x22')](handleEntityNotFound(_0x512d7b,null))['then'](function(_0x1cd818){if(_0x1cd818){_0x550822[_0xfda3('0x44')][_0xfda3('0x49')]=_0x1cd818['id'];_0x550822[_0xfda3('0x44')][_0xfda3('0x4a')]=integrations[_0xfda3('0x4b')](_0x550822['body']['channel'],_0x550822[_0xfda3('0x44')]['type']);_0x550822[_0xfda3('0x44')][_0xfda3('0x4c')]=integrations[_0xfda3('0x4d')](_0x550822[_0xfda3('0x44')][_0xfda3('0x4e')],_0x550822[_0xfda3('0x44')][_0xfda3('0x29')]);return db[_0xfda3('0x47')][_0xfda3('0x43')](_0x550822[_0xfda3('0x44')],{'include':[{'model':db['ZendeskField'],'as':_0xfda3('0x4a')},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})[_0xfda3('0x22')](respondWithResult(_0x512d7b,null))[_0xfda3('0x42')](handleError(_0x512d7b,null));};exports['getFields']=function(_0xa3b2e0,_0x26e1f5,_0x42e387){var _0x589c7a='';return db[_0xfda3('0x3c')][_0xfda3('0x46')]({'where':{'id':_0xa3b2e0[_0xfda3('0x3f')]['id']},'attributes':['id',_0xfda3('0x4f'),_0xfda3('0x50'),'token','authType','remoteUri']})[_0xfda3('0x22')](handleEntityNotFound(_0x26e1f5,null))[_0xfda3('0x22')](function(_0x4768dc){if(_0x4768dc){_0x589c7a=_0x4768dc[_0xfda3('0x51')];var _0x4407e8=_0x589c7a[_0xfda3('0x52')](-0x1);if(_0x4407e8==='/'){_0x589c7a=_0x589c7a['substring'](0x0,_0x589c7a[_0xfda3('0x53')](_0x4407e8));}var _0x6c5e9d={'method':_0xfda3('0x54'),'uri':util[_0xfda3('0x55')]('%s/%s',_0x589c7a,_0xfda3('0x56')),'json':!![]};switch(_0x4768dc['authType']){case _0xfda3('0x50'):_0x6c5e9d[_0xfda3('0x57')]={'Authorization':util[_0xfda3('0x55')](_0xfda3('0x58'),new Buffer(util[_0xfda3('0x55')](_0xfda3('0x59'),_0x4768dc[_0xfda3('0x4f')],_0x4768dc['password']))[_0xfda3('0x5a')](_0xfda3('0x5b')))};break;case _0xfda3('0x5c'):_0x6c5e9d[_0xfda3('0x57')]={'Authorization':util[_0xfda3('0x55')](_0xfda3('0x58'),new Buffer(util['format'](_0xfda3('0x5d'),_0x4768dc[_0xfda3('0x4f')],_0x4768dc[_0xfda3('0x5c')]))[_0xfda3('0x5a')](_0xfda3('0x5b')))};break;default:throw new db['Sequelize'][(_0xfda3('0x5e'))](_0xfda3('0x5f'));}return rp(_0x6c5e9d);}})[_0xfda3('0x22')](function(_0x42a092){if(_0x42a092){var _0xcb7ff4=[_0xfda3('0x60'),_0xfda3('0x61'),_0xfda3('0x62'),_0xfda3('0x63')];_[_0xfda3('0x64')](_0x42a092['ticket_fields'],function(_0x1c0e07){return _0xcb7ff4[_0xfda3('0x65')](_0x1c0e07[_0xfda3('0x29')]);});return{'count':_0x42a092[_0xfda3('0x56')][_0xfda3('0x40')],'rows':_['map'](_0x42a092['ticket_fields'],function(_0x232cd2){return{'id':_0x232cd2['id'],'name':_0x232cd2[_0xfda3('0x66')]>0x7?_0x232cd2[_0xfda3('0x67')]:_0x232cd2[_0xfda3('0x29')],'custom':_0x232cd2[_0xfda3('0x66')]>0x7?!![]:![],'options':_0x232cd2[_0xfda3('0x68')]?_0x232cd2[_0xfda3('0x68')]:_0x232cd2[_0xfda3('0x69')]?_0x232cd2[_0xfda3('0x69')]:[]};})};}})[_0xfda3('0x22')](respondWithResult(_0x26e1f5,null))[_0xfda3('0x42')](function(_0x593270){var _0x1ee8f4=_0xa3b2e0['query']['test']?0x1f4:_0x593270['statusCode']||0x1f4;logger[_0xfda3('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xfda3('0x6a'),_0x1ee8f4,JSON[_0xfda3('0x6b')](_0x593270));delete _0x593270['name'];if(_0x1ee8f4===0x191){_0x1ee8f4=0x190;}_0x26e1f5[_0xfda3('0x1c')](_0x1ee8f4)[_0xfda3('0x6c')](_0xa3b2e0['query'][_0xfda3('0x6d')]?{'message':'Wrong\x20credentials','statusCode':_0x593270[_0xfda3('0x6e')]}:_0x593270);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 59f8213..2527c44 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 _0xe26d=['path','rimraf','../../config/environment','ZendeskAccount','int_zendesk_accounts','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1d8739,_0x25b6dc){var _0x1a4f50=function(_0x3f4ef6){while(--_0x3f4ef6){_0x1d8739['push'](_0x1d8739['shift']());}};_0x1a4f50(++_0x25b6dc);}(_0xe26d,0x16d));var _0xde26=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe26d[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xde26('0x0'))(_0xde26('0x1'));var moment=require(_0xde26('0x2'));var BPromise=require(_0xde26('0x3'));var rp=require(_0xde26('0x4'));var fs=require('fs');var path=require(_0xde26('0x5'));var rimraf=require(_0xde26('0x6'));var config=require(_0xde26('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x1d9109,_0x19eaa8){return _0x1d9109['define'](_0xde26('0x8'),attributes,{'tableName':_0xde26('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x349d=['ZendeskAccount','int_zendesk_accounts','../../config/logger','moment','bluebird','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x349d,0x160));var _0xd349=function(_0x41054b,_0xe82034){_0x41054b=_0x41054b-0x0;var _0x468e13=_0x349d[_0x41054b];return _0x468e13;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd349('0x0'))('api');var moment=require(_0xd349('0x1'));var BPromise=require(_0xd349('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd349('0x3'));var config=require(_0xd349('0x4'));var attributes=require(_0xd349('0x5'));var integrations=require(_0xd349('0x6'));module['exports']=function(_0x511235,_0x345aa2){return _0x511235[_0xd349('0x7')](_0xd349('0x8'),attributes,{'tableName':_0xd349('0x9'),'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 f521f37..c90ab48 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 _0x8f5d=['findAll','raw','options','include','map','model','attributes','find','where','ShowZendeskAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount'];(function(_0x219e9b,_0x295d91){var _0x332e80=function(_0x567792){while(--_0x567792){_0x219e9b['push'](_0x219e9b['shift']());}};_0x332e80(++_0x295d91);}(_0x8f5d,0xd6));var _0xd8f5=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x8f5d[_0x40a825];return _0x273a54;};'use strict';var _=require(_0xd8f5('0x0'));var util=require('util');var moment=require(_0xd8f5('0x1'));var BPromise=require(_0xd8f5('0x2'));var rs=require(_0xd8f5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd8f5('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd8f5('0x5'));var jayson=require(_0xd8f5('0x6'));var client=jayson[_0xd8f5('0x7')][_0xd8f5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x27c47a,_0x69d4d6,_0x55c684){return new BPromise(function(_0xac375c,_0x269693){return client[_0xd8f5('0x9')](_0x27c47a,_0x55c684)[_0xd8f5('0xa')](function(_0x3d3ba0){logger[_0xd8f5('0xb')](_0xd8f5('0xc'),_0x69d4d6,'request\x20sent');logger[_0xd8f5('0xd')](_0xd8f5('0xe'),_0x69d4d6,_0xd8f5('0xf'),JSON[_0xd8f5('0x10')](_0x3d3ba0));if(_0x3d3ba0[_0xd8f5('0x11')]){if(_0x3d3ba0[_0xd8f5('0x11')][_0xd8f5('0x12')]===0x1f4){logger[_0xd8f5('0x11')](_0xd8f5('0xc'),_0x69d4d6,_0x3d3ba0[_0xd8f5('0x11')][_0xd8f5('0x13')]);return _0x269693(_0x3d3ba0[_0xd8f5('0x11')][_0xd8f5('0x13')]);}logger[_0xd8f5('0x11')](_0xd8f5('0xc'),_0x69d4d6,_0x3d3ba0['error'][_0xd8f5('0x13')]);return _0xac375c(_0x3d3ba0[_0xd8f5('0x11')][_0xd8f5('0x13')]);}else{logger['info'](_0xd8f5('0xc'),_0x69d4d6,_0xd8f5('0xf'));_0xac375c(_0x3d3ba0[_0xd8f5('0x14')][_0xd8f5('0x13')]);}})[_0xd8f5('0x15')](function(_0x1cb10c){logger[_0xd8f5('0x11')](_0xd8f5('0xc'),_0x69d4d6,_0x1cb10c);_0x269693(_0x1cb10c);});});}exports[_0xd8f5('0x16')]=function(_0x46f558){var _0x154986=this;return new Promise(function(_0x2584a5,_0xf35e96){return db[_0xd8f5('0x17')][_0xd8f5('0x18')]({'raw':_0x46f558['options']?_0x46f558['options'][_0xd8f5('0x19')]===undefined?!![]:![]:!![],'where':_0x46f558['options']?_0x46f558[_0xd8f5('0x1a')]['where']||null:null,'attributes':_0x46f558[_0xd8f5('0x1a')]?_0x46f558[_0xd8f5('0x1a')]['attributes']||null:null,'limit':_0x46f558[_0xd8f5('0x1a')]?_0x46f558[_0xd8f5('0x1a')]['limit']||null:null,'include':_0x46f558[_0xd8f5('0x1a')]?_0x46f558[_0xd8f5('0x1a')][_0xd8f5('0x1b')]?_[_0xd8f5('0x1c')](_0x46f558['options'][_0xd8f5('0x1b')],function(_0x2c53a9){return{'model':db[_0x2c53a9[_0xd8f5('0x1d')]],'as':_0x2c53a9['as'],'attributes':_0x2c53a9['attributes'],'include':_0x2c53a9[_0xd8f5('0x1b')]?_['map'](_0x2c53a9['include'],function(_0x40c4c5){return{'model':db[_0x40c4c5['model']],'as':_0x40c4c5['as'],'attributes':_0x40c4c5[_0xd8f5('0x1e')],'include':_0x40c4c5[_0xd8f5('0x1b')]?_[_0xd8f5('0x1c')](_0x40c4c5[_0xd8f5('0x1b')],function(_0x30dc02){return{'model':db[_0x30dc02[_0xd8f5('0x1d')]],'as':_0x30dc02['as'],'attributes':_0x30dc02[_0xd8f5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd8f5('0xa')](function(_0x40f0a7){logger[_0xd8f5('0xb')](_0xd8f5('0x16'),_0x46f558);logger[_0xd8f5('0xd')]('GetZendeskAccount',_0x46f558,JSON[_0xd8f5('0x10')](_0x40f0a7));_0x2584a5(_0x40f0a7);})['catch'](function(_0x55f79d){logger[_0xd8f5('0x11')](_0xd8f5('0x16'),_0x55f79d[_0xd8f5('0x13')],_0x46f558);_0xf35e96(_0x154986['error'](0x1f4,_0x55f79d[_0xd8f5('0x13')]));});});};exports['ShowZendeskAccount']=function(_0x462a38){var _0x1fade0=this;return new Promise(function(_0x1a9542,_0x5f0571){return db[_0xd8f5('0x17')][_0xd8f5('0x1f')]({'raw':_0x462a38['options']?_0x462a38['options']['raw']===undefined?!![]:![]:!![],'where':_0x462a38[_0xd8f5('0x1a')]?_0x462a38[_0xd8f5('0x1a')][_0xd8f5('0x20')]||null:null,'attributes':_0x462a38['options']?_0x462a38[_0xd8f5('0x1a')][_0xd8f5('0x1e')]||null:null,'include':_0x462a38[_0xd8f5('0x1a')]?_0x462a38[_0xd8f5('0x1a')][_0xd8f5('0x1b')]?_[_0xd8f5('0x1c')](_0x462a38[_0xd8f5('0x1a')]['include'],function(_0x350eb4){return{'model':db[_0x350eb4[_0xd8f5('0x1d')]],'as':_0x350eb4['as'],'attributes':_0x350eb4[_0xd8f5('0x1e')],'include':_0x350eb4[_0xd8f5('0x1b')]?_['map'](_0x350eb4[_0xd8f5('0x1b')],function(_0x167119){return{'model':db[_0x167119['model']],'as':_0x167119['as'],'attributes':_0x167119[_0xd8f5('0x1e')],'include':_0x167119[_0xd8f5('0x1b')]?_['map'](_0x167119['include'],function(_0x53b4a0){return{'model':db[_0x53b4a0[_0xd8f5('0x1d')]],'as':_0x53b4a0['as'],'attributes':_0x53b4a0[_0xd8f5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd8f5('0xa')](function(_0x11068e){logger[_0xd8f5('0xb')](_0xd8f5('0x21'),_0x462a38);logger['debug'](_0xd8f5('0x21'),_0x462a38,JSON[_0xd8f5('0x10')](_0x11068e));_0x1a9542(_0x11068e);})[_0xd8f5('0x15')](function(_0x45a5c2){logger['error']('ShowZendeskAccount',_0x45a5c2[_0xd8f5('0x13')],_0x462a38);_0x5f0571(_0x1fade0[_0xd8f5('0x11')](0x1f4,_0x45a5c2[_0xd8f5('0x13')]));});});}; \ No newline at end of file +var _0x287e=['message','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','model','map','catch','ShowZendeskAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4c5273,_0x2c7807){var _0x5a5f96=function(_0x314f28){while(--_0x314f28){_0x4c5273['push'](_0x4c5273['shift']());}};_0x5a5f96(++_0x2c7807);}(_0x287e,0x1e3));var _0xe287=function(_0x2ee01f,_0x6a6706){_0x2ee01f=_0x2ee01f-0x0;var _0x5d4f76=_0x287e[_0x2ee01f];return _0x5d4f76;};'use strict';var _=require(_0xe287('0x0'));var util=require(_0xe287('0x1'));var moment=require(_0xe287('0x2'));var BPromise=require(_0xe287('0x3'));var rs=require(_0xe287('0x4'));var fs=require('fs');var Redis=require(_0xe287('0x5'));var db=require(_0xe287('0x6'))['db'];var utils=require(_0xe287('0x7'));var logger=require(_0xe287('0x8'))('rpc');var config=require(_0xe287('0x9'));var jayson=require(_0xe287('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38bd18,_0x482170,_0x4f3cf1){return new BPromise(function(_0x4cd1f4,_0x2082c6){return client[_0xe287('0xb')](_0x38bd18,_0x4f3cf1)[_0xe287('0xc')](function(_0x3b1a68){logger[_0xe287('0xd')](_0xe287('0xe'),_0x482170,_0xe287('0xf'));logger[_0xe287('0x10')](_0xe287('0x11'),_0x482170,_0xe287('0xf'),JSON[_0xe287('0x12')](_0x3b1a68));if(_0x3b1a68[_0xe287('0x13')]){if(_0x3b1a68['error'][_0xe287('0x14')]===0x1f4){logger['error'](_0xe287('0xe'),_0x482170,_0x3b1a68['error'][_0xe287('0x15')]);return _0x2082c6(_0x3b1a68['error'][_0xe287('0x15')]);}logger[_0xe287('0x13')](_0xe287('0xe'),_0x482170,_0x3b1a68[_0xe287('0x13')][_0xe287('0x15')]);return _0x4cd1f4(_0x3b1a68['error'][_0xe287('0x15')]);}else{logger['info'](_0xe287('0xe'),_0x482170,_0xe287('0xf'));_0x4cd1f4(_0x3b1a68['result'][_0xe287('0x15')]);}})['catch'](function(_0x5961c6){logger[_0xe287('0x13')](_0xe287('0xe'),_0x482170,_0x5961c6);_0x2082c6(_0x5961c6);});});}exports[_0xe287('0x16')]=function(_0x5ece64){var _0x2c4ef3=this;return new Promise(function(_0x54c679,_0x5ea865){return db[_0xe287('0x17')][_0xe287('0x18')]({'raw':_0x5ece64['options']?_0x5ece64[_0xe287('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5ece64[_0xe287('0x19')]?_0x5ece64[_0xe287('0x19')][_0xe287('0x1a')]||null:null,'attributes':_0x5ece64['options']?_0x5ece64[_0xe287('0x19')][_0xe287('0x1b')]||null:null,'limit':_0x5ece64[_0xe287('0x19')]?_0x5ece64[_0xe287('0x19')][_0xe287('0x1c')]||null:null,'include':_0x5ece64[_0xe287('0x19')]?_0x5ece64[_0xe287('0x19')][_0xe287('0x1d')]?_['map'](_0x5ece64[_0xe287('0x19')][_0xe287('0x1d')],function(_0x5b6585){return{'model':db[_0x5b6585[_0xe287('0x1e')]],'as':_0x5b6585['as'],'attributes':_0x5b6585['attributes'],'include':_0x5b6585[_0xe287('0x1d')]?_[_0xe287('0x1f')](_0x5b6585[_0xe287('0x1d')],function(_0x4ff2ee){return{'model':db[_0x4ff2ee['model']],'as':_0x4ff2ee['as'],'attributes':_0x4ff2ee[_0xe287('0x1b')],'include':_0x4ff2ee[_0xe287('0x1d')]?_[_0xe287('0x1f')](_0x4ff2ee[_0xe287('0x1d')],function(_0x13905f){return{'model':db[_0x13905f[_0xe287('0x1e')]],'as':_0x13905f['as'],'attributes':_0x13905f[_0xe287('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe287('0xc')](function(_0x55c97a){logger[_0xe287('0xd')]('GetZendeskAccount',_0x5ece64);logger[_0xe287('0x10')](_0xe287('0x16'),_0x5ece64,JSON['stringify'](_0x55c97a));_0x54c679(_0x55c97a);})[_0xe287('0x20')](function(_0x2e5a9a){logger[_0xe287('0x13')](_0xe287('0x16'),_0x2e5a9a['message'],_0x5ece64);_0x5ea865(_0x2c4ef3[_0xe287('0x13')](0x1f4,_0x2e5a9a[_0xe287('0x15')]));});});};exports[_0xe287('0x21')]=function(_0x5c93b8){var _0x811e53=this;return new Promise(function(_0x27c25b,_0x45a57c){return db['ZendeskAccount'][_0xe287('0x22')]({'raw':_0x5c93b8[_0xe287('0x19')]?_0x5c93b8[_0xe287('0x19')][_0xe287('0x23')]===undefined?!![]:![]:!![],'where':_0x5c93b8[_0xe287('0x19')]?_0x5c93b8[_0xe287('0x19')]['where']||null:null,'attributes':_0x5c93b8[_0xe287('0x19')]?_0x5c93b8['options'][_0xe287('0x1b')]||null:null,'include':_0x5c93b8['options']?_0x5c93b8[_0xe287('0x19')][_0xe287('0x1d')]?_[_0xe287('0x1f')](_0x5c93b8[_0xe287('0x19')]['include'],function(_0x519288){return{'model':db[_0x519288[_0xe287('0x1e')]],'as':_0x519288['as'],'attributes':_0x519288[_0xe287('0x1b')],'include':_0x519288['include']?_['map'](_0x519288['include'],function(_0x52465f){return{'model':db[_0x52465f['model']],'as':_0x52465f['as'],'attributes':_0x52465f[_0xe287('0x1b')],'include':_0x52465f[_0xe287('0x1d')]?_[_0xe287('0x1f')](_0x52465f[_0xe287('0x1d')],function(_0x725c0e){return{'model':db[_0x725c0e[_0xe287('0x1e')]],'as':_0x725c0e['as'],'attributes':_0x725c0e['attributes']};}):[]};}):[]};}):[]:[]})[_0xe287('0xc')](function(_0x444b87){logger[_0xe287('0xd')]('ShowZendeskAccount',_0x5c93b8);logger[_0xe287('0x10')](_0xe287('0x21'),_0x5c93b8,JSON[_0xe287('0x12')](_0x444b87));_0x27c25b(_0x444b87);})[_0xe287('0x20')](function(_0x49d930){logger[_0xe287('0x13')](_0xe287('0x21'),_0x49d930[_0xe287('0x15')],_0x5c93b8);_0x45a57c(_0x811e53[_0xe287('0x13')](0x1f4,_0x49d930[_0xe287('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 00932fe..d5073e7 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 _0xb10b=['getFields','/:id/subjects','/:id/descriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','isAuthenticated','show','/:id/fields'];(function(_0x24cb79,_0x3afb04){var _0x426bc2=function(_0x59e440){while(--_0x59e440){_0x24cb79['push'](_0x24cb79['shift']());}};_0x426bc2(++_0x3afb04);}(_0xb10b,0x12a));var _0xbb10=function(_0xd2a568,_0x4e8606){_0xd2a568=_0xd2a568-0x0;var _0x4cf0ba=_0xb10b[_0xd2a568];return _0x4cf0ba;};'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['getSubjects']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getDescriptions']);router[_0xbb10('0x9')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x12')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router[_0xbb10('0x12')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x15')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x19')]);module['exports']=router; \ No newline at end of file +var _0x5c00=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/tags','post','create','setTags','put','/:id','delete','destroy','exports','multer','util'];(function(_0x3e8fbe,_0x232881){var _0xc50bfa=function(_0x5b0071){while(--_0x5b0071){_0x3e8fbe['push'](_0x3e8fbe['shift']());}};_0xc50bfa(++_0x232881);}(_0x5c00,0x17e));var _0x05c0=function(_0x215e8e,_0x2e9b00){_0x215e8e=_0x215e8e-0x0;var _0x43ce3b=_0x5c00[_0x215e8e];return _0x43ce3b;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var fs_extra=require(_0x05c0('0x4'));var auth=require(_0x05c0('0x5'));var interaction=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var controller=require('./intZendeskConfiguration.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0x8')]('/:id/fields',auth[_0x05c0('0x9')](),controller[_0x05c0('0xc')]);router[_0x05c0('0x8')](_0x05c0('0xd'),auth[_0x05c0('0x9')](),controller[_0x05c0('0xe')]);router['get']('/:id/descriptions',auth[_0x05c0('0x9')](),controller['getDescriptions']);router[_0x05c0('0x8')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller['getTags']);router[_0x05c0('0x10')]('/',auth['isAuthenticated'](),controller[_0x05c0('0x11')]);router[_0x05c0('0x10')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x12')]);router[_0x05c0('0x13')](_0x05c0('0x14'),auth[_0x05c0('0x9')](),controller['update']);router[_0x05c0('0x15')](_0x05c0('0x14'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x16')]);module[_0x05c0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 18c59fb..1f6a147 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 _0x16e0=['exports','STRING','sequelize'];(function(_0xf89c3,_0x351bf1){var _0x274fc8=function(_0x5e0c91){while(--_0x5e0c91){_0xf89c3['push'](_0xf89c3['shift']());}};_0x274fc8(++_0x351bf1);}(_0x16e0,0x164));var _0x016e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x16e0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x016e('0x0'));module[_0x016e('0x1')]={'name':{'type':Sequelize[_0x016e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2b70=['sequelize'];(function(_0x2f50a8,_0x3d7260){var _0x41231b=function(_0x2a1452){while(--_0x2a1452){_0x2f50a8['push'](_0x2f50a8['shift']());}};_0x41231b(++_0x3d7260);}(_0x2b70,0x127));var _0x02b7=function(_0x5bc69d,_0x25137d){_0x5bc69d=_0x5bc69d-0x0;var _0x154d9c=_0x2b70[_0x5bc69d];return _0x154d9c;};'use strict';var Sequelize=require(_0x02b7('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index d45a720..f679d63 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 _0xe957=['apply','reject','update','then','destroy','stack','name','map','fieldName','type','key','model','query','keys','intersection','fields','attributes','nolimit','order','sort','where','pick','filters','merge','filter','options','ZendeskConfiguration','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','catch','create','body','getFields','findOne','ZendeskField','getSubjects','getDescriptions','hasOwnProperty','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range'];(function(_0x1f3d83,_0x5199ea){var _0x2c4e68=function(_0x245c3b){while(--_0x245c3b){_0x1f3d83['push'](_0x1f3d83['shift']());}};_0x2c4e68(++_0x5199ea);}(_0xe957,0x83));var _0x7e95=function(_0x32f7b2,_0x309458){_0x32f7b2=_0x32f7b2-0x0;var _0xcbb024=_0xe957[_0x32f7b2];return _0xcbb024;};'use strict';var emlformat=require(_0x7e95('0x0'));var rimraf=require(_0x7e95('0x1'));var zipdir=require(_0x7e95('0x2'));var jsonpatch=require(_0x7e95('0x3'));var rp=require(_0x7e95('0x4'));var moment=require(_0x7e95('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7e95('0x6'));var path=require(_0x7e95('0x7'));var sox=require(_0x7e95('0x8'));var csv=require(_0x7e95('0x9'));var ejs=require(_0x7e95('0xa'));var fs=require('fs');var fs_extra=require(_0x7e95('0xb'));var _=require('lodash');var squel=require(_0x7e95('0xc'));var crypto=require(_0x7e95('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7e95('0xe'));var toCsv=require(_0x7e95('0x9'));var querystring=require('querystring');var Papa=require(_0x7e95('0xf'));var Redis=require(_0x7e95('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7e95('0x11'));var as=require(_0x7e95('0x12'));var hardwareService=require(_0x7e95('0x13'));var logger=require(_0x7e95('0x14'))(_0x7e95('0x15'));var utils=require('../../config/utils');var config=require(_0x7e95('0x16'));var licenseUtil=require(_0x7e95('0x17'));var db=require(_0x7e95('0x18'))['db'];function respondWithStatusCode(_0x572d65,_0x3cba92){_0x3cba92=_0x3cba92||0xcc;return function(_0x3a3aec){if(_0x3a3aec){return _0x572d65[_0x7e95('0x19')](_0x3cba92);}return _0x572d65[_0x7e95('0x1a')](_0x3cba92)['end']();};}function respondWithResult(_0x271fde,_0x38fe1e){_0x38fe1e=_0x38fe1e||0xc8;return function(_0xb74507){if(_0xb74507){return _0x271fde[_0x7e95('0x1a')](_0x38fe1e)[_0x7e95('0x1b')](_0xb74507);}};}function respondWithFilteredResult(_0x3fce0c,_0x3e9b7){return function(_0x902fa7){if(_0x902fa7){var _0x16558a=typeof _0x3e9b7[_0x7e95('0x1c')]==='undefined'&&typeof _0x3e9b7[_0x7e95('0x1d')]==='undefined';var _0x107d17=_0x902fa7[_0x7e95('0x1e')];var _0xab8895=_0x16558a?0x0:_0x3e9b7['offset'];var _0x5285df=_0x16558a?_0x902fa7[_0x7e95('0x1e')]:_0x3e9b7[_0x7e95('0x1c')]+_0x3e9b7[_0x7e95('0x1d')];var _0x4d09e2;if(_0x5285df>=_0x107d17){_0x5285df=_0x107d17;_0x4d09e2=0xc8;}else{_0x4d09e2=0xce;}_0x3fce0c[_0x7e95('0x1a')](_0x4d09e2);return _0x3fce0c[_0x7e95('0x1f')](_0x7e95('0x20'),_0xab8895+'-'+_0x5285df+'/'+_0x107d17)[_0x7e95('0x1b')](_0x902fa7);}return null;};}function patchUpdates(_0x35dc2b){return function(_0x94eb93){try{jsonpatch[_0x7e95('0x21')](_0x94eb93,_0x35dc2b,!![]);}catch(_0x3f2539){return BPromise[_0x7e95('0x22')](_0x3f2539);}return _0x94eb93['save']();};}function saveUpdates(_0x3a513a,_0x469e17){return function(_0x5cae62){if(_0x5cae62){return _0x5cae62[_0x7e95('0x23')](_0x3a513a)[_0x7e95('0x24')](function(_0x5539e5){return _0x5539e5;});}return null;};}function removeEntity(_0x3894dc,_0x516d3a){return function(_0x1c4f0c){if(_0x1c4f0c){return _0x1c4f0c[_0x7e95('0x25')]()[_0x7e95('0x24')](function(){_0x3894dc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c9818,_0x4eeece){return function(_0x5cd828){if(!_0x5cd828){_0x2c9818[_0x7e95('0x19')](0x194);}return _0x5cd828;};}function handleError(_0x184f1f,_0x231d4b){_0x231d4b=_0x231d4b||0x1f4;return function(_0x2e6db5){logger['error'](_0x2e6db5[_0x7e95('0x26')]);if(_0x2e6db5[_0x7e95('0x27')]){delete _0x2e6db5['name'];}_0x184f1f[_0x7e95('0x1a')](_0x231d4b)['send'](_0x2e6db5);};}exports['index']=function(_0x47c889,_0x1f6f96){var _0x505b53={},_0x2dc552={},_0x3a233f={'count':0x0,'rows':[]};var _0xaceb4f=_[_0x7e95('0x28')](db['ZendeskConfiguration']['rawAttributes'],function(_0xe6d5e2){return{'name':_0xe6d5e2[_0x7e95('0x29')],'type':_0xe6d5e2[_0x7e95('0x2a')][_0x7e95('0x2b')]};});_0x2dc552[_0x7e95('0x2c')]=_['map'](_0xaceb4f,_0x7e95('0x27'));_0x2dc552[_0x7e95('0x2d')]=_[_0x7e95('0x2e')](_0x47c889['query']);_0x2dc552['filters']=_[_0x7e95('0x2f')](_0x2dc552['model'],_0x2dc552['query']);_0x505b53['attributes']=_[_0x7e95('0x2f')](_0x2dc552[_0x7e95('0x2c')],qs[_0x7e95('0x30')](_0x47c889['query']['fields']));_0x505b53['attributes']=_0x505b53[_0x7e95('0x31')]['length']?_0x505b53[_0x7e95('0x31')]:_0x2dc552[_0x7e95('0x2c')];if(!_0x47c889['query']['hasOwnProperty'](_0x7e95('0x32'))){_0x505b53[_0x7e95('0x1d')]=qs[_0x7e95('0x1d')](_0x47c889['query'][_0x7e95('0x1d')]);_0x505b53[_0x7e95('0x1c')]=qs['offset'](_0x47c889['query']['offset']);}_0x505b53[_0x7e95('0x33')]=qs['sort'](_0x47c889[_0x7e95('0x2d')][_0x7e95('0x34')]);_0x505b53[_0x7e95('0x35')]=qs['filters'](_[_0x7e95('0x36')](_0x47c889['query'],_0x2dc552[_0x7e95('0x37')]),_0xaceb4f);if(_0x47c889[_0x7e95('0x2d')]['filter']){_0x505b53[_0x7e95('0x35')]=_[_0x7e95('0x38')](_0x505b53[_0x7e95('0x35')],{'$or':_[_0x7e95('0x28')](_0xaceb4f,function(_0x1691ae){if(_0x1691ae[_0x7e95('0x2a')]!=='VIRTUAL'){var _0x160aae={};_0x160aae[_0x1691ae[_0x7e95('0x27')]]={'$like':'%'+_0x47c889[_0x7e95('0x2d')][_0x7e95('0x39')]+'%'};return _0x160aae;}})});}_0x505b53=_['merge']({},_0x505b53,_0x47c889[_0x7e95('0x3a')]);var _0x4998a3={'where':_0x505b53[_0x7e95('0x35')]};return db[_0x7e95('0x3b')][_0x7e95('0x1e')](_0x4998a3)[_0x7e95('0x24')](function(_0x19fded){_0x3a233f['count']=_0x19fded;if(_0x47c889[_0x7e95('0x2d')][_0x7e95('0x3c')]){_0x505b53[_0x7e95('0x3d')]=[{'all':!![]}];}return db[_0x7e95('0x3b')][_0x7e95('0x3e')](_0x505b53);})[_0x7e95('0x24')](function(_0x2639a9){_0x3a233f[_0x7e95('0x3f')]=_0x2639a9;return _0x3a233f;})[_0x7e95('0x24')](respondWithFilteredResult(_0x1f6f96,_0x505b53))['catch'](handleError(_0x1f6f96,null));};exports[_0x7e95('0x40')]=function(_0x4e93c7,_0x23e21c){var _0x2286ee={'raw':![],'where':{'id':_0x4e93c7[_0x7e95('0x41')]['id']}},_0x3c95f9={};_0x3c95f9['model']=_['keys'](db[_0x7e95('0x3b')][_0x7e95('0x42')]);_0x3c95f9[_0x7e95('0x2d')]=_[_0x7e95('0x2e')](_0x4e93c7[_0x7e95('0x2d')]);_0x3c95f9['filters']=_[_0x7e95('0x2f')](_0x3c95f9[_0x7e95('0x2c')],_0x3c95f9['query']);_0x2286ee[_0x7e95('0x31')]=_[_0x7e95('0x2f')](_0x3c95f9['model'],qs['fields'](_0x4e93c7[_0x7e95('0x2d')][_0x7e95('0x30')]));_0x2286ee['attributes']=_0x2286ee[_0x7e95('0x31')][_0x7e95('0x43')]?_0x2286ee['attributes']:_0x3c95f9['model'];if(_0x4e93c7[_0x7e95('0x2d')][_0x7e95('0x3c')]){_0x2286ee[_0x7e95('0x3d')]=[{'all':!![]}];}_0x2286ee=_[_0x7e95('0x38')]({},_0x2286ee,_0x4e93c7[_0x7e95('0x3a')]);return db['ZendeskConfiguration'][_0x7e95('0x44')](_0x2286ee)[_0x7e95('0x24')](handleEntityNotFound(_0x23e21c,null))[_0x7e95('0x24')](respondWithResult(_0x23e21c,null))[_0x7e95('0x45')](handleError(_0x23e21c,null));};exports[_0x7e95('0x46')]=function(_0x30a442,_0x3d0845){return db[_0x7e95('0x3b')]['create'](_0x30a442[_0x7e95('0x47')],{})[_0x7e95('0x24')](respondWithResult(_0x3d0845,0xc9))[_0x7e95('0x45')](handleError(_0x3d0845,null));};exports[_0x7e95('0x23')]=function(_0x3a785f,_0x197ec0){if(_0x3a785f[_0x7e95('0x47')]['id']){delete _0x3a785f[_0x7e95('0x47')]['id'];}return db[_0x7e95('0x3b')][_0x7e95('0x44')]({'where':{'id':_0x3a785f['params']['id']}})[_0x7e95('0x24')](handleEntityNotFound(_0x197ec0,null))[_0x7e95('0x24')](saveUpdates(_0x3a785f['body'],null))[_0x7e95('0x24')](respondWithResult(_0x197ec0,null))[_0x7e95('0x45')](handleError(_0x197ec0,null));};exports[_0x7e95('0x25')]=function(_0xaf0406,_0xe0ade7){return db[_0x7e95('0x3b')][_0x7e95('0x44')]({'where':{'id':_0xaf0406[_0x7e95('0x41')]['id']}})[_0x7e95('0x24')](handleEntityNotFound(_0xe0ade7,null))[_0x7e95('0x24')](removeEntity(_0xe0ade7,null))[_0x7e95('0x45')](handleError(_0xe0ade7,null));};exports[_0x7e95('0x48')]=function(_0x11c6d1,_0x39d16d,_0x46b0f3){var _0x2a1c7f={};var _0x5d0446={};var _0xf76381;var _0x5e699b;return db[_0x7e95('0x3b')][_0x7e95('0x49')]({'where':{'id':_0x11c6d1[_0x7e95('0x41')]['id']}})[_0x7e95('0x24')](handleEntityNotFound(_0x39d16d,null))[_0x7e95('0x24')](function(_0x16598d){if(_0x16598d){_0xf76381=_0x16598d;_0x5d0446['model']=_[_0x7e95('0x2e')](db[_0x7e95('0x4a')][_0x7e95('0x42')]);_0x5d0446['query']=_[_0x7e95('0x2e')](_0x11c6d1[_0x7e95('0x2d')]);_0x5d0446['filters']=_[_0x7e95('0x2f')](_0x5d0446[_0x7e95('0x2c')],_0x5d0446[_0x7e95('0x2d')]);_0x2a1c7f[_0x7e95('0x31')]=_[_0x7e95('0x2f')](_0x5d0446[_0x7e95('0x2c')],qs[_0x7e95('0x30')](_0x11c6d1['query'][_0x7e95('0x30')]));_0x2a1c7f[_0x7e95('0x31')]=_0x2a1c7f[_0x7e95('0x31')][_0x7e95('0x43')]?_0x2a1c7f[_0x7e95('0x31')]:_0x5d0446[_0x7e95('0x2c')];_0x2a1c7f[_0x7e95('0x33')]=qs['sort'](_0x11c6d1[_0x7e95('0x2d')][_0x7e95('0x34')]);_0x2a1c7f[_0x7e95('0x35')]=qs[_0x7e95('0x37')](_[_0x7e95('0x36')](_0x11c6d1[_0x7e95('0x2d')],_0x5d0446[_0x7e95('0x37')]));if(_0x11c6d1['query'][_0x7e95('0x39')]){_0x2a1c7f[_0x7e95('0x35')]=_['merge'](_0x2a1c7f[_0x7e95('0x35')],{'$or':_[_0x7e95('0x28')](_0x2a1c7f[_0x7e95('0x31')],function(_0x1ac41a){var _0x4dc59c={};_0x4dc59c[_0x1ac41a]={'$like':'%'+_0x11c6d1[_0x7e95('0x2d')][_0x7e95('0x39')]+'%'};return _0x4dc59c;})});}_0x2a1c7f=_[_0x7e95('0x38')]({},_0x2a1c7f,_0x11c6d1[_0x7e95('0x3a')]);return _0xf76381[_0x7e95('0x48')](_0x2a1c7f);}})[_0x7e95('0x24')](function(_0x119214){if(_0x119214){_0x5e699b=_0x119214['length'];if(!_0x11c6d1[_0x7e95('0x2d')]['hasOwnProperty'](_0x7e95('0x32'))){_0x2a1c7f[_0x7e95('0x1d')]=qs[_0x7e95('0x1d')](_0x11c6d1[_0x7e95('0x2d')]['limit']);_0x2a1c7f[_0x7e95('0x1c')]=qs[_0x7e95('0x1c')](_0x11c6d1[_0x7e95('0x2d')][_0x7e95('0x1c')]);}return _0xf76381['getFields'](_0x2a1c7f);}})[_0x7e95('0x24')](function(_0x50ca94){if(_0x50ca94){return _0x50ca94?{'count':_0x5e699b,'rows':_0x50ca94}:null;}})[_0x7e95('0x24')](respondWithResult(_0x39d16d,null))[_0x7e95('0x45')](handleError(_0x39d16d,null));};exports[_0x7e95('0x4b')]=function(_0x2f70e5,_0x13f46b,_0x2f65c0){var _0x137a00={};var _0x1ae811={};var _0x151711;var _0x26350b;return db[_0x7e95('0x3b')][_0x7e95('0x49')]({'where':{'id':_0x2f70e5[_0x7e95('0x41')]['id']}})[_0x7e95('0x24')](handleEntityNotFound(_0x13f46b,null))[_0x7e95('0x24')](function(_0x17a4c){if(_0x17a4c){_0x151711=_0x17a4c;_0x1ae811['model']=_['keys'](db[_0x7e95('0x4a')]['rawAttributes']);_0x1ae811['query']=_[_0x7e95('0x2e')](_0x2f70e5[_0x7e95('0x2d')]);_0x1ae811[_0x7e95('0x37')]=_[_0x7e95('0x2f')](_0x1ae811['model'],_0x1ae811[_0x7e95('0x2d')]);_0x137a00[_0x7e95('0x31')]=_[_0x7e95('0x2f')](_0x1ae811[_0x7e95('0x2c')],qs[_0x7e95('0x30')](_0x2f70e5[_0x7e95('0x2d')][_0x7e95('0x30')]));_0x137a00[_0x7e95('0x31')]=_0x137a00[_0x7e95('0x31')][_0x7e95('0x43')]?_0x137a00[_0x7e95('0x31')]:_0x1ae811[_0x7e95('0x2c')];_0x137a00['order']=qs[_0x7e95('0x34')](_0x2f70e5[_0x7e95('0x2d')][_0x7e95('0x34')]);_0x137a00[_0x7e95('0x35')]=qs[_0x7e95('0x37')](_[_0x7e95('0x36')](_0x2f70e5[_0x7e95('0x2d')],_0x1ae811[_0x7e95('0x37')]));if(_0x2f70e5['query'][_0x7e95('0x39')]){_0x137a00[_0x7e95('0x35')]=_['merge'](_0x137a00[_0x7e95('0x35')],{'$or':_[_0x7e95('0x28')](_0x137a00[_0x7e95('0x31')],function(_0x542536){var _0x2cc703={};_0x2cc703[_0x542536]={'$like':'%'+_0x2f70e5[_0x7e95('0x2d')]['filter']+'%'};return _0x2cc703;})});}_0x137a00=_['merge']({},_0x137a00,_0x2f70e5[_0x7e95('0x3a')]);return _0x151711[_0x7e95('0x4b')](_0x137a00);}})['then'](function(_0x182e03){if(_0x182e03){_0x26350b=_0x182e03['length'];if(!_0x2f70e5[_0x7e95('0x2d')]['hasOwnProperty'](_0x7e95('0x32'))){_0x137a00[_0x7e95('0x1d')]=qs[_0x7e95('0x1d')](_0x2f70e5[_0x7e95('0x2d')]['limit']);_0x137a00[_0x7e95('0x1c')]=qs['offset'](_0x2f70e5[_0x7e95('0x2d')][_0x7e95('0x1c')]);}return _0x151711['getSubjects'](_0x137a00);}})[_0x7e95('0x24')](function(_0x2cc7ac){if(_0x2cc7ac){return _0x2cc7ac?{'count':_0x26350b,'rows':_0x2cc7ac}:null;}})[_0x7e95('0x24')](respondWithResult(_0x13f46b,null))[_0x7e95('0x45')](handleError(_0x13f46b,null));};exports[_0x7e95('0x4c')]=function(_0x1ee625,_0x499d7e,_0x12a25d){var _0x4f006b={};var _0x315fb4={};var _0x1ae96a;var _0xa4075e;return db[_0x7e95('0x3b')][_0x7e95('0x49')]({'where':{'id':_0x1ee625[_0x7e95('0x41')]['id']}})[_0x7e95('0x24')](handleEntityNotFound(_0x499d7e,null))['then'](function(_0x193afe){if(_0x193afe){_0x1ae96a=_0x193afe;_0x315fb4[_0x7e95('0x2c')]=_['keys'](db['ZendeskField'][_0x7e95('0x42')]);_0x315fb4[_0x7e95('0x2d')]=_['keys'](_0x1ee625['query']);_0x315fb4[_0x7e95('0x37')]=_['intersection'](_0x315fb4[_0x7e95('0x2c')],_0x315fb4['query']);_0x4f006b[_0x7e95('0x31')]=_[_0x7e95('0x2f')](_0x315fb4[_0x7e95('0x2c')],qs[_0x7e95('0x30')](_0x1ee625[_0x7e95('0x2d')][_0x7e95('0x30')]));_0x4f006b[_0x7e95('0x31')]=_0x4f006b[_0x7e95('0x31')][_0x7e95('0x43')]?_0x4f006b[_0x7e95('0x31')]:_0x315fb4[_0x7e95('0x2c')];_0x4f006b[_0x7e95('0x33')]=qs[_0x7e95('0x34')](_0x1ee625[_0x7e95('0x2d')][_0x7e95('0x34')]);_0x4f006b[_0x7e95('0x35')]=qs['filters'](_[_0x7e95('0x36')](_0x1ee625[_0x7e95('0x2d')],_0x315fb4[_0x7e95('0x37')]));if(_0x1ee625[_0x7e95('0x2d')]['filter']){_0x4f006b['where']=_['merge'](_0x4f006b[_0x7e95('0x35')],{'$or':_[_0x7e95('0x28')](_0x4f006b[_0x7e95('0x31')],function(_0x2ac734){var _0x2b7d9d={};_0x2b7d9d[_0x2ac734]={'$like':'%'+_0x1ee625['query'][_0x7e95('0x39')]+'%'};return _0x2b7d9d;})});}_0x4f006b=_[_0x7e95('0x38')]({},_0x4f006b,_0x1ee625[_0x7e95('0x3a')]);return _0x1ae96a[_0x7e95('0x4c')](_0x4f006b);}})[_0x7e95('0x24')](function(_0x4d199c){if(_0x4d199c){_0xa4075e=_0x4d199c['length'];if(!_0x1ee625[_0x7e95('0x2d')][_0x7e95('0x4d')](_0x7e95('0x32'))){_0x4f006b[_0x7e95('0x1d')]=qs[_0x7e95('0x1d')](_0x1ee625[_0x7e95('0x2d')][_0x7e95('0x1d')]);_0x4f006b[_0x7e95('0x1c')]=qs[_0x7e95('0x1c')](_0x1ee625[_0x7e95('0x2d')]['offset']);}return _0x1ae96a['getDescriptions'](_0x4f006b);}})[_0x7e95('0x24')](function(_0x1ad5f7){if(_0x1ad5f7){return _0x1ad5f7?{'count':_0xa4075e,'rows':_0x1ad5f7}:null;}})[_0x7e95('0x24')](respondWithResult(_0x499d7e,null))[_0x7e95('0x45')](handleError(_0x499d7e,null));};exports[_0x7e95('0x4e')]=function(_0x5be7c7,_0x2aa608,_0x237bef){var _0x51c78c={};var _0x1f7b8f={};var _0x229c6b;var _0x3c8866;return db['ZendeskConfiguration'][_0x7e95('0x49')]({'where':{'id':_0x5be7c7[_0x7e95('0x41')]['id']}})[_0x7e95('0x24')](handleEntityNotFound(_0x2aa608,null))[_0x7e95('0x24')](function(_0x5584ad){if(_0x5584ad){_0x229c6b=_0x5584ad;_0x1f7b8f[_0x7e95('0x2c')]=_[_0x7e95('0x2e')](db[_0x7e95('0x4f')]['rawAttributes']);_0x1f7b8f[_0x7e95('0x2d')]=_[_0x7e95('0x2e')](_0x5be7c7['query']);_0x1f7b8f[_0x7e95('0x37')]=_['intersection'](_0x1f7b8f[_0x7e95('0x2c')],_0x1f7b8f[_0x7e95('0x2d')]);_0x51c78c[_0x7e95('0x31')]=_[_0x7e95('0x2f')](_0x1f7b8f['model'],qs[_0x7e95('0x30')](_0x5be7c7['query'][_0x7e95('0x30')]));_0x51c78c['attributes']=_0x51c78c[_0x7e95('0x31')][_0x7e95('0x43')]?_0x51c78c['attributes']:_0x1f7b8f[_0x7e95('0x2c')];_0x51c78c[_0x7e95('0x33')]=qs[_0x7e95('0x34')](_0x5be7c7['query'][_0x7e95('0x34')]);_0x51c78c[_0x7e95('0x35')]=qs[_0x7e95('0x37')](_[_0x7e95('0x36')](_0x5be7c7[_0x7e95('0x2d')],_0x1f7b8f['filters']));if(_0x5be7c7[_0x7e95('0x2d')][_0x7e95('0x39')]){_0x51c78c['where']=_[_0x7e95('0x38')](_0x51c78c[_0x7e95('0x35')],{'$or':_[_0x7e95('0x28')](_0x51c78c[_0x7e95('0x31')],function(_0x2f773b){var _0x4dabc6={};_0x4dabc6[_0x2f773b]={'$like':'%'+_0x5be7c7[_0x7e95('0x2d')][_0x7e95('0x39')]+'%'};return _0x4dabc6;})});}_0x51c78c=_[_0x7e95('0x38')]({},_0x51c78c,_0x5be7c7[_0x7e95('0x3a')]);return _0x229c6b[_0x7e95('0x4e')](_0x51c78c);}})[_0x7e95('0x24')](function(_0x55acab){if(_0x55acab){_0x3c8866=_0x55acab[_0x7e95('0x43')];if(!_0x5be7c7[_0x7e95('0x2d')]['hasOwnProperty'](_0x7e95('0x32'))){_0x51c78c[_0x7e95('0x1d')]=qs[_0x7e95('0x1d')](_0x5be7c7[_0x7e95('0x2d')][_0x7e95('0x1d')]);_0x51c78c[_0x7e95('0x1c')]=qs[_0x7e95('0x1c')](_0x5be7c7['query'][_0x7e95('0x1c')]);}return _0x229c6b[_0x7e95('0x4e')](_0x51c78c);}})[_0x7e95('0x24')](function(_0x3c3ef7){if(_0x3c3ef7){return _0x3c3ef7?{'count':_0x3c8866,'rows':_0x3c3ef7}:null;}})[_0x7e95('0x24')](respondWithResult(_0x2aa608,null))[_0x7e95('0x45')](handleError(_0x2aa608,null));};exports[_0x7e95('0x50')]=function(_0x246738,_0x31911d,_0x5ef1d3){if(_0x246738['body']['id']){delete _0x246738[_0x7e95('0x47')]['id'];}return db[_0x7e95('0x3b')][_0x7e95('0x49')]({'where':{'id':_0x246738[_0x7e95('0x41')]['id']}})[_0x7e95('0x24')](handleEntityNotFound(_0x31911d,null))[_0x7e95('0x24')](function(_0x43853f){if(_0x43853f){return _0x43853f['setTags'](_0x246738[_0x7e95('0x47')][_0x7e95('0x51')]||[]);}return null;})[_0x7e95('0x24')](respondWithResult(_0x31911d,null))[_0x7e95('0x45')](handleError(_0x31911d,null));}; \ No newline at end of file +var _0x7c64=['pick','merge','filter','options','include','findAll','rows','catch','show','params','keys','fields','includeAll','find','create','body','getFields','ZendeskField','order','getSubjects','getDescriptions','findOne','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','sendStatus','error','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where'];(function(_0x4b3ec4,_0x3c573c){var _0x192836=function(_0x498cc0){while(--_0x498cc0){_0x4b3ec4['push'](_0x4b3ec4['shift']());}};_0x192836(++_0x3c573c);}(_0x7c64,0x1c2));var _0x47c6=function(_0x479ae7,_0x232d97){_0x479ae7=_0x479ae7-0x0;var _0x1e51ce=_0x7c64[_0x479ae7];return _0x1e51ce;};'use strict';var emlformat=require(_0x47c6('0x0'));var rimraf=require(_0x47c6('0x1'));var zipdir=require(_0x47c6('0x2'));var jsonpatch=require(_0x47c6('0x3'));var rp=require(_0x47c6('0x4'));var moment=require(_0x47c6('0x5'));var BPromise=require(_0x47c6('0x6'));var Mustache=require(_0x47c6('0x7'));var util=require('util');var path=require(_0x47c6('0x8'));var sox=require(_0x47c6('0x9'));var csv=require(_0x47c6('0xa'));var ejs=require(_0x47c6('0xb'));var fs=require('fs');var fs_extra=require(_0x47c6('0xc'));var _=require(_0x47c6('0xd'));var squel=require(_0x47c6('0xe'));var crypto=require('crypto');var jsforce=require(_0x47c6('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x47c6('0x10'));var Papa=require(_0x47c6('0x11'));var Redis=require(_0x47c6('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x47c6('0x13'));var hardwareService=require(_0x47c6('0x14'));var logger=require(_0x47c6('0x15'))(_0x47c6('0x16'));var utils=require(_0x47c6('0x17'));var config=require(_0x47c6('0x18'));var licenseUtil=require(_0x47c6('0x19'));var db=require(_0x47c6('0x1a'))['db'];function respondWithStatusCode(_0x3a53ba,_0x1636b9){_0x1636b9=_0x1636b9||0xcc;return function(_0xa84c01){if(_0xa84c01){return _0x3a53ba['sendStatus'](_0x1636b9);}return _0x3a53ba['status'](_0x1636b9)['end']();};}function respondWithResult(_0x35c7d3,_0x2d2012){_0x2d2012=_0x2d2012||0xc8;return function(_0xfe2299){if(_0xfe2299){return _0x35c7d3[_0x47c6('0x1b')](_0x2d2012)[_0x47c6('0x1c')](_0xfe2299);}};}function respondWithFilteredResult(_0x3fb967,_0x361b28){return function(_0x16aa97){if(_0x16aa97){var _0x195bb5=typeof _0x361b28[_0x47c6('0x1d')]==='undefined'&&typeof _0x361b28['limit']===_0x47c6('0x1e');var _0x5c185b=_0x16aa97[_0x47c6('0x1f')];var _0x486406=_0x195bb5?0x0:_0x361b28[_0x47c6('0x1d')];var _0x1f743c=_0x195bb5?_0x16aa97[_0x47c6('0x1f')]:_0x361b28[_0x47c6('0x1d')]+_0x361b28[_0x47c6('0x20')];var _0x176dbc;if(_0x1f743c>=_0x5c185b){_0x1f743c=_0x5c185b;_0x176dbc=0xc8;}else{_0x176dbc=0xce;}_0x3fb967[_0x47c6('0x1b')](_0x176dbc);return _0x3fb967[_0x47c6('0x21')](_0x47c6('0x22'),_0x486406+'-'+_0x1f743c+'/'+_0x5c185b)[_0x47c6('0x1c')](_0x16aa97);}return null;};}function patchUpdates(_0x2c7602){return function(_0x129180){try{jsonpatch['apply'](_0x129180,_0x2c7602,!![]);}catch(_0x4f965f){return BPromise['reject'](_0x4f965f);}return _0x129180['save']();};}function saveUpdates(_0x5e6bd4,_0x476510){return function(_0x14ca2c){if(_0x14ca2c){return _0x14ca2c[_0x47c6('0x23')](_0x5e6bd4)[_0x47c6('0x24')](function(_0x542e1c){return _0x542e1c;});}return null;};}function removeEntity(_0x582e48,_0x313c2e){return function(_0x29f180){if(_0x29f180){return _0x29f180[_0x47c6('0x25')]()[_0x47c6('0x24')](function(){_0x582e48[_0x47c6('0x1b')](0xcc)[_0x47c6('0x26')]();});}};}function handleEntityNotFound(_0x40b917,_0x59586f){return function(_0x370d66){if(!_0x370d66){_0x40b917[_0x47c6('0x27')](0x194);}return _0x370d66;};}function handleError(_0x4eac0e,_0x327c1d){_0x327c1d=_0x327c1d||0x1f4;return function(_0x33f477){logger[_0x47c6('0x28')](_0x33f477['stack']);if(_0x33f477[_0x47c6('0x29')]){delete _0x33f477[_0x47c6('0x29')];}_0x4eac0e['status'](_0x327c1d)[_0x47c6('0x2a')](_0x33f477);};}exports[_0x47c6('0x2b')]=function(_0x6df593,_0x1947de){var _0x2b9467={},_0x197abd={},_0x4777e9={'count':0x0,'rows':[]};var _0x5b9d26=_['map'](db[_0x47c6('0x2c')][_0x47c6('0x2d')],function(_0xd5cafe){return{'name':_0xd5cafe[_0x47c6('0x2e')],'type':_0xd5cafe[_0x47c6('0x2f')][_0x47c6('0x30')]};});_0x197abd['model']=_[_0x47c6('0x31')](_0x5b9d26,_0x47c6('0x29'));_0x197abd['query']=_['keys'](_0x6df593[_0x47c6('0x32')]);_0x197abd[_0x47c6('0x33')]=_[_0x47c6('0x34')](_0x197abd[_0x47c6('0x35')],_0x197abd[_0x47c6('0x32')]);_0x2b9467[_0x47c6('0x36')]=_[_0x47c6('0x34')](_0x197abd['model'],qs['fields'](_0x6df593['query']['fields']));_0x2b9467[_0x47c6('0x36')]=_0x2b9467[_0x47c6('0x36')][_0x47c6('0x37')]?_0x2b9467[_0x47c6('0x36')]:_0x197abd[_0x47c6('0x35')];if(!_0x6df593[_0x47c6('0x32')][_0x47c6('0x38')](_0x47c6('0x39'))){_0x2b9467[_0x47c6('0x20')]=qs['limit'](_0x6df593[_0x47c6('0x32')][_0x47c6('0x20')]);_0x2b9467[_0x47c6('0x1d')]=qs['offset'](_0x6df593[_0x47c6('0x32')][_0x47c6('0x1d')]);}_0x2b9467['order']=qs[_0x47c6('0x3a')](_0x6df593[_0x47c6('0x32')][_0x47c6('0x3a')]);_0x2b9467[_0x47c6('0x3b')]=qs['filters'](_[_0x47c6('0x3c')](_0x6df593['query'],_0x197abd['filters']),_0x5b9d26);if(_0x6df593[_0x47c6('0x32')]['filter']){_0x2b9467[_0x47c6('0x3b')]=_[_0x47c6('0x3d')](_0x2b9467[_0x47c6('0x3b')],{'$or':_[_0x47c6('0x31')](_0x5b9d26,function(_0x20509e){if(_0x20509e[_0x47c6('0x2f')]!=='VIRTUAL'){var _0x5ee339={};_0x5ee339[_0x20509e[_0x47c6('0x29')]]={'$like':'%'+_0x6df593['query'][_0x47c6('0x3e')]+'%'};return _0x5ee339;}})});}_0x2b9467=_['merge']({},_0x2b9467,_0x6df593[_0x47c6('0x3f')]);var _0x4cba81={'where':_0x2b9467[_0x47c6('0x3b')]};return db[_0x47c6('0x2c')][_0x47c6('0x1f')](_0x4cba81)[_0x47c6('0x24')](function(_0x41068d){_0x4777e9[_0x47c6('0x1f')]=_0x41068d;if(_0x6df593[_0x47c6('0x32')]['includeAll']){_0x2b9467[_0x47c6('0x40')]=[{'all':!![]}];}return db[_0x47c6('0x2c')][_0x47c6('0x41')](_0x2b9467);})[_0x47c6('0x24')](function(_0x39737c){_0x4777e9[_0x47c6('0x42')]=_0x39737c;return _0x4777e9;})['then'](respondWithFilteredResult(_0x1947de,_0x2b9467))[_0x47c6('0x43')](handleError(_0x1947de,null));};exports[_0x47c6('0x44')]=function(_0x5cc096,_0x2ea677){var _0x13265d={'raw':![],'where':{'id':_0x5cc096[_0x47c6('0x45')]['id']}},_0x5d7131={};_0x5d7131[_0x47c6('0x35')]=_[_0x47c6('0x46')](db[_0x47c6('0x2c')][_0x47c6('0x2d')]);_0x5d7131[_0x47c6('0x32')]=_[_0x47c6('0x46')](_0x5cc096['query']);_0x5d7131[_0x47c6('0x33')]=_[_0x47c6('0x34')](_0x5d7131[_0x47c6('0x35')],_0x5d7131[_0x47c6('0x32')]);_0x13265d['attributes']=_[_0x47c6('0x34')](_0x5d7131[_0x47c6('0x35')],qs['fields'](_0x5cc096[_0x47c6('0x32')][_0x47c6('0x47')]));_0x13265d['attributes']=_0x13265d['attributes'][_0x47c6('0x37')]?_0x13265d['attributes']:_0x5d7131[_0x47c6('0x35')];if(_0x5cc096['query'][_0x47c6('0x48')]){_0x13265d[_0x47c6('0x40')]=[{'all':!![]}];}_0x13265d=_['merge']({},_0x13265d,_0x5cc096[_0x47c6('0x3f')]);return db['ZendeskConfiguration'][_0x47c6('0x49')](_0x13265d)[_0x47c6('0x24')](handleEntityNotFound(_0x2ea677,null))[_0x47c6('0x24')](respondWithResult(_0x2ea677,null))['catch'](handleError(_0x2ea677,null));};exports[_0x47c6('0x4a')]=function(_0x13ec0e,_0x4774c6){return db[_0x47c6('0x2c')]['create'](_0x13ec0e[_0x47c6('0x4b')],{})[_0x47c6('0x24')](respondWithResult(_0x4774c6,0xc9))[_0x47c6('0x43')](handleError(_0x4774c6,null));};exports[_0x47c6('0x23')]=function(_0xbe0158,_0x548a98){if(_0xbe0158[_0x47c6('0x4b')]['id']){delete _0xbe0158[_0x47c6('0x4b')]['id'];}return db['ZendeskConfiguration'][_0x47c6('0x49')]({'where':{'id':_0xbe0158[_0x47c6('0x45')]['id']}})[_0x47c6('0x24')](handleEntityNotFound(_0x548a98,null))[_0x47c6('0x24')](saveUpdates(_0xbe0158[_0x47c6('0x4b')],null))['then'](respondWithResult(_0x548a98,null))[_0x47c6('0x43')](handleError(_0x548a98,null));};exports[_0x47c6('0x25')]=function(_0x5a1a62,_0x2dace9){return db[_0x47c6('0x2c')][_0x47c6('0x49')]({'where':{'id':_0x5a1a62[_0x47c6('0x45')]['id']}})['then'](handleEntityNotFound(_0x2dace9,null))[_0x47c6('0x24')](removeEntity(_0x2dace9,null))['catch'](handleError(_0x2dace9,null));};exports[_0x47c6('0x4c')]=function(_0x1d258c,_0x4baa75,_0x2e5bcd){var _0x42767a={};var _0x116a0a={};var _0x27517c;var _0x35100d;return db[_0x47c6('0x2c')]['findOne']({'where':{'id':_0x1d258c[_0x47c6('0x45')]['id']}})[_0x47c6('0x24')](handleEntityNotFound(_0x4baa75,null))[_0x47c6('0x24')](function(_0x157c95){if(_0x157c95){_0x27517c=_0x157c95;_0x116a0a[_0x47c6('0x35')]=_[_0x47c6('0x46')](db[_0x47c6('0x4d')][_0x47c6('0x2d')]);_0x116a0a[_0x47c6('0x32')]=_['keys'](_0x1d258c['query']);_0x116a0a[_0x47c6('0x33')]=_['intersection'](_0x116a0a['model'],_0x116a0a['query']);_0x42767a[_0x47c6('0x36')]=_['intersection'](_0x116a0a['model'],qs['fields'](_0x1d258c[_0x47c6('0x32')][_0x47c6('0x47')]));_0x42767a[_0x47c6('0x36')]=_0x42767a[_0x47c6('0x36')][_0x47c6('0x37')]?_0x42767a[_0x47c6('0x36')]:_0x116a0a[_0x47c6('0x35')];_0x42767a[_0x47c6('0x4e')]=qs[_0x47c6('0x3a')](_0x1d258c[_0x47c6('0x32')]['sort']);_0x42767a[_0x47c6('0x3b')]=qs[_0x47c6('0x33')](_[_0x47c6('0x3c')](_0x1d258c[_0x47c6('0x32')],_0x116a0a[_0x47c6('0x33')]));if(_0x1d258c['query'][_0x47c6('0x3e')]){_0x42767a[_0x47c6('0x3b')]=_[_0x47c6('0x3d')](_0x42767a[_0x47c6('0x3b')],{'$or':_[_0x47c6('0x31')](_0x42767a[_0x47c6('0x36')],function(_0x724394){var _0x370207={};_0x370207[_0x724394]={'$like':'%'+_0x1d258c[_0x47c6('0x32')][_0x47c6('0x3e')]+'%'};return _0x370207;})});}_0x42767a=_[_0x47c6('0x3d')]({},_0x42767a,_0x1d258c[_0x47c6('0x3f')]);return _0x27517c[_0x47c6('0x4c')](_0x42767a);}})[_0x47c6('0x24')](function(_0xcd0bbb){if(_0xcd0bbb){_0x35100d=_0xcd0bbb[_0x47c6('0x37')];if(!_0x1d258c[_0x47c6('0x32')][_0x47c6('0x38')]('nolimit')){_0x42767a[_0x47c6('0x20')]=qs[_0x47c6('0x20')](_0x1d258c[_0x47c6('0x32')][_0x47c6('0x20')]);_0x42767a[_0x47c6('0x1d')]=qs[_0x47c6('0x1d')](_0x1d258c[_0x47c6('0x32')][_0x47c6('0x1d')]);}return _0x27517c[_0x47c6('0x4c')](_0x42767a);}})['then'](function(_0x18eab2){if(_0x18eab2){return _0x18eab2?{'count':_0x35100d,'rows':_0x18eab2}:null;}})[_0x47c6('0x24')](respondWithResult(_0x4baa75,null))[_0x47c6('0x43')](handleError(_0x4baa75,null));};exports[_0x47c6('0x4f')]=function(_0x34f3dc,_0x6843f4,_0xb97f31){var _0x304630={};var _0x5e4dd5={};var _0x17b7b2;var _0x153cad;return db[_0x47c6('0x2c')]['findOne']({'where':{'id':_0x34f3dc[_0x47c6('0x45')]['id']}})[_0x47c6('0x24')](handleEntityNotFound(_0x6843f4,null))[_0x47c6('0x24')](function(_0x282fb2){if(_0x282fb2){_0x17b7b2=_0x282fb2;_0x5e4dd5[_0x47c6('0x35')]=_[_0x47c6('0x46')](db[_0x47c6('0x4d')]['rawAttributes']);_0x5e4dd5[_0x47c6('0x32')]=_[_0x47c6('0x46')](_0x34f3dc[_0x47c6('0x32')]);_0x5e4dd5[_0x47c6('0x33')]=_[_0x47c6('0x34')](_0x5e4dd5[_0x47c6('0x35')],_0x5e4dd5[_0x47c6('0x32')]);_0x304630[_0x47c6('0x36')]=_[_0x47c6('0x34')](_0x5e4dd5['model'],qs['fields'](_0x34f3dc[_0x47c6('0x32')]['fields']));_0x304630[_0x47c6('0x36')]=_0x304630[_0x47c6('0x36')]['length']?_0x304630['attributes']:_0x5e4dd5[_0x47c6('0x35')];_0x304630[_0x47c6('0x4e')]=qs[_0x47c6('0x3a')](_0x34f3dc['query'][_0x47c6('0x3a')]);_0x304630[_0x47c6('0x3b')]=qs[_0x47c6('0x33')](_['pick'](_0x34f3dc[_0x47c6('0x32')],_0x5e4dd5[_0x47c6('0x33')]));if(_0x34f3dc['query'][_0x47c6('0x3e')]){_0x304630[_0x47c6('0x3b')]=_[_0x47c6('0x3d')](_0x304630['where'],{'$or':_[_0x47c6('0x31')](_0x304630['attributes'],function(_0x5a0235){var _0x162d36={};_0x162d36[_0x5a0235]={'$like':'%'+_0x34f3dc[_0x47c6('0x32')]['filter']+'%'};return _0x162d36;})});}_0x304630=_['merge']({},_0x304630,_0x34f3dc['options']);return _0x17b7b2[_0x47c6('0x4f')](_0x304630);}})[_0x47c6('0x24')](function(_0x32fc21){if(_0x32fc21){_0x153cad=_0x32fc21['length'];if(!_0x34f3dc['query']['hasOwnProperty'](_0x47c6('0x39'))){_0x304630[_0x47c6('0x20')]=qs['limit'](_0x34f3dc[_0x47c6('0x32')][_0x47c6('0x20')]);_0x304630['offset']=qs['offset'](_0x34f3dc[_0x47c6('0x32')]['offset']);}return _0x17b7b2[_0x47c6('0x4f')](_0x304630);}})[_0x47c6('0x24')](function(_0x2a84b9){if(_0x2a84b9){return _0x2a84b9?{'count':_0x153cad,'rows':_0x2a84b9}:null;}})['then'](respondWithResult(_0x6843f4,null))['catch'](handleError(_0x6843f4,null));};exports[_0x47c6('0x50')]=function(_0x5215e2,_0x15c47d,_0x1f6d84){var _0x2ba4ad={};var _0x42fe86={};var _0x58bdd1;var _0x5d0117;return db[_0x47c6('0x2c')][_0x47c6('0x51')]({'where':{'id':_0x5215e2['params']['id']}})[_0x47c6('0x24')](handleEntityNotFound(_0x15c47d,null))[_0x47c6('0x24')](function(_0x3a959a){if(_0x3a959a){_0x58bdd1=_0x3a959a;_0x42fe86[_0x47c6('0x35')]=_[_0x47c6('0x46')](db[_0x47c6('0x4d')][_0x47c6('0x2d')]);_0x42fe86[_0x47c6('0x32')]=_['keys'](_0x5215e2[_0x47c6('0x32')]);_0x42fe86[_0x47c6('0x33')]=_['intersection'](_0x42fe86[_0x47c6('0x35')],_0x42fe86[_0x47c6('0x32')]);_0x2ba4ad[_0x47c6('0x36')]=_[_0x47c6('0x34')](_0x42fe86[_0x47c6('0x35')],qs[_0x47c6('0x47')](_0x5215e2[_0x47c6('0x32')][_0x47c6('0x47')]));_0x2ba4ad[_0x47c6('0x36')]=_0x2ba4ad[_0x47c6('0x36')][_0x47c6('0x37')]?_0x2ba4ad[_0x47c6('0x36')]:_0x42fe86['model'];_0x2ba4ad[_0x47c6('0x4e')]=qs[_0x47c6('0x3a')](_0x5215e2['query'][_0x47c6('0x3a')]);_0x2ba4ad[_0x47c6('0x3b')]=qs[_0x47c6('0x33')](_['pick'](_0x5215e2[_0x47c6('0x32')],_0x42fe86['filters']));if(_0x5215e2[_0x47c6('0x32')][_0x47c6('0x3e')]){_0x2ba4ad['where']=_[_0x47c6('0x3d')](_0x2ba4ad[_0x47c6('0x3b')],{'$or':_[_0x47c6('0x31')](_0x2ba4ad[_0x47c6('0x36')],function(_0x36dfd7){var _0x2de396={};_0x2de396[_0x36dfd7]={'$like':'%'+_0x5215e2[_0x47c6('0x32')][_0x47c6('0x3e')]+'%'};return _0x2de396;})});}_0x2ba4ad=_[_0x47c6('0x3d')]({},_0x2ba4ad,_0x5215e2[_0x47c6('0x3f')]);return _0x58bdd1[_0x47c6('0x50')](_0x2ba4ad);}})[_0x47c6('0x24')](function(_0x287abe){if(_0x287abe){_0x5d0117=_0x287abe[_0x47c6('0x37')];if(!_0x5215e2['query'][_0x47c6('0x38')](_0x47c6('0x39'))){_0x2ba4ad[_0x47c6('0x20')]=qs[_0x47c6('0x20')](_0x5215e2[_0x47c6('0x32')]['limit']);_0x2ba4ad['offset']=qs[_0x47c6('0x1d')](_0x5215e2[_0x47c6('0x32')]['offset']);}return _0x58bdd1['getDescriptions'](_0x2ba4ad);}})[_0x47c6('0x24')](function(_0x2fa541){if(_0x2fa541){return _0x2fa541?{'count':_0x5d0117,'rows':_0x2fa541}:null;}})[_0x47c6('0x24')](respondWithResult(_0x15c47d,null))[_0x47c6('0x43')](handleError(_0x15c47d,null));};exports[_0x47c6('0x52')]=function(_0x922e7b,_0x1ff150,_0x5252a0){var _0x2df38a={};var _0x176819={};var _0x9ded6c;var _0x2fdedd;return db[_0x47c6('0x2c')]['findOne']({'where':{'id':_0x922e7b[_0x47c6('0x45')]['id']}})['then'](handleEntityNotFound(_0x1ff150,null))['then'](function(_0x2c7c8f){if(_0x2c7c8f){_0x9ded6c=_0x2c7c8f;_0x176819[_0x47c6('0x35')]=_[_0x47c6('0x46')](db[_0x47c6('0x53')][_0x47c6('0x2d')]);_0x176819[_0x47c6('0x32')]=_[_0x47c6('0x46')](_0x922e7b[_0x47c6('0x32')]);_0x176819['filters']=_[_0x47c6('0x34')](_0x176819[_0x47c6('0x35')],_0x176819[_0x47c6('0x32')]);_0x2df38a[_0x47c6('0x36')]=_[_0x47c6('0x34')](_0x176819[_0x47c6('0x35')],qs[_0x47c6('0x47')](_0x922e7b[_0x47c6('0x32')][_0x47c6('0x47')]));_0x2df38a[_0x47c6('0x36')]=_0x2df38a[_0x47c6('0x36')][_0x47c6('0x37')]?_0x2df38a[_0x47c6('0x36')]:_0x176819[_0x47c6('0x35')];_0x2df38a[_0x47c6('0x4e')]=qs[_0x47c6('0x3a')](_0x922e7b[_0x47c6('0x32')]['sort']);_0x2df38a[_0x47c6('0x3b')]=qs[_0x47c6('0x33')](_['pick'](_0x922e7b[_0x47c6('0x32')],_0x176819[_0x47c6('0x33')]));if(_0x922e7b[_0x47c6('0x32')][_0x47c6('0x3e')]){_0x2df38a[_0x47c6('0x3b')]=_[_0x47c6('0x3d')](_0x2df38a[_0x47c6('0x3b')],{'$or':_[_0x47c6('0x31')](_0x2df38a[_0x47c6('0x36')],function(_0x2c2cfb){var _0x17f2f2={};_0x17f2f2[_0x2c2cfb]={'$like':'%'+_0x922e7b[_0x47c6('0x32')][_0x47c6('0x3e')]+'%'};return _0x17f2f2;})});}_0x2df38a=_[_0x47c6('0x3d')]({},_0x2df38a,_0x922e7b['options']);return _0x9ded6c[_0x47c6('0x52')](_0x2df38a);}})['then'](function(_0x13625f){if(_0x13625f){_0x2fdedd=_0x13625f[_0x47c6('0x37')];if(!_0x922e7b[_0x47c6('0x32')][_0x47c6('0x38')](_0x47c6('0x39'))){_0x2df38a['limit']=qs[_0x47c6('0x20')](_0x922e7b[_0x47c6('0x32')][_0x47c6('0x20')]);_0x2df38a[_0x47c6('0x1d')]=qs[_0x47c6('0x1d')](_0x922e7b[_0x47c6('0x32')][_0x47c6('0x1d')]);}return _0x9ded6c[_0x47c6('0x52')](_0x2df38a);}})[_0x47c6('0x24')](function(_0x33d8a2){if(_0x33d8a2){return _0x33d8a2?{'count':_0x2fdedd,'rows':_0x33d8a2}:null;}})[_0x47c6('0x24')](respondWithResult(_0x1ff150,null))[_0x47c6('0x43')](handleError(_0x1ff150,null));};exports[_0x47c6('0x54')]=function(_0x1d5e11,_0x7b1cde,_0x4cc43d){if(_0x1d5e11[_0x47c6('0x4b')]['id']){delete _0x1d5e11['body']['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x1d5e11[_0x47c6('0x45')]['id']}})[_0x47c6('0x24')](handleEntityNotFound(_0x7b1cde,null))[_0x47c6('0x24')](function(_0x4efe6a){if(_0x4efe6a){return _0x4efe6a[_0x47c6('0x54')](_0x1d5e11[_0x47c6('0x4b')]['ids']||[]);}return null;})['then'](respondWithResult(_0x7b1cde,null))[_0x47c6('0x43')](handleError(_0x7b1cde,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 6c95c10..8087106 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 _0x7708=['../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','rimraf'];(function(_0x10200d,_0x40cc79){var _0x558476=function(_0x4059ca){while(--_0x4059ca){_0x10200d['push'](_0x10200d['shift']());}};_0x558476(++_0x40cc79);}(_0x7708,0x188));var _0x8770=function(_0x147497,_0x43e433){_0x147497=_0x147497-0x0;var _0x35f45=_0x7708[_0x147497];return _0x35f45;};'use strict';var _=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var logger=require('../../config/logger')(_0x8770('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x8770('0x5')]=function(_0x50bab7,_0x31390d){return _0x50bab7[_0x8770('0x6')](_0x8770('0x7'),attributes,{'tableName':_0x8770('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5204=['request-promise','path','../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','moment','bluebird'];(function(_0x404a11,_0x268dc0){var _0x435823=function(_0x8bf3a){while(--_0x8bf3a){_0x404a11['push'](_0x404a11['shift']());}};_0x435823(++_0x268dc0);}(_0x5204,0xdf));var _0x4520=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x5204[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var logger=require('../../config/logger')(_0x4520('0x2'));var moment=require(_0x4520('0x3'));var BPromise=require(_0x4520('0x4'));var rp=require(_0x4520('0x5'));var fs=require('fs');var path=require(_0x4520('0x6'));var rimraf=require('rimraf');var config=require(_0x4520('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x4520('0x8')]=function(_0x209381,_0xe0a256){return _0x209381[_0x4520('0x9')](_0x4520('0xa'),attributes,{'tableName':_0x4520('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 2edb979..13d1c65 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 _0xdeda=['then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request'];(function(_0x4a17f1,_0x6b1b59){var _0x4506ac=function(_0x5ac18e){while(--_0x5ac18e){_0x4a17f1['push'](_0x4a17f1['shift']());}};_0x4506ac(++_0x6b1b59);}(_0xdeda,0x15b));var _0xaded=function(_0x475be2,_0xf0639){_0x475be2=_0x475be2-0x0;var _0x4ff8b1=_0xdeda[_0x475be2];return _0x4ff8b1;};'use strict';var _=require(_0xaded('0x0'));var util=require(_0xaded('0x1'));var moment=require(_0xaded('0x2'));var BPromise=require(_0xaded('0x3'));var rs=require(_0xaded('0x4'));var fs=require('fs');var Redis=require(_0xaded('0x5'));var db=require(_0xaded('0x6'))['db'];var utils=require(_0xaded('0x7'));var logger=require('../../config/logger')(_0xaded('0x8'));var config=require(_0xaded('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaded('0xa')][_0xaded('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4dc1d3,_0x5d6ce9,_0x310258){return new BPromise(function(_0x2c1b8a,_0x2322cd){return client[_0xaded('0xc')](_0x4dc1d3,_0x310258)[_0xaded('0xd')](function(_0x147b22){logger[_0xaded('0xe')](_0xaded('0xf'),_0x5d6ce9,'request\x20sent');logger[_0xaded('0x10')](_0xaded('0x11'),_0x5d6ce9,_0xaded('0x12'),JSON[_0xaded('0x13')](_0x147b22));if(_0x147b22[_0xaded('0x14')]){if(_0x147b22[_0xaded('0x14')][_0xaded('0x15')]===0x1f4){logger[_0xaded('0x14')](_0xaded('0xf'),_0x5d6ce9,_0x147b22[_0xaded('0x14')]['message']);return _0x2322cd(_0x147b22[_0xaded('0x14')][_0xaded('0x16')]);}logger[_0xaded('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5d6ce9,_0x147b22[_0xaded('0x14')][_0xaded('0x16')]);return _0x2c1b8a(_0x147b22['error'][_0xaded('0x16')]);}else{logger[_0xaded('0xe')](_0xaded('0xf'),_0x5d6ce9,_0xaded('0x12'));_0x2c1b8a(_0x147b22[_0xaded('0x17')][_0xaded('0x16')]);}})['catch'](function(_0x9d8edd){logger[_0xaded('0x14')](_0xaded('0xf'),_0x5d6ce9,_0x9d8edd);_0x2322cd(_0x9d8edd);});});} \ No newline at end of file +var _0x2160=['../../config/environment','jayson/promise','http','request','info','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x522736,_0x30aadc){var _0x4b4aae=function(_0x2b6cba){while(--_0x2b6cba){_0x522736['push'](_0x522736['shift']());}};_0x4b4aae(++_0x30aadc);}(_0x2160,0x7f));var _0x0216=function(_0x7bb261,_0x2ea59a){_0x7bb261=_0x7bb261-0x0;var _0x56210b=_0x2160[_0x7bb261];return _0x56210b;};'use strict';var _=require(_0x0216('0x0'));var util=require('util');var moment=require(_0x0216('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0216('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0216('0x3'));var logger=require(_0x0216('0x4'))(_0x0216('0x5'));var config=require(_0x0216('0x6'));var jayson=require(_0x0216('0x7'));var client=jayson['client'][_0x0216('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e4b8f,_0x4a66c7,_0x4f4e82){return new BPromise(function(_0x6fe9aa,_0x538b37){return client[_0x0216('0x9')](_0x1e4b8f,_0x4f4e82)['then'](function(_0x1fd4f1){logger[_0x0216('0xa')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4a66c7,_0x0216('0xb'));logger['debug'](_0x0216('0xc'),_0x4a66c7,_0x0216('0xb'),JSON[_0x0216('0xd')](_0x1fd4f1));if(_0x1fd4f1['error']){if(_0x1fd4f1[_0x0216('0xe')]['code']===0x1f4){logger['error'](_0x0216('0xf'),_0x4a66c7,_0x1fd4f1['error']['message']);return _0x538b37(_0x1fd4f1[_0x0216('0xe')]['message']);}logger[_0x0216('0xe')](_0x0216('0xf'),_0x4a66c7,_0x1fd4f1[_0x0216('0xe')][_0x0216('0x10')]);return _0x6fe9aa(_0x1fd4f1[_0x0216('0xe')][_0x0216('0x10')]);}else{logger[_0x0216('0xa')](_0x0216('0xf'),_0x4a66c7,_0x0216('0xb'));_0x6fe9aa(_0x1fd4f1[_0x0216('0x11')]['message']);}})[_0x0216('0x12')](function(_0x4a73f1){logger[_0x0216('0xe')](_0x0216('0xf'),_0x4a66c7,_0x4a73f1);_0x538b37(_0x4a73f1);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 772f437..c2e0240 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 _0x8856=['put','update','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','./intZendeskField.controller','get','index','/:id','isAuthenticated','post'];(function(_0x3b44a0,_0x15bbf2){var _0x238b5e=function(_0xaf8f9b){while(--_0xaf8f9b){_0x3b44a0['push'](_0x3b44a0['shift']());}};_0x238b5e(++_0x15bbf2);}(_0x8856,0x1d4));var _0x6885=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8856[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6885('0x0'));var util=require(_0x6885('0x1'));var path=require('path');var timeout=require(_0x6885('0x2'));var express=require(_0x6885('0x3'));var router=express[_0x6885('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6885('0x5'));var config=require('../../config/environment');var controller=require(_0x6885('0x6'));router[_0x6885('0x7')]('/',auth['isAuthenticated'](),controller[_0x6885('0x8')]);router[_0x6885('0x7')](_0x6885('0x9'),auth[_0x6885('0xa')](),controller['show']);router[_0x6885('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6885('0xc')](_0x6885('0x9'),auth[_0x6885('0xa')](),controller[_0x6885('0xd')]);router['delete'](_0x6885('0x9'),auth[_0x6885('0xa')](),controller[_0x6885('0xe')]);module['exports']=router; \ No newline at end of file +var _0x1d5b=['isAuthenticated','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','index','/:id','post'];(function(_0x54b8a6,_0x38986a){var _0x54a6a3=function(_0x3cb4e6){while(--_0x3cb4e6){_0x54b8a6['push'](_0x54b8a6['shift']());}};_0x54a6a3(++_0x38986a);}(_0x1d5b,0x8c));var _0xb1d5=function(_0x533869,_0x470005){_0x533869=_0x533869-0x0;var _0x224857=_0x1d5b[_0x533869];return _0x224857;};'use strict';var multer=require('multer');var util=require(_0xb1d5('0x0'));var path=require(_0xb1d5('0x1'));var timeout=require(_0xb1d5('0x2'));var express=require(_0xb1d5('0x3'));var router=express['Router']();var fs_extra=require(_0xb1d5('0x4'));var auth=require(_0xb1d5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb1d5('0x6'));var controller=require(_0xb1d5('0x7'));router[_0xb1d5('0x8')]('/',auth['isAuthenticated'](),controller[_0xb1d5('0x9')]);router[_0xb1d5('0x8')](_0xb1d5('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xb1d5('0xb')]('/',auth[_0xb1d5('0xc')](),controller[_0xb1d5('0xd')]);router[_0xb1d5('0xe')](_0xb1d5('0xa'),auth['isAuthenticated'](),controller[_0xb1d5('0xf')]);router[_0xb1d5('0x10')](_0xb1d5('0xa'),auth[_0xb1d5('0xc')](),controller[_0xb1d5('0x11')]);module[_0xb1d5('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 4ea0a13..eab9974 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 _0xc4f2=['keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable'];(function(_0x59c23a,_0x4eb28d){var _0x2ce1ae=function(_0x5e7224){while(--_0x5e7224){_0x59c23a['push'](_0x59c23a['shift']());}};_0x2ce1ae(++_0x4eb28d);}(_0xc4f2,0x1c7));var _0x2c4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4f2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2c4f('0x0'));module[_0x2c4f('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2c4f('0x2'),_0x2c4f('0x3'),_0x2c4f('0x4'),_0x2c4f('0x5'),_0x2c4f('0x6')),'defaultValue':_0x2c4f('0x2')},'content':{'type':Sequelize[_0x2c4f('0x7')]},'key':{'type':Sequelize[_0x2c4f('0x7')]},'keyType':{'type':Sequelize[_0x2c4f('0x8')](_0x2c4f('0x2'),_0x2c4f('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x2c4f('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2c4f('0x7')]},'customField':{'type':Sequelize[_0x2c4f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2c4f('0x7')]}}; \ No newline at end of file +var _0xa577=['BOOLEAN','sequelize','string','variable','customVariable','keyValue','picklist','ENUM','STRING'];(function(_0x56c0ea,_0x4f7ce3){var _0x97e1=function(_0x5850c2){while(--_0x5850c2){_0x56c0ea['push'](_0x56c0ea['shift']());}};_0x97e1(++_0x4f7ce3);}(_0xa577,0x160));var _0x7a57=function(_0x58079f,_0x507d7b){_0x58079f=_0x58079f-0x0;var _0x26aafe=_0xa577[_0x58079f];return _0x26aafe;};'use strict';var Sequelize=require(_0x7a57('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x7a57('0x1'),_0x7a57('0x2'),_0x7a57('0x3'),_0x7a57('0x4'),_0x7a57('0x5')),'defaultValue':_0x7a57('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7a57('0x6')](_0x7a57('0x1'),_0x7a57('0x2'),_0x7a57('0x3'))},'keyContent':{'type':Sequelize[_0x7a57('0x7')]},'idField':{'type':Sequelize[_0x7a57('0x7')]},'nameField':{'type':Sequelize[_0x7a57('0x7')]},'customField':{'type':Sequelize[_0x7a57('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7a57('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 83131e1..784a8d8 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 _0xeaab=['mustache','util','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','set','apply','save','update','then','error','name','index','map','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','nolimit','offset','order','sort','where','filter','merge','type','ZendeskField','includeAll','include','findAll','show','params','keys','length','options','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x1e4f2f,_0x35edfa){var _0xccea89=function(_0x164386){while(--_0x164386){_0x1e4f2f['push'](_0x1e4f2f['shift']());}};_0xccea89(++_0x35edfa);}(_0xeaab,0x83));var _0xbeaa=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xeaab[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbeaa('0x0'));var zipdir=require(_0xbeaa('0x1'));var jsonpatch=require(_0xbeaa('0x2'));var rp=require(_0xbeaa('0x3'));var moment=require(_0xbeaa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbeaa('0x5'));var util=require(_0xbeaa('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbeaa('0x7'));var _=require(_0xbeaa('0x8'));var squel=require(_0xbeaa('0x9'));var crypto=require('crypto');var jsforce=require(_0xbeaa('0xa'));var deskjs=require(_0xbeaa('0xb'));var toCsv=require(_0xbeaa('0xc'));var querystring=require(_0xbeaa('0xd'));var Papa=require('papaparse');var Redis=require(_0xbeaa('0xe'));var authService=require(_0xbeaa('0xf'));var qs=require(_0xbeaa('0x10'));var as=require(_0xbeaa('0x11'));var hardwareService=require(_0xbeaa('0x12'));var logger=require(_0xbeaa('0x13'))('api');var utils=require(_0xbeaa('0x14'));var config=require(_0xbeaa('0x15'));var licenseUtil=require(_0xbeaa('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36501a,_0x398498){_0x398498=_0x398498||0xcc;return function(_0x2d5873){if(_0x2d5873){return _0x36501a[_0xbeaa('0x17')](_0x398498);}return _0x36501a[_0xbeaa('0x18')](_0x398498)[_0xbeaa('0x19')]();};}function respondWithResult(_0x10ffe3,_0x184e47){_0x184e47=_0x184e47||0xc8;return function(_0x335d3f){if(_0x335d3f){return _0x10ffe3[_0xbeaa('0x18')](_0x184e47)[_0xbeaa('0x1a')](_0x335d3f);}};}function respondWithFilteredResult(_0x21c2f8,_0x542f03){return function(_0x42c887){if(_0x42c887){var _0x4db167=typeof _0x542f03['offset']===_0xbeaa('0x1b')&&typeof _0x542f03[_0xbeaa('0x1c')]==='undefined';var _0x455d5c=_0x42c887[_0xbeaa('0x1d')];var _0x7c14c2=_0x4db167?0x0:_0x542f03['offset'];var _0x4be0a0=_0x4db167?_0x42c887[_0xbeaa('0x1d')]:_0x542f03['offset']+_0x542f03[_0xbeaa('0x1c')];var _0x28d19f;if(_0x4be0a0>=_0x455d5c){_0x4be0a0=_0x455d5c;_0x28d19f=0xc8;}else{_0x28d19f=0xce;}_0x21c2f8[_0xbeaa('0x18')](_0x28d19f);return _0x21c2f8[_0xbeaa('0x1e')]('Content-Range',_0x7c14c2+'-'+_0x4be0a0+'/'+_0x455d5c)['json'](_0x42c887);}return null;};}function patchUpdates(_0x47d88b){return function(_0xaa79ad){try{jsonpatch[_0xbeaa('0x1f')](_0xaa79ad,_0x47d88b,!![]);}catch(_0x4b55bc){return BPromise['reject'](_0x4b55bc);}return _0xaa79ad[_0xbeaa('0x20')]();};}function saveUpdates(_0xd0cba,_0x5ed9aa){return function(_0x1b5311){if(_0x1b5311){return _0x1b5311[_0xbeaa('0x21')](_0xd0cba)[_0xbeaa('0x22')](function(_0x210c39){return _0x210c39;});}return null;};}function removeEntity(_0x3ebcbc,_0x24a64a){return function(_0x4c70c3){if(_0x4c70c3){return _0x4c70c3['destroy']()[_0xbeaa('0x22')](function(){_0x3ebcbc['status'](0xcc)[_0xbeaa('0x19')]();});}};}function handleEntityNotFound(_0x49d12e,_0x43f5c3){return function(_0x1a5be2){if(!_0x1a5be2){_0x49d12e[_0xbeaa('0x17')](0x194);}return _0x1a5be2;};}function handleError(_0x5656dd,_0x4fd53f){_0x4fd53f=_0x4fd53f||0x1f4;return function(_0x4131cb){logger[_0xbeaa('0x23')](_0x4131cb['stack']);if(_0x4131cb['name']){delete _0x4131cb[_0xbeaa('0x24')];}_0x5656dd[_0xbeaa('0x18')](_0x4fd53f)['send'](_0x4131cb);};}exports[_0xbeaa('0x25')]=function(_0x256c9d,_0x2438e7){var _0x1b0356={},_0x21472c={},_0x2f5095={'count':0x0,'rows':[]};var _0x44d737=_[_0xbeaa('0x26')](db['ZendeskField'][_0xbeaa('0x27')],function(_0x10ec32){return{'name':_0x10ec32[_0xbeaa('0x28')],'type':_0x10ec32['type']['key']};});_0x21472c['model']=_[_0xbeaa('0x26')](_0x44d737,_0xbeaa('0x24'));_0x21472c[_0xbeaa('0x29')]=_['keys'](_0x256c9d[_0xbeaa('0x29')]);_0x21472c[_0xbeaa('0x2a')]=_[_0xbeaa('0x2b')](_0x21472c[_0xbeaa('0x2c')],_0x21472c[_0xbeaa('0x29')]);_0x1b0356[_0xbeaa('0x2d')]=_[_0xbeaa('0x2b')](_0x21472c[_0xbeaa('0x2c')],qs[_0xbeaa('0x2e')](_0x256c9d[_0xbeaa('0x29')][_0xbeaa('0x2e')]));_0x1b0356['attributes']=_0x1b0356['attributes']['length']?_0x1b0356['attributes']:_0x21472c[_0xbeaa('0x2c')];if(!_0x256c9d[_0xbeaa('0x29')]['hasOwnProperty'](_0xbeaa('0x2f'))){_0x1b0356[_0xbeaa('0x1c')]=qs[_0xbeaa('0x1c')](_0x256c9d[_0xbeaa('0x29')][_0xbeaa('0x1c')]);_0x1b0356['offset']=qs[_0xbeaa('0x30')](_0x256c9d[_0xbeaa('0x29')][_0xbeaa('0x30')]);}_0x1b0356[_0xbeaa('0x31')]=qs[_0xbeaa('0x32')](_0x256c9d[_0xbeaa('0x29')]['sort']);_0x1b0356[_0xbeaa('0x33')]=qs[_0xbeaa('0x2a')](_['pick'](_0x256c9d[_0xbeaa('0x29')],_0x21472c['filters']),_0x44d737);if(_0x256c9d[_0xbeaa('0x29')][_0xbeaa('0x34')]){_0x1b0356[_0xbeaa('0x33')]=_[_0xbeaa('0x35')](_0x1b0356[_0xbeaa('0x33')],{'$or':_['map'](_0x44d737,function(_0x477423){if(_0x477423[_0xbeaa('0x36')]!=='VIRTUAL'){var _0x5d3f4e={};_0x5d3f4e[_0x477423[_0xbeaa('0x24')]]={'$like':'%'+_0x256c9d['query'][_0xbeaa('0x34')]+'%'};return _0x5d3f4e;}})});}_0x1b0356=_[_0xbeaa('0x35')]({},_0x1b0356,_0x256c9d['options']);var _0x4216ea={'where':_0x1b0356[_0xbeaa('0x33')]};return db[_0xbeaa('0x37')][_0xbeaa('0x1d')](_0x4216ea)[_0xbeaa('0x22')](function(_0x1aaeb8){_0x2f5095['count']=_0x1aaeb8;if(_0x256c9d[_0xbeaa('0x29')][_0xbeaa('0x38')]){_0x1b0356[_0xbeaa('0x39')]=[{'all':!![]}];}return db[_0xbeaa('0x37')][_0xbeaa('0x3a')](_0x1b0356);})[_0xbeaa('0x22')](function(_0x12b59){_0x2f5095['rows']=_0x12b59;return _0x2f5095;})['then'](respondWithFilteredResult(_0x2438e7,_0x1b0356))['catch'](handleError(_0x2438e7,null));};exports[_0xbeaa('0x3b')]=function(_0x139462,_0xc7f3a7){var _0x33cd07={'raw':!![],'where':{'id':_0x139462[_0xbeaa('0x3c')]['id']}},_0x58907e={};_0x58907e[_0xbeaa('0x2c')]=_[_0xbeaa('0x3d')](db[_0xbeaa('0x37')][_0xbeaa('0x27')]);_0x58907e['query']=_['keys'](_0x139462[_0xbeaa('0x29')]);_0x58907e[_0xbeaa('0x2a')]=_[_0xbeaa('0x2b')](_0x58907e[_0xbeaa('0x2c')],_0x58907e['query']);_0x33cd07['attributes']=_[_0xbeaa('0x2b')](_0x58907e[_0xbeaa('0x2c')],qs[_0xbeaa('0x2e')](_0x139462['query'][_0xbeaa('0x2e')]));_0x33cd07[_0xbeaa('0x2d')]=_0x33cd07[_0xbeaa('0x2d')][_0xbeaa('0x3e')]?_0x33cd07['attributes']:_0x58907e[_0xbeaa('0x2c')];if(_0x139462[_0xbeaa('0x29')][_0xbeaa('0x38')]){_0x33cd07['include']=[{'all':!![]}];}_0x33cd07=_[_0xbeaa('0x35')]({},_0x33cd07,_0x139462[_0xbeaa('0x3f')]);return db[_0xbeaa('0x37')][_0xbeaa('0x40')](_0x33cd07)[_0xbeaa('0x22')](handleEntityNotFound(_0xc7f3a7,null))['then'](respondWithResult(_0xc7f3a7,null))[_0xbeaa('0x41')](handleError(_0xc7f3a7,null));};exports['create']=function(_0x368381,_0x52275a){return db[_0xbeaa('0x37')][_0xbeaa('0x42')](_0x368381[_0xbeaa('0x43')],{})[_0xbeaa('0x22')](respondWithResult(_0x52275a,0xc9))['catch'](handleError(_0x52275a,null));};exports[_0xbeaa('0x21')]=function(_0x1109bc,_0x2d1aeb){if(_0x1109bc['body']['id']){delete _0x1109bc[_0xbeaa('0x43')]['id'];}return db[_0xbeaa('0x37')][_0xbeaa('0x40')]({'where':{'id':_0x1109bc['params']['id']}})[_0xbeaa('0x22')](handleEntityNotFound(_0x2d1aeb,null))['then'](saveUpdates(_0x1109bc[_0xbeaa('0x43')],null))[_0xbeaa('0x22')](respondWithResult(_0x2d1aeb,null))[_0xbeaa('0x41')](handleError(_0x2d1aeb,null));};exports['destroy']=function(_0x340c42,_0x2f4e1c){return db[_0xbeaa('0x37')][_0xbeaa('0x40')]({'where':{'id':_0x340c42['params']['id']}})['then'](handleEntityNotFound(_0x2f4e1c,null))[_0xbeaa('0x22')](removeEntity(_0x2f4e1c,null))[_0xbeaa('0x41')](handleError(_0x2f4e1c,null));}; \ No newline at end of file +var _0x2eb6=['../../config/license/util','sendStatus','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','ZendeskField','rawAttributes','fieldName','type','key','query','model','attributes','intersection','fields','nolimit','sort','where','filters','pick','filter','options','include','findAll','catch','show','params','length','includeAll','create','body','find','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment'];(function(_0x4b4b0e,_0x6c674){var _0x4c2d91=function(_0x4d440d){while(--_0x4d440d){_0x4b4b0e['push'](_0x4b4b0e['shift']());}};_0x4c2d91(++_0x6c674);}(_0x2eb6,0x1ce));var _0x62eb=function(_0x28d46f,_0x3b165f){_0x28d46f=_0x28d46f-0x0;var _0x4fda11=_0x2eb6[_0x28d46f];return _0x4fda11;};'use strict';var emlformat=require(_0x62eb('0x0'));var rimraf=require(_0x62eb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x62eb('0x2'));var moment=require(_0x62eb('0x3'));var BPromise=require(_0x62eb('0x4'));var Mustache=require(_0x62eb('0x5'));var util=require(_0x62eb('0x6'));var path=require('path');var sox=require(_0x62eb('0x7'));var csv=require(_0x62eb('0x8'));var ejs=require(_0x62eb('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x62eb('0xa'));var squel=require(_0x62eb('0xb'));var crypto=require(_0x62eb('0xc'));var jsforce=require(_0x62eb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x62eb('0x8'));var querystring=require(_0x62eb('0xe'));var Papa=require('papaparse');var Redis=require(_0x62eb('0xf'));var authService=require(_0x62eb('0x10'));var qs=require(_0x62eb('0x11'));var as=require(_0x62eb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x62eb('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x62eb('0x14'));var licenseUtil=require(_0x62eb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52f252,_0x4ea167){_0x4ea167=_0x4ea167||0xcc;return function(_0x5de334){if(_0x5de334){return _0x52f252[_0x62eb('0x16')](_0x4ea167);}return _0x52f252['status'](_0x4ea167)['end']();};}function respondWithResult(_0x561870,_0x527593){_0x527593=_0x527593||0xc8;return function(_0x48d0dc){if(_0x48d0dc){return _0x561870['status'](_0x527593)[_0x62eb('0x17')](_0x48d0dc);}};}function respondWithFilteredResult(_0x5abaee,_0x219126){return function(_0x22046b){if(_0x22046b){var _0x289050=typeof _0x219126[_0x62eb('0x18')]===_0x62eb('0x19')&&typeof _0x219126[_0x62eb('0x1a')]===_0x62eb('0x19');var _0x208f3d=_0x22046b[_0x62eb('0x1b')];var _0xf94e8=_0x289050?0x0:_0x219126[_0x62eb('0x18')];var _0x53cace=_0x289050?_0x22046b[_0x62eb('0x1b')]:_0x219126[_0x62eb('0x18')]+_0x219126[_0x62eb('0x1a')];var _0x4c8068;if(_0x53cace>=_0x208f3d){_0x53cace=_0x208f3d;_0x4c8068=0xc8;}else{_0x4c8068=0xce;}_0x5abaee[_0x62eb('0x1c')](_0x4c8068);return _0x5abaee['set'](_0x62eb('0x1d'),_0xf94e8+'-'+_0x53cace+'/'+_0x208f3d)[_0x62eb('0x17')](_0x22046b);}return null;};}function patchUpdates(_0x4efbee){return function(_0x5b6da5){try{jsonpatch[_0x62eb('0x1e')](_0x5b6da5,_0x4efbee,!![]);}catch(_0x422e83){return BPromise[_0x62eb('0x1f')](_0x422e83);}return _0x5b6da5[_0x62eb('0x20')]();};}function saveUpdates(_0x161775,_0x39895b){return function(_0x23189b){if(_0x23189b){return _0x23189b[_0x62eb('0x21')](_0x161775)[_0x62eb('0x22')](function(_0x30a27f){return _0x30a27f;});}return null;};}function removeEntity(_0x341625,_0x36b4e0){return function(_0x70fd6e){if(_0x70fd6e){return _0x70fd6e[_0x62eb('0x23')]()['then'](function(){_0x341625['status'](0xcc)[_0x62eb('0x24')]();});}};}function handleEntityNotFound(_0x8a1bf8,_0x162132){return function(_0x273221){if(!_0x273221){_0x8a1bf8[_0x62eb('0x16')](0x194);}return _0x273221;};}function handleError(_0x103d5e,_0x4830af){_0x4830af=_0x4830af||0x1f4;return function(_0x27436a){logger[_0x62eb('0x25')](_0x27436a[_0x62eb('0x26')]);if(_0x27436a['name']){delete _0x27436a[_0x62eb('0x27')];}_0x103d5e['status'](_0x4830af)['send'](_0x27436a);};}exports[_0x62eb('0x28')]=function(_0x37fbb5,_0x9131d){var _0x26221c={},_0x49a5b8={},_0x247d4e={'count':0x0,'rows':[]};var _0x44bc7a=_[_0x62eb('0x29')](db[_0x62eb('0x2a')][_0x62eb('0x2b')],function(_0x39a68f){return{'name':_0x39a68f[_0x62eb('0x2c')],'type':_0x39a68f[_0x62eb('0x2d')][_0x62eb('0x2e')]};});_0x49a5b8['model']=_[_0x62eb('0x29')](_0x44bc7a,_0x62eb('0x27'));_0x49a5b8[_0x62eb('0x2f')]=_['keys'](_0x37fbb5[_0x62eb('0x2f')]);_0x49a5b8['filters']=_['intersection'](_0x49a5b8[_0x62eb('0x30')],_0x49a5b8['query']);_0x26221c[_0x62eb('0x31')]=_[_0x62eb('0x32')](_0x49a5b8[_0x62eb('0x30')],qs[_0x62eb('0x33')](_0x37fbb5[_0x62eb('0x2f')][_0x62eb('0x33')]));_0x26221c[_0x62eb('0x31')]=_0x26221c['attributes']['length']?_0x26221c['attributes']:_0x49a5b8[_0x62eb('0x30')];if(!_0x37fbb5[_0x62eb('0x2f')]['hasOwnProperty'](_0x62eb('0x34'))){_0x26221c[_0x62eb('0x1a')]=qs[_0x62eb('0x1a')](_0x37fbb5[_0x62eb('0x2f')][_0x62eb('0x1a')]);_0x26221c['offset']=qs[_0x62eb('0x18')](_0x37fbb5[_0x62eb('0x2f')]['offset']);}_0x26221c['order']=qs['sort'](_0x37fbb5[_0x62eb('0x2f')][_0x62eb('0x35')]);_0x26221c[_0x62eb('0x36')]=qs[_0x62eb('0x37')](_[_0x62eb('0x38')](_0x37fbb5['query'],_0x49a5b8[_0x62eb('0x37')]),_0x44bc7a);if(_0x37fbb5['query']['filter']){_0x26221c[_0x62eb('0x36')]=_['merge'](_0x26221c[_0x62eb('0x36')],{'$or':_[_0x62eb('0x29')](_0x44bc7a,function(_0x6afd9e){if(_0x6afd9e[_0x62eb('0x2d')]!=='VIRTUAL'){var _0x123a03={};_0x123a03[_0x6afd9e[_0x62eb('0x27')]]={'$like':'%'+_0x37fbb5[_0x62eb('0x2f')][_0x62eb('0x39')]+'%'};return _0x123a03;}})});}_0x26221c=_['merge']({},_0x26221c,_0x37fbb5[_0x62eb('0x3a')]);var _0x1aa21f={'where':_0x26221c['where']};return db[_0x62eb('0x2a')]['count'](_0x1aa21f)[_0x62eb('0x22')](function(_0x15b538){_0x247d4e['count']=_0x15b538;if(_0x37fbb5[_0x62eb('0x2f')]['includeAll']){_0x26221c[_0x62eb('0x3b')]=[{'all':!![]}];}return db['ZendeskField'][_0x62eb('0x3c')](_0x26221c);})[_0x62eb('0x22')](function(_0x2d3282){_0x247d4e['rows']=_0x2d3282;return _0x247d4e;})[_0x62eb('0x22')](respondWithFilteredResult(_0x9131d,_0x26221c))[_0x62eb('0x3d')](handleError(_0x9131d,null));};exports[_0x62eb('0x3e')]=function(_0x376c25,_0x464ad){var _0x32771c={'raw':!![],'where':{'id':_0x376c25[_0x62eb('0x3f')]['id']}},_0x1d2dc5={};_0x1d2dc5[_0x62eb('0x30')]=_['keys'](db['ZendeskField'][_0x62eb('0x2b')]);_0x1d2dc5[_0x62eb('0x2f')]=_['keys'](_0x376c25[_0x62eb('0x2f')]);_0x1d2dc5['filters']=_[_0x62eb('0x32')](_0x1d2dc5['model'],_0x1d2dc5[_0x62eb('0x2f')]);_0x32771c[_0x62eb('0x31')]=_[_0x62eb('0x32')](_0x1d2dc5[_0x62eb('0x30')],qs[_0x62eb('0x33')](_0x376c25['query']['fields']));_0x32771c[_0x62eb('0x31')]=_0x32771c[_0x62eb('0x31')][_0x62eb('0x40')]?_0x32771c[_0x62eb('0x31')]:_0x1d2dc5[_0x62eb('0x30')];if(_0x376c25[_0x62eb('0x2f')][_0x62eb('0x41')]){_0x32771c[_0x62eb('0x3b')]=[{'all':!![]}];}_0x32771c=_['merge']({},_0x32771c,_0x376c25[_0x62eb('0x3a')]);return db['ZendeskField']['find'](_0x32771c)[_0x62eb('0x22')](handleEntityNotFound(_0x464ad,null))['then'](respondWithResult(_0x464ad,null))['catch'](handleError(_0x464ad,null));};exports[_0x62eb('0x42')]=function(_0x2e2190,_0x2cea1b){return db[_0x62eb('0x2a')][_0x62eb('0x42')](_0x2e2190[_0x62eb('0x43')],{})[_0x62eb('0x22')](respondWithResult(_0x2cea1b,0xc9))[_0x62eb('0x3d')](handleError(_0x2cea1b,null));};exports['update']=function(_0x505f56,_0x247f12){if(_0x505f56[_0x62eb('0x43')]['id']){delete _0x505f56['body']['id'];}return db['ZendeskField'][_0x62eb('0x44')]({'where':{'id':_0x505f56[_0x62eb('0x3f')]['id']}})['then'](handleEntityNotFound(_0x247f12,null))[_0x62eb('0x22')](saveUpdates(_0x505f56[_0x62eb('0x43')],null))[_0x62eb('0x22')](respondWithResult(_0x247f12,null))['catch'](handleError(_0x247f12,null));};exports[_0x62eb('0x23')]=function(_0x4f815d,_0x561dde){return db[_0x62eb('0x2a')][_0x62eb('0x44')]({'where':{'id':_0x4f815d[_0x62eb('0x3f')]['id']}})[_0x62eb('0x22')](handleEntityNotFound(_0x561dde,null))['then'](removeEntity(_0x561dde,null))[_0x62eb('0x3d')](handleError(_0x561dde,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index b928d57..e581185 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 _0x335d=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util'];(function(_0xa4aae4,_0x1dbb4e){var _0x266eef=function(_0x3388d1){while(--_0x3388d1){_0xa4aae4['push'](_0xa4aae4['shift']());}};_0x266eef(++_0x1dbb4e);}(_0x335d,0x19e));var _0xd335=function(_0x3b6a3f,_0x1537d5){_0x3b6a3f=_0x3b6a3f-0x0;var _0x3f7379=_0x335d[_0x3b6a3f];return _0x3f7379;};'use strict';var _=require(_0xd335('0x0'));var util=require(_0xd335('0x1'));var logger=require(_0xd335('0x2'))(_0xd335('0x3'));var moment=require(_0xd335('0x4'));var BPromise=require('bluebird');var rp=require(_0xd335('0x5'));var fs=require('fs');var path=require(_0xd335('0x6'));var rimraf=require(_0xd335('0x7'));var config=require(_0xd335('0x8'));var attributes=require('./intZendeskField.attributes');module[_0xd335('0x9')]=function(_0x91f5bc,_0x2310e4){return _0x91f5bc[_0xd335('0xa')](_0xd335('0xb'),attributes,{'tableName':_0xd335('0xc'),'paranoid':![],'indexes':[{'name':_0xd335('0xd'),'fields':[_0xd335('0xe'),_0xd335('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x692b=['FieldId','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./intZendeskField.attributes','exports'];(function(_0x12fe24,_0x4061cd){var _0x309501=function(_0x2c91d8){while(--_0x2c91d8){_0x12fe24['push'](_0x12fe24['shift']());}};_0x309501(++_0x4061cd);}(_0x692b,0x157));var _0xb692=function(_0x539900,_0x54fc35){_0x539900=_0x539900-0x0;var _0x4ac7a8=_0x692b[_0x539900];return _0x4ac7a8;};'use strict';var _=require('lodash');var util=require(_0xb692('0x0'));var logger=require(_0xb692('0x1'))(_0xb692('0x2'));var moment=require('moment');var BPromise=require(_0xb692('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb692('0x4'));var config=require(_0xb692('0x5'));var attributes=require(_0xb692('0x6'));module[_0xb692('0x7')]=function(_0x10256b,_0x53549b){return _0x10256b['define']('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0xb692('0x8')],'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 cf734e1..25241fe 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 _0x57cc=['debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','info','ZendeskField,\x20%s,\x20%s'];(function(_0x52abbf,_0x4596eb){var _0x139e78=function(_0x3f193f){while(--_0x3f193f){_0x52abbf['push'](_0x52abbf['shift']());}};_0x139e78(++_0x4596eb);}(_0x57cc,0x184));var _0xc57c=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0x57cc[_0x349367];return _0x14179b;};'use strict';var _=require(_0xc57c('0x0'));var util=require(_0xc57c('0x1'));var moment=require(_0xc57c('0x2'));var BPromise=require(_0xc57c('0x3'));var rs=require(_0xc57c('0x4'));var fs=require('fs');var Redis=require(_0xc57c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc57c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc57c('0x7'));var client=jayson[_0xc57c('0x8')][_0xc57c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x269196,_0x9dd371,_0x1d9714){return new BPromise(function(_0x29b9dc,_0x2bca8e){return client['request'](_0x269196,_0x1d9714)['then'](function(_0x2e56de){logger[_0xc57c('0xa')](_0xc57c('0xb'),_0x9dd371,'request\x20sent');logger[_0xc57c('0xc')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x9dd371,_0xc57c('0xd'),JSON[_0xc57c('0xe')](_0x2e56de));if(_0x2e56de[_0xc57c('0xf')]){if(_0x2e56de['error'][_0xc57c('0x10')]===0x1f4){logger[_0xc57c('0xf')](_0xc57c('0xb'),_0x9dd371,_0x2e56de[_0xc57c('0xf')][_0xc57c('0x11')]);return _0x2bca8e(_0x2e56de[_0xc57c('0xf')][_0xc57c('0x11')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x9dd371,_0x2e56de[_0xc57c('0xf')][_0xc57c('0x11')]);return _0x29b9dc(_0x2e56de[_0xc57c('0xf')][_0xc57c('0x11')]);}else{logger[_0xc57c('0xa')](_0xc57c('0xb'),_0x9dd371,_0xc57c('0xd'));_0x29b9dc(_0x2e56de[_0xc57c('0x12')][_0xc57c('0x11')]);}})[_0xc57c('0x13')](function(_0x55268e){logger[_0xc57c('0xf')](_0xc57c('0xb'),_0x9dd371,_0x55268e);_0x2bca8e(_0x55268e);});});} \ No newline at end of file +var _0x191c=['error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','ZendeskField,\x20%s,\x20%s','debug','stringify'];(function(_0x1aa049,_0x9ae13c){var _0x357f29=function(_0xfd2f83){while(--_0xfd2f83){_0x1aa049['push'](_0x1aa049['shift']());}};_0x357f29(++_0x9ae13c);}(_0x191c,0x155));var _0xc191=function(_0x2c1aa9,_0x1d1fd9){_0x2c1aa9=_0x2c1aa9-0x0;var _0x3c586e=_0x191c[_0x2c1aa9];return _0x3c586e;};'use strict';var _=require(_0xc191('0x0'));var util=require(_0xc191('0x1'));var moment=require(_0xc191('0x2'));var BPromise=require('bluebird');var rs=require(_0xc191('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc191('0x4'))['db'];var utils=require(_0xc191('0x5'));var logger=require(_0xc191('0x6'))(_0xc191('0x7'));var config=require(_0xc191('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc191('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x136a37,_0x242dfe,_0x772920){return new BPromise(function(_0xee776c,_0x4eb611){return client[_0xc191('0xa')](_0x136a37,_0x772920)[_0xc191('0xb')](function(_0x7d1b22){logger[_0xc191('0xc')](_0xc191('0xd'),_0x242dfe,'request\x20sent');logger[_0xc191('0xe')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x242dfe,'request\x20sent',JSON[_0xc191('0xf')](_0x7d1b22));if(_0x7d1b22[_0xc191('0x10')]){if(_0x7d1b22[_0xc191('0x10')][_0xc191('0x11')]===0x1f4){logger['error'](_0xc191('0xd'),_0x242dfe,_0x7d1b22[_0xc191('0x10')][_0xc191('0x12')]);return _0x4eb611(_0x7d1b22[_0xc191('0x10')][_0xc191('0x12')]);}logger[_0xc191('0x10')](_0xc191('0xd'),_0x242dfe,_0x7d1b22[_0xc191('0x10')][_0xc191('0x12')]);return _0xee776c(_0x7d1b22[_0xc191('0x10')][_0xc191('0x12')]);}else{logger[_0xc191('0xc')](_0xc191('0xd'),_0x242dfe,'request\x20sent');_0xee776c(_0x7d1b22[_0xc191('0x13')][_0xc191('0x12')]);}})[_0xc191('0x14')](function(_0x1686c2){logger[_0xc191('0x10')]('ZendeskField,\x20%s,\x20%s',_0x242dfe,_0x1686c2);_0x4eb611(_0x1686c2);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index faa64fb..32f3ad4 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 _0xcb9e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','put','update','destroy','exports','multer','util','path'];(function(_0x103b91,_0x25f9da){var _0x281218=function(_0x51f68a){while(--_0x51f68a){_0x103b91['push'](_0x103b91['shift']());}};_0x281218(++_0x25f9da);}(_0xcb9e,0x1b6));var _0xecb9=function(_0x1282a6,_0x2be651){_0x1282a6=_0x1282a6-0x0;var _0x3caad3=_0xcb9e[_0x1282a6];return _0x3caad3;};'use strict';var multer=require(_0xecb9('0x0'));var util=require(_0xecb9('0x1'));var path=require(_0xecb9('0x2'));var timeout=require('connect-timeout');var express=require(_0xecb9('0x3'));var router=express[_0xecb9('0x4')]();var fs_extra=require(_0xecb9('0x5'));var auth=require(_0xecb9('0x6'));var interaction=require(_0xecb9('0x7'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0xecb9('0x8')]('/',auth[_0xecb9('0x9')](),controller[_0xecb9('0xa')]);router[_0xecb9('0x8')](_0xecb9('0xb'),auth['isAuthenticated'](),controller[_0xecb9('0xc')]);router[_0xecb9('0x8')](_0xecb9('0xd'),auth[_0xecb9('0x9')](),controller[_0xecb9('0xe')]);router['get'](_0xecb9('0xf'),auth[_0xecb9('0x9')](),controller['getFields']);router[_0xecb9('0x10')]('/',auth[_0xecb9('0x9')](),controller['create']);router[_0xecb9('0x10')](_0xecb9('0xd'),auth[_0xecb9('0x9')](),controller['addConfiguration']);router[_0xecb9('0x11')](_0xecb9('0xb'),auth[_0xecb9('0x9')](),controller[_0xecb9('0x12')]);router['delete'](_0xecb9('0xb'),auth[_0xecb9('0x9')](),controller[_0xecb9('0x13')]);module[_0xecb9('0x14')]=router; \ No newline at end of file +var _0x1eca=['post','addConfiguration','put','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields'];(function(_0x4012f0,_0x13cdf3){var _0x253d7a=function(_0x1c8e35){while(--_0x1c8e35){_0x4012f0['push'](_0x4012f0['shift']());}};_0x253d7a(++_0x13cdf3);}(_0x1eca,0x10f));var _0xa1ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1eca[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa1ec('0x0'));var util=require(_0xa1ec('0x1'));var path=require('path');var timeout=require(_0xa1ec('0x2'));var express=require(_0xa1ec('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa1ec('0x4'));var interaction=require(_0xa1ec('0x5'));var config=require(_0xa1ec('0x6'));var controller=require(_0xa1ec('0x7'));router[_0xa1ec('0x8')]('/',auth[_0xa1ec('0x9')](),controller[_0xa1ec('0xa')]);router[_0xa1ec('0x8')](_0xa1ec('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xa1ec('0x8')](_0xa1ec('0xc'),auth[_0xa1ec('0x9')](),controller['getConfigurations']);router[_0xa1ec('0x8')](_0xa1ec('0xd'),auth[_0xa1ec('0x9')](),controller['getFields']);router[_0xa1ec('0xe')]('/',auth[_0xa1ec('0x9')](),controller['create']);router[_0xa1ec('0xe')](_0xa1ec('0xc'),auth['isAuthenticated'](),controller[_0xa1ec('0xf')]);router[_0xa1ec('0x10')](_0xa1ec('0xb'),auth[_0xa1ec('0x9')](),controller['update']);router['delete'](_0xa1ec('0xb'),auth['isAuthenticated'](),controller[_0xa1ec('0x11')]);module[_0xa1ec('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 979fb63..5adf66a 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 _0x668b=['exports','STRING','sequelize'];(function(_0x580971,_0x10984d){var _0x16d873=function(_0x594084){while(--_0x594084){_0x580971['push'](_0x580971['shift']());}};_0x16d873(++_0x10984d);}(_0x668b,0x140));var _0xb668=function(_0xe4bb3d,_0x21e87e){_0xe4bb3d=_0xe4bb3d-0x0;var _0xd9e51=_0x668b[_0xe4bb3d];return _0xd9e51;};'use strict';var Sequelize=require(_0xb668('0x0'));module[_0xb668('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb668('0x2')]},'host':{'type':Sequelize[_0xb668('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb668('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xb668('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xb668('0x2')]},'refreshToken':{'type':Sequelize[_0xb668('0x2')]}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING'];(function(_0x4f9ae8,_0x1e0972){var _0x5cb56e=function(_0x5571b0){while(--_0x5571b0){_0x4f9ae8['push'](_0x4f9ae8['shift']());}};_0x5cb56e(++_0x1e0972);}(_0x34e8,0x12c));var _0x834e=function(_0x3fbdad,_0x40ece6){_0x3fbdad=_0x3fbdad-0x0;var _0x16d385=_0x34e8[_0x3fbdad];return _0x16d385;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')]},'description':{'type':Sequelize[_0x834e('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x834e('0x2')]},'clientId':{'type':Sequelize[_0x834e('0x2')]},'clientSecret':{'type':Sequelize[_0x834e('0x2')]},'serverUrl':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x834e('0x2')]},'refreshToken':{'type':Sequelize[_0x834e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index de342c8..413469c 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 _0xdcfe=['sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','then','error','name','send','index','map','ZohoAccount','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','params','rawAttributes','create','body','update','find','destroy','getConfigurations','findOne','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','getDescriptions','ZohoConfiguration','ZohoField','Descriptions','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','host','zone','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','refreshToken','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Type','remove','includes','api_name','system_mandatory','push','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x57cfbe,_0x3beeb9){var _0x2087b9=function(_0xbb3317){while(--_0xbb3317){_0x57cfbe['push'](_0x57cfbe['shift']());}};_0x2087b9(++_0x3beeb9);}(_0xdcfe,0x17b));var _0xedcf=function(_0x43c682,_0x41c8a4){_0x43c682=_0x43c682-0x0;var _0x57eefb=_0xdcfe[_0x43c682];return _0x57eefb;};'use strict';var emlformat=require(_0xedcf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xedcf('0x1'));var jsonpatch=require(_0xedcf('0x2'));var rp=require(_0xedcf('0x3'));var moment=require(_0xedcf('0x4'));var BPromise=require(_0xedcf('0x5'));var Mustache=require(_0xedcf('0x6'));var util=require('util');var path=require(_0xedcf('0x7'));var sox=require(_0xedcf('0x8'));var csv=require(_0xedcf('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xedcf('0xa'));var _=require(_0xedcf('0xb'));var squel=require('squel');var crypto=require(_0xedcf('0xc'));var jsforce=require(_0xedcf('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xedcf('0x9'));var querystring=require(_0xedcf('0xe'));var Papa=require(_0xedcf('0xf'));var Redis=require('ioredis');var authService=require(_0xedcf('0x10'));var qs=require(_0xedcf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xedcf('0x12'))('api');var utils=require(_0xedcf('0x13'));var config=require(_0xedcf('0x14'));var licenseUtil=require(_0xedcf('0x15'));var db=require(_0xedcf('0x16'))['db'];var integrations=require(_0xedcf('0x17'));function respondWithStatusCode(_0x38f13b,_0x406aa9){_0x406aa9=_0x406aa9||0xcc;return function(_0xc3f6c5){if(_0xc3f6c5){return _0x38f13b[_0xedcf('0x18')](_0x406aa9);}return _0x38f13b['status'](_0x406aa9)['end']();};}function respondWithResult(_0x4ea5c1,_0x46bcc4){_0x46bcc4=_0x46bcc4||0xc8;return function(_0x36474e){if(_0x36474e){return _0x4ea5c1[_0xedcf('0x19')](_0x46bcc4)[_0xedcf('0x1a')](_0x36474e);}};}function respondWithFilteredResult(_0x1edd92,_0x323d52){return function(_0x2e27a6){if(_0x2e27a6){var _0x37928e=typeof _0x323d52[_0xedcf('0x1b')]==='undefined'&&typeof _0x323d52[_0xedcf('0x1c')]===_0xedcf('0x1d');var _0x315d0d=_0x2e27a6[_0xedcf('0x1e')];var _0x1ad115=_0x37928e?0x0:_0x323d52[_0xedcf('0x1b')];var _0x1e8c36=_0x37928e?_0x2e27a6[_0xedcf('0x1e')]:_0x323d52[_0xedcf('0x1b')]+_0x323d52[_0xedcf('0x1c')];var _0x13937d;if(_0x1e8c36>=_0x315d0d){_0x1e8c36=_0x315d0d;_0x13937d=0xc8;}else{_0x13937d=0xce;}_0x1edd92[_0xedcf('0x19')](_0x13937d);return _0x1edd92[_0xedcf('0x1f')](_0xedcf('0x20'),_0x1ad115+'-'+_0x1e8c36+'/'+_0x315d0d)[_0xedcf('0x1a')](_0x2e27a6);}return null;};}function patchUpdates(_0x533a80){return function(_0x3f57a0){try{jsonpatch['apply'](_0x3f57a0,_0x533a80,!![]);}catch(_0x47d8b0){return BPromise[_0xedcf('0x21')](_0x47d8b0);}return _0x3f57a0['save']();};}function saveUpdates(_0x4c51a9,_0x4f76f2){return function(_0x44ae6f){if(_0x44ae6f){return _0x44ae6f['update'](_0x4c51a9)[_0xedcf('0x22')](function(_0x273d17){return _0x273d17;});}return null;};}function removeEntity(_0x3e20ba,_0x590093){return function(_0xadc3f0){if(_0xadc3f0){return _0xadc3f0['destroy']()[_0xedcf('0x22')](function(){_0x3e20ba['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bb81d,_0x2d38da){return function(_0x41ae9f){if(!_0x41ae9f){_0x5bb81d[_0xedcf('0x18')](0x194);}return _0x41ae9f;};}function handleError(_0x47916d,_0x44e8b0){_0x44e8b0=_0x44e8b0||0x1f4;return function(_0x43abdd){logger[_0xedcf('0x23')](_0x43abdd['stack']);if(_0x43abdd[_0xedcf('0x24')]){delete _0x43abdd['name'];}_0x47916d[_0xedcf('0x19')](_0x44e8b0)[_0xedcf('0x25')](_0x43abdd);};}exports[_0xedcf('0x26')]=function(_0x358c4b,_0x48d5ec){var _0x3f8b4d={},_0x43a734={},_0x2125f7={'count':0x0,'rows':[]};var _0x3c5841=_[_0xedcf('0x27')](db[_0xedcf('0x28')]['rawAttributes'],function(_0x4fde7e){return{'name':_0x4fde7e[_0xedcf('0x29')],'type':_0x4fde7e[_0xedcf('0x2a')][_0xedcf('0x2b')]};});_0x43a734[_0xedcf('0x2c')]=_[_0xedcf('0x27')](_0x3c5841,'name');_0x43a734[_0xedcf('0x2d')]=_[_0xedcf('0x2e')](_0x358c4b[_0xedcf('0x2d')]);_0x43a734[_0xedcf('0x2f')]=_[_0xedcf('0x30')](_0x43a734[_0xedcf('0x2c')],_0x43a734['query']);_0x3f8b4d['attributes']=_['intersection'](_0x43a734[_0xedcf('0x2c')],qs['fields'](_0x358c4b['query'][_0xedcf('0x31')]));_0x3f8b4d['attributes']=_0x3f8b4d[_0xedcf('0x32')][_0xedcf('0x33')]?_0x3f8b4d[_0xedcf('0x32')]:_0x43a734[_0xedcf('0x2c')];if(!_0x358c4b[_0xedcf('0x2d')]['hasOwnProperty'](_0xedcf('0x34'))){_0x3f8b4d['limit']=qs[_0xedcf('0x1c')](_0x358c4b[_0xedcf('0x2d')]['limit']);_0x3f8b4d[_0xedcf('0x1b')]=qs[_0xedcf('0x1b')](_0x358c4b['query'][_0xedcf('0x1b')]);}_0x3f8b4d[_0xedcf('0x35')]=qs[_0xedcf('0x36')](_0x358c4b[_0xedcf('0x2d')][_0xedcf('0x36')]);_0x3f8b4d[_0xedcf('0x37')]=qs[_0xedcf('0x2f')](_[_0xedcf('0x38')](_0x358c4b[_0xedcf('0x2d')],_0x43a734[_0xedcf('0x2f')]),_0x3c5841);if(_0x358c4b['query'][_0xedcf('0x39')]){_0x3f8b4d[_0xedcf('0x37')]=_[_0xedcf('0x3a')](_0x3f8b4d['where'],{'$or':_[_0xedcf('0x27')](_0x3c5841,function(_0x7e274a){if(_0x7e274a[_0xedcf('0x2a')]!==_0xedcf('0x3b')){var _0x30d013={};_0x30d013[_0x7e274a[_0xedcf('0x24')]]={'$like':'%'+_0x358c4b['query'][_0xedcf('0x39')]+'%'};return _0x30d013;}})});}_0x3f8b4d=_[_0xedcf('0x3a')]({},_0x3f8b4d,_0x358c4b[_0xedcf('0x3c')]);var _0x119ef9={'where':_0x3f8b4d[_0xedcf('0x37')]};return db['ZohoAccount']['count'](_0x119ef9)[_0xedcf('0x22')](function(_0x4a7469){_0x2125f7[_0xedcf('0x1e')]=_0x4a7469;if(_0x358c4b[_0xedcf('0x2d')]['includeAll']){_0x3f8b4d[_0xedcf('0x3d')]=[{'all':!![]}];}return db[_0xedcf('0x28')]['findAll'](_0x3f8b4d);})[_0xedcf('0x22')](function(_0x4b6276){_0x2125f7[_0xedcf('0x3e')]=_0x4b6276;return _0x2125f7;})[_0xedcf('0x22')](respondWithFilteredResult(_0x48d5ec,_0x3f8b4d))[_0xedcf('0x3f')](handleError(_0x48d5ec,null));};exports['show']=function(_0x203275,_0x1582a4){var _0x556a42={'raw':![],'where':{'id':_0x203275[_0xedcf('0x40')]['id']}},_0x16e543={};_0x16e543[_0xedcf('0x2c')]=_[_0xedcf('0x2e')](db['ZohoAccount'][_0xedcf('0x41')]);_0x16e543[_0xedcf('0x2d')]=_[_0xedcf('0x2e')](_0x203275[_0xedcf('0x2d')]);_0x16e543[_0xedcf('0x2f')]=_[_0xedcf('0x30')](_0x16e543[_0xedcf('0x2c')],_0x16e543['query']);_0x556a42[_0xedcf('0x32')]=_['intersection'](_0x16e543[_0xedcf('0x2c')],qs[_0xedcf('0x31')](_0x203275[_0xedcf('0x2d')][_0xedcf('0x31')]));_0x556a42[_0xedcf('0x32')]=_0x556a42[_0xedcf('0x32')][_0xedcf('0x33')]?_0x556a42[_0xedcf('0x32')]:_0x16e543[_0xedcf('0x2c')];if(_0x203275[_0xedcf('0x2d')]['includeAll']){_0x556a42['include']=[{'all':!![]}];}_0x556a42=_['merge']({},_0x556a42,_0x203275[_0xedcf('0x3c')]);return db[_0xedcf('0x28')]['find'](_0x556a42)[_0xedcf('0x22')](handleEntityNotFound(_0x1582a4,null))[_0xedcf('0x22')](respondWithResult(_0x1582a4,null))[_0xedcf('0x3f')](handleError(_0x1582a4,null));};exports[_0xedcf('0x42')]=function(_0x4c199a,_0x20152a){return db[_0xedcf('0x28')][_0xedcf('0x42')](_0x4c199a[_0xedcf('0x43')],{})[_0xedcf('0x22')](respondWithResult(_0x20152a,0xc9))[_0xedcf('0x3f')](handleError(_0x20152a,null));};exports[_0xedcf('0x44')]=function(_0x236171,_0x5b92f0){if(_0x236171['body']['id']){delete _0x236171[_0xedcf('0x43')]['id'];}return db[_0xedcf('0x28')][_0xedcf('0x45')]({'where':{'id':_0x236171[_0xedcf('0x40')]['id']}})[_0xedcf('0x22')](handleEntityNotFound(_0x5b92f0,null))[_0xedcf('0x22')](saveUpdates(_0x236171[_0xedcf('0x43')],null))[_0xedcf('0x22')](respondWithResult(_0x5b92f0,null))[_0xedcf('0x3f')](handleError(_0x5b92f0,null));};exports[_0xedcf('0x46')]=function(_0x468a07,_0x16924a){return db[_0xedcf('0x28')][_0xedcf('0x45')]({'where':{'id':_0x468a07[_0xedcf('0x40')]['id']}})[_0xedcf('0x22')](handleEntityNotFound(_0x16924a,null))[_0xedcf('0x22')](removeEntity(_0x16924a,null))[_0xedcf('0x3f')](handleError(_0x16924a,null));};exports[_0xedcf('0x47')]=function(_0x12ee55,_0xb680a1,_0x4cd4c3){var _0x47bc8d={};var _0x1c6dba={};var _0x4c827d;var _0x350bf9;return db['ZohoAccount'][_0xedcf('0x48')]({'where':{'id':_0x12ee55[_0xedcf('0x40')]['id']}})[_0xedcf('0x22')](handleEntityNotFound(_0xb680a1,null))[_0xedcf('0x22')](function(_0x22ee1d){if(_0x22ee1d){_0x4c827d=_0x22ee1d;_0x1c6dba['model']=_[_0xedcf('0x2e')](db['ZohoConfiguration']['rawAttributes']);_0x1c6dba[_0xedcf('0x2d')]=_[_0xedcf('0x2e')](_0x12ee55['query']);_0x1c6dba[_0xedcf('0x2f')]=_['intersection'](_0x1c6dba[_0xedcf('0x2c')],_0x1c6dba[_0xedcf('0x2d')]);_0x47bc8d[_0xedcf('0x32')]=_['intersection'](_0x1c6dba[_0xedcf('0x2c')],qs[_0xedcf('0x31')](_0x12ee55[_0xedcf('0x2d')][_0xedcf('0x31')]));_0x47bc8d[_0xedcf('0x32')]=_0x47bc8d['attributes'][_0xedcf('0x33')]?_0x47bc8d[_0xedcf('0x32')]:_0x1c6dba[_0xedcf('0x2c')];_0x47bc8d[_0xedcf('0x35')]=qs[_0xedcf('0x36')](_0x12ee55['query'][_0xedcf('0x36')]);_0x47bc8d[_0xedcf('0x37')]=qs[_0xedcf('0x2f')](_[_0xedcf('0x38')](_0x12ee55[_0xedcf('0x2d')],_0x1c6dba[_0xedcf('0x2f')]));if(_0x12ee55[_0xedcf('0x2d')]['filter']){_0x47bc8d[_0xedcf('0x37')]=_[_0xedcf('0x3a')](_0x47bc8d['where'],{'$or':_[_0xedcf('0x27')](_0x47bc8d[_0xedcf('0x32')],function(_0x4c6844){var _0x26ca95={};_0x26ca95[_0x4c6844]={'$like':'%'+_0x12ee55['query']['filter']+'%'};return _0x26ca95;})});}_0x47bc8d=_[_0xedcf('0x3a')]({},_0x47bc8d,_0x12ee55['options']);return _0x4c827d['getConfigurations'](_0x47bc8d);}})['then'](function(_0x55eacf){if(_0x55eacf){_0x350bf9=_0x55eacf['length'];if(!_0x12ee55['query'][_0xedcf('0x49')]('nolimit')){_0x47bc8d[_0xedcf('0x1c')]=qs['limit'](_0x12ee55[_0xedcf('0x2d')]['limit']);_0x47bc8d['offset']=qs[_0xedcf('0x1b')](_0x12ee55[_0xedcf('0x2d')][_0xedcf('0x1b')]);}return _0x4c827d[_0xedcf('0x47')](_0x47bc8d);}})['then'](function(_0x199a63){if(_0x199a63){return _0x199a63?{'count':_0x350bf9,'rows':_0x199a63}:null;}})['then'](respondWithResult(_0xb680a1,null))[_0xedcf('0x3f')](handleError(_0xb680a1,null));};exports[_0xedcf('0x4a')]=function(_0x280b61,_0x4d1a27,_0x45dfd4){if(_0x280b61[_0xedcf('0x43')]['id']){delete _0x280b61['body']['id'];}return db[_0xedcf('0x28')]['findOne']({'where':{'id':_0x280b61[_0xedcf('0x40')]['id']}})[_0xedcf('0x22')](handleEntityNotFound(_0x4d1a27,null))[_0xedcf('0x22')](function(_0xfb2eaa){if(_0xfb2eaa){_0x280b61[_0xedcf('0x43')][_0xedcf('0x4b')]=_0xfb2eaa['id'];_0x280b61[_0xedcf('0x43')]['Subjects']=integrations[_0xedcf('0x4c')](_0x280b61[_0xedcf('0x43')][_0xedcf('0x4d')],_0x280b61[_0xedcf('0x43')][_0xedcf('0x2a')]);_0x280b61['body']['Descriptions']=integrations[_0xedcf('0x4e')](_0x280b61[_0xedcf('0x43')][_0xedcf('0x4d')],_0x280b61[_0xedcf('0x43')][_0xedcf('0x2a')]);return db[_0xedcf('0x4f')][_0xedcf('0x42')](_0x280b61[_0xedcf('0x43')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0xedcf('0x50')],'as':_0xedcf('0x51')}]});}return null;})[_0xedcf('0x22')](respondWithResult(_0x4d1a27,null))[_0xedcf('0x3f')](handleError(_0x4d1a27,null));};function getAccessToken(_0x238308){return new Promise(function(_0x31217f,_0x300678){var _0x3b2b7e;switch(_0x238308['zone']){case'US':_0x3b2b7e=_0xedcf('0x52');break;case'AU':_0x3b2b7e=_0xedcf('0x53');break;case'EU':_0x3b2b7e='https://accounts.zoho.eu';break;case'IN':_0x3b2b7e=_0xedcf('0x54');break;case'CN':_0x3b2b7e=_0xedcf('0x55');break;default:_0x3b2b7e=_0xedcf('0x56');break;}var _0x19c801={'method':_0xedcf('0x57'),'uri':_0x3b2b7e+_0xedcf('0x58'),'qs':{'refresh_token':_0x238308['refreshToken'],'client_id':_0x238308[_0xedcf('0x59')],'client_secret':_0x238308[_0xedcf('0x5a')],'grant_type':_0xedcf('0x5b')},'json':!![]};return rp(_0x19c801)['then'](function(_0x344ecb){if(_0x344ecb[_0xedcf('0x5c')]){_0x31217f(_0x344ecb[_0xedcf('0x5c')]);}else{_0x300678('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xedcf('0x3f')](function(_0x151515){_0x300678(_0x151515);});});}exports['getFields']=function(_0xe4d715,_0x5f1519,_0x9e354e){var _0x5358f5,_0x4fd4db,_0x3b290e,_0x352968,_0x6cd88;return db['ZohoAccount'][_0xedcf('0x48')]({'where':{'id':_0xe4d715[_0xedcf('0x40')]['id']},'attributes':['id',_0xedcf('0x5d'),_0xedcf('0x5e'),_0xedcf('0x59'),_0xedcf('0x5a'),_0xedcf('0x5f'),_0xedcf('0x60'),'refreshToken']})[_0xedcf('0x22')](handleEntityNotFound(_0x5f1519,null))[_0xedcf('0x22')](function(_0x7ab072){_0x6cd88=_0x7ab072;_0x5358f5=_0x6cd88[_0xedcf('0x5d')];_0x4fd4db=_0x5358f5===_0xedcf('0x61')?'eu':_0xedcf('0x62');_0x3b290e=_0x6cd88[_0xedcf('0x5f')];var _0x509ad7=_0x3b290e[_0xedcf('0x63')](-0x1);if(_0x509ad7==='/'||_0x509ad7==='\x5c'||_0x509ad7===':'){_0x3b290e=_0x3b290e[_0xedcf('0x64')](0x0,_0x3b290e[_0xedcf('0x65')](_0x509ad7));}if(!_0x6cd88[_0xedcf('0x66')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x6cd88);})[_0xedcf('0x22')](function(_0x16eb5b){if(_0x16eb5b){return rp({'method':'GET','uri':util[_0xedcf('0x67')](_0xedcf('0x68'),_0x4fd4db),'qs':{'module':'Calls'},'headers':{'Authorization':_0xedcf('0x69')+_0x16eb5b},'json':!![]});}})[_0xedcf('0x22')](function(_0x53d2d7){if(_0x53d2d7){if(_0x53d2d7['response']&&_0x53d2d7['response'][_0xedcf('0x23')]){throw new Error(_0x53d2d7[_0xedcf('0x6a')][_0xedcf('0x23')]['message']);}var _0x1926eb=[];var _0x382209=[];var _0xf212e0=[_0xedcf('0x6b'),_0xedcf('0x6c'),_0xedcf('0x6d'),_0xedcf('0x6e'),_0xedcf('0x6f'),_0xedcf('0x70'),'Call_Start_Time',_0xedcf('0x71')];_0x382209=_[_0xedcf('0x72')](_0x53d2d7[_0xedcf('0x31')],function(_0xd3b3d0){return _0xf212e0[_0xedcf('0x73')](_0xd3b3d0[_0xedcf('0x74')]);});for(var _0x5d0b22=0x0;_0x5d0b22<_0x382209[_0xedcf('0x33')];_0x5d0b22++){if(_0x382209[_0x5d0b22][_0xedcf('0x75')]===![]){_0x1926eb[_0xedcf('0x76')]({'id':_0x382209[_0x5d0b22]['id'],'name':_0x382209[_0x5d0b22]['display_label'],'custom':_0x382209[_0x5d0b22][_0xedcf('0x77')],'options':_0x382209[_0x5d0b22][_0xedcf('0x78')]===_0xedcf('0x79')&&_0x382209[_0x5d0b22][_0xedcf('0x7a')][_0xedcf('0x33')]>-0x1?_[_0xedcf('0x27')](_0x382209[_0x5d0b22][_0xedcf('0x7a')],function(_0x2b66d2){return{'name':_0x2b66d2,'value':_0x2b66d2};}):[]});}}return{'count':_0x1926eb[_0xedcf('0x33')],'rows':_0x1926eb};}else{return{'count':0x0,'rows':[]};}})[_0xedcf('0x22')](respondWithResult(_0x5f1519,null))[_0xedcf('0x3f')](function(_0x34c6c0){var _0xc18999=_0xe4d715[_0xedcf('0x2d')][_0xedcf('0x7b')]?0x1f4:_0x34c6c0[_0xedcf('0x7c')]||0x1f4;logger[_0xedcf('0x23')](_0xedcf('0x7d'),_0xedcf('0x7e'),_0xc18999,JSON[_0xedcf('0x7f')](_0x34c6c0));delete _0x34c6c0[_0xedcf('0x24')];if(_0xc18999===0x191){_0xc18999=0x190;}_0x5f1519[_0xedcf('0x19')](_0xc18999)[_0xedcf('0x25')](_0xe4d715[_0xedcf('0x2d')]['test']?{'message':_0xedcf('0x80'),'statusCode':_0x34c6c0[_0xedcf('0x7c')]}:_0x34c6c0);});}; \ No newline at end of file +var _0x17c8=['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','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','destroy','end','name','send','index','map','ZohoAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','length','find','create','body','update','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','channel','Descriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientSecret','refresh_token','access_token','host','clientId','serverUrl','code','refreshToken','zoho.eu','com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','remove','api_name','system_mandatory','push','custom_field','data_type','picklist','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x1e1b18,_0x5d471b){var _0x3da8f2=function(_0x51fe71){while(--_0x51fe71){_0x1e1b18['push'](_0x1e1b18['shift']());}};_0x3da8f2(++_0x5d471b);}(_0x17c8,0x73));var _0x817c=function(_0x1cc50b,_0x297a63){_0x1cc50b=_0x1cc50b-0x0;var _0x580ed7=_0x17c8[_0x1cc50b];return _0x580ed7;};'use strict';var emlformat=require(_0x817c('0x0'));var rimraf=require(_0x817c('0x1'));var zipdir=require(_0x817c('0x2'));var jsonpatch=require(_0x817c('0x3'));var rp=require(_0x817c('0x4'));var moment=require(_0x817c('0x5'));var BPromise=require(_0x817c('0x6'));var Mustache=require(_0x817c('0x7'));var util=require('util');var path=require(_0x817c('0x8'));var sox=require(_0x817c('0x9'));var csv=require(_0x817c('0xa'));var ejs=require(_0x817c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x817c('0xc'));var squel=require(_0x817c('0xd'));var crypto=require('crypto');var jsforce=require(_0x817c('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x817c('0xf'));var Papa=require('papaparse');var Redis=require(_0x817c('0x10'));var authService=require(_0x817c('0x11'));var qs=require(_0x817c('0x12'));var as=require(_0x817c('0x13'));var hardwareService=require(_0x817c('0x14'));var logger=require(_0x817c('0x15'))(_0x817c('0x16'));var utils=require(_0x817c('0x17'));var config=require(_0x817c('0x18'));var licenseUtil=require(_0x817c('0x19'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x211c17,_0x583598){_0x583598=_0x583598||0xcc;return function(_0x2a10c6){if(_0x2a10c6){return _0x211c17[_0x817c('0x1a')](_0x583598);}return _0x211c17[_0x817c('0x1b')](_0x583598)['end']();};}function respondWithResult(_0x30f063,_0x1785fe){_0x1785fe=_0x1785fe||0xc8;return function(_0x2dd75){if(_0x2dd75){return _0x30f063['status'](_0x1785fe)[_0x817c('0x1c')](_0x2dd75);}};}function respondWithFilteredResult(_0x1b8673,_0x196fb8){return function(_0x122e5e){if(_0x122e5e){var _0x168a52=typeof _0x196fb8['offset']===_0x817c('0x1d')&&typeof _0x196fb8[_0x817c('0x1e')]==='undefined';var _0x41eae6=_0x122e5e[_0x817c('0x1f')];var _0x370da6=_0x168a52?0x0:_0x196fb8[_0x817c('0x20')];var _0x33e160=_0x168a52?_0x122e5e['count']:_0x196fb8[_0x817c('0x20')]+_0x196fb8[_0x817c('0x1e')];var _0x189d28;if(_0x33e160>=_0x41eae6){_0x33e160=_0x41eae6;_0x189d28=0xc8;}else{_0x189d28=0xce;}_0x1b8673[_0x817c('0x1b')](_0x189d28);return _0x1b8673['set'](_0x817c('0x21'),_0x370da6+'-'+_0x33e160+'/'+_0x41eae6)[_0x817c('0x1c')](_0x122e5e);}return null;};}function patchUpdates(_0x2f51d0){return function(_0x4efc8c){try{jsonpatch[_0x817c('0x22')](_0x4efc8c,_0x2f51d0,!![]);}catch(_0x315908){return BPromise[_0x817c('0x23')](_0x315908);}return _0x4efc8c[_0x817c('0x24')]();};}function saveUpdates(_0x5b140c,_0x4bc2bb){return function(_0x4f8ed4){if(_0x4f8ed4){return _0x4f8ed4['update'](_0x5b140c)[_0x817c('0x25')](function(_0x5b1fa0){return _0x5b1fa0;});}return null;};}function removeEntity(_0x307e0a,_0x2bc20a){return function(_0x53f9b0){if(_0x53f9b0){return _0x53f9b0[_0x817c('0x26')]()[_0x817c('0x25')](function(){_0x307e0a[_0x817c('0x1b')](0xcc)[_0x817c('0x27')]();});}};}function handleEntityNotFound(_0xd9857,_0x3d2e72){return function(_0x18a5a1){if(!_0x18a5a1){_0xd9857[_0x817c('0x1a')](0x194);}return _0x18a5a1;};}function handleError(_0x1dcff7,_0x200f58){_0x200f58=_0x200f58||0x1f4;return function(_0xecb5d){logger['error'](_0xecb5d['stack']);if(_0xecb5d[_0x817c('0x28')]){delete _0xecb5d['name'];}_0x1dcff7['status'](_0x200f58)[_0x817c('0x29')](_0xecb5d);};}exports[_0x817c('0x2a')]=function(_0x4eaa10,_0x20eda0){var _0xdea689={},_0xdf3944={},_0x4a4e25={'count':0x0,'rows':[]};var _0x2a11bd=_[_0x817c('0x2b')](db[_0x817c('0x2c')][_0x817c('0x2d')],function(_0x3aa720){return{'name':_0x3aa720['fieldName'],'type':_0x3aa720[_0x817c('0x2e')][_0x817c('0x2f')]};});_0xdf3944[_0x817c('0x30')]=_[_0x817c('0x2b')](_0x2a11bd,_0x817c('0x28'));_0xdf3944[_0x817c('0x31')]=_[_0x817c('0x32')](_0x4eaa10['query']);_0xdf3944[_0x817c('0x33')]=_[_0x817c('0x34')](_0xdf3944['model'],_0xdf3944[_0x817c('0x31')]);_0xdea689[_0x817c('0x35')]=_[_0x817c('0x34')](_0xdf3944[_0x817c('0x30')],qs[_0x817c('0x36')](_0x4eaa10[_0x817c('0x31')]['fields']));_0xdea689[_0x817c('0x35')]=_0xdea689[_0x817c('0x35')]['length']?_0xdea689[_0x817c('0x35')]:_0xdf3944[_0x817c('0x30')];if(!_0x4eaa10['query'][_0x817c('0x37')](_0x817c('0x38'))){_0xdea689['limit']=qs[_0x817c('0x1e')](_0x4eaa10[_0x817c('0x31')][_0x817c('0x1e')]);_0xdea689[_0x817c('0x20')]=qs[_0x817c('0x20')](_0x4eaa10[_0x817c('0x31')][_0x817c('0x20')]);}_0xdea689[_0x817c('0x39')]=qs[_0x817c('0x3a')](_0x4eaa10['query'][_0x817c('0x3a')]);_0xdea689[_0x817c('0x3b')]=qs[_0x817c('0x33')](_[_0x817c('0x3c')](_0x4eaa10['query'],_0xdf3944[_0x817c('0x33')]),_0x2a11bd);if(_0x4eaa10[_0x817c('0x31')][_0x817c('0x3d')]){_0xdea689[_0x817c('0x3b')]=_[_0x817c('0x3e')](_0xdea689[_0x817c('0x3b')],{'$or':_['map'](_0x2a11bd,function(_0x3376c2){if(_0x3376c2[_0x817c('0x2e')]!=='VIRTUAL'){var _0x17f9a0={};_0x17f9a0[_0x3376c2[_0x817c('0x28')]]={'$like':'%'+_0x4eaa10[_0x817c('0x31')][_0x817c('0x3d')]+'%'};return _0x17f9a0;}})});}_0xdea689=_[_0x817c('0x3e')]({},_0xdea689,_0x4eaa10[_0x817c('0x3f')]);var _0x24e0f9={'where':_0xdea689[_0x817c('0x3b')]};return db[_0x817c('0x2c')]['count'](_0x24e0f9)[_0x817c('0x25')](function(_0x469e5b){_0x4a4e25['count']=_0x469e5b;if(_0x4eaa10[_0x817c('0x31')][_0x817c('0x40')]){_0xdea689[_0x817c('0x41')]=[{'all':!![]}];}return db[_0x817c('0x2c')][_0x817c('0x42')](_0xdea689);})['then'](function(_0x40570f){_0x4a4e25['rows']=_0x40570f;return _0x4a4e25;})[_0x817c('0x25')](respondWithFilteredResult(_0x20eda0,_0xdea689))[_0x817c('0x43')](handleError(_0x20eda0,null));};exports[_0x817c('0x44')]=function(_0x47e0b3,_0x132089){var _0x136dfe={'raw':![],'where':{'id':_0x47e0b3[_0x817c('0x45')]['id']}},_0x23f9bb={};_0x23f9bb[_0x817c('0x30')]=_[_0x817c('0x32')](db[_0x817c('0x2c')][_0x817c('0x2d')]);_0x23f9bb[_0x817c('0x31')]=_[_0x817c('0x32')](_0x47e0b3[_0x817c('0x31')]);_0x23f9bb[_0x817c('0x33')]=_['intersection'](_0x23f9bb[_0x817c('0x30')],_0x23f9bb[_0x817c('0x31')]);_0x136dfe['attributes']=_[_0x817c('0x34')](_0x23f9bb['model'],qs[_0x817c('0x36')](_0x47e0b3[_0x817c('0x31')][_0x817c('0x36')]));_0x136dfe['attributes']=_0x136dfe[_0x817c('0x35')][_0x817c('0x46')]?_0x136dfe[_0x817c('0x35')]:_0x23f9bb[_0x817c('0x30')];if(_0x47e0b3[_0x817c('0x31')][_0x817c('0x40')]){_0x136dfe[_0x817c('0x41')]=[{'all':!![]}];}_0x136dfe=_['merge']({},_0x136dfe,_0x47e0b3[_0x817c('0x3f')]);return db[_0x817c('0x2c')][_0x817c('0x47')](_0x136dfe)['then'](handleEntityNotFound(_0x132089,null))[_0x817c('0x25')](respondWithResult(_0x132089,null))[_0x817c('0x43')](handleError(_0x132089,null));};exports[_0x817c('0x48')]=function(_0x4a0cfb,_0x3bb035){return db[_0x817c('0x2c')][_0x817c('0x48')](_0x4a0cfb[_0x817c('0x49')],{})['then'](respondWithResult(_0x3bb035,0xc9))[_0x817c('0x43')](handleError(_0x3bb035,null));};exports[_0x817c('0x4a')]=function(_0x7d49c3,_0x43471d){if(_0x7d49c3['body']['id']){delete _0x7d49c3[_0x817c('0x49')]['id'];}return db[_0x817c('0x2c')]['find']({'where':{'id':_0x7d49c3['params']['id']}})['then'](handleEntityNotFound(_0x43471d,null))[_0x817c('0x25')](saveUpdates(_0x7d49c3[_0x817c('0x49')],null))[_0x817c('0x25')](respondWithResult(_0x43471d,null))[_0x817c('0x43')](handleError(_0x43471d,null));};exports[_0x817c('0x26')]=function(_0x1b6999,_0x4f7cf1){return db[_0x817c('0x2c')][_0x817c('0x47')]({'where':{'id':_0x1b6999['params']['id']}})[_0x817c('0x25')](handleEntityNotFound(_0x4f7cf1,null))[_0x817c('0x25')](removeEntity(_0x4f7cf1,null))[_0x817c('0x43')](handleError(_0x4f7cf1,null));};exports[_0x817c('0x4b')]=function(_0x3e4490,_0x1d043a,_0x39790c){var _0x50e6b5={};var _0x21a50d={};var _0x2e8a01;var _0x2c182e;return db['ZohoAccount'][_0x817c('0x4c')]({'where':{'id':_0x3e4490[_0x817c('0x45')]['id']}})[_0x817c('0x25')](handleEntityNotFound(_0x1d043a,null))[_0x817c('0x25')](function(_0x4c402e){if(_0x4c402e){_0x2e8a01=_0x4c402e;_0x21a50d[_0x817c('0x30')]=_[_0x817c('0x32')](db['ZohoConfiguration'][_0x817c('0x2d')]);_0x21a50d['query']=_[_0x817c('0x32')](_0x3e4490[_0x817c('0x31')]);_0x21a50d[_0x817c('0x33')]=_[_0x817c('0x34')](_0x21a50d[_0x817c('0x30')],_0x21a50d[_0x817c('0x31')]);_0x50e6b5['attributes']=_[_0x817c('0x34')](_0x21a50d['model'],qs['fields'](_0x3e4490[_0x817c('0x31')][_0x817c('0x36')]));_0x50e6b5['attributes']=_0x50e6b5[_0x817c('0x35')][_0x817c('0x46')]?_0x50e6b5['attributes']:_0x21a50d[_0x817c('0x30')];_0x50e6b5[_0x817c('0x39')]=qs[_0x817c('0x3a')](_0x3e4490[_0x817c('0x31')]['sort']);_0x50e6b5[_0x817c('0x3b')]=qs[_0x817c('0x33')](_[_0x817c('0x3c')](_0x3e4490[_0x817c('0x31')],_0x21a50d['filters']));if(_0x3e4490[_0x817c('0x31')][_0x817c('0x3d')]){_0x50e6b5[_0x817c('0x3b')]=_[_0x817c('0x3e')](_0x50e6b5['where'],{'$or':_[_0x817c('0x2b')](_0x50e6b5[_0x817c('0x35')],function(_0x2cab99){var _0x446cf0={};_0x446cf0[_0x2cab99]={'$like':'%'+_0x3e4490[_0x817c('0x31')][_0x817c('0x3d')]+'%'};return _0x446cf0;})});}_0x50e6b5=_['merge']({},_0x50e6b5,_0x3e4490[_0x817c('0x3f')]);return _0x2e8a01[_0x817c('0x4b')](_0x50e6b5);}})[_0x817c('0x25')](function(_0x341999){if(_0x341999){_0x2c182e=_0x341999[_0x817c('0x46')];if(!_0x3e4490[_0x817c('0x31')]['hasOwnProperty'](_0x817c('0x38'))){_0x50e6b5[_0x817c('0x1e')]=qs[_0x817c('0x1e')](_0x3e4490[_0x817c('0x31')][_0x817c('0x1e')]);_0x50e6b5[_0x817c('0x20')]=qs['offset'](_0x3e4490[_0x817c('0x31')][_0x817c('0x20')]);}return _0x2e8a01[_0x817c('0x4b')](_0x50e6b5);}})[_0x817c('0x25')](function(_0x28c181){if(_0x28c181){return _0x28c181?{'count':_0x2c182e,'rows':_0x28c181}:null;}})[_0x817c('0x25')](respondWithResult(_0x1d043a,null))[_0x817c('0x43')](handleError(_0x1d043a,null));};exports[_0x817c('0x4d')]=function(_0x4911b5,_0x3540b4,_0x221552){if(_0x4911b5[_0x817c('0x49')]['id']){delete _0x4911b5[_0x817c('0x49')]['id'];}return db[_0x817c('0x2c')][_0x817c('0x4c')]({'where':{'id':_0x4911b5[_0x817c('0x45')]['id']}})['then'](handleEntityNotFound(_0x3540b4,null))[_0x817c('0x25')](function(_0x1913f9){if(_0x1913f9){_0x4911b5[_0x817c('0x49')]['AccountId']=_0x1913f9['id'];_0x4911b5[_0x817c('0x49')][_0x817c('0x4e')]=integrations[_0x817c('0x4f')](_0x4911b5[_0x817c('0x49')][_0x817c('0x50')],_0x4911b5[_0x817c('0x49')]['type']);_0x4911b5[_0x817c('0x49')][_0x817c('0x51')]=integrations['getDescriptions'](_0x4911b5['body'][_0x817c('0x50')],_0x4911b5[_0x817c('0x49')][_0x817c('0x2e')]);return db[_0x817c('0x52')][_0x817c('0x48')](_0x4911b5['body'],{'include':[{'model':db[_0x817c('0x53')],'as':'Subjects'},{'model':db[_0x817c('0x53')],'as':_0x817c('0x51')}]});}return null;})[_0x817c('0x25')](respondWithResult(_0x3540b4,null))[_0x817c('0x43')](handleError(_0x3540b4,null));};function getAccessToken(_0xbdbb6a){return new Promise(function(_0x2f434b,_0x5262b2){var _0x1bf357;switch(_0xbdbb6a[_0x817c('0x54')]){case'US':_0x1bf357=_0x817c('0x55');break;case'AU':_0x1bf357=_0x817c('0x56');break;case'EU':_0x1bf357='https://accounts.zoho.eu';break;case'IN':_0x1bf357=_0x817c('0x57');break;case'CN':_0x1bf357=_0x817c('0x58');break;default:_0x1bf357='https://accounts.zoho.eu';break;}var _0x35174={'method':_0x817c('0x59'),'uri':_0x1bf357+_0x817c('0x5a'),'qs':{'refresh_token':_0xbdbb6a['refreshToken'],'client_id':_0xbdbb6a['clientId'],'client_secret':_0xbdbb6a[_0x817c('0x5b')],'grant_type':_0x817c('0x5c')},'json':!![]};return rp(_0x35174)[_0x817c('0x25')](function(_0xa0432c){if(_0xa0432c[_0x817c('0x5d')]){_0x2f434b(_0xa0432c['access_token']);}else{_0x5262b2('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x817c('0x43')](function(_0x9aa36e){_0x5262b2(_0x9aa36e);});});}exports['getFields']=function(_0x3ae215,_0x1b9251,_0x39d4c3){var _0x1d586a,_0x1742d3,_0x4574f7,_0x1a865e,_0x5cf8c7;return db[_0x817c('0x2c')]['findOne']({'where':{'id':_0x3ae215[_0x817c('0x45')]['id']},'attributes':['id',_0x817c('0x5e'),'zone',_0x817c('0x5f'),_0x817c('0x5b'),_0x817c('0x60'),_0x817c('0x61'),_0x817c('0x62')]})[_0x817c('0x25')](handleEntityNotFound(_0x1b9251,null))[_0x817c('0x25')](function(_0x53d02a){_0x5cf8c7=_0x53d02a;_0x1d586a=_0x5cf8c7[_0x817c('0x5e')];_0x1742d3=_0x1d586a===_0x817c('0x63')?'eu':_0x817c('0x64');_0x4574f7=_0x5cf8c7['serverUrl'];var _0x3eff74=_0x4574f7['slice'](-0x1);if(_0x3eff74==='/'||_0x3eff74==='\x5c'||_0x3eff74===':'){_0x4574f7=_0x4574f7[_0x817c('0x65')](0x0,_0x4574f7[_0x817c('0x66')](_0x3eff74));}if(!_0x5cf8c7['refreshToken']){throw new Error(_0x817c('0x67'));}return getAccessToken(_0x5cf8c7);})[_0x817c('0x25')](function(_0x3fc706){if(_0x3fc706){return rp({'method':_0x817c('0x68'),'uri':util['format'](_0x817c('0x69'),_0x1742d3),'qs':{'module':_0x817c('0x6a')},'headers':{'Authorization':_0x817c('0x6b')+_0x3fc706},'json':!![]});}})['then'](function(_0x5e40f1){if(_0x5e40f1){if(_0x5e40f1[_0x817c('0x6c')]&&_0x5e40f1[_0x817c('0x6c')]['error']){throw new Error(_0x5e40f1[_0x817c('0x6c')][_0x817c('0x6d')][_0x817c('0x6e')]);}var _0x1ec8ad=[];var _0xf9c687=[];var _0x517598=[_0x817c('0x6f'),_0x817c('0x70'),_0x817c('0x71'),_0x817c('0x72'),'Call_Duration',_0x817c('0x73'),_0x817c('0x74'),'Call_Type'];_0xf9c687=_[_0x817c('0x75')](_0x5e40f1[_0x817c('0x36')],function(_0x585f5a){return _0x517598['includes'](_0x585f5a[_0x817c('0x76')]);});for(var _0x4b7bc3=0x0;_0x4b7bc3<_0xf9c687['length'];_0x4b7bc3++){if(_0xf9c687[_0x4b7bc3][_0x817c('0x77')]===![]){_0x1ec8ad[_0x817c('0x78')]({'id':_0xf9c687[_0x4b7bc3]['id'],'name':_0xf9c687[_0x4b7bc3]['display_label'],'custom':_0xf9c687[_0x4b7bc3][_0x817c('0x79')],'options':_0xf9c687[_0x4b7bc3][_0x817c('0x7a')]===_0x817c('0x7b')&&_0xf9c687[_0x4b7bc3][_0x817c('0x7c')][_0x817c('0x46')]>-0x1?_[_0x817c('0x2b')](_0xf9c687[_0x4b7bc3][_0x817c('0x7c')],function(_0x5cbe86){return{'name':_0x5cbe86,'value':_0x5cbe86};}):[]});}}return{'count':_0x1ec8ad[_0x817c('0x46')],'rows':_0x1ec8ad};}else{return{'count':0x0,'rows':[]};}})[_0x817c('0x25')](respondWithResult(_0x1b9251,null))['catch'](function(_0xad7908){var _0x28a17d=_0x3ae215[_0x817c('0x31')]['test']?0x1f4:_0xad7908['statusCode']||0x1f4;logger[_0x817c('0x6d')](_0x817c('0x7d'),'getFields',_0x28a17d,JSON[_0x817c('0x7e')](_0xad7908));delete _0xad7908[_0x817c('0x28')];if(_0x28a17d===0x191){_0x28a17d=0x190;}_0x1b9251[_0x817c('0x1b')](_0x28a17d)[_0x817c('0x29')](_0x3ae215[_0x817c('0x31')][_0x817c('0x7f')]?{'message':_0x817c('0x80'),'statusCode':_0xad7908[_0x817c('0x81')]}:_0xad7908);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 721bde9..7309b8e 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 _0xc0d3=['https://accounts.zoho.eu','authorization_code','serverUrl','then','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','error','name','host','slice','https://accounts.zoho.com.cn','POST','/oauth/v2/token','application/x-www-form-urlencoded','parse','refresh_token','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','changed','zone','clientId','clientSecret','code','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in'];(function(_0x244862,_0x3da79e){var _0x2bce23=function(_0x235ae5){while(--_0x235ae5){_0x244862['push'](_0x244862['shift']());}};_0x2bce23(++_0x3da79e);}(_0xc0d3,0x11d));var _0x3c0d=function(_0x47c3e5,_0x32ce41){_0x47c3e5=_0x47c3e5-0x0;var _0x5e47b3=_0xc0d3[_0x47c3e5];return _0x5e47b3;};'use strict';var _=require(_0x3c0d('0x0'));var util=require(_0x3c0d('0x1'));var logger=require(_0x3c0d('0x2'))(_0x3c0d('0x3'));var moment=require(_0x3c0d('0x4'));var BPromise=require(_0x3c0d('0x5'));var rp=require(_0x3c0d('0x6'));var fs=require('fs');var path=require(_0x3c0d('0x7'));var rimraf=require(_0x3c0d('0x8'));var config=require('../../config/environment');var attributes=require(_0x3c0d('0x9'));var integrations=require(_0x3c0d('0xa'));module[_0x3c0d('0xb')]=function(_0x44d236,_0x148f14){return _0x44d236[_0x3c0d('0xc')]('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x458326,_0x16328b,_0x470592){if(_0x458326[_0x3c0d('0xd')](_0x3c0d('0xe'))||_0x458326[_0x3c0d('0xd')]('serverUrl')||_0x458326[_0x3c0d('0xd')](_0x3c0d('0xf'))||_0x458326['changed'](_0x3c0d('0x10'))||_0x458326['changed'](_0x3c0d('0x11'))||_0x458326[_0x3c0d('0xd')]('host')){var _0x550aff,_0x4fa8e2;_0x550aff=_0x458326['serverUrl'];var _0x408ef8=_0x550aff['slice'](-0x1);if(_0x408ef8==='/'||_0x408ef8==='\x5c'||_0x408ef8===':'){_0x550aff=_0x550aff[_0x3c0d('0x12')](0x0,_0x550aff[_0x3c0d('0x13')](_0x408ef8));}switch(_0x458326['zone']){case'US':_0x4fa8e2=_0x3c0d('0x14');break;case'AU':_0x4fa8e2=_0x3c0d('0x15');break;case'IN':_0x4fa8e2=_0x3c0d('0x16');break;case'CN':_0x4fa8e2='https://accounts.zoho.com.cn';break;default:_0x4fa8e2=_0x3c0d('0x17');break;}var _0x8a4aff={'method':'POST','uri':_0x4fa8e2+'/oauth/v2/token','form':{'grant_type':_0x3c0d('0x18'),'client_id':_0x458326[_0x3c0d('0xf')],'client_secret':_0x458326[_0x3c0d('0x10')],'redirect_uri':_0x458326[_0x3c0d('0x19')],'code':_0x458326[_0x3c0d('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x8a4aff)[_0x3c0d('0x1a')](function(_0xf9f240){var _0x2d86cd=JSON['parse'](_0xf9f240);if(_0x2d86cd['refresh_token']){_0x458326[_0x3c0d('0x1b')]=_0x2d86cd['refresh_token'];logger[_0x3c0d('0x1c')](util[_0x3c0d('0x1d')](_0x3c0d('0x1e'),_0x458326['name'],_0x458326['id']));}else{logger['error'](util['format'](_0x3c0d('0x1f'),_0x458326['name'],_0x458326['id']),util[_0x3c0d('0x20')](_0x2d86cd,{'showHidden':![],'depth':null}));}return _0x470592(null,_0x16328b);})[_0x3c0d('0x21')](function(_0x184aa7){logger[_0x3c0d('0x22')](util[_0x3c0d('0x1d')](_0x3c0d('0x1f'),_0x458326[_0x3c0d('0x23')],_0x458326['id']),util[_0x3c0d('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x470592(_0x184aa7);});}else{return _0x470592(null,_0x16328b);}},'beforeUpdate':function(_0x3cb735,_0x3423d5,_0x4109a3){if(_0x3cb735[_0x3c0d('0xd')](_0x3c0d('0xe'))||_0x3cb735[_0x3c0d('0xd')](_0x3c0d('0x19'))||_0x3cb735[_0x3c0d('0xd')](_0x3c0d('0xf'))||_0x3cb735[_0x3c0d('0xd')](_0x3c0d('0x10'))||_0x3cb735[_0x3c0d('0xd')](_0x3c0d('0x11'))||_0x3cb735[_0x3c0d('0xd')](_0x3c0d('0x24'))){var _0x1fcbe5,_0x8da92d;_0x1fcbe5=_0x3cb735[_0x3c0d('0x19')];var _0x53597c=_0x1fcbe5[_0x3c0d('0x25')](-0x1);if(_0x53597c==='/'||_0x53597c==='\x5c'||_0x53597c===':'){_0x1fcbe5=_0x1fcbe5[_0x3c0d('0x12')](0x0,_0x1fcbe5['lastIndexOf'](_0x53597c));}switch(_0x3cb735[_0x3c0d('0xe')]){case'US':_0x8da92d=_0x3c0d('0x14');break;case'AU':_0x8da92d=_0x3c0d('0x15');break;case'IN':_0x8da92d=_0x3c0d('0x16');break;case'CN':_0x8da92d=_0x3c0d('0x26');break;default:_0x8da92d='https://accounts.zoho.eu';break;}var _0x579ee7={'method':_0x3c0d('0x27'),'uri':_0x8da92d+_0x3c0d('0x28'),'form':{'grant_type':_0x3c0d('0x18'),'client_id':_0x3cb735[_0x3c0d('0xf')],'client_secret':_0x3cb735[_0x3c0d('0x10')],'redirect_uri':_0x3cb735[_0x3c0d('0x19')],'code':_0x3cb735[_0x3c0d('0x11')]},'headers':{'Content-Type':_0x3c0d('0x29')}};return rp(_0x579ee7)[_0x3c0d('0x1a')](function(_0xebde02){var _0x2b5c68=JSON[_0x3c0d('0x2a')](_0xebde02);if(_0x2b5c68[_0x3c0d('0x2b')]){_0x3cb735[_0x3c0d('0x1b')]=_0x2b5c68[_0x3c0d('0x2b')];logger[_0x3c0d('0x1c')](util[_0x3c0d('0x1d')](_0x3c0d('0x1e'),_0x3cb735[_0x3c0d('0x23')],_0x3cb735['id']));}else{logger['error'](util[_0x3c0d('0x1d')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3cb735[_0x3c0d('0x23')],_0x3cb735['id']),util[_0x3c0d('0x20')](_0x2b5c68,{'showHidden':![],'depth':null}));}return _0x4109a3(null,_0x3423d5);})[_0x3c0d('0x21')](function(_0x358b92){logger['error'](util[_0x3c0d('0x1d')](_0x3c0d('0x1f'),_0x3cb735[_0x3c0d('0x23')],_0x3cb735['id']),util[_0x3c0d('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x4109a3(_0x358b92);});}else{return _0x4109a3(null,_0x3423d5);}}}});}; \ No newline at end of file +var _0x9eec=['clientId','parse','refresh_token','refreshToken','info','format','error','name','inspect','slice','https://accounts.zoho.in','application/x-www-form-urlencoded','then','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','changed','clientSecret','code','host','serverUrl','substring','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x9eec,0xe7));var _0xc9ee=function(_0x3daad2,_0x1eabe8){_0x3daad2=_0x3daad2-0x0;var _0x3dc17f=_0x9eec[_0x3daad2];return _0x3dc17f;};'use strict';var _=require(_0xc9ee('0x0'));var util=require(_0xc9ee('0x1'));var logger=require(_0xc9ee('0x2'))(_0xc9ee('0x3'));var moment=require(_0xc9ee('0x4'));var BPromise=require(_0xc9ee('0x5'));var rp=require(_0xc9ee('0x6'));var fs=require('fs');var path=require(_0xc9ee('0x7'));var rimraf=require(_0xc9ee('0x8'));var config=require(_0xc9ee('0x9'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xc9ee('0xa'));module[_0xc9ee('0xb')]=function(_0x1a5f12,_0x2846fd){return _0x1a5f12['define']('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4bc6a1,_0x39bdcd,_0x4eff3b){if(_0x4bc6a1['changed']('zone')||_0x4bc6a1[_0xc9ee('0xc')]('serverUrl')||_0x4bc6a1[_0xc9ee('0xc')]('clientId')||_0x4bc6a1[_0xc9ee('0xc')](_0xc9ee('0xd'))||_0x4bc6a1[_0xc9ee('0xc')](_0xc9ee('0xe'))||_0x4bc6a1[_0xc9ee('0xc')](_0xc9ee('0xf'))){var _0x58dab7,_0x13c0bb;_0x58dab7=_0x4bc6a1[_0xc9ee('0x10')];var _0x3279bb=_0x58dab7['slice'](-0x1);if(_0x3279bb==='/'||_0x3279bb==='\x5c'||_0x3279bb===':'){_0x58dab7=_0x58dab7[_0xc9ee('0x11')](0x0,_0x58dab7[_0xc9ee('0x12')](_0x3279bb));}switch(_0x4bc6a1[_0xc9ee('0x13')]){case'US':_0x13c0bb=_0xc9ee('0x14');break;case'AU':_0x13c0bb=_0xc9ee('0x15');break;case'IN':_0x13c0bb='https://accounts.zoho.in';break;case'CN':_0x13c0bb=_0xc9ee('0x16');break;default:_0x13c0bb=_0xc9ee('0x17');break;}var _0x6a958b={'method':_0xc9ee('0x18'),'uri':_0x13c0bb+_0xc9ee('0x19'),'form':{'grant_type':_0xc9ee('0x1a'),'client_id':_0x4bc6a1[_0xc9ee('0x1b')],'client_secret':_0x4bc6a1[_0xc9ee('0xd')],'redirect_uri':_0x4bc6a1[_0xc9ee('0x10')],'code':_0x4bc6a1[_0xc9ee('0xe')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x6a958b)['then'](function(_0x203e68){var _0x393818=JSON[_0xc9ee('0x1c')](_0x203e68);if(_0x393818[_0xc9ee('0x1d')]){_0x4bc6a1[_0xc9ee('0x1e')]=_0x393818[_0xc9ee('0x1d')];logger[_0xc9ee('0x1f')](util[_0xc9ee('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4bc6a1['name'],_0x4bc6a1['id']));}else{logger[_0xc9ee('0x21')](util[_0xc9ee('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4bc6a1[_0xc9ee('0x22')],_0x4bc6a1['id']),util[_0xc9ee('0x23')](_0x393818,{'showHidden':![],'depth':null}));}return _0x4eff3b(null,_0x39bdcd);})['catch'](function(_0x18ec3a){logger['error'](util[_0xc9ee('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4bc6a1['name'],_0x4bc6a1['id']),util[_0xc9ee('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x4eff3b(_0x18ec3a);});}else{return _0x4eff3b(null,_0x39bdcd);}},'beforeUpdate':function(_0x53cb79,_0xc5adba,_0x5eb9ff){if(_0x53cb79['changed'](_0xc9ee('0x13'))||_0x53cb79[_0xc9ee('0xc')](_0xc9ee('0x10'))||_0x53cb79[_0xc9ee('0xc')](_0xc9ee('0x1b'))||_0x53cb79[_0xc9ee('0xc')](_0xc9ee('0xd'))||_0x53cb79['changed'](_0xc9ee('0xe'))||_0x53cb79[_0xc9ee('0xc')](_0xc9ee('0xf'))){var _0x3b49e6,_0x16646d;_0x3b49e6=_0x53cb79[_0xc9ee('0x10')];var _0x493d19=_0x3b49e6[_0xc9ee('0x24')](-0x1);if(_0x493d19==='/'||_0x493d19==='\x5c'||_0x493d19===':'){_0x3b49e6=_0x3b49e6[_0xc9ee('0x11')](0x0,_0x3b49e6[_0xc9ee('0x12')](_0x493d19));}switch(_0x53cb79['zone']){case'US':_0x16646d=_0xc9ee('0x14');break;case'AU':_0x16646d=_0xc9ee('0x15');break;case'IN':_0x16646d=_0xc9ee('0x25');break;case'CN':_0x16646d=_0xc9ee('0x16');break;default:_0x16646d='https://accounts.zoho.eu';break;}var _0x46c3f1={'method':_0xc9ee('0x18'),'uri':_0x16646d+_0xc9ee('0x19'),'form':{'grant_type':_0xc9ee('0x1a'),'client_id':_0x53cb79['clientId'],'client_secret':_0x53cb79[_0xc9ee('0xd')],'redirect_uri':_0x53cb79[_0xc9ee('0x10')],'code':_0x53cb79[_0xc9ee('0xe')]},'headers':{'Content-Type':_0xc9ee('0x26')}};return rp(_0x46c3f1)[_0xc9ee('0x27')](function(_0x23cd6e){var _0x3898f7=JSON['parse'](_0x23cd6e);if(_0x3898f7['refresh_token']){_0x53cb79[_0xc9ee('0x1e')]=_0x3898f7[_0xc9ee('0x1d')];logger['info'](util['format'](_0xc9ee('0x28'),_0x53cb79['name'],_0x53cb79['id']));}else{logger[_0xc9ee('0x21')](util[_0xc9ee('0x20')](_0xc9ee('0x29'),_0x53cb79[_0xc9ee('0x22')],_0x53cb79['id']),util[_0xc9ee('0x23')](_0x3898f7,{'showHidden':![],'depth':null}));}return _0x5eb9ff(null,_0xc5adba);})[_0xc9ee('0x2a')](function(_0x413cb0){logger[_0xc9ee('0x21')](util['format'](_0xc9ee('0x29'),_0x53cb79['name'],_0x53cb79['id']),util[_0xc9ee('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x5eb9ff(_0x413cb0);});}else{return _0x5eb9ff(null,_0xc5adba);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index cc92b19..6602fa1 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 _0xaec5=['message','catch','GetZohoAccount','findAll','options','raw','where','attributes','include','map','model','ZohoAccount','find','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x315974,_0x1709be){var _0x4c37bb=function(_0x2732bf){while(--_0x2732bf){_0x315974['push'](_0x315974['shift']());}};_0x4c37bb(++_0x1709be);}(_0xaec5,0x92));var _0x5aec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaec5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5aec('0x0'));var util=require(_0x5aec('0x1'));var moment=require(_0x5aec('0x2'));var BPromise=require(_0x5aec('0x3'));var rs=require(_0x5aec('0x4'));var fs=require('fs');var Redis=require(_0x5aec('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5aec('0x6'));var logger=require(_0x5aec('0x7'))(_0x5aec('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x476951,_0x3dae8d,_0x215103){return new BPromise(function(_0x28c362,_0x55c01e){return client[_0x5aec('0x9')](_0x476951,_0x215103)[_0x5aec('0xa')](function(_0x5b5bb3){logger[_0x5aec('0xb')](_0x5aec('0xc'),_0x3dae8d,_0x5aec('0xd'));logger[_0x5aec('0xe')](_0x5aec('0xf'),_0x3dae8d,_0x5aec('0xd'),JSON[_0x5aec('0x10')](_0x5b5bb3));if(_0x5b5bb3['error']){if(_0x5b5bb3['error'][_0x5aec('0x11')]===0x1f4){logger[_0x5aec('0x12')](_0x5aec('0xc'),_0x3dae8d,_0x5b5bb3[_0x5aec('0x12')][_0x5aec('0x13')]);return _0x55c01e(_0x5b5bb3[_0x5aec('0x12')][_0x5aec('0x13')]);}logger[_0x5aec('0x12')](_0x5aec('0xc'),_0x3dae8d,_0x5b5bb3[_0x5aec('0x12')][_0x5aec('0x13')]);return _0x28c362(_0x5b5bb3['error'][_0x5aec('0x13')]);}else{logger[_0x5aec('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x3dae8d,_0x5aec('0xd'));_0x28c362(_0x5b5bb3['result'][_0x5aec('0x13')]);}})[_0x5aec('0x14')](function(_0x28f415){logger[_0x5aec('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x3dae8d,_0x28f415);_0x55c01e(_0x28f415);});});}exports[_0x5aec('0x15')]=function(_0x2c32bf){var _0x1f636a=this;return new Promise(function(_0x4518c9,_0x20433a){return db['ZohoAccount'][_0x5aec('0x16')]({'raw':_0x2c32bf[_0x5aec('0x17')]?_0x2c32bf['options'][_0x5aec('0x18')]===undefined?!![]:![]:!![],'where':_0x2c32bf['options']?_0x2c32bf[_0x5aec('0x17')][_0x5aec('0x19')]||null:null,'attributes':_0x2c32bf[_0x5aec('0x17')]?_0x2c32bf['options'][_0x5aec('0x1a')]||null:null,'limit':_0x2c32bf['options']?_0x2c32bf[_0x5aec('0x17')]['limit']||null:null,'include':_0x2c32bf[_0x5aec('0x17')]?_0x2c32bf[_0x5aec('0x17')][_0x5aec('0x1b')]?_[_0x5aec('0x1c')](_0x2c32bf['options']['include'],function(_0x3da833){return{'model':db[_0x3da833[_0x5aec('0x1d')]],'as':_0x3da833['as'],'attributes':_0x3da833[_0x5aec('0x1a')],'include':_0x3da833['include']?_['map'](_0x3da833[_0x5aec('0x1b')],function(_0x5c30c0){return{'model':db[_0x5c30c0[_0x5aec('0x1d')]],'as':_0x5c30c0['as'],'attributes':_0x5c30c0[_0x5aec('0x1a')],'include':_0x5c30c0[_0x5aec('0x1b')]?_['map'](_0x5c30c0[_0x5aec('0x1b')],function(_0x653572){return{'model':db[_0x653572[_0x5aec('0x1d')]],'as':_0x653572['as'],'attributes':_0x653572[_0x5aec('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5aec('0xa')](function(_0x2fea8b){logger[_0x5aec('0xb')]('GetZohoAccount',_0x2c32bf);logger[_0x5aec('0xe')](_0x5aec('0x15'),_0x2c32bf,JSON['stringify'](_0x2fea8b));_0x4518c9(_0x2fea8b);})['catch'](function(_0x131428){logger[_0x5aec('0x12')]('GetZohoAccount',_0x131428['message'],_0x2c32bf);_0x20433a(_0x1f636a[_0x5aec('0x12')](0x1f4,_0x131428['message']));});});};exports['ShowZohoAccount']=function(_0x2c4b3e){var _0x37e76a=this;return new Promise(function(_0x64f7ed,_0xf74789){return db[_0x5aec('0x1e')][_0x5aec('0x1f')]({'raw':_0x2c4b3e[_0x5aec('0x17')]?_0x2c4b3e[_0x5aec('0x17')][_0x5aec('0x18')]===undefined?!![]:![]:!![],'where':_0x2c4b3e['options']?_0x2c4b3e['options'][_0x5aec('0x19')]||null:null,'attributes':_0x2c4b3e[_0x5aec('0x17')]?_0x2c4b3e[_0x5aec('0x17')][_0x5aec('0x1a')]||null:null,'include':_0x2c4b3e[_0x5aec('0x17')]?_0x2c4b3e[_0x5aec('0x17')][_0x5aec('0x1b')]?_['map'](_0x2c4b3e[_0x5aec('0x17')][_0x5aec('0x1b')],function(_0x55b876){return{'model':db[_0x55b876[_0x5aec('0x1d')]],'as':_0x55b876['as'],'attributes':_0x55b876[_0x5aec('0x1a')],'include':_0x55b876['include']?_[_0x5aec('0x1c')](_0x55b876[_0x5aec('0x1b')],function(_0x2a9162){return{'model':db[_0x2a9162[_0x5aec('0x1d')]],'as':_0x2a9162['as'],'attributes':_0x2a9162['attributes'],'include':_0x2a9162[_0x5aec('0x1b')]?_['map'](_0x2a9162[_0x5aec('0x1b')],function(_0x5353ef){return{'model':db[_0x5353ef[_0x5aec('0x1d')]],'as':_0x5353ef['as'],'attributes':_0x5353ef[_0x5aec('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5aec('0xa')](function(_0x157f5a){logger[_0x5aec('0xb')](_0x5aec('0x20'),_0x2c4b3e);logger[_0x5aec('0xe')](_0x5aec('0x20'),_0x2c4b3e,JSON[_0x5aec('0x10')](_0x157f5a));_0x64f7ed(_0x157f5a);})['catch'](function(_0x47999c){logger[_0x5aec('0x12')](_0x5aec('0x20'),_0x47999c['message'],_0x2c4b3e);_0xf74789(_0x37e76a[_0x5aec('0x12')](0x1f4,_0x47999c[_0x5aec('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['http','info','ZohoAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','ZohoAccount','findAll','options','raw','where','attributes','include','map','model','then','GetZohoAccount','ShowZohoAccount','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3ce878,_0x1e439c){var _0x2a8bdd=function(_0x77aa78){while(--_0x77aa78){_0x3ce878['push'](_0x3ce878['shift']());}};_0x2a8bdd(++_0x1e439c);}(_0x7a54,0x106));var _0x47a5=function(_0x3e9858,_0x32fac1){_0x3e9858=_0x3e9858-0x0;var _0x564ce2=_0x7a54[_0x3e9858];return _0x564ce2;};'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')]('ZohoAccount,\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['GetZohoAccount']=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,'limit':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['limit']||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x5247fd['options'][_0x47a5('0x1b')],function(_0x385687){return{'model':db[_0x385687['model']],'as':_0x385687['as'],'attributes':_0x385687[_0x47a5('0x1a')],'include':_0x385687[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x385687[_0x47a5('0x1b')],function(_0x3abd6a){return{'model':db[_0x3abd6a['model']],'as':_0x3abd6a['as'],'attributes':_0x3abd6a['attributes'],'include':_0x3abd6a[_0x47a5('0x1b')]?_['map'](_0x3abd6a[_0x47a5('0x1b')],function(_0x5b6c4e){return{'model':db[_0x5b6c4e[_0x47a5('0x1d')]],'as':_0x5b6c4e['as'],'attributes':_0x5b6c4e[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x1dac65){logger[_0x47a5('0xb')](_0x47a5('0x1f'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1f'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1dac65));_0xaf70a6(_0x1dac65);})[_0x47a5('0x14')](function(_0x1127f8){logger[_0x47a5('0xf')](_0x47a5('0x1f'),_0x1127f8['message'],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x1127f8['message']));});});};exports[_0x47a5('0x20')]=function(_0x9ac908){var _0x16901f=this;return new Promise(function(_0x4d6b57,_0x256650){return db[_0x47a5('0x15')][_0x47a5('0x21')]({'raw':_0x9ac908[_0x47a5('0x17')]?_0x9ac908['options']['raw']===undefined?!![]:![]:!![],'where':_0x9ac908[_0x47a5('0x17')]?_0x9ac908[_0x47a5('0x17')]['where']||null:null,'attributes':_0x9ac908['options']?_0x9ac908[_0x47a5('0x17')][_0x47a5('0x1a')]||null:null,'include':_0x9ac908['options']?_0x9ac908[_0x47a5('0x17')]['include']?_[_0x47a5('0x1c')](_0x9ac908[_0x47a5('0x17')]['include'],function(_0x4843c0){return{'model':db[_0x4843c0[_0x47a5('0x1d')]],'as':_0x4843c0['as'],'attributes':_0x4843c0['attributes'],'include':_0x4843c0[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x4843c0[_0x47a5('0x1b')],function(_0x52749b){return{'model':db[_0x52749b[_0x47a5('0x1d')]],'as':_0x52749b['as'],'attributes':_0x52749b['attributes'],'include':_0x52749b['include']?_[_0x47a5('0x1c')](_0x52749b['include'],function(_0x25cce0){return{'model':db[_0x25cce0['model']],'as':_0x25cce0['as'],'attributes':_0x25cce0[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x38c8d4){logger[_0x47a5('0xb')](_0x47a5('0x20'),_0x9ac908);logger[_0x47a5('0xd')](_0x47a5('0x20'),_0x9ac908,JSON[_0x47a5('0xe')](_0x38c8d4));_0x4d6b57(_0x38c8d4);})[_0x47a5('0x14')](function(_0x4caed5){logger[_0x47a5('0xf')](_0x47a5('0x20'),_0x4caed5['message'],_0x9ac908);_0x256650(_0x16901f[_0x47a5('0xf')](0x1f4,_0x4caed5[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index e6bea39..0522d16 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 _0xaf29=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getDescriptions','post','create','put','delete','destroy','multer'];(function(_0x54709c,_0x1feaac){var _0x2d1fff=function(_0x2982a6){while(--_0x2982a6){_0x54709c['push'](_0x54709c['shift']());}};_0x2d1fff(++_0x1feaac);}(_0xaf29,0x7d));var _0x9af2=function(_0x5950bd,_0x103e16){_0x5950bd=_0x5950bd-0x0;var _0x33e816=_0xaf29[_0x5950bd];return _0x33e816;};'use strict';var multer=require(_0x9af2('0x0'));var util=require(_0x9af2('0x1'));var path=require(_0x9af2('0x2'));var timeout=require(_0x9af2('0x3'));var express=require('express');var router=express[_0x9af2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9af2('0x5'));var interaction=require(_0x9af2('0x6'));var config=require(_0x9af2('0x7'));var controller=require(_0x9af2('0x8'));router[_0x9af2('0x9')]('/',auth[_0x9af2('0xa')](),controller[_0x9af2('0xb')]);router[_0x9af2('0x9')](_0x9af2('0xc'),auth[_0x9af2('0xa')](),controller[_0x9af2('0xd')]);router[_0x9af2('0x9')](_0x9af2('0xe'),auth[_0x9af2('0xa')](),controller['getFields']);router[_0x9af2('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x9af2('0xf')]);router[_0x9af2('0x10')]('/',auth['isAuthenticated'](),controller[_0x9af2('0x11')]);router[_0x9af2('0x12')]('/:id',auth[_0x9af2('0xa')](),controller['update']);router[_0x9af2('0x13')](_0x9af2('0xc'),auth[_0x9af2('0xa')](),controller[_0x9af2('0x14')]);module['exports']=router; \ No newline at end of file +var _0xddc0=['connect-timeout','express','Router','fs-extra','../../config/environment','isAuthenticated','index','/:id','show','getFields','get','/:id/subjects','getSubjects','create','update','delete','exports','multer','util'];(function(_0x2d8c99,_0x2d77b3){var _0x279ae0=function(_0x5f57ba){while(--_0x5f57ba){_0x2d8c99['push'](_0x2d8c99['shift']());}};_0x279ae0(++_0x2d77b3);}(_0xddc0,0x167));var _0x0ddc=function(_0x4d7116,_0xdb8175){_0x4d7116=_0x4d7116-0x0;var _0x4593dc=_0xddc0[_0x4d7116];return _0x4593dc;};'use strict';var multer=require(_0x0ddc('0x0'));var util=require(_0x0ddc('0x1'));var path=require('path');var timeout=require(_0x0ddc('0x2'));var express=require(_0x0ddc('0x3'));var router=express[_0x0ddc('0x4')]();var fs_extra=require(_0x0ddc('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0ddc('0x6'));var controller=require('./intZohoConfiguration.controller');router['get']('/',auth[_0x0ddc('0x7')](),controller[_0x0ddc('0x8')]);router['get'](_0x0ddc('0x9'),auth[_0x0ddc('0x7')](),controller[_0x0ddc('0xa')]);router['get']('/:id/fields',auth[_0x0ddc('0x7')](),controller[_0x0ddc('0xb')]);router[_0x0ddc('0xc')](_0x0ddc('0xd'),auth[_0x0ddc('0x7')](),controller[_0x0ddc('0xe')]);router[_0x0ddc('0xc')]('/:id/descriptions',auth[_0x0ddc('0x7')](),controller['getDescriptions']);router['post']('/',auth[_0x0ddc('0x7')](),controller[_0x0ddc('0xf')]);router['put'](_0x0ddc('0x9'),auth[_0x0ddc('0x7')](),controller[_0x0ddc('0x10')]);router[_0x0ddc('0x11')]('/:id',auth[_0x0ddc('0x7')](),controller['destroy']);module[_0x0ddc('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 9d96e6f..568280a 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 _0x42fa=['nothing','contact_lead','contact','STRING','sequelize','exports','ENUM','lead'];(function(_0x438269,_0x388a66){var _0x4a4a62=function(_0x5ee232){while(--_0x5ee232){_0x438269['push'](_0x438269['shift']());}};_0x4a4a62(++_0x388a66);}(_0x42fa,0x194));var _0xa42f=function(_0x114196,_0x504dd9){_0x114196=_0x114196-0x0;var _0x504d95=_0x42fa[_0x114196];return _0x504d95;};'use strict';var Sequelize=require(_0xa42f('0x0'));module[_0xa42f('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xa42f('0x2')](_0xa42f('0x3'),'contact',_0xa42f('0x4')),'defaultValue':_0xa42f('0x3')},'moduleSearch':{'type':Sequelize[_0xa42f('0x2')](_0xa42f('0x5'),_0xa42f('0x6'),_0xa42f('0x3')),'defaultValue':_0xa42f('0x5')},'description':{'type':Sequelize[_0xa42f('0x7')]}}; \ No newline at end of file +var _0x8702=['lead','contact','nothing','ENUM','contact_lead','sequelize','STRING'];(function(_0x332f9b,_0x20cf77){var _0x7f3d1c=function(_0x22586e){while(--_0x22586e){_0x332f9b['push'](_0x332f9b['shift']());}};_0x7f3d1c(++_0x20cf77);}(_0x8702,0xad));var _0x2870=function(_0x2943d3,_0x7bbd1c){_0x2943d3=_0x2943d3-0x0;var _0x524d34=_0x8702[_0x2943d3];return _0x524d34;};'use strict';var Sequelize=require(_0x2870('0x0'));module['exports']={'name':{'type':Sequelize[_0x2870('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x2870('0x2'),_0x2870('0x3'),_0x2870('0x4')),'defaultValue':_0x2870('0x2')},'moduleSearch':{'type':Sequelize[_0x2870('0x5')](_0x2870('0x6'),_0x2870('0x3'),_0x2870('0x2')),'defaultValue':_0x2870('0x6')},'description':{'type':Sequelize[_0x2870('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index a5b31d5..4785677 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 _0x1671=['merge','find','create','body','getFields','ZohoField','findOne','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','map','ZohoConfiguration','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','catch','show','params','keys'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0x1671,0x1bf));var _0x1167=function(_0x54f39c,_0xcd647c){_0x54f39c=_0x54f39c-0x0;var _0x2712b1=_0x1671[_0x54f39c];return _0x2712b1;};'use strict';var emlformat=require(_0x1167('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1167('0x1'));var rp=require(_0x1167('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1167('0x3'));var util=require(_0x1167('0x4'));var path=require(_0x1167('0x5'));var sox=require(_0x1167('0x6'));var csv=require(_0x1167('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1167('0x8'));var squel=require('squel');var crypto=require(_0x1167('0x9'));var jsforce=require(_0x1167('0xa'));var deskjs=require(_0x1167('0xb'));var toCsv=require(_0x1167('0x7'));var querystring=require(_0x1167('0xc'));var Papa=require(_0x1167('0xd'));var Redis=require(_0x1167('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1167('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1167('0x10'));var logger=require(_0x1167('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x1167('0x12'));var licenseUtil=require(_0x1167('0x13'));var db=require(_0x1167('0x14'))['db'];function respondWithStatusCode(_0x3b41b2,_0x444088){_0x444088=_0x444088||0xcc;return function(_0x2cf009){if(_0x2cf009){return _0x3b41b2['sendStatus'](_0x444088);}return _0x3b41b2[_0x1167('0x15')](_0x444088)[_0x1167('0x16')]();};}function respondWithResult(_0x2f1141,_0x23358d){_0x23358d=_0x23358d||0xc8;return function(_0x5ca915){if(_0x5ca915){return _0x2f1141[_0x1167('0x15')](_0x23358d)[_0x1167('0x17')](_0x5ca915);}};}function respondWithFilteredResult(_0x540edc,_0x4113f8){return function(_0x30f059){if(_0x30f059){var _0x470435=typeof _0x4113f8['offset']===_0x1167('0x18')&&typeof _0x4113f8['limit']===_0x1167('0x18');var _0x2234ac=_0x30f059[_0x1167('0x19')];var _0x399b00=_0x470435?0x0:_0x4113f8[_0x1167('0x1a')];var _0x415714=_0x470435?_0x30f059[_0x1167('0x19')]:_0x4113f8[_0x1167('0x1a')]+_0x4113f8[_0x1167('0x1b')];var _0x3ea9f8;if(_0x415714>=_0x2234ac){_0x415714=_0x2234ac;_0x3ea9f8=0xc8;}else{_0x3ea9f8=0xce;}_0x540edc[_0x1167('0x15')](_0x3ea9f8);return _0x540edc[_0x1167('0x1c')](_0x1167('0x1d'),_0x399b00+'-'+_0x415714+'/'+_0x2234ac)[_0x1167('0x17')](_0x30f059);}return null;};}function patchUpdates(_0x2ad1dc){return function(_0x4da6d5){try{jsonpatch[_0x1167('0x1e')](_0x4da6d5,_0x2ad1dc,!![]);}catch(_0x47b405){return BPromise['reject'](_0x47b405);}return _0x4da6d5[_0x1167('0x1f')]();};}function saveUpdates(_0x376055,_0x570ec2){return function(_0x137e34){if(_0x137e34){return _0x137e34[_0x1167('0x20')](_0x376055)[_0x1167('0x21')](function(_0x389129){return _0x389129;});}return null;};}function removeEntity(_0xfc41e5,_0x16869b){return function(_0x278bf7){if(_0x278bf7){return _0x278bf7[_0x1167('0x22')]()[_0x1167('0x21')](function(){_0xfc41e5['status'](0xcc)[_0x1167('0x16')]();});}};}function handleEntityNotFound(_0x5f1c11,_0x91f53e){return function(_0x58f929){if(!_0x58f929){_0x5f1c11['sendStatus'](0x194);}return _0x58f929;};}function handleError(_0x134ed6,_0x1569f7){_0x1569f7=_0x1569f7||0x1f4;return function(_0x8e94f9){logger['error'](_0x8e94f9[_0x1167('0x23')]);if(_0x8e94f9[_0x1167('0x24')]){delete _0x8e94f9[_0x1167('0x24')];}_0x134ed6[_0x1167('0x15')](_0x1569f7)[_0x1167('0x25')](_0x8e94f9);};}exports['index']=function(_0x3d4148,_0x28effe){var _0x3c5205={},_0x2ab60b={},_0x5296a6={'count':0x0,'rows':[]};var _0x487993=_[_0x1167('0x26')](db[_0x1167('0x27')][_0x1167('0x28')],function(_0x54657e){return{'name':_0x54657e['fieldName'],'type':_0x54657e[_0x1167('0x29')][_0x1167('0x2a')]};});_0x2ab60b[_0x1167('0x2b')]=_[_0x1167('0x26')](_0x487993,'name');_0x2ab60b[_0x1167('0x2c')]=_['keys'](_0x3d4148[_0x1167('0x2c')]);_0x2ab60b[_0x1167('0x2d')]=_[_0x1167('0x2e')](_0x2ab60b[_0x1167('0x2b')],_0x2ab60b[_0x1167('0x2c')]);_0x3c5205['attributes']=_[_0x1167('0x2e')](_0x2ab60b['model'],qs[_0x1167('0x2f')](_0x3d4148['query'][_0x1167('0x2f')]));_0x3c5205[_0x1167('0x30')]=_0x3c5205[_0x1167('0x30')][_0x1167('0x31')]?_0x3c5205[_0x1167('0x30')]:_0x2ab60b['model'];if(!_0x3d4148[_0x1167('0x2c')][_0x1167('0x32')](_0x1167('0x33'))){_0x3c5205['limit']=qs['limit'](_0x3d4148[_0x1167('0x2c')]['limit']);_0x3c5205[_0x1167('0x1a')]=qs[_0x1167('0x1a')](_0x3d4148['query'][_0x1167('0x1a')]);}_0x3c5205[_0x1167('0x34')]=qs['sort'](_0x3d4148[_0x1167('0x2c')][_0x1167('0x35')]);_0x3c5205[_0x1167('0x36')]=qs[_0x1167('0x2d')](_[_0x1167('0x37')](_0x3d4148[_0x1167('0x2c')],_0x2ab60b[_0x1167('0x2d')]),_0x487993);if(_0x3d4148[_0x1167('0x2c')]['filter']){_0x3c5205[_0x1167('0x36')]=_['merge'](_0x3c5205[_0x1167('0x36')],{'$or':_['map'](_0x487993,function(_0x3d1cb9){if(_0x3d1cb9[_0x1167('0x29')]!=='VIRTUAL'){var _0x153772={};_0x153772[_0x3d1cb9[_0x1167('0x24')]]={'$like':'%'+_0x3d4148[_0x1167('0x2c')][_0x1167('0x38')]+'%'};return _0x153772;}})});}_0x3c5205=_['merge']({},_0x3c5205,_0x3d4148[_0x1167('0x39')]);var _0x4123eb={'where':_0x3c5205[_0x1167('0x36')]};return db[_0x1167('0x27')][_0x1167('0x19')](_0x4123eb)[_0x1167('0x21')](function(_0x5a882c){_0x5296a6[_0x1167('0x19')]=_0x5a882c;if(_0x3d4148[_0x1167('0x2c')][_0x1167('0x3a')]){_0x3c5205[_0x1167('0x3b')]=[{'all':!![]}];}return db[_0x1167('0x27')]['findAll'](_0x3c5205);})[_0x1167('0x21')](function(_0x556991){_0x5296a6['rows']=_0x556991;return _0x5296a6;})[_0x1167('0x21')](respondWithFilteredResult(_0x28effe,_0x3c5205))[_0x1167('0x3c')](handleError(_0x28effe,null));};exports[_0x1167('0x3d')]=function(_0x1793f8,_0xe1faa2){var _0x9b362c={'raw':![],'where':{'id':_0x1793f8[_0x1167('0x3e')]['id']}},_0x447996={};_0x447996[_0x1167('0x2b')]=_[_0x1167('0x3f')](db['ZohoConfiguration']['rawAttributes']);_0x447996[_0x1167('0x2c')]=_[_0x1167('0x3f')](_0x1793f8[_0x1167('0x2c')]);_0x447996['filters']=_[_0x1167('0x2e')](_0x447996['model'],_0x447996[_0x1167('0x2c')]);_0x9b362c['attributes']=_[_0x1167('0x2e')](_0x447996[_0x1167('0x2b')],qs[_0x1167('0x2f')](_0x1793f8[_0x1167('0x2c')][_0x1167('0x2f')]));_0x9b362c[_0x1167('0x30')]=_0x9b362c['attributes']['length']?_0x9b362c['attributes']:_0x447996[_0x1167('0x2b')];if(_0x1793f8[_0x1167('0x2c')][_0x1167('0x3a')]){_0x9b362c[_0x1167('0x3b')]=[{'all':!![]}];}_0x9b362c=_[_0x1167('0x40')]({},_0x9b362c,_0x1793f8[_0x1167('0x39')]);return db[_0x1167('0x27')][_0x1167('0x41')](_0x9b362c)['then'](handleEntityNotFound(_0xe1faa2,null))[_0x1167('0x21')](respondWithResult(_0xe1faa2,null))['catch'](handleError(_0xe1faa2,null));};exports[_0x1167('0x42')]=function(_0x2d1165,_0x4a6012){return db[_0x1167('0x27')][_0x1167('0x42')](_0x2d1165[_0x1167('0x43')],{})[_0x1167('0x21')](respondWithResult(_0x4a6012,0xc9))[_0x1167('0x3c')](handleError(_0x4a6012,null));};exports['update']=function(_0x462487,_0x5093f6){if(_0x462487[_0x1167('0x43')]['id']){delete _0x462487[_0x1167('0x43')]['id'];}return db[_0x1167('0x27')][_0x1167('0x41')]({'where':{'id':_0x462487[_0x1167('0x3e')]['id']}})[_0x1167('0x21')](handleEntityNotFound(_0x5093f6,null))[_0x1167('0x21')](saveUpdates(_0x462487[_0x1167('0x43')],null))[_0x1167('0x21')](respondWithResult(_0x5093f6,null))[_0x1167('0x3c')](handleError(_0x5093f6,null));};exports[_0x1167('0x22')]=function(_0x2be275,_0x5c77eb){return db[_0x1167('0x27')][_0x1167('0x41')]({'where':{'id':_0x2be275[_0x1167('0x3e')]['id']}})[_0x1167('0x21')](handleEntityNotFound(_0x5c77eb,null))[_0x1167('0x21')](removeEntity(_0x5c77eb,null))[_0x1167('0x3c')](handleError(_0x5c77eb,null));};exports[_0x1167('0x44')]=function(_0x232fd5,_0x5b8e7f,_0x4849d3){var _0xa9459={};var _0x508d6a={};var _0x47c71f;var _0x504523;return db[_0x1167('0x27')]['findOne']({'where':{'id':_0x232fd5['params']['id']}})['then'](handleEntityNotFound(_0x5b8e7f,null))['then'](function(_0x59ab51){if(_0x59ab51){_0x47c71f=_0x59ab51;_0x508d6a[_0x1167('0x2b')]=_[_0x1167('0x3f')](db[_0x1167('0x45')][_0x1167('0x28')]);_0x508d6a[_0x1167('0x2c')]=_[_0x1167('0x3f')](_0x232fd5[_0x1167('0x2c')]);_0x508d6a['filters']=_['intersection'](_0x508d6a[_0x1167('0x2b')],_0x508d6a[_0x1167('0x2c')]);_0xa9459[_0x1167('0x30')]=_['intersection'](_0x508d6a[_0x1167('0x2b')],qs[_0x1167('0x2f')](_0x232fd5[_0x1167('0x2c')]['fields']));_0xa9459[_0x1167('0x30')]=_0xa9459[_0x1167('0x30')]['length']?_0xa9459[_0x1167('0x30')]:_0x508d6a[_0x1167('0x2b')];_0xa9459[_0x1167('0x34')]=qs[_0x1167('0x35')](_0x232fd5[_0x1167('0x2c')]['sort']);_0xa9459[_0x1167('0x36')]=qs['filters'](_[_0x1167('0x37')](_0x232fd5[_0x1167('0x2c')],_0x508d6a[_0x1167('0x2d')]));if(_0x232fd5[_0x1167('0x2c')][_0x1167('0x38')]){_0xa9459[_0x1167('0x36')]=_[_0x1167('0x40')](_0xa9459['where'],{'$or':_['map'](_0xa9459[_0x1167('0x30')],function(_0xf0ac36){var _0x190295={};_0x190295[_0xf0ac36]={'$like':'%'+_0x232fd5[_0x1167('0x2c')][_0x1167('0x38')]+'%'};return _0x190295;})});}_0xa9459=_[_0x1167('0x40')]({},_0xa9459,_0x232fd5[_0x1167('0x39')]);return _0x47c71f[_0x1167('0x44')](_0xa9459);}})[_0x1167('0x21')](function(_0x319f8f){if(_0x319f8f){_0x504523=_0x319f8f[_0x1167('0x31')];if(!_0x232fd5[_0x1167('0x2c')]['hasOwnProperty'](_0x1167('0x33'))){_0xa9459[_0x1167('0x1b')]=qs['limit'](_0x232fd5['query'][_0x1167('0x1b')]);_0xa9459[_0x1167('0x1a')]=qs[_0x1167('0x1a')](_0x232fd5['query']['offset']);}return _0x47c71f[_0x1167('0x44')](_0xa9459);}})[_0x1167('0x21')](function(_0x4fb16b){if(_0x4fb16b){return _0x4fb16b?{'count':_0x504523,'rows':_0x4fb16b}:null;}})[_0x1167('0x21')](respondWithResult(_0x5b8e7f,null))[_0x1167('0x3c')](handleError(_0x5b8e7f,null));};exports['getSubjects']=function(_0x2ebe56,_0x25d287,_0x16fcac){var _0x4da82f={};var _0x3364e0={};var _0x19abb0;var _0x3003b1;return db[_0x1167('0x27')][_0x1167('0x46')]({'where':{'id':_0x2ebe56[_0x1167('0x3e')]['id']}})[_0x1167('0x21')](handleEntityNotFound(_0x25d287,null))[_0x1167('0x21')](function(_0x140363){if(_0x140363){_0x19abb0=_0x140363;_0x3364e0[_0x1167('0x2b')]=_[_0x1167('0x3f')](db[_0x1167('0x45')]['rawAttributes']);_0x3364e0[_0x1167('0x2c')]=_['keys'](_0x2ebe56[_0x1167('0x2c')]);_0x3364e0[_0x1167('0x2d')]=_[_0x1167('0x2e')](_0x3364e0[_0x1167('0x2b')],_0x3364e0[_0x1167('0x2c')]);_0x4da82f[_0x1167('0x30')]=_['intersection'](_0x3364e0[_0x1167('0x2b')],qs[_0x1167('0x2f')](_0x2ebe56[_0x1167('0x2c')][_0x1167('0x2f')]));_0x4da82f[_0x1167('0x30')]=_0x4da82f['attributes'][_0x1167('0x31')]?_0x4da82f[_0x1167('0x30')]:_0x3364e0[_0x1167('0x2b')];_0x4da82f[_0x1167('0x34')]=qs[_0x1167('0x35')](_0x2ebe56['query']['sort']);_0x4da82f[_0x1167('0x36')]=qs['filters'](_[_0x1167('0x37')](_0x2ebe56['query'],_0x3364e0[_0x1167('0x2d')]));if(_0x2ebe56[_0x1167('0x2c')][_0x1167('0x38')]){_0x4da82f[_0x1167('0x36')]=_[_0x1167('0x40')](_0x4da82f['where'],{'$or':_[_0x1167('0x26')](_0x4da82f[_0x1167('0x30')],function(_0x128118){var _0x133a32={};_0x133a32[_0x128118]={'$like':'%'+_0x2ebe56[_0x1167('0x2c')][_0x1167('0x38')]+'%'};return _0x133a32;})});}_0x4da82f=_[_0x1167('0x40')]({},_0x4da82f,_0x2ebe56['options']);return _0x19abb0[_0x1167('0x47')](_0x4da82f);}})[_0x1167('0x21')](function(_0x4f5bc5){if(_0x4f5bc5){_0x3003b1=_0x4f5bc5[_0x1167('0x31')];if(!_0x2ebe56[_0x1167('0x2c')][_0x1167('0x32')](_0x1167('0x33'))){_0x4da82f[_0x1167('0x1b')]=qs[_0x1167('0x1b')](_0x2ebe56[_0x1167('0x2c')]['limit']);_0x4da82f[_0x1167('0x1a')]=qs[_0x1167('0x1a')](_0x2ebe56[_0x1167('0x2c')][_0x1167('0x1a')]);}return _0x19abb0[_0x1167('0x47')](_0x4da82f);}})[_0x1167('0x21')](function(_0x5804b5){if(_0x5804b5){return _0x5804b5?{'count':_0x3003b1,'rows':_0x5804b5}:null;}})[_0x1167('0x21')](respondWithResult(_0x25d287,null))['catch'](handleError(_0x25d287,null));};exports['getDescriptions']=function(_0x9df27f,_0x5a6a15,_0x14a58d){var _0x160072={};var _0x4fc1af={};var _0x58f66b;var _0x47486c;return db[_0x1167('0x27')]['findOne']({'where':{'id':_0x9df27f['params']['id']}})['then'](handleEntityNotFound(_0x5a6a15,null))[_0x1167('0x21')](function(_0x4df2d3){if(_0x4df2d3){_0x58f66b=_0x4df2d3;_0x4fc1af[_0x1167('0x2b')]=_[_0x1167('0x3f')](db[_0x1167('0x45')]['rawAttributes']);_0x4fc1af[_0x1167('0x2c')]=_['keys'](_0x9df27f[_0x1167('0x2c')]);_0x4fc1af[_0x1167('0x2d')]=_[_0x1167('0x2e')](_0x4fc1af['model'],_0x4fc1af[_0x1167('0x2c')]);_0x160072[_0x1167('0x30')]=_[_0x1167('0x2e')](_0x4fc1af[_0x1167('0x2b')],qs[_0x1167('0x2f')](_0x9df27f[_0x1167('0x2c')][_0x1167('0x2f')]));_0x160072[_0x1167('0x30')]=_0x160072[_0x1167('0x30')]['length']?_0x160072[_0x1167('0x30')]:_0x4fc1af[_0x1167('0x2b')];_0x160072[_0x1167('0x34')]=qs[_0x1167('0x35')](_0x9df27f[_0x1167('0x2c')]['sort']);_0x160072[_0x1167('0x36')]=qs[_0x1167('0x2d')](_[_0x1167('0x37')](_0x9df27f['query'],_0x4fc1af[_0x1167('0x2d')]));if(_0x9df27f[_0x1167('0x2c')][_0x1167('0x38')]){_0x160072[_0x1167('0x36')]=_[_0x1167('0x40')](_0x160072[_0x1167('0x36')],{'$or':_[_0x1167('0x26')](_0x160072[_0x1167('0x30')],function(_0x54f334){var _0x5d224b={};_0x5d224b[_0x54f334]={'$like':'%'+_0x9df27f['query'][_0x1167('0x38')]+'%'};return _0x5d224b;})});}_0x160072=_[_0x1167('0x40')]({},_0x160072,_0x9df27f[_0x1167('0x39')]);return _0x58f66b[_0x1167('0x48')](_0x160072);}})[_0x1167('0x21')](function(_0x36e0f9){if(_0x36e0f9){_0x47486c=_0x36e0f9[_0x1167('0x31')];if(!_0x9df27f['query']['hasOwnProperty']('nolimit')){_0x160072[_0x1167('0x1b')]=qs[_0x1167('0x1b')](_0x9df27f[_0x1167('0x2c')][_0x1167('0x1b')]);_0x160072['offset']=qs['offset'](_0x9df27f[_0x1167('0x2c')][_0x1167('0x1a')]);}return _0x58f66b[_0x1167('0x48')](_0x160072);}})[_0x1167('0x21')](function(_0x5de978){if(_0x5de978){return _0x5de978?{'count':_0x47486c,'rows':_0x5de978}:null;}})['then'](respondWithResult(_0x5a6a15,null))[_0x1167('0x3c')](handleError(_0x5a6a15,null));}; \ No newline at end of file +var _0xa2c4=['crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','save','update','then','sendStatus','error','stack','name','send','map','ZohoConfiguration','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','keys','find','catch','create','body','destroy','getFields','findOne','ZohoField','hasOwnProperty','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','path','sox','to-csv','ejs','lodash','squel'];(function(_0xf26c47,_0x270265){var _0x241341=function(_0x40f4e4){while(--_0x40f4e4){_0xf26c47['push'](_0xf26c47['shift']());}};_0x241341(++_0x270265);}(_0xa2c4,0x16e));var _0x4a2c=function(_0x3a420b,_0x51af0){_0x3a420b=_0x3a420b-0x0;var _0x48a9d5=_0xa2c4[_0x3a420b];return _0x48a9d5;};'use strict';var emlformat=require(_0x4a2c('0x0'));var rimraf=require(_0x4a2c('0x1'));var zipdir=require(_0x4a2c('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('util');var path=require(_0x4a2c('0x3'));var sox=require(_0x4a2c('0x4'));var csv=require(_0x4a2c('0x5'));var ejs=require(_0x4a2c('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4a2c('0x7'));var squel=require(_0x4a2c('0x8'));var crypto=require(_0x4a2c('0x9'));var jsforce=require(_0x4a2c('0xa'));var deskjs=require(_0x4a2c('0xb'));var toCsv=require(_0x4a2c('0x5'));var querystring=require(_0x4a2c('0xc'));var Papa=require('papaparse');var Redis=require(_0x4a2c('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4a2c('0xe'));var as=require(_0x4a2c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4a2c('0x10'))(_0x4a2c('0x11'));var utils=require(_0x4a2c('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4a2c('0x13'))['db'];function respondWithStatusCode(_0x209c31,_0x1f26f4){_0x1f26f4=_0x1f26f4||0xcc;return function(_0x46c01e){if(_0x46c01e){return _0x209c31['sendStatus'](_0x1f26f4);}return _0x209c31[_0x4a2c('0x14')](_0x1f26f4)[_0x4a2c('0x15')]();};}function respondWithResult(_0x47321d,_0x4a7479){_0x4a7479=_0x4a7479||0xc8;return function(_0x51e0c7){if(_0x51e0c7){return _0x47321d[_0x4a2c('0x14')](_0x4a7479)[_0x4a2c('0x16')](_0x51e0c7);}};}function respondWithFilteredResult(_0x2ce8d8,_0x3a28d6){return function(_0x1f2509){if(_0x1f2509){var _0x53e446=typeof _0x3a28d6[_0x4a2c('0x17')]===_0x4a2c('0x18')&&typeof _0x3a28d6[_0x4a2c('0x19')]===_0x4a2c('0x18');var _0x317b75=_0x1f2509[_0x4a2c('0x1a')];var _0x34419f=_0x53e446?0x0:_0x3a28d6[_0x4a2c('0x17')];var _0x1fbcf6=_0x53e446?_0x1f2509['count']:_0x3a28d6[_0x4a2c('0x17')]+_0x3a28d6[_0x4a2c('0x19')];var _0x1a9980;if(_0x1fbcf6>=_0x317b75){_0x1fbcf6=_0x317b75;_0x1a9980=0xc8;}else{_0x1a9980=0xce;}_0x2ce8d8[_0x4a2c('0x14')](_0x1a9980);return _0x2ce8d8['set']('Content-Range',_0x34419f+'-'+_0x1fbcf6+'/'+_0x317b75)[_0x4a2c('0x16')](_0x1f2509);}return null;};}function patchUpdates(_0x33f2ac){return function(_0xced83d){try{jsonpatch[_0x4a2c('0x1b')](_0xced83d,_0x33f2ac,!![]);}catch(_0x1e3b56){return BPromise['reject'](_0x1e3b56);}return _0xced83d[_0x4a2c('0x1c')]();};}function saveUpdates(_0x3bf6dd,_0x1075c0){return function(_0x958ada){if(_0x958ada){return _0x958ada[_0x4a2c('0x1d')](_0x3bf6dd)[_0x4a2c('0x1e')](function(_0x30fb8b){return _0x30fb8b;});}return null;};}function removeEntity(_0x3f93d1,_0x56a32e){return function(_0x36f2ca){if(_0x36f2ca){return _0x36f2ca['destroy']()[_0x4a2c('0x1e')](function(){_0x3f93d1['status'](0xcc)[_0x4a2c('0x15')]();});}};}function handleEntityNotFound(_0x45e8fb,_0x3ca340){return function(_0x440368){if(!_0x440368){_0x45e8fb[_0x4a2c('0x1f')](0x194);}return _0x440368;};}function handleError(_0x35e668,_0x19eb69){_0x19eb69=_0x19eb69||0x1f4;return function(_0x3a1ea6){logger[_0x4a2c('0x20')](_0x3a1ea6[_0x4a2c('0x21')]);if(_0x3a1ea6[_0x4a2c('0x22')]){delete _0x3a1ea6[_0x4a2c('0x22')];}_0x35e668[_0x4a2c('0x14')](_0x19eb69)[_0x4a2c('0x23')](_0x3a1ea6);};}exports['index']=function(_0xe222aa,_0x2fc0eb){var _0x3ef158={},_0x10acbf={},_0x33902a={'count':0x0,'rows':[]};var _0x460224=_[_0x4a2c('0x24')](db[_0x4a2c('0x25')][_0x4a2c('0x26')],function(_0xdca2cb){return{'name':_0xdca2cb[_0x4a2c('0x27')],'type':_0xdca2cb[_0x4a2c('0x28')][_0x4a2c('0x29')]};});_0x10acbf['model']=_['map'](_0x460224,'name');_0x10acbf['query']=_['keys'](_0xe222aa[_0x4a2c('0x2a')]);_0x10acbf[_0x4a2c('0x2b')]=_[_0x4a2c('0x2c')](_0x10acbf[_0x4a2c('0x2d')],_0x10acbf[_0x4a2c('0x2a')]);_0x3ef158[_0x4a2c('0x2e')]=_[_0x4a2c('0x2c')](_0x10acbf[_0x4a2c('0x2d')],qs[_0x4a2c('0x2f')](_0xe222aa[_0x4a2c('0x2a')][_0x4a2c('0x2f')]));_0x3ef158[_0x4a2c('0x2e')]=_0x3ef158[_0x4a2c('0x2e')][_0x4a2c('0x30')]?_0x3ef158[_0x4a2c('0x2e')]:_0x10acbf[_0x4a2c('0x2d')];if(!_0xe222aa['query']['hasOwnProperty']('nolimit')){_0x3ef158['limit']=qs['limit'](_0xe222aa[_0x4a2c('0x2a')][_0x4a2c('0x19')]);_0x3ef158[_0x4a2c('0x17')]=qs['offset'](_0xe222aa[_0x4a2c('0x2a')]['offset']);}_0x3ef158[_0x4a2c('0x31')]=qs[_0x4a2c('0x32')](_0xe222aa['query'][_0x4a2c('0x32')]);_0x3ef158[_0x4a2c('0x33')]=qs[_0x4a2c('0x2b')](_[_0x4a2c('0x34')](_0xe222aa['query'],_0x10acbf[_0x4a2c('0x2b')]),_0x460224);if(_0xe222aa[_0x4a2c('0x2a')][_0x4a2c('0x35')]){_0x3ef158[_0x4a2c('0x33')]=_['merge'](_0x3ef158['where'],{'$or':_['map'](_0x460224,function(_0x432a8a){if(_0x432a8a[_0x4a2c('0x28')]!==_0x4a2c('0x36')){var _0x6bc970={};_0x6bc970[_0x432a8a[_0x4a2c('0x22')]]={'$like':'%'+_0xe222aa[_0x4a2c('0x2a')]['filter']+'%'};return _0x6bc970;}})});}_0x3ef158=_[_0x4a2c('0x37')]({},_0x3ef158,_0xe222aa[_0x4a2c('0x38')]);var _0x5eef49={'where':_0x3ef158['where']};return db[_0x4a2c('0x25')][_0x4a2c('0x1a')](_0x5eef49)[_0x4a2c('0x1e')](function(_0xc82214){_0x33902a[_0x4a2c('0x1a')]=_0xc82214;if(_0xe222aa[_0x4a2c('0x2a')][_0x4a2c('0x39')]){_0x3ef158[_0x4a2c('0x3a')]=[{'all':!![]}];}return db[_0x4a2c('0x25')]['findAll'](_0x3ef158);})[_0x4a2c('0x1e')](function(_0x301036){_0x33902a[_0x4a2c('0x3b')]=_0x301036;return _0x33902a;})['then'](respondWithFilteredResult(_0x2fc0eb,_0x3ef158))['catch'](handleError(_0x2fc0eb,null));};exports[_0x4a2c('0x3c')]=function(_0x3fed3b,_0x117e97){var _0x13285a={'raw':![],'where':{'id':_0x3fed3b[_0x4a2c('0x3d')]['id']}},_0x29b0f9={};_0x29b0f9[_0x4a2c('0x2d')]=_['keys'](db[_0x4a2c('0x25')][_0x4a2c('0x26')]);_0x29b0f9[_0x4a2c('0x2a')]=_[_0x4a2c('0x3e')](_0x3fed3b[_0x4a2c('0x2a')]);_0x29b0f9[_0x4a2c('0x2b')]=_['intersection'](_0x29b0f9[_0x4a2c('0x2d')],_0x29b0f9['query']);_0x13285a[_0x4a2c('0x2e')]=_[_0x4a2c('0x2c')](_0x29b0f9[_0x4a2c('0x2d')],qs[_0x4a2c('0x2f')](_0x3fed3b[_0x4a2c('0x2a')][_0x4a2c('0x2f')]));_0x13285a[_0x4a2c('0x2e')]=_0x13285a[_0x4a2c('0x2e')][_0x4a2c('0x30')]?_0x13285a[_0x4a2c('0x2e')]:_0x29b0f9[_0x4a2c('0x2d')];if(_0x3fed3b[_0x4a2c('0x2a')][_0x4a2c('0x39')]){_0x13285a[_0x4a2c('0x3a')]=[{'all':!![]}];}_0x13285a=_[_0x4a2c('0x37')]({},_0x13285a,_0x3fed3b[_0x4a2c('0x38')]);return db[_0x4a2c('0x25')][_0x4a2c('0x3f')](_0x13285a)['then'](handleEntityNotFound(_0x117e97,null))[_0x4a2c('0x1e')](respondWithResult(_0x117e97,null))[_0x4a2c('0x40')](handleError(_0x117e97,null));};exports[_0x4a2c('0x41')]=function(_0x49263e,_0x157e3e){return db[_0x4a2c('0x25')][_0x4a2c('0x41')](_0x49263e[_0x4a2c('0x42')],{})['then'](respondWithResult(_0x157e3e,0xc9))[_0x4a2c('0x40')](handleError(_0x157e3e,null));};exports[_0x4a2c('0x1d')]=function(_0xc9801e,_0x13a639){if(_0xc9801e[_0x4a2c('0x42')]['id']){delete _0xc9801e[_0x4a2c('0x42')]['id'];}return db['ZohoConfiguration'][_0x4a2c('0x3f')]({'where':{'id':_0xc9801e['params']['id']}})[_0x4a2c('0x1e')](handleEntityNotFound(_0x13a639,null))[_0x4a2c('0x1e')](saveUpdates(_0xc9801e[_0x4a2c('0x42')],null))['then'](respondWithResult(_0x13a639,null))[_0x4a2c('0x40')](handleError(_0x13a639,null));};exports[_0x4a2c('0x43')]=function(_0x433fcc,_0x3b2a38){return db[_0x4a2c('0x25')][_0x4a2c('0x3f')]({'where':{'id':_0x433fcc['params']['id']}})['then'](handleEntityNotFound(_0x3b2a38,null))[_0x4a2c('0x1e')](removeEntity(_0x3b2a38,null))['catch'](handleError(_0x3b2a38,null));};exports[_0x4a2c('0x44')]=function(_0x3581a0,_0x5c32c7,_0x44d586){var _0x509331={};var _0x1577a5={};var _0x4c0fb6;var _0x16daac;return db[_0x4a2c('0x25')][_0x4a2c('0x45')]({'where':{'id':_0x3581a0['params']['id']}})['then'](handleEntityNotFound(_0x5c32c7,null))[_0x4a2c('0x1e')](function(_0x516f86){if(_0x516f86){_0x4c0fb6=_0x516f86;_0x1577a5[_0x4a2c('0x2d')]=_[_0x4a2c('0x3e')](db[_0x4a2c('0x46')][_0x4a2c('0x26')]);_0x1577a5['query']=_['keys'](_0x3581a0['query']);_0x1577a5[_0x4a2c('0x2b')]=_['intersection'](_0x1577a5[_0x4a2c('0x2d')],_0x1577a5[_0x4a2c('0x2a')]);_0x509331[_0x4a2c('0x2e')]=_[_0x4a2c('0x2c')](_0x1577a5['model'],qs[_0x4a2c('0x2f')](_0x3581a0[_0x4a2c('0x2a')][_0x4a2c('0x2f')]));_0x509331[_0x4a2c('0x2e')]=_0x509331[_0x4a2c('0x2e')][_0x4a2c('0x30')]?_0x509331[_0x4a2c('0x2e')]:_0x1577a5['model'];_0x509331[_0x4a2c('0x31')]=qs[_0x4a2c('0x32')](_0x3581a0[_0x4a2c('0x2a')]['sort']);_0x509331[_0x4a2c('0x33')]=qs[_0x4a2c('0x2b')](_[_0x4a2c('0x34')](_0x3581a0[_0x4a2c('0x2a')],_0x1577a5[_0x4a2c('0x2b')]));if(_0x3581a0['query'][_0x4a2c('0x35')]){_0x509331[_0x4a2c('0x33')]=_[_0x4a2c('0x37')](_0x509331[_0x4a2c('0x33')],{'$or':_[_0x4a2c('0x24')](_0x509331[_0x4a2c('0x2e')],function(_0x76c34d){var _0x3767a0={};_0x3767a0[_0x76c34d]={'$like':'%'+_0x3581a0[_0x4a2c('0x2a')][_0x4a2c('0x35')]+'%'};return _0x3767a0;})});}_0x509331=_['merge']({},_0x509331,_0x3581a0[_0x4a2c('0x38')]);return _0x4c0fb6[_0x4a2c('0x44')](_0x509331);}})['then'](function(_0x44da73){if(_0x44da73){_0x16daac=_0x44da73['length'];if(!_0x3581a0[_0x4a2c('0x2a')][_0x4a2c('0x47')]('nolimit')){_0x509331[_0x4a2c('0x19')]=qs[_0x4a2c('0x19')](_0x3581a0[_0x4a2c('0x2a')][_0x4a2c('0x19')]);_0x509331[_0x4a2c('0x17')]=qs['offset'](_0x3581a0[_0x4a2c('0x2a')][_0x4a2c('0x17')]);}return _0x4c0fb6[_0x4a2c('0x44')](_0x509331);}})['then'](function(_0x1f9631){if(_0x1f9631){return _0x1f9631?{'count':_0x16daac,'rows':_0x1f9631}:null;}})[_0x4a2c('0x1e')](respondWithResult(_0x5c32c7,null))[_0x4a2c('0x40')](handleError(_0x5c32c7,null));};exports[_0x4a2c('0x48')]=function(_0x430594,_0x358973,_0x115fd8){var _0x32231b={};var _0x25a69e={};var _0x20deb9;var _0x19598a;return db[_0x4a2c('0x25')][_0x4a2c('0x45')]({'where':{'id':_0x430594[_0x4a2c('0x3d')]['id']}})[_0x4a2c('0x1e')](handleEntityNotFound(_0x358973,null))['then'](function(_0x30c45b){if(_0x30c45b){_0x20deb9=_0x30c45b;_0x25a69e[_0x4a2c('0x2d')]=_['keys'](db[_0x4a2c('0x46')][_0x4a2c('0x26')]);_0x25a69e[_0x4a2c('0x2a')]=_[_0x4a2c('0x3e')](_0x430594[_0x4a2c('0x2a')]);_0x25a69e['filters']=_[_0x4a2c('0x2c')](_0x25a69e[_0x4a2c('0x2d')],_0x25a69e[_0x4a2c('0x2a')]);_0x32231b[_0x4a2c('0x2e')]=_['intersection'](_0x25a69e[_0x4a2c('0x2d')],qs[_0x4a2c('0x2f')](_0x430594[_0x4a2c('0x2a')][_0x4a2c('0x2f')]));_0x32231b[_0x4a2c('0x2e')]=_0x32231b[_0x4a2c('0x2e')][_0x4a2c('0x30')]?_0x32231b[_0x4a2c('0x2e')]:_0x25a69e['model'];_0x32231b[_0x4a2c('0x31')]=qs['sort'](_0x430594[_0x4a2c('0x2a')][_0x4a2c('0x32')]);_0x32231b[_0x4a2c('0x33')]=qs[_0x4a2c('0x2b')](_[_0x4a2c('0x34')](_0x430594[_0x4a2c('0x2a')],_0x25a69e[_0x4a2c('0x2b')]));if(_0x430594['query']['filter']){_0x32231b[_0x4a2c('0x33')]=_[_0x4a2c('0x37')](_0x32231b['where'],{'$or':_[_0x4a2c('0x24')](_0x32231b[_0x4a2c('0x2e')],function(_0x23e22d){var _0x32d3a3={};_0x32d3a3[_0x23e22d]={'$like':'%'+_0x430594['query'][_0x4a2c('0x35')]+'%'};return _0x32d3a3;})});}_0x32231b=_[_0x4a2c('0x37')]({},_0x32231b,_0x430594[_0x4a2c('0x38')]);return _0x20deb9[_0x4a2c('0x48')](_0x32231b);}})['then'](function(_0x283065){if(_0x283065){_0x19598a=_0x283065[_0x4a2c('0x30')];if(!_0x430594[_0x4a2c('0x2a')][_0x4a2c('0x47')](_0x4a2c('0x49'))){_0x32231b['limit']=qs['limit'](_0x430594['query']['limit']);_0x32231b[_0x4a2c('0x17')]=qs['offset'](_0x430594[_0x4a2c('0x2a')][_0x4a2c('0x17')]);}return _0x20deb9[_0x4a2c('0x48')](_0x32231b);}})[_0x4a2c('0x1e')](function(_0x55364d){if(_0x55364d){return _0x55364d?{'count':_0x19598a,'rows':_0x55364d}:null;}})[_0x4a2c('0x1e')](respondWithResult(_0x358973,null))[_0x4a2c('0x40')](handleError(_0x358973,null));};exports['getDescriptions']=function(_0x3b6914,_0x2df439,_0x10a857){var _0x1469fc={};var _0xa673c4={};var _0x23faee;var _0xce92e3;return db[_0x4a2c('0x25')][_0x4a2c('0x45')]({'where':{'id':_0x3b6914[_0x4a2c('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2df439,null))[_0x4a2c('0x1e')](function(_0x185881){if(_0x185881){_0x23faee=_0x185881;_0xa673c4[_0x4a2c('0x2d')]=_[_0x4a2c('0x3e')](db['ZohoField'][_0x4a2c('0x26')]);_0xa673c4[_0x4a2c('0x2a')]=_[_0x4a2c('0x3e')](_0x3b6914[_0x4a2c('0x2a')]);_0xa673c4[_0x4a2c('0x2b')]=_['intersection'](_0xa673c4[_0x4a2c('0x2d')],_0xa673c4[_0x4a2c('0x2a')]);_0x1469fc['attributes']=_['intersection'](_0xa673c4[_0x4a2c('0x2d')],qs[_0x4a2c('0x2f')](_0x3b6914['query']['fields']));_0x1469fc[_0x4a2c('0x2e')]=_0x1469fc[_0x4a2c('0x2e')][_0x4a2c('0x30')]?_0x1469fc[_0x4a2c('0x2e')]:_0xa673c4['model'];_0x1469fc[_0x4a2c('0x31')]=qs['sort'](_0x3b6914[_0x4a2c('0x2a')][_0x4a2c('0x32')]);_0x1469fc['where']=qs[_0x4a2c('0x2b')](_[_0x4a2c('0x34')](_0x3b6914[_0x4a2c('0x2a')],_0xa673c4[_0x4a2c('0x2b')]));if(_0x3b6914['query'][_0x4a2c('0x35')]){_0x1469fc[_0x4a2c('0x33')]=_[_0x4a2c('0x37')](_0x1469fc[_0x4a2c('0x33')],{'$or':_[_0x4a2c('0x24')](_0x1469fc[_0x4a2c('0x2e')],function(_0x1ae8c5){var _0x117904={};_0x117904[_0x1ae8c5]={'$like':'%'+_0x3b6914[_0x4a2c('0x2a')]['filter']+'%'};return _0x117904;})});}_0x1469fc=_[_0x4a2c('0x37')]({},_0x1469fc,_0x3b6914['options']);return _0x23faee[_0x4a2c('0x4a')](_0x1469fc);}})['then'](function(_0x51d5de){if(_0x51d5de){_0xce92e3=_0x51d5de['length'];if(!_0x3b6914[_0x4a2c('0x2a')][_0x4a2c('0x47')](_0x4a2c('0x49'))){_0x1469fc[_0x4a2c('0x19')]=qs[_0x4a2c('0x19')](_0x3b6914['query']['limit']);_0x1469fc['offset']=qs[_0x4a2c('0x17')](_0x3b6914['query'][_0x4a2c('0x17')]);}return _0x23faee['getDescriptions'](_0x1469fc);}})[_0x4a2c('0x1e')](function(_0x49f470){if(_0x49f470){return _0x49f470?{'count':_0xce92e3,'rows':_0x49f470}:null;}})[_0x4a2c('0x1e')](respondWithResult(_0x2df439,null))['catch'](handleError(_0x2df439,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index d3f2a7e..f86fb76 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 _0xeab2=['bluebird','request-promise','path','rimraf','exports','define','int_zoho_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x4e6b5f,_0x210669){var _0x2b8864=function(_0x5c4421){while(--_0x5c4421){_0x4e6b5f['push'](_0x4e6b5f['shift']());}};_0x2b8864(++_0x210669);}(_0xeab2,0x1cf));var _0x2eab=function(_0x3f88bc,_0xe38cf5){_0x3f88bc=_0x3f88bc-0x0;var _0x4df1c4=_0xeab2[_0x3f88bc];return _0x4df1c4;};'use strict';var _=require(_0x2eab('0x0'));var util=require(_0x2eab('0x1'));var logger=require(_0x2eab('0x2'))(_0x2eab('0x3'));var moment=require(_0x2eab('0x4'));var BPromise=require(_0x2eab('0x5'));var rp=require(_0x2eab('0x6'));var fs=require('fs');var path=require(_0x2eab('0x7'));var rimraf=require(_0x2eab('0x8'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0x2eab('0x9')]=function(_0x333848,_0x2b91c4){return _0x333848[_0x2eab('0xa')]('ZohoConfiguration',attributes,{'tableName':_0x2eab('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf030=['int_zoho_configurations','lodash','api','bluebird','path','../../config/environment','./intZohoConfiguration.attributes','exports','define'];(function(_0x52e142,_0x1561c4){var _0x27ae6e=function(_0x1563f5){while(--_0x1563f5){_0x52e142['push'](_0x52e142['shift']());}};_0x27ae6e(++_0x1561c4);}(_0xf030,0xd9));var _0x0f03=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xf030[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x0f03('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0f03('0x1'));var moment=require('moment');var BPromise=require(_0x0f03('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f03('0x3'));var rimraf=require('rimraf');var config=require(_0x0f03('0x4'));var attributes=require(_0x0f03('0x5'));module[_0x0f03('0x6')]=function(_0x27b895,_0x3b9cf9){return _0x27b895[_0x0f03('0x7')]('ZohoConfiguration',attributes,{'tableName':_0x0f03('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 b7c2d37..6e9f3a2 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 _0xf01e=['message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x289a67,_0x1e5a3c){var _0x572b49=function(_0x22e036){while(--_0x22e036){_0x289a67['push'](_0x289a67['shift']());}};_0x572b49(++_0x1e5a3c);}(_0xf01e,0x11b));var _0xef01=function(_0x23a79e,_0x235f89){_0x23a79e=_0x23a79e-0x0;var _0x3dab57=_0xf01e[_0x23a79e];return _0x3dab57;};'use strict';var _=require(_0xef01('0x0'));var util=require('util');var moment=require(_0xef01('0x1'));var BPromise=require('bluebird');var rs=require(_0xef01('0x2'));var fs=require('fs');var Redis=require(_0xef01('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xef01('0x4'));var logger=require(_0xef01('0x5'))(_0xef01('0x6'));var config=require('../../config/environment');var jayson=require(_0xef01('0x7'));var client=jayson[_0xef01('0x8')][_0xef01('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35a118,_0x2fbdf3,_0x87b3a8){return new BPromise(function(_0x44ffed,_0x488fd0){return client[_0xef01('0xa')](_0x35a118,_0x87b3a8)['then'](function(_0x56b78a){logger[_0xef01('0xb')](_0xef01('0xc'),_0x2fbdf3,_0xef01('0xd'));logger['debug'](_0xef01('0xe'),_0x2fbdf3,_0xef01('0xd'),JSON[_0xef01('0xf')](_0x56b78a));if(_0x56b78a[_0xef01('0x10')]){if(_0x56b78a[_0xef01('0x10')]['code']===0x1f4){logger[_0xef01('0x10')](_0xef01('0xc'),_0x2fbdf3,_0x56b78a[_0xef01('0x10')]['message']);return _0x488fd0(_0x56b78a[_0xef01('0x10')]['message']);}logger['error'](_0xef01('0xc'),_0x2fbdf3,_0x56b78a['error']['message']);return _0x44ffed(_0x56b78a[_0xef01('0x10')][_0xef01('0x11')]);}else{logger[_0xef01('0xb')](_0xef01('0xc'),_0x2fbdf3,_0xef01('0xd'));_0x44ffed(_0x56b78a[_0xef01('0x12')][_0xef01('0x11')]);}})[_0xef01('0x13')](function(_0x28f682){logger['error'](_0xef01('0xc'),_0x2fbdf3,_0x28f682);_0x488fd0(_0x28f682);});});} \ No newline at end of file +var _0x3a30=['client','http','request','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x522e32,_0x440e6d){var _0x216842=function(_0x467028){while(--_0x467028){_0x522e32['push'](_0x522e32['shift']());}};_0x216842(++_0x440e6d);}(_0x3a30,0xb7));var _0x03a3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3a30[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x03a3('0x0'));var util=require(_0x03a3('0x1'));var moment=require('moment');var BPromise=require(_0x03a3('0x2'));var rs=require(_0x03a3('0x3'));var fs=require('fs');var Redis=require(_0x03a3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x03a3('0x5'));var logger=require(_0x03a3('0x6'))(_0x03a3('0x7'));var config=require('../../config/environment');var jayson=require(_0x03a3('0x8'));var client=jayson[_0x03a3('0x9')][_0x03a3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a7289,_0x49f510,_0x75240b){return new BPromise(function(_0x3cd9f1,_0x10bd32){return client[_0x03a3('0xb')](_0x4a7289,_0x75240b)[_0x03a3('0xc')](function(_0x276806){logger[_0x03a3('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x49f510,_0x03a3('0xe'));logger[_0x03a3('0xf')](_0x03a3('0x10'),_0x49f510,_0x03a3('0xe'),JSON[_0x03a3('0x11')](_0x276806));if(_0x276806[_0x03a3('0x12')]){if(_0x276806[_0x03a3('0x12')][_0x03a3('0x13')]===0x1f4){logger['error'](_0x03a3('0x14'),_0x49f510,_0x276806['error'][_0x03a3('0x15')]);return _0x10bd32(_0x276806['error'][_0x03a3('0x15')]);}logger[_0x03a3('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x49f510,_0x276806[_0x03a3('0x12')][_0x03a3('0x15')]);return _0x3cd9f1(_0x276806['error'][_0x03a3('0x15')]);}else{logger[_0x03a3('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x49f510,'request\x20sent');_0x3cd9f1(_0x276806[_0x03a3('0x16')][_0x03a3('0x15')]);}})[_0x03a3('0x17')](function(_0xe8a52c){logger[_0x03a3('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x49f510,_0xe8a52c);_0x10bd32(_0xe8a52c);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 5f4b974..2472325 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 _0xc3a8=['../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x3561e1,_0x596597){var _0x372a0f=function(_0x1ecdfe){while(--_0x1ecdfe){_0x3561e1['push'](_0x3561e1['shift']());}};_0x372a0f(++_0x596597);}(_0xc3a8,0x174));var _0x8c3a=function(_0x577077,_0x52f056){_0x577077=_0x577077-0x0;var _0x370769=_0xc3a8[_0x577077];return _0x370769;};'use strict';var multer=require(_0x8c3a('0x0'));var util=require(_0x8c3a('0x1'));var path=require(_0x8c3a('0x2'));var timeout=require(_0x8c3a('0x3'));var express=require(_0x8c3a('0x4'));var router=express['Router']();var fs_extra=require(_0x8c3a('0x5'));var auth=require(_0x8c3a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8c3a('0x7'));var controller=require(_0x8c3a('0x8'));router[_0x8c3a('0x9')]('/',auth[_0x8c3a('0xa')](),controller[_0x8c3a('0xb')]);router[_0x8c3a('0x9')](_0x8c3a('0xc'),auth[_0x8c3a('0xa')](),controller['show']);router[_0x8c3a('0xd')]('/',auth[_0x8c3a('0xa')](),controller[_0x8c3a('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8c3a('0xf')]);router['delete'](_0x8c3a('0xc'),auth[_0x8c3a('0xa')](),controller[_0x8c3a('0x10')]);module[_0x8c3a('0x11')]=router; \ No newline at end of file +var _0x516e=['post','create','put','update','delete','destroy','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id'];(function(_0x4132b3,_0x3f6f59){var _0x4e9dc6=function(_0x7b921e){while(--_0x7b921e){_0x4132b3['push'](_0x4132b3['shift']());}};_0x4e9dc6(++_0x3f6f59);}(_0x516e,0x84));var _0xe516=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x516e[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xe516('0x0'));var util=require('util');var path=require(_0xe516('0x1'));var timeout=require('connect-timeout');var express=require(_0xe516('0x2'));var router=express['Router']();var fs_extra=require(_0xe516('0x3'));var auth=require(_0xe516('0x4'));var interaction=require(_0xe516('0x5'));var config=require(_0xe516('0x6'));var controller=require(_0xe516('0x7'));router[_0xe516('0x8')]('/',auth[_0xe516('0x9')](),controller[_0xe516('0xa')]);router[_0xe516('0x8')](_0xe516('0xb'),auth[_0xe516('0x9')](),controller['show']);router[_0xe516('0xc')]('/',auth[_0xe516('0x9')](),controller[_0xe516('0xd')]);router[_0xe516('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xe516('0xf')]);router[_0xe516('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xe516('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index cf2040d..793946a 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 _0x67d4=['customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','ENUM','variable'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x67d4,0x1bf));var _0x467d=function(_0x980f49,_0x2e0e8b){_0x980f49=_0x980f49-0x0;var _0x283b7d=_0x67d4[_0x980f49];return _0x283b7d;};'use strict';var Sequelize=require(_0x467d('0x0'));module['exports']={'type':{'type':Sequelize[_0x467d('0x1')]('string',_0x467d('0x2'),_0x467d('0x3'),_0x467d('0x4'),_0x467d('0x5')),'defaultValue':_0x467d('0x6')},'content':{'type':Sequelize[_0x467d('0x7')]},'key':{'type':Sequelize[_0x467d('0x7')]},'keyType':{'type':Sequelize[_0x467d('0x1')](_0x467d('0x6'),_0x467d('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x467d('0x7')]},'nameField':{'type':Sequelize[_0x467d('0x7')]},'customField':{'type':Sequelize[_0x467d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x467d('0x7')]}}; \ No newline at end of file +var _0xc398=['string','STRING','customVariable','sequelize','exports','ENUM','variable','keyValue','picklist'];(function(_0x521e1e,_0x4d0ae4){var _0x2e9e7f=function(_0x259b2a){while(--_0x259b2a){_0x521e1e['push'](_0x521e1e['shift']());}};_0x2e9e7f(++_0x4d0ae4);}(_0xc398,0x162));var _0x8c39=function(_0x41bfa8,_0x2222f0){_0x41bfa8=_0x41bfa8-0x0;var _0x5a689e=_0xc398[_0x41bfa8];return _0x5a689e;};'use strict';var Sequelize=require(_0x8c39('0x0'));module[_0x8c39('0x1')]={'type':{'type':Sequelize[_0x8c39('0x2')]('string',_0x8c39('0x3'),'customVariable',_0x8c39('0x4'),_0x8c39('0x5')),'defaultValue':_0x8c39('0x6')},'content':{'type':Sequelize[_0x8c39('0x7')]},'key':{'type':Sequelize[_0x8c39('0x7')]},'keyType':{'type':Sequelize[_0x8c39('0x2')](_0x8c39('0x6'),_0x8c39('0x3'),_0x8c39('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8c39('0x7')]},'nameField':{'type':Sequelize[_0x8c39('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8c39('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 8bcb2d3..13971a5 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 _0x7276=['query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','ZohoField','includeAll','include','show','params','length','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','key','model'];(function(_0x14b62c,_0x23d29f){var _0x36f174=function(_0x32e66d){while(--_0x32e66d){_0x14b62c['push'](_0x14b62c['shift']());}};_0x36f174(++_0x23d29f);}(_0x7276,0xfb));var _0x6727=function(_0x44d461,_0xb9f49f){_0x44d461=_0x44d461-0x0;var _0x7d5162=_0x7276[_0x44d461];return _0x7d5162;};'use strict';var emlformat=require(_0x6727('0x0'));var rimraf=require(_0x6727('0x1'));var zipdir=require(_0x6727('0x2'));var jsonpatch=require(_0x6727('0x3'));var rp=require(_0x6727('0x4'));var moment=require(_0x6727('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6727('0x6'));var util=require(_0x6727('0x7'));var path=require(_0x6727('0x8'));var sox=require(_0x6727('0x9'));var csv=require(_0x6727('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6727('0xb'));var squel=require(_0x6727('0xc'));var crypto=require(_0x6727('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6727('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6727('0xf'));var Papa=require(_0x6727('0x10'));var Redis=require(_0x6727('0x11'));var authService=require(_0x6727('0x12'));var qs=require(_0x6727('0x13'));var as=require(_0x6727('0x14'));var hardwareService=require(_0x6727('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x6727('0x16'));var config=require(_0x6727('0x17'));var licenseUtil=require(_0x6727('0x18'));var db=require(_0x6727('0x19'))['db'];function respondWithStatusCode(_0x3573d6,_0x2a9824){_0x2a9824=_0x2a9824||0xcc;return function(_0x4b4ffa){if(_0x4b4ffa){return _0x3573d6[_0x6727('0x1a')](_0x2a9824);}return _0x3573d6[_0x6727('0x1b')](_0x2a9824)[_0x6727('0x1c')]();};}function respondWithResult(_0x5f41fc,_0x20e252){_0x20e252=_0x20e252||0xc8;return function(_0x433e0a){if(_0x433e0a){return _0x5f41fc[_0x6727('0x1b')](_0x20e252)[_0x6727('0x1d')](_0x433e0a);}};}function respondWithFilteredResult(_0x5cd349,_0x537d6f){return function(_0x21e35b){if(_0x21e35b){var _0x52165b=typeof _0x537d6f[_0x6727('0x1e')]===_0x6727('0x1f')&&typeof _0x537d6f[_0x6727('0x20')]===_0x6727('0x1f');var _0x1d910a=_0x21e35b[_0x6727('0x21')];var _0x26b9ff=_0x52165b?0x0:_0x537d6f['offset'];var _0x142f3c=_0x52165b?_0x21e35b[_0x6727('0x21')]:_0x537d6f[_0x6727('0x1e')]+_0x537d6f[_0x6727('0x20')];var _0x36a389;if(_0x142f3c>=_0x1d910a){_0x142f3c=_0x1d910a;_0x36a389=0xc8;}else{_0x36a389=0xce;}_0x5cd349[_0x6727('0x1b')](_0x36a389);return _0x5cd349['set'](_0x6727('0x22'),_0x26b9ff+'-'+_0x142f3c+'/'+_0x1d910a)[_0x6727('0x1d')](_0x21e35b);}return null;};}function patchUpdates(_0x9090aa){return function(_0x30147d){try{jsonpatch[_0x6727('0x23')](_0x30147d,_0x9090aa,!![]);}catch(_0x9ebd23){return BPromise[_0x6727('0x24')](_0x9ebd23);}return _0x30147d[_0x6727('0x25')]();};}function saveUpdates(_0x37f2ac,_0x2d49dc){return function(_0x445e70){if(_0x445e70){return _0x445e70[_0x6727('0x26')](_0x37f2ac)[_0x6727('0x27')](function(_0x243ab4){return _0x243ab4;});}return null;};}function removeEntity(_0x1efbef,_0x4183e4){return function(_0x570151){if(_0x570151){return _0x570151['destroy']()[_0x6727('0x27')](function(){_0x1efbef['status'](0xcc)[_0x6727('0x1c')]();});}};}function handleEntityNotFound(_0x4ea71e,_0x2a3c4c){return function(_0xe900a4){if(!_0xe900a4){_0x4ea71e[_0x6727('0x1a')](0x194);}return _0xe900a4;};}function handleError(_0x140caa,_0x1bcc6d){_0x1bcc6d=_0x1bcc6d||0x1f4;return function(_0x5093e7){logger[_0x6727('0x28')](_0x5093e7['stack']);if(_0x5093e7[_0x6727('0x29')]){delete _0x5093e7[_0x6727('0x29')];}_0x140caa['status'](_0x1bcc6d)[_0x6727('0x2a')](_0x5093e7);};}exports[_0x6727('0x2b')]=function(_0x530064,_0x9e11ce){var _0x271a19={},_0xc5c3cb={},_0x43148d={'count':0x0,'rows':[]};var _0x4f9f90=_[_0x6727('0x2c')](db['ZohoField'][_0x6727('0x2d')],function(_0x2e948c){return{'name':_0x2e948c[_0x6727('0x2e')],'type':_0x2e948c['type'][_0x6727('0x2f')]};});_0xc5c3cb[_0x6727('0x30')]=_[_0x6727('0x2c')](_0x4f9f90,_0x6727('0x29'));_0xc5c3cb[_0x6727('0x31')]=_[_0x6727('0x32')](_0x530064[_0x6727('0x31')]);_0xc5c3cb[_0x6727('0x33')]=_['intersection'](_0xc5c3cb['model'],_0xc5c3cb[_0x6727('0x31')]);_0x271a19[_0x6727('0x34')]=_['intersection'](_0xc5c3cb[_0x6727('0x30')],qs['fields'](_0x530064['query'][_0x6727('0x35')]));_0x271a19['attributes']=_0x271a19[_0x6727('0x34')]['length']?_0x271a19['attributes']:_0xc5c3cb[_0x6727('0x30')];if(!_0x530064[_0x6727('0x31')][_0x6727('0x36')](_0x6727('0x37'))){_0x271a19[_0x6727('0x20')]=qs[_0x6727('0x20')](_0x530064['query'][_0x6727('0x20')]);_0x271a19[_0x6727('0x1e')]=qs[_0x6727('0x1e')](_0x530064[_0x6727('0x31')][_0x6727('0x1e')]);}_0x271a19[_0x6727('0x38')]=qs[_0x6727('0x39')](_0x530064['query'][_0x6727('0x39')]);_0x271a19[_0x6727('0x3a')]=qs[_0x6727('0x33')](_[_0x6727('0x3b')](_0x530064['query'],_0xc5c3cb['filters']),_0x4f9f90);if(_0x530064[_0x6727('0x31')]['filter']){_0x271a19[_0x6727('0x3a')]=_[_0x6727('0x3c')](_0x271a19['where'],{'$or':_[_0x6727('0x2c')](_0x4f9f90,function(_0x427f9a){if(_0x427f9a['type']!==_0x6727('0x3d')){var _0x42da80={};_0x42da80[_0x427f9a[_0x6727('0x29')]]={'$like':'%'+_0x530064[_0x6727('0x31')][_0x6727('0x3e')]+'%'};return _0x42da80;}})});}_0x271a19=_['merge']({},_0x271a19,_0x530064[_0x6727('0x3f')]);var _0x37ded7={'where':_0x271a19[_0x6727('0x3a')]};return db[_0x6727('0x40')][_0x6727('0x21')](_0x37ded7)[_0x6727('0x27')](function(_0x195123){_0x43148d[_0x6727('0x21')]=_0x195123;if(_0x530064[_0x6727('0x31')][_0x6727('0x41')]){_0x271a19[_0x6727('0x42')]=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x271a19);})[_0x6727('0x27')](function(_0x2ee02c){_0x43148d['rows']=_0x2ee02c;return _0x43148d;})[_0x6727('0x27')](respondWithFilteredResult(_0x9e11ce,_0x271a19))['catch'](handleError(_0x9e11ce,null));};exports[_0x6727('0x43')]=function(_0x4b8830,_0x21f446){var _0x461d1e={'raw':!![],'where':{'id':_0x4b8830[_0x6727('0x44')]['id']}},_0x5b230a={};_0x5b230a[_0x6727('0x30')]=_[_0x6727('0x32')](db['ZohoField']['rawAttributes']);_0x5b230a[_0x6727('0x31')]=_[_0x6727('0x32')](_0x4b8830[_0x6727('0x31')]);_0x5b230a['filters']=_['intersection'](_0x5b230a[_0x6727('0x30')],_0x5b230a[_0x6727('0x31')]);_0x461d1e[_0x6727('0x34')]=_['intersection'](_0x5b230a[_0x6727('0x30')],qs[_0x6727('0x35')](_0x4b8830[_0x6727('0x31')]['fields']));_0x461d1e[_0x6727('0x34')]=_0x461d1e['attributes'][_0x6727('0x45')]?_0x461d1e[_0x6727('0x34')]:_0x5b230a[_0x6727('0x30')];if(_0x4b8830['query'][_0x6727('0x41')]){_0x461d1e['include']=[{'all':!![]}];}_0x461d1e=_[_0x6727('0x3c')]({},_0x461d1e,_0x4b8830['options']);return db[_0x6727('0x40')][_0x6727('0x46')](_0x461d1e)['then'](handleEntityNotFound(_0x21f446,null))[_0x6727('0x27')](respondWithResult(_0x21f446,null))[_0x6727('0x47')](handleError(_0x21f446,null));};exports[_0x6727('0x48')]=function(_0x2c74a1,_0x24a4c7){return db[_0x6727('0x40')][_0x6727('0x48')](_0x2c74a1['body'],{})['then'](respondWithResult(_0x24a4c7,0xc9))[_0x6727('0x47')](handleError(_0x24a4c7,null));};exports[_0x6727('0x26')]=function(_0x46c87d,_0x16f3f8){if(_0x46c87d[_0x6727('0x49')]['id']){delete _0x46c87d[_0x6727('0x49')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x46c87d[_0x6727('0x44')]['id']}})[_0x6727('0x27')](handleEntityNotFound(_0x16f3f8,null))[_0x6727('0x27')](saveUpdates(_0x46c87d[_0x6727('0x49')],null))['then'](respondWithResult(_0x16f3f8,null))[_0x6727('0x47')](handleError(_0x16f3f8,null));};exports[_0x6727('0x4a')]=function(_0x3a08d2,_0x3c83f0){return db[_0x6727('0x40')][_0x6727('0x46')]({'where':{'id':_0x3a08d2[_0x6727('0x44')]['id']}})[_0x6727('0x27')](handleEntityNotFound(_0x3c83f0,null))[_0x6727('0x27')](removeEntity(_0x3c83f0,null))[_0x6727('0x47')](handleError(_0x3c83f0,null));}; \ No newline at end of file +var _0xfa34=['undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','where','filter','merge','options','includeAll','include','findAll','rows','catch','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','offset'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xfa34,0x74));var _0x4fa3=function(_0x323419,_0x2a6172){_0x323419=_0x323419-0x0;var _0x4c0be7=_0xfa34[_0x323419];return _0x4c0be7;};'use strict';var emlformat=require(_0x4fa3('0x0'));var rimraf=require(_0x4fa3('0x1'));var zipdir=require(_0x4fa3('0x2'));var jsonpatch=require(_0x4fa3('0x3'));var rp=require(_0x4fa3('0x4'));var moment=require(_0x4fa3('0x5'));var BPromise=require(_0x4fa3('0x6'));var Mustache=require('mustache');var util=require(_0x4fa3('0x7'));var path=require(_0x4fa3('0x8'));var sox=require(_0x4fa3('0x9'));var csv=require(_0x4fa3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4fa3('0xb'));var _=require(_0x4fa3('0xc'));var squel=require(_0x4fa3('0xd'));var crypto=require(_0x4fa3('0xe'));var jsforce=require(_0x4fa3('0xf'));var deskjs=require(_0x4fa3('0x10'));var toCsv=require(_0x4fa3('0xa'));var querystring=require(_0x4fa3('0x11'));var Papa=require(_0x4fa3('0x12'));var Redis=require('ioredis');var authService=require(_0x4fa3('0x13'));var qs=require(_0x4fa3('0x14'));var as=require(_0x4fa3('0x15'));var hardwareService=require(_0x4fa3('0x16'));var logger=require('../../config/logger')(_0x4fa3('0x17'));var utils=require(_0x4fa3('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4fa3('0x19'))['db'];function respondWithStatusCode(_0x42a3c7,_0x406e2c){_0x406e2c=_0x406e2c||0xcc;return function(_0xd0f81f){if(_0xd0f81f){return _0x42a3c7['sendStatus'](_0x406e2c);}return _0x42a3c7[_0x4fa3('0x1a')](_0x406e2c)[_0x4fa3('0x1b')]();};}function respondWithResult(_0x245d8c,_0x3d34e5){_0x3d34e5=_0x3d34e5||0xc8;return function(_0x2be4fe){if(_0x2be4fe){return _0x245d8c[_0x4fa3('0x1a')](_0x3d34e5)[_0x4fa3('0x1c')](_0x2be4fe);}};}function respondWithFilteredResult(_0x58727c,_0x103ce0){return function(_0x506f05){if(_0x506f05){var _0x5725ef=typeof _0x103ce0[_0x4fa3('0x1d')]===_0x4fa3('0x1e')&&typeof _0x103ce0[_0x4fa3('0x1f')]===_0x4fa3('0x1e');var _0x3385f4=_0x506f05[_0x4fa3('0x20')];var _0x47cceb=_0x5725ef?0x0:_0x103ce0[_0x4fa3('0x1d')];var _0x1967ce=_0x5725ef?_0x506f05[_0x4fa3('0x20')]:_0x103ce0[_0x4fa3('0x1d')]+_0x103ce0[_0x4fa3('0x1f')];var _0x2a011c;if(_0x1967ce>=_0x3385f4){_0x1967ce=_0x3385f4;_0x2a011c=0xc8;}else{_0x2a011c=0xce;}_0x58727c[_0x4fa3('0x1a')](_0x2a011c);return _0x58727c['set'](_0x4fa3('0x21'),_0x47cceb+'-'+_0x1967ce+'/'+_0x3385f4)['json'](_0x506f05);}return null;};}function patchUpdates(_0x45fb80){return function(_0x2c557d){try{jsonpatch[_0x4fa3('0x22')](_0x2c557d,_0x45fb80,!![]);}catch(_0x507115){return BPromise[_0x4fa3('0x23')](_0x507115);}return _0x2c557d[_0x4fa3('0x24')]();};}function saveUpdates(_0x1bb445,_0x2f5a87){return function(_0x2b9b2f){if(_0x2b9b2f){return _0x2b9b2f[_0x4fa3('0x25')](_0x1bb445)[_0x4fa3('0x26')](function(_0x459a92){return _0x459a92;});}return null;};}function removeEntity(_0x5b802c,_0x284259){return function(_0x5ecf37){if(_0x5ecf37){return _0x5ecf37[_0x4fa3('0x27')]()[_0x4fa3('0x26')](function(){_0x5b802c['status'](0xcc)[_0x4fa3('0x1b')]();});}};}function handleEntityNotFound(_0x1de19a,_0x372934){return function(_0x4f37a2){if(!_0x4f37a2){_0x1de19a['sendStatus'](0x194);}return _0x4f37a2;};}function handleError(_0x3c469d,_0xaecd52){_0xaecd52=_0xaecd52||0x1f4;return function(_0x3f26cd){logger[_0x4fa3('0x28')](_0x3f26cd[_0x4fa3('0x29')]);if(_0x3f26cd[_0x4fa3('0x2a')]){delete _0x3f26cd[_0x4fa3('0x2a')];}_0x3c469d[_0x4fa3('0x1a')](_0xaecd52)['send'](_0x3f26cd);};}exports[_0x4fa3('0x2b')]=function(_0x183f0c,_0x2faf0d){var _0x495a9f={},_0x4bb156={},_0x4c9617={'count':0x0,'rows':[]};var _0xe21c77=_[_0x4fa3('0x2c')](db[_0x4fa3('0x2d')][_0x4fa3('0x2e')],function(_0x56eeea){return{'name':_0x56eeea[_0x4fa3('0x2f')],'type':_0x56eeea[_0x4fa3('0x30')][_0x4fa3('0x31')]};});_0x4bb156[_0x4fa3('0x32')]=_['map'](_0xe21c77,_0x4fa3('0x2a'));_0x4bb156[_0x4fa3('0x33')]=_[_0x4fa3('0x34')](_0x183f0c[_0x4fa3('0x33')]);_0x4bb156[_0x4fa3('0x35')]=_['intersection'](_0x4bb156[_0x4fa3('0x32')],_0x4bb156['query']);_0x495a9f[_0x4fa3('0x36')]=_[_0x4fa3('0x37')](_0x4bb156[_0x4fa3('0x32')],qs[_0x4fa3('0x38')](_0x183f0c['query'][_0x4fa3('0x38')]));_0x495a9f[_0x4fa3('0x36')]=_0x495a9f[_0x4fa3('0x36')][_0x4fa3('0x39')]?_0x495a9f['attributes']:_0x4bb156['model'];if(!_0x183f0c[_0x4fa3('0x33')]['hasOwnProperty'](_0x4fa3('0x3a'))){_0x495a9f[_0x4fa3('0x1f')]=qs[_0x4fa3('0x1f')](_0x183f0c[_0x4fa3('0x33')]['limit']);_0x495a9f['offset']=qs[_0x4fa3('0x1d')](_0x183f0c[_0x4fa3('0x33')]['offset']);}_0x495a9f[_0x4fa3('0x3b')]=qs['sort'](_0x183f0c['query']['sort']);_0x495a9f[_0x4fa3('0x3c')]=qs[_0x4fa3('0x35')](_['pick'](_0x183f0c['query'],_0x4bb156['filters']),_0xe21c77);if(_0x183f0c['query'][_0x4fa3('0x3d')]){_0x495a9f[_0x4fa3('0x3c')]=_[_0x4fa3('0x3e')](_0x495a9f[_0x4fa3('0x3c')],{'$or':_[_0x4fa3('0x2c')](_0xe21c77,function(_0x4488a0){if(_0x4488a0[_0x4fa3('0x30')]!=='VIRTUAL'){var _0x28ec2c={};_0x28ec2c[_0x4488a0['name']]={'$like':'%'+_0x183f0c['query'][_0x4fa3('0x3d')]+'%'};return _0x28ec2c;}})});}_0x495a9f=_['merge']({},_0x495a9f,_0x183f0c[_0x4fa3('0x3f')]);var _0x1b2489={'where':_0x495a9f[_0x4fa3('0x3c')]};return db[_0x4fa3('0x2d')][_0x4fa3('0x20')](_0x1b2489)[_0x4fa3('0x26')](function(_0x3099f3){_0x4c9617[_0x4fa3('0x20')]=_0x3099f3;if(_0x183f0c[_0x4fa3('0x33')][_0x4fa3('0x40')]){_0x495a9f[_0x4fa3('0x41')]=[{'all':!![]}];}return db[_0x4fa3('0x2d')][_0x4fa3('0x42')](_0x495a9f);})[_0x4fa3('0x26')](function(_0x3d17b0){_0x4c9617[_0x4fa3('0x43')]=_0x3d17b0;return _0x4c9617;})['then'](respondWithFilteredResult(_0x2faf0d,_0x495a9f))[_0x4fa3('0x44')](handleError(_0x2faf0d,null));};exports['show']=function(_0xa6401e,_0x2c8dc1){var _0x30b926={'raw':!![],'where':{'id':_0xa6401e[_0x4fa3('0x45')]['id']}},_0x35e287={};_0x35e287[_0x4fa3('0x32')]=_['keys'](db[_0x4fa3('0x2d')][_0x4fa3('0x2e')]);_0x35e287[_0x4fa3('0x33')]=_[_0x4fa3('0x34')](_0xa6401e['query']);_0x35e287['filters']=_[_0x4fa3('0x37')](_0x35e287['model'],_0x35e287['query']);_0x30b926[_0x4fa3('0x36')]=_[_0x4fa3('0x37')](_0x35e287['model'],qs[_0x4fa3('0x38')](_0xa6401e['query'][_0x4fa3('0x38')]));_0x30b926['attributes']=_0x30b926[_0x4fa3('0x36')][_0x4fa3('0x39')]?_0x30b926[_0x4fa3('0x36')]:_0x35e287[_0x4fa3('0x32')];if(_0xa6401e[_0x4fa3('0x33')][_0x4fa3('0x40')]){_0x30b926[_0x4fa3('0x41')]=[{'all':!![]}];}_0x30b926=_[_0x4fa3('0x3e')]({},_0x30b926,_0xa6401e['options']);return db[_0x4fa3('0x2d')]['find'](_0x30b926)[_0x4fa3('0x26')](handleEntityNotFound(_0x2c8dc1,null))[_0x4fa3('0x26')](respondWithResult(_0x2c8dc1,null))['catch'](handleError(_0x2c8dc1,null));};exports[_0x4fa3('0x46')]=function(_0x172071,_0x11ce33){return db[_0x4fa3('0x2d')]['create'](_0x172071['body'],{})[_0x4fa3('0x26')](respondWithResult(_0x11ce33,0xc9))[_0x4fa3('0x44')](handleError(_0x11ce33,null));};exports[_0x4fa3('0x25')]=function(_0x4aa090,_0x4ce7de){if(_0x4aa090[_0x4fa3('0x47')]['id']){delete _0x4aa090['body']['id'];}return db[_0x4fa3('0x2d')][_0x4fa3('0x48')]({'where':{'id':_0x4aa090[_0x4fa3('0x45')]['id']}})[_0x4fa3('0x26')](handleEntityNotFound(_0x4ce7de,null))[_0x4fa3('0x26')](saveUpdates(_0x4aa090[_0x4fa3('0x47')],null))[_0x4fa3('0x26')](respondWithResult(_0x4ce7de,null))[_0x4fa3('0x44')](handleError(_0x4ce7de,null));};exports[_0x4fa3('0x27')]=function(_0x86889b,_0x13c5f6){return db[_0x4fa3('0x2d')][_0x4fa3('0x48')]({'where':{'id':_0x86889b['params']['id']}})[_0x4fa3('0x26')](handleEntityNotFound(_0x13c5f6,null))['then'](removeEntity(_0x13c5f6,null))['catch'](handleError(_0x13c5f6,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 57a115b..75b978b 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 _0x627e=['define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3f07a1,_0x2db68a){var _0x5d421a=function(_0x183660){while(--_0x183660){_0x3f07a1['push'](_0x3f07a1['shift']());}};_0x5d421a(++_0x2db68a);}(_0x627e,0x14a));var _0xe627=function(_0x36d589,_0x5f5505){_0x36d589=_0x36d589-0x0;var _0xe7fafd=_0x627e[_0x36d589];return _0xe7fafd;};'use strict';var _=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var logger=require(_0xe627('0x2'))(_0xe627('0x3'));var moment=require(_0xe627('0x4'));var BPromise=require('bluebird');var rp=require(_0xe627('0x5'));var fs=require('fs');var path=require(_0xe627('0x6'));var rimraf=require(_0xe627('0x7'));var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module['exports']=function(_0x1a1a3d,_0x3f2791){return _0x1a1a3d[_0xe627('0x8')](_0xe627('0x9'),attributes,{'tableName':_0xe627('0xa'),'paranoid':![],'indexes':[{'name':_0xe627('0xb'),'fields':['idField',_0xe627('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf2e3=['request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0xf2e3[_0x2db12b];return _0x20990b;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var logger=require(_0x3f2e('0x1'))(_0x3f2e('0x2'));var moment=require(_0x3f2e('0x3'));var BPromise=require(_0x3f2e('0x4'));var rp=require(_0x3f2e('0x5'));var fs=require('fs');var path=require(_0x3f2e('0x6'));var rimraf=require(_0x3f2e('0x7'));var config=require(_0x3f2e('0x8'));var attributes=require(_0x3f2e('0x9'));module['exports']=function(_0x33a3b7,_0xdd6b3e){return _0x33a3b7[_0x3f2e('0xa')](_0x3f2e('0xb'),attributes,{'tableName':_0x3f2e('0xc'),'paranoid':![],'indexes':[{'name':_0x3f2e('0xd'),'fields':[_0x3f2e('0xe'),_0x3f2e('0xf')],'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 fad1467..3cca784 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 _0x6b98=['../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','ZohoField,\x20%s,\x20%s','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x3ee5a9,_0x264a96){var _0x2215ec=function(_0xe36c7f){while(--_0xe36c7f){_0x3ee5a9['push'](_0x3ee5a9['shift']());}};_0x2215ec(++_0x264a96);}(_0x6b98,0x1b2));var _0x86b9=function(_0x7b544a,_0x33c45a){_0x7b544a=_0x7b544a-0x0;var _0x33dcb4=_0x6b98[_0x7b544a];return _0x33dcb4;};'use strict';var _=require(_0x86b9('0x0'));var util=require('util');var moment=require(_0x86b9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x86b9('0x2'));var db=require(_0x86b9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86b9('0x4'))(_0x86b9('0x5'));var config=require(_0x86b9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86b9('0x7')][_0x86b9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f31a3,_0x4a42b5,_0x369683){return new BPromise(function(_0x255a86,_0x5ee171){return client[_0x86b9('0x9')](_0x4f31a3,_0x369683)[_0x86b9('0xa')](function(_0x2506fa){logger['info']('ZohoField,\x20%s,\x20%s',_0x4a42b5,_0x86b9('0xb'));logger[_0x86b9('0xc')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x4a42b5,_0x86b9('0xb'),JSON[_0x86b9('0xd')](_0x2506fa));if(_0x2506fa['error']){if(_0x2506fa['error'][_0x86b9('0xe')]===0x1f4){logger[_0x86b9('0xf')](_0x86b9('0x10'),_0x4a42b5,_0x2506fa[_0x86b9('0xf')][_0x86b9('0x11')]);return _0x5ee171(_0x2506fa[_0x86b9('0xf')]['message']);}logger[_0x86b9('0xf')](_0x86b9('0x10'),_0x4a42b5,_0x2506fa[_0x86b9('0xf')][_0x86b9('0x11')]);return _0x255a86(_0x2506fa[_0x86b9('0xf')][_0x86b9('0x11')]);}else{logger['info'](_0x86b9('0x10'),_0x4a42b5,'request\x20sent');_0x255a86(_0x2506fa[_0x86b9('0x12')][_0x86b9('0x11')]);}})[_0x86b9('0x13')](function(_0x4d9351){logger[_0x86b9('0xf')](_0x86b9('0x10'),_0x4a42b5,_0x4d9351);_0x5ee171(_0x4d9351);});});} \ No newline at end of file +var _0x1b5b=['info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','ZohoField,\x20%s,\x20%s','debug','error','code','message'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x1b5b,0x66));var _0xb1b5=function(_0x3f00ee,_0x1d1673){_0x3f00ee=_0x3f00ee-0x0;var _0x18a07e=_0x1b5b[_0x3f00ee];return _0x18a07e;};'use strict';var _=require(_0xb1b5('0x0'));var util=require(_0xb1b5('0x1'));var moment=require(_0xb1b5('0x2'));var BPromise=require(_0xb1b5('0x3'));var rs=require(_0xb1b5('0x4'));var fs=require('fs');var Redis=require(_0xb1b5('0x5'));var db=require(_0xb1b5('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb1b5('0x7'));var config=require(_0xb1b5('0x8'));var jayson=require(_0xb1b5('0x9'));var client=jayson['client'][_0xb1b5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x61266b,_0x4afe93,_0x23e46e){return new BPromise(function(_0x52c982,_0x9523c6){return client[_0xb1b5('0xb')](_0x61266b,_0x23e46e)[_0xb1b5('0xc')](function(_0x442d86){logger['info'](_0xb1b5('0xd'),_0x4afe93,'request\x20sent');logger[_0xb1b5('0xe')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x4afe93,'request\x20sent',JSON['stringify'](_0x442d86));if(_0x442d86['error']){if(_0x442d86[_0xb1b5('0xf')][_0xb1b5('0x10')]===0x1f4){logger['error'](_0xb1b5('0xd'),_0x4afe93,_0x442d86['error'][_0xb1b5('0x11')]);return _0x9523c6(_0x442d86[_0xb1b5('0xf')][_0xb1b5('0x11')]);}logger[_0xb1b5('0xf')](_0xb1b5('0xd'),_0x4afe93,_0x442d86['error']['message']);return _0x52c982(_0x442d86[_0xb1b5('0xf')][_0xb1b5('0x11')]);}else{logger[_0xb1b5('0x12')](_0xb1b5('0xd'),_0x4afe93,'request\x20sent');_0x52c982(_0x442d86['result'][_0xb1b5('0x11')]);}})[_0xb1b5('0x13')](function(_0x580724){logger[_0xb1b5('0xf')]('ZohoField,\x20%s,\x20%s',_0x4afe93,_0x580724);_0x9523c6(_0x580724);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index d188660..0a902fb 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x211194,_0x2cdfb8){var _0x35e58a=function(_0x1c6c0a){while(--_0x1c6c0a){_0x211194['push'](_0x211194['shift']());}};_0x35e58a(++_0x2cdfb8);}(_0xe706,0xa3));var _0x6e70=function(_0x59db19,_0x30c1c6){_0x59db19=_0x59db19-0x0;var _0x5f0f09=_0xe706[_0x59db19];return _0x5f0f09;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xa8a57e,_0x27295c){var _0x53244c=function(_0x1b333d){while(--_0x1b333d){_0xa8a57e['push'](_0xa8a57e['shift']());}};_0x53244c(++_0x27295c);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 21646c0..8843177 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 _0x3cb9=['INTEGER','exports','STRING','unique_name_and_version','app.js'];(function(_0x442f02,_0x47d845){var _0xab6ef1=function(_0x4cad5c){while(--_0x4cad5c){_0x442f02['push'](_0x442f02['shift']());}};_0xab6ef1(++_0x47d845);}(_0x3cb9,0x12d));var _0x93cb=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x3cb9[_0x411017];return _0x2adeea;};'use strict';var Sequelize=require('sequelize');module[_0x93cb('0x0')]={'name':{'type':Sequelize[_0x93cb('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x93cb('0x1')],'allowNull':![],'unique':_0x93cb('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x93cb('0x3')},'filename':{'type':Sequelize[_0x93cb('0x1')]},'path':{'type':Sequelize[_0x93cb('0x1')]},'type':{'type':Sequelize[_0x93cb('0x1')]},'size':{'type':Sequelize[_0x93cb('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x93cb('0x1')]},'logo':{'type':Sequelize[_0x93cb('0x1')]},'state':{'type':Sequelize[_0x93cb('0x1')],'unique':'state'},'description':{'type':Sequelize[_0x93cb('0x1')]},'title':{'type':Sequelize[_0x93cb('0x1')]},'remoteUri':{'type':Sequelize[_0x93cb('0x1')]},'link':{'type':Sequelize[_0x93cb('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x23c9=['STRING','INTEGER','BOOLEAN','state','unique_name_and_version'];(function(_0x17f283,_0x343b6f){var _0x370bc2=function(_0x53a6d7){while(--_0x53a6d7){_0x17f283['push'](_0x17f283['shift']());}};_0x370bc2(++_0x343b6f);}(_0x23c9,0x1b7));var _0x923c=function(_0x14d0d2,_0x2ad908){_0x14d0d2=_0x14d0d2-0x0;var _0x57b04e=_0x23c9[_0x14d0d2];return _0x57b04e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x923c('0x0')},'version':{'type':Sequelize[_0x923c('0x1')],'allowNull':![],'unique':_0x923c('0x0')},'main':{'type':Sequelize[_0x923c('0x1')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x923c('0x1')]},'path':{'type':Sequelize[_0x923c('0x1')]},'type':{'type':Sequelize[_0x923c('0x1')]},'size':{'type':Sequelize[_0x923c('0x2')]},'active':{'type':Sequelize[_0x923c('0x3')],'defaultValue':![]},'author':{'type':Sequelize[_0x923c('0x1')]},'logo':{'type':Sequelize[_0x923c('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0x923c('0x4')},'description':{'type':Sequelize[_0x923c('0x1')]},'title':{'type':Sequelize[_0x923c('0x1')]},'remoteUri':{'type':Sequelize[_0x923c('0x1')]},'link':{'type':Sequelize[_0x923c('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 2b8fb02..a95fc4b 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 _0x6d38=['sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','keys','filters','intersection','create','catch','body','find','params','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','stack','name','send','index','map','Integration','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','order'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0x6d38,0x1ef));var _0x86d3=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x6d38[_0x122096];return _0x3d1966;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];function respondWithStatusCode(_0x7d4d2e,_0x440a55){_0x440a55=_0x440a55||0xcc;return function(_0x26d64c){if(_0x26d64c){return _0x7d4d2e[_0x86d3('0x14')](_0x440a55);}return _0x7d4d2e[_0x86d3('0x15')](_0x440a55)[_0x86d3('0x16')]();};}function respondWithResult(_0x12ef4a,_0x5ce2ff){_0x5ce2ff=_0x5ce2ff||0xc8;return function(_0x1c1ba8){if(_0x1c1ba8){return _0x12ef4a[_0x86d3('0x15')](_0x5ce2ff)[_0x86d3('0x17')](_0x1c1ba8);}};}function respondWithFilteredResult(_0x207f6f,_0x1ea535){return function(_0x34fb3b){if(_0x34fb3b){var _0x1ff008=typeof _0x1ea535[_0x86d3('0x18')]==='undefined'&&typeof _0x1ea535[_0x86d3('0x19')]===_0x86d3('0x1a');var _0x431b3f=_0x34fb3b[_0x86d3('0x1b')];var _0x46feec=_0x1ff008?0x0:_0x1ea535[_0x86d3('0x18')];var _0x33e459=_0x1ff008?_0x34fb3b[_0x86d3('0x1b')]:_0x1ea535[_0x86d3('0x18')]+_0x1ea535['limit'];var _0x191ba5;if(_0x33e459>=_0x431b3f){_0x33e459=_0x431b3f;_0x191ba5=0xc8;}else{_0x191ba5=0xce;}_0x207f6f['status'](_0x191ba5);return _0x207f6f[_0x86d3('0x1c')]('Content-Range',_0x46feec+'-'+_0x33e459+'/'+_0x431b3f)['json'](_0x34fb3b);}return null;};}function patchUpdates(_0x41486a){return function(_0x1edb6d){try{jsonpatch[_0x86d3('0x1d')](_0x1edb6d,_0x41486a,!![]);}catch(_0x1720ae){return BPromise['reject'](_0x1720ae);}return _0x1edb6d[_0x86d3('0x1e')]();};}function saveUpdates(_0x55e1c3,_0x36e0fa){return function(_0x3fdf67){if(_0x3fdf67){return _0x3fdf67[_0x86d3('0x1f')](_0x55e1c3)['then'](function(_0x39d819){return _0x39d819;});}return null;};}function removeEntity(_0x72b3d4,_0x1fa4ac){return function(_0x4bf5b8){if(_0x4bf5b8){return _0x4bf5b8['destroy']()[_0x86d3('0x20')](function(){_0x72b3d4['status'](0xcc)[_0x86d3('0x16')]();});}};}function handleEntityNotFound(_0x1bea5e,_0x3dfecd){return function(_0x3c5fe4){if(!_0x3c5fe4){_0x1bea5e['sendStatus'](0x194);}return _0x3c5fe4;};}function handleError(_0x481077,_0x3359e4){_0x3359e4=_0x3359e4||0x1f4;return function(_0x611764){logger['error'](_0x611764[_0x86d3('0x21')]);if(_0x611764['name']){delete _0x611764[_0x86d3('0x22')];}_0x481077[_0x86d3('0x15')](_0x3359e4)[_0x86d3('0x23')](_0x611764);};}exports[_0x86d3('0x24')]=function(_0x11a6fd,_0x14c9ff){var _0x1f203e={},_0x35d708={},_0x303f13={'count':0x0,'rows':[]};var _0x44dacf=_[_0x86d3('0x25')](db[_0x86d3('0x26')][_0x86d3('0x27')],function(_0x28c25e){return{'name':_0x28c25e['fieldName'],'type':_0x28c25e[_0x86d3('0x28')][_0x86d3('0x29')]};});_0x35d708[_0x86d3('0x2a')]=_[_0x86d3('0x25')](_0x44dacf,_0x86d3('0x22'));_0x35d708[_0x86d3('0x2b')]=_['keys'](_0x11a6fd[_0x86d3('0x2b')]);_0x35d708['filters']=_['intersection'](_0x35d708[_0x86d3('0x2a')],_0x35d708[_0x86d3('0x2b')]);_0x1f203e[_0x86d3('0x2c')]=_['intersection'](_0x35d708[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x11a6fd['query'][_0x86d3('0x2d')]));_0x1f203e[_0x86d3('0x2c')]=_0x1f203e[_0x86d3('0x2c')][_0x86d3('0x2e')]?_0x1f203e[_0x86d3('0x2c')]:_0x35d708[_0x86d3('0x2a')];if(!_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x2f')]('nolimit')){_0x1f203e['limit']=qs['limit'](_0x11a6fd[_0x86d3('0x2b')]['limit']);_0x1f203e[_0x86d3('0x18')]=qs['offset'](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x18')]);}_0x1f203e[_0x86d3('0x30')]=qs[_0x86d3('0x31')](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x31')]);_0x1f203e[_0x86d3('0x32')]=qs['filters'](_[_0x86d3('0x33')](_0x11a6fd[_0x86d3('0x2b')],_0x35d708['filters']),_0x44dacf);if(_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]){_0x1f203e[_0x86d3('0x32')]=_[_0x86d3('0x35')](_0x1f203e['where'],{'$or':_[_0x86d3('0x25')](_0x44dacf,function(_0x42ac0d){if(_0x42ac0d[_0x86d3('0x28')]!=='VIRTUAL'){var _0x5762ca={};_0x5762ca[_0x42ac0d[_0x86d3('0x22')]]={'$like':'%'+_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]+'%'};return _0x5762ca;}})});}_0x1f203e=_[_0x86d3('0x35')]({},_0x1f203e,_0x11a6fd[_0x86d3('0x36')]);var _0x3666fc={'where':_0x1f203e[_0x86d3('0x32')]};return db['Integration'][_0x86d3('0x1b')](_0x3666fc)[_0x86d3('0x20')](function(_0x2bdc67){_0x303f13[_0x86d3('0x1b')]=_0x2bdc67;if(_0x11a6fd['query'][_0x86d3('0x37')]){_0x1f203e[_0x86d3('0x38')]=[{'all':!![]}];}return db[_0x86d3('0x26')][_0x86d3('0x39')](_0x1f203e);})['then'](function(_0x587747){_0x303f13[_0x86d3('0x3a')]=_0x587747;return _0x303f13;})['then'](respondWithFilteredResult(_0x14c9ff,_0x1f203e))['catch'](handleError(_0x14c9ff,null));};exports[_0x86d3('0x3b')]=function(_0x1385fc,_0x43490a){var _0x35d6fe={'raw':![],'where':{'id':_0x1385fc['params']['id']}},_0x23ef72={};_0x23ef72[_0x86d3('0x2a')]=_[_0x86d3('0x3c')](db[_0x86d3('0x26')]['rawAttributes']);_0x23ef72[_0x86d3('0x2b')]=_[_0x86d3('0x3c')](_0x1385fc['query']);_0x23ef72[_0x86d3('0x3d')]=_[_0x86d3('0x3e')](_0x23ef72['model'],_0x23ef72['query']);_0x35d6fe['attributes']=_[_0x86d3('0x3e')](_0x23ef72[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x2d')]));_0x35d6fe[_0x86d3('0x2c')]=_0x35d6fe['attributes'][_0x86d3('0x2e')]?_0x35d6fe[_0x86d3('0x2c')]:_0x23ef72['model'];if(_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x37')]){_0x35d6fe[_0x86d3('0x38')]=[{'all':!![]}];}_0x35d6fe=_[_0x86d3('0x35')]({},_0x35d6fe,_0x1385fc[_0x86d3('0x36')]);return db[_0x86d3('0x26')]['find'](_0x35d6fe)[_0x86d3('0x20')](handleEntityNotFound(_0x43490a,null))[_0x86d3('0x20')](respondWithResult(_0x43490a,null))['catch'](handleError(_0x43490a,null));};exports[_0x86d3('0x3f')]=function(_0x412d0e,_0xd20863){return db[_0x86d3('0x26')][_0x86d3('0x3f')](_0x412d0e['body'],{})[_0x86d3('0x20')](respondWithResult(_0xd20863,0xc9))[_0x86d3('0x40')](handleError(_0xd20863,null));};exports[_0x86d3('0x1f')]=function(_0x14fa58,_0x369b75){if(_0x14fa58[_0x86d3('0x41')]['id']){delete _0x14fa58[_0x86d3('0x41')]['id'];}return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x14fa58[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x369b75,null))[_0x86d3('0x20')](saveUpdates(_0x14fa58['body'],null))[_0x86d3('0x20')](respondWithResult(_0x369b75,null))[_0x86d3('0x40')](handleError(_0x369b75,null));};exports['destroy']=function(_0x43290d,_0x23a6ee){return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x43290d[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x23a6ee,null))['then'](removeEntity(_0x23a6ee,null))['catch'](handleError(_0x23a6ee,null));}; \ No newline at end of file +var _0x430c=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','update','find','eml-format','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x1c8d5e,_0x4b5de9){var _0x4582e7=function(_0x41670e){while(--_0x41670e){_0x1c8d5e['push'](_0x1c8d5e['shift']());}};_0x4582e7(++_0x4b5de9);}(_0x430c,0x1a1));var _0xc430=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0x430c[_0xa60623];return _0x4a6487;};'use strict';var emlformat=require(_0xc430('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc430('0x1'));var rp=require(_0xc430('0x2'));var moment=require(_0xc430('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc430('0x4'));var csv=require(_0xc430('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc430('0x6'));var _=require('lodash');var squel=require(_0xc430('0x7'));var crypto=require(_0xc430('0x8'));var jsforce=require(_0xc430('0x9'));var deskjs=require(_0xc430('0xa'));var toCsv=require(_0xc430('0x5'));var querystring=require(_0xc430('0xb'));var Papa=require(_0xc430('0xc'));var Redis=require(_0xc430('0xd'));var authService=require(_0xc430('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc430('0xf'));var hardwareService=require(_0xc430('0x10'));var logger=require('../../config/logger')(_0xc430('0x11'));var utils=require('../../config/utils');var config=require(_0xc430('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc430('0x13'))['db'];function respondWithStatusCode(_0x8aa2e6,_0xc5f92){_0xc5f92=_0xc5f92||0xcc;return function(_0x1fb8ce){if(_0x1fb8ce){return _0x8aa2e6[_0xc430('0x14')](_0xc5f92);}return _0x8aa2e6[_0xc430('0x15')](_0xc5f92)[_0xc430('0x16')]();};}function respondWithResult(_0x54d851,_0x4e9134){_0x4e9134=_0x4e9134||0xc8;return function(_0x3f359c){if(_0x3f359c){return _0x54d851[_0xc430('0x15')](_0x4e9134)[_0xc430('0x17')](_0x3f359c);}};}function respondWithFilteredResult(_0x2ef538,_0x31d3b7){return function(_0x55cc6c){if(_0x55cc6c){var _0x111598=typeof _0x31d3b7['offset']==='undefined'&&typeof _0x31d3b7[_0xc430('0x18')]===_0xc430('0x19');var _0x2327c5=_0x55cc6c['count'];var _0x5d3acc=_0x111598?0x0:_0x31d3b7[_0xc430('0x1a')];var _0x4c1937=_0x111598?_0x55cc6c[_0xc430('0x1b')]:_0x31d3b7['offset']+_0x31d3b7['limit'];var _0x2f3203;if(_0x4c1937>=_0x2327c5){_0x4c1937=_0x2327c5;_0x2f3203=0xc8;}else{_0x2f3203=0xce;}_0x2ef538['status'](_0x2f3203);return _0x2ef538[_0xc430('0x1c')](_0xc430('0x1d'),_0x5d3acc+'-'+_0x4c1937+'/'+_0x2327c5)[_0xc430('0x17')](_0x55cc6c);}return null;};}function patchUpdates(_0x1f90bb){return function(_0x2a1ea1){try{jsonpatch['apply'](_0x2a1ea1,_0x1f90bb,!![]);}catch(_0x388a2f){return BPromise['reject'](_0x388a2f);}return _0x2a1ea1['save']();};}function saveUpdates(_0x3b7c3d,_0x2ea352){return function(_0x3c7afa){if(_0x3c7afa){return _0x3c7afa['update'](_0x3b7c3d)[_0xc430('0x1e')](function(_0x57d26e){return _0x57d26e;});}return null;};}function removeEntity(_0x23425d,_0x22ebfb){return function(_0x4efecd){if(_0x4efecd){return _0x4efecd[_0xc430('0x1f')]()[_0xc430('0x1e')](function(){_0x23425d['status'](0xcc)[_0xc430('0x16')]();});}};}function handleEntityNotFound(_0x59c498,_0x3aa85e){return function(_0x4b5280){if(!_0x4b5280){_0x59c498[_0xc430('0x14')](0x194);}return _0x4b5280;};}function handleError(_0x21e28a,_0x50110b){_0x50110b=_0x50110b||0x1f4;return function(_0x33433f){logger[_0xc430('0x20')](_0x33433f[_0xc430('0x21')]);if(_0x33433f[_0xc430('0x22')]){delete _0x33433f[_0xc430('0x22')];}_0x21e28a['status'](_0x50110b)[_0xc430('0x23')](_0x33433f);};}exports[_0xc430('0x24')]=function(_0x1c1da9,_0x1591e3){var _0x542cba={},_0x1f8086={},_0x4cf56c={'count':0x0,'rows':[]};var _0x1d65ee=_['map'](db[_0xc430('0x25')][_0xc430('0x26')],function(_0xfc8767){return{'name':_0xfc8767[_0xc430('0x27')],'type':_0xfc8767['type'][_0xc430('0x28')]};});_0x1f8086[_0xc430('0x29')]=_[_0xc430('0x2a')](_0x1d65ee,_0xc430('0x22'));_0x1f8086['query']=_[_0xc430('0x2b')](_0x1c1da9[_0xc430('0x2c')]);_0x1f8086['filters']=_[_0xc430('0x2d')](_0x1f8086['model'],_0x1f8086['query']);_0x542cba[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x1f8086[_0xc430('0x29')],qs[_0xc430('0x2f')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x2f')]));_0x542cba[_0xc430('0x2e')]=_0x542cba[_0xc430('0x2e')]['length']?_0x542cba[_0xc430('0x2e')]:_0x1f8086['model'];if(!_0x1c1da9[_0xc430('0x2c')][_0xc430('0x30')](_0xc430('0x31'))){_0x542cba[_0xc430('0x18')]=qs['limit'](_0x1c1da9[_0xc430('0x2c')]['limit']);_0x542cba['offset']=qs[_0xc430('0x1a')](_0x1c1da9[_0xc430('0x2c')]['offset']);}_0x542cba[_0xc430('0x32')]=qs[_0xc430('0x33')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x33')]);_0x542cba[_0xc430('0x34')]=qs[_0xc430('0x35')](_[_0xc430('0x36')](_0x1c1da9[_0xc430('0x2c')],_0x1f8086[_0xc430('0x35')]),_0x1d65ee);if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x37')]){_0x542cba[_0xc430('0x34')]=_[_0xc430('0x38')](_0x542cba[_0xc430('0x34')],{'$or':_[_0xc430('0x2a')](_0x1d65ee,function(_0x537e4c){if(_0x537e4c[_0xc430('0x39')]!==_0xc430('0x3a')){var _0x24363b={};_0x24363b[_0x537e4c[_0xc430('0x22')]]={'$like':'%'+_0x1c1da9['query'][_0xc430('0x37')]+'%'};return _0x24363b;}})});}_0x542cba=_[_0xc430('0x38')]({},_0x542cba,_0x1c1da9[_0xc430('0x3b')]);var _0x45b3dc={'where':_0x542cba[_0xc430('0x34')]};return db[_0xc430('0x25')]['count'](_0x45b3dc)[_0xc430('0x1e')](function(_0x348f2f){_0x4cf56c[_0xc430('0x1b')]=_0x348f2f;if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x3c')]){_0x542cba[_0xc430('0x3d')]=[{'all':!![]}];}return db[_0xc430('0x25')][_0xc430('0x3e')](_0x542cba);})[_0xc430('0x1e')](function(_0x4174d2){_0x4cf56c[_0xc430('0x3f')]=_0x4174d2;return _0x4cf56c;})[_0xc430('0x1e')](respondWithFilteredResult(_0x1591e3,_0x542cba))[_0xc430('0x40')](handleError(_0x1591e3,null));};exports[_0xc430('0x41')]=function(_0x5a9c4b,_0x47edb0){var _0x4983e0={'raw':![],'where':{'id':_0x5a9c4b[_0xc430('0x42')]['id']}},_0x262063={};_0x262063[_0xc430('0x29')]=_[_0xc430('0x2b')](db[_0xc430('0x25')][_0xc430('0x26')]);_0x262063[_0xc430('0x2c')]=_[_0xc430('0x2b')](_0x5a9c4b[_0xc430('0x2c')]);_0x262063[_0xc430('0x35')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],_0x262063[_0xc430('0x2c')]);_0x4983e0[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],qs['fields'](_0x5a9c4b[_0xc430('0x2c')][_0xc430('0x2f')]));_0x4983e0[_0xc430('0x2e')]=_0x4983e0[_0xc430('0x2e')][_0xc430('0x43')]?_0x4983e0[_0xc430('0x2e')]:_0x262063[_0xc430('0x29')];if(_0x5a9c4b[_0xc430('0x2c')]['includeAll']){_0x4983e0[_0xc430('0x3d')]=[{'all':!![]}];}_0x4983e0=_['merge']({},_0x4983e0,_0x5a9c4b[_0xc430('0x3b')]);return db[_0xc430('0x25')]['find'](_0x4983e0)['then'](handleEntityNotFound(_0x47edb0,null))[_0xc430('0x1e')](respondWithResult(_0x47edb0,null))['catch'](handleError(_0x47edb0,null));};exports['create']=function(_0x10db27,_0x4eafae){return db[_0xc430('0x25')][_0xc430('0x44')](_0x10db27[_0xc430('0x45')],{})['then'](respondWithResult(_0x4eafae,0xc9))[_0xc430('0x40')](handleError(_0x4eafae,null));};exports[_0xc430('0x46')]=function(_0x19e563,_0x549400){if(_0x19e563[_0xc430('0x45')]['id']){delete _0x19e563[_0xc430('0x45')]['id'];}return db[_0xc430('0x25')][_0xc430('0x47')]({'where':{'id':_0x19e563[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x549400,null))[_0xc430('0x1e')](saveUpdates(_0x19e563['body'],null))[_0xc430('0x1e')](respondWithResult(_0x549400,null))[_0xc430('0x40')](handleError(_0x549400,null));};exports[_0xc430('0x1f')]=function(_0x4e9aff,_0x23cb41){return db[_0xc430('0x25')][_0xc430('0x47')]({'where':{'id':_0x4e9aff[_0xc430('0x42')]['id']}})['then'](handleEntityNotFound(_0x23cb41,null))[_0xc430('0x1e')](removeEntity(_0x23cb41,null))['catch'](handleError(_0x23cb41,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 8e3d3c0..5e67386 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 _0x37f1=['path','rimraf','../../config/environment','exports','define','Integration','integrations','lodash','../../config/logger','api','moment','request-promise'];(function(_0x458e7a,_0x29568c){var _0x2cd164=function(_0x55f4c2){while(--_0x55f4c2){_0x458e7a['push'](_0x458e7a['shift']());}};_0x2cd164(++_0x29568c);}(_0x37f1,0x1ab));var _0x137f=function(_0x76fc43,_0x53dbcb){_0x76fc43=_0x76fc43-0x0;var _0x2d5160=_0x37f1[_0x76fc43];return _0x2d5160;};'use strict';var _=require(_0x137f('0x0'));var util=require('util');var logger=require(_0x137f('0x1'))(_0x137f('0x2'));var moment=require(_0x137f('0x3'));var BPromise=require('bluebird');var rp=require(_0x137f('0x4'));var fs=require('fs');var path=require(_0x137f('0x5'));var rimraf=require(_0x137f('0x6'));var config=require(_0x137f('0x7'));var attributes=require('./integration.attributes');module[_0x137f('0x8')]=function(_0x34fd59,_0x31d1a2){return _0x34fd59[_0x137f('0x9')](_0x137f('0xa'),attributes,{'tableName':_0x137f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb08=['path','rimraf','../../config/environment','./integration.attributes','define','integrations','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x96f74c,_0xfc30a4){var _0x379222=function(_0x1bbde9){while(--_0x1bbde9){_0x96f74c['push'](_0x96f74c['shift']());}};_0x379222(++_0xfc30a4);}(_0xcb08,0x11a));var _0x8cb0=function(_0x45410f,_0x142ee5){_0x45410f=_0x45410f-0x0;var _0x3dacd0=_0xcb08[_0x45410f];return _0x3dacd0;};'use strict';var _=require(_0x8cb0('0x0'));var util=require(_0x8cb0('0x1'));var logger=require(_0x8cb0('0x2'))(_0x8cb0('0x3'));var moment=require(_0x8cb0('0x4'));var BPromise=require('bluebird');var rp=require(_0x8cb0('0x5'));var fs=require('fs');var path=require(_0x8cb0('0x6'));var rimraf=require(_0x8cb0('0x7'));var config=require(_0x8cb0('0x8'));var attributes=require(_0x8cb0('0x9'));module['exports']=function(_0x1fcb1d,_0x24c3a7){return _0x1fcb1d[_0x8cb0('0xa')]('Integration',attributes,{'tableName':_0x8cb0('0xb'),'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 bf0dd96..4c4fc2f 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 _0x7880=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x15169f,_0x56cf47){var _0x49302f=function(_0x150e38){while(--_0x150e38){_0x15169f['push'](_0x15169f['shift']());}};_0x49302f(++_0x56cf47);}(_0x7880,0x1f4));var _0x0788=function(_0x446186,_0x116e31){_0x446186=_0x446186-0x0;var _0x63b564=_0x7880[_0x446186];return _0x63b564;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9cb8,_0x44bbb5,_0x3c29f3){return new BPromise(function(_0x422f8b,_0x55e48a){return client[_0x0788('0xc')](_0x3f9cb8,_0x3c29f3)['then'](function(_0xabaf81){logger['info'](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x44bbb5,_0x0788('0xe'),JSON['stringify'](_0xabaf81));if(_0xabaf81[_0x0788('0x11')]){if(_0xabaf81[_0x0788('0x11')][_0x0788('0x12')]===0x1f4){logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')][_0x0788('0x13')]);return _0x55e48a(_0xabaf81['error'][_0x0788('0x13')]);}logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')]['message']);return _0x422f8b(_0xabaf81[_0x0788('0x11')]['message']);}else{logger[_0x0788('0x14')](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));_0x422f8b(_0xabaf81[_0x0788('0x15')][_0x0788('0x13')]);}})[_0x0788('0x16')](function(_0x5e1a29){logger['error'](_0x0788('0xd'),_0x44bbb5,_0x5e1a29);_0x55e48a(_0x5e1a29);});});} \ No newline at end of file +var _0x955f=['Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','then','info'];(function(_0x5a5173,_0x5ce0db){var _0x28660d=function(_0x1aa703){while(--_0x1aa703){_0x5a5173['push'](_0x5a5173['shift']());}};_0x28660d(++_0x5ce0db);}(_0x955f,0x1eb));var _0xf955=function(_0x535f1c,_0x9270bd){_0x535f1c=_0x535f1c-0x0;var _0xd05828=_0x955f[_0x535f1c];return _0xd05828;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var BPromise=require(_0xf955('0x3'));var rs=require(_0xf955('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf955('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf955('0x6'));var config=require('../../config/environment');var jayson=require(_0xf955('0x7'));var client=jayson[_0xf955('0x8')][_0xf955('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59d5b3,_0x18432f,_0x20c096){return new BPromise(function(_0x4f58fb,_0x254b38){return client[_0xf955('0xa')](_0x59d5b3,_0x20c096)[_0xf955('0xb')](function(_0x38b190){logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,_0xf955('0xe'));logger['debug'](_0xf955('0xf'),_0x18432f,'request\x20sent',JSON[_0xf955('0x10')](_0x38b190));if(_0x38b190[_0xf955('0x11')]){if(_0x38b190[_0xf955('0x11')]['code']===0x1f4){logger[_0xf955('0x11')]('Integration,\x20%s,\x20%s',_0x18432f,_0x38b190[_0xf955('0x11')]['message']);return _0x254b38(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);return _0x4f58fb(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}else{logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,'request\x20sent');_0x4f58fb(_0x38b190[_0xf955('0x13')]['message']);}})[_0xf955('0x14')](function(_0x3a814f){logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x3a814f);_0x254b38(_0x3a814f);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index b42b494..8811147 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 _0x187d=['/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x3690de,_0xaad404){var _0x9737de=function(_0x4bc616){while(--_0x4bc616){_0x3690de['push'](_0x3690de['shift']());}};_0x9737de(++_0xaad404);}(_0x187d,0x93));var _0xd187=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x187d[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var fs_extra=require(_0xd187('0x5'));var auth=require(_0xd187('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd187('0x7'));var controller=require(_0xd187('0x8'));router['get']('/',auth[_0xd187('0x9')](),controller[_0xd187('0xa')]);router[_0xd187('0xb')](_0xd187('0xc'),auth[_0xd187('0x9')](),controller[_0xd187('0xd')]);router[_0xd187('0xb')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0xf')]);router[_0xd187('0x10')]('/',auth[_0xd187('0x9')](),controller[_0xd187('0x11')]);router[_0xd187('0x12')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0x13')]);router[_0xd187('0x14')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0x15')]);module[_0xd187('0x16')]=router; \ No newline at end of file +var _0xda2d=['show','create','put','/:id','update','delete','util','path','connect-timeout','express','Router','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xda2d,0x102));var _0xdda2=function(_0x53c110,_0x3cc899){_0x53c110=_0x53c110-0x0;var _0x5ca1d5=_0xda2d[_0x53c110];return _0x5ca1d5;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0x7')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xc')]);router['post']('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')](_0xdda2('0xf'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x10')]);router[_0xdda2('0x11')](_0xdda2('0xf'),auth['isAuthenticated'](),controller['destroy']);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 243105d..d7998dd 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 _0x10dd=['ENUM','SENT','SENDING','RECEIVED','FAILED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x1ee73f,_0x47f602){var _0x3f52de=function(_0x53f3fa){while(--_0x53f3fa){_0x1ee73f['push'](_0x1ee73f['shift']());}};_0x3f52de(++_0x47f602);}(_0x10dd,0x68));var _0xd10d=function(_0x922b53,_0x2ee440){_0x922b53=_0x922b53-0x0;var _0x5c6d5f=_0x10dd[_0x922b53];return _0x5c6d5f;};'use strict';var Sequelize=require('sequelize');module[_0xd10d('0x0')]={'integration':{'type':Sequelize[_0xd10d('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xd10d('0x1')]},'ticketId':{'type':Sequelize[_0xd10d('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xd10d('0x1')]},'uniqueid':{'type':Sequelize[_0xd10d('0x1')]},'calleridnum':{'type':Sequelize[_0xd10d('0x1')]},'calleridname':{'type':Sequelize[_0xd10d('0x1')]},'queue':{'type':Sequelize[_0xd10d('0x1')]},'interface':{'type':Sequelize[_0xd10d('0x1')]},'membername':{'type':Sequelize[_0xd10d('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xd10d('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xd10d('0x3')]},'talktime':{'type':Sequelize[_0xd10d('0x2')]},'agentacw':{'type':Sequelize[_0xd10d('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd10d('0x2')]},'reason':{'type':Sequelize[_0xd10d('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xd10d('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xd10d('0x3')]},'agentdump':{'type':Sequelize[_0xd10d('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xd10d('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xd10d('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd10d('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd10d('0x1')]},'context':{'type':Sequelize[_0xd10d('0x1')]},'exten':{'type':Sequelize[_0xd10d('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xd10d('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xd10d('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd10d('0x1')]},'destcalleridname':{'type':Sequelize[_0xd10d('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xd10d('0x1')]},'destlanguage':{'type':Sequelize[_0xd10d('0x1')]},'destaccountcode':{'type':Sequelize[_0xd10d('0x1')]},'destcontext':{'type':Sequelize[_0xd10d('0x1')]},'destexten':{'type':Sequelize[_0xd10d('0x1')]},'destpriority':{'type':Sequelize[_0xd10d('0x1')]},'destuniqueid':{'type':Sequelize[_0xd10d('0x1')]},'messageId':{'type':Sequelize[_0xd10d('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xd10d('0x1')]},'from':{'type':Sequelize[_0xd10d('0x1')]},'to':{'type':Sequelize[_0xd10d('0x1')]},'cc':{'type':Sequelize[_0xd10d('0x1')]},'attachment':{'type':Sequelize[_0xd10d('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xd10d('0x5')]},'status':{'type':Sequelize[_0xd10d('0x6')](_0xd10d('0x7'),_0xd10d('0x8'),_0xd10d('0x9'),_0xd10d('0xa'))},'url':{'type':Sequelize[_0xd10d('0x1')]},'app':{'type':Sequelize[_0xd10d('0x1')]},'appdata':{'type':Sequelize[_0xd10d('0x1')]},'projectId':{'type':Sequelize[_0xd10d('0x2')]}}; \ No newline at end of file +var _0xeaab=['INTEGER','TEXT','ENUM','SENT','SENDING','exports','STRING','DATE','BOOLEAN'];(function(_0x187c7d,_0x3eb6bb){var _0x2b2291=function(_0x1a5b6d){while(--_0x1a5b6d){_0x187c7d['push'](_0x187c7d['shift']());}};_0x2b2291(++_0x3eb6bb);}(_0xeaab,0x83));var _0xbeaa=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xeaab[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0xbeaa('0x0')]={'integration':{'type':Sequelize[_0xbeaa('0x1')]},'eventChannel':{'type':Sequelize[_0xbeaa('0x1')]},'exitStatus':{'type':Sequelize[_0xbeaa('0x1')]},'ticketId':{'type':Sequelize[_0xbeaa('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xbeaa('0x1')]},'uniqueid':{'type':Sequelize[_0xbeaa('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xbeaa('0x1')]},'agentcalledAt':{'type':Sequelize[_0xbeaa('0x2')]},'agentconnectAt':{'type':Sequelize[_0xbeaa('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xbeaa('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xbeaa('0x2')]},'talktime':{'type':Sequelize[_0xbeaa('0x4')]},'agentacw':{'type':Sequelize[_0xbeaa('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xbeaa('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xbeaa('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xbeaa('0x2')]},'agentdump':{'type':Sequelize[_0xbeaa('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xbeaa('0x2')]},'lastevent':{'type':Sequelize[_0xbeaa('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xbeaa('0x4')]},'channelstatedesc':{'type':Sequelize[_0xbeaa('0x1')]},'connectedlinenum':{'type':Sequelize[_0xbeaa('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xbeaa('0x1')]},'accountcode':{'type':Sequelize[_0xbeaa('0x1')]},'context':{'type':Sequelize[_0xbeaa('0x1')]},'exten':{'type':Sequelize[_0xbeaa('0x1')]},'priority':{'type':Sequelize[_0xbeaa('0x1')]},'destchannel':{'type':Sequelize[_0xbeaa('0x1')]},'destchannelstate':{'type':Sequelize[_0xbeaa('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xbeaa('0x1')]},'destcalleridnum':{'type':Sequelize[_0xbeaa('0x1')]},'destcalleridname':{'type':Sequelize[_0xbeaa('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xbeaa('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xbeaa('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xbeaa('0x1')]},'destcontext':{'type':Sequelize[_0xbeaa('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xbeaa('0x1')]},'destuniqueid':{'type':Sequelize[_0xbeaa('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xbeaa('0x1')]},'subject':{'type':Sequelize[_0xbeaa('0x1')]},'from':{'type':Sequelize[_0xbeaa('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xbeaa('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xbeaa('0x5')]},'status':{'type':Sequelize[_0xbeaa('0x6')](_0xbeaa('0x7'),_0xbeaa('0x8'),'RECEIVED','FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xbeaa('0x1')]},'appdata':{'type':Sequelize[_0xbeaa('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index d814a91..e4b8681 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 _0x8e32=['index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','send'];(function(_0x39693d,_0x12f836){var _0x258612=function(_0x2c819e){while(--_0x2c819e){_0x39693d['push'](_0x39693d['shift']());}};_0x258612(++_0x12f836);}(_0x8e32,0x100));var _0x28e3=function(_0x265d7d,_0x84ae22){_0x265d7d=_0x265d7d-0x0;var _0x2c14b1=_0x8e32[_0x265d7d];return _0x2c14b1;};'use strict';var emlformat=require(_0x28e3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x28e3('0x1'));var jsonpatch=require(_0x28e3('0x2'));var rp=require('request-promise');var moment=require(_0x28e3('0x3'));var BPromise=require(_0x28e3('0x4'));var Mustache=require(_0x28e3('0x5'));var util=require('util');var path=require(_0x28e3('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x28e3('0x7'));var fs=require('fs');var fs_extra=require(_0x28e3('0x8'));var _=require(_0x28e3('0x9'));var squel=require(_0x28e3('0xa'));var crypto=require(_0x28e3('0xb'));var jsforce=require(_0x28e3('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x28e3('0xd'));var Papa=require(_0x28e3('0xe'));var Redis=require(_0x28e3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x28e3('0x10'));var as=require(_0x28e3('0x11'));var hardwareService=require(_0x28e3('0x12'));var logger=require(_0x28e3('0x13'))('api');var utils=require(_0x28e3('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a2c48,_0x232e77){_0x232e77=_0x232e77||0xcc;return function(_0x3832ee){if(_0x3832ee){return _0x5a2c48[_0x28e3('0x15')](_0x232e77);}return _0x5a2c48[_0x28e3('0x16')](_0x232e77)[_0x28e3('0x17')]();};}function respondWithResult(_0x17123e,_0x26475f){_0x26475f=_0x26475f||0xc8;return function(_0x1b0981){if(_0x1b0981){return _0x17123e[_0x28e3('0x16')](_0x26475f)['json'](_0x1b0981);}};}function respondWithFilteredResult(_0x3c0391,_0x147936){return function(_0x4fcd88){if(_0x4fcd88){var _0x197265=typeof _0x147936[_0x28e3('0x18')]===_0x28e3('0x19')&&typeof _0x147936[_0x28e3('0x1a')]==='undefined';var _0x4161ee=_0x4fcd88['count'];var _0x3543cb=_0x197265?0x0:_0x147936[_0x28e3('0x18')];var _0x9d84ec=_0x197265?_0x4fcd88[_0x28e3('0x1b')]:_0x147936[_0x28e3('0x18')]+_0x147936[_0x28e3('0x1a')];var _0x3c280c;if(_0x9d84ec>=_0x4161ee){_0x9d84ec=_0x4161ee;_0x3c280c=0xc8;}else{_0x3c280c=0xce;}_0x3c0391[_0x28e3('0x16')](_0x3c280c);return _0x3c0391[_0x28e3('0x1c')]('Content-Range',_0x3543cb+'-'+_0x9d84ec+'/'+_0x4161ee)[_0x28e3('0x1d')](_0x4fcd88);}return null;};}function patchUpdates(_0x49f1ab){return function(_0x2dd858){try{jsonpatch[_0x28e3('0x1e')](_0x2dd858,_0x49f1ab,!![]);}catch(_0x510ce1){return BPromise[_0x28e3('0x1f')](_0x510ce1);}return _0x2dd858[_0x28e3('0x20')]();};}function saveUpdates(_0x545234,_0x9d2d61){return function(_0x340c90){if(_0x340c90){return _0x340c90[_0x28e3('0x21')](_0x545234)[_0x28e3('0x22')](function(_0x5cfc4b){return _0x5cfc4b;});}return null;};}function removeEntity(_0x35ae10,_0x123f07){return function(_0x23e24c){if(_0x23e24c){return _0x23e24c[_0x28e3('0x23')]()[_0x28e3('0x22')](function(){_0x35ae10['status'](0xcc)[_0x28e3('0x17')]();});}};}function handleEntityNotFound(_0x37a18d,_0x3555c6){return function(_0xfa82f6){if(!_0xfa82f6){_0x37a18d['sendStatus'](0x194);}return _0xfa82f6;};}function handleError(_0x50e3e4,_0x415bf1){_0x415bf1=_0x415bf1||0x1f4;return function(_0x19395d){logger[_0x28e3('0x24')](_0x19395d[_0x28e3('0x25')]);if(_0x19395d[_0x28e3('0x26')]){delete _0x19395d['name'];}_0x50e3e4[_0x28e3('0x16')](_0x415bf1)[_0x28e3('0x27')](_0x19395d);};}exports[_0x28e3('0x28')]=function(_0x2ec0cf,_0x3855fd){var _0x5d1105={},_0x4b0d03={},_0x5e4635={'count':0x0,'rows':[]};var _0x459638=_[_0x28e3('0x29')](db[_0x28e3('0x2a')][_0x28e3('0x2b')],function(_0x295089){return{'name':_0x295089[_0x28e3('0x2c')],'type':_0x295089[_0x28e3('0x2d')][_0x28e3('0x2e')]};});_0x4b0d03[_0x28e3('0x2f')]=_['map'](_0x459638,'name');_0x4b0d03[_0x28e3('0x30')]=_[_0x28e3('0x31')](_0x2ec0cf['query']);_0x4b0d03[_0x28e3('0x32')]=_['intersection'](_0x4b0d03[_0x28e3('0x2f')],_0x4b0d03['query']);_0x5d1105[_0x28e3('0x33')]=_[_0x28e3('0x34')](_0x4b0d03[_0x28e3('0x2f')],qs[_0x28e3('0x35')](_0x2ec0cf[_0x28e3('0x30')]['fields']));_0x5d1105[_0x28e3('0x33')]=_0x5d1105['attributes'][_0x28e3('0x36')]?_0x5d1105[_0x28e3('0x33')]:_0x4b0d03[_0x28e3('0x2f')];if(!_0x2ec0cf[_0x28e3('0x30')][_0x28e3('0x37')](_0x28e3('0x38'))){_0x5d1105[_0x28e3('0x1a')]=qs[_0x28e3('0x1a')](_0x2ec0cf[_0x28e3('0x30')][_0x28e3('0x1a')]);_0x5d1105[_0x28e3('0x18')]=qs[_0x28e3('0x18')](_0x2ec0cf['query'][_0x28e3('0x18')]);}_0x5d1105[_0x28e3('0x39')]=qs['sort'](_0x2ec0cf['query']['sort']);_0x5d1105[_0x28e3('0x3a')]=qs[_0x28e3('0x32')](_[_0x28e3('0x3b')](_0x2ec0cf['query'],_0x4b0d03[_0x28e3('0x32')]),_0x459638);if(_0x2ec0cf[_0x28e3('0x30')][_0x28e3('0x3c')]){_0x5d1105['where']=_[_0x28e3('0x3d')](_0x5d1105['where'],{'$or':_['map'](_0x459638,function(_0x40d5f6){if(_0x40d5f6['type']!==_0x28e3('0x3e')){var _0x5d9978={};_0x5d9978[_0x40d5f6[_0x28e3('0x26')]]={'$like':'%'+_0x2ec0cf[_0x28e3('0x30')]['filter']+'%'};return _0x5d9978;}})});}_0x5d1105=_[_0x28e3('0x3d')]({},_0x5d1105,_0x2ec0cf[_0x28e3('0x3f')]);var _0x5e32f5={'where':_0x5d1105[_0x28e3('0x3a')]};return db[_0x28e3('0x2a')][_0x28e3('0x1b')](_0x5e32f5)['then'](function(_0xb3fba3){_0x5e4635['count']=_0xb3fba3;if(_0x2ec0cf[_0x28e3('0x30')][_0x28e3('0x40')]){_0x5d1105[_0x28e3('0x41')]=[{'all':!![]}];}return db['IntegrationReport'][_0x28e3('0x42')](_0x5d1105);})['then'](function(_0xffa8a4){_0x5e4635[_0x28e3('0x43')]=_0xffa8a4;return _0x5e4635;})[_0x28e3('0x22')](respondWithFilteredResult(_0x3855fd,_0x5d1105))[_0x28e3('0x44')](handleError(_0x3855fd,null));};exports['show']=function(_0x1a77c8,_0x850346){var _0x4796e3={'raw':![],'where':{'id':_0x1a77c8[_0x28e3('0x45')]['id']}},_0x389a28={};_0x389a28[_0x28e3('0x2f')]=_[_0x28e3('0x31')](db[_0x28e3('0x2a')]['rawAttributes']);_0x389a28[_0x28e3('0x30')]=_[_0x28e3('0x31')](_0x1a77c8[_0x28e3('0x30')]);_0x389a28['filters']=_['intersection'](_0x389a28[_0x28e3('0x2f')],_0x389a28[_0x28e3('0x30')]);_0x4796e3['attributes']=_[_0x28e3('0x34')](_0x389a28[_0x28e3('0x2f')],qs[_0x28e3('0x35')](_0x1a77c8[_0x28e3('0x30')][_0x28e3('0x35')]));_0x4796e3['attributes']=_0x4796e3[_0x28e3('0x33')]['length']?_0x4796e3[_0x28e3('0x33')]:_0x389a28[_0x28e3('0x2f')];if(_0x1a77c8[_0x28e3('0x30')][_0x28e3('0x40')]){_0x4796e3[_0x28e3('0x41')]=[{'all':!![]}];}_0x4796e3=_['merge']({},_0x4796e3,_0x1a77c8[_0x28e3('0x3f')]);return db['IntegrationReport']['find'](_0x4796e3)[_0x28e3('0x22')](handleEntityNotFound(_0x850346,null))[_0x28e3('0x22')](respondWithResult(_0x850346,null))[_0x28e3('0x44')](handleError(_0x850346,null));};exports[_0x28e3('0x46')]=function(_0x3286c3,_0x267871){return db[_0x28e3('0x2a')][_0x28e3('0x46')](_0x3286c3[_0x28e3('0x47')],{})[_0x28e3('0x22')](respondWithResult(_0x267871,0xc9))[_0x28e3('0x44')](handleError(_0x267871,null));};exports[_0x28e3('0x21')]=function(_0x3972f5,_0x1f76cd){if(_0x3972f5[_0x28e3('0x47')]['id']){delete _0x3972f5[_0x28e3('0x47')]['id'];}return db[_0x28e3('0x2a')][_0x28e3('0x48')]({'where':{'id':_0x3972f5[_0x28e3('0x45')]['id']}})[_0x28e3('0x22')](handleEntityNotFound(_0x1f76cd,null))[_0x28e3('0x22')](saveUpdates(_0x3972f5[_0x28e3('0x47')],null))[_0x28e3('0x22')](respondWithResult(_0x1f76cd,null))['catch'](handleError(_0x1f76cd,null));};exports[_0x28e3('0x23')]=function(_0x40849b,_0x51fa4e){return db[_0x28e3('0x2a')][_0x28e3('0x48')]({'where':{'id':_0x40849b[_0x28e3('0x45')]['id']}})[_0x28e3('0x22')](handleEntityNotFound(_0x51fa4e,null))[_0x28e3('0x22')](removeEntity(_0x51fa4e,null))[_0x28e3('0x44')](handleError(_0x51fa4e,null));};exports[_0x28e3('0x49')]=function(_0x279d98,_0x1e3660){return db[_0x28e3('0x2a')]['describe']()[_0x28e3('0x22')](respondWithResult(_0x1e3660,null))['catch'](handleError(_0x1e3660,null));}; \ No newline at end of file +var _0x0242=['destroy','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','IntegrationReport','findAll','rows','catch','show','keys','find','body','params','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then'];(function(_0x4d4d2b,_0x3e9c00){var _0xab9ad6=function(_0x39f351){while(--_0x39f351){_0x4d4d2b['push'](_0x4d4d2b['shift']());}};_0xab9ad6(++_0x3e9c00);}(_0x0242,0xbb));var _0x2024=function(_0x210718,_0x247b55){_0x210718=_0x210718-0x0;var _0x541bfc=_0x0242[_0x210718];return _0x541bfc;};'use strict';var emlformat=require(_0x2024('0x0'));var rimraf=require(_0x2024('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2024('0x2'));var rp=require('request-promise');var moment=require(_0x2024('0x3'));var BPromise=require(_0x2024('0x4'));var Mustache=require(_0x2024('0x5'));var util=require(_0x2024('0x6'));var path=require(_0x2024('0x7'));var sox=require(_0x2024('0x8'));var csv=require(_0x2024('0x9'));var ejs=require(_0x2024('0xa'));var fs=require('fs');var fs_extra=require(_0x2024('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2024('0xc'));var jsforce=require(_0x2024('0xd'));var deskjs=require(_0x2024('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2024('0xf'));var Redis=require(_0x2024('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2024('0x11'));var as=require(_0x2024('0x12'));var hardwareService=require(_0x2024('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2024('0x14'));var config=require(_0x2024('0x15'));var licenseUtil=require(_0x2024('0x16'));var db=require(_0x2024('0x17'))['db'];function respondWithStatusCode(_0x4f7cd8,_0x51fe29){_0x51fe29=_0x51fe29||0xcc;return function(_0x21e0ab){if(_0x21e0ab){return _0x4f7cd8[_0x2024('0x18')](_0x51fe29);}return _0x4f7cd8[_0x2024('0x19')](_0x51fe29)[_0x2024('0x1a')]();};}function respondWithResult(_0x4b7ce9,_0x30c8b6){_0x30c8b6=_0x30c8b6||0xc8;return function(_0x6fb7f){if(_0x6fb7f){return _0x4b7ce9['status'](_0x30c8b6)[_0x2024('0x1b')](_0x6fb7f);}};}function respondWithFilteredResult(_0xe81435,_0x34e4c8){return function(_0x1d5d1c){if(_0x1d5d1c){var _0x337d98=typeof _0x34e4c8['offset']===_0x2024('0x1c')&&typeof _0x34e4c8[_0x2024('0x1d')]===_0x2024('0x1c');var _0x2dbe14=_0x1d5d1c[_0x2024('0x1e')];var _0x3c6117=_0x337d98?0x0:_0x34e4c8['offset'];var _0x3e89e2=_0x337d98?_0x1d5d1c['count']:_0x34e4c8[_0x2024('0x1f')]+_0x34e4c8[_0x2024('0x1d')];var _0x332862;if(_0x3e89e2>=_0x2dbe14){_0x3e89e2=_0x2dbe14;_0x332862=0xc8;}else{_0x332862=0xce;}_0xe81435[_0x2024('0x19')](_0x332862);return _0xe81435[_0x2024('0x20')]('Content-Range',_0x3c6117+'-'+_0x3e89e2+'/'+_0x2dbe14)['json'](_0x1d5d1c);}return null;};}function patchUpdates(_0x178f14){return function(_0xba82c5){try{jsonpatch[_0x2024('0x21')](_0xba82c5,_0x178f14,!![]);}catch(_0x2670d1){return BPromise[_0x2024('0x22')](_0x2670d1);}return _0xba82c5[_0x2024('0x23')]();};}function saveUpdates(_0x47f51a,_0x5bed3d){return function(_0x2cfcbb){if(_0x2cfcbb){return _0x2cfcbb[_0x2024('0x24')](_0x47f51a)[_0x2024('0x25')](function(_0x54b408){return _0x54b408;});}return null;};}function removeEntity(_0x57a1be,_0x13a88c){return function(_0xafe2d3){if(_0xafe2d3){return _0xafe2d3[_0x2024('0x26')]()[_0x2024('0x25')](function(){_0x57a1be[_0x2024('0x19')](0xcc)[_0x2024('0x1a')]();});}};}function handleEntityNotFound(_0x4dacb3,_0x5c0f0e){return function(_0x547197){if(!_0x547197){_0x4dacb3['sendStatus'](0x194);}return _0x547197;};}function handleError(_0x1e8840,_0x1011e6){_0x1011e6=_0x1011e6||0x1f4;return function(_0x270e3f){logger[_0x2024('0x27')](_0x270e3f[_0x2024('0x28')]);if(_0x270e3f['name']){delete _0x270e3f[_0x2024('0x29')];}_0x1e8840[_0x2024('0x19')](_0x1011e6)[_0x2024('0x2a')](_0x270e3f);};}exports['index']=function(_0x3d91c4,_0x4a4535){var _0x5192de={},_0x12de99={},_0x157b63={'count':0x0,'rows':[]};var _0x982cc7=_[_0x2024('0x2b')](db['IntegrationReport'][_0x2024('0x2c')],function(_0x2f140d){return{'name':_0x2f140d[_0x2024('0x2d')],'type':_0x2f140d['type'][_0x2024('0x2e')]};});_0x12de99[_0x2024('0x2f')]=_[_0x2024('0x2b')](_0x982cc7,'name');_0x12de99[_0x2024('0x30')]=_['keys'](_0x3d91c4[_0x2024('0x30')]);_0x12de99[_0x2024('0x31')]=_['intersection'](_0x12de99['model'],_0x12de99[_0x2024('0x30')]);_0x5192de[_0x2024('0x32')]=_[_0x2024('0x33')](_0x12de99['model'],qs[_0x2024('0x34')](_0x3d91c4[_0x2024('0x30')][_0x2024('0x34')]));_0x5192de['attributes']=_0x5192de['attributes'][_0x2024('0x35')]?_0x5192de[_0x2024('0x32')]:_0x12de99[_0x2024('0x2f')];if(!_0x3d91c4[_0x2024('0x30')][_0x2024('0x36')](_0x2024('0x37'))){_0x5192de['limit']=qs[_0x2024('0x1d')](_0x3d91c4['query'][_0x2024('0x1d')]);_0x5192de[_0x2024('0x1f')]=qs[_0x2024('0x1f')](_0x3d91c4['query'][_0x2024('0x1f')]);}_0x5192de[_0x2024('0x38')]=qs['sort'](_0x3d91c4[_0x2024('0x30')][_0x2024('0x39')]);_0x5192de[_0x2024('0x3a')]=qs[_0x2024('0x31')](_[_0x2024('0x3b')](_0x3d91c4[_0x2024('0x30')],_0x12de99['filters']),_0x982cc7);if(_0x3d91c4[_0x2024('0x30')][_0x2024('0x3c')]){_0x5192de['where']=_[_0x2024('0x3d')](_0x5192de[_0x2024('0x3a')],{'$or':_[_0x2024('0x2b')](_0x982cc7,function(_0xda017e){if(_0xda017e[_0x2024('0x3e')]!==_0x2024('0x3f')){var _0x461045={};_0x461045[_0xda017e[_0x2024('0x29')]]={'$like':'%'+_0x3d91c4[_0x2024('0x30')]['filter']+'%'};return _0x461045;}})});}_0x5192de=_[_0x2024('0x3d')]({},_0x5192de,_0x3d91c4[_0x2024('0x40')]);var _0x39ec50={'where':_0x5192de[_0x2024('0x3a')]};return db['IntegrationReport'][_0x2024('0x1e')](_0x39ec50)[_0x2024('0x25')](function(_0x4a3eec){_0x157b63[_0x2024('0x1e')]=_0x4a3eec;if(_0x3d91c4['query']['includeAll']){_0x5192de['include']=[{'all':!![]}];}return db[_0x2024('0x41')][_0x2024('0x42')](_0x5192de);})['then'](function(_0x4cbc5b){_0x157b63[_0x2024('0x43')]=_0x4cbc5b;return _0x157b63;})[_0x2024('0x25')](respondWithFilteredResult(_0x4a4535,_0x5192de))[_0x2024('0x44')](handleError(_0x4a4535,null));};exports[_0x2024('0x45')]=function(_0x151c96,_0x164cb0){var _0x362145={'raw':![],'where':{'id':_0x151c96['params']['id']}},_0x3cba03={};_0x3cba03[_0x2024('0x2f')]=_[_0x2024('0x46')](db['IntegrationReport'][_0x2024('0x2c')]);_0x3cba03[_0x2024('0x30')]=_[_0x2024('0x46')](_0x151c96['query']);_0x3cba03['filters']=_[_0x2024('0x33')](_0x3cba03[_0x2024('0x2f')],_0x3cba03[_0x2024('0x30')]);_0x362145[_0x2024('0x32')]=_[_0x2024('0x33')](_0x3cba03[_0x2024('0x2f')],qs['fields'](_0x151c96['query'][_0x2024('0x34')]));_0x362145[_0x2024('0x32')]=_0x362145['attributes']['length']?_0x362145[_0x2024('0x32')]:_0x3cba03[_0x2024('0x2f')];if(_0x151c96[_0x2024('0x30')]['includeAll']){_0x362145['include']=[{'all':!![]}];}_0x362145=_['merge']({},_0x362145,_0x151c96[_0x2024('0x40')]);return db[_0x2024('0x41')][_0x2024('0x47')](_0x362145)[_0x2024('0x25')](handleEntityNotFound(_0x164cb0,null))[_0x2024('0x25')](respondWithResult(_0x164cb0,null))[_0x2024('0x44')](handleError(_0x164cb0,null));};exports['create']=function(_0x32966a,_0x448b6f){return db[_0x2024('0x41')]['create'](_0x32966a[_0x2024('0x48')],{})['then'](respondWithResult(_0x448b6f,0xc9))[_0x2024('0x44')](handleError(_0x448b6f,null));};exports[_0x2024('0x24')]=function(_0x42a696,_0x391fc2){if(_0x42a696[_0x2024('0x48')]['id']){delete _0x42a696[_0x2024('0x48')]['id'];}return db[_0x2024('0x41')][_0x2024('0x47')]({'where':{'id':_0x42a696[_0x2024('0x49')]['id']}})[_0x2024('0x25')](handleEntityNotFound(_0x391fc2,null))[_0x2024('0x25')](saveUpdates(_0x42a696[_0x2024('0x48')],null))[_0x2024('0x25')](respondWithResult(_0x391fc2,null))[_0x2024('0x44')](handleError(_0x391fc2,null));};exports[_0x2024('0x26')]=function(_0x23d93b,_0xdd938d){return db[_0x2024('0x41')][_0x2024('0x47')]({'where':{'id':_0x23d93b[_0x2024('0x49')]['id']}})[_0x2024('0x25')](handleEntityNotFound(_0xdd938d,null))[_0x2024('0x25')](removeEntity(_0xdd938d,null))[_0x2024('0x44')](handleError(_0xdd938d,null));};exports[_0x2024('0x4a')]=function(_0x46b310,_0x4ecd16){return db[_0x2024('0x41')]['describe']()[_0x2024('0x25')](respondWithResult(_0x4ecd16,null))[_0x2024('0x44')](handleError(_0x4ecd16,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index afa805c..04708f0 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 _0x0fcf=['IntegrationReport','report_integration','lodash','../../config/logger','api','moment','rimraf','../../config/environment','./integrationReport.attributes','exports','define'];(function(_0x17fc18,_0x78d356){var _0x12a349=function(_0x5e8caa){while(--_0x5e8caa){_0x17fc18['push'](_0x17fc18['shift']());}};_0x12a349(++_0x78d356);}(_0x0fcf,0x183));var _0xf0fc=function(_0x1953e3,_0x473946){_0x1953e3=_0x1953e3-0x0;var _0x4ea37b=_0x0fcf[_0x1953e3];return _0x4ea37b;};'use strict';var _=require(_0xf0fc('0x0'));var util=require('util');var logger=require(_0xf0fc('0x1'))(_0xf0fc('0x2'));var moment=require(_0xf0fc('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf0fc('0x4'));var config=require(_0xf0fc('0x5'));var attributes=require(_0xf0fc('0x6'));module[_0xf0fc('0x7')]=function(_0x568216,_0x4098ff){return _0x568216[_0xf0fc('0x8')](_0xf0fc('0x9'),attributes,{'tableName':_0xf0fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a19=['exports','define','IntegrationReport','report_integration','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1a19,0x1d2));var _0x91a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a19[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x91a1('0x0'));var util=require('util');var logger=require(_0x91a1('0x1'))(_0x91a1('0x2'));var moment=require('moment');var BPromise=require(_0x91a1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91a1('0x4'));var rimraf=require(_0x91a1('0x5'));var config=require(_0x91a1('0x6'));var attributes=require('./integrationReport.attributes');module[_0x91a1('0x7')]=function(_0x10175e,_0x3ded4f){return _0x10175e[_0x91a1('0x8')](_0x91a1('0x9'),attributes,{'tableName':_0x91a1('0xa'),'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 a3d7251..6d39d45 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31f0=['../../config/environment','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x2c0697,_0x15c276){var _0x4068d5=function(_0x19d47e){while(--_0x19d47e){_0x2c0697['push'](_0x2c0697['shift']());}};_0x4068d5(++_0x15c276);}(_0x31f0,0xb7));var _0x031f=function(_0x31a4dc,_0x5184a4){_0x31a4dc=_0x31a4dc-0x0;var _0x2421f1=_0x31f0[_0x31a4dc];return _0x2421f1;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var moment=require(_0x031f('0x1'));var BPromise=require('bluebird');var rs=require(_0x031f('0x2'));var fs=require('fs');var Redis=require(_0x031f('0x3'));var db=require(_0x031f('0x4'))['db'];var utils=require(_0x031f('0x5'));var logger=require('../../config/logger')(_0x031f('0x6'));var config=require(_0x031f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc98e,_0x487e65,_0x365f59){return new BPromise(function(_0x4300b4,_0x2569b6){return client[_0x031f('0x8')](_0x3dc98e,_0x365f59)['then'](function(_0x2e5624){logger[_0x031f('0x9')](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));logger[_0x031f('0xc')](_0x031f('0xd'),_0x487e65,_0x031f('0xb'),JSON[_0x031f('0xe')](_0x2e5624));if(_0x2e5624['error']){if(_0x2e5624[_0x031f('0xf')][_0x031f('0x10')]===0x1f4){logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x2569b6(_0x2e5624[_0x031f('0xf')]['message']);}logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x4300b4(_0x2e5624[_0x031f('0xf')]['message']);}else{logger['info'](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));_0x4300b4(_0x2e5624[_0x031f('0x12')][_0x031f('0x11')]);}})['catch'](function(_0x1dc4a7){logger[_0x031f('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x487e65,_0x1dc4a7);_0x2569b6(_0x1dc4a7);});});} \ No newline at end of file +var _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xc2c7,0x134));var _0x7c2c=function(_0x1a405b,_0x449355){_0x1a405b=_0x1a405b-0x0;var _0x4f7e8a=_0xc2c7[_0x1a405b];return _0x4f7e8a;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 46dc0a9..a859a75 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 _0xca96=['addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','isAuthenticated','index','get','/:id','show','/:id/sub_intervals','post'];(function(_0x4810a3,_0x354a38){var _0x3c0dc9=function(_0x54a917){while(--_0x54a917){_0x4810a3['push'](_0x4810a3['shift']());}};_0x3c0dc9(++_0x354a38);}(_0xca96,0x10f));var _0x6ca9=function(_0x55ee39,_0x4ee949){_0x55ee39=_0x55ee39-0x0;var _0x51ec97=_0xca96[_0x55ee39];return _0x51ec97;};'use strict';var multer=require('multer');var util=require(_0x6ca9('0x0'));var path=require('path');var timeout=require(_0x6ca9('0x1'));var express=require(_0x6ca9('0x2'));var router=express[_0x6ca9('0x3')]();var fs_extra=require(_0x6ca9('0x4'));var auth=require(_0x6ca9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6ca9('0x6'));var controller=require(_0x6ca9('0x7'));router['get']('/',auth[_0x6ca9('0x8')](),controller[_0x6ca9('0x9')]);router[_0x6ca9('0xa')](_0x6ca9('0xb'),auth[_0x6ca9('0x8')](),controller[_0x6ca9('0xc')]);router['get'](_0x6ca9('0xd'),auth[_0x6ca9('0x8')](),controller['getIntervals']);router[_0x6ca9('0xe')]('/',auth[_0x6ca9('0x8')](),controller['create']);router[_0x6ca9('0xe')](_0x6ca9('0xd'),auth[_0x6ca9('0x8')](),controller[_0x6ca9('0xf')]);router[_0x6ca9('0xe')](_0x6ca9('0x10'),auth[_0x6ca9('0x8')](),controller[_0x6ca9('0x11')]);router[_0x6ca9('0x12')](_0x6ca9('0xb'),auth['isAuthenticated'](),controller[_0x6ca9('0x13')]);router[_0x6ca9('0x14')](_0x6ca9('0xb'),auth['isAuthenticated'](),controller[_0x6ca9('0x15')]);module['exports']=router; \ No newline at end of file +var _0x5957=['util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','/:id','show','/:id/sub_intervals','isAuthenticated','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','multer'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x5957,0x158));var _0x7595=function(_0x597b51,_0x35a53e){_0x597b51=_0x597b51-0x0;var _0x2fd7a3=_0x5957[_0x597b51];return _0x2fd7a3;};'use strict';var multer=require(_0x7595('0x0'));var util=require(_0x7595('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7595('0x2'));var router=express['Router']();var fs_extra=require(_0x7595('0x3'));var auth=require(_0x7595('0x4'));var interaction=require(_0x7595('0x5'));var config=require(_0x7595('0x6'));var controller=require(_0x7595('0x7'));router[_0x7595('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7595('0x8')](_0x7595('0x9'),auth['isAuthenticated'](),controller[_0x7595('0xa')]);router[_0x7595('0x8')](_0x7595('0xb'),auth[_0x7595('0xc')](),controller[_0x7595('0xd')]);router[_0x7595('0xe')]('/',auth['isAuthenticated'](),controller[_0x7595('0xf')]);router[_0x7595('0xe')](_0x7595('0xb'),auth[_0x7595('0xc')](),controller[_0x7595('0x10')]);router[_0x7595('0xe')](_0x7595('0x11'),auth['isAuthenticated'](),controller[_0x7595('0x12')]);router[_0x7595('0x13')]('/:id',auth[_0x7595('0xc')](),controller[_0x7595('0x14')]);router[_0x7595('0x15')]('/:id',auth[_0x7595('0xc')](),controller[_0x7595('0x16')]);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 7d9fb0e..c646d08 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 _0x2ba0=['sequelize','STRING'];(function(_0x471028,_0x3a5a2b){var _0x463547=function(_0x340dcc){while(--_0x340dcc){_0x471028['push'](_0x471028['shift']());}};_0x463547(++_0x3a5a2b);}(_0x2ba0,0xf2));var _0x02ba=function(_0x504bf2,_0x308bb7){_0x504bf2=_0x504bf2-0x0;var _0x55d5fe=_0x2ba0[_0x504bf2];return _0x55d5fe;};'use strict';var Sequelize=require(_0x02ba('0x0'));module['exports']={'name':{'type':Sequelize[_0x02ba('0x1')]},'description':{'type':Sequelize[_0x02ba('0x1')]},'interval':{'type':Sequelize[_0x02ba('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x272d=['STRING','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x272d,0x1ea));var _0xd272=function(_0x3c3e0b,_0x49468a){_0x3c3e0b=_0x3c3e0b-0x0;var _0x1b489d=_0x272d[_0x3c3e0b];return _0x1b489d;};'use strict';var Sequelize=require(_0xd272('0x0'));module[_0xd272('0x1')]={'name':{'type':Sequelize[_0xd272('0x2')]},'description':{'type':Sequelize[_0xd272('0x2')]},'interval':{'type':Sequelize[_0xd272('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 748dfb8..5e8a93a 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 _0xa4ea=['length','order','sequelize','transaction','bulkCreate','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','name','send','index','map','Interval','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','fields','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa4ea,0x11f));var _0xaa4e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa4ea[_0x934425];return _0x31d596;};'use strict';var emlformat=require(_0xaa4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaa4e('0x1'));var rp=require(_0xaa4e('0x2'));var moment=require(_0xaa4e('0x3'));var BPromise=require(_0xaa4e('0x4'));var Mustache=require(_0xaa4e('0x5'));var util=require(_0xaa4e('0x6'));var path=require(_0xaa4e('0x7'));var sox=require(_0xaa4e('0x8'));var csv=require(_0xaa4e('0x9'));var ejs=require(_0xaa4e('0xa'));var fs=require('fs');var fs_extra=require(_0xaa4e('0xb'));var _=require(_0xaa4e('0xc'));var squel=require('squel');var crypto=require(_0xaa4e('0xd'));var jsforce=require(_0xaa4e('0xe'));var deskjs=require(_0xaa4e('0xf'));var toCsv=require(_0xaa4e('0x9'));var querystring=require(_0xaa4e('0x10'));var Papa=require(_0xaa4e('0x11'));var Redis=require(_0xaa4e('0x12'));var authService=require(_0xaa4e('0x13'));var qs=require(_0xaa4e('0x14'));var as=require(_0xaa4e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa4e('0x16'))(_0xaa4e('0x17'));var utils=require(_0xaa4e('0x18'));var config=require(_0xaa4e('0x19'));var licenseUtil=require(_0xaa4e('0x1a'));var db=require(_0xaa4e('0x1b'))['db'];var extensions=require(_0xaa4e('0x1c'));function respondWithStatusCode(_0x10e610,_0x27a82f){_0x27a82f=_0x27a82f||0xcc;return function(_0x1adfa5){if(_0x1adfa5){return _0x10e610[_0xaa4e('0x1d')](_0x27a82f);}return _0x10e610[_0xaa4e('0x1e')](_0x27a82f)[_0xaa4e('0x1f')]();};}function respondWithResult(_0x1c8d08,_0x331d68){_0x331d68=_0x331d68||0xc8;return function(_0xab8ce5){if(_0xab8ce5){return _0x1c8d08[_0xaa4e('0x1e')](_0x331d68)[_0xaa4e('0x20')](_0xab8ce5);}};}function respondWithFilteredResult(_0x112f6d,_0x15a367){return function(_0x22cb1a){if(_0x22cb1a){var _0x5cdbcd=typeof _0x15a367[_0xaa4e('0x21')]==='undefined'&&typeof _0x15a367[_0xaa4e('0x22')]===_0xaa4e('0x23');var _0x23b489=_0x22cb1a[_0xaa4e('0x24')];var _0x30f709=_0x5cdbcd?0x0:_0x15a367[_0xaa4e('0x21')];var _0x55cc97=_0x5cdbcd?_0x22cb1a['count']:_0x15a367['offset']+_0x15a367[_0xaa4e('0x22')];var _0x3a4226;if(_0x55cc97>=_0x23b489){_0x55cc97=_0x23b489;_0x3a4226=0xc8;}else{_0x3a4226=0xce;}_0x112f6d[_0xaa4e('0x1e')](_0x3a4226);return _0x112f6d[_0xaa4e('0x25')](_0xaa4e('0x26'),_0x30f709+'-'+_0x55cc97+'/'+_0x23b489)['json'](_0x22cb1a);}return null;};}function patchUpdates(_0x51dc29){return function(_0x33895f){try{jsonpatch[_0xaa4e('0x27')](_0x33895f,_0x51dc29,!![]);}catch(_0x46f656){return BPromise[_0xaa4e('0x28')](_0x46f656);}return _0x33895f[_0xaa4e('0x29')]();};}function saveUpdates(_0xad4dd2,_0x57fd88){return function(_0x41de94){if(_0x41de94){return _0x41de94[_0xaa4e('0x2a')](_0xad4dd2)[_0xaa4e('0x2b')](function(_0x563d6b){return _0x563d6b;});}return null;};}function removeEntity(_0x1d9dec,_0x2d3950){return function(_0xc39d90){if(_0xc39d90){return _0xc39d90[_0xaa4e('0x2c')]()[_0xaa4e('0x2b')](function(){var _0xb94992=_0xc39d90[_0xaa4e('0x2d')]({'plain':!![]});var _0x1d6656=_0xaa4e('0x2e');return db[_0xaa4e('0x2f')][_0xaa4e('0x2c')]({'where':{'type':_0x1d6656,'resourceId':_0xb94992['id']}})['then'](function(){return _0xc39d90;});})[_0xaa4e('0x2b')](function(){_0x1d9dec[_0xaa4e('0x1e')](0xcc)[_0xaa4e('0x1f')]();});}};}function handleEntityNotFound(_0x33a3a8,_0x573d33){return function(_0xc38380){if(!_0xc38380){_0x33a3a8[_0xaa4e('0x1d')](0x194);}return _0xc38380;};}function handleError(_0x203233,_0x2e068d){_0x2e068d=_0x2e068d||0x1f4;return function(_0x137167){logger['error'](_0x137167['stack']);if(_0x137167[_0xaa4e('0x30')]){delete _0x137167[_0xaa4e('0x30')];}_0x203233['status'](_0x2e068d)[_0xaa4e('0x31')](_0x137167);};}exports[_0xaa4e('0x32')]=function(_0x57f971,_0x1cdcd1){var _0x7a1739={},_0x27f4d1={},_0x364e86={'count':0x0,'rows':[]};var _0x157c78=_[_0xaa4e('0x33')](db[_0xaa4e('0x34')][_0xaa4e('0x35')],function(_0x4b40e1){return{'name':_0x4b40e1['fieldName'],'type':_0x4b40e1[_0xaa4e('0x36')][_0xaa4e('0x37')]};});_0x27f4d1[_0xaa4e('0x38')]=_[_0xaa4e('0x33')](_0x157c78,_0xaa4e('0x30'));_0x27f4d1[_0xaa4e('0x39')]=_[_0xaa4e('0x3a')](_0x57f971[_0xaa4e('0x39')]);_0x27f4d1[_0xaa4e('0x3b')]=_[_0xaa4e('0x3c')](_0x27f4d1[_0xaa4e('0x38')],_0x27f4d1[_0xaa4e('0x39')]);_0x7a1739[_0xaa4e('0x3d')]=_[_0xaa4e('0x3c')](_0x27f4d1[_0xaa4e('0x38')],qs['fields'](_0x57f971[_0xaa4e('0x39')]['fields']));_0x7a1739[_0xaa4e('0x3d')]=_0x7a1739[_0xaa4e('0x3d')]['length']?_0x7a1739[_0xaa4e('0x3d')]:_0x27f4d1[_0xaa4e('0x38')];if(!_0x57f971[_0xaa4e('0x39')][_0xaa4e('0x3e')]('nolimit')){_0x7a1739[_0xaa4e('0x22')]=qs['limit'](_0x57f971[_0xaa4e('0x39')]['limit']);_0x7a1739['offset']=qs[_0xaa4e('0x21')](_0x57f971[_0xaa4e('0x39')]['offset']);}_0x7a1739['order']=qs[_0xaa4e('0x3f')](_0x57f971[_0xaa4e('0x39')]['sort']);_0x7a1739[_0xaa4e('0x40')]=qs[_0xaa4e('0x3b')](_[_0xaa4e('0x41')](_0x57f971['query'],_0x27f4d1[_0xaa4e('0x3b')]),_0x157c78);if(_0x57f971[_0xaa4e('0x39')][_0xaa4e('0x42')]){_0x7a1739[_0xaa4e('0x40')]=_[_0xaa4e('0x43')](_0x7a1739['where'],{'$or':_[_0xaa4e('0x33')](_0x157c78,function(_0x32598d){if(_0x32598d[_0xaa4e('0x36')]!=='VIRTUAL'){var _0x351c67={};_0x351c67[_0x32598d[_0xaa4e('0x30')]]={'$like':'%'+_0x57f971[_0xaa4e('0x39')][_0xaa4e('0x42')]+'%'};return _0x351c67;}})});}_0x7a1739=_[_0xaa4e('0x43')]({},_0x7a1739,_0x57f971[_0xaa4e('0x44')]);var _0x5042f0={'where':_0x7a1739['where']};return db['Interval'][_0xaa4e('0x24')](_0x5042f0)[_0xaa4e('0x2b')](function(_0x58915e){_0x364e86[_0xaa4e('0x24')]=_0x58915e;if(_0x57f971['query'][_0xaa4e('0x45')]){_0x7a1739[_0xaa4e('0x46')]=[{'all':!![]}];}return db[_0xaa4e('0x34')][_0xaa4e('0x47')](_0x7a1739);})[_0xaa4e('0x2b')](function(_0x31d44d){_0x364e86[_0xaa4e('0x48')]=_0x31d44d;return _0x364e86;})[_0xaa4e('0x2b')](respondWithFilteredResult(_0x1cdcd1,_0x7a1739))['catch'](handleError(_0x1cdcd1,null));};exports['show']=function(_0x439183,_0x23cb1c){var _0x424d2e={'raw':!![],'where':{'id':_0x439183[_0xaa4e('0x49')]['id']}},_0x1afa71={};_0x1afa71[_0xaa4e('0x38')]=_[_0xaa4e('0x3a')](db[_0xaa4e('0x34')]['rawAttributes']);_0x1afa71[_0xaa4e('0x39')]=_[_0xaa4e('0x3a')](_0x439183[_0xaa4e('0x39')]);_0x1afa71['filters']=_[_0xaa4e('0x3c')](_0x1afa71[_0xaa4e('0x38')],_0x1afa71[_0xaa4e('0x39')]);_0x424d2e['attributes']=_[_0xaa4e('0x3c')](_0x1afa71['model'],qs[_0xaa4e('0x4a')](_0x439183[_0xaa4e('0x39')][_0xaa4e('0x4a')]));_0x424d2e[_0xaa4e('0x3d')]=_0x424d2e[_0xaa4e('0x3d')]['length']?_0x424d2e[_0xaa4e('0x3d')]:_0x1afa71[_0xaa4e('0x38')];if(_0x439183[_0xaa4e('0x39')][_0xaa4e('0x45')]){_0x424d2e[_0xaa4e('0x46')]=[{'all':!![]}];}_0x424d2e=_['merge']({},_0x424d2e,_0x439183['options']);return db['Interval'][_0xaa4e('0x4b')](_0x424d2e)[_0xaa4e('0x2b')](handleEntityNotFound(_0x23cb1c,null))[_0xaa4e('0x2b')](respondWithResult(_0x23cb1c,null))[_0xaa4e('0x4c')](handleError(_0x23cb1c,null));};exports[_0xaa4e('0x4d')]=function(_0x361187,_0x1e3bb6){return db[_0xaa4e('0x34')][_0xaa4e('0x4d')](_0x361187[_0xaa4e('0x4e')],{})['then'](function(_0x342e00){var _0x5554a9=_0x361187[_0xaa4e('0x4f')][_0xaa4e('0x2d')]({'plain':!![]});if(!_0x5554a9)throw new Error(_0xaa4e('0x50'));if(_0x5554a9['role']===_0xaa4e('0x4f')){var _0x37b55c=_0x342e00['get']({'plain':!![]});var _0x4b9278=_0xaa4e('0x2e');return db['UserProfileSection'][_0xaa4e('0x4b')]({'where':{'name':_0x4b9278,'userProfileId':_0x5554a9[_0xaa4e('0x51')]},'raw':!![]})[_0xaa4e('0x2b')](function(_0x131cc7){if(_0x131cc7&&_0x131cc7[_0xaa4e('0x52')]===0x0){return db[_0xaa4e('0x2f')][_0xaa4e('0x4d')]({'name':_0x37b55c[_0xaa4e('0x30')],'resourceId':_0x37b55c['id'],'type':_0x131cc7[_0xaa4e('0x30')],'sectionId':_0x131cc7['id']},{})['then'](function(){return _0x342e00;});}else{return _0x342e00;}})[_0xaa4e('0x4c')](function(_0x53b203){logger[_0xaa4e('0x53')](_0xaa4e('0x54'),_0x53b203);throw _0x53b203;});}return _0x342e00;})[_0xaa4e('0x2b')](respondWithResult(_0x1e3bb6,0xc9))[_0xaa4e('0x4c')](handleError(_0x1e3bb6,null));};exports[_0xaa4e('0x2a')]=function(_0xb70c6e,_0xef42a0){if(_0xb70c6e[_0xaa4e('0x4e')]['id']){delete _0xb70c6e[_0xaa4e('0x4e')]['id'];}return db[_0xaa4e('0x34')][_0xaa4e('0x4b')]({'where':{'id':_0xb70c6e[_0xaa4e('0x49')]['id']}})['then'](handleEntityNotFound(_0xef42a0,null))[_0xaa4e('0x2b')](saveUpdates(_0xb70c6e[_0xaa4e('0x4e')],null))['then'](respondWithResult(_0xef42a0,null))['catch'](handleError(_0xef42a0,null));};exports[_0xaa4e('0x2c')]=function(_0x4b16d8,_0xb96b83){return db[_0xaa4e('0x34')][_0xaa4e('0x4b')]({'where':{'id':_0x4b16d8[_0xaa4e('0x49')]['id']}})[_0xaa4e('0x2b')](handleEntityNotFound(_0xb96b83,null))[_0xaa4e('0x2b')](removeEntity(_0xb96b83,null))[_0xaa4e('0x4c')](handleError(_0xb96b83,null));};exports[_0xaa4e('0x55')]=function(_0x26d970,_0x1f672a,_0x4e979b){if(_0x26d970[_0xaa4e('0x4e')]['id']){delete _0x26d970[_0xaa4e('0x4e')]['id'];}return db[_0xaa4e('0x34')][_0xaa4e('0x4b')]({'where':{'id':_0x26d970[_0xaa4e('0x49')]['id']}})[_0xaa4e('0x2b')](handleEntityNotFound(_0x1f672a,null))['then'](function(_0x11e37a){if(_0x11e37a){_0x26d970[_0xaa4e('0x4e')][_0xaa4e('0x56')]=_0x11e37a['id'];return db['Interval'][_0xaa4e('0x4d')](_0x26d970[_0xaa4e('0x4e')]);}})['then'](respondWithResult(_0x1f672a,null))[_0xaa4e('0x4c')](handleError(_0x1f672a,null));};exports[_0xaa4e('0x57')]=function(_0x255fd7,_0x4e5484,_0x261809){var _0x46ca06={};var _0x6732c1={};var _0x351867;var _0x3921e2;return db[_0xaa4e('0x34')][_0xaa4e('0x58')]({'where':{'id':_0x255fd7[_0xaa4e('0x49')]['id']}})[_0xaa4e('0x2b')](handleEntityNotFound(_0x4e5484,null))[_0xaa4e('0x2b')](function(_0x56c61c){if(_0x56c61c){_0x351867=_0x56c61c;_0x6732c1[_0xaa4e('0x38')]=_['keys'](db[_0xaa4e('0x34')][_0xaa4e('0x35')]);_0x6732c1[_0xaa4e('0x39')]=_[_0xaa4e('0x3a')](_0x255fd7[_0xaa4e('0x39')]);_0x6732c1[_0xaa4e('0x3b')]=_[_0xaa4e('0x3c')](_0x6732c1[_0xaa4e('0x38')],_0x6732c1[_0xaa4e('0x39')]);_0x46ca06[_0xaa4e('0x3d')]=_['intersection'](_0x6732c1[_0xaa4e('0x38')],qs[_0xaa4e('0x4a')](_0x255fd7[_0xaa4e('0x39')][_0xaa4e('0x4a')]));_0x46ca06[_0xaa4e('0x3d')]=_0x46ca06[_0xaa4e('0x3d')][_0xaa4e('0x59')]?_0x46ca06[_0xaa4e('0x3d')]:_0x6732c1['model'];_0x46ca06[_0xaa4e('0x5a')]=qs['sort'](_0x255fd7[_0xaa4e('0x39')]['sort']);_0x46ca06['where']=qs[_0xaa4e('0x3b')](_[_0xaa4e('0x41')](_0x255fd7[_0xaa4e('0x39')],_0x6732c1[_0xaa4e('0x3b')]));if(_0x255fd7['query'][_0xaa4e('0x42')]){_0x46ca06[_0xaa4e('0x40')]=_[_0xaa4e('0x43')](_0x46ca06[_0xaa4e('0x40')],{'$or':_[_0xaa4e('0x33')](_0x46ca06[_0xaa4e('0x3d')],function(_0x53ba30){var _0xe059da={};_0xe059da[_0x53ba30]={'$like':'%'+_0x255fd7[_0xaa4e('0x39')][_0xaa4e('0x42')]+'%'};return _0xe059da;})});}_0x46ca06=_[_0xaa4e('0x43')]({},_0x46ca06,_0x255fd7[_0xaa4e('0x44')]);return _0x351867[_0xaa4e('0x57')](_0x46ca06);}})['then'](function(_0x310ef7){if(_0x310ef7){_0x3921e2=_0x310ef7['length'];if(!_0x255fd7[_0xaa4e('0x39')][_0xaa4e('0x3e')]('nolimit')){_0x46ca06[_0xaa4e('0x22')]=qs[_0xaa4e('0x22')](_0x255fd7[_0xaa4e('0x39')][_0xaa4e('0x22')]);_0x46ca06['offset']=qs[_0xaa4e('0x21')](_0x255fd7[_0xaa4e('0x39')][_0xaa4e('0x21')]);}return _0x351867['getIntervals'](_0x46ca06);}})[_0xaa4e('0x2b')](function(_0x14be26){if(_0x14be26){return _0x14be26?{'count':_0x3921e2,'rows':_0x14be26}:null;}})[_0xaa4e('0x2b')](respondWithResult(_0x4e5484,null))[_0xaa4e('0x4c')](handleError(_0x4e5484,null));};exports['addIntervals']=function(_0x3464f9,_0x6014fe,_0x5c0fd2){return db[_0xaa4e('0x34')][_0xaa4e('0x58')]({'where':{'id':_0x3464f9[_0xaa4e('0x49')]['id']}})['then'](handleEntityNotFound(_0x6014fe,null))[_0xaa4e('0x2b')](function(_0x26ca66){if(_0x26ca66){return db[_0xaa4e('0x5b')][_0xaa4e('0x5c')](function(_0x3a805b){return db['Interval']['destroy']({'where':{'IntervalId':_0x3464f9[_0xaa4e('0x49')]['id']},'transaction':_0x3a805b})[_0xaa4e('0x2b')](function(_0x392efb){var _0x1819fd=_[_0xaa4e('0x33')](_0x3464f9['body'],function(_0x40036a){delete _0x40036a['id'];_0x40036a[_0xaa4e('0x56')]=_0x3464f9[_0xaa4e('0x49')]['id'];return _0x40036a;});return db['Interval'][_0xaa4e('0x5d')](_0x1819fd,{'transaction':_0x3a805b});});})[_0xaa4e('0x2b')](function(){return db[_0xaa4e('0x34')][_0xaa4e('0x47')]({'where':{'IntervalId':_0x3464f9[_0xaa4e('0x49')]['id']}});});}})['then'](respondWithResult(_0x6014fe,null))[_0xaa4e('0x4c')](handleError(_0x6014fe,null));}; \ No newline at end of file +var _0x03f2=['index','map','Interval','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','fields','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','IntervalId','order','getIntervals','addIntervals','findOne','sequelize','transaction','bulkCreate','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','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','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','error','name','send'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x03f2,0xec));var _0x203f=function(_0x334012,_0x608e71){_0x334012=_0x334012-0x0;var _0x4fedcf=_0x03f2[_0x334012];return _0x4fedcf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x203f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x203f('0x1'));var moment=require('moment');var BPromise=require(_0x203f('0x2'));var Mustache=require(_0x203f('0x3'));var util=require(_0x203f('0x4'));var path=require('path');var sox=require(_0x203f('0x5'));var csv=require(_0x203f('0x6'));var ejs=require(_0x203f('0x7'));var fs=require('fs');var fs_extra=require(_0x203f('0x8'));var _=require(_0x203f('0x9'));var squel=require(_0x203f('0xa'));var crypto=require(_0x203f('0xb'));var jsforce=require(_0x203f('0xc'));var deskjs=require(_0x203f('0xd'));var toCsv=require(_0x203f('0x6'));var querystring=require(_0x203f('0xe'));var Papa=require('papaparse');var Redis=require(_0x203f('0xf'));var authService=require(_0x203f('0x10'));var qs=require(_0x203f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x203f('0x12'));var logger=require(_0x203f('0x13'))(_0x203f('0x14'));var utils=require('../../config/utils');var config=require(_0x203f('0x15'));var licenseUtil=require(_0x203f('0x16'));var db=require(_0x203f('0x17'))['db'];var extensions=require(_0x203f('0x18'));function respondWithStatusCode(_0x3ab0e7,_0x5efbc9){_0x5efbc9=_0x5efbc9||0xcc;return function(_0x4fa1ea){if(_0x4fa1ea){return _0x3ab0e7[_0x203f('0x19')](_0x5efbc9);}return _0x3ab0e7[_0x203f('0x1a')](_0x5efbc9)[_0x203f('0x1b')]();};}function respondWithResult(_0x39a060,_0x46b483){_0x46b483=_0x46b483||0xc8;return function(_0x35b28f){if(_0x35b28f){return _0x39a060['status'](_0x46b483)[_0x203f('0x1c')](_0x35b28f);}};}function respondWithFilteredResult(_0x5effb2,_0x3bcaad){return function(_0x4b16ac){if(_0x4b16ac){var _0x3cafac=typeof _0x3bcaad[_0x203f('0x1d')]==='undefined'&&typeof _0x3bcaad[_0x203f('0x1e')]===_0x203f('0x1f');var _0x35c026=_0x4b16ac[_0x203f('0x20')];var _0x4b1394=_0x3cafac?0x0:_0x3bcaad[_0x203f('0x1d')];var _0x2be061=_0x3cafac?_0x4b16ac[_0x203f('0x20')]:_0x3bcaad[_0x203f('0x1d')]+_0x3bcaad[_0x203f('0x1e')];var _0x4f81b0;if(_0x2be061>=_0x35c026){_0x2be061=_0x35c026;_0x4f81b0=0xc8;}else{_0x4f81b0=0xce;}_0x5effb2[_0x203f('0x1a')](_0x4f81b0);return _0x5effb2[_0x203f('0x21')]('Content-Range',_0x4b1394+'-'+_0x2be061+'/'+_0x35c026)[_0x203f('0x1c')](_0x4b16ac);}return null;};}function patchUpdates(_0x4aaf09){return function(_0x5cdc04){try{jsonpatch[_0x203f('0x22')](_0x5cdc04,_0x4aaf09,!![]);}catch(_0x368194){return BPromise[_0x203f('0x23')](_0x368194);}return _0x5cdc04[_0x203f('0x24')]();};}function saveUpdates(_0x2bb678,_0x51f0dc){return function(_0xe01a36){if(_0xe01a36){return _0xe01a36[_0x203f('0x25')](_0x2bb678)[_0x203f('0x26')](function(_0xbb301a){return _0xbb301a;});}return null;};}function removeEntity(_0x68c4d2,_0x517b9d){return function(_0x21b0fb){if(_0x21b0fb){return _0x21b0fb[_0x203f('0x27')]()[_0x203f('0x26')](function(){var _0x230739=_0x21b0fb[_0x203f('0x28')]({'plain':!![]});var _0x12d506=_0x203f('0x29');return db[_0x203f('0x2a')][_0x203f('0x27')]({'where':{'type':_0x12d506,'resourceId':_0x230739['id']}})['then'](function(){return _0x21b0fb;});})[_0x203f('0x26')](function(){_0x68c4d2[_0x203f('0x1a')](0xcc)[_0x203f('0x1b')]();});}};}function handleEntityNotFound(_0x3bb10,_0x28299e){return function(_0xf44175){if(!_0xf44175){_0x3bb10[_0x203f('0x19')](0x194);}return _0xf44175;};}function handleError(_0x2513fb,_0x26512e){_0x26512e=_0x26512e||0x1f4;return function(_0x538bf9){logger[_0x203f('0x2b')](_0x538bf9['stack']);if(_0x538bf9[_0x203f('0x2c')]){delete _0x538bf9[_0x203f('0x2c')];}_0x2513fb[_0x203f('0x1a')](_0x26512e)[_0x203f('0x2d')](_0x538bf9);};}exports[_0x203f('0x2e')]=function(_0x25432d,_0x4ce4d8){var _0x5e812e={},_0x1e04ad={},_0x7839ac={'count':0x0,'rows':[]};var _0x2661ea=_[_0x203f('0x2f')](db[_0x203f('0x30')][_0x203f('0x31')],function(_0x2476d7){return{'name':_0x2476d7[_0x203f('0x32')],'type':_0x2476d7[_0x203f('0x33')][_0x203f('0x34')]};});_0x1e04ad['model']=_[_0x203f('0x2f')](_0x2661ea,'name');_0x1e04ad['query']=_['keys'](_0x25432d[_0x203f('0x35')]);_0x1e04ad[_0x203f('0x36')]=_[_0x203f('0x37')](_0x1e04ad[_0x203f('0x38')],_0x1e04ad[_0x203f('0x35')]);_0x5e812e['attributes']=_[_0x203f('0x37')](_0x1e04ad['model'],qs['fields'](_0x25432d[_0x203f('0x35')]['fields']));_0x5e812e[_0x203f('0x39')]=_0x5e812e[_0x203f('0x39')][_0x203f('0x3a')]?_0x5e812e[_0x203f('0x39')]:_0x1e04ad[_0x203f('0x38')];if(!_0x25432d['query'][_0x203f('0x3b')](_0x203f('0x3c'))){_0x5e812e['limit']=qs[_0x203f('0x1e')](_0x25432d[_0x203f('0x35')][_0x203f('0x1e')]);_0x5e812e[_0x203f('0x1d')]=qs[_0x203f('0x1d')](_0x25432d[_0x203f('0x35')]['offset']);}_0x5e812e['order']=qs[_0x203f('0x3d')](_0x25432d[_0x203f('0x35')][_0x203f('0x3d')]);_0x5e812e[_0x203f('0x3e')]=qs[_0x203f('0x36')](_[_0x203f('0x3f')](_0x25432d['query'],_0x1e04ad['filters']),_0x2661ea);if(_0x25432d[_0x203f('0x35')][_0x203f('0x40')]){_0x5e812e[_0x203f('0x3e')]=_[_0x203f('0x41')](_0x5e812e[_0x203f('0x3e')],{'$or':_[_0x203f('0x2f')](_0x2661ea,function(_0x34f96c){if(_0x34f96c[_0x203f('0x33')]!==_0x203f('0x42')){var _0x548d94={};_0x548d94[_0x34f96c['name']]={'$like':'%'+_0x25432d[_0x203f('0x35')][_0x203f('0x40')]+'%'};return _0x548d94;}})});}_0x5e812e=_[_0x203f('0x41')]({},_0x5e812e,_0x25432d[_0x203f('0x43')]);var _0x4b7c7b={'where':_0x5e812e[_0x203f('0x3e')]};return db[_0x203f('0x30')]['count'](_0x4b7c7b)[_0x203f('0x26')](function(_0x30ef81){_0x7839ac[_0x203f('0x20')]=_0x30ef81;if(_0x25432d[_0x203f('0x35')][_0x203f('0x44')]){_0x5e812e[_0x203f('0x45')]=[{'all':!![]}];}return db[_0x203f('0x30')][_0x203f('0x46')](_0x5e812e);})[_0x203f('0x26')](function(_0x42bd6d){_0x7839ac[_0x203f('0x47')]=_0x42bd6d;return _0x7839ac;})[_0x203f('0x26')](respondWithFilteredResult(_0x4ce4d8,_0x5e812e))['catch'](handleError(_0x4ce4d8,null));};exports['show']=function(_0x227e06,_0x5ac5bc){var _0x5813fa={'raw':!![],'where':{'id':_0x227e06[_0x203f('0x48')]['id']}},_0x3f52ad={};_0x3f52ad[_0x203f('0x38')]=_['keys'](db[_0x203f('0x30')]['rawAttributes']);_0x3f52ad[_0x203f('0x35')]=_[_0x203f('0x49')](_0x227e06[_0x203f('0x35')]);_0x3f52ad[_0x203f('0x36')]=_[_0x203f('0x37')](_0x3f52ad[_0x203f('0x38')],_0x3f52ad[_0x203f('0x35')]);_0x5813fa['attributes']=_['intersection'](_0x3f52ad['model'],qs[_0x203f('0x4a')](_0x227e06[_0x203f('0x35')]['fields']));_0x5813fa[_0x203f('0x39')]=_0x5813fa['attributes'][_0x203f('0x3a')]?_0x5813fa[_0x203f('0x39')]:_0x3f52ad[_0x203f('0x38')];if(_0x227e06[_0x203f('0x35')][_0x203f('0x44')]){_0x5813fa['include']=[{'all':!![]}];}_0x5813fa=_[_0x203f('0x41')]({},_0x5813fa,_0x227e06['options']);return db[_0x203f('0x30')]['find'](_0x5813fa)[_0x203f('0x26')](handleEntityNotFound(_0x5ac5bc,null))[_0x203f('0x26')](respondWithResult(_0x5ac5bc,null))[_0x203f('0x4b')](handleError(_0x5ac5bc,null));};exports['create']=function(_0x356674,_0x206fef){return db[_0x203f('0x30')][_0x203f('0x4c')](_0x356674[_0x203f('0x4d')],{})[_0x203f('0x26')](function(_0x2d55c0){var _0x7b1fa9=_0x356674[_0x203f('0x4e')]['get']({'plain':!![]});if(!_0x7b1fa9)throw new Error(_0x203f('0x4f'));if(_0x7b1fa9[_0x203f('0x50')]==='user'){var _0x3fbfe0=_0x2d55c0[_0x203f('0x28')]({'plain':!![]});var _0x130a37=_0x203f('0x29');return db[_0x203f('0x51')][_0x203f('0x52')]({'where':{'name':_0x130a37,'userProfileId':_0x7b1fa9[_0x203f('0x53')]},'raw':!![]})[_0x203f('0x26')](function(_0x7abc6f){if(_0x7abc6f&&_0x7abc6f[_0x203f('0x54')]===0x0){return db[_0x203f('0x2a')]['create']({'name':_0x3fbfe0[_0x203f('0x2c')],'resourceId':_0x3fbfe0['id'],'type':_0x7abc6f[_0x203f('0x2c')],'sectionId':_0x7abc6f['id']},{})[_0x203f('0x26')](function(){return _0x2d55c0;});}else{return _0x2d55c0;}})[_0x203f('0x4b')](function(_0x2c4da4){logger[_0x203f('0x2b')](_0x203f('0x55'),_0x2c4da4);throw _0x2c4da4;});}return _0x2d55c0;})['then'](respondWithResult(_0x206fef,0xc9))[_0x203f('0x4b')](handleError(_0x206fef,null));};exports['update']=function(_0x106298,_0x34ca9b){if(_0x106298[_0x203f('0x4d')]['id']){delete _0x106298['body']['id'];}return db[_0x203f('0x30')][_0x203f('0x52')]({'where':{'id':_0x106298[_0x203f('0x48')]['id']}})[_0x203f('0x26')](handleEntityNotFound(_0x34ca9b,null))[_0x203f('0x26')](saveUpdates(_0x106298[_0x203f('0x4d')],null))['then'](respondWithResult(_0x34ca9b,null))[_0x203f('0x4b')](handleError(_0x34ca9b,null));};exports['destroy']=function(_0x19cc68,_0x414777){return db['Interval'][_0x203f('0x52')]({'where':{'id':_0x19cc68[_0x203f('0x48')]['id']}})[_0x203f('0x26')](handleEntityNotFound(_0x414777,null))[_0x203f('0x26')](removeEntity(_0x414777,null))[_0x203f('0x4b')](handleError(_0x414777,null));};exports['addInterval']=function(_0x3ca838,_0x5ef86e,_0x36af35){if(_0x3ca838[_0x203f('0x4d')]['id']){delete _0x3ca838[_0x203f('0x4d')]['id'];}return db[_0x203f('0x30')]['find']({'where':{'id':_0x3ca838[_0x203f('0x48')]['id']}})['then'](handleEntityNotFound(_0x5ef86e,null))['then'](function(_0x38027e){if(_0x38027e){_0x3ca838[_0x203f('0x4d')][_0x203f('0x56')]=_0x38027e['id'];return db[_0x203f('0x30')][_0x203f('0x4c')](_0x3ca838['body']);}})[_0x203f('0x26')](respondWithResult(_0x5ef86e,null))[_0x203f('0x4b')](handleError(_0x5ef86e,null));};exports['getIntervals']=function(_0x117bd6,_0x472557,_0x386ca5){var _0x1b1f40={};var _0x23a42e={};var _0x2c56ff;var _0x213cb6;return db[_0x203f('0x30')]['findOne']({'where':{'id':_0x117bd6[_0x203f('0x48')]['id']}})[_0x203f('0x26')](handleEntityNotFound(_0x472557,null))['then'](function(_0x47c64e){if(_0x47c64e){_0x2c56ff=_0x47c64e;_0x23a42e['model']=_['keys'](db[_0x203f('0x30')]['rawAttributes']);_0x23a42e[_0x203f('0x35')]=_[_0x203f('0x49')](_0x117bd6[_0x203f('0x35')]);_0x23a42e[_0x203f('0x36')]=_[_0x203f('0x37')](_0x23a42e[_0x203f('0x38')],_0x23a42e['query']);_0x1b1f40[_0x203f('0x39')]=_[_0x203f('0x37')](_0x23a42e[_0x203f('0x38')],qs['fields'](_0x117bd6[_0x203f('0x35')]['fields']));_0x1b1f40[_0x203f('0x39')]=_0x1b1f40[_0x203f('0x39')][_0x203f('0x3a')]?_0x1b1f40[_0x203f('0x39')]:_0x23a42e[_0x203f('0x38')];_0x1b1f40[_0x203f('0x57')]=qs[_0x203f('0x3d')](_0x117bd6[_0x203f('0x35')][_0x203f('0x3d')]);_0x1b1f40['where']=qs[_0x203f('0x36')](_[_0x203f('0x3f')](_0x117bd6[_0x203f('0x35')],_0x23a42e['filters']));if(_0x117bd6[_0x203f('0x35')][_0x203f('0x40')]){_0x1b1f40[_0x203f('0x3e')]=_[_0x203f('0x41')](_0x1b1f40[_0x203f('0x3e')],{'$or':_[_0x203f('0x2f')](_0x1b1f40[_0x203f('0x39')],function(_0x86b7da){var _0x256bf4={};_0x256bf4[_0x86b7da]={'$like':'%'+_0x117bd6['query'][_0x203f('0x40')]+'%'};return _0x256bf4;})});}_0x1b1f40=_[_0x203f('0x41')]({},_0x1b1f40,_0x117bd6[_0x203f('0x43')]);return _0x2c56ff[_0x203f('0x58')](_0x1b1f40);}})['then'](function(_0x546686){if(_0x546686){_0x213cb6=_0x546686['length'];if(!_0x117bd6['query']['hasOwnProperty'](_0x203f('0x3c'))){_0x1b1f40[_0x203f('0x1e')]=qs[_0x203f('0x1e')](_0x117bd6[_0x203f('0x35')][_0x203f('0x1e')]);_0x1b1f40[_0x203f('0x1d')]=qs['offset'](_0x117bd6[_0x203f('0x35')][_0x203f('0x1d')]);}return _0x2c56ff[_0x203f('0x58')](_0x1b1f40);}})[_0x203f('0x26')](function(_0x2dea99){if(_0x2dea99){return _0x2dea99?{'count':_0x213cb6,'rows':_0x2dea99}:null;}})[_0x203f('0x26')](respondWithResult(_0x472557,null))[_0x203f('0x4b')](handleError(_0x472557,null));};exports[_0x203f('0x59')]=function(_0x3b7927,_0x23e3fe,_0x4de57d){return db[_0x203f('0x30')][_0x203f('0x5a')]({'where':{'id':_0x3b7927[_0x203f('0x48')]['id']}})['then'](handleEntityNotFound(_0x23e3fe,null))[_0x203f('0x26')](function(_0x3730d2){if(_0x3730d2){return db[_0x203f('0x5b')][_0x203f('0x5c')](function(_0x492fc4){return db['Interval'][_0x203f('0x27')]({'where':{'IntervalId':_0x3b7927[_0x203f('0x48')]['id']},'transaction':_0x492fc4})[_0x203f('0x26')](function(_0x3223a9){var _0x516a95=_[_0x203f('0x2f')](_0x3b7927[_0x203f('0x4d')],function(_0x1842a7){delete _0x1842a7['id'];_0x1842a7[_0x203f('0x56')]=_0x3b7927[_0x203f('0x48')]['id'];return _0x1842a7;});return db['Interval'][_0x203f('0x5d')](_0x516a95,{'transaction':_0x492fc4});});})[_0x203f('0x26')](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x3b7927[_0x203f('0x48')]['id']}});});}})[_0x203f('0x26')](respondWithResult(_0x23e3fe,null))[_0x203f('0x4b')](handleError(_0x23e3fe,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 4c24228..fc0595e 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 _0x64a5=['request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','rewrite','lodash','util','../../config/logger','api','moment'];(function(_0x519255,_0x14996c){var _0x143255=function(_0x503914){while(--_0x503914){_0x519255['push'](_0x519255['shift']());}};_0x143255(++_0x14996c);}(_0x64a5,0xb1));var _0x564a=function(_0x260e4b,_0x54668d){_0x260e4b=_0x260e4b-0x0;var _0x18dfba=_0x64a5[_0x260e4b];return _0x18dfba;};'use strict';var _=require(_0x564a('0x0'));var util=require(_0x564a('0x1'));var logger=require(_0x564a('0x2'))(_0x564a('0x3'));var moment=require(_0x564a('0x4'));var BPromise=require('bluebird');var rp=require(_0x564a('0x5'));var fs=require('fs');var path=require(_0x564a('0x6'));var rimraf=require(_0x564a('0x7'));var config=require(_0x564a('0x8'));var attributes=require(_0x564a('0x9'));var extensions=require(_0x564a('0xa'));module[_0x564a('0xb')]=function(_0x1e5241,_0x112cc2){return _0x1e5241[_0x564a('0xc')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3dc8bc,_0x5c4a98){extensions[_0x564a('0xd')](_0x1e5241,_0x3dc8bc);},'afterBulkCreate':function(_0x30bfbe,_0x1fa5b5,_0x23d771){_0x23d771();extensions[_0x564a('0xd')](_0x1e5241,_0x30bfbe[0x0]);},'afterUpdate':function(_0x303ca5,_0x421f99){extensions[_0x564a('0xd')](_0x1e5241,_0x303ca5);},'afterDestroy':function(_0x374709,_0x3b8f63){extensions[_0x564a('0xd')](_0x1e5241,_0x374709);}}});}; \ No newline at end of file +var _0xf6ef=['./interval.attributes','../../components/extensions/rewrite','exports','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2b043f,_0x171648){var _0x1dcc63=function(_0x4f41c9){while(--_0x4f41c9){_0x2b043f['push'](_0x2b043f['shift']());}};_0x1dcc63(++_0x171648);}(_0xf6ef,0x18c));var _0xff6e=function(_0x4bea50,_0x18ea16){_0x4bea50=_0x4bea50-0x0;var _0x500311=_0xf6ef[_0x4bea50];return _0x500311;};'use strict';var _=require(_0xff6e('0x0'));var util=require(_0xff6e('0x1'));var logger=require(_0xff6e('0x2'))(_0xff6e('0x3'));var moment=require(_0xff6e('0x4'));var BPromise=require(_0xff6e('0x5'));var rp=require(_0xff6e('0x6'));var fs=require('fs');var path=require(_0xff6e('0x7'));var rimraf=require('rimraf');var config=require(_0xff6e('0x8'));var attributes=require(_0xff6e('0x9'));var extensions=require(_0xff6e('0xa'));module[_0xff6e('0xb')]=function(_0x2d4c64,_0xac38a){return _0x2d4c64['define'](_0xff6e('0xc'),attributes,{'tableName':_0xff6e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x49eb4a,_0x143224){extensions['rewrite'](_0x2d4c64,_0x49eb4a);},'afterBulkCreate':function(_0x2bf55d,_0x143599,_0x2a888a){_0x2a888a();extensions[_0xff6e('0xe')](_0x2d4c64,_0x2bf55d[0x0]);},'afterUpdate':function(_0x554345,_0x4b7c59){extensions['rewrite'](_0x2d4c64,_0x554345);},'afterDestroy':function(_0x59165b,_0x35d653){extensions[_0xff6e('0xe')](_0x2d4c64,_0x59165b);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index aa9f726..a7cacd5 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(_0x2f4c1c,_0x5a3dd4){var _0x25e0f2=function(_0x46ea31){while(--_0x46ea31){_0x2f4c1c['push'](_0x2f4c1c['shift']());}};_0x25e0f2(++_0x5a3dd4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x179c4a,_0x10eb06){var _0x5d1879=function(_0x1f1dcd){while(--_0x1f1dcd){_0x179c4a['push'](_0x179c4a['shift']());}};_0x5d1879(++_0x10eb06);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 a87f0ea..6f249c9 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 _0xb10b=['./jira.controller','post','send','exports','express','../../components/auth/service'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xb10b,0x12a));var _0xbb10=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0xb10b[_0x5eaa0b];return _0x28b295;};'use strict';var express=require(_0xbb10('0x0'));var router=express['Router']();var auth=require(_0xbb10('0x1'));var controller=require(_0xbb10('0x2'));router[_0xbb10('0x3')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x4')]);module[_0xbb10('0x5')]=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x511033,_0x395158){var _0x5289da=function(_0xf1de64){while(--_0xf1de64){_0x511033['push'](_0x511033['shift']());}};_0x5289da(++_0x395158);}(_0x2ef3,0xba));var _0x32ef=function(_0x1c1d63,_0x16d83d){_0x1c1d63=_0x1c1d63-0x0;var _0x2aff16=_0x2ef3[_0x1c1d63];return _0x2aff16;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 1042981..bc46c4e 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 _0x311d=['customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','toString','base64','stringify','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','headers','x-forwarded-for','connection','remoteAddress','socket','https','../../config/logger','support','3eAmWpBVP0','key','Report','\x20from\x20','description','issuetype','fields','customfield_11500','email','newToken'];(function(_0x25e23a,_0x45a34f){var _0x4ca8d7=function(_0x2cbdc7){while(--_0x2cbdc7){_0x25e23a['push'](_0x25e23a['shift']());}};_0x4ca8d7(++_0x45a34f);}(_0x311d,0x6b));var _0xd311=function(_0x2e1677,_0x42dd4c){_0x2e1677=_0x2e1677-0x0;var _0x42bb53=_0x311d[_0x2e1677];return _0x42bb53;};'use strict';var BPromise=require('bluebird');var https=require(_0xd311('0x0'));var logger=require(_0xd311('0x1'))('api');var USERNAME=_0xd311('0x2');var PASSWORD=_0xd311('0x3');function openIssue(_0x3fd239,_0x66c32b){var _0x2c721a={'fields':{'project':{'key':_0x3fd239[_0xd311('0x4')]||'MOTGUI'},'summary':(_0x3fd239['summary']||_0xd311('0x5'))+_0xd311('0x6')+_0x3fd239['ip'],'description':_0x3fd239[_0xd311('0x7')]||JSON['stringify'](_0x3fd239),'issuetype':{'name':_0x3fd239[_0xd311('0x8')]||'Bug'}}};_0x2c721a[_0xd311('0x9')][_0xd311('0xa')]=_0x3fd239[_0xd311('0xb')];_0x2c721a[_0xd311('0x9')]['customfield_11501']=_0x3fd239['oldToken'];_0x2c721a[_0xd311('0x9')]['customfield_11502']=_0x3fd239[_0xd311('0xc')];_0x2c721a['fields'][_0xd311('0xd')]=_0x3fd239['name'];_0x2c721a[_0xd311('0x9')][_0xd311('0xe')]=_0x3fd239[_0xd311('0xf')];_0x2c721a[_0xd311('0x9')][_0xd311('0x10')]=_0x3fd239['ip'];var _0x2658d0={'host':_0xd311('0x11'),'port':0x1bb,'path':_0xd311('0x12'),'method':_0xd311('0x13'),'timeout':0x4e20,'headers':{'Content-Type':_0xd311('0x14'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xd311('0x15')](_0xd311('0x16'))}};var _0x2877a7=JSON[_0xd311('0x17')](_0x2c721a);var _0x8743b6=https[_0xd311('0x18')](_0x2658d0,function(_0x2830ab){_0x2830ab[_0xd311('0x19')](_0xd311('0x1a'));var _0x15e797='';_0x2830ab['on'](_0xd311('0x1b'),function(_0x3072a){_0x15e797+=_0x3072a;});_0x2830ab['on'](_0xd311('0x1c'),function(){if(_0x66c32b){return _0x66c32b[_0xd311('0x1d')](_0x2830ab['statusCode'])[_0xd311('0x1e')](JSON[_0xd311('0x1f')](_0x15e797));}});});_0x8743b6['on'](_0xd311('0x20'),function(_0x3a5885){if(_0x66c32b){return _0x66c32b[_0xd311('0x1d')](0x1f4)[_0xd311('0x1e')]({'errors':[{'message':_0xd311('0x21'),'type':_0xd311('0x22')}]});}});_0x8743b6['write'](_0x2877a7);_0x8743b6[_0xd311('0x1c')]();}exports['openIssue']=openIssue;exports['send']=function(_0x21a3b9,_0x150f49){_0x21a3b9['body']['ip']=_0x21a3b9[_0xd311('0x23')][_0xd311('0x24')]||_0x21a3b9[_0xd311('0x25')][_0xd311('0x26')]||_0x21a3b9[_0xd311('0x27')][_0xd311('0x26')]||_0x21a3b9[_0xd311('0x25')][_0xd311('0x27')][_0xd311('0x26')];return openIssue(_0x21a3b9['body'],_0x150f49);}; \ No newline at end of file +var _0x533a=['fields','customfield_11501','oldToken','newToken','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','toString','base64','request','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','customfield_11500','email'];(function(_0x4e3499,_0x5d6d88){var _0x5ec1ba=function(_0x1dc611){while(--_0x1dc611){_0x4e3499['push'](_0x4e3499['shift']());}};_0x5ec1ba(++_0x5d6d88);}(_0x533a,0x133));var _0xa533=function(_0x33b9ac,_0x1cd671){_0x33b9ac=_0x33b9ac-0x0;var _0x4da2a0=_0x533a[_0x33b9ac];return _0x4da2a0;};'use strict';var BPromise=require(_0xa533('0x0'));var https=require(_0xa533('0x1'));var logger=require(_0xa533('0x2'))('api');var USERNAME=_0xa533('0x3');var PASSWORD=_0xa533('0x4');function openIssue(_0xbf5504,_0x41dff5){var _0x101469={'fields':{'project':{'key':_0xbf5504[_0xa533('0x5')]||'MOTGUI'},'summary':(_0xbf5504[_0xa533('0x6')]||_0xa533('0x7'))+_0xa533('0x8')+_0xbf5504['ip'],'description':_0xbf5504[_0xa533('0x9')]||JSON[_0xa533('0xa')](_0xbf5504),'issuetype':{'name':_0xbf5504[_0xa533('0xb')]||_0xa533('0xc')}}};_0x101469['fields'][_0xa533('0xd')]=_0xbf5504[_0xa533('0xe')];_0x101469[_0xa533('0xf')][_0xa533('0x10')]=_0xbf5504[_0xa533('0x11')];_0x101469[_0xa533('0xf')]['customfield_11502']=_0xbf5504[_0xa533('0x12')];_0x101469[_0xa533('0xf')][_0xa533('0x13')]=_0xbf5504[_0xa533('0x14')];_0x101469[_0xa533('0xf')]['customfield_11504']=_0xbf5504[_0xa533('0x15')];_0x101469[_0xa533('0xf')][_0xa533('0x16')]=_0xbf5504['ip'];var _0x488071={'host':_0xa533('0x17'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xa533('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0xa533('0x19'),'Authorization':_0xa533('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0xa533('0x1b')](_0xa533('0x1c'))}};var _0x6cbca9=JSON['stringify'](_0x101469);var _0x1b3342=https[_0xa533('0x1d')](_0x488071,function(_0x302734){_0x302734['setEncoding']('utf8');var _0x21b9fa='';_0x302734['on'](_0xa533('0x1e'),function(_0x26681a){_0x21b9fa+=_0x26681a;});_0x302734['on'](_0xa533('0x1f'),function(){if(_0x41dff5){return _0x41dff5[_0xa533('0x20')](_0x302734[_0xa533('0x21')])[_0xa533('0x22')](JSON[_0xa533('0x23')](_0x21b9fa));}});});_0x1b3342['on'](_0xa533('0x24'),function(_0x23eb4b){if(_0x41dff5){return _0x41dff5[_0xa533('0x20')](0x1f4)[_0xa533('0x22')]({'errors':[{'message':_0xa533('0x25'),'type':_0xa533('0x26')}]});}});_0x1b3342['write'](_0x6cbca9);_0x1b3342['end']();}exports[_0xa533('0x27')]=openIssue;exports['send']=function(_0x5a6d4e,_0x1c7335){_0x5a6d4e[_0xa533('0x28')]['ip']=_0x5a6d4e[_0xa533('0x29')][_0xa533('0x2a')]||_0x5a6d4e[_0xa533('0x2b')][_0xa533('0x2c')]||_0x5a6d4e[_0xa533('0x2d')]['remoteAddress']||_0x5a6d4e[_0xa533('0x2b')]['socket'][_0xa533('0x2c')];return openIssue(_0x5a6d4e[_0xa533('0x28')],_0x1c7335);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 3d71061..baecb28 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 _0x153f=['Router','fs-extra','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x46d65f,_0x404366){var _0x42dd8e=function(_0x2524e3){while(--_0x2524e3){_0x46d65f['push'](_0x46d65f['shift']());}};_0x42dd8e(++_0x404366);}(_0x153f,0x15b));var _0xf153=function(_0x5a9977,_0x2fac8e){_0x5a9977=_0x5a9977-0x0;var _0xf28f08=_0x153f[_0x5a9977];return _0xf28f08;};'use strict';var multer=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var path=require(_0xf153('0x2'));var timeout=require(_0xf153('0x3'));var express=require(_0xf153('0x4'));var router=express[_0xf153('0x5')]();var fs_extra=require(_0xf153('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf153('0x7'));var config=require('../../config/environment');var controller=require(_0xf153('0x8'));router[_0xf153('0x9')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0xb')]);router[_0xf153('0x9')]('/describe',auth[_0xf153('0xa')](),controller[_0xf153('0xc')]);router[_0xf153('0x9')](_0xf153('0xd'),auth[_0xf153('0xa')](),controller[_0xf153('0xe')]);router[_0xf153('0xf')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0x10')]);router[_0xf153('0x11')]('/:id',auth[_0xf153('0xa')](),controller[_0xf153('0x12')]);router[_0xf153('0x13')]('/:id',auth[_0xf153('0xa')](),controller[_0xf153('0x14')]);module[_0xf153('0x15')]=router; \ No newline at end of file +var _0x4522=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','path','connect-timeout','express','fs-extra'];(function(_0x58d0c,_0x57a115){var _0x568512=function(_0x110f1e){while(--_0x110f1e){_0x58d0c['push'](_0x58d0c['shift']());}};_0x568512(++_0x57a115);}(_0x4522,0x1a0));var _0x2452=function(_0xa392eb,_0x5afbf8){_0xa392eb=_0xa392eb-0x0;var _0x3158db=_0x4522[_0xa392eb];return _0x3158db;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2452('0x0'));var timeout=require(_0x2452('0x1'));var express=require(_0x2452('0x2'));var router=express['Router']();var fs_extra=require(_0x2452('0x3'));var auth=require(_0x2452('0x4'));var interaction=require(_0x2452('0x5'));var config=require(_0x2452('0x6'));var controller=require(_0x2452('0x7'));router[_0x2452('0x8')]('/',auth[_0x2452('0x9')](),controller[_0x2452('0xa')]);router[_0x2452('0x8')](_0x2452('0xb'),auth[_0x2452('0x9')](),controller[_0x2452('0xc')]);router[_0x2452('0x8')](_0x2452('0xd'),auth[_0x2452('0x9')](),controller[_0x2452('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2452('0xf')]);router['put']('/:id',auth[_0x2452('0x9')](),controller[_0x2452('0x10')]);router[_0x2452('0x11')](_0x2452('0xd'),auth[_0x2452('0x9')](),controller[_0x2452('0x12')]);module[_0x2452('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index cfafb06..6936dbe 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(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x7a54,0x106));var _0x47a5=function(_0x43c092,_0x206b1a){_0x43c092=_0x43c092-0x0;var _0x9e7e2=_0x7a54[_0x43c092];return _0x9e7e2;};'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(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x7a54,0x106));var _0x47a5=function(_0x1da97b,_0x1b5537){_0x1da97b=_0x1da97b-0x0;var _0xcbab0d=_0x7a54[_0x1da97b];return _0xcbab0d;};'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 b462b9e..885fc7c 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 _0x4fd7=['VIRTUAL','includeAll','rows','show','params','include','options','find','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','fs-extra','lodash','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','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','map','JscriptyAnswerReport','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge'];(function(_0x5dab19,_0x321f57){var _0x2ad128=function(_0x223420){while(--_0x223420){_0x5dab19['push'](_0x5dab19['shift']());}};_0x2ad128(++_0x321f57);}(_0x4fd7,0xe6));var _0x74fd=function(_0x1d7708,_0x24df75){_0x1d7708=_0x1d7708-0x0;var _0x484dfb=_0x4fd7[_0x1d7708];return _0x484dfb;};'use strict';var emlformat=require(_0x74fd('0x0'));var rimraf=require(_0x74fd('0x1'));var zipdir=require(_0x74fd('0x2'));var jsonpatch=require(_0x74fd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x74fd('0x4'));var Mustache=require(_0x74fd('0x5'));var util=require('util');var path=require(_0x74fd('0x6'));var sox=require('sox');var csv=require(_0x74fd('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x74fd('0x8'));var _=require(_0x74fd('0x9'));var squel=require('squel');var crypto=require(_0x74fd('0xa'));var jsforce=require(_0x74fd('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x74fd('0x7'));var querystring=require(_0x74fd('0xc'));var Papa=require(_0x74fd('0xd'));var Redis=require(_0x74fd('0xe'));var authService=require(_0x74fd('0xf'));var qs=require(_0x74fd('0x10'));var as=require(_0x74fd('0x11'));var hardwareService=require(_0x74fd('0x12'));var logger=require(_0x74fd('0x13'))(_0x74fd('0x14'));var utils=require(_0x74fd('0x15'));var config=require(_0x74fd('0x16'));var licenseUtil=require(_0x74fd('0x17'));var db=require(_0x74fd('0x18'))['db'];function respondWithStatusCode(_0x3fd552,_0x8fafcb){_0x8fafcb=_0x8fafcb||0xcc;return function(_0x4d250d){if(_0x4d250d){return _0x3fd552[_0x74fd('0x19')](_0x8fafcb);}return _0x3fd552[_0x74fd('0x1a')](_0x8fafcb)['end']();};}function respondWithResult(_0x47e63c,_0x3e1d11){_0x3e1d11=_0x3e1d11||0xc8;return function(_0x2a4d2e){if(_0x2a4d2e){return _0x47e63c[_0x74fd('0x1a')](_0x3e1d11)[_0x74fd('0x1b')](_0x2a4d2e);}};}function respondWithFilteredResult(_0x24639c,_0x29bbc2){return function(_0x22e64a){if(_0x22e64a){var _0x127353=typeof _0x29bbc2[_0x74fd('0x1c')]===_0x74fd('0x1d')&&typeof _0x29bbc2[_0x74fd('0x1e')]==='undefined';var _0x2975f3=_0x22e64a[_0x74fd('0x1f')];var _0x4cd126=_0x127353?0x0:_0x29bbc2[_0x74fd('0x1c')];var _0x3904e3=_0x127353?_0x22e64a[_0x74fd('0x1f')]:_0x29bbc2[_0x74fd('0x1c')]+_0x29bbc2[_0x74fd('0x1e')];var _0x299f76;if(_0x3904e3>=_0x2975f3){_0x3904e3=_0x2975f3;_0x299f76=0xc8;}else{_0x299f76=0xce;}_0x24639c[_0x74fd('0x1a')](_0x299f76);return _0x24639c[_0x74fd('0x20')](_0x74fd('0x21'),_0x4cd126+'-'+_0x3904e3+'/'+_0x2975f3)[_0x74fd('0x1b')](_0x22e64a);}return null;};}function patchUpdates(_0x5fe487){return function(_0xb23e0){try{jsonpatch[_0x74fd('0x22')](_0xb23e0,_0x5fe487,!![]);}catch(_0x35a735){return BPromise[_0x74fd('0x23')](_0x35a735);}return _0xb23e0[_0x74fd('0x24')]();};}function saveUpdates(_0x1973a1,_0x204f5f){return function(_0x54fb4d){if(_0x54fb4d){return _0x54fb4d[_0x74fd('0x25')](_0x1973a1)[_0x74fd('0x26')](function(_0xf2c6ce){return _0xf2c6ce;});}return null;};}function removeEntity(_0x42cae0,_0x371d9c){return function(_0x4aae69){if(_0x4aae69){return _0x4aae69[_0x74fd('0x27')]()[_0x74fd('0x26')](function(){_0x42cae0['status'](0xcc)[_0x74fd('0x28')]();});}};}function handleEntityNotFound(_0x49debf,_0x2bc644){return function(_0x23d0ce){if(!_0x23d0ce){_0x49debf[_0x74fd('0x19')](0x194);}return _0x23d0ce;};}function handleError(_0x33d3d9,_0x214102){_0x214102=_0x214102||0x1f4;return function(_0x272d16){logger['error'](_0x272d16[_0x74fd('0x29')]);if(_0x272d16[_0x74fd('0x2a')]){delete _0x272d16[_0x74fd('0x2a')];}_0x33d3d9[_0x74fd('0x1a')](_0x214102)['send'](_0x272d16);};}exports['index']=function(_0x2de0eb,_0x476382){var _0x51e574={},_0x22a98c={},_0x57f0e6={'count':0x0,'rows':[]};var _0x4c0609=_[_0x74fd('0x2b')](db[_0x74fd('0x2c')][_0x74fd('0x2d')],function(_0x239839){return{'name':_0x239839[_0x74fd('0x2e')],'type':_0x239839['type'][_0x74fd('0x2f')]};});_0x22a98c['model']=_['map'](_0x4c0609,_0x74fd('0x2a'));_0x22a98c[_0x74fd('0x30')]=_[_0x74fd('0x31')](_0x2de0eb[_0x74fd('0x30')]);_0x22a98c['filters']=_[_0x74fd('0x32')](_0x22a98c[_0x74fd('0x33')],_0x22a98c[_0x74fd('0x30')]);_0x51e574[_0x74fd('0x34')]=_[_0x74fd('0x32')](_0x22a98c[_0x74fd('0x33')],qs[_0x74fd('0x35')](_0x2de0eb[_0x74fd('0x30')][_0x74fd('0x35')]));_0x51e574[_0x74fd('0x34')]=_0x51e574[_0x74fd('0x34')][_0x74fd('0x36')]?_0x51e574[_0x74fd('0x34')]:_0x22a98c[_0x74fd('0x33')];if(!_0x2de0eb[_0x74fd('0x30')]['hasOwnProperty'](_0x74fd('0x37'))){_0x51e574[_0x74fd('0x1e')]=qs[_0x74fd('0x1e')](_0x2de0eb['query'][_0x74fd('0x1e')]);_0x51e574[_0x74fd('0x1c')]=qs[_0x74fd('0x1c')](_0x2de0eb[_0x74fd('0x30')][_0x74fd('0x1c')]);}_0x51e574['order']=qs[_0x74fd('0x38')](_0x2de0eb[_0x74fd('0x30')][_0x74fd('0x38')]);_0x51e574[_0x74fd('0x39')]=qs[_0x74fd('0x3a')](_[_0x74fd('0x3b')](_0x2de0eb[_0x74fd('0x30')],_0x22a98c[_0x74fd('0x3a')]),_0x4c0609);if(_0x2de0eb[_0x74fd('0x30')][_0x74fd('0x3c')]){_0x51e574[_0x74fd('0x39')]=_[_0x74fd('0x3d')](_0x51e574['where'],{'$or':_[_0x74fd('0x2b')](_0x4c0609,function(_0x48b640){if(_0x48b640['type']!==_0x74fd('0x3e')){var _0x242c33={};_0x242c33[_0x48b640[_0x74fd('0x2a')]]={'$like':'%'+_0x2de0eb[_0x74fd('0x30')][_0x74fd('0x3c')]+'%'};return _0x242c33;}})});}_0x51e574=_[_0x74fd('0x3d')]({},_0x51e574,_0x2de0eb['options']);var _0xfa3e6a={'where':_0x51e574[_0x74fd('0x39')]};return db['JscriptyAnswerReport'][_0x74fd('0x1f')](_0xfa3e6a)[_0x74fd('0x26')](function(_0x5a0de1){_0x57f0e6[_0x74fd('0x1f')]=_0x5a0de1;if(_0x2de0eb[_0x74fd('0x30')][_0x74fd('0x3f')]){_0x51e574['include']=[{'all':!![]}];}return db[_0x74fd('0x2c')]['findAll'](_0x51e574);})[_0x74fd('0x26')](function(_0x143aa6){_0x57f0e6[_0x74fd('0x40')]=_0x143aa6;return _0x57f0e6;})[_0x74fd('0x26')](respondWithFilteredResult(_0x476382,_0x51e574))['catch'](handleError(_0x476382,null));};exports[_0x74fd('0x41')]=function(_0x5779e1,_0x47be20){var _0x59d957={'raw':!![],'where':{'id':_0x5779e1[_0x74fd('0x42')]['id']}},_0x4fccd0={};_0x4fccd0[_0x74fd('0x33')]=_[_0x74fd('0x31')](db[_0x74fd('0x2c')]['rawAttributes']);_0x4fccd0[_0x74fd('0x30')]=_['keys'](_0x5779e1[_0x74fd('0x30')]);_0x4fccd0['filters']=_[_0x74fd('0x32')](_0x4fccd0[_0x74fd('0x33')],_0x4fccd0[_0x74fd('0x30')]);_0x59d957[_0x74fd('0x34')]=_[_0x74fd('0x32')](_0x4fccd0[_0x74fd('0x33')],qs[_0x74fd('0x35')](_0x5779e1[_0x74fd('0x30')][_0x74fd('0x35')]));_0x59d957[_0x74fd('0x34')]=_0x59d957[_0x74fd('0x34')][_0x74fd('0x36')]?_0x59d957[_0x74fd('0x34')]:_0x4fccd0[_0x74fd('0x33')];if(_0x5779e1[_0x74fd('0x30')][_0x74fd('0x3f')]){_0x59d957[_0x74fd('0x43')]=[{'all':!![]}];}_0x59d957=_[_0x74fd('0x3d')]({},_0x59d957,_0x5779e1[_0x74fd('0x44')]);return db[_0x74fd('0x2c')][_0x74fd('0x45')](_0x59d957)[_0x74fd('0x26')](handleEntityNotFound(_0x47be20,null))['then'](respondWithResult(_0x47be20,null))['catch'](handleError(_0x47be20,null));};exports['create']=function(_0x14846b,_0x2dea8f){return db[_0x74fd('0x2c')]['create'](_0x14846b['body'],{})[_0x74fd('0x26')](respondWithResult(_0x2dea8f,0xc9))['catch'](handleError(_0x2dea8f,null));};exports[_0x74fd('0x25')]=function(_0x439978,_0x649148){if(_0x439978[_0x74fd('0x46')]['id']){delete _0x439978[_0x74fd('0x46')]['id'];}return db[_0x74fd('0x2c')][_0x74fd('0x45')]({'where':{'id':_0x439978[_0x74fd('0x42')]['id']}})['then'](handleEntityNotFound(_0x649148,null))['then'](saveUpdates(_0x439978[_0x74fd('0x46')],null))[_0x74fd('0x26')](respondWithResult(_0x649148,null))['catch'](handleError(_0x649148,null));};exports['destroy']=function(_0x227d99,_0x39909e){return db[_0x74fd('0x2c')]['find']({'where':{'id':_0x227d99[_0x74fd('0x42')]['id']}})[_0x74fd('0x26')](handleEntityNotFound(_0x39909e,null))['then'](removeEntity(_0x39909e,null))[_0x74fd('0x47')](handleError(_0x39909e,null));};exports[_0x74fd('0x48')]=function(_0x593c6f,_0x470309){return db['JscriptyAnswerReport'][_0x74fd('0x48')]()[_0x74fd('0x26')](respondWithResult(_0x470309,null))[_0x74fd('0x47')](handleError(_0x470309,null));}; \ No newline at end of file +var _0xcd59=['includeAll','include','findAll','rows','catch','show','params','keys','intersection','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL'];(function(_0x34e46d,_0x5df86a){var _0x1cc6aa=function(_0x5a22f7){while(--_0x5a22f7){_0x34e46d['push'](_0x34e46d['shift']());}};_0x1cc6aa(++_0x5df86a);}(_0xcd59,0x14b));var _0x9cd5=function(_0x48a80d,_0x1b2aaf){_0x48a80d=_0x48a80d-0x0;var _0x267bcb=_0xcd59[_0x48a80d];return _0x267bcb;};'use strict';var emlformat=require(_0x9cd5('0x0'));var rimraf=require(_0x9cd5('0x1'));var zipdir=require(_0x9cd5('0x2'));var jsonpatch=require(_0x9cd5('0x3'));var rp=require(_0x9cd5('0x4'));var moment=require(_0x9cd5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9cd5('0x6'));var util=require(_0x9cd5('0x7'));var path=require(_0x9cd5('0x8'));var sox=require(_0x9cd5('0x9'));var csv=require(_0x9cd5('0xa'));var ejs=require(_0x9cd5('0xb'));var fs=require('fs');var fs_extra=require(_0x9cd5('0xc'));var _=require(_0x9cd5('0xd'));var squel=require(_0x9cd5('0xe'));var crypto=require(_0x9cd5('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x9cd5('0x10'));var toCsv=require(_0x9cd5('0xa'));var querystring=require(_0x9cd5('0x11'));var Papa=require(_0x9cd5('0x12'));var Redis=require(_0x9cd5('0x13'));var authService=require(_0x9cd5('0x14'));var qs=require(_0x9cd5('0x15'));var as=require(_0x9cd5('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9cd5('0x17'))(_0x9cd5('0x18'));var utils=require(_0x9cd5('0x19'));var config=require(_0x9cd5('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c9cf1,_0x172e29){_0x172e29=_0x172e29||0xcc;return function(_0x44518d){if(_0x44518d){return _0x2c9cf1[_0x9cd5('0x1b')](_0x172e29);}return _0x2c9cf1[_0x9cd5('0x1c')](_0x172e29)[_0x9cd5('0x1d')]();};}function respondWithResult(_0x52698b,_0x15b639){_0x15b639=_0x15b639||0xc8;return function(_0x1445c0){if(_0x1445c0){return _0x52698b[_0x9cd5('0x1c')](_0x15b639)['json'](_0x1445c0);}};}function respondWithFilteredResult(_0x541cb8,_0x5c4f3d){return function(_0x258305){if(_0x258305){var _0x1ea3f7=typeof _0x5c4f3d['offset']===_0x9cd5('0x1e')&&typeof _0x5c4f3d[_0x9cd5('0x1f')]===_0x9cd5('0x1e');var _0x57b986=_0x258305[_0x9cd5('0x20')];var _0x2d1863=_0x1ea3f7?0x0:_0x5c4f3d[_0x9cd5('0x21')];var _0x3a6f01=_0x1ea3f7?_0x258305[_0x9cd5('0x20')]:_0x5c4f3d[_0x9cd5('0x21')]+_0x5c4f3d['limit'];var _0x37ea13;if(_0x3a6f01>=_0x57b986){_0x3a6f01=_0x57b986;_0x37ea13=0xc8;}else{_0x37ea13=0xce;}_0x541cb8[_0x9cd5('0x1c')](_0x37ea13);return _0x541cb8[_0x9cd5('0x22')](_0x9cd5('0x23'),_0x2d1863+'-'+_0x3a6f01+'/'+_0x57b986)[_0x9cd5('0x24')](_0x258305);}return null;};}function patchUpdates(_0x4ed8b9){return function(_0x16c4e9){try{jsonpatch[_0x9cd5('0x25')](_0x16c4e9,_0x4ed8b9,!![]);}catch(_0x3f1f5c){return BPromise[_0x9cd5('0x26')](_0x3f1f5c);}return _0x16c4e9[_0x9cd5('0x27')]();};}function saveUpdates(_0x1185d7,_0x1cf603){return function(_0x2238ec){if(_0x2238ec){return _0x2238ec[_0x9cd5('0x28')](_0x1185d7)['then'](function(_0x297f0e){return _0x297f0e;});}return null;};}function removeEntity(_0xba8ee9,_0x1a88e3){return function(_0x43f47d){if(_0x43f47d){return _0x43f47d['destroy']()[_0x9cd5('0x29')](function(){_0xba8ee9[_0x9cd5('0x1c')](0xcc)[_0x9cd5('0x1d')]();});}};}function handleEntityNotFound(_0xe36f86,_0x297776){return function(_0x4509e7){if(!_0x4509e7){_0xe36f86[_0x9cd5('0x1b')](0x194);}return _0x4509e7;};}function handleError(_0x4a245f,_0x1dcb6f){_0x1dcb6f=_0x1dcb6f||0x1f4;return function(_0x64a1c4){logger[_0x9cd5('0x2a')](_0x64a1c4['stack']);if(_0x64a1c4['name']){delete _0x64a1c4[_0x9cd5('0x2b')];}_0x4a245f['status'](_0x1dcb6f)['send'](_0x64a1c4);};}exports[_0x9cd5('0x2c')]=function(_0x2a20d2,_0x13e0d3){var _0x5184b9={},_0x40461a={},_0xc0104b={'count':0x0,'rows':[]};var _0x27e1fd=_[_0x9cd5('0x2d')](db[_0x9cd5('0x2e')][_0x9cd5('0x2f')],function(_0x1dbddc){return{'name':_0x1dbddc[_0x9cd5('0x30')],'type':_0x1dbddc[_0x9cd5('0x31')][_0x9cd5('0x32')]};});_0x40461a[_0x9cd5('0x33')]=_[_0x9cd5('0x2d')](_0x27e1fd,_0x9cd5('0x2b'));_0x40461a[_0x9cd5('0x34')]=_['keys'](_0x2a20d2[_0x9cd5('0x34')]);_0x40461a[_0x9cd5('0x35')]=_['intersection'](_0x40461a['model'],_0x40461a[_0x9cd5('0x34')]);_0x5184b9[_0x9cd5('0x36')]=_['intersection'](_0x40461a[_0x9cd5('0x33')],qs['fields'](_0x2a20d2['query'][_0x9cd5('0x37')]));_0x5184b9[_0x9cd5('0x36')]=_0x5184b9[_0x9cd5('0x36')][_0x9cd5('0x38')]?_0x5184b9['attributes']:_0x40461a[_0x9cd5('0x33')];if(!_0x2a20d2[_0x9cd5('0x34')][_0x9cd5('0x39')]('nolimit')){_0x5184b9[_0x9cd5('0x1f')]=qs[_0x9cd5('0x1f')](_0x2a20d2[_0x9cd5('0x34')][_0x9cd5('0x1f')]);_0x5184b9[_0x9cd5('0x21')]=qs[_0x9cd5('0x21')](_0x2a20d2[_0x9cd5('0x34')][_0x9cd5('0x21')]);}_0x5184b9[_0x9cd5('0x3a')]=qs[_0x9cd5('0x3b')](_0x2a20d2[_0x9cd5('0x34')]['sort']);_0x5184b9[_0x9cd5('0x3c')]=qs['filters'](_['pick'](_0x2a20d2[_0x9cd5('0x34')],_0x40461a[_0x9cd5('0x35')]),_0x27e1fd);if(_0x2a20d2[_0x9cd5('0x34')][_0x9cd5('0x3d')]){_0x5184b9['where']=_[_0x9cd5('0x3e')](_0x5184b9[_0x9cd5('0x3c')],{'$or':_[_0x9cd5('0x2d')](_0x27e1fd,function(_0x458a6a){if(_0x458a6a['type']!==_0x9cd5('0x3f')){var _0x3f50de={};_0x3f50de[_0x458a6a[_0x9cd5('0x2b')]]={'$like':'%'+_0x2a20d2[_0x9cd5('0x34')][_0x9cd5('0x3d')]+'%'};return _0x3f50de;}})});}_0x5184b9=_[_0x9cd5('0x3e')]({},_0x5184b9,_0x2a20d2['options']);var _0x26cf61={'where':_0x5184b9[_0x9cd5('0x3c')]};return db[_0x9cd5('0x2e')][_0x9cd5('0x20')](_0x26cf61)[_0x9cd5('0x29')](function(_0x4182bd){_0xc0104b[_0x9cd5('0x20')]=_0x4182bd;if(_0x2a20d2[_0x9cd5('0x34')][_0x9cd5('0x40')]){_0x5184b9[_0x9cd5('0x41')]=[{'all':!![]}];}return db[_0x9cd5('0x2e')][_0x9cd5('0x42')](_0x5184b9);})[_0x9cd5('0x29')](function(_0xa12319){_0xc0104b[_0x9cd5('0x43')]=_0xa12319;return _0xc0104b;})[_0x9cd5('0x29')](respondWithFilteredResult(_0x13e0d3,_0x5184b9))[_0x9cd5('0x44')](handleError(_0x13e0d3,null));};exports[_0x9cd5('0x45')]=function(_0x4ba72c,_0x13d4b8){var _0x58ae2e={'raw':!![],'where':{'id':_0x4ba72c[_0x9cd5('0x46')]['id']}},_0x427d78={};_0x427d78[_0x9cd5('0x33')]=_[_0x9cd5('0x47')](db[_0x9cd5('0x2e')]['rawAttributes']);_0x427d78[_0x9cd5('0x34')]=_[_0x9cd5('0x47')](_0x4ba72c[_0x9cd5('0x34')]);_0x427d78['filters']=_[_0x9cd5('0x48')](_0x427d78[_0x9cd5('0x33')],_0x427d78[_0x9cd5('0x34')]);_0x58ae2e[_0x9cd5('0x36')]=_['intersection'](_0x427d78[_0x9cd5('0x33')],qs[_0x9cd5('0x37')](_0x4ba72c[_0x9cd5('0x34')][_0x9cd5('0x37')]));_0x58ae2e[_0x9cd5('0x36')]=_0x58ae2e[_0x9cd5('0x36')][_0x9cd5('0x38')]?_0x58ae2e[_0x9cd5('0x36')]:_0x427d78[_0x9cd5('0x33')];if(_0x4ba72c[_0x9cd5('0x34')][_0x9cd5('0x40')]){_0x58ae2e[_0x9cd5('0x41')]=[{'all':!![]}];}_0x58ae2e=_[_0x9cd5('0x3e')]({},_0x58ae2e,_0x4ba72c[_0x9cd5('0x49')]);return db[_0x9cd5('0x2e')][_0x9cd5('0x4a')](_0x58ae2e)[_0x9cd5('0x29')](handleEntityNotFound(_0x13d4b8,null))[_0x9cd5('0x29')](respondWithResult(_0x13d4b8,null))['catch'](handleError(_0x13d4b8,null));};exports[_0x9cd5('0x4b')]=function(_0x1c581a,_0x3fead7){return db[_0x9cd5('0x2e')]['create'](_0x1c581a[_0x9cd5('0x4c')],{})[_0x9cd5('0x29')](respondWithResult(_0x3fead7,0xc9))['catch'](handleError(_0x3fead7,null));};exports[_0x9cd5('0x28')]=function(_0x155652,_0x152b17){if(_0x155652[_0x9cd5('0x4c')]['id']){delete _0x155652[_0x9cd5('0x4c')]['id'];}return db[_0x9cd5('0x2e')][_0x9cd5('0x4a')]({'where':{'id':_0x155652[_0x9cd5('0x46')]['id']}})['then'](handleEntityNotFound(_0x152b17,null))['then'](saveUpdates(_0x155652[_0x9cd5('0x4c')],null))[_0x9cd5('0x29')](respondWithResult(_0x152b17,null))[_0x9cd5('0x44')](handleError(_0x152b17,null));};exports[_0x9cd5('0x4d')]=function(_0x5a933a,_0xf6e17b){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x5a933a[_0x9cd5('0x46')]['id']}})[_0x9cd5('0x29')](handleEntityNotFound(_0xf6e17b,null))[_0x9cd5('0x29')](removeEntity(_0xf6e17b,null))['catch'](handleError(_0xf6e17b,null));};exports[_0x9cd5('0x4e')]=function(_0x30c80f,_0x310e4a){return db[_0x9cd5('0x2e')][_0x9cd5('0x4e')]()[_0x9cd5('0x29')](respondWithResult(_0x310e4a,null))['catch'](handleError(_0x310e4a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 98be432..0aebeda 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 _0xf737=['bluebird','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','lodash','util','../../config/logger'];(function(_0x4127e1,_0xe6f772){var _0x789f4a=function(_0x3e295f){while(--_0x3e295f){_0x4127e1['push'](_0x4127e1['shift']());}};_0x789f4a(++_0xe6f772);}(_0xf737,0x11f));var _0x7f73=function(_0x4d2a2d,_0x5cd08f){_0x4d2a2d=_0x4d2a2d-0x0;var _0x4ee294=_0xf737[_0x4d2a2d];return _0x4ee294;};'use strict';var _=require(_0x7f73('0x0'));var util=require(_0x7f73('0x1'));var logger=require(_0x7f73('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7f73('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f73('0x4'));var rimraf=require(_0x7f73('0x5'));var config=require(_0x7f73('0x6'));var attributes=require(_0x7f73('0x7'));module[_0x7f73('0x8')]=function(_0x1ae690,_0x562db6){return _0x1ae690['define'](_0x7f73('0x9'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8fdc=['report_jscripty_answers','lodash','util','bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','JscriptyAnswerReport'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x8fdc,0x7f));var _0xc8fd=function(_0x2892da,_0x191a40){_0x2892da=_0x2892da-0x0;var _0x28cff2=_0x8fdc[_0x2892da];return _0x28cff2;};'use strict';var _=require(_0xc8fd('0x0'));var util=require(_0xc8fd('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc8fd('0x2'));var rp=require(_0xc8fd('0x3'));var fs=require('fs');var path=require(_0xc8fd('0x4'));var rimraf=require('rimraf');var config=require(_0xc8fd('0x5'));var attributes=require(_0xc8fd('0x6'));module['exports']=function(_0xf70011,_0x263bd2){return _0xf70011['define'](_0xc8fd('0x7'),attributes,{'tableName':_0xc8fd('0x8'),'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 d140d86..9736e30 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 _0xcb83=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch'];(function(_0x1f40d5,_0x1fcba1){var _0xaee672=function(_0x108448){while(--_0x108448){_0x1f40d5['push'](_0x1f40d5['shift']());}};_0xaee672(++_0x1fcba1);}(_0xcb83,0xdc));var _0x3cb8=function(_0x5141b3,_0x1afe5f){_0x5141b3=_0x5141b3-0x0;var _0x522ec0=_0xcb83[_0x5141b3];return _0x522ec0;};'use strict';var _=require(_0x3cb8('0x0'));var util=require(_0x3cb8('0x1'));var moment=require(_0x3cb8('0x2'));var BPromise=require(_0x3cb8('0x3'));var rs=require(_0x3cb8('0x4'));var fs=require('fs');var Redis=require(_0x3cb8('0x5'));var db=require(_0x3cb8('0x6'))['db'];var utils=require(_0x3cb8('0x7'));var logger=require('../../config/logger')(_0x3cb8('0x8'));var config=require('../../config/environment');var jayson=require(_0x3cb8('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x331413,_0x267939,_0xb73c09){return new BPromise(function(_0xe6d437,_0x173c76){return client[_0x3cb8('0xa')](_0x331413,_0xb73c09)[_0x3cb8('0xb')](function(_0x2afee3){logger['info'](_0x3cb8('0xc'),_0x267939,_0x3cb8('0xd'));logger['debug'](_0x3cb8('0xe'),_0x267939,'request\x20sent',JSON['stringify'](_0x2afee3));if(_0x2afee3[_0x3cb8('0xf')]){if(_0x2afee3['error']['code']===0x1f4){logger[_0x3cb8('0xf')](_0x3cb8('0xc'),_0x267939,_0x2afee3[_0x3cb8('0xf')]['message']);return _0x173c76(_0x2afee3[_0x3cb8('0xf')][_0x3cb8('0x10')]);}logger[_0x3cb8('0xf')](_0x3cb8('0xc'),_0x267939,_0x2afee3['error'][_0x3cb8('0x10')]);return _0xe6d437(_0x2afee3[_0x3cb8('0xf')][_0x3cb8('0x10')]);}else{logger[_0x3cb8('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x267939,_0x3cb8('0xd'));_0xe6d437(_0x2afee3[_0x3cb8('0x12')]['message']);}})[_0x3cb8('0x13')](function(_0x57e99f){logger[_0x3cb8('0xf')](_0x3cb8('0xc'),_0x267939,_0x57e99f);_0x173c76(_0x57e99f);});});} \ No newline at end of file +var _0x8726=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x44317e,_0x35066a){var _0xfc90ec=function(_0x209227){while(--_0x209227){_0x44317e['push'](_0x44317e['shift']());}};_0xfc90ec(++_0x35066a);}(_0x8726,0x14c));var _0x6872=function(_0x596e02,_0x5d3823){_0x596e02=_0x596e02-0x0;var _0x10c935=_0x8726[_0x596e02];return _0x10c935;};'use strict';var _=require(_0x6872('0x0'));var util=require(_0x6872('0x1'));var moment=require('moment');var BPromise=require(_0x6872('0x2'));var rs=require(_0x6872('0x3'));var fs=require('fs');var Redis=require(_0x6872('0x4'));var db=require(_0x6872('0x5'))['db'];var utils=require(_0x6872('0x6'));var logger=require(_0x6872('0x7'))('rpc');var config=require(_0x6872('0x8'));var jayson=require(_0x6872('0x9'));var client=jayson[_0x6872('0xa')][_0x6872('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37bb74,_0xf5fbd6,_0x1043de){return new BPromise(function(_0x4ccdca,_0x18b674){return client[_0x6872('0xc')](_0x37bb74,_0x1043de)['then'](function(_0x1e56fd){logger[_0x6872('0xd')](_0x6872('0xe'),_0xf5fbd6,_0x6872('0xf'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0xf5fbd6,_0x6872('0xf'),JSON[_0x6872('0x10')](_0x1e56fd));if(_0x1e56fd[_0x6872('0x11')]){if(_0x1e56fd[_0x6872('0x11')]['code']===0x1f4){logger[_0x6872('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xf5fbd6,_0x1e56fd[_0x6872('0x11')]['message']);return _0x18b674(_0x1e56fd['error'][_0x6872('0x12')]);}logger[_0x6872('0x11')](_0x6872('0xe'),_0xf5fbd6,_0x1e56fd['error']['message']);return _0x4ccdca(_0x1e56fd[_0x6872('0x11')][_0x6872('0x12')]);}else{logger[_0x6872('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xf5fbd6,_0x6872('0xf'));_0x4ccdca(_0x1e56fd[_0x6872('0x13')][_0x6872('0x12')]);}})[_0x6872('0x14')](function(_0x45b7a4){logger[_0x6872('0x11')](_0x6872('0xe'),_0xf5fbd6,_0x45b7a4);_0x18b674(_0x45b7a4);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 84deb5b..a158749 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 _0xfd65=['/:id/clone','clone','put','/:id','update','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','/:id/summary','getSummary','post','create'];(function(_0x33081f,_0x2c12df){var _0x2978d9=function(_0x2d1fc1){while(--_0x2d1fc1){_0x33081f['push'](_0x33081f['shift']());}};_0x2978d9(++_0x2c12df);}(_0xfd65,0x67));var _0x5fd6=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xfd65[_0x1a9204];return _0x17ca68;};'use strict';var multer=require(_0x5fd6('0x0'));var util=require(_0x5fd6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5fd6('0x2'));var router=express['Router']();var fs_extra=require(_0x5fd6('0x3'));var auth=require(_0x5fd6('0x4'));var interaction=require(_0x5fd6('0x5'));var config=require(_0x5fd6('0x6'));var controller=require('./jscriptyProject.controller');router[_0x5fd6('0x7')]('/',auth[_0x5fd6('0x8')](),controller['index']);router[_0x5fd6('0x7')]('/:id',auth[_0x5fd6('0x8')](),controller[_0x5fd6('0x9')]);router[_0x5fd6('0x7')](_0x5fd6('0xa'),auth[_0x5fd6('0x8')](),controller[_0x5fd6('0xb')]);router[_0x5fd6('0x7')](_0x5fd6('0xc'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x5fd6('0x7')](_0x5fd6('0xd'),auth['isAuthenticated'](),timeout('30s'),controller[_0x5fd6('0xe')]);router[_0x5fd6('0xf')]('/',auth[_0x5fd6('0x8')](),controller[_0x5fd6('0x10')]);router['post'](_0x5fd6('0x11'),auth[_0x5fd6('0x8')](),controller[_0x5fd6('0x12')]);router[_0x5fd6('0x13')](_0x5fd6('0x14'),auth['isAuthenticated'](),controller[_0x5fd6('0x15')]);router['delete'](_0x5fd6('0x14'),auth[_0x5fd6('0x8')](),controller[_0x5fd6('0x16')]);module[_0x5fd6('0x17')]=router; \ No newline at end of file +var _0x4119=['get','getSessions','/:id/answers','isAuthenticated','30s','getSummary','post','create','clone','put','update','delete','destroy','exports','path','Router','../../components/auth/service','../../config/environment','./jscriptyProject.controller','index','/:id','show'];(function(_0x1f4202,_0x5350da){var _0x47bb0d=function(_0x3052e9){while(--_0x3052e9){_0x1f4202['push'](_0x1f4202['shift']());}};_0x47bb0d(++_0x5350da);}(_0x4119,0x184));var _0x9411=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4119[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9411('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9411('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x9411('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x9411('0x3'));var controller=require(_0x9411('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x9411('0x5')]);router['get'](_0x9411('0x6'),auth['isAuthenticated'](),controller[_0x9411('0x7')]);router[_0x9411('0x8')]('/:id/sessions',auth['isAuthenticated'](),controller[_0x9411('0x9')]);router['get'](_0x9411('0xa'),auth[_0x9411('0xb')](),controller['getAnswers']);router['get']('/:id/summary',auth['isAuthenticated'](),timeout(_0x9411('0xc')),controller[_0x9411('0xd')]);router[_0x9411('0xe')]('/',auth[_0x9411('0xb')](),controller[_0x9411('0xf')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0x9411('0x10')]);router[_0x9411('0x11')](_0x9411('0x6'),auth['isAuthenticated'](),controller[_0x9411('0x12')]);router[_0x9411('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x9411('0x14')]);module[_0x9411('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index fc114c5..06e3dc7 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 _0x580f=['BOOLEAN','lodash','util','STRING','name','isObjectLike','setDataValue','formData','stringify','isString','format','getDataValue'];(function(_0x17fa51,_0x5ae3f3){var _0x71141f=function(_0xc5ea8){while(--_0xc5ea8){_0x17fa51['push'](_0x17fa51['shift']());}};_0x71141f(++_0x5ae3f3);}(_0x580f,0x1e1));var _0xf580=function(_0x5d41e2,_0x2ca072){_0x5d41e2=_0x5d41e2-0x0;var _0x1de8a3=_0x580f[_0x5d41e2];return _0x1de8a3;};'use strict';var Sequelize=require('sequelize');var _=require(_0xf580('0x0'));var util=require(_0xf580('0x1'));module['exports']={'name':{'type':Sequelize[_0xf580('0x2')],'unique':_0xf580('0x3')},'description':{'type':Sequelize[_0xf580('0x2')]},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x344232){if(_[_0xf580('0x4')](_0x344232)){this[_0xf580('0x5')](_0xf580('0x6'),JSON[_0xf580('0x7')](_0x344232));}else if(_[_0xf580('0x8')](_0x344232)){this[_0xf580('0x5')](_0xf580('0x6'),_0x344232);}else{this[_0xf580('0x5')](_0xf580('0x6'),util[_0xf580('0x9')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xf580('0xa')]('name')||'',this[_0xf580('0xa')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xf580('0xb')],'defaultValue':![]}}; \ No newline at end of file +var _0xdf0d=['BOOLEAN','sequelize','lodash','exports','STRING','TEXT','long','formData','stringify','isString','setDataValue','format','name','getDataValue','description'];(function(_0x8f9872,_0xd2c2b2){var _0x5f277a=function(_0x5d387e){while(--_0x5d387e){_0x8f9872['push'](_0x8f9872['shift']());}};_0x5f277a(++_0xd2c2b2);}(_0xdf0d,0x1d2));var _0xddf0=function(_0x2b5c9b,_0x461b9a){_0x2b5c9b=_0x2b5c9b-0x0;var _0x2331f2=_0xdf0d[_0x2b5c9b];return _0x2331f2;};'use strict';var Sequelize=require(_0xddf0('0x0'));var _=require(_0xddf0('0x1'));var util=require('util');module[_0xddf0('0x2')]={'name':{'type':Sequelize[_0xddf0('0x3')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xddf0('0x4')](_0xddf0('0x5')),'set':function(_0x23067a){if(_['isObjectLike'](_0x23067a)){this['setDataValue'](_0xddf0('0x6'),JSON[_0xddf0('0x7')](_0x23067a));}else if(_[_0xddf0('0x8')](_0x23067a)){this[_0xddf0('0x9')](_0xddf0('0x6'),_0x23067a);}else{this[_0xddf0('0x9')](_0xddf0('0x6'),util[_0xddf0('0xa')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0xddf0('0xb'))||'',this[_0xddf0('0xc')](_0xddf0('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xddf0('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 26db909..40d2680 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 _0xb139=['keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','createdAt','updatedAt','getSessions','findOne','JscriptySessionReport','getAnswers','pick','ProjectId','JscriptyAnswerReport','number','toString','indexOf','replace','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','eml-format','rimraf','fast-json-patch','request-promise','moment','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','Projects','name','send','JscriptyProject','type','key','model','map'];(function(_0x5ad2d8,_0x2f235e){var _0x36107a=function(_0x4e9a35){while(--_0x4e9a35){_0x5ad2d8['push'](_0x5ad2d8['shift']());}};_0x36107a(++_0x2f235e);}(_0xb139,0x1ba));var _0x9b13=function(_0x319152,_0x21851a){_0x319152=_0x319152-0x0;var _0x4beaa1=_0xb139[_0x319152];return _0x4beaa1;};'use strict';var emlformat=require(_0x9b13('0x0'));var rimraf=require(_0x9b13('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9b13('0x2'));var rp=require(_0x9b13('0x3'));var moment=require(_0x9b13('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9b13('0x5'));var sox=require(_0x9b13('0x6'));var csv=require(_0x9b13('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9b13('0x8'));var _=require(_0x9b13('0x9'));var squel=require(_0x9b13('0xa'));var crypto=require(_0x9b13('0xb'));var jsforce=require(_0x9b13('0xc'));var deskjs=require(_0x9b13('0xd'));var toCsv=require(_0x9b13('0x7'));var querystring=require('querystring');var Papa=require(_0x9b13('0xe'));var Redis=require(_0x9b13('0xf'));var authService=require(_0x9b13('0x10'));var qs=require(_0x9b13('0x11'));var as=require(_0x9b13('0x12'));var hardwareService=require(_0x9b13('0x13'));var logger=require(_0x9b13('0x14'))(_0x9b13('0x15'));var utils=require(_0x9b13('0x16'));var config=require(_0x9b13('0x17'));var licenseUtil=require(_0x9b13('0x18'));var db=require(_0x9b13('0x19'))['db'];function respondWithStatusCode(_0x57c6bb,_0x2acc39){_0x2acc39=_0x2acc39||0xcc;return function(_0xf73b78){if(_0xf73b78){return _0x57c6bb[_0x9b13('0x1a')](_0x2acc39);}return _0x57c6bb[_0x9b13('0x1b')](_0x2acc39)[_0x9b13('0x1c')]();};}function respondWithResult(_0x38bca4,_0x6bb190){_0x6bb190=_0x6bb190||0xc8;return function(_0x89509a){if(_0x89509a){return _0x38bca4[_0x9b13('0x1b')](_0x6bb190)['json'](_0x89509a);}};}function respondWithFilteredResult(_0x22e19f,_0x52bffa){return function(_0x3c49d4){if(_0x3c49d4){var _0x2e60cd=typeof _0x52bffa[_0x9b13('0x1d')]===_0x9b13('0x1e')&&typeof _0x52bffa[_0x9b13('0x1f')]===_0x9b13('0x1e');var _0x5d3624=_0x3c49d4[_0x9b13('0x20')];var _0x113926=_0x2e60cd?0x0:_0x52bffa[_0x9b13('0x1d')];var _0x54b0d5=_0x2e60cd?_0x3c49d4[_0x9b13('0x20')]:_0x52bffa[_0x9b13('0x1d')]+_0x52bffa[_0x9b13('0x1f')];var _0x3a3aa2;if(_0x54b0d5>=_0x5d3624){_0x54b0d5=_0x5d3624;_0x3a3aa2=0xc8;}else{_0x3a3aa2=0xce;}_0x22e19f[_0x9b13('0x1b')](_0x3a3aa2);return _0x22e19f[_0x9b13('0x21')](_0x9b13('0x22'),_0x113926+'-'+_0x54b0d5+'/'+_0x5d3624)[_0x9b13('0x23')](_0x3c49d4);}return null;};}function patchUpdates(_0x2a1b73){return function(_0x2aebf4){try{jsonpatch[_0x9b13('0x24')](_0x2aebf4,_0x2a1b73,!![]);}catch(_0x463229){return BPromise['reject'](_0x463229);}return _0x2aebf4[_0x9b13('0x25')]();};}function saveUpdates(_0xc6e24,_0x52eb75){return function(_0x7abfbe){if(_0x7abfbe){return _0x7abfbe[_0x9b13('0x26')](_0xc6e24)[_0x9b13('0x27')](function(_0x14da02){return _0x14da02;});}return null;};}function removeEntity(_0x510259,_0x15babe){return function(_0x24d267){if(_0x24d267){return _0x24d267[_0x9b13('0x28')]()[_0x9b13('0x27')](function(){var _0x543001=_0x24d267[_0x9b13('0x29')]({'plain':!![]});var _0x591c3c=_0x9b13('0x2a');return db['UserProfileResource'][_0x9b13('0x28')]({'where':{'type':_0x591c3c,'resourceId':_0x543001['id']}})[_0x9b13('0x27')](function(){return _0x24d267;});})[_0x9b13('0x27')](function(){_0x510259[_0x9b13('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x192631,_0x58419e){return function(_0x37c1e1){if(!_0x37c1e1){_0x192631['sendStatus'](0x194);}return _0x37c1e1;};}function handleError(_0x4eeaf2,_0x1ecf08){_0x1ecf08=_0x1ecf08||0x1f4;return function(_0x1905ca){logger['error'](_0x1905ca['stack']);if(_0x1905ca[_0x9b13('0x2b')]){delete _0x1905ca[_0x9b13('0x2b')];}_0x4eeaf2[_0x9b13('0x1b')](_0x1ecf08)[_0x9b13('0x2c')](_0x1905ca);};}exports['index']=function(_0x2da422,_0x582ad8){var _0x122b8b={},_0x3b6af={},_0x5660c6={'count':0x0,'rows':[]};var _0x4a0a17=_['map'](db[_0x9b13('0x2d')]['rawAttributes'],function(_0x3262d1){return{'name':_0x3262d1['fieldName'],'type':_0x3262d1[_0x9b13('0x2e')][_0x9b13('0x2f')]};});_0x3b6af[_0x9b13('0x30')]=_[_0x9b13('0x31')](_0x4a0a17,_0x9b13('0x2b'));_0x3b6af['query']=_[_0x9b13('0x32')](_0x2da422[_0x9b13('0x33')]);_0x3b6af['filters']=_[_0x9b13('0x34')](_0x3b6af[_0x9b13('0x30')],_0x3b6af[_0x9b13('0x33')]);_0x122b8b[_0x9b13('0x35')]=_['intersection'](_0x3b6af['model'],qs[_0x9b13('0x36')](_0x2da422[_0x9b13('0x33')][_0x9b13('0x36')]));_0x122b8b[_0x9b13('0x35')]=_0x122b8b[_0x9b13('0x35')][_0x9b13('0x37')]?_0x122b8b[_0x9b13('0x35')]:_0x3b6af['model'];if(!_0x2da422['query'][_0x9b13('0x38')](_0x9b13('0x39'))){_0x122b8b[_0x9b13('0x1f')]=qs['limit'](_0x2da422[_0x9b13('0x33')]['limit']);_0x122b8b['offset']=qs['offset'](_0x2da422[_0x9b13('0x33')]['offset']);}_0x122b8b[_0x9b13('0x3a')]=qs[_0x9b13('0x3b')](_0x2da422[_0x9b13('0x33')][_0x9b13('0x3b')]);_0x122b8b[_0x9b13('0x3c')]=qs[_0x9b13('0x3d')](_['pick'](_0x2da422['query'],_0x3b6af[_0x9b13('0x3d')]),_0x4a0a17);if(_0x2da422['query'][_0x9b13('0x3e')]){_0x122b8b[_0x9b13('0x3c')]=_[_0x9b13('0x3f')](_0x122b8b[_0x9b13('0x3c')],{'$or':_[_0x9b13('0x31')](_0x4a0a17,function(_0x5edfed){if(_0x5edfed[_0x9b13('0x2e')]!==_0x9b13('0x40')){var _0x2770eb={};_0x2770eb[_0x5edfed['name']]={'$like':'%'+_0x2da422[_0x9b13('0x33')]['filter']+'%'};return _0x2770eb;}})});}_0x122b8b=_[_0x9b13('0x3f')]({},_0x122b8b,_0x2da422[_0x9b13('0x41')]);var _0x27ee0b={'where':_0x122b8b[_0x9b13('0x3c')]};return db[_0x9b13('0x2d')][_0x9b13('0x20')](_0x27ee0b)['then'](function(_0x297e8d){_0x5660c6[_0x9b13('0x20')]=_0x297e8d;if(_0x2da422[_0x9b13('0x33')][_0x9b13('0x42')]){_0x122b8b['include']=[{'all':!![]}];}return db[_0x9b13('0x2d')][_0x9b13('0x43')](_0x122b8b);})[_0x9b13('0x27')](function(_0x56f558){_0x5660c6[_0x9b13('0x44')]=_0x56f558;return _0x5660c6;})[_0x9b13('0x27')](respondWithFilteredResult(_0x582ad8,_0x122b8b))[_0x9b13('0x45')](handleError(_0x582ad8,null));};exports[_0x9b13('0x46')]=function(_0x334739,_0x48d52f){var _0x4e6db6={'raw':![],'where':{'id':_0x334739[_0x9b13('0x47')]['id']}},_0x507387={};_0x507387['model']=_[_0x9b13('0x32')](db[_0x9b13('0x2d')][_0x9b13('0x48')]);_0x507387[_0x9b13('0x33')]=_[_0x9b13('0x32')](_0x334739[_0x9b13('0x33')]);_0x507387[_0x9b13('0x3d')]=_['intersection'](_0x507387[_0x9b13('0x30')],_0x507387[_0x9b13('0x33')]);_0x4e6db6[_0x9b13('0x35')]=_['intersection'](_0x507387[_0x9b13('0x30')],qs[_0x9b13('0x36')](_0x334739['query'][_0x9b13('0x36')]));_0x4e6db6[_0x9b13('0x35')]=_0x4e6db6[_0x9b13('0x35')][_0x9b13('0x37')]?_0x4e6db6[_0x9b13('0x35')]:_0x507387['model'];if(_0x334739['query'][_0x9b13('0x42')]){_0x4e6db6['include']=[{'all':!![]}];}_0x4e6db6=_[_0x9b13('0x3f')]({},_0x4e6db6,_0x334739['options']);return db[_0x9b13('0x2d')][_0x9b13('0x49')](_0x4e6db6)[_0x9b13('0x27')](handleEntityNotFound(_0x48d52f,null))[_0x9b13('0x27')](respondWithResult(_0x48d52f,null))[_0x9b13('0x45')](handleError(_0x48d52f,null));};exports['create']=function(_0x1b397b,_0x110998){return db[_0x9b13('0x2d')][_0x9b13('0x4a')](_0x1b397b[_0x9b13('0x4b')],{})[_0x9b13('0x27')](function(_0x1cb92e){var _0x582e98=_0x1b397b['user'][_0x9b13('0x29')]({'plain':!![]});if(!_0x582e98)throw new Error(_0x9b13('0x4c'));if(_0x582e98[_0x9b13('0x4d')]===_0x9b13('0x4e')){var _0x26c2c2=_0x1cb92e['get']({'plain':!![]});var _0x32661e=_0x9b13('0x2a');return db[_0x9b13('0x4f')][_0x9b13('0x49')]({'where':{'name':_0x32661e,'userProfileId':_0x582e98[_0x9b13('0x50')]},'raw':!![]})[_0x9b13('0x27')](function(_0xaed59b){if(_0xaed59b&&_0xaed59b[_0x9b13('0x51')]===0x0){return db[_0x9b13('0x52')][_0x9b13('0x4a')]({'name':_0x26c2c2['name'],'resourceId':_0x26c2c2['id'],'type':_0xaed59b['name'],'sectionId':_0xaed59b['id']},{})[_0x9b13('0x27')](function(){return _0x1cb92e;});}else{return _0x1cb92e;}})[_0x9b13('0x45')](function(_0x5107de){logger[_0x9b13('0x53')](_0x9b13('0x54'),_0x5107de);throw _0x5107de;});}return _0x1cb92e;})['then'](respondWithResult(_0x110998,0xc9))['catch'](handleError(_0x110998,null));};exports[_0x9b13('0x55')]=function(_0x36f92b,_0x4427f9){var _0x37fb97={'where':{'id':_0x36f92b[_0x9b13('0x47')]['id']}},_0x2a9ba2={};_0x2a9ba2[_0x9b13('0x30')]=_['keys'](db[_0x9b13('0x2d')]['rawAttributes']);_0x37fb97['attributes']=_[_0x9b13('0x34')](_0x2a9ba2['model'],qs['fields'](_0x36f92b[_0x9b13('0x33')][_0x9b13('0x36')]));_0x37fb97[_0x9b13('0x35')]=_0x37fb97[_0x9b13('0x35')][_0x9b13('0x37')]?_0x37fb97[_0x9b13('0x35')]:_0x2a9ba2[_0x9b13('0x30')];if(_0x36f92b[_0x9b13('0x33')][_0x9b13('0x42')]){_0x37fb97[_0x9b13('0x56')]=[{'all':!![]}];}_0x37fb97=_[_0x9b13('0x3f')]({},_0x37fb97,_0x36f92b[_0x9b13('0x41')]);return db[_0x9b13('0x2d')][_0x9b13('0x49')](_0x37fb97)[_0x9b13('0x27')](handleEntityNotFound(_0x4427f9,null))['then'](function(_0x3c061b){if(_0x3c061b){var _0xd4c104=_0x3c061b[_0x9b13('0x29')]({'plain':!![]});_0xd4c104=qs[_0x9b13('0x57')](_0xd4c104,['id',_0x9b13('0x58'),_0x9b13('0x59')]);_0x36f92b['body']=_[_0x9b13('0x57')](_0x36f92b[_0x9b13('0x4b')],['id',_0x9b13('0x58'),_0x9b13('0x59')]);return db[_0x9b13('0x2d')][_0x9b13('0x4a')](_[_0x9b13('0x3f')](_0xd4c104,_0x36f92b[_0x9b13('0x4b')]),{'include':_0x36f92b[_0x9b13('0x33')][_0x9b13('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x828720){var _0x362a66=_0x36f92b[_0x9b13('0x4e')]['get']({'plain':!![]});if(!_0x362a66)throw new Error(_0x9b13('0x4c'));if(_0x362a66[_0x9b13('0x4d')]===_0x9b13('0x4e')){var _0x97bec6=_0x828720[_0x9b13('0x29')]({'plain':!![]});var _0x5a4f1a=_0x9b13('0x2a');return db[_0x9b13('0x4f')][_0x9b13('0x49')]({'where':{'name':_0x5a4f1a,'userProfileId':_0x362a66[_0x9b13('0x50')]},'raw':!![]})[_0x9b13('0x27')](function(_0x51e63a){if(_0x51e63a&&_0x51e63a[_0x9b13('0x51')]===0x0){return db[_0x9b13('0x52')]['create']({'name':_0x97bec6['name'],'resourceId':_0x97bec6['id'],'type':_0x51e63a[_0x9b13('0x2b')],'sectionId':_0x51e63a['id']},{})['then'](function(){return _0x828720;});}else{return _0x828720;}})['catch'](function(_0x5c4837){logger[_0x9b13('0x53')](_0x9b13('0x54'),_0x5c4837);throw _0x5c4837;});}return _0x828720;});}})[_0x9b13('0x27')](respondWithResult(_0x4427f9,0xc9))[_0x9b13('0x45')](handleError(_0x4427f9,null));};exports[_0x9b13('0x26')]=function(_0x3bfc43,_0x3e4c6e){if(_0x3bfc43[_0x9b13('0x4b')]['id']){delete _0x3bfc43[_0x9b13('0x4b')]['id'];}return db[_0x9b13('0x2d')][_0x9b13('0x49')]({'where':{'id':_0x3bfc43[_0x9b13('0x47')]['id']}})[_0x9b13('0x27')](handleEntityNotFound(_0x3e4c6e,null))['then'](saveUpdates(_0x3bfc43['body'],null))[_0x9b13('0x27')](respondWithResult(_0x3e4c6e,null))[_0x9b13('0x45')](handleError(_0x3e4c6e,null));};exports['destroy']=function(_0x4594ca,_0x20b169){return db[_0x9b13('0x2d')]['find']({'where':{'id':_0x4594ca[_0x9b13('0x47')]['id']}})[_0x9b13('0x27')](handleEntityNotFound(_0x20b169,null))[_0x9b13('0x27')](removeEntity(_0x20b169,null))[_0x9b13('0x45')](handleError(_0x20b169,null));};exports[_0x9b13('0x5a')]=function(_0xca35b9,_0x2c7b0d,_0x3d156d){var _0x36537c={'raw':!![],'where':{}};var _0x5b48fa={};var _0x368990={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x9b13('0x5b')]({'where':{'id':_0xca35b9[_0x9b13('0x47')]['id']}})['then'](handleEntityNotFound(_0x2c7b0d,null))[_0x9b13('0x27')](function(_0x1bd393){if(_0x1bd393){_0x5b48fa['model']=_[_0x9b13('0x32')](db[_0x9b13('0x5c')][_0x9b13('0x48')]);_0x5b48fa[_0x9b13('0x33')]=_[_0x9b13('0x32')](_0xca35b9[_0x9b13('0x33')]);_0x5b48fa[_0x9b13('0x3d')]=_[_0x9b13('0x34')](_0x5b48fa['model'],_0x5b48fa[_0x9b13('0x33')]);_0x36537c[_0x9b13('0x35')]=_['intersection'](_0x5b48fa[_0x9b13('0x30')],qs[_0x9b13('0x36')](_0xca35b9[_0x9b13('0x33')][_0x9b13('0x36')]));_0x36537c['attributes']=_0x36537c[_0x9b13('0x35')]['length']?_0x36537c['attributes']:_0x5b48fa[_0x9b13('0x30')];if(!_0xca35b9[_0x9b13('0x33')][_0x9b13('0x38')]('nolimit')){_0x36537c[_0x9b13('0x1f')]=qs[_0x9b13('0x1f')](_0xca35b9[_0x9b13('0x33')][_0x9b13('0x1f')]);_0x36537c[_0x9b13('0x1d')]=qs['offset'](_0xca35b9[_0x9b13('0x33')][_0x9b13('0x1d')]);}_0x36537c[_0x9b13('0x3a')]=qs['sort'](_0xca35b9[_0x9b13('0x33')][_0x9b13('0x3b')]);_0x36537c[_0x9b13('0x3c')]=qs[_0x9b13('0x3d')](_['pick'](_0xca35b9[_0x9b13('0x33')],_0x5b48fa[_0x9b13('0x3d')]));_0x36537c[_0x9b13('0x3c')]['ProjectId']=_0x1bd393['id'];if(_0xca35b9[_0x9b13('0x33')][_0x9b13('0x3e')]){_0x36537c[_0x9b13('0x3c')]=_[_0x9b13('0x3f')](_0x36537c[_0x9b13('0x3c')],{'$or':_[_0x9b13('0x31')](_0x36537c[_0x9b13('0x35')],function(_0x3311b7){var _0x2989a5={};_0x2989a5[_0x3311b7]={'$like':'%'+_0xca35b9['query'][_0x9b13('0x3e')]+'%'};return _0x2989a5;})});}_0x36537c=_['merge']({},_0x36537c,_0xca35b9[_0x9b13('0x41')]);return db[_0x9b13('0x5c')][_0x9b13('0x20')]({'where':_0x36537c[_0x9b13('0x3c')]})[_0x9b13('0x27')](function(_0x2a7b7c){_0x368990[_0x9b13('0x20')]=_0x2a7b7c;if(_0xca35b9[_0x9b13('0x33')][_0x9b13('0x42')]){_0x36537c['include']=[{'all':!![]}];}return db[_0x9b13('0x5c')][_0x9b13('0x43')](_0x36537c);})[_0x9b13('0x27')](function(_0x407c5a){_0x368990[_0x9b13('0x44')]=_0x407c5a;return _0x368990;});}})[_0x9b13('0x27')](respondWithFilteredResult(_0x2c7b0d,_0x36537c))[_0x9b13('0x45')](handleError(_0x2c7b0d,null));};exports[_0x9b13('0x5d')]=function(_0x122ebf,_0x257961,_0x24edc2){var _0x2a4a4a={'raw':!![],'where':{}};var _0x4d8594={};var _0x293400={'count':0x0,'rows':[]};return db[_0x9b13('0x2d')][_0x9b13('0x5b')]({'where':{'id':_0x122ebf['params']['id']}})[_0x9b13('0x27')](handleEntityNotFound(_0x257961,null))['then'](function(_0x1e40c4){if(_0x1e40c4){_0x4d8594[_0x9b13('0x30')]=_[_0x9b13('0x32')](db['JscriptyAnswerReport'][_0x9b13('0x48')]);_0x4d8594['query']=_[_0x9b13('0x32')](_0x122ebf['query']);_0x4d8594['filters']=_['intersection'](_0x4d8594['model'],_0x4d8594[_0x9b13('0x33')]);_0x2a4a4a[_0x9b13('0x35')]=_['intersection'](_0x4d8594['model'],qs[_0x9b13('0x36')](_0x122ebf[_0x9b13('0x33')][_0x9b13('0x36')]));_0x2a4a4a[_0x9b13('0x35')]=_0x2a4a4a['attributes'][_0x9b13('0x37')]?_0x2a4a4a['attributes']:_0x4d8594[_0x9b13('0x30')];if(!_0x122ebf[_0x9b13('0x33')][_0x9b13('0x38')](_0x9b13('0x39'))){_0x2a4a4a[_0x9b13('0x1f')]=qs[_0x9b13('0x1f')](_0x122ebf[_0x9b13('0x33')][_0x9b13('0x1f')]);_0x2a4a4a[_0x9b13('0x1d')]=qs['offset'](_0x122ebf['query']['offset']);}_0x2a4a4a[_0x9b13('0x3a')]=qs[_0x9b13('0x3b')](_0x122ebf['query']['sort']);_0x2a4a4a[_0x9b13('0x3c')]=qs[_0x9b13('0x3d')](_[_0x9b13('0x5e')](_0x122ebf[_0x9b13('0x33')],_0x4d8594[_0x9b13('0x3d')]));_0x2a4a4a[_0x9b13('0x3c')][_0x9b13('0x5f')]=_0x1e40c4['id'];if(_0x122ebf[_0x9b13('0x33')]['filter']){_0x2a4a4a['where']=_[_0x9b13('0x3f')](_0x2a4a4a[_0x9b13('0x3c')],{'$or':_['map'](_0x2a4a4a[_0x9b13('0x35')],function(_0x167ec){var _0x2a9c0b={};_0x2a9c0b[_0x167ec]={'$like':'%'+_0x122ebf[_0x9b13('0x33')]['filter']+'%'};return _0x2a9c0b;})});}_0x2a4a4a=_[_0x9b13('0x3f')]({},_0x2a4a4a,_0x122ebf[_0x9b13('0x41')]);return db[_0x9b13('0x60')]['count']({'where':_0x2a4a4a[_0x9b13('0x3c')]})[_0x9b13('0x27')](function(_0x272cc7){_0x293400[_0x9b13('0x20')]=_0x272cc7;if(_0x122ebf[_0x9b13('0x33')][_0x9b13('0x42')]){_0x2a4a4a[_0x9b13('0x56')]=[{'all':!![]}];}return db[_0x9b13('0x60')][_0x9b13('0x43')](_0x2a4a4a);})[_0x9b13('0x27')](function(_0x1b2511){_0x293400[_0x9b13('0x44')]=_0x1b2511;return _0x293400;});}})[_0x9b13('0x27')](respondWithFilteredResult(_0x257961,_0x2a4a4a))[_0x9b13('0x45')](handleError(_0x257961,null));};function char(_0x61beb1){return _0x9b13('0x61')===typeof _0x61beb1?String['fromCharCode']['apply'](null,arguments):_0x61beb1;}function needsEncapsulation(_0x29532a){return!!_0x29532a&&(_0x29532a[_0x9b13('0x62')]()[_0x9b13('0x63')](char(0xd))>=0x0||_0x29532a[_0x9b13('0x62')]()[_0x9b13('0x63')](char(0xa))>=0x0||_0x29532a[_0x9b13('0x62')]()[_0x9b13('0x63')](char(0x2c))>=0x0||_0x29532a[_0x9b13('0x62')]()[_0x9b13('0x63')](char(0x22))>=0x0);}function encapsulate(_0x1b087c){var _0x10c02c=char(0x22),_0x21322e='\x5c'+char(0x22),_0xefeac8=_0x1b087c['toString']()[_0x9b13('0x64')](new RegExp(_0x10c02c,'g'),_0x21322e);return _0x10c02c+_0xefeac8+_0x10c02c;}exports['getSummary']=function(_0x13e318,_0x43d559,_0x49fa31){var _0x2caa67,_0x2c342e;var _0x39cf12={'where':{'ProjectId':_0x13e318[_0x9b13('0x47')]['id']}};if(_0x13e318[_0x9b13('0x33')][_0x9b13('0x65')]){_0x39cf12['where'][_0x9b13('0x66')]=JSON[_0x9b13('0x67')](_0x13e318[_0x9b13('0x33')][_0x9b13('0x65')]);}return db[_0x9b13('0x5c')][_0x9b13('0x43')](_0x39cf12)[_0x9b13('0x27')](handleEntityNotFound(_0x43d559,null))[_0x9b13('0x27')](function(_0x3c3726){if(_0x3c3726){_0x2caa67=_0x3c3726;return db[_0x9b13('0x68')]['findAll']({'where':{'SessionId':{'$in':_['map'](_0x2caa67,'id')},'ProjectId':_0x13e318[_0x9b13('0x47')]['id']},'order':_0x9b13('0x69')});}})[_0x9b13('0x27')](handleEntityNotFound(_0x43d559,null))['then'](function(_0xc0e1bb){if(_0xc0e1bb){_0x2c342e=_0xc0e1bb;var _0x1da647={};for(var _0x1ffc24=0x0,_0x1239ee=_0x2c342e[_0x9b13('0x37')];_0x1ffc24<_0x1239ee;_0x1ffc24++){if(!_0x1da647['hasOwnProperty'](_0x2c342e[_0x1ffc24][_0x9b13('0x6a')])){_0x1da647[_0x2c342e[_0x1ffc24][_0x9b13('0x6a')]]=needsEncapsulation(_0x2c342e[_0x1ffc24][_0x9b13('0x6b')])?encapsulate(_0x2c342e[_0x1ffc24][_0x9b13('0x6b')]):_0x2c342e[_0x1ffc24][_0x9b13('0x6b')];}}var _0x59d0fd=[],_0x185082={};for(var _0x4b10e0=0x0,_0x52d1ee=_0x2caa67[_0x9b13('0x37')];_0x4b10e0<_0x52d1ee;_0x4b10e0++){_0x185082={'ProjectId':_0x13e318['params']['id'],'SessionId':_0x2caa67[_0x4b10e0]['id'],'StartTime':moment(_0x2caa67[_0x4b10e0][_0x9b13('0x66')])['format'](_0x9b13('0x6c'))};for(var _0x2aae31=0x0,_0x4e9aa5=_0x2c342e[_0x9b13('0x37')];_0x2aae31<_0x4e9aa5;_0x2aae31++){if(_0x2c342e[_0x2aae31][_0x9b13('0x6d')]==_0x2caa67[_0x4b10e0]['id']&&_0x1da647[_0x9b13('0x38')](_0x2c342e[_0x2aae31][_0x9b13('0x6a')])){_0x185082[_0x1da647[_0x2c342e[_0x2aae31]['questionId']]]=_0x2c342e[_0x2aae31][_0x9b13('0x6e')];}}for(var _0x490897 in _0x1da647){if(!_0x185082[_0x9b13('0x38')](_0x1da647[_0x490897])){_0x185082[_0x1da647[_0x490897]]=null;}}_0x59d0fd[_0x9b13('0x6f')](_0x185082);}return _0x59d0fd;}})['then'](function(_0x1ad546){if(!_[_0x9b13('0x70')](_0x1ad546)){var _0x1bfd64=toCsv(_0x1ad546);var _0x18b191=Date[_0x9b13('0x71')]();fs[_0x9b13('0x72')](util[_0x9b13('0x73')](_0x9b13('0x74'),_0x13e318[_0x9b13('0x47')]['id'],_0x18b191),_0x1bfd64);_0x43d559[_0x9b13('0x75')](_0x9b13('0x76'),_0x9b13('0x77')+util['format'](_0x9b13('0x78'),_0x13e318['params']['id'],_0x18b191));_0x43d559[_0x9b13('0x75')](_0x9b13('0x79'),'text/csv');return _0x43d559[_0x9b13('0x7a')](util[_0x9b13('0x73')](_0x9b13('0x74'),_0x13e318[_0x9b13('0x47')]['id'],_0x18b191));}else{return _0x43d559[_0x9b13('0x1a')](0xcc);}})[_0x9b13('0x45')](handleError(_0x43d559,null));}; \ No newline at end of file +var _0xcbcd=['Content-Range','apply','reject','update','then','destroy','get','Projects','error','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','clone','fields','omit','createdAt','updatedAt','userProfileId','findOne','ProjectId','JscriptySessionReport','findAll','getAnswers','JscriptyAnswerReport','nolimit','pick','toString','indexOf','replace','getSummary','startTime','starttime','parse','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0xcbcd,0x1bb));var _0xdcbc=function(_0x1ca890,_0x21d0d3){_0x1ca890=_0x1ca890-0x0;var _0x3f8e01=_0xcbcd[_0x1ca890];return _0x3f8e01;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdcbc('0x0'));var zipdir=require(_0xdcbc('0x1'));var jsonpatch=require(_0xdcbc('0x2'));var rp=require(_0xdcbc('0x3'));var moment=require(_0xdcbc('0x4'));var BPromise=require(_0xdcbc('0x5'));var Mustache=require('mustache');var util=require(_0xdcbc('0x6'));var path=require(_0xdcbc('0x7'));var sox=require(_0xdcbc('0x8'));var csv=require(_0xdcbc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdcbc('0xa'));var _=require(_0xdcbc('0xb'));var squel=require('squel');var crypto=require(_0xdcbc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdcbc('0xd'));var toCsv=require(_0xdcbc('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdcbc('0xe'));var authService=require(_0xdcbc('0xf'));var qs=require(_0xdcbc('0x10'));var as=require(_0xdcbc('0x11'));var hardwareService=require(_0xdcbc('0x12'));var logger=require(_0xdcbc('0x13'))(_0xdcbc('0x14'));var utils=require(_0xdcbc('0x15'));var config=require(_0xdcbc('0x16'));var licenseUtil=require(_0xdcbc('0x17'));var db=require(_0xdcbc('0x18'))['db'];function respondWithStatusCode(_0x9791d2,_0x1c8246){_0x1c8246=_0x1c8246||0xcc;return function(_0x5f0a86){if(_0x5f0a86){return _0x9791d2[_0xdcbc('0x19')](_0x1c8246);}return _0x9791d2[_0xdcbc('0x1a')](_0x1c8246)[_0xdcbc('0x1b')]();};}function respondWithResult(_0x1df334,_0x43db4d){_0x43db4d=_0x43db4d||0xc8;return function(_0x541ee7){if(_0x541ee7){return _0x1df334[_0xdcbc('0x1a')](_0x43db4d)[_0xdcbc('0x1c')](_0x541ee7);}};}function respondWithFilteredResult(_0x332753,_0x3f48aa){return function(_0x20c12b){if(_0x20c12b){var _0x37155f=typeof _0x3f48aa[_0xdcbc('0x1d')]===_0xdcbc('0x1e')&&typeof _0x3f48aa['limit']===_0xdcbc('0x1e');var _0x5b21fb=_0x20c12b['count'];var _0x2dc69c=_0x37155f?0x0:_0x3f48aa['offset'];var _0x8a2197=_0x37155f?_0x20c12b[_0xdcbc('0x1f')]:_0x3f48aa[_0xdcbc('0x1d')]+_0x3f48aa[_0xdcbc('0x20')];var _0x26dc7b;if(_0x8a2197>=_0x5b21fb){_0x8a2197=_0x5b21fb;_0x26dc7b=0xc8;}else{_0x26dc7b=0xce;}_0x332753[_0xdcbc('0x1a')](_0x26dc7b);return _0x332753['set'](_0xdcbc('0x21'),_0x2dc69c+'-'+_0x8a2197+'/'+_0x5b21fb)[_0xdcbc('0x1c')](_0x20c12b);}return null;};}function patchUpdates(_0x12e818){return function(_0x220718){try{jsonpatch[_0xdcbc('0x22')](_0x220718,_0x12e818,!![]);}catch(_0x321316){return BPromise[_0xdcbc('0x23')](_0x321316);}return _0x220718['save']();};}function saveUpdates(_0x1cc8db,_0x826c1b){return function(_0x2ac39b){if(_0x2ac39b){return _0x2ac39b[_0xdcbc('0x24')](_0x1cc8db)[_0xdcbc('0x25')](function(_0x4ce2cd){return _0x4ce2cd;});}return null;};}function removeEntity(_0x30cb5a,_0x25b732){return function(_0x38426f){if(_0x38426f){return _0x38426f[_0xdcbc('0x26')]()[_0xdcbc('0x25')](function(){var _0x11c3e3=_0x38426f[_0xdcbc('0x27')]({'plain':!![]});var _0x1893f6=_0xdcbc('0x28');return db['UserProfileResource'][_0xdcbc('0x26')]({'where':{'type':_0x1893f6,'resourceId':_0x11c3e3['id']}})[_0xdcbc('0x25')](function(){return _0x38426f;});})[_0xdcbc('0x25')](function(){_0x30cb5a[_0xdcbc('0x1a')](0xcc)[_0xdcbc('0x1b')]();});}};}function handleEntityNotFound(_0x4232b6,_0xa709b9){return function(_0x26e35e){if(!_0x26e35e){_0x4232b6['sendStatus'](0x194);}return _0x26e35e;};}function handleError(_0x4a1ad2,_0x2da30b){_0x2da30b=_0x2da30b||0x1f4;return function(_0x3da22b){logger[_0xdcbc('0x29')](_0x3da22b['stack']);if(_0x3da22b[_0xdcbc('0x2a')]){delete _0x3da22b[_0xdcbc('0x2a')];}_0x4a1ad2['status'](_0x2da30b)[_0xdcbc('0x2b')](_0x3da22b);};}exports[_0xdcbc('0x2c')]=function(_0xcf5cfb,_0x1d35ea){var _0xbfb583={},_0x39094d={},_0x21104b={'count':0x0,'rows':[]};var _0x432e1f=_[_0xdcbc('0x2d')](db[_0xdcbc('0x2e')][_0xdcbc('0x2f')],function(_0x5c1964){return{'name':_0x5c1964[_0xdcbc('0x30')],'type':_0x5c1964[_0xdcbc('0x31')][_0xdcbc('0x32')]};});_0x39094d[_0xdcbc('0x33')]=_[_0xdcbc('0x2d')](_0x432e1f,'name');_0x39094d[_0xdcbc('0x34')]=_[_0xdcbc('0x35')](_0xcf5cfb['query']);_0x39094d[_0xdcbc('0x36')]=_[_0xdcbc('0x37')](_0x39094d[_0xdcbc('0x33')],_0x39094d['query']);_0xbfb583[_0xdcbc('0x38')]=_[_0xdcbc('0x37')](_0x39094d[_0xdcbc('0x33')],qs['fields'](_0xcf5cfb[_0xdcbc('0x34')]['fields']));_0xbfb583[_0xdcbc('0x38')]=_0xbfb583[_0xdcbc('0x38')][_0xdcbc('0x39')]?_0xbfb583['attributes']:_0x39094d[_0xdcbc('0x33')];if(!_0xcf5cfb['query'][_0xdcbc('0x3a')]('nolimit')){_0xbfb583[_0xdcbc('0x20')]=qs[_0xdcbc('0x20')](_0xcf5cfb[_0xdcbc('0x34')]['limit']);_0xbfb583[_0xdcbc('0x1d')]=qs['offset'](_0xcf5cfb['query'][_0xdcbc('0x1d')]);}_0xbfb583[_0xdcbc('0x3b')]=qs[_0xdcbc('0x3c')](_0xcf5cfb[_0xdcbc('0x34')][_0xdcbc('0x3c')]);_0xbfb583[_0xdcbc('0x3d')]=qs['filters'](_['pick'](_0xcf5cfb['query'],_0x39094d[_0xdcbc('0x36')]),_0x432e1f);if(_0xcf5cfb[_0xdcbc('0x34')][_0xdcbc('0x3e')]){_0xbfb583[_0xdcbc('0x3d')]=_[_0xdcbc('0x3f')](_0xbfb583[_0xdcbc('0x3d')],{'$or':_[_0xdcbc('0x2d')](_0x432e1f,function(_0x5e115c){if(_0x5e115c[_0xdcbc('0x31')]!==_0xdcbc('0x40')){var _0x2cdb82={};_0x2cdb82[_0x5e115c[_0xdcbc('0x2a')]]={'$like':'%'+_0xcf5cfb['query'][_0xdcbc('0x3e')]+'%'};return _0x2cdb82;}})});}_0xbfb583=_[_0xdcbc('0x3f')]({},_0xbfb583,_0xcf5cfb[_0xdcbc('0x41')]);var _0x2a3b7c={'where':_0xbfb583['where']};return db[_0xdcbc('0x2e')]['count'](_0x2a3b7c)[_0xdcbc('0x25')](function(_0x4d683a){_0x21104b[_0xdcbc('0x1f')]=_0x4d683a;if(_0xcf5cfb['query'][_0xdcbc('0x42')]){_0xbfb583[_0xdcbc('0x43')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0xbfb583);})[_0xdcbc('0x25')](function(_0x165610){_0x21104b[_0xdcbc('0x44')]=_0x165610;return _0x21104b;})['then'](respondWithFilteredResult(_0x1d35ea,_0xbfb583))[_0xdcbc('0x45')](handleError(_0x1d35ea,null));};exports['show']=function(_0x5b2fa4,_0x29c7e9){var _0x52763d={'raw':![],'where':{'id':_0x5b2fa4[_0xdcbc('0x46')]['id']}},_0x480970={};_0x480970['model']=_['keys'](db['JscriptyProject'][_0xdcbc('0x2f')]);_0x480970[_0xdcbc('0x34')]=_[_0xdcbc('0x35')](_0x5b2fa4[_0xdcbc('0x34')]);_0x480970[_0xdcbc('0x36')]=_[_0xdcbc('0x37')](_0x480970[_0xdcbc('0x33')],_0x480970[_0xdcbc('0x34')]);_0x52763d['attributes']=_[_0xdcbc('0x37')](_0x480970['model'],qs['fields'](_0x5b2fa4[_0xdcbc('0x34')]['fields']));_0x52763d[_0xdcbc('0x38')]=_0x52763d['attributes'][_0xdcbc('0x39')]?_0x52763d[_0xdcbc('0x38')]:_0x480970[_0xdcbc('0x33')];if(_0x5b2fa4[_0xdcbc('0x34')][_0xdcbc('0x42')]){_0x52763d[_0xdcbc('0x43')]=[{'all':!![]}];}_0x52763d=_[_0xdcbc('0x3f')]({},_0x52763d,_0x5b2fa4[_0xdcbc('0x41')]);return db[_0xdcbc('0x2e')][_0xdcbc('0x47')](_0x52763d)[_0xdcbc('0x25')](handleEntityNotFound(_0x29c7e9,null))[_0xdcbc('0x25')](respondWithResult(_0x29c7e9,null))['catch'](handleError(_0x29c7e9,null));};exports[_0xdcbc('0x48')]=function(_0xdd7402,_0x10b529){return db[_0xdcbc('0x2e')][_0xdcbc('0x48')](_0xdd7402[_0xdcbc('0x49')],{})[_0xdcbc('0x25')](function(_0x147feb){var _0x2375e6=_0xdd7402[_0xdcbc('0x4a')][_0xdcbc('0x27')]({'plain':!![]});if(!_0x2375e6)throw new Error(_0xdcbc('0x4b'));if(_0x2375e6[_0xdcbc('0x4c')]===_0xdcbc('0x4a')){var _0x6b94ba=_0x147feb['get']({'plain':!![]});var _0x121a39='Projects';return db[_0xdcbc('0x4d')][_0xdcbc('0x47')]({'where':{'name':_0x121a39,'userProfileId':_0x2375e6['userProfileId']},'raw':!![]})[_0xdcbc('0x25')](function(_0x340598){if(_0x340598&&_0x340598[_0xdcbc('0x4e')]===0x0){return db[_0xdcbc('0x4f')]['create']({'name':_0x6b94ba['name'],'resourceId':_0x6b94ba['id'],'type':_0x340598[_0xdcbc('0x2a')],'sectionId':_0x340598['id']},{})['then'](function(){return _0x147feb;});}else{return _0x147feb;}})[_0xdcbc('0x45')](function(_0x2ab86f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ab86f);throw _0x2ab86f;});}return _0x147feb;})[_0xdcbc('0x25')](respondWithResult(_0x10b529,0xc9))[_0xdcbc('0x45')](handleError(_0x10b529,null));};exports[_0xdcbc('0x50')]=function(_0x7d05d3,_0x40181f){var _0x28ac13={'where':{'id':_0x7d05d3[_0xdcbc('0x46')]['id']}},_0x2e7bc9={};_0x2e7bc9[_0xdcbc('0x33')]=_[_0xdcbc('0x35')](db['JscriptyProject'][_0xdcbc('0x2f')]);_0x28ac13[_0xdcbc('0x38')]=_[_0xdcbc('0x37')](_0x2e7bc9[_0xdcbc('0x33')],qs[_0xdcbc('0x51')](_0x7d05d3[_0xdcbc('0x34')][_0xdcbc('0x51')]));_0x28ac13[_0xdcbc('0x38')]=_0x28ac13['attributes'][_0xdcbc('0x39')]?_0x28ac13[_0xdcbc('0x38')]:_0x2e7bc9[_0xdcbc('0x33')];if(_0x7d05d3[_0xdcbc('0x34')][_0xdcbc('0x42')]){_0x28ac13[_0xdcbc('0x43')]=[{'all':!![]}];}_0x28ac13=_[_0xdcbc('0x3f')]({},_0x28ac13,_0x7d05d3[_0xdcbc('0x41')]);return db[_0xdcbc('0x2e')][_0xdcbc('0x47')](_0x28ac13)[_0xdcbc('0x25')](handleEntityNotFound(_0x40181f,null))[_0xdcbc('0x25')](function(_0x39e5d7){if(_0x39e5d7){var _0x35b858=_0x39e5d7[_0xdcbc('0x27')]({'plain':!![]});_0x35b858=qs[_0xdcbc('0x52')](_0x35b858,['id',_0xdcbc('0x53'),_0xdcbc('0x54')]);_0x7d05d3[_0xdcbc('0x49')]=_[_0xdcbc('0x52')](_0x7d05d3[_0xdcbc('0x49')],['id',_0xdcbc('0x53'),_0xdcbc('0x54')]);return db[_0xdcbc('0x2e')][_0xdcbc('0x48')](_[_0xdcbc('0x3f')](_0x35b858,_0x7d05d3[_0xdcbc('0x49')]),{'include':_0x7d05d3[_0xdcbc('0x34')][_0xdcbc('0x42')]?[{'all':!![]}]:undefined})[_0xdcbc('0x25')](function(_0x514375){var _0x1b79de=_0x7d05d3[_0xdcbc('0x4a')][_0xdcbc('0x27')]({'plain':!![]});if(!_0x1b79de)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b79de[_0xdcbc('0x4c')]===_0xdcbc('0x4a')){var _0x4b4498=_0x514375[_0xdcbc('0x27')]({'plain':!![]});var _0x37f468=_0xdcbc('0x28');return db[_0xdcbc('0x4d')][_0xdcbc('0x47')]({'where':{'name':_0x37f468,'userProfileId':_0x1b79de[_0xdcbc('0x55')]},'raw':!![]})[_0xdcbc('0x25')](function(_0x239d82){if(_0x239d82&&_0x239d82[_0xdcbc('0x4e')]===0x0){return db['UserProfileResource'][_0xdcbc('0x48')]({'name':_0x4b4498[_0xdcbc('0x2a')],'resourceId':_0x4b4498['id'],'type':_0x239d82['name'],'sectionId':_0x239d82['id']},{})['then'](function(){return _0x514375;});}else{return _0x514375;}})[_0xdcbc('0x45')](function(_0x40c8d9){logger[_0xdcbc('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40c8d9);throw _0x40c8d9;});}return _0x514375;});}})[_0xdcbc('0x25')](respondWithResult(_0x40181f,0xc9))[_0xdcbc('0x45')](handleError(_0x40181f,null));};exports[_0xdcbc('0x24')]=function(_0x10bc68,_0x548592){if(_0x10bc68[_0xdcbc('0x49')]['id']){delete _0x10bc68[_0xdcbc('0x49')]['id'];}return db[_0xdcbc('0x2e')][_0xdcbc('0x47')]({'where':{'id':_0x10bc68[_0xdcbc('0x46')]['id']}})[_0xdcbc('0x25')](handleEntityNotFound(_0x548592,null))['then'](saveUpdates(_0x10bc68[_0xdcbc('0x49')],null))[_0xdcbc('0x25')](respondWithResult(_0x548592,null))[_0xdcbc('0x45')](handleError(_0x548592,null));};exports[_0xdcbc('0x26')]=function(_0x31f0d5,_0x400bf7){return db['JscriptyProject'][_0xdcbc('0x47')]({'where':{'id':_0x31f0d5[_0xdcbc('0x46')]['id']}})[_0xdcbc('0x25')](handleEntityNotFound(_0x400bf7,null))[_0xdcbc('0x25')](removeEntity(_0x400bf7,null))[_0xdcbc('0x45')](handleError(_0x400bf7,null));};exports['getSessions']=function(_0xead3d2,_0x9a8be5,_0x1dbd26){var _0x234f31={'raw':!![],'where':{}};var _0x4211ee={};var _0x134029={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xdcbc('0x56')]({'where':{'id':_0xead3d2[_0xdcbc('0x46')]['id']}})[_0xdcbc('0x25')](handleEntityNotFound(_0x9a8be5,null))['then'](function(_0x519612){if(_0x519612){_0x4211ee['model']=_[_0xdcbc('0x35')](db['JscriptySessionReport'][_0xdcbc('0x2f')]);_0x4211ee[_0xdcbc('0x34')]=_[_0xdcbc('0x35')](_0xead3d2[_0xdcbc('0x34')]);_0x4211ee['filters']=_[_0xdcbc('0x37')](_0x4211ee['model'],_0x4211ee[_0xdcbc('0x34')]);_0x234f31[_0xdcbc('0x38')]=_['intersection'](_0x4211ee['model'],qs[_0xdcbc('0x51')](_0xead3d2['query'][_0xdcbc('0x51')]));_0x234f31[_0xdcbc('0x38')]=_0x234f31[_0xdcbc('0x38')][_0xdcbc('0x39')]?_0x234f31[_0xdcbc('0x38')]:_0x4211ee[_0xdcbc('0x33')];if(!_0xead3d2[_0xdcbc('0x34')][_0xdcbc('0x3a')]('nolimit')){_0x234f31[_0xdcbc('0x20')]=qs[_0xdcbc('0x20')](_0xead3d2['query'][_0xdcbc('0x20')]);_0x234f31[_0xdcbc('0x1d')]=qs[_0xdcbc('0x1d')](_0xead3d2[_0xdcbc('0x34')]['offset']);}_0x234f31[_0xdcbc('0x3b')]=qs[_0xdcbc('0x3c')](_0xead3d2[_0xdcbc('0x34')][_0xdcbc('0x3c')]);_0x234f31[_0xdcbc('0x3d')]=qs['filters'](_['pick'](_0xead3d2[_0xdcbc('0x34')],_0x4211ee['filters']));_0x234f31['where'][_0xdcbc('0x57')]=_0x519612['id'];if(_0xead3d2[_0xdcbc('0x34')][_0xdcbc('0x3e')]){_0x234f31[_0xdcbc('0x3d')]=_[_0xdcbc('0x3f')](_0x234f31[_0xdcbc('0x3d')],{'$or':_['map'](_0x234f31[_0xdcbc('0x38')],function(_0x3f2f18){var _0x9be060={};_0x9be060[_0x3f2f18]={'$like':'%'+_0xead3d2['query'][_0xdcbc('0x3e')]+'%'};return _0x9be060;})});}_0x234f31=_['merge']({},_0x234f31,_0xead3d2[_0xdcbc('0x41')]);return db['JscriptySessionReport']['count']({'where':_0x234f31[_0xdcbc('0x3d')]})['then'](function(_0x18174e){_0x134029[_0xdcbc('0x1f')]=_0x18174e;if(_0xead3d2[_0xdcbc('0x34')][_0xdcbc('0x42')]){_0x234f31[_0xdcbc('0x43')]=[{'all':!![]}];}return db[_0xdcbc('0x58')][_0xdcbc('0x59')](_0x234f31);})['then'](function(_0xed1d43){_0x134029[_0xdcbc('0x44')]=_0xed1d43;return _0x134029;});}})[_0xdcbc('0x25')](respondWithFilteredResult(_0x9a8be5,_0x234f31))[_0xdcbc('0x45')](handleError(_0x9a8be5,null));};exports[_0xdcbc('0x5a')]=function(_0x568963,_0x22ed09,_0x3d68ee){var _0x42ea5c={'raw':!![],'where':{}};var _0x15acf1={};var _0x1f738c={'count':0x0,'rows':[]};return db[_0xdcbc('0x2e')][_0xdcbc('0x56')]({'where':{'id':_0x568963[_0xdcbc('0x46')]['id']}})[_0xdcbc('0x25')](handleEntityNotFound(_0x22ed09,null))[_0xdcbc('0x25')](function(_0x4ddebc){if(_0x4ddebc){_0x15acf1[_0xdcbc('0x33')]=_[_0xdcbc('0x35')](db[_0xdcbc('0x5b')]['rawAttributes']);_0x15acf1['query']=_[_0xdcbc('0x35')](_0x568963[_0xdcbc('0x34')]);_0x15acf1[_0xdcbc('0x36')]=_[_0xdcbc('0x37')](_0x15acf1[_0xdcbc('0x33')],_0x15acf1[_0xdcbc('0x34')]);_0x42ea5c[_0xdcbc('0x38')]=_[_0xdcbc('0x37')](_0x15acf1[_0xdcbc('0x33')],qs['fields'](_0x568963['query'][_0xdcbc('0x51')]));_0x42ea5c['attributes']=_0x42ea5c[_0xdcbc('0x38')][_0xdcbc('0x39')]?_0x42ea5c[_0xdcbc('0x38')]:_0x15acf1['model'];if(!_0x568963[_0xdcbc('0x34')]['hasOwnProperty'](_0xdcbc('0x5c'))){_0x42ea5c[_0xdcbc('0x20')]=qs['limit'](_0x568963['query'][_0xdcbc('0x20')]);_0x42ea5c[_0xdcbc('0x1d')]=qs[_0xdcbc('0x1d')](_0x568963[_0xdcbc('0x34')]['offset']);}_0x42ea5c[_0xdcbc('0x3b')]=qs[_0xdcbc('0x3c')](_0x568963[_0xdcbc('0x34')][_0xdcbc('0x3c')]);_0x42ea5c[_0xdcbc('0x3d')]=qs['filters'](_[_0xdcbc('0x5d')](_0x568963['query'],_0x15acf1['filters']));_0x42ea5c[_0xdcbc('0x3d')][_0xdcbc('0x57')]=_0x4ddebc['id'];if(_0x568963[_0xdcbc('0x34')][_0xdcbc('0x3e')]){_0x42ea5c[_0xdcbc('0x3d')]=_[_0xdcbc('0x3f')](_0x42ea5c[_0xdcbc('0x3d')],{'$or':_['map'](_0x42ea5c[_0xdcbc('0x38')],function(_0x4cd232){var _0x400830={};_0x400830[_0x4cd232]={'$like':'%'+_0x568963[_0xdcbc('0x34')]['filter']+'%'};return _0x400830;})});}_0x42ea5c=_[_0xdcbc('0x3f')]({},_0x42ea5c,_0x568963[_0xdcbc('0x41')]);return db[_0xdcbc('0x5b')][_0xdcbc('0x1f')]({'where':_0x42ea5c[_0xdcbc('0x3d')]})[_0xdcbc('0x25')](function(_0x1995dc){_0x1f738c[_0xdcbc('0x1f')]=_0x1995dc;if(_0x568963[_0xdcbc('0x34')]['includeAll']){_0x42ea5c['include']=[{'all':!![]}];}return db[_0xdcbc('0x5b')][_0xdcbc('0x59')](_0x42ea5c);})[_0xdcbc('0x25')](function(_0x996182){_0x1f738c[_0xdcbc('0x44')]=_0x996182;return _0x1f738c;});}})[_0xdcbc('0x25')](respondWithFilteredResult(_0x22ed09,_0x42ea5c))[_0xdcbc('0x45')](handleError(_0x22ed09,null));};function char(_0x187380){return'number'===typeof _0x187380?String['fromCharCode']['apply'](null,arguments):_0x187380;}function needsEncapsulation(_0x19b7d1){return!!_0x19b7d1&&(_0x19b7d1[_0xdcbc('0x5e')]()[_0xdcbc('0x5f')](char(0xd))>=0x0||_0x19b7d1['toString']()['indexOf'](char(0xa))>=0x0||_0x19b7d1['toString']()[_0xdcbc('0x5f')](char(0x2c))>=0x0||_0x19b7d1[_0xdcbc('0x5e')]()[_0xdcbc('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x3cfa3c){var _0x4fccd5=char(0x22),_0x49cc15='\x5c'+char(0x22),_0x2c993c=_0x3cfa3c[_0xdcbc('0x5e')]()[_0xdcbc('0x60')](new RegExp(_0x4fccd5,'g'),_0x49cc15);return _0x4fccd5+_0x2c993c+_0x4fccd5;}exports[_0xdcbc('0x61')]=function(_0x2975fd,_0x3dcb15,_0x4c8bf0){var _0x389941,_0x2faef5;var _0x534bb8={'where':{'ProjectId':_0x2975fd[_0xdcbc('0x46')]['id']}};if(_0x2975fd[_0xdcbc('0x34')][_0xdcbc('0x62')]){_0x534bb8[_0xdcbc('0x3d')][_0xdcbc('0x63')]=JSON[_0xdcbc('0x64')](_0x2975fd[_0xdcbc('0x34')]['startTime']);}return db[_0xdcbc('0x58')][_0xdcbc('0x59')](_0x534bb8)['then'](handleEntityNotFound(_0x3dcb15,null))[_0xdcbc('0x25')](function(_0x228f5d){if(_0x228f5d){_0x389941=_0x228f5d;return db['JscriptyQuestionReport'][_0xdcbc('0x59')]({'where':{'SessionId':{'$in':_[_0xdcbc('0x2d')](_0x389941,'id')},'ProjectId':_0x2975fd['params']['id']},'order':_0xdcbc('0x65')});}})[_0xdcbc('0x25')](handleEntityNotFound(_0x3dcb15,null))[_0xdcbc('0x25')](function(_0x526c76){if(_0x526c76){_0x2faef5=_0x526c76;var _0x575827={};for(var _0x1f3864=0x0,_0x47e167=_0x2faef5[_0xdcbc('0x39')];_0x1f3864<_0x47e167;_0x1f3864++){if(!_0x575827['hasOwnProperty'](_0x2faef5[_0x1f3864][_0xdcbc('0x66')])){_0x575827[_0x2faef5[_0x1f3864][_0xdcbc('0x66')]]=needsEncapsulation(_0x2faef5[_0x1f3864][_0xdcbc('0x67')])?encapsulate(_0x2faef5[_0x1f3864]['question']):_0x2faef5[_0x1f3864][_0xdcbc('0x67')];}}var _0x10983a=[],_0x3b058b={};for(var _0x590f36=0x0,_0x48912b=_0x389941[_0xdcbc('0x39')];_0x590f36<_0x48912b;_0x590f36++){_0x3b058b={'ProjectId':_0x2975fd[_0xdcbc('0x46')]['id'],'SessionId':_0x389941[_0x590f36]['id'],'StartTime':moment(_0x389941[_0x590f36][_0xdcbc('0x63')])['format'](_0xdcbc('0x68'))};for(var _0x534cd2=0x0,_0x1ab79b=_0x2faef5[_0xdcbc('0x39')];_0x534cd2<_0x1ab79b;_0x534cd2++){if(_0x2faef5[_0x534cd2]['SessionId']==_0x389941[_0x590f36]['id']&&_0x575827[_0xdcbc('0x3a')](_0x2faef5[_0x534cd2][_0xdcbc('0x66')])){_0x3b058b[_0x575827[_0x2faef5[_0x534cd2][_0xdcbc('0x66')]]]=_0x2faef5[_0x534cd2][_0xdcbc('0x69')];}}for(var _0x4e100c in _0x575827){if(!_0x3b058b[_0xdcbc('0x3a')](_0x575827[_0x4e100c])){_0x3b058b[_0x575827[_0x4e100c]]=null;}}_0x10983a[_0xdcbc('0x6a')](_0x3b058b);}return _0x10983a;}})['then'](function(_0x2bb62f){if(!_[_0xdcbc('0x6b')](_0x2bb62f)){var _0x394bf5=toCsv(_0x2bb62f);var _0x53fc05=Date[_0xdcbc('0x6c')]();fs[_0xdcbc('0x6d')](util[_0xdcbc('0x6e')](_0xdcbc('0x6f'),_0x2975fd[_0xdcbc('0x46')]['id'],_0x53fc05),_0x394bf5);_0x3dcb15[_0xdcbc('0x70')](_0xdcbc('0x71'),_0xdcbc('0x72')+util[_0xdcbc('0x6e')](_0xdcbc('0x73'),_0x2975fd[_0xdcbc('0x46')]['id'],_0x53fc05));_0x3dcb15[_0xdcbc('0x70')](_0xdcbc('0x74'),_0xdcbc('0x75'));return _0x3dcb15[_0xdcbc('0x76')](util[_0xdcbc('0x6e')](_0xdcbc('0x6f'),_0x2975fd['params']['id'],_0x53fc05));}else{return _0x3dcb15['sendStatus'](0xcc);}})['catch'](handleError(_0x3dcb15,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 060d1f3..5ff02ef 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 _0x4300=['bluebird','request-promise','path','rimraf','../../config/environment','exports','JscriptyProject','jscripty_projects','lodash'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x4300,0x1a6));var _0x0430=function(_0x1b0582,_0x3fa17d){_0x1b0582=_0x1b0582-0x0;var _0x3ce9a9=_0x4300[_0x1b0582];return _0x3ce9a9;};'use strict';var _=require(_0x0430('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0430('0x1'));var rp=require(_0x0430('0x2'));var fs=require('fs');var path=require(_0x0430('0x3'));var rimraf=require(_0x0430('0x4'));var config=require(_0x0430('0x5'));var attributes=require('./jscriptyProject.attributes');module[_0x0430('0x6')]=function(_0x5943c0,_0x16efe3){return _0x5943c0['define'](_0x0430('0x7'),attributes,{'tableName':_0x0430('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f75=['path','rimraf','../../config/environment','exports','JscriptyProject','jscripty_projects','lodash','../../config/logger','api','request-promise'];(function(_0x2cc8d5,_0x476dac){var _0x34d0fc=function(_0x5117cb){while(--_0x5117cb){_0x2cc8d5['push'](_0x2cc8d5['shift']());}};_0x34d0fc(++_0x476dac);}(_0x9f75,0x15a));var _0x59f7=function(_0x47b177,_0x6b59bc){_0x47b177=_0x47b177-0x0;var _0x59f80d=_0x9f75[_0x47b177];return _0x59f80d;};'use strict';var _=require(_0x59f7('0x0'));var util=require('util');var logger=require(_0x59f7('0x1'))(_0x59f7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x59f7('0x3'));var fs=require('fs');var path=require(_0x59f7('0x4'));var rimraf=require(_0x59f7('0x5'));var config=require(_0x59f7('0x6'));var attributes=require('./jscriptyProject.attributes');module[_0x59f7('0x7')]=function(_0x278f11,_0x5485fa){return _0x278f11['define'](_0x59f7('0x8'),attributes,{'tableName':_0x59f7('0x9'),'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 5e821b2..9bf0169 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 _0x0713=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2257bd,_0x55265f){var _0x49eedc=function(_0x3321d0){while(--_0x3321d0){_0x2257bd['push'](_0x2257bd['shift']());}};_0x49eedc(++_0x55265f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xb7e7=['JscriptyProject,\x20%s,\x20%s','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x262595,_0x5156a4){var _0x4a82d2=function(_0x2d2a77){while(--_0x2d2a77){_0x262595['push'](_0x262595['shift']());}};_0x4a82d2(++_0x5156a4);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0xb7e7[_0x3305de];return _0x3b5a84;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 792a2a1..a05477d 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 _0x7619=['/:id','put','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','describe'];(function(_0x2f02d4,_0x27b24a){var _0x4b707d=function(_0x52f3ba){while(--_0x52f3ba){_0x2f02d4['push'](_0x2f02d4['shift']());}};_0x4b707d(++_0x27b24a);}(_0x7619,0xb7));var _0x9761=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7619[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9761('0x0'));var util=require('util');var path=require(_0x9761('0x1'));var timeout=require(_0x9761('0x2'));var express=require(_0x9761('0x3'));var router=express[_0x9761('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9761('0x5'));var config=require(_0x9761('0x6'));var controller=require(_0x9761('0x7'));router[_0x9761('0x8')]('/',auth[_0x9761('0x9')](),controller[_0x9761('0xa')]);router[_0x9761('0x8')]('/describe',auth[_0x9761('0x9')](),controller[_0x9761('0xb')]);router[_0x9761('0x8')](_0x9761('0xc'),auth[_0x9761('0x9')](),controller['show']);router['post']('/',auth[_0x9761('0x9')](),controller['create']);router[_0x9761('0xd')](_0x9761('0xc'),auth[_0x9761('0x9')](),controller['update']);router['delete']('/:id',auth[_0x9761('0x9')](),controller['destroy']);module[_0x9761('0xe')]=router; \ No newline at end of file +var _0x6c71=['update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put'];(function(_0x510589,_0x391d46){var _0x43955f=function(_0x2a0baa){while(--_0x2a0baa){_0x510589['push'](_0x510589['shift']());}};_0x43955f(++_0x391d46);}(_0x6c71,0x11c));var _0x16c7=function(_0x33b153,_0x1438e3){_0x33b153=_0x33b153-0x0;var _0x4970a1=_0x6c71[_0x33b153];return _0x4970a1;};'use strict';var multer=require(_0x16c7('0x0'));var util=require('util');var path=require(_0x16c7('0x1'));var timeout=require(_0x16c7('0x2'));var express=require(_0x16c7('0x3'));var router=express['Router']();var fs_extra=require(_0x16c7('0x4'));var auth=require(_0x16c7('0x5'));var interaction=require(_0x16c7('0x6'));var config=require('../../config/environment');var controller=require(_0x16c7('0x7'));router[_0x16c7('0x8')]('/',auth[_0x16c7('0x9')](),controller[_0x16c7('0xa')]);router['get'](_0x16c7('0xb'),auth['isAuthenticated'](),controller[_0x16c7('0xc')]);router[_0x16c7('0x8')](_0x16c7('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x16c7('0xe')]('/',auth[_0x16c7('0x9')](),controller['create']);router[_0x16c7('0xf')](_0x16c7('0xd'),auth[_0x16c7('0x9')](),controller[_0x16c7('0x10')]);router[_0x16c7('0x11')](_0x16c7('0xd'),auth[_0x16c7('0x9')](),controller[_0x16c7('0x12')]);module[_0x16c7('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 77a6fcf..fe5a47c 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(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x7a54,0x106));var _0x47a5=function(_0x579c1a,_0x425fc2){_0x579c1a=_0x579c1a-0x0;var _0x117f03=_0x7a54[_0x579c1a];return _0x117f03;};'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(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x7a54,0x106));var _0x47a5=function(_0x204567,_0x3d110c){_0x204567=_0x204567-0x0;var _0x5b27c5=_0x7a54[_0x204567];return _0x5b27c5;};'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 539ee77..ff76b91 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 _0x6be3=['limit','count','offset','set','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','map','JscriptyQuestionReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','show','includeAll','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined'];(function(_0x263d26,_0x23d7a1){var _0x15d290=function(_0x3a4c72){while(--_0x3a4c72){_0x263d26['push'](_0x263d26['shift']());}};_0x15d290(++_0x23d7a1);}(_0x6be3,0xca));var _0x36be=function(_0x379a70,_0x367de6){_0x379a70=_0x379a70-0x0;var _0x3ddaa4=_0x6be3[_0x379a70];return _0x3ddaa4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x36be('0x0'));var zipdir=require(_0x36be('0x1'));var jsonpatch=require(_0x36be('0x2'));var rp=require(_0x36be('0x3'));var moment=require('moment');var BPromise=require(_0x36be('0x4'));var Mustache=require(_0x36be('0x5'));var util=require(_0x36be('0x6'));var path=require(_0x36be('0x7'));var sox=require(_0x36be('0x8'));var csv=require(_0x36be('0x9'));var ejs=require(_0x36be('0xa'));var fs=require('fs');var fs_extra=require(_0x36be('0xb'));var _=require(_0x36be('0xc'));var squel=require('squel');var crypto=require(_0x36be('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x36be('0xe'));var toCsv=require(_0x36be('0x9'));var querystring=require('querystring');var Papa=require(_0x36be('0xf'));var Redis=require(_0x36be('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x36be('0x11'));var as=require(_0x36be('0x12'));var hardwareService=require(_0x36be('0x13'));var logger=require(_0x36be('0x14'))(_0x36be('0x15'));var utils=require(_0x36be('0x16'));var config=require(_0x36be('0x17'));var licenseUtil=require(_0x36be('0x18'));var db=require(_0x36be('0x19'))['db'];function respondWithStatusCode(_0x438276,_0x48c151){_0x48c151=_0x48c151||0xcc;return function(_0x568a25){if(_0x568a25){return _0x438276['sendStatus'](_0x48c151);}return _0x438276[_0x36be('0x1a')](_0x48c151)['end']();};}function respondWithResult(_0x107713,_0x11676f){_0x11676f=_0x11676f||0xc8;return function(_0x5c68f0){if(_0x5c68f0){return _0x107713['status'](_0x11676f)[_0x36be('0x1b')](_0x5c68f0);}};}function respondWithFilteredResult(_0x28b907,_0x45d6d5){return function(_0xfc8021){if(_0xfc8021){var _0x530b78=typeof _0x45d6d5['offset']===_0x36be('0x1c')&&typeof _0x45d6d5[_0x36be('0x1d')]===_0x36be('0x1c');var _0x5d16ad=_0xfc8021[_0x36be('0x1e')];var _0x1f1fef=_0x530b78?0x0:_0x45d6d5['offset'];var _0x4b20d5=_0x530b78?_0xfc8021[_0x36be('0x1e')]:_0x45d6d5[_0x36be('0x1f')]+_0x45d6d5[_0x36be('0x1d')];var _0x17937e;if(_0x4b20d5>=_0x5d16ad){_0x4b20d5=_0x5d16ad;_0x17937e=0xc8;}else{_0x17937e=0xce;}_0x28b907['status'](_0x17937e);return _0x28b907[_0x36be('0x20')]('Content-Range',_0x1f1fef+'-'+_0x4b20d5+'/'+_0x5d16ad)[_0x36be('0x1b')](_0xfc8021);}return null;};}function patchUpdates(_0x4279db){return function(_0x25db65){try{jsonpatch[_0x36be('0x21')](_0x25db65,_0x4279db,!![]);}catch(_0x57260c){return BPromise[_0x36be('0x22')](_0x57260c);}return _0x25db65[_0x36be('0x23')]();};}function saveUpdates(_0x5bd1a6,_0x5764c4){return function(_0x2a05ef){if(_0x2a05ef){return _0x2a05ef[_0x36be('0x24')](_0x5bd1a6)[_0x36be('0x25')](function(_0x2d9056){return _0x2d9056;});}return null;};}function removeEntity(_0x4b6212,_0x27b1cd){return function(_0x3d12ab){if(_0x3d12ab){return _0x3d12ab[_0x36be('0x26')]()[_0x36be('0x25')](function(){_0x4b6212[_0x36be('0x1a')](0xcc)[_0x36be('0x27')]();});}};}function handleEntityNotFound(_0x1ed24c,_0x34d28e){return function(_0x42888e){if(!_0x42888e){_0x1ed24c[_0x36be('0x28')](0x194);}return _0x42888e;};}function handleError(_0x3f64b2,_0x28761c){_0x28761c=_0x28761c||0x1f4;return function(_0x1aab1b){logger[_0x36be('0x29')](_0x1aab1b['stack']);if(_0x1aab1b[_0x36be('0x2a')]){delete _0x1aab1b[_0x36be('0x2a')];}_0x3f64b2[_0x36be('0x1a')](_0x28761c)[_0x36be('0x2b')](_0x1aab1b);};}exports[_0x36be('0x2c')]=function(_0x15d187,_0x73b621){var _0x6de54a={},_0x15abcf={},_0x4dfbdd={'count':0x0,'rows':[]};var _0x1434c8=_[_0x36be('0x2d')](db[_0x36be('0x2e')][_0x36be('0x2f')],function(_0x50a4e7){return{'name':_0x50a4e7['fieldName'],'type':_0x50a4e7['type'][_0x36be('0x30')]};});_0x15abcf[_0x36be('0x31')]=_[_0x36be('0x2d')](_0x1434c8,_0x36be('0x2a'));_0x15abcf[_0x36be('0x32')]=_[_0x36be('0x33')](_0x15d187['query']);_0x15abcf[_0x36be('0x34')]=_[_0x36be('0x35')](_0x15abcf[_0x36be('0x31')],_0x15abcf[_0x36be('0x32')]);_0x6de54a[_0x36be('0x36')]=_['intersection'](_0x15abcf[_0x36be('0x31')],qs[_0x36be('0x37')](_0x15d187[_0x36be('0x32')][_0x36be('0x37')]));_0x6de54a[_0x36be('0x36')]=_0x6de54a[_0x36be('0x36')][_0x36be('0x38')]?_0x6de54a[_0x36be('0x36')]:_0x15abcf[_0x36be('0x31')];if(!_0x15d187[_0x36be('0x32')]['hasOwnProperty'](_0x36be('0x39'))){_0x6de54a[_0x36be('0x1d')]=qs[_0x36be('0x1d')](_0x15d187[_0x36be('0x32')][_0x36be('0x1d')]);_0x6de54a[_0x36be('0x1f')]=qs['offset'](_0x15d187['query']['offset']);}_0x6de54a[_0x36be('0x3a')]=qs['sort'](_0x15d187['query'][_0x36be('0x3b')]);_0x6de54a[_0x36be('0x3c')]=qs[_0x36be('0x34')](_[_0x36be('0x3d')](_0x15d187[_0x36be('0x32')],_0x15abcf[_0x36be('0x34')]),_0x1434c8);if(_0x15d187[_0x36be('0x32')][_0x36be('0x3e')]){_0x6de54a[_0x36be('0x3c')]=_[_0x36be('0x3f')](_0x6de54a[_0x36be('0x3c')],{'$or':_[_0x36be('0x2d')](_0x1434c8,function(_0x1314ff){if(_0x1314ff[_0x36be('0x40')]!==_0x36be('0x41')){var _0x265ad6={};_0x265ad6[_0x1314ff[_0x36be('0x2a')]]={'$like':'%'+_0x15d187[_0x36be('0x32')][_0x36be('0x3e')]+'%'};return _0x265ad6;}})});}_0x6de54a=_['merge']({},_0x6de54a,_0x15d187[_0x36be('0x42')]);var _0x24b597={'where':_0x6de54a[_0x36be('0x3c')]};return db[_0x36be('0x2e')][_0x36be('0x1e')](_0x24b597)['then'](function(_0x6bd448){_0x4dfbdd[_0x36be('0x1e')]=_0x6bd448;if(_0x15d187[_0x36be('0x32')]['includeAll']){_0x6de54a[_0x36be('0x43')]=[{'all':!![]}];}return db[_0x36be('0x2e')][_0x36be('0x44')](_0x6de54a);})[_0x36be('0x25')](function(_0x1ae2f1){_0x4dfbdd['rows']=_0x1ae2f1;return _0x4dfbdd;})[_0x36be('0x25')](respondWithFilteredResult(_0x73b621,_0x6de54a))[_0x36be('0x45')](handleError(_0x73b621,null));};exports[_0x36be('0x46')]=function(_0x4ed1dc,_0x159a5f){var _0x156fed={'raw':!![],'where':{'id':_0x4ed1dc['params']['id']}},_0x466969={};_0x466969[_0x36be('0x31')]=_[_0x36be('0x33')](db['JscriptyQuestionReport'][_0x36be('0x2f')]);_0x466969[_0x36be('0x32')]=_[_0x36be('0x33')](_0x4ed1dc[_0x36be('0x32')]);_0x466969[_0x36be('0x34')]=_[_0x36be('0x35')](_0x466969[_0x36be('0x31')],_0x466969[_0x36be('0x32')]);_0x156fed[_0x36be('0x36')]=_[_0x36be('0x35')](_0x466969[_0x36be('0x31')],qs['fields'](_0x4ed1dc[_0x36be('0x32')]['fields']));_0x156fed[_0x36be('0x36')]=_0x156fed['attributes'][_0x36be('0x38')]?_0x156fed[_0x36be('0x36')]:_0x466969['model'];if(_0x4ed1dc['query'][_0x36be('0x47')]){_0x156fed['include']=[{'all':!![]}];}_0x156fed=_['merge']({},_0x156fed,_0x4ed1dc[_0x36be('0x42')]);return db[_0x36be('0x2e')]['find'](_0x156fed)[_0x36be('0x25')](handleEntityNotFound(_0x159a5f,null))[_0x36be('0x25')](respondWithResult(_0x159a5f,null))[_0x36be('0x45')](handleError(_0x159a5f,null));};exports[_0x36be('0x48')]=function(_0x5f5ad9,_0x25ba5e){return db[_0x36be('0x2e')][_0x36be('0x48')](_0x5f5ad9[_0x36be('0x49')],{})['then'](respondWithResult(_0x25ba5e,0xc9))[_0x36be('0x45')](handleError(_0x25ba5e,null));};exports[_0x36be('0x24')]=function(_0x4d058e,_0x2ae476){if(_0x4d058e[_0x36be('0x49')]['id']){delete _0x4d058e[_0x36be('0x49')]['id'];}return db[_0x36be('0x2e')][_0x36be('0x4a')]({'where':{'id':_0x4d058e[_0x36be('0x4b')]['id']}})[_0x36be('0x25')](handleEntityNotFound(_0x2ae476,null))[_0x36be('0x25')](saveUpdates(_0x4d058e[_0x36be('0x49')],null))[_0x36be('0x25')](respondWithResult(_0x2ae476,null))['catch'](handleError(_0x2ae476,null));};exports[_0x36be('0x26')]=function(_0x1bf78f,_0x45f094){return db['JscriptyQuestionReport'][_0x36be('0x4a')]({'where':{'id':_0x1bf78f['params']['id']}})[_0x36be('0x25')](handleEntityNotFound(_0x45f094,null))[_0x36be('0x25')](removeEntity(_0x45f094,null))[_0x36be('0x45')](handleError(_0x45f094,null));};exports[_0x36be('0x4c')]=function(_0x681308,_0x4630df){return db[_0x36be('0x2e')][_0x36be('0x4c')]()['then'](respondWithResult(_0x4630df,null))[_0x36be('0x45')](handleError(_0x4630df,null));}; \ No newline at end of file +var _0x1ba4=['JscriptyQuestionReport','fieldName','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','create','update','body','destroy','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','then','sendStatus','error','name','index','map'];(function(_0x32d436,_0x3dc378){var _0x12744=function(_0x12ed1b){while(--_0x12ed1b){_0x32d436['push'](_0x32d436['shift']());}};_0x12744(++_0x3dc378);}(_0x1ba4,0x1b1));var _0x41ba=function(_0x155719,_0x123b9d){_0x155719=_0x155719-0x0;var _0x41e840=_0x1ba4[_0x155719];return _0x41e840;};'use strict';var emlformat=require(_0x41ba('0x0'));var rimraf=require(_0x41ba('0x1'));var zipdir=require(_0x41ba('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x41ba('0x3'));var BPromise=require(_0x41ba('0x4'));var Mustache=require(_0x41ba('0x5'));var util=require(_0x41ba('0x6'));var path=require(_0x41ba('0x7'));var sox=require(_0x41ba('0x8'));var csv=require(_0x41ba('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x41ba('0xa'));var _=require(_0x41ba('0xb'));var squel=require('squel');var crypto=require(_0x41ba('0xc'));var jsforce=require(_0x41ba('0xd'));var deskjs=require(_0x41ba('0xe'));var toCsv=require('to-csv');var querystring=require(_0x41ba('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x41ba('0x10'));var qs=require(_0x41ba('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x41ba('0x12'));var utils=require(_0x41ba('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x41ba('0x14'))['db'];function respondWithStatusCode(_0x437615,_0x2603b9){_0x2603b9=_0x2603b9||0xcc;return function(_0x320de6){if(_0x320de6){return _0x437615['sendStatus'](_0x2603b9);}return _0x437615[_0x41ba('0x15')](_0x2603b9)[_0x41ba('0x16')]();};}function respondWithResult(_0x57e918,_0x140997){_0x140997=_0x140997||0xc8;return function(_0x559920){if(_0x559920){return _0x57e918[_0x41ba('0x15')](_0x140997)[_0x41ba('0x17')](_0x559920);}};}function respondWithFilteredResult(_0x28b3c8,_0x3e0c28){return function(_0x184253){if(_0x184253){var _0x59b823=typeof _0x3e0c28[_0x41ba('0x18')]==='undefined'&&typeof _0x3e0c28[_0x41ba('0x19')]==='undefined';var _0x3a292f=_0x184253[_0x41ba('0x1a')];var _0x2a0fc9=_0x59b823?0x0:_0x3e0c28[_0x41ba('0x18')];var _0x44117e=_0x59b823?_0x184253[_0x41ba('0x1a')]:_0x3e0c28[_0x41ba('0x18')]+_0x3e0c28[_0x41ba('0x19')];var _0x813bdd;if(_0x44117e>=_0x3a292f){_0x44117e=_0x3a292f;_0x813bdd=0xc8;}else{_0x813bdd=0xce;}_0x28b3c8[_0x41ba('0x15')](_0x813bdd);return _0x28b3c8[_0x41ba('0x1b')](_0x41ba('0x1c'),_0x2a0fc9+'-'+_0x44117e+'/'+_0x3a292f)['json'](_0x184253);}return null;};}function patchUpdates(_0xdd3f41){return function(_0x2fc07b){try{jsonpatch[_0x41ba('0x1d')](_0x2fc07b,_0xdd3f41,!![]);}catch(_0x55924d){return BPromise['reject'](_0x55924d);}return _0x2fc07b['save']();};}function saveUpdates(_0x3be7e1,_0x6216a4){return function(_0x1d7efc){if(_0x1d7efc){return _0x1d7efc['update'](_0x3be7e1)['then'](function(_0x3193ae){return _0x3193ae;});}return null;};}function removeEntity(_0x33969a,_0x1a160a){return function(_0x145ca1){if(_0x145ca1){return _0x145ca1['destroy']()[_0x41ba('0x1e')](function(){_0x33969a[_0x41ba('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a57f0,_0x52de18){return function(_0x54f101){if(!_0x54f101){_0x3a57f0[_0x41ba('0x1f')](0x194);}return _0x54f101;};}function handleError(_0x3facbc,_0xa2250e){_0xa2250e=_0xa2250e||0x1f4;return function(_0x4a9473){logger[_0x41ba('0x20')](_0x4a9473['stack']);if(_0x4a9473['name']){delete _0x4a9473[_0x41ba('0x21')];}_0x3facbc[_0x41ba('0x15')](_0xa2250e)['send'](_0x4a9473);};}exports[_0x41ba('0x22')]=function(_0x510e9f,_0x5d9edc){var _0x9c2051={},_0x60d92e={},_0x11de51={'count':0x0,'rows':[]};var _0x1dd5d8=_[_0x41ba('0x23')](db[_0x41ba('0x24')]['rawAttributes'],function(_0x393e95){return{'name':_0x393e95[_0x41ba('0x25')],'type':_0x393e95['type'][_0x41ba('0x26')]};});_0x60d92e[_0x41ba('0x27')]=_[_0x41ba('0x23')](_0x1dd5d8,_0x41ba('0x21'));_0x60d92e[_0x41ba('0x28')]=_['keys'](_0x510e9f[_0x41ba('0x28')]);_0x60d92e[_0x41ba('0x29')]=_['intersection'](_0x60d92e[_0x41ba('0x27')],_0x60d92e[_0x41ba('0x28')]);_0x9c2051['attributes']=_['intersection'](_0x60d92e['model'],qs[_0x41ba('0x2a')](_0x510e9f[_0x41ba('0x28')][_0x41ba('0x2a')]));_0x9c2051[_0x41ba('0x2b')]=_0x9c2051[_0x41ba('0x2b')][_0x41ba('0x2c')]?_0x9c2051[_0x41ba('0x2b')]:_0x60d92e[_0x41ba('0x27')];if(!_0x510e9f[_0x41ba('0x28')][_0x41ba('0x2d')](_0x41ba('0x2e'))){_0x9c2051[_0x41ba('0x19')]=qs['limit'](_0x510e9f['query'][_0x41ba('0x19')]);_0x9c2051['offset']=qs[_0x41ba('0x18')](_0x510e9f[_0x41ba('0x28')][_0x41ba('0x18')]);}_0x9c2051['order']=qs[_0x41ba('0x2f')](_0x510e9f[_0x41ba('0x28')][_0x41ba('0x2f')]);_0x9c2051[_0x41ba('0x30')]=qs[_0x41ba('0x29')](_[_0x41ba('0x31')](_0x510e9f[_0x41ba('0x28')],_0x60d92e[_0x41ba('0x29')]),_0x1dd5d8);if(_0x510e9f[_0x41ba('0x28')][_0x41ba('0x32')]){_0x9c2051[_0x41ba('0x30')]=_[_0x41ba('0x33')](_0x9c2051['where'],{'$or':_[_0x41ba('0x23')](_0x1dd5d8,function(_0x191b41){if(_0x191b41['type']!==_0x41ba('0x34')){var _0x229e19={};_0x229e19[_0x191b41['name']]={'$like':'%'+_0x510e9f['query'][_0x41ba('0x32')]+'%'};return _0x229e19;}})});}_0x9c2051=_['merge']({},_0x9c2051,_0x510e9f[_0x41ba('0x35')]);var _0x36284b={'where':_0x9c2051[_0x41ba('0x30')]};return db[_0x41ba('0x24')]['count'](_0x36284b)[_0x41ba('0x1e')](function(_0x101bab){_0x11de51[_0x41ba('0x1a')]=_0x101bab;if(_0x510e9f['query'][_0x41ba('0x36')]){_0x9c2051[_0x41ba('0x37')]=[{'all':!![]}];}return db[_0x41ba('0x24')][_0x41ba('0x38')](_0x9c2051);})[_0x41ba('0x1e')](function(_0x3ae269){_0x11de51[_0x41ba('0x39')]=_0x3ae269;return _0x11de51;})[_0x41ba('0x1e')](respondWithFilteredResult(_0x5d9edc,_0x9c2051))[_0x41ba('0x3a')](handleError(_0x5d9edc,null));};exports[_0x41ba('0x3b')]=function(_0x3aa102,_0x1d8725){var _0x25363a={'raw':!![],'where':{'id':_0x3aa102[_0x41ba('0x3c')]['id']}},_0x519afd={};_0x519afd[_0x41ba('0x27')]=_[_0x41ba('0x3d')](db[_0x41ba('0x24')]['rawAttributes']);_0x519afd[_0x41ba('0x28')]=_[_0x41ba('0x3d')](_0x3aa102['query']);_0x519afd[_0x41ba('0x29')]=_[_0x41ba('0x3e')](_0x519afd['model'],_0x519afd[_0x41ba('0x28')]);_0x25363a[_0x41ba('0x2b')]=_[_0x41ba('0x3e')](_0x519afd[_0x41ba('0x27')],qs['fields'](_0x3aa102['query']['fields']));_0x25363a[_0x41ba('0x2b')]=_0x25363a[_0x41ba('0x2b')][_0x41ba('0x2c')]?_0x25363a[_0x41ba('0x2b')]:_0x519afd[_0x41ba('0x27')];if(_0x3aa102['query'][_0x41ba('0x36')]){_0x25363a['include']=[{'all':!![]}];}_0x25363a=_['merge']({},_0x25363a,_0x3aa102[_0x41ba('0x35')]);return db[_0x41ba('0x24')]['find'](_0x25363a)[_0x41ba('0x1e')](handleEntityNotFound(_0x1d8725,null))[_0x41ba('0x1e')](respondWithResult(_0x1d8725,null))['catch'](handleError(_0x1d8725,null));};exports[_0x41ba('0x3f')]=function(_0x21294d,_0x2119de){return db['JscriptyQuestionReport'][_0x41ba('0x3f')](_0x21294d['body'],{})[_0x41ba('0x1e')](respondWithResult(_0x2119de,0xc9))[_0x41ba('0x3a')](handleError(_0x2119de,null));};exports[_0x41ba('0x40')]=function(_0x231242,_0x365185){if(_0x231242[_0x41ba('0x41')]['id']){delete _0x231242[_0x41ba('0x41')]['id'];}return db[_0x41ba('0x24')]['find']({'where':{'id':_0x231242[_0x41ba('0x3c')]['id']}})['then'](handleEntityNotFound(_0x365185,null))[_0x41ba('0x1e')](saveUpdates(_0x231242[_0x41ba('0x41')],null))[_0x41ba('0x1e')](respondWithResult(_0x365185,null))[_0x41ba('0x3a')](handleError(_0x365185,null));};exports[_0x41ba('0x42')]=function(_0x233a67,_0x36ec99){return db[_0x41ba('0x24')]['find']({'where':{'id':_0x233a67[_0x41ba('0x3c')]['id']}})[_0x41ba('0x1e')](handleEntityNotFound(_0x36ec99,null))[_0x41ba('0x1e')](removeEntity(_0x36ec99,null))[_0x41ba('0x3a')](handleError(_0x36ec99,null));};exports['describe']=function(_0x4cda89,_0x200d77){return db['JscriptyQuestionReport']['describe']()['then'](respondWithResult(_0x200d77,null))[_0x41ba('0x3a')](handleError(_0x200d77,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 84898d5..07f76e8 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 _0x64b5=['rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3c63e2,_0x2a2613){var _0x5da600=function(_0x2fd097){while(--_0x2fd097){_0x3c63e2['push'](_0x3c63e2['shift']());}};_0x5da600(++_0x2a2613);}(_0x64b5,0x68));var _0x564b=function(_0x3f3c57,_0x14fd50){_0x3f3c57=_0x3f3c57-0x0;var _0x51cdf0=_0x64b5[_0x3f3c57];return _0x51cdf0;};'use strict';var _=require(_0x564b('0x0'));var util=require(_0x564b('0x1'));var logger=require(_0x564b('0x2'))(_0x564b('0x3'));var moment=require(_0x564b('0x4'));var BPromise=require(_0x564b('0x5'));var rp=require(_0x564b('0x6'));var fs=require('fs');var path=require(_0x564b('0x7'));var rimraf=require(_0x564b('0x8'));var config=require(_0x564b('0x9'));var attributes=require(_0x564b('0xa'));module[_0x564b('0xb')]=function(_0x2bbda9,_0x58db47){return _0x2bbda9[_0x564b('0xc')]('JscriptyQuestionReport',attributes,{'tableName':_0x564b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd335=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions','lodash'];(function(_0x48ce56,_0x213bea){var _0x25e8a1=function(_0x34f473){while(--_0x34f473){_0x48ce56['push'](_0x48ce56['shift']());}};_0x25e8a1(++_0x213bea);}(_0xd335,0x107));var _0x5d33=function(_0x222ea0,_0x200f2a){_0x222ea0=_0x222ea0-0x0;var _0x381f02=_0xd335[_0x222ea0];return _0x381f02;};'use strict';var _=require(_0x5d33('0x0'));var util=require('util');var logger=require(_0x5d33('0x1'))(_0x5d33('0x2'));var moment=require('moment');var BPromise=require(_0x5d33('0x3'));var rp=require(_0x5d33('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5d33('0x5'));var config=require(_0x5d33('0x6'));var attributes=require(_0x5d33('0x7'));module['exports']=function(_0x19d5f0,_0x2ee7f5){return _0x19d5f0[_0x5d33('0x8')](_0x5d33('0x9'),attributes,{'tableName':_0x5d33('0xa'),'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 6a8f378..abc7f69 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 _0x09b5=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x09b5,0x120));var _0x509b=function(_0x35a521,_0x117bef){_0x35a521=_0x35a521-0x0;var _0xf6d2ef=_0x09b5[_0x35a521];return _0xf6d2ef;};'use strict';var _=require(_0x509b('0x0'));var util=require(_0x509b('0x1'));var moment=require(_0x509b('0x2'));var BPromise=require(_0x509b('0x3'));var rs=require(_0x509b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x509b('0x5'))['db'];var utils=require(_0x509b('0x6'));var logger=require(_0x509b('0x7'))(_0x509b('0x8'));var config=require('../../config/environment');var jayson=require(_0x509b('0x9'));var client=jayson[_0x509b('0xa')][_0x509b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b94cf,_0x4eb239,_0x3c1620){return new BPromise(function(_0x254b54,_0x47d39a){return client[_0x509b('0xc')](_0x4b94cf,_0x3c1620)[_0x509b('0xd')](function(_0x4e6199){logger['info'](_0x509b('0xe'),_0x4eb239,_0x509b('0xf'));logger[_0x509b('0x10')](_0x509b('0x11'),_0x4eb239,_0x509b('0xf'),JSON[_0x509b('0x12')](_0x4e6199));if(_0x4e6199[_0x509b('0x13')]){if(_0x4e6199[_0x509b('0x13')][_0x509b('0x14')]===0x1f4){logger[_0x509b('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4eb239,_0x4e6199[_0x509b('0x13')][_0x509b('0x15')]);return _0x47d39a(_0x4e6199[_0x509b('0x13')][_0x509b('0x15')]);}logger[_0x509b('0x13')](_0x509b('0xe'),_0x4eb239,_0x4e6199[_0x509b('0x13')][_0x509b('0x15')]);return _0x254b54(_0x4e6199[_0x509b('0x13')][_0x509b('0x15')]);}else{logger[_0x509b('0x16')](_0x509b('0xe'),_0x4eb239,_0x509b('0xf'));_0x254b54(_0x4e6199[_0x509b('0x17')]['message']);}})['catch'](function(_0x230d5b){logger[_0x509b('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4eb239,_0x230d5b);_0x47d39a(_0x230d5b);});});} \ No newline at end of file +var _0x4bfa=['code','message','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x5c88a8,_0x14f2ca){var _0x4f517f=function(_0x1638ce){while(--_0x1638ce){_0x5c88a8['push'](_0x5c88a8['shift']());}};_0x4f517f(++_0x14f2ca);}(_0x4bfa,0x106));var _0xa4bf=function(_0x21bfe4,_0x20ffba){_0x21bfe4=_0x21bfe4-0x0;var _0x5bef31=_0x4bfa[_0x21bfe4];return _0x5bef31;};'use strict';var _=require(_0xa4bf('0x0'));var util=require('util');var moment=require(_0xa4bf('0x1'));var BPromise=require(_0xa4bf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa4bf('0x3'));var db=require(_0xa4bf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa4bf('0x5'))(_0xa4bf('0x6'));var config=require(_0xa4bf('0x7'));var jayson=require(_0xa4bf('0x8'));var client=jayson[_0xa4bf('0x9')][_0xa4bf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x251297,_0x4ba6b5,_0x169593){return new BPromise(function(_0x3a2c21,_0xe6053f){return client[_0xa4bf('0xb')](_0x251297,_0x169593)[_0xa4bf('0xc')](function(_0x3d2dde){logger[_0xa4bf('0xd')](_0xa4bf('0xe'),_0x4ba6b5,_0xa4bf('0xf'));logger['debug'](_0xa4bf('0x10'),_0x4ba6b5,_0xa4bf('0xf'),JSON['stringify'](_0x3d2dde));if(_0x3d2dde[_0xa4bf('0x11')]){if(_0x3d2dde[_0xa4bf('0x11')][_0xa4bf('0x12')]===0x1f4){logger[_0xa4bf('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4ba6b5,_0x3d2dde[_0xa4bf('0x11')][_0xa4bf('0x13')]);return _0xe6053f(_0x3d2dde[_0xa4bf('0x11')][_0xa4bf('0x13')]);}logger[_0xa4bf('0x11')](_0xa4bf('0xe'),_0x4ba6b5,_0x3d2dde[_0xa4bf('0x11')]['message']);return _0x3a2c21(_0x3d2dde['error'][_0xa4bf('0x13')]);}else{logger[_0xa4bf('0xd')](_0xa4bf('0xe'),_0x4ba6b5,'request\x20sent');_0x3a2c21(_0x3d2dde['result'][_0xa4bf('0x13')]);}})['catch'](function(_0x28ba9b){logger[_0xa4bf('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4ba6b5,_0x28ba9b);_0xe6053f(_0x28ba9b);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 7932bfb..9387079 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 _0xd01a=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getQuestions','post','put','update','delete','destroy','multer','util'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd01a,0x1b6));var _0xad01=function(_0x57efcf,_0x1cb3e0){_0x57efcf=_0x57efcf-0x0;var _0x14f1cb=_0xd01a[_0x57efcf];return _0x14f1cb;};'use strict';var multer=require(_0xad01('0x0'));var util=require(_0xad01('0x1'));var path=require(_0xad01('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xad01('0x3')]();var fs_extra=require(_0xad01('0x4'));var auth=require(_0xad01('0x5'));var interaction=require(_0xad01('0x6'));var config=require(_0xad01('0x7'));var controller=require(_0xad01('0x8'));router[_0xad01('0x9')]('/',auth[_0xad01('0xa')](),controller[_0xad01('0xb')]);router[_0xad01('0x9')](_0xad01('0xc'),auth['isAuthenticated'](),controller[_0xad01('0xd')]);router[_0xad01('0x9')](_0xad01('0xe'),auth[_0xad01('0xa')](),controller[_0xad01('0xf')]);router[_0xad01('0x9')]('/:id/questions',auth['isAuthenticated'](),controller[_0xad01('0x10')]);router[_0xad01('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xad01('0x12')](_0xad01('0xe'),auth[_0xad01('0xa')](),controller[_0xad01('0x13')]);router[_0xad01('0x14')](_0xad01('0xe'),auth[_0xad01('0xa')](),controller[_0xad01('0x15')]);module['exports']=router; \ No newline at end of file +var _0xa4ec=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/questions','getQuestions','create','update','destroy','exports','multer'];(function(_0x2cc842,_0xd6800d){var _0x24adab=function(_0x41ab67){while(--_0x41ab67){_0x2cc842['push'](_0x2cc842['shift']());}};_0x24adab(++_0xd6800d);}(_0xa4ec,0x1ed));var _0xca4e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa4ec[_0x47e7cb];return _0x2a8874;};'use strict';var multer=require(_0xca4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xca4e('0x1')]();var fs_extra=require(_0xca4e('0x2'));var auth=require(_0xca4e('0x3'));var interaction=require(_0xca4e('0x4'));var config=require(_0xca4e('0x5'));var controller=require(_0xca4e('0x6'));router[_0xca4e('0x7')]('/',auth[_0xca4e('0x8')](),controller[_0xca4e('0x9')]);router['get'](_0xca4e('0xa'),auth[_0xca4e('0x8')](),controller['describe']);router[_0xca4e('0x7')](_0xca4e('0xb'),auth['isAuthenticated'](),controller[_0xca4e('0xc')]);router[_0xca4e('0x7')](_0xca4e('0xd'),auth[_0xca4e('0x8')](),controller[_0xca4e('0xe')]);router['post']('/',auth[_0xca4e('0x8')](),controller[_0xca4e('0xf')]);router['put']('/:id',auth[_0xca4e('0x8')](),controller[_0xca4e('0x10')]);router['delete'](_0xca4e('0xb'),auth[_0xca4e('0x8')](),controller[_0xca4e('0x11')]);module[_0xca4e('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 4f28ede..8a59c20 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 _0x4bfb=['moment','exports','DATE','setDataValue','starttime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0x2cd0fa,_0x39232f){var _0x1acbc4=function(_0x4e7d46){while(--_0x4e7d46){_0x2cd0fa['push'](_0x2cd0fa['shift']());}};_0x1acbc4(++_0x39232f);}(_0x4bfb,0x98));var _0xb4bf=function(_0x149055,_0x42bd96){_0x149055=_0x149055-0x0;var _0x2862bf=_0x4bfb[_0x149055];return _0x2862bf;};'use strict';var moment=require(_0xb4bf('0x0'));var Sequelize=require('sequelize');module[_0xb4bf('0x1')]={'starttime':{'type':Sequelize[_0xb4bf('0x2')],'set':function(_0x4c9fa7){this[_0xb4bf('0x3')](_0xb4bf('0x4'),_0x4c9fa7);this['setDataValue']('endtime',moment()['format'](_0xb4bf('0x5')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xb4bf('0x6')]},'projectname':{'type':Sequelize[_0xb4bf('0x6')]},'queue':{'type':Sequelize[_0xb4bf('0x6')]},'uniqueid':{'type':Sequelize[_0xb4bf('0x6')]},'calleridname':{'type':Sequelize[_0xb4bf('0x6')]},'calleridnum':{'type':Sequelize[_0xb4bf('0x6')]},'completed':{'type':Sequelize[_0xb4bf('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0xe58f=['format','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime','endtime'];(function(_0x20881d,_0xe71d2b){var _0x3c21e5=function(_0xf46bd7){while(--_0xf46bd7){_0x20881d['push'](_0x20881d['shift']());}};_0x3c21e5(++_0xe71d2b);}(_0xe58f,0x1c5));var _0xfe58=function(_0x5e5296,_0x225a9e){_0x5e5296=_0x5e5296-0x0;var _0x2521f2=_0xe58f[_0x5e5296];return _0x2521f2;};'use strict';var moment=require(_0xfe58('0x0'));var Sequelize=require(_0xfe58('0x1'));module[_0xfe58('0x2')]={'starttime':{'type':Sequelize[_0xfe58('0x3')],'set':function(_0x10b9ea){this[_0xfe58('0x4')](_0xfe58('0x5'),_0x10b9ea);this[_0xfe58('0x4')](_0xfe58('0x6'),moment()[_0xfe58('0x7')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xfe58('0x3')]},'membername':{'type':Sequelize[_0xfe58('0x8')]},'projectname':{'type':Sequelize[_0xfe58('0x8')]},'queue':{'type':Sequelize[_0xfe58('0x8')]},'uniqueid':{'type':Sequelize[_0xfe58('0x8')]},'calleridname':{'type':Sequelize[_0xfe58('0x8')]},'calleridnum':{'type':Sequelize[_0xfe58('0x8')]},'completed':{'type':Sequelize[_0xfe58('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index d906651..d82fa4b 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 _0xdf8d=['bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','JscriptySessionReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','create','body','find','describe','getQuestions','JscriptyQuestionReport','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x5d2a16,_0x5ca1ca){var _0x2fd4b7=function(_0x1d4c8a){while(--_0x1d4c8a){_0x5d2a16['push'](_0x5d2a16['shift']());}};_0x2fd4b7(++_0x5ca1ca);}(_0xdf8d,0x1cf));var _0xddf8=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0xdf8d[_0x1a0daa];return _0x1dbe15;};'use strict';var emlformat=require(_0xddf8('0x0'));var rimraf=require(_0xddf8('0x1'));var zipdir=require(_0xddf8('0x2'));var jsonpatch=require(_0xddf8('0x3'));var rp=require(_0xddf8('0x4'));var moment=require('moment');var BPromise=require(_0xddf8('0x5'));var Mustache=require(_0xddf8('0x6'));var util=require(_0xddf8('0x7'));var path=require(_0xddf8('0x8'));var sox=require('sox');var csv=require(_0xddf8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xddf8('0xa'));var _=require(_0xddf8('0xb'));var squel=require(_0xddf8('0xc'));var crypto=require(_0xddf8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xddf8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xddf8('0xf'));var Papa=require(_0xddf8('0x10'));var Redis=require('ioredis');var authService=require(_0xddf8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xddf8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xddf8('0x13'))(_0xddf8('0x14'));var utils=require(_0xddf8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xddf8('0x16'))['db'];function respondWithStatusCode(_0x50ebe5,_0x29a53f){_0x29a53f=_0x29a53f||0xcc;return function(_0x2b246a){if(_0x2b246a){return _0x50ebe5[_0xddf8('0x17')](_0x29a53f);}return _0x50ebe5[_0xddf8('0x18')](_0x29a53f)[_0xddf8('0x19')]();};}function respondWithResult(_0x228a43,_0x120f45){_0x120f45=_0x120f45||0xc8;return function(_0x189575){if(_0x189575){return _0x228a43[_0xddf8('0x18')](_0x120f45)['json'](_0x189575);}};}function respondWithFilteredResult(_0x38ed31,_0x4f659b){return function(_0x2abb3e){if(_0x2abb3e){var _0x37d239=typeof _0x4f659b[_0xddf8('0x1a')]===_0xddf8('0x1b')&&typeof _0x4f659b[_0xddf8('0x1c')]===_0xddf8('0x1b');var _0x3f0f54=_0x2abb3e[_0xddf8('0x1d')];var _0x294d46=_0x37d239?0x0:_0x4f659b['offset'];var _0x3c31bf=_0x37d239?_0x2abb3e['count']:_0x4f659b['offset']+_0x4f659b[_0xddf8('0x1c')];var _0x291ceb;if(_0x3c31bf>=_0x3f0f54){_0x3c31bf=_0x3f0f54;_0x291ceb=0xc8;}else{_0x291ceb=0xce;}_0x38ed31[_0xddf8('0x18')](_0x291ceb);return _0x38ed31[_0xddf8('0x1e')](_0xddf8('0x1f'),_0x294d46+'-'+_0x3c31bf+'/'+_0x3f0f54)['json'](_0x2abb3e);}return null;};}function patchUpdates(_0x2b4644){return function(_0x1661f3){try{jsonpatch[_0xddf8('0x20')](_0x1661f3,_0x2b4644,!![]);}catch(_0x320a8c){return BPromise['reject'](_0x320a8c);}return _0x1661f3[_0xddf8('0x21')]();};}function saveUpdates(_0x489fc5,_0x2d9a87){return function(_0x352975){if(_0x352975){return _0x352975[_0xddf8('0x22')](_0x489fc5)[_0xddf8('0x23')](function(_0x33b94c){return _0x33b94c;});}return null;};}function removeEntity(_0x39823a,_0x1104d9){return function(_0x1be665){if(_0x1be665){return _0x1be665[_0xddf8('0x24')]()[_0xddf8('0x23')](function(){_0x39823a[_0xddf8('0x18')](0xcc)[_0xddf8('0x19')]();});}};}function handleEntityNotFound(_0x27a673,_0x114e26){return function(_0x2a2762){if(!_0x2a2762){_0x27a673[_0xddf8('0x17')](0x194);}return _0x2a2762;};}function handleError(_0x26252d,_0x45d8f0){_0x45d8f0=_0x45d8f0||0x1f4;return function(_0xf153a4){logger[_0xddf8('0x25')](_0xf153a4[_0xddf8('0x26')]);if(_0xf153a4[_0xddf8('0x27')]){delete _0xf153a4['name'];}_0x26252d[_0xddf8('0x18')](_0x45d8f0)[_0xddf8('0x28')](_0xf153a4);};}exports['index']=function(_0x182c1d,_0x486951){var _0x469bf7={},_0x31b471={},_0x2a0d3c={'count':0x0,'rows':[]};var _0x190bf5=_['map'](db[_0xddf8('0x29')][_0xddf8('0x2a')],function(_0x6abc10){return{'name':_0x6abc10[_0xddf8('0x2b')],'type':_0x6abc10[_0xddf8('0x2c')][_0xddf8('0x2d')]};});_0x31b471[_0xddf8('0x2e')]=_[_0xddf8('0x2f')](_0x190bf5,'name');_0x31b471[_0xddf8('0x30')]=_[_0xddf8('0x31')](_0x182c1d[_0xddf8('0x30')]);_0x31b471[_0xddf8('0x32')]=_[_0xddf8('0x33')](_0x31b471['model'],_0x31b471['query']);_0x469bf7[_0xddf8('0x34')]=_[_0xddf8('0x33')](_0x31b471['model'],qs[_0xddf8('0x35')](_0x182c1d[_0xddf8('0x30')][_0xddf8('0x35')]));_0x469bf7[_0xddf8('0x34')]=_0x469bf7[_0xddf8('0x34')]['length']?_0x469bf7['attributes']:_0x31b471[_0xddf8('0x2e')];if(!_0x182c1d[_0xddf8('0x30')][_0xddf8('0x36')](_0xddf8('0x37'))){_0x469bf7[_0xddf8('0x1c')]=qs['limit'](_0x182c1d[_0xddf8('0x30')]['limit']);_0x469bf7['offset']=qs['offset'](_0x182c1d[_0xddf8('0x30')]['offset']);}_0x469bf7[_0xddf8('0x38')]=qs[_0xddf8('0x39')](_0x182c1d[_0xddf8('0x30')][_0xddf8('0x39')]);_0x469bf7[_0xddf8('0x3a')]=qs[_0xddf8('0x32')](_[_0xddf8('0x3b')](_0x182c1d['query'],_0x31b471[_0xddf8('0x32')]),_0x190bf5);if(_0x182c1d[_0xddf8('0x30')][_0xddf8('0x3c')]){_0x469bf7['where']=_[_0xddf8('0x3d')](_0x469bf7[_0xddf8('0x3a')],{'$or':_[_0xddf8('0x2f')](_0x190bf5,function(_0x20b17b){if(_0x20b17b[_0xddf8('0x2c')]!==_0xddf8('0x3e')){var _0x176ab5={};_0x176ab5[_0x20b17b[_0xddf8('0x27')]]={'$like':'%'+_0x182c1d[_0xddf8('0x30')]['filter']+'%'};return _0x176ab5;}})});}_0x469bf7=_['merge']({},_0x469bf7,_0x182c1d[_0xddf8('0x3f')]);var _0x3b4420={'where':_0x469bf7[_0xddf8('0x3a')]};return db[_0xddf8('0x29')][_0xddf8('0x1d')](_0x3b4420)[_0xddf8('0x23')](function(_0x7ceb11){_0x2a0d3c[_0xddf8('0x1d')]=_0x7ceb11;if(_0x182c1d[_0xddf8('0x30')][_0xddf8('0x40')]){_0x469bf7[_0xddf8('0x41')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xddf8('0x42')](_0x469bf7);})[_0xddf8('0x23')](function(_0x578b8e){_0x2a0d3c[_0xddf8('0x43')]=_0x578b8e;return _0x2a0d3c;})[_0xddf8('0x23')](respondWithFilteredResult(_0x486951,_0x469bf7))[_0xddf8('0x44')](handleError(_0x486951,null));};exports['show']=function(_0x5f4a5d,_0x4f29b6){var _0x914c2e={'raw':!![],'where':{'id':_0x5f4a5d[_0xddf8('0x45')]['id']}},_0x3fb883={};_0x3fb883[_0xddf8('0x2e')]=_['keys'](db[_0xddf8('0x29')][_0xddf8('0x2a')]);_0x3fb883[_0xddf8('0x30')]=_[_0xddf8('0x31')](_0x5f4a5d[_0xddf8('0x30')]);_0x3fb883[_0xddf8('0x32')]=_[_0xddf8('0x33')](_0x3fb883[_0xddf8('0x2e')],_0x3fb883[_0xddf8('0x30')]);_0x914c2e[_0xddf8('0x34')]=_[_0xddf8('0x33')](_0x3fb883['model'],qs[_0xddf8('0x35')](_0x5f4a5d[_0xddf8('0x30')][_0xddf8('0x35')]));_0x914c2e['attributes']=_0x914c2e[_0xddf8('0x34')][_0xddf8('0x46')]?_0x914c2e['attributes']:_0x3fb883[_0xddf8('0x2e')];if(_0x5f4a5d[_0xddf8('0x30')][_0xddf8('0x40')]){_0x914c2e[_0xddf8('0x41')]=[{'all':!![]}];}_0x914c2e=_[_0xddf8('0x3d')]({},_0x914c2e,_0x5f4a5d[_0xddf8('0x3f')]);return db[_0xddf8('0x29')]['find'](_0x914c2e)['then'](handleEntityNotFound(_0x4f29b6,null))[_0xddf8('0x23')](respondWithResult(_0x4f29b6,null))['catch'](handleError(_0x4f29b6,null));};exports[_0xddf8('0x47')]=function(_0x2eecfa,_0x4d9890){return db[_0xddf8('0x29')]['create'](_0x2eecfa['body'],{})[_0xddf8('0x23')](respondWithResult(_0x4d9890,0xc9))[_0xddf8('0x44')](handleError(_0x4d9890,null));};exports[_0xddf8('0x22')]=function(_0x5ab522,_0x1d4c61){if(_0x5ab522[_0xddf8('0x48')]['id']){delete _0x5ab522[_0xddf8('0x48')]['id'];}return db[_0xddf8('0x29')]['find']({'where':{'id':_0x5ab522['params']['id']}})[_0xddf8('0x23')](handleEntityNotFound(_0x1d4c61,null))[_0xddf8('0x23')](saveUpdates(_0x5ab522[_0xddf8('0x48')],null))['then'](respondWithResult(_0x1d4c61,null))[_0xddf8('0x44')](handleError(_0x1d4c61,null));};exports[_0xddf8('0x24')]=function(_0x382941,_0x26186c){return db[_0xddf8('0x29')][_0xddf8('0x49')]({'where':{'id':_0x382941[_0xddf8('0x45')]['id']}})['then'](handleEntityNotFound(_0x26186c,null))['then'](removeEntity(_0x26186c,null))[_0xddf8('0x44')](handleError(_0x26186c,null));};exports[_0xddf8('0x4a')]=function(_0xa930a4,_0x208a1d){return db[_0xddf8('0x29')][_0xddf8('0x4a')]()[_0xddf8('0x23')](respondWithResult(_0x208a1d,null))[_0xddf8('0x44')](handleError(_0x208a1d,null));};exports[_0xddf8('0x4b')]=function(_0x18b98a,_0xc82a4d,_0x592c28){var _0x4968d3={'raw':!![],'where':{}};var _0x568329={};var _0xad1673={'count':0x0,'rows':[]};return db[_0xddf8('0x29')]['findOne']({'where':{'id':_0x18b98a[_0xddf8('0x45')]['id']}})['then'](handleEntityNotFound(_0xc82a4d,null))['then'](function(_0x1ce040){if(_0x1ce040){_0x568329[_0xddf8('0x2e')]=_[_0xddf8('0x31')](db[_0xddf8('0x4c')][_0xddf8('0x2a')]);_0x568329['query']=_['keys'](_0x18b98a[_0xddf8('0x30')]);_0x568329[_0xddf8('0x32')]=_[_0xddf8('0x33')](_0x568329[_0xddf8('0x2e')],_0x568329[_0xddf8('0x30')]);_0x4968d3[_0xddf8('0x34')]=_[_0xddf8('0x33')](_0x568329[_0xddf8('0x2e')],qs[_0xddf8('0x35')](_0x18b98a[_0xddf8('0x30')][_0xddf8('0x35')]));_0x4968d3['attributes']=_0x4968d3[_0xddf8('0x34')]['length']?_0x4968d3['attributes']:_0x568329[_0xddf8('0x2e')];if(!_0x18b98a[_0xddf8('0x30')][_0xddf8('0x36')]('nolimit')){_0x4968d3['limit']=qs['limit'](_0x18b98a[_0xddf8('0x30')]['limit']);_0x4968d3[_0xddf8('0x1a')]=qs['offset'](_0x18b98a[_0xddf8('0x30')]['offset']);}_0x4968d3[_0xddf8('0x38')]=qs[_0xddf8('0x39')](_0x18b98a[_0xddf8('0x30')][_0xddf8('0x39')]);_0x4968d3['where']=qs[_0xddf8('0x32')](_['pick'](_0x18b98a['query'],_0x568329[_0xddf8('0x32')]));_0x4968d3[_0xddf8('0x3a')][_0xddf8('0x4d')]=_0x1ce040['id'];if(_0x18b98a[_0xddf8('0x30')][_0xddf8('0x3c')]){_0x4968d3[_0xddf8('0x3a')]=_['merge'](_0x4968d3[_0xddf8('0x3a')],{'$or':_[_0xddf8('0x2f')](_0x4968d3[_0xddf8('0x34')],function(_0x30c1ed){var _0x662836={};_0x662836[_0x30c1ed]={'$like':'%'+_0x18b98a[_0xddf8('0x30')][_0xddf8('0x3c')]+'%'};return _0x662836;})});}_0x4968d3=_[_0xddf8('0x3d')]({},_0x4968d3,_0x18b98a[_0xddf8('0x3f')]);return db[_0xddf8('0x4c')][_0xddf8('0x1d')]({'where':_0x4968d3['where']})['then'](function(_0xe01448){_0xad1673[_0xddf8('0x1d')]=_0xe01448;if(_0x18b98a[_0xddf8('0x30')]['includeAll']){_0x4968d3['include']=[{'all':!![]}];}return db[_0xddf8('0x4c')][_0xddf8('0x42')](_0x4968d3);})[_0xddf8('0x23')](function(_0x2c39ff){_0xad1673[_0xddf8('0x43')]=_0x2c39ff;return _0xad1673;});}})[_0xddf8('0x23')](respondWithFilteredResult(_0xc82a4d,_0x4968d3))['catch'](handleError(_0xc82a4d,null));}; \ No newline at end of file +var _0xb8b2=['../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','end','sendStatus','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','nolimit','order','sort','where','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','pick','SessionId','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x5ad859,_0x5f2d0e){var _0x385a96=function(_0x3961ba){while(--_0x3961ba){_0x5ad859['push'](_0x5ad859['shift']());}};_0x385a96(++_0x5f2d0e);}(_0xb8b2,0xe1));var _0x2b8b=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xb8b2[_0x46aff0];return _0x9d78cf;};'use strict';var emlformat=require(_0x2b8b('0x0'));var rimraf=require(_0x2b8b('0x1'));var zipdir=require(_0x2b8b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2b8b('0x3'));var moment=require(_0x2b8b('0x4'));var BPromise=require(_0x2b8b('0x5'));var Mustache=require(_0x2b8b('0x6'));var util=require(_0x2b8b('0x7'));var path=require(_0x2b8b('0x8'));var sox=require(_0x2b8b('0x9'));var csv=require(_0x2b8b('0xa'));var ejs=require(_0x2b8b('0xb'));var fs=require('fs');var fs_extra=require(_0x2b8b('0xc'));var _=require(_0x2b8b('0xd'));var squel=require('squel');var crypto=require(_0x2b8b('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2b8b('0xf'));var Papa=require(_0x2b8b('0x10'));var Redis=require(_0x2b8b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2b8b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b8b('0x13'));var logger=require(_0x2b8b('0x14'))(_0x2b8b('0x15'));var utils=require(_0x2b8b('0x16'));var config=require(_0x2b8b('0x17'));var licenseUtil=require(_0x2b8b('0x18'));var db=require(_0x2b8b('0x19'))['db'];function respondWithStatusCode(_0x232db8,_0x22218a){_0x22218a=_0x22218a||0xcc;return function(_0x22e9cf){if(_0x22e9cf){return _0x232db8['sendStatus'](_0x22218a);}return _0x232db8[_0x2b8b('0x1a')](_0x22218a)['end']();};}function respondWithResult(_0x4119a6,_0x413899){_0x413899=_0x413899||0xc8;return function(_0x19b826){if(_0x19b826){return _0x4119a6['status'](_0x413899)['json'](_0x19b826);}};}function respondWithFilteredResult(_0xecd24f,_0x342533){return function(_0x351075){if(_0x351075){var _0x31e4b6=typeof _0x342533[_0x2b8b('0x1b')]==='undefined'&&typeof _0x342533['limit']===_0x2b8b('0x1c');var _0x19a881=_0x351075[_0x2b8b('0x1d')];var _0x34dd32=_0x31e4b6?0x0:_0x342533[_0x2b8b('0x1b')];var _0x4a2fbb=_0x31e4b6?_0x351075[_0x2b8b('0x1d')]:_0x342533[_0x2b8b('0x1b')]+_0x342533[_0x2b8b('0x1e')];var _0x3f48f8;if(_0x4a2fbb>=_0x19a881){_0x4a2fbb=_0x19a881;_0x3f48f8=0xc8;}else{_0x3f48f8=0xce;}_0xecd24f[_0x2b8b('0x1a')](_0x3f48f8);return _0xecd24f[_0x2b8b('0x1f')](_0x2b8b('0x20'),_0x34dd32+'-'+_0x4a2fbb+'/'+_0x19a881)['json'](_0x351075);}return null;};}function patchUpdates(_0x33f521){return function(_0x1f28cc){try{jsonpatch['apply'](_0x1f28cc,_0x33f521,!![]);}catch(_0x2fa5a4){return BPromise[_0x2b8b('0x21')](_0x2fa5a4);}return _0x1f28cc[_0x2b8b('0x22')]();};}function saveUpdates(_0x12463f,_0x48b53c){return function(_0x4ce32a){if(_0x4ce32a){return _0x4ce32a[_0x2b8b('0x23')](_0x12463f)[_0x2b8b('0x24')](function(_0x3b4809){return _0x3b4809;});}return null;};}function removeEntity(_0x4fa6f9,_0x54fc41){return function(_0x3b16dd){if(_0x3b16dd){return _0x3b16dd['destroy']()[_0x2b8b('0x24')](function(){_0x4fa6f9['status'](0xcc)[_0x2b8b('0x25')]();});}};}function handleEntityNotFound(_0x47e417,_0x4c603b){return function(_0x7c230f){if(!_0x7c230f){_0x47e417[_0x2b8b('0x26')](0x194);}return _0x7c230f;};}function handleError(_0x3f6863,_0x19aba6){_0x19aba6=_0x19aba6||0x1f4;return function(_0x3398de){logger[_0x2b8b('0x27')](_0x3398de[_0x2b8b('0x28')]);if(_0x3398de[_0x2b8b('0x29')]){delete _0x3398de[_0x2b8b('0x29')];}_0x3f6863['status'](_0x19aba6)[_0x2b8b('0x2a')](_0x3398de);};}exports[_0x2b8b('0x2b')]=function(_0x5a156e,_0x156c93){var _0x5344f0={},_0x275e96={},_0x28f7af={'count':0x0,'rows':[]};var _0x25a230=_[_0x2b8b('0x2c')](db[_0x2b8b('0x2d')][_0x2b8b('0x2e')],function(_0xa322af){return{'name':_0xa322af[_0x2b8b('0x2f')],'type':_0xa322af['type'][_0x2b8b('0x30')]};});_0x275e96['model']=_[_0x2b8b('0x2c')](_0x25a230,'name');_0x275e96[_0x2b8b('0x31')]=_[_0x2b8b('0x32')](_0x5a156e[_0x2b8b('0x31')]);_0x275e96[_0x2b8b('0x33')]=_['intersection'](_0x275e96[_0x2b8b('0x34')],_0x275e96[_0x2b8b('0x31')]);_0x5344f0[_0x2b8b('0x35')]=_[_0x2b8b('0x36')](_0x275e96['model'],qs[_0x2b8b('0x37')](_0x5a156e['query']['fields']));_0x5344f0['attributes']=_0x5344f0['attributes']['length']?_0x5344f0[_0x2b8b('0x35')]:_0x275e96['model'];if(!_0x5a156e[_0x2b8b('0x31')]['hasOwnProperty'](_0x2b8b('0x38'))){_0x5344f0[_0x2b8b('0x1e')]=qs['limit'](_0x5a156e[_0x2b8b('0x31')][_0x2b8b('0x1e')]);_0x5344f0[_0x2b8b('0x1b')]=qs[_0x2b8b('0x1b')](_0x5a156e[_0x2b8b('0x31')][_0x2b8b('0x1b')]);}_0x5344f0[_0x2b8b('0x39')]=qs[_0x2b8b('0x3a')](_0x5a156e['query'][_0x2b8b('0x3a')]);_0x5344f0[_0x2b8b('0x3b')]=qs[_0x2b8b('0x33')](_['pick'](_0x5a156e[_0x2b8b('0x31')],_0x275e96['filters']),_0x25a230);if(_0x5a156e['query']['filter']){_0x5344f0['where']=_[_0x2b8b('0x3c')](_0x5344f0[_0x2b8b('0x3b')],{'$or':_[_0x2b8b('0x2c')](_0x25a230,function(_0x548037){if(_0x548037[_0x2b8b('0x3d')]!=='VIRTUAL'){var _0x5cb19e={};_0x5cb19e[_0x548037[_0x2b8b('0x29')]]={'$like':'%'+_0x5a156e['query'][_0x2b8b('0x3e')]+'%'};return _0x5cb19e;}})});}_0x5344f0=_[_0x2b8b('0x3c')]({},_0x5344f0,_0x5a156e[_0x2b8b('0x3f')]);var _0x472a79={'where':_0x5344f0[_0x2b8b('0x3b')]};return db[_0x2b8b('0x2d')]['count'](_0x472a79)['then'](function(_0x9f4991){_0x28f7af[_0x2b8b('0x1d')]=_0x9f4991;if(_0x5a156e[_0x2b8b('0x31')][_0x2b8b('0x40')]){_0x5344f0[_0x2b8b('0x41')]=[{'all':!![]}];}return db[_0x2b8b('0x2d')][_0x2b8b('0x42')](_0x5344f0);})[_0x2b8b('0x24')](function(_0x5b3cea){_0x28f7af[_0x2b8b('0x43')]=_0x5b3cea;return _0x28f7af;})['then'](respondWithFilteredResult(_0x156c93,_0x5344f0))[_0x2b8b('0x44')](handleError(_0x156c93,null));};exports[_0x2b8b('0x45')]=function(_0x315d4e,_0xaf9f22){var _0x417082={'raw':!![],'where':{'id':_0x315d4e[_0x2b8b('0x46')]['id']}},_0x2172d9={};_0x2172d9['model']=_['keys'](db['JscriptySessionReport'][_0x2b8b('0x2e')]);_0x2172d9['query']=_[_0x2b8b('0x32')](_0x315d4e[_0x2b8b('0x31')]);_0x2172d9[_0x2b8b('0x33')]=_[_0x2b8b('0x36')](_0x2172d9['model'],_0x2172d9['query']);_0x417082['attributes']=_['intersection'](_0x2172d9['model'],qs['fields'](_0x315d4e[_0x2b8b('0x31')][_0x2b8b('0x37')]));_0x417082[_0x2b8b('0x35')]=_0x417082[_0x2b8b('0x35')][_0x2b8b('0x47')]?_0x417082[_0x2b8b('0x35')]:_0x2172d9[_0x2b8b('0x34')];if(_0x315d4e[_0x2b8b('0x31')]['includeAll']){_0x417082[_0x2b8b('0x41')]=[{'all':!![]}];}_0x417082=_['merge']({},_0x417082,_0x315d4e[_0x2b8b('0x3f')]);return db[_0x2b8b('0x2d')][_0x2b8b('0x48')](_0x417082)[_0x2b8b('0x24')](handleEntityNotFound(_0xaf9f22,null))[_0x2b8b('0x24')](respondWithResult(_0xaf9f22,null))['catch'](handleError(_0xaf9f22,null));};exports[_0x2b8b('0x49')]=function(_0x2faccd,_0x3557cd){return db[_0x2b8b('0x2d')][_0x2b8b('0x49')](_0x2faccd[_0x2b8b('0x4a')],{})[_0x2b8b('0x24')](respondWithResult(_0x3557cd,0xc9))['catch'](handleError(_0x3557cd,null));};exports[_0x2b8b('0x23')]=function(_0x151726,_0x3d5270){if(_0x151726[_0x2b8b('0x4a')]['id']){delete _0x151726['body']['id'];}return db['JscriptySessionReport'][_0x2b8b('0x48')]({'where':{'id':_0x151726['params']['id']}})[_0x2b8b('0x24')](handleEntityNotFound(_0x3d5270,null))['then'](saveUpdates(_0x151726[_0x2b8b('0x4a')],null))[_0x2b8b('0x24')](respondWithResult(_0x3d5270,null))[_0x2b8b('0x44')](handleError(_0x3d5270,null));};exports[_0x2b8b('0x4b')]=function(_0x490a0f,_0xc60a41){return db['JscriptySessionReport'][_0x2b8b('0x48')]({'where':{'id':_0x490a0f[_0x2b8b('0x46')]['id']}})[_0x2b8b('0x24')](handleEntityNotFound(_0xc60a41,null))[_0x2b8b('0x24')](removeEntity(_0xc60a41,null))[_0x2b8b('0x44')](handleError(_0xc60a41,null));};exports[_0x2b8b('0x4c')]=function(_0x24d1cc,_0x4dcbef){return db['JscriptySessionReport'][_0x2b8b('0x4c')]()['then'](respondWithResult(_0x4dcbef,null))[_0x2b8b('0x44')](handleError(_0x4dcbef,null));};exports[_0x2b8b('0x4d')]=function(_0x1789ef,_0xffa99c,_0x445eef){var _0x5b0541={'raw':!![],'where':{}};var _0x8063de={};var _0x398aa4={'count':0x0,'rows':[]};return db[_0x2b8b('0x2d')][_0x2b8b('0x4e')]({'where':{'id':_0x1789ef[_0x2b8b('0x46')]['id']}})[_0x2b8b('0x24')](handleEntityNotFound(_0xffa99c,null))[_0x2b8b('0x24')](function(_0x2a6a4c){if(_0x2a6a4c){_0x8063de[_0x2b8b('0x34')]=_['keys'](db[_0x2b8b('0x4f')][_0x2b8b('0x2e')]);_0x8063de['query']=_[_0x2b8b('0x32')](_0x1789ef[_0x2b8b('0x31')]);_0x8063de[_0x2b8b('0x33')]=_[_0x2b8b('0x36')](_0x8063de[_0x2b8b('0x34')],_0x8063de[_0x2b8b('0x31')]);_0x5b0541[_0x2b8b('0x35')]=_[_0x2b8b('0x36')](_0x8063de[_0x2b8b('0x34')],qs[_0x2b8b('0x37')](_0x1789ef[_0x2b8b('0x31')][_0x2b8b('0x37')]));_0x5b0541[_0x2b8b('0x35')]=_0x5b0541[_0x2b8b('0x35')][_0x2b8b('0x47')]?_0x5b0541[_0x2b8b('0x35')]:_0x8063de['model'];if(!_0x1789ef['query'][_0x2b8b('0x50')](_0x2b8b('0x38'))){_0x5b0541[_0x2b8b('0x1e')]=qs['limit'](_0x1789ef[_0x2b8b('0x31')][_0x2b8b('0x1e')]);_0x5b0541[_0x2b8b('0x1b')]=qs['offset'](_0x1789ef[_0x2b8b('0x31')][_0x2b8b('0x1b')]);}_0x5b0541['order']=qs[_0x2b8b('0x3a')](_0x1789ef[_0x2b8b('0x31')][_0x2b8b('0x3a')]);_0x5b0541[_0x2b8b('0x3b')]=qs[_0x2b8b('0x33')](_[_0x2b8b('0x51')](_0x1789ef['query'],_0x8063de['filters']));_0x5b0541[_0x2b8b('0x3b')][_0x2b8b('0x52')]=_0x2a6a4c['id'];if(_0x1789ef[_0x2b8b('0x31')][_0x2b8b('0x3e')]){_0x5b0541[_0x2b8b('0x3b')]=_['merge'](_0x5b0541[_0x2b8b('0x3b')],{'$or':_[_0x2b8b('0x2c')](_0x5b0541[_0x2b8b('0x35')],function(_0x1e9a3c){var _0x99f16f={};_0x99f16f[_0x1e9a3c]={'$like':'%'+_0x1789ef[_0x2b8b('0x31')][_0x2b8b('0x3e')]+'%'};return _0x99f16f;})});}_0x5b0541=_['merge']({},_0x5b0541,_0x1789ef['options']);return db['JscriptyQuestionReport'][_0x2b8b('0x1d')]({'where':_0x5b0541[_0x2b8b('0x3b')]})[_0x2b8b('0x24')](function(_0x5065e0){_0x398aa4[_0x2b8b('0x1d')]=_0x5065e0;if(_0x1789ef[_0x2b8b('0x31')][_0x2b8b('0x40')]){_0x5b0541['include']=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x5b0541);})['then'](function(_0x42ca23){_0x398aa4[_0x2b8b('0x43')]=_0x42ca23;return _0x398aa4;});}})[_0x2b8b('0x24')](respondWithFilteredResult(_0xffa99c,_0x5b0541))['catch'](handleError(_0xffa99c,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 4b986da..0482153 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 _0xe0ae=['api','bluebird','path','rimraf','./jscriptySessionReport.attributes','define','JscriptySessionReport','report_jscripty_sessions','../../config/logger'];(function(_0x4638b7,_0x27fb23){var _0x1d6e96=function(_0x33e0d7){while(--_0x33e0d7){_0x4638b7['push'](_0x4638b7['shift']());}};_0x1d6e96(++_0x27fb23);}(_0xe0ae,0xa1));var _0xee0a=function(_0x4fc80b,_0xfe1b3d){_0x4fc80b=_0x4fc80b-0x0;var _0x119dba=_0xe0ae[_0x4fc80b];return _0x119dba;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xee0a('0x0'))(_0xee0a('0x1'));var moment=require('moment');var BPromise=require(_0xee0a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xee0a('0x3'));var rimraf=require(_0xee0a('0x4'));var config=require('../../config/environment');var attributes=require(_0xee0a('0x5'));module['exports']=function(_0x5bef07,_0x39a302){return _0x5bef07[_0xee0a('0x6')](_0xee0a('0x7'),attributes,{'tableName':_0xee0a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd046=['rimraf','./jscriptySessionReport.attributes','define','util','../../config/logger','api','bluebird'];(function(_0x2fdd26,_0x1848c6){var _0x198002=function(_0xf092a1){while(--_0xf092a1){_0x2fdd26['push'](_0x2fdd26['shift']());}};_0x198002(++_0x1848c6);}(_0xd046,0x129));var _0x6d04=function(_0x55e768,_0x16c19b){_0x55e768=_0x55e768-0x0;var _0x44d7f4=_0xd046[_0x55e768];return _0x44d7f4;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var logger=require(_0x6d04('0x1'))(_0x6d04('0x2'));var moment=require('moment');var BPromise=require(_0x6d04('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6d04('0x4'));var config=require('../../config/environment');var attributes=require(_0x6d04('0x5'));module['exports']=function(_0x4bacb1,_0xf3b4e7){return _0x4bacb1[_0x6d04('0x6')]('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','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 1624b5c..ab863cb 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x90b1=['message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x56364f,_0x2122ef){var _0x3fdce7=function(_0x10abf0){while(--_0x10abf0){_0x56364f['push'](_0x56364f['shift']());}};_0x3fdce7(++_0x2122ef);}(_0x90b1,0x1bb));var _0x190b=function(_0x52230f,_0x29c980){_0x52230f=_0x52230f-0x0;var _0x2e6c80=_0x90b1[_0x52230f];return _0x2e6c80;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var moment=require(_0x190b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x190b('0x3'));var db=require(_0x190b('0x4'))['db'];var utils=require(_0x190b('0x5'));var logger=require(_0x190b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x190b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x34a689,_0x3b57f7,_0x626aa1){return new BPromise(function(_0x311161,_0x802924){return client[_0x190b('0x8')](_0x34a689,_0x626aa1)['then'](function(_0x14b93d){logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));logger[_0x190b('0xc')](_0x190b('0xd'),_0x3b57f7,_0x190b('0xb'),JSON[_0x190b('0xe')](_0x14b93d));if(_0x14b93d['error']){if(_0x14b93d[_0x190b('0xf')][_0x190b('0x10')]===0x1f4){logger['error'](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x802924(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}logger[_0x190b('0xf')](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x311161(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}else{logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));_0x311161(_0x14b93d[_0x190b('0x12')][_0x190b('0x11')]);}})[_0x190b('0x13')](function(_0x5c63d9){logger[_0x190b('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x3b57f7,_0x5c63d9);_0x802924(_0x5c63d9);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x4975,0x86));var _0x5497=function(_0x50bdb0,_0x28deca){_0x50bdb0=_0x50bdb0-0x0;var _0x3567e5=_0x4975[_0x50bdb0];return _0x3567e5;};'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')]('JscriptySessionReport,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 03da0ec..6f2a5c4 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 _0x0473=['express','../../components/auth/service','../../config/environment','./license.controller','get','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports','multer','util','path','connect-timeout'];(function(_0xf364f3,_0xb76ce5){var _0x5d0bfc=function(_0x437d95){while(--_0x437d95){_0xf364f3['push'](_0xf364f3['shift']());}};_0x5d0bfc(++_0xb76ce5);}(_0x0473,0x119));var _0x3047=function(_0x160648,_0x1ca02d){_0x160648=_0x160648-0x0;var _0x5266c6=_0x0473[_0x160648];return _0x5266c6;};'use strict';var multer=require(_0x3047('0x0'));var util=require(_0x3047('0x1'));var path=require(_0x3047('0x2'));var timeout=require(_0x3047('0x3'));var express=require(_0x3047('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3047('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3047('0x6'));var controller=require(_0x3047('0x7'));router[_0x3047('0x8')]('/',controller['index']);router['put'](_0x3047('0x9'),auth[_0x3047('0xa')](),controller[_0x3047('0xb')]);router[_0x3047('0x8')](_0x3047('0xc'),auth[_0x3047('0xa')](),controller[_0x3047('0xd')]);module[_0x3047('0xe')]=router; \ No newline at end of file +var _0x9f6a=['/download_log_file','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','isAuthenticated'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9f6a,0x146));var _0xa9f6=function(_0x4f4d19,_0x574245){_0x4f4d19=_0x4f4d19-0x0;var _0x27a258=_0x9f6a[_0x4f4d19];return _0x27a258;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa9f6('0x0'));var express=require(_0xa9f6('0x1'));var router=express[_0xa9f6('0x2')]();var fs_extra=require(_0xa9f6('0x3'));var auth=require(_0xa9f6('0x4'));var interaction=require(_0xa9f6('0x5'));var config=require(_0xa9f6('0x6'));var controller=require(_0xa9f6('0x7'));router[_0xa9f6('0x8')]('/',controller[_0xa9f6('0x9')]);router[_0xa9f6('0xa')]('/:id',auth[_0xa9f6('0xb')](),controller['update']);router[_0xa9f6('0x8')](_0xa9f6('0xc'),auth[_0xa9f6('0xb')](),controller['downloadLogFile']);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 9a27144..ce44ad6 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 _0x7a0e=['TEXT','STRING','INTEGER','exports'];(function(_0x3fe31b,_0xc87fd1){var _0x1c14e6=function(_0xc6f059){while(--_0xc6f059){_0x3fe31b['push'](_0x3fe31b['shift']());}};_0x1c14e6(++_0xc87fd1);}(_0x7a0e,0x1b7));var _0xe7a0=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x7a0e[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0xe7a0('0x0')]={'license':{'type':Sequelize[_0xe7a0('0x1')]},'data1':{'type':Sequelize[_0xe7a0('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xe7a0('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcedf=['TEXT','STRING','sequelize'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xcedf,0x104));var _0xfced=function(_0x599776,_0x86134e){_0x599776=_0x599776-0x0;var _0x3590e6=_0xcedf[_0x599776];return _0x3590e6;};'use strict';var Sequelize=require(_0xfced('0x0'));module['exports']={'license':{'type':Sequelize[_0xfced('0x1')]},'data1':{'type':Sequelize[_0xfced('0x2')]},'data2':{'type':Sequelize['STRING']},'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 84e11f7..6f46bd6 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 _0x6ef9=['text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','Content-Range','apply','update','then','error','name','send','index','model','keys','query','filters','intersection','attributes','fields','merge','getLicense','body','License','params','get','demo','downloadLogFile','join','/var','log','xcally','Content-disposition','attachment;\x20filename='];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0x6ef9,0x1e2));var _0x96ef=function(_0x4ba380,_0x259bee){_0x4ba380=_0x4ba380-0x0;var _0x4b111b=_0x6ef9[_0x4ba380];return _0x4b111b;};'use strict';var emlformat=require(_0x96ef('0x0'));var rimraf=require(_0x96ef('0x1'));var zipdir=require(_0x96ef('0x2'));var jsonpatch=require(_0x96ef('0x3'));var rp=require(_0x96ef('0x4'));var moment=require('moment');var BPromise=require(_0x96ef('0x5'));var Mustache=require(_0x96ef('0x6'));var util=require(_0x96ef('0x7'));var path=require(_0x96ef('0x8'));var sox=require(_0x96ef('0x9'));var csv=require(_0x96ef('0xa'));var ejs=require(_0x96ef('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x96ef('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x96ef('0xd'));var Papa=require('papaparse');var Redis=require(_0x96ef('0xe'));var authService=require(_0x96ef('0xf'));var qs=require(_0x96ef('0x10'));var as=require(_0x96ef('0x11'));var hardwareService=require(_0x96ef('0x12'));var logger=require(_0x96ef('0x13'))(_0x96ef('0x14'));var utils=require(_0x96ef('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x96ef('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b5a7e,_0x32c75b){_0x32c75b=_0x32c75b||0xcc;return function(_0x5185b5){if(_0x5185b5){return _0x2b5a7e[_0x96ef('0x17')](_0x32c75b);}return _0x2b5a7e[_0x96ef('0x18')](_0x32c75b)[_0x96ef('0x19')]();};}function respondWithResult(_0x16bbcf,_0x342837){_0x342837=_0x342837||0xc8;return function(_0x2b12c2){if(_0x2b12c2){return _0x16bbcf['status'](_0x342837)[_0x96ef('0x1a')](_0x2b12c2);}};}function respondWithFilteredResult(_0xb0e9e5,_0x409308){return function(_0x10ddd7){if(_0x10ddd7){var _0x4c88ac=typeof _0x409308[_0x96ef('0x1b')]==='undefined'&&typeof _0x409308[_0x96ef('0x1c')]==='undefined';var _0x1f6c7c=_0x10ddd7['count'];var _0x45372b=_0x4c88ac?0x0:_0x409308['offset'];var _0x39b516=_0x4c88ac?_0x10ddd7['count']:_0x409308[_0x96ef('0x1b')]+_0x409308['limit'];var _0x467ee4;if(_0x39b516>=_0x1f6c7c){_0x39b516=_0x1f6c7c;_0x467ee4=0xc8;}else{_0x467ee4=0xce;}_0xb0e9e5[_0x96ef('0x18')](_0x467ee4);return _0xb0e9e5['set'](_0x96ef('0x1d'),_0x45372b+'-'+_0x39b516+'/'+_0x1f6c7c)[_0x96ef('0x1a')](_0x10ddd7);}return null;};}function patchUpdates(_0x579abc){return function(_0xb8c89e){try{jsonpatch[_0x96ef('0x1e')](_0xb8c89e,_0x579abc,!![]);}catch(_0x5d4960){return BPromise['reject'](_0x5d4960);}return _0xb8c89e['save']();};}function saveUpdates(_0x4c3d96,_0x36e8d1){return function(_0x3677e0){if(_0x3677e0){return _0x3677e0[_0x96ef('0x1f')](_0x4c3d96)[_0x96ef('0x20')](function(_0x36deb7){return _0x36deb7;});}return null;};}function removeEntity(_0x215748,_0x2a8d2c){return function(_0x2714a4){if(_0x2714a4){return _0x2714a4['destroy']()[_0x96ef('0x20')](function(){_0x215748[_0x96ef('0x18')](0xcc)[_0x96ef('0x19')]();});}};}function handleEntityNotFound(_0x206b3e,_0x4e39f8){return function(_0x47aaac){if(!_0x47aaac){_0x206b3e[_0x96ef('0x17')](0x194);}return _0x47aaac;};}function handleError(_0x1e7d79,_0x35e117){_0x35e117=_0x35e117||0x1f4;return function(_0x48fccd){logger[_0x96ef('0x21')](_0x48fccd['stack']);if(_0x48fccd[_0x96ef('0x22')]){delete _0x48fccd[_0x96ef('0x22')];}_0x1e7d79[_0x96ef('0x18')](_0x35e117)[_0x96ef('0x23')](_0x48fccd);};}var utilLicense=require(_0x96ef('0x16'));exports[_0x96ef('0x24')]=function(_0x3939ea,_0x2c036f){var _0x303897={'raw':!![],'where':{'id':0x1}},_0x368fe4={};_0x368fe4[_0x96ef('0x25')]=_[_0x96ef('0x26')](db['License']['rawAttributes']);_0x368fe4[_0x96ef('0x27')]=_[_0x96ef('0x26')](_0x3939ea[_0x96ef('0x27')]);_0x368fe4[_0x96ef('0x28')]=_[_0x96ef('0x29')](_0x368fe4[_0x96ef('0x25')],_0x368fe4[_0x96ef('0x27')]);_0x303897[_0x96ef('0x2a')]=_[_0x96ef('0x29')](_0x368fe4['model'],qs[_0x96ef('0x2b')](_0x3939ea[_0x96ef('0x27')][_0x96ef('0x2b')]));_0x303897['attributes']=_0x303897[_0x96ef('0x2a')]['length']?_0x303897[_0x96ef('0x2a')]:_0x368fe4[_0x96ef('0x25')];_0x303897=_[_0x96ef('0x2c')]({},_0x303897,_0x3939ea['options']);return utilLicense[_0x96ef('0x2d')](_0x303897)[_0x96ef('0x20')](respondWithResult(_0x2c036f,null))['catch'](handleError(_0x2c036f,null));};exports[_0x96ef('0x1f')]=function(_0x5738a0,_0x1d020c){if(_0x5738a0[_0x96ef('0x2e')]['id']){delete _0x5738a0[_0x96ef('0x2e')]['id'];}return db[_0x96ef('0x2f')]['find']({'where':{'id':_0x5738a0[_0x96ef('0x30')]['id']}})[_0x96ef('0x20')](handleEntityNotFound(_0x1d020c,null))[_0x96ef('0x20')](function(_0xa0b8da){var _0x2e3d53=_0xa0b8da[_0x96ef('0x31')]({'plain':!![]});return utilLicense['checkLicense'](_0x2e3d53,_0x5738a0[_0x96ef('0x2e')]['key']);})['then'](function(_0x33570e){if(!_0x33570e[_0x96ef('0x32')]){return saveUpdates(_0x5738a0[_0x96ef('0x2e')],null);}return _0x33570e;})[_0x96ef('0x20')](respondWithResult(_0x1d020c,null))['catch'](handleError(_0x1d020c,null));};exports[_0x96ef('0x33')]=function(_0x4b6e3a,_0x6af46e){var _0xb96aa1='license-info.log';var _0x3747c4=path[_0x96ef('0x34')](_0x96ef('0x35'),_0x96ef('0x36'),_0x96ef('0x37'),_0xb96aa1);_0x6af46e['setHeader'](_0x96ef('0x38'),_0x96ef('0x39')+_0xb96aa1);_0x6af46e['set']('Content-Type',_0x96ef('0x3a'));_0x6af46e[_0x96ef('0x3b')](_0x3747c4);}; \ No newline at end of file +var _0xcd65=['filters','attributes','intersection','fields','merge','getLicense','update','body','get','checkLicense','key','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','../../config/license/util','index','model','keys','License','rawAttributes','query'];(function(_0x586cd5,_0x176035){var _0x5e29d1=function(_0x203535){while(--_0x203535){_0x586cd5['push'](_0x586cd5['shift']());}};_0x5e29d1(++_0x176035);}(_0xcd65,0x139));var _0x5cd6=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xcd65[_0x6cf19c];return _0xce14f3;};'use strict';var emlformat=require(_0x5cd6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5cd6('0x1'));var jsonpatch=require(_0x5cd6('0x2'));var rp=require(_0x5cd6('0x3'));var moment=require(_0x5cd6('0x4'));var BPromise=require(_0x5cd6('0x5'));var Mustache=require(_0x5cd6('0x6'));var util=require(_0x5cd6('0x7'));var path=require(_0x5cd6('0x8'));var sox=require(_0x5cd6('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5cd6('0xa'));var _=require('lodash');var squel=require(_0x5cd6('0xb'));var crypto=require(_0x5cd6('0xc'));var jsforce=require(_0x5cd6('0xd'));var deskjs=require(_0x5cd6('0xe'));var toCsv=require(_0x5cd6('0xf'));var querystring=require(_0x5cd6('0x10'));var Papa=require(_0x5cd6('0x11'));var Redis=require(_0x5cd6('0x12'));var authService=require(_0x5cd6('0x13'));var qs=require(_0x5cd6('0x14'));var as=require(_0x5cd6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5cd6('0x16'))(_0x5cd6('0x17'));var utils=require(_0x5cd6('0x18'));var config=require(_0x5cd6('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x5cd6('0x1a'))['db'];function respondWithStatusCode(_0xb1649d,_0x4de0ea){_0x4de0ea=_0x4de0ea||0xcc;return function(_0x573e48){if(_0x573e48){return _0xb1649d[_0x5cd6('0x1b')](_0x4de0ea);}return _0xb1649d['status'](_0x4de0ea)[_0x5cd6('0x1c')]();};}function respondWithResult(_0x5ae4ab,_0x54e344){_0x54e344=_0x54e344||0xc8;return function(_0x2ffee7){if(_0x2ffee7){return _0x5ae4ab['status'](_0x54e344)[_0x5cd6('0x1d')](_0x2ffee7);}};}function respondWithFilteredResult(_0x3a9f12,_0x2636ce){return function(_0x35e7e8){if(_0x35e7e8){var _0x9c9209=typeof _0x2636ce[_0x5cd6('0x1e')]===_0x5cd6('0x1f')&&typeof _0x2636ce['limit']===_0x5cd6('0x1f');var _0x3a7be5=_0x35e7e8[_0x5cd6('0x20')];var _0x256101=_0x9c9209?0x0:_0x2636ce[_0x5cd6('0x1e')];var _0x4033fc=_0x9c9209?_0x35e7e8['count']:_0x2636ce[_0x5cd6('0x1e')]+_0x2636ce[_0x5cd6('0x21')];var _0x3473b2;if(_0x4033fc>=_0x3a7be5){_0x4033fc=_0x3a7be5;_0x3473b2=0xc8;}else{_0x3473b2=0xce;}_0x3a9f12[_0x5cd6('0x22')](_0x3473b2);return _0x3a9f12['set'](_0x5cd6('0x23'),_0x256101+'-'+_0x4033fc+'/'+_0x3a7be5)['json'](_0x35e7e8);}return null;};}function patchUpdates(_0x2f0c5d){return function(_0x11a319){try{jsonpatch[_0x5cd6('0x24')](_0x11a319,_0x2f0c5d,!![]);}catch(_0x3247fa){return BPromise[_0x5cd6('0x25')](_0x3247fa);}return _0x11a319[_0x5cd6('0x26')]();};}function saveUpdates(_0x13a9cb,_0x17d4bc){return function(_0x3e2ac5){if(_0x3e2ac5){return _0x3e2ac5['update'](_0x13a9cb)['then'](function(_0x359cbb){return _0x359cbb;});}return null;};}function removeEntity(_0x3bc1a0,_0x53f591){return function(_0x29bc9e){if(_0x29bc9e){return _0x29bc9e[_0x5cd6('0x27')]()[_0x5cd6('0x28')](function(){_0x3bc1a0[_0x5cd6('0x22')](0xcc)[_0x5cd6('0x1c')]();});}};}function handleEntityNotFound(_0x56466b,_0x5eff26){return function(_0x2aa1b3){if(!_0x2aa1b3){_0x56466b[_0x5cd6('0x1b')](0x194);}return _0x2aa1b3;};}function handleError(_0x6d0262,_0x8803e4){_0x8803e4=_0x8803e4||0x1f4;return function(_0x44ea53){logger[_0x5cd6('0x29')](_0x44ea53[_0x5cd6('0x2a')]);if(_0x44ea53[_0x5cd6('0x2b')]){delete _0x44ea53[_0x5cd6('0x2b')];}_0x6d0262[_0x5cd6('0x22')](_0x8803e4)[_0x5cd6('0x2c')](_0x44ea53);};}var utilLicense=require(_0x5cd6('0x2d'));exports[_0x5cd6('0x2e')]=function(_0x16004f,_0x3f48ef){var _0x51944b={'raw':!![],'where':{'id':0x1}},_0xc04ad4={};_0xc04ad4[_0x5cd6('0x2f')]=_[_0x5cd6('0x30')](db[_0x5cd6('0x31')][_0x5cd6('0x32')]);_0xc04ad4[_0x5cd6('0x33')]=_['keys'](_0x16004f[_0x5cd6('0x33')]);_0xc04ad4[_0x5cd6('0x34')]=_['intersection'](_0xc04ad4['model'],_0xc04ad4[_0x5cd6('0x33')]);_0x51944b[_0x5cd6('0x35')]=_[_0x5cd6('0x36')](_0xc04ad4[_0x5cd6('0x2f')],qs[_0x5cd6('0x37')](_0x16004f[_0x5cd6('0x33')][_0x5cd6('0x37')]));_0x51944b[_0x5cd6('0x35')]=_0x51944b[_0x5cd6('0x35')]['length']?_0x51944b[_0x5cd6('0x35')]:_0xc04ad4[_0x5cd6('0x2f')];_0x51944b=_[_0x5cd6('0x38')]({},_0x51944b,_0x16004f['options']);return utilLicense[_0x5cd6('0x39')](_0x51944b)['then'](respondWithResult(_0x3f48ef,null))['catch'](handleError(_0x3f48ef,null));};exports[_0x5cd6('0x3a')]=function(_0x4aadf0,_0x44b3d4){if(_0x4aadf0[_0x5cd6('0x3b')]['id']){delete _0x4aadf0[_0x5cd6('0x3b')]['id'];}return db['License']['find']({'where':{'id':_0x4aadf0['params']['id']}})['then'](handleEntityNotFound(_0x44b3d4,null))[_0x5cd6('0x28')](function(_0x358898){var _0x1f4676=_0x358898[_0x5cd6('0x3c')]({'plain':!![]});return utilLicense[_0x5cd6('0x3d')](_0x1f4676,_0x4aadf0[_0x5cd6('0x3b')][_0x5cd6('0x3e')]);})[_0x5cd6('0x28')](function(_0x27799a){if(!_0x27799a['demo']){return saveUpdates(_0x4aadf0[_0x5cd6('0x3b')],null);}return _0x27799a;})[_0x5cd6('0x28')](respondWithResult(_0x44b3d4,null))['catch'](handleError(_0x44b3d4,null));};exports['downloadLogFile']=function(_0x573ddc,_0x3b95a7){var _0x4f231a=_0x5cd6('0x3f');var _0x1af899=path[_0x5cd6('0x40')](_0x5cd6('0x41'),_0x5cd6('0x42'),_0x5cd6('0x43'),_0x4f231a);_0x3b95a7[_0x5cd6('0x44')](_0x5cd6('0x45'),_0x5cd6('0x46')+_0x4f231a);_0x3b95a7['set'](_0x5cd6('0x47'),_0x5cd6('0x48'));_0x3b95a7['download'](_0x1af899);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index e4d62e2..48673d7 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 _0x0d18=['bluebird','request-promise','rimraf','../../config/environment','./license.attributes','exports','define','License','lodash','util','api','moment'];(function(_0x1b1371,_0x5dd1f2){var _0x252c83=function(_0x42967c){while(--_0x42967c){_0x1b1371['push'](_0x1b1371['shift']());}};_0x252c83(++_0x5dd1f2);}(_0x0d18,0x11c));var _0x80d1=function(_0x26d0f0,_0x2768e2){_0x26d0f0=_0x26d0f0-0x0;var _0x4b6be0=_0x0d18[_0x26d0f0];return _0x4b6be0;};'use strict';var _=require(_0x80d1('0x0'));var util=require(_0x80d1('0x1'));var logger=require('../../config/logger')(_0x80d1('0x2'));var moment=require(_0x80d1('0x3'));var BPromise=require(_0x80d1('0x4'));var rp=require(_0x80d1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x80d1('0x6'));var config=require(_0x80d1('0x7'));var attributes=require(_0x80d1('0x8'));module[_0x80d1('0x9')]=function(_0x2ce9ae,_0x5c9fb6){return _0x2ce9ae[_0x80d1('0xa')](_0x80d1('0xb'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd293=['license','util','moment','bluebird','path','rimraf','../../config/environment','./license.attributes','define','License'];(function(_0x52f8cc,_0x2a8c27){var _0x4ea8f6=function(_0x1279e3){while(--_0x1279e3){_0x52f8cc['push'](_0x52f8cc['shift']());}};_0x4ea8f6(++_0x2a8c27);}(_0xd293,0x12d));var _0x3d29=function(_0x5930a7,_0x219beb){_0x5930a7=_0x5930a7-0x0;var _0x1b17af=_0xd293[_0x5930a7];return _0x1b17af;};'use strict';var _=require('lodash');var util=require(_0x3d29('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3d29('0x1'));var BPromise=require(_0x3d29('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d29('0x3'));var rimraf=require(_0x3d29('0x4'));var config=require(_0x3d29('0x5'));var attributes=require(_0x3d29('0x6'));module['exports']=function(_0x9d615,_0x3b18c5){return _0x9d615[_0x3d29('0x7')](_0x3d29('0x8'),attributes,{'tableName':_0x3d29('0x9'),'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 3509a84..60edf67 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 _0xa15a=['rpc','jayson/promise','client','request','info','request\x20sent','License,\x20%s,\x20%s,\x20%s','error','code','License,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4b093a,_0x4758e5){var _0x3a91f1=function(_0x2c3952){while(--_0x2c3952){_0x4b093a['push'](_0x4b093a['shift']());}};_0x3a91f1(++_0x4758e5);}(_0xa15a,0x1c4));var _0xaa15=function(_0x167478,_0x49b9d4){_0x167478=_0x167478-0x0;var _0x3c6114=_0xa15a[_0x167478];return _0x3c6114;};'use strict';var _=require(_0xaa15('0x0'));var util=require(_0xaa15('0x1'));var moment=require(_0xaa15('0x2'));var BPromise=require(_0xaa15('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa15('0x4'));var db=require(_0xaa15('0x5'))['db'];var utils=require(_0xaa15('0x6'));var logger=require(_0xaa15('0x7'))(_0xaa15('0x8'));var config=require('../../config/environment');var jayson=require(_0xaa15('0x9'));var client=jayson[_0xaa15('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ade97,_0x596e47,_0x4d9be0){return new BPromise(function(_0x5adac6,_0x378b3f){return client[_0xaa15('0xb')](_0x3ade97,_0x4d9be0)['then'](function(_0x11c380){logger[_0xaa15('0xc')]('License,\x20%s,\x20%s',_0x596e47,_0xaa15('0xd'));logger['debug'](_0xaa15('0xe'),_0x596e47,'request\x20sent',JSON['stringify'](_0x11c380));if(_0x11c380[_0xaa15('0xf')]){if(_0x11c380[_0xaa15('0xf')][_0xaa15('0x10')]===0x1f4){logger['error'](_0xaa15('0x11'),_0x596e47,_0x11c380['error']['message']);return _0x378b3f(_0x11c380[_0xaa15('0xf')]['message']);}logger[_0xaa15('0xf')](_0xaa15('0x11'),_0x596e47,_0x11c380[_0xaa15('0xf')][_0xaa15('0x12')]);return _0x5adac6(_0x11c380[_0xaa15('0xf')][_0xaa15('0x12')]);}else{logger[_0xaa15('0xc')]('License,\x20%s,\x20%s',_0x596e47,_0xaa15('0xd'));_0x5adac6(_0x11c380[_0xaa15('0x13')]['message']);}})['catch'](function(_0x5d033c){logger[_0xaa15('0xf')](_0xaa15('0x11'),_0x596e47,_0x5d033c);_0x378b3f(_0x5d033c);});});} \ No newline at end of file +var _0xf120=['../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x442f02,_0x47d845){var _0xab6ef1=function(_0x4cad5c){while(--_0x4cad5c){_0x442f02['push'](_0x442f02['shift']());}};_0xab6ef1(++_0x47d845);}(_0xf120,0x10e));var _0x0f12=function(_0x364649,_0x551fb9){_0x364649=_0x364649-0x0;var _0x243cd5=_0xf120[_0x364649];return _0x243cd5;};'use strict';var _=require('lodash');var util=require(_0x0f12('0x0'));var moment=require(_0x0f12('0x1'));var BPromise=require(_0x0f12('0x2'));var rs=require(_0x0f12('0x3'));var fs=require('fs');var Redis=require(_0x0f12('0x4'));var db=require(_0x0f12('0x5'))['db'];var utils=require(_0x0f12('0x6'));var logger=require(_0x0f12('0x7'))('rpc');var config=require(_0x0f12('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0f12('0x9')][_0x0f12('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e29b9,_0x488c07,_0x5d16af){return new BPromise(function(_0x76ecc7,_0x3d393c){return client[_0x0f12('0xb')](_0x1e29b9,_0x5d16af)[_0x0f12('0xc')](function(_0x24de1a){logger[_0x0f12('0xd')](_0x0f12('0xe'),_0x488c07,_0x0f12('0xf'));logger['debug'](_0x0f12('0x10'),_0x488c07,_0x0f12('0xf'),JSON[_0x0f12('0x11')](_0x24de1a));if(_0x24de1a[_0x0f12('0x12')]){if(_0x24de1a[_0x0f12('0x12')][_0x0f12('0x13')]===0x1f4){logger['error'](_0x0f12('0xe'),_0x488c07,_0x24de1a[_0x0f12('0x12')]['message']);return _0x3d393c(_0x24de1a[_0x0f12('0x12')][_0x0f12('0x14')]);}logger[_0x0f12('0x12')](_0x0f12('0xe'),_0x488c07,_0x24de1a['error'][_0x0f12('0x14')]);return _0x76ecc7(_0x24de1a[_0x0f12('0x12')][_0x0f12('0x14')]);}else{logger[_0x0f12('0xd')](_0x0f12('0xe'),_0x488c07,'request\x20sent');_0x76ecc7(_0x24de1a[_0x0f12('0x15')]['message']);}})[_0x0f12('0x16')](function(_0x3cf354){logger[_0x0f12('0x12')](_0x0f12('0xe'),_0x488c07,_0x3cf354);_0x3d393c(_0x3cf354);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index f28f4a9..682aee9 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 _0x014a=['addSmtp','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeImap','removeSmtp','destroy','removeAgents','exports','multer','path','connect-timeout','fs-extra','./mailAccount.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/verify','verifySmtp','/:id/users','post','addDisposition','addAnswer','create','addImap'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x014a,0x1c6));var _0xa014=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x014a[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0xa014('0x0'));var util=require('util');var path=require(_0xa014('0x1'));var timeout=require(_0xa014('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa014('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa014('0x4'));router[_0xa014('0x5')]('/',auth[_0xa014('0x6')](),controller[_0xa014('0x7')]);router[_0xa014('0x5')]('/describe',auth[_0xa014('0x6')](),controller['describe']);router[_0xa014('0x5')](_0xa014('0x8'),auth[_0xa014('0x6')](),controller[_0xa014('0x9')]);router[_0xa014('0x5')](_0xa014('0xa'),auth[_0xa014('0x6')](),controller[_0xa014('0xb')]);router[_0xa014('0x5')](_0xa014('0xc'),auth[_0xa014('0x6')](),controller[_0xa014('0xd')]);router[_0xa014('0x5')](_0xa014('0xe'),auth['isAuthenticated'](),controller[_0xa014('0xf')]);router[_0xa014('0x5')](_0xa014('0x10'),auth[_0xa014('0x6')](),controller[_0xa014('0x11')]);router[_0xa014('0x5')](_0xa014('0x12'),auth[_0xa014('0x6')](),controller[_0xa014('0x13')]);router['get'](_0xa014('0x14'),auth[_0xa014('0x6')](),controller[_0xa014('0x15')]);router[_0xa014('0x5')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router['get'](_0xa014('0x16'),auth[_0xa014('0x6')](),controller[_0xa014('0x17')]);router[_0xa014('0x5')](_0xa014('0x18'),auth[_0xa014('0x6')](),controller['getAgents']);router[_0xa014('0x19')](_0xa014('0xa'),auth[_0xa014('0x6')](),controller[_0xa014('0x1a')]);router[_0xa014('0x19')](_0xa014('0xc'),auth['isAuthenticated'](),controller[_0xa014('0x1b')]);router[_0xa014('0x19')]('/',auth['isAuthenticated'](),controller[_0xa014('0x1c')]);router[_0xa014('0x19')](_0xa014('0xe'),auth[_0xa014('0x6')](),controller[_0xa014('0x1d')]);router['post'](_0xa014('0x10'),auth[_0xa014('0x6')](),controller[_0xa014('0x1e')]);router[_0xa014('0x19')](_0xa014('0x12'),auth[_0xa014('0x6')](),controller['addInteraction']);router[_0xa014('0x19')](_0xa014('0x14'),auth[_0xa014('0x6')](),controller[_0xa014('0x1f')]);router[_0xa014('0x19')](_0xa014('0x20'),auth[_0xa014('0x6')](),controller[_0xa014('0x21')]);router[_0xa014('0x19')](_0xa014('0x18'),auth[_0xa014('0x6')](),controller[_0xa014('0x22')]);router[_0xa014('0x23')]('/:id',auth[_0xa014('0x6')](),controller[_0xa014('0x24')]);router[_0xa014('0x25')](_0xa014('0xa'),auth[_0xa014('0x6')](),controller[_0xa014('0x26')]);router[_0xa014('0x25')](_0xa014('0xc'),auth[_0xa014('0x6')](),controller['removeAnswers']);router[_0xa014('0x25')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xa014('0x27')]);router[_0xa014('0x25')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0xa014('0x28')]);router[_0xa014('0x25')](_0xa014('0x8'),auth['isAuthenticated'](),controller[_0xa014('0x29')]);router['delete']('/:id/users',auth[_0xa014('0x6')](),controller[_0xa014('0x2a')]);module[_0xa014('0x2b')]=router; \ No newline at end of file +var _0x4400=['getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','/:id/dispositions','/:id/canned_answers','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','send','put','delete','removeDispositions','removeAnswers','/:id/in_servers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getDispositions','getAnswers','/:id/out_servers'];(function(_0x228970,_0x32db8b){var _0x2befe5=function(_0x4b0943){while(--_0x4b0943){_0x228970['push'](_0x228970['shift']());}};_0x2befe5(++_0x32db8b);}(_0x4400,0x175));var _0x0440=function(_0x10630c,_0x13cbbb){_0x10630c=_0x10630c-0x0;var _0x17da93=_0x4400[_0x10630c];return _0x17da93;};'use strict';var multer=require(_0x0440('0x0'));var util=require(_0x0440('0x1'));var path=require(_0x0440('0x2'));var timeout=require('connect-timeout');var express=require(_0x0440('0x3'));var router=express[_0x0440('0x4')]();var fs_extra=require(_0x0440('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0440('0x6'));var config=require(_0x0440('0x7'));var controller=require(_0x0440('0x8'));router[_0x0440('0x9')]('/',auth['isAuthenticated'](),controller[_0x0440('0xa')]);router[_0x0440('0x9')](_0x0440('0xb'),auth[_0x0440('0xc')](),controller[_0x0440('0xd')]);router[_0x0440('0x9')](_0x0440('0xe'),auth[_0x0440('0xc')](),controller[_0x0440('0xf')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x0440('0x10')]);router[_0x0440('0x9')]('/:id/canned_answers',auth[_0x0440('0xc')](),controller[_0x0440('0x11')]);router[_0x0440('0x9')]('/:id/in_servers',auth[_0x0440('0xc')](),controller['getImap']);router[_0x0440('0x9')](_0x0440('0x12'),auth[_0x0440('0xc')](),controller[_0x0440('0x13')]);router[_0x0440('0x9')](_0x0440('0x14'),auth[_0x0440('0xc')](),controller[_0x0440('0x15')]);router['get'](_0x0440('0x16'),auth[_0x0440('0xc')](),controller['getApplications']);router[_0x0440('0x9')](_0x0440('0x17'),auth[_0x0440('0xc')](),controller[_0x0440('0x18')]);router[_0x0440('0x9')](_0x0440('0x19'),auth[_0x0440('0xc')](),controller[_0x0440('0x1a')]);router[_0x0440('0x9')](_0x0440('0x1b'),auth['isAuthenticated'](),controller[_0x0440('0x1c')]);router[_0x0440('0x1d')](_0x0440('0x1e'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x0440('0x1d')](_0x0440('0x1f'),auth[_0x0440('0xc')](),controller[_0x0440('0x20')]);router[_0x0440('0x1d')]('/',auth[_0x0440('0xc')](),controller[_0x0440('0x21')]);router['post']('/:id/in_servers',auth['isAuthenticated'](),controller[_0x0440('0x22')]);router[_0x0440('0x1d')]('/:id/out_servers',auth[_0x0440('0xc')](),controller[_0x0440('0x23')]);router[_0x0440('0x1d')](_0x0440('0x14'),auth[_0x0440('0xc')](),controller[_0x0440('0x24')]);router[_0x0440('0x1d')]('/:id/applications',auth[_0x0440('0xc')](),controller[_0x0440('0x25')]);router[_0x0440('0x1d')]('/:id/send',auth[_0x0440('0xc')](),controller[_0x0440('0x26')]);router[_0x0440('0x1d')](_0x0440('0x1b'),auth[_0x0440('0xc')](),controller['addAgents']);router[_0x0440('0x27')](_0x0440('0xe'),auth[_0x0440('0xc')](),controller['update']);router[_0x0440('0x28')](_0x0440('0x1e'),auth[_0x0440('0xc')](),controller[_0x0440('0x29')]);router[_0x0440('0x28')]('/:id/canned_answers',auth[_0x0440('0xc')](),controller[_0x0440('0x2a')]);router[_0x0440('0x28')](_0x0440('0x2b'),auth[_0x0440('0xc')](),controller[_0x0440('0x2c')]);router[_0x0440('0x28')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x0440('0x2d')]);router[_0x0440('0x28')](_0x0440('0xe'),auth[_0x0440('0xc')](),controller[_0x0440('0x2e')]);router[_0x0440('0x28')]('/:id/users',auth[_0x0440('0xc')](),controller[_0x0440('0x2f')]);module[_0x0440('0x30')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index cfd869d..09b8ac0 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 _0xd68e=['exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','yahoo','provider','custom','getDataValue','sequelize'];(function(_0x2cffb7,_0x66782d){var _0x3803ed=function(_0x3b81ef){while(--_0x3b81ef){_0x2cffb7['push'](_0x2cffb7['shift']());}};_0x3803ed(++_0x66782d);}(_0xd68e,0x1d3));var _0xed68=function(_0x3a9e73,_0x567a70){_0x3a9e73=_0x3a9e73-0x0;var _0x5af67a=_0xd68e[_0x3a9e73];return _0x5af67a;};'use strict';var Sequelize=require(_0xed68('0x0'));module[_0xed68('0x1')]={'description':{'type':Sequelize[_0xed68('0x2')]},'name':{'type':Sequelize[_0xed68('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xed68('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xed68('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xed68('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xed68('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xed68('0x4')]},'markAsUnread':{'type':Sequelize[_0xed68('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xed68('0x2')],'allowNull':![],'defaultValue':_0xed68('0x5')},'fontSize':{'type':Sequelize[_0xed68('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xed68('0x4')],'defaultValue':function(){return _0xed68('0x7');}},'notificationSound':{'type':Sequelize[_0xed68('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xed68('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xed68('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xed68('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xed68('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xed68('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xed68('0x3')],'defaultValue':![],'comment':_0xed68('0x9'),'set':function(_0x5bd1c3){if(!_0x5bd1c3)this[_0xed68('0xa')](_0xed68('0xb'),null);this['setDataValue'](_0xed68('0xc'),_0x5bd1c3);}},'provider':{'type':Sequelize[_0xed68('0xd')]('gmail','hotmail',_0xed68('0xe'),'outlook365'),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0xed68('0xf')))return _0xed68('0x10');return this[_0xed68('0x11')](_0xed68('0xf'));},'set':function(_0x4d670f){if(_0x4d670f===_0xed68('0x10'))_0x4d670f=null;return this[_0xed68('0xa')](_0xed68('0xf'),_0x4d670f);}}}; \ No newline at end of file +var _0xbf92=['gmail','yahoo','getDataValue','provider','custom','setDataValue','sequelize','STRING','TEXT','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x8be87,_0xd1108c){var _0x164736=function(_0x3f9901){while(--_0x3f9901){_0x8be87['push'](_0x8be87['shift']());}};_0x164736(++_0xd1108c);}(_0xbf92,0x136));var _0x2bf9=function(_0x988118,_0x1cff89){_0x988118=_0x988118-0x0;var _0x4d0e7f=_0xbf92[_0x988118];return _0x4d0e7f;};'use strict';var Sequelize=require(_0x2bf9('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x2bf9('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x2bf9('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x2bf9('0x2')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x2bf9('0x3')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x2bf9('0x2')],'defaultValue':function(){return _0x2bf9('0x4');}},'notificationSound':{'type':Sequelize[_0x2bf9('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2bf9('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2bf9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2bf9('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2bf9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2bf9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2bf9('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x2bf9('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x27f7c6){if(!_0x27f7c6)this['setDataValue'](_0x2bf9('0x8'),null);this['setDataValue'](_0x2bf9('0x9'),_0x27f7c6);}},'provider':{'type':Sequelize['ENUM'](_0x2bf9('0xa'),'hotmail',_0x2bf9('0xb'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x2bf9('0xc')](_0x2bf9('0xd')))return _0x2bf9('0xe');return this[_0x2bf9('0xc')](_0x2bf9('0xd'));},'set':function(_0x87dabb){if(_0x87dabb===_0x2bf9('0xe'))_0x87dabb=null;return this[_0x2bf9('0xf')](_0x2bf9('0xd'),_0x87dabb);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 56b22bd..ca962a4 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 _0xb90d=['YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmList','List','Contacts','CloudProvider','format','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','sendMail','attach','out','messageId','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','util','path','lodash','juice','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','client','http','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','sendStatus','gmail','yahoo','hotmail','imap-mail.outlook.com','Unknown\x20email\x20service\x20provider','smtp-mail.outlook.com','outlook365','smtp.office365.com','user','username','password','modernAuthentication','CloudProviderId','pass','host','secure','service','authentication','Imap','port','Smtp','index','MailServerIn','MailServerOut','mandatoryDispositionPause','MailAccount','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','findAll','rows','show','Pause','rawAttributes','include','find','body','provider','custom','params','Mail\x20Account\x20not\x20found','describe','addDisposition','create','getDispositions','findOne','Disposition','order','map','removeDispositions','ids','addAnswer','MailAccountId','getAnswers','CannedAnswer','removeAnswers','email','ListId','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getImap','removeImap','setImap','getSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','priority','finally','send','MailApplication','getMessages','MailMessage','$gte','split'];(function(_0x94a6e9,_0x13fa96){var _0x17a531=function(_0x3962fd){while(--_0x3962fd){_0x94a6e9['push'](_0x94a6e9['shift']());}};_0x17a531(++_0x13fa96);}(_0xb90d,0xdd));var _0xdb90=function(_0x2355a4,_0xc0b80d){_0x2355a4=_0x2355a4-0x0;var _0xe22dd=_0xb90d[_0x2355a4];return _0xe22dd;};'use strict';var moment=require(_0xdb90('0x0'));var BPromise=require('bluebird');var util=require(_0xdb90('0x1'));var path=require(_0xdb90('0x2'));var _=require(_0xdb90('0x3'));var juice=require(_0xdb90('0x4'));var Redis=require('ioredis');var qs=require(_0xdb90('0x5'));var logger=require('../../config/logger')(_0xdb90('0x6'));var config=require(_0xdb90('0x7'));var db=require(_0xdb90('0x8'))['db'];config[_0xdb90('0x9')]=_[_0xdb90('0xa')](config['redis'],{'host':_0xdb90('0xb'),'port':0x18eb});var socket=require(_0xdb90('0xc'))(new Redis(config[_0xdb90('0x9')]));require(_0xdb90('0xd'))[_0xdb90('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0xdb90('0xf')][_0xdb90('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x5223a5,_0x4f5b56,_0x699587,_0x18dc29){return new BPromise(function(_0x3e0a66,_0x53eba7){var _0x316269=_0x18dc29||client;return _0x316269['request'](_0x5223a5,_0x699587)[_0xdb90('0x11')](function(_0x38e46a){logger[_0xdb90('0x12')](_0xdb90('0x13'),_0x4f5b56,_0xdb90('0x14'));logger['debug'](_0xdb90('0x15'),_0x4f5b56,'request\x20sent',JSON['stringify'](_0x38e46a));if(_0x38e46a[_0xdb90('0x16')]){if(_0x38e46a[_0xdb90('0x16')][_0xdb90('0x17')]===0x1f4){logger[_0xdb90('0x16')]('MailAccount,\x20%s,\x20%s',_0x4f5b56,_0x38e46a['error'][_0xdb90('0x18')]);return _0x53eba7(_0x38e46a[_0xdb90('0x16')][_0xdb90('0x18')]);}logger[_0xdb90('0x16')]('MailAccount,\x20%s,\x20%s',_0x4f5b56,_0x38e46a['error'][_0xdb90('0x18')]);return _0x3e0a66(_0x38e46a[_0xdb90('0x16')]['message']);}else{logger['info'](_0xdb90('0x13'),_0x4f5b56,'request\x20sent');_0x3e0a66(_0x38e46a['result'][_0xdb90('0x18')]);}})[_0xdb90('0x19')](function(_0x2d73db){logger[_0xdb90('0x16')](_0xdb90('0x13'),_0x4f5b56,_0x2d73db);_0x53eba7(_0x2d73db);});});}function respondWithStatusCode(_0x5974c3,_0x21e7ef){_0x21e7ef=_0x21e7ef||0xcc;return function(_0x589b78){if(_0x589b78){return _0x5974c3['sendStatus'](_0x21e7ef);}return _0x5974c3[_0xdb90('0x1a')](_0x21e7ef)[_0xdb90('0x1b')]();};}function respondWithResult(_0x3d70ef,_0x24c402){_0x24c402=_0x24c402||0xc8;return function(_0x5c6e19){if(_0x5c6e19){return _0x3d70ef[_0xdb90('0x1a')](_0x24c402)[_0xdb90('0x1c')](_0x5c6e19);}};}function respondWithFilteredResult(_0x356788,_0x2ed361){return function(_0x4f11d0){if(_0x4f11d0){var _0x249a01=typeof _0x2ed361[_0xdb90('0x1d')]===_0xdb90('0x1e')&&typeof _0x2ed361[_0xdb90('0x1f')]===_0xdb90('0x1e');var _0x39ab66=_0x4f11d0['count'];var _0x5e4068=_0x249a01?0x0:_0x2ed361[_0xdb90('0x1d')];var _0x30dedc=_0x249a01?_0x4f11d0[_0xdb90('0x20')]:_0x2ed361[_0xdb90('0x1d')]+_0x2ed361[_0xdb90('0x1f')];var _0x169e1e;if(_0x30dedc>=_0x39ab66){_0x30dedc=_0x39ab66;_0x169e1e=0xc8;}else{_0x169e1e=0xce;}_0x356788[_0xdb90('0x1a')](_0x169e1e);return _0x356788[_0xdb90('0x21')](_0xdb90('0x22'),_0x5e4068+'-'+_0x30dedc+'/'+_0x39ab66)[_0xdb90('0x1c')](_0x4f11d0);}return null;};}function saveUpdates(_0x5014d8){return function(_0xf32663){if(_0xf32663){return _0xf32663[_0xdb90('0x23')](_0x5014d8)[_0xdb90('0x11')](function(_0x9448d6){return _0x9448d6;});}return null;};}function removeEntity(_0x693b0e){return function(_0x3a8501){if(_0x3a8501){return _0x3a8501[_0xdb90('0x24')]()[_0xdb90('0x11')](function(){var _0x44e38c=_0x3a8501[_0xdb90('0x25')]({'plain':!![]});var _0x1f16b4=_0xdb90('0x26');return db[_0xdb90('0x27')][_0xdb90('0x24')]({'where':{'type':_0x1f16b4,'resourceId':_0x44e38c['id']}})[_0xdb90('0x11')](function(){return _0x3a8501;});})[_0xdb90('0x11')](function(){_0x693b0e[_0xdb90('0x1a')](0xcc)[_0xdb90('0x1b')]();});}};}function handleEntityNotFound(_0xbaeb6f){return function(_0x5f31c1){if(!_0x5f31c1){_0xbaeb6f[_0xdb90('0x28')](0x194);}return _0x5f31c1;};}function handleError(_0x4aed69,_0x2306c4){_0x2306c4=_0x2306c4||0x1f4;return function(_0x545c10){logger[_0xdb90('0x16')](_0x545c10['stack']);if(_0x545c10['name']){delete _0x545c10['name'];}_0x4aed69[_0xdb90('0x1a')](_0x2306c4)['send'](_0x545c10);};}function getImapHost(_0x4ce3fe){switch(_0x4ce3fe){case _0xdb90('0x29'):return'imap.gmail.com';case _0xdb90('0x2a'):return'imap.mail.yahoo.com';case _0xdb90('0x2b'):return _0xdb90('0x2c');case'outlook365':return'outlook.office365.com';}throw new Error(_0xdb90('0x2d'),_0x4ce3fe);}function getSmtpHost(_0x475c77){switch(_0x475c77){case _0xdb90('0x29'):return'smtp.gmail.com';case _0xdb90('0x2a'):return'smtp.mail.yahoo.com';case _0xdb90('0x2b'):return _0xdb90('0x2e');case _0xdb90('0x2f'):return _0xdb90('0x30');}throw new Error('Unknown\x20email\x20service\x20provider',_0x475c77);}function getAuthenticationOptions(_0x50faf0,_0x55de54){var _0x4aa93b={};var _0x259743={};if(_0x50faf0){_0x4aa93b['user']=_0x259743[_0xdb90('0x31')]=_0x55de54[_0xdb90('0x32')];_0x4aa93b[_0xdb90('0x33')]=_0x259743['pass']=_0x55de54['password'];if(_0x55de54[_0xdb90('0x34')]){_0x4aa93b[_0xdb90('0x34')]=_0x259743[_0xdb90('0x34')]=!![];_0x4aa93b[_0xdb90('0x35')]=_0x259743['CloudProviderId']=_0x55de54['CloudProviderId'];_0x4aa93b['password']=_0x259743[_0xdb90('0x36')]=null;}else{_0x4aa93b['CloudProviderId']=_0x259743['CloudProviderId']=null;}_0x4aa93b['host']=getImapHost(_0x50faf0);_0x4aa93b['port']=0x3e1;_0x259743[_0xdb90('0x37')]=getSmtpHost(_0x50faf0);_0x259743['port']=0x24b;_0x259743[_0xdb90('0x38')]=![];_0x4aa93b[_0xdb90('0x39')]=_0x259743['service']=null;}else{if(_0x55de54[_0xdb90('0x3a')]){_0x4aa93b['user']=_0x259743[_0xdb90('0x31')]=_0x55de54['username'];_0x4aa93b[_0xdb90('0x33')]=_0x259743[_0xdb90('0x36')]=_0x55de54['password'];}else{_0x4aa93b[_0xdb90('0x3a')]=_0x259743[_0xdb90('0x3a')]=![];_0x4aa93b[_0xdb90('0x31')]=_0x259743[_0xdb90('0x31')]=null;_0x4aa93b[_0xdb90('0x33')]=_0x259743[_0xdb90('0x36')]=null;}_0x4aa93b['host']=_0x55de54[_0xdb90('0x3b')][_0xdb90('0x37')];_0x4aa93b['port']=_0x55de54[_0xdb90('0x3b')][_0xdb90('0x3c')];_0x259743[_0xdb90('0x37')]=_0x55de54['Smtp'][_0xdb90('0x37')];_0x259743[_0xdb90('0x3c')]=_0x55de54[_0xdb90('0x3d')]['port'];}return{'Imap':_0x4aa93b,'Smtp':_0x259743};}exports[_0xdb90('0x3e')]=function(_0x4b0c1d,_0x273e45){var _0x3ab781={'include':[{'model':db[_0xdb90('0x3f')],'as':_0xdb90('0x3b')},{'model':db[_0xdb90('0x40')],'as':_0xdb90('0x3d')},{'model':db['Pause'],'as':_0xdb90('0x41')}]},_0x575db8={},_0x32d822={'count':0x0,'rows':[]};var _0x3ff022=_['map'](db[_0xdb90('0x42')]['rawAttributes'],function(_0x532329){return{'name':_0x532329['fieldName'],'type':_0x532329['type'][_0xdb90('0x43')]};});_0x575db8[_0xdb90('0x44')]=_['map'](_0x3ff022,'name');_0x575db8[_0xdb90('0x45')]=_[_0xdb90('0x46')](_0x4b0c1d[_0xdb90('0x45')]);_0x575db8[_0xdb90('0x47')]=_[_0xdb90('0x48')](_0x575db8[_0xdb90('0x44')],_0x575db8[_0xdb90('0x45')]);_0x3ab781[_0xdb90('0x49')]=_['intersection'](_0x575db8[_0xdb90('0x44')],qs['fields'](_0x4b0c1d['query'][_0xdb90('0x4a')]));_0x3ab781[_0xdb90('0x49')]=_0x3ab781['attributes'][_0xdb90('0x4b')]?_0x3ab781['attributes']:_0x575db8[_0xdb90('0x44')];if(!_0x4b0c1d[_0xdb90('0x45')][_0xdb90('0x4c')](_0xdb90('0x4d'))){_0x3ab781[_0xdb90('0x1f')]=qs[_0xdb90('0x1f')](_0x4b0c1d[_0xdb90('0x45')]['limit']);_0x3ab781[_0xdb90('0x1d')]=qs[_0xdb90('0x1d')](_0x4b0c1d[_0xdb90('0x45')][_0xdb90('0x1d')]);}_0x3ab781['order']=qs['sort'](_0x4b0c1d[_0xdb90('0x45')][_0xdb90('0x4e')]);_0x3ab781[_0xdb90('0x4f')]=qs['filters'](_[_0xdb90('0x50')](_0x4b0c1d[_0xdb90('0x45')],_0x575db8[_0xdb90('0x47')]),_0x3ff022);if(_0x4b0c1d[_0xdb90('0x45')][_0xdb90('0x51')]){_0x3ab781[_0xdb90('0x4f')]=_[_0xdb90('0x52')](_0x3ab781[_0xdb90('0x4f')],{'$or':_['map'](_0x3ff022,function(_0x50b347){if(_0x50b347['type']!==_0xdb90('0x53')){var _0x3c624b={};_0x3c624b[_0x50b347[_0xdb90('0x54')]]={'$like':'%'+_0x4b0c1d[_0xdb90('0x45')]['filter']+'%'};return _0x3c624b;}})});}_0x3ab781=_[_0xdb90('0x52')]({},_0x3ab781,_0x4b0c1d[_0xdb90('0x55')]);var _0x1bf85b={'where':_0x3ab781[_0xdb90('0x4f')]};return db['MailAccount'][_0xdb90('0x20')](_0x1bf85b)[_0xdb90('0x11')](function(_0x3936ad){_0x32d822[_0xdb90('0x20')]=_0x3936ad;if(_0x4b0c1d['query'][_0xdb90('0x56')]){_0x3ab781['include']=[{'all':!![]}];}return db[_0xdb90('0x42')][_0xdb90('0x57')](_0x3ab781);})[_0xdb90('0x11')](function(_0x291fb6){_0x32d822[_0xdb90('0x58')]=_0x291fb6;return _0x32d822;})[_0xdb90('0x11')](respondWithFilteredResult(_0x273e45,_0x3ab781))[_0xdb90('0x19')](handleError(_0x273e45,null));};exports[_0xdb90('0x59')]=function(_0x368555,_0x5162c7){var _0x222ecb={'raw':![],'where':{'id':_0x368555['params']['id']},'include':[{'model':db[_0xdb90('0x3f')],'as':_0xdb90('0x3b')},{'model':db[_0xdb90('0x40')],'as':'Smtp'},{'model':db[_0xdb90('0x5a')],'as':_0xdb90('0x41')}]},_0xed0b37={};_0xed0b37['model']=_[_0xdb90('0x46')](db[_0xdb90('0x42')][_0xdb90('0x5b')]);_0xed0b37['query']=_[_0xdb90('0x46')](_0x368555['query']);_0xed0b37[_0xdb90('0x47')]=_['intersection'](_0xed0b37['model'],_0xed0b37[_0xdb90('0x45')]);_0x222ecb[_0xdb90('0x49')]=_[_0xdb90('0x48')](_0xed0b37[_0xdb90('0x44')],qs['fields'](_0x368555[_0xdb90('0x45')][_0xdb90('0x4a')]));_0x222ecb[_0xdb90('0x49')]=_0x222ecb[_0xdb90('0x49')][_0xdb90('0x4b')]?_0x222ecb['attributes']:_0xed0b37[_0xdb90('0x44')];if(_0x368555[_0xdb90('0x45')][_0xdb90('0x56')]){_0x222ecb[_0xdb90('0x5c')]=[{'all':!![]}];}_0x222ecb=_[_0xdb90('0x52')]({},_0x222ecb,_0x368555[_0xdb90('0x55')]);return db[_0xdb90('0x42')][_0xdb90('0x5d')](_0x222ecb)['then'](handleEntityNotFound(_0x5162c7,null))[_0xdb90('0x11')](respondWithResult(_0x5162c7,null))[_0xdb90('0x19')](handleError(_0x5162c7,null));};exports['update']=function(_0x20cd5e,_0x497cda){if(_0x20cd5e[_0xdb90('0x5e')]['id']){delete _0x20cd5e['body']['id'];}var _0x4f184f=_0x20cd5e[_0xdb90('0x5e')][_0xdb90('0x5f')]===_0xdb90('0x60')?null:_0x20cd5e[_0xdb90('0x5e')]['provider'];var _0x54ce32=_0x20cd5e[_0xdb90('0x5e')][_0xdb90('0x3b')]||{};var _0x2c5db0=_0x20cd5e['body'][_0xdb90('0x3d')]||{};if(_0x4f184f){_0x54ce32[_0xdb90('0x37')]=getImapHost(_0x4f184f);_0x54ce32[_0xdb90('0x3c')]=0x3e1;_0x2c5db0[_0xdb90('0x37')]=getSmtpHost(_0x4f184f);_0x2c5db0[_0xdb90('0x3c')]=0x24b;_0x2c5db0[_0xdb90('0x38')]=![];}if(_0x2c5db0['modernAuthentication']){_0x2c5db0['secure']=![];}else{_0x2c5db0[_0xdb90('0x35')]=null;}if(!_0x54ce32['modernAuthentication'])_0x54ce32[_0xdb90('0x35')]=null;_0x20cd5e[_0xdb90('0x5e')][_0xdb90('0x3b')]=_0x54ce32;_0x20cd5e[_0xdb90('0x5e')]['Smtp']=_0x2c5db0;return db[_0xdb90('0x42')]['find']({'where':{'id':_0x20cd5e[_0xdb90('0x61')]['id']},'include':[{'model':db[_0xdb90('0x3f')],'as':_0xdb90('0x3b')},{'model':db['MailServerOut'],'as':_0xdb90('0x3d')},{'model':db['Pause'],'as':_0xdb90('0x41')}]})['then'](handleEntityNotFound(_0x497cda,null))[_0xdb90('0x11')](function(_0x53344f){if(!_0x53344f)throw new Error(_0xdb90('0x62'));if(_0x53344f['service'])delete _0x20cd5e['body'][_0xdb90('0x3b')];return _0x53344f;})['then'](saveUpdates(_0x20cd5e[_0xdb90('0x5e')],null))[_0xdb90('0x11')](function(_0x1a4ab0){if(!_0x20cd5e[_0xdb90('0x5e')]['Imap'])return _0x1a4ab0;return db[_0xdb90('0x3f')][_0xdb90('0x23')](_0x20cd5e[_0xdb90('0x5e')][_0xdb90('0x3b')],{'where':{'MailAccountId':_0x1a4ab0['id']}})[_0xdb90('0x11')](function(){return _0x1a4ab0;});})[_0xdb90('0x11')](function(_0x1a51b8){if(!_0x20cd5e[_0xdb90('0x5e')][_0xdb90('0x3d')])return _0x1a51b8;return db[_0xdb90('0x40')][_0xdb90('0x23')](_0x20cd5e[_0xdb90('0x5e')][_0xdb90('0x3d')],{'where':{'MailAccountId':_0x1a51b8['id']}})[_0xdb90('0x11')](function(){return _0x1a51b8;});})[_0xdb90('0x11')](respondWithResult(_0x497cda,null))[_0xdb90('0x19')](handleError(_0x497cda,null));};exports['describe']=function(_0x25f837,_0x2147aa){return db[_0xdb90('0x42')][_0xdb90('0x63')]()[_0xdb90('0x11')](respondWithResult(_0x2147aa,null))[_0xdb90('0x19')](handleError(_0x2147aa,null));};exports[_0xdb90('0x64')]=function(_0x348e2f,_0xc82131){if(_0x348e2f[_0xdb90('0x5e')]['id']){delete _0x348e2f[_0xdb90('0x5e')]['id'];}return db[_0xdb90('0x42')][_0xdb90('0x5d')]({'where':{'id':_0x348e2f[_0xdb90('0x61')]['id']}})[_0xdb90('0x11')](handleEntityNotFound(_0xc82131,null))[_0xdb90('0x11')](function(_0x5780fc){if(_0x5780fc){_0x348e2f[_0xdb90('0x5e')]['MailAccountId']=_0x5780fc['id'];return db['Disposition'][_0xdb90('0x65')](_0x348e2f[_0xdb90('0x5e')]);}})[_0xdb90('0x11')](respondWithResult(_0xc82131,null))[_0xdb90('0x19')](handleError(_0xc82131,null));};exports[_0xdb90('0x66')]=function(_0x4d8cd8,_0x568caf){var _0x26de1e={'raw':![],'where':{}};var _0x7085fc={};var _0x36e346={'count':0x0,'rows':[]};return db['MailAccount'][_0xdb90('0x67')]({'where':{'id':_0x4d8cd8[_0xdb90('0x61')]['id']}})['then'](handleEntityNotFound(_0x568caf,null))[_0xdb90('0x11')](function(_0x3d5d4b){if(_0x3d5d4b){_0x7085fc[_0xdb90('0x44')]=_[_0xdb90('0x46')](db[_0xdb90('0x68')][_0xdb90('0x5b')]);_0x7085fc[_0xdb90('0x45')]=_['keys'](_0x4d8cd8[_0xdb90('0x45')]);_0x7085fc[_0xdb90('0x47')]=_['intersection'](_0x7085fc[_0xdb90('0x44')],_0x7085fc[_0xdb90('0x45')]);_0x26de1e[_0xdb90('0x49')]=_[_0xdb90('0x48')](_0x7085fc[_0xdb90('0x44')],qs[_0xdb90('0x4a')](_0x4d8cd8['query'][_0xdb90('0x4a')]));_0x26de1e[_0xdb90('0x49')]=_0x26de1e[_0xdb90('0x49')][_0xdb90('0x4b')]?_0x26de1e['attributes']:_0x7085fc[_0xdb90('0x44')];if(!_0x4d8cd8[_0xdb90('0x45')][_0xdb90('0x4c')]('nolimit')){_0x26de1e[_0xdb90('0x1f')]=qs[_0xdb90('0x1f')](_0x4d8cd8[_0xdb90('0x45')][_0xdb90('0x1f')]);_0x26de1e['offset']=qs[_0xdb90('0x1d')](_0x4d8cd8[_0xdb90('0x45')][_0xdb90('0x1d')]);}_0x26de1e[_0xdb90('0x69')]=qs['sort'](_0x4d8cd8[_0xdb90('0x45')][_0xdb90('0x4e')]);_0x26de1e[_0xdb90('0x4f')]=qs[_0xdb90('0x47')](_[_0xdb90('0x50')](_0x4d8cd8[_0xdb90('0x45')],_0x7085fc[_0xdb90('0x47')]));_0x26de1e[_0xdb90('0x4f')]['MailAccountId']=_0x3d5d4b['id'];if(_0x4d8cd8[_0xdb90('0x45')][_0xdb90('0x51')]){_0x26de1e[_0xdb90('0x4f')]=_[_0xdb90('0x52')](_0x26de1e[_0xdb90('0x4f')],{'$or':_[_0xdb90('0x6a')](_0x26de1e[_0xdb90('0x49')],function(_0x4fea4b){var _0x32935e={};_0x32935e[_0x4fea4b]={'$like':'%'+_0x4d8cd8['query']['filter']+'%'};return _0x32935e;})});}_0x26de1e=_[_0xdb90('0x52')]({},_0x26de1e,_0x4d8cd8[_0xdb90('0x55')]);return db['Disposition'][_0xdb90('0x20')]({'where':_0x26de1e[_0xdb90('0x4f')]})['then'](function(_0x576476){_0x36e346[_0xdb90('0x20')]=_0x576476;if(_0x4d8cd8['query'][_0xdb90('0x56')]){_0x26de1e[_0xdb90('0x5c')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x26de1e);})[_0xdb90('0x11')](function(_0x2b561e){_0x36e346[_0xdb90('0x58')]=_0x2b561e;return _0x36e346;});}})[_0xdb90('0x11')](respondWithFilteredResult(_0x568caf,_0x26de1e))[_0xdb90('0x19')](handleError(_0x568caf,null));};exports[_0xdb90('0x6b')]=function(_0x104621,_0x447401){return db[_0xdb90('0x42')][_0xdb90('0x5d')]({'where':{'id':_0x104621['params']['id']}})[_0xdb90('0x11')](handleEntityNotFound(_0x447401,null))[_0xdb90('0x11')](function(_0x168c6a){if(_0x168c6a){return _0x168c6a[_0xdb90('0x6b')](_0x104621['query'][_0xdb90('0x6c')]);}})[_0xdb90('0x11')](respondWithStatusCode(_0x447401,null))[_0xdb90('0x19')](handleError(_0x447401,null));};exports[_0xdb90('0x6d')]=function(_0x2d11de,_0x34a808){if(_0x2d11de['body']['id']){delete _0x2d11de[_0xdb90('0x5e')]['id'];}return db['MailAccount'][_0xdb90('0x5d')]({'where':{'id':_0x2d11de[_0xdb90('0x61')]['id']}})[_0xdb90('0x11')](handleEntityNotFound(_0x34a808,null))[_0xdb90('0x11')](function(_0x3629a2){if(_0x3629a2){_0x2d11de['body'][_0xdb90('0x6e')]=_0x3629a2['id'];return db['CannedAnswer'][_0xdb90('0x65')](_0x2d11de[_0xdb90('0x5e')]);}})['then'](respondWithResult(_0x34a808,null))[_0xdb90('0x19')](handleError(_0x34a808,null));};exports[_0xdb90('0x6f')]=function(_0x21ea02,_0x125c64){var _0x4d5bc3={'raw':![],'where':{}};var _0x13acd2={};var _0x1b5d6b={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x21ea02['params']['id']}})[_0xdb90('0x11')](handleEntityNotFound(_0x125c64,null))[_0xdb90('0x11')](function(_0xfb9437){if(_0xfb9437){_0x13acd2[_0xdb90('0x44')]=_[_0xdb90('0x46')](db[_0xdb90('0x70')][_0xdb90('0x5b')]);_0x13acd2[_0xdb90('0x45')]=_[_0xdb90('0x46')](_0x21ea02['query']);_0x13acd2['filters']=_[_0xdb90('0x48')](_0x13acd2[_0xdb90('0x44')],_0x13acd2[_0xdb90('0x45')]);_0x4d5bc3[_0xdb90('0x49')]=_[_0xdb90('0x48')](_0x13acd2[_0xdb90('0x44')],qs[_0xdb90('0x4a')](_0x21ea02[_0xdb90('0x45')][_0xdb90('0x4a')]));_0x4d5bc3[_0xdb90('0x49')]=_0x4d5bc3[_0xdb90('0x49')][_0xdb90('0x4b')]?_0x4d5bc3[_0xdb90('0x49')]:_0x13acd2[_0xdb90('0x44')];if(!_0x21ea02[_0xdb90('0x45')]['hasOwnProperty'](_0xdb90('0x4d'))){_0x4d5bc3[_0xdb90('0x1f')]=qs[_0xdb90('0x1f')](_0x21ea02[_0xdb90('0x45')][_0xdb90('0x1f')]);_0x4d5bc3[_0xdb90('0x1d')]=qs['offset'](_0x21ea02[_0xdb90('0x45')][_0xdb90('0x1d')]);}_0x4d5bc3[_0xdb90('0x69')]=qs[_0xdb90('0x4e')](_0x21ea02[_0xdb90('0x45')]['sort']);_0x4d5bc3['where']=qs[_0xdb90('0x47')](_[_0xdb90('0x50')](_0x21ea02[_0xdb90('0x45')],_0x13acd2['filters']));_0x4d5bc3[_0xdb90('0x4f')][_0xdb90('0x6e')]=_0xfb9437['id'];if(_0x21ea02['query'][_0xdb90('0x51')]){_0x4d5bc3[_0xdb90('0x4f')]=_[_0xdb90('0x52')](_0x4d5bc3[_0xdb90('0x4f')],{'$or':_[_0xdb90('0x6a')](_0x4d5bc3[_0xdb90('0x49')],function(_0x1d42a8){var _0x58f89b={};_0x58f89b[_0x1d42a8]={'$like':'%'+_0x21ea02[_0xdb90('0x45')][_0xdb90('0x51')]+'%'};return _0x58f89b;})});}_0x4d5bc3=_['merge']({},_0x4d5bc3,_0x21ea02[_0xdb90('0x55')]);return db[_0xdb90('0x70')]['count']({'where':_0x4d5bc3[_0xdb90('0x4f')]})['then'](function(_0x483fea){_0x1b5d6b[_0xdb90('0x20')]=_0x483fea;if(_0x21ea02[_0xdb90('0x45')]['includeAll']){_0x4d5bc3['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xdb90('0x57')](_0x4d5bc3);})[_0xdb90('0x11')](function(_0x30ae5b){_0x1b5d6b[_0xdb90('0x58')]=_0x30ae5b;return _0x1b5d6b;});}})[_0xdb90('0x11')](respondWithFilteredResult(_0x125c64,_0x4d5bc3))[_0xdb90('0x19')](handleError(_0x125c64,null));};exports['removeAnswers']=function(_0x5f2aa7,_0x109646){return db['MailAccount']['find']({'where':{'id':_0x5f2aa7[_0xdb90('0x61')]['id']}})['then'](handleEntityNotFound(_0x109646,null))[_0xdb90('0x11')](function(_0x23c802){if(_0x23c802){return _0x23c802[_0xdb90('0x71')](_0x5f2aa7[_0xdb90('0x45')][_0xdb90('0x6c')]);}})[_0xdb90('0x11')](respondWithStatusCode(_0x109646,null))[_0xdb90('0x19')](handleError(_0x109646,null));};exports['create']=function(_0x3c3412,_0x11fa8a){var _0x383971={'name':_0x3c3412[_0xdb90('0x5e')][_0xdb90('0x54')],'key':_0x3c3412[_0xdb90('0x5e')][_0xdb90('0x43')],'provider':_0x3c3412[_0xdb90('0x5e')]['provider']===_0xdb90('0x60')?null:_0x3c3412[_0xdb90('0x5e')][_0xdb90('0x5f')],'email':_0x3c3412[_0xdb90('0x5e')][_0xdb90('0x72')],'ListId':_0x3c3412[_0xdb90('0x5e')][_0xdb90('0x73')],'active':!_[_0xdb90('0x74')](_0x3c3412['body']['active'])?_0x3c3412[_0xdb90('0x5e')][_0xdb90('0x75')]:!![],'description':_0x3c3412['body']['description']||null};var _0x236c9c=getAuthenticationOptions(_0x383971[_0xdb90('0x5f')],_0x3c3412[_0xdb90('0x5e')]);_0x383971[_0xdb90('0x3b')]=_0x236c9c['Imap'];_0x383971['Smtp']=_0x236c9c[_0xdb90('0x3d')];return db[_0xdb90('0x42')]['create'](_0x383971,{'include':[{'model':db[_0xdb90('0x40')],'as':_0xdb90('0x3d')},{'model':db[_0xdb90('0x3f')],'as':_0xdb90('0x3b')}]})[_0xdb90('0x11')](function(_0x30d5c2){var _0x2c4905=_0x3c3412['user']['get']({'plain':!![]});if(!_0x2c4905)throw new Error(_0xdb90('0x76'));if(_0x2c4905[_0xdb90('0x77')]===_0xdb90('0x31')){var _0xb0bb62=_0x30d5c2[_0xdb90('0x25')]({'plain':!![]});return db[_0xdb90('0x78')][_0xdb90('0x5d')]({'where':{'name':_0xdb90('0x26'),'userProfileId':_0x2c4905[_0xdb90('0x79')]},'raw':!![]})[_0xdb90('0x11')](function(_0x179e11){if(_0x179e11&&_0x179e11[_0xdb90('0x7a')]===0x0){return db['UserProfileResource'][_0xdb90('0x65')]({'name':_0xb0bb62[_0xdb90('0x54')],'resourceId':_0xb0bb62['id'],'type':_0x179e11[_0xdb90('0x54')],'sectionId':_0x179e11['id']},{})[_0xdb90('0x11')](function(){return _0x30d5c2;});}else{return _0x30d5c2;}})[_0xdb90('0x19')](function(_0x1247fa){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1247fa);throw _0x1247fa;});}return _0x30d5c2;})[_0xdb90('0x11')](respondWithResult(_0x11fa8a,0xc9))['catch'](handleError(_0x11fa8a,null));};exports[_0xdb90('0x7b')]=function(_0xea1e56,_0x3f5757){return db[_0xdb90('0x42')][_0xdb90('0x67')]({'where':{'id':_0xea1e56[_0xdb90('0x61')]['id']}})[_0xdb90('0x11')](handleEntityNotFound(_0x3f5757,null))['then'](function(_0x4e6b58){if(_0x4e6b58){return _0x4e6b58[_0xdb90('0x7b')]();}return null;})['then'](respondWithResult(_0x3f5757,null))[_0xdb90('0x19')](handleError(_0x3f5757,null));};exports['addImap']=function(_0xefbad3,_0xd57302){if(_0xefbad3[_0xdb90('0x5e')]['id']){delete _0xefbad3[_0xdb90('0x5e')]['id'];}return db['MailAccount'][_0xdb90('0x5d')]({'where':{'id':_0xefbad3[_0xdb90('0x61')]['id']}})[_0xdb90('0x11')](handleEntityNotFound(_0xd57302,null))[_0xdb90('0x11')](function(_0x21d90b){if(_0x21d90b){_0xefbad3['body'][_0xdb90('0x6e')]=_0x21d90b['id'];return db['MailServerIn'][_0xdb90('0x65')](_0xefbad3[_0xdb90('0x5e')]);}})[_0xdb90('0x11')](respondWithResult(_0xd57302,null))['catch'](handleError(_0xd57302,null));};exports[_0xdb90('0x7c')]=function(_0x4a436f,_0x393c8e){return db[_0xdb90('0x42')][_0xdb90('0x67')]({'where':{'id':_0x4a436f['params']['id']}})[_0xdb90('0x11')](handleEntityNotFound(_0x393c8e,null))[_0xdb90('0x11')](function(_0x265ae5){if(_0x265ae5){return _0x265ae5[_0xdb90('0x7d')](null);}return null;})[_0xdb90('0x11')](respondWithStatusCode(_0x393c8e,null))[_0xdb90('0x19')](handleError(_0x393c8e,null));};exports[_0xdb90('0x7e')]=function(_0x3ab757,_0x1c2602){return db['MailAccount'][_0xdb90('0x67')]({'where':{'id':_0x3ab757['params']['id']}})[_0xdb90('0x11')](handleEntityNotFound(_0x1c2602,null))[_0xdb90('0x11')](function(_0x58edf1){if(_0x58edf1){return _0x58edf1[_0xdb90('0x7e')]();}return null;})[_0xdb90('0x11')](respondWithResult(_0x1c2602,null))[_0xdb90('0x19')](handleError(_0x1c2602,null));};exports['addSmtp']=function(_0x1e1edb,_0x5d358f){if(_0x1e1edb[_0xdb90('0x5e')]['id']){delete _0x1e1edb[_0xdb90('0x5e')]['id'];}return db[_0xdb90('0x42')][_0xdb90('0x5d')]({'where':{'id':_0x1e1edb[_0xdb90('0x61')]['id']}})[_0xdb90('0x11')](handleEntityNotFound(_0x5d358f,null))[_0xdb90('0x11')](function(_0x389cd1){if(_0x389cd1){_0x1e1edb['body'][_0xdb90('0x6e')]=_0x389cd1['id'];return db[_0xdb90('0x40')][_0xdb90('0x65')](_0x1e1edb[_0xdb90('0x5e')]);}})['then'](respondWithResult(_0x5d358f,null))['catch'](handleError(_0x5d358f,null));};exports['removeSmtp']=function(_0x39b32b,_0x4ebb0e){return db[_0xdb90('0x42')]['findOne']({'where':{'id':_0x39b32b[_0xdb90('0x61')]['id']}})[_0xdb90('0x11')](handleEntityNotFound(_0x4ebb0e,null))[_0xdb90('0x11')](function(_0x62e727){if(_0x62e727){return _0x62e727[_0xdb90('0x7f')](null);}return null;})[_0xdb90('0x11')](respondWithStatusCode(_0x4ebb0e,null))[_0xdb90('0x19')](handleError(_0x4ebb0e,null));};exports[_0xdb90('0x80')]=function(_0x1602a5,_0x50cfbb){return db[_0xdb90('0x81')]['find']({'where':{'id':_0x1602a5['params']['id']}})['then'](handleEntityNotFound(_0x50cfbb,null))[_0xdb90('0x11')](function(_0x156552){if(_0x156552){return _0x156552[_0xdb90('0x80')](_0x1602a5[_0xdb90('0x5e')]['ids'],_[_0xdb90('0x82')](_0x1602a5[_0xdb90('0x5e')],['ids','id'])||{});}})[_0xdb90('0x11')](respondWithResult(_0x50cfbb,null))[_0xdb90('0x19')](handleError(_0x50cfbb,null));};exports[_0xdb90('0x83')]=function(_0xacac61,_0x485895){var _0xc85b08={'raw':![],'where':{}};var _0x3944d0={};var _0x3ed1d0={'count':0x0,'rows':[]};return db[_0xdb90('0x42')][_0xdb90('0x67')]({'where':{'id':_0xacac61[_0xdb90('0x61')]['id']}})['then'](handleEntityNotFound(_0x485895,null))[_0xdb90('0x11')](function(_0x307e7a){if(_0x307e7a){_0x3944d0[_0xdb90('0x44')]=_['keys'](db[_0xdb90('0x81')][_0xdb90('0x5b')]);_0x3944d0[_0xdb90('0x45')]=_[_0xdb90('0x46')](_0xacac61['query']);_0x3944d0[_0xdb90('0x47')]=_[_0xdb90('0x48')](_0x3944d0[_0xdb90('0x44')],_0x3944d0[_0xdb90('0x45')]);_0xc85b08[_0xdb90('0x49')]=_[_0xdb90('0x48')](_0x3944d0[_0xdb90('0x44')],qs[_0xdb90('0x4a')](_0xacac61[_0xdb90('0x45')][_0xdb90('0x4a')]));_0xc85b08[_0xdb90('0x49')]=_0xc85b08[_0xdb90('0x49')]['length']?_0xc85b08[_0xdb90('0x49')]:_0x3944d0[_0xdb90('0x44')];if(!_0xacac61[_0xdb90('0x45')][_0xdb90('0x4c')](_0xdb90('0x4d'))){_0xc85b08[_0xdb90('0x1f')]=qs[_0xdb90('0x1f')](_0xacac61[_0xdb90('0x45')]['limit']);_0xc85b08[_0xdb90('0x1d')]=qs[_0xdb90('0x1d')](_0xacac61[_0xdb90('0x45')][_0xdb90('0x1d')]);}_0xc85b08[_0xdb90('0x69')]=qs[_0xdb90('0x4e')](_0xacac61[_0xdb90('0x45')][_0xdb90('0x4e')]);_0xc85b08[_0xdb90('0x4f')]=qs[_0xdb90('0x47')](_[_0xdb90('0x50')](_0xacac61['query'],_0x3944d0[_0xdb90('0x47')]));_0xc85b08['where'][_0xdb90('0x6e')]=_0x307e7a['id'];if(_0xacac61[_0xdb90('0x45')][_0xdb90('0x51')]){_0xc85b08[_0xdb90('0x4f')]=_[_0xdb90('0x52')](_0xc85b08[_0xdb90('0x4f')],{'$or':_[_0xdb90('0x6a')](_0xc85b08[_0xdb90('0x49')],function(_0x4c16b8){var _0x15299e={};_0x15299e[_0x4c16b8]={'$like':'%'+_0xacac61['query']['filter']+'%'};return _0x15299e;})});}_0xc85b08=_[_0xdb90('0x52')]({},_0xc85b08,_0xacac61['options']);return db['MailInteraction'][_0xdb90('0x20')]({'where':_0xc85b08[_0xdb90('0x4f')]})[_0xdb90('0x11')](function(_0x3c63fa){_0x3ed1d0[_0xdb90('0x20')]=_0x3c63fa;if(_0xacac61[_0xdb90('0x45')][_0xdb90('0x56')]){_0xc85b08[_0xdb90('0x5c')]=[{'model':db[_0xdb90('0x84')],'as':_0xdb90('0x85'),'required':![]},{'model':db['User'],'as':_0xdb90('0x86'),'attributes':['name',_0xdb90('0x87'),_0xdb90('0x88')],'required':![]},{'model':db[_0xdb90('0x89')],'as':_0xdb90('0x8a'),'attributes':['id',_0xdb90('0x54'),_0xdb90('0x8b')],'where':_0xacac61[_0xdb90('0x45')]['tag']?{'id':_0xacac61[_0xdb90('0x45')][_0xdb90('0x8c')]}:undefined,'required':_0xacac61[_0xdb90('0x45')][_0xdb90('0x8c')]?!![]:![]}];}return db[_0xdb90('0x81')]['findAll'](_0xc85b08);})['then'](function(_0x129ca2){_0x3ed1d0[_0xdb90('0x58')]=_0x129ca2;return _0x3ed1d0;});}})[_0xdb90('0x11')](respondWithFilteredResult(_0x485895,_0xc85b08))['catch'](handleError(_0x485895,null));};exports[_0xdb90('0x8d')]=function addApplications(_0x531e9a,_0x1e1c47){var _0x3b9d25=_0x531e9a[_0xdb90('0x61')]['id'];var _0x10d8a5=_0x531e9a[_0xdb90('0x5e')];var _0x4da41e=0xc8;var _0x5a8031=null;return db[_0xdb90('0x8e')]['transaction']({'isolationLevel':db['sequelize'][_0xdb90('0x8f')][_0xdb90('0x90')]['READ_COMMITTED']},function(_0x517251){return db[_0xdb90('0x42')][_0xdb90('0x67')]({'where':{'id':_0x3b9d25},'transaction':_0x517251})[_0xdb90('0x11')](function(_0x587cc3){if(_0x587cc3){return db['MailApplication'][_0xdb90('0x24')]({'where':{'MailAccountId':_0x3b9d25},'transaction':_0x517251})[_0xdb90('0x11')](function(){var _0x5cf81f=_['map'](_0x10d8a5,function(_0x2c2246){_0x2c2246[_0xdb90('0x6e')]=_0x3b9d25;return _0x2c2246;});return db['MailApplication'][_0xdb90('0x91')](_0x5cf81f,{'transaction':_0x517251});});}else{_0x4da41e=0x194;_0x5a8031=[];}});})[_0xdb90('0x11')](function(){if(_0x4da41e!==0x194){return db['MailApplication'][_0xdb90('0x92')]({'where':{'MailAccountId':_0x3b9d25},'order':_0xdb90('0x93')})[_0xdb90('0x11')](function(_0x3e9cc2){_0x5a8031=_0x3e9cc2;});}})[_0xdb90('0x19')](function(_0x3d1680){_0x4da41e=0x1f4;logger[_0xdb90('0x16')](_0x3d1680['stack']);if(_0x3d1680[_0xdb90('0x54')]){delete _0x3d1680[_0xdb90('0x54')];}_0x5a8031=_0x3d1680;})[_0xdb90('0x94')](function(){if(_0x5a8031===null){_0x1e1c47[_0xdb90('0x28')](_0x4da41e);}else{if(_0x4da41e===0x1f4){_0x1e1c47['status'](_0x4da41e)[_0xdb90('0x95')](_0x5a8031);}else{_0x1e1c47[_0xdb90('0x1a')](_0x4da41e)[_0xdb90('0x1c')](_0x5a8031);}}});};exports['getApplications']=function(_0x44fe62,_0x531e24){var _0x1d15dc={};var _0x1e16ed={};var _0x29b5fa;var _0x2f2ec0;return db[_0xdb90('0x42')]['findOne']({'where':{'id':_0x44fe62[_0xdb90('0x61')]['id']}})[_0xdb90('0x11')](handleEntityNotFound(_0x531e24,null))['then'](function(_0x294fd4){if(_0x294fd4){_0x29b5fa=_0x294fd4;_0x1e16ed[_0xdb90('0x44')]=_[_0xdb90('0x46')](db[_0xdb90('0x96')][_0xdb90('0x5b')]);_0x1e16ed[_0xdb90('0x45')]=_[_0xdb90('0x46')](_0x44fe62[_0xdb90('0x45')]);_0x1e16ed['filters']=_['intersection'](_0x1e16ed[_0xdb90('0x44')],_0x1e16ed[_0xdb90('0x45')]);_0x1d15dc[_0xdb90('0x49')]=_[_0xdb90('0x48')](_0x1e16ed['model'],qs[_0xdb90('0x4a')](_0x44fe62[_0xdb90('0x45')][_0xdb90('0x4a')]));_0x1d15dc[_0xdb90('0x49')]=_0x1d15dc['attributes'][_0xdb90('0x4b')]?_0x1d15dc[_0xdb90('0x49')]:_0x1e16ed['model'];_0x1d15dc['order']=qs[_0xdb90('0x4e')](_0x44fe62[_0xdb90('0x45')]['sort']);_0x1d15dc['where']=qs[_0xdb90('0x47')](_[_0xdb90('0x50')](_0x44fe62[_0xdb90('0x45')],_0x1e16ed[_0xdb90('0x47')]));if(_0x44fe62['query']['filter']){_0x1d15dc[_0xdb90('0x4f')]=_[_0xdb90('0x52')](_0x1d15dc[_0xdb90('0x4f')],{'$or':_[_0xdb90('0x6a')](_0x1d15dc['attributes'],function(_0xf8e956){var _0x40fd43={};_0x40fd43[_0xf8e956]={'$like':'%'+_0x44fe62[_0xdb90('0x45')][_0xdb90('0x51')]+'%'};return _0x40fd43;})});}_0x1d15dc=_[_0xdb90('0x52')]({},_0x1d15dc,_0x44fe62[_0xdb90('0x55')]);return _0x29b5fa['getApplications'](_0x1d15dc);}})[_0xdb90('0x11')](function(_0x33a24f){if(_0x33a24f){_0x2f2ec0=_0x33a24f['length'];if(!_0x44fe62[_0xdb90('0x45')]['hasOwnProperty'](_0xdb90('0x4d'))){_0x1d15dc[_0xdb90('0x1f')]=qs[_0xdb90('0x1f')](_0x44fe62[_0xdb90('0x45')][_0xdb90('0x1f')]);_0x1d15dc[_0xdb90('0x1d')]=qs[_0xdb90('0x1d')](_0x44fe62[_0xdb90('0x45')][_0xdb90('0x1d')]);}return _0x29b5fa['getApplications'](_0x1d15dc);}})[_0xdb90('0x11')](function(_0x4c7e85){if(_0x4c7e85){return _0x4c7e85?{'count':_0x2f2ec0,'rows':_0x4c7e85}:null;}})['then'](respondWithResult(_0x531e24,null))[_0xdb90('0x19')](handleError(_0x531e24,null));};exports[_0xdb90('0x97')]=function(_0x27bbda,_0x3670a9){var _0x3aefd6={'raw':!![],'where':{}};var _0x28e5e1={};var _0x491a48={'count':0x0,'rows':[]};return db[_0xdb90('0x42')][_0xdb90('0x67')]({'where':{'id':_0x27bbda['params']['id']}})[_0xdb90('0x11')](handleEntityNotFound(_0x3670a9,null))[_0xdb90('0x11')](function(_0x10a6d7){if(_0x10a6d7){_0x28e5e1['model']=_['keys'](db[_0xdb90('0x98')][_0xdb90('0x5b')]);_0x28e5e1['query']=_[_0xdb90('0x46')](_0x27bbda[_0xdb90('0x45')]);_0x28e5e1[_0xdb90('0x47')]=_['intersection'](_0x28e5e1[_0xdb90('0x44')],_0x28e5e1['query']);_0x3aefd6[_0xdb90('0x49')]=_['intersection'](_0x28e5e1[_0xdb90('0x44')],qs[_0xdb90('0x4a')](_0x27bbda[_0xdb90('0x45')][_0xdb90('0x4a')]));_0x3aefd6[_0xdb90('0x49')]=_0x3aefd6[_0xdb90('0x49')]['length']?_0x3aefd6[_0xdb90('0x49')]:_0x28e5e1['model'];if(!_0x27bbda[_0xdb90('0x45')][_0xdb90('0x4c')](_0xdb90('0x4d'))){_0x3aefd6[_0xdb90('0x1f')]=qs[_0xdb90('0x1f')](_0x27bbda['query'][_0xdb90('0x1f')]);_0x3aefd6['offset']=qs['offset'](_0x27bbda[_0xdb90('0x45')][_0xdb90('0x1d')]);}_0x3aefd6[_0xdb90('0x69')]=qs[_0xdb90('0x4e')](_0x27bbda[_0xdb90('0x45')][_0xdb90('0x4e')]);_0x3aefd6[_0xdb90('0x4f')]=qs['filters'](_['pick'](_0x27bbda['query'],_0x28e5e1[_0xdb90('0x47')]));_0x3aefd6[_0xdb90('0x4f')][_0xdb90('0x6e')]=_0x10a6d7['id'];if(_0x27bbda[_0xdb90('0x45')][_0xdb90('0x51')]){_0x3aefd6[_0xdb90('0x4f')]=_[_0xdb90('0x52')](_0x3aefd6[_0xdb90('0x4f')],{'$or':_[_0xdb90('0x6a')](_0x3aefd6[_0xdb90('0x49')],function(_0x303d4d){var _0x1aba69={};_0x1aba69[_0x303d4d]={'$like':'%'+_0x27bbda[_0xdb90('0x45')][_0xdb90('0x51')]+'%'};return _0x1aba69;})});}if(_0x27bbda[_0xdb90('0x45')][_0xdb90('0x99')]){var _0x3a2c4b=_0x27bbda[_0xdb90('0x45')]['$gte'][_0xdb90('0x9a')](',');var _0x5a7835={};_0x5a7835[_0x3a2c4b[0x0]]={'$gte':moment(_0x3a2c4b[0x1])['format'](_0xdb90('0x9b'))};_0x3aefd6[_0xdb90('0x4f')]=_[_0xdb90('0x52')](_0x3aefd6[_0xdb90('0x4f')],_0x5a7835);}_0x3aefd6=_[_0xdb90('0x52')]({},_0x3aefd6,_0x27bbda[_0xdb90('0x55')]);return db[_0xdb90('0x98')][_0xdb90('0x20')]({'where':_0x3aefd6[_0xdb90('0x4f')]})['then'](function(_0x5859d5){_0x491a48[_0xdb90('0x20')]=_0x5859d5;if(_0x27bbda[_0xdb90('0x45')][_0xdb90('0x56')]){_0x3aefd6[_0xdb90('0x5c')]=[{'all':!![]}];}return db['MailMessage'][_0xdb90('0x57')](_0x3aefd6);})[_0xdb90('0x11')](function(_0x423c1f){if(_0x27bbda[_0xdb90('0x45')][_0xdb90('0x9c')]==='true'){for(var _0x100af6=0x0;_0x100af6<_0x423c1f[_0xdb90('0x4b')];_0x100af6++){_0x423c1f[_0x100af6][_0xdb90('0x5e')]=juice(_0x423c1f[_0x100af6][_0xdb90('0x5e')]);}}_0x491a48[_0xdb90('0x58')]=_0x423c1f;return _0x491a48;});}})['then'](respondWithFilteredResult(_0x3670a9,_0x3aefd6))[_0xdb90('0x19')](handleError(_0x3670a9,null));};exports[_0xdb90('0x95')]=function(_0x1b8a11,_0x2083a9){var _0x5aa693,_0x235cf0={},_0x52af10;if(_0x1b8a11[_0xdb90('0x5e')]['to']){_0x52af10=_0x1b8a11[_0xdb90('0x5e')]['to'][_0xdb90('0x9a')](',')[0x0];}return db[_0xdb90('0x42')][_0xdb90('0x5d')]({'where':{'id':_0x1b8a11[_0xdb90('0x61')]['id']},'include':[{'model':db[_0xdb90('0x9d')],'as':_0xdb90('0x9e'),'include':[{'model':db['CmContact'],'as':_0xdb90('0x9f'),'where':{'email':_0x52af10},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['MailServerOut'],'as':_0xdb90('0x3d'),'raw':!![],'include':[{'model':db[_0xdb90('0xa0')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x2083a9,null))[_0xdb90('0x11')](function(_0x82a6ce){if(!_0x82a6ce)return;_0x5aa693=_0x82a6ce;if(!_0x82a6ce['Smtp'])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0xdb90('0x74')](_0x1b8a11[_0xdb90('0x5e')]['from'])){_0x1b8a11[_0xdb90('0x5e')]['from']=util[_0xdb90('0xa1')](_0xdb90('0xa2'),_0x82a6ce[_0xdb90('0x54')],_0x82a6ce[_0xdb90('0x72')]||_0x82a6ce[_0xdb90('0x3d')]['user']);}if(_0x1b8a11[_0xdb90('0x5e')][_0xdb90('0xa3')]&&_0x1b8a11[_0xdb90('0x5e')][_0xdb90('0xa3')][_0xdb90('0x4b')]){for(var _0x4692d3=0x0;_0x4692d3<_0x1b8a11[_0xdb90('0x5e')][_0xdb90('0xa3')]['length'];_0x4692d3+=0x1){_0x1b8a11[_0xdb90('0x5e')][_0xdb90('0xa3')][_0x4692d3]={'filename':_0x1b8a11['body'][_0xdb90('0xa3')][_0x4692d3][_0xdb90('0x54')],'path':path[_0xdb90('0xa4')](config[_0xdb90('0xa5')],_0xdb90('0xa6'),_0x1b8a11['body'][_0xdb90('0xa3')][_0x4692d3][_0xdb90('0xa7')])};}}var _0x1e71e7=_0x82a6ce[_0xdb90('0xa8')]();return respondWithRpcPromise('SendMail',_0xdb90('0xa9'),{'account':_0x1e71e7,'message':_0x1b8a11['body']});})[_0xdb90('0x11')](function(_0x443bb8){if(!_0x443bb8)return;_0x235cf0=_0x443bb8;if(!_0x5aa693['List'])throw new Error('List\x20not\x20found');if(_0x5aa693[_0xdb90('0x9e')][_0xdb90('0x9f')][_0xdb90('0x4b')])return _0x5aa693[_0xdb90('0x9e')][_0xdb90('0x9f')][0x0];return db[_0xdb90('0x84')]['create'](_[_0xdb90('0xa')](_0x1b8a11[_0xdb90('0x5e')],{'firstName':_0x1b8a11[_0xdb90('0x5e')]['to'],'email':_0x1b8a11[_0xdb90('0x5e')]['to'],'phone':_0x1b8a11[_0xdb90('0x5e')]['to'],'ListId':_0x5aa693[_0xdb90('0x73')]}));})[_0xdb90('0x11')](function(_0x3003d9){if(!_0x3003d9)return;var _0x1bc6df={'UserId':_0x1b8a11['user']['id'],'ContactId':_0x3003d9['id'],'MailAccountId':_0x5aa693['id'],'inReplyTo':_0x235cf0['messageId'],'to':_0x1b8a11[_0xdb90('0x5e')]['from'],'cc':_0x1b8a11['body']['cc'],'subject':_0x1b8a11[_0xdb90('0x5e')]['subject'],'attach':_0x1b8a11['body'][_0xdb90('0xaa')],'firstMsgDirection':_0xdb90('0xab'),'lastMsgAt':moment()[_0xdb90('0xa1')](_0xdb90('0x9b')),'lastMsgDirection':_0xdb90('0xab'),'Messages':[_['merge'](_0x1b8a11[_0xdb90('0x5e')],{'messageId':_0x235cf0[_0xdb90('0xac')],'sentAt':moment()[_0xdb90('0xa1')](_0xdb90('0x9b')),'read':!![],'MailAccountId':_0x5aa693['id'],'UserId':_0x1b8a11[_0xdb90('0x31')]['id'],'ContactId':_0x3003d9['id']})]};if(_0x1b8a11[_0xdb90('0x5e')][_0xdb90('0xad')]){_0x1bc6df=_[_0xdb90('0x52')](_0x1bc6df,_0x1b8a11['body'][_0xdb90('0xad')]);}return db[_0xdb90('0x81')][_0xdb90('0x65')](_0x1bc6df,{'include':[{'model':db[_0xdb90('0x98')],'as':_0xdb90('0xae')}]});})[_0xdb90('0x11')](respondWithResult(_0x2083a9,null))[_0xdb90('0x19')](handleError(_0x2083a9,null));};exports['verifySmtp']=function(_0x5bab5e,_0x31b43e){return db[_0xdb90('0x42')][_0xdb90('0x5d')]({'where':{'id':_0x5bab5e['params']['id']},'include':[{'model':db[_0xdb90('0x40')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xdb90('0xa0')],'as':_0xdb90('0xa0'),'raw':!![]}]}]})[_0xdb90('0x11')](handleEntityNotFound(_0x31b43e,null))[_0xdb90('0x11')](function(_0x359e02){if(!_0x359e02[_0xdb90('0x3d')])return;var _0x2639b5=_0x359e02[_0xdb90('0xa8')]();return respondWithRpcPromise(_0xdb90('0xaf'),_0xdb90('0xb0'),{'account':_0x2639b5});})[_0xdb90('0x11')](respondWithResult(_0x31b43e,null))[_0xdb90('0x19')](handleError(_0x31b43e,null));};exports[_0xdb90('0x24')]=function(_0x5f4946,_0x238a39){return db['MailAccount'][_0xdb90('0x5d')]({'where':{'id':_0x5f4946[_0xdb90('0x61')]['id']}})[_0xdb90('0x11')](handleEntityNotFound(_0x238a39,null))[_0xdb90('0x11')](function(_0x43dc31){if(_0x43dc31&&_0x43dc31[_0xdb90('0x39')]){throw new db[(_0xdb90('0xb1'))][(_0xdb90('0xb2'))](_0xdb90('0xb3'));}return _0x43dc31;})[_0xdb90('0x11')](removeEntity(_0x238a39,null))[_0xdb90('0x19')](handleError(_0x238a39,null));};exports[_0xdb90('0xb4')]=function(_0x5465bc,_0x33a4b8){return db['MailAccount'][_0xdb90('0x5d')]({'where':{'id':_0x5465bc['params']['id']}})[_0xdb90('0x11')](handleEntityNotFound(_0x33a4b8,null))[_0xdb90('0x11')](function(_0x1a09e9){if(_0x1a09e9){return _0x1a09e9[_0xdb90('0xb4')](_0x5465bc[_0xdb90('0x5e')][_0xdb90('0x6c')],_['omit'](_0x5465bc[_0xdb90('0x5e')],[_0xdb90('0x6c'),'id'])||{})[_0xdb90('0xb5')](function(_0x31a467){for(var _0x33e8bc=0x0;_0x33e8bc<_0x5465bc[_0xdb90('0x5e')][_0xdb90('0x6c')][_0xdb90('0x4b')];_0x33e8bc+=0x1){socket[_0xdb90('0xb6')](_0xdb90('0xb7'),{'UserId':Number(_0x5465bc['body'][_0xdb90('0x6c')][_0x33e8bc]),'MailAccountId':Number(_0x5465bc[_0xdb90('0x61')]['id'])});}return _0x31a467;});}})[_0xdb90('0x11')](respondWithResult(_0x33a4b8,null))['catch'](handleError(_0x33a4b8,null));};exports['removeAgents']=function(_0x11e9a0,_0x1f1180){return db['MailAccount'][_0xdb90('0x5d')]({'where':{'id':_0x11e9a0[_0xdb90('0x61')]['id']}})[_0xdb90('0x11')](handleEntityNotFound(_0x1f1180,null))['then'](function(_0x5cacbd){if(_0x5cacbd){return _0x5cacbd[_0xdb90('0xb8')](_0x11e9a0['query'][_0xdb90('0x6c')])['then'](function(){if(_[_0xdb90('0xb9')](_0x11e9a0[_0xdb90('0x45')]['ids'])){for(var _0x21e95c=0x0;_0x21e95c<_0x11e9a0[_0xdb90('0x45')][_0xdb90('0x6c')][_0xdb90('0x4b')];_0x21e95c+=0x1){socket[_0xdb90('0xb6')](_0xdb90('0xba'),{'UserId':Number(_0x11e9a0[_0xdb90('0x45')]['ids'][_0x21e95c]),'MailAccountId':Number(_0x11e9a0[_0xdb90('0x61')]['id'])});}}else{socket['emit'](_0xdb90('0xba'),{'UserId':Number(_0x11e9a0['query'][_0xdb90('0x6c')]),'MailAccountId':Number(_0x11e9a0[_0xdb90('0x61')]['id'])});}});}})['then'](respondWithStatusCode(_0x1f1180,null))[_0xdb90('0x19')](handleError(_0x1f1180,null));};exports['getAgents']=function(_0x63de97,_0x3c500e){var _0x38043a={};var _0x2fed91={};var _0x5cbda3;var _0x418faf;return db[_0xdb90('0x42')][_0xdb90('0x67')]({'where':{'id':_0x63de97[_0xdb90('0x61')]['id']}})[_0xdb90('0x11')](handleEntityNotFound(_0x3c500e,null))['then'](function(_0x1719f0){if(_0x1719f0){_0x5cbda3=_0x1719f0;_0x2fed91[_0xdb90('0x44')]=_[_0xdb90('0x46')](db['User'][_0xdb90('0x5b')]);_0x2fed91[_0xdb90('0x45')]=_[_0xdb90('0x46')](_0x63de97[_0xdb90('0x45')]);_0x2fed91['filters']=_[_0xdb90('0x48')](_0x2fed91['model'],_0x2fed91[_0xdb90('0x45')]);_0x38043a['attributes']=_[_0xdb90('0x48')](_0x2fed91[_0xdb90('0x44')],qs[_0xdb90('0x4a')](_0x63de97[_0xdb90('0x45')]['fields']));_0x38043a[_0xdb90('0x49')]=_0x38043a['attributes']['length']?_0x38043a[_0xdb90('0x49')]:_0x2fed91[_0xdb90('0x44')];_0x38043a[_0xdb90('0x69')]=qs['sort'](_0x63de97[_0xdb90('0x45')][_0xdb90('0x4e')]);_0x38043a[_0xdb90('0x4f')]=qs[_0xdb90('0x47')](_[_0xdb90('0x50')](_0x63de97[_0xdb90('0x45')],_0x2fed91['filters']));if(_0x63de97[_0xdb90('0x45')][_0xdb90('0x51')]){_0x38043a[_0xdb90('0x4f')]=_[_0xdb90('0x52')](_0x38043a[_0xdb90('0x4f')],{'$or':_['map'](_0x38043a[_0xdb90('0x49')],function(_0x2faf17){var _0x397733={};_0x397733[_0x2faf17]={'$like':'%'+_0x63de97[_0xdb90('0x45')][_0xdb90('0x51')]+'%'};return _0x397733;})});}_0x38043a=_['merge']({},_0x38043a,_0x63de97['options']);return _0x5cbda3[_0xdb90('0xbb')](_0x38043a);}})[_0xdb90('0x11')](function(_0x337eb2){if(_0x337eb2){_0x418faf=_0x337eb2[_0xdb90('0x4b')];if(!_0x63de97[_0xdb90('0x45')][_0xdb90('0x4c')]('nolimit')){_0x38043a[_0xdb90('0x1f')]=qs['limit'](_0x63de97[_0xdb90('0x45')]['limit']);_0x38043a[_0xdb90('0x1d')]=qs[_0xdb90('0x1d')](_0x63de97[_0xdb90('0x45')][_0xdb90('0x1d')]);}return _0x5cbda3[_0xdb90('0xbb')](_0x38043a);}})[_0xdb90('0x11')](function(_0x209ede){if(_0x209ede){return _0x209ede?{'count':_0x418faf,'rows':_0x209ede}:null;}})[_0xdb90('0x11')](respondWithResult(_0x3c500e,null))['catch'](handleError(_0x3c500e,null));}; \ No newline at end of file +var _0xe5fc=['create','ids','ListId','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','User','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','CmContact','Contacts','updatedAt','DESC','CloudProvider','isNil','from','email','attachments','join','root','basename','getSmtpOptions','SendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','verifySmtp','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','path','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','destroy','UserProfileResource','stack','name','send','imap.gmail.com','yahoo','imap-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','gmail','smtp.mail.yahoo.com','hotmail','smtp-mail.outlook.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','MailServerOut','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailAccount','include','findAll','rows','params','MailServerIn','Pause','includeAll','find','update','body','provider','custom','describe','addDisposition','MailAccountId','Disposition','findOne','removeDispositions','addAnswer','CannedAnswer'];(function(_0x4ec520,_0x15fee2){var _0xed49d7=function(_0x3031f2){while(--_0x3031f2){_0x4ec520['push'](_0x4ec520['shift']());}};_0xed49d7(++_0x15fee2);}(_0xe5fc,0x113));var _0xce5f=function(_0x183d01,_0x14ef62){_0x183d01=_0x183d01-0x0;var _0x493d2c=_0xe5fc[_0x183d01];return _0x493d2c;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require('util');var path=require(_0xce5f('0x0'));var _=require(_0xce5f('0x1'));var juice=require('juice');var Redis=require(_0xce5f('0x2'));var qs=require(_0xce5f('0x3'));var logger=require('../../config/logger')(_0xce5f('0x4'));var config=require(_0xce5f('0x5'));var db=require('../../mysqldb')['db'];config[_0xce5f('0x6')]=_[_0xce5f('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xce5f('0x8'))(new Redis(config[_0xce5f('0x6')]));require(_0xce5f('0x9'))[_0xce5f('0xa')](socket);var jayson=require(_0xce5f('0xb'));var client=jayson[_0xce5f('0xc')][_0xce5f('0xd')]({'port':0x232b});function respondWithRpcPromise(_0x4dbbea,_0x1d5a1d,_0xfe2e38,_0x626c47){return new BPromise(function(_0x35b0fa,_0x750a4c){var _0x3053bd=_0x626c47||client;return _0x3053bd[_0xce5f('0xe')](_0x4dbbea,_0xfe2e38)[_0xce5f('0xf')](function(_0x5cf1e4){logger['info'](_0xce5f('0x10'),_0x1d5a1d,_0xce5f('0x11'));logger[_0xce5f('0x12')](_0xce5f('0x13'),_0x1d5a1d,_0xce5f('0x11'),JSON[_0xce5f('0x14')](_0x5cf1e4));if(_0x5cf1e4[_0xce5f('0x15')]){if(_0x5cf1e4['error'][_0xce5f('0x16')]===0x1f4){logger[_0xce5f('0x15')](_0xce5f('0x10'),_0x1d5a1d,_0x5cf1e4[_0xce5f('0x15')][_0xce5f('0x17')]);return _0x750a4c(_0x5cf1e4[_0xce5f('0x15')]['message']);}logger[_0xce5f('0x15')](_0xce5f('0x10'),_0x1d5a1d,_0x5cf1e4['error'][_0xce5f('0x17')]);return _0x35b0fa(_0x5cf1e4[_0xce5f('0x15')]['message']);}else{logger[_0xce5f('0x18')](_0xce5f('0x10'),_0x1d5a1d,_0xce5f('0x11'));_0x35b0fa(_0x5cf1e4[_0xce5f('0x19')][_0xce5f('0x17')]);}})[_0xce5f('0x1a')](function(_0x531330){logger['error'](_0xce5f('0x10'),_0x1d5a1d,_0x531330);_0x750a4c(_0x531330);});});}function respondWithStatusCode(_0x1e90b6,_0x218a7d){_0x218a7d=_0x218a7d||0xcc;return function(_0x32e40d){if(_0x32e40d){return _0x1e90b6[_0xce5f('0x1b')](_0x218a7d);}return _0x1e90b6[_0xce5f('0x1c')](_0x218a7d)[_0xce5f('0x1d')]();};}function respondWithResult(_0x2d2d94,_0x44fc6c){_0x44fc6c=_0x44fc6c||0xc8;return function(_0x261149){if(_0x261149){return _0x2d2d94[_0xce5f('0x1c')](_0x44fc6c)[_0xce5f('0x1e')](_0x261149);}};}function respondWithFilteredResult(_0xceb6da,_0x42fe08){return function(_0x143c08){if(_0x143c08){var _0x46e543=typeof _0x42fe08['offset']===_0xce5f('0x1f')&&typeof _0x42fe08['limit']===_0xce5f('0x1f');var _0x524e8b=_0x143c08[_0xce5f('0x20')];var _0x2be86b=_0x46e543?0x0:_0x42fe08[_0xce5f('0x21')];var _0x53e02a=_0x46e543?_0x143c08[_0xce5f('0x20')]:_0x42fe08[_0xce5f('0x21')]+_0x42fe08[_0xce5f('0x22')];var _0x5c5f96;if(_0x53e02a>=_0x524e8b){_0x53e02a=_0x524e8b;_0x5c5f96=0xc8;}else{_0x5c5f96=0xce;}_0xceb6da[_0xce5f('0x1c')](_0x5c5f96);return _0xceb6da['set'](_0xce5f('0x23'),_0x2be86b+'-'+_0x53e02a+'/'+_0x524e8b)[_0xce5f('0x1e')](_0x143c08);}return null;};}function saveUpdates(_0x311040){return function(_0x29f6d7){if(_0x29f6d7){return _0x29f6d7['update'](_0x311040)[_0xce5f('0xf')](function(_0x2253f9){return _0x2253f9;});}return null;};}function removeEntity(_0x5b3e4c){return function(_0x4f1703){if(_0x4f1703){return _0x4f1703[_0xce5f('0x24')]()['then'](function(){var _0x403673=_0x4f1703['get']({'plain':!![]});var _0xd84c4b='MailAccounts';return db[_0xce5f('0x25')]['destroy']({'where':{'type':_0xd84c4b,'resourceId':_0x403673['id']}})['then'](function(){return _0x4f1703;});})[_0xce5f('0xf')](function(){_0x5b3e4c['status'](0xcc)[_0xce5f('0x1d')]();});}};}function handleEntityNotFound(_0x3cfe58){return function(_0x3d66b2){if(!_0x3d66b2){_0x3cfe58[_0xce5f('0x1b')](0x194);}return _0x3d66b2;};}function handleError(_0x48f921,_0x303adc){_0x303adc=_0x303adc||0x1f4;return function(_0xebfa8b){logger[_0xce5f('0x15')](_0xebfa8b[_0xce5f('0x26')]);if(_0xebfa8b[_0xce5f('0x27')]){delete _0xebfa8b['name'];}_0x48f921[_0xce5f('0x1c')](_0x303adc)[_0xce5f('0x28')](_0xebfa8b);};}function getImapHost(_0x55dce0){switch(_0x55dce0){case'gmail':return _0xce5f('0x29');case _0xce5f('0x2a'):return'imap.mail.yahoo.com';case'hotmail':return _0xce5f('0x2b');case _0xce5f('0x2c'):return'outlook.office365.com';}throw new Error(_0xce5f('0x2d'),_0x55dce0);}function getSmtpHost(_0x2b7b5f){switch(_0x2b7b5f){case _0xce5f('0x2e'):return'smtp.gmail.com';case _0xce5f('0x2a'):return _0xce5f('0x2f');case _0xce5f('0x30'):return _0xce5f('0x31');case _0xce5f('0x2c'):return'smtp.office365.com';}throw new Error(_0xce5f('0x2d'),_0x2b7b5f);}function getAuthenticationOptions(_0xff8f71,_0x7a84d){var _0x1bb115={};var _0x27f8bc={};if(_0xff8f71){_0x1bb115[_0xce5f('0x32')]=_0x27f8bc[_0xce5f('0x32')]=_0x7a84d[_0xce5f('0x33')];_0x1bb115[_0xce5f('0x34')]=_0x27f8bc[_0xce5f('0x35')]=_0x7a84d[_0xce5f('0x34')];if(_0x7a84d['modernAuthentication']){_0x1bb115['modernAuthentication']=_0x27f8bc[_0xce5f('0x36')]=!![];_0x1bb115['CloudProviderId']=_0x27f8bc[_0xce5f('0x37')]=_0x7a84d[_0xce5f('0x37')];_0x1bb115[_0xce5f('0x34')]=_0x27f8bc[_0xce5f('0x35')]=null;}else{_0x1bb115[_0xce5f('0x37')]=_0x27f8bc['CloudProviderId']=null;}_0x1bb115[_0xce5f('0x38')]=getImapHost(_0xff8f71);_0x1bb115[_0xce5f('0x39')]=0x3e1;_0x27f8bc[_0xce5f('0x38')]=getSmtpHost(_0xff8f71);_0x27f8bc[_0xce5f('0x39')]=0x24b;_0x27f8bc[_0xce5f('0x3a')]=![];_0x1bb115[_0xce5f('0x3b')]=_0x27f8bc[_0xce5f('0x3b')]=null;}else{if(_0x7a84d['authentication']){_0x1bb115[_0xce5f('0x32')]=_0x27f8bc[_0xce5f('0x32')]=_0x7a84d[_0xce5f('0x33')];_0x1bb115[_0xce5f('0x34')]=_0x27f8bc[_0xce5f('0x35')]=_0x7a84d['password'];}else{_0x1bb115[_0xce5f('0x3c')]=_0x27f8bc['authentication']=![];_0x1bb115[_0xce5f('0x32')]=_0x27f8bc['user']=null;_0x1bb115[_0xce5f('0x34')]=_0x27f8bc[_0xce5f('0x35')]=null;}_0x1bb115[_0xce5f('0x38')]=_0x7a84d[_0xce5f('0x3d')]['host'];_0x1bb115[_0xce5f('0x39')]=_0x7a84d[_0xce5f('0x3d')][_0xce5f('0x39')];_0x27f8bc[_0xce5f('0x38')]=_0x7a84d[_0xce5f('0x3e')]['host'];_0x27f8bc['port']=_0x7a84d['Smtp'][_0xce5f('0x39')];}return{'Imap':_0x1bb115,'Smtp':_0x27f8bc};}exports['index']=function(_0x231cd7,_0x164758){var _0x554aa8={'include':[{'model':db['MailServerIn'],'as':_0xce5f('0x3d')},{'model':db[_0xce5f('0x3f')],'as':'Smtp'},{'model':db['Pause'],'as':_0xce5f('0x40')}]},_0x248524={},_0xa11223={'count':0x0,'rows':[]};var _0x5131ba=_[_0xce5f('0x41')](db['MailAccount'][_0xce5f('0x42')],function(_0x1992f9){return{'name':_0x1992f9[_0xce5f('0x43')],'type':_0x1992f9[_0xce5f('0x44')][_0xce5f('0x45')]};});_0x248524[_0xce5f('0x46')]=_[_0xce5f('0x41')](_0x5131ba,_0xce5f('0x27'));_0x248524[_0xce5f('0x47')]=_[_0xce5f('0x48')](_0x231cd7[_0xce5f('0x47')]);_0x248524[_0xce5f('0x49')]=_['intersection'](_0x248524[_0xce5f('0x46')],_0x248524[_0xce5f('0x47')]);_0x554aa8[_0xce5f('0x4a')]=_[_0xce5f('0x4b')](_0x248524[_0xce5f('0x46')],qs[_0xce5f('0x4c')](_0x231cd7[_0xce5f('0x47')][_0xce5f('0x4c')]));_0x554aa8['attributes']=_0x554aa8[_0xce5f('0x4a')][_0xce5f('0x4d')]?_0x554aa8['attributes']:_0x248524[_0xce5f('0x46')];if(!_0x231cd7[_0xce5f('0x47')][_0xce5f('0x4e')](_0xce5f('0x4f'))){_0x554aa8[_0xce5f('0x22')]=qs[_0xce5f('0x22')](_0x231cd7[_0xce5f('0x47')][_0xce5f('0x22')]);_0x554aa8['offset']=qs[_0xce5f('0x21')](_0x231cd7[_0xce5f('0x47')]['offset']);}_0x554aa8[_0xce5f('0x50')]=qs[_0xce5f('0x51')](_0x231cd7[_0xce5f('0x47')][_0xce5f('0x51')]);_0x554aa8[_0xce5f('0x52')]=qs[_0xce5f('0x49')](_[_0xce5f('0x53')](_0x231cd7[_0xce5f('0x47')],_0x248524[_0xce5f('0x49')]),_0x5131ba);if(_0x231cd7[_0xce5f('0x47')][_0xce5f('0x54')]){_0x554aa8[_0xce5f('0x52')]=_[_0xce5f('0x55')](_0x554aa8[_0xce5f('0x52')],{'$or':_[_0xce5f('0x41')](_0x5131ba,function(_0x53fece){if(_0x53fece[_0xce5f('0x44')]!==_0xce5f('0x56')){var _0x158b9f={};_0x158b9f[_0x53fece[_0xce5f('0x27')]]={'$like':'%'+_0x231cd7[_0xce5f('0x47')][_0xce5f('0x54')]+'%'};return _0x158b9f;}})});}_0x554aa8=_[_0xce5f('0x55')]({},_0x554aa8,_0x231cd7[_0xce5f('0x57')]);var _0x17977c={'where':_0x554aa8[_0xce5f('0x52')]};return db[_0xce5f('0x58')][_0xce5f('0x20')](_0x17977c)[_0xce5f('0xf')](function(_0x165f71){_0xa11223['count']=_0x165f71;if(_0x231cd7['query']['includeAll']){_0x554aa8[_0xce5f('0x59')]=[{'all':!![]}];}return db['MailAccount'][_0xce5f('0x5a')](_0x554aa8);})['then'](function(_0x877084){_0xa11223[_0xce5f('0x5b')]=_0x877084;return _0xa11223;})[_0xce5f('0xf')](respondWithFilteredResult(_0x164758,_0x554aa8))[_0xce5f('0x1a')](handleError(_0x164758,null));};exports['show']=function(_0x259fb7,_0x1d89de){var _0x5edfa5={'raw':![],'where':{'id':_0x259fb7[_0xce5f('0x5c')]['id']},'include':[{'model':db[_0xce5f('0x5d')],'as':_0xce5f('0x3d')},{'model':db[_0xce5f('0x3f')],'as':_0xce5f('0x3e')},{'model':db[_0xce5f('0x5e')],'as':_0xce5f('0x40')}]},_0x240ebe={};_0x240ebe[_0xce5f('0x46')]=_[_0xce5f('0x48')](db[_0xce5f('0x58')][_0xce5f('0x42')]);_0x240ebe[_0xce5f('0x47')]=_[_0xce5f('0x48')](_0x259fb7[_0xce5f('0x47')]);_0x240ebe[_0xce5f('0x49')]=_['intersection'](_0x240ebe[_0xce5f('0x46')],_0x240ebe[_0xce5f('0x47')]);_0x5edfa5[_0xce5f('0x4a')]=_[_0xce5f('0x4b')](_0x240ebe[_0xce5f('0x46')],qs['fields'](_0x259fb7['query'][_0xce5f('0x4c')]));_0x5edfa5['attributes']=_0x5edfa5[_0xce5f('0x4a')][_0xce5f('0x4d')]?_0x5edfa5[_0xce5f('0x4a')]:_0x240ebe[_0xce5f('0x46')];if(_0x259fb7[_0xce5f('0x47')][_0xce5f('0x5f')]){_0x5edfa5['include']=[{'all':!![]}];}_0x5edfa5=_['merge']({},_0x5edfa5,_0x259fb7['options']);return db[_0xce5f('0x58')][_0xce5f('0x60')](_0x5edfa5)[_0xce5f('0xf')](handleEntityNotFound(_0x1d89de,null))[_0xce5f('0xf')](respondWithResult(_0x1d89de,null))['catch'](handleError(_0x1d89de,null));};exports[_0xce5f('0x61')]=function(_0x5b5138,_0x29a581){if(_0x5b5138['body']['id']){delete _0x5b5138[_0xce5f('0x62')]['id'];}var _0x141fec=_0x5b5138['body'][_0xce5f('0x63')]===_0xce5f('0x64')?null:_0x5b5138['body'][_0xce5f('0x63')];var _0x501cad=_0x5b5138['body']['Imap']||{};var _0x20240f=_0x5b5138[_0xce5f('0x62')]['Smtp']||{};if(_0x141fec){_0x501cad['host']=getImapHost(_0x141fec);_0x501cad['port']=0x3e1;_0x20240f[_0xce5f('0x38')]=getSmtpHost(_0x141fec);_0x20240f[_0xce5f('0x39')]=0x24b;_0x20240f[_0xce5f('0x3a')]=![];}if(_0x20240f[_0xce5f('0x36')]){_0x20240f[_0xce5f('0x3a')]=![];}else{_0x20240f['CloudProviderId']=null;}if(!_0x501cad[_0xce5f('0x36')])_0x501cad['CloudProviderId']=null;_0x5b5138[_0xce5f('0x62')]['Imap']=_0x501cad;_0x5b5138[_0xce5f('0x62')][_0xce5f('0x3e')]=_0x20240f;return db[_0xce5f('0x58')][_0xce5f('0x60')]({'where':{'id':_0x5b5138[_0xce5f('0x5c')]['id']},'include':[{'model':db[_0xce5f('0x5d')],'as':_0xce5f('0x3d')},{'model':db['MailServerOut'],'as':_0xce5f('0x3e')},{'model':db[_0xce5f('0x5e')],'as':_0xce5f('0x40')}]})[_0xce5f('0xf')](handleEntityNotFound(_0x29a581,null))[_0xce5f('0xf')](function(_0x43cd94){if(!_0x43cd94)throw new Error('Mail\x20Account\x20not\x20found');if(_0x43cd94['service'])delete _0x5b5138[_0xce5f('0x62')][_0xce5f('0x3d')];return _0x43cd94;})[_0xce5f('0xf')](saveUpdates(_0x5b5138[_0xce5f('0x62')],null))[_0xce5f('0xf')](function(_0x53328b){if(!_0x5b5138[_0xce5f('0x62')]['Imap'])return _0x53328b;return db['MailServerIn'][_0xce5f('0x61')](_0x5b5138[_0xce5f('0x62')][_0xce5f('0x3d')],{'where':{'MailAccountId':_0x53328b['id']}})[_0xce5f('0xf')](function(){return _0x53328b;});})['then'](function(_0x4ea1f7){if(!_0x5b5138[_0xce5f('0x62')]['Smtp'])return _0x4ea1f7;return db[_0xce5f('0x3f')][_0xce5f('0x61')](_0x5b5138[_0xce5f('0x62')][_0xce5f('0x3e')],{'where':{'MailAccountId':_0x4ea1f7['id']}})[_0xce5f('0xf')](function(){return _0x4ea1f7;});})[_0xce5f('0xf')](respondWithResult(_0x29a581,null))['catch'](handleError(_0x29a581,null));};exports['describe']=function(_0x35935c,_0x152f9d){return db[_0xce5f('0x58')][_0xce5f('0x65')]()[_0xce5f('0xf')](respondWithResult(_0x152f9d,null))[_0xce5f('0x1a')](handleError(_0x152f9d,null));};exports[_0xce5f('0x66')]=function(_0x44f9dc,_0xe60546){if(_0x44f9dc[_0xce5f('0x62')]['id']){delete _0x44f9dc[_0xce5f('0x62')]['id'];}return db[_0xce5f('0x58')][_0xce5f('0x60')]({'where':{'id':_0x44f9dc['params']['id']}})[_0xce5f('0xf')](handleEntityNotFound(_0xe60546,null))[_0xce5f('0xf')](function(_0x1e91b9){if(_0x1e91b9){_0x44f9dc[_0xce5f('0x62')][_0xce5f('0x67')]=_0x1e91b9['id'];return db[_0xce5f('0x68')]['create'](_0x44f9dc[_0xce5f('0x62')]);}})[_0xce5f('0xf')](respondWithResult(_0xe60546,null))[_0xce5f('0x1a')](handleError(_0xe60546,null));};exports['getDispositions']=function(_0x36629b,_0x31475a){var _0x4c36af={'raw':![],'where':{}};var _0x5bdb90={};var _0x541d64={'count':0x0,'rows':[]};return db[_0xce5f('0x58')][_0xce5f('0x69')]({'where':{'id':_0x36629b[_0xce5f('0x5c')]['id']}})['then'](handleEntityNotFound(_0x31475a,null))[_0xce5f('0xf')](function(_0xe6f09){if(_0xe6f09){_0x5bdb90[_0xce5f('0x46')]=_[_0xce5f('0x48')](db[_0xce5f('0x68')][_0xce5f('0x42')]);_0x5bdb90[_0xce5f('0x47')]=_['keys'](_0x36629b[_0xce5f('0x47')]);_0x5bdb90['filters']=_[_0xce5f('0x4b')](_0x5bdb90['model'],_0x5bdb90[_0xce5f('0x47')]);_0x4c36af['attributes']=_['intersection'](_0x5bdb90[_0xce5f('0x46')],qs[_0xce5f('0x4c')](_0x36629b[_0xce5f('0x47')][_0xce5f('0x4c')]));_0x4c36af[_0xce5f('0x4a')]=_0x4c36af[_0xce5f('0x4a')][_0xce5f('0x4d')]?_0x4c36af['attributes']:_0x5bdb90[_0xce5f('0x46')];if(!_0x36629b[_0xce5f('0x47')][_0xce5f('0x4e')]('nolimit')){_0x4c36af[_0xce5f('0x22')]=qs[_0xce5f('0x22')](_0x36629b[_0xce5f('0x47')][_0xce5f('0x22')]);_0x4c36af[_0xce5f('0x21')]=qs['offset'](_0x36629b[_0xce5f('0x47')][_0xce5f('0x21')]);}_0x4c36af[_0xce5f('0x50')]=qs[_0xce5f('0x51')](_0x36629b[_0xce5f('0x47')]['sort']);_0x4c36af['where']=qs[_0xce5f('0x49')](_[_0xce5f('0x53')](_0x36629b[_0xce5f('0x47')],_0x5bdb90[_0xce5f('0x49')]));_0x4c36af['where'][_0xce5f('0x67')]=_0xe6f09['id'];if(_0x36629b['query'][_0xce5f('0x54')]){_0x4c36af['where']=_['merge'](_0x4c36af[_0xce5f('0x52')],{'$or':_[_0xce5f('0x41')](_0x4c36af['attributes'],function(_0xd200a9){var _0x3c1692={};_0x3c1692[_0xd200a9]={'$like':'%'+_0x36629b[_0xce5f('0x47')]['filter']+'%'};return _0x3c1692;})});}_0x4c36af=_[_0xce5f('0x55')]({},_0x4c36af,_0x36629b['options']);return db[_0xce5f('0x68')][_0xce5f('0x20')]({'where':_0x4c36af['where']})[_0xce5f('0xf')](function(_0xbf42ae){_0x541d64['count']=_0xbf42ae;if(_0x36629b[_0xce5f('0x47')][_0xce5f('0x5f')]){_0x4c36af['include']=[{'all':!![]}];}return db[_0xce5f('0x68')][_0xce5f('0x5a')](_0x4c36af);})[_0xce5f('0xf')](function(_0x270f02){_0x541d64[_0xce5f('0x5b')]=_0x270f02;return _0x541d64;});}})['then'](respondWithFilteredResult(_0x31475a,_0x4c36af))[_0xce5f('0x1a')](handleError(_0x31475a,null));};exports[_0xce5f('0x6a')]=function(_0x379580,_0x206f45){return db[_0xce5f('0x58')][_0xce5f('0x60')]({'where':{'id':_0x379580[_0xce5f('0x5c')]['id']}})[_0xce5f('0xf')](handleEntityNotFound(_0x206f45,null))['then'](function(_0x4f0c4e){if(_0x4f0c4e){return _0x4f0c4e[_0xce5f('0x6a')](_0x379580[_0xce5f('0x47')]['ids']);}})[_0xce5f('0xf')](respondWithStatusCode(_0x206f45,null))['catch'](handleError(_0x206f45,null));};exports[_0xce5f('0x6b')]=function(_0x3dbac1,_0x35b515){if(_0x3dbac1['body']['id']){delete _0x3dbac1[_0xce5f('0x62')]['id'];}return db[_0xce5f('0x58')][_0xce5f('0x60')]({'where':{'id':_0x3dbac1[_0xce5f('0x5c')]['id']}})[_0xce5f('0xf')](handleEntityNotFound(_0x35b515,null))[_0xce5f('0xf')](function(_0x251b51){if(_0x251b51){_0x3dbac1['body'][_0xce5f('0x67')]=_0x251b51['id'];return db[_0xce5f('0x6c')][_0xce5f('0x6d')](_0x3dbac1[_0xce5f('0x62')]);}})[_0xce5f('0xf')](respondWithResult(_0x35b515,null))[_0xce5f('0x1a')](handleError(_0x35b515,null));};exports['getAnswers']=function(_0x5f1b30,_0x1a5b24){var _0x52f7d0={'raw':![],'where':{}};var _0x338ea0={};var _0x4d73f3={'count':0x0,'rows':[]};return db[_0xce5f('0x58')]['findOne']({'where':{'id':_0x5f1b30[_0xce5f('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1a5b24,null))[_0xce5f('0xf')](function(_0x17f8b9){if(_0x17f8b9){_0x338ea0[_0xce5f('0x46')]=_[_0xce5f('0x48')](db[_0xce5f('0x6c')][_0xce5f('0x42')]);_0x338ea0['query']=_[_0xce5f('0x48')](_0x5f1b30['query']);_0x338ea0[_0xce5f('0x49')]=_['intersection'](_0x338ea0[_0xce5f('0x46')],_0x338ea0[_0xce5f('0x47')]);_0x52f7d0[_0xce5f('0x4a')]=_['intersection'](_0x338ea0[_0xce5f('0x46')],qs[_0xce5f('0x4c')](_0x5f1b30[_0xce5f('0x47')]['fields']));_0x52f7d0[_0xce5f('0x4a')]=_0x52f7d0[_0xce5f('0x4a')][_0xce5f('0x4d')]?_0x52f7d0[_0xce5f('0x4a')]:_0x338ea0[_0xce5f('0x46')];if(!_0x5f1b30[_0xce5f('0x47')][_0xce5f('0x4e')]('nolimit')){_0x52f7d0[_0xce5f('0x22')]=qs['limit'](_0x5f1b30[_0xce5f('0x47')][_0xce5f('0x22')]);_0x52f7d0[_0xce5f('0x21')]=qs[_0xce5f('0x21')](_0x5f1b30[_0xce5f('0x47')][_0xce5f('0x21')]);}_0x52f7d0['order']=qs['sort'](_0x5f1b30['query'][_0xce5f('0x51')]);_0x52f7d0[_0xce5f('0x52')]=qs[_0xce5f('0x49')](_['pick'](_0x5f1b30['query'],_0x338ea0[_0xce5f('0x49')]));_0x52f7d0[_0xce5f('0x52')][_0xce5f('0x67')]=_0x17f8b9['id'];if(_0x5f1b30[_0xce5f('0x47')]['filter']){_0x52f7d0[_0xce5f('0x52')]=_['merge'](_0x52f7d0[_0xce5f('0x52')],{'$or':_[_0xce5f('0x41')](_0x52f7d0[_0xce5f('0x4a')],function(_0x3930bf){var _0x450335={};_0x450335[_0x3930bf]={'$like':'%'+_0x5f1b30[_0xce5f('0x47')]['filter']+'%'};return _0x450335;})});}_0x52f7d0=_[_0xce5f('0x55')]({},_0x52f7d0,_0x5f1b30[_0xce5f('0x57')]);return db['CannedAnswer'][_0xce5f('0x20')]({'where':_0x52f7d0[_0xce5f('0x52')]})[_0xce5f('0xf')](function(_0x1c66fc){_0x4d73f3[_0xce5f('0x20')]=_0x1c66fc;if(_0x5f1b30[_0xce5f('0x47')][_0xce5f('0x5f')]){_0x52f7d0[_0xce5f('0x59')]=[{'all':!![]}];}return db[_0xce5f('0x6c')][_0xce5f('0x5a')](_0x52f7d0);})[_0xce5f('0xf')](function(_0x57a4a6){_0x4d73f3[_0xce5f('0x5b')]=_0x57a4a6;return _0x4d73f3;});}})[_0xce5f('0xf')](respondWithFilteredResult(_0x1a5b24,_0x52f7d0))[_0xce5f('0x1a')](handleError(_0x1a5b24,null));};exports['removeAnswers']=function(_0x4f34c1,_0x56275e){return db[_0xce5f('0x58')]['find']({'where':{'id':_0x4f34c1['params']['id']}})[_0xce5f('0xf')](handleEntityNotFound(_0x56275e,null))[_0xce5f('0xf')](function(_0x14b522){if(_0x14b522){return _0x14b522['removeAnswers'](_0x4f34c1[_0xce5f('0x47')][_0xce5f('0x6e')]);}})['then'](respondWithStatusCode(_0x56275e,null))['catch'](handleError(_0x56275e,null));};exports[_0xce5f('0x6d')]=function(_0x1f6a62,_0x223e0d){var _0x5cbfe1={'name':_0x1f6a62['body'][_0xce5f('0x27')],'key':_0x1f6a62[_0xce5f('0x62')][_0xce5f('0x45')],'provider':_0x1f6a62[_0xce5f('0x62')][_0xce5f('0x63')]===_0xce5f('0x64')?null:_0x1f6a62[_0xce5f('0x62')][_0xce5f('0x63')],'email':_0x1f6a62[_0xce5f('0x62')]['email'],'ListId':_0x1f6a62[_0xce5f('0x62')][_0xce5f('0x6f')],'active':!_['isNil'](_0x1f6a62[_0xce5f('0x62')][_0xce5f('0x70')])?_0x1f6a62[_0xce5f('0x62')][_0xce5f('0x70')]:!![],'description':_0x1f6a62[_0xce5f('0x62')][_0xce5f('0x71')]||null};var _0x4c32dd=getAuthenticationOptions(_0x5cbfe1['provider'],_0x1f6a62[_0xce5f('0x62')]);_0x5cbfe1[_0xce5f('0x3d')]=_0x4c32dd[_0xce5f('0x3d')];_0x5cbfe1['Smtp']=_0x4c32dd[_0xce5f('0x3e')];return db[_0xce5f('0x58')][_0xce5f('0x6d')](_0x5cbfe1,{'include':[{'model':db[_0xce5f('0x3f')],'as':_0xce5f('0x3e')},{'model':db[_0xce5f('0x5d')],'as':_0xce5f('0x3d')}]})['then'](function(_0x159bbe){var _0x71d933=_0x1f6a62[_0xce5f('0x32')][_0xce5f('0x72')]({'plain':!![]});if(!_0x71d933)throw new Error(_0xce5f('0x73'));if(_0x71d933[_0xce5f('0x74')]===_0xce5f('0x32')){var _0x42ce56=_0x159bbe['get']({'plain':!![]});return db[_0xce5f('0x75')][_0xce5f('0x60')]({'where':{'name':_0xce5f('0x76'),'userProfileId':_0x71d933[_0xce5f('0x77')]},'raw':!![]})['then'](function(_0x3de865){if(_0x3de865&&_0x3de865[_0xce5f('0x78')]===0x0){return db[_0xce5f('0x25')][_0xce5f('0x6d')]({'name':_0x42ce56['name'],'resourceId':_0x42ce56['id'],'type':_0x3de865[_0xce5f('0x27')],'sectionId':_0x3de865['id']},{})[_0xce5f('0xf')](function(){return _0x159bbe;});}else{return _0x159bbe;}})[_0xce5f('0x1a')](function(_0x548dc6){logger[_0xce5f('0x15')](_0xce5f('0x79'),_0x548dc6);throw _0x548dc6;});}return _0x159bbe;})[_0xce5f('0xf')](respondWithResult(_0x223e0d,0xc9))[_0xce5f('0x1a')](handleError(_0x223e0d,null));};exports['getImap']=function(_0x44dbaf,_0x419073){return db['MailAccount'][_0xce5f('0x69')]({'where':{'id':_0x44dbaf['params']['id']}})[_0xce5f('0xf')](handleEntityNotFound(_0x419073,null))[_0xce5f('0xf')](function(_0x805189){if(_0x805189){return _0x805189[_0xce5f('0x7a')]();}return null;})[_0xce5f('0xf')](respondWithResult(_0x419073,null))[_0xce5f('0x1a')](handleError(_0x419073,null));};exports[_0xce5f('0x7b')]=function(_0x108a46,_0x547665){if(_0x108a46['body']['id']){delete _0x108a46['body']['id'];}return db['MailAccount'][_0xce5f('0x60')]({'where':{'id':_0x108a46[_0xce5f('0x5c')]['id']}})[_0xce5f('0xf')](handleEntityNotFound(_0x547665,null))[_0xce5f('0xf')](function(_0xbff85d){if(_0xbff85d){_0x108a46[_0xce5f('0x62')][_0xce5f('0x67')]=_0xbff85d['id'];return db[_0xce5f('0x5d')][_0xce5f('0x6d')](_0x108a46['body']);}})[_0xce5f('0xf')](respondWithResult(_0x547665,null))[_0xce5f('0x1a')](handleError(_0x547665,null));};exports['removeImap']=function(_0x3f5337,_0x3cf3ce){return db[_0xce5f('0x58')]['findOne']({'where':{'id':_0x3f5337[_0xce5f('0x5c')]['id']}})[_0xce5f('0xf')](handleEntityNotFound(_0x3cf3ce,null))[_0xce5f('0xf')](function(_0x4f4f1d){if(_0x4f4f1d){return _0x4f4f1d[_0xce5f('0x7c')](null);}return null;})[_0xce5f('0xf')](respondWithStatusCode(_0x3cf3ce,null))[_0xce5f('0x1a')](handleError(_0x3cf3ce,null));};exports[_0xce5f('0x7d')]=function(_0x39578f,_0x53b484){return db[_0xce5f('0x58')][_0xce5f('0x69')]({'where':{'id':_0x39578f['params']['id']}})[_0xce5f('0xf')](handleEntityNotFound(_0x53b484,null))[_0xce5f('0xf')](function(_0xf34d82){if(_0xf34d82){return _0xf34d82[_0xce5f('0x7d')]();}return null;})[_0xce5f('0xf')](respondWithResult(_0x53b484,null))[_0xce5f('0x1a')](handleError(_0x53b484,null));};exports[_0xce5f('0x7e')]=function(_0x57a253,_0x21f01e){if(_0x57a253[_0xce5f('0x62')]['id']){delete _0x57a253[_0xce5f('0x62')]['id'];}return db[_0xce5f('0x58')][_0xce5f('0x60')]({'where':{'id':_0x57a253[_0xce5f('0x5c')]['id']}})[_0xce5f('0xf')](handleEntityNotFound(_0x21f01e,null))[_0xce5f('0xf')](function(_0x31d755){if(_0x31d755){_0x57a253[_0xce5f('0x62')][_0xce5f('0x67')]=_0x31d755['id'];return db['MailServerOut'][_0xce5f('0x6d')](_0x57a253['body']);}})[_0xce5f('0xf')](respondWithResult(_0x21f01e,null))['catch'](handleError(_0x21f01e,null));};exports[_0xce5f('0x7f')]=function(_0x32cbbc,_0xe819b){return db['MailAccount']['findOne']({'where':{'id':_0x32cbbc[_0xce5f('0x5c')]['id']}})[_0xce5f('0xf')](handleEntityNotFound(_0xe819b,null))[_0xce5f('0xf')](function(_0x4fb3a3){if(_0x4fb3a3){return _0x4fb3a3[_0xce5f('0x80')](null);}return null;})[_0xce5f('0xf')](respondWithStatusCode(_0xe819b,null))['catch'](handleError(_0xe819b,null));};exports[_0xce5f('0x81')]=function(_0x1bd26a,_0x826c86){return db[_0xce5f('0x82')]['find']({'where':{'id':_0x1bd26a['params']['id']}})[_0xce5f('0xf')](handleEntityNotFound(_0x826c86,null))[_0xce5f('0xf')](function(_0x21d36a){if(_0x21d36a){return _0x21d36a[_0xce5f('0x81')](_0x1bd26a[_0xce5f('0x62')][_0xce5f('0x6e')],_[_0xce5f('0x83')](_0x1bd26a['body'],[_0xce5f('0x6e'),'id'])||{});}})[_0xce5f('0xf')](respondWithResult(_0x826c86,null))[_0xce5f('0x1a')](handleError(_0x826c86,null));};exports[_0xce5f('0x84')]=function(_0x14b492,_0x27ca31){var _0x5a19b7={'raw':![],'where':{}};var _0x5d9c5f={};var _0x509043={'count':0x0,'rows':[]};return db[_0xce5f('0x58')]['findOne']({'where':{'id':_0x14b492['params']['id']}})[_0xce5f('0xf')](handleEntityNotFound(_0x27ca31,null))[_0xce5f('0xf')](function(_0x5c2ea3){if(_0x5c2ea3){_0x5d9c5f[_0xce5f('0x46')]=_[_0xce5f('0x48')](db[_0xce5f('0x82')]['rawAttributes']);_0x5d9c5f[_0xce5f('0x47')]=_[_0xce5f('0x48')](_0x14b492[_0xce5f('0x47')]);_0x5d9c5f[_0xce5f('0x49')]=_['intersection'](_0x5d9c5f[_0xce5f('0x46')],_0x5d9c5f[_0xce5f('0x47')]);_0x5a19b7[_0xce5f('0x4a')]=_[_0xce5f('0x4b')](_0x5d9c5f[_0xce5f('0x46')],qs['fields'](_0x14b492[_0xce5f('0x47')]['fields']));_0x5a19b7[_0xce5f('0x4a')]=_0x5a19b7['attributes'][_0xce5f('0x4d')]?_0x5a19b7[_0xce5f('0x4a')]:_0x5d9c5f[_0xce5f('0x46')];if(!_0x14b492[_0xce5f('0x47')][_0xce5f('0x4e')]('nolimit')){_0x5a19b7[_0xce5f('0x22')]=qs[_0xce5f('0x22')](_0x14b492[_0xce5f('0x47')][_0xce5f('0x22')]);_0x5a19b7[_0xce5f('0x21')]=qs[_0xce5f('0x21')](_0x14b492[_0xce5f('0x47')][_0xce5f('0x21')]);}_0x5a19b7[_0xce5f('0x50')]=qs[_0xce5f('0x51')](_0x14b492[_0xce5f('0x47')][_0xce5f('0x51')]);_0x5a19b7[_0xce5f('0x52')]=qs[_0xce5f('0x49')](_[_0xce5f('0x53')](_0x14b492[_0xce5f('0x47')],_0x5d9c5f[_0xce5f('0x49')]));_0x5a19b7['where'][_0xce5f('0x67')]=_0x5c2ea3['id'];if(_0x14b492[_0xce5f('0x47')][_0xce5f('0x54')]){_0x5a19b7[_0xce5f('0x52')]=_[_0xce5f('0x55')](_0x5a19b7[_0xce5f('0x52')],{'$or':_[_0xce5f('0x41')](_0x5a19b7['attributes'],function(_0x2e8267){var _0x543795={};_0x543795[_0x2e8267]={'$like':'%'+_0x14b492['query'][_0xce5f('0x54')]+'%'};return _0x543795;})});}_0x5a19b7=_['merge']({},_0x5a19b7,_0x14b492['options']);return db['MailInteraction']['count']({'where':_0x5a19b7['where']})[_0xce5f('0xf')](function(_0x287f98){_0x509043[_0xce5f('0x20')]=_0x287f98;if(_0x14b492[_0xce5f('0x47')][_0xce5f('0x5f')]){_0x5a19b7[_0xce5f('0x59')]=[{'model':db['CmContact'],'as':_0xce5f('0x85'),'required':![]},{'model':db[_0xce5f('0x86')],'as':_0xce5f('0x87'),'attributes':[_0xce5f('0x27'),'fullname',_0xce5f('0x88')],'required':![]},{'model':db[_0xce5f('0x89')],'as':_0xce5f('0x8a'),'attributes':['id',_0xce5f('0x27'),_0xce5f('0x8b')],'where':_0x14b492[_0xce5f('0x47')][_0xce5f('0x8c')]?{'id':_0x14b492[_0xce5f('0x47')][_0xce5f('0x8c')]}:undefined,'required':_0x14b492[_0xce5f('0x47')][_0xce5f('0x8c')]?!![]:![]}];}return db[_0xce5f('0x82')][_0xce5f('0x5a')](_0x5a19b7);})[_0xce5f('0xf')](function(_0x190079){_0x509043[_0xce5f('0x5b')]=_0x190079;return _0x509043;});}})[_0xce5f('0xf')](respondWithFilteredResult(_0x27ca31,_0x5a19b7))[_0xce5f('0x1a')](handleError(_0x27ca31,null));};exports[_0xce5f('0x8d')]=function addApplications(_0x5a262f,_0x4be75a){var _0x15ccbf=_0x5a262f['params']['id'];var _0x1c5dc8=_0x5a262f[_0xce5f('0x62')];var _0x1d03b6=0xc8;var _0x3e2b60=null;return db[_0xce5f('0x8e')][_0xce5f('0x8f')]({'isolationLevel':db[_0xce5f('0x8e')]['Transaction'][_0xce5f('0x90')][_0xce5f('0x91')]},function(_0x37015d){return db[_0xce5f('0x58')][_0xce5f('0x69')]({'where':{'id':_0x15ccbf},'transaction':_0x37015d})['then'](function(_0x187a2b){if(_0x187a2b){return db[_0xce5f('0x92')][_0xce5f('0x24')]({'where':{'MailAccountId':_0x15ccbf},'transaction':_0x37015d})[_0xce5f('0xf')](function(){var _0x103dcd=_[_0xce5f('0x41')](_0x1c5dc8,function(_0x46ad3d){_0x46ad3d[_0xce5f('0x67')]=_0x15ccbf;return _0x46ad3d;});return db[_0xce5f('0x92')][_0xce5f('0x93')](_0x103dcd,{'transaction':_0x37015d});});}else{_0x1d03b6=0x194;_0x3e2b60=[];}});})[_0xce5f('0xf')](function(){if(_0x1d03b6!==0x194){return db[_0xce5f('0x92')][_0xce5f('0x94')]({'where':{'MailAccountId':_0x15ccbf},'order':_0xce5f('0x95')})[_0xce5f('0xf')](function(_0x1f8aff){_0x3e2b60=_0x1f8aff;});}})[_0xce5f('0x1a')](function(_0x1a6a03){_0x1d03b6=0x1f4;logger['error'](_0x1a6a03[_0xce5f('0x26')]);if(_0x1a6a03[_0xce5f('0x27')]){delete _0x1a6a03['name'];}_0x3e2b60=_0x1a6a03;})['finally'](function(){if(_0x3e2b60===null){_0x4be75a[_0xce5f('0x1b')](_0x1d03b6);}else{if(_0x1d03b6===0x1f4){_0x4be75a['status'](_0x1d03b6)[_0xce5f('0x28')](_0x3e2b60);}else{_0x4be75a['status'](_0x1d03b6)[_0xce5f('0x1e')](_0x3e2b60);}}});};exports['getApplications']=function(_0x20fc38,_0x332f0f){var _0x1bb014={};var _0x1b6e95={};var _0x5e8e4a;var _0x307b5b;return db[_0xce5f('0x58')][_0xce5f('0x69')]({'where':{'id':_0x20fc38[_0xce5f('0x5c')]['id']}})['then'](handleEntityNotFound(_0x332f0f,null))['then'](function(_0x31cf50){if(_0x31cf50){_0x5e8e4a=_0x31cf50;_0x1b6e95[_0xce5f('0x46')]=_['keys'](db[_0xce5f('0x92')][_0xce5f('0x42')]);_0x1b6e95[_0xce5f('0x47')]=_[_0xce5f('0x48')](_0x20fc38[_0xce5f('0x47')]);_0x1b6e95['filters']=_['intersection'](_0x1b6e95[_0xce5f('0x46')],_0x1b6e95['query']);_0x1bb014[_0xce5f('0x4a')]=_['intersection'](_0x1b6e95['model'],qs[_0xce5f('0x4c')](_0x20fc38[_0xce5f('0x47')][_0xce5f('0x4c')]));_0x1bb014[_0xce5f('0x4a')]=_0x1bb014[_0xce5f('0x4a')][_0xce5f('0x4d')]?_0x1bb014['attributes']:_0x1b6e95[_0xce5f('0x46')];_0x1bb014[_0xce5f('0x50')]=qs[_0xce5f('0x51')](_0x20fc38[_0xce5f('0x47')]['sort']);_0x1bb014[_0xce5f('0x52')]=qs[_0xce5f('0x49')](_[_0xce5f('0x53')](_0x20fc38[_0xce5f('0x47')],_0x1b6e95[_0xce5f('0x49')]));if(_0x20fc38[_0xce5f('0x47')]['filter']){_0x1bb014[_0xce5f('0x52')]=_['merge'](_0x1bb014[_0xce5f('0x52')],{'$or':_['map'](_0x1bb014[_0xce5f('0x4a')],function(_0x1e3e98){var _0x257358={};_0x257358[_0x1e3e98]={'$like':'%'+_0x20fc38[_0xce5f('0x47')][_0xce5f('0x54')]+'%'};return _0x257358;})});}_0x1bb014=_['merge']({},_0x1bb014,_0x20fc38[_0xce5f('0x57')]);return _0x5e8e4a[_0xce5f('0x96')](_0x1bb014);}})[_0xce5f('0xf')](function(_0x278fbc){if(_0x278fbc){_0x307b5b=_0x278fbc[_0xce5f('0x4d')];if(!_0x20fc38[_0xce5f('0x47')]['hasOwnProperty'](_0xce5f('0x4f'))){_0x1bb014['limit']=qs[_0xce5f('0x22')](_0x20fc38[_0xce5f('0x47')][_0xce5f('0x22')]);_0x1bb014[_0xce5f('0x21')]=qs[_0xce5f('0x21')](_0x20fc38[_0xce5f('0x47')]['offset']);}return _0x5e8e4a[_0xce5f('0x96')](_0x1bb014);}})[_0xce5f('0xf')](function(_0xbee593){if(_0xbee593){return _0xbee593?{'count':_0x307b5b,'rows':_0xbee593}:null;}})[_0xce5f('0xf')](respondWithResult(_0x332f0f,null))['catch'](handleError(_0x332f0f,null));};exports[_0xce5f('0x97')]=function(_0x35e503,_0x1a59ed){var _0x43f20d={'raw':!![],'where':{}};var _0x1a2090={};var _0x3fe003={'count':0x0,'rows':[]};return db[_0xce5f('0x58')]['findOne']({'where':{'id':_0x35e503[_0xce5f('0x5c')]['id']}})[_0xce5f('0xf')](handleEntityNotFound(_0x1a59ed,null))[_0xce5f('0xf')](function(_0x4d239a){if(_0x4d239a){_0x1a2090[_0xce5f('0x46')]=_['keys'](db[_0xce5f('0x98')][_0xce5f('0x42')]);_0x1a2090[_0xce5f('0x47')]=_[_0xce5f('0x48')](_0x35e503[_0xce5f('0x47')]);_0x1a2090['filters']=_[_0xce5f('0x4b')](_0x1a2090[_0xce5f('0x46')],_0x1a2090[_0xce5f('0x47')]);_0x43f20d[_0xce5f('0x4a')]=_[_0xce5f('0x4b')](_0x1a2090[_0xce5f('0x46')],qs['fields'](_0x35e503[_0xce5f('0x47')][_0xce5f('0x4c')]));_0x43f20d[_0xce5f('0x4a')]=_0x43f20d['attributes'][_0xce5f('0x4d')]?_0x43f20d[_0xce5f('0x4a')]:_0x1a2090['model'];if(!_0x35e503['query'][_0xce5f('0x4e')](_0xce5f('0x4f'))){_0x43f20d['limit']=qs[_0xce5f('0x22')](_0x35e503['query'][_0xce5f('0x22')]);_0x43f20d[_0xce5f('0x21')]=qs[_0xce5f('0x21')](_0x35e503['query'][_0xce5f('0x21')]);}_0x43f20d['order']=qs['sort'](_0x35e503['query'][_0xce5f('0x51')]);_0x43f20d[_0xce5f('0x52')]=qs[_0xce5f('0x49')](_[_0xce5f('0x53')](_0x35e503[_0xce5f('0x47')],_0x1a2090[_0xce5f('0x49')]));_0x43f20d[_0xce5f('0x52')][_0xce5f('0x67')]=_0x4d239a['id'];if(_0x35e503[_0xce5f('0x47')][_0xce5f('0x54')]){_0x43f20d[_0xce5f('0x52')]=_['merge'](_0x43f20d[_0xce5f('0x52')],{'$or':_[_0xce5f('0x41')](_0x43f20d[_0xce5f('0x4a')],function(_0xdb7a21){var _0x32c2ae={};_0x32c2ae[_0xdb7a21]={'$like':'%'+_0x35e503[_0xce5f('0x47')]['filter']+'%'};return _0x32c2ae;})});}if(_0x35e503[_0xce5f('0x47')][_0xce5f('0x99')]){var _0x123939=_0x35e503['query'][_0xce5f('0x99')][_0xce5f('0x9a')](',');var _0x328745={};_0x328745[_0x123939[0x0]]={'$gte':moment(_0x123939[0x1])[_0xce5f('0x9b')](_0xce5f('0x9c'))};_0x43f20d[_0xce5f('0x52')]=_[_0xce5f('0x55')](_0x43f20d[_0xce5f('0x52')],_0x328745);}_0x43f20d=_[_0xce5f('0x55')]({},_0x43f20d,_0x35e503[_0xce5f('0x57')]);return db[_0xce5f('0x98')]['count']({'where':_0x43f20d[_0xce5f('0x52')]})[_0xce5f('0xf')](function(_0x236bb9){_0x3fe003[_0xce5f('0x20')]=_0x236bb9;if(_0x35e503[_0xce5f('0x47')][_0xce5f('0x5f')]){_0x43f20d[_0xce5f('0x59')]=[{'all':!![]}];}return db[_0xce5f('0x98')][_0xce5f('0x5a')](_0x43f20d);})[_0xce5f('0xf')](function(_0x109c9e){if(_0x35e503[_0xce5f('0x47')][_0xce5f('0x9d')]===_0xce5f('0x9e')){for(var _0x1507e9=0x0;_0x1507e9<_0x109c9e[_0xce5f('0x4d')];_0x1507e9++){_0x109c9e[_0x1507e9][_0xce5f('0x62')]=juice(_0x109c9e[_0x1507e9][_0xce5f('0x62')]);}}_0x3fe003[_0xce5f('0x5b')]=_0x109c9e;return _0x3fe003;});}})[_0xce5f('0xf')](respondWithFilteredResult(_0x1a59ed,_0x43f20d))['catch'](handleError(_0x1a59ed,null));};exports[_0xce5f('0x28')]=function(_0x2cda4d,_0x20e2d2){var _0x1200ed,_0x432482={},_0x31b6a6;if(_0x2cda4d['body']['to']){_0x31b6a6=_0x2cda4d[_0xce5f('0x62')]['to'][_0xce5f('0x9a')](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x2cda4d[_0xce5f('0x5c')]['id']},'include':[{'model':db[_0xce5f('0x9f')],'as':_0xce5f('0xa0'),'include':[{'model':db[_0xce5f('0xa1')],'as':_0xce5f('0xa2'),'where':{'email':_0x31b6a6},'limit':0x1,'order':[[_0xce5f('0xa3'),_0xce5f('0xa4')]]}]},{'model':db[_0xce5f('0x3f')],'as':_0xce5f('0x3e'),'raw':!![],'include':[{'model':db[_0xce5f('0xa5')],'as':_0xce5f('0xa5'),'raw':!![]}]}]})[_0xce5f('0xf')](handleEntityNotFound(_0x20e2d2,null))[_0xce5f('0xf')](function(_0x518885){if(!_0x518885)return;_0x1200ed=_0x518885;if(!_0x518885['Smtp'])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0xce5f('0xa6')](_0x2cda4d[_0xce5f('0x62')][_0xce5f('0xa7')])){_0x2cda4d[_0xce5f('0x62')][_0xce5f('0xa7')]=util[_0xce5f('0x9b')]('%s\x20<%s>',_0x518885[_0xce5f('0x27')],_0x518885[_0xce5f('0xa8')]||_0x518885[_0xce5f('0x3e')][_0xce5f('0x32')]);}if(_0x2cda4d[_0xce5f('0x62')][_0xce5f('0xa9')]&&_0x2cda4d[_0xce5f('0x62')][_0xce5f('0xa9')]['length']){for(var _0xf82b22=0x0;_0xf82b22<_0x2cda4d[_0xce5f('0x62')]['attachments'][_0xce5f('0x4d')];_0xf82b22+=0x1){_0x2cda4d['body'][_0xce5f('0xa9')][_0xf82b22]={'filename':_0x2cda4d[_0xce5f('0x62')]['attachments'][_0xf82b22][_0xce5f('0x27')],'path':path[_0xce5f('0xaa')](config[_0xce5f('0xab')],'server/files/attachments',_0x2cda4d[_0xce5f('0x62')][_0xce5f('0xa9')][_0xf82b22][_0xce5f('0xac')])};}}var _0x56d29e=_0x518885[_0xce5f('0xad')]();return respondWithRpcPromise(_0xce5f('0xae'),'sendMail',{'account':_0x56d29e,'message':_0x2cda4d[_0xce5f('0x62')]});})[_0xce5f('0xf')](function(_0x314206){if(!_0x314206)return;_0x432482=_0x314206;if(!_0x1200ed[_0xce5f('0xa0')])throw new Error(_0xce5f('0xaf'));if(_0x1200ed[_0xce5f('0xa0')][_0xce5f('0xa2')]['length'])return _0x1200ed[_0xce5f('0xa0')][_0xce5f('0xa2')][0x0];return db[_0xce5f('0xa1')][_0xce5f('0x6d')](_[_0xce5f('0x7')](_0x2cda4d[_0xce5f('0x62')],{'firstName':_0x2cda4d[_0xce5f('0x62')]['to'],'email':_0x2cda4d[_0xce5f('0x62')]['to'],'phone':_0x2cda4d[_0xce5f('0x62')]['to'],'ListId':_0x1200ed['ListId']}));})[_0xce5f('0xf')](function(_0x16266a){if(!_0x16266a)return;var _0x5f0b72={'UserId':_0x2cda4d[_0xce5f('0x32')]['id'],'ContactId':_0x16266a['id'],'MailAccountId':_0x1200ed['id'],'inReplyTo':_0x432482[_0xce5f('0xb0')],'to':_0x2cda4d[_0xce5f('0x62')][_0xce5f('0xa7')],'cc':_0x2cda4d['body']['cc'],'subject':_0x2cda4d[_0xce5f('0x62')][_0xce5f('0xb1')],'attach':_0x2cda4d[_0xce5f('0x62')][_0xce5f('0xb2')],'firstMsgDirection':_0xce5f('0xb3'),'lastMsgAt':moment()[_0xce5f('0x9b')](_0xce5f('0x9c')),'lastMsgDirection':_0xce5f('0xb3'),'Messages':[_[_0xce5f('0x55')](_0x2cda4d[_0xce5f('0x62')],{'messageId':_0x432482[_0xce5f('0xb0')],'sentAt':moment()[_0xce5f('0x9b')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x1200ed['id'],'UserId':_0x2cda4d[_0xce5f('0x32')]['id'],'ContactId':_0x16266a['id']})]};if(_0x2cda4d[_0xce5f('0x62')][_0xce5f('0xb4')]){_0x5f0b72=_[_0xce5f('0x55')](_0x5f0b72,_0x2cda4d[_0xce5f('0x62')][_0xce5f('0xb4')]);}return db['MailInteraction'][_0xce5f('0x6d')](_0x5f0b72,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});})[_0xce5f('0xf')](respondWithResult(_0x20e2d2,null))[_0xce5f('0x1a')](handleError(_0x20e2d2,null));};exports[_0xce5f('0xb5')]=function(_0x4eedea,_0x5864c1){return db['MailAccount'][_0xce5f('0x60')]({'where':{'id':_0x4eedea[_0xce5f('0x5c')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xce5f('0x3e'),'raw':!![],'include':[{'model':db[_0xce5f('0xa5')],'as':_0xce5f('0xa5'),'raw':!![]}]}]})[_0xce5f('0xf')](handleEntityNotFound(_0x5864c1,null))['then'](function(_0x1bf4a2){if(!_0x1bf4a2[_0xce5f('0x3e')])return;var _0x1a4280=_0x1bf4a2['getSmtpOptions']();return respondWithRpcPromise(_0xce5f('0xb6'),_0xce5f('0xb5'),{'account':_0x1a4280});})[_0xce5f('0xf')](respondWithResult(_0x5864c1,null))[_0xce5f('0x1a')](handleError(_0x5864c1,null));};exports[_0xce5f('0x24')]=function(_0x520875,_0x801a8c){return db[_0xce5f('0x58')][_0xce5f('0x60')]({'where':{'id':_0x520875['params']['id']}})[_0xce5f('0xf')](handleEntityNotFound(_0x801a8c,null))[_0xce5f('0xf')](function(_0x5c0b51){if(_0x5c0b51&&_0x5c0b51[_0xce5f('0x3b')]){throw new db['Sequelize'][(_0xce5f('0xb7'))](_0xce5f('0xb8'));}return _0x5c0b51;})[_0xce5f('0xf')](removeEntity(_0x801a8c,null))[_0xce5f('0x1a')](handleError(_0x801a8c,null));};exports[_0xce5f('0xb9')]=function(_0xa918d0,_0x405b03){return db[_0xce5f('0x58')][_0xce5f('0x60')]({'where':{'id':_0xa918d0['params']['id']}})[_0xce5f('0xf')](handleEntityNotFound(_0x405b03,null))[_0xce5f('0xf')](function(_0x42d305){if(_0x42d305){return _0x42d305[_0xce5f('0xb9')](_0xa918d0['body'][_0xce5f('0x6e')],_[_0xce5f('0x83')](_0xa918d0[_0xce5f('0x62')],[_0xce5f('0x6e'),'id'])||{})['spread'](function(_0x663027){for(var _0x44ccf1=0x0;_0x44ccf1<_0xa918d0[_0xce5f('0x62')][_0xce5f('0x6e')][_0xce5f('0x4d')];_0x44ccf1+=0x1){socket[_0xce5f('0xba')](_0xce5f('0xbb'),{'UserId':Number(_0xa918d0[_0xce5f('0x62')]['ids'][_0x44ccf1]),'MailAccountId':Number(_0xa918d0[_0xce5f('0x5c')]['id'])});}return _0x663027;});}})[_0xce5f('0xf')](respondWithResult(_0x405b03,null))[_0xce5f('0x1a')](handleError(_0x405b03,null));};exports['removeAgents']=function(_0x8e19d2,_0x1fa0c3){return db['MailAccount'][_0xce5f('0x60')]({'where':{'id':_0x8e19d2[_0xce5f('0x5c')]['id']}})[_0xce5f('0xf')](handleEntityNotFound(_0x1fa0c3,null))[_0xce5f('0xf')](function(_0x36b95f){if(_0x36b95f){return _0x36b95f[_0xce5f('0xbc')](_0x8e19d2[_0xce5f('0x47')][_0xce5f('0x6e')])[_0xce5f('0xf')](function(){if(_[_0xce5f('0xbd')](_0x8e19d2[_0xce5f('0x47')][_0xce5f('0x6e')])){for(var _0x361f1e=0x0;_0x361f1e<_0x8e19d2[_0xce5f('0x47')][_0xce5f('0x6e')][_0xce5f('0x4d')];_0x361f1e+=0x1){socket[_0xce5f('0xba')](_0xce5f('0xbe'),{'UserId':Number(_0x8e19d2[_0xce5f('0x47')]['ids'][_0x361f1e]),'MailAccountId':Number(_0x8e19d2[_0xce5f('0x5c')]['id'])});}}else{socket[_0xce5f('0xba')](_0xce5f('0xbe'),{'UserId':Number(_0x8e19d2[_0xce5f('0x47')][_0xce5f('0x6e')]),'MailAccountId':Number(_0x8e19d2[_0xce5f('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x1fa0c3,null))[_0xce5f('0x1a')](handleError(_0x1fa0c3,null));};exports[_0xce5f('0xbf')]=function(_0x1bd128,_0x5212de){var _0x47fadf={};var _0xfaba44={};var _0x20df9c;var _0x239c06;return db[_0xce5f('0x58')][_0xce5f('0x69')]({'where':{'id':_0x1bd128[_0xce5f('0x5c')]['id']}})[_0xce5f('0xf')](handleEntityNotFound(_0x5212de,null))[_0xce5f('0xf')](function(_0x271b7f){if(_0x271b7f){_0x20df9c=_0x271b7f;_0xfaba44[_0xce5f('0x46')]=_[_0xce5f('0x48')](db['User']['rawAttributes']);_0xfaba44[_0xce5f('0x47')]=_['keys'](_0x1bd128['query']);_0xfaba44[_0xce5f('0x49')]=_['intersection'](_0xfaba44[_0xce5f('0x46')],_0xfaba44[_0xce5f('0x47')]);_0x47fadf['attributes']=_['intersection'](_0xfaba44[_0xce5f('0x46')],qs[_0xce5f('0x4c')](_0x1bd128[_0xce5f('0x47')]['fields']));_0x47fadf['attributes']=_0x47fadf['attributes'][_0xce5f('0x4d')]?_0x47fadf[_0xce5f('0x4a')]:_0xfaba44['model'];_0x47fadf['order']=qs[_0xce5f('0x51')](_0x1bd128[_0xce5f('0x47')][_0xce5f('0x51')]);_0x47fadf[_0xce5f('0x52')]=qs[_0xce5f('0x49')](_[_0xce5f('0x53')](_0x1bd128[_0xce5f('0x47')],_0xfaba44[_0xce5f('0x49')]));if(_0x1bd128[_0xce5f('0x47')][_0xce5f('0x54')]){_0x47fadf[_0xce5f('0x52')]=_['merge'](_0x47fadf[_0xce5f('0x52')],{'$or':_[_0xce5f('0x41')](_0x47fadf[_0xce5f('0x4a')],function(_0x291fc6){var _0x3b0511={};_0x3b0511[_0x291fc6]={'$like':'%'+_0x1bd128[_0xce5f('0x47')][_0xce5f('0x54')]+'%'};return _0x3b0511;})});}_0x47fadf=_['merge']({},_0x47fadf,_0x1bd128[_0xce5f('0x57')]);return _0x20df9c[_0xce5f('0xbf')](_0x47fadf);}})[_0xce5f('0xf')](function(_0x1dc846){if(_0x1dc846){_0x239c06=_0x1dc846[_0xce5f('0x4d')];if(!_0x1bd128[_0xce5f('0x47')][_0xce5f('0x4e')](_0xce5f('0x4f'))){_0x47fadf[_0xce5f('0x22')]=qs[_0xce5f('0x22')](_0x1bd128[_0xce5f('0x47')]['limit']);_0x47fadf['offset']=qs[_0xce5f('0x21')](_0x1bd128[_0xce5f('0x47')][_0xce5f('0x21')]);}return _0x20df9c[_0xce5f('0xbf')](_0x47fadf);}})[_0xce5f('0xf')](function(_0x149ff0){if(_0x149ff0){return _0x149ff0?{'count':_0x239c06,'rows':_0x149ff0}:null;}})[_0xce5f('0xf')](respondWithResult(_0x5212de,null))['catch'](handleError(_0x5212de,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 3c52137..63852f8 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 _0xb6ff=['hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','update','remove','hasOwnProperty'];(function(_0x668c22,_0x44282d){var _0x1f612c=function(_0x54a357){while(--_0x54a357){_0x668c22['push'](_0x668c22['shift']());}};_0x1f612c(++_0x44282d);}(_0xb6ff,0x185));var _0xfb6f=function(_0x1e3c02,_0x5c07a2){_0x1e3c02=_0x1e3c02-0x0;var _0x4d26d7=_0xb6ff[_0x1e3c02];return _0x4d26d7;};'use strict';var EventEmitter=require(_0xfb6f('0x0'));var MailAccount=require(_0xfb6f('0x1'))['db'][_0xfb6f('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xfb6f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfb6f('0x4'),'afterDestroy':_0xfb6f('0x5')};function emitEvent(_0x3f8484){return function(_0x5f34fa,_0x3dc99e,_0x82ec1f){MailAccountEvents['emit'](_0x3f8484+':'+_0x5f34fa['id'],_0x5f34fa);MailAccountEvents['emit'](_0x3f8484,_0x5f34fa);_0x82ec1f(null);};}for(var e in events){if(events[_0xfb6f('0x6')](e)){var event=events[e];MailAccount[_0xfb6f('0x7')](e,emitEvent(event));}}module[_0xfb6f('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xc971=['remove','emit','exports','events','../../mysqldb','MailAccount','setMaxListeners','save'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xc971,0x17b));var _0x1c97=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xc971[_0x5b561d];return _0x431060;};'use strict';var EventEmitter=require(_0x1c97('0x0'));var MailAccount=require(_0x1c97('0x1'))['db'][_0x1c97('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x1c97('0x3')](0x0);var events={'afterCreate':_0x1c97('0x4'),'afterUpdate':'update','afterDestroy':_0x1c97('0x5')};function emitEvent(_0x3de361){return function(_0x215896,_0x58bc7d,_0x47b9cb){MailAccountEvents[_0x1c97('0x6')](_0x3de361+':'+_0x215896['id'],_0x215896);MailAccountEvents[_0x1c97('0x6')](_0x3de361,_0x215896);_0x47b9cb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x1c97('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 02e6ecd..8d5357f 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 _0x74a7=['provider','custom','Smtp','host','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','pass','exports','define','MailAccount','mail_accounts'];(function(_0x5b17ec,_0x3ef1be){var _0x292367=function(_0x43d16e){while(--_0x43d16e){_0x5b17ec['push'](_0x5b17ec['shift']());}};_0x292367(++_0x3ef1be);}(_0x74a7,0x10c));var _0x774a=function(_0x3b6061,_0x372581){_0x3b6061=_0x3b6061-0x0;var _0x408cf1=_0x74a7[_0x3b6061];return _0x408cf1;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x774a('0x0')]=function(_0x649870){return _0x649870[_0x774a('0x1')](_0x774a('0x2'),attributes,{'tableName':_0x774a('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x530bb6=this;var _0x36d438={'id':_0x530bb6['id'],'tls':{'rejectUnauthorized':![]}};if(_0x530bb6[_0x774a('0x4')]!==_0x774a('0x5')){_0x36d438['service']=_0x530bb6[_0x774a('0x4')];}else{_0x36d438['host']=_0x530bb6[_0x774a('0x6')][_0x774a('0x7')];_0x36d438[_0x774a('0x8')]=_0x530bb6['Smtp'][_0x774a('0x8')];_0x36d438[_0x774a('0x9')]=_0x530bb6[_0x774a('0x6')][_0x774a('0x9')];}if(_0x530bb6[_0x774a('0x6')][_0x774a('0xa')]){if(_0x530bb6[_0x774a('0x6')][_0x774a('0xb')]){if(!_0x530bb6[_0x774a('0x6')][_0x774a('0xc')])throw new Error(_0x774a('0xd'));_0x36d438['auth']={'type':_0x774a('0xe'),'user':_0x530bb6['Smtp'][_0x774a('0xf')],'accessToken':_0x530bb6[_0x774a('0x6')][_0x774a('0xc')]['data5']};}else{_0x36d438['auth']={'user':_0x530bb6[_0x774a('0x6')][_0x774a('0xf')],'pass':_0x530bb6[_0x774a('0x6')][_0x774a('0x10')]};}}return _0x36d438;}}});}; \ No newline at end of file +var _0xc3a2=['pass','./mailAccount.attributes','exports','MailAccount','provider','custom','service','host','Smtp','port','secure','modernAuthentication','CloudProvider','auth','OAuth2','user','data5'];(function(_0x245ab4,_0x565708){var _0x3817e3=function(_0x2b8900){while(--_0x2b8900){_0x245ab4['push'](_0x245ab4['shift']());}};_0x3817e3(++_0x565708);}(_0xc3a2,0x155));var _0x2c3a=function(_0x9eb20f,_0xdaf600){_0x9eb20f=_0x9eb20f-0x0;var _0x3e4c42=_0xc3a2[_0x9eb20f];return _0x3e4c42;};'use strict';var attributes=require(_0x2c3a('0x0'));module[_0x2c3a('0x1')]=function(_0x14c01e){return _0x14c01e['define'](_0x2c3a('0x2'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x6dc09c=this;var _0x4f90dd={'id':_0x6dc09c['id'],'tls':{'rejectUnauthorized':![]}};if(_0x6dc09c[_0x2c3a('0x3')]!==_0x2c3a('0x4')){_0x4f90dd[_0x2c3a('0x5')]=_0x6dc09c[_0x2c3a('0x3')];}else{_0x4f90dd[_0x2c3a('0x6')]=_0x6dc09c[_0x2c3a('0x7')][_0x2c3a('0x6')];_0x4f90dd[_0x2c3a('0x8')]=_0x6dc09c[_0x2c3a('0x7')][_0x2c3a('0x8')];_0x4f90dd[_0x2c3a('0x9')]=_0x6dc09c[_0x2c3a('0x7')][_0x2c3a('0x9')];}if(_0x6dc09c[_0x2c3a('0x7')]['authentication']){if(_0x6dc09c[_0x2c3a('0x7')][_0x2c3a('0xa')]){if(!_0x6dc09c[_0x2c3a('0x7')][_0x2c3a('0xb')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x4f90dd[_0x2c3a('0xc')]={'type':_0x2c3a('0xd'),'user':_0x6dc09c[_0x2c3a('0x7')][_0x2c3a('0xe')],'accessToken':_0x6dc09c['Smtp'][_0x2c3a('0xb')][_0x2c3a('0xf')]};}else{_0x4f90dd[_0x2c3a('0xc')]={'user':_0x6dc09c[_0x2c3a('0x7')][_0x2c3a('0xe')],'pass':_0x6dc09c[_0x2c3a('0x7')][_0x2c3a('0x10')]};}}return _0x4f90dd;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index df2123f..c7696c6 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 _0x5f2f=['Attachments','UserId','User','agent','name','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetMailAccount','options','where','limit','include','model','attributes','map','MailAccount','find','raw','then','smtp','smtpOptions','getSmtpOptions','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','CmContact','DESC','MailApplication','MailServerOut','Smtp','CloudProvider','get','omit','applications','Applications','priority','asc','autoclose','push','close','Contacts','length','create','messageId','subject','format','MailMessage','Messages','inReplyTo','MailInteraction','spread','update','attach','YYYY-MM-DD\x20HH:mm:ss','interaction','contact','attachments','originCc','originChannel','Email','ChatOfflineMessageId','Attachment'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x361a55,_0x496916){_0x361a55=_0x361a55-0x0;var _0x368577=_0x5f2f[_0x361a55];return _0x368577;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var BPromise=require(_0xf5f2('0x2'));var rs=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var db=require(_0xf5f2('0x5'))['db'];var logger=require(_0xf5f2('0x6'))(_0xf5f2('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf5f2('0x8')][_0xf5f2('0x9')]({'port':0x232c});config[_0xf5f2('0xa')]=_[_0xf5f2('0xb')](config[_0xf5f2('0xa')],{'host':_0xf5f2('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf5f2('0xa')]));require(_0xf5f2('0xd'))[_0xf5f2('0xe')](socket);function respondWithRpcPromise(_0x56a69f,_0x375da4,_0x15dd7c){return new BPromise(function(_0x218ae3,_0x4e0e6b){return client[_0xf5f2('0xf')](_0x56a69f,_0x15dd7c)['then'](function(_0x53fb33){logger[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x375da4,'request\x20sent');logger[_0xf5f2('0x12')](_0xf5f2('0x13'),_0x375da4,_0xf5f2('0x14'),JSON[_0xf5f2('0x15')](_0x53fb33));if(_0x53fb33[_0xf5f2('0x16')]){if(_0x53fb33[_0xf5f2('0x16')]['code']===0x1f4){logger[_0xf5f2('0x16')](_0xf5f2('0x11'),_0x375da4,_0x53fb33[_0xf5f2('0x16')][_0xf5f2('0x17')]);return _0x4e0e6b(_0x53fb33[_0xf5f2('0x16')]['message']);}logger[_0xf5f2('0x16')](_0xf5f2('0x11'),_0x375da4,_0x53fb33[_0xf5f2('0x16')][_0xf5f2('0x17')]);return _0x218ae3(_0x53fb33[_0xf5f2('0x16')][_0xf5f2('0x17')]);}else{logger[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x375da4,_0xf5f2('0x14'));_0x218ae3(_0x53fb33[_0xf5f2('0x18')][_0xf5f2('0x17')]);}})[_0xf5f2('0x19')](function(_0x4ff59b){logger[_0xf5f2('0x16')](_0xf5f2('0x11'),_0x375da4,_0x4ff59b);_0x4e0e6b(_0x4ff59b);});});}exports[_0xf5f2('0x1a')]=function(_0x1bf655){var _0x56acc5=this;return new Promise(function(_0x34706d,_0x47101e){return db['MailAccount']['findAll']({'raw':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')][_0xf5f2('0x1c')]||null:null,'attributes':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')]['attributes']||null:null,'limit':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')][_0xf5f2('0x1d')]||null:null,'include':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')]['include']?_['map'](_0x1bf655[_0xf5f2('0x1b')][_0xf5f2('0x1e')],function(_0x13da6f){return{'model':db[_0x13da6f[_0xf5f2('0x1f')]],'as':_0x13da6f['as'],'attributes':_0x13da6f[_0xf5f2('0x20')],'include':_0x13da6f[_0xf5f2('0x1e')]?_[_0xf5f2('0x21')](_0x13da6f[_0xf5f2('0x1e')],function(_0x294414){return{'model':db[_0x294414['model']],'as':_0x294414['as'],'attributes':_0x294414[_0xf5f2('0x20')],'include':_0x294414[_0xf5f2('0x1e')]?_[_0xf5f2('0x21')](_0x294414[_0xf5f2('0x1e')],function(_0x198c73){return{'model':db[_0x198c73[_0xf5f2('0x1f')]],'as':_0x198c73['as'],'attributes':_0x198c73['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x22c826){logger[_0xf5f2('0x10')](_0xf5f2('0x1a'),_0x1bf655);logger['debug']('GetMailAccount',_0x1bf655,JSON[_0xf5f2('0x15')](_0x22c826));_0x34706d(_0x22c826);})[_0xf5f2('0x19')](function(_0x17394a){logger[_0xf5f2('0x16')](_0xf5f2('0x1a'),_0x17394a['message'],_0x1bf655);_0x47101e(_0x56acc5['error'](0x1f4,_0x17394a[_0xf5f2('0x17')]));});});};exports['ShowMailAccount']=function(_0xb744b9){var _0x58a4df=this;return new Promise(function(_0x45b643,_0x31087c){return db[_0xf5f2('0x22')][_0xf5f2('0x23')]({'raw':_0xb744b9[_0xf5f2('0x1b')]?_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x24')]===undefined?!![]:![]:!![],'where':_0xb744b9[_0xf5f2('0x1b')]?_0xb744b9['options'][_0xf5f2('0x1c')]||null:null,'attributes':_0xb744b9[_0xf5f2('0x1b')]?_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null,'include':_0xb744b9[_0xf5f2('0x1b')]?_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x1e')]?_['map'](_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x1e')],function(_0x55989d){return{'model':db[_0x55989d[_0xf5f2('0x1f')]],'as':_0x55989d['as'],'attributes':_0x55989d['attributes'],'include':_0x55989d[_0xf5f2('0x1e')]?_[_0xf5f2('0x21')](_0x55989d[_0xf5f2('0x1e')],function(_0x2e3cca){return{'model':db[_0x2e3cca['model']],'as':_0x2e3cca['as'],'attributes':_0x2e3cca['attributes'],'include':_0x2e3cca[_0xf5f2('0x1e')]?_[_0xf5f2('0x21')](_0x2e3cca[_0xf5f2('0x1e')],function(_0x4ec8fb){return{'model':db[_0x4ec8fb[_0xf5f2('0x1f')]],'as':_0x4ec8fb['as'],'attributes':_0x4ec8fb['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x25')](function(_0x566c47){if(_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x26')]===!![])_0x566c47['setDataValue'](_0xf5f2('0x27'),_0x566c47[_0xf5f2('0x28')]());logger[_0xf5f2('0x10')](_0xf5f2('0x29'),_0xb744b9);logger['debug']('ShowMailAccount',_0xb744b9,JSON[_0xf5f2('0x15')](_0x566c47));_0x45b643(_0x566c47);})[_0xf5f2('0x19')](function(_0x22b20c){logger[_0xf5f2('0x16')](_0xf5f2('0x29'),_0x22b20c[_0xf5f2('0x17')],_0xb744b9);_0x31087c(_0x58a4df[_0xf5f2('0x16')](0x1f4,_0x22b20c['message']));});});};exports[_0xf5f2('0x2a')]=function(_0x3b4ea6){var _0x536501=this;return new Promise(function(_0xc6a1ae,_0x3f3895){var _0x71b0e7={'body':_0x3b4ea6[_0xf5f2('0x2b')],'channel':_0xf5f2('0x2c')};var _0x3b6372=_[_0xf5f2('0x2d')](_[_0xf5f2('0x2e')](db['CmContact'][_0xf5f2('0x2f')]),[_0xf5f2('0x30'),_0xf5f2('0x31'),'CompanyId','ListId']);var _0x59eb00=![];if(_0x3b4ea6[_0xf5f2('0x2b')]['id']){delete _0x3b4ea6[_0xf5f2('0x2b')]['id'];}if(_['isNil'](_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x32')])){return _0x3f3895(_0x536501[_0xf5f2('0x16')](0x1f4,_0xf5f2('0x33')));}if(_[_0xf5f2('0x34')](_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x2b')])||_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x2b')]===''){return _0x3f3895(_0x536501[_0xf5f2('0x16')](0x1f4,_0xf5f2('0x35')));}if(_[_0xf5f2('0x34')](_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x36')])){return _0x3f3895(_0x536501['error'](0x1f4,_0xf5f2('0x37')+_0x3b6372));}if(!_['includes'](_0x3b6372,_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x36')])){return _0x3f3895(_0x536501[_0xf5f2('0x16')](0x1f4,_0xf5f2('0x38')+_0x3b6372));}var _0x31bf0e={};_0x31bf0e[_0x3b4ea6[_0xf5f2('0x2b')]['mapKey']]=_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x32')];return db[_0xf5f2('0x22')][_0xf5f2('0x23')]({'where':{'id':_0x3b4ea6[_0xf5f2('0x39')]['id']},'include':[{'model':db[_0xf5f2('0x3a')],'as':_0xf5f2('0x3b'),'include':[{'model':db[_0xf5f2('0x3c')],'as':'Contacts','where':_0x31bf0e,'limit':0x1,'order':[[_0xf5f2('0x31'),_0xf5f2('0x3d')]]}]},{'model':db[_0xf5f2('0x3e')],'as':'Applications'},{'model':db[_0xf5f2('0x3f')],'as':_0xf5f2('0x40'),'include':[{'model':db[_0xf5f2('0x41')],'as':'CloudProvider'}]}]})['then'](function(_0x7bb942){if(_0x7bb942&&_0x7bb942[_0xf5f2('0x3b')]){var _0x5db519=_0x7bb942[_0xf5f2('0x42')]({'plain':!![]});_0x71b0e7['account']=_[_0xf5f2('0x43')](_0x5db519,['Applications',_0xf5f2('0x3b')]);_0x71b0e7['account'][_0xf5f2('0x27')]=_0x7bb942[_0xf5f2('0x28')]();_0x71b0e7[_0xf5f2('0x44')]=_0x5db519[_0xf5f2('0x45')];_0x71b0e7['list']=_0x5db519[_0xf5f2('0x3b')];_0x71b0e7[_0xf5f2('0x44')]=_['orderBy'](_0x71b0e7['applications'],[_0xf5f2('0x46')],[_0xf5f2('0x47')]);if(_0x71b0e7['account']&&_0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x48')]){_0x71b0e7[_0xf5f2('0x44')][_0xf5f2('0x49')]({'id':0x0,'priority':_0x71b0e7['applications']['length']+0x1,'app':_0xf5f2('0x4a'),'appdata':_0xf5f2('0x48'),'interval':'*,*,*,*'});}if(_0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x45')]){delete _0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x45')];}if(_0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x3b')]){delete _0x71b0e7[_0xf5f2('0x39')]['List'];}if(_0x5db519['List'][_0xf5f2('0x4b')][_0xf5f2('0x4c')]){return _0x5db519[_0xf5f2('0x3b')][_0xf5f2('0x4b')][0x0];}var _0x21b0d3=_['defaults'](_0x3b4ea6[_0xf5f2('0x2b')],{'firstName':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x32')],'ListId':_0x5db519['ListId']});_0x21b0d3[_0x3b4ea6[_0xf5f2('0x2b')]['mapKey']]=_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x32')];return db[_0xf5f2('0x3c')][_0xf5f2('0x4d')](_0x21b0d3);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x756f1f){_0x71b0e7['contact']=_0x756f1f;if(_0x756f1f){if(!_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['messageId']){_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x4e')]=rs['generate']()+'\x20'+_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x32')];}var _0x4579f4={'ContactId':_0x756f1f['id'],'MailAccountId':_0x3b4ea6['account']['id'],'inReplyTo':_0x3b4ea6[_0xf5f2('0x2b')]['message'][_0xf5f2('0x4e')],'to':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x32')],'cc':_0x3b4ea6[_0xf5f2('0x2b')]['message']['cc'],'subject':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x4f')],'attach':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['attach'],'lastMsgAt':moment()[_0xf5f2('0x50')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0xf5f2('0x23')]({'where':{'closed':![],'MailAccountId':_0x3b4ea6['account']['id']},'include':[{'model':db[_0xf5f2('0x51')],'as':_0xf5f2('0x52'),'attributes':[_0xf5f2('0x4e')],'where':{'messageId':_0x3b4ea6[_0xf5f2('0x2b')]['message'][_0xf5f2('0x53')]}}]})[_0xf5f2('0x25')](function(_0x1ec682){if(_0x1ec682){return[_0x1ec682,![]];}return db[_0xf5f2('0x54')][_0xf5f2('0x4d')](_0x4579f4)[_0xf5f2('0x25')](function(_0x158768){return[_0x158768,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xf5f2('0x55')](function(_0x2d171d,_0xb39a6e){if(_0x2d171d){_0x59eb00=_0xb39a6e;if(!_0xb39a6e){return _0x2d171d[_0xf5f2('0x56')]({'inReplyTo':_0x3b4ea6['body'][_0xf5f2('0x17')]['messageId'],'to':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['from'],'cc':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['cc'],'subject':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x4f')],'attach':_0x2d171d['attach']?_0x2d171d[_0xf5f2('0x57')]:_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x57')],'substatus':null,'substatusAt':moment()[_0xf5f2('0x50')](_0xf5f2('0x58')),'lastMsgAt':moment()['format'](_0xf5f2('0x58')),'lastMsgDirection':'in'});}else{return _0x2d171d;}}})[_0xf5f2('0x25')](function(_0x4800fe){_0x71b0e7[_0xf5f2('0x59')]=_0x4800fe[_0xf5f2('0x42')]({'plain':!![]});_0x71b0e7[_0xf5f2('0x59')]['created']=_0x59eb00;return db['MailMessage']['create']({'body':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x2b')],'MailAccountId':_0x3b4ea6[_0xf5f2('0x39')]['id'],'MailInteractionId':_0x4800fe['id'],'direction':'in','ContactId':_0x71b0e7[_0xf5f2('0x5a')]['id'],'messageId':_0x3b4ea6[_0xf5f2('0x2b')]['message'][_0xf5f2('0x4e')],'from':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x32')],'to':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['to'],'cc':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['cc'],'subject':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x4f')],'attach':_0x3b4ea6['body']['message']['attach'],'Attachments':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x5b')],'originTo':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['originTo'],'originCc':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x5c')],'bcc':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['bcc'],'ChatWebsiteId':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['ChatWebsiteId']||null,'originChannel':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x5d')]||_0xf5f2('0x5e'),'ChatOfflineMessageId':_0x3b4ea6['body'][_0xf5f2('0x17')][_0xf5f2('0x5f')]||null},{'include':[{'model':db[_0xf5f2('0x60')],'as':_0xf5f2('0x61')}]});})[_0xf5f2('0x25')](function(_0x4f47e1){_0x71b0e7['message']=_0x4f47e1;if(_0x71b0e7[_0xf5f2('0x59')][_0xf5f2('0x62')]){return db[_0xf5f2('0x63')][_0xf5f2('0x23')]({'attributes':['id','name'],'where':{'id':_0x71b0e7['interaction'][_0xf5f2('0x62')]}})['then'](function(_0x4c4420){if(_0x4c4420){_0x71b0e7['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xf5f2('0x64'),'appdata':_0x4c4420[_0xf5f2('0x65')]+','+(_0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x66')]||0xa),'interval':_0xf5f2('0x67')});}return respondWithRpcPromise(_0xf5f2('0x68'),_0xf5f2('0x69'),_0x71b0e7);});}return respondWithRpcPromise(_0xf5f2('0x68'),_0xf5f2('0x69'),_0x71b0e7);})[_0xf5f2('0x25')](function(_0x9afb3c){_0xc6a1ae(_0x9afb3c);})[_0xf5f2('0x19')](function(_0x1ba503){_0x3f3895(_0x536501[_0xf5f2('0x16')](0x1f4,_0x1ba503[_0xf5f2('0x17')]));});});}; \ No newline at end of file +var _0x9f0e=['updatedAt','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','DESC','Applications','MailServerOut','Smtp','CloudProvider','get','omit','getSmtpOptions','applications','orderBy','asc','autoclose','push','close','*,*,*,*','length','defaults','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','create','Contact\x20not\x20found','update','interaction','created','MailMessage','originTo','originCc','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','where','attributes','limit','include','map','model','debug','ShowMailAccount','find','raw','smtp','setDataValue','smtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact'];(function(_0x3918c8,_0xbf6931){var _0x321976=function(_0x286b79){while(--_0x286b79){_0x3918c8['push'](_0x3918c8['shift']());}};_0x321976(++_0xbf6931);}(_0x9f0e,0x116));var _0xe9f0=function(_0x162750,_0x51a84c){_0x162750=_0x162750-0x0;var _0x384543=_0x9f0e[_0x162750];return _0x384543;};'use strict';var _=require(_0xe9f0('0x0'));var moment=require(_0xe9f0('0x1'));var BPromise=require(_0xe9f0('0x2'));var rs=require(_0xe9f0('0x3'));var Redis=require(_0xe9f0('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xe9f0('0x5'));var config=require(_0xe9f0('0x6'));var jayson=require(_0xe9f0('0x7'));var client=jayson[_0xe9f0('0x8')][_0xe9f0('0x9')]({'port':0x232c});config['redis']=_['defaults'](config[_0xe9f0('0xa')],{'host':_0xe9f0('0xb'),'port':0x18eb});var socket=require(_0xe9f0('0xc'))(new Redis(config['redis']));require(_0xe9f0('0xd'))[_0xe9f0('0xe')](socket);function respondWithRpcPromise(_0x20d602,_0x3386a8,_0xa523c0){return new BPromise(function(_0x240932,_0x807322){return client[_0xe9f0('0xf')](_0x20d602,_0xa523c0)[_0xe9f0('0x10')](function(_0x5352e0){logger[_0xe9f0('0x11')](_0xe9f0('0x12'),_0x3386a8,_0xe9f0('0x13'));logger['debug'](_0xe9f0('0x14'),_0x3386a8,'request\x20sent',JSON[_0xe9f0('0x15')](_0x5352e0));if(_0x5352e0[_0xe9f0('0x16')]){if(_0x5352e0[_0xe9f0('0x16')][_0xe9f0('0x17')]===0x1f4){logger['error'](_0xe9f0('0x12'),_0x3386a8,_0x5352e0['error'][_0xe9f0('0x18')]);return _0x807322(_0x5352e0[_0xe9f0('0x16')][_0xe9f0('0x18')]);}logger['error'](_0xe9f0('0x12'),_0x3386a8,_0x5352e0[_0xe9f0('0x16')][_0xe9f0('0x18')]);return _0x240932(_0x5352e0['error'][_0xe9f0('0x18')]);}else{logger[_0xe9f0('0x11')](_0xe9f0('0x12'),_0x3386a8,_0xe9f0('0x13'));_0x240932(_0x5352e0[_0xe9f0('0x19')][_0xe9f0('0x18')]);}})[_0xe9f0('0x1a')](function(_0x59bf5a){logger[_0xe9f0('0x16')](_0xe9f0('0x12'),_0x3386a8,_0x59bf5a);_0x807322(_0x59bf5a);});});}exports[_0xe9f0('0x1b')]=function(_0x5c4182){var _0x35e841=this;return new Promise(function(_0x30b8c7,_0x1698cf){return db[_0xe9f0('0x1c')]['findAll']({'raw':_0x5c4182[_0xe9f0('0x1d')]?_0x5c4182[_0xe9f0('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5c4182['options']?_0x5c4182['options'][_0xe9f0('0x1e')]||null:null,'attributes':_0x5c4182[_0xe9f0('0x1d')]?_0x5c4182[_0xe9f0('0x1d')][_0xe9f0('0x1f')]||null:null,'limit':_0x5c4182[_0xe9f0('0x1d')]?_0x5c4182['options'][_0xe9f0('0x20')]||null:null,'include':_0x5c4182[_0xe9f0('0x1d')]?_0x5c4182[_0xe9f0('0x1d')][_0xe9f0('0x21')]?_[_0xe9f0('0x22')](_0x5c4182[_0xe9f0('0x1d')][_0xe9f0('0x21')],function(_0x1321bb){return{'model':db[_0x1321bb[_0xe9f0('0x23')]],'as':_0x1321bb['as'],'attributes':_0x1321bb[_0xe9f0('0x1f')],'include':_0x1321bb['include']?_[_0xe9f0('0x22')](_0x1321bb[_0xe9f0('0x21')],function(_0x2ddfba){return{'model':db[_0x2ddfba[_0xe9f0('0x23')]],'as':_0x2ddfba['as'],'attributes':_0x2ddfba['attributes'],'include':_0x2ddfba[_0xe9f0('0x21')]?_[_0xe9f0('0x22')](_0x2ddfba[_0xe9f0('0x21')],function(_0x1f98a7){return{'model':db[_0x1f98a7[_0xe9f0('0x23')]],'as':_0x1f98a7['as'],'attributes':_0x1f98a7['attributes']};}):[]};}):[]};}):[]:[]})[_0xe9f0('0x10')](function(_0xdc16bc){logger[_0xe9f0('0x11')](_0xe9f0('0x1b'),_0x5c4182);logger[_0xe9f0('0x24')](_0xe9f0('0x1b'),_0x5c4182,JSON[_0xe9f0('0x15')](_0xdc16bc));_0x30b8c7(_0xdc16bc);})[_0xe9f0('0x1a')](function(_0x2b6503){logger[_0xe9f0('0x16')](_0xe9f0('0x1b'),_0x2b6503[_0xe9f0('0x18')],_0x5c4182);_0x1698cf(_0x35e841[_0xe9f0('0x16')](0x1f4,_0x2b6503[_0xe9f0('0x18')]));});});};exports[_0xe9f0('0x25')]=function(_0x2097c4){var _0x80e3ac=this;return new Promise(function(_0x3e1846,_0x2e7535){return db[_0xe9f0('0x1c')][_0xe9f0('0x26')]({'raw':_0x2097c4[_0xe9f0('0x1d')]?_0x2097c4[_0xe9f0('0x1d')][_0xe9f0('0x27')]===undefined?!![]:![]:!![],'where':_0x2097c4['options']?_0x2097c4['options']['where']||null:null,'attributes':_0x2097c4[_0xe9f0('0x1d')]?_0x2097c4['options'][_0xe9f0('0x1f')]||null:null,'include':_0x2097c4[_0xe9f0('0x1d')]?_0x2097c4['options'][_0xe9f0('0x21')]?_['map'](_0x2097c4['options']['include'],function(_0x165440){return{'model':db[_0x165440[_0xe9f0('0x23')]],'as':_0x165440['as'],'attributes':_0x165440['attributes'],'include':_0x165440[_0xe9f0('0x21')]?_[_0xe9f0('0x22')](_0x165440[_0xe9f0('0x21')],function(_0x4d4186){return{'model':db[_0x4d4186['model']],'as':_0x4d4186['as'],'attributes':_0x4d4186[_0xe9f0('0x1f')],'include':_0x4d4186[_0xe9f0('0x21')]?_[_0xe9f0('0x22')](_0x4d4186['include'],function(_0x3ca032){return{'model':db[_0x3ca032[_0xe9f0('0x23')]],'as':_0x3ca032['as'],'attributes':_0x3ca032[_0xe9f0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe9f0('0x10')](function(_0x2b38de){if(_0x2097c4['options'][_0xe9f0('0x28')]===!![])_0x2b38de[_0xe9f0('0x29')](_0xe9f0('0x2a'),_0x2b38de['getSmtpOptions']());logger[_0xe9f0('0x11')](_0xe9f0('0x25'),_0x2097c4);logger['debug'](_0xe9f0('0x25'),_0x2097c4,JSON['stringify'](_0x2b38de));_0x3e1846(_0x2b38de);})[_0xe9f0('0x1a')](function(_0x55c0bd){logger['error']('ShowMailAccount',_0x55c0bd['message'],_0x2097c4);_0x2e7535(_0x80e3ac['error'](0x1f4,_0x55c0bd[_0xe9f0('0x18')]));});});};exports[_0xe9f0('0x2b')]=function(_0x2d8f93){var _0x40c2c6=this;return new Promise(function(_0x2560c6,_0xd9b61b){var _0x3d4eb7={'body':_0x2d8f93[_0xe9f0('0x2c')],'channel':_0xe9f0('0x2d')};var _0x4e1c68=_[_0xe9f0('0x2e')](_[_0xe9f0('0x2f')](db[_0xe9f0('0x30')]['rawAttributes']),['createdAt',_0xe9f0('0x31'),'CompanyId',_0xe9f0('0x32')]);var _0x52613a=![];if(_0x2d8f93[_0xe9f0('0x2c')]['id']){delete _0x2d8f93[_0xe9f0('0x2c')]['id'];}if(_['isNil'](_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x33')])){return _0xd9b61b(_0x40c2c6[_0xe9f0('0x16')](0x1f4,_0xe9f0('0x34')));}if(_[_0xe9f0('0x35')](_0x2d8f93['body'][_0xe9f0('0x2c')])||_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x2c')]===''){return _0xd9b61b(_0x40c2c6[_0xe9f0('0x16')](0x1f4,_0xe9f0('0x36')));}if(_['isNil'](_0x2d8f93[_0xe9f0('0x2c')]['mapKey'])){return _0xd9b61b(_0x40c2c6['error'](0x1f4,_0xe9f0('0x37')+_0x4e1c68));}if(!_[_0xe9f0('0x38')](_0x4e1c68,_0x2d8f93['body'][_0xe9f0('0x39')])){return _0xd9b61b(_0x40c2c6[_0xe9f0('0x16')](0x1f4,_0xe9f0('0x3a')+_0x4e1c68));}var _0x7b167b={};_0x7b167b[_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x39')]]=_0x2d8f93[_0xe9f0('0x2c')]['from'];return db[_0xe9f0('0x1c')]['find']({'where':{'id':_0x2d8f93[_0xe9f0('0x3b')]['id']},'include':[{'model':db['CmList'],'as':_0xe9f0('0x3c'),'include':[{'model':db['CmContact'],'as':_0xe9f0('0x3d'),'where':_0x7b167b,'limit':0x1,'order':[[_0xe9f0('0x31'),_0xe9f0('0x3e')]]}]},{'model':db['MailApplication'],'as':_0xe9f0('0x3f')},{'model':db[_0xe9f0('0x40')],'as':_0xe9f0('0x41'),'include':[{'model':db[_0xe9f0('0x42')],'as':_0xe9f0('0x42')}]}]})[_0xe9f0('0x10')](function(_0x6ece3f){if(_0x6ece3f&&_0x6ece3f[_0xe9f0('0x3c')]){var _0x18fc2b=_0x6ece3f[_0xe9f0('0x43')]({'plain':!![]});_0x3d4eb7[_0xe9f0('0x3b')]=_[_0xe9f0('0x44')](_0x18fc2b,['Applications','List']);_0x3d4eb7[_0xe9f0('0x3b')][_0xe9f0('0x2a')]=_0x6ece3f[_0xe9f0('0x45')]();_0x3d4eb7['applications']=_0x18fc2b[_0xe9f0('0x3f')];_0x3d4eb7['list']=_0x18fc2b[_0xe9f0('0x3c')];_0x3d4eb7[_0xe9f0('0x46')]=_[_0xe9f0('0x47')](_0x3d4eb7[_0xe9f0('0x46')],['priority'],[_0xe9f0('0x48')]);if(_0x3d4eb7[_0xe9f0('0x3b')]&&_0x3d4eb7['account'][_0xe9f0('0x49')]){_0x3d4eb7[_0xe9f0('0x46')][_0xe9f0('0x4a')]({'id':0x0,'priority':_0x3d4eb7[_0xe9f0('0x46')]['length']+0x1,'app':_0xe9f0('0x4b'),'appdata':_0xe9f0('0x49'),'interval':_0xe9f0('0x4c')});}if(_0x3d4eb7[_0xe9f0('0x3b')][_0xe9f0('0x3f')]){delete _0x3d4eb7[_0xe9f0('0x3b')][_0xe9f0('0x3f')];}if(_0x3d4eb7[_0xe9f0('0x3b')]['List']){delete _0x3d4eb7[_0xe9f0('0x3b')][_0xe9f0('0x3c')];}if(_0x18fc2b[_0xe9f0('0x3c')][_0xe9f0('0x3d')][_0xe9f0('0x4d')]){return _0x18fc2b[_0xe9f0('0x3c')][_0xe9f0('0x3d')][0x0];}var _0xec9b3c=_[_0xe9f0('0x4e')](_0x2d8f93[_0xe9f0('0x2c')],{'firstName':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x33')],'ListId':_0x18fc2b[_0xe9f0('0x32')]});_0xec9b3c[_0x2d8f93[_0xe9f0('0x2c')]['mapKey']]=_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x33')];return db[_0xe9f0('0x30')]['create'](_0xec9b3c);}else{throw new Error('List\x20not\x20found');}})[_0xe9f0('0x10')](function(_0x57b904){_0x3d4eb7[_0xe9f0('0x4f')]=_0x57b904;if(_0x57b904){if(!_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')]['messageId']){_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')][_0xe9f0('0x50')]=rs[_0xe9f0('0x51')]()+'\x20'+_0x2d8f93['body'][_0xe9f0('0x18')][_0xe9f0('0x33')];}var _0x28a66e={'ContactId':_0x57b904['id'],'MailAccountId':_0x2d8f93[_0xe9f0('0x3b')]['id'],'inReplyTo':_0x2d8f93['body']['message'][_0xe9f0('0x50')],'to':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')][_0xe9f0('0x33')],'cc':_0x2d8f93[_0xe9f0('0x2c')]['message']['cc'],'subject':_0x2d8f93[_0xe9f0('0x2c')]['message'][_0xe9f0('0x52')],'attach':_0x2d8f93['body'][_0xe9f0('0x18')][_0xe9f0('0x53')],'lastMsgAt':moment()[_0xe9f0('0x54')](_0xe9f0('0x55')),'lastMsgDirection':'in'};return db[_0xe9f0('0x56')]['find']({'where':{'closed':![],'MailAccountId':_0x2d8f93['account']['id']},'include':[{'model':db['MailMessage'],'as':_0xe9f0('0x57'),'attributes':[_0xe9f0('0x50')],'where':{'messageId':_0x2d8f93['body'][_0xe9f0('0x18')]['inReplyTo']}}]})['then'](function(_0x156c65){if(_0x156c65){return[_0x156c65,![]];}return db[_0xe9f0('0x56')][_0xe9f0('0x58')](_0x28a66e)[_0xe9f0('0x10')](function(_0x1d2fb2){return[_0x1d2fb2,!![]];});});}else{throw new Error(_0xe9f0('0x59'));}})['spread'](function(_0x5e4ad4,_0x1255e6){if(_0x5e4ad4){_0x52613a=_0x1255e6;if(!_0x1255e6){return _0x5e4ad4[_0xe9f0('0x5a')]({'inReplyTo':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')]['messageId'],'to':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')][_0xe9f0('0x33')],'cc':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')]['cc'],'subject':_0x2d8f93[_0xe9f0('0x2c')]['message'][_0xe9f0('0x52')],'attach':_0x5e4ad4[_0xe9f0('0x53')]?_0x5e4ad4[_0xe9f0('0x53')]:_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')]['attach'],'substatus':null,'substatusAt':moment()[_0xe9f0('0x54')](_0xe9f0('0x55')),'lastMsgAt':moment()[_0xe9f0('0x54')](_0xe9f0('0x55')),'lastMsgDirection':'in'});}else{return _0x5e4ad4;}}})[_0xe9f0('0x10')](function(_0x42aab8){_0x3d4eb7[_0xe9f0('0x5b')]=_0x42aab8[_0xe9f0('0x43')]({'plain':!![]});_0x3d4eb7[_0xe9f0('0x5b')][_0xe9f0('0x5c')]=_0x52613a;return db[_0xe9f0('0x5d')][_0xe9f0('0x58')]({'body':_0x2d8f93['body'][_0xe9f0('0x2c')],'MailAccountId':_0x2d8f93[_0xe9f0('0x3b')]['id'],'MailInteractionId':_0x42aab8['id'],'direction':'in','ContactId':_0x3d4eb7[_0xe9f0('0x4f')]['id'],'messageId':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')][_0xe9f0('0x50')],'from':_0x2d8f93[_0xe9f0('0x2c')]['message'][_0xe9f0('0x33')],'to':_0x2d8f93[_0xe9f0('0x2c')]['message']['to'],'cc':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')]['cc'],'subject':_0x2d8f93[_0xe9f0('0x2c')]['message'][_0xe9f0('0x52')],'attach':_0x2d8f93[_0xe9f0('0x2c')]['message'][_0xe9f0('0x53')],'Attachments':_0x2d8f93[_0xe9f0('0x2c')]['message']['attachments'],'originTo':_0x2d8f93[_0xe9f0('0x2c')]['message'][_0xe9f0('0x5e')],'originCc':_0x2d8f93[_0xe9f0('0x2c')]['message'][_0xe9f0('0x5f')],'bcc':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')][_0xe9f0('0x60')],'ChatWebsiteId':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')][_0xe9f0('0x61')]||null,'originChannel':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')]['originChannel']||_0xe9f0('0x62'),'ChatOfflineMessageId':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')][_0xe9f0('0x63')]||null},{'include':[{'model':db[_0xe9f0('0x64')],'as':_0xe9f0('0x65')}]});})[_0xe9f0('0x10')](function(_0x114033){_0x3d4eb7['message']=_0x114033;if(_0x3d4eb7[_0xe9f0('0x5b')][_0xe9f0('0x66')]){return db[_0xe9f0('0x67')][_0xe9f0('0x26')]({'attributes':['id',_0xe9f0('0x68')],'where':{'id':_0x3d4eb7[_0xe9f0('0x5b')]['UserId']}})[_0xe9f0('0x10')](function(_0x568a13){if(_0x568a13){_0x3d4eb7['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xe9f0('0x69'),'appdata':_0x568a13[_0xe9f0('0x68')]+','+(_0x3d4eb7[_0xe9f0('0x3b')][_0xe9f0('0x6a')]||0xa),'interval':_0xe9f0('0x4c')});}return respondWithRpcPromise(_0xe9f0('0x6b'),_0xe9f0('0x6c'),_0x3d4eb7);});}return respondWithRpcPromise(_0xe9f0('0x6b'),_0xe9f0('0x6c'),_0x3d4eb7);})['then'](function(_0x3b5047){_0x2560c6(_0x3b5047);})[_0xe9f0('0x1a')](function(_0xef6284){_0xd9b61b(_0x40c2c6[_0xe9f0('0x16')](0x1f4,_0xef6284[_0xe9f0('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index c4f690f..9dd1ddb 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 _0x952b=['update','removeListener','mailAccount:','./mailAccount.events','remove'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x952b,0x99));var _0xb952=function(_0x12b294,_0x192e53){_0x12b294=_0x12b294-0x0;var _0x7b92cb=_0x952b[_0x12b294];return _0x7b92cb;};'use strict';var MailAccountEvents=require(_0xb952('0x0'));var events=['save',_0xb952('0x1'),_0xb952('0x2')];function createListener(_0x4f059d,_0x12e65d){return function(_0x5a5254){_0x12e65d['emit'](_0x4f059d,_0x5a5254);};}function removeListener(_0x53d0e3,_0x2ece16){return function(){MailAccountEvents[_0xb952('0x3')](_0x53d0e3,_0x2ece16);};}exports['register']=function(_0x4173dd){for(var _0x40737a=0x0,_0x54dacf=events['length'];_0x40737a<_0x54dacf;_0x40737a++){var _0x5f505a=events[_0x40737a];var _0x153115=createListener(_0xb952('0x4')+_0x5f505a,_0x4173dd);MailAccountEvents['on'](_0x5f505a,_0x153115);}}; \ No newline at end of file +var _0x9af6=['removeListener','length','mailAccount:','./mailAccount.events','save','remove'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x9af6,0x1d7));var _0x69af=function(_0x5c64ae,_0x463dcb){_0x5c64ae=_0x5c64ae-0x0;var _0x422e59=_0x9af6[_0x5c64ae];return _0x422e59;};'use strict';var MailAccountEvents=require(_0x69af('0x0'));var events=[_0x69af('0x1'),_0x69af('0x2'),'update'];function createListener(_0x5cdef7,_0x3c6ca8){return function(_0x4ed59b){_0x3c6ca8['emit'](_0x5cdef7,_0x4ed59b);};}function removeListener(_0x185b85,_0x11f0e4){return function(){MailAccountEvents[_0x69af('0x3')](_0x185b85,_0x11f0e4);};}exports['register']=function(_0x3848c6){for(var _0x54e2f1=0x0,_0x1073cb=events[_0x69af('0x4')];_0x54e2f1<_0x1073cb;_0x54e2f1++){var _0x408d57=events[_0x54e2f1];var _0x17353a=createListener(_0x69af('0x5')+_0x408d57,_0x3848c6);MailAccountEvents['on'](_0x408d57,_0x17353a);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index c201472..313e094 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 _0xf040=['delete','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','put','update'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0xf040,0xb7));var _0x0f04=function(_0x4f5a01,_0x590de4){_0x4f5a01=_0x4f5a01-0x0;var _0x3c882a=_0xf040[_0x4f5a01];return _0x3c882a;};'use strict';var multer=require(_0x0f04('0x0'));var util=require(_0x0f04('0x1'));var path=require(_0x0f04('0x2'));var timeout=require(_0x0f04('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0f04('0x4'));var auth=require(_0x0f04('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0f04('0x6'));var controller=require('./mailApplication.controller');router[_0x0f04('0x7')](_0x0f04('0x8'),auth[_0x0f04('0x9')](),controller[_0x0f04('0xa')]);router[_0x0f04('0xb')](_0x0f04('0x8'),auth[_0x0f04('0x9')](),controller[_0x0f04('0xc')]);router[_0x0f04('0xd')](_0x0f04('0x8'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc0e0=['/:id','isAuthenticated','put','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./mailApplication.controller','get'];(function(_0x53d48b,_0x194821){var _0x465e53=function(_0x173ecd){while(--_0x173ecd){_0x53d48b['push'](_0x53d48b['shift']());}};_0x465e53(++_0x194821);}(_0xc0e0,0x1e1));var _0x0c0e=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xc0e0[_0x42245d];return _0x4b211a;};'use strict';var multer=require('multer');var util=require(_0x0c0e('0x0'));var path=require(_0x0c0e('0x1'));var timeout=require(_0x0c0e('0x2'));var express=require(_0x0c0e('0x3'));var router=express[_0x0c0e('0x4')]();var fs_extra=require(_0x0c0e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0c0e('0x6'));var controller=require(_0x0c0e('0x7'));router[_0x0c0e('0x8')](_0x0c0e('0x9'),auth[_0x0c0e('0xa')](),controller['show']);router[_0x0c0e('0xb')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0c0e('0xc')](_0x0c0e('0x9'),auth[_0x0c0e('0xa')](),controller[_0x0c0e('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 05ca4b1..bbd6334 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 _0xb8d3=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x179555,_0x144352){var _0x474d57=function(_0x2dff64){while(--_0x2dff64){_0x179555['push'](_0x179555['shift']());}};_0x474d57(++_0x144352);}(_0xb8d3,0x93));var _0x3b8d=function(_0x38d887,_0x261d68){_0x38d887=_0x38d887-0x0;var _0x84c717=_0xb8d3[_0x38d887];return _0x84c717;};'use strict';var Sequelize=require(_0x3b8d('0x0'));module[_0x3b8d('0x1')]={'priority':{'type':Sequelize[_0x3b8d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3b8d('0x3')],'allowNull':![],'defaultValue':_0x3b8d('0x4')},'appdata':{'type':Sequelize[_0x3b8d('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x3b8d('0x6')}}; \ No newline at end of file +var _0x10c7=['exports','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x4f0c2b,_0x2c9d14){var _0x526436=function(_0x2e13b6){while(--_0x2e13b6){_0x4f0c2b['push'](_0x4f0c2b['shift']());}};_0x526436(++_0x2c9d14);}(_0x10c7,0xd8));var _0x710c=function(_0x1e8d54,_0x334a60){_0x1e8d54=_0x1e8d54-0x0;var _0x58c69f=_0x10c7[_0x1e8d54];return _0x58c69f;};'use strict';var Sequelize=require('sequelize');module[_0x710c('0x0')]={'priority':{'type':Sequelize[_0x710c('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x710c('0x2')},'appdata':{'type':Sequelize[_0x710c('0x3')]()},'description':{'type':Sequelize[_0x710c('0x4')]},'interval':{'type':Sequelize[_0x710c('0x4')],'defaultValue':_0x710c('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 55d6234..93576eb 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 _0x9c44=['Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','then','body','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'];(function(_0x50c16c,_0x43b99e){var _0x24dc5f=function(_0x39b90f){while(--_0x39b90f){_0x50c16c['push'](_0x50c16c['shift']());}};_0x24dc5f(++_0x43b99e);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'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={'raw':!![],'where':{'id':_0x5987ae[_0x49c4('0x29')]['id']}},_0x46e04d={};_0x46e04d[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](db[_0x49c4('0x2c')][_0x49c4('0x2d')]);_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2b')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d['filters']=_['intersection'](_0x46e04d['model'],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x46e04d[_0x49c4('0x2a')],qs[_0x49c4('0x31')](_0x5987ae['query'][_0x49c4('0x31')]));_0x2b2793[_0x49c4('0x2f')]=_0x2b2793[_0x49c4('0x2f')][_0x49c4('0x32')]?_0x2b2793['attributes']:_0x46e04d['model'];if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x33')]){_0x2b2793[_0x49c4('0x34')]=[{'all':!![]}];}_0x2b2793=_[_0x49c4('0x35')]({},_0x2b2793,_0x5987ae[_0x49c4('0x36')]);return db['MailApplication'][_0x49c4('0x37')](_0x2b2793)[_0x49c4('0x38')](handleEntityNotFound(_0x889909,null))[_0x49c4('0x38')](respondWithResult(_0x889909,null))['catch'](handleError(_0x889909,null));};exports['update']=function(_0x85dce2,_0x1991e9){if(_0x85dce2[_0x49c4('0x39')]['id']){delete _0x85dce2[_0x49c4('0x39')]['id'];}return db[_0x49c4('0x2c')][_0x49c4('0x37')]({'where':{'id':_0x85dce2[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x1991e9,null))[_0x49c4('0x38')](saveUpdates(_0x85dce2['body'],null))[_0x49c4('0x38')](respondWithResult(_0x1991e9,null))['catch'](handleError(_0x1991e9,null));};exports[_0x49c4('0x23')]=function(_0x349791,_0x2625a6){return db[_0x49c4('0x2c')]['find']({'where':{'id':_0x349791[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x2625a6,null))[_0x49c4('0x38')](removeEntity(_0x2625a6,null))['catch'](handleError(_0x2625a6,null));}; \ No newline at end of file +var _0x54ef=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','show','params','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge','options','MailApplication','find','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x43b651,_0x8c2bf2){var _0x16862e=function(_0x105d2e){while(--_0x105d2e){_0x43b651['push'](_0x43b651['shift']());}};_0x16862e(++_0x8c2bf2);}(_0x54ef,0x112));var _0xf54e=function(_0x30a4f1,_0x45afe0){_0x30a4f1=_0x30a4f1-0x0;var _0x5c07b1=_0x54ef[_0x30a4f1];return _0x5c07b1;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];function respondWithStatusCode(_0x4b0ee1,_0x4bd828){_0x4bd828=_0x4bd828||0xcc;return function(_0x15a9d4){if(_0x15a9d4){return _0x4b0ee1[_0xf54e('0x19')](_0x4bd828);}return _0x4b0ee1[_0xf54e('0x1a')](_0x4bd828)[_0xf54e('0x1b')]();};}function respondWithResult(_0x5644aa,_0x331732){_0x331732=_0x331732||0xc8;return function(_0x1bbeaa){if(_0x1bbeaa){return _0x5644aa[_0xf54e('0x1a')](_0x331732)[_0xf54e('0x1c')](_0x1bbeaa);}};}function respondWithFilteredResult(_0x56828e,_0x2366ee){return function(_0x389abc){if(_0x389abc){var _0x3eb415=typeof _0x2366ee['offset']==='undefined'&&typeof _0x2366ee[_0xf54e('0x1d')]===_0xf54e('0x1e');var _0x1c02e7=_0x389abc[_0xf54e('0x1f')];var _0x15cc48=_0x3eb415?0x0:_0x2366ee[_0xf54e('0x20')];var _0x2e27b6=_0x3eb415?_0x389abc[_0xf54e('0x1f')]:_0x2366ee[_0xf54e('0x20')]+_0x2366ee[_0xf54e('0x1d')];var _0x226c96;if(_0x2e27b6>=_0x1c02e7){_0x2e27b6=_0x1c02e7;_0x226c96=0xc8;}else{_0x226c96=0xce;}_0x56828e['status'](_0x226c96);return _0x56828e['set'](_0xf54e('0x21'),_0x15cc48+'-'+_0x2e27b6+'/'+_0x1c02e7)['json'](_0x389abc);}return null;};}function patchUpdates(_0x3e1556){return function(_0x1bfe99){try{jsonpatch[_0xf54e('0x22')](_0x1bfe99,_0x3e1556,!![]);}catch(_0x9903fc){return BPromise[_0xf54e('0x23')](_0x9903fc);}return _0x1bfe99[_0xf54e('0x24')]();};}function saveUpdates(_0x388aa0,_0x11985e){return function(_0x3c0169){if(_0x3c0169){return _0x3c0169[_0xf54e('0x25')](_0x388aa0)[_0xf54e('0x26')](function(_0x5b83df){return _0x5b83df;});}return null;};}function removeEntity(_0x6f6d29,_0x54f914){return function(_0x264a8f){if(_0x264a8f){return _0x264a8f[_0xf54e('0x27')]()[_0xf54e('0x26')](function(){_0x6f6d29[_0xf54e('0x1a')](0xcc)[_0xf54e('0x1b')]();});}};}function handleEntityNotFound(_0x160160,_0x1e08d1){return function(_0x43488d){if(!_0x43488d){_0x160160[_0xf54e('0x19')](0x194);}return _0x43488d;};}function handleError(_0x33457f,_0xf6cdd7){_0xf6cdd7=_0xf6cdd7||0x1f4;return function(_0x39c0ae){logger[_0xf54e('0x28')](_0x39c0ae['stack']);if(_0x39c0ae[_0xf54e('0x29')]){delete _0x39c0ae['name'];}_0x33457f[_0xf54e('0x1a')](_0xf6cdd7)['send'](_0x39c0ae);};}exports[_0xf54e('0x2a')]=function(_0x269f47,_0x21ba00){var _0xa13cd0={'raw':!![],'where':{'id':_0x269f47[_0xf54e('0x2b')]['id']}},_0x25b643={};_0x25b643[_0xf54e('0x2c')]=_['keys'](db['MailApplication'][_0xf54e('0x2d')]);_0x25b643[_0xf54e('0x2e')]=_[_0xf54e('0x2f')](_0x269f47[_0xf54e('0x2e')]);_0x25b643[_0xf54e('0x30')]=_[_0xf54e('0x31')](_0x25b643[_0xf54e('0x2c')],_0x25b643[_0xf54e('0x2e')]);_0xa13cd0[_0xf54e('0x32')]=_[_0xf54e('0x31')](_0x25b643['model'],qs['fields'](_0x269f47[_0xf54e('0x2e')][_0xf54e('0x33')]));_0xa13cd0['attributes']=_0xa13cd0[_0xf54e('0x32')][_0xf54e('0x34')]?_0xa13cd0[_0xf54e('0x32')]:_0x25b643[_0xf54e('0x2c')];if(_0x269f47['query']['includeAll']){_0xa13cd0['include']=[{'all':!![]}];}_0xa13cd0=_[_0xf54e('0x35')]({},_0xa13cd0,_0x269f47[_0xf54e('0x36')]);return db[_0xf54e('0x37')][_0xf54e('0x38')](_0xa13cd0)[_0xf54e('0x26')](handleEntityNotFound(_0x21ba00,null))[_0xf54e('0x26')](respondWithResult(_0x21ba00,null))['catch'](handleError(_0x21ba00,null));};exports['update']=function(_0x530cee,_0xc04e04){if(_0x530cee[_0xf54e('0x39')]['id']){delete _0x530cee['body']['id'];}return db['MailApplication'][_0xf54e('0x38')]({'where':{'id':_0x530cee[_0xf54e('0x2b')]['id']}})[_0xf54e('0x26')](handleEntityNotFound(_0xc04e04,null))['then'](saveUpdates(_0x530cee[_0xf54e('0x39')],null))[_0xf54e('0x26')](respondWithResult(_0xc04e04,null))['catch'](handleError(_0xc04e04,null));};exports[_0xf54e('0x27')]=function(_0x6e5bdf,_0x5af03){return db[_0xf54e('0x37')][_0xf54e('0x38')]({'where':{'id':_0x6e5bdf[_0xf54e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5af03,null))['then'](removeEntity(_0x5af03,null))[_0xf54e('0x3a')](handleError(_0x5af03,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 85ebf70..826a0dd 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 _0x7de2=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4'];(function(_0x511ca2,_0x23b162){var _0x2364a8=function(_0x42bf9d){while(--_0x42bf9d){_0x511ca2['push'](_0x511ca2['shift']());}};_0x2364a8(++_0x23b162);}(_0x7de2,0x150));var _0x27de=function(_0x111337,_0x3391cc){_0x111337=_0x111337-0x0;var _0x2d4265=_0x7de2[_0x111337];return _0x2d4265;};'use strict';var _=require('lodash');var util=require(_0x27de('0x0'));var logger=require(_0x27de('0x1'))(_0x27de('0x2'));var moment=require(_0x27de('0x3'));var BPromise=require(_0x27de('0x4'));var rp=require(_0x27de('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x27de('0x6'));var attributes=require(_0x27de('0x7'));module[_0x27de('0x8')]=function(_0x6459b1,_0x3f5954){return _0x6459b1[_0x27de('0x9')](_0x27de('0xa'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x27de('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x654b=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailApplication.attributes','exports','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x5c38cd,_0x5a6b4e){var _0xc985ef=function(_0x4aa1df){while(--_0x4aa1df){_0x5c38cd['push'](_0x5c38cd['shift']());}};_0xc985ef(++_0x5a6b4e);}(_0x654b,0x16b));var _0xb654=function(_0x4acfd2,_0x5b9374){_0x4acfd2=_0x4acfd2-0x0;var _0x12afbe=_0x654b[_0x4acfd2];return _0x12afbe;};'use strict';var _=require(_0xb654('0x0'));var util=require('util');var logger=require(_0xb654('0x1'))(_0xb654('0x2'));var moment=require(_0xb654('0x3'));var BPromise=require(_0xb654('0x4'));var rp=require(_0xb654('0x5'));var fs=require('fs');var path=require(_0xb654('0x6'));var rimraf=require('rimraf');var config=require(_0xb654('0x7'));var attributes=require(_0xb654('0x8'));module[_0xb654('0x9')]=function(_0xced45a,_0x346225){return _0xced45a[_0xb654('0xa')]('MailApplication',attributes,{'tableName':_0xb654('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb654('0xc'),'collate':_0xb654('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index d3c5199..bf3132c 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 _0xc3ee=['jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','limit','debug','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3832ae,_0x3469bc){var _0xd4ef86=function(_0x346911){while(--_0x346911){_0x3832ae['push'](_0x3832ae['shift']());}};_0xd4ef86(++_0x3469bc);}(_0xc3ee,0xd1));var _0xec3e=function(_0x12665f,_0x3628cb){_0x12665f=_0x12665f-0x0;var _0x1b340f=_0xc3ee[_0x12665f];return _0x1b340f;};'use strict';var _=require(_0xec3e('0x0'));var util=require('util');var moment=require(_0xec3e('0x1'));var BPromise=require(_0xec3e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec3e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xec3e('0x4'));var logger=require(_0xec3e('0x5'))(_0xec3e('0x6'));var config=require(_0xec3e('0x7'));var jayson=require(_0xec3e('0x8'));var client=jayson[_0xec3e('0x9')][_0xec3e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x450a59,_0x4b2cb8,_0x2ac08d){return new BPromise(function(_0xb7a8ba,_0x3712eb){return client[_0xec3e('0xb')](_0x450a59,_0x2ac08d)[_0xec3e('0xc')](function(_0x519cee){logger[_0xec3e('0xd')](_0xec3e('0xe'),_0x4b2cb8,'request\x20sent');logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x4b2cb8,_0xec3e('0xf'),JSON[_0xec3e('0x10')](_0x519cee));if(_0x519cee[_0xec3e('0x11')]){if(_0x519cee[_0xec3e('0x11')][_0xec3e('0x12')]===0x1f4){logger[_0xec3e('0x11')](_0xec3e('0xe'),_0x4b2cb8,_0x519cee[_0xec3e('0x11')][_0xec3e('0x13')]);return _0x3712eb(_0x519cee[_0xec3e('0x11')][_0xec3e('0x13')]);}logger[_0xec3e('0x11')](_0xec3e('0xe'),_0x4b2cb8,_0x519cee['error']['message']);return _0xb7a8ba(_0x519cee[_0xec3e('0x11')][_0xec3e('0x13')]);}else{logger['info'](_0xec3e('0xe'),_0x4b2cb8,_0xec3e('0xf'));_0xb7a8ba(_0x519cee[_0xec3e('0x14')][_0xec3e('0x13')]);}})['catch'](function(_0x11570e){logger['error']('MailApplication,\x20%s,\x20%s',_0x4b2cb8,_0x11570e);_0x3712eb(_0x11570e);});});}exports[_0xec3e('0x15')]=function(_0x59a3ce){var _0x3eb051=this;return new Promise(function(_0x4d448b,_0x2dd3fd){return db[_0xec3e('0x16')][_0xec3e('0x17')](_0x59a3ce[_0xec3e('0x18')],{'raw':_0x59a3ce[_0xec3e('0x19')]?_0x59a3ce['options'][_0xec3e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59a3ce[_0xec3e('0x19')]?_0x59a3ce[_0xec3e('0x19')][_0xec3e('0x1b')]||null:null,'attributes':_0x59a3ce[_0xec3e('0x19')]?_0x59a3ce[_0xec3e('0x19')][_0xec3e('0x1c')]||null:null,'limit':_0x59a3ce[_0xec3e('0x19')]?_0x59a3ce[_0xec3e('0x19')][_0xec3e('0x1d')]||null:null})['then'](function(_0x5bf338){logger['info'](_0xec3e('0x15'),_0x59a3ce);logger[_0xec3e('0x1e')]('UpdateMailApplication',_0x59a3ce,JSON[_0xec3e('0x10')](_0x5bf338));_0x4d448b(_0x5bf338);})['catch'](function(_0x4d549d){logger[_0xec3e('0x11')]('UpdateMailApplication',_0x4d549d['message'],_0x59a3ce);_0x2dd3fd(_0x3eb051[_0xec3e('0x11')](0x1f4,_0x4d549d[_0xec3e('0x13')]));});});}; \ No newline at end of file +var _0xc2a1=['UpdateMailApplication','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','MailApplication','update','body','options','raw','where','attributes','then'];(function(_0x2731f0,_0x126b1b){var _0x36a180=function(_0x44d1a9){while(--_0x44d1a9){_0x2731f0['push'](_0x2731f0['shift']());}};_0x36a180(++_0x126b1b);}(_0xc2a1,0x111));var _0x1c2a=function(_0x2873d2,_0x3178b6){_0x2873d2=_0x2873d2-0x0;var _0x31b7c1=_0xc2a1[_0x2873d2];return _0x31b7c1;};'use strict';var _=require('lodash');var util=require(_0x1c2a('0x0'));var moment=require(_0x1c2a('0x1'));var BPromise=require(_0x1c2a('0x2'));var rs=require(_0x1c2a('0x3'));var fs=require('fs');var Redis=require(_0x1c2a('0x4'));var db=require(_0x1c2a('0x5'))['db'];var utils=require(_0x1c2a('0x6'));var logger=require(_0x1c2a('0x7'))(_0x1c2a('0x8'));var config=require(_0x1c2a('0x9'));var jayson=require(_0x1c2a('0xa'));var client=jayson[_0x1c2a('0xb')][_0x1c2a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xed8dd0,_0x11217f,_0x3c0461){return new BPromise(function(_0xe7181a,_0x31fbab){return client[_0x1c2a('0xd')](_0xed8dd0,_0x3c0461)['then'](function(_0x5572c4){logger['info'](_0x1c2a('0xe'),_0x11217f,_0x1c2a('0xf'));logger[_0x1c2a('0x10')](_0x1c2a('0x11'),_0x11217f,_0x1c2a('0xf'),JSON[_0x1c2a('0x12')](_0x5572c4));if(_0x5572c4[_0x1c2a('0x13')]){if(_0x5572c4['error'][_0x1c2a('0x14')]===0x1f4){logger[_0x1c2a('0x13')](_0x1c2a('0xe'),_0x11217f,_0x5572c4[_0x1c2a('0x13')][_0x1c2a('0x15')]);return _0x31fbab(_0x5572c4[_0x1c2a('0x13')][_0x1c2a('0x15')]);}logger[_0x1c2a('0x13')](_0x1c2a('0xe'),_0x11217f,_0x5572c4[_0x1c2a('0x13')][_0x1c2a('0x15')]);return _0xe7181a(_0x5572c4['error'][_0x1c2a('0x15')]);}else{logger[_0x1c2a('0x16')](_0x1c2a('0xe'),_0x11217f,_0x1c2a('0xf'));_0xe7181a(_0x5572c4[_0x1c2a('0x17')][_0x1c2a('0x15')]);}})[_0x1c2a('0x18')](function(_0x5188a3){logger['error'](_0x1c2a('0xe'),_0x11217f,_0x5188a3);_0x31fbab(_0x5188a3);});});}exports['UpdateMailApplication']=function(_0x19b336){var _0x1720f8=this;return new Promise(function(_0x3a3d30,_0x5e4b03){return db[_0x1c2a('0x19')][_0x1c2a('0x1a')](_0x19b336[_0x1c2a('0x1b')],{'raw':_0x19b336[_0x1c2a('0x1c')]?_0x19b336['options'][_0x1c2a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19b336['options']?_0x19b336[_0x1c2a('0x1c')][_0x1c2a('0x1e')]||null:null,'attributes':_0x19b336[_0x1c2a('0x1c')]?_0x19b336[_0x1c2a('0x1c')][_0x1c2a('0x1f')]||null:null,'limit':_0x19b336[_0x1c2a('0x1c')]?_0x19b336[_0x1c2a('0x1c')]['limit']||null:null})[_0x1c2a('0x20')](function(_0x15e7b8){logger[_0x1c2a('0x16')]('UpdateMailApplication',_0x19b336);logger[_0x1c2a('0x10')](_0x1c2a('0x21'),_0x19b336,JSON[_0x1c2a('0x12')](_0x15e7b8));_0x3a3d30(_0x15e7b8);})[_0x1c2a('0x18')](function(_0x383454){logger['error']('UpdateMailApplication',_0x383454[_0x1c2a('0x15')],_0x19b336);_0x5e4b03(_0x1720f8[_0x1c2a('0x13')](0x1f4,_0x383454[_0x1c2a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index b4cf9d7..8f22ef8 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 _0xa5a4=['isAuthenticated','index','/:id','show','/:id/download','post','create','/:id/tags','mail','mailinteraction:addtags','addTags','put','update','delete','tracked','mailinteraction:destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x547b47,_0x7d6422){var _0x263595=function(_0x1dc7e5){while(--_0x1dc7e5){_0x547b47['push'](_0x547b47['shift']());}};_0x263595(++_0x7d6422);}(_0xa5a4,0x9c));var _0x4a5a=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xa5a4[_0x13b8f3];return _0x1a6d06;};'use strict';var express=require(_0x4a5a('0x0'));var router=express[_0x4a5a('0x1')]();var auth=require(_0x4a5a('0x2'));var interaction=require(_0x4a5a('0x3'));var controller=require('./mailInteraction.controller');router[_0x4a5a('0x4')]('/',auth[_0x4a5a('0x5')](),controller[_0x4a5a('0x6')]);router[_0x4a5a('0x4')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x4a5a('0x4')](_0x4a5a('0x7'),auth[_0x4a5a('0x5')](),controller[_0x4a5a('0x8')]);router[_0x4a5a('0x4')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x4a5a('0x4')](_0x4a5a('0x9'),auth[_0x4a5a('0x5')](),controller['download']);router[_0x4a5a('0xa')]('/',auth[_0x4a5a('0x5')](),controller[_0x4a5a('0xb')]);router[_0x4a5a('0xa')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x4a5a('0xa')](_0x4a5a('0xc'),auth[_0x4a5a('0x5')](),interaction['tracked'](_0x4a5a('0xd'),_0x4a5a('0xe')),controller[_0x4a5a('0xf')]);router[_0x4a5a('0x10')](_0x4a5a('0x7'),auth[_0x4a5a('0x5')](),interaction['tracked'](_0x4a5a('0xd'),'mailinteraction:update'),controller[_0x4a5a('0x11')]);router[_0x4a5a('0x12')]('/:id',auth['isAuthenticated'](),interaction[_0x4a5a('0x13')](_0x4a5a('0xd'),_0x4a5a('0x14')),controller['destroy']);router['delete']('/:id/tags',auth[_0x4a5a('0x5')](),controller[_0x4a5a('0x15')]);module[_0x4a5a('0x16')]=router; \ No newline at end of file +var _0xeb06=['/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','put','tracked','delete','mailinteraction:destroy','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xeb06,0x173));var _0x6eb0=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xeb06[_0x432682];return _0x463d05;};'use strict';var express=require(_0x6eb0('0x0'));var router=express['Router']();var auth=require(_0x6eb0('0x1'));var interaction=require(_0x6eb0('0x2'));var controller=require(_0x6eb0('0x3'));router[_0x6eb0('0x4')]('/',auth[_0x6eb0('0x5')](),controller[_0x6eb0('0x6')]);router[_0x6eb0('0x4')](_0x6eb0('0x7'),auth['isAuthenticated'](),controller[_0x6eb0('0x8')]);router[_0x6eb0('0x4')](_0x6eb0('0x9'),auth[_0x6eb0('0x5')](),controller[_0x6eb0('0xa')]);router[_0x6eb0('0x4')](_0x6eb0('0xb'),auth['isAuthenticated'](),controller[_0x6eb0('0xc')]);router[_0x6eb0('0x4')](_0x6eb0('0xd'),auth[_0x6eb0('0x5')](),controller[_0x6eb0('0xe')]);router[_0x6eb0('0xf')]('/',auth['isAuthenticated'](),controller[_0x6eb0('0x10')]);router[_0x6eb0('0xf')]('/:id/messages',auth[_0x6eb0('0x5')](),controller[_0x6eb0('0x11')]);router[_0x6eb0('0xf')](_0x6eb0('0x12'),auth[_0x6eb0('0x5')](),interaction['tracked'](_0x6eb0('0x13'),_0x6eb0('0x14')),controller[_0x6eb0('0x15')]);router[_0x6eb0('0x16')](_0x6eb0('0x9'),auth[_0x6eb0('0x5')](),interaction[_0x6eb0('0x17')]('mail','mailinteraction:update'),controller['update']);router[_0x6eb0('0x18')](_0x6eb0('0x9'),auth['isAuthenticated'](),interaction['tracked'](_0x6eb0('0x13'),_0x6eb0('0x19')),controller['destroy']);router['delete']('/:id/tags',auth[_0x6eb0('0x5')](),controller['removeTags']);module[_0x6eb0('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index e54c989..e17c270 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 _0x880d=['ENUM','sequelize','DATE','STRING','TEXT','long','BOOLEAN','out'];(function(_0x16f475,_0x22b4b4){var _0x53372e=function(_0x507a7d){while(--_0x507a7d){_0x16f475['push'](_0x16f475['shift']());}};_0x53372e(++_0x22b4b4);}(_0x880d,0x111));var _0xd880=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x880d[_0x2f1762];return _0x8ab21;};'use strict';var Sequelize=require(_0xd880('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd880('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd880('0x2')]},'thirdDisposition':{'type':Sequelize[_0xd880('0x2')]},'note':{'type':Sequelize[_0xd880('0x2')]},'inReplyTo':{'type':Sequelize[_0xd880('0x2')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xd880('0x3')](_0xd880('0x4'))},'subject':{'type':Sequelize[_0xd880('0x3')]()},'attach':{'type':Sequelize[_0xd880('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xd880('0x2')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xd880('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd880('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xd880('0x7')]('in',_0xd880('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xd880('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0xb80d=['long','ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING','TEXT'];(function(_0x50db67,_0xe9a2d9){var _0x473b9a=function(_0x4c2972){while(--_0x4c2972){_0x50db67['push'](_0x50db67['shift']());}};_0x473b9a(++_0xe9a2d9);}(_0xb80d,0x1bc));var _0xdb80=function(_0x25c5a4,_0x1922b9){_0x25c5a4=_0x25c5a4-0x0;var _0x3f191b=_0xb80d[_0x25c5a4];return _0x3f191b;};'use strict';var Sequelize=require(_0xdb80('0x0'));var iconv=require('iconv');module[_0xdb80('0x1')]={'closed':{'type':Sequelize[_0xdb80('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdb80('0x3')]},'disposition':{'type':Sequelize[_0xdb80('0x4')]},'secondDisposition':{'type':Sequelize[_0xdb80('0x4')]},'thirdDisposition':{'type':Sequelize[_0xdb80('0x4')]},'note':{'type':Sequelize[_0xdb80('0x4')]},'inReplyTo':{'type':Sequelize[_0xdb80('0x4')](0x1fe)},'to':{'type':Sequelize[_0xdb80('0x4')]},'cc':{'type':Sequelize[_0xdb80('0x5')](_0xdb80('0x6'))},'subject':{'type':Sequelize[_0xdb80('0x5')]()},'attach':{'type':Sequelize[_0xdb80('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xdb80('0x3')]},'substatus':{'type':Sequelize[_0xdb80('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xdb80('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xdb80('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xdb80('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xdb80('0x7')]('in',_0xdb80('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xdb80('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index ddf45b1..b4daee8 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 _0x03a8=['split','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','ids','spread','Tag','color','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','attachments','format','push','Attachment','Attachments','Messages','from','bcc','subject','get','mkdirSync','missing.recipient@your.company.com','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','rimraf','zip-dir','util','path','juice','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','html-entities','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','update','then','destroy','end','error','name','send','index','map','MailInteraction','fieldName','type','key','getOptions','findAll','mail','query','user','show','params','model','keys','rawAttributes','fields','attributes','includeAll','include','merge','options','find','catch','create','body','describe','MailMessage','addMessage','omit','getMessages','intersection','length','hasOwnProperty','order','sort','filters','pick','where','MailInteractionId','$gte'];(function(_0x3277b7,_0x4d676d){var _0xd779dd=function(_0x345487){while(--_0x345487){_0x3277b7['push'](_0x3277b7['shift']());}};_0xd779dd(++_0x4d676d);}(_0x03a8,0x1eb));var _0x803a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03a8[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x803a('0x0'));var zipdir=require(_0x803a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x803a('0x2'));var path=require(_0x803a('0x3'));var fs=require('fs');var _=require('lodash');var juice=require(_0x803a('0x4'));var Redis=require('ioredis');var interaction=require(_0x803a('0x5'));var qs=require(_0x803a('0x6'));var logger=require(_0x803a('0x7'))(_0x803a('0x8'));var config=require(_0x803a('0x9'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x803a('0xa'));config['redis']=_[_0x803a('0xb')](config[_0x803a('0xc')],{'host':_0x803a('0xd'),'port':0x18eb});var socket=require(_0x803a('0xe'))(new Redis(config[_0x803a('0xc')]));require(_0x803a('0xf'))[_0x803a('0x10')](socket);function respondWithStatusCode(_0x52939e,_0x43ac69){_0x43ac69=_0x43ac69||0xcc;return function(_0x255d06){if(_0x255d06){return _0x52939e[_0x803a('0x11')](_0x43ac69);}return _0x52939e['status'](_0x43ac69)['end']();};}function respondWithResult(_0xf48eb2,_0x54fa82){_0x54fa82=_0x54fa82||0xc8;return function(_0x35cdac){if(_0x35cdac){return _0xf48eb2[_0x803a('0x12')](_0x54fa82)['json'](_0x35cdac);}};}function respondWithFilteredResult(_0x2c334,_0x10009f){return function(_0x35bdd7){if(_0x35bdd7){var _0x438ad4=typeof _0x10009f['offset']===_0x803a('0x13')&&typeof _0x10009f[_0x803a('0x14')]==='undefined';var _0x5af8e9=_0x35bdd7[_0x803a('0x15')];var _0x4121ea=_0x438ad4?0x0:_0x10009f[_0x803a('0x16')];var _0x59f51d=_0x438ad4?_0x35bdd7[_0x803a('0x15')]:_0x10009f[_0x803a('0x16')]+_0x10009f[_0x803a('0x14')];var _0x22985f;if(_0x59f51d>=_0x5af8e9){_0x59f51d=_0x5af8e9;_0x22985f=0xc8;}else{_0x22985f=0xce;}_0x2c334[_0x803a('0x12')](_0x22985f);return _0x2c334[_0x803a('0x17')](_0x803a('0x18'),_0x4121ea+'-'+_0x59f51d+'/'+_0x5af8e9)[_0x803a('0x19')](_0x35bdd7);}return null;};}function saveUpdates(_0xb82864){return function(_0x4fc8b0){if(_0x4fc8b0){return _0x4fc8b0[_0x803a('0x1a')](_0xb82864)[_0x803a('0x1b')](function(_0x29efec){return _0x29efec;});}return null;};}function removeEntity(_0x5be4c4){return function(_0x160a8e){if(_0x160a8e){return _0x160a8e[_0x803a('0x1c')]()['then'](function(){_0x5be4c4[_0x803a('0x12')](0xcc)[_0x803a('0x1d')]();});}};}function handleEntityNotFound(_0x579c91){return function(_0x4e6735){if(!_0x4e6735){_0x579c91['sendStatus'](0x194);}return _0x4e6735;};}function handleError(_0x57da3e,_0x104a82){_0x104a82=_0x104a82||0x1f4;return function(_0x57b67e){logger[_0x803a('0x1e')](_0x57b67e['stack']);if(_0x57b67e[_0x803a('0x1f')]){delete _0x57b67e['name'];}_0x57da3e[_0x803a('0x12')](_0x104a82)[_0x803a('0x20')](_0x57b67e);};}exports[_0x803a('0x21')]=function(_0x5a5702,_0x544dd3){var _0x164b8c={};var _0x10e461=_[_0x803a('0x22')](db[_0x803a('0x23')]['rawAttributes'],function(_0x249be9){return{'name':_0x249be9[_0x803a('0x24')],'type':_0x249be9[_0x803a('0x25')][_0x803a('0x26')]};});_0x164b8c=qs[_0x803a('0x27')](_0x10e461,_0x5a5702);return interaction[_0x803a('0x28')](_0x803a('0x29'),_0x5a5702[_0x803a('0x2a')],_0x5a5702[_0x803a('0x2b')],_0x164b8c,_0x10e461)['then'](respondWithFilteredResult(_0x544dd3,_0x164b8c))['catch'](handleError(_0x544dd3,null));};exports[_0x803a('0x2c')]=function(_0x33083e,_0x21920b){var _0x591992={'raw':![],'where':{'id':_0x33083e[_0x803a('0x2d')]['id']}},_0x32424d={};_0x32424d[_0x803a('0x2e')]=_[_0x803a('0x2f')](db[_0x803a('0x23')][_0x803a('0x30')]);_0x32424d[_0x803a('0x2a')]=_[_0x803a('0x2f')](_0x33083e['query']);_0x32424d['filters']=_['intersection'](_0x32424d[_0x803a('0x2e')],_0x32424d[_0x803a('0x2a')]);_0x591992['attributes']=_['intersection'](_0x32424d[_0x803a('0x2e')],qs[_0x803a('0x31')](_0x33083e['query']['fields']));_0x591992[_0x803a('0x32')]=_0x591992[_0x803a('0x32')]['length']?_0x591992[_0x803a('0x32')]:_0x32424d[_0x803a('0x2e')];if(_0x33083e[_0x803a('0x2a')][_0x803a('0x33')]){_0x591992[_0x803a('0x34')]=[{'all':!![]}];}_0x591992=_[_0x803a('0x35')]({},_0x591992,_0x33083e[_0x803a('0x36')]);return db[_0x803a('0x23')][_0x803a('0x37')](_0x591992)['then'](handleEntityNotFound(_0x21920b,null))[_0x803a('0x1b')](respondWithResult(_0x21920b,null))[_0x803a('0x38')](handleError(_0x21920b,null));};exports[_0x803a('0x39')]=function(_0x3b9d37,_0x78f122){return db[_0x803a('0x23')]['create'](_0x3b9d37[_0x803a('0x3a')],{})[_0x803a('0x1b')](respondWithResult(_0x78f122,0xc9))[_0x803a('0x38')](handleError(_0x78f122,null));};exports[_0x803a('0x1a')]=function(_0xc8b901,_0x2e113b){if(_0xc8b901[_0x803a('0x3a')]['id']){delete _0xc8b901[_0x803a('0x3a')]['id'];}return db[_0x803a('0x23')][_0x803a('0x37')]({'where':{'id':_0xc8b901[_0x803a('0x2d')]['id']}})[_0x803a('0x1b')](handleEntityNotFound(_0x2e113b,null))[_0x803a('0x1b')](saveUpdates(_0xc8b901['body'],null))[_0x803a('0x1b')](respondWithResult(_0x2e113b,null))[_0x803a('0x38')](handleError(_0x2e113b,null));};exports[_0x803a('0x1c')]=function(_0x4a8972,_0x746f86){return db[_0x803a('0x23')]['find']({'where':{'id':_0x4a8972[_0x803a('0x2d')]['id']}})['then'](handleEntityNotFound(_0x746f86,null))['then'](removeEntity(_0x746f86,null))[_0x803a('0x38')](handleError(_0x746f86,null));};exports[_0x803a('0x3b')]=function(_0x52280c,_0x15a2ed){return db[_0x803a('0x23')]['describe']()[_0x803a('0x1b')](respondWithResult(_0x15a2ed,null))[_0x803a('0x38')](handleError(_0x15a2ed,null));};exports['addMessage']=function(_0x1cd572,_0x115308){return db[_0x803a('0x3c')][_0x803a('0x37')]({'where':{'id':_0x1cd572[_0x803a('0x2d')]['id']}})[_0x803a('0x1b')](handleEntityNotFound(_0x115308,null))[_0x803a('0x1b')](function(_0x400a88){if(_0x400a88){return _0x400a88[_0x803a('0x3d')](_0x1cd572[_0x803a('0x3a')]['ids'],_[_0x803a('0x3e')](_0x1cd572['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x115308,null))[_0x803a('0x38')](handleError(_0x115308,null));};exports[_0x803a('0x3f')]=function(_0x5c306b,_0x4cded0){var _0x511a58={'raw':![],'where':{}};var _0x3c19ad={};var _0x3fc2ac={'count':0x0,'rows':[]};return db[_0x803a('0x23')]['findOne']({'where':{'id':_0x5c306b['params']['id']}})[_0x803a('0x1b')](handleEntityNotFound(_0x4cded0,null))[_0x803a('0x1b')](function(_0x7b6aaf){if(_0x7b6aaf){_0x3c19ad[_0x803a('0x2e')]=_[_0x803a('0x2f')](db['MailMessage']['rawAttributes']);_0x3c19ad['query']=_[_0x803a('0x2f')](_0x5c306b[_0x803a('0x2a')]);_0x3c19ad['filters']=_[_0x803a('0x40')](_0x3c19ad[_0x803a('0x2e')],_0x3c19ad[_0x803a('0x2a')]);_0x511a58[_0x803a('0x32')]=_[_0x803a('0x40')](_0x3c19ad[_0x803a('0x2e')],qs['fields'](_0x5c306b[_0x803a('0x2a')][_0x803a('0x31')]));_0x511a58[_0x803a('0x32')]=_0x511a58[_0x803a('0x32')][_0x803a('0x41')]?_0x511a58[_0x803a('0x32')]:_0x3c19ad[_0x803a('0x2e')];if(!_0x5c306b[_0x803a('0x2a')][_0x803a('0x42')]('nolimit')){_0x511a58[_0x803a('0x14')]=qs[_0x803a('0x14')](_0x5c306b['query'][_0x803a('0x14')]);_0x511a58[_0x803a('0x16')]=qs['offset'](_0x5c306b['query'][_0x803a('0x16')]);}_0x511a58[_0x803a('0x43')]=qs[_0x803a('0x44')](_0x5c306b[_0x803a('0x2a')]['sort']);_0x511a58['where']=qs[_0x803a('0x45')](_[_0x803a('0x46')](_0x5c306b[_0x803a('0x2a')],_0x3c19ad[_0x803a('0x45')]));_0x511a58[_0x803a('0x47')][_0x803a('0x48')]=_0x7b6aaf['id'];if(_0x5c306b[_0x803a('0x2a')]['filter']){_0x511a58[_0x803a('0x47')]=_[_0x803a('0x35')](_0x511a58['where'],{'$or':_[_0x803a('0x22')](_0x511a58[_0x803a('0x32')],function(_0x2f2424){var _0x189f07={};_0x189f07[_0x2f2424]={'$like':'%'+_0x5c306b[_0x803a('0x2a')]['filter']+'%'};return _0x189f07;})});}if(_0x5c306b[_0x803a('0x2a')][_0x803a('0x49')]){var _0x20663a=_0x5c306b[_0x803a('0x2a')][_0x803a('0x49')][_0x803a('0x4a')](',');var _0x257384={};_0x257384[_0x20663a[0x0]]={'$gte':moment(_0x20663a[0x1])['format'](_0x803a('0x4b'))};_0x511a58[_0x803a('0x47')]=_['merge'](_0x511a58['where'],_0x257384);}_0x511a58=_[_0x803a('0x35')]({},_0x511a58,_0x5c306b[_0x803a('0x36')]);return db[_0x803a('0x3c')]['count']({'where':_0x511a58[_0x803a('0x47')]})['then'](function(_0x4526f4){_0x3fc2ac['count']=_0x4526f4;if(_0x5c306b[_0x803a('0x2a')][_0x803a('0x33')]){_0x511a58['include']=[{'all':!![]}];}return db[_0x803a('0x3c')][_0x803a('0x28')](_0x511a58);})['then'](function(_0x15e78c){if(_0x5c306b['query']['inlineCss']==='true'){for(var _0x6e3ef7=0x0;_0x6e3ef7<_0x15e78c[_0x803a('0x41')];_0x6e3ef7++){_0x15e78c[_0x6e3ef7][_0x803a('0x3a')]=juice(_0x15e78c[_0x6e3ef7][_0x803a('0x3a')]);}}_0x3fc2ac[_0x803a('0x4c')]=_0x15e78c;return _0x3fc2ac;});}})['then'](respondWithFilteredResult(_0x4cded0,_0x511a58))[_0x803a('0x38')](handleError(_0x4cded0,null));};exports['addTags']=function(_0x3f27fd,_0x4a278a){return db[_0x803a('0x23')]['find']({'where':{'id':_0x3f27fd[_0x803a('0x2d')]['id']}})['then'](handleEntityNotFound(_0x4a278a,null))[_0x803a('0x1b')](function(_0x2586df){if(_0x2586df){return _0x2586df[_0x803a('0x4d')](_0x3f27fd[_0x803a('0x3a')]['ids'],_[_0x803a('0x3e')](_0x3f27fd[_0x803a('0x3a')],[_0x803a('0x4e'),'id'])||{})[_0x803a('0x4f')](function(){return db[_0x803a('0x50')]['findAll']({'attributes':['id',_0x803a('0x1f'),_0x803a('0x51')],'where':{'id':_0x3f27fd[_0x803a('0x3a')][_0x803a('0x4e')]}});})[_0x803a('0x1b')](function(_0x13a95d){socket['emit'](_0x803a('0x52'),{'id':Number(_0x3f27fd[_0x803a('0x2d')]['id']),'tags':_0x13a95d||[]});return{'id':Number(_0x3f27fd[_0x803a('0x2d')]['id']),'tags':_0x13a95d||[]};});}})['then'](respondWithResult(_0x4a278a,null))[_0x803a('0x38')](handleError(_0x4a278a,null));};exports[_0x803a('0x53')]=function(_0x52b4ec,_0x2c93ca){return db[_0x803a('0x23')][_0x803a('0x37')]({'where':{'id':_0x52b4ec[_0x803a('0x2d')]['id']}})[_0x803a('0x1b')](handleEntityNotFound(_0x2c93ca,null))['then'](function(_0x2bae50){if(_0x2bae50){return _0x2bae50['removeTags'](_0x52b4ec[_0x803a('0x2a')]['ids']);}})[_0x803a('0x1b')](respondWithStatusCode(_0x2c93ca,null))[_0x803a('0x38')](handleError(_0x2c93ca,null));};exports[_0x803a('0x54')]=function(_0x2fd825,_0x30bf78){var _0x12721d=moment()[_0x803a('0x55')]()[_0x803a('0x56')]();var _0x822c2f=path[_0x803a('0x57')](config[_0x803a('0x58')],_0x803a('0x59'),_0x803a('0x5a'),'tmp');var _0x59c131=path[_0x803a('0x57')](config[_0x803a('0x58')],'server','files',_0x803a('0x5b'));var _0x38dd4d=path['join'](_0x822c2f,_0x12721d);var _0x480dd6=util[_0x803a('0x5c')]('transcript-%d-%s.zip',_0x2fd825[_0x803a('0x2d')]['id'],_0x12721d);var _0x3b3ca5=path[_0x803a('0x57')](_0x822c2f,_0x480dd6);var _0x4d172c=[];if(_0x2fd825[_0x803a('0x2a')][_0x803a('0x5b')]){_0x4d172c[_0x803a('0x5d')]({'model':db[_0x803a('0x5e')],'as':_0x803a('0x5f'),'raw':!![]});}var _0x371a41=[{'model':db[_0x803a('0x3c')],'as':_0x803a('0x60'),'attributes':['id',_0x803a('0x3a'),_0x803a('0x61'),'to','cc',_0x803a('0x62'),_0x803a('0x63'),'createdAt'],'where':{'secret':![]},'order':qs[_0x803a('0x44')]('id'),'include':_0x4d172c}];return db['MailInteraction'][_0x803a('0x37')]({'where':{'id':_0x2fd825[_0x803a('0x2d')]['id']},'include':_0x371a41})[_0x803a('0x1b')](handleEntityNotFound(_0x30bf78,null))[_0x803a('0x1b')](function(_0x18cd65){if(_0x18cd65&&_0x18cd65[_0x803a('0x60')]){var _0x9fcf22=_0x18cd65[_0x803a('0x64')]({'plain':!![]});fs[_0x803a('0x65')](_0x38dd4d);return BPromise['each'](_0x9fcf22[_0x803a('0x60')],function(_0x34b606,_0xe75779){var _0x467d27={'from':_0x34b606[_0x803a('0x61')],'to':_0x34b606['to']||_0x803a('0x66'),'subject':_0x34b606[_0x803a('0x63')],'html':htmlEntities[_0x803a('0x67')](_0x34b606[_0x803a('0x3a')]),'headers':{'Date':moment(_0x34b606[_0x803a('0x68')])[_0x803a('0x5c')](_0x803a('0x69'))},'attachments':[]};if(_0x34b606['cc']){_0x467d27[_0x803a('0x6a')]['Cc']=_0x34b606['cc'];}if(_0x34b606[_0x803a('0x62')]){_0x467d27[_0x803a('0x6a')][_0x803a('0x6b')]=_0x34b606[_0x803a('0x62')];}return new BPromise(function(_0x2e1442,_0x2fe5c9){if(_0x34b606[_0x803a('0x5f')]){for(var _0x13e892=0x0;_0x13e892<_0x34b606[_0x803a('0x5f')][_0x803a('0x41')];_0x13e892++){var _0x5a6a9e=_0x34b606[_0x803a('0x5f')][_0x13e892];var _0x29c076=path[_0x803a('0x57')](_0x59c131,_0x5a6a9e[_0x803a('0x6c')]);if(fs[_0x803a('0x6d')](_0x29c076)){_0x467d27['attachments'][_0x803a('0x5d')]({'name':_0x5a6a9e[_0x803a('0x1f')],'contentType':_0x5a6a9e[_0x803a('0x25')],'data':fs[_0x803a('0x6e')](_0x29c076)});}}}emlformat['build'](_0x467d27,function(_0x15f470,_0x3d696f){if(_0x15f470)return _0x2fe5c9(_0x15f470);fs[_0x803a('0x6f')](path['join'](_0x38dd4d,util['format'](_0x803a('0x70'),_0xe75779)),_0x3d696f);return _0x2e1442(_0x3d696f);});});})['then'](function(){return new BPromise(function(_0x44fe6d,_0x11ffb3){zipdir(_0x38dd4d,{'saveTo':_0x3b3ca5},function(_0x306660,_0x59c17b){if(_0x306660)return _0x11ffb3(_0x306660);return _0x44fe6d(_0x59c17b);});})[_0x803a('0x1b')](function(){return new BPromise(function(_0x549182,_0x4b2c1b){rimraf(_0x38dd4d,function(_0x2df277){if(_0x2df277)_0x4b2c1b(_0x2df277);return _0x549182();});});})[_0x803a('0x1b')](function(){return _0x30bf78['download'](_0x3b3ca5,_0x480dd6,function(_0x3845e7){if(!_0x3845e7)fs['unlinkSync'](_0x3b3ca5);});});});}else{return _0x30bf78[_0x803a('0x11')](0xc8);}})[_0x803a('0x38')](handleError(_0x30bf78,null));}; \ No newline at end of file +var _0x6e2e=['pick','MailInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','inlineCss','rows','addTags','omit','spread','color','emit','mailInteractionTags:save','removeTags','join','root','server','tmp','files','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','from','bcc','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','push','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','util','path','lodash','juice','ioredis','../../components/interaction/service','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','status','end','offset','undefined','count','Content-Range','json','update','sendStatus','name','send','index','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','query','then','show','params','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','body','destroy','describe','addMessage','MailMessage','ids','getMessages','model','hasOwnProperty','nolimit','limit','sort','where'];(function(_0x56898b,_0x489040){var _0xffe6ec=function(_0x2054d7){while(--_0x2054d7){_0x56898b['push'](_0x56898b['shift']());}};_0xffe6ec(++_0x489040);}(_0x6e2e,0x1f2));var _0xe6e2=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x6e2e[_0x12d033];return _0x3b4e80;};'use strict';var emlformat=require(_0xe6e2('0x0'));var rimraf=require(_0xe6e2('0x1'));var zipdir=require(_0xe6e2('0x2'));var moment=require(_0xe6e2('0x3'));var BPromise=require('bluebird');var util=require(_0xe6e2('0x4'));var path=require(_0xe6e2('0x5'));var fs=require('fs');var _=require(_0xe6e2('0x6'));var juice=require(_0xe6e2('0x7'));var Redis=require(_0xe6e2('0x8'));var interaction=require(_0xe6e2('0x9'));var qs=require('../../components/parsers/qs');var logger=require(_0xe6e2('0xa'))(_0xe6e2('0xb'));var config=require('../../config/environment');var db=require(_0xe6e2('0xc'))['db'];var htmlEntities=require('html-entities');config[_0xe6e2('0xd')]=_[_0xe6e2('0xe')](config[_0xe6e2('0xd')],{'host':_0xe6e2('0xf'),'port':0x18eb});var socket=require(_0xe6e2('0x10'))(new Redis(config['redis']));require(_0xe6e2('0x11'))[_0xe6e2('0x12')](socket);function respondWithStatusCode(_0x4f4f34,_0x1bb6b8){_0x1bb6b8=_0x1bb6b8||0xcc;return function(_0x4a9fd8){if(_0x4a9fd8){return _0x4f4f34['sendStatus'](_0x1bb6b8);}return _0x4f4f34[_0xe6e2('0x13')](_0x1bb6b8)[_0xe6e2('0x14')]();};}function respondWithResult(_0x1fd67a,_0x160d69){_0x160d69=_0x160d69||0xc8;return function(_0x3f2842){if(_0x3f2842){return _0x1fd67a[_0xe6e2('0x13')](_0x160d69)['json'](_0x3f2842);}};}function respondWithFilteredResult(_0x2f3d15,_0x30c12e){return function(_0x43771d){if(_0x43771d){var _0xcaaca=typeof _0x30c12e[_0xe6e2('0x15')]==='undefined'&&typeof _0x30c12e['limit']===_0xe6e2('0x16');var _0xcfff7e=_0x43771d[_0xe6e2('0x17')];var _0x5c5fdf=_0xcaaca?0x0:_0x30c12e[_0xe6e2('0x15')];var _0x3c2bcc=_0xcaaca?_0x43771d[_0xe6e2('0x17')]:_0x30c12e['offset']+_0x30c12e['limit'];var _0x12dfc2;if(_0x3c2bcc>=_0xcfff7e){_0x3c2bcc=_0xcfff7e;_0x12dfc2=0xc8;}else{_0x12dfc2=0xce;}_0x2f3d15[_0xe6e2('0x13')](_0x12dfc2);return _0x2f3d15['set'](_0xe6e2('0x18'),_0x5c5fdf+'-'+_0x3c2bcc+'/'+_0xcfff7e)[_0xe6e2('0x19')](_0x43771d);}return null;};}function saveUpdates(_0x4b2adc){return function(_0x5bb485){if(_0x5bb485){return _0x5bb485[_0xe6e2('0x1a')](_0x4b2adc)['then'](function(_0x4c64b9){return _0x4c64b9;});}return null;};}function removeEntity(_0x1f17a4){return function(_0x39db4e){if(_0x39db4e){return _0x39db4e['destroy']()['then'](function(){_0x1f17a4['status'](0xcc)[_0xe6e2('0x14')]();});}};}function handleEntityNotFound(_0x295b1f){return function(_0x25f480){if(!_0x25f480){_0x295b1f[_0xe6e2('0x1b')](0x194);}return _0x25f480;};}function handleError(_0x5b929f,_0x8c8b77){_0x8c8b77=_0x8c8b77||0x1f4;return function(_0x2c8cbf){logger['error'](_0x2c8cbf['stack']);if(_0x2c8cbf[_0xe6e2('0x1c')]){delete _0x2c8cbf[_0xe6e2('0x1c')];}_0x5b929f[_0xe6e2('0x13')](_0x8c8b77)[_0xe6e2('0x1d')](_0x2c8cbf);};}exports[_0xe6e2('0x1e')]=function(_0x5cbfb4,_0x338301){var _0x46dd7c={};var _0x4d50f0=_['map'](db[_0xe6e2('0x1f')][_0xe6e2('0x20')],function(_0x26b694){return{'name':_0x26b694[_0xe6e2('0x21')],'type':_0x26b694[_0xe6e2('0x22')][_0xe6e2('0x23')]};});_0x46dd7c=qs[_0xe6e2('0x24')](_0x4d50f0,_0x5cbfb4);return interaction[_0xe6e2('0x25')](_0xe6e2('0x26'),_0x5cbfb4[_0xe6e2('0x27')],_0x5cbfb4['user'],_0x46dd7c,_0x4d50f0)[_0xe6e2('0x28')](respondWithFilteredResult(_0x338301,_0x46dd7c))['catch'](handleError(_0x338301,null));};exports[_0xe6e2('0x29')]=function(_0x12a1db,_0x3e74e0){var _0x31ebe6={'raw':![],'where':{'id':_0x12a1db[_0xe6e2('0x2a')]['id']}},_0x52e4c8={};_0x52e4c8['model']=_['keys'](db[_0xe6e2('0x1f')][_0xe6e2('0x20')]);_0x52e4c8['query']=_[_0xe6e2('0x2b')](_0x12a1db[_0xe6e2('0x27')]);_0x52e4c8[_0xe6e2('0x2c')]=_[_0xe6e2('0x2d')](_0x52e4c8['model'],_0x52e4c8['query']);_0x31ebe6[_0xe6e2('0x2e')]=_['intersection'](_0x52e4c8['model'],qs[_0xe6e2('0x2f')](_0x12a1db[_0xe6e2('0x27')][_0xe6e2('0x2f')]));_0x31ebe6[_0xe6e2('0x2e')]=_0x31ebe6[_0xe6e2('0x2e')][_0xe6e2('0x30')]?_0x31ebe6[_0xe6e2('0x2e')]:_0x52e4c8['model'];if(_0x12a1db['query'][_0xe6e2('0x31')]){_0x31ebe6['include']=[{'all':!![]}];}_0x31ebe6=_[_0xe6e2('0x32')]({},_0x31ebe6,_0x12a1db[_0xe6e2('0x33')]);return db[_0xe6e2('0x1f')][_0xe6e2('0x34')](_0x31ebe6)[_0xe6e2('0x28')](handleEntityNotFound(_0x3e74e0,null))[_0xe6e2('0x28')](respondWithResult(_0x3e74e0,null))[_0xe6e2('0x35')](handleError(_0x3e74e0,null));};exports['create']=function(_0x127724,_0x46aa20){return db['MailInteraction']['create'](_0x127724[_0xe6e2('0x36')],{})['then'](respondWithResult(_0x46aa20,0xc9))[_0xe6e2('0x35')](handleError(_0x46aa20,null));};exports[_0xe6e2('0x1a')]=function(_0x12527f,_0x21aedb){if(_0x12527f[_0xe6e2('0x36')]['id']){delete _0x12527f[_0xe6e2('0x36')]['id'];}return db[_0xe6e2('0x1f')][_0xe6e2('0x34')]({'where':{'id':_0x12527f[_0xe6e2('0x2a')]['id']}})[_0xe6e2('0x28')](handleEntityNotFound(_0x21aedb,null))['then'](saveUpdates(_0x12527f['body'],null))['then'](respondWithResult(_0x21aedb,null))[_0xe6e2('0x35')](handleError(_0x21aedb,null));};exports[_0xe6e2('0x37')]=function(_0x4533df,_0x57044c){return db['MailInteraction'][_0xe6e2('0x34')]({'where':{'id':_0x4533df[_0xe6e2('0x2a')]['id']}})[_0xe6e2('0x28')](handleEntityNotFound(_0x57044c,null))[_0xe6e2('0x28')](removeEntity(_0x57044c,null))[_0xe6e2('0x35')](handleError(_0x57044c,null));};exports['describe']=function(_0x1dc002,_0x31216c){return db[_0xe6e2('0x1f')][_0xe6e2('0x38')]()[_0xe6e2('0x28')](respondWithResult(_0x31216c,null))[_0xe6e2('0x35')](handleError(_0x31216c,null));};exports[_0xe6e2('0x39')]=function(_0x38fe0f,_0x2314d3){return db[_0xe6e2('0x3a')][_0xe6e2('0x34')]({'where':{'id':_0x38fe0f[_0xe6e2('0x2a')]['id']}})[_0xe6e2('0x28')](handleEntityNotFound(_0x2314d3,null))[_0xe6e2('0x28')](function(_0x2031a1){if(_0x2031a1){return _0x2031a1['addMessage'](_0x38fe0f['body'][_0xe6e2('0x3b')],_['omit'](_0x38fe0f['body'],[_0xe6e2('0x3b'),'id'])||{});}})[_0xe6e2('0x28')](respondWithResult(_0x2314d3,null))[_0xe6e2('0x35')](handleError(_0x2314d3,null));};exports[_0xe6e2('0x3c')]=function(_0xe8f09c,_0xfc58c7){var _0x99927b={'raw':![],'where':{}};var _0x5c0305={};var _0x1744e7={'count':0x0,'rows':[]};return db[_0xe6e2('0x1f')]['findOne']({'where':{'id':_0xe8f09c['params']['id']}})[_0xe6e2('0x28')](handleEntityNotFound(_0xfc58c7,null))['then'](function(_0x6b94b8){if(_0x6b94b8){_0x5c0305['model']=_[_0xe6e2('0x2b')](db[_0xe6e2('0x3a')][_0xe6e2('0x20')]);_0x5c0305[_0xe6e2('0x27')]=_[_0xe6e2('0x2b')](_0xe8f09c[_0xe6e2('0x27')]);_0x5c0305[_0xe6e2('0x2c')]=_['intersection'](_0x5c0305[_0xe6e2('0x3d')],_0x5c0305[_0xe6e2('0x27')]);_0x99927b[_0xe6e2('0x2e')]=_[_0xe6e2('0x2d')](_0x5c0305['model'],qs[_0xe6e2('0x2f')](_0xe8f09c[_0xe6e2('0x27')][_0xe6e2('0x2f')]));_0x99927b['attributes']=_0x99927b['attributes']['length']?_0x99927b['attributes']:_0x5c0305['model'];if(!_0xe8f09c[_0xe6e2('0x27')][_0xe6e2('0x3e')](_0xe6e2('0x3f'))){_0x99927b[_0xe6e2('0x40')]=qs[_0xe6e2('0x40')](_0xe8f09c['query'][_0xe6e2('0x40')]);_0x99927b[_0xe6e2('0x15')]=qs[_0xe6e2('0x15')](_0xe8f09c[_0xe6e2('0x27')][_0xe6e2('0x15')]);}_0x99927b['order']=qs[_0xe6e2('0x41')](_0xe8f09c[_0xe6e2('0x27')][_0xe6e2('0x41')]);_0x99927b[_0xe6e2('0x42')]=qs[_0xe6e2('0x2c')](_[_0xe6e2('0x43')](_0xe8f09c[_0xe6e2('0x27')],_0x5c0305['filters']));_0x99927b[_0xe6e2('0x42')][_0xe6e2('0x44')]=_0x6b94b8['id'];if(_0xe8f09c[_0xe6e2('0x27')][_0xe6e2('0x45')]){_0x99927b[_0xe6e2('0x42')]=_['merge'](_0x99927b[_0xe6e2('0x42')],{'$or':_[_0xe6e2('0x46')](_0x99927b['attributes'],function(_0x2be4ab){var _0x2cc21a={};_0x2cc21a[_0x2be4ab]={'$like':'%'+_0xe8f09c['query']['filter']+'%'};return _0x2cc21a;})});}if(_0xe8f09c[_0xe6e2('0x27')][_0xe6e2('0x47')]){var _0xb714b9=_0xe8f09c[_0xe6e2('0x27')][_0xe6e2('0x47')][_0xe6e2('0x48')](',');var _0x333f69={};_0x333f69[_0xb714b9[0x0]]={'$gte':moment(_0xb714b9[0x1])[_0xe6e2('0x49')](_0xe6e2('0x4a'))};_0x99927b[_0xe6e2('0x42')]=_[_0xe6e2('0x32')](_0x99927b[_0xe6e2('0x42')],_0x333f69);}_0x99927b=_[_0xe6e2('0x32')]({},_0x99927b,_0xe8f09c['options']);return db[_0xe6e2('0x3a')][_0xe6e2('0x17')]({'where':_0x99927b[_0xe6e2('0x42')]})['then'](function(_0x49299d){_0x1744e7['count']=_0x49299d;if(_0xe8f09c['query'][_0xe6e2('0x31')]){_0x99927b[_0xe6e2('0x4b')]=[{'all':!![]}];}return db[_0xe6e2('0x3a')][_0xe6e2('0x25')](_0x99927b);})[_0xe6e2('0x28')](function(_0x572aa8){if(_0xe8f09c[_0xe6e2('0x27')][_0xe6e2('0x4c')]==='true'){for(var _0x343418=0x0;_0x343418<_0x572aa8['length'];_0x343418++){_0x572aa8[_0x343418][_0xe6e2('0x36')]=juice(_0x572aa8[_0x343418]['body']);}}_0x1744e7[_0xe6e2('0x4d')]=_0x572aa8;return _0x1744e7;});}})[_0xe6e2('0x28')](respondWithFilteredResult(_0xfc58c7,_0x99927b))['catch'](handleError(_0xfc58c7,null));};exports[_0xe6e2('0x4e')]=function(_0x6c357,_0x119a71){return db[_0xe6e2('0x1f')][_0xe6e2('0x34')]({'where':{'id':_0x6c357[_0xe6e2('0x2a')]['id']}})['then'](handleEntityNotFound(_0x119a71,null))[_0xe6e2('0x28')](function(_0x2775d6){if(_0x2775d6){return _0x2775d6['setTags'](_0x6c357[_0xe6e2('0x36')]['ids'],_[_0xe6e2('0x4f')](_0x6c357[_0xe6e2('0x36')],[_0xe6e2('0x3b'),'id'])||{})[_0xe6e2('0x50')](function(){return db['Tag'][_0xe6e2('0x25')]({'attributes':['id',_0xe6e2('0x1c'),_0xe6e2('0x51')],'where':{'id':_0x6c357['body'][_0xe6e2('0x3b')]}});})[_0xe6e2('0x28')](function(_0x50dbae){socket[_0xe6e2('0x52')](_0xe6e2('0x53'),{'id':Number(_0x6c357[_0xe6e2('0x2a')]['id']),'tags':_0x50dbae||[]});return{'id':Number(_0x6c357[_0xe6e2('0x2a')]['id']),'tags':_0x50dbae||[]};});}})[_0xe6e2('0x28')](respondWithResult(_0x119a71,null))[_0xe6e2('0x35')](handleError(_0x119a71,null));};exports[_0xe6e2('0x54')]=function(_0x217c9e,_0x36c2e3){return db['MailInteraction'][_0xe6e2('0x34')]({'where':{'id':_0x217c9e[_0xe6e2('0x2a')]['id']}})[_0xe6e2('0x28')](handleEntityNotFound(_0x36c2e3,null))[_0xe6e2('0x28')](function(_0x2ff40a){if(_0x2ff40a){return _0x2ff40a['removeTags'](_0x217c9e['query'][_0xe6e2('0x3b')]);}})[_0xe6e2('0x28')](respondWithStatusCode(_0x36c2e3,null))[_0xe6e2('0x35')](handleError(_0x36c2e3,null));};exports['download']=function(_0x35564b,_0x37f703){var _0xf76557=moment()['unix']()['toString']();var _0x48403f=path[_0xe6e2('0x55')](config[_0xe6e2('0x56')],_0xe6e2('0x57'),'files',_0xe6e2('0x58'));var _0x2af73e=path[_0xe6e2('0x55')](config['root'],_0xe6e2('0x57'),_0xe6e2('0x59'),'attachments');var _0x5cac45=path[_0xe6e2('0x55')](_0x48403f,_0xf76557);var _0xb619c9=util['format'](_0xe6e2('0x5a'),_0x35564b['params']['id'],_0xf76557);var _0x56ce7e=path[_0xe6e2('0x55')](_0x48403f,_0xb619c9);var _0x1d7959=[];if(_0x35564b[_0xe6e2('0x27')][_0xe6e2('0x5b')]){_0x1d7959['push']({'model':db[_0xe6e2('0x5c')],'as':_0xe6e2('0x5d'),'raw':!![]});}var _0x28cb81=[{'model':db[_0xe6e2('0x3a')],'as':_0xe6e2('0x5e'),'attributes':['id',_0xe6e2('0x36'),_0xe6e2('0x5f'),'to','cc',_0xe6e2('0x60'),_0xe6e2('0x61'),_0xe6e2('0x62')],'where':{'secret':![]},'order':qs[_0xe6e2('0x41')]('id'),'include':_0x1d7959}];return db['MailInteraction']['find']({'where':{'id':_0x35564b[_0xe6e2('0x2a')]['id']},'include':_0x28cb81})['then'](handleEntityNotFound(_0x37f703,null))[_0xe6e2('0x28')](function(_0x348004){if(_0x348004&&_0x348004['Messages']){var _0x1763d2=_0x348004[_0xe6e2('0x63')]({'plain':!![]});fs[_0xe6e2('0x64')](_0x5cac45);return BPromise[_0xe6e2('0x65')](_0x1763d2[_0xe6e2('0x5e')],function(_0x42cd09,_0x33b814){var _0x485718={'from':_0x42cd09[_0xe6e2('0x5f')],'to':_0x42cd09['to']||_0xe6e2('0x66'),'subject':_0x42cd09['subject'],'html':htmlEntities[_0xe6e2('0x67')](_0x42cd09[_0xe6e2('0x36')]),'headers':{'Date':moment(_0x42cd09[_0xe6e2('0x62')])['format'](_0xe6e2('0x68'))},'attachments':[]};if(_0x42cd09['cc']){_0x485718[_0xe6e2('0x69')]['Cc']=_0x42cd09['cc'];}if(_0x42cd09['bcc']){_0x485718[_0xe6e2('0x69')][_0xe6e2('0x6a')]=_0x42cd09[_0xe6e2('0x60')];}return new BPromise(function(_0x201e2c,_0x42c18c){if(_0x42cd09[_0xe6e2('0x5d')]){for(var _0x1418ab=0x0;_0x1418ab<_0x42cd09[_0xe6e2('0x5d')][_0xe6e2('0x30')];_0x1418ab++){var _0x18cece=_0x42cd09['Attachments'][_0x1418ab];var _0x5cf90c=path['join'](_0x2af73e,_0x18cece[_0xe6e2('0x6b')]);if(fs['existsSync'](_0x5cf90c)){_0x485718[_0xe6e2('0x5b')][_0xe6e2('0x6c')]({'name':_0x18cece[_0xe6e2('0x1c')],'contentType':_0x18cece[_0xe6e2('0x22')],'data':fs[_0xe6e2('0x6d')](_0x5cf90c)});}}}emlformat['build'](_0x485718,function(_0x39b9ed,_0x321afc){if(_0x39b9ed)return _0x42c18c(_0x39b9ed);fs[_0xe6e2('0x6e')](path[_0xe6e2('0x55')](_0x5cac45,util['format'](_0xe6e2('0x6f'),_0x33b814)),_0x321afc);return _0x201e2c(_0x321afc);});});})[_0xe6e2('0x28')](function(){return new BPromise(function(_0x48b64,_0x448e04){zipdir(_0x5cac45,{'saveTo':_0x56ce7e},function(_0x3f39aa,_0x723b32){if(_0x3f39aa)return _0x448e04(_0x3f39aa);return _0x48b64(_0x723b32);});})['then'](function(){return new BPromise(function(_0x667e8f,_0x49489b){rimraf(_0x5cac45,function(_0x5420a1){if(_0x5420a1)_0x49489b(_0x5420a1);return _0x667e8f();});});})['then'](function(){return _0x37f703['download'](_0x56ce7e,_0xb619c9,function(_0xe57ab7){if(!_0xe57ab7)fs[_0xe6e2('0x70')](_0x56ce7e);});});});}else{return _0x37f703['sendStatus'](0xc8);}})['catch'](handleError(_0x37f703,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 4319130..b39a9da 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 _0x106f=['update','remove','getUsers','then','Users','findAll','setDataValue','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x258fa4,_0x5751da){var _0x1320a2=function(_0x8fd41f){while(--_0x8fd41f){_0x258fa4['push'](_0x258fa4['shift']());}};_0x1320a2(++_0x5751da);}(_0x106f,0x15c));var _0xf106=function(_0x212da0,_0x462a57){_0x212da0=_0x212da0-0x0;var _0x353cd8=_0x106f[_0x212da0];return _0x353cd8;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xf106('0x0'))['db']['MailInteraction'];var MailMessage=require(_0xf106('0x0'))['db'][_0xf106('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xf106('0x2')](0x0);var events={'afterCreate':_0xf106('0x3'),'afterUpdate':_0xf106('0x4'),'afterDestroy':_0xf106('0x5')};function emitEvent(_0xfe86ce){return function(_0x41aee9,_0x2a654f,_0x25d1c6){_0x41aee9[_0xf106('0x6')]({'attributes':['id'],'raw':!![]})[_0xf106('0x7')](function(_0x4da9ea){_0x41aee9['setDataValue'](_0xf106('0x8'),_0x4da9ea['map'](function(_0x49ed6f){return{'id':_0x49ed6f['id']};}));return MailMessage[_0xf106('0x9')]({'where':{'MailInteractionId':_0x41aee9['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf106('0x7')](function(_0x1a57be){_0x41aee9[_0xf106('0xa')]('unreadMessages',_0x1a57be['length']);MailInteractionEvents[_0xf106('0xb')](_0xfe86ce+':'+_0x41aee9['id'],_0x41aee9);MailInteractionEvents[_0xf106('0xb')](_0xfe86ce,_0x41aee9);_0x25d1c6(null);})[_0xf106('0xc')](_0x25d1c6(null));};}for(var e in events){if(events[_0xf106('0xd')](e)){var event=events[e];MailInteraction[_0xf106('0xe')](e,emitEvent(event));}}module[_0xf106('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0xf37d=['catch','hook','exports','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','unreadMessages','emit'];(function(_0x319b23,_0x2bc213){var _0x3542a6=function(_0x1c6c51){while(--_0x1c6c51){_0x319b23['push'](_0x319b23['shift']());}};_0x3542a6(++_0x2bc213);}(_0xf37d,0x14d));var _0xdf37=function(_0x301c34,_0x15701e){_0x301c34=_0x301c34-0x0;var _0x1a8c5a=_0xf37d[_0x301c34];return _0x1a8c5a;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xdf37('0x0'))['db']['MailInteraction'];var MailMessage=require(_0xdf37('0x0'))['db'][_0xdf37('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xdf37('0x2')](0x0);var events={'afterCreate':_0xdf37('0x3'),'afterUpdate':_0xdf37('0x4'),'afterDestroy':_0xdf37('0x5')};function emitEvent(_0x4e86e0){return function(_0x57386e,_0x127897,_0x2cb9cc){_0x57386e[_0xdf37('0x6')]({'attributes':['id'],'raw':!![]})[_0xdf37('0x7')](function(_0xd3f6ce){_0x57386e[_0xdf37('0x8')]('Users',_0xd3f6ce[_0xdf37('0x9')](function(_0x1dfac4){return{'id':_0x1dfac4['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x57386e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x881c8a){_0x57386e['setDataValue'](_0xdf37('0xa'),_0x881c8a['length']);MailInteractionEvents[_0xdf37('0xb')](_0x4e86e0+':'+_0x57386e['id'],_0x57386e);MailInteractionEvents[_0xdf37('0xb')](_0x4e86e0,_0x57386e);_0x2cb9cc(null);})[_0xdf37('0xc')](_0x2cb9cc(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xdf37('0xd')](e,emitEvent(event));}}module[_0xdf37('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index a2b8a0e..0527385 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 _0x8a94=['util','../../config/logger','api','./mailInteraction.attributes','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','MailMessage','update','then','utf8mb4','lodash'];(function(_0x21ade4,_0x1bd55a){var _0x2f8159=function(_0xd930fa){while(--_0xd930fa){_0x21ade4['push'](_0x21ade4['shift']());}};_0x2f8159(++_0x1bd55a);}(_0x8a94,0xa0));var _0x48a9=function(_0x4f3a4c,_0x3676e5){_0x4f3a4c=_0x4f3a4c-0x0;var _0x24b242=_0x8a94[_0x4f3a4c];return _0x24b242;};'use strict';var _=require(_0x48a9('0x0'));var util=require(_0x48a9('0x1'));var logger=require(_0x48a9('0x2'))(_0x48a9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x48a9('0x4'));module['exports']=function(_0xca0e8e,_0x3c4d2a){return _0xca0e8e[_0x48a9('0x5')](_0x48a9('0x6'),attributes,{'tableName':_0x48a9('0x7'),'paranoid':![],'indexes':[{'name':_0x48a9('0x8'),'fields':[_0x48a9('0x9'),'to'],'type':_0x48a9('0xa')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4da748,_0x3b075c,_0x3f186d){if(_0x4da748[_0x48a9('0xb')]){_0x4da748[_0x48a9('0xc')]=moment()[_0x48a9('0xd')](_0x48a9('0xe'));}if(_0x4da748[_0x48a9('0xf')]){_0x4da748[_0x48a9('0x10')]=moment()['format'](_0x48a9('0xe'));}_0x3f186d(null,_0x3b075c);},'beforeUpdate':function(_0x27b57a,_0x4c9e5c,_0x2602c1){if(_0x27b57a['changed'](_0x48a9('0xb'))){_0x27b57a[_0x48a9('0xc')]=_0x27b57a['substatus']?moment()['format'](_0x48a9('0xe')):null;}if(_0x27b57a[_0x48a9('0x11')]('closed')){_0x27b57a[_0x48a9('0x10')]=moment()[_0x48a9('0xd')](_0x48a9('0xe'));_0x27b57a['substatus']=null;_0x27b57a[_0x48a9('0xc')]=null;}_0x2602c1(null,_0x27b57a);},'afterUpdate':function(_0x1bd35d,_0x44d674,_0xa58755){var _0x1743b0=_0xca0e8e[_0x48a9('0x12')];var _0x31f353=_0x1bd35d['get']({'plain':!![]});if(_0x31f353[_0x48a9('0xf')]){return _0x1743b0[_0x48a9('0x13')][_0x48a9('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x31f353['id']}})[_0x48a9('0x15')](function(){_0xa58755();})['catch'](function(_0x35546d){_0xa58755(_0x35546d);});}else{_0xa58755();}}},'charset':_0x48a9('0x16'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x469d=['substatus','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','MailInteraction','subject','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed'];(function(_0x337eea,_0x3fc240){var _0x3daea7=function(_0xd533b7){while(--_0xd533b7){_0x337eea['push'](_0x337eea['shift']());}};_0x3daea7(++_0x3fc240);}(_0x469d,0x1b9));var _0xd469=function(_0x5b59af,_0x9b2b){_0x5b59af=_0x5b59af-0x0;var _0x2b003c=_0x469d[_0x5b59af];return _0x2b003c;};'use strict';var _=require(_0xd469('0x0'));var util=require('util');var logger=require(_0xd469('0x1'))(_0xd469('0x2'));var moment=require(_0xd469('0x3'));var BPromise=require(_0xd469('0x4'));var rp=require(_0xd469('0x5'));var fs=require('fs');var path=require(_0xd469('0x6'));var rimraf=require(_0xd469('0x7'));var config=require(_0xd469('0x8'));var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x550f8a,_0x41c95f){return _0x550f8a[_0xd469('0x9')](_0xd469('0xa'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xd469('0xb'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5e3c84,_0x114df0,_0x5954cd){if(_0x5e3c84['substatus']){_0x5e3c84[_0xd469('0xc')]=moment()[_0xd469('0xd')](_0xd469('0xe'));}if(_0x5e3c84[_0xd469('0xf')]){_0x5e3c84[_0xd469('0x10')]=moment()[_0xd469('0xd')](_0xd469('0xe'));}_0x5954cd(null,_0x114df0);},'beforeUpdate':function(_0x4525df,_0x59b3de,_0x37f69c){if(_0x4525df[_0xd469('0x11')](_0xd469('0x12'))){_0x4525df[_0xd469('0xc')]=_0x4525df[_0xd469('0x12')]?moment()[_0xd469('0xd')](_0xd469('0xe')):null;}if(_0x4525df[_0xd469('0x11')](_0xd469('0xf'))){_0x4525df[_0xd469('0x10')]=moment()[_0xd469('0xd')]('YYYY-MM-DD\x20HH:mm:ss');_0x4525df[_0xd469('0x12')]=null;_0x4525df[_0xd469('0xc')]=null;}_0x37f69c(null,_0x4525df);},'afterUpdate':function(_0x458c31,_0x18e17e,_0x226b28){var _0x4be38c=_0x550f8a[_0xd469('0x13')];var _0x1d91a1=_0x458c31[_0xd469('0x14')]({'plain':!![]});if(_0x1d91a1['closed']){return _0x4be38c[_0xd469('0x15')][_0xd469('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x1d91a1['id']}})[_0xd469('0x17')](function(){_0x226b28();})[_0xd469('0x18')](function(_0x1f9ee6){_0x226b28(_0x1f9ee6);});}else{_0x226b28();}}},'charset':_0xd469('0x19'),'collate':_0xd469('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 4dddffd..8149525 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 _0xf2ee=['MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateMailInteraction','options','attributes','AddTagsToMailInteraction','MailInteraction','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info'];(function(_0x40e1ac,_0x3a84ad){var _0x23d435=function(_0xc0c25a){while(--_0xc0c25a){_0x40e1ac['push'](_0x40e1ac['shift']());}};_0x23d435(++_0x3a84ad);}(_0xf2ee,0x110));var _0xef2e=function(_0x155d81,_0x2bc075){_0x155d81=_0x155d81-0x0;var _0x3a7ff0=_0xf2ee[_0x155d81];return _0x3a7ff0;};'use strict';var _=require(_0xef2e('0x0'));var util=require(_0xef2e('0x1'));var moment=require(_0xef2e('0x2'));var BPromise=require(_0xef2e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xef2e('0x4'));var logger=require('../../config/logger')(_0xef2e('0x5'));var config=require(_0xef2e('0x6'));var jayson=require(_0xef2e('0x7'));var client=jayson[_0xef2e('0x8')][_0xef2e('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xef2e('0xa')],{'host':_0xef2e('0xb'),'port':0x18eb});var socket=require(_0xef2e('0xc'))(new Redis(config[_0xef2e('0xa')]));require('./mailInteraction.socket')[_0xef2e('0xd')](socket);function respondWithRpcPromise(_0x167f6c,_0x56ac9a,_0x4d9266){return new BPromise(function(_0x501cc2,_0x2e8fd7){return client['request'](_0x167f6c,_0x4d9266)[_0xef2e('0xe')](function(_0x568765){logger[_0xef2e('0xf')](_0xef2e('0x10'),_0x56ac9a,_0xef2e('0x11'));logger[_0xef2e('0x12')](_0xef2e('0x13'),_0x56ac9a,_0xef2e('0x11'),JSON[_0xef2e('0x14')](_0x568765));if(_0x568765[_0xef2e('0x15')]){if(_0x568765[_0xef2e('0x15')]['code']===0x1f4){logger[_0xef2e('0x15')]('MailInteraction,\x20%s,\x20%s',_0x56ac9a,_0x568765[_0xef2e('0x15')][_0xef2e('0x16')]);return _0x2e8fd7(_0x568765[_0xef2e('0x15')][_0xef2e('0x16')]);}logger[_0xef2e('0x15')](_0xef2e('0x10'),_0x56ac9a,_0x568765['error'][_0xef2e('0x16')]);return _0x501cc2(_0x568765[_0xef2e('0x15')][_0xef2e('0x16')]);}else{logger[_0xef2e('0xf')](_0xef2e('0x10'),_0x56ac9a,'request\x20sent');_0x501cc2(_0x568765[_0xef2e('0x17')][_0xef2e('0x16')]);}})[_0xef2e('0x18')](function(_0x5e7a26){logger['error'](_0xef2e('0x10'),_0x56ac9a,_0x5e7a26);_0x2e8fd7(_0x5e7a26);});});}exports[_0xef2e('0x19')]=function(_0x2f2008){var _0x1dc996=this;return new Promise(function(_0x36283e,_0x5258ec){return db['MailInteraction']['update'](_0x2f2008['body'],{'raw':_0x2f2008['options']?_0x2f2008['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f2008[_0xef2e('0x1a')]?_0x2f2008[_0xef2e('0x1a')]['where']||null:null,'attributes':_0x2f2008[_0xef2e('0x1a')]?_0x2f2008[_0xef2e('0x1a')][_0xef2e('0x1b')]||null:null,'limit':_0x2f2008['options']?_0x2f2008[_0xef2e('0x1a')]['limit']||null:null})['then'](function(_0x2af42b){logger[_0xef2e('0xf')](_0xef2e('0x19'),_0x2f2008);logger[_0xef2e('0x12')](_0xef2e('0x19'),_0x2f2008,JSON[_0xef2e('0x14')](_0x2af42b));_0x36283e(_0x2af42b);})['catch'](function(_0x160ab5){logger[_0xef2e('0x15')](_0xef2e('0x19'),_0x160ab5[_0xef2e('0x16')],_0x2f2008);_0x5258ec(_0x1dc996[_0xef2e('0x15')](0x1f4,_0x160ab5[_0xef2e('0x16')]));});});};exports[_0xef2e('0x1c')]=function(_0x4193e7){return new Promise(function(_0x4f8418,_0x19d42a){return db[_0xef2e('0x1d')]['find']({'where':_0x4193e7['options']?_0x4193e7[_0xef2e('0x1a')]['where']||null:null})[_0xef2e('0xe')](function(_0x385211){if(_0x385211){return _0x385211[_0xef2e('0x1e')](_0x4193e7[_0xef2e('0x1f')][_0xef2e('0x20')],_[_0xef2e('0x21')](_0x4193e7[_0xef2e('0x1f')],[_0xef2e('0x20'),'id'])||{});}})[_0xef2e('0x22')](function(_0xc9a2b2){logger[_0xef2e('0xf')](_0xef2e('0x23'),_0x4193e7);logger['debug'](_0xef2e('0x23'),_0x4193e7,JSON['stringify'](_0xc9a2b2));_0x4f8418(_0xc9a2b2);})[_0xef2e('0x18')](function(_0x5c4b9e){logger[_0xef2e('0x15')](_0xef2e('0x23'),_0x5c4b9e[_0xef2e('0x16')],_0x4193e7);_0x19d42a(_this[_0xef2e('0x15')](0x1f4,_0x5c4b9e[_0xef2e('0x16')]));});});}; \ No newline at end of file +var _0xa8db=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction','update','options','attributes','limit','AddTagsToMailInteraction','find','where','addTags','ids','omit','body','spread','AddTags','lodash','util','moment'];(function(_0x34d635,_0x2784fc){var _0x3ab288=function(_0x41589b){while(--_0x41589b){_0x34d635['push'](_0x34d635['shift']());}};_0x3ab288(++_0x2784fc);}(_0xa8db,0x12a));var _0xba8d=function(_0xe6e78c,_0x582369){_0xe6e78c=_0xe6e78c-0x0;var _0x2a09c8=_0xa8db[_0xe6e78c];return _0x2a09c8;};'use strict';var _=require(_0xba8d('0x0'));var util=require(_0xba8d('0x1'));var moment=require(_0xba8d('0x2'));var BPromise=require(_0xba8d('0x3'));var rs=require(_0xba8d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba8d('0x5'))['db'];var utils=require(_0xba8d('0x6'));var logger=require(_0xba8d('0x7'))(_0xba8d('0x8'));var config=require(_0xba8d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xba8d('0xa')]['http']({'port':0x232a});config['redis']=_[_0xba8d('0xb')](config[_0xba8d('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xba8d('0xd'))(new Redis(config[_0xba8d('0xc')]));require(_0xba8d('0xe'))[_0xba8d('0xf')](socket);function respondWithRpcPromise(_0x479881,_0x1c5de4,_0xbb9e4e){return new BPromise(function(_0x342a38,_0x23a53b){return client[_0xba8d('0x10')](_0x479881,_0xbb9e4e)[_0xba8d('0x11')](function(_0x4b2e37){logger[_0xba8d('0x12')](_0xba8d('0x13'),_0x1c5de4,_0xba8d('0x14'));logger[_0xba8d('0x15')](_0xba8d('0x16'),_0x1c5de4,_0xba8d('0x14'),JSON[_0xba8d('0x17')](_0x4b2e37));if(_0x4b2e37[_0xba8d('0x18')]){if(_0x4b2e37['error'][_0xba8d('0x19')]===0x1f4){logger[_0xba8d('0x18')](_0xba8d('0x13'),_0x1c5de4,_0x4b2e37['error'][_0xba8d('0x1a')]);return _0x23a53b(_0x4b2e37[_0xba8d('0x18')][_0xba8d('0x1a')]);}logger[_0xba8d('0x18')]('MailInteraction,\x20%s,\x20%s',_0x1c5de4,_0x4b2e37[_0xba8d('0x18')][_0xba8d('0x1a')]);return _0x342a38(_0x4b2e37[_0xba8d('0x18')][_0xba8d('0x1a')]);}else{logger[_0xba8d('0x12')](_0xba8d('0x13'),_0x1c5de4,_0xba8d('0x14'));_0x342a38(_0x4b2e37['result'][_0xba8d('0x1a')]);}})[_0xba8d('0x1b')](function(_0x24f131){logger[_0xba8d('0x18')](_0xba8d('0x13'),_0x1c5de4,_0x24f131);_0x23a53b(_0x24f131);});});}exports[_0xba8d('0x1c')]=function(_0x354f9e){var _0x224f88=this;return new Promise(function(_0x53259a,_0x546a2f){return db[_0xba8d('0x1d')][_0xba8d('0x1e')](_0x354f9e['body'],{'raw':_0x354f9e[_0xba8d('0x1f')]?_0x354f9e[_0xba8d('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x354f9e[_0xba8d('0x1f')]?_0x354f9e['options']['where']||null:null,'attributes':_0x354f9e[_0xba8d('0x1f')]?_0x354f9e[_0xba8d('0x1f')][_0xba8d('0x20')]||null:null,'limit':_0x354f9e['options']?_0x354f9e[_0xba8d('0x1f')][_0xba8d('0x21')]||null:null})[_0xba8d('0x11')](function(_0x57db7e){logger[_0xba8d('0x12')](_0xba8d('0x1c'),_0x354f9e);logger['debug'](_0xba8d('0x1c'),_0x354f9e,JSON[_0xba8d('0x17')](_0x57db7e));_0x53259a(_0x57db7e);})[_0xba8d('0x1b')](function(_0x2adbfb){logger[_0xba8d('0x18')](_0xba8d('0x1c'),_0x2adbfb['message'],_0x354f9e);_0x546a2f(_0x224f88[_0xba8d('0x18')](0x1f4,_0x2adbfb[_0xba8d('0x1a')]));});});};exports[_0xba8d('0x22')]=function(_0x3ac063){return new Promise(function(_0xcf11c2,_0x16110b){return db[_0xba8d('0x1d')][_0xba8d('0x23')]({'where':_0x3ac063[_0xba8d('0x1f')]?_0x3ac063[_0xba8d('0x1f')][_0xba8d('0x24')]||null:null})[_0xba8d('0x11')](function(_0x2697d6){if(_0x2697d6){return _0x2697d6[_0xba8d('0x25')](_0x3ac063['body'][_0xba8d('0x26')],_[_0xba8d('0x27')](_0x3ac063[_0xba8d('0x28')],['ids','id'])||{});}})[_0xba8d('0x29')](function(_0xbe1470){logger['info'](_0xba8d('0x2a'),_0x3ac063);logger[_0xba8d('0x15')](_0xba8d('0x2a'),_0x3ac063,JSON[_0xba8d('0x17')](_0xbe1470));_0xcf11c2(_0xbe1470);})[_0xba8d('0x1b')](function(_0x56d5c5){logger['error']('AddTags',_0x56d5c5[_0xba8d('0x1a')],_0x3ac063);_0x16110b(_this[_0xba8d('0x18')](0x1f4,_0x56d5c5['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index f8c6837..7801f5b 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 _0xb23e=['removeListener','length','mailInteraction:','./mailInteraction.events','remove','update','emit'];(function(_0x517c2e,_0x3d4bf3){var _0x5d4029=function(_0x150245){while(--_0x150245){_0x517c2e['push'](_0x517c2e['shift']());}};_0x5d4029(++_0x3d4bf3);}(_0xb23e,0xea));var _0xeb23=function(_0x204754,_0x33719f){_0x204754=_0x204754-0x0;var _0x251c92=_0xb23e[_0x204754];return _0x251c92;};'use strict';var MailInteractionEvents=require(_0xeb23('0x0'));var events=['save',_0xeb23('0x1'),_0xeb23('0x2')];function createListener(_0x3fdcd4,_0x11223e){return function(_0x26f22b){_0x11223e[_0xeb23('0x3')](_0x3fdcd4,_0x26f22b);};}function removeListener(_0x26aa01,_0x52fdeb){return function(){MailInteractionEvents[_0xeb23('0x4')](_0x26aa01,_0x52fdeb);};}exports['register']=function(_0x48b74c){for(var _0x3dee0b=0x0,_0x1f6021=events[_0xeb23('0x5')];_0x3dee0b<_0x1f6021;_0x3dee0b++){var _0x4a85f2=events[_0x3dee0b];var _0x397689=createListener(_0xeb23('0x6')+_0x4a85f2,_0x48b74c);MailInteractionEvents['on'](_0x4a85f2,_0x397689);}}; \ No newline at end of file +var _0x2f1f=['remove','update','emit','removeListener','register','mailInteraction:','./mailInteraction.events'];(function(_0x407ef0,_0x3d3015){var _0x305105=function(_0x138ccf){while(--_0x138ccf){_0x407ef0['push'](_0x407ef0['shift']());}};_0x305105(++_0x3d3015);}(_0x2f1f,0x102));var _0xf2f1=function(_0x55966c,_0x48c5b6){_0x55966c=_0x55966c-0x0;var _0x7c4c4f=_0x2f1f[_0x55966c];return _0x7c4c4f;};'use strict';var MailInteractionEvents=require(_0xf2f1('0x0'));var events=['save',_0xf2f1('0x1'),_0xf2f1('0x2')];function createListener(_0x5404eb,_0x2491b6){return function(_0x3bd6d5){_0x2491b6[_0xf2f1('0x3')](_0x5404eb,_0x3bd6d5);};}function removeListener(_0x6dbe3b,_0x3c2c7b){return function(){MailInteractionEvents[_0xf2f1('0x4')](_0x6dbe3b,_0x3c2c7b);};}exports[_0xf2f1('0x5')]=function(_0x34c998){for(var _0x4d163a=0x0,_0x27a446=events['length'];_0x4d163a<_0x27a446;_0x4d163a++){var _0x198e95=events[_0x4d163a];var _0x334d29=createListener(_0xf2f1('0x6')+_0x198e95,_0x34c998);MailInteractionEvents['on'](_0x198e95,_0x334d29);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index e2a9b2f..3490876 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 _0x5397=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','download','post','tracked','mail','create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x21cd08,_0x16cd11){var _0x1d77ba=function(_0x9dcabb){while(--_0x9dcabb){_0x21cd08['push'](_0x21cd08['shift']());}};_0x1d77ba(++_0x16cd11);}(_0x5397,0x105));var _0x7539=function(_0x4ab3d3,_0x2514df){_0x4ab3d3=_0x4ab3d3-0x0;var _0x49b7f6=_0x5397[_0x4ab3d3];return _0x49b7f6;};'use strict';var multer=require('multer');var util=require(_0x7539('0x0'));var path=require(_0x7539('0x1'));var timeout=require(_0x7539('0x2'));var express=require(_0x7539('0x3'));var router=express[_0x7539('0x4')]();var fs_extra=require(_0x7539('0x5'));var auth=require(_0x7539('0x6'));var interaction=require(_0x7539('0x7'));var config=require(_0x7539('0x8'));var controller=require('./mailMessage.controller');router[_0x7539('0x9')]('/',auth[_0x7539('0xa')](),controller[_0x7539('0xb')]);router[_0x7539('0x9')](_0x7539('0xc'),auth['isAuthenticated'](),controller[_0x7539('0xd')]);router['get'](_0x7539('0xe'),auth[_0x7539('0xa')](),controller[_0x7539('0xf')]);router[_0x7539('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x7539('0x10')]);router[_0x7539('0x11')]('/',auth[_0x7539('0xa')](),interaction[_0x7539('0x12')](_0x7539('0x13'),'mailmessage:create'),controller[_0x7539('0x14')]);router[_0x7539('0x15')]('/:id',auth[_0x7539('0xa')](),controller[_0x7539('0x16')]);router['put'](_0x7539('0x17'),auth[_0x7539('0xa')](),controller['accept']);router[_0x7539('0x15')](_0x7539('0x18'),auth[_0x7539('0xa')](),controller[_0x7539('0x19')]);router[_0x7539('0x1a')]('/:id',auth[_0x7539('0xa')](),controller[_0x7539('0x1b')]);module[_0x7539('0x1c')]=router; \ No newline at end of file +var _0xceab=['mail','mailmessage:create','create','update','/:id/accept','put','/:id/reject','reject','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','tracked'];(function(_0xe1a3a5,_0xd3e341){var _0x362646=function(_0xdcef03){while(--_0xdcef03){_0xe1a3a5['push'](_0xe1a3a5['shift']());}};_0x362646(++_0xd3e341);}(_0xceab,0x106));var _0xbcea=function(_0x33aecf,_0x40916d){_0x33aecf=_0x33aecf-0x0;var _0x5836a5=_0xceab[_0x33aecf];return _0x5836a5;};'use strict';var multer=require(_0xbcea('0x0'));var util=require('util');var path=require(_0xbcea('0x1'));var timeout=require(_0xbcea('0x2'));var express=require('express');var router=express[_0xbcea('0x3')]();var fs_extra=require(_0xbcea('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbcea('0x5'));var config=require(_0xbcea('0x6'));var controller=require('./mailMessage.controller');router[_0xbcea('0x7')]('/',auth[_0xbcea('0x8')](),controller[_0xbcea('0x9')]);router[_0xbcea('0x7')](_0xbcea('0xa'),auth['isAuthenticated'](),controller[_0xbcea('0xb')]);router[_0xbcea('0x7')](_0xbcea('0xc'),auth[_0xbcea('0x8')](),controller[_0xbcea('0xd')]);router['get'](_0xbcea('0xe'),auth['isAuthenticated'](),controller[_0xbcea('0xf')]);router[_0xbcea('0x10')]('/',auth[_0xbcea('0x8')](),interaction[_0xbcea('0x11')](_0xbcea('0x12'),_0xbcea('0x13')),controller[_0xbcea('0x14')]);router['put'](_0xbcea('0xc'),auth[_0xbcea('0x8')](),controller[_0xbcea('0x15')]);router['put'](_0xbcea('0x16'),auth['isAuthenticated'](),controller['accept']);router[_0xbcea('0x17')](_0xbcea('0x18'),auth[_0xbcea('0x8')](),controller[_0xbcea('0x19')]);router[_0xbcea('0x1a')](_0xbcea('0xc'),auth['isAuthenticated'](),controller[_0xbcea('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 293cbc1..18bd9bf 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 _0xb717=['Email','Chat','lodash','exports','TEXT','long','medium','BOOLEAN','out','STRING','DATE','INTEGER','ENUM'];(function(_0x173aa0,_0x2d263c){var _0x176df9=function(_0x1b8842){while(--_0x1b8842){_0x173aa0['push'](_0x173aa0['shift']());}};_0x176df9(++_0x2d263c);}(_0xb717,0x91));var _0x7b71=function(_0x4ec8f8,_0x59b707){_0x4ec8f8=_0x4ec8f8-0x0;var _0x59d53c=_0xb717[_0x4ec8f8];return _0x59d53c;};'use strict';var Sequelize=require('sequelize');var _=require(_0x7b71('0x0'));module[_0x7b71('0x1')]={'body':{'type':Sequelize[_0x7b71('0x2')](_0x7b71('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x7b71('0x4'))},'read':{'type':Sequelize[_0x7b71('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x7b71('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7b71('0x7')](0x1fe)},'from':{'type':Sequelize[_0x7b71('0x7')]},'to':{'type':Sequelize['TEXT'](_0x7b71('0x3'))},'cc':{'type':Sequelize[_0x7b71('0x2')](_0x7b71('0x3'))},'bcc':{'type':Sequelize[_0x7b71('0x2')](_0x7b71('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x7b71('0x8')]},'attach':{'type':Sequelize[_0x7b71('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x7b71('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x7b71('0x8')]},'originTo':{'type':Sequelize[_0x7b71('0x2')](_0x7b71('0x3'))},'originCc':{'type':Sequelize[_0x7b71('0x2')](_0x7b71('0x3'))},'originChannel':{'type':Sequelize[_0x7b71('0xa')](_0x7b71('0xb'),_0x7b71('0xc')),'defaultValue':_0x7b71('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x0666=['exports','TEXT','long','medium','BOOLEAN','out','STRING','INTEGER','DATE','ENUM','Chat','Email','sequelize'];(function(_0xf47a62,_0x36435f){var _0x3073d6=function(_0x11247f){while(--_0x11247f){_0xf47a62['push'](_0xf47a62['shift']());}};_0x3073d6(++_0x36435f);}(_0x0666,0x178));var _0x6066=function(_0x72e04a,_0x398f0b){_0x72e04a=_0x72e04a-0x0;var _0x4e8acf=_0x0666[_0x72e04a];return _0x4e8acf;};'use strict';var Sequelize=require(_0x6066('0x0'));var _=require('lodash');module[_0x6066('0x1')]={'body':{'type':Sequelize[_0x6066('0x2')](_0x6066('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x6066('0x2')](_0x6066('0x4'))},'read':{'type':Sequelize[_0x6066('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x6066('0x6')),'defaultValue':_0x6066('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x6066('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x6066('0x2')]('long')},'cc':{'type':Sequelize[_0x6066('0x2')](_0x6066('0x3'))},'bcc':{'type':Sequelize[_0x6066('0x2')](_0x6066('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x6066('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x6066('0x9')]},'originTo':{'type':Sequelize[_0x6066('0x2')](_0x6066('0x3'))},'originCc':{'type':Sequelize[_0x6066('0x2')](_0x6066('0x3'))},'originChannel':{'type':Sequelize[_0x6066('0xa')]('Email',_0x6066('0xb')),'defaultValue':_0x6066('0xc'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index ee75b22..a84797e 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 _0xd030=['error','code','MailMessage,\x20%s,\x20%s','message','info','catch','status','json','offset','limit','undefined','count','Content-Range','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','length','find','update','body','describe','create','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','Contacts','ListId','SendMail','sendMail','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','format','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','[MAILMESSAGE: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','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','Sequelize','QueryTypes','SIP/%s','event','rejectmessage','download','toString','server','files','message-%s.eml','bcc','subject','Attachment','Attachments','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','build','writeFileSync','unlinkSync','eml-format','bluebird','util','lodash','ioredis','../../components/parsers/qs','api','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','html-entities','./mailMessage.socket','client','http','request','then','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xd030,0x1be));var _0x0d03=function(_0x1b0b15,_0x22dea3){_0x1b0b15=_0x1b0b15-0x0;var _0x1f29cd=_0xd030[_0x1b0b15];return _0x1f29cd;};'use strict';var emlformat=require(_0x0d03('0x0'));var moment=require('moment');var BPromise=require(_0x0d03('0x1'));var util=require(_0x0d03('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x0d03('0x3'));var Redis=require(_0x0d03('0x4'));var htmlToText=require('html-to-text');var qs=require(_0x0d03('0x5'));var logger=require('../../config/logger')(_0x0d03('0x6'));var interaction_log=require(_0x0d03('0x7'))(_0x0d03('0x8'));var config=require(_0x0d03('0x9'));var db=require(_0x0d03('0xa'))['db'];config[_0x0d03('0xb')]=_['defaults'](config[_0x0d03('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d03('0xb')]));var htmlEntities=require(_0x0d03('0xc'));require(_0x0d03('0xd'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9003=jayson[_0x0d03('0xe')][_0x0d03('0xf')]({'port':0x232b});var client9002=jayson[_0x0d03('0xe')][_0x0d03('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x11b3cc,_0x11af67,_0x2effff,_0x180f19){return new BPromise(function(_0x3f6f8e,_0x37b9e0){var _0x4cf18c=_0x180f19||client;return _0x4cf18c[_0x0d03('0x10')](_0x11b3cc,_0x2effff)[_0x0d03('0x11')](function(_0x1eb30d){logger['info']('MailMessage,\x20%s,\x20%s',_0x11af67,_0x0d03('0x12'));logger[_0x0d03('0x13')](_0x0d03('0x14'),_0x11af67,_0x0d03('0x12'),JSON[_0x0d03('0x15')](_0x1eb30d));if(_0x1eb30d[_0x0d03('0x16')]){if(_0x1eb30d[_0x0d03('0x16')][_0x0d03('0x17')]===0x1f4){logger['error'](_0x0d03('0x18'),_0x11af67,_0x1eb30d['error']['message']);return _0x37b9e0(_0x1eb30d[_0x0d03('0x16')][_0x0d03('0x19')]);}logger[_0x0d03('0x16')](_0x0d03('0x18'),_0x11af67,_0x1eb30d[_0x0d03('0x16')]['message']);return _0x3f6f8e(_0x1eb30d['error']['message']);}else{logger[_0x0d03('0x1a')](_0x0d03('0x18'),_0x11af67,'request\x20sent');_0x3f6f8e(_0x1eb30d['result'][_0x0d03('0x19')]);}})[_0x0d03('0x1b')](function(_0x12d566){logger['error'](_0x0d03('0x18'),_0x11af67,_0x12d566);_0x37b9e0(_0x12d566);});});}function respondWithResult(_0x19ba7d,_0xcbc07d){_0xcbc07d=_0xcbc07d||0xc8;return function(_0x2765db){if(_0x2765db){return _0x19ba7d[_0x0d03('0x1c')](_0xcbc07d)[_0x0d03('0x1d')](_0x2765db);}};}function respondWithFilteredResult(_0x353b10,_0x128995){return function(_0x582515){if(_0x582515){var _0x44f32c=typeof _0x128995[_0x0d03('0x1e')]==='undefined'&&typeof _0x128995[_0x0d03('0x1f')]===_0x0d03('0x20');var _0x122268=_0x582515[_0x0d03('0x21')];var _0x3b11f1=_0x44f32c?0x0:_0x128995[_0x0d03('0x1e')];var _0x3468d8=_0x44f32c?_0x582515[_0x0d03('0x21')]:_0x128995[_0x0d03('0x1e')]+_0x128995['limit'];var _0x3457fe;if(_0x3468d8>=_0x122268){_0x3468d8=_0x122268;_0x3457fe=0xc8;}else{_0x3457fe=0xce;}_0x353b10[_0x0d03('0x1c')](_0x3457fe);return _0x353b10['set'](_0x0d03('0x22'),_0x3b11f1+'-'+_0x3468d8+'/'+_0x122268)[_0x0d03('0x1d')](_0x582515);}return null;};}function saveUpdates(_0x2d8b4e){return function(_0x52a8fc){if(_0x52a8fc){return _0x52a8fc['update'](_0x2d8b4e)['then'](function(_0x1efef2){return _0x1efef2;});}return null;};}function removeEntity(_0x5c5770){return function(_0x4a3ff6){if(_0x4a3ff6){return _0x4a3ff6[_0x0d03('0x23')]()[_0x0d03('0x11')](function(){_0x5c5770[_0x0d03('0x1c')](0xcc)[_0x0d03('0x24')]();});}};}function handleEntityNotFound(_0x72403f){return function(_0x43f5be){if(!_0x43f5be){_0x72403f[_0x0d03('0x25')](0x194);}return _0x43f5be;};}function handleError(_0x59ff78,_0x16e8d6){_0x16e8d6=_0x16e8d6||0x1f4;return function(_0x5489cc){logger['error'](_0x5489cc[_0x0d03('0x26')]);if(_0x5489cc[_0x0d03('0x27')]){delete _0x5489cc['name'];}_0x59ff78[_0x0d03('0x1c')](_0x16e8d6)[_0x0d03('0x28')](_0x5489cc);};}exports[_0x0d03('0x29')]=function(_0x29faa5,_0x3a3f22){var _0x4973a8={},_0x95c4a5={},_0x1c9f5b={'count':0x0,'rows':[]};var _0x33cc42=_[_0x0d03('0x2a')](db[_0x0d03('0x2b')][_0x0d03('0x2c')],function(_0x544f2d){return{'name':_0x544f2d[_0x0d03('0x2d')],'type':_0x544f2d[_0x0d03('0x2e')][_0x0d03('0x2f')]};});_0x95c4a5[_0x0d03('0x30')]=_[_0x0d03('0x2a')](_0x33cc42,_0x0d03('0x27'));_0x95c4a5[_0x0d03('0x31')]=_[_0x0d03('0x32')](_0x29faa5[_0x0d03('0x31')]);_0x95c4a5['filters']=_[_0x0d03('0x33')](_0x95c4a5['model'],_0x95c4a5[_0x0d03('0x31')]);_0x4973a8[_0x0d03('0x34')]=_['intersection'](_0x95c4a5[_0x0d03('0x30')],qs[_0x0d03('0x35')](_0x29faa5[_0x0d03('0x31')][_0x0d03('0x35')]));_0x4973a8[_0x0d03('0x34')]=_0x4973a8[_0x0d03('0x34')]['length']?_0x4973a8[_0x0d03('0x34')]:_0x95c4a5[_0x0d03('0x30')];if(!_0x29faa5[_0x0d03('0x31')][_0x0d03('0x36')](_0x0d03('0x37'))){_0x4973a8[_0x0d03('0x1f')]=qs[_0x0d03('0x1f')](_0x29faa5[_0x0d03('0x31')][_0x0d03('0x1f')]);_0x4973a8[_0x0d03('0x1e')]=qs[_0x0d03('0x1e')](_0x29faa5[_0x0d03('0x31')]['offset']);}_0x4973a8['order']=qs[_0x0d03('0x38')](_0x29faa5[_0x0d03('0x31')][_0x0d03('0x38')]);_0x4973a8[_0x0d03('0x39')]=qs['filters'](_['pick'](_0x29faa5['query'],_0x95c4a5[_0x0d03('0x3a')]),_0x33cc42);if(_0x29faa5['query'][_0x0d03('0x3b')]){_0x4973a8[_0x0d03('0x39')]=_[_0x0d03('0x3c')](_0x4973a8[_0x0d03('0x39')],{'$or':_[_0x0d03('0x2a')](_0x33cc42,function(_0x13e285){if(_0x13e285['type']!==_0x0d03('0x3d')){var _0x338998={};_0x338998[_0x13e285[_0x0d03('0x27')]]={'$like':'%'+_0x29faa5[_0x0d03('0x31')]['filter']+'%'};return _0x338998;}})});}_0x4973a8=_[_0x0d03('0x3c')]({},_0x4973a8,_0x29faa5[_0x0d03('0x3e')]);var _0x7b09ea={'where':_0x4973a8[_0x0d03('0x39')]};return db[_0x0d03('0x2b')]['count'](_0x7b09ea)[_0x0d03('0x11')](function(_0x26d7aa){_0x1c9f5b[_0x0d03('0x21')]=_0x26d7aa;if(_0x29faa5['query'][_0x0d03('0x3f')]){_0x4973a8[_0x0d03('0x40')]=[{'all':!![]}];}return db[_0x0d03('0x2b')][_0x0d03('0x41')](_0x4973a8);})[_0x0d03('0x11')](function(_0x260479){_0x1c9f5b[_0x0d03('0x42')]=_0x260479;return _0x1c9f5b;})[_0x0d03('0x11')](respondWithFilteredResult(_0x3a3f22,_0x4973a8))[_0x0d03('0x1b')](handleError(_0x3a3f22,null));};exports['show']=function(_0x5a51cc,_0x1525b5){var _0x87395b={'raw':!![],'where':{'id':_0x5a51cc[_0x0d03('0x43')]['id']}},_0xa9e1b2={};_0xa9e1b2[_0x0d03('0x30')]=_[_0x0d03('0x32')](db[_0x0d03('0x2b')]['rawAttributes']);_0xa9e1b2[_0x0d03('0x31')]=_[_0x0d03('0x32')](_0x5a51cc[_0x0d03('0x31')]);_0xa9e1b2[_0x0d03('0x3a')]=_[_0x0d03('0x33')](_0xa9e1b2[_0x0d03('0x30')],_0xa9e1b2['query']);_0x87395b[_0x0d03('0x34')]=_['intersection'](_0xa9e1b2[_0x0d03('0x30')],qs['fields'](_0x5a51cc[_0x0d03('0x31')][_0x0d03('0x35')]));_0x87395b['attributes']=_0x87395b[_0x0d03('0x34')][_0x0d03('0x44')]?_0x87395b[_0x0d03('0x34')]:_0xa9e1b2['model'];if(_0x5a51cc[_0x0d03('0x31')][_0x0d03('0x3f')]){_0x87395b[_0x0d03('0x40')]=[{'all':!![]}];}_0x87395b=_['merge']({},_0x87395b,_0x5a51cc[_0x0d03('0x3e')]);return db[_0x0d03('0x2b')][_0x0d03('0x45')](_0x87395b)['then'](handleEntityNotFound(_0x1525b5,null))[_0x0d03('0x11')](respondWithResult(_0x1525b5,null))[_0x0d03('0x1b')](handleError(_0x1525b5,null));};exports[_0x0d03('0x46')]=function(_0x416adc,_0x4e3a67){if(_0x416adc[_0x0d03('0x47')]['id']){delete _0x416adc[_0x0d03('0x47')]['id'];}return db[_0x0d03('0x2b')][_0x0d03('0x45')]({'where':{'id':_0x416adc['params']['id']}})[_0x0d03('0x11')](handleEntityNotFound(_0x4e3a67,null))[_0x0d03('0x11')](saveUpdates(_0x416adc[_0x0d03('0x47')],null))[_0x0d03('0x11')](respondWithResult(_0x4e3a67,null))[_0x0d03('0x1b')](handleError(_0x4e3a67,null));};exports[_0x0d03('0x23')]=function(_0x189f86,_0x1db458){return db[_0x0d03('0x2b')]['find']({'where':{'id':_0x189f86['params']['id']}})[_0x0d03('0x11')](handleEntityNotFound(_0x1db458,null))[_0x0d03('0x11')](removeEntity(_0x1db458,null))[_0x0d03('0x1b')](handleError(_0x1db458,null));};exports[_0x0d03('0x48')]=function(_0xf082e5,_0x5e8abc){return db[_0x0d03('0x2b')]['describe']()[_0x0d03('0x11')](respondWithResult(_0x5e8abc,null))[_0x0d03('0x1b')](handleError(_0x5e8abc,null));};exports[_0x0d03('0x49')]=function(_0xc3f217,_0xed9c87){return db[_0x0d03('0x2b')][_0x0d03('0x49')](_0xc3f217['body'])[_0x0d03('0x11')](function(_0x397853){if(_0x397853){if(_0x397853['direction']===_0x0d03('0x4a')&&!_0x397853[_0x0d03('0x4b')]){var _0x34ba7f,_0x4c2414,_0x4dc58f;if(_0xc3f217[_0x0d03('0x47')]['to']){_0x4c2414=_0xc3f217[_0x0d03('0x47')]['to'][_0x0d03('0x4c')](',')[0x0];}return db[_0x0d03('0x4d')][_0x0d03('0x4e')]({'where':{'id':_0x397853[_0x0d03('0x4f')]},'include':[{'model':db[_0x0d03('0x50')],'as':_0x0d03('0x51'),'include':[{'model':db[_0x0d03('0x52')],'as':'Contacts','where':{'email':_0x4c2414},'limit':0x1,'order':[['updatedAt',_0x0d03('0x53')]]}]},{'model':db[_0x0d03('0x54')],'as':_0x0d03('0x55'),'raw':!![],'include':[{'model':db[_0x0d03('0x56')],'as':_0x0d03('0x56'),'raw':!![]}]}]})[_0x0d03('0x11')](function(_0x2a5d0e){_0x34ba7f=_0x2a5d0e;if(!_0x34ba7f||!_0x34ba7f[_0x0d03('0x55')])return;var _0x409dbd=_0x34ba7f[_0x0d03('0x57')]();if(_0xc3f217[_0x0d03('0x47')][_0x0d03('0x58')]&&_0xc3f217[_0x0d03('0x47')]['attachments'][_0x0d03('0x44')]){for(var _0x343a98=0x0;_0x343a98<_0xc3f217[_0x0d03('0x47')][_0x0d03('0x58')][_0x0d03('0x44')];_0x343a98+=0x1){_0xc3f217['body'][_0x0d03('0x58')][_0x343a98]={'filename':_0xc3f217[_0x0d03('0x47')][_0x0d03('0x58')][_0x343a98]['name'],'path':path[_0x0d03('0x59')](config[_0x0d03('0x5a')],_0x0d03('0x5b'),_0xc3f217[_0x0d03('0x47')][_0x0d03('0x58')][_0x343a98][_0x0d03('0x5c')])};}}_0x4dc58f={'account':_0x409dbd,'message':_0xc3f217[_0x0d03('0x47')]};return;})['then'](function(){if(_0x34ba7f[_0x0d03('0x51')]){if(_0x34ba7f[_0x0d03('0x51')][_0x0d03('0x5d')]['length']){return _0x34ba7f[_0x0d03('0x51')]['Contacts'][0x0];}else{return db[_0x0d03('0x52')][_0x0d03('0x49')](_['defaults'](_0xc3f217['body'],{'firstName':_0xc3f217[_0x0d03('0x47')]['to'],'email':_0xc3f217[_0x0d03('0x47')]['to'],'phone':_0xc3f217[_0x0d03('0x47')]['to'],'ListId':_0x34ba7f[_0x0d03('0x5e')]}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x4dc58f){return respondWithRpcPromise(_0x0d03('0x5f'),_0x0d03('0x60'),_0x4dc58f,client9003)[_0x0d03('0x11')](function(_0x1b64a3){return _0x397853[_0x0d03('0x46')]({'read':!![],'messageId':_0x1b64a3['messageId'],'sentAt':moment()['format'](_0x0d03('0x61'))});})['catch'](function(_0x3a4e7a){logger[_0x0d03('0x16')]('%s',JSON['stringify'](_0x3a4e7a));return _0x397853;});}return _0x397853;});}return _0x397853;}})[_0x0d03('0x11')](respondWithResult(_0xed9c87,0xc9))[_0x0d03('0x1b')](handleError(_0xed9c87,null));};exports[_0x0d03('0x62')]=function(_0x40e91f,_0x282da7){var _0x760895={'agent':{},'channel':_0x0d03('0x63')};if(_0x40e91f[_0x0d03('0x47')]['id']){delete _0x40e91f[_0x0d03('0x47')]['id'];}_0x40e91f[_0x0d03('0x47')][_0x0d03('0x64')]=!![];_0x40e91f[_0x0d03('0x47')][_0x0d03('0x65')]=moment()[_0x0d03('0x66')](_0x0d03('0x61'));_0x40e91f[_0x0d03('0x47')]['UserId']=_0x40e91f['body'][_0x0d03('0x67')]||_0x40e91f[_0x0d03('0x68')]['id'];_0x760895[_0x0d03('0x69')]['id']=_0x40e91f[_0x0d03('0x47')][_0x0d03('0x67')];return db[_0x0d03('0x2b')][_0x0d03('0x45')]({'where':{'id':_0x40e91f[_0x0d03('0x43')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x282da7,null))[_0x0d03('0x11')](saveUpdates(_0x40e91f['body'],null))[_0x0d03('0x11')](function(_0x36183c){if(_0x36183c){_0x760895['message']=_0x36183c[_0x0d03('0x6a')]({'plain':!![]});return db[_0x0d03('0x6b')][_0x0d03('0x45')]({'where':{'id':_0x36183c[_0x0d03('0x6c')]}});}return null;})['then'](handleEntityNotFound(_0x282da7,null))[_0x0d03('0x11')](function(_0x8bf364){if(_0x8bf364){return _0x8bf364[_0x0d03('0x46')]({'UserId':_0x40e91f[_0x0d03('0x47')][_0x0d03('0x67')],'read1stAt':_[_0x0d03('0x6d')](_0x8bf364[_0x0d03('0x6e')])?moment()[_0x0d03('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0d03('0x11')](function(_0x3329f0){if(_0x3329f0){_0x760895['interaction']=_0x3329f0[_0x0d03('0x6a')]({'plain':!![]});interaction_log[_0x0d03('0x1a')](_0x0d03('0x6f'),_0x40e91f[_0x0d03('0x68')]['id'],_0x40e91f['user']['name'],_0x40e91f[_0x0d03('0x68')][_0x0d03('0x70')],_0x760895[_0x0d03('0x71')]['id'],_0x40e91f[_0x0d03('0x47')]?JSON['stringify'](_0x40e91f['body']):_0x0d03('0x72'));return respondWithRpcPromise(_0x0d03('0x73'),'acceptMessage',_0x760895);}return null;})[_0x0d03('0x11')](function(_0x5b3d04){var _0x42153f=_0x0d03('0x74')+_0x5b3d04[_0x0d03('0x19')][_0x0d03('0x75')];return db[_0x0d03('0x76')]['query'](_0x42153f,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x0d03('0x11')](function(_0x154f05){return _0x154f05;});})[_0x0d03('0x11')](function(_0x245f06){if(_0x245f06){_0x760895[_0x0d03('0x19')][_0x0d03('0x77')]=_0x245f06[0x0];if(!_0x40e91f['body'][_0x0d03('0x67')])return;return db[_0x0d03('0x78')]['find']({'where':{'id':_0x40e91f[_0x0d03('0x47')][_0x0d03('0x67')],'role':_0x0d03('0x69')},'attributes':['id',_0x0d03('0x27'),_0x0d03('0x79'),_0x0d03('0x7a'),_0x0d03('0x7b')],'raw':!![]});}return null;})[_0x0d03('0x11')](function(_0x55b2ce){if(!_0x55b2ce)return null;_0x760895[_0x0d03('0x19')]['agent']=_0x55b2ce;return _0x760895;})['then'](function(_0x29d7c8){if(_0x29d7c8){if(_0x40e91f[_0x0d03('0x47')][_0x0d03('0x7c')]){_0x760895[_0x0d03('0x19')][_0x0d03('0x7d')]=util['format']('SIP/%s',_0x40e91f[_0x0d03('0x68')]['name']);_0x760895[_0x0d03('0x19')][_0x0d03('0x7e')]=_0x760895[_0x0d03('0x7e')];_0x760895[_0x0d03('0x19')][_0x0d03('0x7f')]=_0x760895[_0x0d03('0x7e')];_0x760895['message']['event']='accept';_0x760895[_0x0d03('0x19')][_0x0d03('0x47')]=htmlToText[_0x0d03('0x80')](_0x760895['message'][_0x0d03('0x47')]);return respondWithRpcPromise('EventManager',_0x0d03('0x81'),{'event':_0x0d03('0x82'),'message':_0x760895[_0x0d03('0x19')]},client9002)[_0x0d03('0x11')](function(){return _0x760895;});}return _0x760895;}return null;})[_0x0d03('0x11')](respondWithResult(_0x282da7,null))[_0x0d03('0x1b')](handleError(_0x282da7,null));};exports[_0x0d03('0x83')]=function(_0x7e4975,_0x9b27e8){var _0x2ba563={'agent':{},'channel':_0x0d03('0x63')};if(_0x7e4975[_0x0d03('0x47')]['id']){delete _0x7e4975[_0x0d03('0x47')]['id'];}_0x7e4975[_0x0d03('0x47')][_0x0d03('0x67')]=_0x7e4975[_0x0d03('0x47')][_0x0d03('0x67')]||_0x7e4975['user']['id'];_0x2ba563[_0x0d03('0x69')]['id']=_0x7e4975['body'][_0x0d03('0x67')];return db['MailMessage'][_0x0d03('0x45')]({'where':{'id':_0x7e4975['params']['id'],'UserId':null}})[_0x0d03('0x11')](handleEntityNotFound(_0x9b27e8,null))[_0x0d03('0x11')](function(_0x159762){if(_0x159762){_0x2ba563[_0x0d03('0x19')]=_0x159762['get']({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x159762[_0x0d03('0x6c')]}});}return null;})[_0x0d03('0x11')](handleEntityNotFound(_0x9b27e8,null))[_0x0d03('0x11')](function(_0x442063){if(_0x442063){_0x2ba563[_0x0d03('0x71')]=_0x442063[_0x0d03('0x6a')]({'plain':!![]});interaction_log[_0x0d03('0x1a')](_0x0d03('0x84'),_0x7e4975['user']['id'],_0x7e4975[_0x0d03('0x68')][_0x0d03('0x27')],_0x7e4975['user'][_0x0d03('0x70')],_0x2ba563[_0x0d03('0x71')]['id'],_0x7e4975[_0x0d03('0x47')]?JSON['stringify'](_0x7e4975[_0x0d03('0x47')]):_0x0d03('0x72'));return respondWithRpcPromise('RejectMessage',_0x0d03('0x85'),_0x2ba563);}return null;})[_0x0d03('0x11')](function(_0x1aa51b){var _0xc55758=_0x0d03('0x74')+_0x1aa51b[_0x0d03('0x19')][_0x0d03('0x75')];return db[_0x0d03('0x76')][_0x0d03('0x31')](_0xc55758,{'type':db[_0x0d03('0x86')][_0x0d03('0x87')]['SELECT'],'raw':!![]})[_0x0d03('0x11')](function(_0x5e9de8){return _0x5e9de8;});})['then'](function(_0x3f1954){if(_0x3f1954){_0x2ba563['message'][_0x0d03('0x77')]=_0x3f1954[0x0];if(!_0x7e4975[_0x0d03('0x47')]['UserId'])return;return db[_0x0d03('0x78')][_0x0d03('0x45')]({'where':{'id':_0x7e4975['body']['UserId'],'role':'agent'},'attributes':['id',_0x0d03('0x27'),_0x0d03('0x79'),_0x0d03('0x7a'),_0x0d03('0x7b')],'raw':!![]});}return null;})[_0x0d03('0x11')](function(_0x10ecda){if(!_0x10ecda)return null;_0x2ba563[_0x0d03('0x19')][_0x0d03('0x69')]=_0x10ecda;return _0x2ba563;})['then'](function(_0x460788){if(_0x460788){_0x460788[_0x0d03('0x19')][_0x0d03('0x7d')]=util['format'](_0x0d03('0x88'),_0x7e4975[_0x0d03('0x68')][_0x0d03('0x27')]);_0x460788[_0x0d03('0x19')][_0x0d03('0x7e')]=_0x2ba563[_0x0d03('0x7e')];_0x460788[_0x0d03('0x19')][_0x0d03('0x7f')]=_0x2ba563[_0x0d03('0x7e')];_0x460788[_0x0d03('0x19')][_0x0d03('0x89')]='reject';_0x460788[_0x0d03('0x19')][_0x0d03('0x47')]=htmlToText[_0x0d03('0x80')](_0x2ba563[_0x0d03('0x19')][_0x0d03('0x47')]);respondWithRpcPromise(_0x0d03('0x81'),_0x0d03('0x81'),{'event':_0x0d03('0x8a'),'message':_0x460788[_0x0d03('0x19')]},client9002);return _0x2ba563;}return null;})['then'](respondWithResult(_0x9b27e8,null))['catch'](handleError(_0x9b27e8,null));};exports[_0x0d03('0x8b')]=function(_0x501186,_0x50c452){var _0x4832f6=moment()['unix']()[_0x0d03('0x8c')]();var _0x1b9026=path[_0x0d03('0x59')](config['root'],_0x0d03('0x8d'),_0x0d03('0x8e'),'tmp');var _0x2771ff=path[_0x0d03('0x59')](config[_0x0d03('0x5a')],_0x0d03('0x8d'),_0x0d03('0x8e'),_0x0d03('0x58'));var _0x94777c=util[_0x0d03('0x66')](_0x0d03('0x8f'),_0x4832f6);return db[_0x0d03('0x2b')][_0x0d03('0x45')]({'where':{'id':_0x501186['params']['id']},'attributes':['id','body','from','to','cc',_0x0d03('0x90'),_0x0d03('0x91'),'createdAt'],'include':_0x501186[_0x0d03('0x31')][_0x0d03('0x58')]?[{'model':db[_0x0d03('0x92')],'as':_0x0d03('0x93')}]:undefined})['then'](handleEntityNotFound(_0x50c452,null))[_0x0d03('0x11')](function(_0x1c3794){if(_0x1c3794){var _0x20f920=_0x1c3794;var _0x5c9551={'from':_0x20f920['from'],'to':_0x20f920['to'],'subject':_0x20f920[_0x0d03('0x91')],'html':htmlEntities[_0x0d03('0x94')](_0x20f920[_0x0d03('0x47')]),'headers':{'Date':moment(_0x20f920[_0x0d03('0x95')])['format'](_0x0d03('0x96'))},'attachments':[]};if(_0x1c3794['cc']){_0x5c9551[_0x0d03('0x97')]['Cc']=_0x1c3794['cc'];}if(_0x1c3794[_0x0d03('0x90')]){_0x5c9551[_0x0d03('0x97')]['Bcc']=_0x1c3794['bcc'];}return new BPromise(function(_0x16ebc9,_0x4b97af){if(_0x1c3794['Attachments']){for(var _0x50640f=0x0;_0x50640f<_0x1c3794[_0x0d03('0x93')][_0x0d03('0x44')];_0x50640f++){var _0x50464a=_0x1c3794[_0x0d03('0x93')][_0x50640f];var _0x470fa3=path[_0x0d03('0x59')](_0x2771ff,_0x50464a['basename']);if(fs[_0x0d03('0x98')](_0x470fa3)){_0x5c9551[_0x0d03('0x58')]['push']({'name':_0x50464a[_0x0d03('0x27')],'contentType':_0x50464a[_0x0d03('0x2e')],'data':fs['readFileSync'](_0x470fa3)});}}}emlformat[_0x0d03('0x99')](_0x5c9551,function(_0x14f2dd,_0x249aaf){if(_0x14f2dd)return _0x4b97af(_0x14f2dd);fs[_0x0d03('0x9a')](path[_0x0d03('0x59')](_0x1b9026,_0x94777c),_0x249aaf);return _0x16ebc9(_0x249aaf);});});}})[_0x0d03('0x11')](function(_0x31f24d){if(_0x31f24d){return _0x50c452[_0x0d03('0x8b')](path[_0x0d03('0x59')](_0x1b9026,_0x94777c),_0x94777c,function(_0x3fb89e){if(!_0x3fb89e)fs[_0x0d03('0x9b')](path[_0x0d03('0x59')](_0x1b9026,_0x94777c));});}})[_0x0d03('0x1b')](handleError(_0x50c452,null));}; \ No newline at end of file +var _0x164e=['List','CmContact','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','length','root','server/files/attachments','basename','Contacts','defaults','ListId','List\x20not\x20found','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','format','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','User','fullname','email','manual','interface','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','rejectMessage','sequelize','contact','SIP/%s','rejectmessage','toString','server','files','tmp','join','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','readFileSync','build','writeFileSync','download','moment','ioredis','../../components/parsers/qs','api','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','json','offset','count','limit','status','Content-Range','update','destroy','end','sendStatus','name','send','index','map','MailMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','body','describe','create','direction','secret','split','findOne','MailAccountId'];(function(_0x15924a,_0x331e8b){var _0x5bcc8d=function(_0x5cba41){while(--_0x5cba41){_0x15924a['push'](_0x15924a['shift']());}};_0x5bcc8d(++_0x331e8b);}(_0x164e,0xe6));var _0xe164=function(_0x511c15,_0x215fc2){_0x511c15=_0x511c15-0x0;var _0xc8804f=_0x164e[_0x511c15];return _0xc8804f;};'use strict';var emlformat=require('eml-format');var moment=require(_0xe164('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require(_0xe164('0x1'));var htmlToText=require('html-to-text');var qs=require(_0xe164('0x2'));var logger=require('../../config/logger')(_0xe164('0x3'));var interaction_log=require(_0xe164('0x4'))(_0xe164('0x5'));var config=require(_0xe164('0x6'));var db=require(_0xe164('0x7'))['db'];config[_0xe164('0x8')]=_['defaults'](config[_0xe164('0x8')],{'host':_0xe164('0x9'),'port':0x18eb});var socket=require(_0xe164('0xa'))(new Redis(config[_0xe164('0x8')]));var htmlEntities=require(_0xe164('0xb'));require(_0xe164('0xc'))[_0xe164('0xd')](socket);var jayson=require(_0xe164('0xe'));var client=jayson[_0xe164('0xf')]['http']({'port':0x232c});var client9003=jayson[_0xe164('0xf')][_0xe164('0x10')]({'port':0x232b});var client9002=jayson[_0xe164('0xf')][_0xe164('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x2b4c33,_0x3166a3,_0x4e305a,_0x1b5469){return new BPromise(function(_0x67d01,_0x1a827f){var _0x24e9bd=_0x1b5469||client;return _0x24e9bd[_0xe164('0x11')](_0x2b4c33,_0x4e305a)[_0xe164('0x12')](function(_0x524a4d){logger[_0xe164('0x13')]('MailMessage,\x20%s,\x20%s',_0x3166a3,_0xe164('0x14'));logger['debug'](_0xe164('0x15'),_0x3166a3,_0xe164('0x14'),JSON[_0xe164('0x16')](_0x524a4d));if(_0x524a4d[_0xe164('0x17')]){if(_0x524a4d[_0xe164('0x17')][_0xe164('0x18')]===0x1f4){logger[_0xe164('0x17')](_0xe164('0x19'),_0x3166a3,_0x524a4d[_0xe164('0x17')][_0xe164('0x1a')]);return _0x1a827f(_0x524a4d[_0xe164('0x17')][_0xe164('0x1a')]);}logger[_0xe164('0x17')](_0xe164('0x19'),_0x3166a3,_0x524a4d[_0xe164('0x17')][_0xe164('0x1a')]);return _0x67d01(_0x524a4d[_0xe164('0x17')]['message']);}else{logger[_0xe164('0x13')](_0xe164('0x19'),_0x3166a3,_0xe164('0x14'));_0x67d01(_0x524a4d['result'][_0xe164('0x1a')]);}})['catch'](function(_0x48c891){logger[_0xe164('0x17')](_0xe164('0x19'),_0x3166a3,_0x48c891);_0x1a827f(_0x48c891);});});}function respondWithResult(_0x152071,_0x1a82a6){_0x1a82a6=_0x1a82a6||0xc8;return function(_0x36f6fa){if(_0x36f6fa){return _0x152071['status'](_0x1a82a6)[_0xe164('0x1b')](_0x36f6fa);}};}function respondWithFilteredResult(_0x304f70,_0x421bfa){return function(_0x2bd0cb){if(_0x2bd0cb){var _0x163bd3=typeof _0x421bfa[_0xe164('0x1c')]==='undefined'&&typeof _0x421bfa['limit']==='undefined';var _0x3a710b=_0x2bd0cb[_0xe164('0x1d')];var _0x405d4a=_0x163bd3?0x0:_0x421bfa['offset'];var _0x3f3eb2=_0x163bd3?_0x2bd0cb['count']:_0x421bfa[_0xe164('0x1c')]+_0x421bfa[_0xe164('0x1e')];var _0x1f3a03;if(_0x3f3eb2>=_0x3a710b){_0x3f3eb2=_0x3a710b;_0x1f3a03=0xc8;}else{_0x1f3a03=0xce;}_0x304f70[_0xe164('0x1f')](_0x1f3a03);return _0x304f70['set'](_0xe164('0x20'),_0x405d4a+'-'+_0x3f3eb2+'/'+_0x3a710b)['json'](_0x2bd0cb);}return null;};}function saveUpdates(_0x1589a3){return function(_0x23c51b){if(_0x23c51b){return _0x23c51b[_0xe164('0x21')](_0x1589a3)[_0xe164('0x12')](function(_0x27166d){return _0x27166d;});}return null;};}function removeEntity(_0x24bfb3){return function(_0x33ff9e){if(_0x33ff9e){return _0x33ff9e[_0xe164('0x22')]()[_0xe164('0x12')](function(){_0x24bfb3[_0xe164('0x1f')](0xcc)[_0xe164('0x23')]();});}};}function handleEntityNotFound(_0x34a686){return function(_0x2209d5){if(!_0x2209d5){_0x34a686[_0xe164('0x24')](0x194);}return _0x2209d5;};}function handleError(_0x296587,_0x353ea){_0x353ea=_0x353ea||0x1f4;return function(_0x3dc768){logger['error'](_0x3dc768['stack']);if(_0x3dc768[_0xe164('0x25')]){delete _0x3dc768[_0xe164('0x25')];}_0x296587['status'](_0x353ea)[_0xe164('0x26')](_0x3dc768);};}exports[_0xe164('0x27')]=function(_0x7f261e,_0x38e133){var _0x3a794b={},_0x335b48={},_0x59b5f7={'count':0x0,'rows':[]};var _0x574054=_[_0xe164('0x28')](db[_0xe164('0x29')][_0xe164('0x2a')],function(_0x3cc514){return{'name':_0x3cc514[_0xe164('0x2b')],'type':_0x3cc514[_0xe164('0x2c')]['key']};});_0x335b48[_0xe164('0x2d')]=_[_0xe164('0x28')](_0x574054,'name');_0x335b48[_0xe164('0x2e')]=_[_0xe164('0x2f')](_0x7f261e[_0xe164('0x2e')]);_0x335b48[_0xe164('0x30')]=_[_0xe164('0x31')](_0x335b48[_0xe164('0x2d')],_0x335b48[_0xe164('0x2e')]);_0x3a794b[_0xe164('0x32')]=_[_0xe164('0x31')](_0x335b48[_0xe164('0x2d')],qs[_0xe164('0x33')](_0x7f261e['query']['fields']));_0x3a794b[_0xe164('0x32')]=_0x3a794b[_0xe164('0x32')]['length']?_0x3a794b[_0xe164('0x32')]:_0x335b48['model'];if(!_0x7f261e[_0xe164('0x2e')][_0xe164('0x34')]('nolimit')){_0x3a794b[_0xe164('0x1e')]=qs[_0xe164('0x1e')](_0x7f261e[_0xe164('0x2e')]['limit']);_0x3a794b[_0xe164('0x1c')]=qs[_0xe164('0x1c')](_0x7f261e[_0xe164('0x2e')][_0xe164('0x1c')]);}_0x3a794b[_0xe164('0x35')]=qs[_0xe164('0x36')](_0x7f261e['query'][_0xe164('0x36')]);_0x3a794b[_0xe164('0x37')]=qs[_0xe164('0x30')](_[_0xe164('0x38')](_0x7f261e[_0xe164('0x2e')],_0x335b48[_0xe164('0x30')]),_0x574054);if(_0x7f261e['query'][_0xe164('0x39')]){_0x3a794b[_0xe164('0x37')]=_[_0xe164('0x3a')](_0x3a794b[_0xe164('0x37')],{'$or':_[_0xe164('0x28')](_0x574054,function(_0x143638){if(_0x143638['type']!==_0xe164('0x3b')){var _0x49bd1f={};_0x49bd1f[_0x143638[_0xe164('0x25')]]={'$like':'%'+_0x7f261e[_0xe164('0x2e')][_0xe164('0x39')]+'%'};return _0x49bd1f;}})});}_0x3a794b=_[_0xe164('0x3a')]({},_0x3a794b,_0x7f261e[_0xe164('0x3c')]);var _0x513b1f={'where':_0x3a794b['where']};return db['MailMessage'][_0xe164('0x1d')](_0x513b1f)[_0xe164('0x12')](function(_0x43bff4){_0x59b5f7['count']=_0x43bff4;if(_0x7f261e['query'][_0xe164('0x3d')]){_0x3a794b[_0xe164('0x3e')]=[{'all':!![]}];}return db[_0xe164('0x29')][_0xe164('0x3f')](_0x3a794b);})[_0xe164('0x12')](function(_0x599d31){_0x59b5f7['rows']=_0x599d31;return _0x59b5f7;})[_0xe164('0x12')](respondWithFilteredResult(_0x38e133,_0x3a794b))[_0xe164('0x40')](handleError(_0x38e133,null));};exports[_0xe164('0x41')]=function(_0x127fbe,_0x4f598b){var _0x5e2d1b={'raw':!![],'where':{'id':_0x127fbe[_0xe164('0x42')]['id']}},_0x105a63={};_0x105a63[_0xe164('0x2d')]=_[_0xe164('0x2f')](db[_0xe164('0x29')][_0xe164('0x2a')]);_0x105a63[_0xe164('0x2e')]=_[_0xe164('0x2f')](_0x127fbe['query']);_0x105a63[_0xe164('0x30')]=_[_0xe164('0x31')](_0x105a63['model'],_0x105a63[_0xe164('0x2e')]);_0x5e2d1b[_0xe164('0x32')]=_[_0xe164('0x31')](_0x105a63['model'],qs[_0xe164('0x33')](_0x127fbe[_0xe164('0x2e')][_0xe164('0x33')]));_0x5e2d1b[_0xe164('0x32')]=_0x5e2d1b['attributes']['length']?_0x5e2d1b['attributes']:_0x105a63['model'];if(_0x127fbe[_0xe164('0x2e')][_0xe164('0x3d')]){_0x5e2d1b[_0xe164('0x3e')]=[{'all':!![]}];}_0x5e2d1b=_['merge']({},_0x5e2d1b,_0x127fbe[_0xe164('0x3c')]);return db[_0xe164('0x29')][_0xe164('0x43')](_0x5e2d1b)[_0xe164('0x12')](handleEntityNotFound(_0x4f598b,null))[_0xe164('0x12')](respondWithResult(_0x4f598b,null))[_0xe164('0x40')](handleError(_0x4f598b,null));};exports[_0xe164('0x21')]=function(_0xc1bae3,_0x495023){if(_0xc1bae3[_0xe164('0x44')]['id']){delete _0xc1bae3[_0xe164('0x44')]['id'];}return db[_0xe164('0x29')][_0xe164('0x43')]({'where':{'id':_0xc1bae3['params']['id']}})[_0xe164('0x12')](handleEntityNotFound(_0x495023,null))[_0xe164('0x12')](saveUpdates(_0xc1bae3[_0xe164('0x44')],null))[_0xe164('0x12')](respondWithResult(_0x495023,null))[_0xe164('0x40')](handleError(_0x495023,null));};exports[_0xe164('0x22')]=function(_0x43ec18,_0x519930){return db[_0xe164('0x29')]['find']({'where':{'id':_0x43ec18['params']['id']}})[_0xe164('0x12')](handleEntityNotFound(_0x519930,null))[_0xe164('0x12')](removeEntity(_0x519930,null))[_0xe164('0x40')](handleError(_0x519930,null));};exports[_0xe164('0x45')]=function(_0x45acef,_0x567cd2){return db[_0xe164('0x29')][_0xe164('0x45')]()[_0xe164('0x12')](respondWithResult(_0x567cd2,null))[_0xe164('0x40')](handleError(_0x567cd2,null));};exports[_0xe164('0x46')]=function(_0x348741,_0x3f26f9){return db['MailMessage'][_0xe164('0x46')](_0x348741[_0xe164('0x44')])[_0xe164('0x12')](function(_0x1e095a){if(_0x1e095a){if(_0x1e095a[_0xe164('0x47')]==='out'&&!_0x1e095a[_0xe164('0x48')]){var _0x24ae28,_0x430716,_0x18677b;if(_0x348741[_0xe164('0x44')]['to']){_0x430716=_0x348741['body']['to'][_0xe164('0x49')](',')[0x0];}return db['MailAccount'][_0xe164('0x4a')]({'where':{'id':_0x1e095a[_0xe164('0x4b')]},'include':[{'model':db['CmList'],'as':_0xe164('0x4c'),'include':[{'model':db[_0xe164('0x4d')],'as':'Contacts','where':{'email':_0x430716},'limit':0x1,'order':[['updatedAt',_0xe164('0x4e')]]}]},{'model':db[_0xe164('0x4f')],'as':_0xe164('0x50'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xe164('0x51'),'raw':!![]}]}]})[_0xe164('0x12')](function(_0x318f79){_0x24ae28=_0x318f79;if(!_0x24ae28||!_0x24ae28[_0xe164('0x50')])return;var _0x368e6e=_0x24ae28[_0xe164('0x52')]();if(_0x348741['body']['attachments']&&_0x348741[_0xe164('0x44')][_0xe164('0x53')]['length']){for(var _0x32afd4=0x0;_0x32afd4<_0x348741[_0xe164('0x44')][_0xe164('0x53')][_0xe164('0x54')];_0x32afd4+=0x1){_0x348741[_0xe164('0x44')][_0xe164('0x53')][_0x32afd4]={'filename':_0x348741['body']['attachments'][_0x32afd4]['name'],'path':path['join'](config[_0xe164('0x55')],_0xe164('0x56'),_0x348741[_0xe164('0x44')][_0xe164('0x53')][_0x32afd4][_0xe164('0x57')])};}}_0x18677b={'account':_0x368e6e,'message':_0x348741[_0xe164('0x44')]};return;})[_0xe164('0x12')](function(){if(_0x24ae28[_0xe164('0x4c')]){if(_0x24ae28[_0xe164('0x4c')][_0xe164('0x58')][_0xe164('0x54')]){return _0x24ae28[_0xe164('0x4c')][_0xe164('0x58')][0x0];}else{return db[_0xe164('0x4d')]['create'](_[_0xe164('0x59')](_0x348741[_0xe164('0x44')],{'firstName':_0x348741[_0xe164('0x44')]['to'],'email':_0x348741[_0xe164('0x44')]['to'],'phone':_0x348741['body']['to'],'ListId':_0x24ae28[_0xe164('0x5a')]}));}}else{throw new Error(_0xe164('0x5b'));}})[_0xe164('0x12')](function(){if(_0x18677b){return respondWithRpcPromise('SendMail','sendMail',_0x18677b,client9003)['then'](function(_0x31bc01){return _0x1e095a[_0xe164('0x21')]({'read':!![],'messageId':_0x31bc01[_0xe164('0x5c')],'sentAt':moment()['format'](_0xe164('0x5d'))});})[_0xe164('0x40')](function(_0x4d6556){logger[_0xe164('0x17')]('%s',JSON[_0xe164('0x16')](_0x4d6556));return _0x1e095a;});}return _0x1e095a;});}return _0x1e095a;}})[_0xe164('0x12')](respondWithResult(_0x3f26f9,0xc9))[_0xe164('0x40')](handleError(_0x3f26f9,null));};exports[_0xe164('0x5e')]=function(_0x5ddb1c,_0x29d721){var _0x3436d0={'agent':{},'channel':_0xe164('0x5f')};if(_0x5ddb1c[_0xe164('0x44')]['id']){delete _0x5ddb1c['body']['id'];}_0x5ddb1c[_0xe164('0x44')][_0xe164('0x60')]=!![];_0x5ddb1c[_0xe164('0x44')][_0xe164('0x61')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5ddb1c['body'][_0xe164('0x62')]=_0x5ddb1c[_0xe164('0x44')][_0xe164('0x62')]||_0x5ddb1c['user']['id'];_0x3436d0[_0xe164('0x63')]['id']=_0x5ddb1c[_0xe164('0x44')][_0xe164('0x62')];return db['MailMessage']['find']({'where':{'id':_0x5ddb1c['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x29d721,null))[_0xe164('0x12')](saveUpdates(_0x5ddb1c[_0xe164('0x44')],null))[_0xe164('0x12')](function(_0x37a7f9){if(_0x37a7f9){_0x3436d0[_0xe164('0x1a')]=_0x37a7f9[_0xe164('0x64')]({'plain':!![]});return db[_0xe164('0x65')]['find']({'where':{'id':_0x37a7f9[_0xe164('0x66')]}});}return null;})[_0xe164('0x12')](handleEntityNotFound(_0x29d721,null))[_0xe164('0x12')](function(_0x4e09f3){if(_0x4e09f3){return _0x4e09f3[_0xe164('0x21')]({'UserId':_0x5ddb1c[_0xe164('0x44')]['UserId'],'read1stAt':_[_0xe164('0x67')](_0x4e09f3[_0xe164('0x68')])?moment()[_0xe164('0x69')](_0xe164('0x5d')):undefined});}return null;})['then'](function(_0x350cb6){if(_0x350cb6){_0x3436d0[_0xe164('0x6a')]=_0x350cb6[_0xe164('0x64')]({'plain':!![]});interaction_log['info'](_0xe164('0x6b'),_0x5ddb1c[_0xe164('0x6c')]['id'],_0x5ddb1c[_0xe164('0x6c')]['name'],_0x5ddb1c[_0xe164('0x6c')][_0xe164('0x6d')],_0x3436d0[_0xe164('0x6a')]['id'],_0x5ddb1c[_0xe164('0x44')]?JSON['stringify'](_0x5ddb1c['body']):_0xe164('0x6e'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x3436d0);}return null;})[_0xe164('0x12')](function(_0x4dc08c){var _0x3102c4=_0xe164('0x6f')+_0x4dc08c[_0xe164('0x1a')]['ContactId'];return db['sequelize']['query'](_0x3102c4,{'type':db[_0xe164('0x70')][_0xe164('0x71')][_0xe164('0x72')],'raw':!![]})[_0xe164('0x12')](function(_0x3d5765){return _0x3d5765;});})[_0xe164('0x12')](function(_0x477cfe){if(_0x477cfe){_0x3436d0['message']['contact']=_0x477cfe[0x0];if(!_0x5ddb1c['body'][_0xe164('0x62')])return;return db[_0xe164('0x73')][_0xe164('0x43')]({'where':{'id':_0x5ddb1c[_0xe164('0x44')][_0xe164('0x62')],'role':'agent'},'attributes':['id',_0xe164('0x25'),_0xe164('0x74'),_0xe164('0x75'),'internal'],'raw':!![]});}return null;})['then'](function(_0x5d4a80){if(!_0x5d4a80)return null;_0x3436d0[_0xe164('0x1a')][_0xe164('0x63')]=_0x5d4a80;return _0x3436d0;})[_0xe164('0x12')](function(_0x102e45){if(_0x102e45){if(_0x5ddb1c['body'][_0xe164('0x76')]){_0x3436d0['message'][_0xe164('0x77')]=util['format']('SIP/%s',_0x5ddb1c[_0xe164('0x6c')][_0xe164('0x25')]);_0x3436d0[_0xe164('0x1a')][_0xe164('0x78')]=_0x3436d0[_0xe164('0x78')];_0x3436d0[_0xe164('0x1a')][_0xe164('0x79')]=_0x3436d0[_0xe164('0x78')];_0x3436d0[_0xe164('0x1a')][_0xe164('0x7a')]='accept';_0x3436d0['message'][_0xe164('0x44')]=htmlToText[_0xe164('0x7b')](_0x3436d0[_0xe164('0x1a')][_0xe164('0x44')]);return respondWithRpcPromise(_0xe164('0x7c'),_0xe164('0x7c'),{'event':_0xe164('0x7d'),'message':_0x3436d0[_0xe164('0x1a')]},client9002)[_0xe164('0x12')](function(){return _0x3436d0;});}return _0x3436d0;}return null;})[_0xe164('0x12')](respondWithResult(_0x29d721,null))[_0xe164('0x40')](handleError(_0x29d721,null));};exports[_0xe164('0x7e')]=function(_0x303165,_0x3ccebf){var _0x38ac3b={'agent':{},'channel':_0xe164('0x5f')};if(_0x303165[_0xe164('0x44')]['id']){delete _0x303165[_0xe164('0x44')]['id'];}_0x303165['body'][_0xe164('0x62')]=_0x303165[_0xe164('0x44')][_0xe164('0x62')]||_0x303165[_0xe164('0x6c')]['id'];_0x38ac3b[_0xe164('0x63')]['id']=_0x303165[_0xe164('0x44')][_0xe164('0x62')];return db[_0xe164('0x29')]['find']({'where':{'id':_0x303165[_0xe164('0x42')]['id'],'UserId':null}})[_0xe164('0x12')](handleEntityNotFound(_0x3ccebf,null))[_0xe164('0x12')](function(_0x110a15){if(_0x110a15){_0x38ac3b[_0xe164('0x1a')]=_0x110a15[_0xe164('0x64')]({'plain':!![]});return db[_0xe164('0x65')][_0xe164('0x43')]({'where':{'id':_0x110a15[_0xe164('0x66')]}});}return null;})[_0xe164('0x12')](handleEntityNotFound(_0x3ccebf,null))[_0xe164('0x12')](function(_0x10b492){if(_0x10b492){_0x38ac3b[_0xe164('0x6a')]=_0x10b492[_0xe164('0x64')]({'plain':!![]});interaction_log[_0xe164('0x13')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x303165['user']['id'],_0x303165[_0xe164('0x6c')][_0xe164('0x25')],_0x303165[_0xe164('0x6c')][_0xe164('0x6d')],_0x38ac3b['interaction']['id'],_0x303165[_0xe164('0x44')]?JSON['stringify'](_0x303165[_0xe164('0x44')]):_0xe164('0x6e'));return respondWithRpcPromise('RejectMessage',_0xe164('0x7f'),_0x38ac3b);}return null;})[_0xe164('0x12')](function(_0x5591ba){var _0x4af695=_0xe164('0x6f')+_0x5591ba[_0xe164('0x1a')]['ContactId'];return db[_0xe164('0x80')][_0xe164('0x2e')](_0x4af695,{'type':db[_0xe164('0x70')]['QueryTypes']['SELECT'],'raw':!![]})[_0xe164('0x12')](function(_0x8192d0){return _0x8192d0;});})[_0xe164('0x12')](function(_0x145ac7){if(_0x145ac7){_0x38ac3b[_0xe164('0x1a')][_0xe164('0x81')]=_0x145ac7[0x0];if(!_0x303165['body'][_0xe164('0x62')])return;return db[_0xe164('0x73')][_0xe164('0x43')]({'where':{'id':_0x303165[_0xe164('0x44')]['UserId'],'role':_0xe164('0x63')},'attributes':['id',_0xe164('0x25'),_0xe164('0x74'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x534c14){if(!_0x534c14)return null;_0x38ac3b[_0xe164('0x1a')][_0xe164('0x63')]=_0x534c14;return _0x38ac3b;})[_0xe164('0x12')](function(_0x1aa787){if(_0x1aa787){_0x1aa787[_0xe164('0x1a')][_0xe164('0x77')]=util[_0xe164('0x69')](_0xe164('0x82'),_0x303165[_0xe164('0x6c')][_0xe164('0x25')]);_0x1aa787[_0xe164('0x1a')]['channel']=_0x38ac3b[_0xe164('0x78')];_0x1aa787[_0xe164('0x1a')][_0xe164('0x79')]=_0x38ac3b[_0xe164('0x78')];_0x1aa787[_0xe164('0x1a')][_0xe164('0x7a')]=_0xe164('0x7e');_0x1aa787['message']['body']=htmlToText[_0xe164('0x7b')](_0x38ac3b[_0xe164('0x1a')]['body']);respondWithRpcPromise(_0xe164('0x7c'),'EventManager',{'event':_0xe164('0x83'),'message':_0x1aa787[_0xe164('0x1a')]},client9002);return _0x38ac3b;}return null;})['then'](respondWithResult(_0x3ccebf,null))['catch'](handleError(_0x3ccebf,null));};exports['download']=function(_0x1f0faa,_0x276a62){var _0x42a9ca=moment()['unix']()[_0xe164('0x84')]();var _0x24dc21=path['join'](config[_0xe164('0x55')],_0xe164('0x85'),_0xe164('0x86'),_0xe164('0x87'));var _0x1dc757=path[_0xe164('0x88')](config['root'],_0xe164('0x85'),_0xe164('0x86'),'attachments');var _0x4ad759=util['format'](_0xe164('0x89'),_0x42a9ca);return db[_0xe164('0x29')][_0xe164('0x43')]({'where':{'id':_0x1f0faa[_0xe164('0x42')]['id']},'attributes':['id','body',_0xe164('0x8a'),'to','cc',_0xe164('0x8b'),_0xe164('0x8c'),_0xe164('0x8d')],'include':_0x1f0faa[_0xe164('0x2e')][_0xe164('0x53')]?[{'model':db[_0xe164('0x8e')],'as':_0xe164('0x8f')}]:undefined})['then'](handleEntityNotFound(_0x276a62,null))[_0xe164('0x12')](function(_0x26ae88){if(_0x26ae88){var _0xaa8c12=_0x26ae88;var _0xf8f16e={'from':_0xaa8c12[_0xe164('0x8a')],'to':_0xaa8c12['to'],'subject':_0xaa8c12[_0xe164('0x8c')],'html':htmlEntities[_0xe164('0x90')](_0xaa8c12[_0xe164('0x44')]),'headers':{'Date':moment(_0xaa8c12[_0xe164('0x8d')])[_0xe164('0x69')](_0xe164('0x91'))},'attachments':[]};if(_0x26ae88['cc']){_0xf8f16e[_0xe164('0x92')]['Cc']=_0x26ae88['cc'];}if(_0x26ae88[_0xe164('0x8b')]){_0xf8f16e[_0xe164('0x92')][_0xe164('0x93')]=_0x26ae88[_0xe164('0x8b')];}return new BPromise(function(_0x327643,_0x15a33f){if(_0x26ae88['Attachments']){for(var _0x3e9335=0x0;_0x3e9335<_0x26ae88[_0xe164('0x8f')][_0xe164('0x54')];_0x3e9335++){var _0x56d29a=_0x26ae88[_0xe164('0x8f')][_0x3e9335];var _0x27026e=path[_0xe164('0x88')](_0x1dc757,_0x56d29a[_0xe164('0x57')]);if(fs['existsSync'](_0x27026e)){_0xf8f16e[_0xe164('0x53')][_0xe164('0x94')]({'name':_0x56d29a[_0xe164('0x25')],'contentType':_0x56d29a['type'],'data':fs[_0xe164('0x95')](_0x27026e)});}}}emlformat[_0xe164('0x96')](_0xf8f16e,function(_0x1ab19a,_0x3eece4){if(_0x1ab19a)return _0x15a33f(_0x1ab19a);fs[_0xe164('0x97')](path[_0xe164('0x88')](_0x24dc21,_0x4ad759),_0x3eece4);return _0x327643(_0x3eece4);});});}})[_0xe164('0x12')](function(_0x4c57d6){if(_0x4c57d6){return _0x276a62[_0xe164('0x98')](path[_0xe164('0x88')](_0x24dc21,_0x4ad759),_0x4ad759,function(_0x3689b7){if(!_0x3689b7)fs['unlinkSync'](path[_0xe164('0x88')](_0x24dc21,_0x4ad759));});}})[_0xe164('0x40')](handleError(_0x276a62,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index fa8b8a1..1e4dff6 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 _0x6663=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x6663,0x8e));var _0x3666=function(_0x507403,_0x3f954d){_0x507403=_0x507403-0x0;var _0x1327c=_0x6663[_0x507403];return _0x1327c;};'use strict';var EventEmitter=require(_0x3666('0x0'));var MailMessage=require(_0x3666('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x3666('0x2')](0x0);var events={'afterCreate':_0x3666('0x3'),'afterUpdate':_0x3666('0x4'),'afterDestroy':_0x3666('0x5')};function emitEvent(_0x10e00d){return function(_0x10bf07,_0xfd3889,_0x34ccca){MailMessageEvents[_0x3666('0x6')](_0x10e00d+':'+_0x10bf07['id'],_0x10bf07);MailMessageEvents[_0x3666('0x6')](_0x10e00d,_0x10bf07);_0x34ccca(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x3666('0x7')](e,emitEvent(event));}}module[_0x3666('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x879a=['../../mysqldb','MailMessage','remove','exports'];(function(_0x5943f2,_0x215a15){var _0x117091=function(_0x552455){while(--_0x552455){_0x5943f2['push'](_0x5943f2['shift']());}};_0x117091(++_0x215a15);}(_0x879a,0x184));var _0xa879=function(_0x5864d7,_0x3210f5){_0x5864d7=_0x5864d7-0x0;var _0x4468c4=_0x879a[_0x5864d7];return _0x4468c4;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xa879('0x0'))['db'][_0xa879('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa879('0x2')};function emitEvent(_0x230fdb){return function(_0x2cabde,_0x50b48a,_0x4231bf){MailMessageEvents['emit'](_0x230fdb+':'+_0x2cabde['id'],_0x2cabde);MailMessageEvents['emit'](_0x230fdb,_0x2cabde);_0x4231bf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xa879('0x3')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 8e4e9b9..00e0663 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 _0x246e=['define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','body','plainBody','fromString','models','get','direction','toLowerCase','UserId','MailInteraction','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','exports'];(function(_0x5ed058,_0x543469){var _0x2a0c3e=function(_0x1646c4){while(--_0x1646c4){_0x5ed058['push'](_0x5ed058['shift']());}};_0x2a0c3e(++_0x543469);}(_0x246e,0x161));var _0xe246=function(_0x84d51b,_0x35d67f){_0x84d51b=_0x84d51b-0x0;var _0x44eb6f=_0x246e[_0x84d51b];return _0x44eb6f;};'use strict';var _=require('lodash');var util=require(_0xe246('0x0'));var logger=require(_0xe246('0x1'))('api');var moment=require(_0xe246('0x2'));var BPromise=require(_0xe246('0x3'));var rp=require(_0xe246('0x4'));var htmlToText=require(_0xe246('0x5'));var fs=require('fs');var path=require(_0xe246('0x6'));var rimraf=require(_0xe246('0x7'));var config=require(_0xe246('0x8'));var attributes=require('./mailMessage.attributes');module[_0xe246('0x9')]=function(_0x540dce,_0x293dec){return _0x540dce[_0xe246('0xa')](_0xe246('0xb'),attributes,{'tableName':_0xe246('0xc'),'paranoid':![],'indexes':[{'name':_0xe246('0xd'),'fields':[_0xe246('0xd')]},{'name':_0xe246('0xe'),'fields':['plainBody',_0xe246('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3a1b13,_0x47d169,_0x2b7a0a){if(_0x3a1b13[_0xe246('0x10')]){_0x3a1b13[_0xe246('0x11')]=htmlToText[_0xe246('0x12')](_0x3a1b13[_0xe246('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2b7a0a(null,_0x47d169);},'afterCreate':function(_0x2e0f58,_0x1840bd,_0xe76b72){var _0x43267b=_0x540dce[_0xe246('0x13')];var _0x4695a2=_0x2e0f58[_0xe246('0x14')]({'plain':!![]});if(_0x4695a2['direction']['toLowerCase']()==='in'||_0x4695a2[_0xe246('0x15')][_0xe246('0x16')]()==='out'&&!_0x4695a2['secret']&&!_['isNil'](_0x4695a2[_0xe246('0x17')])){_0x43267b[_0xe246('0x18')]['findOne']({'where':{'id':_0x4695a2[_0xe246('0x19')]}})[_0xe246('0x1a')](function(_0xb2e48b){if(_0xb2e48b){_0xb2e48b[_0xe246('0x1b')]({'lastMsgAt':_0x4695a2[_0xe246('0x1c')],'lastMsgDirection':_0x4695a2[_0xe246('0x15')]['toLowerCase']()});}})[_0xe246('0x1d')](function(_0x3c86e9){console[_0xe246('0x1e')](_0x3c86e9);});}_0xe76b72();}},'charset':_0xe246('0x1f'),'collate':_0xe246('0x20')});}; \ No newline at end of file +var _0x969c=['request-promise','html-to-text','path','rimraf','exports','MailMessage','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','body','plainBody','fromString','models','get','toLowerCase','out','secret','isNil','UserId','findOne','MailInteractionId','then','createdAt','direction','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1a6f2c,_0x54c291){var _0x3b5efb=function(_0x1e6f35){while(--_0x1e6f35){_0x1a6f2c['push'](_0x1a6f2c['shift']());}};_0x3b5efb(++_0x54c291);}(_0x969c,0xc6));var _0xc969=function(_0x2caf23,_0x2294a3){_0x2caf23=_0x2caf23-0x0;var _0x5ec124=_0x969c[_0x2caf23];return _0x5ec124;};'use strict';var _=require(_0xc969('0x0'));var util=require(_0xc969('0x1'));var logger=require(_0xc969('0x2'))(_0xc969('0x3'));var moment=require(_0xc969('0x4'));var BPromise=require(_0xc969('0x5'));var rp=require(_0xc969('0x6'));var htmlToText=require(_0xc969('0x7'));var fs=require('fs');var path=require(_0xc969('0x8'));var rimraf=require(_0xc969('0x9'));var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module[_0xc969('0xa')]=function(_0x50f383,_0x3f4b68){return _0x50f383['define'](_0xc969('0xb'),attributes,{'tableName':_0xc969('0xc'),'paranoid':![],'indexes':[{'name':_0xc969('0xd'),'fields':[_0xc969('0xd')]},{'name':_0xc969('0xe'),'fields':['plainBody',_0xc969('0xf')],'type':_0xc969('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5bd966,_0x33911e,_0x40aa1f){if(_0x5bd966[_0xc969('0x11')]){_0x5bd966[_0xc969('0x12')]=htmlToText[_0xc969('0x13')](_0x5bd966[_0xc969('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x40aa1f(null,_0x33911e);},'afterCreate':function(_0x5ab521,_0x202056,_0x34c39d){var _0x3df007=_0x50f383[_0xc969('0x14')];var _0x1c2be4=_0x5ab521[_0xc969('0x15')]({'plain':!![]});if(_0x1c2be4['direction'][_0xc969('0x16')]()==='in'||_0x1c2be4['direction']['toLowerCase']()===_0xc969('0x17')&&!_0x1c2be4[_0xc969('0x18')]&&!_[_0xc969('0x19')](_0x1c2be4[_0xc969('0x1a')])){_0x3df007['MailInteraction'][_0xc969('0x1b')]({'where':{'id':_0x1c2be4[_0xc969('0x1c')]}})[_0xc969('0x1d')](function(_0x3f6064){if(_0x3f6064){_0x3f6064['update']({'lastMsgAt':_0x1c2be4[_0xc969('0x1e')],'lastMsgDirection':_0x1c2be4[_0xc969('0x1f')]['toLowerCase']()});}})['catch'](function(_0x27f5a7){console[_0xc969('0x20')](_0x27f5a7);});}_0x34c39d();}},'charset':'utf8mb4','collate':_0xc969('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 3e006a0..e85ccb3 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 _0xb62e=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','options','raw','lodash','util'];(function(_0x30c539,_0x41b851){var _0x4a342c=function(_0x5c0b49){while(--_0x5c0b49){_0x30c539['push'](_0x30c539['shift']());}};_0x4a342c(++_0x41b851);}(_0xb62e,0x1de));var _0xeb62=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb62e[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var moment=require(_0xeb62('0x2'));var BPromise=require(_0xeb62('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb62('0x4'));var db=require(_0xeb62('0x5'))['db'];var utils=require(_0xeb62('0x6'));var logger=require(_0xeb62('0x7'))(_0xeb62('0x8'));var config=require(_0xeb62('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb62('0xa')][_0xeb62('0xb')]({'port':0x232a});config[_0xeb62('0xc')]=_['defaults'](config[_0xeb62('0xc')],{'host':_0xeb62('0xd'),'port':0x18eb});var socket=require(_0xeb62('0xe'))(new Redis(config[_0xeb62('0xc')]));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0x4693c9,_0x40584b,_0x6d5e94){return new BPromise(function(_0xf93c21,_0x2fe923){return client[_0xeb62('0xf')](_0x4693c9,_0x6d5e94)[_0xeb62('0x10')](function(_0x3a826a){logger[_0xeb62('0x11')](_0xeb62('0x12'),_0x40584b,'request\x20sent');logger[_0xeb62('0x13')](_0xeb62('0x14'),_0x40584b,_0xeb62('0x15'),JSON[_0xeb62('0x16')](_0x3a826a));if(_0x3a826a['error']){if(_0x3a826a[_0xeb62('0x17')][_0xeb62('0x18')]===0x1f4){logger[_0xeb62('0x17')]('MailMessage,\x20%s,\x20%s',_0x40584b,_0x3a826a[_0xeb62('0x17')][_0xeb62('0x19')]);return _0x2fe923(_0x3a826a[_0xeb62('0x17')]['message']);}logger[_0xeb62('0x17')](_0xeb62('0x12'),_0x40584b,_0x3a826a[_0xeb62('0x17')][_0xeb62('0x19')]);return _0xf93c21(_0x3a826a[_0xeb62('0x17')][_0xeb62('0x19')]);}else{logger[_0xeb62('0x11')](_0xeb62('0x12'),_0x40584b,_0xeb62('0x15'));_0xf93c21(_0x3a826a[_0xeb62('0x1a')][_0xeb62('0x19')]);}})[_0xeb62('0x1b')](function(_0x3cdf76){logger['error'](_0xeb62('0x12'),_0x40584b,_0x3cdf76);_0x2fe923(_0x3cdf76);});});}exports[_0xeb62('0x1c')]=function(_0x332396){var _0xb44905=this;return new Promise(function(_0x425817,_0x24cbf3){return db[_0xeb62('0x1d')]['create'](_0x332396['body'],{'raw':_0x332396[_0xeb62('0x1e')]?_0x332396[_0xeb62('0x1e')][_0xeb62('0x1f')]===undefined?!![]:![]:!![]})[_0xeb62('0x10')](function(_0x122b15){logger['info']('CreateMailMessage',_0x332396);logger[_0xeb62('0x13')](_0xeb62('0x1c'),_0x332396,JSON[_0xeb62('0x16')](_0x122b15));_0x425817(_0x122b15);})[_0xeb62('0x1b')](function(_0x55a169){logger['error'](_0xeb62('0x1c'),_0x55a169['message'],_0x332396);_0x24cbf3(_0xb44905[_0xeb62('0x17')](0x1f4,_0x55a169['message']));});});}; \ No newline at end of file +var _0x6cb4=['result','catch','CreateMailMessage','MailMessage','create','body','options','raw','info','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','MailMessage,\x20%s,\x20%s','message'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6cb4,0xff));var _0x46cb=function(_0x40824d,_0x17585e){_0x40824d=_0x40824d-0x0;var _0x1e1bb9=_0x6cb4[_0x40824d];return _0x1e1bb9;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rs=require(_0x46cb('0x4'));var fs=require('fs');var Redis=require(_0x46cb('0x5'));var db=require(_0x46cb('0x6'))['db'];var utils=require(_0x46cb('0x7'));var logger=require(_0x46cb('0x8'))('rpc');var config=require(_0x46cb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46cb('0xa')]['http']({'port':0x232a});config[_0x46cb('0xb')]=_[_0x46cb('0xc')](config[_0x46cb('0xb')],{'host':_0x46cb('0xd'),'port':0x18eb});var socket=require(_0x46cb('0xe'))(new Redis(config[_0x46cb('0xb')]));require('./mailMessage.socket')[_0x46cb('0xf')](socket);function respondWithRpcPromise(_0x34f9e9,_0x48101c,_0x206f10){return new BPromise(function(_0x106a87,_0x4a60b2){return client[_0x46cb('0x10')](_0x34f9e9,_0x206f10)[_0x46cb('0x11')](function(_0x570cfd){logger['info']('MailMessage,\x20%s,\x20%s',_0x48101c,_0x46cb('0x12'));logger[_0x46cb('0x13')](_0x46cb('0x14'),_0x48101c,_0x46cb('0x12'),JSON['stringify'](_0x570cfd));if(_0x570cfd[_0x46cb('0x15')]){if(_0x570cfd[_0x46cb('0x15')][_0x46cb('0x16')]===0x1f4){logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0x570cfd[_0x46cb('0x15')][_0x46cb('0x18')]);return _0x4a60b2(_0x570cfd[_0x46cb('0x15')][_0x46cb('0x18')]);}logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0x570cfd['error'][_0x46cb('0x18')]);return _0x106a87(_0x570cfd['error'][_0x46cb('0x18')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x48101c,'request\x20sent');_0x106a87(_0x570cfd[_0x46cb('0x19')][_0x46cb('0x18')]);}})[_0x46cb('0x1a')](function(_0xcc8e2){logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0xcc8e2);_0x4a60b2(_0xcc8e2);});});}exports[_0x46cb('0x1b')]=function(_0x32e9fe){var _0x90cd50=this;return new Promise(function(_0xfc9064,_0x149483){return db[_0x46cb('0x1c')][_0x46cb('0x1d')](_0x32e9fe[_0x46cb('0x1e')],{'raw':_0x32e9fe[_0x46cb('0x1f')]?_0x32e9fe[_0x46cb('0x1f')][_0x46cb('0x20')]===undefined?!![]:![]:!![]})[_0x46cb('0x11')](function(_0x41ecd2){logger[_0x46cb('0x21')](_0x46cb('0x1b'),_0x32e9fe);logger[_0x46cb('0x13')](_0x46cb('0x1b'),_0x32e9fe,JSON[_0x46cb('0x22')](_0x41ecd2));_0xfc9064(_0x41ecd2);})[_0x46cb('0x1a')](function(_0x5a1338){logger['error'](_0x46cb('0x1b'),_0x5a1338[_0x46cb('0x18')],_0x32e9fe);_0x149483(_0x90cd50[_0x46cb('0x15')](0x1f4,_0x5a1338[_0x46cb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 284da40..3a75594 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 _0xbe02=['removeListener','register','length','mailMessage:','save','remove','update','emit'];(function(_0x5dc3b6,_0xbc47f6){var _0x14d368=function(_0x566972){while(--_0x566972){_0x5dc3b6['push'](_0x5dc3b6['shift']());}};_0x14d368(++_0xbc47f6);}(_0xbe02,0x124));var _0x2be0=function(_0x2b300b,_0x43ee3d){_0x2b300b=_0x2b300b-0x0;var _0x41bc4d=_0xbe02[_0x2b300b];return _0x41bc4d;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x2be0('0x0'),_0x2be0('0x1'),_0x2be0('0x2')];function createListener(_0x51c23c,_0x499c2b){return function(_0x1d7a85){_0x499c2b[_0x2be0('0x3')](_0x51c23c,_0x1d7a85);};}function removeListener(_0x506aad,_0x1ec170){return function(){MailMessageEvents[_0x2be0('0x4')](_0x506aad,_0x1ec170);};}exports[_0x2be0('0x5')]=function(_0xa6a72f){for(var _0x35e7d8=0x0,_0x10c27b=events[_0x2be0('0x6')];_0x35e7d8<_0x10c27b;_0x35e7d8++){var _0x484f21=events[_0x35e7d8];var _0xdf1605=createListener(_0x2be0('0x7')+_0x484f21,_0xa6a72f);MailMessageEvents['on'](_0x484f21,_0xdf1605);}}; \ No newline at end of file +var _0x097c=['save','remove','emit','register','./mailMessage.events'];(function(_0x2d6813,_0x47e595){var _0x2a6c47=function(_0x4d4d75){while(--_0x4d4d75){_0x2d6813['push'](_0x2d6813['shift']());}};_0x2a6c47(++_0x47e595);}(_0x097c,0x1d5));var _0xc097=function(_0x25f28c,_0x2a2cc3){_0x25f28c=_0x25f28c-0x0;var _0x577fac=_0x097c[_0x25f28c];return _0x577fac;};'use strict';var MailMessageEvents=require(_0xc097('0x0'));var events=[_0xc097('0x1'),_0xc097('0x2'),'update'];function createListener(_0x1eb862,_0x5b478f){return function(_0x23e66a){_0x5b478f[_0xc097('0x3')](_0x1eb862,_0x23e66a);};}function removeListener(_0x5aa3c1,_0x265284){return function(){MailMessageEvents['removeListener'](_0x5aa3c1,_0x265284);};}exports[_0xc097('0x4')]=function(_0x3c9603){for(var _0x31bc9a=0x0,_0x32493e=events['length'];_0x31bc9a<_0x32493e;_0x31bc9a++){var _0x3f67a4=events[_0x31bc9a];var _0x4d95d9=createListener('mailMessage:'+_0x3f67a4,_0x3c9603);MailMessageEvents['on'](_0x3f67a4,_0x4d95d9);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index d56c1e9..5ee8708 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 _0xe25c=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','put','update','delete','removeTeams','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xe25c,0x16e));var _0xce25=function(_0x2c0b32,_0x297b94){_0x2c0b32=_0x2c0b32-0x0;var _0x2e2891=_0xe25c[_0x2c0b32];return _0x2e2891;};'use strict';var multer=require(_0xce25('0x0'));var util=require(_0xce25('0x1'));var path=require('path');var timeout=require(_0xce25('0x2'));var express=require(_0xce25('0x3'));var router=express[_0xce25('0x4')]();var fs_extra=require(_0xce25('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xce25('0x6'));var config=require(_0xce25('0x7'));var controller=require(_0xce25('0x8'));router[_0xce25('0x9')]('/',auth[_0xce25('0xa')](),controller[_0xce25('0xb')]);router['get']('/describe',auth[_0xce25('0xa')](),controller['describe']);router[_0xce25('0x9')](_0xce25('0xc'),auth[_0xce25('0xa')](),controller[_0xce25('0xd')]);router[_0xce25('0x9')](_0xce25('0xe'),auth[_0xce25('0xa')](),controller[_0xce25('0xf')]);router[_0xce25('0x9')](_0xce25('0x10'),auth['isAuthenticated'](),controller[_0xce25('0x11')]);router['get'](_0xce25('0x12'),auth['isAuthenticated'](),controller[_0xce25('0x13')]);router['post']('/',auth[_0xce25('0xa')](),controller['create']);router[_0xce25('0x14')](_0xce25('0x10'),auth[_0xce25('0xa')](),controller[_0xce25('0x15')]);router[_0xce25('0x14')](_0xce25('0x12'),auth[_0xce25('0xa')](),controller['addAgents']);router[_0xce25('0x16')](_0xce25('0xc'),auth[_0xce25('0xa')](),controller[_0xce25('0x17')]);router[_0xce25('0x18')](_0xce25('0xc'),auth[_0xce25('0xa')](),controller['destroy']);router[_0xce25('0x18')]('/:id/teams',auth[_0xce25('0xa')](),controller[_0xce25('0x19')]);router[_0xce25('0x18')]('/:id/users',auth[_0xce25('0xa')](),controller['removeAgents']);module[_0xce25('0x1a')]=router; \ No newline at end of file +var _0x5b5b=['post','create','addTeams','addAgents','update','destroy','delete','removeAgents','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x24f3b5,_0x58cf86){var _0x21b74f=function(_0x4a7127){while(--_0x4a7127){_0x24f3b5['push'](_0x24f3b5['shift']());}};_0x21b74f(++_0x58cf86);}(_0x5b5b,0x175));var _0xb5b5=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0x5b5b[_0x22b68a];return _0x1ac67a;};'use strict';var multer=require('multer');var util=require(_0xb5b5('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb5b5('0x1'));var router=express[_0xb5b5('0x2')]();var fs_extra=require(_0xb5b5('0x3'));var auth=require(_0xb5b5('0x4'));var interaction=require(_0xb5b5('0x5'));var config=require(_0xb5b5('0x6'));var controller=require('./mailQueue.controller');router[_0xb5b5('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb5b5('0x7')]('/describe',auth[_0xb5b5('0x8')](),controller[_0xb5b5('0x9')]);router['get'](_0xb5b5('0xa'),auth[_0xb5b5('0x8')](),controller[_0xb5b5('0xb')]);router[_0xb5b5('0x7')](_0xb5b5('0xc'),auth['isAuthenticated'](),controller['getMembers']);router[_0xb5b5('0x7')](_0xb5b5('0xd'),auth[_0xb5b5('0x8')](),controller[_0xb5b5('0xe')]);router[_0xb5b5('0x7')](_0xb5b5('0xf'),auth[_0xb5b5('0x8')](),controller[_0xb5b5('0x10')]);router[_0xb5b5('0x11')]('/',auth['isAuthenticated'](),controller[_0xb5b5('0x12')]);router[_0xb5b5('0x11')]('/:id/teams',auth[_0xb5b5('0x8')](),controller[_0xb5b5('0x13')]);router[_0xb5b5('0x11')](_0xb5b5('0xf'),auth[_0xb5b5('0x8')](),controller[_0xb5b5('0x14')]);router['put'](_0xb5b5('0xa'),auth[_0xb5b5('0x8')](),controller[_0xb5b5('0x15')]);router['delete']('/:id',auth[_0xb5b5('0x8')](),controller[_0xb5b5('0x16')]);router[_0xb5b5('0x17')](_0xb5b5('0xd'),auth[_0xb5b5('0x8')](),controller['removeTeams']);router[_0xb5b5('0x17')](_0xb5b5('0xf'),auth[_0xb5b5('0x8')](),controller[_0xb5b5('0x18')]);module[_0xb5b5('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index e74d070..4f0a190 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 _0x88e1=['ENUM','INTEGER'];(function(_0x2d0d9f,_0x22c0d8){var _0x30243d=function(_0x29a92b){while(--_0x29a92b){_0x2d0d9f['push'](_0x2d0d9f['shift']());}};_0x30243d(++_0x22c0d8);}(_0x88e1,0xcb));var _0x188e=function(_0xc20f22,_0x49698f){_0xc20f22=_0xc20f22-0x0;var _0x1535d5=_0x88e1[_0xc20f22];return _0x1535d5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x188e('0x0')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x188e('0x1')]('rrmemory','beepall','roundrobin')}}; \ No newline at end of file +var _0xbf15=['roundrobin','sequelize','STRING','name','ENUM','rrmemory','beepall'];(function(_0x4d830b,_0x27f78d){var _0x238c89=function(_0x3eead9){while(--_0x3eead9){_0x4d830b['push'](_0x4d830b['shift']());}};_0x238c89(++_0x27f78d);}(_0xbf15,0xda));var _0x5bf1=function(_0x2dd8ce,_0xe4793b){_0x2dd8ce=_0x2dd8ce-0x0;var _0x152927=_0xbf15[_0x2dd8ce];return _0x152927;};'use strict';var Sequelize=require(_0x5bf1('0x0'));module['exports']={'name':{'type':Sequelize[_0x5bf1('0x1')],'unique':_0x5bf1('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5bf1('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5bf1('0x3')](_0x5bf1('0x4'),_0x5bf1('0x5'),_0x5bf1('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 1bd3bc5..6d68328 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 _0x4e83=['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/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','end','error','name','send','index','MailQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','MailQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserMailQueue','nolimit','MailQueueId','User','agent','mailPause','updatedAt','createdAt','format','%s/%s','findOne','Team','getTeams','ids','Agents','voicePause','interface','flatMap','sequelize','addTeams','each','forEach','emit','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','SELECT','every','TeamId','includes','all','union','compact','value','transaction','removeTeams','removeAgents','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x1eb0c4,_0x425966){var _0x440892=function(_0x1c9e9a){while(--_0x1c9e9a){_0x1eb0c4['push'](_0x1eb0c4['shift']());}};_0x440892(++_0x425966);}(_0x4e83,0x88));var _0x34e8=function(_0x1202a2,_0x2912d9){_0x1202a2=_0x1202a2-0x0;var _0x3a8ac6=_0x4e83[_0x1202a2];return _0x3a8ac6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x34e8('0x0'));var zipdir=require(_0x34e8('0x1'));var jsonpatch=require(_0x34e8('0x2'));var rp=require(_0x34e8('0x3'));var moment=require('moment');var BPromise=require(_0x34e8('0x4'));var Mustache=require(_0x34e8('0x5'));var util=require(_0x34e8('0x6'));var path=require(_0x34e8('0x7'));var sox=require(_0x34e8('0x8'));var csv=require(_0x34e8('0x9'));var ejs=require(_0x34e8('0xa'));var fs=require('fs');var fs_extra=require(_0x34e8('0xb'));var _=require(_0x34e8('0xc'));var squel=require(_0x34e8('0xd'));var crypto=require(_0x34e8('0xe'));var jsforce=require(_0x34e8('0xf'));var deskjs=require(_0x34e8('0x10'));var toCsv=require('to-csv');var querystring=require(_0x34e8('0x11'));var Papa=require(_0x34e8('0x12'));var Redis=require(_0x34e8('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x34e8('0x14'));var as=require(_0x34e8('0x15'));var hardwareService=require(_0x34e8('0x16'));var logger=require(_0x34e8('0x17'))(_0x34e8('0x18'));var utils=require('../../config/utils');var config=require(_0x34e8('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x34e8('0x1a'))['db'];config[_0x34e8('0x1b')]=_[_0x34e8('0x1c')](config[_0x34e8('0x1b')],{'host':_0x34e8('0x1d'),'port':0x18eb});var socket=require(_0x34e8('0x1e'))(new Redis(config['redis']));require(_0x34e8('0x1f'))['register'](socket);function respondWithStatusCode(_0x41a776,_0x544e36){_0x544e36=_0x544e36||0xcc;return function(_0x398621){if(_0x398621){return _0x41a776[_0x34e8('0x20')](_0x544e36);}return _0x41a776[_0x34e8('0x21')](_0x544e36)['end']();};}function respondWithResult(_0x1dd69f,_0x5628d2){_0x5628d2=_0x5628d2||0xc8;return function(_0x423e12){if(_0x423e12){return _0x1dd69f[_0x34e8('0x21')](_0x5628d2)[_0x34e8('0x22')](_0x423e12);}};}function respondWithFilteredResult(_0x4a1af0,_0x8e15d2){return function(_0x1a2fa7){if(_0x1a2fa7){var _0x3b83bb=typeof _0x8e15d2[_0x34e8('0x23')]===_0x34e8('0x24')&&typeof _0x8e15d2[_0x34e8('0x25')]===_0x34e8('0x24');var _0x3bbb4f=_0x1a2fa7[_0x34e8('0x26')];var _0x40b362=_0x3b83bb?0x0:_0x8e15d2['offset'];var _0x1ddd24=_0x3b83bb?_0x1a2fa7[_0x34e8('0x26')]:_0x8e15d2[_0x34e8('0x23')]+_0x8e15d2[_0x34e8('0x25')];var _0x303f4b;if(_0x1ddd24>=_0x3bbb4f){_0x1ddd24=_0x3bbb4f;_0x303f4b=0xc8;}else{_0x303f4b=0xce;}_0x4a1af0[_0x34e8('0x21')](_0x303f4b);return _0x4a1af0[_0x34e8('0x27')](_0x34e8('0x28'),_0x40b362+'-'+_0x1ddd24+'/'+_0x3bbb4f)[_0x34e8('0x22')](_0x1a2fa7);}return null;};}function patchUpdates(_0x15bbff){return function(_0xe68802){try{jsonpatch[_0x34e8('0x29')](_0xe68802,_0x15bbff,!![]);}catch(_0x28075c){return BPromise[_0x34e8('0x2a')](_0x28075c);}return _0xe68802[_0x34e8('0x2b')]();};}function saveUpdates(_0x250321,_0x3df27a){return function(_0x210d13){if(_0x210d13){return _0x210d13[_0x34e8('0x2c')](_0x250321)[_0x34e8('0x2d')](function(_0x4d8780){return _0x4d8780;});}return null;};}function removeEntity(_0x4cf03e,_0x4a2caa){return function(_0x3c8cb3){if(_0x3c8cb3){return _0x3c8cb3[_0x34e8('0x2e')]()[_0x34e8('0x2d')](function(){var _0x2b1179=_0x3c8cb3['get']({'plain':!![]});var _0x18f933='MailQueues';return db[_0x34e8('0x2f')]['destroy']({'where':{'type':_0x18f933,'resourceId':_0x2b1179['id']}})[_0x34e8('0x2d')](function(){return _0x3c8cb3;});})['then'](function(){_0x4cf03e[_0x34e8('0x21')](0xcc)[_0x34e8('0x30')]();});}};}function handleEntityNotFound(_0x3e842b,_0x1bb4f3){return function(_0x49041e){if(!_0x49041e){_0x3e842b[_0x34e8('0x20')](0x194);}return _0x49041e;};}function handleError(_0x42651a,_0x21ed83){_0x21ed83=_0x21ed83||0x1f4;return function(_0x52b2ba){logger[_0x34e8('0x31')](_0x52b2ba['stack']);if(_0x52b2ba[_0x34e8('0x32')]){delete _0x52b2ba['name'];}_0x42651a[_0x34e8('0x21')](_0x21ed83)[_0x34e8('0x33')](_0x52b2ba);};}exports[_0x34e8('0x34')]=function(_0x3d0ec2,_0xf2ba18){var _0x210c99={},_0xe3ac21={},_0x4f13da={'count':0x0,'rows':[]};var _0xda4113=_['map'](db[_0x34e8('0x35')][_0x34e8('0x36')],function(_0x3a7563){return{'name':_0x3a7563[_0x34e8('0x37')],'type':_0x3a7563[_0x34e8('0x38')][_0x34e8('0x39')]};});_0xe3ac21[_0x34e8('0x3a')]=_['map'](_0xda4113,_0x34e8('0x32'));_0xe3ac21[_0x34e8('0x3b')]=_[_0x34e8('0x3c')](_0x3d0ec2[_0x34e8('0x3b')]);_0xe3ac21[_0x34e8('0x3d')]=_[_0x34e8('0x3e')](_0xe3ac21[_0x34e8('0x3a')],_0xe3ac21[_0x34e8('0x3b')]);_0x210c99[_0x34e8('0x3f')]=_[_0x34e8('0x3e')](_0xe3ac21[_0x34e8('0x3a')],qs[_0x34e8('0x40')](_0x3d0ec2[_0x34e8('0x3b')]['fields']));_0x210c99[_0x34e8('0x3f')]=_0x210c99['attributes'][_0x34e8('0x41')]?_0x210c99[_0x34e8('0x3f')]:_0xe3ac21[_0x34e8('0x3a')];if(!_0x3d0ec2[_0x34e8('0x3b')][_0x34e8('0x42')]('nolimit')){_0x210c99[_0x34e8('0x25')]=qs[_0x34e8('0x25')](_0x3d0ec2[_0x34e8('0x3b')][_0x34e8('0x25')]);_0x210c99[_0x34e8('0x23')]=qs[_0x34e8('0x23')](_0x3d0ec2['query'][_0x34e8('0x23')]);}_0x210c99[_0x34e8('0x43')]=qs[_0x34e8('0x44')](_0x3d0ec2[_0x34e8('0x3b')]['sort']);_0x210c99[_0x34e8('0x45')]=qs['filters'](_[_0x34e8('0x46')](_0x3d0ec2[_0x34e8('0x3b')],_0xe3ac21[_0x34e8('0x3d')]),_0xda4113);if(_0x3d0ec2[_0x34e8('0x3b')][_0x34e8('0x47')]){_0x210c99['where']=_[_0x34e8('0x48')](_0x210c99['where'],{'$or':_[_0x34e8('0x49')](_0xda4113,function(_0x31d911){if(_0x31d911[_0x34e8('0x38')]!==_0x34e8('0x4a')){var _0x2f7167={};_0x2f7167[_0x31d911[_0x34e8('0x32')]]={'$like':'%'+_0x3d0ec2['query'][_0x34e8('0x47')]+'%'};return _0x2f7167;}})});}_0x210c99=_[_0x34e8('0x48')]({},_0x210c99,_0x3d0ec2[_0x34e8('0x4b')]);var _0x586084={'where':_0x210c99[_0x34e8('0x45')]};return db[_0x34e8('0x35')]['count'](_0x586084)[_0x34e8('0x2d')](function(_0x44655b){_0x4f13da[_0x34e8('0x26')]=_0x44655b;if(_0x3d0ec2[_0x34e8('0x3b')]['includeAll']){_0x210c99[_0x34e8('0x4c')]=[{'all':!![]}];}return db[_0x34e8('0x35')][_0x34e8('0x4d')](_0x210c99);})[_0x34e8('0x2d')](function(_0xf742e){_0x4f13da[_0x34e8('0x4e')]=_0xf742e;return _0x4f13da;})[_0x34e8('0x2d')](respondWithFilteredResult(_0xf2ba18,_0x210c99))[_0x34e8('0x4f')](handleError(_0xf2ba18,null));};exports[_0x34e8('0x50')]=function(_0x1f273e,_0x197f2b){var _0x321d36={'raw':!![],'where':{'id':_0x1f273e[_0x34e8('0x51')]['id']}},_0x537680={};_0x537680['model']=_[_0x34e8('0x3c')](db['MailQueue']['rawAttributes']);_0x537680['query']=_['keys'](_0x1f273e['query']);_0x537680['filters']=_[_0x34e8('0x3e')](_0x537680['model'],_0x537680['query']);_0x321d36[_0x34e8('0x3f')]=_[_0x34e8('0x3e')](_0x537680[_0x34e8('0x3a')],qs[_0x34e8('0x40')](_0x1f273e[_0x34e8('0x3b')][_0x34e8('0x40')]));_0x321d36['attributes']=_0x321d36[_0x34e8('0x3f')][_0x34e8('0x41')]?_0x321d36[_0x34e8('0x3f')]:_0x537680['model'];if(_0x1f273e['query'][_0x34e8('0x52')]){_0x321d36['include']=[{'all':!![]}];}_0x321d36=_[_0x34e8('0x48')]({},_0x321d36,_0x1f273e['options']);return db[_0x34e8('0x35')][_0x34e8('0x53')](_0x321d36)[_0x34e8('0x2d')](handleEntityNotFound(_0x197f2b,null))['then'](respondWithResult(_0x197f2b,null))[_0x34e8('0x4f')](handleError(_0x197f2b,null));};exports[_0x34e8('0x54')]=function(_0x59fc14,_0x36cb0b){return db[_0x34e8('0x35')][_0x34e8('0x54')](_0x59fc14[_0x34e8('0x55')],{})['then'](function(_0x3c9237){var _0x1b244c=_0x59fc14[_0x34e8('0x56')]['get']({'plain':!![]});if(!_0x1b244c)throw new Error(_0x34e8('0x57'));if(_0x1b244c['role']===_0x34e8('0x56')){var _0xd71733=_0x3c9237[_0x34e8('0x58')]({'plain':!![]});var _0x590b51=_0x34e8('0x59');return db[_0x34e8('0x5a')][_0x34e8('0x53')]({'where':{'name':_0x590b51,'userProfileId':_0x1b244c[_0x34e8('0x5b')]},'raw':!![]})[_0x34e8('0x2d')](function(_0x313205){if(_0x313205&&_0x313205['autoAssociation']===0x0){return db[_0x34e8('0x2f')]['create']({'name':_0xd71733[_0x34e8('0x32')],'resourceId':_0xd71733['id'],'type':_0x313205['name'],'sectionId':_0x313205['id']},{})['then'](function(){return _0x3c9237;});}else{return _0x3c9237;}})['catch'](function(_0x1e8496){logger[_0x34e8('0x31')](_0x34e8('0x5c'),_0x1e8496);throw _0x1e8496;});}return _0x3c9237;})[_0x34e8('0x2d')](respondWithResult(_0x36cb0b,0xc9))[_0x34e8('0x4f')](handleError(_0x36cb0b,null));};exports[_0x34e8('0x2c')]=function(_0x58ea5a,_0x2aebd3){if(_0x58ea5a[_0x34e8('0x55')]['id']){delete _0x58ea5a[_0x34e8('0x55')]['id'];}return db['MailQueue'][_0x34e8('0x53')]({'where':{'id':_0x58ea5a['params']['id']}})[_0x34e8('0x2d')](handleEntityNotFound(_0x2aebd3,null))['then'](saveUpdates(_0x58ea5a['body'],null))[_0x34e8('0x2d')](respondWithResult(_0x2aebd3,null))[_0x34e8('0x4f')](handleError(_0x2aebd3,null));};exports[_0x34e8('0x2e')]=function(_0x567c77,_0x4a6218){return db[_0x34e8('0x35')]['find']({'where':{'id':_0x567c77[_0x34e8('0x51')]['id']}})[_0x34e8('0x2d')](handleEntityNotFound(_0x4a6218,null))[_0x34e8('0x2d')](removeEntity(_0x4a6218,null))[_0x34e8('0x4f')](handleError(_0x4a6218,null));};exports[_0x34e8('0x5d')]=function(_0x4dcf7a,_0x5d7c2b){return db[_0x34e8('0x35')][_0x34e8('0x5d')]()['then'](respondWithResult(_0x5d7c2b,null))[_0x34e8('0x4f')](handleError(_0x5d7c2b,null));};exports['getMembers']=function(_0x16baaa,_0x2211fd,_0x1606ff){var _0x3a785c={'raw':!![],'where':{}},_0x56da86={},_0x392486;return db['MailQueue']['findOne']({'where':{'id':_0x16baaa[_0x34e8('0x51')]['id']}})[_0x34e8('0x2d')](handleEntityNotFound(_0x2211fd,null))[_0x34e8('0x2d')](function(_0x4060ea){if(_0x4060ea){_0x392486=_0x4060ea[_0x34e8('0x58')]({'plain':!![]});_0x56da86[_0x34e8('0x3a')]=_[_0x34e8('0x3c')](db[_0x34e8('0x5e')][_0x34e8('0x36')]);_0x56da86['query']=_[_0x34e8('0x3c')](_0x16baaa[_0x34e8('0x3b')]);_0x56da86[_0x34e8('0x3d')]=_['intersection'](_0x56da86[_0x34e8('0x3a')],_0x56da86[_0x34e8('0x3b')]);_0x3a785c[_0x34e8('0x3f')]=_['intersection'](_0x56da86[_0x34e8('0x3a')],qs[_0x34e8('0x40')](_0x16baaa[_0x34e8('0x3b')]['fields']));_0x3a785c['attributes']=_0x3a785c[_0x34e8('0x3f')][_0x34e8('0x41')]?_0x3a785c[_0x34e8('0x3f')]:_0x56da86[_0x34e8('0x3a')];if(!_0x16baaa['query'][_0x34e8('0x42')](_0x34e8('0x5f'))){_0x3a785c['limit']=qs['limit'](_0x16baaa[_0x34e8('0x3b')][_0x34e8('0x25')]);_0x3a785c[_0x34e8('0x23')]=qs[_0x34e8('0x23')](_0x16baaa[_0x34e8('0x3b')][_0x34e8('0x23')]);}_0x3a785c[_0x34e8('0x43')]=qs[_0x34e8('0x44')](_0x16baaa[_0x34e8('0x3b')][_0x34e8('0x44')]);_0x3a785c[_0x34e8('0x45')]=qs[_0x34e8('0x3d')](_[_0x34e8('0x46')](_0x16baaa[_0x34e8('0x3b')],_0x56da86[_0x34e8('0x3d')]));_0x3a785c[_0x34e8('0x45')][_0x34e8('0x60')]=_0x4060ea['id'];if(_0x16baaa['query']['filter']){_0x3a785c[_0x34e8('0x45')]=_[_0x34e8('0x48')](_0x3a785c[_0x34e8('0x45')],{'$or':_[_0x34e8('0x49')](_0x3a785c[_0x34e8('0x3f')],function(_0x4f7c75){var _0xf54319={};_0xf54319[_0x4f7c75]={'$like':'%'+_0x16baaa[_0x34e8('0x3b')][_0x34e8('0x47')]+'%'};return _0xf54319;})});}_0x3a785c=_[_0x34e8('0x48')]({},_0x3a785c,_0x16baaa[_0x34e8('0x4b')]);return db['UserMailQueue'][_0x34e8('0x4d')](_0x3a785c);}})['then'](function(_0x4d7664){if(_0x4d7664){return db[_0x34e8('0x61')]['findAndCountAll']({'where':{'id':_[_0x34e8('0x49')](_0x4d7664,'UserId'),'role':_0x34e8('0x62')},'attributes':['id',_0x34e8('0x32'),_0x34e8('0x63'),_0x34e8('0x64'),_0x34e8('0x65')]});}})[_0x34e8('0x2d')](function(_0x20a03c){if(_0x20a03c){return{'count':_0x20a03c[_0x34e8('0x26')],'rows':_[_0x34e8('0x49')](_0x20a03c[_0x34e8('0x4e')],function(_0x4198de){return{'membername':_0x4198de[_0x34e8('0x32')],'UserId':_0x4198de['id'],'queue_name':_0x392486[_0x34e8('0x32')],'MailQueueId':_0x392486['id'],'interface':util[_0x34e8('0x66')](_0x34e8('0x67'),'SIP',_0x4198de[_0x34e8('0x32')]),'penalty':0x0,'paused':_0x4198de[_0x34e8('0x63')],'createdAt':_0x4198de[_0x34e8('0x65')],'updatedAt':_0x4198de[_0x34e8('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x34e8('0x2d')](respondWithFilteredResult(_0x2211fd,_0x3a785c))[_0x34e8('0x4f')](handleError(_0x2211fd,null));};exports['getTeams']=function(_0x584d64,_0x3a4907,_0x1b65ce){var _0x47cc75={};var _0x32a7a4={};var _0x1987bc;var _0x3fa3fb;return db[_0x34e8('0x35')][_0x34e8('0x68')]({'where':{'id':_0x584d64[_0x34e8('0x51')]['id']}})[_0x34e8('0x2d')](handleEntityNotFound(_0x3a4907,null))[_0x34e8('0x2d')](function(_0x1d8bf8){if(_0x1d8bf8){_0x1987bc=_0x1d8bf8;_0x32a7a4[_0x34e8('0x3a')]=_['keys'](db[_0x34e8('0x69')][_0x34e8('0x36')]);_0x32a7a4[_0x34e8('0x3b')]=_[_0x34e8('0x3c')](_0x584d64['query']);_0x32a7a4[_0x34e8('0x3d')]=_['intersection'](_0x32a7a4['model'],_0x32a7a4[_0x34e8('0x3b')]);_0x47cc75[_0x34e8('0x3f')]=_['intersection'](_0x32a7a4[_0x34e8('0x3a')],qs[_0x34e8('0x40')](_0x584d64[_0x34e8('0x3b')][_0x34e8('0x40')]));_0x47cc75[_0x34e8('0x3f')]=_0x47cc75['attributes'][_0x34e8('0x41')]?_0x47cc75[_0x34e8('0x3f')]:_0x32a7a4[_0x34e8('0x3a')];_0x47cc75[_0x34e8('0x43')]=qs[_0x34e8('0x44')](_0x584d64[_0x34e8('0x3b')][_0x34e8('0x44')]);_0x47cc75[_0x34e8('0x45')]=qs[_0x34e8('0x3d')](_['pick'](_0x584d64[_0x34e8('0x3b')],_0x32a7a4[_0x34e8('0x3d')]));if(_0x584d64['query'][_0x34e8('0x47')]){_0x47cc75['where']=_[_0x34e8('0x48')](_0x47cc75[_0x34e8('0x45')],{'$or':_[_0x34e8('0x49')](_0x47cc75[_0x34e8('0x3f')],function(_0x182140){var _0x44d24c={};_0x44d24c[_0x182140]={'$like':'%'+_0x584d64[_0x34e8('0x3b')]['filter']+'%'};return _0x44d24c;})});}_0x47cc75=_[_0x34e8('0x48')]({},_0x47cc75,_0x584d64['options']);return _0x1987bc[_0x34e8('0x6a')](_0x47cc75);}})[_0x34e8('0x2d')](function(_0x381d69){if(_0x381d69){_0x3fa3fb=_0x381d69[_0x34e8('0x41')];if(!_0x584d64[_0x34e8('0x3b')][_0x34e8('0x42')]('nolimit')){_0x47cc75[_0x34e8('0x25')]=qs[_0x34e8('0x25')](_0x584d64['query'][_0x34e8('0x25')]);_0x47cc75[_0x34e8('0x23')]=qs[_0x34e8('0x23')](_0x584d64[_0x34e8('0x3b')][_0x34e8('0x23')]);}return _0x1987bc[_0x34e8('0x6a')](_0x47cc75);}})[_0x34e8('0x2d')](function(_0x1bcb7a){if(_0x1bcb7a){return _0x1bcb7a?{'count':_0x3fa3fb,'rows':_0x1bcb7a}:null;}})['then'](respondWithResult(_0x3a4907,null))[_0x34e8('0x4f')](handleError(_0x3a4907,null));};exports['addTeams']=function(_0x368cb2,_0x57f147,_0x220bb0){var _0x4ce13e=_0x368cb2[_0x34e8('0x55')][_0x34e8('0x6b')];return db[_0x34e8('0x69')][_0x34e8('0x4d')]({'where':{'id':_0x4ce13e},'attributes':['id'],'include':[{'model':db[_0x34e8('0x61')],'as':_0x34e8('0x6c'),'attributes':['id',_0x34e8('0x32'),'online',_0x34e8('0x6d'),_0x34e8('0x6e')],'raw':!![]}]})[_0x34e8('0x2d')](function(_0x2a1c95){if(_0x2a1c95){var _0x520af2=_[_0x34e8('0x6f')](_0x2a1c95,function(_0x59e6ca){var _0x2633d3=_0x59e6ca[_0x34e8('0x58')]({'plain':!![]});return _0x2633d3[_0x34e8('0x6c')];});return db[_0x34e8('0x35')][_0x34e8('0x53')]({'where':{'id':_0x368cb2[_0x34e8('0x51')]['id']}})[_0x34e8('0x2d')](function(_0x396380){return db[_0x34e8('0x70')]['transaction'](function(_0x505f24){return _0x396380[_0x34e8('0x71')](_0x4ce13e,{'transaction':_0x505f24})[_0x34e8('0x2d')](function(){return BPromise[_0x34e8('0x72')](_0x520af2,function(_0x50b9ea){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x50b9ea['id'],'MailQueueId':_0x368cb2[_0x34e8('0x51')]['id']},'transaction':_0x505f24});});})['then'](function(){_0x520af2[_0x34e8('0x73')](function(_0x20ce39){socket[_0x34e8('0x74')]('userMailQueue:save',{'UserId':_0x20ce39['id'],'MailQueueId':_0x396380['id']});});});});});}})[_0x34e8('0x2d')](respondWithStatusCode(_0x57f147,null))[_0x34e8('0x4f')](handleError(_0x57f147,null));};exports['removeTeams']=function(_0x4d8782,_0x5a9d15,_0x3b0281){return db[_0x34e8('0x69')][_0x34e8('0x4d')]({'where':{'id':_0x4d8782[_0x34e8('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0x34e8('0x61')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x34e8('0x2d')](handleEntityNotFound(_0x5a9d15,null))['then'](function(_0x25186b){var _0x2f9ca2=_[_0x34e8('0x49')](_0x25186b,'id');var _0xf690d0=[];var _0x432974=[];var _0x1b348b=squel['select']();_0x1b348b[_0x34e8('0x75')](_0x34e8('0x76'))['from'](_0x34e8('0x77'),'tq')[_0x34e8('0x78')](_0x34e8('0x79'),'ut',_0x34e8('0x7a'))[_0x34e8('0x45')]('MailQueueId\x20=\x20?',_0x4d8782['params']['id']);for(var _0x338ee0=0x0;_0x338ee0<_0x25186b[_0x34e8('0x41')];_0x338ee0+=0x1){let _0x41e13e=_0x25186b[_0x338ee0];for(var _0x4154dd=0x0;_0x4154dd<_0x41e13e['Agents'][_0x34e8('0x41')];_0x4154dd+=0x1){let _0x4905c3=_0x41e13e[_0x34e8('0x6c')][_0x4154dd];var _0x1eb697=_0x1b348b[_0x34e8('0x7b')]();_0x1eb697[_0x34e8('0x45')]('ut.UserId\x20=\x20?',_0x4905c3['id']);_0x432974[_0x34e8('0x7c')](db[_0x34e8('0x70')][_0x34e8('0x3b')](_0x1eb697['toString'](),{'type':db[_0x34e8('0x70')]['QueryTypes'][_0x34e8('0x7d')]})['then'](function(_0x34b983){if(_0x34b983['length']===0x1){return _0x4905c3['id'];}else{var _0x16ce18=_[_0x34e8('0x7e')](_[_0x34e8('0x49')](_0x34b983,_0x34e8('0x7f')),function(_0x20af58){return _[_0x34e8('0x80')](_0x2f9ca2,_0x20af58);});if(_0x16ce18){return _0x4905c3['id'];}}}));}}return BPromise[_0x34e8('0x81')](_0x432974)['then'](function(_0x62611f){_0xf690d0=_(_0xf690d0)[_0x34e8('0x82')](_0x62611f)[_0x34e8('0x83')]()[_0x34e8('0x84')]();return db[_0x34e8('0x35')][_0x34e8('0x53')]({'where':{'id':_0x4d8782[_0x34e8('0x51')]['id']}})[_0x34e8('0x2d')](function(_0x23abe7){return db[_0x34e8('0x70')][_0x34e8('0x85')](function(_0x48a8fe){return _0x23abe7[_0x34e8('0x86')](_0x4d8782['query'][_0x34e8('0x6b')],{'transaction':_0x48a8fe})[_0x34e8('0x2d')](function(){if(!_['isEmpty'](_0xf690d0)){return _0x23abe7[_0x34e8('0x87')](_0xf690d0,{'transaction':_0x48a8fe});}})[_0x34e8('0x2d')](function(){_0xf690d0[_0x34e8('0x73')](function(_0x60da12){socket[_0x34e8('0x74')](_0x34e8('0x88'),{'UserId':_0x60da12,'MailQueueId':_0x23abe7['id']});});});});});});})['then'](respondWithStatusCode(_0x5a9d15,null))[_0x34e8('0x4f')](handleError(_0x5a9d15,null));};exports[_0x34e8('0x89')]=function(_0x359a2b,_0x23af1b,_0x5cae9e){return db[_0x34e8('0x35')][_0x34e8('0x53')]({'where':{'id':_0x359a2b[_0x34e8('0x51')]['id']}})[_0x34e8('0x2d')](handleEntityNotFound(_0x23af1b,null))[_0x34e8('0x2d')](function(_0x357206){if(_0x357206){return _0x357206['addAgents'](_0x359a2b[_0x34e8('0x55')]['ids'],_[_0x34e8('0x8a')](_0x359a2b[_0x34e8('0x55')],[_0x34e8('0x6b'),'id'])||{})[_0x34e8('0x8b')](function(_0x399827){for(var _0x5b7ab1=0x0;_0x5b7ab1<_0x359a2b[_0x34e8('0x55')][_0x34e8('0x6b')][_0x34e8('0x41')];_0x5b7ab1+=0x1){socket[_0x34e8('0x74')](_0x34e8('0x8c'),{'UserId':Number(_0x359a2b[_0x34e8('0x55')][_0x34e8('0x6b')][_0x5b7ab1]),'MailQueueId':Number(_0x359a2b[_0x34e8('0x51')]['id'])});}return _0x399827;});}})[_0x34e8('0x2d')](respondWithResult(_0x23af1b,null))[_0x34e8('0x4f')](handleError(_0x23af1b,null));};exports[_0x34e8('0x87')]=function(_0x4d705f,_0xd2575,_0x4809e5){return db[_0x34e8('0x35')]['find']({'where':{'id':_0x4d705f[_0x34e8('0x51')]['id']}})['then'](handleEntityNotFound(_0xd2575,null))[_0x34e8('0x2d')](function(_0x865ead){if(_0x865ead){return _0x865ead[_0x34e8('0x87')](_0x4d705f[_0x34e8('0x3b')][_0x34e8('0x6b')])['then'](function(){if(_[_0x34e8('0x8d')](_0x4d705f[_0x34e8('0x3b')][_0x34e8('0x6b')])){for(var _0x1ea41b=0x0;_0x1ea41b<_0x4d705f[_0x34e8('0x3b')][_0x34e8('0x6b')][_0x34e8('0x41')];_0x1ea41b+=0x1){socket[_0x34e8('0x74')](_0x34e8('0x88'),{'UserId':Number(_0x4d705f[_0x34e8('0x3b')]['ids'][_0x1ea41b]),'MailQueueId':Number(_0x4d705f[_0x34e8('0x51')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x4d705f[_0x34e8('0x3b')][_0x34e8('0x6b')]),'MailQueueId':Number(_0x4d705f[_0x34e8('0x51')]['id'])});}});}})[_0x34e8('0x2d')](respondWithStatusCode(_0xd2575,null))[_0x34e8('0x4f')](handleError(_0xd2575,null));};exports[_0x34e8('0x8e')]=function(_0x3032d1,_0x21849f,_0x519ccf){var _0x9b7c56={};var _0x182fa3={};var _0x8b316e;var _0x194b8a;return db[_0x34e8('0x35')][_0x34e8('0x68')]({'where':{'id':_0x3032d1[_0x34e8('0x51')]['id']}})['then'](handleEntityNotFound(_0x21849f,null))[_0x34e8('0x2d')](function(_0x40cfe3){if(_0x40cfe3){_0x8b316e=_0x40cfe3;_0x182fa3[_0x34e8('0x3a')]=_[_0x34e8('0x3c')](db['User'][_0x34e8('0x36')]);_0x182fa3['query']=_['keys'](_0x3032d1[_0x34e8('0x3b')]);_0x182fa3[_0x34e8('0x3d')]=_[_0x34e8('0x3e')](_0x182fa3[_0x34e8('0x3a')],_0x182fa3[_0x34e8('0x3b')]);_0x9b7c56[_0x34e8('0x3f')]=_[_0x34e8('0x3e')](_0x182fa3[_0x34e8('0x3a')],qs[_0x34e8('0x40')](_0x3032d1[_0x34e8('0x3b')]['fields']));_0x9b7c56['attributes']=_0x9b7c56[_0x34e8('0x3f')]['length']?_0x9b7c56[_0x34e8('0x3f')]:_0x182fa3[_0x34e8('0x3a')];_0x9b7c56[_0x34e8('0x43')]=qs[_0x34e8('0x44')](_0x3032d1[_0x34e8('0x3b')][_0x34e8('0x44')]);_0x9b7c56[_0x34e8('0x45')]=qs['filters'](_[_0x34e8('0x46')](_0x3032d1['query'],_0x182fa3[_0x34e8('0x3d')]));if(_0x3032d1[_0x34e8('0x3b')][_0x34e8('0x47')]){_0x9b7c56[_0x34e8('0x45')]=_[_0x34e8('0x48')](_0x9b7c56[_0x34e8('0x45')],{'$or':_[_0x34e8('0x49')](_0x9b7c56[_0x34e8('0x3f')],function(_0x346348){var _0x56342b={};_0x56342b[_0x346348]={'$like':'%'+_0x3032d1[_0x34e8('0x3b')]['filter']+'%'};return _0x56342b;})});}_0x9b7c56=_[_0x34e8('0x48')]({},_0x9b7c56,_0x3032d1[_0x34e8('0x4b')]);return _0x8b316e['getAgents'](_0x9b7c56);}})['then'](function(_0x4d794b){if(_0x4d794b){_0x194b8a=_0x4d794b[_0x34e8('0x41')];if(!_0x3032d1[_0x34e8('0x3b')][_0x34e8('0x42')](_0x34e8('0x5f'))){_0x9b7c56[_0x34e8('0x25')]=qs[_0x34e8('0x25')](_0x3032d1[_0x34e8('0x3b')]['limit']);_0x9b7c56['offset']=qs[_0x34e8('0x23')](_0x3032d1[_0x34e8('0x3b')][_0x34e8('0x23')]);}return _0x8b316e[_0x34e8('0x8e')](_0x9b7c56);}})[_0x34e8('0x2d')](function(_0x2a3507){if(_0x2a3507){return _0x2a3507?{'count':_0x194b8a,'rows':_0x2a3507}:null;}})[_0x34e8('0x2d')](respondWithResult(_0x21849f,null))[_0x34e8('0x4f')](handleError(_0x21849f,null));}; \ No newline at end of file +var _0x9965=['UserProfileResource','error','name','send','map','MailQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','describe','getMembers','findOne','UserMailQueue','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','SIP','mailPause','getTeams','addTeams','ids','Agents','online','flatMap','sequelize','each','emit','userMailQueue:save','Team','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','compact','value','transaction','removeTeams','removeAgents','forEach','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','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','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','end','status','offset','limit','undefined','count','set','json','reject','save','then','destroy','get','MailQueues'];(function(_0xf924e0,_0x2119bf){var _0x3241a8=function(_0x2fba3e){while(--_0x2fba3e){_0xf924e0['push'](_0xf924e0['shift']());}};_0x3241a8(++_0x2119bf);}(_0x9965,0xf4));var _0x5996=function(_0x251baf,_0x7ffd3e){_0x251baf=_0x251baf-0x0;var _0x5b22f0=_0x9965[_0x251baf];return _0x5b22f0;};'use strict';var emlformat=require(_0x5996('0x0'));var rimraf=require(_0x5996('0x1'));var zipdir=require(_0x5996('0x2'));var jsonpatch=require(_0x5996('0x3'));var rp=require(_0x5996('0x4'));var moment=require('moment');var BPromise=require(_0x5996('0x5'));var Mustache=require(_0x5996('0x6'));var util=require(_0x5996('0x7'));var path=require(_0x5996('0x8'));var sox=require(_0x5996('0x9'));var csv=require(_0x5996('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5996('0xb'));var _=require(_0x5996('0xc'));var squel=require(_0x5996('0xd'));var crypto=require(_0x5996('0xe'));var jsforce=require(_0x5996('0xf'));var deskjs=require(_0x5996('0x10'));var toCsv=require(_0x5996('0xa'));var querystring=require(_0x5996('0x11'));var Papa=require(_0x5996('0x12'));var Redis=require(_0x5996('0x13'));var authService=require(_0x5996('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x5996('0x15'));var hardwareService=require(_0x5996('0x16'));var logger=require(_0x5996('0x17'))(_0x5996('0x18'));var utils=require(_0x5996('0x19'));var config=require(_0x5996('0x1a'));var licenseUtil=require(_0x5996('0x1b'));var db=require(_0x5996('0x1c'))['db'];config[_0x5996('0x1d')]=_['defaults'](config[_0x5996('0x1d')],{'host':_0x5996('0x1e'),'port':0x18eb});var socket=require(_0x5996('0x1f'))(new Redis(config[_0x5996('0x1d')]));require(_0x5996('0x20'))['register'](socket);function respondWithStatusCode(_0x5144b0,_0x5edea0){_0x5edea0=_0x5edea0||0xcc;return function(_0x1f04de){if(_0x1f04de){return _0x5144b0[_0x5996('0x21')](_0x5edea0);}return _0x5144b0['status'](_0x5edea0)[_0x5996('0x22')]();};}function respondWithResult(_0x3f6e5b,_0xc74402){_0xc74402=_0xc74402||0xc8;return function(_0x552959){if(_0x552959){return _0x3f6e5b[_0x5996('0x23')](_0xc74402)['json'](_0x552959);}};}function respondWithFilteredResult(_0x218c64,_0x21ee6d){return function(_0x375c75){if(_0x375c75){var _0x275540=typeof _0x21ee6d[_0x5996('0x24')]==='undefined'&&typeof _0x21ee6d[_0x5996('0x25')]===_0x5996('0x26');var _0x5b4bdf=_0x375c75[_0x5996('0x27')];var _0x136668=_0x275540?0x0:_0x21ee6d[_0x5996('0x24')];var _0x938f8d=_0x275540?_0x375c75[_0x5996('0x27')]:_0x21ee6d['offset']+_0x21ee6d[_0x5996('0x25')];var _0x1ea0d1;if(_0x938f8d>=_0x5b4bdf){_0x938f8d=_0x5b4bdf;_0x1ea0d1=0xc8;}else{_0x1ea0d1=0xce;}_0x218c64['status'](_0x1ea0d1);return _0x218c64[_0x5996('0x28')]('Content-Range',_0x136668+'-'+_0x938f8d+'/'+_0x5b4bdf)[_0x5996('0x29')](_0x375c75);}return null;};}function patchUpdates(_0x1e9985){return function(_0xee8ee){try{jsonpatch['apply'](_0xee8ee,_0x1e9985,!![]);}catch(_0x85e02b){return BPromise[_0x5996('0x2a')](_0x85e02b);}return _0xee8ee[_0x5996('0x2b')]();};}function saveUpdates(_0x1a470a,_0x40c059){return function(_0x428fe9){if(_0x428fe9){return _0x428fe9['update'](_0x1a470a)[_0x5996('0x2c')](function(_0x10c7b5){return _0x10c7b5;});}return null;};}function removeEntity(_0x46a3c9,_0x44246e){return function(_0x464b70){if(_0x464b70){return _0x464b70[_0x5996('0x2d')]()[_0x5996('0x2c')](function(){var _0x539166=_0x464b70[_0x5996('0x2e')]({'plain':!![]});var _0x593133=_0x5996('0x2f');return db[_0x5996('0x30')][_0x5996('0x2d')]({'where':{'type':_0x593133,'resourceId':_0x539166['id']}})[_0x5996('0x2c')](function(){return _0x464b70;});})[_0x5996('0x2c')](function(){_0x46a3c9[_0x5996('0x23')](0xcc)[_0x5996('0x22')]();});}};}function handleEntityNotFound(_0x127837,_0x3d13a3){return function(_0x273d8b){if(!_0x273d8b){_0x127837[_0x5996('0x21')](0x194);}return _0x273d8b;};}function handleError(_0x53e7c1,_0x1d0c52){_0x1d0c52=_0x1d0c52||0x1f4;return function(_0x721f9f){logger[_0x5996('0x31')](_0x721f9f['stack']);if(_0x721f9f[_0x5996('0x32')]){delete _0x721f9f[_0x5996('0x32')];}_0x53e7c1[_0x5996('0x23')](_0x1d0c52)[_0x5996('0x33')](_0x721f9f);};}exports['index']=function(_0x10ec19,_0x2e1873){var _0x46953a={},_0x4ac2f9={},_0x508b4e={'count':0x0,'rows':[]};var _0x3d2132=_[_0x5996('0x34')](db[_0x5996('0x35')][_0x5996('0x36')],function(_0x5dc7ae){return{'name':_0x5dc7ae[_0x5996('0x37')],'type':_0x5dc7ae[_0x5996('0x38')][_0x5996('0x39')]};});_0x4ac2f9[_0x5996('0x3a')]=_[_0x5996('0x34')](_0x3d2132,_0x5996('0x32'));_0x4ac2f9[_0x5996('0x3b')]=_[_0x5996('0x3c')](_0x10ec19[_0x5996('0x3b')]);_0x4ac2f9[_0x5996('0x3d')]=_['intersection'](_0x4ac2f9[_0x5996('0x3a')],_0x4ac2f9[_0x5996('0x3b')]);_0x46953a[_0x5996('0x3e')]=_[_0x5996('0x3f')](_0x4ac2f9[_0x5996('0x3a')],qs['fields'](_0x10ec19[_0x5996('0x3b')][_0x5996('0x40')]));_0x46953a[_0x5996('0x3e')]=_0x46953a[_0x5996('0x3e')][_0x5996('0x41')]?_0x46953a['attributes']:_0x4ac2f9[_0x5996('0x3a')];if(!_0x10ec19['query'][_0x5996('0x42')](_0x5996('0x43'))){_0x46953a[_0x5996('0x25')]=qs[_0x5996('0x25')](_0x10ec19['query'][_0x5996('0x25')]);_0x46953a[_0x5996('0x24')]=qs[_0x5996('0x24')](_0x10ec19[_0x5996('0x3b')][_0x5996('0x24')]);}_0x46953a[_0x5996('0x44')]=qs['sort'](_0x10ec19['query'][_0x5996('0x45')]);_0x46953a[_0x5996('0x46')]=qs['filters'](_[_0x5996('0x47')](_0x10ec19['query'],_0x4ac2f9['filters']),_0x3d2132);if(_0x10ec19[_0x5996('0x3b')][_0x5996('0x48')]){_0x46953a[_0x5996('0x46')]=_[_0x5996('0x49')](_0x46953a[_0x5996('0x46')],{'$or':_[_0x5996('0x34')](_0x3d2132,function(_0x3f6cda){if(_0x3f6cda[_0x5996('0x38')]!==_0x5996('0x4a')){var _0x5d3b20={};_0x5d3b20[_0x3f6cda[_0x5996('0x32')]]={'$like':'%'+_0x10ec19['query'][_0x5996('0x48')]+'%'};return _0x5d3b20;}})});}_0x46953a=_[_0x5996('0x49')]({},_0x46953a,_0x10ec19[_0x5996('0x4b')]);var _0xf018b0={'where':_0x46953a[_0x5996('0x46')]};return db[_0x5996('0x35')][_0x5996('0x27')](_0xf018b0)[_0x5996('0x2c')](function(_0x2d5a0e){_0x508b4e['count']=_0x2d5a0e;if(_0x10ec19[_0x5996('0x3b')][_0x5996('0x4c')]){_0x46953a['include']=[{'all':!![]}];}return db[_0x5996('0x35')]['findAll'](_0x46953a);})[_0x5996('0x2c')](function(_0xb727fe){_0x508b4e[_0x5996('0x4d')]=_0xb727fe;return _0x508b4e;})[_0x5996('0x2c')](respondWithFilteredResult(_0x2e1873,_0x46953a))[_0x5996('0x4e')](handleError(_0x2e1873,null));};exports[_0x5996('0x4f')]=function(_0x3f893c,_0x4c888c){var _0x4e5fb2={'raw':!![],'where':{'id':_0x3f893c[_0x5996('0x50')]['id']}},_0xc2042e={};_0xc2042e[_0x5996('0x3a')]=_[_0x5996('0x3c')](db[_0x5996('0x35')]['rawAttributes']);_0xc2042e[_0x5996('0x3b')]=_['keys'](_0x3f893c[_0x5996('0x3b')]);_0xc2042e[_0x5996('0x3d')]=_[_0x5996('0x3f')](_0xc2042e['model'],_0xc2042e[_0x5996('0x3b')]);_0x4e5fb2['attributes']=_[_0x5996('0x3f')](_0xc2042e[_0x5996('0x3a')],qs[_0x5996('0x40')](_0x3f893c[_0x5996('0x3b')][_0x5996('0x40')]));_0x4e5fb2[_0x5996('0x3e')]=_0x4e5fb2['attributes'][_0x5996('0x41')]?_0x4e5fb2[_0x5996('0x3e')]:_0xc2042e['model'];if(_0x3f893c[_0x5996('0x3b')][_0x5996('0x4c')]){_0x4e5fb2[_0x5996('0x51')]=[{'all':!![]}];}_0x4e5fb2=_[_0x5996('0x49')]({},_0x4e5fb2,_0x3f893c[_0x5996('0x4b')]);return db['MailQueue']['find'](_0x4e5fb2)[_0x5996('0x2c')](handleEntityNotFound(_0x4c888c,null))[_0x5996('0x2c')](respondWithResult(_0x4c888c,null))['catch'](handleError(_0x4c888c,null));};exports[_0x5996('0x52')]=function(_0xd03209,_0x111695){return db[_0x5996('0x35')][_0x5996('0x52')](_0xd03209[_0x5996('0x53')],{})[_0x5996('0x2c')](function(_0xe6fd9a){var _0x51026a=_0xd03209[_0x5996('0x54')][_0x5996('0x2e')]({'plain':!![]});if(!_0x51026a)throw new Error(_0x5996('0x55'));if(_0x51026a[_0x5996('0x56')]===_0x5996('0x54')){var _0x363132=_0xe6fd9a[_0x5996('0x2e')]({'plain':!![]});var _0x431da8='MailQueues';return db[_0x5996('0x57')]['find']({'where':{'name':_0x431da8,'userProfileId':_0x51026a[_0x5996('0x58')]},'raw':!![]})[_0x5996('0x2c')](function(_0xff5d9b){if(_0xff5d9b&&_0xff5d9b['autoAssociation']===0x0){return db[_0x5996('0x30')][_0x5996('0x52')]({'name':_0x363132[_0x5996('0x32')],'resourceId':_0x363132['id'],'type':_0xff5d9b[_0x5996('0x32')],'sectionId':_0xff5d9b['id']},{})['then'](function(){return _0xe6fd9a;});}else{return _0xe6fd9a;}})[_0x5996('0x4e')](function(_0x148343){logger[_0x5996('0x31')](_0x5996('0x59'),_0x148343);throw _0x148343;});}return _0xe6fd9a;})['then'](respondWithResult(_0x111695,0xc9))[_0x5996('0x4e')](handleError(_0x111695,null));};exports[_0x5996('0x5a')]=function(_0x1de52a,_0x4cbc0d){if(_0x1de52a[_0x5996('0x53')]['id']){delete _0x1de52a[_0x5996('0x53')]['id'];}return db[_0x5996('0x35')][_0x5996('0x5b')]({'where':{'id':_0x1de52a[_0x5996('0x50')]['id']}})[_0x5996('0x2c')](handleEntityNotFound(_0x4cbc0d,null))['then'](saveUpdates(_0x1de52a[_0x5996('0x53')],null))['then'](respondWithResult(_0x4cbc0d,null))['catch'](handleError(_0x4cbc0d,null));};exports[_0x5996('0x2d')]=function(_0x5ad9b0,_0x4e107f){return db[_0x5996('0x35')][_0x5996('0x5b')]({'where':{'id':_0x5ad9b0['params']['id']}})[_0x5996('0x2c')](handleEntityNotFound(_0x4e107f,null))['then'](removeEntity(_0x4e107f,null))[_0x5996('0x4e')](handleError(_0x4e107f,null));};exports[_0x5996('0x5c')]=function(_0x1d5a49,_0x3a1b8f){return db['MailQueue'][_0x5996('0x5c')]()['then'](respondWithResult(_0x3a1b8f,null))[_0x5996('0x4e')](handleError(_0x3a1b8f,null));};exports[_0x5996('0x5d')]=function(_0x120550,_0x32773e,_0x12058e){var _0x33bb6d={'raw':!![],'where':{}},_0x29fed3={},_0x2cf263;return db[_0x5996('0x35')][_0x5996('0x5e')]({'where':{'id':_0x120550[_0x5996('0x50')]['id']}})['then'](handleEntityNotFound(_0x32773e,null))['then'](function(_0xcdb5f9){if(_0xcdb5f9){_0x2cf263=_0xcdb5f9[_0x5996('0x2e')]({'plain':!![]});_0x29fed3[_0x5996('0x3a')]=_[_0x5996('0x3c')](db[_0x5996('0x5f')][_0x5996('0x36')]);_0x29fed3[_0x5996('0x3b')]=_[_0x5996('0x3c')](_0x120550[_0x5996('0x3b')]);_0x29fed3['filters']=_[_0x5996('0x3f')](_0x29fed3['model'],_0x29fed3['query']);_0x33bb6d['attributes']=_['intersection'](_0x29fed3[_0x5996('0x3a')],qs[_0x5996('0x40')](_0x120550['query'][_0x5996('0x40')]));_0x33bb6d[_0x5996('0x3e')]=_0x33bb6d[_0x5996('0x3e')][_0x5996('0x41')]?_0x33bb6d['attributes']:_0x29fed3[_0x5996('0x3a')];if(!_0x120550['query'][_0x5996('0x42')](_0x5996('0x43'))){_0x33bb6d[_0x5996('0x25')]=qs['limit'](_0x120550[_0x5996('0x3b')][_0x5996('0x25')]);_0x33bb6d['offset']=qs[_0x5996('0x24')](_0x120550[_0x5996('0x3b')][_0x5996('0x24')]);}_0x33bb6d[_0x5996('0x44')]=qs[_0x5996('0x45')](_0x120550[_0x5996('0x3b')][_0x5996('0x45')]);_0x33bb6d[_0x5996('0x46')]=qs[_0x5996('0x3d')](_[_0x5996('0x47')](_0x120550[_0x5996('0x3b')],_0x29fed3[_0x5996('0x3d')]));_0x33bb6d[_0x5996('0x46')]['MailQueueId']=_0xcdb5f9['id'];if(_0x120550[_0x5996('0x3b')][_0x5996('0x48')]){_0x33bb6d[_0x5996('0x46')]=_['merge'](_0x33bb6d[_0x5996('0x46')],{'$or':_[_0x5996('0x34')](_0x33bb6d[_0x5996('0x3e')],function(_0xe69015){var _0xf5200b={};_0xf5200b[_0xe69015]={'$like':'%'+_0x120550['query'][_0x5996('0x48')]+'%'};return _0xf5200b;})});}_0x33bb6d=_[_0x5996('0x49')]({},_0x33bb6d,_0x120550[_0x5996('0x4b')]);return db[_0x5996('0x5f')][_0x5996('0x60')](_0x33bb6d);}})['then'](function(_0x2ea1e4){if(_0x2ea1e4){return db[_0x5996('0x61')][_0x5996('0x62')]({'where':{'id':_[_0x5996('0x34')](_0x2ea1e4,_0x5996('0x63')),'role':_0x5996('0x64')},'attributes':['id',_0x5996('0x32'),'mailPause',_0x5996('0x65'),_0x5996('0x66')]});}})[_0x5996('0x2c')](function(_0x4d82ec){if(_0x4d82ec){return{'count':_0x4d82ec[_0x5996('0x27')],'rows':_['map'](_0x4d82ec[_0x5996('0x4d')],function(_0x12d6a4){return{'membername':_0x12d6a4[_0x5996('0x32')],'UserId':_0x12d6a4['id'],'queue_name':_0x2cf263[_0x5996('0x32')],'MailQueueId':_0x2cf263['id'],'interface':util[_0x5996('0x67')]('%s/%s',_0x5996('0x68'),_0x12d6a4[_0x5996('0x32')]),'penalty':0x0,'paused':_0x12d6a4[_0x5996('0x69')],'createdAt':_0x12d6a4[_0x5996('0x66')],'updatedAt':_0x12d6a4[_0x5996('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5996('0x2c')](respondWithFilteredResult(_0x32773e,_0x33bb6d))[_0x5996('0x4e')](handleError(_0x32773e,null));};exports[_0x5996('0x6a')]=function(_0x5941aa,_0x8d435c,_0x211bee){var _0x11e4f3={};var _0x518b7a={};var _0x529874;var _0x34b601;return db[_0x5996('0x35')][_0x5996('0x5e')]({'where':{'id':_0x5941aa[_0x5996('0x50')]['id']}})[_0x5996('0x2c')](handleEntityNotFound(_0x8d435c,null))[_0x5996('0x2c')](function(_0x2110df){if(_0x2110df){_0x529874=_0x2110df;_0x518b7a[_0x5996('0x3a')]=_[_0x5996('0x3c')](db['Team'][_0x5996('0x36')]);_0x518b7a[_0x5996('0x3b')]=_[_0x5996('0x3c')](_0x5941aa[_0x5996('0x3b')]);_0x518b7a[_0x5996('0x3d')]=_[_0x5996('0x3f')](_0x518b7a[_0x5996('0x3a')],_0x518b7a[_0x5996('0x3b')]);_0x11e4f3['attributes']=_[_0x5996('0x3f')](_0x518b7a[_0x5996('0x3a')],qs[_0x5996('0x40')](_0x5941aa[_0x5996('0x3b')][_0x5996('0x40')]));_0x11e4f3[_0x5996('0x3e')]=_0x11e4f3[_0x5996('0x3e')][_0x5996('0x41')]?_0x11e4f3['attributes']:_0x518b7a[_0x5996('0x3a')];_0x11e4f3[_0x5996('0x44')]=qs[_0x5996('0x45')](_0x5941aa[_0x5996('0x3b')][_0x5996('0x45')]);_0x11e4f3[_0x5996('0x46')]=qs[_0x5996('0x3d')](_[_0x5996('0x47')](_0x5941aa[_0x5996('0x3b')],_0x518b7a[_0x5996('0x3d')]));if(_0x5941aa[_0x5996('0x3b')][_0x5996('0x48')]){_0x11e4f3['where']=_[_0x5996('0x49')](_0x11e4f3[_0x5996('0x46')],{'$or':_[_0x5996('0x34')](_0x11e4f3['attributes'],function(_0x183d3e){var _0x3a773d={};_0x3a773d[_0x183d3e]={'$like':'%'+_0x5941aa[_0x5996('0x3b')]['filter']+'%'};return _0x3a773d;})});}_0x11e4f3=_[_0x5996('0x49')]({},_0x11e4f3,_0x5941aa[_0x5996('0x4b')]);return _0x529874[_0x5996('0x6a')](_0x11e4f3);}})['then'](function(_0x39adb0){if(_0x39adb0){_0x34b601=_0x39adb0[_0x5996('0x41')];if(!_0x5941aa[_0x5996('0x3b')][_0x5996('0x42')](_0x5996('0x43'))){_0x11e4f3[_0x5996('0x25')]=qs[_0x5996('0x25')](_0x5941aa['query'][_0x5996('0x25')]);_0x11e4f3[_0x5996('0x24')]=qs['offset'](_0x5941aa[_0x5996('0x3b')][_0x5996('0x24')]);}return _0x529874[_0x5996('0x6a')](_0x11e4f3);}})[_0x5996('0x2c')](function(_0x3a5f2e){if(_0x3a5f2e){return _0x3a5f2e?{'count':_0x34b601,'rows':_0x3a5f2e}:null;}})[_0x5996('0x2c')](respondWithResult(_0x8d435c,null))['catch'](handleError(_0x8d435c,null));};exports[_0x5996('0x6b')]=function(_0x289a1a,_0x3373d3,_0x29ed94){var _0xdddc0=_0x289a1a[_0x5996('0x53')][_0x5996('0x6c')];return db['Team'][_0x5996('0x60')]({'where':{'id':_0xdddc0},'attributes':['id'],'include':[{'model':db[_0x5996('0x61')],'as':_0x5996('0x6d'),'attributes':['id',_0x5996('0x32'),_0x5996('0x6e'),'voicePause','interface'],'raw':!![]}]})[_0x5996('0x2c')](function(_0xafe130){if(_0xafe130){var _0xce55df=_[_0x5996('0x6f')](_0xafe130,function(_0x18e127){var _0x319e9a=_0x18e127[_0x5996('0x2e')]({'plain':!![]});return _0x319e9a[_0x5996('0x6d')];});return db[_0x5996('0x35')]['find']({'where':{'id':_0x289a1a['params']['id']}})[_0x5996('0x2c')](function(_0x21170d){return db[_0x5996('0x70')]['transaction'](function(_0x25252d){return _0x21170d[_0x5996('0x6b')](_0xdddc0,{'transaction':_0x25252d})['then'](function(){return BPromise[_0x5996('0x71')](_0xce55df,function(_0x3cc695){return db[_0x5996('0x5f')]['findOrCreate']({'where':{'UserId':_0x3cc695['id'],'MailQueueId':_0x289a1a[_0x5996('0x50')]['id']},'transaction':_0x25252d});});})[_0x5996('0x2c')](function(){_0xce55df['forEach'](function(_0x4d7133){socket[_0x5996('0x72')](_0x5996('0x73'),{'UserId':_0x4d7133['id'],'MailQueueId':_0x21170d['id']});});});});});}})[_0x5996('0x2c')](respondWithStatusCode(_0x3373d3,null))[_0x5996('0x4e')](handleError(_0x3373d3,null));};exports['removeTeams']=function(_0x5f5be1,_0x262612,_0x1382f2){return db[_0x5996('0x74')][_0x5996('0x60')]({'where':{'id':_0x5f5be1[_0x5996('0x3b')][_0x5996('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5996('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x5996('0x2c')](handleEntityNotFound(_0x262612,null))['then'](function(_0x622e16){var _0x26eb64=_['map'](_0x622e16,'id');var _0x2b6cc5=[];var _0x4f63eb=[];var _0x37cb46=squel[_0x5996('0x75')]();_0x37cb46[_0x5996('0x76')](_0x5996('0x77'))[_0x5996('0x78')](_0x5996('0x79'),'tq')[_0x5996('0x7a')](_0x5996('0x7b'),'ut',_0x5996('0x7c'))[_0x5996('0x46')](_0x5996('0x7d'),_0x5f5be1[_0x5996('0x50')]['id']);for(var _0x9f7799=0x0;_0x9f7799<_0x622e16[_0x5996('0x41')];_0x9f7799+=0x1){let _0x2e2333=_0x622e16[_0x9f7799];for(var _0x1c05ff=0x0;_0x1c05ff<_0x2e2333[_0x5996('0x6d')][_0x5996('0x41')];_0x1c05ff+=0x1){let _0xe41cd1=_0x2e2333['Agents'][_0x1c05ff];var _0x10f9a3=_0x37cb46[_0x5996('0x7e')]();_0x10f9a3['where'](_0x5996('0x7f'),_0xe41cd1['id']);_0x4f63eb[_0x5996('0x80')](db[_0x5996('0x70')][_0x5996('0x3b')](_0x10f9a3[_0x5996('0x81')](),{'type':db['sequelize'][_0x5996('0x82')]['SELECT']})['then'](function(_0x5903e6){if(_0x5903e6[_0x5996('0x41')]===0x1){return _0xe41cd1['id'];}else{var _0x13ae69=_[_0x5996('0x83')](_[_0x5996('0x34')](_0x5903e6,'TeamId'),function(_0x29be6a){return _[_0x5996('0x84')](_0x26eb64,_0x29be6a);});if(_0x13ae69){return _0xe41cd1['id'];}}}));}}return BPromise[_0x5996('0x85')](_0x4f63eb)[_0x5996('0x2c')](function(_0x1b17f8){_0x2b6cc5=_(_0x2b6cc5)['union'](_0x1b17f8)[_0x5996('0x86')]()[_0x5996('0x87')]();return db[_0x5996('0x35')][_0x5996('0x5b')]({'where':{'id':_0x5f5be1[_0x5996('0x50')]['id']}})[_0x5996('0x2c')](function(_0x19050a){return db[_0x5996('0x70')][_0x5996('0x88')](function(_0x11e8cf){return _0x19050a[_0x5996('0x89')](_0x5f5be1[_0x5996('0x3b')][_0x5996('0x6c')],{'transaction':_0x11e8cf})[_0x5996('0x2c')](function(){if(!_['isEmpty'](_0x2b6cc5)){return _0x19050a[_0x5996('0x8a')](_0x2b6cc5,{'transaction':_0x11e8cf});}})[_0x5996('0x2c')](function(){_0x2b6cc5[_0x5996('0x8b')](function(_0x59018d){socket[_0x5996('0x72')](_0x5996('0x8c'),{'UserId':_0x59018d,'MailQueueId':_0x19050a['id']});});});});});});})[_0x5996('0x2c')](respondWithStatusCode(_0x262612,null))[_0x5996('0x4e')](handleError(_0x262612,null));};exports['addAgents']=function(_0x51c6c1,_0x4fe596,_0x47193b){return db['MailQueue'][_0x5996('0x5b')]({'where':{'id':_0x51c6c1['params']['id']}})['then'](handleEntityNotFound(_0x4fe596,null))['then'](function(_0x27b214){if(_0x27b214){return _0x27b214[_0x5996('0x8d')](_0x51c6c1[_0x5996('0x53')][_0x5996('0x6c')],_[_0x5996('0x8e')](_0x51c6c1[_0x5996('0x53')],[_0x5996('0x6c'),'id'])||{})[_0x5996('0x8f')](function(_0x1e3c6e){for(var _0x10a6d2=0x0;_0x10a6d2<_0x51c6c1['body'][_0x5996('0x6c')][_0x5996('0x41')];_0x10a6d2+=0x1){socket[_0x5996('0x72')]('userMailQueue:save',{'UserId':Number(_0x51c6c1[_0x5996('0x53')][_0x5996('0x6c')][_0x10a6d2]),'MailQueueId':Number(_0x51c6c1[_0x5996('0x50')]['id'])});}return _0x1e3c6e;});}})['then'](respondWithResult(_0x4fe596,null))[_0x5996('0x4e')](handleError(_0x4fe596,null));};exports[_0x5996('0x8a')]=function(_0x4e2adb,_0x3312d3,_0x9e3aaa){return db[_0x5996('0x35')][_0x5996('0x5b')]({'where':{'id':_0x4e2adb[_0x5996('0x50')]['id']}})[_0x5996('0x2c')](handleEntityNotFound(_0x3312d3,null))[_0x5996('0x2c')](function(_0x59988f){if(_0x59988f){return _0x59988f[_0x5996('0x8a')](_0x4e2adb[_0x5996('0x3b')][_0x5996('0x6c')])[_0x5996('0x2c')](function(){if(_[_0x5996('0x90')](_0x4e2adb[_0x5996('0x3b')]['ids'])){for(var _0x48338c=0x0;_0x48338c<_0x4e2adb['query'][_0x5996('0x6c')][_0x5996('0x41')];_0x48338c+=0x1){socket[_0x5996('0x72')](_0x5996('0x8c'),{'UserId':Number(_0x4e2adb[_0x5996('0x3b')]['ids'][_0x48338c]),'MailQueueId':Number(_0x4e2adb['params']['id'])});}}else{socket[_0x5996('0x72')]('userMailQueue:remove',{'UserId':Number(_0x4e2adb[_0x5996('0x3b')]['ids']),'MailQueueId':Number(_0x4e2adb[_0x5996('0x50')]['id'])});}});}})[_0x5996('0x2c')](respondWithStatusCode(_0x3312d3,null))['catch'](handleError(_0x3312d3,null));};exports[_0x5996('0x91')]=function(_0x34d167,_0x3fa929,_0x4bedcf){var _0x5289ad={};var _0x1d1b3d={};var _0x422889;var _0x17be94;return db['MailQueue']['findOne']({'where':{'id':_0x34d167['params']['id']}})['then'](handleEntityNotFound(_0x3fa929,null))['then'](function(_0x528545){if(_0x528545){_0x422889=_0x528545;_0x1d1b3d['model']=_[_0x5996('0x3c')](db['User'][_0x5996('0x36')]);_0x1d1b3d['query']=_[_0x5996('0x3c')](_0x34d167[_0x5996('0x3b')]);_0x1d1b3d['filters']=_['intersection'](_0x1d1b3d[_0x5996('0x3a')],_0x1d1b3d['query']);_0x5289ad[_0x5996('0x3e')]=_['intersection'](_0x1d1b3d['model'],qs[_0x5996('0x40')](_0x34d167[_0x5996('0x3b')][_0x5996('0x40')]));_0x5289ad[_0x5996('0x3e')]=_0x5289ad[_0x5996('0x3e')][_0x5996('0x41')]?_0x5289ad['attributes']:_0x1d1b3d['model'];_0x5289ad['order']=qs[_0x5996('0x45')](_0x34d167[_0x5996('0x3b')][_0x5996('0x45')]);_0x5289ad[_0x5996('0x46')]=qs[_0x5996('0x3d')](_['pick'](_0x34d167[_0x5996('0x3b')],_0x1d1b3d[_0x5996('0x3d')]));if(_0x34d167[_0x5996('0x3b')]['filter']){_0x5289ad['where']=_[_0x5996('0x49')](_0x5289ad[_0x5996('0x46')],{'$or':_[_0x5996('0x34')](_0x5289ad[_0x5996('0x3e')],function(_0x8e2db9){var _0x35c225={};_0x35c225[_0x8e2db9]={'$like':'%'+_0x34d167['query'][_0x5996('0x48')]+'%'};return _0x35c225;})});}_0x5289ad=_[_0x5996('0x49')]({},_0x5289ad,_0x34d167['options']);return _0x422889['getAgents'](_0x5289ad);}})['then'](function(_0x335ea3){if(_0x335ea3){_0x17be94=_0x335ea3[_0x5996('0x41')];if(!_0x34d167[_0x5996('0x3b')][_0x5996('0x42')](_0x5996('0x43'))){_0x5289ad[_0x5996('0x25')]=qs[_0x5996('0x25')](_0x34d167['query'][_0x5996('0x25')]);_0x5289ad['offset']=qs[_0x5996('0x24')](_0x34d167[_0x5996('0x3b')][_0x5996('0x24')]);}return _0x422889['getAgents'](_0x5289ad);}})['then'](function(_0x5ae2ba){if(_0x5ae2ba){return _0x5ae2ba?{'count':_0x17be94,'rows':_0x5ae2ba}:null;}})['then'](respondWithResult(_0x3fa929,null))[_0x5996('0x4e')](handleError(_0x3fa929,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 7df780e..9fcbb97 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 _0x8b16=['update','remove','emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners','save'];(function(_0x5c7909,_0x583b5a){var _0x4b0348=function(_0x35d02f){while(--_0x35d02f){_0x5c7909['push'](_0x5c7909['shift']());}};_0x4b0348(++_0x583b5a);}(_0x8b16,0x125));var _0x68b1=function(_0x809314,_0xaf27c0){_0x809314=_0x809314-0x0;var _0x1a94b6=_0x8b16[_0x809314];return _0x1a94b6;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x68b1('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x68b1('0x1')](0x0);var events={'afterCreate':_0x68b1('0x2'),'afterUpdate':_0x68b1('0x3'),'afterDestroy':_0x68b1('0x4')};function emitEvent(_0xde97dc){return function(_0x298e86,_0x2a0027,_0x41b93b){MailQueueEvents[_0x68b1('0x5')](_0xde97dc+':'+_0x298e86['id'],_0x298e86);MailQueueEvents[_0x68b1('0x5')](_0xde97dc,_0x298e86);_0x41b93b(null);};}for(var e in events){if(events[_0x68b1('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x68b1('0x7')]=MailQueueEvents; \ No newline at end of file +var _0xc0bb=['setMaxListeners','save','update','remove','emit','hasOwnProperty','events'];(function(_0x105953,_0x15b1d1){var _0x401196=function(_0x5e4739){while(--_0x5e4739){_0x105953['push'](_0x105953['shift']());}};_0x401196(++_0x15b1d1);}(_0xc0bb,0x8b));var _0xbc0b=function(_0x8a7e38,_0x473a5d){_0x8a7e38=_0x8a7e38-0x0;var _0x228609=_0xc0bb[_0x8a7e38];return _0x228609;};'use strict';var EventEmitter=require(_0xbc0b('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xbc0b('0x1')](0x0);var events={'afterCreate':_0xbc0b('0x2'),'afterUpdate':_0xbc0b('0x3'),'afterDestroy':_0xbc0b('0x4')};function emitEvent(_0xbdc169){return function(_0x51c06a,_0x4ff6e4,_0x15d82b){MailQueueEvents['emit'](_0xbdc169+':'+_0x51c06a['id'],_0x51c06a);MailQueueEvents[_0xbc0b('0x5')](_0xbdc169,_0x51c06a);_0x15d82b(null);};}for(var e in events){if(events[_0xbc0b('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 97b6ca8..fb5048e 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 _0x30cc=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./mailQueue.attributes','exports','define','lodash','util'];(function(_0x51fca4,_0x1d3852){var _0x1ba7da=function(_0x2abccb){while(--_0x2abccb){_0x51fca4['push'](_0x51fca4['shift']());}};_0x1ba7da(++_0x1d3852);}(_0x30cc,0xae));var _0xc30c=function(_0x153e7d,_0x10a35f){_0x153e7d=_0x153e7d-0x0;var _0x3c22dd=_0x30cc[_0x153e7d];return _0x3c22dd;};'use strict';var _=require(_0xc30c('0x0'));var util=require(_0xc30c('0x1'));var logger=require(_0xc30c('0x2'))(_0xc30c('0x3'));var moment=require(_0xc30c('0x4'));var BPromise=require(_0xc30c('0x5'));var rp=require(_0xc30c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc30c('0x7'));var attributes=require(_0xc30c('0x8'));module[_0xc30c('0x9')]=function(_0x20889e,_0x4c0fbb){return _0x20889e[_0xc30c('0xa')]('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4930=['api','moment','bluebird','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x4930,0xae));var _0x0493=function(_0x485c5e,_0x3dc133){_0x485c5e=_0x485c5e-0x0;var _0x10585c=_0x4930[_0x485c5e];return _0x10585c;};'use strict';var _=require(_0x0493('0x0'));var util=require(_0x0493('0x1'));var logger=require('../../config/logger')(_0x0493('0x2'));var moment=require(_0x0493('0x3'));var BPromise=require(_0x0493('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0493('0x5'));var attributes=require(_0x0493('0x6'));module[_0x0493('0x7')]=function(_0x155492,_0x4a23d7){return _0x155492[_0x0493('0x8')](_0x0493('0x9'),attributes,{'tableName':_0x0493('0xa'),'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 113cb20..a00a826 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 _0x552d=['request\x20sent','debug','stringify','code','error','message','info','result','GetMailQueue','findAll','options','raw','where','attributes','limit','include','map','model','catch','MailQueue','find','ShowMailQueue','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x552d,0xbe));var _0xd552=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x552d[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xd552('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd552('0x1'));var rs=require(_0xd552('0x2'));var fs=require('fs');var Redis=require(_0xd552('0x3'));var db=require(_0xd552('0x4'))['db'];var utils=require(_0xd552('0x5'));var logger=require(_0xd552('0x6'))(_0xd552('0x7'));var config=require(_0xd552('0x8'));var jayson=require(_0xd552('0x9'));var client=jayson['client'][_0xd552('0xa')]({'port':0x232a});config[_0xd552('0xb')]=_[_0xd552('0xc')](config[_0xd552('0xb')],{'host':_0xd552('0xd'),'port':0x18eb});var socket=require(_0xd552('0xe'))(new Redis(config['redis']));require(_0xd552('0xf'))[_0xd552('0x10')](socket);function respondWithRpcPromise(_0x2063a2,_0x49cd85,_0x3efaca){return new BPromise(function(_0x356cc2,_0x588e21){return client[_0xd552('0x11')](_0x2063a2,_0x3efaca)[_0xd552('0x12')](function(_0x3484a4){logger['info'](_0xd552('0x13'),_0x49cd85,_0xd552('0x14'));logger[_0xd552('0x15')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x49cd85,_0xd552('0x14'),JSON[_0xd552('0x16')](_0x3484a4));if(_0x3484a4['error']){if(_0x3484a4['error'][_0xd552('0x17')]===0x1f4){logger[_0xd552('0x18')](_0xd552('0x13'),_0x49cd85,_0x3484a4['error'][_0xd552('0x19')]);return _0x588e21(_0x3484a4[_0xd552('0x18')]['message']);}logger[_0xd552('0x18')](_0xd552('0x13'),_0x49cd85,_0x3484a4['error'][_0xd552('0x19')]);return _0x356cc2(_0x3484a4[_0xd552('0x18')][_0xd552('0x19')]);}else{logger[_0xd552('0x1a')](_0xd552('0x13'),_0x49cd85,_0xd552('0x14'));_0x356cc2(_0x3484a4[_0xd552('0x1b')]['message']);}})['catch'](function(_0x4eaf38){logger[_0xd552('0x18')]('MailQueue,\x20%s,\x20%s',_0x49cd85,_0x4eaf38);_0x588e21(_0x4eaf38);});});}exports[_0xd552('0x1c')]=function(_0x406b5d){var _0x207d0e=this;return new Promise(function(_0x5de25c,_0x497ca5){return db['MailQueue'][_0xd552('0x1d')]({'raw':_0x406b5d[_0xd552('0x1e')]?_0x406b5d['options'][_0xd552('0x1f')]===undefined?!![]:![]:!![],'where':_0x406b5d[_0xd552('0x1e')]?_0x406b5d[_0xd552('0x1e')][_0xd552('0x20')]||null:null,'attributes':_0x406b5d['options']?_0x406b5d[_0xd552('0x1e')][_0xd552('0x21')]||null:null,'limit':_0x406b5d['options']?_0x406b5d[_0xd552('0x1e')][_0xd552('0x22')]||null:null,'include':_0x406b5d['options']?_0x406b5d[_0xd552('0x1e')][_0xd552('0x23')]?_[_0xd552('0x24')](_0x406b5d[_0xd552('0x1e')][_0xd552('0x23')],function(_0x3085b9){return{'model':db[_0x3085b9[_0xd552('0x25')]],'as':_0x3085b9['as'],'attributes':_0x3085b9[_0xd552('0x21')],'include':_0x3085b9[_0xd552('0x23')]?_[_0xd552('0x24')](_0x3085b9[_0xd552('0x23')],function(_0x4cc2db){return{'model':db[_0x4cc2db['model']],'as':_0x4cc2db['as'],'attributes':_0x4cc2db['attributes'],'include':_0x4cc2db[_0xd552('0x23')]?_[_0xd552('0x24')](_0x4cc2db[_0xd552('0x23')],function(_0x12539d){return{'model':db[_0x12539d[_0xd552('0x25')]],'as':_0x12539d['as'],'attributes':_0x12539d[_0xd552('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd552('0x12')](function(_0x36f095){logger[_0xd552('0x1a')](_0xd552('0x1c'),_0x406b5d);logger[_0xd552('0x15')](_0xd552('0x1c'),_0x406b5d,JSON['stringify'](_0x36f095));_0x5de25c(_0x36f095);})[_0xd552('0x26')](function(_0x11ea96){logger[_0xd552('0x18')](_0xd552('0x1c'),_0x11ea96[_0xd552('0x19')],_0x406b5d);_0x497ca5(_0x207d0e['error'](0x1f4,_0x11ea96[_0xd552('0x19')]));});});};exports['ShowMailQueue']=function(_0x53a293){var _0x30fbed=this;return new Promise(function(_0x4c6e4a,_0x5c9f7a){return db[_0xd552('0x27')][_0xd552('0x28')]({'raw':_0x53a293[_0xd552('0x1e')]?_0x53a293['options']['raw']===undefined?!![]:![]:!![],'where':_0x53a293[_0xd552('0x1e')]?_0x53a293['options'][_0xd552('0x20')]||null:null,'attributes':_0x53a293[_0xd552('0x1e')]?_0x53a293['options'][_0xd552('0x21')]||null:null,'include':_0x53a293[_0xd552('0x1e')]?_0x53a293[_0xd552('0x1e')]['include']?_['map'](_0x53a293['options'][_0xd552('0x23')],function(_0x126f1a){return{'model':db[_0x126f1a[_0xd552('0x25')]],'as':_0x126f1a['as'],'attributes':_0x126f1a['attributes'],'include':_0x126f1a[_0xd552('0x23')]?_[_0xd552('0x24')](_0x126f1a[_0xd552('0x23')],function(_0x16242d){return{'model':db[_0x16242d['model']],'as':_0x16242d['as'],'attributes':_0x16242d['attributes'],'include':_0x16242d[_0xd552('0x23')]?_[_0xd552('0x24')](_0x16242d[_0xd552('0x23')],function(_0x1b9fbb){return{'model':db[_0x1b9fbb['model']],'as':_0x1b9fbb['as'],'attributes':_0x1b9fbb[_0xd552('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd552('0x12')](function(_0x30881f){logger[_0xd552('0x1a')]('ShowMailQueue',_0x53a293);logger['debug'](_0xd552('0x29'),_0x53a293,JSON[_0xd552('0x16')](_0x30881f));_0x4c6e4a(_0x30881f);})[_0xd552('0x26')](function(_0x5a7646){logger[_0xd552('0x18')](_0xd552('0x29'),_0x5a7646[_0xd552('0x19')],_0x53a293);_0x5c9f7a(_0x30fbed[_0xd552('0x18')](0x1f4,_0x5a7646[_0xd552('0x19')]));});});}; \ No newline at end of file +var _0xddf2=['options','attributes','limit','include','map','model','debug','ShowMailQueue','find','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailQueue','MailQueue','findAll','raw','where'];(function(_0x16fd68,_0x3d394d){var _0x12cf8e=function(_0x4728c1){while(--_0x4728c1){_0x16fd68['push'](_0x16fd68['shift']());}};_0x12cf8e(++_0x3d394d);}(_0xddf2,0x1dd));var _0x2ddf=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xddf2[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2ddf('0x0'));var BPromise=require('bluebird');var rs=require(_0x2ddf('0x1'));var fs=require('fs');var Redis=require(_0x2ddf('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ddf('0x3'));var logger=require(_0x2ddf('0x4'))(_0x2ddf('0x5'));var config=require('../../config/environment');var jayson=require(_0x2ddf('0x6'));var client=jayson['client'][_0x2ddf('0x7')]({'port':0x232a});config[_0x2ddf('0x8')]=_[_0x2ddf('0x9')](config['redis'],{'host':_0x2ddf('0xa'),'port':0x18eb});var socket=require(_0x2ddf('0xb'))(new Redis(config[_0x2ddf('0x8')]));require('./mailQueue.socket')[_0x2ddf('0xc')](socket);function respondWithRpcPromise(_0x3a2bdc,_0x3875c0,_0x58ec63){return new BPromise(function(_0xce1078,_0x1635e5){return client[_0x2ddf('0xd')](_0x3a2bdc,_0x58ec63)[_0x2ddf('0xe')](function(_0xcd8ca0){logger['info'](_0x2ddf('0xf'),_0x3875c0,_0x2ddf('0x10'));logger['debug'](_0x2ddf('0x11'),_0x3875c0,'request\x20sent',JSON[_0x2ddf('0x12')](_0xcd8ca0));if(_0xcd8ca0[_0x2ddf('0x13')]){if(_0xcd8ca0[_0x2ddf('0x13')][_0x2ddf('0x14')]===0x1f4){logger[_0x2ddf('0x13')](_0x2ddf('0xf'),_0x3875c0,_0xcd8ca0['error'][_0x2ddf('0x15')]);return _0x1635e5(_0xcd8ca0[_0x2ddf('0x13')][_0x2ddf('0x15')]);}logger['error'](_0x2ddf('0xf'),_0x3875c0,_0xcd8ca0[_0x2ddf('0x13')]['message']);return _0xce1078(_0xcd8ca0[_0x2ddf('0x13')][_0x2ddf('0x15')]);}else{logger[_0x2ddf('0x16')](_0x2ddf('0xf'),_0x3875c0,_0x2ddf('0x10'));_0xce1078(_0xcd8ca0[_0x2ddf('0x17')][_0x2ddf('0x15')]);}})[_0x2ddf('0x18')](function(_0x4fa10c){logger[_0x2ddf('0x13')](_0x2ddf('0xf'),_0x3875c0,_0x4fa10c);_0x1635e5(_0x4fa10c);});});}exports[_0x2ddf('0x19')]=function(_0x44d3f4){var _0x46ed3a=this;return new Promise(function(_0x29cad2,_0x41f102){return db[_0x2ddf('0x1a')][_0x2ddf('0x1b')]({'raw':_0x44d3f4['options']?_0x44d3f4['options'][_0x2ddf('0x1c')]===undefined?!![]:![]:!![],'where':_0x44d3f4['options']?_0x44d3f4['options'][_0x2ddf('0x1d')]||null:null,'attributes':_0x44d3f4[_0x2ddf('0x1e')]?_0x44d3f4[_0x2ddf('0x1e')][_0x2ddf('0x1f')]||null:null,'limit':_0x44d3f4['options']?_0x44d3f4['options'][_0x2ddf('0x20')]||null:null,'include':_0x44d3f4[_0x2ddf('0x1e')]?_0x44d3f4[_0x2ddf('0x1e')][_0x2ddf('0x21')]?_[_0x2ddf('0x22')](_0x44d3f4[_0x2ddf('0x1e')]['include'],function(_0x48c6f0){return{'model':db[_0x48c6f0[_0x2ddf('0x23')]],'as':_0x48c6f0['as'],'attributes':_0x48c6f0['attributes'],'include':_0x48c6f0[_0x2ddf('0x21')]?_[_0x2ddf('0x22')](_0x48c6f0['include'],function(_0x45e76c){return{'model':db[_0x45e76c[_0x2ddf('0x23')]],'as':_0x45e76c['as'],'attributes':_0x45e76c[_0x2ddf('0x1f')],'include':_0x45e76c['include']?_[_0x2ddf('0x22')](_0x45e76c[_0x2ddf('0x21')],function(_0x4f0b18){return{'model':db[_0x4f0b18[_0x2ddf('0x23')]],'as':_0x4f0b18['as'],'attributes':_0x4f0b18['attributes']};}):[]};}):[]};}):[]:[]})[_0x2ddf('0xe')](function(_0x445320){logger[_0x2ddf('0x16')](_0x2ddf('0x19'),_0x44d3f4);logger[_0x2ddf('0x24')](_0x2ddf('0x19'),_0x44d3f4,JSON[_0x2ddf('0x12')](_0x445320));_0x29cad2(_0x445320);})['catch'](function(_0x21f719){logger[_0x2ddf('0x13')](_0x2ddf('0x19'),_0x21f719[_0x2ddf('0x15')],_0x44d3f4);_0x41f102(_0x46ed3a[_0x2ddf('0x13')](0x1f4,_0x21f719[_0x2ddf('0x15')]));});});};exports[_0x2ddf('0x25')]=function(_0x193991){var _0x5168f2=this;return new Promise(function(_0x217502,_0x292e0f){return db['MailQueue'][_0x2ddf('0x26')]({'raw':_0x193991[_0x2ddf('0x1e')]?_0x193991[_0x2ddf('0x1e')][_0x2ddf('0x1c')]===undefined?!![]:![]:!![],'where':_0x193991['options']?_0x193991[_0x2ddf('0x1e')]['where']||null:null,'attributes':_0x193991['options']?_0x193991[_0x2ddf('0x1e')][_0x2ddf('0x1f')]||null:null,'include':_0x193991[_0x2ddf('0x1e')]?_0x193991[_0x2ddf('0x1e')][_0x2ddf('0x21')]?_[_0x2ddf('0x22')](_0x193991[_0x2ddf('0x1e')][_0x2ddf('0x21')],function(_0x4439db){return{'model':db[_0x4439db['model']],'as':_0x4439db['as'],'attributes':_0x4439db[_0x2ddf('0x1f')],'include':_0x4439db['include']?_[_0x2ddf('0x22')](_0x4439db[_0x2ddf('0x21')],function(_0x42929e){return{'model':db[_0x42929e['model']],'as':_0x42929e['as'],'attributes':_0x42929e[_0x2ddf('0x1f')],'include':_0x42929e['include']?_[_0x2ddf('0x22')](_0x42929e[_0x2ddf('0x21')],function(_0x549043){return{'model':db[_0x549043[_0x2ddf('0x23')]],'as':_0x549043['as'],'attributes':_0x549043[_0x2ddf('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2ddf('0xe')](function(_0x3748a5){logger[_0x2ddf('0x16')](_0x2ddf('0x25'),_0x193991);logger[_0x2ddf('0x24')](_0x2ddf('0x25'),_0x193991,JSON['stringify'](_0x3748a5));_0x217502(_0x3748a5);})[_0x2ddf('0x18')](function(_0x1cc159){logger[_0x2ddf('0x13')](_0x2ddf('0x25'),_0x1cc159[_0x2ddf('0x15')],_0x193991);_0x292e0f(_0x5168f2['error'](0x1f4,_0x1cc159['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 3df9e80..92ebead 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 _0x1956=['removeListener','register','length','mailQueue:','./mailQueue.events','save','remove','update'];(function(_0x59ee03,_0x463383){var _0x320190=function(_0x32aa7d){while(--_0x32aa7d){_0x59ee03['push'](_0x59ee03['shift']());}};_0x320190(++_0x463383);}(_0x1956,0x15c));var _0x6195=function(_0xf34109,_0x380779){_0xf34109=_0xf34109-0x0;var _0x570bfc=_0x1956[_0xf34109];return _0x570bfc;};'use strict';var MailQueueEvents=require(_0x6195('0x0'));var events=[_0x6195('0x1'),_0x6195('0x2'),_0x6195('0x3')];function createListener(_0x3b70c6,_0x154078){return function(_0x267f16){_0x154078['emit'](_0x3b70c6,_0x267f16);};}function removeListener(_0x35567c,_0x320109){return function(){MailQueueEvents[_0x6195('0x4')](_0x35567c,_0x320109);};}exports[_0x6195('0x5')]=function(_0x1257a0){for(var _0x338444=0x0,_0x354458=events[_0x6195('0x6')];_0x338444<_0x354458;_0x338444++){var _0xf8576e=events[_0x338444];var _0x4cb932=createListener(_0x6195('0x7')+_0xf8576e,_0x1257a0);MailQueueEvents['on'](_0xf8576e,_0x4cb932);}}; \ No newline at end of file +var _0x5ff0=['update','emit','removeListener','register','mailQueue:','./mailQueue.events','save','remove'];(function(_0x5c52a3,_0x38c5ea){var _0xf3a990=function(_0x338bd8){while(--_0x338bd8){_0x5c52a3['push'](_0x5c52a3['shift']());}};_0xf3a990(++_0x38c5ea);}(_0x5ff0,0xad));var _0x05ff=function(_0x51f410,_0x37f440){_0x51f410=_0x51f410-0x0;var _0x5e008b=_0x5ff0[_0x51f410];return _0x5e008b;};'use strict';var MailQueueEvents=require(_0x05ff('0x0'));var events=[_0x05ff('0x1'),_0x05ff('0x2'),_0x05ff('0x3')];function createListener(_0x67da5f,_0x5868d5){return function(_0x391061){_0x5868d5[_0x05ff('0x4')](_0x67da5f,_0x391061);};}function removeListener(_0x1a6ab3,_0x31dc47){return function(){MailQueueEvents[_0x05ff('0x5')](_0x1a6ab3,_0x31dc47);};}exports[_0x05ff('0x6')]=function(_0x2503a1){for(var _0x33f3d3=0x0,_0x2b7fd8=events['length'];_0x33f3d3<_0x2b7fd8;_0x33f3d3++){var _0x46eab9=events[_0x33f3d3];var _0x783754=createListener(_0x05ff('0x7')+_0x46eab9,_0x2503a1);MailQueueEvents['on'](_0x46eab9,_0x783754);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 2fb54b5..4616ae3 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 _0x9c89=['Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','update','delete','destroy','exports','multer','util','path'];(function(_0x49258d,_0x5bcf0e){var _0x2a9044=function(_0x1a629e){while(--_0x1a629e){_0x49258d['push'](_0x49258d['shift']());}};_0x2a9044(++_0x5bcf0e);}(_0x9c89,0x101));var _0x99c8=function(_0x438fd3,_0x355514){_0x438fd3=_0x438fd3-0x0;var _0x23e8ed=_0x9c89[_0x438fd3];return _0x23e8ed;};'use strict';var multer=require(_0x99c8('0x0'));var util=require(_0x99c8('0x1'));var path=require(_0x99c8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x99c8('0x3')]();var fs_extra=require(_0x99c8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x99c8('0x5'));var config=require(_0x99c8('0x6'));var controller=require(_0x99c8('0x7'));router[_0x99c8('0x8')]('/',auth['isAuthenticated'](),controller[_0x99c8('0x9')]);router[_0x99c8('0x8')](_0x99c8('0xa'),auth['isAuthenticated'](),controller[_0x99c8('0xb')]);router[_0x99c8('0x8')](_0x99c8('0xc'),auth[_0x99c8('0xd')](),controller[_0x99c8('0xe')]);router[_0x99c8('0xf')]('/',auth[_0x99c8('0xd')](),controller['create']);router['put'](_0x99c8('0xc'),auth[_0x99c8('0xd')](),controller[_0x99c8('0x10')]);router[_0x99c8('0x11')](_0x99c8('0xc'),auth[_0x99c8('0xd')](),controller[_0x99c8('0x12')]);module[_0x99c8('0x13')]=router; \ No newline at end of file +var _0xfae6=['update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','/describe','isAuthenticated','describe','show','create','put','/:id'];(function(_0x303c30,_0x16edcb){var _0x43161b=function(_0x3330ff){while(--_0x3330ff){_0x303c30['push'](_0x303c30['shift']());}};_0x43161b(++_0x16edcb);}(_0xfae6,0xc1));var _0x6fae=function(_0x4022f0,_0x44a2d3){_0x4022f0=_0x4022f0-0x0;var _0x469d2b=_0xfae6[_0x4022f0];return _0x469d2b;};'use strict';var multer=require(_0x6fae('0x0'));var util=require(_0x6fae('0x1'));var path=require('path');var timeout=require(_0x6fae('0x2'));var express=require(_0x6fae('0x3'));var router=express[_0x6fae('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6fae('0x5'));var interaction=require(_0x6fae('0x6'));var config=require('../../config/environment');var controller=require(_0x6fae('0x7'));router[_0x6fae('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6fae('0x8')](_0x6fae('0x9'),auth[_0x6fae('0xa')](),controller[_0x6fae('0xb')]);router[_0x6fae('0x8')]('/:id',auth[_0x6fae('0xa')](),controller[_0x6fae('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6fae('0xd')]);router[_0x6fae('0xe')](_0x6fae('0xf'),auth[_0x6fae('0xa')](),controller[_0x6fae('0x10')]);router[_0x6fae('0x11')](_0x6fae('0xf'),auth[_0x6fae('0xa')](),controller[_0x6fae('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 9453e80..65158a5 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 _0x750c=['STRING','DATE','sequelize','exports'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x750c,0x1d2));var _0xc750=function(_0x30b355,_0x11fc94){_0x30b355=_0x30b355-0x0;var _0x3bdff2=_0x750c[_0x30b355];return _0x3bdff2;};'use strict';var moment=require('moment');var Sequelize=require(_0xc750('0x0'));module[_0xc750('0x1')]={'uniqueid':{'type':Sequelize[_0xc750('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc750('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc750('0x3')]},'exitAt':{'type':Sequelize[_0xc750('0x3')]},'reason':{'type':Sequelize[_0xc750('0x2')]}}; \ No newline at end of file +var _0xc99e=['moment','sequelize','STRING','DATE'];(function(_0x60878f,_0x1166d3){var _0x1fbefb=function(_0x375d8c){while(--_0x375d8c){_0x60878f['push'](_0x60878f['shift']());}};_0x1fbefb(++_0x1166d3);}(_0xc99e,0x1d8));var _0xec99=function(_0x30712e,_0x1eec0e){_0x30712e=_0x30712e-0x0;var _0x14a2e1=_0xc99e[_0x30712e];return _0x14a2e1;};'use strict';var moment=require(_0xec99('0x0'));var Sequelize=require(_0xec99('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xec99('0x2')]},'joinAt':{'type':Sequelize[_0xec99('0x3')]},'leaveAt':{'type':Sequelize[_0xec99('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xec99('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index ccbc171..4ca82c9 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 _0x0120=['name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','limit','undefined','count','offset','set','Content-Range','json','reject','save','update','then','destroy','end','sendStatus','error','stack'];(function(_0x1015dd,_0x38560b){var _0x2d7385=function(_0x41d7df){while(--_0x41d7df){_0x1015dd['push'](_0x1015dd['shift']());}};_0x2d7385(++_0x38560b);}(_0x0120,0x6f));var _0x0012=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x0120[_0x30ae5e];return _0x1f2e93;};'use strict';var emlformat=require(_0x0012('0x0'));var rimraf=require(_0x0012('0x1'));var zipdir=require(_0x0012('0x2'));var jsonpatch=require(_0x0012('0x3'));var rp=require(_0x0012('0x4'));var moment=require(_0x0012('0x5'));var BPromise=require(_0x0012('0x6'));var Mustache=require(_0x0012('0x7'));var util=require(_0x0012('0x8'));var path=require(_0x0012('0x9'));var sox=require(_0x0012('0xa'));var csv=require(_0x0012('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0012('0xc'));var crypto=require(_0x0012('0xd'));var jsforce=require(_0x0012('0xe'));var deskjs=require(_0x0012('0xf'));var toCsv=require(_0x0012('0xb'));var querystring=require('querystring');var Papa=require(_0x0012('0x10'));var Redis=require(_0x0012('0x11'));var authService=require(_0x0012('0x12'));var qs=require(_0x0012('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0012('0x14'));var logger=require('../../config/logger')(_0x0012('0x15'));var utils=require(_0x0012('0x16'));var config=require(_0x0012('0x17'));var licenseUtil=require(_0x0012('0x18'));var db=require(_0x0012('0x19'))['db'];function respondWithStatusCode(_0x4d3e7a,_0x6d4a1a){_0x6d4a1a=_0x6d4a1a||0xcc;return function(_0x4f0ee1){if(_0x4f0ee1){return _0x4d3e7a['sendStatus'](_0x6d4a1a);}return _0x4d3e7a['status'](_0x6d4a1a)['end']();};}function respondWithResult(_0x3a7d50,_0x496a2b){_0x496a2b=_0x496a2b||0xc8;return function(_0x3995fd){if(_0x3995fd){return _0x3a7d50[_0x0012('0x1a')](_0x496a2b)['json'](_0x3995fd);}};}function respondWithFilteredResult(_0x24f4ed,_0x1a0c0d){return function(_0x348810){if(_0x348810){var _0x3b8dfc=typeof _0x1a0c0d['offset']==='undefined'&&typeof _0x1a0c0d[_0x0012('0x1b')]===_0x0012('0x1c');var _0x3948bf=_0x348810[_0x0012('0x1d')];var _0x1d0423=_0x3b8dfc?0x0:_0x1a0c0d[_0x0012('0x1e')];var _0x1e78ee=_0x3b8dfc?_0x348810[_0x0012('0x1d')]:_0x1a0c0d['offset']+_0x1a0c0d[_0x0012('0x1b')];var _0x56b0e1;if(_0x1e78ee>=_0x3948bf){_0x1e78ee=_0x3948bf;_0x56b0e1=0xc8;}else{_0x56b0e1=0xce;}_0x24f4ed['status'](_0x56b0e1);return _0x24f4ed[_0x0012('0x1f')](_0x0012('0x20'),_0x1d0423+'-'+_0x1e78ee+'/'+_0x3948bf)[_0x0012('0x21')](_0x348810);}return null;};}function patchUpdates(_0x2c837e){return function(_0x53ac2d){try{jsonpatch['apply'](_0x53ac2d,_0x2c837e,!![]);}catch(_0x460d82){return BPromise[_0x0012('0x22')](_0x460d82);}return _0x53ac2d[_0x0012('0x23')]();};}function saveUpdates(_0x7177bc,_0x190f07){return function(_0x2e6a2c){if(_0x2e6a2c){return _0x2e6a2c[_0x0012('0x24')](_0x7177bc)[_0x0012('0x25')](function(_0x57487e){return _0x57487e;});}return null;};}function removeEntity(_0x24674c,_0x24a280){return function(_0x4cf4bd){if(_0x4cf4bd){return _0x4cf4bd[_0x0012('0x26')]()[_0x0012('0x25')](function(){_0x24674c[_0x0012('0x1a')](0xcc)[_0x0012('0x27')]();});}};}function handleEntityNotFound(_0x42bcd7,_0x5e820b){return function(_0x351ffd){if(!_0x351ffd){_0x42bcd7[_0x0012('0x28')](0x194);}return _0x351ffd;};}function handleError(_0xbb5b55,_0x2a0302){_0x2a0302=_0x2a0302||0x1f4;return function(_0x173cb3){logger[_0x0012('0x29')](_0x173cb3[_0x0012('0x2a')]);if(_0x173cb3[_0x0012('0x2b')]){delete _0x173cb3[_0x0012('0x2b')];}_0xbb5b55[_0x0012('0x1a')](_0x2a0302)[_0x0012('0x2c')](_0x173cb3);};}exports[_0x0012('0x2d')]=function(_0x45c3ca,_0x3ce788){var _0x1282bb={},_0x276389={},_0x1b676d={'count':0x0,'rows':[]};var _0x1f4a0a=_[_0x0012('0x2e')](db[_0x0012('0x2f')][_0x0012('0x30')],function(_0x4d0998){return{'name':_0x4d0998[_0x0012('0x31')],'type':_0x4d0998[_0x0012('0x32')]['key']};});_0x276389[_0x0012('0x33')]=_[_0x0012('0x2e')](_0x1f4a0a,_0x0012('0x2b'));_0x276389[_0x0012('0x34')]=_[_0x0012('0x35')](_0x45c3ca['query']);_0x276389[_0x0012('0x36')]=_[_0x0012('0x37')](_0x276389[_0x0012('0x33')],_0x276389['query']);_0x1282bb[_0x0012('0x38')]=_[_0x0012('0x37')](_0x276389[_0x0012('0x33')],qs[_0x0012('0x39')](_0x45c3ca[_0x0012('0x34')][_0x0012('0x39')]));_0x1282bb['attributes']=_0x1282bb[_0x0012('0x38')][_0x0012('0x3a')]?_0x1282bb[_0x0012('0x38')]:_0x276389[_0x0012('0x33')];if(!_0x45c3ca['query']['hasOwnProperty'](_0x0012('0x3b'))){_0x1282bb[_0x0012('0x1b')]=qs[_0x0012('0x1b')](_0x45c3ca[_0x0012('0x34')][_0x0012('0x1b')]);_0x1282bb[_0x0012('0x1e')]=qs[_0x0012('0x1e')](_0x45c3ca['query'][_0x0012('0x1e')]);}_0x1282bb[_0x0012('0x3c')]=qs['sort'](_0x45c3ca[_0x0012('0x34')][_0x0012('0x3d')]);_0x1282bb[_0x0012('0x3e')]=qs[_0x0012('0x36')](_[_0x0012('0x3f')](_0x45c3ca[_0x0012('0x34')],_0x276389[_0x0012('0x36')]),_0x1f4a0a);if(_0x45c3ca['query'][_0x0012('0x40')]){_0x1282bb['where']=_[_0x0012('0x41')](_0x1282bb['where'],{'$or':_['map'](_0x1f4a0a,function(_0x1c35aa){if(_0x1c35aa[_0x0012('0x32')]!==_0x0012('0x42')){var _0x4e4424={};_0x4e4424[_0x1c35aa[_0x0012('0x2b')]]={'$like':'%'+_0x45c3ca[_0x0012('0x34')][_0x0012('0x40')]+'%'};return _0x4e4424;}})});}_0x1282bb=_[_0x0012('0x41')]({},_0x1282bb,_0x45c3ca[_0x0012('0x43')]);var _0x379780={'where':_0x1282bb[_0x0012('0x3e')]};return db[_0x0012('0x2f')]['count'](_0x379780)[_0x0012('0x25')](function(_0x25aff1){_0x1b676d[_0x0012('0x1d')]=_0x25aff1;if(_0x45c3ca[_0x0012('0x34')][_0x0012('0x44')]){_0x1282bb[_0x0012('0x45')]=[{'all':!![]}];}return db[_0x0012('0x2f')]['findAll'](_0x1282bb);})['then'](function(_0x1c54de){_0x1b676d['rows']=_0x1c54de;return _0x1b676d;})[_0x0012('0x25')](respondWithFilteredResult(_0x3ce788,_0x1282bb))[_0x0012('0x46')](handleError(_0x3ce788,null));};exports[_0x0012('0x47')]=function(_0x40f80d,_0x32c1f9){var _0x5348a2={'raw':!![],'where':{'id':_0x40f80d[_0x0012('0x48')]['id']}},_0x1bd93a={};_0x1bd93a['model']=_[_0x0012('0x35')](db[_0x0012('0x2f')][_0x0012('0x30')]);_0x1bd93a[_0x0012('0x34')]=_['keys'](_0x40f80d['query']);_0x1bd93a[_0x0012('0x36')]=_['intersection'](_0x1bd93a[_0x0012('0x33')],_0x1bd93a['query']);_0x5348a2[_0x0012('0x38')]=_[_0x0012('0x37')](_0x1bd93a[_0x0012('0x33')],qs[_0x0012('0x39')](_0x40f80d['query'][_0x0012('0x39')]));_0x5348a2['attributes']=_0x5348a2[_0x0012('0x38')][_0x0012('0x3a')]?_0x5348a2[_0x0012('0x38')]:_0x1bd93a[_0x0012('0x33')];if(_0x40f80d[_0x0012('0x34')][_0x0012('0x44')]){_0x5348a2[_0x0012('0x45')]=[{'all':!![]}];}_0x5348a2=_['merge']({},_0x5348a2,_0x40f80d[_0x0012('0x43')]);return db[_0x0012('0x2f')][_0x0012('0x49')](_0x5348a2)[_0x0012('0x25')](handleEntityNotFound(_0x32c1f9,null))[_0x0012('0x25')](respondWithResult(_0x32c1f9,null))[_0x0012('0x46')](handleError(_0x32c1f9,null));};exports['create']=function(_0x5894ee,_0x48de64){return db['MailQueueReport'][_0x0012('0x4a')](_0x5894ee[_0x0012('0x4b')],{})[_0x0012('0x25')](respondWithResult(_0x48de64,0xc9))[_0x0012('0x46')](handleError(_0x48de64,null));};exports[_0x0012('0x24')]=function(_0x53d552,_0x44ffaf){if(_0x53d552[_0x0012('0x4b')]['id']){delete _0x53d552[_0x0012('0x4b')]['id'];}return db[_0x0012('0x2f')][_0x0012('0x49')]({'where':{'id':_0x53d552[_0x0012('0x48')]['id']}})[_0x0012('0x25')](handleEntityNotFound(_0x44ffaf,null))[_0x0012('0x25')](saveUpdates(_0x53d552[_0x0012('0x4b')],null))[_0x0012('0x25')](respondWithResult(_0x44ffaf,null))[_0x0012('0x46')](handleError(_0x44ffaf,null));};exports['destroy']=function(_0x2389cd,_0x12cb8f){return db[_0x0012('0x2f')]['find']({'where':{'id':_0x2389cd[_0x0012('0x48')]['id']}})[_0x0012('0x25')](handleEntityNotFound(_0x12cb8f,null))[_0x0012('0x25')](removeEntity(_0x12cb8f,null))[_0x0012('0x46')](handleError(_0x12cb8f,null));};exports[_0x0012('0x4c')]=function(_0x5f283f,_0xd11428){return db['MailQueueReport'][_0x0012('0x4c')]()[_0x0012('0x25')](respondWithResult(_0xd11428,null))['catch'](handleError(_0xd11428,null));}; \ No newline at end of file +var _0x7046=['map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','MailQueueReport','includeAll','include','rows','show','params','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','name','send'];(function(_0x45bf8f,_0x32311c){var _0x28c890=function(_0x4a35cc){while(--_0x4a35cc){_0x45bf8f['push'](_0x45bf8f['shift']());}};_0x28c890(++_0x32311c);}(_0x7046,0x144));var _0x6704=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x7046[_0x5d6456];return _0x4d66c1;};'use strict';var emlformat=require(_0x6704('0x0'));var rimraf=require(_0x6704('0x1'));var zipdir=require(_0x6704('0x2'));var jsonpatch=require(_0x6704('0x3'));var rp=require('request-promise');var moment=require(_0x6704('0x4'));var BPromise=require(_0x6704('0x5'));var Mustache=require(_0x6704('0x6'));var util=require('util');var path=require(_0x6704('0x7'));var sox=require(_0x6704('0x8'));var csv=require(_0x6704('0x9'));var ejs=require(_0x6704('0xa'));var fs=require('fs');var fs_extra=require(_0x6704('0xb'));var _=require('lodash');var squel=require(_0x6704('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6704('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6704('0xe'));var Redis=require(_0x6704('0xf'));var authService=require(_0x6704('0x10'));var qs=require(_0x6704('0x11'));var as=require(_0x6704('0x12'));var hardwareService=require(_0x6704('0x13'));var logger=require(_0x6704('0x14'))(_0x6704('0x15'));var utils=require('../../config/utils');var config=require(_0x6704('0x16'));var licenseUtil=require(_0x6704('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2feb52,_0x1db0ad){_0x1db0ad=_0x1db0ad||0xcc;return function(_0x327e03){if(_0x327e03){return _0x2feb52[_0x6704('0x18')](_0x1db0ad);}return _0x2feb52[_0x6704('0x19')](_0x1db0ad)[_0x6704('0x1a')]();};}function respondWithResult(_0x17b9bc,_0x2da4df){_0x2da4df=_0x2da4df||0xc8;return function(_0x24ece3){if(_0x24ece3){return _0x17b9bc['status'](_0x2da4df)[_0x6704('0x1b')](_0x24ece3);}};}function respondWithFilteredResult(_0x1752bc,_0x35082b){return function(_0x4fef80){if(_0x4fef80){var _0x11782a=typeof _0x35082b[_0x6704('0x1c')]===_0x6704('0x1d')&&typeof _0x35082b[_0x6704('0x1e')]===_0x6704('0x1d');var _0x5adb35=_0x4fef80[_0x6704('0x1f')];var _0x31d732=_0x11782a?0x0:_0x35082b[_0x6704('0x1c')];var _0xe49450=_0x11782a?_0x4fef80[_0x6704('0x1f')]:_0x35082b['offset']+_0x35082b[_0x6704('0x1e')];var _0x2f6eae;if(_0xe49450>=_0x5adb35){_0xe49450=_0x5adb35;_0x2f6eae=0xc8;}else{_0x2f6eae=0xce;}_0x1752bc[_0x6704('0x19')](_0x2f6eae);return _0x1752bc[_0x6704('0x20')](_0x6704('0x21'),_0x31d732+'-'+_0xe49450+'/'+_0x5adb35)[_0x6704('0x1b')](_0x4fef80);}return null;};}function patchUpdates(_0x42b27f){return function(_0x5bb33e){try{jsonpatch[_0x6704('0x22')](_0x5bb33e,_0x42b27f,!![]);}catch(_0xf6d433){return BPromise[_0x6704('0x23')](_0xf6d433);}return _0x5bb33e['save']();};}function saveUpdates(_0x4dca58,_0x48d829){return function(_0x3e183b){if(_0x3e183b){return _0x3e183b[_0x6704('0x24')](_0x4dca58)[_0x6704('0x25')](function(_0x41f89e){return _0x41f89e;});}return null;};}function removeEntity(_0x56d1e1,_0xf2c459){return function(_0xabb97a){if(_0xabb97a){return _0xabb97a[_0x6704('0x26')]()[_0x6704('0x25')](function(){_0x56d1e1[_0x6704('0x19')](0xcc)[_0x6704('0x1a')]();});}};}function handleEntityNotFound(_0x2acafd,_0x5d50ff){return function(_0x896227){if(!_0x896227){_0x2acafd[_0x6704('0x18')](0x194);}return _0x896227;};}function handleError(_0x36bea4,_0x1bdfee){_0x1bdfee=_0x1bdfee||0x1f4;return function(_0x118d93){logger['error'](_0x118d93['stack']);if(_0x118d93[_0x6704('0x27')]){delete _0x118d93[_0x6704('0x27')];}_0x36bea4[_0x6704('0x19')](_0x1bdfee)[_0x6704('0x28')](_0x118d93);};}exports['index']=function(_0x1def46,_0x18cd98){var _0x5c229d={},_0x588814={},_0x16e749={'count':0x0,'rows':[]};var _0x5363c9=_[_0x6704('0x29')](db['MailQueueReport']['rawAttributes'],function(_0x7e193e){return{'name':_0x7e193e[_0x6704('0x2a')],'type':_0x7e193e[_0x6704('0x2b')]['key']};});_0x588814[_0x6704('0x2c')]=_[_0x6704('0x29')](_0x5363c9,_0x6704('0x27'));_0x588814[_0x6704('0x2d')]=_[_0x6704('0x2e')](_0x1def46[_0x6704('0x2d')]);_0x588814[_0x6704('0x2f')]=_[_0x6704('0x30')](_0x588814[_0x6704('0x2c')],_0x588814[_0x6704('0x2d')]);_0x5c229d[_0x6704('0x31')]=_[_0x6704('0x30')](_0x588814[_0x6704('0x2c')],qs[_0x6704('0x32')](_0x1def46[_0x6704('0x2d')][_0x6704('0x32')]));_0x5c229d[_0x6704('0x31')]=_0x5c229d[_0x6704('0x31')][_0x6704('0x33')]?_0x5c229d[_0x6704('0x31')]:_0x588814[_0x6704('0x2c')];if(!_0x1def46[_0x6704('0x2d')][_0x6704('0x34')](_0x6704('0x35'))){_0x5c229d[_0x6704('0x1e')]=qs['limit'](_0x1def46['query']['limit']);_0x5c229d[_0x6704('0x1c')]=qs[_0x6704('0x1c')](_0x1def46[_0x6704('0x2d')]['offset']);}_0x5c229d[_0x6704('0x36')]=qs['sort'](_0x1def46[_0x6704('0x2d')][_0x6704('0x37')]);_0x5c229d[_0x6704('0x38')]=qs[_0x6704('0x2f')](_[_0x6704('0x39')](_0x1def46[_0x6704('0x2d')],_0x588814[_0x6704('0x2f')]),_0x5363c9);if(_0x1def46[_0x6704('0x2d')]['filter']){_0x5c229d['where']=_[_0x6704('0x3a')](_0x5c229d[_0x6704('0x38')],{'$or':_['map'](_0x5363c9,function(_0x48f3c2){if(_0x48f3c2[_0x6704('0x2b')]!=='VIRTUAL'){var _0xd7e27b={};_0xd7e27b[_0x48f3c2[_0x6704('0x27')]]={'$like':'%'+_0x1def46[_0x6704('0x2d')][_0x6704('0x3b')]+'%'};return _0xd7e27b;}})});}_0x5c229d=_['merge']({},_0x5c229d,_0x1def46[_0x6704('0x3c')]);var _0x1ee017={'where':_0x5c229d['where']};return db[_0x6704('0x3d')]['count'](_0x1ee017)[_0x6704('0x25')](function(_0x714c83){_0x16e749[_0x6704('0x1f')]=_0x714c83;if(_0x1def46['query'][_0x6704('0x3e')]){_0x5c229d[_0x6704('0x3f')]=[{'all':!![]}];}return db[_0x6704('0x3d')]['findAll'](_0x5c229d);})[_0x6704('0x25')](function(_0x444d36){_0x16e749[_0x6704('0x40')]=_0x444d36;return _0x16e749;})[_0x6704('0x25')](respondWithFilteredResult(_0x18cd98,_0x5c229d))['catch'](handleError(_0x18cd98,null));};exports[_0x6704('0x41')]=function(_0x50cc74,_0x2defda){var _0x45a217={'raw':!![],'where':{'id':_0x50cc74[_0x6704('0x42')]['id']}},_0x10fc26={};_0x10fc26['model']=_['keys'](db['MailQueueReport'][_0x6704('0x43')]);_0x10fc26['query']=_[_0x6704('0x2e')](_0x50cc74['query']);_0x10fc26[_0x6704('0x2f')]=_[_0x6704('0x30')](_0x10fc26['model'],_0x10fc26[_0x6704('0x2d')]);_0x45a217[_0x6704('0x31')]=_[_0x6704('0x30')](_0x10fc26[_0x6704('0x2c')],qs[_0x6704('0x32')](_0x50cc74['query'][_0x6704('0x32')]));_0x45a217[_0x6704('0x31')]=_0x45a217[_0x6704('0x31')][_0x6704('0x33')]?_0x45a217[_0x6704('0x31')]:_0x10fc26['model'];if(_0x50cc74[_0x6704('0x2d')]['includeAll']){_0x45a217[_0x6704('0x3f')]=[{'all':!![]}];}_0x45a217=_[_0x6704('0x3a')]({},_0x45a217,_0x50cc74[_0x6704('0x3c')]);return db[_0x6704('0x3d')][_0x6704('0x44')](_0x45a217)['then'](handleEntityNotFound(_0x2defda,null))[_0x6704('0x25')](respondWithResult(_0x2defda,null))[_0x6704('0x45')](handleError(_0x2defda,null));};exports['create']=function(_0x1b9d36,_0x17a98a){return db[_0x6704('0x3d')][_0x6704('0x46')](_0x1b9d36[_0x6704('0x47')],{})[_0x6704('0x25')](respondWithResult(_0x17a98a,0xc9))['catch'](handleError(_0x17a98a,null));};exports[_0x6704('0x24')]=function(_0x5b0713,_0xb73442){if(_0x5b0713['body']['id']){delete _0x5b0713[_0x6704('0x47')]['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x5b0713[_0x6704('0x42')]['id']}})[_0x6704('0x25')](handleEntityNotFound(_0xb73442,null))[_0x6704('0x25')](saveUpdates(_0x5b0713[_0x6704('0x47')],null))[_0x6704('0x25')](respondWithResult(_0xb73442,null))[_0x6704('0x45')](handleError(_0xb73442,null));};exports['destroy']=function(_0x5b9e28,_0x254cf7){return db[_0x6704('0x3d')][_0x6704('0x44')]({'where':{'id':_0x5b9e28[_0x6704('0x42')]['id']}})[_0x6704('0x25')](handleEntityNotFound(_0x254cf7,null))[_0x6704('0x25')](removeEntity(_0x254cf7,null))[_0x6704('0x45')](handleError(_0x254cf7,null));};exports[_0x6704('0x48')]=function(_0x1fcfb0,_0x44e4a5){return db[_0x6704('0x3d')][_0x6704('0x48')]()[_0x6704('0x25')](respondWithResult(_0x44e4a5,null))[_0x6704('0x45')](handleError(_0x44e4a5,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 7bf1cb3..415b3c1 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 _0x068f=['bluebird','request-promise','path','rimraf','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x2533c7,_0x29feff){var _0x279bd8=function(_0x3c6ed3){while(--_0x3c6ed3){_0x2533c7['push'](_0x2533c7['shift']());}};_0x279bd8(++_0x29feff);}(_0x068f,0x1a1));var _0xf068=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x068f[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0xf068('0x0'));var util=require(_0xf068('0x1'));var logger=require(_0xf068('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf068('0x3'));var rp=require(_0xf068('0x4'));var fs=require('fs');var path=require(_0xf068('0x5'));var rimraf=require(_0xf068('0x6'));var config=require('../../config/environment');var attributes=require(_0xf068('0x7'));module['exports']=function(_0x41d679,_0x6d3f80){return _0x41d679[_0xf068('0x8')](_0xf068('0x9'),attributes,{'tableName':_0xf068('0xa'),'paranoid':![],'indexes':[{'name':_0xf068('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x392a=['moment','bluebird','request-promise','rimraf','./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','api'];(function(_0x52d5a0,_0x18d981){var _0x9cfaf2=function(_0x2a1174){while(--_0x2a1174){_0x52d5a0['push'](_0x52d5a0['shift']());}};_0x9cfaf2(++_0x18d981);}(_0x392a,0x11d));var _0xa392=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x392a[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xa392('0x0'));var util=require('util');var logger=require(_0xa392('0x1'))(_0xa392('0x2'));var moment=require(_0xa392('0x3'));var BPromise=require(_0xa392('0x4'));var rp=require(_0xa392('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa392('0x6'));var config=require('../../config/environment');var attributes=require(_0xa392('0x7'));module[_0xa392('0x8')]=function(_0x47d810,_0x271ac9){return _0x47d810['define'](_0xa392('0x9'),attributes,{'tableName':_0xa392('0xa'),'paranoid':![],'indexes':[{'name':_0xa392('0xb'),'fields':[_0xa392('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index be74fcf..0abd9e9 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x2a866a,_0x3c7c40){var _0xbfac83=function(_0x4210fd){while(--_0x4210fd){_0x2a866a['push'](_0x2a866a['shift']());}};_0xbfac83(++_0x3c7c40);}(_0x7a54,0x106));var _0x47a5=function(_0x3b0e84,_0x1c5ba9){_0x3b0e84=_0x3b0e84-0x0;var _0x41de0e=_0x7a54[_0x3b0e84];return _0x41de0e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x737f41,_0x4f9dfa){var _0x218e4c=function(_0xdb282f){while(--_0xdb282f){_0x737f41['push'](_0x737f41['shift']());}};_0x218e4c(++_0x4f9dfa);}(_0xadb5,0xad));var _0x5adb=function(_0x416e44,_0xa95389){_0x416e44=_0x416e44-0x0;var _0x271345=_0xadb5[_0x416e44];return _0x271345;};'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']('MailQueueReport,\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);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 945c0ba..878049f 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x686fdb,_0x494a22){var _0x31ceca=function(_0x3ba7e1){while(--_0x3ba7e1){_0x686fdb['push'](_0x686fdb['shift']());}};_0x31ceca(++_0x494a22);}(_0xe706,0xa3));var _0x6e70=function(_0x2ada99,_0x4ea2aa){_0x2ada99=_0x2ada99-0x0;var _0x5447e5=_0xe706[_0x2ada99];return _0x5447e5;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x51b80a,_0x355fe3){var _0x22fdf0=function(_0x152b3e){while(--_0x152b3e){_0x51b80a['push'](_0x51b80a['shift']());}};_0x22fdf0(++_0x355fe3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index bf71bed..384e9d2 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 _0x8b37=['STRING','BOOLEAN','INBOX','INTEGER','exports'];(function(_0x2a682c,_0x576708){var _0x461fba=function(_0x3a4271){while(--_0x3a4271){_0x2a682c['push'](_0x2a682c['shift']());}};_0x461fba(++_0x576708);}(_0x8b37,0x1c1));var _0x78b3=function(_0x5d33ee,_0x55b07b){_0x5d33ee=_0x5d33ee-0x0;var _0x5a0b29=_0x8b37[_0x5d33ee];return _0x5a0b29;};'use strict';var Sequelize=require('sequelize');module[_0x78b3('0x0')]={'description':{'type':Sequelize[_0x78b3('0x1')]},'host':{'type':Sequelize[_0x78b3('0x1')]},'authentication':{'type':Sequelize[_0x78b3('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x78b3('0x1')]},'password':{'type':Sequelize[_0x78b3('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x78b3('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x78b3('0x1')],'defaultValue':_0x78b3('0x3')},'connTimeout':{'type':Sequelize[_0x78b3('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x78b3('0x1')]},'modernAuthentication':{'type':Sequelize[_0x78b3('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xed79=['BOOLEAN','sequelize','STRING','INTEGER','INBOX'];(function(_0x37aec6,_0x2db561){var _0x2aa8a8=function(_0x4fc0bb){while(--_0x4fc0bb){_0x37aec6['push'](_0x37aec6['shift']());}};_0x2aa8a8(++_0x2db561);}(_0xed79,0x1c3));var _0x9ed7=function(_0x175abe,_0x98b707){_0x175abe=_0x175abe-0x0;var _0x3a6627=_0xed79[_0x175abe];return _0x3a6627;};'use strict';var Sequelize=require(_0x9ed7('0x0'));module['exports']={'description':{'type':Sequelize[_0x9ed7('0x1')]},'host':{'type':Sequelize[_0x9ed7('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x9ed7('0x1')]},'port':{'type':Sequelize[_0x9ed7('0x2')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x9ed7('0x1')],'defaultValue':_0x9ed7('0x3')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x9ed7('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0x9ed7('0x1')]},'modernAuthentication':{'type':Sequelize[_0x9ed7('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index c189e89..4362fde 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 _0x5bb4=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','MailServerIn','mail_servers_in','lodash'];(function(_0x33f7e1,_0x48d209){var _0x23bab4=function(_0xd532b0){while(--_0xd532b0){_0x33f7e1['push'](_0x33f7e1['shift']());}};_0x23bab4(++_0x48d209);}(_0x5bb4,0x143));var _0x45bb=function(_0x41c30b,_0x13a703){_0x41c30b=_0x41c30b-0x0;var _0x34fe22=_0x5bb4[_0x41c30b];return _0x34fe22;};'use strict';var _=require(_0x45bb('0x0'));var util=require('util');var logger=require(_0x45bb('0x1'))(_0x45bb('0x2'));var moment=require(_0x45bb('0x3'));var BPromise=require(_0x45bb('0x4'));var rp=require(_0x45bb('0x5'));var fs=require('fs');var path=require(_0x45bb('0x6'));var rimraf=require(_0x45bb('0x7'));var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module[_0x45bb('0x8')]=function(_0x59ce15,_0x4f8f12){return _0x59ce15[_0x45bb('0x9')](_0x45bb('0xa'),attributes,{'tableName':_0x45bb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa967=['mail_servers_in','lodash','util','../../config/logger','api','moment','path','rimraf','exports','define','MailServerIn'];(function(_0x52bdfe,_0x5282ec){var _0x5c6df7=function(_0x2355bb){while(--_0x2355bb){_0x52bdfe['push'](_0x52bdfe['shift']());}};_0x5c6df7(++_0x5282ec);}(_0xa967,0xbc));var _0x7a96=function(_0x5ec594,_0x4aae4d){_0x5ec594=_0x5ec594-0x0;var _0x24b9de=_0xa967[_0x5ec594];return _0x24b9de;};'use strict';var _=require(_0x7a96('0x0'));var util=require(_0x7a96('0x1'));var logger=require(_0x7a96('0x2'))(_0x7a96('0x3'));var moment=require(_0x7a96('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a96('0x5'));var rimraf=require(_0x7a96('0x6'));var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module[_0x7a96('0x7')]=function(_0xc55184,_0x30b457){return _0xc55184[_0x7a96('0x8')](_0x7a96('0x9'),attributes,{'tableName':_0x7a96('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index cf825cd..301a1d4 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 _0x94cd=['options','raw','attributes','map','include','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','MailServerIn,\x20%s,\x20%s','result','catch','GetMailServerIn','MailServerIn','findAll'];(function(_0x3d31dc,_0x2646f7){var _0x3b4382=function(_0x59aecc){while(--_0x59aecc){_0x3d31dc['push'](_0x3d31dc['shift']());}};_0x3b4382(++_0x2646f7);}(_0x94cd,0xb0));var _0xd94c=function(_0x4de634,_0x128d45){_0x4de634=_0x4de634-0x0;var _0x9577c1=_0x94cd[_0x4de634];return _0x9577c1;};'use strict';var _=require('lodash');var util=require(_0xd94c('0x0'));var moment=require(_0xd94c('0x1'));var BPromise=require(_0xd94c('0x2'));var rs=require(_0xd94c('0x3'));var fs=require('fs');var Redis=require(_0xd94c('0x4'));var db=require(_0xd94c('0x5'))['db'];var utils=require(_0xd94c('0x6'));var logger=require(_0xd94c('0x7'))(_0xd94c('0x8'));var config=require(_0xd94c('0x9'));var jayson=require(_0xd94c('0xa'));var client=jayson[_0xd94c('0xb')][_0xd94c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x178c96,_0x95e7e2,_0x3454a7){return new BPromise(function(_0x5568e5,_0x131e73){return client[_0xd94c('0xd')](_0x178c96,_0x3454a7)[_0xd94c('0xe')](function(_0x2dd3fc){logger[_0xd94c('0xf')]('MailServerIn,\x20%s,\x20%s',_0x95e7e2,_0xd94c('0x10'));logger[_0xd94c('0x11')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x95e7e2,_0xd94c('0x10'),JSON[_0xd94c('0x12')](_0x2dd3fc));if(_0x2dd3fc[_0xd94c('0x13')]){if(_0x2dd3fc[_0xd94c('0x13')][_0xd94c('0x14')]===0x1f4){logger[_0xd94c('0x13')]('MailServerIn,\x20%s,\x20%s',_0x95e7e2,_0x2dd3fc[_0xd94c('0x13')][_0xd94c('0x15')]);return _0x131e73(_0x2dd3fc['error']['message']);}logger['error'](_0xd94c('0x16'),_0x95e7e2,_0x2dd3fc[_0xd94c('0x13')]['message']);return _0x5568e5(_0x2dd3fc[_0xd94c('0x13')]['message']);}else{logger['info'](_0xd94c('0x16'),_0x95e7e2,_0xd94c('0x10'));_0x5568e5(_0x2dd3fc[_0xd94c('0x17')][_0xd94c('0x15')]);}})[_0xd94c('0x18')](function(_0x1ac74e){logger[_0xd94c('0x13')]('MailServerIn,\x20%s,\x20%s',_0x95e7e2,_0x1ac74e);_0x131e73(_0x1ac74e);});});}exports[_0xd94c('0x19')]=function(_0x34280e){var _0x4c02bd=this;return new Promise(function(_0x351b84,_0x4f6af4){return db[_0xd94c('0x1a')][_0xd94c('0x1b')]({'raw':_0x34280e[_0xd94c('0x1c')]?_0x34280e[_0xd94c('0x1c')][_0xd94c('0x1d')]===undefined?!![]:![]:!![],'where':_0x34280e[_0xd94c('0x1c')]?_0x34280e[_0xd94c('0x1c')]['where']||null:null,'attributes':_0x34280e[_0xd94c('0x1c')]?_0x34280e[_0xd94c('0x1c')][_0xd94c('0x1e')]||null:null,'limit':_0x34280e[_0xd94c('0x1c')]?_0x34280e[_0xd94c('0x1c')]['limit']||null:null,'include':_0x34280e[_0xd94c('0x1c')]?_0x34280e[_0xd94c('0x1c')]['include']?_[_0xd94c('0x1f')](_0x34280e[_0xd94c('0x1c')]['include'],function(_0x3e2122){return{'model':db[_0x3e2122['model']],'as':_0x3e2122['as'],'attributes':_0x3e2122[_0xd94c('0x1e')],'include':_0x3e2122[_0xd94c('0x20')]?_[_0xd94c('0x1f')](_0x3e2122[_0xd94c('0x20')],function(_0x589713){return{'model':db[_0x589713[_0xd94c('0x21')]],'as':_0x589713['as'],'attributes':_0x589713[_0xd94c('0x1e')],'include':_0x589713[_0xd94c('0x20')]?_[_0xd94c('0x1f')](_0x589713[_0xd94c('0x20')],function(_0x46d769){return{'model':db[_0x46d769[_0xd94c('0x21')]],'as':_0x46d769['as'],'attributes':_0x46d769['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3cb9e9){logger[_0xd94c('0xf')]('GetMailServerIn',_0x34280e);logger[_0xd94c('0x11')](_0xd94c('0x19'),_0x34280e,JSON[_0xd94c('0x12')](_0x3cb9e9));_0x351b84(_0x3cb9e9);})[_0xd94c('0x18')](function(_0x54244c){logger[_0xd94c('0x13')](_0xd94c('0x19'),_0x54244c[_0xd94c('0x15')],_0x34280e);_0x4f6af4(_0x4c02bd['error'](0x1f4,_0x54244c['message']));});});}; \ No newline at end of file +var _0x5cd9=['request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','findAll','options','raw','where','limit','include','map','model','attributes','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s'];(function(_0x239412,_0x55dab6){var _0x4d511d=function(_0x39701e){while(--_0x39701e){_0x239412['push'](_0x239412['shift']());}};_0x4d511d(++_0x55dab6);}(_0x5cd9,0x13c));var _0x95cd=function(_0x1fab6d,_0xd405a9){_0x1fab6d=_0x1fab6d-0x0;var _0x38cc13=_0x5cd9[_0x1fab6d];return _0x38cc13;};'use strict';var _=require('lodash');var util=require(_0x95cd('0x0'));var moment=require(_0x95cd('0x1'));var BPromise=require(_0x95cd('0x2'));var rs=require(_0x95cd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95cd('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x95cd('0x5'));var config=require(_0x95cd('0x6'));var jayson=require(_0x95cd('0x7'));var client=jayson[_0x95cd('0x8')][_0x95cd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a862e,_0xda639a,_0x50f01d){return new BPromise(function(_0x523d56,_0x4fc0f5){return client[_0x95cd('0xa')](_0x2a862e,_0x50f01d)[_0x95cd('0xb')](function(_0x3cac40){logger[_0x95cd('0xc')](_0x95cd('0xd'),_0xda639a,_0x95cd('0xe'));logger[_0x95cd('0xf')](_0x95cd('0x10'),_0xda639a,_0x95cd('0xe'),JSON[_0x95cd('0x11')](_0x3cac40));if(_0x3cac40[_0x95cd('0x12')]){if(_0x3cac40[_0x95cd('0x12')][_0x95cd('0x13')]===0x1f4){logger[_0x95cd('0x12')](_0x95cd('0xd'),_0xda639a,_0x3cac40[_0x95cd('0x12')][_0x95cd('0x14')]);return _0x4fc0f5(_0x3cac40[_0x95cd('0x12')][_0x95cd('0x14')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0xda639a,_0x3cac40[_0x95cd('0x12')]['message']);return _0x523d56(_0x3cac40[_0x95cd('0x12')][_0x95cd('0x14')]);}else{logger[_0x95cd('0xc')](_0x95cd('0xd'),_0xda639a,_0x95cd('0xe'));_0x523d56(_0x3cac40[_0x95cd('0x15')][_0x95cd('0x14')]);}})[_0x95cd('0x16')](function(_0x14e6f3){logger[_0x95cd('0x12')](_0x95cd('0xd'),_0xda639a,_0x14e6f3);_0x4fc0f5(_0x14e6f3);});});}exports[_0x95cd('0x17')]=function(_0x10a6fe){var _0x56b2d0=this;return new Promise(function(_0x1fecb4,_0x143937){return db['MailServerIn'][_0x95cd('0x18')]({'raw':_0x10a6fe[_0x95cd('0x19')]?_0x10a6fe[_0x95cd('0x19')][_0x95cd('0x1a')]===undefined?!![]:![]:!![],'where':_0x10a6fe[_0x95cd('0x19')]?_0x10a6fe[_0x95cd('0x19')][_0x95cd('0x1b')]||null:null,'attributes':_0x10a6fe[_0x95cd('0x19')]?_0x10a6fe['options']['attributes']||null:null,'limit':_0x10a6fe['options']?_0x10a6fe[_0x95cd('0x19')][_0x95cd('0x1c')]||null:null,'include':_0x10a6fe[_0x95cd('0x19')]?_0x10a6fe[_0x95cd('0x19')][_0x95cd('0x1d')]?_[_0x95cd('0x1e')](_0x10a6fe[_0x95cd('0x19')]['include'],function(_0x794de0){return{'model':db[_0x794de0[_0x95cd('0x1f')]],'as':_0x794de0['as'],'attributes':_0x794de0[_0x95cd('0x20')],'include':_0x794de0[_0x95cd('0x1d')]?_['map'](_0x794de0[_0x95cd('0x1d')],function(_0xedd11b){return{'model':db[_0xedd11b['model']],'as':_0xedd11b['as'],'attributes':_0xedd11b[_0x95cd('0x20')],'include':_0xedd11b['include']?_[_0x95cd('0x1e')](_0xedd11b[_0x95cd('0x1d')],function(_0x21251f){return{'model':db[_0x21251f['model']],'as':_0x21251f['as'],'attributes':_0x21251f[_0x95cd('0x20')]};}):[]};}):[]};}):[]:[]})[_0x95cd('0xb')](function(_0x283bcf){logger[_0x95cd('0xc')](_0x95cd('0x17'),_0x10a6fe);logger[_0x95cd('0xf')](_0x95cd('0x17'),_0x10a6fe,JSON[_0x95cd('0x11')](_0x283bcf));_0x1fecb4(_0x283bcf);})[_0x95cd('0x16')](function(_0x4b5c36){logger[_0x95cd('0x12')](_0x95cd('0x17'),_0x4b5c36[_0x95cd('0x14')],_0x10a6fe);_0x143937(_0x56b2d0['error'](0x1f4,_0x4b5c36[_0x95cd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 932f5be..64781f8 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x7a54,0x106));var _0x47a5=function(_0x353bcc,_0x315cc8){_0x353bcc=_0x353bcc-0x0;var _0x34528b=_0x7a54[_0x353bcc];return _0x34528b;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 6afa12e..32dca05 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 _0xbfcc=['sequelize','STRING','INTEGER'];(function(_0x4128c2,_0x59ee78){var _0x1af896=function(_0x32e3ee){while(--_0x32e3ee){_0x4128c2['push'](_0x4128c2['shift']());}};_0x1af896(++_0x59ee78);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x421196,_0x1cbd94){_0x421196=_0x421196-0x0;var _0x2738af=_0xbfcc[_0x421196];return _0x2738af;};'use strict';var Sequelize=require(_0xcbfc('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xcbfc('0x1')]},'user':{'type':Sequelize[_0xcbfc('0x1')]},'pass':{'type':Sequelize[_0xcbfc('0x1')]},'port':{'type':Sequelize[_0xcbfc('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xbc9d=['sequelize','exports','STRING','BOOLEAN'];(function(_0x1ff465,_0x160b55){var _0x90afc3=function(_0x1473f1){while(--_0x1473f1){_0x1ff465['push'](_0x1ff465['shift']());}};_0x90afc3(++_0x160b55);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x2b3100,_0x345565){_0x2b3100=_0x2b3100-0x0;var _0x59bb19=_0xbc9d[_0x2b3100];return _0x59bb19;};'use strict';var Sequelize=require(_0xdbc9('0x0'));module[_0xdbc9('0x1')]={'description':{'type':Sequelize[_0xdbc9('0x2')]},'host':{'type':Sequelize[_0xdbc9('0x2')]},'user':{'type':Sequelize[_0xdbc9('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xdbc9('0x2')]},'authentication':{'type':Sequelize[_0xdbc9('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xdbc9('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 864623a..220bdb2 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 _0x0268=['find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','map','MailServerOut','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll'];(function(_0x233a4c,_0x3ef6e1){var _0x51d977=function(_0x5f27f7){while(--_0x5f27f7){_0x233a4c['push'](_0x233a4c['shift']());}};_0x51d977(++_0x3ef6e1);}(_0x0268,0xea));var _0x8026=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x0268[_0x110c3d];return _0x226d67;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8026('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8026('0x1'));var rp=require(_0x8026('0x2'));var moment=require(_0x8026('0x3'));var BPromise=require(_0x8026('0x4'));var Mustache=require(_0x8026('0x5'));var util=require(_0x8026('0x6'));var path=require(_0x8026('0x7'));var sox=require(_0x8026('0x8'));var csv=require(_0x8026('0x9'));var ejs=require(_0x8026('0xa'));var fs=require('fs');var fs_extra=require(_0x8026('0xb'));var _=require('lodash');var squel=require(_0x8026('0xc'));var crypto=require(_0x8026('0xd'));var jsforce=require(_0x8026('0xe'));var deskjs=require(_0x8026('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8026('0x10'));var Redis=require('ioredis');var authService=require(_0x8026('0x11'));var qs=require(_0x8026('0x12'));var as=require(_0x8026('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8026('0x14'));var utils=require(_0x8026('0x15'));var config=require(_0x8026('0x16'));var licenseUtil=require(_0x8026('0x17'));var db=require(_0x8026('0x18'))['db'];function respondWithStatusCode(_0x2ee9f7,_0x2d1666){_0x2d1666=_0x2d1666||0xcc;return function(_0x5a106a){if(_0x5a106a){return _0x2ee9f7[_0x8026('0x19')](_0x2d1666);}return _0x2ee9f7[_0x8026('0x1a')](_0x2d1666)[_0x8026('0x1b')]();};}function respondWithResult(_0x274791,_0x26aa1e){_0x26aa1e=_0x26aa1e||0xc8;return function(_0x4fb7b8){if(_0x4fb7b8){return _0x274791[_0x8026('0x1a')](_0x26aa1e)['json'](_0x4fb7b8);}};}function respondWithFilteredResult(_0x19114d,_0x43d542){return function(_0x111228){if(_0x111228){var _0x309b30=typeof _0x43d542[_0x8026('0x1c')]===_0x8026('0x1d')&&typeof _0x43d542[_0x8026('0x1e')]===_0x8026('0x1d');var _0xbdff29=_0x111228[_0x8026('0x1f')];var _0x240344=_0x309b30?0x0:_0x43d542[_0x8026('0x1c')];var _0xd672d9=_0x309b30?_0x111228[_0x8026('0x1f')]:_0x43d542[_0x8026('0x1c')]+_0x43d542[_0x8026('0x1e')];var _0x4f5133;if(_0xd672d9>=_0xbdff29){_0xd672d9=_0xbdff29;_0x4f5133=0xc8;}else{_0x4f5133=0xce;}_0x19114d[_0x8026('0x1a')](_0x4f5133);return _0x19114d[_0x8026('0x20')](_0x8026('0x21'),_0x240344+'-'+_0xd672d9+'/'+_0xbdff29)[_0x8026('0x22')](_0x111228);}return null;};}function patchUpdates(_0x19d85e){return function(_0x485512){try{jsonpatch[_0x8026('0x23')](_0x485512,_0x19d85e,!![]);}catch(_0x2d577d){return BPromise[_0x8026('0x24')](_0x2d577d);}return _0x485512['save']();};}function saveUpdates(_0x4edf2c,_0x4a2d46){return function(_0x38358f){if(_0x38358f){return _0x38358f[_0x8026('0x25')](_0x4edf2c)[_0x8026('0x26')](function(_0x163b11){return _0x163b11;});}return null;};}function removeEntity(_0x8a9f24,_0x184dcf){return function(_0x295002){if(_0x295002){return _0x295002[_0x8026('0x27')]()[_0x8026('0x26')](function(){_0x8a9f24['status'](0xcc)[_0x8026('0x1b')]();});}};}function handleEntityNotFound(_0xdf11b5,_0x4c9a1c){return function(_0x444ed5){if(!_0x444ed5){_0xdf11b5[_0x8026('0x19')](0x194);}return _0x444ed5;};}function handleError(_0xce34c1,_0x16b4b2){_0x16b4b2=_0x16b4b2||0x1f4;return function(_0x2db6a2){logger['error'](_0x2db6a2[_0x8026('0x28')]);if(_0x2db6a2['name']){delete _0x2db6a2[_0x8026('0x29')];}_0xce34c1[_0x8026('0x1a')](_0x16b4b2)[_0x8026('0x2a')](_0x2db6a2);};}exports['index']=function(_0x8987c3,_0x5b4033){var _0x50e59f={},_0xc19f23={},_0xbc6ed9={'count':0x0,'rows':[]};var _0x51ec10=_[_0x8026('0x2b')](db[_0x8026('0x2c')]['rawAttributes'],function(_0x361024){return{'name':_0x361024[_0x8026('0x2d')],'type':_0x361024[_0x8026('0x2e')][_0x8026('0x2f')]};});_0xc19f23['model']=_[_0x8026('0x2b')](_0x51ec10,_0x8026('0x29'));_0xc19f23[_0x8026('0x30')]=_[_0x8026('0x31')](_0x8987c3[_0x8026('0x30')]);_0xc19f23['filters']=_[_0x8026('0x32')](_0xc19f23[_0x8026('0x33')],_0xc19f23['query']);_0x50e59f[_0x8026('0x34')]=_['intersection'](_0xc19f23[_0x8026('0x33')],qs['fields'](_0x8987c3[_0x8026('0x30')][_0x8026('0x35')]));_0x50e59f[_0x8026('0x34')]=_0x50e59f['attributes'][_0x8026('0x36')]?_0x50e59f['attributes']:_0xc19f23['model'];if(!_0x8987c3['query'][_0x8026('0x37')](_0x8026('0x38'))){_0x50e59f[_0x8026('0x1e')]=qs['limit'](_0x8987c3[_0x8026('0x30')]['limit']);_0x50e59f[_0x8026('0x1c')]=qs[_0x8026('0x1c')](_0x8987c3[_0x8026('0x30')]['offset']);}_0x50e59f[_0x8026('0x39')]=qs[_0x8026('0x3a')](_0x8987c3[_0x8026('0x30')]['sort']);_0x50e59f[_0x8026('0x3b')]=qs[_0x8026('0x3c')](_[_0x8026('0x3d')](_0x8987c3[_0x8026('0x30')],_0xc19f23[_0x8026('0x3c')]),_0x51ec10);if(_0x8987c3['query']['filter']){_0x50e59f[_0x8026('0x3b')]=_['merge'](_0x50e59f[_0x8026('0x3b')],{'$or':_[_0x8026('0x2b')](_0x51ec10,function(_0xcd1a87){if(_0xcd1a87[_0x8026('0x2e')]!==_0x8026('0x3e')){var _0x103957={};_0x103957[_0xcd1a87[_0x8026('0x29')]]={'$like':'%'+_0x8987c3['query'][_0x8026('0x3f')]+'%'};return _0x103957;}})});}_0x50e59f=_[_0x8026('0x40')]({},_0x50e59f,_0x8987c3[_0x8026('0x41')]);var _0x9046ee={'where':_0x50e59f[_0x8026('0x3b')]};return db[_0x8026('0x2c')][_0x8026('0x1f')](_0x9046ee)[_0x8026('0x26')](function(_0x225a83){_0xbc6ed9[_0x8026('0x1f')]=_0x225a83;if(_0x8987c3[_0x8026('0x30')]['includeAll']){_0x50e59f[_0x8026('0x42')]=[{'all':!![]}];}return db[_0x8026('0x2c')][_0x8026('0x43')](_0x50e59f);})['then'](function(_0x28c3d5){_0xbc6ed9[_0x8026('0x44')]=_0x28c3d5;return _0xbc6ed9;})['then'](respondWithFilteredResult(_0x5b4033,_0x50e59f))[_0x8026('0x45')](handleError(_0x5b4033,null));};exports[_0x8026('0x46')]=function(_0x8d5725,_0x2e1611){var _0x1138ca={'raw':!![],'where':{'id':_0x8d5725[_0x8026('0x47')]['id']}},_0xd8e195={};_0xd8e195[_0x8026('0x33')]=_[_0x8026('0x31')](db['MailServerOut'][_0x8026('0x48')]);_0xd8e195['query']=_['keys'](_0x8d5725[_0x8026('0x30')]);_0xd8e195[_0x8026('0x3c')]=_[_0x8026('0x32')](_0xd8e195[_0x8026('0x33')],_0xd8e195[_0x8026('0x30')]);_0x1138ca['attributes']=_[_0x8026('0x32')](_0xd8e195['model'],qs['fields'](_0x8d5725['query'][_0x8026('0x35')]));_0x1138ca[_0x8026('0x34')]=_0x1138ca[_0x8026('0x34')][_0x8026('0x36')]?_0x1138ca[_0x8026('0x34')]:_0xd8e195[_0x8026('0x33')];if(_0x8d5725[_0x8026('0x30')][_0x8026('0x49')]){_0x1138ca[_0x8026('0x42')]=[{'all':!![]}];}_0x1138ca=_[_0x8026('0x40')]({},_0x1138ca,_0x8d5725[_0x8026('0x41')]);return db[_0x8026('0x2c')][_0x8026('0x4a')](_0x1138ca)['then'](handleEntityNotFound(_0x2e1611,null))[_0x8026('0x26')](respondWithResult(_0x2e1611,null))[_0x8026('0x45')](handleError(_0x2e1611,null));};exports[_0x8026('0x4b')]=function(_0x39f379,_0x191028){return db[_0x8026('0x2c')][_0x8026('0x4b')](_0x39f379['body'],{})[_0x8026('0x26')](respondWithResult(_0x191028,0xc9))[_0x8026('0x45')](handleError(_0x191028,null));};exports[_0x8026('0x25')]=function(_0x126af1,_0x4612af){if(_0x126af1[_0x8026('0x4c')]['id']){delete _0x126af1['body']['id'];}return db[_0x8026('0x2c')][_0x8026('0x4a')]({'where':{'id':_0x126af1[_0x8026('0x47')]['id']}})[_0x8026('0x26')](handleEntityNotFound(_0x4612af,null))[_0x8026('0x26')](saveUpdates(_0x126af1[_0x8026('0x4c')],null))[_0x8026('0x26')](respondWithResult(_0x4612af,null))[_0x8026('0x45')](handleError(_0x4612af,null));};exports[_0x8026('0x27')]=function(_0x112b71,_0x23f9e8){return db['MailServerOut'][_0x8026('0x4a')]({'where':{'id':_0x112b71[_0x8026('0x47')]['id']}})[_0x8026('0x26')](handleEntityNotFound(_0x23f9e8,null))[_0x8026('0x26')](removeEntity(_0x23f9e8,null))[_0x8026('0x45')](handleError(_0x23f9e8,null));}; \ No newline at end of file +var _0x8042=['map','MailServerOut','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','includeAll','include','rows','catch','params','rawAttributes','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','json','apply','save','update','then','destroy','stack','name','send','index'];(function(_0x23edcb,_0x2aed3d){var _0x4d1450=function(_0xcfd691){while(--_0xcfd691){_0x23edcb['push'](_0x23edcb['shift']());}};_0x4d1450(++_0x2aed3d);}(_0x8042,0x1da));var _0x2804=function(_0x455bbf,_0x487eb1){_0x455bbf=_0x455bbf-0x0;var _0x31cc6a=_0x8042[_0x455bbf];return _0x31cc6a;};'use strict';var emlformat=require(_0x2804('0x0'));var rimraf=require(_0x2804('0x1'));var zipdir=require(_0x2804('0x2'));var jsonpatch=require(_0x2804('0x3'));var rp=require(_0x2804('0x4'));var moment=require(_0x2804('0x5'));var BPromise=require(_0x2804('0x6'));var Mustache=require(_0x2804('0x7'));var util=require(_0x2804('0x8'));var path=require('path');var sox=require(_0x2804('0x9'));var csv=require(_0x2804('0xa'));var ejs=require(_0x2804('0xb'));var fs=require('fs');var fs_extra=require(_0x2804('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2804('0xd'));var jsforce=require(_0x2804('0xe'));var deskjs=require(_0x2804('0xf'));var toCsv=require(_0x2804('0xa'));var querystring=require(_0x2804('0x10'));var Papa=require('papaparse');var Redis=require(_0x2804('0x11'));var authService=require(_0x2804('0x12'));var qs=require(_0x2804('0x13'));var as=require(_0x2804('0x14'));var hardwareService=require(_0x2804('0x15'));var logger=require(_0x2804('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x2804('0x17'));var licenseUtil=require(_0x2804('0x18'));var db=require(_0x2804('0x19'))['db'];function respondWithStatusCode(_0x4946ce,_0x28d98b){_0x28d98b=_0x28d98b||0xcc;return function(_0x24433a){if(_0x24433a){return _0x4946ce[_0x2804('0x1a')](_0x28d98b);}return _0x4946ce[_0x2804('0x1b')](_0x28d98b)[_0x2804('0x1c')]();};}function respondWithResult(_0x528f24,_0x512ef5){_0x512ef5=_0x512ef5||0xc8;return function(_0x32e536){if(_0x32e536){return _0x528f24[_0x2804('0x1b')](_0x512ef5)['json'](_0x32e536);}};}function respondWithFilteredResult(_0x5775e9,_0x65a365){return function(_0x113341){if(_0x113341){var _0x5cfa7a=typeof _0x65a365['offset']===_0x2804('0x1d')&&typeof _0x65a365[_0x2804('0x1e')]===_0x2804('0x1d');var _0x5209c8=_0x113341['count'];var _0x9beb04=_0x5cfa7a?0x0:_0x65a365[_0x2804('0x1f')];var _0x372bc7=_0x5cfa7a?_0x113341[_0x2804('0x20')]:_0x65a365['offset']+_0x65a365[_0x2804('0x1e')];var _0x32fd62;if(_0x372bc7>=_0x5209c8){_0x372bc7=_0x5209c8;_0x32fd62=0xc8;}else{_0x32fd62=0xce;}_0x5775e9['status'](_0x32fd62);return _0x5775e9[_0x2804('0x21')]('Content-Range',_0x9beb04+'-'+_0x372bc7+'/'+_0x5209c8)[_0x2804('0x22')](_0x113341);}return null;};}function patchUpdates(_0x299d83){return function(_0x314ebf){try{jsonpatch[_0x2804('0x23')](_0x314ebf,_0x299d83,!![]);}catch(_0x18a5ab){return BPromise['reject'](_0x18a5ab);}return _0x314ebf[_0x2804('0x24')]();};}function saveUpdates(_0x34fe17,_0x1d4467){return function(_0x27a046){if(_0x27a046){return _0x27a046[_0x2804('0x25')](_0x34fe17)[_0x2804('0x26')](function(_0x106eb7){return _0x106eb7;});}return null;};}function removeEntity(_0x4d3071,_0x364cb2){return function(_0x500089){if(_0x500089){return _0x500089[_0x2804('0x27')]()[_0x2804('0x26')](function(){_0x4d3071[_0x2804('0x1b')](0xcc)[_0x2804('0x1c')]();});}};}function handleEntityNotFound(_0x33ff79,_0x2a2e94){return function(_0x4d8446){if(!_0x4d8446){_0x33ff79[_0x2804('0x1a')](0x194);}return _0x4d8446;};}function handleError(_0x2acce0,_0x500e8e){_0x500e8e=_0x500e8e||0x1f4;return function(_0x1b3ac2){logger['error'](_0x1b3ac2[_0x2804('0x28')]);if(_0x1b3ac2[_0x2804('0x29')]){delete _0x1b3ac2[_0x2804('0x29')];}_0x2acce0[_0x2804('0x1b')](_0x500e8e)[_0x2804('0x2a')](_0x1b3ac2);};}exports[_0x2804('0x2b')]=function(_0x1862ab,_0x5bdb75){var _0x1f77d2={},_0xdfbd76={},_0xb8f3d5={'count':0x0,'rows':[]};var _0x47d10f=_[_0x2804('0x2c')](db[_0x2804('0x2d')]['rawAttributes'],function(_0x5eef08){return{'name':_0x5eef08['fieldName'],'type':_0x5eef08['type']['key']};});_0xdfbd76['model']=_[_0x2804('0x2c')](_0x47d10f,'name');_0xdfbd76['query']=_[_0x2804('0x2e')](_0x1862ab[_0x2804('0x2f')]);_0xdfbd76[_0x2804('0x30')]=_[_0x2804('0x31')](_0xdfbd76['model'],_0xdfbd76[_0x2804('0x2f')]);_0x1f77d2[_0x2804('0x32')]=_[_0x2804('0x31')](_0xdfbd76[_0x2804('0x33')],qs['fields'](_0x1862ab['query'][_0x2804('0x34')]));_0x1f77d2[_0x2804('0x32')]=_0x1f77d2[_0x2804('0x32')][_0x2804('0x35')]?_0x1f77d2[_0x2804('0x32')]:_0xdfbd76[_0x2804('0x33')];if(!_0x1862ab[_0x2804('0x2f')][_0x2804('0x36')](_0x2804('0x37'))){_0x1f77d2[_0x2804('0x1e')]=qs[_0x2804('0x1e')](_0x1862ab[_0x2804('0x2f')]['limit']);_0x1f77d2[_0x2804('0x1f')]=qs[_0x2804('0x1f')](_0x1862ab[_0x2804('0x2f')][_0x2804('0x1f')]);}_0x1f77d2[_0x2804('0x38')]=qs[_0x2804('0x39')](_0x1862ab[_0x2804('0x2f')][_0x2804('0x39')]);_0x1f77d2[_0x2804('0x3a')]=qs[_0x2804('0x30')](_[_0x2804('0x3b')](_0x1862ab['query'],_0xdfbd76[_0x2804('0x30')]),_0x47d10f);if(_0x1862ab['query']['filter']){_0x1f77d2[_0x2804('0x3a')]=_['merge'](_0x1f77d2[_0x2804('0x3a')],{'$or':_[_0x2804('0x2c')](_0x47d10f,function(_0xa8b660){if(_0xa8b660[_0x2804('0x3c')]!==_0x2804('0x3d')){var _0x1bf8aa={};_0x1bf8aa[_0xa8b660['name']]={'$like':'%'+_0x1862ab[_0x2804('0x2f')][_0x2804('0x3e')]+'%'};return _0x1bf8aa;}})});}_0x1f77d2=_[_0x2804('0x3f')]({},_0x1f77d2,_0x1862ab['options']);var _0x55b261={'where':_0x1f77d2[_0x2804('0x3a')]};return db[_0x2804('0x2d')]['count'](_0x55b261)[_0x2804('0x26')](function(_0x2cd636){_0xb8f3d5['count']=_0x2cd636;if(_0x1862ab[_0x2804('0x2f')][_0x2804('0x40')]){_0x1f77d2[_0x2804('0x41')]=[{'all':!![]}];}return db[_0x2804('0x2d')]['findAll'](_0x1f77d2);})[_0x2804('0x26')](function(_0x137eb4){_0xb8f3d5[_0x2804('0x42')]=_0x137eb4;return _0xb8f3d5;})[_0x2804('0x26')](respondWithFilteredResult(_0x5bdb75,_0x1f77d2))[_0x2804('0x43')](handleError(_0x5bdb75,null));};exports['show']=function(_0x6e89aa,_0x328810){var _0x2c5fe9={'raw':!![],'where':{'id':_0x6e89aa[_0x2804('0x44')]['id']}},_0xa2f65a={};_0xa2f65a[_0x2804('0x33')]=_['keys'](db['MailServerOut'][_0x2804('0x45')]);_0xa2f65a[_0x2804('0x2f')]=_['keys'](_0x6e89aa[_0x2804('0x2f')]);_0xa2f65a['filters']=_['intersection'](_0xa2f65a[_0x2804('0x33')],_0xa2f65a[_0x2804('0x2f')]);_0x2c5fe9['attributes']=_[_0x2804('0x31')](_0xa2f65a[_0x2804('0x33')],qs[_0x2804('0x34')](_0x6e89aa[_0x2804('0x2f')][_0x2804('0x34')]));_0x2c5fe9[_0x2804('0x32')]=_0x2c5fe9[_0x2804('0x32')][_0x2804('0x35')]?_0x2c5fe9[_0x2804('0x32')]:_0xa2f65a[_0x2804('0x33')];if(_0x6e89aa[_0x2804('0x2f')][_0x2804('0x40')]){_0x2c5fe9['include']=[{'all':!![]}];}_0x2c5fe9=_[_0x2804('0x3f')]({},_0x2c5fe9,_0x6e89aa[_0x2804('0x46')]);return db[_0x2804('0x2d')]['find'](_0x2c5fe9)['then'](handleEntityNotFound(_0x328810,null))[_0x2804('0x26')](respondWithResult(_0x328810,null))['catch'](handleError(_0x328810,null));};exports[_0x2804('0x47')]=function(_0x3c1d8b,_0x4c6b73){return db[_0x2804('0x2d')][_0x2804('0x47')](_0x3c1d8b[_0x2804('0x48')],{})['then'](respondWithResult(_0x4c6b73,0xc9))[_0x2804('0x43')](handleError(_0x4c6b73,null));};exports['update']=function(_0x3637e2,_0x5b5498){if(_0x3637e2['body']['id']){delete _0x3637e2[_0x2804('0x48')]['id'];}return db[_0x2804('0x2d')][_0x2804('0x49')]({'where':{'id':_0x3637e2[_0x2804('0x44')]['id']}})[_0x2804('0x26')](handleEntityNotFound(_0x5b5498,null))['then'](saveUpdates(_0x3637e2[_0x2804('0x48')],null))['then'](respondWithResult(_0x5b5498,null))['catch'](handleError(_0x5b5498,null));};exports['destroy']=function(_0x1e4133,_0x1462da){return db[_0x2804('0x2d')][_0x2804('0x49')]({'where':{'id':_0x1e4133[_0x2804('0x44')]['id']}})[_0x2804('0x26')](handleEntityNotFound(_0x1462da,null))['then'](removeEntity(_0x1462da,null))['catch'](handleError(_0x1462da,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 33ce8b3..44d0f1c 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 _0x36aa=['bluebird','request-promise','path','../../config/environment','./mailServerOut.attributes','mail_servers_out','lodash','util','api','moment'];(function(_0x4d83d0,_0xca2fd2){var _0x3883c6=function(_0x210cf4){while(--_0x210cf4){_0x4d83d0['push'](_0x4d83d0['shift']());}};_0x3883c6(++_0xca2fd2);}(_0x36aa,0x88));var _0xa36a=function(_0x5ea722,_0x33372c){_0x5ea722=_0x5ea722-0x0;var _0x4b0d44=_0x36aa[_0x5ea722];return _0x4b0d44;};'use strict';var _=require(_0xa36a('0x0'));var util=require(_0xa36a('0x1'));var logger=require('../../config/logger')(_0xa36a('0x2'));var moment=require(_0xa36a('0x3'));var BPromise=require(_0xa36a('0x4'));var rp=require(_0xa36a('0x5'));var fs=require('fs');var path=require(_0xa36a('0x6'));var rimraf=require('rimraf');var config=require(_0xa36a('0x7'));var attributes=require(_0xa36a('0x8'));module['exports']=function(_0xaac875,_0x4c773f){return _0xaac875['define']('MailServerOut',attributes,{'tableName':_0xa36a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1caf=['request-promise','rimraf','../../config/environment','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x44e239,_0x35c138){var _0x2df409=function(_0x3eb320){while(--_0x3eb320){_0x44e239['push'](_0x44e239['shift']());}};_0x2df409(++_0x35c138);}(_0x1caf,0xbd));var _0xf1ca=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x1caf[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0xf1ca('0x0'));var util=require(_0xf1ca('0x1'));var logger=require(_0xf1ca('0x2'))(_0xf1ca('0x3'));var moment=require(_0xf1ca('0x4'));var BPromise=require(_0xf1ca('0x5'));var rp=require(_0xf1ca('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf1ca('0x7'));var config=require(_0xf1ca('0x8'));var attributes=require('./mailServerOut.attributes');module[_0xf1ca('0x9')]=function(_0x4bcc54,_0x3fef49){return _0x4bcc54[_0xf1ca('0xa')](_0xf1ca('0xb'),attributes,{'tableName':_0xf1ca('0xc'),'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 9bcf26c..3385cee 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x18600a,_0x21b4c2){var _0x1affbd=function(_0x4087eb){while(--_0x4087eb){_0x18600a['push'](_0x18600a['shift']());}};_0x1affbd(++_0x21b4c2);}(_0x5f2f,0x73));var _0xf5f2=function(_0xc1fe7b,_0x4a0863){_0xc1fe7b=_0xc1fe7b-0x0;var _0x38b020=_0x5f2f[_0xc1fe7b];return _0x38b020;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0xe2a016,_0x493eef){var _0x5aece2=function(_0x4926eb){while(--_0x4926eb){_0xe2a016['push'](_0xe2a016['shift']());}};_0x5aece2(++_0x493eef);}(_0x2ef3,0xba));var _0x32ef=function(_0x29712e,_0x29e347){_0x29712e=_0x29712e-0x0;var _0x504df3=_0x2ef3[_0x29712e];return _0x504df3;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index b426770..fd7d3bc 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 _0x5675=['get','/describe','describe','/:id','show','post','isAuthenticated','create','update','destroy','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','index'];(function(_0x4965a1,_0x47bf05){var _0x299f9c=function(_0x22822b){while(--_0x22822b){_0x4965a1['push'](_0x4965a1['shift']());}};_0x299f9c(++_0x47bf05);}(_0x5675,0x92));var _0x5567=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x5675[_0x2aa0e7];return _0x1472c0;};'use strict';var multer=require(_0x5567('0x0'));var util=require(_0x5567('0x1'));var path=require('path');var timeout=require(_0x5567('0x2'));var express=require('express');var router=express[_0x5567('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5567('0x4'));var config=require(_0x5567('0x5'));var controller=require('./mailSubstatus.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5567('0x6')]);router[_0x5567('0x7')](_0x5567('0x8'),auth['isAuthenticated'](),controller[_0x5567('0x9')]);router[_0x5567('0x7')](_0x5567('0xa'),auth['isAuthenticated'](),controller[_0x5567('0xb')]);router[_0x5567('0xc')]('/',auth[_0x5567('0xd')](),controller[_0x5567('0xe')]);router['put'](_0x5567('0xa'),auth[_0x5567('0xd')](),controller[_0x5567('0xf')]);router['delete'](_0x5567('0xa'),auth['isAuthenticated'](),controller[_0x5567('0x10')]);module['exports']=router; \ No newline at end of file +var _0x3501=['express','fs-extra','../../components/auth/service','../../config/environment','./mailSubstatus.controller','get','index','isAuthenticated','describe','/:id','create','put','delete','destroy','multer','util','path','connect-timeout'];(function(_0x331ce0,_0xe335b9){var _0x31c3c7=function(_0x2bf43c){while(--_0x2bf43c){_0x331ce0['push'](_0x331ce0['shift']());}};_0x31c3c7(++_0xe335b9);}(_0x3501,0xd4));var _0x1350=function(_0x4ae2a1,_0x453065){_0x4ae2a1=_0x4ae2a1-0x0;var _0x49b5b7=_0x3501[_0x4ae2a1];return _0x49b5b7;};'use strict';var multer=require(_0x1350('0x0'));var util=require(_0x1350('0x1'));var path=require(_0x1350('0x2'));var timeout=require(_0x1350('0x3'));var express=require(_0x1350('0x4'));var router=express['Router']();var fs_extra=require(_0x1350('0x5'));var auth=require(_0x1350('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1350('0x7'));var controller=require(_0x1350('0x8'));router[_0x1350('0x9')]('/',auth['isAuthenticated'](),controller[_0x1350('0xa')]);router['get']('/describe',auth[_0x1350('0xb')](),controller[_0x1350('0xc')]);router[_0x1350('0x9')](_0x1350('0xd'),auth[_0x1350('0xb')](),controller['show']);router['post']('/',auth[_0x1350('0xb')](),controller[_0x1350('0xe')]);router[_0x1350('0xf')]('/:id',auth[_0x1350('0xb')](),controller['update']);router[_0x1350('0x10')](_0x1350('0xd'),auth[_0x1350('0xb')](),controller[_0x1350('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index af4bce0..87a1353 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 _0xbd10=['STRING','sequelize','exports'];(function(_0x13b330,_0x297092){var _0x1f666c=function(_0x5ebc84){while(--_0x5ebc84){_0x13b330['push'](_0x13b330['shift']());}};_0x1f666c(++_0x297092);}(_0xbd10,0x85));var _0x0bd1=function(_0x3a50d9,_0x71522a){_0x3a50d9=_0x3a50d9-0x0;var _0x243d4c=_0xbd10[_0x3a50d9];return _0x243d4c;};'use strict';var Sequelize=require(_0x0bd1('0x0'));module[_0x0bd1('0x1')]={'name':{'type':Sequelize[_0x0bd1('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0bd1('0x2')]}}; \ No newline at end of file +var _0x446c=['STRING','name','sequelize','exports'];(function(_0x16ca43,_0x16bcc2){var _0x4c9d67=function(_0x456fb7){while(--_0x456fb7){_0x16ca43['push'](_0x16ca43['shift']());}};_0x4c9d67(++_0x16bcc2);}(_0x446c,0x156));var _0xc446=function(_0x473738,_0x15ea31){_0x473738=_0x473738-0x0;var _0x1df4ae=_0x446c[_0x473738];return _0x1df4ae;};'use strict';var Sequelize=require(_0xc446('0x0'));module[_0xc446('0x1')]={'name':{'type':Sequelize[_0xc446('0x2')],'unique':_0xc446('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 6bb73e5..5ae1794 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 _0x5186=['then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','ejs','lodash','crypto','jsforce','desk.js','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','count','limit','set','apply','reject','save','update'];(function(_0x1526e1,_0x5ed5a5){var _0x249a1e=function(_0x4a7c12){while(--_0x4a7c12){_0x1526e1['push'](_0x1526e1['shift']());}};_0x249a1e(++_0x5ed5a5);}(_0x5186,0x193));var _0x6518=function(_0x57bd83,_0x1f4edc){_0x57bd83=_0x57bd83-0x0;var _0x509621=_0x5186[_0x57bd83];return _0x509621;};'use strict';var emlformat=require(_0x6518('0x0'));var rimraf=require(_0x6518('0x1'));var zipdir=require(_0x6518('0x2'));var jsonpatch=require(_0x6518('0x3'));var rp=require(_0x6518('0x4'));var moment=require(_0x6518('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6518('0x6'));var util=require('util');var path=require(_0x6518('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6518('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6518('0x9'));var squel=require('squel');var crypto=require(_0x6518('0xa'));var jsforce=require(_0x6518('0xb'));var deskjs=require(_0x6518('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6518('0xd'));var Redis=require(_0x6518('0xe'));var authService=require(_0x6518('0xf'));var qs=require(_0x6518('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6518('0x11'));var logger=require(_0x6518('0x12'))(_0x6518('0x13'));var utils=require(_0x6518('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6518('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x286cd0,_0x47ae49){_0x47ae49=_0x47ae49||0xcc;return function(_0x1c602c){if(_0x1c602c){return _0x286cd0[_0x6518('0x16')](_0x47ae49);}return _0x286cd0[_0x6518('0x17')](_0x47ae49)[_0x6518('0x18')]();};}function respondWithResult(_0xc2ea65,_0x5a8d7b){_0x5a8d7b=_0x5a8d7b||0xc8;return function(_0x5a3e02){if(_0x5a3e02){return _0xc2ea65[_0x6518('0x17')](_0x5a8d7b)[_0x6518('0x19')](_0x5a3e02);}};}function respondWithFilteredResult(_0x325401,_0x4479e5){return function(_0xaabfc6){if(_0xaabfc6){var _0x22b17b=typeof _0x4479e5[_0x6518('0x1a')]==='undefined'&&typeof _0x4479e5['limit']===_0x6518('0x1b');var _0x4c4c98=_0xaabfc6[_0x6518('0x1c')];var _0x3ddc27=_0x22b17b?0x0:_0x4479e5[_0x6518('0x1a')];var _0x4d0afe=_0x22b17b?_0xaabfc6[_0x6518('0x1c')]:_0x4479e5[_0x6518('0x1a')]+_0x4479e5[_0x6518('0x1d')];var _0x1ab82e;if(_0x4d0afe>=_0x4c4c98){_0x4d0afe=_0x4c4c98;_0x1ab82e=0xc8;}else{_0x1ab82e=0xce;}_0x325401['status'](_0x1ab82e);return _0x325401[_0x6518('0x1e')]('Content-Range',_0x3ddc27+'-'+_0x4d0afe+'/'+_0x4c4c98)['json'](_0xaabfc6);}return null;};}function patchUpdates(_0x2793e3){return function(_0xea8d95){try{jsonpatch[_0x6518('0x1f')](_0xea8d95,_0x2793e3,!![]);}catch(_0x5af44a){return BPromise[_0x6518('0x20')](_0x5af44a);}return _0xea8d95[_0x6518('0x21')]();};}function saveUpdates(_0xd168f7,_0x57c01a){return function(_0x44c99b){if(_0x44c99b){return _0x44c99b[_0x6518('0x22')](_0xd168f7)[_0x6518('0x23')](function(_0x4ef992){return _0x4ef992;});}return null;};}function removeEntity(_0x19c69d,_0x8eb48f){return function(_0x3ee327){if(_0x3ee327){return _0x3ee327[_0x6518('0x24')]()[_0x6518('0x23')](function(){_0x19c69d[_0x6518('0x17')](0xcc)[_0x6518('0x18')]();});}};}function handleEntityNotFound(_0x8d672b,_0x1bd085){return function(_0x246509){if(!_0x246509){_0x8d672b[_0x6518('0x16')](0x194);}return _0x246509;};}function handleError(_0x43129f,_0x2d1290){_0x2d1290=_0x2d1290||0x1f4;return function(_0x19e3ff){logger[_0x6518('0x25')](_0x19e3ff[_0x6518('0x26')]);if(_0x19e3ff[_0x6518('0x27')]){delete _0x19e3ff[_0x6518('0x27')];}_0x43129f[_0x6518('0x17')](_0x2d1290)[_0x6518('0x28')](_0x19e3ff);};}exports[_0x6518('0x29')]=function(_0x23d54e,_0x13d25e){var _0x3ddd30={},_0x1de94d={},_0x5a19e1={'count':0x0,'rows':[]};var _0x562445=_[_0x6518('0x2a')](db[_0x6518('0x2b')][_0x6518('0x2c')],function(_0x34c8b2){return{'name':_0x34c8b2['fieldName'],'type':_0x34c8b2[_0x6518('0x2d')]['key']};});_0x1de94d[_0x6518('0x2e')]=_[_0x6518('0x2a')](_0x562445,_0x6518('0x27'));_0x1de94d[_0x6518('0x2f')]=_[_0x6518('0x30')](_0x23d54e[_0x6518('0x2f')]);_0x1de94d[_0x6518('0x31')]=_[_0x6518('0x32')](_0x1de94d[_0x6518('0x2e')],_0x1de94d[_0x6518('0x2f')]);_0x3ddd30[_0x6518('0x33')]=_[_0x6518('0x32')](_0x1de94d['model'],qs[_0x6518('0x34')](_0x23d54e[_0x6518('0x2f')][_0x6518('0x34')]));_0x3ddd30[_0x6518('0x33')]=_0x3ddd30[_0x6518('0x33')][_0x6518('0x35')]?_0x3ddd30['attributes']:_0x1de94d[_0x6518('0x2e')];if(!_0x23d54e[_0x6518('0x2f')][_0x6518('0x36')](_0x6518('0x37'))){_0x3ddd30[_0x6518('0x1d')]=qs['limit'](_0x23d54e[_0x6518('0x2f')][_0x6518('0x1d')]);_0x3ddd30[_0x6518('0x1a')]=qs[_0x6518('0x1a')](_0x23d54e[_0x6518('0x2f')][_0x6518('0x1a')]);}_0x3ddd30['order']=qs[_0x6518('0x38')](_0x23d54e[_0x6518('0x2f')][_0x6518('0x38')]);_0x3ddd30[_0x6518('0x39')]=qs['filters'](_[_0x6518('0x3a')](_0x23d54e[_0x6518('0x2f')],_0x1de94d[_0x6518('0x31')]),_0x562445);if(_0x23d54e[_0x6518('0x2f')]['filter']){_0x3ddd30['where']=_[_0x6518('0x3b')](_0x3ddd30[_0x6518('0x39')],{'$or':_['map'](_0x562445,function(_0x21e269){if(_0x21e269[_0x6518('0x2d')]!==_0x6518('0x3c')){var _0xdb7347={};_0xdb7347[_0x21e269[_0x6518('0x27')]]={'$like':'%'+_0x23d54e[_0x6518('0x2f')][_0x6518('0x3d')]+'%'};return _0xdb7347;}})});}_0x3ddd30=_[_0x6518('0x3b')]({},_0x3ddd30,_0x23d54e[_0x6518('0x3e')]);var _0x1155e2={'where':_0x3ddd30[_0x6518('0x39')]};return db['MailSubstatus'][_0x6518('0x1c')](_0x1155e2)[_0x6518('0x23')](function(_0x2e3b8f){_0x5a19e1[_0x6518('0x1c')]=_0x2e3b8f;if(_0x23d54e[_0x6518('0x2f')][_0x6518('0x3f')]){_0x3ddd30[_0x6518('0x40')]=[{'all':!![]}];}return db[_0x6518('0x2b')]['findAll'](_0x3ddd30);})[_0x6518('0x23')](function(_0x5230d7){_0x5a19e1[_0x6518('0x41')]=_0x5230d7;return _0x5a19e1;})[_0x6518('0x23')](respondWithFilteredResult(_0x13d25e,_0x3ddd30))[_0x6518('0x42')](handleError(_0x13d25e,null));};exports[_0x6518('0x43')]=function(_0x1d06f7,_0xa66639){var _0x3831f8={'raw':!![],'where':{'id':_0x1d06f7[_0x6518('0x44')]['id']}},_0x8df306={};_0x8df306[_0x6518('0x2e')]=_[_0x6518('0x30')](db[_0x6518('0x2b')]['rawAttributes']);_0x8df306['query']=_[_0x6518('0x30')](_0x1d06f7[_0x6518('0x2f')]);_0x8df306['filters']=_[_0x6518('0x32')](_0x8df306[_0x6518('0x2e')],_0x8df306[_0x6518('0x2f')]);_0x3831f8['attributes']=_[_0x6518('0x32')](_0x8df306[_0x6518('0x2e')],qs[_0x6518('0x34')](_0x1d06f7[_0x6518('0x2f')][_0x6518('0x34')]));_0x3831f8[_0x6518('0x33')]=_0x3831f8[_0x6518('0x33')][_0x6518('0x35')]?_0x3831f8[_0x6518('0x33')]:_0x8df306[_0x6518('0x2e')];if(_0x1d06f7[_0x6518('0x2f')][_0x6518('0x3f')]){_0x3831f8['include']=[{'all':!![]}];}_0x3831f8=_[_0x6518('0x3b')]({},_0x3831f8,_0x1d06f7[_0x6518('0x3e')]);return db['MailSubstatus']['find'](_0x3831f8)['then'](handleEntityNotFound(_0xa66639,null))[_0x6518('0x23')](respondWithResult(_0xa66639,null))[_0x6518('0x42')](handleError(_0xa66639,null));};exports[_0x6518('0x45')]=function(_0x50f154,_0x58ab48){return db['MailSubstatus'][_0x6518('0x45')](_0x50f154[_0x6518('0x46')],{})['then'](respondWithResult(_0x58ab48,0xc9))[_0x6518('0x42')](handleError(_0x58ab48,null));};exports['update']=function(_0x13fa8a,_0x50f62c){if(_0x13fa8a[_0x6518('0x46')]['id']){delete _0x13fa8a[_0x6518('0x46')]['id'];}return db[_0x6518('0x2b')]['find']({'where':{'id':_0x13fa8a[_0x6518('0x44')]['id']}})[_0x6518('0x23')](handleEntityNotFound(_0x50f62c,null))[_0x6518('0x23')](saveUpdates(_0x13fa8a['body'],null))[_0x6518('0x23')](respondWithResult(_0x50f62c,null))[_0x6518('0x42')](handleError(_0x50f62c,null));};exports['destroy']=function(_0x144cf2,_0x472b2b){return db[_0x6518('0x2b')][_0x6518('0x47')]({'where':{'id':_0x144cf2[_0x6518('0x44')]['id']}})['then'](handleEntityNotFound(_0x472b2b,null))[_0x6518('0x23')](removeEntity(_0x472b2b,null))[_0x6518('0x42')](handleError(_0x472b2b,null));};exports[_0x6518('0x48')]=function(_0x3a6173,_0x1341a5){return db[_0x6518('0x2b')][_0x6518('0x48')]()[_0x6518('0x23')](respondWithResult(_0x1341a5,null))[_0x6518('0x42')](handleError(_0x1341a5,null));}; \ No newline at end of file +var _0x3ab7=['hasOwnProperty','nolimit','sort','filters','where','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','then','error','stack','name','index','map','MailSubstatus','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length'];(function(_0x2a192a,_0x34e5cb){var _0x356ceb=function(_0xc5f1f1){while(--_0xc5f1f1){_0x2a192a['push'](_0x2a192a['shift']());}};_0x356ceb(++_0x34e5cb);}(_0x3ab7,0x180));var _0x73ab=function(_0x545b71,_0x4f44eb){_0x545b71=_0x545b71-0x0;var _0x26e587=_0x3ab7[_0x545b71];return _0x26e587;};'use strict';var emlformat=require(_0x73ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x73ab('0x1'));var jsonpatch=require(_0x73ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x73ab('0x3'));var Mustache=require(_0x73ab('0x4'));var util=require(_0x73ab('0x5'));var path=require(_0x73ab('0x6'));var sox=require(_0x73ab('0x7'));var csv=require(_0x73ab('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x73ab('0x9'));var _=require(_0x73ab('0xa'));var squel=require(_0x73ab('0xb'));var crypto=require(_0x73ab('0xc'));var jsforce=require(_0x73ab('0xd'));var deskjs=require(_0x73ab('0xe'));var toCsv=require(_0x73ab('0x8'));var querystring=require(_0x73ab('0xf'));var Papa=require(_0x73ab('0x10'));var Redis=require(_0x73ab('0x11'));var authService=require(_0x73ab('0x12'));var qs=require(_0x73ab('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x73ab('0x14'))(_0x73ab('0x15'));var utils=require(_0x73ab('0x16'));var config=require(_0x73ab('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x73ab('0x18'))['db'];function respondWithStatusCode(_0x15827b,_0x375cbc){_0x375cbc=_0x375cbc||0xcc;return function(_0x1903d8){if(_0x1903d8){return _0x15827b[_0x73ab('0x19')](_0x375cbc);}return _0x15827b[_0x73ab('0x1a')](_0x375cbc)[_0x73ab('0x1b')]();};}function respondWithResult(_0x1a250e,_0x5d89d3){_0x5d89d3=_0x5d89d3||0xc8;return function(_0x7b26a3){if(_0x7b26a3){return _0x1a250e[_0x73ab('0x1a')](_0x5d89d3)['json'](_0x7b26a3);}};}function respondWithFilteredResult(_0x2711e2,_0x30f507){return function(_0x2043cc){if(_0x2043cc){var _0x5e47e7=typeof _0x30f507['offset']==='undefined'&&typeof _0x30f507['limit']===_0x73ab('0x1c');var _0x595efc=_0x2043cc[_0x73ab('0x1d')];var _0x2ff5cf=_0x5e47e7?0x0:_0x30f507[_0x73ab('0x1e')];var _0x2f0e24=_0x5e47e7?_0x2043cc[_0x73ab('0x1d')]:_0x30f507[_0x73ab('0x1e')]+_0x30f507[_0x73ab('0x1f')];var _0x3ff80c;if(_0x2f0e24>=_0x595efc){_0x2f0e24=_0x595efc;_0x3ff80c=0xc8;}else{_0x3ff80c=0xce;}_0x2711e2[_0x73ab('0x1a')](_0x3ff80c);return _0x2711e2[_0x73ab('0x20')](_0x73ab('0x21'),_0x2ff5cf+'-'+_0x2f0e24+'/'+_0x595efc)[_0x73ab('0x22')](_0x2043cc);}return null;};}function patchUpdates(_0x321d05){return function(_0xf0f84f){try{jsonpatch[_0x73ab('0x23')](_0xf0f84f,_0x321d05,!![]);}catch(_0x3f57c5){return BPromise[_0x73ab('0x24')](_0x3f57c5);}return _0xf0f84f['save']();};}function saveUpdates(_0x54a018,_0x3bfc46){return function(_0x2bb6c2){if(_0x2bb6c2){return _0x2bb6c2[_0x73ab('0x25')](_0x54a018)[_0x73ab('0x26')](function(_0x4b53c8){return _0x4b53c8;});}return null;};}function removeEntity(_0x59b4c3,_0x53badb){return function(_0x372889){if(_0x372889){return _0x372889['destroy']()[_0x73ab('0x26')](function(){_0x59b4c3[_0x73ab('0x1a')](0xcc)[_0x73ab('0x1b')]();});}};}function handleEntityNotFound(_0x1f1be3,_0x14947f){return function(_0x5423dd){if(!_0x5423dd){_0x1f1be3[_0x73ab('0x19')](0x194);}return _0x5423dd;};}function handleError(_0x5708b9,_0x36438e){_0x36438e=_0x36438e||0x1f4;return function(_0x38e8a5){logger[_0x73ab('0x27')](_0x38e8a5[_0x73ab('0x28')]);if(_0x38e8a5[_0x73ab('0x29')]){delete _0x38e8a5[_0x73ab('0x29')];}_0x5708b9[_0x73ab('0x1a')](_0x36438e)['send'](_0x38e8a5);};}exports[_0x73ab('0x2a')]=function(_0x488634,_0x4f5a29){var _0x28bbfe={},_0x4214be={},_0x5ca3b9={'count':0x0,'rows':[]};var _0xa1a44d=_[_0x73ab('0x2b')](db[_0x73ab('0x2c')][_0x73ab('0x2d')],function(_0x6f2e8a){return{'name':_0x6f2e8a[_0x73ab('0x2e')],'type':_0x6f2e8a[_0x73ab('0x2f')]['key']};});_0x4214be[_0x73ab('0x30')]=_[_0x73ab('0x2b')](_0xa1a44d,'name');_0x4214be[_0x73ab('0x31')]=_['keys'](_0x488634[_0x73ab('0x31')]);_0x4214be['filters']=_[_0x73ab('0x32')](_0x4214be[_0x73ab('0x30')],_0x4214be[_0x73ab('0x31')]);_0x28bbfe['attributes']=_[_0x73ab('0x32')](_0x4214be[_0x73ab('0x30')],qs['fields'](_0x488634[_0x73ab('0x31')][_0x73ab('0x33')]));_0x28bbfe[_0x73ab('0x34')]=_0x28bbfe[_0x73ab('0x34')][_0x73ab('0x35')]?_0x28bbfe[_0x73ab('0x34')]:_0x4214be[_0x73ab('0x30')];if(!_0x488634['query'][_0x73ab('0x36')](_0x73ab('0x37'))){_0x28bbfe[_0x73ab('0x1f')]=qs[_0x73ab('0x1f')](_0x488634[_0x73ab('0x31')][_0x73ab('0x1f')]);_0x28bbfe[_0x73ab('0x1e')]=qs['offset'](_0x488634[_0x73ab('0x31')][_0x73ab('0x1e')]);}_0x28bbfe['order']=qs[_0x73ab('0x38')](_0x488634[_0x73ab('0x31')][_0x73ab('0x38')]);_0x28bbfe['where']=qs[_0x73ab('0x39')](_['pick'](_0x488634[_0x73ab('0x31')],_0x4214be[_0x73ab('0x39')]),_0xa1a44d);if(_0x488634[_0x73ab('0x31')]['filter']){_0x28bbfe[_0x73ab('0x3a')]=_[_0x73ab('0x3b')](_0x28bbfe[_0x73ab('0x3a')],{'$or':_['map'](_0xa1a44d,function(_0x259993){if(_0x259993[_0x73ab('0x2f')]!==_0x73ab('0x3c')){var _0x1fd893={};_0x1fd893[_0x259993[_0x73ab('0x29')]]={'$like':'%'+_0x488634['query']['filter']+'%'};return _0x1fd893;}})});}_0x28bbfe=_[_0x73ab('0x3b')]({},_0x28bbfe,_0x488634['options']);var _0xae6b27={'where':_0x28bbfe[_0x73ab('0x3a')]};return db[_0x73ab('0x2c')][_0x73ab('0x1d')](_0xae6b27)[_0x73ab('0x26')](function(_0x2cbee4){_0x5ca3b9[_0x73ab('0x1d')]=_0x2cbee4;if(_0x488634['query'][_0x73ab('0x3d')]){_0x28bbfe[_0x73ab('0x3e')]=[{'all':!![]}];}return db['MailSubstatus'][_0x73ab('0x3f')](_0x28bbfe);})['then'](function(_0x473388){_0x5ca3b9['rows']=_0x473388;return _0x5ca3b9;})[_0x73ab('0x26')](respondWithFilteredResult(_0x4f5a29,_0x28bbfe))[_0x73ab('0x40')](handleError(_0x4f5a29,null));};exports[_0x73ab('0x41')]=function(_0x397462,_0x59cb80){var _0x3e25af={'raw':!![],'where':{'id':_0x397462[_0x73ab('0x42')]['id']}},_0x3ff7f8={};_0x3ff7f8[_0x73ab('0x30')]=_[_0x73ab('0x43')](db[_0x73ab('0x2c')][_0x73ab('0x2d')]);_0x3ff7f8[_0x73ab('0x31')]=_[_0x73ab('0x43')](_0x397462['query']);_0x3ff7f8[_0x73ab('0x39')]=_['intersection'](_0x3ff7f8[_0x73ab('0x30')],_0x3ff7f8[_0x73ab('0x31')]);_0x3e25af[_0x73ab('0x34')]=_[_0x73ab('0x32')](_0x3ff7f8['model'],qs[_0x73ab('0x33')](_0x397462[_0x73ab('0x31')][_0x73ab('0x33')]));_0x3e25af[_0x73ab('0x34')]=_0x3e25af[_0x73ab('0x34')][_0x73ab('0x35')]?_0x3e25af[_0x73ab('0x34')]:_0x3ff7f8['model'];if(_0x397462[_0x73ab('0x31')][_0x73ab('0x3d')]){_0x3e25af['include']=[{'all':!![]}];}_0x3e25af=_[_0x73ab('0x3b')]({},_0x3e25af,_0x397462['options']);return db[_0x73ab('0x2c')]['find'](_0x3e25af)[_0x73ab('0x26')](handleEntityNotFound(_0x59cb80,null))['then'](respondWithResult(_0x59cb80,null))['catch'](handleError(_0x59cb80,null));};exports[_0x73ab('0x44')]=function(_0x58da75,_0x9313d){return db['MailSubstatus'][_0x73ab('0x44')](_0x58da75[_0x73ab('0x45')],{})[_0x73ab('0x26')](respondWithResult(_0x9313d,0xc9))[_0x73ab('0x40')](handleError(_0x9313d,null));};exports[_0x73ab('0x25')]=function(_0x40a069,_0x4c2b0f){if(_0x40a069[_0x73ab('0x45')]['id']){delete _0x40a069[_0x73ab('0x45')]['id'];}return db[_0x73ab('0x2c')][_0x73ab('0x46')]({'where':{'id':_0x40a069[_0x73ab('0x42')]['id']}})['then'](handleEntityNotFound(_0x4c2b0f,null))[_0x73ab('0x26')](saveUpdates(_0x40a069[_0x73ab('0x45')],null))[_0x73ab('0x26')](respondWithResult(_0x4c2b0f,null))[_0x73ab('0x40')](handleError(_0x4c2b0f,null));};exports[_0x73ab('0x47')]=function(_0x7f1cba,_0x24c0f6){return db['MailSubstatus']['find']({'where':{'id':_0x7f1cba[_0x73ab('0x42')]['id']}})[_0x73ab('0x26')](handleEntityNotFound(_0x24c0f6,null))[_0x73ab('0x26')](removeEntity(_0x24c0f6,null))['catch'](handleError(_0x24c0f6,null));};exports['describe']=function(_0x1b868a,_0x1ef0dc){return db[_0x73ab('0x2c')][_0x73ab('0x48')]()[_0x73ab('0x26')](respondWithResult(_0x1ef0dc,null))[_0x73ab('0x40')](handleError(_0x1ef0dc,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 97fa6f5..f63bf17 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 _0x6c41=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x2ab324,_0x49fbac){var _0x427c10=function(_0x4674c2){while(--_0x4674c2){_0x2ab324['push'](_0x2ab324['shift']());}};_0x427c10(++_0x49fbac);}(_0x6c41,0xee));var _0x16c4=function(_0x1b1e76,_0x31695b){_0x1b1e76=_0x1b1e76-0x0;var _0x3d743a=_0x6c41[_0x1b1e76];return _0x3d743a;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x16c4('0x0'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x16c4('0x1')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x1ecd96){return function(_0x1fce75,_0x5e1b7d,_0x2749e0){MailSubstatusEvents[_0x16c4('0x2')](_0x1ecd96+':'+_0x1fce75['id'],_0x1fce75);MailSubstatusEvents['emit'](_0x1ecd96,_0x1fce75);_0x2749e0(null);};}for(var e in events){if(events[_0x16c4('0x3')](e)){var event=events[e];MailSubstatus[_0x16c4('0x4')](e,emitEvent(event));}}module[_0x16c4('0x5')]=MailSubstatusEvents; \ No newline at end of file +var _0xb0cb=['update','emit','hasOwnProperty','hook','../../mysqldb','MailSubstatus','setMaxListeners'];(function(_0x45fa67,_0x54f9c8){var _0x2eddaf=function(_0x3a9aec){while(--_0x3a9aec){_0x45fa67['push'](_0x45fa67['shift']());}};_0x2eddaf(++_0x54f9c8);}(_0xb0cb,0x1d9));var _0xbb0c=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xb0cb[_0x4fbfd9];return _0x31dc94;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0xbb0c('0x0'))['db'][_0xbb0c('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xbb0c('0x2')](0x0);var events={'afterUpdate':_0xbb0c('0x3')};function emitEvent(_0xb71659){return function(_0x17fb15,_0x4cd99c,_0x39e19a){MailSubstatusEvents[_0xbb0c('0x4')](_0xb71659+':'+_0x17fb15['id'],_0x17fb15);MailSubstatusEvents[_0xbb0c('0x4')](_0xb71659,_0x17fb15);_0x39e19a(null);};}for(var e in events){if(events[_0xbb0c('0x5')](e)){var event=events[e];MailSubstatus[_0xbb0c('0x6')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index d6065e8..e3ecf7c 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 _0x2819=['name','catch','models','define','mail_substatuses','Condition','update','mailSubstatus','_previousDataValues'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x2819,0x14f));var _0x9281=function(_0x2570f1,_0x591e10){_0x2570f1=_0x2570f1-0x0;var _0x4c93f7=_0x2819[_0x2570f1];return _0x4c93f7;};'use strict';var attributes=require('./mailSubstatus.attributes');module['exports']=function(_0x4cff19){var _0xd9f4ca=_0x4cff19[_0x9281('0x0')];return _0x4cff19[_0x9281('0x1')]('MailSubstatus',attributes,{'tableName':_0x9281('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x315191,_0xde8e9,_0x440662){return _0xd9f4ca[_0x9281('0x3')][_0x9281('0x4')]({'value':_0x315191['name']},{'where':{'field':_0x9281('0x5'),'value':_0x315191[_0x9281('0x6')][_0x9281('0x7')]}})['then'](function(){_0x440662();})[_0x9281('0x8')](function(_0x12c732){_0x440662(_0x12c732);});}}});}; \ No newline at end of file +var _0x1f61=['define','MailSubstatus','mail_substatuses','update','mailSubstatus','then','./mailSubstatus.attributes','exports','models'];(function(_0x5a1d85,_0x334ae5){var _0x20f063=function(_0x538f17){while(--_0x538f17){_0x5a1d85['push'](_0x5a1d85['shift']());}};_0x20f063(++_0x334ae5);}(_0x1f61,0x10b));var _0x11f6=function(_0x1c5adf,_0x12a026){_0x1c5adf=_0x1c5adf-0x0;var _0x3dd9c2=_0x1f61[_0x1c5adf];return _0x3dd9c2;};'use strict';var attributes=require(_0x11f6('0x0'));module[_0x11f6('0x1')]=function(_0xfe9ae8){var _0x44657f=_0xfe9ae8[_0x11f6('0x2')];return _0xfe9ae8[_0x11f6('0x3')](_0x11f6('0x4'),attributes,{'tableName':_0x11f6('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0xad93ca,_0x822049,_0x2f6c6d){return _0x44657f['Condition'][_0x11f6('0x6')]({'value':_0xad93ca['name']},{'where':{'field':_0x11f6('0x7'),'value':_0xad93ca['_previousDataValues']['name']}})[_0x11f6('0x8')](function(){_0x2f6c6d();})['catch'](function(_0x3c6835){_0x2f6c6d(_0x3c6835);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 9fd7fa0..4a1b6c9 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 _0x054d=['info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x2e77e7,_0xd963f1){var _0xbf7386=function(_0x116e14){while(--_0x116e14){_0x2e77e7['push'](_0x2e77e7['shift']());}};_0xbf7386(++_0xd963f1);}(_0x054d,0x11f));var _0xd054=function(_0x13b860,_0x5de82f){_0x13b860=_0x13b860-0x0;var _0x399444=_0x054d[_0x13b860];return _0x399444;};'use strict';var _=require(_0xd054('0x0'));var util=require(_0xd054('0x1'));var moment=require(_0xd054('0x2'));var BPromise=require(_0xd054('0x3'));var rs=require(_0xd054('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd054('0x5'))['db'];var utils=require(_0xd054('0x6'));var logger=require('../../config/logger')(_0xd054('0x7'));var config=require(_0xd054('0x8'));var jayson=require(_0xd054('0x9'));var client=jayson['client'][_0xd054('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28aa89,_0x148a9b,_0x477f63){return new BPromise(function(_0xc53c63,_0x4c0bfd){return client[_0xd054('0xb')](_0x28aa89,_0x477f63)[_0xd054('0xc')](function(_0x8cc5e5){logger[_0xd054('0xd')](_0xd054('0xe'),_0x148a9b,_0xd054('0xf'));logger[_0xd054('0x10')](_0xd054('0x11'),_0x148a9b,_0xd054('0xf'),JSON['stringify'](_0x8cc5e5));if(_0x8cc5e5[_0xd054('0x12')]){if(_0x8cc5e5['error']['code']===0x1f4){logger[_0xd054('0x12')](_0xd054('0xe'),_0x148a9b,_0x8cc5e5[_0xd054('0x12')][_0xd054('0x13')]);return _0x4c0bfd(_0x8cc5e5[_0xd054('0x12')]['message']);}logger[_0xd054('0x12')](_0xd054('0xe'),_0x148a9b,_0x8cc5e5[_0xd054('0x12')][_0xd054('0x13')]);return _0xc53c63(_0x8cc5e5[_0xd054('0x12')][_0xd054('0x13')]);}else{logger[_0xd054('0xd')](_0xd054('0xe'),_0x148a9b,'request\x20sent');_0xc53c63(_0x8cc5e5['result'][_0xd054('0x13')]);}})['catch'](function(_0x1a4eb5){logger['error'](_0xd054('0xe'),_0x148a9b,_0x1a4eb5);_0x4c0bfd(_0x1a4eb5);});});} \ No newline at end of file +var _0x76fb=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','debug','request\x20sent','stringify','error','code','MailSubstatus,\x20%s,\x20%s','result','message','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3a6724,_0x1eda5d){var _0x310c51=function(_0x5eeec4){while(--_0x5eeec4){_0x3a6724['push'](_0x3a6724['shift']());}};_0x310c51(++_0x1eda5d);}(_0x76fb,0x94));var _0xb76f=function(_0x5e2d72,_0x3544a3){_0x5e2d72=_0x5e2d72-0x0;var _0x26bab4=_0x76fb[_0x5e2d72];return _0x26bab4;};'use strict';var _=require(_0xb76f('0x0'));var util=require(_0xb76f('0x1'));var moment=require(_0xb76f('0x2'));var BPromise=require('bluebird');var rs=require(_0xb76f('0x3'));var fs=require('fs');var Redis=require(_0xb76f('0x4'));var db=require(_0xb76f('0x5'))['db'];var utils=require(_0xb76f('0x6'));var logger=require(_0xb76f('0x7'))(_0xb76f('0x8'));var config=require(_0xb76f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb76f('0xa')][_0xb76f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a1dc7,_0xa99582,_0x13d314){return new BPromise(function(_0x411b0b,_0x56daf9){return client[_0xb76f('0xc')](_0x5a1dc7,_0x13d314)['then'](function(_0xab79e2){logger[_0xb76f('0xd')]('MailSubstatus,\x20%s,\x20%s',_0xa99582,'request\x20sent');logger[_0xb76f('0xe')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0xa99582,_0xb76f('0xf'),JSON[_0xb76f('0x10')](_0xab79e2));if(_0xab79e2[_0xb76f('0x11')]){if(_0xab79e2[_0xb76f('0x11')][_0xb76f('0x12')]===0x1f4){logger[_0xb76f('0x11')](_0xb76f('0x13'),_0xa99582,_0xab79e2[_0xb76f('0x11')]['message']);return _0x56daf9(_0xab79e2[_0xb76f('0x11')]['message']);}logger['error'](_0xb76f('0x13'),_0xa99582,_0xab79e2[_0xb76f('0x11')]['message']);return _0x411b0b(_0xab79e2['error']['message']);}else{logger[_0xb76f('0xd')](_0xb76f('0x13'),_0xa99582,_0xb76f('0xf'));_0x411b0b(_0xab79e2[_0xb76f('0x14')][_0xb76f('0x15')]);}})['catch'](function(_0xe82afc){logger['error'](_0xb76f('0x13'),_0xa99582,_0xe82afc);_0x56daf9(_0xe82afc);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index a3a30dd..9b5880c 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 _0x848c=['index','/describe','describe','show','put','/:id','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated'];(function(_0xedddc5,_0x264d56){var _0x15942b=function(_0x379b4f){while(--_0x379b4f){_0xedddc5['push'](_0xedddc5['shift']());}};_0x15942b(++_0x264d56);}(_0x848c,0x12f));var _0xc848=function(_0x5e4d4d,_0x5a5aa6){_0x5e4d4d=_0x5e4d4d-0x0;var _0x40cbd6=_0x848c[_0x5e4d4d];return _0x40cbd6;};'use strict';var multer=require(_0xc848('0x0'));var util=require(_0xc848('0x1'));var path=require(_0xc848('0x2'));var timeout=require('connect-timeout');var express=require(_0xc848('0x3'));var router=express[_0xc848('0x4')]();var fs_extra=require(_0xc848('0x5'));var auth=require(_0xc848('0x6'));var interaction=require(_0xc848('0x7'));var config=require(_0xc848('0x8'));var controller=require(_0xc848('0x9'));router[_0xc848('0xa')]('/',auth[_0xc848('0xb')](),controller[_0xc848('0xc')]);router[_0xc848('0xa')](_0xc848('0xd'),auth[_0xc848('0xb')](),controller[_0xc848('0xe')]);router[_0xc848('0xa')]('/:id',auth[_0xc848('0xb')](),controller[_0xc848('0xf')]);router['post']('/',auth[_0xc848('0xb')](),controller['create']);router[_0xc848('0x10')](_0xc848('0x11'),auth[_0xc848('0xb')](),controller[_0xc848('0x12')]);router['delete'](_0xc848('0x11'),auth[_0xc848('0xb')](),controller[_0xc848('0x13')]);module[_0xc848('0x14')]=router; \ No newline at end of file +var _0xdda1=['isAuthenticated','get','describe','/:id','post','create','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdda1,0xf3));var _0x1dda=function(_0x2ec91a,_0x2575f0){_0x2ec91a=_0x2ec91a-0x0;var _0x1e599b=_0xdda1[_0x2ec91a];return _0x1e599b;};'use strict';var multer=require(_0x1dda('0x0'));var util=require(_0x1dda('0x1'));var path=require(_0x1dda('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1dda('0x3')]();var fs_extra=require(_0x1dda('0x4'));var auth=require(_0x1dda('0x5'));var interaction=require(_0x1dda('0x6'));var config=require(_0x1dda('0x7'));var controller=require(_0x1dda('0x8'));router['get']('/',auth[_0x1dda('0x9')](),controller['index']);router[_0x1dda('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x1dda('0xb')]);router[_0x1dda('0xa')](_0x1dda('0xc'),auth[_0x1dda('0x9')](),controller['show']);router[_0x1dda('0xd')]('/',auth[_0x1dda('0x9')](),controller[_0x1dda('0xe')]);router['put'](_0x1dda('0xc'),auth[_0x1dda('0x9')](),controller['update']);router[_0x1dda('0xf')](_0x1dda('0xc'),auth[_0x1dda('0x9')](),controller[_0x1dda('0x10')]);module[_0x1dda('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 64c3869..ca127b1 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(_0x2d6db3,_0xa4df80){var _0x3fab08=function(_0x5ef83d){while(--_0x5ef83d){_0x2d6db3['push'](_0x2d6db3['shift']());}};_0x3fab08(++_0xa4df80);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xcb91[_0x231e16];return _0x570a7c;};'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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x200534,_0x56f8db){var _0x49ab6a=function(_0x207cd0){while(--_0x207cd0){_0x200534['push'](_0x200534['shift']());}};_0x49ab6a(++_0x56f8db);}(_0x70e0,0x17b));var _0x070e=function(_0x121c03,_0x562786){_0x121c03=_0x121c03-0x0;var _0x1b1562=_0x70e0[_0x121c03];return _0x1b1562;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index b232a3f..1a58f99 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 _0x1111=['pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','map','MailTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0x49ffa1,_0x2448b1){var _0x153ad3=function(_0x28003f){while(--_0x28003f){_0x49ffa1['push'](_0x49ffa1['shift']());}};_0x153ad3(++_0x2448b1);}(_0x1111,0xab));var _0x1111=function(_0x31c6ea,_0x2ec193){_0x31c6ea=_0x31c6ea-0x0;var _0x1163b2=_0x1111[_0x31c6ea];return _0x1163b2;};'use strict';var emlformat=require(_0x1111('0x0'));var rimraf=require(_0x1111('0x1'));var zipdir=require(_0x1111('0x2'));var jsonpatch=require(_0x1111('0x3'));var rp=require('request-promise');var moment=require(_0x1111('0x4'));var BPromise=require(_0x1111('0x5'));var Mustache=require('mustache');var util=require(_0x1111('0x6'));var path=require(_0x1111('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1111('0x8'));var fs=require('fs');var fs_extra=require(_0x1111('0x9'));var _=require(_0x1111('0xa'));var squel=require('squel');var crypto=require(_0x1111('0xb'));var jsforce=require(_0x1111('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1111('0xd'));var querystring=require(_0x1111('0xe'));var Papa=require(_0x1111('0xf'));var Redis=require(_0x1111('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1111('0x11'));var as=require(_0x1111('0x12'));var hardwareService=require(_0x1111('0x13'));var logger=require(_0x1111('0x14'))(_0x1111('0x15'));var utils=require('../../config/utils');var config=require(_0x1111('0x16'));var licenseUtil=require(_0x1111('0x17'));var db=require(_0x1111('0x18'))['db'];function respondWithStatusCode(_0x2004ce,_0x4fa64f){_0x4fa64f=_0x4fa64f||0xcc;return function(_0xa5698d){if(_0xa5698d){return _0x2004ce[_0x1111('0x19')](_0x4fa64f);}return _0x2004ce['status'](_0x4fa64f)['end']();};}function respondWithResult(_0x359885,_0x58b3c1){_0x58b3c1=_0x58b3c1||0xc8;return function(_0x1ab702){if(_0x1ab702){return _0x359885[_0x1111('0x1a')](_0x58b3c1)[_0x1111('0x1b')](_0x1ab702);}};}function respondWithFilteredResult(_0x410743,_0x16df80){return function(_0x5af98e){if(_0x5af98e){var _0x43d272=typeof _0x16df80[_0x1111('0x1c')]===_0x1111('0x1d')&&typeof _0x16df80[_0x1111('0x1e')]===_0x1111('0x1d');var _0x49910c=_0x5af98e['count'];var _0x3c9d97=_0x43d272?0x0:_0x16df80['offset'];var _0x50d5b6=_0x43d272?_0x5af98e[_0x1111('0x1f')]:_0x16df80[_0x1111('0x1c')]+_0x16df80[_0x1111('0x1e')];var _0x1b5004;if(_0x50d5b6>=_0x49910c){_0x50d5b6=_0x49910c;_0x1b5004=0xc8;}else{_0x1b5004=0xce;}_0x410743[_0x1111('0x1a')](_0x1b5004);return _0x410743[_0x1111('0x20')](_0x1111('0x21'),_0x3c9d97+'-'+_0x50d5b6+'/'+_0x49910c)['json'](_0x5af98e);}return null;};}function patchUpdates(_0x1d4e96){return function(_0x1dc312){try{jsonpatch[_0x1111('0x22')](_0x1dc312,_0x1d4e96,!![]);}catch(_0x211702){return BPromise[_0x1111('0x23')](_0x211702);}return _0x1dc312[_0x1111('0x24')]();};}function saveUpdates(_0x340e30,_0x5e95b3){return function(_0x560a6a){if(_0x560a6a){return _0x560a6a[_0x1111('0x25')](_0x340e30)[_0x1111('0x26')](function(_0x114214){return _0x114214;});}return null;};}function removeEntity(_0x89eea4,_0x41486a){return function(_0x28be3e){if(_0x28be3e){return _0x28be3e['destroy']()['then'](function(){_0x89eea4['status'](0xcc)[_0x1111('0x27')]();});}};}function handleEntityNotFound(_0x3b501a,_0x31b25b){return function(_0x80ac00){if(!_0x80ac00){_0x3b501a['sendStatus'](0x194);}return _0x80ac00;};}function handleError(_0x1e15db,_0x13a2cf){_0x13a2cf=_0x13a2cf||0x1f4;return function(_0x59dde6){logger[_0x1111('0x28')](_0x59dde6[_0x1111('0x29')]);if(_0x59dde6[_0x1111('0x2a')]){delete _0x59dde6[_0x1111('0x2a')];}_0x1e15db[_0x1111('0x1a')](_0x13a2cf)['send'](_0x59dde6);};}exports['index']=function(_0x278671,_0x521418){var _0x115741={},_0x2ed531={},_0x26f0f8={'count':0x0,'rows':[]};var _0x3a574a=_[_0x1111('0x2b')](db[_0x1111('0x2c')][_0x1111('0x2d')],function(_0x1076a4){return{'name':_0x1076a4['fieldName'],'type':_0x1076a4[_0x1111('0x2e')][_0x1111('0x2f')]};});_0x2ed531[_0x1111('0x30')]=_['map'](_0x3a574a,'name');_0x2ed531[_0x1111('0x31')]=_[_0x1111('0x32')](_0x278671[_0x1111('0x31')]);_0x2ed531[_0x1111('0x33')]=_[_0x1111('0x34')](_0x2ed531[_0x1111('0x30')],_0x2ed531[_0x1111('0x31')]);_0x115741[_0x1111('0x35')]=_[_0x1111('0x34')](_0x2ed531['model'],qs[_0x1111('0x36')](_0x278671[_0x1111('0x31')]['fields']));_0x115741['attributes']=_0x115741['attributes'][_0x1111('0x37')]?_0x115741['attributes']:_0x2ed531[_0x1111('0x30')];if(!_0x278671[_0x1111('0x31')][_0x1111('0x38')](_0x1111('0x39'))){_0x115741[_0x1111('0x1e')]=qs[_0x1111('0x1e')](_0x278671[_0x1111('0x31')][_0x1111('0x1e')]);_0x115741[_0x1111('0x1c')]=qs[_0x1111('0x1c')](_0x278671[_0x1111('0x31')]['offset']);}_0x115741['order']=qs[_0x1111('0x3a')](_0x278671[_0x1111('0x31')][_0x1111('0x3a')]);_0x115741[_0x1111('0x3b')]=qs[_0x1111('0x33')](_[_0x1111('0x3c')](_0x278671[_0x1111('0x31')],_0x2ed531[_0x1111('0x33')]),_0x3a574a);if(_0x278671[_0x1111('0x31')][_0x1111('0x3d')]){_0x115741[_0x1111('0x3b')]=_[_0x1111('0x3e')](_0x115741[_0x1111('0x3b')],{'$or':_[_0x1111('0x2b')](_0x3a574a,function(_0x309b49){if(_0x309b49['type']!==_0x1111('0x3f')){var _0x5d9668={};_0x5d9668[_0x309b49[_0x1111('0x2a')]]={'$like':'%'+_0x278671['query']['filter']+'%'};return _0x5d9668;}})});}_0x115741=_[_0x1111('0x3e')]({},_0x115741,_0x278671[_0x1111('0x40')]);var _0x28f67c={'where':_0x115741[_0x1111('0x3b')]};return db[_0x1111('0x2c')][_0x1111('0x1f')](_0x28f67c)['then'](function(_0x583a50){_0x26f0f8['count']=_0x583a50;if(_0x278671[_0x1111('0x31')]['includeAll']){_0x115741['include']=[{'all':!![]}];}return db[_0x1111('0x2c')][_0x1111('0x41')](_0x115741);})[_0x1111('0x26')](function(_0x4285b7){_0x26f0f8[_0x1111('0x42')]=_0x4285b7;return _0x26f0f8;})['then'](respondWithFilteredResult(_0x521418,_0x115741))['catch'](handleError(_0x521418,null));};exports[_0x1111('0x43')]=function(_0x1d889b,_0x2f1971){var _0x184d9c={'raw':!![],'where':{'id':_0x1d889b[_0x1111('0x44')]['id']}},_0x4d24e5={};_0x4d24e5[_0x1111('0x30')]=_[_0x1111('0x32')](db['MailTransferReport'][_0x1111('0x2d')]);_0x4d24e5[_0x1111('0x31')]=_[_0x1111('0x32')](_0x1d889b['query']);_0x4d24e5[_0x1111('0x33')]=_['intersection'](_0x4d24e5['model'],_0x4d24e5['query']);_0x184d9c['attributes']=_[_0x1111('0x34')](_0x4d24e5[_0x1111('0x30')],qs['fields'](_0x1d889b['query'][_0x1111('0x36')]));_0x184d9c[_0x1111('0x35')]=_0x184d9c[_0x1111('0x35')]['length']?_0x184d9c[_0x1111('0x35')]:_0x4d24e5['model'];if(_0x1d889b[_0x1111('0x31')][_0x1111('0x45')]){_0x184d9c[_0x1111('0x46')]=[{'all':!![]}];}_0x184d9c=_[_0x1111('0x3e')]({},_0x184d9c,_0x1d889b[_0x1111('0x40')]);return db[_0x1111('0x2c')][_0x1111('0x47')](_0x184d9c)[_0x1111('0x26')](handleEntityNotFound(_0x2f1971,null))[_0x1111('0x26')](respondWithResult(_0x2f1971,null))[_0x1111('0x48')](handleError(_0x2f1971,null));};exports[_0x1111('0x49')]=function(_0x41e94f,_0x227cb7){return db[_0x1111('0x2c')]['create'](_0x41e94f[_0x1111('0x4a')],{})[_0x1111('0x26')](respondWithResult(_0x227cb7,0xc9))[_0x1111('0x48')](handleError(_0x227cb7,null));};exports[_0x1111('0x25')]=function(_0x43a384,_0x2fc799){if(_0x43a384[_0x1111('0x4a')]['id']){delete _0x43a384[_0x1111('0x4a')]['id'];}return db[_0x1111('0x2c')][_0x1111('0x47')]({'where':{'id':_0x43a384[_0x1111('0x44')]['id']}})[_0x1111('0x26')](handleEntityNotFound(_0x2fc799,null))[_0x1111('0x26')](saveUpdates(_0x43a384['body'],null))[_0x1111('0x26')](respondWithResult(_0x2fc799,null))[_0x1111('0x48')](handleError(_0x2fc799,null));};exports[_0x1111('0x4b')]=function(_0x480436,_0x34b756){return db[_0x1111('0x2c')]['find']({'where':{'id':_0x480436[_0x1111('0x44')]['id']}})[_0x1111('0x26')](handleEntityNotFound(_0x34b756,null))[_0x1111('0x26')](removeEntity(_0x34b756,null))[_0x1111('0x48')](handleError(_0x34b756,null));};exports['describe']=function(_0x2b0219,_0x45fa4a){return db[_0x1111('0x2c')][_0x1111('0x4c')]()[_0x1111('0x26')](respondWithResult(_0x45fa4a,null))[_0x1111('0x48')](handleError(_0x45fa4a,null));}; \ No newline at end of file +var _0xda73=['to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','MailTransferReport','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','findAll','rows','show','find','catch','create','body','params','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','crypto','jsforce','desk.js'];(function(_0x478a58,_0x53fcec){var _0x3bb51f=function(_0x2d1d8d){while(--_0x2d1d8d){_0x478a58['push'](_0x478a58['shift']());}};_0x3bb51f(++_0x53fcec);}(_0xda73,0x118));var _0x3da7=function(_0x51a029,_0x33c50b){_0x51a029=_0x51a029-0x0;var _0x124e01=_0xda73[_0x51a029];return _0x124e01;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3da7('0x0'));var zipdir=require(_0x3da7('0x1'));var jsonpatch=require(_0x3da7('0x2'));var rp=require('request-promise');var moment=require(_0x3da7('0x3'));var BPromise=require(_0x3da7('0x4'));var Mustache=require(_0x3da7('0x5'));var util=require(_0x3da7('0x6'));var path=require('path');var sox=require(_0x3da7('0x7'));var csv=require('to-csv');var ejs=require(_0x3da7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3da7('0x9'));var jsforce=require(_0x3da7('0xa'));var deskjs=require(_0x3da7('0xb'));var toCsv=require(_0x3da7('0xc'));var querystring=require(_0x3da7('0xd'));var Papa=require('papaparse');var Redis=require(_0x3da7('0xe'));var authService=require(_0x3da7('0xf'));var qs=require(_0x3da7('0x10'));var as=require(_0x3da7('0x11'));var hardwareService=require(_0x3da7('0x12'));var logger=require(_0x3da7('0x13'))(_0x3da7('0x14'));var utils=require(_0x3da7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3da7('0x16'));var db=require(_0x3da7('0x17'))['db'];function respondWithStatusCode(_0x56dbdd,_0x5b11be){_0x5b11be=_0x5b11be||0xcc;return function(_0x1fe51c){if(_0x1fe51c){return _0x56dbdd[_0x3da7('0x18')](_0x5b11be);}return _0x56dbdd[_0x3da7('0x19')](_0x5b11be)[_0x3da7('0x1a')]();};}function respondWithResult(_0x58f241,_0x18cc0c){_0x18cc0c=_0x18cc0c||0xc8;return function(_0x25c6c0){if(_0x25c6c0){return _0x58f241[_0x3da7('0x19')](_0x18cc0c)[_0x3da7('0x1b')](_0x25c6c0);}};}function respondWithFilteredResult(_0x42f53,_0x3fcb30){return function(_0x29417c){if(_0x29417c){var _0x1f5e57=typeof _0x3fcb30[_0x3da7('0x1c')]===_0x3da7('0x1d')&&typeof _0x3fcb30['limit']===_0x3da7('0x1d');var _0x409ecc=_0x29417c[_0x3da7('0x1e')];var _0x2c2260=_0x1f5e57?0x0:_0x3fcb30[_0x3da7('0x1c')];var _0x154a15=_0x1f5e57?_0x29417c[_0x3da7('0x1e')]:_0x3fcb30[_0x3da7('0x1c')]+_0x3fcb30[_0x3da7('0x1f')];var _0x333501;if(_0x154a15>=_0x409ecc){_0x154a15=_0x409ecc;_0x333501=0xc8;}else{_0x333501=0xce;}_0x42f53[_0x3da7('0x19')](_0x333501);return _0x42f53[_0x3da7('0x20')](_0x3da7('0x21'),_0x2c2260+'-'+_0x154a15+'/'+_0x409ecc)[_0x3da7('0x1b')](_0x29417c);}return null;};}function patchUpdates(_0x481225){return function(_0x22f844){try{jsonpatch[_0x3da7('0x22')](_0x22f844,_0x481225,!![]);}catch(_0x3dfbcb){return BPromise['reject'](_0x3dfbcb);}return _0x22f844[_0x3da7('0x23')]();};}function saveUpdates(_0x579564,_0x274ce7){return function(_0x1b0985){if(_0x1b0985){return _0x1b0985[_0x3da7('0x24')](_0x579564)[_0x3da7('0x25')](function(_0x17bc7a){return _0x17bc7a;});}return null;};}function removeEntity(_0x3307a5,_0x29825d){return function(_0xceda49){if(_0xceda49){return _0xceda49[_0x3da7('0x26')]()[_0x3da7('0x25')](function(){_0x3307a5[_0x3da7('0x19')](0xcc)[_0x3da7('0x1a')]();});}};}function handleEntityNotFound(_0x27192b,_0xb8a378){return function(_0x18d1fa){if(!_0x18d1fa){_0x27192b[_0x3da7('0x18')](0x194);}return _0x18d1fa;};}function handleError(_0x1fa2fd,_0x760107){_0x760107=_0x760107||0x1f4;return function(_0x503317){logger['error'](_0x503317[_0x3da7('0x27')]);if(_0x503317['name']){delete _0x503317[_0x3da7('0x28')];}_0x1fa2fd[_0x3da7('0x19')](_0x760107)[_0x3da7('0x29')](_0x503317);};}exports[_0x3da7('0x2a')]=function(_0x517bb0,_0x47cfe5){var _0x5ed1f9={},_0x6e3ee1={},_0x3fd2f3={'count':0x0,'rows':[]};var _0x27c590=_['map'](db[_0x3da7('0x2b')][_0x3da7('0x2c')],function(_0x2e2041){return{'name':_0x2e2041[_0x3da7('0x2d')],'type':_0x2e2041[_0x3da7('0x2e')]['key']};});_0x6e3ee1[_0x3da7('0x2f')]=_[_0x3da7('0x30')](_0x27c590,'name');_0x6e3ee1[_0x3da7('0x31')]=_[_0x3da7('0x32')](_0x517bb0['query']);_0x6e3ee1['filters']=_[_0x3da7('0x33')](_0x6e3ee1[_0x3da7('0x2f')],_0x6e3ee1[_0x3da7('0x31')]);_0x5ed1f9[_0x3da7('0x34')]=_[_0x3da7('0x33')](_0x6e3ee1[_0x3da7('0x2f')],qs[_0x3da7('0x35')](_0x517bb0[_0x3da7('0x31')][_0x3da7('0x35')]));_0x5ed1f9[_0x3da7('0x34')]=_0x5ed1f9[_0x3da7('0x34')][_0x3da7('0x36')]?_0x5ed1f9[_0x3da7('0x34')]:_0x6e3ee1['model'];if(!_0x517bb0[_0x3da7('0x31')]['hasOwnProperty'](_0x3da7('0x37'))){_0x5ed1f9[_0x3da7('0x1f')]=qs[_0x3da7('0x1f')](_0x517bb0[_0x3da7('0x31')][_0x3da7('0x1f')]);_0x5ed1f9[_0x3da7('0x1c')]=qs[_0x3da7('0x1c')](_0x517bb0[_0x3da7('0x31')][_0x3da7('0x1c')]);}_0x5ed1f9[_0x3da7('0x38')]=qs[_0x3da7('0x39')](_0x517bb0[_0x3da7('0x31')]['sort']);_0x5ed1f9[_0x3da7('0x3a')]=qs['filters'](_['pick'](_0x517bb0['query'],_0x6e3ee1[_0x3da7('0x3b')]),_0x27c590);if(_0x517bb0[_0x3da7('0x31')][_0x3da7('0x3c')]){_0x5ed1f9[_0x3da7('0x3a')]=_[_0x3da7('0x3d')](_0x5ed1f9[_0x3da7('0x3a')],{'$or':_[_0x3da7('0x30')](_0x27c590,function(_0x5ec74f){if(_0x5ec74f[_0x3da7('0x2e')]!==_0x3da7('0x3e')){var _0x5b16a2={};_0x5b16a2[_0x5ec74f[_0x3da7('0x28')]]={'$like':'%'+_0x517bb0['query']['filter']+'%'};return _0x5b16a2;}})});}_0x5ed1f9=_[_0x3da7('0x3d')]({},_0x5ed1f9,_0x517bb0['options']);var _0x388dd6={'where':_0x5ed1f9[_0x3da7('0x3a')]};return db['MailTransferReport'][_0x3da7('0x1e')](_0x388dd6)[_0x3da7('0x25')](function(_0x10877d){_0x3fd2f3[_0x3da7('0x1e')]=_0x10877d;if(_0x517bb0[_0x3da7('0x31')][_0x3da7('0x3f')]){_0x5ed1f9['include']=[{'all':!![]}];}return db[_0x3da7('0x2b')][_0x3da7('0x40')](_0x5ed1f9);})[_0x3da7('0x25')](function(_0x502135){_0x3fd2f3[_0x3da7('0x41')]=_0x502135;return _0x3fd2f3;})[_0x3da7('0x25')](respondWithFilteredResult(_0x47cfe5,_0x5ed1f9))['catch'](handleError(_0x47cfe5,null));};exports[_0x3da7('0x42')]=function(_0x1cb690,_0x21cc92){var _0x2a833a={'raw':!![],'where':{'id':_0x1cb690['params']['id']}},_0x3d290a={};_0x3d290a['model']=_[_0x3da7('0x32')](db[_0x3da7('0x2b')][_0x3da7('0x2c')]);_0x3d290a[_0x3da7('0x31')]=_[_0x3da7('0x32')](_0x1cb690[_0x3da7('0x31')]);_0x3d290a['filters']=_[_0x3da7('0x33')](_0x3d290a[_0x3da7('0x2f')],_0x3d290a[_0x3da7('0x31')]);_0x2a833a[_0x3da7('0x34')]=_[_0x3da7('0x33')](_0x3d290a[_0x3da7('0x2f')],qs['fields'](_0x1cb690['query'][_0x3da7('0x35')]));_0x2a833a[_0x3da7('0x34')]=_0x2a833a['attributes'][_0x3da7('0x36')]?_0x2a833a[_0x3da7('0x34')]:_0x3d290a[_0x3da7('0x2f')];if(_0x1cb690[_0x3da7('0x31')][_0x3da7('0x3f')]){_0x2a833a['include']=[{'all':!![]}];}_0x2a833a=_['merge']({},_0x2a833a,_0x1cb690['options']);return db[_0x3da7('0x2b')][_0x3da7('0x43')](_0x2a833a)[_0x3da7('0x25')](handleEntityNotFound(_0x21cc92,null))[_0x3da7('0x25')](respondWithResult(_0x21cc92,null))[_0x3da7('0x44')](handleError(_0x21cc92,null));};exports[_0x3da7('0x45')]=function(_0x100e83,_0x13513d){return db[_0x3da7('0x2b')][_0x3da7('0x45')](_0x100e83[_0x3da7('0x46')],{})[_0x3da7('0x25')](respondWithResult(_0x13513d,0xc9))['catch'](handleError(_0x13513d,null));};exports[_0x3da7('0x24')]=function(_0x4ae051,_0xfb5b1b){if(_0x4ae051[_0x3da7('0x46')]['id']){delete _0x4ae051[_0x3da7('0x46')]['id'];}return db[_0x3da7('0x2b')][_0x3da7('0x43')]({'where':{'id':_0x4ae051[_0x3da7('0x47')]['id']}})[_0x3da7('0x25')](handleEntityNotFound(_0xfb5b1b,null))[_0x3da7('0x25')](saveUpdates(_0x4ae051[_0x3da7('0x46')],null))[_0x3da7('0x25')](respondWithResult(_0xfb5b1b,null))[_0x3da7('0x44')](handleError(_0xfb5b1b,null));};exports[_0x3da7('0x26')]=function(_0x1f7436,_0x5d0673){return db[_0x3da7('0x2b')]['find']({'where':{'id':_0x1f7436[_0x3da7('0x47')]['id']}})[_0x3da7('0x25')](handleEntityNotFound(_0x5d0673,null))[_0x3da7('0x25')](removeEntity(_0x5d0673,null))[_0x3da7('0x44')](handleError(_0x5d0673,null));};exports[_0x3da7('0x48')]=function(_0xc783c4,_0x643c9f){return db['MailTransferReport']['describe']()[_0x3da7('0x25')](respondWithResult(_0x643c9f,null))[_0x3da7('0x44')](handleError(_0x643c9f,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 6478b5d..2d0d8e2 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 _0xe2cd=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0xe2cd,0x64));var _0xde2c=function(_0x522302,_0x6cf3d1){_0x522302=_0x522302-0x0;var _0x1248b7=_0xe2cd[_0x522302];return _0x1248b7;};'use strict';var _=require(_0xde2c('0x0'));var util=require(_0xde2c('0x1'));var logger=require(_0xde2c('0x2'))(_0xde2c('0x3'));var moment=require(_0xde2c('0x4'));var BPromise=require(_0xde2c('0x5'));var rp=require(_0xde2c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde2c('0x7'));var config=require(_0xde2c('0x8'));var attributes=require('./mailTransferReport.attributes');module[_0xde2c('0x9')]=function(_0x2195fc,_0x191eb1){return _0x2195fc[_0xde2c('0xa')]('MailTransferReport',attributes,{'tableName':_0xde2c('0xb'),'paranoid':![],'indexes':[{'name':_0xde2c('0xc'),'fields':[_0xde2c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeec6=['request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x312931,_0x22e92b){var _0xdf26e5=function(_0x5be735){while(--_0x5be735){_0x312931['push'](_0x312931['shift']());}};_0xdf26e5(++_0x22e92b);}(_0xeec6,0x1c2));var _0x6eec=function(_0x56138f,_0x1e9ebb){_0x56138f=_0x56138f-0x0;var _0x1acaf7=_0xeec6[_0x56138f];return _0x1acaf7;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var logger=require(_0x6eec('0x2'))(_0x6eec('0x3'));var moment=require('moment');var BPromise=require(_0x6eec('0x4'));var rp=require(_0x6eec('0x5'));var fs=require('fs');var path=require(_0x6eec('0x6'));var rimraf=require(_0x6eec('0x7'));var config=require(_0x6eec('0x8'));var attributes=require(_0x6eec('0x9'));module['exports']=function(_0x185f31,_0x3c6eda){return _0x185f31['define'](_0x6eec('0xa'),attributes,{'tableName':_0x6eec('0xb'),'paranoid':![],'indexes':[{'name':_0x6eec('0xc'),'fields':[_0x6eec('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 2699ab9..543e2bd 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 _0x4666=['request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','MailTransferReport,\x20%s,\x20%s'];(function(_0x1d0fd1,_0x3f8ee5){var _0x37490b=function(_0x3bb450){while(--_0x3bb450){_0x1d0fd1['push'](_0x1d0fd1['shift']());}};_0x37490b(++_0x3f8ee5);}(_0x4666,0x196));var _0x6466=function(_0x2e2d42,_0x4bb4f7){_0x2e2d42=_0x2e2d42-0x0;var _0x1534b8=_0x4666[_0x2e2d42];return _0x1534b8;};'use strict';var _=require(_0x6466('0x0'));var util=require('util');var moment=require(_0x6466('0x1'));var BPromise=require(_0x6466('0x2'));var rs=require(_0x6466('0x3'));var fs=require('fs');var Redis=require(_0x6466('0x4'));var db=require(_0x6466('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6466('0x6'));var config=require(_0x6466('0x7'));var jayson=require(_0x6466('0x8'));var client=jayson[_0x6466('0x9')][_0x6466('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40442e,_0x45233a,_0x5ae02b){return new BPromise(function(_0x143b90,_0x1e2fdd){return client['request'](_0x40442e,_0x5ae02b)[_0x6466('0xb')](function(_0x47c04f){logger[_0x6466('0xc')](_0x6466('0xd'),_0x45233a,_0x6466('0xe'));logger[_0x6466('0xf')](_0x6466('0x10'),_0x45233a,_0x6466('0xe'),JSON['stringify'](_0x47c04f));if(_0x47c04f[_0x6466('0x11')]){if(_0x47c04f[_0x6466('0x11')][_0x6466('0x12')]===0x1f4){logger[_0x6466('0x11')](_0x6466('0xd'),_0x45233a,_0x47c04f['error']['message']);return _0x1e2fdd(_0x47c04f['error'][_0x6466('0x13')]);}logger[_0x6466('0x11')](_0x6466('0xd'),_0x45233a,_0x47c04f[_0x6466('0x11')][_0x6466('0x13')]);return _0x143b90(_0x47c04f[_0x6466('0x11')]['message']);}else{logger[_0x6466('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x45233a,_0x6466('0xe'));_0x143b90(_0x47c04f[_0x6466('0x14')][_0x6466('0x13')]);}})['catch'](function(_0x2e0c72){logger['error'](_0x6466('0xd'),_0x45233a,_0x2e0c72);_0x1e2fdd(_0x2e0c72);});});} \ No newline at end of file +var _0x3d58=['error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','request','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x3d58,0x117));var _0x83d5=function(_0x28e2a8,_0x1a3d6d){_0x28e2a8=_0x28e2a8-0x0;var _0xa7a529=_0x3d58[_0x28e2a8];return _0xa7a529;};'use strict';var _=require(_0x83d5('0x0'));var util=require(_0x83d5('0x1'));var moment=require(_0x83d5('0x2'));var BPromise=require(_0x83d5('0x3'));var rs=require(_0x83d5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x83d5('0x5'));var logger=require(_0x83d5('0x6'))(_0x83d5('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x83d5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x281403,_0x3ce2d6,_0x49df21){return new BPromise(function(_0x13aeb1,_0xe6035){return client[_0x83d5('0x9')](_0x281403,_0x49df21)['then'](function(_0x65dbce){logger['info'](_0x83d5('0xa'),_0x3ce2d6,_0x83d5('0xb'));logger[_0x83d5('0xc')](_0x83d5('0xd'),_0x3ce2d6,_0x83d5('0xb'),JSON[_0x83d5('0xe')](_0x65dbce));if(_0x65dbce[_0x83d5('0xf')]){if(_0x65dbce[_0x83d5('0xf')][_0x83d5('0x10')]===0x1f4){logger[_0x83d5('0xf')](_0x83d5('0xa'),_0x3ce2d6,_0x65dbce['error'][_0x83d5('0x11')]);return _0xe6035(_0x65dbce[_0x83d5('0xf')][_0x83d5('0x11')]);}logger[_0x83d5('0xf')](_0x83d5('0xa'),_0x3ce2d6,_0x65dbce[_0x83d5('0xf')][_0x83d5('0x11')]);return _0x13aeb1(_0x65dbce[_0x83d5('0xf')][_0x83d5('0x11')]);}else{logger[_0x83d5('0x12')](_0x83d5('0xa'),_0x3ce2d6,_0x83d5('0xb'));_0x13aeb1(_0x65dbce[_0x83d5('0x13')][_0x83d5('0x11')]);}})[_0x83d5('0x14')](function(_0x45e32e){logger[_0x83d5('0xf')](_0x83d5('0xa'),_0x3ce2d6,_0x45e32e);_0xe6035(_0x45e32e);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 838224b..febb4ef 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 _0xfcd7=['/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','index','get','describe','post','isAuthenticated','create','put'];(function(_0x16516c,_0x3bb81b){var _0x5a7f78=function(_0x1b52ab){while(--_0x1b52ab){_0x16516c['push'](_0x16516c['shift']());}};_0x5a7f78(++_0x3bb81b);}(_0xfcd7,0x97));var _0x7fcd=function(_0x5a6708,_0xf80307){_0x5a6708=_0x5a6708-0x0;var _0x41df44=_0xfcd7[_0x5a6708];return _0x41df44;};'use strict';var multer=require('multer');var util=require(_0x7fcd('0x0'));var path=require(_0x7fcd('0x1'));var timeout=require(_0x7fcd('0x2'));var express=require(_0x7fcd('0x3'));var router=express[_0x7fcd('0x4')]();var fs_extra=require(_0x7fcd('0x5'));var auth=require(_0x7fcd('0x6'));var interaction=require(_0x7fcd('0x7'));var config=require(_0x7fcd('0x8'));var controller=require(_0x7fcd('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7fcd('0xa')]);router[_0x7fcd('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x7fcd('0xc')]);router[_0x7fcd('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7fcd('0xd')]('/',auth[_0x7fcd('0xe')](),controller[_0x7fcd('0xf')]);router[_0x7fcd('0x10')](_0x7fcd('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x7fcd('0x12')](_0x7fcd('0x11'),auth[_0x7fcd('0xe')](),controller[_0x7fcd('0x13')]);module[_0x7fcd('0x14')]=router; \ No newline at end of file +var _0x3ae3=['connect-timeout','Router','fs-extra','./memberReport.controller','get','isAuthenticated','index','describe','post','update','delete','destroy','exports','multer','path'];(function(_0x1ceca2,_0x143096){var _0x35e8b3=function(_0x2cc539){while(--_0x2cc539){_0x1ceca2['push'](_0x1ceca2['shift']());}};_0x35e8b3(++_0x143096);}(_0x3ae3,0x166));var _0x33ae=function(_0x31560a,_0x56297c){_0x31560a=_0x31560a-0x0;var _0x22bcdb=_0x3ae3[_0x31560a];return _0x22bcdb;};'use strict';var multer=require(_0x33ae('0x0'));var util=require('util');var path=require(_0x33ae('0x1'));var timeout=require(_0x33ae('0x2'));var express=require('express');var router=express[_0x33ae('0x3')]();var fs_extra=require(_0x33ae('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x33ae('0x5'));router[_0x33ae('0x6')]('/',auth[_0x33ae('0x7')](),controller[_0x33ae('0x8')]);router[_0x33ae('0x6')]('/describe',auth[_0x33ae('0x7')](),controller[_0x33ae('0x9')]);router[_0x33ae('0x6')]('/:id',auth[_0x33ae('0x7')](),controller['show']);router[_0x33ae('0xa')]('/',auth[_0x33ae('0x7')](),controller['create']);router['put']('/:id',auth[_0x33ae('0x7')](),controller[_0x33ae('0xb')]);router[_0x33ae('0xc')]('/:id',auth[_0x33ae('0x7')](),controller[_0x33ae('0xd')]);module[_0x33ae('0xe')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 3f18682..58aabd7 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 _0xbe89=['duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','exitAt'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xbe89,0x1b6));var _0x9be8=function(_0x3ff533,_0x4c65ef){_0x3ff533=_0x3ff533-0x0;var _0x487b82=_0xbe89[_0x3ff533];return _0x487b82;};'use strict';var Sequelize=require(_0x9be8('0x0'));var moment=require('moment');module[_0x9be8('0x1')]={'channel':{'type':Sequelize[_0x9be8('0x2')]},'membername':{'type':Sequelize[_0x9be8('0x2')]},'interface':{'type':Sequelize[_0x9be8('0x2')]},'type':{'type':Sequelize[_0x9be8('0x2')],'defaultValue':_0x9be8('0x3'),'comment':_0x9be8('0x4')},'duration':{'type':Sequelize[_0x9be8('0x5')]},'enterAt':{'type':Sequelize[_0x9be8('0x6')]},'exitAt':{'type':Sequelize[_0x9be8('0x6')],'set':function(_0x352954){var _0x17ea9a=moment(_0x352954);var _0x5e200f=moment(this[_0x9be8('0x7')](_0x9be8('0x8')));var _0x1f006b=_0x17ea9a['diff'](_0x5e200f,'seconds');this['setDataValue'](_0x9be8('0x9'),_0x352954);this['setDataValue'](_0x9be8('0xa'),_0x1f006b>=0x0?_0x1f006b:null);}},'data1':{'type':Sequelize[_0x9be8('0x2')],'comment':_0x9be8('0xb')},'data2':{'type':Sequelize[_0x9be8('0x2')],'comment':_0x9be8('0xc')},'data3':{'type':Sequelize[_0x9be8('0x2')],'comment':_0x9be8('0xd')},'data4':{'type':Sequelize[_0x9be8('0x2')],'comment':_0x9be8('0xe')},'data5':{'type':Sequelize[_0x9be8('0x2')],'comment':_0x9be8('0xf')},'role':{'type':Sequelize[_0x9be8('0x2')]},'internal':{'type':Sequelize[_0x9be8('0x5')]},'uniqueid':{'type':Sequelize[_0x9be8('0x2')]}}; \ No newline at end of file +var _0xdd0a=['STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','sequelize','moment','exports'];(function(_0x3712e2,_0x32d752){var _0x1faff4=function(_0x550dc0){while(--_0x550dc0){_0x3712e2['push'](_0x3712e2['shift']());}};_0x1faff4(++_0x32d752);}(_0xdd0a,0xa2));var _0xadd0=function(_0xe41fb2,_0x88404e){_0xe41fb2=_0xe41fb2-0x0;var _0x237f2a=_0xdd0a[_0xe41fb2];return _0x237f2a;};'use strict';var Sequelize=require(_0xadd0('0x0'));var moment=require(_0xadd0('0x1'));module[_0xadd0('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xadd0('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xadd0('0x3')],'defaultValue':_0xadd0('0x4'),'comment':_0xadd0('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xadd0('0x6')]},'exitAt':{'type':Sequelize[_0xadd0('0x6')],'set':function(_0x262bca){var _0x53a430=moment(_0x262bca);var _0x2b76fd=moment(this['getDataValue'](_0xadd0('0x7')));var _0x5126c0=_0x53a430[_0xadd0('0x8')](_0x2b76fd,_0xadd0('0x9'));this[_0xadd0('0xa')](_0xadd0('0xb'),_0x262bca);this[_0xadd0('0xa')](_0xadd0('0xc'),_0x5126c0>=0x0?_0x5126c0:null);}},'data1':{'type':Sequelize[_0xadd0('0x3')],'comment':_0xadd0('0xd')},'data2':{'type':Sequelize[_0xadd0('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xadd0('0x3')],'comment':_0xadd0('0xe')},'data4':{'type':Sequelize[_0xadd0('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xadd0('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xadd0('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 72b42d8..0be3c28 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then'];(function(_0x34c52e,_0xb44845){var _0x273eed=function(_0xd602a4){while(--_0xd602a4){_0x34c52e['push'](_0x34c52e['shift']());}};_0x273eed(++_0xb44845);}(_0x008c,0x188));var _0xc008=function(_0x30c2ae,_0x4c98a2){_0x30c2ae=_0x30c2ae-0x0;var _0x1ee1cc=_0x008c[_0x30c2ae];return _0x1ee1cc;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,null));}; \ No newline at end of file +var _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x1d2e5e,_0x145ae6){var _0x4a1d68=function(_0x3dd5b6){while(--_0x3dd5b6){_0x1d2e5e['push'](_0x1d2e5e['shift']());}};_0x4a1d68(++_0x145ae6);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 770eb33..375d49a 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 _0x4b0b=['../../config/logger','api','moment','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','lodash','util'];(function(_0x631a3c,_0x1b61b6){var _0x2bdfa3=function(_0x21711b){while(--_0x21711b){_0x631a3c['push'](_0x631a3c['shift']());}};_0x2bdfa3(++_0x1b61b6);}(_0x4b0b,0x94));var _0xb4b0=function(_0x5de17a,_0x3102cd){_0x5de17a=_0x5de17a-0x0;var _0x1f3979=_0x4b0b[_0x5de17a];return _0x1f3979;};'use strict';var _=require(_0xb4b0('0x0'));var util=require(_0xb4b0('0x1'));var logger=require(_0xb4b0('0x2'))(_0xb4b0('0x3'));var moment=require(_0xb4b0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb4b0('0x5'));var rimraf=require(_0xb4b0('0x6'));var config=require(_0xb4b0('0x7'));var attributes=require(_0xb4b0('0x8'));module[_0xb4b0('0x9')]=function(_0x274be2,_0xf21e3){return _0x274be2[_0xb4b0('0xa')](_0xb4b0('0xb'),attributes,{'tableName':_0xb4b0('0xc'),'paranoid':![],'indexes':[{'name':_0xb4b0('0xd'),'fields':[_0xb4b0('0xe'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x019b=['../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5b0df7,_0x1cbd13){var _0x2ceb04=function(_0xa97e4c){while(--_0xa97e4c){_0x5b0df7['push'](_0x5b0df7['shift']());}};_0x2ceb04(++_0x1cbd13);}(_0x019b,0x1da));var _0xb019=function(_0x40d8d7,_0x30dd5e){_0x40d8d7=_0x40d8d7-0x0;var _0x3454cc=_0x019b[_0x40d8d7];return _0x3454cc;};'use strict';var _=require(_0xb019('0x0'));var util=require(_0xb019('0x1'));var logger=require(_0xb019('0x2'))(_0xb019('0x3'));var moment=require(_0xb019('0x4'));var BPromise=require(_0xb019('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb019('0x6'));var attributes=require(_0xb019('0x7'));module[_0xb019('0x8')]=function(_0x173ee4,_0x39bafe){return _0x173ee4[_0xb019('0x9')](_0xb019('0xa'),attributes,{'tableName':_0xb019('0xb'),'paranoid':![],'indexes':[{'name':_0xb019('0xc'),'fields':[_0xb019('0xd'),_0xb019('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 2880360..ce36cf7 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 _0xac6a=['../../config/logger','rpc','../../config/environment','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','map','include','model','then','CreateMemberReport','create','body','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0xac6a,0xc2));var _0xaac6=function(_0x580ccb,_0xb4987e){_0x580ccb=_0x580ccb-0x0;var _0x106d15=_0xac6a[_0x580ccb];return _0x106d15;};'use strict';var _=require(_0xaac6('0x0'));var util=require(_0xaac6('0x1'));var moment=require(_0xaac6('0x2'));var BPromise=require(_0xaac6('0x3'));var rs=require(_0xaac6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaac6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaac6('0x6'))(_0xaac6('0x7'));var config=require(_0xaac6('0x8'));var jayson=require(_0xaac6('0x9'));var client=jayson[_0xaac6('0xa')][_0xaac6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2547b2,_0xbadbe3,_0x3edefc){return new BPromise(function(_0x467bc5,_0x404a53){return client[_0xaac6('0xc')](_0x2547b2,_0x3edefc)['then'](function(_0x6f34a5){logger[_0xaac6('0xd')](_0xaac6('0xe'),_0xbadbe3,_0xaac6('0xf'));logger[_0xaac6('0x10')](_0xaac6('0x11'),_0xbadbe3,'request\x20sent',JSON[_0xaac6('0x12')](_0x6f34a5));if(_0x6f34a5[_0xaac6('0x13')]){if(_0x6f34a5[_0xaac6('0x13')][_0xaac6('0x14')]===0x1f4){logger[_0xaac6('0x13')]('MemberReport,\x20%s,\x20%s',_0xbadbe3,_0x6f34a5[_0xaac6('0x13')][_0xaac6('0x15')]);return _0x404a53(_0x6f34a5['error']['message']);}logger[_0xaac6('0x13')](_0xaac6('0xe'),_0xbadbe3,_0x6f34a5[_0xaac6('0x13')][_0xaac6('0x15')]);return _0x467bc5(_0x6f34a5[_0xaac6('0x13')][_0xaac6('0x15')]);}else{logger[_0xaac6('0xd')](_0xaac6('0xe'),_0xbadbe3,_0xaac6('0xf'));_0x467bc5(_0x6f34a5[_0xaac6('0x16')][_0xaac6('0x15')]);}})[_0xaac6('0x17')](function(_0x4c2de0){logger['error'](_0xaac6('0xe'),_0xbadbe3,_0x4c2de0);_0x404a53(_0x4c2de0);});});}exports[_0xaac6('0x18')]=function(_0x3cce6f){var _0xaf75d=this;return new Promise(function(_0x3d234a,_0x521e44){return db[_0xaac6('0x19')][_0xaac6('0x1a')]({'raw':_0x3cce6f[_0xaac6('0x1b')]?_0x3cce6f[_0xaac6('0x1b')][_0xaac6('0x1c')]===undefined?!![]:![]:!![],'where':_0x3cce6f[_0xaac6('0x1b')]?_0x3cce6f[_0xaac6('0x1b')]['where']||null:null,'attributes':_0x3cce6f[_0xaac6('0x1b')]?_0x3cce6f[_0xaac6('0x1b')][_0xaac6('0x1d')]||null:null,'limit':_0x3cce6f[_0xaac6('0x1b')]?_0x3cce6f[_0xaac6('0x1b')][_0xaac6('0x1e')]||null:null,'include':_0x3cce6f[_0xaac6('0x1b')]?_0x3cce6f['options']['include']?_[_0xaac6('0x1f')](_0x3cce6f['options'][_0xaac6('0x20')],function(_0x12dfa5){return{'model':db[_0x12dfa5[_0xaac6('0x21')]],'as':_0x12dfa5['as'],'attributes':_0x12dfa5['attributes'],'include':_0x12dfa5[_0xaac6('0x20')]?_['map'](_0x12dfa5[_0xaac6('0x20')],function(_0x943dc9){return{'model':db[_0x943dc9[_0xaac6('0x21')]],'as':_0x943dc9['as'],'attributes':_0x943dc9[_0xaac6('0x1d')],'include':_0x943dc9[_0xaac6('0x20')]?_['map'](_0x943dc9[_0xaac6('0x20')],function(_0x321cbc){return{'model':db[_0x321cbc['model']],'as':_0x321cbc['as'],'attributes':_0x321cbc['attributes']};}):[]};}):[]};}):[]:[]})[_0xaac6('0x22')](function(_0x512d93){logger[_0xaac6('0xd')](_0xaac6('0x18'),_0x3cce6f);logger[_0xaac6('0x10')](_0xaac6('0x18'),_0x3cce6f,JSON[_0xaac6('0x12')](_0x512d93));_0x3d234a(_0x512d93);})[_0xaac6('0x17')](function(_0x19ebcf){logger[_0xaac6('0x13')](_0xaac6('0x18'),_0x19ebcf['message'],_0x3cce6f);_0x521e44(_0xaf75d[_0xaac6('0x13')](0x1f4,_0x19ebcf[_0xaac6('0x15')]));});});};exports[_0xaac6('0x23')]=function(_0x463951){var _0xf71ad8=this;return new Promise(function(_0x540fe5,_0x53b001){return db[_0xaac6('0x19')][_0xaac6('0x24')](_0x463951[_0xaac6('0x25')],{'raw':_0x463951['options']?_0x463951[_0xaac6('0x1b')][_0xaac6('0x1c')]===undefined?!![]:![]:!![]})[_0xaac6('0x22')](function(_0x4b4228){logger[_0xaac6('0xd')](_0xaac6('0x23'),_0x463951);logger[_0xaac6('0x10')](_0xaac6('0x23'),_0x463951,JSON[_0xaac6('0x12')](_0x4b4228));_0x540fe5(_0x4b4228);})['catch'](function(_0x124a42){logger[_0xaac6('0x13')]('CreateMemberReport',_0x124a42[_0xaac6('0x15')],_0x463951);_0x53b001(_0xf71ad8[_0xaac6('0x13')](0x1f4,_0x124a42['message']));});});};exports[_0xaac6('0x26')]=function(_0x112ab4){var _0x32895b=this;return new Promise(function(_0x3af6d0,_0x15a837){return db['MemberReport'][_0xaac6('0x27')](_0x112ab4[_0xaac6('0x25')],{'raw':_0x112ab4[_0xaac6('0x1b')]?_0x112ab4[_0xaac6('0x1b')][_0xaac6('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x112ab4['options']?_0x112ab4['options']['where']||null:null,'attributes':_0x112ab4['options']?_0x112ab4['options'][_0xaac6('0x1d')]||null:null,'limit':_0x112ab4['options']?_0x112ab4[_0xaac6('0x1b')][_0xaac6('0x1e')]||null:null})[_0xaac6('0x22')](function(_0x2aa206){logger[_0xaac6('0xd')](_0xaac6('0x26'),_0x112ab4);logger[_0xaac6('0x10')](_0xaac6('0x26'),_0x112ab4,JSON[_0xaac6('0x12')](_0x2aa206));_0x3af6d0(_0x2aa206);})[_0xaac6('0x17')](function(_0x57e0e0){logger['error']('UpdateMemberReport',_0x57e0e0[_0xaac6('0x15')],_0x112ab4);_0x15a837(_0x32895b[_0xaac6('0x13')](0x1f4,_0x57e0e0['message']));});});}; \ No newline at end of file +var _0xa23f=['findAll','options','attributes','limit','include','map','model','GetMemberReport','stringify','MemberReport','create','body','CreateMemberReport','UpdateMemberReport','update','raw','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','code','MemberReport,\x20%s,\x20%s','message','catch'];(function(_0x18c0c9,_0x3eb495){var _0x1de608=function(_0x1be24f){while(--_0x1be24f){_0x18c0c9['push'](_0x18c0c9['shift']());}};_0x1de608(++_0x3eb495);}(_0xa23f,0x7c));var _0xfa23=function(_0x2bfe1a,_0x4d0cfb){_0x2bfe1a=_0x2bfe1a-0x0;var _0x3d2088=_0xa23f[_0x2bfe1a];return _0x3d2088;};'use strict';var _=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfa23('0x2'));var fs=require('fs');var Redis=require(_0xfa23('0x3'));var db=require(_0xfa23('0x4'))['db'];var utils=require(_0xfa23('0x5'));var logger=require('../../config/logger')(_0xfa23('0x6'));var config=require('../../config/environment');var jayson=require(_0xfa23('0x7'));var client=jayson[_0xfa23('0x8')][_0xfa23('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3696ef,_0x4fb6e6,_0x5a7882){return new BPromise(function(_0x59d53e,_0x19a1ac){return client[_0xfa23('0xa')](_0x3696ef,_0x5a7882)[_0xfa23('0xb')](function(_0x31bb2c){logger[_0xfa23('0xc')]('MemberReport,\x20%s,\x20%s',_0x4fb6e6,'request\x20sent');logger[_0xfa23('0xd')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x4fb6e6,_0xfa23('0xe'),JSON['stringify'](_0x31bb2c));if(_0x31bb2c[_0xfa23('0xf')]){if(_0x31bb2c[_0xfa23('0xf')][_0xfa23('0x10')]===0x1f4){logger['error'](_0xfa23('0x11'),_0x4fb6e6,_0x31bb2c[_0xfa23('0xf')][_0xfa23('0x12')]);return _0x19a1ac(_0x31bb2c['error']['message']);}logger[_0xfa23('0xf')](_0xfa23('0x11'),_0x4fb6e6,_0x31bb2c[_0xfa23('0xf')][_0xfa23('0x12')]);return _0x59d53e(_0x31bb2c['error'][_0xfa23('0x12')]);}else{logger[_0xfa23('0xc')](_0xfa23('0x11'),_0x4fb6e6,_0xfa23('0xe'));_0x59d53e(_0x31bb2c['result'][_0xfa23('0x12')]);}})[_0xfa23('0x13')](function(_0x3ca6be){logger[_0xfa23('0xf')](_0xfa23('0x11'),_0x4fb6e6,_0x3ca6be);_0x19a1ac(_0x3ca6be);});});}exports['GetMemberReport']=function(_0x59610c){var _0x5c3c6d=this;return new Promise(function(_0x445bd0,_0xb3ced2){return db['MemberReport'][_0xfa23('0x14')]({'raw':_0x59610c[_0xfa23('0x15')]?_0x59610c[_0xfa23('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x59610c[_0xfa23('0x15')]?_0x59610c[_0xfa23('0x15')]['where']||null:null,'attributes':_0x59610c[_0xfa23('0x15')]?_0x59610c[_0xfa23('0x15')][_0xfa23('0x16')]||null:null,'limit':_0x59610c[_0xfa23('0x15')]?_0x59610c[_0xfa23('0x15')][_0xfa23('0x17')]||null:null,'include':_0x59610c[_0xfa23('0x15')]?_0x59610c['options'][_0xfa23('0x18')]?_[_0xfa23('0x19')](_0x59610c[_0xfa23('0x15')][_0xfa23('0x18')],function(_0x542cde){return{'model':db[_0x542cde[_0xfa23('0x1a')]],'as':_0x542cde['as'],'attributes':_0x542cde['attributes'],'include':_0x542cde[_0xfa23('0x18')]?_[_0xfa23('0x19')](_0x542cde[_0xfa23('0x18')],function(_0x26bdce){return{'model':db[_0x26bdce[_0xfa23('0x1a')]],'as':_0x26bdce['as'],'attributes':_0x26bdce[_0xfa23('0x16')],'include':_0x26bdce[_0xfa23('0x18')]?_[_0xfa23('0x19')](_0x26bdce['include'],function(_0x2ae826){return{'model':db[_0x2ae826['model']],'as':_0x2ae826['as'],'attributes':_0x2ae826[_0xfa23('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ea972){logger[_0xfa23('0xc')](_0xfa23('0x1b'),_0x59610c);logger[_0xfa23('0xd')](_0xfa23('0x1b'),_0x59610c,JSON[_0xfa23('0x1c')](_0x4ea972));_0x445bd0(_0x4ea972);})[_0xfa23('0x13')](function(_0x3c9d9d){logger['error'](_0xfa23('0x1b'),_0x3c9d9d['message'],_0x59610c);_0xb3ced2(_0x5c3c6d[_0xfa23('0xf')](0x1f4,_0x3c9d9d[_0xfa23('0x12')]));});});};exports['CreateMemberReport']=function(_0x1c83d0){var _0x3a6966=this;return new Promise(function(_0xf9c420,_0x3dadc0){return db[_0xfa23('0x1d')][_0xfa23('0x1e')](_0x1c83d0[_0xfa23('0x1f')],{'raw':_0x1c83d0[_0xfa23('0x15')]?_0x1c83d0[_0xfa23('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xfa23('0xb')](function(_0x59c393){logger[_0xfa23('0xc')](_0xfa23('0x20'),_0x1c83d0);logger[_0xfa23('0xd')](_0xfa23('0x20'),_0x1c83d0,JSON[_0xfa23('0x1c')](_0x59c393));_0xf9c420(_0x59c393);})[_0xfa23('0x13')](function(_0x18f549){logger[_0xfa23('0xf')](_0xfa23('0x20'),_0x18f549['message'],_0x1c83d0);_0x3dadc0(_0x3a6966[_0xfa23('0xf')](0x1f4,_0x18f549['message']));});});};exports[_0xfa23('0x21')]=function(_0x88a593){var _0x17c407=this;return new Promise(function(_0x30ea1e,_0x3fed37){return db[_0xfa23('0x1d')][_0xfa23('0x22')](_0x88a593['body'],{'raw':_0x88a593[_0xfa23('0x15')]?_0x88a593[_0xfa23('0x15')][_0xfa23('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x88a593[_0xfa23('0x15')]?_0x88a593['options']['where']||null:null,'attributes':_0x88a593['options']?_0x88a593[_0xfa23('0x15')][_0xfa23('0x16')]||null:null,'limit':_0x88a593['options']?_0x88a593[_0xfa23('0x15')][_0xfa23('0x17')]||null:null})[_0xfa23('0xb')](function(_0x588fa5){logger[_0xfa23('0xc')]('UpdateMemberReport',_0x88a593);logger[_0xfa23('0xd')](_0xfa23('0x21'),_0x88a593,JSON[_0xfa23('0x1c')](_0x588fa5));_0x30ea1e(_0x588fa5);})[_0xfa23('0x13')](function(_0x1bc029){logger[_0xfa23('0xf')]('UpdateMemberReport',_0x1bc029[_0xfa23('0x12')],_0x88a593);_0x3fed37(_0x17c407[_0xfa23('0xf')](0x1f4,_0x1bc029[_0xfa23('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 2df4b78..f11811c 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 _0x8420=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util'];(function(_0x11fb16,_0x29a381){var _0x343de1=function(_0x4a69f7){while(--_0x4a69f7){_0x11fb16['push'](_0x11fb16['shift']());}};_0x343de1(++_0x29a381);}(_0x8420,0xbe));var _0x0842=function(_0x3154e1,_0x52a5d6){_0x3154e1=_0x3154e1-0x0;var _0x4e0ea7=_0x8420[_0x3154e1];return _0x4e0ea7;};'use strict';var multer=require(_0x0842('0x0'));var util=require(_0x0842('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0842('0x2'));var router=express[_0x0842('0x3')]();var fs_extra=require(_0x0842('0x4'));var auth=require(_0x0842('0x5'));var interaction=require(_0x0842('0x6'));var config=require(_0x0842('0x7'));var controller=require(_0x0842('0x8'));router[_0x0842('0x9')]('/',controller[_0x0842('0xa')]);module[_0x0842('0xb')]=router; \ No newline at end of file +var _0xccc8=['get','index','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2fa32e,_0x58dc3e){var _0xaf8068=function(_0x18284d){while(--_0x18284d){_0x2fa32e['push'](_0x2fa32e['shift']());}};_0xaf8068(++_0x58dc3e);}(_0xccc8,0xa3));var _0x8ccc=function(_0x4c6bca,_0x3de390){_0x4c6bca=_0x4c6bca-0x0;var _0x29d58e=_0xccc8[_0x4c6bca];return _0x29d58e;};'use strict';var multer=require(_0x8ccc('0x0'));var util=require('util');var path=require(_0x8ccc('0x1'));var timeout=require(_0x8ccc('0x2'));var express=require(_0x8ccc('0x3'));var router=express['Router']();var fs_extra=require(_0x8ccc('0x4'));var auth=require(_0x8ccc('0x5'));var interaction=require(_0x8ccc('0x6'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0x8ccc('0x7')]('/',controller[_0x8ccc('0x8')]);module[_0x8ccc('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index e7f1c3c..d4362a3 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 _0x68a2=['version','exports','STRING'];(function(_0x5bc93e,_0x28e79a){var _0x74a2bd=function(_0x438202){while(--_0x438202){_0x5bc93e['push'](_0x5bc93e['shift']());}};_0x74a2bd(++_0x28e79a);}(_0x68a2,0x193));var _0x268a=function(_0xc3c356,_0x1a122e){_0xc3c356=_0xc3c356-0x0;var _0x336f95=_0x68a2[_0xc3c356];return _0x336f95;};'use strict';var Sequelize=require('sequelize');module[_0x268a('0x0')]={'version':{'type':Sequelize[_0x268a('0x1')],'unique':_0x268a('0x2')}}; \ No newline at end of file +var _0x7f2d=['version','exports'];(function(_0x4f431d,_0xd51a3b){var _0x4f31e1=function(_0x1c688d){while(--_0x1c688d){_0x4f431d['push'](_0x4f431d['shift']());}};_0x4f31e1(++_0xd51a3b);}(_0x7f2d,0x145));var _0xd7f2=function(_0xde429,_0x4b63a6){_0xde429=_0xde429-0x0;var _0x59feac=_0x7f2d[_0xde429];return _0x59feac;};'use strict';var Sequelize=require('sequelize');module[_0xd7f2('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0xd7f2('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 17f3d4e..bd7e5ce 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 _0xe318=['zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','Migration','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','eml-format'];(function(_0x5cf5d9,_0x53019f){var _0x539744=function(_0x2068e4){while(--_0x2068e4){_0x5cf5d9['push'](_0x5cf5d9['shift']());}};_0x539744(++_0x53019f);}(_0xe318,0x14e));var _0x8e31=function(_0x594502,_0x3eeddf){_0x594502=_0x594502-0x0;var _0x2af91a=_0xe318[_0x594502];return _0x2af91a;};'use strict';var emlformat=require(_0x8e31('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8e31('0x1'));var jsonpatch=require(_0x8e31('0x2'));var rp=require(_0x8e31('0x3'));var moment=require('moment');var BPromise=require(_0x8e31('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8e31('0x5'));var sox=require(_0x8e31('0x6'));var csv=require(_0x8e31('0x7'));var ejs=require(_0x8e31('0x8'));var fs=require('fs');var fs_extra=require(_0x8e31('0x9'));var _=require(_0x8e31('0xa'));var squel=require(_0x8e31('0xb'));var crypto=require(_0x8e31('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8e31('0xd'));var toCsv=require(_0x8e31('0x7'));var querystring=require(_0x8e31('0xe'));var Papa=require(_0x8e31('0xf'));var Redis=require(_0x8e31('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8e31('0x11'));var as=require(_0x8e31('0x12'));var hardwareService=require(_0x8e31('0x13'));var logger=require('../../config/logger')(_0x8e31('0x14'));var utils=require(_0x8e31('0x15'));var config=require(_0x8e31('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x577b75,_0x4a713c){_0x4a713c=_0x4a713c||0xcc;return function(_0xf6aeb2){if(_0xf6aeb2){return _0x577b75[_0x8e31('0x17')](_0x4a713c);}return _0x577b75[_0x8e31('0x18')](_0x4a713c)[_0x8e31('0x19')]();};}function respondWithResult(_0x4a2911,_0x5cc33c){_0x5cc33c=_0x5cc33c||0xc8;return function(_0xb09868){if(_0xb09868){return _0x4a2911[_0x8e31('0x18')](_0x5cc33c)[_0x8e31('0x1a')](_0xb09868);}};}function respondWithFilteredResult(_0x38139a,_0x700012){return function(_0x52f5eb){if(_0x52f5eb){var _0x1338c2=typeof _0x700012['offset']==='undefined'&&typeof _0x700012[_0x8e31('0x1b')]==='undefined';var _0x37b70e=_0x52f5eb[_0x8e31('0x1c')];var _0x11ec65=_0x1338c2?0x0:_0x700012[_0x8e31('0x1d')];var _0x368b69=_0x1338c2?_0x52f5eb[_0x8e31('0x1c')]:_0x700012[_0x8e31('0x1d')]+_0x700012[_0x8e31('0x1b')];var _0x346356;if(_0x368b69>=_0x37b70e){_0x368b69=_0x37b70e;_0x346356=0xc8;}else{_0x346356=0xce;}_0x38139a['status'](_0x346356);return _0x38139a[_0x8e31('0x1e')](_0x8e31('0x1f'),_0x11ec65+'-'+_0x368b69+'/'+_0x37b70e)['json'](_0x52f5eb);}return null;};}function patchUpdates(_0x3ff0cf){return function(_0x945d3a){try{jsonpatch[_0x8e31('0x20')](_0x945d3a,_0x3ff0cf,!![]);}catch(_0x4da38b){return BPromise[_0x8e31('0x21')](_0x4da38b);}return _0x945d3a[_0x8e31('0x22')]();};}function saveUpdates(_0x1d0d0d,_0x1a325d){return function(_0x2d2e4b){if(_0x2d2e4b){return _0x2d2e4b[_0x8e31('0x23')](_0x1d0d0d)[_0x8e31('0x24')](function(_0x175322){return _0x175322;});}return null;};}function removeEntity(_0x248aa3,_0x200133){return function(_0x4ca46d){if(_0x4ca46d){return _0x4ca46d[_0x8e31('0x25')]()[_0x8e31('0x24')](function(){_0x248aa3[_0x8e31('0x18')](0xcc)[_0x8e31('0x19')]();});}};}function handleEntityNotFound(_0x1cead3,_0x4d18ec){return function(_0x398ea4){if(!_0x398ea4){_0x1cead3[_0x8e31('0x17')](0x194);}return _0x398ea4;};}function handleError(_0x3623b0,_0x4f2945){_0x4f2945=_0x4f2945||0x1f4;return function(_0x2c03ae){logger[_0x8e31('0x26')](_0x2c03ae['stack']);if(_0x2c03ae[_0x8e31('0x27')]){delete _0x2c03ae[_0x8e31('0x27')];}_0x3623b0['status'](_0x4f2945)[_0x8e31('0x28')](_0x2c03ae);};}exports[_0x8e31('0x29')]=function(_0x52b31e,_0x26afbc){var _0x386173={},_0x3a067f={},_0x3106f1={'count':0x0,'rows':[]};var _0x4830d6=_[_0x8e31('0x2a')](db[_0x8e31('0x2b')][_0x8e31('0x2c')],function(_0x3b9669){return{'name':_0x3b9669['fieldName'],'type':_0x3b9669[_0x8e31('0x2d')][_0x8e31('0x2e')]};});_0x3a067f['model']=_[_0x8e31('0x2a')](_0x4830d6,_0x8e31('0x27'));_0x3a067f[_0x8e31('0x2f')]=_[_0x8e31('0x30')](_0x52b31e[_0x8e31('0x2f')]);_0x3a067f[_0x8e31('0x31')]=_[_0x8e31('0x32')](_0x3a067f[_0x8e31('0x33')],_0x3a067f[_0x8e31('0x2f')]);_0x386173[_0x8e31('0x34')]=_[_0x8e31('0x32')](_0x3a067f[_0x8e31('0x33')],qs[_0x8e31('0x35')](_0x52b31e[_0x8e31('0x2f')][_0x8e31('0x35')]));_0x386173['attributes']=_0x386173[_0x8e31('0x34')][_0x8e31('0x36')]?_0x386173['attributes']:_0x3a067f[_0x8e31('0x33')];if(!_0x52b31e[_0x8e31('0x2f')]['hasOwnProperty'](_0x8e31('0x37'))){_0x386173[_0x8e31('0x1b')]=qs['limit'](_0x52b31e[_0x8e31('0x2f')][_0x8e31('0x1b')]);_0x386173['offset']=qs[_0x8e31('0x1d')](_0x52b31e['query']['offset']);}_0x386173['order']=qs[_0x8e31('0x38')](_0x52b31e[_0x8e31('0x2f')][_0x8e31('0x38')]);_0x386173[_0x8e31('0x39')]=qs['filters'](_[_0x8e31('0x3a')](_0x52b31e[_0x8e31('0x2f')],_0x3a067f[_0x8e31('0x31')]),_0x4830d6);if(_0x52b31e[_0x8e31('0x2f')][_0x8e31('0x3b')]){_0x386173[_0x8e31('0x39')]=_[_0x8e31('0x3c')](_0x386173['where'],{'$or':_[_0x8e31('0x2a')](_0x4830d6,function(_0x34a5ce){if(_0x34a5ce[_0x8e31('0x2d')]!==_0x8e31('0x3d')){var _0x505a0f={};_0x505a0f[_0x34a5ce[_0x8e31('0x27')]]={'$like':'%'+_0x52b31e[_0x8e31('0x2f')][_0x8e31('0x3b')]+'%'};return _0x505a0f;}})});}_0x386173=_[_0x8e31('0x3c')]({},_0x386173,_0x52b31e[_0x8e31('0x3e')]);var _0x84bf4c={'where':_0x386173[_0x8e31('0x39')]};return db[_0x8e31('0x2b')][_0x8e31('0x1c')](_0x84bf4c)[_0x8e31('0x24')](function(_0x121e6e){_0x3106f1[_0x8e31('0x1c')]=_0x121e6e;if(_0x52b31e[_0x8e31('0x2f')][_0x8e31('0x3f')]){_0x386173[_0x8e31('0x40')]=[{'all':!![]}];}return db['Migration']['findAll'](_0x386173);})['then'](function(_0xd8ae9c){_0x3106f1[_0x8e31('0x41')]=_0xd8ae9c;return _0x3106f1;})[_0x8e31('0x24')](respondWithFilteredResult(_0x26afbc,_0x386173))[_0x8e31('0x42')](handleError(_0x26afbc,null));}; \ No newline at end of file +var _0xa482=['rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','index','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa482,0x181));var _0x2a48=function(_0x2466e1,_0x15a3e4){_0x2466e1=_0x2466e1-0x0;var _0x599669=_0xa482[_0x2466e1];return _0x599669;};'use strict';var emlformat=require(_0x2a48('0x0'));var rimraf=require(_0x2a48('0x1'));var zipdir=require(_0x2a48('0x2'));var jsonpatch=require(_0x2a48('0x3'));var rp=require(_0x2a48('0x4'));var moment=require(_0x2a48('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2a48('0x6'));var util=require(_0x2a48('0x7'));var path=require(_0x2a48('0x8'));var sox=require(_0x2a48('0x9'));var csv=require(_0x2a48('0xa'));var ejs=require(_0x2a48('0xb'));var fs=require('fs');var fs_extra=require(_0x2a48('0xc'));var _=require(_0x2a48('0xd'));var squel=require(_0x2a48('0xe'));var crypto=require(_0x2a48('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2a48('0x10'));var toCsv=require(_0x2a48('0xa'));var querystring=require('querystring');var Papa=require(_0x2a48('0x11'));var Redis=require(_0x2a48('0x12'));var authService=require(_0x2a48('0x13'));var qs=require(_0x2a48('0x14'));var as=require(_0x2a48('0x15'));var hardwareService=require(_0x2a48('0x16'));var logger=require(_0x2a48('0x17'))('api');var utils=require(_0x2a48('0x18'));var config=require(_0x2a48('0x19'));var licenseUtil=require(_0x2a48('0x1a'));var db=require(_0x2a48('0x1b'))['db'];function respondWithStatusCode(_0x55c88a,_0x4685e2){_0x4685e2=_0x4685e2||0xcc;return function(_0x5a2972){if(_0x5a2972){return _0x55c88a['sendStatus'](_0x4685e2);}return _0x55c88a[_0x2a48('0x1c')](_0x4685e2)[_0x2a48('0x1d')]();};}function respondWithResult(_0x5c987f,_0x14cad8){_0x14cad8=_0x14cad8||0xc8;return function(_0x4224fb){if(_0x4224fb){return _0x5c987f[_0x2a48('0x1c')](_0x14cad8)[_0x2a48('0x1e')](_0x4224fb);}};}function respondWithFilteredResult(_0x45e125,_0x20301d){return function(_0x4ac4d7){if(_0x4ac4d7){var _0x5416dc=typeof _0x20301d[_0x2a48('0x1f')]===_0x2a48('0x20')&&typeof _0x20301d[_0x2a48('0x21')]===_0x2a48('0x20');var _0x57b662=_0x4ac4d7[_0x2a48('0x22')];var _0x1cfdd2=_0x5416dc?0x0:_0x20301d[_0x2a48('0x1f')];var _0xa702e9=_0x5416dc?_0x4ac4d7[_0x2a48('0x22')]:_0x20301d['offset']+_0x20301d[_0x2a48('0x21')];var _0x362b14;if(_0xa702e9>=_0x57b662){_0xa702e9=_0x57b662;_0x362b14=0xc8;}else{_0x362b14=0xce;}_0x45e125[_0x2a48('0x1c')](_0x362b14);return _0x45e125[_0x2a48('0x23')](_0x2a48('0x24'),_0x1cfdd2+'-'+_0xa702e9+'/'+_0x57b662)[_0x2a48('0x1e')](_0x4ac4d7);}return null;};}function patchUpdates(_0x5910f6){return function(_0x20adaa){try{jsonpatch[_0x2a48('0x25')](_0x20adaa,_0x5910f6,!![]);}catch(_0x1cc00f){return BPromise[_0x2a48('0x26')](_0x1cc00f);}return _0x20adaa[_0x2a48('0x27')]();};}function saveUpdates(_0x5eb800,_0x52b485){return function(_0x160d7f){if(_0x160d7f){return _0x160d7f['update'](_0x5eb800)[_0x2a48('0x28')](function(_0x38d0dc){return _0x38d0dc;});}return null;};}function removeEntity(_0x6a9618,_0x4c66bf){return function(_0x587916){if(_0x587916){return _0x587916[_0x2a48('0x29')]()[_0x2a48('0x28')](function(){_0x6a9618[_0x2a48('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4207d4,_0x33a77c){return function(_0x55a735){if(!_0x55a735){_0x4207d4[_0x2a48('0x2a')](0x194);}return _0x55a735;};}function handleError(_0x5b5057,_0x540717){_0x540717=_0x540717||0x1f4;return function(_0x15549e){logger['error'](_0x15549e[_0x2a48('0x2b')]);if(_0x15549e[_0x2a48('0x2c')]){delete _0x15549e[_0x2a48('0x2c')];}_0x5b5057['status'](_0x540717)['send'](_0x15549e);};}exports[_0x2a48('0x2d')]=function(_0x4d8889,_0x415499){var _0x5f12fe={},_0x152b2d={},_0x2c7155={'count':0x0,'rows':[]};var _0xa5f15d=_[_0x2a48('0x2e')](db['Migration'][_0x2a48('0x2f')],function(_0x1a13a6){return{'name':_0x1a13a6[_0x2a48('0x30')],'type':_0x1a13a6[_0x2a48('0x31')][_0x2a48('0x32')]};});_0x152b2d['model']=_[_0x2a48('0x2e')](_0xa5f15d,_0x2a48('0x2c'));_0x152b2d[_0x2a48('0x33')]=_[_0x2a48('0x34')](_0x4d8889[_0x2a48('0x33')]);_0x152b2d[_0x2a48('0x35')]=_[_0x2a48('0x36')](_0x152b2d[_0x2a48('0x37')],_0x152b2d['query']);_0x5f12fe[_0x2a48('0x38')]=_[_0x2a48('0x36')](_0x152b2d['model'],qs[_0x2a48('0x39')](_0x4d8889[_0x2a48('0x33')][_0x2a48('0x39')]));_0x5f12fe[_0x2a48('0x38')]=_0x5f12fe['attributes'][_0x2a48('0x3a')]?_0x5f12fe[_0x2a48('0x38')]:_0x152b2d[_0x2a48('0x37')];if(!_0x4d8889[_0x2a48('0x33')][_0x2a48('0x3b')](_0x2a48('0x3c'))){_0x5f12fe[_0x2a48('0x21')]=qs['limit'](_0x4d8889[_0x2a48('0x33')][_0x2a48('0x21')]);_0x5f12fe['offset']=qs['offset'](_0x4d8889[_0x2a48('0x33')][_0x2a48('0x1f')]);}_0x5f12fe[_0x2a48('0x3d')]=qs[_0x2a48('0x3e')](_0x4d8889[_0x2a48('0x33')][_0x2a48('0x3e')]);_0x5f12fe['where']=qs[_0x2a48('0x35')](_[_0x2a48('0x3f')](_0x4d8889[_0x2a48('0x33')],_0x152b2d[_0x2a48('0x35')]),_0xa5f15d);if(_0x4d8889['query'][_0x2a48('0x40')]){_0x5f12fe['where']=_[_0x2a48('0x41')](_0x5f12fe[_0x2a48('0x42')],{'$or':_[_0x2a48('0x2e')](_0xa5f15d,function(_0x1a6f44){if(_0x1a6f44[_0x2a48('0x31')]!==_0x2a48('0x43')){var _0x4a8e1e={};_0x4a8e1e[_0x1a6f44[_0x2a48('0x2c')]]={'$like':'%'+_0x4d8889[_0x2a48('0x33')]['filter']+'%'};return _0x4a8e1e;}})});}_0x5f12fe=_[_0x2a48('0x41')]({},_0x5f12fe,_0x4d8889['options']);var _0x149703={'where':_0x5f12fe[_0x2a48('0x42')]};return db['Migration']['count'](_0x149703)[_0x2a48('0x28')](function(_0x2e7ba8){_0x2c7155[_0x2a48('0x22')]=_0x2e7ba8;if(_0x4d8889[_0x2a48('0x33')]['includeAll']){_0x5f12fe[_0x2a48('0x44')]=[{'all':!![]}];}return db['Migration'][_0x2a48('0x45')](_0x5f12fe);})[_0x2a48('0x28')](function(_0x4b0e72){_0x2c7155[_0x2a48('0x46')]=_0x4b0e72;return _0x2c7155;})[_0x2a48('0x28')](respondWithFilteredResult(_0x415499,_0x5f12fe))[_0x2a48('0x47')](handleError(_0x415499,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 12d5aec..b36f7d6 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 _0x2c23=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./migration.attributes','Migration','lodash'];(function(_0x45d9bb,_0x2c0350){var _0x1a36e9=function(_0x643803){while(--_0x643803){_0x45d9bb['push'](_0x45d9bb['shift']());}};_0x1a36e9(++_0x2c0350);}(_0x2c23,0x1d5));var _0x32c2=function(_0x59575d,_0x3c389b){_0x59575d=_0x59575d-0x0;var _0x4a6ad4=_0x2c23[_0x59575d];return _0x4a6ad4;};'use strict';var _=require(_0x32c2('0x0'));var util=require('util');var logger=require(_0x32c2('0x1'))(_0x32c2('0x2'));var moment=require(_0x32c2('0x3'));var BPromise=require(_0x32c2('0x4'));var rp=require(_0x32c2('0x5'));var fs=require('fs');var path=require(_0x32c2('0x6'));var rimraf=require(_0x32c2('0x7'));var config=require('../../config/environment');var attributes=require(_0x32c2('0x8'));module['exports']=function(_0x49487e,_0xe4caf9){return _0x49487e['define'](_0x32c2('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25d0=['path','rimraf','../../config/environment','define','lodash','util','api','bluebird'];(function(_0xf17d77,_0x526fef){var _0x116db8=function(_0x23c607){while(--_0x23c607){_0xf17d77['push'](_0xf17d77['shift']());}};_0x116db8(++_0x526fef);}(_0x25d0,0x124));var _0x025d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x025d('0x0'));var util=require(_0x025d('0x1'));var logger=require('../../config/logger')(_0x025d('0x2'));var moment=require('moment');var BPromise=require(_0x025d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x025d('0x4'));var rimraf=require(_0x025d('0x5'));var config=require(_0x025d('0x6'));var attributes=require('./migration.attributes');module['exports']=function(_0x133d5f,_0x104596){return _0x133d5f[_0x025d('0x7')]('Migration',attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 0bd7794..c6e2694 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 _0x1ee2=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util'];(function(_0x516aec,_0x3b8799){var _0x2c7cb7=function(_0x4fc7ba){while(--_0x4fc7ba){_0x516aec['push'](_0x516aec['shift']());}};_0x2c7cb7(++_0x3b8799);}(_0x1ee2,0x11c));var _0x21ee=function(_0x210c77,_0x316e72){_0x210c77=_0x210c77-0x0;var _0x14e894=_0x1ee2[_0x210c77];return _0x14e894;};'use strict';var _=require(_0x21ee('0x0'));var util=require(_0x21ee('0x1'));var moment=require(_0x21ee('0x2'));var BPromise=require(_0x21ee('0x3'));var rs=require(_0x21ee('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x21ee('0x5'))['db'];var utils=require(_0x21ee('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x21ee('0x7'));var jayson=require(_0x21ee('0x8'));var client=jayson[_0x21ee('0x9')][_0x21ee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x479a60,_0x361e58,_0x207f5b){return new BPromise(function(_0x38588c,_0x3c1243){return client[_0x21ee('0xb')](_0x479a60,_0x207f5b)[_0x21ee('0xc')](function(_0x2ad5af){logger[_0x21ee('0xd')](_0x21ee('0xe'),_0x361e58,_0x21ee('0xf'));logger[_0x21ee('0x10')]('Migration,\x20%s,\x20%s,\x20%s',_0x361e58,'request\x20sent',JSON['stringify'](_0x2ad5af));if(_0x2ad5af[_0x21ee('0x11')]){if(_0x2ad5af[_0x21ee('0x11')][_0x21ee('0x12')]===0x1f4){logger[_0x21ee('0x11')]('Migration,\x20%s,\x20%s',_0x361e58,_0x2ad5af[_0x21ee('0x11')][_0x21ee('0x13')]);return _0x3c1243(_0x2ad5af[_0x21ee('0x11')][_0x21ee('0x13')]);}logger[_0x21ee('0x11')](_0x21ee('0xe'),_0x361e58,_0x2ad5af[_0x21ee('0x11')]['message']);return _0x38588c(_0x2ad5af[_0x21ee('0x11')][_0x21ee('0x13')]);}else{logger[_0x21ee('0xd')](_0x21ee('0xe'),_0x361e58,_0x21ee('0xf'));_0x38588c(_0x2ad5af[_0x21ee('0x14')]['message']);}})[_0x21ee('0x15')](function(_0xa0bd5a){logger[_0x21ee('0x11')](_0x21ee('0xe'),_0x361e58,_0xa0bd5a);_0x3c1243(_0xa0bd5a);});});} \ No newline at end of file +var _0x8868=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Migration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','lodash','util'];(function(_0xd7b2c7,_0x220e37){var _0x33c54e=function(_0x31c150){while(--_0x31c150){_0xd7b2c7['push'](_0xd7b2c7['shift']());}};_0x33c54e(++_0x220e37);}(_0x8868,0x1ca));var _0x8886=function(_0x23e927,_0x55387f){_0x23e927=_0x23e927-0x0;var _0x154420=_0x8868[_0x23e927];return _0x154420;};'use strict';var _=require(_0x8886('0x0'));var util=require(_0x8886('0x1'));var moment=require(_0x8886('0x2'));var BPromise=require(_0x8886('0x3'));var rs=require(_0x8886('0x4'));var fs=require('fs');var Redis=require(_0x8886('0x5'));var db=require(_0x8886('0x6'))['db'];var utils=require(_0x8886('0x7'));var logger=require(_0x8886('0x8'))(_0x8886('0x9'));var config=require(_0x8886('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8886('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26b94d,_0x5e2a73,_0x1a85e1){return new BPromise(function(_0x56b9fa,_0x147fc9){return client[_0x8886('0xc')](_0x26b94d,_0x1a85e1)[_0x8886('0xd')](function(_0x39036d){logger[_0x8886('0xe')](_0x8886('0xf'),_0x5e2a73,'request\x20sent');logger[_0x8886('0x10')]('Migration,\x20%s,\x20%s,\x20%s',_0x5e2a73,'request\x20sent',JSON[_0x8886('0x11')](_0x39036d));if(_0x39036d['error']){if(_0x39036d[_0x8886('0x12')][_0x8886('0x13')]===0x1f4){logger[_0x8886('0x12')](_0x8886('0xf'),_0x5e2a73,_0x39036d['error'][_0x8886('0x14')]);return _0x147fc9(_0x39036d[_0x8886('0x12')]['message']);}logger[_0x8886('0x12')]('Migration,\x20%s,\x20%s',_0x5e2a73,_0x39036d[_0x8886('0x12')][_0x8886('0x14')]);return _0x56b9fa(_0x39036d[_0x8886('0x12')][_0x8886('0x14')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0x5e2a73,_0x8886('0x15'));_0x56b9fa(_0x39036d[_0x8886('0x16')]['message']);}})['catch'](function(_0x563a82){logger['error'](_0x8886('0xf'),_0x5e2a73,_0x563a82);_0x147fc9(_0x563a82);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 66f5a25..288e2c6 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 _0x4279=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','post','create','update','delete','destroy','exports','util','path','express'];(function(_0x364223,_0x1361ef){var _0x4a4e1b=function(_0x51fc17){while(--_0x51fc17){_0x364223['push'](_0x364223['shift']());}};_0x4a4e1b(++_0x1361ef);}(_0x4279,0x8d));var _0x9427=function(_0x4bff7a,_0xdddc08){_0x4bff7a=_0x4bff7a-0x0;var _0x16354d=_0x4279[_0x4bff7a];return _0x16354d;};'use strict';var multer=require('multer');var util=require(_0x9427('0x0'));var path=require(_0x9427('0x1'));var timeout=require('connect-timeout');var express=require(_0x9427('0x2'));var router=express[_0x9427('0x3')]();var fs_extra=require(_0x9427('0x4'));var auth=require(_0x9427('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9427('0x6'));var controller=require('./network.controller');router[_0x9427('0x7')]('/',auth[_0x9427('0x8')](),controller['index']);router[_0x9427('0x7')](_0x9427('0x9'),auth[_0x9427('0x8')](),controller['show']);router[_0x9427('0xa')]('/',auth['isAuthenticated'](),controller[_0x9427('0xb')]);router['put']('/:id',auth[_0x9427('0x8')](),controller[_0x9427('0xc')]);router[_0x9427('0xd')](_0x9427('0x9'),auth[_0x9427('0x8')](),controller[_0x9427('0xe')]);module[_0x9427('0xf')]=router; \ No newline at end of file +var _0xd7a5=['index','show','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated'];(function(_0x38e385,_0x1369f6){var _0xf8f599=function(_0x1a3948){while(--_0x1a3948){_0x38e385['push'](_0x38e385['shift']());}};_0xf8f599(++_0x1369f6);}(_0xd7a5,0x1ad));var _0x5d7a=function(_0x2e50a2,_0x27f31e){_0x2e50a2=_0x2e50a2-0x0;var _0x47e5de=_0xd7a5[_0x2e50a2];return _0x47e5de;};'use strict';var multer=require(_0x5d7a('0x0'));var util=require('util');var path=require(_0x5d7a('0x1'));var timeout=require(_0x5d7a('0x2'));var express=require('express');var router=express[_0x5d7a('0x3')]();var fs_extra=require(_0x5d7a('0x4'));var auth=require(_0x5d7a('0x5'));var interaction=require(_0x5d7a('0x6'));var config=require(_0x5d7a('0x7'));var controller=require(_0x5d7a('0x8'));router[_0x5d7a('0x9')]('/',auth[_0x5d7a('0xa')](),controller[_0x5d7a('0xb')]);router[_0x5d7a('0x9')]('/:id',auth[_0x5d7a('0xa')](),controller[_0x5d7a('0xc')]);router['post']('/',auth[_0x5d7a('0xa')](),controller[_0x5d7a('0xd')]);router[_0x5d7a('0xe')](_0x5d7a('0xf'),auth[_0x5d7a('0xa')](),controller[_0x5d7a('0x10')]);router[_0x5d7a('0x11')]('/:id',auth[_0x5d7a('0xa')](),controller[_0x5d7a('0x12')]);module[_0x5d7a('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index f46f209..b253765 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 _0x00f7=['stun','STRING','exports','ENUM','localnet'];(function(_0x4c7935,_0x4a53fb){var _0x30651d=function(_0x12f35f){while(--_0x12f35f){_0x4c7935['push'](_0x4c7935['shift']());}};_0x30651d(++_0x4a53fb);}(_0x00f7,0x1c9));var _0x700f=function(_0x1a3626,_0x464c65){_0x1a3626=_0x1a3626-0x0;var _0x240135=_0x00f7[_0x1a3626];return _0x240135;};'use strict';var Sequelize=require('sequelize');module[_0x700f('0x0')]={'type':{'type':Sequelize[_0x700f('0x1')](_0x700f('0x2'),'externip',_0x700f('0x3'),'turn')},'value':{'type':Sequelize[_0x700f('0x4')]},'username':{'type':Sequelize[_0x700f('0x4')]},'password':{'type':Sequelize[_0x700f('0x4')]}}; \ No newline at end of file +var _0x0ba5=['sequelize','exports','ENUM','localnet','stun','turn','STRING'];(function(_0x4d4a2d,_0x1c17d0){var _0x4db007=function(_0x1a440e){while(--_0x1a440e){_0x4d4a2d['push'](_0x4d4a2d['shift']());}};_0x4db007(++_0x1c17d0);}(_0x0ba5,0x157));var _0x50ba=function(_0xf55e4e,_0x1ce036){_0xf55e4e=_0xf55e4e-0x0;var _0x3e627e=_0x0ba5[_0xf55e4e];return _0x3e627e;};'use strict';var Sequelize=require(_0x50ba('0x0'));module[_0x50ba('0x1')]={'type':{'type':Sequelize[_0x50ba('0x2')](_0x50ba('0x3'),'externip',_0x50ba('0x4'),_0x50ba('0x5'))},'value':{'type':Sequelize[_0x50ba('0x6')]},'username':{'type':Sequelize[_0x50ba('0x6')]},'password':{'type':Sequelize[_0x50ba('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index ce73ad4..52de838 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 _0x3e83=['find','create','body','type','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','format','/etc/asterisk/sip_xcally_%s.conf','STUN','TURN','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','toLowerCase','destroy','server/files/templates/turn_multiple.ejs','chan_sip.so','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','jayson/promise','request','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','limit','undefined','offset','count','set','json','update','then','end','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','Network','includeAll','include','findAll','rows','show','params','length','options'];(function(_0x3d0784,_0x4d2d49){var _0x3b00ca=function(_0x11a4a3){while(--_0x11a4a3){_0x3d0784['push'](_0x3d0784['shift']());}};_0x3b00ca(++_0x4d2d49);}(_0x3e83,0xc5));var _0x33e8=function(_0x443246,_0x199405){_0x443246=_0x443246-0x0;var _0xf91625=_0x3e83[_0x443246];return _0xf91625;};'use strict';var util=require(_0x33e8('0x0'));var path=require(_0x33e8('0x1'));var ejs=require(_0x33e8('0x2'));var fs=require('fs');var _=require(_0x33e8('0x3'));var qs=require(_0x33e8('0x4'));var logger=require(_0x33e8('0x5'))(_0x33e8('0x6'));var config=require('../../config/environment');var db=require(_0x33e8('0x7'))['db'];var jayson=require(_0x33e8('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x35226d,_0x45a400,_0x4377fd,_0x7a10fe){return new Promise(function(_0x527a4d,_0xec248d){var _0x2df76c=_0x7a10fe||client;return _0x2df76c[_0x33e8('0x9')](_0x35226d,_0x4377fd)['then'](function(_0x234b99){logger[_0x33e8('0xa')](_0x33e8('0xb'),_0x45a400,_0x33e8('0xc'));logger['debug'](_0x33e8('0xd'),_0x45a400,_0x33e8('0xc'),JSON[_0x33e8('0xe')](_0x234b99));if(_0x234b99['error']){if(_0x234b99[_0x33e8('0xf')][_0x33e8('0x10')]===0x1f4){logger[_0x33e8('0xf')]('Network,\x20%s,\x20%s',_0x45a400,_0x234b99[_0x33e8('0xf')][_0x33e8('0x11')]);return _0xec248d(_0x234b99['error'][_0x33e8('0x11')]);}logger[_0x33e8('0xf')]('Network,\x20%s,\x20%s',_0x45a400,_0x234b99[_0x33e8('0xf')][_0x33e8('0x11')]);return _0x527a4d(_0x234b99[_0x33e8('0xf')]['message']);}else{logger[_0x33e8('0xa')](_0x33e8('0xb'),_0x45a400,_0x33e8('0xc'));_0x527a4d(_0x234b99[_0x33e8('0x12')][_0x33e8('0x11')]);}})[_0x33e8('0x13')](function(_0x151693){logger[_0x33e8('0xf')]('Network,\x20%s,\x20%s',_0x45a400,_0x151693);_0xec248d(_0x151693);});});}function respondWithResult(_0x1e8155,_0x2de035){_0x2de035=_0x2de035||0xc8;return function(_0x29ad03){if(_0x29ad03){return _0x1e8155[_0x33e8('0x14')](_0x2de035)['json'](_0x29ad03);}};}function respondWithFilteredResult(_0x3ec961,_0x578077){return function(_0x432090){if(_0x432090){var _0x50489e=typeof _0x578077['offset']==='undefined'&&typeof _0x578077[_0x33e8('0x15')]===_0x33e8('0x16');var _0x3975fe=_0x432090['count'];var _0x410fb3=_0x50489e?0x0:_0x578077[_0x33e8('0x17')];var _0x55bfb8=_0x50489e?_0x432090[_0x33e8('0x18')]:_0x578077[_0x33e8('0x17')]+_0x578077['limit'];var _0x9cd814;if(_0x55bfb8>=_0x3975fe){_0x55bfb8=_0x3975fe;_0x9cd814=0xc8;}else{_0x9cd814=0xce;}_0x3ec961['status'](_0x9cd814);return _0x3ec961[_0x33e8('0x19')]('Content-Range',_0x410fb3+'-'+_0x55bfb8+'/'+_0x3975fe)[_0x33e8('0x1a')](_0x432090);}return null;};}function saveUpdates(_0x43f960){return function(_0xf5b7e2){if(_0xf5b7e2){return _0xf5b7e2[_0x33e8('0x1b')](_0x43f960)[_0x33e8('0x1c')](function(_0x331603){return _0x331603;});}return null;};}function removeEntity(_0x3c9a6d){return function(_0x201a01){if(_0x201a01){return _0x201a01['destroy']()['then'](function(){_0x3c9a6d[_0x33e8('0x14')](0xcc)[_0x33e8('0x1d')]();});}};}function handleEntityNotFound(_0x5196e2){return function(_0x47b3d9){if(!_0x47b3d9){_0x5196e2['sendStatus'](0x194);}return _0x47b3d9;};}function handleError(_0x425f3c,_0x907806){_0x907806=_0x907806||0x1f4;return function(_0xb95a34){logger[_0x33e8('0xf')](_0xb95a34['stack']);if(_0xb95a34[_0x33e8('0x1e')]){delete _0xb95a34['name'];}_0x425f3c[_0x33e8('0x14')](_0x907806)[_0x33e8('0x1f')](_0xb95a34);};}exports[_0x33e8('0x20')]=function(_0x3695ee,_0x1d5819){var _0x2a0be2={},_0x4023ab={},_0x4114e8={'count':0x0,'rows':[]};var _0x3448a7=_[_0x33e8('0x21')](db['Network'][_0x33e8('0x22')],function(_0x19066a){return{'name':_0x19066a[_0x33e8('0x23')],'type':_0x19066a['type'][_0x33e8('0x24')]};});_0x4023ab['model']=_[_0x33e8('0x21')](_0x3448a7,'name');_0x4023ab[_0x33e8('0x25')]=_[_0x33e8('0x26')](_0x3695ee[_0x33e8('0x25')]);_0x4023ab[_0x33e8('0x27')]=_[_0x33e8('0x28')](_0x4023ab['model'],_0x4023ab[_0x33e8('0x25')]);_0x2a0be2[_0x33e8('0x29')]=_[_0x33e8('0x28')](_0x4023ab[_0x33e8('0x2a')],qs[_0x33e8('0x2b')](_0x3695ee[_0x33e8('0x25')][_0x33e8('0x2b')]));_0x2a0be2[_0x33e8('0x29')]=_0x2a0be2['attributes']['length']?_0x2a0be2[_0x33e8('0x29')]:_0x4023ab['model'];if(!_0x3695ee[_0x33e8('0x25')]['hasOwnProperty'](_0x33e8('0x2c'))){_0x2a0be2['limit']=qs['limit'](_0x3695ee[_0x33e8('0x25')][_0x33e8('0x15')]);_0x2a0be2[_0x33e8('0x17')]=qs[_0x33e8('0x17')](_0x3695ee['query'][_0x33e8('0x17')]);}_0x2a0be2[_0x33e8('0x2d')]=qs[_0x33e8('0x2e')](_0x3695ee['query'][_0x33e8('0x2e')]);_0x2a0be2[_0x33e8('0x2f')]=qs[_0x33e8('0x27')](_[_0x33e8('0x30')](_0x3695ee[_0x33e8('0x25')],_0x4023ab['filters']),_0x3448a7);if(_0x3695ee['query'][_0x33e8('0x31')]){_0x2a0be2[_0x33e8('0x2f')]=_[_0x33e8('0x32')](_0x2a0be2[_0x33e8('0x2f')],{'$or':_['map'](_0x3448a7,function(_0x1e6265){if(_0x1e6265['type']!==_0x33e8('0x33')){var _0x45f99f={};_0x45f99f[_0x1e6265[_0x33e8('0x1e')]]={'$like':'%'+_0x3695ee['query'][_0x33e8('0x31')]+'%'};return _0x45f99f;}})});}_0x2a0be2=_[_0x33e8('0x32')]({},_0x2a0be2,_0x3695ee['options']);var _0x58e734={'where':_0x2a0be2[_0x33e8('0x2f')]};return db[_0x33e8('0x34')][_0x33e8('0x18')](_0x58e734)[_0x33e8('0x1c')](function(_0x2d8717){_0x4114e8['count']=_0x2d8717;if(_0x3695ee[_0x33e8('0x25')][_0x33e8('0x35')]){_0x2a0be2[_0x33e8('0x36')]=[{'all':!![]}];}return db[_0x33e8('0x34')][_0x33e8('0x37')](_0x2a0be2);})['then'](function(_0x4c3b90){_0x4114e8[_0x33e8('0x38')]=_0x4c3b90;return _0x4114e8;})['then'](respondWithFilteredResult(_0x1d5819,_0x2a0be2))[_0x33e8('0x13')](handleError(_0x1d5819,null));};exports[_0x33e8('0x39')]=function(_0x30e568,_0x4fcb7a){var _0x346dca={'raw':!![],'where':{'id':_0x30e568[_0x33e8('0x3a')]['id']}},_0xc80dda={};_0xc80dda['model']=_[_0x33e8('0x26')](db[_0x33e8('0x34')][_0x33e8('0x22')]);_0xc80dda['query']=_['keys'](_0x30e568[_0x33e8('0x25')]);_0xc80dda[_0x33e8('0x27')]=_[_0x33e8('0x28')](_0xc80dda['model'],_0xc80dda[_0x33e8('0x25')]);_0x346dca[_0x33e8('0x29')]=_[_0x33e8('0x28')](_0xc80dda[_0x33e8('0x2a')],qs['fields'](_0x30e568['query'][_0x33e8('0x2b')]));_0x346dca[_0x33e8('0x29')]=_0x346dca[_0x33e8('0x29')][_0x33e8('0x3b')]?_0x346dca[_0x33e8('0x29')]:_0xc80dda[_0x33e8('0x2a')];if(_0x30e568[_0x33e8('0x25')][_0x33e8('0x35')]){_0x346dca[_0x33e8('0x36')]=[{'all':!![]}];}_0x346dca=_['merge']({},_0x346dca,_0x30e568[_0x33e8('0x3c')]);return db[_0x33e8('0x34')][_0x33e8('0x3d')](_0x346dca)['then'](handleEntityNotFound(_0x4fcb7a,null))[_0x33e8('0x1c')](respondWithResult(_0x4fcb7a,null))[_0x33e8('0x13')](handleError(_0x4fcb7a,null));};exports[_0x33e8('0x3e')]=function(_0x105f51,_0x551893){var _0x3a58c6;return db[_0x33e8('0x34')][_0x33e8('0x3e')](_0x105f51[_0x33e8('0x3f')],{'raw':!![]})['then'](function(_0x28eeaf){_0x3a58c6=_0x28eeaf;return db[_0x33e8('0x34')][_0x33e8('0x37')]({'where':{'type':_0x105f51[_0x33e8('0x3f')][_0x33e8('0x40')]},'raw':!![]});})[_0x33e8('0x1c')](function(_0x4146b4){if(_0x3a58c6[_0x33e8('0x40')]['toUpperCase']()=='STUN'){var _0x171776=fs[_0x33e8('0x41')](path[_0x33e8('0x42')](config[_0x33e8('0x43')],_0x33e8('0x44')),_0x33e8('0x45'));var _0x3e1f7b=ejs[_0x33e8('0x46')](_0x171776,{'networks':_0x4146b4||[]});fs[_0x33e8('0x47')](_0x33e8('0x48'),_0x3e1f7b);return respondWithRpcPromise(_0x33e8('0x49'),_0x33e8('0x3e'),{'module':_0x33e8('0x4a')});}else if(_0x3a58c6['type'][_0x33e8('0x4b')]()=='TURN'){var _0x4de0ef=fs[_0x33e8('0x41')](path[_0x33e8('0x42')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x33e8('0x45'));var _0x4904de=ejs['render'](_0x4de0ef,{'networks':_0x4146b4||[]});fs[_0x33e8('0x47')]('/etc/asterisk/turn_xcally.conf',_0x4904de);return respondWithRpcPromise('Reload',_0x33e8('0x3e'),{'module':_0x33e8('0x4a')});}else{var _0x53b935=fs[_0x33e8('0x41')](path[_0x33e8('0x42')](config['root'],'server/files/templates/network.ejs'),_0x33e8('0x45'));var _0x5cecd5=ejs[_0x33e8('0x46')](_0x53b935,{'networks':_0x4146b4||[]});fs[_0x33e8('0x47')](util[_0x33e8('0x4c')](_0x33e8('0x4d'),_0x105f51[_0x33e8('0x3f')]['type']['toLowerCase']()),_0x5cecd5);return respondWithRpcPromise('Reload',_0x33e8('0x3e'),{'module':'chan_sip.so'});}})[_0x33e8('0x1c')](function(){return _0x3a58c6;})['then'](respondWithResult(_0x551893,0xc9))[_0x33e8('0x13')](handleError(_0x551893,null));};exports[_0x33e8('0x1b')]=function(_0x22fa45,_0x28a260){var _0x45f851;return db[_0x33e8('0x34')][_0x33e8('0x3d')]({'where':{'id':_0x22fa45[_0x33e8('0x3a')]['id']}})['then'](handleEntityNotFound(_0x28a260,null))[_0x33e8('0x1c')](saveUpdates(_0x22fa45[_0x33e8('0x3f')],null))[_0x33e8('0x1c')](function(_0x32e7fd){if(_0x32e7fd){_0x45f851=_0x32e7fd;return db['Network'][_0x33e8('0x37')]({'where':{'type':_0x45f851['type']},'raw':!![]});}return null;})['then'](function(_0x11659c){if(_0x45f851[_0x33e8('0x40')][_0x33e8('0x4b')]()==_0x33e8('0x4e')){var _0x5b4d09=fs[_0x33e8('0x41')](path[_0x33e8('0x42')](config[_0x33e8('0x43')],_0x33e8('0x44')),_0x33e8('0x45'));var _0x564fd5=ejs[_0x33e8('0x46')](_0x5b4d09,{'networks':_0x11659c||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x564fd5);return respondWithRpcPromise(_0x33e8('0x49'),'update',{'module':_0x33e8('0x4a')});}else if(_0x45f851[_0x33e8('0x40')][_0x33e8('0x4b')]()==_0x33e8('0x4f')){var _0x13883a=fs['readFileSync'](path[_0x33e8('0x42')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x33e8('0x45'));var _0xe68ec6=ejs[_0x33e8('0x46')](_0x13883a,{'networks':_0x11659c||[]});fs[_0x33e8('0x47')](_0x33e8('0x50'),_0xe68ec6);return respondWithRpcPromise(_0x33e8('0x49'),_0x33e8('0x1b'),{'module':_0x33e8('0x4a')});}else{var _0x47338a=fs[_0x33e8('0x41')](path['join'](config['root'],_0x33e8('0x51')),_0x33e8('0x45'));var _0x270de5=ejs['render'](_0x47338a,{'networks':_0x11659c||[]});fs['writeFileSync'](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x22fa45[_0x33e8('0x3f')][_0x33e8('0x40')][_0x33e8('0x52')]()),_0x270de5);return respondWithRpcPromise(_0x33e8('0x49'),_0x33e8('0x1b'),{'module':'chan_sip.so'});}})['then'](function(_0xf21582){if(_0xf21582){return _0x45f851;}return null;})['then'](respondWithResult(_0x28a260,null))[_0x33e8('0x13')](handleError(_0x28a260,null));};exports[_0x33e8('0x53')]=function(_0xed5b12,_0x3727f0){var _0x445e6e;return db[_0x33e8('0x34')][_0x33e8('0x3d')]({'where':{'id':_0xed5b12[_0x33e8('0x3a')]['id']}})[_0x33e8('0x1c')](function(_0x2ca37a){_0x445e6e=_0x2ca37a;return _0x2ca37a;})[_0x33e8('0x1c')](handleEntityNotFound(_0x3727f0,null))[_0x33e8('0x1c')](removeEntity(_0x3727f0,null))[_0x33e8('0x1c')](function(){if(_0x445e6e){return db[_0x33e8('0x34')]['findAll']({'where':{'type':_0x445e6e[_0x33e8('0x40')]},'raw':!![]});}})[_0x33e8('0x1c')](function(_0x2c2296){if(_0x445e6e[_0x33e8('0x40')]['toUpperCase']()=='STUN'){var _0x1be6e9=fs['readFileSync'](path[_0x33e8('0x42')](config[_0x33e8('0x43')],_0x33e8('0x44')),_0x33e8('0x45'));var _0x52fa5d=ejs['render'](_0x1be6e9,{'networks':_0x2c2296||[]});fs[_0x33e8('0x47')](_0x33e8('0x48'),_0x52fa5d);return respondWithRpcPromise(_0x33e8('0x49'),_0x33e8('0x53'),{'module':_0x33e8('0x4a')});}else if(_0x445e6e['type']['toUpperCase']()=='TURN'){var _0x5385ab=fs[_0x33e8('0x41')](path[_0x33e8('0x42')](config['root'],_0x33e8('0x54')),'utf8');var _0x3397ee=ejs['render'](_0x5385ab,{'networks':_0x2c2296||[]});fs[_0x33e8('0x47')](_0x33e8('0x50'),_0x3397ee);return respondWithRpcPromise(_0x33e8('0x49'),'destroy',{'module':_0x33e8('0x4a')});}else{var _0x56a1e9=fs[_0x33e8('0x41')](path[_0x33e8('0x42')](config[_0x33e8('0x43')],_0x33e8('0x51')),_0x33e8('0x45'));var _0x3ec484=ejs['render'](_0x56a1e9,{'networks':_0x2c2296||[]});fs[_0x33e8('0x47')](util[_0x33e8('0x4c')](_0x33e8('0x4d'),_0x445e6e[_0x33e8('0x40')]['toLowerCase']()),_0x3ec484);return respondWithRpcPromise(_0x33e8('0x49'),'destroy',{'module':_0x33e8('0x55')});}})[_0x33e8('0x13')](handleError(_0x3727f0,null));}; \ No newline at end of file +var _0xe3f1=['res_stun_monitor.so','root','server/files/templates/turn_multiple.ejs','utf8','Reload','server/files/templates/network.ejs','toLowerCase','chan_sip.so','params','TURN','/etc/asterisk/turn_xcally.conf','/etc/asterisk/sip_xcally_%s.conf','util','path','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','client','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','status','json','offset','undefined','count','set','Content-Range','update','then','destroy','end','sendStatus','stack','name','send','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','show','Network','rawAttributes','length','include','find','create','body','findAll','toUpperCase','readFileSync','join','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf'];(function(_0x35ec29,_0x4a249b){var _0x41d6d1=function(_0x107f49){while(--_0x107f49){_0x35ec29['push'](_0x35ec29['shift']());}};_0x41d6d1(++_0x4a249b);}(_0xe3f1,0x1b0));var _0x1e3f=function(_0x43fa0c,_0x36775e){_0x43fa0c=_0x43fa0c-0x0;var _0x569da2=_0xe3f1[_0x43fa0c];return _0x569da2;};'use strict';var util=require(_0x1e3f('0x0'));var path=require(_0x1e3f('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1e3f('0x2'));var qs=require(_0x1e3f('0x3'));var logger=require(_0x1e3f('0x4'))(_0x1e3f('0x5'));var config=require(_0x1e3f('0x6'));var db=require(_0x1e3f('0x7'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x1e3f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ee1e4,_0x256f66,_0x1d2ccb,_0x5eaa18){return new Promise(function(_0x368297,_0x9ee5ba){var _0x4cf1de=_0x5eaa18||client;return _0x4cf1de['request'](_0x5ee1e4,_0x1d2ccb)['then'](function(_0x31f5f8){logger['info'](_0x1e3f('0x9'),_0x256f66,'request\x20sent');logger[_0x1e3f('0xa')]('Network,\x20%s,\x20%s,\x20%s',_0x256f66,'request\x20sent',JSON[_0x1e3f('0xb')](_0x31f5f8));if(_0x31f5f8[_0x1e3f('0xc')]){if(_0x31f5f8[_0x1e3f('0xc')][_0x1e3f('0xd')]===0x1f4){logger['error'](_0x1e3f('0x9'),_0x256f66,_0x31f5f8[_0x1e3f('0xc')][_0x1e3f('0xe')]);return _0x9ee5ba(_0x31f5f8['error'][_0x1e3f('0xe')]);}logger[_0x1e3f('0xc')](_0x1e3f('0x9'),_0x256f66,_0x31f5f8[_0x1e3f('0xc')][_0x1e3f('0xe')]);return _0x368297(_0x31f5f8['error'][_0x1e3f('0xe')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x256f66,_0x1e3f('0xf'));_0x368297(_0x31f5f8[_0x1e3f('0x10')][_0x1e3f('0xe')]);}})[_0x1e3f('0x11')](function(_0x557a28){logger[_0x1e3f('0xc')]('Network,\x20%s,\x20%s',_0x256f66,_0x557a28);_0x9ee5ba(_0x557a28);});});}function respondWithResult(_0x2f1071,_0x2e1949){_0x2e1949=_0x2e1949||0xc8;return function(_0x3f736d){if(_0x3f736d){return _0x2f1071[_0x1e3f('0x12')](_0x2e1949)[_0x1e3f('0x13')](_0x3f736d);}};}function respondWithFilteredResult(_0x3b2777,_0x2f19e4){return function(_0x439581){if(_0x439581){var _0x50ddc1=typeof _0x2f19e4[_0x1e3f('0x14')]===_0x1e3f('0x15')&&typeof _0x2f19e4['limit']==='undefined';var _0x200625=_0x439581[_0x1e3f('0x16')];var _0x12dd91=_0x50ddc1?0x0:_0x2f19e4[_0x1e3f('0x14')];var _0x1da28c=_0x50ddc1?_0x439581[_0x1e3f('0x16')]:_0x2f19e4[_0x1e3f('0x14')]+_0x2f19e4['limit'];var _0x3fbdb8;if(_0x1da28c>=_0x200625){_0x1da28c=_0x200625;_0x3fbdb8=0xc8;}else{_0x3fbdb8=0xce;}_0x3b2777['status'](_0x3fbdb8);return _0x3b2777[_0x1e3f('0x17')](_0x1e3f('0x18'),_0x12dd91+'-'+_0x1da28c+'/'+_0x200625)[_0x1e3f('0x13')](_0x439581);}return null;};}function saveUpdates(_0x38df63){return function(_0x2b7031){if(_0x2b7031){return _0x2b7031[_0x1e3f('0x19')](_0x38df63)[_0x1e3f('0x1a')](function(_0x556b8d){return _0x556b8d;});}return null;};}function removeEntity(_0x186a17){return function(_0x54f855){if(_0x54f855){return _0x54f855[_0x1e3f('0x1b')]()[_0x1e3f('0x1a')](function(){_0x186a17[_0x1e3f('0x12')](0xcc)[_0x1e3f('0x1c')]();});}};}function handleEntityNotFound(_0x503899){return function(_0x59d7ff){if(!_0x59d7ff){_0x503899[_0x1e3f('0x1d')](0x194);}return _0x59d7ff;};}function handleError(_0x45d470,_0x4bc8fc){_0x4bc8fc=_0x4bc8fc||0x1f4;return function(_0x18cdd7){logger['error'](_0x18cdd7[_0x1e3f('0x1e')]);if(_0x18cdd7[_0x1e3f('0x1f')]){delete _0x18cdd7[_0x1e3f('0x1f')];}_0x45d470[_0x1e3f('0x12')](_0x4bc8fc)[_0x1e3f('0x20')](_0x18cdd7);};}exports['index']=function(_0xae021f,_0x23f408){var _0x499f80={},_0x4a99bf={},_0x1781c1={'count':0x0,'rows':[]};var _0x1ca5e2=_['map'](db['Network']['rawAttributes'],function(_0x11360e){return{'name':_0x11360e[_0x1e3f('0x21')],'type':_0x11360e[_0x1e3f('0x22')][_0x1e3f('0x23')]};});_0x4a99bf['model']=_[_0x1e3f('0x24')](_0x1ca5e2,_0x1e3f('0x1f'));_0x4a99bf[_0x1e3f('0x25')]=_[_0x1e3f('0x26')](_0xae021f[_0x1e3f('0x25')]);_0x4a99bf[_0x1e3f('0x27')]=_[_0x1e3f('0x28')](_0x4a99bf[_0x1e3f('0x29')],_0x4a99bf['query']);_0x499f80[_0x1e3f('0x2a')]=_[_0x1e3f('0x28')](_0x4a99bf[_0x1e3f('0x29')],qs[_0x1e3f('0x2b')](_0xae021f[_0x1e3f('0x25')]['fields']));_0x499f80['attributes']=_0x499f80[_0x1e3f('0x2a')]['length']?_0x499f80[_0x1e3f('0x2a')]:_0x4a99bf[_0x1e3f('0x29')];if(!_0xae021f[_0x1e3f('0x25')]['hasOwnProperty'](_0x1e3f('0x2c'))){_0x499f80['limit']=qs[_0x1e3f('0x2d')](_0xae021f[_0x1e3f('0x25')][_0x1e3f('0x2d')]);_0x499f80[_0x1e3f('0x14')]=qs[_0x1e3f('0x14')](_0xae021f[_0x1e3f('0x25')][_0x1e3f('0x14')]);}_0x499f80[_0x1e3f('0x2e')]=qs[_0x1e3f('0x2f')](_0xae021f[_0x1e3f('0x25')]['sort']);_0x499f80[_0x1e3f('0x30')]=qs['filters'](_[_0x1e3f('0x31')](_0xae021f[_0x1e3f('0x25')],_0x4a99bf[_0x1e3f('0x27')]),_0x1ca5e2);if(_0xae021f[_0x1e3f('0x25')]['filter']){_0x499f80[_0x1e3f('0x30')]=_[_0x1e3f('0x32')](_0x499f80[_0x1e3f('0x30')],{'$or':_[_0x1e3f('0x24')](_0x1ca5e2,function(_0x3644ad){if(_0x3644ad[_0x1e3f('0x22')]!==_0x1e3f('0x33')){var _0x4d2997={};_0x4d2997[_0x3644ad['name']]={'$like':'%'+_0xae021f[_0x1e3f('0x25')][_0x1e3f('0x34')]+'%'};return _0x4d2997;}})});}_0x499f80=_[_0x1e3f('0x32')]({},_0x499f80,_0xae021f[_0x1e3f('0x35')]);var _0x417fe7={'where':_0x499f80[_0x1e3f('0x30')]};return db['Network'][_0x1e3f('0x16')](_0x417fe7)[_0x1e3f('0x1a')](function(_0x2c68da){_0x1781c1[_0x1e3f('0x16')]=_0x2c68da;if(_0xae021f['query'][_0x1e3f('0x36')]){_0x499f80['include']=[{'all':!![]}];}return db['Network']['findAll'](_0x499f80);})[_0x1e3f('0x1a')](function(_0x14f288){_0x1781c1[_0x1e3f('0x37')]=_0x14f288;return _0x1781c1;})[_0x1e3f('0x1a')](respondWithFilteredResult(_0x23f408,_0x499f80))['catch'](handleError(_0x23f408,null));};exports[_0x1e3f('0x38')]=function(_0x199e36,_0x2ae3f3){var _0x2a62c3={'raw':!![],'where':{'id':_0x199e36['params']['id']}},_0x3ed251={};_0x3ed251['model']=_['keys'](db[_0x1e3f('0x39')][_0x1e3f('0x3a')]);_0x3ed251['query']=_[_0x1e3f('0x26')](_0x199e36[_0x1e3f('0x25')]);_0x3ed251[_0x1e3f('0x27')]=_['intersection'](_0x3ed251[_0x1e3f('0x29')],_0x3ed251[_0x1e3f('0x25')]);_0x2a62c3[_0x1e3f('0x2a')]=_[_0x1e3f('0x28')](_0x3ed251[_0x1e3f('0x29')],qs[_0x1e3f('0x2b')](_0x199e36[_0x1e3f('0x25')][_0x1e3f('0x2b')]));_0x2a62c3['attributes']=_0x2a62c3['attributes'][_0x1e3f('0x3b')]?_0x2a62c3[_0x1e3f('0x2a')]:_0x3ed251[_0x1e3f('0x29')];if(_0x199e36[_0x1e3f('0x25')][_0x1e3f('0x36')]){_0x2a62c3[_0x1e3f('0x3c')]=[{'all':!![]}];}_0x2a62c3=_[_0x1e3f('0x32')]({},_0x2a62c3,_0x199e36[_0x1e3f('0x35')]);return db[_0x1e3f('0x39')][_0x1e3f('0x3d')](_0x2a62c3)[_0x1e3f('0x1a')](handleEntityNotFound(_0x2ae3f3,null))[_0x1e3f('0x1a')](respondWithResult(_0x2ae3f3,null))['catch'](handleError(_0x2ae3f3,null));};exports[_0x1e3f('0x3e')]=function(_0x5b7b35,_0x41f52c){var _0x151f6a;return db[_0x1e3f('0x39')][_0x1e3f('0x3e')](_0x5b7b35[_0x1e3f('0x3f')],{'raw':!![]})[_0x1e3f('0x1a')](function(_0x679d97){_0x151f6a=_0x679d97;return db[_0x1e3f('0x39')][_0x1e3f('0x40')]({'where':{'type':_0x5b7b35[_0x1e3f('0x3f')][_0x1e3f('0x22')]},'raw':!![]});})[_0x1e3f('0x1a')](function(_0x9834b1){if(_0x151f6a[_0x1e3f('0x22')][_0x1e3f('0x41')]()=='STUN'){var _0x14f54e=fs[_0x1e3f('0x42')](path[_0x1e3f('0x43')](config['root'],_0x1e3f('0x44')),'utf8');var _0x2b57d2=ejs[_0x1e3f('0x45')](_0x14f54e,{'networks':_0x9834b1||[]});fs[_0x1e3f('0x46')](_0x1e3f('0x47'),_0x2b57d2);return respondWithRpcPromise('Reload',_0x1e3f('0x3e'),{'module':_0x1e3f('0x48')});}else if(_0x151f6a['type'][_0x1e3f('0x41')]()=='TURN'){var _0x3f39e7=fs['readFileSync'](path[_0x1e3f('0x43')](config[_0x1e3f('0x49')],_0x1e3f('0x4a')),_0x1e3f('0x4b'));var _0x3c3ae2=ejs['render'](_0x3f39e7,{'networks':_0x9834b1||[]});fs[_0x1e3f('0x46')]('/etc/asterisk/turn_xcally.conf',_0x3c3ae2);return respondWithRpcPromise(_0x1e3f('0x4c'),'create',{'module':'res_stun_monitor.so'});}else{var _0x54c6e5=fs['readFileSync'](path['join'](config[_0x1e3f('0x49')],_0x1e3f('0x4d')),_0x1e3f('0x4b'));var _0x192e4e=ejs['render'](_0x54c6e5,{'networks':_0x9834b1||[]});fs[_0x1e3f('0x46')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x5b7b35[_0x1e3f('0x3f')]['type'][_0x1e3f('0x4e')]()),_0x192e4e);return respondWithRpcPromise('Reload',_0x1e3f('0x3e'),{'module':_0x1e3f('0x4f')});}})['then'](function(){return _0x151f6a;})[_0x1e3f('0x1a')](respondWithResult(_0x41f52c,0xc9))[_0x1e3f('0x11')](handleError(_0x41f52c,null));};exports[_0x1e3f('0x19')]=function(_0x1b5b14,_0x5d5916){var _0x24d467;return db[_0x1e3f('0x39')][_0x1e3f('0x3d')]({'where':{'id':_0x1b5b14[_0x1e3f('0x50')]['id']}})[_0x1e3f('0x1a')](handleEntityNotFound(_0x5d5916,null))[_0x1e3f('0x1a')](saveUpdates(_0x1b5b14[_0x1e3f('0x3f')],null))[_0x1e3f('0x1a')](function(_0x14c8b7){if(_0x14c8b7){_0x24d467=_0x14c8b7;return db[_0x1e3f('0x39')][_0x1e3f('0x40')]({'where':{'type':_0x24d467[_0x1e3f('0x22')]},'raw':!![]});}return null;})[_0x1e3f('0x1a')](function(_0x23f4f8){if(_0x24d467['type'][_0x1e3f('0x41')]()=='STUN'){var _0x82d84=fs[_0x1e3f('0x42')](path['join'](config[_0x1e3f('0x49')],_0x1e3f('0x44')),_0x1e3f('0x4b'));var _0x39a72f=ejs[_0x1e3f('0x45')](_0x82d84,{'networks':_0x23f4f8||[]});fs['writeFileSync'](_0x1e3f('0x47'),_0x39a72f);return respondWithRpcPromise(_0x1e3f('0x4c'),_0x1e3f('0x19'),{'module':'res_stun_monitor.so'});}else if(_0x24d467[_0x1e3f('0x22')][_0x1e3f('0x41')]()==_0x1e3f('0x51')){var _0x49a161=fs[_0x1e3f('0x42')](path[_0x1e3f('0x43')](config[_0x1e3f('0x49')],_0x1e3f('0x4a')),_0x1e3f('0x4b'));var _0x2b3e75=ejs[_0x1e3f('0x45')](_0x49a161,{'networks':_0x23f4f8||[]});fs['writeFileSync'](_0x1e3f('0x52'),_0x2b3e75);return respondWithRpcPromise(_0x1e3f('0x4c'),'update',{'module':'res_stun_monitor.so'});}else{var _0x30c872=fs['readFileSync'](path['join'](config[_0x1e3f('0x49')],'server/files/templates/network.ejs'),_0x1e3f('0x4b'));var _0x3910c4=ejs[_0x1e3f('0x45')](_0x30c872,{'networks':_0x23f4f8||[]});fs['writeFileSync'](util['format'](_0x1e3f('0x53'),_0x1b5b14[_0x1e3f('0x3f')]['type']['toLowerCase']()),_0x3910c4);return respondWithRpcPromise(_0x1e3f('0x4c'),_0x1e3f('0x19'),{'module':'chan_sip.so'});}})[_0x1e3f('0x1a')](function(_0x17890e){if(_0x17890e){return _0x24d467;}return null;})[_0x1e3f('0x1a')](respondWithResult(_0x5d5916,null))[_0x1e3f('0x11')](handleError(_0x5d5916,null));};exports['destroy']=function(_0x39e5c8,_0x569b80){var _0x4e7c12;return db[_0x1e3f('0x39')][_0x1e3f('0x3d')]({'where':{'id':_0x39e5c8[_0x1e3f('0x50')]['id']}})['then'](function(_0x51193e){_0x4e7c12=_0x51193e;return _0x51193e;})['then'](handleEntityNotFound(_0x569b80,null))[_0x1e3f('0x1a')](removeEntity(_0x569b80,null))[_0x1e3f('0x1a')](function(){if(_0x4e7c12){return db[_0x1e3f('0x39')][_0x1e3f('0x40')]({'where':{'type':_0x4e7c12[_0x1e3f('0x22')]},'raw':!![]});}})[_0x1e3f('0x1a')](function(_0x552a6d){if(_0x4e7c12[_0x1e3f('0x22')]['toUpperCase']()=='STUN'){var _0x5de2f0=fs[_0x1e3f('0x42')](path[_0x1e3f('0x43')](config[_0x1e3f('0x49')],_0x1e3f('0x44')),_0x1e3f('0x4b'));var _0x423f49=ejs['render'](_0x5de2f0,{'networks':_0x552a6d||[]});fs[_0x1e3f('0x46')](_0x1e3f('0x47'),_0x423f49);return respondWithRpcPromise('Reload','destroy',{'module':'res_stun_monitor.so'});}else if(_0x4e7c12[_0x1e3f('0x22')]['toUpperCase']()==_0x1e3f('0x51')){var _0x47da14=fs[_0x1e3f('0x42')](path[_0x1e3f('0x43')](config[_0x1e3f('0x49')],_0x1e3f('0x4a')),'utf8');var _0x1017e4=ejs[_0x1e3f('0x45')](_0x47da14,{'networks':_0x552a6d||[]});fs[_0x1e3f('0x46')](_0x1e3f('0x52'),_0x1017e4);return respondWithRpcPromise('Reload',_0x1e3f('0x1b'),{'module':_0x1e3f('0x48')});}else{var _0x130fa6=fs[_0x1e3f('0x42')](path[_0x1e3f('0x43')](config[_0x1e3f('0x49')],'server/files/templates/network.ejs'),_0x1e3f('0x4b'));var _0x1ee300=ejs[_0x1e3f('0x45')](_0x130fa6,{'networks':_0x552a6d||[]});fs[_0x1e3f('0x46')](util['format'](_0x1e3f('0x53'),_0x4e7c12[_0x1e3f('0x22')][_0x1e3f('0x4e')]()),_0x1ee300);return respondWithRpcPromise(_0x1e3f('0x4c'),_0x1e3f('0x1b'),{'module':_0x1e3f('0x4f')});}})['catch'](handleError(_0x569b80,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 4c9c74c..8188b6e 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 _0x91a7=['bluebird','path','./network.attributes','exports','Network','network','util','../../config/logger','api'];(function(_0x15fc7a,_0xd21741){var _0x3aa9f4=function(_0x313108){while(--_0x313108){_0x15fc7a['push'](_0x15fc7a['shift']());}};_0x3aa9f4(++_0xd21741);}(_0x91a7,0xe7));var _0x791a=function(_0x24690f,_0x3cb79f){_0x24690f=_0x24690f-0x0;var _0x92d126=_0x91a7[_0x24690f];return _0x92d126;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var logger=require(_0x791a('0x1'))(_0x791a('0x2'));var moment=require('moment');var BPromise=require(_0x791a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x791a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x791a('0x5'));module[_0x791a('0x6')]=function(_0x49a9b7,_0x361f53){return _0x49a9b7['define'](_0x791a('0x7'),attributes,{'tableName':_0x791a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9a7=['exports','define','Network','network','util','bluebird','path','rimraf','../../config/environment','./network.attributes'];(function(_0x30b9d7,_0x1edfeb){var _0x3aaf0d=function(_0x829c78){while(--_0x829c78){_0x30b9d7['push'](_0x30b9d7['shift']());}};_0x3aaf0d(++_0x1edfeb);}(_0xb9a7,0x112));var _0x7b9a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xb9a7[_0xa148b7];return _0x51efd3;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7b9a('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b9a('0x2'));var rimraf=require(_0x7b9a('0x3'));var config=require(_0x7b9a('0x4'));var attributes=require(_0x7b9a('0x5'));module[_0x7b9a('0x6')]=function(_0xf6dae2,_0x22764f){return _0xf6dae2[_0x7b9a('0x7')](_0x7b9a('0x8'),attributes,{'tableName':_0x7b9a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 19f6004..3777d5d 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(_0x263a11,_0x536deb){var _0x3db148=function(_0x265219){while(--_0x265219){_0x263a11['push'](_0x263a11['shift']());}};_0x3db148(++_0x536deb);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4c664e,_0x244f05){var _0x515a56=function(_0x82bab2){while(--_0x82bab2){_0x4c664e['push'](_0x4c664e['shift']());}};_0x515a56(++_0x244f05);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 ba3d640..2e10049 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 _0xbcce=['/:id/canned_answers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','create','post','addAnswer','/:id/notify','addApplications','addAgents','/:id/send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','Router','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions'];(function(_0x4096f9,_0x4f7603){var _0x4175c1=function(_0x3e08da){while(--_0x3e08da){_0x4096f9['push'](_0x4096f9['shift']());}};_0x4175c1(++_0x4f7603);}(_0xbcce,0x180));var _0xebcc=function(_0x2abf9a,_0x5bcf1f){_0x2abf9a=_0x2abf9a-0x0;var _0x54b265=_0xbcce[_0x2abf9a];return _0x54b265;};'use strict';var multer=require('multer');var util=require(_0xebcc('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xebcc('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xebcc('0x2'));var config=require(_0xebcc('0x3'));var controller=require('./openchannelAccount.controller');router[_0xebcc('0x4')]('/',auth['isAuthenticated'](),controller[_0xebcc('0x5')]);router['get'](_0xebcc('0x6'),auth[_0xebcc('0x7')](),controller[_0xebcc('0x8')]);router['get'](_0xebcc('0x9'),auth[_0xebcc('0x7')](),controller[_0xebcc('0xa')]);router[_0xebcc('0x4')](_0xebcc('0xb'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xebcc('0x4')](_0xebcc('0xc'),auth[_0xebcc('0x7')](),controller['getAnswers']);router[_0xebcc('0x4')](_0xebcc('0xd'),auth[_0xebcc('0x7')](),controller[_0xebcc('0xe')]);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0xebcc('0xf')]);router[_0xebcc('0x4')](_0xebcc('0x10'),auth[_0xebcc('0x7')](),controller[_0xebcc('0x11')]);router['post']('/',auth[_0xebcc('0x7')](),controller[_0xebcc('0x12')]);router[_0xebcc('0x13')](_0xebcc('0xb'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xebcc('0x13')](_0xebcc('0xc'),auth[_0xebcc('0x7')](),controller[_0xebcc('0x14')]);router[_0xebcc('0x13')](_0xebcc('0x15'),controller['notify']);router['post'](_0xebcc('0xd'),auth['isAuthenticated'](),controller[_0xebcc('0x16')]);router['post'](_0xebcc('0x10'),auth[_0xebcc('0x7')](),controller[_0xebcc('0x17')]);router[_0xebcc('0x13')](_0xebcc('0x18'),auth[_0xebcc('0x7')](),controller['send']);router[_0xebcc('0x19')](_0xebcc('0x9'),auth[_0xebcc('0x7')](),controller[_0xebcc('0x1a')]);router[_0xebcc('0x1b')](_0xebcc('0x9'),auth['isAuthenticated'](),controller[_0xebcc('0x1c')]);router[_0xebcc('0x1b')](_0xebcc('0xb'),auth[_0xebcc('0x7')](),controller[_0xebcc('0x1d')]);router['delete'](_0xebcc('0xc'),auth['isAuthenticated'](),controller[_0xebcc('0x1e')]);router[_0xebcc('0x1b')]('/:id/users',auth['isAuthenticated'](),controller[_0xebcc('0x1f')]);module[_0xebcc('0x20')]=router; \ No newline at end of file +var _0x8449=['isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','create','post','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x8449,0x69));var _0x9844=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x8449[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require(_0x9844('0x0'));var util=require('util');var path=require(_0x9844('0x1'));var timeout=require(_0x9844('0x2'));var express=require(_0x9844('0x3'));var router=express[_0x9844('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9844('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9844('0x6'));var controller=require(_0x9844('0x7'));router[_0x9844('0x8')]('/',auth[_0x9844('0x9')](),controller['index']);router['get'](_0x9844('0xa'),auth['isAuthenticated'](),controller[_0x9844('0xb')]);router[_0x9844('0x8')](_0x9844('0xc'),auth[_0x9844('0x9')](),controller[_0x9844('0xd')]);router['get'](_0x9844('0xe'),auth[_0x9844('0x9')](),controller['getDispositions']);router[_0x9844('0x8')]('/:id/canned_answers',auth[_0x9844('0x9')](),controller['getAnswers']);router['get'](_0x9844('0xf'),auth[_0x9844('0x9')](),controller[_0x9844('0x10')]);router['get']('/:id/interactions',auth[_0x9844('0x9')](),controller[_0x9844('0x11')]);router[_0x9844('0x8')](_0x9844('0x12'),auth[_0x9844('0x9')](),controller[_0x9844('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9844('0x14')]);router[_0x9844('0x15')](_0x9844('0xe'),auth[_0x9844('0x9')](),controller['addDisposition']);router[_0x9844('0x15')](_0x9844('0x16'),auth[_0x9844('0x9')](),controller[_0x9844('0x17')]);router['post'](_0x9844('0x18'),controller[_0x9844('0x19')]);router[_0x9844('0x15')]('/:id/applications',auth[_0x9844('0x9')](),controller[_0x9844('0x1a')]);router[_0x9844('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0x9844('0x1b')]);router[_0x9844('0x15')](_0x9844('0x1c'),auth[_0x9844('0x9')](),controller[_0x9844('0x1d')]);router[_0x9844('0x1e')](_0x9844('0xc'),auth[_0x9844('0x9')](),controller[_0x9844('0x1f')]);router['delete'](_0x9844('0xc'),auth[_0x9844('0x9')](),controller[_0x9844('0x20')]);router[_0x9844('0x21')](_0x9844('0xe'),auth['isAuthenticated'](),controller[_0x9844('0x22')]);router['delete'](_0x9844('0x16'),auth['isAuthenticated'](),controller[_0x9844('0x23')]);router[_0x9844('0x21')]('/:id/users',auth[_0x9844('0x9')](),controller[_0x9844('0x24')]);module[_0x9844('0x25')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 85a4b01..3f5b873 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 _0x3ee7=['STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports'];(function(_0x447f23,_0x21cba2){var _0xa5df13=function(_0x43260a){while(--_0x43260a){_0x447f23['push'](_0x447f23['shift']());}};_0xa5df13(++_0x21cba2);}(_0x3ee7,0x1e9));var _0x73ee=function(_0x52b3c9,_0x2bf3ae){_0x52b3c9=_0x52b3c9-0x0;var _0x36423d=_0x3ee7[_0x52b3c9];return _0x36423d;};'use strict';var Sequelize=require(_0x73ee('0x0'));var rs=require(_0x73ee('0x1'));module[_0x73ee('0x2')]={'name':{'type':Sequelize[_0x73ee('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x73ee('0x3')]},'token':{'type':Sequelize[_0x73ee('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x73ee('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x73ee('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x73ee('0x4')],'defaultValue':function(){return _0x73ee('0x5');}},'notificationSound':{'type':Sequelize[_0x73ee('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x73ee('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x73ee('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x73ee('0x3')]},'queueTransfer':{'type':Sequelize[_0x73ee('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x73ee('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x73ee('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x73ee('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x8cfe6e){if(!_0x8cfe6e)this[_0x73ee('0x9')](_0x73ee('0xa'),null);this[_0x73ee('0x9')](_0x73ee('0xb'),_0x8cfe6e);}}}; \ No newline at end of file +var _0xe1bf=['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'];(function(_0xd3c259,_0x3b9999){var _0x5ec139=function(_0xc5db69){while(--_0xc5db69){_0xd3c259['push'](_0xd3c259['shift']());}};_0x5ec139(++_0x3b9999);}(_0xe1bf,0x190));var _0xfe1b=function(_0x3420d6,_0x4ae675){_0x3420d6=_0x3420d6-0x0;var _0x313d6a=_0xe1bf[_0x3420d6];return _0x313d6a;};'use strict';var Sequelize=require(_0xfe1b('0x0'));var rs=require(_0xfe1b('0x1'));module[_0xfe1b('0x2')]={'name':{'type':Sequelize[_0xfe1b('0x3')],'unique':_0xfe1b('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xfe1b('0x3')]},'token':{'type':Sequelize[_0xfe1b('0x3')],'defaultValue':function(){return rs[_0xfe1b('0x5')]();}},'replyUri':{'type':Sequelize[_0xfe1b('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xfe1b('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xfe1b('0x6');}},'notificationSound':{'type':Sequelize[_0xfe1b('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfe1b('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfe1b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xfe1b('0x3')]},'queueTransfer':{'type':Sequelize[_0xfe1b('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfe1b('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfe1b('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xfe1b('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xfe1b('0xa'),'set':function(_0x19501e){if(!_0x19501e)this[_0xfe1b('0xb')](_0xfe1b('0xc'),null);this[_0xfe1b('0xb')](_0xfe1b('0xd'),_0x19501e);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 126dc03..91fa1d2 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 _0x8ebf=['request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','get','OpenchannelAccounts','destroy','end','stack','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','keys','intersection','attributes','length','query','hasOwnProperty','order','sort','pick','filters','filter','where','VIRTUAL','options','include','findAll','rows','show','params','fields','includeAll','merge','find','create','body','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','getDispositions','nolimit','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','from','CmList','List','CmContact','Contacts','DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','defaults','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','findOne','Contact','Owner','fullname','internal','Tags','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','http','client','request','then'];(function(_0x1925bd,_0x3d880a){var _0x270fd5=function(_0x5bbc45){while(--_0x5bbc45){_0x1925bd['push'](_0x1925bd['shift']());}};_0x270fd5(++_0x3d880a);}(_0x8ebf,0x15c));var _0xf8eb=function(_0x55677b,_0x3e5655){_0x55677b=_0x55677b-0x0;var _0x104b88=_0x8ebf[_0x55677b];return _0x104b88;};'use strict';var emlformat=require(_0xf8eb('0x0'));var rimraf=require(_0xf8eb('0x1'));var zipdir=require(_0xf8eb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf8eb('0x3'));var moment=require(_0xf8eb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf8eb('0x5'));var util=require(_0xf8eb('0x6'));var path=require(_0xf8eb('0x7'));var sox=require('sox');var csv=require(_0xf8eb('0x8'));var ejs=require(_0xf8eb('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf8eb('0xa'));var squel=require(_0xf8eb('0xb'));var crypto=require(_0xf8eb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf8eb('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf8eb('0xe'));var Papa=require('papaparse');var Redis=require(_0xf8eb('0xf'));var authService=require(_0xf8eb('0x10'));var qs=require(_0xf8eb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf8eb('0x12'));var logger=require(_0xf8eb('0x13'))(_0xf8eb('0x14'));var utils=require(_0xf8eb('0x15'));var config=require(_0xf8eb('0x16'));var licenseUtil=require(_0xf8eb('0x17'));var db=require(_0xf8eb('0x18'))['db'];config[_0xf8eb('0x19')]=_['defaults'](config[_0xf8eb('0x19')],{'host':_0xf8eb('0x1a'),'port':0x18eb});var socket=require(_0xf8eb('0x1b'))(new Redis(config[_0xf8eb('0x19')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xf8eb('0x1c')]({'port':0x232c});var client9002=jayson[_0xf8eb('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24277e,_0x10415f,_0x32d2d7,_0x54975a){return new BPromise(function(_0x18dbbd,_0x335e19){var _0x2f052d=_0x54975a||client;return _0x2f052d[_0xf8eb('0x1e')](_0x24277e,_0x32d2d7)[_0xf8eb('0x1f')](function(_0x1df079){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x10415f,_0xf8eb('0x20'));logger[_0xf8eb('0x21')](_0xf8eb('0x22'),_0x10415f,_0xf8eb('0x20'),JSON[_0xf8eb('0x23')](_0x1df079));if(_0x1df079[_0xf8eb('0x24')]){if(_0x1df079[_0xf8eb('0x24')][_0xf8eb('0x25')]===0x1f4){logger['error'](_0xf8eb('0x26'),_0x10415f,_0x1df079['error']['message']);return _0x335e19(_0x1df079[_0xf8eb('0x24')][_0xf8eb('0x27')]);}logger[_0xf8eb('0x24')](_0xf8eb('0x26'),_0x10415f,_0x1df079['error'][_0xf8eb('0x27')]);return _0x18dbbd(_0x1df079[_0xf8eb('0x24')][_0xf8eb('0x27')]);}else{logger[_0xf8eb('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x10415f,_0xf8eb('0x20'));_0x18dbbd(_0x1df079[_0xf8eb('0x29')][_0xf8eb('0x27')]);}})[_0xf8eb('0x2a')](function(_0xa208f0){logger[_0xf8eb('0x24')](_0xf8eb('0x26'),_0x10415f,_0xa208f0);_0x335e19(_0xa208f0);});});}function respondWithStatusCode(_0x2dbf73,_0x674c51){_0x674c51=_0x674c51||0xcc;return function(_0x6164d5){if(_0x6164d5){return _0x2dbf73[_0xf8eb('0x2b')](_0x674c51);}return _0x2dbf73[_0xf8eb('0x2c')](_0x674c51)['end']();};}function respondWithResult(_0x424364,_0x519a2c){_0x519a2c=_0x519a2c||0xc8;return function(_0x1b702d){if(_0x1b702d){return _0x424364[_0xf8eb('0x2c')](_0x519a2c)[_0xf8eb('0x2d')](_0x1b702d);}};}function respondWithFilteredResult(_0xa39e74,_0x45348a){return function(_0x1716db){if(_0x1716db){var _0x5bf35a=typeof _0x45348a[_0xf8eb('0x2e')]===_0xf8eb('0x2f')&&typeof _0x45348a[_0xf8eb('0x30')]===_0xf8eb('0x2f');var _0x308ca9=_0x1716db[_0xf8eb('0x31')];var _0x3c3e56=_0x5bf35a?0x0:_0x45348a['offset'];var _0x5c4f86=_0x5bf35a?_0x1716db['count']:_0x45348a[_0xf8eb('0x2e')]+_0x45348a[_0xf8eb('0x30')];var _0x34d9cd;if(_0x5c4f86>=_0x308ca9){_0x5c4f86=_0x308ca9;_0x34d9cd=0xc8;}else{_0x34d9cd=0xce;}_0xa39e74[_0xf8eb('0x2c')](_0x34d9cd);return _0xa39e74['set'](_0xf8eb('0x32'),_0x3c3e56+'-'+_0x5c4f86+'/'+_0x308ca9)['json'](_0x1716db);}return null;};}function patchUpdates(_0x5c43d4){return function(_0x5ad1a6){try{jsonpatch['apply'](_0x5ad1a6,_0x5c43d4,!![]);}catch(_0x222415){return BPromise['reject'](_0x222415);}return _0x5ad1a6[_0xf8eb('0x33')]();};}function saveUpdates(_0x439df1,_0x15c6a0){return function(_0x143b45){if(_0x143b45){return _0x143b45[_0xf8eb('0x34')](_0x439df1)[_0xf8eb('0x1f')](function(_0x377811){return _0x377811;});}return null;};}function removeEntity(_0x512cf6,_0x260f4d){return function(_0x157081){if(_0x157081){return _0x157081['destroy']()[_0xf8eb('0x1f')](function(){var _0x5bbc6f=_0x157081[_0xf8eb('0x35')]({'plain':!![]});var _0x3cf6dd=_0xf8eb('0x36');return db['UserProfileResource'][_0xf8eb('0x37')]({'where':{'type':_0x3cf6dd,'resourceId':_0x5bbc6f['id']}})['then'](function(){return _0x157081;});})['then'](function(){_0x512cf6[_0xf8eb('0x2c')](0xcc)[_0xf8eb('0x38')]();});}};}function handleEntityNotFound(_0x3a567d,_0x36e34d){return function(_0x403f90){if(!_0x403f90){_0x3a567d[_0xf8eb('0x2b')](0x194);}return _0x403f90;};}function handleError(_0x5afa1c,_0xe203cc){_0xe203cc=_0xe203cc||0x1f4;return function(_0x5b2c16){logger[_0xf8eb('0x24')](_0x5b2c16[_0xf8eb('0x39')]);if(_0x5b2c16[_0xf8eb('0x3a')]){delete _0x5b2c16[_0xf8eb('0x3a')];}_0x5afa1c[_0xf8eb('0x2c')](_0xe203cc)[_0xf8eb('0x3b')](_0x5b2c16);};}exports[_0xf8eb('0x3c')]=function(_0x4dd250,_0x31ca46){var _0x462e7a={'include':[{'model':db['Pause'],'as':_0xf8eb('0x3d')}]},_0xad425e={},_0x5537f7={'count':0x0,'rows':[]};var _0x597cfc=_[_0xf8eb('0x3e')](db[_0xf8eb('0x3f')][_0xf8eb('0x40')],function(_0x1c6439){return{'name':_0x1c6439[_0xf8eb('0x41')],'type':_0x1c6439[_0xf8eb('0x42')][_0xf8eb('0x43')]};});_0xad425e[_0xf8eb('0x44')]=_[_0xf8eb('0x3e')](_0x597cfc,'name');_0xad425e['query']=_[_0xf8eb('0x45')](_0x4dd250['query']);_0xad425e['filters']=_[_0xf8eb('0x46')](_0xad425e['model'],_0xad425e['query']);_0x462e7a[_0xf8eb('0x47')]=_[_0xf8eb('0x46')](_0xad425e[_0xf8eb('0x44')],qs['fields'](_0x4dd250['query']['fields']));_0x462e7a['attributes']=_0x462e7a['attributes'][_0xf8eb('0x48')]?_0x462e7a[_0xf8eb('0x47')]:_0xad425e[_0xf8eb('0x44')];if(!_0x4dd250[_0xf8eb('0x49')][_0xf8eb('0x4a')]('nolimit')){_0x462e7a[_0xf8eb('0x30')]=qs[_0xf8eb('0x30')](_0x4dd250[_0xf8eb('0x49')][_0xf8eb('0x30')]);_0x462e7a[_0xf8eb('0x2e')]=qs[_0xf8eb('0x2e')](_0x4dd250[_0xf8eb('0x49')][_0xf8eb('0x2e')]);}_0x462e7a[_0xf8eb('0x4b')]=qs[_0xf8eb('0x4c')](_0x4dd250['query'][_0xf8eb('0x4c')]);_0x462e7a['where']=qs['filters'](_[_0xf8eb('0x4d')](_0x4dd250[_0xf8eb('0x49')],_0xad425e[_0xf8eb('0x4e')]),_0x597cfc);if(_0x4dd250[_0xf8eb('0x49')][_0xf8eb('0x4f')]){_0x462e7a['where']=_['merge'](_0x462e7a[_0xf8eb('0x50')],{'$or':_[_0xf8eb('0x3e')](_0x597cfc,function(_0x4e4006){if(_0x4e4006[_0xf8eb('0x42')]!==_0xf8eb('0x51')){var _0x4db10b={};_0x4db10b[_0x4e4006[_0xf8eb('0x3a')]]={'$like':'%'+_0x4dd250[_0xf8eb('0x49')][_0xf8eb('0x4f')]+'%'};return _0x4db10b;}})});}_0x462e7a=_['merge']({},_0x462e7a,_0x4dd250[_0xf8eb('0x52')]);var _0x4023f8={'where':_0x462e7a['where']};return db[_0xf8eb('0x3f')][_0xf8eb('0x31')](_0x4023f8)[_0xf8eb('0x1f')](function(_0x33a8b8){_0x5537f7[_0xf8eb('0x31')]=_0x33a8b8;if(_0x4dd250['query']['includeAll']){_0x462e7a[_0xf8eb('0x53')]=[{'all':!![]}];}return db[_0xf8eb('0x3f')][_0xf8eb('0x54')](_0x462e7a);})[_0xf8eb('0x1f')](function(_0x3589e3){_0x5537f7[_0xf8eb('0x55')]=_0x3589e3;return _0x5537f7;})['then'](respondWithFilteredResult(_0x31ca46,_0x462e7a))[_0xf8eb('0x2a')](handleError(_0x31ca46,null));};exports[_0xf8eb('0x56')]=function(_0x2c64c8,_0x19192f){var _0x14e505={'raw':![],'where':{'id':_0x2c64c8[_0xf8eb('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xf8eb('0x3d')}]},_0x304c50={};_0x304c50['model']=_[_0xf8eb('0x45')](db[_0xf8eb('0x3f')][_0xf8eb('0x40')]);_0x304c50[_0xf8eb('0x49')]=_[_0xf8eb('0x45')](_0x2c64c8[_0xf8eb('0x49')]);_0x304c50[_0xf8eb('0x4e')]=_[_0xf8eb('0x46')](_0x304c50['model'],_0x304c50[_0xf8eb('0x49')]);_0x14e505['attributes']=_['intersection'](_0x304c50['model'],qs[_0xf8eb('0x58')](_0x2c64c8['query'][_0xf8eb('0x58')]));_0x14e505['attributes']=_0x14e505['attributes'][_0xf8eb('0x48')]?_0x14e505[_0xf8eb('0x47')]:_0x304c50[_0xf8eb('0x44')];if(_0x2c64c8[_0xf8eb('0x49')][_0xf8eb('0x59')]){_0x14e505[_0xf8eb('0x53')]=[{'all':!![]}];}_0x14e505=_[_0xf8eb('0x5a')]({},_0x14e505,_0x2c64c8[_0xf8eb('0x52')]);return db['OpenchannelAccount'][_0xf8eb('0x5b')](_0x14e505)[_0xf8eb('0x1f')](handleEntityNotFound(_0x19192f,null))[_0xf8eb('0x1f')](respondWithResult(_0x19192f,null))['catch'](handleError(_0x19192f,null));};exports[_0xf8eb('0x5c')]=function(_0x50683f,_0x44d72f){return db[_0xf8eb('0x3f')][_0xf8eb('0x5c')](_0x50683f[_0xf8eb('0x5d')],{})[_0xf8eb('0x1f')](function(_0x5e35b1){var _0x3de79d=_0x50683f['user'][_0xf8eb('0x35')]({'plain':!![]});if(!_0x3de79d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3de79d[_0xf8eb('0x5e')]===_0xf8eb('0x5f')){var _0x24533f=_0x5e35b1[_0xf8eb('0x35')]({'plain':!![]});var _0x3fb55c=_0xf8eb('0x36');return db[_0xf8eb('0x60')][_0xf8eb('0x5b')]({'where':{'name':_0x3fb55c,'userProfileId':_0x3de79d[_0xf8eb('0x61')]},'raw':!![]})['then'](function(_0x1f622d){if(_0x1f622d&&_0x1f622d['autoAssociation']===0x0){return db[_0xf8eb('0x62')][_0xf8eb('0x5c')]({'name':_0x24533f[_0xf8eb('0x3a')],'resourceId':_0x24533f['id'],'type':_0x1f622d[_0xf8eb('0x3a')],'sectionId':_0x1f622d['id']},{})['then'](function(){return _0x5e35b1;});}else{return _0x5e35b1;}})['catch'](function(_0x5f00c9){logger[_0xf8eb('0x24')](_0xf8eb('0x63'),_0x5f00c9);throw _0x5f00c9;});}return _0x5e35b1;})[_0xf8eb('0x1f')](respondWithResult(_0x44d72f,0xc9))[_0xf8eb('0x2a')](handleError(_0x44d72f,null));};exports[_0xf8eb('0x34')]=function(_0x49c0cb,_0x201fdc){if(_0x49c0cb[_0xf8eb('0x5d')]['id']){delete _0x49c0cb[_0xf8eb('0x5d')]['id'];}return db[_0xf8eb('0x3f')][_0xf8eb('0x5b')]({'where':{'id':_0x49c0cb[_0xf8eb('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xf8eb('0x3d')}]})[_0xf8eb('0x1f')](handleEntityNotFound(_0x201fdc,null))[_0xf8eb('0x1f')](saveUpdates(_0x49c0cb[_0xf8eb('0x5d')],null))[_0xf8eb('0x1f')](respondWithResult(_0x201fdc,null))[_0xf8eb('0x2a')](handleError(_0x201fdc,null));};exports[_0xf8eb('0x37')]=function(_0x469455,_0x4015a8){return db[_0xf8eb('0x3f')]['find']({'where':{'id':_0x469455[_0xf8eb('0x57')]['id']}})['then'](handleEntityNotFound(_0x4015a8,null))['then'](removeEntity(_0x4015a8,null))[_0xf8eb('0x2a')](handleError(_0x4015a8,null));};exports[_0xf8eb('0x64')]=function(_0x4f0117,_0x5734ab){return db[_0xf8eb('0x3f')]['describe']()[_0xf8eb('0x1f')](respondWithResult(_0x5734ab,null))[_0xf8eb('0x2a')](handleError(_0x5734ab,null));};exports['addDisposition']=function(_0x2e891a,_0x29b4bc,_0x3e80d6){if(_0x2e891a[_0xf8eb('0x5d')]['id']){delete _0x2e891a[_0xf8eb('0x5d')]['id'];}return db[_0xf8eb('0x3f')]['find']({'where':{'id':_0x2e891a[_0xf8eb('0x57')]['id']}})[_0xf8eb('0x1f')](handleEntityNotFound(_0x29b4bc,null))[_0xf8eb('0x1f')](function(_0x585378){if(_0x585378){_0x2e891a[_0xf8eb('0x5d')]['OpenchannelAccountId']=_0x585378['id'];return db[_0xf8eb('0x65')][_0xf8eb('0x5c')](_0x2e891a[_0xf8eb('0x5d')]);}})[_0xf8eb('0x1f')](respondWithResult(_0x29b4bc,null))[_0xf8eb('0x2a')](handleError(_0x29b4bc,null));};exports[_0xf8eb('0x66')]=function(_0x1342c6,_0x149a44,_0xe2fcfb){var _0xbb5049={'raw':![],'where':{}};var _0x247a17={};var _0x331fbc={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x1342c6['params']['id']}})[_0xf8eb('0x1f')](handleEntityNotFound(_0x149a44,null))[_0xf8eb('0x1f')](function(_0x11c9b3){if(_0x11c9b3){_0x247a17[_0xf8eb('0x44')]=_[_0xf8eb('0x45')](db[_0xf8eb('0x65')][_0xf8eb('0x40')]);_0x247a17[_0xf8eb('0x49')]=_[_0xf8eb('0x45')](_0x1342c6['query']);_0x247a17[_0xf8eb('0x4e')]=_[_0xf8eb('0x46')](_0x247a17[_0xf8eb('0x44')],_0x247a17[_0xf8eb('0x49')]);_0xbb5049[_0xf8eb('0x47')]=_[_0xf8eb('0x46')](_0x247a17[_0xf8eb('0x44')],qs[_0xf8eb('0x58')](_0x1342c6[_0xf8eb('0x49')][_0xf8eb('0x58')]));_0xbb5049[_0xf8eb('0x47')]=_0xbb5049[_0xf8eb('0x47')][_0xf8eb('0x48')]?_0xbb5049[_0xf8eb('0x47')]:_0x247a17[_0xf8eb('0x44')];if(!_0x1342c6['query'][_0xf8eb('0x4a')](_0xf8eb('0x67'))){_0xbb5049[_0xf8eb('0x30')]=qs[_0xf8eb('0x30')](_0x1342c6[_0xf8eb('0x49')][_0xf8eb('0x30')]);_0xbb5049[_0xf8eb('0x2e')]=qs['offset'](_0x1342c6[_0xf8eb('0x49')][_0xf8eb('0x2e')]);}_0xbb5049[_0xf8eb('0x4b')]=qs[_0xf8eb('0x4c')](_0x1342c6[_0xf8eb('0x49')]['sort']);_0xbb5049['where']=qs[_0xf8eb('0x4e')](_['pick'](_0x1342c6[_0xf8eb('0x49')],_0x247a17[_0xf8eb('0x4e')]));_0xbb5049[_0xf8eb('0x50')][_0xf8eb('0x68')]=_0x11c9b3['id'];if(_0x1342c6[_0xf8eb('0x49')][_0xf8eb('0x4f')]){_0xbb5049[_0xf8eb('0x50')]=_[_0xf8eb('0x5a')](_0xbb5049['where'],{'$or':_[_0xf8eb('0x3e')](_0xbb5049[_0xf8eb('0x47')],function(_0x5802a4){var _0x2e98d2={};_0x2e98d2[_0x5802a4]={'$like':'%'+_0x1342c6['query'][_0xf8eb('0x4f')]+'%'};return _0x2e98d2;})});}_0xbb5049=_[_0xf8eb('0x5a')]({},_0xbb5049,_0x1342c6['options']);return db[_0xf8eb('0x65')]['count']({'where':_0xbb5049[_0xf8eb('0x50')]})[_0xf8eb('0x1f')](function(_0xcec2e6){_0x331fbc[_0xf8eb('0x31')]=_0xcec2e6;if(_0x1342c6[_0xf8eb('0x49')][_0xf8eb('0x59')]){_0xbb5049[_0xf8eb('0x53')]=[{'all':!![]}];}return db[_0xf8eb('0x65')][_0xf8eb('0x54')](_0xbb5049);})[_0xf8eb('0x1f')](function(_0xadaead){_0x331fbc[_0xf8eb('0x55')]=_0xadaead;return _0x331fbc;});}})[_0xf8eb('0x1f')](respondWithFilteredResult(_0x149a44,_0xbb5049))['catch'](handleError(_0x149a44,null));};exports[_0xf8eb('0x69')]=function(_0x4757ae,_0x1a2b4b,_0x30dde1){return db[_0xf8eb('0x3f')][_0xf8eb('0x5b')]({'where':{'id':_0x4757ae[_0xf8eb('0x57')]['id']}})[_0xf8eb('0x1f')](handleEntityNotFound(_0x1a2b4b,null))['then'](function(_0x4c60a0){if(_0x4c60a0){return _0x4c60a0[_0xf8eb('0x69')](_0x4757ae[_0xf8eb('0x49')][_0xf8eb('0x6a')]);}})[_0xf8eb('0x1f')](respondWithStatusCode(_0x1a2b4b,null))['catch'](handleError(_0x1a2b4b,null));};exports[_0xf8eb('0x6b')]=function(_0x2924b2,_0x4f9d13,_0x1f68bd){if(_0x2924b2[_0xf8eb('0x5d')]['id']){delete _0x2924b2['body']['id'];}return db[_0xf8eb('0x3f')]['find']({'where':{'id':_0x2924b2[_0xf8eb('0x57')]['id']}})[_0xf8eb('0x1f')](handleEntityNotFound(_0x4f9d13,null))[_0xf8eb('0x1f')](function(_0x1cdfcb){if(_0x1cdfcb){_0x2924b2[_0xf8eb('0x5d')][_0xf8eb('0x68')]=_0x1cdfcb['id'];return db['CannedAnswer'][_0xf8eb('0x5c')](_0x2924b2['body']);}})[_0xf8eb('0x1f')](respondWithResult(_0x4f9d13,null))[_0xf8eb('0x2a')](handleError(_0x4f9d13,null));};exports['getAnswers']=function(_0x4f3147,_0x2c4d5d,_0x541ea0){var _0x2be2f7={'raw':![],'where':{}};var _0x343b4b={};var _0x2ffceb={'count':0x0,'rows':[]};return db[_0xf8eb('0x3f')]['findOne']({'where':{'id':_0x4f3147[_0xf8eb('0x57')]['id']}})[_0xf8eb('0x1f')](handleEntityNotFound(_0x2c4d5d,null))[_0xf8eb('0x1f')](function(_0x129a75){if(_0x129a75){_0x343b4b[_0xf8eb('0x44')]=_[_0xf8eb('0x45')](db[_0xf8eb('0x6c')]['rawAttributes']);_0x343b4b[_0xf8eb('0x49')]=_[_0xf8eb('0x45')](_0x4f3147[_0xf8eb('0x49')]);_0x343b4b[_0xf8eb('0x4e')]=_[_0xf8eb('0x46')](_0x343b4b[_0xf8eb('0x44')],_0x343b4b[_0xf8eb('0x49')]);_0x2be2f7[_0xf8eb('0x47')]=_[_0xf8eb('0x46')](_0x343b4b[_0xf8eb('0x44')],qs['fields'](_0x4f3147[_0xf8eb('0x49')]['fields']));_0x2be2f7[_0xf8eb('0x47')]=_0x2be2f7[_0xf8eb('0x47')][_0xf8eb('0x48')]?_0x2be2f7[_0xf8eb('0x47')]:_0x343b4b[_0xf8eb('0x44')];if(!_0x4f3147[_0xf8eb('0x49')]['hasOwnProperty'](_0xf8eb('0x67'))){_0x2be2f7['limit']=qs[_0xf8eb('0x30')](_0x4f3147[_0xf8eb('0x49')][_0xf8eb('0x30')]);_0x2be2f7[_0xf8eb('0x2e')]=qs[_0xf8eb('0x2e')](_0x4f3147[_0xf8eb('0x49')]['offset']);}_0x2be2f7['order']=qs[_0xf8eb('0x4c')](_0x4f3147[_0xf8eb('0x49')]['sort']);_0x2be2f7['where']=qs[_0xf8eb('0x4e')](_[_0xf8eb('0x4d')](_0x4f3147[_0xf8eb('0x49')],_0x343b4b[_0xf8eb('0x4e')]));_0x2be2f7[_0xf8eb('0x50')][_0xf8eb('0x68')]=_0x129a75['id'];if(_0x4f3147['query'][_0xf8eb('0x4f')]){_0x2be2f7['where']=_[_0xf8eb('0x5a')](_0x2be2f7[_0xf8eb('0x50')],{'$or':_[_0xf8eb('0x3e')](_0x2be2f7[_0xf8eb('0x47')],function(_0x306499){var _0x580bf1={};_0x580bf1[_0x306499]={'$like':'%'+_0x4f3147[_0xf8eb('0x49')][_0xf8eb('0x4f')]+'%'};return _0x580bf1;})});}_0x2be2f7=_[_0xf8eb('0x5a')]({},_0x2be2f7,_0x4f3147[_0xf8eb('0x52')]);return db[_0xf8eb('0x6c')][_0xf8eb('0x31')]({'where':_0x2be2f7[_0xf8eb('0x50')]})[_0xf8eb('0x1f')](function(_0x3b0b23){_0x2ffceb[_0xf8eb('0x31')]=_0x3b0b23;if(_0x4f3147[_0xf8eb('0x49')][_0xf8eb('0x59')]){_0x2be2f7[_0xf8eb('0x53')]=[{'all':!![]}];}return db[_0xf8eb('0x6c')][_0xf8eb('0x54')](_0x2be2f7);})[_0xf8eb('0x1f')](function(_0x44bbb9){_0x2ffceb[_0xf8eb('0x55')]=_0x44bbb9;return _0x2ffceb;});}})[_0xf8eb('0x1f')](respondWithFilteredResult(_0x2c4d5d,_0x2be2f7))[_0xf8eb('0x2a')](handleError(_0x2c4d5d,null));};exports[_0xf8eb('0x6d')]=function(_0x234f6d,_0x490e17,_0x4ce421){return db[_0xf8eb('0x3f')]['find']({'where':{'id':_0x234f6d[_0xf8eb('0x57')]['id']}})[_0xf8eb('0x1f')](handleEntityNotFound(_0x490e17,null))['then'](function(_0x36817f){if(_0x36817f){return _0x36817f[_0xf8eb('0x6d')](_0x234f6d[_0xf8eb('0x49')][_0xf8eb('0x6a')]);}})['then'](respondWithStatusCode(_0x490e17,null))[_0xf8eb('0x2a')](handleError(_0x490e17,null));};exports[_0xf8eb('0x6e')]=function(_0x584aa2,_0x3a5231,_0x404f29){var _0x55f23e={'body':_0x584aa2[_0xf8eb('0x5d')],'channel':_0xf8eb('0x6f')};var _0x31afb4=[];var _0x45adc1=[];var _0x9cbd68={};var _0x45af67=![];return db['CmContact']['describe']()[_0xf8eb('0x1f')](function(_0x141ab1){if(!_0x141ab1){throw new db['Sequelize'][(_0xf8eb('0x70'))](_0xf8eb('0x71'));}_0x31afb4=_[_0xf8eb('0x72')](_[_0xf8eb('0x45')](_0x141ab1),[_0xf8eb('0x73'),_0xf8eb('0x74')]);_0x45adc1=_['difference'](_['keys'](_0x141ab1),[_0xf8eb('0x73'),_0xf8eb('0x74'),'CompanyId',_0xf8eb('0x75')]);if(_0x584aa2[_0xf8eb('0x5d')]['id']){delete _0x584aa2[_0xf8eb('0x5d')]['id'];}if(_[_0xf8eb('0x76')](_0x584aa2[_0xf8eb('0x5d')]['from'])){throw new db[(_0xf8eb('0x77'))][(_0xf8eb('0x70'))]('from\x20is\x20mandatory');}if(_[_0xf8eb('0x76')](_0x584aa2[_0xf8eb('0x5d')][_0xf8eb('0x5d')])||_0x584aa2[_0xf8eb('0x5d')][_0xf8eb('0x5d')]===''){throw new db[(_0xf8eb('0x77'))][(_0xf8eb('0x70'))](_0xf8eb('0x78'));}if(_[_0xf8eb('0x76')](_0x584aa2['body'][_0xf8eb('0x79')])){throw new db[(_0xf8eb('0x77'))][(_0xf8eb('0x70'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x45adc1);}if(!_[_0xf8eb('0x7a')](_0x45adc1,_0x584aa2['body'][_0xf8eb('0x79')])){throw new db[(_0xf8eb('0x77'))][(_0xf8eb('0x70'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x45adc1);}_0x9cbd68[_0x584aa2[_0xf8eb('0x5d')][_0xf8eb('0x79')]]=_0x584aa2[_0xf8eb('0x5d')][_0xf8eb('0x7b')];})['then'](function(){return db[_0xf8eb('0x3f')]['find']({'where':{'id':_0x584aa2[_0xf8eb('0x57')]['id']},'include':[{'model':db[_0xf8eb('0x7c')],'as':_0xf8eb('0x7d'),'include':[{'model':db[_0xf8eb('0x7e')],'as':_0xf8eb('0x7f'),'where':_0x9cbd68,'limit':0x1,'order':[[_0xf8eb('0x74'),_0xf8eb('0x80')]]}]},{'model':db[_0xf8eb('0x81')],'as':_0xf8eb('0x82')}]});})[_0xf8eb('0x1f')](handleEntityNotFound(_0x3a5231,null))[_0xf8eb('0x1f')](function(_0x5b9615){if(_0x5b9615&&_0x5b9615[_0xf8eb('0x7d')]){_0x55f23e[_0xf8eb('0x83')]=_0x5b9615;_0x55f23e['applications']=_0x5b9615[_0xf8eb('0x82')];_0x55f23e['list']=_0x5b9615[_0xf8eb('0x7d')];_0x55f23e[_0xf8eb('0x84')]=_[_0xf8eb('0x85')](_0x55f23e[_0xf8eb('0x84')],[_0xf8eb('0x86')],['asc']);if(_0x55f23e[_0xf8eb('0x83')][_0xf8eb('0x82')]){delete _0x55f23e[_0xf8eb('0x83')][_0xf8eb('0x82')];}if(_0x55f23e[_0xf8eb('0x83')][_0xf8eb('0x7d')]&&_0x55f23e[_0xf8eb('0x83')]['List'][_0xf8eb('0x7f')][_0xf8eb('0x48')]){return _0x55f23e[_0xf8eb('0x83')][_0xf8eb('0x7d')][_0xf8eb('0x7f')][0x0];}var _0x7a7a2c=_[_0xf8eb('0x87')](_0x584aa2[_0xf8eb('0x5d')],{'firstName':_0x584aa2[_0xf8eb('0x5d')][_0xf8eb('0x7b')],'ListId':_0x5b9615['ListId']});_0x7a7a2c[_0x584aa2[_0xf8eb('0x5d')]['mapKey']]=_0x584aa2['body']['from'];return db['CmContact'][_0xf8eb('0x5c')](_0x7a7a2c,{'fields':_0x31afb4,'raw':!![]});}})[_0xf8eb('0x1f')](handleEntityNotFound(_0x3a5231,null))[_0xf8eb('0x1f')](function(_0x41973d){_0x55f23e[_0xf8eb('0x88')]=_0x41973d;if(_0x41973d){var _0x1de81f={'ContactId':_0x41973d['id'],'OpenchannelAccountId':_0x584aa2['params']['id'],'from':(_0x41973d[_0xf8eb('0x89')]||'')+'\x20'+(_0x41973d[_0xf8eb('0x8a')]||'')};var _0x2dcbae={'OpenchannelAccountId':_0x584aa2[_0xf8eb('0x57')]['id'],'closed':![]};if(_0x584aa2[_0xf8eb('0x5d')][_0xf8eb('0x8b')]){_0x2dcbae['threadId']=_0x584aa2[_0xf8eb('0x5d')][_0xf8eb('0x8b')];return db[_0xf8eb('0x8c')]['find']({'where':_0x2dcbae})[_0xf8eb('0x1f')](function(_0xbd1e4a){if(_0xbd1e4a){return[_0xbd1e4a,![]];}_0x1de81f['threadId']=_0x584aa2[_0xf8eb('0x5d')]['threadId'];_0x1de81f[_0xf8eb('0x8d')]=_0x584aa2[_0xf8eb('0x5d')][_0xf8eb('0x8d')];return db['OpenchannelInteraction'][_0xf8eb('0x5c')](_0x1de81f)[_0xf8eb('0x1f')](function(_0xd69e18){return[_0xd69e18,!![]];});});}else{_0x2dcbae[_0xf8eb('0x8b')]=null;}_0x2dcbae[_0xf8eb('0x8e')]=_0x41973d['id'];return db[_0xf8eb('0x8c')][_0xf8eb('0x5b')]({'where':_0x2dcbae})[_0xf8eb('0x1f')](function(_0x560d0c){if(_0x560d0c){return[_0x560d0c,![]];}return db[_0xf8eb('0x8c')][_0xf8eb('0x5c')](_0x1de81f)[_0xf8eb('0x1f')](function(_0x1faf6f){return[_0x1faf6f,!![]];});});}})[_0xf8eb('0x8f')](function(_0x34bf83,_0x37ec35){if(_0x34bf83){_0x45af67=_0x37ec35;if(!_0x37ec35){var _0x2aab28={'from':(_0x55f23e[_0xf8eb('0x88')][_0xf8eb('0x89')]||'')+'\x20'+(_0x55f23e['contact'][_0xf8eb('0x8a')]||'')};if(_0x584aa2[_0xf8eb('0x5d')]['threadId']&&_0x584aa2[_0xf8eb('0x5d')][_0xf8eb('0x90')]&&_0x584aa2[_0xf8eb('0x5d')][_0xf8eb('0x8b')]!=_0x584aa2[_0xf8eb('0x5d')]['messageId']){_0x2aab28[_0xf8eb('0x8b')]=_0x584aa2[_0xf8eb('0x5d')][_0xf8eb('0x90')];}return _0x34bf83[_0xf8eb('0x34')](_0x2aab28);}else{return _0x34bf83;}}})[_0xf8eb('0x1f')](function(_0x558d7c){_0x55f23e[_0xf8eb('0x91')]=_0x558d7c[_0xf8eb('0x35')]({'plain':!![]});_0x55f23e[_0xf8eb('0x91')]['created']=_0x45af67;if(_0x55f23e['interaction'][_0xf8eb('0x92')]){if(_0x55f23e[_0xf8eb('0x83')][_0xf8eb('0x93')]){_0x55f23e[_0xf8eb('0x84')][_0xf8eb('0x94')]({'id':0x0,'priority':_0x55f23e[_0xf8eb('0x84')][_0xf8eb('0x48')]+0x1,'app':_0xf8eb('0x95'),'appdata':_0xf8eb('0x96'),'interval':_0xf8eb('0x97')});}}return db['OpenchannelMessage'][_0xf8eb('0x5c')]({'body':_0x584aa2[_0xf8eb('0x5d')][_0xf8eb('0x5d')],'OpenchannelAccountId':_0x584aa2[_0xf8eb('0x57')]['id'],'OpenchannelInteractionId':_0x558d7c['id'],'direction':'in','ContactId':_0x55f23e[_0xf8eb('0x88')]['id'],'AttachmentId':_0x584aa2[_0xf8eb('0x5d')][_0xf8eb('0x98')]});})[_0xf8eb('0x1f')](function(_0x32a7a2){_0x55f23e['message']=_0x32a7a2;if(_0x55f23e[_0xf8eb('0x91')][_0xf8eb('0x99')]){return db[_0xf8eb('0x9a')][_0xf8eb('0x5b')]({'attributes':['id','name'],'where':{'id':_0x55f23e[_0xf8eb('0x91')][_0xf8eb('0x99')]}})[_0xf8eb('0x1f')](function(_0x3fd15e){if(_0x3fd15e){_0x55f23e[_0xf8eb('0x84')][_0xf8eb('0x9b')]({'id':0x0,'priority':0x0,'app':_0xf8eb('0x9c'),'appdata':_0x3fd15e[_0xf8eb('0x3a')]+','+(_0x55f23e[_0xf8eb('0x83')][_0xf8eb('0x9d')]||0xa),'interval':_0xf8eb('0x97')});_0x55f23e[_0xf8eb('0x9e')]=![];}return respondWithRpcPromise(_0xf8eb('0x9f'),'startRouting',_0x55f23e);});}return respondWithRpcPromise(_0xf8eb('0x9f'),_0xf8eb('0xa0'),_0x55f23e);})[_0xf8eb('0x1f')](function(_0x50e6bc){respondWithRpcPromise(_0xf8eb('0xa1'),'EventManager',{'event':'notify','message':_0x50e6bc},client9002);return _0x50e6bc;})[_0xf8eb('0x1f')](respondWithResult(_0x3a5231,null))[_0xf8eb('0x2a')](handleError(_0x3a5231,null));};exports['addApplications']=function(_0x5e1f23,_0x298a0d){var _0x399f20=_0x5e1f23[_0xf8eb('0x57')]['id'];var _0x5bcd09=_0x5e1f23['body'];var _0x519a6a=0xc8;var _0x18e94f=null;return db[_0xf8eb('0xa2')][_0xf8eb('0xa3')]({'isolationLevel':db[_0xf8eb('0xa2')]['Transaction'][_0xf8eb('0xa4')][_0xf8eb('0xa5')]},function(_0x203378){return db[_0xf8eb('0x3f')]['findOne']({'where':{'id':_0x399f20},'transaction':_0x203378})[_0xf8eb('0x1f')](function(_0x2ddb50){if(_0x2ddb50){return db[_0xf8eb('0x81')][_0xf8eb('0x37')]({'where':{'OpenchannelAccountId':_0x399f20},'transaction':_0x203378})[_0xf8eb('0x1f')](function(){var _0x137fc7=_['map'](_0x5bcd09,function(_0x1ad627){_0x1ad627[_0xf8eb('0x68')]=_0x399f20;return _0x1ad627;});return db['OpenchannelApplication'][_0xf8eb('0xa6')](_0x137fc7,{'transaction':_0x203378});});}else{_0x519a6a=0x194;_0x18e94f=[];}});})[_0xf8eb('0x1f')](function(){if(_0x519a6a!==0x194){return db['OpenchannelApplication'][_0xf8eb('0xa7')]({'where':{'OpenchannelAccountId':_0x399f20},'order':_0xf8eb('0x86')})[_0xf8eb('0x1f')](function(_0x35f2e1){_0x18e94f=_0x35f2e1;});}})[_0xf8eb('0x2a')](function(_0x274ac3){_0x519a6a=0x1f4;logger[_0xf8eb('0x24')](_0x274ac3[_0xf8eb('0x39')]);if(_0x274ac3['name']){delete _0x274ac3['name'];}_0x18e94f=_0x274ac3;})[_0xf8eb('0xa8')](function(){if(_0x18e94f===null){_0x298a0d['sendStatus'](_0x519a6a);}else{if(_0x519a6a===0x1f4){_0x298a0d[_0xf8eb('0x2c')](_0x519a6a)[_0xf8eb('0x3b')](_0x18e94f);}else{_0x298a0d[_0xf8eb('0x2c')](_0x519a6a)[_0xf8eb('0x2d')](_0x18e94f);}}});};exports[_0xf8eb('0xa9')]=function(_0x3e4a53,_0x2c9d93,_0x5f4a25){var _0x4b068e={};var _0x38608a={};var _0x46f313;var _0x3d2c22;return db[_0xf8eb('0x3f')]['findOne']({'where':{'id':_0x3e4a53['params']['id']}})[_0xf8eb('0x1f')](handleEntityNotFound(_0x2c9d93,null))[_0xf8eb('0x1f')](function(_0x2bde33){if(_0x2bde33){_0x46f313=_0x2bde33;_0x38608a[_0xf8eb('0x44')]=_[_0xf8eb('0x45')](db[_0xf8eb('0x81')][_0xf8eb('0x40')]);_0x38608a['query']=_[_0xf8eb('0x45')](_0x3e4a53['query']);_0x38608a[_0xf8eb('0x4e')]=_[_0xf8eb('0x46')](_0x38608a['model'],_0x38608a[_0xf8eb('0x49')]);_0x4b068e[_0xf8eb('0x47')]=_[_0xf8eb('0x46')](_0x38608a[_0xf8eb('0x44')],qs['fields'](_0x3e4a53[_0xf8eb('0x49')][_0xf8eb('0x58')]));_0x4b068e[_0xf8eb('0x47')]=_0x4b068e['attributes'][_0xf8eb('0x48')]?_0x4b068e[_0xf8eb('0x47')]:_0x38608a[_0xf8eb('0x44')];_0x4b068e[_0xf8eb('0x4b')]=qs[_0xf8eb('0x4c')](_0x3e4a53['query']['sort']);_0x4b068e[_0xf8eb('0x50')]=qs[_0xf8eb('0x4e')](_[_0xf8eb('0x4d')](_0x3e4a53['query'],_0x38608a[_0xf8eb('0x4e')]));if(_0x3e4a53[_0xf8eb('0x49')]['filter']){_0x4b068e[_0xf8eb('0x50')]=_['merge'](_0x4b068e[_0xf8eb('0x50')],{'$or':_[_0xf8eb('0x3e')](_0x4b068e['attributes'],function(_0x543acc){var _0x3ff3f3={};_0x3ff3f3[_0x543acc]={'$like':'%'+_0x3e4a53[_0xf8eb('0x49')]['filter']+'%'};return _0x3ff3f3;})});}_0x4b068e=_[_0xf8eb('0x5a')]({},_0x4b068e,_0x3e4a53['options']);return _0x46f313[_0xf8eb('0xa9')](_0x4b068e);}})['then'](function(_0x553323){if(_0x553323){_0x3d2c22=_0x553323['length'];if(!_0x3e4a53[_0xf8eb('0x49')][_0xf8eb('0x4a')](_0xf8eb('0x67'))){_0x4b068e[_0xf8eb('0x30')]=qs['limit'](_0x3e4a53['query']['limit']);_0x4b068e[_0xf8eb('0x2e')]=qs[_0xf8eb('0x2e')](_0x3e4a53[_0xf8eb('0x49')]['offset']);}return _0x46f313[_0xf8eb('0xa9')](_0x4b068e);}})[_0xf8eb('0x1f')](function(_0x158810){if(_0x158810){return _0x158810?{'count':_0x3d2c22,'rows':_0x158810}:null;}})[_0xf8eb('0x1f')](respondWithResult(_0x2c9d93,null))[_0xf8eb('0x2a')](handleError(_0x2c9d93,null));};exports[_0xf8eb('0xaa')]=function(_0x23cc3e,_0x124621,_0xc46788){var _0x17a4fc={'raw':![],'where':{}};var _0x2bb6dc={};var _0x4461f3={'count':0x0,'rows':[]};return db[_0xf8eb('0x3f')][_0xf8eb('0xab')]({'where':{'id':_0x23cc3e[_0xf8eb('0x57')]['id']}})[_0xf8eb('0x1f')](handleEntityNotFound(_0x124621,null))[_0xf8eb('0x1f')](function(_0x290910){if(_0x290910){_0x2bb6dc['model']=_[_0xf8eb('0x45')](db[_0xf8eb('0x8c')][_0xf8eb('0x40')]);_0x2bb6dc[_0xf8eb('0x49')]=_[_0xf8eb('0x45')](_0x23cc3e[_0xf8eb('0x49')]);_0x2bb6dc['filters']=_['intersection'](_0x2bb6dc[_0xf8eb('0x44')],_0x2bb6dc['query']);_0x17a4fc[_0xf8eb('0x47')]=_['intersection'](_0x2bb6dc[_0xf8eb('0x44')],qs['fields'](_0x23cc3e[_0xf8eb('0x49')][_0xf8eb('0x58')]));_0x17a4fc[_0xf8eb('0x47')]=_0x17a4fc[_0xf8eb('0x47')][_0xf8eb('0x48')]?_0x17a4fc[_0xf8eb('0x47')]:_0x2bb6dc[_0xf8eb('0x44')];if(!_0x23cc3e[_0xf8eb('0x49')][_0xf8eb('0x4a')](_0xf8eb('0x67'))){_0x17a4fc[_0xf8eb('0x30')]=qs[_0xf8eb('0x30')](_0x23cc3e[_0xf8eb('0x49')][_0xf8eb('0x30')]);_0x17a4fc[_0xf8eb('0x2e')]=qs[_0xf8eb('0x2e')](_0x23cc3e[_0xf8eb('0x49')][_0xf8eb('0x2e')]);}_0x17a4fc[_0xf8eb('0x4b')]=qs['sort'](_0x23cc3e[_0xf8eb('0x49')][_0xf8eb('0x4c')]);_0x17a4fc[_0xf8eb('0x50')]=qs[_0xf8eb('0x4e')](_[_0xf8eb('0x4d')](_0x23cc3e[_0xf8eb('0x49')],_0x2bb6dc[_0xf8eb('0x4e')]));_0x17a4fc['where'][_0xf8eb('0x68')]=_0x290910['id'];if(_0x23cc3e['query'][_0xf8eb('0x4f')]){_0x17a4fc[_0xf8eb('0x50')]=_[_0xf8eb('0x5a')](_0x17a4fc[_0xf8eb('0x50')],{'$or':_[_0xf8eb('0x3e')](_0x17a4fc[_0xf8eb('0x47')],function(_0x41fc01){var _0x24e90c={};_0x24e90c[_0x41fc01]={'$like':'%'+_0x23cc3e[_0xf8eb('0x49')][_0xf8eb('0x4f')]+'%'};return _0x24e90c;})});}_0x17a4fc=_['merge']({},_0x17a4fc,_0x23cc3e[_0xf8eb('0x52')]);return db['OpenchannelInteraction'][_0xf8eb('0x31')]({'where':_0x17a4fc[_0xf8eb('0x50')]})[_0xf8eb('0x1f')](function(_0x2fe850){_0x4461f3[_0xf8eb('0x31')]=_0x2fe850;if(_0x23cc3e[_0xf8eb('0x49')][_0xf8eb('0x59')]){_0x17a4fc['include']=[{'model':db['CmContact'],'as':_0xf8eb('0xac'),'required':![]},{'model':db[_0xf8eb('0x9a')],'as':_0xf8eb('0xad'),'attributes':[_0xf8eb('0x3a'),_0xf8eb('0xae'),_0xf8eb('0xaf')],'required':![]},{'model':db['Tag'],'as':_0xf8eb('0xb0'),'attributes':['id',_0xf8eb('0x3a'),'color'],'where':_0x23cc3e[_0xf8eb('0x49')][_0xf8eb('0xb1')]?{'id':_0x23cc3e['query']['tag']}:undefined,'required':_0x23cc3e[_0xf8eb('0x49')][_0xf8eb('0xb1')]?!![]:![]}];}return db[_0xf8eb('0x8c')]['findAll'](_0x17a4fc);})[_0xf8eb('0x1f')](function(_0x10557c){_0x4461f3[_0xf8eb('0x55')]=_0x10557c;return _0x4461f3;});}})['then'](respondWithFilteredResult(_0x124621,_0x17a4fc))['catch'](handleError(_0x124621,null));};exports[_0xf8eb('0xb2')]=function(_0x59a9ae,_0x18c34a,_0x1f8c66){return db[_0xf8eb('0x3f')]['find']({'where':{'id':_0x59a9ae[_0xf8eb('0x57')]['id']}})[_0xf8eb('0x1f')](handleEntityNotFound(_0x18c34a,null))['then'](function(_0x4cbeed){if(_0x4cbeed){return _0x4cbeed[_0xf8eb('0xb2')](_0x59a9ae[_0xf8eb('0x5d')]['ids'],_[_0xf8eb('0xb3')](_0x59a9ae[_0xf8eb('0x5d')],[_0xf8eb('0x6a'),'id'])||{})[_0xf8eb('0x8f')](function(_0x27edc1){for(var _0x2c09eb=0x0;_0x2c09eb<_0x59a9ae[_0xf8eb('0x5d')][_0xf8eb('0x6a')][_0xf8eb('0x48')];_0x2c09eb+=0x1){socket[_0xf8eb('0xb4')](_0xf8eb('0xb5'),{'UserId':Number(_0x59a9ae[_0xf8eb('0x5d')][_0xf8eb('0x6a')][_0x2c09eb]),'OpenchannelAccountId':Number(_0x59a9ae['params']['id'])});}return _0x27edc1;});}})['then'](respondWithResult(_0x18c34a,null))[_0xf8eb('0x2a')](handleError(_0x18c34a,null));};exports[_0xf8eb('0xb6')]=function(_0x471d1d,_0x321868,_0x2af140){return db[_0xf8eb('0x3f')][_0xf8eb('0x5b')]({'where':{'id':_0x471d1d[_0xf8eb('0x57')]['id']}})[_0xf8eb('0x1f')](handleEntityNotFound(_0x321868,null))[_0xf8eb('0x1f')](function(_0x6801b2){if(_0x6801b2){return _0x6801b2[_0xf8eb('0xb6')](_0x471d1d[_0xf8eb('0x49')][_0xf8eb('0x6a')])[_0xf8eb('0x1f')](function(){if(_[_0xf8eb('0xb7')](_0x471d1d[_0xf8eb('0x49')][_0xf8eb('0x6a')])){for(var _0x5850b0=0x0;_0x5850b0<_0x471d1d['query'][_0xf8eb('0x6a')]['length'];_0x5850b0+=0x1){socket[_0xf8eb('0xb4')](_0xf8eb('0xb8'),{'UserId':Number(_0x471d1d[_0xf8eb('0x49')][_0xf8eb('0x6a')][_0x5850b0]),'OpenchannelAccountId':Number(_0x471d1d[_0xf8eb('0x57')]['id'])});}}else{socket[_0xf8eb('0xb4')]('userOpenchannelAccount:remove',{'UserId':Number(_0x471d1d[_0xf8eb('0x49')][_0xf8eb('0x6a')]),'OpenchannelAccountId':Number(_0x471d1d[_0xf8eb('0x57')]['id'])});}});}})[_0xf8eb('0x1f')](respondWithStatusCode(_0x321868,null))[_0xf8eb('0x2a')](handleError(_0x321868,null));};exports[_0xf8eb('0xb9')]=function(_0x42035b,_0x5ab0b4,_0x191eae){var _0x52c200={};var _0x19a4d8={};var _0xfd7000;var _0x911504;return db[_0xf8eb('0x3f')][_0xf8eb('0xab')]({'where':{'id':_0x42035b[_0xf8eb('0x57')]['id']}})[_0xf8eb('0x1f')](handleEntityNotFound(_0x5ab0b4,null))[_0xf8eb('0x1f')](function(_0x1947d2){if(_0x1947d2){_0xfd7000=_0x1947d2;_0x19a4d8[_0xf8eb('0x44')]=_[_0xf8eb('0x45')](db[_0xf8eb('0x9a')][_0xf8eb('0x40')]);_0x19a4d8[_0xf8eb('0x49')]=_[_0xf8eb('0x45')](_0x42035b[_0xf8eb('0x49')]);_0x19a4d8[_0xf8eb('0x4e')]=_['intersection'](_0x19a4d8['model'],_0x19a4d8[_0xf8eb('0x49')]);_0x52c200[_0xf8eb('0x47')]=_[_0xf8eb('0x46')](_0x19a4d8[_0xf8eb('0x44')],qs['fields'](_0x42035b['query'][_0xf8eb('0x58')]));_0x52c200[_0xf8eb('0x47')]=_0x52c200[_0xf8eb('0x47')][_0xf8eb('0x48')]?_0x52c200[_0xf8eb('0x47')]:_0x19a4d8['model'];_0x52c200['order']=qs[_0xf8eb('0x4c')](_0x42035b['query'][_0xf8eb('0x4c')]);_0x52c200[_0xf8eb('0x50')]=qs[_0xf8eb('0x4e')](_[_0xf8eb('0x4d')](_0x42035b[_0xf8eb('0x49')],_0x19a4d8[_0xf8eb('0x4e')]));if(_0x42035b[_0xf8eb('0x49')][_0xf8eb('0x4f')]){_0x52c200[_0xf8eb('0x50')]=_['merge'](_0x52c200[_0xf8eb('0x50')],{'$or':_[_0xf8eb('0x3e')](_0x52c200[_0xf8eb('0x47')],function(_0x40d952){var _0x38194f={};_0x38194f[_0x40d952]={'$like':'%'+_0x42035b[_0xf8eb('0x49')][_0xf8eb('0x4f')]+'%'};return _0x38194f;})});}_0x52c200=_[_0xf8eb('0x5a')]({},_0x52c200,_0x42035b['options']);return _0xfd7000[_0xf8eb('0xb9')](_0x52c200);}})[_0xf8eb('0x1f')](function(_0x66731){if(_0x66731){_0x911504=_0x66731[_0xf8eb('0x48')];if(!_0x42035b[_0xf8eb('0x49')][_0xf8eb('0x4a')](_0xf8eb('0x67'))){_0x52c200[_0xf8eb('0x30')]=qs[_0xf8eb('0x30')](_0x42035b[_0xf8eb('0x49')][_0xf8eb('0x30')]);_0x52c200['offset']=qs['offset'](_0x42035b[_0xf8eb('0x49')][_0xf8eb('0x2e')]);}return _0xfd7000[_0xf8eb('0xb9')](_0x52c200);}})['then'](function(_0x3c9b1f){if(_0x3c9b1f){return _0x3c9b1f?{'count':_0x911504,'rows':_0x3c9b1f}:null;}})['then'](respondWithResult(_0x5ab0b4,null))[_0xf8eb('0x2a')](handleError(_0x5ab0b4,null));};exports['send']=function(_0x27b73a,_0x4f3a73,_0xf378ed){var _0x951eee,_0x30bdc5,_0x1ac627;if(_[_0xf8eb('0x76')](_0x27b73a[_0xf8eb('0x5d')][_0xf8eb('0x5d')])||_0x27b73a[_0xf8eb('0x5d')][_0xf8eb('0x5d')]===''){throw new db['Sequelize'][(_0xf8eb('0x70'))](_0xf8eb('0x78'));}if(_[_0xf8eb('0x76')](_0x27b73a[_0xf8eb('0x5d')]['to'])){}_0x951eee=_0x27b73a['body']['to'];return db[_0xf8eb('0x3f')][_0xf8eb('0xab')]({'where':{'id':_0x27b73a[_0xf8eb('0x57')]['id']}})['then'](handleEntityNotFound(_0x4f3a73,null))[_0xf8eb('0x1f')](function(_0x478f16){if(_0x478f16){return db[_0xf8eb('0x3f')][_0xf8eb('0x5b')]({'where':{'id':_0x478f16['id']},'include':[{'model':db['CmList'],'as':_0xf8eb('0x7d'),'include':[{'model':db[_0xf8eb('0x7e')],'as':_0xf8eb('0x7f'),'where':{[_0x478f16[_0xf8eb('0x79')]]:_0x951eee},'limit':0x1,'order':[[_0xf8eb('0x74'),_0xf8eb('0x80')]]}]}]})[_0xf8eb('0x1f')](handleEntityNotFound(_0x4f3a73,null))[_0xf8eb('0x1f')](function(_0x31b0dc){if(_0x31b0dc&&_0x31b0dc[_0xf8eb('0x7d')]){_0x30bdc5=_0x31b0dc[_0xf8eb('0x35')]({'plain':!![]});if(_0x30bdc5['List']&&_0x30bdc5[_0xf8eb('0x7d')][_0xf8eb('0x7f')][_0xf8eb('0x48')]){return _0x30bdc5[_0xf8eb('0x7d')][_0xf8eb('0x7f')][0x0];}return db[_0xf8eb('0x7e')][_0xf8eb('0x5c')](_['defaults'](_0x27b73a[_0xf8eb('0x5d')],{'firstName':_0x951eee,[_0x31b0dc[_0xf8eb('0x79')]]:_0x951eee,'phone':_0x951eee,'ListId':_0x30bdc5[_0xf8eb('0x75')]}));}})[_0xf8eb('0x1f')](handleEntityNotFound(_0x4f3a73,null))[_0xf8eb('0x1f')](function(_0xb4670d){if(_0xb4670d){_0x1ac627=_0xb4670d;return db[_0xf8eb('0x8c')]['find']({'where':{'ContactId':_0x1ac627['id'],'closed':![],'OpenchannelAccountId':_0x30bdc5['id']}})[_0xf8eb('0x1f')](function(_0x4e00a7){if(_0x4e00a7){return[_0x4e00a7,![]];}return db['OpenchannelInteraction'][_0xf8eb('0x5c')]({'UserId':_0x27b73a[_0xf8eb('0x5f')]['id'],'ContactId':_0x1ac627['id'],'OpenchannelAccountId':_0x30bdc5['id'],'lastMsgDirection':_0xf8eb('0xba'),'firstMsgDirection':_0xf8eb('0xba'),'Messages':[_[_0xf8eb('0x5a')](_0x27b73a[_0xf8eb('0x5d')],{'read':![],'body':_0x27b73a[_0xf8eb('0x5d')][_0xf8eb('0x5d')],'OpenchannelAccountId':_0x30bdc5['id'],'UserId':_0x27b73a[_0xf8eb('0x5f')]['id'],'ContactId':_0x1ac627['id']})]},{'include':[{'model':db[_0xf8eb('0xbb')],'as':_0xf8eb('0xbc')}]})[_0xf8eb('0x1f')](function(_0x108bb0){return[_0x108bb0,!![]];});});}})[_0xf8eb('0x8f')](function(_0x4c7ac6,_0x362f49){if(_0x362f49){return _0x4c7ac6;}return db[_0xf8eb('0xbb')]['create'](_['merge'](_0x27b73a[_0xf8eb('0x5d')],{'read':![],'body':_0x27b73a['body'][_0xf8eb('0x5d')],'OpenchannelAccountId':_0x30bdc5['id'],'OpenchannelInteractionId':_0x4c7ac6['id'],'UserId':_0x27b73a[_0xf8eb('0x5f')]['id'],'ContactId':_0x1ac627['id']}))[_0xf8eb('0x1f')](function(_0x3e91ad){_0x4c7ac6['dataValues'][_0xf8eb('0xbc')]=[];_0x4c7ac6[_0xf8eb('0xbd')][_0xf8eb('0xbc')][_0xf8eb('0x94')](_0x3e91ad[_0xf8eb('0xbd')]);return _0x4c7ac6;});});}})['then'](respondWithResult(_0x4f3a73,null))[_0xf8eb('0x2a')](handleError(_0x4f3a73,null));}; \ No newline at end of file +var _0xbdfd=['where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','Pause','length','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','body','find','params','describe','addDisposition','OpenchannelAccountId','Disposition','hasOwnProperty','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','applications','list','orderBy','priority','asc','account','defaults','from','CmContact','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','update','interaction','created','autoclose','push','close','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','bulkCreate','finally','getApplications','Contact','Owner','internal','Tag','color','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','client','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','get','OpenchannelAccounts','UserProfileResource','destroy','stack','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','nolimit','order','sort','pick'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbdfd,0x135));var _0xdbdf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbdfd[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xdbdf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdbdf('0x1'));var rp=require(_0xdbdf('0x2'));var moment=require(_0xdbdf('0x3'));var BPromise=require(_0xdbdf('0x4'));var Mustache=require('mustache');var util=require(_0xdbdf('0x5'));var path=require(_0xdbdf('0x6'));var sox=require('sox');var csv=require(_0xdbdf('0x7'));var ejs=require(_0xdbdf('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdbdf('0x9'));var squel=require(_0xdbdf('0xa'));var crypto=require(_0xdbdf('0xb'));var jsforce=require(_0xdbdf('0xc'));var deskjs=require(_0xdbdf('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdbdf('0xe'));var Papa=require(_0xdbdf('0xf'));var Redis=require(_0xdbdf('0x10'));var authService=require(_0xdbdf('0x11'));var qs=require(_0xdbdf('0x12'));var as=require(_0xdbdf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdbdf('0x14'));var utils=require(_0xdbdf('0x15'));var config=require(_0xdbdf('0x16'));var licenseUtil=require(_0xdbdf('0x17'));var db=require(_0xdbdf('0x18'))['db'];config[_0xdbdf('0x19')]=_['defaults'](config[_0xdbdf('0x19')],{'host':_0xdbdf('0x1a'),'port':0x18eb});var socket=require(_0xdbdf('0x1b'))(new Redis(config[_0xdbdf('0x19')]));require(_0xdbdf('0x1c'))[_0xdbdf('0x1d')](socket);var jayson=require(_0xdbdf('0x1e'));var client=jayson['client'][_0xdbdf('0x1f')]({'port':0x232c});var client9002=jayson[_0xdbdf('0x20')][_0xdbdf('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x173a18,_0x216c58,_0x50dbaa,_0x219aa3){return new BPromise(function(_0x34c928,_0x2764c3){var _0x282e4e=_0x219aa3||client;return _0x282e4e[_0xdbdf('0x21')](_0x173a18,_0x50dbaa)[_0xdbdf('0x22')](function(_0x34cbc0){logger[_0xdbdf('0x23')](_0xdbdf('0x24'),_0x216c58,_0xdbdf('0x25'));logger[_0xdbdf('0x26')](_0xdbdf('0x27'),_0x216c58,'request\x20sent',JSON[_0xdbdf('0x28')](_0x34cbc0));if(_0x34cbc0[_0xdbdf('0x29')]){if(_0x34cbc0[_0xdbdf('0x29')][_0xdbdf('0x2a')]===0x1f4){logger[_0xdbdf('0x29')](_0xdbdf('0x24'),_0x216c58,_0x34cbc0[_0xdbdf('0x29')][_0xdbdf('0x2b')]);return _0x2764c3(_0x34cbc0['error'][_0xdbdf('0x2b')]);}logger[_0xdbdf('0x29')](_0xdbdf('0x24'),_0x216c58,_0x34cbc0[_0xdbdf('0x29')]['message']);return _0x34c928(_0x34cbc0[_0xdbdf('0x29')][_0xdbdf('0x2b')]);}else{logger[_0xdbdf('0x23')](_0xdbdf('0x24'),_0x216c58,_0xdbdf('0x25'));_0x34c928(_0x34cbc0[_0xdbdf('0x2c')][_0xdbdf('0x2b')]);}})[_0xdbdf('0x2d')](function(_0x5219f9){logger[_0xdbdf('0x29')](_0xdbdf('0x24'),_0x216c58,_0x5219f9);_0x2764c3(_0x5219f9);});});}function respondWithStatusCode(_0xb8adbd,_0x23b080){_0x23b080=_0x23b080||0xcc;return function(_0x1bc27b){if(_0x1bc27b){return _0xb8adbd[_0xdbdf('0x2e')](_0x23b080);}return _0xb8adbd[_0xdbdf('0x2f')](_0x23b080)[_0xdbdf('0x30')]();};}function respondWithResult(_0x353fb1,_0x3d0ad1){_0x3d0ad1=_0x3d0ad1||0xc8;return function(_0x486fea){if(_0x486fea){return _0x353fb1['status'](_0x3d0ad1)[_0xdbdf('0x31')](_0x486fea);}};}function respondWithFilteredResult(_0x501ca8,_0x1995e0){return function(_0xfa1cd9){if(_0xfa1cd9){var _0x1ea57e=typeof _0x1995e0[_0xdbdf('0x32')]===_0xdbdf('0x33')&&typeof _0x1995e0[_0xdbdf('0x34')]===_0xdbdf('0x33');var _0x2faffe=_0xfa1cd9[_0xdbdf('0x35')];var _0x4c0f1d=_0x1ea57e?0x0:_0x1995e0[_0xdbdf('0x32')];var _0x2a1a92=_0x1ea57e?_0xfa1cd9['count']:_0x1995e0[_0xdbdf('0x32')]+_0x1995e0[_0xdbdf('0x34')];var _0x1cbaaa;if(_0x2a1a92>=_0x2faffe){_0x2a1a92=_0x2faffe;_0x1cbaaa=0xc8;}else{_0x1cbaaa=0xce;}_0x501ca8[_0xdbdf('0x2f')](_0x1cbaaa);return _0x501ca8[_0xdbdf('0x36')]('Content-Range',_0x4c0f1d+'-'+_0x2a1a92+'/'+_0x2faffe)[_0xdbdf('0x31')](_0xfa1cd9);}return null;};}function patchUpdates(_0x3f0119){return function(_0x4eaf57){try{jsonpatch[_0xdbdf('0x37')](_0x4eaf57,_0x3f0119,!![]);}catch(_0x380296){return BPromise[_0xdbdf('0x38')](_0x380296);}return _0x4eaf57[_0xdbdf('0x39')]();};}function saveUpdates(_0x384530,_0x25a2cb){return function(_0x530307){if(_0x530307){return _0x530307['update'](_0x384530)['then'](function(_0x4b2180){return _0x4b2180;});}return null;};}function removeEntity(_0x42e463,_0x480d42){return function(_0x310e14){if(_0x310e14){return _0x310e14['destroy']()['then'](function(){var _0x35f315=_0x310e14[_0xdbdf('0x3a')]({'plain':!![]});var _0xce5be1=_0xdbdf('0x3b');return db[_0xdbdf('0x3c')][_0xdbdf('0x3d')]({'where':{'type':_0xce5be1,'resourceId':_0x35f315['id']}})[_0xdbdf('0x22')](function(){return _0x310e14;});})['then'](function(){_0x42e463[_0xdbdf('0x2f')](0xcc)[_0xdbdf('0x30')]();});}};}function handleEntityNotFound(_0x189413,_0x3f4eec){return function(_0xe2bf1d){if(!_0xe2bf1d){_0x189413[_0xdbdf('0x2e')](0x194);}return _0xe2bf1d;};}function handleError(_0x164be1,_0x1bb441){_0x1bb441=_0x1bb441||0x1f4;return function(_0x56c495){logger[_0xdbdf('0x29')](_0x56c495[_0xdbdf('0x3e')]);if(_0x56c495['name']){delete _0x56c495[_0xdbdf('0x3f')];}_0x164be1[_0xdbdf('0x2f')](_0x1bb441)[_0xdbdf('0x40')](_0x56c495);};}exports[_0xdbdf('0x41')]=function(_0x555c2d,_0x36310c){var _0x54d15a={'include':[{'model':db['Pause'],'as':_0xdbdf('0x42')}]},_0x270df0={},_0x4a916c={'count':0x0,'rows':[]};var _0x4a0b75=_[_0xdbdf('0x43')](db[_0xdbdf('0x44')][_0xdbdf('0x45')],function(_0x11b456){return{'name':_0x11b456[_0xdbdf('0x46')],'type':_0x11b456[_0xdbdf('0x47')]['key']};});_0x270df0['model']=_[_0xdbdf('0x43')](_0x4a0b75,_0xdbdf('0x3f'));_0x270df0[_0xdbdf('0x48')]=_[_0xdbdf('0x49')](_0x555c2d['query']);_0x270df0[_0xdbdf('0x4a')]=_['intersection'](_0x270df0[_0xdbdf('0x4b')],_0x270df0[_0xdbdf('0x48')]);_0x54d15a[_0xdbdf('0x4c')]=_[_0xdbdf('0x4d')](_0x270df0[_0xdbdf('0x4b')],qs['fields'](_0x555c2d[_0xdbdf('0x48')][_0xdbdf('0x4e')]));_0x54d15a['attributes']=_0x54d15a[_0xdbdf('0x4c')]['length']?_0x54d15a[_0xdbdf('0x4c')]:_0x270df0['model'];if(!_0x555c2d[_0xdbdf('0x48')]['hasOwnProperty'](_0xdbdf('0x4f'))){_0x54d15a[_0xdbdf('0x34')]=qs[_0xdbdf('0x34')](_0x555c2d[_0xdbdf('0x48')][_0xdbdf('0x34')]);_0x54d15a[_0xdbdf('0x32')]=qs[_0xdbdf('0x32')](_0x555c2d[_0xdbdf('0x48')][_0xdbdf('0x32')]);}_0x54d15a[_0xdbdf('0x50')]=qs[_0xdbdf('0x51')](_0x555c2d['query'][_0xdbdf('0x51')]);_0x54d15a['where']=qs[_0xdbdf('0x4a')](_[_0xdbdf('0x52')](_0x555c2d[_0xdbdf('0x48')],_0x270df0[_0xdbdf('0x4a')]),_0x4a0b75);if(_0x555c2d[_0xdbdf('0x48')]['filter']){_0x54d15a[_0xdbdf('0x53')]=_[_0xdbdf('0x54')](_0x54d15a['where'],{'$or':_[_0xdbdf('0x43')](_0x4a0b75,function(_0x536393){if(_0x536393[_0xdbdf('0x47')]!==_0xdbdf('0x55')){var _0x537247={};_0x537247[_0x536393[_0xdbdf('0x3f')]]={'$like':'%'+_0x555c2d[_0xdbdf('0x48')][_0xdbdf('0x56')]+'%'};return _0x537247;}})});}_0x54d15a=_[_0xdbdf('0x54')]({},_0x54d15a,_0x555c2d[_0xdbdf('0x57')]);var _0x433aef={'where':_0x54d15a[_0xdbdf('0x53')]};return db[_0xdbdf('0x44')][_0xdbdf('0x35')](_0x433aef)[_0xdbdf('0x22')](function(_0x50d12e){_0x4a916c[_0xdbdf('0x35')]=_0x50d12e;if(_0x555c2d[_0xdbdf('0x48')][_0xdbdf('0x58')]){_0x54d15a[_0xdbdf('0x59')]=[{'all':!![]}];}return db[_0xdbdf('0x44')][_0xdbdf('0x5a')](_0x54d15a);})[_0xdbdf('0x22')](function(_0xb41556){_0x4a916c['rows']=_0xb41556;return _0x4a916c;})[_0xdbdf('0x22')](respondWithFilteredResult(_0x36310c,_0x54d15a))['catch'](handleError(_0x36310c,null));};exports[_0xdbdf('0x5b')]=function(_0x5aecd0,_0x13e56c){var _0x51137e={'raw':![],'where':{'id':_0x5aecd0['params']['id']},'include':[{'model':db[_0xdbdf('0x5c')],'as':_0xdbdf('0x42')}]},_0x428e8c={};_0x428e8c[_0xdbdf('0x4b')]=_[_0xdbdf('0x49')](db[_0xdbdf('0x44')][_0xdbdf('0x45')]);_0x428e8c['query']=_[_0xdbdf('0x49')](_0x5aecd0[_0xdbdf('0x48')]);_0x428e8c[_0xdbdf('0x4a')]=_[_0xdbdf('0x4d')](_0x428e8c[_0xdbdf('0x4b')],_0x428e8c[_0xdbdf('0x48')]);_0x51137e[_0xdbdf('0x4c')]=_[_0xdbdf('0x4d')](_0x428e8c[_0xdbdf('0x4b')],qs[_0xdbdf('0x4e')](_0x5aecd0[_0xdbdf('0x48')][_0xdbdf('0x4e')]));_0x51137e['attributes']=_0x51137e[_0xdbdf('0x4c')][_0xdbdf('0x5d')]?_0x51137e['attributes']:_0x428e8c[_0xdbdf('0x4b')];if(_0x5aecd0[_0xdbdf('0x48')][_0xdbdf('0x58')]){_0x51137e[_0xdbdf('0x59')]=[{'all':!![]}];}_0x51137e=_[_0xdbdf('0x54')]({},_0x51137e,_0x5aecd0[_0xdbdf('0x57')]);return db[_0xdbdf('0x44')]['find'](_0x51137e)[_0xdbdf('0x22')](handleEntityNotFound(_0x13e56c,null))[_0xdbdf('0x22')](respondWithResult(_0x13e56c,null))['catch'](handleError(_0x13e56c,null));};exports[_0xdbdf('0x5e')]=function(_0x3b24dd,_0x4ab283){return db[_0xdbdf('0x44')][_0xdbdf('0x5e')](_0x3b24dd['body'],{})['then'](function(_0x325adc){var _0x2caa41=_0x3b24dd['user']['get']({'plain':!![]});if(!_0x2caa41)throw new Error(_0xdbdf('0x5f'));if(_0x2caa41['role']===_0xdbdf('0x60')){var _0x136006=_0x325adc[_0xdbdf('0x3a')]({'plain':!![]});var _0x69c229=_0xdbdf('0x3b');return db[_0xdbdf('0x61')]['find']({'where':{'name':_0x69c229,'userProfileId':_0x2caa41[_0xdbdf('0x62')]},'raw':!![]})[_0xdbdf('0x22')](function(_0x3dcc43){if(_0x3dcc43&&_0x3dcc43[_0xdbdf('0x63')]===0x0){return db['UserProfileResource']['create']({'name':_0x136006[_0xdbdf('0x3f')],'resourceId':_0x136006['id'],'type':_0x3dcc43['name'],'sectionId':_0x3dcc43['id']},{})[_0xdbdf('0x22')](function(){return _0x325adc;});}else{return _0x325adc;}})[_0xdbdf('0x2d')](function(_0x4d1c3d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d1c3d);throw _0x4d1c3d;});}return _0x325adc;})[_0xdbdf('0x22')](respondWithResult(_0x4ab283,0xc9))[_0xdbdf('0x2d')](handleError(_0x4ab283,null));};exports['update']=function(_0x339d47,_0xff966c){if(_0x339d47[_0xdbdf('0x64')]['id']){delete _0x339d47[_0xdbdf('0x64')]['id'];}return db[_0xdbdf('0x44')][_0xdbdf('0x65')]({'where':{'id':_0x339d47[_0xdbdf('0x66')]['id']},'include':[{'model':db[_0xdbdf('0x5c')],'as':_0xdbdf('0x42')}]})[_0xdbdf('0x22')](handleEntityNotFound(_0xff966c,null))[_0xdbdf('0x22')](saveUpdates(_0x339d47[_0xdbdf('0x64')],null))[_0xdbdf('0x22')](respondWithResult(_0xff966c,null))[_0xdbdf('0x2d')](handleError(_0xff966c,null));};exports[_0xdbdf('0x3d')]=function(_0xae14c1,_0x5ab15b){return db[_0xdbdf('0x44')]['find']({'where':{'id':_0xae14c1['params']['id']}})[_0xdbdf('0x22')](handleEntityNotFound(_0x5ab15b,null))[_0xdbdf('0x22')](removeEntity(_0x5ab15b,null))[_0xdbdf('0x2d')](handleError(_0x5ab15b,null));};exports[_0xdbdf('0x67')]=function(_0x5596b8,_0x1d1442){return db[_0xdbdf('0x44')][_0xdbdf('0x67')]()[_0xdbdf('0x22')](respondWithResult(_0x1d1442,null))[_0xdbdf('0x2d')](handleError(_0x1d1442,null));};exports[_0xdbdf('0x68')]=function(_0x338088,_0x5310a0,_0x187a5a){if(_0x338088[_0xdbdf('0x64')]['id']){delete _0x338088[_0xdbdf('0x64')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x338088[_0xdbdf('0x66')]['id']}})[_0xdbdf('0x22')](handleEntityNotFound(_0x5310a0,null))[_0xdbdf('0x22')](function(_0x29d076){if(_0x29d076){_0x338088[_0xdbdf('0x64')][_0xdbdf('0x69')]=_0x29d076['id'];return db[_0xdbdf('0x6a')][_0xdbdf('0x5e')](_0x338088[_0xdbdf('0x64')]);}})['then'](respondWithResult(_0x5310a0,null))[_0xdbdf('0x2d')](handleError(_0x5310a0,null));};exports['getDispositions']=function(_0x49a825,_0x591182,_0x3a7955){var _0x442a5f={'raw':![],'where':{}};var _0x45dc8e={};var _0x3605be={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x49a825['params']['id']}})['then'](handleEntityNotFound(_0x591182,null))[_0xdbdf('0x22')](function(_0x5c0d73){if(_0x5c0d73){_0x45dc8e[_0xdbdf('0x4b')]=_[_0xdbdf('0x49')](db['Disposition']['rawAttributes']);_0x45dc8e[_0xdbdf('0x48')]=_[_0xdbdf('0x49')](_0x49a825[_0xdbdf('0x48')]);_0x45dc8e['filters']=_['intersection'](_0x45dc8e[_0xdbdf('0x4b')],_0x45dc8e[_0xdbdf('0x48')]);_0x442a5f[_0xdbdf('0x4c')]=_[_0xdbdf('0x4d')](_0x45dc8e['model'],qs[_0xdbdf('0x4e')](_0x49a825[_0xdbdf('0x48')][_0xdbdf('0x4e')]));_0x442a5f[_0xdbdf('0x4c')]=_0x442a5f[_0xdbdf('0x4c')][_0xdbdf('0x5d')]?_0x442a5f[_0xdbdf('0x4c')]:_0x45dc8e['model'];if(!_0x49a825['query'][_0xdbdf('0x6b')]('nolimit')){_0x442a5f[_0xdbdf('0x34')]=qs[_0xdbdf('0x34')](_0x49a825[_0xdbdf('0x48')][_0xdbdf('0x34')]);_0x442a5f[_0xdbdf('0x32')]=qs[_0xdbdf('0x32')](_0x49a825[_0xdbdf('0x48')][_0xdbdf('0x32')]);}_0x442a5f[_0xdbdf('0x50')]=qs[_0xdbdf('0x51')](_0x49a825[_0xdbdf('0x48')][_0xdbdf('0x51')]);_0x442a5f['where']=qs[_0xdbdf('0x4a')](_[_0xdbdf('0x52')](_0x49a825[_0xdbdf('0x48')],_0x45dc8e[_0xdbdf('0x4a')]));_0x442a5f[_0xdbdf('0x53')][_0xdbdf('0x69')]=_0x5c0d73['id'];if(_0x49a825[_0xdbdf('0x48')][_0xdbdf('0x56')]){_0x442a5f[_0xdbdf('0x53')]=_[_0xdbdf('0x54')](_0x442a5f['where'],{'$or':_[_0xdbdf('0x43')](_0x442a5f[_0xdbdf('0x4c')],function(_0x5dbcad){var _0xe00a63={};_0xe00a63[_0x5dbcad]={'$like':'%'+_0x49a825['query'][_0xdbdf('0x56')]+'%'};return _0xe00a63;})});}_0x442a5f=_[_0xdbdf('0x54')]({},_0x442a5f,_0x49a825[_0xdbdf('0x57')]);return db[_0xdbdf('0x6a')]['count']({'where':_0x442a5f[_0xdbdf('0x53')]})['then'](function(_0x3820ed){_0x3605be[_0xdbdf('0x35')]=_0x3820ed;if(_0x49a825[_0xdbdf('0x48')][_0xdbdf('0x58')]){_0x442a5f[_0xdbdf('0x59')]=[{'all':!![]}];}return db['Disposition'][_0xdbdf('0x5a')](_0x442a5f);})[_0xdbdf('0x22')](function(_0x1dd764){_0x3605be[_0xdbdf('0x6c')]=_0x1dd764;return _0x3605be;});}})[_0xdbdf('0x22')](respondWithFilteredResult(_0x591182,_0x442a5f))[_0xdbdf('0x2d')](handleError(_0x591182,null));};exports[_0xdbdf('0x6d')]=function(_0x58a929,_0x41a120,_0x8424c4){return db[_0xdbdf('0x44')]['find']({'where':{'id':_0x58a929[_0xdbdf('0x66')]['id']}})[_0xdbdf('0x22')](handleEntityNotFound(_0x41a120,null))['then'](function(_0x36517e){if(_0x36517e){return _0x36517e['removeDispositions'](_0x58a929[_0xdbdf('0x48')][_0xdbdf('0x6e')]);}})[_0xdbdf('0x22')](respondWithStatusCode(_0x41a120,null))[_0xdbdf('0x2d')](handleError(_0x41a120,null));};exports[_0xdbdf('0x6f')]=function(_0x474240,_0xa2999c,_0x43342a){if(_0x474240[_0xdbdf('0x64')]['id']){delete _0x474240['body']['id'];}return db['OpenchannelAccount'][_0xdbdf('0x65')]({'where':{'id':_0x474240[_0xdbdf('0x66')]['id']}})[_0xdbdf('0x22')](handleEntityNotFound(_0xa2999c,null))[_0xdbdf('0x22')](function(_0x49739c){if(_0x49739c){_0x474240[_0xdbdf('0x64')][_0xdbdf('0x69')]=_0x49739c['id'];return db[_0xdbdf('0x70')][_0xdbdf('0x5e')](_0x474240[_0xdbdf('0x64')]);}})[_0xdbdf('0x22')](respondWithResult(_0xa2999c,null))['catch'](handleError(_0xa2999c,null));};exports[_0xdbdf('0x71')]=function(_0x9383fc,_0x5c85fa,_0x382667){var _0x4455f1={'raw':![],'where':{}};var _0x2da986={};var _0x2e2d5b={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xdbdf('0x72')]({'where':{'id':_0x9383fc[_0xdbdf('0x66')]['id']}})[_0xdbdf('0x22')](handleEntityNotFound(_0x5c85fa,null))[_0xdbdf('0x22')](function(_0xe6e04b){if(_0xe6e04b){_0x2da986['model']=_['keys'](db[_0xdbdf('0x70')][_0xdbdf('0x45')]);_0x2da986[_0xdbdf('0x48')]=_[_0xdbdf('0x49')](_0x9383fc[_0xdbdf('0x48')]);_0x2da986[_0xdbdf('0x4a')]=_['intersection'](_0x2da986[_0xdbdf('0x4b')],_0x2da986[_0xdbdf('0x48')]);_0x4455f1[_0xdbdf('0x4c')]=_[_0xdbdf('0x4d')](_0x2da986[_0xdbdf('0x4b')],qs[_0xdbdf('0x4e')](_0x9383fc['query'][_0xdbdf('0x4e')]));_0x4455f1[_0xdbdf('0x4c')]=_0x4455f1[_0xdbdf('0x4c')][_0xdbdf('0x5d')]?_0x4455f1[_0xdbdf('0x4c')]:_0x2da986[_0xdbdf('0x4b')];if(!_0x9383fc[_0xdbdf('0x48')][_0xdbdf('0x6b')](_0xdbdf('0x4f'))){_0x4455f1[_0xdbdf('0x34')]=qs[_0xdbdf('0x34')](_0x9383fc['query']['limit']);_0x4455f1[_0xdbdf('0x32')]=qs[_0xdbdf('0x32')](_0x9383fc[_0xdbdf('0x48')][_0xdbdf('0x32')]);}_0x4455f1[_0xdbdf('0x50')]=qs[_0xdbdf('0x51')](_0x9383fc['query'][_0xdbdf('0x51')]);_0x4455f1[_0xdbdf('0x53')]=qs[_0xdbdf('0x4a')](_[_0xdbdf('0x52')](_0x9383fc[_0xdbdf('0x48')],_0x2da986[_0xdbdf('0x4a')]));_0x4455f1[_0xdbdf('0x53')]['OpenchannelAccountId']=_0xe6e04b['id'];if(_0x9383fc[_0xdbdf('0x48')][_0xdbdf('0x56')]){_0x4455f1[_0xdbdf('0x53')]=_['merge'](_0x4455f1[_0xdbdf('0x53')],{'$or':_['map'](_0x4455f1[_0xdbdf('0x4c')],function(_0x5c6b65){var _0x23eb9d={};_0x23eb9d[_0x5c6b65]={'$like':'%'+_0x9383fc[_0xdbdf('0x48')]['filter']+'%'};return _0x23eb9d;})});}_0x4455f1=_[_0xdbdf('0x54')]({},_0x4455f1,_0x9383fc[_0xdbdf('0x57')]);return db[_0xdbdf('0x70')][_0xdbdf('0x35')]({'where':_0x4455f1[_0xdbdf('0x53')]})[_0xdbdf('0x22')](function(_0x31bc4d){_0x2e2d5b[_0xdbdf('0x35')]=_0x31bc4d;if(_0x9383fc['query']['includeAll']){_0x4455f1['include']=[{'all':!![]}];}return db[_0xdbdf('0x70')][_0xdbdf('0x5a')](_0x4455f1);})[_0xdbdf('0x22')](function(_0x562337){_0x2e2d5b['rows']=_0x562337;return _0x2e2d5b;});}})['then'](respondWithFilteredResult(_0x5c85fa,_0x4455f1))[_0xdbdf('0x2d')](handleError(_0x5c85fa,null));};exports[_0xdbdf('0x73')]=function(_0x58053c,_0x4399d7,_0x5e6e8a){return db['OpenchannelAccount'][_0xdbdf('0x65')]({'where':{'id':_0x58053c[_0xdbdf('0x66')]['id']}})[_0xdbdf('0x22')](handleEntityNotFound(_0x4399d7,null))[_0xdbdf('0x22')](function(_0x3165cb){if(_0x3165cb){return _0x3165cb[_0xdbdf('0x73')](_0x58053c[_0xdbdf('0x48')][_0xdbdf('0x6e')]);}})[_0xdbdf('0x22')](respondWithStatusCode(_0x4399d7,null))[_0xdbdf('0x2d')](handleError(_0x4399d7,null));};exports[_0xdbdf('0x74')]=function(_0x24f073,_0x5a9774,_0x427e17){var _0x37fe66={'body':_0x24f073[_0xdbdf('0x64')],'channel':_0xdbdf('0x75')};var _0x3edc53=[];var _0x2438d1=[];var _0x1395a5={};var _0x1e19d7=![];return db['CmContact'][_0xdbdf('0x67')]()[_0xdbdf('0x22')](function(_0x10786c){if(!_0x10786c){throw new db[(_0xdbdf('0x76'))][(_0xdbdf('0x77'))](_0xdbdf('0x78'));}_0x3edc53=_[_0xdbdf('0x79')](_[_0xdbdf('0x49')](_0x10786c),['createdAt',_0xdbdf('0x7a')]);_0x2438d1=_['difference'](_[_0xdbdf('0x49')](_0x10786c),[_0xdbdf('0x7b'),_0xdbdf('0x7a'),'CompanyId',_0xdbdf('0x7c')]);if(_0x24f073[_0xdbdf('0x64')]['id']){delete _0x24f073['body']['id'];}if(_[_0xdbdf('0x7d')](_0x24f073['body']['from'])){throw new db[(_0xdbdf('0x76'))][(_0xdbdf('0x77'))](_0xdbdf('0x7e'));}if(_[_0xdbdf('0x7d')](_0x24f073[_0xdbdf('0x64')]['body'])||_0x24f073['body']['body']===''){throw new db[(_0xdbdf('0x76'))][(_0xdbdf('0x77'))](_0xdbdf('0x7f'));}if(_['isNil'](_0x24f073[_0xdbdf('0x64')][_0xdbdf('0x80')])){throw new db[(_0xdbdf('0x76'))]['ValidationError'](_0xdbdf('0x81')+_0x2438d1);}if(!_['includes'](_0x2438d1,_0x24f073[_0xdbdf('0x64')][_0xdbdf('0x80')])){throw new db[(_0xdbdf('0x76'))][(_0xdbdf('0x77'))](_0xdbdf('0x82')+_0x2438d1);}_0x1395a5[_0x24f073['body']['mapKey']]=_0x24f073[_0xdbdf('0x64')]['from'];})[_0xdbdf('0x22')](function(){return db[_0xdbdf('0x44')][_0xdbdf('0x65')]({'where':{'id':_0x24f073[_0xdbdf('0x66')]['id']},'include':[{'model':db[_0xdbdf('0x83')],'as':_0xdbdf('0x84'),'include':[{'model':db['CmContact'],'as':_0xdbdf('0x85'),'where':_0x1395a5,'limit':0x1,'order':[['updatedAt',_0xdbdf('0x86')]]}]},{'model':db[_0xdbdf('0x87')],'as':_0xdbdf('0x88')}]});})['then'](handleEntityNotFound(_0x5a9774,null))['then'](function(_0x12dfc9){if(_0x12dfc9&&_0x12dfc9[_0xdbdf('0x84')]){_0x37fe66['account']=_0x12dfc9;_0x37fe66[_0xdbdf('0x89')]=_0x12dfc9[_0xdbdf('0x88')];_0x37fe66[_0xdbdf('0x8a')]=_0x12dfc9[_0xdbdf('0x84')];_0x37fe66['applications']=_[_0xdbdf('0x8b')](_0x37fe66[_0xdbdf('0x89')],[_0xdbdf('0x8c')],[_0xdbdf('0x8d')]);if(_0x37fe66[_0xdbdf('0x8e')][_0xdbdf('0x88')]){delete _0x37fe66[_0xdbdf('0x8e')][_0xdbdf('0x88')];}if(_0x37fe66[_0xdbdf('0x8e')][_0xdbdf('0x84')]&&_0x37fe66[_0xdbdf('0x8e')][_0xdbdf('0x84')][_0xdbdf('0x85')][_0xdbdf('0x5d')]){return _0x37fe66[_0xdbdf('0x8e')]['List']['Contacts'][0x0];}var _0x2511ac=_[_0xdbdf('0x8f')](_0x24f073['body'],{'firstName':_0x24f073[_0xdbdf('0x64')][_0xdbdf('0x90')],'ListId':_0x12dfc9[_0xdbdf('0x7c')]});_0x2511ac[_0x24f073[_0xdbdf('0x64')][_0xdbdf('0x80')]]=_0x24f073[_0xdbdf('0x64')]['from'];return db[_0xdbdf('0x91')][_0xdbdf('0x5e')](_0x2511ac,{'fields':_0x3edc53,'raw':!![]});}})[_0xdbdf('0x22')](handleEntityNotFound(_0x5a9774,null))[_0xdbdf('0x22')](function(_0x472f5a){_0x37fe66[_0xdbdf('0x92')]=_0x472f5a;if(_0x472f5a){var _0x35c431={'ContactId':_0x472f5a['id'],'OpenchannelAccountId':_0x24f073[_0xdbdf('0x66')]['id'],'from':(_0x472f5a[_0xdbdf('0x93')]||'')+'\x20'+(_0x472f5a[_0xdbdf('0x94')]||'')};var _0x2e9d34={'OpenchannelAccountId':_0x24f073[_0xdbdf('0x66')]['id'],'closed':![]};if(_0x24f073[_0xdbdf('0x64')]['threadId']){_0x2e9d34[_0xdbdf('0x95')]=_0x24f073[_0xdbdf('0x64')][_0xdbdf('0x95')];return db[_0xdbdf('0x96')]['find']({'where':_0x2e9d34})[_0xdbdf('0x22')](function(_0x3e4c39){if(_0x3e4c39){return[_0x3e4c39,![]];}_0x35c431[_0xdbdf('0x95')]=_0x24f073[_0xdbdf('0x64')][_0xdbdf('0x95')];_0x35c431[_0xdbdf('0x97')]=_0x24f073[_0xdbdf('0x64')][_0xdbdf('0x97')];return db['OpenchannelInteraction'][_0xdbdf('0x5e')](_0x35c431)[_0xdbdf('0x22')](function(_0x15d63f){return[_0x15d63f,!![]];});});}else{_0x2e9d34[_0xdbdf('0x95')]=null;}_0x2e9d34[_0xdbdf('0x98')]=_0x472f5a['id'];return db[_0xdbdf('0x96')][_0xdbdf('0x65')]({'where':_0x2e9d34})['then'](function(_0x52b8e8){if(_0x52b8e8){return[_0x52b8e8,![]];}return db[_0xdbdf('0x96')]['create'](_0x35c431)[_0xdbdf('0x22')](function(_0x360bea){return[_0x360bea,!![]];});});}})['spread'](function(_0x3b17e0,_0xc214d0){if(_0x3b17e0){_0x1e19d7=_0xc214d0;if(!_0xc214d0){var _0x533c38={'from':(_0x37fe66[_0xdbdf('0x92')]['firstName']||'')+'\x20'+(_0x37fe66[_0xdbdf('0x92')][_0xdbdf('0x94')]||'')};if(_0x24f073[_0xdbdf('0x64')][_0xdbdf('0x95')]&&_0x24f073[_0xdbdf('0x64')][_0xdbdf('0x99')]&&_0x24f073[_0xdbdf('0x64')]['threadId']!=_0x24f073[_0xdbdf('0x64')][_0xdbdf('0x99')]){_0x533c38[_0xdbdf('0x95')]=_0x24f073[_0xdbdf('0x64')]['messageId'];}return _0x3b17e0[_0xdbdf('0x9a')](_0x533c38);}else{return _0x3b17e0;}}})['then'](function(_0x512bcf){_0x37fe66[_0xdbdf('0x9b')]=_0x512bcf[_0xdbdf('0x3a')]({'plain':!![]});_0x37fe66[_0xdbdf('0x9b')]['created']=_0x1e19d7;if(_0x37fe66[_0xdbdf('0x9b')][_0xdbdf('0x9c')]){if(_0x37fe66[_0xdbdf('0x8e')][_0xdbdf('0x9d')]){_0x37fe66['applications'][_0xdbdf('0x9e')]({'id':0x0,'priority':_0x37fe66['applications'][_0xdbdf('0x5d')]+0x1,'app':_0xdbdf('0x9f'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0xdbdf('0x5e')]({'body':_0x24f073[_0xdbdf('0x64')][_0xdbdf('0x64')],'OpenchannelAccountId':_0x24f073[_0xdbdf('0x66')]['id'],'OpenchannelInteractionId':_0x512bcf['id'],'direction':'in','ContactId':_0x37fe66[_0xdbdf('0x92')]['id'],'AttachmentId':_0x24f073[_0xdbdf('0x64')]['AttachmentId']});})[_0xdbdf('0x22')](function(_0x41c93a){_0x37fe66['message']=_0x41c93a;if(_0x37fe66[_0xdbdf('0x9b')][_0xdbdf('0xa0')]){return db[_0xdbdf('0xa1')][_0xdbdf('0x65')]({'attributes':['id',_0xdbdf('0x3f')],'where':{'id':_0x37fe66['interaction'][_0xdbdf('0xa0')]}})[_0xdbdf('0x22')](function(_0x34edb4){if(_0x34edb4){_0x37fe66[_0xdbdf('0x89')][_0xdbdf('0xa2')]({'id':0x0,'priority':0x0,'app':_0xdbdf('0xa3'),'appdata':_0x34edb4[_0xdbdf('0x3f')]+','+(_0x37fe66[_0xdbdf('0x8e')][_0xdbdf('0xa4')]||0xa),'interval':_0xdbdf('0xa5')});_0x37fe66[_0xdbdf('0xa6')]=![];}return respondWithRpcPromise(_0xdbdf('0xa7'),'startRouting',_0x37fe66);});}return respondWithRpcPromise(_0xdbdf('0xa7'),_0xdbdf('0xa8'),_0x37fe66);})['then'](function(_0xcefbef){respondWithRpcPromise(_0xdbdf('0xa9'),_0xdbdf('0xa9'),{'event':_0xdbdf('0x74'),'message':_0xcefbef},client9002);return _0xcefbef;})[_0xdbdf('0x22')](respondWithResult(_0x5a9774,null))[_0xdbdf('0x2d')](handleError(_0x5a9774,null));};exports[_0xdbdf('0xaa')]=function(_0x315ea1,_0x2ce69){var _0x38f882=_0x315ea1[_0xdbdf('0x66')]['id'];var _0x6fc9ce=_0x315ea1[_0xdbdf('0x64')];var _0x4ac922=0xc8;var _0x1934b8=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xdbdf('0xab')][_0xdbdf('0xac')][_0xdbdf('0xad')]['READ_COMMITTED']},function(_0x67f157){return db[_0xdbdf('0x44')]['findOne']({'where':{'id':_0x38f882},'transaction':_0x67f157})[_0xdbdf('0x22')](function(_0x4d4a57){if(_0x4d4a57){return db['OpenchannelApplication'][_0xdbdf('0x3d')]({'where':{'OpenchannelAccountId':_0x38f882},'transaction':_0x67f157})[_0xdbdf('0x22')](function(){var _0x2defee=_[_0xdbdf('0x43')](_0x6fc9ce,function(_0x2208cb){_0x2208cb[_0xdbdf('0x69')]=_0x38f882;return _0x2208cb;});return db['OpenchannelApplication'][_0xdbdf('0xae')](_0x2defee,{'transaction':_0x67f157});});}else{_0x4ac922=0x194;_0x1934b8=[];}});})[_0xdbdf('0x22')](function(){if(_0x4ac922!==0x194){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x38f882},'order':_0xdbdf('0x8c')})[_0xdbdf('0x22')](function(_0x52f150){_0x1934b8=_0x52f150;});}})[_0xdbdf('0x2d')](function(_0x551bb8){_0x4ac922=0x1f4;logger[_0xdbdf('0x29')](_0x551bb8[_0xdbdf('0x3e')]);if(_0x551bb8[_0xdbdf('0x3f')]){delete _0x551bb8[_0xdbdf('0x3f')];}_0x1934b8=_0x551bb8;})[_0xdbdf('0xaf')](function(){if(_0x1934b8===null){_0x2ce69[_0xdbdf('0x2e')](_0x4ac922);}else{if(_0x4ac922===0x1f4){_0x2ce69[_0xdbdf('0x2f')](_0x4ac922)[_0xdbdf('0x40')](_0x1934b8);}else{_0x2ce69[_0xdbdf('0x2f')](_0x4ac922)[_0xdbdf('0x31')](_0x1934b8);}}});};exports[_0xdbdf('0xb0')]=function(_0x1dac25,_0x412c34,_0x43c411){var _0x55b15a={};var _0x488a8b={};var _0x3c34b1;var _0x19f636;return db['OpenchannelAccount'][_0xdbdf('0x72')]({'where':{'id':_0x1dac25[_0xdbdf('0x66')]['id']}})[_0xdbdf('0x22')](handleEntityNotFound(_0x412c34,null))[_0xdbdf('0x22')](function(_0x246790){if(_0x246790){_0x3c34b1=_0x246790;_0x488a8b[_0xdbdf('0x4b')]=_['keys'](db[_0xdbdf('0x87')][_0xdbdf('0x45')]);_0x488a8b['query']=_[_0xdbdf('0x49')](_0x1dac25[_0xdbdf('0x48')]);_0x488a8b[_0xdbdf('0x4a')]=_[_0xdbdf('0x4d')](_0x488a8b[_0xdbdf('0x4b')],_0x488a8b[_0xdbdf('0x48')]);_0x55b15a[_0xdbdf('0x4c')]=_['intersection'](_0x488a8b['model'],qs[_0xdbdf('0x4e')](_0x1dac25[_0xdbdf('0x48')][_0xdbdf('0x4e')]));_0x55b15a[_0xdbdf('0x4c')]=_0x55b15a[_0xdbdf('0x4c')][_0xdbdf('0x5d')]?_0x55b15a[_0xdbdf('0x4c')]:_0x488a8b[_0xdbdf('0x4b')];_0x55b15a[_0xdbdf('0x50')]=qs['sort'](_0x1dac25[_0xdbdf('0x48')][_0xdbdf('0x51')]);_0x55b15a[_0xdbdf('0x53')]=qs['filters'](_[_0xdbdf('0x52')](_0x1dac25['query'],_0x488a8b[_0xdbdf('0x4a')]));if(_0x1dac25['query'][_0xdbdf('0x56')]){_0x55b15a['where']=_[_0xdbdf('0x54')](_0x55b15a[_0xdbdf('0x53')],{'$or':_[_0xdbdf('0x43')](_0x55b15a[_0xdbdf('0x4c')],function(_0x19f3c1){var _0xcdcc97={};_0xcdcc97[_0x19f3c1]={'$like':'%'+_0x1dac25[_0xdbdf('0x48')][_0xdbdf('0x56')]+'%'};return _0xcdcc97;})});}_0x55b15a=_['merge']({},_0x55b15a,_0x1dac25[_0xdbdf('0x57')]);return _0x3c34b1[_0xdbdf('0xb0')](_0x55b15a);}})['then'](function(_0x403614){if(_0x403614){_0x19f636=_0x403614[_0xdbdf('0x5d')];if(!_0x1dac25['query'][_0xdbdf('0x6b')](_0xdbdf('0x4f'))){_0x55b15a[_0xdbdf('0x34')]=qs['limit'](_0x1dac25[_0xdbdf('0x48')][_0xdbdf('0x34')]);_0x55b15a[_0xdbdf('0x32')]=qs[_0xdbdf('0x32')](_0x1dac25['query']['offset']);}return _0x3c34b1[_0xdbdf('0xb0')](_0x55b15a);}})[_0xdbdf('0x22')](function(_0x195844){if(_0x195844){return _0x195844?{'count':_0x19f636,'rows':_0x195844}:null;}})[_0xdbdf('0x22')](respondWithResult(_0x412c34,null))['catch'](handleError(_0x412c34,null));};exports['getInteractions']=function(_0x3398d5,_0x5f41d0,_0x29b80d){var _0x3e1d8e={'raw':![],'where':{}};var _0x76edda={};var _0x7f7769={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xdbdf('0x72')]({'where':{'id':_0x3398d5[_0xdbdf('0x66')]['id']}})[_0xdbdf('0x22')](handleEntityNotFound(_0x5f41d0,null))[_0xdbdf('0x22')](function(_0x5cca72){if(_0x5cca72){_0x76edda[_0xdbdf('0x4b')]=_[_0xdbdf('0x49')](db['OpenchannelInteraction'][_0xdbdf('0x45')]);_0x76edda[_0xdbdf('0x48')]=_[_0xdbdf('0x49')](_0x3398d5[_0xdbdf('0x48')]);_0x76edda['filters']=_['intersection'](_0x76edda[_0xdbdf('0x4b')],_0x76edda[_0xdbdf('0x48')]);_0x3e1d8e[_0xdbdf('0x4c')]=_['intersection'](_0x76edda['model'],qs['fields'](_0x3398d5[_0xdbdf('0x48')][_0xdbdf('0x4e')]));_0x3e1d8e['attributes']=_0x3e1d8e[_0xdbdf('0x4c')][_0xdbdf('0x5d')]?_0x3e1d8e[_0xdbdf('0x4c')]:_0x76edda[_0xdbdf('0x4b')];if(!_0x3398d5['query'][_0xdbdf('0x6b')](_0xdbdf('0x4f'))){_0x3e1d8e['limit']=qs['limit'](_0x3398d5['query']['limit']);_0x3e1d8e['offset']=qs[_0xdbdf('0x32')](_0x3398d5['query'][_0xdbdf('0x32')]);}_0x3e1d8e[_0xdbdf('0x50')]=qs['sort'](_0x3398d5['query'][_0xdbdf('0x51')]);_0x3e1d8e[_0xdbdf('0x53')]=qs['filters'](_[_0xdbdf('0x52')](_0x3398d5[_0xdbdf('0x48')],_0x76edda['filters']));_0x3e1d8e[_0xdbdf('0x53')][_0xdbdf('0x69')]=_0x5cca72['id'];if(_0x3398d5['query'][_0xdbdf('0x56')]){_0x3e1d8e[_0xdbdf('0x53')]=_['merge'](_0x3e1d8e[_0xdbdf('0x53')],{'$or':_[_0xdbdf('0x43')](_0x3e1d8e[_0xdbdf('0x4c')],function(_0x593fdb){var _0x45f872={};_0x45f872[_0x593fdb]={'$like':'%'+_0x3398d5[_0xdbdf('0x48')][_0xdbdf('0x56')]+'%'};return _0x45f872;})});}_0x3e1d8e=_[_0xdbdf('0x54')]({},_0x3e1d8e,_0x3398d5[_0xdbdf('0x57')]);return db[_0xdbdf('0x96')][_0xdbdf('0x35')]({'where':_0x3e1d8e[_0xdbdf('0x53')]})[_0xdbdf('0x22')](function(_0x5e67eb){_0x7f7769['count']=_0x5e67eb;if(_0x3398d5[_0xdbdf('0x48')][_0xdbdf('0x58')]){_0x3e1d8e['include']=[{'model':db['CmContact'],'as':_0xdbdf('0xb1'),'required':![]},{'model':db[_0xdbdf('0xa1')],'as':_0xdbdf('0xb2'),'attributes':[_0xdbdf('0x3f'),'fullname',_0xdbdf('0xb3')],'required':![]},{'model':db[_0xdbdf('0xb4')],'as':'Tags','attributes':['id',_0xdbdf('0x3f'),_0xdbdf('0xb5')],'where':_0x3398d5[_0xdbdf('0x48')]['tag']?{'id':_0x3398d5[_0xdbdf('0x48')][_0xdbdf('0xb6')]}:undefined,'required':_0x3398d5[_0xdbdf('0x48')]['tag']?!![]:![]}];}return db[_0xdbdf('0x96')][_0xdbdf('0x5a')](_0x3e1d8e);})[_0xdbdf('0x22')](function(_0x348147){_0x7f7769[_0xdbdf('0x6c')]=_0x348147;return _0x7f7769;});}})['then'](respondWithFilteredResult(_0x5f41d0,_0x3e1d8e))['catch'](handleError(_0x5f41d0,null));};exports[_0xdbdf('0xb7')]=function(_0x595249,_0x36634b,_0x3f9d67){return db[_0xdbdf('0x44')][_0xdbdf('0x65')]({'where':{'id':_0x595249[_0xdbdf('0x66')]['id']}})['then'](handleEntityNotFound(_0x36634b,null))[_0xdbdf('0x22')](function(_0x451602){if(_0x451602){return _0x451602[_0xdbdf('0xb7')](_0x595249[_0xdbdf('0x64')][_0xdbdf('0x6e')],_[_0xdbdf('0xb8')](_0x595249[_0xdbdf('0x64')],[_0xdbdf('0x6e'),'id'])||{})[_0xdbdf('0xb9')](function(_0x3fefc6){for(var _0xed4a97=0x0;_0xed4a97<_0x595249[_0xdbdf('0x64')][_0xdbdf('0x6e')][_0xdbdf('0x5d')];_0xed4a97+=0x1){socket[_0xdbdf('0xba')](_0xdbdf('0xbb'),{'UserId':Number(_0x595249['body'][_0xdbdf('0x6e')][_0xed4a97]),'OpenchannelAccountId':Number(_0x595249[_0xdbdf('0x66')]['id'])});}return _0x3fefc6;});}})['then'](respondWithResult(_0x36634b,null))[_0xdbdf('0x2d')](handleError(_0x36634b,null));};exports[_0xdbdf('0xbc')]=function(_0xf45a8f,_0x1d021e,_0x485d8b){return db[_0xdbdf('0x44')]['find']({'where':{'id':_0xf45a8f[_0xdbdf('0x66')]['id']}})[_0xdbdf('0x22')](handleEntityNotFound(_0x1d021e,null))[_0xdbdf('0x22')](function(_0x53f690){if(_0x53f690){return _0x53f690[_0xdbdf('0xbc')](_0xf45a8f[_0xdbdf('0x48')][_0xdbdf('0x6e')])[_0xdbdf('0x22')](function(){if(_[_0xdbdf('0xbd')](_0xf45a8f[_0xdbdf('0x48')][_0xdbdf('0x6e')])){for(var _0x165e97=0x0;_0x165e97<_0xf45a8f['query'][_0xdbdf('0x6e')][_0xdbdf('0x5d')];_0x165e97+=0x1){socket[_0xdbdf('0xba')](_0xdbdf('0xbe'),{'UserId':Number(_0xf45a8f['query'][_0xdbdf('0x6e')][_0x165e97]),'OpenchannelAccountId':Number(_0xf45a8f[_0xdbdf('0x66')]['id'])});}}else{socket[_0xdbdf('0xba')](_0xdbdf('0xbe'),{'UserId':Number(_0xf45a8f[_0xdbdf('0x48')]['ids']),'OpenchannelAccountId':Number(_0xf45a8f['params']['id'])});}});}})[_0xdbdf('0x22')](respondWithStatusCode(_0x1d021e,null))[_0xdbdf('0x2d')](handleError(_0x1d021e,null));};exports[_0xdbdf('0xbf')]=function(_0x175ffb,_0x1211f5,_0x57f1c7){var _0x4c8004={};var _0xfb11a5={};var _0x55c469;var _0x3f6f8b;return db[_0xdbdf('0x44')][_0xdbdf('0x72')]({'where':{'id':_0x175ffb[_0xdbdf('0x66')]['id']}})[_0xdbdf('0x22')](handleEntityNotFound(_0x1211f5,null))[_0xdbdf('0x22')](function(_0x1b180f){if(_0x1b180f){_0x55c469=_0x1b180f;_0xfb11a5[_0xdbdf('0x4b')]=_[_0xdbdf('0x49')](db[_0xdbdf('0xa1')][_0xdbdf('0x45')]);_0xfb11a5[_0xdbdf('0x48')]=_[_0xdbdf('0x49')](_0x175ffb[_0xdbdf('0x48')]);_0xfb11a5[_0xdbdf('0x4a')]=_['intersection'](_0xfb11a5[_0xdbdf('0x4b')],_0xfb11a5[_0xdbdf('0x48')]);_0x4c8004[_0xdbdf('0x4c')]=_[_0xdbdf('0x4d')](_0xfb11a5[_0xdbdf('0x4b')],qs[_0xdbdf('0x4e')](_0x175ffb[_0xdbdf('0x48')][_0xdbdf('0x4e')]));_0x4c8004[_0xdbdf('0x4c')]=_0x4c8004[_0xdbdf('0x4c')][_0xdbdf('0x5d')]?_0x4c8004[_0xdbdf('0x4c')]:_0xfb11a5[_0xdbdf('0x4b')];_0x4c8004[_0xdbdf('0x50')]=qs[_0xdbdf('0x51')](_0x175ffb[_0xdbdf('0x48')][_0xdbdf('0x51')]);_0x4c8004[_0xdbdf('0x53')]=qs['filters'](_[_0xdbdf('0x52')](_0x175ffb[_0xdbdf('0x48')],_0xfb11a5[_0xdbdf('0x4a')]));if(_0x175ffb['query'][_0xdbdf('0x56')]){_0x4c8004[_0xdbdf('0x53')]=_['merge'](_0x4c8004[_0xdbdf('0x53')],{'$or':_['map'](_0x4c8004[_0xdbdf('0x4c')],function(_0xea7a32){var _0x4725d7={};_0x4725d7[_0xea7a32]={'$like':'%'+_0x175ffb['query'][_0xdbdf('0x56')]+'%'};return _0x4725d7;})});}_0x4c8004=_['merge']({},_0x4c8004,_0x175ffb[_0xdbdf('0x57')]);return _0x55c469['getAgents'](_0x4c8004);}})[_0xdbdf('0x22')](function(_0x47c9a4){if(_0x47c9a4){_0x3f6f8b=_0x47c9a4[_0xdbdf('0x5d')];if(!_0x175ffb['query']['hasOwnProperty'](_0xdbdf('0x4f'))){_0x4c8004[_0xdbdf('0x34')]=qs[_0xdbdf('0x34')](_0x175ffb[_0xdbdf('0x48')][_0xdbdf('0x34')]);_0x4c8004[_0xdbdf('0x32')]=qs[_0xdbdf('0x32')](_0x175ffb[_0xdbdf('0x48')][_0xdbdf('0x32')]);}return _0x55c469['getAgents'](_0x4c8004);}})[_0xdbdf('0x22')](function(_0x549412){if(_0x549412){return _0x549412?{'count':_0x3f6f8b,'rows':_0x549412}:null;}})[_0xdbdf('0x22')](respondWithResult(_0x1211f5,null))[_0xdbdf('0x2d')](handleError(_0x1211f5,null));};exports['send']=function(_0x338b90,_0x915b0c,_0x27cf47){var _0x5c3948,_0x10e6ee,_0xeb3701;if(_[_0xdbdf('0x7d')](_0x338b90['body'][_0xdbdf('0x64')])||_0x338b90['body'][_0xdbdf('0x64')]===''){throw new db[(_0xdbdf('0x76'))][(_0xdbdf('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xdbdf('0x7d')](_0x338b90['body']['to'])){}_0x5c3948=_0x338b90[_0xdbdf('0x64')]['to'];return db['OpenchannelAccount'][_0xdbdf('0x72')]({'where':{'id':_0x338b90[_0xdbdf('0x66')]['id']}})['then'](handleEntityNotFound(_0x915b0c,null))[_0xdbdf('0x22')](function(_0x42a64d){if(_0x42a64d){return db[_0xdbdf('0x44')][_0xdbdf('0x65')]({'where':{'id':_0x42a64d['id']},'include':[{'model':db[_0xdbdf('0x83')],'as':_0xdbdf('0x84'),'include':[{'model':db[_0xdbdf('0x91')],'as':_0xdbdf('0x85'),'where':{[_0x42a64d[_0xdbdf('0x80')]]:_0x5c3948},'limit':0x1,'order':[[_0xdbdf('0x7a'),'DESC']]}]}]})[_0xdbdf('0x22')](handleEntityNotFound(_0x915b0c,null))[_0xdbdf('0x22')](function(_0x5e7bce){if(_0x5e7bce&&_0x5e7bce['List']){_0x10e6ee=_0x5e7bce['get']({'plain':!![]});if(_0x10e6ee[_0xdbdf('0x84')]&&_0x10e6ee[_0xdbdf('0x84')][_0xdbdf('0x85')][_0xdbdf('0x5d')]){return _0x10e6ee[_0xdbdf('0x84')][_0xdbdf('0x85')][0x0];}return db[_0xdbdf('0x91')][_0xdbdf('0x5e')](_['defaults'](_0x338b90[_0xdbdf('0x64')],{'firstName':_0x5c3948,[_0x5e7bce[_0xdbdf('0x80')]]:_0x5c3948,'phone':_0x5c3948,'ListId':_0x10e6ee[_0xdbdf('0x7c')]}));}})['then'](handleEntityNotFound(_0x915b0c,null))['then'](function(_0x1b7b2d){if(_0x1b7b2d){_0xeb3701=_0x1b7b2d;return db[_0xdbdf('0x96')][_0xdbdf('0x65')]({'where':{'ContactId':_0xeb3701['id'],'closed':![],'OpenchannelAccountId':_0x10e6ee['id']}})[_0xdbdf('0x22')](function(_0x30a8fc){if(_0x30a8fc){return[_0x30a8fc,![]];}return db[_0xdbdf('0x96')]['create']({'UserId':_0x338b90['user']['id'],'ContactId':_0xeb3701['id'],'OpenchannelAccountId':_0x10e6ee['id'],'lastMsgDirection':_0xdbdf('0xc0'),'firstMsgDirection':_0xdbdf('0xc0'),'Messages':[_[_0xdbdf('0x54')](_0x338b90[_0xdbdf('0x64')],{'read':![],'body':_0x338b90[_0xdbdf('0x64')][_0xdbdf('0x64')],'OpenchannelAccountId':_0x10e6ee['id'],'UserId':_0x338b90[_0xdbdf('0x60')]['id'],'ContactId':_0xeb3701['id']})]},{'include':[{'model':db[_0xdbdf('0xc1')],'as':_0xdbdf('0xc2')}]})['then'](function(_0x2d5874){return[_0x2d5874,!![]];});});}})[_0xdbdf('0xb9')](function(_0x299359,_0x2f6da0){if(_0x2f6da0){return _0x299359;}return db[_0xdbdf('0xc1')][_0xdbdf('0x5e')](_[_0xdbdf('0x54')](_0x338b90[_0xdbdf('0x64')],{'read':![],'body':_0x338b90[_0xdbdf('0x64')][_0xdbdf('0x64')],'OpenchannelAccountId':_0x10e6ee['id'],'OpenchannelInteractionId':_0x299359['id'],'UserId':_0x338b90[_0xdbdf('0x60')]['id'],'ContactId':_0xeb3701['id']}))[_0xdbdf('0x22')](function(_0x360784){_0x299359['dataValues']['Messages']=[];_0x299359[_0xdbdf('0xc3')][_0xdbdf('0xc2')]['push'](_0x360784[_0xdbdf('0xc3')]);return _0x299359;});});}})[_0xdbdf('0x22')](respondWithResult(_0x915b0c,null))[_0xdbdf('0x2d')](handleError(_0x915b0c,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index e0ad888..c4a9be0 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 _0x91a7=['../../mysqldb','OpenchannelAccount','setMaxListeners','update','emit','hasOwnProperty','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x91a7,0xe7));var _0x791a=function(_0x4d9097,_0x115525){_0x4d9097=_0x4d9097-0x0;var _0x567610=_0x91a7[_0x4d9097];return _0x567610;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x791a('0x0'))['db'][_0x791a('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x791a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x791a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2f6392){return function(_0x535640,_0x50ab29,_0x32fe2b){OpenchannelAccountEvents[_0x791a('0x4')](_0x2f6392+':'+_0x535640['id'],_0x535640);OpenchannelAccountEvents['emit'](_0x2f6392,_0x535640);_0x32fe2b(null);};}for(var e in events){if(events[_0x791a('0x5')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x791a('0x6')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x96cc=['remove','emit','hook','exports','events','OpenchannelAccount','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x96cc,0x16c));var _0xc96c=function(_0x339b2f,_0xf4081c){_0x339b2f=_0x339b2f-0x0;var _0x203fa2=_0x96cc[_0x339b2f];return _0x203fa2;};'use strict';var EventEmitter=require(_0xc96c('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xc96c('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc96c('0x2'),'afterUpdate':_0xc96c('0x3'),'afterDestroy':_0xc96c('0x4')};function emitEvent(_0x421701){return function(_0x71140d,_0x29b6f1,_0x377e6c){OpenchannelAccountEvents[_0xc96c('0x5')](_0x421701+':'+_0x71140d['id'],_0x71140d);OpenchannelAccountEvents[_0xc96c('0x5')](_0x421701,_0x71140d);_0x377e6c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xc96c('0x6')](e,emitEvent(event));}}module[_0xc96c('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 7065aad..082ad1b 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(_0x213771,_0x11d7c9){var _0x5b9e5f=function(_0x200da4){while(--_0x200da4){_0x213771['push'](_0x213771['shift']());}};_0x5b9e5f(++_0x11d7c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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(_0x1ffd66,_0x4471fe){var _0x315dce=function(_0x48ab10){while(--_0x48ab10){_0x1ffd66['push'](_0x1ffd66['shift']());}};_0x315dce(++_0x4471fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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 4cdaabc..a66fff6 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 _0xdc9b=['register','request','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/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./openchannelAccount.socket'];(function(_0x59fc54,_0x530249){var _0x386c9e=function(_0x580a6e){while(--_0x580a6e){_0x59fc54['push'](_0x59fc54['shift']());}};_0x386c9e(++_0x530249);}(_0xdc9b,0x70));var _0xbdc9=function(_0x23cd70,_0x1850d8){_0x23cd70=_0x23cd70-0x0;var _0x4de5e8=_0xdc9b[_0x23cd70];return _0x4de5e8;};'use strict';var _=require(_0xbdc9('0x0'));var util=require(_0xbdc9('0x1'));var moment=require(_0xbdc9('0x2'));var BPromise=require('bluebird');var rs=require(_0xbdc9('0x3'));var fs=require('fs');var Redis=require(_0xbdc9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbdc9('0x5'))(_0xbdc9('0x6'));var config=require('../../config/environment');var jayson=require(_0xbdc9('0x7'));var client=jayson[_0xbdc9('0x8')]['http']({'port':0x232a});config[_0xbdc9('0x9')]=_['defaults'](config[_0xbdc9('0x9')],{'host':_0xbdc9('0xa'),'port':0x18eb});var socket=require(_0xbdc9('0xb'))(new Redis(config[_0xbdc9('0x9')]));require(_0xbdc9('0xc'))[_0xbdc9('0xd')](socket);function respondWithRpcPromise(_0x7e6df8,_0x2d1c34,_0x1a6e8f){return new BPromise(function(_0x289f6e,_0x3e58f4){return client[_0xbdc9('0xe')](_0x7e6df8,_0x1a6e8f)[_0xbdc9('0xf')](function(_0xb5a15b){logger[_0xbdc9('0x10')](_0xbdc9('0x11'),_0x2d1c34,_0xbdc9('0x12'));logger[_0xbdc9('0x13')](_0xbdc9('0x14'),_0x2d1c34,_0xbdc9('0x12'),JSON[_0xbdc9('0x15')](_0xb5a15b));if(_0xb5a15b['error']){if(_0xb5a15b[_0xbdc9('0x16')]['code']===0x1f4){logger['error'](_0xbdc9('0x11'),_0x2d1c34,_0xb5a15b[_0xbdc9('0x16')]['message']);return _0x3e58f4(_0xb5a15b[_0xbdc9('0x16')][_0xbdc9('0x17')]);}logger[_0xbdc9('0x16')](_0xbdc9('0x11'),_0x2d1c34,_0xb5a15b[_0xbdc9('0x16')][_0xbdc9('0x17')]);return _0x289f6e(_0xb5a15b['error']['message']);}else{logger[_0xbdc9('0x10')](_0xbdc9('0x11'),_0x2d1c34,_0xbdc9('0x12'));_0x289f6e(_0xb5a15b['result']['message']);}})[_0xbdc9('0x18')](function(_0x2aad7b){logger['error'](_0xbdc9('0x11'),_0x2d1c34,_0x2aad7b);_0x3e58f4(_0x2aad7b);});});} \ No newline at end of file +var _0x065e=['socket.io-emitter','./openchannelAccount.socket','register','request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis'];(function(_0xac0de1,_0x12d3d9){var _0x1c1995=function(_0x3f96e8){while(--_0x3f96e8){_0xac0de1['push'](_0xac0de1['shift']());}};_0x1c1995(++_0x12d3d9);}(_0x065e,0x1a7));var _0xe065=function(_0x1eab98,_0x5148a1){_0x1eab98=_0x1eab98-0x0;var _0x25816d=_0x065e[_0x1eab98];return _0x25816d;};'use strict';var _=require(_0xe065('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe065('0x1'));var fs=require('fs');var Redis=require(_0xe065('0x2'));var db=require(_0xe065('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe065('0x4'));var config=require(_0xe065('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe065('0x6')][_0xe065('0x7')]({'port':0x232a});config[_0xe065('0x8')]=_['defaults'](config[_0xe065('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xe065('0x9'))(new Redis(config[_0xe065('0x8')]));require(_0xe065('0xa'))[_0xe065('0xb')](socket);function respondWithRpcPromise(_0x85001e,_0x531ebd,_0x43827c){return new BPromise(function(_0x6c9117,_0x3f59d3){return client[_0xe065('0xc')](_0x85001e,_0x43827c)[_0xe065('0xd')](function(_0x2a6a6e){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x531ebd,_0xe065('0xe'));logger[_0xe065('0xf')](_0xe065('0x10'),_0x531ebd,'request\x20sent',JSON[_0xe065('0x11')](_0x2a6a6e));if(_0x2a6a6e[_0xe065('0x12')]){if(_0x2a6a6e[_0xe065('0x12')][_0xe065('0x13')]===0x1f4){logger[_0xe065('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x531ebd,_0x2a6a6e[_0xe065('0x12')][_0xe065('0x14')]);return _0x3f59d3(_0x2a6a6e[_0xe065('0x12')][_0xe065('0x14')]);}logger[_0xe065('0x12')](_0xe065('0x15'),_0x531ebd,_0x2a6a6e[_0xe065('0x12')]['message']);return _0x6c9117(_0x2a6a6e[_0xe065('0x12')][_0xe065('0x14')]);}else{logger['info'](_0xe065('0x15'),_0x531ebd,_0xe065('0xe'));_0x6c9117(_0x2a6a6e[_0xe065('0x16')][_0xe065('0x14')]);}})[_0xe065('0x17')](function(_0x302adf){logger[_0xe065('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x531ebd,_0x302adf);_0x3f59d3(_0x302adf);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 6e257f9..47160aa 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 _0x5d31=['save','remove','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x5400c9,_0x2a6a51){var _0x3e187d=function(_0x31916c){while(--_0x31916c){_0x5400c9['push'](_0x5400c9['shift']());}};_0x3e187d(++_0x2a6a51);}(_0x5d31,0xb7));var _0x15d3=function(_0xddfe05,_0x57b987){_0xddfe05=_0xddfe05-0x0;var _0x42b95e=_0x5d31[_0xddfe05];return _0x42b95e;};'use strict';var OpenchannelAccountEvents=require(_0x15d3('0x0'));var events=[_0x15d3('0x1'),_0x15d3('0x2'),'update'];function createListener(_0x3aaddc,_0x3a3511){return function(_0x4eecbd){_0x3a3511[_0x15d3('0x3')](_0x3aaddc,_0x4eecbd);};}function removeListener(_0x526c77,_0x4f54e9){return function(){OpenchannelAccountEvents[_0x15d3('0x4')](_0x526c77,_0x4f54e9);};}exports[_0x15d3('0x5')]=function(_0x4177c1){for(var _0x378cb7=0x0,_0x1f7128=events[_0x15d3('0x6')];_0x378cb7<_0x1f7128;_0x378cb7++){var _0x5ab85a=events[_0x378cb7];var _0x169a5e=createListener(_0x15d3('0x7')+_0x5ab85a,_0x4177c1);OpenchannelAccountEvents['on'](_0x5ab85a,_0x169a5e);}}; \ No newline at end of file +var _0x938c=['./openchannelAccount.events','save','update','removeListener','register','length','openchannelAccount:'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x938c,0x11f));var _0xc938=function(_0x37fa79,_0xf495ba){_0x37fa79=_0x37fa79-0x0;var _0x1edf52=_0x938c[_0x37fa79];return _0x1edf52;};'use strict';var OpenchannelAccountEvents=require(_0xc938('0x0'));var events=[_0xc938('0x1'),'remove',_0xc938('0x2')];function createListener(_0x5cd37a,_0x502809){return function(_0x257b7c){_0x502809['emit'](_0x5cd37a,_0x257b7c);};}function removeListener(_0x15a960,_0xa06f0c){return function(){OpenchannelAccountEvents[_0xc938('0x3')](_0x15a960,_0xa06f0c);};}exports[_0xc938('0x4')]=function(_0x235110){for(var _0x8cfbb6=0x0,_0x5c08fe=events[_0xc938('0x5')];_0x8cfbb6<_0x5c08fe;_0x8cfbb6++){var _0x6e8871=events[_0x8cfbb6];var _0x52fbb1=createListener(_0xc938('0x6')+_0x6e8871,_0x235110);OpenchannelAccountEvents['on'](_0x6e8871,_0x52fbb1);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index dd32e7a..75ebc98 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 _0xfdf0=['put','/:id','update','exports','Router','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','isAuthenticated','show','post','create'];(function(_0x4f0e11,_0x1840c1){var _0x9cfbbf=function(_0x43bebc){while(--_0x43bebc){_0x4f0e11['push'](_0x4f0e11['shift']());}};_0x9cfbbf(++_0x1840c1);}(_0xfdf0,0x1a8));var _0x0fdf=function(_0x349a9e,_0x473cb8){_0x349a9e=_0x349a9e-0x0;var _0x24c207=_0xfdf0[_0x349a9e];return _0x24c207;};'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[_0x0fdf('0x0')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0fdf('0x1'));var config=require(_0x0fdf('0x2'));var controller=require(_0x0fdf('0x3'));router[_0x0fdf('0x4')]('/',auth['isAuthenticated'](),controller[_0x0fdf('0x5')]);router[_0x0fdf('0x4')]('/:id',auth[_0x0fdf('0x6')](),controller[_0x0fdf('0x7')]);router[_0x0fdf('0x8')]('/',auth[_0x0fdf('0x6')](),controller[_0x0fdf('0x9')]);router[_0x0fdf('0xa')](_0x0fdf('0xb'),auth[_0x0fdf('0x6')](),controller[_0x0fdf('0xc')]);router['delete'](_0x0fdf('0xb'),auth[_0x0fdf('0x6')](),controller['destroy']);module[_0x0fdf('0xd')]=router; \ No newline at end of file +var _0x6e8b=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','exports','multer','path'];(function(_0x4da382,_0x4cfc5d){var _0x10073f=function(_0x32dc45){while(--_0x32dc45){_0x4da382['push'](_0x4da382['shift']());}};_0x10073f(++_0x4cfc5d);}(_0x6e8b,0x1e4));var _0xb6e8=function(_0x47d6dc,_0xc036cc){_0x47d6dc=_0x47d6dc-0x0;var _0x1a1c93=_0x6e8b[_0x47d6dc];return _0x1a1c93;};'use strict';var multer=require(_0xb6e8('0x0'));var util=require('util');var path=require(_0xb6e8('0x1'));var timeout=require(_0xb6e8('0x2'));var express=require(_0xb6e8('0x3'));var router=express[_0xb6e8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb6e8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb6e8('0x6'));var controller=require(_0xb6e8('0x7'));router[_0xb6e8('0x8')]('/',auth['isAuthenticated'](),controller[_0xb6e8('0x9')]);router[_0xb6e8('0x8')](_0xb6e8('0xa'),auth[_0xb6e8('0xb')](),controller[_0xb6e8('0xc')]);router[_0xb6e8('0xd')]('/',auth[_0xb6e8('0xb')](),controller[_0xb6e8('0xe')]);router[_0xb6e8('0xf')](_0xb6e8('0xa'),auth[_0xb6e8('0xb')](),controller['update']);router[_0xb6e8('0x10')](_0xb6e8('0xa'),auth[_0xb6e8('0xb')](),controller['destroy']);module[_0xb6e8('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 68c8d0b..323460a 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 _0x3e52=['*,*,*,*','sequelize','exports','INTEGER','noop','STRING'];(function(_0x47a198,_0x84a0f4){var _0x357260=function(_0x41ecdd){while(--_0x41ecdd){_0x47a198['push'](_0x47a198['shift']());}};_0x357260(++_0x84a0f4);}(_0x3e52,0xfd));var _0x23e5=function(_0x54655c,_0x2ecea5){_0x54655c=_0x54655c-0x0;var _0x5e503f=_0x3e52[_0x54655c];return _0x5e503f;};'use strict';var Sequelize=require(_0x23e5('0x0'));module[_0x23e5('0x1')]={'priority':{'type':Sequelize[_0x23e5('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x23e5('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x23e5('0x4')],'defaultValue':_0x23e5('0x5')}}; \ No newline at end of file +var _0x3eca=['*,*,*,*','exports','INTEGER','STRING','noop','TEXT'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x3eca,0x1a5));var _0xa3ec=function(_0x155c64,_0x26ff95){_0x155c64=_0x155c64-0x0;var _0x1f154a=_0x3eca[_0x155c64];return _0x1f154a;};'use strict';var Sequelize=require('sequelize');module[_0xa3ec('0x0')]={'priority':{'type':Sequelize[_0xa3ec('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xa3ec('0x2')],'allowNull':![],'defaultValue':_0xa3ec('0x3')},'appdata':{'type':Sequelize[_0xa3ec('0x4')]()},'description':{'type':Sequelize[_0xa3ec('0x2')]},'interval':{'type':Sequelize[_0xa3ec('0x2')],'defaultValue':_0xa3ec('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 738b109..2ab33e7 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 _0xcfbc=['create','body','update','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','save','then','destroy','end','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find'];(function(_0x5520b8,_0x929ea0){var _0x341b15=function(_0x255ac8){while(--_0x255ac8){_0x5520b8['push'](_0x5520b8['shift']());}};_0x341b15(++_0x929ea0);}(_0xcfbc,0xe7));var _0xccfb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcfbc[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xccfb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xccfb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xccfb('0x2'));var moment=require(_0xccfb('0x3'));var BPromise=require(_0xccfb('0x4'));var Mustache=require(_0xccfb('0x5'));var util=require(_0xccfb('0x6'));var path=require(_0xccfb('0x7'));var sox=require('sox');var csv=require(_0xccfb('0x8'));var ejs=require(_0xccfb('0x9'));var fs=require('fs');var fs_extra=require(_0xccfb('0xa'));var _=require(_0xccfb('0xb'));var squel=require(_0xccfb('0xc'));var crypto=require('crypto');var jsforce=require(_0xccfb('0xd'));var deskjs=require(_0xccfb('0xe'));var toCsv=require(_0xccfb('0x8'));var querystring=require(_0xccfb('0xf'));var Papa=require(_0xccfb('0x10'));var Redis=require('ioredis');var authService=require(_0xccfb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xccfb('0x12'));var hardwareService=require(_0xccfb('0x13'));var logger=require(_0xccfb('0x14'))('api');var utils=require(_0xccfb('0x15'));var config=require(_0xccfb('0x16'));var licenseUtil=require(_0xccfb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf4a3ea,_0x149fe6){_0x149fe6=_0x149fe6||0xcc;return function(_0x390697){if(_0x390697){return _0xf4a3ea[_0xccfb('0x18')](_0x149fe6);}return _0xf4a3ea[_0xccfb('0x19')](_0x149fe6)['end']();};}function respondWithResult(_0x55db42,_0x110d9a){_0x110d9a=_0x110d9a||0xc8;return function(_0x4e4234){if(_0x4e4234){return _0x55db42[_0xccfb('0x19')](_0x110d9a)['json'](_0x4e4234);}};}function respondWithFilteredResult(_0x312ff8,_0x4f71ca){return function(_0x4cc52f){if(_0x4cc52f){var _0x93f825=typeof _0x4f71ca[_0xccfb('0x1a')]==='undefined'&&typeof _0x4f71ca[_0xccfb('0x1b')]===_0xccfb('0x1c');var _0x553b85=_0x4cc52f[_0xccfb('0x1d')];var _0x55575e=_0x93f825?0x0:_0x4f71ca[_0xccfb('0x1a')];var _0x2fa073=_0x93f825?_0x4cc52f['count']:_0x4f71ca[_0xccfb('0x1a')]+_0x4f71ca[_0xccfb('0x1b')];var _0xf5fce5;if(_0x2fa073>=_0x553b85){_0x2fa073=_0x553b85;_0xf5fce5=0xc8;}else{_0xf5fce5=0xce;}_0x312ff8['status'](_0xf5fce5);return _0x312ff8[_0xccfb('0x1e')](_0xccfb('0x1f'),_0x55575e+'-'+_0x2fa073+'/'+_0x553b85)[_0xccfb('0x20')](_0x4cc52f);}return null;};}function patchUpdates(_0x21774c){return function(_0x51d986){try{jsonpatch[_0xccfb('0x21')](_0x51d986,_0x21774c,!![]);}catch(_0x1ed0ff){return BPromise['reject'](_0x1ed0ff);}return _0x51d986[_0xccfb('0x22')]();};}function saveUpdates(_0x81f569,_0x4081b4){return function(_0x538f5f){if(_0x538f5f){return _0x538f5f['update'](_0x81f569)[_0xccfb('0x23')](function(_0x3d9a0f){return _0x3d9a0f;});}return null;};}function removeEntity(_0x47fa8d,_0x10e040){return function(_0x313989){if(_0x313989){return _0x313989[_0xccfb('0x24')]()[_0xccfb('0x23')](function(){_0x47fa8d[_0xccfb('0x19')](0xcc)[_0xccfb('0x25')]();});}};}function handleEntityNotFound(_0x59bd71,_0x277f9e){return function(_0x1d6bf8){if(!_0x1d6bf8){_0x59bd71[_0xccfb('0x18')](0x194);}return _0x1d6bf8;};}function handleError(_0x289f63,_0x120bce){_0x120bce=_0x120bce||0x1f4;return function(_0x2b7454){logger[_0xccfb('0x26')](_0x2b7454[_0xccfb('0x27')]);if(_0x2b7454[_0xccfb('0x28')]){delete _0x2b7454[_0xccfb('0x28')];}_0x289f63[_0xccfb('0x19')](_0x120bce)[_0xccfb('0x29')](_0x2b7454);};}exports[_0xccfb('0x2a')]=function(_0x4f64fe,_0x484043){var _0x51771b={},_0x33b80b={},_0x35c269={'count':0x0,'rows':[]};var _0x4e283a=_[_0xccfb('0x2b')](db[_0xccfb('0x2c')][_0xccfb('0x2d')],function(_0x467b43){return{'name':_0x467b43[_0xccfb('0x2e')],'type':_0x467b43[_0xccfb('0x2f')][_0xccfb('0x30')]};});_0x33b80b[_0xccfb('0x31')]=_[_0xccfb('0x2b')](_0x4e283a,_0xccfb('0x28'));_0x33b80b[_0xccfb('0x32')]=_[_0xccfb('0x33')](_0x4f64fe[_0xccfb('0x32')]);_0x33b80b['filters']=_['intersection'](_0x33b80b[_0xccfb('0x31')],_0x33b80b[_0xccfb('0x32')]);_0x51771b[_0xccfb('0x34')]=_[_0xccfb('0x35')](_0x33b80b[_0xccfb('0x31')],qs[_0xccfb('0x36')](_0x4f64fe['query'][_0xccfb('0x36')]));_0x51771b[_0xccfb('0x34')]=_0x51771b[_0xccfb('0x34')][_0xccfb('0x37')]?_0x51771b['attributes']:_0x33b80b[_0xccfb('0x31')];if(!_0x4f64fe['query']['hasOwnProperty'](_0xccfb('0x38'))){_0x51771b['limit']=qs[_0xccfb('0x1b')](_0x4f64fe['query']['limit']);_0x51771b['offset']=qs[_0xccfb('0x1a')](_0x4f64fe['query'][_0xccfb('0x1a')]);}_0x51771b[_0xccfb('0x39')]=qs[_0xccfb('0x3a')](_0x4f64fe[_0xccfb('0x32')][_0xccfb('0x3a')]);_0x51771b[_0xccfb('0x3b')]=qs[_0xccfb('0x3c')](_['pick'](_0x4f64fe[_0xccfb('0x32')],_0x33b80b[_0xccfb('0x3c')]),_0x4e283a);if(_0x4f64fe['query'][_0xccfb('0x3d')]){_0x51771b['where']=_['merge'](_0x51771b[_0xccfb('0x3b')],{'$or':_[_0xccfb('0x2b')](_0x4e283a,function(_0x35bfc2){if(_0x35bfc2[_0xccfb('0x2f')]!==_0xccfb('0x3e')){var _0x7b22b2={};_0x7b22b2[_0x35bfc2[_0xccfb('0x28')]]={'$like':'%'+_0x4f64fe[_0xccfb('0x32')][_0xccfb('0x3d')]+'%'};return _0x7b22b2;}})});}_0x51771b=_[_0xccfb('0x3f')]({},_0x51771b,_0x4f64fe[_0xccfb('0x40')]);var _0x48e5ba={'where':_0x51771b[_0xccfb('0x3b')]};return db[_0xccfb('0x2c')][_0xccfb('0x1d')](_0x48e5ba)[_0xccfb('0x23')](function(_0x37f7ef){_0x35c269[_0xccfb('0x1d')]=_0x37f7ef;if(_0x4f64fe[_0xccfb('0x32')][_0xccfb('0x41')]){_0x51771b['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0xccfb('0x42')](_0x51771b);})[_0xccfb('0x23')](function(_0x4f8d64){_0x35c269[_0xccfb('0x43')]=_0x4f8d64;return _0x35c269;})[_0xccfb('0x23')](respondWithFilteredResult(_0x484043,_0x51771b))[_0xccfb('0x44')](handleError(_0x484043,null));};exports[_0xccfb('0x45')]=function(_0xef9439,_0x223b8b){var _0x256404={'raw':!![],'where':{'id':_0xef9439[_0xccfb('0x46')]['id']}},_0xc494d2={};_0xc494d2['model']=_[_0xccfb('0x33')](db[_0xccfb('0x2c')][_0xccfb('0x2d')]);_0xc494d2[_0xccfb('0x32')]=_[_0xccfb('0x33')](_0xef9439[_0xccfb('0x32')]);_0xc494d2[_0xccfb('0x3c')]=_[_0xccfb('0x35')](_0xc494d2[_0xccfb('0x31')],_0xc494d2[_0xccfb('0x32')]);_0x256404[_0xccfb('0x34')]=_['intersection'](_0xc494d2[_0xccfb('0x31')],qs[_0xccfb('0x36')](_0xef9439[_0xccfb('0x32')][_0xccfb('0x36')]));_0x256404['attributes']=_0x256404[_0xccfb('0x34')][_0xccfb('0x37')]?_0x256404[_0xccfb('0x34')]:_0xc494d2[_0xccfb('0x31')];if(_0xef9439[_0xccfb('0x32')][_0xccfb('0x41')]){_0x256404[_0xccfb('0x47')]=[{'all':!![]}];}_0x256404=_[_0xccfb('0x3f')]({},_0x256404,_0xef9439[_0xccfb('0x40')]);return db[_0xccfb('0x2c')][_0xccfb('0x48')](_0x256404)['then'](handleEntityNotFound(_0x223b8b,null))['then'](respondWithResult(_0x223b8b,null))[_0xccfb('0x44')](handleError(_0x223b8b,null));};exports[_0xccfb('0x49')]=function(_0x4b25e0,_0x3a164c){return db[_0xccfb('0x2c')][_0xccfb('0x49')](_0x4b25e0[_0xccfb('0x4a')],{})['then'](respondWithResult(_0x3a164c,0xc9))[_0xccfb('0x44')](handleError(_0x3a164c,null));};exports[_0xccfb('0x4b')]=function(_0x3f22d3,_0x53e637){if(_0x3f22d3[_0xccfb('0x4a')]['id']){delete _0x3f22d3['body']['id'];}return db[_0xccfb('0x2c')][_0xccfb('0x48')]({'where':{'id':_0x3f22d3[_0xccfb('0x46')]['id']}})[_0xccfb('0x23')](handleEntityNotFound(_0x53e637,null))[_0xccfb('0x23')](saveUpdates(_0x3f22d3['body'],null))[_0xccfb('0x23')](respondWithResult(_0x53e637,null))[_0xccfb('0x44')](handleError(_0x53e637,null));};exports[_0xccfb('0x24')]=function(_0x389325,_0x128288){return db['OpenchannelApplication'][_0xccfb('0x48')]({'where':{'id':_0x389325['params']['id']}})[_0xccfb('0x23')](handleEntityNotFound(_0x128288,null))[_0xccfb('0x23')](removeEntity(_0x128288,null))[_0xccfb('0x44')](handleError(_0x128288,null));}; \ No newline at end of file +var _0xccbe=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','OpenchannelApplication','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','merge','find','catch','create','body','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','squel'];(function(_0x2721e4,_0x32ccdb){var _0x4916e2=function(_0x48c716){while(--_0x48c716){_0x2721e4['push'](_0x2721e4['shift']());}};_0x4916e2(++_0x32ccdb);}(_0xccbe,0x10a));var _0xeccb=function(_0x36de10,_0xfe25e8){_0x36de10=_0x36de10-0x0;var _0x58100f=_0xccbe[_0x36de10];return _0x58100f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeccb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeccb('0x1'));var rp=require(_0xeccb('0x2'));var moment=require(_0xeccb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xeccb('0x4'));var util=require(_0xeccb('0x5'));var path=require('path');var sox=require(_0xeccb('0x6'));var csv=require('to-csv');var ejs=require(_0xeccb('0x7'));var fs=require('fs');var fs_extra=require(_0xeccb('0x8'));var _=require('lodash');var squel=require(_0xeccb('0x9'));var crypto=require(_0xeccb('0xa'));var jsforce=require(_0xeccb('0xb'));var deskjs=require(_0xeccb('0xc'));var toCsv=require(_0xeccb('0xd'));var querystring=require(_0xeccb('0xe'));var Papa=require(_0xeccb('0xf'));var Redis=require('ioredis');var authService=require(_0xeccb('0x10'));var qs=require(_0xeccb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeccb('0x12'));var logger=require(_0xeccb('0x13'))(_0xeccb('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x496318,_0x21df7e){_0x21df7e=_0x21df7e||0xcc;return function(_0x1a7c16){if(_0x1a7c16){return _0x496318[_0xeccb('0x15')](_0x21df7e);}return _0x496318[_0xeccb('0x16')](_0x21df7e)[_0xeccb('0x17')]();};}function respondWithResult(_0x52c001,_0x17f74a){_0x17f74a=_0x17f74a||0xc8;return function(_0xc7e074){if(_0xc7e074){return _0x52c001[_0xeccb('0x16')](_0x17f74a)[_0xeccb('0x18')](_0xc7e074);}};}function respondWithFilteredResult(_0x19167d,_0x3cf4d3){return function(_0x242e1e){if(_0x242e1e){var _0x2a9bc1=typeof _0x3cf4d3[_0xeccb('0x19')]===_0xeccb('0x1a')&&typeof _0x3cf4d3['limit']===_0xeccb('0x1a');var _0x7852a1=_0x242e1e[_0xeccb('0x1b')];var _0xfe10f7=_0x2a9bc1?0x0:_0x3cf4d3[_0xeccb('0x19')];var _0x57b2ad=_0x2a9bc1?_0x242e1e[_0xeccb('0x1b')]:_0x3cf4d3[_0xeccb('0x19')]+_0x3cf4d3[_0xeccb('0x1c')];var _0x280b15;if(_0x57b2ad>=_0x7852a1){_0x57b2ad=_0x7852a1;_0x280b15=0xc8;}else{_0x280b15=0xce;}_0x19167d['status'](_0x280b15);return _0x19167d['set'](_0xeccb('0x1d'),_0xfe10f7+'-'+_0x57b2ad+'/'+_0x7852a1)[_0xeccb('0x18')](_0x242e1e);}return null;};}function patchUpdates(_0x55dd40){return function(_0xa9367a){try{jsonpatch[_0xeccb('0x1e')](_0xa9367a,_0x55dd40,!![]);}catch(_0x357cdf){return BPromise[_0xeccb('0x1f')](_0x357cdf);}return _0xa9367a['save']();};}function saveUpdates(_0x420dec,_0x4d9d8b){return function(_0x2f9ca6){if(_0x2f9ca6){return _0x2f9ca6[_0xeccb('0x20')](_0x420dec)[_0xeccb('0x21')](function(_0x1a8b3e){return _0x1a8b3e;});}return null;};}function removeEntity(_0x49fb59,_0x1ae4b4){return function(_0x32e3ac){if(_0x32e3ac){return _0x32e3ac[_0xeccb('0x22')]()[_0xeccb('0x21')](function(){_0x49fb59['status'](0xcc)[_0xeccb('0x17')]();});}};}function handleEntityNotFound(_0x1d476b,_0x239927){return function(_0x4c67aa){if(!_0x4c67aa){_0x1d476b[_0xeccb('0x15')](0x194);}return _0x4c67aa;};}function handleError(_0x4ff6a7,_0x53d4f7){_0x53d4f7=_0x53d4f7||0x1f4;return function(_0x34f174){logger[_0xeccb('0x23')](_0x34f174[_0xeccb('0x24')]);if(_0x34f174[_0xeccb('0x25')]){delete _0x34f174[_0xeccb('0x25')];}_0x4ff6a7['status'](_0x53d4f7)['send'](_0x34f174);};}exports['index']=function(_0x3a8531,_0x20bbec){var _0x26114c={},_0x2837b6={},_0x1a4c46={'count':0x0,'rows':[]};var _0x453210=_['map'](db[_0xeccb('0x26')][_0xeccb('0x27')],function(_0x3820c7){return{'name':_0x3820c7[_0xeccb('0x28')],'type':_0x3820c7[_0xeccb('0x29')]['key']};});_0x2837b6[_0xeccb('0x2a')]=_[_0xeccb('0x2b')](_0x453210,_0xeccb('0x25'));_0x2837b6[_0xeccb('0x2c')]=_[_0xeccb('0x2d')](_0x3a8531[_0xeccb('0x2c')]);_0x2837b6[_0xeccb('0x2e')]=_['intersection'](_0x2837b6[_0xeccb('0x2a')],_0x2837b6[_0xeccb('0x2c')]);_0x26114c['attributes']=_[_0xeccb('0x2f')](_0x2837b6['model'],qs[_0xeccb('0x30')](_0x3a8531[_0xeccb('0x2c')][_0xeccb('0x30')]));_0x26114c['attributes']=_0x26114c[_0xeccb('0x31')]['length']?_0x26114c[_0xeccb('0x31')]:_0x2837b6[_0xeccb('0x2a')];if(!_0x3a8531['query']['hasOwnProperty'](_0xeccb('0x32'))){_0x26114c[_0xeccb('0x1c')]=qs[_0xeccb('0x1c')](_0x3a8531[_0xeccb('0x2c')]['limit']);_0x26114c['offset']=qs[_0xeccb('0x19')](_0x3a8531[_0xeccb('0x2c')]['offset']);}_0x26114c[_0xeccb('0x33')]=qs['sort'](_0x3a8531[_0xeccb('0x2c')][_0xeccb('0x34')]);_0x26114c[_0xeccb('0x35')]=qs['filters'](_[_0xeccb('0x36')](_0x3a8531[_0xeccb('0x2c')],_0x2837b6['filters']),_0x453210);if(_0x3a8531[_0xeccb('0x2c')][_0xeccb('0x37')]){_0x26114c[_0xeccb('0x35')]=_['merge'](_0x26114c['where'],{'$or':_[_0xeccb('0x2b')](_0x453210,function(_0x132582){if(_0x132582[_0xeccb('0x29')]!==_0xeccb('0x38')){var _0x2ed61a={};_0x2ed61a[_0x132582[_0xeccb('0x25')]]={'$like':'%'+_0x3a8531[_0xeccb('0x2c')]['filter']+'%'};return _0x2ed61a;}})});}_0x26114c=_['merge']({},_0x26114c,_0x3a8531[_0xeccb('0x39')]);var _0x55c83c={'where':_0x26114c[_0xeccb('0x35')]};return db[_0xeccb('0x26')][_0xeccb('0x1b')](_0x55c83c)[_0xeccb('0x21')](function(_0x3dcbac){_0x1a4c46[_0xeccb('0x1b')]=_0x3dcbac;if(_0x3a8531[_0xeccb('0x2c')][_0xeccb('0x3a')]){_0x26114c[_0xeccb('0x3b')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0xeccb('0x3c')](_0x26114c);})[_0xeccb('0x21')](function(_0x4ee414){_0x1a4c46[_0xeccb('0x3d')]=_0x4ee414;return _0x1a4c46;})[_0xeccb('0x21')](respondWithFilteredResult(_0x20bbec,_0x26114c))['catch'](handleError(_0x20bbec,null));};exports[_0xeccb('0x3e')]=function(_0x11ad49,_0x50090b){var _0x1b59df={'raw':!![],'where':{'id':_0x11ad49[_0xeccb('0x3f')]['id']}},_0xe74b77={};_0xe74b77[_0xeccb('0x2a')]=_[_0xeccb('0x2d')](db['OpenchannelApplication']['rawAttributes']);_0xe74b77[_0xeccb('0x2c')]=_[_0xeccb('0x2d')](_0x11ad49[_0xeccb('0x2c')]);_0xe74b77[_0xeccb('0x2e')]=_[_0xeccb('0x2f')](_0xe74b77['model'],_0xe74b77[_0xeccb('0x2c')]);_0x1b59df['attributes']=_[_0xeccb('0x2f')](_0xe74b77[_0xeccb('0x2a')],qs['fields'](_0x11ad49['query'][_0xeccb('0x30')]));_0x1b59df[_0xeccb('0x31')]=_0x1b59df[_0xeccb('0x31')]['length']?_0x1b59df[_0xeccb('0x31')]:_0xe74b77[_0xeccb('0x2a')];if(_0x11ad49[_0xeccb('0x2c')][_0xeccb('0x3a')]){_0x1b59df[_0xeccb('0x3b')]=[{'all':!![]}];}_0x1b59df=_[_0xeccb('0x40')]({},_0x1b59df,_0x11ad49['options']);return db[_0xeccb('0x26')][_0xeccb('0x41')](_0x1b59df)[_0xeccb('0x21')](handleEntityNotFound(_0x50090b,null))[_0xeccb('0x21')](respondWithResult(_0x50090b,null))[_0xeccb('0x42')](handleError(_0x50090b,null));};exports[_0xeccb('0x43')]=function(_0xfe35fb,_0x3d5894){return db['OpenchannelApplication'][_0xeccb('0x43')](_0xfe35fb[_0xeccb('0x44')],{})['then'](respondWithResult(_0x3d5894,0xc9))[_0xeccb('0x42')](handleError(_0x3d5894,null));};exports[_0xeccb('0x20')]=function(_0x148e9f,_0x5bb993){if(_0x148e9f[_0xeccb('0x44')]['id']){delete _0x148e9f[_0xeccb('0x44')]['id'];}return db[_0xeccb('0x26')][_0xeccb('0x41')]({'where':{'id':_0x148e9f[_0xeccb('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5bb993,null))[_0xeccb('0x21')](saveUpdates(_0x148e9f[_0xeccb('0x44')],null))[_0xeccb('0x21')](respondWithResult(_0x5bb993,null))[_0xeccb('0x42')](handleError(_0x5bb993,null));};exports[_0xeccb('0x22')]=function(_0x490b4f,_0x9a3306){return db[_0xeccb('0x26')]['find']({'where':{'id':_0x490b4f[_0xeccb('0x3f')]['id']}})[_0xeccb('0x21')](handleEntityNotFound(_0x9a3306,null))['then'](removeEntity(_0x9a3306,null))[_0xeccb('0x42')](handleError(_0x9a3306,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index fcd4e69..9b0c4d2 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 _0xa91b=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xa91b,0x70));var _0xba91=function(_0x246d2e,_0x15c0fc){_0x246d2e=_0x246d2e-0x0;var _0x2ab209=_0xa91b[_0x246d2e];return _0x2ab209;};'use strict';var _=require(_0xba91('0x0'));var util=require(_0xba91('0x1'));var logger=require(_0xba91('0x2'))(_0xba91('0x3'));var moment=require('moment');var BPromise=require(_0xba91('0x4'));var rp=require(_0xba91('0x5'));var fs=require('fs');var path=require(_0xba91('0x6'));var rimraf=require(_0xba91('0x7'));var config=require(_0xba91('0x8'));var attributes=require(_0xba91('0x9'));module[_0xba91('0xa')]=function(_0x1763eb,_0x28e3dd){return _0x1763eb[_0xba91('0xb')](_0xba91('0xc'),attributes,{'tableName':_0xba91('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xba91('0xe'),'collate':_0xba91('0xf')});}; \ No newline at end of file +var _0x10f3=['define','OpenchannelApplication','utf8mb4','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x1d0aa3,_0x24c956){var _0x42292e=function(_0x2a4737){while(--_0x2a4737){_0x1d0aa3['push'](_0x1d0aa3['shift']());}};_0x42292e(++_0x24c956);}(_0x10f3,0x10b));var _0x310f=function(_0x93d2e5,_0x235109){_0x93d2e5=_0x93d2e5-0x0;var _0x5b7d4b=_0x10f3[_0x93d2e5];return _0x5b7d4b;};'use strict';var _=require(_0x310f('0x0'));var util=require(_0x310f('0x1'));var logger=require(_0x310f('0x2'))(_0x310f('0x3'));var moment=require('moment');var BPromise=require(_0x310f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x310f('0x5'));var rimraf=require(_0x310f('0x6'));var config=require(_0x310f('0x7'));var attributes=require('./openchannelApplication.attributes');module[_0x310f('0x8')]=function(_0xdf1b9f,_0xf531d4){return _0xdf1b9f[_0x310f('0x9')](_0x310f('0xa'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x310f('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 80341a7..68f92dd 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 _0x90fb=['moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','OpenchannelApplication','update','body','options','attributes','limit','UpdateOpenchannelApplication','stringify','lodash','util'];(function(_0x23e5d2,_0x415e7a){var _0x51ee49=function(_0x2cc5fd){while(--_0x2cc5fd){_0x23e5d2['push'](_0x23e5d2['shift']());}};_0x51ee49(++_0x415e7a);}(_0x90fb,0xb2));var _0xb90f=function(_0x3e2e82,_0x369bbe){_0x3e2e82=_0x3e2e82-0x0;var _0xba15aa=_0x90fb[_0x3e2e82];return _0xba15aa;};'use strict';var _=require(_0xb90f('0x0'));var util=require(_0xb90f('0x1'));var moment=require(_0xb90f('0x2'));var BPromise=require(_0xb90f('0x3'));var rs=require(_0xb90f('0x4'));var fs=require('fs');var Redis=require(_0xb90f('0x5'));var db=require(_0xb90f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb90f('0x7'));var config=require(_0xb90f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb90f('0x9')][_0xb90f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fc783,_0x509f6c,_0x5cda89){return new BPromise(function(_0x551b61,_0x2b09e3){return client[_0xb90f('0xb')](_0x2fc783,_0x5cda89)[_0xb90f('0xc')](function(_0x2a9447){logger[_0xb90f('0xd')](_0xb90f('0xe'),_0x509f6c,_0xb90f('0xf'));logger[_0xb90f('0x10')](_0xb90f('0x11'),_0x509f6c,_0xb90f('0xf'),JSON['stringify'](_0x2a9447));if(_0x2a9447[_0xb90f('0x12')]){if(_0x2a9447[_0xb90f('0x12')]['code']===0x1f4){logger[_0xb90f('0x12')](_0xb90f('0xe'),_0x509f6c,_0x2a9447[_0xb90f('0x12')][_0xb90f('0x13')]);return _0x2b09e3(_0x2a9447[_0xb90f('0x12')][_0xb90f('0x13')]);}logger[_0xb90f('0x12')](_0xb90f('0xe'),_0x509f6c,_0x2a9447[_0xb90f('0x12')][_0xb90f('0x13')]);return _0x551b61(_0x2a9447[_0xb90f('0x12')][_0xb90f('0x13')]);}else{logger[_0xb90f('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x509f6c,'request\x20sent');_0x551b61(_0x2a9447[_0xb90f('0x14')]['message']);}})[_0xb90f('0x15')](function(_0x360300){logger[_0xb90f('0x12')](_0xb90f('0xe'),_0x509f6c,_0x360300);_0x2b09e3(_0x360300);});});}exports['UpdateOpenchannelApplication']=function(_0x57d3c4){var _0xc8fd8a=this;return new Promise(function(_0x5813e6,_0x57f9e7){return db[_0xb90f('0x16')][_0xb90f('0x17')](_0x57d3c4[_0xb90f('0x18')],{'raw':_0x57d3c4[_0xb90f('0x19')]?_0x57d3c4[_0xb90f('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57d3c4[_0xb90f('0x19')]?_0x57d3c4[_0xb90f('0x19')]['where']||null:null,'attributes':_0x57d3c4[_0xb90f('0x19')]?_0x57d3c4[_0xb90f('0x19')][_0xb90f('0x1a')]||null:null,'limit':_0x57d3c4[_0xb90f('0x19')]?_0x57d3c4[_0xb90f('0x19')][_0xb90f('0x1b')]||null:null})['then'](function(_0x2eadf6){logger['info'](_0xb90f('0x1c'),_0x57d3c4);logger[_0xb90f('0x10')](_0xb90f('0x1c'),_0x57d3c4,JSON[_0xb90f('0x1d')](_0x2eadf6));_0x5813e6(_0x2eadf6);})['catch'](function(_0x25d064){logger['error'](_0xb90f('0x1c'),_0x25d064[_0xb90f('0x13')],_0x57d3c4);_0x57f9e7(_0xc8fd8a[_0xb90f('0x12')](0x1f4,_0x25d064['message']));});});}; \ No newline at end of file +var _0x40e9=['info','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','attributes','limit','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xa2a0e8,_0x36f7a9){var _0x5d7b9c=function(_0x3db7c1){while(--_0x3db7c1){_0xa2a0e8['push'](_0xa2a0e8['shift']());}};_0x5d7b9c(++_0x36f7a9);}(_0x40e9,0x17f));var _0x940e=function(_0x592b71,_0x32970d){_0x592b71=_0x592b71-0x0;var _0x13f598=_0x40e9[_0x592b71];return _0x13f598;};'use strict';var _=require(_0x940e('0x0'));var util=require('util');var moment=require(_0x940e('0x1'));var BPromise=require(_0x940e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x940e('0x3'));var db=require(_0x940e('0x4'))['db'];var utils=require(_0x940e('0x5'));var logger=require(_0x940e('0x6'))(_0x940e('0x7'));var config=require(_0x940e('0x8'));var jayson=require(_0x940e('0x9'));var client=jayson[_0x940e('0xa')][_0x940e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e181b,_0x1138f0,_0x30fe09){return new BPromise(function(_0x44549b,_0x1eb825){return client[_0x940e('0xc')](_0x3e181b,_0x30fe09)['then'](function(_0x46ac1f){logger['info'](_0x940e('0xd'),_0x1138f0,_0x940e('0xe'));logger['debug'](_0x940e('0xf'),_0x1138f0,_0x940e('0xe'),JSON[_0x940e('0x10')](_0x46ac1f));if(_0x46ac1f[_0x940e('0x11')]){if(_0x46ac1f[_0x940e('0x11')][_0x940e('0x12')]===0x1f4){logger[_0x940e('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x1138f0,_0x46ac1f[_0x940e('0x11')]['message']);return _0x1eb825(_0x46ac1f[_0x940e('0x11')][_0x940e('0x13')]);}logger[_0x940e('0x11')](_0x940e('0xd'),_0x1138f0,_0x46ac1f[_0x940e('0x11')]['message']);return _0x44549b(_0x46ac1f[_0x940e('0x11')][_0x940e('0x13')]);}else{logger[_0x940e('0x14')](_0x940e('0xd'),_0x1138f0,'request\x20sent');_0x44549b(_0x46ac1f[_0x940e('0x15')][_0x940e('0x13')]);}})[_0x940e('0x16')](function(_0x5db50a){logger[_0x940e('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x1138f0,_0x5db50a);_0x1eb825(_0x5db50a);});});}exports[_0x940e('0x17')]=function(_0x9cb44f){var _0x4b765c=this;return new Promise(function(_0x282d35,_0x1988e1){return db[_0x940e('0x18')]['update'](_0x9cb44f[_0x940e('0x19')],{'raw':_0x9cb44f['options']?_0x9cb44f[_0x940e('0x1a')][_0x940e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9cb44f['options']?_0x9cb44f[_0x940e('0x1a')]['where']||null:null,'attributes':_0x9cb44f[_0x940e('0x1a')]?_0x9cb44f['options'][_0x940e('0x1c')]||null:null,'limit':_0x9cb44f[_0x940e('0x1a')]?_0x9cb44f[_0x940e('0x1a')][_0x940e('0x1d')]||null:null})['then'](function(_0x585dbf){logger[_0x940e('0x14')](_0x940e('0x17'),_0x9cb44f);logger[_0x940e('0x1e')](_0x940e('0x17'),_0x9cb44f,JSON[_0x940e('0x10')](_0x585dbf));_0x282d35(_0x585dbf);})[_0x940e('0x16')](function(_0x5478d1){logger['error']('UpdateOpenchannelApplication',_0x5478d1[_0x940e('0x13')],_0x9cb44f);_0x1988e1(_0x4b765c[_0x940e('0x11')](0x1f4,_0x5478d1[_0x940e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 3ca46b2..77aa461 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 _0x15f4=['destroy','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','/:id','openchannelinteraction:update','update','delete'];(function(_0x3bf27f,_0x2dbbe0){var _0x4e5160=function(_0x41ffa2){while(--_0x41ffa2){_0x3bf27f['push'](_0x3bf27f['shift']());}};_0x4e5160(++_0x2dbbe0);}(_0x15f4,0x1c3));var _0x415f=function(_0x140840,_0x35aa35){_0x140840=_0x140840-0x0;var _0x3b07fd=_0x15f4[_0x140840];return _0x3b07fd;};'use strict';var multer=require(_0x415f('0x0'));var util=require('util');var path=require(_0x415f('0x1'));var timeout=require(_0x415f('0x2'));var express=require(_0x415f('0x3'));var router=express[_0x415f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x415f('0x5'));var interaction=require(_0x415f('0x6'));var config=require('../../config/environment');var controller=require(_0x415f('0x7'));router[_0x415f('0x8')]('/',auth[_0x415f('0x9')](),controller[_0x415f('0xa')]);router['get'](_0x415f('0xb'),auth[_0x415f('0x9')](),controller[_0x415f('0xc')]);router[_0x415f('0x8')]('/:id',auth[_0x415f('0x9')](),controller[_0x415f('0xd')]);router[_0x415f('0x8')](_0x415f('0xe'),auth[_0x415f('0x9')](),controller[_0x415f('0xf')]);router[_0x415f('0x8')](_0x415f('0x10'),auth[_0x415f('0x9')](),controller[_0x415f('0x11')]);router[_0x415f('0x12')]('/',auth['isAuthenticated'](),controller[_0x415f('0x13')]);router['post'](_0x415f('0xe'),auth[_0x415f('0x9')](),controller['addMessage']);router[_0x415f('0x12')](_0x415f('0x14'),auth[_0x415f('0x9')](),interaction[_0x415f('0x15')](_0x415f('0x16'),_0x415f('0x17')),controller['addTags']);router[_0x415f('0x18')](_0x415f('0x19'),auth['isAuthenticated'](),interaction[_0x415f('0x15')](_0x415f('0x16'),_0x415f('0x1a')),controller[_0x415f('0x1b')]);router[_0x415f('0x1c')]('/:id',auth[_0x415f('0x9')](),interaction[_0x415f('0x15')]('openchannel','openchannelinteraction:destroy'),controller[_0x415f('0x1d')]);router[_0x415f('0x1c')](_0x415f('0x14'),auth[_0x415f('0x9')](),controller[_0x415f('0x1e')]);module[_0x415f('0x1f')]=router; \ No newline at end of file +var _0xd1fa=['/:id','show','/:id/messages','getMessages','post','/:id/tags','tracked','openchannel','addTags','update','delete','openchannelinteraction:destroy','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','/describe','isAuthenticated','describe'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd1fa,0x1cd));var _0xad1f=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xd1fa[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0xad1f('0x0'));var util=require(_0xad1f('0x1'));var path=require(_0xad1f('0x2'));var timeout=require(_0xad1f('0x3'));var express=require(_0xad1f('0x4'));var router=express[_0xad1f('0x5')]();var fs_extra=require(_0xad1f('0x6'));var auth=require(_0xad1f('0x7'));var interaction=require(_0xad1f('0x8'));var config=require(_0xad1f('0x9'));var controller=require(_0xad1f('0xa'));router[_0xad1f('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xad1f('0xb')](_0xad1f('0xc'),auth[_0xad1f('0xd')](),controller[_0xad1f('0xe')]);router['get'](_0xad1f('0xf'),auth[_0xad1f('0xd')](),controller[_0xad1f('0x10')]);router[_0xad1f('0xb')](_0xad1f('0x11'),auth[_0xad1f('0xd')](),controller[_0xad1f('0x12')]);router[_0xad1f('0xb')]('/:id/download',auth[_0xad1f('0xd')](),controller['download']);router[_0xad1f('0x13')]('/',auth[_0xad1f('0xd')](),controller['create']);router['post']('/:id/messages',auth[_0xad1f('0xd')](),controller['addMessage']);router[_0xad1f('0x13')](_0xad1f('0x14'),auth[_0xad1f('0xd')](),interaction[_0xad1f('0x15')](_0xad1f('0x16'),'openchannelinteraction:addtags'),controller[_0xad1f('0x17')]);router['put']('/:id',auth[_0xad1f('0xd')](),interaction[_0xad1f('0x15')](_0xad1f('0x16'),'openchannelinteraction:update'),controller[_0xad1f('0x18')]);router[_0xad1f('0x19')](_0xad1f('0xf'),auth[_0xad1f('0xd')](),interaction[_0xad1f('0x15')](_0xad1f('0x16'),_0xad1f('0x1a')),controller[_0xad1f('0x1b')]);router[_0xad1f('0x19')](_0xad1f('0x14'),auth[_0xad1f('0xd')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 4a343de..3f94262 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 _0xf109=['DATE','ENUM','out','sequelize','exports','BOOLEAN','STRING'];(function(_0x202d24,_0x5e8641){var _0x2b3a8e=function(_0x4c7c4a){while(--_0x4c7c4a){_0x202d24['push'](_0x202d24['shift']());}};_0x2b3a8e(++_0x5e8641);}(_0xf109,0xce));var _0x9f10=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xf109[_0x1762b4];return _0x29beda;};'use strict';var Sequelize=require(_0x9f10('0x0'));module[_0x9f10('0x1')]={'closed':{'type':Sequelize[_0x9f10('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x9f10('0x3')]},'note':{'type':Sequelize[_0x9f10('0x3')]},'read1stAt':{'type':Sequelize[_0x9f10('0x4')]},'threadId':{'type':Sequelize[_0x9f10('0x3')]},'externalUrl':{'type':Sequelize[_0x9f10('0x3')]},'lastMsgAt':{'type':Sequelize[_0x9f10('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x9f10('0x5')]('in',_0x9f10('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x9f10('0x5')]('in',_0x9f10('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x9f10('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe644=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0xe644,0x159));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4e64('0x0'));module[_0x4e64('0x1')]={'closed':{'type':Sequelize[_0x4e64('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4e64('0x3')]},'disposition':{'type':Sequelize[_0x4e64('0x4')]},'secondDisposition':{'type':Sequelize[_0x4e64('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x4e64('0x4')]},'read1stAt':{'type':Sequelize[_0x4e64('0x3')]},'threadId':{'type':Sequelize[_0x4e64('0x4')]},'externalUrl':{'type':Sequelize[_0x4e64('0x4')]},'lastMsgAt':{'type':Sequelize[_0x4e64('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x4e64('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x4e64('0x5')]('in',_0x4e64('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 541b60e..2049b74 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 _0xa9bf=['findAll','openchannel','query','user','show','from','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','catch','create','body','describe','ids','omit','findOne','OpenchannelMessage','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','merge','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closed','disposition','threadId','Public','basename','createReadStream','createWriteStream','out','System','value','renderFile','downloadInteraction.ejs','transcript-','createPdfFromHTML','error','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','sendStatus','rimraf','zip-dir','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','redis','defaults','status','end','json','offset','undefined','limit','count','Content-Range','update','destroy','then','stack','name','send','map','OpenchannelInteraction','rawAttributes','type','key','getOptions'];(function(_0x14c837,_0xbb29e9){var _0x250e8b=function(_0x19eb4a){while(--_0x19eb4a){_0x14c837['push'](_0x14c837['shift']());}};_0x250e8b(++_0xbb29e9);}(_0xa9bf,0x1d0));var _0xfa9b=function(_0x5f002d,_0x1b9dc8){_0x5f002d=_0x5f002d-0x0;var _0x544598=_0xa9bf[_0x5f002d];return _0x544598;};'use strict';var rimraf=require(_0xfa9b('0x0'));var zipdir=require(_0xfa9b('0x1'));var moment=require('moment');var util=require('util');var path=require('path');var ejs=require(_0xfa9b('0x2'));var fs=require('fs');var _=require(_0xfa9b('0x3'));var Redis=require(_0xfa9b('0x4'));var interaction=require(_0xfa9b('0x5'));var qs=require(_0xfa9b('0x6'));var pdf=require(_0xfa9b('0x7'));var logger=require(_0xfa9b('0x8'))('api');var config=require(_0xfa9b('0x9'));var db=require('../../mysqldb')['db'];config[_0xfa9b('0xa')]=_[_0xfa9b('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfa9b('0xa')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x30a87b,_0xbe2495){_0xbe2495=_0xbe2495||0xcc;return function(_0x506707){if(_0x506707){return _0x30a87b['sendStatus'](_0xbe2495);}return _0x30a87b[_0xfa9b('0xc')](_0xbe2495)[_0xfa9b('0xd')]();};}function respondWithResult(_0x348a93,_0x3c56bc){_0x3c56bc=_0x3c56bc||0xc8;return function(_0x16cd3f){if(_0x16cd3f){return _0x348a93[_0xfa9b('0xc')](_0x3c56bc)[_0xfa9b('0xe')](_0x16cd3f);}};}function respondWithFilteredResult(_0x199e32,_0x2fcfdf){return function(_0x48b9df){if(_0x48b9df){var _0x14e6a5=typeof _0x2fcfdf[_0xfa9b('0xf')]===_0xfa9b('0x10')&&typeof _0x2fcfdf[_0xfa9b('0x11')]===_0xfa9b('0x10');var _0x513ecc=_0x48b9df['count'];var _0xe88fc1=_0x14e6a5?0x0:_0x2fcfdf[_0xfa9b('0xf')];var _0x100485=_0x14e6a5?_0x48b9df[_0xfa9b('0x12')]:_0x2fcfdf[_0xfa9b('0xf')]+_0x2fcfdf['limit'];var _0x39040a;if(_0x100485>=_0x513ecc){_0x100485=_0x513ecc;_0x39040a=0xc8;}else{_0x39040a=0xce;}_0x199e32[_0xfa9b('0xc')](_0x39040a);return _0x199e32['set'](_0xfa9b('0x13'),_0xe88fc1+'-'+_0x100485+'/'+_0x513ecc)[_0xfa9b('0xe')](_0x48b9df);}return null;};}function saveUpdates(_0x225e4b){return function(_0x45262d){if(_0x45262d){return _0x45262d[_0xfa9b('0x14')](_0x225e4b)['then'](function(_0x47385b){return _0x47385b;});}return null;};}function removeEntity(_0x41df70){return function(_0x2ef299){if(_0x2ef299){return _0x2ef299[_0xfa9b('0x15')]()[_0xfa9b('0x16')](function(){_0x41df70[_0xfa9b('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x412411){return function(_0x3e95f2){if(!_0x3e95f2){_0x412411['sendStatus'](0x194);}return _0x3e95f2;};}function handleError(_0x51b452,_0x1d4196){_0x1d4196=_0x1d4196||0x1f4;return function(_0x3e8582){logger['error'](_0x3e8582[_0xfa9b('0x17')]);if(_0x3e8582[_0xfa9b('0x18')]){delete _0x3e8582['name'];}_0x51b452[_0xfa9b('0xc')](_0x1d4196)[_0xfa9b('0x19')](_0x3e8582);};}exports['index']=function(_0x4f3a0e,_0x5edaf3){var _0x53680a={};var _0x12f7f3=_[_0xfa9b('0x1a')](db[_0xfa9b('0x1b')][_0xfa9b('0x1c')],function(_0x5285d6){return{'name':_0x5285d6['fieldName'],'type':_0x5285d6[_0xfa9b('0x1d')][_0xfa9b('0x1e')]};});_0x53680a=qs[_0xfa9b('0x1f')](_0x12f7f3,_0x4f3a0e);return interaction[_0xfa9b('0x20')](_0xfa9b('0x21'),_0x4f3a0e[_0xfa9b('0x22')],_0x4f3a0e[_0xfa9b('0x23')],_0x53680a,_0x12f7f3)[_0xfa9b('0x16')](respondWithFilteredResult(_0x5edaf3,_0x53680a))['catch'](handleError(_0x5edaf3,null));};exports[_0xfa9b('0x24')]=function(_0x241157,_0x1d1897){var _0xe7c277={};if(_0x241157[_0xfa9b('0x22')]['type']&&_0x241157[_0xfa9b('0x22')]['type']===_0xfa9b('0x25')){_0xe7c277[_0xfa9b('0x25')]=_0x241157[_0xfa9b('0x26')]['id'];}else{_0xe7c277['id']=_0x241157[_0xfa9b('0x26')]['id'];}var _0x17038d={'raw':![],'where':_0xe7c277},_0x477752={};_0x477752[_0xfa9b('0x27')]=_[_0xfa9b('0x28')](db[_0xfa9b('0x1b')][_0xfa9b('0x1c')]);_0x477752[_0xfa9b('0x22')]=_[_0xfa9b('0x28')](_0x241157['query']);_0x477752[_0xfa9b('0x29')]=_[_0xfa9b('0x2a')](_0x477752['model'],_0x477752[_0xfa9b('0x22')]);_0x17038d[_0xfa9b('0x2b')]=_[_0xfa9b('0x2a')](_0x477752[_0xfa9b('0x27')],qs[_0xfa9b('0x2c')](_0x241157[_0xfa9b('0x22')]['fields']));_0x17038d[_0xfa9b('0x2b')]=_0x17038d[_0xfa9b('0x2b')][_0xfa9b('0x2d')]?_0x17038d['attributes']:_0x477752[_0xfa9b('0x27')];if(_0x241157['query'][_0xfa9b('0x2e')]){_0x17038d[_0xfa9b('0x2f')]=[{'all':!![]}];}_0x17038d=_['merge']({},_0x17038d,_0x241157[_0xfa9b('0x30')]);return db[_0xfa9b('0x1b')][_0xfa9b('0x31')](_0x17038d)['then'](handleEntityNotFound(_0x1d1897,null))[_0xfa9b('0x16')](respondWithResult(_0x1d1897,null))[_0xfa9b('0x32')](handleError(_0x1d1897,null));};exports[_0xfa9b('0x33')]=function(_0x536d27,_0x6d69ff){return db['OpenchannelInteraction'][_0xfa9b('0x33')](_0x536d27['body'],{})[_0xfa9b('0x16')](respondWithResult(_0x6d69ff,0xc9))[_0xfa9b('0x32')](handleError(_0x6d69ff,null));};exports[_0xfa9b('0x14')]=function(_0x50e9ca,_0x2c49ba){if(_0x50e9ca[_0xfa9b('0x34')]['id']){delete _0x50e9ca[_0xfa9b('0x34')]['id'];}return db[_0xfa9b('0x1b')][_0xfa9b('0x31')]({'where':{'id':_0x50e9ca[_0xfa9b('0x26')]['id']}})[_0xfa9b('0x16')](handleEntityNotFound(_0x2c49ba,null))[_0xfa9b('0x16')](saveUpdates(_0x50e9ca['body'],null))['then'](respondWithResult(_0x2c49ba,null))['catch'](handleError(_0x2c49ba,null));};exports[_0xfa9b('0x15')]=function(_0x13d3ff,_0x35d0ad){return db[_0xfa9b('0x1b')][_0xfa9b('0x31')]({'where':{'id':_0x13d3ff[_0xfa9b('0x26')]['id']}})[_0xfa9b('0x16')](handleEntityNotFound(_0x35d0ad,null))[_0xfa9b('0x16')](removeEntity(_0x35d0ad,null))[_0xfa9b('0x32')](handleError(_0x35d0ad,null));};exports[_0xfa9b('0x35')]=function(_0x5e321c,_0x4b311c){return db[_0xfa9b('0x1b')][_0xfa9b('0x35')]()['then'](respondWithResult(_0x4b311c,null))[_0xfa9b('0x32')](handleError(_0x4b311c,null));};exports['addMessage']=function(_0x1ab6d5,_0x37bf17){return db['OpenchannelMessage'][_0xfa9b('0x31')]({'where':{'id':_0x1ab6d5[_0xfa9b('0x26')]['id']}})['then'](handleEntityNotFound(_0x37bf17,null))[_0xfa9b('0x16')](function(_0x10def2){if(_0x10def2){return _0x10def2['addMessage'](_0x1ab6d5[_0xfa9b('0x34')][_0xfa9b('0x36')],_[_0xfa9b('0x37')](_0x1ab6d5[_0xfa9b('0x34')],['ids','id'])||{});}})[_0xfa9b('0x16')](respondWithResult(_0x37bf17,null))[_0xfa9b('0x32')](handleError(_0x37bf17,null));};exports['getMessages']=function(_0x301587,_0x2f4e7c){var _0x487e8e={'raw':![],'where':{}};var _0x6d3dc8={};var _0x394be8={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xfa9b('0x38')]({'where':{'id':_0x301587['params']['id']}})[_0xfa9b('0x16')](handleEntityNotFound(_0x2f4e7c,null))['then'](function(_0x1b1aca){if(_0x1b1aca){_0x6d3dc8[_0xfa9b('0x27')]=_[_0xfa9b('0x28')](db[_0xfa9b('0x39')]['rawAttributes']);_0x6d3dc8[_0xfa9b('0x22')]=_[_0xfa9b('0x28')](_0x301587['query']);_0x6d3dc8['filters']=_[_0xfa9b('0x2a')](_0x6d3dc8[_0xfa9b('0x27')],_0x6d3dc8[_0xfa9b('0x22')]);_0x487e8e[_0xfa9b('0x2b')]=_['intersection'](_0x6d3dc8['model'],qs[_0xfa9b('0x2c')](_0x301587[_0xfa9b('0x22')][_0xfa9b('0x2c')]));_0x487e8e[_0xfa9b('0x2b')]=_0x487e8e['attributes'][_0xfa9b('0x2d')]?_0x487e8e['attributes']:_0x6d3dc8['model'];if(!_0x301587['query'][_0xfa9b('0x3a')](_0xfa9b('0x3b'))){_0x487e8e[_0xfa9b('0x11')]=qs[_0xfa9b('0x11')](_0x301587[_0xfa9b('0x22')][_0xfa9b('0x11')]);_0x487e8e['offset']=qs[_0xfa9b('0xf')](_0x301587[_0xfa9b('0x22')][_0xfa9b('0xf')]);}_0x487e8e[_0xfa9b('0x3c')]=qs[_0xfa9b('0x3d')](_0x301587['query'][_0xfa9b('0x3d')]);_0x487e8e[_0xfa9b('0x3e')]=qs[_0xfa9b('0x29')](_[_0xfa9b('0x3f')](_0x301587[_0xfa9b('0x22')],_0x6d3dc8['filters']));_0x487e8e[_0xfa9b('0x3e')][_0xfa9b('0x40')]=_0x1b1aca['id'];if(_0x301587[_0xfa9b('0x22')]['filter']){_0x487e8e[_0xfa9b('0x3e')]=_[_0xfa9b('0x41')](_0x487e8e[_0xfa9b('0x3e')],{'$or':_['map'](_0x487e8e[_0xfa9b('0x2b')],function(_0x4b83a8){var _0x505382={};_0x505382[_0x4b83a8]={'$like':'%'+_0x301587[_0xfa9b('0x22')][_0xfa9b('0x42')]+'%'};return _0x505382;})});}if(_0x301587['query'][_0xfa9b('0x43')]){var _0x13aa04=_0x301587[_0xfa9b('0x22')][_0xfa9b('0x43')]['split'](',');var _0x1e6813={};_0x1e6813[_0x13aa04[0x0]]={'$gte':moment(_0x13aa04[0x1])[_0xfa9b('0x44')](_0xfa9b('0x45'))};_0x487e8e[_0xfa9b('0x3e')]=_['merge'](_0x487e8e['where'],_0x1e6813);}_0x487e8e=_['merge']({},_0x487e8e,_0x301587[_0xfa9b('0x30')]);return db[_0xfa9b('0x39')][_0xfa9b('0x12')]({'where':_0x487e8e[_0xfa9b('0x3e')]})['then'](function(_0x2bf629){_0x394be8[_0xfa9b('0x12')]=_0x2bf629;if(_0x301587[_0xfa9b('0x22')]['includeAll']){_0x487e8e['include']=[{'all':!![]}];}return db[_0xfa9b('0x39')][_0xfa9b('0x20')](_0x487e8e);})[_0xfa9b('0x16')](function(_0x23b870){_0x394be8[_0xfa9b('0x46')]=_0x23b870;return _0x394be8;});}})[_0xfa9b('0x16')](respondWithFilteredResult(_0x2f4e7c,_0x487e8e))[_0xfa9b('0x32')](handleError(_0x2f4e7c,null));};exports[_0xfa9b('0x47')]=function(_0x329927,_0xda3c63){return db[_0xfa9b('0x1b')][_0xfa9b('0x31')]({'where':{'id':_0x329927[_0xfa9b('0x26')]['id']}})['then'](handleEntityNotFound(_0xda3c63,null))['then'](function(_0x27af84){if(_0x27af84){return _0x27af84[_0xfa9b('0x48')](_0x329927['body'][_0xfa9b('0x36')],_['omit'](_0x329927[_0xfa9b('0x34')],['ids','id'])||{})[_0xfa9b('0x49')](function(){return db[_0xfa9b('0x4a')][_0xfa9b('0x20')]({'attributes':['id','name',_0xfa9b('0x4b')],'where':{'id':_0x329927[_0xfa9b('0x34')]['ids']}});})[_0xfa9b('0x16')](function(_0x5468d2){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x329927[_0xfa9b('0x26')]['id']),'tags':_0x5468d2||[]});return{'id':Number(_0x329927[_0xfa9b('0x26')]['id']),'tags':_0x5468d2||[]};});}})[_0xfa9b('0x16')](respondWithResult(_0xda3c63,null))[_0xfa9b('0x32')](handleError(_0xda3c63,null));};exports[_0xfa9b('0x4c')]=function(_0x3889d5,_0x956c4d){return db['OpenchannelInteraction'][_0xfa9b('0x31')]({'where':{'id':_0x3889d5[_0xfa9b('0x26')]['id']}})['then'](handleEntityNotFound(_0x956c4d,null))['then'](function(_0x23c300){if(_0x23c300){return _0x23c300[_0xfa9b('0x4c')](_0x3889d5[_0xfa9b('0x22')][_0xfa9b('0x36')]);}})[_0xfa9b('0x16')](respondWithStatusCode(_0x956c4d,null))['catch'](handleError(_0x956c4d,null));};exports[_0xfa9b('0x4d')]=function(_0x1e9641,_0x484f12){var _0xfd51a6=moment()[_0xfa9b('0x4e')]()[_0xfa9b('0x4f')]();var _0x3c77dc=path[_0xfa9b('0x50')](config[_0xfa9b('0x51')],_0xfa9b('0x52'),_0xfa9b('0x53'),_0xfa9b('0x54'));var _0x3b7c3e=path[_0xfa9b('0x50')](config[_0xfa9b('0x51')],_0xfa9b('0x52'),_0xfa9b('0x53'),_0xfa9b('0x55'));var _0x3cc852=path['join'](_0x3c77dc,_0xfd51a6);var _0x29fe10=util[_0xfa9b('0x44')](_0xfa9b('0x56'),_0x1e9641[_0xfa9b('0x26')]['id'],_0xfd51a6);var _0x25ec4a=path[_0xfa9b('0x50')](_0x3c77dc,_0x29fe10);var _0xc5cb58=[];_0xc5cb58[_0xfa9b('0x57')]({'model':db[_0xfa9b('0x58')],'as':'User','attributes':['id',_0xfa9b('0x59')],'raw':!![]});_0xc5cb58[_0xfa9b('0x57')]({'model':db[_0xfa9b('0x5a')],'as':_0xfa9b('0x5b'),'attributes':['id',_0xfa9b('0x5c'),_0xfa9b('0x5d')],'raw':!![]});if(_0x1e9641[_0xfa9b('0x22')][_0xfa9b('0x55')]){_0xc5cb58[_0xfa9b('0x57')]({'model':db[_0xfa9b('0x5e')],'as':'Attachment','raw':!![]});}var _0x34e80b=[{'model':db[_0xfa9b('0x39')],'as':_0xfa9b('0x5f'),'attributes':['id',_0xfa9b('0x34'),'createdAt',_0xfa9b('0x60'),_0xfa9b('0x61'),_0xfa9b('0x62')],'include':_0xc5cb58}];_0x34e80b['push']({'model':db[_0xfa9b('0x63')],'as':_0xfa9b('0x64'),'attributes':['id',_0xfa9b('0x18')]});_0x34e80b[_0xfa9b('0x57')]({'model':db['User'],'as':_0xfa9b('0x65'),'attributes':['id',_0xfa9b('0x59')]});return db[_0xfa9b('0x1b')][_0xfa9b('0x31')]({'where':{'id':_0x1e9641[_0xfa9b('0x26')]['id']},'include':_0x34e80b})['then'](handleEntityNotFound(_0x484f12,null))[_0xfa9b('0x16')](function(_0x1f95f7){if(_0x1f95f7){var _0x4e4c92=_0x1f95f7[_0xfa9b('0x66')]({'plain':!![]});fs[_0xfa9b('0x67')](_0x3cc852);var _0x469026={'channel':_0xfa9b('0x68'),'account':_0x4e4c92[_0xfa9b('0x64')][_0xfa9b('0x18')],'agent':_0x4e4c92['Owner']?_0x4e4c92[_0xfa9b('0x65')][_0xfa9b('0x59')]:_0xfa9b('0x69'),'createdAt':moment(_0x4e4c92['createdAt'])[_0xfa9b('0x44')](_0xfa9b('0x45'))[_0xfa9b('0x4f')](),'closedAt':_0x4e4c92[_0xfa9b('0x6a')]?moment(_0x4e4c92['closedAt'])['format'](_0xfa9b('0x45'))[_0xfa9b('0x4f')]():'','disposition':_0x4e4c92[_0xfa9b('0x6b')],'visibility':_0x4e4c92[_0xfa9b('0x6c')]?_0xfa9b('0x6d'):'Private','messages':_(_0x4e4c92['Messages'])[_0xfa9b('0x42')]({'secret':![]})[_0xfa9b('0x1a')](function(_0x2df1d0){if(_0x2df1d0['Attachment']){var _0x2fd3df=path[_0xfa9b('0x50')](_0x3b7c3e,_0x2df1d0[_0xfa9b('0x5e')][_0xfa9b('0x6e')]);if(fs['existsSync'](_0x2fd3df)){fs[_0xfa9b('0x6f')](_0x2fd3df)['pipe'](fs[_0xfa9b('0x70')](path[_0xfa9b('0x50')](_0x3cc852,_0x2df1d0['Attachment']['basename'])));}}return{'date':moment(_0x2df1d0['createdAt'])[_0xfa9b('0x44')](_0xfa9b('0x45'))[_0xfa9b('0x4f')](),'sender':_0x2df1d0['direction']===_0xfa9b('0x71')?_0x2df1d0[_0xfa9b('0x58')]?_0x2df1d0[_0xfa9b('0x58')][_0xfa9b('0x59')]:_0xfa9b('0x72'):_0x2df1d0[_0xfa9b('0x5b')]['firstName']+(_0x2df1d0[_0xfa9b('0x5b')][_0xfa9b('0x5d')]?'\x20'+_0x2df1d0['Contact'][_0xfa9b('0x5d')]:''),'body':_0x2df1d0[_0xfa9b('0x5e')]?_0x2df1d0[_0xfa9b('0x5e')][_0xfa9b('0x6e')]:_0x2df1d0[_0xfa9b('0x34')],'direction':_0x2df1d0['direction']===_0xfa9b('0x71')?'A':'C','secret':_0x2df1d0['secret'],'read':_0x2df1d0[_0xfa9b('0x62')],'attachment':_0x2df1d0[_0xfa9b('0x5e')]};})[_0xfa9b('0x73')]()};return ejs[_0xfa9b('0x74')](path['join'](config[_0xfa9b('0x51')],_0xfa9b('0x52'),'views',_0xfa9b('0x75')),{'interaction':_0x469026})[_0xfa9b('0x16')](function(_0x5b0766){var _0x102378=path['join'](_0x3cc852,_0xfa9b('0x76')+_0x4e4c92['id']+'-'+_0xfd51a6+'.pdf');var _0x1a49e2={'path':_0x102378,'channel':_0xfa9b('0x68'),'interactionId':_0x4e4c92['id']};return pdf[_0xfa9b('0x77')](_0x5b0766,_0x1a49e2);})['then'](function(){return new Promise(function(_0x2a8687,_0x1288ad){zipdir(_0x3cc852,{'saveTo':_0x25ec4a},function(_0x5dcf4c,_0x56a652){if(_0x5dcf4c)return _0x1288ad(_0x5dcf4c);return _0x2a8687(_0x56a652);});})['then'](function(){return new Promise(function(_0x841d21,_0x3e3e93){rimraf(_0x3cc852,function(_0x2aea82){if(_0x2aea82)_0x3e3e93(_0x2aea82);return _0x841d21();});});})[_0xfa9b('0x16')](function(){return _0x484f12['download'](_0x25ec4a,_0x29fe10,function(_0x110a00){if(_0x110a00){logger[_0xfa9b('0x78')](_0xfa9b('0x79'),_0x110a00);}else{fs[_0xfa9b('0x7a')](_0x25ec4a);}});});});}else{return _0x484f12[_0xfa9b('0x7b')](0xc8);}})[_0xfa9b('0x32')](handleError(_0x484f12,null));}; \ No newline at end of file +var _0x981b=['findAll','then','catch','type','query','from','params','keys','OpenchannelInteraction','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','filters','hasOwnProperty','nolimit','sort','where','pick','OpenchannelInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','Tag','color','emit','removeTags','download','unix','toString','join','root','server','tmp','files','transcript-%d-%s.zip','push','CmContact','Contact','firstName','lastName','attachments','Attachment','Messages','createdAt','direction','OpenchannelAccount','User','Owner','fullname','get','Openchannel','Account','N.A.','closed','closedAt','disposition','threadId','Private','map','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','secret','read','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','rimraf','zip-dir','moment','path','ejs','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','redis','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','update','destroy','error','stack','name','send','index','rawAttributes','fieldName','key'];(function(_0x16b263,_0x4de298){var _0x12fcb5=function(_0x1f512f){while(--_0x1f512f){_0x16b263['push'](_0x16b263['shift']());}};_0x12fcb5(++_0x4de298);}(_0x981b,0xda));var _0xb981=function(_0x188266,_0x49fbc4){_0x188266=_0x188266-0x0;var _0x4d06c6=_0x981b[_0x188266];return _0x4d06c6;};'use strict';var rimraf=require(_0xb981('0x0'));var zipdir=require(_0xb981('0x1'));var moment=require(_0xb981('0x2'));var util=require('util');var path=require(_0xb981('0x3'));var ejs=require(_0xb981('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xb981('0x5'));var qs=require(_0xb981('0x6'));var pdf=require(_0xb981('0x7'));var logger=require(_0xb981('0x8'))('api');var config=require(_0xb981('0x9'));var db=require('../../mysqldb')['db'];config[_0xb981('0xa')]=_['defaults'](config[_0xb981('0xa')],{'host':_0xb981('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb981('0xa')]));require(_0xb981('0xc'))[_0xb981('0xd')](socket);function respondWithStatusCode(_0x4f466e,_0x5f596f){_0x5f596f=_0x5f596f||0xcc;return function(_0x3a1c9e){if(_0x3a1c9e){return _0x4f466e[_0xb981('0xe')](_0x5f596f);}return _0x4f466e[_0xb981('0xf')](_0x5f596f)[_0xb981('0x10')]();};}function respondWithResult(_0x20b052,_0x2eebbc){_0x2eebbc=_0x2eebbc||0xc8;return function(_0x5043f8){if(_0x5043f8){return _0x20b052['status'](_0x2eebbc)[_0xb981('0x11')](_0x5043f8);}};}function respondWithFilteredResult(_0x14e2fc,_0x4be78d){return function(_0x458e56){if(_0x458e56){var _0x1e80b9=typeof _0x4be78d['offset']==='undefined'&&typeof _0x4be78d['limit']===_0xb981('0x12');var _0x55715a=_0x458e56[_0xb981('0x13')];var _0x189013=_0x1e80b9?0x0:_0x4be78d[_0xb981('0x14')];var _0x572490=_0x1e80b9?_0x458e56[_0xb981('0x13')]:_0x4be78d['offset']+_0x4be78d[_0xb981('0x15')];var _0x29f2ab;if(_0x572490>=_0x55715a){_0x572490=_0x55715a;_0x29f2ab=0xc8;}else{_0x29f2ab=0xce;}_0x14e2fc['status'](_0x29f2ab);return _0x14e2fc[_0xb981('0x16')](_0xb981('0x17'),_0x189013+'-'+_0x572490+'/'+_0x55715a)[_0xb981('0x11')](_0x458e56);}return null;};}function saveUpdates(_0x56013a){return function(_0x588263){if(_0x588263){return _0x588263[_0xb981('0x18')](_0x56013a)['then'](function(_0x247e5b){return _0x247e5b;});}return null;};}function removeEntity(_0x495c46){return function(_0x331847){if(_0x331847){return _0x331847[_0xb981('0x19')]()['then'](function(){_0x495c46[_0xb981('0xf')](0xcc)[_0xb981('0x10')]();});}};}function handleEntityNotFound(_0x1a83b4){return function(_0x107c1d){if(!_0x107c1d){_0x1a83b4[_0xb981('0xe')](0x194);}return _0x107c1d;};}function handleError(_0x561b32,_0x4fba26){_0x4fba26=_0x4fba26||0x1f4;return function(_0x27fdb8){logger[_0xb981('0x1a')](_0x27fdb8[_0xb981('0x1b')]);if(_0x27fdb8[_0xb981('0x1c')]){delete _0x27fdb8['name'];}_0x561b32[_0xb981('0xf')](_0x4fba26)[_0xb981('0x1d')](_0x27fdb8);};}exports[_0xb981('0x1e')]=function(_0x352048,_0xc917df){var _0x839420={};var _0x3f32cc=_['map'](db['OpenchannelInteraction'][_0xb981('0x1f')],function(_0x29182c){return{'name':_0x29182c[_0xb981('0x20')],'type':_0x29182c['type'][_0xb981('0x21')]};});_0x839420=qs['getOptions'](_0x3f32cc,_0x352048);return interaction[_0xb981('0x22')]('openchannel',_0x352048['query'],_0x352048['user'],_0x839420,_0x3f32cc)[_0xb981('0x23')](respondWithFilteredResult(_0xc917df,_0x839420))[_0xb981('0x24')](handleError(_0xc917df,null));};exports['show']=function(_0x37c5e6,_0x44c982){var _0x46252c={};if(_0x37c5e6['query'][_0xb981('0x25')]&&_0x37c5e6[_0xb981('0x26')]['type']===_0xb981('0x27')){_0x46252c[_0xb981('0x27')]=_0x37c5e6[_0xb981('0x28')]['id'];}else{_0x46252c['id']=_0x37c5e6[_0xb981('0x28')]['id'];}var _0x512aa2={'raw':![],'where':_0x46252c},_0x41f16c={};_0x41f16c['model']=_[_0xb981('0x29')](db[_0xb981('0x2a')][_0xb981('0x1f')]);_0x41f16c[_0xb981('0x26')]=_['keys'](_0x37c5e6['query']);_0x41f16c['filters']=_[_0xb981('0x2b')](_0x41f16c[_0xb981('0x2c')],_0x41f16c[_0xb981('0x26')]);_0x512aa2[_0xb981('0x2d')]=_[_0xb981('0x2b')](_0x41f16c[_0xb981('0x2c')],qs[_0xb981('0x2e')](_0x37c5e6[_0xb981('0x26')][_0xb981('0x2e')]));_0x512aa2['attributes']=_0x512aa2[_0xb981('0x2d')][_0xb981('0x2f')]?_0x512aa2[_0xb981('0x2d')]:_0x41f16c[_0xb981('0x2c')];if(_0x37c5e6[_0xb981('0x26')][_0xb981('0x30')]){_0x512aa2[_0xb981('0x31')]=[{'all':!![]}];}_0x512aa2=_[_0xb981('0x32')]({},_0x512aa2,_0x37c5e6[_0xb981('0x33')]);return db['OpenchannelInteraction'][_0xb981('0x34')](_0x512aa2)[_0xb981('0x23')](handleEntityNotFound(_0x44c982,null))[_0xb981('0x23')](respondWithResult(_0x44c982,null))['catch'](handleError(_0x44c982,null));};exports[_0xb981('0x35')]=function(_0x341a56,_0x10dfe1){return db[_0xb981('0x2a')][_0xb981('0x35')](_0x341a56['body'],{})[_0xb981('0x23')](respondWithResult(_0x10dfe1,0xc9))['catch'](handleError(_0x10dfe1,null));};exports[_0xb981('0x18')]=function(_0x4f80ae,_0x42fad3){if(_0x4f80ae[_0xb981('0x36')]['id']){delete _0x4f80ae[_0xb981('0x36')]['id'];}return db[_0xb981('0x2a')][_0xb981('0x34')]({'where':{'id':_0x4f80ae['params']['id']}})[_0xb981('0x23')](handleEntityNotFound(_0x42fad3,null))['then'](saveUpdates(_0x4f80ae['body'],null))['then'](respondWithResult(_0x42fad3,null))[_0xb981('0x24')](handleError(_0x42fad3,null));};exports[_0xb981('0x19')]=function(_0xdb88b1,_0x534b3c){return db[_0xb981('0x2a')][_0xb981('0x34')]({'where':{'id':_0xdb88b1['params']['id']}})[_0xb981('0x23')](handleEntityNotFound(_0x534b3c,null))[_0xb981('0x23')](removeEntity(_0x534b3c,null))['catch'](handleError(_0x534b3c,null));};exports['describe']=function(_0x5b3555,_0x349354){return db[_0xb981('0x2a')][_0xb981('0x37')]()[_0xb981('0x23')](respondWithResult(_0x349354,null))[_0xb981('0x24')](handleError(_0x349354,null));};exports[_0xb981('0x38')]=function(_0x34a77b,_0x2c71c3){return db[_0xb981('0x39')][_0xb981('0x34')]({'where':{'id':_0x34a77b[_0xb981('0x28')]['id']}})[_0xb981('0x23')](handleEntityNotFound(_0x2c71c3,null))['then'](function(_0x24f821){if(_0x24f821){return _0x24f821[_0xb981('0x38')](_0x34a77b[_0xb981('0x36')][_0xb981('0x3a')],_[_0xb981('0x3b')](_0x34a77b['body'],[_0xb981('0x3a'),'id'])||{});}})['then'](respondWithResult(_0x2c71c3,null))[_0xb981('0x24')](handleError(_0x2c71c3,null));};exports[_0xb981('0x3c')]=function(_0x516f86,_0x5e3400){var _0x406ee5={'raw':![],'where':{}};var _0xb2ddae={};var _0xc490c7={'count':0x0,'rows':[]};return db['OpenchannelInteraction']['findOne']({'where':{'id':_0x516f86[_0xb981('0x28')]['id']}})[_0xb981('0x23')](handleEntityNotFound(_0x5e3400,null))[_0xb981('0x23')](function(_0x32efd7){if(_0x32efd7){_0xb2ddae[_0xb981('0x2c')]=_[_0xb981('0x29')](db[_0xb981('0x39')][_0xb981('0x1f')]);_0xb2ddae[_0xb981('0x26')]=_[_0xb981('0x29')](_0x516f86['query']);_0xb2ddae[_0xb981('0x3d')]=_[_0xb981('0x2b')](_0xb2ddae['model'],_0xb2ddae['query']);_0x406ee5[_0xb981('0x2d')]=_[_0xb981('0x2b')](_0xb2ddae[_0xb981('0x2c')],qs[_0xb981('0x2e')](_0x516f86[_0xb981('0x26')]['fields']));_0x406ee5[_0xb981('0x2d')]=_0x406ee5[_0xb981('0x2d')][_0xb981('0x2f')]?_0x406ee5[_0xb981('0x2d')]:_0xb2ddae[_0xb981('0x2c')];if(!_0x516f86['query'][_0xb981('0x3e')](_0xb981('0x3f'))){_0x406ee5[_0xb981('0x15')]=qs[_0xb981('0x15')](_0x516f86[_0xb981('0x26')][_0xb981('0x15')]);_0x406ee5['offset']=qs[_0xb981('0x14')](_0x516f86[_0xb981('0x26')][_0xb981('0x14')]);}_0x406ee5['order']=qs[_0xb981('0x40')](_0x516f86[_0xb981('0x26')][_0xb981('0x40')]);_0x406ee5[_0xb981('0x41')]=qs[_0xb981('0x3d')](_[_0xb981('0x42')](_0x516f86[_0xb981('0x26')],_0xb2ddae[_0xb981('0x3d')]));_0x406ee5[_0xb981('0x41')][_0xb981('0x43')]=_0x32efd7['id'];if(_0x516f86[_0xb981('0x26')]['filter']){_0x406ee5[_0xb981('0x41')]=_[_0xb981('0x32')](_0x406ee5[_0xb981('0x41')],{'$or':_['map'](_0x406ee5[_0xb981('0x2d')],function(_0x136ca2){var _0x13b5fc={};_0x13b5fc[_0x136ca2]={'$like':'%'+_0x516f86[_0xb981('0x26')]['filter']+'%'};return _0x13b5fc;})});}if(_0x516f86['query'][_0xb981('0x44')]){var _0x1c347b=_0x516f86['query'][_0xb981('0x44')][_0xb981('0x45')](',');var _0x4acaf3={};_0x4acaf3[_0x1c347b[0x0]]={'$gte':moment(_0x1c347b[0x1])[_0xb981('0x46')](_0xb981('0x47'))};_0x406ee5[_0xb981('0x41')]=_[_0xb981('0x32')](_0x406ee5[_0xb981('0x41')],_0x4acaf3);}_0x406ee5=_[_0xb981('0x32')]({},_0x406ee5,_0x516f86['options']);return db[_0xb981('0x39')]['count']({'where':_0x406ee5['where']})[_0xb981('0x23')](function(_0x1b18ce){_0xc490c7[_0xb981('0x13')]=_0x1b18ce;if(_0x516f86[_0xb981('0x26')][_0xb981('0x30')]){_0x406ee5[_0xb981('0x31')]=[{'all':!![]}];}return db[_0xb981('0x39')]['findAll'](_0x406ee5);})['then'](function(_0x47bfb3){_0xc490c7[_0xb981('0x48')]=_0x47bfb3;return _0xc490c7;});}})[_0xb981('0x23')](respondWithFilteredResult(_0x5e3400,_0x406ee5))[_0xb981('0x24')](handleError(_0x5e3400,null));};exports[_0xb981('0x49')]=function(_0x25f53e,_0x1d3936){return db[_0xb981('0x2a')]['find']({'where':{'id':_0x25f53e[_0xb981('0x28')]['id']}})['then'](handleEntityNotFound(_0x1d3936,null))[_0xb981('0x23')](function(_0x4ba5db){if(_0x4ba5db){return _0x4ba5db['setTags'](_0x25f53e[_0xb981('0x36')][_0xb981('0x3a')],_[_0xb981('0x3b')](_0x25f53e[_0xb981('0x36')],[_0xb981('0x3a'),'id'])||{})[_0xb981('0x4a')](function(){return db[_0xb981('0x4b')]['findAll']({'attributes':['id',_0xb981('0x1c'),_0xb981('0x4c')],'where':{'id':_0x25f53e[_0xb981('0x36')][_0xb981('0x3a')]}});})[_0xb981('0x23')](function(_0x4a6a99){socket[_0xb981('0x4d')]('openchannelInteractionTags:save',{'id':Number(_0x25f53e['params']['id']),'tags':_0x4a6a99||[]});return{'id':Number(_0x25f53e['params']['id']),'tags':_0x4a6a99||[]};});}})['then'](respondWithResult(_0x1d3936,null))[_0xb981('0x24')](handleError(_0x1d3936,null));};exports[_0xb981('0x4e')]=function(_0x3d4c22,_0x2cff19){return db['OpenchannelInteraction'][_0xb981('0x34')]({'where':{'id':_0x3d4c22['params']['id']}})['then'](handleEntityNotFound(_0x2cff19,null))[_0xb981('0x23')](function(_0x449871){if(_0x449871){return _0x449871[_0xb981('0x4e')](_0x3d4c22[_0xb981('0x26')][_0xb981('0x3a')]);}})['then'](respondWithStatusCode(_0x2cff19,null))['catch'](handleError(_0x2cff19,null));};exports[_0xb981('0x4f')]=function(_0x46f2a2,_0x1fc6c1){var _0x2371b5=moment()[_0xb981('0x50')]()[_0xb981('0x51')]();var _0x4d4378=path[_0xb981('0x52')](config[_0xb981('0x53')],_0xb981('0x54'),'files',_0xb981('0x55'));var _0x47dc12=path['join'](config['root'],'server',_0xb981('0x56'),'attachments');var _0x17fe7f=path['join'](_0x4d4378,_0x2371b5);var _0x484984=util[_0xb981('0x46')](_0xb981('0x57'),_0x46f2a2['params']['id'],_0x2371b5);var _0x54e6cb=path[_0xb981('0x52')](_0x4d4378,_0x484984);var _0x459975=[];_0x459975[_0xb981('0x58')]({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x459975[_0xb981('0x58')]({'model':db[_0xb981('0x59')],'as':_0xb981('0x5a'),'attributes':['id',_0xb981('0x5b'),_0xb981('0x5c')],'raw':!![]});if(_0x46f2a2[_0xb981('0x26')][_0xb981('0x5d')]){_0x459975[_0xb981('0x58')]({'model':db[_0xb981('0x5e')],'as':'Attachment','raw':!![]});}var _0x15bf8c=[{'model':db[_0xb981('0x39')],'as':_0xb981('0x5f'),'attributes':['id',_0xb981('0x36'),_0xb981('0x60'),_0xb981('0x61'),'secret','read'],'include':_0x459975}];_0x15bf8c[_0xb981('0x58')]({'model':db[_0xb981('0x62')],'as':'Account','attributes':['id',_0xb981('0x1c')]});_0x15bf8c['push']({'model':db[_0xb981('0x63')],'as':_0xb981('0x64'),'attributes':['id',_0xb981('0x65')]});return db[_0xb981('0x2a')][_0xb981('0x34')]({'where':{'id':_0x46f2a2[_0xb981('0x28')]['id']},'include':_0x15bf8c})[_0xb981('0x23')](handleEntityNotFound(_0x1fc6c1,null))['then'](function(_0x4996f3){if(_0x4996f3){var _0x127445=_0x4996f3[_0xb981('0x66')]({'plain':!![]});fs['mkdirSync'](_0x17fe7f);var _0x3fdc3f={'channel':_0xb981('0x67'),'account':_0x127445[_0xb981('0x68')][_0xb981('0x1c')],'agent':_0x127445[_0xb981('0x64')]?_0x127445[_0xb981('0x64')][_0xb981('0x65')]:_0xb981('0x69'),'createdAt':moment(_0x127445[_0xb981('0x60')])[_0xb981('0x46')](_0xb981('0x47'))['toString'](),'closedAt':_0x127445[_0xb981('0x6a')]?moment(_0x127445[_0xb981('0x6b')])['format'](_0xb981('0x47'))[_0xb981('0x51')]():'','disposition':_0x127445[_0xb981('0x6c')],'visibility':_0x127445[_0xb981('0x6d')]?'Public':_0xb981('0x6e'),'messages':_(_0x127445[_0xb981('0x5f')])['filter']({'secret':![]})[_0xb981('0x6f')](function(_0x4c6d5d){if(_0x4c6d5d[_0xb981('0x5e')]){var _0x379ddb=path[_0xb981('0x52')](_0x47dc12,_0x4c6d5d[_0xb981('0x5e')][_0xb981('0x70')]);if(fs[_0xb981('0x71')](_0x379ddb)){fs[_0xb981('0x72')](_0x379ddb)[_0xb981('0x73')](fs[_0xb981('0x74')](path[_0xb981('0x52')](_0x17fe7f,_0x4c6d5d['Attachment'][_0xb981('0x70')])));}}return{'date':moment(_0x4c6d5d['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x4c6d5d[_0xb981('0x61')]===_0xb981('0x75')?_0x4c6d5d[_0xb981('0x63')]?_0x4c6d5d[_0xb981('0x63')][_0xb981('0x65')]:_0xb981('0x76'):_0x4c6d5d[_0xb981('0x5a')][_0xb981('0x5b')]+(_0x4c6d5d[_0xb981('0x5a')][_0xb981('0x5c')]?'\x20'+_0x4c6d5d[_0xb981('0x5a')]['lastName']:''),'body':_0x4c6d5d[_0xb981('0x5e')]?_0x4c6d5d['Attachment'][_0xb981('0x70')]:_0x4c6d5d['body'],'direction':_0x4c6d5d['direction']===_0xb981('0x75')?'A':'C','secret':_0x4c6d5d[_0xb981('0x77')],'read':_0x4c6d5d[_0xb981('0x78')],'attachment':_0x4c6d5d['Attachment']};})['value']()};return ejs[_0xb981('0x79')](path[_0xb981('0x52')](config['root'],_0xb981('0x54'),'views',_0xb981('0x7a')),{'interaction':_0x3fdc3f})['then'](function(_0x49e545){var _0x18dd5a=path[_0xb981('0x52')](_0x17fe7f,_0xb981('0x7b')+_0x127445['id']+'-'+_0x2371b5+_0xb981('0x7c'));var _0x5a0f05={'path':_0x18dd5a,'channel':_0xb981('0x67'),'interactionId':_0x127445['id']};return pdf[_0xb981('0x7d')](_0x49e545,_0x5a0f05);})[_0xb981('0x23')](function(){return new Promise(function(_0x6139e9,_0x1cc2c9){zipdir(_0x17fe7f,{'saveTo':_0x54e6cb},function(_0x2d0a58,_0x297165){if(_0x2d0a58)return _0x1cc2c9(_0x2d0a58);return _0x6139e9(_0x297165);});})[_0xb981('0x23')](function(){return new Promise(function(_0x49e116,_0x716e8b){rimraf(_0x17fe7f,function(_0x28931e){if(_0x28931e)_0x716e8b(_0x28931e);return _0x49e116();});});})[_0xb981('0x23')](function(){return _0x1fc6c1[_0xb981('0x4f')](_0x54e6cb,_0x484984,function(_0x441a66){if(_0x441a66){logger[_0xb981('0x1a')]('Unable\x20to\x20delete\x20zip\x20file',_0x441a66);}else{fs['unlinkSync'](_0x54e6cb);}});});});}else{return _0x1fc6c1[_0xb981('0xe')](0xc8);}})[_0xb981('0x24')](handleError(_0x1fc6c1,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index ef96889..e57639f 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 _0xda73=['update','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners'];(function(_0x337ea1,_0x1e73df){var _0x49dbc3=function(_0x22c2a2){while(--_0x22c2a2){_0x337ea1['push'](_0x337ea1['shift']());}};_0x49dbc3(++_0x1e73df);}(_0xda73,0x194));var _0x3da7=function(_0x498d98,_0x20e104){_0x498d98=_0x498d98-0x0;var _0x5ac025=_0xda73[_0x498d98];return _0x5ac025;};'use strict';var EventEmitter=require(_0x3da7('0x0'));var OpenchannelInteraction=require(_0x3da7('0x1'))['db'][_0x3da7('0x2')];var OpenchannelMessage=require(_0x3da7('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x3da7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3da7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1bb445){return function(_0x5a310d,_0x1c2db5,_0xf9564f){_0x5a310d[_0x3da7('0x5')]({'attributes':['id'],'raw':!![]})[_0x3da7('0x6')](function(_0x6d94d){_0x5a310d[_0x3da7('0x7')]('Users',_0x6d94d[_0x3da7('0x8')](function(_0x3ec683){return{'id':_0x3ec683['id']};}));return OpenchannelMessage[_0x3da7('0x9')]({'where':{'OpenchannelInteractionId':_0x5a310d['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x469a75){_0x5a310d[_0x3da7('0x7')](_0x3da7('0xa'),_0x469a75[_0x3da7('0xb')]);OpenchannelInteractionEvents[_0x3da7('0xc')](_0x1bb445+':'+_0x5a310d['id'],_0x5a310d);OpenchannelInteractionEvents['emit'](_0x1bb445,_0x5a310d);_0xf9564f(null);})[_0x3da7('0xd')](_0xf9564f(null));};}for(var e in events){if(events[_0x3da7('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x3da7('0xf')](e,emitEvent(event));}}module[_0x3da7('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xd1ca=['then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','getUsers'];(function(_0x17d713,_0x19b690){var _0x452666=function(_0xaff2b4){while(--_0xaff2b4){_0x17d713['push'](_0x17d713['shift']());}};_0x452666(++_0x19b690);}(_0xd1ca,0x180));var _0xad1c=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xd1ca[_0x16b9ed];return _0x66b1f8;};'use strict';var EventEmitter=require(_0xad1c('0x0'));var OpenchannelInteraction=require(_0xad1c('0x1'))['db'][_0xad1c('0x2')];var OpenchannelMessage=require(_0xad1c('0x1'))['db'][_0xad1c('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xad1c('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xad1c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x10b527){return function(_0x30253a,_0x5c00d6,_0x535725){_0x30253a[_0xad1c('0x6')]({'attributes':['id'],'raw':!![]})[_0xad1c('0x7')](function(_0x3eb768){_0x30253a[_0xad1c('0x8')]('Users',_0x3eb768[_0xad1c('0x9')](function(_0x5d5513){return{'id':_0x5d5513['id']};}));return OpenchannelMessage[_0xad1c('0xa')]({'where':{'OpenchannelInteractionId':_0x30253a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xad1c('0x7')](function(_0x209e82){_0x30253a['setDataValue'](_0xad1c('0xb'),_0x209e82[_0xad1c('0xc')]);OpenchannelInteractionEvents['emit'](_0x10b527+':'+_0x30253a['id'],_0x30253a);OpenchannelInteractionEvents[_0xad1c('0xd')](_0x10b527,_0x30253a);_0x535725(null);})[_0xad1c('0xe')](_0x535725(null));};}for(var e in events){if(events[_0xad1c('0xf')](e)){var event=events[e];OpenchannelInteraction[_0xad1c('0x10')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 2db49d5..70e079f 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 _0x8c97=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','util'];(function(_0x77d323,_0x43d5cf){var _0x458ba0=function(_0x557e0a){while(--_0x557e0a){_0x77d323['push'](_0x77d323['shift']());}};_0x458ba0(++_0x43d5cf);}(_0x8c97,0x158));var _0x78c9=function(_0x403216,_0x391051){_0x403216=_0x403216-0x0;var _0x1c8ea9=_0x8c97[_0x403216];return _0x1c8ea9;};'use strict';var _=require('lodash');var util=require(_0x78c9('0x0'));var logger=require(_0x78c9('0x1'))(_0x78c9('0x2'));var moment=require(_0x78c9('0x3'));var BPromise=require('bluebird');var rp=require(_0x78c9('0x4'));var fs=require('fs');var path=require(_0x78c9('0x5'));var rimraf=require(_0x78c9('0x6'));var config=require(_0x78c9('0x7'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x36a59c,_0x145e59){return _0x36a59c[_0x78c9('0x8')](_0x78c9('0x9'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x78c9('0xa'),'collate':_0x78c9('0xb'),'hooks':{'beforeUpdate':function(_0x45ce41,_0x11baed,_0x4f3da9){if(_0x45ce41[_0x78c9('0xc')](_0x78c9('0xd'))){_0x45ce41[_0x78c9('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x4f3da9(null,_0x45ce41);}}});}; \ No newline at end of file +var _0x31e5=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x31e5,0x164));var _0x531e=function(_0x35adb1,_0x290436){_0x35adb1=_0x35adb1-0x0;var _0x466e8a=_0x31e5[_0x35adb1];return _0x466e8a;};'use strict';var _=require(_0x531e('0x0'));var util=require(_0x531e('0x1'));var logger=require(_0x531e('0x2'))(_0x531e('0x3'));var moment=require(_0x531e('0x4'));var BPromise=require(_0x531e('0x5'));var rp=require(_0x531e('0x6'));var fs=require('fs');var path=require(_0x531e('0x7'));var rimraf=require(_0x531e('0x8'));var config=require(_0x531e('0x9'));var attributes=require(_0x531e('0xa'));module[_0x531e('0xb')]=function(_0x56c309,_0xba5754){return _0x56c309[_0x531e('0xc')](_0x531e('0xd'),attributes,{'tableName':_0x531e('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x531e('0xf'),'hooks':{'beforeUpdate':function(_0x15be20,_0xc28df0,_0x3794fc){if(_0x15be20[_0x531e('0x10')](_0x531e('0x11'))){_0x15be20[_0x531e('0x12')]=moment()[_0x531e('0x13')](_0x531e('0x14'));}_0x3794fc(null,_0x15be20);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index e530e5e..662899a 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 _0xa033=['error','code','message','info','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','options','raw','where','attributes','limit','stringify','AddTagsToOpenchannelInteraction','find','addTags','body','omit','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','then','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xa033,0xbe));var _0x3a03=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa033[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3a03('0x0'));var moment=require(_0x3a03('0x1'));var BPromise=require(_0x3a03('0x2'));var rs=require(_0x3a03('0x3'));var fs=require('fs');var Redis=require(_0x3a03('0x4'));var db=require(_0x3a03('0x5'))['db'];var utils=require(_0x3a03('0x6'));var logger=require(_0x3a03('0x7'))(_0x3a03('0x8'));var config=require(_0x3a03('0x9'));var jayson=require(_0x3a03('0xa'));var client=jayson[_0x3a03('0xb')][_0x3a03('0xc')]({'port':0x232a});config[_0x3a03('0xd')]=_['defaults'](config[_0x3a03('0xd')],{'host':_0x3a03('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3a03('0xd')]));require('./openchannelInteraction.socket')[_0x3a03('0xf')](socket);function respondWithRpcPromise(_0x5b6434,_0x36087a,_0x3df39f){return new BPromise(function(_0xa917f3,_0x4570d4){return client['request'](_0x5b6434,_0x3df39f)[_0x3a03('0x10')](function(_0x5a6369){logger['info'](_0x3a03('0x11'),_0x36087a,'request\x20sent');logger[_0x3a03('0x12')](_0x3a03('0x13'),_0x36087a,'request\x20sent',JSON['stringify'](_0x5a6369));if(_0x5a6369[_0x3a03('0x14')]){if(_0x5a6369[_0x3a03('0x14')][_0x3a03('0x15')]===0x1f4){logger[_0x3a03('0x14')](_0x3a03('0x11'),_0x36087a,_0x5a6369[_0x3a03('0x14')][_0x3a03('0x16')]);return _0x4570d4(_0x5a6369[_0x3a03('0x14')]['message']);}logger[_0x3a03('0x14')](_0x3a03('0x11'),_0x36087a,_0x5a6369[_0x3a03('0x14')][_0x3a03('0x16')]);return _0xa917f3(_0x5a6369[_0x3a03('0x14')][_0x3a03('0x16')]);}else{logger[_0x3a03('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x36087a,'request\x20sent');_0xa917f3(_0x5a6369[_0x3a03('0x18')][_0x3a03('0x16')]);}})[_0x3a03('0x19')](function(_0x2bc4c0){logger[_0x3a03('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x36087a,_0x2bc4c0);_0x4570d4(_0x2bc4c0);});});}exports[_0x3a03('0x1a')]=function(_0x3c15af){var _0x22f1cd=this;return new Promise(function(_0x412e04,_0x5b156d){return db[_0x3a03('0x1b')]['update'](_0x3c15af['body'],{'raw':_0x3c15af[_0x3a03('0x1c')]?_0x3c15af[_0x3a03('0x1c')][_0x3a03('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c15af[_0x3a03('0x1c')]?_0x3c15af[_0x3a03('0x1c')][_0x3a03('0x1e')]||null:null,'attributes':_0x3c15af['options']?_0x3c15af['options'][_0x3a03('0x1f')]||null:null,'limit':_0x3c15af[_0x3a03('0x1c')]?_0x3c15af[_0x3a03('0x1c')][_0x3a03('0x20')]||null:null})[_0x3a03('0x10')](function(_0x5bb5b4){logger[_0x3a03('0x17')](_0x3a03('0x1a'),_0x3c15af);logger[_0x3a03('0x12')](_0x3a03('0x1a'),_0x3c15af,JSON[_0x3a03('0x21')](_0x5bb5b4));_0x412e04(_0x5bb5b4);})[_0x3a03('0x19')](function(_0x354ec3){logger[_0x3a03('0x14')]('UpdateOpenchannelInteraction',_0x354ec3['message'],_0x3c15af);_0x5b156d(_0x22f1cd['error'](0x1f4,_0x354ec3[_0x3a03('0x16')]));});});};exports[_0x3a03('0x22')]=function(_0x3656fc){return new Promise(function(_0x216cb1,_0xf72c74){return db[_0x3a03('0x1b')][_0x3a03('0x23')]({'where':_0x3656fc[_0x3a03('0x1c')]?_0x3656fc[_0x3a03('0x1c')][_0x3a03('0x1e')]||null:null})[_0x3a03('0x10')](function(_0xf0d2ac){if(_0xf0d2ac){return _0xf0d2ac[_0x3a03('0x24')](_0x3656fc[_0x3a03('0x25')]['ids'],_[_0x3a03('0x26')](_0x3656fc[_0x3a03('0x25')],[_0x3a03('0x27'),'id'])||{});}})[_0x3a03('0x28')](function(_0x49156b){logger[_0x3a03('0x17')](_0x3a03('0x29'),_0x3656fc);logger['debug'](_0x3a03('0x29'),_0x3656fc,JSON['stringify'](_0x49156b));_0x216cb1(_0x49156b);})[_0x3a03('0x19')](function(_0x4ece1a){logger[_0x3a03('0x14')](_0x3a03('0x29'),_0x4ece1a[_0x3a03('0x16')],_0x3656fc);_0xf72c74(_this[_0x3a03('0x14')](0x1f4,_0x4ece1a[_0x3a03('0x16')]));});});}; \ No newline at end of file +var _0x7121=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','request','then','info','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','attributes','debug','find','ids','omit','spread','AddTags'];(function(_0x390b7c,_0x43ef0c){var _0x30bfc5=function(_0x419787){while(--_0x419787){_0x390b7c['push'](_0x390b7c['shift']());}};_0x30bfc5(++_0x43ef0c);}(_0x7121,0x1bc));var _0x1712=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x7121[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x1712('0x0'));var util=require('util');var moment=require(_0x1712('0x1'));var BPromise=require(_0x1712('0x2'));var rs=require(_0x1712('0x3'));var fs=require('fs');var Redis=require(_0x1712('0x4'));var db=require(_0x1712('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1712('0x6'));var config=require('../../config/environment');var jayson=require(_0x1712('0x7'));var client=jayson[_0x1712('0x8')][_0x1712('0x9')]({'port':0x232a});config[_0x1712('0xa')]=_[_0x1712('0xb')](config[_0x1712('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1712('0xa')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x5598a2,_0x532538,_0x3b1d03){return new BPromise(function(_0xbf83bf,_0x2785a1){return client[_0x1712('0xc')](_0x5598a2,_0x3b1d03)[_0x1712('0xd')](function(_0x56b294){logger[_0x1712('0xe')]('OpenchannelInteraction,\x20%s,\x20%s',_0x532538,_0x1712('0xf'));logger['debug'](_0x1712('0x10'),_0x532538,_0x1712('0xf'),JSON[_0x1712('0x11')](_0x56b294));if(_0x56b294['error']){if(_0x56b294[_0x1712('0x12')][_0x1712('0x13')]===0x1f4){logger[_0x1712('0x12')](_0x1712('0x14'),_0x532538,_0x56b294[_0x1712('0x12')][_0x1712('0x15')]);return _0x2785a1(_0x56b294[_0x1712('0x12')]['message']);}logger[_0x1712('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x532538,_0x56b294[_0x1712('0x12')]['message']);return _0xbf83bf(_0x56b294[_0x1712('0x12')][_0x1712('0x15')]);}else{logger['info'](_0x1712('0x14'),_0x532538,_0x1712('0xf'));_0xbf83bf(_0x56b294[_0x1712('0x16')][_0x1712('0x15')]);}})[_0x1712('0x17')](function(_0x57d4d6){logger[_0x1712('0x12')](_0x1712('0x14'),_0x532538,_0x57d4d6);_0x2785a1(_0x57d4d6);});});}exports[_0x1712('0x18')]=function(_0x3efac0){var _0x535e8f=this;return new Promise(function(_0x88923,_0x4138bc){return db[_0x1712('0x19')][_0x1712('0x1a')](_0x3efac0[_0x1712('0x1b')],{'raw':_0x3efac0[_0x1712('0x1c')]?_0x3efac0['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3efac0[_0x1712('0x1c')]?_0x3efac0['options'][_0x1712('0x1d')]||null:null,'attributes':_0x3efac0[_0x1712('0x1c')]?_0x3efac0[_0x1712('0x1c')][_0x1712('0x1e')]||null:null,'limit':_0x3efac0[_0x1712('0x1c')]?_0x3efac0[_0x1712('0x1c')]['limit']||null:null})[_0x1712('0xd')](function(_0x564e41){logger[_0x1712('0xe')]('UpdateOpenchannelInteraction',_0x3efac0);logger[_0x1712('0x1f')]('UpdateOpenchannelInteraction',_0x3efac0,JSON[_0x1712('0x11')](_0x564e41));_0x88923(_0x564e41);})[_0x1712('0x17')](function(_0x46a37f){logger[_0x1712('0x12')](_0x1712('0x18'),_0x46a37f[_0x1712('0x15')],_0x3efac0);_0x4138bc(_0x535e8f[_0x1712('0x12')](0x1f4,_0x46a37f[_0x1712('0x15')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x299401){return new Promise(function(_0x24801f,_0x4d7502){return db[_0x1712('0x19')][_0x1712('0x20')]({'where':_0x299401[_0x1712('0x1c')]?_0x299401[_0x1712('0x1c')]['where']||null:null})[_0x1712('0xd')](function(_0x1b7f8f){if(_0x1b7f8f){return _0x1b7f8f['addTags'](_0x299401[_0x1712('0x1b')][_0x1712('0x21')],_[_0x1712('0x22')](_0x299401['body'],[_0x1712('0x21'),'id'])||{});}})[_0x1712('0x23')](function(_0x1dfceb){logger[_0x1712('0xe')](_0x1712('0x24'),_0x299401);logger[_0x1712('0x1f')]('AddTags',_0x299401,JSON[_0x1712('0x11')](_0x1dfceb));_0x24801f(_0x1dfceb);})['catch'](function(_0x20b78a){logger['error'](_0x1712('0x24'),_0x20b78a[_0x1712('0x15')],_0x299401);_0x4d7502(_this['error'](0x1f4,_0x20b78a[_0x1712('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index d53224f..f25521e 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 _0xe079=['length','./openchannelInteraction.events','save','remove','update','removeListener','register'];(function(_0x58f5df,_0x139a13){var _0x2e461c=function(_0x1da549){while(--_0x1da549){_0x58f5df['push'](_0x58f5df['shift']());}};_0x2e461c(++_0x139a13);}(_0xe079,0xd3));var _0x9e07=function(_0x485ead,_0x20c85d){_0x485ead=_0x485ead-0x0;var _0x11a1eb=_0xe079[_0x485ead];return _0x11a1eb;};'use strict';var OpenchannelInteractionEvents=require(_0x9e07('0x0'));var events=[_0x9e07('0x1'),_0x9e07('0x2'),_0x9e07('0x3')];function createListener(_0x2dc165,_0x256f92){return function(_0x32e7a8){_0x256f92['emit'](_0x2dc165,_0x32e7a8);};}function removeListener(_0x1ed05e,_0x35b234){return function(){OpenchannelInteractionEvents[_0x9e07('0x4')](_0x1ed05e,_0x35b234);};}exports[_0x9e07('0x5')]=function(_0x37681a){for(var _0x48bda9=0x0,_0xce4ec5=events[_0x9e07('0x6')];_0x48bda9<_0xce4ec5;_0x48bda9++){var _0x5d8b36=events[_0x48bda9];var _0x19b471=createListener('openchannelInteraction:'+_0x5d8b36,_0x37681a);OpenchannelInteractionEvents['on'](_0x5d8b36,_0x19b471);}}; \ No newline at end of file +var _0x80af=['save','remove','removeListener','register','length','./openchannelInteraction.events'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x80af,0x167));var _0xf80a=function(_0x169b57,_0x520132){_0x169b57=_0x169b57-0x0;var _0x2671f3=_0x80af[_0x169b57];return _0x2671f3;};'use strict';var OpenchannelInteractionEvents=require(_0xf80a('0x0'));var events=[_0xf80a('0x1'),_0xf80a('0x2'),'update'];function createListener(_0x39a0ea,_0x499f1e){return function(_0x254416){_0x499f1e['emit'](_0x39a0ea,_0x254416);};}function removeListener(_0x46d949,_0xda5157){return function(){OpenchannelInteractionEvents[_0xf80a('0x3')](_0x46d949,_0xda5157);};}exports[_0xf80a('0x4')]=function(_0x2459a4){for(var _0x2ca28b=0x0,_0x32bb48=events[_0xf80a('0x5')];_0x2ca28b<_0x32bb48;_0x2ca28b++){var _0x148240=events[_0x2ca28b];var _0x1d523=createListener('openchannelInteraction:'+_0x148240,_0x2459a4);OpenchannelInteractionEvents['on'](_0x148240,_0x1d523);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index e80f743..a76f047 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 _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x57cda2,_0x24da77){var _0x5a1749=function(_0x4a2bea){while(--_0x4a2bea){_0x57cda2['push'](_0x57cda2['shift']());}};_0x5a1749(++_0x24da77);}(_0x9c44,0x178));var _0x49c4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9c44[_0x1d1779];return _0x2377e9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file +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(_0x5520c7,_0xbee449){var _0x3b0590=function(_0x1bb4f9){while(--_0x1bb4f9){_0x5520c7['push'](_0x5520c7['shift']());}};_0x3b0590(++_0xbee449);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x81e39d,_0x4c3934){_0x81e39d=_0x81e39d-0x0;var _0x548fbb=_0xcb91[_0x81e39d];return _0x548fbb;};'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 diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 7323111..11ccad9 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 _0x3f8c=['medium','BOOLEAN','TEXT'];(function(_0x4b2d46,_0x5990fb){var _0x15ee19=function(_0x3fc1a5){while(--_0x3fc1a5){_0x4b2d46['push'](_0x4b2d46['shift']());}};_0x15ee19(++_0x5990fb);}(_0x3f8c,0x104));var _0xc3f8=function(_0x13aeca,_0x13b265){_0x13aeca=_0x13aeca-0x0;var _0x5110f=_0x3f8c[_0x13aeca];return _0x5110f;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xc3f8('0x0')](_0xc3f8('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xc3f8('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc3f8('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc3f8('0x0')]}}; \ No newline at end of file +var _0xcecc=['sequelize','TEXT','BOOLEAN','ENUM','out'];(function(_0x4cb0d4,_0x4531b8){var _0x3c8ddc=function(_0x24304f){while(--_0x24304f){_0x4cb0d4['push'](_0x4cb0d4['shift']());}};_0x3c8ddc(++_0x4531b8);}(_0xcecc,0x186));var _0xccec=function(_0x3f7f79,_0x2ae01d){_0x3f7f79=_0x3f7f79-0x0;var _0x2bed58=_0xcecc[_0x3f7f79];return _0x2bed58;};'use strict';var Sequelize=require(_0xccec('0x0'));module['exports']={'body':{'type':Sequelize[_0xccec('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xccec('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xccec('0x3')]('in',_0xccec('0x4')),'defaultValue':_0xccec('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xccec('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 12ef173..fd38d59 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 _0x91ea=['interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','reject','interaction','rejectMessage','Sequelize','QueryTypes','User','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','client','http','request','info','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','end','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','show','params','find','create','body','describe','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','get','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','contact','fullname','email','internal','manual'];(function(_0x9b2bb0,_0x3965b1){var _0x2cdb3b=function(_0x177d75){while(--_0x177d75){_0x9b2bb0['push'](_0x9b2bb0['shift']());}};_0x2cdb3b(++_0x3965b1);}(_0x91ea,0x92));var _0xa91e=function(_0x576b83,_0x40c990){_0x576b83=_0x576b83-0x0;var _0x38c2ef=_0x91ea[_0x576b83];return _0x38c2ef;};'use strict';var emlformat=require(_0xa91e('0x0'));var rimraf=require(_0xa91e('0x1'));var zipdir=require(_0xa91e('0x2'));var jsonpatch=require(_0xa91e('0x3'));var rp=require(_0xa91e('0x4'));var moment=require(_0xa91e('0x5'));var BPromise=require(_0xa91e('0x6'));var Mustache=require(_0xa91e('0x7'));var util=require('util');var path=require(_0xa91e('0x8'));var sox=require(_0xa91e('0x9'));var csv=require(_0xa91e('0xa'));var ejs=require(_0xa91e('0xb'));var fs=require('fs');var fs_extra=require(_0xa91e('0xc'));var _=require(_0xa91e('0xd'));var squel=require(_0xa91e('0xe'));var crypto=require(_0xa91e('0xf'));var jsforce=require(_0xa91e('0x10'));var deskjs=require(_0xa91e('0x11'));var toCsv=require(_0xa91e('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa91e('0x12'));var authService=require(_0xa91e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa91e('0x14'));var hardwareService=require(_0xa91e('0x15'));var logger=require(_0xa91e('0x16'))('api');var utils=require(_0xa91e('0x17'));var config=require(_0xa91e('0x18'));var licenseUtil=require(_0xa91e('0x19'));var db=require(_0xa91e('0x1a'))['db'];config[_0xa91e('0x1b')]=_[_0xa91e('0x1c')](config[_0xa91e('0x1b')],{'host':_0xa91e('0x1d'),'port':0x18eb});var socket=require(_0xa91e('0x1e'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xa91e('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xa91e('0x1f')][_0xa91e('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x149155,_0x27396e,_0x5de25e,_0x19d04f){return new BPromise(function(_0x4e4eb3,_0x4cdd8d){var _0x4bb1e1=_0x19d04f||client;return _0x4bb1e1[_0xa91e('0x21')](_0x149155,_0x5de25e)['then'](function(_0x69eab4){logger[_0xa91e('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x27396e,_0xa91e('0x23'));logger['debug'](_0xa91e('0x24'),_0x27396e,_0xa91e('0x23'),JSON['stringify'](_0x69eab4));if(_0x69eab4['error']){if(_0x69eab4[_0xa91e('0x25')][_0xa91e('0x26')]===0x1f4){logger[_0xa91e('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x27396e,_0x69eab4[_0xa91e('0x25')]['message']);return _0x4cdd8d(_0x69eab4[_0xa91e('0x25')]['message']);}logger[_0xa91e('0x25')](_0xa91e('0x27'),_0x27396e,_0x69eab4[_0xa91e('0x25')][_0xa91e('0x28')]);return _0x4e4eb3(_0x69eab4[_0xa91e('0x25')][_0xa91e('0x28')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x27396e,_0xa91e('0x23'));_0x4e4eb3(_0x69eab4[_0xa91e('0x29')]['message']);}})[_0xa91e('0x2a')](function(_0x51764a){logger[_0xa91e('0x25')](_0xa91e('0x27'),_0x27396e,_0x51764a);_0x4cdd8d(_0x51764a);});});}function respondWithStatusCode(_0x500496,_0x4eb4f5){_0x4eb4f5=_0x4eb4f5||0xcc;return function(_0x59be28){if(_0x59be28){return _0x500496[_0xa91e('0x2b')](_0x4eb4f5);}return _0x500496['status'](_0x4eb4f5)['end']();};}function respondWithResult(_0x43c32a,_0x215fb9){_0x215fb9=_0x215fb9||0xc8;return function(_0x20f82e){if(_0x20f82e){return _0x43c32a[_0xa91e('0x2c')](_0x215fb9)[_0xa91e('0x2d')](_0x20f82e);}};}function respondWithFilteredResult(_0xfc547,_0x22393b){return function(_0x5f4450){if(_0x5f4450){var _0x31966c=typeof _0x22393b[_0xa91e('0x2e')]===_0xa91e('0x2f')&&typeof _0x22393b['limit']==='undefined';var _0x3d40d6=_0x5f4450[_0xa91e('0x30')];var _0x2f7463=_0x31966c?0x0:_0x22393b[_0xa91e('0x2e')];var _0x435a7a=_0x31966c?_0x5f4450[_0xa91e('0x30')]:_0x22393b[_0xa91e('0x2e')]+_0x22393b[_0xa91e('0x31')];var _0xececae;if(_0x435a7a>=_0x3d40d6){_0x435a7a=_0x3d40d6;_0xececae=0xc8;}else{_0xececae=0xce;}_0xfc547['status'](_0xececae);return _0xfc547['set'](_0xa91e('0x32'),_0x2f7463+'-'+_0x435a7a+'/'+_0x3d40d6)['json'](_0x5f4450);}return null;};}function patchUpdates(_0x8fa9c){return function(_0x52e2fa){try{jsonpatch[_0xa91e('0x33')](_0x52e2fa,_0x8fa9c,!![]);}catch(_0x240826){return BPromise['reject'](_0x240826);}return _0x52e2fa[_0xa91e('0x34')]();};}function saveUpdates(_0xc751ea,_0x54d0ff){return function(_0x3c8a84){if(_0x3c8a84){return _0x3c8a84[_0xa91e('0x35')](_0xc751ea)[_0xa91e('0x36')](function(_0x414e7a){return _0x414e7a;});}return null;};}function removeEntity(_0x159f48,_0x58fc8f){return function(_0x2f6213){if(_0x2f6213){return _0x2f6213[_0xa91e('0x37')]()[_0xa91e('0x36')](function(){_0x159f48[_0xa91e('0x2c')](0xcc)[_0xa91e('0x38')]();});}};}function handleEntityNotFound(_0x11e513,_0x4b7f7e){return function(_0x1f4211){if(!_0x1f4211){_0x11e513[_0xa91e('0x2b')](0x194);}return _0x1f4211;};}function handleError(_0x1313b7,_0x39f50b){_0x39f50b=_0x39f50b||0x1f4;return function(_0x4a3949){logger[_0xa91e('0x25')](_0x4a3949[_0xa91e('0x39')]);if(_0x4a3949[_0xa91e('0x3a')]){delete _0x4a3949['name'];}_0x1313b7['status'](_0x39f50b)[_0xa91e('0x3b')](_0x4a3949);};}exports[_0xa91e('0x3c')]=function(_0x2e1cc0,_0xb8c1ce){var _0x32e6f3={},_0x4a528f={},_0x346b8c={'count':0x0,'rows':[]};var _0xdb2f37=_['map'](db[_0xa91e('0x3d')][_0xa91e('0x3e')],function(_0x175641){return{'name':_0x175641[_0xa91e('0x3f')],'type':_0x175641[_0xa91e('0x40')][_0xa91e('0x41')]};});_0x4a528f[_0xa91e('0x42')]=_[_0xa91e('0x43')](_0xdb2f37,_0xa91e('0x3a'));_0x4a528f[_0xa91e('0x44')]=_[_0xa91e('0x45')](_0x2e1cc0['query']);_0x4a528f[_0xa91e('0x46')]=_[_0xa91e('0x47')](_0x4a528f[_0xa91e('0x42')],_0x4a528f['query']);_0x32e6f3[_0xa91e('0x48')]=_[_0xa91e('0x47')](_0x4a528f[_0xa91e('0x42')],qs['fields'](_0x2e1cc0[_0xa91e('0x44')][_0xa91e('0x49')]));_0x32e6f3[_0xa91e('0x48')]=_0x32e6f3[_0xa91e('0x48')][_0xa91e('0x4a')]?_0x32e6f3['attributes']:_0x4a528f[_0xa91e('0x42')];if(!_0x2e1cc0[_0xa91e('0x44')][_0xa91e('0x4b')](_0xa91e('0x4c'))){_0x32e6f3['limit']=qs[_0xa91e('0x31')](_0x2e1cc0[_0xa91e('0x44')][_0xa91e('0x31')]);_0x32e6f3[_0xa91e('0x2e')]=qs[_0xa91e('0x2e')](_0x2e1cc0['query'][_0xa91e('0x2e')]);}_0x32e6f3[_0xa91e('0x4d')]=qs[_0xa91e('0x4e')](_0x2e1cc0['query'][_0xa91e('0x4e')]);_0x32e6f3[_0xa91e('0x4f')]=qs[_0xa91e('0x46')](_[_0xa91e('0x50')](_0x2e1cc0['query'],_0x4a528f[_0xa91e('0x46')]),_0xdb2f37);if(_0x2e1cc0[_0xa91e('0x44')][_0xa91e('0x51')]){_0x32e6f3[_0xa91e('0x4f')]=_['merge'](_0x32e6f3[_0xa91e('0x4f')],{'$or':_[_0xa91e('0x43')](_0xdb2f37,function(_0x136c19){if(_0x136c19[_0xa91e('0x40')]!==_0xa91e('0x52')){var _0x4efabb={};_0x4efabb[_0x136c19[_0xa91e('0x3a')]]={'$like':'%'+_0x2e1cc0[_0xa91e('0x44')][_0xa91e('0x51')]+'%'};return _0x4efabb;}})});}_0x32e6f3=_[_0xa91e('0x53')]({},_0x32e6f3,_0x2e1cc0[_0xa91e('0x54')]);var _0x34ac61={'where':_0x32e6f3[_0xa91e('0x4f')]};return db[_0xa91e('0x3d')][_0xa91e('0x30')](_0x34ac61)[_0xa91e('0x36')](function(_0xe49420){_0x346b8c[_0xa91e('0x30')]=_0xe49420;if(_0x2e1cc0[_0xa91e('0x44')][_0xa91e('0x55')]){_0x32e6f3[_0xa91e('0x56')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x32e6f3);})[_0xa91e('0x36')](function(_0x1d5280){_0x346b8c['rows']=_0x1d5280;return _0x346b8c;})[_0xa91e('0x36')](respondWithFilteredResult(_0xb8c1ce,_0x32e6f3))[_0xa91e('0x2a')](handleError(_0xb8c1ce,null));};exports[_0xa91e('0x57')]=function(_0x372033,_0x4f52eb){var _0x16a1d0={'raw':!![],'where':{'id':_0x372033[_0xa91e('0x58')]['id']}},_0x1b110a={};_0x1b110a['model']=_[_0xa91e('0x45')](db['OpenchannelMessage']['rawAttributes']);_0x1b110a[_0xa91e('0x44')]=_[_0xa91e('0x45')](_0x372033[_0xa91e('0x44')]);_0x1b110a['filters']=_[_0xa91e('0x47')](_0x1b110a[_0xa91e('0x42')],_0x1b110a[_0xa91e('0x44')]);_0x16a1d0[_0xa91e('0x48')]=_[_0xa91e('0x47')](_0x1b110a['model'],qs['fields'](_0x372033['query']['fields']));_0x16a1d0[_0xa91e('0x48')]=_0x16a1d0[_0xa91e('0x48')][_0xa91e('0x4a')]?_0x16a1d0[_0xa91e('0x48')]:_0x1b110a[_0xa91e('0x42')];if(_0x372033[_0xa91e('0x44')][_0xa91e('0x55')]){_0x16a1d0[_0xa91e('0x56')]=[{'all':!![]}];}_0x16a1d0=_[_0xa91e('0x53')]({},_0x16a1d0,_0x372033[_0xa91e('0x54')]);return db[_0xa91e('0x3d')][_0xa91e('0x59')](_0x16a1d0)[_0xa91e('0x36')](handleEntityNotFound(_0x4f52eb,null))[_0xa91e('0x36')](respondWithResult(_0x4f52eb,null))[_0xa91e('0x2a')](handleError(_0x4f52eb,null));};exports[_0xa91e('0x5a')]=function(_0x2c726a,_0x231d78){return db[_0xa91e('0x3d')][_0xa91e('0x5a')](_0x2c726a['body'],{})[_0xa91e('0x36')](respondWithResult(_0x231d78,0xc9))[_0xa91e('0x2a')](handleError(_0x231d78,null));};exports[_0xa91e('0x35')]=function(_0x46b4c5,_0x2b06e0){if(_0x46b4c5[_0xa91e('0x5b')]['id']){delete _0x46b4c5[_0xa91e('0x5b')]['id'];}return db[_0xa91e('0x3d')][_0xa91e('0x59')]({'where':{'id':_0x46b4c5['params']['id']}})[_0xa91e('0x36')](handleEntityNotFound(_0x2b06e0,null))[_0xa91e('0x36')](saveUpdates(_0x46b4c5['body'],null))[_0xa91e('0x36')](respondWithResult(_0x2b06e0,null))['catch'](handleError(_0x2b06e0,null));};exports[_0xa91e('0x37')]=function(_0x1eb7e9,_0x21afa9){return db['OpenchannelMessage'][_0xa91e('0x59')]({'where':{'id':_0x1eb7e9[_0xa91e('0x58')]['id']}})[_0xa91e('0x36')](handleEntityNotFound(_0x21afa9,null))[_0xa91e('0x36')](removeEntity(_0x21afa9,null))[_0xa91e('0x2a')](handleError(_0x21afa9,null));};exports[_0xa91e('0x5c')]=function(_0x3c84c5,_0x3ac6ad){return db[_0xa91e('0x3d')][_0xa91e('0x5c')]()['then'](respondWithResult(_0x3ac6ad,null))[_0xa91e('0x2a')](handleError(_0x3ac6ad,null));};var interaction_log=require(_0xa91e('0x16'))('openchannel-interactions');exports[_0xa91e('0x5d')]=function(_0x1e38ad,_0x29f59a,_0x5f32e4){var _0x433924={'agent':{},'channel':_0xa91e('0x5e')};if(_0x1e38ad[_0xa91e('0x5b')]['id']){delete _0x1e38ad['body']['id'];}_0x1e38ad['body'][_0xa91e('0x5f')]=!![];_0x1e38ad['body'][_0xa91e('0x60')]=moment()[_0xa91e('0x61')](_0xa91e('0x62'));_0x1e38ad[_0xa91e('0x5b')][_0xa91e('0x63')]=_0x1e38ad['body'][_0xa91e('0x63')]||_0x1e38ad[_0xa91e('0x64')]['id'];_0x433924[_0xa91e('0x65')]['id']=_0x1e38ad[_0xa91e('0x5b')][_0xa91e('0x63')];return db[_0xa91e('0x3d')][_0xa91e('0x59')]({'where':{'id':_0x1e38ad['params']['id'],'UserId':null}})[_0xa91e('0x36')](handleEntityNotFound(_0x29f59a,null))['then'](saveUpdates(_0x1e38ad[_0xa91e('0x5b')],null))['then'](function(_0x4d4df0){if(_0x4d4df0){_0x433924[_0xa91e('0x28')]=_0x4d4df0['get']({'plain':!![]});return db[_0xa91e('0x66')]['find']({'where':{'id':_0x4d4df0[_0xa91e('0x67')]}});}return null;})[_0xa91e('0x36')](handleEntityNotFound(_0x29f59a,null))[_0xa91e('0x36')](function(_0x31385f){if(_0x31385f){return _0x31385f[_0xa91e('0x35')]({'UserId':_0x1e38ad['body'][_0xa91e('0x63')],'read1stAt':_['isNil'](_0x31385f[_0xa91e('0x68')])?moment()['format'](_0xa91e('0x62')):undefined});}return null;})[_0xa91e('0x36')](function(_0x851210){if(_0x851210){_0x433924['interaction']=_0x851210[_0xa91e('0x69')]({'plain':!![]});interaction_log[_0xa91e('0x22')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1e38ad['user']['id'],_0x1e38ad['user'][_0xa91e('0x3a')],_0x1e38ad[_0xa91e('0x64')][_0xa91e('0x6a')],_0x433924['interaction']['id'],_0x1e38ad[_0xa91e('0x5b')]?JSON[_0xa91e('0x6b')](_0x1e38ad[_0xa91e('0x5b')]):_0xa91e('0x6c'));return respondWithRpcPromise(_0xa91e('0x6d'),_0xa91e('0x6e'),_0x433924);}return null;})[_0xa91e('0x36')](function(_0x3b7815){var _0x1a276a=_0xa91e('0x6f')+_0x3b7815[_0xa91e('0x28')][_0xa91e('0x70')];return db[_0xa91e('0x71')]['query'](_0x1a276a,{'type':db['Sequelize']['QueryTypes'][_0xa91e('0x72')],'raw':!![]})['then'](function(_0x16417c){return _0x16417c;});})[_0xa91e('0x36')](function(_0x337595){if(_0x337595){_0x433924[_0xa91e('0x28')][_0xa91e('0x73')]=_0x337595[0x0];if(!_0x1e38ad[_0xa91e('0x5b')][_0xa91e('0x63')])return;return db['User'][_0xa91e('0x59')]({'where':{'id':_0x1e38ad[_0xa91e('0x5b')][_0xa91e('0x63')],'role':'agent'},'attributes':['id',_0xa91e('0x3a'),_0xa91e('0x74'),_0xa91e('0x75'),_0xa91e('0x76')],'raw':!![]});}return null;})[_0xa91e('0x36')](function(_0x387cbc){if(!_0x387cbc)return null;_0x433924[_0xa91e('0x28')][_0xa91e('0x65')]=_0x387cbc;return _0x433924;})[_0xa91e('0x36')](function(_0x405d70){if(_0x405d70){if(_0x1e38ad[_0xa91e('0x5b')][_0xa91e('0x77')]){_0x433924[_0xa91e('0x28')][_0xa91e('0x78')]=util[_0xa91e('0x61')](_0xa91e('0x79'),_0x1e38ad[_0xa91e('0x64')]['name']);_0x433924['message'][_0xa91e('0x7a')]=_0x433924[_0xa91e('0x7a')];_0x433924[_0xa91e('0x28')][_0xa91e('0x7b')]=_0x433924[_0xa91e('0x7a')];_0x433924[_0xa91e('0x28')]['event']=_0xa91e('0x5d');return respondWithRpcPromise(_0xa91e('0x7c'),_0xa91e('0x7c'),{'event':_0xa91e('0x7d'),'message':_0x433924[_0xa91e('0x28')]},client9002)[_0xa91e('0x36')](function(){return _0x433924;});}return _0x433924;}return null;})['then'](respondWithResult(_0x29f59a,null))[_0xa91e('0x2a')](handleError(_0x29f59a,null));};var interaction_log=require(_0xa91e('0x16'))('openchannel-interactions');exports[_0xa91e('0x7e')]=function(_0x135151,_0x29ec9c,_0x272508){var _0x27be5e={'agent':{},'channel':_0xa91e('0x5e')};if(_0x135151[_0xa91e('0x5b')]['id']){delete _0x135151[_0xa91e('0x5b')]['id'];}_0x135151[_0xa91e('0x5b')][_0xa91e('0x63')]=_0x135151[_0xa91e('0x5b')][_0xa91e('0x63')]||_0x135151[_0xa91e('0x64')]['id'];_0x27be5e[_0xa91e('0x65')]['id']=_0x135151[_0xa91e('0x5b')][_0xa91e('0x63')];return db['OpenchannelMessage']['find']({'where':{'id':_0x135151[_0xa91e('0x58')]['id'],'UserId':null}})[_0xa91e('0x36')](handleEntityNotFound(_0x29ec9c,null))[_0xa91e('0x36')](function(_0x2e628e){if(_0x2e628e){_0x27be5e[_0xa91e('0x28')]=_0x2e628e[_0xa91e('0x69')]({'plain':!![]});return db['OpenchannelInteraction'][_0xa91e('0x59')]({'where':{'id':_0x2e628e[_0xa91e('0x67')]}});}return null;})[_0xa91e('0x36')](handleEntityNotFound(_0x29ec9c,null))['then'](function(_0x46d223){if(_0x46d223){_0x27be5e[_0xa91e('0x7f')]=_0x46d223[_0xa91e('0x69')]({'plain':!![]});interaction_log[_0xa91e('0x22')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x135151[_0xa91e('0x64')]['id'],_0x135151['user'][_0xa91e('0x3a')],_0x135151[_0xa91e('0x64')][_0xa91e('0x6a')],_0x27be5e[_0xa91e('0x7f')]['id'],_0x135151[_0xa91e('0x5b')]?JSON[_0xa91e('0x6b')](_0x135151['body']):_0xa91e('0x6c'));return respondWithRpcPromise('RejectMessage',_0xa91e('0x80'),_0x27be5e);}return null;})['then'](function(_0x4e4406){var _0x3561f8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e4406[_0xa91e('0x28')][_0xa91e('0x70')];return db[_0xa91e('0x71')][_0xa91e('0x44')](_0x3561f8,{'type':db[_0xa91e('0x81')][_0xa91e('0x82')][_0xa91e('0x72')],'raw':!![]})[_0xa91e('0x36')](function(_0x4572d5){return _0x4572d5;});})[_0xa91e('0x36')](function(_0x564bb3){if(_0x564bb3){_0x27be5e['message'][_0xa91e('0x73')]=_0x564bb3[0x0];if(!_0x135151[_0xa91e('0x5b')][_0xa91e('0x63')])return;return db[_0xa91e('0x83')][_0xa91e('0x59')]({'where':{'id':_0x135151[_0xa91e('0x5b')][_0xa91e('0x63')],'role':_0xa91e('0x65')},'attributes':['id','name',_0xa91e('0x74'),_0xa91e('0x75'),'internal'],'raw':!![]});}return null;})[_0xa91e('0x36')](function(_0x4bde40){if(!_0x4bde40)return null;_0x27be5e[_0xa91e('0x28')][_0xa91e('0x65')]=_0x4bde40;return _0x27be5e;})[_0xa91e('0x36')](function(_0x1c0d1c){if(_0x1c0d1c){_0x1c0d1c[_0xa91e('0x28')]['interface']=util[_0xa91e('0x61')](_0xa91e('0x79'),_0x135151['user']['name']);_0x1c0d1c[_0xa91e('0x28')][_0xa91e('0x7a')]=_0x27be5e[_0xa91e('0x7a')];_0x1c0d1c['message']['motionChannel']=_0x27be5e[_0xa91e('0x7a')];_0x1c0d1c['message']['event']=_0xa91e('0x7e');respondWithRpcPromise(_0xa91e('0x7c'),_0xa91e('0x7c'),{'event':_0xa91e('0x84'),'message':_0x1c0d1c[_0xa91e('0x28')]},client9002);return _0x27be5e;}return null;})[_0xa91e('0x36')](respondWithResult(_0x29ec9c,null))[_0xa91e('0x2a')](handleError(_0x29ec9c,null));}; \ No newline at end of file +var _0xb3f7=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./openchannelMessage.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','OpenchannelMessage','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','params','create','body','find','describe','openchannel-interactions','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','isNil','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','event','accept','acceptmessage','OpenchannelInteractionId','RejectMessage','rejectMessage','ContactId','Sequelize','SIP/%s','EventManager','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb3f7,0x10a));var _0x7b3f=function(_0x1cfceb,_0x43a781){_0x1cfceb=_0x1cfceb-0x0;var _0x5e76f5=_0xb3f7[_0x1cfceb];return _0x5e76f5;};'use strict';var emlformat=require(_0x7b3f('0x0'));var rimraf=require(_0x7b3f('0x1'));var zipdir=require(_0x7b3f('0x2'));var jsonpatch=require(_0x7b3f('0x3'));var rp=require('request-promise');var moment=require(_0x7b3f('0x4'));var BPromise=require(_0x7b3f('0x5'));var Mustache=require(_0x7b3f('0x6'));var util=require(_0x7b3f('0x7'));var path=require(_0x7b3f('0x8'));var sox=require(_0x7b3f('0x9'));var csv=require(_0x7b3f('0xa'));var ejs=require(_0x7b3f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7b3f('0xc'));var deskjs=require(_0x7b3f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7b3f('0xe'));var Redis=require(_0x7b3f('0xf'));var authService=require(_0x7b3f('0x10'));var qs=require(_0x7b3f('0x11'));var as=require(_0x7b3f('0x12'));var hardwareService=require(_0x7b3f('0x13'));var logger=require(_0x7b3f('0x14'))(_0x7b3f('0x15'));var utils=require(_0x7b3f('0x16'));var config=require(_0x7b3f('0x17'));var licenseUtil=require(_0x7b3f('0x18'));var db=require('../../mysqldb')['db'];config[_0x7b3f('0x19')]=_[_0x7b3f('0x1a')](config[_0x7b3f('0x19')],{'host':_0x7b3f('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7b3f('0x19')]));require(_0x7b3f('0x1c'))[_0x7b3f('0x1d')](socket);var jayson=require(_0x7b3f('0x1e'));var client=jayson[_0x7b3f('0x1f')][_0x7b3f('0x20')]({'port':0x232c});var client9002=jayson[_0x7b3f('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14a95c,_0x2b3ab6,_0x11672f,_0x216186){return new BPromise(function(_0x2f2ec0,_0x5cbd1e){var _0x14ef90=_0x216186||client;return _0x14ef90['request'](_0x14a95c,_0x11672f)[_0x7b3f('0x21')](function(_0x3982c5){logger[_0x7b3f('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x2b3ab6,_0x7b3f('0x23'));logger[_0x7b3f('0x24')](_0x7b3f('0x25'),_0x2b3ab6,_0x7b3f('0x23'),JSON[_0x7b3f('0x26')](_0x3982c5));if(_0x3982c5['error']){if(_0x3982c5[_0x7b3f('0x27')][_0x7b3f('0x28')]===0x1f4){logger[_0x7b3f('0x27')](_0x7b3f('0x29'),_0x2b3ab6,_0x3982c5['error'][_0x7b3f('0x2a')]);return _0x5cbd1e(_0x3982c5[_0x7b3f('0x27')][_0x7b3f('0x2a')]);}logger['error'](_0x7b3f('0x29'),_0x2b3ab6,_0x3982c5[_0x7b3f('0x27')][_0x7b3f('0x2a')]);return _0x2f2ec0(_0x3982c5[_0x7b3f('0x27')]['message']);}else{logger[_0x7b3f('0x22')](_0x7b3f('0x29'),_0x2b3ab6,_0x7b3f('0x23'));_0x2f2ec0(_0x3982c5[_0x7b3f('0x2b')]['message']);}})[_0x7b3f('0x2c')](function(_0x47c7f3){logger[_0x7b3f('0x27')](_0x7b3f('0x29'),_0x2b3ab6,_0x47c7f3);_0x5cbd1e(_0x47c7f3);});});}function respondWithStatusCode(_0x54b802,_0xf1af62){_0xf1af62=_0xf1af62||0xcc;return function(_0x42c594){if(_0x42c594){return _0x54b802[_0x7b3f('0x2d')](_0xf1af62);}return _0x54b802[_0x7b3f('0x2e')](_0xf1af62)[_0x7b3f('0x2f')]();};}function respondWithResult(_0x2ef5a0,_0x21c3fa){_0x21c3fa=_0x21c3fa||0xc8;return function(_0x517db8){if(_0x517db8){return _0x2ef5a0[_0x7b3f('0x2e')](_0x21c3fa)[_0x7b3f('0x30')](_0x517db8);}};}function respondWithFilteredResult(_0x1bdf43,_0x1f7e41){return function(_0xd9a061){if(_0xd9a061){var _0x5a2b2c=typeof _0x1f7e41[_0x7b3f('0x31')]===_0x7b3f('0x32')&&typeof _0x1f7e41[_0x7b3f('0x33')]===_0x7b3f('0x32');var _0x3b98b7=_0xd9a061[_0x7b3f('0x34')];var _0x53d6e1=_0x5a2b2c?0x0:_0x1f7e41[_0x7b3f('0x31')];var _0x1b929d=_0x5a2b2c?_0xd9a061[_0x7b3f('0x34')]:_0x1f7e41['offset']+_0x1f7e41[_0x7b3f('0x33')];var _0x101dad;if(_0x1b929d>=_0x3b98b7){_0x1b929d=_0x3b98b7;_0x101dad=0xc8;}else{_0x101dad=0xce;}_0x1bdf43['status'](_0x101dad);return _0x1bdf43[_0x7b3f('0x35')](_0x7b3f('0x36'),_0x53d6e1+'-'+_0x1b929d+'/'+_0x3b98b7)[_0x7b3f('0x30')](_0xd9a061);}return null;};}function patchUpdates(_0x12eda9){return function(_0x133fa7){try{jsonpatch[_0x7b3f('0x37')](_0x133fa7,_0x12eda9,!![]);}catch(_0xfa6b4d){return BPromise[_0x7b3f('0x38')](_0xfa6b4d);}return _0x133fa7[_0x7b3f('0x39')]();};}function saveUpdates(_0x3d26ec,_0xd03c3a){return function(_0x2959bd){if(_0x2959bd){return _0x2959bd[_0x7b3f('0x3a')](_0x3d26ec)['then'](function(_0x19fb97){return _0x19fb97;});}return null;};}function removeEntity(_0x4e5fc0,_0x532770){return function(_0x44519a){if(_0x44519a){return _0x44519a[_0x7b3f('0x3b')]()[_0x7b3f('0x21')](function(){_0x4e5fc0[_0x7b3f('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ff0df,_0x58afae){return function(_0x1e50c5){if(!_0x1e50c5){_0x1ff0df['sendStatus'](0x194);}return _0x1e50c5;};}function handleError(_0x1e430e,_0x26c7e7){_0x26c7e7=_0x26c7e7||0x1f4;return function(_0x52d90c){logger[_0x7b3f('0x27')](_0x52d90c[_0x7b3f('0x3c')]);if(_0x52d90c[_0x7b3f('0x3d')]){delete _0x52d90c[_0x7b3f('0x3d')];}_0x1e430e[_0x7b3f('0x2e')](_0x26c7e7)[_0x7b3f('0x3e')](_0x52d90c);};}exports['index']=function(_0x198b71,_0x434799){var _0x4f6e4a={},_0x485312={},_0x576092={'count':0x0,'rows':[]};var _0x2dbf58=_[_0x7b3f('0x3f')](db[_0x7b3f('0x40')][_0x7b3f('0x41')],function(_0x151c7b){return{'name':_0x151c7b['fieldName'],'type':_0x151c7b[_0x7b3f('0x42')][_0x7b3f('0x43')]};});_0x485312['model']=_[_0x7b3f('0x3f')](_0x2dbf58,'name');_0x485312[_0x7b3f('0x44')]=_[_0x7b3f('0x45')](_0x198b71[_0x7b3f('0x44')]);_0x485312[_0x7b3f('0x46')]=_[_0x7b3f('0x47')](_0x485312[_0x7b3f('0x48')],_0x485312['query']);_0x4f6e4a[_0x7b3f('0x49')]=_['intersection'](_0x485312['model'],qs[_0x7b3f('0x4a')](_0x198b71[_0x7b3f('0x44')]['fields']));_0x4f6e4a[_0x7b3f('0x49')]=_0x4f6e4a[_0x7b3f('0x49')][_0x7b3f('0x4b')]?_0x4f6e4a[_0x7b3f('0x49')]:_0x485312[_0x7b3f('0x48')];if(!_0x198b71[_0x7b3f('0x44')][_0x7b3f('0x4c')]('nolimit')){_0x4f6e4a[_0x7b3f('0x33')]=qs[_0x7b3f('0x33')](_0x198b71[_0x7b3f('0x44')][_0x7b3f('0x33')]);_0x4f6e4a[_0x7b3f('0x31')]=qs[_0x7b3f('0x31')](_0x198b71[_0x7b3f('0x44')]['offset']);}_0x4f6e4a['order']=qs[_0x7b3f('0x4d')](_0x198b71['query']['sort']);_0x4f6e4a[_0x7b3f('0x4e')]=qs[_0x7b3f('0x46')](_[_0x7b3f('0x4f')](_0x198b71[_0x7b3f('0x44')],_0x485312['filters']),_0x2dbf58);if(_0x198b71[_0x7b3f('0x44')][_0x7b3f('0x50')]){_0x4f6e4a[_0x7b3f('0x4e')]=_['merge'](_0x4f6e4a[_0x7b3f('0x4e')],{'$or':_[_0x7b3f('0x3f')](_0x2dbf58,function(_0x27bbbf){if(_0x27bbbf['type']!==_0x7b3f('0x51')){var _0x44179c={};_0x44179c[_0x27bbbf[_0x7b3f('0x3d')]]={'$like':'%'+_0x198b71[_0x7b3f('0x44')][_0x7b3f('0x50')]+'%'};return _0x44179c;}})});}_0x4f6e4a=_[_0x7b3f('0x52')]({},_0x4f6e4a,_0x198b71['options']);var _0x313ade={'where':_0x4f6e4a[_0x7b3f('0x4e')]};return db['OpenchannelMessage'][_0x7b3f('0x34')](_0x313ade)[_0x7b3f('0x21')](function(_0x23a0e0){_0x576092[_0x7b3f('0x34')]=_0x23a0e0;if(_0x198b71[_0x7b3f('0x44')][_0x7b3f('0x53')]){_0x4f6e4a[_0x7b3f('0x54')]=[{'all':!![]}];}return db[_0x7b3f('0x40')][_0x7b3f('0x55')](_0x4f6e4a);})[_0x7b3f('0x21')](function(_0x21ce89){_0x576092[_0x7b3f('0x56')]=_0x21ce89;return _0x576092;})[_0x7b3f('0x21')](respondWithFilteredResult(_0x434799,_0x4f6e4a))[_0x7b3f('0x2c')](handleError(_0x434799,null));};exports['show']=function(_0x4c5e91,_0x20790e){var _0xe7fdcd={'raw':!![],'where':{'id':_0x4c5e91[_0x7b3f('0x57')]['id']}},_0x5efb91={};_0x5efb91['model']=_[_0x7b3f('0x45')](db[_0x7b3f('0x40')][_0x7b3f('0x41')]);_0x5efb91[_0x7b3f('0x44')]=_[_0x7b3f('0x45')](_0x4c5e91['query']);_0x5efb91[_0x7b3f('0x46')]=_['intersection'](_0x5efb91[_0x7b3f('0x48')],_0x5efb91[_0x7b3f('0x44')]);_0xe7fdcd[_0x7b3f('0x49')]=_[_0x7b3f('0x47')](_0x5efb91[_0x7b3f('0x48')],qs['fields'](_0x4c5e91[_0x7b3f('0x44')][_0x7b3f('0x4a')]));_0xe7fdcd[_0x7b3f('0x49')]=_0xe7fdcd['attributes'][_0x7b3f('0x4b')]?_0xe7fdcd[_0x7b3f('0x49')]:_0x5efb91[_0x7b3f('0x48')];if(_0x4c5e91[_0x7b3f('0x44')][_0x7b3f('0x53')]){_0xe7fdcd[_0x7b3f('0x54')]=[{'all':!![]}];}_0xe7fdcd=_[_0x7b3f('0x52')]({},_0xe7fdcd,_0x4c5e91['options']);return db[_0x7b3f('0x40')]['find'](_0xe7fdcd)[_0x7b3f('0x21')](handleEntityNotFound(_0x20790e,null))[_0x7b3f('0x21')](respondWithResult(_0x20790e,null))[_0x7b3f('0x2c')](handleError(_0x20790e,null));};exports[_0x7b3f('0x58')]=function(_0x2172e2,_0x552fe4){return db['OpenchannelMessage'][_0x7b3f('0x58')](_0x2172e2['body'],{})[_0x7b3f('0x21')](respondWithResult(_0x552fe4,0xc9))[_0x7b3f('0x2c')](handleError(_0x552fe4,null));};exports['update']=function(_0xd7e4f0,_0x504bdf){if(_0xd7e4f0[_0x7b3f('0x59')]['id']){delete _0xd7e4f0[_0x7b3f('0x59')]['id'];}return db[_0x7b3f('0x40')][_0x7b3f('0x5a')]({'where':{'id':_0xd7e4f0['params']['id']}})[_0x7b3f('0x21')](handleEntityNotFound(_0x504bdf,null))[_0x7b3f('0x21')](saveUpdates(_0xd7e4f0[_0x7b3f('0x59')],null))['then'](respondWithResult(_0x504bdf,null))['catch'](handleError(_0x504bdf,null));};exports[_0x7b3f('0x3b')]=function(_0x4e35aa,_0x27dbb8){return db['OpenchannelMessage'][_0x7b3f('0x5a')]({'where':{'id':_0x4e35aa[_0x7b3f('0x57')]['id']}})[_0x7b3f('0x21')](handleEntityNotFound(_0x27dbb8,null))['then'](removeEntity(_0x27dbb8,null))['catch'](handleError(_0x27dbb8,null));};exports[_0x7b3f('0x5b')]=function(_0x383316,_0x149dd7){return db[_0x7b3f('0x40')][_0x7b3f('0x5b')]()[_0x7b3f('0x21')](respondWithResult(_0x149dd7,null))[_0x7b3f('0x2c')](handleError(_0x149dd7,null));};var interaction_log=require(_0x7b3f('0x14'))(_0x7b3f('0x5c'));exports['accept']=function(_0x4163fd,_0x301903,_0x278b70){var _0x554df5={'agent':{},'channel':_0x7b3f('0x5d')};if(_0x4163fd[_0x7b3f('0x59')]['id']){delete _0x4163fd['body']['id'];}_0x4163fd[_0x7b3f('0x59')][_0x7b3f('0x5e')]=!![];_0x4163fd[_0x7b3f('0x59')][_0x7b3f('0x5f')]=moment()[_0x7b3f('0x60')](_0x7b3f('0x61'));_0x4163fd[_0x7b3f('0x59')][_0x7b3f('0x62')]=_0x4163fd[_0x7b3f('0x59')]['UserId']||_0x4163fd[_0x7b3f('0x63')]['id'];_0x554df5[_0x7b3f('0x64')]['id']=_0x4163fd[_0x7b3f('0x59')][_0x7b3f('0x62')];return db['OpenchannelMessage'][_0x7b3f('0x5a')]({'where':{'id':_0x4163fd['params']['id'],'UserId':null}})[_0x7b3f('0x21')](handleEntityNotFound(_0x301903,null))[_0x7b3f('0x21')](saveUpdates(_0x4163fd[_0x7b3f('0x59')],null))['then'](function(_0x3680ff){if(_0x3680ff){_0x554df5[_0x7b3f('0x2a')]=_0x3680ff[_0x7b3f('0x65')]({'plain':!![]});return db[_0x7b3f('0x66')][_0x7b3f('0x5a')]({'where':{'id':_0x3680ff['OpenchannelInteractionId']}});}return null;})[_0x7b3f('0x21')](handleEntityNotFound(_0x301903,null))[_0x7b3f('0x21')](function(_0x481b1e){if(_0x481b1e){return _0x481b1e[_0x7b3f('0x3a')]({'UserId':_0x4163fd[_0x7b3f('0x59')]['UserId'],'read1stAt':_[_0x7b3f('0x67')](_0x481b1e[_0x7b3f('0x68')])?moment()[_0x7b3f('0x60')](_0x7b3f('0x61')):undefined});}return null;})[_0x7b3f('0x21')](function(_0xda83fa){if(_0xda83fa){_0x554df5['interaction']=_0xda83fa['get']({'plain':!![]});interaction_log[_0x7b3f('0x22')](_0x7b3f('0x69'),_0x4163fd['user']['id'],_0x4163fd['user'][_0x7b3f('0x3d')],_0x4163fd['user'][_0x7b3f('0x6a')],_0x554df5[_0x7b3f('0x6b')]['id'],_0x4163fd['body']?JSON['stringify'](_0x4163fd[_0x7b3f('0x59')]):_0x7b3f('0x6c'));return respondWithRpcPromise(_0x7b3f('0x6d'),_0x7b3f('0x6e'),_0x554df5);}return null;})['then'](function(_0x212d94){var _0x1c9a29=_0x7b3f('0x6f')+_0x212d94[_0x7b3f('0x2a')]['ContactId'];return db[_0x7b3f('0x70')][_0x7b3f('0x44')](_0x1c9a29,{'type':db['Sequelize'][_0x7b3f('0x71')][_0x7b3f('0x72')],'raw':!![]})[_0x7b3f('0x21')](function(_0x7658df){return _0x7658df;});})[_0x7b3f('0x21')](function(_0x3dac5e){if(_0x3dac5e){_0x554df5[_0x7b3f('0x2a')][_0x7b3f('0x73')]=_0x3dac5e[0x0];if(!_0x4163fd[_0x7b3f('0x59')][_0x7b3f('0x62')])return;return db[_0x7b3f('0x74')][_0x7b3f('0x5a')]({'where':{'id':_0x4163fd['body'][_0x7b3f('0x62')],'role':_0x7b3f('0x64')},'attributes':['id',_0x7b3f('0x3d'),_0x7b3f('0x75'),_0x7b3f('0x76'),_0x7b3f('0x77')],'raw':!![]});}return null;})[_0x7b3f('0x21')](function(_0x2654a6){if(!_0x2654a6)return null;_0x554df5[_0x7b3f('0x2a')][_0x7b3f('0x64')]=_0x2654a6;return _0x554df5;})['then'](function(_0x596c65){if(_0x596c65){if(_0x4163fd[_0x7b3f('0x59')][_0x7b3f('0x78')]){_0x554df5['message'][_0x7b3f('0x79')]=util[_0x7b3f('0x60')]('SIP/%s',_0x4163fd[_0x7b3f('0x63')][_0x7b3f('0x3d')]);_0x554df5[_0x7b3f('0x2a')][_0x7b3f('0x7a')]=_0x554df5[_0x7b3f('0x7a')];_0x554df5[_0x7b3f('0x2a')][_0x7b3f('0x7b')]=_0x554df5[_0x7b3f('0x7a')];_0x554df5[_0x7b3f('0x2a')][_0x7b3f('0x7c')]=_0x7b3f('0x7d');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x7b3f('0x7e'),'message':_0x554df5[_0x7b3f('0x2a')]},client9002)[_0x7b3f('0x21')](function(){return _0x554df5;});}return _0x554df5;}return null;})[_0x7b3f('0x21')](respondWithResult(_0x301903,null))[_0x7b3f('0x2c')](handleError(_0x301903,null));};var interaction_log=require(_0x7b3f('0x14'))(_0x7b3f('0x5c'));exports[_0x7b3f('0x38')]=function(_0x475684,_0x51c0f4,_0xf39f79){var _0x5e6d8a={'agent':{},'channel':_0x7b3f('0x5d')};if(_0x475684[_0x7b3f('0x59')]['id']){delete _0x475684[_0x7b3f('0x59')]['id'];}_0x475684['body'][_0x7b3f('0x62')]=_0x475684[_0x7b3f('0x59')]['UserId']||_0x475684[_0x7b3f('0x63')]['id'];_0x5e6d8a[_0x7b3f('0x64')]['id']=_0x475684[_0x7b3f('0x59')]['UserId'];return db['OpenchannelMessage'][_0x7b3f('0x5a')]({'where':{'id':_0x475684[_0x7b3f('0x57')]['id'],'UserId':null}})[_0x7b3f('0x21')](handleEntityNotFound(_0x51c0f4,null))[_0x7b3f('0x21')](function(_0x44858c){if(_0x44858c){_0x5e6d8a['message']=_0x44858c[_0x7b3f('0x65')]({'plain':!![]});return db[_0x7b3f('0x66')][_0x7b3f('0x5a')]({'where':{'id':_0x44858c[_0x7b3f('0x7f')]}});}return null;})[_0x7b3f('0x21')](handleEntityNotFound(_0x51c0f4,null))[_0x7b3f('0x21')](function(_0x3631d3){if(_0x3631d3){_0x5e6d8a['interaction']=_0x3631d3[_0x7b3f('0x65')]({'plain':!![]});interaction_log[_0x7b3f('0x22')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x475684[_0x7b3f('0x63')]['id'],_0x475684[_0x7b3f('0x63')][_0x7b3f('0x3d')],_0x475684[_0x7b3f('0x63')][_0x7b3f('0x6a')],_0x5e6d8a[_0x7b3f('0x6b')]['id'],_0x475684[_0x7b3f('0x59')]?JSON[_0x7b3f('0x26')](_0x475684[_0x7b3f('0x59')]):'null');return respondWithRpcPromise(_0x7b3f('0x80'),_0x7b3f('0x81'),_0x5e6d8a);}return null;})[_0x7b3f('0x21')](function(_0x506025){var _0x1b2a11=_0x7b3f('0x6f')+_0x506025[_0x7b3f('0x2a')][_0x7b3f('0x82')];return db[_0x7b3f('0x70')][_0x7b3f('0x44')](_0x1b2a11,{'type':db[_0x7b3f('0x83')][_0x7b3f('0x71')][_0x7b3f('0x72')],'raw':!![]})[_0x7b3f('0x21')](function(_0x41fc66){return _0x41fc66;});})[_0x7b3f('0x21')](function(_0x5a53b0){if(_0x5a53b0){_0x5e6d8a[_0x7b3f('0x2a')][_0x7b3f('0x73')]=_0x5a53b0[0x0];if(!_0x475684['body']['UserId'])return;return db['User'][_0x7b3f('0x5a')]({'where':{'id':_0x475684[_0x7b3f('0x59')]['UserId'],'role':_0x7b3f('0x64')},'attributes':['id',_0x7b3f('0x3d'),'fullname',_0x7b3f('0x76'),_0x7b3f('0x77')],'raw':!![]});}return null;})[_0x7b3f('0x21')](function(_0x59c24a){if(!_0x59c24a)return null;_0x5e6d8a[_0x7b3f('0x2a')]['agent']=_0x59c24a;return _0x5e6d8a;})[_0x7b3f('0x21')](function(_0x1f0e76){if(_0x1f0e76){_0x1f0e76[_0x7b3f('0x2a')][_0x7b3f('0x79')]=util[_0x7b3f('0x60')](_0x7b3f('0x84'),_0x475684['user'][_0x7b3f('0x3d')]);_0x1f0e76['message'][_0x7b3f('0x7a')]=_0x5e6d8a[_0x7b3f('0x7a')];_0x1f0e76[_0x7b3f('0x2a')][_0x7b3f('0x7b')]=_0x5e6d8a['channel'];_0x1f0e76[_0x7b3f('0x2a')][_0x7b3f('0x7c')]=_0x7b3f('0x38');respondWithRpcPromise('EventManager',_0x7b3f('0x85'),{'event':_0x7b3f('0x86'),'message':_0x1f0e76[_0x7b3f('0x2a')]},client9002);return _0x5e6d8a;}return null;})['then'](respondWithResult(_0x51c0f4,null))[_0x7b3f('0x2c')](handleError(_0x51c0f4,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index a2e3576..556c2ee 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 _0xc63f=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x49ca8c,_0x1fa230){var _0x188538=function(_0x2e2ca7){while(--_0x2e2ca7){_0x49ca8c['push'](_0x49ca8c['shift']());}};_0x188538(++_0x1fa230);}(_0xc63f,0x148));var _0xfc63=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc63f[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xfc63('0x0'));var OpenchannelMessage=require(_0xfc63('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xfc63('0x2')](0x0);var events={'afterCreate':_0xfc63('0x3'),'afterUpdate':_0xfc63('0x4'),'afterDestroy':_0xfc63('0x5')};function emitEvent(_0x4d7e25){return function(_0x2a0b12,_0x51ceae,_0x32ff53){OpenchannelMessageEvents[_0xfc63('0x6')](_0x4d7e25+':'+_0x2a0b12['id'],_0x2a0b12);OpenchannelMessageEvents[_0xfc63('0x6')](_0x4d7e25,_0x2a0b12);_0x32ff53(null);};}for(var e in events){if(events[_0xfc63('0x7')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xf2b6=['OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x291aaf,_0x4c6d8d){var _0x5571e6=function(_0x1b4fec){while(--_0x1b4fec){_0x291aaf['push'](_0x291aaf['shift']());}};_0x5571e6(++_0x4c6d8d);}(_0xf2b6,0xf8));var _0x6f2b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf2b6[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x6f2b('0x0'));var OpenchannelMessage=require(_0x6f2b('0x1'))['db'][_0x6f2b('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x6f2b('0x3')](0x0);var events={'afterCreate':_0x6f2b('0x4'),'afterUpdate':_0x6f2b('0x5'),'afterDestroy':_0x6f2b('0x6')};function emitEvent(_0x255e9e){return function(_0x225bf4,_0xccfd5e,_0x3cc734){OpenchannelMessageEvents[_0x6f2b('0x7')](_0x255e9e+':'+_0x225bf4['id'],_0x225bf4);OpenchannelMessageEvents['emit'](_0x255e9e,_0x225bf4);_0x3cc734(null);};}for(var e in events){if(events[_0x6f2b('0x8')](e)){var event=events[e];OpenchannelMessage[_0x6f2b('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 233b6a2..23902bf 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 _0x67a8=['method','GET','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','openchannel_messages','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','CmContact','Contact','keys','replyUri','info','afterCreate','format','length','Interaction','POST'];(function(_0x4a25cf,_0x147ae8){var _0x248ac6=function(_0x333b73){while(--_0x333b73){_0x4a25cf['push'](_0x4a25cf['shift']());}};_0x248ac6(++_0x147ae8);}(_0x67a8,0x1c1));var _0x867a=function(_0x4fd58a,_0x1bfea0){_0x4fd58a=_0x4fd58a-0x0;var _0x3dea76=_0x67a8[_0x4fd58a];return _0x3dea76;};'use strict';var _=require(_0x867a('0x0'));var util=require(_0x867a('0x1'));var logger=require(_0x867a('0x2'))(_0x867a('0x3'));var moment=require(_0x867a('0x4'));var BPromise=require(_0x867a('0x5'));var rp=require(_0x867a('0x6'));var fs=require('fs');var path=require(_0x867a('0x7'));var rimraf=require(_0x867a('0x8'));var config=require(_0x867a('0x9'));var attributes=require('./openchannelMessage.attributes');module[_0x867a('0xa')]=function(_0x56a950,_0x15644f){return _0x56a950[_0x867a('0xb')]('OpenchannelMessage',attributes,{'tableName':_0x867a('0xc'),'paranoid':![],'indexes':[{'name':_0x867a('0xd'),'fields':[_0x867a('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2cb5d4,_0x88691d,_0xf28ffc){var _0x591a87=_0x56a950[_0x867a('0xf')];var _0x2b2b80=_0x2cb5d4[_0x867a('0x10')]({'plain':!![]});if(_0x2b2b80[_0x867a('0x11')][_0x867a('0x12')]()==='in'||_0x2b2b80[_0x867a('0x11')][_0x867a('0x12')]()===_0x867a('0x13')&&!_0x2b2b80[_0x867a('0x14')]&&!_[_0x867a('0x15')](_0x2b2b80[_0x867a('0x16')])){_0x591a87[_0x867a('0x17')][_0x867a('0x18')]({'where':{'id':_0x2b2b80[_0x867a('0x19')]}})[_0x867a('0x1a')](function(_0x4e0e36){if(_0x4e0e36){_0x4e0e36[_0x867a('0x1b')]({'lastMsgAt':_0x2b2b80[_0x867a('0x1c')],'lastMsgDirection':_0x2b2b80['direction'][_0x867a('0x12')]()});}})[_0x867a('0x1d')](function(_0xec4baf){console[_0x867a('0x1e')](_0xec4baf);});}if(_0x2b2b80[_0x867a('0x11')]===_0x867a('0x13')&&!_0x2b2b80[_0x867a('0x14')]){var _0x551c01;_0x591a87['CmContact'][_0x867a('0x1f')]()[_0x867a('0x1a')](function(_0x10894e){return _0x591a87[_0x867a('0x20')][_0x867a('0x21')]({'where':{'id':_0x2b2b80[_0x867a('0x22')]},'include':[{'model':_0x591a87[_0x867a('0x17')],'as':_0x867a('0x23'),'where':{'id':_0x2b2b80['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x591a87[_0x867a('0x24')],'as':_0x867a('0x25'),'attributes':_[_0x867a('0x26')](_0x10894e)}]}]});})[_0x867a('0x1a')](function(_0x351dbe){_0x551c01=_0x351dbe['get']({'plain':!![]});if(_0x551c01&&_0x551c01[_0x867a('0x27')]){logger[_0x867a('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x867a('0x29'),util[_0x867a('0x2a')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x2b2b80['id'],_0x551c01[_0x867a('0x27')]));if(_0x551c01[_0x867a('0x23')]&&_0x551c01[_0x867a('0x23')][_0x867a('0x2b')]){_0x2b2b80[_0x867a('0x2c')]=_['omit'](_0x551c01['Interactions'][0x0],_0x867a('0x25'));_0x2b2b80[_0x867a('0x25')]=_0x551c01[_0x867a('0x23')][0x0][_0x867a('0x25')];}var _0x88691d={'method':_0x867a('0x2d'),'uri':encodeURI(_0x551c01[_0x867a('0x27')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x88691d[_0x867a('0x2e')]){case _0x867a('0x2f'):_0x88691d['qs']=_0x2b2b80;break;case _0x867a('0x2d'):_0x88691d[_0x867a('0xe')]=_0x2b2b80;break;}return rp(_0x88691d)['then'](function(_0x516c0e){logger[_0x867a('0x28')](_0x867a('0x30'),'afterCreate',util[_0x867a('0x2a')](_0x867a('0x31'),_0x2b2b80['id'],_0x551c01[_0x867a('0x27')]));if(_0x516c0e[_0x867a('0xe')][_0x867a('0x32')]&&_0x516c0e[_0x867a('0xe')][_0x867a('0x32')]!=_0x2b2b80[_0x867a('0x2c')][_0x867a('0x32')]){return _0x591a87['OpenchannelInteraction'][_0x867a('0x1b')]({'threadId':_0x516c0e['body'][_0x867a('0x32')]},{'where':{'id':_0x2b2b80[_0x867a('0x2c')]['id']}});}else{return;}})[_0x867a('0x1a')](function(){return _0x2cb5d4[_0x867a('0x1b')]({'read':!![]});})[_0x867a('0x1d')](function(_0xd9e25e){logger[_0x867a('0x1e')](_0x867a('0x30'),_0x867a('0x29'),util[_0x867a('0x33')](_0xd9e25e,{'showHidden':![],'depth':null}));_0xf28ffc();});}else{_0xf28ffc();}})[_0x867a('0x34')](function(){_0xf28ffc();});}else{_0xf28ffc();}}},'charset':_0x867a('0x35'),'collate':_0x867a('0x36')});}; \ No newline at end of file +var _0xc425=['get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','catch','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','CmContact','keys','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Contact','POST','method','GET','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models'];(function(_0x163da2,_0x4ef598){var _0x17edaf=function(_0x45af4b){while(--_0x45af4b){_0x163da2['push'](_0x163da2['shift']());}};_0x17edaf(++_0x4ef598);}(_0xc425,0x8d));var _0x5c42=function(_0x35891,_0x554518){_0x35891=_0x35891-0x0;var _0x192226=_0xc425[_0x35891];return _0x192226;};'use strict';var _=require(_0x5c42('0x0'));var util=require(_0x5c42('0x1'));var logger=require(_0x5c42('0x2'))(_0x5c42('0x3'));var moment=require(_0x5c42('0x4'));var BPromise=require(_0x5c42('0x5'));var rp=require(_0x5c42('0x6'));var fs=require('fs');var path=require(_0x5c42('0x7'));var rimraf=require(_0x5c42('0x8'));var config=require(_0x5c42('0x9'));var attributes=require(_0x5c42('0xa'));module['exports']=function(_0x3366f4,_0x272558){return _0x3366f4[_0x5c42('0xb')](_0x5c42('0xc'),attributes,{'tableName':_0x5c42('0xd'),'paranoid':![],'indexes':[{'name':_0x5c42('0xe'),'fields':[_0x5c42('0xf')],'type':_0x5c42('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x7a5e17,_0x5903c4,_0x1297a2){var _0x967694=_0x3366f4[_0x5c42('0x11')];var _0x21fea4=_0x7a5e17[_0x5c42('0x12')]({'plain':!![]});if(_0x21fea4[_0x5c42('0x13')][_0x5c42('0x14')]()==='in'||_0x21fea4[_0x5c42('0x13')][_0x5c42('0x14')]()===_0x5c42('0x15')&&!_0x21fea4[_0x5c42('0x16')]&&!_['isNil'](_0x21fea4[_0x5c42('0x17')])){_0x967694[_0x5c42('0x18')]['findOne']({'where':{'id':_0x21fea4[_0x5c42('0x19')]}})[_0x5c42('0x1a')](function(_0x504bdf){if(_0x504bdf){_0x504bdf[_0x5c42('0x1b')]({'lastMsgAt':_0x21fea4[_0x5c42('0x1c')],'lastMsgDirection':_0x21fea4['direction'][_0x5c42('0x14')]()});}})[_0x5c42('0x1d')](function(_0x2597f4){console['error'](_0x2597f4);});}if(_0x21fea4[_0x5c42('0x13')]===_0x5c42('0x15')&&!_0x21fea4[_0x5c42('0x16')]){var _0x50a5c5;_0x967694['CmContact'][_0x5c42('0x1e')]()[_0x5c42('0x1a')](function(_0x3c5b02){return _0x967694[_0x5c42('0x1f')][_0x5c42('0x20')]({'where':{'id':_0x21fea4[_0x5c42('0x21')]},'include':[{'model':_0x967694[_0x5c42('0x18')],'as':_0x5c42('0x22'),'where':{'id':_0x21fea4['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x967694[_0x5c42('0x23')],'as':'Contact','attributes':_[_0x5c42('0x24')](_0x3c5b02)}]}]});})[_0x5c42('0x1a')](function(_0x3427bc){_0x50a5c5=_0x3427bc['get']({'plain':!![]});if(_0x50a5c5&&_0x50a5c5['replyUri']){logger['info'](_0x5c42('0x25'),_0x5c42('0x26'),util[_0x5c42('0x27')](_0x5c42('0x28'),_0x21fea4['id'],_0x50a5c5[_0x5c42('0x29')]));if(_0x50a5c5[_0x5c42('0x22')]&&_0x50a5c5[_0x5c42('0x22')][_0x5c42('0x2a')]){_0x21fea4['Interaction']=_['omit'](_0x50a5c5[_0x5c42('0x22')][0x0],_0x5c42('0x2b'));_0x21fea4[_0x5c42('0x2b')]=_0x50a5c5[_0x5c42('0x22')][0x0][_0x5c42('0x2b')];}var _0x5903c4={'method':_0x5c42('0x2c'),'uri':encodeURI(_0x50a5c5['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5903c4[_0x5c42('0x2d')]){case _0x5c42('0x2e'):_0x5903c4['qs']=_0x21fea4;break;case _0x5c42('0x2c'):_0x5903c4[_0x5c42('0xf')]=_0x21fea4;break;}return rp(_0x5903c4)[_0x5c42('0x1a')](function(_0x6e97f8){logger[_0x5c42('0x2f')](_0x5c42('0x25'),_0x5c42('0x26'),util['format'](_0x5c42('0x30'),_0x21fea4['id'],_0x50a5c5[_0x5c42('0x29')]));if(_0x6e97f8['body']['threadId']&&_0x6e97f8[_0x5c42('0xf')][_0x5c42('0x31')]!=_0x21fea4[_0x5c42('0x32')][_0x5c42('0x31')]){return _0x967694[_0x5c42('0x18')]['update']({'threadId':_0x6e97f8[_0x5c42('0xf')]['threadId']},{'where':{'id':_0x21fea4[_0x5c42('0x32')]['id']}});}else{return;}})['then'](function(){return _0x7a5e17['update']({'read':!![]});})[_0x5c42('0x1d')](function(_0x2f6d91){logger[_0x5c42('0x33')](_0x5c42('0x25'),_0x5c42('0x26'),util['inspect'](_0x2f6d91,{'showHidden':![],'depth':null}));_0x1297a2();});}else{_0x1297a2();}})['finally'](function(){_0x1297a2();});}else{_0x1297a2();}}},'charset':'utf8mb4','collate':_0x5c42('0x34')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 4f11569..9f0a279 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 _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x371585,_0x43c516){var _0x59fb00=function(_0x88540f){while(--_0x88540f){_0x371585['push'](_0x371585['shift']());}};_0x59fb00(++_0x43c516);}(_0x2ef3,0xba));var _0x32ef=function(_0xc3712e,_0x2cebf0){_0xc3712e=_0xc3712e-0x0;var _0x408cc1=_0x2ef3[_0xc3712e];return _0x408cc1;};'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});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ 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(_0x3f261b,_0x433eb9){var _0x43bbb7=function(_0x4dab5d){while(--_0x4dab5d){_0x3f261b['push'](_0x3f261b['shift']());}};_0x43bbb7(++_0x433eb9);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'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 846febd..92709f4 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 _0x9ab0=['save','remove','update','emit','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x21c501,_0x25143b){var _0x1d6093=function(_0x280534){while(--_0x280534){_0x21c501['push'](_0x21c501['shift']());}};_0x1d6093(++_0x25143b);}(_0x9ab0,0x195));var _0x09ab=function(_0x2058ef,_0x196e26){_0x2058ef=_0x2058ef-0x0;var _0x545bec=_0x9ab0[_0x2058ef];return _0x545bec;};'use strict';var OpenchannelMessageEvents=require(_0x09ab('0x0'));var events=[_0x09ab('0x1'),_0x09ab('0x2'),_0x09ab('0x3')];function createListener(_0x38fee4,_0x428fc1){return function(_0x38c30a){_0x428fc1[_0x09ab('0x4')](_0x38fee4,_0x38c30a);};}function removeListener(_0x3c0cd0,_0x4bb59a){return function(){OpenchannelMessageEvents['removeListener'](_0x3c0cd0,_0x4bb59a);};}exports['register']=function(_0x3144ec){for(var _0x387ac8=0x0,_0x241bd1=events[_0x09ab('0x5')];_0x387ac8<_0x241bd1;_0x387ac8++){var _0x610663=events[_0x387ac8];var _0x464d64=createListener(_0x09ab('0x6')+_0x610663,_0x3144ec);OpenchannelMessageEvents['on'](_0x610663,_0x464d64);}}; \ No newline at end of file +var _0x9219=['remove','update','emit','register','length','openchannelMessage:','save'];(function(_0x1b52e,_0x1591af){var _0x3b039e=function(_0x180a92){while(--_0x180a92){_0x1b52e['push'](_0x1b52e['shift']());}};_0x3b039e(++_0x1591af);}(_0x9219,0x1cd));var _0x9921=function(_0x423a9f,_0x276c65){_0x423a9f=_0x423a9f-0x0;var _0xb8731f=_0x9219[_0x423a9f];return _0xb8731f;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x9921('0x0'),_0x9921('0x1'),_0x9921('0x2')];function createListener(_0x16aae8,_0x1d2f5a){return function(_0x660b0e){_0x1d2f5a[_0x9921('0x3')](_0x16aae8,_0x660b0e);};}function removeListener(_0x2ccc50,_0x1bc8cb){return function(){OpenchannelMessageEvents['removeListener'](_0x2ccc50,_0x1bc8cb);};}exports[_0x9921('0x4')]=function(_0x3c7dde){for(var _0x26696b=0x0,_0x59543d=events[_0x9921('0x5')];_0x26696b<_0x59543d;_0x26696b++){var _0x13f633=events[_0x26696b];var _0x4d4007=createListener(_0x9921('0x6')+_0x13f633,_0x3c7dde);OpenchannelMessageEvents['on'](_0x13f633,_0x4d4007);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 147f4d0..6db065f 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 _0x3008=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','create','post','/:id/users','addAgents'];(function(_0x1b32b7,_0x38f21f){var _0x17d574=function(_0xb6d644){while(--_0xb6d644){_0x1b32b7['push'](_0x1b32b7['shift']());}};_0x17d574(++_0x38f21f);}(_0x3008,0x14f));var _0x8300=function(_0x38ce4c,_0xfdbe8c){_0x38ce4c=_0x38ce4c-0x0;var _0x5d4544=_0x3008[_0x38ce4c];return _0x5d4544;};'use strict';var multer=require('multer');var util=require(_0x8300('0x0'));var path=require(_0x8300('0x1'));var timeout=require(_0x8300('0x2'));var express=require(_0x8300('0x3'));var router=express[_0x8300('0x4')]();var fs_extra=require(_0x8300('0x5'));var auth=require(_0x8300('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8300('0x7'));var controller=require(_0x8300('0x8'));router['get']('/',auth[_0x8300('0x9')](),controller[_0x8300('0xa')]);router[_0x8300('0xb')](_0x8300('0xc'),auth[_0x8300('0x9')](),controller[_0x8300('0xd')]);router[_0x8300('0xb')](_0x8300('0xe'),auth[_0x8300('0x9')](),controller[_0x8300('0xf')]);router[_0x8300('0xb')](_0x8300('0x10'),auth[_0x8300('0x9')](),controller[_0x8300('0x11')]);router[_0x8300('0xb')](_0x8300('0x12'),auth[_0x8300('0x9')](),controller[_0x8300('0x13')]);router[_0x8300('0xb')]('/:id/users',auth[_0x8300('0x9')](),controller[_0x8300('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8300('0x15')]);router['post'](_0x8300('0x12'),auth[_0x8300('0x9')](),controller['addTeams']);router[_0x8300('0x16')](_0x8300('0x17'),auth['isAuthenticated'](),controller[_0x8300('0x18')]);router[_0x8300('0x19')](_0x8300('0xe'),auth[_0x8300('0x9')](),controller[_0x8300('0x1a')]);router[_0x8300('0x1b')](_0x8300('0xe'),auth['isAuthenticated'](),controller[_0x8300('0x1c')]);router['delete'](_0x8300('0x12'),auth[_0x8300('0x9')](),controller['removeTeams']);router[_0x8300('0x1b')](_0x8300('0x17'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x8300('0x1d')]=router; \ No newline at end of file +var _0x9195=['addTeams','put','update','delete','destroy','removeTeams','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x21e02a,_0x4aed98){var _0x1015a0=function(_0x583650){while(--_0x583650){_0x21e02a['push'](_0x21e02a['shift']());}};_0x1015a0(++_0x4aed98);}(_0x9195,0x7a));var _0x5919=function(_0x16df39,_0x3943ca){_0x16df39=_0x16df39-0x0;var _0x216149=_0x9195[_0x16df39];return _0x216149;};'use strict';var multer=require(_0x5919('0x0'));var util=require(_0x5919('0x1'));var path=require(_0x5919('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5919('0x3')]();var fs_extra=require(_0x5919('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5919('0x5'));var config=require(_0x5919('0x6'));var controller=require(_0x5919('0x7'));router[_0x5919('0x8')]('/',auth['isAuthenticated'](),controller[_0x5919('0x9')]);router[_0x5919('0x8')](_0x5919('0xa'),auth[_0x5919('0xb')](),controller[_0x5919('0xc')]);router[_0x5919('0x8')](_0x5919('0xd'),auth[_0x5919('0xb')](),controller[_0x5919('0xe')]);router[_0x5919('0x8')](_0x5919('0xf'),auth[_0x5919('0xb')](),controller[_0x5919('0x10')]);router['get'](_0x5919('0x11'),auth['isAuthenticated'](),controller[_0x5919('0x12')]);router[_0x5919('0x8')](_0x5919('0x13'),auth['isAuthenticated'](),controller[_0x5919('0x14')]);router[_0x5919('0x15')]('/',auth[_0x5919('0xb')](),controller[_0x5919('0x16')]);router[_0x5919('0x15')]('/:id/teams',auth[_0x5919('0xb')](),controller[_0x5919('0x17')]);router['post'](_0x5919('0x13'),auth[_0x5919('0xb')](),controller['addAgents']);router[_0x5919('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x5919('0x19')]);router[_0x5919('0x1a')]('/:id',auth[_0x5919('0xb')](),controller[_0x5919('0x1b')]);router[_0x5919('0x1a')](_0x5919('0x11'),auth[_0x5919('0xb')](),controller[_0x5919('0x1c')]);router['delete'](_0x5919('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 95b2c0e..fe20e34 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 _0xc344=['roundrobin','sequelize','exports','name','INTEGER','ENUM','rrmemory'];(function(_0x106905,_0x1ae4ce){var _0x3292fd=function(_0x1a798d){while(--_0x1a798d){_0x106905['push'](_0x106905['shift']());}};_0x3292fd(++_0x1ae4ce);}(_0xc344,0x104));var _0x4c34=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0xc344[_0x34843e];return _0x598f7f;};'use strict';var Sequelize=require(_0x4c34('0x0'));module[_0x4c34('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4c34('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x4c34('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4c34('0x4')](_0x4c34('0x5'),'beepall',_0x4c34('0x6'))}}; \ No newline at end of file +var _0xbbe2=['sequelize','exports','name','STRING','INTEGER','ENUM','beepall','roundrobin'];(function(_0x4ea413,_0x51ff3a){var _0x51cf25=function(_0x3c6456){while(--_0x3c6456){_0x4ea413['push'](_0x4ea413['shift']());}};_0x51cf25(++_0x51ff3a);}(_0xbbe2,0x180));var _0x2bbe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbe2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2bbe('0x0'));module[_0x2bbe('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2bbe('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2bbe('0x3')]},'timeout':{'type':Sequelize[_0x2bbe('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2bbe('0x5')]('rrmemory',_0x2bbe('0x6'),_0x2bbe('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 9fd27bf..cd2eaf5 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 _0xe519=['every','includes','all','union','value','isEmpty','userOpenchannelQueue:save','removeAgents','isArray','userOpenchannelQueue:remove','getAgents','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','OpenchannelQueues','UserProfileResource','error','stack','send','map','OpenchannelQueue','rawAttributes','type','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','User','UserId','agent','openchannelPause','updatedAt','createdAt','rows','%s/%s','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','UserOpenchannelQueue','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0xe519,0x93));var _0x9e51=function(_0x5d806b,_0x10424b){_0x5d806b=_0x5d806b-0x0;var _0x443e7e=_0xe519[_0x5d806b];return _0x443e7e;};'use strict';var emlformat=require(_0x9e51('0x0'));var rimraf=require(_0x9e51('0x1'));var zipdir=require(_0x9e51('0x2'));var jsonpatch=require(_0x9e51('0x3'));var rp=require(_0x9e51('0x4'));var moment=require(_0x9e51('0x5'));var BPromise=require(_0x9e51('0x6'));var Mustache=require(_0x9e51('0x7'));var util=require(_0x9e51('0x8'));var path=require(_0x9e51('0x9'));var sox=require('sox');var csv=require(_0x9e51('0xa'));var ejs=require(_0x9e51('0xb'));var fs=require('fs');var fs_extra=require(_0x9e51('0xc'));var _=require(_0x9e51('0xd'));var squel=require(_0x9e51('0xe'));var crypto=require(_0x9e51('0xf'));var jsforce=require(_0x9e51('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x9e51('0xa'));var querystring=require(_0x9e51('0x11'));var Papa=require(_0x9e51('0x12'));var Redis=require(_0x9e51('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e51('0x14'));var logger=require(_0x9e51('0x15'))('api');var utils=require(_0x9e51('0x16'));var config=require(_0x9e51('0x17'));var licenseUtil=require(_0x9e51('0x18'));var db=require(_0x9e51('0x19'))['db'];config['redis']=_[_0x9e51('0x1a')](config[_0x9e51('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x9e51('0x1c'))(new Redis(config[_0x9e51('0x1b')]));require('./openchannelQueue.socket')[_0x9e51('0x1d')](socket);function respondWithStatusCode(_0x4f08de,_0x3cefd5){_0x3cefd5=_0x3cefd5||0xcc;return function(_0x218311){if(_0x218311){return _0x4f08de['sendStatus'](_0x3cefd5);}return _0x4f08de[_0x9e51('0x1e')](_0x3cefd5)[_0x9e51('0x1f')]();};}function respondWithResult(_0x109b9f,_0x474fc0){_0x474fc0=_0x474fc0||0xc8;return function(_0x39dadc){if(_0x39dadc){return _0x109b9f['status'](_0x474fc0)['json'](_0x39dadc);}};}function respondWithFilteredResult(_0x402858,_0x241db3){return function(_0x16140b){if(_0x16140b){var _0x42a5b7=typeof _0x241db3[_0x9e51('0x20')]===_0x9e51('0x21')&&typeof _0x241db3[_0x9e51('0x22')]===_0x9e51('0x21');var _0x28277c=_0x16140b[_0x9e51('0x23')];var _0x1df51e=_0x42a5b7?0x0:_0x241db3['offset'];var _0x3ad586=_0x42a5b7?_0x16140b[_0x9e51('0x23')]:_0x241db3[_0x9e51('0x20')]+_0x241db3['limit'];var _0x1de92e;if(_0x3ad586>=_0x28277c){_0x3ad586=_0x28277c;_0x1de92e=0xc8;}else{_0x1de92e=0xce;}_0x402858[_0x9e51('0x1e')](_0x1de92e);return _0x402858[_0x9e51('0x24')](_0x9e51('0x25'),_0x1df51e+'-'+_0x3ad586+'/'+_0x28277c)['json'](_0x16140b);}return null;};}function patchUpdates(_0x40169f){return function(_0x201384){try{jsonpatch[_0x9e51('0x26')](_0x201384,_0x40169f,!![]);}catch(_0x493981){return BPromise[_0x9e51('0x27')](_0x493981);}return _0x201384[_0x9e51('0x28')]();};}function saveUpdates(_0x227b91,_0x436289){return function(_0x4cae06){if(_0x4cae06){return _0x4cae06[_0x9e51('0x29')](_0x227b91)[_0x9e51('0x2a')](function(_0x86489a){return _0x86489a;});}return null;};}function removeEntity(_0x91742a,_0x536808){return function(_0x51e327){if(_0x51e327){return _0x51e327['destroy']()['then'](function(){var _0x4a6a2e=_0x51e327[_0x9e51('0x2b')]({'plain':!![]});var _0x1b395e=_0x9e51('0x2c');return db[_0x9e51('0x2d')]['destroy']({'where':{'type':_0x1b395e,'resourceId':_0x4a6a2e['id']}})[_0x9e51('0x2a')](function(){return _0x51e327;});})[_0x9e51('0x2a')](function(){_0x91742a[_0x9e51('0x1e')](0xcc)[_0x9e51('0x1f')]();});}};}function handleEntityNotFound(_0x5e9393,_0x36220a){return function(_0x1b9221){if(!_0x1b9221){_0x5e9393['sendStatus'](0x194);}return _0x1b9221;};}function handleError(_0x33064a,_0x320182){_0x320182=_0x320182||0x1f4;return function(_0x57deac){logger[_0x9e51('0x2e')](_0x57deac[_0x9e51('0x2f')]);if(_0x57deac['name']){delete _0x57deac['name'];}_0x33064a['status'](_0x320182)[_0x9e51('0x30')](_0x57deac);};}exports['index']=function(_0x3aae6a,_0x52e36f){var _0x58954b={},_0x286b81={},_0x843f60={'count':0x0,'rows':[]};var _0x3b5b60=_[_0x9e51('0x31')](db[_0x9e51('0x32')][_0x9e51('0x33')],function(_0x35809d){return{'name':_0x35809d['fieldName'],'type':_0x35809d[_0x9e51('0x34')][_0x9e51('0x35')]};});_0x286b81[_0x9e51('0x36')]=_['map'](_0x3b5b60,_0x9e51('0x37'));_0x286b81[_0x9e51('0x38')]=_['keys'](_0x3aae6a['query']);_0x286b81[_0x9e51('0x39')]=_[_0x9e51('0x3a')](_0x286b81[_0x9e51('0x36')],_0x286b81['query']);_0x58954b['attributes']=_[_0x9e51('0x3a')](_0x286b81[_0x9e51('0x36')],qs['fields'](_0x3aae6a[_0x9e51('0x38')][_0x9e51('0x3b')]));_0x58954b[_0x9e51('0x3c')]=_0x58954b['attributes'][_0x9e51('0x3d')]?_0x58954b[_0x9e51('0x3c')]:_0x286b81[_0x9e51('0x36')];if(!_0x3aae6a['query'][_0x9e51('0x3e')](_0x9e51('0x3f'))){_0x58954b[_0x9e51('0x22')]=qs['limit'](_0x3aae6a[_0x9e51('0x38')][_0x9e51('0x22')]);_0x58954b[_0x9e51('0x20')]=qs[_0x9e51('0x20')](_0x3aae6a[_0x9e51('0x38')]['offset']);}_0x58954b[_0x9e51('0x40')]=qs[_0x9e51('0x41')](_0x3aae6a['query'][_0x9e51('0x41')]);_0x58954b[_0x9e51('0x42')]=qs['filters'](_[_0x9e51('0x43')](_0x3aae6a[_0x9e51('0x38')],_0x286b81['filters']),_0x3b5b60);if(_0x3aae6a[_0x9e51('0x38')]['filter']){_0x58954b[_0x9e51('0x42')]=_[_0x9e51('0x44')](_0x58954b[_0x9e51('0x42')],{'$or':_[_0x9e51('0x31')](_0x3b5b60,function(_0xeb47fa){if(_0xeb47fa[_0x9e51('0x34')]!==_0x9e51('0x45')){var _0x3f20a4={};_0x3f20a4[_0xeb47fa[_0x9e51('0x37')]]={'$like':'%'+_0x3aae6a['query'][_0x9e51('0x46')]+'%'};return _0x3f20a4;}})});}_0x58954b=_[_0x9e51('0x44')]({},_0x58954b,_0x3aae6a[_0x9e51('0x47')]);var _0x9cca3d={'where':_0x58954b[_0x9e51('0x42')]};return db[_0x9e51('0x32')][_0x9e51('0x23')](_0x9cca3d)[_0x9e51('0x2a')](function(_0x3dea14){_0x843f60[_0x9e51('0x23')]=_0x3dea14;if(_0x3aae6a[_0x9e51('0x38')][_0x9e51('0x48')]){_0x58954b['include']=[{'all':!![]}];}return db[_0x9e51('0x32')][_0x9e51('0x49')](_0x58954b);})[_0x9e51('0x2a')](function(_0x4186d5){_0x843f60['rows']=_0x4186d5;return _0x843f60;})['then'](respondWithFilteredResult(_0x52e36f,_0x58954b))[_0x9e51('0x4a')](handleError(_0x52e36f,null));};exports[_0x9e51('0x4b')]=function(_0x5c8fb4,_0x4d7bcf){var _0x31d74a={'raw':!![],'where':{'id':_0x5c8fb4[_0x9e51('0x4c')]['id']}},_0x77ee4c={};_0x77ee4c[_0x9e51('0x36')]=_[_0x9e51('0x4d')](db[_0x9e51('0x32')]['rawAttributes']);_0x77ee4c[_0x9e51('0x38')]=_[_0x9e51('0x4d')](_0x5c8fb4[_0x9e51('0x38')]);_0x77ee4c[_0x9e51('0x39')]=_[_0x9e51('0x3a')](_0x77ee4c[_0x9e51('0x36')],_0x77ee4c[_0x9e51('0x38')]);_0x31d74a[_0x9e51('0x3c')]=_[_0x9e51('0x3a')](_0x77ee4c[_0x9e51('0x36')],qs['fields'](_0x5c8fb4[_0x9e51('0x38')]['fields']));_0x31d74a[_0x9e51('0x3c')]=_0x31d74a[_0x9e51('0x3c')]['length']?_0x31d74a['attributes']:_0x77ee4c[_0x9e51('0x36')];if(_0x5c8fb4['query'][_0x9e51('0x48')]){_0x31d74a['include']=[{'all':!![]}];}_0x31d74a=_['merge']({},_0x31d74a,_0x5c8fb4[_0x9e51('0x47')]);return db['OpenchannelQueue'][_0x9e51('0x4e')](_0x31d74a)[_0x9e51('0x2a')](handleEntityNotFound(_0x4d7bcf,null))[_0x9e51('0x2a')](respondWithResult(_0x4d7bcf,null))[_0x9e51('0x4a')](handleError(_0x4d7bcf,null));};exports[_0x9e51('0x4f')]=function(_0x249881,_0x3a2683){return db[_0x9e51('0x32')][_0x9e51('0x4f')](_0x249881[_0x9e51('0x50')],{})['then'](function(_0x3fabcc){var _0x18e94a=_0x249881['user'][_0x9e51('0x2b')]({'plain':!![]});if(!_0x18e94a)throw new Error(_0x9e51('0x51'));if(_0x18e94a['role']==='user'){var _0x588a0b=_0x3fabcc['get']({'plain':!![]});var _0x1e55bd=_0x9e51('0x2c');return db[_0x9e51('0x52')][_0x9e51('0x4e')]({'where':{'name':_0x1e55bd,'userProfileId':_0x18e94a['userProfileId']},'raw':!![]})[_0x9e51('0x2a')](function(_0x16a4ae){if(_0x16a4ae&&_0x16a4ae[_0x9e51('0x53')]===0x0){return db[_0x9e51('0x2d')][_0x9e51('0x4f')]({'name':_0x588a0b[_0x9e51('0x37')],'resourceId':_0x588a0b['id'],'type':_0x16a4ae[_0x9e51('0x37')],'sectionId':_0x16a4ae['id']},{})[_0x9e51('0x2a')](function(){return _0x3fabcc;});}else{return _0x3fabcc;}})['catch'](function(_0x308c0a){logger[_0x9e51('0x2e')](_0x9e51('0x54'),_0x308c0a);throw _0x308c0a;});}return _0x3fabcc;})[_0x9e51('0x2a')](respondWithResult(_0x3a2683,0xc9))[_0x9e51('0x4a')](handleError(_0x3a2683,null));};exports['update']=function(_0x7ce07b,_0x3d9d53){if(_0x7ce07b[_0x9e51('0x50')]['id']){delete _0x7ce07b[_0x9e51('0x50')]['id'];}return db['OpenchannelQueue'][_0x9e51('0x4e')]({'where':{'id':_0x7ce07b[_0x9e51('0x4c')]['id']}})[_0x9e51('0x2a')](handleEntityNotFound(_0x3d9d53,null))[_0x9e51('0x2a')](saveUpdates(_0x7ce07b[_0x9e51('0x50')],null))[_0x9e51('0x2a')](respondWithResult(_0x3d9d53,null))[_0x9e51('0x4a')](handleError(_0x3d9d53,null));};exports['destroy']=function(_0x552ad5,_0x4bb4a8){return db[_0x9e51('0x32')]['find']({'where':{'id':_0x552ad5[_0x9e51('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4bb4a8,null))[_0x9e51('0x2a')](removeEntity(_0x4bb4a8,null))[_0x9e51('0x4a')](handleError(_0x4bb4a8,null));};exports[_0x9e51('0x55')]=function(_0x59af59,_0x379ae3){return db[_0x9e51('0x32')][_0x9e51('0x55')]()['then'](respondWithResult(_0x379ae3,null))['catch'](handleError(_0x379ae3,null));};exports[_0x9e51('0x56')]=function(_0x10d0ec,_0x485343,_0x7a48d2){var _0x1d3b6d={'raw':!![],'where':{}},_0x6fc697={},_0xb3fa68;return db[_0x9e51('0x32')]['findOne']({'where':{'id':_0x10d0ec['params']['id']}})[_0x9e51('0x2a')](handleEntityNotFound(_0x485343,null))['then'](function(_0x165d98){if(_0x165d98){_0xb3fa68=_0x165d98[_0x9e51('0x2b')]({'plain':!![]});_0x6fc697[_0x9e51('0x36')]=_[_0x9e51('0x4d')](db['UserOpenchannelQueue'][_0x9e51('0x33')]);_0x6fc697[_0x9e51('0x38')]=_[_0x9e51('0x4d')](_0x10d0ec[_0x9e51('0x38')]);_0x6fc697[_0x9e51('0x39')]=_['intersection'](_0x6fc697[_0x9e51('0x36')],_0x6fc697['query']);_0x1d3b6d[_0x9e51('0x3c')]=_[_0x9e51('0x3a')](_0x6fc697[_0x9e51('0x36')],qs['fields'](_0x10d0ec[_0x9e51('0x38')]['fields']));_0x1d3b6d[_0x9e51('0x3c')]=_0x1d3b6d[_0x9e51('0x3c')][_0x9e51('0x3d')]?_0x1d3b6d[_0x9e51('0x3c')]:_0x6fc697[_0x9e51('0x36')];if(!_0x10d0ec['query'][_0x9e51('0x3e')](_0x9e51('0x3f'))){_0x1d3b6d[_0x9e51('0x22')]=qs[_0x9e51('0x22')](_0x10d0ec[_0x9e51('0x38')][_0x9e51('0x22')]);_0x1d3b6d['offset']=qs[_0x9e51('0x20')](_0x10d0ec[_0x9e51('0x38')][_0x9e51('0x20')]);}_0x1d3b6d['order']=qs[_0x9e51('0x41')](_0x10d0ec[_0x9e51('0x38')][_0x9e51('0x41')]);_0x1d3b6d['where']=qs[_0x9e51('0x39')](_['pick'](_0x10d0ec['query'],_0x6fc697[_0x9e51('0x39')]));_0x1d3b6d[_0x9e51('0x42')]['OpenchannelQueueId']=_0x165d98['id'];if(_0x10d0ec[_0x9e51('0x38')][_0x9e51('0x46')]){_0x1d3b6d[_0x9e51('0x42')]=_[_0x9e51('0x44')](_0x1d3b6d[_0x9e51('0x42')],{'$or':_[_0x9e51('0x31')](_0x1d3b6d[_0x9e51('0x3c')],function(_0x3dd238){var _0x4da974={};_0x4da974[_0x3dd238]={'$like':'%'+_0x10d0ec[_0x9e51('0x38')]['filter']+'%'};return _0x4da974;})});}_0x1d3b6d=_[_0x9e51('0x44')]({},_0x1d3b6d,_0x10d0ec[_0x9e51('0x47')]);return db['UserOpenchannelQueue'][_0x9e51('0x49')](_0x1d3b6d);}})['then'](function(_0xe47759){if(_0xe47759){return db[_0x9e51('0x57')]['findAndCountAll']({'where':{'id':_[_0x9e51('0x31')](_0xe47759,_0x9e51('0x58')),'role':_0x9e51('0x59')},'attributes':['id',_0x9e51('0x37'),_0x9e51('0x5a'),_0x9e51('0x5b'),_0x9e51('0x5c')]});}})[_0x9e51('0x2a')](function(_0x389e74){if(_0x389e74){return{'count':_0x389e74['count'],'rows':_[_0x9e51('0x31')](_0x389e74[_0x9e51('0x5d')],function(_0x249449){return{'membername':_0x249449[_0x9e51('0x37')],'UserId':_0x249449['id'],'queue_name':_0xb3fa68[_0x9e51('0x37')],'OpenchannelQueueId':_0xb3fa68['id'],'interface':util['format'](_0x9e51('0x5e'),'SIP',_0x249449['name']),'penalty':0x0,'paused':_0x249449[_0x9e51('0x5a')],'createdAt':_0x249449[_0x9e51('0x5c')],'updatedAt':_0x249449[_0x9e51('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9e51('0x2a')](respondWithFilteredResult(_0x485343,_0x1d3b6d))[_0x9e51('0x4a')](handleError(_0x485343,null));};exports[_0x9e51('0x5f')]=function(_0x59ecec,_0x220d11,_0xf6ab4c){var _0x153521={};var _0x7183c6={};var _0x48659f;var _0x5813aa;return db[_0x9e51('0x32')]['findOne']({'where':{'id':_0x59ecec[_0x9e51('0x4c')]['id']}})[_0x9e51('0x2a')](handleEntityNotFound(_0x220d11,null))['then'](function(_0x196b31){if(_0x196b31){_0x48659f=_0x196b31;_0x7183c6['model']=_[_0x9e51('0x4d')](db[_0x9e51('0x60')][_0x9e51('0x33')]);_0x7183c6[_0x9e51('0x38')]=_['keys'](_0x59ecec[_0x9e51('0x38')]);_0x7183c6[_0x9e51('0x39')]=_[_0x9e51('0x3a')](_0x7183c6[_0x9e51('0x36')],_0x7183c6[_0x9e51('0x38')]);_0x153521[_0x9e51('0x3c')]=_[_0x9e51('0x3a')](_0x7183c6['model'],qs[_0x9e51('0x3b')](_0x59ecec[_0x9e51('0x38')][_0x9e51('0x3b')]));_0x153521['attributes']=_0x153521[_0x9e51('0x3c')][_0x9e51('0x3d')]?_0x153521[_0x9e51('0x3c')]:_0x7183c6[_0x9e51('0x36')];_0x153521[_0x9e51('0x40')]=qs['sort'](_0x59ecec[_0x9e51('0x38')][_0x9e51('0x41')]);_0x153521['where']=qs['filters'](_[_0x9e51('0x43')](_0x59ecec['query'],_0x7183c6[_0x9e51('0x39')]));if(_0x59ecec[_0x9e51('0x38')]['filter']){_0x153521[_0x9e51('0x42')]=_[_0x9e51('0x44')](_0x153521[_0x9e51('0x42')],{'$or':_[_0x9e51('0x31')](_0x153521[_0x9e51('0x3c')],function(_0x4d82ad){var _0xff73c0={};_0xff73c0[_0x4d82ad]={'$like':'%'+_0x59ecec['query']['filter']+'%'};return _0xff73c0;})});}_0x153521=_['merge']({},_0x153521,_0x59ecec['options']);return _0x48659f[_0x9e51('0x5f')](_0x153521);}})[_0x9e51('0x2a')](function(_0x57e1cf){if(_0x57e1cf){_0x5813aa=_0x57e1cf[_0x9e51('0x3d')];if(!_0x59ecec['query'][_0x9e51('0x3e')](_0x9e51('0x3f'))){_0x153521[_0x9e51('0x22')]=qs[_0x9e51('0x22')](_0x59ecec[_0x9e51('0x38')][_0x9e51('0x22')]);_0x153521[_0x9e51('0x20')]=qs['offset'](_0x59ecec[_0x9e51('0x38')][_0x9e51('0x20')]);}return _0x48659f[_0x9e51('0x5f')](_0x153521);}})[_0x9e51('0x2a')](function(_0xb7e482){if(_0xb7e482){return _0xb7e482?{'count':_0x5813aa,'rows':_0xb7e482}:null;}})['then'](respondWithResult(_0x220d11,null))[_0x9e51('0x4a')](handleError(_0x220d11,null));};exports[_0x9e51('0x61')]=function(_0x380325,_0x55c422,_0x3d2cbc){var _0xa2ccd9=_0x380325[_0x9e51('0x50')][_0x9e51('0x62')];return db[_0x9e51('0x60')]['findAll']({'where':{'id':_0xa2ccd9},'attributes':['id'],'include':[{'model':db[_0x9e51('0x57')],'as':_0x9e51('0x63'),'attributes':['id',_0x9e51('0x37'),_0x9e51('0x64'),_0x9e51('0x65'),'interface'],'raw':!![]}]})[_0x9e51('0x2a')](function(_0x2030bb){if(_0x2030bb){var _0x22d534=_[_0x9e51('0x66')](_0x2030bb,function(_0x769ad4){var _0x429487=_0x769ad4['get']({'plain':!![]});return _0x429487[_0x9e51('0x63')];});return db['OpenchannelQueue'][_0x9e51('0x4e')]({'where':{'id':_0x380325[_0x9e51('0x4c')]['id']}})['then'](function(_0x563fd6){return db[_0x9e51('0x67')][_0x9e51('0x68')](function(_0x336bb2){return _0x563fd6['addTeams'](_0xa2ccd9,{'transaction':_0x336bb2})[_0x9e51('0x2a')](function(){return BPromise[_0x9e51('0x69')](_0x22d534,function(_0x1571c4){return db[_0x9e51('0x6a')][_0x9e51('0x6b')]({'where':{'UserId':_0x1571c4['id'],'OpenchannelQueueId':_0x380325['params']['id']},'transaction':_0x336bb2});});})[_0x9e51('0x2a')](function(){_0x22d534[_0x9e51('0x6c')](function(_0x554f0d){socket[_0x9e51('0x6d')]('userOpenchannelQueue:save',{'UserId':_0x554f0d['id'],'OpenchannelQueueId':_0x563fd6['id']});});});});});}})[_0x9e51('0x2a')](respondWithStatusCode(_0x55c422,null))[_0x9e51('0x4a')](handleError(_0x55c422,null));};exports[_0x9e51('0x6e')]=function(_0x6df2a8,_0x1a03f8,_0xe2b26e){return db[_0x9e51('0x60')][_0x9e51('0x49')]({'where':{'id':_0x6df2a8[_0x9e51('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0x9e51('0x57')],'as':_0x9e51('0x63'),'attributes':['id'],'raw':!![]}]})[_0x9e51('0x2a')](handleEntityNotFound(_0x1a03f8,null))['then'](function(_0x4b809e){var _0x5870de=_[_0x9e51('0x31')](_0x4b809e,'id');var _0x382f52=[];var _0x2b30bc=[];var _0x41ba6b=squel[_0x9e51('0x6f')]();_0x41ba6b[_0x9e51('0x70')](_0x9e51('0x71'))[_0x9e51('0x72')](_0x9e51('0x73'),'tq')[_0x9e51('0x74')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9e51('0x42')]('OpenchannelQueueId\x20=\x20?',_0x6df2a8[_0x9e51('0x4c')]['id']);for(var _0x2c7180=0x0;_0x2c7180<_0x4b809e[_0x9e51('0x3d')];_0x2c7180+=0x1){let _0x46bec2=_0x4b809e[_0x2c7180];for(var _0x13b175=0x0;_0x13b175<_0x46bec2[_0x9e51('0x63')][_0x9e51('0x3d')];_0x13b175+=0x1){let _0x19cb27=_0x46bec2[_0x9e51('0x63')][_0x13b175];var _0x3b3536=_0x41ba6b[_0x9e51('0x75')]();_0x3b3536['where'](_0x9e51('0x76'),_0x19cb27['id']);_0x2b30bc[_0x9e51('0x77')](db[_0x9e51('0x67')][_0x9e51('0x38')](_0x3b3536[_0x9e51('0x78')](),{'type':db[_0x9e51('0x67')][_0x9e51('0x79')][_0x9e51('0x7a')]})[_0x9e51('0x2a')](function(_0x19474e){if(_0x19474e[_0x9e51('0x3d')]===0x1){return _0x19cb27['id'];}else{var _0x2851ba=_[_0x9e51('0x7b')](_['map'](_0x19474e,'TeamId'),function(_0x20cf57){return _[_0x9e51('0x7c')](_0x5870de,_0x20cf57);});if(_0x2851ba){return _0x19cb27['id'];}}}));}}return BPromise[_0x9e51('0x7d')](_0x2b30bc)['then'](function(_0x16f2e8){_0x382f52=_(_0x382f52)[_0x9e51('0x7e')](_0x16f2e8)['compact']()[_0x9e51('0x7f')]();return db[_0x9e51('0x32')]['find']({'where':{'id':_0x6df2a8[_0x9e51('0x4c')]['id']}})['then'](function(_0x51deb9){return db[_0x9e51('0x67')][_0x9e51('0x68')](function(_0x437439){return _0x51deb9[_0x9e51('0x6e')](_0x6df2a8[_0x9e51('0x38')][_0x9e51('0x62')],{'transaction':_0x437439})[_0x9e51('0x2a')](function(){if(!_[_0x9e51('0x80')](_0x382f52)){return _0x51deb9['removeAgents'](_0x382f52,{'transaction':_0x437439});}})[_0x9e51('0x2a')](function(){_0x382f52['forEach'](function(_0xadc00a){socket[_0x9e51('0x6d')]('userOpenchannelQueue:remove',{'UserId':_0xadc00a,'OpenchannelQueueId':_0x51deb9['id']});});});});});});})[_0x9e51('0x2a')](respondWithStatusCode(_0x1a03f8,null))[_0x9e51('0x4a')](handleError(_0x1a03f8,null));};exports['addAgents']=function(_0x5e1ef3,_0x3cafbf,_0x3acde8){return db['OpenchannelQueue']['find']({'where':{'id':_0x5e1ef3[_0x9e51('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3cafbf,null))['then'](function(_0x22f28c){if(_0x22f28c){return _0x22f28c['addAgents'](_0x5e1ef3[_0x9e51('0x50')][_0x9e51('0x62')],_['omit'](_0x5e1ef3['body'],['ids','id'])||{})['spread'](function(_0x1edaef){for(var _0x24d3b5=0x0;_0x24d3b5<_0x5e1ef3[_0x9e51('0x50')][_0x9e51('0x62')]['length'];_0x24d3b5+=0x1){socket[_0x9e51('0x6d')](_0x9e51('0x81'),{'UserId':Number(_0x5e1ef3['body']['ids'][_0x24d3b5]),'OpenchannelQueueId':Number(_0x5e1ef3[_0x9e51('0x4c')]['id'])});}return _0x1edaef;});}})[_0x9e51('0x2a')](respondWithResult(_0x3cafbf,null))['catch'](handleError(_0x3cafbf,null));};exports[_0x9e51('0x82')]=function(_0x18742e,_0x7a1306,_0x100fc4){return db['OpenchannelQueue']['find']({'where':{'id':_0x18742e[_0x9e51('0x4c')]['id']}})['then'](handleEntityNotFound(_0x7a1306,null))[_0x9e51('0x2a')](function(_0x138c7f){if(_0x138c7f){return _0x138c7f[_0x9e51('0x82')](_0x18742e[_0x9e51('0x38')][_0x9e51('0x62')])[_0x9e51('0x2a')](function(){if(_[_0x9e51('0x83')](_0x18742e[_0x9e51('0x38')]['ids'])){for(var _0x5efd8b=0x0;_0x5efd8b<_0x18742e[_0x9e51('0x38')][_0x9e51('0x62')][_0x9e51('0x3d')];_0x5efd8b+=0x1){socket[_0x9e51('0x6d')]('userOpenchannelQueue:remove',{'UserId':Number(_0x18742e[_0x9e51('0x38')][_0x9e51('0x62')][_0x5efd8b]),'OpenchannelQueueId':Number(_0x18742e['params']['id'])});}}else{socket[_0x9e51('0x6d')](_0x9e51('0x84'),{'UserId':Number(_0x18742e['query'][_0x9e51('0x62')]),'OpenchannelQueueId':Number(_0x18742e[_0x9e51('0x4c')]['id'])});}});}})[_0x9e51('0x2a')](respondWithStatusCode(_0x7a1306,null))[_0x9e51('0x4a')](handleError(_0x7a1306,null));};exports[_0x9e51('0x85')]=function(_0x255397,_0x288c5b,_0x386c86){var _0x5ed4a4={};var _0x368d71={};var _0x9a88c8;var _0x202dc4;return db['OpenchannelQueue'][_0x9e51('0x86')]({'where':{'id':_0x255397['params']['id']}})[_0x9e51('0x2a')](handleEntityNotFound(_0x288c5b,null))['then'](function(_0x4c284d){if(_0x4c284d){_0x9a88c8=_0x4c284d;_0x368d71[_0x9e51('0x36')]=_[_0x9e51('0x4d')](db[_0x9e51('0x57')]['rawAttributes']);_0x368d71['query']=_[_0x9e51('0x4d')](_0x255397[_0x9e51('0x38')]);_0x368d71[_0x9e51('0x39')]=_['intersection'](_0x368d71[_0x9e51('0x36')],_0x368d71['query']);_0x5ed4a4[_0x9e51('0x3c')]=_[_0x9e51('0x3a')](_0x368d71[_0x9e51('0x36')],qs[_0x9e51('0x3b')](_0x255397[_0x9e51('0x38')]['fields']));_0x5ed4a4[_0x9e51('0x3c')]=_0x5ed4a4['attributes']['length']?_0x5ed4a4[_0x9e51('0x3c')]:_0x368d71[_0x9e51('0x36')];_0x5ed4a4['order']=qs['sort'](_0x255397[_0x9e51('0x38')]['sort']);_0x5ed4a4[_0x9e51('0x42')]=qs['filters'](_['pick'](_0x255397[_0x9e51('0x38')],_0x368d71[_0x9e51('0x39')]));if(_0x255397[_0x9e51('0x38')][_0x9e51('0x46')]){_0x5ed4a4[_0x9e51('0x42')]=_[_0x9e51('0x44')](_0x5ed4a4[_0x9e51('0x42')],{'$or':_[_0x9e51('0x31')](_0x5ed4a4[_0x9e51('0x3c')],function(_0x33ee52){var _0x40ad7f={};_0x40ad7f[_0x33ee52]={'$like':'%'+_0x255397[_0x9e51('0x38')][_0x9e51('0x46')]+'%'};return _0x40ad7f;})});}_0x5ed4a4=_[_0x9e51('0x44')]({},_0x5ed4a4,_0x255397[_0x9e51('0x47')]);return _0x9a88c8['getAgents'](_0x5ed4a4);}})['then'](function(_0x462191){if(_0x462191){_0x202dc4=_0x462191['length'];if(!_0x255397[_0x9e51('0x38')]['hasOwnProperty'](_0x9e51('0x3f'))){_0x5ed4a4[_0x9e51('0x22')]=qs[_0x9e51('0x22')](_0x255397[_0x9e51('0x38')]['limit']);_0x5ed4a4[_0x9e51('0x20')]=qs[_0x9e51('0x20')](_0x255397[_0x9e51('0x38')][_0x9e51('0x20')]);}return _0x9a88c8[_0x9e51('0x85')](_0x5ed4a4);}})[_0x9e51('0x2a')](function(_0x4821c2){if(_0x4821c2){return _0x4821c2?{'count':_0x202dc4,'rows':_0x4821c2}:null;}})['then'](respondWithResult(_0x288c5b,null))[_0x9e51('0x4a')](handleError(_0x288c5b,null));}; \ No newline at end of file +var _0x9a5b=['squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','map','OpenchannelQueue','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','params','describe','getMembers','UserOpenchannelQueue','pick','OpenchannelQueueId','User','UserId','agent','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','emit','userOpenchannelQueue:save','select','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','push','QueryTypes','SELECT','TeamId','union','compact','value','isEmpty','removeAgents','forEach','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9a5b,0xff));var _0xb9a5=function(_0x1885f8,_0x3538b0){_0x1885f8=_0x1885f8-0x0;var _0x3e5041=_0x9a5b[_0x1885f8];return _0x3e5041;};'use strict';var emlformat=require(_0xb9a5('0x0'));var rimraf=require(_0xb9a5('0x1'));var zipdir=require(_0xb9a5('0x2'));var jsonpatch=require(_0xb9a5('0x3'));var rp=require(_0xb9a5('0x4'));var moment=require(_0xb9a5('0x5'));var BPromise=require(_0xb9a5('0x6'));var Mustache=require(_0xb9a5('0x7'));var util=require(_0xb9a5('0x8'));var path=require(_0xb9a5('0x9'));var sox=require(_0xb9a5('0xa'));var csv=require(_0xb9a5('0xb'));var ejs=require(_0xb9a5('0xc'));var fs=require('fs');var fs_extra=require(_0xb9a5('0xd'));var _=require(_0xb9a5('0xe'));var squel=require(_0xb9a5('0xf'));var crypto=require(_0xb9a5('0x10'));var jsforce=require(_0xb9a5('0x11'));var deskjs=require(_0xb9a5('0x12'));var toCsv=require('to-csv');var querystring=require(_0xb9a5('0x13'));var Papa=require(_0xb9a5('0x14'));var Redis=require('ioredis');var authService=require(_0xb9a5('0x15'));var qs=require(_0xb9a5('0x16'));var as=require(_0xb9a5('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb9a5('0x18'))(_0xb9a5('0x19'));var utils=require(_0xb9a5('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xb9a5('0x1b'));var db=require(_0xb9a5('0x1c'))['db'];config[_0xb9a5('0x1d')]=_[_0xb9a5('0x1e')](config[_0xb9a5('0x1d')],{'host':_0xb9a5('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb9a5('0x1d')]));require(_0xb9a5('0x20'))[_0xb9a5('0x21')](socket);function respondWithStatusCode(_0x1953b7,_0x62bac0){_0x62bac0=_0x62bac0||0xcc;return function(_0x2c8b1a){if(_0x2c8b1a){return _0x1953b7[_0xb9a5('0x22')](_0x62bac0);}return _0x1953b7[_0xb9a5('0x23')](_0x62bac0)[_0xb9a5('0x24')]();};}function respondWithResult(_0x559a3a,_0x6d2e0b){_0x6d2e0b=_0x6d2e0b||0xc8;return function(_0x567248){if(_0x567248){return _0x559a3a[_0xb9a5('0x23')](_0x6d2e0b)[_0xb9a5('0x25')](_0x567248);}};}function respondWithFilteredResult(_0x99974d,_0x1f4c26){return function(_0x5b6d26){if(_0x5b6d26){var _0x3b0d51=typeof _0x1f4c26[_0xb9a5('0x26')]==='undefined'&&typeof _0x1f4c26[_0xb9a5('0x27')]===_0xb9a5('0x28');var _0xa86162=_0x5b6d26[_0xb9a5('0x29')];var _0x2bd025=_0x3b0d51?0x0:_0x1f4c26[_0xb9a5('0x26')];var _0x3a4254=_0x3b0d51?_0x5b6d26[_0xb9a5('0x29')]:_0x1f4c26['offset']+_0x1f4c26['limit'];var _0x215a58;if(_0x3a4254>=_0xa86162){_0x3a4254=_0xa86162;_0x215a58=0xc8;}else{_0x215a58=0xce;}_0x99974d[_0xb9a5('0x23')](_0x215a58);return _0x99974d['set']('Content-Range',_0x2bd025+'-'+_0x3a4254+'/'+_0xa86162)['json'](_0x5b6d26);}return null;};}function patchUpdates(_0x267f1f){return function(_0x458c94){try{jsonpatch[_0xb9a5('0x2a')](_0x458c94,_0x267f1f,!![]);}catch(_0x3bc9e8){return BPromise[_0xb9a5('0x2b')](_0x3bc9e8);}return _0x458c94[_0xb9a5('0x2c')]();};}function saveUpdates(_0x1b0231,_0x30c871){return function(_0x1b0ff7){if(_0x1b0ff7){return _0x1b0ff7[_0xb9a5('0x2d')](_0x1b0231)[_0xb9a5('0x2e')](function(_0x461166){return _0x461166;});}return null;};}function removeEntity(_0x4b4d04,_0x24f0f9){return function(_0x161ae4){if(_0x161ae4){return _0x161ae4[_0xb9a5('0x2f')]()[_0xb9a5('0x2e')](function(){var _0x333472=_0x161ae4[_0xb9a5('0x30')]({'plain':!![]});var _0x1accd7=_0xb9a5('0x31');return db[_0xb9a5('0x32')][_0xb9a5('0x2f')]({'where':{'type':_0x1accd7,'resourceId':_0x333472['id']}})['then'](function(){return _0x161ae4;});})[_0xb9a5('0x2e')](function(){_0x4b4d04['status'](0xcc)[_0xb9a5('0x24')]();});}};}function handleEntityNotFound(_0x82f94d,_0x3058e8){return function(_0x39899a){if(!_0x39899a){_0x82f94d[_0xb9a5('0x22')](0x194);}return _0x39899a;};}function handleError(_0x17809f,_0x10adfd){_0x10adfd=_0x10adfd||0x1f4;return function(_0x1c1c99){logger[_0xb9a5('0x33')](_0x1c1c99[_0xb9a5('0x34')]);if(_0x1c1c99[_0xb9a5('0x35')]){delete _0x1c1c99[_0xb9a5('0x35')];}_0x17809f[_0xb9a5('0x23')](_0x10adfd)[_0xb9a5('0x36')](_0x1c1c99);};}exports['index']=function(_0x2a6295,_0x4cee67){var _0x599470={},_0x2fe076={},_0x123eec={'count':0x0,'rows':[]};var _0x5f0996=_[_0xb9a5('0x37')](db[_0xb9a5('0x38')][_0xb9a5('0x39')],function(_0x540c7c){return{'name':_0x540c7c[_0xb9a5('0x3a')],'type':_0x540c7c[_0xb9a5('0x3b')]['key']};});_0x2fe076[_0xb9a5('0x3c')]=_['map'](_0x5f0996,_0xb9a5('0x35'));_0x2fe076[_0xb9a5('0x3d')]=_[_0xb9a5('0x3e')](_0x2a6295[_0xb9a5('0x3d')]);_0x2fe076[_0xb9a5('0x3f')]=_['intersection'](_0x2fe076[_0xb9a5('0x3c')],_0x2fe076['query']);_0x599470[_0xb9a5('0x40')]=_[_0xb9a5('0x41')](_0x2fe076['model'],qs[_0xb9a5('0x42')](_0x2a6295[_0xb9a5('0x3d')][_0xb9a5('0x42')]));_0x599470['attributes']=_0x599470[_0xb9a5('0x40')]['length']?_0x599470[_0xb9a5('0x40')]:_0x2fe076[_0xb9a5('0x3c')];if(!_0x2a6295[_0xb9a5('0x3d')][_0xb9a5('0x43')](_0xb9a5('0x44'))){_0x599470[_0xb9a5('0x27')]=qs[_0xb9a5('0x27')](_0x2a6295[_0xb9a5('0x3d')][_0xb9a5('0x27')]);_0x599470[_0xb9a5('0x26')]=qs['offset'](_0x2a6295[_0xb9a5('0x3d')][_0xb9a5('0x26')]);}_0x599470[_0xb9a5('0x45')]=qs[_0xb9a5('0x46')](_0x2a6295['query']['sort']);_0x599470[_0xb9a5('0x47')]=qs[_0xb9a5('0x3f')](_['pick'](_0x2a6295[_0xb9a5('0x3d')],_0x2fe076[_0xb9a5('0x3f')]),_0x5f0996);if(_0x2a6295['query']['filter']){_0x599470[_0xb9a5('0x47')]=_[_0xb9a5('0x48')](_0x599470[_0xb9a5('0x47')],{'$or':_['map'](_0x5f0996,function(_0x260ba2){if(_0x260ba2[_0xb9a5('0x3b')]!=='VIRTUAL'){var _0x5e9130={};_0x5e9130[_0x260ba2[_0xb9a5('0x35')]]={'$like':'%'+_0x2a6295[_0xb9a5('0x3d')][_0xb9a5('0x49')]+'%'};return _0x5e9130;}})});}_0x599470=_['merge']({},_0x599470,_0x2a6295[_0xb9a5('0x4a')]);var _0x248869={'where':_0x599470[_0xb9a5('0x47')]};return db[_0xb9a5('0x38')][_0xb9a5('0x29')](_0x248869)[_0xb9a5('0x2e')](function(_0x5e99b0){_0x123eec[_0xb9a5('0x29')]=_0x5e99b0;if(_0x2a6295['query'][_0xb9a5('0x4b')]){_0x599470[_0xb9a5('0x4c')]=[{'all':!![]}];}return db[_0xb9a5('0x38')][_0xb9a5('0x4d')](_0x599470);})[_0xb9a5('0x2e')](function(_0x3ede6e){_0x123eec[_0xb9a5('0x4e')]=_0x3ede6e;return _0x123eec;})[_0xb9a5('0x2e')](respondWithFilteredResult(_0x4cee67,_0x599470))[_0xb9a5('0x4f')](handleError(_0x4cee67,null));};exports['show']=function(_0xf47866,_0x423860){var _0x675bae={'raw':!![],'where':{'id':_0xf47866['params']['id']}},_0x3b82b0={};_0x3b82b0[_0xb9a5('0x3c')]=_[_0xb9a5('0x3e')](db[_0xb9a5('0x38')]['rawAttributes']);_0x3b82b0[_0xb9a5('0x3d')]=_[_0xb9a5('0x3e')](_0xf47866[_0xb9a5('0x3d')]);_0x3b82b0[_0xb9a5('0x3f')]=_[_0xb9a5('0x41')](_0x3b82b0['model'],_0x3b82b0['query']);_0x675bae['attributes']=_[_0xb9a5('0x41')](_0x3b82b0['model'],qs['fields'](_0xf47866[_0xb9a5('0x3d')][_0xb9a5('0x42')]));_0x675bae[_0xb9a5('0x40')]=_0x675bae[_0xb9a5('0x40')][_0xb9a5('0x50')]?_0x675bae[_0xb9a5('0x40')]:_0x3b82b0[_0xb9a5('0x3c')];if(_0xf47866[_0xb9a5('0x3d')][_0xb9a5('0x4b')]){_0x675bae[_0xb9a5('0x4c')]=[{'all':!![]}];}_0x675bae=_[_0xb9a5('0x48')]({},_0x675bae,_0xf47866[_0xb9a5('0x4a')]);return db['OpenchannelQueue'][_0xb9a5('0x51')](_0x675bae)['then'](handleEntityNotFound(_0x423860,null))[_0xb9a5('0x2e')](respondWithResult(_0x423860,null))[_0xb9a5('0x4f')](handleError(_0x423860,null));};exports[_0xb9a5('0x52')]=function(_0x4f3a93,_0x26d752){return db['OpenchannelQueue'][_0xb9a5('0x52')](_0x4f3a93[_0xb9a5('0x53')],{})[_0xb9a5('0x2e')](function(_0x33c951){var _0x581034=_0x4f3a93[_0xb9a5('0x54')][_0xb9a5('0x30')]({'plain':!![]});if(!_0x581034)throw new Error(_0xb9a5('0x55'));if(_0x581034[_0xb9a5('0x56')]===_0xb9a5('0x54')){var _0x17104a=_0x33c951[_0xb9a5('0x30')]({'plain':!![]});var _0x3d9fdd='OpenchannelQueues';return db['UserProfileSection'][_0xb9a5('0x51')]({'where':{'name':_0x3d9fdd,'userProfileId':_0x581034[_0xb9a5('0x57')]},'raw':!![]})[_0xb9a5('0x2e')](function(_0x2cbb35){if(_0x2cbb35&&_0x2cbb35[_0xb9a5('0x58')]===0x0){return db[_0xb9a5('0x32')]['create']({'name':_0x17104a['name'],'resourceId':_0x17104a['id'],'type':_0x2cbb35[_0xb9a5('0x35')],'sectionId':_0x2cbb35['id']},{})[_0xb9a5('0x2e')](function(){return _0x33c951;});}else{return _0x33c951;}})['catch'](function(_0x1ff5c9){logger[_0xb9a5('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ff5c9);throw _0x1ff5c9;});}return _0x33c951;})[_0xb9a5('0x2e')](respondWithResult(_0x26d752,0xc9))[_0xb9a5('0x4f')](handleError(_0x26d752,null));};exports[_0xb9a5('0x2d')]=function(_0x2a8134,_0x267458){if(_0x2a8134[_0xb9a5('0x53')]['id']){delete _0x2a8134['body']['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x2a8134[_0xb9a5('0x59')]['id']}})[_0xb9a5('0x2e')](handleEntityNotFound(_0x267458,null))[_0xb9a5('0x2e')](saveUpdates(_0x2a8134[_0xb9a5('0x53')],null))[_0xb9a5('0x2e')](respondWithResult(_0x267458,null))[_0xb9a5('0x4f')](handleError(_0x267458,null));};exports[_0xb9a5('0x2f')]=function(_0x19289d,_0x4b729b){return db[_0xb9a5('0x38')][_0xb9a5('0x51')]({'where':{'id':_0x19289d[_0xb9a5('0x59')]['id']}})[_0xb9a5('0x2e')](handleEntityNotFound(_0x4b729b,null))[_0xb9a5('0x2e')](removeEntity(_0x4b729b,null))[_0xb9a5('0x4f')](handleError(_0x4b729b,null));};exports[_0xb9a5('0x5a')]=function(_0x421b45,_0x33b93a){return db[_0xb9a5('0x38')]['describe']()['then'](respondWithResult(_0x33b93a,null))[_0xb9a5('0x4f')](handleError(_0x33b93a,null));};exports[_0xb9a5('0x5b')]=function(_0x44e938,_0xeb74e6,_0x5ae03b){var _0x185544={'raw':!![],'where':{}},_0x159ee6={},_0x330dd9;return db[_0xb9a5('0x38')]['findOne']({'where':{'id':_0x44e938[_0xb9a5('0x59')]['id']}})[_0xb9a5('0x2e')](handleEntityNotFound(_0xeb74e6,null))[_0xb9a5('0x2e')](function(_0x5a2b7a){if(_0x5a2b7a){_0x330dd9=_0x5a2b7a[_0xb9a5('0x30')]({'plain':!![]});_0x159ee6['model']=_[_0xb9a5('0x3e')](db[_0xb9a5('0x5c')][_0xb9a5('0x39')]);_0x159ee6[_0xb9a5('0x3d')]=_[_0xb9a5('0x3e')](_0x44e938[_0xb9a5('0x3d')]);_0x159ee6[_0xb9a5('0x3f')]=_[_0xb9a5('0x41')](_0x159ee6[_0xb9a5('0x3c')],_0x159ee6[_0xb9a5('0x3d')]);_0x185544['attributes']=_['intersection'](_0x159ee6['model'],qs[_0xb9a5('0x42')](_0x44e938[_0xb9a5('0x3d')][_0xb9a5('0x42')]));_0x185544[_0xb9a5('0x40')]=_0x185544[_0xb9a5('0x40')]['length']?_0x185544[_0xb9a5('0x40')]:_0x159ee6[_0xb9a5('0x3c')];if(!_0x44e938[_0xb9a5('0x3d')][_0xb9a5('0x43')](_0xb9a5('0x44'))){_0x185544[_0xb9a5('0x27')]=qs['limit'](_0x44e938[_0xb9a5('0x3d')]['limit']);_0x185544['offset']=qs[_0xb9a5('0x26')](_0x44e938[_0xb9a5('0x3d')][_0xb9a5('0x26')]);}_0x185544[_0xb9a5('0x45')]=qs[_0xb9a5('0x46')](_0x44e938[_0xb9a5('0x3d')][_0xb9a5('0x46')]);_0x185544[_0xb9a5('0x47')]=qs[_0xb9a5('0x3f')](_[_0xb9a5('0x5d')](_0x44e938[_0xb9a5('0x3d')],_0x159ee6['filters']));_0x185544['where'][_0xb9a5('0x5e')]=_0x5a2b7a['id'];if(_0x44e938[_0xb9a5('0x3d')][_0xb9a5('0x49')]){_0x185544[_0xb9a5('0x47')]=_['merge'](_0x185544['where'],{'$or':_[_0xb9a5('0x37')](_0x185544[_0xb9a5('0x40')],function(_0x338319){var _0x51e65d={};_0x51e65d[_0x338319]={'$like':'%'+_0x44e938[_0xb9a5('0x3d')][_0xb9a5('0x49')]+'%'};return _0x51e65d;})});}_0x185544=_['merge']({},_0x185544,_0x44e938[_0xb9a5('0x4a')]);return db['UserOpenchannelQueue'][_0xb9a5('0x4d')](_0x185544);}})[_0xb9a5('0x2e')](function(_0xba812a){if(_0xba812a){return db[_0xb9a5('0x5f')]['findAndCountAll']({'where':{'id':_[_0xb9a5('0x37')](_0xba812a,_0xb9a5('0x60')),'role':_0xb9a5('0x61')},'attributes':['id',_0xb9a5('0x35'),_0xb9a5('0x62'),_0xb9a5('0x63'),_0xb9a5('0x64')]});}})['then'](function(_0x2f35c1){if(_0x2f35c1){return{'count':_0x2f35c1['count'],'rows':_[_0xb9a5('0x37')](_0x2f35c1[_0xb9a5('0x4e')],function(_0x52acc3){return{'membername':_0x52acc3['name'],'UserId':_0x52acc3['id'],'queue_name':_0x330dd9[_0xb9a5('0x35')],'OpenchannelQueueId':_0x330dd9['id'],'interface':util[_0xb9a5('0x65')]('%s/%s',_0xb9a5('0x66'),_0x52acc3['name']),'penalty':0x0,'paused':_0x52acc3['openchannelPause'],'createdAt':_0x52acc3[_0xb9a5('0x64')],'updatedAt':_0x52acc3[_0xb9a5('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb9a5('0x2e')](respondWithFilteredResult(_0xeb74e6,_0x185544))['catch'](handleError(_0xeb74e6,null));};exports[_0xb9a5('0x67')]=function(_0x17e170,_0x560f10,_0xd6e3bb){var _0xd164dc={};var _0xfc72a8={};var _0x3f5f17;var _0x550c32;return db[_0xb9a5('0x38')]['findOne']({'where':{'id':_0x17e170['params']['id']}})[_0xb9a5('0x2e')](handleEntityNotFound(_0x560f10,null))[_0xb9a5('0x2e')](function(_0x280ff6){if(_0x280ff6){_0x3f5f17=_0x280ff6;_0xfc72a8[_0xb9a5('0x3c')]=_[_0xb9a5('0x3e')](db[_0xb9a5('0x68')][_0xb9a5('0x39')]);_0xfc72a8[_0xb9a5('0x3d')]=_[_0xb9a5('0x3e')](_0x17e170[_0xb9a5('0x3d')]);_0xfc72a8[_0xb9a5('0x3f')]=_[_0xb9a5('0x41')](_0xfc72a8[_0xb9a5('0x3c')],_0xfc72a8['query']);_0xd164dc[_0xb9a5('0x40')]=_['intersection'](_0xfc72a8[_0xb9a5('0x3c')],qs[_0xb9a5('0x42')](_0x17e170[_0xb9a5('0x3d')]['fields']));_0xd164dc['attributes']=_0xd164dc[_0xb9a5('0x40')]['length']?_0xd164dc[_0xb9a5('0x40')]:_0xfc72a8[_0xb9a5('0x3c')];_0xd164dc[_0xb9a5('0x45')]=qs[_0xb9a5('0x46')](_0x17e170[_0xb9a5('0x3d')]['sort']);_0xd164dc[_0xb9a5('0x47')]=qs['filters'](_[_0xb9a5('0x5d')](_0x17e170[_0xb9a5('0x3d')],_0xfc72a8[_0xb9a5('0x3f')]));if(_0x17e170[_0xb9a5('0x3d')][_0xb9a5('0x49')]){_0xd164dc[_0xb9a5('0x47')]=_[_0xb9a5('0x48')](_0xd164dc[_0xb9a5('0x47')],{'$or':_[_0xb9a5('0x37')](_0xd164dc[_0xb9a5('0x40')],function(_0x587b25){var _0x1d667b={};_0x1d667b[_0x587b25]={'$like':'%'+_0x17e170[_0xb9a5('0x3d')]['filter']+'%'};return _0x1d667b;})});}_0xd164dc=_[_0xb9a5('0x48')]({},_0xd164dc,_0x17e170[_0xb9a5('0x4a')]);return _0x3f5f17[_0xb9a5('0x67')](_0xd164dc);}})[_0xb9a5('0x2e')](function(_0x47b494){if(_0x47b494){_0x550c32=_0x47b494[_0xb9a5('0x50')];if(!_0x17e170[_0xb9a5('0x3d')][_0xb9a5('0x43')]('nolimit')){_0xd164dc[_0xb9a5('0x27')]=qs[_0xb9a5('0x27')](_0x17e170[_0xb9a5('0x3d')][_0xb9a5('0x27')]);_0xd164dc['offset']=qs['offset'](_0x17e170[_0xb9a5('0x3d')][_0xb9a5('0x26')]);}return _0x3f5f17[_0xb9a5('0x67')](_0xd164dc);}})[_0xb9a5('0x2e')](function(_0x3df679){if(_0x3df679){return _0x3df679?{'count':_0x550c32,'rows':_0x3df679}:null;}})[_0xb9a5('0x2e')](respondWithResult(_0x560f10,null))[_0xb9a5('0x4f')](handleError(_0x560f10,null));};exports[_0xb9a5('0x69')]=function(_0x45a51a,_0x5558fc,_0xc26d2){var _0x3dcc47=_0x45a51a[_0xb9a5('0x53')][_0xb9a5('0x6a')];return db['Team'][_0xb9a5('0x4d')]({'where':{'id':_0x3dcc47},'attributes':['id'],'include':[{'model':db[_0xb9a5('0x5f')],'as':_0xb9a5('0x6b'),'attributes':['id',_0xb9a5('0x35'),_0xb9a5('0x6c'),_0xb9a5('0x6d'),_0xb9a5('0x6e')],'raw':!![]}]})['then'](function(_0x27db2a){if(_0x27db2a){var _0x91b342=_['flatMap'](_0x27db2a,function(_0x7d4fa1){var _0x591d84=_0x7d4fa1[_0xb9a5('0x30')]({'plain':!![]});return _0x591d84[_0xb9a5('0x6b')];});return db[_0xb9a5('0x38')]['find']({'where':{'id':_0x45a51a[_0xb9a5('0x59')]['id']}})[_0xb9a5('0x2e')](function(_0x372ffa){return db[_0xb9a5('0x6f')][_0xb9a5('0x70')](function(_0x2e8acc){return _0x372ffa[_0xb9a5('0x69')](_0x3dcc47,{'transaction':_0x2e8acc})['then'](function(){return BPromise[_0xb9a5('0x71')](_0x91b342,function(_0x42318d){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x42318d['id'],'OpenchannelQueueId':_0x45a51a[_0xb9a5('0x59')]['id']},'transaction':_0x2e8acc});});})[_0xb9a5('0x2e')](function(){_0x91b342['forEach'](function(_0x313484){socket[_0xb9a5('0x72')](_0xb9a5('0x73'),{'UserId':_0x313484['id'],'OpenchannelQueueId':_0x372ffa['id']});});});});});}})[_0xb9a5('0x2e')](respondWithStatusCode(_0x5558fc,null))['catch'](handleError(_0x5558fc,null));};exports['removeTeams']=function(_0xd2f268,_0x2c24e5,_0x5e9d2a){return db['Team'][_0xb9a5('0x4d')]({'where':{'id':_0xd2f268['query'][_0xb9a5('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xb9a5('0x5f')],'as':_0xb9a5('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xb9a5('0x2e')](handleEntityNotFound(_0x2c24e5,null))[_0xb9a5('0x2e')](function(_0x4355e4){var _0x3d28d4=_[_0xb9a5('0x37')](_0x4355e4,'id');var _0x43c1e2=[];var _0x3a3f1c=[];var _0x2ae059=squel[_0xb9a5('0x74')]();_0x2ae059['field']('tq.TeamId')['from']('team_has_openchannel_queues','tq')[_0xb9a5('0x75')]('user_has_teams','ut',_0xb9a5('0x76'))[_0xb9a5('0x47')](_0xb9a5('0x77'),_0xd2f268['params']['id']);for(var _0x43250a=0x0;_0x43250a<_0x4355e4[_0xb9a5('0x50')];_0x43250a+=0x1){let _0x2e5b96=_0x4355e4[_0x43250a];for(var _0x46a5d6=0x0;_0x46a5d6<_0x2e5b96['Agents'][_0xb9a5('0x50')];_0x46a5d6+=0x1){let _0x41662d=_0x2e5b96['Agents'][_0x46a5d6];var _0xe9d023=_0x2ae059['clone']();_0xe9d023[_0xb9a5('0x47')]('ut.UserId\x20=\x20?',_0x41662d['id']);_0x3a3f1c[_0xb9a5('0x78')](db['sequelize'][_0xb9a5('0x3d')](_0xe9d023['toString'](),{'type':db[_0xb9a5('0x6f')][_0xb9a5('0x79')][_0xb9a5('0x7a')]})[_0xb9a5('0x2e')](function(_0x25c7f0){if(_0x25c7f0[_0xb9a5('0x50')]===0x1){return _0x41662d['id'];}else{var _0x283368=_['every'](_['map'](_0x25c7f0,_0xb9a5('0x7b')),function(_0x292770){return _['includes'](_0x3d28d4,_0x292770);});if(_0x283368){return _0x41662d['id'];}}}));}}return BPromise['all'](_0x3a3f1c)[_0xb9a5('0x2e')](function(_0x10a6cb){_0x43c1e2=_(_0x43c1e2)[_0xb9a5('0x7c')](_0x10a6cb)[_0xb9a5('0x7d')]()[_0xb9a5('0x7e')]();return db[_0xb9a5('0x38')][_0xb9a5('0x51')]({'where':{'id':_0xd2f268[_0xb9a5('0x59')]['id']}})[_0xb9a5('0x2e')](function(_0x16bc2a){return db['sequelize']['transaction'](function(_0x1649c0){return _0x16bc2a['removeTeams'](_0xd2f268[_0xb9a5('0x3d')][_0xb9a5('0x6a')],{'transaction':_0x1649c0})[_0xb9a5('0x2e')](function(){if(!_[_0xb9a5('0x7f')](_0x43c1e2)){return _0x16bc2a[_0xb9a5('0x80')](_0x43c1e2,{'transaction':_0x1649c0});}})[_0xb9a5('0x2e')](function(){_0x43c1e2[_0xb9a5('0x81')](function(_0x84d3cd){socket[_0xb9a5('0x72')]('userOpenchannelQueue:remove',{'UserId':_0x84d3cd,'OpenchannelQueueId':_0x16bc2a['id']});});});});});});})[_0xb9a5('0x2e')](respondWithStatusCode(_0x2c24e5,null))[_0xb9a5('0x4f')](handleError(_0x2c24e5,null));};exports['addAgents']=function(_0x15a596,_0x263432,_0xc00e20){return db['OpenchannelQueue'][_0xb9a5('0x51')]({'where':{'id':_0x15a596['params']['id']}})[_0xb9a5('0x2e')](handleEntityNotFound(_0x263432,null))['then'](function(_0x4ce031){if(_0x4ce031){return _0x4ce031['addAgents'](_0x15a596[_0xb9a5('0x53')][_0xb9a5('0x6a')],_[_0xb9a5('0x82')](_0x15a596[_0xb9a5('0x53')],[_0xb9a5('0x6a'),'id'])||{})[_0xb9a5('0x83')](function(_0x29a2aa){for(var _0x4446e6=0x0;_0x4446e6<_0x15a596[_0xb9a5('0x53')][_0xb9a5('0x6a')][_0xb9a5('0x50')];_0x4446e6+=0x1){socket[_0xb9a5('0x72')](_0xb9a5('0x73'),{'UserId':Number(_0x15a596[_0xb9a5('0x53')]['ids'][_0x4446e6]),'OpenchannelQueueId':Number(_0x15a596[_0xb9a5('0x59')]['id'])});}return _0x29a2aa;});}})['then'](respondWithResult(_0x263432,null))['catch'](handleError(_0x263432,null));};exports[_0xb9a5('0x80')]=function(_0x29c323,_0x19f6c1,_0x1ca0e4){return db[_0xb9a5('0x38')][_0xb9a5('0x51')]({'where':{'id':_0x29c323[_0xb9a5('0x59')]['id']}})['then'](handleEntityNotFound(_0x19f6c1,null))['then'](function(_0x44cca3){if(_0x44cca3){return _0x44cca3[_0xb9a5('0x80')](_0x29c323[_0xb9a5('0x3d')][_0xb9a5('0x6a')])[_0xb9a5('0x2e')](function(){if(_[_0xb9a5('0x84')](_0x29c323[_0xb9a5('0x3d')][_0xb9a5('0x6a')])){for(var _0x49d502=0x0;_0x49d502<_0x29c323[_0xb9a5('0x3d')]['ids']['length'];_0x49d502+=0x1){socket[_0xb9a5('0x72')]('userOpenchannelQueue:remove',{'UserId':Number(_0x29c323[_0xb9a5('0x3d')][_0xb9a5('0x6a')][_0x49d502]),'OpenchannelQueueId':Number(_0x29c323[_0xb9a5('0x59')]['id'])});}}else{socket[_0xb9a5('0x72')](_0xb9a5('0x85'),{'UserId':Number(_0x29c323[_0xb9a5('0x3d')][_0xb9a5('0x6a')]),'OpenchannelQueueId':Number(_0x29c323[_0xb9a5('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x19f6c1,null))['catch'](handleError(_0x19f6c1,null));};exports[_0xb9a5('0x86')]=function(_0x5e26b0,_0x6900ec,_0x549046){var _0x4dcd96={};var _0x1e8f0d={};var _0x3e15a2;var _0xb27e8b;return db[_0xb9a5('0x38')]['findOne']({'where':{'id':_0x5e26b0['params']['id']}})[_0xb9a5('0x2e')](handleEntityNotFound(_0x6900ec,null))[_0xb9a5('0x2e')](function(_0x287ab9){if(_0x287ab9){_0x3e15a2=_0x287ab9;_0x1e8f0d[_0xb9a5('0x3c')]=_['keys'](db[_0xb9a5('0x5f')]['rawAttributes']);_0x1e8f0d[_0xb9a5('0x3d')]=_[_0xb9a5('0x3e')](_0x5e26b0[_0xb9a5('0x3d')]);_0x1e8f0d['filters']=_[_0xb9a5('0x41')](_0x1e8f0d[_0xb9a5('0x3c')],_0x1e8f0d[_0xb9a5('0x3d')]);_0x4dcd96[_0xb9a5('0x40')]=_[_0xb9a5('0x41')](_0x1e8f0d[_0xb9a5('0x3c')],qs[_0xb9a5('0x42')](_0x5e26b0['query'][_0xb9a5('0x42')]));_0x4dcd96[_0xb9a5('0x40')]=_0x4dcd96[_0xb9a5('0x40')]['length']?_0x4dcd96[_0xb9a5('0x40')]:_0x1e8f0d['model'];_0x4dcd96[_0xb9a5('0x45')]=qs[_0xb9a5('0x46')](_0x5e26b0[_0xb9a5('0x3d')]['sort']);_0x4dcd96[_0xb9a5('0x47')]=qs['filters'](_['pick'](_0x5e26b0[_0xb9a5('0x3d')],_0x1e8f0d[_0xb9a5('0x3f')]));if(_0x5e26b0[_0xb9a5('0x3d')][_0xb9a5('0x49')]){_0x4dcd96[_0xb9a5('0x47')]=_[_0xb9a5('0x48')](_0x4dcd96[_0xb9a5('0x47')],{'$or':_[_0xb9a5('0x37')](_0x4dcd96['attributes'],function(_0x1c29b0){var _0x422b08={};_0x422b08[_0x1c29b0]={'$like':'%'+_0x5e26b0[_0xb9a5('0x3d')][_0xb9a5('0x49')]+'%'};return _0x422b08;})});}_0x4dcd96=_[_0xb9a5('0x48')]({},_0x4dcd96,_0x5e26b0[_0xb9a5('0x4a')]);return _0x3e15a2['getAgents'](_0x4dcd96);}})['then'](function(_0x1a8ea6){if(_0x1a8ea6){_0xb27e8b=_0x1a8ea6[_0xb9a5('0x50')];if(!_0x5e26b0[_0xb9a5('0x3d')][_0xb9a5('0x43')](_0xb9a5('0x44'))){_0x4dcd96[_0xb9a5('0x27')]=qs[_0xb9a5('0x27')](_0x5e26b0['query'][_0xb9a5('0x27')]);_0x4dcd96[_0xb9a5('0x26')]=qs['offset'](_0x5e26b0[_0xb9a5('0x3d')][_0xb9a5('0x26')]);}return _0x3e15a2[_0xb9a5('0x86')](_0x4dcd96);}})['then'](function(_0x306f8e){if(_0x306f8e){return _0x306f8e?{'count':_0xb27e8b,'rows':_0x306f8e}:null;}})[_0xb9a5('0x2e')](respondWithResult(_0x6900ec,null))['catch'](handleError(_0x6900ec,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index cefe529..71815c0 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 _0xdc10=['OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2336be,_0xad8474){var _0x41ca43=function(_0x14800b){while(--_0x14800b){_0x2336be['push'](_0x2336be['shift']());}};_0x41ca43(++_0xad8474);}(_0xdc10,0x169));var _0x0dc1=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xdc10[_0x3d42d8];return _0x27fc41;};'use strict';var EventEmitter=require(_0x0dc1('0x0'));var OpenchannelQueue=require(_0x0dc1('0x1'))['db'][_0x0dc1('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x0dc1('0x3')](0x0);var events={'afterCreate':_0x0dc1('0x4'),'afterUpdate':_0x0dc1('0x5'),'afterDestroy':_0x0dc1('0x6')};function emitEvent(_0x280c78){return function(_0x3da089,_0x39fd41,_0xbe907f){OpenchannelQueueEvents[_0x0dc1('0x7')](_0x280c78+':'+_0x3da089['id'],_0x3da089);OpenchannelQueueEvents['emit'](_0x280c78,_0x3da089);_0xbe907f(null);};}for(var e in events){if(events[_0x0dc1('0x8')](e)){var event=events[e];OpenchannelQueue[_0x0dc1('0x9')](e,emitEvent(event));}}module[_0x0dc1('0xa')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x805f=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0x4b608f,_0x2efaca){var _0x3b8ccb=function(_0x3f35fb){while(--_0x3f35fb){_0x4b608f['push'](_0x4b608f['shift']());}};_0x3b8ccb(++_0x2efaca);}(_0x805f,0x13b));var _0xf805=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x805f[_0x2be8c2];return _0x97f531;};'use strict';var EventEmitter=require(_0xf805('0x0'));var OpenchannelQueue=require(_0xf805('0x1'))['db'][_0xf805('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xf805('0x3')](0x0);var events={'afterCreate':_0xf805('0x4'),'afterUpdate':_0xf805('0x5'),'afterDestroy':_0xf805('0x6')};function emitEvent(_0x199547){return function(_0x27d30c,_0x17b446,_0x1c6730){OpenchannelQueueEvents[_0xf805('0x7')](_0x199547+':'+_0x27d30c['id'],_0x27d30c);OpenchannelQueueEvents[_0xf805('0x7')](_0x199547,_0x27d30c);_0x1c6730(null);};}for(var e in events){if(events[_0xf805('0x8')](e)){var event=events[e];OpenchannelQueue[_0xf805('0x9')](e,emitEvent(event));}}module[_0xf805('0xa')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 33f4918..e94a714 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 _0xeb5b=['rimraf','../../config/environment','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x234b4b,_0x5b5d44){var _0xaeb59c=function(_0x2b69de){while(--_0x2b69de){_0x234b4b['push'](_0x234b4b['shift']());}};_0xaeb59c(++_0x5b5d44);}(_0xeb5b,0x158));var _0xbeb5=function(_0x1dc640,_0x57424b){_0x1dc640=_0x1dc640-0x0;var _0x20e103=_0xeb5b[_0x1dc640];return _0x20e103;};'use strict';var _=require(_0xbeb5('0x0'));var util=require(_0xbeb5('0x1'));var logger=require(_0xbeb5('0x2'))(_0xbeb5('0x3'));var moment=require('moment');var BPromise=require(_0xbeb5('0x4'));var rp=require(_0xbeb5('0x5'));var fs=require('fs');var path=require(_0xbeb5('0x6'));var rimraf=require(_0xbeb5('0x7'));var config=require(_0xbeb5('0x8'));var attributes=require('./openchannelQueue.attributes');module[_0xbeb5('0x9')]=function(_0x58ce90,_0x34ae1c){return _0x58ce90[_0xbeb5('0xa')](_0xbeb5('0xb'),attributes,{'tableName':_0xbeb5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5153=['exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./openchannelQueue.attributes'];(function(_0x3b5f66,_0x1dbfc5){var _0x4aa1a8=function(_0x57c05c){while(--_0x57c05c){_0x3b5f66['push'](_0x3b5f66['shift']());}};_0x4aa1a8(++_0x1dbfc5);}(_0x5153,0xc4));var _0x3515=function(_0x4cadd8,_0x31e6f5){_0x4cadd8=_0x4cadd8-0x0;var _0x3034bf=_0x5153[_0x4cadd8];return _0x3034bf;};'use strict';var _=require(_0x3515('0x0'));var util=require(_0x3515('0x1'));var logger=require(_0x3515('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3515('0x3'));var rp=require(_0x3515('0x4'));var fs=require('fs');var path=require(_0x3515('0x5'));var rimraf=require('rimraf');var config=require(_0x3515('0x6'));var attributes=require(_0x3515('0x7'));module[_0x3515('0x8')]=function(_0x53e6e7,_0x48729a){return _0x53e6e7[_0x3515('0x9')](_0x3515('0xa'),attributes,{'tableName':_0x3515('0xb'),'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 035ce31..e09f946 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 _0xe9b3=['./openchannelQueue.socket','register','request','then','info','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','OpenchannelQueue,\x20%s,\x20%s','GetOpenchannelQueue','OpenchannelQueue','findAll','options','attributes','limit','include','map','model','ShowOpenchannelQueue','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0xa174c9,_0x52bda5){var _0x2781b9=function(_0x2450e6){while(--_0x2450e6){_0xa174c9['push'](_0xa174c9['shift']());}};_0x2781b9(++_0x52bda5);}(_0xe9b3,0x1b5));var _0x3e9b=function(_0x48dbe0,_0x382761){_0x48dbe0=_0x48dbe0-0x0;var _0x412c2c=_0xe9b3[_0x48dbe0];return _0x412c2c;};'use strict';var _=require(_0x3e9b('0x0'));var util=require(_0x3e9b('0x1'));var moment=require(_0x3e9b('0x2'));var BPromise=require(_0x3e9b('0x3'));var rs=require(_0x3e9b('0x4'));var fs=require('fs');var Redis=require(_0x3e9b('0x5'));var db=require(_0x3e9b('0x6'))['db'];var utils=require(_0x3e9b('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x3e9b('0x8'));var jayson=require(_0x3e9b('0x9'));var client=jayson[_0x3e9b('0xa')][_0x3e9b('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3e9b('0xc')],{'host':_0x3e9b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3e9b('0xc')]));require(_0x3e9b('0xe'))[_0x3e9b('0xf')](socket);function respondWithRpcPromise(_0x1214a1,_0x3d8928,_0x1419b8){return new BPromise(function(_0x3cda0f,_0x5e3dbf){return client[_0x3e9b('0x10')](_0x1214a1,_0x1419b8)[_0x3e9b('0x11')](function(_0x3fcb59){logger[_0x3e9b('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x3d8928,'request\x20sent');logger[_0x3e9b('0x13')](_0x3e9b('0x14'),_0x3d8928,_0x3e9b('0x15'),JSON[_0x3e9b('0x16')](_0x3fcb59));if(_0x3fcb59[_0x3e9b('0x17')]){if(_0x3fcb59[_0x3e9b('0x17')][_0x3e9b('0x18')]===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x3d8928,_0x3fcb59[_0x3e9b('0x17')][_0x3e9b('0x19')]);return _0x5e3dbf(_0x3fcb59[_0x3e9b('0x17')]['message']);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x3d8928,_0x3fcb59[_0x3e9b('0x17')][_0x3e9b('0x19')]);return _0x3cda0f(_0x3fcb59['error'][_0x3e9b('0x19')]);}else{logger[_0x3e9b('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x3d8928,'request\x20sent');_0x3cda0f(_0x3fcb59['result'][_0x3e9b('0x19')]);}})[_0x3e9b('0x1a')](function(_0x481c2d){logger['error'](_0x3e9b('0x1b'),_0x3d8928,_0x481c2d);_0x5e3dbf(_0x481c2d);});});}exports[_0x3e9b('0x1c')]=function(_0x420107){var _0x2242a8=this;return new Promise(function(_0x4a1037,_0x2d431f){return db[_0x3e9b('0x1d')][_0x3e9b('0x1e')]({'raw':_0x420107[_0x3e9b('0x1f')]?_0x420107['options']['raw']===undefined?!![]:![]:!![],'where':_0x420107[_0x3e9b('0x1f')]?_0x420107[_0x3e9b('0x1f')]['where']||null:null,'attributes':_0x420107[_0x3e9b('0x1f')]?_0x420107[_0x3e9b('0x1f')][_0x3e9b('0x20')]||null:null,'limit':_0x420107[_0x3e9b('0x1f')]?_0x420107['options'][_0x3e9b('0x21')]||null:null,'include':_0x420107['options']?_0x420107[_0x3e9b('0x1f')][_0x3e9b('0x22')]?_[_0x3e9b('0x23')](_0x420107[_0x3e9b('0x1f')][_0x3e9b('0x22')],function(_0x2b3c36){return{'model':db[_0x2b3c36[_0x3e9b('0x24')]],'as':_0x2b3c36['as'],'attributes':_0x2b3c36['attributes'],'include':_0x2b3c36[_0x3e9b('0x22')]?_[_0x3e9b('0x23')](_0x2b3c36['include'],function(_0x4adf25){return{'model':db[_0x4adf25[_0x3e9b('0x24')]],'as':_0x4adf25['as'],'attributes':_0x4adf25['attributes'],'include':_0x4adf25[_0x3e9b('0x22')]?_['map'](_0x4adf25['include'],function(_0x42c507){return{'model':db[_0x42c507[_0x3e9b('0x24')]],'as':_0x42c507['as'],'attributes':_0x42c507['attributes']};}):[]};}):[]};}):[]:[]})[_0x3e9b('0x11')](function(_0x3c7d03){logger[_0x3e9b('0x12')](_0x3e9b('0x1c'),_0x420107);logger[_0x3e9b('0x13')](_0x3e9b('0x1c'),_0x420107,JSON[_0x3e9b('0x16')](_0x3c7d03));_0x4a1037(_0x3c7d03);})[_0x3e9b('0x1a')](function(_0x2059f5){logger['error'](_0x3e9b('0x1c'),_0x2059f5['message'],_0x420107);_0x2d431f(_0x2242a8[_0x3e9b('0x17')](0x1f4,_0x2059f5[_0x3e9b('0x19')]));});});};exports[_0x3e9b('0x25')]=function(_0x3ff963){var _0x5bf03e=this;return new Promise(function(_0x3b1e3b,_0x1f7c35){return db[_0x3e9b('0x1d')][_0x3e9b('0x26')]({'raw':_0x3ff963[_0x3e9b('0x1f')]?_0x3ff963[_0x3e9b('0x1f')][_0x3e9b('0x27')]===undefined?!![]:![]:!![],'where':_0x3ff963[_0x3e9b('0x1f')]?_0x3ff963[_0x3e9b('0x1f')][_0x3e9b('0x28')]||null:null,'attributes':_0x3ff963[_0x3e9b('0x1f')]?_0x3ff963[_0x3e9b('0x1f')][_0x3e9b('0x20')]||null:null,'include':_0x3ff963[_0x3e9b('0x1f')]?_0x3ff963[_0x3e9b('0x1f')]['include']?_[_0x3e9b('0x23')](_0x3ff963[_0x3e9b('0x1f')][_0x3e9b('0x22')],function(_0x3d35a3){return{'model':db[_0x3d35a3['model']],'as':_0x3d35a3['as'],'attributes':_0x3d35a3['attributes'],'include':_0x3d35a3['include']?_['map'](_0x3d35a3[_0x3e9b('0x22')],function(_0x35e26e){return{'model':db[_0x35e26e['model']],'as':_0x35e26e['as'],'attributes':_0x35e26e[_0x3e9b('0x20')],'include':_0x35e26e['include']?_[_0x3e9b('0x23')](_0x35e26e[_0x3e9b('0x22')],function(_0xbd2028){return{'model':db[_0xbd2028[_0x3e9b('0x24')]],'as':_0xbd2028['as'],'attributes':_0xbd2028['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x170457){logger[_0x3e9b('0x12')]('ShowOpenchannelQueue',_0x3ff963);logger[_0x3e9b('0x13')](_0x3e9b('0x25'),_0x3ff963,JSON['stringify'](_0x170457));_0x3b1e3b(_0x170457);})['catch'](function(_0x3cb73b){logger['error'](_0x3e9b('0x25'),_0x3cb73b[_0x3e9b('0x19')],_0x3ff963);_0x1f7c35(_0x5bf03e['error'](0x1f4,_0x3cb73b[_0x3e9b('0x19')]));});});}; \ No newline at end of file +var _0xb7dd=['raw','where','include','map','attributes','model','then','catch','ShowOpenchannelQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./openchannelQueue.socket','register','request','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelQueue,\x20%s,\x20%s','GetOpenchannelQueue','OpenchannelQueue','findAll','options'];(function(_0x5d6bdb,_0x1d9f93){var _0x3454ba=function(_0x4f0955){while(--_0x4f0955){_0x5d6bdb['push'](_0x5d6bdb['shift']());}};_0x3454ba(++_0x1d9f93);}(_0xb7dd,0xf9));var _0xdb7d=function(_0x534935,_0x991297){_0x534935=_0x534935-0x0;var _0x75d4e9=_0xb7dd[_0x534935];return _0x75d4e9;};'use strict';var _=require(_0xdb7d('0x0'));var util=require('util');var moment=require(_0xdb7d('0x1'));var BPromise=require(_0xdb7d('0x2'));var rs=require(_0xdb7d('0x3'));var fs=require('fs');var Redis=require(_0xdb7d('0x4'));var db=require(_0xdb7d('0x5'))['db'];var utils=require(_0xdb7d('0x6'));var logger=require(_0xdb7d('0x7'))(_0xdb7d('0x8'));var config=require(_0xdb7d('0x9'));var jayson=require(_0xdb7d('0xa'));var client=jayson[_0xdb7d('0xb')][_0xdb7d('0xc')]({'port':0x232a});config['redis']=_[_0xdb7d('0xd')](config[_0xdb7d('0xe')],{'host':_0xdb7d('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdb7d('0xe')]));require(_0xdb7d('0x10'))[_0xdb7d('0x11')](socket);function respondWithRpcPromise(_0x1424da,_0x3f4c4d,_0x1a60c4){return new BPromise(function(_0xf776c,_0x18d63b){return client[_0xdb7d('0x12')](_0x1424da,_0x1a60c4)['then'](function(_0x4d3dc2){logger[_0xdb7d('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x3f4c4d,_0xdb7d('0x14'));logger[_0xdb7d('0x15')](_0xdb7d('0x16'),_0x3f4c4d,_0xdb7d('0x14'),JSON[_0xdb7d('0x17')](_0x4d3dc2));if(_0x4d3dc2[_0xdb7d('0x18')]){if(_0x4d3dc2['error']['code']===0x1f4){logger[_0xdb7d('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x3f4c4d,_0x4d3dc2[_0xdb7d('0x18')][_0xdb7d('0x19')]);return _0x18d63b(_0x4d3dc2[_0xdb7d('0x18')][_0xdb7d('0x19')]);}logger[_0xdb7d('0x18')](_0xdb7d('0x1a'),_0x3f4c4d,_0x4d3dc2['error']['message']);return _0xf776c(_0x4d3dc2['error'][_0xdb7d('0x19')]);}else{logger[_0xdb7d('0x13')](_0xdb7d('0x1a'),_0x3f4c4d,_0xdb7d('0x14'));_0xf776c(_0x4d3dc2['result']['message']);}})['catch'](function(_0x3ba9a7){logger[_0xdb7d('0x18')](_0xdb7d('0x1a'),_0x3f4c4d,_0x3ba9a7);_0x18d63b(_0x3ba9a7);});});}exports[_0xdb7d('0x1b')]=function(_0xd40ed9){var _0x55df69=this;return new Promise(function(_0xe2e11c,_0x5b06ea){return db[_0xdb7d('0x1c')][_0xdb7d('0x1d')]({'raw':_0xd40ed9[_0xdb7d('0x1e')]?_0xd40ed9['options'][_0xdb7d('0x1f')]===undefined?!![]:![]:!![],'where':_0xd40ed9['options']?_0xd40ed9[_0xdb7d('0x1e')][_0xdb7d('0x20')]||null:null,'attributes':_0xd40ed9[_0xdb7d('0x1e')]?_0xd40ed9['options']['attributes']||null:null,'limit':_0xd40ed9[_0xdb7d('0x1e')]?_0xd40ed9[_0xdb7d('0x1e')]['limit']||null:null,'include':_0xd40ed9['options']?_0xd40ed9[_0xdb7d('0x1e')][_0xdb7d('0x21')]?_[_0xdb7d('0x22')](_0xd40ed9[_0xdb7d('0x1e')][_0xdb7d('0x21')],function(_0x1433d9){return{'model':db[_0x1433d9['model']],'as':_0x1433d9['as'],'attributes':_0x1433d9[_0xdb7d('0x23')],'include':_0x1433d9[_0xdb7d('0x21')]?_[_0xdb7d('0x22')](_0x1433d9[_0xdb7d('0x21')],function(_0xe09603){return{'model':db[_0xe09603['model']],'as':_0xe09603['as'],'attributes':_0xe09603['attributes'],'include':_0xe09603[_0xdb7d('0x21')]?_[_0xdb7d('0x22')](_0xe09603[_0xdb7d('0x21')],function(_0x37deee){return{'model':db[_0x37deee[_0xdb7d('0x24')]],'as':_0x37deee['as'],'attributes':_0x37deee[_0xdb7d('0x23')]};}):[]};}):[]};}):[]:[]})[_0xdb7d('0x25')](function(_0x9e029e){logger[_0xdb7d('0x13')]('GetOpenchannelQueue',_0xd40ed9);logger[_0xdb7d('0x15')](_0xdb7d('0x1b'),_0xd40ed9,JSON[_0xdb7d('0x17')](_0x9e029e));_0xe2e11c(_0x9e029e);})[_0xdb7d('0x26')](function(_0x2377b4){logger['error'](_0xdb7d('0x1b'),_0x2377b4[_0xdb7d('0x19')],_0xd40ed9);_0x5b06ea(_0x55df69[_0xdb7d('0x18')](0x1f4,_0x2377b4[_0xdb7d('0x19')]));});});};exports[_0xdb7d('0x27')]=function(_0x2e0149){var _0x35a2f8=this;return new Promise(function(_0x37306c,_0x57286a){return db['OpenchannelQueue']['find']({'raw':_0x2e0149['options']?_0x2e0149[_0xdb7d('0x1e')][_0xdb7d('0x1f')]===undefined?!![]:![]:!![],'where':_0x2e0149[_0xdb7d('0x1e')]?_0x2e0149['options'][_0xdb7d('0x20')]||null:null,'attributes':_0x2e0149[_0xdb7d('0x1e')]?_0x2e0149[_0xdb7d('0x1e')][_0xdb7d('0x23')]||null:null,'include':_0x2e0149[_0xdb7d('0x1e')]?_0x2e0149[_0xdb7d('0x1e')]['include']?_[_0xdb7d('0x22')](_0x2e0149[_0xdb7d('0x1e')]['include'],function(_0x51be1f){return{'model':db[_0x51be1f[_0xdb7d('0x24')]],'as':_0x51be1f['as'],'attributes':_0x51be1f[_0xdb7d('0x23')],'include':_0x51be1f[_0xdb7d('0x21')]?_[_0xdb7d('0x22')](_0x51be1f[_0xdb7d('0x21')],function(_0x2939ce){return{'model':db[_0x2939ce[_0xdb7d('0x24')]],'as':_0x2939ce['as'],'attributes':_0x2939ce[_0xdb7d('0x23')],'include':_0x2939ce[_0xdb7d('0x21')]?_['map'](_0x2939ce[_0xdb7d('0x21')],function(_0x2a2986){return{'model':db[_0x2a2986[_0xdb7d('0x24')]],'as':_0x2a2986['as'],'attributes':_0x2a2986['attributes']};}):[]};}):[]};}):[]:[]})[_0xdb7d('0x25')](function(_0x13541a){logger[_0xdb7d('0x13')](_0xdb7d('0x27'),_0x2e0149);logger['debug'](_0xdb7d('0x27'),_0x2e0149,JSON['stringify'](_0x13541a));_0x37306c(_0x13541a);})[_0xdb7d('0x26')](function(_0x2e1306){logger[_0xdb7d('0x18')](_0xdb7d('0x27'),_0x2e1306[_0xdb7d('0x19')],_0x2e0149);_0x57286a(_0x35a2f8[_0xdb7d('0x18')](0x1f4,_0x2e1306[_0xdb7d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index c2a84c4..15fb899 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 _0x141c=['./openchannelQueue.events','save','remove','emit','register','length','openchannelQueue:'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x141c,0x1b9));var _0xc141=function(_0x58fea9,_0x593aee){_0x58fea9=_0x58fea9-0x0;var _0x319266=_0x141c[_0x58fea9];return _0x319266;};'use strict';var OpenchannelQueueEvents=require(_0xc141('0x0'));var events=[_0xc141('0x1'),_0xc141('0x2'),'update'];function createListener(_0x3cfdf9,_0x493b02){return function(_0x57513c){_0x493b02[_0xc141('0x3')](_0x3cfdf9,_0x57513c);};}function removeListener(_0x319fa5,_0x5c3a15){return function(){OpenchannelQueueEvents['removeListener'](_0x319fa5,_0x5c3a15);};}exports[_0xc141('0x4')]=function(_0x5e237d){for(var _0x577e1f=0x0,_0x49275c=events[_0xc141('0x5')];_0x577e1f<_0x49275c;_0x577e1f++){var _0x18b34c=events[_0x577e1f];var _0x3959c0=createListener(_0xc141('0x6')+_0x18b34c,_0x5e237d);OpenchannelQueueEvents['on'](_0x18b34c,_0x3959c0);}}; \ No newline at end of file +var _0xcc92=['openchannelQueue:','save','remove','emit','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc92,0x1d5));var _0x2cc9=function(_0x24cc72,_0x4dc73a){_0x24cc72=_0x24cc72-0x0;var _0xd49f1e=_0xcc92[_0x24cc72];return _0xd49f1e;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x2cc9('0x0'),_0x2cc9('0x1'),'update'];function createListener(_0x3d73c1,_0x15da40){return function(_0x16179a){_0x15da40[_0x2cc9('0x2')](_0x3d73c1,_0x16179a);};}function removeListener(_0x4f5004,_0x4c3690){return function(){OpenchannelQueueEvents['removeListener'](_0x4f5004,_0x4c3690);};}exports[_0x2cc9('0x3')]=function(_0x55f7d3){for(var _0x39223e=0x0,_0x2ce8e1=events[_0x2cc9('0x4')];_0x39223e<_0x2ce8e1;_0x39223e++){var _0x2133e9=events[_0x39223e];var _0x204605=createListener(_0x2cc9('0x5')+_0x2133e9,_0x55f7d3);OpenchannelQueueEvents['on'](_0x2133e9,_0x204605);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 190e2ea..1c418ba 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 _0xcd71=['destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','put','/:id','update','delete'];(function(_0x473f51,_0x4c2b60){var _0x46a981=function(_0x20b64f){while(--_0x20b64f){_0x473f51['push'](_0x473f51['shift']());}};_0x46a981(++_0x4c2b60);}(_0xcd71,0x1e2));var _0x1cd7=function(_0x3e0f20,_0x4c1204){_0x3e0f20=_0x3e0f20-0x0;var _0x4dc50e=_0xcd71[_0x3e0f20];return _0x4dc50e;};'use strict';var multer=require(_0x1cd7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1cd7('0x1'));var express=require(_0x1cd7('0x2'));var router=express[_0x1cd7('0x3')]();var fs_extra=require(_0x1cd7('0x4'));var auth=require(_0x1cd7('0x5'));var interaction=require(_0x1cd7('0x6'));var config=require(_0x1cd7('0x7'));var controller=require('./openchannelQueueReport.controller');router[_0x1cd7('0x8')]('/',auth[_0x1cd7('0x9')](),controller[_0x1cd7('0xa')]);router[_0x1cd7('0x8')](_0x1cd7('0xb'),auth[_0x1cd7('0x9')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x1cd7('0xc')]);router[_0x1cd7('0xd')]('/',auth[_0x1cd7('0x9')](),controller['create']);router[_0x1cd7('0xe')](_0x1cd7('0xf'),auth[_0x1cd7('0x9')](),controller[_0x1cd7('0x10')]);router[_0x1cd7('0x11')](_0x1cd7('0xf'),auth[_0x1cd7('0x9')](),controller[_0x1cd7('0x12')]);module[_0x1cd7('0x13')]=router; \ No newline at end of file +var _0x8d2a=['create','put','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x509c90,_0x4659f5){var _0x65764c=function(_0x30cb3a){while(--_0x30cb3a){_0x509c90['push'](_0x509c90['shift']());}};_0x65764c(++_0x4659f5);}(_0x8d2a,0xe0));var _0xa8d2=function(_0x3a2299,_0x872183){_0x3a2299=_0x3a2299-0x0;var _0xfdc0c5=_0x8d2a[_0x3a2299];return _0xfdc0c5;};'use strict';var multer=require(_0xa8d2('0x0'));var util=require(_0xa8d2('0x1'));var path=require(_0xa8d2('0x2'));var timeout=require(_0xa8d2('0x3'));var express=require(_0xa8d2('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa8d2('0x5'));var interaction=require(_0xa8d2('0x6'));var config=require(_0xa8d2('0x7'));var controller=require(_0xa8d2('0x8'));router[_0xa8d2('0x9')]('/',auth[_0xa8d2('0xa')](),controller[_0xa8d2('0xb')]);router['get'](_0xa8d2('0xc'),auth[_0xa8d2('0xa')](),controller[_0xa8d2('0xd')]);router[_0xa8d2('0x9')](_0xa8d2('0xe'),auth[_0xa8d2('0xa')](),controller[_0xa8d2('0xf')]);router['post']('/',auth[_0xa8d2('0xa')](),controller[_0xa8d2('0x10')]);router[_0xa8d2('0x11')](_0xa8d2('0xe'),auth[_0xa8d2('0xa')](),controller[_0xa8d2('0x12')]);router['delete']('/:id',auth[_0xa8d2('0xa')](),controller['destroy']);module[_0xa8d2('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 893359d..190407f 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 _0x85ab=['moment','exports','STRING','DATE'];(function(_0x3974f2,_0x421976){var _0x463bde=function(_0x993467){while(--_0x993467){_0x3974f2['push'](_0x3974f2['shift']());}};_0x463bde(++_0x421976);}(_0x85ab,0x88));var _0xb85a=function(_0x3b601a,_0x1fcc08){_0x3b601a=_0x3b601a-0x0;var _0x3b4d2b=_0x85ab[_0x3b601a];return _0x3b4d2b;};'use strict';var moment=require(_0xb85a('0x0'));var Sequelize=require('sequelize');module[_0xb85a('0x1')]={'uniqueid':{'type':Sequelize[_0xb85a('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb85a('0x2')]},'joinAt':{'type':Sequelize[_0xb85a('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb85a('0x3')]},'reason':{'type':Sequelize[_0xb85a('0x2')]}}; \ No newline at end of file +var _0xd081=['DATE','moment','STRING'];(function(_0x616fb8,_0x177e11){var _0x739e20=function(_0xfe27e9){while(--_0xfe27e9){_0x616fb8['push'](_0x616fb8['shift']());}};_0x739e20(++_0x177e11);}(_0xd081,0x16f));var _0x1d08=function(_0x326960,_0x4e5496){_0x326960=_0x326960-0x0;var _0x5a3363=_0xd081[_0x326960];return _0x5a3363;};'use strict';var moment=require(_0x1d08('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x1d08('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x1d08('0x1')]},'joinAt':{'type':Sequelize[_0x1d08('0x2')]},'leaveAt':{'type':Sequelize[_0x1d08('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x1d08('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 070b4ee..55aafcc 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 _0xef3e=['offset','undefined','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','OpenchannelQueueReport','count','includeAll','include','findAll','rows','find','catch','create','body','params','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xef3e,0x163));var _0xeef3=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xef3e[_0xdea41a];return _0x15d0d8;};'use strict';var emlformat=require(_0xeef3('0x0'));var rimraf=require(_0xeef3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeef3('0x2'));var rp=require('request-promise');var moment=require(_0xeef3('0x3'));var BPromise=require(_0xeef3('0x4'));var Mustache=require(_0xeef3('0x5'));var util=require(_0xeef3('0x6'));var path=require('path');var sox=require(_0xeef3('0x7'));var csv=require('to-csv');var ejs=require(_0xeef3('0x8'));var fs=require('fs');var fs_extra=require(_0xeef3('0x9'));var _=require(_0xeef3('0xa'));var squel=require(_0xeef3('0xb'));var crypto=require(_0xeef3('0xc'));var jsforce=require(_0xeef3('0xd'));var deskjs=require(_0xeef3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xeef3('0xf'));var Papa=require(_0xeef3('0x10'));var Redis=require(_0xeef3('0x11'));var authService=require(_0xeef3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xeef3('0x13'));var hardwareService=require(_0xeef3('0x14'));var logger=require('../../config/logger')(_0xeef3('0x15'));var utils=require(_0xeef3('0x16'));var config=require(_0xeef3('0x17'));var licenseUtil=require(_0xeef3('0x18'));var db=require(_0xeef3('0x19'))['db'];function respondWithStatusCode(_0x5642b8,_0x1486a3){_0x1486a3=_0x1486a3||0xcc;return function(_0x4f893e){if(_0x4f893e){return _0x5642b8[_0xeef3('0x1a')](_0x1486a3);}return _0x5642b8['status'](_0x1486a3)[_0xeef3('0x1b')]();};}function respondWithResult(_0x5449d9,_0x431250){_0x431250=_0x431250||0xc8;return function(_0x747793){if(_0x747793){return _0x5449d9[_0xeef3('0x1c')](_0x431250)[_0xeef3('0x1d')](_0x747793);}};}function respondWithFilteredResult(_0x3cfcb7,_0x27a31d){return function(_0x778c2a){if(_0x778c2a){var _0x189274=typeof _0x27a31d[_0xeef3('0x1e')]===_0xeef3('0x1f')&&typeof _0x27a31d['limit']===_0xeef3('0x1f');var _0x105e22=_0x778c2a['count'];var _0x10bd5a=_0x189274?0x0:_0x27a31d[_0xeef3('0x1e')];var _0x241d34=_0x189274?_0x778c2a['count']:_0x27a31d[_0xeef3('0x1e')]+_0x27a31d[_0xeef3('0x20')];var _0x286770;if(_0x241d34>=_0x105e22){_0x241d34=_0x105e22;_0x286770=0xc8;}else{_0x286770=0xce;}_0x3cfcb7[_0xeef3('0x1c')](_0x286770);return _0x3cfcb7[_0xeef3('0x21')]('Content-Range',_0x10bd5a+'-'+_0x241d34+'/'+_0x105e22)['json'](_0x778c2a);}return null;};}function patchUpdates(_0x4a9d56){return function(_0x401871){try{jsonpatch[_0xeef3('0x22')](_0x401871,_0x4a9d56,!![]);}catch(_0x1d7ece){return BPromise[_0xeef3('0x23')](_0x1d7ece);}return _0x401871[_0xeef3('0x24')]();};}function saveUpdates(_0x566bf4,_0x45b8f7){return function(_0x45a682){if(_0x45a682){return _0x45a682[_0xeef3('0x25')](_0x566bf4)[_0xeef3('0x26')](function(_0x46eb17){return _0x46eb17;});}return null;};}function removeEntity(_0x166050,_0x380b05){return function(_0x4f2eaa){if(_0x4f2eaa){return _0x4f2eaa[_0xeef3('0x27')]()[_0xeef3('0x26')](function(){_0x166050['status'](0xcc)[_0xeef3('0x1b')]();});}};}function handleEntityNotFound(_0x249d7f,_0xa3152f){return function(_0x1f08b0){if(!_0x1f08b0){_0x249d7f[_0xeef3('0x1a')](0x194);}return _0x1f08b0;};}function handleError(_0x53d45e,_0x138c22){_0x138c22=_0x138c22||0x1f4;return function(_0x536ca8){logger[_0xeef3('0x28')](_0x536ca8[_0xeef3('0x29')]);if(_0x536ca8[_0xeef3('0x2a')]){delete _0x536ca8[_0xeef3('0x2a')];}_0x53d45e[_0xeef3('0x1c')](_0x138c22)[_0xeef3('0x2b')](_0x536ca8);};}exports[_0xeef3('0x2c')]=function(_0x12d358,_0x2e6cd1){var _0x21d768={},_0x5dbbb7={},_0x1daac0={'count':0x0,'rows':[]};var _0x1e61c1=_[_0xeef3('0x2d')](db['OpenchannelQueueReport'][_0xeef3('0x2e')],function(_0x7ea4e2){return{'name':_0x7ea4e2[_0xeef3('0x2f')],'type':_0x7ea4e2['type'][_0xeef3('0x30')]};});_0x5dbbb7[_0xeef3('0x31')]=_['map'](_0x1e61c1,_0xeef3('0x2a'));_0x5dbbb7[_0xeef3('0x32')]=_[_0xeef3('0x33')](_0x12d358[_0xeef3('0x32')]);_0x5dbbb7[_0xeef3('0x34')]=_[_0xeef3('0x35')](_0x5dbbb7[_0xeef3('0x31')],_0x5dbbb7[_0xeef3('0x32')]);_0x21d768[_0xeef3('0x36')]=_[_0xeef3('0x35')](_0x5dbbb7[_0xeef3('0x31')],qs[_0xeef3('0x37')](_0x12d358[_0xeef3('0x32')][_0xeef3('0x37')]));_0x21d768[_0xeef3('0x36')]=_0x21d768['attributes'][_0xeef3('0x38')]?_0x21d768[_0xeef3('0x36')]:_0x5dbbb7['model'];if(!_0x12d358[_0xeef3('0x32')][_0xeef3('0x39')](_0xeef3('0x3a'))){_0x21d768[_0xeef3('0x20')]=qs[_0xeef3('0x20')](_0x12d358[_0xeef3('0x32')][_0xeef3('0x20')]);_0x21d768[_0xeef3('0x1e')]=qs['offset'](_0x12d358[_0xeef3('0x32')][_0xeef3('0x1e')]);}_0x21d768[_0xeef3('0x3b')]=qs['sort'](_0x12d358[_0xeef3('0x32')][_0xeef3('0x3c')]);_0x21d768[_0xeef3('0x3d')]=qs[_0xeef3('0x34')](_[_0xeef3('0x3e')](_0x12d358[_0xeef3('0x32')],_0x5dbbb7[_0xeef3('0x34')]),_0x1e61c1);if(_0x12d358[_0xeef3('0x32')][_0xeef3('0x3f')]){_0x21d768['where']=_[_0xeef3('0x40')](_0x21d768[_0xeef3('0x3d')],{'$or':_[_0xeef3('0x2d')](_0x1e61c1,function(_0x15e2b6){if(_0x15e2b6['type']!==_0xeef3('0x41')){var _0x4e9f93={};_0x4e9f93[_0x15e2b6['name']]={'$like':'%'+_0x12d358[_0xeef3('0x32')][_0xeef3('0x3f')]+'%'};return _0x4e9f93;}})});}_0x21d768=_[_0xeef3('0x40')]({},_0x21d768,_0x12d358['options']);var _0x4fbe84={'where':_0x21d768[_0xeef3('0x3d')]};return db[_0xeef3('0x42')][_0xeef3('0x43')](_0x4fbe84)[_0xeef3('0x26')](function(_0x5e61f8){_0x1daac0[_0xeef3('0x43')]=_0x5e61f8;if(_0x12d358[_0xeef3('0x32')][_0xeef3('0x44')]){_0x21d768[_0xeef3('0x45')]=[{'all':!![]}];}return db[_0xeef3('0x42')][_0xeef3('0x46')](_0x21d768);})[_0xeef3('0x26')](function(_0x3150b4){_0x1daac0[_0xeef3('0x47')]=_0x3150b4;return _0x1daac0;})[_0xeef3('0x26')](respondWithFilteredResult(_0x2e6cd1,_0x21d768))['catch'](handleError(_0x2e6cd1,null));};exports['show']=function(_0x42fa11,_0x2e58f1){var _0x1b0e77={'raw':!![],'where':{'id':_0x42fa11['params']['id']}},_0x4c25f4={};_0x4c25f4[_0xeef3('0x31')]=_['keys'](db[_0xeef3('0x42')][_0xeef3('0x2e')]);_0x4c25f4['query']=_['keys'](_0x42fa11['query']);_0x4c25f4[_0xeef3('0x34')]=_[_0xeef3('0x35')](_0x4c25f4[_0xeef3('0x31')],_0x4c25f4[_0xeef3('0x32')]);_0x1b0e77[_0xeef3('0x36')]=_[_0xeef3('0x35')](_0x4c25f4[_0xeef3('0x31')],qs[_0xeef3('0x37')](_0x42fa11['query'][_0xeef3('0x37')]));_0x1b0e77[_0xeef3('0x36')]=_0x1b0e77[_0xeef3('0x36')][_0xeef3('0x38')]?_0x1b0e77['attributes']:_0x4c25f4[_0xeef3('0x31')];if(_0x42fa11[_0xeef3('0x32')]['includeAll']){_0x1b0e77['include']=[{'all':!![]}];}_0x1b0e77=_[_0xeef3('0x40')]({},_0x1b0e77,_0x42fa11['options']);return db[_0xeef3('0x42')][_0xeef3('0x48')](_0x1b0e77)[_0xeef3('0x26')](handleEntityNotFound(_0x2e58f1,null))[_0xeef3('0x26')](respondWithResult(_0x2e58f1,null))[_0xeef3('0x49')](handleError(_0x2e58f1,null));};exports[_0xeef3('0x4a')]=function(_0x2377b3,_0x51913a){return db['OpenchannelQueueReport'][_0xeef3('0x4a')](_0x2377b3[_0xeef3('0x4b')],{})[_0xeef3('0x26')](respondWithResult(_0x51913a,0xc9))['catch'](handleError(_0x51913a,null));};exports[_0xeef3('0x25')]=function(_0x39f481,_0x3c7a91){if(_0x39f481[_0xeef3('0x4b')]['id']){delete _0x39f481[_0xeef3('0x4b')]['id'];}return db[_0xeef3('0x42')][_0xeef3('0x48')]({'where':{'id':_0x39f481[_0xeef3('0x4c')]['id']}})[_0xeef3('0x26')](handleEntityNotFound(_0x3c7a91,null))[_0xeef3('0x26')](saveUpdates(_0x39f481['body'],null))[_0xeef3('0x26')](respondWithResult(_0x3c7a91,null))['catch'](handleError(_0x3c7a91,null));};exports['destroy']=function(_0x4defb4,_0x52a34f){return db[_0xeef3('0x42')][_0xeef3('0x48')]({'where':{'id':_0x4defb4[_0xeef3('0x4c')]['id']}})[_0xeef3('0x26')](handleEntityNotFound(_0x52a34f,null))[_0xeef3('0x26')](removeEntity(_0x52a34f,null))[_0xeef3('0x49')](handleError(_0x52a34f,null));};exports['describe']=function(_0x4a1e87,_0x2c9770){return db[_0xeef3('0x42')]['describe']()[_0xeef3('0x26')](respondWithResult(_0x2c9770,null))[_0xeef3('0x49')](handleError(_0x2c9770,null));}; \ No newline at end of file +var _0xbbe9=['then','destroy','error','name','index','map','OpenchannelQueueReport','rawAttributes','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','show','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update'];(function(_0x27604f,_0x5ae336){var _0x40d189=function(_0xebacde){while(--_0xebacde){_0x27604f['push'](_0x27604f['shift']());}};_0x40d189(++_0x5ae336);}(_0xbbe9,0x10c));var _0x9bbe=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xbbe9[_0x36c5b0];return _0xf19333;};'use strict';var emlformat=require(_0x9bbe('0x0'));var rimraf=require(_0x9bbe('0x1'));var zipdir=require(_0x9bbe('0x2'));var jsonpatch=require(_0x9bbe('0x3'));var rp=require('request-promise');var moment=require(_0x9bbe('0x4'));var BPromise=require(_0x9bbe('0x5'));var Mustache=require(_0x9bbe('0x6'));var util=require(_0x9bbe('0x7'));var path=require(_0x9bbe('0x8'));var sox=require(_0x9bbe('0x9'));var csv=require(_0x9bbe('0xa'));var ejs=require(_0x9bbe('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9bbe('0xc'));var squel=require(_0x9bbe('0xd'));var crypto=require(_0x9bbe('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9bbe('0xf'));var toCsv=require(_0x9bbe('0xa'));var querystring=require(_0x9bbe('0x10'));var Papa=require(_0x9bbe('0x11'));var Redis=require(_0x9bbe('0x12'));var authService=require(_0x9bbe('0x13'));var qs=require(_0x9bbe('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9bbe('0x15'));var logger=require(_0x9bbe('0x16'))(_0x9bbe('0x17'));var utils=require(_0x9bbe('0x18'));var config=require(_0x9bbe('0x19'));var licenseUtil=require(_0x9bbe('0x1a'));var db=require(_0x9bbe('0x1b'))['db'];function respondWithStatusCode(_0x4135c9,_0x3acd06){_0x3acd06=_0x3acd06||0xcc;return function(_0x39bf14){if(_0x39bf14){return _0x4135c9[_0x9bbe('0x1c')](_0x3acd06);}return _0x4135c9[_0x9bbe('0x1d')](_0x3acd06)[_0x9bbe('0x1e')]();};}function respondWithResult(_0x5e0f7f,_0x5730bc){_0x5730bc=_0x5730bc||0xc8;return function(_0x4394d8){if(_0x4394d8){return _0x5e0f7f[_0x9bbe('0x1d')](_0x5730bc)[_0x9bbe('0x1f')](_0x4394d8);}};}function respondWithFilteredResult(_0x56dba2,_0x5f3fbd){return function(_0x2dddb9){if(_0x2dddb9){var _0x3322c0=typeof _0x5f3fbd[_0x9bbe('0x20')]==='undefined'&&typeof _0x5f3fbd[_0x9bbe('0x21')]===_0x9bbe('0x22');var _0x48f5c1=_0x2dddb9[_0x9bbe('0x23')];var _0x371c72=_0x3322c0?0x0:_0x5f3fbd[_0x9bbe('0x20')];var _0xde3a32=_0x3322c0?_0x2dddb9['count']:_0x5f3fbd[_0x9bbe('0x20')]+_0x5f3fbd['limit'];var _0x3ec6f3;if(_0xde3a32>=_0x48f5c1){_0xde3a32=_0x48f5c1;_0x3ec6f3=0xc8;}else{_0x3ec6f3=0xce;}_0x56dba2[_0x9bbe('0x1d')](_0x3ec6f3);return _0x56dba2[_0x9bbe('0x24')]('Content-Range',_0x371c72+'-'+_0xde3a32+'/'+_0x48f5c1)[_0x9bbe('0x1f')](_0x2dddb9);}return null;};}function patchUpdates(_0x2f215f){return function(_0x51339f){try{jsonpatch['apply'](_0x51339f,_0x2f215f,!![]);}catch(_0x5763a5){return BPromise[_0x9bbe('0x25')](_0x5763a5);}return _0x51339f[_0x9bbe('0x26')]();};}function saveUpdates(_0xea0100,_0x180284){return function(_0x5cd15c){if(_0x5cd15c){return _0x5cd15c[_0x9bbe('0x27')](_0xea0100)[_0x9bbe('0x28')](function(_0x49459d){return _0x49459d;});}return null;};}function removeEntity(_0xe0d2,_0x475623){return function(_0xece453){if(_0xece453){return _0xece453[_0x9bbe('0x29')]()[_0x9bbe('0x28')](function(){_0xe0d2[_0x9bbe('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x206633,_0x28093b){return function(_0x29277d){if(!_0x29277d){_0x206633[_0x9bbe('0x1c')](0x194);}return _0x29277d;};}function handleError(_0x387cbf,_0x97939){_0x97939=_0x97939||0x1f4;return function(_0x3627f6){logger[_0x9bbe('0x2a')](_0x3627f6['stack']);if(_0x3627f6[_0x9bbe('0x2b')]){delete _0x3627f6['name'];}_0x387cbf[_0x9bbe('0x1d')](_0x97939)['send'](_0x3627f6);};}exports[_0x9bbe('0x2c')]=function(_0x4a1d4c,_0x83cb9c){var _0x23790f={},_0x314902={},_0x1e6bd3={'count':0x0,'rows':[]};var _0x331000=_[_0x9bbe('0x2d')](db[_0x9bbe('0x2e')][_0x9bbe('0x2f')],function(_0xe1ea91){return{'name':_0xe1ea91['fieldName'],'type':_0xe1ea91[_0x9bbe('0x30')][_0x9bbe('0x31')]};});_0x314902[_0x9bbe('0x32')]=_[_0x9bbe('0x2d')](_0x331000,_0x9bbe('0x2b'));_0x314902[_0x9bbe('0x33')]=_['keys'](_0x4a1d4c[_0x9bbe('0x33')]);_0x314902['filters']=_['intersection'](_0x314902['model'],_0x314902['query']);_0x23790f[_0x9bbe('0x34')]=_[_0x9bbe('0x35')](_0x314902['model'],qs[_0x9bbe('0x36')](_0x4a1d4c[_0x9bbe('0x33')][_0x9bbe('0x36')]));_0x23790f[_0x9bbe('0x34')]=_0x23790f[_0x9bbe('0x34')][_0x9bbe('0x37')]?_0x23790f[_0x9bbe('0x34')]:_0x314902[_0x9bbe('0x32')];if(!_0x4a1d4c[_0x9bbe('0x33')][_0x9bbe('0x38')](_0x9bbe('0x39'))){_0x23790f[_0x9bbe('0x21')]=qs[_0x9bbe('0x21')](_0x4a1d4c[_0x9bbe('0x33')][_0x9bbe('0x21')]);_0x23790f[_0x9bbe('0x20')]=qs[_0x9bbe('0x20')](_0x4a1d4c[_0x9bbe('0x33')][_0x9bbe('0x20')]);}_0x23790f[_0x9bbe('0x3a')]=qs['sort'](_0x4a1d4c[_0x9bbe('0x33')][_0x9bbe('0x3b')]);_0x23790f['where']=qs[_0x9bbe('0x3c')](_[_0x9bbe('0x3d')](_0x4a1d4c[_0x9bbe('0x33')],_0x314902[_0x9bbe('0x3c')]),_0x331000);if(_0x4a1d4c[_0x9bbe('0x33')][_0x9bbe('0x3e')]){_0x23790f[_0x9bbe('0x3f')]=_['merge'](_0x23790f[_0x9bbe('0x3f')],{'$or':_[_0x9bbe('0x2d')](_0x331000,function(_0x113235){if(_0x113235[_0x9bbe('0x30')]!==_0x9bbe('0x40')){var _0x3bf2d3={};_0x3bf2d3[_0x113235[_0x9bbe('0x2b')]]={'$like':'%'+_0x4a1d4c[_0x9bbe('0x33')][_0x9bbe('0x3e')]+'%'};return _0x3bf2d3;}})});}_0x23790f=_[_0x9bbe('0x41')]({},_0x23790f,_0x4a1d4c[_0x9bbe('0x42')]);var _0x2e3804={'where':_0x23790f[_0x9bbe('0x3f')]};return db['OpenchannelQueueReport'][_0x9bbe('0x23')](_0x2e3804)[_0x9bbe('0x28')](function(_0x1dada5){_0x1e6bd3[_0x9bbe('0x23')]=_0x1dada5;if(_0x4a1d4c[_0x9bbe('0x33')][_0x9bbe('0x43')]){_0x23790f[_0x9bbe('0x44')]=[{'all':!![]}];}return db[_0x9bbe('0x2e')]['findAll'](_0x23790f);})[_0x9bbe('0x28')](function(_0x2eb11b){_0x1e6bd3[_0x9bbe('0x45')]=_0x2eb11b;return _0x1e6bd3;})[_0x9bbe('0x28')](respondWithFilteredResult(_0x83cb9c,_0x23790f))['catch'](handleError(_0x83cb9c,null));};exports[_0x9bbe('0x46')]=function(_0x11419d,_0x16c11d){var _0x336811={'raw':!![],'where':{'id':_0x11419d[_0x9bbe('0x47')]['id']}},_0x2db174={};_0x2db174['model']=_['keys'](db[_0x9bbe('0x2e')][_0x9bbe('0x2f')]);_0x2db174[_0x9bbe('0x33')]=_['keys'](_0x11419d[_0x9bbe('0x33')]);_0x2db174[_0x9bbe('0x3c')]=_[_0x9bbe('0x35')](_0x2db174[_0x9bbe('0x32')],_0x2db174[_0x9bbe('0x33')]);_0x336811['attributes']=_[_0x9bbe('0x35')](_0x2db174[_0x9bbe('0x32')],qs[_0x9bbe('0x36')](_0x11419d[_0x9bbe('0x33')][_0x9bbe('0x36')]));_0x336811[_0x9bbe('0x34')]=_0x336811[_0x9bbe('0x34')][_0x9bbe('0x37')]?_0x336811[_0x9bbe('0x34')]:_0x2db174[_0x9bbe('0x32')];if(_0x11419d['query']['includeAll']){_0x336811[_0x9bbe('0x44')]=[{'all':!![]}];}_0x336811=_[_0x9bbe('0x41')]({},_0x336811,_0x11419d[_0x9bbe('0x42')]);return db[_0x9bbe('0x2e')][_0x9bbe('0x48')](_0x336811)[_0x9bbe('0x28')](handleEntityNotFound(_0x16c11d,null))[_0x9bbe('0x28')](respondWithResult(_0x16c11d,null))[_0x9bbe('0x49')](handleError(_0x16c11d,null));};exports[_0x9bbe('0x4a')]=function(_0x7a26d6,_0x445c8f){return db['OpenchannelQueueReport'][_0x9bbe('0x4a')](_0x7a26d6['body'],{})['then'](respondWithResult(_0x445c8f,0xc9))[_0x9bbe('0x49')](handleError(_0x445c8f,null));};exports['update']=function(_0x136921,_0x4c0ae1){if(_0x136921[_0x9bbe('0x4b')]['id']){delete _0x136921[_0x9bbe('0x4b')]['id'];}return db[_0x9bbe('0x2e')][_0x9bbe('0x48')]({'where':{'id':_0x136921[_0x9bbe('0x47')]['id']}})[_0x9bbe('0x28')](handleEntityNotFound(_0x4c0ae1,null))[_0x9bbe('0x28')](saveUpdates(_0x136921['body'],null))[_0x9bbe('0x28')](respondWithResult(_0x4c0ae1,null))[_0x9bbe('0x49')](handleError(_0x4c0ae1,null));};exports[_0x9bbe('0x29')]=function(_0x5a3863,_0x1184f7){return db[_0x9bbe('0x2e')][_0x9bbe('0x48')]({'where':{'id':_0x5a3863[_0x9bbe('0x47')]['id']}})[_0x9bbe('0x28')](handleEntityNotFound(_0x1184f7,null))[_0x9bbe('0x28')](removeEntity(_0x1184f7,null))['catch'](handleError(_0x1184f7,null));};exports[_0x9bbe('0x4c')]=function(_0x32188e,_0x15183b){return db[_0x9bbe('0x2e')][_0x9bbe('0x4c')]()[_0x9bbe('0x28')](respondWithResult(_0x15183b,null))['catch'](handleError(_0x15183b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index fb873e8..305380a 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 _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x34d900,_0x48b934){var _0xd2a284=function(_0x9a9ca){while(--_0x9a9ca){_0x34d900['push'](_0x34d900['shift']());}};_0xd2a284(++_0x48b934);}(_0x5fc3,0xa8));var _0x35fc=function(_0x28edda,_0xbd447a){_0x28edda=_0x28edda-0x0;var _0x21f4a4=_0x5fc3[_0x28edda];return _0x21f4a4;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x27908e,_0x5ef4c6){var _0x52d0f6=function(_0x2d3946){while(--_0x2d3946){_0x27908e['push'](_0x27908e['shift']());}};_0x52d0f6(++_0x5ef4c6);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xc4aa[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'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 2493e0a..22a10af 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 _0xd7d1=['update','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','create','body','options','raw','debug','UpdateOpenchannelQueueReport','OpenchannelQueueReport'];(function(_0x52b0cf,_0x5d2621){var _0xe961fb=function(_0x51ceda){while(--_0x51ceda){_0x52b0cf['push'](_0x52b0cf['shift']());}};_0xe961fb(++_0x5d2621);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x9062e4,_0x28f6d1){_0x9062e4=_0x9062e4-0x0;var _0x41a69=_0xd7d1[_0x9062e4];return _0x41a69;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var moment=require(_0x1d7d('0x2'));var BPromise=require(_0x1d7d('0x3'));var rs=require(_0x1d7d('0x4'));var fs=require('fs');var Redis=require(_0x1d7d('0x5'));var db=require(_0x1d7d('0x6'))['db'];var utils=require(_0x1d7d('0x7'));var logger=require(_0x1d7d('0x8'))(_0x1d7d('0x9'));var config=require(_0x1d7d('0xa'));var jayson=require(_0x1d7d('0xb'));var client=jayson[_0x1d7d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x462ef8,_0x1aa456,_0x14dbf6){return new BPromise(function(_0x3675a2,_0xd6189e){return client[_0x1d7d('0xd')](_0x462ef8,_0x14dbf6)[_0x1d7d('0xe')](function(_0xa44223){logger[_0x1d7d('0xf')](_0x1d7d('0x10'),_0x1aa456,_0x1d7d('0x11'));logger['debug'](_0x1d7d('0x12'),_0x1aa456,'request\x20sent',JSON[_0x1d7d('0x13')](_0xa44223));if(_0xa44223[_0x1d7d('0x14')]){if(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x15')]===0x1f4){logger['error'](_0x1d7d('0x10'),_0x1aa456,_0xa44223['error']['message']);return _0xd6189e(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x1aa456,_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);return _0x3675a2(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}else{logger[_0x1d7d('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1aa456,_0x1d7d('0x11'));_0x3675a2(_0xa44223[_0x1d7d('0x17')]['message']);}})[_0x1d7d('0x18')](function(_0x162c3a){logger[_0x1d7d('0x14')](_0x1d7d('0x10'),_0x1aa456,_0x162c3a);_0xd6189e(_0x162c3a);});});}exports[_0x1d7d('0x19')]=function(_0x4db4f2){var _0x664e3f=this;return new Promise(function(_0x191024,_0x5cbb8f){return db['OpenchannelQueueReport'][_0x1d7d('0x1a')](_0x4db4f2[_0x1d7d('0x1b')],{'raw':_0x4db4f2[_0x1d7d('0x1c')]?_0x4db4f2[_0x1d7d('0x1c')][_0x1d7d('0x1d')]===undefined?!![]:![]:!![]})[_0x1d7d('0xe')](function(_0x54d401){logger[_0x1d7d('0xf')](_0x1d7d('0x19'),_0x4db4f2);logger[_0x1d7d('0x1e')]('CreateOpenchannelQueueReport',_0x4db4f2,JSON[_0x1d7d('0x13')](_0x54d401));_0x191024(_0x54d401);})[_0x1d7d('0x18')](function(_0x4a1cdc){logger['error'](_0x1d7d('0x19'),_0x4a1cdc[_0x1d7d('0x16')],_0x4db4f2);_0x5cbb8f(_0x664e3f[_0x1d7d('0x14')](0x1f4,_0x4a1cdc['message']));});});};exports[_0x1d7d('0x1f')]=function(_0x106376){var _0x2d4c0c=this;return new Promise(function(_0x21e59,_0x4fa346){return db[_0x1d7d('0x20')][_0x1d7d('0x21')](_0x106376['body'],{'raw':_0x106376['options']?_0x106376[_0x1d7d('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x106376[_0x1d7d('0x1c')]?_0x106376[_0x1d7d('0x1c')][_0x1d7d('0x22')]||null:null,'attributes':_0x106376[_0x1d7d('0x1c')]?_0x106376[_0x1d7d('0x1c')]['attributes']||null:null,'limit':_0x106376[_0x1d7d('0x1c')]?_0x106376[_0x1d7d('0x1c')][_0x1d7d('0x23')]||null:null})['then'](function(_0x78adbe){logger[_0x1d7d('0xf')](_0x1d7d('0x1f'),_0x106376);logger['debug']('UpdateOpenchannelQueueReport',_0x106376,JSON['stringify'](_0x78adbe));_0x21e59(_0x78adbe);})[_0x1d7d('0x18')](function(_0x329f56){logger['error'](_0x1d7d('0x1f'),_0x329f56[_0x1d7d('0x16')],_0x106376);_0x4fa346(_0x2d4c0c[_0x1d7d('0x14')](0x1f4,_0x329f56[_0x1d7d('0x16')]));});});}; \ No newline at end of file +var _0x5ed9=['create','body','options','raw','then','UpdateOpenchannelQueueReport','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport'];(function(_0x35f8ac,_0x438d59){var _0x23cee4=function(_0x2f04ca){while(--_0x2f04ca){_0x35f8ac['push'](_0x35f8ac['shift']());}};_0x23cee4(++_0x438d59);}(_0x5ed9,0x1e9));var _0x95ed=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5ed9[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x95ed('0x0'));var util=require(_0x95ed('0x1'));var moment=require('moment');var BPromise=require(_0x95ed('0x2'));var rs=require(_0x95ed('0x3'));var fs=require('fs');var Redis=require(_0x95ed('0x4'));var db=require(_0x95ed('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x95ed('0x6'))(_0x95ed('0x7'));var config=require(_0x95ed('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x95ed('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32bf25,_0xaa1eb1,_0x3753b5){return new BPromise(function(_0x1df51f,_0x46ed43){return client[_0x95ed('0xa')](_0x32bf25,_0x3753b5)['then'](function(_0x2b59f5){logger[_0x95ed('0xb')](_0x95ed('0xc'),_0xaa1eb1,'request\x20sent');logger[_0x95ed('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0xaa1eb1,_0x95ed('0xe'),JSON[_0x95ed('0xf')](_0x2b59f5));if(_0x2b59f5[_0x95ed('0x10')]){if(_0x2b59f5[_0x95ed('0x10')][_0x95ed('0x11')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0xaa1eb1,_0x2b59f5[_0x95ed('0x10')][_0x95ed('0x12')]);return _0x46ed43(_0x2b59f5['error']['message']);}logger[_0x95ed('0x10')](_0x95ed('0xc'),_0xaa1eb1,_0x2b59f5[_0x95ed('0x10')][_0x95ed('0x12')]);return _0x1df51f(_0x2b59f5['error'][_0x95ed('0x12')]);}else{logger[_0x95ed('0xb')](_0x95ed('0xc'),_0xaa1eb1,_0x95ed('0xe'));_0x1df51f(_0x2b59f5[_0x95ed('0x13')]['message']);}})[_0x95ed('0x14')](function(_0x54ad78){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0xaa1eb1,_0x54ad78);_0x46ed43(_0x54ad78);});});}exports[_0x95ed('0x15')]=function(_0x58fb9e){var _0x421ab9=this;return new Promise(function(_0x1bc47c,_0x4ad26d){return db[_0x95ed('0x16')][_0x95ed('0x17')](_0x58fb9e[_0x95ed('0x18')],{'raw':_0x58fb9e[_0x95ed('0x19')]?_0x58fb9e[_0x95ed('0x19')][_0x95ed('0x1a')]===undefined?!![]:![]:!![]})[_0x95ed('0x1b')](function(_0x3e05cf){logger[_0x95ed('0xb')](_0x95ed('0x15'),_0x58fb9e);logger['debug'](_0x95ed('0x15'),_0x58fb9e,JSON[_0x95ed('0xf')](_0x3e05cf));_0x1bc47c(_0x3e05cf);})['catch'](function(_0x5d5afe){logger['error'](_0x95ed('0x15'),_0x5d5afe[_0x95ed('0x12')],_0x58fb9e);_0x4ad26d(_0x421ab9[_0x95ed('0x10')](0x1f4,_0x5d5afe[_0x95ed('0x12')]));});});};exports[_0x95ed('0x1c')]=function(_0x19b664){var _0x3ef74c=this;return new Promise(function(_0x416d23,_0x146f74){return db[_0x95ed('0x16')][_0x95ed('0x1d')](_0x19b664[_0x95ed('0x18')],{'raw':_0x19b664[_0x95ed('0x19')]?_0x19b664[_0x95ed('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19b664[_0x95ed('0x19')]?_0x19b664['options']['where']||null:null,'attributes':_0x19b664[_0x95ed('0x19')]?_0x19b664[_0x95ed('0x19')][_0x95ed('0x1e')]||null:null,'limit':_0x19b664[_0x95ed('0x19')]?_0x19b664[_0x95ed('0x19')][_0x95ed('0x1f')]||null:null})[_0x95ed('0x1b')](function(_0x190620){logger[_0x95ed('0xb')](_0x95ed('0x1c'),_0x19b664);logger[_0x95ed('0xd')](_0x95ed('0x1c'),_0x19b664,JSON['stringify'](_0x190620));_0x416d23(_0x190620);})[_0x95ed('0x14')](function(_0xf73b6f){logger['error'](_0x95ed('0x1c'),_0xf73b6f['message'],_0x19b664);_0x146f74(_0x3ef74c['error'](0x1f4,_0xf73b6f['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 4f1f04f..10e27bc 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 _0x55e6=['isAuthenticated','describe','/:id','show','post','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','get'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x55e6,0x107));var _0x655e=function(_0xa080d9,_0x31a5eb){_0xa080d9=_0xa080d9-0x0;var _0x5c871a=_0x55e6[_0xa080d9];return _0x5c871a;};'use strict';var multer=require('multer');var util=require(_0x655e('0x0'));var path=require(_0x655e('0x1'));var timeout=require(_0x655e('0x2'));var express=require(_0x655e('0x3'));var router=express[_0x655e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x655e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x655e('0x6'));var controller=require(_0x655e('0x7'));router[_0x655e('0x8')]('/',auth[_0x655e('0x9')](),controller['index']);router[_0x655e('0x8')]('/describe',auth[_0x655e('0x9')](),controller[_0x655e('0xa')]);router[_0x655e('0x8')](_0x655e('0xb'),auth['isAuthenticated'](),controller[_0x655e('0xc')]);router[_0x655e('0xd')]('/',auth[_0x655e('0x9')](),controller['create']);router['put'](_0x655e('0xb'),auth[_0x655e('0x9')](),controller['update']);router[_0x655e('0xe')](_0x655e('0xb'),auth[_0x655e('0x9')](),controller['destroy']);module[_0x655e('0xf')]=router; \ No newline at end of file +var _0x4ace=['delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0x4ace,0x191));var _0xe4ac=function(_0x155aeb,_0x19265b){_0x155aeb=_0x155aeb-0x0;var _0x1210a6=_0x4ace[_0x155aeb];return _0x1210a6;};'use strict';var multer=require(_0xe4ac('0x0'));var util=require(_0xe4ac('0x1'));var path=require('path');var timeout=require(_0xe4ac('0x2'));var express=require('express');var router=express[_0xe4ac('0x3')]();var fs_extra=require(_0xe4ac('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe4ac('0x5'));var config=require(_0xe4ac('0x6'));var controller=require('./openchannelTransferReport.controller');router[_0xe4ac('0x7')]('/',auth[_0xe4ac('0x8')](),controller[_0xe4ac('0x9')]);router['get'](_0xe4ac('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xe4ac('0x7')](_0xe4ac('0xb'),auth[_0xe4ac('0x8')](),controller[_0xe4ac('0xc')]);router[_0xe4ac('0xd')]('/',auth[_0xe4ac('0x8')](),controller[_0xe4ac('0xe')]);router[_0xe4ac('0xf')](_0xe4ac('0xb'),auth['isAuthenticated'](),controller[_0xe4ac('0x10')]);router[_0xe4ac('0x11')](_0xe4ac('0xb'),auth['isAuthenticated'](),controller[_0xe4ac('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 6bb46b7..6ba409b 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x5cb0a1,_0x3cf0bf){var _0x4b6613=function(_0x54d3b9){while(--_0x54d3b9){_0x5cb0a1['push'](_0x5cb0a1['shift']());}};_0x4b6613(++_0x3cf0bf);}(_0x008c,0x188));var _0xc008=function(_0x50521f,_0x4375b3){_0x50521f=_0x50521f-0x0;var _0x29b4be=_0x008c[_0x50521f];return _0x29b4be;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x369b7f,_0x2b76f2){var _0x5acc9f=function(_0x140cca){while(--_0x140cca){_0x369b7f['push'](_0x369b7f['shift']());}};_0x5acc9f(++_0x2b76f2);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3e0191,_0x1d4b20){_0x3e0191=_0x3e0191-0x0;var _0xf2ae83=_0xf3cd[_0x3e0191];return _0xf2ae83;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 94d2d01..31110dd 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 _0xd3a4=['key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','OpenchannelTransferReport','include','findAll','then','show','params','keys','rawAttributes','includeAll','find','catch','create','body','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','error','stack','name','map','fieldName'];(function(_0xf951be,_0x18dd6c){var _0x3f508=function(_0x55b73e){while(--_0x55b73e){_0xf951be['push'](_0xf951be['shift']());}};_0x3f508(++_0x18dd6c);}(_0xd3a4,0x188));var _0x4d3a=function(_0x5e2e54,_0x42e06b){_0x5e2e54=_0x5e2e54-0x0;var _0x24334f=_0xd3a4[_0x5e2e54];return _0x24334f;};'use strict';var emlformat=require(_0x4d3a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4d3a('0x1'));var rp=require('request-promise');var moment=require(_0x4d3a('0x2'));var BPromise=require(_0x4d3a('0x3'));var Mustache=require(_0x4d3a('0x4'));var util=require(_0x4d3a('0x5'));var path=require(_0x4d3a('0x6'));var sox=require('sox');var csv=require(_0x4d3a('0x7'));var ejs=require(_0x4d3a('0x8'));var fs=require('fs');var fs_extra=require(_0x4d3a('0x9'));var _=require(_0x4d3a('0xa'));var squel=require('squel');var crypto=require(_0x4d3a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4d3a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4d3a('0xd'));var Papa=require(_0x4d3a('0xe'));var Redis=require(_0x4d3a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4d3a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4d3a('0x11'))(_0x4d3a('0x12'));var utils=require(_0x4d3a('0x13'));var config=require(_0x4d3a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4d3a('0x15'))['db'];function respondWithStatusCode(_0x34d4ae,_0xaf0892){_0xaf0892=_0xaf0892||0xcc;return function(_0x10e828){if(_0x10e828){return _0x34d4ae[_0x4d3a('0x16')](_0xaf0892);}return _0x34d4ae[_0x4d3a('0x17')](_0xaf0892)[_0x4d3a('0x18')]();};}function respondWithResult(_0x32d128,_0x37bddd){_0x37bddd=_0x37bddd||0xc8;return function(_0x3963f5){if(_0x3963f5){return _0x32d128[_0x4d3a('0x17')](_0x37bddd)[_0x4d3a('0x19')](_0x3963f5);}};}function respondWithFilteredResult(_0x4fa447,_0x2adf4e){return function(_0x4f7cbd){if(_0x4f7cbd){var _0xe27cd=typeof _0x2adf4e[_0x4d3a('0x1a')]===_0x4d3a('0x1b')&&typeof _0x2adf4e[_0x4d3a('0x1c')]===_0x4d3a('0x1b');var _0x110928=_0x4f7cbd['count'];var _0x49c47c=_0xe27cd?0x0:_0x2adf4e['offset'];var _0x189f42=_0xe27cd?_0x4f7cbd[_0x4d3a('0x1d')]:_0x2adf4e[_0x4d3a('0x1a')]+_0x2adf4e['limit'];var _0x4fc495;if(_0x189f42>=_0x110928){_0x189f42=_0x110928;_0x4fc495=0xc8;}else{_0x4fc495=0xce;}_0x4fa447[_0x4d3a('0x17')](_0x4fc495);return _0x4fa447[_0x4d3a('0x1e')](_0x4d3a('0x1f'),_0x49c47c+'-'+_0x189f42+'/'+_0x110928)['json'](_0x4f7cbd);}return null;};}function patchUpdates(_0x13772e){return function(_0x2b9e7e){try{jsonpatch['apply'](_0x2b9e7e,_0x13772e,!![]);}catch(_0x1e964a){return BPromise['reject'](_0x1e964a);}return _0x2b9e7e[_0x4d3a('0x20')]();};}function saveUpdates(_0x902ae8,_0x2ad1c2){return function(_0x2a0228){if(_0x2a0228){return _0x2a0228[_0x4d3a('0x21')](_0x902ae8)['then'](function(_0x190863){return _0x190863;});}return null;};}function removeEntity(_0x3eb435,_0x34ae69){return function(_0x4ced9a){if(_0x4ced9a){return _0x4ced9a[_0x4d3a('0x22')]()['then'](function(){_0x3eb435[_0x4d3a('0x17')](0xcc)[_0x4d3a('0x18')]();});}};}function handleEntityNotFound(_0x9dc664,_0x2fde74){return function(_0x3bcaa8){if(!_0x3bcaa8){_0x9dc664[_0x4d3a('0x16')](0x194);}return _0x3bcaa8;};}function handleError(_0x51e21f,_0x3a6b0d){_0x3a6b0d=_0x3a6b0d||0x1f4;return function(_0x14ef2b){logger[_0x4d3a('0x23')](_0x14ef2b[_0x4d3a('0x24')]);if(_0x14ef2b[_0x4d3a('0x25')]){delete _0x14ef2b[_0x4d3a('0x25')];}_0x51e21f[_0x4d3a('0x17')](_0x3a6b0d)['send'](_0x14ef2b);};}exports['index']=function(_0x50a10c,_0x29a844){var _0x41a7b3={},_0x303ba9={},_0x57f84b={'count':0x0,'rows':[]};var _0x2a1b0f=_[_0x4d3a('0x26')](db['OpenchannelTransferReport']['rawAttributes'],function(_0x4b22b7){return{'name':_0x4b22b7[_0x4d3a('0x27')],'type':_0x4b22b7['type'][_0x4d3a('0x28')]};});_0x303ba9[_0x4d3a('0x29')]=_[_0x4d3a('0x26')](_0x2a1b0f,_0x4d3a('0x25'));_0x303ba9['query']=_['keys'](_0x50a10c[_0x4d3a('0x2a')]);_0x303ba9[_0x4d3a('0x2b')]=_['intersection'](_0x303ba9['model'],_0x303ba9['query']);_0x41a7b3[_0x4d3a('0x2c')]=_[_0x4d3a('0x2d')](_0x303ba9[_0x4d3a('0x29')],qs['fields'](_0x50a10c[_0x4d3a('0x2a')][_0x4d3a('0x2e')]));_0x41a7b3[_0x4d3a('0x2c')]=_0x41a7b3[_0x4d3a('0x2c')][_0x4d3a('0x2f')]?_0x41a7b3['attributes']:_0x303ba9[_0x4d3a('0x29')];if(!_0x50a10c[_0x4d3a('0x2a')][_0x4d3a('0x30')](_0x4d3a('0x31'))){_0x41a7b3[_0x4d3a('0x1c')]=qs[_0x4d3a('0x1c')](_0x50a10c['query'][_0x4d3a('0x1c')]);_0x41a7b3[_0x4d3a('0x1a')]=qs['offset'](_0x50a10c[_0x4d3a('0x2a')][_0x4d3a('0x1a')]);}_0x41a7b3[_0x4d3a('0x32')]=qs[_0x4d3a('0x33')](_0x50a10c['query'][_0x4d3a('0x33')]);_0x41a7b3['where']=qs[_0x4d3a('0x2b')](_[_0x4d3a('0x34')](_0x50a10c[_0x4d3a('0x2a')],_0x303ba9[_0x4d3a('0x2b')]),_0x2a1b0f);if(_0x50a10c['query'][_0x4d3a('0x35')]){_0x41a7b3[_0x4d3a('0x36')]=_[_0x4d3a('0x37')](_0x41a7b3[_0x4d3a('0x36')],{'$or':_[_0x4d3a('0x26')](_0x2a1b0f,function(_0x5547c4){if(_0x5547c4['type']!==_0x4d3a('0x38')){var _0x302ddf={};_0x302ddf[_0x5547c4[_0x4d3a('0x25')]]={'$like':'%'+_0x50a10c[_0x4d3a('0x2a')]['filter']+'%'};return _0x302ddf;}})});}_0x41a7b3=_[_0x4d3a('0x37')]({},_0x41a7b3,_0x50a10c[_0x4d3a('0x39')]);var _0x3519a5={'where':_0x41a7b3['where']};return db[_0x4d3a('0x3a')][_0x4d3a('0x1d')](_0x3519a5)['then'](function(_0x5a4ca2){_0x57f84b[_0x4d3a('0x1d')]=_0x5a4ca2;if(_0x50a10c[_0x4d3a('0x2a')]['includeAll']){_0x41a7b3[_0x4d3a('0x3b')]=[{'all':!![]}];}return db[_0x4d3a('0x3a')][_0x4d3a('0x3c')](_0x41a7b3);})[_0x4d3a('0x3d')](function(_0x31fdea){_0x57f84b['rows']=_0x31fdea;return _0x57f84b;})[_0x4d3a('0x3d')](respondWithFilteredResult(_0x29a844,_0x41a7b3))['catch'](handleError(_0x29a844,null));};exports[_0x4d3a('0x3e')]=function(_0x5521d8,_0x15a72e){var _0x13e38c={'raw':!![],'where':{'id':_0x5521d8[_0x4d3a('0x3f')]['id']}},_0x1fb7f1={};_0x1fb7f1[_0x4d3a('0x29')]=_[_0x4d3a('0x40')](db['OpenchannelTransferReport'][_0x4d3a('0x41')]);_0x1fb7f1[_0x4d3a('0x2a')]=_['keys'](_0x5521d8[_0x4d3a('0x2a')]);_0x1fb7f1[_0x4d3a('0x2b')]=_['intersection'](_0x1fb7f1['model'],_0x1fb7f1[_0x4d3a('0x2a')]);_0x13e38c['attributes']=_['intersection'](_0x1fb7f1[_0x4d3a('0x29')],qs[_0x4d3a('0x2e')](_0x5521d8['query'][_0x4d3a('0x2e')]));_0x13e38c[_0x4d3a('0x2c')]=_0x13e38c[_0x4d3a('0x2c')][_0x4d3a('0x2f')]?_0x13e38c['attributes']:_0x1fb7f1['model'];if(_0x5521d8[_0x4d3a('0x2a')][_0x4d3a('0x42')]){_0x13e38c[_0x4d3a('0x3b')]=[{'all':!![]}];}_0x13e38c=_['merge']({},_0x13e38c,_0x5521d8[_0x4d3a('0x39')]);return db[_0x4d3a('0x3a')][_0x4d3a('0x43')](_0x13e38c)[_0x4d3a('0x3d')](handleEntityNotFound(_0x15a72e,null))[_0x4d3a('0x3d')](respondWithResult(_0x15a72e,null))[_0x4d3a('0x44')](handleError(_0x15a72e,null));};exports[_0x4d3a('0x45')]=function(_0x459c7b,_0x16279e){return db[_0x4d3a('0x3a')][_0x4d3a('0x45')](_0x459c7b[_0x4d3a('0x46')],{})[_0x4d3a('0x3d')](respondWithResult(_0x16279e,0xc9))[_0x4d3a('0x44')](handleError(_0x16279e,null));};exports['update']=function(_0x3f9506,_0x44fdf3){if(_0x3f9506[_0x4d3a('0x46')]['id']){delete _0x3f9506[_0x4d3a('0x46')]['id'];}return db[_0x4d3a('0x3a')][_0x4d3a('0x43')]({'where':{'id':_0x3f9506['params']['id']}})[_0x4d3a('0x3d')](handleEntityNotFound(_0x44fdf3,null))[_0x4d3a('0x3d')](saveUpdates(_0x3f9506[_0x4d3a('0x46')],null))[_0x4d3a('0x3d')](respondWithResult(_0x44fdf3,null))['catch'](handleError(_0x44fdf3,null));};exports['destroy']=function(_0x3849d9,_0x56bb37){return db[_0x4d3a('0x3a')][_0x4d3a('0x43')]({'where':{'id':_0x3849d9['params']['id']}})[_0x4d3a('0x3d')](handleEntityNotFound(_0x56bb37,null))[_0x4d3a('0x3d')](removeEntity(_0x56bb37,null))[_0x4d3a('0x44')](handleError(_0x56bb37,null));};exports[_0x4d3a('0x47')]=function(_0x167f5a,_0x20e7fb){return db[_0x4d3a('0x3a')][_0x4d3a('0x47')]()[_0x4d3a('0x3d')](respondWithResult(_0x20e7fb,null))['catch'](handleError(_0x20e7fb,null));}; \ No newline at end of file +var _0x3cba=['hasOwnProperty','limit','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','OpenchannelTransferReport','include','findAll','rows','catch','params','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','undefined','count','offset','status','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','attributes','intersection','fields','length'];(function(_0xc87d08,_0x59c9be){var _0x30a714=function(_0x437c0d){while(--_0x437c0d){_0xc87d08['push'](_0xc87d08['shift']());}};_0x30a714(++_0x59c9be);}(_0x3cba,0x18d));var _0xa3cb=function(_0x1098db,_0x39ba6b){_0x1098db=_0x1098db-0x0;var _0x14f090=_0x3cba[_0x1098db];return _0x14f090;};'use strict';var emlformat=require(_0xa3cb('0x0'));var rimraf=require(_0xa3cb('0x1'));var zipdir=require(_0xa3cb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa3cb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa3cb('0x4'));var util=require(_0xa3cb('0x5'));var path=require(_0xa3cb('0x6'));var sox=require(_0xa3cb('0x7'));var csv=require('to-csv');var ejs=require(_0xa3cb('0x8'));var fs=require('fs');var fs_extra=require(_0xa3cb('0x9'));var _=require(_0xa3cb('0xa'));var squel=require(_0xa3cb('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa3cb('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa3cb('0xd'));var Papa=require(_0xa3cb('0xe'));var Redis=require(_0xa3cb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa3cb('0x10'));var as=require(_0xa3cb('0x11'));var hardwareService=require(_0xa3cb('0x12'));var logger=require('../../config/logger')(_0xa3cb('0x13'));var utils=require(_0xa3cb('0x14'));var config=require(_0xa3cb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa3cb('0x16'))['db'];function respondWithStatusCode(_0x44374d,_0x180500){_0x180500=_0x180500||0xcc;return function(_0x21712a){if(_0x21712a){return _0x44374d[_0xa3cb('0x17')](_0x180500);}return _0x44374d['status'](_0x180500)[_0xa3cb('0x18')]();};}function respondWithResult(_0x7789df,_0x2be4a){_0x2be4a=_0x2be4a||0xc8;return function(_0x16c86a){if(_0x16c86a){return _0x7789df['status'](_0x2be4a)[_0xa3cb('0x19')](_0x16c86a);}};}function respondWithFilteredResult(_0x35cff0,_0x5ebdd3){return function(_0x1a15f5){if(_0x1a15f5){var _0x3d9e49=typeof _0x5ebdd3['offset']===_0xa3cb('0x1a')&&typeof _0x5ebdd3['limit']==='undefined';var _0x41538a=_0x1a15f5[_0xa3cb('0x1b')];var _0x4345d2=_0x3d9e49?0x0:_0x5ebdd3[_0xa3cb('0x1c')];var _0x45872e=_0x3d9e49?_0x1a15f5['count']:_0x5ebdd3[_0xa3cb('0x1c')]+_0x5ebdd3['limit'];var _0x546e43;if(_0x45872e>=_0x41538a){_0x45872e=_0x41538a;_0x546e43=0xc8;}else{_0x546e43=0xce;}_0x35cff0[_0xa3cb('0x1d')](_0x546e43);return _0x35cff0[_0xa3cb('0x1e')](_0xa3cb('0x1f'),_0x4345d2+'-'+_0x45872e+'/'+_0x41538a)[_0xa3cb('0x19')](_0x1a15f5);}return null;};}function patchUpdates(_0x56162e){return function(_0x2cae73){try{jsonpatch[_0xa3cb('0x20')](_0x2cae73,_0x56162e,!![]);}catch(_0x1c9950){return BPromise[_0xa3cb('0x21')](_0x1c9950);}return _0x2cae73[_0xa3cb('0x22')]();};}function saveUpdates(_0x1fa0e1,_0x2e47e0){return function(_0x2bc1d9){if(_0x2bc1d9){return _0x2bc1d9[_0xa3cb('0x23')](_0x1fa0e1)['then'](function(_0x1d6ba2){return _0x1d6ba2;});}return null;};}function removeEntity(_0x3d4436,_0x1096fb){return function(_0x276f27){if(_0x276f27){return _0x276f27[_0xa3cb('0x24')]()[_0xa3cb('0x25')](function(){_0x3d4436[_0xa3cb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1efed9,_0x218361){return function(_0x25017c){if(!_0x25017c){_0x1efed9['sendStatus'](0x194);}return _0x25017c;};}function handleError(_0x1a0689,_0x32aecc){_0x32aecc=_0x32aecc||0x1f4;return function(_0x21d8d1){logger[_0xa3cb('0x26')](_0x21d8d1[_0xa3cb('0x27')]);if(_0x21d8d1[_0xa3cb('0x28')]){delete _0x21d8d1['name'];}_0x1a0689[_0xa3cb('0x1d')](_0x32aecc)[_0xa3cb('0x29')](_0x21d8d1);};}exports[_0xa3cb('0x2a')]=function(_0xf3e613,_0x323539){var _0x53aa0c={},_0x194f99={},_0x2cecab={'count':0x0,'rows':[]};var _0x435591=_[_0xa3cb('0x2b')](db['OpenchannelTransferReport'][_0xa3cb('0x2c')],function(_0x127034){return{'name':_0x127034['fieldName'],'type':_0x127034['type'][_0xa3cb('0x2d')]};});_0x194f99[_0xa3cb('0x2e')]=_[_0xa3cb('0x2b')](_0x435591,_0xa3cb('0x28'));_0x194f99[_0xa3cb('0x2f')]=_[_0xa3cb('0x30')](_0xf3e613[_0xa3cb('0x2f')]);_0x194f99['filters']=_['intersection'](_0x194f99[_0xa3cb('0x2e')],_0x194f99[_0xa3cb('0x2f')]);_0x53aa0c[_0xa3cb('0x31')]=_[_0xa3cb('0x32')](_0x194f99[_0xa3cb('0x2e')],qs[_0xa3cb('0x33')](_0xf3e613[_0xa3cb('0x2f')]['fields']));_0x53aa0c[_0xa3cb('0x31')]=_0x53aa0c[_0xa3cb('0x31')][_0xa3cb('0x34')]?_0x53aa0c[_0xa3cb('0x31')]:_0x194f99[_0xa3cb('0x2e')];if(!_0xf3e613['query'][_0xa3cb('0x35')]('nolimit')){_0x53aa0c[_0xa3cb('0x36')]=qs[_0xa3cb('0x36')](_0xf3e613[_0xa3cb('0x2f')][_0xa3cb('0x36')]);_0x53aa0c['offset']=qs['offset'](_0xf3e613[_0xa3cb('0x2f')][_0xa3cb('0x1c')]);}_0x53aa0c['order']=qs[_0xa3cb('0x37')](_0xf3e613[_0xa3cb('0x2f')][_0xa3cb('0x37')]);_0x53aa0c[_0xa3cb('0x38')]=qs[_0xa3cb('0x39')](_[_0xa3cb('0x3a')](_0xf3e613[_0xa3cb('0x2f')],_0x194f99[_0xa3cb('0x39')]),_0x435591);if(_0xf3e613[_0xa3cb('0x2f')][_0xa3cb('0x3b')]){_0x53aa0c[_0xa3cb('0x38')]=_['merge'](_0x53aa0c['where'],{'$or':_[_0xa3cb('0x2b')](_0x435591,function(_0x44bb8b){if(_0x44bb8b[_0xa3cb('0x3c')]!==_0xa3cb('0x3d')){var _0x334fe2={};_0x334fe2[_0x44bb8b[_0xa3cb('0x28')]]={'$like':'%'+_0xf3e613[_0xa3cb('0x2f')]['filter']+'%'};return _0x334fe2;}})});}_0x53aa0c=_[_0xa3cb('0x3e')]({},_0x53aa0c,_0xf3e613[_0xa3cb('0x3f')]);var _0x3581a5={'where':_0x53aa0c['where']};return db[_0xa3cb('0x40')][_0xa3cb('0x1b')](_0x3581a5)[_0xa3cb('0x25')](function(_0x4eff2a){_0x2cecab[_0xa3cb('0x1b')]=_0x4eff2a;if(_0xf3e613[_0xa3cb('0x2f')]['includeAll']){_0x53aa0c[_0xa3cb('0x41')]=[{'all':!![]}];}return db[_0xa3cb('0x40')][_0xa3cb('0x42')](_0x53aa0c);})['then'](function(_0x56d501){_0x2cecab[_0xa3cb('0x43')]=_0x56d501;return _0x2cecab;})[_0xa3cb('0x25')](respondWithFilteredResult(_0x323539,_0x53aa0c))[_0xa3cb('0x44')](handleError(_0x323539,null));};exports['show']=function(_0x22818b,_0x1675b6){var _0x4d2217={'raw':!![],'where':{'id':_0x22818b[_0xa3cb('0x45')]['id']}},_0x193d5b={};_0x193d5b[_0xa3cb('0x2e')]=_[_0xa3cb('0x30')](db[_0xa3cb('0x40')][_0xa3cb('0x2c')]);_0x193d5b[_0xa3cb('0x2f')]=_['keys'](_0x22818b[_0xa3cb('0x2f')]);_0x193d5b[_0xa3cb('0x39')]=_[_0xa3cb('0x32')](_0x193d5b['model'],_0x193d5b[_0xa3cb('0x2f')]);_0x4d2217[_0xa3cb('0x31')]=_[_0xa3cb('0x32')](_0x193d5b[_0xa3cb('0x2e')],qs[_0xa3cb('0x33')](_0x22818b[_0xa3cb('0x2f')][_0xa3cb('0x33')]));_0x4d2217['attributes']=_0x4d2217[_0xa3cb('0x31')][_0xa3cb('0x34')]?_0x4d2217[_0xa3cb('0x31')]:_0x193d5b[_0xa3cb('0x2e')];if(_0x22818b[_0xa3cb('0x2f')][_0xa3cb('0x46')]){_0x4d2217[_0xa3cb('0x41')]=[{'all':!![]}];}_0x4d2217=_['merge']({},_0x4d2217,_0x22818b[_0xa3cb('0x3f')]);return db[_0xa3cb('0x40')]['find'](_0x4d2217)[_0xa3cb('0x25')](handleEntityNotFound(_0x1675b6,null))[_0xa3cb('0x25')](respondWithResult(_0x1675b6,null))[_0xa3cb('0x44')](handleError(_0x1675b6,null));};exports[_0xa3cb('0x47')]=function(_0x7d8559,_0x511285){return db['OpenchannelTransferReport'][_0xa3cb('0x47')](_0x7d8559[_0xa3cb('0x48')],{})[_0xa3cb('0x25')](respondWithResult(_0x511285,0xc9))[_0xa3cb('0x44')](handleError(_0x511285,null));};exports[_0xa3cb('0x23')]=function(_0x304c3e,_0x1fd473){if(_0x304c3e['body']['id']){delete _0x304c3e[_0xa3cb('0x48')]['id'];}return db[_0xa3cb('0x40')][_0xa3cb('0x49')]({'where':{'id':_0x304c3e[_0xa3cb('0x45')]['id']}})['then'](handleEntityNotFound(_0x1fd473,null))['then'](saveUpdates(_0x304c3e[_0xa3cb('0x48')],null))[_0xa3cb('0x25')](respondWithResult(_0x1fd473,null))[_0xa3cb('0x44')](handleError(_0x1fd473,null));};exports[_0xa3cb('0x24')]=function(_0x35d621,_0x3e41c8){return db[_0xa3cb('0x40')][_0xa3cb('0x49')]({'where':{'id':_0x35d621[_0xa3cb('0x45')]['id']}})['then'](handleEntityNotFound(_0x3e41c8,null))['then'](removeEntity(_0x3e41c8,null))[_0xa3cb('0x44')](handleError(_0x3e41c8,null));};exports['describe']=function(_0x2b7990,_0x234e4a){return db['OpenchannelTransferReport'][_0xa3cb('0x4a')]()[_0xa3cb('0x25')](respondWithResult(_0x234e4a,null))['catch'](handleError(_0x234e4a,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 6c2799d..243c5ae 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 _0xcd49=['define','OpenchannelTransferReport','uniqueid','lodash','util','../../config/logger','api','request-promise','path','./openchannelTransferReport.attributes','exports'];(function(_0x36e19f,_0x3c7511){var _0x2a1f77=function(_0x32c016){while(--_0x32c016){_0x36e19f['push'](_0x36e19f['shift']());}};_0x2a1f77(++_0x3c7511);}(_0xcd49,0x116));var _0x9cd4=function(_0x3987a1,_0x447793){_0x3987a1=_0x3987a1-0x0;var _0xe2596e=_0xcd49[_0x3987a1];return _0xe2596e;};'use strict';var _=require(_0x9cd4('0x0'));var util=require(_0x9cd4('0x1'));var logger=require(_0x9cd4('0x2'))(_0x9cd4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9cd4('0x4'));var fs=require('fs');var path=require(_0x9cd4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9cd4('0x6'));module[_0x9cd4('0x7')]=function(_0x5c7df2,_0x41ae56){return _0x5c7df2[_0x9cd4('0x8')](_0x9cd4('0x9'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x9cd4('0xa'),'fields':[_0x9cd4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3b42=['uniqueid','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer'];(function(_0x323fca,_0x369c53){var _0x2f4122=function(_0x8d8818){while(--_0x8d8818){_0x323fca['push'](_0x323fca['shift']());}};_0x2f4122(++_0x369c53);}(_0x3b42,0x1ed));var _0x23b4=function(_0x2ecb6,_0x2f726b){_0x2ecb6=_0x2ecb6-0x0;var _0x1e373a=_0x3b42[_0x2ecb6];return _0x1e373a;};'use strict';var _=require('lodash');var util=require(_0x23b4('0x0'));var logger=require(_0x23b4('0x1'))(_0x23b4('0x2'));var moment=require(_0x23b4('0x3'));var BPromise=require(_0x23b4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x23b4('0x5'));var rimraf=require('rimraf');var config=require(_0x23b4('0x6'));var attributes=require(_0x23b4('0x7'));module['exports']=function(_0x384e44,_0xf196af){return _0x384e44[_0x23b4('0x8')](_0x23b4('0x9'),attributes,{'tableName':_0x23b4('0xa'),'paranoid':![],'indexes':[{'name':_0x23b4('0xb'),'fields':[_0x23b4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 69e2f0a..688d0a8 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 _0xf69d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelTransferReport,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x1c443c,_0x478c3c){var _0x117781=function(_0x407ae1){while(--_0x407ae1){_0x1c443c['push'](_0x1c443c['shift']());}};_0x117781(++_0x478c3c);}(_0xf69d,0xd3));var _0xdf69=function(_0x34a90f,_0x253137){_0x34a90f=_0x34a90f-0x0;var _0x4c0381=_0xf69d[_0x34a90f];return _0x4c0381;};'use strict';var _=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var moment=require(_0xdf69('0x2'));var BPromise=require(_0xdf69('0x3'));var rs=require(_0xdf69('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf69('0x5'))['db'];var utils=require(_0xdf69('0x6'));var logger=require(_0xdf69('0x7'))(_0xdf69('0x8'));var config=require(_0xdf69('0x9'));var jayson=require(_0xdf69('0xa'));var client=jayson[_0xdf69('0xb')][_0xdf69('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d2501,_0x12c186,_0x18a08e){return new BPromise(function(_0xc1b77e,_0x38909e){return client[_0xdf69('0xd')](_0x1d2501,_0x18a08e)[_0xdf69('0xe')](function(_0x211ea9){logger[_0xdf69('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x12c186,_0xdf69('0x10'));logger[_0xdf69('0x11')](_0xdf69('0x12'),_0x12c186,_0xdf69('0x10'),JSON[_0xdf69('0x13')](_0x211ea9));if(_0x211ea9[_0xdf69('0x14')]){if(_0x211ea9['error']['code']===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x12c186,_0x211ea9[_0xdf69('0x14')][_0xdf69('0x15')]);return _0x38909e(_0x211ea9[_0xdf69('0x14')][_0xdf69('0x15')]);}logger[_0xdf69('0x14')](_0xdf69('0x16'),_0x12c186,_0x211ea9['error'][_0xdf69('0x15')]);return _0xc1b77e(_0x211ea9[_0xdf69('0x14')][_0xdf69('0x15')]);}else{logger[_0xdf69('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x12c186,_0xdf69('0x10'));_0xc1b77e(_0x211ea9['result'][_0xdf69('0x15')]);}})[_0xdf69('0x17')](function(_0x5263a4){logger[_0xdf69('0x14')](_0xdf69('0x16'),_0x12c186,_0x5263a4);_0x38909e(_0x5263a4);});});} \ No newline at end of file +var _0x9335=['error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x534956,_0x331880){var _0x52bcc6=function(_0x44c438){while(--_0x44c438){_0x534956['push'](_0x534956['shift']());}};_0x52bcc6(++_0x331880);}(_0x9335,0xab));var _0x5933=function(_0x18821c,_0x1889fc){_0x18821c=_0x18821c-0x0;var _0x61d7f8=_0x9335[_0x18821c];return _0x61d7f8;};'use strict';var _=require(_0x5933('0x0'));var util=require(_0x5933('0x1'));var moment=require('moment');var BPromise=require(_0x5933('0x2'));var rs=require(_0x5933('0x3'));var fs=require('fs');var Redis=require(_0x5933('0x4'));var db=require(_0x5933('0x5'))['db'];var utils=require(_0x5933('0x6'));var logger=require(_0x5933('0x7'))(_0x5933('0x8'));var config=require('../../config/environment');var jayson=require(_0x5933('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x21f4c1,_0x3f15fc,_0x21ab46){return new BPromise(function(_0x59c5cb,_0x2ad740){return client[_0x5933('0xa')](_0x21f4c1,_0x21ab46)[_0x5933('0xb')](function(_0xbcd6bb){logger[_0x5933('0xc')](_0x5933('0xd'),_0x3f15fc,_0x5933('0xe'));logger[_0x5933('0xf')](_0x5933('0x10'),_0x3f15fc,_0x5933('0xe'),JSON[_0x5933('0x11')](_0xbcd6bb));if(_0xbcd6bb[_0x5933('0x12')]){if(_0xbcd6bb[_0x5933('0x12')]['code']===0x1f4){logger[_0x5933('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3f15fc,_0xbcd6bb[_0x5933('0x12')][_0x5933('0x13')]);return _0x2ad740(_0xbcd6bb[_0x5933('0x12')]['message']);}logger[_0x5933('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3f15fc,_0xbcd6bb[_0x5933('0x12')]['message']);return _0x59c5cb(_0xbcd6bb[_0x5933('0x12')]['message']);}else{logger[_0x5933('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3f15fc,_0x5933('0xe'));_0x59c5cb(_0xbcd6bb[_0x5933('0x14')][_0x5933('0x13')]);}})['catch'](function(_0x48dc5b){logger[_0x5933('0x12')](_0x5933('0xd'),_0x3f15fc,_0x48dc5b);_0x2ad740(_0x48dc5b);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 1022677..e903e3f 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 _0x5e02=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','post','create','put','/:id','update'];(function(_0xbf5e16,_0x146ce3){var _0x5975a5=function(_0x2387a7){while(--_0x2387a7){_0xbf5e16['push'](_0xbf5e16['shift']());}};_0x5975a5(++_0x146ce3);}(_0x5e02,0x1f1));var _0x25e0=function(_0xc36492,_0x4af888){_0xc36492=_0xc36492-0x0;var _0x1547d1=_0x5e02[_0xc36492];return _0x1547d1;};'use strict';var multer=require(_0x25e0('0x0'));var util=require('util');var path=require(_0x25e0('0x1'));var timeout=require(_0x25e0('0x2'));var express=require(_0x25e0('0x3'));var router=express[_0x25e0('0x4')]();var fs_extra=require(_0x25e0('0x5'));var auth=require(_0x25e0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x25e0('0x7'));var controller=require('./pause.controller');router[_0x25e0('0x8')]('/',auth[_0x25e0('0x9')](),controller[_0x25e0('0xa')]);router['get']('/:id',auth[_0x25e0('0x9')](),controller['show']);router[_0x25e0('0xb')]('/',auth[_0x25e0('0x9')](),controller[_0x25e0('0xc')]);router[_0x25e0('0xd')](_0x25e0('0xe'),auth['isAuthenticated'](),controller[_0x25e0('0xf')]);router[_0x25e0('0x10')]('/:id',auth[_0x25e0('0x9')](),controller[_0x25e0('0x11')]);module[_0x25e0('0x12')]=router; \ No newline at end of file +var _0x6024=['delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','create','put','update'];(function(_0x5595a6,_0x5d5a00){var _0x152b55=function(_0x89d2a6){while(--_0x89d2a6){_0x5595a6['push'](_0x5595a6['shift']());}};_0x152b55(++_0x5d5a00);}(_0x6024,0xc1));var _0x4602=function(_0x10d87b,_0x2eb7fd){_0x10d87b=_0x10d87b-0x0;var _0x3b904b=_0x6024[_0x10d87b];return _0x3b904b;};'use strict';var multer=require(_0x4602('0x0'));var util=require(_0x4602('0x1'));var path=require('path');var timeout=require(_0x4602('0x2'));var express=require('express');var router=express[_0x4602('0x3')]();var fs_extra=require(_0x4602('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4602('0x5'));var config=require(_0x4602('0x6'));var controller=require(_0x4602('0x7'));router[_0x4602('0x8')]('/',auth[_0x4602('0x9')](),controller[_0x4602('0xa')]);router[_0x4602('0x8')](_0x4602('0xb'),auth[_0x4602('0x9')](),controller[_0x4602('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4602('0xd')]);router[_0x4602('0xe')](_0x4602('0xb'),auth[_0x4602('0x9')](),controller[_0x4602('0xf')]);router[_0x4602('0x10')](_0x4602('0xb'),auth['isAuthenticated'](),controller[_0x4602('0x11')]);module[_0x4602('0x12')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index fb3aa1d..942ea1c 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 _0xe4d4=['STRING','name','sequelize','exports'];(function(_0x2d8f0f,_0x51780e){var _0x2c7465=function(_0x50f40c){while(--_0x50f40c){_0x2d8f0f['push'](_0x2d8f0f['shift']());}};_0x2c7465(++_0x51780e);}(_0xe4d4,0x1e6));var _0x4e4d=function(_0x3ebc6b,_0x582bd8){_0x3ebc6b=_0x3ebc6b-0x0;var _0x4837de=_0xe4d4[_0x3ebc6b];return _0x4837de;};'use strict';var Sequelize=require(_0x4e4d('0x0'));module[_0x4e4d('0x1')]={'name':{'type':Sequelize[_0x4e4d('0x2')],'unique':_0x4e4d('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x4e4d('0x2')]}}; \ No newline at end of file +var _0x859e=['exports','STRING'];(function(_0x2e4769,_0x3c94ad){var _0x6ff89f=function(_0x29b3b2){while(--_0x29b3b2){_0x2e4769['push'](_0x2e4769['shift']());}};_0x6ff89f(++_0x3c94ad);}(_0x859e,0xfa));var _0xe859=function(_0x33e1e5,_0x1008a0){_0x33e1e5=_0x33e1e5-0x0;var _0x163f32=_0x859e[_0x33e1e5];return _0x163f32;};'use strict';var Sequelize=require('sequelize');module[_0xe859('0x0')]={'name':{'type':Sequelize[_0xe859('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xe859('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 287659e..f58cdb7 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 _0x1713=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','get','Pauses','UserProfileResource','status','end','sendStatus','error','name','send','index','map','Pause','rawAttributes','fieldName','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','destroy','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x4a71b6,_0x23120f){var _0x290de9=function(_0x53eabc){while(--_0x53eabc){_0x4a71b6['push'](_0x4a71b6['shift']());}};_0x290de9(++_0x23120f);}(_0x1713,0x145));var _0x3171=function(_0x43c8cd,_0x1f1756){_0x43c8cd=_0x43c8cd-0x0;var _0x596c3c=_0x1713[_0x43c8cd];return _0x596c3c;};'use strict';var emlformat=require(_0x3171('0x0'));var rimraf=require(_0x3171('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3171('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3171('0x3'));var Mustache=require(_0x3171('0x4'));var util=require(_0x3171('0x5'));var path=require(_0x3171('0x6'));var sox=require(_0x3171('0x7'));var csv=require('to-csv');var ejs=require(_0x3171('0x8'));var fs=require('fs');var fs_extra=require(_0x3171('0x9'));var _=require(_0x3171('0xa'));var squel=require(_0x3171('0xb'));var crypto=require(_0x3171('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3171('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3171('0xe'));var Papa=require(_0x3171('0xf'));var Redis=require(_0x3171('0x10'));var authService=require(_0x3171('0x11'));var qs=require(_0x3171('0x12'));var as=require(_0x3171('0x13'));var hardwareService=require(_0x3171('0x14'));var logger=require(_0x3171('0x15'))(_0x3171('0x16'));var utils=require(_0x3171('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3171('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46ce88,_0x15130e){_0x15130e=_0x15130e||0xcc;return function(_0x4efc4d){if(_0x4efc4d){return _0x46ce88['sendStatus'](_0x15130e);}return _0x46ce88['status'](_0x15130e)['end']();};}function respondWithResult(_0x53ee20,_0x13c9b1){_0x13c9b1=_0x13c9b1||0xc8;return function(_0x4f8a96){if(_0x4f8a96){return _0x53ee20['status'](_0x13c9b1)[_0x3171('0x19')](_0x4f8a96);}};}function respondWithFilteredResult(_0x51a98e,_0x5f09e2){return function(_0x38bc51){if(_0x38bc51){var _0xc31cfc=typeof _0x5f09e2[_0x3171('0x1a')]==='undefined'&&typeof _0x5f09e2[_0x3171('0x1b')]===_0x3171('0x1c');var _0x552f78=_0x38bc51[_0x3171('0x1d')];var _0x5eb380=_0xc31cfc?0x0:_0x5f09e2[_0x3171('0x1a')];var _0x47fddd=_0xc31cfc?_0x38bc51[_0x3171('0x1d')]:_0x5f09e2[_0x3171('0x1a')]+_0x5f09e2[_0x3171('0x1b')];var _0x267944;if(_0x47fddd>=_0x552f78){_0x47fddd=_0x552f78;_0x267944=0xc8;}else{_0x267944=0xce;}_0x51a98e['status'](_0x267944);return _0x51a98e[_0x3171('0x1e')](_0x3171('0x1f'),_0x5eb380+'-'+_0x47fddd+'/'+_0x552f78)[_0x3171('0x19')](_0x38bc51);}return null;};}function patchUpdates(_0x5a2ae0){return function(_0x2497aa){try{jsonpatch[_0x3171('0x20')](_0x2497aa,_0x5a2ae0,!![]);}catch(_0x592404){return BPromise[_0x3171('0x21')](_0x592404);}return _0x2497aa['save']();};}function saveUpdates(_0x18c6cb,_0x40fe53){return function(_0x81a593){if(_0x81a593){return _0x81a593[_0x3171('0x22')](_0x18c6cb)[_0x3171('0x23')](function(_0x13645a){return _0x13645a;});}return null;};}function removeEntity(_0x36746e,_0x5ba61a){return function(_0x3a5a44){if(_0x3a5a44){return _0x3a5a44['destroy']()[_0x3171('0x23')](function(){var _0x1ada1f=_0x3a5a44[_0x3171('0x24')]({'plain':!![]});var _0x25853a=_0x3171('0x25');return db[_0x3171('0x26')]['destroy']({'where':{'type':_0x25853a,'resourceId':_0x1ada1f['id']}})['then'](function(){return _0x3a5a44;});})[_0x3171('0x23')](function(){_0x36746e[_0x3171('0x27')](0xcc)[_0x3171('0x28')]();});}};}function handleEntityNotFound(_0xf18cdf,_0x52e19a){return function(_0x11f9cd){if(!_0x11f9cd){_0xf18cdf[_0x3171('0x29')](0x194);}return _0x11f9cd;};}function handleError(_0x15b9af,_0x1e5e5f){_0x1e5e5f=_0x1e5e5f||0x1f4;return function(_0x3a5c06){logger[_0x3171('0x2a')](_0x3a5c06['stack']);if(_0x3a5c06[_0x3171('0x2b')]){delete _0x3a5c06[_0x3171('0x2b')];}_0x15b9af[_0x3171('0x27')](_0x1e5e5f)[_0x3171('0x2c')](_0x3a5c06);};}exports[_0x3171('0x2d')]=function(_0x54b55d,_0x3238a7){var _0x4e9659={},_0x299080={},_0x4053bb={'count':0x0,'rows':[]};var _0x13b8a5=_[_0x3171('0x2e')](db[_0x3171('0x2f')][_0x3171('0x30')],function(_0x66fa3d){return{'name':_0x66fa3d[_0x3171('0x31')],'type':_0x66fa3d['type'][_0x3171('0x32')]};});_0x299080['model']=_[_0x3171('0x2e')](_0x13b8a5,_0x3171('0x2b'));_0x299080['query']=_[_0x3171('0x33')](_0x54b55d[_0x3171('0x34')]);_0x299080['filters']=_[_0x3171('0x35')](_0x299080[_0x3171('0x36')],_0x299080[_0x3171('0x34')]);_0x4e9659[_0x3171('0x37')]=_[_0x3171('0x35')](_0x299080['model'],qs['fields'](_0x54b55d['query'][_0x3171('0x38')]));_0x4e9659['attributes']=_0x4e9659['attributes'][_0x3171('0x39')]?_0x4e9659[_0x3171('0x37')]:_0x299080[_0x3171('0x36')];if(!_0x54b55d[_0x3171('0x34')][_0x3171('0x3a')](_0x3171('0x3b'))){_0x4e9659[_0x3171('0x1b')]=qs[_0x3171('0x1b')](_0x54b55d[_0x3171('0x34')]['limit']);_0x4e9659['offset']=qs[_0x3171('0x1a')](_0x54b55d[_0x3171('0x34')][_0x3171('0x1a')]);}_0x4e9659['order']=qs[_0x3171('0x3c')](_0x54b55d[_0x3171('0x34')]['sort']);_0x4e9659[_0x3171('0x3d')]=qs[_0x3171('0x3e')](_['pick'](_0x54b55d['query'],_0x299080['filters']),_0x13b8a5);if(_0x54b55d[_0x3171('0x34')][_0x3171('0x3f')]){_0x4e9659[_0x3171('0x3d')]=_['merge'](_0x4e9659[_0x3171('0x3d')],{'$or':_['map'](_0x13b8a5,function(_0x5122c8){if(_0x5122c8[_0x3171('0x40')]!==_0x3171('0x41')){var _0x9f1c61={};_0x9f1c61[_0x5122c8[_0x3171('0x2b')]]={'$like':'%'+_0x54b55d[_0x3171('0x34')][_0x3171('0x3f')]+'%'};return _0x9f1c61;}})});}_0x4e9659=_[_0x3171('0x42')]({},_0x4e9659,_0x54b55d[_0x3171('0x43')]);var _0x51a4e7={'where':_0x4e9659[_0x3171('0x3d')]};return db[_0x3171('0x2f')][_0x3171('0x1d')](_0x51a4e7)[_0x3171('0x23')](function(_0x6ecc9f){_0x4053bb[_0x3171('0x1d')]=_0x6ecc9f;if(_0x54b55d[_0x3171('0x34')][_0x3171('0x44')]){_0x4e9659[_0x3171('0x45')]=[{'all':!![]}];}return db[_0x3171('0x2f')][_0x3171('0x46')](_0x4e9659);})[_0x3171('0x23')](function(_0x3a08be){_0x4053bb[_0x3171('0x47')]=_0x3a08be;return _0x4053bb;})[_0x3171('0x23')](respondWithFilteredResult(_0x3238a7,_0x4e9659))['catch'](handleError(_0x3238a7,null));};exports[_0x3171('0x48')]=function(_0xf5da42,_0x469de9){var _0x12003b={'raw':!![],'where':{'id':_0xf5da42[_0x3171('0x49')]['id']}},_0x2c4b5a={};_0x2c4b5a[_0x3171('0x36')]=_[_0x3171('0x33')](db['Pause'][_0x3171('0x30')]);_0x2c4b5a[_0x3171('0x34')]=_[_0x3171('0x33')](_0xf5da42['query']);_0x2c4b5a[_0x3171('0x3e')]=_[_0x3171('0x35')](_0x2c4b5a[_0x3171('0x36')],_0x2c4b5a[_0x3171('0x34')]);_0x12003b[_0x3171('0x37')]=_[_0x3171('0x35')](_0x2c4b5a[_0x3171('0x36')],qs[_0x3171('0x38')](_0xf5da42[_0x3171('0x34')][_0x3171('0x38')]));_0x12003b[_0x3171('0x37')]=_0x12003b[_0x3171('0x37')][_0x3171('0x39')]?_0x12003b['attributes']:_0x2c4b5a[_0x3171('0x36')];if(_0xf5da42['query'][_0x3171('0x44')]){_0x12003b['include']=[{'all':!![]}];}_0x12003b=_[_0x3171('0x42')]({},_0x12003b,_0xf5da42[_0x3171('0x43')]);return db[_0x3171('0x2f')][_0x3171('0x4a')](_0x12003b)[_0x3171('0x23')](handleEntityNotFound(_0x469de9,null))[_0x3171('0x23')](respondWithResult(_0x469de9,null))['catch'](handleError(_0x469de9,null));};exports[_0x3171('0x4b')]=function(_0xc491ed,_0x4d96c5){return db[_0x3171('0x2f')][_0x3171('0x4b')](_0xc491ed[_0x3171('0x4c')],{})[_0x3171('0x23')](function(_0xa1a7f0){var _0x23921d=_0xc491ed[_0x3171('0x4d')]['get']({'plain':!![]});if(!_0x23921d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23921d[_0x3171('0x4e')]===_0x3171('0x4d')){var _0x1197eb=_0xa1a7f0['get']({'plain':!![]});var _0x234503=_0x3171('0x25');return db[_0x3171('0x4f')][_0x3171('0x4a')]({'where':{'name':_0x234503,'userProfileId':_0x23921d[_0x3171('0x50')]},'raw':!![]})[_0x3171('0x23')](function(_0x1116b4){if(_0x1116b4&&_0x1116b4[_0x3171('0x51')]===0x0){return db[_0x3171('0x26')][_0x3171('0x4b')]({'name':_0x1197eb['name'],'resourceId':_0x1197eb['id'],'type':_0x1116b4[_0x3171('0x2b')],'sectionId':_0x1116b4['id']},{})[_0x3171('0x23')](function(){return _0xa1a7f0;});}else{return _0xa1a7f0;}})['catch'](function(_0x1e9a50){logger['error'](_0x3171('0x52'),_0x1e9a50);throw _0x1e9a50;});}return _0xa1a7f0;})['then'](respondWithResult(_0x4d96c5,0xc9))[_0x3171('0x53')](handleError(_0x4d96c5,null));};exports[_0x3171('0x22')]=function(_0x5a2e5d,_0x191eb8){if(_0x5a2e5d[_0x3171('0x4c')]['id']){delete _0x5a2e5d[_0x3171('0x4c')]['id'];}return db[_0x3171('0x2f')]['find']({'where':{'id':_0x5a2e5d['params']['id']}})[_0x3171('0x23')](handleEntityNotFound(_0x191eb8,null))[_0x3171('0x23')](saveUpdates(_0x5a2e5d[_0x3171('0x4c')],null))[_0x3171('0x23')](respondWithResult(_0x191eb8,null))['catch'](handleError(_0x191eb8,null));};exports[_0x3171('0x54')]=function(_0x186efa,_0x564274){return db[_0x3171('0x2f')]['find']({'where':{'id':_0x186efa[_0x3171('0x49')]['id']}})['then'](handleEntityNotFound(_0x564274,null))[_0x3171('0x23')](removeEntity(_0x564274,null))[_0x3171('0x53')](handleError(_0x564274,null));}; \ No newline at end of file +var _0xfeef=['hasOwnProperty','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','sendStatus','stack','name','map','Pause','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length'];(function(_0x900d3c,_0x5b6aa3){var _0x502079=function(_0x387ea1){while(--_0x387ea1){_0x900d3c['push'](_0x900d3c['shift']());}};_0x502079(++_0x5b6aa3);}(_0xfeef,0x1c2));var _0xffee=function(_0x5e52b2,_0x3023e0){_0x5e52b2=_0x5e52b2-0x0;var _0x1b0610=_0xfeef[_0x5e52b2];return _0x1b0610;};'use strict';var emlformat=require(_0xffee('0x0'));var rimraf=require(_0xffee('0x1'));var zipdir=require(_0xffee('0x2'));var jsonpatch=require(_0xffee('0x3'));var rp=require(_0xffee('0x4'));var moment=require('moment');var BPromise=require(_0xffee('0x5'));var Mustache=require(_0xffee('0x6'));var util=require(_0xffee('0x7'));var path=require(_0xffee('0x8'));var sox=require(_0xffee('0x9'));var csv=require(_0xffee('0xa'));var ejs=require(_0xffee('0xb'));var fs=require('fs');var fs_extra=require(_0xffee('0xc'));var _=require(_0xffee('0xd'));var squel=require(_0xffee('0xe'));var crypto=require(_0xffee('0xf'));var jsforce=require(_0xffee('0x10'));var deskjs=require(_0xffee('0x11'));var toCsv=require(_0xffee('0xa'));var querystring=require(_0xffee('0x12'));var Papa=require(_0xffee('0x13'));var Redis=require(_0xffee('0x14'));var authService=require(_0xffee('0x15'));var qs=require(_0xffee('0x16'));var as=require(_0xffee('0x17'));var hardwareService=require(_0xffee('0x18'));var logger=require(_0xffee('0x19'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xffee('0x1a'));var db=require(_0xffee('0x1b'))['db'];function respondWithStatusCode(_0x5a1c76,_0xaed622){_0xaed622=_0xaed622||0xcc;return function(_0x537787){if(_0x537787){return _0x5a1c76['sendStatus'](_0xaed622);}return _0x5a1c76[_0xffee('0x1c')](_0xaed622)['end']();};}function respondWithResult(_0x33424d,_0x3bc5b8){_0x3bc5b8=_0x3bc5b8||0xc8;return function(_0x496564){if(_0x496564){return _0x33424d[_0xffee('0x1c')](_0x3bc5b8)['json'](_0x496564);}};}function respondWithFilteredResult(_0x303866,_0x12fc8a){return function(_0x50d463){if(_0x50d463){var _0x5903bb=typeof _0x12fc8a[_0xffee('0x1d')]===_0xffee('0x1e')&&typeof _0x12fc8a[_0xffee('0x1f')]===_0xffee('0x1e');var _0x39185a=_0x50d463[_0xffee('0x20')];var _0x3f4cbd=_0x5903bb?0x0:_0x12fc8a[_0xffee('0x1d')];var _0x25654a=_0x5903bb?_0x50d463[_0xffee('0x20')]:_0x12fc8a['offset']+_0x12fc8a[_0xffee('0x1f')];var _0x5c7841;if(_0x25654a>=_0x39185a){_0x25654a=_0x39185a;_0x5c7841=0xc8;}else{_0x5c7841=0xce;}_0x303866[_0xffee('0x1c')](_0x5c7841);return _0x303866[_0xffee('0x21')](_0xffee('0x22'),_0x3f4cbd+'-'+_0x25654a+'/'+_0x39185a)[_0xffee('0x23')](_0x50d463);}return null;};}function patchUpdates(_0x44a24e){return function(_0xc493e5){try{jsonpatch[_0xffee('0x24')](_0xc493e5,_0x44a24e,!![]);}catch(_0x208267){return BPromise[_0xffee('0x25')](_0x208267);}return _0xc493e5[_0xffee('0x26')]();};}function saveUpdates(_0x2a28ad,_0x3063ae){return function(_0x41714f){if(_0x41714f){return _0x41714f[_0xffee('0x27')](_0x2a28ad)[_0xffee('0x28')](function(_0x2bc159){return _0x2bc159;});}return null;};}function removeEntity(_0x595390,_0x842e12){return function(_0x572df4){if(_0x572df4){return _0x572df4[_0xffee('0x29')]()[_0xffee('0x28')](function(){var _0x2c3d1e=_0x572df4[_0xffee('0x2a')]({'plain':!![]});var _0x5bb906=_0xffee('0x2b');return db[_0xffee('0x2c')][_0xffee('0x29')]({'where':{'type':_0x5bb906,'resourceId':_0x2c3d1e['id']}})[_0xffee('0x28')](function(){return _0x572df4;});})[_0xffee('0x28')](function(){_0x595390[_0xffee('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a30ea,_0x20875e){return function(_0x4dac1d){if(!_0x4dac1d){_0x3a30ea[_0xffee('0x2d')](0x194);}return _0x4dac1d;};}function handleError(_0x466e26,_0x2350ba){_0x2350ba=_0x2350ba||0x1f4;return function(_0xbbc43e){logger['error'](_0xbbc43e[_0xffee('0x2e')]);if(_0xbbc43e[_0xffee('0x2f')]){delete _0xbbc43e[_0xffee('0x2f')];}_0x466e26[_0xffee('0x1c')](_0x2350ba)['send'](_0xbbc43e);};}exports['index']=function(_0x186b82,_0x34b61e){var _0x2cfe32={},_0x4a1060={},_0xd9b12c={'count':0x0,'rows':[]};var _0x378595=_[_0xffee('0x30')](db[_0xffee('0x31')][_0xffee('0x32')],function(_0xabfe64){return{'name':_0xabfe64[_0xffee('0x33')],'type':_0xabfe64['type'][_0xffee('0x34')]};});_0x4a1060['model']=_[_0xffee('0x30')](_0x378595,'name');_0x4a1060[_0xffee('0x35')]=_[_0xffee('0x36')](_0x186b82[_0xffee('0x35')]);_0x4a1060['filters']=_[_0xffee('0x37')](_0x4a1060[_0xffee('0x38')],_0x4a1060['query']);_0x2cfe32[_0xffee('0x39')]=_[_0xffee('0x37')](_0x4a1060[_0xffee('0x38')],qs[_0xffee('0x3a')](_0x186b82[_0xffee('0x35')][_0xffee('0x3a')]));_0x2cfe32[_0xffee('0x39')]=_0x2cfe32['attributes'][_0xffee('0x3b')]?_0x2cfe32[_0xffee('0x39')]:_0x4a1060[_0xffee('0x38')];if(!_0x186b82[_0xffee('0x35')][_0xffee('0x3c')]('nolimit')){_0x2cfe32[_0xffee('0x1f')]=qs[_0xffee('0x1f')](_0x186b82[_0xffee('0x35')][_0xffee('0x1f')]);_0x2cfe32[_0xffee('0x1d')]=qs['offset'](_0x186b82[_0xffee('0x35')][_0xffee('0x1d')]);}_0x2cfe32['order']=qs[_0xffee('0x3d')](_0x186b82['query'][_0xffee('0x3d')]);_0x2cfe32['where']=qs[_0xffee('0x3e')](_[_0xffee('0x3f')](_0x186b82[_0xffee('0x35')],_0x4a1060[_0xffee('0x3e')]),_0x378595);if(_0x186b82['query'][_0xffee('0x40')]){_0x2cfe32[_0xffee('0x41')]=_[_0xffee('0x42')](_0x2cfe32[_0xffee('0x41')],{'$or':_[_0xffee('0x30')](_0x378595,function(_0x3c4598){if(_0x3c4598[_0xffee('0x43')]!==_0xffee('0x44')){var _0x14cd5a={};_0x14cd5a[_0x3c4598[_0xffee('0x2f')]]={'$like':'%'+_0x186b82['query'][_0xffee('0x40')]+'%'};return _0x14cd5a;}})});}_0x2cfe32=_[_0xffee('0x42')]({},_0x2cfe32,_0x186b82[_0xffee('0x45')]);var _0x3adbc1={'where':_0x2cfe32['where']};return db[_0xffee('0x31')][_0xffee('0x20')](_0x3adbc1)[_0xffee('0x28')](function(_0x19f7a0){_0xd9b12c[_0xffee('0x20')]=_0x19f7a0;if(_0x186b82['query'][_0xffee('0x46')]){_0x2cfe32[_0xffee('0x47')]=[{'all':!![]}];}return db[_0xffee('0x31')][_0xffee('0x48')](_0x2cfe32);})['then'](function(_0x324c9a){_0xd9b12c[_0xffee('0x49')]=_0x324c9a;return _0xd9b12c;})[_0xffee('0x28')](respondWithFilteredResult(_0x34b61e,_0x2cfe32))[_0xffee('0x4a')](handleError(_0x34b61e,null));};exports[_0xffee('0x4b')]=function(_0x75d7ec,_0x174b23){var _0x5027d9={'raw':!![],'where':{'id':_0x75d7ec[_0xffee('0x4c')]['id']}},_0x2f20d8={};_0x2f20d8[_0xffee('0x38')]=_[_0xffee('0x36')](db[_0xffee('0x31')]['rawAttributes']);_0x2f20d8['query']=_[_0xffee('0x36')](_0x75d7ec[_0xffee('0x35')]);_0x2f20d8[_0xffee('0x3e')]=_['intersection'](_0x2f20d8['model'],_0x2f20d8[_0xffee('0x35')]);_0x5027d9[_0xffee('0x39')]=_[_0xffee('0x37')](_0x2f20d8[_0xffee('0x38')],qs[_0xffee('0x3a')](_0x75d7ec['query'][_0xffee('0x3a')]));_0x5027d9[_0xffee('0x39')]=_0x5027d9[_0xffee('0x39')]['length']?_0x5027d9[_0xffee('0x39')]:_0x2f20d8[_0xffee('0x38')];if(_0x75d7ec['query'][_0xffee('0x46')]){_0x5027d9[_0xffee('0x47')]=[{'all':!![]}];}_0x5027d9=_[_0xffee('0x42')]({},_0x5027d9,_0x75d7ec[_0xffee('0x45')]);return db[_0xffee('0x31')]['find'](_0x5027d9)[_0xffee('0x28')](handleEntityNotFound(_0x174b23,null))['then'](respondWithResult(_0x174b23,null))[_0xffee('0x4a')](handleError(_0x174b23,null));};exports['create']=function(_0x25cca1,_0x88179b){return db['Pause']['create'](_0x25cca1[_0xffee('0x4d')],{})[_0xffee('0x28')](function(_0x9d206f){var _0x4d3b79=_0x25cca1[_0xffee('0x4e')][_0xffee('0x2a')]({'plain':!![]});if(!_0x4d3b79)throw new Error(_0xffee('0x4f'));if(_0x4d3b79['role']===_0xffee('0x4e')){var _0x40c189=_0x9d206f[_0xffee('0x2a')]({'plain':!![]});var _0x510114='Pauses';return db[_0xffee('0x50')][_0xffee('0x51')]({'where':{'name':_0x510114,'userProfileId':_0x4d3b79['userProfileId']},'raw':!![]})[_0xffee('0x28')](function(_0xe06d4){if(_0xe06d4&&_0xe06d4[_0xffee('0x52')]===0x0){return db[_0xffee('0x2c')][_0xffee('0x53')]({'name':_0x40c189[_0xffee('0x2f')],'resourceId':_0x40c189['id'],'type':_0xe06d4[_0xffee('0x2f')],'sectionId':_0xe06d4['id']},{})[_0xffee('0x28')](function(){return _0x9d206f;});}else{return _0x9d206f;}})['catch'](function(_0x3c2065){logger['error'](_0xffee('0x54'),_0x3c2065);throw _0x3c2065;});}return _0x9d206f;})[_0xffee('0x28')](respondWithResult(_0x88179b,0xc9))[_0xffee('0x4a')](handleError(_0x88179b,null));};exports['update']=function(_0x5e8138,_0x210076){if(_0x5e8138['body']['id']){delete _0x5e8138['body']['id'];}return db[_0xffee('0x31')][_0xffee('0x51')]({'where':{'id':_0x5e8138[_0xffee('0x4c')]['id']}})[_0xffee('0x28')](handleEntityNotFound(_0x210076,null))[_0xffee('0x28')](saveUpdates(_0x5e8138[_0xffee('0x4d')],null))[_0xffee('0x28')](respondWithResult(_0x210076,null))[_0xffee('0x4a')](handleError(_0x210076,null));};exports['destroy']=function(_0x5b2548,_0x53a0b9){return db[_0xffee('0x31')]['find']({'where':{'id':_0x5b2548[_0xffee('0x4c')]['id']}})['then'](handleEntityNotFound(_0x53a0b9,null))[_0xffee('0x28')](removeEntity(_0x53a0b9,null))[_0xffee('0x4a')](handleError(_0x53a0b9,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 8899df3..9c9054c 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 _0x1cb9=['./pause.attributes','exports','define','Pause','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x5575cc,_0x3cca39){var _0x1e5306=function(_0x11b590){while(--_0x11b590){_0x5575cc['push'](_0x5575cc['shift']());}};_0x1e5306(++_0x3cca39);}(_0x1cb9,0x14e));var _0x91cb=function(_0x562187,_0x3f9ed9){_0x562187=_0x562187-0x0;var _0x5fd700=_0x1cb9[_0x562187];return _0x5fd700;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./pause.attributes','exports','define','tools_pauses'];(function(_0x45b1a3,_0x32555b){var _0x2e66c3=function(_0x54b4e1){while(--_0x54b4e1){_0x45b1a3['push'](_0x45b1a3['shift']());}};_0x2e66c3(++_0x32555b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x36bf88,_0x15c459){_0x36bf88=_0x36bf88-0x0;var _0x332914=_0x5fc3[_0x36bf88];return _0x332914;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('Pause',attributes,{'tableName':_0x35fc('0xb'),'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 a40afbe..afb3486 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(_0x49b23e,_0x11380b){var _0x2f7a50=function(_0x4ff65f){while(--_0x4ff65f){_0x49b23e['push'](_0x49b23e['shift']());}};_0x2f7a50(++_0x11380b);}(_0xb10b,0x12a));var _0xbb10=function(_0x15a8e1,_0x21e63d){_0x15a8e1=_0x15a8e1-0x0;var _0x185130=_0xb10b[_0x15a8e1];return _0x185130;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x23b0a1,_0x25dd28){var _0x500734=function(_0x42ffe8){while(--_0x42ffe8){_0x23b0a1['push'](_0x23b0a1['shift']());}};_0x500734(++_0x25dd28);}(_0xb10b,0x12a));var _0xbb10=function(_0x1915e5,_0xe53420){_0x1915e5=_0x1915e5-0x0;var _0x148dd0=_0xb10b[_0x1915e5];return _0x148dd0;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index df92e09..8efd633 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 _0x3667=['download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download'];(function(_0x506a61,_0x5155ee){var _0x2c5b08=function(_0x110856){while(--_0x110856){_0x506a61['push'](_0x506a61['shift']());}};_0x2c5b08(++_0x5155ee);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7366('0x0'));var util=require(_0x7366('0x1'));var path=require(_0x7366('0x2'));var timeout=require(_0x7366('0x3'));var express=require(_0x7366('0x4'));var router=express['Router']();var fs_extra=require(_0x7366('0x5'));var auth=require(_0x7366('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7366('0x7'));var controller=require(_0x7366('0x8'));router[_0x7366('0x9')]('/',auth[_0x7366('0xa')](),controller[_0x7366('0xb')]);router['get'](_0x7366('0xc'),controller[_0x7366('0xd')]);router[_0x7366('0x9')](_0x7366('0xe'),auth[_0x7366('0xa')](),controller[_0x7366('0xf')]);router[_0x7366('0x9')](_0x7366('0x10'),auth[_0x7366('0xa')](),controller[_0x7366('0x11')]);var upload=multer({'storage':multer[_0x7366('0x12')]({'destination':function(_0x2d7e38,_0x57ea7f,_0x425ee4){_0x425ee4(null,path[_0x7366('0x13')](config[_0x7366('0x14')],_0x7366('0x15')));},'filename':function(_0x25a565,_0xd5bac8,_0x3e3a73){_0xd5bac8[_0x7366('0x16')]=_0xd5bac8[_0x7366('0x16')][_0x7366('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3e3a73(null,util[_0x7366('0x18')](_0x7366('0x19'),path[_0x7366('0x1a')](_0xd5bac8[_0x7366('0x16')],path[_0x7366('0x1b')](_0xd5bac8['originalname'])),Date[_0x7366('0x1c')](),path[_0x7366('0x1b')](_0xd5bac8[_0x7366('0x16')])));}})});router[_0x7366('0x1d')]('/',upload[_0x7366('0x1e')](_0x7366('0x1f')),controller[_0x7366('0x20')]);router[_0x7366('0x1d')](_0x7366('0xc'),controller[_0x7366('0x21')]);router[_0x7366('0x22')]('/:id',auth[_0x7366('0xa')](),controller['update']);router[_0x7366('0x23')](_0x7366('0xe'),auth[_0x7366('0xa')](),controller['delete']);module[_0x7366('0x24')]=router; \ No newline at end of file +var _0xc978=['isAuthenticated','index','/webhook','webhookGet','/:id','show','download','diskStorage','join','root','server/files/plugins','originalname','replace','%s-%s%s','now','extname','post','single','file','upload','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get'];(function(_0x42312f,_0x1c1cdc){var _0x2eca40=function(_0x42cbba){while(--_0x42cbba){_0x42312f['push'](_0x42312f['shift']());}};_0x2eca40(++_0x1c1cdc);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var path=require(_0x8c97('0x2'));var timeout=require(_0x8c97('0x3'));var express=require(_0x8c97('0x4'));var router=express[_0x8c97('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8c97('0x6'));var interaction=require(_0x8c97('0x7'));var config=require(_0x8c97('0x8'));var controller=require(_0x8c97('0x9'));router[_0x8c97('0xa')]('/',auth[_0x8c97('0xb')](),controller[_0x8c97('0xc')]);router['get'](_0x8c97('0xd'),controller[_0x8c97('0xe')]);router[_0x8c97('0xa')](_0x8c97('0xf'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x10')]);router[_0x8c97('0xa')]('/:id/download',auth[_0x8c97('0xb')](),controller[_0x8c97('0x11')]);var upload=multer({'storage':multer[_0x8c97('0x12')]({'destination':function(_0x3a34b2,_0x400eb6,_0x949a83){_0x949a83(null,path[_0x8c97('0x13')](config[_0x8c97('0x14')],_0x8c97('0x15')));},'filename':function(_0x5cf392,_0x44611a,_0x346274){_0x44611a['originalname']=_0x44611a[_0x8c97('0x16')][_0x8c97('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x346274(null,util['format'](_0x8c97('0x18'),path['basename'](_0x44611a['originalname'],path['extname'](_0x44611a[_0x8c97('0x16')])),Date[_0x8c97('0x19')](),path[_0x8c97('0x1a')](_0x44611a[_0x8c97('0x16')])));}})});router[_0x8c97('0x1b')]('/',upload[_0x8c97('0x1c')](_0x8c97('0x1d')),controller[_0x8c97('0x1e')]);router[_0x8c97('0x1b')]('/webhook',controller[_0x8c97('0x1f')]);router[_0x8c97('0x20')](_0x8c97('0xf'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x21')]);router[_0x8c97('0x22')](_0x8c97('0xf'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x22')]);module[_0x8c97('0x23')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index f2af393..9bc5f5b 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 _0x7b13=['always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x3fe30d,_0x469e48){var _0x37b3e1=function(_0x5f1a27){while(--_0x5f1a27){_0x3fe30d['push'](_0x3fe30d['shift']());}};_0x37b3e1(++_0x469e48);}(_0x7b13,0xc0));var _0x37b1=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x7b13[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module[_0x37b1('0x0')]={'name':{'type':Sequelize[_0x37b1('0x1')]},'type':{'type':Sequelize[_0x37b1('0x2')]('html',_0x37b1('0x3'))},'description':{'type':Sequelize[_0x37b1('0x4')]},'version':{'type':Sequelize[_0x37b1('0x4')]},'path':{'type':Sequelize[_0x37b1('0x1')],'comment':_0x37b1('0x5')},'active':{'type':Sequelize[_0x37b1('0x6')],'defaultValue':0x0,'comment':_0x37b1('0x7')},'sidebar':{'type':Sequelize['ENUM']('adminOnly','agentOnly',_0x37b1('0x8'),'never'),'defaultValue':_0x37b1('0x8'),'comment':_0x37b1('0x9')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x37b1('0x1')]},'scriptName':{'type':Sequelize[_0x37b1('0x1')]},'scriptPath':{'type':Sequelize[_0x37b1('0x1')]}}; \ No newline at end of file +var _0x1893=['STRING','exports','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1893,0xf3));var _0x3189=function(_0x407ebf,_0x2b47f5){_0x407ebf=_0x407ebf-0x0;var _0x29d7db=_0x1893[_0x407ebf];return _0x29d7db;};'use strict';var Sequelize=require('sequelize');module[_0x3189('0x0')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3189('0x1')](_0x3189('0x2'),'script')},'description':{'type':Sequelize[_0x3189('0x3')]},'version':{'type':Sequelize[_0x3189('0x3')]},'path':{'type':Sequelize['STRING'],'comment':_0x3189('0x4')},'active':{'type':Sequelize[_0x3189('0x5')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x3189('0x1')](_0x3189('0x6'),_0x3189('0x7'),'always',_0x3189('0x8')),'defaultValue':'always','comment':_0x3189('0x9')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x3189('0xa')]},'agentUrl':{'type':Sequelize[_0x3189('0xa')]},'scriptName':{'type':Sequelize[_0x3189('0xa')]},'scriptPath':{'type':Sequelize[_0x3189('0xa')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 1e807bb..f6aeb8e 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 _0x5465=['webhookPost','zip-dir','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','rimraf','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./plugin.socket','register','sendStatus','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','get','Plugins','error','stack','status','index','map','Plugin','rawAttributes','fieldName','type','key','model','name','query','keys','attributes','intersection','fields','length','offset','order','sort','filters','pick','filter','merge','where','includeAll','rows','catch','show','params','include','options','find','download','join','server/files/plugins','format','basename','createWriteStream','zip','warning','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','filename','extname','file','root','Plugin\x20upload\x20destination:\x20%s','0777','Invalid\x20plugin\x20structure','lstatSync','isDirectory','readdirSync','some','Plugin\x20manifest\x20missing','manifest.json','parse','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','html','admin','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','test','Warning:\x20agent\x20view\x20not\x20specified','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','send','Zip\x20archive\x20removed','delete','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode'];(function(_0x50ced1,_0xc04d1e){var _0x8f0b7=function(_0x1d4c77){while(--_0x1d4c77){_0x50ced1['push'](_0x50ced1['shift']());}};_0x8f0b7(++_0xc04d1e);}(_0x5465,0xa4));var _0x5546=function(_0x42ccd0,_0x10f08e){_0x42ccd0=_0x42ccd0-0x0;var _0x31afbb=_0x5465[_0x42ccd0];return _0x31afbb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5546('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5546('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x5546('0x2'));var util=require('util');var path=require(_0x5546('0x3'));var sox=require('sox');var csv=require(_0x5546('0x4'));var ejs=require(_0x5546('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5546('0x6'));var squel=require(_0x5546('0x7'));var crypto=require(_0x5546('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x5546('0x9'));var toCsv=require(_0x5546('0x4'));var querystring=require(_0x5546('0xa'));var Papa=require(_0x5546('0xb'));var extract=require('extract-zip');var rimraf=require(_0x5546('0xc'));var archiver=require('archiver');var Redis=require(_0x5546('0xd'));var authService=require(_0x5546('0xe'));var qs=require(_0x5546('0xf'));var as=require(_0x5546('0x10'));var hardwareService=require(_0x5546('0x11'));var logger=require('../../config/logger')(_0x5546('0x12'));var utils=require(_0x5546('0x13'));var config=require(_0x5546('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5546('0x15'))['db'];config['redis']=_[_0x5546('0x16')](config['redis'],{'host':_0x5546('0x17'),'port':0x18eb});var socket=require(_0x5546('0x18'))(new Redis(config[_0x5546('0x19')]));require(_0x5546('0x1a'))[_0x5546('0x1b')](socket);function respondWithStatusCode(_0x4e18da,_0xde61ba){_0xde61ba=_0xde61ba||0xcc;return function(_0xe7b084){if(_0xe7b084){return _0x4e18da[_0x5546('0x1c')](_0xde61ba);}return _0x4e18da['status'](_0xde61ba)['end']();};}function respondWithResult(_0x591736,_0x512842){_0x512842=_0x512842||0xc8;return function(_0x4502b8){if(_0x4502b8){return _0x591736['status'](_0x512842)['json'](_0x4502b8);}};}function respondWithFilteredResult(_0x2b84d3,_0x525774){return function(_0x381db4){if(_0x381db4){var _0x1c2e48=typeof _0x525774['offset']==='undefined'&&typeof _0x525774[_0x5546('0x1d')]===_0x5546('0x1e');var _0x1d1950=_0x381db4[_0x5546('0x1f')];var _0x5cb4ba=_0x1c2e48?0x0:_0x525774['offset'];var _0x43eb22=_0x1c2e48?_0x381db4[_0x5546('0x1f')]:_0x525774['offset']+_0x525774[_0x5546('0x1d')];var _0x7adc57;if(_0x43eb22>=_0x1d1950){_0x43eb22=_0x1d1950;_0x7adc57=0xc8;}else{_0x7adc57=0xce;}_0x2b84d3['status'](_0x7adc57);return _0x2b84d3[_0x5546('0x20')](_0x5546('0x21'),_0x5cb4ba+'-'+_0x43eb22+'/'+_0x1d1950)[_0x5546('0x22')](_0x381db4);}return null;};}function patchUpdates(_0x27ca25){return function(_0x1d7e5b){try{jsonpatch[_0x5546('0x23')](_0x1d7e5b,_0x27ca25,!![]);}catch(_0xa931d7){return BPromise[_0x5546('0x24')](_0xa931d7);}return _0x1d7e5b['save']();};}function saveUpdates(_0x4eaef6,_0x233085){return function(_0x2aa5c3){if(_0x2aa5c3){return _0x2aa5c3[_0x5546('0x25')](_0x4eaef6)[_0x5546('0x26')](function(_0x91a361){return _0x91a361;});}return null;};}function removeEntity(_0x50ec08,_0x5b2be2){return function(_0x51a059){if(_0x51a059){return _0x51a059[_0x5546('0x27')]()[_0x5546('0x26')](function(){var _0x1cc6ab=_0x51a059[_0x5546('0x28')]({'plain':!![]});var _0x5cb8b6=_0x5546('0x29');return db['UserProfileResource'][_0x5546('0x27')]({'where':{'type':_0x5cb8b6,'resourceId':_0x1cc6ab['id']}})['then'](function(){return _0x51a059;});})['then'](function(){_0x50ec08['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d66e2,_0x2a7c18){return function(_0x86650b){if(!_0x86650b){_0x2d66e2[_0x5546('0x1c')](0x194);}return _0x86650b;};}function handleError(_0x5a9f24,_0x2b6136){_0x2b6136=_0x2b6136||0x1f4;return function(_0x20d5a2){logger[_0x5546('0x2a')](_0x20d5a2[_0x5546('0x2b')]);if(_0x20d5a2['name']){delete _0x20d5a2['name'];}_0x5a9f24[_0x5546('0x2c')](_0x2b6136)['send'](_0x20d5a2);};}exports[_0x5546('0x2d')]=function(_0x31e25b,_0x279af7){var _0x3f37b4={},_0x327d8f={},_0x5f1b15={'count':0x0,'rows':[]};var _0x6daee1=_[_0x5546('0x2e')](db[_0x5546('0x2f')][_0x5546('0x30')],function(_0x28363f){return{'name':_0x28363f[_0x5546('0x31')],'type':_0x28363f[_0x5546('0x32')][_0x5546('0x33')]};});_0x327d8f[_0x5546('0x34')]=_['map'](_0x6daee1,_0x5546('0x35'));_0x327d8f[_0x5546('0x36')]=_[_0x5546('0x37')](_0x31e25b[_0x5546('0x36')]);_0x327d8f['filters']=_['intersection'](_0x327d8f[_0x5546('0x34')],_0x327d8f[_0x5546('0x36')]);_0x3f37b4[_0x5546('0x38')]=_[_0x5546('0x39')](_0x327d8f[_0x5546('0x34')],qs[_0x5546('0x3a')](_0x31e25b[_0x5546('0x36')][_0x5546('0x3a')]));_0x3f37b4[_0x5546('0x38')]=_0x3f37b4[_0x5546('0x38')][_0x5546('0x3b')]?_0x3f37b4[_0x5546('0x38')]:_0x327d8f[_0x5546('0x34')];if(!_0x31e25b[_0x5546('0x36')]['hasOwnProperty']('nolimit')){_0x3f37b4[_0x5546('0x1d')]=qs[_0x5546('0x1d')](_0x31e25b[_0x5546('0x36')][_0x5546('0x1d')]);_0x3f37b4[_0x5546('0x3c')]=qs[_0x5546('0x3c')](_0x31e25b[_0x5546('0x36')]['offset']);}_0x3f37b4[_0x5546('0x3d')]=qs['sort'](_0x31e25b['query'][_0x5546('0x3e')]);_0x3f37b4['where']=qs[_0x5546('0x3f')](_[_0x5546('0x40')](_0x31e25b[_0x5546('0x36')],_0x327d8f['filters']),_0x6daee1);if(_0x31e25b['query'][_0x5546('0x41')]){_0x3f37b4['where']=_[_0x5546('0x42')](_0x3f37b4['where'],{'$or':_['map'](_0x6daee1,function(_0x356ac0){if(_0x356ac0[_0x5546('0x32')]!=='VIRTUAL'){var _0x4e71ad={};_0x4e71ad[_0x356ac0[_0x5546('0x35')]]={'$like':'%'+_0x31e25b[_0x5546('0x36')]['filter']+'%'};return _0x4e71ad;}})});}_0x3f37b4=_['merge']({},_0x3f37b4,_0x31e25b['options']);var _0x163116={'where':_0x3f37b4[_0x5546('0x43')]};return db[_0x5546('0x2f')][_0x5546('0x1f')](_0x163116)[_0x5546('0x26')](function(_0x5f2561){_0x5f1b15['count']=_0x5f2561;if(_0x31e25b[_0x5546('0x36')][_0x5546('0x44')]){_0x3f37b4['include']=[{'all':!![]}];}return db[_0x5546('0x2f')]['findAll'](_0x3f37b4);})[_0x5546('0x26')](function(_0xf134f){_0x5f1b15[_0x5546('0x45')]=_0xf134f;return _0x5f1b15;})[_0x5546('0x26')](respondWithFilteredResult(_0x279af7,_0x3f37b4))[_0x5546('0x46')](handleError(_0x279af7,null));};exports[_0x5546('0x47')]=function(_0x38ba6,_0x2b8ef9){var _0x3c50b1={'raw':!![],'where':{'id':_0x38ba6[_0x5546('0x48')]['id']}},_0x13bd11={};_0x13bd11[_0x5546('0x34')]=_[_0x5546('0x37')](db['Plugin'][_0x5546('0x30')]);_0x13bd11[_0x5546('0x36')]=_[_0x5546('0x37')](_0x38ba6['query']);_0x13bd11[_0x5546('0x3f')]=_[_0x5546('0x39')](_0x13bd11[_0x5546('0x34')],_0x13bd11[_0x5546('0x36')]);_0x3c50b1[_0x5546('0x38')]=_[_0x5546('0x39')](_0x13bd11[_0x5546('0x34')],qs['fields'](_0x38ba6[_0x5546('0x36')][_0x5546('0x3a')]));_0x3c50b1['attributes']=_0x3c50b1[_0x5546('0x38')][_0x5546('0x3b')]?_0x3c50b1[_0x5546('0x38')]:_0x13bd11[_0x5546('0x34')];if(_0x38ba6[_0x5546('0x36')]['includeAll']){_0x3c50b1[_0x5546('0x49')]=[{'all':!![]}];}_0x3c50b1=_[_0x5546('0x42')]({},_0x3c50b1,_0x38ba6[_0x5546('0x4a')]);return db[_0x5546('0x2f')][_0x5546('0x4b')](_0x3c50b1)[_0x5546('0x26')](handleEntityNotFound(_0x2b8ef9,null))['then'](respondWithResult(_0x2b8ef9,null))['catch'](handleError(_0x2b8ef9,null));};exports[_0x5546('0x4c')]=function(_0x226031,_0x3d2b04,_0x564468){return db['Plugin']['find']({'where':{'id':_0x226031[_0x5546('0x48')]['id']},'attributes':[_0x5546('0x35'),'path'],'raw':!![]})[_0x5546('0x26')](handleEntityNotFound(_0x3d2b04,null))[_0x5546('0x26')](function(_0x102fcc){if(_0x102fcc){var _0xe5f59e=path[_0x5546('0x4d')](config['root'],_0x5546('0x4e'),util[_0x5546('0x4f')]('%s.zip',path[_0x5546('0x50')](_0x102fcc['path'])));var _0x56ac4a=fs[_0x5546('0x51')](_0xe5f59e);var _0x1d41b2=archiver(_0x5546('0x52'),{'zlib':{'level':0x9}});_0x1d41b2['on'](_0x5546('0x53'),function(_0x4f4954){if(_0x4f4954['code']==='ENOENT'){logger[_0x5546('0x2a')](_0x4f4954);}else{throw new db[(_0x5546('0x54'))][(_0x5546('0x55'))](_0x5546('0x56'));}});_0x1d41b2['on'](_0x5546('0x2a'),function(_0x51ad8c){throw new db['Sequelize'][(_0x5546('0x55'))](_0x5546('0x56'));});_0x1d41b2[_0x5546('0x57')](_0x56ac4a);_0x1d41b2['glob'](_0x5546('0x58'),{'cwd':path[_0x5546('0x4d')](config['root'],_0x5546('0x4e'),path[_0x5546('0x59')](_0x102fcc['path'])),'ignore':[path[_0x5546('0x4d')](path['basename'](_0x102fcc[_0x5546('0x3')]),_0x5546('0x5a')),path[_0x5546('0x4d')](path['basename'](_0x102fcc[_0x5546('0x3')]),_0x5546('0x5b'))],'nodir':!![]})[_0x5546('0x5c')]();_0x56ac4a['on'](_0x5546('0x5d'),function(){if(!fs[_0x5546('0x5e')](_0xe5f59e)){throw new db[(_0x5546('0x54'))][(_0x5546('0x55'))](_0x5546('0x5f'));}return _0x3d2b04[_0x5546('0x4c')](_0xe5f59e,util[_0x5546('0x4f')]('%s.zip',path[_0x5546('0x50')](_0x102fcc[_0x5546('0x3')])),function(_0x492029){if(_0x492029){throw new db['Sequelize'][(_0x5546('0x55'))](_0x5546('0x60'));}fs[_0x5546('0x61')](_0xe5f59e);logger[_0x5546('0x62')](_0x5546('0x63'));logger[_0x5546('0x62')]('Temporary\x20file\x20removed');});});}return null;})[_0x5546('0x46')](handleError(_0x3d2b04,null));};exports['upload']=function(_0xff8f00,_0x4cce85,_0x151c53){var _0x5a2d1f=path[_0x5546('0x50')](_0xff8f00['file'][_0x5546('0x64')],path[_0x5546('0x65')](_0xff8f00[_0x5546('0x66')][_0x5546('0x64')]));var _0x11addf=path['join'](config[_0x5546('0x67')],'server/files/plugins',_0xff8f00['file']['filename']);var _0x36afe6=path['join'](config[_0x5546('0x67')],_0x5546('0x4e'),_0x5a2d1f);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x11addf);logger[_0x5546('0x62')](_0x5546('0x68'),_0x36afe6);try{fs['chmodSync'](_0x11addf,parseInt(_0x5546('0x69'),0x8));extract(_0x11addf,{'dir':_0x36afe6},function(_0x36ecde){if(_0x36ecde){logger[_0x5546('0x2a')](_0x36ecde);handleError(_0x36ecde,!![]);};var _0x18caf7=fs['readdirSync'](_0x36afe6);if(_0x18caf7['length']>0x1){removeReferences(_0x11addf,_0x36afe6);logger[_0x5546('0x2a')](_0x5546('0x6a'));return _0x151c53(new Error(_0x5546('0x6a')));}var _0x11c608=fs[_0x5546('0x6b')](path[_0x5546('0x4d')](_0x36afe6,_0x18caf7[0x0]));if(_0x11c608['isFile']()){removeReferences(_0x11addf,_0x36afe6);logger[_0x5546('0x2a')]('Invalid\x20plugin\x20structure');return _0x151c53(new Error(_0x5546('0x6a')));}if(_0x11c608[_0x5546('0x6c')]()){var _0x20beaa=fs[_0x5546('0x6d')](path['join'](_0x36afe6,_0x18caf7[0x0]));if(_0x20beaa[_0x5546('0x3b')]===0x0){removeReferences(_0x11addf,_0x36afe6);logger[_0x5546('0x2a')](_0x5546('0x6a'));return _0x151c53(new Error('Invalid\x20plugin\x20structure'));}var _0x501ceb=_0x20beaa[_0x5546('0x6e')](function(_0x82a009){return _0x82a009==='manifest.json';});if(!_0x501ceb){return _0x151c53(new Error(_0x5546('0x6f')));}var _0x3928cf=fs['readFileSync'](path[_0x5546('0x4d')](_0x36afe6,_0x18caf7[0x0],_0x5546('0x70')));var _0x28fb30=JSON[_0x5546('0x71')](_0x3928cf);if('undefined'==typeof _0x28fb30[_0x5546('0x35')]){return _0x151c53(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x28fb30['type']){return _0x151c53(new Error(_0x5546('0x72')));}if(_0x5546('0x1e')==typeof _0x28fb30[_0x5546('0x73')]){return _0x151c53(new Error(_0x5546('0x74')));}if(_0x5546('0x1e')==typeof _0x28fb30[_0x5546('0x75')]){return _0x151c53(new Error(_0x5546('0x76')));}if(_0x28fb30[_0x5546('0x32')]==='html'){if(_0x5546('0x1e')==typeof _0x28fb30[_0x5546('0x75')][_0x5546('0x77')]){return _0x151c53(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x5546('0x1e')==typeof _0x28fb30['parameters'][_0x5546('0x77')]['admin']&&_0x5546('0x1e')==typeof _0x28fb30[_0x5546('0x75')][_0x5546('0x77')]['agent']){return _0x151c53(new Error(_0x5546('0x78')));}}else if(_0x28fb30[_0x5546('0x32')]===_0x5546('0x79')){if(_0x5546('0x1e')==typeof _0x28fb30[_0x5546('0x75')][_0x5546('0x7a')]){return _0x151c53(new Error(_0x5546('0x7b')));}if(_0x5546('0x1e')==typeof _0x28fb30[_0x5546('0x75')][_0x5546('0x7c')]){return _0x151c53(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x151c53(new Error(_0x5546('0x7d')));}var _0x383b6f=_0x28fb30[_0x5546('0x35')];var _0x2b6904=_0x28fb30[_0x5546('0x7e')];var _0x3a3043=_0x28fb30[_0x5546('0x32')];var _0x5600bd=_0x28fb30[_0x5546('0x7f')]?_0x28fb30[_0x5546('0x7f')]:_0x5546('0x80');var _0x13ec8f=_0x28fb30[_0x5546('0x81')]?_0x28fb30[_0x5546('0x81')]:_0x5546('0x82');var _0x7c0091='';var _0x50b65f='';var _0x157de6='';var _0x59c8e4='';var _0x426c51=_0x28fb30[_0x5546('0x73')];if(_0x3a3043===_0x5546('0x83')){if(_0x5546('0x1e')!=typeof _0x28fb30['parameters'][_0x5546('0x77')][_0x5546('0x84')]){var _0xb55c60=_0x28fb30[_0x5546('0x75')][_0x5546('0x77')][_0x5546('0x84')];if(!/^(f|ht)tps?:\/\//i['test'](_0xb55c60)){_0x7c0091=path['join'](_0x5546('0x85'),_0x5a2d1f,_0x18caf7[0x0],_0xb55c60);}else{_0x7c0091=_0xb55c60;}}else{logger['info'](_0x5546('0x86'));}if('undefined'!=typeof _0x28fb30[_0x5546('0x75')]['views'][_0x5546('0x87')]){var _0x1720d9=_0x28fb30[_0x5546('0x75')][_0x5546('0x77')][_0x5546('0x87')];if(!/^(f|ht)tps?:\/\//i[_0x5546('0x88')](_0x1720d9)){_0x50b65f=path[_0x5546('0x4d')](_0x5546('0x85'),_0x5a2d1f,_0x18caf7[0x0],_0x1720d9);}else{_0x50b65f=_0x1720d9;}}else{logger[_0x5546('0x62')](_0x5546('0x89'));}}else if(_0x3a3043===_0x5546('0x79')){_0x157de6=_0x28fb30[_0x5546('0x75')]['scriptName'];_0x59c8e4=_0x28fb30[_0x5546('0x75')]['scriptPath'];if(_0x5546('0x1e')!=typeof _0x28fb30[_0x5546('0x75')]['views']){if(_0x5546('0x1e')!=typeof _0x28fb30[_0x5546('0x75')][_0x5546('0x77')][_0x5546('0x84')]){var _0xb55c60=_0x28fb30[_0x5546('0x75')][_0x5546('0x77')][_0x5546('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x5546('0x88')](_0xb55c60)){_0x7c0091=path['join'](_0x5546('0x85'),_0x5a2d1f,_0x18caf7[0x0],_0xb55c60);}else{_0x7c0091=_0xb55c60;}}if(_0x5546('0x1e')!=typeof _0x28fb30['parameters']['views'][_0x5546('0x87')]){var _0x1720d9=_0x28fb30[_0x5546('0x75')][_0x5546('0x77')][_0x5546('0x87')];if(!/^(f|ht)tps?:\/\//i[_0x5546('0x88')](_0x1720d9)){_0x50b65f=path[_0x5546('0x4d')]('plugins',_0x5a2d1f,_0x18caf7[0x0],_0x1720d9);}else{_0x50b65f=_0x1720d9;}}}}var _0x390ea1={'name':_0x383b6f,'description':_0x2b6904,'path':path[_0x5546('0x4d')](_0x5a2d1f,_0x18caf7[0x0]),'type':_0x3a3043,'sidebar':_0x5600bd,'icon':_0x13ec8f,'adminUrl':_0x7c0091,'agentUrl':_0x50b65f,'scriptName':_0x157de6,'scriptPath':_0x59c8e4,'version':_0x426c51};removeReferences(_0x11addf,null);return db[_0x5546('0x2f')][_0x5546('0x8a')](_0x390ea1)[_0x5546('0x26')](function(_0x58e6ed){var _0x1a8256={'role':_0xff8f00[_0x5546('0x8b')]['role'],'userProfileId':_0xff8f00[_0x5546('0x8b')][_0x5546('0x8c')]};if(!_0x1a8256)throw new Error(_0x5546('0x8d'));if(_0x1a8256['role']==='user'){var _0x449dc0=_0x58e6ed[_0x5546('0x28')]({'plain':!![]});return db[_0x5546('0x8e')][_0x5546('0x4b')]({'where':{'name':_0x5546('0x29'),'userProfileId':_0x1a8256['userProfileId']},'raw':!![]})[_0x5546('0x26')](function(_0x4d2163){if(_0x4d2163&&_0x4d2163[_0x5546('0x8f')]===0x0){return db[_0x5546('0x90')][_0x5546('0x8a')]({'name':_0x449dc0['name'],'resourceId':_0x449dc0['id'],'type':_0x4d2163[_0x5546('0x35')],'sectionId':_0x4d2163['id']},{})[_0x5546('0x26')](function(){return _0x58e6ed;});}else{return _0x58e6ed;}})[_0x5546('0x46')](function(_0x1ba5b7){logger[_0x5546('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ba5b7);throw _0x1ba5b7;});}return _0x58e6ed;})[_0x5546('0x26')](respondWithResult(_0x4cce85,null))[_0x5546('0x46')](handleError(_0x4cce85,null));}});}catch(_0x202f04){_0x4cce85[_0x5546('0x2c')](0x1f4)[_0x5546('0x91')](_0x202f04);}};function removeReferences(_0x954e63,_0x3ecf29){try{if(_0x954e63){fs[_0x5546('0x61')](_0x954e63);logger[_0x5546('0x62')](_0x5546('0x92'));}if(_0x3ecf29){rimraf(_0x3ecf29,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x55c1fc){logger['error'](_0x55c1fc);}}exports['update']=function(_0x1b1185,_0x5bd3ea,_0x10d346){return db[_0x5546('0x2f')][_0x5546('0x4b')]({'where':{'id':_0x1b1185['params']['id']}})['then'](handleEntityNotFound(_0x5bd3ea,null))[_0x5546('0x26')](saveUpdates(_0x1b1185[_0x5546('0x8b')],null))[_0x5546('0x26')](respondWithResult(_0x5bd3ea,null))[_0x5546('0x46')](handleError(_0x5bd3ea,null));};exports[_0x5546('0x93')]=function(_0x3c52de,_0x177efb,_0x31cf96){return db[_0x5546('0x2f')][_0x5546('0x4b')]({'where':{'id':_0x3c52de[_0x5546('0x48')]['id']}})[_0x5546('0x26')](function(_0x1b67d2){if(_0x1b67d2){return _0x1b67d2[_0x5546('0x27')]();}})[_0x5546('0x26')](function(_0x582221){rimraf(path[_0x5546('0x4d')](config['root'],_0x5546('0x4e'),path[_0x5546('0x59')](_0x582221[_0x5546('0x3')])),function(){});return _0x582221;})[_0x5546('0x26')](handleEntityNotFound(_0x177efb,null))[_0x5546('0x26')](respondWithStatusCode(_0x177efb,null))['catch'](handleError(_0x177efb,null));};exports[_0x5546('0x94')]=function(_0x494a47,_0x59295a,_0x513767){return BPromise[_0x5546('0x95')]()['then'](function(){if(!_0x494a47[_0x5546('0x36')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x494a47[_0x5546('0x36')][_0x5546('0x96')]){throw new Error(_0x5546('0x97'));}var _0x22d55d=_0x494a47[_0x5546('0x36')]['hostname']?_0x494a47[_0x5546('0x36')][_0x5546('0x98')]+':'+_0x494a47[_0x5546('0x36')][_0x5546('0x96')]:_0x5546('0x99')+_0x494a47[_0x5546('0x36')]['port'];var _0x28ea89=_0x494a47[_0x5546('0x36')][_0x5546('0x22')]?_0x494a47[_0x5546('0x36')]['json']:!![];var _0x8e86dc=_0x494a47['query'][_0x5546('0x9a')]?_0x494a47[_0x5546('0x36')]['encoding']:null;var _0xc61e40={'method':_0x494a47[_0x5546('0x9b')],'uri':util[_0x5546('0x4f')](_0x5546('0x9c'),_0x22d55d,_0x494a47[_0x5546('0x36')][_0x5546('0x3')]),'json':_0x28ea89,'resolveWithFullResponse':!![],'encoding':_0x8e86dc,'qs':_0x494a47[_0x5546('0x36')]};if(_0x494a47[_0x5546('0x9d')]){_0xc61e40[_0x5546('0x9d')]=_0x494a47['headers'];if(_0xc61e40[_0x5546('0x9d')][_0x5546('0x9e')]){delete _0xc61e40['headers'][_0x5546('0x9e')];}}if(_0xc61e40[_0x5546('0x9d')][_0x5546('0x9f')]){delete _0xc61e40[_0x5546('0x9d')]['content-type'];}return rp(_0xc61e40);})[_0x5546('0x26')](function(_0x23f413){if(_0x23f413){_0x59295a['set'](_0x23f413[_0x5546('0x9d')]);logger[_0x5546('0x62')](_0x23f413[_0x5546('0x8b')]);if(_[_0x5546('0xa0')](_0x494a47[_0x5546('0x36')][_0x5546('0x3')],'download')&&_0x23f413[_0x5546('0xa1')]==0x1f4){return _0x59295a[_0x5546('0x1c')](_0x23f413[_0x5546('0xa1')]);}else{return _0x59295a[_0x5546('0x2c')](_0x23f413['statusCode'])[_0x5546('0x91')](_0x23f413[_0x5546('0x8b')]);}}else{return _0x59295a[_0x5546('0x1c')](0xc8);}})[_0x5546('0x46')](handleError(_0x59295a,null));};exports[_0x5546('0xa2')]=function(_0x19f620,_0x506382,_0x129160){return BPromise[_0x5546('0x95')]()[_0x5546('0x26')](function(){if(!_0x19f620[_0x5546('0x36')][_0x5546('0x3')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x19f620['query'][_0x5546('0x96')]){throw new Error(_0x5546('0x97'));}var _0x1a6614=_0x19f620[_0x5546('0x36')][_0x5546('0x98')]?_0x19f620[_0x5546('0x36')][_0x5546('0x98')]+':'+_0x19f620[_0x5546('0x36')][_0x5546('0x96')]:'http://localhost:'+_0x19f620[_0x5546('0x36')]['port'];var _0x35de5a=_0x19f620[_0x5546('0x36')][_0x5546('0x22')]?_0x19f620[_0x5546('0x36')]['json']:!![];var _0x53eb86=_0x19f620[_0x5546('0x36')][_0x5546('0x9a')]?_0x19f620[_0x5546('0x36')]['encoding']:null;var _0x396401={'method':_0x19f620[_0x5546('0x9b')],'uri':util['format'](_0x5546('0x9c'),_0x1a6614,_0x19f620[_0x5546('0x36')]['path']),'json':_0x35de5a,'resolveWithFullResponse':!![],'encoding':_0x53eb86,'body':_0x19f620['body']};if(_0x19f620[_0x5546('0x9d')]){_0x396401[_0x5546('0x9d')]=_0x19f620[_0x5546('0x9d')];if(_0x396401[_0x5546('0x9d')][_0x5546('0x9e')]){delete _0x396401[_0x5546('0x9d')][_0x5546('0x9e')];}}if(_0x396401[_0x5546('0x9d')]['content-type']){delete _0x396401[_0x5546('0x9d')]['content-type'];}return rp(_0x396401);})['then'](function(_0xa783d3){if(_0xa783d3){_0x506382[_0x5546('0x20')](_0xa783d3[_0x5546('0x9d')]);logger[_0x5546('0x62')](_0xa783d3['body']);return _0x506382[_0x5546('0x2c')](_0xa783d3[_0x5546('0xa1')])[_0x5546('0x91')](_0xa783d3['body']);}else{return _0x506382[_0x5546('0x1c')](0xc8);}})['catch'](handleError(_0x506382,null));}; \ No newline at end of file +var _0xe619=['html','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','querystring','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','register','sendStatus','end','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','show','params','attributes','includeAll','find','catch','download','join','root','server/files/plugins','format','%s.zip','createWriteStream','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','node_modules/**/*','basename','finalize','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','upload','filename','extname','file','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','parameters','Invalid\x20manifest:\x20parameters\x20missing'];(function(_0x172db4,_0x27a961){var _0x408649=function(_0x5de5da){while(--_0x5de5da){_0x172db4['push'](_0x172db4['shift']());}};_0x408649(++_0x27a961);}(_0xe619,0x17f));var _0x9e61=function(_0xe36749,_0x2a45c8){_0xe36749=_0xe36749-0x0;var _0x5d86b7=_0xe619[_0xe36749];return _0x5d86b7;};'use strict';var emlformat=require(_0x9e61('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9e61('0x1'));var jsonpatch=require(_0x9e61('0x2'));var rp=require(_0x9e61('0x3'));var moment=require(_0x9e61('0x4'));var BPromise=require(_0x9e61('0x5'));var Mustache=require(_0x9e61('0x6'));var util=require(_0x9e61('0x7'));var path=require(_0x9e61('0x8'));var sox=require(_0x9e61('0x9'));var csv=require(_0x9e61('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9e61('0xb'));var squel=require(_0x9e61('0xc'));var crypto=require(_0x9e61('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9e61('0xa'));var querystring=require(_0x9e61('0xe'));var Papa=require('papaparse');var extract=require(_0x9e61('0xf'));var rimraf=require(_0x9e61('0x10'));var archiver=require(_0x9e61('0x11'));var Redis=require(_0x9e61('0x12'));var authService=require(_0x9e61('0x13'));var qs=require(_0x9e61('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e61('0x15'));var logger=require(_0x9e61('0x16'))(_0x9e61('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9e61('0x18'));var db=require(_0x9e61('0x19'))['db'];config['redis']=_[_0x9e61('0x1a')](config[_0x9e61('0x1b')],{'host':_0x9e61('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9e61('0x1b')]));require('./plugin.socket')[_0x9e61('0x1d')](socket);function respondWithStatusCode(_0x3df3c9,_0xf8ba64){_0xf8ba64=_0xf8ba64||0xcc;return function(_0x4cddd){if(_0x4cddd){return _0x3df3c9[_0x9e61('0x1e')](_0xf8ba64);}return _0x3df3c9['status'](_0xf8ba64)[_0x9e61('0x1f')]();};}function respondWithResult(_0x253cd9,_0x41ed0f){_0x41ed0f=_0x41ed0f||0xc8;return function(_0x42f880){if(_0x42f880){return _0x253cd9[_0x9e61('0x20')](_0x41ed0f)[_0x9e61('0x21')](_0x42f880);}};}function respondWithFilteredResult(_0xaf22d7,_0x445699){return function(_0x2bbede){if(_0x2bbede){var _0x5c53f2=typeof _0x445699['offset']==='undefined'&&typeof _0x445699[_0x9e61('0x22')]===_0x9e61('0x23');var _0x101aa2=_0x2bbede[_0x9e61('0x24')];var _0x3e0379=_0x5c53f2?0x0:_0x445699[_0x9e61('0x25')];var _0x459e4b=_0x5c53f2?_0x2bbede[_0x9e61('0x24')]:_0x445699[_0x9e61('0x25')]+_0x445699[_0x9e61('0x22')];var _0x1572f7;if(_0x459e4b>=_0x101aa2){_0x459e4b=_0x101aa2;_0x1572f7=0xc8;}else{_0x1572f7=0xce;}_0xaf22d7[_0x9e61('0x20')](_0x1572f7);return _0xaf22d7['set'](_0x9e61('0x26'),_0x3e0379+'-'+_0x459e4b+'/'+_0x101aa2)['json'](_0x2bbede);}return null;};}function patchUpdates(_0xf81d35){return function(_0x90ecc9){try{jsonpatch[_0x9e61('0x27')](_0x90ecc9,_0xf81d35,!![]);}catch(_0x4231f0){return BPromise[_0x9e61('0x28')](_0x4231f0);}return _0x90ecc9[_0x9e61('0x29')]();};}function saveUpdates(_0x5b3a18,_0x58e262){return function(_0x10c771){if(_0x10c771){return _0x10c771[_0x9e61('0x2a')](_0x5b3a18)[_0x9e61('0x2b')](function(_0x54c837){return _0x54c837;});}return null;};}function removeEntity(_0x18e09a,_0x30435d){return function(_0x3387ce){if(_0x3387ce){return _0x3387ce[_0x9e61('0x2c')]()['then'](function(){var _0x3435d2=_0x3387ce[_0x9e61('0x2d')]({'plain':!![]});var _0x2457e3=_0x9e61('0x2e');return db[_0x9e61('0x2f')][_0x9e61('0x2c')]({'where':{'type':_0x2457e3,'resourceId':_0x3435d2['id']}})[_0x9e61('0x2b')](function(){return _0x3387ce;});})['then'](function(){_0x18e09a[_0x9e61('0x20')](0xcc)[_0x9e61('0x1f')]();});}};}function handleEntityNotFound(_0x3db27d,_0x50cacd){return function(_0x573eee){if(!_0x573eee){_0x3db27d['sendStatus'](0x194);}return _0x573eee;};}function handleError(_0x3d5dd3,_0xc6d395){_0xc6d395=_0xc6d395||0x1f4;return function(_0xf89817){logger[_0x9e61('0x30')](_0xf89817[_0x9e61('0x31')]);if(_0xf89817[_0x9e61('0x32')]){delete _0xf89817['name'];}_0x3d5dd3['status'](_0xc6d395)[_0x9e61('0x33')](_0xf89817);};}exports[_0x9e61('0x34')]=function(_0x533a2d,_0x4f47b3){var _0x3fc24b={},_0x3adb8b={},_0x1c2928={'count':0x0,'rows':[]};var _0x56d43d=_[_0x9e61('0x35')](db[_0x9e61('0x36')][_0x9e61('0x37')],function(_0x8d0564){return{'name':_0x8d0564[_0x9e61('0x38')],'type':_0x8d0564[_0x9e61('0x39')][_0x9e61('0x3a')]};});_0x3adb8b[_0x9e61('0x3b')]=_['map'](_0x56d43d,'name');_0x3adb8b[_0x9e61('0x3c')]=_[_0x9e61('0x3d')](_0x533a2d[_0x9e61('0x3c')]);_0x3adb8b[_0x9e61('0x3e')]=_['intersection'](_0x3adb8b['model'],_0x3adb8b[_0x9e61('0x3c')]);_0x3fc24b['attributes']=_[_0x9e61('0x3f')](_0x3adb8b[_0x9e61('0x3b')],qs[_0x9e61('0x40')](_0x533a2d[_0x9e61('0x3c')][_0x9e61('0x40')]));_0x3fc24b['attributes']=_0x3fc24b['attributes'][_0x9e61('0x41')]?_0x3fc24b['attributes']:_0x3adb8b[_0x9e61('0x3b')];if(!_0x533a2d[_0x9e61('0x3c')]['hasOwnProperty'](_0x9e61('0x42'))){_0x3fc24b[_0x9e61('0x22')]=qs['limit'](_0x533a2d[_0x9e61('0x3c')][_0x9e61('0x22')]);_0x3fc24b[_0x9e61('0x25')]=qs[_0x9e61('0x25')](_0x533a2d['query'][_0x9e61('0x25')]);}_0x3fc24b[_0x9e61('0x43')]=qs[_0x9e61('0x44')](_0x533a2d[_0x9e61('0x3c')][_0x9e61('0x44')]);_0x3fc24b['where']=qs[_0x9e61('0x3e')](_[_0x9e61('0x45')](_0x533a2d['query'],_0x3adb8b[_0x9e61('0x3e')]),_0x56d43d);if(_0x533a2d[_0x9e61('0x3c')][_0x9e61('0x46')]){_0x3fc24b[_0x9e61('0x47')]=_[_0x9e61('0x48')](_0x3fc24b['where'],{'$or':_[_0x9e61('0x35')](_0x56d43d,function(_0x3ae25b){if(_0x3ae25b['type']!==_0x9e61('0x49')){var _0x509636={};_0x509636[_0x3ae25b[_0x9e61('0x32')]]={'$like':'%'+_0x533a2d['query'][_0x9e61('0x46')]+'%'};return _0x509636;}})});}_0x3fc24b=_[_0x9e61('0x48')]({},_0x3fc24b,_0x533a2d['options']);var _0x1f2edf={'where':_0x3fc24b[_0x9e61('0x47')]};return db[_0x9e61('0x36')]['count'](_0x1f2edf)[_0x9e61('0x2b')](function(_0x539e5a){_0x1c2928['count']=_0x539e5a;if(_0x533a2d[_0x9e61('0x3c')]['includeAll']){_0x3fc24b[_0x9e61('0x4a')]=[{'all':!![]}];}return db['Plugin'][_0x9e61('0x4b')](_0x3fc24b);})[_0x9e61('0x2b')](function(_0xe5d761){_0x1c2928['rows']=_0xe5d761;return _0x1c2928;})['then'](respondWithFilteredResult(_0x4f47b3,_0x3fc24b))['catch'](handleError(_0x4f47b3,null));};exports[_0x9e61('0x4c')]=function(_0x3763e3,_0x54516b){var _0x444df8={'raw':!![],'where':{'id':_0x3763e3[_0x9e61('0x4d')]['id']}},_0x3a20fc={};_0x3a20fc[_0x9e61('0x3b')]=_[_0x9e61('0x3d')](db['Plugin'][_0x9e61('0x37')]);_0x3a20fc[_0x9e61('0x3c')]=_[_0x9e61('0x3d')](_0x3763e3[_0x9e61('0x3c')]);_0x3a20fc[_0x9e61('0x3e')]=_[_0x9e61('0x3f')](_0x3a20fc[_0x9e61('0x3b')],_0x3a20fc[_0x9e61('0x3c')]);_0x444df8[_0x9e61('0x4e')]=_['intersection'](_0x3a20fc['model'],qs[_0x9e61('0x40')](_0x3763e3['query'][_0x9e61('0x40')]));_0x444df8[_0x9e61('0x4e')]=_0x444df8['attributes']['length']?_0x444df8[_0x9e61('0x4e')]:_0x3a20fc[_0x9e61('0x3b')];if(_0x3763e3[_0x9e61('0x3c')][_0x9e61('0x4f')]){_0x444df8[_0x9e61('0x4a')]=[{'all':!![]}];}_0x444df8=_[_0x9e61('0x48')]({},_0x444df8,_0x3763e3['options']);return db[_0x9e61('0x36')][_0x9e61('0x50')](_0x444df8)[_0x9e61('0x2b')](handleEntityNotFound(_0x54516b,null))[_0x9e61('0x2b')](respondWithResult(_0x54516b,null))[_0x9e61('0x51')](handleError(_0x54516b,null));};exports[_0x9e61('0x52')]=function(_0x587ecc,_0x239f93,_0x26498d){return db[_0x9e61('0x36')][_0x9e61('0x50')]({'where':{'id':_0x587ecc[_0x9e61('0x4d')]['id']},'attributes':[_0x9e61('0x32'),_0x9e61('0x8')],'raw':!![]})['then'](handleEntityNotFound(_0x239f93,null))[_0x9e61('0x2b')](function(_0xb22e41){if(_0xb22e41){var _0x2be691=path[_0x9e61('0x53')](config[_0x9e61('0x54')],_0x9e61('0x55'),util[_0x9e61('0x56')](_0x9e61('0x57'),path['basename'](_0xb22e41[_0x9e61('0x8')])));var _0xdb89a1=fs[_0x9e61('0x58')](_0x2be691);var _0x5effcf=archiver(_0x9e61('0x59'),{'zlib':{'level':0x9}});_0x5effcf['on']('warning',function(_0x15d235){if(_0x15d235[_0x9e61('0x5a')]===_0x9e61('0x5b')){logger[_0x9e61('0x30')](_0x15d235);}else{throw new db[(_0x9e61('0x5c'))][(_0x9e61('0x5d'))](_0x9e61('0x5e'));}});_0x5effcf['on']('error',function(_0x5a4dbc){throw new db[(_0x9e61('0x5c'))][(_0x9e61('0x5d'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x5effcf[_0x9e61('0x5f')](_0xdb89a1);_0x5effcf[_0x9e61('0x60')](_0x9e61('0x61'),{'cwd':path[_0x9e61('0x53')](config['root'],'server/files/plugins',path['dirname'](_0xb22e41[_0x9e61('0x8')])),'ignore':[path[_0x9e61('0x53')](path['basename'](_0xb22e41[_0x9e61('0x8')]),_0x9e61('0x62')),path[_0x9e61('0x53')](path[_0x9e61('0x63')](_0xb22e41['path']),'attachments/**/*')],'nodir':!![]})[_0x9e61('0x64')]();_0xdb89a1['on'](_0x9e61('0x65'),function(){if(!fs['existsSync'](_0x2be691)){throw new db[(_0x9e61('0x5c'))]['Error'](_0x9e61('0x66'));}return _0x239f93[_0x9e61('0x52')](_0x2be691,util['format'](_0x9e61('0x57'),path[_0x9e61('0x63')](_0xb22e41[_0x9e61('0x8')])),function(_0x1c3080){if(_0x1c3080){throw new db['Sequelize'][(_0x9e61('0x5d'))](_0x9e61('0x67'));}fs[_0x9e61('0x68')](_0x2be691);logger[_0x9e61('0x69')](_0x9e61('0x6a'));logger[_0x9e61('0x69')]('Temporary\x20file\x20removed');});});}return null;})[_0x9e61('0x51')](handleError(_0x239f93,null));};exports[_0x9e61('0x6b')]=function(_0x13c6ad,_0x422bd4,_0xb19dff){var _0x2e1ff9=path[_0x9e61('0x63')](_0x13c6ad['file'][_0x9e61('0x6c')],path[_0x9e61('0x6d')](_0x13c6ad[_0x9e61('0x6e')][_0x9e61('0x6c')]));var _0x1f4654=path['join'](config['root'],_0x9e61('0x55'),_0x13c6ad['file']['filename']);var _0x1eb20a=path[_0x9e61('0x53')](config['root'],'server/files/plugins',_0x2e1ff9);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x1f4654);logger[_0x9e61('0x69')]('Plugin\x20upload\x20destination:\x20%s',_0x1eb20a);try{fs['chmodSync'](_0x1f4654,parseInt('0777',0x8));extract(_0x1f4654,{'dir':_0x1eb20a},function(_0x44e063){if(_0x44e063){logger[_0x9e61('0x30')](_0x44e063);handleError(_0x44e063,!![]);};var _0x516f2b=fs['readdirSync'](_0x1eb20a);if(_0x516f2b[_0x9e61('0x41')]>0x1){removeReferences(_0x1f4654,_0x1eb20a);logger[_0x9e61('0x30')]('Invalid\x20plugin\x20structure');return _0xb19dff(new Error(_0x9e61('0x6f')));}var _0x458c6f=fs[_0x9e61('0x70')](path[_0x9e61('0x53')](_0x1eb20a,_0x516f2b[0x0]));if(_0x458c6f[_0x9e61('0x71')]()){removeReferences(_0x1f4654,_0x1eb20a);logger[_0x9e61('0x30')](_0x9e61('0x6f'));return _0xb19dff(new Error('Invalid\x20plugin\x20structure'));}if(_0x458c6f[_0x9e61('0x72')]()){var _0x1b66a4=fs[_0x9e61('0x73')](path[_0x9e61('0x53')](_0x1eb20a,_0x516f2b[0x0]));if(_0x1b66a4[_0x9e61('0x41')]===0x0){removeReferences(_0x1f4654,_0x1eb20a);logger[_0x9e61('0x30')](_0x9e61('0x6f'));return _0xb19dff(new Error(_0x9e61('0x6f')));}var _0x2a8992=_0x1b66a4['some'](function(_0x5c767b){return _0x5c767b===_0x9e61('0x74');});if(!_0x2a8992){return _0xb19dff(new Error(_0x9e61('0x75')));}var _0x19dba1=fs[_0x9e61('0x76')](path[_0x9e61('0x53')](_0x1eb20a,_0x516f2b[0x0],_0x9e61('0x74')));var _0x483a65=JSON[_0x9e61('0x77')](_0x19dba1);if(_0x9e61('0x23')==typeof _0x483a65[_0x9e61('0x32')]){return _0xb19dff(new Error(_0x9e61('0x78')));}if(_0x9e61('0x23')==typeof _0x483a65[_0x9e61('0x39')]){return _0xb19dff(new Error(_0x9e61('0x79')));}if(_0x9e61('0x23')==typeof _0x483a65['version']){return _0xb19dff(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x9e61('0x23')==typeof _0x483a65[_0x9e61('0x7a')]){return _0xb19dff(new Error(_0x9e61('0x7b')));}if(_0x483a65[_0x9e61('0x39')]===_0x9e61('0x7c')){if(_0x9e61('0x23')==typeof _0x483a65[_0x9e61('0x7a')]['views']){return _0xb19dff(new Error(_0x9e61('0x7d')));}if('undefined'==typeof _0x483a65[_0x9e61('0x7a')][_0x9e61('0x7e')][_0x9e61('0x7f')]&&_0x9e61('0x23')==typeof _0x483a65[_0x9e61('0x7a')]['views'][_0x9e61('0x80')]){return _0xb19dff(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x483a65[_0x9e61('0x39')]===_0x9e61('0x81')){if(_0x9e61('0x23')==typeof _0x483a65[_0x9e61('0x7a')][_0x9e61('0x82')]){return _0xb19dff(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x9e61('0x23')==typeof _0x483a65[_0x9e61('0x7a')]['scriptPath']){return _0xb19dff(new Error(_0x9e61('0x83')));}}else{return _0xb19dff(new Error(_0x9e61('0x84')));}var _0x3611f3=_0x483a65[_0x9e61('0x32')];var _0x4d21df=_0x483a65[_0x9e61('0x85')];var _0x13034c=_0x483a65[_0x9e61('0x39')];var _0x40fa86=_0x483a65[_0x9e61('0x86')]?_0x483a65[_0x9e61('0x86')]:_0x9e61('0x87');var _0x4c51cd=_0x483a65[_0x9e61('0x88')]?_0x483a65['icon']:'icon-apps';var _0x21b296='';var _0x1e623c='';var _0x279fb9='';var _0x533e8d='';var _0x1037a3=_0x483a65['version'];if(_0x13034c==='html'){if(_0x9e61('0x23')!=typeof _0x483a65[_0x9e61('0x7a')]['views'][_0x9e61('0x7f')]){var _0xbb4524=_0x483a65[_0x9e61('0x7a')][_0x9e61('0x7e')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x9e61('0x89')](_0xbb4524)){_0x21b296=path['join'](_0x9e61('0x8a'),_0x2e1ff9,_0x516f2b[0x0],_0xbb4524);}else{_0x21b296=_0xbb4524;}}else{logger[_0x9e61('0x69')](_0x9e61('0x8b'));}if(_0x9e61('0x23')!=typeof _0x483a65[_0x9e61('0x7a')]['views'][_0x9e61('0x80')]){var _0x2e1b59=_0x483a65['parameters']['views'][_0x9e61('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x9e61('0x89')](_0x2e1b59)){_0x1e623c=path['join'](_0x9e61('0x8a'),_0x2e1ff9,_0x516f2b[0x0],_0x2e1b59);}else{_0x1e623c=_0x2e1b59;}}else{logger[_0x9e61('0x69')](_0x9e61('0x8c'));}}else if(_0x13034c===_0x9e61('0x81')){_0x279fb9=_0x483a65['parameters'][_0x9e61('0x82')];_0x533e8d=_0x483a65['parameters'][_0x9e61('0x8d')];if(_0x9e61('0x23')!=typeof _0x483a65[_0x9e61('0x7a')][_0x9e61('0x7e')]){if(_0x9e61('0x23')!=typeof _0x483a65[_0x9e61('0x7a')]['views']['admin']){var _0xbb4524=_0x483a65[_0x9e61('0x7a')][_0x9e61('0x7e')][_0x9e61('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x9e61('0x89')](_0xbb4524)){_0x21b296=path[_0x9e61('0x53')](_0x9e61('0x8a'),_0x2e1ff9,_0x516f2b[0x0],_0xbb4524);}else{_0x21b296=_0xbb4524;}}if('undefined'!=typeof _0x483a65[_0x9e61('0x7a')][_0x9e61('0x7e')]['agent']){var _0x2e1b59=_0x483a65[_0x9e61('0x7a')][_0x9e61('0x7e')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x9e61('0x89')](_0x2e1b59)){_0x1e623c=path[_0x9e61('0x53')](_0x9e61('0x8a'),_0x2e1ff9,_0x516f2b[0x0],_0x2e1b59);}else{_0x1e623c=_0x2e1b59;}}}}var _0x1cfbfe={'name':_0x3611f3,'description':_0x4d21df,'path':path[_0x9e61('0x53')](_0x2e1ff9,_0x516f2b[0x0]),'type':_0x13034c,'sidebar':_0x40fa86,'icon':_0x4c51cd,'adminUrl':_0x21b296,'agentUrl':_0x1e623c,'scriptName':_0x279fb9,'scriptPath':_0x533e8d,'version':_0x1037a3};removeReferences(_0x1f4654,null);return db[_0x9e61('0x36')]['create'](_0x1cfbfe)[_0x9e61('0x2b')](function(_0x1be3db){var _0x1358b2={'role':_0x13c6ad['body'][_0x9e61('0x8e')],'userProfileId':_0x13c6ad[_0x9e61('0x8f')][_0x9e61('0x90')]};if(!_0x1358b2)throw new Error(_0x9e61('0x91'));if(_0x1358b2[_0x9e61('0x8e')]===_0x9e61('0x92')){var _0x5b76fa=_0x1be3db[_0x9e61('0x2d')]({'plain':!![]});return db[_0x9e61('0x93')]['find']({'where':{'name':'Plugins','userProfileId':_0x1358b2[_0x9e61('0x90')]},'raw':!![]})[_0x9e61('0x2b')](function(_0x247908){if(_0x247908&&_0x247908[_0x9e61('0x94')]===0x0){return db[_0x9e61('0x2f')]['create']({'name':_0x5b76fa['name'],'resourceId':_0x5b76fa['id'],'type':_0x247908[_0x9e61('0x32')],'sectionId':_0x247908['id']},{})[_0x9e61('0x2b')](function(){return _0x1be3db;});}else{return _0x1be3db;}})[_0x9e61('0x51')](function(_0x3d8fa0){logger['error'](_0x9e61('0x95'),_0x3d8fa0);throw _0x3d8fa0;});}return _0x1be3db;})[_0x9e61('0x2b')](respondWithResult(_0x422bd4,null))[_0x9e61('0x51')](handleError(_0x422bd4,null));}});}catch(_0x23fada){_0x422bd4[_0x9e61('0x20')](0x1f4)[_0x9e61('0x33')](_0x23fada);}};function removeReferences(_0x57bbe3,_0x2bfb10){try{if(_0x57bbe3){fs[_0x9e61('0x68')](_0x57bbe3);logger[_0x9e61('0x69')](_0x9e61('0x96'));}if(_0x2bfb10){rimraf(_0x2bfb10,function(){});logger[_0x9e61('0x69')](_0x9e61('0x97'));}}catch(_0x4ce885){logger['error'](_0x4ce885);}}exports[_0x9e61('0x2a')]=function(_0x429b63,_0x27315f,_0x51e4aa){return db[_0x9e61('0x36')]['find']({'where':{'id':_0x429b63[_0x9e61('0x4d')]['id']}})[_0x9e61('0x2b')](handleEntityNotFound(_0x27315f,null))[_0x9e61('0x2b')](saveUpdates(_0x429b63[_0x9e61('0x8f')],null))[_0x9e61('0x2b')](respondWithResult(_0x27315f,null))[_0x9e61('0x51')](handleError(_0x27315f,null));};exports[_0x9e61('0x98')]=function(_0x3d027a,_0x24302e,_0x2779aa){return db[_0x9e61('0x36')][_0x9e61('0x50')]({'where':{'id':_0x3d027a['params']['id']}})[_0x9e61('0x2b')](function(_0x52d7e7){if(_0x52d7e7){return _0x52d7e7[_0x9e61('0x2c')]();}})[_0x9e61('0x2b')](function(_0x4617b2){rimraf(path[_0x9e61('0x53')](config[_0x9e61('0x54')],'server/files/plugins',path['dirname'](_0x4617b2[_0x9e61('0x8')])),function(){});return _0x4617b2;})[_0x9e61('0x2b')](handleEntityNotFound(_0x24302e,null))[_0x9e61('0x2b')](respondWithStatusCode(_0x24302e,null))[_0x9e61('0x51')](handleError(_0x24302e,null));};exports[_0x9e61('0x99')]=function(_0x322ac9,_0x2a1d38,_0x2a5379){return BPromise[_0x9e61('0x9a')]()[_0x9e61('0x2b')](function(){if(!_0x322ac9[_0x9e61('0x3c')][_0x9e61('0x8')]){throw new Error(_0x9e61('0x9b'));}if(!_0x322ac9[_0x9e61('0x3c')][_0x9e61('0x9c')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x579598=_0x322ac9[_0x9e61('0x3c')][_0x9e61('0x9d')]?_0x322ac9[_0x9e61('0x3c')][_0x9e61('0x9d')]+':'+_0x322ac9[_0x9e61('0x3c')][_0x9e61('0x9c')]:_0x9e61('0x9e')+_0x322ac9[_0x9e61('0x3c')]['port'];var _0x540f8d=_0x322ac9[_0x9e61('0x3c')]['json']?_0x322ac9['query'][_0x9e61('0x21')]:!![];var _0x5217fe=_0x322ac9['query'][_0x9e61('0x9f')]?_0x322ac9['query'][_0x9e61('0x9f')]:null;var _0x36b393={'method':_0x322ac9[_0x9e61('0xa0')],'uri':util[_0x9e61('0x56')](_0x9e61('0xa1'),_0x579598,_0x322ac9['query'][_0x9e61('0x8')]),'json':_0x540f8d,'resolveWithFullResponse':!![],'encoding':_0x5217fe,'qs':_0x322ac9['query']};if(_0x322ac9[_0x9e61('0xa2')]){_0x36b393[_0x9e61('0xa2')]=_0x322ac9[_0x9e61('0xa2')];if(_0x36b393[_0x9e61('0xa2')][_0x9e61('0xa3')]){delete _0x36b393[_0x9e61('0xa2')][_0x9e61('0xa3')];}}if(_0x36b393[_0x9e61('0xa2')][_0x9e61('0xa4')]){delete _0x36b393[_0x9e61('0xa2')]['content-type'];}return rp(_0x36b393);})[_0x9e61('0x2b')](function(_0x224449){if(_0x224449){_0x2a1d38[_0x9e61('0xa5')](_0x224449[_0x9e61('0xa2')]);logger[_0x9e61('0x69')](_0x224449[_0x9e61('0x8f')]);if(_[_0x9e61('0xa6')](_0x322ac9[_0x9e61('0x3c')][_0x9e61('0x8')],_0x9e61('0x52'))&&_0x224449[_0x9e61('0xa7')]==0x1f4){return _0x2a1d38[_0x9e61('0x1e')](_0x224449[_0x9e61('0xa7')]);}else{return _0x2a1d38[_0x9e61('0x20')](_0x224449[_0x9e61('0xa7')])[_0x9e61('0x33')](_0x224449[_0x9e61('0x8f')]);}}else{return _0x2a1d38[_0x9e61('0x1e')](0xc8);}})[_0x9e61('0x51')](handleError(_0x2a1d38,null));};exports[_0x9e61('0xa8')]=function(_0xaf14eb,_0x1d4778,_0x1833c9){return BPromise[_0x9e61('0x9a')]()[_0x9e61('0x2b')](function(){if(!_0xaf14eb[_0x9e61('0x3c')][_0x9e61('0x8')]){throw new Error(_0x9e61('0x9b'));}if(!_0xaf14eb[_0x9e61('0x3c')][_0x9e61('0x9c')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x305be8=_0xaf14eb['query'][_0x9e61('0x9d')]?_0xaf14eb[_0x9e61('0x3c')][_0x9e61('0x9d')]+':'+_0xaf14eb['query'][_0x9e61('0x9c')]:_0x9e61('0x9e')+_0xaf14eb['query'][_0x9e61('0x9c')];var _0x3bc3ff=_0xaf14eb[_0x9e61('0x3c')][_0x9e61('0x21')]?_0xaf14eb['query'][_0x9e61('0x21')]:!![];var _0x2cc1bf=_0xaf14eb[_0x9e61('0x3c')]['encoding']?_0xaf14eb['query'][_0x9e61('0x9f')]:null;var _0x4a64eb={'method':_0xaf14eb[_0x9e61('0xa0')],'uri':util[_0x9e61('0x56')]('%s%s',_0x305be8,_0xaf14eb[_0x9e61('0x3c')][_0x9e61('0x8')]),'json':_0x3bc3ff,'resolveWithFullResponse':!![],'encoding':_0x2cc1bf,'body':_0xaf14eb[_0x9e61('0x8f')]};if(_0xaf14eb['headers']){_0x4a64eb['headers']=_0xaf14eb[_0x9e61('0xa2')];if(_0x4a64eb[_0x9e61('0xa2')]['content-length']){delete _0x4a64eb[_0x9e61('0xa2')][_0x9e61('0xa3')];}}if(_0x4a64eb[_0x9e61('0xa2')][_0x9e61('0xa4')]){delete _0x4a64eb[_0x9e61('0xa2')]['content-type'];}return rp(_0x4a64eb);})[_0x9e61('0x2b')](function(_0x419ccc){if(_0x419ccc){_0x1d4778[_0x9e61('0xa5')](_0x419ccc[_0x9e61('0xa2')]);logger[_0x9e61('0x69')](_0x419ccc[_0x9e61('0x8f')]);return _0x1d4778[_0x9e61('0x20')](_0x419ccc[_0x9e61('0xa7')])['send'](_0x419ccc[_0x9e61('0x8f')]);}else{return _0x1d4778[_0x9e61('0x1e')](0xc8);}})['catch'](handleError(_0x1d4778,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 4b681c2..154c2ee 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 _0x6b4e=['emit','hasOwnProperty','hook','exports','../../mysqldb','remove'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0x6b4e,0x1a8));var _0xe6b4=function(_0x1ece83,_0x1f41b3){_0x1ece83=_0x1ece83-0x0;var _0xe28f9f=_0x6b4e[_0x1ece83];return _0xe28f9f;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xe6b4('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xe6b4('0x1')};function emitEvent(_0x3be9b1){return function(_0x1aedc5,_0x344db1,_0x436fc0){PluginEvents[_0xe6b4('0x2')](_0x3be9b1+':'+_0x1aedc5['id'],_0x1aedc5);PluginEvents['emit'](_0x3be9b1,_0x1aedc5);_0x436fc0(null);};}for(var e in events){if(events[_0xe6b4('0x3')](e)){var event=events[e];Plugin[_0xe6b4('0x4')](e,emitEvent(event));}}module[_0xe6b4('0x5')]=PluginEvents; \ No newline at end of file +var _0xd8a7=['save','update','remove','emit','hook','exports','events'];(function(_0x5df780,_0x3460c8){var _0x535f5b=function(_0x505237){while(--_0x505237){_0x5df780['push'](_0x5df780['shift']());}};_0x535f5b(++_0x3460c8);}(_0xd8a7,0xdf));var _0x7d8a=function(_0x4f0a8d,_0x163d0e){_0x4f0a8d=_0x4f0a8d-0x0;var _0x33f41f=_0xd8a7[_0x4f0a8d];return _0x33f41f;};'use strict';var EventEmitter=require(_0x7d8a('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7d8a('0x1'),'afterUpdate':_0x7d8a('0x2'),'afterDestroy':_0x7d8a('0x3')};function emitEvent(_0x480dc9){return function(_0xc1a093,_0x5e2db5,_0x435491){PluginEvents['emit'](_0x480dc9+':'+_0xc1a093['id'],_0xc1a093);PluginEvents[_0x7d8a('0x4')](_0x480dc9,_0xc1a093);_0x435491(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x7d8a('0x5')](e,emitEvent(event));}}module[_0x7d8a('0x6')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index bd67fff..d2d4a26 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 _0xa4ae=['request-promise','rimraf','../../config/environment','./plugin.attributes','define','Plugin','plugins','api','moment','bluebird'];(function(_0x1faf15,_0x1db88b){var _0x3c8142=function(_0x213f39){while(--_0x213f39){_0x1faf15['push'](_0x1faf15['shift']());}};_0x3c8142(++_0x1db88b);}(_0xa4ae,0x101));var _0xea4a=function(_0x28111f,_0x254934){_0x28111f=_0x28111f-0x0;var _0x5203e6=_0xa4ae[_0x28111f];return _0x5203e6;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xea4a('0x0'));var moment=require(_0xea4a('0x1'));var BPromise=require(_0xea4a('0x2'));var rp=require(_0xea4a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea4a('0x4'));var config=require(_0xea4a('0x5'));var attributes=require(_0xea4a('0x6'));module['exports']=function(_0x4ecfc5,_0xae6d09){return _0x4ecfc5[_0xea4a('0x7')](_0xea4a('0x8'),attributes,{'tableName':_0xea4a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbadb=['./plugin.attributes','exports','define','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x2bab95,_0x15f1a8){var _0x5b31cd=function(_0x1fc7ea){while(--_0x1fc7ea){_0x2bab95['push'](_0x2bab95['shift']());}};_0x5b31cd(++_0x15f1a8);}(_0xbadb,0x1e3));var _0xbbad=function(_0x1cc758,_0x10f66c){_0x1cc758=_0x1cc758-0x0;var _0x2b6785=_0xbadb[_0x1cc758];return _0x2b6785;};'use strict';var _=require(_0xbbad('0x0'));var util=require(_0xbbad('0x1'));var logger=require(_0xbbad('0x2'))(_0xbbad('0x3'));var moment=require('moment');var BPromise=require(_0xbbad('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbbad('0x5'));var config=require(_0xbbad('0x6'));var attributes=require(_0xbbad('0x7'));module[_0xbbad('0x8')]=function(_0x11918b,_0x312c39){return _0x11918b[_0xbbad('0x9')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 0bee4f4..53be2ba 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 _0x8ae0=['http','redis','./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreatePlugin','Plugin','body','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x290694,_0x281935){var _0x5a0f2e=function(_0x58d7d4){while(--_0x58d7d4){_0x290694['push'](_0x290694['shift']());}};_0x5a0f2e(++_0x281935);}(_0x8ae0,0x115));var _0x08ae=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8ae0[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x08ae('0x0'));var util=require(_0x08ae('0x1'));var moment=require(_0x08ae('0x2'));var BPromise=require(_0x08ae('0x3'));var rs=require(_0x08ae('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x08ae('0x5'))['db'];var utils=require(_0x08ae('0x6'));var logger=require(_0x08ae('0x7'))(_0x08ae('0x8'));var config=require(_0x08ae('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x08ae('0xa')][_0x08ae('0xb')]({'port':0x232a});config[_0x08ae('0xc')]=_['defaults'](config[_0x08ae('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x08ae('0xd'))[_0x08ae('0xe')](socket);function respondWithRpcPromise(_0x1148cd,_0x1c8366,_0x51371d){return new BPromise(function(_0x28ef72,_0xfeaecb){return client[_0x08ae('0xf')](_0x1148cd,_0x51371d)[_0x08ae('0x10')](function(_0x128eb9){logger['info'](_0x08ae('0x11'),_0x1c8366,_0x08ae('0x12'));logger[_0x08ae('0x13')]('Plugin,\x20%s,\x20%s,\x20%s',_0x1c8366,_0x08ae('0x12'),JSON[_0x08ae('0x14')](_0x128eb9));if(_0x128eb9[_0x08ae('0x15')]){if(_0x128eb9[_0x08ae('0x15')][_0x08ae('0x16')]===0x1f4){logger[_0x08ae('0x15')](_0x08ae('0x11'),_0x1c8366,_0x128eb9[_0x08ae('0x15')][_0x08ae('0x17')]);return _0xfeaecb(_0x128eb9['error']['message']);}logger[_0x08ae('0x15')](_0x08ae('0x11'),_0x1c8366,_0x128eb9[_0x08ae('0x15')]['message']);return _0x28ef72(_0x128eb9['error']['message']);}else{logger[_0x08ae('0x18')](_0x08ae('0x11'),_0x1c8366,_0x08ae('0x12'));_0x28ef72(_0x128eb9[_0x08ae('0x19')][_0x08ae('0x17')]);}})[_0x08ae('0x1a')](function(_0x2968c9){logger['error']('Plugin,\x20%s,\x20%s',_0x1c8366,_0x2968c9);_0xfeaecb(_0x2968c9);});});}exports[_0x08ae('0x1b')]=function(_0x4d3a9e){var _0x152fdc=this;return new Promise(function(_0x37dbc7,_0x50d52d){return db[_0x08ae('0x1c')]['create'](_0x4d3a9e[_0x08ae('0x1d')],{'raw':_0x4d3a9e['options']?_0x4d3a9e[_0x08ae('0x1e')][_0x08ae('0x1f')]===undefined?!![]:![]:!![]})[_0x08ae('0x10')](function(_0x14d35d){logger['info']('CreatePlugin',_0x4d3a9e);logger[_0x08ae('0x13')](_0x08ae('0x1b'),_0x4d3a9e,JSON[_0x08ae('0x14')](_0x14d35d));_0x37dbc7(_0x14d35d);})[_0x08ae('0x1a')](function(_0x30ef15){logger[_0x08ae('0x15')](_0x08ae('0x1b'),_0x30ef15[_0x08ae('0x17')],_0x4d3a9e);_0x50d52d(_0x152fdc[_0x08ae('0x15')](0x1f4,_0x30ef15['message']));});});}; \ No newline at end of file +var _0xf180=['body','options','raw','CreatePlugin','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./plugin.socket','register','then','request\x20sent','error','Plugin,\x20%s,\x20%s','message','info','result','Plugin','create'];(function(_0x1c9bff,_0x4ec5c5){var _0x462024=function(_0x10a15a){while(--_0x10a15a){_0x1c9bff['push'](_0x1c9bff['shift']());}};_0x462024(++_0x4ec5c5);}(_0xf180,0xfe));var _0x0f18=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xf180[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x0f18('0x0'));var util=require(_0x0f18('0x1'));var moment=require(_0x0f18('0x2'));var BPromise=require(_0x0f18('0x3'));var rs=require(_0x0f18('0x4'));var fs=require('fs');var Redis=require(_0x0f18('0x5'));var db=require(_0x0f18('0x6'))['db'];var utils=require(_0x0f18('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x0f18('0x8'));var jayson=require(_0x0f18('0x9'));var client=jayson[_0x0f18('0xa')][_0x0f18('0xb')]({'port':0x232a});config[_0x0f18('0xc')]=_['defaults'](config[_0x0f18('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x0f18('0xd'))(new Redis(config['redis']));require(_0x0f18('0xe'))[_0x0f18('0xf')](socket);function respondWithRpcPromise(_0x3216e3,_0x1b1c15,_0x44a1b6){return new BPromise(function(_0x1fee2d,_0x4e68a6){return client['request'](_0x3216e3,_0x44a1b6)[_0x0f18('0x10')](function(_0x4ecbdc){logger['info']('Plugin,\x20%s,\x20%s',_0x1b1c15,_0x0f18('0x11'));logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x1b1c15,_0x0f18('0x11'),JSON['stringify'](_0x4ecbdc));if(_0x4ecbdc[_0x0f18('0x12')]){if(_0x4ecbdc['error']['code']===0x1f4){logger[_0x0f18('0x12')](_0x0f18('0x13'),_0x1b1c15,_0x4ecbdc[_0x0f18('0x12')][_0x0f18('0x14')]);return _0x4e68a6(_0x4ecbdc[_0x0f18('0x12')]['message']);}logger[_0x0f18('0x12')]('Plugin,\x20%s,\x20%s',_0x1b1c15,_0x4ecbdc['error'][_0x0f18('0x14')]);return _0x1fee2d(_0x4ecbdc[_0x0f18('0x12')][_0x0f18('0x14')]);}else{logger[_0x0f18('0x15')]('Plugin,\x20%s,\x20%s',_0x1b1c15,_0x0f18('0x11'));_0x1fee2d(_0x4ecbdc[_0x0f18('0x16')][_0x0f18('0x14')]);}})['catch'](function(_0x3afe3d){logger['error'](_0x0f18('0x13'),_0x1b1c15,_0x3afe3d);_0x4e68a6(_0x3afe3d);});});}exports['CreatePlugin']=function(_0x442bfa){var _0x5e1051=this;return new Promise(function(_0x5ae31d,_0x4629de){return db[_0x0f18('0x17')][_0x0f18('0x18')](_0x442bfa[_0x0f18('0x19')],{'raw':_0x442bfa[_0x0f18('0x1a')]?_0x442bfa[_0x0f18('0x1a')][_0x0f18('0x1b')]===undefined?!![]:![]:!![]})[_0x0f18('0x10')](function(_0x35653d){logger[_0x0f18('0x15')](_0x0f18('0x1c'),_0x442bfa);logger[_0x0f18('0x1d')]('CreatePlugin',_0x442bfa,JSON['stringify'](_0x35653d));_0x5ae31d(_0x35653d);})[_0x0f18('0x1e')](function(_0x44bfd4){logger['error']('CreatePlugin',_0x44bfd4['message'],_0x442bfa);_0x4629de(_0x5e1051[_0x0f18('0x12')](0x1f4,_0x44bfd4['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 12457b7..f791cbd 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 _0xcd62=['removeListener','register','length','plugin:','./plugin.events','save','update','emit'];(function(_0x36235c,_0x8b8179){var _0x211e1b=function(_0x2bd8ad){while(--_0x2bd8ad){_0x36235c['push'](_0x36235c['shift']());}};_0x211e1b(++_0x8b8179);}(_0xcd62,0xac));var _0x2cd6=function(_0x47e0c4,_0x3c51f5){_0x47e0c4=_0x47e0c4-0x0;var _0x2b2608=_0xcd62[_0x47e0c4];return _0x2b2608;};'use strict';var PluginEvents=require(_0x2cd6('0x0'));var events=[_0x2cd6('0x1'),'remove',_0x2cd6('0x2')];function createListener(_0x3ae3b1,_0x3a4a2b){return function(_0x5eb766){_0x3a4a2b[_0x2cd6('0x3')](_0x3ae3b1,_0x5eb766);};}function removeListener(_0x378b71,_0x1183a6){return function(){PluginEvents[_0x2cd6('0x4')](_0x378b71,_0x1183a6);};}exports[_0x2cd6('0x5')]=function(_0x1e9bcb){for(var _0x5179d7=0x0,_0x34fae6=events[_0x2cd6('0x6')];_0x5179d7<_0x34fae6;_0x5179d7++){var _0x5362ed=events[_0x5179d7];var _0x5ce8db=createListener(_0x2cd6('0x7')+_0x5362ed,_0x1e9bcb);PluginEvents['on'](_0x5362ed,_0x5ce8db);}}; \ No newline at end of file +var _0xc3d1=['emit','register','length','./plugin.events','save','update'];(function(_0xffb9d8,_0x4c3c9a){var _0x41b2f6=function(_0x4dffef){while(--_0x4dffef){_0xffb9d8['push'](_0xffb9d8['shift']());}};_0x41b2f6(++_0x4c3c9a);}(_0xc3d1,0xed));var _0x1c3d=function(_0x3dfed5,_0x2d800a){_0x3dfed5=_0x3dfed5-0x0;var _0x1266f0=_0xc3d1[_0x3dfed5];return _0x1266f0;};'use strict';var PluginEvents=require(_0x1c3d('0x0'));var events=[_0x1c3d('0x1'),'remove',_0x1c3d('0x2')];function createListener(_0x5bc3fe,_0x182a4a){return function(_0x21598f){_0x182a4a[_0x1c3d('0x3')](_0x5bc3fe,_0x21598f);};}function removeListener(_0x190105,_0xaafc76){return function(){PluginEvents['removeListener'](_0x190105,_0xaafc76);};}exports[_0x1c3d('0x4')]=function(_0x2b39a2){for(var _0x2367da=0x0,_0xc95b6=events[_0x1c3d('0x5')];_0x2367da<_0xc95b6;_0x2367da++){var _0x4b7d8c=events[_0x2367da];var _0x48ebb5=createListener('plugin:'+_0x4b7d8c,_0x2b39a2);PluginEvents['on'](_0x4b7d8c,_0x48ebb5);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index b0e87a8..1c688a3 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(_0xcacff5,_0x49c74c){var _0x5dfd42=function(_0x530bfe){while(--_0x530bfe){_0xcacff5['push'](_0xcacff5['shift']());}};_0x5dfd42(++_0x49c74c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x97d527,_0x198ff0){var _0x502ae0=function(_0x4e78fe){while(--_0x4e78fe){_0x97d527['push'](_0x97d527['shift']());}};_0x502ae0(++_0x198ff0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 796ca9d..4a6820f 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 _0xf290=['reject','express','length','catch','show','params','create','body','script','join','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','stop','hasOwnProperty','Unknown\x20id','../../config/pm2','api','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','info','index','list','then'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0xf290,0xde));var _0x0f29=function(_0x4996d5,_0x123daf){_0x4996d5=_0x4996d5-0x0;var _0x4793f9=_0xf290[_0x4996d5];return _0x4793f9;};'use strict';var _=require('lodash');var pm2=require(_0x0f29('0x0'));var logger=require('../../config/logger')(_0x0f29('0x1'));var path=require('path');var exec=require(_0x0f29('0x2'))[_0x0f29('0x3')];var BPromise=require(_0x0f29('0x4'));function handleEntityNotFound(_0x28b644,_0xfdab92){return function(_0x5984ba){if(!_0x5984ba){_0x28b644[_0x0f29('0x5')](0x194);;}return _0x5984ba;};}function respondWithResult(_0x4911fb,_0x2d5350){_0x2d5350=_0x2d5350||0xc8;return function(_0x1c45ec){if(_0x1c45ec){return _0x4911fb[_0x0f29('0x6')](_0x2d5350)[_0x0f29('0x7')](_0x1c45ec);}return null;};}function handleError(_0xc78ca2,_0x45350b){_0x45350b=_0x45350b||0x1f4;return function(_0x2be26e){logger[_0x0f29('0x8')](_0x2be26e[_0x0f29('0x9')]);if(_0x2be26e[_0x0f29('0xa')]){delete _0x2be26e[_0x0f29('0xa')];}_0xc78ca2[_0x0f29('0x6')](_0x45350b)[_0x0f29('0xb')](_0x2be26e);};}function execChildProcess(){return new BPromise(function(_0xbcdea8,_0x5cc052){exec('npm\x20install',function(_0x38eb8f,_0x5f4796,_0xc11f21){logger[_0x0f29('0xc')](_0x5f4796);logger[_0x0f29('0xc')](_0xc11f21);if(_0x38eb8f){logger[_0x0f29('0x8')](_0x38eb8f);return _0x5cc052(_0x38eb8f);}return _0xbcdea8(_0x5f4796);});});}exports[_0x0f29('0xd')]=function(_0x2d2573,_0x5519cf){return pm2[_0x0f29('0xe')]()[_0x0f29('0xf')](function(_0x2bb7b8){if(_0x2bb7b8){var _0x368984=_[_0x0f29('0x10')](_0x2bb7b8,function(_0x2ed9c5){return _0x2ed9c5[_0x0f29('0xa')]===_0x0f29('0x11')||_0x2ed9c5['name']==='motion2';});return{'rows':_0x368984,'count':_0x368984[_0x0f29('0x12')]};}return null;})[_0x0f29('0xf')](respondWithResult(_0x5519cf,null))[_0x0f29('0x13')](handleError(_0x5519cf,null));};exports[_0x0f29('0x14')]=function(_0x4b3f0b,_0x122bfa){return pm2['describe'](_0x4b3f0b[_0x0f29('0x15')]['id'])['then'](respondWithResult(_0x122bfa,null))['then'](handleEntityNotFound(_0x122bfa,null))['catch'](handleError(_0x122bfa,null));};exports[_0x0f29('0x16')]=function(_0x8fc03f,_0x13e8ff){if(_0x8fc03f[_0x0f29('0x17')][_0x0f29('0xa')]&&_0x8fc03f[_0x0f29('0x17')][_0x0f29('0x18')]){var _0x4888b6=path[_0x0f29('0x19')](__dirname,'../../files/plugins',_0x8fc03f['body']['script']);var _0x5d94b9=process[_0x0f29('0x1a')]();process[_0x0f29('0x1b')](path['dirname'](_0x4888b6));return execChildProcess()[_0x0f29('0xf')](function(_0x1840e0){process[_0x0f29('0x1b')](_0x5d94b9);return pm2[_0x0f29('0x1c')]({'name':_0x8fc03f[_0x0f29('0x17')]['name'],'script':_0x4888b6});})[_0x0f29('0xf')](function(_0x5a440f){pm2[_0x0f29('0x1d')]();return _0x5a440f[0x0];})[_0x0f29('0xf')](respondWithResult(_0x13e8ff,0xc9))[_0x0f29('0x13')](handleError(_0x13e8ff,null));}else{return _0x13e8ff[_0x0f29('0x6')](0x1f4)['send']({'message':_0x0f29('0x1e')});}};exports['update']=function(_0x58b201,_0x92876){if(_0x58b201['body']['id']){delete _0x58b201['body']['id'];}var _0x57dcc7={'online':'restart','stopped':_0x0f29('0x1f')};if(_0x57dcc7[_0x0f29('0x20')](_0x58b201['body'][_0x0f29('0x6')])){return pm2[_0x57dcc7[_0x58b201[_0x0f29('0x17')][_0x0f29('0x6')]]](_0x58b201['params']['id'])['then'](respondWithResult(_0x92876,0xc8))[_0x0f29('0x13')](handleError(_0x92876,null));}else{return _0x92876['status'](0x1f4)[_0x0f29('0xb')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x7b10f,_0x409b19){if(_0x7b10f[_0x0f29('0x17')]['id']){delete _0x7b10f[_0x0f29('0x17')]['id'];}if(_0x7b10f['params']['id']){return pm2['delete'](_0x7b10f[_0x0f29('0x15')]['id'])['then'](function(_0x4a4cf2){pm2[_0x0f29('0x1d')]();return _0x4a4cf2[0x0];})['then'](respondWithResult(_0x409b19,null))[_0x0f29('0x13')](handleError(_0x409b19,null));}else{return _0x409b19['status'](0x1f4)['send']({'message':_0x0f29('0x21')});}}; \ No newline at end of file +var _0xcb91=['describe','create','body','../../files/plugins','cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','Unknown\x20id','../../config/logger','api','path','child_process','bluebird','sendStatus','json','name','status','send','npm\x20install','info','list','then','reject','express','length','catch','show'];(function(_0x24332e,_0x2a22b7){var _0xa1616=function(_0x17867f){while(--_0x17867f){_0x24332e['push'](_0x24332e['shift']());}};_0xa1616(++_0x2a22b7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0xcb91[_0x5eaa0b];return _0x28b295;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var path=require(_0x1cb9('0x2'));var exec=require(_0x1cb9('0x3'))['exec'];var BPromise=require(_0x1cb9('0x4'));function handleEntityNotFound(_0x2c17b8,_0x545a34){return function(_0x13d5fd){if(!_0x13d5fd){_0x2c17b8[_0x1cb9('0x5')](0x194);;}return _0x13d5fd;};}function respondWithResult(_0x53ffbd,_0x226b69){_0x226b69=_0x226b69||0xc8;return function(_0x3f7deb){if(_0x3f7deb){return _0x53ffbd['status'](_0x226b69)[_0x1cb9('0x6')](_0x3f7deb);}return null;};}function handleError(_0x12567c,_0x59d1be){_0x59d1be=_0x59d1be||0x1f4;return function(_0x3ae0f1){logger['error'](_0x3ae0f1['stack']);if(_0x3ae0f1[_0x1cb9('0x7')]){delete _0x3ae0f1[_0x1cb9('0x7')];}_0x12567c[_0x1cb9('0x8')](_0x59d1be)[_0x1cb9('0x9')](_0x3ae0f1);};}function execChildProcess(){return new BPromise(function(_0x2fc627,_0x50ce71){exec(_0x1cb9('0xa'),function(_0x44a6b4,_0x3af35f,_0x3fdd83){logger[_0x1cb9('0xb')](_0x3af35f);logger['info'](_0x3fdd83);if(_0x44a6b4){logger['error'](_0x44a6b4);return _0x50ce71(_0x44a6b4);}return _0x2fc627(_0x3af35f);});});}exports['index']=function(_0x358866,_0x282bc6){return pm2[_0x1cb9('0xc')]()[_0x1cb9('0xd')](function(_0x56884d){if(_0x56884d){var _0x397727=_[_0x1cb9('0xe')](_0x56884d,function(_0x1b3cd7){return _0x1b3cd7[_0x1cb9('0x7')]===_0x1cb9('0xf')||_0x1b3cd7['name']==='motion2';});return{'rows':_0x397727,'count':_0x397727[_0x1cb9('0x10')]};}return null;})[_0x1cb9('0xd')](respondWithResult(_0x282bc6,null))[_0x1cb9('0x11')](handleError(_0x282bc6,null));};exports[_0x1cb9('0x12')]=function(_0x3e21e0,_0xf22920){return pm2[_0x1cb9('0x13')](_0x3e21e0['params']['id'])['then'](respondWithResult(_0xf22920,null))[_0x1cb9('0xd')](handleEntityNotFound(_0xf22920,null))[_0x1cb9('0x11')](handleError(_0xf22920,null));};exports[_0x1cb9('0x14')]=function(_0x31481a,_0x280a84){if(_0x31481a[_0x1cb9('0x15')][_0x1cb9('0x7')]&&_0x31481a['body']['script']){var _0x1a5a72=path['join'](__dirname,_0x1cb9('0x16'),_0x31481a[_0x1cb9('0x15')]['script']);var _0x599275=process[_0x1cb9('0x17')]();process[_0x1cb9('0x18')](path[_0x1cb9('0x19')](_0x1a5a72));return execChildProcess()[_0x1cb9('0xd')](function(_0x45b8d3){process[_0x1cb9('0x18')](_0x599275);return pm2['start']({'name':_0x31481a['body'][_0x1cb9('0x7')],'script':_0x1a5a72});})['then'](function(_0x10a419){pm2[_0x1cb9('0x1a')]();return _0x10a419[0x0];})[_0x1cb9('0xd')](respondWithResult(_0x280a84,0xc9))[_0x1cb9('0x11')](handleError(_0x280a84,null));}else{return _0x280a84[_0x1cb9('0x8')](0x1f4)['send']({'message':_0x1cb9('0x1b')});}};exports[_0x1cb9('0x1c')]=function(_0x4c8d76,_0xd6891c){if(_0x4c8d76[_0x1cb9('0x15')]['id']){delete _0x4c8d76[_0x1cb9('0x15')]['id'];}var _0x1804fd={'online':_0x1cb9('0x1d'),'stopped':_0x1cb9('0x1e')};if(_0x1804fd[_0x1cb9('0x1f')](_0x4c8d76[_0x1cb9('0x15')][_0x1cb9('0x8')])){return pm2[_0x1804fd[_0x4c8d76[_0x1cb9('0x15')]['status']]](_0x4c8d76[_0x1cb9('0x20')]['id'])['then'](respondWithResult(_0xd6891c,0xc8))[_0x1cb9('0x11')](handleError(_0xd6891c,null));}else{return _0xd6891c['status'](0x1f4)[_0x1cb9('0x9')]({'message':_0x1cb9('0x21')});}};exports[_0x1cb9('0x22')]=function(_0x2038aa,_0x561d89){if(_0x2038aa[_0x1cb9('0x15')]['id']){delete _0x2038aa['body']['id'];}if(_0x2038aa[_0x1cb9('0x20')]['id']){return pm2[_0x1cb9('0x23')](_0x2038aa[_0x1cb9('0x20')]['id'])['then'](function(_0xae4c7a){pm2['dump']();return _0xae4c7a[0x0];})[_0x1cb9('0xd')](respondWithResult(_0x561d89,null))['catch'](handleError(_0x561d89,null));}else{return _0x561d89[_0x1cb9('0x8')](0x1f4)[_0x1cb9('0x9')]({'message':_0x1cb9('0x24')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 17a3371..554988c 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 _0x9213=['isAuthenticated','exports','express','Router','../../components/auth/service','./realtime.controller','/agents','getAgents','get','/queues'];(function(_0x2267ae,_0x513706){var _0x34cb2e=function(_0x2b502a){while(--_0x2b502a){_0x2267ae['push'](_0x2267ae['shift']());}};_0x34cb2e(++_0x513706);}(_0x9213,0x160));var _0x3921=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9213[_0x5f09c5];return _0x426ad9;};'use strict';var express=require(_0x3921('0x0'));var router=express[_0x3921('0x1')]();var auth=require(_0x3921('0x2'));var controller=require(_0x3921('0x3'));router['get'](_0x3921('0x4'),auth['isAuthenticated'](),controller[_0x3921('0x5')]);router[_0x3921('0x6')](_0x3921('0x7'),auth[_0x3921('0x8')](),controller['getQueues']);module[_0x3921('0x9')]=router; \ No newline at end of file +var _0x975f=['exports','express','Router','../../components/auth/service','./realtime.controller','get','/agents','getAgents','/queues','isAuthenticated','getQueues'];(function(_0x3048ea,_0x3838c2){var _0x1a13c4=function(_0x2c6a6b){while(--_0x2c6a6b){_0x3048ea['push'](_0x3048ea['shift']());}};_0x1a13c4(++_0x3838c2);}(_0x975f,0x109));var _0xf975=function(_0x4704dc,_0x575a5f){_0x4704dc=_0x4704dc-0x0;var _0x254d81=_0x975f[_0x4704dc];return _0x254d81;};'use strict';var express=require(_0xf975('0x0'));var router=express[_0xf975('0x1')]();var auth=require(_0xf975('0x2'));var controller=require(_0xf975('0x3'));router[_0xf975('0x4')](_0xf975('0x5'),auth['isAuthenticated'](),controller[_0xf975('0x6')]);router['get'](_0xf975('0x7'),auth[_0xf975('0x8')](),controller[_0xf975('0x9')]);module[_0xf975('0xa')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 2fa4222..814b143 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 _0x3392=['assign','UserProfile','getResources','User','count','map','find','filterAgentAttributes','merge','includes','Status','sortAgentsByStatus','catch','getQueues','format','startCase','name','voice','dialActive','dialMethod','join','QueueCampaigns','Queues','filter','findAndCountAll','getRealtimeQueues','initializeQueues','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../mysqldb','../../errors/api','APIBadRequestError','handleError','undefined','offset','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pause','*pause','resolve','then','channel','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','globalStatus','getUpdatedSortOptions','fields','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','fieldName','type','key','role','agent','online','getOptions','sequelize','literal','FIELD(id,','forEach','Pause','push','where','user','extraQueryConditions'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3392,0xb7));var _0x2339=function(_0x1d8a54,_0x234148){_0x1d8a54=_0x1d8a54-0x0;var _0x19595b=_0x3392[_0x1d8a54];return _0x19595b;};'use strict';var _=require('lodash');var util=require(_0x2339('0x0'));var rta=require(_0x2339('0x1'));var rtq=require(_0x2339('0x2'));var qs=require(_0x2339('0x3'));var utils=require('../../config/utils');var db=require(_0x2339('0x4'))['db'];var APIBadRequestError=require(_0x2339('0x5'))[_0x2339('0x6')];var APIHandleError=require(_0x2339('0x5'))[_0x2339('0x7')];function respondWithFilteredResult(_0x37baf9,_0x111d8c){return function(_0x57502c){if(_0x57502c){var _0x1c6ccf=typeof _0x111d8c['offset']===_0x2339('0x8')&&typeof _0x111d8c['limit']==='undefined';var _0x584fe0=_0x57502c['count'];var _0x49bf5e=_0x1c6ccf?0x0:_0x111d8c[_0x2339('0x9')];var _0x5b65ad=_0x1c6ccf?_0x57502c['count']:_0x111d8c[_0x2339('0x9')]+_0x111d8c['limit'];var _0x496254;if(_0x5b65ad>=_0x584fe0){_0x5b65ad=_0x584fe0;_0x496254=0xc8;}else{_0x496254=0xce;}_0x37baf9['status'](_0x496254);return _0x37baf9[_0x2339('0xa')](_0x2339('0xb'),_0x49bf5e+'-'+_0x5b65ad+'/'+_0x584fe0)[_0x2339('0xc')](_0x57502c);}return null;};}exports[_0x2339('0xd')]=function(_0x42a82b,_0x594193){var _0xa0cc47={'count':0x0,'rows':[]};var _0x18db0e={};var _0x2c383a;var _0xc56cf5=utils[_0x2339('0xe')]();var _0x4eb11c;var _0x28c0c0;var _0x1a2076=_0x42a82b[_0x2339('0xf')][_0x2339('0x10')];var _0x40afc2=_0x42a82b[_0x2339('0xf')][_0x2339('0x11')];var _0x33d854=_0x42a82b[_0x2339('0xf')]['pauseTypeFilter'];var _0x323d84=_0x40afc2===_0x2339('0x12')||_0x40afc2===_0x2339('0x13')?!![]:![];var _0x1c46db=[];var _0x2803fd;var _0x4441e3;Promise[_0x2339('0x14')]()[_0x2339('0x15')](function(){if(_0x42a82b[_0x2339('0xf')][_0x2339('0x16')]){if(!utils['isValidChannel'](_0x42a82b[_0x2339('0xf')]['channel'])){throw new APIBadRequestError(util['format'](_0x2339('0x17'),_0x42a82b[_0x2339('0xf')][_0x2339('0x16')]));}_0x2c383a=_0x42a82b[_0x2339('0xf')][_0x2339('0x16')][_0x2339('0x18')]();}if(!_0x42a82b['query']['sort']||!_0x42a82b[_0x2339('0xf')][_0x2339('0x19')]['includes'](_0x2339('0x1a'))){_0x42a82b[_0x2339('0xf')][_0x2339('0x19')]=rta['validateSortParameter'](_0x42a82b['query'][_0x2339('0x19')]);return;}var _0x4923e1=rta[_0x2339('0x1b')](_0x42a82b[_0x2339('0xf')][_0x2339('0x19')]);_0x42a82b[_0x2339('0xf')][_0x2339('0x19')]=_0x4923e1[_0x2339('0x1c')]['join'](',');_0x2803fd=_0x4923e1['order'];})[_0x2339('0x15')](function(){if(!_0x1a2076){return[];}return rta[_0x2339('0x1d')](_0x1a2076,_0x2c383a);})[_0x2339('0x15')](function(_0xa1661b){_0x1c46db=_0xa1661b;return rta[_0x2339('0x1e')]();})[_0x2339('0x15')](function(_0x19f1b8){_0x28c0c0=_0x19f1b8[_0x2339('0x1f')];if((!_0x40afc2||_0x323d84)&&!_0x2803fd){return _0x1c46db;}if(_0x2803fd&&!_0x40afc2){return rta[_0x2339('0x20')](_0x28c0c0,_0x1c46db,_0x2803fd);}else{return rta[_0x2339('0x21')](_0x28c0c0,_0x1c46db,_0x40afc2);}})[_0x2339('0x15')](function(_0x364074){_0x1c46db=_0x364074;var _0x46edb2=![];if(_0x1c46db[_0x2339('0x22')]===0x0){if(_0x1a2076||_0x40afc2){_0x46edb2=!![];}if(_0x323d84){_0x46edb2=![];}}if(_0x46edb2){return _0xa0cc47;}var _0x369106=_['map'](db['User']['rawAttributes'],function(_0xb20cac){return{'name':_0xb20cac[_0x2339('0x23')],'type':_0xb20cac[_0x2339('0x24')][_0x2339('0x25')]};});_0x42a82b[_0x2339('0xf')][_0x2339('0x26')]=_0x2339('0x27');_0x42a82b[_0x2339('0xf')][_0x2339('0x28')]=!![];_0x18db0e=qs[_0x2339('0x29')](_0x369106,_0x42a82b);_0x18db0e['raw']=!![];var _0x384d26=[];if(_0x1c46db[_0x2339('0x22')]>0x0){_0x384d26['push']({'id':{'$in':_0x1c46db}});if(_0x2803fd&&!_0x40afc2){_0x4441e3=[db[_0x2339('0x2a')][_0x2339('0x2b')](_0x2339('0x2c')+_0x1c46db+')')];_0x18db0e['order']=_0x4441e3;}}if(_0x323d84){_0xc56cf5[_0x2339('0x2d')](function(_0x15283e){var _0x185eed=!![];if(_0x40afc2===_0x2339('0x13')&&_0x2c383a!==_0x15283e){_0x185eed=![];}_0x384d26['push']({[_0x15283e+_0x2339('0x2e')]:_0x185eed});});if(_0x33d854){_0x384d26['push']({'pauseType':_0x33d854});}}else if(_0x40afc2){_0xc56cf5[_0x2339('0x2d')](function(_0x23bb1f){_0x384d26[_0x2339('0x2f')]({[_0x23bb1f+_0x2339('0x2e')]:![]});});}_0x18db0e[_0x2339('0x30')]=_['merge'](_0x18db0e['where'],{'$and':_0x384d26});if(_0x42a82b[_0x2339('0x31')][_0x2339('0x26')]==='user'){var _0x5aa97b={'params':{'id':_0x42a82b['user']['userProfileId']},'query':{'section':'Agents','role':_0x2339('0x27'),'online':!![],'raw':!![],'ids':_0x1c46db,'customSorting':_0x4441e3}};if(_0x323d84){_0x5aa97b[_0x2339('0xf')][_0x2339('0x32')]=_0x384d26;}_0x5aa97b[_0x2339('0xf')]=Object[_0x2339('0x33')](_0x5aa97b[_0x2339('0xf')],_0x42a82b[_0x2339('0xf')]);delete _0x5aa97b[_0x2339('0xf')]['id'];return db[_0x2339('0x34')][_0x2339('0x35')](_0x5aa97b);}return db[_0x2339('0x36')]['findAndCountAll'](_0x18db0e);})[_0x2339('0x15')](function(_0x54d061){_0xa0cc47[_0x2339('0x37')]=_0x54d061[_0x2339('0x37')];_0x4eb11c=_0x54d061[_0x2339('0x1f')];return _0x4eb11c[_0x2339('0x38')](function(_0x525d93){var _0x3a85e7=_[_0x2339('0x39')](_0x28c0c0,['id',_0x525d93['id']]);if(_0x3a85e7){var _0x5e9ea8=rta[_0x2339('0x3a')](_0x3a85e7);_[_0x2339('0x3b')](_0x525d93,_0x5e9ea8);}_0x525d93[_0x2339('0x1a')]=rta['getAgentStatus'](_0x525d93);if(_0x525d93[_0x2339('0x1a')][_0x2339('0x3c')](_0x2339('0x12'))){_0xc56cf5[_0x2339('0x2d')](function(_0x4c53e3){if(_0x525d93[_0x4c53e3+_0x2339('0x2e')]){_0x525d93[_0x4c53e3+_0x2339('0x3d')]=_0x2339('0x12');}});}return _0x525d93;});})[_0x2339('0x15')](function(_0x15c1ef){if(!_0x2803fd||_0x4441e3){return _0x15c1ef;}return rta[_0x2339('0x3e')](_0x15c1ef,_0x2803fd);})[_0x2339('0x15')](function(_0x45c571){_0xa0cc47[_0x2339('0x1f')]=_0x45c571;return _0xa0cc47;})[_0x2339('0x15')](respondWithFilteredResult(_0x594193,_0x18db0e))[_0x2339('0x3f')](APIHandleError(_0x594193));};exports[_0x2339('0x40')]=function(_0x332ffe,_0x428ba0){var _0x367edd={'count':0x0,'rows':[]};var _0x164135={};var _0x216543;var _0x137171;var _0x12eed6;Promise[_0x2339('0x14')]()['then'](function(){if(_0x332ffe[_0x2339('0xf')][_0x2339('0x16')]){if(!utils['isValidChannel'](_0x332ffe[_0x2339('0xf')][_0x2339('0x16')])){throw new APIBadRequestError(util[_0x2339('0x41')](_0x2339('0x17'),_0x332ffe[_0x2339('0xf')][_0x2339('0x16')]));}_0x216543=_0x332ffe[_0x2339('0xf')][_0x2339('0x16')][_0x2339('0x18')]();}var _0xbe326=_[_0x2339('0x42')](_0x216543)+'Queue';var _0x3e6659=_['map'](db[_0xbe326]['rawAttributes'],function(_0x2da7c4){return{'name':_0x2da7c4[_0x2339('0x23')],'type':_0x2da7c4[_0x2339('0x24')][_0x2339('0x25')]};});if(!_0x332ffe[_0x2339('0xf')][_0x2339('0x1c')]){var _0x57d206=['id',_0x2339('0x43')];if(_0x216543===_0x2339('0x44')){_0x57d206[_0x2339('0x2f')](_0x2339('0x24'));if(_0x332ffe[_0x2339('0xf')][_0x2339('0x24')]==='outbound'){_0x57d206[_0x2339('0x2f')]([_0x2339('0x45'),_0x2339('0x46')]);}}_0x332ffe['query'][_0x2339('0x1c')]=_0x57d206[_0x2339('0x47')](',');}_0x164135=qs[_0x2339('0x29')](_0x3e6659,_0x332ffe);if(_0x332ffe[_0x2339('0x31')][_0x2339('0x26')]===_0x2339('0x31')){var _0x463c46={'params':{'id':_0x332ffe[_0x2339('0x31')]['userProfileId']},'query':{'section':_0x216543==='voice'&&_0x332ffe[_0x2339('0xf')][_0x2339('0x24')]==='outbound'?_0x2339('0x48'):_['startCase'](_0x216543)+_0x2339('0x49'),'type':_0x332ffe[_0x2339('0xf')][_0x2339('0x24')],'nolimit':!![],'sort':_0x2339('0x43'),'filter':_0x332ffe[_0x2339('0xf')][_0x2339('0x4a')]}};return db[_0x2339('0x34')][_0x2339('0x35')](_0x463c46);}return db[_0xbe326][_0x2339('0x4b')](_0x164135);})[_0x2339('0x15')](function(_0x22ca20){_0x367edd[_0x2339('0x37')]=_0x22ca20[_0x2339('0x37')];_0x137171=_0x22ca20[_0x2339('0x1f')];return rtq[_0x2339('0x4c')](_0x332ffe,_0x216543);})[_0x2339('0x15')](function(_0x1a4414){_0x12eed6=_0x1a4414[_0x2339('0x1f')];return rtq[_0x2339('0x4d')](_0x137171,_0x12eed6,_0x216543,_0x332ffe[_0x2339('0xf')][_0x2339('0x24')]);})[_0x2339('0x15')](function(_0x1b20a0){_0x367edd[_0x2339('0x1f')]=_0x1b20a0;return _0x367edd;})[_0x2339('0x15')](respondWithFilteredResult(_0x428ba0,_0x164135))[_0x2339('0x3f')](APIHandleError(_0x428ba0));}; \ No newline at end of file +var _0x2409=['getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','User','rawAttributes','fieldName','type','agent','online','getOptions','raw','length','push','sequelize','literal','FIELD(id,','forEach','Pause','where','merge','user','role','userProfileId','Agents','extraQueryConditions','assign','getResources','findAndCountAll','map','filterAgentAttributes','getAgentStatus','Status','sortAgentsByStatus','catch','getQueues','resolve','startCase','Queue','key','name','outbound','dialActive','dialMethod','voice','QueueCampaigns','Queues','filter','UserProfile','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','count','status','Content-Range','getAgents','query','globalStatusFilter','pauseTypeFilter','pause','*pause','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','fields','join','order','then'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x2409,0x1d6));var _0x9240=function(_0x3168d9,_0x2d270f){_0x3168d9=_0x3168d9-0x0;var _0x79eefa=_0x2409[_0x3168d9];return _0x79eefa;};'use strict';var _=require(_0x9240('0x0'));var util=require(_0x9240('0x1'));var rta=require(_0x9240('0x2'));var rtq=require(_0x9240('0x3'));var qs=require(_0x9240('0x4'));var utils=require(_0x9240('0x5'));var db=require(_0x9240('0x6'))['db'];var APIBadRequestError=require(_0x9240('0x7'))[_0x9240('0x8')];var APIHandleError=require(_0x9240('0x7'))[_0x9240('0x9')];function respondWithFilteredResult(_0x532bc4,_0x55d2fc){return function(_0x15d044){if(_0x15d044){var _0x726f8=typeof _0x55d2fc[_0x9240('0xa')]===_0x9240('0xb')&&typeof _0x55d2fc[_0x9240('0xc')]===_0x9240('0xb');var _0x5ef2ef=_0x15d044[_0x9240('0xd')];var _0x503ee0=_0x726f8?0x0:_0x55d2fc[_0x9240('0xa')];var _0x92cdf5=_0x726f8?_0x15d044[_0x9240('0xd')]:_0x55d2fc[_0x9240('0xa')]+_0x55d2fc[_0x9240('0xc')];var _0x5a9f03;if(_0x92cdf5>=_0x5ef2ef){_0x92cdf5=_0x5ef2ef;_0x5a9f03=0xc8;}else{_0x5a9f03=0xce;}_0x532bc4[_0x9240('0xe')](_0x5a9f03);return _0x532bc4['set'](_0x9240('0xf'),_0x503ee0+'-'+_0x92cdf5+'/'+_0x5ef2ef)['json'](_0x15d044);}return null;};}exports[_0x9240('0x10')]=function(_0x48de8e,_0x333f7c){var _0x530ef8={'count':0x0,'rows':[]};var _0x36a812={};var _0x3d9881;var _0x2b0100=utils['getChannels']();var _0x261d01;var _0x5aca04;var _0x63c80e=_0x48de8e[_0x9240('0x11')]['globalQueueFilter'];var _0x46dec8=_0x48de8e[_0x9240('0x11')][_0x9240('0x12')];var _0x1e71bf=_0x48de8e[_0x9240('0x11')][_0x9240('0x13')];var _0x565b77=_0x46dec8===_0x9240('0x14')||_0x46dec8===_0x9240('0x15')?!![]:![];var _0x5c6d7c=[];var _0xd7f3eb;var _0x2454c3;Promise['resolve']()['then'](function(){if(_0x48de8e['query'][_0x9240('0x16')]){if(!utils['isValidChannel'](_0x48de8e[_0x9240('0x11')][_0x9240('0x16')])){throw new APIBadRequestError(util[_0x9240('0x17')](_0x9240('0x18'),_0x48de8e[_0x9240('0x11')]['channel']));}_0x3d9881=_0x48de8e[_0x9240('0x11')][_0x9240('0x16')][_0x9240('0x19')]();}if(!_0x48de8e[_0x9240('0x11')][_0x9240('0x1a')]||!_0x48de8e[_0x9240('0x11')][_0x9240('0x1a')][_0x9240('0x1b')](_0x9240('0x1c'))){_0x48de8e[_0x9240('0x11')][_0x9240('0x1a')]=rta[_0x9240('0x1d')](_0x48de8e[_0x9240('0x11')]['sort']);return;}var _0x299ef6=rta['getUpdatedSortOptions'](_0x48de8e[_0x9240('0x11')]['sort']);_0x48de8e[_0x9240('0x11')][_0x9240('0x1a')]=_0x299ef6[_0x9240('0x1e')][_0x9240('0x1f')](',');_0xd7f3eb=_0x299ef6[_0x9240('0x20')];})[_0x9240('0x21')](function(){if(!_0x63c80e){return[];}return rta[_0x9240('0x22')](_0x63c80e,_0x3d9881);})['then'](function(_0x41fa00){_0x5c6d7c=_0x41fa00;return rta['getRealtimeAgents']();})['then'](function(_0x2417e9){_0x5aca04=_0x2417e9[_0x9240('0x23')];if((!_0x46dec8||_0x565b77)&&!_0xd7f3eb){return _0x5c6d7c;}if(_0xd7f3eb&&!_0x46dec8){return rta[_0x9240('0x24')](_0x5aca04,_0x5c6d7c,_0xd7f3eb);}else{return rta[_0x9240('0x25')](_0x5aca04,_0x5c6d7c,_0x46dec8);}})[_0x9240('0x21')](function(_0x2287c8){_0x5c6d7c=_0x2287c8;var _0x5279cc=![];if(_0x5c6d7c['length']===0x0){if(_0x63c80e||_0x46dec8){_0x5279cc=!![];}if(_0x565b77){_0x5279cc=![];}}if(_0x5279cc){return _0x530ef8;}var _0x424057=_['map'](db[_0x9240('0x26')][_0x9240('0x27')],function(_0x47b390){return{'name':_0x47b390[_0x9240('0x28')],'type':_0x47b390[_0x9240('0x29')]['key']};});_0x48de8e['query']['role']=_0x9240('0x2a');_0x48de8e[_0x9240('0x11')][_0x9240('0x2b')]=!![];_0x36a812=qs[_0x9240('0x2c')](_0x424057,_0x48de8e);_0x36a812[_0x9240('0x2d')]=!![];var _0x398048=[];if(_0x5c6d7c[_0x9240('0x2e')]>0x0){_0x398048[_0x9240('0x2f')]({'id':{'$in':_0x5c6d7c}});if(_0xd7f3eb&&!_0x46dec8){_0x2454c3=[db[_0x9240('0x30')][_0x9240('0x31')](_0x9240('0x32')+_0x5c6d7c+')')];_0x36a812[_0x9240('0x20')]=_0x2454c3;}}if(_0x565b77){_0x2b0100[_0x9240('0x33')](function(_0x361e1a){var _0x2cfed4=!![];if(_0x46dec8===_0x9240('0x15')&&_0x3d9881!==_0x361e1a){_0x2cfed4=![];}_0x398048[_0x9240('0x2f')]({[_0x361e1a+'Pause']:_0x2cfed4});});if(_0x1e71bf){_0x398048['push']({'pauseType':_0x1e71bf});}}else if(_0x46dec8){_0x2b0100[_0x9240('0x33')](function(_0x52504e){_0x398048[_0x9240('0x2f')]({[_0x52504e+_0x9240('0x34')]:![]});});}_0x36a812[_0x9240('0x35')]=_[_0x9240('0x36')](_0x36a812[_0x9240('0x35')],{'$and':_0x398048});if(_0x48de8e[_0x9240('0x37')][_0x9240('0x38')]===_0x9240('0x37')){var _0x27064b={'params':{'id':_0x48de8e[_0x9240('0x37')][_0x9240('0x39')]},'query':{'section':_0x9240('0x3a'),'role':'agent','online':!![],'raw':!![],'ids':_0x5c6d7c,'customSorting':_0x2454c3}};if(_0x565b77){_0x27064b[_0x9240('0x11')][_0x9240('0x3b')]=_0x398048;}_0x27064b[_0x9240('0x11')]=Object[_0x9240('0x3c')](_0x27064b[_0x9240('0x11')],_0x48de8e['query']);delete _0x27064b[_0x9240('0x11')]['id'];return db['UserProfile'][_0x9240('0x3d')](_0x27064b);}return db[_0x9240('0x26')][_0x9240('0x3e')](_0x36a812);})[_0x9240('0x21')](function(_0x47e71d){_0x530ef8['count']=_0x47e71d[_0x9240('0xd')];_0x261d01=_0x47e71d[_0x9240('0x23')];return _0x261d01[_0x9240('0x3f')](function(_0x45c39f){var _0x3427da=_['find'](_0x5aca04,['id',_0x45c39f['id']]);if(_0x3427da){var _0x1013ee=rta[_0x9240('0x40')](_0x3427da);_[_0x9240('0x36')](_0x45c39f,_0x1013ee);}_0x45c39f['globalStatus']=rta[_0x9240('0x41')](_0x45c39f);if(_0x45c39f[_0x9240('0x1c')][_0x9240('0x1b')](_0x9240('0x14'))){_0x2b0100[_0x9240('0x33')](function(_0x3ca4d3){if(_0x45c39f[_0x3ca4d3+_0x9240('0x34')]){_0x45c39f[_0x3ca4d3+_0x9240('0x42')]=_0x9240('0x14');}});}return _0x45c39f;});})[_0x9240('0x21')](function(_0x12da8c){if(!_0xd7f3eb||_0x2454c3){return _0x12da8c;}return rta[_0x9240('0x43')](_0x12da8c,_0xd7f3eb);})[_0x9240('0x21')](function(_0x13d8a2){_0x530ef8[_0x9240('0x23')]=_0x13d8a2;return _0x530ef8;})[_0x9240('0x21')](respondWithFilteredResult(_0x333f7c,_0x36a812))[_0x9240('0x44')](APIHandleError(_0x333f7c));};exports[_0x9240('0x45')]=function(_0x8c8906,_0x5b78d3){var _0x48fd4c={'count':0x0,'rows':[]};var _0xbd1304={};var _0x3e60ec;var _0x2214bc;var _0x1527e0;Promise[_0x9240('0x46')]()['then'](function(){if(_0x8c8906[_0x9240('0x11')][_0x9240('0x16')]){if(!utils['isValidChannel'](_0x8c8906[_0x9240('0x11')]['channel'])){throw new APIBadRequestError(util[_0x9240('0x17')](_0x9240('0x18'),_0x8c8906[_0x9240('0x11')]['channel']));}_0x3e60ec=_0x8c8906[_0x9240('0x11')][_0x9240('0x16')][_0x9240('0x19')]();}var _0x39ebfa=_[_0x9240('0x47')](_0x3e60ec)+_0x9240('0x48');var _0x49dd4e=_[_0x9240('0x3f')](db[_0x39ebfa][_0x9240('0x27')],function(_0x548cba){return{'name':_0x548cba[_0x9240('0x28')],'type':_0x548cba[_0x9240('0x29')][_0x9240('0x49')]};});if(!_0x8c8906[_0x9240('0x11')][_0x9240('0x1e')]){var _0x105a41=['id',_0x9240('0x4a')];if(_0x3e60ec==='voice'){_0x105a41[_0x9240('0x2f')](_0x9240('0x29'));if(_0x8c8906[_0x9240('0x11')][_0x9240('0x29')]===_0x9240('0x4b')){_0x105a41[_0x9240('0x2f')]([_0x9240('0x4c'),_0x9240('0x4d')]);}}_0x8c8906[_0x9240('0x11')][_0x9240('0x1e')]=_0x105a41[_0x9240('0x1f')](',');}_0xbd1304=qs[_0x9240('0x2c')](_0x49dd4e,_0x8c8906);if(_0x8c8906[_0x9240('0x37')][_0x9240('0x38')]===_0x9240('0x37')){var _0x517ddd={'params':{'id':_0x8c8906[_0x9240('0x37')][_0x9240('0x39')]},'query':{'section':_0x3e60ec===_0x9240('0x4e')&&_0x8c8906[_0x9240('0x11')][_0x9240('0x29')]===_0x9240('0x4b')?_0x9240('0x4f'):_[_0x9240('0x47')](_0x3e60ec)+_0x9240('0x50'),'type':_0x8c8906['query']['type'],'nolimit':!![],'sort':'name','filter':_0x8c8906['query'][_0x9240('0x51')]}};return db[_0x9240('0x52')][_0x9240('0x3d')](_0x517ddd);}return db[_0x39ebfa][_0x9240('0x3e')](_0xbd1304);})[_0x9240('0x21')](function(_0x595551){_0x48fd4c[_0x9240('0xd')]=_0x595551[_0x9240('0xd')];_0x2214bc=_0x595551[_0x9240('0x23')];return rtq['getRealtimeQueues'](_0x8c8906,_0x3e60ec);})[_0x9240('0x21')](function(_0x165b9a){_0x1527e0=_0x165b9a[_0x9240('0x23')];return rtq[_0x9240('0x53')](_0x2214bc,_0x1527e0,_0x3e60ec,_0x8c8906['query'][_0x9240('0x29')]);})[_0x9240('0x21')](function(_0x15f1ec){_0x48fd4c[_0x9240('0x23')]=_0x15f1ec;return _0x48fd4c;})[_0x9240('0x21')](respondWithFilteredResult(_0x5b78d3,_0xbd1304))['catch'](APIHandleError(_0x5b78d3));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index ccbccc2..dab4f1c 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1806f2,_0x34a0cf){var _0x2d803d=function(_0x20f5d4){while(--_0x20f5d4){_0x1806f2['push'](_0x1806f2['shift']());}};_0x2d803d(++_0x34a0cf);}(_0xe706,0xa3));var _0x6e70=function(_0x22fe5c,_0x28645c){_0x22fe5c=_0x22fe5c-0x0;var _0x17a217=_0xe706[_0x22fe5c];return _0x17a217;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x398dda,_0xdbcec6){var _0x2a48ea=function(_0x5be83e){while(--_0x5be83e){_0x398dda['push'](_0x398dda['shift']());}};_0x2a48ea(++_0xdbcec6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('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 fbdaf86..6646882 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 _0x741c=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x741c,0x196));var _0xc741=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x741c[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xc741('0x0'));module[_0xc741('0x1')]={'state':{'type':Sequelize[_0xc741('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xc741('0x3')]},'scheduledat':{'type':Sequelize[_0xc741('0x4')]},'uniqueid':{'type':Sequelize[_0xc741('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xc741('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xc741('0x3')]},'membername':{'type':Sequelize[_0xc741('0x3')]}}; \ No newline at end of file +var _0xed1f=['DATE','INTEGER','STRING','sequelize','exports'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0xed1f,0x170));var _0xfed1=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0xed1f[_0x4dc7b9];return _0x3ab114;};'use strict';var Sequelize=require(_0xfed1('0x0'));module[_0xfed1('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xfed1('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xfed1('0x2')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xfed1('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xfed1('0x4')]},'campaigntype':{'type':Sequelize[_0xfed1('0x4')]},'membername':{'type':Sequelize[_0xfed1('0x4')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 5e865ca..ebb8ab2 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 _0x9f7e=['report_agent_preview','lodash','path','rimraf','./reportAgentPreview.attributes','define','ReportAgentPreview'];(function(_0x6c79c0,_0x12b571){var _0x4b96ca=function(_0x464948){while(--_0x464948){_0x6c79c0['push'](_0x6c79c0['shift']());}};_0x4b96ca(++_0x12b571);}(_0x9f7e,0x112));var _0xe9f7=function(_0x15beff,_0x12a464){_0x15beff=_0x15beff-0x0;var _0x3629df=_0x9f7e[_0x15beff];return _0x3629df;};'use strict';var _=require(_0xe9f7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9f7('0x1'));var rimraf=require(_0xe9f7('0x2'));var config=require('../../config/environment');var attributes=require(_0xe9f7('0x3'));module['exports']=function(_0x21e393,_0x600221){return _0x21e393[_0xe9f7('0x4')](_0xe9f7('0x5'),attributes,{'tableName':_0xe9f7('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35f1=['ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./reportAgentPreview.attributes','exports'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x35f1,0x106));var _0x135f=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0x35f1[_0x484c03];return _0x294127;};'use strict';var _=require(_0x135f('0x0'));var util=require(_0x135f('0x1'));var logger=require(_0x135f('0x2'))(_0x135f('0x3'));var moment=require(_0x135f('0x4'));var BPromise=require(_0x135f('0x5'));var rp=require(_0x135f('0x6'));var fs=require('fs');var path=require(_0x135f('0x7'));var rimraf=require(_0x135f('0x8'));var config=require('../../config/environment');var attributes=require(_0x135f('0x9'));module[_0x135f('0xa')]=function(_0x53d582,_0x2d2003){return _0x53d582['define'](_0x135f('0xb'),attributes,{'tableName':_0x135f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 1322054..4c5d35f 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 _0xa455=['info','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','ReportAgentPreview,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateReportAgentPreview','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','http','request','then'];(function(_0x22f9b3,_0x321301){var _0x244936=function(_0x2f5476){while(--_0x2f5476){_0x22f9b3['push'](_0x22f9b3['shift']());}};_0x244936(++_0x321301);}(_0xa455,0x154));var _0x5a45=function(_0x5c72dd,_0x5339c0){_0x5c72dd=_0x5c72dd-0x0;var _0x374d4f=_0xa455[_0x5c72dd];return _0x374d4f;};'use strict';var _=require(_0x5a45('0x0'));var util=require('util');var moment=require(_0x5a45('0x1'));var BPromise=require(_0x5a45('0x2'));var rs=require(_0x5a45('0x3'));var fs=require('fs');var Redis=require(_0x5a45('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5a45('0x5'));var config=require(_0x5a45('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5a45('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1dd356,_0x2a6e40,_0x1a59c8){return new BPromise(function(_0x54ff5a,_0xf76367){return client[_0x5a45('0x8')](_0x1dd356,_0x1a59c8)[_0x5a45('0x9')](function(_0x5b9356){logger[_0x5a45('0xa')]('ReportAgentPreview,\x20%s,\x20%s',_0x2a6e40,'request\x20sent');logger[_0x5a45('0xb')](_0x5a45('0xc'),_0x2a6e40,'request\x20sent',JSON[_0x5a45('0xd')](_0x5b9356));if(_0x5b9356[_0x5a45('0xe')]){if(_0x5b9356['error']['code']===0x1f4){logger[_0x5a45('0xe')](_0x5a45('0xf'),_0x2a6e40,_0x5b9356[_0x5a45('0xe')][_0x5a45('0x10')]);return _0xf76367(_0x5b9356[_0x5a45('0xe')][_0x5a45('0x10')]);}logger[_0x5a45('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x2a6e40,_0x5b9356[_0x5a45('0xe')]['message']);return _0x54ff5a(_0x5b9356['error'][_0x5a45('0x10')]);}else{logger[_0x5a45('0xa')](_0x5a45('0xf'),_0x2a6e40,_0x5a45('0x11'));_0x54ff5a(_0x5b9356[_0x5a45('0x12')][_0x5a45('0x10')]);}})[_0x5a45('0x13')](function(_0x4c208b){logger[_0x5a45('0xe')](_0x5a45('0xf'),_0x2a6e40,_0x4c208b);_0xf76367(_0x4c208b);});});}exports[_0x5a45('0x14')]=function(_0x56372e){var _0x268be3=this;return new Promise(function(_0x1cfa57,_0x1a6392){return db['ReportAgentPreview'][_0x5a45('0x15')](_0x56372e[_0x5a45('0x16')],{'raw':_0x56372e[_0x5a45('0x17')]?_0x56372e[_0x5a45('0x17')][_0x5a45('0x18')]===undefined?!![]:![]:!![]})[_0x5a45('0x9')](function(_0x47f996){logger[_0x5a45('0xa')](_0x5a45('0x14'),_0x56372e);logger[_0x5a45('0xb')](_0x5a45('0x14'),_0x56372e,JSON[_0x5a45('0xd')](_0x47f996));_0x1cfa57(_0x47f996);})[_0x5a45('0x13')](function(_0xc6c8d3){logger[_0x5a45('0xe')](_0x5a45('0x14'),_0xc6c8d3['message'],_0x56372e);_0x1a6392(_0x268be3[_0x5a45('0xe')](0x1f4,_0xc6c8d3[_0x5a45('0x10')]));});});}; \ No newline at end of file +var _0x6b05=['stringify','error','code','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','then','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6b05,0x89));var _0x56b0=function(_0x6b2c4f,_0x488606){_0x6b2c4f=_0x6b2c4f-0x0;var _0x491ec3=_0x6b05[_0x6b2c4f];return _0x491ec3;};'use strict';var _=require(_0x56b0('0x0'));var util=require(_0x56b0('0x1'));var moment=require('moment');var BPromise=require(_0x56b0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x56b0('0x3'));var db=require(_0x56b0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x56b0('0x5'))(_0x56b0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x56b0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5dbced,_0x71f348,_0x5ac961){return new BPromise(function(_0x277176,_0x4f5d84){return client[_0x56b0('0x8')](_0x5dbced,_0x5ac961)['then'](function(_0x3744e8){logger[_0x56b0('0x9')](_0x56b0('0xa'),_0x71f348,_0x56b0('0xb'));logger['debug'](_0x56b0('0xc'),_0x71f348,'request\x20sent',JSON[_0x56b0('0xd')](_0x3744e8));if(_0x3744e8[_0x56b0('0xe')]){if(_0x3744e8[_0x56b0('0xe')][_0x56b0('0xf')]===0x1f4){logger[_0x56b0('0xe')](_0x56b0('0xa'),_0x71f348,_0x3744e8[_0x56b0('0xe')]['message']);return _0x4f5d84(_0x3744e8[_0x56b0('0xe')]['message']);}logger[_0x56b0('0xe')](_0x56b0('0xa'),_0x71f348,_0x3744e8[_0x56b0('0xe')][_0x56b0('0x10')]);return _0x277176(_0x3744e8[_0x56b0('0xe')]['message']);}else{logger[_0x56b0('0x9')](_0x56b0('0xa'),_0x71f348,_0x56b0('0xb'));_0x277176(_0x3744e8['result'][_0x56b0('0x10')]);}})[_0x56b0('0x11')](function(_0x2164fe){logger[_0x56b0('0xe')](_0x56b0('0xa'),_0x71f348,_0x2164fe);_0x4f5d84(_0x2164fe);});});}exports[_0x56b0('0x12')]=function(_0xd1925a){var _0x516279=this;return new Promise(function(_0x5f3644,_0x3c7d92){return db[_0x56b0('0x13')][_0x56b0('0x14')](_0xd1925a[_0x56b0('0x15')],{'raw':_0xd1925a[_0x56b0('0x16')]?_0xd1925a[_0x56b0('0x16')][_0x56b0('0x17')]===undefined?!![]:![]:!![]})[_0x56b0('0x18')](function(_0x22c907){logger['info'](_0x56b0('0x12'),_0xd1925a);logger['debug']('CreateReportAgentPreview',_0xd1925a,JSON[_0x56b0('0xd')](_0x22c907));_0x5f3644(_0x22c907);})[_0x56b0('0x11')](function(_0x325fec){logger['error'](_0x56b0('0x12'),_0x325fec[_0x56b0('0x10')],_0xd1925a);_0x3c7d92(_0x516279[_0x56b0('0xe')](0x1f4,_0x325fec[_0x56b0('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 12e76af..b257c6e 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 _0xc013=['whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','multer','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/fax/queues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/sms/queues/:id/notify','/whatsapp/queues/:id/notify'];(function(_0x26b308,_0x397dfc){var _0x59478d=function(_0x20b4c4){while(--_0x20b4c4){_0x26b308['push'](_0x26b308['shift']());}};_0x59478d(++_0x397dfc);}(_0xc013,0x1bc));var _0x3c01=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xc013[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0x3c01('0x0'));var util=require('util');var path=require('path');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x3c01('0x1'));router[_0x3c01('0x2')](_0x3c01('0x3'),auth[_0x3c01('0x4')](),controller['voiceChannels']);router[_0x3c01('0x2')]('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0x3c01('0x5')]);router['get'](_0x3c01('0x6'),auth[_0x3c01('0x4')](),controller['voiceChannelStopMixMonitor']);router[_0x3c01('0x2')](_0x3c01('0x7'),auth[_0x3c01('0x4')](),controller[_0x3c01('0x8')]);router[_0x3c01('0x2')](_0x3c01('0x9'),auth[_0x3c01('0x4')](),controller['chatQueues']);router['get'](_0x3c01('0xa'),auth[_0x3c01('0x4')](),controller[_0x3c01('0xb')]);router[_0x3c01('0x2')](_0x3c01('0xc'),auth[_0x3c01('0x4')](),controller[_0x3c01('0xd')]);router[_0x3c01('0x2')](_0x3c01('0xe'),auth[_0x3c01('0x4')](),controller[_0x3c01('0xf')]);router[_0x3c01('0x2')](_0x3c01('0x10'),auth[_0x3c01('0x4')](),controller['smsQueues']);router[_0x3c01('0x2')]('/whatsapp/queues',auth[_0x3c01('0x4')](),controller['whatsappQueues']);router['get'](_0x3c01('0x11'),auth[_0x3c01('0x4')](),controller['faxQueues']);router[_0x3c01('0x2')](_0x3c01('0x12'),auth['isAuthenticated'](),controller['voiceQueuesPreview']);router[_0x3c01('0x2')](_0x3c01('0x13'),auth[_0x3c01('0x4')](),controller[_0x3c01('0x14')]);router[_0x3c01('0x2')](_0x3c01('0x15'),auth[_0x3c01('0x4')](),controller[_0x3c01('0x16')]);router[_0x3c01('0x2')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0x3c01('0x17')]);router['get'](_0x3c01('0x18'),auth[_0x3c01('0x4')](),controller[_0x3c01('0x19')]);router[_0x3c01('0x2')](_0x3c01('0x1a'),auth[_0x3c01('0x4')](),controller['showVoiceQueues']);router[_0x3c01('0x1b')](_0x3c01('0x1a'),auth[_0x3c01('0x4')](),controller[_0x3c01('0x1c')]);router[_0x3c01('0x2')](_0x3c01('0x1d'),auth[_0x3c01('0x4')](),controller[_0x3c01('0x1e')]);router[_0x3c01('0x2')](_0x3c01('0x1f'),auth[_0x3c01('0x4')](),controller[_0x3c01('0x20')]);router[_0x3c01('0x2')]('/agents',auth[_0x3c01('0x4')](),controller['agents']);router[_0x3c01('0x1b')]('/agents/:id/capacity',auth[_0x3c01('0x4')](),controller[_0x3c01('0x21')]);router[_0x3c01('0x2')](_0x3c01('0x22'),auth['isAuthenticated'](),controller[_0x3c01('0x23')]);router[_0x3c01('0x2')](_0x3c01('0x24'),auth[_0x3c01('0x4')](),controller[_0x3c01('0x25')]);router[_0x3c01('0x2')](_0x3c01('0x26'),auth[_0x3c01('0x4')](),controller[_0x3c01('0x27')]);router[_0x3c01('0x2')](_0x3c01('0x28'),auth[_0x3c01('0x4')](),controller[_0x3c01('0x29')]);router[_0x3c01('0x2')]('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x3c01('0x2a')]);router['get'](_0x3c01('0x2b'),auth[_0x3c01('0x4')](),controller[_0x3c01('0x2c')]);router[_0x3c01('0x2')](_0x3c01('0x2d'),auth[_0x3c01('0x4')](),controller[_0x3c01('0x2e')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0x3c01('0x4')](),controller[_0x3c01('0x2f')]);router[_0x3c01('0x2')](_0x3c01('0x30'),auth[_0x3c01('0x4')](),controller['smsQueuesWaitingInteractions']);router[_0x3c01('0x2')](_0x3c01('0x31'),auth[_0x3c01('0x4')](),controller[_0x3c01('0x32')]);router[_0x3c01('0x2')](_0x3c01('0x33'),auth[_0x3c01('0x4')](),controller['faxQueuesWaitingInteractions']);router['post'](_0x3c01('0x34'),auth['isAuthenticated'](),controller[_0x3c01('0x35')](_0x3c01('0x36')));router[_0x3c01('0x2')](_0x3c01('0x37'),auth[_0x3c01('0x4')](),controller[_0x3c01('0x38')]);router[_0x3c01('0x39')](_0x3c01('0x3a'),auth[_0x3c01('0x4')](),controller[_0x3c01('0x35')]('chat'));router[_0x3c01('0x2')](_0x3c01('0x3b'),auth['isAuthenticated'](),controller[_0x3c01('0x3c')]);router[_0x3c01('0x39')]('/fax/queues/:id/notify',auth[_0x3c01('0x4')](),controller[_0x3c01('0x35')](_0x3c01('0x3d')));router[_0x3c01('0x2')](_0x3c01('0x3e'),auth['isAuthenticated'](),controller[_0x3c01('0x3f')]);router[_0x3c01('0x39')](_0x3c01('0x40'),auth[_0x3c01('0x4')](),controller[_0x3c01('0x35')]('openchannel'));router[_0x3c01('0x2')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0x3c01('0x39')](_0x3c01('0x41'),auth['isAuthenticated'](),controller[_0x3c01('0x35')]('sms'));router[_0x3c01('0x39')](_0x3c01('0x42'),auth[_0x3c01('0x4')](),controller[_0x3c01('0x35')](_0x3c01('0x43')));router[_0x3c01('0x2')](_0x3c01('0x44'),auth[_0x3c01('0x4')](),controller[_0x3c01('0x45')]);router[_0x3c01('0x2')](_0x3c01('0x46'),auth[_0x3c01('0x4')](),controller[_0x3c01('0x47')]);router['post'](_0x3c01('0x48'),auth[_0x3c01('0x4')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file +var _0x2a78=['queueNotify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','/campaigns','campaigns','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','/chat/queues/:id/notify','chat'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x2a78,0x67));var _0x82a7=function(_0x26577d,_0x2ff912){_0x26577d=_0x26577d-0x0;var _0x1c14d4=_0x2a78[_0x26577d];return _0x1c14d4;};'use strict';var multer=require(_0x82a7('0x0'));var util=require(_0x82a7('0x1'));var path=require('path');var express=require(_0x82a7('0x2'));var router=express[_0x82a7('0x3')]();var auth=require(_0x82a7('0x4'));var controller=require(_0x82a7('0x5'));router[_0x82a7('0x6')]('/voice/channels',auth[_0x82a7('0x7')](),controller['voiceChannels']);router[_0x82a7('0x6')](_0x82a7('0x8'),auth[_0x82a7('0x7')](),controller[_0x82a7('0x9')]);router[_0x82a7('0x6')](_0x82a7('0xa'),auth[_0x82a7('0x7')](),controller[_0x82a7('0xb')]);router['get'](_0x82a7('0xc'),auth[_0x82a7('0x7')](),controller[_0x82a7('0xd')]);router[_0x82a7('0x6')](_0x82a7('0xe'),auth[_0x82a7('0x7')](),controller[_0x82a7('0xf')]);router['get']('/mail/queues',auth[_0x82a7('0x7')](),controller['mailQueues']);router[_0x82a7('0x6')](_0x82a7('0x10'),auth[_0x82a7('0x7')](),controller[_0x82a7('0x11')]);router['get'](_0x82a7('0x12'),auth[_0x82a7('0x7')](),controller[_0x82a7('0x13')]);router[_0x82a7('0x6')](_0x82a7('0x14'),auth['isAuthenticated'](),controller[_0x82a7('0x15')]);router['get'](_0x82a7('0x16'),auth[_0x82a7('0x7')](),controller[_0x82a7('0x17')]);router[_0x82a7('0x6')](_0x82a7('0x18'),auth[_0x82a7('0x7')](),controller[_0x82a7('0x19')]);router[_0x82a7('0x6')](_0x82a7('0x1a'),auth['isAuthenticated'](),controller[_0x82a7('0x1b')]);router[_0x82a7('0x6')](_0x82a7('0x1c'),auth[_0x82a7('0x7')](),controller[_0x82a7('0x1d')]);router[_0x82a7('0x6')](_0x82a7('0x1e'),auth['isAuthenticated'](),controller[_0x82a7('0x1f')]);router[_0x82a7('0x6')](_0x82a7('0x20'),auth[_0x82a7('0x7')](),controller[_0x82a7('0x21')]);router[_0x82a7('0x6')](_0x82a7('0x22'),auth['isAuthenticated'](),controller[_0x82a7('0x23')]);router[_0x82a7('0x6')]('/voice/queues/:id',auth[_0x82a7('0x7')](),controller[_0x82a7('0x24')]);router[_0x82a7('0x25')](_0x82a7('0x26'),auth[_0x82a7('0x7')](),controller[_0x82a7('0x27')]);router[_0x82a7('0x6')]('/outbound',auth[_0x82a7('0x7')](),controller[_0x82a7('0x28')]);router[_0x82a7('0x6')](_0x82a7('0x29'),auth[_0x82a7('0x7')](),controller['outboundChannels']);router['get'](_0x82a7('0x2a'),auth[_0x82a7('0x7')](),controller[_0x82a7('0x2b')]);router['put'](_0x82a7('0x2c'),auth['isAuthenticated'](),controller[_0x82a7('0x2d')]);router[_0x82a7('0x6')](_0x82a7('0x2e'),auth['isAuthenticated'](),controller[_0x82a7('0x2f')]);router[_0x82a7('0x6')]('/trunks',auth[_0x82a7('0x7')](),controller[_0x82a7('0x30')]);router['get'](_0x82a7('0x31'),auth[_0x82a7('0x7')](),controller[_0x82a7('0x32')]);router[_0x82a7('0x6')]('/fax/accounts',auth[_0x82a7('0x7')](),controller['faxAccounts']);router['get']('/chat/queues/waitinginteractions',auth[_0x82a7('0x7')](),controller['chatQueuesWaitingInteractions']);router['get'](_0x82a7('0x33'),auth['isAuthenticated'](),controller[_0x82a7('0x34')]);router['get']('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x82a7('0x35')]);router[_0x82a7('0x6')]('/openchannel/queues/:id/waitinginteractions',auth[_0x82a7('0x7')](),controller[_0x82a7('0x36')]);router['get'](_0x82a7('0x37'),auth[_0x82a7('0x7')](),controller[_0x82a7('0x38')]);router[_0x82a7('0x6')](_0x82a7('0x39'),auth[_0x82a7('0x7')](),controller[_0x82a7('0x3a')]);router[_0x82a7('0x6')](_0x82a7('0x3b'),auth[_0x82a7('0x7')](),controller[_0x82a7('0x3c')]);router[_0x82a7('0x3d')](_0x82a7('0x3e'),auth[_0x82a7('0x7')](),controller['queueNotify'](_0x82a7('0x3f')));router[_0x82a7('0x6')](_0x82a7('0x40'),auth[_0x82a7('0x7')](),controller['showMailQueues']);router['post'](_0x82a7('0x41'),auth['isAuthenticated'](),controller['queueNotify'](_0x82a7('0x42')));router[_0x82a7('0x6')]('/chat/queues/:id',auth[_0x82a7('0x7')](),controller['showChatQueues']);router[_0x82a7('0x3d')]('/fax/queues/:id/notify',auth[_0x82a7('0x7')](),controller[_0x82a7('0x43')](_0x82a7('0x44')));router[_0x82a7('0x6')](_0x82a7('0x45'),auth[_0x82a7('0x7')](),controller[_0x82a7('0x46')]);router[_0x82a7('0x3d')](_0x82a7('0x47'),auth[_0x82a7('0x7')](),controller[_0x82a7('0x43')](_0x82a7('0x48')));router[_0x82a7('0x6')](_0x82a7('0x49'),auth[_0x82a7('0x7')](),controller[_0x82a7('0x4a')]);router[_0x82a7('0x3d')](_0x82a7('0x4b'),auth['isAuthenticated'](),controller[_0x82a7('0x43')](_0x82a7('0x4c')));router[_0x82a7('0x3d')](_0x82a7('0x4d'),auth[_0x82a7('0x7')](),controller['queueNotify'](_0x82a7('0x4e')));router['get'](_0x82a7('0x4f'),auth['isAuthenticated'](),controller[_0x82a7('0x50')]);router[_0x82a7('0x6')](_0x82a7('0x51'),auth['isAuthenticated'](),controller[_0x82a7('0x52')]);router[_0x82a7('0x3d')](_0x82a7('0x53'),auth['isAuthenticated'](),controller[_0x82a7('0x54')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 6a66521..de9c8a3 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 _0x8958=['faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','TransferReport','create','agentNotify','channel','Agent\x20not\x20found','Message','Start','agentTransferTimeout','*,*,*,*','moment','api','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','interaction','MemberReport','findAll','user','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions'];(function(_0x5f110e,_0x2ae443){var _0x192fc0=function(_0xb7ade0){while(--_0xb7ade0){_0x5f110e['push'](_0x5f110e['shift']());}};_0x192fc0(++_0x2ae443);}(_0x8958,0x93));var _0x8895=function(_0x245cab,_0x565284){_0x245cab=_0x245cab-0x0;var _0x144703=_0x8958[_0x245cab];return _0x144703;};'use strict';var BPromise=require('bluebird');var moment=require(_0x8895('0x0'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x8895('0x1'));var jayson=require('jayson/promise');var amiClient=jayson[_0x8895('0x2')][_0x8895('0x3')]({'port':0x232a});var mailClient=jayson[_0x8895('0x2')]['http']({'port':0x232b});var routingClient=jayson[_0x8895('0x2')][_0x8895('0x3')]({'port':0x232c});function respondWithRpcPromise(_0x124e1e,_0x40cec6,_0x33013a){return new BPromise(function(_0x51376b,_0xe018b8){var _0xc2be9f=_0x33013a?_0x33013a:amiClient;return _0xc2be9f[_0x8895('0x4')](_0x124e1e,_0x40cec6)[_0x8895('0x5')](function(_0x6eab1e){if(_0x6eab1e[_0x8895('0x6')]){if(_0x6eab1e[_0x8895('0x6')][_0x8895('0x7')]===0x1f4){return _0xe018b8(_0x6eab1e[_0x8895('0x6')][_0x8895('0x8')]);}return _0x51376b(_0x6eab1e['error'][_0x8895('0x8')]);}else{_0x51376b(_0x6eab1e[_0x8895('0x9')]);}})[_0x8895('0xa')](function(_0x301bec){_0xe018b8(_0x301bec);});});}function respondWithResult(_0x446e1a,_0xaf93bc){_0xaf93bc=_0xaf93bc||0xc8;return function(_0x5af0ef){if(_0x5af0ef){return _0x446e1a[_0x8895('0xb')](_0xaf93bc)[_0x8895('0xc')](_0x5af0ef);}return _0x446e1a[_0x8895('0xd')](0x194);};}function handleError(_0x57d40a,_0x47b9fe){_0x47b9fe=_0x47b9fe||0x1f4;return function(_0x9191b8){logger['error'](_0x9191b8[_0x8895('0xe')]);if(_0x9191b8[_0x8895('0xf')]){delete _0x9191b8[_0x8895('0xf')];}_0x57d40a[_0x8895('0xb')](_0x47b9fe)[_0x8895('0x10')](_0x9191b8);};}function findById(_0x5b4c2e){return function(_0x4128e2){if(!_[_0x8895('0x11')](_0x5b4c2e)&&!_[_0x8895('0x11')](_0x4128e2)&&!_[_0x8895('0x11')](_0x4128e2[_0x8895('0x12')])){return _[_0x8895('0x13')](_0x4128e2[_0x8895('0x12')],function(_0x26cee0){return _0x26cee0['id']==_0x5b4c2e;});}return null;};}exports[_0x8895('0x14')]=function(_0x2da618,_0x24fef0){return respondWithRpcPromise(_0x8895('0x15'),_0x2da618[_0x8895('0x16')])['then'](respondWithResult(_0x24fef0,null))['catch'](handleError(_0x24fef0,null));};exports['voiceChannelMixMonitor']=function(_0x3daf43,_0x456282){return respondWithRpcPromise(_0x8895('0x17'),_[_0x8895('0x18')](_0x3daf43[_0x8895('0x16')],_0x3daf43[_0x8895('0x19')]))[_0x8895('0x5')](respondWithResult(_0x456282,null))[_0x8895('0xa')](handleError(_0x456282,null));};exports['voiceChannelStopMixMonitor']=function(_0x1a4c5b,_0x5db3a0){return respondWithRpcPromise(_0x8895('0x1a'),_[_0x8895('0x18')](_0x1a4c5b[_0x8895('0x16')],_0x1a4c5b['params']))['then'](respondWithResult(_0x5db3a0,null))[_0x8895('0xa')](handleError(_0x5db3a0,null));};exports[_0x8895('0x1b')]=function(_0x38f7ad,_0x24a376){return respondWithRpcPromise('VoiceQueues',_0x38f7ad[_0x8895('0x16')])[_0x8895('0x5')](respondWithResult(_0x24a376,null))[_0x8895('0xa')](handleError(_0x24a376,null));};exports['showVoiceQueues']=function(_0x4aee03,_0x78b57){return respondWithRpcPromise('VoiceQueues',_0x4aee03[_0x8895('0x16')])[_0x8895('0x5')](findById(_0x4aee03[_0x8895('0x19')]['id']))[_0x8895('0x5')](respondWithResult(_0x78b57,null))[_0x8895('0xa')](handleError(_0x78b57,null));};exports['updateVoiceQueue']=function(_0x4d567a,_0x6e449d){return respondWithRpcPromise(_0x8895('0x1c'),_[_0x8895('0x18')](_0x4d567a[_0x8895('0x1d')],_0x4d567a[_0x8895('0x19')]))['then'](respondWithResult(_0x6e449d,null))['catch'](handleError(_0x6e449d,null));};exports[_0x8895('0x1e')]=function(_0x848a11,_0x1c16f6){return respondWithRpcPromise(_0x8895('0x1f'),_[_0x8895('0x18')](_0x848a11['query'],_0x848a11[_0x8895('0x19')]))['then'](respondWithResult(_0x1c16f6,null))[_0x8895('0xa')](handleError(_0x1c16f6,null));};exports['voiceQueuesChannels']=function(_0x40ba14,_0x1a3fe5){return respondWithRpcPromise(_0x8895('0x20'),_0x40ba14[_0x8895('0x16')])[_0x8895('0x5')](respondWithResult(_0x1a3fe5,null))['catch'](handleError(_0x1a3fe5,null));};exports[_0x8895('0x21')]=function(_0xcba076,_0x1b5359){return respondWithRpcPromise(_0x8895('0x22'),_[_0x8895('0x18')](_0xcba076['query'],_0xcba076[_0x8895('0x19')]))['then'](respondWithResult(_0x1b5359,null))[_0x8895('0xa')](handleError(_0x1b5359,null));};exports['voiceQueuesChannelHangup']=function(_0x21c22b,_0x15a865){return respondWithRpcPromise(_0x8895('0x23'),_[_0x8895('0x18')](_0x21c22b[_0x8895('0x16')],_0x21c22b['params']))[_0x8895('0x5')](respondWithResult(_0x15a865,null))['catch'](handleError(_0x15a865,null));};exports[_0x8895('0x24')]=function(_0xcc735f,_0x36e13b){return respondWithRpcPromise(_0x8895('0x25'),_[_0x8895('0x18')](_0xcc735f[_0x8895('0x16')],_0xcc735f['params']))[_0x8895('0x5')](respondWithResult(_0x36e13b,null))[_0x8895('0xa')](handleError(_0x36e13b,null));};exports['outbound']=function(_0x2557fc,_0x54ca09){return respondWithRpcPromise(_0x8895('0x26'),_0x2557fc[_0x8895('0x16')])['then'](respondWithResult(_0x54ca09,null))[_0x8895('0xa')](handleError(_0x54ca09,null));};exports[_0x8895('0x27')]=function(_0x5b7204,_0x58751a){return respondWithRpcPromise(_0x8895('0x28'),_0x5b7204[_0x8895('0x16')])[_0x8895('0x5')](respondWithResult(_0x58751a,null))[_0x8895('0xa')](handleError(_0x58751a,null));};exports[_0x8895('0x29')]=function(_0x4917d1,_0x42ed1f){var _0x25c854;return respondWithRpcPromise(_0x8895('0x2a'),_0x4917d1[_0x8895('0x16')])[_0x8895('0x5')](function(_0x534876){_0x25c854=_0x534876;return respondWithRpcPromise('Agents',_0x4917d1[_0x8895('0x16')],routingClient);})['then'](function(_0x20a521){return _[_0x8895('0x18')]({},_0x20a521,_0x25c854);})['then'](respondWithResult(_0x42ed1f,null))[_0x8895('0xa')](handleError(_0x42ed1f,null));};exports['agentCapacity']=function(_0x1e6395,_0x5e6413){if(_0x1e6395['body']&&_0x1e6395['body']['interaction']&&_0x1e6395['user']&&_0x1e6395['user'][_0x8895('0xf')]){for(var _0x206f57 in _0x1e6395['body']['interaction']){if(_0x1e6395[_0x8895('0x1d')][_0x8895('0x2b')]['hasOwnProperty'](_0x206f57)){db[_0x8895('0x2c')][_0x8895('0x2d')]({'where':{'channel':_0x206f57,'membername':_0x1e6395[_0x8895('0x2e')][_0x8895('0xf')],'type':_0x8895('0x2f'),'exitAt':null,'uniqueid':_0x1e6395['body']['interaction'][_0x206f57]&&_0x1e6395['body'][_0x8895('0x2b')][_0x206f57]['length']?{'$notIn':_0x1e6395[_0x8895('0x1d')][_0x8895('0x2b')][_0x206f57]}:{'$ne':null}}})[_0x8895('0x5')](function(_0x28aaa9){var _0x587ccb=moment()[_0x8895('0x30')](_0x8895('0x31'));for(var _0x3413cd=0x0,_0x167302=_0x28aaa9[_0x8895('0x32')];_0x3413cd<_0x167302;_0x3413cd+=0x1){_0x28aaa9[_0x3413cd][_0x8895('0x33')]({'exitAt':_0x587ccb});}});for(var _0x14295a=0x0;_0x14295a<_0x1e6395[_0x8895('0x1d')]['interaction'][_0x206f57][_0x8895('0x32')];_0x14295a+=0x1){db[_0x8895('0x2c')]['findOrCreate']({'where':{'channel':_0x206f57,'membername':_0x1e6395[_0x8895('0x2e')]['name'],'type':'INTERACTION','uniqueid':_0x1e6395[_0x8895('0x1d')][_0x8895('0x2b')][_0x206f57][_0x14295a],'exitAt':null},'defaults':{'channel':_0x206f57,'membername':_0x1e6395[_0x8895('0x2e')]['name'],'interface':_[_0x8895('0x11')](_0x1e6395['user'][_0x8895('0x34')])?util[_0x8895('0x30')](_0x8895('0x35'),_0x1e6395[_0x8895('0x2e')][_0x8895('0xf')]):_0x1e6395[_0x8895('0x2e')][_0x8895('0x34')],'type':'INTERACTION','enterAt':moment()['format'](_0x8895('0x31')),'role':_0x8895('0x36'),'internal':_0x1e6395['user'][_0x8895('0x37')],'uniqueid':_0x1e6395['body']['interaction'][_0x206f57][_0x14295a]}});}}}}return respondWithRpcPromise(_0x8895('0x38'),{'id':_0x1e6395['params']['id'],'capacity':_0x1e6395[_0x8895('0x1d')][_0x8895('0x39')]},routingClient)[_0x8895('0x5')](respondWithResult(_0x5e6413,null))[_0x8895('0xa')](handleError(_0x5e6413,null));};exports[_0x8895('0x3a')]=function(_0x39a1d9,_0x306481){return respondWithRpcPromise(_0x8895('0x3b'),_0x39a1d9['query'])[_0x8895('0x5')](respondWithResult(_0x306481,null))[_0x8895('0xa')](handleError(_0x306481,null));};exports[_0x8895('0x3c')]=function(_0x5a5bc6,_0x1935aa){return respondWithRpcPromise(_0x8895('0x3d'),_0x5a5bc6[_0x8895('0x16')])[_0x8895('0x5')](respondWithResult(_0x1935aa,null))[_0x8895('0xa')](handleError(_0x1935aa,null));};exports[_0x8895('0x3e')]=function(_0x434ab8,_0x216e6e){return respondWithRpcPromise(_0x8895('0x3f'),_0x434ab8[_0x8895('0x16')])['then'](respondWithResult(_0x216e6e,null))[_0x8895('0xa')](handleError(_0x216e6e,null));};exports[_0x8895('0x40')]=function(_0xb3d1ab,_0x10560a){return respondWithRpcPromise(_0x8895('0x41'),_0xb3d1ab['query'],routingClient)[_0x8895('0x5')](respondWithResult(_0x10560a,null))[_0x8895('0xa')](handleError(_0x10560a,null));};exports[_0x8895('0x42')]=function(_0x3d17bd,_0x37a7b4){return respondWithRpcPromise('ChatQueues',_0x3d17bd[_0x8895('0x16')],routingClient)[_0x8895('0x5')](findById(_0x3d17bd[_0x8895('0x19')]['id']))['then'](respondWithResult(_0x37a7b4,null))[_0x8895('0xa')](handleError(_0x37a7b4,null));};exports[_0x8895('0x43')]=function(_0x2c777b,_0x4ec8eb){return respondWithRpcPromise(_0x8895('0x44'),_0x2c777b[_0x8895('0x16')],routingClient)['then'](respondWithResult(_0x4ec8eb,null))[_0x8895('0xa')](handleError(_0x4ec8eb,null));};exports[_0x8895('0x45')]=function(_0x5198f8,_0x2f990a){return respondWithRpcPromise(_0x8895('0x44'),_0x5198f8[_0x8895('0x16')],routingClient)[_0x8895('0x5')](findById(_0x5198f8['params']['id']))['then'](respondWithResult(_0x2f990a,null))[_0x8895('0xa')](handleError(_0x2f990a,null));};exports[_0x8895('0x46')]=function(_0x49877,_0x51eb9c){return respondWithRpcPromise(_0x8895('0x47'),_0x49877[_0x8895('0x16')],mailClient)['then'](respondWithResult(_0x51eb9c,null))[_0x8895('0xa')](handleError(_0x51eb9c,null));};exports['openchannelQueues']=function(_0x435e36,_0x2bd955){return respondWithRpcPromise(_0x8895('0x48'),_0x435e36[_0x8895('0x16')],routingClient)[_0x8895('0x5')](respondWithResult(_0x2bd955,null))['catch'](handleError(_0x2bd955,null));};exports['showOpenchannelQueues']=function(_0x239401,_0x216abb){return respondWithRpcPromise('OpenchannelQueues',_0x239401[_0x8895('0x16')],routingClient)[_0x8895('0x5')](findById(_0x239401[_0x8895('0x19')]['id']))[_0x8895('0x5')](respondWithResult(_0x216abb,null))['catch'](handleError(_0x216abb,null));};exports[_0x8895('0x49')]=function(_0x2d2bf9,_0x1b1bc0){return respondWithRpcPromise(_0x8895('0x4a'),_0x2d2bf9[_0x8895('0x16')],routingClient)[_0x8895('0x5')](respondWithResult(_0x1b1bc0,null))[_0x8895('0xa')](handleError(_0x1b1bc0,null));};exports[_0x8895('0x4b')]=function(_0x2bffd7,_0x21c7bb){return respondWithRpcPromise(_0x8895('0x4a'),_0x2bffd7[_0x8895('0x16')],routingClient)[_0x8895('0x5')](findById(_0x2bffd7[_0x8895('0x19')]['id']))[_0x8895('0x5')](respondWithResult(_0x21c7bb,null))['catch'](handleError(_0x21c7bb,null));};exports['whatsappQueues']=function(_0x5b96fe,_0x13b143){return respondWithRpcPromise(_0x8895('0x4c'),_0x5b96fe[_0x8895('0x16')],routingClient)[_0x8895('0x5')](respondWithResult(_0x13b143,null))[_0x8895('0xa')](handleError(_0x13b143,null));};exports['showWhatsappQueues']=function(_0x816803,_0xc6af80){return respondWithRpcPromise('WhatsappQueues',_0x816803[_0x8895('0x16')],routingClient)[_0x8895('0x5')](findById(_0x816803[_0x8895('0x19')]['id']))[_0x8895('0x5')](respondWithResult(_0xc6af80,null))[_0x8895('0xa')](handleError(_0xc6af80,null));};exports['faxQueues']=function(_0x6440ea,_0x3c318c){return respondWithRpcPromise(_0x8895('0x4d'),_0x6440ea[_0x8895('0x16')],routingClient)[_0x8895('0x5')](respondWithResult(_0x3c318c,null))[_0x8895('0xa')](handleError(_0x3c318c,null));};exports[_0x8895('0x4e')]=function(_0x5e7048,_0x10d395){return respondWithRpcPromise(_0x8895('0x4d'),_0x5e7048['query'],routingClient)[_0x8895('0x5')](findById(_0x5e7048[_0x8895('0x19')]['id']))[_0x8895('0x5')](respondWithResult(_0x10d395,null))[_0x8895('0xa')](handleError(_0x10d395,null));};exports[_0x8895('0x4f')]=function(_0x560381,_0x16cd17){return respondWithRpcPromise('FaxAccounts',_0x560381[_0x8895('0x16')])[_0x8895('0x5')](respondWithResult(_0x16cd17,null))['catch'](handleError(_0x16cd17,null));};exports[_0x8895('0x50')]=function(_0x24f1c5,_0x140b2a){return respondWithRpcPromise(_0x8895('0x51'),_0x24f1c5['query'],routingClient)[_0x8895('0x5')](respondWithResult(_0x140b2a,null))['catch'](handleError(_0x140b2a,null));};exports['mailQueuesWaitingInteractions']=function(_0x1a198d,_0x185351){return respondWithRpcPromise(_0x8895('0x52'),_0x1a198d['query'],routingClient)[_0x8895('0x5')](respondWithResult(_0x185351,null))['catch'](handleError(_0x185351,null));};exports[_0x8895('0x53')]=function(_0x930a13,_0x3893fb){return respondWithRpcPromise(_0x8895('0x54'),_0x930a13[_0x8895('0x16')],routingClient)['then'](respondWithResult(_0x3893fb,null))['catch'](handleError(_0x3893fb,null));};exports[_0x8895('0x55')]=function(_0x5517a2,_0x3707a6){return respondWithRpcPromise(_0x8895('0x54'),_0x5517a2['query'],routingClient)[_0x8895('0x5')](function(_0xd9637a){if(_0x5517a2[_0x8895('0x16')][_0x8895('0x56')]!==undefined){var _0x166e9a=_(_0xd9637a['rows'])[_0x8895('0x57')]([_0x5517a2['query']['type'],_0x5517a2[_0x8895('0x19')]['id']])['map'](_0x8895('0x58'))[_0x8895('0x59')]()[_0x8895('0x5a')]();return _0xd9637a[_0x8895('0x12')]['filter'](function(_0x4d802e){return _0x166e9a['indexOf'](_0x4d802e[_0x8895('0x58')])>-0x1;});}else{return _0xd9637a[_0x8895('0x12')][_0x8895('0x57')](function(_0x14fd1f){return _0x14fd1f[_0x8895('0x58')]===parseInt(_0x5517a2[_0x8895('0x19')]['id']);});}})['then'](respondWithResult(_0x3707a6,null))[_0x8895('0xa')](handleError(_0x3707a6,null));};exports[_0x8895('0x5b')]=function(_0x4deccc,_0x584a1f){return respondWithRpcPromise(_0x8895('0x5c'),_0x4deccc['query'],routingClient)[_0x8895('0x5')](respondWithResult(_0x584a1f,null))['catch'](handleError(_0x584a1f,null));};exports[_0x8895('0x5d')]=function(_0x452756,_0x553437){return respondWithRpcPromise(_0x8895('0x5e'),_0x452756[_0x8895('0x16')],routingClient)['then'](respondWithResult(_0x553437,null))[_0x8895('0xa')](handleError(_0x553437,null));};exports[_0x8895('0x5f')]=function(_0x2af98f,_0xef59db){return respondWithRpcPromise(_0x8895('0x60'),_0x2af98f[_0x8895('0x16')],routingClient)[_0x8895('0x5')](respondWithResult(_0xef59db,null))['catch'](handleError(_0xef59db,null));};exports[_0x8895('0x61')]=function(_0x5ada19){return function(_0x330506,_0x1f583a){var _0x32d52c,_0x325597;var _0x4e6691=_[_0x8895('0x62')](_0x5ada19);var _0x1d50f6=_0x5ada19===_0x8895('0x63')?_0x8895('0x64'):_0x8895('0x65');return db[_0x4e6691+_0x8895('0x66')][_0x8895('0x67')]({'raw':!![],'where':{'id':_0x330506[_0x8895('0x19')]['id']}})['then'](function(_0x3b4092){if(_[_0x8895('0x11')](_0x3b4092)){throw new Error(_0x4e6691+'\x20Queue\x20not\x20found');}_0x32d52c=_0x3b4092;return db[_0x4e6691+'Message'][_0x8895('0x67')]({'where':{'id':_0x330506[_0x8895('0x1d')][_0x8895('0x68')]},'include':[{'model':db[_0x4e6691+_0x8895('0x69')],'as':'Interaction'},{'model':db[_0x4e6691+_0x1d50f6],'as':'Account'}]});})[_0x8895('0x5')](function(_0x42ebe2){if(_[_0x8895('0x11')](_0x42ebe2)){throw new Error(_0x4e6691+_0x8895('0x6a'));}_0x325597=_0x42ebe2;return _0x42ebe2[_0x8895('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2cd8b0={'uniqueid':_0x5ada19+'.'+_0x325597['id']+'.'+_0x325597[_0x8895('0x69')]['id'],'FromUserId':_0x330506['user']['id'],'type':_0x8895('0x6c')};_0x2cd8b0[_0x4e6691+_0x8895('0x6d')]=_0x325597['id'];_0x2cd8b0[_0x4e6691+_0x8895('0x6e')]=_0x325597[_0x8895('0x69')]['id'];_0x2cd8b0[_0x8895('0x6f')+_0x4e6691+_0x1d50f6+'Id']=_0x325597[_0x8895('0x65')]['id'];_0x2cd8b0['To'+_0x4e6691+'QueueId']=_0x32d52c['id'];return db[_0x4e6691+_0x8895('0x70')][_0x8895('0x71')](_0x2cd8b0);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x5ada19,'interaction':_0x325597['Interaction'],'message':_0x325597,'account':_0x325597[_0x8895('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8895('0x6c'),'appdata':_0x32d52c['name']+','+(_0x325597[_0x8895('0x65')]['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x1f583a,null))[_0x8895('0xa')](handleError(_0x1f583a,null));};};exports[_0x8895('0x72')]=function(_0x28d7ab,_0x20b607){var _0x605f47,_0x54cf18;if(_[_0x8895('0x11')](_0x28d7ab[_0x8895('0x1d')][_0x8895('0x73')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x4a4d4b=_0x28d7ab['body'][_0x8895('0x73')];var _0x1d796a=_[_0x8895('0x62')](_0x4a4d4b);var _0x2084b1=_0x4a4d4b===_0x8895('0x63')?_0x8895('0x64'):_0x8895('0x65');return db['User'][_0x8895('0x67')]({'raw':!![],'where':{'id':_0x28d7ab['params']['id'],'role':_0x8895('0x36')}})['then'](function(_0x2f2908){if(_[_0x8895('0x11')](_0x2f2908)){throw new Error(_0x8895('0x74'));}_0x605f47=_0x2f2908;return db[_0x1d796a+_0x8895('0x75')][_0x8895('0x67')]({'where':{'id':_0x28d7ab[_0x8895('0x1d')][_0x8895('0x68')]},'include':[{'model':db[_0x1d796a+'Interaction'],'as':_0x8895('0x69')},{'model':db[_0x1d796a+_0x2084b1],'as':_0x8895('0x65')}]});})[_0x8895('0x5')](function(_0x3ce240){if(_[_0x8895('0x11')](_0x3ce240)){throw new Error(_0x1d796a+'\x20Message\x20not\x20found');}_0x54cf18=_0x3ce240;return _0x3ce240[_0x8895('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x20f574={'uniqueid':_0x4a4d4b+'.'+_0x54cf18['id']+'.'+_0x54cf18[_0x8895('0x69')]['id'],'FromUserId':_0x28d7ab[_0x8895('0x2e')]['id'],'type':_0x8895('0x6c'),'ToUserId':_0x605f47['id']};_0x20f574[_0x1d796a+_0x8895('0x6d')]=_0x54cf18['id'];_0x20f574[_0x1d796a+_0x8895('0x6e')]=_0x54cf18[_0x8895('0x69')]['id'];_0x20f574[_0x8895('0x6f')+_0x1d796a+_0x2084b1+'Id']=_0x54cf18[_0x8895('0x65')]['id'];return db[_0x1d796a+'TransferReport'][_0x8895('0x71')](_0x20f574);})['then'](function(){return respondWithRpcPromise(_0x8895('0x76'),{'channel':_0x4a4d4b,'interaction':_0x54cf18[_0x8895('0x69')],'message':_0x54cf18,'account':_0x54cf18[_0x8895('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x605f47[_0x8895('0xf')]+','+(_0x54cf18['Account'][_0x8895('0x77')]||0x12c),'interval':_0x8895('0x78')}]},routingClient);})[_0x8895('0x5')](respondWithResult(_0x20b607,null))[_0x8895('0xa')](handleError(_0x20b607,null));}; \ No newline at end of file +var _0x81bd=['client','http','request','then','error','code','message','result','catch','status','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','VoiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','interface','SIP/%s','internal','AgentCapacity','capacity','telephones','Telephones','Trunks','campaigns','Campaigns','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','findOne','Message','Interaction','update','queue','InteractionId','From','QueueId','TransferReport','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','agent','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','MessageId','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api'];(function(_0x266294,_0x4abaee){var _0x1d1ac2=function(_0xfe909d){while(--_0xfe909d){_0x266294['push'](_0x266294['shift']());}};_0x1d1ac2(++_0x4abaee);}(_0x81bd,0x7c));var _0xd81b=function(_0x2a59e0,_0xc12ff){_0x2a59e0=_0x2a59e0-0x0;var _0x48813a=_0x81bd[_0x2a59e0];return _0x48813a;};'use strict';var BPromise=require(_0xd81b('0x0'));var moment=require(_0xd81b('0x1'));var _=require(_0xd81b('0x2'));var util=require(_0xd81b('0x3'));var db=require(_0xd81b('0x4'))['db'];var logger=require(_0xd81b('0x5'))(_0xd81b('0x6'));var jayson=require('jayson/promise');var amiClient=jayson[_0xd81b('0x7')][_0xd81b('0x8')]({'port':0x232a});var mailClient=jayson[_0xd81b('0x7')]['http']({'port':0x232b});var routingClient=jayson[_0xd81b('0x7')][_0xd81b('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x1f3f2c,_0x562084,_0x5e14e8){return new BPromise(function(_0xa4cf97,_0x5468d5){var _0x223515=_0x5e14e8?_0x5e14e8:amiClient;return _0x223515[_0xd81b('0x9')](_0x1f3f2c,_0x562084)[_0xd81b('0xa')](function(_0x86dab6){if(_0x86dab6[_0xd81b('0xb')]){if(_0x86dab6[_0xd81b('0xb')][_0xd81b('0xc')]===0x1f4){return _0x5468d5(_0x86dab6[_0xd81b('0xb')][_0xd81b('0xd')]);}return _0xa4cf97(_0x86dab6[_0xd81b('0xb')][_0xd81b('0xd')]);}else{_0xa4cf97(_0x86dab6[_0xd81b('0xe')]);}})[_0xd81b('0xf')](function(_0x560530){_0x5468d5(_0x560530);});});}function respondWithResult(_0x21dfff,_0x57f71d){_0x57f71d=_0x57f71d||0xc8;return function(_0x3f2405){if(_0x3f2405){return _0x21dfff[_0xd81b('0x10')](_0x57f71d)['json'](_0x3f2405);}return _0x21dfff[_0xd81b('0x11')](0x194);};}function handleError(_0x47dd04,_0x13dd00){_0x13dd00=_0x13dd00||0x1f4;return function(_0x41bf7a){logger[_0xd81b('0xb')](_0x41bf7a[_0xd81b('0x12')]);if(_0x41bf7a[_0xd81b('0x13')]){delete _0x41bf7a['name'];}_0x47dd04[_0xd81b('0x10')](_0x13dd00)[_0xd81b('0x14')](_0x41bf7a);};}function findById(_0x5c2863){return function(_0x2abef4){if(!_[_0xd81b('0x15')](_0x5c2863)&&!_[_0xd81b('0x15')](_0x2abef4)&&!_[_0xd81b('0x15')](_0x2abef4[_0xd81b('0x16')])){return _[_0xd81b('0x17')](_0x2abef4[_0xd81b('0x16')],function(_0x3d4d34){return _0x3d4d34['id']==_0x5c2863;});}return null;};}exports[_0xd81b('0x18')]=function(_0x285164,_0x1ff3c6){return respondWithRpcPromise(_0xd81b('0x19'),_0x285164[_0xd81b('0x1a')])[_0xd81b('0xa')](respondWithResult(_0x1ff3c6,null))[_0xd81b('0xf')](handleError(_0x1ff3c6,null));};exports[_0xd81b('0x1b')]=function(_0x5f101a,_0x4d566e){return respondWithRpcPromise(_0xd81b('0x1c'),_[_0xd81b('0x1d')](_0x5f101a[_0xd81b('0x1a')],_0x5f101a['params']))[_0xd81b('0xa')](respondWithResult(_0x4d566e,null))[_0xd81b('0xf')](handleError(_0x4d566e,null));};exports['voiceChannelStopMixMonitor']=function(_0xcd6474,_0x13d687){return respondWithRpcPromise(_0xd81b('0x1e'),_[_0xd81b('0x1d')](_0xcd6474[_0xd81b('0x1a')],_0xcd6474[_0xd81b('0x1f')]))[_0xd81b('0xa')](respondWithResult(_0x13d687,null))[_0xd81b('0xf')](handleError(_0x13d687,null));};exports[_0xd81b('0x20')]=function(_0x212c4e,_0x2ccedf){return respondWithRpcPromise(_0xd81b('0x21'),_0x212c4e['query'])[_0xd81b('0xa')](respondWithResult(_0x2ccedf,null))[_0xd81b('0xf')](handleError(_0x2ccedf,null));};exports[_0xd81b('0x22')]=function(_0x31b9fd,_0x3266c2){return respondWithRpcPromise(_0xd81b('0x21'),_0x31b9fd[_0xd81b('0x1a')])[_0xd81b('0xa')](findById(_0x31b9fd[_0xd81b('0x1f')]['id']))['then'](respondWithResult(_0x3266c2,null))[_0xd81b('0xf')](handleError(_0x3266c2,null));};exports['updateVoiceQueue']=function(_0x5c8aee,_0xb9ff9f){return respondWithRpcPromise(_0xd81b('0x23'),_['merge'](_0x5c8aee['body'],_0x5c8aee[_0xd81b('0x1f')]))[_0xd81b('0xa')](respondWithResult(_0xb9ff9f,null))[_0xd81b('0xf')](handleError(_0xb9ff9f,null));};exports[_0xd81b('0x24')]=function(_0x1a1572,_0x4654ba){return respondWithRpcPromise('VoiceQueuesPreview',_[_0xd81b('0x1d')](_0x1a1572[_0xd81b('0x1a')],_0x1a1572['params']))['then'](respondWithResult(_0x4654ba,null))[_0xd81b('0xf')](handleError(_0x4654ba,null));};exports[_0xd81b('0x25')]=function(_0x50472a,_0x50ce25){return respondWithRpcPromise('VoiceQueuesChannels',_0x50472a[_0xd81b('0x1a')])[_0xd81b('0xa')](respondWithResult(_0x50ce25,null))[_0xd81b('0xf')](handleError(_0x50ce25,null));};exports[_0xd81b('0x26')]=function(_0xa56339,_0x12ee8f){return respondWithRpcPromise(_0xd81b('0x27'),_['merge'](_0xa56339[_0xd81b('0x1a')],_0xa56339['params']))[_0xd81b('0xa')](respondWithResult(_0x12ee8f,null))[_0xd81b('0xf')](handleError(_0x12ee8f,null));};exports[_0xd81b('0x28')]=function(_0xcd9e86,_0x36c69f){return respondWithRpcPromise(_0xd81b('0x29'),_[_0xd81b('0x1d')](_0xcd9e86[_0xd81b('0x1a')],_0xcd9e86[_0xd81b('0x1f')]))[_0xd81b('0xa')](respondWithResult(_0x36c69f,null))[_0xd81b('0xf')](handleError(_0x36c69f,null));};exports[_0xd81b('0x2a')]=function(_0x346038,_0x57bc0c){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xd81b('0x1d')](_0x346038[_0xd81b('0x1a')],_0x346038[_0xd81b('0x1f')]))['then'](respondWithResult(_0x57bc0c,null))[_0xd81b('0xf')](handleError(_0x57bc0c,null));};exports[_0xd81b('0x2b')]=function(_0x5a236a,_0x46f058){return respondWithRpcPromise(_0xd81b('0x2c'),_0x5a236a['query'])[_0xd81b('0xa')](respondWithResult(_0x46f058,null))['catch'](handleError(_0x46f058,null));};exports[_0xd81b('0x2d')]=function(_0x2502d1,_0x203365){return respondWithRpcPromise(_0xd81b('0x2e'),_0x2502d1['query'])[_0xd81b('0xa')](respondWithResult(_0x203365,null))[_0xd81b('0xf')](handleError(_0x203365,null));};exports[_0xd81b('0x2f')]=function(_0x67fbe5,_0x3abd60){var _0x466e98;return respondWithRpcPromise(_0xd81b('0x30'),_0x67fbe5['query'])[_0xd81b('0xa')](function(_0x35a295){_0x466e98=_0x35a295;return respondWithRpcPromise(_0xd81b('0x30'),_0x67fbe5['query'],routingClient);})[_0xd81b('0xa')](function(_0x3a05f4){return _[_0xd81b('0x1d')]({},_0x3a05f4,_0x466e98);})[_0xd81b('0xa')](respondWithResult(_0x3abd60,null))[_0xd81b('0xf')](handleError(_0x3abd60,null));};exports['agentCapacity']=function(_0x3dfba7,_0x11d617){if(_0x3dfba7[_0xd81b('0x31')]&&_0x3dfba7[_0xd81b('0x31')][_0xd81b('0x32')]&&_0x3dfba7[_0xd81b('0x33')]&&_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x13')]){for(var _0x4405a8 in _0x3dfba7[_0xd81b('0x31')][_0xd81b('0x32')]){if(_0x3dfba7['body'][_0xd81b('0x32')][_0xd81b('0x34')](_0x4405a8)){db[_0xd81b('0x35')][_0xd81b('0x36')]({'where':{'channel':_0x4405a8,'membername':_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x13')],'type':_0xd81b('0x37'),'exitAt':null,'uniqueid':_0x3dfba7[_0xd81b('0x31')]['interaction'][_0x4405a8]&&_0x3dfba7['body'][_0xd81b('0x32')][_0x4405a8][_0xd81b('0x38')]?{'$notIn':_0x3dfba7[_0xd81b('0x31')][_0xd81b('0x32')][_0x4405a8]}:{'$ne':null}}})[_0xd81b('0xa')](function(_0x37031b){var _0x334bd0=moment()[_0xd81b('0x39')](_0xd81b('0x3a'));for(var _0xcfbbc2=0x0,_0x41e2e6=_0x37031b[_0xd81b('0x38')];_0xcfbbc2<_0x41e2e6;_0xcfbbc2+=0x1){_0x37031b[_0xcfbbc2]['updateAttributes']({'exitAt':_0x334bd0});}});for(var _0x27d18a=0x0;_0x27d18a<_0x3dfba7[_0xd81b('0x31')][_0xd81b('0x32')][_0x4405a8][_0xd81b('0x38')];_0x27d18a+=0x1){db[_0xd81b('0x35')][_0xd81b('0x3b')]({'where':{'channel':_0x4405a8,'membername':_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x13')],'type':_0xd81b('0x37'),'uniqueid':_0x3dfba7['body'][_0xd81b('0x32')][_0x4405a8][_0x27d18a],'exitAt':null},'defaults':{'channel':_0x4405a8,'membername':_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x13')],'interface':_[_0xd81b('0x15')](_0x3dfba7['user'][_0xd81b('0x3c')])?util[_0xd81b('0x39')](_0xd81b('0x3d'),_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x13')]):_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x3c')],'type':_0xd81b('0x37'),'enterAt':moment()[_0xd81b('0x39')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x3e')],'uniqueid':_0x3dfba7[_0xd81b('0x31')][_0xd81b('0x32')][_0x4405a8][_0x27d18a]}});}}}}return respondWithRpcPromise(_0xd81b('0x3f'),{'id':_0x3dfba7[_0xd81b('0x1f')]['id'],'capacity':_0x3dfba7[_0xd81b('0x31')][_0xd81b('0x40')]},routingClient)['then'](respondWithResult(_0x11d617,null))[_0xd81b('0xf')](handleError(_0x11d617,null));};exports[_0xd81b('0x41')]=function(_0x1b523c,_0x3d171a){return respondWithRpcPromise(_0xd81b('0x42'),_0x1b523c['query'])[_0xd81b('0xa')](respondWithResult(_0x3d171a,null))[_0xd81b('0xf')](handleError(_0x3d171a,null));};exports['trunks']=function(_0x1f13c3,_0x315bd5){return respondWithRpcPromise(_0xd81b('0x43'),_0x1f13c3[_0xd81b('0x1a')])[_0xd81b('0xa')](respondWithResult(_0x315bd5,null))[_0xd81b('0xf')](handleError(_0x315bd5,null));};exports[_0xd81b('0x44')]=function(_0x22f588,_0x3ed626){return respondWithRpcPromise(_0xd81b('0x45'),_0x22f588[_0xd81b('0x1a')])['then'](respondWithResult(_0x3ed626,null))[_0xd81b('0xf')](handleError(_0x3ed626,null));};exports['chatQueues']=function(_0x1800fa,_0x7b438c){return respondWithRpcPromise(_0xd81b('0x46'),_0x1800fa[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x7b438c,null))[_0xd81b('0xf')](handleError(_0x7b438c,null));};exports['showChatQueues']=function(_0x2d978d,_0xe0c9c6){return respondWithRpcPromise('ChatQueues',_0x2d978d['query'],routingClient)[_0xd81b('0xa')](findById(_0x2d978d['params']['id']))[_0xd81b('0xa')](respondWithResult(_0xe0c9c6,null))['catch'](handleError(_0xe0c9c6,null));};exports[_0xd81b('0x47')]=function(_0x315a66,_0x3d97ba){return respondWithRpcPromise('MailQueues',_0x315a66[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x3d97ba,null))['catch'](handleError(_0x3d97ba,null));};exports[_0xd81b('0x48')]=function(_0x108aaf,_0x5951ec){return respondWithRpcPromise(_0xd81b('0x49'),_0x108aaf['query'],routingClient)[_0xd81b('0xa')](findById(_0x108aaf[_0xd81b('0x1f')]['id']))[_0xd81b('0xa')](respondWithResult(_0x5951ec,null))[_0xd81b('0xf')](handleError(_0x5951ec,null));};exports[_0xd81b('0x4a')]=function(_0x32eab4,_0x2f2afe){return respondWithRpcPromise(_0xd81b('0x4b'),_0x32eab4[_0xd81b('0x1a')],mailClient)[_0xd81b('0xa')](respondWithResult(_0x2f2afe,null))['catch'](handleError(_0x2f2afe,null));};exports[_0xd81b('0x4c')]=function(_0x434434,_0x385841){return respondWithRpcPromise(_0xd81b('0x4d'),_0x434434[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x385841,null))[_0xd81b('0xf')](handleError(_0x385841,null));};exports['showOpenchannelQueues']=function(_0x57f0fb,_0x5de22d){return respondWithRpcPromise(_0xd81b('0x4d'),_0x57f0fb[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](findById(_0x57f0fb[_0xd81b('0x1f')]['id']))[_0xd81b('0xa')](respondWithResult(_0x5de22d,null))[_0xd81b('0xf')](handleError(_0x5de22d,null));};exports[_0xd81b('0x4e')]=function(_0x5afecf,_0x3fcd8c){return respondWithRpcPromise(_0xd81b('0x4f'),_0x5afecf[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x3fcd8c,null))[_0xd81b('0xf')](handleError(_0x3fcd8c,null));};exports[_0xd81b('0x50')]=function(_0xb5fca8,_0x4ed17d){return respondWithRpcPromise(_0xd81b('0x4f'),_0xb5fca8[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](findById(_0xb5fca8[_0xd81b('0x1f')]['id']))[_0xd81b('0xa')](respondWithResult(_0x4ed17d,null))[_0xd81b('0xf')](handleError(_0x4ed17d,null));};exports[_0xd81b('0x51')]=function(_0x19d4f0,_0x8fa8cd){return respondWithRpcPromise(_0xd81b('0x52'),_0x19d4f0[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x8fa8cd,null))['catch'](handleError(_0x8fa8cd,null));};exports[_0xd81b('0x53')]=function(_0x5358a6,_0x2e7141){return respondWithRpcPromise(_0xd81b('0x52'),_0x5358a6[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](findById(_0x5358a6[_0xd81b('0x1f')]['id']))[_0xd81b('0xa')](respondWithResult(_0x2e7141,null))[_0xd81b('0xf')](handleError(_0x2e7141,null));};exports[_0xd81b('0x54')]=function(_0x10d6d2,_0x36fb7a){return respondWithRpcPromise('FaxQueues',_0x10d6d2[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x36fb7a,null))[_0xd81b('0xf')](handleError(_0x36fb7a,null));};exports[_0xd81b('0x55')]=function(_0x7720d3,_0x5abbb4){return respondWithRpcPromise('FaxQueues',_0x7720d3[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](findById(_0x7720d3[_0xd81b('0x1f')]['id']))[_0xd81b('0xa')](respondWithResult(_0x5abbb4,null))[_0xd81b('0xf')](handleError(_0x5abbb4,null));};exports[_0xd81b('0x56')]=function(_0xaee7e3,_0x539132){return respondWithRpcPromise(_0xd81b('0x57'),_0xaee7e3[_0xd81b('0x1a')])[_0xd81b('0xa')](respondWithResult(_0x539132,null))[_0xd81b('0xf')](handleError(_0x539132,null));};exports[_0xd81b('0x58')]=function(_0x21d039,_0x1e0da3){return respondWithRpcPromise(_0xd81b('0x59'),_0x21d039[_0xd81b('0x1a')],routingClient)['then'](respondWithResult(_0x1e0da3,null))[_0xd81b('0xf')](handleError(_0x1e0da3,null));};exports[_0xd81b('0x5a')]=function(_0x3858eb,_0x9c30e7){return respondWithRpcPromise(_0xd81b('0x5b'),_0x3858eb['query'],routingClient)[_0xd81b('0xa')](respondWithResult(_0x9c30e7,null))[_0xd81b('0xf')](handleError(_0x9c30e7,null));};exports['openchannelQueuesWaitingInteractions']=function(_0xa00645,_0x43e593){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0xa00645[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x43e593,null))[_0xd81b('0xf')](handleError(_0x43e593,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x2aff4b,_0x3db4d7){return respondWithRpcPromise(_0xd81b('0x5c'),_0x2aff4b['query'],routingClient)['then'](function(_0xdd970d){if(_0x2aff4b[_0xd81b('0x1a')][_0xd81b('0x5d')]!==undefined){var _0x5d601d=_(_0xdd970d[_0xd81b('0x16')])[_0xd81b('0x5e')]([_0x2aff4b[_0xd81b('0x1a')][_0xd81b('0x5d')],_0x2aff4b['params']['id']])['map'](_0xd81b('0x5f'))[_0xd81b('0x60')]()[_0xd81b('0x61')]();return _0xdd970d[_0xd81b('0x16')]['filter'](function(_0x1b8b17){return _0x5d601d[_0xd81b('0x62')](_0x1b8b17['queue_id'])>-0x1;});}else{return _0xdd970d[_0xd81b('0x16')]['filter'](function(_0x32a8f4){return _0x32a8f4[_0xd81b('0x5f')]===parseInt(_0x2aff4b['params']['id']);});}})[_0xd81b('0xa')](respondWithResult(_0x3db4d7,null))[_0xd81b('0xf')](handleError(_0x3db4d7,null));};exports[_0xd81b('0x63')]=function(_0x2490f1,_0x2b0fe4){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2490f1[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x2b0fe4,null))[_0xd81b('0xf')](handleError(_0x2b0fe4,null));};exports[_0xd81b('0x64')]=function(_0x1919b2,_0x2b1d96){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x1919b2['query'],routingClient)[_0xd81b('0xa')](respondWithResult(_0x2b1d96,null))[_0xd81b('0xf')](handleError(_0x2b1d96,null));};exports[_0xd81b('0x65')]=function(_0x15aed5,_0x4dd8ac){return respondWithRpcPromise(_0xd81b('0x66'),_0x15aed5[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x4dd8ac,null))[_0xd81b('0xf')](handleError(_0x4dd8ac,null));};exports[_0xd81b('0x67')]=function(_0x589882){return function(_0x3744bf,_0x374ac0){var _0x159b28,_0x40b468;var _0x1d596c=_[_0xd81b('0x68')](_0x589882);var _0x402eb9=_0x589882==='chat'?_0xd81b('0x69'):_0xd81b('0x6a');return db[_0x1d596c+_0xd81b('0x6b')][_0xd81b('0x6c')]({'raw':!![],'where':{'id':_0x3744bf[_0xd81b('0x1f')]['id']}})[_0xd81b('0xa')](function(_0x59bee6){if(_[_0xd81b('0x15')](_0x59bee6)){throw new Error(_0x1d596c+'\x20Queue\x20not\x20found');}_0x159b28=_0x59bee6;return db[_0x1d596c+_0xd81b('0x6d')][_0xd81b('0x6c')]({'where':{'id':_0x3744bf[_0xd81b('0x31')]['messageId']},'include':[{'model':db[_0x1d596c+_0xd81b('0x6e')],'as':_0xd81b('0x6e')},{'model':db[_0x1d596c+_0x402eb9],'as':_0xd81b('0x6a')}]});})[_0xd81b('0xa')](function(_0x254105){if(_[_0xd81b('0x15')](_0x254105)){throw new Error(_0x1d596c+'\x20Message\x20not\x20found');}_0x40b468=_0x254105;return _0x254105[_0xd81b('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5f5514={'uniqueid':_0x589882+'.'+_0x40b468['id']+'.'+_0x40b468[_0xd81b('0x6e')]['id'],'FromUserId':_0x3744bf[_0xd81b('0x33')]['id'],'type':_0xd81b('0x70')};_0x5f5514[_0x1d596c+'MessageId']=_0x40b468['id'];_0x5f5514[_0x1d596c+_0xd81b('0x71')]=_0x40b468[_0xd81b('0x6e')]['id'];_0x5f5514[_0xd81b('0x72')+_0x1d596c+_0x402eb9+'Id']=_0x40b468[_0xd81b('0x6a')]['id'];_0x5f5514['To'+_0x1d596c+_0xd81b('0x73')]=_0x159b28['id'];return db[_0x1d596c+_0xd81b('0x74')]['create'](_0x5f5514);})[_0xd81b('0xa')](function(){return respondWithRpcPromise(_0xd81b('0x75'),{'channel':_0x589882,'interaction':_0x40b468[_0xd81b('0x6e')],'message':_0x40b468,'account':_0x40b468[_0xd81b('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd81b('0x70'),'appdata':_0x159b28[_0xd81b('0x13')]+','+(_0x40b468[_0xd81b('0x6a')][_0xd81b('0x76')]||0x12c),'interval':_0xd81b('0x77')}]},routingClient);})[_0xd81b('0xa')](respondWithResult(_0x374ac0,null))[_0xd81b('0xf')](handleError(_0x374ac0,null));};};exports[_0xd81b('0x78')]=function(_0x42eb62,_0x2c19fd){var _0x36d8fd,_0x5adfe4;if(_[_0xd81b('0x15')](_0x42eb62['body'][_0xd81b('0x79')])){throw new Error(_0xd81b('0x7a'));}var _0x1ca94b=_0x42eb62[_0xd81b('0x31')][_0xd81b('0x79')];var _0x115805=_['capitalize'](_0x1ca94b);var _0x3a41e6=_0x1ca94b===_0xd81b('0x7b')?_0xd81b('0x69'):_0xd81b('0x6a');return db[_0xd81b('0x7c')][_0xd81b('0x6c')]({'raw':!![],'where':{'id':_0x42eb62[_0xd81b('0x1f')]['id'],'role':_0xd81b('0x7d')}})[_0xd81b('0xa')](function(_0xfacc8f){if(_[_0xd81b('0x15')](_0xfacc8f)){throw new Error(_0xd81b('0x7e'));}_0x36d8fd=_0xfacc8f;return db[_0x115805+'Message'][_0xd81b('0x6c')]({'where':{'id':_0x42eb62[_0xd81b('0x31')][_0xd81b('0x7f')]},'include':[{'model':db[_0x115805+_0xd81b('0x6e')],'as':_0xd81b('0x6e')},{'model':db[_0x115805+_0x3a41e6],'as':'Account'}]});})[_0xd81b('0xa')](function(_0x1e61d8){if(_[_0xd81b('0x15')](_0x1e61d8)){throw new Error(_0x115805+_0xd81b('0x80'));}_0x5adfe4=_0x1e61d8;return _0x1e61d8[_0xd81b('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd81b('0xa')](function(){var _0x4e4919={'uniqueid':_0x1ca94b+'.'+_0x5adfe4['id']+'.'+_0x5adfe4[_0xd81b('0x6e')]['id'],'FromUserId':_0x42eb62['user']['id'],'type':_0xd81b('0x70'),'ToUserId':_0x36d8fd['id']};_0x4e4919[_0x115805+_0xd81b('0x81')]=_0x5adfe4['id'];_0x4e4919[_0x115805+_0xd81b('0x71')]=_0x5adfe4[_0xd81b('0x6e')]['id'];_0x4e4919['From'+_0x115805+_0x3a41e6+'Id']=_0x5adfe4[_0xd81b('0x6a')]['id'];return db[_0x115805+_0xd81b('0x74')]['create'](_0x4e4919);})[_0xd81b('0xa')](function(){return respondWithRpcPromise(_0xd81b('0x75'),{'channel':_0x1ca94b,'interaction':_0x5adfe4[_0xd81b('0x6e')],'message':_0x5adfe4,'account':_0x5adfe4[_0xd81b('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd81b('0x7d'),'appdata':_0x36d8fd['name']+','+(_0x5adfe4['Account'][_0xd81b('0x82')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xd81b('0xa')](respondWithResult(_0x2c19fd,null))['catch'](handleError(_0x2c19fd,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index c63e9f2..e058157 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 _0x1714=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','/:id','isAuthenticated','show','/:id/run','post','create','put','update','delete','destroy','util'];(function(_0x5b825e,_0x10f033){var _0x29f4f2=function(_0x533e5f){while(--_0x533e5f){_0x5b825e['push'](_0x5b825e['shift']());}};_0x29f4f2(++_0x10f033);}(_0x1714,0xe6));var _0x4171=function(_0x5d1d1a,_0x28b8e0){_0x5d1d1a=_0x5d1d1a-0x0;var _0x29f1ba=_0x1714[_0x5d1d1a];return _0x29f1ba;};'use strict';var multer=require('multer');var util=require(_0x4171('0x0'));var path=require(_0x4171('0x1'));var timeout=require(_0x4171('0x2'));var express=require(_0x4171('0x3'));var router=express[_0x4171('0x4')]();var fs_extra=require(_0x4171('0x5'));var auth=require(_0x4171('0x6'));var interaction=require(_0x4171('0x7'));var config=require(_0x4171('0x8'));var controller=require(_0x4171('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4171('0xa')](_0x4171('0xb'),auth[_0x4171('0xc')](),controller[_0x4171('0xd')]);router['get'](_0x4171('0xe'),auth['isAuthenticated'](),controller['run']);router[_0x4171('0xf')]('/',auth[_0x4171('0xc')](),controller[_0x4171('0x10')]);router[_0x4171('0x11')]('/:id',auth[_0x4171('0xc')](),controller[_0x4171('0x12')]);router[_0x4171('0x13')](_0x4171('0xb'),auth[_0x4171('0xc')](),controller[_0x4171('0x14')]);module['exports']=router; \ No newline at end of file +var _0x653a=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/run','run','create','update','delete','/:id','destroy','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4ac6bf,_0x5a575c){var _0x512540=function(_0x1e044e){while(--_0x1e044e){_0x4ac6bf['push'](_0x4ac6bf['shift']());}};_0x512540(++_0x5a575c);}(_0x653a,0x13d));var _0xa653=function(_0x3bafe6,_0x3432b7){_0x3bafe6=_0x3bafe6-0x0;var _0x30bc43=_0x653a[_0x3bafe6];return _0x30bc43;};'use strict';var multer=require('multer');var util=require(_0xa653('0x0'));var path=require(_0xa653('0x1'));var timeout=require(_0xa653('0x2'));var express=require(_0xa653('0x3'));var router=express[_0xa653('0x4')]();var fs_extra=require(_0xa653('0x5'));var auth=require(_0xa653('0x6'));var interaction=require(_0xa653('0x7'));var config=require(_0xa653('0x8'));var controller=require('./schedule.controller');router[_0xa653('0x9')]('/',auth[_0xa653('0xa')](),controller[_0xa653('0xb')]);router[_0xa653('0x9')]('/:id',auth[_0xa653('0xa')](),controller['show']);router['get'](_0xa653('0xc'),auth['isAuthenticated'](),controller[_0xa653('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa653('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xa653('0xf')]);router[_0xa653('0x10')](_0xa653('0x11'),auth[_0xa653('0xa')](),controller[_0xa653('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 5ef040f..6d5a428 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 _0x9ca4=['STRING','BOOLEAN','DATE','ENUM','years','quarters','months','weeks','days','hours','pdf','xlsx','csv','custom','default','TEXT','sequelize','exports'];(function(_0x17db61,_0x364236){var _0x7ac96b=function(_0x329bf4){while(--_0x329bf4){_0x17db61['push'](_0x17db61['shift']());}};_0x7ac96b(++_0x364236);}(_0x9ca4,0xd6));var _0x49ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ca4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x49ca('0x0'));module[_0x49ca('0x1')]={'name':{'type':Sequelize[_0x49ca('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x49ca('0x2')]},'active':{'type':Sequelize[_0x49ca('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x49ca('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x49ca('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x49ca('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x49ca('0x5')](_0x49ca('0x6'),_0x49ca('0x7'),_0x49ca('0x8'),_0x49ca('0x9'),_0x49ca('0xa'),_0x49ca('0xb'),'minutes'),'allowNull':![],'defaultValue':_0x49ca('0xa')},'output':{'type':Sequelize[_0x49ca('0x5')]('csv',_0x49ca('0xc'),_0x49ca('0xd')),'allowNull':![],'defaultValue':_0x49ca('0xe')},'type':{'type':Sequelize[_0x49ca('0x5')](_0x49ca('0xf'),_0x49ca('0x10')),'allowNull':![],'defaultValue':_0x49ca('0xf')},'sendMail':{'type':Sequelize[_0x49ca('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x49ca('0x2')]},'cc':{'type':Sequelize[_0x49ca('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x49ca('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8bc3=['days','hours','minutes','csv','xlsx','default','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','weeks'];(function(_0x1cb251,_0x23f6d3){var _0x1b836d=function(_0xb2e116){while(--_0xb2e116){_0x1cb251['push'](_0x1cb251['shift']());}};_0x1b836d(++_0x23f6d3);}(_0x8bc3,0x171));var _0x38bc=function(_0x5daebd,_0x134fb6){_0x5daebd=_0x5daebd-0x0;var _0x30bb10=_0x8bc3[_0x5daebd];return _0x30bb10;};'use strict';var Sequelize=require(_0x38bc('0x0'));module[_0x38bc('0x1')]={'name':{'type':Sequelize[_0x38bc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x38bc('0x2')]},'active':{'type':Sequelize[_0x38bc('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x38bc('0x2')],'allowNull':![],'defaultValue':_0x38bc('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x38bc('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x38bc('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x38bc('0x7')](_0x38bc('0x8'),_0x38bc('0x9'),'months',_0x38bc('0xa'),_0x38bc('0xb'),_0x38bc('0xc'),_0x38bc('0xd')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM'](_0x38bc('0xe'),'pdf',_0x38bc('0xf')),'allowNull':![],'defaultValue':_0x38bc('0xe')},'type':{'type':Sequelize[_0x38bc('0x7')]('custom',_0x38bc('0x10')),'allowNull':![],'defaultValue':_0x38bc('0x11')},'sendMail':{'type':Sequelize[_0x38bc('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x38bc('0x2')]},'cc':{'type':Sequelize[_0x38bc('0x12')]},'bcc':{'type':Sequelize[_0x38bc('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x38bc('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index d1e82f4..b92aac6 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 _0xbd03=['fields','length','nolimit','order','sort','pick','where','options','includeAll','include','rows','params','keys','merge','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','find','userProfileId','../../config/schedule','run','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Schedule','rawAttributes','fieldName','type','model','query','filters','attributes','intersection'];(function(_0x51379e,_0x39b9e9){var _0xdee903=function(_0x39820e){while(--_0x39820e){_0x51379e['push'](_0x51379e['shift']());}};_0xdee903(++_0x39b9e9);}(_0xbd03,0x15d));var _0x3bd0=function(_0x5ecadc,_0x1cf9f1){_0x5ecadc=_0x5ecadc-0x0;var _0x565037=_0xbd03[_0x5ecadc];return _0x565037;};'use strict';var emlformat=require(_0x3bd0('0x0'));var rimraf=require(_0x3bd0('0x1'));var zipdir=require(_0x3bd0('0x2'));var jsonpatch=require(_0x3bd0('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3bd0('0x4'));var Mustache=require(_0x3bd0('0x5'));var util=require(_0x3bd0('0x6'));var path=require(_0x3bd0('0x7'));var sox=require(_0x3bd0('0x8'));var csv=require(_0x3bd0('0x9'));var ejs=require(_0x3bd0('0xa'));var fs=require('fs');var fs_extra=require(_0x3bd0('0xb'));var _=require('lodash');var squel=require(_0x3bd0('0xc'));var crypto=require(_0x3bd0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3bd0('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3bd0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3bd0('0x10'));var as=require(_0x3bd0('0x11'));var hardwareService=require(_0x3bd0('0x12'));var logger=require(_0x3bd0('0x13'))(_0x3bd0('0x14'));var utils=require(_0x3bd0('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3bd0('0x16'));var db=require(_0x3bd0('0x17'))['db'];function respondWithStatusCode(_0x46f614,_0x58d452){_0x58d452=_0x58d452||0xcc;return function(_0x57ac94){if(_0x57ac94){return _0x46f614[_0x3bd0('0x18')](_0x58d452);}return _0x46f614[_0x3bd0('0x19')](_0x58d452)[_0x3bd0('0x1a')]();};}function respondWithResult(_0x486c00,_0xd39068){_0xd39068=_0xd39068||0xc8;return function(_0x32291a){if(_0x32291a){return _0x486c00[_0x3bd0('0x19')](_0xd39068)[_0x3bd0('0x1b')](_0x32291a);}};}function respondWithFilteredResult(_0x7aee6c,_0x1fc349){return function(_0x570786){if(_0x570786){var _0x5c5551=typeof _0x1fc349[_0x3bd0('0x1c')]===_0x3bd0('0x1d')&&typeof _0x1fc349[_0x3bd0('0x1e')]===_0x3bd0('0x1d');var _0x4f48b0=_0x570786[_0x3bd0('0x1f')];var _0x5ad3ef=_0x5c5551?0x0:_0x1fc349[_0x3bd0('0x1c')];var _0x2a8889=_0x5c5551?_0x570786[_0x3bd0('0x1f')]:_0x1fc349['offset']+_0x1fc349[_0x3bd0('0x1e')];var _0x3276b2;if(_0x2a8889>=_0x4f48b0){_0x2a8889=_0x4f48b0;_0x3276b2=0xc8;}else{_0x3276b2=0xce;}_0x7aee6c[_0x3bd0('0x19')](_0x3276b2);return _0x7aee6c[_0x3bd0('0x20')](_0x3bd0('0x21'),_0x5ad3ef+'-'+_0x2a8889+'/'+_0x4f48b0)[_0x3bd0('0x1b')](_0x570786);}return null;};}function patchUpdates(_0x1a2ba2){return function(_0x244e88){try{jsonpatch[_0x3bd0('0x22')](_0x244e88,_0x1a2ba2,!![]);}catch(_0x167d97){return BPromise[_0x3bd0('0x23')](_0x167d97);}return _0x244e88[_0x3bd0('0x24')]();};}function saveUpdates(_0x1798ee,_0x374963){return function(_0x198810){if(_0x198810){return _0x198810[_0x3bd0('0x25')](_0x1798ee)[_0x3bd0('0x26')](function(_0x4cb4ea){return _0x4cb4ea;});}return null;};}function removeEntity(_0x220591,_0x5d5a9a){return function(_0xbe59a0){if(_0xbe59a0){return _0xbe59a0[_0x3bd0('0x27')]()[_0x3bd0('0x26')](function(){var _0x41630f=_0xbe59a0[_0x3bd0('0x28')]({'plain':!![]});var _0x3959e2='Scheduler';return db[_0x3bd0('0x29')][_0x3bd0('0x27')]({'where':{'type':_0x3959e2,'resourceId':_0x41630f['id']}})[_0x3bd0('0x26')](function(){return _0xbe59a0;});})[_0x3bd0('0x26')](function(){_0x220591[_0x3bd0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d6b42,_0x4d9289){return function(_0x182084){if(!_0x182084){_0x2d6b42['sendStatus'](0x194);}return _0x182084;};}function handleError(_0x3b2f2e,_0xe746ac){_0xe746ac=_0xe746ac||0x1f4;return function(_0x22bedc){logger[_0x3bd0('0x2a')](_0x22bedc[_0x3bd0('0x2b')]);if(_0x22bedc['name']){delete _0x22bedc[_0x3bd0('0x2c')];}_0x3b2f2e['status'](_0xe746ac)[_0x3bd0('0x2d')](_0x22bedc);};}exports[_0x3bd0('0x2e')]=function(_0x25c63f,_0x481d79){var _0x4281e1={},_0xcdc646={},_0x1f2e59={'count':0x0,'rows':[]};var _0x93d665=_['map'](db[_0x3bd0('0x2f')][_0x3bd0('0x30')],function(_0x160b84){return{'name':_0x160b84[_0x3bd0('0x31')],'type':_0x160b84[_0x3bd0('0x32')]['key']};});_0xcdc646[_0x3bd0('0x33')]=_['map'](_0x93d665,_0x3bd0('0x2c'));_0xcdc646['query']=_['keys'](_0x25c63f[_0x3bd0('0x34')]);_0xcdc646[_0x3bd0('0x35')]=_['intersection'](_0xcdc646[_0x3bd0('0x33')],_0xcdc646['query']);_0x4281e1[_0x3bd0('0x36')]=_[_0x3bd0('0x37')](_0xcdc646[_0x3bd0('0x33')],qs[_0x3bd0('0x38')](_0x25c63f[_0x3bd0('0x34')][_0x3bd0('0x38')]));_0x4281e1[_0x3bd0('0x36')]=_0x4281e1[_0x3bd0('0x36')][_0x3bd0('0x39')]?_0x4281e1[_0x3bd0('0x36')]:_0xcdc646[_0x3bd0('0x33')];if(!_0x25c63f[_0x3bd0('0x34')]['hasOwnProperty'](_0x3bd0('0x3a'))){_0x4281e1[_0x3bd0('0x1e')]=qs['limit'](_0x25c63f['query'][_0x3bd0('0x1e')]);_0x4281e1['offset']=qs[_0x3bd0('0x1c')](_0x25c63f['query'][_0x3bd0('0x1c')]);}_0x4281e1[_0x3bd0('0x3b')]=qs[_0x3bd0('0x3c')](_0x25c63f['query'][_0x3bd0('0x3c')]);_0x4281e1['where']=qs[_0x3bd0('0x35')](_[_0x3bd0('0x3d')](_0x25c63f[_0x3bd0('0x34')],_0xcdc646[_0x3bd0('0x35')]),_0x93d665);if(_0x25c63f[_0x3bd0('0x34')]['filter']){_0x4281e1[_0x3bd0('0x3e')]=_['merge'](_0x4281e1[_0x3bd0('0x3e')],{'$or':_['map'](_0x93d665,function(_0x3cbbfe){if(_0x3cbbfe[_0x3bd0('0x32')]!=='VIRTUAL'){var _0xcd0aed={};_0xcd0aed[_0x3cbbfe[_0x3bd0('0x2c')]]={'$like':'%'+_0x25c63f[_0x3bd0('0x34')]['filter']+'%'};return _0xcd0aed;}})});}_0x4281e1=_['merge']({},_0x4281e1,_0x25c63f[_0x3bd0('0x3f')]);var _0x513c44={'where':_0x4281e1[_0x3bd0('0x3e')]};return db[_0x3bd0('0x2f')]['count'](_0x513c44)[_0x3bd0('0x26')](function(_0x11ec82){_0x1f2e59['count']=_0x11ec82;if(_0x25c63f[_0x3bd0('0x34')][_0x3bd0('0x40')]){_0x4281e1[_0x3bd0('0x41')]=[{'all':!![]}];}return db[_0x3bd0('0x2f')]['findAll'](_0x4281e1);})[_0x3bd0('0x26')](function(_0x5b3f48){_0x1f2e59[_0x3bd0('0x42')]=_0x5b3f48;return _0x1f2e59;})[_0x3bd0('0x26')](respondWithFilteredResult(_0x481d79,_0x4281e1))['catch'](handleError(_0x481d79,null));};exports['show']=function(_0x224a9f,_0x4791b4){var _0x5b2395={'raw':![],'where':{'id':_0x224a9f[_0x3bd0('0x43')]['id']}},_0x3dcca5={};_0x3dcca5[_0x3bd0('0x33')]=_[_0x3bd0('0x44')](db[_0x3bd0('0x2f')]['rawAttributes']);_0x3dcca5[_0x3bd0('0x34')]=_[_0x3bd0('0x44')](_0x224a9f['query']);_0x3dcca5[_0x3bd0('0x35')]=_['intersection'](_0x3dcca5[_0x3bd0('0x33')],_0x3dcca5[_0x3bd0('0x34')]);_0x5b2395[_0x3bd0('0x36')]=_['intersection'](_0x3dcca5[_0x3bd0('0x33')],qs[_0x3bd0('0x38')](_0x224a9f['query']['fields']));_0x5b2395['attributes']=_0x5b2395[_0x3bd0('0x36')][_0x3bd0('0x39')]?_0x5b2395[_0x3bd0('0x36')]:_0x3dcca5[_0x3bd0('0x33')];if(_0x224a9f[_0x3bd0('0x34')][_0x3bd0('0x40')]){_0x5b2395[_0x3bd0('0x41')]=[{'all':!![]}];}_0x5b2395=_[_0x3bd0('0x45')]({},_0x5b2395,_0x224a9f[_0x3bd0('0x3f')]);return db[_0x3bd0('0x2f')]['find'](_0x5b2395)[_0x3bd0('0x26')](handleEntityNotFound(_0x4791b4,null))['then'](respondWithResult(_0x4791b4,null))[_0x3bd0('0x46')](handleError(_0x4791b4,null));};exports['create']=function(_0x213ef0,_0x2e61e2){return db[_0x3bd0('0x2f')]['create'](_0x213ef0[_0x3bd0('0x47')],{})[_0x3bd0('0x26')](function(_0xbe1701){var _0x3c938a=_0x213ef0[_0x3bd0('0x48')][_0x3bd0('0x28')]({'plain':!![]});if(!_0x3c938a)throw new Error(_0x3bd0('0x49'));if(_0x3c938a[_0x3bd0('0x4a')]===_0x3bd0('0x48')){var _0x4e2233=_0xbe1701['get']({'plain':!![]});var _0x4be787=_0x3bd0('0x4b');return db[_0x3bd0('0x4c')][_0x3bd0('0x4d')]({'where':{'name':_0x4be787,'userProfileId':_0x3c938a[_0x3bd0('0x4e')]},'raw':!![]})['then'](function(_0x3329e0){if(_0x3329e0&&_0x3329e0['autoAssociation']===0x0){return db[_0x3bd0('0x29')]['create']({'name':_0x4e2233[_0x3bd0('0x2c')],'resourceId':_0x4e2233['id'],'type':_0x3329e0[_0x3bd0('0x2c')],'sectionId':_0x3329e0['id']},{})[_0x3bd0('0x26')](function(){return _0xbe1701;});}else{return _0xbe1701;}})[_0x3bd0('0x46')](function(_0x53b8af){logger[_0x3bd0('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53b8af);throw _0x53b8af;});}return _0xbe1701;})['then'](respondWithResult(_0x2e61e2,0xc9))[_0x3bd0('0x46')](handleError(_0x2e61e2,null));};exports[_0x3bd0('0x25')]=function(_0x3ce818,_0x5b186d){if(_0x3ce818[_0x3bd0('0x47')]['id']){delete _0x3ce818['body']['id'];}return db[_0x3bd0('0x2f')][_0x3bd0('0x4d')]({'where':{'id':_0x3ce818[_0x3bd0('0x43')]['id']}})[_0x3bd0('0x26')](handleEntityNotFound(_0x5b186d,null))[_0x3bd0('0x26')](saveUpdates(_0x3ce818['body'],null))['then'](respondWithResult(_0x5b186d,null))['catch'](handleError(_0x5b186d,null));};exports[_0x3bd0('0x27')]=function(_0x2f7635,_0x13dfd1){return db[_0x3bd0('0x2f')][_0x3bd0('0x4d')]({'where':{'id':_0x2f7635[_0x3bd0('0x43')]['id']}})[_0x3bd0('0x26')](handleEntityNotFound(_0x13dfd1,null))[_0x3bd0('0x26')](removeEntity(_0x13dfd1,null))[_0x3bd0('0x46')](handleError(_0x13dfd1,null));};exports['run']=function(_0x52ed49,_0x273c64,_0x4c3e6c){var _0x12501b=require(_0x3bd0('0x4f'));return db[_0x3bd0('0x2f')]['find']({'where':{'id':_0x52ed49['params']['id']},'raw':!![]})[_0x3bd0('0x26')](handleEntityNotFound(_0x273c64,null))['then'](function(){_0x12501b[_0x3bd0('0x50')](_0x52ed49[_0x3bd0('0x43')]['id']);})[_0x3bd0('0x26')](respondWithStatusCode(_0x273c64,null))[_0x3bd0('0x46')](handleError(_0x273c64,null));}; \ No newline at end of file +var _0x3130=['index','map','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filters','filter','where','VIRTUAL','merge','options','include','Schedule','findAll','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Scheduler','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','json','apply','reject','save','update','then','get','UserProfileResource','end','sendStatus','error','stack','name'];(function(_0x20af59,_0x29e647){var _0x1940e4=function(_0x5800a3){while(--_0x5800a3){_0x20af59['push'](_0x20af59['shift']());}};_0x1940e4(++_0x29e647);}(_0x3130,0x78));var _0x0313=function(_0x13bd07,_0x18d8b5){_0x13bd07=_0x13bd07-0x0;var _0xc2d64a=_0x3130[_0x13bd07];return _0xc2d64a;};'use strict';var emlformat=require(_0x0313('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0313('0x1'));var jsonpatch=require(_0x0313('0x2'));var rp=require(_0x0313('0x3'));var moment=require('moment');var BPromise=require(_0x0313('0x4'));var Mustache=require(_0x0313('0x5'));var util=require(_0x0313('0x6'));var path=require(_0x0313('0x7'));var sox=require(_0x0313('0x8'));var csv=require(_0x0313('0x9'));var ejs=require(_0x0313('0xa'));var fs=require('fs');var fs_extra=require(_0x0313('0xb'));var _=require(_0x0313('0xc'));var squel=require(_0x0313('0xd'));var crypto=require('crypto');var jsforce=require(_0x0313('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0313('0x9'));var querystring=require(_0x0313('0xf'));var Papa=require(_0x0313('0x10'));var Redis=require(_0x0313('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0313('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0313('0x13'))(_0x0313('0x14'));var utils=require(_0x0313('0x15'));var config=require(_0x0313('0x16'));var licenseUtil=require(_0x0313('0x17'));var db=require(_0x0313('0x18'))['db'];function respondWithStatusCode(_0x5a07d3,_0x502ff5){_0x502ff5=_0x502ff5||0xcc;return function(_0x1bd9bf){if(_0x1bd9bf){return _0x5a07d3['sendStatus'](_0x502ff5);}return _0x5a07d3[_0x0313('0x19')](_0x502ff5)['end']();};}function respondWithResult(_0xbf6857,_0x16cf9f){_0x16cf9f=_0x16cf9f||0xc8;return function(_0x56ce8e){if(_0x56ce8e){return _0xbf6857['status'](_0x16cf9f)['json'](_0x56ce8e);}};}function respondWithFilteredResult(_0xe5b44,_0x247631){return function(_0x4d911b){if(_0x4d911b){var _0x276628=typeof _0x247631[_0x0313('0x1a')]===_0x0313('0x1b')&&typeof _0x247631['limit']===_0x0313('0x1b');var _0x16ee2a=_0x4d911b[_0x0313('0x1c')];var _0x41e719=_0x276628?0x0:_0x247631[_0x0313('0x1a')];var _0x14fa4e=_0x276628?_0x4d911b[_0x0313('0x1c')]:_0x247631[_0x0313('0x1a')]+_0x247631[_0x0313('0x1d')];var _0x2e72bd;if(_0x14fa4e>=_0x16ee2a){_0x14fa4e=_0x16ee2a;_0x2e72bd=0xc8;}else{_0x2e72bd=0xce;}_0xe5b44['status'](_0x2e72bd);return _0xe5b44[_0x0313('0x1e')]('Content-Range',_0x41e719+'-'+_0x14fa4e+'/'+_0x16ee2a)[_0x0313('0x1f')](_0x4d911b);}return null;};}function patchUpdates(_0x42c0fa){return function(_0x1a3334){try{jsonpatch[_0x0313('0x20')](_0x1a3334,_0x42c0fa,!![]);}catch(_0x386a06){return BPromise[_0x0313('0x21')](_0x386a06);}return _0x1a3334[_0x0313('0x22')]();};}function saveUpdates(_0x396363,_0x405339){return function(_0x30bc35){if(_0x30bc35){return _0x30bc35[_0x0313('0x23')](_0x396363)[_0x0313('0x24')](function(_0x3d44d1){return _0x3d44d1;});}return null;};}function removeEntity(_0x3f2057,_0x539c7c){return function(_0x3a2d16){if(_0x3a2d16){return _0x3a2d16['destroy']()[_0x0313('0x24')](function(){var _0x26acb7=_0x3a2d16[_0x0313('0x25')]({'plain':!![]});var _0x3b6e1c='Scheduler';return db[_0x0313('0x26')]['destroy']({'where':{'type':_0x3b6e1c,'resourceId':_0x26acb7['id']}})[_0x0313('0x24')](function(){return _0x3a2d16;});})[_0x0313('0x24')](function(){_0x3f2057[_0x0313('0x19')](0xcc)[_0x0313('0x27')]();});}};}function handleEntityNotFound(_0x540102,_0x5a786f){return function(_0x49681c){if(!_0x49681c){_0x540102[_0x0313('0x28')](0x194);}return _0x49681c;};}function handleError(_0x4fe1a4,_0x13d5ad){_0x13d5ad=_0x13d5ad||0x1f4;return function(_0x53f7bb){logger[_0x0313('0x29')](_0x53f7bb[_0x0313('0x2a')]);if(_0x53f7bb[_0x0313('0x2b')]){delete _0x53f7bb[_0x0313('0x2b')];}_0x4fe1a4[_0x0313('0x19')](_0x13d5ad)['send'](_0x53f7bb);};}exports[_0x0313('0x2c')]=function(_0x363922,_0x1ad068){var _0xc3f6db={},_0xd2de60={},_0x5b5dd1={'count':0x0,'rows':[]};var _0x245a29=_[_0x0313('0x2d')](db['Schedule']['rawAttributes'],function(_0x235dc1){return{'name':_0x235dc1[_0x0313('0x2e')],'type':_0x235dc1['type'][_0x0313('0x2f')]};});_0xd2de60[_0x0313('0x30')]=_[_0x0313('0x2d')](_0x245a29,_0x0313('0x2b'));_0xd2de60[_0x0313('0x31')]=_[_0x0313('0x32')](_0x363922[_0x0313('0x31')]);_0xd2de60['filters']=_[_0x0313('0x33')](_0xd2de60['model'],_0xd2de60[_0x0313('0x31')]);_0xc3f6db[_0x0313('0x34')]=_['intersection'](_0xd2de60[_0x0313('0x30')],qs[_0x0313('0x35')](_0x363922[_0x0313('0x31')][_0x0313('0x35')]));_0xc3f6db[_0x0313('0x34')]=_0xc3f6db[_0x0313('0x34')][_0x0313('0x36')]?_0xc3f6db[_0x0313('0x34')]:_0xd2de60[_0x0313('0x30')];if(!_0x363922[_0x0313('0x31')][_0x0313('0x37')]('nolimit')){_0xc3f6db[_0x0313('0x1d')]=qs[_0x0313('0x1d')](_0x363922[_0x0313('0x31')]['limit']);_0xc3f6db[_0x0313('0x1a')]=qs[_0x0313('0x1a')](_0x363922[_0x0313('0x31')][_0x0313('0x1a')]);}_0xc3f6db[_0x0313('0x38')]=qs[_0x0313('0x39')](_0x363922[_0x0313('0x31')]['sort']);_0xc3f6db['where']=qs['filters'](_[_0x0313('0x3a')](_0x363922['query'],_0xd2de60[_0x0313('0x3b')]),_0x245a29);if(_0x363922[_0x0313('0x31')][_0x0313('0x3c')]){_0xc3f6db['where']=_['merge'](_0xc3f6db[_0x0313('0x3d')],{'$or':_['map'](_0x245a29,function(_0x10251f){if(_0x10251f['type']!==_0x0313('0x3e')){var _0x5559c0={};_0x5559c0[_0x10251f[_0x0313('0x2b')]]={'$like':'%'+_0x363922[_0x0313('0x31')][_0x0313('0x3c')]+'%'};return _0x5559c0;}})});}_0xc3f6db=_[_0x0313('0x3f')]({},_0xc3f6db,_0x363922[_0x0313('0x40')]);var _0x5f50db={'where':_0xc3f6db['where']};return db['Schedule'][_0x0313('0x1c')](_0x5f50db)[_0x0313('0x24')](function(_0x292002){_0x5b5dd1['count']=_0x292002;if(_0x363922[_0x0313('0x31')]['includeAll']){_0xc3f6db[_0x0313('0x41')]=[{'all':!![]}];}return db[_0x0313('0x42')][_0x0313('0x43')](_0xc3f6db);})['then'](function(_0x259d45){_0x5b5dd1['rows']=_0x259d45;return _0x5b5dd1;})['then'](respondWithFilteredResult(_0x1ad068,_0xc3f6db))[_0x0313('0x44')](handleError(_0x1ad068,null));};exports[_0x0313('0x45')]=function(_0x2a3c81,_0x36079a){var _0x376618={'raw':![],'where':{'id':_0x2a3c81[_0x0313('0x46')]['id']}},_0x2c528b={};_0x2c528b[_0x0313('0x30')]=_[_0x0313('0x32')](db['Schedule']['rawAttributes']);_0x2c528b[_0x0313('0x31')]=_[_0x0313('0x32')](_0x2a3c81[_0x0313('0x31')]);_0x2c528b[_0x0313('0x3b')]=_['intersection'](_0x2c528b[_0x0313('0x30')],_0x2c528b[_0x0313('0x31')]);_0x376618['attributes']=_[_0x0313('0x33')](_0x2c528b[_0x0313('0x30')],qs[_0x0313('0x35')](_0x2a3c81[_0x0313('0x31')]['fields']));_0x376618[_0x0313('0x34')]=_0x376618[_0x0313('0x34')]['length']?_0x376618[_0x0313('0x34')]:_0x2c528b[_0x0313('0x30')];if(_0x2a3c81['query'][_0x0313('0x47')]){_0x376618['include']=[{'all':!![]}];}_0x376618=_[_0x0313('0x3f')]({},_0x376618,_0x2a3c81[_0x0313('0x40')]);return db['Schedule']['find'](_0x376618)[_0x0313('0x24')](handleEntityNotFound(_0x36079a,null))[_0x0313('0x24')](respondWithResult(_0x36079a,null))['catch'](handleError(_0x36079a,null));};exports['create']=function(_0x18f161,_0x32bbd9){return db[_0x0313('0x42')][_0x0313('0x48')](_0x18f161[_0x0313('0x49')],{})['then'](function(_0x2c57cd){var _0x5705c7=_0x18f161[_0x0313('0x4a')]['get']({'plain':!![]});if(!_0x5705c7)throw new Error(_0x0313('0x4b'));if(_0x5705c7['role']===_0x0313('0x4a')){var _0x21e8c1=_0x2c57cd[_0x0313('0x25')]({'plain':!![]});var _0x1cfdc4=_0x0313('0x4c');return db[_0x0313('0x4d')][_0x0313('0x4e')]({'where':{'name':_0x1cfdc4,'userProfileId':_0x5705c7['userProfileId']},'raw':!![]})['then'](function(_0x206b4b){if(_0x206b4b&&_0x206b4b['autoAssociation']===0x0){return db[_0x0313('0x26')][_0x0313('0x48')]({'name':_0x21e8c1[_0x0313('0x2b')],'resourceId':_0x21e8c1['id'],'type':_0x206b4b['name'],'sectionId':_0x206b4b['id']},{})['then'](function(){return _0x2c57cd;});}else{return _0x2c57cd;}})[_0x0313('0x44')](function(_0x2d153f){logger[_0x0313('0x29')](_0x0313('0x4f'),_0x2d153f);throw _0x2d153f;});}return _0x2c57cd;})[_0x0313('0x24')](respondWithResult(_0x32bbd9,0xc9))[_0x0313('0x44')](handleError(_0x32bbd9,null));};exports['update']=function(_0x8706e3,_0x21a606){if(_0x8706e3['body']['id']){delete _0x8706e3[_0x0313('0x49')]['id'];}return db['Schedule'][_0x0313('0x4e')]({'where':{'id':_0x8706e3[_0x0313('0x46')]['id']}})[_0x0313('0x24')](handleEntityNotFound(_0x21a606,null))['then'](saveUpdates(_0x8706e3[_0x0313('0x49')],null))[_0x0313('0x24')](respondWithResult(_0x21a606,null))['catch'](handleError(_0x21a606,null));};exports['destroy']=function(_0x47427c,_0x571cb6){return db[_0x0313('0x42')][_0x0313('0x4e')]({'where':{'id':_0x47427c[_0x0313('0x46')]['id']}})['then'](handleEntityNotFound(_0x571cb6,null))[_0x0313('0x24')](removeEntity(_0x571cb6,null))[_0x0313('0x44')](handleError(_0x571cb6,null));};exports[_0x0313('0x50')]=function(_0x3aebcf,_0x370f5d,_0x4ec0c5){var _0x584730=require(_0x0313('0x51'));return db[_0x0313('0x42')]['find']({'where':{'id':_0x3aebcf[_0x0313('0x46')]['id']},'raw':!![]})[_0x0313('0x24')](handleEntityNotFound(_0x370f5d,null))['then'](function(){_0x584730[_0x0313('0x50')](_0x3aebcf[_0x0313('0x46')]['id']);})[_0x0313('0x24')](respondWithStatusCode(_0x370f5d,null))[_0x0313('0x44')](handleError(_0x370f5d,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 70221dd..1c2a93c 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 _0x984d=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','define','Schedule','tools_schedules','lodash','util','api'];(function(_0x48c727,_0x268a4e){var _0x5ce98d=function(_0x59d9ef){while(--_0x59d9ef){_0x48c727['push'](_0x48c727['shift']());}};_0x5ce98d(++_0x268a4e);}(_0x984d,0x1de));var _0xd984=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x984d[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xd984('0x0'));var util=require(_0xd984('0x1'));var logger=require('../../config/logger')(_0xd984('0x2'));var moment=require(_0xd984('0x3'));var BPromise=require(_0xd984('0x4'));var rp=require(_0xd984('0x5'));var fs=require('fs');var path=require(_0xd984('0x6'));var rimraf=require(_0xd984('0x7'));var config=require(_0xd984('0x8'));var attributes=require(_0xd984('0x9'));module['exports']=function(_0x4dedda,_0x127f7f){return _0x4dedda[_0xd984('0xa')](_0xd984('0xb'),attributes,{'tableName':_0xd984('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a48=['rimraf','../../config/environment','./schedule.attributes','Schedule','tools_schedules','lodash','api','moment','request-promise','path'];(function(_0x5222d9,_0x12496d){var _0x16b0d5=function(_0x4220a6){while(--_0x4220a6){_0x5222d9['push'](_0x5222d9['shift']());}};_0x16b0d5(++_0x12496d);}(_0x4a48,0x1a9));var _0x84a4=function(_0x37e4bd,_0x341b67){_0x37e4bd=_0x37e4bd-0x0;var _0x47ea7d=_0x4a48[_0x37e4bd];return _0x47ea7d;};'use strict';var _=require(_0x84a4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x84a4('0x1'));var moment=require(_0x84a4('0x2'));var BPromise=require('bluebird');var rp=require(_0x84a4('0x3'));var fs=require('fs');var path=require(_0x84a4('0x4'));var rimraf=require(_0x84a4('0x5'));var config=require(_0x84a4('0x6'));var attributes=require(_0x84a4('0x7'));module['exports']=function(_0x55be50,_0x9f50fe){return _0x55be50['define'](_0x84a4('0x8'),attributes,{'tableName':_0x84a4('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 293aed1..f07933b 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 _0x86eb=['stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s'];(function(_0x528f71,_0x21ee60){var _0x3f3ecd=function(_0x28c71b){while(--_0x28c71b){_0x528f71['push'](_0x528f71['shift']());}};_0x3f3ecd(++_0x21ee60);}(_0x86eb,0x1e8));var _0xb86e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x86eb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb86e('0x0'));var util=require(_0xb86e('0x1'));var moment=require('moment');var BPromise=require(_0xb86e('0x2'));var rs=require(_0xb86e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb86e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb86e('0x5'))(_0xb86e('0x6'));var config=require(_0xb86e('0x7'));var jayson=require(_0xb86e('0x8'));var client=jayson[_0xb86e('0x9')][_0xb86e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42d513,_0x1ef7a9,_0x25b5a9){return new BPromise(function(_0x64ae71,_0x23c6a8){return client[_0xb86e('0xb')](_0x42d513,_0x25b5a9)[_0xb86e('0xc')](function(_0x5af300){logger[_0xb86e('0xd')](_0xb86e('0xe'),_0x1ef7a9,_0xb86e('0xf'));logger[_0xb86e('0x10')](_0xb86e('0x11'),_0x1ef7a9,_0xb86e('0xf'),JSON[_0xb86e('0x12')](_0x5af300));if(_0x5af300[_0xb86e('0x13')]){if(_0x5af300[_0xb86e('0x13')][_0xb86e('0x14')]===0x1f4){logger[_0xb86e('0x13')](_0xb86e('0xe'),_0x1ef7a9,_0x5af300[_0xb86e('0x13')]['message']);return _0x23c6a8(_0x5af300[_0xb86e('0x13')][_0xb86e('0x15')]);}logger['error']('Schedule,\x20%s,\x20%s',_0x1ef7a9,_0x5af300[_0xb86e('0x13')]['message']);return _0x64ae71(_0x5af300['error'][_0xb86e('0x15')]);}else{logger['info'](_0xb86e('0xe'),_0x1ef7a9,_0xb86e('0xf'));_0x64ae71(_0x5af300[_0xb86e('0x16')][_0xb86e('0x15')]);}})['catch'](function(_0x3df037){logger[_0xb86e('0x13')](_0xb86e('0xe'),_0x1ef7a9,_0x3df037);_0x23c6a8(_0x3df037);});});} \ No newline at end of file +var _0x5297=['error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s'];(function(_0x4d08b8,_0x34c445){var _0x70214a=function(_0x4db67c){while(--_0x4db67c){_0x4d08b8['push'](_0x4d08b8['shift']());}};_0x70214a(++_0x34c445);}(_0x5297,0x14f));var _0x7529=function(_0x12baa8,_0x43ce92){_0x12baa8=_0x12baa8-0x0;var _0x49e7b7=_0x5297[_0x12baa8];return _0x49e7b7;};'use strict';var _=require('lodash');var util=require(_0x7529('0x0'));var moment=require(_0x7529('0x1'));var BPromise=require(_0x7529('0x2'));var rs=require(_0x7529('0x3'));var fs=require('fs');var Redis=require(_0x7529('0x4'));var db=require(_0x7529('0x5'))['db'];var utils=require(_0x7529('0x6'));var logger=require(_0x7529('0x7'))(_0x7529('0x8'));var config=require(_0x7529('0x9'));var jayson=require(_0x7529('0xa'));var client=jayson['client'][_0x7529('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ef89b,_0x2b4813,_0x4cdf56){return new BPromise(function(_0x41865e,_0x4597cf){return client[_0x7529('0xc')](_0x5ef89b,_0x4cdf56)['then'](function(_0x3b2d2b){logger[_0x7529('0xd')](_0x7529('0xe'),_0x2b4813,_0x7529('0xf'));logger['debug'](_0x7529('0x10'),_0x2b4813,'request\x20sent',JSON['stringify'](_0x3b2d2b));if(_0x3b2d2b[_0x7529('0x11')]){if(_0x3b2d2b[_0x7529('0x11')][_0x7529('0x12')]===0x1f4){logger['error'](_0x7529('0xe'),_0x2b4813,_0x3b2d2b['error']['message']);return _0x4597cf(_0x3b2d2b[_0x7529('0x11')][_0x7529('0x13')]);}logger[_0x7529('0x11')](_0x7529('0xe'),_0x2b4813,_0x3b2d2b['error'][_0x7529('0x13')]);return _0x41865e(_0x3b2d2b[_0x7529('0x11')][_0x7529('0x13')]);}else{logger['info'](_0x7529('0xe'),_0x2b4813,_0x7529('0xf'));_0x41865e(_0x3b2d2b[_0x7529('0x14')][_0x7529('0x13')]);}})[_0x7529('0x15')](function(_0x22a687){logger[_0x7529('0x11')]('Schedule,\x20%s,\x20%s',_0x2b4813,_0x22a687);_0x4597cf(_0x22a687);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 373a8d2..258028c 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 _0xdce3=['/:id','show','/:id/download','download','create','put','update','delete','destroy','exports','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe'];(function(_0x9425e3,_0x546432){var _0x1893a6=function(_0x52c642){while(--_0x52c642){_0x9425e3['push'](_0x9425e3['shift']());}};_0x1893a6(++_0x546432);}(_0xdce3,0x114));var _0x3dce=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xdce3[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3dce('0x0'));var timeout=require('connect-timeout');var express=require(_0x3dce('0x1'));var router=express[_0x3dce('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x3dce('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3dce('0x4'));var controller=require('./screenRecording.controller');router[_0x3dce('0x5')]('/',auth[_0x3dce('0x6')](),controller[_0x3dce('0x7')]);router[_0x3dce('0x5')]('/describe',auth[_0x3dce('0x6')](),controller[_0x3dce('0x8')]);router['get'](_0x3dce('0x9'),auth[_0x3dce('0x6')](),controller[_0x3dce('0xa')]);router['get'](_0x3dce('0xb'),auth[_0x3dce('0x6')](),controller[_0x3dce('0xc')]);router['post']('/',auth[_0x3dce('0x6')](),controller[_0x3dce('0xd')]);router[_0x3dce('0xe')](_0x3dce('0x9'),auth[_0x3dce('0x6')](),controller[_0x3dce('0xf')]);router[_0x3dce('0x10')]('/:id',auth[_0x3dce('0x6')](),controller[_0x3dce('0x11')]);module[_0x3dce('0x12')]=router; \ No newline at end of file +var _0x0a8b=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x474d30,_0x22d434){var _0x314a72=function(_0x4c92d1){while(--_0x4c92d1){_0x474d30['push'](_0x474d30['shift']());}};_0x314a72(++_0x22d434);}(_0x0a8b,0x1de));var _0xb0a8=function(_0x55f4a2,_0x18c2ed){_0x55f4a2=_0x55f4a2-0x0;var _0x171762=_0x0a8b[_0x55f4a2];return _0x171762;};'use strict';var multer=require('multer');var util=require(_0xb0a8('0x0'));var path=require(_0xb0a8('0x1'));var timeout=require(_0xb0a8('0x2'));var express=require(_0xb0a8('0x3'));var router=express[_0xb0a8('0x4')]();var fs_extra=require(_0xb0a8('0x5'));var auth=require(_0xb0a8('0x6'));var interaction=require(_0xb0a8('0x7'));var config=require('../../config/environment');var controller=require(_0xb0a8('0x8'));router[_0xb0a8('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb0a8('0xa'),auth[_0xb0a8('0xb')](),controller[_0xb0a8('0xc')]);router[_0xb0a8('0x9')](_0xb0a8('0xd'),auth[_0xb0a8('0xb')](),controller[_0xb0a8('0xe')]);router[_0xb0a8('0x9')](_0xb0a8('0xf'),auth[_0xb0a8('0xb')](),controller[_0xb0a8('0x10')]);router[_0xb0a8('0x11')]('/',auth['isAuthenticated'](),controller[_0xb0a8('0x12')]);router[_0xb0a8('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xb0a8('0x14')]);router[_0xb0a8('0x15')](_0xb0a8('0xd'),auth[_0xb0a8('0xb')](),controller[_0xb0a8('0x16')]);module[_0xb0a8('0x17')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 123de4c..60f9afd 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 _0x4813=['toString','closedAt','MM-DD-YYYY\x20HH:mm','updatedAt','sequelize','path','VIRTUAL','getDataValue','extname','value','STRING','setDataValue','INTEGER','startedAt','subtract','duration','DATE','format'];(function(_0x195c0a,_0x127054){var _0x4876ff=function(_0x4c7c8f){while(--_0x4c7c8f){_0x195c0a['push'](_0x195c0a['shift']());}};_0x4876ff(++_0x127054);}(_0x4813,0xdc));var _0x3481=function(_0x5e78d0,_0x15ec99){_0x5e78d0=_0x5e78d0-0x0;var _0x5a5764=_0x4813[_0x5e78d0];return _0x5a5764;};'use strict';var Sequelize=require(_0x3481('0x0'));var moment=require('moment');var path=require(_0x3481('0x1'));var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x3481('0x2')],'get':function(){return this[_0x3481('0x3')]('value')?path[_0x3481('0x4')](this[_0x3481('0x3')](_0x3481('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x3481('0x6')]},'channel':{'type':Sequelize[_0x3481('0x6')]},'value':{'type':Sequelize[_0x3481('0x6')],'set':function(_0x369c3b){var _0x54a2c8=_0x369c3b['replace'](/\\/g,'/');this[_0x3481('0x7')]('value',_0x54a2c8);}},'rating':{'type':Sequelize[_0x3481('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x3481('0x8')],'set':function(_0x39b6c4){this[_0x3481('0x7')](_0x3481('0x9'),moment()[_0x3481('0xa')](_0x39b6c4,'ms'));this[_0x3481('0x7')]('closedAt',moment());this['setDataValue'](_0x3481('0xb'),_0x39b6c4);}},'startedAt':{'type':Sequelize[_0x3481('0xc')],'get':function(){return moment(this[_0x3481('0x3')](_0x3481('0x9')))[_0x3481('0xd')]('MM-DD-YYYY\x20HH:mm')[_0x3481('0xe')]();}},'closedAt':{'type':Sequelize[_0x3481('0xc')],'get':function(){return moment(this[_0x3481('0x3')](_0x3481('0xf')))[_0x3481('0xd')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0x3481('0xc')],'get':function(){return moment(this[_0x3481('0x3')]('createdAt'))[_0x3481('0xd')](_0x3481('0x10'))[_0x3481('0xe')]();}},'updatedAt':{'type':Sequelize[_0x3481('0xc')],'get':function(){return moment(this[_0x3481('0x3')](_0x3481('0x11')))[_0x3481('0xd')]('MM-DD-YYYY\x20HH:mm')[_0x3481('0xe')]();}}}; \ No newline at end of file +var _0x753c=['createdAt','format','updatedAt','moment','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x3b632f,_0x453380){var _0x10e788=function(_0x2228a4){while(--_0x2228a4){_0x3b632f['push'](_0x3b632f['shift']());}};_0x10e788(++_0x453380);}(_0x753c,0x96));var _0xc753=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x753c[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc753('0x0'));var path=require('path');var config=require(_0xc753('0x1'));module[_0xc753('0x2')]={'format':{'type':Sequelize[_0xc753('0x3')],'get':function(){return this[_0xc753('0x4')](_0xc753('0x5'))?path[_0xc753('0x6')](this[_0xc753('0x4')](_0xc753('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0xc753('0x7')]},'channel':{'type':Sequelize[_0xc753('0x7')]},'value':{'type':Sequelize[_0xc753('0x7')],'set':function(_0xf96e73){var _0xd7ee43=_0xf96e73[_0xc753('0x8')](/\\/g,'/');this[_0xc753('0x9')](_0xc753('0x5'),_0xd7ee43);}},'rating':{'type':Sequelize[_0xc753('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xc753('0xa')],'set':function(_0x128610){this[_0xc753('0x9')](_0xc753('0xb'),moment()[_0xc753('0xc')](_0x128610,'ms'));this[_0xc753('0x9')](_0xc753('0xd'),moment());this['setDataValue'](_0xc753('0xe'),_0x128610);}},'startedAt':{'type':Sequelize[_0xc753('0xf')],'get':function(){return moment(this['getDataValue'](_0xc753('0xb')))['format'](_0xc753('0x10'))[_0xc753('0x11')]();}},'closedAt':{'type':Sequelize[_0xc753('0xf')],'get':function(){return moment(this['getDataValue'](_0xc753('0xd')))['format'](_0xc753('0x10'))['toString']();}},'createdAt':{'type':Sequelize[_0xc753('0xf')],'get':function(){return moment(this[_0xc753('0x4')](_0xc753('0x12')))[_0xc753('0x13')](_0xc753('0x10'))['toString']();}},'updatedAt':{'type':Sequelize[_0xc753('0xf')],'get':function(){return moment(this[_0xc753('0x4')](_0xc753('0x14')))[_0xc753('0x13')](_0xc753('0x10'))[_0xc753('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 56bce41..a6c8989 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 _0x2eb2=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy','end','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','find','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf'];(function(_0x11362f,_0x2fc8f0){var _0x5a446c=function(_0x5a0a7c){while(--_0x5a0a7c){_0x11362f['push'](_0x11362f['shift']());}};_0x5a446c(++_0x2fc8f0);}(_0x2eb2,0x19f));var _0x22eb=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x2eb2[_0x28947d];return _0x12d2ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x22eb('0x0'));var zipdir=require(_0x22eb('0x1'));var jsonpatch=require(_0x22eb('0x2'));var rp=require(_0x22eb('0x3'));var moment=require(_0x22eb('0x4'));var BPromise=require(_0x22eb('0x5'));var Mustache=require('mustache');var util=require(_0x22eb('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x22eb('0x7'));var ejs=require(_0x22eb('0x8'));var fs=require('fs');var fs_extra=require(_0x22eb('0x9'));var _=require(_0x22eb('0xa'));var squel=require(_0x22eb('0xb'));var crypto=require(_0x22eb('0xc'));var jsforce=require(_0x22eb('0xd'));var deskjs=require(_0x22eb('0xe'));var toCsv=require(_0x22eb('0x7'));var querystring=require(_0x22eb('0xf'));var Papa=require(_0x22eb('0x10'));var Redis=require(_0x22eb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x22eb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x22eb('0x13'))('api');var utils=require(_0x22eb('0x14'));var config=require(_0x22eb('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f286c,_0x189f05){_0x189f05=_0x189f05||0xcc;return function(_0x128d43){if(_0x128d43){return _0x1f286c[_0x22eb('0x16')](_0x189f05);}return _0x1f286c[_0x22eb('0x17')](_0x189f05)['end']();};}function respondWithResult(_0x350ade,_0x53f14e){_0x53f14e=_0x53f14e||0xc8;return function(_0x1f5089){if(_0x1f5089){return _0x350ade['status'](_0x53f14e)[_0x22eb('0x18')](_0x1f5089);}};}function respondWithFilteredResult(_0x84c668,_0x53abbf){return function(_0x48b63c){if(_0x48b63c){var _0x4bc29a=typeof _0x53abbf[_0x22eb('0x19')]==='undefined'&&typeof _0x53abbf['limit']===_0x22eb('0x1a');var _0x4d9a71=_0x48b63c['count'];var _0xb7a73a=_0x4bc29a?0x0:_0x53abbf[_0x22eb('0x19')];var _0x385bcb=_0x4bc29a?_0x48b63c[_0x22eb('0x1b')]:_0x53abbf[_0x22eb('0x19')]+_0x53abbf['limit'];var _0x4182a8;if(_0x385bcb>=_0x4d9a71){_0x385bcb=_0x4d9a71;_0x4182a8=0xc8;}else{_0x4182a8=0xce;}_0x84c668[_0x22eb('0x17')](_0x4182a8);return _0x84c668[_0x22eb('0x1c')](_0x22eb('0x1d'),_0xb7a73a+'-'+_0x385bcb+'/'+_0x4d9a71)[_0x22eb('0x18')](_0x48b63c);}return null;};}function patchUpdates(_0x517313){return function(_0x2eb115){try{jsonpatch[_0x22eb('0x1e')](_0x2eb115,_0x517313,!![]);}catch(_0x2fc36e){return BPromise['reject'](_0x2fc36e);}return _0x2eb115['save']();};}function saveUpdates(_0x4335b7,_0x267d97){return function(_0x434ecb){if(_0x434ecb){return _0x434ecb[_0x22eb('0x1f')](_0x4335b7)[_0x22eb('0x20')](function(_0x3e8c1c){return _0x3e8c1c;});}return null;};}function removeEntity(_0x43dacb,_0x4e7e69){return function(_0x2e8f7c){if(_0x2e8f7c){return _0x2e8f7c[_0x22eb('0x21')]()[_0x22eb('0x20')](function(){_0x43dacb[_0x22eb('0x17')](0xcc)[_0x22eb('0x22')]();});}};}function handleEntityNotFound(_0x4da252,_0x12c133){return function(_0x6f8ff3){if(!_0x6f8ff3){_0x4da252[_0x22eb('0x16')](0x194);}return _0x6f8ff3;};}function handleError(_0x5a001e,_0xe0783c){_0xe0783c=_0xe0783c||0x1f4;return function(_0x259847){logger['error'](_0x259847[_0x22eb('0x23')]);if(_0x259847[_0x22eb('0x24')]){delete _0x259847[_0x22eb('0x24')];}_0x5a001e[_0x22eb('0x17')](_0xe0783c)[_0x22eb('0x25')](_0x259847);};}exports['index']=function(_0x49dd59,_0x2a950e){var _0x25e5bc={},_0x44cf91={},_0x7c0119={'count':0x0,'rows':[]};var _0x1599c7=_[_0x22eb('0x26')](db[_0x22eb('0x27')][_0x22eb('0x28')],function(_0x382784){return{'name':_0x382784[_0x22eb('0x29')],'type':_0x382784[_0x22eb('0x2a')][_0x22eb('0x2b')]};});_0x44cf91['model']=_[_0x22eb('0x2c')](_['map'](_0x1599c7,_0x22eb('0x24')),[_0x22eb('0x2d')]);_0x44cf91[_0x22eb('0x2e')]=_[_0x22eb('0x2f')](_0x49dd59[_0x22eb('0x2e')]);_0x44cf91[_0x22eb('0x30')]=_[_0x22eb('0x31')](_0x44cf91[_0x22eb('0x32')],_0x44cf91[_0x22eb('0x2e')]);_0x25e5bc[_0x22eb('0x33')]=_['intersection'](_0x44cf91['model'],qs[_0x22eb('0x34')](_0x49dd59['query']['fields']));_0x25e5bc[_0x22eb('0x33')]=_0x25e5bc[_0x22eb('0x33')][_0x22eb('0x35')]?_0x25e5bc[_0x22eb('0x33')]:_0x44cf91[_0x22eb('0x32')];if(!_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x36')](_0x22eb('0x37'))){_0x25e5bc[_0x22eb('0x38')]=qs[_0x22eb('0x38')](_0x49dd59['query'][_0x22eb('0x38')]);_0x25e5bc['offset']=qs['offset'](_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x19')]);}_0x25e5bc['order']=qs[_0x22eb('0x39')](_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x39')]);_0x25e5bc[_0x22eb('0x3a')]=qs[_0x22eb('0x30')](_['pick'](_0x49dd59[_0x22eb('0x2e')],_0x44cf91[_0x22eb('0x30')]),_0x1599c7);if(_0x49dd59['query'][_0x22eb('0x3b')]){_0x25e5bc[_0x22eb('0x3a')]=_[_0x22eb('0x3c')](_0x25e5bc[_0x22eb('0x3a')],{'$or':_[_0x22eb('0x26')](_0x1599c7,function(_0x5382eb){if(_0x5382eb['type']!==_0x22eb('0x3d')){var _0x6cd651={};_0x6cd651[_0x5382eb['name']]={'$like':'%'+_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x3b')]+'%'};return _0x6cd651;}})});}_0x25e5bc=_[_0x22eb('0x3c')]({},_0x25e5bc,_0x49dd59['options']);var _0x1d977c={'where':_0x25e5bc[_0x22eb('0x3a')]};return db[_0x22eb('0x27')][_0x22eb('0x1b')](_0x1d977c)[_0x22eb('0x20')](function(_0x39778e){_0x7c0119['count']=_0x39778e;if(_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x3e')]){_0x25e5bc['include']=[{'all':!![]}];}return db[_0x22eb('0x27')][_0x22eb('0x3f')](_0x25e5bc);})[_0x22eb('0x20')](function(_0x30cb10){_0x7c0119[_0x22eb('0x40')]=_0x30cb10;return _0x7c0119;})[_0x22eb('0x20')](respondWithFilteredResult(_0x2a950e,_0x25e5bc))[_0x22eb('0x41')](handleError(_0x2a950e,null));};exports[_0x22eb('0x42')]=function(_0x1bafa3,_0x82ace8){var _0x3e1826={'raw':![],'where':{'id':_0x1bafa3[_0x22eb('0x43')]['id']}},_0x1cf1e0={};_0x1cf1e0[_0x22eb('0x32')]=_[_0x22eb('0x2f')](db[_0x22eb('0x27')][_0x22eb('0x28')]);_0x1cf1e0[_0x22eb('0x2e')]=_['keys'](_0x1bafa3[_0x22eb('0x2e')]);_0x1cf1e0[_0x22eb('0x30')]=_['intersection'](_0x1cf1e0[_0x22eb('0x32')],_0x1cf1e0[_0x22eb('0x2e')]);_0x3e1826['attributes']=_['intersection'](_0x1cf1e0['model'],qs[_0x22eb('0x34')](_0x1bafa3[_0x22eb('0x2e')]['fields']));_0x3e1826['attributes']=_0x3e1826[_0x22eb('0x33')][_0x22eb('0x35')]?_0x3e1826[_0x22eb('0x33')]:_0x1cf1e0[_0x22eb('0x32')];if(_0x1bafa3[_0x22eb('0x2e')][_0x22eb('0x3e')]){_0x3e1826[_0x22eb('0x44')]=[{'all':!![]}];}_0x3e1826=_[_0x22eb('0x3c')]({},_0x3e1826,_0x1bafa3['options']);return db['ScreenRecording'][_0x22eb('0x45')](_0x3e1826)['then'](handleEntityNotFound(_0x82ace8,null))[_0x22eb('0x20')](respondWithResult(_0x82ace8,null))['catch'](handleError(_0x82ace8,null));};exports[_0x22eb('0x46')]=function(_0x5c41c0,_0x4b2f86){return db['ScreenRecording']['create'](_0x5c41c0[_0x22eb('0x47')],{})['then'](respondWithResult(_0x4b2f86,0xc9))[_0x22eb('0x41')](handleError(_0x4b2f86,null));};exports[_0x22eb('0x1f')]=function(_0x490bef,_0x24e6ba){if(_0x490bef['body']['id']){delete _0x490bef[_0x22eb('0x47')]['id'];}delete _0x490bef[_0x22eb('0x47')][_0x22eb('0x48')];delete _0x490bef[_0x22eb('0x47')][_0x22eb('0x49')];delete _0x490bef[_0x22eb('0x47')][_0x22eb('0x4a')];delete _0x490bef[_0x22eb('0x47')][_0x22eb('0x4b')];return db['ScreenRecording'][_0x22eb('0x45')]({'where':{'id':_0x490bef[_0x22eb('0x43')]['id']}})['then'](handleEntityNotFound(_0x24e6ba,null))[_0x22eb('0x20')](saveUpdates(_0x490bef[_0x22eb('0x47')],null))[_0x22eb('0x20')](respondWithResult(_0x24e6ba,null))[_0x22eb('0x41')](handleError(_0x24e6ba,null));};exports['describe']=function(_0x6c0600,_0x169ae1){return db[_0x22eb('0x27')][_0x22eb('0x4c')]()[_0x22eb('0x20')](respondWithResult(_0x169ae1,null))[_0x22eb('0x41')](handleError(_0x169ae1,null));};exports['download']=function(_0x29d7ca,_0x4e5b9f,_0x3ff406){var _0x5eecef=require(_0x22eb('0x4d'));var _0x254b53=![];var _0x4028ef={};if(_0x29d7ca[_0x22eb('0x2e')][_0x22eb('0x2a')]&&_0x29d7ca['query']['type']===_0x22eb('0x4e')){_0x4028ef[_0x22eb('0x4e')]=_0x29d7ca['params']['id'];}else{_0x4028ef['id']=_0x29d7ca[_0x22eb('0x43')]['id'];}return db[_0x22eb('0x27')][_0x22eb('0x45')]({'where':_0x4028ef,'attributes':['id',_0x22eb('0x4b')],'raw':!![]})[_0x22eb('0x20')](handleEntityNotFound(_0x4e5b9f,null))[_0x22eb('0x20')](function(_0x3a8588){if(_0x3a8588){var _0x35c997=path[_0x22eb('0x4f')](config[_0x22eb('0x50')],_0x22eb('0x51'),_0x3a8588['value']);var _0x19cadf=util[_0x22eb('0x2d')](_0x22eb('0x52'),_0x35c997);if(fs[_0x22eb('0x53')](_0x19cadf)){_0x254b53=!![];return _0x5eecef[_0x22eb('0x54')](_0x19cadf,_0x35c997,config[_0x22eb('0x55')][_0x22eb('0x56')])[_0x22eb('0x20')](function(){return _0x3a8588;});}return _0x3a8588;}})[_0x22eb('0x20')](function(_0x9f8465){if(_0x9f8465){var _0x3e9ab5=path[_0x22eb('0x4f')](config[_0x22eb('0x50')],_0x22eb('0x51'),_0x9f8465['value']);if(!fs['existsSync'](_0x3e9ab5)){throw new db[(_0x22eb('0x57'))][(_0x22eb('0x58'))](_0x22eb('0x59'));}if(_0x9f8465[_0x22eb('0x5a')]){return _0x4e5b9f[_0x22eb('0x5b')](_0x3e9ab5,_0x9f8465['filename']+path[_0x22eb('0x5c')](_0x3e9ab5),function(){if(_0x254b53){fs[_0x22eb('0x5d')](_0x3e9ab5);}});}else{return _0x4e5b9f['download'](_0x3e9ab5,function(_0x485408){if(_0x254b53){fs[_0x22eb('0x5d')](_0x3e9ab5);}});}}})[_0x22eb('0x41')](function(_0xb5c8ae){if(_0xb5c8ae[_0x22eb('0x5e')]===_0x22eb('0x59')){_0x4e5b9f[_0x22eb('0x17')](0x194)[_0x22eb('0x25')](_0x22eb('0x5f'));}else{return handleError(_0x4e5b9f,null);}});};exports[_0x22eb('0x21')]=function(_0x19b579,_0x164645){return db[_0x22eb('0x27')][_0x22eb('0x45')]({'where':{'id':_0x19b579[_0x22eb('0x43')]['id']}})['then'](function(_0x29dd8b){if(_[_0x22eb('0x60')](_0x29dd8b)){throw new ReferenceError(_0x22eb('0x61'));}return _0x29dd8b;})['then'](function(_0x1787ec){var _0x5ac4c5=path[_0x22eb('0x4f')](config['root'],_0x22eb('0x51'),_0x1787ec[_0x22eb('0x4b')]);logger['info'](_0x22eb('0x62'),_0x5ac4c5);if(!_[_0x22eb('0x60')](_0x1787ec['value'])&&fs['existsSync'](_0x5ac4c5)){logger[_0x22eb('0x63')](_0x22eb('0x64')+_0x5ac4c5+_0x22eb('0x65'));fs[_0x22eb('0x66')](_0x5ac4c5);}_0x5ac4c5=_0x5ac4c5+_0x22eb('0x67');if(!_[_0x22eb('0x60')](_0x1787ec['value'])&&fs[_0x22eb('0x53')](_0x5ac4c5)){logger['info']('File:\x20\x22'+_0x5ac4c5+_0x22eb('0x65'));fs[_0x22eb('0x66')](_0x5ac4c5);}return _0x1787ec;})[_0x22eb('0x20')](function(_0x22b5c6){if(!_0x22b5c6)throw new InternalError();return _0x22b5c6[_0x22eb('0x21')]();})[_0x22eb('0x20')](function(){_0x164645[_0x22eb('0x17')](0xcc)[_0x22eb('0x22')]();})['catch'](handleError(_0x164645,null));}; \ No newline at end of file +var _0xf2ca=['ScreenRecording','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','rows','show','params','keys','find','create','catch','body','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','%s.cypher','existsSync','secrets','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','error','stack','name','send','index','map'];(function(_0x34a32e,_0x26f089){var _0x24ca9b=function(_0x47c1c5){while(--_0x47c1c5){_0x34a32e['push'](_0x34a32e['shift']());}};_0x24ca9b(++_0x26f089);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x51904f,_0x439694){_0x51904f=_0x51904f-0x0;var _0x24dc27=_0xf2ca[_0x51904f];return _0x24dc27;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x3c1ae6,_0xe929b5){return function(_0xff396f){if(!_0xff396f){_0x3c1ae6[_0xaf2c('0x18')](0x194);}return _0xff396f;};}function handleError(_0x4a8dd8,_0x29f8b0){_0x29f8b0=_0x29f8b0||0x1f4;return function(_0x2051be){logger[_0xaf2c('0x24')](_0x2051be[_0xaf2c('0x25')]);if(_0x2051be['name']){delete _0x2051be[_0xaf2c('0x26')];}_0x4a8dd8['status'](_0x29f8b0)[_0xaf2c('0x27')](_0x2051be);};}exports[_0xaf2c('0x28')]=function(_0x15466b,_0x5d685a){var _0x2747bb={},_0x2ea490={},_0x3baee2={'count':0x0,'rows':[]};var _0x4a96d2=_[_0xaf2c('0x29')](db[_0xaf2c('0x2a')][_0xaf2c('0x2b')],function(_0x19364e){return{'name':_0x19364e['fieldName'],'type':_0x19364e[_0xaf2c('0x2c')][_0xaf2c('0x2d')]};});_0x2ea490[_0xaf2c('0x2e')]=_['differenceBy'](_['map'](_0x4a96d2,_0xaf2c('0x26')),['format']);_0x2ea490[_0xaf2c('0x2f')]=_['keys'](_0x15466b[_0xaf2c('0x2f')]);_0x2ea490[_0xaf2c('0x30')]=_['intersection'](_0x2ea490[_0xaf2c('0x2e')],_0x2ea490[_0xaf2c('0x2f')]);_0x2747bb['attributes']=_[_0xaf2c('0x31')](_0x2ea490[_0xaf2c('0x2e')],qs[_0xaf2c('0x32')](_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x32')]));_0x2747bb[_0xaf2c('0x33')]=_0x2747bb['attributes'][_0xaf2c('0x34')]?_0x2747bb['attributes']:_0x2ea490[_0xaf2c('0x2e')];if(!_0x15466b['query'][_0xaf2c('0x35')]('nolimit')){_0x2747bb[_0xaf2c('0x1e')]=qs['limit'](_0x15466b[_0xaf2c('0x2f')]['limit']);_0x2747bb[_0xaf2c('0x1c')]=qs[_0xaf2c('0x1c')](_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x1c')]);}_0x2747bb[_0xaf2c('0x36')]=qs['sort'](_0x15466b['query'][_0xaf2c('0x37')]);_0x2747bb[_0xaf2c('0x38')]=qs[_0xaf2c('0x30')](_[_0xaf2c('0x39')](_0x15466b[_0xaf2c('0x2f')],_0x2ea490[_0xaf2c('0x30')]),_0x4a96d2);if(_0x15466b['query'][_0xaf2c('0x3a')]){_0x2747bb[_0xaf2c('0x38')]=_['merge'](_0x2747bb[_0xaf2c('0x38')],{'$or':_[_0xaf2c('0x29')](_0x4a96d2,function(_0x25bebd){if(_0x25bebd[_0xaf2c('0x2c')]!==_0xaf2c('0x3b')){var _0x1e8eaf={};_0x1e8eaf[_0x25bebd[_0xaf2c('0x26')]]={'$like':'%'+_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x3a')]+'%'};return _0x1e8eaf;}})});}_0x2747bb=_[_0xaf2c('0x3c')]({},_0x2747bb,_0x15466b[_0xaf2c('0x3d')]);var _0x43f606={'where':_0x2747bb[_0xaf2c('0x38')]};return db['ScreenRecording']['count'](_0x43f606)['then'](function(_0x189809){_0x3baee2[_0xaf2c('0x3e')]=_0x189809;if(_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x3f')]){_0x2747bb[_0xaf2c('0x40')]=[{'all':!![]}];}return db[_0xaf2c('0x2a')]['findAll'](_0x2747bb);})[_0xaf2c('0x23')](function(_0x78632a){_0x3baee2[_0xaf2c('0x41')]=_0x78632a;return _0x3baee2;})['then'](respondWithFilteredResult(_0x5d685a,_0x2747bb))['catch'](handleError(_0x5d685a,null));};exports[_0xaf2c('0x42')]=function(_0x4f8440,_0x181787){var _0x25ba26={'raw':![],'where':{'id':_0x4f8440[_0xaf2c('0x43')]['id']}},_0x20fb99={};_0x20fb99['model']=_[_0xaf2c('0x44')](db['ScreenRecording'][_0xaf2c('0x2b')]);_0x20fb99[_0xaf2c('0x2f')]=_['keys'](_0x4f8440[_0xaf2c('0x2f')]);_0x20fb99['filters']=_[_0xaf2c('0x31')](_0x20fb99[_0xaf2c('0x2e')],_0x20fb99[_0xaf2c('0x2f')]);_0x25ba26[_0xaf2c('0x33')]=_[_0xaf2c('0x31')](_0x20fb99[_0xaf2c('0x2e')],qs[_0xaf2c('0x32')](_0x4f8440[_0xaf2c('0x2f')][_0xaf2c('0x32')]));_0x25ba26['attributes']=_0x25ba26['attributes'][_0xaf2c('0x34')]?_0x25ba26['attributes']:_0x20fb99['model'];if(_0x4f8440['query'][_0xaf2c('0x3f')]){_0x25ba26[_0xaf2c('0x40')]=[{'all':!![]}];}_0x25ba26=_[_0xaf2c('0x3c')]({},_0x25ba26,_0x4f8440[_0xaf2c('0x3d')]);return db['ScreenRecording'][_0xaf2c('0x45')](_0x25ba26)['then'](handleEntityNotFound(_0x181787,null))[_0xaf2c('0x23')](respondWithResult(_0x181787,null))['catch'](handleError(_0x181787,null));};exports[_0xaf2c('0x46')]=function(_0x133e8c,_0x2d01b7){return db[_0xaf2c('0x2a')][_0xaf2c('0x46')](_0x133e8c['body'],{})[_0xaf2c('0x23')](respondWithResult(_0x2d01b7,0xc9))[_0xaf2c('0x47')](handleError(_0x2d01b7,null));};exports['update']=function(_0x4e8efd,_0x367b30){if(_0x4e8efd['body']['id']){delete _0x4e8efd[_0xaf2c('0x48')]['id'];}delete _0x4e8efd[_0xaf2c('0x48')][_0xaf2c('0x49')];delete _0x4e8efd[_0xaf2c('0x48')][_0xaf2c('0x4a')];delete _0x4e8efd[_0xaf2c('0x48')][_0xaf2c('0x4b')];delete _0x4e8efd[_0xaf2c('0x48')][_0xaf2c('0x4c')];return db[_0xaf2c('0x2a')][_0xaf2c('0x45')]({'where':{'id':_0x4e8efd['params']['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x367b30,null))[_0xaf2c('0x23')](saveUpdates(_0x4e8efd['body'],null))['then'](respondWithResult(_0x367b30,null))['catch'](handleError(_0x367b30,null));};exports[_0xaf2c('0x4d')]=function(_0x1f6907,_0x551061){return db[_0xaf2c('0x2a')][_0xaf2c('0x4d')]()[_0xaf2c('0x23')](respondWithResult(_0x551061,null))[_0xaf2c('0x47')](handleError(_0x551061,null));};exports[_0xaf2c('0x4e')]=function(_0x170e67,_0x22b1fc,_0x490b95){var _0x2df52e=require(_0xaf2c('0x4f'));var _0x5771e5=![];var _0x245797={};if(_0x170e67[_0xaf2c('0x2f')][_0xaf2c('0x2c')]&&_0x170e67[_0xaf2c('0x2f')][_0xaf2c('0x2c')]===_0xaf2c('0x50')){_0x245797[_0xaf2c('0x50')]=_0x170e67[_0xaf2c('0x43')]['id'];}else{_0x245797['id']=_0x170e67[_0xaf2c('0x43')]['id'];}return db[_0xaf2c('0x2a')][_0xaf2c('0x45')]({'where':_0x245797,'attributes':['id',_0xaf2c('0x4c')],'raw':!![]})[_0xaf2c('0x23')](handleEntityNotFound(_0x22b1fc,null))[_0xaf2c('0x23')](function(_0x297a22){if(_0x297a22){var _0x2d6677=path[_0xaf2c('0x51')](config[_0xaf2c('0x52')],_0xaf2c('0x53'),_0x297a22[_0xaf2c('0x4c')]);var _0x5321c3=util[_0xaf2c('0x54')](_0xaf2c('0x55'),_0x2d6677);if(fs[_0xaf2c('0x56')](_0x5321c3)){_0x5771e5=!![];return _0x2df52e['decryptFile'](_0x5321c3,_0x2d6677,config[_0xaf2c('0x57')]['recording'])[_0xaf2c('0x23')](function(){return _0x297a22;});}return _0x297a22;}})[_0xaf2c('0x23')](function(_0xb3ad9){if(_0xb3ad9){var _0x45918b=path[_0xaf2c('0x51')](config[_0xaf2c('0x52')],_0xaf2c('0x53'),_0xb3ad9[_0xaf2c('0x4c')]);if(!fs[_0xaf2c('0x56')](_0x45918b)){throw new db['Sequelize'][(_0xaf2c('0x58'))](_0xaf2c('0x59'));}if(_0xb3ad9[_0xaf2c('0x5a')]){return _0x22b1fc[_0xaf2c('0x4e')](_0x45918b,_0xb3ad9[_0xaf2c('0x5a')]+path['extname'](_0x45918b),function(){if(_0x5771e5){fs[_0xaf2c('0x5b')](_0x45918b);}});}else{return _0x22b1fc[_0xaf2c('0x4e')](_0x45918b,function(_0x506000){if(_0x5771e5){fs[_0xaf2c('0x5b')](_0x45918b);}});}}})[_0xaf2c('0x47')](function(_0x4b7070){if(_0x4b7070['message']===_0xaf2c('0x59')){_0x22b1fc[_0xaf2c('0x19')](0x194)[_0xaf2c('0x27')](_0xaf2c('0x5c'));}else{return handleError(_0x22b1fc,null);}});};exports['destroy']=function(_0x36b6f0,_0x3f48f1){return db['ScreenRecording'][_0xaf2c('0x45')]({'where':{'id':_0x36b6f0['params']['id']}})[_0xaf2c('0x23')](function(_0xe6a251){if(_[_0xaf2c('0x5d')](_0xe6a251)){throw new ReferenceError(_0xaf2c('0x5e'));}return _0xe6a251;})[_0xaf2c('0x23')](function(_0x348f7e){var _0x1c9639=path[_0xaf2c('0x51')](config[_0xaf2c('0x52')],_0xaf2c('0x53'),_0x348f7e['value']);logger[_0xaf2c('0x5f')](_0xaf2c('0x60'),_0x1c9639);if(!_[_0xaf2c('0x5d')](_0x348f7e[_0xaf2c('0x4c')])&&fs[_0xaf2c('0x56')](_0x1c9639)){logger['info'](_0xaf2c('0x61')+_0x1c9639+_0xaf2c('0x62'));fs[_0xaf2c('0x63')](_0x1c9639);}_0x1c9639=_0x1c9639+_0xaf2c('0x64');if(!_[_0xaf2c('0x5d')](_0x348f7e['value'])&&fs['existsSync'](_0x1c9639)){logger[_0xaf2c('0x5f')](_0xaf2c('0x61')+_0x1c9639+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xaf2c('0x63')](_0x1c9639);}return _0x348f7e;})[_0xaf2c('0x23')](function(_0x2e189b){if(!_0x2e189b)throw new InternalError();return _0x2e189b['destroy']();})[_0xaf2c('0x23')](function(){_0x3f48f1[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();})[_0xaf2c('0x47')](handleError(_0x3f48f1,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 43819b3..d2b63a0 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 _0xdcf2=['rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x400dbc,_0x401c49){var _0x59372e=function(_0xc31f02){while(--_0xc31f02){_0x400dbc['push'](_0x400dbc['shift']());}};_0x59372e(++_0x401c49);}(_0xdcf2,0x1e4));var _0x2dcf=function(_0x4c644c,_0x1a5d4f){_0x4c644c=_0x4c644c-0x0;var _0x18b89e=_0xdcf2[_0x4c644c];return _0x18b89e;};'use strict';var _=require(_0x2dcf('0x0'));var util=require(_0x2dcf('0x1'));var logger=require(_0x2dcf('0x2'))('api');var moment=require(_0x2dcf('0x3'));var BPromise=require('bluebird');var rp=require(_0x2dcf('0x4'));var fs=require('fs');var path=require(_0x2dcf('0x5'));var rimraf=require(_0x2dcf('0x6'));var config=require(_0x2dcf('0x7'));var attributes=require(_0x2dcf('0x8'));module[_0x2dcf('0x9')]=function(_0x454c35,_0x4b282d){return _0x454c35[_0x2dcf('0xa')](_0x2dcf('0xb'),attributes,{'tableName':_0x2dcf('0xc'),'paranoid':![],'indexes':[{'name':_0x2dcf('0xd'),'fields':[_0x2dcf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x28cc=['ScreenRecording','screen_recordings','interactionid','util','../../config/logger','api','moment','request-promise','./screenRecording.attributes','define'];(function(_0x35007a,_0x58a0d4){var _0x574f68=function(_0xd1c129){while(--_0xd1c129){_0x35007a['push'](_0x35007a['shift']());}};_0x574f68(++_0x58a0d4);}(_0x28cc,0x12f));var _0xc28c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x28cc[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xc28c('0x0'));var logger=require(_0xc28c('0x1'))(_0xc28c('0x2'));var moment=require(_0xc28c('0x3'));var BPromise=require('bluebird');var rp=require(_0xc28c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc28c('0x5'));module['exports']=function(_0x1076e5,_0x12ac30){return _0x1076e5[_0xc28c('0x6')](_0xc28c('0x7'),attributes,{'tableName':_0xc28c('0x8'),'paranoid':![],'indexes':[{'name':_0xc28c('0x9'),'fields':[_0xc28c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 7a278e7..169f8c1 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 _0x7e0b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7e0b,0x18b));var _0xb7e0=function(_0xf88f93,_0x56279c){_0xf88f93=_0xf88f93-0x0;var _0x5c7462=_0x7e0b[_0xf88f93];return _0x5c7462;};'use strict';var _=require('lodash');var util=require(_0xb7e0('0x0'));var moment=require(_0xb7e0('0x1'));var BPromise=require(_0xb7e0('0x2'));var rs=require(_0xb7e0('0x3'));var fs=require('fs');var Redis=require(_0xb7e0('0x4'));var db=require(_0xb7e0('0x5'))['db'];var utils=require(_0xb7e0('0x6'));var logger=require(_0xb7e0('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb7e0('0x8')][_0xb7e0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29191e,_0x547b86,_0x229418){return new BPromise(function(_0x364b96,_0x8ec9c6){return client['request'](_0x29191e,_0x229418)['then'](function(_0x165451){logger['info'](_0xb7e0('0xa'),_0x547b86,'request\x20sent');logger[_0xb7e0('0xb')](_0xb7e0('0xc'),_0x547b86,_0xb7e0('0xd'),JSON[_0xb7e0('0xe')](_0x165451));if(_0x165451['error']){if(_0x165451[_0xb7e0('0xf')][_0xb7e0('0x10')]===0x1f4){logger[_0xb7e0('0xf')](_0xb7e0('0xa'),_0x547b86,_0x165451[_0xb7e0('0xf')][_0xb7e0('0x11')]);return _0x8ec9c6(_0x165451[_0xb7e0('0xf')][_0xb7e0('0x11')]);}logger[_0xb7e0('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x547b86,_0x165451[_0xb7e0('0xf')][_0xb7e0('0x11')]);return _0x364b96(_0x165451['error'][_0xb7e0('0x11')]);}else{logger[_0xb7e0('0x12')](_0xb7e0('0xa'),_0x547b86,_0xb7e0('0xd'));_0x364b96(_0x165451[_0xb7e0('0x13')][_0xb7e0('0x11')]);}})[_0xb7e0('0x14')](function(_0x396892){logger[_0xb7e0('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x547b86,_0x396892);_0x8ec9c6(_0x396892);});});} \ No newline at end of file +var _0xc738=['../../config/logger','rpc','jayson/promise','request','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x46ed23,_0x3dae77){var _0x146e77=function(_0x3c7e26){while(--_0x3c7e26){_0x46ed23['push'](_0x46ed23['shift']());}};_0x146e77(++_0x3dae77);}(_0xc738,0x175));var _0x8c73=function(_0x323419,_0x2a6172){_0x323419=_0x323419-0x0;var _0x4c0be7=_0xc738[_0x323419];return _0x4c0be7;};'use strict';var _=require(_0x8c73('0x0'));var util=require(_0x8c73('0x1'));var moment=require(_0x8c73('0x2'));var BPromise=require('bluebird');var rs=require(_0x8c73('0x3'));var fs=require('fs');var Redis=require(_0x8c73('0x4'));var db=require(_0x8c73('0x5'))['db'];var utils=require(_0x8c73('0x6'));var logger=require(_0x8c73('0x7'))(_0x8c73('0x8'));var config=require('../../config/environment');var jayson=require(_0x8c73('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x145c5c,_0x37779,_0x2577e8){return new BPromise(function(_0x24c3e4,_0x52d6d0){return client[_0x8c73('0xa')](_0x145c5c,_0x2577e8)['then'](function(_0x38eb26){logger[_0x8c73('0xb')](_0x8c73('0xc'),_0x37779,_0x8c73('0xd'));logger[_0x8c73('0xe')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x37779,_0x8c73('0xd'),JSON[_0x8c73('0xf')](_0x38eb26));if(_0x38eb26[_0x8c73('0x10')]){if(_0x38eb26[_0x8c73('0x10')]['code']===0x1f4){logger[_0x8c73('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x37779,_0x38eb26['error'][_0x8c73('0x11')]);return _0x52d6d0(_0x38eb26[_0x8c73('0x10')]['message']);}logger[_0x8c73('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x37779,_0x38eb26[_0x8c73('0x10')][_0x8c73('0x11')]);return _0x24c3e4(_0x38eb26[_0x8c73('0x10')][_0x8c73('0x11')]);}else{logger[_0x8c73('0xb')](_0x8c73('0xc'),_0x37779,_0x8c73('0xd'));_0x24c3e4(_0x38eb26[_0x8c73('0x12')][_0x8c73('0x11')]);}})[_0x8c73('0x13')](function(_0xa95a37){logger['error'](_0x8c73('0xc'),_0x37779,_0xa95a37);_0x52d6d0(_0xa95a37);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 15ca148..1f72479 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 _0x803b=['/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','extname','originalname','post','single','file','addLogo','logologin','addLogoLogin','%s%s','preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','/now','getDate','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin'];(function(_0x587ba2,_0x42eb40){var _0x50ec73=function(_0x2f32e3){while(--_0x2f32e3){_0x587ba2['push'](_0x587ba2['shift']());}};_0x50ec73(++_0x42eb40);}(_0x803b,0x1c3));var _0xb803=function(_0x13d494,_0x3b5429){_0x13d494=_0x13d494-0x0;var _0x47dc99=_0x803b[_0x13d494];return _0x47dc99;};'use strict';var multer=require(_0xb803('0x0'));var util=require(_0xb803('0x1'));var path=require('path');var timeout=require(_0xb803('0x2'));var express=require(_0xb803('0x3'));var router=express[_0xb803('0x4')]();var fs_extra=require(_0xb803('0x5'));var auth=require(_0xb803('0x6'));var interaction=require(_0xb803('0x7'));var config=require(_0xb803('0x8'));var controller=require(_0xb803('0x9'));router[_0xb803('0xa')]('/',auth[_0xb803('0xb')](),controller['index']);router[_0xb803('0xa')](_0xb803('0xc'),controller[_0xb803('0xd')]);router[_0xb803('0xa')](_0xb803('0xe'),controller[_0xb803('0xf')]);router[_0xb803('0xa')](_0xb803('0x10'),controller['getLogo']);router['get'](_0xb803('0x11'),controller[_0xb803('0x12')]);router[_0xb803('0xa')](_0xb803('0x13'),controller[_0xb803('0x14')]);router[_0xb803('0xa')](_0xb803('0x15'),controller[_0xb803('0x16')]);router[_0xb803('0xa')](_0xb803('0x17'),controller[_0xb803('0x18')]);var upload=multer({'storage':multer[_0xb803('0x19')]({'destination':function(_0x3b2b61,_0x21417b,_0x243a2e){_0x243a2e(null,path[_0xb803('0x1a')](config[_0xb803('0x1b')],_0xb803('0x1c')));},'filename':function(_0x115c79,_0x466842,_0x25de54){_0x25de54(null,util[_0xb803('0x1d')]('%s%s',_0xb803('0x1e'),path[_0xb803('0x1f')](_0x466842[_0xb803('0x20')])));}})});router[_0xb803('0x21')](_0xb803('0x10'),upload[_0xb803('0x22')](_0xb803('0x23')),controller[_0xb803('0x24')]);var upload=multer({'storage':multer[_0xb803('0x19')]({'destination':function(_0x410dd2,_0x4fb136,_0xf80e5e){_0xf80e5e(null,path['join'](config['root'],_0xb803('0x1c')));},'filename':function(_0x379e44,_0x1b946f,_0x8f1ab9){_0x8f1ab9(null,util[_0xb803('0x1d')]('%s%s',_0xb803('0x25'),path[_0xb803('0x1f')](_0x1b946f[_0xb803('0x20')])));}})});router[_0xb803('0x21')](_0xb803('0x11'),upload[_0xb803('0x22')]('file'),controller[_0xb803('0x26')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4163a7,_0x21600b,_0x129051){_0x129051(null,path[_0xb803('0x1a')](config[_0xb803('0x1b')],_0xb803('0x1c')));},'filename':function(_0x306184,_0x398d25,_0x534576){_0x534576(null,util[_0xb803('0x1d')](_0xb803('0x27'),_0xb803('0x28'),path[_0xb803('0x1f')](_0x398d25[_0xb803('0x20')])));}})});router[_0xb803('0x21')](_0xb803('0x15'),upload[_0xb803('0x22')](_0xb803('0x23')),controller[_0xb803('0x29')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x55fe51,_0x7422f9,_0x2096b6){_0x2096b6(null,path[_0xb803('0x1a')](config[_0xb803('0x1b')],'server/files/images/logos/'));},'filename':function(_0x2280db,_0x364ea6,_0x353a90){_0x353a90(null,util[_0xb803('0x1d')]('%s%s',_0xb803('0x2a'),path[_0xb803('0x1f')](_0x364ea6['originalname'])));}})});router[_0xb803('0x21')]('/:id/favicon',upload[_0xb803('0x22')]('file'),controller[_0xb803('0x2b')]);router[_0xb803('0x2c')](_0xb803('0xe'),auth[_0xb803('0xb')](),controller[_0xb803('0x2d')]);module[_0xb803('0x2e')]=router; \ No newline at end of file +var _0x0bfc=['isAuthenticated','index','get','/now','getDate','/:id','show','getLogo','/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','server/files/images/logos/','%s%s','logo','extname','originalname','post','/:id/logo','single','file','addLogo','join','logologin','addLogoLogin','root','format','preferred','addPreferred','/:id/favicon','addFavicon','put','update','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller'];(function(_0x549365,_0x9b03e8){var _0xe63ffe=function(_0x2642b4){while(--_0x2642b4){_0x549365['push'](_0x549365['shift']());}};_0xe63ffe(++_0x9b03e8);}(_0x0bfc,0x132));var _0xc0bf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x0bfc[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0xc0bf('0x0'));var util=require('util');var path=require(_0xc0bf('0x1'));var timeout=require(_0xc0bf('0x2'));var express=require('express');var router=express[_0xc0bf('0x3')]();var fs_extra=require(_0xc0bf('0x4'));var auth=require(_0xc0bf('0x5'));var interaction=require(_0xc0bf('0x6'));var config=require(_0xc0bf('0x7'));var controller=require(_0xc0bf('0x8'));router['get']('/',auth[_0xc0bf('0x9')](),controller[_0xc0bf('0xa')]);router[_0xc0bf('0xb')](_0xc0bf('0xc'),controller[_0xc0bf('0xd')]);router[_0xc0bf('0xb')](_0xc0bf('0xe'),controller[_0xc0bf('0xf')]);router['get']('/:id/logo',controller[_0xc0bf('0x10')]);router['get'](_0xc0bf('0x11'),controller['getLogoLogin']);router[_0xc0bf('0xb')](_0xc0bf('0x12'),controller[_0xc0bf('0x13')]);router[_0xc0bf('0xb')](_0xc0bf('0x14'),controller[_0xc0bf('0x15')]);router[_0xc0bf('0xb')]('/:id/favicon',controller[_0xc0bf('0x16')]);var upload=multer({'storage':multer[_0xc0bf('0x17')]({'destination':function(_0x1d3ae3,_0x28373b,_0x1ef4d7){_0x1ef4d7(null,path['join'](config['root'],_0xc0bf('0x18')));},'filename':function(_0x2adb14,_0x55caa4,_0x233d27){_0x233d27(null,util['format'](_0xc0bf('0x19'),_0xc0bf('0x1a'),path[_0xc0bf('0x1b')](_0x55caa4[_0xc0bf('0x1c')])));}})});router[_0xc0bf('0x1d')](_0xc0bf('0x1e'),upload[_0xc0bf('0x1f')](_0xc0bf('0x20')),controller[_0xc0bf('0x21')]);var upload=multer({'storage':multer[_0xc0bf('0x17')]({'destination':function(_0x19993b,_0x42915c,_0x3eb7fc){_0x3eb7fc(null,path[_0xc0bf('0x22')](config['root'],_0xc0bf('0x18')));},'filename':function(_0x205a7d,_0x25921f,_0x18f41d){_0x18f41d(null,util['format'](_0xc0bf('0x19'),_0xc0bf('0x23'),path['extname'](_0x25921f[_0xc0bf('0x1c')])));}})});router['post'](_0xc0bf('0x11'),upload[_0xc0bf('0x1f')](_0xc0bf('0x20')),controller[_0xc0bf('0x24')]);var upload=multer({'storage':multer[_0xc0bf('0x17')]({'destination':function(_0x23ba51,_0x8e08c8,_0x36864a){_0x36864a(null,path[_0xc0bf('0x22')](config[_0xc0bf('0x25')],'server/files/images/logos/'));},'filename':function(_0x29c71e,_0x4df53d,_0x286ae7){_0x286ae7(null,util[_0xc0bf('0x26')](_0xc0bf('0x19'),_0xc0bf('0x27'),path[_0xc0bf('0x1b')](_0x4df53d[_0xc0bf('0x1c')])));}})});router[_0xc0bf('0x1d')]('/:id/preferred',upload['single']('file'),controller[_0xc0bf('0x28')]);var upload=multer({'storage':multer[_0xc0bf('0x17')]({'destination':function(_0xd5411b,_0x59b52c,_0x5bc08b){_0x5bc08b(null,path[_0xc0bf('0x22')](config[_0xc0bf('0x25')],_0xc0bf('0x18')));},'filename':function(_0x4e83ab,_0x13ec3e,_0x3c6290){_0x3c6290(null,util['format'](_0xc0bf('0x19'),'favicon',path[_0xc0bf('0x1b')](_0x13ec3e[_0xc0bf('0x1c')])));}})});router[_0xc0bf('0x1d')](_0xc0bf('0x29'),upload[_0xc0bf('0x1f')](_0xc0bf('0x20')),controller[_0xc0bf('0x2a')]);router[_0xc0bf('0x2b')](_0xc0bf('0xe'),auth[_0xc0bf('0x9')](),controller[_0xc0bf('0x2c')]);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 933d7cd..0bc62a7 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x1242f2,_0x2b9a43){var _0x3e1e84=function(_0x2d25a0){while(--_0x2d25a0){_0x1242f2['push'](_0x1242f2['shift']());}};_0x3e1e84(++_0x2b9a43);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x40abeb,_0x120e6c){var _0xff33a5=function(_0x583956){while(--_0x583956){_0x40abeb['push'](_0x40abeb['shift']());}};_0xff33a5(++_0x120e6c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index c5e9a2e..3e8786c 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 _0xd6dc=['key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','VIRTUAL','filter','merge','options','include','findAll','params','includeAll','body','find','addLogo','file','filename','logo','addLogoLogin','server/files/images/logos','getLicense','loginLogo','preferred','defaultLogo','defaultLoginLogo','defaultFavicon','join','toLower','root','default_logo.svg','default','upperFirst','existsSync','ValidationError','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','custom','Sequelize','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','favicon','getFavicon','defaultPreferred','default_favicon.ico','utcOffset','format','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','code','error','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','Setting','rawAttributes','type'];(function(_0x5a7e3c,_0xdc9219){var _0x59252b=function(_0x29655c){while(--_0x29655c){_0x5a7e3c['push'](_0x5a7e3c['shift']());}};_0x59252b(++_0xdc9219);}(_0xd6dc,0xb7));var _0xcd6d=function(_0x491972,_0x42a920){_0x491972=_0x491972-0x0;var _0x58691e=_0xd6dc[_0x491972];return _0x58691e;};'use strict';var emlformat=require(_0xcd6d('0x0'));var rimraf=require(_0xcd6d('0x1'));var zipdir=require(_0xcd6d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd6d('0x3'));var moment=require(_0xcd6d('0x4'));var BPromise=require(_0xcd6d('0x5'));var Mustache=require(_0xcd6d('0x6'));var util=require(_0xcd6d('0x7'));var path=require(_0xcd6d('0x8'));var sox=require(_0xcd6d('0x9'));var csv=require(_0xcd6d('0xa'));var ejs=require(_0xcd6d('0xb'));var fs=require('fs');var fs_extra=require(_0xcd6d('0xc'));var _=require(_0xcd6d('0xd'));var squel=require(_0xcd6d('0xe'));var crypto=require(_0xcd6d('0xf'));var jsforce=require(_0xcd6d('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcd6d('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcd6d('0x12'));var hardwareService=require(_0xcd6d('0x13'));var logger=require(_0xcd6d('0x14'))(_0xcd6d('0x15'));var utils=require(_0xcd6d('0x16'));var config=require(_0xcd6d('0x17'));var licenseUtil=require(_0xcd6d('0x18'));var db=require(_0xcd6d('0x19'))['db'];var jayson=require(_0xcd6d('0x1a'));var client=jayson['client'][_0xcd6d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5dd88b,_0x15bb07,_0x466532,_0x11e449){return new BPromise(function(_0x1357b7,_0x45a9cc){var _0x343d17=_0x11e449||client;return _0x343d17['request'](_0x5dd88b,_0x466532)['then'](function(_0x2b3ab5){logger['info']('Setting,\x20%s,\x20%s',_0x15bb07,_0xcd6d('0x1c'));logger[_0xcd6d('0x1d')](_0xcd6d('0x1e'),_0x15bb07,_0xcd6d('0x1c'),JSON['stringify'](_0x2b3ab5));if(_0x2b3ab5['error']){if(_0x2b3ab5['error'][_0xcd6d('0x1f')]===0x1f4){logger[_0xcd6d('0x20')](_0xcd6d('0x21'),_0x15bb07,_0x2b3ab5['error'][_0xcd6d('0x22')]);return _0x45a9cc(_0x2b3ab5[_0xcd6d('0x20')][_0xcd6d('0x22')]);}logger['error'](_0xcd6d('0x21'),_0x15bb07,_0x2b3ab5['error']['message']);return _0x1357b7(_0x2b3ab5[_0xcd6d('0x20')]['message']);}else{logger['info'](_0xcd6d('0x21'),_0x15bb07,_0xcd6d('0x1c'));_0x1357b7(_0x2b3ab5[_0xcd6d('0x23')][_0xcd6d('0x22')]);}})[_0xcd6d('0x24')](function(_0x1fb35e){logger[_0xcd6d('0x20')](_0xcd6d('0x21'),_0x15bb07,_0x1fb35e);_0x45a9cc(_0x1fb35e);});});}function respondWithStatusCode(_0xf0739c,_0x35dff9){_0x35dff9=_0x35dff9||0xcc;return function(_0x5c770a){if(_0x5c770a){return _0xf0739c[_0xcd6d('0x25')](_0x35dff9);}return _0xf0739c[_0xcd6d('0x26')](_0x35dff9)['end']();};}function respondWithResult(_0x5f13b5,_0xa35b4f){_0xa35b4f=_0xa35b4f||0xc8;return function(_0x6bf33d){if(_0x6bf33d){return _0x5f13b5['status'](_0xa35b4f)[_0xcd6d('0x27')](_0x6bf33d);}};}function respondWithFilteredResult(_0x36aa7c,_0x5b1401){return function(_0x58f76e){if(_0x58f76e){var _0x311731=typeof _0x5b1401[_0xcd6d('0x28')]===_0xcd6d('0x29')&&typeof _0x5b1401[_0xcd6d('0x2a')]==='undefined';var _0x3193d5=_0x58f76e['count'];var _0x2e4f09=_0x311731?0x0:_0x5b1401['offset'];var _0x1484d=_0x311731?_0x58f76e[_0xcd6d('0x2b')]:_0x5b1401[_0xcd6d('0x28')]+_0x5b1401[_0xcd6d('0x2a')];var _0x2a9f62;if(_0x1484d>=_0x3193d5){_0x1484d=_0x3193d5;_0x2a9f62=0xc8;}else{_0x2a9f62=0xce;}_0x36aa7c[_0xcd6d('0x26')](_0x2a9f62);return _0x36aa7c[_0xcd6d('0x2c')](_0xcd6d('0x2d'),_0x2e4f09+'-'+_0x1484d+'/'+_0x3193d5)[_0xcd6d('0x27')](_0x58f76e);}return null;};}function patchUpdates(_0x4dc9c8){return function(_0x3b9333){try{jsonpatch[_0xcd6d('0x2e')](_0x3b9333,_0x4dc9c8,!![]);}catch(_0x3df1fa){return BPromise[_0xcd6d('0x2f')](_0x3df1fa);}return _0x3b9333[_0xcd6d('0x30')]();};}function saveUpdates(_0x1b8dc4,_0x3fcfbb){return function(_0x284dea){if(_0x284dea){return _0x284dea[_0xcd6d('0x31')](_0x1b8dc4)[_0xcd6d('0x32')](function(_0x29a507){return _0x29a507;});}return null;};}function removeEntity(_0x4a8205,_0x52dc7d){return function(_0x2025a2){if(_0x2025a2){return _0x2025a2[_0xcd6d('0x33')]()[_0xcd6d('0x32')](function(){_0x4a8205[_0xcd6d('0x26')](0xcc)[_0xcd6d('0x34')]();});}};}function handleEntityNotFound(_0x3ea5af,_0x5a9d96){return function(_0x154caf){if(!_0x154caf){_0x3ea5af[_0xcd6d('0x25')](0x194);}return _0x154caf;};}function handleError(_0x144d21,_0x28be27){_0x28be27=_0x28be27||0x1f4;return function(_0x513d21){logger[_0xcd6d('0x20')](_0x513d21[_0xcd6d('0x35')]);if(_0x513d21['name']){delete _0x513d21[_0xcd6d('0x36')];}_0x144d21[_0xcd6d('0x26')](_0x28be27)[_0xcd6d('0x37')](_0x513d21);};}exports[_0xcd6d('0x38')]=function(_0x3beefa,_0x4d5dc6){var _0x33c8cb={},_0x5b964a={},_0x4118b4={'count':0x0,'rows':[]};var _0x3844dc=_[_0xcd6d('0x39')](db[_0xcd6d('0x3a')][_0xcd6d('0x3b')],function(_0x30c01a){return{'name':_0x30c01a['fieldName'],'type':_0x30c01a[_0xcd6d('0x3c')][_0xcd6d('0x3d')]};});_0x5b964a[_0xcd6d('0x3e')]=_['map'](_0x3844dc,'name');_0x5b964a[_0xcd6d('0x3f')]=_[_0xcd6d('0x40')](_0x3beefa['query']);_0x5b964a['filters']=_[_0xcd6d('0x41')](_0x5b964a[_0xcd6d('0x3e')],_0x5b964a[_0xcd6d('0x3f')]);_0x33c8cb[_0xcd6d('0x42')]=_[_0xcd6d('0x41')](_0x5b964a[_0xcd6d('0x3e')],qs[_0xcd6d('0x43')](_0x3beefa[_0xcd6d('0x3f')]['fields']));_0x33c8cb[_0xcd6d('0x42')]=_0x33c8cb[_0xcd6d('0x42')][_0xcd6d('0x44')]?_0x33c8cb[_0xcd6d('0x42')]:_0x5b964a['model'];if(!_0x3beefa[_0xcd6d('0x3f')][_0xcd6d('0x45')](_0xcd6d('0x46'))){_0x33c8cb['limit']=qs[_0xcd6d('0x2a')](_0x3beefa[_0xcd6d('0x3f')]['limit']);_0x33c8cb[_0xcd6d('0x28')]=qs[_0xcd6d('0x28')](_0x3beefa['query'][_0xcd6d('0x28')]);}_0x33c8cb[_0xcd6d('0x47')]=qs['sort'](_0x3beefa[_0xcd6d('0x3f')]['sort']);_0x33c8cb[_0xcd6d('0x48')]=qs[_0xcd6d('0x49')](_[_0xcd6d('0x4a')](_0x3beefa[_0xcd6d('0x3f')],_0x5b964a[_0xcd6d('0x49')]),_0x3844dc);if(_0x3beefa[_0xcd6d('0x3f')]['filter']){_0x33c8cb[_0xcd6d('0x48')]=_['merge'](_0x33c8cb[_0xcd6d('0x48')],{'$or':_[_0xcd6d('0x39')](_0x3844dc,function(_0x5be14e){if(_0x5be14e[_0xcd6d('0x3c')]!==_0xcd6d('0x4b')){var _0x5d1c7b={};_0x5d1c7b[_0x5be14e[_0xcd6d('0x36')]]={'$like':'%'+_0x3beefa['query'][_0xcd6d('0x4c')]+'%'};return _0x5d1c7b;}})});}_0x33c8cb=_[_0xcd6d('0x4d')]({},_0x33c8cb,_0x3beefa[_0xcd6d('0x4e')]);var _0x4bd277={'where':_0x33c8cb[_0xcd6d('0x48')]};return db[_0xcd6d('0x3a')][_0xcd6d('0x2b')](_0x4bd277)[_0xcd6d('0x32')](function(_0x1dd368){_0x4118b4[_0xcd6d('0x2b')]=_0x1dd368;if(_0x3beefa[_0xcd6d('0x3f')]['includeAll']){_0x33c8cb[_0xcd6d('0x4f')]=[{'all':!![]}];}return db['Setting'][_0xcd6d('0x50')](_0x33c8cb);})[_0xcd6d('0x32')](function(_0xe0fa1d){_0x4118b4['rows']=_0xe0fa1d;return _0x4118b4;})[_0xcd6d('0x32')](respondWithFilteredResult(_0x4d5dc6,_0x33c8cb))[_0xcd6d('0x24')](handleError(_0x4d5dc6,null));};exports['show']=function(_0x39ab11,_0x34a44d){var _0x287e72={'raw':![],'where':{'id':_0x39ab11[_0xcd6d('0x51')]['id']}},_0xa1b509={};_0xa1b509[_0xcd6d('0x3e')]=_[_0xcd6d('0x40')](db['Setting']['rawAttributes']);_0xa1b509['query']=_[_0xcd6d('0x40')](_0x39ab11[_0xcd6d('0x3f')]);_0xa1b509[_0xcd6d('0x49')]=_[_0xcd6d('0x41')](_0xa1b509[_0xcd6d('0x3e')],_0xa1b509['query']);_0x287e72[_0xcd6d('0x42')]=_[_0xcd6d('0x41')](_0xa1b509[_0xcd6d('0x3e')],qs[_0xcd6d('0x43')](_0x39ab11[_0xcd6d('0x3f')][_0xcd6d('0x43')]));_0x287e72['attributes']=_0x287e72[_0xcd6d('0x42')]['length']?_0x287e72[_0xcd6d('0x42')]:_0xa1b509['model'];if(_0x39ab11[_0xcd6d('0x3f')][_0xcd6d('0x52')]){_0x287e72['include']=[{'all':!![]}];}_0x287e72=_[_0xcd6d('0x4d')]({},_0x287e72,_0x39ab11[_0xcd6d('0x4e')]);return db['Setting']['find'](_0x287e72)[_0xcd6d('0x32')](handleEntityNotFound(_0x34a44d,null))[_0xcd6d('0x32')](respondWithResult(_0x34a44d,null))[_0xcd6d('0x24')](handleError(_0x34a44d,null));};exports[_0xcd6d('0x31')]=function(_0x447ede,_0x12d54d){if(_0x447ede[_0xcd6d('0x53')]['id']){delete _0x447ede['body']['id'];}return db[_0xcd6d('0x3a')][_0xcd6d('0x54')]({'where':{'id':_0x447ede[_0xcd6d('0x51')]['id']}})[_0xcd6d('0x32')](handleEntityNotFound(_0x12d54d,null))[_0xcd6d('0x32')](saveUpdates(_0x447ede['body'],null))[_0xcd6d('0x32')](respondWithResult(_0x12d54d,null))[_0xcd6d('0x24')](handleError(_0x12d54d,null));};exports[_0xcd6d('0x55')]=function(_0x4e9e60,_0x2aaf10,_0x128f02){if(_0x4e9e60['file']&&_0x4e9e60[_0xcd6d('0x56')][_0xcd6d('0x57')]){_0x4e9e60['body'][_0xcd6d('0x58')]=_0x4e9e60['file'][_0xcd6d('0x57')];}return db[_0xcd6d('0x3a')][_0xcd6d('0x54')]({'where':{'id':_0x4e9e60[_0xcd6d('0x51')]['id']}})['then'](handleEntityNotFound(_0x2aaf10,null))[_0xcd6d('0x32')](saveUpdates(_0x4e9e60[_0xcd6d('0x53')],null))['then'](respondWithResult(_0x2aaf10,null))[_0xcd6d('0x24')](handleError(_0x2aaf10,null));};exports[_0xcd6d('0x59')]=function(_0x3077a1,_0xed1a9,_0x3caad4){if(_0x3077a1[_0xcd6d('0x56')]&&_0x3077a1[_0xcd6d('0x56')][_0xcd6d('0x57')]){_0x3077a1[_0xcd6d('0x53')]['loginLogo']=_0x3077a1[_0xcd6d('0x56')]['filename'];}return db['Setting']['find']({'where':{'id':_0x3077a1['params']['id']}})[_0xcd6d('0x32')](handleEntityNotFound(_0xed1a9,null))[_0xcd6d('0x32')](saveUpdates(_0x3077a1['body'],null))['then'](respondWithResult(_0xed1a9,null))[_0xcd6d('0x24')](handleError(_0xed1a9,null));};var utilLicense=require(_0xcd6d('0x18'));exports['getLogo']=function(_0x20fa95,_0x3dd630,_0x196c94){var _0x5c7f41=_0xcd6d('0x5a');var _0x187c59={'custom':![]};return utilLicense[_0xcd6d('0x5b')]()[_0xcd6d('0x32')](function(_0x1d9ddb){if(_0x1d9ddb){_0x187c59=_0x1d9ddb;}return db[_0xcd6d('0x3a')]['find']({'where':{'id':_0x20fa95[_0xcd6d('0x51')]['id']},'attributes':[_0xcd6d('0x58'),_0xcd6d('0x5c'),_0xcd6d('0x5d'),'favicon',_0xcd6d('0x5e'),_0xcd6d('0x5f'),'defaultPreferred',_0xcd6d('0x60')],'raw':!![]});})[_0xcd6d('0x32')](handleEntityNotFound(_0x3dd630,null))[_0xcd6d('0x32')](function(_0xfabc1e){if(_0xfabc1e){var _0x2ed4df=_0xfabc1e[_0xcd6d('0x58')]&&fs['existsSync'](path[_0xcd6d('0x61')](config['root'],_0x5c7f41,_[_0xcd6d('0x62')](_0xfabc1e[_0xcd6d('0x58')])))?path[_0xcd6d('0x61')](config[_0xcd6d('0x63')],_0x5c7f41,_[_0xcd6d('0x62')](_0xfabc1e['logo'])):path[_0xcd6d('0x61')](config[_0xcd6d('0x63')],_0x5c7f41,_['toLower'](_0xcd6d('0x64')));var _0x28e409=_0xcd6d('0x65')+_[_0xcd6d('0x66')]('logo');if(_0xfabc1e[_0x28e409]||!_0x187c59['custom']){_0x2ed4df=path['join'](config[_0xcd6d('0x63')],_0x5c7f41,_[_0xcd6d('0x62')](_0xcd6d('0x64')));}if(!fs[_0xcd6d('0x67')](_0x2ed4df)){throw new db['Sequelize'][(_0xcd6d('0x68'))](_[_0xcd6d('0x66')](_0xcd6d('0x58'))+_0xcd6d('0x69'));}return _0x3dd630[_0xcd6d('0x6a')](_0x2ed4df);}})['catch'](handleError(_0x3dd630,null));};var utilLicense=require(_0xcd6d('0x18'));exports[_0xcd6d('0x6b')]=function(_0x412e68,_0x260957,_0x1c3ed4){var _0xdb1863=_0xcd6d('0x5a');var _0x3136e2={'custom':![]};return utilLicense['getLicense']()[_0xcd6d('0x32')](function(_0x2c996d){if(_0x2c996d){_0x3136e2=_0x2c996d;}return db[_0xcd6d('0x3a')][_0xcd6d('0x54')]({'where':{'id':_0x412e68[_0xcd6d('0x51')]['id']},'attributes':['logo',_0xcd6d('0x5c'),_0xcd6d('0x5d'),'favicon',_0xcd6d('0x5e'),'defaultLoginLogo','defaultPreferred',_0xcd6d('0x60')],'raw':!![]});})[_0xcd6d('0x32')](handleEntityNotFound(_0x260957,null))[_0xcd6d('0x32')](function(_0x5f269c){if(_0x5f269c){var _0x4b91d7=_0x5f269c[_0xcd6d('0x5c')]&&fs['existsSync'](path[_0xcd6d('0x61')](config['root'],_0xdb1863,_['toLower'](_0x5f269c[_0xcd6d('0x5c')])))?path[_0xcd6d('0x61')](config[_0xcd6d('0x63')],_0xdb1863,_[_0xcd6d('0x62')](_0x5f269c[_0xcd6d('0x5c')])):path[_0xcd6d('0x61')](config[_0xcd6d('0x63')],_0xdb1863,_[_0xcd6d('0x62')](_0xcd6d('0x6c')));var _0xe7549=_0xcd6d('0x65')+_[_0xcd6d('0x66')](_0xcd6d('0x5c'));if(_0x5f269c[_0xe7549]||!_0x3136e2[_0xcd6d('0x6d')]){_0x4b91d7=path[_0xcd6d('0x61')](config[_0xcd6d('0x63')],_0xdb1863,_['toLower']('default_loginLogo.svg'));}if(!fs[_0xcd6d('0x67')](_0x4b91d7)){throw new db[(_0xcd6d('0x6e'))]['ValidationError'](_['upperFirst'](_0xcd6d('0x5c'))+'\x20not\x20found');}return _0x260957[_0xcd6d('0x6a')](_0x4b91d7);}})[_0xcd6d('0x24')](handleError(_0x260957,null));};exports['gdpr']=function(_0x150518,_0x1ad051){return db[_0xcd6d('0x3a')][_0xcd6d('0x54')]({'where':{'id':_0x150518[_0xcd6d('0x51')]['id']},'attributes':[_0xcd6d('0x6f')]})['then'](respondWithResult(_0x1ad051,null))[_0xcd6d('0x24')](handleError(_0x1ad051,null));};exports[_0xcd6d('0x70')]=function(_0x247321,_0x22e3c7,_0x13fe7a){if(_0x247321[_0xcd6d('0x56')]&&_0x247321['file'][_0xcd6d('0x57')]){_0x247321[_0xcd6d('0x53')][_0xcd6d('0x5d')]=_0x247321['file']['filename'];}return db['Setting']['find']({'where':{'id':_0x247321['params']['id']}})[_0xcd6d('0x32')](handleEntityNotFound(_0x22e3c7,null))[_0xcd6d('0x32')](saveUpdates(_0x247321[_0xcd6d('0x53')],null))['then'](respondWithResult(_0x22e3c7,null))[_0xcd6d('0x24')](handleError(_0x22e3c7,null));};var utilLicense=require(_0xcd6d('0x18'));exports[_0xcd6d('0x71')]=function(_0x4a02c4,_0x556587,_0xf86cb7){var _0x3e9e68=_0xcd6d('0x5a');var _0xd746c5={'custom':![]};return utilLicense[_0xcd6d('0x5b')]()['then'](function(_0x9f83eb){if(_0x9f83eb){_0xd746c5=_0x9f83eb;}return db[_0xcd6d('0x3a')][_0xcd6d('0x54')]({'where':{'id':_0x4a02c4[_0xcd6d('0x51')]['id']},'attributes':['logo',_0xcd6d('0x5c'),_0xcd6d('0x5d'),'favicon',_0xcd6d('0x5e'),'defaultLoginLogo','defaultPreferred',_0xcd6d('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x556587,null))[_0xcd6d('0x32')](function(_0x20d2a2){if(_0x20d2a2){var _0x5983ef=_0x20d2a2['preferred']&&fs[_0xcd6d('0x67')](path[_0xcd6d('0x61')](config[_0xcd6d('0x63')],_0x3e9e68,_['toLower'](_0x20d2a2['preferred'])))?path[_0xcd6d('0x61')](config[_0xcd6d('0x63')],_0x3e9e68,_[_0xcd6d('0x62')](_0x20d2a2[_0xcd6d('0x5d')])):path['join'](config[_0xcd6d('0x63')],_0x3e9e68,_[_0xcd6d('0x62')](_0xcd6d('0x72')));var _0x3ce763=_0xcd6d('0x65')+_['upperFirst'](_0xcd6d('0x5d'));if(_0x20d2a2[_0x3ce763]||!_0xd746c5[_0xcd6d('0x6d')]||!_0xd746c5[_0xcd6d('0x5d')]){_0x5983ef=path[_0xcd6d('0x61')](config[_0xcd6d('0x63')],_0x3e9e68,_[_0xcd6d('0x62')](_0xcd6d('0x72')));}if(!fs[_0xcd6d('0x67')](_0x5983ef)){throw new db['Sequelize'][(_0xcd6d('0x68'))](_[_0xcd6d('0x66')](_0xcd6d('0x5d'))+'\x20not\x20found');}return _0x556587[_0xcd6d('0x6a')](_0x5983ef);}})[_0xcd6d('0x24')](handleError(_0x556587,null));};exports[_0xcd6d('0x73')]=function(_0x1fae59,_0x33622b,_0x3bf08b){if(_0x1fae59[_0xcd6d('0x56')]&&_0x1fae59['file'][_0xcd6d('0x57')]){_0x1fae59[_0xcd6d('0x53')][_0xcd6d('0x74')]=_0x1fae59[_0xcd6d('0x56')][_0xcd6d('0x57')];}return db[_0xcd6d('0x3a')][_0xcd6d('0x54')]({'where':{'id':_0x1fae59[_0xcd6d('0x51')]['id']}})[_0xcd6d('0x32')](handleEntityNotFound(_0x33622b,null))[_0xcd6d('0x32')](saveUpdates(_0x1fae59[_0xcd6d('0x53')],null))['then'](respondWithResult(_0x33622b,null))[_0xcd6d('0x24')](handleError(_0x33622b,null));};var utilLicense=require(_0xcd6d('0x18'));exports[_0xcd6d('0x75')]=function(_0x192399,_0x1f0f49,_0xe54b53){var _0x4aefcd=_0xcd6d('0x5a');var _0x386f1f={'custom':![]};return utilLicense[_0xcd6d('0x5b')]()['then'](function(_0x8f70c4){if(_0x8f70c4){_0x386f1f=_0x8f70c4;}return db['Setting']['find']({'where':{'id':_0x192399[_0xcd6d('0x51')]['id']},'attributes':[_0xcd6d('0x58'),_0xcd6d('0x5c'),'preferred',_0xcd6d('0x74'),_0xcd6d('0x5e'),'defaultLoginLogo',_0xcd6d('0x76'),_0xcd6d('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x1f0f49,null))[_0xcd6d('0x32')](function(_0x265f9a){if(_0x265f9a){var _0xde2f75=_0x265f9a['favicon']&&fs['existsSync'](path['join'](config['root'],_0x4aefcd,_[_0xcd6d('0x62')](_0x265f9a['favicon'])))?path[_0xcd6d('0x61')](config[_0xcd6d('0x63')],_0x4aefcd,_[_0xcd6d('0x62')](_0x265f9a['favicon'])):path[_0xcd6d('0x61')](config[_0xcd6d('0x63')],_0x4aefcd,_[_0xcd6d('0x62')](_0xcd6d('0x77')));var _0x5601a7=_0xcd6d('0x65')+_[_0xcd6d('0x66')](_0xcd6d('0x74'));if(_0x265f9a[_0x5601a7]||!_0x386f1f[_0xcd6d('0x6d')]){_0xde2f75=path[_0xcd6d('0x61')](config[_0xcd6d('0x63')],_0x4aefcd,_[_0xcd6d('0x62')](_0xcd6d('0x77')));}if(!fs['existsSync'](_0xde2f75)){throw new db['Sequelize'][(_0xcd6d('0x68'))](_[_0xcd6d('0x66')](_0xcd6d('0x74'))+'\x20not\x20found');}return _0x1f0f49['download'](_0xde2f75);}})[_0xcd6d('0x24')](handleError(_0x1f0f49,null));};exports['getDate']=function(_0x341f06,_0x594345){var _0x5b7f10={'offset':moment()['utcOffset']()};_0x5b7f10['now']=moment()[_0xcd6d('0x78')](_0x5b7f10[_0xcd6d('0x28')])[_0xcd6d('0x79')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x594345[_0xcd6d('0x26')](0xc8)[_0xcd6d('0x37')](_0x5b7f10);}; \ No newline at end of file +var _0x5e3f=['existsSync','join','toLower','root','default','custom','default_logo.svg','Sequelize','upperFirst','\x20not\x20found','download','server/files/images/logos','default_loginLogo.svg','gdpr','getPreferred','defaultPreferred','default_preferred.png','ValidationError','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','intersection','find','body','file','filename','Setting','addLogoLogin','../../config/license/util','getLicense','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','logo'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e3f,0x110));var _0xf5e3=function(_0x218841,_0x5432c7){_0x218841=_0x218841-0x0;var _0x18cf90=_0x5e3f[_0x218841];return _0x18cf90;};'use strict';var emlformat=require(_0xf5e3('0x0'));var rimraf=require(_0xf5e3('0x1'));var zipdir=require(_0xf5e3('0x2'));var jsonpatch=require(_0xf5e3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf5e3('0x4'));var Mustache=require(_0xf5e3('0x5'));var util=require('util');var path=require(_0xf5e3('0x6'));var sox=require(_0xf5e3('0x7'));var csv=require(_0xf5e3('0x8'));var ejs=require(_0xf5e3('0x9'));var fs=require('fs');var fs_extra=require(_0xf5e3('0xa'));var _=require(_0xf5e3('0xb'));var squel=require(_0xf5e3('0xc'));var crypto=require(_0xf5e3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf5e3('0xe'));var toCsv=require(_0xf5e3('0x8'));var querystring=require(_0xf5e3('0xf'));var Papa=require(_0xf5e3('0x10'));var Redis=require('ioredis');var authService=require(_0xf5e3('0x11'));var qs=require(_0xf5e3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf5e3('0x13'));var logger=require(_0xf5e3('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf5e3('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xf5e3('0x16')][_0xf5e3('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x379194,_0x584698,_0x7f4c7,_0x593e1f){return new BPromise(function(_0x293abb,_0x5a1173){var _0xc1324e=_0x593e1f||client;return _0xc1324e[_0xf5e3('0x18')](_0x379194,_0x7f4c7)['then'](function(_0x800bee){logger[_0xf5e3('0x19')](_0xf5e3('0x1a'),_0x584698,_0xf5e3('0x1b'));logger[_0xf5e3('0x1c')](_0xf5e3('0x1d'),_0x584698,_0xf5e3('0x1b'),JSON[_0xf5e3('0x1e')](_0x800bee));if(_0x800bee[_0xf5e3('0x1f')]){if(_0x800bee[_0xf5e3('0x1f')][_0xf5e3('0x20')]===0x1f4){logger['error'](_0xf5e3('0x1a'),_0x584698,_0x800bee[_0xf5e3('0x1f')][_0xf5e3('0x21')]);return _0x5a1173(_0x800bee[_0xf5e3('0x1f')][_0xf5e3('0x21')]);}logger[_0xf5e3('0x1f')](_0xf5e3('0x1a'),_0x584698,_0x800bee[_0xf5e3('0x1f')][_0xf5e3('0x21')]);return _0x293abb(_0x800bee['error'][_0xf5e3('0x21')]);}else{logger[_0xf5e3('0x19')](_0xf5e3('0x1a'),_0x584698,_0xf5e3('0x1b'));_0x293abb(_0x800bee[_0xf5e3('0x22')][_0xf5e3('0x21')]);}})[_0xf5e3('0x23')](function(_0xae73b0){logger[_0xf5e3('0x1f')](_0xf5e3('0x1a'),_0x584698,_0xae73b0);_0x5a1173(_0xae73b0);});});}function respondWithStatusCode(_0x700bfc,_0x3212fd){_0x3212fd=_0x3212fd||0xcc;return function(_0x168078){if(_0x168078){return _0x700bfc[_0xf5e3('0x24')](_0x3212fd);}return _0x700bfc[_0xf5e3('0x25')](_0x3212fd)['end']();};}function respondWithResult(_0x3e7be6,_0x378691){_0x378691=_0x378691||0xc8;return function(_0x38333b){if(_0x38333b){return _0x3e7be6[_0xf5e3('0x25')](_0x378691)['json'](_0x38333b);}};}function respondWithFilteredResult(_0x53a7cd,_0x1425d8){return function(_0x28f286){if(_0x28f286){var _0x160a26=typeof _0x1425d8['offset']===_0xf5e3('0x26')&&typeof _0x1425d8[_0xf5e3('0x27')]===_0xf5e3('0x26');var _0x31935c=_0x28f286['count'];var _0x4cf374=_0x160a26?0x0:_0x1425d8[_0xf5e3('0x28')];var _0xdd15b9=_0x160a26?_0x28f286[_0xf5e3('0x29')]:_0x1425d8[_0xf5e3('0x28')]+_0x1425d8[_0xf5e3('0x27')];var _0x47f071;if(_0xdd15b9>=_0x31935c){_0xdd15b9=_0x31935c;_0x47f071=0xc8;}else{_0x47f071=0xce;}_0x53a7cd[_0xf5e3('0x25')](_0x47f071);return _0x53a7cd[_0xf5e3('0x2a')](_0xf5e3('0x2b'),_0x4cf374+'-'+_0xdd15b9+'/'+_0x31935c)[_0xf5e3('0x2c')](_0x28f286);}return null;};}function patchUpdates(_0x3bce96){return function(_0x22e200){try{jsonpatch[_0xf5e3('0x2d')](_0x22e200,_0x3bce96,!![]);}catch(_0x1ba315){return BPromise[_0xf5e3('0x2e')](_0x1ba315);}return _0x22e200[_0xf5e3('0x2f')]();};}function saveUpdates(_0x2be0e2,_0x3045be){return function(_0x49a27e){if(_0x49a27e){return _0x49a27e[_0xf5e3('0x30')](_0x2be0e2)[_0xf5e3('0x31')](function(_0x1f1a76){return _0x1f1a76;});}return null;};}function removeEntity(_0x350826,_0x1df908){return function(_0x48d728){if(_0x48d728){return _0x48d728[_0xf5e3('0x32')]()[_0xf5e3('0x31')](function(){_0x350826[_0xf5e3('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a2f52,_0xb4bf72){return function(_0xe217b9){if(!_0xe217b9){_0x3a2f52[_0xf5e3('0x24')](0x194);}return _0xe217b9;};}function handleError(_0x4537bf,_0x4587e0){_0x4587e0=_0x4587e0||0x1f4;return function(_0x3c9e67){logger[_0xf5e3('0x1f')](_0x3c9e67[_0xf5e3('0x33')]);if(_0x3c9e67[_0xf5e3('0x34')]){delete _0x3c9e67[_0xf5e3('0x34')];}_0x4537bf[_0xf5e3('0x25')](_0x4587e0)[_0xf5e3('0x35')](_0x3c9e67);};}exports[_0xf5e3('0x36')]=function(_0x562271,_0x514e38){var _0x489607={},_0x80c33b={},_0x60b0db={'count':0x0,'rows':[]};var _0x19c576=_['map'](db['Setting'][_0xf5e3('0x37')],function(_0x29838b){return{'name':_0x29838b[_0xf5e3('0x38')],'type':_0x29838b[_0xf5e3('0x39')][_0xf5e3('0x3a')]};});_0x80c33b[_0xf5e3('0x3b')]=_[_0xf5e3('0x3c')](_0x19c576,'name');_0x80c33b[_0xf5e3('0x3d')]=_[_0xf5e3('0x3e')](_0x562271[_0xf5e3('0x3d')]);_0x80c33b[_0xf5e3('0x3f')]=_['intersection'](_0x80c33b[_0xf5e3('0x3b')],_0x80c33b[_0xf5e3('0x3d')]);_0x489607[_0xf5e3('0x40')]=_['intersection'](_0x80c33b['model'],qs[_0xf5e3('0x41')](_0x562271['query'][_0xf5e3('0x41')]));_0x489607['attributes']=_0x489607['attributes'][_0xf5e3('0x42')]?_0x489607['attributes']:_0x80c33b[_0xf5e3('0x3b')];if(!_0x562271[_0xf5e3('0x3d')][_0xf5e3('0x43')]('nolimit')){_0x489607[_0xf5e3('0x27')]=qs['limit'](_0x562271[_0xf5e3('0x3d')]['limit']);_0x489607[_0xf5e3('0x28')]=qs[_0xf5e3('0x28')](_0x562271['query']['offset']);}_0x489607['order']=qs[_0xf5e3('0x44')](_0x562271[_0xf5e3('0x3d')][_0xf5e3('0x44')]);_0x489607[_0xf5e3('0x45')]=qs[_0xf5e3('0x3f')](_[_0xf5e3('0x46')](_0x562271[_0xf5e3('0x3d')],_0x80c33b['filters']),_0x19c576);if(_0x562271[_0xf5e3('0x3d')][_0xf5e3('0x47')]){_0x489607[_0xf5e3('0x45')]=_['merge'](_0x489607[_0xf5e3('0x45')],{'$or':_[_0xf5e3('0x3c')](_0x19c576,function(_0x797e99){if(_0x797e99[_0xf5e3('0x39')]!==_0xf5e3('0x48')){var _0x10fbd9={};_0x10fbd9[_0x797e99[_0xf5e3('0x34')]]={'$like':'%'+_0x562271[_0xf5e3('0x3d')][_0xf5e3('0x47')]+'%'};return _0x10fbd9;}})});}_0x489607=_[_0xf5e3('0x49')]({},_0x489607,_0x562271[_0xf5e3('0x4a')]);var _0x4364b3={'where':_0x489607[_0xf5e3('0x45')]};return db['Setting'][_0xf5e3('0x29')](_0x4364b3)[_0xf5e3('0x31')](function(_0x115be8){_0x60b0db[_0xf5e3('0x29')]=_0x115be8;if(_0x562271['query'][_0xf5e3('0x4b')]){_0x489607[_0xf5e3('0x4c')]=[{'all':!![]}];}return db['Setting'][_0xf5e3('0x4d')](_0x489607);})['then'](function(_0x1b9767){_0x60b0db[_0xf5e3('0x4e')]=_0x1b9767;return _0x60b0db;})[_0xf5e3('0x31')](respondWithFilteredResult(_0x514e38,_0x489607))[_0xf5e3('0x23')](handleError(_0x514e38,null));};exports[_0xf5e3('0x4f')]=function(_0x1a24fc,_0x153d3f){var _0x3ce281={'raw':![],'where':{'id':_0x1a24fc[_0xf5e3('0x50')]['id']}},_0x1a0f6b={};_0x1a0f6b[_0xf5e3('0x3b')]=_[_0xf5e3('0x3e')](db['Setting'][_0xf5e3('0x37')]);_0x1a0f6b['query']=_['keys'](_0x1a24fc[_0xf5e3('0x3d')]);_0x1a0f6b[_0xf5e3('0x3f')]=_['intersection'](_0x1a0f6b[_0xf5e3('0x3b')],_0x1a0f6b['query']);_0x3ce281[_0xf5e3('0x40')]=_[_0xf5e3('0x51')](_0x1a0f6b[_0xf5e3('0x3b')],qs[_0xf5e3('0x41')](_0x1a24fc[_0xf5e3('0x3d')][_0xf5e3('0x41')]));_0x3ce281[_0xf5e3('0x40')]=_0x3ce281[_0xf5e3('0x40')]['length']?_0x3ce281[_0xf5e3('0x40')]:_0x1a0f6b[_0xf5e3('0x3b')];if(_0x1a24fc[_0xf5e3('0x3d')]['includeAll']){_0x3ce281['include']=[{'all':!![]}];}_0x3ce281=_[_0xf5e3('0x49')]({},_0x3ce281,_0x1a24fc[_0xf5e3('0x4a')]);return db['Setting'][_0xf5e3('0x52')](_0x3ce281)[_0xf5e3('0x31')](handleEntityNotFound(_0x153d3f,null))[_0xf5e3('0x31')](respondWithResult(_0x153d3f,null))[_0xf5e3('0x23')](handleError(_0x153d3f,null));};exports[_0xf5e3('0x30')]=function(_0x1c0121,_0x4309ed){if(_0x1c0121['body']['id']){delete _0x1c0121[_0xf5e3('0x53')]['id'];}return db['Setting']['find']({'where':{'id':_0x1c0121['params']['id']}})[_0xf5e3('0x31')](handleEntityNotFound(_0x4309ed,null))['then'](saveUpdates(_0x1c0121[_0xf5e3('0x53')],null))[_0xf5e3('0x31')](respondWithResult(_0x4309ed,null))['catch'](handleError(_0x4309ed,null));};exports['addLogo']=function(_0x1dbb2d,_0x408e86,_0xb28ca9){if(_0x1dbb2d[_0xf5e3('0x54')]&&_0x1dbb2d[_0xf5e3('0x54')][_0xf5e3('0x55')]){_0x1dbb2d[_0xf5e3('0x53')]['logo']=_0x1dbb2d[_0xf5e3('0x54')][_0xf5e3('0x55')];}return db[_0xf5e3('0x56')][_0xf5e3('0x52')]({'where':{'id':_0x1dbb2d[_0xf5e3('0x50')]['id']}})[_0xf5e3('0x31')](handleEntityNotFound(_0x408e86,null))[_0xf5e3('0x31')](saveUpdates(_0x1dbb2d[_0xf5e3('0x53')],null))[_0xf5e3('0x31')](respondWithResult(_0x408e86,null))['catch'](handleError(_0x408e86,null));};exports[_0xf5e3('0x57')]=function(_0x9b20de,_0xdf4428,_0x44f2ba){if(_0x9b20de['file']&&_0x9b20de[_0xf5e3('0x54')][_0xf5e3('0x55')]){_0x9b20de['body']['loginLogo']=_0x9b20de[_0xf5e3('0x54')][_0xf5e3('0x55')];}return db[_0xf5e3('0x56')][_0xf5e3('0x52')]({'where':{'id':_0x9b20de['params']['id']}})[_0xf5e3('0x31')](handleEntityNotFound(_0xdf4428,null))[_0xf5e3('0x31')](saveUpdates(_0x9b20de[_0xf5e3('0x53')],null))[_0xf5e3('0x31')](respondWithResult(_0xdf4428,null))[_0xf5e3('0x23')](handleError(_0xdf4428,null));};var utilLicense=require(_0xf5e3('0x58'));exports['getLogo']=function(_0x1754a1,_0x47f321,_0x368f61){var _0xa79efc='server/files/images/logos';var _0x4cf560={'custom':![]};return utilLicense[_0xf5e3('0x59')]()[_0xf5e3('0x31')](function(_0x21da30){if(_0x21da30){_0x4cf560=_0x21da30;}return db[_0xf5e3('0x56')]['find']({'where':{'id':_0x1754a1[_0xf5e3('0x50')]['id']},'attributes':['logo',_0xf5e3('0x5a'),_0xf5e3('0x5b'),_0xf5e3('0x5c'),_0xf5e3('0x5d'),_0xf5e3('0x5e'),'defaultPreferred',_0xf5e3('0x5f')],'raw':!![]});})[_0xf5e3('0x31')](handleEntityNotFound(_0x47f321,null))['then'](function(_0xccac7c){if(_0xccac7c){var _0x4bff20=_0xccac7c[_0xf5e3('0x60')]&&fs[_0xf5e3('0x61')](path[_0xf5e3('0x62')](config['root'],_0xa79efc,_[_0xf5e3('0x63')](_0xccac7c[_0xf5e3('0x60')])))?path['join'](config['root'],_0xa79efc,_[_0xf5e3('0x63')](_0xccac7c['logo'])):path[_0xf5e3('0x62')](config[_0xf5e3('0x64')],_0xa79efc,_[_0xf5e3('0x63')]('default_logo.svg'));var _0x2033ce=_0xf5e3('0x65')+_['upperFirst']('logo');if(_0xccac7c[_0x2033ce]||!_0x4cf560[_0xf5e3('0x66')]){_0x4bff20=path['join'](config['root'],_0xa79efc,_['toLower'](_0xf5e3('0x67')));}if(!fs[_0xf5e3('0x61')](_0x4bff20)){throw new db[(_0xf5e3('0x68'))]['ValidationError'](_[_0xf5e3('0x69')](_0xf5e3('0x60'))+_0xf5e3('0x6a'));}return _0x47f321[_0xf5e3('0x6b')](_0x4bff20);}})[_0xf5e3('0x23')](handleError(_0x47f321,null));};var utilLicense=require(_0xf5e3('0x58'));exports['getLogoLogin']=function(_0x302607,_0x15fbc8,_0x280c91){var _0x1f4b2f=_0xf5e3('0x6c');var _0x2774c7={'custom':![]};return utilLicense[_0xf5e3('0x59')]()['then'](function(_0x15e019){if(_0x15e019){_0x2774c7=_0x15e019;}return db[_0xf5e3('0x56')][_0xf5e3('0x52')]({'where':{'id':_0x302607[_0xf5e3('0x50')]['id']},'attributes':[_0xf5e3('0x60'),'loginLogo',_0xf5e3('0x5b'),'favicon',_0xf5e3('0x5d'),_0xf5e3('0x5e'),'defaultPreferred',_0xf5e3('0x5f')],'raw':!![]});})[_0xf5e3('0x31')](handleEntityNotFound(_0x15fbc8,null))[_0xf5e3('0x31')](function(_0x388833){if(_0x388833){var _0x4ae0d7=_0x388833[_0xf5e3('0x5a')]&&fs[_0xf5e3('0x61')](path[_0xf5e3('0x62')](config['root'],_0x1f4b2f,_[_0xf5e3('0x63')](_0x388833['loginLogo'])))?path[_0xf5e3('0x62')](config[_0xf5e3('0x64')],_0x1f4b2f,_[_0xf5e3('0x63')](_0x388833[_0xf5e3('0x5a')])):path[_0xf5e3('0x62')](config[_0xf5e3('0x64')],_0x1f4b2f,_[_0xf5e3('0x63')](_0xf5e3('0x6d')));var _0x3ec41c=_0xf5e3('0x65')+_['upperFirst'](_0xf5e3('0x5a'));if(_0x388833[_0x3ec41c]||!_0x2774c7[_0xf5e3('0x66')]){_0x4ae0d7=path['join'](config[_0xf5e3('0x64')],_0x1f4b2f,_[_0xf5e3('0x63')]('default_loginLogo.svg'));}if(!fs['existsSync'](_0x4ae0d7)){throw new db['Sequelize']['ValidationError'](_['upperFirst']('loginLogo')+_0xf5e3('0x6a'));}return _0x15fbc8[_0xf5e3('0x6b')](_0x4ae0d7);}})['catch'](handleError(_0x15fbc8,null));};exports[_0xf5e3('0x6e')]=function(_0x3ce623,_0x2e772c){return db['Setting'][_0xf5e3('0x52')]({'where':{'id':_0x3ce623['params']['id']},'attributes':['securePassword']})[_0xf5e3('0x31')](respondWithResult(_0x2e772c,null))['catch'](handleError(_0x2e772c,null));};exports['addPreferred']=function(_0x1b4795,_0x40f2db,_0x3f7c75){if(_0x1b4795[_0xf5e3('0x54')]&&_0x1b4795[_0xf5e3('0x54')][_0xf5e3('0x55')]){_0x1b4795[_0xf5e3('0x53')][_0xf5e3('0x5b')]=_0x1b4795[_0xf5e3('0x54')]['filename'];}return db['Setting'][_0xf5e3('0x52')]({'where':{'id':_0x1b4795[_0xf5e3('0x50')]['id']}})[_0xf5e3('0x31')](handleEntityNotFound(_0x40f2db,null))[_0xf5e3('0x31')](saveUpdates(_0x1b4795[_0xf5e3('0x53')],null))[_0xf5e3('0x31')](respondWithResult(_0x40f2db,null))['catch'](handleError(_0x40f2db,null));};var utilLicense=require('../../config/license/util');exports[_0xf5e3('0x6f')]=function(_0x3cc87c,_0x2bdd43,_0xb12bbe){var _0x3db13d=_0xf5e3('0x6c');var _0x1b0250={'custom':![]};return utilLicense['getLicense']()[_0xf5e3('0x31')](function(_0x2595a6){if(_0x2595a6){_0x1b0250=_0x2595a6;}return db[_0xf5e3('0x56')][_0xf5e3('0x52')]({'where':{'id':_0x3cc87c['params']['id']},'attributes':['logo','loginLogo',_0xf5e3('0x5b'),'favicon',_0xf5e3('0x5d'),_0xf5e3('0x5e'),_0xf5e3('0x70'),'defaultFavicon'],'raw':!![]});})[_0xf5e3('0x31')](handleEntityNotFound(_0x2bdd43,null))[_0xf5e3('0x31')](function(_0xab163b){if(_0xab163b){var _0x1ac317=_0xab163b[_0xf5e3('0x5b')]&&fs[_0xf5e3('0x61')](path[_0xf5e3('0x62')](config[_0xf5e3('0x64')],_0x3db13d,_[_0xf5e3('0x63')](_0xab163b[_0xf5e3('0x5b')])))?path[_0xf5e3('0x62')](config[_0xf5e3('0x64')],_0x3db13d,_[_0xf5e3('0x63')](_0xab163b['preferred'])):path[_0xf5e3('0x62')](config[_0xf5e3('0x64')],_0x3db13d,_[_0xf5e3('0x63')](_0xf5e3('0x71')));var _0x5b769c=_0xf5e3('0x65')+_[_0xf5e3('0x69')]('preferred');if(_0xab163b[_0x5b769c]||!_0x1b0250[_0xf5e3('0x66')]||!_0x1b0250[_0xf5e3('0x5b')]){_0x1ac317=path[_0xf5e3('0x62')](config[_0xf5e3('0x64')],_0x3db13d,_[_0xf5e3('0x63')](_0xf5e3('0x71')));}if(!fs[_0xf5e3('0x61')](_0x1ac317)){throw new db[(_0xf5e3('0x68'))][(_0xf5e3('0x72'))](_[_0xf5e3('0x69')](_0xf5e3('0x5b'))+_0xf5e3('0x6a'));}return _0x2bdd43[_0xf5e3('0x6b')](_0x1ac317);}})[_0xf5e3('0x23')](handleError(_0x2bdd43,null));};exports[_0xf5e3('0x73')]=function(_0x59011a,_0x43ae46,_0x1c2c1e){if(_0x59011a[_0xf5e3('0x54')]&&_0x59011a[_0xf5e3('0x54')][_0xf5e3('0x55')]){_0x59011a[_0xf5e3('0x53')]['favicon']=_0x59011a[_0xf5e3('0x54')][_0xf5e3('0x55')];}return db[_0xf5e3('0x56')][_0xf5e3('0x52')]({'where':{'id':_0x59011a['params']['id']}})[_0xf5e3('0x31')](handleEntityNotFound(_0x43ae46,null))[_0xf5e3('0x31')](saveUpdates(_0x59011a[_0xf5e3('0x53')],null))[_0xf5e3('0x31')](respondWithResult(_0x43ae46,null))[_0xf5e3('0x23')](handleError(_0x43ae46,null));};var utilLicense=require('../../config/license/util');exports[_0xf5e3('0x74')]=function(_0x33d6ce,_0x4a1dc3,_0x1813fb){var _0xddf0f1='server/files/images/logos';var _0x306be3={'custom':![]};return utilLicense['getLicense']()[_0xf5e3('0x31')](function(_0x515c46){if(_0x515c46){_0x306be3=_0x515c46;}return db['Setting'][_0xf5e3('0x52')]({'where':{'id':_0x33d6ce[_0xf5e3('0x50')]['id']},'attributes':['logo','loginLogo','preferred','favicon',_0xf5e3('0x5d'),_0xf5e3('0x5e'),'defaultPreferred',_0xf5e3('0x5f')],'raw':!![]});})[_0xf5e3('0x31')](handleEntityNotFound(_0x4a1dc3,null))[_0xf5e3('0x31')](function(_0x4d5b52){if(_0x4d5b52){var _0x274216=_0x4d5b52['favicon']&&fs[_0xf5e3('0x61')](path['join'](config['root'],_0xddf0f1,_[_0xf5e3('0x63')](_0x4d5b52[_0xf5e3('0x5c')])))?path[_0xf5e3('0x62')](config['root'],_0xddf0f1,_[_0xf5e3('0x63')](_0x4d5b52[_0xf5e3('0x5c')])):path[_0xf5e3('0x62')](config[_0xf5e3('0x64')],_0xddf0f1,_[_0xf5e3('0x63')](_0xf5e3('0x75')));var _0x4655c0=_0xf5e3('0x65')+_[_0xf5e3('0x69')](_0xf5e3('0x5c'));if(_0x4d5b52[_0x4655c0]||!_0x306be3['custom']){_0x274216=path[_0xf5e3('0x62')](config[_0xf5e3('0x64')],_0xddf0f1,_[_0xf5e3('0x63')](_0xf5e3('0x75')));}if(!fs[_0xf5e3('0x61')](_0x274216)){throw new db['Sequelize']['ValidationError'](_[_0xf5e3('0x69')](_0xf5e3('0x5c'))+_0xf5e3('0x6a'));}return _0x4a1dc3['download'](_0x274216);}})[_0xf5e3('0x23')](handleError(_0x4a1dc3,null));};exports[_0xf5e3('0x76')]=function(_0x46a24,_0x23eccd){var _0x1a0fc5={'offset':moment()[_0xf5e3('0x77')]()};_0x1a0fc5[_0xf5e3('0x78')]=moment()[_0xf5e3('0x77')](_0x1a0fc5[_0xf5e3('0x28')])[_0xf5e3('0x79')](_0xf5e3('0x7a'));return _0x23eccd[_0xf5e3('0x25')](0xc8)[_0xf5e3('0x35')](_0x1a0fc5);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 03cf5de..10e8a81 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x45d9bb,_0x2c0350){var _0x1a36e9=function(_0x643803){while(--_0x643803){_0x45d9bb['push'](_0x45d9bb['shift']());}};_0x1a36e9(++_0x2c0350);}(_0x3e74,0x175));var _0x43e7=function(_0x15852a,_0xa34287){_0x15852a=_0x15852a-0x0;var _0x18b79c=_0x3e74[_0x15852a];return _0x18b79c;};'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 _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 66a8836..29bad8a 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 _0xbc3f=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSetting','Setting','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x491319,_0xc31ad4){var _0x4b16bf=function(_0x3d811e){while(--_0x3d811e){_0x491319['push'](_0x491319['shift']());}};_0x4b16bf(++_0xc31ad4);}(_0xbc3f,0x1a6));var _0xfbc3=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xbc3f[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0xfbc3('0x0'));var util=require(_0xfbc3('0x1'));var moment=require(_0xfbc3('0x2'));var BPromise=require(_0xfbc3('0x3'));var rs=require(_0xfbc3('0x4'));var fs=require('fs');var Redis=require(_0xfbc3('0x5'));var db=require(_0xfbc3('0x6'))['db'];var utils=require(_0xfbc3('0x7'));var logger=require(_0xfbc3('0x8'))(_0xfbc3('0x9'));var config=require(_0xfbc3('0xa'));var jayson=require(_0xfbc3('0xb'));var client=jayson['client'][_0xfbc3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3d8094,_0x4270f5,_0x26156c){return new BPromise(function(_0x2fdb94,_0x1129d8){return client[_0xfbc3('0xd')](_0x3d8094,_0x26156c)['then'](function(_0x1cdaa6){logger[_0xfbc3('0xe')](_0xfbc3('0xf'),_0x4270f5,_0xfbc3('0x10'));logger[_0xfbc3('0x11')]('Setting,\x20%s,\x20%s,\x20%s',_0x4270f5,_0xfbc3('0x10'),JSON[_0xfbc3('0x12')](_0x1cdaa6));if(_0x1cdaa6[_0xfbc3('0x13')]){if(_0x1cdaa6[_0xfbc3('0x13')][_0xfbc3('0x14')]===0x1f4){logger[_0xfbc3('0x13')]('Setting,\x20%s,\x20%s',_0x4270f5,_0x1cdaa6[_0xfbc3('0x13')]['message']);return _0x1129d8(_0x1cdaa6[_0xfbc3('0x13')][_0xfbc3('0x15')]);}logger[_0xfbc3('0x13')](_0xfbc3('0xf'),_0x4270f5,_0x1cdaa6[_0xfbc3('0x13')][_0xfbc3('0x15')]);return _0x2fdb94(_0x1cdaa6[_0xfbc3('0x13')][_0xfbc3('0x15')]);}else{logger[_0xfbc3('0xe')]('Setting,\x20%s,\x20%s',_0x4270f5,'request\x20sent');_0x2fdb94(_0x1cdaa6[_0xfbc3('0x16')]['message']);}})[_0xfbc3('0x17')](function(_0x4a790e){logger[_0xfbc3('0x13')](_0xfbc3('0xf'),_0x4270f5,_0x4a790e);_0x1129d8(_0x4a790e);});});}exports[_0xfbc3('0x18')]=function(_0x53a338){var _0x291dea=this;return new Promise(function(_0x493e6e,_0x455d99){return db[_0xfbc3('0x19')]['find']({'raw':_0x53a338[_0xfbc3('0x1a')]?_0x53a338['options'][_0xfbc3('0x1b')]===undefined?!![]:![]:!![],'where':_0x53a338[_0xfbc3('0x1a')]?_0x53a338[_0xfbc3('0x1a')][_0xfbc3('0x1c')]||null:null,'attributes':_0x53a338['options']?_0x53a338['options'][_0xfbc3('0x1d')]||null:null,'include':_0x53a338[_0xfbc3('0x1a')]?_0x53a338['options'][_0xfbc3('0x1e')]?_['map'](_0x53a338['options'][_0xfbc3('0x1e')],function(_0x5015b6){return{'model':db[_0x5015b6['model']],'as':_0x5015b6['as'],'attributes':_0x5015b6[_0xfbc3('0x1d')],'include':_0x5015b6[_0xfbc3('0x1e')]?_[_0xfbc3('0x1f')](_0x5015b6['include'],function(_0x424d71){return{'model':db[_0x424d71[_0xfbc3('0x20')]],'as':_0x424d71['as'],'attributes':_0x424d71[_0xfbc3('0x1d')],'include':_0x424d71[_0xfbc3('0x1e')]?_[_0xfbc3('0x1f')](_0x424d71[_0xfbc3('0x1e')],function(_0x5e647e){return{'model':db[_0x5e647e[_0xfbc3('0x20')]],'as':_0x5e647e['as'],'attributes':_0x5e647e[_0xfbc3('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x90f046){logger[_0xfbc3('0xe')]('ShowSetting',_0x53a338);logger[_0xfbc3('0x11')](_0xfbc3('0x18'),_0x53a338,JSON[_0xfbc3('0x12')](_0x90f046));_0x493e6e(_0x90f046);})[_0xfbc3('0x17')](function(_0x4545a3){logger[_0xfbc3('0x13')](_0xfbc3('0x18'),_0x4545a3[_0xfbc3('0x15')],_0x53a338);_0x455d99(_0x291dea[_0xfbc3('0x13')](0x1f4,_0x4545a3[_0xfbc3('0x15')]));});});}; \ No newline at end of file +var _0xf835=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowSetting','Setting','find','options','raw','where','attributes','map','model','include','catch','lodash','util'];(function(_0x448722,_0x344dc2){var _0x5d1731=function(_0x13bfcc){while(--_0x13bfcc){_0x448722['push'](_0x448722['shift']());}};_0x5d1731(++_0x344dc2);}(_0xf835,0xec));var _0x5f83=function(_0x519ddd,_0x14913f){_0x519ddd=_0x519ddd-0x0;var _0x15c3df=_0xf835[_0x519ddd];return _0x15c3df;};'use strict';var _=require(_0x5f83('0x0'));var util=require(_0x5f83('0x1'));var moment=require(_0x5f83('0x2'));var BPromise=require(_0x5f83('0x3'));var rs=require(_0x5f83('0x4'));var fs=require('fs');var Redis=require(_0x5f83('0x5'));var db=require(_0x5f83('0x6'))['db'];var utils=require(_0x5f83('0x7'));var logger=require('../../config/logger')(_0x5f83('0x8'));var config=require(_0x5f83('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5f83('0xa')][_0x5f83('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xec62cd,_0x4503f1,_0x39ff08){return new BPromise(function(_0x185b1d,_0x1ce51a){return client[_0x5f83('0xc')](_0xec62cd,_0x39ff08)[_0x5f83('0xd')](function(_0x4e3afe){logger[_0x5f83('0xe')](_0x5f83('0xf'),_0x4503f1,_0x5f83('0x10'));logger[_0x5f83('0x11')](_0x5f83('0x12'),_0x4503f1,_0x5f83('0x10'),JSON[_0x5f83('0x13')](_0x4e3afe));if(_0x4e3afe[_0x5f83('0x14')]){if(_0x4e3afe[_0x5f83('0x14')][_0x5f83('0x15')]===0x1f4){logger[_0x5f83('0x14')]('Setting,\x20%s,\x20%s',_0x4503f1,_0x4e3afe[_0x5f83('0x14')]['message']);return _0x1ce51a(_0x4e3afe[_0x5f83('0x14')][_0x5f83('0x16')]);}logger['error'](_0x5f83('0xf'),_0x4503f1,_0x4e3afe[_0x5f83('0x14')][_0x5f83('0x16')]);return _0x185b1d(_0x4e3afe['error'][_0x5f83('0x16')]);}else{logger[_0x5f83('0xe')]('Setting,\x20%s,\x20%s',_0x4503f1,_0x5f83('0x10'));_0x185b1d(_0x4e3afe['result'][_0x5f83('0x16')]);}})['catch'](function(_0x3df03b){logger[_0x5f83('0x14')](_0x5f83('0xf'),_0x4503f1,_0x3df03b);_0x1ce51a(_0x3df03b);});});}exports[_0x5f83('0x17')]=function(_0x4251e7){var _0x167a21=this;return new Promise(function(_0x2070f0,_0x2bb3c6){return db[_0x5f83('0x18')][_0x5f83('0x19')]({'raw':_0x4251e7['options']?_0x4251e7[_0x5f83('0x1a')][_0x5f83('0x1b')]===undefined?!![]:![]:!![],'where':_0x4251e7['options']?_0x4251e7['options'][_0x5f83('0x1c')]||null:null,'attributes':_0x4251e7[_0x5f83('0x1a')]?_0x4251e7[_0x5f83('0x1a')][_0x5f83('0x1d')]||null:null,'include':_0x4251e7['options']?_0x4251e7[_0x5f83('0x1a')]['include']?_[_0x5f83('0x1e')](_0x4251e7[_0x5f83('0x1a')]['include'],function(_0x191b64){return{'model':db[_0x191b64[_0x5f83('0x1f')]],'as':_0x191b64['as'],'attributes':_0x191b64['attributes'],'include':_0x191b64[_0x5f83('0x20')]?_[_0x5f83('0x1e')](_0x191b64[_0x5f83('0x20')],function(_0x174159){return{'model':db[_0x174159[_0x5f83('0x1f')]],'as':_0x174159['as'],'attributes':_0x174159[_0x5f83('0x1d')],'include':_0x174159[_0x5f83('0x20')]?_[_0x5f83('0x1e')](_0x174159[_0x5f83('0x20')],function(_0x5af7d6){return{'model':db[_0x5af7d6[_0x5f83('0x1f')]],'as':_0x5af7d6['as'],'attributes':_0x5af7d6[_0x5f83('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5f83('0xd')](function(_0x2170f6){logger[_0x5f83('0xe')](_0x5f83('0x17'),_0x4251e7);logger['debug'](_0x5f83('0x17'),_0x4251e7,JSON[_0x5f83('0x13')](_0x2170f6));_0x2070f0(_0x2170f6);})[_0x5f83('0x21')](function(_0x5e6311){logger[_0x5f83('0x14')](_0x5f83('0x17'),_0x5e6311[_0x5f83('0x16')],_0x4251e7);_0x2bb3c6(_0x167a21['error'](0x1f4,_0x5e6311['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index e88ff67..cd7a0dc 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['/:id/users','getAgents','create','post','addAnswer','/:id/notify','notify','/:id/send','send','status','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x3ce67b,_0x1abbe6){var _0x3d39ab=function(_0x2219e3){while(--_0x2219e3){_0x3ce67b['push'](_0x3ce67b['shift']());}};_0x3d39ab(++_0x1abbe6);}(_0xabce,0x103));var _0xeabc=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xabce[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/describe',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0x9')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0x9')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);router[_0xeabc('0x9')](_0xeabc('0x10'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x11')]);router[_0xeabc('0x9')](_0xeabc('0x12'),auth['isAuthenticated'](),controller[_0xeabc('0x13')]);router[_0xeabc('0x9')](_0xeabc('0x14'),controller['statusGet']);router['get'](_0xeabc('0x15'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x16')]);router['post']('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0x17')]);router['post']('/:id/dispositions',auth[_0xeabc('0x8')](),controller['addDisposition']);router[_0xeabc('0x18')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x19')]);router[_0xeabc('0x18')](_0xeabc('0x1a'),controller[_0xeabc('0x1b')]);router[_0xeabc('0x18')]('/:id/applications',auth[_0xeabc('0x8')](),controller['addApplications']);router[_0xeabc('0x18')](_0xeabc('0x1c'),auth['isAuthenticated'](),controller[_0xeabc('0x1d')]);router[_0xeabc('0x18')](_0xeabc('0x14'),controller[_0xeabc('0x1e')]);router[_0xeabc('0x18')]('/:id/users',auth[_0xeabc('0x8')](),controller[_0xeabc('0x1f')]);router[_0xeabc('0x20')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0x21')]);router[_0xeabc('0x22')](_0xeabc('0x23'),auth['isAuthenticated'](),controller[_0xeabc('0x24')]);router['delete'](_0xeabc('0xc'),auth['isAuthenticated'](),controller[_0xeabc('0x25')]);router[_0xeabc('0x22')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x26')]);router[_0xeabc('0x22')](_0xeabc('0x15'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xeabc('0x27')]=router; \ No newline at end of file +var _0x7fbe=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','post','create','/:id/notify','notify','put','delete','removeAnswers','path','connect-timeout','express'];(function(_0x2918db,_0x787b2f){var _0x19ae07=function(_0x4d5f7f){while(--_0x4d5f7f){_0x2918db['push'](_0x2918db['shift']());}};_0x19ae07(++_0x787b2f);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x47f038,_0x68f37b){_0x47f038=_0x47f038-0x0;var _0x211674=_0x7fbe[_0x47f038];return _0x211674;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['show']);router['get'](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x10')]);router[_0xe7fb('0x9')](_0xe7fb('0x11'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x12')]);router[_0xe7fb('0x9')](_0xe7fb('0x13'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x14')]);router[_0xe7fb('0x9')](_0xe7fb('0x15'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x16')]);router['get'](_0xe7fb('0x17'),controller[_0xe7fb('0x18')]);router['get'](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['getAgents']);router[_0xe7fb('0x1a')]('/',auth['isAuthenticated'](),controller[_0xe7fb('0x1b')]);router[_0xe7fb('0x1a')](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller['addDisposition']);router[_0xe7fb('0x1a')]('/:id/canned_answers',auth[_0xe7fb('0xa')](),controller['addAnswer']);router[_0xe7fb('0x1a')](_0xe7fb('0x1c'),controller[_0xe7fb('0x1d')]);router[_0xe7fb('0x1a')]('/:id/applications',auth[_0xe7fb('0xa')](),controller['addApplications']);router[_0xe7fb('0x1a')]('/:id/send',auth[_0xe7fb('0xa')](),controller['send']);router[_0xe7fb('0x1a')](_0xe7fb('0x17'),controller['status']);router[_0xe7fb('0x1a')](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['addAgents']);router[_0xe7fb('0x1e')](_0xe7fb('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xe7fb('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0xe7fb('0x1f')](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller['removeDispositions']);router[_0xe7fb('0x1f')](_0xe7fb('0x11'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x20')]);router[_0xe7fb('0x1f')](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index e873ce6..755aec4 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 _0xe790=['name','STRING','ENUM','twilio','skebby','connectel','clicksend','plivo','bandwidth','infobip','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0xe790,0x173));var _0x0e79=function(_0x551939,_0x36f9c7){_0x551939=_0x551939-0x0;var _0x53ad1e=_0xe790[_0x551939];return _0x53ad1e;};'use strict';var Sequelize=require(_0x0e79('0x0'));var rs=require(_0x0e79('0x1'));module[_0x0e79('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x0e79('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x0e79('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x0e79('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0x0e79('0x4')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x0e79('0x4')]},'type':{'type':Sequelize[_0x0e79('0x5')](_0x0e79('0x6'),_0x0e79('0x7'),_0x0e79('0x8'),_0x0e79('0x9'),_0x0e79('0xa'),'clickatell',_0x0e79('0xb'),'csc',_0x0e79('0xc'),_0x0e79('0xd'))},'accountSid':{'type':Sequelize[_0x0e79('0x4')]},'authId':{'type':Sequelize[_0x0e79('0x4')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x0e79('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x0e79('0x4')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x0e79('0x4')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x0e79('0x4')]},'senderString':{'type':Sequelize[_0x0e79('0x4')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x0e79('0xe')],'defaultValue':function(){return _0x0e79('0xf');}},'notificationSound':{'type':Sequelize[_0x0e79('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0e79('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0e79('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0e79('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0e79('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0e79('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x0e79('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0e79('0x11')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x0e79('0x10')],'defaultValue':![],'comment':_0x0e79('0x12'),'set':function(_0x458314){if(!_0x458314)this[_0x0e79('0x13')](_0x0e79('0x14'),null);this[_0x0e79('0x13')](_0x0e79('0x15'),_0x458314);}}}; \ No newline at end of file +var _0x045a=['name','generate','ENUM','twilio','skebby','connectel','clicksend','clickatell','bandwidth','infobip','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING'];(function(_0x112d61,_0x493d23){var _0x26858f=function(_0x39bc7f){while(--_0x39bc7f){_0x112d61['push'](_0x112d61['shift']());}};_0x26858f(++_0x493d23);}(_0x045a,0x183));var _0xa045=function(_0x11d627,_0x569181){_0x11d627=_0x11d627-0x0;var _0x5ea20e=_0x045a[_0x11d627];return _0x5ea20e;};'use strict';var Sequelize=require(_0xa045('0x0'));var rs=require(_0xa045('0x1'));module[_0xa045('0x2')]={'name':{'type':Sequelize[_0xa045('0x3')],'unique':_0xa045('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xa045('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xa045('0x3')],'defaultValue':function(){return rs[_0xa045('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa045('0x6')](_0xa045('0x7'),_0xa045('0x8'),_0xa045('0x9'),_0xa045('0xa'),'plivo',_0xa045('0xb'),_0xa045('0xc'),'csc',_0xa045('0xd'),'intelepeer')},'accountSid':{'type':Sequelize[_0xa045('0x3')]},'authId':{'type':Sequelize[_0xa045('0x3')]},'authToken':{'type':Sequelize[_0xa045('0x3')]},'smsMethod':{'type':Sequelize[_0xa045('0x6')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xa045('0x3')]},'accountId':{'type':Sequelize[_0xa045('0x3')]},'senderString':{'type':Sequelize[_0xa045('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xa045('0x3')]},'notificationTemplate':{'type':Sequelize[_0xa045('0xe')],'defaultValue':function(){return _0xa045('0xf');}},'notificationSound':{'type':Sequelize[_0xa045('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa045('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa045('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa045('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa045('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa045('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa045('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa045('0x11')],'comment':_0xa045('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xa045('0x10')],'defaultValue':![],'comment':_0xa045('0x13'),'set':function(_0x45222d){if(!_0x45222d)this[_0xa045('0x14')](_0xa045('0x15'),null);this['setDataValue'](_0xa045('0x16'),_0x45222d);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index fb4d5c2..2100891 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 _0x69ab=['DELIVERED','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','state','message-id','addAgents','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','moment','mustache','util','ejs','lodash','crypto','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','redis','defaults','localhost','./smsAccount.socket','client','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','SmsAccounts','stack','name','send','Pause','map','SmsAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','VIRTUAL','filter','options','includeAll','show','params','mandatoryDispositionPause','include','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','SmsAccountId','Disposition','removeDispositions','CannedAnswer','getAnswers','findOne','hasOwnProperty','order','findAll','rows','removeAnswers','ids','SmsApplication','account','orderBy','Applications','asc','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','mobile','From','Body','messageId','MessageSid','skebby','from','sender','text','clicksend','message_id','plivo','Text','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','refid','isNil','ValidationError','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','DESC','list','omit','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','applications','push','close','unmanaged','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','sequelize','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','priority','finally','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','List','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','bandwidth','redif','inspect','connectel'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x69ab,0xe5));var _0xb69a=function(_0x386d7a,_0x3092ee){_0x386d7a=_0x386d7a-0x0;var _0x3855bf=_0x69ab[_0x386d7a];return _0x3855bf;};'use strict';var emlformat=require(_0xb69a('0x0'));var rimraf=require(_0xb69a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb69a('0x2'));var rp=require('request-promise');var moment=require(_0xb69a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb69a('0x4'));var util=require(_0xb69a('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb69a('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb69a('0x7'));var squel=require('squel');var crypto=require(_0xb69a('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xb69a('0x9'));var toCsv=require(_0xb69a('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb69a('0xb'));var qs=require(_0xb69a('0xc'));var as=require(_0xb69a('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb69a('0xe'));var utils=require(_0xb69a('0xf'));var config=require(_0xb69a('0x10'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb69a('0x11')]=_[_0xb69a('0x12')](config[_0xb69a('0x11')],{'host':_0xb69a('0x13'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb69a('0x14'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xb69a('0x15')]['http']({'port':0x232c});function respondWithRpcPromise(_0xea17a6,_0xca244d,_0x478223,_0x1a9219){return new BPromise(function(_0x903635,_0x345410){var _0x330754=_0x1a9219||client;return _0x330754[_0xb69a('0x16')](_0xea17a6,_0x478223)[_0xb69a('0x17')](function(_0x57c8c5){logger[_0xb69a('0x18')](_0xb69a('0x19'),_0xca244d,'request\x20sent');logger[_0xb69a('0x1a')](_0xb69a('0x1b'),_0xca244d,_0xb69a('0x1c'),JSON[_0xb69a('0x1d')](_0x57c8c5));if(_0x57c8c5['error']){if(_0x57c8c5[_0xb69a('0x1e')][_0xb69a('0x1f')]===0x1f4){logger[_0xb69a('0x1e')](_0xb69a('0x19'),_0xca244d,_0x57c8c5[_0xb69a('0x1e')][_0xb69a('0x20')]);return _0x345410(_0x57c8c5[_0xb69a('0x1e')][_0xb69a('0x20')]);}logger[_0xb69a('0x1e')]('SmsAccount,\x20%s,\x20%s',_0xca244d,_0x57c8c5[_0xb69a('0x1e')]['message']);return _0x903635(_0x57c8c5['error'][_0xb69a('0x20')]);}else{logger['info'](_0xb69a('0x19'),_0xca244d,_0xb69a('0x1c'));_0x903635(_0x57c8c5['result'][_0xb69a('0x20')]);}})[_0xb69a('0x21')](function(_0x19e11b){logger[_0xb69a('0x1e')](_0xb69a('0x19'),_0xca244d,_0x19e11b);_0x345410(_0x19e11b);});});}function respondWithStatusCode(_0xd19f65,_0x452428){_0x452428=_0x452428||0xcc;return function(_0x352a35){if(_0x352a35){return _0xd19f65[_0xb69a('0x22')](_0x452428);}return _0xd19f65['status'](_0x452428)['end']();};}function respondWithResult(_0x1f4757,_0x27c98b){_0x27c98b=_0x27c98b||0xc8;return function(_0x5bfd8e){if(_0x5bfd8e){return _0x1f4757[_0xb69a('0x23')](_0x27c98b)[_0xb69a('0x24')](_0x5bfd8e);}};}function respondWithFilteredResult(_0x2fd198,_0x2b6f11){return function(_0x1c72b3){if(_0x1c72b3){var _0xf9883e=typeof _0x2b6f11[_0xb69a('0x25')]===_0xb69a('0x26')&&typeof _0x2b6f11[_0xb69a('0x27')]===_0xb69a('0x26');var _0xbcc0d9=_0x1c72b3['count'];var _0x3a9575=_0xf9883e?0x0:_0x2b6f11[_0xb69a('0x25')];var _0xc2e85c=_0xf9883e?_0x1c72b3[_0xb69a('0x28')]:_0x2b6f11['offset']+_0x2b6f11[_0xb69a('0x27')];var _0x3aa5b2;if(_0xc2e85c>=_0xbcc0d9){_0xc2e85c=_0xbcc0d9;_0x3aa5b2=0xc8;}else{_0x3aa5b2=0xce;}_0x2fd198['status'](_0x3aa5b2);return _0x2fd198['set'](_0xb69a('0x29'),_0x3a9575+'-'+_0xc2e85c+'/'+_0xbcc0d9)[_0xb69a('0x24')](_0x1c72b3);}return null;};}function patchUpdates(_0x526160){return function(_0x32a15e){try{jsonpatch[_0xb69a('0x2a')](_0x32a15e,_0x526160,!![]);}catch(_0x4578cd){return BPromise[_0xb69a('0x2b')](_0x4578cd);}return _0x32a15e['save']();};}function saveUpdates(_0x11f30f,_0x5254ad){return function(_0x32bca4){if(_0x32bca4){return _0x32bca4[_0xb69a('0x2c')](_0x11f30f)[_0xb69a('0x17')](function(_0x4cb20f){return _0x4cb20f;});}return null;};}function removeEntity(_0x3609c5,_0x57e0d3){return function(_0x51c258){if(_0x51c258){return _0x51c258['destroy']()[_0xb69a('0x17')](function(){var _0x32abeb=_0x51c258['get']({'plain':!![]});var _0x34589a=_0xb69a('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x34589a,'resourceId':_0x32abeb['id']}})[_0xb69a('0x17')](function(){return _0x51c258;});})[_0xb69a('0x17')](function(){_0x3609c5[_0xb69a('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25d93d,_0x4e2fe9){return function(_0x18e96b){if(!_0x18e96b){_0x25d93d[_0xb69a('0x22')](0x194);}return _0x18e96b;};}function handleError(_0x19fbfb,_0x37b42d){_0x37b42d=_0x37b42d||0x1f4;return function(_0x194389){logger['error'](_0x194389[_0xb69a('0x2e')]);if(_0x194389['name']){delete _0x194389[_0xb69a('0x2f')];}_0x19fbfb[_0xb69a('0x23')](_0x37b42d)[_0xb69a('0x30')](_0x194389);};}exports['index']=function(_0x3b31e9,_0x30235c){var _0x33a882={'include':[{'model':db[_0xb69a('0x31')],'as':'mandatoryDispositionPause'}]},_0x5a8dab={},_0xabdb87={'count':0x0,'rows':[]};var _0xd7d050=_[_0xb69a('0x32')](db[_0xb69a('0x33')][_0xb69a('0x34')],function(_0x48d18f){return{'name':_0x48d18f['fieldName'],'type':_0x48d18f[_0xb69a('0x35')][_0xb69a('0x36')]};});_0x5a8dab[_0xb69a('0x37')]=_[_0xb69a('0x32')](_0xd7d050,_0xb69a('0x2f'));_0x5a8dab[_0xb69a('0x38')]=_[_0xb69a('0x39')](_0x3b31e9[_0xb69a('0x38')]);_0x5a8dab[_0xb69a('0x3a')]=_[_0xb69a('0x3b')](_0x5a8dab[_0xb69a('0x37')],_0x5a8dab[_0xb69a('0x38')]);_0x33a882['attributes']=_[_0xb69a('0x3b')](_0x5a8dab[_0xb69a('0x37')],qs[_0xb69a('0x3c')](_0x3b31e9[_0xb69a('0x38')][_0xb69a('0x3c')]));_0x33a882[_0xb69a('0x3d')]=_0x33a882[_0xb69a('0x3d')][_0xb69a('0x3e')]?_0x33a882[_0xb69a('0x3d')]:_0x5a8dab['model'];if(!_0x3b31e9[_0xb69a('0x38')]['hasOwnProperty'](_0xb69a('0x3f'))){_0x33a882[_0xb69a('0x27')]=qs[_0xb69a('0x27')](_0x3b31e9['query'][_0xb69a('0x27')]);_0x33a882[_0xb69a('0x25')]=qs[_0xb69a('0x25')](_0x3b31e9['query'][_0xb69a('0x25')]);}_0x33a882['order']=qs[_0xb69a('0x40')](_0x3b31e9['query'][_0xb69a('0x40')]);_0x33a882[_0xb69a('0x41')]=qs[_0xb69a('0x3a')](_[_0xb69a('0x42')](_0x3b31e9[_0xb69a('0x38')],_0x5a8dab[_0xb69a('0x3a')]),_0xd7d050);if(_0x3b31e9[_0xb69a('0x38')]['filter']){_0x33a882['where']=_['merge'](_0x33a882[_0xb69a('0x41')],{'$or':_[_0xb69a('0x32')](_0xd7d050,function(_0x3ec60d){if(_0x3ec60d[_0xb69a('0x35')]!==_0xb69a('0x43')){var _0x43d424={};_0x43d424[_0x3ec60d[_0xb69a('0x2f')]]={'$like':'%'+_0x3b31e9['query'][_0xb69a('0x44')]+'%'};return _0x43d424;}})});}_0x33a882=_['merge']({},_0x33a882,_0x3b31e9[_0xb69a('0x45')]);var _0x344afc={'where':_0x33a882[_0xb69a('0x41')]};return db[_0xb69a('0x33')][_0xb69a('0x28')](_0x344afc)[_0xb69a('0x17')](function(_0x47e801){_0xabdb87[_0xb69a('0x28')]=_0x47e801;if(_0x3b31e9[_0xb69a('0x38')][_0xb69a('0x46')]){_0x33a882['include']=[{'all':!![]}];}return db[_0xb69a('0x33')]['findAll'](_0x33a882);})[_0xb69a('0x17')](function(_0x33a466){_0xabdb87['rows']=_0x33a466;return _0xabdb87;})[_0xb69a('0x17')](respondWithFilteredResult(_0x30235c,_0x33a882))[_0xb69a('0x21')](handleError(_0x30235c,null));};exports[_0xb69a('0x47')]=function(_0x3cdf1c,_0x38c92e){var _0x21843d={'raw':![],'where':{'id':_0x3cdf1c[_0xb69a('0x48')]['id']},'include':[{'model':db['Pause'],'as':_0xb69a('0x49')}]},_0xd2c7e={};_0xd2c7e[_0xb69a('0x37')]=_[_0xb69a('0x39')](db[_0xb69a('0x33')][_0xb69a('0x34')]);_0xd2c7e[_0xb69a('0x38')]=_[_0xb69a('0x39')](_0x3cdf1c[_0xb69a('0x38')]);_0xd2c7e[_0xb69a('0x3a')]=_[_0xb69a('0x3b')](_0xd2c7e[_0xb69a('0x37')],_0xd2c7e[_0xb69a('0x38')]);_0x21843d['attributes']=_[_0xb69a('0x3b')](_0xd2c7e[_0xb69a('0x37')],qs[_0xb69a('0x3c')](_0x3cdf1c[_0xb69a('0x38')]['fields']));_0x21843d[_0xb69a('0x3d')]=_0x21843d[_0xb69a('0x3d')][_0xb69a('0x3e')]?_0x21843d[_0xb69a('0x3d')]:_0xd2c7e[_0xb69a('0x37')];if(_0x3cdf1c['query'][_0xb69a('0x46')]){_0x21843d[_0xb69a('0x4a')]=[{'all':!![]}];}_0x21843d=_[_0xb69a('0x4b')]({},_0x21843d,_0x3cdf1c[_0xb69a('0x45')]);return db[_0xb69a('0x33')][_0xb69a('0x4c')](_0x21843d)[_0xb69a('0x17')](handleEntityNotFound(_0x38c92e,null))['then'](respondWithResult(_0x38c92e,null))['catch'](handleError(_0x38c92e,null));};exports['create']=function(_0x3989e7,_0x604d1e){return db[_0xb69a('0x33')][_0xb69a('0x4d')](_0x3989e7[_0xb69a('0x4e')],{})[_0xb69a('0x17')](function(_0x345c02){var _0x512f6d=_0x3989e7[_0xb69a('0x4f')]['get']({'plain':!![]});if(!_0x512f6d)throw new Error(_0xb69a('0x50'));if(_0x512f6d[_0xb69a('0x51')]===_0xb69a('0x4f')){var _0x2dc07f=_0x345c02[_0xb69a('0x52')]({'plain':!![]});var _0x5f4f85=_0xb69a('0x2d');return db[_0xb69a('0x53')][_0xb69a('0x4c')]({'where':{'name':_0x5f4f85,'userProfileId':_0x512f6d['userProfileId']},'raw':!![]})[_0xb69a('0x17')](function(_0x3dfe2b){if(_0x3dfe2b&&_0x3dfe2b[_0xb69a('0x54')]===0x0){return db['UserProfileResource'][_0xb69a('0x4d')]({'name':_0x2dc07f[_0xb69a('0x2f')],'resourceId':_0x2dc07f['id'],'type':_0x3dfe2b[_0xb69a('0x2f')],'sectionId':_0x3dfe2b['id']},{})[_0xb69a('0x17')](function(){return _0x345c02;});}else{return _0x345c02;}})['catch'](function(_0x866599){logger['error'](_0xb69a('0x55'),_0x866599);throw _0x866599;});}return _0x345c02;})[_0xb69a('0x17')](respondWithResult(_0x604d1e,0xc9))[_0xb69a('0x21')](handleError(_0x604d1e,null));};exports[_0xb69a('0x2c')]=function(_0x4e1f83,_0x1b28ef){if(_0x4e1f83[_0xb69a('0x4e')]['id']){delete _0x4e1f83['body']['id'];}return db[_0xb69a('0x33')]['find']({'where':{'id':_0x4e1f83[_0xb69a('0x48')]['id']},'include':[{'model':db[_0xb69a('0x31')],'as':_0xb69a('0x49')}]})[_0xb69a('0x17')](handleEntityNotFound(_0x1b28ef,null))[_0xb69a('0x17')](saveUpdates(_0x4e1f83[_0xb69a('0x4e')],null))['then'](respondWithResult(_0x1b28ef,null))[_0xb69a('0x21')](handleError(_0x1b28ef,null));};exports[_0xb69a('0x56')]=function(_0x2c93e2,_0x283d6c){return db['SmsAccount'][_0xb69a('0x4c')]({'where':{'id':_0x2c93e2[_0xb69a('0x48')]['id']}})[_0xb69a('0x17')](handleEntityNotFound(_0x283d6c,null))[_0xb69a('0x17')](removeEntity(_0x283d6c,null))['catch'](handleError(_0x283d6c,null));};exports['describe']=function(_0x29b7f7,_0x35ab1d){return db['SmsAccount'][_0xb69a('0x57')]()[_0xb69a('0x17')](respondWithResult(_0x35ab1d,null))[_0xb69a('0x21')](handleError(_0x35ab1d,null));};exports['addDisposition']=function(_0x18a30e,_0x2df867,_0xda0ad4){if(_0x18a30e[_0xb69a('0x4e')]['id']){delete _0x18a30e['body']['id'];}return db[_0xb69a('0x33')][_0xb69a('0x4c')]({'where':{'id':_0x18a30e[_0xb69a('0x48')]['id']}})[_0xb69a('0x17')](handleEntityNotFound(_0x2df867,null))[_0xb69a('0x17')](function(_0x59d657){if(_0x59d657){_0x18a30e['body'][_0xb69a('0x58')]=_0x59d657['id'];return db['Disposition'][_0xb69a('0x4d')](_0x18a30e[_0xb69a('0x4e')]);}})[_0xb69a('0x17')](respondWithResult(_0x2df867,null))['catch'](handleError(_0x2df867,null));};exports['getDispositions']=function(_0x56fe33,_0x332691,_0xec8373){var _0xe339c={'raw':![],'where':{}};var _0x57571a={};var _0x57bdcf={'count':0x0,'rows':[]};return db[_0xb69a('0x33')]['findOne']({'where':{'id':_0x56fe33[_0xb69a('0x48')]['id']}})[_0xb69a('0x17')](handleEntityNotFound(_0x332691,null))['then'](function(_0x235448){if(_0x235448){_0x57571a[_0xb69a('0x37')]=_[_0xb69a('0x39')](db[_0xb69a('0x59')]['rawAttributes']);_0x57571a['query']=_[_0xb69a('0x39')](_0x56fe33[_0xb69a('0x38')]);_0x57571a['filters']=_[_0xb69a('0x3b')](_0x57571a['model'],_0x57571a[_0xb69a('0x38')]);_0xe339c[_0xb69a('0x3d')]=_[_0xb69a('0x3b')](_0x57571a['model'],qs['fields'](_0x56fe33[_0xb69a('0x38')][_0xb69a('0x3c')]));_0xe339c[_0xb69a('0x3d')]=_0xe339c['attributes'][_0xb69a('0x3e')]?_0xe339c[_0xb69a('0x3d')]:_0x57571a[_0xb69a('0x37')];if(!_0x56fe33['query']['hasOwnProperty']('nolimit')){_0xe339c[_0xb69a('0x27')]=qs[_0xb69a('0x27')](_0x56fe33[_0xb69a('0x38')][_0xb69a('0x27')]);_0xe339c[_0xb69a('0x25')]=qs[_0xb69a('0x25')](_0x56fe33[_0xb69a('0x38')][_0xb69a('0x25')]);}_0xe339c['order']=qs[_0xb69a('0x40')](_0x56fe33[_0xb69a('0x38')][_0xb69a('0x40')]);_0xe339c[_0xb69a('0x41')]=qs[_0xb69a('0x3a')](_[_0xb69a('0x42')](_0x56fe33['query'],_0x57571a[_0xb69a('0x3a')]));_0xe339c['where'][_0xb69a('0x58')]=_0x235448['id'];if(_0x56fe33[_0xb69a('0x38')][_0xb69a('0x44')]){_0xe339c[_0xb69a('0x41')]=_['merge'](_0xe339c[_0xb69a('0x41')],{'$or':_[_0xb69a('0x32')](_0xe339c['attributes'],function(_0x116e75){var _0x4bb94f={};_0x4bb94f[_0x116e75]={'$like':'%'+_0x56fe33[_0xb69a('0x38')][_0xb69a('0x44')]+'%'};return _0x4bb94f;})});}_0xe339c=_[_0xb69a('0x4b')]({},_0xe339c,_0x56fe33[_0xb69a('0x45')]);return db['Disposition'][_0xb69a('0x28')]({'where':_0xe339c[_0xb69a('0x41')]})[_0xb69a('0x17')](function(_0x32ca71){_0x57bdcf['count']=_0x32ca71;if(_0x56fe33[_0xb69a('0x38')][_0xb69a('0x46')]){_0xe339c[_0xb69a('0x4a')]=[{'all':!![]}];}return db[_0xb69a('0x59')]['findAll'](_0xe339c);})[_0xb69a('0x17')](function(_0x4b2f39){_0x57bdcf['rows']=_0x4b2f39;return _0x57bdcf;});}})[_0xb69a('0x17')](respondWithFilteredResult(_0x332691,_0xe339c))[_0xb69a('0x21')](handleError(_0x332691,null));};exports[_0xb69a('0x5a')]=function(_0x37bd95,_0xd529f6,_0x40f77c){return db[_0xb69a('0x33')][_0xb69a('0x4c')]({'where':{'id':_0x37bd95[_0xb69a('0x48')]['id']}})[_0xb69a('0x17')](handleEntityNotFound(_0xd529f6,null))[_0xb69a('0x17')](function(_0xa1228f){if(_0xa1228f){return _0xa1228f['removeDispositions'](_0x37bd95['query']['ids']);}})[_0xb69a('0x17')](respondWithStatusCode(_0xd529f6,null))[_0xb69a('0x21')](handleError(_0xd529f6,null));};exports['addAnswer']=function(_0x2cc8ce,_0x40d38f,_0x5ad757){if(_0x2cc8ce[_0xb69a('0x4e')]['id']){delete _0x2cc8ce['body']['id'];}return db[_0xb69a('0x33')][_0xb69a('0x4c')]({'where':{'id':_0x2cc8ce['params']['id']}})[_0xb69a('0x17')](handleEntityNotFound(_0x40d38f,null))[_0xb69a('0x17')](function(_0x22aa69){if(_0x22aa69){_0x2cc8ce[_0xb69a('0x4e')][_0xb69a('0x58')]=_0x22aa69['id'];return db[_0xb69a('0x5b')]['create'](_0x2cc8ce[_0xb69a('0x4e')]);}})['then'](respondWithResult(_0x40d38f,null))[_0xb69a('0x21')](handleError(_0x40d38f,null));};exports[_0xb69a('0x5c')]=function(_0xbe3689,_0x164c80,_0x1e8c17){var _0x5be564={'raw':![],'where':{}};var _0x4ffbda={};var _0x4c91ab={'count':0x0,'rows':[]};return db[_0xb69a('0x33')][_0xb69a('0x5d')]({'where':{'id':_0xbe3689[_0xb69a('0x48')]['id']}})[_0xb69a('0x17')](handleEntityNotFound(_0x164c80,null))[_0xb69a('0x17')](function(_0x204b6b){if(_0x204b6b){_0x4ffbda[_0xb69a('0x37')]=_[_0xb69a('0x39')](db['CannedAnswer']['rawAttributes']);_0x4ffbda[_0xb69a('0x38')]=_['keys'](_0xbe3689['query']);_0x4ffbda[_0xb69a('0x3a')]=_[_0xb69a('0x3b')](_0x4ffbda['model'],_0x4ffbda[_0xb69a('0x38')]);_0x5be564[_0xb69a('0x3d')]=_['intersection'](_0x4ffbda[_0xb69a('0x37')],qs[_0xb69a('0x3c')](_0xbe3689[_0xb69a('0x38')]['fields']));_0x5be564[_0xb69a('0x3d')]=_0x5be564[_0xb69a('0x3d')]['length']?_0x5be564[_0xb69a('0x3d')]:_0x4ffbda[_0xb69a('0x37')];if(!_0xbe3689[_0xb69a('0x38')][_0xb69a('0x5e')](_0xb69a('0x3f'))){_0x5be564[_0xb69a('0x27')]=qs['limit'](_0xbe3689[_0xb69a('0x38')][_0xb69a('0x27')]);_0x5be564[_0xb69a('0x25')]=qs[_0xb69a('0x25')](_0xbe3689[_0xb69a('0x38')][_0xb69a('0x25')]);}_0x5be564[_0xb69a('0x5f')]=qs['sort'](_0xbe3689[_0xb69a('0x38')]['sort']);_0x5be564[_0xb69a('0x41')]=qs['filters'](_[_0xb69a('0x42')](_0xbe3689['query'],_0x4ffbda[_0xb69a('0x3a')]));_0x5be564[_0xb69a('0x41')][_0xb69a('0x58')]=_0x204b6b['id'];if(_0xbe3689['query'][_0xb69a('0x44')]){_0x5be564[_0xb69a('0x41')]=_[_0xb69a('0x4b')](_0x5be564['where'],{'$or':_[_0xb69a('0x32')](_0x5be564[_0xb69a('0x3d')],function(_0x478c37){var _0x14e3a6={};_0x14e3a6[_0x478c37]={'$like':'%'+_0xbe3689[_0xb69a('0x38')][_0xb69a('0x44')]+'%'};return _0x14e3a6;})});}_0x5be564=_[_0xb69a('0x4b')]({},_0x5be564,_0xbe3689['options']);return db[_0xb69a('0x5b')][_0xb69a('0x28')]({'where':_0x5be564['where']})[_0xb69a('0x17')](function(_0xf9f648){_0x4c91ab[_0xb69a('0x28')]=_0xf9f648;if(_0xbe3689[_0xb69a('0x38')][_0xb69a('0x46')]){_0x5be564[_0xb69a('0x4a')]=[{'all':!![]}];}return db['CannedAnswer'][_0xb69a('0x60')](_0x5be564);})[_0xb69a('0x17')](function(_0xbfffdd){_0x4c91ab[_0xb69a('0x61')]=_0xbfffdd;return _0x4c91ab;});}})['then'](respondWithFilteredResult(_0x164c80,_0x5be564))[_0xb69a('0x21')](handleError(_0x164c80,null));};exports[_0xb69a('0x62')]=function(_0x235250,_0x39196d,_0xcec3fa){return db[_0xb69a('0x33')][_0xb69a('0x4c')]({'where':{'id':_0x235250[_0xb69a('0x48')]['id']}})['then'](handleEntityNotFound(_0x39196d,null))[_0xb69a('0x17')](function(_0x1906c2){if(_0x1906c2){return _0x1906c2[_0xb69a('0x62')](_0x235250[_0xb69a('0x38')][_0xb69a('0x63')]);}})[_0xb69a('0x17')](respondWithStatusCode(_0x39196d,null))[_0xb69a('0x21')](handleError(_0x39196d,null));};exports['notify']=function(_0x199533,_0x81fd5b,_0x23cf5e){var _0x58107a={'channel':'sms'};var _0x73569d=[];var _0xc66ed9=[];var _0x2cabb6={};return db[_0xb69a('0x33')][_0xb69a('0x4c')]({'where':{'id':_0x199533[_0xb69a('0x48')]['id']},'include':[{'model':db[_0xb69a('0x64')],'as':'Applications'}]})[_0xb69a('0x17')](handleEntityNotFound(_0x81fd5b,null))[_0xb69a('0x17')](function(_0x4ef525){_0x58107a[_0xb69a('0x65')]=_0x4ef525;_0x58107a['applications']=_[_0xb69a('0x66')](_0x4ef525[_0xb69a('0x67')],['priority'],[_0xb69a('0x68')]);if(_0x58107a['account'][_0xb69a('0x67')]){delete _0x58107a[_0xb69a('0x65')][_0xb69a('0x67')];}return db[_0xb69a('0x69')][_0xb69a('0x57')]();})[_0xb69a('0x17')](function(_0x56e4c1){if(!_0x56e4c1){throw new db[(_0xb69a('0x6a'))]['ValidationError']('no\x20available\x20attributes');}_0x73569d=_[_0xb69a('0x6b')](_[_0xb69a('0x39')](_0x56e4c1),[_0xb69a('0x6c'),_0xb69a('0x6d')]);_0xc66ed9=_[_0xb69a('0x6b')](_['keys'](_0x56e4c1),['createdAt',_0xb69a('0x6d'),_0xb69a('0x6e'),_0xb69a('0x6f')]);_0x58107a[_0xb69a('0x4e')]={'mapKey':_0xb69a('0x70')};if(_0x58107a[_0xb69a('0x65')][_0xb69a('0x35')]){switch(_0x58107a[_0xb69a('0x65')]['type']){case'twilio':_0x58107a[_0xb69a('0x4e')]['from']=_0x199533[_0xb69a('0x4e')][_0xb69a('0x71')];_0x58107a[_0xb69a('0x4e')][_0xb69a('0x4e')]=_0x199533[_0xb69a('0x4e')][_0xb69a('0x72')];_0x58107a[_0xb69a('0x4e')][_0xb69a('0x73')]=_0x199533[_0xb69a('0x4e')][_0xb69a('0x74')];break;case _0xb69a('0x75'):_0x58107a[_0xb69a('0x4e')][_0xb69a('0x76')]='+'+_0x199533['body'][_0xb69a('0x77')];_0x58107a['body'][_0xb69a('0x4e')]=_0x199533[_0xb69a('0x4e')][_0xb69a('0x78')];break;case'connectel':_0x58107a[_0xb69a('0x4e')]['from']=_0x199533['body']['from'];_0x58107a[_0xb69a('0x4e')]['body']=_0x199533[_0xb69a('0x4e')][_0xb69a('0x20')];break;case _0xb69a('0x79'):_0x58107a['body'][_0xb69a('0x76')]=_0x199533[_0xb69a('0x4e')][_0xb69a('0x76')];_0x58107a[_0xb69a('0x4e')][_0xb69a('0x4e')]=_0x199533[_0xb69a('0x4e')]['body'];_0x58107a['body'][_0xb69a('0x73')]=_0x199533[_0xb69a('0x4e')][_0xb69a('0x7a')];break;case _0xb69a('0x7b'):_0x58107a['body'][_0xb69a('0x76')]=_0x199533['body']['From'];_0x58107a[_0xb69a('0x4e')][_0xb69a('0x4e')]=_0x199533['body'][_0xb69a('0x7c')];_0x58107a[_0xb69a('0x4e')][_0xb69a('0x73')]=_0x199533[_0xb69a('0x4e')]['MessageUUID'];break;case'infobip':_0x58107a['body']['from']='+'+_0x199533[_0xb69a('0x4e')]['results'][0x0][_0xb69a('0x76')];_0x58107a[_0xb69a('0x4e')][_0xb69a('0x4e')]=_0x199533['body']['results'][0x0][_0xb69a('0x78')];_0x58107a[_0xb69a('0x4e')][_0xb69a('0x73')]=_0x199533[_0xb69a('0x4e')][_0xb69a('0x7d')][0x0]['messageId'];break;case _0xb69a('0x7e'):_0x58107a[_0xb69a('0x4e')]['from']=_0x199533['body'][_0xb69a('0x7f')];_0x58107a['body'][_0xb69a('0x4e')]=_0x199533[_0xb69a('0x4e')][_0xb69a('0x80')][_0xb69a('0x20')];break;case _0xb69a('0x81'):_0x58107a[_0xb69a('0x4e')]['from']=_0x199533[_0xb69a('0x4e')][_0xb69a('0x82')];_0x58107a[_0xb69a('0x4e')][_0xb69a('0x4e')]=_0x199533[_0xb69a('0x4e')][_0xb69a('0x78')];_0x58107a[_0xb69a('0x4e')][_0xb69a('0x73')]=_0x199533[_0xb69a('0x4e')][_0xb69a('0x83')];break;case'bandwidth':_0x58107a[_0xb69a('0x4e')]['messageId']=_0x199533[_0xb69a('0x4e')][0x0]['message']['id'];_0x58107a[_0xb69a('0x4e')][_0xb69a('0x76')]=_0x199533[_0xb69a('0x4e')][0x0][_0xb69a('0x20')][_0xb69a('0x76')];_0x58107a[_0xb69a('0x4e')]['body']=_0x199533[_0xb69a('0x4e')][0x0][_0xb69a('0x20')][_0xb69a('0x78')];break;case _0xb69a('0x84'):_0x58107a[_0xb69a('0x4e')][_0xb69a('0x76')]=_0x199533[_0xb69a('0x4e')][_0xb69a('0x76')];_0x58107a[_0xb69a('0x4e')][_0xb69a('0x4e')]=_0x199533[_0xb69a('0x4e')]['message'];_0x58107a['body'][_0xb69a('0x73')]=_0x199533[_0xb69a('0x4e')][_0xb69a('0x85')];break;}}if(_0x58107a['body']['id']){delete _0x58107a[_0xb69a('0x4e')]['id'];}if(_[_0xb69a('0x86')](_0x58107a[_0xb69a('0x4e')][_0xb69a('0x76')])){throw new db['Sequelize'][(_0xb69a('0x87'))]('from\x20is\x20mandatory');}if(_[_0xb69a('0x86')](_0x58107a[_0xb69a('0x4e')]['body'])||_0x58107a[_0xb69a('0x4e')][_0xb69a('0x4e')]===''){throw new db[(_0xb69a('0x6a'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb69a('0x86')](_0x58107a[_0xb69a('0x4e')][_0xb69a('0x88')])){throw new db[(_0xb69a('0x6a'))][(_0xb69a('0x87'))](_0xb69a('0x89')+_0xc66ed9);}if(!_[_0xb69a('0x8a')](_0xc66ed9,_0x58107a[_0xb69a('0x4e')][_0xb69a('0x88')])){throw new db[(_0xb69a('0x6a'))][(_0xb69a('0x87'))](_0xb69a('0x8b')+_0xc66ed9);}_0x2cabb6[_0x58107a[_0xb69a('0x4e')]['mapKey']]=_0x58107a[_0xb69a('0x4e')][_0xb69a('0x76')];return db['CmList']['find']({'where':{'id':_0x58107a['account'][_0xb69a('0x6f')]},'include':[{'model':db[_0xb69a('0x69')],'as':'Contacts','where':_0x2cabb6,'limit':0x1,'order':[[_0xb69a('0x6d'),_0xb69a('0x8c')]]}]});})[_0xb69a('0x17')](handleEntityNotFound(_0x81fd5b,null))['then'](function(_0x2164b1){if(_0x2164b1){_0x58107a[_0xb69a('0x8d')]=_[_0xb69a('0x8e')](_0x2164b1,['Contacts']);if(_0x2164b1['Contacts']['length']){return _0x2164b1[_0xb69a('0x8f')][0x0];}var _0x340352=_['defaults'](_0x58107a['body'],{'firstName':_0x58107a[_0xb69a('0x4e')][_0xb69a('0x76')],'ListId':_0x2164b1['id']});_0x340352[_0x58107a[_0xb69a('0x4e')][_0xb69a('0x88')]]=_0x58107a[_0xb69a('0x4e')][_0xb69a('0x76')];return db[_0xb69a('0x69')]['create'](_0x340352,{'fields':_0x73569d,'raw':!![]});}})['then'](handleEntityNotFound(_0x81fd5b,null))['then'](function(_0x22871a){if(_0x22871a){_0x58107a[_0xb69a('0x90')]=_0x22871a;var _0x44405a={'ContactId':_0x22871a['id'],'phone':_0x58107a[_0xb69a('0x4e')][_0xb69a('0x76')],'SmsAccountId':_0x199533[_0xb69a('0x48')]['id']};var _0x5b7fe0={'ContactId':_0x22871a['id'],'SmsAccountId':_0x199533[_0xb69a('0x48')]['id'],'closed':![]};return db[_0xb69a('0x91')][_0xb69a('0x4c')]({'where':_0x5b7fe0})[_0xb69a('0x17')](function(_0x371a84){if(_0x371a84){return[_0x371a84,![]];}return db[_0xb69a('0x91')][_0xb69a('0x4d')](_0x44405a)[_0xb69a('0x17')](function(_0x4e50e2){return[_0x4e50e2,!![]];});});}})[_0xb69a('0x92')](function(_0x37da6c,_0x358327){_0x58107a[_0xb69a('0x93')]=_0x37da6c[_0xb69a('0x52')]({'plain':!![]});_0x58107a['interaction'][_0xb69a('0x94')]=![];if(_0x358327){if(_0x58107a['account'][_0xb69a('0x95')]){_0x58107a[_0xb69a('0x96')][_0xb69a('0x97')]({'id':0x0,'priority':_0x58107a[_0xb69a('0x96')][_0xb69a('0x3e')]+0x1,'app':_0xb69a('0x98'),'appdata':_0xb69a('0x99'),'interval':'*,*,*,*'});}_0x58107a['interaction'][_0xb69a('0x94')]=!![];}return db[_0xb69a('0x9a')][_0xb69a('0x4d')]({'phone':_0x58107a[_0xb69a('0x4e')][_0xb69a('0x76')],'messageId':_0x58107a[_0xb69a('0x4e')][_0xb69a('0x73')],'body':_0x58107a[_0xb69a('0x4e')][_0xb69a('0x4e')],'SmsAccountId':_0x199533[_0xb69a('0x48')]['id'],'SmsInteractionId':_0x37da6c['id'],'direction':'in','ContactId':_0x37da6c[_0xb69a('0x9b')],'AttachmentId':_0x58107a[_0xb69a('0x4e')][_0xb69a('0x9c')]});})[_0xb69a('0x17')](function(_0x456f30){_0x58107a['message']=_0x456f30;if(_0x58107a[_0xb69a('0x93')][_0xb69a('0x9d')]){return db[_0xb69a('0x9e')][_0xb69a('0x4c')]({'attributes':['id','name'],'where':{'id':_0x58107a[_0xb69a('0x93')][_0xb69a('0x9d')]}})[_0xb69a('0x17')](function(_0x549d1b){if(_0x549d1b){_0x58107a[_0xb69a('0x96')][_0xb69a('0x9f')]({'id':0x0,'priority':0x0,'app':_0xb69a('0xa0'),'appdata':_0x549d1b[_0xb69a('0x2f')]+','+(_0x58107a['account'][_0xb69a('0xa1')]||0xa),'interval':_0xb69a('0xa2')});}return respondWithRpcPromise(_0xb69a('0xa3'),_0xb69a('0xa4'),_0x58107a);});}return respondWithRpcPromise(_0xb69a('0xa3'),_0xb69a('0xa4'),_0x58107a);})[_0xb69a('0x17')](function(_0xa80dd1){if(_0xa80dd1){var _0x790447=0xc8;var _0x5f4030=_0xb69a('0xa5');logger[_0xb69a('0x18')](_0xb69a('0x1b'),_0x5f4030,_0x790447,_0xb69a('0xa6'));logger[_0xb69a('0x1a')](_0xb69a('0xa7'),_0x5f4030,_0x790447,'entity\x20found',JSON[_0xb69a('0x1d')](_0xa80dd1));if(_0x58107a[_0xb69a('0x65')][_0xb69a('0x35')]===_0xb69a('0xa8')){return _0x81fd5b[_0xb69a('0x23')](_0x790447)['set'](_0xb69a('0xa9'),_0xb69a('0xaa'))[_0xb69a('0x30')](_0xb69a('0xab'));}else{return _0x81fd5b[_0xb69a('0x23')](_0x790447)[_0xb69a('0x24')](_0xa80dd1);}}})['catch'](handleError(_0x81fd5b,null));};exports['addApplications']=function(_0x71e3a4,_0x21976e){var _0x3b8c2d=_0x71e3a4[_0xb69a('0x48')]['id'];var _0x260790=_0x71e3a4[_0xb69a('0x4e')];var _0x26ff81=0xc8;var _0x14ae0b=null;return db[_0xb69a('0xac')]['transaction']({'isolationLevel':db[_0xb69a('0xac')][_0xb69a('0xad')][_0xb69a('0xae')]['READ_COMMITTED']},function(_0x2a7e4b){return db[_0xb69a('0x33')][_0xb69a('0x5d')]({'where':{'id':_0x3b8c2d},'transaction':_0x2a7e4b})['then'](function(_0x527d2){if(_0x527d2){return db[_0xb69a('0x64')][_0xb69a('0x56')]({'where':{'SmsAccountId':_0x3b8c2d},'transaction':_0x2a7e4b})[_0xb69a('0x17')](function(){var _0x149fbd=_[_0xb69a('0x32')](_0x260790,function(_0x2a431d){_0x2a431d[_0xb69a('0x58')]=_0x3b8c2d;return _0x2a431d;});return db[_0xb69a('0x64')][_0xb69a('0xaf')](_0x149fbd,{'transaction':_0x2a7e4b});});}else{_0x26ff81=0x194;_0x14ae0b=[];}});})['then'](function(){if(_0x26ff81!==0x194){return db['SmsApplication'][_0xb69a('0xb0')]({'where':{'SmsAccountId':_0x3b8c2d},'order':_0xb69a('0xb1')})[_0xb69a('0x17')](function(_0x4857d4){_0x14ae0b=_0x4857d4;});}})['catch'](function(_0x31c7b8){_0x26ff81=0x1f4;logger[_0xb69a('0x1e')](_0x31c7b8[_0xb69a('0x2e')]);if(_0x31c7b8[_0xb69a('0x2f')]){delete _0x31c7b8['name'];}_0x14ae0b=_0x31c7b8;})[_0xb69a('0xb2')](function(){if(_0x14ae0b===null){_0x21976e['sendStatus'](_0x26ff81);}else{if(_0x26ff81===0x1f4){_0x21976e[_0xb69a('0x23')](_0x26ff81)[_0xb69a('0x30')](_0x14ae0b);}else{_0x21976e[_0xb69a('0x23')](_0x26ff81)['json'](_0x14ae0b);}}});};exports[_0xb69a('0xb3')]=function(_0x44abac,_0x463d19,_0x4ef4a8){var _0x2e5915={};var _0xe17369={};var _0x43bae1;var _0xcfd18;return db[_0xb69a('0x33')][_0xb69a('0x5d')]({'where':{'id':_0x44abac[_0xb69a('0x48')]['id']}})[_0xb69a('0x17')](handleEntityNotFound(_0x463d19,null))[_0xb69a('0x17')](function(_0x4b949f){if(_0x4b949f){_0x43bae1=_0x4b949f;_0xe17369[_0xb69a('0x37')]=_[_0xb69a('0x39')](db[_0xb69a('0x64')][_0xb69a('0x34')]);_0xe17369[_0xb69a('0x38')]=_[_0xb69a('0x39')](_0x44abac[_0xb69a('0x38')]);_0xe17369[_0xb69a('0x3a')]=_[_0xb69a('0x3b')](_0xe17369['model'],_0xe17369[_0xb69a('0x38')]);_0x2e5915[_0xb69a('0x3d')]=_[_0xb69a('0x3b')](_0xe17369['model'],qs[_0xb69a('0x3c')](_0x44abac[_0xb69a('0x38')][_0xb69a('0x3c')]));_0x2e5915[_0xb69a('0x3d')]=_0x2e5915[_0xb69a('0x3d')]['length']?_0x2e5915[_0xb69a('0x3d')]:_0xe17369[_0xb69a('0x37')];_0x2e5915[_0xb69a('0x5f')]=qs[_0xb69a('0x40')](_0x44abac[_0xb69a('0x38')][_0xb69a('0x40')]);_0x2e5915['where']=qs[_0xb69a('0x3a')](_[_0xb69a('0x42')](_0x44abac[_0xb69a('0x38')],_0xe17369['filters']));if(_0x44abac[_0xb69a('0x38')][_0xb69a('0x44')]){_0x2e5915[_0xb69a('0x41')]=_[_0xb69a('0x4b')](_0x2e5915['where'],{'$or':_[_0xb69a('0x32')](_0x2e5915[_0xb69a('0x3d')],function(_0x523792){var _0x3ece3d={};_0x3ece3d[_0x523792]={'$like':'%'+_0x44abac['query'][_0xb69a('0x44')]+'%'};return _0x3ece3d;})});}_0x2e5915=_[_0xb69a('0x4b')]({},_0x2e5915,_0x44abac[_0xb69a('0x45')]);return _0x43bae1[_0xb69a('0xb3')](_0x2e5915);}})[_0xb69a('0x17')](function(_0x32b943){if(_0x32b943){_0xcfd18=_0x32b943[_0xb69a('0x3e')];if(!_0x44abac[_0xb69a('0x38')][_0xb69a('0x5e')](_0xb69a('0x3f'))){_0x2e5915['limit']=qs['limit'](_0x44abac['query'][_0xb69a('0x27')]);_0x2e5915['offset']=qs[_0xb69a('0x25')](_0x44abac[_0xb69a('0x38')][_0xb69a('0x25')]);}return _0x43bae1[_0xb69a('0xb3')](_0x2e5915);}})[_0xb69a('0x17')](function(_0x69cdc1){if(_0x69cdc1){return _0x69cdc1?{'count':_0xcfd18,'rows':_0x69cdc1}:null;}})[_0xb69a('0x17')](respondWithResult(_0x463d19,null))['catch'](handleError(_0x463d19,null));};exports[_0xb69a('0xb4')]=function(_0x2172d3,_0x469de8,_0x44eeb7){var _0x4b643b={'raw':![],'where':{}};var _0x597a35={};var _0x2db483={'count':0x0,'rows':[]};return db[_0xb69a('0x33')][_0xb69a('0x5d')]({'where':{'id':_0x2172d3[_0xb69a('0x48')]['id']}})[_0xb69a('0x17')](handleEntityNotFound(_0x469de8,null))['then'](function(_0x445c00){if(_0x445c00){_0x597a35['model']=_['keys'](db[_0xb69a('0x91')][_0xb69a('0x34')]);_0x597a35[_0xb69a('0x38')]=_['keys'](_0x2172d3['query']);_0x597a35[_0xb69a('0x3a')]=_[_0xb69a('0x3b')](_0x597a35[_0xb69a('0x37')],_0x597a35[_0xb69a('0x38')]);_0x4b643b[_0xb69a('0x3d')]=_[_0xb69a('0x3b')](_0x597a35[_0xb69a('0x37')],qs[_0xb69a('0x3c')](_0x2172d3[_0xb69a('0x38')][_0xb69a('0x3c')]));_0x4b643b[_0xb69a('0x3d')]=_0x4b643b[_0xb69a('0x3d')][_0xb69a('0x3e')]?_0x4b643b[_0xb69a('0x3d')]:_0x597a35[_0xb69a('0x37')];if(!_0x2172d3[_0xb69a('0x38')]['hasOwnProperty']('nolimit')){_0x4b643b[_0xb69a('0x27')]=qs[_0xb69a('0x27')](_0x2172d3['query'][_0xb69a('0x27')]);_0x4b643b[_0xb69a('0x25')]=qs[_0xb69a('0x25')](_0x2172d3['query'][_0xb69a('0x25')]);}_0x4b643b[_0xb69a('0x5f')]=qs[_0xb69a('0x40')](_0x2172d3[_0xb69a('0x38')][_0xb69a('0x40')]);_0x4b643b['where']=qs[_0xb69a('0x3a')](_[_0xb69a('0x42')](_0x2172d3[_0xb69a('0x38')],_0x597a35['filters']));_0x4b643b[_0xb69a('0x41')][_0xb69a('0x58')]=_0x445c00['id'];if(_0x2172d3[_0xb69a('0x38')][_0xb69a('0x44')]){_0x4b643b[_0xb69a('0x41')]=_[_0xb69a('0x4b')](_0x4b643b[_0xb69a('0x41')],{'$or':_[_0xb69a('0x32')](_0x4b643b[_0xb69a('0x3d')],function(_0x5230b0){var _0x14d5f7={};_0x14d5f7[_0x5230b0]={'$like':'%'+_0x2172d3['query']['filter']+'%'};return _0x14d5f7;})});}_0x4b643b=_[_0xb69a('0x4b')]({},_0x4b643b,_0x2172d3[_0xb69a('0x45')]);return db[_0xb69a('0x91')][_0xb69a('0x28')]({'where':_0x4b643b[_0xb69a('0x41')]})[_0xb69a('0x17')](function(_0x20a98f){_0x2db483[_0xb69a('0x28')]=_0x20a98f;if(_0x2172d3['query']['includeAll']){_0x4b643b[_0xb69a('0x4a')]=[{'model':db[_0xb69a('0x69')],'as':_0xb69a('0xb5'),'required':![]},{'model':db[_0xb69a('0x9e')],'as':'Owner','attributes':[_0xb69a('0x2f'),_0xb69a('0xb6'),_0xb69a('0xb7')],'required':![]},{'model':db[_0xb69a('0xb8')],'as':_0xb69a('0xb9'),'attributes':['id',_0xb69a('0x2f'),_0xb69a('0xba')],'where':_0x2172d3[_0xb69a('0x38')][_0xb69a('0xbb')]?{'id':_0x2172d3[_0xb69a('0x38')][_0xb69a('0xbb')]}:undefined,'required':_0x2172d3[_0xb69a('0x38')]['tag']?!![]:![]}];}return db[_0xb69a('0x91')][_0xb69a('0x60')](_0x4b643b);})[_0xb69a('0x17')](function(_0x2d7e31){_0x2db483['rows']=_0x2d7e31;return _0x2db483;});}})[_0xb69a('0x17')](respondWithFilteredResult(_0x469de8,_0x4b643b))[_0xb69a('0x21')](handleError(_0x469de8,null));};exports[_0xb69a('0x30')]=function(_0x414f45,_0x200880,_0x4b4fb9){var _0x5ebd38,_0x122f96,_0x4eb8fe;if(_[_0xb69a('0x86')](_0x414f45[_0xb69a('0x4e')][_0xb69a('0x4e')])||_0x414f45[_0xb69a('0x4e')][_0xb69a('0x4e')]===''){throw new db['Sequelize'][(_0xb69a('0x87'))](_0xb69a('0xbc'));}if(_['isNil'](_0x414f45[_0xb69a('0x4e')]['to'])){throw new db[(_0xb69a('0x6a'))][(_0xb69a('0x87'))]('to\x20is\x20mandatory');}_0x5ebd38=_0x414f45[_0xb69a('0x4e')]['to'];return db[_0xb69a('0x33')][_0xb69a('0x4c')]({'where':{'id':_0x414f45[_0xb69a('0x48')]['id']},'include':[{'model':db['CmList'],'as':_0xb69a('0xbd'),'include':[{'model':db[_0xb69a('0x69')],'as':_0xb69a('0x8f'),'where':{'mobile':_0x5ebd38},'limit':0x1,'order':[[_0xb69a('0x6d'),_0xb69a('0x8c')]]}]}]})[_0xb69a('0x17')](handleEntityNotFound(_0x200880,null))['then'](function(_0x53adfd){if(_0x53adfd&&_0x53adfd[_0xb69a('0xbd')]){_0x122f96=_0x53adfd['get']({'plain':!![]});if(_0x122f96[_0xb69a('0xbd')]&&_0x122f96['List'][_0xb69a('0x8f')][_0xb69a('0x3e')]){return _0x122f96[_0xb69a('0xbd')][_0xb69a('0x8f')][0x0];}return db[_0xb69a('0x69')][_0xb69a('0x4d')](_[_0xb69a('0x12')](_0x414f45[_0xb69a('0x4e')],{'firstName':_0x5ebd38,'mobile':_0x5ebd38,'phone':_0x5ebd38,'ListId':_0x122f96[_0xb69a('0x6f')]}));}})[_0xb69a('0x17')](handleEntityNotFound(_0x200880,null))[_0xb69a('0x17')](function(_0x2a6f83){if(_0x2a6f83){_0x4eb8fe=_0x2a6f83;return db[_0xb69a('0x91')][_0xb69a('0x4c')]({'where':{'ContactId':_0x4eb8fe['id'],'closed':![],'SmsAccountId':_0x122f96['id']}})['then'](function(_0x1bc014){if(_0x1bc014){return[_0x1bc014,![]];}return db[_0xb69a('0x91')]['create']({'UserId':_0x414f45[_0xb69a('0x4f')]['id'],'ContactId':_0x4eb8fe['id'],'SmsAccountId':_0x122f96['id'],'phone':_0x5ebd38,'firstMsgDirection':'out','Messages':[_[_0xb69a('0x4b')](_0x414f45['body'],{'read':![],'body':_0x414f45['body'][_0xb69a('0x4e')],'phone':_0x5ebd38,'SmsAccountId':_0x122f96['id'],'UserId':_0x414f45[_0xb69a('0x4f')]['id'],'ContactId':_0x4eb8fe['id']})]},{'include':[{'model':db[_0xb69a('0x9a')],'as':_0xb69a('0xbe')}]})['then'](function(_0x479895){return[_0x479895,!![]];});});}})[_0xb69a('0x92')](function(_0x4651fe,_0x587255){if(_0x587255){return _0x4651fe;}return db[_0xb69a('0x9a')][_0xb69a('0x4d')](_[_0xb69a('0x4b')](_0x414f45[_0xb69a('0x4e')],{'read':![],'body':_0x414f45[_0xb69a('0x4e')][_0xb69a('0x4e')],'phone':_0x5ebd38,'SmsAccountId':_0x122f96['id'],'SmsInteractionId':_0x4651fe['id'],'UserId':_0x414f45['user']['id'],'ContactId':_0x4eb8fe['id']}))[_0xb69a('0x17')](function(_0x16c2cb){_0x4651fe[_0xb69a('0xbf')][_0xb69a('0xbe')]=[];_0x4651fe[_0xb69a('0xbf')][_0xb69a('0xbe')][_0xb69a('0x97')](_0x16c2cb[_0xb69a('0xbf')]);return _0x4651fe;});})['then'](respondWithResult(_0x200880,null))['catch'](handleError(_0x200880,null));};exports['status']=function(_0x58dc65,_0x2e3b8f,_0x51681b){if(_0x58dc65[_0xb69a('0x4e')]['id']){delete _0x58dc65[_0xb69a('0x4e')]['id'];}var _0x35604c,_0x323be1,_0x1d6abf;return db['SmsAccount']['find']({'where':{'id':_0x58dc65[_0xb69a('0x48')]['id']}})['then'](handleEntityNotFound(_0x2e3b8f,null))[_0xb69a('0x17')](function(_0x41ebf6){if(_0x41ebf6){_0x1d6abf=_0x41ebf6;logger[_0xb69a('0x1a')](_0xb69a('0x1b'),_0xb69a('0x23'),_0xb69a('0xc0'),_0x41ebf6[_0xb69a('0x35')],util['inspect'](_0x58dc65[_0xb69a('0x4e')],{'showHidden':![],'depth':null}));switch(_0x41ebf6['type']){case _0xb69a('0x75'):if(_0x58dc65[_0xb69a('0x4e')][_0xb69a('0xc1')]&&_0x58dc65[_0xb69a('0x4e')][_0xb69a('0x23')]){_0x323be1=_0x58dc65[_0xb69a('0x4e')][_0xb69a('0x23')];return db['SmsMessage'][_0xb69a('0x4c')]({'where':{'messageId':_0x58dc65[_0xb69a('0x4e')][_0xb69a('0xc1')]}});}break;case'connectel':if(_0x58dc65[_0xb69a('0x4e')][_0xb69a('0xc2')]&&_0x58dc65['body'][_0xb69a('0xc3')]){_0x323be1=_0x58dc65['body'][_0xb69a('0xc3')];return db[_0xb69a('0x9a')][_0xb69a('0x4c')]({'where':{'messageId':_0x58dc65[_0xb69a('0x4e')][_0xb69a('0xc2')]}});}break;case _0xb69a('0x79'):if(_0x58dc65[_0xb69a('0x4e')][_0xb69a('0x7a')]&&_0x58dc65[_0xb69a('0x4e')]['status_code']){_0x323be1=_0x58dc65[_0xb69a('0x4e')][_0xb69a('0xc4')];return db[_0xb69a('0x9a')][_0xb69a('0x4c')]({'where':{'messageId':_0x58dc65['body']['message_id']}});}break;case _0xb69a('0xc5'):var _0xf0587d=_0x58dc65['body']['results'][0x0];if(_0xf0587d[_0xb69a('0x73')]&&_0xf0587d[_0xb69a('0x23')]['groupName']==='DELIVERED'){_0x323be1=_0xf0587d[_0xb69a('0x23')][_0xb69a('0xc6')];return db[_0xb69a('0x9a')][_0xb69a('0x4c')]({'where':{'messageId':_0xf0587d[_0xb69a('0x73')]}});}break;case _0xb69a('0x81'):if(_0x58dc65[_0xb69a('0x4e')][_0xb69a('0x73')]&&_0x58dc65[_0xb69a('0x4e')][_0xb69a('0x23')]){_0x323be1=_0x58dc65[_0xb69a('0x4e')][_0xb69a('0x23')];return db[_0xb69a('0x9a')]['find']({'where':{'messageId':_0x58dc65[_0xb69a('0x4e')][_0xb69a('0x73')]}});}break;case _0xb69a('0xc7'):if(_0x58dc65['body'][0x0]['message']['id']){_0x323be1=_0x58dc65['body'][0x0]['type'];return db[_0xb69a('0x9a')][_0xb69a('0x4c')]({'where':{'messageId':_0x58dc65[_0xb69a('0x4e')][0x0][_0xb69a('0x20')]['id']}});}break;case'intelepeer':if(_0x58dc65[_0xb69a('0x4e')][_0xb69a('0xc8')]&&_0x58dc65[_0xb69a('0x4e')]['status']){_0x323be1=_0x58dc65[_0xb69a('0x4e')]['status'];return db[_0xb69a('0x9a')]['find']({'where':{'messageId':_0x58dc65['body'][_0xb69a('0xc8')]}});}break;}}})[_0xb69a('0x17')](handleEntityNotFound(_0x2e3b8f,null))[_0xb69a('0x17')](function(_0x109ca6){if(_0x109ca6){_0x35604c=_0x109ca6;switch(_0x1d6abf['type']){case _0xb69a('0x75'):if(_0x323be1==='DELIVERED'){return _0x35604c[_0xb69a('0x2c')]({'read':!![]});}else{logger[_0xb69a('0x1e')](_0xb69a('0x1b'),_0xb69a('0x23'),'skebby',util[_0xb69a('0xc9')](_0x58dc65[_0xb69a('0x4e')],{'showHidden':![],'depth':null}));}break;case _0xb69a('0xca'):if(_0x323be1==='1'){return _0x35604c[_0xb69a('0x2c')]({'read':!![]});}else{logger[_0xb69a('0x1e')](_0xb69a('0x1b'),_0xb69a('0x23'),'skebby',util['inspect'](_0x58dc65[_0xb69a('0x4e')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x58dc65[_0xb69a('0x4e')]['error_code']&&_0x323be1>=0xc8&&_0x323be1<=0xce){return _0x35604c[_0xb69a('0x2c')]({'read':!![]});}else{logger['error'](_0xb69a('0x1b'),_0xb69a('0x23'),_0xb69a('0x79'),util[_0xb69a('0xc9')](_0x58dc65['body'],{'showHidden':![],'depth':null}));}break;case _0xb69a('0xc5'):var _0x57c082=_0x58dc65[_0xb69a('0x4e')][_0xb69a('0x7d')][0x0];if(_0x57c082[_0xb69a('0x23')][_0xb69a('0xc6')]===_0xb69a('0xcb')){return _0x35604c['update']({'read':!![]});}else{logger[_0xb69a('0x1e')](_0xb69a('0x1b'),_0xb69a('0x23'),_0xb69a('0xc5'),util[_0xb69a('0xc9')](_0x58dc65['body'],{'showHidden':![],'depth':null}));}break;case _0xb69a('0x81'):if(_0x323be1=='DELIVERED_TO_GATEWAY'||_0x323be1==_0xb69a('0xcc')){return _0x35604c[_0xb69a('0x2c')]({'read':!![]});}else{logger[_0xb69a('0x1e')](_0xb69a('0x1b'),'status','clickatell',util[_0xb69a('0xc9')](_0x58dc65[_0xb69a('0x4e')],{'showHidden':![],'depth':null}));}break;case _0xb69a('0xc7'):if(_0x323be1==_0xb69a('0xcd')){return _0x35604c[_0xb69a('0x2c')]({'read':!![]});}else{logger[_0xb69a('0x1e')](_0xb69a('0x1b'),_0xb69a('0x23'),_0xb69a('0xc7'),util['inspect'](_0x58dc65['body'],{'showHidden':![],'depth':null}));}break;case _0xb69a('0x84'):if(_0x323be1===_0xb69a('0xce')||_0x323be1==='ACCEPTD'){return _0x35604c[_0xb69a('0x2c')]({'read':!![]});}else{logger[_0xb69a('0x1e')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb69a('0x23'),_0xb69a('0x84'),util[_0xb69a('0xc9')](_0x58dc65[_0xb69a('0x4e')],{'showHidden':![],'depth':null}));}break;}return _0x35604c;}})[_0xb69a('0x17')](respondWithResult(_0x2e3b8f,null))[_0xb69a('0x21')](handleError(_0x2e3b8f,null));};exports[_0xb69a('0xcf')]=function(_0x2fa4c7,_0x433414,_0x32c093){var _0xc5f47a,_0x8e0fa0,_0x1726e0;return db[_0xb69a('0x33')][_0xb69a('0x4c')]({'where':{'id':_0x2fa4c7[_0xb69a('0x48')]['id']}})[_0xb69a('0x17')](handleEntityNotFound(_0x433414,null))[_0xb69a('0x17')](function(_0x472824){if(_0x472824){_0x1726e0=_0x472824;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x472824[_0xb69a('0x35')],util['inspect'](_0x2fa4c7['query'],{'showHidden':![],'depth':null}));switch(_0x472824[_0xb69a('0x35')]){case'csc':if(_0x2fa4c7[_0xb69a('0x38')]['message-id']&&_0x2fa4c7[_0xb69a('0x38')][_0xb69a('0xd0')]){_0x8e0fa0=_0x2fa4c7[_0xb69a('0x38')][_0xb69a('0xd0')];return db[_0xb69a('0x9a')][_0xb69a('0x4c')]({'where':{'messageId':_0x2fa4c7[_0xb69a('0x38')][_0xb69a('0xd1')]}});}break;}}})[_0xb69a('0x17')](handleEntityNotFound(_0x433414,null))[_0xb69a('0x17')](function(_0x1276a2){if(_0x1276a2){_0xc5f47a=_0x1276a2;switch(_0x1726e0[_0xb69a('0x35')]){case'csc':if(_0x8e0fa0==='2'||_0x8e0fa0==='6'){return _0xc5f47a[_0xb69a('0x2c')]({'read':!![]});}else{logger['error'](_0xb69a('0x1b'),'status','csc',util[_0xb69a('0xc9')](_0x2fa4c7[_0xb69a('0x38')],{'showHidden':![],'depth':null}));};break;}return _0xc5f47a;}})[_0xb69a('0x17')](respondWithResult(_0x433414,null))[_0xb69a('0x21')](handleError(_0x433414,null));};exports[_0xb69a('0xd2')]=function(_0x5ef2e9,_0x541c62,_0x20c67b){return db[_0xb69a('0x33')]['find']({'where':{'id':_0x5ef2e9[_0xb69a('0x48')]['id']}})[_0xb69a('0x17')](handleEntityNotFound(_0x541c62,null))['then'](function(_0x22b028){if(_0x22b028){return _0x22b028['addAgents'](_0x5ef2e9['body'][_0xb69a('0x63')],_[_0xb69a('0x8e')](_0x5ef2e9[_0xb69a('0x4e')],[_0xb69a('0x63'),'id'])||{})[_0xb69a('0x92')](function(_0x11ab1f){for(var _0xf38004=0x0;_0xf38004<_0x5ef2e9[_0xb69a('0x4e')][_0xb69a('0x63')][_0xb69a('0x3e')];_0xf38004+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x5ef2e9[_0xb69a('0x4e')][_0xb69a('0x63')][_0xf38004]),'SmsAccountId':Number(_0x5ef2e9[_0xb69a('0x48')]['id'])});}return _0x11ab1f;});}})['then'](respondWithResult(_0x541c62,null))[_0xb69a('0x21')](handleError(_0x541c62,null));};exports[_0xb69a('0xd3')]=function(_0x1bef47,_0x5b353c,_0xc18daf){return db[_0xb69a('0x33')][_0xb69a('0x4c')]({'where':{'id':_0x1bef47['params']['id']}})[_0xb69a('0x17')](handleEntityNotFound(_0x5b353c,null))['then'](function(_0x164f0e){if(_0x164f0e){return _0x164f0e[_0xb69a('0xd3')](_0x1bef47['query'][_0xb69a('0x63')])[_0xb69a('0x17')](function(){if(_[_0xb69a('0xd4')](_0x1bef47[_0xb69a('0x38')]['ids'])){for(var _0x13706b=0x0;_0x13706b<_0x1bef47[_0xb69a('0x38')][_0xb69a('0x63')][_0xb69a('0x3e')];_0x13706b+=0x1){socket[_0xb69a('0xd5')](_0xb69a('0xd6'),{'UserId':Number(_0x1bef47[_0xb69a('0x38')][_0xb69a('0x63')][_0x13706b]),'SmsAccountId':Number(_0x1bef47[_0xb69a('0x48')]['id'])});}}else{socket[_0xb69a('0xd5')]('userSmsAccount:remove',{'UserId':Number(_0x1bef47['query']['ids']),'SmsAccountId':Number(_0x1bef47[_0xb69a('0x48')]['id'])});}});}})[_0xb69a('0x17')](respondWithStatusCode(_0x5b353c,null))[_0xb69a('0x21')](handleError(_0x5b353c,null));};exports[_0xb69a('0xd7')]=function(_0x52b65f,_0xc78082,_0x5e3eb3){var _0x508efd={};var _0x4434a7={};var _0x4c480b;var _0x42114a;return db['SmsAccount'][_0xb69a('0x5d')]({'where':{'id':_0x52b65f['params']['id']}})[_0xb69a('0x17')](handleEntityNotFound(_0xc78082,null))[_0xb69a('0x17')](function(_0x548355){if(_0x548355){_0x4c480b=_0x548355;_0x4434a7[_0xb69a('0x37')]=_[_0xb69a('0x39')](db[_0xb69a('0x9e')][_0xb69a('0x34')]);_0x4434a7[_0xb69a('0x38')]=_['keys'](_0x52b65f[_0xb69a('0x38')]);_0x4434a7[_0xb69a('0x3a')]=_[_0xb69a('0x3b')](_0x4434a7['model'],_0x4434a7[_0xb69a('0x38')]);_0x508efd['attributes']=_[_0xb69a('0x3b')](_0x4434a7['model'],qs[_0xb69a('0x3c')](_0x52b65f['query'][_0xb69a('0x3c')]));_0x508efd['attributes']=_0x508efd[_0xb69a('0x3d')]['length']?_0x508efd[_0xb69a('0x3d')]:_0x4434a7[_0xb69a('0x37')];_0x508efd['order']=qs['sort'](_0x52b65f[_0xb69a('0x38')][_0xb69a('0x40')]);_0x508efd[_0xb69a('0x41')]=qs[_0xb69a('0x3a')](_[_0xb69a('0x42')](_0x52b65f[_0xb69a('0x38')],_0x4434a7['filters']));if(_0x52b65f[_0xb69a('0x38')][_0xb69a('0x44')]){_0x508efd['where']=_[_0xb69a('0x4b')](_0x508efd[_0xb69a('0x41')],{'$or':_['map'](_0x508efd['attributes'],function(_0x3cf94f){var _0x32ee4d={};_0x32ee4d[_0x3cf94f]={'$like':'%'+_0x52b65f[_0xb69a('0x38')]['filter']+'%'};return _0x32ee4d;})});}_0x508efd=_[_0xb69a('0x4b')]({},_0x508efd,_0x52b65f[_0xb69a('0x45')]);return _0x4c480b[_0xb69a('0xd7')](_0x508efd);}})[_0xb69a('0x17')](function(_0x3cbcfa){if(_0x3cbcfa){_0x42114a=_0x3cbcfa[_0xb69a('0x3e')];if(!_0x52b65f['query'][_0xb69a('0x5e')]('nolimit')){_0x508efd[_0xb69a('0x27')]=qs[_0xb69a('0x27')](_0x52b65f[_0xb69a('0x38')]['limit']);_0x508efd[_0xb69a('0x25')]=qs[_0xb69a('0x25')](_0x52b65f[_0xb69a('0x38')][_0xb69a('0x25')]);}return _0x4c480b[_0xb69a('0xd7')](_0x508efd);}})['then'](function(_0x582773){if(_0x582773){return _0x582773?{'count':_0x42114a,'rows':_0x582773}:null;}})['then'](respondWithResult(_0xc78082,null))[_0xb69a('0x21')](handleError(_0xc78082,null));}; \ No newline at end of file +var _0x4615=['ListId','mobile','twilio','From','messageId','MessageSid','skebby','from','connectel','clicksend','plivo','Text','MessageUUID','infobip','results','text','segmentedMessage','clickatell','fromNumber','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','CmList','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','priority','finally','send','getApplications','Owner','fullname','internal','Tags','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','SmsAccount,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','message_id','groupName','DELIVERED','redif','error_code','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','state','message-id','csc','addAgents','omit','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','then','info','debug','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','sendStatus','status','offset','undefined','limit','set','Content-Range','json','reject','save','update','destroy','get','SmsAccounts','end','stack','name','index','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','SmsAccount','findAll','rows','show','params','Pause','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','mandatoryDispositionPause','catch','describe','addDisposition','getDispositions','Disposition','map','options','removeDispositions','ids','addAnswer','SmsAccountId','getAnswers','findOne','CannedAnswer','removeAnswers','sms','SmsApplication','Applications','account','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x4615,0x14e));var _0x5461=function(_0x1eb2dd,_0x453406){_0x1eb2dd=_0x1eb2dd-0x0;var _0x2f3d99=_0x4615[_0x1eb2dd];return _0x2f3d99;};'use strict';var emlformat=require(_0x5461('0x0'));var rimraf=require(_0x5461('0x1'));var zipdir=require(_0x5461('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5461('0x3'));var moment=require(_0x5461('0x4'));var BPromise=require(_0x5461('0x5'));var Mustache=require(_0x5461('0x6'));var util=require(_0x5461('0x7'));var path=require('path');var sox=require(_0x5461('0x8'));var csv=require(_0x5461('0x9'));var ejs=require(_0x5461('0xa'));var fs=require('fs');var fs_extra=require(_0x5461('0xb'));var _=require(_0x5461('0xc'));var squel=require(_0x5461('0xd'));var crypto=require('crypto');var jsforce=require(_0x5461('0xe'));var deskjs=require(_0x5461('0xf'));var toCsv=require(_0x5461('0x9'));var querystring=require(_0x5461('0x10'));var Papa=require(_0x5461('0x11'));var Redis=require(_0x5461('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5461('0x13'));var as=require(_0x5461('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5461('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5461('0x16'));var db=require('../../mysqldb')['db'];config[_0x5461('0x17')]=_[_0x5461('0x18')](config[_0x5461('0x17')],{'host':_0x5461('0x19'),'port':0x18eb});var socket=require(_0x5461('0x1a'))(new Redis(config[_0x5461('0x17')]));require(_0x5461('0x1b'))[_0x5461('0x1c')](socket);var jayson=require(_0x5461('0x1d'));var client=jayson[_0x5461('0x1e')][_0x5461('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x4f4a5e,_0x4a93a7,_0x551e85,_0x44b270){return new BPromise(function(_0x276189,_0x2e08fc){var _0xb48dd2=_0x44b270||client;return _0xb48dd2['request'](_0x4f4a5e,_0x551e85)[_0x5461('0x20')](function(_0x56c28e){logger[_0x5461('0x21')]('SmsAccount,\x20%s,\x20%s',_0x4a93a7,'request\x20sent');logger[_0x5461('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4a93a7,_0x5461('0x23'),JSON[_0x5461('0x24')](_0x56c28e));if(_0x56c28e[_0x5461('0x25')]){if(_0x56c28e[_0x5461('0x25')][_0x5461('0x26')]===0x1f4){logger[_0x5461('0x25')](_0x5461('0x27'),_0x4a93a7,_0x56c28e[_0x5461('0x25')]['message']);return _0x2e08fc(_0x56c28e['error']['message']);}logger['error'](_0x5461('0x27'),_0x4a93a7,_0x56c28e[_0x5461('0x25')][_0x5461('0x28')]);return _0x276189(_0x56c28e[_0x5461('0x25')][_0x5461('0x28')]);}else{logger[_0x5461('0x21')](_0x5461('0x27'),_0x4a93a7,_0x5461('0x23'));_0x276189(_0x56c28e[_0x5461('0x29')][_0x5461('0x28')]);}})['catch'](function(_0x4f7b2c){logger['error'](_0x5461('0x27'),_0x4a93a7,_0x4f7b2c);_0x2e08fc(_0x4f7b2c);});});}function respondWithStatusCode(_0x21c696,_0x3e662){_0x3e662=_0x3e662||0xcc;return function(_0x1a8812){if(_0x1a8812){return _0x21c696[_0x5461('0x2a')](_0x3e662);}return _0x21c696[_0x5461('0x2b')](_0x3e662)['end']();};}function respondWithResult(_0x16f5eb,_0x4db8ba){_0x4db8ba=_0x4db8ba||0xc8;return function(_0x39e5d4){if(_0x39e5d4){return _0x16f5eb[_0x5461('0x2b')](_0x4db8ba)['json'](_0x39e5d4);}};}function respondWithFilteredResult(_0x30a3e3,_0x580700){return function(_0x592a3d){if(_0x592a3d){var _0x2dd679=typeof _0x580700[_0x5461('0x2c')]===_0x5461('0x2d')&&typeof _0x580700[_0x5461('0x2e')]==='undefined';var _0xf18928=_0x592a3d['count'];var _0x5991ec=_0x2dd679?0x0:_0x580700['offset'];var _0x2cc254=_0x2dd679?_0x592a3d['count']:_0x580700[_0x5461('0x2c')]+_0x580700[_0x5461('0x2e')];var _0x231f47;if(_0x2cc254>=_0xf18928){_0x2cc254=_0xf18928;_0x231f47=0xc8;}else{_0x231f47=0xce;}_0x30a3e3['status'](_0x231f47);return _0x30a3e3[_0x5461('0x2f')](_0x5461('0x30'),_0x5991ec+'-'+_0x2cc254+'/'+_0xf18928)[_0x5461('0x31')](_0x592a3d);}return null;};}function patchUpdates(_0x23bc37){return function(_0x300b59){try{jsonpatch['apply'](_0x300b59,_0x23bc37,!![]);}catch(_0x3d6503){return BPromise[_0x5461('0x32')](_0x3d6503);}return _0x300b59[_0x5461('0x33')]();};}function saveUpdates(_0x1175a9,_0x1552c6){return function(_0x5cb782){if(_0x5cb782){return _0x5cb782[_0x5461('0x34')](_0x1175a9)['then'](function(_0x10fc17){return _0x10fc17;});}return null;};}function removeEntity(_0x5b14bf,_0x1cfe23){return function(_0xfea81e){if(_0xfea81e){return _0xfea81e[_0x5461('0x35')]()[_0x5461('0x20')](function(){var _0x3fd583=_0xfea81e[_0x5461('0x36')]({'plain':!![]});var _0x567660=_0x5461('0x37');return db['UserProfileResource'][_0x5461('0x35')]({'where':{'type':_0x567660,'resourceId':_0x3fd583['id']}})[_0x5461('0x20')](function(){return _0xfea81e;});})[_0x5461('0x20')](function(){_0x5b14bf[_0x5461('0x2b')](0xcc)[_0x5461('0x38')]();});}};}function handleEntityNotFound(_0x573a18,_0x53244c){return function(_0x4b201f){if(!_0x4b201f){_0x573a18[_0x5461('0x2a')](0x194);}return _0x4b201f;};}function handleError(_0x13191d,_0x3f337c){_0x3f337c=_0x3f337c||0x1f4;return function(_0x9b4b0a){logger[_0x5461('0x25')](_0x9b4b0a[_0x5461('0x39')]);if(_0x9b4b0a[_0x5461('0x3a')]){delete _0x9b4b0a[_0x5461('0x3a')];}_0x13191d['status'](_0x3f337c)['send'](_0x9b4b0a);};}exports[_0x5461('0x3b')]=function(_0x23b1a4,_0x32a740){var _0x1b1ecc={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x3d6d6b={},_0x1ac133={'count':0x0,'rows':[]};var _0x46d43e=_['map'](db['SmsAccount'][_0x5461('0x3c')],function(_0x2cbf3a){return{'name':_0x2cbf3a['fieldName'],'type':_0x2cbf3a[_0x5461('0x3d')][_0x5461('0x3e')]};});_0x3d6d6b[_0x5461('0x3f')]=_['map'](_0x46d43e,_0x5461('0x3a'));_0x3d6d6b[_0x5461('0x40')]=_[_0x5461('0x41')](_0x23b1a4[_0x5461('0x40')]);_0x3d6d6b[_0x5461('0x42')]=_[_0x5461('0x43')](_0x3d6d6b[_0x5461('0x3f')],_0x3d6d6b[_0x5461('0x40')]);_0x1b1ecc['attributes']=_[_0x5461('0x43')](_0x3d6d6b[_0x5461('0x3f')],qs[_0x5461('0x44')](_0x23b1a4['query'][_0x5461('0x44')]));_0x1b1ecc[_0x5461('0x45')]=_0x1b1ecc[_0x5461('0x45')][_0x5461('0x46')]?_0x1b1ecc[_0x5461('0x45')]:_0x3d6d6b[_0x5461('0x3f')];if(!_0x23b1a4[_0x5461('0x40')][_0x5461('0x47')](_0x5461('0x48'))){_0x1b1ecc[_0x5461('0x2e')]=qs[_0x5461('0x2e')](_0x23b1a4[_0x5461('0x40')][_0x5461('0x2e')]);_0x1b1ecc[_0x5461('0x2c')]=qs[_0x5461('0x2c')](_0x23b1a4[_0x5461('0x40')]['offset']);}_0x1b1ecc[_0x5461('0x49')]=qs[_0x5461('0x4a')](_0x23b1a4[_0x5461('0x40')][_0x5461('0x4a')]);_0x1b1ecc[_0x5461('0x4b')]=qs[_0x5461('0x42')](_[_0x5461('0x4c')](_0x23b1a4[_0x5461('0x40')],_0x3d6d6b[_0x5461('0x42')]),_0x46d43e);if(_0x23b1a4[_0x5461('0x40')][_0x5461('0x4d')]){_0x1b1ecc[_0x5461('0x4b')]=_[_0x5461('0x4e')](_0x1b1ecc['where'],{'$or':_['map'](_0x46d43e,function(_0x390a18){if(_0x390a18[_0x5461('0x3d')]!==_0x5461('0x4f')){var _0x31fb31={};_0x31fb31[_0x390a18[_0x5461('0x3a')]]={'$like':'%'+_0x23b1a4[_0x5461('0x40')][_0x5461('0x4d')]+'%'};return _0x31fb31;}})});}_0x1b1ecc=_[_0x5461('0x4e')]({},_0x1b1ecc,_0x23b1a4['options']);var _0x2a8c25={'where':_0x1b1ecc['where']};return db['SmsAccount'][_0x5461('0x50')](_0x2a8c25)[_0x5461('0x20')](function(_0x45bb9f){_0x1ac133[_0x5461('0x50')]=_0x45bb9f;if(_0x23b1a4[_0x5461('0x40')][_0x5461('0x51')]){_0x1b1ecc[_0x5461('0x52')]=[{'all':!![]}];}return db[_0x5461('0x53')][_0x5461('0x54')](_0x1b1ecc);})[_0x5461('0x20')](function(_0x5d72f3){_0x1ac133[_0x5461('0x55')]=_0x5d72f3;return _0x1ac133;})[_0x5461('0x20')](respondWithFilteredResult(_0x32a740,_0x1b1ecc))['catch'](handleError(_0x32a740,null));};exports[_0x5461('0x56')]=function(_0x347e87,_0xe901d3){var _0x668337={'raw':![],'where':{'id':_0x347e87[_0x5461('0x57')]['id']},'include':[{'model':db[_0x5461('0x58')],'as':'mandatoryDispositionPause'}]},_0xe8e286={};_0xe8e286[_0x5461('0x3f')]=_[_0x5461('0x41')](db['SmsAccount'][_0x5461('0x3c')]);_0xe8e286['query']=_[_0x5461('0x41')](_0x347e87[_0x5461('0x40')]);_0xe8e286[_0x5461('0x42')]=_[_0x5461('0x43')](_0xe8e286[_0x5461('0x3f')],_0xe8e286[_0x5461('0x40')]);_0x668337[_0x5461('0x45')]=_[_0x5461('0x43')](_0xe8e286[_0x5461('0x3f')],qs['fields'](_0x347e87[_0x5461('0x40')][_0x5461('0x44')]));_0x668337[_0x5461('0x45')]=_0x668337[_0x5461('0x45')][_0x5461('0x46')]?_0x668337[_0x5461('0x45')]:_0xe8e286['model'];if(_0x347e87[_0x5461('0x40')][_0x5461('0x51')]){_0x668337['include']=[{'all':!![]}];}_0x668337=_[_0x5461('0x4e')]({},_0x668337,_0x347e87['options']);return db[_0x5461('0x53')][_0x5461('0x59')](_0x668337)['then'](handleEntityNotFound(_0xe901d3,null))[_0x5461('0x20')](respondWithResult(_0xe901d3,null))['catch'](handleError(_0xe901d3,null));};exports[_0x5461('0x5a')]=function(_0x1a24de,_0x259b69){return db['SmsAccount']['create'](_0x1a24de['body'],{})['then'](function(_0x28e419){var _0x1ca5c4=_0x1a24de['user'][_0x5461('0x36')]({'plain':!![]});if(!_0x1ca5c4)throw new Error(_0x5461('0x5b'));if(_0x1ca5c4[_0x5461('0x5c')]===_0x5461('0x5d')){var _0x46947f=_0x28e419['get']({'plain':!![]});var _0x40252e=_0x5461('0x37');return db[_0x5461('0x5e')]['find']({'where':{'name':_0x40252e,'userProfileId':_0x1ca5c4[_0x5461('0x5f')]},'raw':!![]})['then'](function(_0xab591e){if(_0xab591e&&_0xab591e[_0x5461('0x60')]===0x0){return db['UserProfileResource'][_0x5461('0x5a')]({'name':_0x46947f['name'],'resourceId':_0x46947f['id'],'type':_0xab591e[_0x5461('0x3a')],'sectionId':_0xab591e['id']},{})['then'](function(){return _0x28e419;});}else{return _0x28e419;}})['catch'](function(_0x90d079){logger['error'](_0x5461('0x61'),_0x90d079);throw _0x90d079;});}return _0x28e419;})['then'](respondWithResult(_0x259b69,0xc9))['catch'](handleError(_0x259b69,null));};exports['update']=function(_0x50f26c,_0x571f59){if(_0x50f26c['body']['id']){delete _0x50f26c[_0x5461('0x62')]['id'];}return db[_0x5461('0x53')][_0x5461('0x59')]({'where':{'id':_0x50f26c['params']['id']},'include':[{'model':db[_0x5461('0x58')],'as':_0x5461('0x63')}]})[_0x5461('0x20')](handleEntityNotFound(_0x571f59,null))[_0x5461('0x20')](saveUpdates(_0x50f26c[_0x5461('0x62')],null))[_0x5461('0x20')](respondWithResult(_0x571f59,null))[_0x5461('0x64')](handleError(_0x571f59,null));};exports['destroy']=function(_0x3be5b8,_0x5e2810){return db[_0x5461('0x53')][_0x5461('0x59')]({'where':{'id':_0x3be5b8[_0x5461('0x57')]['id']}})[_0x5461('0x20')](handleEntityNotFound(_0x5e2810,null))['then'](removeEntity(_0x5e2810,null))['catch'](handleError(_0x5e2810,null));};exports[_0x5461('0x65')]=function(_0x22ccd4,_0x1a0d57){return db[_0x5461('0x53')][_0x5461('0x65')]()[_0x5461('0x20')](respondWithResult(_0x1a0d57,null))[_0x5461('0x64')](handleError(_0x1a0d57,null));};exports[_0x5461('0x66')]=function(_0x594120,_0x38d211,_0xfe4227){if(_0x594120[_0x5461('0x62')]['id']){delete _0x594120['body']['id'];}return db[_0x5461('0x53')][_0x5461('0x59')]({'where':{'id':_0x594120[_0x5461('0x57')]['id']}})['then'](handleEntityNotFound(_0x38d211,null))[_0x5461('0x20')](function(_0xaf5dd0){if(_0xaf5dd0){_0x594120['body']['SmsAccountId']=_0xaf5dd0['id'];return db['Disposition'][_0x5461('0x5a')](_0x594120[_0x5461('0x62')]);}})[_0x5461('0x20')](respondWithResult(_0x38d211,null))[_0x5461('0x64')](handleError(_0x38d211,null));};exports[_0x5461('0x67')]=function(_0x3f47a1,_0x5000c8,_0x20df1c){var _0xbb6d36={'raw':![],'where':{}};var _0x170afa={};var _0x293fb7={'count':0x0,'rows':[]};return db[_0x5461('0x53')]['findOne']({'where':{'id':_0x3f47a1[_0x5461('0x57')]['id']}})[_0x5461('0x20')](handleEntityNotFound(_0x5000c8,null))[_0x5461('0x20')](function(_0x55efa0){if(_0x55efa0){_0x170afa[_0x5461('0x3f')]=_[_0x5461('0x41')](db[_0x5461('0x68')][_0x5461('0x3c')]);_0x170afa[_0x5461('0x40')]=_[_0x5461('0x41')](_0x3f47a1[_0x5461('0x40')]);_0x170afa[_0x5461('0x42')]=_[_0x5461('0x43')](_0x170afa[_0x5461('0x3f')],_0x170afa[_0x5461('0x40')]);_0xbb6d36[_0x5461('0x45')]=_[_0x5461('0x43')](_0x170afa['model'],qs[_0x5461('0x44')](_0x3f47a1[_0x5461('0x40')][_0x5461('0x44')]));_0xbb6d36[_0x5461('0x45')]=_0xbb6d36[_0x5461('0x45')][_0x5461('0x46')]?_0xbb6d36[_0x5461('0x45')]:_0x170afa[_0x5461('0x3f')];if(!_0x3f47a1[_0x5461('0x40')]['hasOwnProperty'](_0x5461('0x48'))){_0xbb6d36[_0x5461('0x2e')]=qs[_0x5461('0x2e')](_0x3f47a1[_0x5461('0x40')][_0x5461('0x2e')]);_0xbb6d36[_0x5461('0x2c')]=qs[_0x5461('0x2c')](_0x3f47a1['query'][_0x5461('0x2c')]);}_0xbb6d36[_0x5461('0x49')]=qs['sort'](_0x3f47a1[_0x5461('0x40')][_0x5461('0x4a')]);_0xbb6d36[_0x5461('0x4b')]=qs[_0x5461('0x42')](_[_0x5461('0x4c')](_0x3f47a1[_0x5461('0x40')],_0x170afa['filters']));_0xbb6d36['where']['SmsAccountId']=_0x55efa0['id'];if(_0x3f47a1['query'][_0x5461('0x4d')]){_0xbb6d36['where']=_[_0x5461('0x4e')](_0xbb6d36[_0x5461('0x4b')],{'$or':_[_0x5461('0x69')](_0xbb6d36[_0x5461('0x45')],function(_0x412d5f){var _0x3c2a65={};_0x3c2a65[_0x412d5f]={'$like':'%'+_0x3f47a1[_0x5461('0x40')][_0x5461('0x4d')]+'%'};return _0x3c2a65;})});}_0xbb6d36=_[_0x5461('0x4e')]({},_0xbb6d36,_0x3f47a1[_0x5461('0x6a')]);return db['Disposition']['count']({'where':_0xbb6d36['where']})[_0x5461('0x20')](function(_0x3edc4f){_0x293fb7['count']=_0x3edc4f;if(_0x3f47a1[_0x5461('0x40')][_0x5461('0x51')]){_0xbb6d36['include']=[{'all':!![]}];}return db[_0x5461('0x68')]['findAll'](_0xbb6d36);})['then'](function(_0x44bcd4){_0x293fb7[_0x5461('0x55')]=_0x44bcd4;return _0x293fb7;});}})['then'](respondWithFilteredResult(_0x5000c8,_0xbb6d36))[_0x5461('0x64')](handleError(_0x5000c8,null));};exports[_0x5461('0x6b')]=function(_0x4eeb8e,_0x326c2c,_0x1cdd26){return db[_0x5461('0x53')][_0x5461('0x59')]({'where':{'id':_0x4eeb8e[_0x5461('0x57')]['id']}})[_0x5461('0x20')](handleEntityNotFound(_0x326c2c,null))['then'](function(_0x4995e3){if(_0x4995e3){return _0x4995e3[_0x5461('0x6b')](_0x4eeb8e['query'][_0x5461('0x6c')]);}})[_0x5461('0x20')](respondWithStatusCode(_0x326c2c,null))[_0x5461('0x64')](handleError(_0x326c2c,null));};exports[_0x5461('0x6d')]=function(_0x287631,_0x3396a6,_0x4cdc05){if(_0x287631[_0x5461('0x62')]['id']){delete _0x287631['body']['id'];}return db[_0x5461('0x53')][_0x5461('0x59')]({'where':{'id':_0x287631[_0x5461('0x57')]['id']}})['then'](handleEntityNotFound(_0x3396a6,null))['then'](function(_0x50cd2b){if(_0x50cd2b){_0x287631[_0x5461('0x62')][_0x5461('0x6e')]=_0x50cd2b['id'];return db['CannedAnswer']['create'](_0x287631[_0x5461('0x62')]);}})[_0x5461('0x20')](respondWithResult(_0x3396a6,null))[_0x5461('0x64')](handleError(_0x3396a6,null));};exports[_0x5461('0x6f')]=function(_0x1b8dee,_0x455dfd,_0x1d24a1){var _0x1ff677={'raw':![],'where':{}};var _0x33ada7={};var _0x2d2e5d={'count':0x0,'rows':[]};return db[_0x5461('0x53')][_0x5461('0x70')]({'where':{'id':_0x1b8dee[_0x5461('0x57')]['id']}})[_0x5461('0x20')](handleEntityNotFound(_0x455dfd,null))[_0x5461('0x20')](function(_0x2e1b2d){if(_0x2e1b2d){_0x33ada7['model']=_[_0x5461('0x41')](db[_0x5461('0x71')][_0x5461('0x3c')]);_0x33ada7[_0x5461('0x40')]=_[_0x5461('0x41')](_0x1b8dee['query']);_0x33ada7['filters']=_[_0x5461('0x43')](_0x33ada7[_0x5461('0x3f')],_0x33ada7['query']);_0x1ff677[_0x5461('0x45')]=_[_0x5461('0x43')](_0x33ada7[_0x5461('0x3f')],qs[_0x5461('0x44')](_0x1b8dee[_0x5461('0x40')][_0x5461('0x44')]));_0x1ff677[_0x5461('0x45')]=_0x1ff677[_0x5461('0x45')]['length']?_0x1ff677[_0x5461('0x45')]:_0x33ada7[_0x5461('0x3f')];if(!_0x1b8dee['query']['hasOwnProperty'](_0x5461('0x48'))){_0x1ff677[_0x5461('0x2e')]=qs[_0x5461('0x2e')](_0x1b8dee[_0x5461('0x40')][_0x5461('0x2e')]);_0x1ff677[_0x5461('0x2c')]=qs[_0x5461('0x2c')](_0x1b8dee[_0x5461('0x40')][_0x5461('0x2c')]);}_0x1ff677[_0x5461('0x49')]=qs[_0x5461('0x4a')](_0x1b8dee[_0x5461('0x40')]['sort']);_0x1ff677[_0x5461('0x4b')]=qs[_0x5461('0x42')](_[_0x5461('0x4c')](_0x1b8dee[_0x5461('0x40')],_0x33ada7[_0x5461('0x42')]));_0x1ff677[_0x5461('0x4b')][_0x5461('0x6e')]=_0x2e1b2d['id'];if(_0x1b8dee[_0x5461('0x40')][_0x5461('0x4d')]){_0x1ff677[_0x5461('0x4b')]=_['merge'](_0x1ff677[_0x5461('0x4b')],{'$or':_[_0x5461('0x69')](_0x1ff677[_0x5461('0x45')],function(_0x30fd72){var _0xc81813={};_0xc81813[_0x30fd72]={'$like':'%'+_0x1b8dee[_0x5461('0x40')][_0x5461('0x4d')]+'%'};return _0xc81813;})});}_0x1ff677=_[_0x5461('0x4e')]({},_0x1ff677,_0x1b8dee[_0x5461('0x6a')]);return db[_0x5461('0x71')]['count']({'where':_0x1ff677[_0x5461('0x4b')]})[_0x5461('0x20')](function(_0x2cd04a){_0x2d2e5d[_0x5461('0x50')]=_0x2cd04a;if(_0x1b8dee['query'][_0x5461('0x51')]){_0x1ff677[_0x5461('0x52')]=[{'all':!![]}];}return db[_0x5461('0x71')][_0x5461('0x54')](_0x1ff677);})[_0x5461('0x20')](function(_0x109ea8){_0x2d2e5d['rows']=_0x109ea8;return _0x2d2e5d;});}})[_0x5461('0x20')](respondWithFilteredResult(_0x455dfd,_0x1ff677))[_0x5461('0x64')](handleError(_0x455dfd,null));};exports[_0x5461('0x72')]=function(_0xafd71e,_0x41fa59,_0x286d76){return db[_0x5461('0x53')][_0x5461('0x59')]({'where':{'id':_0xafd71e[_0x5461('0x57')]['id']}})[_0x5461('0x20')](handleEntityNotFound(_0x41fa59,null))['then'](function(_0x265725){if(_0x265725){return _0x265725[_0x5461('0x72')](_0xafd71e[_0x5461('0x40')][_0x5461('0x6c')]);}})[_0x5461('0x20')](respondWithStatusCode(_0x41fa59,null))['catch'](handleError(_0x41fa59,null));};exports['notify']=function(_0x853a19,_0x5d99fa,_0x5b32f0){var _0x54df78={'channel':_0x5461('0x73')};var _0x481ba1=[];var _0xabaf4d=[];var _0x21057d={};return db[_0x5461('0x53')][_0x5461('0x59')]({'where':{'id':_0x853a19[_0x5461('0x57')]['id']},'include':[{'model':db[_0x5461('0x74')],'as':_0x5461('0x75')}]})['then'](handleEntityNotFound(_0x5d99fa,null))[_0x5461('0x20')](function(_0x111e0c){_0x54df78[_0x5461('0x76')]=_0x111e0c;_0x54df78[_0x5461('0x77')]=_[_0x5461('0x78')](_0x111e0c[_0x5461('0x75')],['priority'],[_0x5461('0x79')]);if(_0x54df78[_0x5461('0x76')][_0x5461('0x75')]){delete _0x54df78[_0x5461('0x76')]['Applications'];}return db[_0x5461('0x7a')][_0x5461('0x65')]();})[_0x5461('0x20')](function(_0x2c96fa){if(!_0x2c96fa){throw new db[(_0x5461('0x7b'))][(_0x5461('0x7c'))](_0x5461('0x7d'));}_0x481ba1=_[_0x5461('0x7e')](_[_0x5461('0x41')](_0x2c96fa),[_0x5461('0x7f'),_0x5461('0x80')]);_0xabaf4d=_['difference'](_['keys'](_0x2c96fa),[_0x5461('0x7f'),_0x5461('0x80'),_0x5461('0x81'),_0x5461('0x82')]);_0x54df78[_0x5461('0x62')]={'mapKey':_0x5461('0x83')};if(_0x54df78[_0x5461('0x76')][_0x5461('0x3d')]){switch(_0x54df78[_0x5461('0x76')]['type']){case _0x5461('0x84'):_0x54df78[_0x5461('0x62')]['from']=_0x853a19[_0x5461('0x62')][_0x5461('0x85')];_0x54df78['body'][_0x5461('0x62')]=_0x853a19[_0x5461('0x62')]['Body'];_0x54df78[_0x5461('0x62')][_0x5461('0x86')]=_0x853a19['body'][_0x5461('0x87')];break;case _0x5461('0x88'):_0x54df78[_0x5461('0x62')][_0x5461('0x89')]='+'+_0x853a19['body']['sender'];_0x54df78[_0x5461('0x62')]['body']=_0x853a19[_0x5461('0x62')]['text'];break;case _0x5461('0x8a'):_0x54df78[_0x5461('0x62')][_0x5461('0x89')]=_0x853a19[_0x5461('0x62')][_0x5461('0x89')];_0x54df78['body']['body']=_0x853a19[_0x5461('0x62')]['message'];break;case _0x5461('0x8b'):_0x54df78[_0x5461('0x62')]['from']=_0x853a19['body'][_0x5461('0x89')];_0x54df78[_0x5461('0x62')][_0x5461('0x62')]=_0x853a19[_0x5461('0x62')][_0x5461('0x62')];_0x54df78[_0x5461('0x62')][_0x5461('0x86')]=_0x853a19[_0x5461('0x62')]['message_id'];break;case _0x5461('0x8c'):_0x54df78['body'][_0x5461('0x89')]=_0x853a19[_0x5461('0x62')][_0x5461('0x85')];_0x54df78[_0x5461('0x62')][_0x5461('0x62')]=_0x853a19[_0x5461('0x62')][_0x5461('0x8d')];_0x54df78[_0x5461('0x62')][_0x5461('0x86')]=_0x853a19['body'][_0x5461('0x8e')];break;case _0x5461('0x8f'):_0x54df78[_0x5461('0x62')][_0x5461('0x89')]='+'+_0x853a19[_0x5461('0x62')][_0x5461('0x90')][0x0][_0x5461('0x89')];_0x54df78[_0x5461('0x62')]['body']=_0x853a19[_0x5461('0x62')][_0x5461('0x90')][0x0][_0x5461('0x91')];_0x54df78[_0x5461('0x62')]['messageId']=_0x853a19[_0x5461('0x62')][_0x5461('0x90')][0x0][_0x5461('0x86')];break;case'csc':_0x54df78['body'][_0x5461('0x89')]=_0x853a19[_0x5461('0x62')]['originatingAddress'];_0x54df78[_0x5461('0x62')][_0x5461('0x62')]=_0x853a19[_0x5461('0x62')][_0x5461('0x92')]['message'];break;case _0x5461('0x93'):_0x54df78['body']['from']=_0x853a19['body'][_0x5461('0x94')];_0x54df78['body'][_0x5461('0x62')]=_0x853a19[_0x5461('0x62')][_0x5461('0x91')];_0x54df78[_0x5461('0x62')]['messageId']=_0x853a19[_0x5461('0x62')]['replyMessageId'];break;case _0x5461('0x95'):_0x54df78['body']['messageId']=_0x853a19[_0x5461('0x62')][0x0][_0x5461('0x28')]['id'];_0x54df78[_0x5461('0x62')][_0x5461('0x89')]=_0x853a19[_0x5461('0x62')][0x0][_0x5461('0x28')]['from'];_0x54df78['body'][_0x5461('0x62')]=_0x853a19[_0x5461('0x62')][0x0][_0x5461('0x28')][_0x5461('0x91')];break;case _0x5461('0x96'):_0x54df78[_0x5461('0x62')]['from']=_0x853a19[_0x5461('0x62')][_0x5461('0x89')];_0x54df78[_0x5461('0x62')]['body']=_0x853a19[_0x5461('0x62')]['message'];_0x54df78[_0x5461('0x62')][_0x5461('0x86')]=_0x853a19['body']['refid'];break;}}if(_0x54df78[_0x5461('0x62')]['id']){delete _0x54df78[_0x5461('0x62')]['id'];}if(_['isNil'](_0x54df78[_0x5461('0x62')][_0x5461('0x89')])){throw new db[(_0x5461('0x7b'))]['ValidationError'](_0x5461('0x97'));}if(_['isNil'](_0x54df78[_0x5461('0x62')][_0x5461('0x62')])||_0x54df78[_0x5461('0x62')][_0x5461('0x62')]===''){throw new db[(_0x5461('0x7b'))]['ValidationError'](_0x5461('0x98'));}if(_[_0x5461('0x99')](_0x54df78['body'][_0x5461('0x9a')])){throw new db[(_0x5461('0x7b'))][(_0x5461('0x7c'))](_0x5461('0x9b')+_0xabaf4d);}if(!_[_0x5461('0x9c')](_0xabaf4d,_0x54df78[_0x5461('0x62')][_0x5461('0x9a')])){throw new db['Sequelize'][(_0x5461('0x7c'))](_0x5461('0x9d')+_0xabaf4d);}_0x21057d[_0x54df78[_0x5461('0x62')][_0x5461('0x9a')]]=_0x54df78[_0x5461('0x62')][_0x5461('0x89')];return db[_0x5461('0x9e')]['find']({'where':{'id':_0x54df78[_0x5461('0x76')]['ListId']},'include':[{'model':db[_0x5461('0x7a')],'as':'Contacts','where':_0x21057d,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x5461('0x20')](handleEntityNotFound(_0x5d99fa,null))['then'](function(_0x209824){if(_0x209824){_0x54df78['list']=_['omit'](_0x209824,['Contacts']);if(_0x209824['Contacts'][_0x5461('0x46')]){return _0x209824[_0x5461('0x9f')][0x0];}var _0x4c2537=_[_0x5461('0x18')](_0x54df78[_0x5461('0x62')],{'firstName':_0x54df78[_0x5461('0x62')][_0x5461('0x89')],'ListId':_0x209824['id']});_0x4c2537[_0x54df78[_0x5461('0x62')][_0x5461('0x9a')]]=_0x54df78[_0x5461('0x62')][_0x5461('0x89')];return db['CmContact'][_0x5461('0x5a')](_0x4c2537,{'fields':_0x481ba1,'raw':!![]});}})['then'](handleEntityNotFound(_0x5d99fa,null))[_0x5461('0x20')](function(_0x7a6353){if(_0x7a6353){_0x54df78[_0x5461('0xa0')]=_0x7a6353;var _0x24d885={'ContactId':_0x7a6353['id'],'phone':_0x54df78[_0x5461('0x62')][_0x5461('0x89')],'SmsAccountId':_0x853a19[_0x5461('0x57')]['id']};var _0xd65dd0={'ContactId':_0x7a6353['id'],'SmsAccountId':_0x853a19[_0x5461('0x57')]['id'],'closed':![]};return db[_0x5461('0xa1')][_0x5461('0x59')]({'where':_0xd65dd0})['then'](function(_0x210c60){if(_0x210c60){return[_0x210c60,![]];}return db[_0x5461('0xa1')][_0x5461('0x5a')](_0x24d885)[_0x5461('0x20')](function(_0x3f82d5){return[_0x3f82d5,!![]];});});}})[_0x5461('0xa2')](function(_0x4eee6a,_0x1978ff){_0x54df78[_0x5461('0xa3')]=_0x4eee6a['get']({'plain':!![]});_0x54df78[_0x5461('0xa3')][_0x5461('0xa4')]=![];if(_0x1978ff){if(_0x54df78[_0x5461('0x76')][_0x5461('0xa5')]){_0x54df78[_0x5461('0x77')][_0x5461('0xa6')]({'id':0x0,'priority':_0x54df78['applications'][_0x5461('0x46')]+0x1,'app':_0x5461('0xa7'),'appdata':_0x5461('0xa8'),'interval':_0x5461('0xa9')});}_0x54df78[_0x5461('0xa3')][_0x5461('0xa4')]=!![];}return db[_0x5461('0xaa')][_0x5461('0x5a')]({'phone':_0x54df78[_0x5461('0x62')][_0x5461('0x89')],'messageId':_0x54df78['body'][_0x5461('0x86')],'body':_0x54df78[_0x5461('0x62')]['body'],'SmsAccountId':_0x853a19['params']['id'],'SmsInteractionId':_0x4eee6a['id'],'direction':'in','ContactId':_0x4eee6a[_0x5461('0xab')],'AttachmentId':_0x54df78[_0x5461('0x62')][_0x5461('0xac')]});})[_0x5461('0x20')](function(_0x182bf5){_0x54df78[_0x5461('0x28')]=_0x182bf5;if(_0x54df78[_0x5461('0xa3')][_0x5461('0xad')]){return db[_0x5461('0xae')]['find']({'attributes':['id',_0x5461('0x3a')],'where':{'id':_0x54df78[_0x5461('0xa3')][_0x5461('0xad')]}})[_0x5461('0x20')](function(_0x35adb2){if(_0x35adb2){_0x54df78[_0x5461('0x77')][_0x5461('0xaf')]({'id':0x0,'priority':0x0,'app':_0x5461('0xb0'),'appdata':_0x35adb2[_0x5461('0x3a')]+','+(_0x54df78[_0x5461('0x76')][_0x5461('0xb1')]||0xa),'interval':_0x5461('0xa9')});}return respondWithRpcPromise('Start',_0x5461('0xb2'),_0x54df78);});}return respondWithRpcPromise(_0x5461('0xb3'),_0x5461('0xb2'),_0x54df78);})[_0x5461('0x20')](function(_0x11e093){if(_0x11e093){var _0x208f6d=0xc8;var _0x522ae4='receiveMessage';logger[_0x5461('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x522ae4,_0x208f6d,_0x5461('0xb4'));logger[_0x5461('0x22')](_0x5461('0xb5'),_0x522ae4,_0x208f6d,'entity\x20found',JSON['stringify'](_0x11e093));if(_0x54df78[_0x5461('0x76')][_0x5461('0x3d')]===_0x5461('0x84')){return _0x5d99fa[_0x5461('0x2b')](_0x208f6d)[_0x5461('0x2f')](_0x5461('0xb6'),_0x5461('0xb7'))['send']('\x0a');}else{return _0x5d99fa['status'](_0x208f6d)[_0x5461('0x31')](_0x11e093);}}})['catch'](handleError(_0x5d99fa,null));};exports['addApplications']=function(_0xe1f89c,_0x3bbdfb){var _0x369d9c=_0xe1f89c[_0x5461('0x57')]['id'];var _0x3e8a75=_0xe1f89c[_0x5461('0x62')];var _0x5682b6=0xc8;var _0x43442d=null;return db[_0x5461('0xb8')][_0x5461('0xb9')]({'isolationLevel':db['sequelize'][_0x5461('0xba')][_0x5461('0xbb')][_0x5461('0xbc')]},function(_0x5771d2){return db[_0x5461('0x53')][_0x5461('0x70')]({'where':{'id':_0x369d9c},'transaction':_0x5771d2})[_0x5461('0x20')](function(_0x167c69){if(_0x167c69){return db['SmsApplication'][_0x5461('0x35')]({'where':{'SmsAccountId':_0x369d9c},'transaction':_0x5771d2})['then'](function(){var _0x2ed89a=_[_0x5461('0x69')](_0x3e8a75,function(_0x202af4){_0x202af4[_0x5461('0x6e')]=_0x369d9c;return _0x202af4;});return db['SmsApplication'][_0x5461('0xbd')](_0x2ed89a,{'transaction':_0x5771d2});});}else{_0x5682b6=0x194;_0x43442d=[];}});})[_0x5461('0x20')](function(){if(_0x5682b6!==0x194){return db[_0x5461('0x74')][_0x5461('0xbe')]({'where':{'SmsAccountId':_0x369d9c},'order':_0x5461('0xbf')})[_0x5461('0x20')](function(_0x1f9f2e){_0x43442d=_0x1f9f2e;});}})[_0x5461('0x64')](function(_0x253b69){_0x5682b6=0x1f4;logger['error'](_0x253b69[_0x5461('0x39')]);if(_0x253b69['name']){delete _0x253b69['name'];}_0x43442d=_0x253b69;})[_0x5461('0xc0')](function(){if(_0x43442d===null){_0x3bbdfb[_0x5461('0x2a')](_0x5682b6);}else{if(_0x5682b6===0x1f4){_0x3bbdfb[_0x5461('0x2b')](_0x5682b6)[_0x5461('0xc1')](_0x43442d);}else{_0x3bbdfb[_0x5461('0x2b')](_0x5682b6)[_0x5461('0x31')](_0x43442d);}}});};exports[_0x5461('0xc2')]=function(_0x28b1b7,_0x13d7dd,_0x1a9dcd){var _0x1d5545={};var _0x391e57={};var _0x1466f7;var _0xa0d404;return db[_0x5461('0x53')]['findOne']({'where':{'id':_0x28b1b7[_0x5461('0x57')]['id']}})[_0x5461('0x20')](handleEntityNotFound(_0x13d7dd,null))[_0x5461('0x20')](function(_0x33933a){if(_0x33933a){_0x1466f7=_0x33933a;_0x391e57[_0x5461('0x3f')]=_['keys'](db['SmsApplication']['rawAttributes']);_0x391e57[_0x5461('0x40')]=_[_0x5461('0x41')](_0x28b1b7['query']);_0x391e57[_0x5461('0x42')]=_[_0x5461('0x43')](_0x391e57[_0x5461('0x3f')],_0x391e57['query']);_0x1d5545[_0x5461('0x45')]=_[_0x5461('0x43')](_0x391e57[_0x5461('0x3f')],qs[_0x5461('0x44')](_0x28b1b7[_0x5461('0x40')]['fields']));_0x1d5545['attributes']=_0x1d5545[_0x5461('0x45')][_0x5461('0x46')]?_0x1d5545[_0x5461('0x45')]:_0x391e57[_0x5461('0x3f')];_0x1d5545[_0x5461('0x49')]=qs[_0x5461('0x4a')](_0x28b1b7[_0x5461('0x40')]['sort']);_0x1d5545[_0x5461('0x4b')]=qs[_0x5461('0x42')](_[_0x5461('0x4c')](_0x28b1b7[_0x5461('0x40')],_0x391e57[_0x5461('0x42')]));if(_0x28b1b7['query'][_0x5461('0x4d')]){_0x1d5545[_0x5461('0x4b')]=_[_0x5461('0x4e')](_0x1d5545[_0x5461('0x4b')],{'$or':_[_0x5461('0x69')](_0x1d5545[_0x5461('0x45')],function(_0x208ee8){var _0x366506={};_0x366506[_0x208ee8]={'$like':'%'+_0x28b1b7[_0x5461('0x40')][_0x5461('0x4d')]+'%'};return _0x366506;})});}_0x1d5545=_[_0x5461('0x4e')]({},_0x1d5545,_0x28b1b7[_0x5461('0x6a')]);return _0x1466f7['getApplications'](_0x1d5545);}})[_0x5461('0x20')](function(_0x5dbab7){if(_0x5dbab7){_0xa0d404=_0x5dbab7[_0x5461('0x46')];if(!_0x28b1b7[_0x5461('0x40')][_0x5461('0x47')](_0x5461('0x48'))){_0x1d5545['limit']=qs['limit'](_0x28b1b7['query']['limit']);_0x1d5545[_0x5461('0x2c')]=qs[_0x5461('0x2c')](_0x28b1b7['query'][_0x5461('0x2c')]);}return _0x1466f7[_0x5461('0xc2')](_0x1d5545);}})[_0x5461('0x20')](function(_0x47ccab){if(_0x47ccab){return _0x47ccab?{'count':_0xa0d404,'rows':_0x47ccab}:null;}})[_0x5461('0x20')](respondWithResult(_0x13d7dd,null))[_0x5461('0x64')](handleError(_0x13d7dd,null));};exports['getInteractions']=function(_0x526b7b,_0x15fd62,_0xdbbfad){var _0x11900a={'raw':![],'where':{}};var _0x4e8ee2={};var _0x348009={'count':0x0,'rows':[]};return db[_0x5461('0x53')][_0x5461('0x70')]({'where':{'id':_0x526b7b[_0x5461('0x57')]['id']}})[_0x5461('0x20')](handleEntityNotFound(_0x15fd62,null))['then'](function(_0x18baf0){if(_0x18baf0){_0x4e8ee2[_0x5461('0x3f')]=_[_0x5461('0x41')](db[_0x5461('0xa1')][_0x5461('0x3c')]);_0x4e8ee2[_0x5461('0x40')]=_[_0x5461('0x41')](_0x526b7b[_0x5461('0x40')]);_0x4e8ee2[_0x5461('0x42')]=_['intersection'](_0x4e8ee2[_0x5461('0x3f')],_0x4e8ee2[_0x5461('0x40')]);_0x11900a[_0x5461('0x45')]=_[_0x5461('0x43')](_0x4e8ee2[_0x5461('0x3f')],qs[_0x5461('0x44')](_0x526b7b[_0x5461('0x40')][_0x5461('0x44')]));_0x11900a[_0x5461('0x45')]=_0x11900a['attributes'][_0x5461('0x46')]?_0x11900a[_0x5461('0x45')]:_0x4e8ee2[_0x5461('0x3f')];if(!_0x526b7b[_0x5461('0x40')][_0x5461('0x47')](_0x5461('0x48'))){_0x11900a['limit']=qs[_0x5461('0x2e')](_0x526b7b[_0x5461('0x40')][_0x5461('0x2e')]);_0x11900a[_0x5461('0x2c')]=qs[_0x5461('0x2c')](_0x526b7b[_0x5461('0x40')][_0x5461('0x2c')]);}_0x11900a[_0x5461('0x49')]=qs[_0x5461('0x4a')](_0x526b7b[_0x5461('0x40')][_0x5461('0x4a')]);_0x11900a[_0x5461('0x4b')]=qs[_0x5461('0x42')](_[_0x5461('0x4c')](_0x526b7b[_0x5461('0x40')],_0x4e8ee2['filters']));_0x11900a[_0x5461('0x4b')]['SmsAccountId']=_0x18baf0['id'];if(_0x526b7b['query'][_0x5461('0x4d')]){_0x11900a['where']=_[_0x5461('0x4e')](_0x11900a[_0x5461('0x4b')],{'$or':_[_0x5461('0x69')](_0x11900a[_0x5461('0x45')],function(_0x537818){var _0x503bc6={};_0x503bc6[_0x537818]={'$like':'%'+_0x526b7b[_0x5461('0x40')][_0x5461('0x4d')]+'%'};return _0x503bc6;})});}_0x11900a=_['merge']({},_0x11900a,_0x526b7b[_0x5461('0x6a')]);return db[_0x5461('0xa1')]['count']({'where':_0x11900a[_0x5461('0x4b')]})['then'](function(_0x49987c){_0x348009[_0x5461('0x50')]=_0x49987c;if(_0x526b7b[_0x5461('0x40')][_0x5461('0x51')]){_0x11900a[_0x5461('0x52')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x5461('0xae')],'as':_0x5461('0xc3'),'attributes':[_0x5461('0x3a'),_0x5461('0xc4'),_0x5461('0xc5')],'required':![]},{'model':db['Tag'],'as':_0x5461('0xc6'),'attributes':['id',_0x5461('0x3a'),'color'],'where':_0x526b7b[_0x5461('0x40')][_0x5461('0xc7')]?{'id':_0x526b7b['query']['tag']}:undefined,'required':_0x526b7b[_0x5461('0x40')][_0x5461('0xc7')]?!![]:![]}];}return db['SmsInteraction'][_0x5461('0x54')](_0x11900a);})[_0x5461('0x20')](function(_0x3e95a3){_0x348009['rows']=_0x3e95a3;return _0x348009;});}})[_0x5461('0x20')](respondWithFilteredResult(_0x15fd62,_0x11900a))[_0x5461('0x64')](handleError(_0x15fd62,null));};exports[_0x5461('0xc1')]=function(_0x48ab6a,_0x509d95,_0x366a26){var _0x232b05,_0x5c0a90,_0x17edb6;if(_[_0x5461('0x99')](_0x48ab6a['body'][_0x5461('0x62')])||_0x48ab6a[_0x5461('0x62')][_0x5461('0x62')]===''){throw new db[(_0x5461('0x7b'))]['ValidationError'](_0x5461('0x98'));}if(_[_0x5461('0x99')](_0x48ab6a[_0x5461('0x62')]['to'])){throw new db[(_0x5461('0x7b'))][(_0x5461('0x7c'))](_0x5461('0xc8'));}_0x232b05=_0x48ab6a[_0x5461('0x62')]['to'];return db[_0x5461('0x53')][_0x5461('0x59')]({'where':{'id':_0x48ab6a[_0x5461('0x57')]['id']},'include':[{'model':db[_0x5461('0x9e')],'as':_0x5461('0xc9'),'include':[{'model':db[_0x5461('0x7a')],'as':_0x5461('0x9f'),'where':{'mobile':_0x232b05},'limit':0x1,'order':[[_0x5461('0x80'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x509d95,null))['then'](function(_0x3c488c){if(_0x3c488c&&_0x3c488c[_0x5461('0xc9')]){_0x5c0a90=_0x3c488c[_0x5461('0x36')]({'plain':!![]});if(_0x5c0a90[_0x5461('0xc9')]&&_0x5c0a90[_0x5461('0xc9')]['Contacts']['length']){return _0x5c0a90[_0x5461('0xc9')]['Contacts'][0x0];}return db['CmContact'][_0x5461('0x5a')](_[_0x5461('0x18')](_0x48ab6a[_0x5461('0x62')],{'firstName':_0x232b05,'mobile':_0x232b05,'phone':_0x232b05,'ListId':_0x5c0a90[_0x5461('0x82')]}));}})[_0x5461('0x20')](handleEntityNotFound(_0x509d95,null))[_0x5461('0x20')](function(_0x9f9684){if(_0x9f9684){_0x17edb6=_0x9f9684;return db[_0x5461('0xa1')]['find']({'where':{'ContactId':_0x17edb6['id'],'closed':![],'SmsAccountId':_0x5c0a90['id']}})[_0x5461('0x20')](function(_0xac2e3b){if(_0xac2e3b){return[_0xac2e3b,![]];}return db[_0x5461('0xa1')][_0x5461('0x5a')]({'UserId':_0x48ab6a[_0x5461('0x5d')]['id'],'ContactId':_0x17edb6['id'],'SmsAccountId':_0x5c0a90['id'],'phone':_0x232b05,'firstMsgDirection':_0x5461('0xca'),'Messages':[_[_0x5461('0x4e')](_0x48ab6a[_0x5461('0x62')],{'read':![],'body':_0x48ab6a[_0x5461('0x62')][_0x5461('0x62')],'phone':_0x232b05,'SmsAccountId':_0x5c0a90['id'],'UserId':_0x48ab6a[_0x5461('0x5d')]['id'],'ContactId':_0x17edb6['id']})]},{'include':[{'model':db[_0x5461('0xaa')],'as':_0x5461('0xcb')}]})[_0x5461('0x20')](function(_0x2412f3){return[_0x2412f3,!![]];});});}})[_0x5461('0xa2')](function(_0x3e2e00,_0x2273fd){if(_0x2273fd){return _0x3e2e00;}return db[_0x5461('0xaa')][_0x5461('0x5a')](_[_0x5461('0x4e')](_0x48ab6a['body'],{'read':![],'body':_0x48ab6a[_0x5461('0x62')][_0x5461('0x62')],'phone':_0x232b05,'SmsAccountId':_0x5c0a90['id'],'SmsInteractionId':_0x3e2e00['id'],'UserId':_0x48ab6a[_0x5461('0x5d')]['id'],'ContactId':_0x17edb6['id']}))[_0x5461('0x20')](function(_0xddd60c){_0x3e2e00[_0x5461('0xcc')]['Messages']=[];_0x3e2e00[_0x5461('0xcc')]['Messages'][_0x5461('0xa6')](_0xddd60c[_0x5461('0xcc')]);return _0x3e2e00;});})['then'](respondWithResult(_0x509d95,null))['catch'](handleError(_0x509d95,null));};exports['status']=function(_0x53f8cf,_0x1d287c,_0x41ea97){if(_0x53f8cf[_0x5461('0x62')]['id']){delete _0x53f8cf[_0x5461('0x62')]['id'];}var _0x31bcd9,_0x454701,_0x2bf469;return db[_0x5461('0x53')][_0x5461('0x59')]({'where':{'id':_0x53f8cf[_0x5461('0x57')]['id']}})[_0x5461('0x20')](handleEntityNotFound(_0x1d287c,null))['then'](function(_0x2d39b8){if(_0x2d39b8){_0x2bf469=_0x2d39b8;logger[_0x5461('0x22')](_0x5461('0xcd'),'status',_0x5461('0xce'),_0x2d39b8['type'],util[_0x5461('0xcf')](_0x53f8cf[_0x5461('0x62')],{'showHidden':![],'depth':null}));switch(_0x2d39b8[_0x5461('0x3d')]){case _0x5461('0x88'):if(_0x53f8cf[_0x5461('0x62')]['skebby_dispatch_id']&&_0x53f8cf[_0x5461('0x62')]['status']){_0x454701=_0x53f8cf[_0x5461('0x62')][_0x5461('0x2b')];return db[_0x5461('0xaa')][_0x5461('0x59')]({'where':{'messageId':_0x53f8cf[_0x5461('0x62')][_0x5461('0xd0')]}});}break;case _0x5461('0x8a'):if(_0x53f8cf[_0x5461('0x62')][_0x5461('0xd1')]&&_0x53f8cf[_0x5461('0x62')]['statusInt']){_0x454701=_0x53f8cf[_0x5461('0x62')][_0x5461('0xd2')];return db[_0x5461('0xaa')][_0x5461('0x59')]({'where':{'messageId':_0x53f8cf['body'][_0x5461('0xd1')]}});}break;case _0x5461('0x8b'):if(_0x53f8cf[_0x5461('0x62')]['message_id']&&_0x53f8cf[_0x5461('0x62')][_0x5461('0xd3')]){_0x454701=_0x53f8cf[_0x5461('0x62')][_0x5461('0xd3')];return db[_0x5461('0xaa')]['find']({'where':{'messageId':_0x53f8cf[_0x5461('0x62')][_0x5461('0xd4')]}});}break;case _0x5461('0x8f'):var _0x2ad28c=_0x53f8cf['body'][_0x5461('0x90')][0x0];if(_0x2ad28c[_0x5461('0x86')]&&_0x2ad28c[_0x5461('0x2b')][_0x5461('0xd5')]===_0x5461('0xd6')){_0x454701=_0x2ad28c['status'][_0x5461('0xd5')];return db['SmsMessage'][_0x5461('0x59')]({'where':{'messageId':_0x2ad28c[_0x5461('0x86')]}});}break;case _0x5461('0x93'):if(_0x53f8cf[_0x5461('0x62')][_0x5461('0x86')]&&_0x53f8cf[_0x5461('0x62')]['status']){_0x454701=_0x53f8cf[_0x5461('0x62')][_0x5461('0x2b')];return db[_0x5461('0xaa')][_0x5461('0x59')]({'where':{'messageId':_0x53f8cf[_0x5461('0x62')][_0x5461('0x86')]}});}break;case _0x5461('0x95'):if(_0x53f8cf[_0x5461('0x62')][0x0][_0x5461('0x28')]['id']){_0x454701=_0x53f8cf['body'][0x0][_0x5461('0x3d')];return db[_0x5461('0xaa')][_0x5461('0x59')]({'where':{'messageId':_0x53f8cf[_0x5461('0x62')][0x0][_0x5461('0x28')]['id']}});}break;case _0x5461('0x96'):if(_0x53f8cf[_0x5461('0x62')][_0x5461('0xd7')]&&_0x53f8cf[_0x5461('0x62')]['status']){_0x454701=_0x53f8cf[_0x5461('0x62')][_0x5461('0x2b')];return db[_0x5461('0xaa')][_0x5461('0x59')]({'where':{'messageId':_0x53f8cf[_0x5461('0x62')][_0x5461('0xd7')]}});}break;}}})[_0x5461('0x20')](handleEntityNotFound(_0x1d287c,null))[_0x5461('0x20')](function(_0x4f65b4){if(_0x4f65b4){_0x31bcd9=_0x4f65b4;switch(_0x2bf469[_0x5461('0x3d')]){case _0x5461('0x88'):if(_0x454701===_0x5461('0xd6')){return _0x31bcd9[_0x5461('0x34')]({'read':!![]});}else{logger[_0x5461('0x25')](_0x5461('0xcd'),_0x5461('0x2b'),_0x5461('0x88'),util[_0x5461('0xcf')](_0x53f8cf[_0x5461('0x62')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x454701==='1'){return _0x31bcd9[_0x5461('0x34')]({'read':!![]});}else{logger[_0x5461('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x5461('0x88'),util['inspect'](_0x53f8cf[_0x5461('0x62')],{'showHidden':![],'depth':null}));}break;case _0x5461('0x8b'):if(!_0x53f8cf['body'][_0x5461('0xd8')]&&_0x454701>=0xc8&&_0x454701<=0xce){return _0x31bcd9[_0x5461('0x34')]({'read':!![]});}else{logger[_0x5461('0x25')](_0x5461('0xcd'),_0x5461('0x2b'),_0x5461('0x8b'),util[_0x5461('0xcf')](_0x53f8cf[_0x5461('0x62')],{'showHidden':![],'depth':null}));}break;case _0x5461('0x8f'):var _0x814ecd=_0x53f8cf[_0x5461('0x62')][_0x5461('0x90')][0x0];if(_0x814ecd[_0x5461('0x2b')][_0x5461('0xd5')]===_0x5461('0xd6')){return _0x31bcd9[_0x5461('0x34')]({'read':!![]});}else{logger[_0x5461('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x5461('0x8f'),util['inspect'](_0x53f8cf['body'],{'showHidden':![],'depth':null}));}break;case _0x5461('0x93'):if(_0x454701=='DELIVERED_TO_GATEWAY'||_0x454701==_0x5461('0xd9')){return _0x31bcd9[_0x5461('0x34')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status','clickatell',util['inspect'](_0x53f8cf['body'],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x454701==_0x5461('0xda')){return _0x31bcd9[_0x5461('0x34')]({'read':!![]});}else{logger[_0x5461('0x25')](_0x5461('0xcd'),'status',_0x5461('0x95'),util[_0x5461('0xcf')](_0x53f8cf[_0x5461('0x62')],{'showHidden':![],'depth':null}));}break;case _0x5461('0x96'):if(_0x454701===_0x5461('0xdb')||_0x454701===_0x5461('0xdc')){return _0x31bcd9[_0x5461('0x34')]({'read':!![]});}else{logger[_0x5461('0x25')](_0x5461('0xcd'),_0x5461('0x2b'),_0x5461('0x96'),util['inspect'](_0x53f8cf[_0x5461('0x62')],{'showHidden':![],'depth':null}));}break;}return _0x31bcd9;}})[_0x5461('0x20')](respondWithResult(_0x1d287c,null))['catch'](handleError(_0x1d287c,null));};exports[_0x5461('0xdd')]=function(_0x3e0205,_0x5ed99b,_0x4d5849){var _0x45810e,_0x1b787,_0x170948;return db[_0x5461('0x53')][_0x5461('0x59')]({'where':{'id':_0x3e0205[_0x5461('0x57')]['id']}})[_0x5461('0x20')](handleEntityNotFound(_0x5ed99b,null))[_0x5461('0x20')](function(_0x1cb739){if(_0x1cb739){_0x170948=_0x1cb739;logger[_0x5461('0x22')](_0x5461('0xcd'),_0x5461('0x2b'),'received\x20delivery\x20report\x20from',_0x1cb739[_0x5461('0x3d')],util[_0x5461('0xcf')](_0x3e0205[_0x5461('0x40')],{'showHidden':![],'depth':null}));switch(_0x1cb739[_0x5461('0x3d')]){case'csc':if(_0x3e0205[_0x5461('0x40')]['message-id']&&_0x3e0205[_0x5461('0x40')][_0x5461('0xde')]){_0x1b787=_0x3e0205[_0x5461('0x40')]['state'];return db['SmsMessage']['find']({'where':{'messageId':_0x3e0205[_0x5461('0x40')][_0x5461('0xdf')]}});}break;}}})[_0x5461('0x20')](handleEntityNotFound(_0x5ed99b,null))[_0x5461('0x20')](function(_0x59a118){if(_0x59a118){_0x45810e=_0x59a118;switch(_0x170948[_0x5461('0x3d')]){case _0x5461('0xe0'):if(_0x1b787==='2'||_0x1b787==='6'){return _0x45810e['update']({'read':!![]});}else{logger[_0x5461('0x25')](_0x5461('0xcd'),_0x5461('0x2b'),_0x5461('0xe0'),util[_0x5461('0xcf')](_0x3e0205[_0x5461('0x40')],{'showHidden':![],'depth':null}));};break;}return _0x45810e;}})[_0x5461('0x20')](respondWithResult(_0x5ed99b,null))[_0x5461('0x64')](handleError(_0x5ed99b,null));};exports[_0x5461('0xe1')]=function(_0x4bc26e,_0x5c4254,_0x13c2c7){return db[_0x5461('0x53')][_0x5461('0x59')]({'where':{'id':_0x4bc26e[_0x5461('0x57')]['id']}})[_0x5461('0x20')](handleEntityNotFound(_0x5c4254,null))[_0x5461('0x20')](function(_0x1c5d11){if(_0x1c5d11){return _0x1c5d11[_0x5461('0xe1')](_0x4bc26e[_0x5461('0x62')][_0x5461('0x6c')],_[_0x5461('0xe2')](_0x4bc26e[_0x5461('0x62')],[_0x5461('0x6c'),'id'])||{})[_0x5461('0xa2')](function(_0x5bd3e5){for(var _0x478e2f=0x0;_0x478e2f<_0x4bc26e[_0x5461('0x62')][_0x5461('0x6c')][_0x5461('0x46')];_0x478e2f+=0x1){socket[_0x5461('0xe3')]('userSmsAccount:save',{'UserId':Number(_0x4bc26e[_0x5461('0x62')]['ids'][_0x478e2f]),'SmsAccountId':Number(_0x4bc26e[_0x5461('0x57')]['id'])});}return _0x5bd3e5;});}})[_0x5461('0x20')](respondWithResult(_0x5c4254,null))['catch'](handleError(_0x5c4254,null));};exports[_0x5461('0xe4')]=function(_0x178463,_0x1269bb,_0x4ff1e6){return db['SmsAccount'][_0x5461('0x59')]({'where':{'id':_0x178463[_0x5461('0x57')]['id']}})[_0x5461('0x20')](handleEntityNotFound(_0x1269bb,null))[_0x5461('0x20')](function(_0x58e34a){if(_0x58e34a){return _0x58e34a[_0x5461('0xe4')](_0x178463[_0x5461('0x40')][_0x5461('0x6c')])[_0x5461('0x20')](function(){if(_[_0x5461('0xe5')](_0x178463['query']['ids'])){for(var _0x11be03=0x0;_0x11be03<_0x178463[_0x5461('0x40')][_0x5461('0x6c')][_0x5461('0x46')];_0x11be03+=0x1){socket[_0x5461('0xe3')]('userSmsAccount:remove',{'UserId':Number(_0x178463[_0x5461('0x40')][_0x5461('0x6c')][_0x11be03]),'SmsAccountId':Number(_0x178463['params']['id'])});}}else{socket[_0x5461('0xe3')](_0x5461('0xe6'),{'UserId':Number(_0x178463['query'][_0x5461('0x6c')]),'SmsAccountId':Number(_0x178463['params']['id'])});}});}})[_0x5461('0x20')](respondWithStatusCode(_0x1269bb,null))[_0x5461('0x64')](handleError(_0x1269bb,null));};exports[_0x5461('0xe7')]=function(_0x513adf,_0x311e33,_0x2defc4){var _0x1c950b={};var _0x443c77={};var _0x3eea26;var _0x1610de;return db[_0x5461('0x53')][_0x5461('0x70')]({'where':{'id':_0x513adf[_0x5461('0x57')]['id']}})[_0x5461('0x20')](handleEntityNotFound(_0x311e33,null))[_0x5461('0x20')](function(_0x5c3a60){if(_0x5c3a60){_0x3eea26=_0x5c3a60;_0x443c77['model']=_['keys'](db[_0x5461('0xae')][_0x5461('0x3c')]);_0x443c77[_0x5461('0x40')]=_[_0x5461('0x41')](_0x513adf[_0x5461('0x40')]);_0x443c77['filters']=_['intersection'](_0x443c77[_0x5461('0x3f')],_0x443c77[_0x5461('0x40')]);_0x1c950b[_0x5461('0x45')]=_['intersection'](_0x443c77[_0x5461('0x3f')],qs[_0x5461('0x44')](_0x513adf['query']['fields']));_0x1c950b['attributes']=_0x1c950b[_0x5461('0x45')][_0x5461('0x46')]?_0x1c950b['attributes']:_0x443c77[_0x5461('0x3f')];_0x1c950b['order']=qs[_0x5461('0x4a')](_0x513adf['query'][_0x5461('0x4a')]);_0x1c950b[_0x5461('0x4b')]=qs['filters'](_[_0x5461('0x4c')](_0x513adf['query'],_0x443c77['filters']));if(_0x513adf[_0x5461('0x40')][_0x5461('0x4d')]){_0x1c950b['where']=_[_0x5461('0x4e')](_0x1c950b[_0x5461('0x4b')],{'$or':_[_0x5461('0x69')](_0x1c950b[_0x5461('0x45')],function(_0x2ac5ba){var _0x52c302={};_0x52c302[_0x2ac5ba]={'$like':'%'+_0x513adf[_0x5461('0x40')][_0x5461('0x4d')]+'%'};return _0x52c302;})});}_0x1c950b=_[_0x5461('0x4e')]({},_0x1c950b,_0x513adf[_0x5461('0x6a')]);return _0x3eea26[_0x5461('0xe7')](_0x1c950b);}})[_0x5461('0x20')](function(_0x44b391){if(_0x44b391){_0x1610de=_0x44b391[_0x5461('0x46')];if(!_0x513adf[_0x5461('0x40')]['hasOwnProperty'](_0x5461('0x48'))){_0x1c950b[_0x5461('0x2e')]=qs[_0x5461('0x2e')](_0x513adf[_0x5461('0x40')][_0x5461('0x2e')]);_0x1c950b['offset']=qs[_0x5461('0x2c')](_0x513adf[_0x5461('0x40')][_0x5461('0x2c')]);}return _0x3eea26[_0x5461('0xe7')](_0x1c950b);}})['then'](function(_0x43202a){if(_0x43202a){return _0x43202a?{'count':_0x1610de,'rows':_0x43202a}:null;}})[_0x5461('0x20')](respondWithResult(_0x311e33,null))[_0x5461('0x64')](handleError(_0x311e33,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 9d20ff2..091a511 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 _0x5d50=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','save','update','remove'];(function(_0x13a45f,_0x533e58){var _0x145ef3=function(_0x17127a){while(--_0x17127a){_0x13a45f['push'](_0x13a45f['shift']());}};_0x145ef3(++_0x533e58);}(_0x5d50,0x13a));var _0x05d5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d50[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x05d5('0x0'));var SmsAccount=require(_0x05d5('0x1'))['db'][_0x05d5('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x05d5('0x3'),'afterUpdate':_0x05d5('0x4'),'afterDestroy':_0x05d5('0x5')};function emitEvent(_0x1f2587){return function(_0x5ef2d9,_0xaa1447,_0x405da4){SmsAccountEvents[_0x05d5('0x6')](_0x1f2587+':'+_0x5ef2d9['id'],_0x5ef2d9);SmsAccountEvents['emit'](_0x1f2587,_0x5ef2d9);_0x405da4(null);};}for(var e in events){if(events[_0x05d5('0x7')](e)){var event=events[e];SmsAccount[_0x05d5('0x8')](e,emitEvent(event));}}module[_0x05d5('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x7642=['emit','hasOwnProperty','hook','../../mysqldb','SmsAccount','setMaxListeners','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7642,0x173));var _0x2764=function(_0x153bc0,_0x16e027){_0x153bc0=_0x153bc0-0x0;var _0x470629=_0x7642[_0x153bc0];return _0x470629;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x2764('0x0'))['db'][_0x2764('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x2764('0x2')](0x0);var events={'afterCreate':_0x2764('0x3'),'afterUpdate':'update','afterDestroy':_0x2764('0x4')};function emitEvent(_0x27dac1){return function(_0x135d2f,_0x20a521,_0x9011bd){SmsAccountEvents['emit'](_0x27dac1+':'+_0x135d2f['id'],_0x135d2f);SmsAccountEvents[_0x2764('0x5')](_0x27dac1,_0x135d2f);_0x9011bd(null);};}for(var e in events){if(events[_0x2764('0x6')](e)){var event=events[e];SmsAccount[_0x2764('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 428344b..20bf5f4 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 _0x8359=['sms_accounts','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./smsAccount.attributes','exports','define','SmsAccount'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8359,0x1e1));var _0x9835=function(_0x26d386,_0x1660c0){_0x26d386=_0x26d386-0x0;var _0x4ef9a8=_0x8359[_0x26d386];return _0x4ef9a8;};'use strict';var _=require(_0x9835('0x0'));var util=require(_0x9835('0x1'));var logger=require(_0x9835('0x2'))('api');var moment=require(_0x9835('0x3'));var BPromise=require('bluebird');var rp=require(_0x9835('0x4'));var fs=require('fs');var path=require(_0x9835('0x5'));var rimraf=require(_0x9835('0x6'));var config=require('../../config/environment');var attributes=require(_0x9835('0x7'));module[_0x9835('0x8')]=function(_0x2c1ac9,_0x5b253f){return _0x2c1ac9[_0x9835('0x9')](_0x9835('0xa'),attributes,{'tableName':_0x9835('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc30b=['path','rimraf','./smsAccount.attributes','define','SmsAccount','lodash','../../config/logger','api','moment','request-promise'];(function(_0x322914,_0xa01e0f){var _0x41be05=function(_0x2f4efa){while(--_0x2f4efa){_0x322914['push'](_0x322914['shift']());}};_0x41be05(++_0xa01e0f);}(_0xc30b,0x127));var _0xbc30=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xc30b[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xbc30('0x0'));var util=require('util');var logger=require(_0xbc30('0x1'))(_0xbc30('0x2'));var moment=require(_0xbc30('0x3'));var BPromise=require('bluebird');var rp=require(_0xbc30('0x4'));var fs=require('fs');var path=require(_0xbc30('0x5'));var rimraf=require(_0xbc30('0x6'));var config=require('../../config/environment');var attributes=require(_0xbc30('0x7'));module['exports']=function(_0x800a1d,_0x3e78ed){return _0x800a1d[_0xbc30('0x8')](_0xbc30('0x9'),attributes,{'tableName':'sms_accounts','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 67d01a4..0bf4f5f 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 _0x32ad=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','bluebird'];(function(_0x1a3f87,_0x468ce7){var _0x16793a=function(_0x20a9aa){while(--_0x20a9aa){_0x1a3f87['push'](_0x1a3f87['shift']());}};_0x16793a(++_0x468ce7);}(_0x32ad,0x93));var _0xd32a=function(_0x30b824,_0x14c743){_0x30b824=_0x30b824-0x0;var _0x98dcfd=_0x32ad[_0x30b824];return _0x98dcfd;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xd32a('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd32a('0x1'));var db=require(_0xd32a('0x2'))['db'];var utils=require(_0xd32a('0x3'));var logger=require(_0xd32a('0x4'))(_0xd32a('0x5'));var config=require(_0xd32a('0x6'));var jayson=require(_0xd32a('0x7'));var client=jayson[_0xd32a('0x8')][_0xd32a('0x9')]({'port':0x232a});config[_0xd32a('0xa')]=_[_0xd32a('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd32a('0xc'))(new Redis(config[_0xd32a('0xa')]));require(_0xd32a('0xd'))[_0xd32a('0xe')](socket);function respondWithRpcPromise(_0x219ae6,_0x512cec,_0x228016){return new BPromise(function(_0x1474c7,_0x2ce928){return client[_0xd32a('0xf')](_0x219ae6,_0x228016)[_0xd32a('0x10')](function(_0x11ab95){logger[_0xd32a('0x11')](_0xd32a('0x12'),_0x512cec,'request\x20sent');logger[_0xd32a('0x13')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x512cec,_0xd32a('0x14'),JSON[_0xd32a('0x15')](_0x11ab95));if(_0x11ab95[_0xd32a('0x16')]){if(_0x11ab95['error'][_0xd32a('0x17')]===0x1f4){logger[_0xd32a('0x16')](_0xd32a('0x12'),_0x512cec,_0x11ab95['error'][_0xd32a('0x18')]);return _0x2ce928(_0x11ab95['error']['message']);}logger[_0xd32a('0x16')](_0xd32a('0x12'),_0x512cec,_0x11ab95[_0xd32a('0x16')][_0xd32a('0x18')]);return _0x1474c7(_0x11ab95[_0xd32a('0x16')]['message']);}else{logger[_0xd32a('0x11')](_0xd32a('0x12'),_0x512cec,_0xd32a('0x14'));_0x1474c7(_0x11ab95[_0xd32a('0x19')]['message']);}})[_0xd32a('0x1a')](function(_0xb00620){logger[_0xd32a('0x16')](_0xd32a('0x12'),_0x512cec,_0xb00620);_0x2ce928(_0xb00620);});});}exports[_0xd32a('0x1b')]=function(_0x5c8dc5){var _0x1661c8=this;return new Promise(function(_0xafc868,_0x3cb0dc){return db[_0xd32a('0x1c')][_0xd32a('0x1d')]({'raw':_0x5c8dc5[_0xd32a('0x1e')]?_0x5c8dc5['options'][_0xd32a('0x1f')]===undefined?!![]:![]:!![],'where':_0x5c8dc5[_0xd32a('0x1e')]?_0x5c8dc5[_0xd32a('0x1e')][_0xd32a('0x20')]||null:null,'attributes':_0x5c8dc5[_0xd32a('0x1e')]?_0x5c8dc5['options'][_0xd32a('0x21')]||null:null,'include':_0x5c8dc5[_0xd32a('0x1e')]?_0x5c8dc5['options'][_0xd32a('0x22')]?_[_0xd32a('0x23')](_0x5c8dc5[_0xd32a('0x1e')]['include'],function(_0x3078e3){return{'model':db[_0x3078e3[_0xd32a('0x24')]],'as':_0x3078e3['as'],'attributes':_0x3078e3[_0xd32a('0x21')],'include':_0x3078e3[_0xd32a('0x22')]?_['map'](_0x3078e3[_0xd32a('0x22')],function(_0x545d50){return{'model':db[_0x545d50[_0xd32a('0x24')]],'as':_0x545d50['as'],'attributes':_0x545d50[_0xd32a('0x21')],'include':_0x545d50[_0xd32a('0x22')]?_[_0xd32a('0x23')](_0x545d50['include'],function(_0x14b7aa){return{'model':db[_0x14b7aa[_0xd32a('0x24')]],'as':_0x14b7aa['as'],'attributes':_0x14b7aa[_0xd32a('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd32a('0x10')](function(_0x39c460){logger[_0xd32a('0x11')]('ShowSmsAccount',_0x5c8dc5);logger[_0xd32a('0x13')](_0xd32a('0x1b'),_0x5c8dc5,JSON[_0xd32a('0x15')](_0x39c460));_0xafc868(_0x39c460);})['catch'](function(_0x47d76f){logger['error'](_0xd32a('0x1b'),_0x47d76f[_0xd32a('0x18')],_0x5c8dc5);_0x3cb0dc(_0x1661c8[_0xd32a('0x16')](0x1f4,_0x47d76f[_0xd32a('0x18')]));});});}; \ No newline at end of file +var _0x709a=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','register','request','then','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','ShowSmsAccount','SmsAccount','options','raw','where','attributes','include','map','model','catch','lodash','util','moment','bluebird'];(function(_0x32911e,_0x990d5d){var _0x1ca76b=function(_0x423c38){while(--_0x423c38){_0x32911e['push'](_0x32911e['shift']());}};_0x1ca76b(++_0x990d5d);}(_0x709a,0x1f4));var _0xa709=function(_0x2113ba,_0x5ac4ef){_0x2113ba=_0x2113ba-0x0;var _0x255e52=_0x709a[_0x2113ba];return _0x255e52;};'use strict';var _=require(_0xa709('0x0'));var util=require(_0xa709('0x1'));var moment=require(_0xa709('0x2'));var BPromise=require(_0xa709('0x3'));var rs=require(_0xa709('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa709('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa709('0x6'))(_0xa709('0x7'));var config=require(_0xa709('0x8'));var jayson=require(_0xa709('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xa709('0xa')](config[_0xa709('0xb')],{'host':_0xa709('0xc'),'port':0x18eb});var socket=require(_0xa709('0xd'))(new Redis(config['redis']));require('./smsAccount.socket')[_0xa709('0xe')](socket);function respondWithRpcPromise(_0x395b54,_0xff4e0f,_0x25b968){return new BPromise(function(_0x16c4cf,_0xfdbc39){return client[_0xa709('0xf')](_0x395b54,_0x25b968)[_0xa709('0x10')](function(_0x57a56d){logger[_0xa709('0x11')]('SmsAccount,\x20%s,\x20%s',_0xff4e0f,'request\x20sent');logger[_0xa709('0x12')](_0xa709('0x13'),_0xff4e0f,_0xa709('0x14'),JSON[_0xa709('0x15')](_0x57a56d));if(_0x57a56d['error']){if(_0x57a56d[_0xa709('0x16')][_0xa709('0x17')]===0x1f4){logger['error'](_0xa709('0x18'),_0xff4e0f,_0x57a56d[_0xa709('0x16')][_0xa709('0x19')]);return _0xfdbc39(_0x57a56d[_0xa709('0x16')][_0xa709('0x19')]);}logger[_0xa709('0x16')](_0xa709('0x18'),_0xff4e0f,_0x57a56d[_0xa709('0x16')][_0xa709('0x19')]);return _0x16c4cf(_0x57a56d[_0xa709('0x16')]['message']);}else{logger['info'](_0xa709('0x18'),_0xff4e0f,_0xa709('0x14'));_0x16c4cf(_0x57a56d['result'][_0xa709('0x19')]);}})['catch'](function(_0xf215af){logger[_0xa709('0x16')](_0xa709('0x18'),_0xff4e0f,_0xf215af);_0xfdbc39(_0xf215af);});});}exports[_0xa709('0x1a')]=function(_0x9b9a87){var _0xb7f282=this;return new Promise(function(_0x19efa9,_0x1759ef){return db[_0xa709('0x1b')]['find']({'raw':_0x9b9a87[_0xa709('0x1c')]?_0x9b9a87[_0xa709('0x1c')][_0xa709('0x1d')]===undefined?!![]:![]:!![],'where':_0x9b9a87[_0xa709('0x1c')]?_0x9b9a87[_0xa709('0x1c')][_0xa709('0x1e')]||null:null,'attributes':_0x9b9a87['options']?_0x9b9a87['options'][_0xa709('0x1f')]||null:null,'include':_0x9b9a87[_0xa709('0x1c')]?_0x9b9a87[_0xa709('0x1c')][_0xa709('0x20')]?_[_0xa709('0x21')](_0x9b9a87[_0xa709('0x1c')][_0xa709('0x20')],function(_0xe19d6){return{'model':db[_0xe19d6[_0xa709('0x22')]],'as':_0xe19d6['as'],'attributes':_0xe19d6[_0xa709('0x1f')],'include':_0xe19d6[_0xa709('0x20')]?_[_0xa709('0x21')](_0xe19d6['include'],function(_0x44023){return{'model':db[_0x44023['model']],'as':_0x44023['as'],'attributes':_0x44023[_0xa709('0x1f')],'include':_0x44023[_0xa709('0x20')]?_[_0xa709('0x21')](_0x44023[_0xa709('0x20')],function(_0x1f4166){return{'model':db[_0x1f4166[_0xa709('0x22')]],'as':_0x1f4166['as'],'attributes':_0x1f4166[_0xa709('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa709('0x10')](function(_0xd1e828){logger[_0xa709('0x11')](_0xa709('0x1a'),_0x9b9a87);logger[_0xa709('0x12')](_0xa709('0x1a'),_0x9b9a87,JSON[_0xa709('0x15')](_0xd1e828));_0x19efa9(_0xd1e828);})[_0xa709('0x23')](function(_0x156e32){logger[_0xa709('0x16')](_0xa709('0x1a'),_0x156e32[_0xa709('0x19')],_0x9b9a87);_0x1759ef(_0xb7f282[_0xa709('0x16')](0x1f4,_0x156e32[_0xa709('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 56cf7dd..e63e84f 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(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_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 diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 3c55002..eb7989a 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(_0x57c369,_0xc25822){var _0x1eb9cf=function(_0x2aa201){while(--_0x2aa201){_0x57c369['push'](_0x57c369['shift']());}};_0x1eb9cf(++_0xc25822);}(_0x55ca,0x126));var _0xa55c=function(_0x70fd53,_0x2a95a6){_0x70fd53=_0x70fd53-0x0;var _0x4b71c5=_0x55ca[_0x70fd53];return _0x4b71c5;};'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(_0x149984,_0x51d61d){var _0x8b01ce=function(_0x2c4ca1){while(--_0x2c4ca1){_0x149984['push'](_0x149984['shift']());}};_0x8b01ce(++_0x51d61d);}(_0x34e8,0x12c));var _0x834e=function(_0x452962,_0x458dc7){_0x452962=_0x452962-0x0;var _0x4540e8=_0x34e8[_0x452962];return _0x4540e8;};'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 8db1fcc..9a1e2fa 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 _0x6108=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0xe1d7b9,_0x18b0d9){var _0x2ac5b0=function(_0x2967d6){while(--_0x2967d6){_0xe1d7b9['push'](_0xe1d7b9['shift']());}};_0x2ac5b0(++_0x18b0d9);}(_0x6108,0x12e));var _0x8610=function(_0x16c3b9,_0x17b6e7){_0x16c3b9=_0x16c3b9-0x0;var _0x177e11=_0x6108[_0x16c3b9];return _0x177e11;};'use strict';var Sequelize=require(_0x8610('0x0'));module[_0x8610('0x1')]={'priority':{'type':Sequelize[_0x8610('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8610('0x3')],'allowNull':![],'defaultValue':_0x8610('0x4')},'appdata':{'type':Sequelize[_0x8610('0x5')]()},'description':{'type':Sequelize[_0x8610('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x8610('0x6')}}; \ No newline at end of file +var _0x9465=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0xd7de03,_0x57e8a2){var _0x2aff6b=function(_0x42b68e){while(--_0x42b68e){_0xd7de03['push'](_0xd7de03['shift']());}};_0x2aff6b(++_0x57e8a2);}(_0x9465,0x106));var _0x5946=function(_0x5e8eae,_0x4f81e0){_0x5e8eae=_0x5e8eae-0x0;var _0xdd09cd=_0x9465[_0x5e8eae];return _0xdd09cd;};'use strict';var Sequelize=require(_0x5946('0x0'));module[_0x5946('0x1')]={'priority':{'type':Sequelize[_0x5946('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5946('0x3')},'appdata':{'type':Sequelize[_0x5946('0x4')]()},'description':{'type':Sequelize[_0x5946('0x5')]},'interval':{'type':Sequelize[_0x5946('0x5')],'defaultValue':_0x5946('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index b777598..4e54a81 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 _0x3ec5=['model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','undefined','limit','count','offset','status','Content-Range','apply','save','update','destroy','then','error','stack','name','map','SmsApplication','rawAttributes','fieldName','type','key'];(function(_0x5093e9,_0x5154d0){var _0x4c9a22=function(_0x15176d){while(--_0x15176d){_0x5093e9['push'](_0x5093e9['shift']());}};_0x4c9a22(++_0x5154d0);}(_0x3ec5,0x18c));var _0x53ec=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x3ec5[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x53ec('0x0'));var rimraf=require(_0x53ec('0x1'));var zipdir=require(_0x53ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x53ec('0x3'));var BPromise=require(_0x53ec('0x4'));var Mustache=require(_0x53ec('0x5'));var util=require(_0x53ec('0x6'));var path=require('path');var sox=require(_0x53ec('0x7'));var csv=require(_0x53ec('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x53ec('0x9'));var _=require(_0x53ec('0xa'));var squel=require(_0x53ec('0xb'));var crypto=require(_0x53ec('0xc'));var jsforce=require(_0x53ec('0xd'));var deskjs=require(_0x53ec('0xe'));var toCsv=require(_0x53ec('0x8'));var querystring=require(_0x53ec('0xf'));var Papa=require(_0x53ec('0x10'));var Redis=require(_0x53ec('0x11'));var authService=require(_0x53ec('0x12'));var qs=require(_0x53ec('0x13'));var as=require(_0x53ec('0x14'));var hardwareService=require(_0x53ec('0x15'));var logger=require('../../config/logger')(_0x53ec('0x16'));var utils=require(_0x53ec('0x17'));var config=require(_0x53ec('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x53ec('0x19'))['db'];function respondWithStatusCode(_0x593b39,_0x2c768f){_0x2c768f=_0x2c768f||0xcc;return function(_0x527174){if(_0x527174){return _0x593b39[_0x53ec('0x1a')](_0x2c768f);}return _0x593b39['status'](_0x2c768f)[_0x53ec('0x1b')]();};}function respondWithResult(_0x431410,_0x37dec8){_0x37dec8=_0x37dec8||0xc8;return function(_0x5b553b){if(_0x5b553b){return _0x431410['status'](_0x37dec8)['json'](_0x5b553b);}};}function respondWithFilteredResult(_0x38ca52,_0x37b58b){return function(_0x55f939){if(_0x55f939){var _0x1566c6=typeof _0x37b58b['offset']===_0x53ec('0x1c')&&typeof _0x37b58b[_0x53ec('0x1d')]===_0x53ec('0x1c');var _0x10ee2f=_0x55f939[_0x53ec('0x1e')];var _0x4eea57=_0x1566c6?0x0:_0x37b58b[_0x53ec('0x1f')];var _0x41f728=_0x1566c6?_0x55f939[_0x53ec('0x1e')]:_0x37b58b[_0x53ec('0x1f')]+_0x37b58b[_0x53ec('0x1d')];var _0x5ad6d0;if(_0x41f728>=_0x10ee2f){_0x41f728=_0x10ee2f;_0x5ad6d0=0xc8;}else{_0x5ad6d0=0xce;}_0x38ca52[_0x53ec('0x20')](_0x5ad6d0);return _0x38ca52['set'](_0x53ec('0x21'),_0x4eea57+'-'+_0x41f728+'/'+_0x10ee2f)['json'](_0x55f939);}return null;};}function patchUpdates(_0x418e4c){return function(_0x2afa77){try{jsonpatch[_0x53ec('0x22')](_0x2afa77,_0x418e4c,!![]);}catch(_0x2c8407){return BPromise['reject'](_0x2c8407);}return _0x2afa77[_0x53ec('0x23')]();};}function saveUpdates(_0x59c826,_0x2bc410){return function(_0x453415){if(_0x453415){return _0x453415[_0x53ec('0x24')](_0x59c826)['then'](function(_0x3604c1){return _0x3604c1;});}return null;};}function removeEntity(_0x5d82e7,_0x406b74){return function(_0x444ad3){if(_0x444ad3){return _0x444ad3[_0x53ec('0x25')]()[_0x53ec('0x26')](function(){_0x5d82e7['status'](0xcc)[_0x53ec('0x1b')]();});}};}function handleEntityNotFound(_0x4ee36b,_0x5e146f){return function(_0x1d3eb3){if(!_0x1d3eb3){_0x4ee36b[_0x53ec('0x1a')](0x194);}return _0x1d3eb3;};}function handleError(_0x3e02c9,_0x4efdd8){_0x4efdd8=_0x4efdd8||0x1f4;return function(_0x12fa2b){logger[_0x53ec('0x27')](_0x12fa2b[_0x53ec('0x28')]);if(_0x12fa2b[_0x53ec('0x29')]){delete _0x12fa2b[_0x53ec('0x29')];}_0x3e02c9[_0x53ec('0x20')](_0x4efdd8)['send'](_0x12fa2b);};}exports['index']=function(_0x57904c,_0x16c632){var _0x509c43={},_0x505a1c={},_0x275811={'count':0x0,'rows':[]};var _0x35f33d=_[_0x53ec('0x2a')](db[_0x53ec('0x2b')][_0x53ec('0x2c')],function(_0xd69af1){return{'name':_0xd69af1[_0x53ec('0x2d')],'type':_0xd69af1[_0x53ec('0x2e')][_0x53ec('0x2f')]};});_0x505a1c[_0x53ec('0x30')]=_[_0x53ec('0x2a')](_0x35f33d,_0x53ec('0x29'));_0x505a1c[_0x53ec('0x31')]=_[_0x53ec('0x32')](_0x57904c[_0x53ec('0x31')]);_0x505a1c['filters']=_['intersection'](_0x505a1c['model'],_0x505a1c[_0x53ec('0x31')]);_0x509c43['attributes']=_[_0x53ec('0x33')](_0x505a1c[_0x53ec('0x30')],qs[_0x53ec('0x34')](_0x57904c[_0x53ec('0x31')][_0x53ec('0x34')]));_0x509c43[_0x53ec('0x35')]=_0x509c43[_0x53ec('0x35')][_0x53ec('0x36')]?_0x509c43[_0x53ec('0x35')]:_0x505a1c['model'];if(!_0x57904c[_0x53ec('0x31')][_0x53ec('0x37')](_0x53ec('0x38'))){_0x509c43['limit']=qs['limit'](_0x57904c[_0x53ec('0x31')][_0x53ec('0x1d')]);_0x509c43[_0x53ec('0x1f')]=qs[_0x53ec('0x1f')](_0x57904c[_0x53ec('0x31')][_0x53ec('0x1f')]);}_0x509c43['order']=qs[_0x53ec('0x39')](_0x57904c[_0x53ec('0x31')][_0x53ec('0x39')]);_0x509c43[_0x53ec('0x3a')]=qs[_0x53ec('0x3b')](_[_0x53ec('0x3c')](_0x57904c['query'],_0x505a1c[_0x53ec('0x3b')]),_0x35f33d);if(_0x57904c['query'][_0x53ec('0x3d')]){_0x509c43[_0x53ec('0x3a')]=_['merge'](_0x509c43[_0x53ec('0x3a')],{'$or':_['map'](_0x35f33d,function(_0x302eb1){if(_0x302eb1['type']!=='VIRTUAL'){var _0x282fb2={};_0x282fb2[_0x302eb1[_0x53ec('0x29')]]={'$like':'%'+_0x57904c[_0x53ec('0x31')][_0x53ec('0x3d')]+'%'};return _0x282fb2;}})});}_0x509c43=_[_0x53ec('0x3e')]({},_0x509c43,_0x57904c[_0x53ec('0x3f')]);var _0x27e3aa={'where':_0x509c43[_0x53ec('0x3a')]};return db[_0x53ec('0x2b')]['count'](_0x27e3aa)[_0x53ec('0x26')](function(_0xcfe0b0){_0x275811[_0x53ec('0x1e')]=_0xcfe0b0;if(_0x57904c[_0x53ec('0x31')][_0x53ec('0x40')]){_0x509c43[_0x53ec('0x41')]=[{'all':!![]}];}return db['SmsApplication'][_0x53ec('0x42')](_0x509c43);})[_0x53ec('0x26')](function(_0x5ea354){_0x275811[_0x53ec('0x43')]=_0x5ea354;return _0x275811;})[_0x53ec('0x26')](respondWithFilteredResult(_0x16c632,_0x509c43))[_0x53ec('0x44')](handleError(_0x16c632,null));};exports[_0x53ec('0x45')]=function(_0x11ff23,_0x1299c1){var _0x364ec0={'raw':!![],'where':{'id':_0x11ff23['params']['id']}},_0x36e5a3={};_0x36e5a3['model']=_[_0x53ec('0x32')](db['SmsApplication']['rawAttributes']);_0x36e5a3[_0x53ec('0x31')]=_['keys'](_0x11ff23[_0x53ec('0x31')]);_0x36e5a3['filters']=_[_0x53ec('0x33')](_0x36e5a3[_0x53ec('0x30')],_0x36e5a3[_0x53ec('0x31')]);_0x364ec0['attributes']=_[_0x53ec('0x33')](_0x36e5a3[_0x53ec('0x30')],qs['fields'](_0x11ff23[_0x53ec('0x31')]['fields']));_0x364ec0[_0x53ec('0x35')]=_0x364ec0[_0x53ec('0x35')]['length']?_0x364ec0[_0x53ec('0x35')]:_0x36e5a3[_0x53ec('0x30')];if(_0x11ff23[_0x53ec('0x31')]['includeAll']){_0x364ec0[_0x53ec('0x41')]=[{'all':!![]}];}_0x364ec0=_['merge']({},_0x364ec0,_0x11ff23[_0x53ec('0x3f')]);return db[_0x53ec('0x2b')][_0x53ec('0x46')](_0x364ec0)[_0x53ec('0x26')](handleEntityNotFound(_0x1299c1,null))[_0x53ec('0x26')](respondWithResult(_0x1299c1,null))['catch'](handleError(_0x1299c1,null));};exports[_0x53ec('0x47')]=function(_0x493768,_0xa6e6cd){return db['SmsApplication'][_0x53ec('0x47')](_0x493768[_0x53ec('0x48')],{})[_0x53ec('0x26')](respondWithResult(_0xa6e6cd,0xc9))['catch'](handleError(_0xa6e6cd,null));};exports['update']=function(_0x4778c4,_0x3613a7){if(_0x4778c4[_0x53ec('0x48')]['id']){delete _0x4778c4[_0x53ec('0x48')]['id'];}return db['SmsApplication'][_0x53ec('0x46')]({'where':{'id':_0x4778c4[_0x53ec('0x49')]['id']}})[_0x53ec('0x26')](handleEntityNotFound(_0x3613a7,null))['then'](saveUpdates(_0x4778c4['body'],null))[_0x53ec('0x26')](respondWithResult(_0x3613a7,null))[_0x53ec('0x44')](handleError(_0x3613a7,null));};exports[_0x53ec('0x25')]=function(_0x41bf78,_0x44e2c4){return db[_0x53ec('0x2b')][_0x53ec('0x46')]({'where':{'id':_0x41bf78[_0x53ec('0x49')]['id']}})['then'](handleEntityNotFound(_0x44e2c4,null))[_0x53ec('0x26')](removeEntity(_0x44e2c4,null))[_0x53ec('0x44')](handleError(_0x44e2c4,null));}; \ No newline at end of file +var _0xbc8b=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','show','params','includeAll','find','catch','create','body','rimraf','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsApplication','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields'];(function(_0x16946d,_0x35eeaa){var _0x53c8f4=function(_0x4677e4){while(--_0x4677e4){_0x16946d['push'](_0x16946d['shift']());}};_0x53c8f4(++_0x35eeaa);}(_0xbc8b,0x1a4));var _0xbbc8=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xbc8b[_0x1e7b16];return _0x37fadc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbbc8('0x0'));var zipdir=require(_0xbbc8('0x1'));var jsonpatch=require(_0xbbc8('0x2'));var rp=require(_0xbbc8('0x3'));var moment=require(_0xbbc8('0x4'));var BPromise=require(_0xbbc8('0x5'));var Mustache=require(_0xbbc8('0x6'));var util=require(_0xbbc8('0x7'));var path=require(_0xbbc8('0x8'));var sox=require(_0xbbc8('0x9'));var csv=require(_0xbbc8('0xa'));var ejs=require(_0xbbc8('0xb'));var fs=require('fs');var fs_extra=require(_0xbbc8('0xc'));var _=require(_0xbbc8('0xd'));var squel=require(_0xbbc8('0xe'));var crypto=require('crypto');var jsforce=require(_0xbbc8('0xf'));var deskjs=require(_0xbbc8('0x10'));var toCsv=require(_0xbbc8('0xa'));var querystring=require(_0xbbc8('0x11'));var Papa=require(_0xbbc8('0x12'));var Redis=require(_0xbbc8('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xbbc8('0x14'));var as=require(_0xbbc8('0x15'));var hardwareService=require(_0xbbc8('0x16'));var logger=require(_0xbbc8('0x17'))(_0xbbc8('0x18'));var utils=require(_0xbbc8('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xbbc8('0x1a'));var db=require(_0xbbc8('0x1b'))['db'];function respondWithStatusCode(_0x7fdc28,_0x2b1bb4){_0x2b1bb4=_0x2b1bb4||0xcc;return function(_0x7765ab){if(_0x7765ab){return _0x7fdc28[_0xbbc8('0x1c')](_0x2b1bb4);}return _0x7fdc28['status'](_0x2b1bb4)[_0xbbc8('0x1d')]();};}function respondWithResult(_0x4c5b02,_0xf25f0b){_0xf25f0b=_0xf25f0b||0xc8;return function(_0x2b61fc){if(_0x2b61fc){return _0x4c5b02['status'](_0xf25f0b)[_0xbbc8('0x1e')](_0x2b61fc);}};}function respondWithFilteredResult(_0x5cd49b,_0x4109a7){return function(_0x11a360){if(_0x11a360){var _0x3b772e=typeof _0x4109a7[_0xbbc8('0x1f')]===_0xbbc8('0x20')&&typeof _0x4109a7[_0xbbc8('0x21')]===_0xbbc8('0x20');var _0x4f4daf=_0x11a360[_0xbbc8('0x22')];var _0x3c46a7=_0x3b772e?0x0:_0x4109a7[_0xbbc8('0x1f')];var _0x213261=_0x3b772e?_0x11a360['count']:_0x4109a7[_0xbbc8('0x1f')]+_0x4109a7['limit'];var _0x4e148c;if(_0x213261>=_0x4f4daf){_0x213261=_0x4f4daf;_0x4e148c=0xc8;}else{_0x4e148c=0xce;}_0x5cd49b[_0xbbc8('0x23')](_0x4e148c);return _0x5cd49b[_0xbbc8('0x24')](_0xbbc8('0x25'),_0x3c46a7+'-'+_0x213261+'/'+_0x4f4daf)['json'](_0x11a360);}return null;};}function patchUpdates(_0x532b2d){return function(_0x16c2e7){try{jsonpatch[_0xbbc8('0x26')](_0x16c2e7,_0x532b2d,!![]);}catch(_0x3002ee){return BPromise[_0xbbc8('0x27')](_0x3002ee);}return _0x16c2e7[_0xbbc8('0x28')]();};}function saveUpdates(_0x11b36c,_0x3819a8){return function(_0x8f90a1){if(_0x8f90a1){return _0x8f90a1[_0xbbc8('0x29')](_0x11b36c)[_0xbbc8('0x2a')](function(_0x57fb46){return _0x57fb46;});}return null;};}function removeEntity(_0x192b78,_0x9a1e4c){return function(_0x32cfee){if(_0x32cfee){return _0x32cfee[_0xbbc8('0x2b')]()['then'](function(){_0x192b78[_0xbbc8('0x23')](0xcc)[_0xbbc8('0x1d')]();});}};}function handleEntityNotFound(_0x501d51,_0x4cd90e){return function(_0x2138d0){if(!_0x2138d0){_0x501d51[_0xbbc8('0x1c')](0x194);}return _0x2138d0;};}function handleError(_0x1886d5,_0xa4ba89){_0xa4ba89=_0xa4ba89||0x1f4;return function(_0xe4e24c){logger[_0xbbc8('0x2c')](_0xe4e24c[_0xbbc8('0x2d')]);if(_0xe4e24c[_0xbbc8('0x2e')]){delete _0xe4e24c['name'];}_0x1886d5['status'](_0xa4ba89)[_0xbbc8('0x2f')](_0xe4e24c);};}exports[_0xbbc8('0x30')]=function(_0x26b6b5,_0x37566c){var _0x6a10f9={},_0x4dc933={},_0x2402f6={'count':0x0,'rows':[]};var _0x35a5c9=_[_0xbbc8('0x31')](db[_0xbbc8('0x32')][_0xbbc8('0x33')],function(_0x468964){return{'name':_0x468964['fieldName'],'type':_0x468964[_0xbbc8('0x34')]['key']};});_0x4dc933[_0xbbc8('0x35')]=_[_0xbbc8('0x31')](_0x35a5c9,_0xbbc8('0x2e'));_0x4dc933['query']=_[_0xbbc8('0x36')](_0x26b6b5[_0xbbc8('0x37')]);_0x4dc933[_0xbbc8('0x38')]=_[_0xbbc8('0x39')](_0x4dc933[_0xbbc8('0x35')],_0x4dc933['query']);_0x6a10f9[_0xbbc8('0x3a')]=_[_0xbbc8('0x39')](_0x4dc933[_0xbbc8('0x35')],qs[_0xbbc8('0x3b')](_0x26b6b5[_0xbbc8('0x37')]['fields']));_0x6a10f9[_0xbbc8('0x3a')]=_0x6a10f9[_0xbbc8('0x3a')][_0xbbc8('0x3c')]?_0x6a10f9[_0xbbc8('0x3a')]:_0x4dc933[_0xbbc8('0x35')];if(!_0x26b6b5[_0xbbc8('0x37')][_0xbbc8('0x3d')](_0xbbc8('0x3e'))){_0x6a10f9[_0xbbc8('0x21')]=qs[_0xbbc8('0x21')](_0x26b6b5[_0xbbc8('0x37')][_0xbbc8('0x21')]);_0x6a10f9[_0xbbc8('0x1f')]=qs[_0xbbc8('0x1f')](_0x26b6b5['query'][_0xbbc8('0x1f')]);}_0x6a10f9[_0xbbc8('0x3f')]=qs[_0xbbc8('0x40')](_0x26b6b5[_0xbbc8('0x37')][_0xbbc8('0x40')]);_0x6a10f9[_0xbbc8('0x41')]=qs[_0xbbc8('0x38')](_[_0xbbc8('0x42')](_0x26b6b5['query'],_0x4dc933[_0xbbc8('0x38')]),_0x35a5c9);if(_0x26b6b5[_0xbbc8('0x37')][_0xbbc8('0x43')]){_0x6a10f9[_0xbbc8('0x41')]=_['merge'](_0x6a10f9['where'],{'$or':_[_0xbbc8('0x31')](_0x35a5c9,function(_0x4a84be){if(_0x4a84be[_0xbbc8('0x34')]!==_0xbbc8('0x44')){var _0x28ee5b={};_0x28ee5b[_0x4a84be['name']]={'$like':'%'+_0x26b6b5[_0xbbc8('0x37')]['filter']+'%'};return _0x28ee5b;}})});}_0x6a10f9=_[_0xbbc8('0x45')]({},_0x6a10f9,_0x26b6b5['options']);var _0x9bf38f={'where':_0x6a10f9[_0xbbc8('0x41')]};return db[_0xbbc8('0x32')][_0xbbc8('0x22')](_0x9bf38f)[_0xbbc8('0x2a')](function(_0x233a0a){_0x2402f6['count']=_0x233a0a;if(_0x26b6b5[_0xbbc8('0x37')]['includeAll']){_0x6a10f9[_0xbbc8('0x46')]=[{'all':!![]}];}return db[_0xbbc8('0x32')][_0xbbc8('0x47')](_0x6a10f9);})['then'](function(_0xabdd7b){_0x2402f6[_0xbbc8('0x48')]=_0xabdd7b;return _0x2402f6;})['then'](respondWithFilteredResult(_0x37566c,_0x6a10f9))['catch'](handleError(_0x37566c,null));};exports[_0xbbc8('0x49')]=function(_0x5a43a7,_0x191dad){var _0x44ee33={'raw':!![],'where':{'id':_0x5a43a7[_0xbbc8('0x4a')]['id']}},_0x13b353={};_0x13b353['model']=_[_0xbbc8('0x36')](db[_0xbbc8('0x32')]['rawAttributes']);_0x13b353['query']=_[_0xbbc8('0x36')](_0x5a43a7[_0xbbc8('0x37')]);_0x13b353['filters']=_['intersection'](_0x13b353[_0xbbc8('0x35')],_0x13b353[_0xbbc8('0x37')]);_0x44ee33[_0xbbc8('0x3a')]=_[_0xbbc8('0x39')](_0x13b353[_0xbbc8('0x35')],qs['fields'](_0x5a43a7[_0xbbc8('0x37')][_0xbbc8('0x3b')]));_0x44ee33[_0xbbc8('0x3a')]=_0x44ee33[_0xbbc8('0x3a')]['length']?_0x44ee33['attributes']:_0x13b353[_0xbbc8('0x35')];if(_0x5a43a7[_0xbbc8('0x37')][_0xbbc8('0x4b')]){_0x44ee33['include']=[{'all':!![]}];}_0x44ee33=_[_0xbbc8('0x45')]({},_0x44ee33,_0x5a43a7['options']);return db[_0xbbc8('0x32')][_0xbbc8('0x4c')](_0x44ee33)[_0xbbc8('0x2a')](handleEntityNotFound(_0x191dad,null))[_0xbbc8('0x2a')](respondWithResult(_0x191dad,null))[_0xbbc8('0x4d')](handleError(_0x191dad,null));};exports[_0xbbc8('0x4e')]=function(_0xaf1dde,_0xddde6e){return db[_0xbbc8('0x32')][_0xbbc8('0x4e')](_0xaf1dde['body'],{})['then'](respondWithResult(_0xddde6e,0xc9))[_0xbbc8('0x4d')](handleError(_0xddde6e,null));};exports[_0xbbc8('0x29')]=function(_0x350e89,_0x4098dd){if(_0x350e89[_0xbbc8('0x4f')]['id']){delete _0x350e89[_0xbbc8('0x4f')]['id'];}return db[_0xbbc8('0x32')]['find']({'where':{'id':_0x350e89['params']['id']}})['then'](handleEntityNotFound(_0x4098dd,null))[_0xbbc8('0x2a')](saveUpdates(_0x350e89[_0xbbc8('0x4f')],null))['then'](respondWithResult(_0x4098dd,null))['catch'](handleError(_0x4098dd,null));};exports['destroy']=function(_0x3bfc9f,_0x5109b9){return db[_0xbbc8('0x32')][_0xbbc8('0x4c')]({'where':{'id':_0x3bfc9f['params']['id']}})[_0xbbc8('0x2a')](handleEntityNotFound(_0x5109b9,null))[_0xbbc8('0x2a')](removeEntity(_0x5109b9,null))[_0xbbc8('0x4d')](handleError(_0x5109b9,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index ffa04e7..e86d19e 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 _0xaba8=['utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./smsApplication.attributes','exports'];(function(_0x163ad0,_0x642af0){var _0x538254=function(_0x28bb30){while(--_0x28bb30){_0x163ad0['push'](_0x163ad0['shift']());}};_0x538254(++_0x642af0);}(_0xaba8,0x8d));var _0x8aba=function(_0x469f4d,_0x40c891){_0x469f4d=_0x469f4d-0x0;var _0x5b96c2=_0xaba8[_0x469f4d];return _0x5b96c2;};'use strict';var _=require(_0x8aba('0x0'));var util=require(_0x8aba('0x1'));var logger=require(_0x8aba('0x2'))(_0x8aba('0x3'));var moment=require(_0x8aba('0x4'));var BPromise=require('bluebird');var rp=require(_0x8aba('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8aba('0x6'));var config=require('../../config/environment');var attributes=require(_0x8aba('0x7'));module[_0x8aba('0x8')]=function(_0x242b74,_0x3b3087){return _0x242b74['define']('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8aba('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb5b5=['exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5b34c0,_0x3ad403){var _0x242bd3=function(_0x51d0ce){while(--_0x51d0ce){_0x5b34c0['push'](_0x5b34c0['shift']());}};_0x242bd3(++_0x3ad403);}(_0xb5b5,0x149));var _0x5b5b=function(_0x5d8018,_0x588592){_0x5d8018=_0x5d8018-0x0;var _0x151ac4=_0xb5b5[_0x5d8018];return _0x151ac4;};'use strict';var _=require(_0x5b5b('0x0'));var util=require(_0x5b5b('0x1'));var logger=require(_0x5b5b('0x2'))(_0x5b5b('0x3'));var moment=require(_0x5b5b('0x4'));var BPromise=require(_0x5b5b('0x5'));var rp=require(_0x5b5b('0x6'));var fs=require('fs');var path=require(_0x5b5b('0x7'));var rimraf=require(_0x5b5b('0x8'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0x5b5b('0x9')]=function(_0x36a252,_0x38b08a){return _0x36a252[_0x5b5b('0xa')]('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5b5b('0xb'),'collate':_0x5b5b('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index c48f944..946c691 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 _0xe1c4=['http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','client'];(function(_0x42a6bb,_0x42c70f){var _0x1885af=function(_0x2a3700){while(--_0x2a3700){_0x42a6bb['push'](_0x42a6bb['shift']());}};_0x1885af(++_0x42c70f);}(_0xe1c4,0x1ec));var _0x4e1c=function(_0x596e72,_0x39d3fb){_0x596e72=_0x596e72-0x0;var _0x40f797=_0xe1c4[_0x596e72];return _0x40f797;};'use strict';var _=require(_0x4e1c('0x0'));var util=require(_0x4e1c('0x1'));var moment=require(_0x4e1c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4e1c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e1c('0x4'));var logger=require(_0x4e1c('0x5'))(_0x4e1c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4e1c('0x7')][_0x4e1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44db21,_0x1c7e52,_0x460295){return new BPromise(function(_0x108830,_0x2622b4){return client[_0x4e1c('0x9')](_0x44db21,_0x460295)[_0x4e1c('0xa')](function(_0x60e98c){logger[_0x4e1c('0xb')](_0x4e1c('0xc'),_0x1c7e52,_0x4e1c('0xd'));logger['debug'](_0x4e1c('0xe'),_0x1c7e52,_0x4e1c('0xd'),JSON['stringify'](_0x60e98c));if(_0x60e98c[_0x4e1c('0xf')]){if(_0x60e98c[_0x4e1c('0xf')][_0x4e1c('0x10')]===0x1f4){logger[_0x4e1c('0xf')]('SmsApplication,\x20%s,\x20%s',_0x1c7e52,_0x60e98c[_0x4e1c('0xf')][_0x4e1c('0x11')]);return _0x2622b4(_0x60e98c[_0x4e1c('0xf')][_0x4e1c('0x11')]);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x1c7e52,_0x60e98c['error'][_0x4e1c('0x11')]);return _0x108830(_0x60e98c[_0x4e1c('0xf')][_0x4e1c('0x11')]);}else{logger[_0x4e1c('0xb')]('SmsApplication,\x20%s,\x20%s',_0x1c7e52,_0x4e1c('0xd'));_0x108830(_0x60e98c[_0x4e1c('0x12')][_0x4e1c('0x11')]);}})[_0x4e1c('0x13')](function(_0x44a842){logger[_0x4e1c('0xf')]('SmsApplication,\x20%s,\x20%s',_0x1c7e52,_0x44a842);_0x2622b4(_0x44a842);});});} \ No newline at end of file +var _0x57b7=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsApplication,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x57b7,0x160));var _0x757b=function(_0x35c40b,_0x2a7a8b){_0x35c40b=_0x35c40b-0x0;var _0x5cda1c=_0x57b7[_0x35c40b];return _0x5cda1c;};'use strict';var _=require(_0x757b('0x0'));var util=require(_0x757b('0x1'));var moment=require(_0x757b('0x2'));var BPromise=require(_0x757b('0x3'));var rs=require(_0x757b('0x4'));var fs=require('fs');var Redis=require(_0x757b('0x5'));var db=require(_0x757b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x757b('0x7'))(_0x757b('0x8'));var config=require(_0x757b('0x9'));var jayson=require(_0x757b('0xa'));var client=jayson['client'][_0x757b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8528c7,_0x36c83c,_0x224503){return new BPromise(function(_0x18b130,_0x1845cf){return client[_0x757b('0xc')](_0x8528c7,_0x224503)[_0x757b('0xd')](function(_0x53a1ce){logger[_0x757b('0xe')](_0x757b('0xf'),_0x36c83c,'request\x20sent');logger[_0x757b('0x10')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x36c83c,_0x757b('0x11'),JSON['stringify'](_0x53a1ce));if(_0x53a1ce[_0x757b('0x12')]){if(_0x53a1ce[_0x757b('0x12')]['code']===0x1f4){logger[_0x757b('0x12')](_0x757b('0xf'),_0x36c83c,_0x53a1ce['error'][_0x757b('0x13')]);return _0x1845cf(_0x53a1ce['error'][_0x757b('0x13')]);}logger[_0x757b('0x12')]('SmsApplication,\x20%s,\x20%s',_0x36c83c,_0x53a1ce[_0x757b('0x12')]['message']);return _0x18b130(_0x53a1ce[_0x757b('0x12')][_0x757b('0x13')]);}else{logger[_0x757b('0xe')]('SmsApplication,\x20%s,\x20%s',_0x36c83c,_0x757b('0x11'));_0x18b130(_0x53a1ce[_0x757b('0x14')]['message']);}})[_0x757b('0x15')](function(_0x493286){logger['error'](_0x757b('0xf'),_0x36c83c,_0x493286);_0x1845cf(_0x493286);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 262c12b..53310dd 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 _0xb03e=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags'];(function(_0x38ed44,_0x23c2c4){var _0x7712a3=function(_0x1fd531){while(--_0x1fd531){_0x38ed44['push'](_0x38ed44['shift']());}};_0x7712a3(++_0x23c2c4);}(_0xb03e,0x1eb));var _0xeb03=function(_0x3b5cd1,_0x234b7a){_0x3b5cd1=_0x3b5cd1-0x0;var _0x2f8d39=_0xb03e[_0x3b5cd1];return _0x2f8d39;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var fs_extra=require(_0xeb03('0x5'));var auth=require(_0xeb03('0x6'));var interaction=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var controller=require(_0xeb03('0x9'));router[_0xeb03('0xa')]('/',auth[_0xeb03('0xb')](),controller['index']);router[_0xeb03('0xa')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller[_0xeb03('0xd')]);router[_0xeb03('0xa')](_0xeb03('0xe'),auth['isAuthenticated'](),controller[_0xeb03('0xf')]);router[_0xeb03('0xa')](_0xeb03('0x10'),auth['isAuthenticated'](),controller[_0xeb03('0x11')]);router['get'](_0xeb03('0x12'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x13')]);router[_0xeb03('0x14')]('/',auth[_0xeb03('0xb')](),controller[_0xeb03('0x15')]);router[_0xeb03('0x14')](_0xeb03('0x10'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x16')]);router[_0xeb03('0x14')](_0xeb03('0x17'),auth['isAuthenticated'](),interaction[_0xeb03('0x18')](_0xeb03('0x19'),_0xeb03('0x1a')),controller[_0xeb03('0x1b')]);router['put'](_0xeb03('0xe'),auth[_0xeb03('0xb')](),interaction[_0xeb03('0x18')]('sms',_0xeb03('0x1c')),controller[_0xeb03('0x1d')]);router[_0xeb03('0x1e')](_0xeb03('0xe'),auth[_0xeb03('0xb')](),interaction[_0xeb03('0x18')](_0xeb03('0x19'),_0xeb03('0x1f')),controller[_0xeb03('0x20')]);router[_0xeb03('0x1e')](_0xeb03('0x17'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x21')]);module[_0xeb03('0x22')]=router; \ No newline at end of file +var _0x13f6=['isAuthenticated','index','get','/:id','show','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','update','delete','smsinteraction:destroy','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller'];(function(_0x2a6f37,_0xeba479){var _0x790d87=function(_0x326e85){while(--_0x326e85){_0x2a6f37['push'](_0x2a6f37['shift']());}};_0x790d87(++_0xeba479);}(_0x13f6,0x124));var _0x613f=function(_0x334f3b,_0x41b8ee){_0x334f3b=_0x334f3b-0x0;var _0x5b792e=_0x13f6[_0x334f3b];return _0x5b792e;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var fs_extra=require(_0x613f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x613f('0x5'));var config=require(_0x613f('0x6'));var controller=require(_0x613f('0x7'));router['get']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x613f('0xa')](_0x613f('0xb'),auth[_0x613f('0x8')](),controller[_0x613f('0xc')]);router['get'](_0x613f('0xd'),auth[_0x613f('0x8')](),controller[_0x613f('0xe')]);router['get'](_0x613f('0xf'),auth[_0x613f('0x8')](),controller[_0x613f('0x10')]);router['post']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x11')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0x613f('0x12')]);router[_0x613f('0x13')](_0x613f('0x14'),auth[_0x613f('0x8')](),interaction[_0x613f('0x15')](_0x613f('0x16'),_0x613f('0x17')),controller[_0x613f('0x18')]);router[_0x613f('0x19')](_0x613f('0xb'),auth['isAuthenticated'](),interaction[_0x613f('0x15')]('sms','smsinteraction:update'),controller[_0x613f('0x1a')]);router[_0x613f('0x1b')]('/:id',auth[_0x613f('0x8')](),interaction['tracked'](_0x613f('0x16'),_0x613f('0x1c')),controller[_0x613f('0x1d')]);router[_0x613f('0x1b')](_0x613f('0x14'),auth[_0x613f('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 063db8e..f241e8f 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 _0x8375=['sequelize','moment','exports','DATE','STRING','ENUM','out'];(function(_0x2587f9,_0xa90257){var _0x10dc8b=function(_0x3023cf){while(--_0x3023cf){_0x2587f9['push'](_0x2587f9['shift']());}};_0x10dc8b(++_0xa90257);}(_0x8375,0xa8));var _0x5837=function(_0x1bc43c,_0x203b41){_0x1bc43c=_0x1bc43c-0x0;var _0x343b4d=_0x8375[_0x1bc43c];return _0x343b4d;};'use strict';var Sequelize=require(_0x5837('0x0'));var moment=require(_0x5837('0x1'));module[_0x5837('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5837('0x3')]},'disposition':{'type':Sequelize[_0x5837('0x4')]},'secondDisposition':{'type':Sequelize[_0x5837('0x4')]},'thirdDisposition':{'type':Sequelize[_0x5837('0x4')]},'note':{'type':Sequelize[_0x5837('0x4')]},'phone':{'type':Sequelize[_0x5837('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x5837('0x5')]('in',_0x5837('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5837('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x5837('0x5')]('in',_0x5837('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0fcd=['DATE','STRING','ENUM','moment','exports','BOOLEAN'];(function(_0x2ff775,_0x35bf17){var _0x4785b1=function(_0x3a6a3b){while(--_0x3a6a3b){_0x2ff775['push'](_0x2ff775['shift']());}};_0x4785b1(++_0x35bf17);}(_0x0fcd,0x129));var _0xd0fc=function(_0x513186,_0x2519c1){_0x513186=_0x513186-0x0;var _0x5857c7=_0x0fcd[_0x513186];return _0x5857c7;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd0fc('0x0'));module[_0xd0fc('0x1')]={'closed':{'type':Sequelize[_0xd0fc('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd0fc('0x3')]},'disposition':{'type':Sequelize[_0xd0fc('0x4')]},'secondDisposition':{'type':Sequelize[_0xd0fc('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd0fc('0x4')]},'phone':{'type':Sequelize[_0xd0fc('0x4')]},'read1stAt':{'type':Sequelize[_0xd0fc('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xd0fc('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd0fc('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xd0fc('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 739088e..40ab033 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 _0x1295=['$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','join','root','server','files','tmp','format','transcript-%d-%s.zip','User','fullname','push','CmContact','firstName','lastName','direction','read','SmsAccount','Owner','get','mkdirSync','Account','N.A.','createdAt','disposition','Messages','toString','out','System','Contact','secret','value','views','transcript-','.pdf','Sms','log','unlinkSync','rimraf','moment','bluebird','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','then','name','send','index','map','SmsInteraction','fieldName','type','key','getOptions','findAll','query','user','catch','show','params','rawAttributes','keys','filters','intersection','attributes','model','fields','length','includeAll','include','merge','options','find','body','describe','addMessage','SmsMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0xdbb378,_0x2dc54e){var _0x5c39d7=function(_0x737247){while(--_0x737247){_0xdbb378['push'](_0xdbb378['shift']());}};_0x5c39d7(++_0x2dc54e);}(_0x1295,0x123));var _0x5129=function(_0x456ab2,_0x2423c1){_0x456ab2=_0x456ab2-0x0;var _0x5c29f4=_0x1295[_0x456ab2];return _0x5c29f4;};'use strict';var rimraf=require(_0x5129('0x0'));var zipdir=require('zip-dir');var moment=require(_0x5129('0x1'));var BPromise=require(_0x5129('0x2'));var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5129('0x3'));var Redis=require(_0x5129('0x4'));var interaction=require('../../components/interaction/service');var qs=require(_0x5129('0x5'));var pdf=require(_0x5129('0x6'));var logger=require(_0x5129('0x7'))(_0x5129('0x8'));var config=require(_0x5129('0x9'));var db=require(_0x5129('0xa'))['db'];config[_0x5129('0xb')]=_['defaults'](config[_0x5129('0xb')],{'host':_0x5129('0xc'),'port':0x18eb});var socket=require(_0x5129('0xd'))(new Redis(config[_0x5129('0xb')]));require(_0x5129('0xe'))[_0x5129('0xf')](socket);function respondWithStatusCode(_0x3a9218,_0x47900b){_0x47900b=_0x47900b||0xcc;return function(_0x37bd72){if(_0x37bd72){return _0x3a9218[_0x5129('0x10')](_0x47900b);}return _0x3a9218[_0x5129('0x11')](_0x47900b)[_0x5129('0x12')]();};}function respondWithResult(_0x3df29a,_0x1b0ee6){_0x1b0ee6=_0x1b0ee6||0xc8;return function(_0x227758){if(_0x227758){return _0x3df29a['status'](_0x1b0ee6)[_0x5129('0x13')](_0x227758);}};}function respondWithFilteredResult(_0x2072ea,_0x5d7462){return function(_0x4e8357){if(_0x4e8357){var _0x5a7edb=typeof _0x5d7462[_0x5129('0x14')]===_0x5129('0x15')&&typeof _0x5d7462['limit']===_0x5129('0x15');var _0x176806=_0x4e8357[_0x5129('0x16')];var _0x5f2651=_0x5a7edb?0x0:_0x5d7462[_0x5129('0x14')];var _0x43419b=_0x5a7edb?_0x4e8357[_0x5129('0x16')]:_0x5d7462['offset']+_0x5d7462[_0x5129('0x17')];var _0x5ba733;if(_0x43419b>=_0x176806){_0x43419b=_0x176806;_0x5ba733=0xc8;}else{_0x5ba733=0xce;}_0x2072ea['status'](_0x5ba733);return _0x2072ea[_0x5129('0x18')](_0x5129('0x19'),_0x5f2651+'-'+_0x43419b+'/'+_0x176806)[_0x5129('0x13')](_0x4e8357);}return null;};}function saveUpdates(_0x33020a){return function(_0x5083d5){if(_0x5083d5){return _0x5083d5[_0x5129('0x1a')](_0x33020a)['then'](function(_0x29f8e6){return _0x29f8e6;});}return null;};}function removeEntity(_0x2da468){return function(_0x339914){if(_0x339914){return _0x339914[_0x5129('0x1b')]()[_0x5129('0x1c')](function(){_0x2da468['status'](0xcc)[_0x5129('0x12')]();});}};}function handleEntityNotFound(_0x56f45d){return function(_0x4e650f){if(!_0x4e650f){_0x56f45d[_0x5129('0x10')](0x194);}return _0x4e650f;};}function handleError(_0x5de329,_0x338c68){_0x338c68=_0x338c68||0x1f4;return function(_0x55b2d5){logger['error'](_0x55b2d5['stack']);if(_0x55b2d5[_0x5129('0x1d')]){delete _0x55b2d5['name'];}_0x5de329['status'](_0x338c68)[_0x5129('0x1e')](_0x55b2d5);};}exports[_0x5129('0x1f')]=function(_0x537384,_0x113841){var _0xd47869={};var _0x3c9a59=_[_0x5129('0x20')](db[_0x5129('0x21')]['rawAttributes'],function(_0x5817d8){return{'name':_0x5817d8[_0x5129('0x22')],'type':_0x5817d8[_0x5129('0x23')][_0x5129('0x24')]};});_0xd47869=qs[_0x5129('0x25')](_0x3c9a59,_0x537384);return interaction[_0x5129('0x26')]('sms',_0x537384[_0x5129('0x27')],_0x537384[_0x5129('0x28')],_0xd47869,_0x3c9a59)['then'](respondWithFilteredResult(_0x113841,_0xd47869))[_0x5129('0x29')](handleError(_0x113841,null));};exports[_0x5129('0x2a')]=function(_0x467ac0,_0x4ec7ed){var _0x17b305={'raw':![],'where':{'id':_0x467ac0[_0x5129('0x2b')]['id']}},_0x427562={};_0x427562['model']=_['keys'](db[_0x5129('0x21')][_0x5129('0x2c')]);_0x427562['query']=_[_0x5129('0x2d')](_0x467ac0[_0x5129('0x27')]);_0x427562[_0x5129('0x2e')]=_[_0x5129('0x2f')](_0x427562['model'],_0x427562[_0x5129('0x27')]);_0x17b305[_0x5129('0x30')]=_[_0x5129('0x2f')](_0x427562[_0x5129('0x31')],qs[_0x5129('0x32')](_0x467ac0['query'][_0x5129('0x32')]));_0x17b305[_0x5129('0x30')]=_0x17b305[_0x5129('0x30')][_0x5129('0x33')]?_0x17b305[_0x5129('0x30')]:_0x427562[_0x5129('0x31')];if(_0x467ac0[_0x5129('0x27')][_0x5129('0x34')]){_0x17b305[_0x5129('0x35')]=[{'all':!![]}];}_0x17b305=_[_0x5129('0x36')]({},_0x17b305,_0x467ac0[_0x5129('0x37')]);return db[_0x5129('0x21')][_0x5129('0x38')](_0x17b305)['then'](handleEntityNotFound(_0x4ec7ed,null))['then'](respondWithResult(_0x4ec7ed,null))['catch'](handleError(_0x4ec7ed,null));};exports['create']=function(_0x27eb44,_0x446b27){return db[_0x5129('0x21')]['create'](_0x27eb44['body'],{})['then'](respondWithResult(_0x446b27,0xc9))[_0x5129('0x29')](handleError(_0x446b27,null));};exports[_0x5129('0x1a')]=function(_0x2259bf,_0xf9212b){if(_0x2259bf[_0x5129('0x39')]['id']){delete _0x2259bf[_0x5129('0x39')]['id'];}return db[_0x5129('0x21')]['find']({'where':{'id':_0x2259bf[_0x5129('0x2b')]['id']}})[_0x5129('0x1c')](handleEntityNotFound(_0xf9212b,null))[_0x5129('0x1c')](saveUpdates(_0x2259bf['body'],null))[_0x5129('0x1c')](respondWithResult(_0xf9212b,null))['catch'](handleError(_0xf9212b,null));};exports['destroy']=function(_0x42afc1,_0x4f74ef){return db[_0x5129('0x21')]['find']({'where':{'id':_0x42afc1['params']['id']}})[_0x5129('0x1c')](handleEntityNotFound(_0x4f74ef,null))[_0x5129('0x1c')](removeEntity(_0x4f74ef,null))[_0x5129('0x29')](handleError(_0x4f74ef,null));};exports[_0x5129('0x3a')]=function(_0x3e48fd,_0x19d5eb){return db['SmsInteraction'][_0x5129('0x3a')]()[_0x5129('0x1c')](respondWithResult(_0x19d5eb,null))[_0x5129('0x29')](handleError(_0x19d5eb,null));};exports[_0x5129('0x3b')]=function(_0x7def2d,_0x301779){return db[_0x5129('0x3c')][_0x5129('0x38')]({'where':{'id':_0x7def2d['params']['id']}})[_0x5129('0x1c')](handleEntityNotFound(_0x301779,null))[_0x5129('0x1c')](function(_0xd965b7){if(_0xd965b7){return _0xd965b7['addMessage'](_0x7def2d[_0x5129('0x39')]['ids'],_[_0x5129('0x3d')](_0x7def2d[_0x5129('0x39')],[_0x5129('0x3e'),'id'])||{});}})['then'](respondWithResult(_0x301779,null))[_0x5129('0x29')](handleError(_0x301779,null));};exports[_0x5129('0x3f')]=function(_0x450417,_0x5bda95){var _0x19ccda={'raw':![],'where':{}};var _0x12118d={};var _0x1cd235={'count':0x0,'rows':[]};return db[_0x5129('0x21')][_0x5129('0x40')]({'where':{'id':_0x450417[_0x5129('0x2b')]['id']}})[_0x5129('0x1c')](handleEntityNotFound(_0x5bda95,null))[_0x5129('0x1c')](function(_0x2db847){if(_0x2db847){_0x12118d[_0x5129('0x31')]=_['keys'](db['SmsMessage'][_0x5129('0x2c')]);_0x12118d[_0x5129('0x27')]=_[_0x5129('0x2d')](_0x450417[_0x5129('0x27')]);_0x12118d[_0x5129('0x2e')]=_[_0x5129('0x2f')](_0x12118d[_0x5129('0x31')],_0x12118d['query']);_0x19ccda['attributes']=_[_0x5129('0x2f')](_0x12118d['model'],qs['fields'](_0x450417[_0x5129('0x27')][_0x5129('0x32')]));_0x19ccda['attributes']=_0x19ccda[_0x5129('0x30')]['length']?_0x19ccda[_0x5129('0x30')]:_0x12118d[_0x5129('0x31')];if(!_0x450417[_0x5129('0x27')][_0x5129('0x41')](_0x5129('0x42'))){_0x19ccda['limit']=qs['limit'](_0x450417[_0x5129('0x27')][_0x5129('0x17')]);_0x19ccda['offset']=qs[_0x5129('0x14')](_0x450417[_0x5129('0x27')][_0x5129('0x14')]);}_0x19ccda[_0x5129('0x43')]=qs[_0x5129('0x44')](_0x450417[_0x5129('0x27')][_0x5129('0x44')]);_0x19ccda[_0x5129('0x45')]=qs[_0x5129('0x2e')](_[_0x5129('0x46')](_0x450417[_0x5129('0x27')],_0x12118d[_0x5129('0x2e')]));_0x19ccda[_0x5129('0x45')]['SmsInteractionId']=_0x2db847['id'];if(_0x450417[_0x5129('0x27')][_0x5129('0x47')]){_0x19ccda['where']=_['merge'](_0x19ccda[_0x5129('0x45')],{'$or':_['map'](_0x19ccda['attributes'],function(_0x17329c){var _0x43f30b={};_0x43f30b[_0x17329c]={'$like':'%'+_0x450417[_0x5129('0x27')][_0x5129('0x47')]+'%'};return _0x43f30b;})});}if(_0x450417[_0x5129('0x27')][_0x5129('0x48')]){var _0x540b54=_0x450417[_0x5129('0x27')][_0x5129('0x48')][_0x5129('0x49')](',');var _0x3fa19b={};_0x3fa19b[_0x540b54[0x0]]={'$gte':moment(_0x540b54[0x1])['format'](_0x5129('0x4a'))};_0x19ccda[_0x5129('0x45')]=_[_0x5129('0x36')](_0x19ccda['where'],_0x3fa19b);}_0x19ccda=_[_0x5129('0x36')]({},_0x19ccda,_0x450417[_0x5129('0x37')]);return db[_0x5129('0x3c')]['count']({'where':_0x19ccda[_0x5129('0x45')]})[_0x5129('0x1c')](function(_0x316c8){_0x1cd235[_0x5129('0x16')]=_0x316c8;if(_0x450417[_0x5129('0x27')][_0x5129('0x34')]){_0x19ccda[_0x5129('0x35')]=[{'all':!![]}];}return db[_0x5129('0x3c')][_0x5129('0x26')](_0x19ccda);})['then'](function(_0x30f4b9){_0x1cd235[_0x5129('0x4b')]=_0x30f4b9;return _0x1cd235;});}})[_0x5129('0x1c')](respondWithFilteredResult(_0x5bda95,_0x19ccda))[_0x5129('0x29')](handleError(_0x5bda95,null));};exports[_0x5129('0x4c')]=function(_0x3b810e,_0x5980eb){return db['SmsInteraction']['find']({'where':{'id':_0x3b810e[_0x5129('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5980eb,null))['then'](function(_0x1e6c80){if(_0x1e6c80){return _0x1e6c80[_0x5129('0x4d')](_0x3b810e[_0x5129('0x39')]['ids'],_['omit'](_0x3b810e['body'],['ids','id'])||{})[_0x5129('0x4e')](function(){return db[_0x5129('0x4f')][_0x5129('0x26')]({'attributes':['id','name',_0x5129('0x50')],'where':{'id':_0x3b810e[_0x5129('0x39')][_0x5129('0x3e')]}});})[_0x5129('0x1c')](function(_0x19a215){socket[_0x5129('0x51')](_0x5129('0x52'),{'id':Number(_0x3b810e['params']['id']),'tags':_0x19a215||[]});return{'id':Number(_0x3b810e[_0x5129('0x2b')]['id']),'tags':_0x19a215||[]};});}})['then'](respondWithResult(_0x5980eb,null))['catch'](handleError(_0x5980eb,null));};exports['removeTags']=function(_0x4a7aeb,_0x35d68b){return db['SmsInteraction'][_0x5129('0x38')]({'where':{'id':_0x4a7aeb['params']['id']}})['then'](handleEntityNotFound(_0x35d68b,null))[_0x5129('0x1c')](function(_0x249048){if(_0x249048){return _0x249048[_0x5129('0x53')](_0x4a7aeb[_0x5129('0x27')][_0x5129('0x3e')]);}})[_0x5129('0x1c')](respondWithStatusCode(_0x35d68b,null))[_0x5129('0x29')](handleError(_0x35d68b,null));};exports[_0x5129('0x54')]=function(_0x11efeb,_0x46c916){var _0x3ace4b=moment()['unix']()['toString']();var _0x5a93f3=path[_0x5129('0x55')](config[_0x5129('0x56')],_0x5129('0x57'),_0x5129('0x58'),_0x5129('0x59'));var _0x5111c0=path[_0x5129('0x55')](_0x5a93f3,_0x3ace4b);var _0x55185e=util[_0x5129('0x5a')](_0x5129('0x5b'),_0x11efeb['params']['id'],_0x3ace4b);var _0x4642c7=path['join'](_0x5a93f3,_0x55185e);var _0x476b8a=[];_0x476b8a['push']({'model':db['User'],'as':_0x5129('0x5c'),'attributes':['id',_0x5129('0x5d')],'raw':!![]});_0x476b8a[_0x5129('0x5e')]({'model':db[_0x5129('0x5f')],'as':'Contact','attributes':['id',_0x5129('0x60'),_0x5129('0x61')],'raw':!![]});var _0x21b132=[{'model':db[_0x5129('0x3c')],'as':'Messages','attributes':['id',_0x5129('0x39'),'createdAt',_0x5129('0x62'),'secret',_0x5129('0x63')],'include':_0x476b8a}];_0x21b132[_0x5129('0x5e')]({'model':db[_0x5129('0x64')],'as':'Account','attributes':['id','name']});_0x21b132[_0x5129('0x5e')]({'model':db['User'],'as':_0x5129('0x65'),'attributes':['id',_0x5129('0x5d')]});return db[_0x5129('0x21')][_0x5129('0x38')]({'where':{'id':_0x11efeb[_0x5129('0x2b')]['id']},'include':_0x21b132})[_0x5129('0x1c')](handleEntityNotFound(_0x46c916,null))[_0x5129('0x1c')](function(_0x3dada5){if(_0x3dada5){var _0x245fa8=_0x3dada5[_0x5129('0x66')]({'plain':!![]});fs[_0x5129('0x67')](_0x5111c0);var _0x463b95={'channel':'Sms','account':_0x245fa8[_0x5129('0x68')][_0x5129('0x1d')],'agent':_0x245fa8[_0x5129('0x65')]?_0x245fa8[_0x5129('0x65')]['fullname']:_0x5129('0x69'),'createdAt':moment(_0x245fa8[_0x5129('0x6a')])['format'](_0x5129('0x4a'))['toString'](),'closedAt':_0x245fa8['closed']?moment(_0x245fa8['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x245fa8[_0x5129('0x6b')],'messages':_(_0x245fa8[_0x5129('0x6c')])[_0x5129('0x47')]({'secret':![]})[_0x5129('0x20')](function(_0x927209){return{'date':moment(_0x927209[_0x5129('0x6a')])[_0x5129('0x5a')](_0x5129('0x4a'))[_0x5129('0x6d')](),'sender':_0x927209[_0x5129('0x62')]===_0x5129('0x6e')?_0x927209[_0x5129('0x5c')]?_0x927209['User'][_0x5129('0x5d')]:_0x5129('0x6f'):_0x927209[_0x5129('0x70')][_0x5129('0x60')]+(_0x927209[_0x5129('0x70')][_0x5129('0x61')]?'\x20'+_0x927209[_0x5129('0x70')][_0x5129('0x61')]:''),'body':_0x927209[_0x5129('0x39')],'direction':_0x927209[_0x5129('0x62')]===_0x5129('0x6e')?'A':'C','secret':_0x927209[_0x5129('0x71')],'read':_0x927209[_0x5129('0x63')]};})[_0x5129('0x72')]()};return ejs['renderFile'](path[_0x5129('0x55')](config['root'],_0x5129('0x57'),_0x5129('0x73'),'downloadInteraction.ejs'),{'interaction':_0x463b95})[_0x5129('0x1c')](function(_0x2d4f32){var _0x36e6ae=path['join'](_0x5111c0,_0x5129('0x74')+_0x245fa8['id']+'-'+_0x3ace4b+_0x5129('0x75'));var _0x1bc164={'path':_0x36e6ae,'channel':_0x5129('0x76'),'interactionId':_0x245fa8['id']};return pdf['createPdfFromHTML'](_0x2d4f32,_0x1bc164);})[_0x5129('0x1c')](function(){return new BPromise(function(_0x301992,_0x19e1d4){zipdir(_0x5111c0,{'saveTo':_0x4642c7},function(_0x5543b6,_0x72d81f){if(_0x5543b6)return _0x19e1d4(_0x5543b6);return _0x301992(_0x72d81f);});})[_0x5129('0x1c')](function(){return new BPromise(function(_0x4fda62,_0x4ab77c){rimraf(_0x5111c0,function(_0x35357e){if(_0x35357e)_0x4ab77c(_0x35357e);return _0x4fda62();});});})[_0x5129('0x1c')](function(){return _0x46c916[_0x5129('0x54')](_0x4642c7,_0x55185e,function(_0x8569b0){if(_0x8569b0){console[_0x5129('0x77')]('err',_0x8569b0);}else{fs[_0x5129('0x78')](_0x4642c7);}});});});}else{return _0x46c916[_0x5129('0x10')](0xc8);}})[_0x5129('0x29')](handleError(_0x46c916,null));}; \ No newline at end of file +var _0x19d9=['get','mkdirSync','Sms','N.A.','toString','closed','out','System','direction','value','server','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','rimraf','zip-dir','path','ejs','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','update','then','destroy','error','stack','name','send','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','user','show','params','keys','query','filters','intersection','model','attributes','fields','includeAll','include','options','catch','create','body','find','describe','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','order','sort','where','SmsInteractionId','merge','map','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','SmsMessage','rows','spread','removeTags','unix','root','files','tmp','join','format','transcript-%d-%s.zip','push','fullname','CmContact','Contact','firstName','lastName','Messages','createdAt','secret','read','SmsAccount','Account','User','Owner'];(function(_0x2b55d9,_0x231241){var _0x85e9cb=function(_0x4289a7){while(--_0x4289a7){_0x2b55d9['push'](_0x2b55d9['shift']());}};_0x85e9cb(++_0x231241);}(_0x19d9,0xf7));var _0x919d=function(_0xcf7841,_0x147346){_0xcf7841=_0xcf7841-0x0;var _0x2d07d7=_0x19d9[_0xcf7841];return _0x2d07d7;};'use strict';var rimraf=require(_0x919d('0x0'));var zipdir=require(_0x919d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require('util');var path=require(_0x919d('0x2'));var ejs=require(_0x919d('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x919d('0x4'));var qs=require(_0x919d('0x5'));var pdf=require('../../components/export/pdf');var logger=require(_0x919d('0x6'))(_0x919d('0x7'));var config=require(_0x919d('0x8'));var db=require(_0x919d('0x9'))['db'];config[_0x919d('0xa')]=_[_0x919d('0xb')](config[_0x919d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x919d('0xc'))(new Redis(config['redis']));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0xbe202b,_0x2a9dc2){_0x2a9dc2=_0x2a9dc2||0xcc;return function(_0x11d23c){if(_0x11d23c){return _0xbe202b[_0x919d('0xd')](_0x2a9dc2);}return _0xbe202b[_0x919d('0xe')](_0x2a9dc2)[_0x919d('0xf')]();};}function respondWithResult(_0x5121cd,_0x167c4a){_0x167c4a=_0x167c4a||0xc8;return function(_0x5d023a){if(_0x5d023a){return _0x5121cd[_0x919d('0xe')](_0x167c4a)['json'](_0x5d023a);}};}function respondWithFilteredResult(_0x42a996,_0xaf3a99){return function(_0xf84c3e){if(_0xf84c3e){var _0x14e6e1=typeof _0xaf3a99['offset']===_0x919d('0x10')&&typeof _0xaf3a99[_0x919d('0x11')]===_0x919d('0x10');var _0x485291=_0xf84c3e[_0x919d('0x12')];var _0x54b22f=_0x14e6e1?0x0:_0xaf3a99['offset'];var _0x1fd5b4=_0x14e6e1?_0xf84c3e[_0x919d('0x12')]:_0xaf3a99[_0x919d('0x13')]+_0xaf3a99[_0x919d('0x11')];var _0x50a9a7;if(_0x1fd5b4>=_0x485291){_0x1fd5b4=_0x485291;_0x50a9a7=0xc8;}else{_0x50a9a7=0xce;}_0x42a996[_0x919d('0xe')](_0x50a9a7);return _0x42a996[_0x919d('0x14')](_0x919d('0x15'),_0x54b22f+'-'+_0x1fd5b4+'/'+_0x485291)['json'](_0xf84c3e);}return null;};}function saveUpdates(_0x350538){return function(_0x4bb82c){if(_0x4bb82c){return _0x4bb82c[_0x919d('0x16')](_0x350538)[_0x919d('0x17')](function(_0x2ab947){return _0x2ab947;});}return null;};}function removeEntity(_0x50a302){return function(_0x22d775){if(_0x22d775){return _0x22d775[_0x919d('0x18')]()[_0x919d('0x17')](function(){_0x50a302[_0x919d('0xe')](0xcc)[_0x919d('0xf')]();});}};}function handleEntityNotFound(_0x25ed31){return function(_0x4c2939){if(!_0x4c2939){_0x25ed31['sendStatus'](0x194);}return _0x4c2939;};}function handleError(_0x804ef5,_0xf42580){_0xf42580=_0xf42580||0x1f4;return function(_0x50df7c){logger[_0x919d('0x19')](_0x50df7c[_0x919d('0x1a')]);if(_0x50df7c[_0x919d('0x1b')]){delete _0x50df7c[_0x919d('0x1b')];}_0x804ef5[_0x919d('0xe')](_0xf42580)[_0x919d('0x1c')](_0x50df7c);};}exports['index']=function(_0x42ef49,_0x2003df){var _0x491ee4={};var _0x455a83=_['map'](db[_0x919d('0x1d')][_0x919d('0x1e')],function(_0x10953c){return{'name':_0x10953c[_0x919d('0x1f')],'type':_0x10953c[_0x919d('0x20')][_0x919d('0x21')]};});_0x491ee4=qs[_0x919d('0x22')](_0x455a83,_0x42ef49);return interaction[_0x919d('0x23')]('sms',_0x42ef49['query'],_0x42ef49[_0x919d('0x24')],_0x491ee4,_0x455a83)[_0x919d('0x17')](respondWithFilteredResult(_0x2003df,_0x491ee4))['catch'](handleError(_0x2003df,null));};exports[_0x919d('0x25')]=function(_0x51d2a7,_0xc52b43){var _0x181a81={'raw':![],'where':{'id':_0x51d2a7[_0x919d('0x26')]['id']}},_0x389df5={};_0x389df5['model']=_[_0x919d('0x27')](db[_0x919d('0x1d')][_0x919d('0x1e')]);_0x389df5[_0x919d('0x28')]=_[_0x919d('0x27')](_0x51d2a7['query']);_0x389df5[_0x919d('0x29')]=_[_0x919d('0x2a')](_0x389df5[_0x919d('0x2b')],_0x389df5[_0x919d('0x28')]);_0x181a81[_0x919d('0x2c')]=_[_0x919d('0x2a')](_0x389df5[_0x919d('0x2b')],qs[_0x919d('0x2d')](_0x51d2a7[_0x919d('0x28')][_0x919d('0x2d')]));_0x181a81['attributes']=_0x181a81[_0x919d('0x2c')]['length']?_0x181a81[_0x919d('0x2c')]:_0x389df5[_0x919d('0x2b')];if(_0x51d2a7[_0x919d('0x28')][_0x919d('0x2e')]){_0x181a81[_0x919d('0x2f')]=[{'all':!![]}];}_0x181a81=_['merge']({},_0x181a81,_0x51d2a7[_0x919d('0x30')]);return db[_0x919d('0x1d')]['find'](_0x181a81)['then'](handleEntityNotFound(_0xc52b43,null))[_0x919d('0x17')](respondWithResult(_0xc52b43,null))[_0x919d('0x31')](handleError(_0xc52b43,null));};exports[_0x919d('0x32')]=function(_0x3c5235,_0x93e8fd){return db[_0x919d('0x1d')][_0x919d('0x32')](_0x3c5235['body'],{})['then'](respondWithResult(_0x93e8fd,0xc9))[_0x919d('0x31')](handleError(_0x93e8fd,null));};exports[_0x919d('0x16')]=function(_0xbcec9a,_0x48e57e){if(_0xbcec9a['body']['id']){delete _0xbcec9a[_0x919d('0x33')]['id'];}return db[_0x919d('0x1d')][_0x919d('0x34')]({'where':{'id':_0xbcec9a[_0x919d('0x26')]['id']}})[_0x919d('0x17')](handleEntityNotFound(_0x48e57e,null))[_0x919d('0x17')](saveUpdates(_0xbcec9a[_0x919d('0x33')],null))[_0x919d('0x17')](respondWithResult(_0x48e57e,null))['catch'](handleError(_0x48e57e,null));};exports['destroy']=function(_0x5ab89c,_0x50eeed){return db[_0x919d('0x1d')][_0x919d('0x34')]({'where':{'id':_0x5ab89c[_0x919d('0x26')]['id']}})[_0x919d('0x17')](handleEntityNotFound(_0x50eeed,null))[_0x919d('0x17')](removeEntity(_0x50eeed,null))[_0x919d('0x31')](handleError(_0x50eeed,null));};exports['describe']=function(_0x173342,_0xa9c940){return db[_0x919d('0x1d')][_0x919d('0x35')]()[_0x919d('0x17')](respondWithResult(_0xa9c940,null))[_0x919d('0x31')](handleError(_0xa9c940,null));};exports[_0x919d('0x36')]=function(_0x33bff3,_0x2cdbe3){return db['SmsMessage']['find']({'where':{'id':_0x33bff3['params']['id']}})[_0x919d('0x17')](handleEntityNotFound(_0x2cdbe3,null))[_0x919d('0x17')](function(_0x5fa005){if(_0x5fa005){return _0x5fa005[_0x919d('0x36')](_0x33bff3['body'][_0x919d('0x37')],_[_0x919d('0x38')](_0x33bff3[_0x919d('0x33')],[_0x919d('0x37'),'id'])||{});}})[_0x919d('0x17')](respondWithResult(_0x2cdbe3,null))[_0x919d('0x31')](handleError(_0x2cdbe3,null));};exports[_0x919d('0x39')]=function(_0x2d099b,_0x2ea9d3){var _0x423b39={'raw':![],'where':{}};var _0x4d4b10={};var _0x2e4297={'count':0x0,'rows':[]};return db[_0x919d('0x1d')][_0x919d('0x3a')]({'where':{'id':_0x2d099b[_0x919d('0x26')]['id']}})[_0x919d('0x17')](handleEntityNotFound(_0x2ea9d3,null))['then'](function(_0x13b3e3){if(_0x13b3e3){_0x4d4b10[_0x919d('0x2b')]=_[_0x919d('0x27')](db['SmsMessage'][_0x919d('0x1e')]);_0x4d4b10[_0x919d('0x28')]=_[_0x919d('0x27')](_0x2d099b['query']);_0x4d4b10[_0x919d('0x29')]=_[_0x919d('0x2a')](_0x4d4b10[_0x919d('0x2b')],_0x4d4b10[_0x919d('0x28')]);_0x423b39['attributes']=_[_0x919d('0x2a')](_0x4d4b10[_0x919d('0x2b')],qs['fields'](_0x2d099b[_0x919d('0x28')][_0x919d('0x2d')]));_0x423b39[_0x919d('0x2c')]=_0x423b39['attributes']['length']?_0x423b39[_0x919d('0x2c')]:_0x4d4b10[_0x919d('0x2b')];if(!_0x2d099b[_0x919d('0x28')][_0x919d('0x3b')]('nolimit')){_0x423b39[_0x919d('0x11')]=qs[_0x919d('0x11')](_0x2d099b[_0x919d('0x28')][_0x919d('0x11')]);_0x423b39[_0x919d('0x13')]=qs[_0x919d('0x13')](_0x2d099b[_0x919d('0x28')][_0x919d('0x13')]);}_0x423b39[_0x919d('0x3c')]=qs['sort'](_0x2d099b[_0x919d('0x28')][_0x919d('0x3d')]);_0x423b39[_0x919d('0x3e')]=qs[_0x919d('0x29')](_['pick'](_0x2d099b[_0x919d('0x28')],_0x4d4b10[_0x919d('0x29')]));_0x423b39[_0x919d('0x3e')][_0x919d('0x3f')]=_0x13b3e3['id'];if(_0x2d099b['query']['filter']){_0x423b39['where']=_[_0x919d('0x40')](_0x423b39['where'],{'$or':_[_0x919d('0x41')](_0x423b39[_0x919d('0x2c')],function(_0x2db4b2){var _0x104fd4={};_0x104fd4[_0x2db4b2]={'$like':'%'+_0x2d099b[_0x919d('0x28')][_0x919d('0x42')]+'%'};return _0x104fd4;})});}if(_0x2d099b['query']['$gte']){var _0x4d0380=_0x2d099b[_0x919d('0x28')][_0x919d('0x43')][_0x919d('0x44')](',');var _0x1a970e={};_0x1a970e[_0x4d0380[0x0]]={'$gte':moment(_0x4d0380[0x1])['format'](_0x919d('0x45'))};_0x423b39[_0x919d('0x3e')]=_[_0x919d('0x40')](_0x423b39['where'],_0x1a970e);}_0x423b39=_[_0x919d('0x40')]({},_0x423b39,_0x2d099b[_0x919d('0x30')]);return db[_0x919d('0x46')]['count']({'where':_0x423b39[_0x919d('0x3e')]})['then'](function(_0xa74875){_0x2e4297[_0x919d('0x12')]=_0xa74875;if(_0x2d099b[_0x919d('0x28')]['includeAll']){_0x423b39[_0x919d('0x2f')]=[{'all':!![]}];}return db[_0x919d('0x46')]['findAll'](_0x423b39);})[_0x919d('0x17')](function(_0x530d2e){_0x2e4297[_0x919d('0x47')]=_0x530d2e;return _0x2e4297;});}})['then'](respondWithFilteredResult(_0x2ea9d3,_0x423b39))[_0x919d('0x31')](handleError(_0x2ea9d3,null));};exports['addTags']=function(_0x58db97,_0xcbf20e){return db[_0x919d('0x1d')][_0x919d('0x34')]({'where':{'id':_0x58db97[_0x919d('0x26')]['id']}})[_0x919d('0x17')](handleEntityNotFound(_0xcbf20e,null))[_0x919d('0x17')](function(_0x5b7e7b){if(_0x5b7e7b){return _0x5b7e7b['setTags'](_0x58db97[_0x919d('0x33')][_0x919d('0x37')],_[_0x919d('0x38')](_0x58db97[_0x919d('0x33')],[_0x919d('0x37'),'id'])||{})[_0x919d('0x48')](function(){return db['Tag']['findAll']({'attributes':['id',_0x919d('0x1b'),'color'],'where':{'id':_0x58db97['body'][_0x919d('0x37')]}});})[_0x919d('0x17')](function(_0x553df4){socket['emit']('smsInteractionTags:save',{'id':Number(_0x58db97[_0x919d('0x26')]['id']),'tags':_0x553df4||[]});return{'id':Number(_0x58db97['params']['id']),'tags':_0x553df4||[]};});}})[_0x919d('0x17')](respondWithResult(_0xcbf20e,null))[_0x919d('0x31')](handleError(_0xcbf20e,null));};exports[_0x919d('0x49')]=function(_0x5725c3,_0x6050f0){return db['SmsInteraction']['find']({'where':{'id':_0x5725c3['params']['id']}})[_0x919d('0x17')](handleEntityNotFound(_0x6050f0,null))[_0x919d('0x17')](function(_0x3bdafb){if(_0x3bdafb){return _0x3bdafb[_0x919d('0x49')](_0x5725c3[_0x919d('0x28')]['ids']);}})[_0x919d('0x17')](respondWithStatusCode(_0x6050f0,null))[_0x919d('0x31')](handleError(_0x6050f0,null));};exports['download']=function(_0x1e9b0d,_0x350c98){var _0x447948=moment()[_0x919d('0x4a')]()['toString']();var _0x1cca23=path['join'](config[_0x919d('0x4b')],'server',_0x919d('0x4c'),_0x919d('0x4d'));var _0x189103=path[_0x919d('0x4e')](_0x1cca23,_0x447948);var _0x712d6f=util[_0x919d('0x4f')](_0x919d('0x50'),_0x1e9b0d[_0x919d('0x26')]['id'],_0x447948);var _0xa13050=path[_0x919d('0x4e')](_0x1cca23,_0x712d6f);var _0x46c5f2=[];_0x46c5f2[_0x919d('0x51')]({'model':db['User'],'as':'User','attributes':['id',_0x919d('0x52')],'raw':!![]});_0x46c5f2[_0x919d('0x51')]({'model':db[_0x919d('0x53')],'as':_0x919d('0x54'),'attributes':['id',_0x919d('0x55'),_0x919d('0x56')],'raw':!![]});var _0x4c4e78=[{'model':db[_0x919d('0x46')],'as':_0x919d('0x57'),'attributes':['id',_0x919d('0x33'),_0x919d('0x58'),'direction',_0x919d('0x59'),_0x919d('0x5a')],'include':_0x46c5f2}];_0x4c4e78[_0x919d('0x51')]({'model':db[_0x919d('0x5b')],'as':_0x919d('0x5c'),'attributes':['id',_0x919d('0x1b')]});_0x4c4e78[_0x919d('0x51')]({'model':db[_0x919d('0x5d')],'as':_0x919d('0x5e'),'attributes':['id',_0x919d('0x52')]});return db[_0x919d('0x1d')][_0x919d('0x34')]({'where':{'id':_0x1e9b0d[_0x919d('0x26')]['id']},'include':_0x4c4e78})[_0x919d('0x17')](handleEntityNotFound(_0x350c98,null))[_0x919d('0x17')](function(_0x2cf2e8){if(_0x2cf2e8){var _0x2cc183=_0x2cf2e8[_0x919d('0x5f')]({'plain':!![]});fs[_0x919d('0x60')](_0x189103);var _0x13602f={'channel':_0x919d('0x61'),'account':_0x2cc183[_0x919d('0x5c')]['name'],'agent':_0x2cc183[_0x919d('0x5e')]?_0x2cc183[_0x919d('0x5e')][_0x919d('0x52')]:_0x919d('0x62'),'createdAt':moment(_0x2cc183[_0x919d('0x58')])[_0x919d('0x4f')]('YYYY-MM-DD\x20HH:mm:ss')[_0x919d('0x63')](),'closedAt':_0x2cc183[_0x919d('0x64')]?moment(_0x2cc183['closedAt'])[_0x919d('0x4f')](_0x919d('0x45'))[_0x919d('0x63')]():'','disposition':_0x2cc183['disposition'],'messages':_(_0x2cc183[_0x919d('0x57')])['filter']({'secret':![]})[_0x919d('0x41')](function(_0x38afc2){return{'date':moment(_0x38afc2[_0x919d('0x58')])[_0x919d('0x4f')](_0x919d('0x45'))[_0x919d('0x63')](),'sender':_0x38afc2['direction']===_0x919d('0x65')?_0x38afc2[_0x919d('0x5d')]?_0x38afc2[_0x919d('0x5d')][_0x919d('0x52')]:_0x919d('0x66'):_0x38afc2['Contact'][_0x919d('0x55')]+(_0x38afc2[_0x919d('0x54')][_0x919d('0x56')]?'\x20'+_0x38afc2[_0x919d('0x54')][_0x919d('0x56')]:''),'body':_0x38afc2[_0x919d('0x33')],'direction':_0x38afc2[_0x919d('0x67')]===_0x919d('0x65')?'A':'C','secret':_0x38afc2[_0x919d('0x59')],'read':_0x38afc2[_0x919d('0x5a')]};})[_0x919d('0x68')]()};return ejs['renderFile'](path[_0x919d('0x4e')](config[_0x919d('0x4b')],_0x919d('0x69'),_0x919d('0x6a'),_0x919d('0x6b')),{'interaction':_0x13602f})[_0x919d('0x17')](function(_0x50d2b8){var _0x315113=path[_0x919d('0x4e')](_0x189103,_0x919d('0x6c')+_0x2cc183['id']+'-'+_0x447948+_0x919d('0x6d'));var _0x5a5fd1={'path':_0x315113,'channel':'Sms','interactionId':_0x2cc183['id']};return pdf[_0x919d('0x6e')](_0x50d2b8,_0x5a5fd1);})[_0x919d('0x17')](function(){return new BPromise(function(_0x514a19,_0x1cc0c6){zipdir(_0x189103,{'saveTo':_0xa13050},function(_0x54daa1,_0x2dadb4){if(_0x54daa1)return _0x1cc0c6(_0x54daa1);return _0x514a19(_0x2dadb4);});})[_0x919d('0x17')](function(){return new BPromise(function(_0x291ab9,_0x249f3b){rimraf(_0x189103,function(_0x137a38){if(_0x137a38)_0x249f3b(_0x137a38);return _0x291ab9();});});})['then'](function(){return _0x350c98[_0x919d('0x6f')](_0xa13050,_0x712d6f,function(_0x3da461){if(_0x3da461){console[_0x919d('0x70')](_0x919d('0x71'),_0x3da461);}else{fs['unlinkSync'](_0xa13050);}});});});}else{return _0x350c98['sendStatus'](0xc8);}})[_0x919d('0x31')](handleError(_0x350c98,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 8c38fb1..443066b 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 _0x056b=['hook','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','emit','catch','hasOwnProperty'];(function(_0x493f26,_0x520f22){var _0x5c6b70=function(_0x360d34){while(--_0x360d34){_0x493f26['push'](_0x493f26['shift']());}};_0x5c6b70(++_0x520f22);}(_0x056b,0xb6));var _0xb056=function(_0x529c58,_0x5040d0){_0x529c58=_0x529c58-0x0;var _0x5ad8d8=_0x056b[_0x529c58];return _0x5ad8d8;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xb056('0x0'))['db'][_0xb056('0x1')];var SmsMessage=require(_0xb056('0x0'))['db'][_0xb056('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xb056('0x3')](0x0);var events={'afterCreate':_0xb056('0x4'),'afterUpdate':_0xb056('0x5'),'afterDestroy':_0xb056('0x6')};function emitEvent(_0x343d88){return function(_0x2ff09d,_0x15a545,_0x515612){_0x2ff09d[_0xb056('0x7')]({'attributes':['id'],'raw':!![]})[_0xb056('0x8')](function(_0x3eae69){_0x2ff09d[_0xb056('0x9')](_0xb056('0xa'),_0x3eae69[_0xb056('0xb')](function(_0x539126){return{'id':_0x539126['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x2ff09d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb056('0x8')](function(_0x160c2a){_0x2ff09d[_0xb056('0x9')](_0xb056('0xc'),_0x160c2a['length']);SmsInteractionEvents[_0xb056('0xd')](_0x343d88+':'+_0x2ff09d['id'],_0x2ff09d);SmsInteractionEvents['emit'](_0x343d88,_0x2ff09d);_0x515612(null);})[_0xb056('0xe')](_0x515612(null));};}for(var e in events){if(events[_0xb056('0xf')](e)){var event=events[e];SmsInteraction[_0xb056('0x10')](e,emitEvent(event));}}module[_0xb056('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0x430c=['setMaxListeners','getUsers','setDataValue','Users','map','findAll','then','length','emit','catch','hook','events','../../mysqldb','SmsMessage'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x430c,0x1a1));var _0xc430=function(_0x2c5340,_0x5c86e5){_0x2c5340=_0x2c5340-0x0;var _0x3c505e=_0x430c[_0x2c5340];return _0x3c505e;};'use strict';var EventEmitter=require(_0xc430('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require(_0xc430('0x1'))['db'][_0xc430('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc430('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x47d8b9){return function(_0x338a82,_0x2408f5,_0x50b256){_0x338a82[_0xc430('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0x212354){_0x338a82[_0xc430('0x5')](_0xc430('0x6'),_0x212354[_0xc430('0x7')](function(_0x2e23f8){return{'id':_0x2e23f8['id']};}));return SmsMessage[_0xc430('0x8')]({'where':{'SmsInteractionId':_0x338a82['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc430('0x9')](function(_0x115814){_0x338a82[_0xc430('0x5')]('unreadMessages',_0x115814[_0xc430('0xa')]);SmsInteractionEvents[_0xc430('0xb')](_0x47d8b9+':'+_0x338a82['id'],_0x338a82);SmsInteractionEvents['emit'](_0x47d8b9,_0x338a82);_0x50b256(null);})[_0xc430('0xc')](_0x50b256(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xc430('0xd')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index ceb4d8d..ae7cbec 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 _0x2962=['rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','changed','closed','format','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1e4ad9,_0xf18a6b){var _0x2680b9=function(_0x215251){while(--_0x215251){_0x1e4ad9['push'](_0x1e4ad9['shift']());}};_0x2680b9(++_0xf18a6b);}(_0x2962,0x71));var _0x2296=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x2962[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x2296('0x0'));var util=require(_0x2296('0x1'));var logger=require(_0x2296('0x2'))(_0x2296('0x3'));var moment=require(_0x2296('0x4'));var BPromise=require(_0x2296('0x5'));var rp=require(_0x2296('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2296('0x7'));var config=require(_0x2296('0x8'));var attributes=require(_0x2296('0x9'));module[_0x2296('0xa')]=function(_0x48dff9,_0x9f13b8){return _0x48dff9['define'](_0x2296('0xb'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x13d593,_0x3aa0af,_0x379ddb){if(_0x13d593[_0x2296('0xc')](_0x2296('0xd'))){_0x13d593['closedAt']=moment()[_0x2296('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x379ddb(null,_0x13d593);}}});}; \ No newline at end of file +var _0xed34=['sms_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','SmsInteraction'];(function(_0x148f8d,_0x4d71ee){var _0x5c788a=function(_0x491ef3){while(--_0x491ef3){_0x148f8d['push'](_0x148f8d['shift']());}};_0x5c788a(++_0x4d71ee);}(_0xed34,0x115));var _0x4ed3=function(_0x28f17b,_0x58c50f){_0x28f17b=_0x28f17b-0x0;var _0x55025d=_0xed34[_0x28f17b];return _0x55025d;};'use strict';var _=require(_0x4ed3('0x0'));var util=require(_0x4ed3('0x1'));var logger=require(_0x4ed3('0x2'))(_0x4ed3('0x3'));var moment=require(_0x4ed3('0x4'));var BPromise=require(_0x4ed3('0x5'));var rp=require(_0x4ed3('0x6'));var fs=require('fs');var path=require(_0x4ed3('0x7'));var rimraf=require('rimraf');var config=require(_0x4ed3('0x8'));var attributes=require('./smsInteraction.attributes');module[_0x4ed3('0x9')]=function(_0x2089e0,_0x1eaef2){return _0x2089e0[_0x4ed3('0xa')](_0x4ed3('0xb'),attributes,{'tableName':_0x4ed3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4a6f2f,_0x4600be,_0x2b15d8){if(_0x4a6f2f[_0x4ed3('0xd')]('closed')){_0x4a6f2f[_0x4ed3('0xe')]=moment()[_0x4ed3('0xf')](_0x4ed3('0x10'));}_0x2b15d8(null,_0x4a6f2f);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index aa7867f..eefb7e7 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 _0x7dc4=['error','code','message','catch','SmsInteraction','update','body','options','raw','attributes','limit','UpdateSmsInteraction','where','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0x7dc4,0x1c9));var _0x47dc=function(_0x1a1809,_0x1eec91){_0x1a1809=_0x1a1809-0x0;var _0x276442=_0x7dc4[_0x1a1809];return _0x276442;};'use strict';var _=require(_0x47dc('0x0'));var util=require(_0x47dc('0x1'));var moment=require(_0x47dc('0x2'));var BPromise=require(_0x47dc('0x3'));var rs=require(_0x47dc('0x4'));var fs=require('fs');var Redis=require(_0x47dc('0x5'));var db=require(_0x47dc('0x6'))['db'];var utils=require(_0x47dc('0x7'));var logger=require(_0x47dc('0x8'))(_0x47dc('0x9'));var config=require(_0x47dc('0xa'));var jayson=require(_0x47dc('0xb'));var client=jayson[_0x47dc('0xc')][_0x47dc('0xd')]({'port':0x232a});config[_0x47dc('0xe')]=_[_0x47dc('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x47dc('0x10'))(new Redis(config[_0x47dc('0xe')]));require(_0x47dc('0x11'))[_0x47dc('0x12')](socket);function respondWithRpcPromise(_0x1fc1bd,_0x417d18,_0xeff984){return new BPromise(function(_0x3d4243,_0x110fdf){return client[_0x47dc('0x13')](_0x1fc1bd,_0xeff984)[_0x47dc('0x14')](function(_0x3c7d33){logger[_0x47dc('0x15')](_0x47dc('0x16'),_0x417d18,_0x47dc('0x17'));logger[_0x47dc('0x18')](_0x47dc('0x19'),_0x417d18,_0x47dc('0x17'),JSON[_0x47dc('0x1a')](_0x3c7d33));if(_0x3c7d33[_0x47dc('0x1b')]){if(_0x3c7d33[_0x47dc('0x1b')][_0x47dc('0x1c')]===0x1f4){logger[_0x47dc('0x1b')]('SmsInteraction,\x20%s,\x20%s',_0x417d18,_0x3c7d33[_0x47dc('0x1b')][_0x47dc('0x1d')]);return _0x110fdf(_0x3c7d33[_0x47dc('0x1b')]['message']);}logger[_0x47dc('0x1b')](_0x47dc('0x16'),_0x417d18,_0x3c7d33['error'][_0x47dc('0x1d')]);return _0x3d4243(_0x3c7d33[_0x47dc('0x1b')]['message']);}else{logger[_0x47dc('0x15')](_0x47dc('0x16'),_0x417d18,_0x47dc('0x17'));_0x3d4243(_0x3c7d33['result'][_0x47dc('0x1d')]);}})[_0x47dc('0x1e')](function(_0x1aec1f){logger[_0x47dc('0x1b')](_0x47dc('0x16'),_0x417d18,_0x1aec1f);_0x110fdf(_0x1aec1f);});});}exports['UpdateSmsInteraction']=function(_0x44ae0b){var _0x2133cb=this;return new Promise(function(_0x34bd87,_0x88d65a){return db[_0x47dc('0x1f')][_0x47dc('0x20')](_0x44ae0b[_0x47dc('0x21')],{'raw':_0x44ae0b[_0x47dc('0x22')]?_0x44ae0b[_0x47dc('0x22')][_0x47dc('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44ae0b[_0x47dc('0x22')]?_0x44ae0b['options']['where']||null:null,'attributes':_0x44ae0b['options']?_0x44ae0b[_0x47dc('0x22')][_0x47dc('0x24')]||null:null,'limit':_0x44ae0b[_0x47dc('0x22')]?_0x44ae0b[_0x47dc('0x22')][_0x47dc('0x25')]||null:null})[_0x47dc('0x14')](function(_0x3b0d4b){logger[_0x47dc('0x15')](_0x47dc('0x26'),_0x44ae0b);logger[_0x47dc('0x18')](_0x47dc('0x26'),_0x44ae0b,JSON['stringify'](_0x3b0d4b));_0x34bd87(_0x3b0d4b);})[_0x47dc('0x1e')](function(_0x202a89){logger[_0x47dc('0x1b')](_0x47dc('0x26'),_0x202a89[_0x47dc('0x1d')],_0x44ae0b);_0x88d65a(_0x2133cb[_0x47dc('0x1b')](0x1f4,_0x202a89[_0x47dc('0x1d')]));});});};exports['AddTagsToSmsInteraction']=function(_0x53fefc){return new Promise(function(_0x49eca5,_0x5863f6){return db[_0x47dc('0x1f')]['find']({'where':_0x53fefc[_0x47dc('0x22')]?_0x53fefc['options'][_0x47dc('0x27')]||null:null})[_0x47dc('0x14')](function(_0x5ad8b2){if(_0x5ad8b2){return _0x5ad8b2[_0x47dc('0x28')](_0x53fefc[_0x47dc('0x21')][_0x47dc('0x29')],_['omit'](_0x53fefc['body'],[_0x47dc('0x29'),'id'])||{});}})[_0x47dc('0x2a')](function(_0x1c8904){logger[_0x47dc('0x15')](_0x47dc('0x2b'),_0x53fefc);logger[_0x47dc('0x18')]('AddTags',_0x53fefc,JSON[_0x47dc('0x1a')](_0x1c8904));_0x49eca5(_0x1c8904);})[_0x47dc('0x1e')](function(_0x2568f9){logger[_0x47dc('0x1b')](_0x47dc('0x2b'),_0x2568f9[_0x47dc('0x1d')],_0x53fefc);_0x5863f6(_this[_0x47dc('0x1b')](0x1f4,_0x2568f9['message']));});});}; \ No newline at end of file +var _0xd54f=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateSmsInteraction','update','options','raw','limit','AddTagsToSmsInteraction','SmsInteraction','where','addTags','body','ids','spread','AddTags'];(function(_0x3084cc,_0x4113c0){var _0x410eef=function(_0x4d2a01){while(--_0x4d2a01){_0x3084cc['push'](_0x3084cc['shift']());}};_0x410eef(++_0x4113c0);}(_0xd54f,0xf0));var _0xfd54=function(_0xf3de7a,_0x464f47){_0xf3de7a=_0xf3de7a-0x0;var _0x56f74a=_0xd54f[_0xf3de7a];return _0x56f74a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfd54('0x0'));var BPromise=require(_0xfd54('0x1'));var rs=require(_0xfd54('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd54('0x3'))['db'];var utils=require(_0xfd54('0x4'));var logger=require(_0xfd54('0x5'))(_0xfd54('0x6'));var config=require(_0xfd54('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfd54('0x8')][_0xfd54('0x9')]({'port':0x232a});config['redis']=_[_0xfd54('0xa')](config[_0xfd54('0xb')],{'host':_0xfd54('0xc'),'port':0x18eb});var socket=require(_0xfd54('0xd'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0xfd54('0xe')](socket);function respondWithRpcPromise(_0x5131c0,_0x19ebe5,_0xe4a544){return new BPromise(function(_0x1b2704,_0x57c7dc){return client[_0xfd54('0xf')](_0x5131c0,_0xe4a544)[_0xfd54('0x10')](function(_0x258fc9){logger[_0xfd54('0x11')](_0xfd54('0x12'),_0x19ebe5,_0xfd54('0x13'));logger[_0xfd54('0x14')](_0xfd54('0x15'),_0x19ebe5,_0xfd54('0x13'),JSON[_0xfd54('0x16')](_0x258fc9));if(_0x258fc9['error']){if(_0x258fc9['error']['code']===0x1f4){logger['error'](_0xfd54('0x12'),_0x19ebe5,_0x258fc9[_0xfd54('0x17')][_0xfd54('0x18')]);return _0x57c7dc(_0x258fc9[_0xfd54('0x17')][_0xfd54('0x18')]);}logger[_0xfd54('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x19ebe5,_0x258fc9[_0xfd54('0x17')][_0xfd54('0x18')]);return _0x1b2704(_0x258fc9[_0xfd54('0x17')][_0xfd54('0x18')]);}else{logger[_0xfd54('0x11')](_0xfd54('0x12'),_0x19ebe5,_0xfd54('0x13'));_0x1b2704(_0x258fc9[_0xfd54('0x19')][_0xfd54('0x18')]);}})[_0xfd54('0x1a')](function(_0x7f57d5){logger['error'](_0xfd54('0x12'),_0x19ebe5,_0x7f57d5);_0x57c7dc(_0x7f57d5);});});}exports[_0xfd54('0x1b')]=function(_0x11a696){var _0x5c11fe=this;return new Promise(function(_0x5d1462,_0x396316){return db['SmsInteraction'][_0xfd54('0x1c')](_0x11a696['body'],{'raw':_0x11a696[_0xfd54('0x1d')]?_0x11a696[_0xfd54('0x1d')][_0xfd54('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11a696[_0xfd54('0x1d')]?_0x11a696[_0xfd54('0x1d')]['where']||null:null,'attributes':_0x11a696[_0xfd54('0x1d')]?_0x11a696['options']['attributes']||null:null,'limit':_0x11a696[_0xfd54('0x1d')]?_0x11a696[_0xfd54('0x1d')][_0xfd54('0x1f')]||null:null})[_0xfd54('0x10')](function(_0x1f3fbc){logger['info']('UpdateSmsInteraction',_0x11a696);logger[_0xfd54('0x14')](_0xfd54('0x1b'),_0x11a696,JSON[_0xfd54('0x16')](_0x1f3fbc));_0x5d1462(_0x1f3fbc);})[_0xfd54('0x1a')](function(_0x237771){logger[_0xfd54('0x17')](_0xfd54('0x1b'),_0x237771[_0xfd54('0x18')],_0x11a696);_0x396316(_0x5c11fe[_0xfd54('0x17')](0x1f4,_0x237771[_0xfd54('0x18')]));});});};exports[_0xfd54('0x20')]=function(_0x167b96){return new Promise(function(_0x261e59,_0x4d3edc){return db[_0xfd54('0x21')]['find']({'where':_0x167b96[_0xfd54('0x1d')]?_0x167b96['options'][_0xfd54('0x22')]||null:null})[_0xfd54('0x10')](function(_0x325217){if(_0x325217){return _0x325217[_0xfd54('0x23')](_0x167b96[_0xfd54('0x24')]['ids'],_['omit'](_0x167b96[_0xfd54('0x24')],[_0xfd54('0x25'),'id'])||{});}})[_0xfd54('0x26')](function(_0x4e266a){logger[_0xfd54('0x11')](_0xfd54('0x27'),_0x167b96);logger['debug'](_0xfd54('0x27'),_0x167b96,JSON[_0xfd54('0x16')](_0x4e266a));_0x261e59(_0x4e266a);})[_0xfd54('0x1a')](function(_0x521488){logger[_0xfd54('0x17')](_0xfd54('0x27'),_0x521488[_0xfd54('0x18')],_0x167b96);_0x4d3edc(_this[_0xfd54('0x17')](0x1f4,_0x521488[_0xfd54('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index f5d91cd..239b2fa 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 _0x9f0f=['save','remove','emit','removeListener','register','length'];(function(_0x481f1d,_0x3c80c1){var _0x5e283=function(_0x2db1df){while(--_0x2db1df){_0x481f1d['push'](_0x481f1d['shift']());}};_0x5e283(++_0x3c80c1);}(_0x9f0f,0x132));var _0xf9f0=function(_0x5b3970,_0xd0fb8e){_0x5b3970=_0x5b3970-0x0;var _0x52cc2c=_0x9f0f[_0x5b3970];return _0x52cc2c;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xf9f0('0x0'),_0xf9f0('0x1'),'update'];function createListener(_0x227fa2,_0x47c2dd){return function(_0x525819){_0x47c2dd[_0xf9f0('0x2')](_0x227fa2,_0x525819);};}function removeListener(_0x3420d4,_0x599506){return function(){SmsInteractionEvents[_0xf9f0('0x3')](_0x3420d4,_0x599506);};}exports[_0xf9f0('0x4')]=function(_0x3e9bbd){for(var _0x3711e4=0x0,_0x24096d=events[_0xf9f0('0x5')];_0x3711e4<_0x24096d;_0x3711e4++){var _0x1659e8=events[_0x3711e4];var _0x580f84=createListener('smsInteraction:'+_0x1659e8,_0x3e9bbd);SmsInteractionEvents['on'](_0x1659e8,_0x580f84);}}; \ No newline at end of file +var _0x4e8b=['smsInteraction:','./smsInteraction.events','save','remove','update','removeListener','register','length'];(function(_0xb12fb,_0x1634d0){var _0x225859=function(_0x4e2d53){while(--_0x4e2d53){_0xb12fb['push'](_0xb12fb['shift']());}};_0x225859(++_0x1634d0);}(_0x4e8b,0x81));var _0xb4e8=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x4e8b[_0x279d37];return _0x530173;};'use strict';var SmsInteractionEvents=require(_0xb4e8('0x0'));var events=[_0xb4e8('0x1'),_0xb4e8('0x2'),_0xb4e8('0x3')];function createListener(_0x48eece,_0x1f5758){return function(_0x281b42){_0x1f5758['emit'](_0x48eece,_0x281b42);};}function removeListener(_0x44709d,_0x541c9c){return function(){SmsInteractionEvents[_0xb4e8('0x4')](_0x44709d,_0x541c9c);};}exports[_0xb4e8('0x5')]=function(_0x4903f3){for(var _0xf19562=0x0,_0xfab044=events[_0xb4e8('0x6')];_0xf19562<_0xfab044;_0xf19562++){var _0x400671=events[_0xf19562];var _0x286682=createListener(_0xb4e8('0x7')+_0x400671,_0x4903f3);SmsInteractionEvents['on'](_0x400671,_0x286682);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 0b8ad6a..ed939b9 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 _0x6e14=['smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked'];(function(_0x2f2f8f,_0x3e9363){var _0x167c84=function(_0x2ce7f5){while(--_0x2ce7f5){_0x2f2f8f['push'](_0x2f2f8f['shift']());}};_0x167c84(++_0x3e9363);}(_0x6e14,0x81));var _0x46e1=function(_0x5b60c4,_0x5caf00){_0x5b60c4=_0x5b60c4-0x0;var _0xa98fff=_0x6e14[_0x5b60c4];return _0xa98fff;};'use strict';var multer=require(_0x46e1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x46e1('0x1'));var express=require(_0x46e1('0x2'));var router=express['Router']();var fs_extra=require(_0x46e1('0x3'));var auth=require(_0x46e1('0x4'));var interaction=require(_0x46e1('0x5'));var config=require('../../config/environment');var controller=require(_0x46e1('0x6'));router[_0x46e1('0x7')]('/',auth[_0x46e1('0x8')](),controller[_0x46e1('0x9')]);router[_0x46e1('0x7')](_0x46e1('0xa'),auth['isAuthenticated'](),controller[_0x46e1('0xb')]);router[_0x46e1('0x7')](_0x46e1('0xc'),auth[_0x46e1('0x8')](),controller[_0x46e1('0xd')]);router[_0x46e1('0xe')]('/',auth[_0x46e1('0x8')](),interaction[_0x46e1('0xf')]('sms',_0x46e1('0x10')),controller[_0x46e1('0x11')]);router[_0x46e1('0xe')](_0x46e1('0x12'),controller[_0x46e1('0x13')]);router[_0x46e1('0x14')](_0x46e1('0xc'),auth[_0x46e1('0x8')](),controller[_0x46e1('0x15')]);router['put'](_0x46e1('0x16'),auth[_0x46e1('0x8')](),controller[_0x46e1('0x17')]);router['put'](_0x46e1('0x18'),auth[_0x46e1('0x8')](),controller[_0x46e1('0x19')]);router[_0x46e1('0x1a')](_0x46e1('0xc'),auth[_0x46e1('0x8')](),controller[_0x46e1('0x1b')]);module[_0x46e1('0x1c')]=router; \ No newline at end of file +var _0x79d2=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','describe','/:id','tracked','smsmessage:create','create','post','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','util','path'];(function(_0x5e8eb6,_0x4f7f3b){var _0x4d0320=function(_0x3db467){while(--_0x3db467){_0x5e8eb6['push'](_0x5e8eb6['shift']());}};_0x4d0320(++_0x4f7f3b);}(_0x79d2,0xd6));var _0x279d=function(_0x44cad0,_0x229ce2){_0x44cad0=_0x44cad0-0x0;var _0x360e6f=_0x79d2[_0x44cad0];return _0x360e6f;};'use strict';var multer=require('multer');var util=require(_0x279d('0x0'));var path=require(_0x279d('0x1'));var timeout=require('connect-timeout');var express=require(_0x279d('0x2'));var router=express['Router']();var fs_extra=require(_0x279d('0x3'));var auth=require(_0x279d('0x4'));var interaction=require(_0x279d('0x5'));var config=require(_0x279d('0x6'));var controller=require(_0x279d('0x7'));router[_0x279d('0x8')]('/',auth[_0x279d('0x9')](),controller[_0x279d('0xa')]);router[_0x279d('0x8')]('/describe',auth[_0x279d('0x9')](),controller[_0x279d('0xb')]);router[_0x279d('0x8')](_0x279d('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x279d('0x9')](),interaction[_0x279d('0xd')]('sms',_0x279d('0xe')),controller[_0x279d('0xf')]);router[_0x279d('0x10')](_0x279d('0x11'),controller[_0x279d('0x12')]);router[_0x279d('0x13')](_0x279d('0xc'),auth[_0x279d('0x9')](),controller[_0x279d('0x14')]);router[_0x279d('0x13')](_0x279d('0x15'),auth[_0x279d('0x9')](),controller[_0x279d('0x16')]);router['put'](_0x279d('0x17'),auth['isAuthenticated'](),controller[_0x279d('0x18')]);router['delete'](_0x279d('0xc'),auth[_0x279d('0x9')](),controller[_0x279d('0x19')]);module[_0x279d('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 8a6eaf7..1b345f7 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 _0x1d19=['medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x1d19,0xb1));var _0x91d1=function(_0x357477,_0xebc70){_0x357477=_0x357477-0x0;var _0x3755af=_0x1d19[_0x357477];return _0x3755af;};'use strict';var Sequelize=require(_0x91d1('0x0'));module[_0x91d1('0x1')]={'body':{'type':Sequelize[_0x91d1('0x2')](_0x91d1('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x91d1('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x91d1('0x5')]('in',_0x91d1('0x6')),'defaultValue':_0x91d1('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x91d1('0x7')](0xbe)},'phone':{'type':Sequelize[_0x91d1('0x7')]},'readAt':{'type':Sequelize[_0x91d1('0x8')]},'secret':{'type':Sequelize[_0x91d1('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x91d1('0x2')]}}; \ No newline at end of file +var _0x0178=['TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize','exports'];(function(_0x497cba,_0xec2f3c){var _0x18756c=function(_0x34d33a){while(--_0x34d33a){_0x497cba['push'](_0x497cba['shift']());}};_0x18756c(++_0xec2f3c);}(_0x0178,0xce));var _0x8017=function(_0x4753f1,_0x71e4ff){_0x4753f1=_0x4753f1-0x0;var _0x31cf8e=_0x0178[_0x4753f1];return _0x31cf8e;};'use strict';var Sequelize=require(_0x8017('0x0'));module[_0x8017('0x1')]={'body':{'type':Sequelize[_0x8017('0x2')](_0x8017('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x8017('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8017('0x5')]('in',_0x8017('0x6')),'defaultValue':_0x8017('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8017('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x8017('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x8017('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 1e01902..ebd4edb 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 _0x01a6=['user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','Status','plivio','results','groupName','DELIVERED','infobip','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','destroy','end','stack','name','index','map','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','SmsMessage','findAll','rows','show','params','rawAttributes','create','body','find','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction'];(function(_0x24304c,_0x5c5332){var _0x457533=function(_0x340cdf){while(--_0x340cdf){_0x24304c['push'](_0x24304c['shift']());}};_0x457533(++_0x5c5332);}(_0x01a6,0x162));var _0x601a=function(_0x121c09,_0x11ce42){_0x121c09=_0x121c09-0x0;var _0x2b8005=_0x01a6[_0x121c09];return _0x2b8005;};'use strict';var emlformat=require(_0x601a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x601a('0x1'));var jsonpatch=require(_0x601a('0x2'));var rp=require(_0x601a('0x3'));var moment=require(_0x601a('0x4'));var BPromise=require(_0x601a('0x5'));var Mustache=require('mustache');var util=require(_0x601a('0x6'));var path=require('path');var sox=require(_0x601a('0x7'));var csv=require(_0x601a('0x8'));var ejs=require(_0x601a('0x9'));var fs=require('fs');var fs_extra=require(_0x601a('0xa'));var _=require(_0x601a('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x601a('0xc'));var deskjs=require(_0x601a('0xd'));var toCsv=require(_0x601a('0x8'));var querystring=require('querystring');var Papa=require(_0x601a('0xe'));var Redis=require(_0x601a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x601a('0x10'));var as=require(_0x601a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x601a('0x12'))(_0x601a('0x13'));var utils=require(_0x601a('0x14'));var config=require(_0x601a('0x15'));var licenseUtil=require(_0x601a('0x16'));var db=require(_0x601a('0x17'))['db'];config[_0x601a('0x18')]=_[_0x601a('0x19')](config[_0x601a('0x18')],{'host':_0x601a('0x1a'),'port':0x18eb});var socket=require(_0x601a('0x1b'))(new Redis(config['redis']));require(_0x601a('0x1c'))[_0x601a('0x1d')](socket);var jayson=require(_0x601a('0x1e'));var client=jayson[_0x601a('0x1f')][_0x601a('0x20')]({'port':0x232c});var client9002=jayson[_0x601a('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f7a46,_0x2ff56c,_0x164a5c,_0x31eefd){return new BPromise(function(_0x4e1ebf,_0x2e51dc){var _0x47cdc4=_0x31eefd||client;return _0x47cdc4[_0x601a('0x21')](_0x2f7a46,_0x164a5c)[_0x601a('0x22')](function(_0x359554){logger[_0x601a('0x23')](_0x601a('0x24'),_0x2ff56c,_0x601a('0x25'));logger[_0x601a('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2ff56c,_0x601a('0x25'),JSON[_0x601a('0x27')](_0x359554));if(_0x359554[_0x601a('0x28')]){if(_0x359554[_0x601a('0x28')][_0x601a('0x29')]===0x1f4){logger[_0x601a('0x28')](_0x601a('0x24'),_0x2ff56c,_0x359554['error'][_0x601a('0x2a')]);return _0x2e51dc(_0x359554['error']['message']);}logger[_0x601a('0x28')](_0x601a('0x24'),_0x2ff56c,_0x359554[_0x601a('0x28')][_0x601a('0x2a')]);return _0x4e1ebf(_0x359554['error'][_0x601a('0x2a')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x2ff56c,'request\x20sent');_0x4e1ebf(_0x359554['result']['message']);}})[_0x601a('0x2b')](function(_0x599d71){logger[_0x601a('0x28')](_0x601a('0x24'),_0x2ff56c,_0x599d71);_0x2e51dc(_0x599d71);});});}function respondWithStatusCode(_0x29ec51,_0x233f5d){_0x233f5d=_0x233f5d||0xcc;return function(_0x540462){if(_0x540462){return _0x29ec51[_0x601a('0x2c')](_0x233f5d);}return _0x29ec51[_0x601a('0x2d')](_0x233f5d)['end']();};}function respondWithResult(_0x30ca00,_0x335581){_0x335581=_0x335581||0xc8;return function(_0x36c19f){if(_0x36c19f){return _0x30ca00[_0x601a('0x2d')](_0x335581)[_0x601a('0x2e')](_0x36c19f);}};}function respondWithFilteredResult(_0x564b9d,_0xe4ca6e){return function(_0x2126b2){if(_0x2126b2){var _0x9e08f4=typeof _0xe4ca6e[_0x601a('0x2f')]===_0x601a('0x30')&&typeof _0xe4ca6e['limit']===_0x601a('0x30');var _0x43f7a7=_0x2126b2['count'];var _0x44d27f=_0x9e08f4?0x0:_0xe4ca6e[_0x601a('0x2f')];var _0x2c764a=_0x9e08f4?_0x2126b2['count']:_0xe4ca6e['offset']+_0xe4ca6e[_0x601a('0x31')];var _0x27e660;if(_0x2c764a>=_0x43f7a7){_0x2c764a=_0x43f7a7;_0x27e660=0xc8;}else{_0x27e660=0xce;}_0x564b9d[_0x601a('0x2d')](_0x27e660);return _0x564b9d['set'](_0x601a('0x32'),_0x44d27f+'-'+_0x2c764a+'/'+_0x43f7a7)['json'](_0x2126b2);}return null;};}function patchUpdates(_0x2d790d){return function(_0x4ec041){try{jsonpatch[_0x601a('0x33')](_0x4ec041,_0x2d790d,!![]);}catch(_0x3afaea){return BPromise[_0x601a('0x34')](_0x3afaea);}return _0x4ec041[_0x601a('0x35')]();};}function saveUpdates(_0x468010,_0x3be4f1){return function(_0x5b9be0){if(_0x5b9be0){return _0x5b9be0[_0x601a('0x36')](_0x468010)[_0x601a('0x22')](function(_0x1a82d0){return _0x1a82d0;});}return null;};}function removeEntity(_0x32d5d1,_0x27154a){return function(_0x544ecc){if(_0x544ecc){return _0x544ecc[_0x601a('0x37')]()['then'](function(){_0x32d5d1[_0x601a('0x2d')](0xcc)[_0x601a('0x38')]();});}};}function handleEntityNotFound(_0x27633f,_0x33125f){return function(_0x16ea11){if(!_0x16ea11){_0x27633f[_0x601a('0x2c')](0x194);}return _0x16ea11;};}function handleError(_0x325620,_0x4f491b){_0x4f491b=_0x4f491b||0x1f4;return function(_0x3de417){logger[_0x601a('0x28')](_0x3de417[_0x601a('0x39')]);if(_0x3de417[_0x601a('0x3a')]){delete _0x3de417[_0x601a('0x3a')];}_0x325620[_0x601a('0x2d')](_0x4f491b)['send'](_0x3de417);};}exports[_0x601a('0x3b')]=function(_0x1aaaa0,_0x8af62e){var _0x1d0830={},_0xe9b1db={},_0x366690={'count':0x0,'rows':[]};var _0x2baf74=_[_0x601a('0x3c')](db['SmsMessage']['rawAttributes'],function(_0x583db4){return{'name':_0x583db4[_0x601a('0x3d')],'type':_0x583db4[_0x601a('0x3e')][_0x601a('0x3f')]};});_0xe9b1db[_0x601a('0x40')]=_[_0x601a('0x3c')](_0x2baf74,_0x601a('0x3a'));_0xe9b1db['query']=_[_0x601a('0x41')](_0x1aaaa0['query']);_0xe9b1db[_0x601a('0x42')]=_[_0x601a('0x43')](_0xe9b1db['model'],_0xe9b1db['query']);_0x1d0830[_0x601a('0x44')]=_[_0x601a('0x43')](_0xe9b1db[_0x601a('0x40')],qs[_0x601a('0x45')](_0x1aaaa0[_0x601a('0x46')]['fields']));_0x1d0830[_0x601a('0x44')]=_0x1d0830[_0x601a('0x44')][_0x601a('0x47')]?_0x1d0830[_0x601a('0x44')]:_0xe9b1db[_0x601a('0x40')];if(!_0x1aaaa0[_0x601a('0x46')][_0x601a('0x48')](_0x601a('0x49'))){_0x1d0830[_0x601a('0x31')]=qs['limit'](_0x1aaaa0[_0x601a('0x46')]['limit']);_0x1d0830[_0x601a('0x2f')]=qs[_0x601a('0x2f')](_0x1aaaa0[_0x601a('0x46')]['offset']);}_0x1d0830[_0x601a('0x4a')]=qs[_0x601a('0x4b')](_0x1aaaa0[_0x601a('0x46')]['sort']);_0x1d0830[_0x601a('0x4c')]=qs[_0x601a('0x42')](_['pick'](_0x1aaaa0[_0x601a('0x46')],_0xe9b1db[_0x601a('0x42')]),_0x2baf74);if(_0x1aaaa0[_0x601a('0x46')][_0x601a('0x4d')]){_0x1d0830['where']=_[_0x601a('0x4e')](_0x1d0830[_0x601a('0x4c')],{'$or':_['map'](_0x2baf74,function(_0x5b470f){if(_0x5b470f['type']!=='VIRTUAL'){var _0x45994a={};_0x45994a[_0x5b470f[_0x601a('0x3a')]]={'$like':'%'+_0x1aaaa0[_0x601a('0x46')][_0x601a('0x4d')]+'%'};return _0x45994a;}})});}_0x1d0830=_[_0x601a('0x4e')]({},_0x1d0830,_0x1aaaa0[_0x601a('0x4f')]);var _0x1ef934={'where':_0x1d0830[_0x601a('0x4c')]};return db['SmsMessage']['count'](_0x1ef934)[_0x601a('0x22')](function(_0x2fb89e){_0x366690[_0x601a('0x50')]=_0x2fb89e;if(_0x1aaaa0['query'][_0x601a('0x51')]){_0x1d0830[_0x601a('0x52')]=[{'all':!![]}];}return db[_0x601a('0x53')][_0x601a('0x54')](_0x1d0830);})['then'](function(_0x244b56){_0x366690[_0x601a('0x55')]=_0x244b56;return _0x366690;})[_0x601a('0x22')](respondWithFilteredResult(_0x8af62e,_0x1d0830))[_0x601a('0x2b')](handleError(_0x8af62e,null));};exports[_0x601a('0x56')]=function(_0x19c461,_0x16c69c){var _0x48b427={'raw':!![],'where':{'id':_0x19c461[_0x601a('0x57')]['id']}},_0xda8991={};_0xda8991[_0x601a('0x40')]=_[_0x601a('0x41')](db[_0x601a('0x53')][_0x601a('0x58')]);_0xda8991[_0x601a('0x46')]=_[_0x601a('0x41')](_0x19c461['query']);_0xda8991[_0x601a('0x42')]=_['intersection'](_0xda8991['model'],_0xda8991['query']);_0x48b427[_0x601a('0x44')]=_[_0x601a('0x43')](_0xda8991[_0x601a('0x40')],qs[_0x601a('0x45')](_0x19c461[_0x601a('0x46')][_0x601a('0x45')]));_0x48b427[_0x601a('0x44')]=_0x48b427[_0x601a('0x44')]['length']?_0x48b427[_0x601a('0x44')]:_0xda8991['model'];if(_0x19c461[_0x601a('0x46')]['includeAll']){_0x48b427[_0x601a('0x52')]=[{'all':!![]}];}_0x48b427=_['merge']({},_0x48b427,_0x19c461[_0x601a('0x4f')]);return db[_0x601a('0x53')]['find'](_0x48b427)[_0x601a('0x22')](handleEntityNotFound(_0x16c69c,null))[_0x601a('0x22')](respondWithResult(_0x16c69c,null))[_0x601a('0x2b')](handleError(_0x16c69c,null));};exports[_0x601a('0x59')]=function(_0x2562f5,_0x418984){return db[_0x601a('0x53')][_0x601a('0x59')](_0x2562f5[_0x601a('0x5a')],{})[_0x601a('0x22')](respondWithResult(_0x418984,0xc9))['catch'](handleError(_0x418984,null));};exports[_0x601a('0x36')]=function(_0x44fb33,_0xff10ee){if(_0x44fb33[_0x601a('0x5a')]['id']){delete _0x44fb33['body']['id'];}return db[_0x601a('0x53')][_0x601a('0x5b')]({'where':{'id':_0x44fb33['params']['id']}})['then'](handleEntityNotFound(_0xff10ee,null))[_0x601a('0x22')](saveUpdates(_0x44fb33['body'],null))[_0x601a('0x22')](respondWithResult(_0xff10ee,null))['catch'](handleError(_0xff10ee,null));};exports[_0x601a('0x37')]=function(_0x2e972f,_0x5aa2e5){return db[_0x601a('0x53')][_0x601a('0x5b')]({'where':{'id':_0x2e972f[_0x601a('0x57')]['id']}})['then'](handleEntityNotFound(_0x5aa2e5,null))[_0x601a('0x22')](removeEntity(_0x5aa2e5,null))[_0x601a('0x2b')](handleError(_0x5aa2e5,null));};exports['describe']=function(_0x5a7046,_0x47da42){return db[_0x601a('0x53')][_0x601a('0x5c')]()[_0x601a('0x22')](respondWithResult(_0x47da42,null))[_0x601a('0x2b')](handleError(_0x47da42,null));};var interaction_log=require('../../config/logger')(_0x601a('0x5d'));exports[_0x601a('0x5e')]=function(_0x7466ce,_0xb48a57,_0x20bacc){var _0x4c95e1={'agent':{},'channel':_0x601a('0x5f')};if(_0x7466ce[_0x601a('0x5a')]['id']){delete _0x7466ce['body']['id'];}_0x7466ce[_0x601a('0x5a')][_0x601a('0x60')]=!![];_0x7466ce[_0x601a('0x5a')][_0x601a('0x61')]=moment()[_0x601a('0x62')](_0x601a('0x63'));_0x7466ce[_0x601a('0x5a')][_0x601a('0x64')]=_0x7466ce[_0x601a('0x5a')][_0x601a('0x64')]||_0x7466ce['user']['id'];_0x4c95e1[_0x601a('0x65')]['id']=_0x7466ce[_0x601a('0x5a')][_0x601a('0x64')];return db[_0x601a('0x53')][_0x601a('0x5b')]({'where':{'id':_0x7466ce[_0x601a('0x57')]['id'],'UserId':null}})[_0x601a('0x22')](handleEntityNotFound(_0xb48a57,null))[_0x601a('0x22')](saveUpdates(_0x7466ce[_0x601a('0x5a')],null))['then'](function(_0x3006c1){if(_0x3006c1){_0x4c95e1['message']=_0x3006c1[_0x601a('0x66')]({'plain':!![]});return db[_0x601a('0x67')][_0x601a('0x5b')]({'where':{'id':_0x3006c1[_0x601a('0x68')]}});}return null;})[_0x601a('0x22')](handleEntityNotFound(_0xb48a57,null))[_0x601a('0x22')](function(_0x57e431){if(_0x57e431){return _0x57e431[_0x601a('0x36')]({'UserId':_0x7466ce['body'][_0x601a('0x64')],'read1stAt':_[_0x601a('0x69')](_0x57e431[_0x601a('0x6a')])?moment()[_0x601a('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x601a('0x22')](function(_0x522f43){if(_0x522f43){_0x4c95e1[_0x601a('0x6b')]=_0x522f43[_0x601a('0x66')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x7466ce[_0x601a('0x6c')]['id'],_0x7466ce[_0x601a('0x6c')][_0x601a('0x3a')],_0x7466ce['user'][_0x601a('0x6d')],_0x4c95e1[_0x601a('0x6b')]['id'],_0x7466ce['body']?JSON['stringify'](_0x7466ce[_0x601a('0x5a')]):_0x601a('0x6e'));return respondWithRpcPromise(_0x601a('0x6f'),_0x601a('0x70'),_0x4c95e1);}return null;})['then'](function(_0x4e9765){var _0x40ee80=_0x601a('0x71')+_0x4e9765[_0x601a('0x2a')][_0x601a('0x72')];return db[_0x601a('0x73')]['query'](_0x40ee80,{'type':db[_0x601a('0x74')][_0x601a('0x75')][_0x601a('0x76')],'raw':!![]})[_0x601a('0x22')](function(_0x1dd286){return _0x1dd286;});})['then'](function(_0x160fda){if(_0x160fda){_0x4c95e1[_0x601a('0x2a')][_0x601a('0x77')]=_0x160fda[0x0];if(!_0x7466ce[_0x601a('0x5a')][_0x601a('0x64')])return;return db[_0x601a('0x78')][_0x601a('0x5b')]({'where':{'id':_0x7466ce[_0x601a('0x5a')][_0x601a('0x64')],'role':'agent'},'attributes':['id',_0x601a('0x3a'),_0x601a('0x79'),_0x601a('0x7a'),_0x601a('0x7b')],'raw':!![]});}return null;})[_0x601a('0x22')](function(_0x343bf6){if(!_0x343bf6)return null;_0x4c95e1[_0x601a('0x2a')][_0x601a('0x65')]=_0x343bf6;return _0x4c95e1;})[_0x601a('0x22')](function(_0x54d5c8){if(_0x54d5c8){if(_0x7466ce['body'][_0x601a('0x7c')]){_0x4c95e1[_0x601a('0x2a')][_0x601a('0x7d')]=util[_0x601a('0x62')](_0x601a('0x7e'),_0x7466ce[_0x601a('0x6c')][_0x601a('0x3a')]);_0x4c95e1[_0x601a('0x2a')][_0x601a('0x7f')]=_0x4c95e1[_0x601a('0x7f')];_0x4c95e1[_0x601a('0x2a')][_0x601a('0x80')]=_0x4c95e1['channel'];_0x4c95e1[_0x601a('0x2a')][_0x601a('0x81')]=_0x601a('0x5e');return respondWithRpcPromise(_0x601a('0x82'),_0x601a('0x82'),{'event':_0x601a('0x83'),'message':_0x4c95e1[_0x601a('0x2a')]},client9002)[_0x601a('0x22')](function(){return _0x4c95e1;});}return _0x4c95e1;}return null;})[_0x601a('0x22')](respondWithResult(_0xb48a57,null))['catch'](handleError(_0xb48a57,null));};var interaction_log=require(_0x601a('0x12'))('sms-interactions');exports[_0x601a('0x34')]=function(_0x45857d,_0x35e074,_0x20d39f){var _0x175237={'agent':{},'channel':'sms'};if(_0x45857d['body']['id']){delete _0x45857d['body']['id'];}_0x45857d[_0x601a('0x5a')]['UserId']=_0x45857d[_0x601a('0x5a')][_0x601a('0x64')]||_0x45857d[_0x601a('0x6c')]['id'];_0x175237['agent']['id']=_0x45857d[_0x601a('0x5a')][_0x601a('0x64')];return db[_0x601a('0x53')]['find']({'where':{'id':_0x45857d[_0x601a('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x35e074,null))[_0x601a('0x22')](function(_0x5aeb4a){if(_0x5aeb4a){_0x175237[_0x601a('0x2a')]=_0x5aeb4a[_0x601a('0x66')]({'plain':!![]});return db[_0x601a('0x67')]['find']({'where':{'id':_0x5aeb4a[_0x601a('0x68')]}});}return null;})[_0x601a('0x22')](handleEntityNotFound(_0x35e074,null))[_0x601a('0x22')](function(_0x71a7b4){if(_0x71a7b4){_0x175237[_0x601a('0x6b')]=_0x71a7b4['get']({'plain':!![]});interaction_log[_0x601a('0x23')](_0x601a('0x84'),_0x45857d[_0x601a('0x6c')]['id'],_0x45857d['user'][_0x601a('0x3a')],_0x45857d[_0x601a('0x6c')]['role'],_0x175237[_0x601a('0x6b')]['id'],_0x45857d['body']?JSON[_0x601a('0x27')](_0x45857d['body']):_0x601a('0x6e'));return respondWithRpcPromise('RejectMessage',_0x601a('0x85'),_0x175237);}return null;})[_0x601a('0x22')](function(_0x5e6edf){var _0x43a354='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5e6edf['message']['ContactId'];return db['sequelize']['query'](_0x43a354,{'type':db['Sequelize'][_0x601a('0x75')][_0x601a('0x76')],'raw':!![]})['then'](function(_0xac6e06){return _0xac6e06;});})[_0x601a('0x22')](function(_0x4a6dfd){if(_0x4a6dfd){_0x175237[_0x601a('0x2a')]['contact']=_0x4a6dfd[0x0];if(!_0x45857d[_0x601a('0x5a')][_0x601a('0x64')])return;return db[_0x601a('0x78')]['find']({'where':{'id':_0x45857d[_0x601a('0x5a')][_0x601a('0x64')],'role':_0x601a('0x65')},'attributes':['id',_0x601a('0x3a'),_0x601a('0x79'),_0x601a('0x7a'),_0x601a('0x7b')],'raw':!![]});}return null;})[_0x601a('0x22')](function(_0x5e9fcc){if(!_0x5e9fcc)return null;_0x175237[_0x601a('0x2a')][_0x601a('0x65')]=_0x5e9fcc;return _0x175237;})[_0x601a('0x22')](function(_0x17f640){if(_0x17f640){_0x17f640[_0x601a('0x2a')]['interface']=util[_0x601a('0x62')](_0x601a('0x7e'),_0x45857d['user'][_0x601a('0x3a')]);_0x17f640[_0x601a('0x2a')][_0x601a('0x7f')]=_0x175237[_0x601a('0x7f')];_0x17f640[_0x601a('0x2a')][_0x601a('0x80')]=_0x175237[_0x601a('0x7f')];_0x17f640[_0x601a('0x2a')][_0x601a('0x81')]=_0x601a('0x34');respondWithRpcPromise('EventManager','EventManager',{'event':_0x601a('0x86'),'message':_0x17f640[_0x601a('0x2a')]},client9002);return _0x175237;}return null;})['then'](respondWithResult(_0x35e074,null))[_0x601a('0x2b')](handleError(_0x35e074,null));};exports[_0x601a('0x2d')]=function(_0x352577,_0x1c9a4b,_0x4e10a1){if(_0x352577[_0x601a('0x5a')]['id']){delete _0x352577[_0x601a('0x5a')]['id'];}var _0xf0373d;return db[_0x601a('0x53')][_0x601a('0x5b')]({'where':{'id':_0x352577[_0x601a('0x57')]['id']}})[_0x601a('0x22')](handleEntityNotFound(_0x1c9a4b,null))[_0x601a('0x22')](function(_0x209e90){if(_0x209e90){_0xf0373d=_0x209e90;return db[_0x601a('0x87')][_0x601a('0x5b')]({'where':{'id':_0x209e90[_0x601a('0x88')]}});}})['then'](handleEntityNotFound(_0x1c9a4b,null))[_0x601a('0x22')](function(_0x53b66a){if(_0x53b66a){logger[_0x601a('0x26')](_0x601a('0x89'),_0x601a('0x2d'),_0x601a('0x8a'),_0x53b66a[_0x601a('0x3e')],util[_0x601a('0x8b')](_0x352577[_0x601a('0x5a')],{'showHidden':![],'depth':null}));switch(_0x53b66a[_0x601a('0x3e')]){case _0x601a('0x8c'):if(_0x352577['body'][_0x601a('0x8d')]&&_0x352577['body'][_0x601a('0x8d')]===_0xf0373d[_0x601a('0x8e')]){return _0xf0373d[_0x601a('0x36')]({'read':!![]});}else{logger[_0x601a('0x28')](_0x601a('0x8f'),'status',_0x601a('0x8c'),util['inspect'](_0x352577[_0x601a('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x601a('0x90'):if(_0x352577[_0x601a('0x5a')][_0x601a('0x91')]&&_0x352577['body'][_0x601a('0x91')]===_0xf0373d['messageId']&&_[_0x601a('0x92')]([_0x601a('0x93'),'delivered'],_0x352577[_0x601a('0x5a')][_0x601a('0x94')])>=0x0){return _0xf0373d['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x601a('0x95'),util['inspect'](_0x352577[_0x601a('0x5a')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x46e6c1=_0x352577[_0x601a('0x5a')][_0x601a('0x96')][0x0];if(_0x46e6c1[_0x601a('0x2d')][_0x601a('0x97')]===_0x601a('0x98')){return _0xf0373d[_0x601a('0x36')]({'read':!![]});}else{logger[_0x601a('0x28')](_0x601a('0x8f'),_0x601a('0x2d'),_0x601a('0x99'),util[_0x601a('0x8b')](_0x352577[_0x601a('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0xf0373d;}})[_0x601a('0x22')](respondWithResult(_0x1c9a4b,null))[_0x601a('0x2b')](handleError(_0x1c9a4b,null));}; \ No newline at end of file +var _0x3bd3=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','destroy','end','stack','name','send','index','SmsMessage','type','key','map','keys','filters','intersection','model','attributes','fields','query','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','create','body','find','describe','sms-interactions','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteraction','SmsInteractionId','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','fullname','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT','contact','User','email','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','MessageUUID','indexOf','sent','Status','plivio','groupName','DELIVERED','infobip','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0x3bd3,0x110));var _0x33bd=function(_0x46ac4d,_0x46fa04){_0x46ac4d=_0x46ac4d-0x0;var _0x2cb141=_0x3bd3[_0x46ac4d];return _0x2cb141;};'use strict';var emlformat=require(_0x33bd('0x0'));var rimraf=require(_0x33bd('0x1'));var zipdir=require(_0x33bd('0x2'));var jsonpatch=require(_0x33bd('0x3'));var rp=require(_0x33bd('0x4'));var moment=require(_0x33bd('0x5'));var BPromise=require(_0x33bd('0x6'));var Mustache=require(_0x33bd('0x7'));var util=require(_0x33bd('0x8'));var path=require('path');var sox=require(_0x33bd('0x9'));var csv=require(_0x33bd('0xa'));var ejs=require(_0x33bd('0xb'));var fs=require('fs');var fs_extra=require(_0x33bd('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x33bd('0xd'));var jsforce=require(_0x33bd('0xe'));var deskjs=require(_0x33bd('0xf'));var toCsv=require(_0x33bd('0xa'));var querystring=require(_0x33bd('0x10'));var Papa=require(_0x33bd('0x11'));var Redis=require(_0x33bd('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x33bd('0x13'));var as=require(_0x33bd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x33bd('0x15'))(_0x33bd('0x16'));var utils=require(_0x33bd('0x17'));var config=require(_0x33bd('0x18'));var licenseUtil=require(_0x33bd('0x19'));var db=require(_0x33bd('0x1a'))['db'];config[_0x33bd('0x1b')]=_[_0x33bd('0x1c')](config[_0x33bd('0x1b')],{'host':_0x33bd('0x1d'),'port':0x18eb});var socket=require(_0x33bd('0x1e'))(new Redis(config[_0x33bd('0x1b')]));require('./smsMessage.socket')[_0x33bd('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x33bd('0x20')][_0x33bd('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x33bd('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x281d64,_0x2654c6,_0xf70c61,_0x321d73){return new BPromise(function(_0x138cf3,_0x129792){var _0x18f545=_0x321d73||client;return _0x18f545['request'](_0x281d64,_0xf70c61)[_0x33bd('0x22')](function(_0x312695){logger['info'](_0x33bd('0x23'),_0x2654c6,_0x33bd('0x24'));logger[_0x33bd('0x25')](_0x33bd('0x26'),_0x2654c6,_0x33bd('0x24'),JSON['stringify'](_0x312695));if(_0x312695[_0x33bd('0x27')]){if(_0x312695['error'][_0x33bd('0x28')]===0x1f4){logger[_0x33bd('0x27')](_0x33bd('0x23'),_0x2654c6,_0x312695['error'][_0x33bd('0x29')]);return _0x129792(_0x312695[_0x33bd('0x27')][_0x33bd('0x29')]);}logger[_0x33bd('0x27')]('SmsMessage,\x20%s,\x20%s',_0x2654c6,_0x312695['error'][_0x33bd('0x29')]);return _0x138cf3(_0x312695[_0x33bd('0x27')][_0x33bd('0x29')]);}else{logger[_0x33bd('0x2a')](_0x33bd('0x23'),_0x2654c6,_0x33bd('0x24'));_0x138cf3(_0x312695[_0x33bd('0x2b')]['message']);}})[_0x33bd('0x2c')](function(_0x11d5a6){logger[_0x33bd('0x27')]('SmsMessage,\x20%s,\x20%s',_0x2654c6,_0x11d5a6);_0x129792(_0x11d5a6);});});}function respondWithStatusCode(_0x5b75dc,_0x43e5c3){_0x43e5c3=_0x43e5c3||0xcc;return function(_0x3ac779){if(_0x3ac779){return _0x5b75dc[_0x33bd('0x2d')](_0x43e5c3);}return _0x5b75dc[_0x33bd('0x2e')](_0x43e5c3)['end']();};}function respondWithResult(_0x3b9be8,_0x2da86f){_0x2da86f=_0x2da86f||0xc8;return function(_0x29b33c){if(_0x29b33c){return _0x3b9be8[_0x33bd('0x2e')](_0x2da86f)['json'](_0x29b33c);}};}function respondWithFilteredResult(_0x382f79,_0x18920c){return function(_0x30d2ed){if(_0x30d2ed){var _0x296795=typeof _0x18920c[_0x33bd('0x2f')]==='undefined'&&typeof _0x18920c[_0x33bd('0x30')]==='undefined';var _0x4da374=_0x30d2ed[_0x33bd('0x31')];var _0x3642ef=_0x296795?0x0:_0x18920c[_0x33bd('0x2f')];var _0x2caa20=_0x296795?_0x30d2ed['count']:_0x18920c['offset']+_0x18920c['limit'];var _0x135d8d;if(_0x2caa20>=_0x4da374){_0x2caa20=_0x4da374;_0x135d8d=0xc8;}else{_0x135d8d=0xce;}_0x382f79['status'](_0x135d8d);return _0x382f79[_0x33bd('0x32')](_0x33bd('0x33'),_0x3642ef+'-'+_0x2caa20+'/'+_0x4da374)[_0x33bd('0x34')](_0x30d2ed);}return null;};}function patchUpdates(_0x24ff3e){return function(_0x79326e){try{jsonpatch['apply'](_0x79326e,_0x24ff3e,!![]);}catch(_0x414799){return BPromise[_0x33bd('0x35')](_0x414799);}return _0x79326e[_0x33bd('0x36')]();};}function saveUpdates(_0x121097,_0x4d4539){return function(_0x1546e6){if(_0x1546e6){return _0x1546e6[_0x33bd('0x37')](_0x121097)[_0x33bd('0x22')](function(_0xe0a377){return _0xe0a377;});}return null;};}function removeEntity(_0x4628b7,_0x417052){return function(_0x3d81fd){if(_0x3d81fd){return _0x3d81fd[_0x33bd('0x38')]()[_0x33bd('0x22')](function(){_0x4628b7[_0x33bd('0x2e')](0xcc)[_0x33bd('0x39')]();});}};}function handleEntityNotFound(_0x58c027,_0x2c600f){return function(_0x52df70){if(!_0x52df70){_0x58c027[_0x33bd('0x2d')](0x194);}return _0x52df70;};}function handleError(_0x547d92,_0x100f2e){_0x100f2e=_0x100f2e||0x1f4;return function(_0x152d0a){logger['error'](_0x152d0a[_0x33bd('0x3a')]);if(_0x152d0a[_0x33bd('0x3b')]){delete _0x152d0a[_0x33bd('0x3b')];}_0x547d92[_0x33bd('0x2e')](_0x100f2e)[_0x33bd('0x3c')](_0x152d0a);};}exports[_0x33bd('0x3d')]=function(_0xe574ce,_0x3a2aa6){var _0x302db6={},_0x59b6e3={},_0x1a929b={'count':0x0,'rows':[]};var _0x748b8c=_['map'](db[_0x33bd('0x3e')]['rawAttributes'],function(_0x1e1f19){return{'name':_0x1e1f19['fieldName'],'type':_0x1e1f19[_0x33bd('0x3f')][_0x33bd('0x40')]};});_0x59b6e3['model']=_[_0x33bd('0x41')](_0x748b8c,_0x33bd('0x3b'));_0x59b6e3['query']=_[_0x33bd('0x42')](_0xe574ce['query']);_0x59b6e3[_0x33bd('0x43')]=_[_0x33bd('0x44')](_0x59b6e3[_0x33bd('0x45')],_0x59b6e3['query']);_0x302db6[_0x33bd('0x46')]=_[_0x33bd('0x44')](_0x59b6e3[_0x33bd('0x45')],qs[_0x33bd('0x47')](_0xe574ce[_0x33bd('0x48')]['fields']));_0x302db6['attributes']=_0x302db6[_0x33bd('0x46')]['length']?_0x302db6[_0x33bd('0x46')]:_0x59b6e3[_0x33bd('0x45')];if(!_0xe574ce[_0x33bd('0x48')][_0x33bd('0x49')]('nolimit')){_0x302db6[_0x33bd('0x30')]=qs['limit'](_0xe574ce['query'][_0x33bd('0x30')]);_0x302db6[_0x33bd('0x2f')]=qs[_0x33bd('0x2f')](_0xe574ce[_0x33bd('0x48')][_0x33bd('0x2f')]);}_0x302db6[_0x33bd('0x4a')]=qs['sort'](_0xe574ce[_0x33bd('0x48')][_0x33bd('0x4b')]);_0x302db6['where']=qs[_0x33bd('0x43')](_[_0x33bd('0x4c')](_0xe574ce[_0x33bd('0x48')],_0x59b6e3[_0x33bd('0x43')]),_0x748b8c);if(_0xe574ce[_0x33bd('0x48')][_0x33bd('0x4d')]){_0x302db6[_0x33bd('0x4e')]=_['merge'](_0x302db6['where'],{'$or':_[_0x33bd('0x41')](_0x748b8c,function(_0xdf5551){if(_0xdf5551[_0x33bd('0x3f')]!=='VIRTUAL'){var _0x28c91b={};_0x28c91b[_0xdf5551['name']]={'$like':'%'+_0xe574ce[_0x33bd('0x48')]['filter']+'%'};return _0x28c91b;}})});}_0x302db6=_[_0x33bd('0x4f')]({},_0x302db6,_0xe574ce[_0x33bd('0x50')]);var _0x2e1f9e={'where':_0x302db6[_0x33bd('0x4e')]};return db[_0x33bd('0x3e')][_0x33bd('0x31')](_0x2e1f9e)['then'](function(_0x34a300){_0x1a929b['count']=_0x34a300;if(_0xe574ce['query'][_0x33bd('0x51')]){_0x302db6[_0x33bd('0x52')]=[{'all':!![]}];}return db['SmsMessage'][_0x33bd('0x53')](_0x302db6);})[_0x33bd('0x22')](function(_0x3a5d6c){_0x1a929b[_0x33bd('0x54')]=_0x3a5d6c;return _0x1a929b;})[_0x33bd('0x22')](respondWithFilteredResult(_0x3a2aa6,_0x302db6))[_0x33bd('0x2c')](handleError(_0x3a2aa6,null));};exports[_0x33bd('0x55')]=function(_0x43d452,_0x1e0ae7){var _0x25ae68={'raw':!![],'where':{'id':_0x43d452[_0x33bd('0x56')]['id']}},_0x5a8a24={};_0x5a8a24['model']=_[_0x33bd('0x42')](db[_0x33bd('0x3e')][_0x33bd('0x57')]);_0x5a8a24[_0x33bd('0x48')]=_[_0x33bd('0x42')](_0x43d452[_0x33bd('0x48')]);_0x5a8a24[_0x33bd('0x43')]=_[_0x33bd('0x44')](_0x5a8a24[_0x33bd('0x45')],_0x5a8a24['query']);_0x25ae68[_0x33bd('0x46')]=_[_0x33bd('0x44')](_0x5a8a24[_0x33bd('0x45')],qs[_0x33bd('0x47')](_0x43d452[_0x33bd('0x48')][_0x33bd('0x47')]));_0x25ae68[_0x33bd('0x46')]=_0x25ae68[_0x33bd('0x46')][_0x33bd('0x58')]?_0x25ae68['attributes']:_0x5a8a24[_0x33bd('0x45')];if(_0x43d452[_0x33bd('0x48')][_0x33bd('0x51')]){_0x25ae68[_0x33bd('0x52')]=[{'all':!![]}];}_0x25ae68=_[_0x33bd('0x4f')]({},_0x25ae68,_0x43d452[_0x33bd('0x50')]);return db[_0x33bd('0x3e')]['find'](_0x25ae68)[_0x33bd('0x22')](handleEntityNotFound(_0x1e0ae7,null))[_0x33bd('0x22')](respondWithResult(_0x1e0ae7,null))[_0x33bd('0x2c')](handleError(_0x1e0ae7,null));};exports[_0x33bd('0x59')]=function(_0x4cbb38,_0x2bd994){return db[_0x33bd('0x3e')][_0x33bd('0x59')](_0x4cbb38['body'],{})[_0x33bd('0x22')](respondWithResult(_0x2bd994,0xc9))[_0x33bd('0x2c')](handleError(_0x2bd994,null));};exports['update']=function(_0x1cc421,_0x36e084){if(_0x1cc421[_0x33bd('0x5a')]['id']){delete _0x1cc421[_0x33bd('0x5a')]['id'];}return db['SmsMessage'][_0x33bd('0x5b')]({'where':{'id':_0x1cc421[_0x33bd('0x56')]['id']}})['then'](handleEntityNotFound(_0x36e084,null))['then'](saveUpdates(_0x1cc421['body'],null))['then'](respondWithResult(_0x36e084,null))[_0x33bd('0x2c')](handleError(_0x36e084,null));};exports[_0x33bd('0x38')]=function(_0x48283b,_0x4862f3){return db[_0x33bd('0x3e')]['find']({'where':{'id':_0x48283b[_0x33bd('0x56')]['id']}})[_0x33bd('0x22')](handleEntityNotFound(_0x4862f3,null))['then'](removeEntity(_0x4862f3,null))['catch'](handleError(_0x4862f3,null));};exports[_0x33bd('0x5c')]=function(_0x6d4800,_0x2b7bc1){return db[_0x33bd('0x3e')][_0x33bd('0x5c')]()[_0x33bd('0x22')](respondWithResult(_0x2b7bc1,null))[_0x33bd('0x2c')](handleError(_0x2b7bc1,null));};var interaction_log=require(_0x33bd('0x15'))(_0x33bd('0x5d'));exports['accept']=function(_0x49f480,_0x5da690,_0x509523){var _0x239ba4={'agent':{},'channel':_0x33bd('0x5e')};if(_0x49f480[_0x33bd('0x5a')]['id']){delete _0x49f480[_0x33bd('0x5a')]['id'];}_0x49f480[_0x33bd('0x5a')][_0x33bd('0x5f')]=!![];_0x49f480[_0x33bd('0x5a')]['readAt']=moment()[_0x33bd('0x60')](_0x33bd('0x61'));_0x49f480['body']['UserId']=_0x49f480['body'][_0x33bd('0x62')]||_0x49f480['user']['id'];_0x239ba4[_0x33bd('0x63')]['id']=_0x49f480[_0x33bd('0x5a')]['UserId'];return db[_0x33bd('0x3e')][_0x33bd('0x5b')]({'where':{'id':_0x49f480[_0x33bd('0x56')]['id'],'UserId':null}})[_0x33bd('0x22')](handleEntityNotFound(_0x5da690,null))[_0x33bd('0x22')](saveUpdates(_0x49f480[_0x33bd('0x5a')],null))['then'](function(_0x1c9d5a){if(_0x1c9d5a){_0x239ba4[_0x33bd('0x29')]=_0x1c9d5a[_0x33bd('0x64')]({'plain':!![]});return db[_0x33bd('0x65')][_0x33bd('0x5b')]({'where':{'id':_0x1c9d5a[_0x33bd('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x5da690,null))[_0x33bd('0x22')](function(_0x3d33cb){if(_0x3d33cb){return _0x3d33cb[_0x33bd('0x37')]({'UserId':_0x49f480['body']['UserId'],'read1stAt':_['isNil'](_0x3d33cb[_0x33bd('0x67')])?moment()[_0x33bd('0x60')](_0x33bd('0x61')):undefined});}return null;})[_0x33bd('0x22')](function(_0x1d95d1){if(_0x1d95d1){_0x239ba4[_0x33bd('0x68')]=_0x1d95d1['get']({'plain':!![]});interaction_log[_0x33bd('0x2a')](_0x33bd('0x69'),_0x49f480[_0x33bd('0x6a')]['id'],_0x49f480[_0x33bd('0x6a')][_0x33bd('0x3b')],_0x49f480['user'][_0x33bd('0x6b')],_0x239ba4[_0x33bd('0x68')]['id'],_0x49f480[_0x33bd('0x5a')]?JSON[_0x33bd('0x6c')](_0x49f480[_0x33bd('0x5a')]):'null');return respondWithRpcPromise(_0x33bd('0x6d'),_0x33bd('0x6e'),_0x239ba4);}return null;})[_0x33bd('0x22')](function(_0x8e94f1){var _0x17be33=_0x33bd('0x6f')+_0x8e94f1[_0x33bd('0x29')][_0x33bd('0x70')];return db[_0x33bd('0x71')][_0x33bd('0x48')](_0x17be33,{'type':db['Sequelize'][_0x33bd('0x72')]['SELECT'],'raw':!![]})[_0x33bd('0x22')](function(_0x528d38){return _0x528d38;});})[_0x33bd('0x22')](function(_0x23e26c){if(_0x23e26c){_0x239ba4[_0x33bd('0x29')]['contact']=_0x23e26c[0x0];if(!_0x49f480[_0x33bd('0x5a')][_0x33bd('0x62')])return;return db['User'][_0x33bd('0x5b')]({'where':{'id':_0x49f480[_0x33bd('0x5a')]['UserId'],'role':'agent'},'attributes':['id','name',_0x33bd('0x73'),'email',_0x33bd('0x74')],'raw':!![]});}return null;})[_0x33bd('0x22')](function(_0x3c87f7){if(!_0x3c87f7)return null;_0x239ba4[_0x33bd('0x29')][_0x33bd('0x63')]=_0x3c87f7;return _0x239ba4;})['then'](function(_0x3d7878){if(_0x3d7878){if(_0x49f480[_0x33bd('0x5a')]['manual']){_0x239ba4[_0x33bd('0x29')][_0x33bd('0x75')]=util[_0x33bd('0x60')](_0x33bd('0x76'),_0x49f480['user'][_0x33bd('0x3b')]);_0x239ba4['message']['channel']=_0x239ba4[_0x33bd('0x77')];_0x239ba4['message'][_0x33bd('0x78')]=_0x239ba4[_0x33bd('0x77')];_0x239ba4['message'][_0x33bd('0x79')]='accept';return respondWithRpcPromise(_0x33bd('0x7a'),_0x33bd('0x7a'),{'event':_0x33bd('0x7b'),'message':_0x239ba4[_0x33bd('0x29')]},client9002)[_0x33bd('0x22')](function(){return _0x239ba4;});}return _0x239ba4;}return null;})['then'](respondWithResult(_0x5da690,null))['catch'](handleError(_0x5da690,null));};var interaction_log=require('../../config/logger')(_0x33bd('0x5d'));exports['reject']=function(_0x248e6e,_0x4b7a14,_0x3a89c7){var _0x59c083={'agent':{},'channel':'sms'};if(_0x248e6e[_0x33bd('0x5a')]['id']){delete _0x248e6e['body']['id'];}_0x248e6e[_0x33bd('0x5a')]['UserId']=_0x248e6e[_0x33bd('0x5a')][_0x33bd('0x62')]||_0x248e6e['user']['id'];_0x59c083['agent']['id']=_0x248e6e[_0x33bd('0x5a')][_0x33bd('0x62')];return db['SmsMessage'][_0x33bd('0x5b')]({'where':{'id':_0x248e6e[_0x33bd('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4b7a14,null))['then'](function(_0x3b5c0e){if(_0x3b5c0e){_0x59c083[_0x33bd('0x29')]=_0x3b5c0e[_0x33bd('0x64')]({'plain':!![]});return db[_0x33bd('0x65')][_0x33bd('0x5b')]({'where':{'id':_0x3b5c0e['SmsInteractionId']}});}return null;})[_0x33bd('0x22')](handleEntityNotFound(_0x4b7a14,null))[_0x33bd('0x22')](function(_0x162ee1){if(_0x162ee1){_0x59c083[_0x33bd('0x68')]=_0x162ee1[_0x33bd('0x64')]({'plain':!![]});interaction_log[_0x33bd('0x2a')](_0x33bd('0x7c'),_0x248e6e['user']['id'],_0x248e6e[_0x33bd('0x6a')]['name'],_0x248e6e['user'][_0x33bd('0x6b')],_0x59c083[_0x33bd('0x68')]['id'],_0x248e6e[_0x33bd('0x5a')]?JSON[_0x33bd('0x6c')](_0x248e6e['body']):_0x33bd('0x7d'));return respondWithRpcPromise(_0x33bd('0x7e'),_0x33bd('0x7f'),_0x59c083);}return null;})['then'](function(_0x10eb1e){var _0x1fcc0a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x10eb1e[_0x33bd('0x29')][_0x33bd('0x70')];return db['sequelize']['query'](_0x1fcc0a,{'type':db['Sequelize']['QueryTypes'][_0x33bd('0x80')],'raw':!![]})[_0x33bd('0x22')](function(_0x42d37f){return _0x42d37f;});})[_0x33bd('0x22')](function(_0x3239d7){if(_0x3239d7){_0x59c083[_0x33bd('0x29')][_0x33bd('0x81')]=_0x3239d7[0x0];if(!_0x248e6e[_0x33bd('0x5a')][_0x33bd('0x62')])return;return db[_0x33bd('0x82')][_0x33bd('0x5b')]({'where':{'id':_0x248e6e['body'][_0x33bd('0x62')],'role':'agent'},'attributes':['id',_0x33bd('0x3b'),_0x33bd('0x73'),_0x33bd('0x83'),_0x33bd('0x74')],'raw':!![]});}return null;})['then'](function(_0x33a88c){if(!_0x33a88c)return null;_0x59c083[_0x33bd('0x29')][_0x33bd('0x63')]=_0x33a88c;return _0x59c083;})[_0x33bd('0x22')](function(_0x2b2999){if(_0x2b2999){_0x2b2999[_0x33bd('0x29')]['interface']=util[_0x33bd('0x60')](_0x33bd('0x76'),_0x248e6e[_0x33bd('0x6a')][_0x33bd('0x3b')]);_0x2b2999['message']['channel']=_0x59c083[_0x33bd('0x77')];_0x2b2999[_0x33bd('0x29')]['motionChannel']=_0x59c083['channel'];_0x2b2999['message'][_0x33bd('0x79')]=_0x33bd('0x35');respondWithRpcPromise(_0x33bd('0x7a'),_0x33bd('0x7a'),{'event':'rejectmessage','message':_0x2b2999['message']},client9002);return _0x59c083;}return null;})[_0x33bd('0x22')](respondWithResult(_0x4b7a14,null))['catch'](handleError(_0x4b7a14,null));};exports[_0x33bd('0x2e')]=function(_0x132c0d,_0x18b5ae,_0x1ba84d){if(_0x132c0d[_0x33bd('0x5a')]['id']){delete _0x132c0d[_0x33bd('0x5a')]['id'];}var _0x2ca71d;return db[_0x33bd('0x3e')]['find']({'where':{'id':_0x132c0d[_0x33bd('0x56')]['id']}})['then'](handleEntityNotFound(_0x18b5ae,null))[_0x33bd('0x22')](function(_0x109f49){if(_0x109f49){_0x2ca71d=_0x109f49;return db[_0x33bd('0x84')][_0x33bd('0x5b')]({'where':{'id':_0x109f49[_0x33bd('0x85')]}});}})[_0x33bd('0x22')](handleEntityNotFound(_0x18b5ae,null))[_0x33bd('0x22')](function(_0x594eaf){if(_0x594eaf){logger[_0x33bd('0x25')](_0x33bd('0x26'),_0x33bd('0x2e'),_0x33bd('0x86'),_0x594eaf[_0x33bd('0x3f')],util['inspect'](_0x132c0d[_0x33bd('0x5a')],{'showHidden':![],'depth':null}));switch(_0x594eaf['type']){case _0x33bd('0x87'):if(_0x132c0d[_0x33bd('0x5a')]['MessageSid']&&_0x132c0d[_0x33bd('0x5a')]['MessageSid']===_0x2ca71d[_0x33bd('0x88')]){return _0x2ca71d[_0x33bd('0x37')]({'read':!![]});}else{logger[_0x33bd('0x27')](_0x33bd('0x89'),_0x33bd('0x2e'),_0x33bd('0x87'),util[_0x33bd('0x8a')](_0x132c0d['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x132c0d[_0x33bd('0x5a')][_0x33bd('0x8b')]&&_0x132c0d['body']['MessageUUID']===_0x2ca71d[_0x33bd('0x88')]&&_[_0x33bd('0x8c')]([_0x33bd('0x8d'),'delivered'],_0x132c0d[_0x33bd('0x5a')][_0x33bd('0x8e')])>=0x0){return _0x2ca71d[_0x33bd('0x37')]({'read':!![]});}else{logger[_0x33bd('0x27')](_0x33bd('0x89'),_0x33bd('0x2e'),_0x33bd('0x8f'),util[_0x33bd('0x8a')](_0x132c0d[_0x33bd('0x5a')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x51a7bd=_0x132c0d[_0x33bd('0x5a')]['results'][0x0];if(_0x51a7bd['status'][_0x33bd('0x90')]===_0x33bd('0x91')){return _0x2ca71d['update']({'read':!![]});}else{logger[_0x33bd('0x27')](_0x33bd('0x89'),_0x33bd('0x2e'),_0x33bd('0x92'),util[_0x33bd('0x8a')](_0x132c0d[_0x33bd('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x2ca71d;}})[_0x33bd('0x22')](respondWithResult(_0x18b5ae,null))[_0x33bd('0x2c')](handleError(_0x18b5ae,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index f1f1b1d..b17a7a8 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 _0x686b=['emit','hasOwnProperty','exports','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x4ec531,_0x5afec2){var _0x5f4a07=function(_0x599de9){while(--_0x599de9){_0x4ec531['push'](_0x4ec531['shift']());}};_0x5f4a07(++_0x5afec2);}(_0x686b,0x123));var _0xb686=function(_0x14aa2e,_0xa82634){_0x14aa2e=_0x14aa2e-0x0;var _0x36283e=_0x686b[_0x14aa2e];return _0x36283e;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xb686('0x0'))['db'][_0xb686('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xb686('0x2')](0x0);var events={'afterCreate':_0xb686('0x3'),'afterUpdate':_0xb686('0x4'),'afterDestroy':_0xb686('0x5')};function emitEvent(_0x8839fe){return function(_0x47d475,_0x3abaeb,_0x3aaf5c){SmsMessageEvents['emit'](_0x8839fe+':'+_0x47d475['id'],_0x47d475);SmsMessageEvents[_0xb686('0x6')](_0x8839fe,_0x47d475);_0x3aaf5c(null);};}for(var e in events){if(events[_0xb686('0x7')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xb686('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x1c6f=['exports','../../mysqldb','SmsMessage','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x2982ca,_0x5a6851){var _0x3e591f=function(_0x3241c9){while(--_0x3241c9){_0x2982ca['push'](_0x2982ca['shift']());}};_0x3e591f(++_0x5a6851);}(_0x1c6f,0x189));var _0xf1c6=function(_0x2887ce,_0xd2aa8b){_0x2887ce=_0x2887ce-0x0;var _0x2a09f2=_0x1c6f[_0x2887ce];return _0x2a09f2;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xf1c6('0x0'))['db'][_0xf1c6('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xf1c6('0x2')](0x0);var events={'afterCreate':_0xf1c6('0x3'),'afterUpdate':'update','afterDestroy':_0xf1c6('0x4')};function emitEvent(_0x10aafd){return function(_0x2dcae7,_0x2db613,_0x5cd60f){SmsMessageEvents[_0xf1c6('0x5')](_0x10aafd+':'+_0x2dcae7['id'],_0x2dcae7);SmsMessageEvents[_0xf1c6('0x5')](_0x10aafd,_0x2dcae7);_0x5cd60f(null);};}for(var e in events){if(events[_0xf1c6('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xf1c6('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 d961576..96dea61 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 _0xa4ad=['create','remote','/api/sms/messages/','token','then','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','login?username=','username','&password=','split','POST','user_key','session_key','total_sent','internal_order_id','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','deliveryReport','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','/status?token=','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','sender','text','timestamp','keys','sort','length','createHash','md5','signature=','GET','/external/get/send.php?','id_sms','clickatell','uuid','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','bandwidth','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','intelepeer','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','SmsInteractionId','SmsInteraction','findOne','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages'];(function(_0x41f712,_0xf5b2c8){var _0x3c2bd0=function(_0x109852){while(--_0x109852){_0x41f712['push'](_0x41f712['shift']());}};_0x3c2bd0(++_0xf5b2c8);}(_0xa4ad,0xd0));var _0xda4a=function(_0x34933a,_0x327378){_0x34933a=_0x34933a-0x0;var _0x36abb4=_0xa4ad[_0x34933a];return _0x36abb4;};'use strict';var _=require(_0xda4a('0x0'));var util=require(_0xda4a('0x1'));var logger=require(_0xda4a('0x2'))(_0xda4a('0x3'));var moment=require(_0xda4a('0x4'));var BPromise=require(_0xda4a('0x5'));var rp=require(_0xda4a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda4a('0x7'));var config=require(_0xda4a('0x8'));var attributes=require('./smsMessage.attributes');module['exports']=function(_0x197357,_0x33097d){return _0x197357['define'](_0xda4a('0x9'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xda4a('0xa'),'fields':[_0xda4a('0xa')]},{'name':_0xda4a('0xb'),'fields':[_0xda4a('0xc')],'type':_0xda4a('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c250e,_0x55ac25,_0x5e1347){var _0x5a3825=_0x197357[_0xda4a('0xe')];var _0x409e4e=_0x3c250e[_0xda4a('0xf')]({'plain':!![]});if(_0x409e4e[_0xda4a('0x10')][_0xda4a('0x11')]()==='in'||_0x409e4e['direction'][_0xda4a('0x11')]()===_0xda4a('0x12')&&!_0x409e4e['secret']&&!_[_0xda4a('0x13')](_0x409e4e['UserId'])&&!_[_0xda4a('0x13')](_0x409e4e[_0xda4a('0x14')])){_0x5a3825[_0xda4a('0x15')][_0xda4a('0x16')]({'where':{'id':_0x409e4e[_0xda4a('0x14')]}})['then'](function(_0x1565ac){if(_0x1565ac){_0x1565ac[_0xda4a('0x17')]({'lastMsgAt':_0x409e4e[_0xda4a('0x18')],'lastMsgDirection':_0x409e4e[_0xda4a('0x10')][_0xda4a('0x11')]()});}})[_0xda4a('0x19')](function(_0x4ac3db){console[_0xda4a('0x1a')](_0x4ac3db);});}if(_0x409e4e[_0xda4a('0x10')]===_0xda4a('0x12')&&!_0x409e4e['secret']){var _0x23c4ab;_0x5a3825[_0xda4a('0x1b')][_0xda4a('0x1c')]({'where':{'id':_0x409e4e[_0xda4a('0x1d')]},'raw':!![]})['then'](function(_0x5c06aa){_0x23c4ab=_0x5c06aa;if(_0x23c4ab&&_0x23c4ab['type']){switch(_0x23c4ab[_0xda4a('0x1e')]){case'twilio':var _0x1b9ad4=require(_0xda4a('0x1f'));if(_0x23c4ab[_0xda4a('0x20')]&&_0x23c4ab[_0xda4a('0x21')]&&_0x23c4ab[_0xda4a('0x22')]){var _0x5a4f9a=new _0x1b9ad4(_0x23c4ab[_0xda4a('0x20')],_0x23c4ab['authToken']);_0x5a4f9a[_0xda4a('0x23')][_0xda4a('0x24')]({'body':_0x409e4e[_0xda4a('0xc')],'to':_0x409e4e[_0xda4a('0x22')],'from':_0x23c4ab[_0xda4a('0x22')],'statusCallback':_0x23c4ab[_0xda4a('0x25')]+_0xda4a('0x26')+_0x409e4e['id']+'/status?token='+_0x23c4ab[_0xda4a('0x27')]})[_0xda4a('0x28')](function(_0x348de6){if(_0x348de6[_0xda4a('0x29')]){return _0x3c250e[_0xda4a('0x17')]({'messageId':_0x348de6[_0xda4a('0x29')]});}})['catch'](function(_0xa1c17a){logger[_0xda4a('0x1a')](_0xda4a('0x2a'),_0xda4a('0x2b'),_0xda4a('0x1f'),util[_0xda4a('0x2c')](_0xa1c17a,{'showHidden':![],'depth':null}));});}else{logger[_0xda4a('0x1a')](_0xda4a('0x2a'),_0xda4a('0x2b'),_0xda4a('0x1f'),_0xda4a('0x2d'));}break;case _0xda4a('0x2e'):var _0x296c2d=_0xda4a('0x2f');if(_0x23c4ab['username']&&_0x23c4ab[_0xda4a('0x30')]){var _0xdd6cf1={'recipient':[_0x409e4e['phone']],'message':_0x409e4e[_0xda4a('0xc')],'message_type':_0x23c4ab[_0xda4a('0x31')]};if(_0x23c4ab[_0xda4a('0x31')]&&_0x23c4ab[_0xda4a('0x31')]!=='SI'){_0xdd6cf1['sender']=_0x23c4ab[_0xda4a('0x22')];}var _0x34d298={'url':_0x296c2d+_0xda4a('0x32')+_0x23c4ab[_0xda4a('0x33')]+_0xda4a('0x34')+_0x23c4ab[_0xda4a('0x30')],'method':'GET'};rp(_0x34d298)[_0xda4a('0x28')](function(_0x11397f){var _0x24a500=_0x11397f[_0xda4a('0x35')](';');var _0x20654c={'user_key':_0x24a500[0x0],'session_key':_0x24a500[0x1]};_0x34d298={'url':_0x296c2d+'sms','method':_0xda4a('0x36'),'headers':{'user_key':_0x20654c[_0xda4a('0x37')],'Session_key':_0x20654c[_0xda4a('0x38')]},'json':!![],'body':_0xdd6cf1};return rp(_0x34d298);})[_0xda4a('0x28')](function(_0x27d632){if(_0x27d632[_0xda4a('0x39')]>=0x1){var _0x3208a4={'messageId':_0x27d632[_0xda4a('0x3a')]};if(_0x23c4ab['smsMethod']!=='GP'||!_0x23c4ab['deliveryReport']){_0x3208a4[_0xda4a('0x3b')]=!![];}return _0x3c250e[_0xda4a('0x17')](_0x3208a4);}else{return logger[_0xda4a('0x1a')](_0xda4a('0x2a'),_0xda4a('0x2b'),_0xda4a('0x2e'),util['inspect'](_0x27d632,{'showHidden':![],'depth':null}));}})[_0xda4a('0x19')](function(_0x23b754){return logger[_0xda4a('0x1a')](_0xda4a('0x2a'),_0xda4a('0x2b'),'skebby',util['inspect'](_0x23b754,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xda4a('0x2b'),_0xda4a('0x2e'),_0xda4a('0x3c'));}break;case _0xda4a('0x3d'):if(_0x23c4ab['authToken']){var _0x296691={'recipient':_0x409e4e[_0xda4a('0x22')],'message':_0x409e4e['body'],'sender':_0x23c4ab[_0xda4a('0x3e')]||_0x23c4ab['phone'],'authorization':_0x23c4ab[_0xda4a('0x21')]};var _0x55ac25={'method':'POST','uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x296691,'json':!![]};rp(_0x55ac25)['then'](function(_0x21ce08){var _0x535715={'messageId':_0x21ce08['requestid']};if(!_0x23c4ab[_0xda4a('0x3f')]){_0x535715[_0xda4a('0x3b')]=!![];}return _0x3c250e['update'](_0x535715);})[_0xda4a('0x19')](function(_0x148996){logger[_0xda4a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xda4a('0x2b'),_0xda4a('0x3d'),util[_0xda4a('0x2c')](_0x148996,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xda4a('0x2b'),'connectel','Missing\x20parameters:\x20authToken');}break;case _0xda4a('0x40'):if(_0x23c4ab[_0xda4a('0x33')]&&_0x23c4ab['password']){var _0x296691={'messages':[{'source':_0xda4a('0x41'),'to':_0x409e4e[_0xda4a('0x22')],'body':_0x409e4e['body'],'from':_0x23c4ab['senderString']||_0x23c4ab[_0xda4a('0x22')]}]};var _0x4c01c4=util[_0xda4a('0x42')](_0xda4a('0x43'),_0x23c4ab[_0xda4a('0x33')],_0x23c4ab[_0xda4a('0x30')]);var _0x55ac25={'method':_0xda4a('0x36'),'uri':_0xda4a('0x44'),'body':_0x296691,'headers':{'Authorization':util[_0xda4a('0x42')](_0xda4a('0x45'),new Buffer(_0x4c01c4)[_0xda4a('0x46')]('base64'))},'json':!![]};rp(_0x55ac25)['then'](function(_0x27e0d6){if(_0x27e0d6[_0xda4a('0x47')]>=0xc8&&_0x27e0d6[_0xda4a('0x47')]<=0xce){if(_0x27e0d6[_0xda4a('0x48')]&&_0x27e0d6[_0xda4a('0x48')][_0xda4a('0x49')]>0x0){var _0x3b2c66=_[_0xda4a('0x4a')](_0x27e0d6[_0xda4a('0x48')][_0xda4a('0x23')]);var _0x1cfdb3={'messageId':_0x3b2c66[_0xda4a('0x4b')]};if(!_0x23c4ab[_0xda4a('0x3f')]){_0x1cfdb3[_0xda4a('0x3b')]=!![];}return _0x3c250e[_0xda4a('0x17')](_0x1cfdb3);}else{logger[_0xda4a('0x1a')](_0xda4a('0x2a'),'afterCreate','clickSend',util[_0xda4a('0x2c')](_0x27e0d6,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xda4a('0x2a'),_0xda4a('0x2b'),_0xda4a('0x4c'),util[_0xda4a('0x2c')](_0x27e0d6,{'showHidden':![],'depth':null}));}})[_0xda4a('0x19')](function(_0x5093b5){logger[_0xda4a('0x1a')](_0xda4a('0x2a'),_0xda4a('0x2b'),'clickSend',util[_0xda4a('0x2c')](_0x5093b5,{'showHidden':![],'depth':null}));});}else{logger[_0xda4a('0x1a')](_0xda4a('0x2a'),'afterCreate',_0xda4a('0x4c'),_0xda4a('0x3c'));}break;case _0xda4a('0x4d'):if(_0x23c4ab[_0xda4a('0x4e')]&&_0x23c4ab['authToken']){var _0x296691={'dst':_0x409e4e[_0xda4a('0x22')],'text':_0x409e4e['body'],'src':_0x23c4ab[_0xda4a('0x3e')]||_0x23c4ab[_0xda4a('0x22')],'url':_0x23c4ab[_0xda4a('0x25')]+'/api/sms/messages/'+_0x409e4e['id']+_0xda4a('0x4f')+_0x23c4ab[_0xda4a('0x27')]};var _0x4c01c4=util[_0xda4a('0x42')](_0xda4a('0x43'),_0x23c4ab[_0xda4a('0x4e')],_0x23c4ab['authToken']);var _0x55ac25={'method':_0xda4a('0x36'),'uri':util[_0xda4a('0x42')]('https://api.plivo.com/v1/Account/%s/Message/',_0x23c4ab[_0xda4a('0x4e')]),'body':_0x296691,'headers':{'Authorization':util['format'](_0xda4a('0x45'),new Buffer(_0x4c01c4)[_0xda4a('0x46')](_0xda4a('0x50')))},'json':!![]};rp(_0x55ac25)[_0xda4a('0x28')](function(_0x6b545e){var _0x3ae200={'messageId':_0x6b545e[_0xda4a('0x51')][0x0]};return _0x3c250e['update'](_0x3ae200);})[_0xda4a('0x19')](function(_0x5e8aac){logger['error'](_0xda4a('0x2a'),_0xda4a('0x2b'),_0xda4a('0x4d'),util[_0xda4a('0x2c')](_0x5e8aac,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xda4a('0x2a'),'afterCreate',_0xda4a('0x4d'),_0xda4a('0x52'));}break;case _0xda4a('0x53'):if(_0x23c4ab[_0xda4a('0x33')]&&_0x23c4ab[_0xda4a('0x30')]){if(_0x23c4ab[_0xda4a('0x54')]){var _0x86752a={'method':'POST','uri':_0x23c4ab[_0xda4a('0x54')]+'/auth/1/session','body':{'username':_0x23c4ab[_0xda4a('0x33')],'password':_0x23c4ab[_0xda4a('0x30')]},'json':!![]};return rp(_0x86752a)[_0xda4a('0x28')](function(_0x193357){var _0x18143f={'method':_0xda4a('0x36'),'uri':_0x23c4ab['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x23c4ab[_0xda4a('0x22')],'destinations':[{'to':_0x409e4e[_0xda4a('0x22')]}],'text':_0x409e4e['body'],'notifyUrl':_0x23c4ab['remote']+'/api/sms/messages/'+_0x409e4e['id']+'/status?token='+_0x23c4ab[_0xda4a('0x27')],'notifyContentType':_0xda4a('0x55'),'callbackData':_0x23c4ab[_0xda4a('0x22')]+';'+_0x409e4e[_0xda4a('0xc')]}]},'headers':{'Authorization':_0xda4a('0x56')+_0x193357[_0xda4a('0x27')]},'json':!![]};return rp(_0x18143f)[_0xda4a('0x28')](function(_0x32e674){if(_0x32e674[_0xda4a('0x23')]){var _0x3cb32b={'messageId':_0x32e674[_0xda4a('0x23')][0x0][_0xda4a('0xa')]};if(!_0x23c4ab[_0xda4a('0x3f')]){_0x3cb32b[_0xda4a('0x3b')]=!![];}return _0x3c250e[_0xda4a('0x17')](_0x3cb32b);}else{return logger[_0xda4a('0x1a')](_0xda4a('0x2a'),_0xda4a('0x2b'),_0xda4a('0x53'),util[_0xda4a('0x2c')](_0x32e674,{'showHidden':![],'depth':null}));}});})[_0xda4a('0x19')](function(_0x159bfa){return logger[_0xda4a('0x1a')](_0xda4a('0x2a'),_0xda4a('0x2b'),_0xda4a('0x53'),util[_0xda4a('0x2c')](_0x159bfa,{'showHidden':![],'depth':null}));});}else{logger[_0xda4a('0x1a')](_0xda4a('0x2a'),'afterCreate',_0xda4a('0x53'),_0xda4a('0x57'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xda4a('0x2b'),_0xda4a('0x53'),_0xda4a('0x3c'));}break;case _0xda4a('0x58'):var _0x3843c4=require(_0xda4a('0x59'));if(_0x23c4ab[_0xda4a('0x5a')]){var _0x1cb03d={};_0x1cb03d[_0xda4a('0x5b')]=_0x23c4ab[_0xda4a('0x33')];_0x1cb03d[_0xda4a('0x22')]=_0x409e4e[_0xda4a('0x22')];_0x1cb03d[_0xda4a('0x5c')]=_0x23c4ab[_0xda4a('0x22')];_0x1cb03d[_0xda4a('0x5d')]=_0x409e4e[_0xda4a('0xc')];_0x1cb03d[_0xda4a('0x5e')]=+new Date();var _0x1d0fca='';var _0x25da24='';var _0x10dc6c=Object[_0xda4a('0x5f')](_0x1cb03d);_0x10dc6c[_0xda4a('0x60')]();for(var _0x54e2cf=0x0;_0x54e2cf<_0x10dc6c[_0xda4a('0x61')];_0x54e2cf++){if(_0x1d0fca!=''){_0x1d0fca+='&';}_0x1d0fca+=_0x10dc6c[_0x54e2cf]+'='+encodeURIComponent(_0x1cb03d[_0x10dc6c[_0x54e2cf]]);_0x25da24+=_0x1cb03d[_0x10dc6c[_0x54e2cf]];}_0x25da24+=_0x23c4ab[_0xda4a('0x5a')];_0x25da24=_0x3843c4[_0xda4a('0x62')](_0xda4a('0x63'))['update'](_0x25da24)['digest']('hex');if(_0x1d0fca!==''){_0x1d0fca+='&';}_0x1d0fca+=_0xda4a('0x64')+_0x25da24;var _0x34d298={'method':_0xda4a('0x65'),'uri':_0x23c4ab[_0xda4a('0x54')]+_0xda4a('0x66')+_0x1d0fca,'json':!![]};return rp(_0x34d298)[_0xda4a('0x28')](function(_0x42200){var _0x3326c7=Object['keys'](_0x42200);if(_0x42200[_0x3326c7[0x0]]['error']&&parseInt(_0x42200[_0x3326c7[0x0]][_0xda4a('0x1a')])===0x0){var _0x18a605={'messageId':_0x42200[_0x3326c7[0x0]][_0xda4a('0x67')]};if(!_0x23c4ab['deliveryReport']){_0x18a605[_0xda4a('0x3b')]=!![];}return _0x3c250e[_0xda4a('0x17')](_0x18a605);}else{return logger['error'](_0xda4a('0x2a'),_0xda4a('0x2b'),'csc',util['inspect'](_0x42200['error'],{'showHidden':![],'depth':null}));}})[_0xda4a('0x19')](function(_0x153e02){return logger[_0xda4a('0x1a')](_0xda4a('0x2a'),_0xda4a('0x2b'),_0xda4a('0x58'),util['inspect'](_0x153e02,{'showHidden':![],'depth':null}));});}else{logger[_0xda4a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xda4a('0x58'),'Missing\x20parameters:\x20apiKey');}break;case _0xda4a('0x68'):if(_0x23c4ab['apiKey']){var _0x504fbd={'method':'POST','uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x23c4ab[_0xda4a('0x5a')]},'body':{'content':_0x409e4e[_0xda4a('0xc')],'to':[_0x409e4e[_0xda4a('0x22')]],'from':_0x23c4ab[_0xda4a('0x22')],'binary':![],'clientMessageId':_0xda4a('0x69'),'charset':_0xda4a('0x6a')},'json':!![]};rp(_0x504fbd)[_0xda4a('0x28')](function(_0x3aecf7){if(!_0x3aecf7['error']){var _0x3dfd6d={'messageId':_0x3aecf7[_0xda4a('0x23')][0x0][_0xda4a('0x6b')]};if(!_0x23c4ab['deliveryReport']){_0x3dfd6d[_0xda4a('0x3b')]=!![];}return _0x3c250e[_0xda4a('0x17')](_0x3dfd6d);}else{return logger[_0xda4a('0x1a')](_0xda4a('0x2a'),_0xda4a('0x2b'),_0xda4a('0x68'),util['inspect'](_0x3aecf7[_0xda4a('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x243030){return logger['error'](_0xda4a('0x2a'),'afterCreate',_0xda4a('0x68'),util['inspect'](_0x243030,{'showHidden':![],'depth':null}));});}else{logger[_0xda4a('0x1a')](_0xda4a('0x2a'),'afterCreate',_0xda4a('0x68'),'Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0x23c4ab[_0xda4a('0x33')]&&_0x23c4ab[_0xda4a('0x30')]){var _0x4c01c4=util['format'](_0xda4a('0x43'),_0x23c4ab[_0xda4a('0x33')],_0x23c4ab[_0xda4a('0x30')]);var _0x55ac25={'method':_0xda4a('0x36'),'uri':_0xda4a('0x6c')+_0x23c4ab['accountId']+_0xda4a('0x6d'),'body':{'to':[_0x409e4e['phone']],'text':_0x409e4e['body'],'from':_0x23c4ab[_0xda4a('0x22')],'applicationId':_0x23c4ab[_0xda4a('0x6e')]},'headers':{'Authorization':util[_0xda4a('0x42')](_0xda4a('0x45'),new Buffer(_0x4c01c4)[_0xda4a('0x46')](_0xda4a('0x50')))},'json':!![]};rp(_0x55ac25)[_0xda4a('0x28')](function(_0x5392d1){if(_0x5392d1['id']){var _0x6beb38={'messageId':_0x5392d1['id']};return _0x3c250e[_0xda4a('0x17')](_0x6beb38);}else{logger['error'](_0xda4a('0x2a'),_0xda4a('0x2b'),'bandwidth',util[_0xda4a('0x2c')](_0x5392d1,{'showHidden':![],'depth':null}));}})['catch'](function(_0x25c580){logger[_0xda4a('0x1a')](_0xda4a('0x2a'),_0xda4a('0x2b'),_0xda4a('0x6f'),util['inspect'](_0x25c580,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xda4a('0x2a'),_0xda4a('0x2b'),_0xda4a('0x6f'),'Missing\x20parameters:\x20username,\x20password');}break;case'intelepeer':if(_0x23c4ab[_0xda4a('0x5a')]){var _0x467928={};var _0x34d298={'method':_0xda4a('0x36'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xda4a('0x70')+_0x23c4ab[_0xda4a('0x5a')],'Content-Type':_0xda4a('0x55')},'body':{'from':_0x23c4ab[_0xda4a('0x22')],'to':_0x409e4e[_0xda4a('0x22')],'text':_0x409e4e['body']},'json':!![]};return rp(_0x34d298)[_0xda4a('0x28')](function(_0x3047a4){if(_0x3047a4[_0xda4a('0x71')]==0xca){_0x467928['message']=_0x3047a4;var _0x10f446={'method':_0xda4a('0x36'),'uri':_0xda4a('0x72'),'headers':{'Authorization':'Bearer\x20'+_0x23c4ab[_0xda4a('0x5a')],'Content-Type':_0xda4a('0x55')},'body':{'refid':_0x467928[_0xda4a('0x73')][_0xda4a('0x74')]},'json':!![]};return rp(_0x10f446)['then'](function(_0x3f46be){_0x467928[_0xda4a('0x75')]=_0x3f46be;var _0x572a65={'messageId':_0x467928[_0xda4a('0x73')]['refid'],'read':!![]};return _0x3c250e[_0xda4a('0x17')](_0x572a65);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xda4a('0x2b'),_0xda4a('0x76'),util[_0xda4a('0x2c')](_0x3047a4,{'showHidden':![],'depth':null}));}})[_0xda4a('0x19')](function(_0x18adc3){return logger[_0xda4a('0x1a')](_0xda4a('0x2a'),'afterCreate',_0xda4a('0x76'),util[_0xda4a('0x2c')](_0x18adc3,{'showHidden':![],'depth':null}));});}else{return logger[_0xda4a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xda4a('0x2b'),_0xda4a('0x76'),'Token\x20not\x20received');}break;}}})[_0xda4a('0x77')](function(){_0x5e1347();});}else{_0x5e1347();}}},'charset':_0xda4a('0x78'),'collate':_0xda4a('0x79')});}; \ No newline at end of file +var _0x91a3=['signature=','/external/get/send.php?','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','Missing\x20parameters:\x20apiKey','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','lodash','util','api','moment','bluebird','request-promise','../../config/environment','SmsMessage','messageId','fti_sms_messages','body','models','get','direction','secret','isNil','SmsInteractionId','SmsInteraction','findOne','then','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','create','remote','/api/sms/messages/','/status?token=','token','update','sid','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','smsMethod','sender','login?username=','&password=','GET','sms','POST','user_key','session_key','deliveryReport','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','read','clicksend','password','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','head','message_id','clickSend','plivo','%s:%s','authId','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','login','text','timestamp','keys','sort','length','apiKey','md5','digest','hex'];(function(_0x52c49e,_0x5e0f0e){var _0x672659=function(_0x13b308){while(--_0x13b308){_0x52c49e['push'](_0x52c49e['shift']());}};_0x672659(++_0x5e0f0e);}(_0x91a3,0x17c));var _0x391a=function(_0x506756,_0x35be92){_0x506756=_0x506756-0x0;var _0x3dc271=_0x91a3[_0x506756];return _0x3dc271;};'use strict';var _=require(_0x391a('0x0'));var util=require(_0x391a('0x1'));var logger=require('../../config/logger')(_0x391a('0x2'));var moment=require(_0x391a('0x3'));var BPromise=require(_0x391a('0x4'));var rp=require(_0x391a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x391a('0x6'));var attributes=require('./smsMessage.attributes');module['exports']=function(_0x88e240,_0x6befcb){return _0x88e240['define'](_0x391a('0x7'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x391a('0x8'),'fields':[_0x391a('0x8')]},{'name':_0x391a('0x9'),'fields':[_0x391a('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ee113,_0x3a2266,_0x44724f){var _0x33cd5a=_0x88e240[_0x391a('0xb')];var _0x16881a=_0x5ee113[_0x391a('0xc')]({'plain':!![]});if(_0x16881a[_0x391a('0xd')]['toLowerCase']()==='in'||_0x16881a[_0x391a('0xd')]['toLowerCase']()==='out'&&!_0x16881a[_0x391a('0xe')]&&!_[_0x391a('0xf')](_0x16881a['UserId'])&&!_[_0x391a('0xf')](_0x16881a[_0x391a('0x10')])){_0x33cd5a[_0x391a('0x11')][_0x391a('0x12')]({'where':{'id':_0x16881a['SmsInteractionId']}})[_0x391a('0x13')](function(_0x1b749a){if(_0x1b749a){_0x1b749a['update']({'lastMsgAt':_0x16881a['createdAt'],'lastMsgDirection':_0x16881a['direction']['toLowerCase']()});}})[_0x391a('0x14')](function(_0x5d98be){console[_0x391a('0x15')](_0x5d98be);});}if(_0x16881a[_0x391a('0xd')]==='out'&&!_0x16881a[_0x391a('0xe')]){var _0xd8fe53;_0x33cd5a[_0x391a('0x16')][_0x391a('0x17')]({'where':{'id':_0x16881a[_0x391a('0x18')]},'raw':!![]})[_0x391a('0x13')](function(_0x34e71a){_0xd8fe53=_0x34e71a;if(_0xd8fe53&&_0xd8fe53[_0x391a('0x19')]){switch(_0xd8fe53[_0x391a('0x19')]){case'twilio':var _0x347821=require(_0x391a('0x1a'));if(_0xd8fe53[_0x391a('0x1b')]&&_0xd8fe53['authToken']&&_0xd8fe53[_0x391a('0x1c')]){var _0x4e5fda=new _0x347821(_0xd8fe53[_0x391a('0x1b')],_0xd8fe53[_0x391a('0x1d')]);_0x4e5fda[_0x391a('0x1e')][_0x391a('0x1f')]({'body':_0x16881a[_0x391a('0xa')],'to':_0x16881a[_0x391a('0x1c')],'from':_0xd8fe53[_0x391a('0x1c')],'statusCallback':_0xd8fe53[_0x391a('0x20')]+_0x391a('0x21')+_0x16881a['id']+_0x391a('0x22')+_0xd8fe53[_0x391a('0x23')]})[_0x391a('0x13')](function(_0x1372c8){if(_0x1372c8['sid']){return _0x5ee113[_0x391a('0x24')]({'messageId':_0x1372c8[_0x391a('0x25')]});}})[_0x391a('0x14')](function(_0x5aec72){logger[_0x391a('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x391a('0x26'),'twilio',util[_0x391a('0x27')](_0x5aec72,{'showHidden':![],'depth':null}));});}else{logger[_0x391a('0x15')](_0x391a('0x28'),'afterCreate',_0x391a('0x1a'),_0x391a('0x29'));}break;case _0x391a('0x2a'):var _0x3a8a4a='https://api.skebby.it/API/v1.0/REST/';if(_0xd8fe53[_0x391a('0x2b')]&&_0xd8fe53['password']){var _0x540875={'recipient':[_0x16881a['phone']],'message':_0x16881a[_0x391a('0xa')],'message_type':_0xd8fe53[_0x391a('0x2c')]};if(_0xd8fe53['smsMethod']&&_0xd8fe53[_0x391a('0x2c')]!=='SI'){_0x540875[_0x391a('0x2d')]=_0xd8fe53[_0x391a('0x1c')];}var _0x56712e={'url':_0x3a8a4a+_0x391a('0x2e')+_0xd8fe53[_0x391a('0x2b')]+_0x391a('0x2f')+_0xd8fe53['password'],'method':_0x391a('0x30')};rp(_0x56712e)[_0x391a('0x13')](function(_0x2205da){var _0x438207=_0x2205da['split'](';');var _0x5c0eb0={'user_key':_0x438207[0x0],'session_key':_0x438207[0x1]};_0x56712e={'url':_0x3a8a4a+_0x391a('0x31'),'method':_0x391a('0x32'),'headers':{'user_key':_0x5c0eb0[_0x391a('0x33')],'Session_key':_0x5c0eb0[_0x391a('0x34')]},'json':!![],'body':_0x540875};return rp(_0x56712e);})['then'](function(_0x109659){if(_0x109659['total_sent']>=0x1){var _0x242afd={'messageId':_0x109659['internal_order_id']};if(_0xd8fe53['smsMethod']!=='GP'||!_0xd8fe53[_0x391a('0x35')]){_0x242afd['read']=!![];}return _0x5ee113[_0x391a('0x24')](_0x242afd);}else{return logger[_0x391a('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x391a('0x26'),_0x391a('0x2a'),util[_0x391a('0x27')](_0x109659,{'showHidden':![],'depth':null}));}})[_0x391a('0x14')](function(_0x29ba6b){return logger[_0x391a('0x15')](_0x391a('0x28'),_0x391a('0x26'),_0x391a('0x2a'),util[_0x391a('0x27')](_0x29ba6b,{'showHidden':![],'depth':null}));});}else{logger[_0x391a('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x391a('0x26'),_0x391a('0x2a'),_0x391a('0x36'));}break;case _0x391a('0x37'):if(_0xd8fe53[_0x391a('0x1d')]){var _0x2c7ff5={'recipient':_0x16881a[_0x391a('0x1c')],'message':_0x16881a['body'],'sender':_0xd8fe53[_0x391a('0x38')]||_0xd8fe53['phone'],'authorization':_0xd8fe53[_0x391a('0x1d')]};var _0x3a2266={'method':'POST','uri':_0x391a('0x39'),'body':_0x2c7ff5,'json':!![]};rp(_0x3a2266)[_0x391a('0x13')](function(_0x1837f6){var _0x1032ef={'messageId':_0x1837f6[_0x391a('0x3a')]};if(!_0xd8fe53[_0x391a('0x35')]){_0x1032ef[_0x391a('0x3b')]=!![];}return _0x5ee113[_0x391a('0x24')](_0x1032ef);})[_0x391a('0x14')](function(_0x209d1d){logger[_0x391a('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x391a('0x37'),util['inspect'](_0x209d1d,{'showHidden':![],'depth':null}));});}else{logger[_0x391a('0x15')](_0x391a('0x28'),_0x391a('0x26'),'connectel','Missing\x20parameters:\x20authToken');}break;case _0x391a('0x3c'):if(_0xd8fe53[_0x391a('0x2b')]&&_0xd8fe53[_0x391a('0x3d')]){var _0x2c7ff5={'messages':[{'source':_0x391a('0x3e'),'to':_0x16881a[_0x391a('0x1c')],'body':_0x16881a[_0x391a('0xa')],'from':_0xd8fe53[_0x391a('0x38')]||_0xd8fe53['phone']}]};var _0x5d4ef9=util[_0x391a('0x3f')]('%s:%s',_0xd8fe53[_0x391a('0x2b')],_0xd8fe53[_0x391a('0x3d')]);var _0x3a2266={'method':_0x391a('0x32'),'uri':_0x391a('0x40'),'body':_0x2c7ff5,'headers':{'Authorization':util['format'](_0x391a('0x41'),new Buffer(_0x5d4ef9)[_0x391a('0x42')](_0x391a('0x43')))},'json':!![]};rp(_0x3a2266)['then'](function(_0xb4ab4){if(_0xb4ab4[_0x391a('0x44')]>=0xc8&&_0xb4ab4['http_code']<=0xce){if(_0xb4ab4[_0x391a('0x45')]&&_0xb4ab4['data']['queued_count']>0x0){var _0x2b9343=_[_0x391a('0x46')](_0xb4ab4['data'][_0x391a('0x1e')]);var _0x3c0160={'messageId':_0x2b9343[_0x391a('0x47')]};if(!_0xd8fe53[_0x391a('0x35')]){_0x3c0160[_0x391a('0x3b')]=!![];}return _0x5ee113[_0x391a('0x24')](_0x3c0160);}else{logger[_0x391a('0x15')](_0x391a('0x28'),_0x391a('0x26'),_0x391a('0x48'),util[_0x391a('0x27')](_0xb4ab4,{'showHidden':![],'depth':null}));}}else{logger[_0x391a('0x15')](_0x391a('0x28'),_0x391a('0x26'),_0x391a('0x48'),util['inspect'](_0xb4ab4,{'showHidden':![],'depth':null}));}})[_0x391a('0x14')](function(_0x2406bf){logger[_0x391a('0x15')](_0x391a('0x28'),_0x391a('0x26'),_0x391a('0x48'),util['inspect'](_0x2406bf,{'showHidden':![],'depth':null}));});}else{logger[_0x391a('0x15')](_0x391a('0x28'),_0x391a('0x26'),'clickSend',_0x391a('0x36'));}break;case _0x391a('0x49'):if(_0xd8fe53['authId']&&_0xd8fe53[_0x391a('0x1d')]){var _0x2c7ff5={'dst':_0x16881a[_0x391a('0x1c')],'text':_0x16881a[_0x391a('0xa')],'src':_0xd8fe53[_0x391a('0x38')]||_0xd8fe53['phone'],'url':_0xd8fe53[_0x391a('0x20')]+_0x391a('0x21')+_0x16881a['id']+_0x391a('0x22')+_0xd8fe53[_0x391a('0x23')]};var _0x5d4ef9=util[_0x391a('0x3f')](_0x391a('0x4a'),_0xd8fe53[_0x391a('0x4b')],_0xd8fe53['authToken']);var _0x3a2266={'method':_0x391a('0x32'),'uri':util[_0x391a('0x3f')]('https://api.plivo.com/v1/Account/%s/Message/',_0xd8fe53[_0x391a('0x4b')]),'body':_0x2c7ff5,'headers':{'Authorization':util['format'](_0x391a('0x41'),new Buffer(_0x5d4ef9)[_0x391a('0x42')](_0x391a('0x43')))},'json':!![]};rp(_0x3a2266)['then'](function(_0x5277dc){var _0x5b656c={'messageId':_0x5277dc[_0x391a('0x4c')][0x0]};return _0x5ee113[_0x391a('0x24')](_0x5b656c);})[_0x391a('0x14')](function(_0x4309e0){logger['error'](_0x391a('0x28'),'afterCreate',_0x391a('0x49'),util[_0x391a('0x27')](_0x4309e0,{'showHidden':![],'depth':null}));});}else{logger[_0x391a('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x391a('0x26'),_0x391a('0x49'),_0x391a('0x4d'));}break;case _0x391a('0x4e'):if(_0xd8fe53['username']&&_0xd8fe53['password']){if(_0xd8fe53[_0x391a('0x4f')]){var _0x2e146d={'method':'POST','uri':_0xd8fe53[_0x391a('0x4f')]+_0x391a('0x50'),'body':{'username':_0xd8fe53[_0x391a('0x2b')],'password':_0xd8fe53[_0x391a('0x3d')]},'json':!![]};return rp(_0x2e146d)[_0x391a('0x13')](function(_0x42b36b){var _0x1643f5={'method':_0x391a('0x32'),'uri':_0xd8fe53['baseUrl']+_0x391a('0x51'),'body':{'messages':[{'from':_0xd8fe53[_0x391a('0x1c')],'destinations':[{'to':_0x16881a[_0x391a('0x1c')]}],'text':_0x16881a[_0x391a('0xa')],'notifyUrl':_0xd8fe53[_0x391a('0x20')]+'/api/sms/messages/'+_0x16881a['id']+'/status?token='+_0xd8fe53[_0x391a('0x23')],'notifyContentType':_0x391a('0x52'),'callbackData':_0xd8fe53[_0x391a('0x1c')]+';'+_0x16881a[_0x391a('0xa')]}]},'headers':{'Authorization':_0x391a('0x53')+_0x42b36b[_0x391a('0x23')]},'json':!![]};return rp(_0x1643f5)[_0x391a('0x13')](function(_0x527f54){if(_0x527f54[_0x391a('0x1e')]){var _0x274d50={'messageId':_0x527f54['messages'][0x0][_0x391a('0x8')]};if(!_0xd8fe53[_0x391a('0x35')]){_0x274d50['read']=!![];}return _0x5ee113[_0x391a('0x24')](_0x274d50);}else{return logger['error'](_0x391a('0x28'),_0x391a('0x26'),'infobip',util[_0x391a('0x27')](_0x527f54,{'showHidden':![],'depth':null}));}});})[_0x391a('0x14')](function(_0xa1509b){return logger[_0x391a('0x15')](_0x391a('0x28'),'afterCreate','infobip',util['inspect'](_0xa1509b,{'showHidden':![],'depth':null}));});}else{logger[_0x391a('0x15')](_0x391a('0x28'),_0x391a('0x26'),_0x391a('0x4e'),_0x391a('0x54'));}}else{logger[_0x391a('0x15')](_0x391a('0x28'),'afterCreate','infobip',_0x391a('0x36'));}break;case _0x391a('0x55'):var _0x5f1424=require('crypto');if(_0xd8fe53['apiKey']){var _0x4b96e2={};_0x4b96e2[_0x391a('0x56')]=_0xd8fe53[_0x391a('0x2b')];_0x4b96e2[_0x391a('0x1c')]=_0x16881a[_0x391a('0x1c')];_0x4b96e2[_0x391a('0x2d')]=_0xd8fe53['phone'];_0x4b96e2[_0x391a('0x57')]=_0x16881a[_0x391a('0xa')];_0x4b96e2[_0x391a('0x58')]=+new Date();var _0xc17942='';var _0x31e0c6='';var _0x5e38c5=Object[_0x391a('0x59')](_0x4b96e2);_0x5e38c5[_0x391a('0x5a')]();for(var _0x211bc4=0x0;_0x211bc4<_0x5e38c5[_0x391a('0x5b')];_0x211bc4++){if(_0xc17942!=''){_0xc17942+='&';}_0xc17942+=_0x5e38c5[_0x211bc4]+'='+encodeURIComponent(_0x4b96e2[_0x5e38c5[_0x211bc4]]);_0x31e0c6+=_0x4b96e2[_0x5e38c5[_0x211bc4]];}_0x31e0c6+=_0xd8fe53[_0x391a('0x5c')];_0x31e0c6=_0x5f1424['createHash'](_0x391a('0x5d'))['update'](_0x31e0c6)[_0x391a('0x5e')](_0x391a('0x5f'));if(_0xc17942!==''){_0xc17942+='&';}_0xc17942+=_0x391a('0x60')+_0x31e0c6;var _0x56712e={'method':_0x391a('0x30'),'uri':_0xd8fe53['baseUrl']+_0x391a('0x61')+_0xc17942,'json':!![]};return rp(_0x56712e)[_0x391a('0x13')](function(_0x626f7b){var _0xf2406=Object[_0x391a('0x59')](_0x626f7b);if(_0x626f7b[_0xf2406[0x0]][_0x391a('0x15')]&&parseInt(_0x626f7b[_0xf2406[0x0]][_0x391a('0x15')])===0x0){var _0x3bd3d2={'messageId':_0x626f7b[_0xf2406[0x0]]['id_sms']};if(!_0xd8fe53['deliveryReport']){_0x3bd3d2['read']=!![];}return _0x5ee113[_0x391a('0x24')](_0x3bd3d2);}else{return logger['error'](_0x391a('0x28'),'afterCreate','csc',util['inspect'](_0x626f7b[_0x391a('0x15')],{'showHidden':![],'depth':null}));}})[_0x391a('0x14')](function(_0x21a74b){return logger[_0x391a('0x15')](_0x391a('0x28'),'afterCreate','csc',util[_0x391a('0x27')](_0x21a74b,{'showHidden':![],'depth':null}));});}else{logger[_0x391a('0x15')](_0x391a('0x28'),_0x391a('0x26'),'csc','Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0xd8fe53[_0x391a('0x5c')]){var _0x534f59={'method':_0x391a('0x32'),'uri':_0x391a('0x62'),'headers':{'Authorization':_0xd8fe53[_0x391a('0x5c')]},'body':{'content':_0x16881a[_0x391a('0xa')],'to':[_0x16881a['phone']],'from':_0xd8fe53[_0x391a('0x1c')],'binary':![],'clientMessageId':_0x391a('0x63'),'charset':_0x391a('0x64')},'json':!![]};rp(_0x534f59)[_0x391a('0x13')](function(_0x136120){if(!_0x136120['error']){var _0x2fd196={'messageId':_0x136120[_0x391a('0x1e')][0x0][_0x391a('0x65')]};if(!_0xd8fe53[_0x391a('0x35')]){_0x2fd196['read']=!![];}return _0x5ee113[_0x391a('0x24')](_0x2fd196);}else{return logger[_0x391a('0x15')](_0x391a('0x28'),_0x391a('0x26'),_0x391a('0x66'),util[_0x391a('0x27')](_0x136120[_0x391a('0x15')],{'showHidden':![],'depth':null}));}})[_0x391a('0x14')](function(_0xfc23c2){return logger['error'](_0x391a('0x28'),_0x391a('0x26'),_0x391a('0x66'),util[_0x391a('0x27')](_0xfc23c2,{'showHidden':![],'depth':null}));});}else{logger[_0x391a('0x15')](_0x391a('0x28'),_0x391a('0x26'),_0x391a('0x66'),_0x391a('0x67'));}break;case'bandwidth':if(_0xd8fe53[_0x391a('0x2b')]&&_0xd8fe53[_0x391a('0x3d')]){var _0x5d4ef9=util[_0x391a('0x3f')](_0x391a('0x4a'),_0xd8fe53[_0x391a('0x2b')],_0xd8fe53[_0x391a('0x3d')]);var _0x3a2266={'method':_0x391a('0x32'),'uri':_0x391a('0x68')+_0xd8fe53[_0x391a('0x69')]+'/messages','body':{'to':[_0x16881a[_0x391a('0x1c')]],'text':_0x16881a[_0x391a('0xa')],'from':_0xd8fe53[_0x391a('0x1c')],'applicationId':_0xd8fe53[_0x391a('0x6a')]},'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x5d4ef9)['toString'](_0x391a('0x43')))},'json':!![]};rp(_0x3a2266)[_0x391a('0x13')](function(_0x30a67d){if(_0x30a67d['id']){var _0x386e80={'messageId':_0x30a67d['id']};return _0x5ee113[_0x391a('0x24')](_0x386e80);}else{logger[_0x391a('0x15')](_0x391a('0x28'),'afterCreate',_0x391a('0x6b'),util[_0x391a('0x27')](_0x30a67d,{'showHidden':![],'depth':null}));}})[_0x391a('0x14')](function(_0x4547a4){logger['error'](_0x391a('0x28'),'afterCreate',_0x391a('0x6b'),util['inspect'](_0x4547a4,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x391a('0x28'),_0x391a('0x26'),'bandwidth',_0x391a('0x36'));}break;case _0x391a('0x6c'):if(_0xd8fe53[_0x391a('0x5c')]){var _0x110721={};var _0x56712e={'method':'POST','uri':_0x391a('0x6d'),'headers':{'Authorization':_0x391a('0x6e')+_0xd8fe53[_0x391a('0x5c')],'Content-Type':_0x391a('0x52')},'body':{'from':_0xd8fe53[_0x391a('0x1c')],'to':_0x16881a[_0x391a('0x1c')],'text':_0x16881a[_0x391a('0xa')]},'json':!![]};return rp(_0x56712e)[_0x391a('0x13')](function(_0x4fe61e){if(_0x4fe61e[_0x391a('0x6f')]==0xca){_0x110721[_0x391a('0x70')]=_0x4fe61e;var _0x260910={'method':_0x391a('0x32'),'uri':_0x391a('0x71'),'headers':{'Authorization':_0x391a('0x6e')+_0xd8fe53[_0x391a('0x5c')],'Content-Type':_0x391a('0x52')},'body':{'refid':_0x110721[_0x391a('0x70')][_0x391a('0x72')]},'json':!![]};return rp(_0x260910)['then'](function(_0x3e0c19){_0x110721[_0x391a('0x73')]=_0x3e0c19;var _0x15b4df={'messageId':_0x110721[_0x391a('0x70')][_0x391a('0x72')],'read':!![]};return _0x5ee113['update'](_0x15b4df);});}else{return logger[_0x391a('0x15')](_0x391a('0x28'),_0x391a('0x26'),_0x391a('0x6c'),util['inspect'](_0x4fe61e,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5be33d){return logger['error'](_0x391a('0x28'),_0x391a('0x26'),_0x391a('0x6c'),util[_0x391a('0x27')](_0x5be33d,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x391a('0x28'),_0x391a('0x26'),'intelepeer',_0x391a('0x74'));}break;}}})[_0x391a('0x75')](function(){_0x44724f();});}else{_0x44724f();}}},'charset':_0x391a('0x76'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index b9645ff..facf801 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 _0xc066=['http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','create','body','options','raw','CreateSmsMessage','debug','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xc066,0xc3));var _0x6c06=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc066[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6c06('0x0'));var BPromise=require(_0x6c06('0x1'));var rs=require(_0x6c06('0x2'));var fs=require('fs');var Redis=require(_0x6c06('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c06('0x4'));var logger=require(_0x6c06('0x5'))(_0x6c06('0x6'));var config=require('../../config/environment');var jayson=require(_0x6c06('0x7'));var client=jayson[_0x6c06('0x8')][_0x6c06('0x9')]({'port':0x232a});config[_0x6c06('0xa')]=_[_0x6c06('0xb')](config[_0x6c06('0xa')],{'host':_0x6c06('0xc'),'port':0x18eb});var socket=require(_0x6c06('0xd'))(new Redis(config['redis']));require(_0x6c06('0xe'))[_0x6c06('0xf')](socket);function respondWithRpcPromise(_0x450c0c,_0x237c73,_0x1e91fc){return new BPromise(function(_0x548b3a,_0x1099d4){return client[_0x6c06('0x10')](_0x450c0c,_0x1e91fc)[_0x6c06('0x11')](function(_0x1beef3){logger[_0x6c06('0x12')](_0x6c06('0x13'),_0x237c73,'request\x20sent');logger['debug'](_0x6c06('0x14'),_0x237c73,_0x6c06('0x15'),JSON[_0x6c06('0x16')](_0x1beef3));if(_0x1beef3[_0x6c06('0x17')]){if(_0x1beef3[_0x6c06('0x17')][_0x6c06('0x18')]===0x1f4){logger['error'](_0x6c06('0x13'),_0x237c73,_0x1beef3['error'][_0x6c06('0x19')]);return _0x1099d4(_0x1beef3[_0x6c06('0x17')][_0x6c06('0x19')]);}logger[_0x6c06('0x17')]('SmsMessage,\x20%s,\x20%s',_0x237c73,_0x1beef3[_0x6c06('0x17')][_0x6c06('0x19')]);return _0x548b3a(_0x1beef3[_0x6c06('0x17')][_0x6c06('0x19')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x237c73,'request\x20sent');_0x548b3a(_0x1beef3[_0x6c06('0x1a')]['message']);}})[_0x6c06('0x1b')](function(_0x4616ca){logger[_0x6c06('0x17')](_0x6c06('0x13'),_0x237c73,_0x4616ca);_0x1099d4(_0x4616ca);});});}exports['CreateSmsMessage']=function(_0x414d5b){var _0x3411f9=this;return new Promise(function(_0x2d57c4,_0xc0a3f7){return db['SmsMessage'][_0x6c06('0x1c')](_0x414d5b[_0x6c06('0x1d')],{'raw':_0x414d5b[_0x6c06('0x1e')]?_0x414d5b[_0x6c06('0x1e')][_0x6c06('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x300231){logger['info'](_0x6c06('0x20'),_0x414d5b);logger[_0x6c06('0x21')](_0x6c06('0x20'),_0x414d5b,JSON[_0x6c06('0x16')](_0x300231));_0x2d57c4(_0x300231);})[_0x6c06('0x1b')](function(_0x20fd44){logger[_0x6c06('0x17')](_0x6c06('0x20'),_0x20fd44[_0x6c06('0x19')],_0x414d5b);_0xc0a3f7(_0x3411f9[_0x6c06('0x17')](0x1f4,_0x20fd44[_0x6c06('0x19')]));});});}; \ No newline at end of file +var _0x1e06=['request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x1e06,0x171));var _0x61e0=function(_0x10732b,_0x1160f4){_0x10732b=_0x10732b-0x0;var _0x2f6dff=_0x1e06[_0x10732b];return _0x2f6dff;};'use strict';var _=require(_0x61e0('0x0'));var util=require(_0x61e0('0x1'));var moment=require(_0x61e0('0x2'));var BPromise=require(_0x61e0('0x3'));var rs=require(_0x61e0('0x4'));var fs=require('fs');var Redis=require(_0x61e0('0x5'));var db=require(_0x61e0('0x6'))['db'];var utils=require(_0x61e0('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x61e0('0x8'));var jayson=require(_0x61e0('0x9'));var client=jayson[_0x61e0('0xa')]['http']({'port':0x232a});config[_0x61e0('0xb')]=_[_0x61e0('0xc')](config['redis'],{'host':_0x61e0('0xd'),'port':0x18eb});var socket=require(_0x61e0('0xe'))(new Redis(config[_0x61e0('0xb')]));require('./smsMessage.socket')[_0x61e0('0xf')](socket);function respondWithRpcPromise(_0x14bd5b,_0x5f307a,_0x3b86ce){return new BPromise(function(_0x331d78,_0x14c18c){return client[_0x61e0('0x10')](_0x14bd5b,_0x3b86ce)[_0x61e0('0x11')](function(_0x501472){logger[_0x61e0('0x12')](_0x61e0('0x13'),_0x5f307a,_0x61e0('0x14'));logger['debug'](_0x61e0('0x15'),_0x5f307a,_0x61e0('0x14'),JSON[_0x61e0('0x16')](_0x501472));if(_0x501472[_0x61e0('0x17')]){if(_0x501472[_0x61e0('0x17')][_0x61e0('0x18')]===0x1f4){logger[_0x61e0('0x17')](_0x61e0('0x13'),_0x5f307a,_0x501472[_0x61e0('0x17')][_0x61e0('0x19')]);return _0x14c18c(_0x501472[_0x61e0('0x17')][_0x61e0('0x19')]);}logger['error'](_0x61e0('0x13'),_0x5f307a,_0x501472[_0x61e0('0x17')][_0x61e0('0x19')]);return _0x331d78(_0x501472[_0x61e0('0x17')][_0x61e0('0x19')]);}else{logger[_0x61e0('0x12')]('SmsMessage,\x20%s,\x20%s',_0x5f307a,'request\x20sent');_0x331d78(_0x501472[_0x61e0('0x1a')][_0x61e0('0x19')]);}})[_0x61e0('0x1b')](function(_0x366d56){logger['error'](_0x61e0('0x13'),_0x5f307a,_0x366d56);_0x14c18c(_0x366d56);});});}exports[_0x61e0('0x1c')]=function(_0x5ca530){var _0x3cdcb1=this;return new Promise(function(_0x4f9c3e,_0x5e02b1){return db[_0x61e0('0x1d')][_0x61e0('0x1e')](_0x5ca530[_0x61e0('0x1f')],{'raw':_0x5ca530[_0x61e0('0x20')]?_0x5ca530[_0x61e0('0x20')][_0x61e0('0x21')]===undefined?!![]:![]:!![]})[_0x61e0('0x11')](function(_0x54a9d3){logger[_0x61e0('0x12')]('CreateSmsMessage',_0x5ca530);logger[_0x61e0('0x22')](_0x61e0('0x1c'),_0x5ca530,JSON[_0x61e0('0x16')](_0x54a9d3));_0x4f9c3e(_0x54a9d3);})['catch'](function(_0x3a547f){logger['error'](_0x61e0('0x1c'),_0x3a547f[_0x61e0('0x19')],_0x5ca530);_0x5e02b1(_0x3cdcb1[_0x61e0('0x17')](0x1f4,_0x3a547f['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 958218e..ab94d65 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 _0xe590=['length','smsMessage:','./smsMessage.events','save','remove','update','emit','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe590,0xca));var _0x0e59=function(_0x4e57a7,_0x33acd0){_0x4e57a7=_0x4e57a7-0x0;var _0x2917bc=_0xe590[_0x4e57a7];return _0x2917bc;};'use strict';var SmsMessageEvents=require(_0x0e59('0x0'));var events=[_0x0e59('0x1'),_0x0e59('0x2'),_0x0e59('0x3')];function createListener(_0x1b1610,_0x379eb6){return function(_0x5c35dc){_0x379eb6[_0x0e59('0x4')](_0x1b1610,_0x5c35dc);};}function removeListener(_0x6afbce,_0x1d075c){return function(){SmsMessageEvents['removeListener'](_0x6afbce,_0x1d075c);};}exports[_0x0e59('0x5')]=function(_0x501beb){for(var _0x237374=0x0,_0x475888=events[_0x0e59('0x6')];_0x237374<_0x475888;_0x237374++){var _0x3b920a=events[_0x237374];var _0x5b64b8=createListener(_0x0e59('0x7')+_0x3b920a,_0x501beb);SmsMessageEvents['on'](_0x3b920a,_0x5b64b8);}}; \ No newline at end of file +var _0x4c45=['emit','removeListener','register','length','smsMessage:','./smsMessage.events','remove','update'];(function(_0x51353a,_0x2a93f8){var _0x289ecf=function(_0x3422ce){while(--_0x3422ce){_0x51353a['push'](_0x51353a['shift']());}};_0x289ecf(++_0x2a93f8);}(_0x4c45,0x1c5));var _0x54c4=function(_0x3ccac1,_0x5cc7ea){_0x3ccac1=_0x3ccac1-0x0;var _0x10b20b=_0x4c45[_0x3ccac1];return _0x10b20b;};'use strict';var SmsMessageEvents=require(_0x54c4('0x0'));var events=['save',_0x54c4('0x1'),_0x54c4('0x2')];function createListener(_0x151873,_0x444906){return function(_0x2ce2f9){_0x444906[_0x54c4('0x3')](_0x151873,_0x2ce2f9);};}function removeListener(_0x3ef20c,_0xd8150d){return function(){SmsMessageEvents[_0x54c4('0x4')](_0x3ef20c,_0xd8150d);};}exports[_0x54c4('0x5')]=function(_0x2e9d2b){for(var _0x51860e=0x0,_0x1f18fd=events[_0x54c4('0x6')];_0x51860e<_0x1f18fd;_0x51860e++){var _0x85186a=events[_0x51860e];var _0x3f21ec=createListener(_0x54c4('0x7')+_0x85186a,_0x2e9d2b);SmsMessageEvents['on'](_0x85186a,_0x3f21ec);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 708ce46..5fa7226 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 _0xd88f=['getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeAgents','exports','multer','path','express','Router','fs-extra','../../config/environment','./smsQueue.controller','isAuthenticated','get','describe','/:id','/:id/members'];(function(_0x5ba1b8,_0x5cbd9f){var _0x4c2f70=function(_0x31c180){while(--_0x31c180){_0x5ba1b8['push'](_0x5ba1b8['shift']());}};_0x4c2f70(++_0x5cbd9f);}(_0xd88f,0x138));var _0xfd88=function(_0x3f2fea,_0x3c4ea8){_0x3f2fea=_0x3f2fea-0x0;var _0x69a4d5=_0xd88f[_0x3f2fea];return _0x69a4d5;};'use strict';var multer=require(_0xfd88('0x0'));var util=require('util');var path=require(_0xfd88('0x1'));var timeout=require('connect-timeout');var express=require(_0xfd88('0x2'));var router=express[_0xfd88('0x3')]();var fs_extra=require(_0xfd88('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfd88('0x5'));var controller=require(_0xfd88('0x6'));router['get']('/',auth[_0xfd88('0x7')](),controller['index']);router[_0xfd88('0x8')]('/describe',auth[_0xfd88('0x7')](),controller[_0xfd88('0x9')]);router[_0xfd88('0x8')](_0xfd88('0xa'),auth[_0xfd88('0x7')](),controller['show']);router[_0xfd88('0x8')](_0xfd88('0xb'),auth[_0xfd88('0x7')](),controller[_0xfd88('0xc')]);router[_0xfd88('0x8')](_0xfd88('0xd'),auth[_0xfd88('0x7')](),controller[_0xfd88('0xe')]);router['get']('/:id/users',auth[_0xfd88('0x7')](),controller[_0xfd88('0xf')]);router[_0xfd88('0x10')]('/',auth[_0xfd88('0x7')](),controller[_0xfd88('0x11')]);router[_0xfd88('0x10')](_0xfd88('0xd'),auth[_0xfd88('0x7')](),controller[_0xfd88('0x12')]);router[_0xfd88('0x10')](_0xfd88('0x13'),auth[_0xfd88('0x7')](),controller[_0xfd88('0x14')]);router[_0xfd88('0x15')]('/:id',auth[_0xfd88('0x7')](),controller[_0xfd88('0x16')]);router[_0xfd88('0x17')](_0xfd88('0xa'),auth[_0xfd88('0x7')](),controller[_0xfd88('0x18')]);router[_0xfd88('0x17')](_0xfd88('0xd'),auth[_0xfd88('0x7')](),controller['removeTeams']);router['delete'](_0xfd88('0x13'),auth['isAuthenticated'](),controller[_0xfd88('0x19')]);module[_0xfd88('0x1a')]=router; \ No newline at end of file +var _0xccdd=['connect-timeout','express','Router','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','/:id/teams','removeAgents','exports','util','path'];(function(_0x2603fc,_0x25cc88){var _0x1342bf=function(_0x48637c){while(--_0x48637c){_0x2603fc['push'](_0x2603fc['shift']());}};_0x1342bf(++_0x25cc88);}(_0xccdd,0xa6));var _0xdccd=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0xccdd[_0x58dc25];return _0x21b0a7;};'use strict';var multer=require('multer');var util=require(_0xdccd('0x0'));var path=require(_0xdccd('0x1'));var timeout=require(_0xdccd('0x2'));var express=require(_0xdccd('0x3'));var router=express[_0xdccd('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdccd('0x5'));var config=require('../../config/environment');var controller=require(_0xdccd('0x6'));router[_0xdccd('0x7')]('/',auth[_0xdccd('0x8')](),controller[_0xdccd('0x9')]);router[_0xdccd('0x7')]('/describe',auth[_0xdccd('0x8')](),controller['describe']);router[_0xdccd('0x7')](_0xdccd('0xa'),auth['isAuthenticated'](),controller[_0xdccd('0xb')]);router[_0xdccd('0x7')](_0xdccd('0xc'),auth['isAuthenticated'](),controller[_0xdccd('0xd')]);router[_0xdccd('0x7')]('/:id/teams',auth[_0xdccd('0x8')](),controller[_0xdccd('0xe')]);router[_0xdccd('0x7')](_0xdccd('0xf'),auth[_0xdccd('0x8')](),controller[_0xdccd('0x10')]);router[_0xdccd('0x11')]('/',auth[_0xdccd('0x8')](),controller[_0xdccd('0x12')]);router['post']('/:id/teams',auth[_0xdccd('0x8')](),controller[_0xdccd('0x13')]);router['post'](_0xdccd('0xf'),auth[_0xdccd('0x8')](),controller[_0xdccd('0x14')]);router[_0xdccd('0x15')](_0xdccd('0xa'),auth[_0xdccd('0x8')](),controller[_0xdccd('0x16')]);router[_0xdccd('0x17')](_0xdccd('0xa'),auth[_0xdccd('0x8')](),controller[_0xdccd('0x18')]);router['delete'](_0xdccd('0x19'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xdccd('0x17')](_0xdccd('0xf'),auth[_0xdccd('0x8')](),controller[_0xdccd('0x1a')]);module[_0xdccd('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 2af0c74..e0dba0f 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 _0x16af=['STRING','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x16af,0x7c));var _0xf16a=function(_0x167e37,_0x5d4711){_0x167e37=_0x167e37-0x0;var _0x36a1cc=_0x16af[_0x167e37];return _0x36a1cc;};'use strict';var Sequelize=require(_0xf16a('0x0'));module[_0xf16a('0x1')]={'name':{'type':Sequelize[_0xf16a('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf16a('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf16a('0x3')](_0xf16a('0x4'),_0xf16a('0x5'),_0xf16a('0x6'))}}; \ No newline at end of file +var _0x1187=['ENUM','roundrobin','exports','name','STRING','INTEGER'];(function(_0x3f00ee,_0x1d1673){var _0x18a07e=function(_0x4dad57){while(--_0x4dad57){_0x3f00ee['push'](_0x3f00ee['shift']());}};_0x18a07e(++_0x1d1673);}(_0x1187,0x122));var _0x7118=function(_0x4dd1b3,_0x4ec057){_0x4dd1b3=_0x4dd1b3-0x0;var _0x3495af=_0x1187[_0x4dd1b3];return _0x3495af;};'use strict';var Sequelize=require('sequelize');module[_0x7118('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x7118('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7118('0x2')]},'timeout':{'type':Sequelize[_0x7118('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7118('0x4')]('rrmemory','beepall',_0x7118('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 6e45954..f00f2f9 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 _0x7e98=['clone','ut.UserId\x20=\x20?','toString','sequelize','QueryTypes','SELECT','TeamId','includes','union','compact','value','removeTeams','isEmpty','removeAgents','addAgents','spread','isArray','userSmsQueue:remove','getAgents','eml-format','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','then','destroy','SmsQueues','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','SmsQueue','includeAll','findAll','rows','show','rawAttributes','merge','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','findOne','UserSmsQueue','hasOwnProperty','pick','SmsQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','addTeams','each','forEach','emit','userSmsQueue:save','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId'];(function(_0x3eb74a,_0xbd4f5){var _0x56c99f=function(_0x1f0433){while(--_0x1f0433){_0x3eb74a['push'](_0x3eb74a['shift']());}};_0x56c99f(++_0xbd4f5);}(_0x7e98,0x1ba));var _0x87e9=function(_0xc7c83d,_0x4464a1){_0xc7c83d=_0xc7c83d-0x0;var _0x24c1e6=_0x7e98[_0xc7c83d];return _0x24c1e6;};'use strict';var emlformat=require(_0x87e9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x87e9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x87e9('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x87e9('0x3'));var util=require(_0x87e9('0x4'));var path=require(_0x87e9('0x5'));var sox=require(_0x87e9('0x6'));var csv=require(_0x87e9('0x7'));var ejs=require(_0x87e9('0x8'));var fs=require('fs');var fs_extra=require(_0x87e9('0x9'));var _=require(_0x87e9('0xa'));var squel=require(_0x87e9('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x87e9('0xc'));var toCsv=require(_0x87e9('0x7'));var querystring=require(_0x87e9('0xd'));var Papa=require(_0x87e9('0xe'));var Redis=require('ioredis');var authService=require(_0x87e9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x87e9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x87e9('0x11'))(_0x87e9('0x12'));var utils=require(_0x87e9('0x13'));var config=require(_0x87e9('0x14'));var licenseUtil=require(_0x87e9('0x15'));var db=require(_0x87e9('0x16'))['db'];config[_0x87e9('0x17')]=_['defaults'](config[_0x87e9('0x17')],{'host':_0x87e9('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x87e9('0x17')]));require(_0x87e9('0x19'))[_0x87e9('0x1a')](socket);function respondWithStatusCode(_0x15bfa6,_0x94d22b){_0x94d22b=_0x94d22b||0xcc;return function(_0x2ea369){if(_0x2ea369){return _0x15bfa6[_0x87e9('0x1b')](_0x94d22b);}return _0x15bfa6[_0x87e9('0x1c')](_0x94d22b)[_0x87e9('0x1d')]();};}function respondWithResult(_0xa363e8,_0x568e7a){_0x568e7a=_0x568e7a||0xc8;return function(_0x401b52){if(_0x401b52){return _0xa363e8[_0x87e9('0x1c')](_0x568e7a)[_0x87e9('0x1e')](_0x401b52);}};}function respondWithFilteredResult(_0x3927a1,_0x450a0e){return function(_0x51712a){if(_0x51712a){var _0x196ac3=typeof _0x450a0e[_0x87e9('0x1f')]==='undefined'&&typeof _0x450a0e[_0x87e9('0x20')]===_0x87e9('0x21');var _0x46d80d=_0x51712a['count'];var _0xa98dc4=_0x196ac3?0x0:_0x450a0e['offset'];var _0x250fa1=_0x196ac3?_0x51712a[_0x87e9('0x22')]:_0x450a0e[_0x87e9('0x1f')]+_0x450a0e['limit'];var _0x58bd64;if(_0x250fa1>=_0x46d80d){_0x250fa1=_0x46d80d;_0x58bd64=0xc8;}else{_0x58bd64=0xce;}_0x3927a1[_0x87e9('0x1c')](_0x58bd64);return _0x3927a1['set'](_0x87e9('0x23'),_0xa98dc4+'-'+_0x250fa1+'/'+_0x46d80d)[_0x87e9('0x1e')](_0x51712a);}return null;};}function patchUpdates(_0x50f82b){return function(_0x8ff86f){try{jsonpatch[_0x87e9('0x24')](_0x8ff86f,_0x50f82b,!![]);}catch(_0x368758){return BPromise['reject'](_0x368758);}return _0x8ff86f[_0x87e9('0x25')]();};}function saveUpdates(_0x80e20b,_0x39ffa8){return function(_0x4470a2){if(_0x4470a2){return _0x4470a2['update'](_0x80e20b)[_0x87e9('0x26')](function(_0x317fa3){return _0x317fa3;});}return null;};}function removeEntity(_0x5c681f,_0x4eb030){return function(_0x252481){if(_0x252481){return _0x252481[_0x87e9('0x27')]()['then'](function(){var _0x4a86b8=_0x252481['get']({'plain':!![]});var _0x228048=_0x87e9('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x228048,'resourceId':_0x4a86b8['id']}})[_0x87e9('0x26')](function(){return _0x252481;});})[_0x87e9('0x26')](function(){_0x5c681f['status'](0xcc)[_0x87e9('0x1d')]();});}};}function handleEntityNotFound(_0x835d32,_0x55fb2a){return function(_0x473809){if(!_0x473809){_0x835d32[_0x87e9('0x1b')](0x194);}return _0x473809;};}function handleError(_0x38442c,_0x4d4d6c){_0x4d4d6c=_0x4d4d6c||0x1f4;return function(_0x17785c){logger[_0x87e9('0x29')](_0x17785c[_0x87e9('0x2a')]);if(_0x17785c['name']){delete _0x17785c[_0x87e9('0x2b')];}_0x38442c['status'](_0x4d4d6c)[_0x87e9('0x2c')](_0x17785c);};}exports[_0x87e9('0x2d')]=function(_0x4fd551,_0x376676){var _0x5c7712={},_0x56207c={},_0x1a73f7={'count':0x0,'rows':[]};var _0x3302e1=_[_0x87e9('0x2e')](db['SmsQueue']['rawAttributes'],function(_0x569d05){return{'name':_0x569d05[_0x87e9('0x2f')],'type':_0x569d05[_0x87e9('0x30')][_0x87e9('0x31')]};});_0x56207c[_0x87e9('0x32')]=_[_0x87e9('0x2e')](_0x3302e1,_0x87e9('0x2b'));_0x56207c[_0x87e9('0x33')]=_[_0x87e9('0x34')](_0x4fd551['query']);_0x56207c[_0x87e9('0x35')]=_[_0x87e9('0x36')](_0x56207c[_0x87e9('0x32')],_0x56207c[_0x87e9('0x33')]);_0x5c7712[_0x87e9('0x37')]=_[_0x87e9('0x36')](_0x56207c[_0x87e9('0x32')],qs[_0x87e9('0x38')](_0x4fd551[_0x87e9('0x33')]['fields']));_0x5c7712[_0x87e9('0x37')]=_0x5c7712[_0x87e9('0x37')][_0x87e9('0x39')]?_0x5c7712['attributes']:_0x56207c['model'];if(!_0x4fd551[_0x87e9('0x33')]['hasOwnProperty'](_0x87e9('0x3a'))){_0x5c7712[_0x87e9('0x20')]=qs[_0x87e9('0x20')](_0x4fd551['query'][_0x87e9('0x20')]);_0x5c7712[_0x87e9('0x1f')]=qs['offset'](_0x4fd551[_0x87e9('0x33')]['offset']);}_0x5c7712[_0x87e9('0x3b')]=qs[_0x87e9('0x3c')](_0x4fd551[_0x87e9('0x33')]['sort']);_0x5c7712[_0x87e9('0x3d')]=qs['filters'](_['pick'](_0x4fd551['query'],_0x56207c[_0x87e9('0x35')]),_0x3302e1);if(_0x4fd551['query'][_0x87e9('0x3e')]){_0x5c7712[_0x87e9('0x3d')]=_['merge'](_0x5c7712[_0x87e9('0x3d')],{'$or':_[_0x87e9('0x2e')](_0x3302e1,function(_0x5ee245){if(_0x5ee245[_0x87e9('0x30')]!=='VIRTUAL'){var _0x610806={};_0x610806[_0x5ee245['name']]={'$like':'%'+_0x4fd551[_0x87e9('0x33')][_0x87e9('0x3e')]+'%'};return _0x610806;}})});}_0x5c7712=_['merge']({},_0x5c7712,_0x4fd551['options']);var _0x10f837={'where':_0x5c7712[_0x87e9('0x3d')]};return db[_0x87e9('0x3f')][_0x87e9('0x22')](_0x10f837)['then'](function(_0x4ed60c){_0x1a73f7[_0x87e9('0x22')]=_0x4ed60c;if(_0x4fd551[_0x87e9('0x33')][_0x87e9('0x40')]){_0x5c7712['include']=[{'all':!![]}];}return db[_0x87e9('0x3f')][_0x87e9('0x41')](_0x5c7712);})['then'](function(_0x4aa593){_0x1a73f7[_0x87e9('0x42')]=_0x4aa593;return _0x1a73f7;})[_0x87e9('0x26')](respondWithFilteredResult(_0x376676,_0x5c7712))['catch'](handleError(_0x376676,null));};exports[_0x87e9('0x43')]=function(_0x13d23a,_0xe34462){var _0x16c190={'raw':!![],'where':{'id':_0x13d23a['params']['id']}},_0x43f476={};_0x43f476[_0x87e9('0x32')]=_['keys'](db['SmsQueue'][_0x87e9('0x44')]);_0x43f476[_0x87e9('0x33')]=_[_0x87e9('0x34')](_0x13d23a[_0x87e9('0x33')]);_0x43f476[_0x87e9('0x35')]=_[_0x87e9('0x36')](_0x43f476[_0x87e9('0x32')],_0x43f476[_0x87e9('0x33')]);_0x16c190[_0x87e9('0x37')]=_[_0x87e9('0x36')](_0x43f476[_0x87e9('0x32')],qs[_0x87e9('0x38')](_0x13d23a[_0x87e9('0x33')][_0x87e9('0x38')]));_0x16c190[_0x87e9('0x37')]=_0x16c190[_0x87e9('0x37')][_0x87e9('0x39')]?_0x16c190[_0x87e9('0x37')]:_0x43f476['model'];if(_0x13d23a[_0x87e9('0x33')][_0x87e9('0x40')]){_0x16c190['include']=[{'all':!![]}];}_0x16c190=_[_0x87e9('0x45')]({},_0x16c190,_0x13d23a[_0x87e9('0x46')]);return db[_0x87e9('0x3f')][_0x87e9('0x47')](_0x16c190)[_0x87e9('0x26')](handleEntityNotFound(_0xe34462,null))[_0x87e9('0x26')](respondWithResult(_0xe34462,null))[_0x87e9('0x48')](handleError(_0xe34462,null));};exports[_0x87e9('0x49')]=function(_0x32f795,_0x30a395){return db['SmsQueue'][_0x87e9('0x49')](_0x32f795[_0x87e9('0x4a')],{})[_0x87e9('0x26')](function(_0x13a3a8){var _0x2bd623=_0x32f795[_0x87e9('0x4b')][_0x87e9('0x4c')]({'plain':!![]});if(!_0x2bd623)throw new Error(_0x87e9('0x4d'));if(_0x2bd623[_0x87e9('0x4e')]===_0x87e9('0x4b')){var _0xff344f=_0x13a3a8[_0x87e9('0x4c')]({'plain':!![]});var _0x15d568=_0x87e9('0x28');return db[_0x87e9('0x4f')][_0x87e9('0x47')]({'where':{'name':_0x15d568,'userProfileId':_0x2bd623[_0x87e9('0x50')]},'raw':!![]})['then'](function(_0x984fd8){if(_0x984fd8&&_0x984fd8[_0x87e9('0x51')]===0x0){return db[_0x87e9('0x52')]['create']({'name':_0xff344f[_0x87e9('0x2b')],'resourceId':_0xff344f['id'],'type':_0x984fd8[_0x87e9('0x2b')],'sectionId':_0x984fd8['id']},{})[_0x87e9('0x26')](function(){return _0x13a3a8;});}else{return _0x13a3a8;}})[_0x87e9('0x48')](function(_0x892a3f){logger[_0x87e9('0x29')](_0x87e9('0x53'),_0x892a3f);throw _0x892a3f;});}return _0x13a3a8;})[_0x87e9('0x26')](respondWithResult(_0x30a395,0xc9))[_0x87e9('0x48')](handleError(_0x30a395,null));};exports[_0x87e9('0x54')]=function(_0x787788,_0x90d8){if(_0x787788[_0x87e9('0x4a')]['id']){delete _0x787788[_0x87e9('0x4a')]['id'];}return db[_0x87e9('0x3f')][_0x87e9('0x47')]({'where':{'id':_0x787788[_0x87e9('0x55')]['id']}})[_0x87e9('0x26')](handleEntityNotFound(_0x90d8,null))['then'](saveUpdates(_0x787788['body'],null))['then'](respondWithResult(_0x90d8,null))[_0x87e9('0x48')](handleError(_0x90d8,null));};exports[_0x87e9('0x27')]=function(_0x1b2bc7,_0x4fbbb4){return db[_0x87e9('0x3f')]['find']({'where':{'id':_0x1b2bc7[_0x87e9('0x55')]['id']}})[_0x87e9('0x26')](handleEntityNotFound(_0x4fbbb4,null))[_0x87e9('0x26')](removeEntity(_0x4fbbb4,null))[_0x87e9('0x48')](handleError(_0x4fbbb4,null));};exports['describe']=function(_0x58b872,_0x1e9c2b){return db[_0x87e9('0x3f')][_0x87e9('0x56')]()['then'](respondWithResult(_0x1e9c2b,null))[_0x87e9('0x48')](handleError(_0x1e9c2b,null));};exports['getMembers']=function(_0x2984d1,_0x119f25,_0x538e23){var _0x243ea4={'raw':!![],'where':{}},_0xab90d7={},_0xba5afc;return db[_0x87e9('0x3f')][_0x87e9('0x57')]({'where':{'id':_0x2984d1['params']['id']}})[_0x87e9('0x26')](handleEntityNotFound(_0x119f25,null))[_0x87e9('0x26')](function(_0x45f8bb){if(_0x45f8bb){_0xba5afc=_0x45f8bb[_0x87e9('0x4c')]({'plain':!![]});_0xab90d7[_0x87e9('0x32')]=_['keys'](db[_0x87e9('0x58')][_0x87e9('0x44')]);_0xab90d7[_0x87e9('0x33')]=_[_0x87e9('0x34')](_0x2984d1[_0x87e9('0x33')]);_0xab90d7[_0x87e9('0x35')]=_[_0x87e9('0x36')](_0xab90d7[_0x87e9('0x32')],_0xab90d7[_0x87e9('0x33')]);_0x243ea4[_0x87e9('0x37')]=_[_0x87e9('0x36')](_0xab90d7[_0x87e9('0x32')],qs[_0x87e9('0x38')](_0x2984d1['query'][_0x87e9('0x38')]));_0x243ea4[_0x87e9('0x37')]=_0x243ea4[_0x87e9('0x37')][_0x87e9('0x39')]?_0x243ea4[_0x87e9('0x37')]:_0xab90d7[_0x87e9('0x32')];if(!_0x2984d1[_0x87e9('0x33')][_0x87e9('0x59')]('nolimit')){_0x243ea4[_0x87e9('0x20')]=qs[_0x87e9('0x20')](_0x2984d1['query'][_0x87e9('0x20')]);_0x243ea4[_0x87e9('0x1f')]=qs[_0x87e9('0x1f')](_0x2984d1['query']['offset']);}_0x243ea4['order']=qs[_0x87e9('0x3c')](_0x2984d1[_0x87e9('0x33')][_0x87e9('0x3c')]);_0x243ea4[_0x87e9('0x3d')]=qs[_0x87e9('0x35')](_[_0x87e9('0x5a')](_0x2984d1[_0x87e9('0x33')],_0xab90d7[_0x87e9('0x35')]));_0x243ea4[_0x87e9('0x3d')][_0x87e9('0x5b')]=_0x45f8bb['id'];if(_0x2984d1['query'][_0x87e9('0x3e')]){_0x243ea4[_0x87e9('0x3d')]=_[_0x87e9('0x45')](_0x243ea4[_0x87e9('0x3d')],{'$or':_[_0x87e9('0x2e')](_0x243ea4['attributes'],function(_0x3d40d9){var _0x5904a5={};_0x5904a5[_0x3d40d9]={'$like':'%'+_0x2984d1['query'][_0x87e9('0x3e')]+'%'};return _0x5904a5;})});}_0x243ea4=_[_0x87e9('0x45')]({},_0x243ea4,_0x2984d1[_0x87e9('0x46')]);return db['UserSmsQueue'][_0x87e9('0x41')](_0x243ea4);}})[_0x87e9('0x26')](function(_0x10929f){if(_0x10929f){return db[_0x87e9('0x5c')][_0x87e9('0x5d')]({'where':{'id':_[_0x87e9('0x2e')](_0x10929f,_0x87e9('0x5e')),'role':_0x87e9('0x5f')},'attributes':['id',_0x87e9('0x2b'),'smsPause',_0x87e9('0x60'),_0x87e9('0x61')]});}})[_0x87e9('0x26')](function(_0x350c40){if(_0x350c40){return{'count':_0x350c40[_0x87e9('0x22')],'rows':_[_0x87e9('0x2e')](_0x350c40[_0x87e9('0x42')],function(_0x525d7d){return{'membername':_0x525d7d[_0x87e9('0x2b')],'UserId':_0x525d7d['id'],'queue_name':_0xba5afc[_0x87e9('0x2b')],'SmsQueueId':_0xba5afc['id'],'interface':util[_0x87e9('0x62')](_0x87e9('0x63'),_0x87e9('0x64'),_0x525d7d[_0x87e9('0x2b')]),'penalty':0x0,'paused':_0x525d7d['smsPause'],'createdAt':_0x525d7d['createdAt'],'updatedAt':_0x525d7d[_0x87e9('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x87e9('0x26')](respondWithFilteredResult(_0x119f25,_0x243ea4))[_0x87e9('0x48')](handleError(_0x119f25,null));};exports['getTeams']=function(_0x4930b5,_0x1a5b43,_0x257e67){var _0x5a6788={};var _0x54c2be={};var _0x2bdccd;var _0x117714;return db['SmsQueue'][_0x87e9('0x57')]({'where':{'id':_0x4930b5[_0x87e9('0x55')]['id']}})[_0x87e9('0x26')](handleEntityNotFound(_0x1a5b43,null))[_0x87e9('0x26')](function(_0x14cc8f){if(_0x14cc8f){_0x2bdccd=_0x14cc8f;_0x54c2be[_0x87e9('0x32')]=_[_0x87e9('0x34')](db[_0x87e9('0x65')][_0x87e9('0x44')]);_0x54c2be[_0x87e9('0x33')]=_[_0x87e9('0x34')](_0x4930b5[_0x87e9('0x33')]);_0x54c2be['filters']=_['intersection'](_0x54c2be[_0x87e9('0x32')],_0x54c2be['query']);_0x5a6788[_0x87e9('0x37')]=_[_0x87e9('0x36')](_0x54c2be[_0x87e9('0x32')],qs[_0x87e9('0x38')](_0x4930b5[_0x87e9('0x33')][_0x87e9('0x38')]));_0x5a6788['attributes']=_0x5a6788[_0x87e9('0x37')]['length']?_0x5a6788[_0x87e9('0x37')]:_0x54c2be[_0x87e9('0x32')];_0x5a6788[_0x87e9('0x3b')]=qs['sort'](_0x4930b5[_0x87e9('0x33')][_0x87e9('0x3c')]);_0x5a6788[_0x87e9('0x3d')]=qs[_0x87e9('0x35')](_[_0x87e9('0x5a')](_0x4930b5['query'],_0x54c2be[_0x87e9('0x35')]));if(_0x4930b5['query'][_0x87e9('0x3e')]){_0x5a6788[_0x87e9('0x3d')]=_[_0x87e9('0x45')](_0x5a6788[_0x87e9('0x3d')],{'$or':_['map'](_0x5a6788['attributes'],function(_0x507626){var _0x21c99f={};_0x21c99f[_0x507626]={'$like':'%'+_0x4930b5[_0x87e9('0x33')][_0x87e9('0x3e')]+'%'};return _0x21c99f;})});}_0x5a6788=_[_0x87e9('0x45')]({},_0x5a6788,_0x4930b5[_0x87e9('0x46')]);return _0x2bdccd['getTeams'](_0x5a6788);}})[_0x87e9('0x26')](function(_0xf7d454){if(_0xf7d454){_0x117714=_0xf7d454[_0x87e9('0x39')];if(!_0x4930b5[_0x87e9('0x33')]['hasOwnProperty'](_0x87e9('0x3a'))){_0x5a6788['limit']=qs[_0x87e9('0x20')](_0x4930b5['query'][_0x87e9('0x20')]);_0x5a6788[_0x87e9('0x1f')]=qs[_0x87e9('0x1f')](_0x4930b5[_0x87e9('0x33')][_0x87e9('0x1f')]);}return _0x2bdccd[_0x87e9('0x66')](_0x5a6788);}})[_0x87e9('0x26')](function(_0x1ed0ca){if(_0x1ed0ca){return _0x1ed0ca?{'count':_0x117714,'rows':_0x1ed0ca}:null;}})[_0x87e9('0x26')](respondWithResult(_0x1a5b43,null))[_0x87e9('0x48')](handleError(_0x1a5b43,null));};exports['addTeams']=function(_0x1382ed,_0x5d2195,_0x5e1e36){var _0x41a7c0=_0x1382ed['body'][_0x87e9('0x67')];return db[_0x87e9('0x65')][_0x87e9('0x41')]({'where':{'id':_0x41a7c0},'attributes':['id'],'include':[{'model':db['User'],'as':_0x87e9('0x68'),'attributes':['id',_0x87e9('0x2b'),_0x87e9('0x69'),_0x87e9('0x6a'),_0x87e9('0x6b')],'raw':!![]}]})[_0x87e9('0x26')](function(_0x3e1249){if(_0x3e1249){var _0x7f4302=_[_0x87e9('0x6c')](_0x3e1249,function(_0x5cc8a2){var _0x3fc254=_0x5cc8a2[_0x87e9('0x4c')]({'plain':!![]});return _0x3fc254[_0x87e9('0x68')];});return db[_0x87e9('0x3f')]['find']({'where':{'id':_0x1382ed['params']['id']}})[_0x87e9('0x26')](function(_0x2bf439){return db['sequelize'][_0x87e9('0x6d')](function(_0x111903){return _0x2bf439[_0x87e9('0x6e')](_0x41a7c0,{'transaction':_0x111903})[_0x87e9('0x26')](function(){return BPromise[_0x87e9('0x6f')](_0x7f4302,function(_0x4aa589){return db[_0x87e9('0x58')]['findOrCreate']({'where':{'UserId':_0x4aa589['id'],'SmsQueueId':_0x1382ed['params']['id']},'transaction':_0x111903});});})[_0x87e9('0x26')](function(){_0x7f4302[_0x87e9('0x70')](function(_0x3c1a09){socket[_0x87e9('0x71')](_0x87e9('0x72'),{'UserId':_0x3c1a09['id'],'SmsQueueId':_0x2bf439['id']});});});});});}})[_0x87e9('0x26')](respondWithStatusCode(_0x5d2195,null))[_0x87e9('0x48')](handleError(_0x5d2195,null));};exports['removeTeams']=function(_0x10b085,_0x463c01,_0x561fd9){return db[_0x87e9('0x65')]['findAll']({'where':{'id':_0x10b085[_0x87e9('0x33')][_0x87e9('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x87e9('0x68'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x463c01,null))[_0x87e9('0x26')](function(_0x397bad){var _0xf0c938=_[_0x87e9('0x2e')](_0x397bad,'id');var _0x24f4f2=[];var _0x4caa84=[];var _0x40a8fa=squel[_0x87e9('0x73')]();_0x40a8fa[_0x87e9('0x74')]('tq.TeamId')[_0x87e9('0x75')](_0x87e9('0x76'),'tq')[_0x87e9('0x77')](_0x87e9('0x78'),'ut',_0x87e9('0x79'))['where']('SmsQueueId\x20=\x20?',_0x10b085[_0x87e9('0x55')]['id']);for(var _0xcea89b=0x0;_0xcea89b<_0x397bad[_0x87e9('0x39')];_0xcea89b+=0x1){let _0x21d93e=_0x397bad[_0xcea89b];for(var _0x1851e4=0x0;_0x1851e4<_0x21d93e[_0x87e9('0x68')]['length'];_0x1851e4+=0x1){let _0x5ed9b6=_0x21d93e['Agents'][_0x1851e4];var _0x34b38e=_0x40a8fa[_0x87e9('0x7a')]();_0x34b38e[_0x87e9('0x3d')](_0x87e9('0x7b'),_0x5ed9b6['id']);_0x4caa84['push'](db['sequelize'][_0x87e9('0x33')](_0x34b38e[_0x87e9('0x7c')](),{'type':db[_0x87e9('0x7d')][_0x87e9('0x7e')][_0x87e9('0x7f')]})[_0x87e9('0x26')](function(_0x30c0cc){if(_0x30c0cc[_0x87e9('0x39')]===0x1){return _0x5ed9b6['id'];}else{var _0x529a4d=_['every'](_[_0x87e9('0x2e')](_0x30c0cc,_0x87e9('0x80')),function(_0xcd063e){return _[_0x87e9('0x81')](_0xf0c938,_0xcd063e);});if(_0x529a4d){return _0x5ed9b6['id'];}}}));}}return BPromise['all'](_0x4caa84)['then'](function(_0xd9d40d){_0x24f4f2=_(_0x24f4f2)[_0x87e9('0x82')](_0xd9d40d)[_0x87e9('0x83')]()[_0x87e9('0x84')]();return db[_0x87e9('0x3f')][_0x87e9('0x47')]({'where':{'id':_0x10b085[_0x87e9('0x55')]['id']}})[_0x87e9('0x26')](function(_0x176192){return db[_0x87e9('0x7d')][_0x87e9('0x6d')](function(_0x105642){return _0x176192[_0x87e9('0x85')](_0x10b085[_0x87e9('0x33')][_0x87e9('0x67')],{'transaction':_0x105642})[_0x87e9('0x26')](function(){if(!_[_0x87e9('0x86')](_0x24f4f2)){return _0x176192[_0x87e9('0x87')](_0x24f4f2,{'transaction':_0x105642});}})[_0x87e9('0x26')](function(){_0x24f4f2['forEach'](function(_0x498dbb){socket[_0x87e9('0x71')]('userSmsQueue:remove',{'UserId':_0x498dbb,'SmsQueueId':_0x176192['id']});});});});});});})[_0x87e9('0x26')](respondWithStatusCode(_0x463c01,null))[_0x87e9('0x48')](handleError(_0x463c01,null));};exports[_0x87e9('0x88')]=function(_0x50940f,_0x370047,_0x867abb){return db['SmsQueue'][_0x87e9('0x47')]({'where':{'id':_0x50940f['params']['id']}})[_0x87e9('0x26')](handleEntityNotFound(_0x370047,null))[_0x87e9('0x26')](function(_0x1875de){if(_0x1875de){return _0x1875de['addAgents'](_0x50940f[_0x87e9('0x4a')]['ids'],_['omit'](_0x50940f[_0x87e9('0x4a')],[_0x87e9('0x67'),'id'])||{})[_0x87e9('0x89')](function(_0x4fd293){for(var _0xb00653=0x0;_0xb00653<_0x50940f[_0x87e9('0x4a')]['ids']['length'];_0xb00653+=0x1){socket['emit'](_0x87e9('0x72'),{'UserId':Number(_0x50940f[_0x87e9('0x4a')][_0x87e9('0x67')][_0xb00653]),'SmsQueueId':Number(_0x50940f[_0x87e9('0x55')]['id'])});}return _0x4fd293;});}})[_0x87e9('0x26')](respondWithResult(_0x370047,null))[_0x87e9('0x48')](handleError(_0x370047,null));};exports[_0x87e9('0x87')]=function(_0x184511,_0x130f49,_0xe57645){return db['SmsQueue']['find']({'where':{'id':_0x184511[_0x87e9('0x55')]['id']}})[_0x87e9('0x26')](handleEntityNotFound(_0x130f49,null))[_0x87e9('0x26')](function(_0x1c8184){if(_0x1c8184){return _0x1c8184[_0x87e9('0x87')](_0x184511[_0x87e9('0x33')]['ids'])[_0x87e9('0x26')](function(){if(_[_0x87e9('0x8a')](_0x184511[_0x87e9('0x33')][_0x87e9('0x67')])){for(var _0x292955=0x0;_0x292955<_0x184511[_0x87e9('0x33')][_0x87e9('0x67')][_0x87e9('0x39')];_0x292955+=0x1){socket[_0x87e9('0x71')]('userSmsQueue:remove',{'UserId':Number(_0x184511[_0x87e9('0x33')][_0x87e9('0x67')][_0x292955]),'SmsQueueId':Number(_0x184511[_0x87e9('0x55')]['id'])});}}else{socket[_0x87e9('0x71')](_0x87e9('0x8b'),{'UserId':Number(_0x184511[_0x87e9('0x33')][_0x87e9('0x67')]),'SmsQueueId':Number(_0x184511[_0x87e9('0x55')]['id'])});}});}})[_0x87e9('0x26')](respondWithStatusCode(_0x130f49,null))['catch'](handleError(_0x130f49,null));};exports[_0x87e9('0x8c')]=function(_0x22fb65,_0x2ca569,_0x530700){var _0xa85bfc={};var _0x42c55d={};var _0x200c0e;var _0x44572b;return db['SmsQueue']['findOne']({'where':{'id':_0x22fb65['params']['id']}})[_0x87e9('0x26')](handleEntityNotFound(_0x2ca569,null))[_0x87e9('0x26')](function(_0xcd690b){if(_0xcd690b){_0x200c0e=_0xcd690b;_0x42c55d[_0x87e9('0x32')]=_['keys'](db[_0x87e9('0x5c')][_0x87e9('0x44')]);_0x42c55d[_0x87e9('0x33')]=_['keys'](_0x22fb65['query']);_0x42c55d[_0x87e9('0x35')]=_[_0x87e9('0x36')](_0x42c55d[_0x87e9('0x32')],_0x42c55d[_0x87e9('0x33')]);_0xa85bfc[_0x87e9('0x37')]=_[_0x87e9('0x36')](_0x42c55d['model'],qs[_0x87e9('0x38')](_0x22fb65['query']['fields']));_0xa85bfc[_0x87e9('0x37')]=_0xa85bfc['attributes'][_0x87e9('0x39')]?_0xa85bfc['attributes']:_0x42c55d['model'];_0xa85bfc['order']=qs['sort'](_0x22fb65[_0x87e9('0x33')][_0x87e9('0x3c')]);_0xa85bfc['where']=qs[_0x87e9('0x35')](_[_0x87e9('0x5a')](_0x22fb65[_0x87e9('0x33')],_0x42c55d[_0x87e9('0x35')]));if(_0x22fb65[_0x87e9('0x33')][_0x87e9('0x3e')]){_0xa85bfc[_0x87e9('0x3d')]=_[_0x87e9('0x45')](_0xa85bfc[_0x87e9('0x3d')],{'$or':_[_0x87e9('0x2e')](_0xa85bfc['attributes'],function(_0x7b3f5e){var _0x4d0cff={};_0x4d0cff[_0x7b3f5e]={'$like':'%'+_0x22fb65[_0x87e9('0x33')]['filter']+'%'};return _0x4d0cff;})});}_0xa85bfc=_[_0x87e9('0x45')]({},_0xa85bfc,_0x22fb65['options']);return _0x200c0e['getAgents'](_0xa85bfc);}})[_0x87e9('0x26')](function(_0x1b2572){if(_0x1b2572){_0x44572b=_0x1b2572[_0x87e9('0x39')];if(!_0x22fb65[_0x87e9('0x33')]['hasOwnProperty'](_0x87e9('0x3a'))){_0xa85bfc[_0x87e9('0x20')]=qs[_0x87e9('0x20')](_0x22fb65[_0x87e9('0x33')][_0x87e9('0x20')]);_0xa85bfc[_0x87e9('0x1f')]=qs[_0x87e9('0x1f')](_0x22fb65[_0x87e9('0x33')]['offset']);}return _0x200c0e[_0x87e9('0x8c')](_0xa85bfc);}})[_0x87e9('0x26')](function(_0x596402){if(_0x596402){return _0x596402?{'count':_0x44572b,'rows':_0x596402}:null;}})['then'](respondWithResult(_0x2ca569,null))[_0x87e9('0x48')](handleError(_0x2ca569,null));}; \ No newline at end of file +var _0x1806=['includeAll','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','filter','findAll','User','findAndCountAll','agent','smsPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','order','addTeams','Agents','online','voicePause','flatMap','get','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','ids','select','from','team_has_sms_queues','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','isArray','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','status','json','offset','undefined','limit','count','set','apply','save','update','then','SmsQueues','UserProfileResource','destroy','end','sendStatus','error','stack','name','send','map','SmsQueue','rawAttributes','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options'];(function(_0x533136,_0x3ba2db){var _0x484d2c=function(_0x4b4f15){while(--_0x4b4f15){_0x533136['push'](_0x533136['shift']());}};_0x484d2c(++_0x3ba2db);}(_0x1806,0x162));var _0x6180=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x1806[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x6180('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6180('0x1'));var rp=require(_0x6180('0x2'));var moment=require(_0x6180('0x3'));var BPromise=require(_0x6180('0x4'));var Mustache=require('mustache');var util=require(_0x6180('0x5'));var path=require('path');var sox=require(_0x6180('0x6'));var csv=require(_0x6180('0x7'));var ejs=require(_0x6180('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6180('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6180('0xa'));var deskjs=require(_0x6180('0xb'));var toCsv=require(_0x6180('0x7'));var querystring=require(_0x6180('0xc'));var Papa=require(_0x6180('0xd'));var Redis=require('ioredis');var authService=require(_0x6180('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6180('0xf'));var hardwareService=require(_0x6180('0x10'));var logger=require(_0x6180('0x11'))(_0x6180('0x12'));var utils=require(_0x6180('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6180('0x14'));var db=require(_0x6180('0x15'))['db'];config[_0x6180('0x16')]=_[_0x6180('0x17')](config['redis'],{'host':_0x6180('0x18'),'port':0x18eb});var socket=require(_0x6180('0x19'))(new Redis(config[_0x6180('0x16')]));require(_0x6180('0x1a'))[_0x6180('0x1b')](socket);function respondWithStatusCode(_0x5be4f7,_0x545d14){_0x545d14=_0x545d14||0xcc;return function(_0x2307b8){if(_0x2307b8){return _0x5be4f7['sendStatus'](_0x545d14);}return _0x5be4f7[_0x6180('0x1c')](_0x545d14)['end']();};}function respondWithResult(_0x29e96a,_0x50ea08){_0x50ea08=_0x50ea08||0xc8;return function(_0x598f9e){if(_0x598f9e){return _0x29e96a[_0x6180('0x1c')](_0x50ea08)[_0x6180('0x1d')](_0x598f9e);}};}function respondWithFilteredResult(_0x4b200e,_0x5c03ff){return function(_0x46e2cf){if(_0x46e2cf){var _0x2422f4=typeof _0x5c03ff[_0x6180('0x1e')]===_0x6180('0x1f')&&typeof _0x5c03ff[_0x6180('0x20')]===_0x6180('0x1f');var _0x2e070d=_0x46e2cf[_0x6180('0x21')];var _0x23ef72=_0x2422f4?0x0:_0x5c03ff[_0x6180('0x1e')];var _0x229e74=_0x2422f4?_0x46e2cf[_0x6180('0x21')]:_0x5c03ff[_0x6180('0x1e')]+_0x5c03ff['limit'];var _0x493444;if(_0x229e74>=_0x2e070d){_0x229e74=_0x2e070d;_0x493444=0xc8;}else{_0x493444=0xce;}_0x4b200e[_0x6180('0x1c')](_0x493444);return _0x4b200e[_0x6180('0x22')]('Content-Range',_0x23ef72+'-'+_0x229e74+'/'+_0x2e070d)[_0x6180('0x1d')](_0x46e2cf);}return null;};}function patchUpdates(_0x709de6){return function(_0x848dce){try{jsonpatch[_0x6180('0x23')](_0x848dce,_0x709de6,!![]);}catch(_0x585916){return BPromise['reject'](_0x585916);}return _0x848dce[_0x6180('0x24')]();};}function saveUpdates(_0x3c77cb,_0x995c18){return function(_0x539e7c){if(_0x539e7c){return _0x539e7c[_0x6180('0x25')](_0x3c77cb)[_0x6180('0x26')](function(_0x11886c){return _0x11886c;});}return null;};}function removeEntity(_0x476616,_0x22802c){return function(_0x2262db){if(_0x2262db){return _0x2262db['destroy']()[_0x6180('0x26')](function(){var _0x329fe4=_0x2262db['get']({'plain':!![]});var _0x2eeaa1=_0x6180('0x27');return db[_0x6180('0x28')][_0x6180('0x29')]({'where':{'type':_0x2eeaa1,'resourceId':_0x329fe4['id']}})[_0x6180('0x26')](function(){return _0x2262db;});})['then'](function(){_0x476616['status'](0xcc)[_0x6180('0x2a')]();});}};}function handleEntityNotFound(_0x5a1194,_0xf0bec9){return function(_0x4a0421){if(!_0x4a0421){_0x5a1194[_0x6180('0x2b')](0x194);}return _0x4a0421;};}function handleError(_0x28c7c2,_0x400bfd){_0x400bfd=_0x400bfd||0x1f4;return function(_0x3b9b18){logger[_0x6180('0x2c')](_0x3b9b18[_0x6180('0x2d')]);if(_0x3b9b18['name']){delete _0x3b9b18[_0x6180('0x2e')];}_0x28c7c2[_0x6180('0x1c')](_0x400bfd)[_0x6180('0x2f')](_0x3b9b18);};}exports['index']=function(_0x194440,_0xa20be8){var _0x3946d5={},_0x12607c={},_0x459eb0={'count':0x0,'rows':[]};var _0x428b07=_[_0x6180('0x30')](db[_0x6180('0x31')][_0x6180('0x32')],function(_0x59b058){return{'name':_0x59b058['fieldName'],'type':_0x59b058[_0x6180('0x33')][_0x6180('0x34')]};});_0x12607c[_0x6180('0x35')]=_[_0x6180('0x30')](_0x428b07,_0x6180('0x2e'));_0x12607c[_0x6180('0x36')]=_[_0x6180('0x37')](_0x194440[_0x6180('0x36')]);_0x12607c[_0x6180('0x38')]=_[_0x6180('0x39')](_0x12607c[_0x6180('0x35')],_0x12607c[_0x6180('0x36')]);_0x3946d5['attributes']=_[_0x6180('0x39')](_0x12607c['model'],qs[_0x6180('0x3a')](_0x194440[_0x6180('0x36')][_0x6180('0x3a')]));_0x3946d5['attributes']=_0x3946d5['attributes'][_0x6180('0x3b')]?_0x3946d5[_0x6180('0x3c')]:_0x12607c['model'];if(!_0x194440[_0x6180('0x36')][_0x6180('0x3d')](_0x6180('0x3e'))){_0x3946d5['limit']=qs['limit'](_0x194440[_0x6180('0x36')][_0x6180('0x20')]);_0x3946d5[_0x6180('0x1e')]=qs[_0x6180('0x1e')](_0x194440[_0x6180('0x36')][_0x6180('0x1e')]);}_0x3946d5['order']=qs[_0x6180('0x3f')](_0x194440[_0x6180('0x36')][_0x6180('0x3f')]);_0x3946d5[_0x6180('0x40')]=qs[_0x6180('0x38')](_[_0x6180('0x41')](_0x194440[_0x6180('0x36')],_0x12607c['filters']),_0x428b07);if(_0x194440[_0x6180('0x36')]['filter']){_0x3946d5[_0x6180('0x40')]=_[_0x6180('0x42')](_0x3946d5[_0x6180('0x40')],{'$or':_[_0x6180('0x30')](_0x428b07,function(_0x3d09b2){if(_0x3d09b2[_0x6180('0x33')]!==_0x6180('0x43')){var _0x39d306={};_0x39d306[_0x3d09b2[_0x6180('0x2e')]]={'$like':'%'+_0x194440[_0x6180('0x36')]['filter']+'%'};return _0x39d306;}})});}_0x3946d5=_[_0x6180('0x42')]({},_0x3946d5,_0x194440[_0x6180('0x44')]);var _0x4e4771={'where':_0x3946d5[_0x6180('0x40')]};return db[_0x6180('0x31')][_0x6180('0x21')](_0x4e4771)['then'](function(_0x4c07b3){_0x459eb0[_0x6180('0x21')]=_0x4c07b3;if(_0x194440[_0x6180('0x36')][_0x6180('0x45')]){_0x3946d5['include']=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0x3946d5);})[_0x6180('0x26')](function(_0x1e21fc){_0x459eb0['rows']=_0x1e21fc;return _0x459eb0;})[_0x6180('0x26')](respondWithFilteredResult(_0xa20be8,_0x3946d5))[_0x6180('0x46')](handleError(_0xa20be8,null));};exports[_0x6180('0x47')]=function(_0x5383c4,_0xf7608b){var _0x225c2e={'raw':!![],'where':{'id':_0x5383c4[_0x6180('0x48')]['id']}},_0x2c6969={};_0x2c6969[_0x6180('0x35')]=_[_0x6180('0x37')](db[_0x6180('0x31')][_0x6180('0x32')]);_0x2c6969[_0x6180('0x36')]=_[_0x6180('0x37')](_0x5383c4[_0x6180('0x36')]);_0x2c6969[_0x6180('0x38')]=_['intersection'](_0x2c6969['model'],_0x2c6969[_0x6180('0x36')]);_0x225c2e[_0x6180('0x3c')]=_[_0x6180('0x39')](_0x2c6969[_0x6180('0x35')],qs['fields'](_0x5383c4[_0x6180('0x36')][_0x6180('0x3a')]));_0x225c2e[_0x6180('0x3c')]=_0x225c2e[_0x6180('0x3c')][_0x6180('0x3b')]?_0x225c2e[_0x6180('0x3c')]:_0x2c6969[_0x6180('0x35')];if(_0x5383c4['query'][_0x6180('0x45')]){_0x225c2e[_0x6180('0x49')]=[{'all':!![]}];}_0x225c2e=_['merge']({},_0x225c2e,_0x5383c4['options']);return db[_0x6180('0x31')][_0x6180('0x4a')](_0x225c2e)['then'](handleEntityNotFound(_0xf7608b,null))['then'](respondWithResult(_0xf7608b,null))['catch'](handleError(_0xf7608b,null));};exports[_0x6180('0x4b')]=function(_0x2217e3,_0x207873){return db[_0x6180('0x31')]['create'](_0x2217e3[_0x6180('0x4c')],{})['then'](function(_0x52a2c3){var _0x305cb4=_0x2217e3[_0x6180('0x4d')]['get']({'plain':!![]});if(!_0x305cb4)throw new Error(_0x6180('0x4e'));if(_0x305cb4[_0x6180('0x4f')]==='user'){var _0x4b8961=_0x52a2c3['get']({'plain':!![]});var _0xc18999=_0x6180('0x27');return db['UserProfileSection'][_0x6180('0x4a')]({'where':{'name':_0xc18999,'userProfileId':_0x305cb4[_0x6180('0x50')]},'raw':!![]})[_0x6180('0x26')](function(_0x313442){if(_0x313442&&_0x313442[_0x6180('0x51')]===0x0){return db['UserProfileResource'][_0x6180('0x4b')]({'name':_0x4b8961[_0x6180('0x2e')],'resourceId':_0x4b8961['id'],'type':_0x313442[_0x6180('0x2e')],'sectionId':_0x313442['id']},{})[_0x6180('0x26')](function(){return _0x52a2c3;});}else{return _0x52a2c3;}})[_0x6180('0x46')](function(_0x524d7c){logger[_0x6180('0x2c')](_0x6180('0x52'),_0x524d7c);throw _0x524d7c;});}return _0x52a2c3;})[_0x6180('0x26')](respondWithResult(_0x207873,0xc9))['catch'](handleError(_0x207873,null));};exports[_0x6180('0x25')]=function(_0x3a5994,_0x358bc9){if(_0x3a5994[_0x6180('0x4c')]['id']){delete _0x3a5994[_0x6180('0x4c')]['id'];}return db[_0x6180('0x31')]['find']({'where':{'id':_0x3a5994[_0x6180('0x48')]['id']}})['then'](handleEntityNotFound(_0x358bc9,null))[_0x6180('0x26')](saveUpdates(_0x3a5994['body'],null))[_0x6180('0x26')](respondWithResult(_0x358bc9,null))[_0x6180('0x46')](handleError(_0x358bc9,null));};exports[_0x6180('0x29')]=function(_0x29025b,_0x1630ee){return db[_0x6180('0x31')][_0x6180('0x4a')]({'where':{'id':_0x29025b[_0x6180('0x48')]['id']}})['then'](handleEntityNotFound(_0x1630ee,null))[_0x6180('0x26')](removeEntity(_0x1630ee,null))[_0x6180('0x46')](handleError(_0x1630ee,null));};exports[_0x6180('0x53')]=function(_0xf3e584,_0x40be1b){return db[_0x6180('0x31')][_0x6180('0x53')]()[_0x6180('0x26')](respondWithResult(_0x40be1b,null))['catch'](handleError(_0x40be1b,null));};exports[_0x6180('0x54')]=function(_0x14e8cf,_0x509271,_0x257744){var _0x347923={'raw':!![],'where':{}},_0x25953a={},_0x4a4bd8;return db[_0x6180('0x31')][_0x6180('0x55')]({'where':{'id':_0x14e8cf[_0x6180('0x48')]['id']}})['then'](handleEntityNotFound(_0x509271,null))['then'](function(_0x209fe0){if(_0x209fe0){_0x4a4bd8=_0x209fe0['get']({'plain':!![]});_0x25953a[_0x6180('0x35')]=_['keys'](db[_0x6180('0x56')][_0x6180('0x32')]);_0x25953a[_0x6180('0x36')]=_[_0x6180('0x37')](_0x14e8cf[_0x6180('0x36')]);_0x25953a[_0x6180('0x38')]=_[_0x6180('0x39')](_0x25953a['model'],_0x25953a['query']);_0x347923['attributes']=_[_0x6180('0x39')](_0x25953a[_0x6180('0x35')],qs[_0x6180('0x3a')](_0x14e8cf[_0x6180('0x36')][_0x6180('0x3a')]));_0x347923['attributes']=_0x347923[_0x6180('0x3c')][_0x6180('0x3b')]?_0x347923[_0x6180('0x3c')]:_0x25953a[_0x6180('0x35')];if(!_0x14e8cf[_0x6180('0x36')]['hasOwnProperty'](_0x6180('0x3e'))){_0x347923[_0x6180('0x20')]=qs[_0x6180('0x20')](_0x14e8cf['query'][_0x6180('0x20')]);_0x347923[_0x6180('0x1e')]=qs['offset'](_0x14e8cf['query']['offset']);}_0x347923['order']=qs[_0x6180('0x3f')](_0x14e8cf[_0x6180('0x36')][_0x6180('0x3f')]);_0x347923[_0x6180('0x40')]=qs[_0x6180('0x38')](_[_0x6180('0x41')](_0x14e8cf[_0x6180('0x36')],_0x25953a[_0x6180('0x38')]));_0x347923[_0x6180('0x40')][_0x6180('0x57')]=_0x209fe0['id'];if(_0x14e8cf[_0x6180('0x36')]['filter']){_0x347923[_0x6180('0x40')]=_[_0x6180('0x42')](_0x347923[_0x6180('0x40')],{'$or':_[_0x6180('0x30')](_0x347923[_0x6180('0x3c')],function(_0x5601a5){var _0x20b70b={};_0x20b70b[_0x5601a5]={'$like':'%'+_0x14e8cf[_0x6180('0x36')][_0x6180('0x58')]+'%'};return _0x20b70b;})});}_0x347923=_[_0x6180('0x42')]({},_0x347923,_0x14e8cf[_0x6180('0x44')]);return db[_0x6180('0x56')][_0x6180('0x59')](_0x347923);}})['then'](function(_0x27fd40){if(_0x27fd40){return db[_0x6180('0x5a')][_0x6180('0x5b')]({'where':{'id':_[_0x6180('0x30')](_0x27fd40,'UserId'),'role':_0x6180('0x5c')},'attributes':['id',_0x6180('0x2e'),_0x6180('0x5d'),_0x6180('0x5e'),_0x6180('0x5f')]});}})[_0x6180('0x26')](function(_0x539fa2){if(_0x539fa2){return{'count':_0x539fa2[_0x6180('0x21')],'rows':_[_0x6180('0x30')](_0x539fa2[_0x6180('0x60')],function(_0x170a20){return{'membername':_0x170a20[_0x6180('0x2e')],'UserId':_0x170a20['id'],'queue_name':_0x4a4bd8['name'],'SmsQueueId':_0x4a4bd8['id'],'interface':util[_0x6180('0x61')](_0x6180('0x62'),_0x6180('0x63'),_0x170a20[_0x6180('0x2e')]),'penalty':0x0,'paused':_0x170a20['smsPause'],'createdAt':_0x170a20[_0x6180('0x5f')],'updatedAt':_0x170a20[_0x6180('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6180('0x26')](respondWithFilteredResult(_0x509271,_0x347923))['catch'](handleError(_0x509271,null));};exports[_0x6180('0x64')]=function(_0x19abbc,_0x7ac57c,_0x1a01e5){var _0x4c554b={};var _0xff0544={};var _0x1a930b;var _0x35c816;return db['SmsQueue'][_0x6180('0x55')]({'where':{'id':_0x19abbc[_0x6180('0x48')]['id']}})[_0x6180('0x26')](handleEntityNotFound(_0x7ac57c,null))[_0x6180('0x26')](function(_0x5093e0){if(_0x5093e0){_0x1a930b=_0x5093e0;_0xff0544[_0x6180('0x35')]=_[_0x6180('0x37')](db[_0x6180('0x65')][_0x6180('0x32')]);_0xff0544[_0x6180('0x36')]=_[_0x6180('0x37')](_0x19abbc[_0x6180('0x36')]);_0xff0544['filters']=_[_0x6180('0x39')](_0xff0544['model'],_0xff0544[_0x6180('0x36')]);_0x4c554b['attributes']=_['intersection'](_0xff0544[_0x6180('0x35')],qs[_0x6180('0x3a')](_0x19abbc['query']['fields']));_0x4c554b[_0x6180('0x3c')]=_0x4c554b[_0x6180('0x3c')][_0x6180('0x3b')]?_0x4c554b[_0x6180('0x3c')]:_0xff0544[_0x6180('0x35')];_0x4c554b[_0x6180('0x66')]=qs['sort'](_0x19abbc['query'][_0x6180('0x3f')]);_0x4c554b[_0x6180('0x40')]=qs[_0x6180('0x38')](_[_0x6180('0x41')](_0x19abbc[_0x6180('0x36')],_0xff0544[_0x6180('0x38')]));if(_0x19abbc[_0x6180('0x36')][_0x6180('0x58')]){_0x4c554b['where']=_[_0x6180('0x42')](_0x4c554b[_0x6180('0x40')],{'$or':_[_0x6180('0x30')](_0x4c554b[_0x6180('0x3c')],function(_0x4416de){var _0x39ee57={};_0x39ee57[_0x4416de]={'$like':'%'+_0x19abbc[_0x6180('0x36')][_0x6180('0x58')]+'%'};return _0x39ee57;})});}_0x4c554b=_[_0x6180('0x42')]({},_0x4c554b,_0x19abbc['options']);return _0x1a930b[_0x6180('0x64')](_0x4c554b);}})[_0x6180('0x26')](function(_0x45dc6e){if(_0x45dc6e){_0x35c816=_0x45dc6e[_0x6180('0x3b')];if(!_0x19abbc[_0x6180('0x36')][_0x6180('0x3d')](_0x6180('0x3e'))){_0x4c554b[_0x6180('0x20')]=qs[_0x6180('0x20')](_0x19abbc[_0x6180('0x36')][_0x6180('0x20')]);_0x4c554b[_0x6180('0x1e')]=qs['offset'](_0x19abbc['query'][_0x6180('0x1e')]);}return _0x1a930b[_0x6180('0x64')](_0x4c554b);}})['then'](function(_0x3b4400){if(_0x3b4400){return _0x3b4400?{'count':_0x35c816,'rows':_0x3b4400}:null;}})[_0x6180('0x26')](respondWithResult(_0x7ac57c,null))['catch'](handleError(_0x7ac57c,null));};exports[_0x6180('0x67')]=function(_0x11ed69,_0x136caa,_0x3b45e2){var _0x5155f5=_0x11ed69[_0x6180('0x4c')]['ids'];return db[_0x6180('0x65')][_0x6180('0x59')]({'where':{'id':_0x5155f5},'attributes':['id'],'include':[{'model':db[_0x6180('0x5a')],'as':_0x6180('0x68'),'attributes':['id',_0x6180('0x2e'),_0x6180('0x69'),_0x6180('0x6a'),'interface'],'raw':!![]}]})[_0x6180('0x26')](function(_0x3b388e){if(_0x3b388e){var _0xcca336=_[_0x6180('0x6b')](_0x3b388e,function(_0x5c6071){var _0xf7c400=_0x5c6071[_0x6180('0x6c')]({'plain':!![]});return _0xf7c400[_0x6180('0x68')];});return db[_0x6180('0x31')][_0x6180('0x4a')]({'where':{'id':_0x11ed69[_0x6180('0x48')]['id']}})[_0x6180('0x26')](function(_0x24c4be){return db[_0x6180('0x6d')][_0x6180('0x6e')](function(_0x4be7c6){return _0x24c4be['addTeams'](_0x5155f5,{'transaction':_0x4be7c6})[_0x6180('0x26')](function(){return BPromise[_0x6180('0x6f')](_0xcca336,function(_0x37d93b){return db[_0x6180('0x56')][_0x6180('0x70')]({'where':{'UserId':_0x37d93b['id'],'SmsQueueId':_0x11ed69[_0x6180('0x48')]['id']},'transaction':_0x4be7c6});});})[_0x6180('0x26')](function(){_0xcca336[_0x6180('0x71')](function(_0x56b502){socket[_0x6180('0x72')](_0x6180('0x73'),{'UserId':_0x56b502['id'],'SmsQueueId':_0x24c4be['id']});});});});});}})[_0x6180('0x26')](respondWithStatusCode(_0x136caa,null))[_0x6180('0x46')](handleError(_0x136caa,null));};exports[_0x6180('0x74')]=function(_0x1804a2,_0xe85af,_0x5cdf06){return db['Team']['findAll']({'where':{'id':_0x1804a2[_0x6180('0x36')][_0x6180('0x75')]},'attributes':['id'],'include':[{'model':db[_0x6180('0x5a')],'as':_0x6180('0x68'),'attributes':['id'],'raw':!![]}]})[_0x6180('0x26')](handleEntityNotFound(_0xe85af,null))[_0x6180('0x26')](function(_0x3b9877){var _0x1bc00a=_['map'](_0x3b9877,'id');var _0x58b48b=[];var _0x238456=[];var _0x1d629a=squel[_0x6180('0x76')]();_0x1d629a['field']('tq.TeamId')[_0x6180('0x77')](_0x6180('0x78'),'tq')['join']('user_has_teams','ut',_0x6180('0x79'))['where']('SmsQueueId\x20=\x20?',_0x1804a2['params']['id']);for(var _0x19fc48=0x0;_0x19fc48<_0x3b9877[_0x6180('0x3b')];_0x19fc48+=0x1){let _0x3cf143=_0x3b9877[_0x19fc48];for(var _0x822add=0x0;_0x822add<_0x3cf143[_0x6180('0x68')]['length'];_0x822add+=0x1){let _0x12ccf0=_0x3cf143['Agents'][_0x822add];var _0xaa8367=_0x1d629a[_0x6180('0x7a')]();_0xaa8367[_0x6180('0x40')](_0x6180('0x7b'),_0x12ccf0['id']);_0x238456[_0x6180('0x7c')](db[_0x6180('0x6d')][_0x6180('0x36')](_0xaa8367[_0x6180('0x7d')](),{'type':db[_0x6180('0x6d')][_0x6180('0x7e')][_0x6180('0x7f')]})['then'](function(_0x8cce7f){if(_0x8cce7f[_0x6180('0x3b')]===0x1){return _0x12ccf0['id'];}else{var _0x5d1def=_[_0x6180('0x80')](_['map'](_0x8cce7f,_0x6180('0x81')),function(_0x3ba121){return _['includes'](_0x1bc00a,_0x3ba121);});if(_0x5d1def){return _0x12ccf0['id'];}}}));}}return BPromise[_0x6180('0x82')](_0x238456)[_0x6180('0x26')](function(_0x57ba4e){_0x58b48b=_(_0x58b48b)[_0x6180('0x83')](_0x57ba4e)[_0x6180('0x84')]()[_0x6180('0x85')]();return db[_0x6180('0x31')][_0x6180('0x4a')]({'where':{'id':_0x1804a2[_0x6180('0x48')]['id']}})[_0x6180('0x26')](function(_0x3f4c15){return db[_0x6180('0x6d')][_0x6180('0x6e')](function(_0x1a48d5){return _0x3f4c15['removeTeams'](_0x1804a2['query'][_0x6180('0x75')],{'transaction':_0x1a48d5})[_0x6180('0x26')](function(){if(!_[_0x6180('0x86')](_0x58b48b)){return _0x3f4c15[_0x6180('0x87')](_0x58b48b,{'transaction':_0x1a48d5});}})[_0x6180('0x26')](function(){_0x58b48b['forEach'](function(_0x546a7c){socket[_0x6180('0x72')](_0x6180('0x88'),{'UserId':_0x546a7c,'SmsQueueId':_0x3f4c15['id']});});});});});});})[_0x6180('0x26')](respondWithStatusCode(_0xe85af,null))[_0x6180('0x46')](handleError(_0xe85af,null));};exports[_0x6180('0x89')]=function(_0x28736e,_0x3a8eb9,_0x1d0df5){return db[_0x6180('0x31')][_0x6180('0x4a')]({'where':{'id':_0x28736e[_0x6180('0x48')]['id']}})[_0x6180('0x26')](handleEntityNotFound(_0x3a8eb9,null))[_0x6180('0x26')](function(_0xdfc371){if(_0xdfc371){return _0xdfc371[_0x6180('0x89')](_0x28736e[_0x6180('0x4c')][_0x6180('0x75')],_[_0x6180('0x8a')](_0x28736e['body'],[_0x6180('0x75'),'id'])||{})['spread'](function(_0x2ded78){for(var _0x33a9fb=0x0;_0x33a9fb<_0x28736e['body'][_0x6180('0x75')][_0x6180('0x3b')];_0x33a9fb+=0x1){socket[_0x6180('0x72')](_0x6180('0x73'),{'UserId':Number(_0x28736e['body']['ids'][_0x33a9fb]),'SmsQueueId':Number(_0x28736e[_0x6180('0x48')]['id'])});}return _0x2ded78;});}})['then'](respondWithResult(_0x3a8eb9,null))['catch'](handleError(_0x3a8eb9,null));};exports[_0x6180('0x87')]=function(_0x220331,_0x4dd6a1,_0x34fed2){return db[_0x6180('0x31')]['find']({'where':{'id':_0x220331['params']['id']}})['then'](handleEntityNotFound(_0x4dd6a1,null))[_0x6180('0x26')](function(_0x2ec27b){if(_0x2ec27b){return _0x2ec27b[_0x6180('0x87')](_0x220331[_0x6180('0x36')]['ids'])[_0x6180('0x26')](function(){if(_[_0x6180('0x8b')](_0x220331[_0x6180('0x36')][_0x6180('0x75')])){for(var _0x3290fe=0x0;_0x3290fe<_0x220331['query']['ids']['length'];_0x3290fe+=0x1){socket[_0x6180('0x72')](_0x6180('0x88'),{'UserId':Number(_0x220331[_0x6180('0x36')]['ids'][_0x3290fe]),'SmsQueueId':Number(_0x220331[_0x6180('0x48')]['id'])});}}else{socket[_0x6180('0x72')](_0x6180('0x88'),{'UserId':Number(_0x220331['query'][_0x6180('0x75')]),'SmsQueueId':Number(_0x220331['params']['id'])});}});}})[_0x6180('0x26')](respondWithStatusCode(_0x4dd6a1,null))[_0x6180('0x46')](handleError(_0x4dd6a1,null));};exports[_0x6180('0x8c')]=function(_0x5dfbb5,_0x1feb76,_0x4324fc){var _0x5e2016={};var _0x58bc84={};var _0x171a31;var _0x3ea10e;return db[_0x6180('0x31')]['findOne']({'where':{'id':_0x5dfbb5['params']['id']}})[_0x6180('0x26')](handleEntityNotFound(_0x1feb76,null))[_0x6180('0x26')](function(_0x8004f9){if(_0x8004f9){_0x171a31=_0x8004f9;_0x58bc84[_0x6180('0x35')]=_['keys'](db[_0x6180('0x5a')][_0x6180('0x32')]);_0x58bc84['query']=_['keys'](_0x5dfbb5[_0x6180('0x36')]);_0x58bc84['filters']=_[_0x6180('0x39')](_0x58bc84[_0x6180('0x35')],_0x58bc84['query']);_0x5e2016['attributes']=_['intersection'](_0x58bc84['model'],qs['fields'](_0x5dfbb5[_0x6180('0x36')][_0x6180('0x3a')]));_0x5e2016['attributes']=_0x5e2016[_0x6180('0x3c')]['length']?_0x5e2016[_0x6180('0x3c')]:_0x58bc84[_0x6180('0x35')];_0x5e2016[_0x6180('0x66')]=qs[_0x6180('0x3f')](_0x5dfbb5[_0x6180('0x36')]['sort']);_0x5e2016[_0x6180('0x40')]=qs[_0x6180('0x38')](_['pick'](_0x5dfbb5[_0x6180('0x36')],_0x58bc84['filters']));if(_0x5dfbb5['query'][_0x6180('0x58')]){_0x5e2016['where']=_[_0x6180('0x42')](_0x5e2016[_0x6180('0x40')],{'$or':_['map'](_0x5e2016[_0x6180('0x3c')],function(_0xcb50d3){var _0x30bac4={};_0x30bac4[_0xcb50d3]={'$like':'%'+_0x5dfbb5[_0x6180('0x36')][_0x6180('0x58')]+'%'};return _0x30bac4;})});}_0x5e2016=_[_0x6180('0x42')]({},_0x5e2016,_0x5dfbb5['options']);return _0x171a31[_0x6180('0x8c')](_0x5e2016);}})[_0x6180('0x26')](function(_0x36a983){if(_0x36a983){_0x3ea10e=_0x36a983[_0x6180('0x3b')];if(!_0x5dfbb5[_0x6180('0x36')][_0x6180('0x3d')](_0x6180('0x3e'))){_0x5e2016[_0x6180('0x20')]=qs['limit'](_0x5dfbb5['query'][_0x6180('0x20')]);_0x5e2016['offset']=qs[_0x6180('0x1e')](_0x5dfbb5[_0x6180('0x36')]['offset']);}return _0x171a31[_0x6180('0x8c')](_0x5e2016);}})[_0x6180('0x26')](function(_0x2e4961){if(_0x2e4961){return _0x2e4961?{'count':_0x3ea10e,'rows':_0x2e4961}:null;}})[_0x6180('0x26')](respondWithResult(_0x1feb76,null))[_0x6180('0x46')](handleError(_0x1feb76,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index b024876..a4175af 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 _0x078c=['events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x5ccdf0,_0x3cafba){var _0x4915af=function(_0x1087ac){while(--_0x1087ac){_0x5ccdf0['push'](_0x5ccdf0['shift']());}};_0x4915af(++_0x3cafba);}(_0x078c,0x118));var _0xc078=function(_0x53a7af,_0x1408a5){_0x53a7af=_0x53a7af-0x0;var _0x3cc7f6=_0x078c[_0x53a7af];return _0x3cc7f6;};'use strict';var EventEmitter=require(_0xc078('0x0'));var SmsQueue=require(_0xc078('0x1'))['db'][_0xc078('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xc078('0x3')](0x0);var events={'afterCreate':_0xc078('0x4'),'afterUpdate':_0xc078('0x5'),'afterDestroy':_0xc078('0x6')};function emitEvent(_0x7d9c3e){return function(_0x5b747c,_0x22ec7b,_0x469481){SmsQueueEvents[_0xc078('0x7')](_0x7d9c3e+':'+_0x5b747c['id'],_0x5b747c);SmsQueueEvents[_0xc078('0x7')](_0x7d9c3e,_0x5b747c);_0x469481(null);};}for(var e in events){if(events[_0xc078('0x8')](e)){var event=events[e];SmsQueue[_0xc078('0x9')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x02f7=['hasOwnProperty','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit'];(function(_0x474ca9,_0x11a63b){var _0x221fd6=function(_0x20872a){while(--_0x20872a){_0x474ca9['push'](_0x474ca9['shift']());}};_0x221fd6(++_0x11a63b);}(_0x02f7,0x11a));var _0x702f=function(_0x2ae2dd,_0x2bacf3){_0x2ae2dd=_0x2ae2dd-0x0;var _0x5d9904=_0x02f7[_0x2ae2dd];return _0x5d9904;};'use strict';var EventEmitter=require(_0x702f('0x0'));var SmsQueue=require(_0x702f('0x1'))['db'][_0x702f('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x702f('0x3')](0x0);var events={'afterCreate':_0x702f('0x4'),'afterUpdate':_0x702f('0x5'),'afterDestroy':_0x702f('0x6')};function emitEvent(_0x469cff){return function(_0x275819,_0x349e00,_0x200287){SmsQueueEvents[_0x702f('0x7')](_0x469cff+':'+_0x275819['id'],_0x275819);SmsQueueEvents[_0x702f('0x7')](_0x469cff,_0x275819);_0x200287(null);};}for(var e in events){if(events[_0x702f('0x8')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x702f('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index a6040e4..a0021fd 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 _0x3a27=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','sms_queues'];(function(_0x25febc,_0xa928d){var _0x21b031=function(_0x561a3f){while(--_0x561a3f){_0x25febc['push'](_0x25febc['shift']());}};_0x21b031(++_0xa928d);}(_0x3a27,0xbb));var _0x73a2=function(_0x18adf1,_0x10b471){_0x18adf1=_0x18adf1-0x0;var _0x2b7d58=_0x3a27[_0x18adf1];return _0x2b7d58;};'use strict';var _=require(_0x73a2('0x0'));var util=require('util');var logger=require(_0x73a2('0x1'))(_0x73a2('0x2'));var moment=require(_0x73a2('0x3'));var BPromise=require(_0x73a2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x73a2('0x5'));var rimraf=require(_0x73a2('0x6'));var config=require(_0x73a2('0x7'));var attributes=require('./smsQueue.attributes');module[_0x73a2('0x8')]=function(_0x1e30cb,_0x595260){return _0x1e30cb[_0x73a2('0x9')]('SmsQueue',attributes,{'tableName':_0x73a2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ea4=['SmsQueue','sms_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueue.attributes','exports','define'];(function(_0x5d7ec5,_0x3b66f4){var _0x536b56=function(_0x5a9cd0){while(--_0x5a9cd0){_0x5d7ec5['push'](_0x5d7ec5['shift']());}};_0x536b56(++_0x3b66f4);}(_0x6ea4,0xb6));var _0x46ea=function(_0x11d231,_0x23fee0){_0x11d231=_0x11d231-0x0;var _0x5b98d5=_0x6ea4[_0x11d231];return _0x5b98d5;};'use strict';var _=require(_0x46ea('0x0'));var util=require(_0x46ea('0x1'));var logger=require(_0x46ea('0x2'))('api');var moment=require('moment');var BPromise=require(_0x46ea('0x3'));var rp=require(_0x46ea('0x4'));var fs=require('fs');var path=require(_0x46ea('0x5'));var rimraf=require(_0x46ea('0x6'));var config=require('../../config/environment');var attributes=require(_0x46ea('0x7'));module[_0x46ea('0x8')]=function(_0x5dc2a8,_0x11bce4){return _0x5dc2a8[_0x46ea('0x9')](_0x46ea('0xa'),attributes,{'tableName':_0x46ea('0xb'),'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 fc0ad4e..9e0e22e 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 _0x73aa=['request','then','SmsQueue,\x20%s,\x20%s','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','info','result','catch','SmsQueue','findAll','raw','options','where','attributes','limit','map','include','model','GetSmsQueue','debug','find','ShowSmsQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','socket.io-emitter','./smsQueue.socket'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x73aa,0x103));var _0xa73a=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x73aa[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0xa73a('0x0'));var util=require(_0xa73a('0x1'));var moment=require(_0xa73a('0x2'));var BPromise=require(_0xa73a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa73a('0x4'));var db=require(_0xa73a('0x5'))['db'];var utils=require(_0xa73a('0x6'));var logger=require(_0xa73a('0x7'))(_0xa73a('0x8'));var config=require(_0xa73a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa73a('0xa')][_0xa73a('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa73a('0xc'))(new Redis(config['redis']));require(_0xa73a('0xd'))['register'](socket);function respondWithRpcPromise(_0x5235e5,_0x3e969f,_0x555025){return new BPromise(function(_0x264ed9,_0x3058af){return client[_0xa73a('0xe')](_0x5235e5,_0x555025)[_0xa73a('0xf')](function(_0x57402a){logger['info'](_0xa73a('0x10'),_0x3e969f,'request\x20sent');logger['debug'](_0xa73a('0x11'),_0x3e969f,_0xa73a('0x12'),JSON['stringify'](_0x57402a));if(_0x57402a['error']){if(_0x57402a['error'][_0xa73a('0x13')]===0x1f4){logger[_0xa73a('0x14')](_0xa73a('0x10'),_0x3e969f,_0x57402a[_0xa73a('0x14')][_0xa73a('0x15')]);return _0x3058af(_0x57402a['error'][_0xa73a('0x15')]);}logger['error'](_0xa73a('0x10'),_0x3e969f,_0x57402a['error'][_0xa73a('0x15')]);return _0x264ed9(_0x57402a[_0xa73a('0x14')][_0xa73a('0x15')]);}else{logger[_0xa73a('0x16')]('SmsQueue,\x20%s,\x20%s',_0x3e969f,_0xa73a('0x12'));_0x264ed9(_0x57402a[_0xa73a('0x17')][_0xa73a('0x15')]);}})[_0xa73a('0x18')](function(_0x2601da){logger['error']('SmsQueue,\x20%s,\x20%s',_0x3e969f,_0x2601da);_0x3058af(_0x2601da);});});}exports['GetSmsQueue']=function(_0x147c0d){var _0x2cd9b2=this;return new Promise(function(_0x3d1dc7,_0x973fa9){return db[_0xa73a('0x19')][_0xa73a('0x1a')]({'raw':_0x147c0d['options']?_0x147c0d['options'][_0xa73a('0x1b')]===undefined?!![]:![]:!![],'where':_0x147c0d[_0xa73a('0x1c')]?_0x147c0d['options'][_0xa73a('0x1d')]||null:null,'attributes':_0x147c0d[_0xa73a('0x1c')]?_0x147c0d[_0xa73a('0x1c')][_0xa73a('0x1e')]||null:null,'limit':_0x147c0d[_0xa73a('0x1c')]?_0x147c0d[_0xa73a('0x1c')][_0xa73a('0x1f')]||null:null,'include':_0x147c0d[_0xa73a('0x1c')]?_0x147c0d[_0xa73a('0x1c')]['include']?_[_0xa73a('0x20')](_0x147c0d[_0xa73a('0x1c')][_0xa73a('0x21')],function(_0x5edb48){return{'model':db[_0x5edb48[_0xa73a('0x22')]],'as':_0x5edb48['as'],'attributes':_0x5edb48[_0xa73a('0x1e')],'include':_0x5edb48[_0xa73a('0x21')]?_[_0xa73a('0x20')](_0x5edb48[_0xa73a('0x21')],function(_0x5a9aa1){return{'model':db[_0x5a9aa1[_0xa73a('0x22')]],'as':_0x5a9aa1['as'],'attributes':_0x5a9aa1[_0xa73a('0x1e')],'include':_0x5a9aa1[_0xa73a('0x21')]?_['map'](_0x5a9aa1[_0xa73a('0x21')],function(_0x208d04){return{'model':db[_0x208d04[_0xa73a('0x22')]],'as':_0x208d04['as'],'attributes':_0x208d04[_0xa73a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa73a('0xf')](function(_0x5682c1){logger[_0xa73a('0x16')](_0xa73a('0x23'),_0x147c0d);logger[_0xa73a('0x24')](_0xa73a('0x23'),_0x147c0d,JSON['stringify'](_0x5682c1));_0x3d1dc7(_0x5682c1);})[_0xa73a('0x18')](function(_0x1c0401){logger[_0xa73a('0x14')](_0xa73a('0x23'),_0x1c0401[_0xa73a('0x15')],_0x147c0d);_0x973fa9(_0x2cd9b2[_0xa73a('0x14')](0x1f4,_0x1c0401[_0xa73a('0x15')]));});});};exports['ShowSmsQueue']=function(_0x1bbfb9){var _0x134c1e=this;return new Promise(function(_0x1530e8,_0x4e24f4){return db[_0xa73a('0x19')][_0xa73a('0x25')]({'raw':_0x1bbfb9['options']?_0x1bbfb9[_0xa73a('0x1c')][_0xa73a('0x1b')]===undefined?!![]:![]:!![],'where':_0x1bbfb9[_0xa73a('0x1c')]?_0x1bbfb9['options'][_0xa73a('0x1d')]||null:null,'attributes':_0x1bbfb9[_0xa73a('0x1c')]?_0x1bbfb9[_0xa73a('0x1c')][_0xa73a('0x1e')]||null:null,'include':_0x1bbfb9[_0xa73a('0x1c')]?_0x1bbfb9['options'][_0xa73a('0x21')]?_['map'](_0x1bbfb9[_0xa73a('0x1c')][_0xa73a('0x21')],function(_0x522ee1){return{'model':db[_0x522ee1['model']],'as':_0x522ee1['as'],'attributes':_0x522ee1[_0xa73a('0x1e')],'include':_0x522ee1[_0xa73a('0x21')]?_['map'](_0x522ee1[_0xa73a('0x21')],function(_0x5e6b7d){return{'model':db[_0x5e6b7d['model']],'as':_0x5e6b7d['as'],'attributes':_0x5e6b7d[_0xa73a('0x1e')],'include':_0x5e6b7d['include']?_['map'](_0x5e6b7d[_0xa73a('0x21')],function(_0x1e372f){return{'model':db[_0x1e372f[_0xa73a('0x22')]],'as':_0x1e372f['as'],'attributes':_0x1e372f[_0xa73a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa73a('0xf')](function(_0x16b539){logger[_0xa73a('0x16')](_0xa73a('0x26'),_0x1bbfb9);logger[_0xa73a('0x24')](_0xa73a('0x26'),_0x1bbfb9,JSON['stringify'](_0x16b539));_0x1530e8(_0x16b539);})[_0xa73a('0x18')](function(_0x5b4630){logger[_0xa73a('0x14')](_0xa73a('0x26'),_0x5b4630[_0xa73a('0x15')],_0x1bbfb9);_0x4e24f4(_0x134c1e[_0xa73a('0x14')](0x1f4,_0x5b4630['message']));});});}; \ No newline at end of file +var _0xab81=['info','SmsQueue,\x20%s,\x20%s','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','options','raw','where','attributes','limit','map','include','model','then','ShowSmsQueue','debug','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xab81,0x8f));var _0x1ab8=function(_0x1d3b4a,_0x5f56e6){_0x1d3b4a=_0x1d3b4a-0x0;var _0x102fcd=_0xab81[_0x1d3b4a];return _0x102fcd;};'use strict';var _=require(_0x1ab8('0x0'));var util=require(_0x1ab8('0x1'));var moment=require(_0x1ab8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ab8('0x3'));var db=require(_0x1ab8('0x4'))['db'];var utils=require(_0x1ab8('0x5'));var logger=require(_0x1ab8('0x6'))(_0x1ab8('0x7'));var config=require('../../config/environment');var jayson=require(_0x1ab8('0x8'));var client=jayson['client'][_0x1ab8('0x9')]({'port':0x232a});config[_0x1ab8('0xa')]=_[_0x1ab8('0xb')](config[_0x1ab8('0xa')],{'host':_0x1ab8('0xc'),'port':0x18eb});var socket=require(_0x1ab8('0xd'))(new Redis(config[_0x1ab8('0xa')]));require(_0x1ab8('0xe'))[_0x1ab8('0xf')](socket);function respondWithRpcPromise(_0x366239,_0x2e69e4,_0x5f13e7){return new BPromise(function(_0x51a715,_0xa87813){return client[_0x1ab8('0x10')](_0x366239,_0x5f13e7)['then'](function(_0x578d85){logger[_0x1ab8('0x11')](_0x1ab8('0x12'),_0x2e69e4,'request\x20sent');logger['debug'](_0x1ab8('0x13'),_0x2e69e4,_0x1ab8('0x14'),JSON[_0x1ab8('0x15')](_0x578d85));if(_0x578d85[_0x1ab8('0x16')]){if(_0x578d85[_0x1ab8('0x16')][_0x1ab8('0x17')]===0x1f4){logger[_0x1ab8('0x16')](_0x1ab8('0x12'),_0x2e69e4,_0x578d85[_0x1ab8('0x16')][_0x1ab8('0x18')]);return _0xa87813(_0x578d85['error'][_0x1ab8('0x18')]);}logger['error'](_0x1ab8('0x12'),_0x2e69e4,_0x578d85['error'][_0x1ab8('0x18')]);return _0x51a715(_0x578d85[_0x1ab8('0x16')]['message']);}else{logger[_0x1ab8('0x11')](_0x1ab8('0x12'),_0x2e69e4,_0x1ab8('0x14'));_0x51a715(_0x578d85[_0x1ab8('0x19')][_0x1ab8('0x18')]);}})[_0x1ab8('0x1a')](function(_0x4c8af4){logger[_0x1ab8('0x16')](_0x1ab8('0x12'),_0x2e69e4,_0x4c8af4);_0xa87813(_0x4c8af4);});});}exports[_0x1ab8('0x1b')]=function(_0x3aa5f0){var _0x46d15a=this;return new Promise(function(_0x1e4ec9,_0x371fe7){return db[_0x1ab8('0x1c')]['findAll']({'raw':_0x3aa5f0[_0x1ab8('0x1d')]?_0x3aa5f0['options'][_0x1ab8('0x1e')]===undefined?!![]:![]:!![],'where':_0x3aa5f0[_0x1ab8('0x1d')]?_0x3aa5f0[_0x1ab8('0x1d')][_0x1ab8('0x1f')]||null:null,'attributes':_0x3aa5f0[_0x1ab8('0x1d')]?_0x3aa5f0[_0x1ab8('0x1d')][_0x1ab8('0x20')]||null:null,'limit':_0x3aa5f0[_0x1ab8('0x1d')]?_0x3aa5f0[_0x1ab8('0x1d')][_0x1ab8('0x21')]||null:null,'include':_0x3aa5f0[_0x1ab8('0x1d')]?_0x3aa5f0['options']['include']?_[_0x1ab8('0x22')](_0x3aa5f0[_0x1ab8('0x1d')][_0x1ab8('0x23')],function(_0x5749e3){return{'model':db[_0x5749e3[_0x1ab8('0x24')]],'as':_0x5749e3['as'],'attributes':_0x5749e3[_0x1ab8('0x20')],'include':_0x5749e3[_0x1ab8('0x23')]?_[_0x1ab8('0x22')](_0x5749e3[_0x1ab8('0x23')],function(_0x35c911){return{'model':db[_0x35c911['model']],'as':_0x35c911['as'],'attributes':_0x35c911['attributes'],'include':_0x35c911[_0x1ab8('0x23')]?_[_0x1ab8('0x22')](_0x35c911['include'],function(_0x33e209){return{'model':db[_0x33e209[_0x1ab8('0x24')]],'as':_0x33e209['as'],'attributes':_0x33e209[_0x1ab8('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1ab8('0x25')](function(_0x215fb8){logger[_0x1ab8('0x11')](_0x1ab8('0x1b'),_0x3aa5f0);logger['debug'](_0x1ab8('0x1b'),_0x3aa5f0,JSON['stringify'](_0x215fb8));_0x1e4ec9(_0x215fb8);})[_0x1ab8('0x1a')](function(_0x23584e){logger[_0x1ab8('0x16')]('GetSmsQueue',_0x23584e[_0x1ab8('0x18')],_0x3aa5f0);_0x371fe7(_0x46d15a[_0x1ab8('0x16')](0x1f4,_0x23584e[_0x1ab8('0x18')]));});});};exports[_0x1ab8('0x26')]=function(_0x2cae2c){var _0x50192c=this;return new Promise(function(_0x2be2e3,_0x5b2749){return db[_0x1ab8('0x1c')]['find']({'raw':_0x2cae2c[_0x1ab8('0x1d')]?_0x2cae2c[_0x1ab8('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2cae2c[_0x1ab8('0x1d')]?_0x2cae2c[_0x1ab8('0x1d')][_0x1ab8('0x1f')]||null:null,'attributes':_0x2cae2c[_0x1ab8('0x1d')]?_0x2cae2c[_0x1ab8('0x1d')][_0x1ab8('0x20')]||null:null,'include':_0x2cae2c[_0x1ab8('0x1d')]?_0x2cae2c[_0x1ab8('0x1d')][_0x1ab8('0x23')]?_[_0x1ab8('0x22')](_0x2cae2c[_0x1ab8('0x1d')]['include'],function(_0x42d7cd){return{'model':db[_0x42d7cd[_0x1ab8('0x24')]],'as':_0x42d7cd['as'],'attributes':_0x42d7cd['attributes'],'include':_0x42d7cd[_0x1ab8('0x23')]?_[_0x1ab8('0x22')](_0x42d7cd[_0x1ab8('0x23')],function(_0x3f4175){return{'model':db[_0x3f4175['model']],'as':_0x3f4175['as'],'attributes':_0x3f4175[_0x1ab8('0x20')],'include':_0x3f4175[_0x1ab8('0x23')]?_[_0x1ab8('0x22')](_0x3f4175['include'],function(_0x37fcd8){return{'model':db[_0x37fcd8[_0x1ab8('0x24')]],'as':_0x37fcd8['as'],'attributes':_0x37fcd8[_0x1ab8('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22d4d8){logger[_0x1ab8('0x11')](_0x1ab8('0x26'),_0x2cae2c);logger[_0x1ab8('0x27')](_0x1ab8('0x26'),_0x2cae2c,JSON['stringify'](_0x22d4d8));_0x2be2e3(_0x22d4d8);})['catch'](function(_0x48184f){logger['error'](_0x1ab8('0x26'),_0x48184f[_0x1ab8('0x18')],_0x2cae2c);_0x5b2749(_0x50192c[_0x1ab8('0x16')](0x1f4,_0x48184f[_0x1ab8('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 18cb318..d1f4998 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 _0xada0=['register','length','smsQueue:','./smsQueue.events','save','emit','removeListener'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xada0,0x153));var _0x0ada=function(_0x487b3c,_0x208604){_0x487b3c=_0x487b3c-0x0;var _0x36f608=_0xada0[_0x487b3c];return _0x36f608;};'use strict';var SmsQueueEvents=require(_0x0ada('0x0'));var events=[_0x0ada('0x1'),'remove','update'];function createListener(_0x5dfae1,_0x28a266){return function(_0x23de20){_0x28a266[_0x0ada('0x2')](_0x5dfae1,_0x23de20);};}function removeListener(_0x2609d6,_0x522d46){return function(){SmsQueueEvents[_0x0ada('0x3')](_0x2609d6,_0x522d46);};}exports[_0x0ada('0x4')]=function(_0x104274){for(var _0x4bdcc0=0x0,_0x23e56e=events[_0x0ada('0x5')];_0x4bdcc0<_0x23e56e;_0x4bdcc0++){var _0x17291d=events[_0x4bdcc0];var _0x2cdbe1=createListener(_0x0ada('0x6')+_0x17291d,_0x104274);SmsQueueEvents['on'](_0x17291d,_0x2cdbe1);}}; \ No newline at end of file +var _0x4ec4=['save','update','emit','removeListener','register','length','smsQueue:','./smsQueue.events'];(function(_0x459423,_0x3416a8){var _0x42ed14=function(_0x1d4f69){while(--_0x1d4f69){_0x459423['push'](_0x459423['shift']());}};_0x42ed14(++_0x3416a8);}(_0x4ec4,0x1bf));var _0x44ec=function(_0x373f9e,_0x3ef27e){_0x373f9e=_0x373f9e-0x0;var _0xa0821c=_0x4ec4[_0x373f9e];return _0xa0821c;};'use strict';var SmsQueueEvents=require(_0x44ec('0x0'));var events=[_0x44ec('0x1'),'remove',_0x44ec('0x2')];function createListener(_0x2080a5,_0x2add8f){return function(_0x38b246){_0x2add8f[_0x44ec('0x3')](_0x2080a5,_0x38b246);};}function removeListener(_0x555292,_0x1d5762){return function(){SmsQueueEvents[_0x44ec('0x4')](_0x555292,_0x1d5762);};}exports[_0x44ec('0x5')]=function(_0x38e62a){for(var _0x4e6b96=0x0,_0x937e5=events[_0x44ec('0x6')];_0x4e6b96<_0x937e5;_0x4e6b96++){var _0x3340f6=events[_0x4e6b96];var _0x56f3e6=createListener(_0x44ec('0x7')+_0x3340f6,_0x38e62a);SmsQueueEvents['on'](_0x3340f6,_0x56f3e6);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 8435841..b1cdd1f 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 _0x66cd=['post','put','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0xdc7a75,_0x4b84d4){var _0x47774d=function(_0x1dd572){while(--_0x1dd572){_0xdc7a75['push'](_0xdc7a75['shift']());}};_0x47774d(++_0x4b84d4);}(_0x66cd,0xa4));var _0xd66c=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x66cd[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0xd66c('0x0'));var util=require(_0xd66c('0x1'));var path=require(_0xd66c('0x2'));var timeout=require(_0xd66c('0x3'));var express=require('express');var router=express[_0xd66c('0x4')]();var fs_extra=require(_0xd66c('0x5'));var auth=require(_0xd66c('0x6'));var interaction=require(_0xd66c('0x7'));var config=require(_0xd66c('0x8'));var controller=require('./smsQueueReport.controller');router[_0xd66c('0x9')]('/',auth[_0xd66c('0xa')](),controller[_0xd66c('0xb')]);router['get'](_0xd66c('0xc'),auth['isAuthenticated'](),controller[_0xd66c('0xd')]);router['get'](_0xd66c('0xe'),auth[_0xd66c('0xa')](),controller[_0xd66c('0xf')]);router[_0xd66c('0x10')]('/',auth[_0xd66c('0xa')](),controller['create']);router[_0xd66c('0x11')](_0xd66c('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xd66c('0x12')](_0xd66c('0xe'),auth[_0xd66c('0xa')](),controller['destroy']);module[_0xd66c('0x13')]=router; \ No newline at end of file +var _0x692c=['/:id','show','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x552204,_0x222864){var _0x24988d=function(_0x5d893b){while(--_0x5d893b){_0x552204['push'](_0x552204['shift']());}};_0x24988d(++_0x222864);}(_0x692c,0x6a));var _0xc692=function(_0x2e96f1,_0x1c7f62){_0x2e96f1=_0x2e96f1-0x0;var _0x3d7a0b=_0x692c[_0x2e96f1];return _0x3d7a0b;};'use strict';var multer=require(_0xc692('0x0'));var util=require(_0xc692('0x1'));var path=require(_0xc692('0x2'));var timeout=require(_0xc692('0x3'));var express=require(_0xc692('0x4'));var router=express[_0xc692('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc692('0x6'));var interaction=require(_0xc692('0x7'));var config=require(_0xc692('0x8'));var controller=require(_0xc692('0x9'));router[_0xc692('0xa')]('/',auth[_0xc692('0xb')](),controller['index']);router['get'](_0xc692('0xc'),auth[_0xc692('0xb')](),controller[_0xc692('0xd')]);router[_0xc692('0xa')](_0xc692('0xe'),auth[_0xc692('0xb')](),controller[_0xc692('0xf')]);router['post']('/',auth[_0xc692('0xb')](),controller[_0xc692('0x10')]);router[_0xc692('0x11')](_0xc692('0xe'),auth[_0xc692('0xb')](),controller['update']);router[_0xc692('0x12')](_0xc692('0xe'),auth[_0xc692('0xb')](),controller['destroy']);module[_0xc692('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 71ceb50..8568e22 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 _0xd148=['DATE','sequelize','exports','STRING'];(function(_0x486a8b,_0x1d918f){var _0x2e1dd9=function(_0x4a6b21){while(--_0x4a6b21){_0x486a8b['push'](_0x486a8b['shift']());}};_0x2e1dd9(++_0x1d918f);}(_0xd148,0x8d));var _0x8d14=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd148[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require(_0x8d14('0x0'));module[_0x8d14('0x1')]={'uniqueid':{'type':Sequelize[_0x8d14('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x8d14('0x3')]},'leaveAt':{'type':Sequelize[_0x8d14('0x3')]},'acceptAt':{'type':Sequelize[_0x8d14('0x3')]},'exitAt':{'type':Sequelize[_0x8d14('0x3')]},'reason':{'type':Sequelize[_0x8d14('0x2')]}}; \ No newline at end of file +var _0x7fac=['exports','STRING','DATE','moment'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x7fac,0x137));var _0xc7fa=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x7fac[_0x2fc012];return _0x2891f9;};'use strict';var moment=require(_0xc7fa('0x0'));var Sequelize=require('sequelize');module[_0xc7fa('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xc7fa('0x2')]},'joinAt':{'type':Sequelize[_0xc7fa('0x3')]},'leaveAt':{'type':Sequelize[_0xc7fa('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xc7fa('0x3')]},'reason':{'type':Sequelize[_0xc7fa('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 75391b4..fbb337a 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 _0x0bea=['describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','reject','save','update','destroy','error','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','merge','options','SmsQueueReport','then','includeAll','include','findAll','rows','catch','show','params','find','create','body'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x0bea,0x139));var _0xa0be=function(_0xf35bd4,_0x51ff64){_0xf35bd4=_0xf35bd4-0x0;var _0x47912b=_0x0bea[_0xf35bd4];return _0x47912b;};'use strict';var emlformat=require(_0xa0be('0x0'));var rimraf=require(_0xa0be('0x1'));var zipdir=require(_0xa0be('0x2'));var jsonpatch=require(_0xa0be('0x3'));var rp=require('request-promise');var moment=require(_0xa0be('0x4'));var BPromise=require(_0xa0be('0x5'));var Mustache=require(_0xa0be('0x6'));var util=require(_0xa0be('0x7'));var path=require(_0xa0be('0x8'));var sox=require(_0xa0be('0x9'));var csv=require(_0xa0be('0xa'));var ejs=require(_0xa0be('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa0be('0xc'));var squel=require(_0xa0be('0xd'));var crypto=require(_0xa0be('0xe'));var jsforce=require(_0xa0be('0xf'));var deskjs=require(_0xa0be('0x10'));var toCsv=require(_0xa0be('0xa'));var querystring=require(_0xa0be('0x11'));var Papa=require(_0xa0be('0x12'));var Redis=require(_0xa0be('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xa0be('0x14'));var as=require(_0xa0be('0x15'));var hardwareService=require(_0xa0be('0x16'));var logger=require(_0xa0be('0x17'))(_0xa0be('0x18'));var utils=require(_0xa0be('0x19'));var config=require(_0xa0be('0x1a'));var licenseUtil=require(_0xa0be('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35c530,_0x34009e){_0x34009e=_0x34009e||0xcc;return function(_0x16aea0){if(_0x16aea0){return _0x35c530[_0xa0be('0x1c')](_0x34009e);}return _0x35c530[_0xa0be('0x1d')](_0x34009e)[_0xa0be('0x1e')]();};}function respondWithResult(_0xefbb12,_0x10a9cb){_0x10a9cb=_0x10a9cb||0xc8;return function(_0x3d3927){if(_0x3d3927){return _0xefbb12[_0xa0be('0x1d')](_0x10a9cb)[_0xa0be('0x1f')](_0x3d3927);}};}function respondWithFilteredResult(_0x411c85,_0x579dd5){return function(_0xfd0a61){if(_0xfd0a61){var _0x933eb5=typeof _0x579dd5['offset']===_0xa0be('0x20')&&typeof _0x579dd5[_0xa0be('0x21')]==='undefined';var _0x72ac3a=_0xfd0a61['count'];var _0x229abd=_0x933eb5?0x0:_0x579dd5[_0xa0be('0x22')];var _0x45dcce=_0x933eb5?_0xfd0a61[_0xa0be('0x23')]:_0x579dd5[_0xa0be('0x22')]+_0x579dd5[_0xa0be('0x21')];var _0x2ae3e1;if(_0x45dcce>=_0x72ac3a){_0x45dcce=_0x72ac3a;_0x2ae3e1=0xc8;}else{_0x2ae3e1=0xce;}_0x411c85['status'](_0x2ae3e1);return _0x411c85['set'](_0xa0be('0x24'),_0x229abd+'-'+_0x45dcce+'/'+_0x72ac3a)[_0xa0be('0x1f')](_0xfd0a61);}return null;};}function patchUpdates(_0x56b1ad){return function(_0x5f2e88){try{jsonpatch['apply'](_0x5f2e88,_0x56b1ad,!![]);}catch(_0x2cfb98){return BPromise[_0xa0be('0x25')](_0x2cfb98);}return _0x5f2e88[_0xa0be('0x26')]();};}function saveUpdates(_0x176647,_0x253b20){return function(_0x4a393f){if(_0x4a393f){return _0x4a393f[_0xa0be('0x27')](_0x176647)['then'](function(_0x49bf96){return _0x49bf96;});}return null;};}function removeEntity(_0x36aeec,_0x3e466c){return function(_0x2ddaba){if(_0x2ddaba){return _0x2ddaba[_0xa0be('0x28')]()['then'](function(){_0x36aeec[_0xa0be('0x1d')](0xcc)[_0xa0be('0x1e')]();});}};}function handleEntityNotFound(_0x50fbbd,_0x492a9d){return function(_0x4b60d1){if(!_0x4b60d1){_0x50fbbd[_0xa0be('0x1c')](0x194);}return _0x4b60d1;};}function handleError(_0x54db28,_0x32deca){_0x32deca=_0x32deca||0x1f4;return function(_0x5c8c42){logger[_0xa0be('0x29')](_0x5c8c42['stack']);if(_0x5c8c42[_0xa0be('0x2a')]){delete _0x5c8c42['name'];}_0x54db28[_0xa0be('0x1d')](_0x32deca)['send'](_0x5c8c42);};}exports[_0xa0be('0x2b')]=function(_0x67023d,_0x605a24){var _0x1c3382={},_0x33732c={},_0x5e09df={'count':0x0,'rows':[]};var _0x12db02=_['map'](db['SmsQueueReport'][_0xa0be('0x2c')],function(_0x4c63c6){return{'name':_0x4c63c6[_0xa0be('0x2d')],'type':_0x4c63c6[_0xa0be('0x2e')][_0xa0be('0x2f')]};});_0x33732c[_0xa0be('0x30')]=_[_0xa0be('0x31')](_0x12db02,_0xa0be('0x2a'));_0x33732c[_0xa0be('0x32')]=_[_0xa0be('0x33')](_0x67023d['query']);_0x33732c[_0xa0be('0x34')]=_[_0xa0be('0x35')](_0x33732c['model'],_0x33732c['query']);_0x1c3382[_0xa0be('0x36')]=_['intersection'](_0x33732c[_0xa0be('0x30')],qs[_0xa0be('0x37')](_0x67023d['query'][_0xa0be('0x37')]));_0x1c3382[_0xa0be('0x36')]=_0x1c3382['attributes'][_0xa0be('0x38')]?_0x1c3382[_0xa0be('0x36')]:_0x33732c[_0xa0be('0x30')];if(!_0x67023d[_0xa0be('0x32')][_0xa0be('0x39')](_0xa0be('0x3a'))){_0x1c3382[_0xa0be('0x21')]=qs[_0xa0be('0x21')](_0x67023d['query'][_0xa0be('0x21')]);_0x1c3382['offset']=qs[_0xa0be('0x22')](_0x67023d['query']['offset']);}_0x1c3382['order']=qs[_0xa0be('0x3b')](_0x67023d['query'][_0xa0be('0x3b')]);_0x1c3382[_0xa0be('0x3c')]=qs['filters'](_['pick'](_0x67023d['query'],_0x33732c[_0xa0be('0x34')]),_0x12db02);if(_0x67023d[_0xa0be('0x32')]['filter']){_0x1c3382[_0xa0be('0x3c')]=_['merge'](_0x1c3382[_0xa0be('0x3c')],{'$or':_['map'](_0x12db02,function(_0x111cd6){if(_0x111cd6[_0xa0be('0x2e')]!==_0xa0be('0x3d')){var _0x27b411={};_0x27b411[_0x111cd6['name']]={'$like':'%'+_0x67023d[_0xa0be('0x32')][_0xa0be('0x3e')]+'%'};return _0x27b411;}})});}_0x1c3382=_[_0xa0be('0x3f')]({},_0x1c3382,_0x67023d[_0xa0be('0x40')]);var _0x53b1de={'where':_0x1c3382[_0xa0be('0x3c')]};return db[_0xa0be('0x41')][_0xa0be('0x23')](_0x53b1de)[_0xa0be('0x42')](function(_0x5c0c96){_0x5e09df[_0xa0be('0x23')]=_0x5c0c96;if(_0x67023d['query'][_0xa0be('0x43')]){_0x1c3382[_0xa0be('0x44')]=[{'all':!![]}];}return db[_0xa0be('0x41')][_0xa0be('0x45')](_0x1c3382);})[_0xa0be('0x42')](function(_0x31d026){_0x5e09df[_0xa0be('0x46')]=_0x31d026;return _0x5e09df;})[_0xa0be('0x42')](respondWithFilteredResult(_0x605a24,_0x1c3382))[_0xa0be('0x47')](handleError(_0x605a24,null));};exports[_0xa0be('0x48')]=function(_0x30caf0,_0x2333e3){var _0x4e2e3e={'raw':!![],'where':{'id':_0x30caf0[_0xa0be('0x49')]['id']}},_0x2ec9fa={};_0x2ec9fa[_0xa0be('0x30')]=_[_0xa0be('0x33')](db[_0xa0be('0x41')][_0xa0be('0x2c')]);_0x2ec9fa[_0xa0be('0x32')]=_[_0xa0be('0x33')](_0x30caf0[_0xa0be('0x32')]);_0x2ec9fa['filters']=_[_0xa0be('0x35')](_0x2ec9fa['model'],_0x2ec9fa[_0xa0be('0x32')]);_0x4e2e3e[_0xa0be('0x36')]=_[_0xa0be('0x35')](_0x2ec9fa[_0xa0be('0x30')],qs['fields'](_0x30caf0[_0xa0be('0x32')][_0xa0be('0x37')]));_0x4e2e3e[_0xa0be('0x36')]=_0x4e2e3e[_0xa0be('0x36')]['length']?_0x4e2e3e[_0xa0be('0x36')]:_0x2ec9fa[_0xa0be('0x30')];if(_0x30caf0[_0xa0be('0x32')]['includeAll']){_0x4e2e3e[_0xa0be('0x44')]=[{'all':!![]}];}_0x4e2e3e=_[_0xa0be('0x3f')]({},_0x4e2e3e,_0x30caf0[_0xa0be('0x40')]);return db[_0xa0be('0x41')][_0xa0be('0x4a')](_0x4e2e3e)[_0xa0be('0x42')](handleEntityNotFound(_0x2333e3,null))[_0xa0be('0x42')](respondWithResult(_0x2333e3,null))[_0xa0be('0x47')](handleError(_0x2333e3,null));};exports['create']=function(_0x17d690,_0x1951ed){return db[_0xa0be('0x41')][_0xa0be('0x4b')](_0x17d690[_0xa0be('0x4c')],{})[_0xa0be('0x42')](respondWithResult(_0x1951ed,0xc9))[_0xa0be('0x47')](handleError(_0x1951ed,null));};exports[_0xa0be('0x27')]=function(_0x1a7806,_0x4b22c3){if(_0x1a7806[_0xa0be('0x4c')]['id']){delete _0x1a7806[_0xa0be('0x4c')]['id'];}return db['SmsQueueReport'][_0xa0be('0x4a')]({'where':{'id':_0x1a7806[_0xa0be('0x49')]['id']}})[_0xa0be('0x42')](handleEntityNotFound(_0x4b22c3,null))[_0xa0be('0x42')](saveUpdates(_0x1a7806['body'],null))[_0xa0be('0x42')](respondWithResult(_0x4b22c3,null))[_0xa0be('0x47')](handleError(_0x4b22c3,null));};exports[_0xa0be('0x28')]=function(_0xc393f,_0x39570c){return db[_0xa0be('0x41')][_0xa0be('0x4a')]({'where':{'id':_0xc393f['params']['id']}})[_0xa0be('0x42')](handleEntityNotFound(_0x39570c,null))['then'](removeEntity(_0x39570c,null))[_0xa0be('0x47')](handleError(_0x39570c,null));};exports[_0xa0be('0x4d')]=function(_0x29312d,_0x4c98ea){return db[_0xa0be('0x41')][_0xa0be('0x4d')]()[_0xa0be('0x42')](respondWithResult(_0x4c98ea,null))[_0xa0be('0x47')](handleError(_0x4c98ea,null));}; \ No newline at end of file +var _0x0019=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','filters','find','create','body','catch','params','destroy','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x406c89,_0x26c32b){var _0x48abca=function(_0x314867){while(--_0x314867){_0x406c89['push'](_0x406c89['shift']());}};_0x48abca(++_0x26c32b);}(_0x0019,0x8a));var _0x9001=function(_0x349148,_0x31eabb){_0x349148=_0x349148-0x0;var _0x2f2b0f=_0x0019[_0x349148];return _0x2f2b0f;};'use strict';var emlformat=require(_0x9001('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9001('0x1'));var rp=require(_0x9001('0x2'));var moment=require(_0x9001('0x3'));var BPromise=require(_0x9001('0x4'));var Mustache=require(_0x9001('0x5'));var util=require(_0x9001('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9001('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9001('0x8'));var squel=require(_0x9001('0x9'));var crypto=require(_0x9001('0xa'));var jsforce=require(_0x9001('0xb'));var deskjs=require(_0x9001('0xc'));var toCsv=require(_0x9001('0x7'));var querystring=require(_0x9001('0xd'));var Papa=require('papaparse');var Redis=require(_0x9001('0xe'));var authService=require(_0x9001('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9001('0x10'));var hardwareService=require(_0x9001('0x11'));var logger=require(_0x9001('0x12'))(_0x9001('0x13'));var utils=require('../../config/utils');var config=require(_0x9001('0x14'));var licenseUtil=require(_0x9001('0x15'));var db=require(_0x9001('0x16'))['db'];function respondWithStatusCode(_0x4a0479,_0x52d81a){_0x52d81a=_0x52d81a||0xcc;return function(_0x5269ae){if(_0x5269ae){return _0x4a0479[_0x9001('0x17')](_0x52d81a);}return _0x4a0479[_0x9001('0x18')](_0x52d81a)[_0x9001('0x19')]();};}function respondWithResult(_0x311520,_0x16aacb){_0x16aacb=_0x16aacb||0xc8;return function(_0x3f172c){if(_0x3f172c){return _0x311520[_0x9001('0x18')](_0x16aacb)[_0x9001('0x1a')](_0x3f172c);}};}function respondWithFilteredResult(_0x9b285,_0x41c0e0){return function(_0x5081f9){if(_0x5081f9){var _0x48bd33=typeof _0x41c0e0[_0x9001('0x1b')]===_0x9001('0x1c')&&typeof _0x41c0e0['limit']==='undefined';var _0x4a4f22=_0x5081f9['count'];var _0x47d5c4=_0x48bd33?0x0:_0x41c0e0['offset'];var _0x2d9dea=_0x48bd33?_0x5081f9[_0x9001('0x1d')]:_0x41c0e0[_0x9001('0x1b')]+_0x41c0e0[_0x9001('0x1e')];var _0x15116a;if(_0x2d9dea>=_0x4a4f22){_0x2d9dea=_0x4a4f22;_0x15116a=0xc8;}else{_0x15116a=0xce;}_0x9b285[_0x9001('0x18')](_0x15116a);return _0x9b285[_0x9001('0x1f')](_0x9001('0x20'),_0x47d5c4+'-'+_0x2d9dea+'/'+_0x4a4f22)[_0x9001('0x1a')](_0x5081f9);}return null;};}function patchUpdates(_0x3cdb25){return function(_0x4e8924){try{jsonpatch['apply'](_0x4e8924,_0x3cdb25,!![]);}catch(_0x1f8797){return BPromise[_0x9001('0x21')](_0x1f8797);}return _0x4e8924[_0x9001('0x22')]();};}function saveUpdates(_0x3d8051,_0x287017){return function(_0x680fbc){if(_0x680fbc){return _0x680fbc[_0x9001('0x23')](_0x3d8051)[_0x9001('0x24')](function(_0x15ee53){return _0x15ee53;});}return null;};}function removeEntity(_0x19f833,_0x25fe78){return function(_0x408106){if(_0x408106){return _0x408106['destroy']()[_0x9001('0x24')](function(){_0x19f833[_0x9001('0x18')](0xcc)[_0x9001('0x19')]();});}};}function handleEntityNotFound(_0x496271,_0x6505a7){return function(_0x18a7cf){if(!_0x18a7cf){_0x496271['sendStatus'](0x194);}return _0x18a7cf;};}function handleError(_0x5c7325,_0x2fac9d){_0x2fac9d=_0x2fac9d||0x1f4;return function(_0x1a412c){logger[_0x9001('0x25')](_0x1a412c[_0x9001('0x26')]);if(_0x1a412c['name']){delete _0x1a412c[_0x9001('0x27')];}_0x5c7325[_0x9001('0x18')](_0x2fac9d)[_0x9001('0x28')](_0x1a412c);};}exports[_0x9001('0x29')]=function(_0x5a9022,_0x48d02a){var _0x45c4cb={},_0x25764a={},_0x484a50={'count':0x0,'rows':[]};var _0x6afd2d=_[_0x9001('0x2a')](db[_0x9001('0x2b')][_0x9001('0x2c')],function(_0x35dad2){return{'name':_0x35dad2['fieldName'],'type':_0x35dad2[_0x9001('0x2d')]['key']};});_0x25764a[_0x9001('0x2e')]=_[_0x9001('0x2a')](_0x6afd2d,_0x9001('0x27'));_0x25764a[_0x9001('0x2f')]=_[_0x9001('0x30')](_0x5a9022[_0x9001('0x2f')]);_0x25764a['filters']=_[_0x9001('0x31')](_0x25764a[_0x9001('0x2e')],_0x25764a[_0x9001('0x2f')]);_0x45c4cb[_0x9001('0x32')]=_[_0x9001('0x31')](_0x25764a[_0x9001('0x2e')],qs[_0x9001('0x33')](_0x5a9022[_0x9001('0x2f')][_0x9001('0x33')]));_0x45c4cb['attributes']=_0x45c4cb['attributes'][_0x9001('0x34')]?_0x45c4cb[_0x9001('0x32')]:_0x25764a[_0x9001('0x2e')];if(!_0x5a9022[_0x9001('0x2f')][_0x9001('0x35')](_0x9001('0x36'))){_0x45c4cb[_0x9001('0x1e')]=qs[_0x9001('0x1e')](_0x5a9022[_0x9001('0x2f')][_0x9001('0x1e')]);_0x45c4cb[_0x9001('0x1b')]=qs['offset'](_0x5a9022[_0x9001('0x2f')]['offset']);}_0x45c4cb[_0x9001('0x37')]=qs[_0x9001('0x38')](_0x5a9022['query']['sort']);_0x45c4cb[_0x9001('0x39')]=qs['filters'](_[_0x9001('0x3a')](_0x5a9022[_0x9001('0x2f')],_0x25764a['filters']),_0x6afd2d);if(_0x5a9022['query'][_0x9001('0x3b')]){_0x45c4cb['where']=_[_0x9001('0x3c')](_0x45c4cb[_0x9001('0x39')],{'$or':_[_0x9001('0x2a')](_0x6afd2d,function(_0x8cac14){if(_0x8cac14['type']!==_0x9001('0x3d')){var _0x165045={};_0x165045[_0x8cac14[_0x9001('0x27')]]={'$like':'%'+_0x5a9022[_0x9001('0x2f')][_0x9001('0x3b')]+'%'};return _0x165045;}})});}_0x45c4cb=_[_0x9001('0x3c')]({},_0x45c4cb,_0x5a9022[_0x9001('0x3e')]);var _0x33de14={'where':_0x45c4cb['where']};return db[_0x9001('0x2b')]['count'](_0x33de14)[_0x9001('0x24')](function(_0x405bfe){_0x484a50[_0x9001('0x1d')]=_0x405bfe;if(_0x5a9022[_0x9001('0x2f')][_0x9001('0x3f')]){_0x45c4cb[_0x9001('0x40')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x9001('0x41')](_0x45c4cb);})[_0x9001('0x24')](function(_0xbb3542){_0x484a50[_0x9001('0x42')]=_0xbb3542;return _0x484a50;})[_0x9001('0x24')](respondWithFilteredResult(_0x48d02a,_0x45c4cb))['catch'](handleError(_0x48d02a,null));};exports[_0x9001('0x43')]=function(_0x5d4b0e,_0xac96e6){var _0x53a43d={'raw':!![],'where':{'id':_0x5d4b0e['params']['id']}},_0xd7e545={};_0xd7e545[_0x9001('0x2e')]=_[_0x9001('0x30')](db['SmsQueueReport'][_0x9001('0x2c')]);_0xd7e545[_0x9001('0x2f')]=_[_0x9001('0x30')](_0x5d4b0e[_0x9001('0x2f')]);_0xd7e545[_0x9001('0x44')]=_[_0x9001('0x31')](_0xd7e545['model'],_0xd7e545[_0x9001('0x2f')]);_0x53a43d['attributes']=_[_0x9001('0x31')](_0xd7e545[_0x9001('0x2e')],qs['fields'](_0x5d4b0e[_0x9001('0x2f')]['fields']));_0x53a43d[_0x9001('0x32')]=_0x53a43d[_0x9001('0x32')][_0x9001('0x34')]?_0x53a43d[_0x9001('0x32')]:_0xd7e545[_0x9001('0x2e')];if(_0x5d4b0e[_0x9001('0x2f')]['includeAll']){_0x53a43d[_0x9001('0x40')]=[{'all':!![]}];}_0x53a43d=_[_0x9001('0x3c')]({},_0x53a43d,_0x5d4b0e[_0x9001('0x3e')]);return db[_0x9001('0x2b')][_0x9001('0x45')](_0x53a43d)[_0x9001('0x24')](handleEntityNotFound(_0xac96e6,null))[_0x9001('0x24')](respondWithResult(_0xac96e6,null))['catch'](handleError(_0xac96e6,null));};exports[_0x9001('0x46')]=function(_0x4c4b21,_0x20436e){return db['SmsQueueReport']['create'](_0x4c4b21[_0x9001('0x47')],{})[_0x9001('0x24')](respondWithResult(_0x20436e,0xc9))[_0x9001('0x48')](handleError(_0x20436e,null));};exports[_0x9001('0x23')]=function(_0x3f20cb,_0x55fe98){if(_0x3f20cb['body']['id']){delete _0x3f20cb[_0x9001('0x47')]['id'];}return db['SmsQueueReport'][_0x9001('0x45')]({'where':{'id':_0x3f20cb[_0x9001('0x49')]['id']}})[_0x9001('0x24')](handleEntityNotFound(_0x55fe98,null))['then'](saveUpdates(_0x3f20cb['body'],null))[_0x9001('0x24')](respondWithResult(_0x55fe98,null))[_0x9001('0x48')](handleError(_0x55fe98,null));};exports[_0x9001('0x4a')]=function(_0x3b40a7,_0x55f087){return db[_0x9001('0x2b')][_0x9001('0x45')]({'where':{'id':_0x3b40a7[_0x9001('0x49')]['id']}})['then'](handleEntityNotFound(_0x55f087,null))[_0x9001('0x24')](removeEntity(_0x55f087,null))[_0x9001('0x48')](handleError(_0x55f087,null));};exports['describe']=function(_0x1b1e96,_0x5388fc){return db[_0x9001('0x2b')][_0x9001('0x4b')]()[_0x9001('0x24')](respondWithResult(_0x5388fc,null))['catch'](handleError(_0x5388fc,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 06efc6e..bdeebe2 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 _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'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(_0x2c534a,_0x18a19e){var _0x3f5c99=function(_0x4c085f){while(--_0x4c085f){_0x2c534a['push'](_0x2c534a['shift']());}};_0x3f5c99(++_0x18a19e);}(_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 1000627..62c44e3 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 _0x8891=['request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','create','body','options','CreateSmsQueueReport','update','raw','where','attributes','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsQueueReport,\x20%s,\x20%s'];(function(_0x4ee010,_0x59e069){var _0x2e0024=function(_0x24057e){while(--_0x24057e){_0x4ee010['push'](_0x4ee010['shift']());}};_0x2e0024(++_0x59e069);}(_0x8891,0x13a));var _0x1889=function(_0xe09d0,_0x1e55d0){_0xe09d0=_0xe09d0-0x0;var _0x44ad05=_0x8891[_0xe09d0];return _0x44ad05;};'use strict';var _=require(_0x1889('0x0'));var util=require(_0x1889('0x1'));var moment=require(_0x1889('0x2'));var BPromise=require(_0x1889('0x3'));var rs=require(_0x1889('0x4'));var fs=require('fs');var Redis=require(_0x1889('0x5'));var db=require(_0x1889('0x6'))['db'];var utils=require(_0x1889('0x7'));var logger=require('../../config/logger')(_0x1889('0x8'));var config=require(_0x1889('0x9'));var jayson=require(_0x1889('0xa'));var client=jayson[_0x1889('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a4136,_0x53b034,_0x460043){return new BPromise(function(_0x1dc7aa,_0x607f08){return client[_0x1889('0xc')](_0x1a4136,_0x460043)[_0x1889('0xd')](function(_0x182c44){logger[_0x1889('0xe')](_0x1889('0xf'),_0x53b034,_0x1889('0x10'));logger[_0x1889('0x11')](_0x1889('0x12'),_0x53b034,_0x1889('0x10'),JSON[_0x1889('0x13')](_0x182c44));if(_0x182c44[_0x1889('0x14')]){if(_0x182c44[_0x1889('0x14')]['code']===0x1f4){logger['error'](_0x1889('0xf'),_0x53b034,_0x182c44['error'][_0x1889('0x15')]);return _0x607f08(_0x182c44[_0x1889('0x14')]['message']);}logger[_0x1889('0x14')]('SmsQueueReport,\x20%s,\x20%s',_0x53b034,_0x182c44[_0x1889('0x14')][_0x1889('0x15')]);return _0x1dc7aa(_0x182c44[_0x1889('0x14')][_0x1889('0x15')]);}else{logger[_0x1889('0xe')](_0x1889('0xf'),_0x53b034,_0x1889('0x10'));_0x1dc7aa(_0x182c44[_0x1889('0x16')]['message']);}})[_0x1889('0x17')](function(_0x17a75c){logger[_0x1889('0x14')]('SmsQueueReport,\x20%s,\x20%s',_0x53b034,_0x17a75c);_0x607f08(_0x17a75c);});});}exports['CreateSmsQueueReport']=function(_0x5a92ff){var _0x372c57=this;return new Promise(function(_0x331b7f,_0x35d404){return db['SmsQueueReport'][_0x1889('0x18')](_0x5a92ff[_0x1889('0x19')],{'raw':_0x5a92ff[_0x1889('0x1a')]?_0x5a92ff[_0x1889('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x1889('0xd')](function(_0x1e53e2){logger[_0x1889('0xe')](_0x1889('0x1b'),_0x5a92ff);logger[_0x1889('0x11')](_0x1889('0x1b'),_0x5a92ff,JSON[_0x1889('0x13')](_0x1e53e2));_0x331b7f(_0x1e53e2);})[_0x1889('0x17')](function(_0x550c29){logger['error']('CreateSmsQueueReport',_0x550c29['message'],_0x5a92ff);_0x35d404(_0x372c57[_0x1889('0x14')](0x1f4,_0x550c29[_0x1889('0x15')]));});});};exports['UpdateSmsQueueReport']=function(_0x56463c){var _0x7d0852=this;return new Promise(function(_0x4afc87,_0x1a1c55){return db['SmsQueueReport'][_0x1889('0x1c')](_0x56463c['body'],{'raw':_0x56463c[_0x1889('0x1a')]?_0x56463c[_0x1889('0x1a')][_0x1889('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56463c[_0x1889('0x1a')]?_0x56463c[_0x1889('0x1a')][_0x1889('0x1e')]||null:null,'attributes':_0x56463c[_0x1889('0x1a')]?_0x56463c['options'][_0x1889('0x1f')]||null:null,'limit':_0x56463c['options']?_0x56463c['options']['limit']||null:null})[_0x1889('0xd')](function(_0x159bc5){logger[_0x1889('0xe')](_0x1889('0x20'),_0x56463c);logger['debug'](_0x1889('0x20'),_0x56463c,JSON[_0x1889('0x13')](_0x159bc5));_0x4afc87(_0x159bc5);})[_0x1889('0x17')](function(_0x5bac0d){logger[_0x1889('0x14')](_0x1889('0x20'),_0x5bac0d[_0x1889('0x15')],_0x56463c);_0x1a1c55(_0x7d0852[_0x1889('0x14')](0x1f4,_0x5bac0d[_0x1889('0x15')]));});});}; \ No newline at end of file +var _0x517d=['raw','where','attributes','lodash','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','create','body','options','CreateSmsQueueReport','UpdateSmsQueueReport','SmsQueueReport','update'];(function(_0x32019b,_0x26419a){var _0x4c3eb1=function(_0x3a26a2){while(--_0x3a26a2){_0x32019b['push'](_0x32019b['shift']());}};_0x4c3eb1(++_0x26419a);}(_0x517d,0x158));var _0xd517=function(_0x1d2be8,_0x430374){_0x1d2be8=_0x1d2be8-0x0;var _0x402432=_0x517d[_0x1d2be8];return _0x402432;};'use strict';var _=require(_0xd517('0x0'));var util=require(_0xd517('0x1'));var moment=require('moment');var BPromise=require(_0xd517('0x2'));var rs=require(_0xd517('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd517('0x4'))(_0xd517('0x5'));var config=require(_0xd517('0x6'));var jayson=require(_0xd517('0x7'));var client=jayson[_0xd517('0x8')][_0xd517('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e519a,_0x5e3299,_0x561ac6){return new BPromise(function(_0x362d4e,_0x469db6){return client[_0xd517('0xa')](_0x4e519a,_0x561ac6)[_0xd517('0xb')](function(_0x3a3f01){logger[_0xd517('0xc')](_0xd517('0xd'),_0x5e3299,_0xd517('0xe'));logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x5e3299,'request\x20sent',JSON[_0xd517('0xf')](_0x3a3f01));if(_0x3a3f01[_0xd517('0x10')]){if(_0x3a3f01['error'][_0xd517('0x11')]===0x1f4){logger[_0xd517('0x10')](_0xd517('0xd'),_0x5e3299,_0x3a3f01[_0xd517('0x10')]['message']);return _0x469db6(_0x3a3f01[_0xd517('0x10')]['message']);}logger[_0xd517('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x5e3299,_0x3a3f01['error'][_0xd517('0x12')]);return _0x362d4e(_0x3a3f01[_0xd517('0x10')][_0xd517('0x12')]);}else{logger[_0xd517('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x5e3299,_0xd517('0xe'));_0x362d4e(_0x3a3f01[_0xd517('0x13')]['message']);}})[_0xd517('0x14')](function(_0x4ca9cf){logger['error'](_0xd517('0xd'),_0x5e3299,_0x4ca9cf);_0x469db6(_0x4ca9cf);});});}exports['CreateSmsQueueReport']=function(_0x2797fe){var _0x171fc0=this;return new Promise(function(_0x237dec,_0x4f88dc){return db['SmsQueueReport'][_0xd517('0x15')](_0x2797fe[_0xd517('0x16')],{'raw':_0x2797fe[_0xd517('0x17')]?_0x2797fe[_0xd517('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xd517('0xb')](function(_0x321174){logger[_0xd517('0xc')]('CreateSmsQueueReport',_0x2797fe);logger['debug'](_0xd517('0x18'),_0x2797fe,JSON[_0xd517('0xf')](_0x321174));_0x237dec(_0x321174);})[_0xd517('0x14')](function(_0x20be1b){logger['error'](_0xd517('0x18'),_0x20be1b[_0xd517('0x12')],_0x2797fe);_0x4f88dc(_0x171fc0[_0xd517('0x10')](0x1f4,_0x20be1b[_0xd517('0x12')]));});});};exports[_0xd517('0x19')]=function(_0x5468db){var _0x331d64=this;return new Promise(function(_0x50300f,_0x26fd58){return db[_0xd517('0x1a')][_0xd517('0x1b')](_0x5468db['body'],{'raw':_0x5468db[_0xd517('0x17')]?_0x5468db[_0xd517('0x17')][_0xd517('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5468db[_0xd517('0x17')]?_0x5468db[_0xd517('0x17')][_0xd517('0x1d')]||null:null,'attributes':_0x5468db['options']?_0x5468db[_0xd517('0x17')][_0xd517('0x1e')]||null:null,'limit':_0x5468db[_0xd517('0x17')]?_0x5468db[_0xd517('0x17')]['limit']||null:null})[_0xd517('0xb')](function(_0x512960){logger['info'](_0xd517('0x19'),_0x5468db);logger['debug'](_0xd517('0x19'),_0x5468db,JSON[_0xd517('0xf')](_0x512960));_0x50300f(_0x512960);})[_0xd517('0x14')](function(_0x2b1a8){logger[_0xd517('0x10')](_0xd517('0x19'),_0x2b1a8[_0xd517('0x12')],_0x5468db);_0x26fd58(_0x331d64[_0xd517('0x10')](0x1f4,_0x2b1a8[_0xd517('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 2d9f2ad..44a4375 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 _0x72b1=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x138452,_0x8ac96){var _0x3fa4d1=function(_0x28035c){while(--_0x28035c){_0x138452['push'](_0x138452['shift']());}};_0x3fa4d1(++_0x8ac96);}(_0x72b1,0x16e));var _0x172b=function(_0x658d94,_0x308068){_0x658d94=_0x658d94-0x0;var _0x59f0f3=_0x72b1[_0x658d94];return _0x59f0f3;};'use strict';var multer=require(_0x172b('0x0'));var util=require('util');var path=require(_0x172b('0x1'));var timeout=require(_0x172b('0x2'));var express=require(_0x172b('0x3'));var router=express[_0x172b('0x4')]();var fs_extra=require(_0x172b('0x5'));var auth=require(_0x172b('0x6'));var interaction=require(_0x172b('0x7'));var config=require('../../config/environment');var controller=require(_0x172b('0x8'));router[_0x172b('0x9')]('/',auth[_0x172b('0xa')](),controller[_0x172b('0xb')]);router['get'](_0x172b('0xc'),auth['isAuthenticated'](),controller[_0x172b('0xd')]);router['get'](_0x172b('0xe'),auth[_0x172b('0xa')](),controller[_0x172b('0xf')]);router[_0x172b('0x10')]('/',auth['isAuthenticated'](),controller[_0x172b('0x11')]);router[_0x172b('0x12')](_0x172b('0xe'),auth[_0x172b('0xa')](),controller[_0x172b('0x13')]);router[_0x172b('0x14')](_0x172b('0xe'),auth['isAuthenticated'](),controller[_0x172b('0x15')]);module[_0x172b('0x16')]=router; \ No newline at end of file +var _0x99c9=['describe','/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x42b523,_0xd32edf){var _0x4a41f0=function(_0xd5bec8){while(--_0xd5bec8){_0x42b523['push'](_0x42b523['shift']());}};_0x4a41f0(++_0xd32edf);}(_0x99c9,0x13c));var _0x999c=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x99c9[_0x49b207];return _0x2dc8fa;};'use strict';var multer=require(_0x999c('0x0'));var util=require(_0x999c('0x1'));var path=require(_0x999c('0x2'));var timeout=require(_0x999c('0x3'));var express=require(_0x999c('0x4'));var router=express[_0x999c('0x5')]();var fs_extra=require(_0x999c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x999c('0x7'));var config=require(_0x999c('0x8'));var controller=require(_0x999c('0x9'));router[_0x999c('0xa')]('/',auth[_0x999c('0xb')](),controller[_0x999c('0xc')]);router[_0x999c('0xa')](_0x999c('0xd'),auth[_0x999c('0xb')](),controller[_0x999c('0xe')]);router[_0x999c('0xa')](_0x999c('0xf'),auth[_0x999c('0xb')](),controller[_0x999c('0x10')]);router['post']('/',auth[_0x999c('0xb')](),controller[_0x999c('0x11')]);router['put'](_0x999c('0xf'),auth[_0x999c('0xb')](),controller[_0x999c('0x12')]);router[_0x999c('0x13')](_0x999c('0xf'),auth[_0x999c('0xb')](),controller[_0x999c('0x14')]);module[_0x999c('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 4fed385..e18fb52 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x5ce809,_0x42c23f){var _0x2debc0=function(_0x3094c6){while(--_0x3094c6){_0x5ce809['push'](_0x5ce809['shift']());}};_0x2debc0(++_0x42c23f);}(_0xf4eb,0xec));var _0xbf4e=function(_0xc112e2,_0x1f127b){_0xc112e2=_0xc112e2-0x0;var _0x42b664=_0xf4eb[_0xc112e2];return _0x42b664;};'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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x280c7a,_0x3f29b4){var _0x32ce3b=function(_0x448908){while(--_0x448908){_0x280c7a['push'](_0x280c7a['shift']());}};_0x32ce3b(++_0x3f29b4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index a0e23b3..ab54459 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 _0x9420=['limit','count','set','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','SmsTransferReport','rawAttributes','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','params','keys','intersection','options','find','create','body','catch','describe','eml-format','rimraf','moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined'];(function(_0x5f746f,_0x5b05ab){var _0x198d15=function(_0x58c7e7){while(--_0x58c7e7){_0x5f746f['push'](_0x5f746f['shift']());}};_0x198d15(++_0x5b05ab);}(_0x9420,0x186));var _0x0942=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x9420[_0x494d1f];return _0x457b6e;};'use strict';var emlformat=require(_0x0942('0x0'));var rimraf=require(_0x0942('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0942('0x2'));var BPromise=require(_0x0942('0x3'));var Mustache=require('mustache');var util=require(_0x0942('0x4'));var path=require(_0x0942('0x5'));var sox=require(_0x0942('0x6'));var csv=require('to-csv');var ejs=require(_0x0942('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0942('0x8'));var squel=require('squel');var crypto=require(_0x0942('0x9'));var jsforce=require(_0x0942('0xa'));var deskjs=require(_0x0942('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0942('0xc'));var Redis=require('ioredis');var authService=require(_0x0942('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0942('0xe'));var logger=require(_0x0942('0xf'))(_0x0942('0x10'));var utils=require('../../config/utils');var config=require(_0x0942('0x11'));var licenseUtil=require(_0x0942('0x12'));var db=require(_0x0942('0x13'))['db'];function respondWithStatusCode(_0x1dc1e0,_0x34cdd6){_0x34cdd6=_0x34cdd6||0xcc;return function(_0x382ed8){if(_0x382ed8){return _0x1dc1e0['sendStatus'](_0x34cdd6);}return _0x1dc1e0[_0x0942('0x14')](_0x34cdd6)['end']();};}function respondWithResult(_0x20db95,_0x3b47e8){_0x3b47e8=_0x3b47e8||0xc8;return function(_0x26c43f){if(_0x26c43f){return _0x20db95[_0x0942('0x14')](_0x3b47e8)[_0x0942('0x15')](_0x26c43f);}};}function respondWithFilteredResult(_0x14affd,_0x56aba1){return function(_0x23514f){if(_0x23514f){var _0x503408=typeof _0x56aba1[_0x0942('0x16')]===_0x0942('0x17')&&typeof _0x56aba1[_0x0942('0x18')]==='undefined';var _0x1e5529=_0x23514f[_0x0942('0x19')];var _0x507c7b=_0x503408?0x0:_0x56aba1[_0x0942('0x16')];var _0x5e3b06=_0x503408?_0x23514f[_0x0942('0x19')]:_0x56aba1[_0x0942('0x16')]+_0x56aba1[_0x0942('0x18')];var _0x799896;if(_0x5e3b06>=_0x1e5529){_0x5e3b06=_0x1e5529;_0x799896=0xc8;}else{_0x799896=0xce;}_0x14affd[_0x0942('0x14')](_0x799896);return _0x14affd[_0x0942('0x1a')]('Content-Range',_0x507c7b+'-'+_0x5e3b06+'/'+_0x1e5529)[_0x0942('0x15')](_0x23514f);}return null;};}function patchUpdates(_0x23a30b){return function(_0xa1fc65){try{jsonpatch['apply'](_0xa1fc65,_0x23a30b,!![]);}catch(_0x1a4261){return BPromise['reject'](_0x1a4261);}return _0xa1fc65[_0x0942('0x1b')]();};}function saveUpdates(_0x3d5bc7,_0x4a3e05){return function(_0x48b040){if(_0x48b040){return _0x48b040[_0x0942('0x1c')](_0x3d5bc7)[_0x0942('0x1d')](function(_0x552755){return _0x552755;});}return null;};}function removeEntity(_0xacc4ad,_0x20fb90){return function(_0xadacc){if(_0xadacc){return _0xadacc[_0x0942('0x1e')]()['then'](function(){_0xacc4ad[_0x0942('0x14')](0xcc)[_0x0942('0x1f')]();});}};}function handleEntityNotFound(_0x4c5112,_0x52925a){return function(_0xb74264){if(!_0xb74264){_0x4c5112[_0x0942('0x20')](0x194);}return _0xb74264;};}function handleError(_0x332ef0,_0x38e46a){_0x38e46a=_0x38e46a||0x1f4;return function(_0x289b0e){logger[_0x0942('0x21')](_0x289b0e[_0x0942('0x22')]);if(_0x289b0e[_0x0942('0x23')]){delete _0x289b0e[_0x0942('0x23')];}_0x332ef0[_0x0942('0x14')](_0x38e46a)['send'](_0x289b0e);};}exports[_0x0942('0x24')]=function(_0x58a86a,_0x358daa){var _0x38b7d4={},_0x14fb28={},_0x597768={'count':0x0,'rows':[]};var _0x3dce5a=_[_0x0942('0x25')](db[_0x0942('0x26')][_0x0942('0x27')],function(_0x50c575){return{'name':_0x50c575['fieldName'],'type':_0x50c575['type'][_0x0942('0x28')]};});_0x14fb28[_0x0942('0x29')]=_[_0x0942('0x25')](_0x3dce5a,_0x0942('0x23'));_0x14fb28[_0x0942('0x2a')]=_['keys'](_0x58a86a['query']);_0x14fb28[_0x0942('0x2b')]=_['intersection'](_0x14fb28[_0x0942('0x29')],_0x14fb28[_0x0942('0x2a')]);_0x38b7d4['attributes']=_['intersection'](_0x14fb28['model'],qs[_0x0942('0x2c')](_0x58a86a[_0x0942('0x2a')][_0x0942('0x2c')]));_0x38b7d4['attributes']=_0x38b7d4[_0x0942('0x2d')][_0x0942('0x2e')]?_0x38b7d4[_0x0942('0x2d')]:_0x14fb28[_0x0942('0x29')];if(!_0x58a86a[_0x0942('0x2a')][_0x0942('0x2f')](_0x0942('0x30'))){_0x38b7d4[_0x0942('0x18')]=qs[_0x0942('0x18')](_0x58a86a[_0x0942('0x2a')]['limit']);_0x38b7d4[_0x0942('0x16')]=qs[_0x0942('0x16')](_0x58a86a[_0x0942('0x2a')][_0x0942('0x16')]);}_0x38b7d4[_0x0942('0x31')]=qs[_0x0942('0x32')](_0x58a86a[_0x0942('0x2a')][_0x0942('0x32')]);_0x38b7d4[_0x0942('0x33')]=qs[_0x0942('0x2b')](_[_0x0942('0x34')](_0x58a86a[_0x0942('0x2a')],_0x14fb28[_0x0942('0x2b')]),_0x3dce5a);if(_0x58a86a['query'][_0x0942('0x35')]){_0x38b7d4[_0x0942('0x33')]=_[_0x0942('0x36')](_0x38b7d4['where'],{'$or':_[_0x0942('0x25')](_0x3dce5a,function(_0xa8572f){if(_0xa8572f['type']!==_0x0942('0x37')){var _0x2101e3={};_0x2101e3[_0xa8572f[_0x0942('0x23')]]={'$like':'%'+_0x58a86a[_0x0942('0x2a')]['filter']+'%'};return _0x2101e3;}})});}_0x38b7d4=_['merge']({},_0x38b7d4,_0x58a86a['options']);var _0x1e80e4={'where':_0x38b7d4[_0x0942('0x33')]};return db[_0x0942('0x26')][_0x0942('0x19')](_0x1e80e4)['then'](function(_0x28cce9){_0x597768['count']=_0x28cce9;if(_0x58a86a['query'][_0x0942('0x38')]){_0x38b7d4[_0x0942('0x39')]=[{'all':!![]}];}return db[_0x0942('0x26')]['findAll'](_0x38b7d4);})[_0x0942('0x1d')](function(_0x29bf0a){_0x597768[_0x0942('0x3a')]=_0x29bf0a;return _0x597768;})[_0x0942('0x1d')](respondWithFilteredResult(_0x358daa,_0x38b7d4))['catch'](handleError(_0x358daa,null));};exports[_0x0942('0x3b')]=function(_0x4089d8,_0x472154){var _0x3d12a2={'raw':!![],'where':{'id':_0x4089d8[_0x0942('0x3c')]['id']}},_0x18e0aa={};_0x18e0aa[_0x0942('0x29')]=_[_0x0942('0x3d')](db[_0x0942('0x26')][_0x0942('0x27')]);_0x18e0aa[_0x0942('0x2a')]=_[_0x0942('0x3d')](_0x4089d8[_0x0942('0x2a')]);_0x18e0aa[_0x0942('0x2b')]=_[_0x0942('0x3e')](_0x18e0aa[_0x0942('0x29')],_0x18e0aa[_0x0942('0x2a')]);_0x3d12a2[_0x0942('0x2d')]=_[_0x0942('0x3e')](_0x18e0aa[_0x0942('0x29')],qs[_0x0942('0x2c')](_0x4089d8[_0x0942('0x2a')][_0x0942('0x2c')]));_0x3d12a2[_0x0942('0x2d')]=_0x3d12a2[_0x0942('0x2d')][_0x0942('0x2e')]?_0x3d12a2[_0x0942('0x2d')]:_0x18e0aa['model'];if(_0x4089d8[_0x0942('0x2a')][_0x0942('0x38')]){_0x3d12a2[_0x0942('0x39')]=[{'all':!![]}];}_0x3d12a2=_['merge']({},_0x3d12a2,_0x4089d8[_0x0942('0x3f')]);return db[_0x0942('0x26')][_0x0942('0x40')](_0x3d12a2)['then'](handleEntityNotFound(_0x472154,null))[_0x0942('0x1d')](respondWithResult(_0x472154,null))['catch'](handleError(_0x472154,null));};exports[_0x0942('0x41')]=function(_0x9c6df,_0x4f58ea){return db[_0x0942('0x26')][_0x0942('0x41')](_0x9c6df[_0x0942('0x42')],{})[_0x0942('0x1d')](respondWithResult(_0x4f58ea,0xc9))['catch'](handleError(_0x4f58ea,null));};exports[_0x0942('0x1c')]=function(_0x59089b,_0x22448e){if(_0x59089b['body']['id']){delete _0x59089b[_0x0942('0x42')]['id'];}return db['SmsTransferReport'][_0x0942('0x40')]({'where':{'id':_0x59089b[_0x0942('0x3c')]['id']}})[_0x0942('0x1d')](handleEntityNotFound(_0x22448e,null))[_0x0942('0x1d')](saveUpdates(_0x59089b[_0x0942('0x42')],null))['then'](respondWithResult(_0x22448e,null))[_0x0942('0x43')](handleError(_0x22448e,null));};exports[_0x0942('0x1e')]=function(_0x31cb3e,_0x1ea961){return db[_0x0942('0x26')][_0x0942('0x40')]({'where':{'id':_0x31cb3e[_0x0942('0x3c')]['id']}})[_0x0942('0x1d')](handleEntityNotFound(_0x1ea961,null))[_0x0942('0x1d')](removeEntity(_0x1ea961,null))[_0x0942('0x43')](handleError(_0x1ea961,null));};exports[_0x0942('0x44')]=function(_0x5b3f0e,_0x21261a){return db[_0x0942('0x26')][_0x0942('0x44')]()[_0x0942('0x1d')](respondWithResult(_0x21261a,null))['catch'](handleError(_0x21261a,null));}; \ No newline at end of file +var _0xc22c=['model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','VIRTUAL','SmsTransferReport','count','then','includeAll','include','findAll','rows','params','rawAttributes','length','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','offset','set','Content-Range','reject','save','update','destroy','stack','name','send','index','fieldName','key'];(function(_0x2bdb7e,_0x28fbc7){var _0x1106ca=function(_0x1ca35e){while(--_0x1ca35e){_0x2bdb7e['push'](_0x2bdb7e['shift']());}};_0x1106ca(++_0x28fbc7);}(_0xc22c,0x1ef));var _0xcc22=function(_0x57b432,_0x1589a0){_0x57b432=_0x57b432-0x0;var _0x2edf2a=_0xc22c[_0x57b432];return _0x2edf2a;};'use strict';var emlformat=require(_0xcc22('0x0'));var rimraf=require(_0xcc22('0x1'));var zipdir=require(_0xcc22('0x2'));var jsonpatch=require(_0xcc22('0x3'));var rp=require('request-promise');var moment=require(_0xcc22('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcc22('0x5'));var path=require(_0xcc22('0x6'));var sox=require(_0xcc22('0x7'));var csv=require('to-csv');var ejs=require(_0xcc22('0x8'));var fs=require('fs');var fs_extra=require(_0xcc22('0x9'));var _=require('lodash');var squel=require(_0xcc22('0xa'));var crypto=require(_0xcc22('0xb'));var jsforce=require(_0xcc22('0xc'));var deskjs=require(_0xcc22('0xd'));var toCsv=require(_0xcc22('0xe'));var querystring=require(_0xcc22('0xf'));var Papa=require('papaparse');var Redis=require(_0xcc22('0x10'));var authService=require(_0xcc22('0x11'));var qs=require(_0xcc22('0x12'));var as=require(_0xcc22('0x13'));var hardwareService=require(_0xcc22('0x14'));var logger=require(_0xcc22('0x15'))(_0xcc22('0x16'));var utils=require('../../config/utils');var config=require(_0xcc22('0x17'));var licenseUtil=require(_0xcc22('0x18'));var db=require(_0xcc22('0x19'))['db'];function respondWithStatusCode(_0x312898,_0x39c4af){_0x39c4af=_0x39c4af||0xcc;return function(_0x1c6cc3){if(_0x1c6cc3){return _0x312898[_0xcc22('0x1a')](_0x39c4af);}return _0x312898[_0xcc22('0x1b')](_0x39c4af)['end']();};}function respondWithResult(_0x5d5168,_0x5af57a){_0x5af57a=_0x5af57a||0xc8;return function(_0x13e8c3){if(_0x13e8c3){return _0x5d5168[_0xcc22('0x1b')](_0x5af57a)[_0xcc22('0x1c')](_0x13e8c3);}};}function respondWithFilteredResult(_0x1f420c,_0x5c2b93){return function(_0xe36c73){if(_0xe36c73){var _0x42d2ca=typeof _0x5c2b93['offset']==='undefined'&&typeof _0x5c2b93[_0xcc22('0x1d')]===_0xcc22('0x1e');var _0x3ebce6=_0xe36c73['count'];var _0x228c92=_0x42d2ca?0x0:_0x5c2b93['offset'];var _0x3631e0=_0x42d2ca?_0xe36c73['count']:_0x5c2b93[_0xcc22('0x1f')]+_0x5c2b93[_0xcc22('0x1d')];var _0x49f385;if(_0x3631e0>=_0x3ebce6){_0x3631e0=_0x3ebce6;_0x49f385=0xc8;}else{_0x49f385=0xce;}_0x1f420c[_0xcc22('0x1b')](_0x49f385);return _0x1f420c[_0xcc22('0x20')](_0xcc22('0x21'),_0x228c92+'-'+_0x3631e0+'/'+_0x3ebce6)[_0xcc22('0x1c')](_0xe36c73);}return null;};}function patchUpdates(_0x289144){return function(_0x536259){try{jsonpatch['apply'](_0x536259,_0x289144,!![]);}catch(_0xcd4f4){return BPromise[_0xcc22('0x22')](_0xcd4f4);}return _0x536259[_0xcc22('0x23')]();};}function saveUpdates(_0x5e0f43,_0x365cfb){return function(_0x5a9b76){if(_0x5a9b76){return _0x5a9b76[_0xcc22('0x24')](_0x5e0f43)['then'](function(_0x59eabe){return _0x59eabe;});}return null;};}function removeEntity(_0x5c5df3,_0x4ae349){return function(_0x3291dc){if(_0x3291dc){return _0x3291dc[_0xcc22('0x25')]()['then'](function(){_0x5c5df3[_0xcc22('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a909b,_0x3067dc){return function(_0x162e62){if(!_0x162e62){_0x3a909b[_0xcc22('0x1a')](0x194);}return _0x162e62;};}function handleError(_0x4efbc7,_0x18894f){_0x18894f=_0x18894f||0x1f4;return function(_0x20cd3e){logger['error'](_0x20cd3e[_0xcc22('0x26')]);if(_0x20cd3e[_0xcc22('0x27')]){delete _0x20cd3e[_0xcc22('0x27')];}_0x4efbc7['status'](_0x18894f)[_0xcc22('0x28')](_0x20cd3e);};}exports[_0xcc22('0x29')]=function(_0x20d7db,_0x4903ad){var _0x45d618={},_0x2d2bf5={},_0x147ddf={'count':0x0,'rows':[]};var _0x4228c0=_['map'](db['SmsTransferReport']['rawAttributes'],function(_0x50bf76){return{'name':_0x50bf76[_0xcc22('0x2a')],'type':_0x50bf76['type'][_0xcc22('0x2b')]};});_0x2d2bf5[_0xcc22('0x2c')]=_['map'](_0x4228c0,_0xcc22('0x27'));_0x2d2bf5[_0xcc22('0x2d')]=_[_0xcc22('0x2e')](_0x20d7db[_0xcc22('0x2d')]);_0x2d2bf5[_0xcc22('0x2f')]=_[_0xcc22('0x30')](_0x2d2bf5[_0xcc22('0x2c')],_0x2d2bf5[_0xcc22('0x2d')]);_0x45d618[_0xcc22('0x31')]=_[_0xcc22('0x30')](_0x2d2bf5[_0xcc22('0x2c')],qs['fields'](_0x20d7db['query'][_0xcc22('0x32')]));_0x45d618['attributes']=_0x45d618['attributes']['length']?_0x45d618['attributes']:_0x2d2bf5[_0xcc22('0x2c')];if(!_0x20d7db['query'][_0xcc22('0x33')]('nolimit')){_0x45d618[_0xcc22('0x1d')]=qs[_0xcc22('0x1d')](_0x20d7db[_0xcc22('0x2d')][_0xcc22('0x1d')]);_0x45d618['offset']=qs['offset'](_0x20d7db[_0xcc22('0x2d')][_0xcc22('0x1f')]);}_0x45d618[_0xcc22('0x34')]=qs[_0xcc22('0x35')](_0x20d7db[_0xcc22('0x2d')][_0xcc22('0x35')]);_0x45d618[_0xcc22('0x36')]=qs[_0xcc22('0x2f')](_[_0xcc22('0x37')](_0x20d7db[_0xcc22('0x2d')],_0x2d2bf5['filters']),_0x4228c0);if(_0x20d7db[_0xcc22('0x2d')][_0xcc22('0x38')]){_0x45d618['where']=_[_0xcc22('0x39')](_0x45d618[_0xcc22('0x36')],{'$or':_[_0xcc22('0x3a')](_0x4228c0,function(_0x501fdd){if(_0x501fdd[_0xcc22('0x3b')]!==_0xcc22('0x3c')){var _0x5e8aac={};_0x5e8aac[_0x501fdd[_0xcc22('0x27')]]={'$like':'%'+_0x20d7db[_0xcc22('0x2d')]['filter']+'%'};return _0x5e8aac;}})});}_0x45d618=_[_0xcc22('0x39')]({},_0x45d618,_0x20d7db['options']);var _0x3c7665={'where':_0x45d618[_0xcc22('0x36')]};return db[_0xcc22('0x3d')][_0xcc22('0x3e')](_0x3c7665)[_0xcc22('0x3f')](function(_0x499256){_0x147ddf['count']=_0x499256;if(_0x20d7db[_0xcc22('0x2d')][_0xcc22('0x40')]){_0x45d618[_0xcc22('0x41')]=[{'all':!![]}];}return db[_0xcc22('0x3d')][_0xcc22('0x42')](_0x45d618);})[_0xcc22('0x3f')](function(_0x3e3882){_0x147ddf[_0xcc22('0x43')]=_0x3e3882;return _0x147ddf;})['then'](respondWithFilteredResult(_0x4903ad,_0x45d618))['catch'](handleError(_0x4903ad,null));};exports['show']=function(_0x2dc9fc,_0x1b9ccd){var _0x3c2dbd={'raw':!![],'where':{'id':_0x2dc9fc[_0xcc22('0x44')]['id']}},_0x15449f={};_0x15449f[_0xcc22('0x2c')]=_[_0xcc22('0x2e')](db[_0xcc22('0x3d')][_0xcc22('0x45')]);_0x15449f[_0xcc22('0x2d')]=_['keys'](_0x2dc9fc['query']);_0x15449f[_0xcc22('0x2f')]=_[_0xcc22('0x30')](_0x15449f[_0xcc22('0x2c')],_0x15449f[_0xcc22('0x2d')]);_0x3c2dbd[_0xcc22('0x31')]=_[_0xcc22('0x30')](_0x15449f[_0xcc22('0x2c')],qs['fields'](_0x2dc9fc['query']['fields']));_0x3c2dbd['attributes']=_0x3c2dbd[_0xcc22('0x31')][_0xcc22('0x46')]?_0x3c2dbd[_0xcc22('0x31')]:_0x15449f[_0xcc22('0x2c')];if(_0x2dc9fc['query'][_0xcc22('0x40')]){_0x3c2dbd['include']=[{'all':!![]}];}_0x3c2dbd=_[_0xcc22('0x39')]({},_0x3c2dbd,_0x2dc9fc[_0xcc22('0x47')]);return db[_0xcc22('0x3d')][_0xcc22('0x48')](_0x3c2dbd)[_0xcc22('0x3f')](handleEntityNotFound(_0x1b9ccd,null))[_0xcc22('0x3f')](respondWithResult(_0x1b9ccd,null))[_0xcc22('0x49')](handleError(_0x1b9ccd,null));};exports[_0xcc22('0x4a')]=function(_0x26b5ff,_0xbed772){return db[_0xcc22('0x3d')]['create'](_0x26b5ff[_0xcc22('0x4b')],{})[_0xcc22('0x3f')](respondWithResult(_0xbed772,0xc9))[_0xcc22('0x49')](handleError(_0xbed772,null));};exports[_0xcc22('0x24')]=function(_0xb6a77c,_0x3f43c6){if(_0xb6a77c[_0xcc22('0x4b')]['id']){delete _0xb6a77c[_0xcc22('0x4b')]['id'];}return db[_0xcc22('0x3d')][_0xcc22('0x48')]({'where':{'id':_0xb6a77c[_0xcc22('0x44')]['id']}})['then'](handleEntityNotFound(_0x3f43c6,null))[_0xcc22('0x3f')](saveUpdates(_0xb6a77c[_0xcc22('0x4b')],null))[_0xcc22('0x3f')](respondWithResult(_0x3f43c6,null))[_0xcc22('0x49')](handleError(_0x3f43c6,null));};exports['destroy']=function(_0x435de4,_0x13f08f){return db[_0xcc22('0x3d')][_0xcc22('0x48')]({'where':{'id':_0x435de4[_0xcc22('0x44')]['id']}})[_0xcc22('0x3f')](handleEntityNotFound(_0x13f08f,null))[_0xcc22('0x3f')](removeEntity(_0x13f08f,null))['catch'](handleError(_0x13f08f,null));};exports[_0xcc22('0x4c')]=function(_0x523937,_0x1635bb){return db[_0xcc22('0x3d')][_0xcc22('0x4c')]()[_0xcc22('0x3f')](respondWithResult(_0x1635bb,null))[_0xcc22('0x49')](handleError(_0x1635bb,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 411e2ad..3ff39a9 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 _0xfef2=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash'];(function(_0x257a08,_0x27771f){var _0x4b2b23=function(_0x373bea){while(--_0x373bea){_0x257a08['push'](_0x257a08['shift']());}};_0x4b2b23(++_0x27771f);}(_0xfef2,0x1e0));var _0x2fef=function(_0x3d542c,_0x2098ae){_0x3d542c=_0x3d542c-0x0;var _0x4946de=_0xfef2[_0x3d542c];return _0x4946de;};'use strict';var _=require(_0x2fef('0x0'));var util=require(_0x2fef('0x1'));var logger=require(_0x2fef('0x2'))('api');var moment=require(_0x2fef('0x3'));var BPromise=require(_0x2fef('0x4'));var rp=require(_0x2fef('0x5'));var fs=require('fs');var path=require(_0x2fef('0x6'));var rimraf=require('rimraf');var config=require(_0x2fef('0x7'));var attributes=require('./smsTransferReport.attributes');module[_0x2fef('0x8')]=function(_0x35c574,_0x152f6d){return _0x35c574[_0x2fef('0x9')](_0x2fef('0xa'),attributes,{'tableName':_0x2fef('0xb'),'paranoid':![],'indexes':[{'name':_0x2fef('0xc'),'fields':[_0x2fef('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8558=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','util'];(function(_0x1a3c6b,_0x3739d6){var _0x2a113a=function(_0x23519e){while(--_0x23519e){_0x1a3c6b['push'](_0x1a3c6b['shift']());}};_0x2a113a(++_0x3739d6);}(_0x8558,0x103));var _0x8855=function(_0x4c3633,_0x7df7bf){_0x4c3633=_0x4c3633-0x0;var _0x34aa22=_0x8558[_0x4c3633];return _0x34aa22;};'use strict';var _=require('lodash');var util=require(_0x8855('0x0'));var logger=require(_0x8855('0x1'))(_0x8855('0x2'));var moment=require(_0x8855('0x3'));var BPromise=require(_0x8855('0x4'));var rp=require(_0x8855('0x5'));var fs=require('fs');var path=require(_0x8855('0x6'));var rimraf=require('rimraf');var config=require(_0x8855('0x7'));var attributes=require('./smsTransferReport.attributes');module[_0x8855('0x8')]=function(_0x4ed0e8,_0x276ee5){return _0x4ed0e8[_0x8855('0x9')](_0x8855('0xa'),attributes,{'tableName':_0x8855('0xb'),'paranoid':![],'indexes':[{'name':_0x8855('0xc'),'fields':[_0x8855('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index c792e90..03df31f 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 _0xca9e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util'];(function(_0xed9fea,_0x5ed774){var _0x198f12=function(_0xfb85f6){while(--_0xfb85f6){_0xed9fea['push'](_0xed9fea['shift']());}};_0x198f12(++_0x5ed774);}(_0xca9e,0x136));var _0xeca9=function(_0x519a04,_0x1a0ad4){_0x519a04=_0x519a04-0x0;var _0x34d091=_0xca9e[_0x519a04];return _0x34d091;};'use strict';var _=require(_0xeca9('0x0'));var util=require(_0xeca9('0x1'));var moment=require(_0xeca9('0x2'));var BPromise=require(_0xeca9('0x3'));var rs=require(_0xeca9('0x4'));var fs=require('fs');var Redis=require(_0xeca9('0x5'));var db=require(_0xeca9('0x6'))['db'];var utils=require(_0xeca9('0x7'));var logger=require(_0xeca9('0x8'))(_0xeca9('0x9'));var config=require(_0xeca9('0xa'));var jayson=require(_0xeca9('0xb'));var client=jayson[_0xeca9('0xc')][_0xeca9('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x483e41,_0x369f5e,_0x1774f3){return new BPromise(function(_0x4d57ee,_0x4eaf49){return client[_0xeca9('0xe')](_0x483e41,_0x1774f3)[_0xeca9('0xf')](function(_0x1673b6){logger['info'](_0xeca9('0x10'),_0x369f5e,_0xeca9('0x11'));logger[_0xeca9('0x12')](_0xeca9('0x13'),_0x369f5e,_0xeca9('0x11'),JSON[_0xeca9('0x14')](_0x1673b6));if(_0x1673b6['error']){if(_0x1673b6[_0xeca9('0x15')][_0xeca9('0x16')]===0x1f4){logger['error'](_0xeca9('0x10'),_0x369f5e,_0x1673b6['error'][_0xeca9('0x17')]);return _0x4eaf49(_0x1673b6[_0xeca9('0x15')]['message']);}logger[_0xeca9('0x15')](_0xeca9('0x10'),_0x369f5e,_0x1673b6[_0xeca9('0x15')]['message']);return _0x4d57ee(_0x1673b6[_0xeca9('0x15')][_0xeca9('0x17')]);}else{logger[_0xeca9('0x18')](_0xeca9('0x10'),_0x369f5e,'request\x20sent');_0x4d57ee(_0x1673b6['result'][_0xeca9('0x17')]);}})[_0xeca9('0x19')](function(_0x553965){logger[_0xeca9('0x15')](_0xeca9('0x10'),_0x369f5e,_0x553965);_0x4eaf49(_0x553965);});});} \ No newline at end of file +var _0x522b=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','SmsTransferReport,\x20%s,\x20%s','message','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x38a555,_0x7b155c){var _0x3ff762=function(_0x2eefd8){while(--_0x2eefd8){_0x38a555['push'](_0x38a555['shift']());}};_0x3ff762(++_0x7b155c);}(_0x522b,0x1c3));var _0xb522=function(_0x810e4d,_0x909ef4){_0x810e4d=_0x810e4d-0x0;var _0x13f01c=_0x522b[_0x810e4d];return _0x13f01c;};'use strict';var _=require(_0xb522('0x0'));var util=require(_0xb522('0x1'));var moment=require('moment');var BPromise=require(_0xb522('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb522('0x3'))['db'];var utils=require(_0xb522('0x4'));var logger=require('../../config/logger')(_0xb522('0x5'));var config=require(_0xb522('0x6'));var jayson=require(_0xb522('0x7'));var client=jayson[_0xb522('0x8')][_0xb522('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55a5f0,_0x446229,_0x2f289f){return new BPromise(function(_0x5a5cd3,_0x55259d){return client[_0xb522('0xa')](_0x55a5f0,_0x2f289f)['then'](function(_0x3f4f63){logger[_0xb522('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x446229,_0xb522('0xc'));logger[_0xb522('0xd')](_0xb522('0xe'),_0x446229,'request\x20sent',JSON['stringify'](_0x3f4f63));if(_0x3f4f63[_0xb522('0xf')]){if(_0x3f4f63[_0xb522('0xf')][_0xb522('0x10')]===0x1f4){logger['error'](_0xb522('0x11'),_0x446229,_0x3f4f63['error'][_0xb522('0x12')]);return _0x55259d(_0x3f4f63[_0xb522('0xf')]['message']);}logger[_0xb522('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x446229,_0x3f4f63[_0xb522('0xf')][_0xb522('0x12')]);return _0x5a5cd3(_0x3f4f63[_0xb522('0xf')][_0xb522('0x12')]);}else{logger[_0xb522('0xb')](_0xb522('0x11'),_0x446229,_0xb522('0xc'));_0x5a5cd3(_0x3f4f63['result'][_0xb522('0x12')]);}})['catch'](function(_0x435f25){logger[_0xb522('0xf')](_0xb522('0x11'),_0x446229,_0x435f25);_0x55259d(_0x435f25);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 6be7608..6301b23 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 _0xaddb=['fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','index','get','/:id','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','replace','format','%s-%s%s','basename','originalname','extname','post','single','file','create','put','update','delete','exports','multer','util','path','express','Router'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaddb,0x83));var _0xbadd=function(_0xe0eace,_0x1c3cb5){_0xe0eace=_0xe0eace-0x0;var _0x1f3945=_0xaddb[_0xe0eace];return _0x1f3945;};'use strict';var multer=require(_0xbadd('0x0'));var util=require(_0xbadd('0x1'));var path=require(_0xbadd('0x2'));var timeout=require('connect-timeout');var express=require(_0xbadd('0x3'));var router=express[_0xbadd('0x4')]();var fs_extra=require(_0xbadd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbadd('0x6'));var config=require(_0xbadd('0x7'));var controller=require(_0xbadd('0x8'));router['get']('/',auth[_0xbadd('0x9')](),controller[_0xbadd('0xa')]);router[_0xbadd('0xb')](_0xbadd('0xc'),auth[_0xbadd('0x9')](),controller[_0xbadd('0xd')]);router[_0xbadd('0xb')](_0xbadd('0xe'),auth['isAuthenticated'](),controller[_0xbadd('0xf')]);var upload=multer({'storage':multer[_0xbadd('0x10')]({'destination':function(_0x5ca726,_0x155262,_0x1d26b3){_0x1d26b3(null,path[_0xbadd('0x11')](config[_0xbadd('0x12')],_0xbadd('0x13')));},'filename':function(_0x3dabb3,_0x1d7eff,_0x1f2637){_0x1d7eff['originalname']=_0x1d7eff['originalname'][_0xbadd('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1f2637(null,util[_0xbadd('0x15')](_0xbadd('0x16'),path[_0xbadd('0x17')](_0x1d7eff[_0xbadd('0x18')],path[_0xbadd('0x19')](_0x1d7eff[_0xbadd('0x18')])),Date['now'](),path[_0xbadd('0x19')](_0x1d7eff[_0xbadd('0x18')])));}})});router[_0xbadd('0x1a')]('/',upload[_0xbadd('0x1b')](_0xbadd('0x1c')),controller[_0xbadd('0x1d')]);router[_0xbadd('0x1e')](_0xbadd('0xc'),auth['isAuthenticated'](),controller[_0xbadd('0x1f')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xbadd('0x20')]);module[_0xbadd('0x21')]=router; \ No newline at end of file +var _0xb22a=['join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','now','post','single','file','create','put','update','delete','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download'];(function(_0x56756b,_0x3e8cc7){var _0xa3002=function(_0x5f1386){while(--_0x5f1386){_0x56756b['push'](_0x56756b['shift']());}};_0xa3002(++_0x3e8cc7);}(_0xb22a,0x1a4));var _0xab22=function(_0x324e86,_0x81b1cb){_0x324e86=_0x324e86-0x0;var _0x592846=_0xb22a[_0x324e86];return _0x592846;};'use strict';var multer=require(_0xab22('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xab22('0x1'));var express=require('express');var router=express[_0xab22('0x2')]();var fs_extra=require(_0xab22('0x3'));var auth=require(_0xab22('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xab22('0x5'));var controller=require(_0xab22('0x6'));router[_0xab22('0x7')]('/',auth[_0xab22('0x8')](),controller[_0xab22('0x9')]);router[_0xab22('0x7')](_0xab22('0xa'),auth['isAuthenticated'](),controller[_0xab22('0xb')]);router[_0xab22('0x7')](_0xab22('0xc'),auth['isAuthenticated'](),controller[_0xab22('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4e27bb,_0x1746c8,_0x4d5b36){_0x4d5b36(null,path[_0xab22('0xe')](config[_0xab22('0xf')],_0xab22('0x10')));},'filename':function(_0x5bb58c,_0x5bd412,_0x1a3ce4){_0x5bd412[_0xab22('0x11')]=_0x5bd412[_0xab22('0x11')][_0xab22('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1a3ce4(null,util[_0xab22('0x13')](_0xab22('0x14'),path['basename'](_0x5bd412[_0xab22('0x11')],path[_0xab22('0x15')](_0x5bd412[_0xab22('0x11')])),Date[_0xab22('0x16')](),path['extname'](_0x5bd412[_0xab22('0x11')])));}})});router[_0xab22('0x17')]('/',upload[_0xab22('0x18')](_0xab22('0x19')),controller[_0xab22('0x1a')]);router[_0xab22('0x1b')]('/:id',auth[_0xab22('0x8')](),controller[_0xab22('0x1c')]);router['delete'](_0xab22('0xa'),auth[_0xab22('0x8')](),controller[_0xab22('0x1d')]);module[_0xab22('0x1e')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 218358f..6e8b066 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 _0x5037=['exports','STRING','name','INTEGER','BIGINT'];(function(_0x10aedc,_0x2d6197){var _0x1fafc0=function(_0x152c75){while(--_0x152c75){_0x10aedc['push'](_0x10aedc['shift']());}};_0x1fafc0(++_0x2d6197);}(_0x5037,0x118));var _0x7503=function(_0x216d99,_0x39be4e){_0x216d99=_0x216d99-0x0;var _0x3d00e5=_0x5037[_0x216d99];return _0x3d00e5;};'use strict';var Sequelize=require('sequelize');module[_0x7503('0x0')]={'name':{'type':Sequelize[_0x7503('0x1')],'unique':_0x7503('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x7503('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x7503('0x1')]},'original_format':{'type':Sequelize[_0x7503('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x7503('0x3')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x7503('0x3')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x7503('0x4')]},'converted_channelCount':{'type':Sequelize[_0x7503('0x3')]},'converted_bitRate':{'type':Sequelize[_0x7503('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x7503('0x3')]}}; \ No newline at end of file +var _0xbcdf=['name','FLOAT','BIGINT','INTEGER','sequelize','STRING'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xbcdf,0x8e));var _0xfbcd=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0xbcdf[_0x386c3e];return _0x4b8e13;};'use strict';var Sequelize=require(_0xfbcd('0x0'));module['exports']={'name':{'type':Sequelize[_0xfbcd('0x1')],'unique':_0xfbcd('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xfbcd('0x1')]},'display_name':{'type':Sequelize[_0xfbcd('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xfbcd('0x1')]},'original_format':{'type':Sequelize[_0xfbcd('0x1')]},'original_duration':{'type':Sequelize[_0xfbcd('0x3')]},'original_sampleCount':{'type':Sequelize[_0xfbcd('0x4')]},'original_channelCount':{'type':Sequelize[_0xfbcd('0x5')]},'original_bitRate':{'type':Sequelize[_0xfbcd('0x4')]},'original_sampleRate':{'type':Sequelize[_0xfbcd('0x5')]},'converted_format':{'type':Sequelize[_0xfbcd('0x1')]},'converted_duration':{'type':Sequelize[_0xfbcd('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xfbcd('0x4')]},'converted_channelCount':{'type':Sequelize[_0xfbcd('0x5')]},'converted_bitRate':{'type':Sequelize[_0xfbcd('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 6e6893c..b4c3d4c 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 _0x26e5=['merge','type','VIRTUAL','options','Sound','includeAll','include','findAll','rows','catch','show','params','keys','find','save_name','converted_format','join','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','download','%s.%s','format','create','basename','file','originalname','filename','extname','substring','wav','root','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','chmodSync','body','role','user','UserProfileSection','Sounds','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','status','description','delete','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','end','error','name','send','index','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter'];(function(_0xa0def0,_0x739c79){var _0x295efa=function(_0x3d52c2){while(--_0x3d52c2){_0xa0def0['push'](_0xa0def0['shift']());}};_0x295efa(++_0x739c79);}(_0x26e5,0xb8));var _0x526e=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x26e5[_0x485b5a];return _0xd2b34d;};'use strict';var emlformat=require(_0x526e('0x0'));var rimraf=require(_0x526e('0x1'));var zipdir=require(_0x526e('0x2'));var jsonpatch=require(_0x526e('0x3'));var rp=require(_0x526e('0x4'));var moment=require(_0x526e('0x5'));var BPromise=require(_0x526e('0x6'));var Mustache=require(_0x526e('0x7'));var util=require(_0x526e('0x8'));var path=require(_0x526e('0x9'));var sox=require(_0x526e('0xa'));var csv=require(_0x526e('0xb'));var ejs=require(_0x526e('0xc'));var fs=require('fs');var fs_extra=require(_0x526e('0xd'));var _=require(_0x526e('0xe'));var squel=require(_0x526e('0xf'));var crypto=require('crypto');var jsforce=require(_0x526e('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x526e('0xb'));var querystring=require(_0x526e('0x11'));var Papa=require(_0x526e('0x12'));var Redis=require(_0x526e('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x526e('0x14'));var logger=require(_0x526e('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x526e('0x16'));var db=require(_0x526e('0x17'))['db'];function respondWithStatusCode(_0x26f94f,_0x45ec82){_0x45ec82=_0x45ec82||0xcc;return function(_0x49c644){if(_0x49c644){return _0x26f94f[_0x526e('0x18')](_0x45ec82);}return _0x26f94f['status'](_0x45ec82)['end']();};}function respondWithResult(_0x28ef38,_0x135ca7){_0x135ca7=_0x135ca7||0xc8;return function(_0x1372fb){if(_0x1372fb){return _0x28ef38['status'](_0x135ca7)[_0x526e('0x19')](_0x1372fb);}};}function respondWithFilteredResult(_0x5da47c,_0x32e52a){return function(_0x1c000e){if(_0x1c000e){var _0xc39cdc=typeof _0x32e52a[_0x526e('0x1a')]===_0x526e('0x1b')&&typeof _0x32e52a[_0x526e('0x1c')]===_0x526e('0x1b');var _0x3b5d01=_0x1c000e[_0x526e('0x1d')];var _0xdb4da5=_0xc39cdc?0x0:_0x32e52a[_0x526e('0x1a')];var _0x4edc8d=_0xc39cdc?_0x1c000e[_0x526e('0x1d')]:_0x32e52a['offset']+_0x32e52a['limit'];var _0x4085bd;if(_0x4edc8d>=_0x3b5d01){_0x4edc8d=_0x3b5d01;_0x4085bd=0xc8;}else{_0x4085bd=0xce;}_0x5da47c['status'](_0x4085bd);return _0x5da47c[_0x526e('0x1e')](_0x526e('0x1f'),_0xdb4da5+'-'+_0x4edc8d+'/'+_0x3b5d01)[_0x526e('0x19')](_0x1c000e);}return null;};}function patchUpdates(_0x3c3a16){return function(_0x1cfc41){try{jsonpatch[_0x526e('0x20')](_0x1cfc41,_0x3c3a16,!![]);}catch(_0x59640b){return BPromise[_0x526e('0x21')](_0x59640b);}return _0x1cfc41[_0x526e('0x22')]();};}function saveUpdates(_0x164299,_0x25d964){return function(_0x1b96c0){if(_0x1b96c0){return _0x1b96c0[_0x526e('0x23')](_0x164299)['then'](function(_0x1b2247){return _0x1b2247;});}return null;};}function removeEntity(_0x481a14,_0xcc4a86){return function(_0x2a3836){if(_0x2a3836){return _0x2a3836[_0x526e('0x24')]()[_0x526e('0x25')](function(){var _0x4d62ed=_0x2a3836[_0x526e('0x26')]({'plain':!![]});var _0x53d316='Sounds';return db[_0x526e('0x27')][_0x526e('0x24')]({'where':{'type':_0x53d316,'resourceId':_0x4d62ed['id']}})['then'](function(){return _0x2a3836;});})['then'](function(){_0x481a14['status'](0xcc)[_0x526e('0x28')]();});}};}function handleEntityNotFound(_0x11bc55,_0x2f854b){return function(_0x436dcf){if(!_0x436dcf){_0x11bc55['sendStatus'](0x194);}return _0x436dcf;};}function handleError(_0x381df9,_0xc7fa38){_0xc7fa38=_0xc7fa38||0x1f4;return function(_0x4135b0){logger[_0x526e('0x29')](_0x4135b0['stack']);if(_0x4135b0[_0x526e('0x2a')]){delete _0x4135b0['name'];}_0x381df9['status'](_0xc7fa38)[_0x526e('0x2b')](_0x4135b0);};}exports[_0x526e('0x2c')]=function(_0x1e21d3,_0x489d8f){var _0x42602c={},_0x537578={},_0xe2f293={'count':0x0,'rows':[]};var _0x57ddca=_['map'](db['Sound'][_0x526e('0x2d')],function(_0x47cc7d){return{'name':_0x47cc7d[_0x526e('0x2e')],'type':_0x47cc7d['type']['key']};});_0x537578['model']=_['map'](_0x57ddca,_0x526e('0x2a'));_0x537578[_0x526e('0x2f')]=_['keys'](_0x1e21d3['query']);_0x537578[_0x526e('0x30')]=_[_0x526e('0x31')](_0x537578[_0x526e('0x32')],_0x537578['query']);_0x42602c[_0x526e('0x33')]=_[_0x526e('0x31')](_0x537578[_0x526e('0x32')],qs[_0x526e('0x34')](_0x1e21d3[_0x526e('0x2f')][_0x526e('0x34')]));_0x42602c[_0x526e('0x33')]=_0x42602c[_0x526e('0x33')][_0x526e('0x35')]?_0x42602c[_0x526e('0x33')]:_0x537578[_0x526e('0x32')];if(!_0x1e21d3['query'][_0x526e('0x36')]('nolimit')){_0x42602c[_0x526e('0x1c')]=qs[_0x526e('0x1c')](_0x1e21d3[_0x526e('0x2f')]['limit']);_0x42602c['offset']=qs[_0x526e('0x1a')](_0x1e21d3[_0x526e('0x2f')][_0x526e('0x1a')]);}_0x42602c[_0x526e('0x37')]=qs[_0x526e('0x38')](_0x1e21d3[_0x526e('0x2f')][_0x526e('0x38')]);_0x42602c[_0x526e('0x39')]=qs[_0x526e('0x30')](_[_0x526e('0x3a')](_0x1e21d3['query'],_0x537578[_0x526e('0x30')]),_0x57ddca);if(_0x1e21d3[_0x526e('0x2f')][_0x526e('0x3b')]){_0x42602c['where']=_[_0x526e('0x3c')](_0x42602c[_0x526e('0x39')],{'$or':_['map'](_0x57ddca,function(_0x5374e2){if(_0x5374e2[_0x526e('0x3d')]!==_0x526e('0x3e')){var _0x107abf={};_0x107abf[_0x5374e2[_0x526e('0x2a')]]={'$like':'%'+_0x1e21d3['query']['filter']+'%'};return _0x107abf;}})});}_0x42602c=_[_0x526e('0x3c')]({},_0x42602c,_0x1e21d3[_0x526e('0x3f')]);var _0x3c5899={'where':_0x42602c[_0x526e('0x39')]};return db[_0x526e('0x40')][_0x526e('0x1d')](_0x3c5899)['then'](function(_0x49c1d6){_0xe2f293[_0x526e('0x1d')]=_0x49c1d6;if(_0x1e21d3[_0x526e('0x2f')][_0x526e('0x41')]){_0x42602c[_0x526e('0x42')]=[{'all':!![]}];}return db[_0x526e('0x40')][_0x526e('0x43')](_0x42602c);})[_0x526e('0x25')](function(_0x1aaf1e){_0xe2f293[_0x526e('0x44')]=_0x1aaf1e;return _0xe2f293;})[_0x526e('0x25')](respondWithFilteredResult(_0x489d8f,_0x42602c))[_0x526e('0x45')](handleError(_0x489d8f,null));};exports[_0x526e('0x46')]=function(_0x5e8f1d,_0x56e459){var _0x328669={'raw':!![],'where':{'id':_0x5e8f1d[_0x526e('0x47')]['id']}},_0x177672={};_0x177672[_0x526e('0x32')]=_[_0x526e('0x48')](db['Sound'][_0x526e('0x2d')]);_0x177672['query']=_[_0x526e('0x48')](_0x5e8f1d[_0x526e('0x2f')]);_0x177672['filters']=_[_0x526e('0x31')](_0x177672[_0x526e('0x32')],_0x177672[_0x526e('0x2f')]);_0x328669[_0x526e('0x33')]=_[_0x526e('0x31')](_0x177672['model'],qs[_0x526e('0x34')](_0x5e8f1d[_0x526e('0x2f')][_0x526e('0x34')]));_0x328669['attributes']=_0x328669['attributes'][_0x526e('0x35')]?_0x328669[_0x526e('0x33')]:_0x177672[_0x526e('0x32')];if(_0x5e8f1d['query']['includeAll']){_0x328669[_0x526e('0x42')]=[{'all':!![]}];}_0x328669=_[_0x526e('0x3c')]({},_0x328669,_0x5e8f1d['options']);return db[_0x526e('0x40')][_0x526e('0x49')](_0x328669)[_0x526e('0x25')](handleEntityNotFound(_0x56e459,null))['then'](respondWithResult(_0x56e459,null))['catch'](handleError(_0x56e459,null));};exports['download']=function(_0x3bd5e9,_0x64edc1,_0x4824a1){return db[_0x526e('0x40')][_0x526e('0x49')]({'where':{'id':_0x3bd5e9[_0x526e('0x47')]['id']},'attributes':[_0x526e('0x2a'),_0x526e('0x4a'),_0x526e('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x64edc1,null))[_0x526e('0x25')](function(_0x1d7176){if(_0x1d7176){if(!fs['existsSync'](path[_0x526e('0x4c')](config['root'],_0x526e('0x4d'),_0x1d7176[_0x526e('0x4a')]+'.'+_0x1d7176[_0x526e('0x4b')]))){throw new db[(_0x526e('0x4e'))][(_0x526e('0x4f'))](_0x526e('0x50'));}return _0x64edc1[_0x526e('0x51')](path[_0x526e('0x4c')](config['root'],'server/files/sounds/converted',util['format'](_0x526e('0x52'),_0x1d7176[_0x526e('0x4a')],_0x1d7176[_0x526e('0x4b')])),util[_0x526e('0x53')]('%s.%s',_0x1d7176['name'],_0x1d7176['converted_format']));}return null;})[_0x526e('0x45')](handleError(_0x64edc1,null));};exports[_0x526e('0x54')]=function(_0x3d6681,_0x96fe65,_0xa5d13b){var _0x20167d={'name':path[_0x526e('0x55')](_0x3d6681[_0x526e('0x56')][_0x526e('0x57')],path['extname'](_0x3d6681[_0x526e('0x56')]['originalname'])),'save_name':path[_0x526e('0x55')](_0x3d6681[_0x526e('0x56')][_0x526e('0x58')],path[_0x526e('0x59')](_0x3d6681['file'][_0x526e('0x58')])),'original_format':path[_0x526e('0x59')](_0x3d6681[_0x526e('0x56')][_0x526e('0x57')])[_0x526e('0x5a')](0x1),'converted_format':_0x526e('0x5b')};var _0x1c8d46=path[_0x526e('0x4c')](config[_0x526e('0x5c')],_0x526e('0x5d'),_0x3d6681[_0x526e('0x56')]['filename']);var _0x1adcb8=path['join'](config['root'],'server/files/sounds/converted',util[_0x526e('0x53')]('%s.%s',path[_0x526e('0x55')](_0x3d6681[_0x526e('0x56')][_0x526e('0x58')],path['extname'](_0x3d6681[_0x526e('0x56')]['filename'])),_0x20167d[_0x526e('0x4b')]));logger[_0x526e('0x5e')](_0x526e('0x5f'),_0x1c8d46);logger[_0x526e('0x5e')](_0x526e('0x60'),_0x1adcb8);try{fs['chmodSync'](_0x1c8d46,parseInt(_0x526e('0x61'),0x8));var _0x12be77=sox['transcode'](_0x1c8d46,_0x1adcb8,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x12be77['on']('error',function(_0x238943){fs[_0x526e('0x62')](_0x1c8d46);_0x96fe65['status'](0x1f4)['send'](_0x238943);});_0x12be77['on']('src',function(_0x76ce59){_0x20167d[_0x526e('0x63')]=isNaN(_0x76ce59[_0x526e('0x64')])?null:_0x76ce59['duration']*0x3e8;_0x20167d[_0x526e('0x65')]=isNaN(_0x76ce59[_0x526e('0x66')])?null:_0x76ce59[_0x526e('0x66')];_0x20167d[_0x526e('0x67')]=isNaN(_0x76ce59[_0x526e('0x68')])?null:_0x76ce59[_0x526e('0x68')];_0x20167d['original_bitRate']=isNaN(_0x76ce59[_0x526e('0x69')])?null:_0x76ce59['bitRate'];_0x20167d[_0x526e('0x6a')]=isNaN(_0x76ce59[_0x526e('0x6b')])?null:_0x76ce59[_0x526e('0x6b')];});_0x12be77['on']('dest',function(_0xc05f2f){_0x20167d[_0x526e('0x6c')]=isNaN(_0xc05f2f[_0x526e('0x64')])?null:_0xc05f2f[_0x526e('0x64')]*0x3e8;_0x20167d[_0x526e('0x6d')]=isNaN(_0xc05f2f['sampleCount'])?null:_0xc05f2f[_0x526e('0x66')];_0x20167d[_0x526e('0x6e')]=isNaN(_0xc05f2f['channelCount'])?null:_0xc05f2f[_0x526e('0x68')];_0x20167d[_0x526e('0x6f')]=isNaN(_0xc05f2f['bitRate'])?null:_0xc05f2f[_0x526e('0x69')];_0x20167d['converted_sampleRate']=isNaN(_0xc05f2f[_0x526e('0x6b')])?null:_0xc05f2f['sampleRate'];});_0x12be77['on']('end',function(){fs[_0x526e('0x70')](_0x1adcb8,parseInt(_0x526e('0x61'),0x8));return db[_0x526e('0x40')][_0x526e('0x54')](_0x20167d)['then'](function(_0x2b73ec){var _0x53e864={'role':_0x3d6681[_0x526e('0x71')][_0x526e('0x72')],'userProfileId':_0x3d6681[_0x526e('0x71')]['userProfileId']};if(!_0x53e864)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x53e864[_0x526e('0x72')]===_0x526e('0x73')){var _0x4e314b=_0x2b73ec[_0x526e('0x26')]({'plain':!![]});return db[_0x526e('0x74')][_0x526e('0x49')]({'where':{'name':_0x526e('0x75'),'userProfileId':_0x53e864['userProfileId']},'raw':!![]})[_0x526e('0x25')](function(_0xd2ac02){if(_0xd2ac02&&_0xd2ac02['autoAssociation']===0x0){return db['UserProfileResource'][_0x526e('0x54')]({'name':_0x4e314b[_0x526e('0x2a')],'resourceId':_0x4e314b['id'],'type':_0xd2ac02['name'],'sectionId':_0xd2ac02['id']},{})[_0x526e('0x25')](function(){return _0x2b73ec;});}else{return _0x2b73ec;}})['catch'](function(_0x3cddfb){logger[_0x526e('0x29')](_0x526e('0x76'),_0x3cddfb);throw _0x3cddfb;});}return _0x2b73ec;})['then'](respondWithResult(_0x96fe65,null))[_0x526e('0x45')](handleError(_0x96fe65,null));});_0x12be77['start']();}catch(_0x12cc6a){_0x96fe65[_0x526e('0x77')](0x1f4)['send'](_0x12cc6a);}};exports[_0x526e('0x23')]=function(_0x55c32e,_0x2d8576,_0x41462d){return db['Sound'][_0x526e('0x49')]({'where':{'id':_0x55c32e[_0x526e('0x47')]['id']}})['then'](handleEntityNotFound(_0x2d8576,null))[_0x526e('0x25')](saveUpdates(_[_0x526e('0x3a')](_0x55c32e[_0x526e('0x71')],[_0x526e('0x2a'),_0x526e('0x78')]),null))[_0x526e('0x25')](respondWithResult(_0x2d8576,null))[_0x526e('0x45')](handleError(_0x2d8576,null));};exports[_0x526e('0x79')]=function(_0x4ac018,_0x5ba5da,_0xa70b39){return db[_0x526e('0x40')][_0x526e('0x49')]({'where':{'id':_0x4ac018['params']['id']}})[_0x526e('0x25')](function(_0xeb5f3){if(_0xeb5f3){return _0xeb5f3['destroy']();}})[_0x526e('0x25')](function(_0x47d5e7){var _0x1bcf7a=path[_0x526e('0x4c')](config[_0x526e('0x5c')],_0x526e('0x5d'),util[_0x526e('0x53')](_0x526e('0x52'),_0x47d5e7['save_name'],_0x47d5e7['original_format']));var _0x1d7990=path[_0x526e('0x4c')](config[_0x526e('0x5c')],'server/files/sounds/converted',util[_0x526e('0x53')](_0x526e('0x52'),_0x47d5e7[_0x526e('0x4a')],_0x47d5e7[_0x526e('0x4b')]));fs['unlinkSync'](_0x1bcf7a);fs[_0x526e('0x62')](_0x1d7990);return _0x47d5e7;})[_0x526e('0x25')](function(_0x33c366){if(_0x33c366){return _0x5ba5da[_0x526e('0x77')](0xcc)[_0x526e('0x28')]();}})[_0x526e('0x25')](handleEntityNotFound(_0x5ba5da,null))['catch'](handleError(_0x5ba5da,null));}; \ No newline at end of file +var _0xae88=['delete','original_format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','get','Sounds','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Sound','includeAll','findAll','rows','catch','show','keys','include','find','download','params','save_name','existsSync','join','server/files/sounds/converted','Sequelize','ValidationError','root','format','%s.%s','converted_format','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','create','body','role','userProfileId','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description'];(function(_0x5d37cb,_0x58c4b5){var _0x4354bb=function(_0x4a473a){while(--_0x4a473a){_0x5d37cb['push'](_0x5d37cb['shift']());}};_0x4354bb(++_0x58c4b5);}(_0xae88,0x106));var _0x8ae8=function(_0x17ac69,_0x2a019f){_0x17ac69=_0x17ac69-0x0;var _0x489611=_0xae88[_0x17ac69];return _0x489611;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ae8('0x0'));var zipdir=require(_0x8ae8('0x1'));var jsonpatch=require(_0x8ae8('0x2'));var rp=require(_0x8ae8('0x3'));var moment=require(_0x8ae8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8ae8('0x5'));var util=require(_0x8ae8('0x6'));var path=require(_0x8ae8('0x7'));var sox=require('sox');var csv=require(_0x8ae8('0x8'));var ejs=require(_0x8ae8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8ae8('0xa'));var squel=require('squel');var crypto=require(_0x8ae8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8ae8('0xc'));var toCsv=require(_0x8ae8('0x8'));var querystring=require(_0x8ae8('0xd'));var Papa=require(_0x8ae8('0xe'));var Redis=require(_0x8ae8('0xf'));var authService=require(_0x8ae8('0x10'));var qs=require(_0x8ae8('0x11'));var as=require(_0x8ae8('0x12'));var hardwareService=require(_0x8ae8('0x13'));var logger=require(_0x8ae8('0x14'))(_0x8ae8('0x15'));var utils=require('../../config/utils');var config=require(_0x8ae8('0x16'));var licenseUtil=require(_0x8ae8('0x17'));var db=require(_0x8ae8('0x18'))['db'];function respondWithStatusCode(_0xd87337,_0x3f46ec){_0x3f46ec=_0x3f46ec||0xcc;return function(_0x505394){if(_0x505394){return _0xd87337[_0x8ae8('0x19')](_0x3f46ec);}return _0xd87337[_0x8ae8('0x1a')](_0x3f46ec)['end']();};}function respondWithResult(_0x783729,_0x5f21a7){_0x5f21a7=_0x5f21a7||0xc8;return function(_0x44cad7){if(_0x44cad7){return _0x783729[_0x8ae8('0x1a')](_0x5f21a7)['json'](_0x44cad7);}};}function respondWithFilteredResult(_0xacb487,_0x4bf0bc){return function(_0x186899){if(_0x186899){var _0x8aa40e=typeof _0x4bf0bc[_0x8ae8('0x1b')]===_0x8ae8('0x1c')&&typeof _0x4bf0bc[_0x8ae8('0x1d')]===_0x8ae8('0x1c');var _0x7ccbae=_0x186899[_0x8ae8('0x1e')];var _0x498de7=_0x8aa40e?0x0:_0x4bf0bc[_0x8ae8('0x1b')];var _0x182110=_0x8aa40e?_0x186899['count']:_0x4bf0bc[_0x8ae8('0x1b')]+_0x4bf0bc[_0x8ae8('0x1d')];var _0x2016e5;if(_0x182110>=_0x7ccbae){_0x182110=_0x7ccbae;_0x2016e5=0xc8;}else{_0x2016e5=0xce;}_0xacb487[_0x8ae8('0x1a')](_0x2016e5);return _0xacb487[_0x8ae8('0x1f')](_0x8ae8('0x20'),_0x498de7+'-'+_0x182110+'/'+_0x7ccbae)[_0x8ae8('0x21')](_0x186899);}return null;};}function patchUpdates(_0x1ca2b8){return function(_0x106cd5){try{jsonpatch['apply'](_0x106cd5,_0x1ca2b8,!![]);}catch(_0x4cebc9){return BPromise[_0x8ae8('0x22')](_0x4cebc9);}return _0x106cd5[_0x8ae8('0x23')]();};}function saveUpdates(_0x4d197d,_0x3dfb1a){return function(_0x1a9dd5){if(_0x1a9dd5){return _0x1a9dd5[_0x8ae8('0x24')](_0x4d197d)[_0x8ae8('0x25')](function(_0x3ecee9){return _0x3ecee9;});}return null;};}function removeEntity(_0x1bd72a,_0x5f57a3){return function(_0x4fea51){if(_0x4fea51){return _0x4fea51[_0x8ae8('0x26')]()['then'](function(){var _0x2cdc01=_0x4fea51[_0x8ae8('0x27')]({'plain':!![]});var _0x339aaa=_0x8ae8('0x28');return db['UserProfileResource'][_0x8ae8('0x26')]({'where':{'type':_0x339aaa,'resourceId':_0x2cdc01['id']}})['then'](function(){return _0x4fea51;});})['then'](function(){_0x1bd72a['status'](0xcc)[_0x8ae8('0x29')]();});}};}function handleEntityNotFound(_0x29efd2,_0x41cbe3){return function(_0x281597){if(!_0x281597){_0x29efd2[_0x8ae8('0x19')](0x194);}return _0x281597;};}function handleError(_0x2d9942,_0x3b9d41){_0x3b9d41=_0x3b9d41||0x1f4;return function(_0x52eddf){logger[_0x8ae8('0x2a')](_0x52eddf[_0x8ae8('0x2b')]);if(_0x52eddf[_0x8ae8('0x2c')]){delete _0x52eddf[_0x8ae8('0x2c')];}_0x2d9942['status'](_0x3b9d41)[_0x8ae8('0x2d')](_0x52eddf);};}exports[_0x8ae8('0x2e')]=function(_0x249ff7,_0x1f61f7){var _0x5dad67={},_0x1d0106={},_0x1368be={'count':0x0,'rows':[]};var _0x5eb23d=_[_0x8ae8('0x2f')](db['Sound'][_0x8ae8('0x30')],function(_0x11c5aa){return{'name':_0x11c5aa[_0x8ae8('0x31')],'type':_0x11c5aa[_0x8ae8('0x32')][_0x8ae8('0x33')]};});_0x1d0106[_0x8ae8('0x34')]=_['map'](_0x5eb23d,'name');_0x1d0106['query']=_['keys'](_0x249ff7[_0x8ae8('0x35')]);_0x1d0106[_0x8ae8('0x36')]=_['intersection'](_0x1d0106[_0x8ae8('0x34')],_0x1d0106[_0x8ae8('0x35')]);_0x5dad67['attributes']=_[_0x8ae8('0x37')](_0x1d0106['model'],qs[_0x8ae8('0x38')](_0x249ff7[_0x8ae8('0x35')]['fields']));_0x5dad67['attributes']=_0x5dad67[_0x8ae8('0x39')][_0x8ae8('0x3a')]?_0x5dad67[_0x8ae8('0x39')]:_0x1d0106[_0x8ae8('0x34')];if(!_0x249ff7[_0x8ae8('0x35')][_0x8ae8('0x3b')](_0x8ae8('0x3c'))){_0x5dad67[_0x8ae8('0x1d')]=qs[_0x8ae8('0x1d')](_0x249ff7['query'][_0x8ae8('0x1d')]);_0x5dad67[_0x8ae8('0x1b')]=qs[_0x8ae8('0x1b')](_0x249ff7['query'][_0x8ae8('0x1b')]);}_0x5dad67[_0x8ae8('0x3d')]=qs[_0x8ae8('0x3e')](_0x249ff7[_0x8ae8('0x35')]['sort']);_0x5dad67[_0x8ae8('0x3f')]=qs[_0x8ae8('0x36')](_['pick'](_0x249ff7[_0x8ae8('0x35')],_0x1d0106['filters']),_0x5eb23d);if(_0x249ff7['query'][_0x8ae8('0x40')]){_0x5dad67[_0x8ae8('0x3f')]=_[_0x8ae8('0x41')](_0x5dad67[_0x8ae8('0x3f')],{'$or':_['map'](_0x5eb23d,function(_0x3abf4c){if(_0x3abf4c[_0x8ae8('0x32')]!==_0x8ae8('0x42')){var _0x1e6810={};_0x1e6810[_0x3abf4c['name']]={'$like':'%'+_0x249ff7[_0x8ae8('0x35')][_0x8ae8('0x40')]+'%'};return _0x1e6810;}})});}_0x5dad67=_[_0x8ae8('0x41')]({},_0x5dad67,_0x249ff7[_0x8ae8('0x43')]);var _0x4fabea={'where':_0x5dad67[_0x8ae8('0x3f')]};return db[_0x8ae8('0x44')]['count'](_0x4fabea)[_0x8ae8('0x25')](function(_0x465ae8){_0x1368be[_0x8ae8('0x1e')]=_0x465ae8;if(_0x249ff7[_0x8ae8('0x35')][_0x8ae8('0x45')]){_0x5dad67['include']=[{'all':!![]}];}return db['Sound'][_0x8ae8('0x46')](_0x5dad67);})['then'](function(_0xbf051){_0x1368be[_0x8ae8('0x47')]=_0xbf051;return _0x1368be;})[_0x8ae8('0x25')](respondWithFilteredResult(_0x1f61f7,_0x5dad67))[_0x8ae8('0x48')](handleError(_0x1f61f7,null));};exports[_0x8ae8('0x49')]=function(_0x1f40b4,_0x4231e8){var _0x4f3ad9={'raw':!![],'where':{'id':_0x1f40b4['params']['id']}},_0xe7461c={};_0xe7461c['model']=_[_0x8ae8('0x4a')](db[_0x8ae8('0x44')]['rawAttributes']);_0xe7461c[_0x8ae8('0x35')]=_[_0x8ae8('0x4a')](_0x1f40b4['query']);_0xe7461c['filters']=_[_0x8ae8('0x37')](_0xe7461c[_0x8ae8('0x34')],_0xe7461c['query']);_0x4f3ad9[_0x8ae8('0x39')]=_[_0x8ae8('0x37')](_0xe7461c[_0x8ae8('0x34')],qs[_0x8ae8('0x38')](_0x1f40b4[_0x8ae8('0x35')][_0x8ae8('0x38')]));_0x4f3ad9['attributes']=_0x4f3ad9[_0x8ae8('0x39')]['length']?_0x4f3ad9[_0x8ae8('0x39')]:_0xe7461c[_0x8ae8('0x34')];if(_0x1f40b4[_0x8ae8('0x35')][_0x8ae8('0x45')]){_0x4f3ad9[_0x8ae8('0x4b')]=[{'all':!![]}];}_0x4f3ad9=_[_0x8ae8('0x41')]({},_0x4f3ad9,_0x1f40b4[_0x8ae8('0x43')]);return db[_0x8ae8('0x44')][_0x8ae8('0x4c')](_0x4f3ad9)[_0x8ae8('0x25')](handleEntityNotFound(_0x4231e8,null))[_0x8ae8('0x25')](respondWithResult(_0x4231e8,null))[_0x8ae8('0x48')](handleError(_0x4231e8,null));};exports[_0x8ae8('0x4d')]=function(_0x4df51b,_0x21ef88,_0x7fdd88){return db[_0x8ae8('0x44')][_0x8ae8('0x4c')]({'where':{'id':_0x4df51b[_0x8ae8('0x4e')]['id']},'attributes':['name',_0x8ae8('0x4f'),'converted_format'],'raw':!![]})[_0x8ae8('0x25')](handleEntityNotFound(_0x21ef88,null))['then'](function(_0xe2924a){if(_0xe2924a){if(!fs[_0x8ae8('0x50')](path[_0x8ae8('0x51')](config['root'],_0x8ae8('0x52'),_0xe2924a[_0x8ae8('0x4f')]+'.'+_0xe2924a['converted_format']))){throw new db[(_0x8ae8('0x53'))][(_0x8ae8('0x54'))]('Sound\x20not\x20found');}return _0x21ef88[_0x8ae8('0x4d')](path[_0x8ae8('0x51')](config[_0x8ae8('0x55')],'server/files/sounds/converted',util[_0x8ae8('0x56')](_0x8ae8('0x57'),_0xe2924a[_0x8ae8('0x4f')],_0xe2924a[_0x8ae8('0x58')])),util['format'](_0x8ae8('0x57'),_0xe2924a['name'],_0xe2924a['converted_format']));}return null;})[_0x8ae8('0x48')](handleError(_0x21ef88,null));};exports['create']=function(_0x314f41,_0x249311,_0x37f2f2){var _0x166597={'name':path[_0x8ae8('0x59')](_0x314f41[_0x8ae8('0x5a')][_0x8ae8('0x5b')],path[_0x8ae8('0x5c')](_0x314f41[_0x8ae8('0x5a')]['originalname'])),'save_name':path[_0x8ae8('0x59')](_0x314f41[_0x8ae8('0x5a')][_0x8ae8('0x5d')],path[_0x8ae8('0x5c')](_0x314f41[_0x8ae8('0x5a')][_0x8ae8('0x5d')])),'original_format':path[_0x8ae8('0x5c')](_0x314f41[_0x8ae8('0x5a')][_0x8ae8('0x5b')])[_0x8ae8('0x5e')](0x1),'converted_format':_0x8ae8('0x5f')};var _0x579bff=path['join'](config[_0x8ae8('0x55')],_0x8ae8('0x60'),_0x314f41[_0x8ae8('0x5a')][_0x8ae8('0x5d')]);var _0x4a5fb4=path[_0x8ae8('0x51')](config[_0x8ae8('0x55')],_0x8ae8('0x52'),util[_0x8ae8('0x56')](_0x8ae8('0x57'),path[_0x8ae8('0x59')](_0x314f41[_0x8ae8('0x5a')][_0x8ae8('0x5d')],path[_0x8ae8('0x5c')](_0x314f41[_0x8ae8('0x5a')]['filename'])),_0x166597['converted_format']));logger[_0x8ae8('0x61')](_0x8ae8('0x62'),_0x579bff);logger[_0x8ae8('0x61')]('Sound\x20upload\x20destination:\x20%s',_0x4a5fb4);try{fs[_0x8ae8('0x63')](_0x579bff,parseInt(_0x8ae8('0x64'),0x8));var _0x1c9cea=sox[_0x8ae8('0x65')](_0x579bff,_0x4a5fb4,{'sampleRate':0x1f40,'format':_0x8ae8('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1c9cea['on']('error',function(_0x5bac32){fs[_0x8ae8('0x66')](_0x579bff);_0x249311[_0x8ae8('0x1a')](0x1f4)[_0x8ae8('0x2d')](_0x5bac32);});_0x1c9cea['on'](_0x8ae8('0x67'),function(_0x20f3e0){_0x166597[_0x8ae8('0x68')]=isNaN(_0x20f3e0[_0x8ae8('0x69')])?null:_0x20f3e0[_0x8ae8('0x69')]*0x3e8;_0x166597[_0x8ae8('0x6a')]=isNaN(_0x20f3e0['sampleCount'])?null:_0x20f3e0[_0x8ae8('0x6b')];_0x166597[_0x8ae8('0x6c')]=isNaN(_0x20f3e0['channelCount'])?null:_0x20f3e0[_0x8ae8('0x6d')];_0x166597[_0x8ae8('0x6e')]=isNaN(_0x20f3e0['bitRate'])?null:_0x20f3e0[_0x8ae8('0x6f')];_0x166597['original_sampleRate']=isNaN(_0x20f3e0[_0x8ae8('0x70')])?null:_0x20f3e0[_0x8ae8('0x70')];});_0x1c9cea['on'](_0x8ae8('0x71'),function(_0x5be9b0){_0x166597[_0x8ae8('0x72')]=isNaN(_0x5be9b0[_0x8ae8('0x69')])?null:_0x5be9b0['duration']*0x3e8;_0x166597[_0x8ae8('0x73')]=isNaN(_0x5be9b0[_0x8ae8('0x6b')])?null:_0x5be9b0[_0x8ae8('0x6b')];_0x166597[_0x8ae8('0x74')]=isNaN(_0x5be9b0[_0x8ae8('0x6d')])?null:_0x5be9b0['channelCount'];_0x166597[_0x8ae8('0x75')]=isNaN(_0x5be9b0[_0x8ae8('0x6f')])?null:_0x5be9b0[_0x8ae8('0x6f')];_0x166597[_0x8ae8('0x76')]=isNaN(_0x5be9b0['sampleRate'])?null:_0x5be9b0[_0x8ae8('0x70')];});_0x1c9cea['on']('end',function(){fs[_0x8ae8('0x63')](_0x4a5fb4,parseInt(_0x8ae8('0x64'),0x8));return db['Sound'][_0x8ae8('0x77')](_0x166597)[_0x8ae8('0x25')](function(_0x1eed75){var _0x1de53e={'role':_0x314f41[_0x8ae8('0x78')][_0x8ae8('0x79')],'userProfileId':_0x314f41[_0x8ae8('0x78')][_0x8ae8('0x7a')]};if(!_0x1de53e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1de53e['role']===_0x8ae8('0x7b')){var _0x2e119b=_0x1eed75[_0x8ae8('0x27')]({'plain':!![]});return db['UserProfileSection'][_0x8ae8('0x4c')]({'where':{'name':_0x8ae8('0x28'),'userProfileId':_0x1de53e[_0x8ae8('0x7a')]},'raw':!![]})[_0x8ae8('0x25')](function(_0x2554ab){if(_0x2554ab&&_0x2554ab['autoAssociation']===0x0){return db['UserProfileResource'][_0x8ae8('0x77')]({'name':_0x2e119b[_0x8ae8('0x2c')],'resourceId':_0x2e119b['id'],'type':_0x2554ab[_0x8ae8('0x2c')],'sectionId':_0x2554ab['id']},{})[_0x8ae8('0x25')](function(){return _0x1eed75;});}else{return _0x1eed75;}})['catch'](function(_0x3b8404){logger[_0x8ae8('0x2a')](_0x8ae8('0x7c'),_0x3b8404);throw _0x3b8404;});}return _0x1eed75;})['then'](respondWithResult(_0x249311,null))[_0x8ae8('0x48')](handleError(_0x249311,null));});_0x1c9cea[_0x8ae8('0x7d')]();}catch(_0x2ca9d2){_0x249311['status'](0x1f4)[_0x8ae8('0x2d')](_0x2ca9d2);}};exports['update']=function(_0x2a70d7,_0x116831,_0x287082){return db[_0x8ae8('0x44')][_0x8ae8('0x4c')]({'where':{'id':_0x2a70d7[_0x8ae8('0x4e')]['id']}})[_0x8ae8('0x25')](handleEntityNotFound(_0x116831,null))[_0x8ae8('0x25')](saveUpdates(_[_0x8ae8('0x7e')](_0x2a70d7[_0x8ae8('0x78')],['name',_0x8ae8('0x7f')]),null))[_0x8ae8('0x25')](respondWithResult(_0x116831,null))[_0x8ae8('0x48')](handleError(_0x116831,null));};exports[_0x8ae8('0x80')]=function(_0x232128,_0x3fb4ea,_0x4117e4){return db['Sound']['find']({'where':{'id':_0x232128[_0x8ae8('0x4e')]['id']}})[_0x8ae8('0x25')](function(_0xc1b1b4){if(_0xc1b1b4){return _0xc1b1b4[_0x8ae8('0x26')]();}})[_0x8ae8('0x25')](function(_0x5c90b4){var _0x5ceaab=path['join'](config[_0x8ae8('0x55')],'server/files/sounds/original',util['format'](_0x8ae8('0x57'),_0x5c90b4[_0x8ae8('0x4f')],_0x5c90b4[_0x8ae8('0x81')]));var _0x54d9ea=path[_0x8ae8('0x51')](config[_0x8ae8('0x55')],'server/files/sounds/converted',util[_0x8ae8('0x56')](_0x8ae8('0x57'),_0x5c90b4[_0x8ae8('0x4f')],_0x5c90b4[_0x8ae8('0x58')]));fs['unlinkSync'](_0x5ceaab);fs['unlinkSync'](_0x54d9ea);return _0x5c90b4;})[_0x8ae8('0x25')](function(_0x35f9fa){if(_0x35f9fa){return _0x3fb4ea['status'](0xcc)[_0x8ae8('0x29')]();}})[_0x8ae8('0x25')](handleEntityNotFound(_0x3fb4ea,null))[_0x8ae8('0x48')](handleError(_0x3fb4ea,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 3f9fb11..ee1ff5f 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 _0xde01=['request-promise','path','../../config/environment','./sound.attributes','exports','define','Sound','lodash','util','../../config/logger','api','bluebird'];(function(_0x3956f4,_0x5d72d8){var _0x4d48f5=function(_0x12ed02){while(--_0x12ed02){_0x3956f4['push'](_0x3956f4['shift']());}};_0x4d48f5(++_0x5d72d8);}(_0xde01,0x157));var _0x1de0=function(_0x1b19c2,_0x46f4f7){_0x1b19c2=_0x1b19c2-0x0;var _0x4e02cc=_0xde01[_0x1b19c2];return _0x4e02cc;};'use strict';var _=require(_0x1de0('0x0'));var util=require(_0x1de0('0x1'));var logger=require(_0x1de0('0x2'))(_0x1de0('0x3'));var moment=require('moment');var BPromise=require(_0x1de0('0x4'));var rp=require(_0x1de0('0x5'));var fs=require('fs');var path=require(_0x1de0('0x6'));var rimraf=require('rimraf');var config=require(_0x1de0('0x7'));var attributes=require(_0x1de0('0x8'));module[_0x1de0('0x9')]=function(_0x1f6136,_0xefdd25){return _0x1f6136[_0x1de0('0xa')](_0x1de0('0xb'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4bf=['./sound.attributes','exports','define','tools_sounds','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment'];(function(_0x469947,_0x4f4db9){var _0x104e09=function(_0x1f5e9f){while(--_0x1f5e9f){_0x469947['push'](_0x469947['shift']());}};_0x104e09(++_0x4f4db9);}(_0xf4bf,0x1d2));var _0xff4b=function(_0x4bc428,_0xf56dd9){_0x4bc428=_0x4bc428-0x0;var _0x3ca37f=_0xf4bf[_0x4bc428];return _0x3ca37f;};'use strict';var _=require(_0xff4b('0x0'));var util=require(_0xff4b('0x1'));var logger=require(_0xff4b('0x2'))('api');var moment=require(_0xff4b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xff4b('0x4'));var rimraf=require(_0xff4b('0x5'));var config=require(_0xff4b('0x6'));var attributes=require(_0xff4b('0x7'));module[_0xff4b('0x8')]=function(_0x16b2bb,_0x35cbe4){return _0x16b2bb[_0xff4b('0x9')]('Sound',attributes,{'tableName':_0xff4b('0xa'),'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 650fc69..61058f0 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 _0x0be1=['request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','find','options','raw','where','attributes','include','map','model','debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Sound,\x20%s,\x20%s'];(function(_0x4d7c80,_0x2af89b){var _0x24fcb6=function(_0x3cc104){while(--_0x3cc104){_0x4d7c80['push'](_0x4d7c80['shift']());}};_0x24fcb6(++_0x2af89b);}(_0x0be1,0x186));var _0x10be=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x0be1[_0x5a95fa];return _0x1a61b8;};'use strict';var _=require(_0x10be('0x0'));var util=require('util');var moment=require(_0x10be('0x1'));var BPromise=require(_0x10be('0x2'));var rs=require(_0x10be('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x10be('0x4'))['db'];var utils=require(_0x10be('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x10be('0x6'));var jayson=require(_0x10be('0x7'));var client=jayson[_0x10be('0x8')][_0x10be('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ebba8,_0x58350b,_0x1ca1ea){return new BPromise(function(_0x3202a8,_0x3002cd){return client['request'](_0x5ebba8,_0x1ca1ea)[_0x10be('0xa')](function(_0x16bc76){logger[_0x10be('0xb')](_0x10be('0xc'),_0x58350b,_0x10be('0xd'));logger['debug'](_0x10be('0xe'),_0x58350b,_0x10be('0xd'),JSON[_0x10be('0xf')](_0x16bc76));if(_0x16bc76['error']){if(_0x16bc76[_0x10be('0x10')][_0x10be('0x11')]===0x1f4){logger[_0x10be('0x10')](_0x10be('0xc'),_0x58350b,_0x16bc76['error'][_0x10be('0x12')]);return _0x3002cd(_0x16bc76[_0x10be('0x10')][_0x10be('0x12')]);}logger[_0x10be('0x10')](_0x10be('0xc'),_0x58350b,_0x16bc76[_0x10be('0x10')][_0x10be('0x12')]);return _0x3202a8(_0x16bc76['error'][_0x10be('0x12')]);}else{logger[_0x10be('0xb')](_0x10be('0xc'),_0x58350b,'request\x20sent');_0x3202a8(_0x16bc76[_0x10be('0x13')]['message']);}})[_0x10be('0x14')](function(_0x35b439){logger['error'](_0x10be('0xc'),_0x58350b,_0x35b439);_0x3002cd(_0x35b439);});});}exports[_0x10be('0x15')]=function(_0x1ad749){var _0xda6c1b=this;return new Promise(function(_0x2460f7,_0x46177c){return db['Sound'][_0x10be('0x16')]({'raw':_0x1ad749[_0x10be('0x17')]?_0x1ad749[_0x10be('0x17')][_0x10be('0x18')]===undefined?!![]:![]:!![],'where':_0x1ad749[_0x10be('0x17')]?_0x1ad749[_0x10be('0x17')][_0x10be('0x19')]||null:null,'attributes':_0x1ad749[_0x10be('0x17')]?_0x1ad749['options'][_0x10be('0x1a')]||null:null,'include':_0x1ad749['options']?_0x1ad749[_0x10be('0x17')][_0x10be('0x1b')]?_[_0x10be('0x1c')](_0x1ad749[_0x10be('0x17')][_0x10be('0x1b')],function(_0x4a4b53){return{'model':db[_0x4a4b53[_0x10be('0x1d')]],'as':_0x4a4b53['as'],'attributes':_0x4a4b53[_0x10be('0x1a')],'include':_0x4a4b53[_0x10be('0x1b')]?_[_0x10be('0x1c')](_0x4a4b53[_0x10be('0x1b')],function(_0x1429e7){return{'model':db[_0x1429e7[_0x10be('0x1d')]],'as':_0x1429e7['as'],'attributes':_0x1429e7['attributes'],'include':_0x1429e7['include']?_[_0x10be('0x1c')](_0x1429e7['include'],function(_0x7ac9b4){return{'model':db[_0x7ac9b4[_0x10be('0x1d')]],'as':_0x7ac9b4['as'],'attributes':_0x7ac9b4[_0x10be('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x10be('0xa')](function(_0x5ccba5){logger[_0x10be('0xb')](_0x10be('0x15'),_0x1ad749);logger[_0x10be('0x1e')]('ShowSound',_0x1ad749,JSON[_0x10be('0xf')](_0x5ccba5));_0x2460f7(_0x5ccba5);})[_0x10be('0x14')](function(_0x1835ac){logger[_0x10be('0x10')](_0x10be('0x15'),_0x1835ac[_0x10be('0x12')],_0x1ad749);_0x46177c(_0xda6c1b['error'](0x1f4,_0x1835ac[_0x10be('0x12')]));});});}; \ No newline at end of file +var _0xa8fa=['attributes','ShowSound','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','Sound','find','options','raw','include','map','model'];(function(_0x5b65f2,_0x591120){var _0x82c225=function(_0x27bb35){while(--_0x27bb35){_0x5b65f2['push'](_0x5b65f2['shift']());}};_0x82c225(++_0x591120);}(_0xa8fa,0x18b));var _0xaa8f=function(_0x1274af,_0x5bf67b){_0x1274af=_0x1274af-0x0;var _0x43df23=_0xa8fa[_0x1274af];return _0x43df23;};'use strict';var _=require('lodash');var util=require(_0xaa8f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xaa8f('0x1'));var fs=require('fs');var Redis=require(_0xaa8f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa8f('0x3'));var logger=require(_0xaa8f('0x4'))('rpc');var config=require(_0xaa8f('0x5'));var jayson=require(_0xaa8f('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x20c059,_0xa01aae,_0x4202d8){return new BPromise(function(_0xae7dc0,_0x29aa8a){return client['request'](_0x20c059,_0x4202d8)[_0xaa8f('0x7')](function(_0x4b8a99){logger[_0xaa8f('0x8')](_0xaa8f('0x9'),_0xa01aae,'request\x20sent');logger[_0xaa8f('0xa')](_0xaa8f('0xb'),_0xa01aae,_0xaa8f('0xc'),JSON[_0xaa8f('0xd')](_0x4b8a99));if(_0x4b8a99[_0xaa8f('0xe')]){if(_0x4b8a99[_0xaa8f('0xe')][_0xaa8f('0xf')]===0x1f4){logger[_0xaa8f('0xe')]('Sound,\x20%s,\x20%s',_0xa01aae,_0x4b8a99['error'][_0xaa8f('0x10')]);return _0x29aa8a(_0x4b8a99[_0xaa8f('0xe')][_0xaa8f('0x10')]);}logger[_0xaa8f('0xe')](_0xaa8f('0x9'),_0xa01aae,_0x4b8a99[_0xaa8f('0xe')][_0xaa8f('0x10')]);return _0xae7dc0(_0x4b8a99[_0xaa8f('0xe')][_0xaa8f('0x10')]);}else{logger[_0xaa8f('0x8')](_0xaa8f('0x9'),_0xa01aae,_0xaa8f('0xc'));_0xae7dc0(_0x4b8a99[_0xaa8f('0x11')]['message']);}})['catch'](function(_0x992571){logger[_0xaa8f('0xe')](_0xaa8f('0x9'),_0xa01aae,_0x992571);_0x29aa8a(_0x992571);});});}exports['ShowSound']=function(_0x3e83db){var _0x279643=this;return new Promise(function(_0x3ddbe9,_0x3ef398){return db[_0xaa8f('0x12')][_0xaa8f('0x13')]({'raw':_0x3e83db[_0xaa8f('0x14')]?_0x3e83db[_0xaa8f('0x14')][_0xaa8f('0x15')]===undefined?!![]:![]:!![],'where':_0x3e83db[_0xaa8f('0x14')]?_0x3e83db[_0xaa8f('0x14')]['where']||null:null,'attributes':_0x3e83db[_0xaa8f('0x14')]?_0x3e83db['options']['attributes']||null:null,'include':_0x3e83db['options']?_0x3e83db['options'][_0xaa8f('0x16')]?_[_0xaa8f('0x17')](_0x3e83db[_0xaa8f('0x14')][_0xaa8f('0x16')],function(_0x24b82e){return{'model':db[_0x24b82e[_0xaa8f('0x18')]],'as':_0x24b82e['as'],'attributes':_0x24b82e[_0xaa8f('0x19')],'include':_0x24b82e[_0xaa8f('0x16')]?_['map'](_0x24b82e['include'],function(_0x10e147){return{'model':db[_0x10e147[_0xaa8f('0x18')]],'as':_0x10e147['as'],'attributes':_0x10e147[_0xaa8f('0x19')],'include':_0x10e147[_0xaa8f('0x16')]?_[_0xaa8f('0x17')](_0x10e147[_0xaa8f('0x16')],function(_0x11188b){return{'model':db[_0x11188b[_0xaa8f('0x18')]],'as':_0x11188b['as'],'attributes':_0x11188b['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa8f('0x7')](function(_0x4522ce){logger[_0xaa8f('0x8')](_0xaa8f('0x1a'),_0x3e83db);logger[_0xaa8f('0xa')](_0xaa8f('0x1a'),_0x3e83db,JSON['stringify'](_0x4522ce));_0x3ddbe9(_0x4522ce);})[_0xaa8f('0x1b')](function(_0x508154){logger['error'](_0xaa8f('0x1a'),_0x508154[_0xaa8f('0x10')],_0x3e83db);_0x3ef398(_0x279643[_0xaa8f('0xe')](0x1f4,_0x508154[_0xaa8f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 89e0abd..e17a1b6 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 _0x757a=['destroy','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete'];(function(_0x5066d4,_0x5d775a){var _0x27352c=function(_0x38a529){while(--_0x38a529){_0x5066d4['push'](_0x5066d4['shift']());}};_0x27352c(++_0x5d775a);}(_0x757a,0xde));var _0xa757=function(_0x18fb74,_0x24225f){_0x18fb74=_0x18fb74-0x0;var _0x9c4ff4=_0x757a[_0x18fb74];return _0x9c4ff4;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0xb')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xc')]);router['put'](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0x10')]);module['exports']=router; \ No newline at end of file +var _0xd8b0=['update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x2eedab,_0x271a82){var _0x176ee9=function(_0x476017){while(--_0x476017){_0x2eedab['push'](_0x2eedab['shift']());}};_0x176ee9(++_0x271a82);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['post']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xb')]);router[_0x0d8b('0xc')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 5d51267..27e8ab3 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 _0xcc84=['TEXT','medium','ENUM','out','sequelize','exports','STRING'];(function(_0x20fd72,_0xe0ac2f){var _0x32a2e0=function(_0x47d067){while(--_0x47d067){_0x20fd72['push'](_0x20fd72['shift']());}};_0x32a2e0(++_0xe0ac2f);}(_0xcc84,0xc8));var _0x4cc8=function(_0x3cbe1c,_0x4bcabd){_0x3cbe1c=_0x3cbe1c-0x0;var _0x5ee08b=_0xcc84[_0x3cbe1c];return _0x5ee08b;};'use strict';var Sequelize=require(_0x4cc8('0x0'));module[_0x4cc8('0x1')]={'uniqueid':{'type':Sequelize[_0x4cc8('0x2')]},'body':{'type':Sequelize[_0x4cc8('0x3')](_0x4cc8('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x4cc8('0x5')]('in',_0x4cc8('0x6')),'defaultValue':_0x4cc8('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x4cc8('0x2')]},'providerResponse':{'type':Sequelize[_0x4cc8('0x3')]}}; \ No newline at end of file +var _0x7576=['ENUM','out','sequelize','STRING','TEXT','medium'];(function(_0x36d704,_0xe8efa2){var _0x19afb5=function(_0x342754){while(--_0x342754){_0x36d704['push'](_0x36d704['shift']());}};_0x19afb5(++_0xe8efa2);}(_0x7576,0x182));var _0x6757=function(_0x42b76d,_0x37c324){_0x42b76d=_0x42b76d-0x0;var _0x2afa8f=_0x7576[_0x42b76d];return _0x2afa8f;};'use strict';var Sequelize=require(_0x6757('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x6757('0x1')]},'body':{'type':Sequelize[_0x6757('0x2')](_0x6757('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x6757('0x4')]('in',_0x6757('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x6757('0x1')]},'providerResponse':{'type':Sequelize[_0x6757('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 53bc261..b998f74 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 _0x3166=['reject','save','update','then','destroy','error','stack','name','send','index','SquareMessage','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','options','create','body','params','catch','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range'];(function(_0xa7879c,_0x4dc1d9){var _0x576d61=function(_0x54d9f0){while(--_0x54d9f0){_0xa7879c['push'](_0xa7879c['shift']());}};_0x576d61(++_0x4dc1d9);}(_0x3166,0xbb));var _0x6316=function(_0x51aa5c,_0x5a5d15){_0x51aa5c=_0x51aa5c-0x0;var _0x4ec15a=_0x3166[_0x51aa5c];return _0x4ec15a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6316('0x0'));var zipdir=require(_0x6316('0x1'));var jsonpatch=require(_0x6316('0x2'));var rp=require('request-promise');var moment=require(_0x6316('0x3'));var BPromise=require(_0x6316('0x4'));var Mustache=require('mustache');var util=require(_0x6316('0x5'));var path=require(_0x6316('0x6'));var sox=require('sox');var csv=require(_0x6316('0x7'));var ejs=require(_0x6316('0x8'));var fs=require('fs');var fs_extra=require(_0x6316('0x9'));var _=require(_0x6316('0xa'));var squel=require('squel');var crypto=require(_0x6316('0xb'));var jsforce=require(_0x6316('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6316('0x7'));var querystring=require(_0x6316('0xd'));var Papa=require(_0x6316('0xe'));var Redis=require(_0x6316('0xf'));var authService=require(_0x6316('0x10'));var qs=require(_0x6316('0x11'));var as=require(_0x6316('0x12'));var hardwareService=require(_0x6316('0x13'));var logger=require(_0x6316('0x14'))(_0x6316('0x15'));var utils=require(_0x6316('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6316('0x17'));var db=require(_0x6316('0x18'))['db'];function respondWithStatusCode(_0x1a1c46,_0x34898b){_0x34898b=_0x34898b||0xcc;return function(_0x468c19){if(_0x468c19){return _0x1a1c46[_0x6316('0x19')](_0x34898b);}return _0x1a1c46['status'](_0x34898b)[_0x6316('0x1a')]();};}function respondWithResult(_0x6261d5,_0x15b8bb){_0x15b8bb=_0x15b8bb||0xc8;return function(_0xcba5ff){if(_0xcba5ff){return _0x6261d5['status'](_0x15b8bb)[_0x6316('0x1b')](_0xcba5ff);}};}function respondWithFilteredResult(_0x46022e,_0x2e1d48){return function(_0x493139){if(_0x493139){var _0x22348f=typeof _0x2e1d48[_0x6316('0x1c')]==='undefined'&&typeof _0x2e1d48[_0x6316('0x1d')]===_0x6316('0x1e');var _0x3f9e07=_0x493139[_0x6316('0x1f')];var _0x569db2=_0x22348f?0x0:_0x2e1d48['offset'];var _0x2eecb9=_0x22348f?_0x493139[_0x6316('0x1f')]:_0x2e1d48[_0x6316('0x1c')]+_0x2e1d48[_0x6316('0x1d')];var _0x22cd6e;if(_0x2eecb9>=_0x3f9e07){_0x2eecb9=_0x3f9e07;_0x22cd6e=0xc8;}else{_0x22cd6e=0xce;}_0x46022e[_0x6316('0x20')](_0x22cd6e);return _0x46022e[_0x6316('0x21')](_0x6316('0x22'),_0x569db2+'-'+_0x2eecb9+'/'+_0x3f9e07)[_0x6316('0x1b')](_0x493139);}return null;};}function patchUpdates(_0x3e4543){return function(_0x36db62){try{jsonpatch['apply'](_0x36db62,_0x3e4543,!![]);}catch(_0x1ed2d2){return BPromise[_0x6316('0x23')](_0x1ed2d2);}return _0x36db62[_0x6316('0x24')]();};}function saveUpdates(_0x156065,_0x3cfc43){return function(_0x236256){if(_0x236256){return _0x236256[_0x6316('0x25')](_0x156065)[_0x6316('0x26')](function(_0x59000b){return _0x59000b;});}return null;};}function removeEntity(_0x4063e3,_0x46e2c1){return function(_0x3206ef){if(_0x3206ef){return _0x3206ef[_0x6316('0x27')]()['then'](function(){_0x4063e3[_0x6316('0x20')](0xcc)[_0x6316('0x1a')]();});}};}function handleEntityNotFound(_0x11a2b1,_0x4c5bd7){return function(_0x8dd4f6){if(!_0x8dd4f6){_0x11a2b1[_0x6316('0x19')](0x194);}return _0x8dd4f6;};}function handleError(_0x271379,_0x16a64b){_0x16a64b=_0x16a64b||0x1f4;return function(_0x1483ba){logger[_0x6316('0x28')](_0x1483ba[_0x6316('0x29')]);if(_0x1483ba[_0x6316('0x2a')]){delete _0x1483ba[_0x6316('0x2a')];}_0x271379['status'](_0x16a64b)[_0x6316('0x2b')](_0x1483ba);};}exports[_0x6316('0x2c')]=function(_0x546eae,_0x30b984){var _0x49a51c={},_0x33c001={},_0x2bd2a4={'count':0x0,'rows':[]};var _0x5889e4=_['map'](db[_0x6316('0x2d')]['rawAttributes'],function(_0x528f8d){return{'name':_0x528f8d['fieldName'],'type':_0x528f8d['type'][_0x6316('0x2e')]};});_0x33c001[_0x6316('0x2f')]=_[_0x6316('0x30')](_0x5889e4,'name');_0x33c001[_0x6316('0x31')]=_[_0x6316('0x32')](_0x546eae[_0x6316('0x31')]);_0x33c001[_0x6316('0x33')]=_[_0x6316('0x34')](_0x33c001[_0x6316('0x2f')],_0x33c001[_0x6316('0x31')]);_0x49a51c[_0x6316('0x35')]=_['intersection'](_0x33c001[_0x6316('0x2f')],qs[_0x6316('0x36')](_0x546eae[_0x6316('0x31')][_0x6316('0x36')]));_0x49a51c[_0x6316('0x35')]=_0x49a51c['attributes'][_0x6316('0x37')]?_0x49a51c[_0x6316('0x35')]:_0x33c001['model'];if(!_0x546eae[_0x6316('0x31')][_0x6316('0x38')](_0x6316('0x39'))){_0x49a51c[_0x6316('0x1d')]=qs['limit'](_0x546eae[_0x6316('0x31')][_0x6316('0x1d')]);_0x49a51c['offset']=qs[_0x6316('0x1c')](_0x546eae[_0x6316('0x31')][_0x6316('0x1c')]);}_0x49a51c[_0x6316('0x3a')]=qs[_0x6316('0x3b')](_0x546eae[_0x6316('0x31')][_0x6316('0x3b')]);_0x49a51c['where']=qs[_0x6316('0x33')](_[_0x6316('0x3c')](_0x546eae[_0x6316('0x31')],_0x33c001[_0x6316('0x33')]),_0x5889e4);if(_0x546eae[_0x6316('0x31')]['filter']){_0x49a51c[_0x6316('0x3d')]=_[_0x6316('0x3e')](_0x49a51c[_0x6316('0x3d')],{'$or':_[_0x6316('0x30')](_0x5889e4,function(_0x305036){if(_0x305036['type']!==_0x6316('0x3f')){var _0x483873={};_0x483873[_0x305036['name']]={'$like':'%'+_0x546eae['query'][_0x6316('0x40')]+'%'};return _0x483873;}})});}_0x49a51c=_['merge']({},_0x49a51c,_0x546eae['options']);var _0x11b566={'where':_0x49a51c[_0x6316('0x3d')]};return db[_0x6316('0x2d')]['count'](_0x11b566)[_0x6316('0x26')](function(_0x7e8308){_0x2bd2a4[_0x6316('0x1f')]=_0x7e8308;if(_0x546eae[_0x6316('0x31')][_0x6316('0x41')]){_0x49a51c[_0x6316('0x42')]=[{'all':!![]}];}return db['SquareMessage'][_0x6316('0x43')](_0x49a51c);})['then'](function(_0x446a1f){_0x2bd2a4[_0x6316('0x44')]=_0x446a1f;return _0x2bd2a4;})[_0x6316('0x26')](respondWithFilteredResult(_0x30b984,_0x49a51c))['catch'](handleError(_0x30b984,null));};exports['show']=function(_0x2dee31,_0x49f73e){var _0x353f71={'raw':!![],'where':{'id':_0x2dee31['params']['id']}},_0x4ed79c={};_0x4ed79c['model']=_[_0x6316('0x32')](db[_0x6316('0x2d')]['rawAttributes']);_0x4ed79c[_0x6316('0x31')]=_[_0x6316('0x32')](_0x2dee31[_0x6316('0x31')]);_0x4ed79c[_0x6316('0x33')]=_[_0x6316('0x34')](_0x4ed79c[_0x6316('0x2f')],_0x4ed79c['query']);_0x353f71['attributes']=_[_0x6316('0x34')](_0x4ed79c[_0x6316('0x2f')],qs[_0x6316('0x36')](_0x2dee31[_0x6316('0x31')][_0x6316('0x36')]));_0x353f71[_0x6316('0x35')]=_0x353f71[_0x6316('0x35')][_0x6316('0x37')]?_0x353f71[_0x6316('0x35')]:_0x4ed79c[_0x6316('0x2f')];if(_0x2dee31[_0x6316('0x31')]['includeAll']){_0x353f71['include']=[{'all':!![]}];}_0x353f71=_[_0x6316('0x3e')]({},_0x353f71,_0x2dee31[_0x6316('0x45')]);return db[_0x6316('0x2d')]['find'](_0x353f71)['then'](handleEntityNotFound(_0x49f73e,null))[_0x6316('0x26')](respondWithResult(_0x49f73e,null))['catch'](handleError(_0x49f73e,null));};exports['create']=function(_0x100d70,_0x4f3c7d){return db[_0x6316('0x2d')][_0x6316('0x46')](_0x100d70[_0x6316('0x47')],{})[_0x6316('0x26')](respondWithResult(_0x4f3c7d,0xc9))['catch'](handleError(_0x4f3c7d,null));};exports[_0x6316('0x25')]=function(_0x73cf7b,_0x253ded){if(_0x73cf7b[_0x6316('0x47')]['id']){delete _0x73cf7b[_0x6316('0x47')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0x73cf7b[_0x6316('0x48')]['id']}})[_0x6316('0x26')](handleEntityNotFound(_0x253ded,null))[_0x6316('0x26')](saveUpdates(_0x73cf7b[_0x6316('0x47')],null))['then'](respondWithResult(_0x253ded,null))[_0x6316('0x49')](handleError(_0x253ded,null));};exports[_0x6316('0x27')]=function(_0x81538d,_0x5f5dc9){return db[_0x6316('0x2d')]['find']({'where':{'id':_0x81538d[_0x6316('0x48')]['id']}})[_0x6316('0x26')](handleEntityNotFound(_0x5f5dc9,null))[_0x6316('0x26')](removeEntity(_0x5f5dc9,null))['catch'](handleError(_0x5f5dc9,null));}; \ No newline at end of file +var _0x2015=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareMessage','includeAll','include','findAll','rows','show','create','catch','body','find','params','eml-format','rimraf'];(function(_0x468a77,_0x1382be){var _0x2d1c33=function(_0x2f2e83){while(--_0x2f2e83){_0x468a77['push'](_0x468a77['shift']());}};_0x2d1c33(++_0x1382be);}(_0x2015,0x193));var _0x5201=function(_0xde2051,_0x38d400){_0xde2051=_0xde2051-0x0;var _0x305627=_0x2015[_0xde2051];return _0x305627;};'use strict';var emlformat=require(_0x5201('0x0'));var rimraf=require(_0x5201('0x1'));var zipdir=require(_0x5201('0x2'));var jsonpatch=require(_0x5201('0x3'));var rp=require(_0x5201('0x4'));var moment=require(_0x5201('0x5'));var BPromise=require(_0x5201('0x6'));var Mustache=require(_0x5201('0x7'));var util=require('util');var path=require(_0x5201('0x8'));var sox=require(_0x5201('0x9'));var csv=require(_0x5201('0xa'));var ejs=require(_0x5201('0xb'));var fs=require('fs');var fs_extra=require(_0x5201('0xc'));var _=require(_0x5201('0xd'));var squel=require(_0x5201('0xe'));var crypto=require(_0x5201('0xf'));var jsforce=require(_0x5201('0x10'));var deskjs=require(_0x5201('0x11'));var toCsv=require('to-csv');var querystring=require(_0x5201('0x12'));var Papa=require(_0x5201('0x13'));var Redis=require('ioredis');var authService=require(_0x5201('0x14'));var qs=require(_0x5201('0x15'));var as=require(_0x5201('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5201('0x17'))(_0x5201('0x18'));var utils=require(_0x5201('0x19'));var config=require(_0x5201('0x1a'));var licenseUtil=require(_0x5201('0x1b'));var db=require(_0x5201('0x1c'))['db'];function respondWithStatusCode(_0x2038a9,_0x677cd5){_0x677cd5=_0x677cd5||0xcc;return function(_0x2aa01f){if(_0x2aa01f){return _0x2038a9[_0x5201('0x1d')](_0x677cd5);}return _0x2038a9[_0x5201('0x1e')](_0x677cd5)[_0x5201('0x1f')]();};}function respondWithResult(_0x491252,_0x377838){_0x377838=_0x377838||0xc8;return function(_0x30a34e){if(_0x30a34e){return _0x491252['status'](_0x377838)['json'](_0x30a34e);}};}function respondWithFilteredResult(_0x395a97,_0x364fb7){return function(_0x224f98){if(_0x224f98){var _0x5b3184=typeof _0x364fb7['offset']===_0x5201('0x20')&&typeof _0x364fb7['limit']===_0x5201('0x20');var _0x54810d=_0x224f98[_0x5201('0x21')];var _0x4d44d8=_0x5b3184?0x0:_0x364fb7[_0x5201('0x22')];var _0x1a17ac=_0x5b3184?_0x224f98[_0x5201('0x21')]:_0x364fb7[_0x5201('0x22')]+_0x364fb7['limit'];var _0x510942;if(_0x1a17ac>=_0x54810d){_0x1a17ac=_0x54810d;_0x510942=0xc8;}else{_0x510942=0xce;}_0x395a97[_0x5201('0x1e')](_0x510942);return _0x395a97[_0x5201('0x23')](_0x5201('0x24'),_0x4d44d8+'-'+_0x1a17ac+'/'+_0x54810d)['json'](_0x224f98);}return null;};}function patchUpdates(_0xd028ab){return function(_0x433884){try{jsonpatch[_0x5201('0x25')](_0x433884,_0xd028ab,!![]);}catch(_0x446bee){return BPromise[_0x5201('0x26')](_0x446bee);}return _0x433884['save']();};}function saveUpdates(_0x15fade,_0x32aa89){return function(_0x33c2bb){if(_0x33c2bb){return _0x33c2bb[_0x5201('0x27')](_0x15fade)[_0x5201('0x28')](function(_0x6d5e04){return _0x6d5e04;});}return null;};}function removeEntity(_0x10e9c2,_0x4d4142){return function(_0x4a3040){if(_0x4a3040){return _0x4a3040[_0x5201('0x29')]()[_0x5201('0x28')](function(){_0x10e9c2[_0x5201('0x1e')](0xcc)[_0x5201('0x1f')]();});}};}function handleEntityNotFound(_0x1258a7,_0x219e8){return function(_0x43ca02){if(!_0x43ca02){_0x1258a7[_0x5201('0x1d')](0x194);}return _0x43ca02;};}function handleError(_0x2c7a2c,_0x49aed2){_0x49aed2=_0x49aed2||0x1f4;return function(_0xff15b7){logger[_0x5201('0x2a')](_0xff15b7['stack']);if(_0xff15b7[_0x5201('0x2b')]){delete _0xff15b7['name'];}_0x2c7a2c['status'](_0x49aed2)[_0x5201('0x2c')](_0xff15b7);};}exports[_0x5201('0x2d')]=function(_0x33eecd,_0x58f914){var _0x5838ea={},_0x3b3d53={},_0x3597a0={'count':0x0,'rows':[]};var _0x453c7b=_[_0x5201('0x2e')](db['SquareMessage'][_0x5201('0x2f')],function(_0x153720){return{'name':_0x153720[_0x5201('0x30')],'type':_0x153720[_0x5201('0x31')][_0x5201('0x32')]};});_0x3b3d53['model']=_['map'](_0x453c7b,_0x5201('0x2b'));_0x3b3d53[_0x5201('0x33')]=_[_0x5201('0x34')](_0x33eecd[_0x5201('0x33')]);_0x3b3d53[_0x5201('0x35')]=_[_0x5201('0x36')](_0x3b3d53[_0x5201('0x37')],_0x3b3d53['query']);_0x5838ea[_0x5201('0x38')]=_[_0x5201('0x36')](_0x3b3d53[_0x5201('0x37')],qs['fields'](_0x33eecd[_0x5201('0x33')][_0x5201('0x39')]));_0x5838ea[_0x5201('0x38')]=_0x5838ea[_0x5201('0x38')][_0x5201('0x3a')]?_0x5838ea[_0x5201('0x38')]:_0x3b3d53[_0x5201('0x37')];if(!_0x33eecd[_0x5201('0x33')][_0x5201('0x3b')](_0x5201('0x3c'))){_0x5838ea[_0x5201('0x3d')]=qs[_0x5201('0x3d')](_0x33eecd['query']['limit']);_0x5838ea[_0x5201('0x22')]=qs[_0x5201('0x22')](_0x33eecd[_0x5201('0x33')][_0x5201('0x22')]);}_0x5838ea[_0x5201('0x3e')]=qs[_0x5201('0x3f')](_0x33eecd[_0x5201('0x33')]['sort']);_0x5838ea[_0x5201('0x40')]=qs[_0x5201('0x35')](_[_0x5201('0x41')](_0x33eecd['query'],_0x3b3d53[_0x5201('0x35')]),_0x453c7b);if(_0x33eecd[_0x5201('0x33')][_0x5201('0x42')]){_0x5838ea['where']=_[_0x5201('0x43')](_0x5838ea[_0x5201('0x40')],{'$or':_['map'](_0x453c7b,function(_0x5786c2){if(_0x5786c2[_0x5201('0x31')]!==_0x5201('0x44')){var _0xd8901b={};_0xd8901b[_0x5786c2[_0x5201('0x2b')]]={'$like':'%'+_0x33eecd[_0x5201('0x33')][_0x5201('0x42')]+'%'};return _0xd8901b;}})});}_0x5838ea=_['merge']({},_0x5838ea,_0x33eecd[_0x5201('0x45')]);var _0x5989bc={'where':_0x5838ea['where']};return db[_0x5201('0x46')][_0x5201('0x21')](_0x5989bc)[_0x5201('0x28')](function(_0x3e673f){_0x3597a0[_0x5201('0x21')]=_0x3e673f;if(_0x33eecd['query'][_0x5201('0x47')]){_0x5838ea[_0x5201('0x48')]=[{'all':!![]}];}return db[_0x5201('0x46')][_0x5201('0x49')](_0x5838ea);})[_0x5201('0x28')](function(_0x62a2a4){_0x3597a0[_0x5201('0x4a')]=_0x62a2a4;return _0x3597a0;})['then'](respondWithFilteredResult(_0x58f914,_0x5838ea))['catch'](handleError(_0x58f914,null));};exports[_0x5201('0x4b')]=function(_0x470a0d,_0x17ad51){var _0x105959={'raw':!![],'where':{'id':_0x470a0d['params']['id']}},_0x3bf92c={};_0x3bf92c['model']=_[_0x5201('0x34')](db[_0x5201('0x46')][_0x5201('0x2f')]);_0x3bf92c[_0x5201('0x33')]=_[_0x5201('0x34')](_0x470a0d[_0x5201('0x33')]);_0x3bf92c[_0x5201('0x35')]=_[_0x5201('0x36')](_0x3bf92c[_0x5201('0x37')],_0x3bf92c[_0x5201('0x33')]);_0x105959[_0x5201('0x38')]=_['intersection'](_0x3bf92c['model'],qs[_0x5201('0x39')](_0x470a0d[_0x5201('0x33')][_0x5201('0x39')]));_0x105959[_0x5201('0x38')]=_0x105959[_0x5201('0x38')]['length']?_0x105959['attributes']:_0x3bf92c[_0x5201('0x37')];if(_0x470a0d[_0x5201('0x33')][_0x5201('0x47')]){_0x105959[_0x5201('0x48')]=[{'all':!![]}];}_0x105959=_[_0x5201('0x43')]({},_0x105959,_0x470a0d[_0x5201('0x45')]);return db['SquareMessage']['find'](_0x105959)['then'](handleEntityNotFound(_0x17ad51,null))[_0x5201('0x28')](respondWithResult(_0x17ad51,null))['catch'](handleError(_0x17ad51,null));};exports[_0x5201('0x4c')]=function(_0xecbe7b,_0x3dea26){return db[_0x5201('0x46')][_0x5201('0x4c')](_0xecbe7b['body'],{})[_0x5201('0x28')](respondWithResult(_0x3dea26,0xc9))[_0x5201('0x4d')](handleError(_0x3dea26,null));};exports[_0x5201('0x27')]=function(_0x14e692,_0x3eeea1){if(_0x14e692[_0x5201('0x4e')]['id']){delete _0x14e692[_0x5201('0x4e')]['id'];}return db[_0x5201('0x46')][_0x5201('0x4f')]({'where':{'id':_0x14e692[_0x5201('0x50')]['id']}})['then'](handleEntityNotFound(_0x3eeea1,null))[_0x5201('0x28')](saveUpdates(_0x14e692['body'],null))[_0x5201('0x28')](respondWithResult(_0x3eeea1,null))[_0x5201('0x4d')](handleError(_0x3eeea1,null));};exports['destroy']=function(_0x14a142,_0xfa16c2){return db['SquareMessage'][_0x5201('0x4f')]({'where':{'id':_0x14a142['params']['id']}})[_0x5201('0x28')](handleEntityNotFound(_0xfa16c2,null))[_0x5201('0x28')](removeEntity(_0xfa16c2,null))[_0x5201('0x4d')](handleError(_0xfa16c2,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 910aae8..f816955 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 _0x4283=['request-promise','define','SquareMessage','square_messages','util','../../config/logger'];(function(_0x3b7d38,_0x34b4c8){var _0x44bdaa=function(_0x39a8a2){while(--_0x39a8a2){_0x3b7d38['push'](_0x3b7d38['shift']());}};_0x44bdaa(++_0x34b4c8);}(_0x4283,0x1c0));var _0x3428=function(_0x133338,_0x55c872){_0x133338=_0x133338-0x0;var _0x238a75=_0x4283[_0x133338];return _0x238a75;};'use strict';var _=require('lodash');var util=require(_0x3428('0x0'));var logger=require(_0x3428('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3428('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module['exports']=function(_0x1b0bd5,_0x49c30e){return _0x1b0bd5[_0x3428('0x3')](_0x3428('0x4'),attributes,{'tableName':_0x3428('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf145=['../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x129a7c,_0x5c7eae){var _0x33d5cc=function(_0x24988b){while(--_0x24988b){_0x129a7c['push'](_0x129a7c['shift']());}};_0x33d5cc(++_0x5c7eae);}(_0xf145,0x1f1));var _0x5f14=function(_0x416ad,_0x3797e5){_0x416ad=_0x416ad-0x0;var _0x160983=_0xf145[_0x416ad];return _0x160983;};'use strict';var _=require(_0x5f14('0x0'));var util=require(_0x5f14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5f14('0x2'));var BPromise=require(_0x5f14('0x3'));var rp=require(_0x5f14('0x4'));var fs=require('fs');var path=require(_0x5f14('0x5'));var rimraf=require(_0x5f14('0x6'));var config=require(_0x5f14('0x7'));var attributes=require(_0x5f14('0x8'));module[_0x5f14('0x9')]=function(_0x5b58e3,_0xacc2d7){return _0x5b58e3[_0x5f14('0xa')](_0x5f14('0xb'),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 ed67bda..ccbc20e 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 _0x2870=['info','result','CreateSquareMessage','body','options','raw','catch','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x2870,0x197));var _0x0287=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x2870[_0x5f1391];return _0x50ebe3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0287('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0287('0x1'));var db=require(_0x0287('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0287('0x3'));var config=require(_0x0287('0x4'));var jayson=require(_0x0287('0x5'));var client=jayson[_0x0287('0x6')][_0x0287('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1673e8,_0x133e81,_0x1395ab){return new BPromise(function(_0x4923e9,_0x2c9137){return client[_0x0287('0x8')](_0x1673e8,_0x1395ab)[_0x0287('0x9')](function(_0x11200c){logger['info'](_0x0287('0xa'),_0x133e81,_0x0287('0xb'));logger[_0x0287('0xc')](_0x0287('0xd'),_0x133e81,_0x0287('0xb'),JSON[_0x0287('0xe')](_0x11200c));if(_0x11200c[_0x0287('0xf')]){if(_0x11200c['error'][_0x0287('0x10')]===0x1f4){logger[_0x0287('0xf')](_0x0287('0xa'),_0x133e81,_0x11200c[_0x0287('0xf')][_0x0287('0x11')]);return _0x2c9137(_0x11200c[_0x0287('0xf')][_0x0287('0x11')]);}logger[_0x0287('0xf')](_0x0287('0xa'),_0x133e81,_0x11200c[_0x0287('0xf')][_0x0287('0x11')]);return _0x4923e9(_0x11200c['error'][_0x0287('0x11')]);}else{logger[_0x0287('0x12')](_0x0287('0xa'),_0x133e81,_0x0287('0xb'));_0x4923e9(_0x11200c[_0x0287('0x13')][_0x0287('0x11')]);}})['catch'](function(_0x40b109){logger[_0x0287('0xf')](_0x0287('0xa'),_0x133e81,_0x40b109);_0x2c9137(_0x40b109);});});}exports[_0x0287('0x14')]=function(_0x18f0e7){var _0x103321=this;return new Promise(function(_0x23adfd,_0x3985e6){return db['SquareMessage']['create'](_0x18f0e7[_0x0287('0x15')],{'raw':_0x18f0e7[_0x0287('0x16')]?_0x18f0e7[_0x0287('0x16')][_0x0287('0x17')]===undefined?!![]:![]:!![]})[_0x0287('0x9')](function(_0x5cb4bc){logger[_0x0287('0x12')](_0x0287('0x14'),_0x18f0e7);logger[_0x0287('0xc')](_0x0287('0x14'),_0x18f0e7,JSON[_0x0287('0xe')](_0x5cb4bc));_0x23adfd(_0x5cb4bc);})[_0x0287('0x18')](function(_0x4873c3){logger[_0x0287('0xf')](_0x0287('0x14'),_0x4873c3[_0x0287('0x11')],_0x18f0e7);_0x3985e6(_0x103321[_0x0287('0xf')](0x1f4,_0x4873c3['message']));});});}; \ No newline at end of file +var _0xb575=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','stringify','error','message','SquareMessage,\x20%s,\x20%s','request\x20sent','result','CreateSquareMessage','create','body','options','raw','then','moment','ioredis','../../mysqldb'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xb575,0x165));var _0x5b57=function(_0x1fc316,_0x1c4eec){_0x1fc316=_0x1fc316-0x0;var _0x2641f7=_0xb575[_0x1fc316];return _0x2641f7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5b57('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b57('0x1'));var db=require(_0x5b57('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b57('0x3'))(_0x5b57('0x4'));var config=require(_0x5b57('0x5'));var jayson=require(_0x5b57('0x6'));var client=jayson[_0x5b57('0x7')][_0x5b57('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ee584,_0x3d03ef,_0x4cbe94){return new BPromise(function(_0x26e8cb,_0x5b7163){return client[_0x5b57('0x9')](_0x5ee584,_0x4cbe94)['then'](function(_0x4a531e){logger[_0x5b57('0xa')]('SquareMessage,\x20%s,\x20%s',_0x3d03ef,'request\x20sent');logger[_0x5b57('0xb')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x3d03ef,'request\x20sent',JSON[_0x5b57('0xc')](_0x4a531e));if(_0x4a531e['error']){if(_0x4a531e[_0x5b57('0xd')]['code']===0x1f4){logger[_0x5b57('0xd')]('SquareMessage,\x20%s,\x20%s',_0x3d03ef,_0x4a531e['error']['message']);return _0x5b7163(_0x4a531e[_0x5b57('0xd')][_0x5b57('0xe')]);}logger[_0x5b57('0xd')](_0x5b57('0xf'),_0x3d03ef,_0x4a531e[_0x5b57('0xd')]['message']);return _0x26e8cb(_0x4a531e[_0x5b57('0xd')][_0x5b57('0xe')]);}else{logger[_0x5b57('0xa')](_0x5b57('0xf'),_0x3d03ef,_0x5b57('0x10'));_0x26e8cb(_0x4a531e[_0x5b57('0x11')]['message']);}})['catch'](function(_0x2dc3da){logger[_0x5b57('0xd')](_0x5b57('0xf'),_0x3d03ef,_0x2dc3da);_0x5b7163(_0x2dc3da);});});}exports[_0x5b57('0x12')]=function(_0x1c7561){var _0x42f5b1=this;return new Promise(function(_0x36b29c,_0x4b02e0){return db['SquareMessage'][_0x5b57('0x13')](_0x1c7561[_0x5b57('0x14')],{'raw':_0x1c7561[_0x5b57('0x15')]?_0x1c7561[_0x5b57('0x15')][_0x5b57('0x16')]===undefined?!![]:![]:!![]})[_0x5b57('0x17')](function(_0x2fb055){logger[_0x5b57('0xa')](_0x5b57('0x12'),_0x1c7561);logger['debug']('CreateSquareMessage',_0x1c7561,JSON[_0x5b57('0xc')](_0x2fb055));_0x36b29c(_0x2fb055);})['catch'](function(_0x1a2aab){logger[_0x5b57('0xd')](_0x5b57('0x12'),_0x1a2aab[_0x5b57('0xe')],_0x1c7561);_0x4b02e0(_0x42f5b1[_0x5b57('0xd')](0x1f4,_0x1a2aab[_0x5b57('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index ae6d567..df7826f 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 _0xa259=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','index','get','/:id','isAuthenticated','show','15s','post','create','put','update'];(function(_0x754525,_0xfe4641){var _0x1e1f51=function(_0x10e638){while(--_0x10e638){_0x754525['push'](_0x754525['shift']());}};_0x1e1f51(++_0xfe4641);}(_0xa259,0x17d));var _0x9a25=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xa259[_0x1deb03];return _0x189fe7;};'use strict';var multer=require(_0x9a25('0x0'));var util=require(_0x9a25('0x1'));var path=require(_0x9a25('0x2'));var timeout=require(_0x9a25('0x3'));var express=require('express');var router=express[_0x9a25('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9a25('0x5'));var interaction=require(_0x9a25('0x6'));var config=require('../../config/environment');var controller=require(_0x9a25('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x9a25('0x8')]);router[_0x9a25('0x9')](_0x9a25('0xa'),auth[_0x9a25('0xb')](),controller[_0x9a25('0xc')]);router['get']('/:id/test',auth[_0x9a25('0xb')](),timeout(_0x9a25('0xd')),controller['test']);router[_0x9a25('0xe')]('/',auth[_0x9a25('0xb')](),controller[_0x9a25('0xf')]);router[_0x9a25('0x10')](_0x9a25('0xa'),auth[_0x9a25('0xb')](),controller[_0x9a25('0x11')]);router[_0x9a25('0x12')](_0x9a25('0xa'),auth[_0x9a25('0xb')](),controller[_0x9a25('0x13')]);module[_0x9a25('0x14')]=router; \ No newline at end of file +var _0x3c90=['../../config/environment','get','index','isAuthenticated','show','/:id/test','15s','test','post','create','put','/:id','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dcff8,_0x4b055b){var _0x38129f=function(_0x53e0b8){while(--_0x53e0b8){_0x3dcff8['push'](_0x3dcff8['shift']());}};_0x38129f(++_0x4b055b);}(_0x3c90,0x66));var _0x03c9=function(_0x106979,_0x1b00fe){_0x106979=_0x106979-0x0;var _0x105e91=_0x3c90[_0x106979];return _0x105e91;};'use strict';var multer=require(_0x03c9('0x0'));var util=require(_0x03c9('0x1'));var path=require(_0x03c9('0x2'));var timeout=require(_0x03c9('0x3'));var express=require('express');var router=express[_0x03c9('0x4')]();var fs_extra=require(_0x03c9('0x5'));var auth=require(_0x03c9('0x6'));var interaction=require(_0x03c9('0x7'));var config=require(_0x03c9('0x8'));var controller=require('./squareOdbc.controller');router[_0x03c9('0x9')]('/',auth['isAuthenticated'](),controller[_0x03c9('0xa')]);router[_0x03c9('0x9')]('/:id',auth[_0x03c9('0xb')](),controller[_0x03c9('0xc')]);router[_0x03c9('0x9')](_0x03c9('0xd'),auth['isAuthenticated'](),timeout(_0x03c9('0xe')),controller[_0x03c9('0xf')]);router[_0x03c9('0x10')]('/',auth['isAuthenticated'](),controller[_0x03c9('0x11')]);router[_0x03c9('0x12')](_0x03c9('0x13'),auth[_0x03c9('0xb')](),controller[_0x03c9('0x14')]);router[_0x03c9('0x15')](_0x03c9('0x13'),auth[_0x03c9('0xb')](),controller['destroy']);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 de2c773..aee6879 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 _0xaf95=['sequelize','exports','STRING'];(function(_0x2674a1,_0x4a3162){var _0x246b98=function(_0x143385){while(--_0x143385){_0x2674a1['push'](_0x2674a1['shift']());}};_0x246b98(++_0x4a3162);}(_0xaf95,0x1cb));var _0x5af9=function(_0x32fa1f,_0x3735be){_0x32fa1f=_0x32fa1f-0x0;var _0x51a8ca=_0xaf95[_0x32fa1f];return _0x51a8ca;};'use strict';var Sequelize=require(_0x5af9('0x0'));module[_0x5af9('0x1')]={'name':{'type':Sequelize[_0x5af9('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x5af9('0x2')]},'description':{'type':Sequelize[_0x5af9('0x2')]}}; \ No newline at end of file +var _0x6e50=['sequelize','exports','STRING','name'];(function(_0x15a451,_0x363459){var _0x35f130=function(_0x496ff2){while(--_0x496ff2){_0x15a451['push'](_0x15a451['shift']());}};_0x35f130(++_0x363459);}(_0x6e50,0x9c));var _0x06e5=function(_0x3b4c2f,_0xfc1624){_0x3b4c2f=_0x3b4c2f-0x0;var _0x3369a1=_0x6e50[_0x3b4c2f];return _0x3369a1;};'use strict';var Sequelize=require(_0x06e5('0x0'));module[_0x06e5('0x1')]={'name':{'type':Sequelize[_0x06e5('0x2')],'unique':_0x06e5('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x06e5('0x2')]},'description':{'type':Sequelize[_0x06e5('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index a502dc8..e4fe666 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 _0xa5ef=['json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','end','error','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','openSync','closeSync','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x1b9348,_0x48d76){var _0x15d338=function(_0x41b76d){while(--_0x41b76d){_0x1b9348['push'](_0x1b9348['shift']());}};_0x15d338(++_0x48d76);}(_0xa5ef,0x1a0));var _0xfa5e=function(_0x214cbb,_0x40c21f){_0x214cbb=_0x214cbb-0x0;var _0x1495c1=_0xa5ef[_0x214cbb];return _0x1495c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfa5e('0x0'));var zipdir=require(_0xfa5e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfa5e('0x2'));var Mustache=require(_0xfa5e('0x3'));var util=require(_0xfa5e('0x4'));var path=require(_0xfa5e('0x5'));var sox=require(_0xfa5e('0x6'));var csv=require(_0xfa5e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa5e('0x8'));var _=require(_0xfa5e('0x9'));var squel=require(_0xfa5e('0xa'));var crypto=require('crypto');var jsforce=require(_0xfa5e('0xb'));var deskjs=require(_0xfa5e('0xc'));var toCsv=require(_0xfa5e('0x7'));var querystring=require(_0xfa5e('0xd'));var Papa=require(_0xfa5e('0xe'));var Redis=require(_0xfa5e('0xf'));var authService=require(_0xfa5e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xfa5e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfa5e('0x12'));var utils=require(_0xfa5e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xfa5e('0x14'));var db=require(_0xfa5e('0x15'))['db'];function respondWithStatusCode(_0x84d88c,_0x1c29cf){_0x1c29cf=_0x1c29cf||0xcc;return function(_0x300567){if(_0x300567){return _0x84d88c[_0xfa5e('0x16')](_0x1c29cf);}return _0x84d88c[_0xfa5e('0x17')](_0x1c29cf)['end']();};}function respondWithResult(_0xc8c5c5,_0x206311){_0x206311=_0x206311||0xc8;return function(_0x5dcc9a){if(_0x5dcc9a){return _0xc8c5c5[_0xfa5e('0x17')](_0x206311)[_0xfa5e('0x18')](_0x5dcc9a);}};}function respondWithFilteredResult(_0x4cfb62,_0x2335a2){return function(_0x1c0e04){if(_0x1c0e04){var _0x1a0a34=typeof _0x2335a2[_0xfa5e('0x19')]===_0xfa5e('0x1a')&&typeof _0x2335a2['limit']===_0xfa5e('0x1a');var _0x22eca0=_0x1c0e04['count'];var _0x331bf3=_0x1a0a34?0x0:_0x2335a2[_0xfa5e('0x19')];var _0x44ec6c=_0x1a0a34?_0x1c0e04[_0xfa5e('0x1b')]:_0x2335a2[_0xfa5e('0x19')]+_0x2335a2[_0xfa5e('0x1c')];var _0x131c42;if(_0x44ec6c>=_0x22eca0){_0x44ec6c=_0x22eca0;_0x131c42=0xc8;}else{_0x131c42=0xce;}_0x4cfb62[_0xfa5e('0x17')](_0x131c42);return _0x4cfb62[_0xfa5e('0x1d')](_0xfa5e('0x1e'),_0x331bf3+'-'+_0x44ec6c+'/'+_0x22eca0)['json'](_0x1c0e04);}return null;};}function patchUpdates(_0x5cbc3f){return function(_0x5c80cc){try{jsonpatch[_0xfa5e('0x1f')](_0x5c80cc,_0x5cbc3f,!![]);}catch(_0x26dfe0){return BPromise[_0xfa5e('0x20')](_0x26dfe0);}return _0x5c80cc[_0xfa5e('0x21')]();};}function saveUpdates(_0xa4b31d,_0x280580){return function(_0x2fa80f){if(_0x2fa80f){return _0x2fa80f[_0xfa5e('0x22')](_0xa4b31d)[_0xfa5e('0x23')](function(_0x4278b6){return _0x4278b6;});}return null;};}function removeEntity(_0x2a0585,_0x3d1760){return function(_0xbfd995){if(_0xbfd995){return _0xbfd995[_0xfa5e('0x24')]()[_0xfa5e('0x23')](function(){var _0x77e2c5=_0xbfd995[_0xfa5e('0x25')]({'plain':!![]});var _0x5a9e51=_0xfa5e('0x26');return db[_0xfa5e('0x27')]['destroy']({'where':{'type':_0x5a9e51,'resourceId':_0x77e2c5['id']}})['then'](function(){return _0xbfd995;});})['then'](function(){_0x2a0585[_0xfa5e('0x17')](0xcc)[_0xfa5e('0x28')]();});}};}function handleEntityNotFound(_0x3e122c,_0xc84eb1){return function(_0x26e118){if(!_0x26e118){_0x3e122c['sendStatus'](0x194);}return _0x26e118;};}function handleError(_0xeefb18,_0x20aa38){_0x20aa38=_0x20aa38||0x1f4;return function(_0x5832ea){logger[_0xfa5e('0x29')](_0x5832ea[_0xfa5e('0x2a')]);if(_0x5832ea[_0xfa5e('0x2b')]){delete _0x5832ea['name'];}_0xeefb18[_0xfa5e('0x17')](_0x20aa38)[_0xfa5e('0x2c')](_0x5832ea);};}exports['index']=function(_0x16a4e6,_0x85ef37){var _0x59ce63={},_0x1cde0f={},_0x525679={'count':0x0,'rows':[]};var _0x367f76=_[_0xfa5e('0x2d')](db[_0xfa5e('0x2e')][_0xfa5e('0x2f')],function(_0x25d82e){return{'name':_0x25d82e[_0xfa5e('0x30')],'type':_0x25d82e['type'][_0xfa5e('0x31')]};});_0x1cde0f[_0xfa5e('0x32')]=_['map'](_0x367f76,'name');_0x1cde0f['query']=_[_0xfa5e('0x33')](_0x16a4e6[_0xfa5e('0x34')]);_0x1cde0f['filters']=_[_0xfa5e('0x35')](_0x1cde0f[_0xfa5e('0x32')],_0x1cde0f[_0xfa5e('0x34')]);_0x59ce63['attributes']=_[_0xfa5e('0x35')](_0x1cde0f[_0xfa5e('0x32')],qs[_0xfa5e('0x36')](_0x16a4e6[_0xfa5e('0x34')][_0xfa5e('0x36')]));_0x59ce63[_0xfa5e('0x37')]=_0x59ce63['attributes'][_0xfa5e('0x38')]?_0x59ce63[_0xfa5e('0x37')]:_0x1cde0f[_0xfa5e('0x32')];if(!_0x16a4e6[_0xfa5e('0x34')][_0xfa5e('0x39')](_0xfa5e('0x3a'))){_0x59ce63[_0xfa5e('0x1c')]=qs[_0xfa5e('0x1c')](_0x16a4e6[_0xfa5e('0x34')][_0xfa5e('0x1c')]);_0x59ce63[_0xfa5e('0x19')]=qs[_0xfa5e('0x19')](_0x16a4e6['query'][_0xfa5e('0x19')]);}_0x59ce63['order']=qs[_0xfa5e('0x3b')](_0x16a4e6[_0xfa5e('0x34')][_0xfa5e('0x3b')]);_0x59ce63[_0xfa5e('0x3c')]=qs[_0xfa5e('0x3d')](_[_0xfa5e('0x3e')](_0x16a4e6[_0xfa5e('0x34')],_0x1cde0f[_0xfa5e('0x3d')]),_0x367f76);if(_0x16a4e6[_0xfa5e('0x34')][_0xfa5e('0x3f')]){_0x59ce63[_0xfa5e('0x3c')]=_[_0xfa5e('0x40')](_0x59ce63[_0xfa5e('0x3c')],{'$or':_[_0xfa5e('0x2d')](_0x367f76,function(_0x3d5f1f){if(_0x3d5f1f[_0xfa5e('0x41')]!==_0xfa5e('0x42')){var _0x509aa0={};_0x509aa0[_0x3d5f1f['name']]={'$like':'%'+_0x16a4e6['query'][_0xfa5e('0x3f')]+'%'};return _0x509aa0;}})});}_0x59ce63=_['merge']({},_0x59ce63,_0x16a4e6[_0xfa5e('0x43')]);var _0x576c92={'where':_0x59ce63[_0xfa5e('0x3c')]};return db[_0xfa5e('0x2e')][_0xfa5e('0x1b')](_0x576c92)[_0xfa5e('0x23')](function(_0x39c780){_0x525679[_0xfa5e('0x1b')]=_0x39c780;if(_0x16a4e6[_0xfa5e('0x34')][_0xfa5e('0x44')]){_0x59ce63[_0xfa5e('0x45')]=[{'all':!![]}];}return db[_0xfa5e('0x2e')][_0xfa5e('0x46')](_0x59ce63);})[_0xfa5e('0x23')](function(_0x37a017){_0x525679[_0xfa5e('0x47')]=_0x37a017;return _0x525679;})[_0xfa5e('0x23')](respondWithFilteredResult(_0x85ef37,_0x59ce63))['catch'](handleError(_0x85ef37,null));};exports[_0xfa5e('0x48')]=function(_0x20e00e,_0x4ef452){var _0x6e38a={'raw':!![],'where':{'id':_0x20e00e[_0xfa5e('0x49')]['id']}},_0x3cebe7={};_0x3cebe7[_0xfa5e('0x32')]=_[_0xfa5e('0x33')](db[_0xfa5e('0x2e')]['rawAttributes']);_0x3cebe7[_0xfa5e('0x34')]=_[_0xfa5e('0x33')](_0x20e00e[_0xfa5e('0x34')]);_0x3cebe7['filters']=_[_0xfa5e('0x35')](_0x3cebe7[_0xfa5e('0x32')],_0x3cebe7['query']);_0x6e38a['attributes']=_[_0xfa5e('0x35')](_0x3cebe7[_0xfa5e('0x32')],qs[_0xfa5e('0x36')](_0x20e00e[_0xfa5e('0x34')][_0xfa5e('0x36')]));_0x6e38a['attributes']=_0x6e38a[_0xfa5e('0x37')][_0xfa5e('0x38')]?_0x6e38a[_0xfa5e('0x37')]:_0x3cebe7[_0xfa5e('0x32')];if(_0x20e00e[_0xfa5e('0x34')][_0xfa5e('0x44')]){_0x6e38a[_0xfa5e('0x45')]=[{'all':!![]}];}_0x6e38a=_[_0xfa5e('0x40')]({},_0x6e38a,_0x20e00e[_0xfa5e('0x43')]);return db[_0xfa5e('0x2e')][_0xfa5e('0x4a')](_0x6e38a)[_0xfa5e('0x23')](handleEntityNotFound(_0x4ef452,null))['then'](respondWithResult(_0x4ef452,null))['catch'](handleError(_0x4ef452,null));};exports[_0xfa5e('0x4b')]=function(_0x46ce17,_0x10ec9c){return db[_0xfa5e('0x2e')]['create'](_0x46ce17[_0xfa5e('0x4c')],{})[_0xfa5e('0x23')](function(_0x521a7b){var _0x3f31c6=_0x46ce17['user'][_0xfa5e('0x25')]({'plain':!![]});if(!_0x3f31c6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f31c6[_0xfa5e('0x4d')]===_0xfa5e('0x4e')){var _0x3c517f=_0x521a7b[_0xfa5e('0x25')]({'plain':!![]});var _0x200e0f=_0xfa5e('0x26');return db[_0xfa5e('0x4f')]['find']({'where':{'name':_0x200e0f,'userProfileId':_0x3f31c6[_0xfa5e('0x50')]},'raw':!![]})[_0xfa5e('0x23')](function(_0xfff50d){if(_0xfff50d&&_0xfff50d[_0xfa5e('0x51')]===0x0){return db[_0xfa5e('0x27')][_0xfa5e('0x4b')]({'name':_0x3c517f['name'],'resourceId':_0x3c517f['id'],'type':_0xfff50d['name'],'sectionId':_0xfff50d['id']},{})[_0xfa5e('0x23')](function(){return _0x521a7b;});}else{return _0x521a7b;}})[_0xfa5e('0x52')](function(_0x309ebc){logger['error'](_0xfa5e('0x53'),_0x309ebc);throw _0x309ebc;});}return _0x521a7b;})[_0xfa5e('0x23')](respondWithResult(_0x10ec9c,0xc9))[_0xfa5e('0x52')](handleError(_0x10ec9c,null));};exports[_0xfa5e('0x22')]=function(_0x459700,_0x3509df){if(_0x459700['body']['id']){delete _0x459700[_0xfa5e('0x4c')]['id'];}return db[_0xfa5e('0x2e')][_0xfa5e('0x4a')]({'where':{'id':_0x459700[_0xfa5e('0x49')]['id']}})[_0xfa5e('0x23')](handleEntityNotFound(_0x3509df,null))[_0xfa5e('0x23')](saveUpdates(_0x459700[_0xfa5e('0x4c')],null))[_0xfa5e('0x23')](respondWithResult(_0x3509df,null))[_0xfa5e('0x52')](handleError(_0x3509df,null));};exports['destroy']=function(_0x2249fa,_0x25bfd6){return db[_0xfa5e('0x2e')][_0xfa5e('0x4a')]({'where':{'id':_0x2249fa[_0xfa5e('0x49')]['id']}})[_0xfa5e('0x23')](handleEntityNotFound(_0x25bfd6,null))[_0xfa5e('0x23')](removeEntity(_0x25bfd6,null))[_0xfa5e('0x52')](handleError(_0x25bfd6,null));};exports[_0xfa5e('0x54')]=function(_0xa68c29,_0x1bf253,_0x342069){var _0x1d7d44;return db['SquareOdbc'][_0xfa5e('0x4a')]({'where':{'id':_0xa68c29[_0xfa5e('0x49')]['id']},'attributes':['id',_0xfa5e('0x55')]})[_0xfa5e('0x23')](handleEntityNotFound(_0x1bf253,null))[_0xfa5e('0x23')](function(_0xee355c){if(_0xee355c){var _0x1143fb=require('odbc')();_0x1143fb[_0xfa5e('0x56')](_0xee355c['dsn']);_0x1143fb[_0xfa5e('0x57')]();return _0xee355c;}})[_0xfa5e('0x23')](respondWithResult(_0x1bf253,null))[_0xfa5e('0x52')](handleError(_0x1bf253,null));}; \ No newline at end of file +var _0xbef5=['findAll','rows','catch','show','keys','create','role','user','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','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','undefined','limit','count','offset','set','apply','save','update','then','destroy','get','ODBC','error','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','options','includeAll','include'];(function(_0x4df29b,_0x3505b7){var _0x49332f=function(_0x3c48ff){while(--_0x3c48ff){_0x4df29b['push'](_0x4df29b['shift']());}};_0x49332f(++_0x3505b7);}(_0xbef5,0x170));var _0x5bef=function(_0x1a834b,_0x688075){_0x1a834b=_0x1a834b-0x0;var _0x164a83=_0xbef5[_0x1a834b];return _0x164a83;};'use strict';var emlformat=require(_0x5bef('0x0'));var rimraf=require(_0x5bef('0x1'));var zipdir=require(_0x5bef('0x2'));var jsonpatch=require(_0x5bef('0x3'));var rp=require(_0x5bef('0x4'));var moment=require(_0x5bef('0x5'));var BPromise=require(_0x5bef('0x6'));var Mustache=require('mustache');var util=require(_0x5bef('0x7'));var path=require(_0x5bef('0x8'));var sox=require(_0x5bef('0x9'));var csv=require(_0x5bef('0xa'));var ejs=require(_0x5bef('0xb'));var fs=require('fs');var fs_extra=require(_0x5bef('0xc'));var _=require(_0x5bef('0xd'));var squel=require('squel');var crypto=require(_0x5bef('0xe'));var jsforce=require(_0x5bef('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5bef('0x10'));var Papa=require('papaparse');var Redis=require(_0x5bef('0x11'));var authService=require(_0x5bef('0x12'));var qs=require(_0x5bef('0x13'));var as=require(_0x5bef('0x14'));var hardwareService=require(_0x5bef('0x15'));var logger=require(_0x5bef('0x16'))(_0x5bef('0x17'));var utils=require(_0x5bef('0x18'));var config=require(_0x5bef('0x19'));var licenseUtil=require(_0x5bef('0x1a'));var db=require(_0x5bef('0x1b'))['db'];function respondWithStatusCode(_0xf89f2f,_0x272e1a){_0x272e1a=_0x272e1a||0xcc;return function(_0x3b55ce){if(_0x3b55ce){return _0xf89f2f[_0x5bef('0x1c')](_0x272e1a);}return _0xf89f2f[_0x5bef('0x1d')](_0x272e1a)['end']();};}function respondWithResult(_0x5cdf22,_0x31f998){_0x31f998=_0x31f998||0xc8;return function(_0x10e9ae){if(_0x10e9ae){return _0x5cdf22[_0x5bef('0x1d')](_0x31f998)['json'](_0x10e9ae);}};}function respondWithFilteredResult(_0x2804d8,_0x498997){return function(_0x5afb4c){if(_0x5afb4c){var _0x469040=typeof _0x498997['offset']===_0x5bef('0x1e')&&typeof _0x498997[_0x5bef('0x1f')]===_0x5bef('0x1e');var _0x5aa121=_0x5afb4c[_0x5bef('0x20')];var _0x59d282=_0x469040?0x0:_0x498997['offset'];var _0x1bf7cd=_0x469040?_0x5afb4c[_0x5bef('0x20')]:_0x498997[_0x5bef('0x21')]+_0x498997[_0x5bef('0x1f')];var _0xc78bad;if(_0x1bf7cd>=_0x5aa121){_0x1bf7cd=_0x5aa121;_0xc78bad=0xc8;}else{_0xc78bad=0xce;}_0x2804d8[_0x5bef('0x1d')](_0xc78bad);return _0x2804d8[_0x5bef('0x22')]('Content-Range',_0x59d282+'-'+_0x1bf7cd+'/'+_0x5aa121)['json'](_0x5afb4c);}return null;};}function patchUpdates(_0x1fac7f){return function(_0x40ad5c){try{jsonpatch[_0x5bef('0x23')](_0x40ad5c,_0x1fac7f,!![]);}catch(_0x1cefdf){return BPromise['reject'](_0x1cefdf);}return _0x40ad5c[_0x5bef('0x24')]();};}function saveUpdates(_0x4a10fe,_0x2adaf1){return function(_0x16f86f){if(_0x16f86f){return _0x16f86f[_0x5bef('0x25')](_0x4a10fe)[_0x5bef('0x26')](function(_0x338792){return _0x338792;});}return null;};}function removeEntity(_0x250180,_0x1c436b){return function(_0xd1925f){if(_0xd1925f){return _0xd1925f[_0x5bef('0x27')]()[_0x5bef('0x26')](function(){var _0xd87322=_0xd1925f[_0x5bef('0x28')]({'plain':!![]});var _0x3164b4=_0x5bef('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x3164b4,'resourceId':_0xd87322['id']}})[_0x5bef('0x26')](function(){return _0xd1925f;});})[_0x5bef('0x26')](function(){_0x250180[_0x5bef('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9826a0,_0x1e7a5a){return function(_0x89d08b){if(!_0x89d08b){_0x9826a0[_0x5bef('0x1c')](0x194);}return _0x89d08b;};}function handleError(_0x34f1ed,_0x22ab3c){_0x22ab3c=_0x22ab3c||0x1f4;return function(_0x5ff323){logger[_0x5bef('0x2a')](_0x5ff323[_0x5bef('0x2b')]);if(_0x5ff323[_0x5bef('0x2c')]){delete _0x5ff323['name'];}_0x34f1ed[_0x5bef('0x1d')](_0x22ab3c)['send'](_0x5ff323);};}exports[_0x5bef('0x2d')]=function(_0x340490,_0x2b28c8){var _0x1e5c9a={},_0x4d3e63={},_0x2b8604={'count':0x0,'rows':[]};var _0x4c2a05=_[_0x5bef('0x2e')](db[_0x5bef('0x2f')][_0x5bef('0x30')],function(_0x4882b0){return{'name':_0x4882b0[_0x5bef('0x31')],'type':_0x4882b0['type']['key']};});_0x4d3e63[_0x5bef('0x32')]=_['map'](_0x4c2a05,'name');_0x4d3e63[_0x5bef('0x33')]=_['keys'](_0x340490[_0x5bef('0x33')]);_0x4d3e63[_0x5bef('0x34')]=_[_0x5bef('0x35')](_0x4d3e63[_0x5bef('0x32')],_0x4d3e63['query']);_0x1e5c9a['attributes']=_[_0x5bef('0x35')](_0x4d3e63['model'],qs[_0x5bef('0x36')](_0x340490[_0x5bef('0x33')][_0x5bef('0x36')]));_0x1e5c9a['attributes']=_0x1e5c9a[_0x5bef('0x37')][_0x5bef('0x38')]?_0x1e5c9a['attributes']:_0x4d3e63['model'];if(!_0x340490[_0x5bef('0x33')][_0x5bef('0x39')](_0x5bef('0x3a'))){_0x1e5c9a[_0x5bef('0x1f')]=qs['limit'](_0x340490['query'][_0x5bef('0x1f')]);_0x1e5c9a[_0x5bef('0x21')]=qs[_0x5bef('0x21')](_0x340490[_0x5bef('0x33')][_0x5bef('0x21')]);}_0x1e5c9a['order']=qs[_0x5bef('0x3b')](_0x340490['query']['sort']);_0x1e5c9a[_0x5bef('0x3c')]=qs['filters'](_['pick'](_0x340490[_0x5bef('0x33')],_0x4d3e63[_0x5bef('0x34')]),_0x4c2a05);if(_0x340490[_0x5bef('0x33')][_0x5bef('0x3d')]){_0x1e5c9a[_0x5bef('0x3c')]=_[_0x5bef('0x3e')](_0x1e5c9a[_0x5bef('0x3c')],{'$or':_[_0x5bef('0x2e')](_0x4c2a05,function(_0x43fac2){if(_0x43fac2[_0x5bef('0x3f')]!=='VIRTUAL'){var _0x45c17b={};_0x45c17b[_0x43fac2[_0x5bef('0x2c')]]={'$like':'%'+_0x340490[_0x5bef('0x33')][_0x5bef('0x3d')]+'%'};return _0x45c17b;}})});}_0x1e5c9a=_[_0x5bef('0x3e')]({},_0x1e5c9a,_0x340490[_0x5bef('0x40')]);var _0x487331={'where':_0x1e5c9a[_0x5bef('0x3c')]};return db[_0x5bef('0x2f')]['count'](_0x487331)[_0x5bef('0x26')](function(_0x1ea0c8){_0x2b8604['count']=_0x1ea0c8;if(_0x340490['query'][_0x5bef('0x41')]){_0x1e5c9a[_0x5bef('0x42')]=[{'all':!![]}];}return db[_0x5bef('0x2f')][_0x5bef('0x43')](_0x1e5c9a);})[_0x5bef('0x26')](function(_0x4427b1){_0x2b8604[_0x5bef('0x44')]=_0x4427b1;return _0x2b8604;})[_0x5bef('0x26')](respondWithFilteredResult(_0x2b28c8,_0x1e5c9a))[_0x5bef('0x45')](handleError(_0x2b28c8,null));};exports[_0x5bef('0x46')]=function(_0x1cd99e,_0x51b22a){var _0x1939cc={'raw':!![],'where':{'id':_0x1cd99e['params']['id']}},_0x523af7={};_0x523af7[_0x5bef('0x32')]=_[_0x5bef('0x47')](db[_0x5bef('0x2f')][_0x5bef('0x30')]);_0x523af7[_0x5bef('0x33')]=_['keys'](_0x1cd99e[_0x5bef('0x33')]);_0x523af7[_0x5bef('0x34')]=_[_0x5bef('0x35')](_0x523af7[_0x5bef('0x32')],_0x523af7[_0x5bef('0x33')]);_0x1939cc[_0x5bef('0x37')]=_[_0x5bef('0x35')](_0x523af7[_0x5bef('0x32')],qs['fields'](_0x1cd99e[_0x5bef('0x33')][_0x5bef('0x36')]));_0x1939cc[_0x5bef('0x37')]=_0x1939cc[_0x5bef('0x37')][_0x5bef('0x38')]?_0x1939cc['attributes']:_0x523af7['model'];if(_0x1cd99e[_0x5bef('0x33')][_0x5bef('0x41')]){_0x1939cc[_0x5bef('0x42')]=[{'all':!![]}];}_0x1939cc=_[_0x5bef('0x3e')]({},_0x1939cc,_0x1cd99e[_0x5bef('0x40')]);return db[_0x5bef('0x2f')]['find'](_0x1939cc)[_0x5bef('0x26')](handleEntityNotFound(_0x51b22a,null))[_0x5bef('0x26')](respondWithResult(_0x51b22a,null))[_0x5bef('0x45')](handleError(_0x51b22a,null));};exports[_0x5bef('0x48')]=function(_0x3c6392,_0x566d61){return db[_0x5bef('0x2f')][_0x5bef('0x48')](_0x3c6392['body'],{})[_0x5bef('0x26')](function(_0x1ff3a0){var _0x268b7a=_0x3c6392['user'][_0x5bef('0x28')]({'plain':!![]});if(!_0x268b7a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x268b7a[_0x5bef('0x49')]===_0x5bef('0x4a')){var _0x14a5b4=_0x1ff3a0[_0x5bef('0x28')]({'plain':!![]});var _0x206da3=_0x5bef('0x29');return db[_0x5bef('0x4b')][_0x5bef('0x4c')]({'where':{'name':_0x206da3,'userProfileId':_0x268b7a['userProfileId']},'raw':!![]})[_0x5bef('0x26')](function(_0x23bbed){if(_0x23bbed&&_0x23bbed[_0x5bef('0x4d')]===0x0){return db[_0x5bef('0x4e')][_0x5bef('0x48')]({'name':_0x14a5b4[_0x5bef('0x2c')],'resourceId':_0x14a5b4['id'],'type':_0x23bbed[_0x5bef('0x2c')],'sectionId':_0x23bbed['id']},{})[_0x5bef('0x26')](function(){return _0x1ff3a0;});}else{return _0x1ff3a0;}})['catch'](function(_0x29a3e0){logger['error'](_0x5bef('0x4f'),_0x29a3e0);throw _0x29a3e0;});}return _0x1ff3a0;})[_0x5bef('0x26')](respondWithResult(_0x566d61,0xc9))['catch'](handleError(_0x566d61,null));};exports[_0x5bef('0x25')]=function(_0x12a07c,_0x8228d){if(_0x12a07c[_0x5bef('0x50')]['id']){delete _0x12a07c[_0x5bef('0x50')]['id'];}return db[_0x5bef('0x2f')][_0x5bef('0x4c')]({'where':{'id':_0x12a07c[_0x5bef('0x51')]['id']}})[_0x5bef('0x26')](handleEntityNotFound(_0x8228d,null))[_0x5bef('0x26')](saveUpdates(_0x12a07c[_0x5bef('0x50')],null))[_0x5bef('0x26')](respondWithResult(_0x8228d,null))[_0x5bef('0x45')](handleError(_0x8228d,null));};exports[_0x5bef('0x27')]=function(_0xe22c00,_0x4c6ff3){return db['SquareOdbc'][_0x5bef('0x4c')]({'where':{'id':_0xe22c00['params']['id']}})[_0x5bef('0x26')](handleEntityNotFound(_0x4c6ff3,null))[_0x5bef('0x26')](removeEntity(_0x4c6ff3,null))[_0x5bef('0x45')](handleError(_0x4c6ff3,null));};exports[_0x5bef('0x52')]=function(_0x37d3de,_0x2f6803,_0x12543c){var _0x3419e3;return db[_0x5bef('0x2f')][_0x5bef('0x4c')]({'where':{'id':_0x37d3de['params']['id']},'attributes':['id',_0x5bef('0x53')]})[_0x5bef('0x26')](handleEntityNotFound(_0x2f6803,null))[_0x5bef('0x26')](function(_0x4b619b){if(_0x4b619b){var _0x5b4c8e=require(_0x5bef('0x54'))();_0x5b4c8e[_0x5bef('0x55')](_0x4b619b[_0x5bef('0x53')]);_0x5b4c8e[_0x5bef('0x56')]();return _0x4b619b;}})[_0x5bef('0x26')](respondWithResult(_0x2f6803,null))[_0x5bef('0x45')](handleError(_0x2f6803,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 4a4102a..15636e4 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 _0x93e2=['square_odbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareOdbc.attributes','exports','define'];(function(_0x26f9b1,_0x540b6f){var _0x2ec59a=function(_0x22bc8c){while(--_0x22bc8c){_0x26f9b1['push'](_0x26f9b1['shift']());}};_0x2ec59a(++_0x540b6f);}(_0x93e2,0x12c));var _0x293e=function(_0x21c309,_0x5af8d7){_0x21c309=_0x21c309-0x0;var _0x5a705b=_0x93e2[_0x21c309];return _0x5a705b;};'use strict';var _=require(_0x293e('0x0'));var util=require(_0x293e('0x1'));var logger=require(_0x293e('0x2'))(_0x293e('0x3'));var moment=require(_0x293e('0x4'));var BPromise=require(_0x293e('0x5'));var rp=require(_0x293e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x293e('0x7'));var config=require(_0x293e('0x8'));var attributes=require(_0x293e('0x9'));module[_0x293e('0xa')]=function(_0x2d1a78,_0x70c72a){return _0x2d1a78[_0x293e('0xb')]('SquareOdbc',attributes,{'tableName':_0x293e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb784=['rimraf','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x3eeb1b,_0x36a09c){var _0x4cce24=function(_0x5c48c5){while(--_0x5c48c5){_0x3eeb1b['push'](_0x3eeb1b['shift']());}};_0x4cce24(++_0x36a09c);}(_0xb784,0x16d));var _0x4b78=function(_0x5d5f70,_0x1bdeb8){_0x5d5f70=_0x5d5f70-0x0;var _0x2e03f1=_0xb784[_0x5d5f70];return _0x2e03f1;};'use strict';var _=require(_0x4b78('0x0'));var util=require(_0x4b78('0x1'));var logger=require(_0x4b78('0x2'))(_0x4b78('0x3'));var moment=require(_0x4b78('0x4'));var BPromise=require(_0x4b78('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b78('0x6'));var rimraf=require(_0x4b78('0x7'));var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0x4b78('0x8')]=function(_0x3ff1f5,_0x3965e7){return _0x3ff1f5[_0x4b78('0x9')](_0x4b78('0xa'),attributes,{'tableName':_0x4b78('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 1c2c006..da5c8ae 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 _0x6542=['where','attributes','include','map','model','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareOdbc','options','raw'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6542,0x1b7));var _0x2654=function(_0x49d14d,_0x408dbc){_0x49d14d=_0x49d14d-0x0;var _0x24638c=_0x6542[_0x49d14d];return _0x24638c;};'use strict';var _=require(_0x2654('0x0'));var util=require('util');var moment=require(_0x2654('0x1'));var BPromise=require('bluebird');var rs=require(_0x2654('0x2'));var fs=require('fs');var Redis=require(_0x2654('0x3'));var db=require(_0x2654('0x4'))['db'];var utils=require(_0x2654('0x5'));var logger=require(_0x2654('0x6'))('rpc');var config=require(_0x2654('0x7'));var jayson=require(_0x2654('0x8'));var client=jayson[_0x2654('0x9')][_0x2654('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42cf47,_0x2adad3,_0x110948){return new BPromise(function(_0x2fbb2b,_0x4e256c){return client['request'](_0x42cf47,_0x110948)[_0x2654('0xb')](function(_0x9d6500){logger[_0x2654('0xc')](_0x2654('0xd'),_0x2adad3,_0x2654('0xe'));logger[_0x2654('0xf')](_0x2654('0x10'),_0x2adad3,_0x2654('0xe'),JSON[_0x2654('0x11')](_0x9d6500));if(_0x9d6500[_0x2654('0x12')]){if(_0x9d6500[_0x2654('0x12')][_0x2654('0x13')]===0x1f4){logger[_0x2654('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x2adad3,_0x9d6500['error'][_0x2654('0x14')]);return _0x4e256c(_0x9d6500[_0x2654('0x12')][_0x2654('0x14')]);}logger[_0x2654('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x2adad3,_0x9d6500[_0x2654('0x12')][_0x2654('0x14')]);return _0x2fbb2b(_0x9d6500[_0x2654('0x12')][_0x2654('0x14')]);}else{logger[_0x2654('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x2adad3,_0x2654('0xe'));_0x2fbb2b(_0x9d6500[_0x2654('0x15')][_0x2654('0x14')]);}})[_0x2654('0x16')](function(_0x169c67){logger[_0x2654('0x12')](_0x2654('0xd'),_0x2adad3,_0x169c67);_0x4e256c(_0x169c67);});});}exports[_0x2654('0x17')]=function(_0x1e0e9d){var _0x4d378e=this;return new Promise(function(_0x1acd9f,_0x36c693){return db['SquareOdbc']['find']({'raw':_0x1e0e9d[_0x2654('0x18')]?_0x1e0e9d['options'][_0x2654('0x19')]===undefined?!![]:![]:!![],'where':_0x1e0e9d['options']?_0x1e0e9d[_0x2654('0x18')][_0x2654('0x1a')]||null:null,'attributes':_0x1e0e9d[_0x2654('0x18')]?_0x1e0e9d[_0x2654('0x18')][_0x2654('0x1b')]||null:null,'include':_0x1e0e9d[_0x2654('0x18')]?_0x1e0e9d['options'][_0x2654('0x1c')]?_[_0x2654('0x1d')](_0x1e0e9d[_0x2654('0x18')]['include'],function(_0x4f01e6){return{'model':db[_0x4f01e6[_0x2654('0x1e')]],'as':_0x4f01e6['as'],'attributes':_0x4f01e6['attributes'],'include':_0x4f01e6[_0x2654('0x1c')]?_[_0x2654('0x1d')](_0x4f01e6[_0x2654('0x1c')],function(_0x4c92b8){return{'model':db[_0x4c92b8[_0x2654('0x1e')]],'as':_0x4c92b8['as'],'attributes':_0x4c92b8['attributes'],'include':_0x4c92b8['include']?_[_0x2654('0x1d')](_0x4c92b8[_0x2654('0x1c')],function(_0x19efe0){return{'model':db[_0x19efe0[_0x2654('0x1e')]],'as':_0x19efe0['as'],'attributes':_0x19efe0[_0x2654('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2654('0xb')](function(_0x50d455){logger[_0x2654('0xc')]('ShowSquareOdbc',_0x1e0e9d);logger[_0x2654('0xf')](_0x2654('0x17'),_0x1e0e9d,JSON['stringify'](_0x50d455));_0x1acd9f(_0x50d455);})[_0x2654('0x16')](function(_0x411c54){logger['error'](_0x2654('0x17'),_0x411c54['message'],_0x1e0e9d);_0x36c693(_0x4d378e[_0x2654('0x12')](0x1f4,_0x411c54[_0x2654('0x14')]));});});}; \ No newline at end of file +var _0x09d9=['stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','result','ShowSquareOdbc','find','options','where','attributes','include','model','map','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s'];(function(_0x44dbe7,_0x35dcf1){var _0x18a387=function(_0x399848){while(--_0x399848){_0x44dbe7['push'](_0x44dbe7['shift']());}};_0x18a387(++_0x35dcf1);}(_0x09d9,0xaf));var _0x909d=function(_0x10096b,_0xbb107b){_0x10096b=_0x10096b-0x0;var _0xe26fa=_0x09d9[_0x10096b];return _0xe26fa;};'use strict';var _=require(_0x909d('0x0'));var util=require(_0x909d('0x1'));var moment=require(_0x909d('0x2'));var BPromise=require('bluebird');var rs=require(_0x909d('0x3'));var fs=require('fs');var Redis=require(_0x909d('0x4'));var db=require(_0x909d('0x5'))['db'];var utils=require(_0x909d('0x6'));var logger=require(_0x909d('0x7'))('rpc');var config=require(_0x909d('0x8'));var jayson=require(_0x909d('0x9'));var client=jayson[_0x909d('0xa')][_0x909d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1add40,_0x1e74ae,_0x91411b){return new BPromise(function(_0x16e600,_0x57f77e){return client[_0x909d('0xc')](_0x1add40,_0x91411b)[_0x909d('0xd')](function(_0x175dae){logger[_0x909d('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x1e74ae,_0x909d('0xf'));logger['debug'](_0x909d('0x10'),_0x1e74ae,_0x909d('0xf'),JSON[_0x909d('0x11')](_0x175dae));if(_0x175dae[_0x909d('0x12')]){if(_0x175dae['error'][_0x909d('0x13')]===0x1f4){logger[_0x909d('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x1e74ae,_0x175dae[_0x909d('0x12')]['message']);return _0x57f77e(_0x175dae['error'][_0x909d('0x14')]);}logger[_0x909d('0x12')](_0x909d('0x15'),_0x1e74ae,_0x175dae[_0x909d('0x12')][_0x909d('0x14')]);return _0x16e600(_0x175dae[_0x909d('0x12')]['message']);}else{logger[_0x909d('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x1e74ae,_0x909d('0xf'));_0x16e600(_0x175dae[_0x909d('0x16')][_0x909d('0x14')]);}})['catch'](function(_0x237928){logger[_0x909d('0x12')](_0x909d('0x15'),_0x1e74ae,_0x237928);_0x57f77e(_0x237928);});});}exports[_0x909d('0x17')]=function(_0x72c0f2){var _0x3812a0=this;return new Promise(function(_0x524963,_0x2a0e5a){return db['SquareOdbc'][_0x909d('0x18')]({'raw':_0x72c0f2['options']?_0x72c0f2[_0x909d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x72c0f2[_0x909d('0x19')]?_0x72c0f2[_0x909d('0x19')][_0x909d('0x1a')]||null:null,'attributes':_0x72c0f2[_0x909d('0x19')]?_0x72c0f2[_0x909d('0x19')][_0x909d('0x1b')]||null:null,'include':_0x72c0f2['options']?_0x72c0f2[_0x909d('0x19')][_0x909d('0x1c')]?_['map'](_0x72c0f2['options'][_0x909d('0x1c')],function(_0x476ef3){return{'model':db[_0x476ef3[_0x909d('0x1d')]],'as':_0x476ef3['as'],'attributes':_0x476ef3[_0x909d('0x1b')],'include':_0x476ef3[_0x909d('0x1c')]?_['map'](_0x476ef3[_0x909d('0x1c')],function(_0x21db7a){return{'model':db[_0x21db7a[_0x909d('0x1d')]],'as':_0x21db7a['as'],'attributes':_0x21db7a[_0x909d('0x1b')],'include':_0x21db7a[_0x909d('0x1c')]?_[_0x909d('0x1e')](_0x21db7a['include'],function(_0x2a83e2){return{'model':db[_0x2a83e2[_0x909d('0x1d')]],'as':_0x2a83e2['as'],'attributes':_0x2a83e2[_0x909d('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52c62c){logger[_0x909d('0xe')]('ShowSquareOdbc',_0x72c0f2);logger['debug'](_0x909d('0x17'),_0x72c0f2,JSON[_0x909d('0x11')](_0x52c62c));_0x524963(_0x52c62c);})[_0x909d('0x1f')](function(_0x330f02){logger['error'](_0x909d('0x17'),_0x330f02[_0x909d('0x14')],_0x72c0f2);_0x2a0e5a(_0x3812a0['error'](0x1f4,_0x330f02['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index fb2b683..d20abf0 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 _0x80fa=['multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete'];(function(_0x471e21,_0x5da25e){var _0x56a76e=function(_0x2e76c5){while(--_0x2e76c5){_0x471e21['push'](_0x471e21['shift']());}};_0x56a76e(++_0x5da25e);}(_0x80fa,0x6c));var _0xa80f=function(_0x4852f8,_0x19bbc9){_0x4852f8=_0x4852f8-0x0;var _0x115ff7=_0x80fa[_0x4852f8];return _0x115ff7;};'use strict';var multer=require(_0xa80f('0x0'));var util=require(_0xa80f('0x1'));var path=require(_0xa80f('0x2'));var timeout=require('connect-timeout');var express=require(_0xa80f('0x3'));var router=express['Router']();var fs_extra=require(_0xa80f('0x4'));var auth=require(_0xa80f('0x5'));var interaction=require(_0xa80f('0x6'));var config=require(_0xa80f('0x7'));var controller=require(_0xa80f('0x8'));router[_0xa80f('0x9')]('/',auth[_0xa80f('0xa')](),controller[_0xa80f('0xb')]);router[_0xa80f('0x9')](_0xa80f('0xc'),auth[_0xa80f('0xa')](),controller[_0xa80f('0xd')]);router[_0xa80f('0xe')]('/',auth['isAuthenticated'](),controller[_0xa80f('0xf')]);router[_0xa80f('0x10')](_0xa80f('0xc'),auth[_0xa80f('0xa')](),controller['update']);router[_0xa80f('0x11')](_0xa80f('0xc'),auth[_0xa80f('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xeb10=['/:id','update','delete','isAuthenticated','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','show','post','create','put'];(function(_0x144b30,_0x77072d){var _0x1bb7bc=function(_0x1082cc){while(--_0x1082cc){_0x144b30['push'](_0x144b30['shift']());}};_0x1bb7bc(++_0x77072d);}(_0xeb10,0x96));var _0x0eb1=function(_0x1e847f,_0x12e4dc){_0x1e847f=_0x1e847f-0x0;var _0xa413d6=_0xeb10[_0x1e847f];return _0xa413d6;};'use strict';var multer=require(_0x0eb1('0x0'));var util=require('util');var path=require(_0x0eb1('0x1'));var timeout=require(_0x0eb1('0x2'));var express=require(_0x0eb1('0x3'));var router=express[_0x0eb1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0eb1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0eb1('0x6'));var controller=require('./squareProject.controller');router[_0x0eb1('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0eb1('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x0eb1('0x8')]);router[_0x0eb1('0x9')]('/',auth['isAuthenticated'](),controller[_0x0eb1('0xa')]);router[_0x0eb1('0xb')](_0x0eb1('0xc'),auth['isAuthenticated'](),controller[_0x0eb1('0xd')]);router[_0x0eb1('0xe')](_0x0eb1('0xc'),auth[_0x0eb1('0xf')](),controller[_0x0eb1('0x10')]);module[_0x0eb1('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 9045628..eb94928 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 _0xa94b=['preproduction','toString','production','utf8','DATE','sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue'];(function(_0x3dfe27,_0x198b51){var _0x270930=function(_0x3bb23d){while(--_0x3bb23d){_0x3dfe27['push'](_0x3dfe27['shift']());}};_0x270930(++_0x198b51);}(_0xa94b,0x130));var _0xba94=function(_0x31c3b7,_0x3ad401){_0x31c3b7=_0x31c3b7-0x0;var _0xfbf491=_0xa94b[_0x31c3b7];return _0xfbf491;};'use strict';var Sequelize=require(_0xba94('0x0'));module[_0xba94('0x1')]={'name':{'type':Sequelize[_0xba94('0x2')],'unique':_0xba94('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xba94('0x4')]},'preproduction':{'type':Sequelize[_0xba94('0x5')](_0xba94('0x6')),'get':function(){if(this[_0xba94('0x7')](_0xba94('0x8'))){return this['getDataValue'](_0xba94('0x8'))[_0xba94('0x9')]('utf8');}}},'production':{'type':Sequelize['BLOB'](_0xba94('0x6')),'get':function(){if(this['getDataValue']('production')){return this['getDataValue'](_0xba94('0xa'))[_0xba94('0x9')](_0xba94('0xb'));}}},'savedAt':{'type':Sequelize[_0xba94('0xc')]},'publishedAt':{'type':Sequelize[_0xba94('0xc')]}}; \ No newline at end of file +var _0xa20f=['name','TEXT','BLOB','long','preproduction','getDataValue','toString','utf8','production','DATE','STRING'];(function(_0x39b997,_0x59e981){var _0x11b28e=function(_0x5c7034){while(--_0x5c7034){_0x39b997['push'](_0x39b997['shift']());}};_0x11b28e(++_0x59e981);}(_0xa20f,0x107));var _0xfa20=function(_0x251421,_0x34bf49){_0x251421=_0x251421-0x0;var _0xe9bbff=_0xa20f[_0x251421];return _0xe9bbff;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfa20('0x0')],'unique':_0xfa20('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xfa20('0x0')]},'notes':{'type':Sequelize[_0xfa20('0x2')]},'preproduction':{'type':Sequelize[_0xfa20('0x3')](_0xfa20('0x4')),'get':function(){if(this['getDataValue'](_0xfa20('0x5'))){return this[_0xfa20('0x6')](_0xfa20('0x5'))[_0xfa20('0x7')](_0xfa20('0x8'));}}},'production':{'type':Sequelize[_0xfa20('0x3')](_0xfa20('0x4')),'get':function(){if(this[_0xfa20('0x6')](_0xfa20('0x9'))){return this[_0xfa20('0x6')](_0xfa20('0x9'))[_0xfa20('0x7')]('utf8');}}},'savedAt':{'type':Sequelize[_0xfa20('0xa')]},'publishedAt':{'type':Sequelize[_0xfa20('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index d42fc5f..f90ecd8 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 _0xfe0e=['params','pick','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./squareProject.socket','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','UserProfileResource','publish','agi','stringify','sendStatus','stack','name','send','index','SquareProject','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','findAll','rows','show','fields','includeAll','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SquareProjects','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x15cc52,_0x167dca){var _0x47224b=function(_0x2046e6){while(--_0x2046e6){_0x15cc52['push'](_0x15cc52['shift']());}};_0x47224b(++_0x167dca);}(_0xfe0e,0x123));var _0xefe0=function(_0xdedef0,_0x16668c){_0xdedef0=_0xdedef0-0x0;var _0x248498=_0xfe0e[_0xdedef0];return _0x248498;};'use strict';var _=require(_0xefe0('0x0'));var Redis=require(_0xefe0('0x1'));var qs=require(_0xefe0('0x2'));var logger=require(_0xefe0('0x3'))(_0xefe0('0x4'));var config=require(_0xefe0('0x5'));var db=require(_0xefe0('0x6'))['db'];config[_0xefe0('0x7')]=_['defaults'](config['redis'],{'host':_0xefe0('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xefe0('0x7')]));require(_0xefe0('0x9'))['register'](socket);function respondWithResult(_0x2c2bc0,_0x41bfd0){_0x41bfd0=_0x41bfd0||0xc8;return function(_0x451bc0){if(_0x451bc0){return _0x2c2bc0[_0xefe0('0xa')](_0x41bfd0)[_0xefe0('0xb')](_0x451bc0);}};}function respondWithFilteredResult(_0x32282d,_0x49cbf2){return function(_0x200bdb){if(_0x200bdb){var _0x499d1e=typeof _0x49cbf2[_0xefe0('0xc')]===_0xefe0('0xd')&&typeof _0x49cbf2[_0xefe0('0xe')]==='undefined';var _0x25df09=_0x200bdb[_0xefe0('0xf')];var _0x16e5d2=_0x499d1e?0x0:_0x49cbf2[_0xefe0('0xc')];var _0x2eaf7e=_0x499d1e?_0x200bdb[_0xefe0('0xf')]:_0x49cbf2[_0xefe0('0xc')]+_0x49cbf2[_0xefe0('0xe')];var _0x57d4cb;if(_0x2eaf7e>=_0x25df09){_0x2eaf7e=_0x25df09;_0x57d4cb=0xc8;}else{_0x57d4cb=0xce;}_0x32282d['status'](_0x57d4cb);return _0x32282d[_0xefe0('0x10')](_0xefe0('0x11'),_0x16e5d2+'-'+_0x2eaf7e+'/'+_0x25df09)[_0xefe0('0xb')](_0x200bdb);}return null;};}function saveUpdates(_0x1a9bcf){return function(_0xc086b1){if(_0xc086b1){return _0xc086b1[_0xefe0('0x12')](_0x1a9bcf)[_0xefe0('0x13')](function(_0x9540d7){return _0x9540d7;});}return null;};}function removeEntity(_0x587140){return function(_0x4d61c0){if(_0x4d61c0){return _0x4d61c0[_0xefe0('0x14')]()['then'](function(){var _0xa2f5c2=_0x4d61c0[_0xefe0('0x15')]({'plain':!![]});var _0x2a1f70='SquareProjects';return db[_0xefe0('0x16')]['destroy']({'where':{'type':_0x2a1f70,'resourceId':_0xa2f5c2['id']}})[_0xefe0('0x13')](function(){return _0x4d61c0;});})[_0xefe0('0x13')](function(){var _0xabe18f=new Redis(config[_0xefe0('0x7')]);_0xabe18f[_0xefe0('0x17')](_0xefe0('0x18'),JSON[_0xefe0('0x19')]({'id':_0x4d61c0['id'],'deleted':!![]}));})[_0xefe0('0x13')](function(){_0x587140[_0xefe0('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x262740){return function(_0x1cef9a){if(!_0x1cef9a){_0x262740[_0xefe0('0x1a')](0x194);}return _0x1cef9a;};}function handleError(_0x237494,_0x99273c){_0x99273c=_0x99273c||0x1f4;return function(_0x5663b9){logger['error'](_0x5663b9[_0xefe0('0x1b')]);if(_0x5663b9[_0xefe0('0x1c')]){delete _0x5663b9['name'];}_0x237494[_0xefe0('0xa')](_0x99273c)[_0xefe0('0x1d')](_0x5663b9);};}exports[_0xefe0('0x1e')]=function(_0x48cc49,_0x4fbc9b){var _0x4cb0f4={},_0x53d3e4={},_0x4e8e60={'count':0x0,'rows':[]};var _0x4fafa5=_['map'](db[_0xefe0('0x1f')][_0xefe0('0x20')],function(_0x4efa97){return{'name':_0x4efa97['fieldName'],'type':_0x4efa97[_0xefe0('0x21')][_0xefe0('0x22')]};});_0x53d3e4[_0xefe0('0x23')]=_['map'](_0x4fafa5,_0xefe0('0x1c'));_0x53d3e4['query']=_[_0xefe0('0x24')](_0x48cc49['query']);_0x53d3e4[_0xefe0('0x25')]=_[_0xefe0('0x26')](_0x53d3e4['model'],_0x53d3e4[_0xefe0('0x27')]);_0x4cb0f4['attributes']=_[_0xefe0('0x26')](_0x53d3e4[_0xefe0('0x23')],qs['fields'](_0x48cc49[_0xefe0('0x27')]['fields']));_0x4cb0f4['attributes']=_0x4cb0f4[_0xefe0('0x28')][_0xefe0('0x29')]?_0x4cb0f4[_0xefe0('0x28')]:_0x53d3e4['model'];if(!_0x48cc49[_0xefe0('0x27')][_0xefe0('0x2a')](_0xefe0('0x2b'))){_0x4cb0f4[_0xefe0('0xe')]=qs['limit'](_0x48cc49['query'][_0xefe0('0xe')]);_0x4cb0f4[_0xefe0('0xc')]=qs['offset'](_0x48cc49[_0xefe0('0x27')][_0xefe0('0xc')]);}_0x4cb0f4[_0xefe0('0x2c')]=qs[_0xefe0('0x2d')](_0x48cc49[_0xefe0('0x27')]['sort']);_0x4cb0f4[_0xefe0('0x2e')]=qs[_0xefe0('0x25')](_['pick'](_0x48cc49[_0xefe0('0x27')],_0x53d3e4[_0xefe0('0x25')]),_0x4fafa5);if(_0x48cc49[_0xefe0('0x27')][_0xefe0('0x2f')]){_0x4cb0f4['where']=_[_0xefe0('0x30')](_0x4cb0f4['where'],{'$or':_[_0xefe0('0x31')](_0x4fafa5,function(_0x851009){if(_0x851009[_0xefe0('0x21')]!=='VIRTUAL'){var _0x30169a={};_0x30169a[_0x851009[_0xefe0('0x1c')]]={'$like':'%'+_0x48cc49[_0xefe0('0x27')][_0xefe0('0x2f')]+'%'};return _0x30169a;}})});}_0x4cb0f4=_[_0xefe0('0x30')]({},_0x4cb0f4,_0x48cc49['options']);var _0x2f2bbf={'where':_0x4cb0f4[_0xefe0('0x2e')]};return db[_0xefe0('0x1f')]['count'](_0x2f2bbf)[_0xefe0('0x13')](function(_0xbe53cb){_0x4e8e60[_0xefe0('0xf')]=_0xbe53cb;if(_0x48cc49[_0xefe0('0x27')]['includeAll']){_0x4cb0f4['include']=[{'all':!![]}];}return db['SquareProject'][_0xefe0('0x32')](_0x4cb0f4);})[_0xefe0('0x13')](function(_0x15af87){_0x4e8e60[_0xefe0('0x33')]=_0x15af87;return _0x4e8e60;})[_0xefe0('0x13')](respondWithFilteredResult(_0x4fbc9b,_0x4cb0f4))['catch'](handleError(_0x4fbc9b,null));};exports[_0xefe0('0x34')]=function(_0x1175f8,_0x593ef9){var _0x248e45={'raw':![],'where':{'id':_0x1175f8['params']['id']}},_0x2ce8c5={};_0x2ce8c5[_0xefe0('0x23')]=_[_0xefe0('0x24')](db[_0xefe0('0x1f')]['rawAttributes']);_0x2ce8c5[_0xefe0('0x27')]=_[_0xefe0('0x24')](_0x1175f8[_0xefe0('0x27')]);_0x2ce8c5['filters']=_[_0xefe0('0x26')](_0x2ce8c5[_0xefe0('0x23')],_0x2ce8c5[_0xefe0('0x27')]);_0x248e45[_0xefe0('0x28')]=_['intersection'](_0x2ce8c5[_0xefe0('0x23')],qs['fields'](_0x1175f8[_0xefe0('0x27')][_0xefe0('0x35')]));_0x248e45[_0xefe0('0x28')]=_0x248e45[_0xefe0('0x28')][_0xefe0('0x29')]?_0x248e45[_0xefe0('0x28')]:_0x2ce8c5[_0xefe0('0x23')];if(_0x1175f8[_0xefe0('0x27')][_0xefe0('0x36')]){_0x248e45['include']=[{'all':!![]}];}_0x248e45=_['merge']({},_0x248e45,_0x1175f8[_0xefe0('0x37')]);return db[_0xefe0('0x1f')][_0xefe0('0x38')](_0x248e45)[_0xefe0('0x13')](handleEntityNotFound(_0x593ef9,null))['then'](respondWithResult(_0x593ef9,null))[_0xefe0('0x39')](handleError(_0x593ef9,null));};exports[_0xefe0('0x3a')]=function(_0x58b5b1,_0x1a842b){return db[_0xefe0('0x1f')][_0xefe0('0x3a')](_0x58b5b1[_0xefe0('0x3b')],{})[_0xefe0('0x13')](function(_0x562546){var _0x594054=_0x58b5b1['user'][_0xefe0('0x15')]({'plain':!![]});if(!_0x594054)throw new Error(_0xefe0('0x3c'));if(_0x594054[_0xefe0('0x3d')]===_0xefe0('0x3e')){var _0x583b41=_0x562546[_0xefe0('0x15')]({'plain':!![]});var _0x59cff4=_0xefe0('0x3f');return db[_0xefe0('0x40')][_0xefe0('0x38')]({'where':{'name':_0x59cff4,'userProfileId':_0x594054[_0xefe0('0x41')]},'raw':!![]})[_0xefe0('0x13')](function(_0x58fe78){if(_0x58fe78&&_0x58fe78[_0xefe0('0x42')]===0x0){return db[_0xefe0('0x16')][_0xefe0('0x3a')]({'name':_0x583b41['name'],'resourceId':_0x583b41['id'],'type':_0x58fe78[_0xefe0('0x1c')],'sectionId':_0x58fe78['id']},{})[_0xefe0('0x13')](function(){return _0x562546;});}else{return _0x562546;}})[_0xefe0('0x39')](function(_0x28da4e){logger[_0xefe0('0x43')](_0xefe0('0x44'),_0x28da4e);throw _0x28da4e;});}return _0x562546;})[_0xefe0('0x13')](respondWithResult(_0x1a842b,0xc9))[_0xefe0('0x39')](handleError(_0x1a842b,null));};exports[_0xefe0('0x12')]=function(_0x120292,_0x1ffc37){if(_0x120292['body']['id']){delete _0x120292[_0xefe0('0x3b')]['id'];}return db[_0xefe0('0x1f')][_0xefe0('0x38')]({'where':{'id':_0x120292[_0xefe0('0x45')]['id']}})[_0xefe0('0x13')](handleEntityNotFound(_0x1ffc37,null))[_0xefe0('0x13')](saveUpdates(_0x120292['body'],null))[_0xefe0('0x13')](function(_0x563c8d){if(!_0x563c8d)return;var _0x39f52f=_0x563c8d[_0xefe0('0x15')]({'plain':!![]});return _0x39f52f;})[_0xefe0('0x13')](function(_0x1449b3){var _0x56b4e9=new Redis(config[_0xefe0('0x7')]);_0x56b4e9['publish'](_0xefe0('0x18'),JSON[_0xefe0('0x19')](_[_0xefe0('0x46')](_0x1449b3,['id',_0xefe0('0x1c'),_0xefe0('0x47')])));return _0x1449b3;})[_0xefe0('0x13')](respondWithResult(_0x1ffc37,null))[_0xefe0('0x39')](handleError(_0x1ffc37,null));};exports[_0xefe0('0x14')]=function(_0x581883,_0xd79136){return db[_0xefe0('0x1f')]['find']({'where':{'id':_0x581883[_0xefe0('0x45')]['id']}})['then'](handleEntityNotFound(_0xd79136,null))[_0xefe0('0x13')](removeEntity(_0xd79136,null))[_0xefe0('0x39')](handleError(_0xd79136,null));}; \ No newline at end of file +var _0xb237=['SquareProject','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','production','find','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','undefined','limit','count','offset','set','Content-Range','update','then','get','SquareProjects','destroy','publish','agi','stringify','end','sendStatus','name','send','index','map'];(function(_0xbc5c0c,_0x330004){var _0x244f6e=function(_0x1ad32d){while(--_0x1ad32d){_0xbc5c0c['push'](_0xbc5c0c['shift']());}};_0x244f6e(++_0x330004);}(_0xb237,0x148));var _0x7b23=function(_0x2aa7de,_0x34da8c){_0x2aa7de=_0x2aa7de-0x0;var _0x3144e7=_0xb237[_0x2aa7de];return _0x3144e7;};'use strict';var _=require(_0x7b23('0x0'));var Redis=require('ioredis');var qs=require(_0x7b23('0x1'));var logger=require(_0x7b23('0x2'))('api');var config=require(_0x7b23('0x3'));var db=require(_0x7b23('0x4'))['db'];config[_0x7b23('0x5')]=_[_0x7b23('0x6')](config[_0x7b23('0x5')],{'host':_0x7b23('0x7'),'port':0x18eb});var socket=require(_0x7b23('0x8'))(new Redis(config[_0x7b23('0x5')]));require('./squareProject.socket')[_0x7b23('0x9')](socket);function respondWithResult(_0x4a9389,_0x1ad7c2){_0x1ad7c2=_0x1ad7c2||0xc8;return function(_0x4b6bcf){if(_0x4b6bcf){return _0x4a9389[_0x7b23('0xa')](_0x1ad7c2)[_0x7b23('0xb')](_0x4b6bcf);}};}function respondWithFilteredResult(_0x10dbda,_0xf3266f){return function(_0x5414a7){if(_0x5414a7){var _0x5a0213=typeof _0xf3266f['offset']===_0x7b23('0xc')&&typeof _0xf3266f[_0x7b23('0xd')]===_0x7b23('0xc');var _0x474bc1=_0x5414a7[_0x7b23('0xe')];var _0x237047=_0x5a0213?0x0:_0xf3266f['offset'];var _0x15fe5f=_0x5a0213?_0x5414a7[_0x7b23('0xe')]:_0xf3266f[_0x7b23('0xf')]+_0xf3266f[_0x7b23('0xd')];var _0x13ae4c;if(_0x15fe5f>=_0x474bc1){_0x15fe5f=_0x474bc1;_0x13ae4c=0xc8;}else{_0x13ae4c=0xce;}_0x10dbda[_0x7b23('0xa')](_0x13ae4c);return _0x10dbda[_0x7b23('0x10')](_0x7b23('0x11'),_0x237047+'-'+_0x15fe5f+'/'+_0x474bc1)[_0x7b23('0xb')](_0x5414a7);}return null;};}function saveUpdates(_0x35e7f5){return function(_0x1e35a1){if(_0x1e35a1){return _0x1e35a1[_0x7b23('0x12')](_0x35e7f5)[_0x7b23('0x13')](function(_0x107e77){return _0x107e77;});}return null;};}function removeEntity(_0x544580){return function(_0x25886b){if(_0x25886b){return _0x25886b['destroy']()['then'](function(){var _0x453ff1=_0x25886b[_0x7b23('0x14')]({'plain':!![]});var _0x351482=_0x7b23('0x15');return db['UserProfileResource'][_0x7b23('0x16')]({'where':{'type':_0x351482,'resourceId':_0x453ff1['id']}})[_0x7b23('0x13')](function(){return _0x25886b;});})[_0x7b23('0x13')](function(){var _0x9faafc=new Redis(config['redis']);_0x9faafc[_0x7b23('0x17')](_0x7b23('0x18'),JSON[_0x7b23('0x19')]({'id':_0x25886b['id'],'deleted':!![]}));})[_0x7b23('0x13')](function(){_0x544580[_0x7b23('0xa')](0xcc)[_0x7b23('0x1a')]();});}};}function handleEntityNotFound(_0x1cb46c){return function(_0x130c27){if(!_0x130c27){_0x1cb46c[_0x7b23('0x1b')](0x194);}return _0x130c27;};}function handleError(_0x1ec5b8,_0x54c295){_0x54c295=_0x54c295||0x1f4;return function(_0x5d9fe0){logger['error'](_0x5d9fe0['stack']);if(_0x5d9fe0[_0x7b23('0x1c')]){delete _0x5d9fe0[_0x7b23('0x1c')];}_0x1ec5b8[_0x7b23('0xa')](_0x54c295)[_0x7b23('0x1d')](_0x5d9fe0);};}exports[_0x7b23('0x1e')]=function(_0x237997,_0xddf13d){var _0xf4b533={},_0x5b3d82={},_0x931198={'count':0x0,'rows':[]};var _0x46f4c8=_[_0x7b23('0x1f')](db[_0x7b23('0x20')][_0x7b23('0x21')],function(_0x588f75){return{'name':_0x588f75['fieldName'],'type':_0x588f75[_0x7b23('0x22')]['key']};});_0x5b3d82[_0x7b23('0x23')]=_[_0x7b23('0x1f')](_0x46f4c8,_0x7b23('0x1c'));_0x5b3d82[_0x7b23('0x24')]=_[_0x7b23('0x25')](_0x237997[_0x7b23('0x24')]);_0x5b3d82[_0x7b23('0x26')]=_[_0x7b23('0x27')](_0x5b3d82[_0x7b23('0x23')],_0x5b3d82[_0x7b23('0x24')]);_0xf4b533['attributes']=_[_0x7b23('0x27')](_0x5b3d82[_0x7b23('0x23')],qs[_0x7b23('0x28')](_0x237997[_0x7b23('0x24')][_0x7b23('0x28')]));_0xf4b533[_0x7b23('0x29')]=_0xf4b533[_0x7b23('0x29')][_0x7b23('0x2a')]?_0xf4b533[_0x7b23('0x29')]:_0x5b3d82['model'];if(!_0x237997['query']['hasOwnProperty'](_0x7b23('0x2b'))){_0xf4b533[_0x7b23('0xd')]=qs['limit'](_0x237997['query']['limit']);_0xf4b533[_0x7b23('0xf')]=qs[_0x7b23('0xf')](_0x237997[_0x7b23('0x24')][_0x7b23('0xf')]);}_0xf4b533[_0x7b23('0x2c')]=qs['sort'](_0x237997[_0x7b23('0x24')][_0x7b23('0x2d')]);_0xf4b533['where']=qs[_0x7b23('0x26')](_['pick'](_0x237997[_0x7b23('0x24')],_0x5b3d82[_0x7b23('0x26')]),_0x46f4c8);if(_0x237997[_0x7b23('0x24')][_0x7b23('0x2e')]){_0xf4b533[_0x7b23('0x2f')]=_[_0x7b23('0x30')](_0xf4b533['where'],{'$or':_[_0x7b23('0x1f')](_0x46f4c8,function(_0x5599ab){if(_0x5599ab[_0x7b23('0x22')]!==_0x7b23('0x31')){var _0x2c14a9={};_0x2c14a9[_0x5599ab[_0x7b23('0x1c')]]={'$like':'%'+_0x237997[_0x7b23('0x24')]['filter']+'%'};return _0x2c14a9;}})});}_0xf4b533=_[_0x7b23('0x30')]({},_0xf4b533,_0x237997['options']);var _0x21e0b1={'where':_0xf4b533['where']};return db[_0x7b23('0x20')]['count'](_0x21e0b1)['then'](function(_0x33b3a9){_0x931198[_0x7b23('0xe')]=_0x33b3a9;if(_0x237997[_0x7b23('0x24')][_0x7b23('0x32')]){_0xf4b533[_0x7b23('0x33')]=[{'all':!![]}];}return db[_0x7b23('0x20')][_0x7b23('0x34')](_0xf4b533);})[_0x7b23('0x13')](function(_0x3c3c6c){_0x931198[_0x7b23('0x35')]=_0x3c3c6c;return _0x931198;})[_0x7b23('0x13')](respondWithFilteredResult(_0xddf13d,_0xf4b533))[_0x7b23('0x36')](handleError(_0xddf13d,null));};exports[_0x7b23('0x37')]=function(_0x589f77,_0x37ab41){var _0x2c2bea={'raw':![],'where':{'id':_0x589f77[_0x7b23('0x38')]['id']}},_0x225128={};_0x225128[_0x7b23('0x23')]=_[_0x7b23('0x25')](db['SquareProject']['rawAttributes']);_0x225128[_0x7b23('0x24')]=_[_0x7b23('0x25')](_0x589f77[_0x7b23('0x24')]);_0x225128[_0x7b23('0x26')]=_['intersection'](_0x225128['model'],_0x225128[_0x7b23('0x24')]);_0x2c2bea[_0x7b23('0x29')]=_[_0x7b23('0x27')](_0x225128[_0x7b23('0x23')],qs[_0x7b23('0x28')](_0x589f77['query'][_0x7b23('0x28')]));_0x2c2bea['attributes']=_0x2c2bea[_0x7b23('0x29')]['length']?_0x2c2bea['attributes']:_0x225128[_0x7b23('0x23')];if(_0x589f77['query'][_0x7b23('0x32')]){_0x2c2bea[_0x7b23('0x33')]=[{'all':!![]}];}_0x2c2bea=_['merge']({},_0x2c2bea,_0x589f77[_0x7b23('0x39')]);return db['SquareProject']['find'](_0x2c2bea)['then'](handleEntityNotFound(_0x37ab41,null))[_0x7b23('0x13')](respondWithResult(_0x37ab41,null))['catch'](handleError(_0x37ab41,null));};exports['create']=function(_0x4274ec,_0x92eeec){return db[_0x7b23('0x20')][_0x7b23('0x3a')](_0x4274ec[_0x7b23('0x3b')],{})['then'](function(_0x476410){var _0x270be6=_0x4274ec[_0x7b23('0x3c')][_0x7b23('0x14')]({'plain':!![]});if(!_0x270be6)throw new Error(_0x7b23('0x3d'));if(_0x270be6[_0x7b23('0x3e')]===_0x7b23('0x3c')){var _0x91373f=_0x476410[_0x7b23('0x14')]({'plain':!![]});var _0x10da9b=_0x7b23('0x15');return db[_0x7b23('0x3f')]['find']({'where':{'name':_0x10da9b,'userProfileId':_0x270be6[_0x7b23('0x40')]},'raw':!![]})['then'](function(_0xba6f10){if(_0xba6f10&&_0xba6f10[_0x7b23('0x41')]===0x0){return db[_0x7b23('0x42')][_0x7b23('0x3a')]({'name':_0x91373f[_0x7b23('0x1c')],'resourceId':_0x91373f['id'],'type':_0xba6f10[_0x7b23('0x1c')],'sectionId':_0xba6f10['id']},{})[_0x7b23('0x13')](function(){return _0x476410;});}else{return _0x476410;}})[_0x7b23('0x36')](function(_0x52a005){logger[_0x7b23('0x43')](_0x7b23('0x44'),_0x52a005);throw _0x52a005;});}return _0x476410;})[_0x7b23('0x13')](respondWithResult(_0x92eeec,0xc9))['catch'](handleError(_0x92eeec,null));};exports['update']=function(_0x271939,_0x381584){if(_0x271939[_0x7b23('0x3b')]['id']){delete _0x271939[_0x7b23('0x3b')]['id'];}return db[_0x7b23('0x20')]['find']({'where':{'id':_0x271939[_0x7b23('0x38')]['id']}})['then'](handleEntityNotFound(_0x381584,null))[_0x7b23('0x13')](saveUpdates(_0x271939[_0x7b23('0x3b')],null))[_0x7b23('0x13')](function(_0x56ed3c){if(!_0x56ed3c)return;var _0x3ca69e=_0x56ed3c[_0x7b23('0x14')]({'plain':!![]});return _0x3ca69e;})[_0x7b23('0x13')](function(_0x381de1){var _0x344bae=new Redis(config['redis']);_0x344bae['publish'](_0x7b23('0x18'),JSON[_0x7b23('0x19')](_[_0x7b23('0x45')](_0x381de1,['id',_0x7b23('0x1c'),_0x7b23('0x46')])));return _0x381de1;})[_0x7b23('0x13')](respondWithResult(_0x381584,null))[_0x7b23('0x36')](handleError(_0x381584,null));};exports[_0x7b23('0x16')]=function(_0x1bba41,_0x177113){return db[_0x7b23('0x20')][_0x7b23('0x47')]({'where':{'id':_0x1bba41[_0x7b23('0x38')]['id']}})['then'](handleEntityNotFound(_0x177113,null))[_0x7b23('0x13')](removeEntity(_0x177113,null))[_0x7b23('0x36')](handleError(_0x177113,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index c52cde9..f55e24e 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 _0x4963=['events','../../mysqldb','SquareProject','setMaxListeners','save','update','emit','hasOwnProperty','exports'];(function(_0xedf90b,_0x18089c){var _0x66fb=function(_0x5a6cb2){while(--_0x5a6cb2){_0xedf90b['push'](_0xedf90b['shift']());}};_0x66fb(++_0x18089c);}(_0x4963,0x19e));var _0x3496=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4963[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x3496('0x0'));var SquareProject=require(_0x3496('0x1'))['db'][_0x3496('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x3496('0x3')](0x0);var events={'afterCreate':_0x3496('0x4'),'afterUpdate':_0x3496('0x5'),'afterDestroy':'remove'};function emitEvent(_0x134575){return function(_0x520f3a,_0x39fe1d,_0x100f13){SquareProjectEvents[_0x3496('0x6')](_0x134575+':'+_0x520f3a['id'],_0x520f3a);SquareProjectEvents[_0x3496('0x6')](_0x134575,_0x520f3a);_0x100f13(null);};}for(var e in events){if(events[_0x3496('0x7')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x3496('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x7b43=['events','../../mysqldb','setMaxListeners','update','emit','hook','exports'];(function(_0x2ecac5,_0x47fdd2){var _0x40e663=function(_0x4cc999){while(--_0x4cc999){_0x2ecac5['push'](_0x2ecac5['shift']());}};_0x40e663(++_0x47fdd2);}(_0x7b43,0x11f));var _0x37b4=function(_0x17dc5d,_0x3b23e3){_0x17dc5d=_0x17dc5d-0x0;var _0x2be82f=_0x7b43[_0x17dc5d];return _0x2be82f;};'use strict';var EventEmitter=require(_0x37b4('0x0'));var SquareProject=require(_0x37b4('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x37b4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x37b4('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3dfab9){return function(_0x4d452b,_0xee6365,_0x45cb90){SquareProjectEvents['emit'](_0x3dfab9+':'+_0x4d452b['id'],_0x4d452b);SquareProjectEvents[_0x37b4('0x4')](_0x3dfab9,_0x4d452b);_0x45cb90(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x37b4('0x5')](e,emitEvent(event));}}module[_0x37b4('0x6')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 6fc2770..8360c13 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 _0x8b1f=['./squareProject.attributes','exports','define','changed','preproduction','savedAt','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8b1f,0xda));var _0xf8b1=function(_0x32672b,_0x20f3c6){_0x32672b=_0x32672b-0x0;var _0x3d0bed=_0x8b1f[_0x32672b];return _0x3d0bed;};'use strict';var _=require(_0xf8b1('0x0'));var util=require(_0xf8b1('0x1'));var logger=require(_0xf8b1('0x2'))('api');var moment=require(_0xf8b1('0x3'));var BPromise=require(_0xf8b1('0x4'));var rp=require(_0xf8b1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf8b1('0x6'));module[_0xf8b1('0x7')]=function(_0x4e0663,_0x4e1914){return _0x4e0663[_0xf8b1('0x8')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e474b,_0x14b914,_0x3077cc){if(_0x1e474b[_0xf8b1('0x9')](_0xf8b1('0xa'))){_0x1e474b[_0xf8b1('0xb')]=moment()[_0xf8b1('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x1e474b[_0xf8b1('0x9')](_0xf8b1('0xd'))){_0x1e474b[_0xf8b1('0xe')]=moment()['format'](_0xf8b1('0xf'));}_0x3077cc(null,_0x1e474b);}}});}; \ No newline at end of file +var _0x901e=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','SquareProject','square_projects','changed','preproduction','production','publishedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1e1249,_0x2f9b30){var _0x2e0290=function(_0x50c69b){while(--_0x50c69b){_0x1e1249['push'](_0x1e1249['shift']());}};_0x2e0290(++_0x2f9b30);}(_0x901e,0x1cb));var _0xe901=function(_0x2e4ee7,_0x4bdc11){_0x2e4ee7=_0x2e4ee7-0x0;var _0x49e2e8=_0x901e[_0x2e4ee7];return _0x49e2e8;};'use strict';var _=require('lodash');var util=require(_0xe901('0x0'));var logger=require(_0xe901('0x1'))(_0xe901('0x2'));var moment=require('moment');var BPromise=require(_0xe901('0x3'));var rp=require(_0xe901('0x4'));var fs=require('fs');var path=require(_0xe901('0x5'));var rimraf=require(_0xe901('0x6'));var config=require('../../config/environment');var attributes=require('./squareProject.attributes');module[_0xe901('0x7')]=function(_0x2f47fc,_0x30fa64){return _0x2f47fc[_0xe901('0x8')](_0xe901('0x9'),attributes,{'tableName':_0xe901('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a9bdb,_0x56122f,_0x5f42d1){if(_0x1a9bdb[_0xe901('0xb')](_0xe901('0xc'))){_0x1a9bdb['savedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x1a9bdb['changed'](_0xe901('0xd'))){_0x1a9bdb[_0xe901('0xe')]=moment()[_0xe901('0xf')](_0xe901('0x10'));}_0x5f42d1(null,_0x1a9bdb);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 0a1cdeb..ef920eb 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 _0x3e19=['raw','attributes','limit','include','map','model','then','info','debug','stringify','error','message','ShowSquareProject','find','where','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options'];(function(_0x4b7798,_0x4a3be7){var _0x5c71ca=function(_0x495581){while(--_0x495581){_0x4b7798['push'](_0x4b7798['shift']());}};_0x5c71ca(++_0x4a3be7);}(_0x3e19,0x1d1));var _0x93e1=function(_0x888385,_0x9cdc66){_0x888385=_0x888385-0x0;var _0x22d5c2=_0x3e19[_0x888385];return _0x22d5c2;};'use strict';var _=require(_0x93e1('0x0'));var Redis=require(_0x93e1('0x1'));var db=require(_0x93e1('0x2'))['db'];var logger=require(_0x93e1('0x3'))(_0x93e1('0x4'));var config=require(_0x93e1('0x5'));config[_0x93e1('0x6')]=_[_0x93e1('0x7')](config[_0x93e1('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x93e1('0x8'))(new Redis(config[_0x93e1('0x6')]));require(_0x93e1('0x9'))[_0x93e1('0xa')](socket);exports[_0x93e1('0xb')]=function(_0x1be4d8){var _0x3fffbe=this;return new Promise(function(_0x36fb64,_0x397f8e){return db[_0x93e1('0xc')][_0x93e1('0xd')]({'raw':_0x1be4d8['options']?_0x1be4d8[_0x93e1('0xe')][_0x93e1('0xf')]===undefined?!![]:![]:!![],'where':_0x1be4d8[_0x93e1('0xe')]?_0x1be4d8[_0x93e1('0xe')]['where']||null:null,'attributes':_0x1be4d8[_0x93e1('0xe')]?_0x1be4d8[_0x93e1('0xe')][_0x93e1('0x10')]||null:null,'limit':_0x1be4d8[_0x93e1('0xe')]?_0x1be4d8[_0x93e1('0xe')][_0x93e1('0x11')]||null:null,'include':_0x1be4d8[_0x93e1('0xe')]?_0x1be4d8[_0x93e1('0xe')][_0x93e1('0x12')]?_[_0x93e1('0x13')](_0x1be4d8[_0x93e1('0xe')]['include'],function(_0x4dcefc){return{'model':db[_0x4dcefc['model']],'as':_0x4dcefc['as'],'attributes':_0x4dcefc[_0x93e1('0x10')],'include':_0x4dcefc[_0x93e1('0x12')]?_[_0x93e1('0x13')](_0x4dcefc[_0x93e1('0x12')],function(_0x2c2e0b){return{'model':db[_0x2c2e0b['model']],'as':_0x2c2e0b['as'],'attributes':_0x2c2e0b[_0x93e1('0x10')],'include':_0x2c2e0b[_0x93e1('0x12')]?_[_0x93e1('0x13')](_0x2c2e0b[_0x93e1('0x12')],function(_0x5922c2){return{'model':db[_0x5922c2[_0x93e1('0x14')]],'as':_0x5922c2['as'],'attributes':_0x5922c2[_0x93e1('0x10')]};}):[]};}):[]};}):[]:[]})[_0x93e1('0x15')](function(_0x509a92){logger[_0x93e1('0x16')](_0x93e1('0xb'),_0x1be4d8);logger[_0x93e1('0x17')]('GetSquareProjects',_0x1be4d8,JSON[_0x93e1('0x18')](_0x509a92));_0x36fb64(_0x509a92);})['catch'](function(_0x51a91e){logger[_0x93e1('0x19')](_0x93e1('0xb'),_0x51a91e[_0x93e1('0x1a')],_0x1be4d8);_0x397f8e(_0x3fffbe[_0x93e1('0x19')](0x1f4,_0x51a91e['message']));});});};exports[_0x93e1('0x1b')]=function(_0x5c4040){var _0x3b0a83=this;return new Promise(function(_0x3e51bd,_0x1d0e95){return db[_0x93e1('0xc')][_0x93e1('0x1c')]({'raw':_0x5c4040[_0x93e1('0xe')]?_0x5c4040['options']['raw']===undefined?!![]:![]:!![],'where':_0x5c4040[_0x93e1('0xe')]?_0x5c4040[_0x93e1('0xe')][_0x93e1('0x1d')]||null:null,'attributes':_0x5c4040[_0x93e1('0xe')]?_0x5c4040[_0x93e1('0xe')][_0x93e1('0x10')]||null:null,'include':_0x5c4040[_0x93e1('0xe')]?_0x5c4040['options'][_0x93e1('0x12')]?_['map'](_0x5c4040[_0x93e1('0xe')][_0x93e1('0x12')],function(_0x593927){return{'model':db[_0x593927['model']],'as':_0x593927['as'],'attributes':_0x593927[_0x93e1('0x10')],'include':_0x593927[_0x93e1('0x12')]?_[_0x93e1('0x13')](_0x593927[_0x93e1('0x12')],function(_0x3c3f57){return{'model':db[_0x3c3f57['model']],'as':_0x3c3f57['as'],'attributes':_0x3c3f57[_0x93e1('0x10')],'include':_0x3c3f57[_0x93e1('0x12')]?_['map'](_0x3c3f57[_0x93e1('0x12')],function(_0x27d487){return{'model':db[_0x27d487[_0x93e1('0x14')]],'as':_0x27d487['as'],'attributes':_0x27d487[_0x93e1('0x10')]};}):[]};}):[]};}):[]:[]})[_0x93e1('0x15')](function(_0x389a9b){logger['info']('ShowSquareProject',_0x5c4040);logger[_0x93e1('0x17')](_0x93e1('0x1b'),_0x5c4040,JSON[_0x93e1('0x18')](_0x389a9b));_0x3e51bd(_0x389a9b);})['catch'](function(_0x3f7414){logger[_0x93e1('0x19')](_0x93e1('0x1b'),_0x3f7414[_0x93e1('0x1a')],_0x5c4040);_0x1d0e95(_0x3b0a83['error'](0x1f4,_0x3f7414[_0x93e1('0x1a')]));});});}; \ No newline at end of file +var _0xa838=['ShowSquareProject','find','where','info','lodash','ioredis','rpc','redis','localhost','./squareProject.socket','SquareProject','findAll','options','attributes','map','include','model','then','debug','stringify','catch','GetSquareProjects','error','message'];(function(_0x3b475a,_0x83e1ba){var _0x40d8c6=function(_0x21aa67){while(--_0x21aa67){_0x3b475a['push'](_0x3b475a['shift']());}};_0x40d8c6(++_0x83e1ba);}(_0xa838,0x7c));var _0x8a83=function(_0x38b098,_0x5c594c){_0x38b098=_0x38b098-0x0;var _0x1f0399=_0xa838[_0x38b098];return _0x1f0399;};'use strict';var _=require(_0x8a83('0x0'));var Redis=require(_0x8a83('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x8a83('0x2'));var config=require('../../config/environment');config[_0x8a83('0x3')]=_['defaults'](config['redis'],{'host':_0x8a83('0x4'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8a83('0x3')]));require(_0x8a83('0x5'))['register'](socket);exports['GetSquareProjects']=function(_0x16cf4b){var _0x50a692=this;return new Promise(function(_0x29b6f2,_0x4ad86d){return db[_0x8a83('0x6')][_0x8a83('0x7')]({'raw':_0x16cf4b['options']?_0x16cf4b[_0x8a83('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x16cf4b[_0x8a83('0x8')]?_0x16cf4b[_0x8a83('0x8')]['where']||null:null,'attributes':_0x16cf4b[_0x8a83('0x8')]?_0x16cf4b[_0x8a83('0x8')][_0x8a83('0x9')]||null:null,'limit':_0x16cf4b[_0x8a83('0x8')]?_0x16cf4b[_0x8a83('0x8')]['limit']||null:null,'include':_0x16cf4b[_0x8a83('0x8')]?_0x16cf4b[_0x8a83('0x8')]['include']?_[_0x8a83('0xa')](_0x16cf4b[_0x8a83('0x8')][_0x8a83('0xb')],function(_0x150565){return{'model':db[_0x150565['model']],'as':_0x150565['as'],'attributes':_0x150565[_0x8a83('0x9')],'include':_0x150565['include']?_[_0x8a83('0xa')](_0x150565[_0x8a83('0xb')],function(_0x4e0783){return{'model':db[_0x4e0783['model']],'as':_0x4e0783['as'],'attributes':_0x4e0783['attributes'],'include':_0x4e0783['include']?_[_0x8a83('0xa')](_0x4e0783[_0x8a83('0xb')],function(_0x2b0793){return{'model':db[_0x2b0793[_0x8a83('0xc')]],'as':_0x2b0793['as'],'attributes':_0x2b0793['attributes']};}):[]};}):[]};}):[]:[]})[_0x8a83('0xd')](function(_0x4f64cf){logger['info']('GetSquareProjects',_0x16cf4b);logger[_0x8a83('0xe')]('GetSquareProjects',_0x16cf4b,JSON[_0x8a83('0xf')](_0x4f64cf));_0x29b6f2(_0x4f64cf);})[_0x8a83('0x10')](function(_0x3bbf39){logger['error'](_0x8a83('0x11'),_0x3bbf39['message'],_0x16cf4b);_0x4ad86d(_0x50a692[_0x8a83('0x12')](0x1f4,_0x3bbf39[_0x8a83('0x13')]));});});};exports[_0x8a83('0x14')]=function(_0x4c8f98){var _0x2102b8=this;return new Promise(function(_0x155ba4,_0x2d54aa){return db[_0x8a83('0x6')][_0x8a83('0x15')]({'raw':_0x4c8f98[_0x8a83('0x8')]?_0x4c8f98[_0x8a83('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x4c8f98[_0x8a83('0x8')]?_0x4c8f98[_0x8a83('0x8')][_0x8a83('0x16')]||null:null,'attributes':_0x4c8f98[_0x8a83('0x8')]?_0x4c8f98[_0x8a83('0x8')][_0x8a83('0x9')]||null:null,'include':_0x4c8f98[_0x8a83('0x8')]?_0x4c8f98[_0x8a83('0x8')][_0x8a83('0xb')]?_[_0x8a83('0xa')](_0x4c8f98[_0x8a83('0x8')]['include'],function(_0x28814c){return{'model':db[_0x28814c[_0x8a83('0xc')]],'as':_0x28814c['as'],'attributes':_0x28814c[_0x8a83('0x9')],'include':_0x28814c[_0x8a83('0xb')]?_['map'](_0x28814c[_0x8a83('0xb')],function(_0x459c3b){return{'model':db[_0x459c3b[_0x8a83('0xc')]],'as':_0x459c3b['as'],'attributes':_0x459c3b[_0x8a83('0x9')],'include':_0x459c3b['include']?_[_0x8a83('0xa')](_0x459c3b[_0x8a83('0xb')],function(_0x379a05){return{'model':db[_0x379a05['model']],'as':_0x379a05['as'],'attributes':_0x379a05[_0x8a83('0x9')]};}):[]};}):[]};}):[]:[]})[_0x8a83('0xd')](function(_0x4b0769){logger[_0x8a83('0x17')](_0x8a83('0x14'),_0x4c8f98);logger[_0x8a83('0xe')]('ShowSquareProject',_0x4c8f98,JSON[_0x8a83('0xf')](_0x4b0769));_0x155ba4(_0x4b0769);})[_0x8a83('0x10')](function(_0x284ca2){logger[_0x8a83('0x12')](_0x8a83('0x14'),_0x284ca2[_0x8a83('0x13')],_0x4c8f98);_0x2d54aa(_0x2102b8[_0x8a83('0x12')](0x1f4,_0x284ca2[_0x8a83('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index fc78bd0..e339380 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 _0x68e5=['./squareProject.events','save','update','register'];(function(_0x1d8414,_0x34058f){var _0xbaa723=function(_0x56b080){while(--_0x56b080){_0x1d8414['push'](_0x1d8414['shift']());}};_0xbaa723(++_0x34058f);}(_0x68e5,0x150));var _0x568e=function(_0x516f59,_0x4460ce){_0x516f59=_0x516f59-0x0;var _0x4edd4b=_0x68e5[_0x516f59];return _0x4edd4b;};'use strict';var SquareProjectEvents=require(_0x568e('0x0'));var events=[_0x568e('0x1'),'remove',_0x568e('0x2')];function createListener(_0x20088f,_0x256865){return function(_0x4e2e0a){_0x256865['emit'](_0x20088f,_0x4e2e0a);};}function removeListener(_0x120bbf,_0x508b20){return function(){SquareProjectEvents['removeListener'](_0x120bbf,_0x508b20);};}exports[_0x568e('0x3')]=function(_0x22d595){for(var _0x6cfc62=0x0,_0xf10985=events['length'];_0x6cfc62<_0xf10985;_0x6cfc62++){var _0xbbf586=events[_0x6cfc62];var _0x2a8eeb=createListener('squareProject:'+_0xbbf586,_0x22d595);SquareProjectEvents['on'](_0xbbf586,_0x2a8eeb);}}; \ No newline at end of file +var _0xf921=['save','remove','emit','removeListener','length','squareProject:','./squareProject.events'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xf921,0x164));var _0x1f92=function(_0x259d6b,_0x2efc49){_0x259d6b=_0x259d6b-0x0;var _0x5e3636=_0xf921[_0x259d6b];return _0x5e3636;};'use strict';var SquareProjectEvents=require(_0x1f92('0x0'));var events=[_0x1f92('0x1'),_0x1f92('0x2'),'update'];function createListener(_0x44d0d8,_0x4b5aad){return function(_0x48cfb9){_0x4b5aad[_0x1f92('0x3')](_0x44d0d8,_0x48cfb9);};}function removeListener(_0x1fc39e,_0x5b8590){return function(){SquareProjectEvents[_0x1f92('0x4')](_0x1fc39e,_0x5b8590);};}exports['register']=function(_0x4eaeb5){for(var _0x58bd10=0x0,_0x501f82=events[_0x1f92('0x5')];_0x58bd10<_0x501f82;_0x58bd10++){var _0x2613d4=events[_0x58bd10];var _0x43a1d2=createListener(_0x1f92('0x6')+_0x2613d4,_0x4eaeb5);SquareProjectEvents['on'](_0x2613d4,_0x43a1d2);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index fa65c31..5705871 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x33fdb6,_0x5f1c5a){var _0x18d384=function(_0x54b9fd){while(--_0x54b9fd){_0x33fdb6['push'](_0x33fdb6['shift']());}};_0x18d384(++_0x5f1c5a);}(_0xabce,0x103));var _0xeabc=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xabce[_0x2bf141];return _0x48277b;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file +var _0x5fc3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','/:id/download','download','post','create','put','update','/:id','multer','util','connect-timeout'];(function(_0x5d2a2d,_0x51032a){var _0x26d2f0=function(_0x352c48){while(--_0x352c48){_0x5d2a2d['push'](_0x5d2a2d['shift']());}};_0x26d2f0(++_0x51032a);}(_0x5fc3,0xa8));var _0x35fc=function(_0x289e64,_0x5adb3c){_0x289e64=_0x289e64-0x0;var _0x30246c=_0x5fc3[_0x289e64];return _0x30246c;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0x12'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 5515792..ac848b5 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 _0x7da7=['VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7da7,0x10d));var _0x77da=function(_0x5ed54b,_0x3a2827){_0x5ed54b=_0x5ed54b-0x0;var _0x4b58c7=_0x7da7[_0x5ed54b];return _0x4b58c7;};'use strict';var Sequelize=require(_0x77da('0x0'));module[_0x77da('0x1')]={'uniqueid':{'type':Sequelize[_0x77da('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x77da('0x2')]},'extension':{'type':Sequelize[_0x77da('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x77da('0x2')]},'dnid':{'type':Sequelize[_0x77da('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x77da('0x2')]},'filename':{'type':Sequelize[_0x77da('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x77da('0x3')],'get':function(){var _0x47cf1d='';var _0x1191de=this[_0x77da('0x4')](_0x77da('0x5'));if(_0x1191de){_0x47cf1d=_0x1191de[_0x77da('0x6')](_0x1191de[_0x77da('0x7')]('.'));}return _0x47cf1d;}}}; \ No newline at end of file +var _0x81bd=['STRING','VIRTUAL','getDataValue','substring','lastIndexOf','sequelize','exports'];(function(_0x7cb021,_0xdbd9f9){var _0x56b57e=function(_0x156940){while(--_0x156940){_0x7cb021['push'](_0x7cb021['shift']());}};_0x56b57e(++_0xdbd9f9);}(_0x81bd,0x7c));var _0xd81b=function(_0x15cdcb,_0x4340e9){_0x15cdcb=_0x15cdcb-0x0;var _0x37b069=_0x81bd[_0x15cdcb];return _0x37b069;};'use strict';var Sequelize=require(_0xd81b('0x0'));module[_0xd81b('0x1')]={'uniqueid':{'type':Sequelize[_0xd81b('0x2')]},'callerid':{'type':Sequelize[_0xd81b('0x2')]},'calleridname':{'type':Sequelize[_0xd81b('0x2')]},'context':{'type':Sequelize[_0xd81b('0x2')]},'extension':{'type':Sequelize[_0xd81b('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd81b('0x2')]},'dnid':{'type':Sequelize[_0xd81b('0x2')]},'projectName':{'type':Sequelize[_0xd81b('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xd81b('0x2')]},'savePath':{'type':Sequelize[_0xd81b('0x2')]},'format':{'type':Sequelize[_0xd81b('0x3')],'get':function(){var _0x562084='';var _0x5e14e8=this[_0xd81b('0x4')]('savePath');if(_0x5e14e8){_0x562084=_0x5e14e8[_0xd81b('0x5')](_0x5e14e8[_0xd81b('0x6')]('.'));}return _0x562084;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 47e417b..1600091 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 _0x7906=['save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','SquareRecording','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','../../components/encryptor','uniqueid','filename','savePath','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x7906,0x176));var _0x6790=function(_0x2e57c6,_0x434a3d){_0x2e57c6=_0x2e57c6-0x0;var _0x33f946=_0x7906[_0x2e57c6];return _0x33f946;};'use strict';var emlformat=require(_0x6790('0x0'));var rimraf=require(_0x6790('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6790('0x2'));var rp=require(_0x6790('0x3'));var moment=require(_0x6790('0x4'));var BPromise=require(_0x6790('0x5'));var Mustache=require(_0x6790('0x6'));var util=require(_0x6790('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x6790('0x8'));var ejs=require(_0x6790('0x9'));var fs=require('fs');var fs_extra=require(_0x6790('0xa'));var _=require(_0x6790('0xb'));var squel=require(_0x6790('0xc'));var crypto=require(_0x6790('0xd'));var jsforce=require(_0x6790('0xe'));var deskjs=require(_0x6790('0xf'));var toCsv=require(_0x6790('0x8'));var querystring=require(_0x6790('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6790('0x11'));var qs=require(_0x6790('0x12'));var as=require(_0x6790('0x13'));var hardwareService=require(_0x6790('0x14'));var logger=require('../../config/logger')(_0x6790('0x15'));var utils=require(_0x6790('0x16'));var config=require(_0x6790('0x17'));var licenseUtil=require(_0x6790('0x18'));var db=require(_0x6790('0x19'))['db'];function respondWithStatusCode(_0x149b4c,_0x5b8258){_0x5b8258=_0x5b8258||0xcc;return function(_0x4dc150){if(_0x4dc150){return _0x149b4c[_0x6790('0x1a')](_0x5b8258);}return _0x149b4c[_0x6790('0x1b')](_0x5b8258)[_0x6790('0x1c')]();};}function respondWithResult(_0x271d9a,_0x513edb){_0x513edb=_0x513edb||0xc8;return function(_0x42c343){if(_0x42c343){return _0x271d9a[_0x6790('0x1b')](_0x513edb)['json'](_0x42c343);}};}function respondWithFilteredResult(_0x1479d2,_0x3ef37c){return function(_0x4b7c7a){if(_0x4b7c7a){var _0x2166a8=typeof _0x3ef37c['offset']===_0x6790('0x1d')&&typeof _0x3ef37c[_0x6790('0x1e')]===_0x6790('0x1d');var _0xed5d38=_0x4b7c7a[_0x6790('0x1f')];var _0x244763=_0x2166a8?0x0:_0x3ef37c['offset'];var _0x53dcc4=_0x2166a8?_0x4b7c7a[_0x6790('0x1f')]:_0x3ef37c[_0x6790('0x20')]+_0x3ef37c[_0x6790('0x1e')];var _0x887a5f;if(_0x53dcc4>=_0xed5d38){_0x53dcc4=_0xed5d38;_0x887a5f=0xc8;}else{_0x887a5f=0xce;}_0x1479d2['status'](_0x887a5f);return _0x1479d2[_0x6790('0x21')](_0x6790('0x22'),_0x244763+'-'+_0x53dcc4+'/'+_0xed5d38)[_0x6790('0x23')](_0x4b7c7a);}return null;};}function patchUpdates(_0x37805a){return function(_0xe3e634){try{jsonpatch[_0x6790('0x24')](_0xe3e634,_0x37805a,!![]);}catch(_0x35125d){return BPromise[_0x6790('0x25')](_0x35125d);}return _0xe3e634[_0x6790('0x26')]();};}function saveUpdates(_0x523e52,_0x39db0a){return function(_0x8a2456){if(_0x8a2456){return _0x8a2456[_0x6790('0x27')](_0x523e52)[_0x6790('0x28')](function(_0x402637){return _0x402637;});}return null;};}function removeEntity(_0x3d9dd6,_0x4af7ff){return function(_0x29c79a){if(_0x29c79a){return _0x29c79a[_0x6790('0x29')]()[_0x6790('0x28')](function(){_0x3d9dd6[_0x6790('0x1b')](0xcc)[_0x6790('0x1c')]();});}};}function handleEntityNotFound(_0x48704a,_0x136d6a){return function(_0x4d0f49){if(!_0x4d0f49){_0x48704a[_0x6790('0x1a')](0x194);}return _0x4d0f49;};}function handleError(_0x21f4e0,_0x1b1040){_0x1b1040=_0x1b1040||0x1f4;return function(_0x5d4ad5){logger[_0x6790('0x2a')](_0x5d4ad5[_0x6790('0x2b')]);if(_0x5d4ad5['name']){delete _0x5d4ad5[_0x6790('0x2c')];}_0x21f4e0[_0x6790('0x1b')](_0x1b1040)[_0x6790('0x2d')](_0x5d4ad5);};}exports[_0x6790('0x2e')]=function(_0x32481f,_0x2a214f){var _0xdc2a73={},_0x32f10c={},_0x43058c={'count':0x0,'rows':[]};var _0x1b2319=_[_0x6790('0x2f')](db['SquareRecording'][_0x6790('0x30')],function(_0x39a2a1){return{'name':_0x39a2a1['fieldName'],'type':_0x39a2a1[_0x6790('0x31')][_0x6790('0x32')]};});_0x32f10c[_0x6790('0x33')]=_['map'](_0x1b2319,'name');_0x32f10c[_0x6790('0x34')]=_[_0x6790('0x35')](_0x32481f[_0x6790('0x34')]);_0x32f10c[_0x6790('0x36')]=_[_0x6790('0x37')](_0x32f10c[_0x6790('0x33')],_0x32f10c[_0x6790('0x34')]);_0xdc2a73[_0x6790('0x38')]=_[_0x6790('0x37')](_0x32f10c[_0x6790('0x33')],qs[_0x6790('0x39')](_0x32481f[_0x6790('0x34')][_0x6790('0x39')]));_0xdc2a73['attributes']=_0xdc2a73[_0x6790('0x38')]['length']?_0xdc2a73[_0x6790('0x38')]:_0x32f10c[_0x6790('0x33')];if(!_0x32481f[_0x6790('0x34')]['hasOwnProperty'](_0x6790('0x3a'))){_0xdc2a73[_0x6790('0x1e')]=qs[_0x6790('0x1e')](_0x32481f[_0x6790('0x34')]['limit']);_0xdc2a73[_0x6790('0x20')]=qs['offset'](_0x32481f[_0x6790('0x34')][_0x6790('0x20')]);}_0xdc2a73[_0x6790('0x3b')]=qs[_0x6790('0x3c')](_0x32481f['query']['sort']);_0xdc2a73[_0x6790('0x3d')]=qs[_0x6790('0x36')](_[_0x6790('0x3e')](_0x32481f[_0x6790('0x34')],_0x32f10c[_0x6790('0x36')]),_0x1b2319);if(_0x32481f[_0x6790('0x34')][_0x6790('0x3f')]){_0xdc2a73[_0x6790('0x3d')]=_[_0x6790('0x40')](_0xdc2a73[_0x6790('0x3d')],{'$or':_['map'](_0x1b2319,function(_0x4fc123){if(_0x4fc123['type']!=='VIRTUAL'){var _0x2d5ebc={};_0x2d5ebc[_0x4fc123[_0x6790('0x2c')]]={'$like':'%'+_0x32481f['query'][_0x6790('0x3f')]+'%'};return _0x2d5ebc;}})});}_0xdc2a73=_[_0x6790('0x40')]({},_0xdc2a73,_0x32481f['options']);var _0x26b455={'where':_0xdc2a73['where']};return db[_0x6790('0x41')][_0x6790('0x1f')](_0x26b455)[_0x6790('0x28')](function(_0x2f8f8f){_0x43058c[_0x6790('0x1f')]=_0x2f8f8f;if(_0x32481f['query'][_0x6790('0x42')]){_0xdc2a73[_0x6790('0x43')]=[{'all':!![]}];}return db[_0x6790('0x41')][_0x6790('0x44')](_0xdc2a73);})[_0x6790('0x28')](function(_0x24fa2a){_0x43058c[_0x6790('0x45')]=_0x24fa2a;return _0x43058c;})['then'](respondWithFilteredResult(_0x2a214f,_0xdc2a73))[_0x6790('0x46')](handleError(_0x2a214f,null));};exports[_0x6790('0x47')]=function(_0x4adfeb,_0x16ec63){var _0x101795={'raw':!![],'where':{'id':_0x4adfeb[_0x6790('0x48')]['id']}},_0x1017b5={};_0x1017b5[_0x6790('0x33')]=_[_0x6790('0x35')](db[_0x6790('0x41')]['rawAttributes']);_0x1017b5['query']=_[_0x6790('0x35')](_0x4adfeb['query']);_0x1017b5[_0x6790('0x36')]=_['intersection'](_0x1017b5[_0x6790('0x33')],_0x1017b5[_0x6790('0x34')]);_0x101795[_0x6790('0x38')]=_[_0x6790('0x37')](_0x1017b5['model'],qs[_0x6790('0x39')](_0x4adfeb['query'][_0x6790('0x39')]));_0x101795[_0x6790('0x38')]=_0x101795['attributes'][_0x6790('0x49')]?_0x101795[_0x6790('0x38')]:_0x1017b5['model'];if(_0x4adfeb['query']['includeAll']){_0x101795[_0x6790('0x43')]=[{'all':!![]}];}_0x101795=_[_0x6790('0x40')]({},_0x101795,_0x4adfeb[_0x6790('0x4a')]);return db[_0x6790('0x41')][_0x6790('0x4b')](_0x101795)[_0x6790('0x28')](handleEntityNotFound(_0x16ec63,null))['then'](respondWithResult(_0x16ec63,null))[_0x6790('0x46')](handleError(_0x16ec63,null));};exports['create']=function(_0x1cc79f,_0x5d4963){return db[_0x6790('0x41')][_0x6790('0x4c')](_0x1cc79f[_0x6790('0x4d')],{})[_0x6790('0x28')](respondWithResult(_0x5d4963,0xc9))['catch'](handleError(_0x5d4963,null));};exports[_0x6790('0x27')]=function(_0x281a16,_0x22849f){if(_0x281a16['body']['id']){delete _0x281a16[_0x6790('0x4d')]['id'];}return db['SquareRecording'][_0x6790('0x4b')]({'where':{'id':_0x281a16['params']['id']}})[_0x6790('0x28')](handleEntityNotFound(_0x22849f,null))['then'](saveUpdates(_0x281a16[_0x6790('0x4d')],null))['then'](respondWithResult(_0x22849f,null))['catch'](handleError(_0x22849f,null));};exports['download']=function(_0x471451,_0x46e30c,_0x272c36){var _0x539f25=require(_0x6790('0x4e'));var _0x8eeebc=![];var _0x4aa313={};if(_0x471451[_0x6790('0x34')][_0x6790('0x31')]&&_0x471451[_0x6790('0x34')][_0x6790('0x31')]==='uniqueid'){_0x4aa313[_0x6790('0x4f')]=_0x471451[_0x6790('0x48')]['id'];}else{_0x4aa313['id']=_0x471451[_0x6790('0x48')]['id'];}return db['SquareRecording'][_0x6790('0x4b')]({'where':_0x4aa313,'attributes':['id','savePath',_0x6790('0x50')],'raw':!![]})[_0x6790('0x28')](handleEntityNotFound(_0x46e30c,null))[_0x6790('0x28')](function(_0x35da6e){if(_0x35da6e){var _0xcce693=_0x35da6e[_0x6790('0x51')];var _0x3cbc93=util[_0x6790('0x52')](_0x6790('0x53'),_0xcce693);if(fs[_0x6790('0x54')](_0x3cbc93)){_0x8eeebc=!![];return _0x539f25[_0x6790('0x55')](_0x3cbc93,_0xcce693,config[_0x6790('0x56')]['recording'])[_0x6790('0x28')](function(){return _0x35da6e;});}return _0x35da6e;}})[_0x6790('0x28')](function(_0x1bad47){if(_0x1bad47){var _0x1dd902=_0x1bad47[_0x6790('0x51')];if(!fs[_0x6790('0x54')](_0x1dd902)){throw new db[(_0x6790('0x57'))][(_0x6790('0x58'))](_0x6790('0x59'));}if(_0x1bad47[_0x6790('0x50')]){return _0x46e30c[_0x6790('0x5a')](_0x1dd902,_0x1bad47[_0x6790('0x50')]+path[_0x6790('0x5b')](_0x1dd902),function(){if(_0x8eeebc){fs[_0x6790('0x5c')](_0x1dd902);}});}else{return _0x46e30c[_0x6790('0x5a')](_0x1dd902,function(_0x2b009b){if(_0x8eeebc){fs['unlink'](_0x1dd902);}});}}})[_0x6790('0x46')](function(_0x2b8424){if(_0x2b8424[_0x6790('0x5d')]===_0x6790('0x59')){_0x46e30c[_0x6790('0x1b')](0x194)['send'](_0x6790('0x5e'));}else{return handleError(_0x46e30c,null);}});};exports[_0x6790('0x29')]=function(_0x4f893a,_0x27afb5){return db[_0x6790('0x41')][_0x6790('0x4b')]({'where':{'id':_0x4f893a[_0x6790('0x48')]['id']}})[_0x6790('0x28')](function(_0x10eba7){if(_[_0x6790('0x5f')](_0x10eba7)){throw new ReferenceError(_0x6790('0x60'));}return _0x10eba7;})[_0x6790('0x28')](function(_0x312a78){var _0x5728ca=_0x312a78[_0x6790('0x51')];logger['info'](_0x6790('0x61'),_0x5728ca);if(!_[_0x6790('0x5f')](_0x312a78[_0x6790('0x51')])&&fs[_0x6790('0x54')](_0x5728ca)){logger[_0x6790('0x62')](_0x6790('0x63')+_0x5728ca+_0x6790('0x64'));fs[_0x6790('0x65')](_0x5728ca);}_0x5728ca=_0x5728ca+_0x6790('0x66');if(!_[_0x6790('0x5f')](_0x312a78[_0x6790('0x51')])&&fs[_0x6790('0x54')](_0x5728ca)){logger[_0x6790('0x62')](_0x6790('0x63')+_0x5728ca+_0x6790('0x64'));fs[_0x6790('0x65')](_0x5728ca);}return _0x312a78;})[_0x6790('0x28')](function(_0x57fe78){if(!_0x57fe78)throw new InternalError();return _0x57fe78[_0x6790('0x29')]();})[_0x6790('0x28')](function(){_0x27afb5[_0x6790('0x1b')](0xcc)['end']();})['catch'](handleError(_0x27afb5,null));}; \ No newline at end of file +var _0x4c8b=['include','options','find','create','body','params','download','../../components/encryptor','uniqueid','savePath','existsSync','recording','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','File:\x20\x22','eml-format','zip-dir','moment','bluebird','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','fields'];(function(_0x51e60f,_0x4f4843){var _0x3aede8=function(_0x325212){while(--_0x325212){_0x51e60f['push'](_0x51e60f['shift']());}};_0x3aede8(++_0x4f4843);}(_0x4c8b,0xce));var _0xb4c8=function(_0x3a1b11,_0x4a8bd5){_0x3a1b11=_0x3a1b11-0x0;var _0x420e78=_0x4c8b[_0x3a1b11];return _0x420e78;};'use strict';var emlformat=require(_0xb4c8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb4c8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb4c8('0x2'));var BPromise=require(_0xb4c8('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb4c8('0x4'));var sox=require('sox');var csv=require(_0xb4c8('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb4c8('0x6'));var _=require('lodash');var squel=require(_0xb4c8('0x7'));var crypto=require(_0xb4c8('0x8'));var jsforce=require(_0xb4c8('0x9'));var deskjs=require(_0xb4c8('0xa'));var toCsv=require(_0xb4c8('0x5'));var querystring=require(_0xb4c8('0xb'));var Papa=require(_0xb4c8('0xc'));var Redis=require('ioredis');var authService=require(_0xb4c8('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xb4c8('0xe'));var hardwareService=require(_0xb4c8('0xf'));var logger=require(_0xb4c8('0x10'))(_0xb4c8('0x11'));var utils=require('../../config/utils');var config=require(_0xb4c8('0x12'));var licenseUtil=require(_0xb4c8('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5264f6,_0x1d78b5){_0x1d78b5=_0x1d78b5||0xcc;return function(_0x5c1f80){if(_0x5c1f80){return _0x5264f6[_0xb4c8('0x14')](_0x1d78b5);}return _0x5264f6[_0xb4c8('0x15')](_0x1d78b5)[_0xb4c8('0x16')]();};}function respondWithResult(_0x454cd4,_0x3381ea){_0x3381ea=_0x3381ea||0xc8;return function(_0x3339f6){if(_0x3339f6){return _0x454cd4[_0xb4c8('0x15')](_0x3381ea)[_0xb4c8('0x17')](_0x3339f6);}};}function respondWithFilteredResult(_0x5e9991,_0x31c9b){return function(_0x9d2336){if(_0x9d2336){var _0x2d71bd=typeof _0x31c9b[_0xb4c8('0x18')]===_0xb4c8('0x19')&&typeof _0x31c9b[_0xb4c8('0x1a')]===_0xb4c8('0x19');var _0x32fcb9=_0x9d2336[_0xb4c8('0x1b')];var _0x88282d=_0x2d71bd?0x0:_0x31c9b[_0xb4c8('0x18')];var _0x5636f4=_0x2d71bd?_0x9d2336[_0xb4c8('0x1b')]:_0x31c9b[_0xb4c8('0x18')]+_0x31c9b[_0xb4c8('0x1a')];var _0x14159e;if(_0x5636f4>=_0x32fcb9){_0x5636f4=_0x32fcb9;_0x14159e=0xc8;}else{_0x14159e=0xce;}_0x5e9991[_0xb4c8('0x15')](_0x14159e);return _0x5e9991['set'](_0xb4c8('0x1c'),_0x88282d+'-'+_0x5636f4+'/'+_0x32fcb9)[_0xb4c8('0x17')](_0x9d2336);}return null;};}function patchUpdates(_0x57ef02){return function(_0x1f0000){try{jsonpatch[_0xb4c8('0x1d')](_0x1f0000,_0x57ef02,!![]);}catch(_0x137e85){return BPromise['reject'](_0x137e85);}return _0x1f0000[_0xb4c8('0x1e')]();};}function saveUpdates(_0x5383cc,_0x422c4c){return function(_0x5226b2){if(_0x5226b2){return _0x5226b2[_0xb4c8('0x1f')](_0x5383cc)[_0xb4c8('0x20')](function(_0xfb1b15){return _0xfb1b15;});}return null;};}function removeEntity(_0x59d4fa,_0x4b2ef1){return function(_0x502e81){if(_0x502e81){return _0x502e81[_0xb4c8('0x21')]()[_0xb4c8('0x20')](function(){_0x59d4fa[_0xb4c8('0x15')](0xcc)[_0xb4c8('0x16')]();});}};}function handleEntityNotFound(_0x57fbbf,_0x491a61){return function(_0xc5abb9){if(!_0xc5abb9){_0x57fbbf[_0xb4c8('0x14')](0x194);}return _0xc5abb9;};}function handleError(_0x42081f,_0x3bc5fd){_0x3bc5fd=_0x3bc5fd||0x1f4;return function(_0x4078b7){logger['error'](_0x4078b7[_0xb4c8('0x22')]);if(_0x4078b7[_0xb4c8('0x23')]){delete _0x4078b7[_0xb4c8('0x23')];}_0x42081f[_0xb4c8('0x15')](_0x3bc5fd)[_0xb4c8('0x24')](_0x4078b7);};}exports[_0xb4c8('0x25')]=function(_0x57e036,_0x9c8370){var _0x118ba6={},_0xcc0299={},_0x56a7e0={'count':0x0,'rows':[]};var _0x2f871f=_[_0xb4c8('0x26')](db[_0xb4c8('0x27')][_0xb4c8('0x28')],function(_0x4fd0b5){return{'name':_0x4fd0b5[_0xb4c8('0x29')],'type':_0x4fd0b5[_0xb4c8('0x2a')]['key']};});_0xcc0299[_0xb4c8('0x2b')]=_[_0xb4c8('0x26')](_0x2f871f,_0xb4c8('0x23'));_0xcc0299[_0xb4c8('0x2c')]=_[_0xb4c8('0x2d')](_0x57e036[_0xb4c8('0x2c')]);_0xcc0299[_0xb4c8('0x2e')]=_['intersection'](_0xcc0299[_0xb4c8('0x2b')],_0xcc0299[_0xb4c8('0x2c')]);_0x118ba6[_0xb4c8('0x2f')]=_[_0xb4c8('0x30')](_0xcc0299['model'],qs['fields'](_0x57e036[_0xb4c8('0x2c')]['fields']));_0x118ba6[_0xb4c8('0x2f')]=_0x118ba6['attributes'][_0xb4c8('0x31')]?_0x118ba6[_0xb4c8('0x2f')]:_0xcc0299[_0xb4c8('0x2b')];if(!_0x57e036['query'][_0xb4c8('0x32')](_0xb4c8('0x33'))){_0x118ba6['limit']=qs[_0xb4c8('0x1a')](_0x57e036[_0xb4c8('0x2c')]['limit']);_0x118ba6[_0xb4c8('0x18')]=qs[_0xb4c8('0x18')](_0x57e036['query'][_0xb4c8('0x18')]);}_0x118ba6[_0xb4c8('0x34')]=qs['sort'](_0x57e036[_0xb4c8('0x2c')][_0xb4c8('0x35')]);_0x118ba6[_0xb4c8('0x36')]=qs[_0xb4c8('0x2e')](_[_0xb4c8('0x37')](_0x57e036[_0xb4c8('0x2c')],_0xcc0299[_0xb4c8('0x2e')]),_0x2f871f);if(_0x57e036[_0xb4c8('0x2c')][_0xb4c8('0x38')]){_0x118ba6[_0xb4c8('0x36')]=_[_0xb4c8('0x39')](_0x118ba6[_0xb4c8('0x36')],{'$or':_[_0xb4c8('0x26')](_0x2f871f,function(_0x1612a4){if(_0x1612a4[_0xb4c8('0x2a')]!==_0xb4c8('0x3a')){var _0x2e3877={};_0x2e3877[_0x1612a4[_0xb4c8('0x23')]]={'$like':'%'+_0x57e036[_0xb4c8('0x2c')]['filter']+'%'};return _0x2e3877;}})});}_0x118ba6=_[_0xb4c8('0x39')]({},_0x118ba6,_0x57e036['options']);var _0x229a23={'where':_0x118ba6['where']};return db[_0xb4c8('0x27')][_0xb4c8('0x1b')](_0x229a23)[_0xb4c8('0x20')](function(_0x2081a8){_0x56a7e0['count']=_0x2081a8;if(_0x57e036[_0xb4c8('0x2c')][_0xb4c8('0x3b')]){_0x118ba6['include']=[{'all':!![]}];}return db[_0xb4c8('0x27')]['findAll'](_0x118ba6);})[_0xb4c8('0x20')](function(_0xc41a7b){_0x56a7e0[_0xb4c8('0x3c')]=_0xc41a7b;return _0x56a7e0;})['then'](respondWithFilteredResult(_0x9c8370,_0x118ba6))[_0xb4c8('0x3d')](handleError(_0x9c8370,null));};exports[_0xb4c8('0x3e')]=function(_0x4a8a2f,_0x4a3228){var _0x14447={'raw':!![],'where':{'id':_0x4a8a2f['params']['id']}},_0x59d628={};_0x59d628[_0xb4c8('0x2b')]=_[_0xb4c8('0x2d')](db[_0xb4c8('0x27')]['rawAttributes']);_0x59d628[_0xb4c8('0x2c')]=_[_0xb4c8('0x2d')](_0x4a8a2f[_0xb4c8('0x2c')]);_0x59d628['filters']=_[_0xb4c8('0x30')](_0x59d628[_0xb4c8('0x2b')],_0x59d628[_0xb4c8('0x2c')]);_0x14447['attributes']=_[_0xb4c8('0x30')](_0x59d628[_0xb4c8('0x2b')],qs[_0xb4c8('0x3f')](_0x4a8a2f[_0xb4c8('0x2c')]['fields']));_0x14447[_0xb4c8('0x2f')]=_0x14447['attributes'][_0xb4c8('0x31')]?_0x14447[_0xb4c8('0x2f')]:_0x59d628[_0xb4c8('0x2b')];if(_0x4a8a2f['query'][_0xb4c8('0x3b')]){_0x14447[_0xb4c8('0x40')]=[{'all':!![]}];}_0x14447=_[_0xb4c8('0x39')]({},_0x14447,_0x4a8a2f[_0xb4c8('0x41')]);return db[_0xb4c8('0x27')][_0xb4c8('0x42')](_0x14447)[_0xb4c8('0x20')](handleEntityNotFound(_0x4a3228,null))['then'](respondWithResult(_0x4a3228,null))[_0xb4c8('0x3d')](handleError(_0x4a3228,null));};exports[_0xb4c8('0x43')]=function(_0x3c993a,_0x2c5f92){return db[_0xb4c8('0x27')][_0xb4c8('0x43')](_0x3c993a[_0xb4c8('0x44')],{})[_0xb4c8('0x20')](respondWithResult(_0x2c5f92,0xc9))[_0xb4c8('0x3d')](handleError(_0x2c5f92,null));};exports['update']=function(_0xc73c72,_0x566290){if(_0xc73c72[_0xb4c8('0x44')]['id']){delete _0xc73c72[_0xb4c8('0x44')]['id'];}return db[_0xb4c8('0x27')][_0xb4c8('0x42')]({'where':{'id':_0xc73c72[_0xb4c8('0x45')]['id']}})['then'](handleEntityNotFound(_0x566290,null))[_0xb4c8('0x20')](saveUpdates(_0xc73c72[_0xb4c8('0x44')],null))[_0xb4c8('0x20')](respondWithResult(_0x566290,null))[_0xb4c8('0x3d')](handleError(_0x566290,null));};exports[_0xb4c8('0x46')]=function(_0x9f1351,_0x2634e8,_0x1e24a5){var _0x24cc60=require(_0xb4c8('0x47'));var _0x5f311e=![];var _0x46781e={};if(_0x9f1351['query'][_0xb4c8('0x2a')]&&_0x9f1351['query']['type']===_0xb4c8('0x48')){_0x46781e['uniqueid']=_0x9f1351[_0xb4c8('0x45')]['id'];}else{_0x46781e['id']=_0x9f1351[_0xb4c8('0x45')]['id'];}return db[_0xb4c8('0x27')][_0xb4c8('0x42')]({'where':_0x46781e,'attributes':['id','savePath','filename'],'raw':!![]})[_0xb4c8('0x20')](handleEntityNotFound(_0x2634e8,null))[_0xb4c8('0x20')](function(_0x5052e4){if(_0x5052e4){var _0x2321eb=_0x5052e4[_0xb4c8('0x49')];var _0x55cdaf=util['format']('%s.cypher',_0x2321eb);if(fs[_0xb4c8('0x4a')](_0x55cdaf)){_0x5f311e=!![];return _0x24cc60['decryptFile'](_0x55cdaf,_0x2321eb,config['secrets'][_0xb4c8('0x4b')])[_0xb4c8('0x20')](function(){return _0x5052e4;});}return _0x5052e4;}})[_0xb4c8('0x20')](function(_0x1a18b4){if(_0x1a18b4){var _0x32ab14=_0x1a18b4['savePath'];if(!fs[_0xb4c8('0x4a')](_0x32ab14)){throw new db['Sequelize'][(_0xb4c8('0x4c'))](_0xb4c8('0x4d'));}if(_0x1a18b4[_0xb4c8('0x4e')]){return _0x2634e8[_0xb4c8('0x46')](_0x32ab14,_0x1a18b4[_0xb4c8('0x4e')]+path[_0xb4c8('0x4f')](_0x32ab14),function(){if(_0x5f311e){fs[_0xb4c8('0x50')](_0x32ab14);}});}else{return _0x2634e8[_0xb4c8('0x46')](_0x32ab14,function(_0x23fac2){if(_0x5f311e){fs['unlink'](_0x32ab14);}});}}})[_0xb4c8('0x3d')](function(_0xd483df){if(_0xd483df['message']===_0xb4c8('0x4d')){_0x2634e8[_0xb4c8('0x15')](0x194)['send'](_0xb4c8('0x51'));}else{return handleError(_0x2634e8,null);}});};exports[_0xb4c8('0x21')]=function(_0x412fdb,_0x4a9a4a){return db[_0xb4c8('0x27')]['find']({'where':{'id':_0x412fdb[_0xb4c8('0x45')]['id']}})[_0xb4c8('0x20')](function(_0x4e1ad9){if(_['isNil'](_0x4e1ad9)){throw new ReferenceError(_0xb4c8('0x52'));}return _0x4e1ad9;})['then'](function(_0x9af15b){var _0x33a57d=_0x9af15b[_0xb4c8('0x49')];logger['info'](_0xb4c8('0x53'),_0x33a57d);if(!_['isNil'](_0x9af15b[_0xb4c8('0x49')])&&fs['existsSync'](_0x33a57d)){logger[_0xb4c8('0x54')]('File:\x20\x22'+_0x33a57d+_0xb4c8('0x55'));fs[_0xb4c8('0x56')](_0x33a57d);}_0x33a57d=_0x33a57d+_0xb4c8('0x57');if(!_[_0xb4c8('0x58')](_0x9af15b[_0xb4c8('0x49')])&&fs[_0xb4c8('0x4a')](_0x33a57d)){logger['info'](_0xb4c8('0x59')+_0x33a57d+_0xb4c8('0x55'));fs['unlinkSync'](_0x33a57d);}return _0x9af15b;})[_0xb4c8('0x20')](function(_0x2c3a36){if(!_0x2c3a36)throw new InternalError();return _0x2c3a36[_0xb4c8('0x21')]();})['then'](function(){_0x4a9a4a[_0xb4c8('0x15')](0xcc)[_0xb4c8('0x16')]();})[_0xb4c8('0x3d')](handleError(_0x4a9a4a,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 71ca2ba..d011074 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 _0x5ae9=['request-promise','path','../../config/environment','exports','define','SquareRecording','lodash','api','moment'];(function(_0x3c2efc,_0x532d14){var _0x4f64d1=function(_0x1524b2){while(--_0x1524b2){_0x3c2efc['push'](_0x3c2efc['shift']());}};_0x4f64d1(++_0x532d14);}(_0x5ae9,0x19b));var _0x95ae=function(_0x4b793b,_0x1ee112){_0x4b793b=_0x4b793b-0x0;var _0xcfbd6a=_0x5ae9[_0x4b793b];return _0xcfbd6a;};'use strict';var _=require(_0x95ae('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x95ae('0x1'));var moment=require(_0x95ae('0x2'));var BPromise=require('bluebird');var rp=require(_0x95ae('0x3'));var fs=require('fs');var path=require(_0x95ae('0x4'));var rimraf=require('rimraf');var config=require(_0x95ae('0x5'));var attributes=require('./squareRecording.attributes');module[_0x95ae('0x6')]=function(_0x3c4464,_0xa51307){return _0x3c4464[_0x95ae('0x7')](_0x95ae('0x8'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb091=['moment','request-promise','../../config/environment','./squareRecording.attributes','define','square_recordings','util','../../config/logger','api'];(function(_0x146fb3,_0x571891){var _0x430ef7=function(_0x143f3d){while(--_0x143f3d){_0x146fb3['push'](_0x146fb3['shift']());}};_0x430ef7(++_0x571891);}(_0xb091,0x16e));var _0x1b09=function(_0x80bc83,_0x4f84f0){_0x80bc83=_0x80bc83-0x0;var _0x5b7d68=_0xb091[_0x80bc83];return _0x5b7d68;};'use strict';var _=require('lodash');var util=require(_0x1b09('0x0'));var logger=require(_0x1b09('0x1'))(_0x1b09('0x2'));var moment=require(_0x1b09('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b09('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b09('0x5'));var attributes=require(_0x1b09('0x6'));module['exports']=function(_0xda8caa,_0x5fa348){return _0xda8caa[_0x1b09('0x7')]('SquareRecording',attributes,{'tableName':_0x1b09('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 6b893d2..db07d6d 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 _0x00ed=['moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','lodash','util'];(function(_0xf9e96b,_0x4b0b86){var _0x27d90f=function(_0x4294f3){while(--_0x4294f3){_0xf9e96b['push'](_0xf9e96b['shift']());}};_0x27d90f(++_0x4b0b86);}(_0x00ed,0xac));var _0xd00e=function(_0x4a166b,_0xb3dd3b){_0x4a166b=_0x4a166b-0x0;var _0x3dcea3=_0x00ed[_0x4a166b];return _0x3dcea3;};'use strict';var _=require(_0xd00e('0x0'));var util=require(_0xd00e('0x1'));var moment=require(_0xd00e('0x2'));var BPromise=require('bluebird');var rs=require(_0xd00e('0x3'));var fs=require('fs');var Redis=require(_0xd00e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd00e('0x5'));var logger=require('../../config/logger')(_0xd00e('0x6'));var config=require('../../config/environment');var jayson=require(_0xd00e('0x7'));var client=jayson[_0xd00e('0x8')][_0xd00e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503f93,_0xb1cdaf,_0x53a89d){return new BPromise(function(_0x2e7e14,_0x100209){return client[_0xd00e('0xa')](_0x503f93,_0x53a89d)[_0xd00e('0xb')](function(_0x34bc5a){logger['info'](_0xd00e('0xc'),_0xb1cdaf,'request\x20sent');logger[_0xd00e('0xd')](_0xd00e('0xe'),_0xb1cdaf,_0xd00e('0xf'),JSON[_0xd00e('0x10')](_0x34bc5a));if(_0x34bc5a['error']){if(_0x34bc5a[_0xd00e('0x11')][_0xd00e('0x12')]===0x1f4){logger[_0xd00e('0x11')](_0xd00e('0xc'),_0xb1cdaf,_0x34bc5a[_0xd00e('0x11')][_0xd00e('0x13')]);return _0x100209(_0x34bc5a[_0xd00e('0x11')][_0xd00e('0x13')]);}logger[_0xd00e('0x11')](_0xd00e('0xc'),_0xb1cdaf,_0x34bc5a['error']['message']);return _0x2e7e14(_0x34bc5a[_0xd00e('0x11')]['message']);}else{logger[_0xd00e('0x14')](_0xd00e('0xc'),_0xb1cdaf,_0xd00e('0xf'));_0x2e7e14(_0x34bc5a[_0xd00e('0x15')]['message']);}})[_0xd00e('0x16')](function(_0x143b79){logger[_0xd00e('0x11')](_0xd00e('0xc'),_0xb1cdaf,_0x143b79);_0x100209(_0x143b79);});});}exports[_0xd00e('0x17')]=function(_0x21df00){var _0x36196b=this;return new Promise(function(_0x1858b8,_0x2ad3e4){return db[_0xd00e('0x18')][_0xd00e('0x19')](_0x21df00[_0xd00e('0x1a')],{'raw':_0x21df00['options']?_0x21df00[_0xd00e('0x1b')][_0xd00e('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x43300d){logger[_0xd00e('0x14')](_0xd00e('0x17'),_0x21df00);logger['debug'](_0xd00e('0x17'),_0x21df00,JSON[_0xd00e('0x10')](_0x43300d));_0x1858b8(_0x43300d);})[_0xd00e('0x16')](function(_0x4c6201){logger[_0xd00e('0x11')](_0xd00e('0x17'),_0x4c6201['message'],_0x21df00);_0x2ad3e4(_0x36196b['error'](0x1f4,_0x4c6201[_0xd00e('0x13')]));});});}; \ No newline at end of file +var _0xc3d8=['body','options','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareRecording','SquareRecording','create'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0xc3d8,0xc0));var _0x8c3d=function(_0x4a8dce,_0x9ccd07){_0x4a8dce=_0x4a8dce-0x0;var _0x268c0b=_0xc3d8[_0x4a8dce];return _0x268c0b;};'use strict';var _=require(_0x8c3d('0x0'));var util=require(_0x8c3d('0x1'));var moment=require(_0x8c3d('0x2'));var BPromise=require(_0x8c3d('0x3'));var rs=require(_0x8c3d('0x4'));var fs=require('fs');var Redis=require(_0x8c3d('0x5'));var db=require(_0x8c3d('0x6'))['db'];var utils=require(_0x8c3d('0x7'));var logger=require(_0x8c3d('0x8'))('rpc');var config=require(_0x8c3d('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x537b58,_0x25d62d,_0x2871dd){return new BPromise(function(_0x5c0235,_0x337594){return client[_0x8c3d('0xa')](_0x537b58,_0x2871dd)['then'](function(_0x32af8f){logger[_0x8c3d('0xb')](_0x8c3d('0xc'),_0x25d62d,_0x8c3d('0xd'));logger[_0x8c3d('0xe')](_0x8c3d('0xf'),_0x25d62d,_0x8c3d('0xd'),JSON[_0x8c3d('0x10')](_0x32af8f));if(_0x32af8f[_0x8c3d('0x11')]){if(_0x32af8f[_0x8c3d('0x11')][_0x8c3d('0x12')]===0x1f4){logger[_0x8c3d('0x11')](_0x8c3d('0xc'),_0x25d62d,_0x32af8f['error']['message']);return _0x337594(_0x32af8f['error'][_0x8c3d('0x13')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x25d62d,_0x32af8f[_0x8c3d('0x11')][_0x8c3d('0x13')]);return _0x5c0235(_0x32af8f['error'][_0x8c3d('0x13')]);}else{logger[_0x8c3d('0xb')](_0x8c3d('0xc'),_0x25d62d,_0x8c3d('0xd'));_0x5c0235(_0x32af8f['result']['message']);}})[_0x8c3d('0x14')](function(_0x16f963){logger[_0x8c3d('0x11')]('SquareRecording,\x20%s,\x20%s',_0x25d62d,_0x16f963);_0x337594(_0x16f963);});});}exports[_0x8c3d('0x15')]=function(_0x604ef){var _0x85c1f=this;return new Promise(function(_0x1a6af9,_0x2dae33){return db[_0x8c3d('0x16')][_0x8c3d('0x17')](_0x604ef[_0x8c3d('0x18')],{'raw':_0x604ef[_0x8c3d('0x19')]?_0x604ef[_0x8c3d('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8c3d('0x1a')](function(_0x4b4d59){logger[_0x8c3d('0xb')](_0x8c3d('0x15'),_0x604ef);logger[_0x8c3d('0xe')]('CreateSquareRecording',_0x604ef,JSON[_0x8c3d('0x10')](_0x4b4d59));_0x1a6af9(_0x4b4d59);})[_0x8c3d('0x14')](function(_0x473aae){logger[_0x8c3d('0x11')](_0x8c3d('0x15'),_0x473aae[_0x8c3d('0x13')],_0x604ef);_0x2dae33(_0x85c1f[_0x8c3d('0x11')](0x1f4,_0x473aae[_0x8c3d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index e24d200..e6affa8 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(_0x98c519,_0x541919){var _0x3aa2d8=function(_0x1c2e86){while(--_0x1c2e86){_0x98c519['push'](_0x98c519['shift']());}};_0x3aa2d8(++_0x541919);}(_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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index d332a1e..4fe66db 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 _0x174e=['BOOLEAN','sequelize','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x174e,0x11b));var _0xe174=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x174e[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xe174('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xe174('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe174('0x1')]},'language':{'type':Sequelize[_0xe174('0x1')]},'type':{'type':Sequelize[_0xe174('0x1')]},'uniqueid':{'type':Sequelize[_0xe174('0x1')]},'version':{'type':Sequelize[_0xe174('0x1')]},'callerid':{'type':Sequelize[_0xe174('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xe174('0x1')]},'callingani2':{'type':Sequelize[_0xe174('0x1')]},'callington':{'type':Sequelize[_0xe174('0x1')]},'callingtns':{'type':Sequelize[_0xe174('0x1')]},'dnid':{'type':Sequelize[_0xe174('0x1')]},'rdnis':{'type':Sequelize[_0xe174('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xe174('0x1')]},'priority':{'type':Sequelize[_0xe174('0x1')]},'enhanced':{'type':Sequelize[_0xe174('0x1')]},'accountcode':{'type':Sequelize[_0xe174('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xe174('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xe174('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x5f0d=['BOOLEAN','sequelize','STRING','DATE'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5f0d,0x1c1));var _0xd5f0=function(_0x2ab4db,_0x3e0c74){_0x2ab4db=_0x2ab4db-0x0;var _0x130e26=_0x5f0d[_0x2ab4db];return _0x130e26;};'use strict';var Sequelize=require(_0xd5f0('0x0'));module['exports']={'network':{'type':Sequelize[_0xd5f0('0x1')]},'network_script':{'type':Sequelize[_0xd5f0('0x1')]},'request':{'type':Sequelize[_0xd5f0('0x1')]},'channel':{'type':Sequelize[_0xd5f0('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd5f0('0x1')]},'uniqueid':{'type':Sequelize[_0xd5f0('0x1')]},'version':{'type':Sequelize[_0xd5f0('0x1')]},'callerid':{'type':Sequelize[_0xd5f0('0x1')]},'calleridname':{'type':Sequelize[_0xd5f0('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xd5f0('0x1')]},'callington':{'type':Sequelize[_0xd5f0('0x1')]},'callingtns':{'type':Sequelize[_0xd5f0('0x1')]},'dnid':{'type':Sequelize[_0xd5f0('0x1')]},'rdnis':{'type':Sequelize[_0xd5f0('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd5f0('0x1')]},'enhanced':{'type':Sequelize[_0xd5f0('0x1')]},'accountcode':{'type':Sequelize[_0xd5f0('0x1')]},'threadid':{'type':Sequelize[_0xd5f0('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd5f0('0x2')]},'bot':{'type':Sequelize[_0xd5f0('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 8a8a21d..1005f8f 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 _0x8356=['map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','offset','limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x8356,0x104));var _0x6835=function(_0x56fd29,_0x17790b){_0x56fd29=_0x56fd29-0x0;var _0x2a0bf7=_0x8356[_0x56fd29];return _0x2a0bf7;};'use strict';var emlformat=require(_0x6835('0x0'));var rimraf=require(_0x6835('0x1'));var zipdir=require(_0x6835('0x2'));var jsonpatch=require(_0x6835('0x3'));var rp=require('request-promise');var moment=require(_0x6835('0x4'));var BPromise=require(_0x6835('0x5'));var Mustache=require(_0x6835('0x6'));var util=require(_0x6835('0x7'));var path=require(_0x6835('0x8'));var sox=require(_0x6835('0x9'));var csv=require(_0x6835('0xa'));var ejs=require(_0x6835('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6835('0xc'));var squel=require(_0x6835('0xd'));var crypto=require(_0x6835('0xe'));var jsforce=require(_0x6835('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6835('0xa'));var querystring=require(_0x6835('0x10'));var Papa=require(_0x6835('0x11'));var Redis=require(_0x6835('0x12'));var authService=require(_0x6835('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6835('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6835('0x15'))('api');var utils=require(_0x6835('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6835('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x381b43,_0x118465){_0x118465=_0x118465||0xcc;return function(_0x4f02d9){if(_0x4f02d9){return _0x381b43[_0x6835('0x18')](_0x118465);}return _0x381b43[_0x6835('0x19')](_0x118465)[_0x6835('0x1a')]();};}function respondWithResult(_0x47abeb,_0x5631ea){_0x5631ea=_0x5631ea||0xc8;return function(_0x3f90db){if(_0x3f90db){return _0x47abeb[_0x6835('0x19')](_0x5631ea)['json'](_0x3f90db);}};}function respondWithFilteredResult(_0x95d83,_0x1f012f){return function(_0x5a5920){if(_0x5a5920){var _0x161656=typeof _0x1f012f[_0x6835('0x1b')]==='undefined'&&typeof _0x1f012f[_0x6835('0x1c')]==='undefined';var _0x199603=_0x5a5920[_0x6835('0x1d')];var _0x615177=_0x161656?0x0:_0x1f012f['offset'];var _0x1ab46c=_0x161656?_0x5a5920[_0x6835('0x1d')]:_0x1f012f['offset']+_0x1f012f[_0x6835('0x1c')];var _0x43dfd1;if(_0x1ab46c>=_0x199603){_0x1ab46c=_0x199603;_0x43dfd1=0xc8;}else{_0x43dfd1=0xce;}_0x95d83[_0x6835('0x19')](_0x43dfd1);return _0x95d83['set'](_0x6835('0x1e'),_0x615177+'-'+_0x1ab46c+'/'+_0x199603)[_0x6835('0x1f')](_0x5a5920);}return null;};}function patchUpdates(_0x113694){return function(_0x380e76){try{jsonpatch[_0x6835('0x20')](_0x380e76,_0x113694,!![]);}catch(_0x24adcc){return BPromise[_0x6835('0x21')](_0x24adcc);}return _0x380e76[_0x6835('0x22')]();};}function saveUpdates(_0x2f27d2,_0x1b0c9c){return function(_0x49e723){if(_0x49e723){return _0x49e723['update'](_0x2f27d2)[_0x6835('0x23')](function(_0x589db7){return _0x589db7;});}return null;};}function removeEntity(_0x11ba17,_0x3287ee){return function(_0x25bb84){if(_0x25bb84){return _0x25bb84[_0x6835('0x24')]()['then'](function(){_0x11ba17[_0x6835('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33d0b9,_0xbcf106){return function(_0x2ca476){if(!_0x2ca476){_0x33d0b9[_0x6835('0x18')](0x194);}return _0x2ca476;};}function handleError(_0x3af8a2,_0xa327ff){_0xa327ff=_0xa327ff||0x1f4;return function(_0x941c2b){logger[_0x6835('0x25')](_0x941c2b['stack']);if(_0x941c2b[_0x6835('0x26')]){delete _0x941c2b[_0x6835('0x26')];}_0x3af8a2[_0x6835('0x19')](_0xa327ff)[_0x6835('0x27')](_0x941c2b);};}exports['index']=function(_0x2678a4,_0x50f268){var _0x4aa4bf={},_0x2f6224={},_0x2a09fd={'count':0x0,'rows':[]};var _0xad9833=_[_0x6835('0x28')](db[_0x6835('0x29')][_0x6835('0x2a')],function(_0x449259){return{'name':_0x449259[_0x6835('0x2b')],'type':_0x449259[_0x6835('0x2c')][_0x6835('0x2d')]};});_0x2f6224[_0x6835('0x2e')]=_[_0x6835('0x28')](_0xad9833,_0x6835('0x26'));_0x2f6224[_0x6835('0x2f')]=_[_0x6835('0x30')](_0x2678a4[_0x6835('0x2f')]);_0x2f6224['filters']=_['intersection'](_0x2f6224['model'],_0x2f6224[_0x6835('0x2f')]);_0x4aa4bf[_0x6835('0x31')]=_[_0x6835('0x32')](_0x2f6224[_0x6835('0x2e')],qs[_0x6835('0x33')](_0x2678a4['query'][_0x6835('0x33')]));_0x4aa4bf[_0x6835('0x31')]=_0x4aa4bf['attributes'][_0x6835('0x34')]?_0x4aa4bf[_0x6835('0x31')]:_0x2f6224['model'];if(!_0x2678a4['query']['hasOwnProperty'](_0x6835('0x35'))){_0x4aa4bf[_0x6835('0x1c')]=qs[_0x6835('0x1c')](_0x2678a4[_0x6835('0x2f')][_0x6835('0x1c')]);_0x4aa4bf['offset']=qs[_0x6835('0x1b')](_0x2678a4[_0x6835('0x2f')]['offset']);}_0x4aa4bf[_0x6835('0x36')]=qs[_0x6835('0x37')](_0x2678a4[_0x6835('0x2f')]['sort']);_0x4aa4bf[_0x6835('0x38')]=qs[_0x6835('0x39')](_[_0x6835('0x3a')](_0x2678a4[_0x6835('0x2f')],_0x2f6224[_0x6835('0x39')]),_0xad9833);if(_0x2678a4[_0x6835('0x2f')][_0x6835('0x3b')]){_0x4aa4bf[_0x6835('0x38')]=_[_0x6835('0x3c')](_0x4aa4bf[_0x6835('0x38')],{'$or':_[_0x6835('0x28')](_0xad9833,function(_0x44d9c3){if(_0x44d9c3[_0x6835('0x2c')]!==_0x6835('0x3d')){var _0x25f1be={};_0x25f1be[_0x44d9c3[_0x6835('0x26')]]={'$like':'%'+_0x2678a4[_0x6835('0x2f')][_0x6835('0x3b')]+'%'};return _0x25f1be;}})});}_0x4aa4bf=_[_0x6835('0x3c')]({},_0x4aa4bf,_0x2678a4[_0x6835('0x3e')]);var _0x3c7714={'where':_0x4aa4bf[_0x6835('0x38')]};return db[_0x6835('0x29')][_0x6835('0x1d')](_0x3c7714)[_0x6835('0x23')](function(_0x31ad95){_0x2a09fd[_0x6835('0x1d')]=_0x31ad95;if(_0x2678a4[_0x6835('0x2f')][_0x6835('0x3f')]){_0x4aa4bf['include']=[{'all':!![]}];}return db[_0x6835('0x29')][_0x6835('0x40')](_0x4aa4bf);})['then'](function(_0x28eaa8){_0x2a09fd[_0x6835('0x41')]=_0x28eaa8;return _0x2a09fd;})[_0x6835('0x23')](respondWithFilteredResult(_0x50f268,_0x4aa4bf))[_0x6835('0x42')](handleError(_0x50f268,null));};exports[_0x6835('0x43')]=function(_0x2f167c,_0x1636aa){var _0x15a255={'raw':!![],'where':{'id':_0x2f167c['params']['id']}},_0xaebbf5={};_0xaebbf5[_0x6835('0x2e')]=_['keys'](db[_0x6835('0x29')][_0x6835('0x2a')]);_0xaebbf5[_0x6835('0x2f')]=_[_0x6835('0x30')](_0x2f167c[_0x6835('0x2f')]);_0xaebbf5['filters']=_[_0x6835('0x32')](_0xaebbf5['model'],_0xaebbf5['query']);_0x15a255[_0x6835('0x31')]=_['intersection'](_0xaebbf5[_0x6835('0x2e')],qs[_0x6835('0x33')](_0x2f167c[_0x6835('0x2f')][_0x6835('0x33')]));_0x15a255['attributes']=_0x15a255['attributes'][_0x6835('0x34')]?_0x15a255[_0x6835('0x31')]:_0xaebbf5[_0x6835('0x2e')];if(_0x2f167c['query'][_0x6835('0x3f')]){_0x15a255[_0x6835('0x44')]=[{'all':!![]}];}_0x15a255=_['merge']({},_0x15a255,_0x2f167c[_0x6835('0x3e')]);return db[_0x6835('0x29')][_0x6835('0x45')](_0x15a255)[_0x6835('0x23')](handleEntityNotFound(_0x1636aa,null))['then'](respondWithResult(_0x1636aa,null))[_0x6835('0x42')](handleError(_0x1636aa,null));};exports[_0x6835('0x46')]=function(_0x38baae,_0x519840){return db[_0x6835('0x29')][_0x6835('0x46')](_0x38baae[_0x6835('0x47')],{})[_0x6835('0x23')](respondWithResult(_0x519840,0xc9))[_0x6835('0x42')](handleError(_0x519840,null));};exports[_0x6835('0x48')]=function(_0x5ad18d,_0x2a262d){if(_0x5ad18d[_0x6835('0x47')]['id']){delete _0x5ad18d[_0x6835('0x47')]['id'];}return db[_0x6835('0x29')][_0x6835('0x45')]({'where':{'id':_0x5ad18d[_0x6835('0x49')]['id']}})['then'](handleEntityNotFound(_0x2a262d,null))[_0x6835('0x23')](saveUpdates(_0x5ad18d['body'],null))[_0x6835('0x23')](respondWithResult(_0x2a262d,null))['catch'](handleError(_0x2a262d,null));};exports['destroy']=function(_0x436140,_0x436f1f){return db['SquareReport']['find']({'where':{'id':_0x436140[_0x6835('0x49')]['id']}})['then'](handleEntityNotFound(_0x436f1f,null))['then'](removeEntity(_0x436f1f,null))[_0x6835('0x42')](handleError(_0x436f1f,null));};exports[_0x6835('0x4a')]=function(_0x5ec2ff,_0x6b3fa9){return db[_0x6835('0x29')][_0x6835('0x4a')]()[_0x6835('0x23')](respondWithResult(_0x6b3fa9,null))[_0x6835('0x42')](handleError(_0x6b3fa9,null));}; \ No newline at end of file +var _0xca38=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','SquareReport','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','fields','include','merge','options','create','body','find','describe','eml-format','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x13f83f,_0x44e4b6){var _0x5648f5=function(_0x2611bb){while(--_0x2611bb){_0x13f83f['push'](_0x13f83f['shift']());}};_0x5648f5(++_0x44e4b6);}(_0xca38,0x1d5));var _0x8ca3=function(_0xd413a4,_0x3120fe){_0xd413a4=_0xd413a4-0x0;var _0x9170f4=_0xca38[_0xd413a4];return _0x9170f4;};'use strict';var emlformat=require(_0x8ca3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8ca3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8ca3('0x2'));var moment=require('moment');var BPromise=require(_0x8ca3('0x3'));var Mustache=require(_0x8ca3('0x4'));var util=require('util');var path=require('path');var sox=require(_0x8ca3('0x5'));var csv=require(_0x8ca3('0x6'));var ejs=require(_0x8ca3('0x7'));var fs=require('fs');var fs_extra=require(_0x8ca3('0x8'));var _=require(_0x8ca3('0x9'));var squel=require('squel');var crypto=require(_0x8ca3('0xa'));var jsforce=require(_0x8ca3('0xb'));var deskjs=require(_0x8ca3('0xc'));var toCsv=require(_0x8ca3('0x6'));var querystring=require(_0x8ca3('0xd'));var Papa=require(_0x8ca3('0xe'));var Redis=require(_0x8ca3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8ca3('0x10'));var as=require(_0x8ca3('0x11'));var hardwareService=require(_0x8ca3('0x12'));var logger=require(_0x8ca3('0x13'))('api');var utils=require(_0x8ca3('0x14'));var config=require(_0x8ca3('0x15'));var licenseUtil=require(_0x8ca3('0x16'));var db=require(_0x8ca3('0x17'))['db'];function respondWithStatusCode(_0x386ce5,_0x22b9b5){_0x22b9b5=_0x22b9b5||0xcc;return function(_0x5f3fb4){if(_0x5f3fb4){return _0x386ce5[_0x8ca3('0x18')](_0x22b9b5);}return _0x386ce5[_0x8ca3('0x19')](_0x22b9b5)[_0x8ca3('0x1a')]();};}function respondWithResult(_0x192ddf,_0x371c8c){_0x371c8c=_0x371c8c||0xc8;return function(_0x5f1024){if(_0x5f1024){return _0x192ddf['status'](_0x371c8c)[_0x8ca3('0x1b')](_0x5f1024);}};}function respondWithFilteredResult(_0x30e1d0,_0x5d6797){return function(_0xe0d33a){if(_0xe0d33a){var _0x335cdd=typeof _0x5d6797[_0x8ca3('0x1c')]==='undefined'&&typeof _0x5d6797[_0x8ca3('0x1d')]===_0x8ca3('0x1e');var _0x292cb9=_0xe0d33a[_0x8ca3('0x1f')];var _0x14a5df=_0x335cdd?0x0:_0x5d6797[_0x8ca3('0x1c')];var _0x451ae1=_0x335cdd?_0xe0d33a[_0x8ca3('0x1f')]:_0x5d6797[_0x8ca3('0x1c')]+_0x5d6797[_0x8ca3('0x1d')];var _0x29630f;if(_0x451ae1>=_0x292cb9){_0x451ae1=_0x292cb9;_0x29630f=0xc8;}else{_0x29630f=0xce;}_0x30e1d0[_0x8ca3('0x19')](_0x29630f);return _0x30e1d0[_0x8ca3('0x20')](_0x8ca3('0x21'),_0x14a5df+'-'+_0x451ae1+'/'+_0x292cb9)[_0x8ca3('0x1b')](_0xe0d33a);}return null;};}function patchUpdates(_0x470a13){return function(_0x6f586c){try{jsonpatch[_0x8ca3('0x22')](_0x6f586c,_0x470a13,!![]);}catch(_0xf27fd8){return BPromise[_0x8ca3('0x23')](_0xf27fd8);}return _0x6f586c[_0x8ca3('0x24')]();};}function saveUpdates(_0x55db7f,_0x39620b){return function(_0x3289a0){if(_0x3289a0){return _0x3289a0[_0x8ca3('0x25')](_0x55db7f)['then'](function(_0x4cdf16){return _0x4cdf16;});}return null;};}function removeEntity(_0x3081a1,_0x210ac2){return function(_0x40f981){if(_0x40f981){return _0x40f981[_0x8ca3('0x26')]()[_0x8ca3('0x27')](function(){_0x3081a1['status'](0xcc)[_0x8ca3('0x1a')]();});}};}function handleEntityNotFound(_0x3924b8,_0x4afc6b){return function(_0x441fb9){if(!_0x441fb9){_0x3924b8[_0x8ca3('0x18')](0x194);}return _0x441fb9;};}function handleError(_0x1295d4,_0x3d470e){_0x3d470e=_0x3d470e||0x1f4;return function(_0x27b102){logger[_0x8ca3('0x28')](_0x27b102[_0x8ca3('0x29')]);if(_0x27b102[_0x8ca3('0x2a')]){delete _0x27b102[_0x8ca3('0x2a')];}_0x1295d4[_0x8ca3('0x19')](_0x3d470e)[_0x8ca3('0x2b')](_0x27b102);};}exports[_0x8ca3('0x2c')]=function(_0xaf130b,_0x1175c7){var _0x53f003={},_0x4262fb={},_0x1ca3e1={'count':0x0,'rows':[]};var _0x43baa0=_['map'](db[_0x8ca3('0x2d')]['rawAttributes'],function(_0x5d458e){return{'name':_0x5d458e[_0x8ca3('0x2e')],'type':_0x5d458e[_0x8ca3('0x2f')][_0x8ca3('0x30')]};});_0x4262fb[_0x8ca3('0x31')]=_['map'](_0x43baa0,_0x8ca3('0x2a'));_0x4262fb[_0x8ca3('0x32')]=_['keys'](_0xaf130b[_0x8ca3('0x32')]);_0x4262fb[_0x8ca3('0x33')]=_[_0x8ca3('0x34')](_0x4262fb['model'],_0x4262fb[_0x8ca3('0x32')]);_0x53f003[_0x8ca3('0x35')]=_[_0x8ca3('0x34')](_0x4262fb[_0x8ca3('0x31')],qs['fields'](_0xaf130b[_0x8ca3('0x32')]['fields']));_0x53f003[_0x8ca3('0x35')]=_0x53f003[_0x8ca3('0x35')][_0x8ca3('0x36')]?_0x53f003['attributes']:_0x4262fb[_0x8ca3('0x31')];if(!_0xaf130b[_0x8ca3('0x32')][_0x8ca3('0x37')](_0x8ca3('0x38'))){_0x53f003[_0x8ca3('0x1d')]=qs[_0x8ca3('0x1d')](_0xaf130b['query']['limit']);_0x53f003[_0x8ca3('0x1c')]=qs['offset'](_0xaf130b['query'][_0x8ca3('0x1c')]);}_0x53f003[_0x8ca3('0x39')]=qs['sort'](_0xaf130b[_0x8ca3('0x32')][_0x8ca3('0x3a')]);_0x53f003[_0x8ca3('0x3b')]=qs[_0x8ca3('0x33')](_[_0x8ca3('0x3c')](_0xaf130b['query'],_0x4262fb[_0x8ca3('0x33')]),_0x43baa0);if(_0xaf130b[_0x8ca3('0x32')][_0x8ca3('0x3d')]){_0x53f003[_0x8ca3('0x3b')]=_['merge'](_0x53f003[_0x8ca3('0x3b')],{'$or':_[_0x8ca3('0x3e')](_0x43baa0,function(_0x5844b2){if(_0x5844b2[_0x8ca3('0x2f')]!==_0x8ca3('0x3f')){var _0x179ab5={};_0x179ab5[_0x5844b2[_0x8ca3('0x2a')]]={'$like':'%'+_0xaf130b[_0x8ca3('0x32')][_0x8ca3('0x3d')]+'%'};return _0x179ab5;}})});}_0x53f003=_['merge']({},_0x53f003,_0xaf130b['options']);var _0xfbf04={'where':_0x53f003[_0x8ca3('0x3b')]};return db[_0x8ca3('0x2d')][_0x8ca3('0x1f')](_0xfbf04)[_0x8ca3('0x27')](function(_0x53f269){_0x1ca3e1[_0x8ca3('0x1f')]=_0x53f269;if(_0xaf130b['query'][_0x8ca3('0x40')]){_0x53f003['include']=[{'all':!![]}];}return db[_0x8ca3('0x2d')][_0x8ca3('0x41')](_0x53f003);})['then'](function(_0x45d78c){_0x1ca3e1[_0x8ca3('0x42')]=_0x45d78c;return _0x1ca3e1;})[_0x8ca3('0x27')](respondWithFilteredResult(_0x1175c7,_0x53f003))[_0x8ca3('0x43')](handleError(_0x1175c7,null));};exports[_0x8ca3('0x44')]=function(_0xa4613f,_0x424c29){var _0x271abe={'raw':!![],'where':{'id':_0xa4613f[_0x8ca3('0x45')]['id']}},_0x3c84e={};_0x3c84e['model']=_[_0x8ca3('0x46')](db['SquareReport'][_0x8ca3('0x47')]);_0x3c84e[_0x8ca3('0x32')]=_[_0x8ca3('0x46')](_0xa4613f[_0x8ca3('0x32')]);_0x3c84e[_0x8ca3('0x33')]=_[_0x8ca3('0x34')](_0x3c84e[_0x8ca3('0x31')],_0x3c84e[_0x8ca3('0x32')]);_0x271abe[_0x8ca3('0x35')]=_[_0x8ca3('0x34')](_0x3c84e['model'],qs[_0x8ca3('0x48')](_0xa4613f[_0x8ca3('0x32')][_0x8ca3('0x48')]));_0x271abe['attributes']=_0x271abe[_0x8ca3('0x35')]['length']?_0x271abe['attributes']:_0x3c84e[_0x8ca3('0x31')];if(_0xa4613f[_0x8ca3('0x32')][_0x8ca3('0x40')]){_0x271abe[_0x8ca3('0x49')]=[{'all':!![]}];}_0x271abe=_[_0x8ca3('0x4a')]({},_0x271abe,_0xa4613f[_0x8ca3('0x4b')]);return db[_0x8ca3('0x2d')]['find'](_0x271abe)[_0x8ca3('0x27')](handleEntityNotFound(_0x424c29,null))[_0x8ca3('0x27')](respondWithResult(_0x424c29,null))[_0x8ca3('0x43')](handleError(_0x424c29,null));};exports[_0x8ca3('0x4c')]=function(_0xac6c8f,_0xb16658){return db[_0x8ca3('0x2d')][_0x8ca3('0x4c')](_0xac6c8f['body'],{})[_0x8ca3('0x27')](respondWithResult(_0xb16658,0xc9))[_0x8ca3('0x43')](handleError(_0xb16658,null));};exports[_0x8ca3('0x25')]=function(_0x2ab5a2,_0x2a508d){if(_0x2ab5a2['body']['id']){delete _0x2ab5a2[_0x8ca3('0x4d')]['id'];}return db['SquareReport'][_0x8ca3('0x4e')]({'where':{'id':_0x2ab5a2[_0x8ca3('0x45')]['id']}})[_0x8ca3('0x27')](handleEntityNotFound(_0x2a508d,null))[_0x8ca3('0x27')](saveUpdates(_0x2ab5a2[_0x8ca3('0x4d')],null))[_0x8ca3('0x27')](respondWithResult(_0x2a508d,null))[_0x8ca3('0x43')](handleError(_0x2a508d,null));};exports['destroy']=function(_0xfaccf8,_0xc7f7d1){return db[_0x8ca3('0x2d')][_0x8ca3('0x4e')]({'where':{'id':_0xfaccf8[_0x8ca3('0x45')]['id']}})[_0x8ca3('0x27')](handleEntityNotFound(_0xc7f7d1,null))[_0x8ca3('0x27')](removeEntity(_0xc7f7d1,null))[_0x8ca3('0x43')](handleError(_0xc7f7d1,null));};exports[_0x8ca3('0x4f')]=function(_0x4aa480,_0x24c1f4){return db[_0x8ca3('0x2d')][_0x8ca3('0x4f')]()['then'](respondWithResult(_0x24c1f4,null))['catch'](handleError(_0x24c1f4,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 94700a1..448da75 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 _0xc1ce=['request-promise','path','exports','define','report_square','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment'];(function(_0x5547c8,_0x5c3a5b){var _0x543d70=function(_0x2e37dc){while(--_0x2e37dc){_0x5547c8['push'](_0x5547c8['shift']());}};_0x543d70(++_0x5c3a5b);}(_0xc1ce,0xf2));var _0xec1c=function(_0x43feed,_0x1c0ad5){_0x43feed=_0x43feed-0x0;var _0x2c744a=_0xc1ce[_0x43feed];return _0x2c744a;};'use strict';var _=require(_0xec1c('0x0'));var util=require(_0xec1c('0x1'));var logger=require(_0xec1c('0x2'))(_0xec1c('0x3'));var moment=require(_0xec1c('0x4'));var BPromise=require('bluebird');var rp=require(_0xec1c('0x5'));var fs=require('fs');var path=require(_0xec1c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module[_0xec1c('0x7')]=function(_0x251eac,_0xe1ba14){return _0x251eac[_0xec1c('0x8')]('SquareReport',attributes,{'tableName':_0xec1c('0x9'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xec1c('0xa'),_0xec1c('0xb')]},{'name':_0xec1c('0xc'),'fields':[_0xec1c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x481a=['moment','bluebird','path','rimraf','../../config/environment','exports','define','SquareReport','project_name','leaveAt','util','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x481a,0xf4));var _0xa481=function(_0x546b6c,_0x186692){_0x546b6c=_0x546b6c-0x0;var _0x19bbcc=_0x481a[_0x546b6c];return _0x19bbcc;};'use strict';var _=require('lodash');var util=require(_0xa481('0x0'));var logger=require(_0xa481('0x1'))(_0xa481('0x2'));var moment=require(_0xa481('0x3'));var BPromise=require(_0xa481('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa481('0x5'));var rimraf=require(_0xa481('0x6'));var config=require(_0xa481('0x7'));var attributes=require('./squareReport.attributes');module[_0xa481('0x8')]=function(_0x27fc3c,_0xc9aa17){return _0x27fc3c[_0xa481('0x9')](_0xa481('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid',_0xa481('0xb')]},{'name':'leaveAt','fields':[_0xa481('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index a08c021..04f8f12 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 _0x1e31=['update','where','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','CreateSquareReport','SquareReport','create','body','options','raw','catch','UpdateSquareReport'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x1e31,0x10a));var _0x11e3=function(_0x4398cb,_0x46319f){_0x4398cb=_0x4398cb-0x0;var _0x4deee4=_0x1e31[_0x4398cb];return _0x4deee4;};'use strict';var _=require(_0x11e3('0x0'));var util=require(_0x11e3('0x1'));var moment=require('moment');var BPromise=require(_0x11e3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11e3('0x3'));var db=require(_0x11e3('0x4'))['db'];var utils=require(_0x11e3('0x5'));var logger=require(_0x11e3('0x6'))(_0x11e3('0x7'));var config=require(_0x11e3('0x8'));var jayson=require(_0x11e3('0x9'));var client=jayson[_0x11e3('0xa')][_0x11e3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15d741,_0x3edcee,_0x1702ad){return new BPromise(function(_0x3fd978,_0x197ee6){return client['request'](_0x15d741,_0x1702ad)[_0x11e3('0xc')](function(_0x45522e){logger['info'](_0x11e3('0xd'),_0x3edcee,'request\x20sent');logger[_0x11e3('0xe')](_0x11e3('0xf'),_0x3edcee,_0x11e3('0x10'),JSON[_0x11e3('0x11')](_0x45522e));if(_0x45522e[_0x11e3('0x12')]){if(_0x45522e['error'][_0x11e3('0x13')]===0x1f4){logger[_0x11e3('0x12')](_0x11e3('0xd'),_0x3edcee,_0x45522e[_0x11e3('0x12')]['message']);return _0x197ee6(_0x45522e['error'][_0x11e3('0x14')]);}logger[_0x11e3('0x12')](_0x11e3('0xd'),_0x3edcee,_0x45522e[_0x11e3('0x12')][_0x11e3('0x14')]);return _0x3fd978(_0x45522e['error'][_0x11e3('0x14')]);}else{logger[_0x11e3('0x15')](_0x11e3('0xd'),_0x3edcee,_0x11e3('0x10'));_0x3fd978(_0x45522e[_0x11e3('0x16')][_0x11e3('0x14')]);}})['catch'](function(_0x481d76){logger[_0x11e3('0x12')]('SquareReport,\x20%s,\x20%s',_0x3edcee,_0x481d76);_0x197ee6(_0x481d76);});});}exports[_0x11e3('0x17')]=function(_0x46e44d){var _0x4ceac1=this;return new Promise(function(_0x277a19,_0x562135){return db[_0x11e3('0x18')][_0x11e3('0x19')](_0x46e44d[_0x11e3('0x1a')],{'raw':_0x46e44d['options']?_0x46e44d[_0x11e3('0x1b')][_0x11e3('0x1c')]===undefined?!![]:![]:!![]})[_0x11e3('0xc')](function(_0x35e31e){logger[_0x11e3('0x15')](_0x11e3('0x17'),_0x46e44d);logger['debug']('CreateSquareReport',_0x46e44d,JSON[_0x11e3('0x11')](_0x35e31e));_0x277a19(_0x35e31e);})[_0x11e3('0x1d')](function(_0x5cd9d0){logger[_0x11e3('0x12')](_0x11e3('0x17'),_0x5cd9d0[_0x11e3('0x14')],_0x46e44d);_0x562135(_0x4ceac1['error'](0x1f4,_0x5cd9d0[_0x11e3('0x14')]));});});};exports[_0x11e3('0x1e')]=function(_0x5b2883){var _0x16ab7b=this;return new Promise(function(_0x585fad,_0x5d2229){return db[_0x11e3('0x18')][_0x11e3('0x1f')](_0x5b2883[_0x11e3('0x1a')],{'raw':_0x5b2883[_0x11e3('0x1b')]?_0x5b2883['options'][_0x11e3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b2883[_0x11e3('0x1b')]?_0x5b2883[_0x11e3('0x1b')][_0x11e3('0x20')]||null:null,'attributes':_0x5b2883['options']?_0x5b2883[_0x11e3('0x1b')]['attributes']||null:null,'limit':_0x5b2883[_0x11e3('0x1b')]?_0x5b2883[_0x11e3('0x1b')]['limit']||null:null})[_0x11e3('0xc')](function(_0x258572){logger[_0x11e3('0x15')]('UpdateSquareReport',_0x5b2883);logger[_0x11e3('0xe')](_0x11e3('0x1e'),_0x5b2883,JSON[_0x11e3('0x11')](_0x258572));_0x585fad(_0x258572);})[_0x11e3('0x1d')](function(_0x47ff02){logger['error'](_0x11e3('0x1e'),_0x47ff02[_0x11e3('0x14')],_0x5b2883);_0x5d2229(_0x16ab7b[_0x11e3('0x12')](0x1f4,_0x47ff02['message']));});});}; \ No newline at end of file +var _0x9e5e=['then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','body','options','raw','update','where','attributes','limit','UpdateSquareReport','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xd63e3a,_0x1bd6eb){var _0x19c178=function(_0x56be0d){while(--_0x56be0d){_0xd63e3a['push'](_0xd63e3a['shift']());}};_0x19c178(++_0x1bd6eb);}(_0x9e5e,0x11e));var _0xe9e5=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x9e5e[_0x368fb9];return _0x4892fb;};'use strict';var _=require(_0xe9e5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe9e5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9e5('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe9e5('0x3'));var logger=require(_0xe9e5('0x4'))(_0xe9e5('0x5'));var config=require(_0xe9e5('0x6'));var jayson=require(_0xe9e5('0x7'));var client=jayson[_0xe9e5('0x8')][_0xe9e5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5caf9d,_0xbb4055,_0x4f6fd7){return new BPromise(function(_0x2ab3c8,_0xb7b5c6){return client[_0xe9e5('0xa')](_0x5caf9d,_0x4f6fd7)[_0xe9e5('0xb')](function(_0x3c9be0){logger[_0xe9e5('0xc')](_0xe9e5('0xd'),_0xbb4055,'request\x20sent');logger[_0xe9e5('0xe')](_0xe9e5('0xf'),_0xbb4055,_0xe9e5('0x10'),JSON[_0xe9e5('0x11')](_0x3c9be0));if(_0x3c9be0[_0xe9e5('0x12')]){if(_0x3c9be0['error'][_0xe9e5('0x13')]===0x1f4){logger[_0xe9e5('0x12')]('SquareReport,\x20%s,\x20%s',_0xbb4055,_0x3c9be0['error'][_0xe9e5('0x14')]);return _0xb7b5c6(_0x3c9be0['error'][_0xe9e5('0x14')]);}logger[_0xe9e5('0x12')]('SquareReport,\x20%s,\x20%s',_0xbb4055,_0x3c9be0[_0xe9e5('0x12')][_0xe9e5('0x14')]);return _0x2ab3c8(_0x3c9be0['error'][_0xe9e5('0x14')]);}else{logger[_0xe9e5('0xc')]('SquareReport,\x20%s,\x20%s',_0xbb4055,'request\x20sent');_0x2ab3c8(_0x3c9be0[_0xe9e5('0x15')][_0xe9e5('0x14')]);}})[_0xe9e5('0x16')](function(_0x3bbe05){logger[_0xe9e5('0x12')](_0xe9e5('0xd'),_0xbb4055,_0x3bbe05);_0xb7b5c6(_0x3bbe05);});});}exports[_0xe9e5('0x17')]=function(_0xf0b97){var _0x23081b=this;return new Promise(function(_0x57b87e,_0x3c2636){return db[_0xe9e5('0x18')]['create'](_0xf0b97[_0xe9e5('0x19')],{'raw':_0xf0b97['options']?_0xf0b97[_0xe9e5('0x1a')][_0xe9e5('0x1b')]===undefined?!![]:![]:!![]})[_0xe9e5('0xb')](function(_0x5d5959){logger[_0xe9e5('0xc')](_0xe9e5('0x17'),_0xf0b97);logger['debug'](_0xe9e5('0x17'),_0xf0b97,JSON[_0xe9e5('0x11')](_0x5d5959));_0x57b87e(_0x5d5959);})[_0xe9e5('0x16')](function(_0x31932b){logger[_0xe9e5('0x12')]('CreateSquareReport',_0x31932b[_0xe9e5('0x14')],_0xf0b97);_0x3c2636(_0x23081b[_0xe9e5('0x12')](0x1f4,_0x31932b[_0xe9e5('0x14')]));});});};exports['UpdateSquareReport']=function(_0x58bd6d){var _0xa5dfa2=this;return new Promise(function(_0x1b6470,_0x2a50fc){return db[_0xe9e5('0x18')][_0xe9e5('0x1c')](_0x58bd6d['body'],{'raw':_0x58bd6d[_0xe9e5('0x1a')]?_0x58bd6d[_0xe9e5('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58bd6d['options']?_0x58bd6d[_0xe9e5('0x1a')][_0xe9e5('0x1d')]||null:null,'attributes':_0x58bd6d['options']?_0x58bd6d[_0xe9e5('0x1a')][_0xe9e5('0x1e')]||null:null,'limit':_0x58bd6d[_0xe9e5('0x1a')]?_0x58bd6d[_0xe9e5('0x1a')][_0xe9e5('0x1f')]||null:null})[_0xe9e5('0xb')](function(_0x10991e){logger[_0xe9e5('0xc')](_0xe9e5('0x20'),_0x58bd6d);logger['debug'](_0xe9e5('0x20'),_0x58bd6d,JSON[_0xe9e5('0x11')](_0x10991e));_0x1b6470(_0x10991e);})[_0xe9e5('0x16')](function(_0x5356eb){logger['error'](_0xe9e5('0x20'),_0x5356eb[_0xe9e5('0x14')],_0x58bd6d);_0x2a50fc(_0xa5dfa2[_0xe9e5('0x12')](0x1f4,_0x5356eb[_0xe9e5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index ba2ae1e..ce5b156 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 _0x6245=['multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','index','/describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy'];(function(_0x323d87,_0x4ef3f9){var _0x5e8f74=function(_0x185735){while(--_0x185735){_0x323d87['push'](_0x323d87['shift']());}};_0x5e8f74(++_0x4ef3f9);}(_0x6245,0x93));var _0x5624=function(_0x45161c,_0x5494fc){_0x45161c=_0x45161c-0x0;var _0x186581=_0x6245[_0x45161c];return _0x186581;};'use strict';var multer=require(_0x5624('0x0'));var util=require(_0x5624('0x1'));var path=require(_0x5624('0x2'));var timeout=require('connect-timeout');var express=require(_0x5624('0x3'));var router=express['Router']();var fs_extra=require(_0x5624('0x4'));var auth=require(_0x5624('0x5'));var interaction=require(_0x5624('0x6'));var config=require(_0x5624('0x7'));var controller=require(_0x5624('0x8'));router[_0x5624('0x9')]('/',auth['isAuthenticated'](),controller[_0x5624('0xa')]);router[_0x5624('0x9')](_0x5624('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x5624('0x9')](_0x5624('0xc'),auth[_0x5624('0xd')](),controller[_0x5624('0xe')]);router[_0x5624('0xf')]('/',auth[_0x5624('0xd')](),controller[_0x5624('0x10')]);router[_0x5624('0x11')](_0x5624('0xc'),auth[_0x5624('0xd')](),controller[_0x5624('0x12')]);router[_0x5624('0x13')](_0x5624('0xc'),auth[_0x5624('0xd')](),controller[_0x5624('0x14')]);module['exports']=router; \ No newline at end of file +var _0x5e0b=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','delete','destroy','exports'];(function(_0x4b11c1,_0x3caec6){var _0x38c398=function(_0x3f4a21){while(--_0x3f4a21){_0x4b11c1['push'](_0x4b11c1['shift']());}};_0x38c398(++_0x3caec6);}(_0x5e0b,0x6e));var _0xb5e0=function(_0xe30e17,_0xce02be){_0xe30e17=_0xe30e17-0x0;var _0x2342c9=_0x5e0b[_0xe30e17];return _0x2342c9;};'use strict';var multer=require(_0xb5e0('0x0'));var util=require(_0xb5e0('0x1'));var path=require(_0xb5e0('0x2'));var timeout=require(_0xb5e0('0x3'));var express=require(_0xb5e0('0x4'));var router=express[_0xb5e0('0x5')]();var fs_extra=require(_0xb5e0('0x6'));var auth=require(_0xb5e0('0x7'));var interaction=require(_0xb5e0('0x8'));var config=require(_0xb5e0('0x9'));var controller=require(_0xb5e0('0xa'));router[_0xb5e0('0xb')]('/',auth[_0xb5e0('0xc')](),controller[_0xb5e0('0xd')]);router['get'](_0xb5e0('0xe'),auth[_0xb5e0('0xc')](),controller['describe']);router['get'](_0xb5e0('0xf'),auth['isAuthenticated'](),controller[_0xb5e0('0x10')]);router['post']('/',auth[_0xb5e0('0xc')](),controller[_0xb5e0('0x11')]);router[_0xb5e0('0x12')](_0xb5e0('0xf'),auth[_0xb5e0('0xc')](),controller['update']);router[_0xb5e0('0x13')](_0xb5e0('0xf'),auth[_0xb5e0('0xc')](),controller[_0xb5e0('0x14')]);module[_0xb5e0('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 ca0dd5d..5f83253 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 _0x1cb4=['exports','STRING','TEXT','sequelize'];(function(_0x223434,_0x1e20e9){var _0x218c8=function(_0x9c48e2){while(--_0x9c48e2){_0x223434['push'](_0x223434['shift']());}};_0x218c8(++_0x1e20e9);}(_0x1cb4,0x9b));var _0x41cb=function(_0x58ad3b,_0x3ef98e){_0x58ad3b=_0x58ad3b-0x0;var _0x4e76ba=_0x1cb4[_0x58ad3b];return _0x4e76ba;};'use strict';var Sequelize=require(_0x41cb('0x0'));module[_0x41cb('0x1')]={'uniqueid':{'type':Sequelize[_0x41cb('0x2')]},'node':{'type':Sequelize[_0x41cb('0x2')]},'application':{'type':Sequelize[_0x41cb('0x2')]},'data':{'type':Sequelize[_0x41cb('0x3')]},'project_name':{'type':Sequelize[_0x41cb('0x2')]},'callerid':{'type':Sequelize[_0x41cb('0x2')]}}; \ No newline at end of file +var _0x19c1=['STRING','TEXT','exports'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x19c1,0x131));var _0x119c=function(_0x62e83c,_0x21c153){_0x62e83c=_0x62e83c-0x0;var _0x19d23f=_0x19c1[_0x62e83c];return _0x19d23f;};'use strict';var Sequelize=require('sequelize');module[_0x119c('0x0')]={'uniqueid':{'type':Sequelize[_0x119c('0x1')]},'node':{'type':Sequelize[_0x119c('0x1')]},'application':{'type':Sequelize[_0x119c('0x1')]},'data':{'type':Sequelize[_0x119c('0x2')]},'project_name':{'type':Sequelize[_0x119c('0x1')]},'callerid':{'type':Sequelize[_0x119c('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 1a872d0..54b87d6 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 _0xc7f7=['catch','show','params','keys','merge','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','destroy','then','error','stack','name','index','map','SquareDetailsReport','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x31eae6,_0x112161){var _0x192fa7=function(_0x42e5db){while(--_0x42e5db){_0x31eae6['push'](_0x31eae6['shift']());}};_0x192fa7(++_0x112161);}(_0xc7f7,0xef));var _0x7c7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7f7[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7c7f('0x0'));var rimraf=require(_0x7c7f('0x1'));var zipdir=require(_0x7c7f('0x2'));var jsonpatch=require(_0x7c7f('0x3'));var rp=require(_0x7c7f('0x4'));var moment=require(_0x7c7f('0x5'));var BPromise=require(_0x7c7f('0x6'));var Mustache=require('mustache');var util=require(_0x7c7f('0x7'));var path=require(_0x7c7f('0x8'));var sox=require('sox');var csv=require(_0x7c7f('0x9'));var ejs=require(_0x7c7f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7c7f('0xb'));var squel=require(_0x7c7f('0xc'));var crypto=require('crypto');var jsforce=require(_0x7c7f('0xd'));var deskjs=require(_0x7c7f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7c7f('0xf'));var Papa=require(_0x7c7f('0x10'));var Redis=require('ioredis');var authService=require(_0x7c7f('0x11'));var qs=require(_0x7c7f('0x12'));var as=require(_0x7c7f('0x13'));var hardwareService=require(_0x7c7f('0x14'));var logger=require(_0x7c7f('0x15'))('api');var utils=require(_0x7c7f('0x16'));var config=require(_0x7c7f('0x17'));var licenseUtil=require(_0x7c7f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x295d5b,_0x1bb520){_0x1bb520=_0x1bb520||0xcc;return function(_0xbc1319){if(_0xbc1319){return _0x295d5b[_0x7c7f('0x19')](_0x1bb520);}return _0x295d5b[_0x7c7f('0x1a')](_0x1bb520)[_0x7c7f('0x1b')]();};}function respondWithResult(_0x51dca9,_0x49e15e){_0x49e15e=_0x49e15e||0xc8;return function(_0x31c9ef){if(_0x31c9ef){return _0x51dca9[_0x7c7f('0x1a')](_0x49e15e)[_0x7c7f('0x1c')](_0x31c9ef);}};}function respondWithFilteredResult(_0xab4f74,_0x1dd739){return function(_0x2f2185){if(_0x2f2185){var _0x447467=typeof _0x1dd739['offset']===_0x7c7f('0x1d')&&typeof _0x1dd739[_0x7c7f('0x1e')]===_0x7c7f('0x1d');var _0x15b01c=_0x2f2185[_0x7c7f('0x1f')];var _0x5374bb=_0x447467?0x0:_0x1dd739[_0x7c7f('0x20')];var _0xb243fb=_0x447467?_0x2f2185[_0x7c7f('0x1f')]:_0x1dd739[_0x7c7f('0x20')]+_0x1dd739[_0x7c7f('0x1e')];var _0x33eb63;if(_0xb243fb>=_0x15b01c){_0xb243fb=_0x15b01c;_0x33eb63=0xc8;}else{_0x33eb63=0xce;}_0xab4f74[_0x7c7f('0x1a')](_0x33eb63);return _0xab4f74['set']('Content-Range',_0x5374bb+'-'+_0xb243fb+'/'+_0x15b01c)[_0x7c7f('0x1c')](_0x2f2185);}return null;};}function patchUpdates(_0x1b90d8){return function(_0x144765){try{jsonpatch[_0x7c7f('0x21')](_0x144765,_0x1b90d8,!![]);}catch(_0x3e8452){return BPromise[_0x7c7f('0x22')](_0x3e8452);}return _0x144765[_0x7c7f('0x23')]();};}function saveUpdates(_0x47f649,_0x3e8325){return function(_0x30898c){if(_0x30898c){return _0x30898c[_0x7c7f('0x24')](_0x47f649)['then'](function(_0xf85a51){return _0xf85a51;});}return null;};}function removeEntity(_0x14bbc2,_0x1b2a05){return function(_0x9342f8){if(_0x9342f8){return _0x9342f8[_0x7c7f('0x25')]()[_0x7c7f('0x26')](function(){_0x14bbc2[_0x7c7f('0x1a')](0xcc)[_0x7c7f('0x1b')]();});}};}function handleEntityNotFound(_0x23a451,_0x51e89f){return function(_0xd9c715){if(!_0xd9c715){_0x23a451['sendStatus'](0x194);}return _0xd9c715;};}function handleError(_0x1fb2b3,_0xcc2de4){_0xcc2de4=_0xcc2de4||0x1f4;return function(_0x4e5e52){logger[_0x7c7f('0x27')](_0x4e5e52[_0x7c7f('0x28')]);if(_0x4e5e52[_0x7c7f('0x29')]){delete _0x4e5e52[_0x7c7f('0x29')];}_0x1fb2b3['status'](_0xcc2de4)['send'](_0x4e5e52);};}exports[_0x7c7f('0x2a')]=function(_0x4dad0c,_0x1c0be2){var _0x1e36b7={},_0x467a4c={},_0x5227ef={'count':0x0,'rows':[]};var _0x2b4e86=_[_0x7c7f('0x2b')](db[_0x7c7f('0x2c')][_0x7c7f('0x2d')],function(_0x536ea7){return{'name':_0x536ea7[_0x7c7f('0x2e')],'type':_0x536ea7['type'][_0x7c7f('0x2f')]};});_0x467a4c['model']=_[_0x7c7f('0x2b')](_0x2b4e86,'name');_0x467a4c[_0x7c7f('0x30')]=_['keys'](_0x4dad0c[_0x7c7f('0x30')]);_0x467a4c[_0x7c7f('0x31')]=_[_0x7c7f('0x32')](_0x467a4c[_0x7c7f('0x33')],_0x467a4c[_0x7c7f('0x30')]);_0x1e36b7[_0x7c7f('0x34')]=_[_0x7c7f('0x32')](_0x467a4c[_0x7c7f('0x33')],qs[_0x7c7f('0x35')](_0x4dad0c['query'][_0x7c7f('0x35')]));_0x1e36b7[_0x7c7f('0x34')]=_0x1e36b7[_0x7c7f('0x34')][_0x7c7f('0x36')]?_0x1e36b7[_0x7c7f('0x34')]:_0x467a4c[_0x7c7f('0x33')];if(!_0x4dad0c['query'][_0x7c7f('0x37')](_0x7c7f('0x38'))){_0x1e36b7[_0x7c7f('0x1e')]=qs[_0x7c7f('0x1e')](_0x4dad0c[_0x7c7f('0x30')][_0x7c7f('0x1e')]);_0x1e36b7[_0x7c7f('0x20')]=qs['offset'](_0x4dad0c['query']['offset']);}_0x1e36b7[_0x7c7f('0x39')]=qs[_0x7c7f('0x3a')](_0x4dad0c['query'][_0x7c7f('0x3a')]);_0x1e36b7[_0x7c7f('0x3b')]=qs['filters'](_[_0x7c7f('0x3c')](_0x4dad0c['query'],_0x467a4c[_0x7c7f('0x31')]),_0x2b4e86);if(_0x4dad0c['query'][_0x7c7f('0x3d')]){_0x1e36b7[_0x7c7f('0x3b')]=_['merge'](_0x1e36b7['where'],{'$or':_[_0x7c7f('0x2b')](_0x2b4e86,function(_0x2ff25c){if(_0x2ff25c[_0x7c7f('0x3e')]!==_0x7c7f('0x3f')){var _0x59a755={};_0x59a755[_0x2ff25c[_0x7c7f('0x29')]]={'$like':'%'+_0x4dad0c[_0x7c7f('0x30')][_0x7c7f('0x3d')]+'%'};return _0x59a755;}})});}_0x1e36b7=_['merge']({},_0x1e36b7,_0x4dad0c[_0x7c7f('0x40')]);var _0x57fbff={'where':_0x1e36b7[_0x7c7f('0x3b')]};return db[_0x7c7f('0x2c')][_0x7c7f('0x1f')](_0x57fbff)[_0x7c7f('0x26')](function(_0x3446ac){_0x5227ef[_0x7c7f('0x1f')]=_0x3446ac;if(_0x4dad0c['query'][_0x7c7f('0x41')]){_0x1e36b7[_0x7c7f('0x42')]=[{'all':!![]}];}return db[_0x7c7f('0x2c')][_0x7c7f('0x43')](_0x1e36b7);})[_0x7c7f('0x26')](function(_0x174103){_0x5227ef[_0x7c7f('0x44')]=_0x174103;return _0x5227ef;})[_0x7c7f('0x26')](respondWithFilteredResult(_0x1c0be2,_0x1e36b7))[_0x7c7f('0x45')](handleError(_0x1c0be2,null));};exports[_0x7c7f('0x46')]=function(_0x4a5e8e,_0x50f2b0){var _0x2ecdf8={'raw':!![],'where':{'id':_0x4a5e8e[_0x7c7f('0x47')]['id']}},_0x2a4e00={};_0x2a4e00[_0x7c7f('0x33')]=_[_0x7c7f('0x48')](db[_0x7c7f('0x2c')][_0x7c7f('0x2d')]);_0x2a4e00[_0x7c7f('0x30')]=_[_0x7c7f('0x48')](_0x4a5e8e[_0x7c7f('0x30')]);_0x2a4e00['filters']=_[_0x7c7f('0x32')](_0x2a4e00[_0x7c7f('0x33')],_0x2a4e00[_0x7c7f('0x30')]);_0x2ecdf8['attributes']=_[_0x7c7f('0x32')](_0x2a4e00[_0x7c7f('0x33')],qs[_0x7c7f('0x35')](_0x4a5e8e[_0x7c7f('0x30')][_0x7c7f('0x35')]));_0x2ecdf8[_0x7c7f('0x34')]=_0x2ecdf8[_0x7c7f('0x34')]['length']?_0x2ecdf8[_0x7c7f('0x34')]:_0x2a4e00[_0x7c7f('0x33')];if(_0x4a5e8e[_0x7c7f('0x30')][_0x7c7f('0x41')]){_0x2ecdf8[_0x7c7f('0x42')]=[{'all':!![]}];}_0x2ecdf8=_[_0x7c7f('0x49')]({},_0x2ecdf8,_0x4a5e8e[_0x7c7f('0x40')]);return db[_0x7c7f('0x2c')][_0x7c7f('0x4a')](_0x2ecdf8)[_0x7c7f('0x26')](handleEntityNotFound(_0x50f2b0,null))[_0x7c7f('0x26')](respondWithResult(_0x50f2b0,null))[_0x7c7f('0x45')](handleError(_0x50f2b0,null));};exports['create']=function(_0x3c50a0,_0x4af774){return db[_0x7c7f('0x2c')]['create'](_0x3c50a0[_0x7c7f('0x4b')],{})['then'](respondWithResult(_0x4af774,0xc9))[_0x7c7f('0x45')](handleError(_0x4af774,null));};exports[_0x7c7f('0x24')]=function(_0x181c22,_0x5d30e2){if(_0x181c22[_0x7c7f('0x4b')]['id']){delete _0x181c22[_0x7c7f('0x4b')]['id'];}return db['SquareDetailsReport'][_0x7c7f('0x4a')]({'where':{'id':_0x181c22['params']['id']}})[_0x7c7f('0x26')](handleEntityNotFound(_0x5d30e2,null))[_0x7c7f('0x26')](saveUpdates(_0x181c22[_0x7c7f('0x4b')],null))[_0x7c7f('0x26')](respondWithResult(_0x5d30e2,null))['catch'](handleError(_0x5d30e2,null));};exports[_0x7c7f('0x25')]=function(_0x13d220,_0x35c9a9){return db[_0x7c7f('0x2c')][_0x7c7f('0x4a')]({'where':{'id':_0x13d220[_0x7c7f('0x47')]['id']}})[_0x7c7f('0x26')](handleEntityNotFound(_0x35c9a9,null))[_0x7c7f('0x26')](removeEntity(_0x35c9a9,null))[_0x7c7f('0x45')](handleError(_0x35c9a9,null));};exports[_0x7c7f('0x4c')]=function(_0x3a807d,_0x99524e){return db[_0x7c7f('0x2c')][_0x7c7f('0x4c')]()[_0x7c7f('0x26')](respondWithResult(_0x99524e,null))[_0x7c7f('0x45')](handleError(_0x99524e,null));}; \ No newline at end of file +var _0xfaa6=['path','sox','to-csv','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','fieldName','type','key','model','query','keys','filters','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','SquareDetailsReport','rawAttributes','intersection','include','options','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x4509cf,_0x1b4e21){var _0x5f35bb=function(_0x2e3cad){while(--_0x2e3cad){_0x4509cf['push'](_0x4509cf['shift']());}};_0x5f35bb(++_0x1b4e21);}(_0xfaa6,0xdd));var _0x6faa=function(_0x4536a4,_0x55af7b){_0x4536a4=_0x4536a4-0x0;var _0x4fd1c1=_0xfaa6[_0x4536a4];return _0x4fd1c1;};'use strict';var emlformat=require(_0x6faa('0x0'));var rimraf=require(_0x6faa('0x1'));var zipdir=require(_0x6faa('0x2'));var jsonpatch=require(_0x6faa('0x3'));var rp=require(_0x6faa('0x4'));var moment=require(_0x6faa('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6faa('0x6'));var util=require('util');var path=require(_0x6faa('0x7'));var sox=require(_0x6faa('0x8'));var csv=require(_0x6faa('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6faa('0xa'));var _=require(_0x6faa('0xb'));var squel=require(_0x6faa('0xc'));var crypto=require(_0x6faa('0xd'));var jsforce=require(_0x6faa('0xe'));var deskjs=require(_0x6faa('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6faa('0x10'));var Redis=require('ioredis');var authService=require(_0x6faa('0x11'));var qs=require(_0x6faa('0x12'));var as=require(_0x6faa('0x13'));var hardwareService=require(_0x6faa('0x14'));var logger=require(_0x6faa('0x15'))(_0x6faa('0x16'));var utils=require('../../config/utils');var config=require(_0x6faa('0x17'));var licenseUtil=require(_0x6faa('0x18'));var db=require(_0x6faa('0x19'))['db'];function respondWithStatusCode(_0x4fa8dd,_0xc1a560){_0xc1a560=_0xc1a560||0xcc;return function(_0x1fd4e3){if(_0x1fd4e3){return _0x4fa8dd[_0x6faa('0x1a')](_0xc1a560);}return _0x4fa8dd[_0x6faa('0x1b')](_0xc1a560)[_0x6faa('0x1c')]();};}function respondWithResult(_0x4c13a7,_0x2d65a4){_0x2d65a4=_0x2d65a4||0xc8;return function(_0x4e1d38){if(_0x4e1d38){return _0x4c13a7['status'](_0x2d65a4)[_0x6faa('0x1d')](_0x4e1d38);}};}function respondWithFilteredResult(_0x32dc2f,_0xcd21f5){return function(_0x22c2c7){if(_0x22c2c7){var _0x249163=typeof _0xcd21f5[_0x6faa('0x1e')]===_0x6faa('0x1f')&&typeof _0xcd21f5[_0x6faa('0x20')]==='undefined';var _0x49e27d=_0x22c2c7[_0x6faa('0x21')];var _0x164f9e=_0x249163?0x0:_0xcd21f5['offset'];var _0x3baf36=_0x249163?_0x22c2c7[_0x6faa('0x21')]:_0xcd21f5['offset']+_0xcd21f5[_0x6faa('0x20')];var _0xa9aa79;if(_0x3baf36>=_0x49e27d){_0x3baf36=_0x49e27d;_0xa9aa79=0xc8;}else{_0xa9aa79=0xce;}_0x32dc2f[_0x6faa('0x1b')](_0xa9aa79);return _0x32dc2f[_0x6faa('0x22')](_0x6faa('0x23'),_0x164f9e+'-'+_0x3baf36+'/'+_0x49e27d)[_0x6faa('0x1d')](_0x22c2c7);}return null;};}function patchUpdates(_0x3d83f1){return function(_0x432f65){try{jsonpatch[_0x6faa('0x24')](_0x432f65,_0x3d83f1,!![]);}catch(_0x4b8cba){return BPromise[_0x6faa('0x25')](_0x4b8cba);}return _0x432f65[_0x6faa('0x26')]();};}function saveUpdates(_0x1049b5,_0x5e2f44){return function(_0x570f1f){if(_0x570f1f){return _0x570f1f[_0x6faa('0x27')](_0x1049b5)[_0x6faa('0x28')](function(_0x7506ec){return _0x7506ec;});}return null;};}function removeEntity(_0x318293,_0x536a33){return function(_0x563ca7){if(_0x563ca7){return _0x563ca7[_0x6faa('0x29')]()['then'](function(){_0x318293[_0x6faa('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42976d,_0x59375b){return function(_0x1b0e76){if(!_0x1b0e76){_0x42976d[_0x6faa('0x1a')](0x194);}return _0x1b0e76;};}function handleError(_0x19f562,_0x1fc13e){_0x1fc13e=_0x1fc13e||0x1f4;return function(_0x5a237b){logger[_0x6faa('0x2a')](_0x5a237b['stack']);if(_0x5a237b[_0x6faa('0x2b')]){delete _0x5a237b[_0x6faa('0x2b')];}_0x19f562['status'](_0x1fc13e)[_0x6faa('0x2c')](_0x5a237b);};}exports[_0x6faa('0x2d')]=function(_0x3feceb,_0x3f1e65){var _0x4a8edb={},_0x458fbd={},_0x120425={'count':0x0,'rows':[]};var _0x3f50c5=_[_0x6faa('0x2e')](db['SquareDetailsReport']['rawAttributes'],function(_0x534a8b){return{'name':_0x534a8b[_0x6faa('0x2f')],'type':_0x534a8b[_0x6faa('0x30')][_0x6faa('0x31')]};});_0x458fbd[_0x6faa('0x32')]=_[_0x6faa('0x2e')](_0x3f50c5,'name');_0x458fbd[_0x6faa('0x33')]=_[_0x6faa('0x34')](_0x3feceb[_0x6faa('0x33')]);_0x458fbd[_0x6faa('0x35')]=_['intersection'](_0x458fbd[_0x6faa('0x32')],_0x458fbd['query']);_0x4a8edb['attributes']=_['intersection'](_0x458fbd[_0x6faa('0x32')],qs['fields'](_0x3feceb[_0x6faa('0x33')][_0x6faa('0x36')]));_0x4a8edb[_0x6faa('0x37')]=_0x4a8edb[_0x6faa('0x37')][_0x6faa('0x38')]?_0x4a8edb[_0x6faa('0x37')]:_0x458fbd['model'];if(!_0x3feceb['query']['hasOwnProperty'](_0x6faa('0x39'))){_0x4a8edb['limit']=qs['limit'](_0x3feceb[_0x6faa('0x33')]['limit']);_0x4a8edb[_0x6faa('0x1e')]=qs['offset'](_0x3feceb[_0x6faa('0x33')]['offset']);}_0x4a8edb['order']=qs[_0x6faa('0x3a')](_0x3feceb[_0x6faa('0x33')][_0x6faa('0x3a')]);_0x4a8edb[_0x6faa('0x3b')]=qs[_0x6faa('0x35')](_[_0x6faa('0x3c')](_0x3feceb['query'],_0x458fbd[_0x6faa('0x35')]),_0x3f50c5);if(_0x3feceb[_0x6faa('0x33')][_0x6faa('0x3d')]){_0x4a8edb[_0x6faa('0x3b')]=_[_0x6faa('0x3e')](_0x4a8edb[_0x6faa('0x3b')],{'$or':_['map'](_0x3f50c5,function(_0x428952){if(_0x428952['type']!==_0x6faa('0x3f')){var _0xd64bfd={};_0xd64bfd[_0x428952[_0x6faa('0x2b')]]={'$like':'%'+_0x3feceb[_0x6faa('0x33')][_0x6faa('0x3d')]+'%'};return _0xd64bfd;}})});}_0x4a8edb=_[_0x6faa('0x3e')]({},_0x4a8edb,_0x3feceb['options']);var _0x5b005e={'where':_0x4a8edb[_0x6faa('0x3b')]};return db['SquareDetailsReport']['count'](_0x5b005e)[_0x6faa('0x28')](function(_0x38dd10){_0x120425[_0x6faa('0x21')]=_0x38dd10;if(_0x3feceb[_0x6faa('0x33')][_0x6faa('0x40')]){_0x4a8edb['include']=[{'all':!![]}];}return db[_0x6faa('0x41')]['findAll'](_0x4a8edb);})[_0x6faa('0x28')](function(_0x8c9676){_0x120425['rows']=_0x8c9676;return _0x120425;})[_0x6faa('0x28')](respondWithFilteredResult(_0x3f1e65,_0x4a8edb))['catch'](handleError(_0x3f1e65,null));};exports['show']=function(_0x15c464,_0x3753c2){var _0x314f5c={'raw':!![],'where':{'id':_0x15c464['params']['id']}},_0x3b8f5a={};_0x3b8f5a[_0x6faa('0x32')]=_[_0x6faa('0x34')](db[_0x6faa('0x41')][_0x6faa('0x42')]);_0x3b8f5a[_0x6faa('0x33')]=_[_0x6faa('0x34')](_0x15c464[_0x6faa('0x33')]);_0x3b8f5a[_0x6faa('0x35')]=_[_0x6faa('0x43')](_0x3b8f5a[_0x6faa('0x32')],_0x3b8f5a[_0x6faa('0x33')]);_0x314f5c[_0x6faa('0x37')]=_[_0x6faa('0x43')](_0x3b8f5a[_0x6faa('0x32')],qs['fields'](_0x15c464[_0x6faa('0x33')][_0x6faa('0x36')]));_0x314f5c[_0x6faa('0x37')]=_0x314f5c[_0x6faa('0x37')][_0x6faa('0x38')]?_0x314f5c[_0x6faa('0x37')]:_0x3b8f5a['model'];if(_0x15c464['query']['includeAll']){_0x314f5c[_0x6faa('0x44')]=[{'all':!![]}];}_0x314f5c=_['merge']({},_0x314f5c,_0x15c464[_0x6faa('0x45')]);return db[_0x6faa('0x41')][_0x6faa('0x46')](_0x314f5c)[_0x6faa('0x28')](handleEntityNotFound(_0x3753c2,null))[_0x6faa('0x28')](respondWithResult(_0x3753c2,null))[_0x6faa('0x47')](handleError(_0x3753c2,null));};exports[_0x6faa('0x48')]=function(_0x224c2d,_0x1faef9){return db[_0x6faa('0x41')][_0x6faa('0x48')](_0x224c2d['body'],{})[_0x6faa('0x28')](respondWithResult(_0x1faef9,0xc9))[_0x6faa('0x47')](handleError(_0x1faef9,null));};exports[_0x6faa('0x27')]=function(_0xfbe21f,_0x48fd9a){if(_0xfbe21f[_0x6faa('0x49')]['id']){delete _0xfbe21f[_0x6faa('0x49')]['id'];}return db[_0x6faa('0x41')][_0x6faa('0x46')]({'where':{'id':_0xfbe21f[_0x6faa('0x4a')]['id']}})[_0x6faa('0x28')](handleEntityNotFound(_0x48fd9a,null))['then'](saveUpdates(_0xfbe21f['body'],null))['then'](respondWithResult(_0x48fd9a,null))[_0x6faa('0x47')](handleError(_0x48fd9a,null));};exports[_0x6faa('0x29')]=function(_0x5852cc,_0x22efb3){return db['SquareDetailsReport'][_0x6faa('0x46')]({'where':{'id':_0x5852cc[_0x6faa('0x4a')]['id']}})[_0x6faa('0x28')](handleEntityNotFound(_0x22efb3,null))[_0x6faa('0x28')](removeEntity(_0x22efb3,null))[_0x6faa('0x47')](handleError(_0x22efb3,null));};exports['describe']=function(_0x401403,_0x37d329){return db['SquareDetailsReport'][_0x6faa('0x4b')]()['then'](respondWithResult(_0x37d329,null))[_0x6faa('0x47')](handleError(_0x37d329,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 5d526f1..65f11b5 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 _0xfd25=['bluebird','request-promise','rimraf','./squareReportDetail.attributes','exports','report_square_details','lodash','../../config/logger','api','moment'];(function(_0x1f20c1,_0x350567){var _0x548c58=function(_0x54b7c5){while(--_0x54b7c5){_0x1f20c1['push'](_0x1f20c1['shift']());}};_0x548c58(++_0x350567);}(_0xfd25,0xce));var _0x5fd2=function(_0xa3d2fb,_0x4714fe){_0xa3d2fb=_0xa3d2fb-0x0;var _0x217eb7=_0xfd25[_0xa3d2fb];return _0x217eb7;};'use strict';var _=require(_0x5fd2('0x0'));var util=require('util');var logger=require(_0x5fd2('0x1'))(_0x5fd2('0x2'));var moment=require(_0x5fd2('0x3'));var BPromise=require(_0x5fd2('0x4'));var rp=require(_0x5fd2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5fd2('0x6'));var config=require('../../config/environment');var attributes=require(_0x5fd2('0x7'));module[_0x5fd2('0x8')]=function(_0x56fdb5,_0x55cfa2){return _0x56fdb5['define']('SquareDetailsReport',attributes,{'tableName':_0x5fd2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc98e=['rimraf','./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','lodash','util','api','bluebird','path'];(function(_0x5df033,_0x29458b){var _0x445829=function(_0x2c795b){while(--_0x2c795b){_0x5df033['push'](_0x5df033['shift']());}};_0x445829(++_0x29458b);}(_0xc98e,0x11d));var _0xec98=function(_0x57732a,_0x7c12b6){_0x57732a=_0x57732a-0x0;var _0x32d6d5=_0xc98e[_0x57732a];return _0x32d6d5;};'use strict';var _=require(_0xec98('0x0'));var util=require(_0xec98('0x1'));var logger=require('../../config/logger')(_0xec98('0x2'));var moment=require('moment');var BPromise=require(_0xec98('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec98('0x4'));var rimraf=require(_0xec98('0x5'));var config=require('../../config/environment');var attributes=require(_0xec98('0x6'));module['exports']=function(_0x4fd721,_0x4d27c0){return _0x4fd721[_0xec98('0x7')](_0xec98('0x8'),attributes,{'tableName':_0xec98('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index fb5c11b..cfb3cba 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 _0x51c5=['options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','debug','request\x20sent','stringify','error','code','message','SquareDetailsReport,\x20%s,\x20%s','info','catch','CreateSquareDetailsReport','create'];(function(_0x36c87d,_0x2ab247){var _0x54dc55=function(_0x2b4112){while(--_0x2b4112){_0x36c87d['push'](_0x36c87d['shift']());}};_0x54dc55(++_0x2ab247);}(_0x51c5,0x8f));var _0x551c=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x51c5[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0x551c('0x0'));var util=require(_0x551c('0x1'));var moment=require(_0x551c('0x2'));var BPromise=require(_0x551c('0x3'));var rs=require(_0x551c('0x4'));var fs=require('fs');var Redis=require(_0x551c('0x5'));var db=require(_0x551c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x551c('0x7'))(_0x551c('0x8'));var config=require(_0x551c('0x9'));var jayson=require(_0x551c('0xa'));var client=jayson[_0x551c('0xb')][_0x551c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21dfa1,_0x196955,_0x4f3a0a){return new BPromise(function(_0x414edb,_0x15f4f8){return client[_0x551c('0xd')](_0x21dfa1,_0x4f3a0a)['then'](function(_0x17683c){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x196955,'request\x20sent');logger[_0x551c('0xe')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x196955,_0x551c('0xf'),JSON[_0x551c('0x10')](_0x17683c));if(_0x17683c[_0x551c('0x11')]){if(_0x17683c[_0x551c('0x11')][_0x551c('0x12')]===0x1f4){logger[_0x551c('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x196955,_0x17683c[_0x551c('0x11')][_0x551c('0x13')]);return _0x15f4f8(_0x17683c[_0x551c('0x11')]['message']);}logger[_0x551c('0x11')](_0x551c('0x14'),_0x196955,_0x17683c['error'][_0x551c('0x13')]);return _0x414edb(_0x17683c['error'][_0x551c('0x13')]);}else{logger[_0x551c('0x15')](_0x551c('0x14'),_0x196955,_0x551c('0xf'));_0x414edb(_0x17683c['result']['message']);}})[_0x551c('0x16')](function(_0xcdf011){logger['error'](_0x551c('0x14'),_0x196955,_0xcdf011);_0x15f4f8(_0xcdf011);});});}exports[_0x551c('0x17')]=function(_0x274432){var _0x2a0b55=this;return new Promise(function(_0x4c8dba,_0x4fcaf3){return db['SquareDetailsReport'][_0x551c('0x18')](_0x274432['body'],{'raw':_0x274432['options']?_0x274432[_0x551c('0x19')][_0x551c('0x1a')]===undefined?!![]:![]:!![]})[_0x551c('0x1b')](function(_0x1927e7){logger[_0x551c('0x15')](_0x551c('0x17'),_0x274432);logger['debug']('CreateSquareDetailsReport',_0x274432,JSON[_0x551c('0x10')](_0x1927e7));_0x4c8dba(_0x1927e7);})['catch'](function(_0x330160){logger[_0x551c('0x11')](_0x551c('0x17'),_0x330160[_0x551c('0x13')],_0x274432);_0x4fcaf3(_0x2a0b55[_0x551c('0x11')](0x1f4,_0x330160['message']));});});}; \ No newline at end of file +var _0x9d5b=['code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3d7c58,_0x5113cb){var _0x330b65=function(_0x3bdff9){while(--_0x3bdff9){_0x3d7c58['push'](_0x3d7c58['shift']());}};_0x330b65(++_0x5113cb);}(_0x9d5b,0x14d));var _0xb9d5=function(_0x2eb38a,_0x59bee3){_0x2eb38a=_0x2eb38a-0x0;var _0x120ac5=_0x9d5b[_0x2eb38a];return _0x120ac5;};'use strict';var _=require('lodash');var util=require(_0xb9d5('0x0'));var moment=require(_0xb9d5('0x1'));var BPromise=require(_0xb9d5('0x2'));var rs=require(_0xb9d5('0x3'));var fs=require('fs');var Redis=require(_0xb9d5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9d5('0x5'));var logger=require('../../config/logger')(_0xb9d5('0x6'));var config=require(_0xb9d5('0x7'));var jayson=require(_0xb9d5('0x8'));var client=jayson[_0xb9d5('0x9')][_0xb9d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5144c7,_0x1ddb78,_0x35cf2){return new BPromise(function(_0x4dc4be,_0x2d3f66){return client[_0xb9d5('0xb')](_0x5144c7,_0x35cf2)[_0xb9d5('0xc')](function(_0x94e766){logger['info'](_0xb9d5('0xd'),_0x1ddb78,_0xb9d5('0xe'));logger['debug'](_0xb9d5('0xf'),_0x1ddb78,_0xb9d5('0xe'),JSON[_0xb9d5('0x10')](_0x94e766));if(_0x94e766[_0xb9d5('0x11')]){if(_0x94e766[_0xb9d5('0x11')][_0xb9d5('0x12')]===0x1f4){logger[_0xb9d5('0x11')](_0xb9d5('0xd'),_0x1ddb78,_0x94e766[_0xb9d5('0x11')][_0xb9d5('0x13')]);return _0x2d3f66(_0x94e766[_0xb9d5('0x11')]['message']);}logger[_0xb9d5('0x11')](_0xb9d5('0xd'),_0x1ddb78,_0x94e766['error'][_0xb9d5('0x13')]);return _0x4dc4be(_0x94e766[_0xb9d5('0x11')][_0xb9d5('0x13')]);}else{logger['info'](_0xb9d5('0xd'),_0x1ddb78,_0xb9d5('0xe'));_0x4dc4be(_0x94e766[_0xb9d5('0x14')][_0xb9d5('0x13')]);}})[_0xb9d5('0x15')](function(_0x321a77){logger[_0xb9d5('0x11')](_0xb9d5('0xd'),_0x1ddb78,_0x321a77);_0x2d3f66(_0x321a77);});});}exports[_0xb9d5('0x16')]=function(_0x436002){var _0x248cb3=this;return new Promise(function(_0xf2c261,_0x2f8df6){return db[_0xb9d5('0x17')]['create'](_0x436002[_0xb9d5('0x18')],{'raw':_0x436002[_0xb9d5('0x19')]?_0x436002[_0xb9d5('0x19')][_0xb9d5('0x1a')]===undefined?!![]:![]:!![]})[_0xb9d5('0xc')](function(_0x457d69){logger['info'](_0xb9d5('0x16'),_0x436002);logger['debug'](_0xb9d5('0x16'),_0x436002,JSON[_0xb9d5('0x10')](_0x457d69));_0xf2c261(_0x457d69);})[_0xb9d5('0x15')](function(_0x13fc35){logger[_0xb9d5('0x11')](_0xb9d5('0x16'),_0x13fc35[_0xb9d5('0x13')],_0x436002);_0x2f8df6(_0x248cb3[_0xb9d5('0x11')](0x1f4,_0x13fc35['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index d5bc0a9..3d10bed 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 _0x0538=['isAuthenticated','get','/process/:pid/kill','killProcess','exports','express','../../components/auth/service','./system.controller'];(function(_0x2d4a0d,_0x404753){var _0x11c1b7=function(_0x8c9ed){while(--_0x8c9ed){_0x2d4a0d['push'](_0x2d4a0d['shift']());}};_0x11c1b7(++_0x404753);}(_0x0538,0xcd));var _0x8053=function(_0x297eea,_0x5060be){_0x297eea=_0x297eea-0x0;var _0x1c42d2=_0x0538[_0x297eea];return _0x1c42d2;};'use strict';var express=require(_0x8053('0x0'));var router=express['Router']();var auth=require(_0x8053('0x1'));var controller=require(_0x8053('0x2'));router['get']('/',auth[_0x8053('0x3')](),controller['index']);router[_0x8053('0x4')](_0x8053('0x5'),auth[_0x8053('0x3')](),controller[_0x8053('0x6')]);module[_0x8053('0x7')]=router; \ No newline at end of file +var _0x7b13=['express','../../components/auth/service','get','/process/:pid/kill','isAuthenticated','exports'];(function(_0x379040,_0x550567){var _0x27e6e3=function(_0x21139c){while(--_0x21139c){_0x379040['push'](_0x379040['shift']());}};_0x27e6e3(++_0x550567);}(_0x7b13,0x11a));var _0x37b1=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x7b13[_0x3b380d];return _0x54502b;};'use strict';var express=require(_0x37b1('0x0'));var router=express['Router']();var auth=require(_0x37b1('0x1'));var controller=require('./system.controller');router[_0x37b1('0x2')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x37b1('0x3'),auth[_0x37b1('0x4')](),controller['killProcess']);module[_0x37b1('0x5')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 1bbe65a..69887da 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 _0x3850=['params','then','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','bluebird','lodash','error','inspect','name','send','getAllData','status','catch','json','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args'];(function(_0x3c5b01,_0x4399eb){var _0x2cf739=function(_0x299498){while(--_0x299498){_0x3c5b01['push'](_0x3c5b01['shift']());}};_0x2cf739(++_0x4399eb);}(_0x3850,0x91));var _0x0385=function(_0x36e506,_0x444776){_0x36e506=_0x36e506-0x0;var _0x50c90b=_0x3850[_0x36e506];return _0x50c90b;};'use strict';var info=require(_0x0385('0x0'));var exec=require(_0x0385('0x1'))[_0x0385('0x2')];var logger=require(_0x0385('0x3'))('api');var util=require('util');var BPromise=require(_0x0385('0x4'));var _=require(_0x0385('0x5'));function handleError(_0x43aafb,_0x207299,_0x2a36c0){_0x207299=_0x207299||0x1f4;return function(_0x2079e1){logger[_0x0385('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x2a36c0,_0x207299,util[_0x0385('0x7')](_0x2079e1,{'showHidden':![],'depth':null}));delete _0x2079e1[_0x0385('0x8')];_0x43aafb['status'](_0x207299)[_0x0385('0x9')](_0x2079e1);};}exports['index']=function(_0x206e3f,_0x73a062){return info[_0x0385('0xa')]()['then'](function(_0x3a3185){return _0x73a062[_0x0385('0xb')](0xc8)['json'](_0x3a3185);})[_0x0385('0xc')](function(_0xbafdea){return _0x73a062[_0x0385('0xb')](0x1f4)[_0x0385('0xd')](_0xbafdea);});};exports[_0x0385('0xe')]=function(_0x1acb3b,_0x523f84){var _0x59a519=[_0x0385('0xf')];return new BPromise(function(_0x2ec3a8,_0x1b61e2){return exec(util['format'](_0x0385('0x10'),_0x1acb3b[_0x0385('0x11')]['pid']),function(_0x44a7f8,_0x26e4e7,_0x323908){if(_0x44a7f8){return _0x1b61e2(_0x44a7f8);}return _0x2ec3a8(_0x26e4e7);});})[_0x0385('0x12')](function(_0x5e6b5b){var _0x566def=![];var _0x131d92=_0x5e6b5b['split'](/\n/);for(var _0x207a8c=0x0,_0x58fc59=_0x59a519[_0x0385('0x13')];_0x207a8c<_0x58fc59,_0x566def===![];_0x207a8c+=0x1){if(_0x5e6b5b[_0x0385('0x14')](_0x59a519[_0x207a8c])>=0x0){_0x566def=!![];}}if(!_0x566def){throw new Error(util[_0x0385('0x15')](_0x0385('0x16'),_0x1acb3b['params'][_0x0385('0x17')]));}process[_0x0385('0x18')](_0x1acb3b[_0x0385('0x11')]['pid'],_0x0385('0x19'));return _0x523f84[_0x0385('0xb')](0xc8)[_0x0385('0xd')]({'message':util[_0x0385('0x15')](_0x0385('0x1a'),_0x1acb3b['params']['pid'])});})[_0x0385('0xc')](handleError(_0x523f84,null,_0x0385('0xe')));}; \ No newline at end of file +var _0xd370=['../../config/logger','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec'];(function(_0x5af451,_0x1f75d8){var _0x21e3f2=function(_0x536c3c){while(--_0x536c3c){_0x5af451['push'](_0x5af451['shift']());}};_0x21e3f2(++_0x1f75d8);}(_0xd370,0xd5));var _0x0d37=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0xd370[_0xf79bae];return _0x5d2cb7;};'use strict';var info=require(_0x0d37('0x0'));var exec=require(_0x0d37('0x1'))[_0x0d37('0x2')];var logger=require(_0x0d37('0x3'))('api');var util=require(_0x0d37('0x4'));var BPromise=require(_0x0d37('0x5'));var _=require(_0x0d37('0x6'));function handleError(_0x14aab4,_0x58a299,_0x1e98e3){_0x58a299=_0x58a299||0x1f4;return function(_0x18f043){logger['error'](_0x0d37('0x7'),_0x1e98e3,_0x58a299,util['inspect'](_0x18f043,{'showHidden':![],'depth':null}));delete _0x18f043[_0x0d37('0x8')];_0x14aab4[_0x0d37('0x9')](_0x58a299)['send'](_0x18f043);};}exports[_0x0d37('0xa')]=function(_0x2f5871,_0x3567a5){return info[_0x0d37('0xb')]()[_0x0d37('0xc')](function(_0x4319ad){return _0x3567a5[_0x0d37('0x9')](0xc8)[_0x0d37('0xd')](_0x4319ad);})[_0x0d37('0xe')](function(_0x23eba0){return _0x3567a5['status'](0x1f4)[_0x0d37('0xd')](_0x23eba0);});};exports[_0x0d37('0xf')]=function(_0x58ee9d,_0x513d69){var _0x2155a4=[_0x0d37('0x10')];return new BPromise(function(_0x1c1b86,_0x29ffc8){return exec(util[_0x0d37('0x11')](_0x0d37('0x12'),_0x58ee9d[_0x0d37('0x13')][_0x0d37('0x14')]),function(_0x386f1b,_0xc43d77,_0x19db01){if(_0x386f1b){return _0x29ffc8(_0x386f1b);}return _0x1c1b86(_0xc43d77);});})['then'](function(_0x193755){var _0x302637=![];var _0x4720e1=_0x193755[_0x0d37('0x15')](/\n/);for(var _0x4fc15b=0x0,_0x30a3ac=_0x2155a4[_0x0d37('0x16')];_0x4fc15b<_0x30a3ac,_0x302637===![];_0x4fc15b+=0x1){if(_0x193755[_0x0d37('0x17')](_0x2155a4[_0x4fc15b])>=0x0){_0x302637=!![];}}if(!_0x302637){throw new Error(util[_0x0d37('0x11')](_0x0d37('0x18'),_0x58ee9d[_0x0d37('0x13')][_0x0d37('0x14')]));}process[_0x0d37('0x19')](_0x58ee9d[_0x0d37('0x13')][_0x0d37('0x14')],'SIGINT');return _0x513d69[_0x0d37('0x9')](0xc8)[_0x0d37('0xd')]({'message':util[_0x0d37('0x11')](_0x0d37('0x1a'),_0x58ee9d[_0x0d37('0x13')][_0x0d37('0x14')])});})[_0x0d37('0xe')](handleError(_0x513d69,null,_0x0d37('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index ce31071..8219c21 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 _0x983f=['/:id','isAuthenticated','create','put','update','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','index'];(function(_0x4794e6,_0x544fa1){var _0x2b07d8=function(_0x1c5ec9){while(--_0x1c5ec9){_0x4794e6['push'](_0x4794e6['shift']());}};_0x2b07d8(++_0x544fa1);}(_0x983f,0xd3));var _0xf983=function(_0x2d5bf7,_0xb6985c){_0x2d5bf7=_0x2d5bf7-0x0;var _0xb86a87=_0x983f[_0x2d5bf7];return _0xb86a87;};'use strict';var multer=require('multer');var util=require(_0xf983('0x0'));var path=require(_0xf983('0x1'));var timeout=require('connect-timeout');var express=require(_0xf983('0x2'));var router=express['Router']();var fs_extra=require(_0xf983('0x3'));var auth=require(_0xf983('0x4'));var interaction=require(_0xf983('0x5'));var config=require(_0xf983('0x6'));var controller=require(_0xf983('0x7'));router[_0xf983('0x8')]('/',auth['isAuthenticated'](),controller[_0xf983('0x9')]);router[_0xf983('0x8')](_0xf983('0xa'),auth[_0xf983('0xb')](),controller['show']);router['post']('/',auth[_0xf983('0xb')](),controller[_0xf983('0xc')]);router[_0xf983('0xd')](_0xf983('0xa'),auth[_0xf983('0xb')](),controller[_0xf983('0xe')]);router['delete'](_0xf983('0xa'),auth['isAuthenticated'](),controller[_0xf983('0xf')]);module[_0xf983('0x10')]=router; \ No newline at end of file +var _0x3c66=['../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','post','put','/:id','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x136152,_0x2bf01){var _0x57a6ed=function(_0x1b1a6c){while(--_0x1b1a6c){_0x136152['push'](_0x136152['shift']());}};_0x57a6ed(++_0x2bf01);}(_0x3c66,0x8b));var _0x63c6=function(_0x577110,_0x31171d){_0x577110=_0x577110-0x0;var _0x1354bc=_0x3c66[_0x577110];return _0x1354bc;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x63c6('0x0'));var express=require(_0x63c6('0x1'));var router=express[_0x63c6('0x2')]();var fs_extra=require(_0x63c6('0x3'));var auth=require(_0x63c6('0x4'));var interaction=require(_0x63c6('0x5'));var config=require(_0x63c6('0x6'));var controller=require(_0x63c6('0x7'));router[_0x63c6('0x8')]('/',auth[_0x63c6('0x9')](),controller[_0x63c6('0xa')]);router[_0x63c6('0x8')]('/:id',auth[_0x63c6('0x9')](),controller['show']);router[_0x63c6('0xb')]('/',auth[_0x63c6('0x9')](),controller['create']);router[_0x63c6('0xc')](_0x63c6('0xd'),auth[_0x63c6('0x9')](),controller[_0x63c6('0xe')]);router[_0x63c6('0xf')](_0x63c6('0xd'),auth['isAuthenticated'](),controller[_0x63c6('0x10')]);module[_0x63c6('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index dae3583..e98de2c 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 _0x9e6b=['sequelize','exports','name','STRING'];(function(_0x4a58de,_0x751480){var _0x22b8ec=function(_0x3c6027){while(--_0x3c6027){_0x4a58de['push'](_0x4a58de['shift']());}};_0x22b8ec(++_0x751480);}(_0x9e6b,0x11c));var _0xb9e6=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9e6b[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0xb9e6('0x0'));module[_0xb9e6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb9e6('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xb9e6('0x3')]}}; \ No newline at end of file +var _0xc224=['exports','STRING','#0091EA','sequelize'];(function(_0x17bb3d,_0x9d5bdf){var _0x27fdd0=function(_0xf418c5){while(--_0xf418c5){_0x17bb3d['push'](_0x17bb3d['shift']());}};_0x27fdd0(++_0x9d5bdf);}(_0xc224,0x1af));var _0x4c22=function(_0x4d57c4,_0x4df912){_0x4d57c4=_0x4d57c4-0x0;var _0x5eddf9=_0xc224[_0x4d57c4];return _0x5eddf9;};'use strict';var Sequelize=require(_0x4c22('0x0'));module[_0x4c22('0x1')]={'name':{'type':Sequelize[_0x4c22('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x4c22('0x2')],'defaultValue':_0x4c22('0x3')},'description':{'type':Sequelize[_0x4c22('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index a1af980..39b28c2 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 _0xf021=['autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','limit','reject','save','update','then','Tags','end','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','merge','filter','options','Tag','count','includeAll','include','rows','catch','show','intersection','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xf021,0x18f));var _0x1f02=function(_0x1046ba,_0x17699d){_0x1046ba=_0x1046ba-0x0;var _0x31ae08=_0xf021[_0x1046ba];return _0x31ae08;};'use strict';var emlformat=require(_0x1f02('0x0'));var rimraf=require(_0x1f02('0x1'));var zipdir=require(_0x1f02('0x2'));var jsonpatch=require(_0x1f02('0x3'));var rp=require(_0x1f02('0x4'));var moment=require('moment');var BPromise=require(_0x1f02('0x5'));var Mustache=require('mustache');var util=require(_0x1f02('0x6'));var path=require(_0x1f02('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1f02('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f02('0x9'));var squel=require(_0x1f02('0xa'));var crypto=require(_0x1f02('0xb'));var jsforce=require(_0x1f02('0xc'));var deskjs=require(_0x1f02('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1f02('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1f02('0xf'));var as=require(_0x1f02('0x10'));var hardwareService=require(_0x1f02('0x11'));var logger=require(_0x1f02('0x12'))(_0x1f02('0x13'));var utils=require('../../config/utils');var config=require(_0x1f02('0x14'));var licenseUtil=require(_0x1f02('0x15'));var db=require(_0x1f02('0x16'))['db'];function respondWithStatusCode(_0x56a2c2,_0x24e9b8){_0x24e9b8=_0x24e9b8||0xcc;return function(_0x1ac6eb){if(_0x1ac6eb){return _0x56a2c2[_0x1f02('0x17')](_0x24e9b8);}return _0x56a2c2['status'](_0x24e9b8)['end']();};}function respondWithResult(_0x4974bd,_0x11ba7e){_0x11ba7e=_0x11ba7e||0xc8;return function(_0x2c08ad){if(_0x2c08ad){return _0x4974bd[_0x1f02('0x18')](_0x11ba7e)[_0x1f02('0x19')](_0x2c08ad);}};}function respondWithFilteredResult(_0x1c16ce,_0x45bae1){return function(_0x440328){if(_0x440328){var _0x3b0a3d=typeof _0x45bae1['offset']===_0x1f02('0x1a')&&typeof _0x45bae1['limit']==='undefined';var _0x4a66a5=_0x440328['count'];var _0x4d1e4f=_0x3b0a3d?0x0:_0x45bae1[_0x1f02('0x1b')];var _0x3033a2=_0x3b0a3d?_0x440328['count']:_0x45bae1[_0x1f02('0x1b')]+_0x45bae1[_0x1f02('0x1c')];var _0x356444;if(_0x3033a2>=_0x4a66a5){_0x3033a2=_0x4a66a5;_0x356444=0xc8;}else{_0x356444=0xce;}_0x1c16ce[_0x1f02('0x18')](_0x356444);return _0x1c16ce['set']('Content-Range',_0x4d1e4f+'-'+_0x3033a2+'/'+_0x4a66a5)[_0x1f02('0x19')](_0x440328);}return null;};}function patchUpdates(_0x37393a){return function(_0x5e78c2){try{jsonpatch['apply'](_0x5e78c2,_0x37393a,!![]);}catch(_0x339c29){return BPromise[_0x1f02('0x1d')](_0x339c29);}return _0x5e78c2[_0x1f02('0x1e')]();};}function saveUpdates(_0xbabbd7,_0x480297){return function(_0x12c4af){if(_0x12c4af){return _0x12c4af[_0x1f02('0x1f')](_0xbabbd7)[_0x1f02('0x20')](function(_0x2f422c){return _0x2f422c;});}return null;};}function removeEntity(_0x43b3e7,_0x134398){return function(_0x1328ea){if(_0x1328ea){return _0x1328ea['destroy']()[_0x1f02('0x20')](function(){var _0x3a8c57=_0x1328ea['get']({'plain':!![]});var _0x25a8d1=_0x1f02('0x21');return db['UserProfileResource']['destroy']({'where':{'type':_0x25a8d1,'resourceId':_0x3a8c57['id']}})[_0x1f02('0x20')](function(){return _0x1328ea;});})[_0x1f02('0x20')](function(){_0x43b3e7[_0x1f02('0x18')](0xcc)[_0x1f02('0x22')]();});}};}function handleEntityNotFound(_0x3f5c5e,_0x3f5577){return function(_0x297cf4){if(!_0x297cf4){_0x3f5c5e['sendStatus'](0x194);}return _0x297cf4;};}function handleError(_0x4d5f7e,_0x4e04f2){_0x4e04f2=_0x4e04f2||0x1f4;return function(_0x3ef4bf){logger[_0x1f02('0x23')](_0x3ef4bf[_0x1f02('0x24')]);if(_0x3ef4bf['name']){delete _0x3ef4bf['name'];}_0x4d5f7e[_0x1f02('0x18')](_0x4e04f2)[_0x1f02('0x25')](_0x3ef4bf);};}exports[_0x1f02('0x26')]=function(_0x433a1e,_0x220345){var _0x3080a6={},_0x442333={},_0x23fa22={'count':0x0,'rows':[]};var _0x1c2a0d=_[_0x1f02('0x27')](db['Tag'][_0x1f02('0x28')],function(_0x5ab7a2){return{'name':_0x5ab7a2[_0x1f02('0x29')],'type':_0x5ab7a2[_0x1f02('0x2a')][_0x1f02('0x2b')]};});_0x442333[_0x1f02('0x2c')]=_[_0x1f02('0x27')](_0x1c2a0d,_0x1f02('0x2d'));_0x442333['query']=_['keys'](_0x433a1e[_0x1f02('0x2e')]);_0x442333[_0x1f02('0x2f')]=_['intersection'](_0x442333[_0x1f02('0x2c')],_0x442333['query']);_0x3080a6[_0x1f02('0x30')]=_['intersection'](_0x442333[_0x1f02('0x2c')],qs['fields'](_0x433a1e['query'][_0x1f02('0x31')]));_0x3080a6[_0x1f02('0x30')]=_0x3080a6[_0x1f02('0x30')][_0x1f02('0x32')]?_0x3080a6['attributes']:_0x442333[_0x1f02('0x2c')];if(!_0x433a1e[_0x1f02('0x2e')][_0x1f02('0x33')]('nolimit')){_0x3080a6[_0x1f02('0x1c')]=qs[_0x1f02('0x1c')](_0x433a1e[_0x1f02('0x2e')][_0x1f02('0x1c')]);_0x3080a6[_0x1f02('0x1b')]=qs[_0x1f02('0x1b')](_0x433a1e['query'][_0x1f02('0x1b')]);}_0x3080a6[_0x1f02('0x34')]=qs[_0x1f02('0x35')](_0x433a1e['query'][_0x1f02('0x35')]);_0x3080a6['where']=qs[_0x1f02('0x2f')](_['pick'](_0x433a1e['query'],_0x442333[_0x1f02('0x2f')]),_0x1c2a0d);if(_0x433a1e['query']['filter']){_0x3080a6[_0x1f02('0x36')]=_[_0x1f02('0x37')](_0x3080a6[_0x1f02('0x36')],{'$or':_[_0x1f02('0x27')](_0x1c2a0d,function(_0x47ee27){if(_0x47ee27[_0x1f02('0x2a')]!=='VIRTUAL'){var _0x2cd179={};_0x2cd179[_0x47ee27[_0x1f02('0x2d')]]={'$like':'%'+_0x433a1e[_0x1f02('0x2e')][_0x1f02('0x38')]+'%'};return _0x2cd179;}})});}_0x3080a6=_[_0x1f02('0x37')]({},_0x3080a6,_0x433a1e[_0x1f02('0x39')]);var _0xb4fac5={'where':_0x3080a6[_0x1f02('0x36')]};return db[_0x1f02('0x3a')]['count'](_0xb4fac5)[_0x1f02('0x20')](function(_0x5aab10){_0x23fa22[_0x1f02('0x3b')]=_0x5aab10;if(_0x433a1e['query'][_0x1f02('0x3c')]){_0x3080a6[_0x1f02('0x3d')]=[{'all':!![]}];}return db[_0x1f02('0x3a')]['findAll'](_0x3080a6);})['then'](function(_0x1c3f09){_0x23fa22[_0x1f02('0x3e')]=_0x1c3f09;return _0x23fa22;})[_0x1f02('0x20')](respondWithFilteredResult(_0x220345,_0x3080a6))[_0x1f02('0x3f')](handleError(_0x220345,null));};exports[_0x1f02('0x40')]=function(_0x15fb49,_0x23733c){var _0x11f31f={'raw':!![],'where':{'id':_0x15fb49['params']['id']}},_0x391b57={};_0x391b57[_0x1f02('0x2c')]=_['keys'](db['Tag'][_0x1f02('0x28')]);_0x391b57['query']=_['keys'](_0x15fb49[_0x1f02('0x2e')]);_0x391b57['filters']=_['intersection'](_0x391b57[_0x1f02('0x2c')],_0x391b57[_0x1f02('0x2e')]);_0x11f31f['attributes']=_[_0x1f02('0x41')](_0x391b57[_0x1f02('0x2c')],qs[_0x1f02('0x31')](_0x15fb49[_0x1f02('0x2e')]['fields']));_0x11f31f[_0x1f02('0x30')]=_0x11f31f[_0x1f02('0x30')][_0x1f02('0x32')]?_0x11f31f[_0x1f02('0x30')]:_0x391b57[_0x1f02('0x2c')];if(_0x15fb49[_0x1f02('0x2e')][_0x1f02('0x3c')]){_0x11f31f[_0x1f02('0x3d')]=[{'all':!![]}];}_0x11f31f=_[_0x1f02('0x37')]({},_0x11f31f,_0x15fb49[_0x1f02('0x39')]);return db[_0x1f02('0x3a')][_0x1f02('0x42')](_0x11f31f)[_0x1f02('0x20')](handleEntityNotFound(_0x23733c,null))[_0x1f02('0x20')](respondWithResult(_0x23733c,null))['catch'](handleError(_0x23733c,null));};exports[_0x1f02('0x43')]=function(_0x50d5ed,_0x37759d){return db['Tag'][_0x1f02('0x43')](_0x50d5ed[_0x1f02('0x44')],{})[_0x1f02('0x20')](function(_0x32dac3){var _0x40bf99=_0x50d5ed[_0x1f02('0x45')][_0x1f02('0x46')]({'plain':!![]});if(!_0x40bf99)throw new Error(_0x1f02('0x47'));if(_0x40bf99[_0x1f02('0x48')]===_0x1f02('0x45')){var _0x1241c5=_0x32dac3['get']({'plain':!![]});var _0x45e71d=_0x1f02('0x21');return db[_0x1f02('0x49')][_0x1f02('0x42')]({'where':{'name':_0x45e71d,'userProfileId':_0x40bf99[_0x1f02('0x4a')]},'raw':!![]})[_0x1f02('0x20')](function(_0x2201b4){if(_0x2201b4&&_0x2201b4[_0x1f02('0x4b')]===0x0){return db[_0x1f02('0x4c')]['create']({'name':_0x1241c5[_0x1f02('0x2d')],'resourceId':_0x1241c5['id'],'type':_0x2201b4[_0x1f02('0x2d')],'sectionId':_0x2201b4['id']},{})[_0x1f02('0x20')](function(){return _0x32dac3;});}else{return _0x32dac3;}})[_0x1f02('0x3f')](function(_0x3cdf8c){logger['error'](_0x1f02('0x4d'),_0x3cdf8c);throw _0x3cdf8c;});}return _0x32dac3;})['then'](respondWithResult(_0x37759d,0xc9))[_0x1f02('0x3f')](handleError(_0x37759d,null));};exports[_0x1f02('0x1f')]=function(_0x2240d1,_0x18d80d){if(_0x2240d1[_0x1f02('0x44')]['id']){delete _0x2240d1[_0x1f02('0x44')]['id'];}return db[_0x1f02('0x3a')][_0x1f02('0x42')]({'where':{'id':_0x2240d1[_0x1f02('0x4e')]['id']}})[_0x1f02('0x20')](handleEntityNotFound(_0x18d80d,null))['then'](saveUpdates(_0x2240d1['body'],null))['then'](respondWithResult(_0x18d80d,null))[_0x1f02('0x3f')](handleError(_0x18d80d,null));};exports['destroy']=function(_0x238911,_0x449d58){return db['Tag'][_0x1f02('0x42')]({'where':{'id':_0x238911['params']['id']}})['then'](handleEntityNotFound(_0x449d58,null))['then'](removeEntity(_0x449d58,null))[_0x1f02('0x3f')](handleError(_0x449d58,null));}; \ No newline at end of file +var _0x1b73=['map','Tag','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','get','UserProfileResource','error','stack','name','send','index'];(function(_0x2309b1,_0x37771d){var _0x44b992=function(_0x4ddcf6){while(--_0x4ddcf6){_0x2309b1['push'](_0x2309b1['shift']());}};_0x44b992(++_0x37771d);}(_0x1b73,0x1d5));var _0x31b7=function(_0x9fe044,_0x14a84b){_0x9fe044=_0x9fe044-0x0;var _0x151880=_0x1b73[_0x9fe044];return _0x151880;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x31b7('0x0'));var zipdir=require(_0x31b7('0x1'));var jsonpatch=require(_0x31b7('0x2'));var rp=require(_0x31b7('0x3'));var moment=require('moment');var BPromise=require(_0x31b7('0x4'));var Mustache=require('mustache');var util=require(_0x31b7('0x5'));var path=require(_0x31b7('0x6'));var sox=require('sox');var csv=require(_0x31b7('0x7'));var ejs=require(_0x31b7('0x8'));var fs=require('fs');var fs_extra=require(_0x31b7('0x9'));var _=require('lodash');var squel=require(_0x31b7('0xa'));var crypto=require(_0x31b7('0xb'));var jsforce=require(_0x31b7('0xc'));var deskjs=require(_0x31b7('0xd'));var toCsv=require(_0x31b7('0x7'));var querystring=require(_0x31b7('0xe'));var Papa=require(_0x31b7('0xf'));var Redis=require('ioredis');var authService=require(_0x31b7('0x10'));var qs=require(_0x31b7('0x11'));var as=require(_0x31b7('0x12'));var hardwareService=require(_0x31b7('0x13'));var logger=require(_0x31b7('0x14'))(_0x31b7('0x15'));var utils=require(_0x31b7('0x16'));var config=require(_0x31b7('0x17'));var licenseUtil=require(_0x31b7('0x18'));var db=require(_0x31b7('0x19'))['db'];function respondWithStatusCode(_0x492612,_0x32afeb){_0x32afeb=_0x32afeb||0xcc;return function(_0x55e1bb){if(_0x55e1bb){return _0x492612[_0x31b7('0x1a')](_0x32afeb);}return _0x492612[_0x31b7('0x1b')](_0x32afeb)[_0x31b7('0x1c')]();};}function respondWithResult(_0x1969d2,_0x7988e2){_0x7988e2=_0x7988e2||0xc8;return function(_0x34e917){if(_0x34e917){return _0x1969d2[_0x31b7('0x1b')](_0x7988e2)['json'](_0x34e917);}};}function respondWithFilteredResult(_0x1e93fb,_0x491c98){return function(_0x210f18){if(_0x210f18){var _0xf213c9=typeof _0x491c98['offset']===_0x31b7('0x1d')&&typeof _0x491c98[_0x31b7('0x1e')]===_0x31b7('0x1d');var _0x39eee9=_0x210f18[_0x31b7('0x1f')];var _0x5f3245=_0xf213c9?0x0:_0x491c98[_0x31b7('0x20')];var _0x437eba=_0xf213c9?_0x210f18[_0x31b7('0x1f')]:_0x491c98[_0x31b7('0x20')]+_0x491c98[_0x31b7('0x1e')];var _0x4b8ab1;if(_0x437eba>=_0x39eee9){_0x437eba=_0x39eee9;_0x4b8ab1=0xc8;}else{_0x4b8ab1=0xce;}_0x1e93fb[_0x31b7('0x1b')](_0x4b8ab1);return _0x1e93fb[_0x31b7('0x21')](_0x31b7('0x22'),_0x5f3245+'-'+_0x437eba+'/'+_0x39eee9)[_0x31b7('0x23')](_0x210f18);}return null;};}function patchUpdates(_0x5b56bc){return function(_0x892fe4){try{jsonpatch[_0x31b7('0x24')](_0x892fe4,_0x5b56bc,!![]);}catch(_0x424318){return BPromise[_0x31b7('0x25')](_0x424318);}return _0x892fe4['save']();};}function saveUpdates(_0x33dd04,_0x20cb03){return function(_0x250574){if(_0x250574){return _0x250574[_0x31b7('0x26')](_0x33dd04)[_0x31b7('0x27')](function(_0x2d24bf){return _0x2d24bf;});}return null;};}function removeEntity(_0x36492c,_0x20e5b0){return function(_0x3b0eff){if(_0x3b0eff){return _0x3b0eff['destroy']()[_0x31b7('0x27')](function(){var _0x35a51f=_0x3b0eff[_0x31b7('0x28')]({'plain':!![]});var _0x2c993b='Tags';return db[_0x31b7('0x29')]['destroy']({'where':{'type':_0x2c993b,'resourceId':_0x35a51f['id']}})[_0x31b7('0x27')](function(){return _0x3b0eff;});})[_0x31b7('0x27')](function(){_0x36492c[_0x31b7('0x1b')](0xcc)[_0x31b7('0x1c')]();});}};}function handleEntityNotFound(_0xffacb,_0x128865){return function(_0x21ab03){if(!_0x21ab03){_0xffacb[_0x31b7('0x1a')](0x194);}return _0x21ab03;};}function handleError(_0x4e58e5,_0x47ef33){_0x47ef33=_0x47ef33||0x1f4;return function(_0x503549){logger[_0x31b7('0x2a')](_0x503549[_0x31b7('0x2b')]);if(_0x503549[_0x31b7('0x2c')]){delete _0x503549['name'];}_0x4e58e5[_0x31b7('0x1b')](_0x47ef33)[_0x31b7('0x2d')](_0x503549);};}exports[_0x31b7('0x2e')]=function(_0x277273,_0x58a87e){var _0x5b0ed2={},_0x34c62a={},_0x4b5cf9={'count':0x0,'rows':[]};var _0x574dfe=_[_0x31b7('0x2f')](db[_0x31b7('0x30')][_0x31b7('0x31')],function(_0x35f83c){return{'name':_0x35f83c['fieldName'],'type':_0x35f83c['type'][_0x31b7('0x32')]};});_0x34c62a[_0x31b7('0x33')]=_[_0x31b7('0x2f')](_0x574dfe,_0x31b7('0x2c'));_0x34c62a[_0x31b7('0x34')]=_['keys'](_0x277273['query']);_0x34c62a[_0x31b7('0x35')]=_[_0x31b7('0x36')](_0x34c62a['model'],_0x34c62a[_0x31b7('0x34')]);_0x5b0ed2[_0x31b7('0x37')]=_['intersection'](_0x34c62a[_0x31b7('0x33')],qs[_0x31b7('0x38')](_0x277273[_0x31b7('0x34')][_0x31b7('0x38')]));_0x5b0ed2[_0x31b7('0x37')]=_0x5b0ed2[_0x31b7('0x37')][_0x31b7('0x39')]?_0x5b0ed2[_0x31b7('0x37')]:_0x34c62a[_0x31b7('0x33')];if(!_0x277273[_0x31b7('0x34')][_0x31b7('0x3a')](_0x31b7('0x3b'))){_0x5b0ed2[_0x31b7('0x1e')]=qs['limit'](_0x277273['query'][_0x31b7('0x1e')]);_0x5b0ed2[_0x31b7('0x20')]=qs[_0x31b7('0x20')](_0x277273[_0x31b7('0x34')][_0x31b7('0x20')]);}_0x5b0ed2[_0x31b7('0x3c')]=qs[_0x31b7('0x3d')](_0x277273[_0x31b7('0x34')][_0x31b7('0x3d')]);_0x5b0ed2[_0x31b7('0x3e')]=qs['filters'](_[_0x31b7('0x3f')](_0x277273[_0x31b7('0x34')],_0x34c62a[_0x31b7('0x35')]),_0x574dfe);if(_0x277273[_0x31b7('0x34')]['filter']){_0x5b0ed2[_0x31b7('0x3e')]=_[_0x31b7('0x40')](_0x5b0ed2['where'],{'$or':_[_0x31b7('0x2f')](_0x574dfe,function(_0x5724fa){if(_0x5724fa['type']!==_0x31b7('0x41')){var _0x10e82c={};_0x10e82c[_0x5724fa[_0x31b7('0x2c')]]={'$like':'%'+_0x277273[_0x31b7('0x34')][_0x31b7('0x42')]+'%'};return _0x10e82c;}})});}_0x5b0ed2=_['merge']({},_0x5b0ed2,_0x277273[_0x31b7('0x43')]);var _0x5d01ee={'where':_0x5b0ed2['where']};return db['Tag'][_0x31b7('0x1f')](_0x5d01ee)[_0x31b7('0x27')](function(_0x1527b3){_0x4b5cf9[_0x31b7('0x1f')]=_0x1527b3;if(_0x277273[_0x31b7('0x34')]['includeAll']){_0x5b0ed2[_0x31b7('0x44')]=[{'all':!![]}];}return db['Tag'][_0x31b7('0x45')](_0x5b0ed2);})[_0x31b7('0x27')](function(_0x41c92e){_0x4b5cf9[_0x31b7('0x46')]=_0x41c92e;return _0x4b5cf9;})['then'](respondWithFilteredResult(_0x58a87e,_0x5b0ed2))[_0x31b7('0x47')](handleError(_0x58a87e,null));};exports[_0x31b7('0x48')]=function(_0x1046fb,_0x4b3d24){var _0x31fd89={'raw':!![],'where':{'id':_0x1046fb[_0x31b7('0x49')]['id']}},_0x51918d={};_0x51918d[_0x31b7('0x33')]=_['keys'](db[_0x31b7('0x30')][_0x31b7('0x31')]);_0x51918d[_0x31b7('0x34')]=_[_0x31b7('0x4a')](_0x1046fb['query']);_0x51918d[_0x31b7('0x35')]=_['intersection'](_0x51918d['model'],_0x51918d[_0x31b7('0x34')]);_0x31fd89[_0x31b7('0x37')]=_[_0x31b7('0x36')](_0x51918d[_0x31b7('0x33')],qs['fields'](_0x1046fb[_0x31b7('0x34')][_0x31b7('0x38')]));_0x31fd89['attributes']=_0x31fd89[_0x31b7('0x37')][_0x31b7('0x39')]?_0x31fd89[_0x31b7('0x37')]:_0x51918d['model'];if(_0x1046fb[_0x31b7('0x34')][_0x31b7('0x4b')]){_0x31fd89[_0x31b7('0x44')]=[{'all':!![]}];}_0x31fd89=_[_0x31b7('0x40')]({},_0x31fd89,_0x1046fb[_0x31b7('0x43')]);return db[_0x31b7('0x30')][_0x31b7('0x4c')](_0x31fd89)[_0x31b7('0x27')](handleEntityNotFound(_0x4b3d24,null))['then'](respondWithResult(_0x4b3d24,null))[_0x31b7('0x47')](handleError(_0x4b3d24,null));};exports['create']=function(_0x5a72ee,_0x22cc77){return db[_0x31b7('0x30')][_0x31b7('0x4d')](_0x5a72ee[_0x31b7('0x4e')],{})['then'](function(_0x322798){var _0x18556b=_0x5a72ee[_0x31b7('0x4f')]['get']({'plain':!![]});if(!_0x18556b)throw new Error(_0x31b7('0x50'));if(_0x18556b[_0x31b7('0x51')]===_0x31b7('0x4f')){var _0x3b5868=_0x322798[_0x31b7('0x28')]({'plain':!![]});var _0x309077=_0x31b7('0x52');return db[_0x31b7('0x53')]['find']({'where':{'name':_0x309077,'userProfileId':_0x18556b['userProfileId']},'raw':!![]})[_0x31b7('0x27')](function(_0x1d55e6){if(_0x1d55e6&&_0x1d55e6[_0x31b7('0x54')]===0x0){return db[_0x31b7('0x29')]['create']({'name':_0x3b5868['name'],'resourceId':_0x3b5868['id'],'type':_0x1d55e6[_0x31b7('0x2c')],'sectionId':_0x1d55e6['id']},{})[_0x31b7('0x27')](function(){return _0x322798;});}else{return _0x322798;}})[_0x31b7('0x47')](function(_0x5ea605){logger[_0x31b7('0x2a')](_0x31b7('0x55'),_0x5ea605);throw _0x5ea605;});}return _0x322798;})[_0x31b7('0x27')](respondWithResult(_0x22cc77,0xc9))[_0x31b7('0x47')](handleError(_0x22cc77,null));};exports['update']=function(_0x535a3c,_0x43c1ee){if(_0x535a3c[_0x31b7('0x4e')]['id']){delete _0x535a3c[_0x31b7('0x4e')]['id'];}return db[_0x31b7('0x30')][_0x31b7('0x4c')]({'where':{'id':_0x535a3c[_0x31b7('0x49')]['id']}})[_0x31b7('0x27')](handleEntityNotFound(_0x43c1ee,null))[_0x31b7('0x27')](saveUpdates(_0x535a3c[_0x31b7('0x4e')],null))[_0x31b7('0x27')](respondWithResult(_0x43c1ee,null))['catch'](handleError(_0x43c1ee,null));};exports['destroy']=function(_0x4bd00d,_0x954c){return db[_0x31b7('0x30')][_0x31b7('0x4c')]({'where':{'id':_0x4bd00d['params']['id']}})[_0x31b7('0x27')](handleEntityNotFound(_0x954c,null))[_0x31b7('0x27')](removeEntity(_0x954c,null))[_0x31b7('0x47')](handleError(_0x954c,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index c651336..edee54a 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 _0x0fc8=['request-promise','../../config/environment','exports','define','Tag','lodash','util','bluebird'];(function(_0x2e4070,_0x2d9467){var _0x5e8378=function(_0xae4f4a){while(--_0xae4f4a){_0x2e4070['push'](_0x2e4070['shift']());}};_0x5e8378(++_0x2d9467);}(_0x0fc8,0x145));var _0x80fc=function(_0x815942,_0x417656){_0x815942=_0x815942-0x0;var _0x5f0782=_0x0fc8[_0x815942];return _0x5f0782;};'use strict';var _=require(_0x80fc('0x0'));var util=require(_0x80fc('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x80fc('0x2'));var rp=require(_0x80fc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x80fc('0x4'));var attributes=require('./tag.attributes');module[_0x80fc('0x5')]=function(_0x42a9ff,_0x10b37c){return _0x42a9ff[_0x80fc('0x6')](_0x80fc('0x7'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f00=['Tag','tools_tags','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./tag.attributes','exports','define'];(function(_0x187b8b,_0x1de107){var _0xdefa5f=function(_0x473cf5){while(--_0x473cf5){_0x187b8b['push'](_0x187b8b['shift']());}};_0xdefa5f(++_0x1de107);}(_0x7f00,0x1a6));var _0x07f0=function(_0x4e30c0,_0x534a76){_0x4e30c0=_0x4e30c0-0x0;var _0x5db594=_0x7f00[_0x4e30c0];return _0x5db594;};'use strict';var _=require('lodash');var util=require(_0x07f0('0x0'));var logger=require(_0x07f0('0x1'))(_0x07f0('0x2'));var moment=require('moment');var BPromise=require(_0x07f0('0x3'));var rp=require(_0x07f0('0x4'));var fs=require('fs');var path=require(_0x07f0('0x5'));var rimraf=require('rimraf');var config=require(_0x07f0('0x6'));var attributes=require(_0x07f0('0x7'));module[_0x07f0('0x8')]=function(_0x421bcf,_0xa6530e){return _0x421bcf[_0x07f0('0x9')](_0x07f0('0xa'),attributes,{'tableName':_0x07f0('0xb'),'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 aa5d753..0bd489e 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 _0xa3e6=['then','Tag,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x1fc855,_0x2c0ac4){_0x1fc855=_0x1fc855-0x0;var _0x1cbb1c=_0xa3e6[_0x1fc855];return _0x1cbb1c;};'use strict';var _=require(_0x6a3e('0x0'));var util=require('util');var moment=require(_0x6a3e('0x1'));var BPromise=require('bluebird');var rs=require(_0x6a3e('0x2'));var fs=require('fs');var Redis=require(_0x6a3e('0x3'));var db=require(_0x6a3e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6a3e('0x5'))('rpc');var config=require(_0x6a3e('0x6'));var jayson=require(_0x6a3e('0x7'));var client=jayson[_0x6a3e('0x8')][_0x6a3e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19dd88,_0x52a2f8,_0x3d7fbe){return new BPromise(function(_0x3d2a86,_0x5c3b9f){return client['request'](_0x19dd88,_0x3d7fbe)[_0x6a3e('0xa')](function(_0x5707de){logger['info'](_0x6a3e('0xb'),_0x52a2f8,'request\x20sent');logger[_0x6a3e('0xc')]('Tag,\x20%s,\x20%s,\x20%s',_0x52a2f8,_0x6a3e('0xd'),JSON[_0x6a3e('0xe')](_0x5707de));if(_0x5707de[_0x6a3e('0xf')]){if(_0x5707de[_0x6a3e('0xf')][_0x6a3e('0x10')]===0x1f4){logger[_0x6a3e('0xf')]('Tag,\x20%s,\x20%s',_0x52a2f8,_0x5707de[_0x6a3e('0xf')][_0x6a3e('0x11')]);return _0x5c3b9f(_0x5707de[_0x6a3e('0xf')][_0x6a3e('0x11')]);}logger[_0x6a3e('0xf')](_0x6a3e('0xb'),_0x52a2f8,_0x5707de[_0x6a3e('0xf')]['message']);return _0x3d2a86(_0x5707de[_0x6a3e('0xf')][_0x6a3e('0x11')]);}else{logger[_0x6a3e('0x12')](_0x6a3e('0xb'),_0x52a2f8,'request\x20sent');_0x3d2a86(_0x5707de[_0x6a3e('0x13')][_0x6a3e('0x11')]);}})['catch'](function(_0x5d3d56){logger['error']('Tag,\x20%s,\x20%s',_0x52a2f8,_0x5d3d56);_0x5c3b9f(_0x5d3d56);});});} \ No newline at end of file +var _0x72b1=['stringify','error','Tag,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s'];(function(_0x29ec33,_0x1a9e4c){var _0x4a3262=function(_0x2509ef){while(--_0x2509ef){_0x29ec33['push'](_0x29ec33['shift']());}};_0x4a3262(++_0x1a9e4c);}(_0x72b1,0x16e));var _0x172b=function(_0x5a1e85,_0x54f57a){_0x5a1e85=_0x5a1e85-0x0;var _0x15550b=_0x72b1[_0x5a1e85];return _0x15550b;};'use strict';var _=require(_0x172b('0x0'));var util=require('util');var moment=require(_0x172b('0x1'));var BPromise=require(_0x172b('0x2'));var rs=require(_0x172b('0x3'));var fs=require('fs');var Redis=require(_0x172b('0x4'));var db=require(_0x172b('0x5'))['db'];var utils=require(_0x172b('0x6'));var logger=require(_0x172b('0x7'))('rpc');var config=require(_0x172b('0x8'));var jayson=require(_0x172b('0x9'));var client=jayson[_0x172b('0xa')][_0x172b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x571994,_0x345e5e,_0x517363){return new BPromise(function(_0x1f98e9,_0x531b10){return client[_0x172b('0xc')](_0x571994,_0x517363)[_0x172b('0xd')](function(_0x977f18){logger[_0x172b('0xe')]('Tag,\x20%s,\x20%s',_0x345e5e,_0x172b('0xf'));logger[_0x172b('0x10')](_0x172b('0x11'),_0x345e5e,_0x172b('0xf'),JSON[_0x172b('0x12')](_0x977f18));if(_0x977f18[_0x172b('0x13')]){if(_0x977f18[_0x172b('0x13')]['code']===0x1f4){logger[_0x172b('0x13')](_0x172b('0x14'),_0x345e5e,_0x977f18[_0x172b('0x13')]['message']);return _0x531b10(_0x977f18[_0x172b('0x13')]['message']);}logger[_0x172b('0x13')](_0x172b('0x14'),_0x345e5e,_0x977f18['error'][_0x172b('0x15')]);return _0x1f98e9(_0x977f18[_0x172b('0x13')][_0x172b('0x15')]);}else{logger[_0x172b('0xe')]('Tag,\x20%s,\x20%s',_0x345e5e,'request\x20sent');_0x1f98e9(_0x977f18[_0x172b('0x16')][_0x172b('0x15')]);}})[_0x172b('0x17')](function(_0x3c7fff){logger['error']('Tag,\x20%s,\x20%s',_0x345e5e,_0x3c7fff);_0x531b10(_0x3c7fff);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index c488758..6141ccd 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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_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['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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 f3532bd..2c2b828 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 _0xe706=['STRING','sequelize','exports'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xe706,0xa3));var _0x6e70=function(_0x8e7772,_0x9d77b0){_0x8e7772=_0x8e7772-0x0;var _0x408200=_0xe706[_0x8e7772];return _0x408200;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x703f6c,_0x5ee1bd){var _0x2fa70f=function(_0x112d07){while(--_0x112d07){_0x703f6c['push'](_0x703f6c['shift']());}};_0x2fa70f(++_0x5ee1bd);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index cd93dad..8b3930a 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 _0xea12=['emit','Queue:save','User','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','SIP/%s','all','TeamVoicePrefix','spread','Queue:remove','VoicePrefixId','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./team.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','name','send','index','Team','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','map','options','includeAll','include','findAll','catch','show','params','merge','find','create','user','get','role','Teams','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','sequelize','transaction','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','UserVoiceQueue','destroy','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix','UserProfileResource','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','length','Queues','addQueues','findOne','add','ids','removeQueues','remove','addAgents','isArray','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','Voice','through','QueueId','TeamVoiceQueue','penalty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xea12,0x148));var _0x2ea1=function(_0x57a9a1,_0x23bfa9){_0x57a9a1=_0x57a9a1-0x0;var _0xa33da0=_0xea12[_0x57a9a1];return _0xa33da0;};'use strict';var emlformat=require(_0x2ea1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2ea1('0x1'));var jsonpatch=require(_0x2ea1('0x2'));var rp=require(_0x2ea1('0x3'));var moment=require(_0x2ea1('0x4'));var BPromise=require(_0x2ea1('0x5'));var Mustache=require(_0x2ea1('0x6'));var util=require(_0x2ea1('0x7'));var path=require('path');var sox=require(_0x2ea1('0x8'));var csv=require('to-csv');var ejs=require(_0x2ea1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2ea1('0xa'));var crypto=require(_0x2ea1('0xb'));var jsforce=require(_0x2ea1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2ea1('0xd'));var querystring=require('querystring');var Papa=require(_0x2ea1('0xe'));var Redis=require(_0x2ea1('0xf'));var authService=require(_0x2ea1('0x10'));var qs=require(_0x2ea1('0x11'));var as=require(_0x2ea1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ea1('0x13'))('api');var utils=require(_0x2ea1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2ea1('0x15'));var db=require(_0x2ea1('0x16'))['db'];config[_0x2ea1('0x17')]=_[_0x2ea1('0x18')](config[_0x2ea1('0x17')],{'host':_0x2ea1('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2ea1('0x17')]));require(_0x2ea1('0x1a'))[_0x2ea1('0x1b')](socket);function respondWithStatusCode(_0x38c286,_0x37ed42){_0x37ed42=_0x37ed42||0xcc;return function(_0x31a25d){if(_0x31a25d){return _0x38c286[_0x2ea1('0x1c')](_0x37ed42);}return _0x38c286[_0x2ea1('0x1d')](_0x37ed42)[_0x2ea1('0x1e')]();};}function respondWithResult(_0x341b9,_0x331440){_0x331440=_0x331440||0xc8;return function(_0x330dc0){if(_0x330dc0){return _0x341b9['status'](_0x331440)[_0x2ea1('0x1f')](_0x330dc0);}};}function respondWithFilteredResult(_0x23a747,_0x177915){return function(_0x5cf0ce){if(_0x5cf0ce){var _0x41be52=typeof _0x177915[_0x2ea1('0x20')]===_0x2ea1('0x21')&&typeof _0x177915[_0x2ea1('0x22')]===_0x2ea1('0x21');var _0xb6699=_0x5cf0ce[_0x2ea1('0x23')];var _0x5010f0=_0x41be52?0x0:_0x177915[_0x2ea1('0x20')];var _0x320d73=_0x41be52?_0x5cf0ce[_0x2ea1('0x23')]:_0x177915[_0x2ea1('0x20')]+_0x177915[_0x2ea1('0x22')];var _0x31599a;if(_0x320d73>=_0xb6699){_0x320d73=_0xb6699;_0x31599a=0xc8;}else{_0x31599a=0xce;}_0x23a747[_0x2ea1('0x1d')](_0x31599a);return _0x23a747[_0x2ea1('0x24')](_0x2ea1('0x25'),_0x5010f0+'-'+_0x320d73+'/'+_0xb6699)[_0x2ea1('0x1f')](_0x5cf0ce);}return null;};}function patchUpdates(_0x2e9575){return function(_0xcc39f8){try{jsonpatch[_0x2ea1('0x26')](_0xcc39f8,_0x2e9575,!![]);}catch(_0xb43b68){return BPromise[_0x2ea1('0x27')](_0xb43b68);}return _0xcc39f8['save']();};}function saveUpdates(_0x10c3c6,_0x26aeec){return function(_0x35ca78){if(_0x35ca78){return _0x35ca78['update'](_0x10c3c6)[_0x2ea1('0x28')](function(_0x123604){return _0x123604;});}return null;};}function handleEntityNotFound(_0xa1f8db,_0xb56016){return function(_0x2c1969){if(!_0x2c1969){_0xa1f8db[_0x2ea1('0x1c')](0x194);}return _0x2c1969;};}function handleError(_0x2f53a5,_0x4ac682){_0x4ac682=_0x4ac682||0x1f4;return function(_0x9c359b){logger['error'](_0x9c359b['stack']);if(_0x9c359b[_0x2ea1('0x29')]){delete _0x9c359b['name'];}_0x2f53a5[_0x2ea1('0x1d')](_0x4ac682)[_0x2ea1('0x2a')](_0x9c359b);};}exports[_0x2ea1('0x2b')]=function(_0x243b65,_0x402f1c){var _0x279a19={},_0x52a701={},_0x45cbd5={'count':0x0,'rows':[]};var _0x706bee=_['map'](db[_0x2ea1('0x2c')][_0x2ea1('0x2d')],function(_0x20fff6){return{'name':_0x20fff6[_0x2ea1('0x2e')],'type':_0x20fff6[_0x2ea1('0x2f')][_0x2ea1('0x30')]};});_0x52a701[_0x2ea1('0x31')]=_['map'](_0x706bee,_0x2ea1('0x29'));_0x52a701[_0x2ea1('0x32')]=_[_0x2ea1('0x33')](_0x243b65[_0x2ea1('0x32')]);_0x52a701['filters']=_[_0x2ea1('0x34')](_0x52a701[_0x2ea1('0x31')],_0x52a701['query']);_0x279a19[_0x2ea1('0x35')]=_[_0x2ea1('0x34')](_0x52a701[_0x2ea1('0x31')],qs[_0x2ea1('0x36')](_0x243b65[_0x2ea1('0x32')][_0x2ea1('0x36')]));_0x279a19[_0x2ea1('0x35')]=_0x279a19[_0x2ea1('0x35')]['length']?_0x279a19[_0x2ea1('0x35')]:_0x52a701[_0x2ea1('0x31')];if(!_0x243b65[_0x2ea1('0x32')][_0x2ea1('0x37')](_0x2ea1('0x38'))){_0x279a19['limit']=qs['limit'](_0x243b65[_0x2ea1('0x32')][_0x2ea1('0x22')]);_0x279a19[_0x2ea1('0x20')]=qs[_0x2ea1('0x20')](_0x243b65[_0x2ea1('0x32')][_0x2ea1('0x20')]);}_0x279a19[_0x2ea1('0x39')]=qs['sort'](_0x243b65[_0x2ea1('0x32')][_0x2ea1('0x3a')]);_0x279a19[_0x2ea1('0x3b')]=qs[_0x2ea1('0x3c')](_[_0x2ea1('0x3d')](_0x243b65[_0x2ea1('0x32')],_0x52a701[_0x2ea1('0x3c')]),_0x706bee);if(_0x243b65[_0x2ea1('0x32')][_0x2ea1('0x3e')]){_0x279a19[_0x2ea1('0x3b')]=_['merge'](_0x279a19[_0x2ea1('0x3b')],{'$or':_[_0x2ea1('0x3f')](_0x706bee,function(_0x46da7b){if(_0x46da7b[_0x2ea1('0x2f')]!=='VIRTUAL'){var _0x38c70e={};_0x38c70e[_0x46da7b[_0x2ea1('0x29')]]={'$like':'%'+_0x243b65[_0x2ea1('0x32')][_0x2ea1('0x3e')]+'%'};return _0x38c70e;}})});}_0x279a19=_['merge']({},_0x279a19,_0x243b65[_0x2ea1('0x40')]);var _0x1b9450={'where':_0x279a19[_0x2ea1('0x3b')]};return db[_0x2ea1('0x2c')]['count'](_0x1b9450)[_0x2ea1('0x28')](function(_0x1efa24){_0x45cbd5[_0x2ea1('0x23')]=_0x1efa24;if(_0x243b65[_0x2ea1('0x32')][_0x2ea1('0x41')]){_0x279a19[_0x2ea1('0x42')]=[{'all':!![]}];}return db[_0x2ea1('0x2c')][_0x2ea1('0x43')](_0x279a19);})['then'](function(_0x3e5c2b){_0x45cbd5['rows']=_0x3e5c2b;return _0x45cbd5;})[_0x2ea1('0x28')](respondWithFilteredResult(_0x402f1c,_0x279a19))[_0x2ea1('0x44')](handleError(_0x402f1c,null));};exports[_0x2ea1('0x45')]=function(_0x76bef3,_0x102476){var _0x50b2b9={'raw':![],'where':{'id':_0x76bef3[_0x2ea1('0x46')]['id']}},_0x54f23d={};_0x54f23d['model']=_[_0x2ea1('0x33')](db[_0x2ea1('0x2c')][_0x2ea1('0x2d')]);_0x54f23d['query']=_['keys'](_0x76bef3['query']);_0x54f23d[_0x2ea1('0x3c')]=_[_0x2ea1('0x34')](_0x54f23d[_0x2ea1('0x31')],_0x54f23d[_0x2ea1('0x32')]);_0x50b2b9[_0x2ea1('0x35')]=_[_0x2ea1('0x34')](_0x54f23d[_0x2ea1('0x31')],qs['fields'](_0x76bef3[_0x2ea1('0x32')][_0x2ea1('0x36')]));_0x50b2b9[_0x2ea1('0x35')]=_0x50b2b9[_0x2ea1('0x35')]['length']?_0x50b2b9[_0x2ea1('0x35')]:_0x54f23d['model'];if(_0x76bef3[_0x2ea1('0x32')][_0x2ea1('0x41')]){_0x50b2b9[_0x2ea1('0x42')]=[{'all':!![]}];}_0x50b2b9=_[_0x2ea1('0x47')]({},_0x50b2b9,_0x76bef3[_0x2ea1('0x40')]);return db[_0x2ea1('0x2c')][_0x2ea1('0x48')](_0x50b2b9)[_0x2ea1('0x28')](handleEntityNotFound(_0x102476,null))[_0x2ea1('0x28')](respondWithResult(_0x102476,null))[_0x2ea1('0x44')](handleError(_0x102476,null));};exports[_0x2ea1('0x49')]=function(_0x4437fa,_0x5c3c4c){return db[_0x2ea1('0x2c')][_0x2ea1('0x49')](_0x4437fa['body'],{})[_0x2ea1('0x28')](function(_0x41c21d){var _0x4506a5=_0x4437fa[_0x2ea1('0x4a')][_0x2ea1('0x4b')]({'plain':!![]});if(!_0x4506a5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4506a5[_0x2ea1('0x4c')]===_0x2ea1('0x4a')){var _0x1d57c5=_0x41c21d[_0x2ea1('0x4b')]({'plain':!![]});var _0x47dc1d=_0x2ea1('0x4d');return db[_0x2ea1('0x4e')]['find']({'where':{'name':_0x47dc1d,'userProfileId':_0x4506a5['userProfileId']},'raw':!![]})[_0x2ea1('0x28')](function(_0x278086){if(_0x278086&&_0x278086[_0x2ea1('0x4f')]===0x0){return db['UserProfileResource'][_0x2ea1('0x49')]({'name':_0x1d57c5[_0x2ea1('0x29')],'resourceId':_0x1d57c5['id'],'type':_0x278086[_0x2ea1('0x29')],'sectionId':_0x278086['id']},{})[_0x2ea1('0x28')](function(){return _0x41c21d;});}else{return _0x41c21d;}})['catch'](function(_0x31a9ec){logger[_0x2ea1('0x50')](_0x2ea1('0x51'),_0x31a9ec);throw _0x31a9ec;});}return _0x41c21d;})[_0x2ea1('0x28')](respondWithResult(_0x5c3c4c,0xc9))['catch'](handleError(_0x5c3c4c,null));};exports[_0x2ea1('0x52')]=function(_0x2f9bed,_0x4b83a7){if(_0x2f9bed[_0x2ea1('0x53')]['id']){delete _0x2f9bed['body']['id'];}return db[_0x2ea1('0x2c')][_0x2ea1('0x48')]({'where':{'id':_0x2f9bed['params']['id']}})['then'](handleEntityNotFound(_0x4b83a7,null))[_0x2ea1('0x28')](saveUpdates(_0x2f9bed[_0x2ea1('0x53')],null))[_0x2ea1('0x28')](respondWithResult(_0x4b83a7,null))[_0x2ea1('0x44')](handleError(_0x4b83a7,null));};exports['destroy']=function(_0x2a088a,_0x14ca9d){var _0x23adca=_0x2a088a['params']['id'];var _0x9fe801=[];return db[_0x2ea1('0x54')][_0x2ea1('0x55')](function(_0x2cf8e7){var _0x17979c='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x23adca;return db[_0x2ea1('0x54')][_0x2ea1('0x32')](_0x17979c,{'type':db[_0x2ea1('0x56')]['QueryTypes'][_0x2ea1('0x57')],'raw':!![],'transaction':_0x2cf8e7})[_0x2ea1('0x28')](function(_0x33c8c2){_0x9fe801=_[_0x2ea1('0x3f')](_0x33c8c2,function(_0x2c8562){return Number(_0x2c8562[_0x2ea1('0x58')]);});})[_0x2ea1('0x28')](function(){var _0x3da705=_0x2ea1('0x59')+_0x23adca;return db['sequelize'][_0x2ea1('0x32')](_0x3da705,{'type':db['Sequelize'][_0x2ea1('0x5a')][_0x2ea1('0x57')],'raw':!![],'transaction':_0x2cf8e7});})[_0x2ea1('0x28')](function(_0x4f7ad8){var _0x452685=_[_0x2ea1('0x3f')](_0x4f7ad8,function(_0x26e01a){return Number(_0x26e01a[_0x2ea1('0x5b')]);});return db[_0x2ea1('0x5c')][_0x2ea1('0x5d')]({'where':{'UserId':{'$in':_0x9fe801},'VoiceQueueId':{'$in':_0x452685}},'transaction':_0x2cf8e7});})[_0x2ea1('0x28')](function(){var _0x4a0750='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x23adca;return db[_0x2ea1('0x54')]['query'](_0x4a0750,{'type':db[_0x2ea1('0x56')]['QueryTypes'][_0x2ea1('0x57')],'raw':!![],'transaction':_0x2cf8e7});})[_0x2ea1('0x28')](function(_0x4f5508){var _0x126a01=_[_0x2ea1('0x3f')](_0x4f5508,function(_0x57bf24){return Number(_0x57bf24[_0x2ea1('0x5e')]);});return db[_0x2ea1('0x5f')][_0x2ea1('0x5d')]({'where':{'UserId':{'$in':_0x9fe801},'MailQueueId':{'$in':_0x126a01}},'transaction':_0x2cf8e7});})[_0x2ea1('0x28')](function(){var _0x5689aa=_0x2ea1('0x60')+_0x23adca;return db[_0x2ea1('0x54')][_0x2ea1('0x32')](_0x5689aa,{'type':db[_0x2ea1('0x56')][_0x2ea1('0x5a')][_0x2ea1('0x57')],'raw':!![],'transaction':_0x2cf8e7});})[_0x2ea1('0x28')](function(_0x10fbae){var _0x3caee5=_[_0x2ea1('0x3f')](_0x10fbae,function(_0x4551c2){return Number(_0x4551c2['SmsQueueId']);});return db[_0x2ea1('0x61')]['destroy']({'where':{'UserId':{'$in':_0x9fe801},'SmsQueueId':{'$in':_0x3caee5}},'transaction':_0x2cf8e7});})[_0x2ea1('0x28')](function(){var _0x30fee9=_0x2ea1('0x62')+_0x23adca;return db[_0x2ea1('0x54')][_0x2ea1('0x32')](_0x30fee9,{'type':db[_0x2ea1('0x56')][_0x2ea1('0x5a')]['SELECT'],'raw':!![],'transaction':_0x2cf8e7});})[_0x2ea1('0x28')](function(_0x3a2e9d){var _0x2350eb=_[_0x2ea1('0x3f')](_0x3a2e9d,function(_0x1c54ae){return Number(_0x1c54ae[_0x2ea1('0x63')]);});return db[_0x2ea1('0x64')][_0x2ea1('0x5d')]({'where':{'UserId':{'$in':_0x9fe801},'ChatQueueId':{'$in':_0x2350eb}},'transaction':_0x2cf8e7});})['then'](function(){var _0x401000=_0x2ea1('0x65')+_0x23adca;return db['sequelize'][_0x2ea1('0x32')](_0x401000,{'type':db[_0x2ea1('0x56')][_0x2ea1('0x5a')][_0x2ea1('0x57')],'raw':!![],'transaction':_0x2cf8e7});})[_0x2ea1('0x28')](function(_0x5f0e54){var _0x144698=_[_0x2ea1('0x3f')](_0x5f0e54,function(_0x4d97cb){return Number(_0x4d97cb[_0x2ea1('0x66')]);});return db[_0x2ea1('0x67')][_0x2ea1('0x5d')]({'where':{'UserId':{'$in':_0x9fe801},'FaxQueueId':{'$in':_0x144698}},'transaction':_0x2cf8e7});})['then'](function(){var _0x268882=_0x2ea1('0x68')+_0x23adca;return db[_0x2ea1('0x54')][_0x2ea1('0x32')](_0x268882,{'type':db['Sequelize']['QueryTypes'][_0x2ea1('0x57')],'raw':!![],'transaction':_0x2cf8e7});})['then'](function(_0x1ad64f){var _0x467259=_[_0x2ea1('0x3f')](_0x1ad64f,function(_0x3c93af){return Number(_0x3c93af[_0x2ea1('0x69')]);});return db[_0x2ea1('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x9fe801},'OpenchannelQueueId':{'$in':_0x467259}},'transaction':_0x2cf8e7});})[_0x2ea1('0x28')](function(){var _0x49570e='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x23adca;return db[_0x2ea1('0x54')][_0x2ea1('0x32')](_0x49570e,{'type':db[_0x2ea1('0x56')]['QueryTypes'][_0x2ea1('0x57')],'raw':!![],'transaction':_0x2cf8e7});})[_0x2ea1('0x28')](function(_0x1d24d8){var _0x52822a=_['map'](_0x1d24d8,function(_0x3bc8f6){return Number(_0x3bc8f6[_0x2ea1('0x6b')]);});return db[_0x2ea1('0x6c')]['destroy']({'where':{'UserId':{'$in':_0x9fe801},'WhatsappQueueId':{'$in':_0x52822a}},'transaction':_0x2cf8e7});})['then'](function(){return db['TeamVoicePrefix']['find']({'where':{'TeamId':_0x23adca}});})[_0x2ea1('0x28')](function(_0x23538d){if(_0x23538d===null){return;}return db[_0x2ea1('0x6d')]['destroy']({'where':{'UserId':{'$in':_0x9fe801},'VoicePrefixId':_0x23538d['VoicePrefixId']},'transaction':_0x2cf8e7});})[_0x2ea1('0x28')](function(){return db[_0x2ea1('0x2c')]['destroy']({'where':{'id':_0x23adca},'cascade':!![],'transaction':_0x2cf8e7});})[_0x2ea1('0x28')](function(_0x2f6d3f){if(_0x2f6d3f===0x0){_0x14ca9d[_0x2ea1('0x1c')](0x194);}else{return db[_0x2ea1('0x6e')]['destroy']({'where':{'type':_0x2ea1('0x4d'),'resourceId':_0x23adca},'cascade':!![],'transaction':_0x2cf8e7})[_0x2ea1('0x28')](function(){_0x14ca9d[_0x2ea1('0x1d')](0xcc)[_0x2ea1('0x1e')]();});}})[_0x2ea1('0x44')](function(_0x299b00){_0x14ca9d[_0x2ea1('0x1d')](0x1f4)[_0x2ea1('0x2a')](_0x299b00);});});};exports[_0x2ea1('0x6f')]=function(_0x59f96e,_0x443acd,_0x38c33b){return db[_0x2ea1('0x2c')]['findOne']({'where':{'id':_0x59f96e[_0x2ea1('0x46')]['id']}})[_0x2ea1('0x28')](handleEntityNotFound(_0x443acd,null))['then'](function(_0x97fd53){if(!_0x59f96e['query'][_0x2ea1('0x70')]||!utils[_0x2ea1('0x71')](_0x59f96e['query'][_0x2ea1('0x70')])){throw new db['Sequelize'][(_0x2ea1('0x72'))](_0x2ea1('0x73'));}var _0x3dba4b={};var _0x599c24={};_0x599c24['model']=_[_0x2ea1('0x33')](db[_[_0x2ea1('0x74')](_0x59f96e[_0x2ea1('0x32')][_0x2ea1('0x70')][_0x2ea1('0x75')]())+_0x2ea1('0x76')][_0x2ea1('0x2d')]);_0x599c24[_0x2ea1('0x32')]=_[_0x2ea1('0x33')](_0x59f96e[_0x2ea1('0x32')]);_0x599c24[_0x2ea1('0x3c')]=_[_0x2ea1('0x34')](_0x599c24[_0x2ea1('0x31')],_0x599c24[_0x2ea1('0x32')]);_0x3dba4b['attributes']=_['intersection'](_0x599c24[_0x2ea1('0x31')],qs['fields'](_0x59f96e[_0x2ea1('0x32')][_0x2ea1('0x36')]));_0x3dba4b[_0x2ea1('0x35')]=_0x3dba4b[_0x2ea1('0x35')][_0x2ea1('0x77')]?_0x3dba4b[_0x2ea1('0x35')]:_0x599c24[_0x2ea1('0x31')];_0x3dba4b[_0x2ea1('0x22')]=qs['limit'](_0x59f96e['query'][_0x2ea1('0x22')]);_0x3dba4b[_0x2ea1('0x20')]=qs[_0x2ea1('0x20')](_0x59f96e[_0x2ea1('0x32')][_0x2ea1('0x20')]);_0x3dba4b[_0x2ea1('0x39')]=qs[_0x2ea1('0x3a')](_0x59f96e[_0x2ea1('0x32')][_0x2ea1('0x3a')]);_0x3dba4b[_0x2ea1('0x3b')]=qs[_0x2ea1('0x3c')](_[_0x2ea1('0x3d')](_0x59f96e[_0x2ea1('0x32')],_0x599c24[_0x2ea1('0x3c')]));_0x3dba4b=_[_0x2ea1('0x47')]({},_0x3dba4b,_0x59f96e['options']);return _0x97fd53['get'+_[_0x2ea1('0x74')](_0x59f96e[_0x2ea1('0x32')][_0x2ea1('0x70')]['toLowerCase']())+_0x2ea1('0x78')](_0x3dba4b);})[_0x2ea1('0x28')](respondWithResult(_0x443acd,null))[_0x2ea1('0x44')](handleError(_0x443acd,null));};exports[_0x2ea1('0x79')]=function(_0x293986,_0x3819e3,_0x179687){return db[_0x2ea1('0x2c')][_0x2ea1('0x7a')]({'where':{'id':_0x293986[_0x2ea1('0x46')]['id']}})[_0x2ea1('0x28')](function(_0x13e0b9){if(_0x13e0b9){if(!_0x293986[_0x2ea1('0x53')]['channel']||!utils[_0x2ea1('0x71')](_0x293986[_0x2ea1('0x53')][_0x2ea1('0x70')])){throw new db[(_0x2ea1('0x56'))][(_0x2ea1('0x72'))](_0x2ea1('0x73'));}return _0x13e0b9[_0x2ea1('0x7b')+_['capitalize'](_0x293986[_0x2ea1('0x53')][_0x2ea1('0x70')][_0x2ea1('0x75')]())+_0x2ea1('0x78')](_0x293986['body'][_0x2ea1('0x7c')]);}return null;})[_0x2ea1('0x28')](handleEntityNotFound(_0x3819e3,null))[_0x2ea1('0x28')](respondWithStatusCode(_0x3819e3,null))['catch'](handleError(_0x3819e3,null));};exports[_0x2ea1('0x7d')]=function(_0x523a8e,_0x3d4d38,_0x470751){return db[_0x2ea1('0x2c')]['findOne']({'where':{'id':_0x523a8e['params']['id']}})[_0x2ea1('0x28')](function(_0x23615f){if(_0x23615f){if(!_0x523a8e[_0x2ea1('0x32')][_0x2ea1('0x70')]||!utils['isValidChannel'](_0x523a8e[_0x2ea1('0x32')][_0x2ea1('0x70')])){throw new db[(_0x2ea1('0x56'))]['ValidationError']('Unknown\x20channel');}return _0x23615f[_0x2ea1('0x7e')+_['capitalize'](_0x523a8e['query'][_0x2ea1('0x70')]['toLowerCase']())+'Queues'](_0x523a8e['query']['ids']);}return null;})[_0x2ea1('0x28')](handleEntityNotFound(_0x3d4d38,null))[_0x2ea1('0x28')](respondWithStatusCode(_0x3d4d38,null))[_0x2ea1('0x44')](handleError(_0x3d4d38,null));};exports[_0x2ea1('0x7f')]=function(_0x41c67b,_0x4b9d21){var _0x44b96b=_[_0x2ea1('0x80')](_0x41c67b[_0x2ea1('0x53')]['ids'])?_0x41c67b[_0x2ea1('0x53')][_0x2ea1('0x7c')]:[_0x41c67b[_0x2ea1('0x53')]['ids']];var _0x11e08e=_0x41c67b['params']['id'];return db[_0x2ea1('0x2c')][_0x2ea1('0x48')]({'where':{'id':_0x11e08e}})[_0x2ea1('0x28')](handleEntityNotFound(_0x4b9d21,null))['then'](function(_0x59a859){if(_0x59a859){var _0x552f7f=['Voice',_0x2ea1('0x81'),_0x2ea1('0x82'),_0x2ea1('0x83'),_0x2ea1('0x84'),_0x2ea1('0x85'),_0x2ea1('0x86')];return db[_0x2ea1('0x54')]['transaction'](function(_0x50e8e3){var _0x44e89c=_[_0x2ea1('0x3f')](_0x552f7f,function(_0x19a07b){var _0x4623e9={'attributes':['id',_0x2ea1('0x29')]};if(_0x19a07b===_0x2ea1('0x87')){_0x4623e9[_0x2ea1('0x88')]={'attributes':['penalty']};}return _0x59a859[_0x2ea1('0x4b')+_0x19a07b+_0x2ea1('0x78')](_0x4623e9)['then'](function(_0x39b493){var _0x40205b=_['map'](_0x39b493,function(_0x523f8d){var _0x246ad4=_[_0x2ea1('0x3f')](_0x44b96b,function(_0x81f3c2){var _0x37d1ff={'where':{'UserId':_0x81f3c2,[_0x19a07b+_0x2ea1('0x89')]:_0x523f8d['id']},'transaction':_0x50e8e3};if(_0x19a07b==='Voice'){_0x37d1ff[_0x2ea1('0x18')]={'penalty':_0x523f8d[_0x2ea1('0x8a')][_0x2ea1('0x8b')]};}return db['User'+_0x19a07b+_0x2ea1('0x76')]['findOrCreate'](_0x37d1ff)[_0x2ea1('0x28')](function(){socket[_0x2ea1('0x8c')](_0x2ea1('0x4a')+_0x19a07b+_0x2ea1('0x8d'),{'UserId':_0x81f3c2,[_0x19a07b+_0x2ea1('0x89')]:_0x523f8d['id']});if(_0x19a07b!==_0x2ea1('0x87')){return;}return db[_0x2ea1('0x8e')][_0x2ea1('0x43')]({'where':{'id':_0x44b96b,'online':0x1},'attributes':['id',_0x2ea1('0x29'),_0x2ea1('0x8f'),_0x2ea1('0x90'),_0x2ea1('0x91')],'raw':!![]})[_0x2ea1('0x28')](function(_0x84eab0){var _0xbc11e9=_[_0x2ea1('0x3f')](_0x84eab0,function(_0x1b7de0){return db[_0x2ea1('0x92')][_0x2ea1('0x93')]({'membername':_0x1b7de0[_0x2ea1('0x29')],'UserId':_0x1b7de0['id'],'queue_name':_0x523f8d[_0x2ea1('0x29')],'VoiceQueueId':_0x523f8d['id'],'interface':_[_0x2ea1('0x94')](_0x1b7de0['interface'])?util['format'](_0x2ea1('0x95'),_0x1b7de0['name']):_0x1b7de0[_0x2ea1('0x91')],'paused':_0x1b7de0[_0x2ea1('0x90')]||![],'penalty':_0x523f8d[_0x2ea1('0x8a')][_0x2ea1('0x8b')]},{'transaction':_0x50e8e3});});return Promise[_0x2ea1('0x96')](_0xbc11e9);});});});return Promise[_0x2ea1('0x96')](_0x246ad4);});return Promise[_0x2ea1('0x96')](_0x40205b);})['then'](function(){return db[_0x2ea1('0x97')][_0x2ea1('0x7a')]({'where':{'teamId':_0x11e08e}})[_0x2ea1('0x28')](function(_0x42b044){if(_0x42b044){var _0x5175d1=_[_0x2ea1('0x3f')](_0x44b96b,function(_0x2306ce){db[_0x2ea1('0x6d')][_0x2ea1('0x93')]({'UserId':_0x2306ce,'VoicePrefixId':_0x42b044['VoicePrefixId']});});return Promise['all'](_0x5175d1);}});});});return Promise[_0x2ea1('0x96')](_0x44e89c)[_0x2ea1('0x28')](function(){return _0x59a859[_0x2ea1('0x7f')](_0x44b96b,{'transaction':_0x50e8e3})[_0x2ea1('0x98')](function(_0x583903){return _0x583903;});});});}})['then'](respondWithResult(_0x4b9d21,null))[_0x2ea1('0x44')](handleError(_0x4b9d21,null));};exports['removeAgents']=function(_0xfcedbe,_0x368fc4){var _0x23d1fd=_[_0x2ea1('0x80')](_0xfcedbe['query'][_0x2ea1('0x7c')])?_0xfcedbe[_0x2ea1('0x32')][_0x2ea1('0x7c')]:[_0xfcedbe[_0x2ea1('0x32')][_0x2ea1('0x7c')]];var _0x1b08a6=_0xfcedbe[_0x2ea1('0x46')]['id'];return db[_0x2ea1('0x2c')][_0x2ea1('0x48')]({'where':{'id':_0x1b08a6}})['then'](handleEntityNotFound(_0x368fc4,null))[_0x2ea1('0x28')](function(_0x4ac68f){if(_0x4ac68f){var _0x54e6c7=[_0x2ea1('0x87'),_0x2ea1('0x81'),_0x2ea1('0x82'),_0x2ea1('0x83'),'Fax',_0x2ea1('0x85'),'Whatsapp'];return db[_0x2ea1('0x54')][_0x2ea1('0x55')](function(_0x58eb60){var _0x45c4fa=_[_0x2ea1('0x3f')](_0x54e6c7,function(_0x5ccd19){var _0x40002c={'attributes':['id',_0x2ea1('0x29')]};return _0x4ac68f[_0x2ea1('0x4b')+_0x5ccd19+_0x2ea1('0x78')](_0x40002c)[_0x2ea1('0x28')](function(_0x16fc12){var _0x390064=_['map'](_0x16fc12,function(_0x1faa80){return _0x1faa80['removeAgents'](_0x23d1fd,{'transaction':_0x58eb60})[_0x2ea1('0x28')](function(){var _0x3dce14=_[_0x2ea1('0x3f')](_0x23d1fd,function(_0x15ec3a){socket[_0x2ea1('0x8c')](_0x2ea1('0x4a')+_0x5ccd19+_0x2ea1('0x99'),{'UserId':Number(_0x15ec3a),[_0x5ccd19+_0x2ea1('0x89')]:_0x1faa80['id']});if(_0x5ccd19!==_0x2ea1('0x87')){return;}return db[_0x2ea1('0x92')][_0x2ea1('0x5d')]({'where':{'VoiceQueueId':_0x1faa80['id'],'UserId':_0x15ec3a},'transaction':_0x58eb60});});return Promise[_0x2ea1('0x96')](_0x3dce14);});});return Promise['all'](_0x390064);});});return Promise[_0x2ea1('0x96')](_0x45c4fa)[_0x2ea1('0x28')](function(){return _0x4ac68f['removeAgents'](_0x23d1fd,{'transaction':_0x58eb60});})[_0x2ea1('0x28')](function(){return db[_0x2ea1('0x97')][_0x2ea1('0x7a')]({'where':{'teamId':_0x1b08a6}})['then'](function(_0x25568d){if(_0x25568d){var _0x18355c=_['map'](_0x23d1fd,function(_0x4a78b3){db[_0x2ea1('0x6d')][_0x2ea1('0x5d')]({'where':{'UserId':_0x4a78b3,'VoicePrefixId':_0x25568d[_0x2ea1('0x9a')]}});});return Promise[_0x2ea1('0x96')](_0x18355c);}});});});}})[_0x2ea1('0x28')](respondWithStatusCode(_0x368fc4,null))[_0x2ea1('0x44')](handleError(_0x368fc4,null));};exports[_0x2ea1('0x9b')]=function(_0x338af4,_0x49d908,_0x2deb61){var _0x79d28c={};var _0x12896e={};var _0x537794;var _0x296b98;return db[_0x2ea1('0x2c')][_0x2ea1('0x7a')]({'where':{'id':_0x338af4[_0x2ea1('0x46')]['id']}})[_0x2ea1('0x28')](handleEntityNotFound(_0x49d908,null))[_0x2ea1('0x28')](function(_0xc81911){if(_0xc81911){_0x537794=_0xc81911;_0x12896e[_0x2ea1('0x31')]=_[_0x2ea1('0x33')](db[_0x2ea1('0x8e')]['rawAttributes']);_0x12896e[_0x2ea1('0x32')]=_[_0x2ea1('0x33')](_0x338af4[_0x2ea1('0x32')]);_0x12896e[_0x2ea1('0x3c')]=_[_0x2ea1('0x34')](_0x12896e[_0x2ea1('0x31')],_0x12896e[_0x2ea1('0x32')]);_0x79d28c[_0x2ea1('0x35')]=_[_0x2ea1('0x34')](_0x12896e[_0x2ea1('0x31')],qs['fields'](_0x338af4[_0x2ea1('0x32')][_0x2ea1('0x36')]));_0x79d28c['attributes']=_0x79d28c[_0x2ea1('0x35')][_0x2ea1('0x77')]?_0x79d28c[_0x2ea1('0x35')]:_0x12896e['model'];_0x79d28c[_0x2ea1('0x39')]=qs[_0x2ea1('0x3a')](_0x338af4['query'][_0x2ea1('0x3a')]);_0x79d28c['where']=qs[_0x2ea1('0x3c')](_['pick'](_0x338af4['query'],_0x12896e[_0x2ea1('0x3c')]));if(_0x338af4[_0x2ea1('0x32')]['filter']){_0x79d28c[_0x2ea1('0x3b')]=_[_0x2ea1('0x47')](_0x79d28c[_0x2ea1('0x3b')],{'$or':_['map'](_0x79d28c[_0x2ea1('0x35')],function(_0x5340c3){var _0x13edb8={};_0x13edb8[_0x5340c3]={'$like':'%'+_0x338af4['query'][_0x2ea1('0x3e')]+'%'};return _0x13edb8;})});}_0x79d28c=_[_0x2ea1('0x47')]({},_0x79d28c,_0x338af4[_0x2ea1('0x40')]);return _0x537794[_0x2ea1('0x9b')](_0x79d28c);}})[_0x2ea1('0x28')](function(_0x4d4826){if(_0x4d4826){_0x296b98=_0x4d4826[_0x2ea1('0x77')];if(!_0x338af4[_0x2ea1('0x32')][_0x2ea1('0x37')](_0x2ea1('0x38'))){_0x79d28c['limit']=qs[_0x2ea1('0x22')](_0x338af4[_0x2ea1('0x32')][_0x2ea1('0x22')]);_0x79d28c[_0x2ea1('0x20')]=qs[_0x2ea1('0x20')](_0x338af4[_0x2ea1('0x32')]['offset']);}return _0x537794[_0x2ea1('0x9b')](_0x79d28c);}})[_0x2ea1('0x28')](function(_0x1a9e38){if(_0x1a9e38){return _0x1a9e38?{'count':_0x296b98,'rows':_0x1a9e38}:null;}})[_0x2ea1('0x28')](respondWithResult(_0x49d908,null))['catch'](handleError(_0x49d908,null));}; \ No newline at end of file +var _0x2bfd=['through','penalty','QueueId','User','findOrCreate','emit','Queue:save','online','voicePause','interface','upsert','SIP/%s','all','UserVoicePrefix','addAgents','spread','removeAgents','Queue:remove','getAgents','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./team.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','error','stack','name','send','index','map','Team','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','findAll','then','rows','catch','params','rawAttributes','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','Teams','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','transaction','sequelize','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','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','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','pick','findOne','Queues','ids','isArray','Voice','Mail','Sms','Fax','Openchannel','Whatsapp'];(function(_0x580c12,_0x21f6ee){var _0x1c1322=function(_0x1142b1){while(--_0x1142b1){_0x580c12['push'](_0x580c12['shift']());}};_0x1c1322(++_0x21f6ee);}(_0x2bfd,0x1e4));var _0xd2bf=function(_0x561f25,_0x2d95c1){_0x561f25=_0x561f25-0x0;var _0x150e4c=_0x2bfd[_0x561f25];return _0x150e4c;};'use strict';var emlformat=require(_0xd2bf('0x0'));var rimraf=require(_0xd2bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd2bf('0x2'));var rp=require('request-promise');var moment=require(_0xd2bf('0x3'));var BPromise=require(_0xd2bf('0x4'));var Mustache=require('mustache');var util=require(_0xd2bf('0x5'));var path=require(_0xd2bf('0x6'));var sox=require(_0xd2bf('0x7'));var csv=require(_0xd2bf('0x8'));var ejs=require(_0xd2bf('0x9'));var fs=require('fs');var fs_extra=require(_0xd2bf('0xa'));var _=require(_0xd2bf('0xb'));var squel=require(_0xd2bf('0xc'));var crypto=require(_0xd2bf('0xd'));var jsforce=require(_0xd2bf('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd2bf('0xf'));var Papa=require(_0xd2bf('0x10'));var Redis=require(_0xd2bf('0x11'));var authService=require(_0xd2bf('0x12'));var qs=require(_0xd2bf('0x13'));var as=require(_0xd2bf('0x14'));var hardwareService=require(_0xd2bf('0x15'));var logger=require(_0xd2bf('0x16'))(_0xd2bf('0x17'));var utils=require(_0xd2bf('0x18'));var config=require(_0xd2bf('0x19'));var licenseUtil=require(_0xd2bf('0x1a'));var db=require(_0xd2bf('0x1b'))['db'];config['redis']=_[_0xd2bf('0x1c')](config[_0xd2bf('0x1d')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd2bf('0x1d')]));require(_0xd2bf('0x1e'))[_0xd2bf('0x1f')](socket);function respondWithStatusCode(_0x270dd1,_0x4b2333){_0x4b2333=_0x4b2333||0xcc;return function(_0x3ca59e){if(_0x3ca59e){return _0x270dd1[_0xd2bf('0x20')](_0x4b2333);}return _0x270dd1[_0xd2bf('0x21')](_0x4b2333)[_0xd2bf('0x22')]();};}function respondWithResult(_0x36a0ad,_0x4ba135){_0x4ba135=_0x4ba135||0xc8;return function(_0x52bcd9){if(_0x52bcd9){return _0x36a0ad[_0xd2bf('0x21')](_0x4ba135)[_0xd2bf('0x23')](_0x52bcd9);}};}function respondWithFilteredResult(_0x59dddd,_0x4dc0a9){return function(_0x50e394){if(_0x50e394){var _0x35dad3=typeof _0x4dc0a9[_0xd2bf('0x24')]===_0xd2bf('0x25')&&typeof _0x4dc0a9['limit']===_0xd2bf('0x25');var _0x36475d=_0x50e394[_0xd2bf('0x26')];var _0x329f40=_0x35dad3?0x0:_0x4dc0a9[_0xd2bf('0x24')];var _0x17dac0=_0x35dad3?_0x50e394[_0xd2bf('0x26')]:_0x4dc0a9[_0xd2bf('0x24')]+_0x4dc0a9[_0xd2bf('0x27')];var _0x1e19ce;if(_0x17dac0>=_0x36475d){_0x17dac0=_0x36475d;_0x1e19ce=0xc8;}else{_0x1e19ce=0xce;}_0x59dddd['status'](_0x1e19ce);return _0x59dddd[_0xd2bf('0x28')]('Content-Range',_0x329f40+'-'+_0x17dac0+'/'+_0x36475d)[_0xd2bf('0x23')](_0x50e394);}return null;};}function patchUpdates(_0x238628){return function(_0x5df4f3){try{jsonpatch[_0xd2bf('0x29')](_0x5df4f3,_0x238628,!![]);}catch(_0x4d36e9){return BPromise['reject'](_0x4d36e9);}return _0x5df4f3['save']();};}function saveUpdates(_0x151eab,_0x2d1886){return function(_0x526e76){if(_0x526e76){return _0x526e76['update'](_0x151eab)['then'](function(_0x33c466){return _0x33c466;});}return null;};}function handleEntityNotFound(_0x3e4400,_0x37fd7e){return function(_0x54f0af){if(!_0x54f0af){_0x3e4400[_0xd2bf('0x20')](0x194);}return _0x54f0af;};}function handleError(_0x5a1b18,_0x56df54){_0x56df54=_0x56df54||0x1f4;return function(_0x45c7a9){logger[_0xd2bf('0x2a')](_0x45c7a9[_0xd2bf('0x2b')]);if(_0x45c7a9[_0xd2bf('0x2c')]){delete _0x45c7a9[_0xd2bf('0x2c')];}_0x5a1b18[_0xd2bf('0x21')](_0x56df54)[_0xd2bf('0x2d')](_0x45c7a9);};}exports[_0xd2bf('0x2e')]=function(_0x3acaef,_0x20c89c){var _0x2f2f23={},_0x50d167={},_0x34dc81={'count':0x0,'rows':[]};var _0xd781ff=_[_0xd2bf('0x2f')](db[_0xd2bf('0x30')]['rawAttributes'],function(_0x299398){return{'name':_0x299398[_0xd2bf('0x31')],'type':_0x299398[_0xd2bf('0x32')][_0xd2bf('0x33')]};});_0x50d167[_0xd2bf('0x34')]=_[_0xd2bf('0x2f')](_0xd781ff,_0xd2bf('0x2c'));_0x50d167[_0xd2bf('0x35')]=_[_0xd2bf('0x36')](_0x3acaef[_0xd2bf('0x35')]);_0x50d167[_0xd2bf('0x37')]=_[_0xd2bf('0x38')](_0x50d167[_0xd2bf('0x34')],_0x50d167['query']);_0x2f2f23[_0xd2bf('0x39')]=_['intersection'](_0x50d167[_0xd2bf('0x34')],qs['fields'](_0x3acaef[_0xd2bf('0x35')][_0xd2bf('0x3a')]));_0x2f2f23[_0xd2bf('0x39')]=_0x2f2f23[_0xd2bf('0x39')][_0xd2bf('0x3b')]?_0x2f2f23['attributes']:_0x50d167[_0xd2bf('0x34')];if(!_0x3acaef[_0xd2bf('0x35')][_0xd2bf('0x3c')](_0xd2bf('0x3d'))){_0x2f2f23[_0xd2bf('0x27')]=qs[_0xd2bf('0x27')](_0x3acaef[_0xd2bf('0x35')][_0xd2bf('0x27')]);_0x2f2f23[_0xd2bf('0x24')]=qs[_0xd2bf('0x24')](_0x3acaef[_0xd2bf('0x35')][_0xd2bf('0x24')]);}_0x2f2f23[_0xd2bf('0x3e')]=qs[_0xd2bf('0x3f')](_0x3acaef[_0xd2bf('0x35')]['sort']);_0x2f2f23[_0xd2bf('0x40')]=qs[_0xd2bf('0x37')](_['pick'](_0x3acaef[_0xd2bf('0x35')],_0x50d167['filters']),_0xd781ff);if(_0x3acaef['query']['filter']){_0x2f2f23[_0xd2bf('0x40')]=_[_0xd2bf('0x41')](_0x2f2f23[_0xd2bf('0x40')],{'$or':_[_0xd2bf('0x2f')](_0xd781ff,function(_0x5b2a84){if(_0x5b2a84[_0xd2bf('0x32')]!=='VIRTUAL'){var _0x41e5b0={};_0x41e5b0[_0x5b2a84[_0xd2bf('0x2c')]]={'$like':'%'+_0x3acaef['query'][_0xd2bf('0x42')]+'%'};return _0x41e5b0;}})});}_0x2f2f23=_[_0xd2bf('0x41')]({},_0x2f2f23,_0x3acaef[_0xd2bf('0x43')]);var _0x1bcce6={'where':_0x2f2f23[_0xd2bf('0x40')]};return db[_0xd2bf('0x30')][_0xd2bf('0x26')](_0x1bcce6)['then'](function(_0x142d83){_0x34dc81[_0xd2bf('0x26')]=_0x142d83;if(_0x3acaef[_0xd2bf('0x35')]['includeAll']){_0x2f2f23['include']=[{'all':!![]}];}return db[_0xd2bf('0x30')][_0xd2bf('0x44')](_0x2f2f23);})[_0xd2bf('0x45')](function(_0x5bad35){_0x34dc81[_0xd2bf('0x46')]=_0x5bad35;return _0x34dc81;})[_0xd2bf('0x45')](respondWithFilteredResult(_0x20c89c,_0x2f2f23))[_0xd2bf('0x47')](handleError(_0x20c89c,null));};exports['show']=function(_0x2933e0,_0x2f4de7){var _0x225549={'raw':![],'where':{'id':_0x2933e0[_0xd2bf('0x48')]['id']}},_0x201b95={};_0x201b95['model']=_[_0xd2bf('0x36')](db[_0xd2bf('0x30')][_0xd2bf('0x49')]);_0x201b95[_0xd2bf('0x35')]=_[_0xd2bf('0x36')](_0x2933e0['query']);_0x201b95[_0xd2bf('0x37')]=_['intersection'](_0x201b95[_0xd2bf('0x34')],_0x201b95['query']);_0x225549[_0xd2bf('0x39')]=_['intersection'](_0x201b95['model'],qs[_0xd2bf('0x3a')](_0x2933e0[_0xd2bf('0x35')][_0xd2bf('0x3a')]));_0x225549[_0xd2bf('0x39')]=_0x225549[_0xd2bf('0x39')][_0xd2bf('0x3b')]?_0x225549[_0xd2bf('0x39')]:_0x201b95[_0xd2bf('0x34')];if(_0x2933e0['query'][_0xd2bf('0x4a')]){_0x225549[_0xd2bf('0x4b')]=[{'all':!![]}];}_0x225549=_[_0xd2bf('0x41')]({},_0x225549,_0x2933e0['options']);return db[_0xd2bf('0x30')][_0xd2bf('0x4c')](_0x225549)['then'](handleEntityNotFound(_0x2f4de7,null))['then'](respondWithResult(_0x2f4de7,null))[_0xd2bf('0x47')](handleError(_0x2f4de7,null));};exports[_0xd2bf('0x4d')]=function(_0x7d2b54,_0x4fcb3e){return db[_0xd2bf('0x30')][_0xd2bf('0x4d')](_0x7d2b54[_0xd2bf('0x4e')],{})[_0xd2bf('0x45')](function(_0x413a54){var _0x55c750=_0x7d2b54['user']['get']({'plain':!![]});if(!_0x55c750)throw new Error(_0xd2bf('0x4f'));if(_0x55c750['role']===_0xd2bf('0x50')){var _0x4a87fb=_0x413a54[_0xd2bf('0x51')]({'plain':!![]});var _0x5864c1=_0xd2bf('0x52');return db['UserProfileSection'][_0xd2bf('0x4c')]({'where':{'name':_0x5864c1,'userProfileId':_0x55c750[_0xd2bf('0x53')]},'raw':!![]})[_0xd2bf('0x45')](function(_0xb959cc){if(_0xb959cc&&_0xb959cc[_0xd2bf('0x54')]===0x0){return db[_0xd2bf('0x55')][_0xd2bf('0x4d')]({'name':_0x4a87fb[_0xd2bf('0x2c')],'resourceId':_0x4a87fb['id'],'type':_0xb959cc[_0xd2bf('0x2c')],'sectionId':_0xb959cc['id']},{})[_0xd2bf('0x45')](function(){return _0x413a54;});}else{return _0x413a54;}})[_0xd2bf('0x47')](function(_0x1ddb65){logger[_0xd2bf('0x2a')](_0xd2bf('0x56'),_0x1ddb65);throw _0x1ddb65;});}return _0x413a54;})[_0xd2bf('0x45')](respondWithResult(_0x4fcb3e,0xc9))['catch'](handleError(_0x4fcb3e,null));};exports[_0xd2bf('0x57')]=function(_0x14b762,_0x4b02d4){if(_0x14b762[_0xd2bf('0x4e')]['id']){delete _0x14b762['body']['id'];}return db[_0xd2bf('0x30')]['find']({'where':{'id':_0x14b762[_0xd2bf('0x48')]['id']}})[_0xd2bf('0x45')](handleEntityNotFound(_0x4b02d4,null))['then'](saveUpdates(_0x14b762[_0xd2bf('0x4e')],null))['then'](respondWithResult(_0x4b02d4,null))[_0xd2bf('0x47')](handleError(_0x4b02d4,null));};exports['destroy']=function(_0x4673ab,_0x4647bb){var _0x1a25d6=_0x4673ab[_0xd2bf('0x48')]['id'];var _0x2908b7=[];return db['sequelize'][_0xd2bf('0x58')](function(_0x2ef2bf){var _0x3cb1c9='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x1a25d6;return db[_0xd2bf('0x59')][_0xd2bf('0x35')](_0x3cb1c9,{'type':db[_0xd2bf('0x5a')][_0xd2bf('0x5b')][_0xd2bf('0x5c')],'raw':!![],'transaction':_0x2ef2bf})[_0xd2bf('0x45')](function(_0x4b86e0){_0x2908b7=_[_0xd2bf('0x2f')](_0x4b86e0,function(_0x14ba8d){return Number(_0x14ba8d[_0xd2bf('0x5d')]);});})[_0xd2bf('0x45')](function(){var _0x2dd778=_0xd2bf('0x5e')+_0x1a25d6;return db[_0xd2bf('0x59')][_0xd2bf('0x35')](_0x2dd778,{'type':db[_0xd2bf('0x5a')]['QueryTypes'][_0xd2bf('0x5c')],'raw':!![],'transaction':_0x2ef2bf});})[_0xd2bf('0x45')](function(_0x2bf9fd){var _0x1d8c70=_['map'](_0x2bf9fd,function(_0x1b0971){return Number(_0x1b0971[_0xd2bf('0x5f')]);});return db[_0xd2bf('0x60')][_0xd2bf('0x61')]({'where':{'UserId':{'$in':_0x2908b7},'VoiceQueueId':{'$in':_0x1d8c70}},'transaction':_0x2ef2bf});})[_0xd2bf('0x45')](function(){var _0x37241d=_0xd2bf('0x62')+_0x1a25d6;return db[_0xd2bf('0x59')][_0xd2bf('0x35')](_0x37241d,{'type':db['Sequelize'][_0xd2bf('0x5b')][_0xd2bf('0x5c')],'raw':!![],'transaction':_0x2ef2bf});})['then'](function(_0x2bc98a){var _0x41bd01=_[_0xd2bf('0x2f')](_0x2bc98a,function(_0x596475){return Number(_0x596475[_0xd2bf('0x63')]);});return db[_0xd2bf('0x64')]['destroy']({'where':{'UserId':{'$in':_0x2908b7},'MailQueueId':{'$in':_0x41bd01}},'transaction':_0x2ef2bf});})[_0xd2bf('0x45')](function(){var _0x35c50e=_0xd2bf('0x65')+_0x1a25d6;return db['sequelize']['query'](_0x35c50e,{'type':db['Sequelize'][_0xd2bf('0x5b')][_0xd2bf('0x5c')],'raw':!![],'transaction':_0x2ef2bf});})[_0xd2bf('0x45')](function(_0x2e4c2a){var _0x18b5c8=_[_0xd2bf('0x2f')](_0x2e4c2a,function(_0x3a9791){return Number(_0x3a9791[_0xd2bf('0x66')]);});return db[_0xd2bf('0x67')][_0xd2bf('0x61')]({'where':{'UserId':{'$in':_0x2908b7},'SmsQueueId':{'$in':_0x18b5c8}},'transaction':_0x2ef2bf});})['then'](function(){var _0x5d3feb=_0xd2bf('0x68')+_0x1a25d6;return db['sequelize'][_0xd2bf('0x35')](_0x5d3feb,{'type':db[_0xd2bf('0x5a')][_0xd2bf('0x5b')][_0xd2bf('0x5c')],'raw':!![],'transaction':_0x2ef2bf});})[_0xd2bf('0x45')](function(_0x11804d){var _0x11d7fd=_['map'](_0x11804d,function(_0x27b460){return Number(_0x27b460[_0xd2bf('0x69')]);});return db[_0xd2bf('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x2908b7},'ChatQueueId':{'$in':_0x11d7fd}},'transaction':_0x2ef2bf});})['then'](function(){var _0x3f58a1=_0xd2bf('0x6b')+_0x1a25d6;return db['sequelize'][_0xd2bf('0x35')](_0x3f58a1,{'type':db[_0xd2bf('0x5a')][_0xd2bf('0x5b')][_0xd2bf('0x5c')],'raw':!![],'transaction':_0x2ef2bf});})[_0xd2bf('0x45')](function(_0x11ef2e){var _0x28df40=_['map'](_0x11ef2e,function(_0xe7ee05){return Number(_0xe7ee05[_0xd2bf('0x6c')]);});return db[_0xd2bf('0x6d')][_0xd2bf('0x61')]({'where':{'UserId':{'$in':_0x2908b7},'FaxQueueId':{'$in':_0x28df40}},'transaction':_0x2ef2bf});})[_0xd2bf('0x45')](function(){var _0x4dcd85='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1a25d6;return db[_0xd2bf('0x59')][_0xd2bf('0x35')](_0x4dcd85,{'type':db[_0xd2bf('0x5a')][_0xd2bf('0x5b')][_0xd2bf('0x5c')],'raw':!![],'transaction':_0x2ef2bf});})[_0xd2bf('0x45')](function(_0x28549a){var _0x4321b5=_[_0xd2bf('0x2f')](_0x28549a,function(_0x392807){return Number(_0x392807[_0xd2bf('0x6e')]);});return db[_0xd2bf('0x6f')][_0xd2bf('0x61')]({'where':{'UserId':{'$in':_0x2908b7},'OpenchannelQueueId':{'$in':_0x4321b5}},'transaction':_0x2ef2bf});})[_0xd2bf('0x45')](function(){var _0x43d6d5=_0xd2bf('0x70')+_0x1a25d6;return db[_0xd2bf('0x59')][_0xd2bf('0x35')](_0x43d6d5,{'type':db['Sequelize'][_0xd2bf('0x5b')][_0xd2bf('0x5c')],'raw':!![],'transaction':_0x2ef2bf});})['then'](function(_0x12c292){var _0x92e993=_[_0xd2bf('0x2f')](_0x12c292,function(_0x3e9556){return Number(_0x3e9556[_0xd2bf('0x71')]);});return db[_0xd2bf('0x72')]['destroy']({'where':{'UserId':{'$in':_0x2908b7},'WhatsappQueueId':{'$in':_0x92e993}},'transaction':_0x2ef2bf});})[_0xd2bf('0x45')](function(){return db[_0xd2bf('0x73')]['find']({'where':{'TeamId':_0x1a25d6}});})['then'](function(_0x134f5f){if(_0x134f5f===null){return;}return db['UserVoicePrefix'][_0xd2bf('0x61')]({'where':{'UserId':{'$in':_0x2908b7},'VoicePrefixId':_0x134f5f[_0xd2bf('0x74')]},'transaction':_0x2ef2bf});})[_0xd2bf('0x45')](function(){return db[_0xd2bf('0x30')][_0xd2bf('0x61')]({'where':{'id':_0x1a25d6},'cascade':!![],'transaction':_0x2ef2bf});})[_0xd2bf('0x45')](function(_0x2e743d){if(_0x2e743d===0x0){_0x4647bb[_0xd2bf('0x20')](0x194);}else{return db[_0xd2bf('0x55')][_0xd2bf('0x61')]({'where':{'type':'Teams','resourceId':_0x1a25d6},'cascade':!![],'transaction':_0x2ef2bf})['then'](function(){_0x4647bb[_0xd2bf('0x21')](0xcc)[_0xd2bf('0x22')]();});}})[_0xd2bf('0x47')](function(_0x2a7899){_0x4647bb[_0xd2bf('0x21')](0x1f4)[_0xd2bf('0x2d')](_0x2a7899);});});};exports[_0xd2bf('0x75')]=function(_0x574bf9,_0xcadf9c,_0x4b79d6){return db[_0xd2bf('0x30')]['findOne']({'where':{'id':_0x574bf9[_0xd2bf('0x48')]['id']}})[_0xd2bf('0x45')](handleEntityNotFound(_0xcadf9c,null))[_0xd2bf('0x45')](function(_0x2d7682){if(!_0x574bf9[_0xd2bf('0x35')][_0xd2bf('0x76')]||!utils[_0xd2bf('0x77')](_0x574bf9['query'][_0xd2bf('0x76')])){throw new db[(_0xd2bf('0x5a'))][(_0xd2bf('0x78'))](_0xd2bf('0x79'));}var _0x24ab6a={};var _0x358d58={};_0x358d58[_0xd2bf('0x34')]=_[_0xd2bf('0x36')](db[_[_0xd2bf('0x7a')](_0x574bf9[_0xd2bf('0x35')][_0xd2bf('0x76')][_0xd2bf('0x7b')]())+_0xd2bf('0x7c')][_0xd2bf('0x49')]);_0x358d58[_0xd2bf('0x35')]=_[_0xd2bf('0x36')](_0x574bf9['query']);_0x358d58['filters']=_[_0xd2bf('0x38')](_0x358d58[_0xd2bf('0x34')],_0x358d58['query']);_0x24ab6a[_0xd2bf('0x39')]=_[_0xd2bf('0x38')](_0x358d58['model'],qs['fields'](_0x574bf9[_0xd2bf('0x35')]['fields']));_0x24ab6a[_0xd2bf('0x39')]=_0x24ab6a[_0xd2bf('0x39')][_0xd2bf('0x3b')]?_0x24ab6a[_0xd2bf('0x39')]:_0x358d58['model'];_0x24ab6a['limit']=qs['limit'](_0x574bf9[_0xd2bf('0x35')][_0xd2bf('0x27')]);_0x24ab6a[_0xd2bf('0x24')]=qs[_0xd2bf('0x24')](_0x574bf9[_0xd2bf('0x35')][_0xd2bf('0x24')]);_0x24ab6a[_0xd2bf('0x3e')]=qs[_0xd2bf('0x3f')](_0x574bf9[_0xd2bf('0x35')]['sort']);_0x24ab6a[_0xd2bf('0x40')]=qs[_0xd2bf('0x37')](_[_0xd2bf('0x7d')](_0x574bf9[_0xd2bf('0x35')],_0x358d58[_0xd2bf('0x37')]));_0x24ab6a=_[_0xd2bf('0x41')]({},_0x24ab6a,_0x574bf9[_0xd2bf('0x43')]);return _0x2d7682[_0xd2bf('0x51')+_[_0xd2bf('0x7a')](_0x574bf9[_0xd2bf('0x35')][_0xd2bf('0x76')]['toLowerCase']())+'Queues'](_0x24ab6a);})['then'](respondWithResult(_0xcadf9c,null))[_0xd2bf('0x47')](handleError(_0xcadf9c,null));};exports['addQueues']=function(_0x3a9930,_0x1c9ca5,_0x3cccc2){return db['Team'][_0xd2bf('0x7e')]({'where':{'id':_0x3a9930[_0xd2bf('0x48')]['id']}})[_0xd2bf('0x45')](function(_0x28ea4c){if(_0x28ea4c){if(!_0x3a9930[_0xd2bf('0x4e')]['channel']||!utils['isValidChannel'](_0x3a9930['body']['channel'])){throw new db[(_0xd2bf('0x5a'))][(_0xd2bf('0x78'))](_0xd2bf('0x79'));}return _0x28ea4c['add'+_[_0xd2bf('0x7a')](_0x3a9930[_0xd2bf('0x4e')]['channel'][_0xd2bf('0x7b')]())+_0xd2bf('0x7f')](_0x3a9930[_0xd2bf('0x4e')][_0xd2bf('0x80')]);}return null;})['then'](handleEntityNotFound(_0x1c9ca5,null))['then'](respondWithStatusCode(_0x1c9ca5,null))[_0xd2bf('0x47')](handleError(_0x1c9ca5,null));};exports['removeQueues']=function(_0x4b28b,_0x1c0216,_0x2dee97){return db[_0xd2bf('0x30')][_0xd2bf('0x7e')]({'where':{'id':_0x4b28b[_0xd2bf('0x48')]['id']}})[_0xd2bf('0x45')](function(_0x457eab){if(_0x457eab){if(!_0x4b28b['query'][_0xd2bf('0x76')]||!utils['isValidChannel'](_0x4b28b['query']['channel'])){throw new db[(_0xd2bf('0x5a'))]['ValidationError']('Unknown\x20channel');}return _0x457eab['remove'+_[_0xd2bf('0x7a')](_0x4b28b[_0xd2bf('0x35')][_0xd2bf('0x76')][_0xd2bf('0x7b')]())+_0xd2bf('0x7f')](_0x4b28b['query'][_0xd2bf('0x80')]);}return null;})[_0xd2bf('0x45')](handleEntityNotFound(_0x1c0216,null))[_0xd2bf('0x45')](respondWithStatusCode(_0x1c0216,null))[_0xd2bf('0x47')](handleError(_0x1c0216,null));};exports['addAgents']=function(_0x1e5b75,_0x80e576){var _0x4376db=_[_0xd2bf('0x81')](_0x1e5b75[_0xd2bf('0x4e')]['ids'])?_0x1e5b75['body'][_0xd2bf('0x80')]:[_0x1e5b75['body']['ids']];var _0xc1ef0=_0x1e5b75[_0xd2bf('0x48')]['id'];return db[_0xd2bf('0x30')][_0xd2bf('0x4c')]({'where':{'id':_0xc1ef0}})['then'](handleEntityNotFound(_0x80e576,null))['then'](function(_0x49d53a){if(_0x49d53a){var _0x241fa3=[_0xd2bf('0x82'),'Chat',_0xd2bf('0x83'),_0xd2bf('0x84'),_0xd2bf('0x85'),_0xd2bf('0x86'),_0xd2bf('0x87')];return db['sequelize']['transaction'](function(_0x1c7e91){var _0xe5453a=_['map'](_0x241fa3,function(_0x3ea324){var _0x58ba1e={'attributes':['id','name']};if(_0x3ea324===_0xd2bf('0x82')){_0x58ba1e[_0xd2bf('0x88')]={'attributes':[_0xd2bf('0x89')]};}return _0x49d53a['get'+_0x3ea324+_0xd2bf('0x7f')](_0x58ba1e)['then'](function(_0x2aaf9c){var _0xa728f3=_['map'](_0x2aaf9c,function(_0x54cc05){var _0x46f183=_[_0xd2bf('0x2f')](_0x4376db,function(_0x21db72){var _0x2433c8={'where':{'UserId':_0x21db72,[_0x3ea324+_0xd2bf('0x8a')]:_0x54cc05['id']},'transaction':_0x1c7e91};if(_0x3ea324===_0xd2bf('0x82')){_0x2433c8[_0xd2bf('0x1c')]={'penalty':_0x54cc05['TeamVoiceQueue'][_0xd2bf('0x89')]};}return db[_0xd2bf('0x8b')+_0x3ea324+_0xd2bf('0x7c')][_0xd2bf('0x8c')](_0x2433c8)[_0xd2bf('0x45')](function(){socket[_0xd2bf('0x8d')](_0xd2bf('0x50')+_0x3ea324+_0xd2bf('0x8e'),{'UserId':_0x21db72,[_0x3ea324+_0xd2bf('0x8a')]:_0x54cc05['id']});if(_0x3ea324!=='Voice'){return;}return db[_0xd2bf('0x8b')][_0xd2bf('0x44')]({'where':{'id':_0x4376db,'online':0x1},'attributes':['id',_0xd2bf('0x2c'),_0xd2bf('0x8f'),_0xd2bf('0x90'),_0xd2bf('0x91')],'raw':!![]})['then'](function(_0x415488){var _0x90aa3f=_[_0xd2bf('0x2f')](_0x415488,function(_0x2d8a6b){return db['UserVoiceQueueRt'][_0xd2bf('0x92')]({'membername':_0x2d8a6b['name'],'UserId':_0x2d8a6b['id'],'queue_name':_0x54cc05[_0xd2bf('0x2c')],'VoiceQueueId':_0x54cc05['id'],'interface':_['isNil'](_0x2d8a6b[_0xd2bf('0x91')])?util['format'](_0xd2bf('0x93'),_0x2d8a6b[_0xd2bf('0x2c')]):_0x2d8a6b[_0xd2bf('0x91')],'paused':_0x2d8a6b[_0xd2bf('0x90')]||![],'penalty':_0x54cc05['TeamVoiceQueue']['penalty']},{'transaction':_0x1c7e91});});return Promise[_0xd2bf('0x94')](_0x90aa3f);});});});return Promise[_0xd2bf('0x94')](_0x46f183);});return Promise[_0xd2bf('0x94')](_0xa728f3);})[_0xd2bf('0x45')](function(){return db['TeamVoicePrefix'][_0xd2bf('0x7e')]({'where':{'teamId':_0xc1ef0}})['then'](function(_0x4fbd80){if(_0x4fbd80){var _0x154e25=_['map'](_0x4376db,function(_0x46527d){db[_0xd2bf('0x95')][_0xd2bf('0x92')]({'UserId':_0x46527d,'VoicePrefixId':_0x4fbd80[_0xd2bf('0x74')]});});return Promise['all'](_0x154e25);}});});});return Promise[_0xd2bf('0x94')](_0xe5453a)[_0xd2bf('0x45')](function(){return _0x49d53a[_0xd2bf('0x96')](_0x4376db,{'transaction':_0x1c7e91})[_0xd2bf('0x97')](function(_0x7eff2a){return _0x7eff2a;});});});}})[_0xd2bf('0x45')](respondWithResult(_0x80e576,null))[_0xd2bf('0x47')](handleError(_0x80e576,null));};exports[_0xd2bf('0x98')]=function(_0xee7b2,_0x1603a2){var _0x1ef7c5=_[_0xd2bf('0x81')](_0xee7b2['query']['ids'])?_0xee7b2[_0xd2bf('0x35')][_0xd2bf('0x80')]:[_0xee7b2[_0xd2bf('0x35')]['ids']];var _0x56d77b=_0xee7b2['params']['id'];return db['Team'][_0xd2bf('0x4c')]({'where':{'id':_0x56d77b}})['then'](handleEntityNotFound(_0x1603a2,null))[_0xd2bf('0x45')](function(_0x24f2e3){if(_0x24f2e3){var _0xdf28e5=[_0xd2bf('0x82'),'Chat',_0xd2bf('0x83'),'Sms',_0xd2bf('0x85'),_0xd2bf('0x86'),_0xd2bf('0x87')];return db[_0xd2bf('0x59')][_0xd2bf('0x58')](function(_0x324b7){var _0x417449=_[_0xd2bf('0x2f')](_0xdf28e5,function(_0x4e923a){var _0x4d0d3c={'attributes':['id',_0xd2bf('0x2c')]};return _0x24f2e3[_0xd2bf('0x51')+_0x4e923a+_0xd2bf('0x7f')](_0x4d0d3c)[_0xd2bf('0x45')](function(_0x3e0006){var _0x201fe1=_[_0xd2bf('0x2f')](_0x3e0006,function(_0x3a25a8){return _0x3a25a8['removeAgents'](_0x1ef7c5,{'transaction':_0x324b7})[_0xd2bf('0x45')](function(){var _0x29c28c=_[_0xd2bf('0x2f')](_0x1ef7c5,function(_0xeb03a1){socket[_0xd2bf('0x8d')](_0xd2bf('0x50')+_0x4e923a+_0xd2bf('0x99'),{'UserId':Number(_0xeb03a1),[_0x4e923a+_0xd2bf('0x8a')]:_0x3a25a8['id']});if(_0x4e923a!==_0xd2bf('0x82')){return;}return db['UserVoiceQueueRt'][_0xd2bf('0x61')]({'where':{'VoiceQueueId':_0x3a25a8['id'],'UserId':_0xeb03a1},'transaction':_0x324b7});});return Promise[_0xd2bf('0x94')](_0x29c28c);});});return Promise[_0xd2bf('0x94')](_0x201fe1);});});return Promise[_0xd2bf('0x94')](_0x417449)[_0xd2bf('0x45')](function(){return _0x24f2e3[_0xd2bf('0x98')](_0x1ef7c5,{'transaction':_0x324b7});})[_0xd2bf('0x45')](function(){return db[_0xd2bf('0x73')][_0xd2bf('0x7e')]({'where':{'teamId':_0x56d77b}})['then'](function(_0x37fd8b){if(_0x37fd8b){var _0x18c139=_[_0xd2bf('0x2f')](_0x1ef7c5,function(_0x31b99c){db[_0xd2bf('0x95')]['destroy']({'where':{'UserId':_0x31b99c,'VoicePrefixId':_0x37fd8b[_0xd2bf('0x74')]}});});return Promise['all'](_0x18c139);}});});});}})[_0xd2bf('0x45')](respondWithStatusCode(_0x1603a2,null))[_0xd2bf('0x47')](handleError(_0x1603a2,null));};exports[_0xd2bf('0x9a')]=function(_0x53926a,_0x3b997a,_0x420d0a){var _0x290d66={};var _0x2738fd={};var _0x4b6dea;var _0x1f9ac8;return db[_0xd2bf('0x30')]['findOne']({'where':{'id':_0x53926a[_0xd2bf('0x48')]['id']}})[_0xd2bf('0x45')](handleEntityNotFound(_0x3b997a,null))[_0xd2bf('0x45')](function(_0x197a78){if(_0x197a78){_0x4b6dea=_0x197a78;_0x2738fd['model']=_[_0xd2bf('0x36')](db[_0xd2bf('0x8b')][_0xd2bf('0x49')]);_0x2738fd['query']=_[_0xd2bf('0x36')](_0x53926a['query']);_0x2738fd[_0xd2bf('0x37')]=_['intersection'](_0x2738fd['model'],_0x2738fd[_0xd2bf('0x35')]);_0x290d66['attributes']=_[_0xd2bf('0x38')](_0x2738fd[_0xd2bf('0x34')],qs[_0xd2bf('0x3a')](_0x53926a[_0xd2bf('0x35')][_0xd2bf('0x3a')]));_0x290d66[_0xd2bf('0x39')]=_0x290d66[_0xd2bf('0x39')][_0xd2bf('0x3b')]?_0x290d66[_0xd2bf('0x39')]:_0x2738fd[_0xd2bf('0x34')];_0x290d66['order']=qs[_0xd2bf('0x3f')](_0x53926a[_0xd2bf('0x35')]['sort']);_0x290d66[_0xd2bf('0x40')]=qs[_0xd2bf('0x37')](_['pick'](_0x53926a[_0xd2bf('0x35')],_0x2738fd[_0xd2bf('0x37')]));if(_0x53926a[_0xd2bf('0x35')][_0xd2bf('0x42')]){_0x290d66['where']=_['merge'](_0x290d66['where'],{'$or':_['map'](_0x290d66[_0xd2bf('0x39')],function(_0x55de5b){var _0x4a701f={};_0x4a701f[_0x55de5b]={'$like':'%'+_0x53926a[_0xd2bf('0x35')][_0xd2bf('0x42')]+'%'};return _0x4a701f;})});}_0x290d66=_[_0xd2bf('0x41')]({},_0x290d66,_0x53926a['options']);return _0x4b6dea[_0xd2bf('0x9a')](_0x290d66);}})[_0xd2bf('0x45')](function(_0x5cd964){if(_0x5cd964){_0x1f9ac8=_0x5cd964['length'];if(!_0x53926a[_0xd2bf('0x35')][_0xd2bf('0x3c')](_0xd2bf('0x3d'))){_0x290d66[_0xd2bf('0x27')]=qs[_0xd2bf('0x27')](_0x53926a[_0xd2bf('0x35')][_0xd2bf('0x27')]);_0x290d66[_0xd2bf('0x24')]=qs[_0xd2bf('0x24')](_0x53926a[_0xd2bf('0x35')][_0xd2bf('0x24')]);}return _0x4b6dea[_0xd2bf('0x9a')](_0x290d66);}})['then'](function(_0x2485be){if(_0x2485be){return _0x2485be?{'count':_0x1f9ac8,'rows':_0x2485be}:null;}})[_0xd2bf('0x45')](respondWithResult(_0x3b997a,null))[_0xd2bf('0x47')](handleError(_0x3b997a,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 0960220..6e1a754 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 _0x5e8b=['Team','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x5976f8,_0x1265b7){var _0x179715=function(_0x2b2c4b){while(--_0x2b2c4b){_0x5976f8['push'](_0x5976f8['shift']());}};_0x179715(++_0x1265b7);}(_0x5e8b,0x110));var _0xb5e8=function(_0x19f454,_0x2504e8){_0x19f454=_0x19f454-0x0;var _0x5cf1dd=_0x5e8b[_0x19f454];return _0x5cf1dd;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0xb5e8('0x0')];var TeamEvents=new EventEmitter();TeamEvents[_0xb5e8('0x1')](0x0);var events={'afterCreate':_0xb5e8('0x2'),'afterUpdate':_0xb5e8('0x3'),'afterDestroy':_0xb5e8('0x4')};function emitEvent(_0x544bc3){return function(_0x480f13,_0x2ad1ba,_0x2795c5){TeamEvents[_0xb5e8('0x5')](_0x544bc3+':'+_0x480f13['id'],_0x480f13);TeamEvents['emit'](_0x544bc3,_0x480f13);_0x2795c5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xb5e8('0x6')](e,emitEvent(event));}}module[_0xb5e8('0x7')]=TeamEvents; \ No newline at end of file +var _0xaa60=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','Team','save'];(function(_0x2f79ab,_0x177978){var _0x22d41c=function(_0xbe5b7b){while(--_0xbe5b7b){_0x2f79ab['push'](_0x2f79ab['shift']());}};_0x22d41c(++_0x177978);}(_0xaa60,0x10a));var _0x0aa6=function(_0x2718ff,_0x1c96be){_0x2718ff=_0x2718ff-0x0;var _0x35a031=_0xaa60[_0x2718ff];return _0x35a031;};'use strict';var EventEmitter=require(_0x0aa6('0x0'));var Team=require(_0x0aa6('0x1'))['db'][_0x0aa6('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0aa6('0x3'),'afterUpdate':_0x0aa6('0x4'),'afterDestroy':_0x0aa6('0x5')};function emitEvent(_0x3e6806){return function(_0xe58ae0,_0x11a37c,_0x2e4d36){TeamEvents['emit'](_0x3e6806+':'+_0xe58ae0['id'],_0xe58ae0);TeamEvents[_0x0aa6('0x6')](_0x3e6806,_0xe58ae0);_0x2e4d36(null);};}for(var e in events){if(events[_0x0aa6('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x0aa6('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 b9902e5..121aefb 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 _0xe6dc=['Whatsapp','then','all','catch','./team.attributes','Queues','map','setDataValue','channel','exports','Team','teams','Sms','Voice'];(function(_0x18c30f,_0x22477f){var _0x42452a=function(_0xa73709){while(--_0xa73709){_0x18c30f['push'](_0x18c30f['shift']());}};_0x42452a(++_0x22477f);}(_0xe6dc,0x1ee));var _0xce6d=function(_0x476d51,_0x10d34a){_0x476d51=_0x476d51-0x0;var _0x154623=_0xe6dc[_0x476d51];return _0x154623;};'use strict';var _=require('lodash');var attributes=require(_0xce6d('0x0'));function getQueuesByChannel(_0x4bf14e,_0x20bc66){var _0x195f88='get'+_0x20bc66+_0xce6d('0x1');return _0x4bf14e[_0x195f88]()['then'](function(_0xad9466){return _[_0xce6d('0x2')](_0xad9466,function(_0x18d53f){_0x18d53f[_0xce6d('0x3')](_0xce6d('0x4'),_0x20bc66);return _0x18d53f;});})['catch'](function(_0x30f2fa){throw _0x30f2fa;});}module[_0xce6d('0x5')]=function(_0x2c3f60){return _0x2c3f60['define'](_0xce6d('0x6'),attributes,{'tableName':_0xce6d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x397855=this;var _0x1217bd=['Chat','Fax','Mail','Openchannel',_0xce6d('0x8'),_0xce6d('0x9'),_0xce6d('0xa')];return Promise['resolve']()[_0xce6d('0xb')](function(){var _0x336d66=_[_0xce6d('0x2')](_0x1217bd,function(_0x532eec){return getQueuesByChannel(_0x397855,_0x532eec);});return Promise[_0xce6d('0xc')](_0x336d66);})[_0xce6d('0xd')](function(_0x1e723e){throw _0x1e723e;});}}});}; \ No newline at end of file +var _0xfc1b=['lodash','get','then','map','setDataValue','channel','catch','exports','define','Team','teams','Fax','Mail','Sms','Whatsapp','resolve'];(function(_0x5cc51f,_0x22c480){var _0x315a2f=function(_0x4f93bd){while(--_0x4f93bd){_0x5cc51f['push'](_0x5cc51f['shift']());}};_0x315a2f(++_0x22c480);}(_0xfc1b,0x160));var _0xbfc1=function(_0x394336,_0x5ea2f0){_0x394336=_0x394336-0x0;var _0x30d14a=_0xfc1b[_0x394336];return _0x30d14a;};'use strict';var _=require(_0xbfc1('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0xa8cac6,_0x390887){var _0x3184f3=_0xbfc1('0x1')+_0x390887+'Queues';return _0xa8cac6[_0x3184f3]()[_0xbfc1('0x2')](function(_0x1b2e0a){return _[_0xbfc1('0x3')](_0x1b2e0a,function(_0x86c53b){_0x86c53b[_0xbfc1('0x4')](_0xbfc1('0x5'),_0x390887);return _0x86c53b;});})[_0xbfc1('0x6')](function(_0x59c191){throw _0x59c191;});}module[_0xbfc1('0x7')]=function(_0x2d29f2){return _0x2d29f2[_0xbfc1('0x8')](_0xbfc1('0x9'),attributes,{'tableName':_0xbfc1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x402c37=this;var _0x3a092f=['Chat',_0xbfc1('0xb'),_0xbfc1('0xc'),'Openchannel',_0xbfc1('0xd'),'Voice',_0xbfc1('0xe')];return Promise[_0xbfc1('0xf')]()[_0xbfc1('0x2')](function(){var _0x4608f5=_[_0xbfc1('0x3')](_0x3a092f,function(_0x18b5cc){return getQueuesByChannel(_0x402c37,_0x18b5cc);});return Promise['all'](_0x4608f5);})[_0xbfc1('0x6')](function(_0x58eb81){throw _0x58eb81;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index ffce0e1..b026244 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 _0x3563=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util'];(function(_0x1c510a,_0x1413a9){var _0x23cedd=function(_0x3f3e43){while(--_0x3f3e43){_0x1c510a['push'](_0x1c510a['shift']());}};_0x23cedd(++_0x1413a9);}(_0x3563,0xf6));var _0x3356=function(_0x3d7959,_0x180c1c){_0x3d7959=_0x3d7959-0x0;var _0x4fffa0=_0x3563[_0x3d7959];return _0x4fffa0;};'use strict';var _=require(_0x3356('0x0'));var util=require(_0x3356('0x1'));var moment=require(_0x3356('0x2'));var BPromise=require(_0x3356('0x3'));var rs=require(_0x3356('0x4'));var fs=require('fs');var Redis=require(_0x3356('0x5'));var db=require(_0x3356('0x6'))['db'];var utils=require(_0x3356('0x7'));var logger=require('../../config/logger')(_0x3356('0x8'));var config=require(_0x3356('0x9'));var jayson=require(_0x3356('0xa'));var client=jayson[_0x3356('0xb')][_0x3356('0xc')]({'port':0x232a});config[_0x3356('0xd')]=_[_0x3356('0xe')](config[_0x3356('0xd')],{'host':_0x3356('0xf'),'port':0x18eb});var socket=require(_0x3356('0x10'))(new Redis(config[_0x3356('0xd')]));require(_0x3356('0x11'))[_0x3356('0x12')](socket);function respondWithRpcPromise(_0x537659,_0x3ec5fa,_0x4dd3fe){return new BPromise(function(_0x291240,_0x5785d3){return client['request'](_0x537659,_0x4dd3fe)[_0x3356('0x13')](function(_0x18af7d){logger[_0x3356('0x14')](_0x3356('0x15'),_0x3ec5fa,_0x3356('0x16'));logger[_0x3356('0x17')](_0x3356('0x18'),_0x3ec5fa,_0x3356('0x16'),JSON[_0x3356('0x19')](_0x18af7d));if(_0x18af7d['error']){if(_0x18af7d['error'][_0x3356('0x1a')]===0x1f4){logger[_0x3356('0x1b')](_0x3356('0x15'),_0x3ec5fa,_0x18af7d[_0x3356('0x1b')][_0x3356('0x1c')]);return _0x5785d3(_0x18af7d['error'][_0x3356('0x1c')]);}logger[_0x3356('0x1b')]('Team,\x20%s,\x20%s',_0x3ec5fa,_0x18af7d[_0x3356('0x1b')][_0x3356('0x1c')]);return _0x291240(_0x18af7d['error']['message']);}else{logger[_0x3356('0x14')]('Team,\x20%s,\x20%s',_0x3ec5fa,_0x3356('0x16'));_0x291240(_0x18af7d[_0x3356('0x1d')][_0x3356('0x1c')]);}})[_0x3356('0x1e')](function(_0x5a18a4){logger[_0x3356('0x1b')](_0x3356('0x15'),_0x3ec5fa,_0x5a18a4);_0x5785d3(_0x5a18a4);});});} \ No newline at end of file +var _0x7c17=['Team,\x20%s,\x20%s,\x20%s','stringify','error','message','Team,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','defaults','localhost','register','info','request\x20sent','debug'];(function(_0x1df473,_0x1a6931){var _0x1bdd49=function(_0x519be6){while(--_0x519be6){_0x1df473['push'](_0x1df473['shift']());}};_0x1bdd49(++_0x1a6931);}(_0x7c17,0x149));var _0x77c1=function(_0x1eaf5f,_0x3b8f31){_0x1eaf5f=_0x1eaf5f-0x0;var _0x4dec35=_0x7c17[_0x1eaf5f];return _0x4dec35;};'use strict';var _=require(_0x77c1('0x0'));var util=require(_0x77c1('0x1'));var moment=require(_0x77c1('0x2'));var BPromise=require(_0x77c1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x77c1('0x4'))['db'];var utils=require(_0x77c1('0x5'));var logger=require('../../config/logger')(_0x77c1('0x6'));var config=require(_0x77c1('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x77c1('0x8')]({'port':0x232a});config[_0x77c1('0x9')]=_[_0x77c1('0xa')](config[_0x77c1('0x9')],{'host':_0x77c1('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x77c1('0x9')]));require('./team.socket')[_0x77c1('0xc')](socket);function respondWithRpcPromise(_0x23c393,_0x1df874,_0x293489){return new BPromise(function(_0x4fb51a,_0x54884f){return client['request'](_0x23c393,_0x293489)['then'](function(_0x5ed264){logger[_0x77c1('0xd')]('Team,\x20%s,\x20%s',_0x1df874,_0x77c1('0xe'));logger[_0x77c1('0xf')](_0x77c1('0x10'),_0x1df874,'request\x20sent',JSON[_0x77c1('0x11')](_0x5ed264));if(_0x5ed264['error']){if(_0x5ed264[_0x77c1('0x12')]['code']===0x1f4){logger[_0x77c1('0x12')]('Team,\x20%s,\x20%s',_0x1df874,_0x5ed264[_0x77c1('0x12')][_0x77c1('0x13')]);return _0x54884f(_0x5ed264['error'][_0x77c1('0x13')]);}logger[_0x77c1('0x12')](_0x77c1('0x14'),_0x1df874,_0x5ed264[_0x77c1('0x12')][_0x77c1('0x13')]);return _0x4fb51a(_0x5ed264[_0x77c1('0x12')][_0x77c1('0x13')]);}else{logger['info'](_0x77c1('0x14'),_0x1df874,'request\x20sent');_0x4fb51a(_0x5ed264[_0x77c1('0x15')][_0x77c1('0x13')]);}})[_0x77c1('0x16')](function(_0x353bb5){logger[_0x77c1('0x12')](_0x77c1('0x14'),_0x1df874,_0x353bb5);_0x54884f(_0x353bb5);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index e04f9ba..0cc7a8f 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 _0x52fc=['save','remove','emit','register','team:','./team.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x52fc,0xc5));var _0xc52f=function(_0x507e03,_0x20aaf7){_0x507e03=_0x507e03-0x0;var _0xa13f3e=_0x52fc[_0x507e03];return _0xa13f3e;};'use strict';var TeamEvents=require(_0xc52f('0x0'));var events=[_0xc52f('0x1'),_0xc52f('0x2'),'update'];function createListener(_0x541bb1,_0x684b9c){return function(_0x27140e){_0x684b9c[_0xc52f('0x3')](_0x541bb1,_0x27140e);};}function removeListener(_0x5a55a8,_0x59ab69){return function(){TeamEvents['removeListener'](_0x5a55a8,_0x59ab69);};}exports[_0xc52f('0x4')]=function(_0x23f51d){for(var _0x1b3b6c=0x0,_0x523425=events['length'];_0x1b3b6c<_0x523425;_0x1b3b6c++){var _0x4db523=events[_0x1b3b6c];var _0x4c73c8=createListener(_0xc52f('0x5')+_0x4db523,_0x23f51d);TeamEvents['on'](_0x4db523,_0x4c73c8);}}; \ No newline at end of file +var _0xa74b=['./team.events','save','register','length','team:'];(function(_0xe54c9b,_0x29f219){var _0x3724b1=function(_0x29e599){while(--_0x29e599){_0xe54c9b['push'](_0xe54c9b['shift']());}};_0x3724b1(++_0x29f219);}(_0xa74b,0x140));var _0xba74=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xa74b[_0x59ee6f];return _0x4c0979;};'use strict';var TeamEvents=require(_0xba74('0x0'));var events=[_0xba74('0x1'),'remove','update'];function createListener(_0x590c52,_0x5c501b){return function(_0xeee0f4){_0x5c501b['emit'](_0x590c52,_0xeee0f4);};}function removeListener(_0x35ef86,_0x6b6b00){return function(){TeamEvents['removeListener'](_0x35ef86,_0x6b6b00);};}exports[_0xba74('0x2')]=function(_0x166929){for(var _0x2b96fe=0x0,_0x36779c=events[_0xba74('0x3')];_0x2b96fe<_0x36779c;_0x2b96fe++){var _0x38b2fe=events[_0x2b96fe];var _0x3077e7=createListener(_0xba74('0x4')+_0x38b2fe,_0x166929);TeamEvents['on'](_0x38b2fe,_0x3077e7);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index f75d4e6..d25d495 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 _0xa900=['exports','INTEGER','sequelize'];(function(_0x28b9e3,_0x5d637d){var _0x2bb425=function(_0x57e290){while(--_0x57e290){_0x28b9e3['push'](_0x28b9e3['shift']());}};_0x2bb425(++_0x5d637d);}(_0xa900,0x101));var _0x0a90=function(_0x24b33c,_0x33cb97){_0x24b33c=_0x24b33c-0x0;var _0x33becf=_0xa900[_0x24b33c];return _0x33becf;};'use strict';var Sequelize=require(_0x0a90('0x0'));module[_0x0a90('0x1')]={'TeamId':{'type':Sequelize[_0x0a90('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x0a90('0x2')]}}; \ No newline at end of file +var _0xf39b=['INTEGER','sequelize','exports'];(function(_0x3d9349,_0x25f417){var _0x3caa40=function(_0x3bf438){while(--_0x3bf438){_0x3d9349['push'](_0x3d9349['shift']());}};_0x3caa40(++_0x25f417);}(_0xf39b,0x100));var _0xbf39=function(_0x37e2fb,_0x80dc0){_0x37e2fb=_0x37e2fb-0x0;var _0x392d2d=_0xf39b[_0x37e2fb];return _0x392d2d;};'use strict';var Sequelize=require(_0xbf39('0x0'));module[_0xbf39('0x1')]={'TeamId':{'type':Sequelize[_0xbf39('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 28b3d67..0f13933 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 _0x3423=['TeamVoicePrefix','team_has_voice_prefixes','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define'];(function(_0x296fb6,_0x569ebf){var _0x1baf04=function(_0x4d4a7f){while(--_0x4d4a7f){_0x296fb6['push'](_0x296fb6['shift']());}};_0x1baf04(++_0x569ebf);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3342('0x0'))(_0x3342('0x1'));var moment=require(_0x3342('0x2'));var BPromise=require(_0x3342('0x3'));var rp=require(_0x3342('0x4'));var fs=require('fs');var path=require(_0x3342('0x5'));var rimraf=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var attributes=require(_0x3342('0x8'));module[_0x3342('0x9')]=function(_0x467453,_0x2ccbe0){return _0x467453[_0x3342('0xa')](_0x3342('0xb'),attributes,{'tableName':_0x3342('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf089=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','exports','define','team_has_voice_prefixes','util'];(function(_0x404132,_0x57de0c){var _0x5b3bdb=function(_0x222a38){while(--_0x222a38){_0x404132['push'](_0x404132['shift']());}};_0x5b3bdb(++_0x57de0c);}(_0xf089,0xba));var _0x9f08=function(_0x5600f4,_0x542d94){_0x5600f4=_0x5600f4-0x0;var _0x3160d6=_0xf089[_0x5600f4];return _0x3160d6;};'use strict';var _=require('lodash');var util=require(_0x9f08('0x0'));var logger=require(_0x9f08('0x1'))('api');var moment=require(_0x9f08('0x2'));var BPromise=require(_0x9f08('0x3'));var rp=require(_0x9f08('0x4'));var fs=require('fs');var path=require(_0x9f08('0x5'));var rimraf=require('rimraf');var config=require(_0x9f08('0x6'));var attributes=require(_0x9f08('0x7'));module[_0x9f08('0x8')]=function(_0x13768c,_0x38c9ea){return _0x13768c[_0x9f08('0x9')]('TeamVoicePrefix',attributes,{'tableName':_0x9f08('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index cfbbb6c..db9f1df 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x35ed10,_0x4e20be){var _0x23c2e2=function(_0x312961){while(--_0x312961){_0x35ed10['push'](_0x35ed10['shift']());}};_0x23c2e2(++_0x4e20be);}(_0x70e0,0x17b));var _0x070e=function(_0x43ae5f,_0x48a279){_0x43ae5f=_0x43ae5f-0x0;var _0x3174a4=_0x70e0[_0x43ae5f];return _0x3174a4;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xd370ad,_0x503878){var _0x3ee1e5=function(_0x3ddd00){while(--_0x3ddd00){_0xd370ad['push'](_0xd370ad['shift']());}};_0x3ee1e5(++_0x503878);}(_0xe706,0xa3));var _0x6e70=function(_0x562456,_0x9ad741){_0x562456=_0x562456-0x0;var _0x46d4a9=_0xe706[_0x562456];return _0x46d4a9;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 4acdb4d..34bc96d 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 _0xa3cf=['exports','INTEGER'];(function(_0x42675a,_0x49294b){var _0x24f052=function(_0x1bb040){while(--_0x1bb040){_0x42675a['push'](_0x42675a['shift']());}};_0x24f052(++_0x49294b);}(_0xa3cf,0xfa));var _0xfa3c=function(_0x59549a,_0x439167){_0x59549a=_0x59549a-0x0;var _0x234aa2=_0xa3cf[_0x59549a];return _0x234aa2;};'use strict';var Sequelize=require('sequelize');module[_0xfa3c('0x0')]={'penalty':{'type':Sequelize[_0xfa3c('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3ed8=['sequelize','exports','INTEGER'];(function(_0x58b665,_0x681401){var _0x47edd0=function(_0x18648f){while(--_0x18648f){_0x58b665['push'](_0x58b665['shift']());}};_0x47edd0(++_0x681401);}(_0x3ed8,0x17d));var _0x83ed=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0x3ed8[_0x5eb22e];return _0x27fed5;};'use strict';var Sequelize=require(_0x83ed('0x0'));module[_0x83ed('0x1')]={'penalty':{'type':Sequelize[_0x83ed('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 05c47a2..2cf999f 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 _0x765b=['rimraf','../../config/environment','define','team_has_voice_queues','api','bluebird','path'];(function(_0x50082f,_0x385e89){var _0x3a8c5a=function(_0xb9149a){while(--_0xb9149a){_0x50082f['push'](_0x50082f['shift']());}};_0x3a8c5a(++_0x385e89);}(_0x765b,0x18c));var _0xb765=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0x765b[_0x2c0dc0];return _0x4c0990;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb765('0x0'));var moment=require('moment');var BPromise=require(_0xb765('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb765('0x2'));var rimraf=require(_0xb765('0x3'));var config=require(_0xb765('0x4'));var attributes=require('./teamVoiceQueue.attributes');module['exports']=function(_0x58195b,_0x5441a3){return _0x58195b[_0xb765('0x5')]('TeamVoiceQueue',attributes,{'tableName':_0xb765('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba47=['bluebird','request-promise','path','../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','moment'];(function(_0x31b5a5,_0x44376a){var _0x364cc9=function(_0x4e5f95){while(--_0x4e5f95){_0x31b5a5['push'](_0x31b5a5['shift']());}};_0x364cc9(++_0x44376a);}(_0xba47,0x1ac));var _0x7ba4=function(_0x38cabe,_0x1c5929){_0x38cabe=_0x38cabe-0x0;var _0x5487ec=_0xba47[_0x38cabe];return _0x5487ec;};'use strict';var _=require(_0x7ba4('0x0'));var util=require(_0x7ba4('0x1'));var logger=require(_0x7ba4('0x2'))('api');var moment=require(_0x7ba4('0x3'));var BPromise=require(_0x7ba4('0x4'));var rp=require(_0x7ba4('0x5'));var fs=require('fs');var path=require(_0x7ba4('0x6'));var rimraf=require('rimraf');var config=require(_0x7ba4('0x7'));var attributes=require(_0x7ba4('0x8'));module['exports']=function(_0x4f8c2d,_0x565107){return _0x4f8c2d[_0x7ba4('0x9')](_0x7ba4('0xa'),attributes,{'tableName':_0x7ba4('0xb'),'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 482332f..fbee451 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 _0x6460=['client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x2a2b2b,_0x524547){var _0x8ac446=function(_0x192b09){while(--_0x192b09){_0x2a2b2b['push'](_0x2a2b2b['shift']());}};_0x8ac446(++_0x524547);}(_0x6460,0x158));var _0x0646=function(_0x484d8a,_0x152f58){_0x484d8a=_0x484d8a-0x0;var _0x1ea628=_0x6460[_0x484d8a];return _0x1ea628;};'use strict';var _=require('lodash');var util=require(_0x0646('0x0'));var moment=require(_0x0646('0x1'));var BPromise=require('bluebird');var rs=require(_0x0646('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0646('0x3'))['db'];var utils=require(_0x0646('0x4'));var logger=require('../../config/logger')(_0x0646('0x5'));var config=require(_0x0646('0x6'));var jayson=require(_0x0646('0x7'));var client=jayson[_0x0646('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38d655,_0xbc6a7a,_0x1789cd){return new BPromise(function(_0x4ce914,_0x5567fe){return client[_0x0646('0x9')](_0x38d655,_0x1789cd)[_0x0646('0xa')](function(_0x5e1f2e){logger[_0x0646('0xb')](_0x0646('0xc'),_0xbc6a7a,_0x0646('0xd'));logger[_0x0646('0xe')](_0x0646('0xf'),_0xbc6a7a,'request\x20sent',JSON[_0x0646('0x10')](_0x5e1f2e));if(_0x5e1f2e[_0x0646('0x11')]){if(_0x5e1f2e[_0x0646('0x11')][_0x0646('0x12')]===0x1f4){logger[_0x0646('0x11')](_0x0646('0xc'),_0xbc6a7a,_0x5e1f2e[_0x0646('0x11')][_0x0646('0x13')]);return _0x5567fe(_0x5e1f2e[_0x0646('0x11')]['message']);}logger[_0x0646('0x11')](_0x0646('0xc'),_0xbc6a7a,_0x5e1f2e[_0x0646('0x11')][_0x0646('0x13')]);return _0x4ce914(_0x5e1f2e[_0x0646('0x11')][_0x0646('0x13')]);}else{logger[_0x0646('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0xbc6a7a,_0x0646('0xd'));_0x4ce914(_0x5e1f2e[_0x0646('0x14')][_0x0646('0x13')]);}})[_0x0646('0x15')](function(_0x5e61c3){logger[_0x0646('0x11')](_0x0646('0xc'),_0xbc6a7a,_0x5e61c3);_0x5567fe(_0x5e61c3);});});} \ No newline at end of file +var _0x49c9=['util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x4a6ae7,_0x5a943c){var _0x16f801=function(_0x4aca14){while(--_0x4aca14){_0x4a6ae7['push'](_0x4a6ae7['shift']());}};_0x16f801(++_0x5a943c);}(_0x49c9,0x164));var _0x949c=function(_0x168cd8,_0x32a7fe){_0x168cd8=_0x168cd8-0x0;var _0x164f85=_0x49c9[_0x168cd8];return _0x164f85;};'use strict';var _=require(_0x949c('0x0'));var util=require(_0x949c('0x1'));var moment=require('moment');var BPromise=require(_0x949c('0x2'));var rs=require(_0x949c('0x3'));var fs=require('fs');var Redis=require(_0x949c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x949c('0x5'))('rpc');var config=require(_0x949c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x949c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13d36b,_0x4d8645,_0x1d37a1){return new BPromise(function(_0x21af0d,_0x5d5449){return client[_0x949c('0x8')](_0x13d36b,_0x1d37a1)[_0x949c('0x9')](function(_0x38aecb){logger[_0x949c('0xa')](_0x949c('0xb'),_0x4d8645,_0x949c('0xc'));logger[_0x949c('0xd')](_0x949c('0xe'),_0x4d8645,'request\x20sent',JSON[_0x949c('0xf')](_0x38aecb));if(_0x38aecb[_0x949c('0x10')]){if(_0x38aecb[_0x949c('0x10')][_0x949c('0x11')]===0x1f4){logger[_0x949c('0x10')](_0x949c('0xb'),_0x4d8645,_0x38aecb[_0x949c('0x10')]['message']);return _0x5d5449(_0x38aecb[_0x949c('0x10')]['message']);}logger['error'](_0x949c('0xb'),_0x4d8645,_0x38aecb[_0x949c('0x10')][_0x949c('0x12')]);return _0x21af0d(_0x38aecb[_0x949c('0x10')][_0x949c('0x12')]);}else{logger[_0x949c('0xa')](_0x949c('0xb'),_0x4d8645,_0x949c('0xc'));_0x21af0d(_0x38aecb[_0x949c('0x13')][_0x949c('0x12')]);}})[_0x949c('0x14')](function(_0x485fd8){logger[_0x949c('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4d8645,_0x485fd8);_0x5d5449(_0x485fd8);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 8013c57..4f4ff07 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 _0xdc86=['isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xdc86,0x118));var _0x6dc8=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0xdc86[_0x28aea5];return _0x6a55f9;};'use strict';var multer=require('multer');var util=require(_0x6dc8('0x0'));var path=require('path');var timeout=require(_0x6dc8('0x1'));var express=require('express');var router=express[_0x6dc8('0x2')]();var fs_extra=require(_0x6dc8('0x3'));var auth=require(_0x6dc8('0x4'));var interaction=require(_0x6dc8('0x5'));var config=require(_0x6dc8('0x6'));var controller=require('./template.controller');router[_0x6dc8('0x7')]('/',auth[_0x6dc8('0x8')](),controller[_0x6dc8('0x9')]);router[_0x6dc8('0x7')](_0x6dc8('0xa'),auth[_0x6dc8('0x8')](),controller[_0x6dc8('0xb')]);router[_0x6dc8('0xc')]('/',auth['isAuthenticated'](),controller[_0x6dc8('0xd')]);router['put'](_0x6dc8('0xa'),auth[_0x6dc8('0x8')](),controller[_0x6dc8('0xe')]);router[_0x6dc8('0xf')]('/:id',auth[_0x6dc8('0x8')](),controller[_0x6dc8('0x10')]);module[_0x6dc8('0x11')]=router; \ No newline at end of file +var _0x9d56=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5b032c,_0x882c49){var _0x4b8ce3=function(_0x522c13){while(--_0x522c13){_0x5b032c['push'](_0x5b032c['shift']());}};_0x4b8ce3(++_0x882c49);}(_0x9d56,0x122));var _0x69d5=function(_0x12c68e,_0x2c8ba9){_0x12c68e=_0x12c68e-0x0;var _0x445cee=_0x9d56[_0x12c68e];return _0x445cee;};'use strict';var multer=require(_0x69d5('0x0'));var util=require(_0x69d5('0x1'));var path=require(_0x69d5('0x2'));var timeout=require(_0x69d5('0x3'));var express=require('express');var router=express[_0x69d5('0x4')]();var fs_extra=require(_0x69d5('0x5'));var auth=require(_0x69d5('0x6'));var interaction=require(_0x69d5('0x7'));var config=require(_0x69d5('0x8'));var controller=require('./template.controller');router[_0x69d5('0x9')]('/',auth[_0x69d5('0xa')](),controller[_0x69d5('0xb')]);router[_0x69d5('0x9')](_0x69d5('0xc'),auth[_0x69d5('0xa')](),controller[_0x69d5('0xd')]);router[_0x69d5('0xe')]('/',auth[_0x69d5('0xa')](),controller[_0x69d5('0xf')]);router[_0x69d5('0x10')](_0x69d5('0xc'),auth[_0x69d5('0xa')](),controller[_0x69d5('0x11')]);router[_0x69d5('0x12')](_0x69d5('0xc'),auth[_0x69d5('0xa')](),controller[_0x69d5('0x13')]);module[_0x69d5('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 af5fc4c..946537f 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 _0x9db0=['STRING','TEXT','sequelize','exports'];(function(_0x46f3f8,_0x12c74b){var _0xbc57cd=function(_0x34df37){while(--_0x34df37){_0x46f3f8['push'](_0x46f3f8['shift']());}};_0xbc57cd(++_0x12c74b);}(_0x9db0,0x72));var _0x09db=function(_0x2570f1,_0x456168){_0x2570f1=_0x2570f1-0x0;var _0x30b4f1=_0x9db0[_0x2570f1];return _0x30b4f1;};'use strict';var Sequelize=require(_0x09db('0x0'));module[_0x09db('0x1')]={'name':{'type':Sequelize[_0x09db('0x2')]},'description':{'type':Sequelize[_0x09db('0x2')]},'html':{'type':Sequelize[_0x09db('0x3')]}}; \ No newline at end of file +var _0xc14d=['STRING','TEXT','sequelize','exports'];(function(_0x1979dd,_0x50cbeb){var _0x21231b=function(_0x8b6110){while(--_0x8b6110){_0x1979dd['push'](_0x1979dd['shift']());}};_0x21231b(++_0x50cbeb);}(_0xc14d,0xd2));var _0xdc14=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc14d[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xdc14('0x0'));module[_0xdc14('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdc14('0x2')]},'html':{'type':Sequelize[_0xdc14('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index e7bbe5f..bc53554 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 _0x8850=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','get','Templates','UserProfileResource','error','stack','name','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x448ba1,_0x3e5ad1){var _0x7084ee=function(_0x478fed){while(--_0x478fed){_0x448ba1['push'](_0x448ba1['shift']());}};_0x7084ee(++_0x3e5ad1);}(_0x8850,0x1cd));var _0x0885=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8850[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x0885('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0885('0x1'));var jsonpatch=require(_0x0885('0x2'));var rp=require('request-promise');var moment=require(_0x0885('0x3'));var BPromise=require(_0x0885('0x4'));var Mustache=require('mustache');var util=require(_0x0885('0x5'));var path=require(_0x0885('0x6'));var sox=require('sox');var csv=require(_0x0885('0x7'));var ejs=require(_0x0885('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0885('0x9'));var crypto=require(_0x0885('0xa'));var jsforce=require(_0x0885('0xb'));var deskjs=require(_0x0885('0xc'));var toCsv=require(_0x0885('0x7'));var querystring=require(_0x0885('0xd'));var Papa=require(_0x0885('0xe'));var Redis=require(_0x0885('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0885('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0885('0x11'));var logger=require(_0x0885('0x12'))(_0x0885('0x13'));var utils=require(_0x0885('0x14'));var config=require(_0x0885('0x15'));var licenseUtil=require(_0x0885('0x16'));var db=require(_0x0885('0x17'))['db'];function respondWithStatusCode(_0x102184,_0x580efc){_0x580efc=_0x580efc||0xcc;return function(_0x24ea8f){if(_0x24ea8f){return _0x102184[_0x0885('0x18')](_0x580efc);}return _0x102184[_0x0885('0x19')](_0x580efc)['end']();};}function respondWithResult(_0x281701,_0x4b0c45){_0x4b0c45=_0x4b0c45||0xc8;return function(_0x35b7f0){if(_0x35b7f0){return _0x281701[_0x0885('0x19')](_0x4b0c45)['json'](_0x35b7f0);}};}function respondWithFilteredResult(_0x46987c,_0x54e0e3){return function(_0x426b2b){if(_0x426b2b){var _0x37e178=typeof _0x54e0e3[_0x0885('0x1a')]===_0x0885('0x1b')&&typeof _0x54e0e3[_0x0885('0x1c')]==='undefined';var _0x1a29ff=_0x426b2b[_0x0885('0x1d')];var _0x509c98=_0x37e178?0x0:_0x54e0e3[_0x0885('0x1a')];var _0x226268=_0x37e178?_0x426b2b[_0x0885('0x1d')]:_0x54e0e3[_0x0885('0x1a')]+_0x54e0e3[_0x0885('0x1c')];var _0x56e80b;if(_0x226268>=_0x1a29ff){_0x226268=_0x1a29ff;_0x56e80b=0xc8;}else{_0x56e80b=0xce;}_0x46987c[_0x0885('0x19')](_0x56e80b);return _0x46987c[_0x0885('0x1e')](_0x0885('0x1f'),_0x509c98+'-'+_0x226268+'/'+_0x1a29ff)[_0x0885('0x20')](_0x426b2b);}return null;};}function patchUpdates(_0x459fcb){return function(_0x58ca9f){try{jsonpatch['apply'](_0x58ca9f,_0x459fcb,!![]);}catch(_0x2dde3b){return BPromise[_0x0885('0x21')](_0x2dde3b);}return _0x58ca9f[_0x0885('0x22')]();};}function saveUpdates(_0x2031f2,_0x49ce90){return function(_0x3331a0){if(_0x3331a0){return _0x3331a0[_0x0885('0x23')](_0x2031f2)['then'](function(_0x3b2ab7){return _0x3b2ab7;});}return null;};}function removeEntity(_0x38ce6f,_0xd73655){return function(_0x36b954){if(_0x36b954){return _0x36b954[_0x0885('0x24')]()[_0x0885('0x25')](function(){var _0x394165=_0x36b954[_0x0885('0x26')]({'plain':!![]});var _0x2f3ec7=_0x0885('0x27');return db[_0x0885('0x28')]['destroy']({'where':{'type':_0x2f3ec7,'resourceId':_0x394165['id']}})['then'](function(){return _0x36b954;});})[_0x0885('0x25')](function(){_0x38ce6f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31c154,_0x49a1df){return function(_0x36debb){if(!_0x36debb){_0x31c154[_0x0885('0x18')](0x194);}return _0x36debb;};}function handleError(_0x281424,_0x244fa7){_0x244fa7=_0x244fa7||0x1f4;return function(_0x34b3d6){logger[_0x0885('0x29')](_0x34b3d6[_0x0885('0x2a')]);if(_0x34b3d6[_0x0885('0x2b')]){delete _0x34b3d6[_0x0885('0x2b')];}_0x281424['status'](_0x244fa7)['send'](_0x34b3d6);};}exports[_0x0885('0x2c')]=function(_0x4764b3,_0x409194){var _0x58bbc8={},_0x180810={},_0x5285ac={'count':0x0,'rows':[]};var _0x3cae8e=_[_0x0885('0x2d')](db[_0x0885('0x2e')][_0x0885('0x2f')],function(_0x1cb9a9){return{'name':_0x1cb9a9[_0x0885('0x30')],'type':_0x1cb9a9[_0x0885('0x31')][_0x0885('0x32')]};});_0x180810[_0x0885('0x33')]=_[_0x0885('0x2d')](_0x3cae8e,_0x0885('0x2b'));_0x180810[_0x0885('0x34')]=_[_0x0885('0x35')](_0x4764b3['query']);_0x180810[_0x0885('0x36')]=_['intersection'](_0x180810[_0x0885('0x33')],_0x180810['query']);_0x58bbc8[_0x0885('0x37')]=_[_0x0885('0x38')](_0x180810[_0x0885('0x33')],qs[_0x0885('0x39')](_0x4764b3['query'][_0x0885('0x39')]));_0x58bbc8[_0x0885('0x37')]=_0x58bbc8[_0x0885('0x37')][_0x0885('0x3a')]?_0x58bbc8['attributes']:_0x180810[_0x0885('0x33')];if(!_0x4764b3[_0x0885('0x34')]['hasOwnProperty'](_0x0885('0x3b'))){_0x58bbc8['limit']=qs[_0x0885('0x1c')](_0x4764b3[_0x0885('0x34')][_0x0885('0x1c')]);_0x58bbc8[_0x0885('0x1a')]=qs[_0x0885('0x1a')](_0x4764b3[_0x0885('0x34')][_0x0885('0x1a')]);}_0x58bbc8[_0x0885('0x3c')]=qs['sort'](_0x4764b3[_0x0885('0x34')]['sort']);_0x58bbc8[_0x0885('0x3d')]=qs[_0x0885('0x36')](_[_0x0885('0x3e')](_0x4764b3[_0x0885('0x34')],_0x180810[_0x0885('0x36')]),_0x3cae8e);if(_0x4764b3[_0x0885('0x34')]['filter']){_0x58bbc8[_0x0885('0x3d')]=_[_0x0885('0x3f')](_0x58bbc8['where'],{'$or':_[_0x0885('0x2d')](_0x3cae8e,function(_0x45452a){if(_0x45452a['type']!==_0x0885('0x40')){var _0x5e2bd7={};_0x5e2bd7[_0x45452a[_0x0885('0x2b')]]={'$like':'%'+_0x4764b3[_0x0885('0x34')][_0x0885('0x41')]+'%'};return _0x5e2bd7;}})});}_0x58bbc8=_[_0x0885('0x3f')]({},_0x58bbc8,_0x4764b3[_0x0885('0x42')]);var _0x25b398={'where':_0x58bbc8[_0x0885('0x3d')]};return db[_0x0885('0x2e')][_0x0885('0x1d')](_0x25b398)[_0x0885('0x25')](function(_0x8330c8){_0x5285ac[_0x0885('0x1d')]=_0x8330c8;if(_0x4764b3[_0x0885('0x34')][_0x0885('0x43')]){_0x58bbc8[_0x0885('0x44')]=[{'all':!![]}];}return db[_0x0885('0x2e')]['findAll'](_0x58bbc8);})['then'](function(_0x28535a){_0x5285ac[_0x0885('0x45')]=_0x28535a;return _0x5285ac;})[_0x0885('0x25')](respondWithFilteredResult(_0x409194,_0x58bbc8))['catch'](handleError(_0x409194,null));};exports['show']=function(_0x5e9d1e,_0x30f413){var _0x31c244={'raw':!![],'where':{'id':_0x5e9d1e[_0x0885('0x46')]['id']}},_0xffd86e={};_0xffd86e['model']=_[_0x0885('0x35')](db['Template'][_0x0885('0x2f')]);_0xffd86e['query']=_[_0x0885('0x35')](_0x5e9d1e[_0x0885('0x34')]);_0xffd86e[_0x0885('0x36')]=_[_0x0885('0x38')](_0xffd86e[_0x0885('0x33')],_0xffd86e[_0x0885('0x34')]);_0x31c244[_0x0885('0x37')]=_[_0x0885('0x38')](_0xffd86e['model'],qs['fields'](_0x5e9d1e[_0x0885('0x34')][_0x0885('0x39')]));_0x31c244[_0x0885('0x37')]=_0x31c244['attributes']['length']?_0x31c244[_0x0885('0x37')]:_0xffd86e['model'];if(_0x5e9d1e['query'][_0x0885('0x43')]){_0x31c244[_0x0885('0x44')]=[{'all':!![]}];}_0x31c244=_[_0x0885('0x3f')]({},_0x31c244,_0x5e9d1e[_0x0885('0x42')]);return db[_0x0885('0x2e')][_0x0885('0x47')](_0x31c244)[_0x0885('0x25')](handleEntityNotFound(_0x30f413,null))[_0x0885('0x25')](respondWithResult(_0x30f413,null))[_0x0885('0x48')](handleError(_0x30f413,null));};exports[_0x0885('0x49')]=function(_0x55b8a9,_0x261721){return db['Template']['create'](_0x55b8a9['body'],{})['then'](function(_0xfc6845){var _0xecbe76=_0x55b8a9[_0x0885('0x4a')][_0x0885('0x26')]({'plain':!![]});if(!_0xecbe76)throw new Error(_0x0885('0x4b'));if(_0xecbe76['role']===_0x0885('0x4a')){var _0x593733=_0xfc6845[_0x0885('0x26')]({'plain':!![]});var _0x36cf5e=_0x0885('0x27');return db[_0x0885('0x4c')][_0x0885('0x47')]({'where':{'name':_0x36cf5e,'userProfileId':_0xecbe76[_0x0885('0x4d')]},'raw':!![]})[_0x0885('0x25')](function(_0x234658){if(_0x234658&&_0x234658['autoAssociation']===0x0){return db['UserProfileResource'][_0x0885('0x49')]({'name':_0x593733[_0x0885('0x2b')],'resourceId':_0x593733['id'],'type':_0x234658[_0x0885('0x2b')],'sectionId':_0x234658['id']},{})[_0x0885('0x25')](function(){return _0xfc6845;});}else{return _0xfc6845;}})['catch'](function(_0x383a87){logger[_0x0885('0x29')](_0x0885('0x4e'),_0x383a87);throw _0x383a87;});}return _0xfc6845;})[_0x0885('0x25')](respondWithResult(_0x261721,0xc9))[_0x0885('0x48')](handleError(_0x261721,null));};exports[_0x0885('0x23')]=function(_0x4e02df,_0x42ebf3){if(_0x4e02df[_0x0885('0x4f')]['id']){delete _0x4e02df[_0x0885('0x4f')]['id'];}return db[_0x0885('0x2e')][_0x0885('0x47')]({'where':{'id':_0x4e02df[_0x0885('0x46')]['id']}})[_0x0885('0x25')](handleEntityNotFound(_0x42ebf3,null))[_0x0885('0x25')](saveUpdates(_0x4e02df[_0x0885('0x4f')],null))[_0x0885('0x25')](respondWithResult(_0x42ebf3,null))[_0x0885('0x48')](handleError(_0x42ebf3,null));};exports['destroy']=function(_0x10d57d,_0x27d5c1){return db[_0x0885('0x2e')][_0x0885('0x47')]({'where':{'id':_0x10d57d['params']['id']}})[_0x0885('0x25')](handleEntityNotFound(_0x27d5c1,null))['then'](removeEntity(_0x27d5c1,null))[_0x0885('0x48')](handleError(_0x27d5c1,null));}; \ No newline at end of file +var _0x384c=['where','VIRTUAL','merge','Template','count','include','findAll','catch','show','params','keys','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','eml-format','rimraf','moment','bluebird','util','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','get','Templates','UserProfileResource','destroy','error','name','send','index','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','nolimit','order','sort','filters','filter'];(function(_0x4de1c3,_0xbe77b9){var _0x26acfe=function(_0x2c9df4){while(--_0x2c9df4){_0x4de1c3['push'](_0x4de1c3['shift']());}};_0x26acfe(++_0xbe77b9);}(_0x384c,0x14c));var _0xc384=function(_0x1326bb,_0x512c22){_0x1326bb=_0x1326bb-0x0;var _0xb7ecf1=_0x384c[_0x1326bb];return _0xb7ecf1;};'use strict';var emlformat=require(_0xc384('0x0'));var rimraf=require(_0xc384('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc384('0x2'));var BPromise=require(_0xc384('0x3'));var Mustache=require('mustache');var util=require(_0xc384('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc384('0x5'));var _=require(_0xc384('0x6'));var squel=require(_0xc384('0x7'));var crypto=require(_0xc384('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xc384('0x9'));var toCsv=require(_0xc384('0xa'));var querystring=require(_0xc384('0xb'));var Papa=require(_0xc384('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc384('0xd'));var as=require(_0xc384('0xe'));var hardwareService=require(_0xc384('0xf'));var logger=require(_0xc384('0x10'))(_0xc384('0x11'));var utils=require(_0xc384('0x12'));var config=require(_0xc384('0x13'));var licenseUtil=require(_0xc384('0x14'));var db=require(_0xc384('0x15'))['db'];function respondWithStatusCode(_0xe73b8e,_0x318a78){_0x318a78=_0x318a78||0xcc;return function(_0x43ea67){if(_0x43ea67){return _0xe73b8e[_0xc384('0x16')](_0x318a78);}return _0xe73b8e[_0xc384('0x17')](_0x318a78)[_0xc384('0x18')]();};}function respondWithResult(_0x51fc11,_0x4500c5){_0x4500c5=_0x4500c5||0xc8;return function(_0x182878){if(_0x182878){return _0x51fc11[_0xc384('0x17')](_0x4500c5)[_0xc384('0x19')](_0x182878);}};}function respondWithFilteredResult(_0x32f9ed,_0x4031cd){return function(_0xeb42c8){if(_0xeb42c8){var _0x179705=typeof _0x4031cd[_0xc384('0x1a')]===_0xc384('0x1b')&&typeof _0x4031cd[_0xc384('0x1c')]==='undefined';var _0x4c1617=_0xeb42c8['count'];var _0xbe663b=_0x179705?0x0:_0x4031cd[_0xc384('0x1a')];var _0x285d27=_0x179705?_0xeb42c8['count']:_0x4031cd['offset']+_0x4031cd[_0xc384('0x1c')];var _0x1eba7a;if(_0x285d27>=_0x4c1617){_0x285d27=_0x4c1617;_0x1eba7a=0xc8;}else{_0x1eba7a=0xce;}_0x32f9ed[_0xc384('0x17')](_0x1eba7a);return _0x32f9ed[_0xc384('0x1d')](_0xc384('0x1e'),_0xbe663b+'-'+_0x285d27+'/'+_0x4c1617)['json'](_0xeb42c8);}return null;};}function patchUpdates(_0x5dbecd){return function(_0x16c16d){try{jsonpatch[_0xc384('0x1f')](_0x16c16d,_0x5dbecd,!![]);}catch(_0x470f9b){return BPromise['reject'](_0x470f9b);}return _0x16c16d[_0xc384('0x20')]();};}function saveUpdates(_0x554562,_0x17615a){return function(_0x467ccf){if(_0x467ccf){return _0x467ccf[_0xc384('0x21')](_0x554562)[_0xc384('0x22')](function(_0x28aea2){return _0x28aea2;});}return null;};}function removeEntity(_0x486428,_0x484807){return function(_0x4ffc83){if(_0x4ffc83){return _0x4ffc83['destroy']()[_0xc384('0x22')](function(){var _0x1c3e59=_0x4ffc83[_0xc384('0x23')]({'plain':!![]});var _0x77ac94=_0xc384('0x24');return db[_0xc384('0x25')][_0xc384('0x26')]({'where':{'type':_0x77ac94,'resourceId':_0x1c3e59['id']}})['then'](function(){return _0x4ffc83;});})['then'](function(){_0x486428['status'](0xcc)[_0xc384('0x18')]();});}};}function handleEntityNotFound(_0x33f180,_0x25ab2b){return function(_0x3cfccd){if(!_0x3cfccd){_0x33f180['sendStatus'](0x194);}return _0x3cfccd;};}function handleError(_0x3fe499,_0x4e6ebf){_0x4e6ebf=_0x4e6ebf||0x1f4;return function(_0x5a3d17){logger[_0xc384('0x27')](_0x5a3d17['stack']);if(_0x5a3d17[_0xc384('0x28')]){delete _0x5a3d17[_0xc384('0x28')];}_0x3fe499[_0xc384('0x17')](_0x4e6ebf)[_0xc384('0x29')](_0x5a3d17);};}exports[_0xc384('0x2a')]=function(_0x1c7ba4,_0x4b5415){var _0x7e3f2b={},_0x3627a1={},_0x4cf712={'count':0x0,'rows':[]};var _0x29ddc3=_['map'](db['Template'][_0xc384('0x2b')],function(_0x5e8149){return{'name':_0x5e8149[_0xc384('0x2c')],'type':_0x5e8149[_0xc384('0x2d')]['key']};});_0x3627a1[_0xc384('0x2e')]=_[_0xc384('0x2f')](_0x29ddc3,_0xc384('0x28'));_0x3627a1[_0xc384('0x30')]=_['keys'](_0x1c7ba4['query']);_0x3627a1['filters']=_[_0xc384('0x31')](_0x3627a1['model'],_0x3627a1[_0xc384('0x30')]);_0x7e3f2b[_0xc384('0x32')]=_[_0xc384('0x31')](_0x3627a1[_0xc384('0x2e')],qs[_0xc384('0x33')](_0x1c7ba4['query'][_0xc384('0x33')]));_0x7e3f2b[_0xc384('0x32')]=_0x7e3f2b['attributes'][_0xc384('0x34')]?_0x7e3f2b['attributes']:_0x3627a1['model'];if(!_0x1c7ba4['query']['hasOwnProperty'](_0xc384('0x35'))){_0x7e3f2b[_0xc384('0x1c')]=qs['limit'](_0x1c7ba4[_0xc384('0x30')][_0xc384('0x1c')]);_0x7e3f2b[_0xc384('0x1a')]=qs[_0xc384('0x1a')](_0x1c7ba4[_0xc384('0x30')][_0xc384('0x1a')]);}_0x7e3f2b[_0xc384('0x36')]=qs[_0xc384('0x37')](_0x1c7ba4[_0xc384('0x30')][_0xc384('0x37')]);_0x7e3f2b['where']=qs['filters'](_['pick'](_0x1c7ba4[_0xc384('0x30')],_0x3627a1[_0xc384('0x38')]),_0x29ddc3);if(_0x1c7ba4[_0xc384('0x30')][_0xc384('0x39')]){_0x7e3f2b[_0xc384('0x3a')]=_['merge'](_0x7e3f2b['where'],{'$or':_[_0xc384('0x2f')](_0x29ddc3,function(_0x122660){if(_0x122660[_0xc384('0x2d')]!==_0xc384('0x3b')){var _0x466c11={};_0x466c11[_0x122660['name']]={'$like':'%'+_0x1c7ba4[_0xc384('0x30')][_0xc384('0x39')]+'%'};return _0x466c11;}})});}_0x7e3f2b=_[_0xc384('0x3c')]({},_0x7e3f2b,_0x1c7ba4['options']);var _0x4d0219={'where':_0x7e3f2b[_0xc384('0x3a')]};return db[_0xc384('0x3d')]['count'](_0x4d0219)[_0xc384('0x22')](function(_0x59f8a1){_0x4cf712[_0xc384('0x3e')]=_0x59f8a1;if(_0x1c7ba4['query']['includeAll']){_0x7e3f2b[_0xc384('0x3f')]=[{'all':!![]}];}return db[_0xc384('0x3d')][_0xc384('0x40')](_0x7e3f2b);})[_0xc384('0x22')](function(_0x9dda83){_0x4cf712['rows']=_0x9dda83;return _0x4cf712;})[_0xc384('0x22')](respondWithFilteredResult(_0x4b5415,_0x7e3f2b))[_0xc384('0x41')](handleError(_0x4b5415,null));};exports[_0xc384('0x42')]=function(_0x203517,_0x2cff3c){var _0x5baeab={'raw':!![],'where':{'id':_0x203517[_0xc384('0x43')]['id']}},_0xf92f67={};_0xf92f67[_0xc384('0x2e')]=_['keys'](db['Template']['rawAttributes']);_0xf92f67[_0xc384('0x30')]=_[_0xc384('0x44')](_0x203517[_0xc384('0x30')]);_0xf92f67[_0xc384('0x38')]=_['intersection'](_0xf92f67[_0xc384('0x2e')],_0xf92f67[_0xc384('0x30')]);_0x5baeab['attributes']=_['intersection'](_0xf92f67[_0xc384('0x2e')],qs[_0xc384('0x33')](_0x203517[_0xc384('0x30')][_0xc384('0x33')]));_0x5baeab[_0xc384('0x32')]=_0x5baeab['attributes'][_0xc384('0x34')]?_0x5baeab[_0xc384('0x32')]:_0xf92f67[_0xc384('0x2e')];if(_0x203517[_0xc384('0x30')][_0xc384('0x45')]){_0x5baeab['include']=[{'all':!![]}];}_0x5baeab=_[_0xc384('0x3c')]({},_0x5baeab,_0x203517[_0xc384('0x46')]);return db[_0xc384('0x3d')][_0xc384('0x47')](_0x5baeab)['then'](handleEntityNotFound(_0x2cff3c,null))[_0xc384('0x22')](respondWithResult(_0x2cff3c,null))[_0xc384('0x41')](handleError(_0x2cff3c,null));};exports[_0xc384('0x48')]=function(_0x2c6cc8,_0x4e9172){return db[_0xc384('0x3d')][_0xc384('0x48')](_0x2c6cc8[_0xc384('0x49')],{})[_0xc384('0x22')](function(_0x51a56e){var _0x4b51=_0x2c6cc8['user'][_0xc384('0x23')]({'plain':!![]});if(!_0x4b51)throw new Error(_0xc384('0x4a'));if(_0x4b51['role']===_0xc384('0x4b')){var _0x50ae31=_0x51a56e['get']({'plain':!![]});var _0x5934e6=_0xc384('0x24');return db[_0xc384('0x4c')][_0xc384('0x47')]({'where':{'name':_0x5934e6,'userProfileId':_0x4b51['userProfileId']},'raw':!![]})[_0xc384('0x22')](function(_0x1614df){if(_0x1614df&&_0x1614df[_0xc384('0x4d')]===0x0){return db[_0xc384('0x25')][_0xc384('0x48')]({'name':_0x50ae31[_0xc384('0x28')],'resourceId':_0x50ae31['id'],'type':_0x1614df[_0xc384('0x28')],'sectionId':_0x1614df['id']},{})[_0xc384('0x22')](function(){return _0x51a56e;});}else{return _0x51a56e;}})['catch'](function(_0x49b02d){logger[_0xc384('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49b02d);throw _0x49b02d;});}return _0x51a56e;})[_0xc384('0x22')](respondWithResult(_0x4e9172,0xc9))[_0xc384('0x41')](handleError(_0x4e9172,null));};exports[_0xc384('0x21')]=function(_0x529e4b,_0x5d1ead){if(_0x529e4b[_0xc384('0x49')]['id']){delete _0x529e4b[_0xc384('0x49')]['id'];}return db[_0xc384('0x3d')][_0xc384('0x47')]({'where':{'id':_0x529e4b[_0xc384('0x43')]['id']}})[_0xc384('0x22')](handleEntityNotFound(_0x5d1ead,null))[_0xc384('0x22')](saveUpdates(_0x529e4b['body'],null))[_0xc384('0x22')](respondWithResult(_0x5d1ead,null))[_0xc384('0x41')](handleError(_0x5d1ead,null));};exports[_0xc384('0x26')]=function(_0x53e888,_0x2de5ac){return db[_0xc384('0x3d')][_0xc384('0x47')]({'where':{'id':_0x53e888['params']['id']}})[_0xc384('0x22')](handleEntityNotFound(_0x2de5ac,null))[_0xc384('0x22')](removeEntity(_0x2de5ac,null))[_0xc384('0x41')](handleError(_0x2de5ac,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 204fabb..0c12bfd 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 _0xf7aa=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates'];(function(_0x247c98,_0x3cad7c){var _0x38b15f=function(_0x150eae){while(--_0x150eae){_0x247c98['push'](_0x247c98['shift']());}};_0x38b15f(++_0x3cad7c);}(_0xf7aa,0xea));var _0xaf7a=function(_0x49b8a4,_0x5505a6){_0x49b8a4=_0x49b8a4-0x0;var _0x1d553e=_0xf7aa[_0x49b8a4];return _0x1d553e;};'use strict';var _=require(_0xaf7a('0x0'));var util=require(_0xaf7a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xaf7a('0x2'));var BPromise=require(_0xaf7a('0x3'));var rp=require(_0xaf7a('0x4'));var fs=require('fs');var path=require(_0xaf7a('0x5'));var rimraf=require(_0xaf7a('0x6'));var config=require(_0xaf7a('0x7'));var attributes=require(_0xaf7a('0x8'));module[_0xaf7a('0x9')]=function(_0x3a4dcf,_0x369aa9){return _0x3a4dcf[_0xaf7a('0xa')](_0xaf7a('0xb'),attributes,{'tableName':_0xaf7a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd1a=['Template','tools_templates','lodash','util','../../config/logger','api','bluebird','path','rimraf','./template.attributes','exports','define'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xdd1a,0xfe));var _0xadd1=function(_0x402b34,_0x27815d){_0x402b34=_0x402b34-0x0;var _0x2a1ba9=_0xdd1a[_0x402b34];return _0x2a1ba9;};'use strict';var _=require(_0xadd1('0x0'));var util=require(_0xadd1('0x1'));var logger=require(_0xadd1('0x2'))(_0xadd1('0x3'));var moment=require('moment');var BPromise=require(_0xadd1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xadd1('0x5'));var rimraf=require(_0xadd1('0x6'));var config=require('../../config/environment');var attributes=require(_0xadd1('0x7'));module[_0xadd1('0x8')]=function(_0x54fe3d,_0x52affb){return _0x54fe3d[_0xadd1('0x9')](_0xadd1('0xa'),attributes,{'tableName':_0xadd1('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 7f21675..8318aac 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 _0xdafb=['raw','where','attributes','limit','map','include','model','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','GetTemplate','Template','findAll','options'];(function(_0x47f46c,_0x42a9de){var _0x2b0833=function(_0x1ad637){while(--_0x1ad637){_0x47f46c['push'](_0x47f46c['shift']());}};_0x2b0833(++_0x42a9de);}(_0xdafb,0x1a9));var _0xbdaf=function(_0x4ea3f8,_0x4a1d73){_0x4ea3f8=_0x4ea3f8-0x0;var _0x57ac7d=_0xdafb[_0x4ea3f8];return _0x57ac7d;};'use strict';var _=require(_0xbdaf('0x0'));var util=require(_0xbdaf('0x1'));var moment=require(_0xbdaf('0x2'));var BPromise=require(_0xbdaf('0x3'));var rs=require(_0xbdaf('0x4'));var fs=require('fs');var Redis=require(_0xbdaf('0x5'));var db=require(_0xbdaf('0x6'))['db'];var utils=require(_0xbdaf('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xbdaf('0x8'));var client=jayson[_0xbdaf('0x9')][_0xbdaf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43f837,_0x480667,_0x171a1b){return new BPromise(function(_0xa70bb6,_0x115b1b){return client['request'](_0x43f837,_0x171a1b)['then'](function(_0x20e3ff){logger[_0xbdaf('0xb')](_0xbdaf('0xc'),_0x480667,_0xbdaf('0xd'));logger[_0xbdaf('0xe')](_0xbdaf('0xf'),_0x480667,_0xbdaf('0xd'),JSON['stringify'](_0x20e3ff));if(_0x20e3ff[_0xbdaf('0x10')]){if(_0x20e3ff['error'][_0xbdaf('0x11')]===0x1f4){logger[_0xbdaf('0x10')](_0xbdaf('0xc'),_0x480667,_0x20e3ff[_0xbdaf('0x10')][_0xbdaf('0x12')]);return _0x115b1b(_0x20e3ff[_0xbdaf('0x10')][_0xbdaf('0x12')]);}logger[_0xbdaf('0x10')]('Template,\x20%s,\x20%s',_0x480667,_0x20e3ff[_0xbdaf('0x10')]['message']);return _0xa70bb6(_0x20e3ff['error']['message']);}else{logger[_0xbdaf('0xb')](_0xbdaf('0xc'),_0x480667,_0xbdaf('0xd'));_0xa70bb6(_0x20e3ff['result'][_0xbdaf('0x12')]);}})['catch'](function(_0x10d397){logger[_0xbdaf('0x10')](_0xbdaf('0xc'),_0x480667,_0x10d397);_0x115b1b(_0x10d397);});});}exports[_0xbdaf('0x13')]=function(_0x25b884){var _0x42c091=this;return new Promise(function(_0x7ff20c,_0x226c1c){return db[_0xbdaf('0x14')][_0xbdaf('0x15')]({'raw':_0x25b884[_0xbdaf('0x16')]?_0x25b884[_0xbdaf('0x16')][_0xbdaf('0x17')]===undefined?!![]:![]:!![],'where':_0x25b884[_0xbdaf('0x16')]?_0x25b884[_0xbdaf('0x16')][_0xbdaf('0x18')]||null:null,'attributes':_0x25b884['options']?_0x25b884[_0xbdaf('0x16')][_0xbdaf('0x19')]||null:null,'limit':_0x25b884[_0xbdaf('0x16')]?_0x25b884[_0xbdaf('0x16')][_0xbdaf('0x1a')]||null:null,'include':_0x25b884[_0xbdaf('0x16')]?_0x25b884[_0xbdaf('0x16')]['include']?_[_0xbdaf('0x1b')](_0x25b884['options'][_0xbdaf('0x1c')],function(_0x52089c){return{'model':db[_0x52089c[_0xbdaf('0x1d')]],'as':_0x52089c['as'],'attributes':_0x52089c['attributes'],'include':_0x52089c[_0xbdaf('0x1c')]?_[_0xbdaf('0x1b')](_0x52089c['include'],function(_0x3edb73){return{'model':db[_0x3edb73[_0xbdaf('0x1d')]],'as':_0x3edb73['as'],'attributes':_0x3edb73[_0xbdaf('0x19')],'include':_0x3edb73[_0xbdaf('0x1c')]?_[_0xbdaf('0x1b')](_0x3edb73['include'],function(_0x5e361c){return{'model':db[_0x5e361c[_0xbdaf('0x1d')]],'as':_0x5e361c['as'],'attributes':_0x5e361c['attributes']};}):[]};}):[]};}):[]:[]})[_0xbdaf('0x1e')](function(_0x802578){logger[_0xbdaf('0xb')](_0xbdaf('0x13'),_0x25b884);logger['debug'](_0xbdaf('0x13'),_0x25b884,JSON[_0xbdaf('0x1f')](_0x802578));_0x7ff20c(_0x802578);})['catch'](function(_0x63583b){logger[_0xbdaf('0x10')]('GetTemplate',_0x63583b['message'],_0x25b884);_0x226c1c(_0x42c091[_0xbdaf('0x10')](0x1f4,_0x63583b[_0xbdaf('0x12')]));});});}; \ No newline at end of file +var _0x2af2=['GetTemplate','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','Template','findAll','options','raw','attributes','include','model','map'];(function(_0x4db40c,_0x5aebda){var _0x572a4b=function(_0x4cb854){while(--_0x4cb854){_0x4db40c['push'](_0x4db40c['shift']());}};_0x572a4b(++_0x5aebda);}(_0x2af2,0x1cf));var _0x22af=function(_0x2b4603,_0x1ceca7){_0x2b4603=_0x2b4603-0x0;var _0x2e9606=_0x2af2[_0x2b4603];return _0x2e9606;};'use strict';var _=require(_0x22af('0x0'));var util=require(_0x22af('0x1'));var moment=require('moment');var BPromise=require(_0x22af('0x2'));var rs=require(_0x22af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x22af('0x4'))['db'];var utils=require(_0x22af('0x5'));var logger=require(_0x22af('0x6'))('rpc');var config=require(_0x22af('0x7'));var jayson=require(_0x22af('0x8'));var client=jayson[_0x22af('0x9')][_0x22af('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a5758,_0xaa821e,_0xe85fcc){return new BPromise(function(_0x1cbb15,_0x437e51){return client[_0x22af('0xb')](_0x3a5758,_0xe85fcc)[_0x22af('0xc')](function(_0x503db5){logger['info'](_0x22af('0xd'),_0xaa821e,_0x22af('0xe'));logger[_0x22af('0xf')](_0x22af('0x10'),_0xaa821e,_0x22af('0xe'),JSON[_0x22af('0x11')](_0x503db5));if(_0x503db5[_0x22af('0x12')]){if(_0x503db5[_0x22af('0x12')][_0x22af('0x13')]===0x1f4){logger['error'](_0x22af('0xd'),_0xaa821e,_0x503db5[_0x22af('0x12')]['message']);return _0x437e51(_0x503db5[_0x22af('0x12')][_0x22af('0x14')]);}logger[_0x22af('0x12')]('Template,\x20%s,\x20%s',_0xaa821e,_0x503db5[_0x22af('0x12')]['message']);return _0x1cbb15(_0x503db5[_0x22af('0x12')]['message']);}else{logger[_0x22af('0x15')]('Template,\x20%s,\x20%s',_0xaa821e,_0x22af('0xe'));_0x1cbb15(_0x503db5[_0x22af('0x16')][_0x22af('0x14')]);}})[_0x22af('0x17')](function(_0x164ab9){logger[_0x22af('0x12')](_0x22af('0xd'),_0xaa821e,_0x164ab9);_0x437e51(_0x164ab9);});});}exports['GetTemplate']=function(_0x4dbef6){var _0x23f4c1=this;return new Promise(function(_0x469fbe,_0x416004){return db[_0x22af('0x18')][_0x22af('0x19')]({'raw':_0x4dbef6['options']?_0x4dbef6[_0x22af('0x1a')][_0x22af('0x1b')]===undefined?!![]:![]:!![],'where':_0x4dbef6[_0x22af('0x1a')]?_0x4dbef6[_0x22af('0x1a')]['where']||null:null,'attributes':_0x4dbef6[_0x22af('0x1a')]?_0x4dbef6['options'][_0x22af('0x1c')]||null:null,'limit':_0x4dbef6['options']?_0x4dbef6[_0x22af('0x1a')]['limit']||null:null,'include':_0x4dbef6[_0x22af('0x1a')]?_0x4dbef6[_0x22af('0x1a')][_0x22af('0x1d')]?_['map'](_0x4dbef6['options'][_0x22af('0x1d')],function(_0x4de8ff){return{'model':db[_0x4de8ff[_0x22af('0x1e')]],'as':_0x4de8ff['as'],'attributes':_0x4de8ff[_0x22af('0x1c')],'include':_0x4de8ff[_0x22af('0x1d')]?_[_0x22af('0x1f')](_0x4de8ff[_0x22af('0x1d')],function(_0x2ee735){return{'model':db[_0x2ee735[_0x22af('0x1e')]],'as':_0x2ee735['as'],'attributes':_0x2ee735[_0x22af('0x1c')],'include':_0x2ee735[_0x22af('0x1d')]?_['map'](_0x2ee735['include'],function(_0x2b27fd){return{'model':db[_0x2b27fd['model']],'as':_0x2b27fd['as'],'attributes':_0x2b27fd[_0x22af('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x22af('0xc')](function(_0x1808ed){logger[_0x22af('0x15')](_0x22af('0x20'),_0x4dbef6);logger[_0x22af('0xf')]('GetTemplate',_0x4dbef6,JSON[_0x22af('0x11')](_0x1808ed));_0x469fbe(_0x1808ed);})[_0x22af('0x17')](function(_0x18476f){logger[_0x22af('0x12')](_0x22af('0x20'),_0x18476f['message'],_0x4dbef6);_0x416004(_0x23f4c1[_0x22af('0x12')](0x1f4,_0x18476f['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 525f80d..61f3d60 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 _0x49a1=['isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get'];(function(_0x5c5b81,_0xd59b92){var _0x1a408a=function(_0x38f4df){while(--_0x38f4df){_0x5c5b81['push'](_0x5c5b81['shift']());}};_0x1a408a(++_0xd59b92);}(_0x49a1,0x190));var _0x149a=function(_0x5a4300,_0x4b95b7){_0x5a4300=_0x5a4300-0x0;var _0x40f2c9=_0x49a1[_0x5a4300];return _0x40f2c9;};'use strict';var multer=require(_0x149a('0x0'));var util=require(_0x149a('0x1'));var path=require(_0x149a('0x2'));var timeout=require(_0x149a('0x3'));var express=require(_0x149a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x149a('0x5'));var config=require(_0x149a('0x6'));var controller=require('./trigger.controller');router[_0x149a('0x7')]('/',auth[_0x149a('0x8')](),controller['index']);router[_0x149a('0x7')]('/:id',auth[_0x149a('0x8')](),controller[_0x149a('0x9')]);router['get'](_0x149a('0xa'),auth[_0x149a('0x8')](),controller[_0x149a('0xb')]);router[_0x149a('0x7')](_0x149a('0xc'),auth[_0x149a('0x8')](),controller['getAnyConditions']);router['get'](_0x149a('0xd'),auth[_0x149a('0x8')](),controller[_0x149a('0xe')]);router[_0x149a('0xf')]('/',auth[_0x149a('0x8')](),controller[_0x149a('0x10')]);router[_0x149a('0xf')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x149a('0x11')]);router['post'](_0x149a('0xc'),auth[_0x149a('0x8')](),controller[_0x149a('0x12')]);router[_0x149a('0xf')](_0x149a('0xd'),auth[_0x149a('0x8')](),controller[_0x149a('0x13')]);router[_0x149a('0x14')](_0x149a('0x15'),auth[_0x149a('0x8')](),controller['update']);router[_0x149a('0x16')](_0x149a('0x15'),auth[_0x149a('0x8')](),controller[_0x149a('0x17')]);module['exports']=router; \ No newline at end of file +var _0xa2d0=['../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','create','post','addAction','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x6190ce,_0x40520f){var _0x369ef6=function(_0x86ecde){while(--_0x86ecde){_0x6190ce['push'](_0x6190ce['shift']());}};_0x369ef6(++_0x40520f);}(_0xa2d0,0x77));var _0x0a2d=function(_0x37bceb,_0x453626){_0x37bceb=_0x37bceb-0x0;var _0x31f6ef=_0xa2d0[_0x37bceb];return _0x31f6ef;};'use strict';var multer=require(_0x0a2d('0x0'));var util=require('util');var path=require(_0x0a2d('0x1'));var timeout=require(_0x0a2d('0x2'));var express=require(_0x0a2d('0x3'));var router=express[_0x0a2d('0x4')]();var fs_extra=require(_0x0a2d('0x5'));var auth=require(_0x0a2d('0x6'));var interaction=require(_0x0a2d('0x7'));var config=require('../../config/environment');var controller=require('./trigger.controller');router['get']('/',auth[_0x0a2d('0x8')](),controller['index']);router['get']('/:id',auth[_0x0a2d('0x8')](),controller['show']);router[_0x0a2d('0x9')](_0x0a2d('0xa'),auth['isAuthenticated'](),controller[_0x0a2d('0xb')]);router['get'](_0x0a2d('0xc'),auth[_0x0a2d('0x8')](),controller[_0x0a2d('0xd')]);router['get'](_0x0a2d('0xe'),auth[_0x0a2d('0x8')](),controller[_0x0a2d('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0a2d('0x10')]);router[_0x0a2d('0x11')](_0x0a2d('0xa'),auth[_0x0a2d('0x8')](),controller['addAllCondition']);router[_0x0a2d('0x11')]('/:id/any_conditions',auth[_0x0a2d('0x8')](),controller['addAnyCondition']);router[_0x0a2d('0x11')](_0x0a2d('0xe'),auth[_0x0a2d('0x8')](),controller[_0x0a2d('0x12')]);router[_0x0a2d('0x13')](_0x0a2d('0x14'),auth[_0x0a2d('0x8')](),controller[_0x0a2d('0x15')]);router[_0x0a2d('0x16')](_0x0a2d('0x14'),auth[_0x0a2d('0x8')](),controller[_0x0a2d('0x17')]);module[_0x0a2d('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index e99bbc1..516f656 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 _0x4896=['exports','STRING','BOOLEAN','sequelize'];(function(_0xbf44b3,_0x4638ad){var _0x112f5=function(_0x1cd1c1){while(--_0x1cd1c1){_0xbf44b3['push'](_0xbf44b3['shift']());}};_0x112f5(++_0x4638ad);}(_0x4896,0x1ef));var _0x6489=function(_0x66d989,_0x2b8626){_0x66d989=_0x66d989-0x0;var _0x112275=_0x4896[_0x66d989];return _0x112275;};'use strict';var Sequelize=require(_0x6489('0x0'));module[_0x6489('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x6489('0x2')]},'description':{'type':Sequelize[_0x6489('0x2')]},'status':{'type':Sequelize[_0x6489('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x6e88=['sequelize','exports','STRING','BOOLEAN'];(function(_0x5de930,_0x3ae033){var _0x816f8b=function(_0x19aa95){while(--_0x19aa95){_0x5de930['push'](_0x5de930['shift']());}};_0x816f8b(++_0x3ae033);}(_0x6e88,0x1c0));var _0x86e8=function(_0x4b773b,_0x3f2905){_0x4b773b=_0x4b773b-0x0;var _0x4c6c5a=_0x6e88[_0x4b773b];return _0x4c6c5a;};'use strict';var Sequelize=require(_0x86e8('0x0'));module[_0x86e8('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x86e8('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x86e8('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index e462bfa..fc54d39 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 _0xaa13=['find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addAllCondition','Condition','addAnyCondition','getAllConditions','findOne','getAnyConditions','addAction','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','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','sendStatus','status','end','json','offset','undefined','count','apply','reject','save','update','then','destroy','get','error','stack','name','map','Trigger','rawAttributes','fieldName','type','key','model','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','catch','show','keys','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user'];(function(_0x281275,_0x283494){var _0x2805ed=function(_0xebd591){while(--_0xebd591){_0x281275['push'](_0x281275['shift']());}};_0x2805ed(++_0x283494);}(_0xaa13,0x6b));var _0x3aa1=function(_0x13aee6,_0x2d189f){_0x13aee6=_0x13aee6-0x0;var _0x2153fa=_0xaa13[_0x13aee6];return _0x2153fa;};'use strict';var emlformat=require(_0x3aa1('0x0'));var rimraf=require(_0x3aa1('0x1'));var zipdir=require(_0x3aa1('0x2'));var jsonpatch=require(_0x3aa1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3aa1('0x4'));var Mustache=require('mustache');var util=require(_0x3aa1('0x5'));var path=require('path');var sox=require(_0x3aa1('0x6'));var csv=require(_0x3aa1('0x7'));var ejs=require(_0x3aa1('0x8'));var fs=require('fs');var fs_extra=require(_0x3aa1('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3aa1('0xa'));var jsforce=require(_0x3aa1('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3aa1('0x7'));var querystring=require(_0x3aa1('0xc'));var Papa=require(_0x3aa1('0xd'));var Redis=require(_0x3aa1('0xe'));var authService=require(_0x3aa1('0xf'));var qs=require(_0x3aa1('0x10'));var as=require(_0x3aa1('0x11'));var hardwareService=require(_0x3aa1('0x12'));var logger=require(_0x3aa1('0x13'))(_0x3aa1('0x14'));var utils=require(_0x3aa1('0x15'));var config=require(_0x3aa1('0x16'));var licenseUtil=require(_0x3aa1('0x17'));var db=require(_0x3aa1('0x18'))['db'];function respondWithStatusCode(_0x109e18,_0x813998){_0x813998=_0x813998||0xcc;return function(_0x17e6c6){if(_0x17e6c6){return _0x109e18[_0x3aa1('0x19')](_0x813998);}return _0x109e18[_0x3aa1('0x1a')](_0x813998)[_0x3aa1('0x1b')]();};}function respondWithResult(_0x128c8c,_0x2c6592){_0x2c6592=_0x2c6592||0xc8;return function(_0x4afe9c){if(_0x4afe9c){return _0x128c8c[_0x3aa1('0x1a')](_0x2c6592)[_0x3aa1('0x1c')](_0x4afe9c);}};}function respondWithFilteredResult(_0x4b612d,_0x13b7f8){return function(_0x3f1546){if(_0x3f1546){var _0x1664b2=typeof _0x13b7f8[_0x3aa1('0x1d')]===_0x3aa1('0x1e')&&typeof _0x13b7f8['limit']===_0x3aa1('0x1e');var _0x2d3e14=_0x3f1546[_0x3aa1('0x1f')];var _0x1bbbe3=_0x1664b2?0x0:_0x13b7f8[_0x3aa1('0x1d')];var _0x4dbd16=_0x1664b2?_0x3f1546[_0x3aa1('0x1f')]:_0x13b7f8[_0x3aa1('0x1d')]+_0x13b7f8['limit'];var _0x240cc9;if(_0x4dbd16>=_0x2d3e14){_0x4dbd16=_0x2d3e14;_0x240cc9=0xc8;}else{_0x240cc9=0xce;}_0x4b612d['status'](_0x240cc9);return _0x4b612d['set']('Content-Range',_0x1bbbe3+'-'+_0x4dbd16+'/'+_0x2d3e14)[_0x3aa1('0x1c')](_0x3f1546);}return null;};}function patchUpdates(_0x3f7933){return function(_0x4c5885){try{jsonpatch[_0x3aa1('0x20')](_0x4c5885,_0x3f7933,!![]);}catch(_0x498ae5){return BPromise[_0x3aa1('0x21')](_0x498ae5);}return _0x4c5885[_0x3aa1('0x22')]();};}function saveUpdates(_0x5a1e84,_0x520fe9){return function(_0x32e5f9){if(_0x32e5f9){return _0x32e5f9[_0x3aa1('0x23')](_0x5a1e84)[_0x3aa1('0x24')](function(_0x4af8d5){return _0x4af8d5;});}return null;};}function removeEntity(_0x2eaf01,_0x59fa5a){return function(_0x1c7312){if(_0x1c7312){return _0x1c7312[_0x3aa1('0x25')]()[_0x3aa1('0x24')](function(){var _0xef762e=_0x1c7312[_0x3aa1('0x26')]({'plain':!![]});var _0x2a9fc4='Triggers';return db['UserProfileResource'][_0x3aa1('0x25')]({'where':{'type':_0x2a9fc4,'resourceId':_0xef762e['id']}})[_0x3aa1('0x24')](function(){return _0x1c7312;});})[_0x3aa1('0x24')](function(){_0x2eaf01[_0x3aa1('0x1a')](0xcc)[_0x3aa1('0x1b')]();});}};}function handleEntityNotFound(_0x300ed2,_0x1f74f8){return function(_0x344ca2){if(!_0x344ca2){_0x300ed2[_0x3aa1('0x19')](0x194);}return _0x344ca2;};}function handleError(_0x594afe,_0x4dc2eb){_0x4dc2eb=_0x4dc2eb||0x1f4;return function(_0x495109){logger[_0x3aa1('0x27')](_0x495109[_0x3aa1('0x28')]);if(_0x495109['name']){delete _0x495109[_0x3aa1('0x29')];}_0x594afe[_0x3aa1('0x1a')](_0x4dc2eb)['send'](_0x495109);};}exports['index']=function(_0x26d885,_0x5cc824){var _0x1a4c09={},_0x50b870={},_0x99831a={'count':0x0,'rows':[]};var _0x584b42=_[_0x3aa1('0x2a')](db[_0x3aa1('0x2b')][_0x3aa1('0x2c')],function(_0x183152){return{'name':_0x183152[_0x3aa1('0x2d')],'type':_0x183152[_0x3aa1('0x2e')][_0x3aa1('0x2f')]};});_0x50b870[_0x3aa1('0x30')]=_[_0x3aa1('0x2a')](_0x584b42,'name');_0x50b870['query']=_['keys'](_0x26d885['query']);_0x50b870[_0x3aa1('0x31')]=_[_0x3aa1('0x32')](_0x50b870[_0x3aa1('0x30')],_0x50b870['query']);_0x1a4c09['attributes']=_[_0x3aa1('0x32')](_0x50b870[_0x3aa1('0x30')],qs[_0x3aa1('0x33')](_0x26d885[_0x3aa1('0x34')]['fields']));_0x1a4c09[_0x3aa1('0x35')]=_0x1a4c09[_0x3aa1('0x35')][_0x3aa1('0x36')]?_0x1a4c09[_0x3aa1('0x35')]:_0x50b870['model'];if(!_0x26d885[_0x3aa1('0x34')][_0x3aa1('0x37')](_0x3aa1('0x38'))){_0x1a4c09[_0x3aa1('0x39')]=qs[_0x3aa1('0x39')](_0x26d885[_0x3aa1('0x34')]['limit']);_0x1a4c09[_0x3aa1('0x1d')]=qs[_0x3aa1('0x1d')](_0x26d885[_0x3aa1('0x34')]['offset']);}_0x1a4c09[_0x3aa1('0x3a')]=qs[_0x3aa1('0x3b')](_0x26d885[_0x3aa1('0x34')]['sort']);_0x1a4c09[_0x3aa1('0x3c')]=qs[_0x3aa1('0x31')](_[_0x3aa1('0x3d')](_0x26d885[_0x3aa1('0x34')],_0x50b870['filters']),_0x584b42);if(_0x26d885[_0x3aa1('0x34')]['filter']){_0x1a4c09['where']=_[_0x3aa1('0x3e')](_0x1a4c09[_0x3aa1('0x3c')],{'$or':_[_0x3aa1('0x2a')](_0x584b42,function(_0xbd13c3){if(_0xbd13c3[_0x3aa1('0x2e')]!==_0x3aa1('0x3f')){var _0x10cc8e={};_0x10cc8e[_0xbd13c3[_0x3aa1('0x29')]]={'$like':'%'+_0x26d885[_0x3aa1('0x34')][_0x3aa1('0x40')]+'%'};return _0x10cc8e;}})});}_0x1a4c09=_[_0x3aa1('0x3e')]({},_0x1a4c09,_0x26d885[_0x3aa1('0x41')]);var _0x2d7eef={'where':_0x1a4c09[_0x3aa1('0x3c')]};return db['Trigger']['count'](_0x2d7eef)[_0x3aa1('0x24')](function(_0x574d39){_0x99831a['count']=_0x574d39;if(_0x26d885[_0x3aa1('0x34')][_0x3aa1('0x42')]){_0x1a4c09[_0x3aa1('0x43')]=[{'all':!![]}];}return db['Trigger']['findAll'](_0x1a4c09);})[_0x3aa1('0x24')](function(_0x24840e){_0x99831a['rows']=_0x24840e;return _0x99831a;})[_0x3aa1('0x24')](respondWithFilteredResult(_0x5cc824,_0x1a4c09))[_0x3aa1('0x44')](handleError(_0x5cc824,null));};exports[_0x3aa1('0x45')]=function(_0x304837,_0x5ec33c){var _0x3ffcd3={'raw':![],'where':{'id':_0x304837['params']['id']}},_0x45c618={};_0x45c618['model']=_[_0x3aa1('0x46')](db['Trigger'][_0x3aa1('0x2c')]);_0x45c618[_0x3aa1('0x34')]=_[_0x3aa1('0x46')](_0x304837[_0x3aa1('0x34')]);_0x45c618[_0x3aa1('0x31')]=_[_0x3aa1('0x32')](_0x45c618['model'],_0x45c618[_0x3aa1('0x34')]);_0x3ffcd3[_0x3aa1('0x35')]=_['intersection'](_0x45c618[_0x3aa1('0x30')],qs[_0x3aa1('0x33')](_0x304837['query'][_0x3aa1('0x33')]));_0x3ffcd3[_0x3aa1('0x35')]=_0x3ffcd3['attributes'][_0x3aa1('0x36')]?_0x3ffcd3[_0x3aa1('0x35')]:_0x45c618[_0x3aa1('0x30')];if(_0x304837['query'][_0x3aa1('0x42')]){_0x3ffcd3[_0x3aa1('0x43')]=[{'all':!![]}];}_0x3ffcd3=_[_0x3aa1('0x3e')]({},_0x3ffcd3,_0x304837['options']);return db[_0x3aa1('0x2b')]['find'](_0x3ffcd3)[_0x3aa1('0x24')](handleEntityNotFound(_0x5ec33c,null))[_0x3aa1('0x24')](respondWithResult(_0x5ec33c,null))[_0x3aa1('0x44')](handleError(_0x5ec33c,null));};exports[_0x3aa1('0x47')]=function(_0x45e8c3,_0x211607){return db[_0x3aa1('0x2b')][_0x3aa1('0x47')](_0x45e8c3['body'],{})[_0x3aa1('0x24')](function(_0x1b4b3d){var _0x10f1e9=_0x45e8c3['user'][_0x3aa1('0x26')]({'plain':!![]});if(!_0x10f1e9)throw new Error(_0x3aa1('0x48'));if(_0x10f1e9[_0x3aa1('0x49')]===_0x3aa1('0x4a')){var _0x3f92e1=_0x1b4b3d[_0x3aa1('0x26')]({'plain':!![]});var _0x15e698='Triggers';return db['UserProfileSection'][_0x3aa1('0x4b')]({'where':{'name':_0x15e698,'userProfileId':_0x10f1e9[_0x3aa1('0x4c')]},'raw':!![]})[_0x3aa1('0x24')](function(_0x34d440){if(_0x34d440&&_0x34d440[_0x3aa1('0x4d')]===0x0){return db[_0x3aa1('0x4e')][_0x3aa1('0x47')]({'name':_0x3f92e1['name'],'resourceId':_0x3f92e1['id'],'type':_0x34d440[_0x3aa1('0x29')],'sectionId':_0x34d440['id']},{})[_0x3aa1('0x24')](function(){return _0x1b4b3d;});}else{return _0x1b4b3d;}})['catch'](function(_0x296d33){logger['error'](_0x3aa1('0x4f'),_0x296d33);throw _0x296d33;});}return _0x1b4b3d;})[_0x3aa1('0x24')](respondWithResult(_0x211607,0xc9))[_0x3aa1('0x44')](handleError(_0x211607,null));};exports[_0x3aa1('0x23')]=function(_0x543393,_0x25697b){if(_0x543393[_0x3aa1('0x50')]['id']){delete _0x543393[_0x3aa1('0x50')]['id'];}return db[_0x3aa1('0x2b')][_0x3aa1('0x4b')]({'where':{'id':_0x543393[_0x3aa1('0x51')]['id']}})['then'](handleEntityNotFound(_0x25697b,null))[_0x3aa1('0x24')](saveUpdates(_0x543393['body'],null))[_0x3aa1('0x24')](respondWithResult(_0x25697b,null))['catch'](handleError(_0x25697b,null));};exports[_0x3aa1('0x25')]=function(_0x4d482e,_0x4e7fb7){return db['Trigger']['find']({'where':{'id':_0x4d482e[_0x3aa1('0x51')]['id']}})['then'](handleEntityNotFound(_0x4e7fb7,null))['then'](removeEntity(_0x4e7fb7,null))[_0x3aa1('0x44')](handleError(_0x4e7fb7,null));};exports[_0x3aa1('0x52')]=function(_0x1b1169,_0x2471c7,_0x1f8816){if(_0x1b1169[_0x3aa1('0x50')]['id']){delete _0x1b1169[_0x3aa1('0x50')]['id'];}return db[_0x3aa1('0x2b')][_0x3aa1('0x4b')]({'where':{'id':_0x1b1169[_0x3aa1('0x51')]['id']}})[_0x3aa1('0x24')](handleEntityNotFound(_0x2471c7,null))[_0x3aa1('0x24')](function(_0x1e2ab8){if(_0x1e2ab8){_0x1b1169[_0x3aa1('0x50')]['TriggerAllId']=_0x1e2ab8['id'];return db[_0x3aa1('0x53')][_0x3aa1('0x47')](_0x1b1169[_0x3aa1('0x50')]);}})[_0x3aa1('0x24')](respondWithResult(_0x2471c7,null))['catch'](handleError(_0x2471c7,null));};exports[_0x3aa1('0x54')]=function(_0x52973a,_0x23476d,_0x19fb60){if(_0x52973a['body']['id']){delete _0x52973a['body']['id'];}return db[_0x3aa1('0x2b')]['find']({'where':{'id':_0x52973a[_0x3aa1('0x51')]['id']}})[_0x3aa1('0x24')](handleEntityNotFound(_0x23476d,null))[_0x3aa1('0x24')](function(_0x50deff){if(_0x50deff){_0x52973a['body']['TriggerAnyId']=_0x50deff['id'];return db[_0x3aa1('0x53')][_0x3aa1('0x47')](_0x52973a[_0x3aa1('0x50')]);}})[_0x3aa1('0x24')](respondWithResult(_0x23476d,null))[_0x3aa1('0x44')](handleError(_0x23476d,null));};exports[_0x3aa1('0x55')]=function(_0x8a7490,_0x24dce4,_0x579c8e){var _0x514d3e={};var _0x4e3ab6={};var _0x23ebe9;var _0x367176;return db[_0x3aa1('0x2b')][_0x3aa1('0x56')]({'where':{'id':_0x8a7490[_0x3aa1('0x51')]['id']}})[_0x3aa1('0x24')](handleEntityNotFound(_0x24dce4,null))[_0x3aa1('0x24')](function(_0x8ef360){if(_0x8ef360){_0x23ebe9=_0x8ef360;_0x4e3ab6['model']=_['keys'](db[_0x3aa1('0x53')][_0x3aa1('0x2c')]);_0x4e3ab6[_0x3aa1('0x34')]=_[_0x3aa1('0x46')](_0x8a7490[_0x3aa1('0x34')]);_0x4e3ab6[_0x3aa1('0x31')]=_['intersection'](_0x4e3ab6[_0x3aa1('0x30')],_0x4e3ab6['query']);_0x514d3e[_0x3aa1('0x35')]=_[_0x3aa1('0x32')](_0x4e3ab6[_0x3aa1('0x30')],qs['fields'](_0x8a7490[_0x3aa1('0x34')][_0x3aa1('0x33')]));_0x514d3e[_0x3aa1('0x35')]=_0x514d3e['attributes'][_0x3aa1('0x36')]?_0x514d3e[_0x3aa1('0x35')]:_0x4e3ab6[_0x3aa1('0x30')];_0x514d3e[_0x3aa1('0x3a')]=qs[_0x3aa1('0x3b')](_0x8a7490['query']['sort']);_0x514d3e[_0x3aa1('0x3c')]=qs[_0x3aa1('0x31')](_[_0x3aa1('0x3d')](_0x8a7490[_0x3aa1('0x34')],_0x4e3ab6['filters']));if(_0x8a7490[_0x3aa1('0x34')]['filter']){_0x514d3e['where']=_[_0x3aa1('0x3e')](_0x514d3e['where'],{'$or':_[_0x3aa1('0x2a')](_0x514d3e['attributes'],function(_0x3104fb){var _0x38dea5={};_0x38dea5[_0x3104fb]={'$like':'%'+_0x8a7490[_0x3aa1('0x34')]['filter']+'%'};return _0x38dea5;})});}_0x514d3e=_[_0x3aa1('0x3e')]({},_0x514d3e,_0x8a7490[_0x3aa1('0x41')]);return _0x23ebe9['getAllConditions'](_0x514d3e);}})[_0x3aa1('0x24')](function(_0x2c9439){if(_0x2c9439){_0x367176=_0x2c9439['length'];if(!_0x8a7490[_0x3aa1('0x34')]['hasOwnProperty'](_0x3aa1('0x38'))){_0x514d3e[_0x3aa1('0x39')]=qs[_0x3aa1('0x39')](_0x8a7490['query'][_0x3aa1('0x39')]);_0x514d3e['offset']=qs[_0x3aa1('0x1d')](_0x8a7490[_0x3aa1('0x34')][_0x3aa1('0x1d')]);}return _0x23ebe9[_0x3aa1('0x55')](_0x514d3e);}})[_0x3aa1('0x24')](function(_0x225b36){if(_0x225b36){return _0x225b36?{'count':_0x367176,'rows':_0x225b36}:null;}})[_0x3aa1('0x24')](respondWithResult(_0x24dce4,null))[_0x3aa1('0x44')](handleError(_0x24dce4,null));};exports[_0x3aa1('0x57')]=function(_0x27b112,_0x7b1ae3,_0x1730ad){var _0x23ecf1={};var _0x326907={};var _0x3cd2b6;var _0x59e821;return db[_0x3aa1('0x2b')][_0x3aa1('0x56')]({'where':{'id':_0x27b112[_0x3aa1('0x51')]['id']}})[_0x3aa1('0x24')](handleEntityNotFound(_0x7b1ae3,null))[_0x3aa1('0x24')](function(_0x19dc44){if(_0x19dc44){_0x3cd2b6=_0x19dc44;_0x326907[_0x3aa1('0x30')]=_[_0x3aa1('0x46')](db[_0x3aa1('0x53')][_0x3aa1('0x2c')]);_0x326907[_0x3aa1('0x34')]=_[_0x3aa1('0x46')](_0x27b112[_0x3aa1('0x34')]);_0x326907[_0x3aa1('0x31')]=_[_0x3aa1('0x32')](_0x326907['model'],_0x326907[_0x3aa1('0x34')]);_0x23ecf1['attributes']=_[_0x3aa1('0x32')](_0x326907[_0x3aa1('0x30')],qs[_0x3aa1('0x33')](_0x27b112['query'][_0x3aa1('0x33')]));_0x23ecf1[_0x3aa1('0x35')]=_0x23ecf1[_0x3aa1('0x35')]['length']?_0x23ecf1[_0x3aa1('0x35')]:_0x326907[_0x3aa1('0x30')];_0x23ecf1['order']=qs[_0x3aa1('0x3b')](_0x27b112[_0x3aa1('0x34')][_0x3aa1('0x3b')]);_0x23ecf1['where']=qs[_0x3aa1('0x31')](_[_0x3aa1('0x3d')](_0x27b112[_0x3aa1('0x34')],_0x326907[_0x3aa1('0x31')]));if(_0x27b112['query'][_0x3aa1('0x40')]){_0x23ecf1['where']=_['merge'](_0x23ecf1[_0x3aa1('0x3c')],{'$or':_[_0x3aa1('0x2a')](_0x23ecf1['attributes'],function(_0x5cb96a){var _0x505509={};_0x505509[_0x5cb96a]={'$like':'%'+_0x27b112[_0x3aa1('0x34')]['filter']+'%'};return _0x505509;})});}_0x23ecf1=_[_0x3aa1('0x3e')]({},_0x23ecf1,_0x27b112[_0x3aa1('0x41')]);return _0x3cd2b6[_0x3aa1('0x57')](_0x23ecf1);}})[_0x3aa1('0x24')](function(_0x559a0f){if(_0x559a0f){_0x59e821=_0x559a0f[_0x3aa1('0x36')];if(!_0x27b112[_0x3aa1('0x34')]['hasOwnProperty'](_0x3aa1('0x38'))){_0x23ecf1[_0x3aa1('0x39')]=qs[_0x3aa1('0x39')](_0x27b112[_0x3aa1('0x34')]['limit']);_0x23ecf1[_0x3aa1('0x1d')]=qs[_0x3aa1('0x1d')](_0x27b112['query']['offset']);}return _0x3cd2b6[_0x3aa1('0x57')](_0x23ecf1);}})[_0x3aa1('0x24')](function(_0x39db2d){if(_0x39db2d){return _0x39db2d?{'count':_0x59e821,'rows':_0x39db2d}:null;}})[_0x3aa1('0x24')](respondWithResult(_0x7b1ae3,null))['catch'](handleError(_0x7b1ae3,null));};exports[_0x3aa1('0x58')]=function(_0x4e30cd,_0x21d245,_0x3a9499){if(_0x4e30cd[_0x3aa1('0x50')]['id']){delete _0x4e30cd[_0x3aa1('0x50')]['id'];}return db['Trigger'][_0x3aa1('0x4b')]({'where':{'id':_0x4e30cd[_0x3aa1('0x51')]['id']}})[_0x3aa1('0x24')](handleEntityNotFound(_0x21d245,null))[_0x3aa1('0x24')](function(_0x2c291a){if(_0x2c291a){_0x4e30cd[_0x3aa1('0x50')]['TriggerId']=_0x2c291a['id'];return db[_0x3aa1('0x59')][_0x3aa1('0x47')](_0x4e30cd['body']);}})[_0x3aa1('0x24')](respondWithResult(_0x21d245,null))['catch'](handleError(_0x21d245,null));};exports[_0x3aa1('0x5a')]=function(_0x3f40b9,_0x2c398e,_0x9ef069){var _0x46230c={};var _0x40fb91={};var _0x197f57;var _0x311c07;return db['Trigger'][_0x3aa1('0x56')]({'where':{'id':_0x3f40b9[_0x3aa1('0x51')]['id']}})[_0x3aa1('0x24')](handleEntityNotFound(_0x2c398e,null))['then'](function(_0x519bdb){if(_0x519bdb){_0x197f57=_0x519bdb;_0x40fb91[_0x3aa1('0x30')]=_[_0x3aa1('0x46')](db[_0x3aa1('0x59')]['rawAttributes']);_0x40fb91[_0x3aa1('0x34')]=_['keys'](_0x3f40b9[_0x3aa1('0x34')]);_0x40fb91[_0x3aa1('0x31')]=_['intersection'](_0x40fb91[_0x3aa1('0x30')],_0x40fb91[_0x3aa1('0x34')]);_0x46230c['attributes']=_[_0x3aa1('0x32')](_0x40fb91[_0x3aa1('0x30')],qs[_0x3aa1('0x33')](_0x3f40b9['query'][_0x3aa1('0x33')]));_0x46230c['attributes']=_0x46230c['attributes'][_0x3aa1('0x36')]?_0x46230c['attributes']:_0x40fb91[_0x3aa1('0x30')];_0x46230c[_0x3aa1('0x3a')]=qs[_0x3aa1('0x3b')](_0x3f40b9[_0x3aa1('0x34')][_0x3aa1('0x3b')]);_0x46230c[_0x3aa1('0x3c')]=qs[_0x3aa1('0x31')](_['pick'](_0x3f40b9[_0x3aa1('0x34')],_0x40fb91[_0x3aa1('0x31')]));if(_0x3f40b9['query'][_0x3aa1('0x40')]){_0x46230c[_0x3aa1('0x3c')]=_[_0x3aa1('0x3e')](_0x46230c[_0x3aa1('0x3c')],{'$or':_[_0x3aa1('0x2a')](_0x46230c[_0x3aa1('0x35')],function(_0x2caea8){var _0x5b0b6b={};_0x5b0b6b[_0x2caea8]={'$like':'%'+_0x3f40b9[_0x3aa1('0x34')]['filter']+'%'};return _0x5b0b6b;})});}_0x46230c=_['merge']({},_0x46230c,_0x3f40b9['options']);return _0x197f57['getActions'](_0x46230c);}})['then'](function(_0x4351fb){if(_0x4351fb){_0x311c07=_0x4351fb[_0x3aa1('0x36')];if(!_0x3f40b9[_0x3aa1('0x34')][_0x3aa1('0x37')](_0x3aa1('0x38'))){_0x46230c[_0x3aa1('0x39')]=qs[_0x3aa1('0x39')](_0x3f40b9['query']['limit']);_0x46230c[_0x3aa1('0x1d')]=qs[_0x3aa1('0x1d')](_0x3f40b9[_0x3aa1('0x34')]['offset']);}return _0x197f57[_0x3aa1('0x5a')](_0x46230c);}})[_0x3aa1('0x24')](function(_0x449915){if(_0x449915){return _0x449915?{'count':_0x311c07,'rows':_0x449915}:null;}})[_0x3aa1('0x24')](respondWithResult(_0x2c398e,null))[_0x3aa1('0x44')](handleError(_0x2c398e,null));}; \ No newline at end of file +var _0x5375=['../../config/utils','../../config/environment','../../config/license/util','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Triggers','end','error','stack','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','Condition','addAnyCondition','getAllConditions','length','order','nolimit','getAnyConditions','findOne','addAction','TriggerId','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x5375,0xa6));var _0x5537=function(_0x4a5c1d,_0x3ad1a2){_0x4a5c1d=_0x4a5c1d-0x0;var _0x49326a=_0x5375[_0x4a5c1d];return _0x49326a;};'use strict';var emlformat=require(_0x5537('0x0'));var rimraf=require(_0x5537('0x1'));var zipdir=require(_0x5537('0x2'));var jsonpatch=require(_0x5537('0x3'));var rp=require(_0x5537('0x4'));var moment=require(_0x5537('0x5'));var BPromise=require(_0x5537('0x6'));var Mustache=require('mustache');var util=require(_0x5537('0x7'));var path=require('path');var sox=require(_0x5537('0x8'));var csv=require(_0x5537('0x9'));var ejs=require(_0x5537('0xa'));var fs=require('fs');var fs_extra=require(_0x5537('0xb'));var _=require(_0x5537('0xc'));var squel=require(_0x5537('0xd'));var crypto=require(_0x5537('0xe'));var jsforce=require(_0x5537('0xf'));var deskjs=require(_0x5537('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5537('0x11'));var Redis=require(_0x5537('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5537('0x13'));var as=require(_0x5537('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5537('0x15'))('api');var utils=require(_0x5537('0x16'));var config=require(_0x5537('0x17'));var licenseUtil=require(_0x5537('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9573df,_0x139b52){_0x139b52=_0x139b52||0xcc;return function(_0x42fdb5){if(_0x42fdb5){return _0x9573df['sendStatus'](_0x139b52);}return _0x9573df['status'](_0x139b52)['end']();};}function respondWithResult(_0x21bd44,_0x3ff00e){_0x3ff00e=_0x3ff00e||0xc8;return function(_0x4c1b62){if(_0x4c1b62){return _0x21bd44['status'](_0x3ff00e)['json'](_0x4c1b62);}};}function respondWithFilteredResult(_0x39d60f,_0x1afde3){return function(_0x4c8f6b){if(_0x4c8f6b){var _0x4b3f21=typeof _0x1afde3[_0x5537('0x19')]==='undefined'&&typeof _0x1afde3[_0x5537('0x1a')]===_0x5537('0x1b');var _0x5ba09d=_0x4c8f6b['count'];var _0x5c0974=_0x4b3f21?0x0:_0x1afde3[_0x5537('0x19')];var _0x5a28b0=_0x4b3f21?_0x4c8f6b[_0x5537('0x1c')]:_0x1afde3[_0x5537('0x19')]+_0x1afde3['limit'];var _0x2872ac;if(_0x5a28b0>=_0x5ba09d){_0x5a28b0=_0x5ba09d;_0x2872ac=0xc8;}else{_0x2872ac=0xce;}_0x39d60f['status'](_0x2872ac);return _0x39d60f[_0x5537('0x1d')](_0x5537('0x1e'),_0x5c0974+'-'+_0x5a28b0+'/'+_0x5ba09d)[_0x5537('0x1f')](_0x4c8f6b);}return null;};}function patchUpdates(_0x5ae926){return function(_0x50b14b){try{jsonpatch[_0x5537('0x20')](_0x50b14b,_0x5ae926,!![]);}catch(_0x498881){return BPromise[_0x5537('0x21')](_0x498881);}return _0x50b14b[_0x5537('0x22')]();};}function saveUpdates(_0x2ccdac,_0x5245ce){return function(_0x538ff9){if(_0x538ff9){return _0x538ff9[_0x5537('0x23')](_0x2ccdac)[_0x5537('0x24')](function(_0x5955a7){return _0x5955a7;});}return null;};}function removeEntity(_0x91f3af,_0x4ada0d){return function(_0x1d16de){if(_0x1d16de){return _0x1d16de[_0x5537('0x25')]()[_0x5537('0x24')](function(){var _0x1b8e95=_0x1d16de[_0x5537('0x26')]({'plain':!![]});var _0x34e76e=_0x5537('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x34e76e,'resourceId':_0x1b8e95['id']}})[_0x5537('0x24')](function(){return _0x1d16de;});})[_0x5537('0x24')](function(){_0x91f3af['status'](0xcc)[_0x5537('0x28')]();});}};}function handleEntityNotFound(_0x2a69eb,_0x5405a4){return function(_0x2e8ec2){if(!_0x2e8ec2){_0x2a69eb['sendStatus'](0x194);}return _0x2e8ec2;};}function handleError(_0x61c41e,_0x405f39){_0x405f39=_0x405f39||0x1f4;return function(_0x498c23){logger[_0x5537('0x29')](_0x498c23[_0x5537('0x2a')]);if(_0x498c23['name']){delete _0x498c23['name'];}_0x61c41e['status'](_0x405f39)[_0x5537('0x2b')](_0x498c23);};}exports[_0x5537('0x2c')]=function(_0x4e1935,_0xd02e0e){var _0x2c7858={},_0x5796f1={},_0x555fdc={'count':0x0,'rows':[]};var _0x4bebf7=_[_0x5537('0x2d')](db[_0x5537('0x2e')][_0x5537('0x2f')],function(_0x4e32c4){return{'name':_0x4e32c4[_0x5537('0x30')],'type':_0x4e32c4[_0x5537('0x31')][_0x5537('0x32')]};});_0x5796f1[_0x5537('0x33')]=_[_0x5537('0x2d')](_0x4bebf7,_0x5537('0x34'));_0x5796f1[_0x5537('0x35')]=_[_0x5537('0x36')](_0x4e1935['query']);_0x5796f1[_0x5537('0x37')]=_[_0x5537('0x38')](_0x5796f1[_0x5537('0x33')],_0x5796f1[_0x5537('0x35')]);_0x2c7858[_0x5537('0x39')]=_[_0x5537('0x38')](_0x5796f1['model'],qs[_0x5537('0x3a')](_0x4e1935[_0x5537('0x35')][_0x5537('0x3a')]));_0x2c7858[_0x5537('0x39')]=_0x2c7858[_0x5537('0x39')]['length']?_0x2c7858[_0x5537('0x39')]:_0x5796f1[_0x5537('0x33')];if(!_0x4e1935[_0x5537('0x35')][_0x5537('0x3b')]('nolimit')){_0x2c7858[_0x5537('0x1a')]=qs[_0x5537('0x1a')](_0x4e1935[_0x5537('0x35')][_0x5537('0x1a')]);_0x2c7858[_0x5537('0x19')]=qs['offset'](_0x4e1935[_0x5537('0x35')][_0x5537('0x19')]);}_0x2c7858['order']=qs[_0x5537('0x3c')](_0x4e1935['query'][_0x5537('0x3c')]);_0x2c7858['where']=qs[_0x5537('0x37')](_[_0x5537('0x3d')](_0x4e1935[_0x5537('0x35')],_0x5796f1[_0x5537('0x37')]),_0x4bebf7);if(_0x4e1935[_0x5537('0x35')][_0x5537('0x3e')]){_0x2c7858[_0x5537('0x3f')]=_[_0x5537('0x40')](_0x2c7858['where'],{'$or':_[_0x5537('0x2d')](_0x4bebf7,function(_0x4dfdbb){if(_0x4dfdbb['type']!==_0x5537('0x41')){var _0x4111f6={};_0x4111f6[_0x4dfdbb['name']]={'$like':'%'+_0x4e1935[_0x5537('0x35')][_0x5537('0x3e')]+'%'};return _0x4111f6;}})});}_0x2c7858=_[_0x5537('0x40')]({},_0x2c7858,_0x4e1935[_0x5537('0x42')]);var _0x31d32d={'where':_0x2c7858[_0x5537('0x3f')]};return db[_0x5537('0x2e')][_0x5537('0x1c')](_0x31d32d)[_0x5537('0x24')](function(_0x1e1e2f){_0x555fdc[_0x5537('0x1c')]=_0x1e1e2f;if(_0x4e1935[_0x5537('0x35')][_0x5537('0x43')]){_0x2c7858[_0x5537('0x44')]=[{'all':!![]}];}return db[_0x5537('0x2e')][_0x5537('0x45')](_0x2c7858);})[_0x5537('0x24')](function(_0x2f4068){_0x555fdc[_0x5537('0x46')]=_0x2f4068;return _0x555fdc;})[_0x5537('0x24')](respondWithFilteredResult(_0xd02e0e,_0x2c7858))[_0x5537('0x47')](handleError(_0xd02e0e,null));};exports['show']=function(_0x503ba2,_0x2a1217){var _0x1a6c76={'raw':![],'where':{'id':_0x503ba2[_0x5537('0x48')]['id']}},_0x1f8c8f={};_0x1f8c8f[_0x5537('0x33')]=_[_0x5537('0x36')](db[_0x5537('0x2e')][_0x5537('0x2f')]);_0x1f8c8f[_0x5537('0x35')]=_[_0x5537('0x36')](_0x503ba2[_0x5537('0x35')]);_0x1f8c8f['filters']=_[_0x5537('0x38')](_0x1f8c8f[_0x5537('0x33')],_0x1f8c8f[_0x5537('0x35')]);_0x1a6c76[_0x5537('0x39')]=_[_0x5537('0x38')](_0x1f8c8f[_0x5537('0x33')],qs['fields'](_0x503ba2[_0x5537('0x35')]['fields']));_0x1a6c76[_0x5537('0x39')]=_0x1a6c76[_0x5537('0x39')]['length']?_0x1a6c76[_0x5537('0x39')]:_0x1f8c8f[_0x5537('0x33')];if(_0x503ba2[_0x5537('0x35')][_0x5537('0x43')]){_0x1a6c76['include']=[{'all':!![]}];}_0x1a6c76=_[_0x5537('0x40')]({},_0x1a6c76,_0x503ba2[_0x5537('0x42')]);return db[_0x5537('0x2e')][_0x5537('0x49')](_0x1a6c76)['then'](handleEntityNotFound(_0x2a1217,null))[_0x5537('0x24')](respondWithResult(_0x2a1217,null))[_0x5537('0x47')](handleError(_0x2a1217,null));};exports['create']=function(_0x48e5c1,_0x36031c){return db[_0x5537('0x2e')][_0x5537('0x4a')](_0x48e5c1['body'],{})['then'](function(_0x24a406){var _0xd27c40=_0x48e5c1['user']['get']({'plain':!![]});if(!_0xd27c40)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd27c40[_0x5537('0x4b')]===_0x5537('0x4c')){var _0x4d733b=_0x24a406[_0x5537('0x26')]({'plain':!![]});var _0x4a4008=_0x5537('0x27');return db[_0x5537('0x4d')]['find']({'where':{'name':_0x4a4008,'userProfileId':_0xd27c40[_0x5537('0x4e')]},'raw':!![]})[_0x5537('0x24')](function(_0x58ae0f){if(_0x58ae0f&&_0x58ae0f['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4d733b[_0x5537('0x34')],'resourceId':_0x4d733b['id'],'type':_0x58ae0f[_0x5537('0x34')],'sectionId':_0x58ae0f['id']},{})['then'](function(){return _0x24a406;});}else{return _0x24a406;}})[_0x5537('0x47')](function(_0x1e2a03){logger[_0x5537('0x29')](_0x5537('0x4f'),_0x1e2a03);throw _0x1e2a03;});}return _0x24a406;})[_0x5537('0x24')](respondWithResult(_0x36031c,0xc9))['catch'](handleError(_0x36031c,null));};exports[_0x5537('0x23')]=function(_0x2222f1,_0x419261){if(_0x2222f1[_0x5537('0x50')]['id']){delete _0x2222f1[_0x5537('0x50')]['id'];}return db[_0x5537('0x2e')][_0x5537('0x49')]({'where':{'id':_0x2222f1['params']['id']}})[_0x5537('0x24')](handleEntityNotFound(_0x419261,null))['then'](saveUpdates(_0x2222f1[_0x5537('0x50')],null))['then'](respondWithResult(_0x419261,null))['catch'](handleError(_0x419261,null));};exports[_0x5537('0x25')]=function(_0x1c8d56,_0xb80b9){return db[_0x5537('0x2e')][_0x5537('0x49')]({'where':{'id':_0x1c8d56[_0x5537('0x48')]['id']}})['then'](handleEntityNotFound(_0xb80b9,null))[_0x5537('0x24')](removeEntity(_0xb80b9,null))[_0x5537('0x47')](handleError(_0xb80b9,null));};exports[_0x5537('0x51')]=function(_0x1b6c68,_0x282205,_0x4b7e1b){if(_0x1b6c68[_0x5537('0x50')]['id']){delete _0x1b6c68[_0x5537('0x50')]['id'];}return db['Trigger'][_0x5537('0x49')]({'where':{'id':_0x1b6c68[_0x5537('0x48')]['id']}})[_0x5537('0x24')](handleEntityNotFound(_0x282205,null))['then'](function(_0x3ec7d1){if(_0x3ec7d1){_0x1b6c68[_0x5537('0x50')]['TriggerAllId']=_0x3ec7d1['id'];return db[_0x5537('0x52')][_0x5537('0x4a')](_0x1b6c68[_0x5537('0x50')]);}})[_0x5537('0x24')](respondWithResult(_0x282205,null))[_0x5537('0x47')](handleError(_0x282205,null));};exports[_0x5537('0x53')]=function(_0x3b4537,_0x40e2d4,_0x264b31){if(_0x3b4537[_0x5537('0x50')]['id']){delete _0x3b4537[_0x5537('0x50')]['id'];}return db[_0x5537('0x2e')]['find']({'where':{'id':_0x3b4537['params']['id']}})[_0x5537('0x24')](handleEntityNotFound(_0x40e2d4,null))[_0x5537('0x24')](function(_0x152400){if(_0x152400){_0x3b4537[_0x5537('0x50')]['TriggerAnyId']=_0x152400['id'];return db['Condition'][_0x5537('0x4a')](_0x3b4537[_0x5537('0x50')]);}})['then'](respondWithResult(_0x40e2d4,null))[_0x5537('0x47')](handleError(_0x40e2d4,null));};exports[_0x5537('0x54')]=function(_0x12bb3c,_0xddfa6c,_0x3fc64b){var _0xeefe05={};var _0x5877d1={};var _0x37d4d9;var _0x5c1235;return db[_0x5537('0x2e')]['findOne']({'where':{'id':_0x12bb3c[_0x5537('0x48')]['id']}})[_0x5537('0x24')](handleEntityNotFound(_0xddfa6c,null))[_0x5537('0x24')](function(_0x20a576){if(_0x20a576){_0x37d4d9=_0x20a576;_0x5877d1[_0x5537('0x33')]=_[_0x5537('0x36')](db[_0x5537('0x52')][_0x5537('0x2f')]);_0x5877d1[_0x5537('0x35')]=_[_0x5537('0x36')](_0x12bb3c['query']);_0x5877d1[_0x5537('0x37')]=_[_0x5537('0x38')](_0x5877d1[_0x5537('0x33')],_0x5877d1[_0x5537('0x35')]);_0xeefe05[_0x5537('0x39')]=_[_0x5537('0x38')](_0x5877d1[_0x5537('0x33')],qs[_0x5537('0x3a')](_0x12bb3c[_0x5537('0x35')][_0x5537('0x3a')]));_0xeefe05[_0x5537('0x39')]=_0xeefe05[_0x5537('0x39')][_0x5537('0x55')]?_0xeefe05[_0x5537('0x39')]:_0x5877d1['model'];_0xeefe05[_0x5537('0x56')]=qs[_0x5537('0x3c')](_0x12bb3c[_0x5537('0x35')][_0x5537('0x3c')]);_0xeefe05['where']=qs[_0x5537('0x37')](_[_0x5537('0x3d')](_0x12bb3c[_0x5537('0x35')],_0x5877d1[_0x5537('0x37')]));if(_0x12bb3c[_0x5537('0x35')]['filter']){_0xeefe05[_0x5537('0x3f')]=_['merge'](_0xeefe05[_0x5537('0x3f')],{'$or':_[_0x5537('0x2d')](_0xeefe05[_0x5537('0x39')],function(_0x53412e){var _0x19192c={};_0x19192c[_0x53412e]={'$like':'%'+_0x12bb3c[_0x5537('0x35')]['filter']+'%'};return _0x19192c;})});}_0xeefe05=_[_0x5537('0x40')]({},_0xeefe05,_0x12bb3c['options']);return _0x37d4d9[_0x5537('0x54')](_0xeefe05);}})[_0x5537('0x24')](function(_0x3e4ba9){if(_0x3e4ba9){_0x5c1235=_0x3e4ba9[_0x5537('0x55')];if(!_0x12bb3c[_0x5537('0x35')][_0x5537('0x3b')](_0x5537('0x57'))){_0xeefe05[_0x5537('0x1a')]=qs[_0x5537('0x1a')](_0x12bb3c[_0x5537('0x35')][_0x5537('0x1a')]);_0xeefe05[_0x5537('0x19')]=qs[_0x5537('0x19')](_0x12bb3c[_0x5537('0x35')]['offset']);}return _0x37d4d9[_0x5537('0x54')](_0xeefe05);}})['then'](function(_0x42ae59){if(_0x42ae59){return _0x42ae59?{'count':_0x5c1235,'rows':_0x42ae59}:null;}})[_0x5537('0x24')](respondWithResult(_0xddfa6c,null))[_0x5537('0x47')](handleError(_0xddfa6c,null));};exports[_0x5537('0x58')]=function(_0x30940e,_0x95950c,_0x4932ca){var _0x206408={};var _0x5f1e56={};var _0x7e74a9;var _0x23e1ce;return db['Trigger'][_0x5537('0x59')]({'where':{'id':_0x30940e['params']['id']}})[_0x5537('0x24')](handleEntityNotFound(_0x95950c,null))[_0x5537('0x24')](function(_0x1df049){if(_0x1df049){_0x7e74a9=_0x1df049;_0x5f1e56[_0x5537('0x33')]=_['keys'](db[_0x5537('0x52')][_0x5537('0x2f')]);_0x5f1e56[_0x5537('0x35')]=_[_0x5537('0x36')](_0x30940e[_0x5537('0x35')]);_0x5f1e56[_0x5537('0x37')]=_[_0x5537('0x38')](_0x5f1e56['model'],_0x5f1e56[_0x5537('0x35')]);_0x206408[_0x5537('0x39')]=_[_0x5537('0x38')](_0x5f1e56[_0x5537('0x33')],qs[_0x5537('0x3a')](_0x30940e[_0x5537('0x35')][_0x5537('0x3a')]));_0x206408[_0x5537('0x39')]=_0x206408[_0x5537('0x39')][_0x5537('0x55')]?_0x206408['attributes']:_0x5f1e56[_0x5537('0x33')];_0x206408[_0x5537('0x56')]=qs['sort'](_0x30940e['query'][_0x5537('0x3c')]);_0x206408['where']=qs[_0x5537('0x37')](_[_0x5537('0x3d')](_0x30940e[_0x5537('0x35')],_0x5f1e56['filters']));if(_0x30940e[_0x5537('0x35')]['filter']){_0x206408[_0x5537('0x3f')]=_[_0x5537('0x40')](_0x206408[_0x5537('0x3f')],{'$or':_[_0x5537('0x2d')](_0x206408['attributes'],function(_0x24f6e5){var _0x1247b1={};_0x1247b1[_0x24f6e5]={'$like':'%'+_0x30940e[_0x5537('0x35')][_0x5537('0x3e')]+'%'};return _0x1247b1;})});}_0x206408=_[_0x5537('0x40')]({},_0x206408,_0x30940e[_0x5537('0x42')]);return _0x7e74a9['getAnyConditions'](_0x206408);}})[_0x5537('0x24')](function(_0x1b22af){if(_0x1b22af){_0x23e1ce=_0x1b22af[_0x5537('0x55')];if(!_0x30940e['query'][_0x5537('0x3b')]('nolimit')){_0x206408[_0x5537('0x1a')]=qs[_0x5537('0x1a')](_0x30940e[_0x5537('0x35')][_0x5537('0x1a')]);_0x206408['offset']=qs[_0x5537('0x19')](_0x30940e['query']['offset']);}return _0x7e74a9['getAnyConditions'](_0x206408);}})[_0x5537('0x24')](function(_0x29913c){if(_0x29913c){return _0x29913c?{'count':_0x23e1ce,'rows':_0x29913c}:null;}})['then'](respondWithResult(_0x95950c,null))['catch'](handleError(_0x95950c,null));};exports[_0x5537('0x5a')]=function(_0x304e08,_0x538735,_0x3d49a2){if(_0x304e08[_0x5537('0x50')]['id']){delete _0x304e08[_0x5537('0x50')]['id'];}return db[_0x5537('0x2e')][_0x5537('0x49')]({'where':{'id':_0x304e08['params']['id']}})[_0x5537('0x24')](handleEntityNotFound(_0x538735,null))['then'](function(_0x3238cd){if(_0x3238cd){_0x304e08[_0x5537('0x50')][_0x5537('0x5b')]=_0x3238cd['id'];return db['Action']['create'](_0x304e08['body']);}})['then'](respondWithResult(_0x538735,null))[_0x5537('0x47')](handleError(_0x538735,null));};exports[_0x5537('0x5c')]=function(_0x4c183a,_0x5276e1,_0x31f6ad){var _0x7b06a1={};var _0x2bd6fd={};var _0x568b91;var _0x24e447;return db[_0x5537('0x2e')][_0x5537('0x59')]({'where':{'id':_0x4c183a[_0x5537('0x48')]['id']}})[_0x5537('0x24')](handleEntityNotFound(_0x5276e1,null))[_0x5537('0x24')](function(_0x53e572){if(_0x53e572){_0x568b91=_0x53e572;_0x2bd6fd[_0x5537('0x33')]=_[_0x5537('0x36')](db[_0x5537('0x5d')][_0x5537('0x2f')]);_0x2bd6fd['query']=_[_0x5537('0x36')](_0x4c183a[_0x5537('0x35')]);_0x2bd6fd[_0x5537('0x37')]=_['intersection'](_0x2bd6fd[_0x5537('0x33')],_0x2bd6fd['query']);_0x7b06a1[_0x5537('0x39')]=_[_0x5537('0x38')](_0x2bd6fd[_0x5537('0x33')],qs[_0x5537('0x3a')](_0x4c183a[_0x5537('0x35')]['fields']));_0x7b06a1['attributes']=_0x7b06a1[_0x5537('0x39')][_0x5537('0x55')]?_0x7b06a1[_0x5537('0x39')]:_0x2bd6fd['model'];_0x7b06a1[_0x5537('0x56')]=qs[_0x5537('0x3c')](_0x4c183a[_0x5537('0x35')]['sort']);_0x7b06a1['where']=qs[_0x5537('0x37')](_['pick'](_0x4c183a[_0x5537('0x35')],_0x2bd6fd[_0x5537('0x37')]));if(_0x4c183a['query'][_0x5537('0x3e')]){_0x7b06a1[_0x5537('0x3f')]=_[_0x5537('0x40')](_0x7b06a1[_0x5537('0x3f')],{'$or':_[_0x5537('0x2d')](_0x7b06a1['attributes'],function(_0x143d33){var _0x279789={};_0x279789[_0x143d33]={'$like':'%'+_0x4c183a[_0x5537('0x35')][_0x5537('0x3e')]+'%'};return _0x279789;})});}_0x7b06a1=_[_0x5537('0x40')]({},_0x7b06a1,_0x4c183a[_0x5537('0x42')]);return _0x568b91[_0x5537('0x5c')](_0x7b06a1);}})['then'](function(_0x27e991){if(_0x27e991){_0x24e447=_0x27e991[_0x5537('0x55')];if(!_0x4c183a['query'][_0x5537('0x3b')](_0x5537('0x57'))){_0x7b06a1[_0x5537('0x1a')]=qs['limit'](_0x4c183a[_0x5537('0x35')][_0x5537('0x1a')]);_0x7b06a1['offset']=qs[_0x5537('0x19')](_0x4c183a[_0x5537('0x35')]['offset']);}return _0x568b91['getActions'](_0x7b06a1);}})['then'](function(_0x2dab27){if(_0x2dab27){return _0x2dab27?{'count':_0x24e447,'rows':_0x2dab27}:null;}})[_0x5537('0x24')](respondWithResult(_0x5276e1,null))[_0x5537('0x47')](handleError(_0x5276e1,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index e6d6012..d462718 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 _0x4abf=['rimraf','exports','define','tools_triggers','lodash','util','api','path'];(function(_0x5880b8,_0x42f10e){var _0x24039a=function(_0x2b32a7){while(--_0x2b32a7){_0x5880b8['push'](_0x5880b8['shift']());}};_0x24039a(++_0x42f10e);}(_0x4abf,0xac));var _0xf4ab=function(_0x29105c,_0x1dd29f){_0x29105c=_0x29105c-0x0;var _0x16be8d=_0x4abf[_0x29105c];return _0x16be8d;};'use strict';var _=require(_0xf4ab('0x0'));var util=require(_0xf4ab('0x1'));var logger=require('../../config/logger')(_0xf4ab('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4ab('0x3'));var rimraf=require(_0xf4ab('0x4'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0xf4ab('0x5')]=function(_0x4160fb,_0x2e6efe){return _0x4160fb[_0xf4ab('0x6')]('Trigger',attributes,{'tableName':_0xf4ab('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec39=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./trigger.attributes','define','Trigger','tools_triggers','lodash'];(function(_0x3012e3,_0x538392){var _0x56c48d=function(_0x74555a){while(--_0x74555a){_0x3012e3['push'](_0x3012e3['shift']());}};_0x56c48d(++_0x538392);}(_0xec39,0x19f));var _0x9ec3=function(_0x4c0c90,_0x553b47){_0x4c0c90=_0x4c0c90-0x0;var _0x463b85=_0xec39[_0x4c0c90];return _0x463b85;};'use strict';var _=require(_0x9ec3('0x0'));var util=require(_0x9ec3('0x1'));var logger=require(_0x9ec3('0x2'))(_0x9ec3('0x3'));var moment=require(_0x9ec3('0x4'));var BPromise=require(_0x9ec3('0x5'));var rp=require(_0x9ec3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ec3('0x7'));var config=require(_0x9ec3('0x8'));var attributes=require(_0x9ec3('0x9'));module['exports']=function(_0x49ddff,_0x55adba){return _0x49ddff[_0x9ec3('0xa')](_0x9ec3('0xb'),attributes,{'tableName':_0x9ec3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index b37e0f9..2737c4b 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 _0xc731=['http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','where','attributes','map','include','model','GetTrigger','find','ShowTrigger','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x584488,_0x499cd8){var _0x495b45=function(_0x18ba24){while(--_0x18ba24){_0x584488['push'](_0x584488['shift']());}};_0x495b45(++_0x499cd8);}(_0xc731,0x1e6));var _0x1c73=function(_0x3f2222,_0x46f6af){_0x3f2222=_0x3f2222-0x0;var _0x30a3f3=_0xc731[_0x3f2222];return _0x30a3f3;};'use strict';var _=require(_0x1c73('0x0'));var util=require(_0x1c73('0x1'));var moment=require('moment');var BPromise=require(_0x1c73('0x2'));var rs=require(_0x1c73('0x3'));var fs=require('fs');var Redis=require(_0x1c73('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1c73('0x5'));var logger=require('../../config/logger')(_0x1c73('0x6'));var config=require(_0x1c73('0x7'));var jayson=require(_0x1c73('0x8'));var client=jayson['client'][_0x1c73('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb0a620,_0x5ea45e,_0x2a5626){return new BPromise(function(_0x4aea73,_0x29974d){return client[_0x1c73('0xa')](_0xb0a620,_0x2a5626)[_0x1c73('0xb')](function(_0x1bfa81){logger[_0x1c73('0xc')](_0x1c73('0xd'),_0x5ea45e,_0x1c73('0xe'));logger[_0x1c73('0xf')](_0x1c73('0x10'),_0x5ea45e,_0x1c73('0xe'),JSON[_0x1c73('0x11')](_0x1bfa81));if(_0x1bfa81[_0x1c73('0x12')]){if(_0x1bfa81[_0x1c73('0x12')][_0x1c73('0x13')]===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x5ea45e,_0x1bfa81[_0x1c73('0x12')][_0x1c73('0x14')]);return _0x29974d(_0x1bfa81[_0x1c73('0x12')][_0x1c73('0x14')]);}logger[_0x1c73('0x12')](_0x1c73('0xd'),_0x5ea45e,_0x1bfa81[_0x1c73('0x12')][_0x1c73('0x14')]);return _0x4aea73(_0x1bfa81['error'][_0x1c73('0x14')]);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x5ea45e,_0x1c73('0xe'));_0x4aea73(_0x1bfa81[_0x1c73('0x15')][_0x1c73('0x14')]);}})[_0x1c73('0x16')](function(_0x10328e){logger[_0x1c73('0x12')]('Trigger,\x20%s,\x20%s',_0x5ea45e,_0x10328e);_0x29974d(_0x10328e);});});}exports['GetTrigger']=function(_0x58d1ee){var _0x4ab0b7=this;return new Promise(function(_0x182de8,_0xe6f218){return db['Trigger'][_0x1c73('0x17')]({'raw':_0x58d1ee['options']?_0x58d1ee[_0x1c73('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x58d1ee['options']?_0x58d1ee[_0x1c73('0x18')][_0x1c73('0x19')]||null:null,'attributes':_0x58d1ee['options']?_0x58d1ee[_0x1c73('0x18')][_0x1c73('0x1a')]||null:null,'limit':_0x58d1ee['options']?_0x58d1ee[_0x1c73('0x18')]['limit']||null:null,'include':_0x58d1ee[_0x1c73('0x18')]?_0x58d1ee[_0x1c73('0x18')]['include']?_[_0x1c73('0x1b')](_0x58d1ee[_0x1c73('0x18')][_0x1c73('0x1c')],function(_0x4baf2c){return{'model':db[_0x4baf2c[_0x1c73('0x1d')]],'as':_0x4baf2c['as'],'attributes':_0x4baf2c[_0x1c73('0x1a')],'include':_0x4baf2c['include']?_['map'](_0x4baf2c[_0x1c73('0x1c')],function(_0x1a739f){return{'model':db[_0x1a739f[_0x1c73('0x1d')]],'as':_0x1a739f['as'],'attributes':_0x1a739f[_0x1c73('0x1a')],'include':_0x1a739f['include']?_[_0x1c73('0x1b')](_0x1a739f[_0x1c73('0x1c')],function(_0x44056c){return{'model':db[_0x44056c[_0x1c73('0x1d')]],'as':_0x44056c['as'],'attributes':_0x44056c[_0x1c73('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1c73('0xb')](function(_0x246e30){logger[_0x1c73('0xc')](_0x1c73('0x1e'),_0x58d1ee);logger[_0x1c73('0xf')](_0x1c73('0x1e'),_0x58d1ee,JSON[_0x1c73('0x11')](_0x246e30));_0x182de8(_0x246e30);})['catch'](function(_0x20f249){logger['error']('GetTrigger',_0x20f249[_0x1c73('0x14')],_0x58d1ee);_0xe6f218(_0x4ab0b7[_0x1c73('0x12')](0x1f4,_0x20f249['message']));});});};exports['ShowTrigger']=function(_0x17d1a5){var _0x5bda2c=this;return new Promise(function(_0x58dfdd,_0x5aca5d){return db['Trigger'][_0x1c73('0x1f')]({'raw':_0x17d1a5[_0x1c73('0x18')]?_0x17d1a5[_0x1c73('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x17d1a5[_0x1c73('0x18')]?_0x17d1a5[_0x1c73('0x18')][_0x1c73('0x19')]||null:null,'attributes':_0x17d1a5[_0x1c73('0x18')]?_0x17d1a5[_0x1c73('0x18')]['attributes']||null:null,'include':_0x17d1a5[_0x1c73('0x18')]?_0x17d1a5[_0x1c73('0x18')][_0x1c73('0x1c')]?_['map'](_0x17d1a5['options'][_0x1c73('0x1c')],function(_0x11d466){return{'model':db[_0x11d466['model']],'as':_0x11d466['as'],'attributes':_0x11d466['attributes'],'include':_0x11d466[_0x1c73('0x1c')]?_[_0x1c73('0x1b')](_0x11d466['include'],function(_0x132be2){return{'model':db[_0x132be2['model']],'as':_0x132be2['as'],'attributes':_0x132be2['attributes'],'include':_0x132be2['include']?_['map'](_0x132be2[_0x1c73('0x1c')],function(_0x3b6301){return{'model':db[_0x3b6301['model']],'as':_0x3b6301['as'],'attributes':_0x3b6301['attributes']};}):[]};}):[]};}):[]:[]})[_0x1c73('0xb')](function(_0x19749b){logger[_0x1c73('0xc')]('ShowTrigger',_0x17d1a5);logger[_0x1c73('0xf')](_0x1c73('0x20'),_0x17d1a5,JSON[_0x1c73('0x11')](_0x19749b));_0x58dfdd(_0x19749b);})['catch'](function(_0x38a047){logger[_0x1c73('0x12')](_0x1c73('0x20'),_0x38a047[_0x1c73('0x14')],_0x17d1a5);_0x5aca5d(_0x5bda2c['error'](0x1f4,_0x38a047[_0x1c73('0x14')]));});});}; \ No newline at end of file +var _0x0637=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','stringify','error','code','Trigger,\x20%s,\x20%s','message','Trigger','findAll','options','raw','where','attributes','limit','map','model','include','GetTrigger','catch','ShowTrigger','find','debug','lodash','moment'];(function(_0x581249,_0x483f03){var _0x284bae=function(_0x2faadd){while(--_0x2faadd){_0x581249['push'](_0x581249['shift']());}};_0x284bae(++_0x483f03);}(_0x0637,0x1e8));var _0x7063=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0637[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7063('0x0'));var util=require('util');var moment=require(_0x7063('0x1'));var BPromise=require(_0x7063('0x2'));var rs=require(_0x7063('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7063('0x4'))['db'];var utils=require(_0x7063('0x5'));var logger=require(_0x7063('0x6'))(_0x7063('0x7'));var config=require(_0x7063('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7063('0x9')][_0x7063('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51331a,_0x555dc0,_0x3ca09e){return new BPromise(function(_0x58d6ea,_0x3ce804){return client[_0x7063('0xb')](_0x51331a,_0x3ca09e)[_0x7063('0xc')](function(_0x2eb9c0){logger[_0x7063('0xd')]('Trigger,\x20%s,\x20%s',_0x555dc0,'request\x20sent');logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x555dc0,_0x7063('0xe'),JSON[_0x7063('0xf')](_0x2eb9c0));if(_0x2eb9c0[_0x7063('0x10')]){if(_0x2eb9c0[_0x7063('0x10')][_0x7063('0x11')]===0x1f4){logger['error'](_0x7063('0x12'),_0x555dc0,_0x2eb9c0['error'][_0x7063('0x13')]);return _0x3ce804(_0x2eb9c0[_0x7063('0x10')]['message']);}logger[_0x7063('0x10')]('Trigger,\x20%s,\x20%s',_0x555dc0,_0x2eb9c0[_0x7063('0x10')]['message']);return _0x58d6ea(_0x2eb9c0[_0x7063('0x10')][_0x7063('0x13')]);}else{logger[_0x7063('0xd')](_0x7063('0x12'),_0x555dc0,_0x7063('0xe'));_0x58d6ea(_0x2eb9c0['result'][_0x7063('0x13')]);}})['catch'](function(_0x4a8ea3){logger[_0x7063('0x10')]('Trigger,\x20%s,\x20%s',_0x555dc0,_0x4a8ea3);_0x3ce804(_0x4a8ea3);});});}exports['GetTrigger']=function(_0x17efd0){var _0x59d413=this;return new Promise(function(_0x3340f0,_0x256904){return db[_0x7063('0x14')][_0x7063('0x15')]({'raw':_0x17efd0['options']?_0x17efd0[_0x7063('0x16')][_0x7063('0x17')]===undefined?!![]:![]:!![],'where':_0x17efd0['options']?_0x17efd0[_0x7063('0x16')][_0x7063('0x18')]||null:null,'attributes':_0x17efd0[_0x7063('0x16')]?_0x17efd0['options'][_0x7063('0x19')]||null:null,'limit':_0x17efd0['options']?_0x17efd0[_0x7063('0x16')][_0x7063('0x1a')]||null:null,'include':_0x17efd0['options']?_0x17efd0['options']['include']?_[_0x7063('0x1b')](_0x17efd0['options']['include'],function(_0x49e3eb){return{'model':db[_0x49e3eb[_0x7063('0x1c')]],'as':_0x49e3eb['as'],'attributes':_0x49e3eb[_0x7063('0x19')],'include':_0x49e3eb['include']?_[_0x7063('0x1b')](_0x49e3eb['include'],function(_0xc6fbea){return{'model':db[_0xc6fbea[_0x7063('0x1c')]],'as':_0xc6fbea['as'],'attributes':_0xc6fbea[_0x7063('0x19')],'include':_0xc6fbea[_0x7063('0x1d')]?_[_0x7063('0x1b')](_0xc6fbea[_0x7063('0x1d')],function(_0x45ffb2){return{'model':db[_0x45ffb2[_0x7063('0x1c')]],'as':_0x45ffb2['as'],'attributes':_0x45ffb2[_0x7063('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7063('0xc')](function(_0x2c417f){logger[_0x7063('0xd')](_0x7063('0x1e'),_0x17efd0);logger['debug'](_0x7063('0x1e'),_0x17efd0,JSON[_0x7063('0xf')](_0x2c417f));_0x3340f0(_0x2c417f);})[_0x7063('0x1f')](function(_0x47e1b9){logger[_0x7063('0x10')](_0x7063('0x1e'),_0x47e1b9[_0x7063('0x13')],_0x17efd0);_0x256904(_0x59d413[_0x7063('0x10')](0x1f4,_0x47e1b9['message']));});});};exports[_0x7063('0x20')]=function(_0x1396b2){var _0x2953ee=this;return new Promise(function(_0x6143c3,_0x105e17){return db['Trigger'][_0x7063('0x21')]({'raw':_0x1396b2['options']?_0x1396b2[_0x7063('0x16')][_0x7063('0x17')]===undefined?!![]:![]:!![],'where':_0x1396b2['options']?_0x1396b2[_0x7063('0x16')][_0x7063('0x18')]||null:null,'attributes':_0x1396b2[_0x7063('0x16')]?_0x1396b2[_0x7063('0x16')][_0x7063('0x19')]||null:null,'include':_0x1396b2[_0x7063('0x16')]?_0x1396b2['options'][_0x7063('0x1d')]?_[_0x7063('0x1b')](_0x1396b2['options'][_0x7063('0x1d')],function(_0x4e85a3){return{'model':db[_0x4e85a3[_0x7063('0x1c')]],'as':_0x4e85a3['as'],'attributes':_0x4e85a3[_0x7063('0x19')],'include':_0x4e85a3['include']?_[_0x7063('0x1b')](_0x4e85a3[_0x7063('0x1d')],function(_0x76568c){return{'model':db[_0x76568c[_0x7063('0x1c')]],'as':_0x76568c['as'],'attributes':_0x76568c['attributes'],'include':_0x76568c[_0x7063('0x1d')]?_[_0x7063('0x1b')](_0x76568c[_0x7063('0x1d')],function(_0x15d3f5){return{'model':db[_0x15d3f5[_0x7063('0x1c')]],'as':_0x15d3f5['as'],'attributes':_0x15d3f5['attributes']};}):[]};}):[]};}):[]:[]})[_0x7063('0xc')](function(_0x4e9eb8){logger[_0x7063('0xd')](_0x7063('0x20'),_0x1396b2);logger[_0x7063('0x22')](_0x7063('0x20'),_0x1396b2,JSON[_0x7063('0xf')](_0x4e9eb8));_0x6143c3(_0x4e9eb8);})[_0x7063('0x1f')](function(_0x541558){logger[_0x7063('0x10')](_0x7063('0x20'),_0x541558[_0x7063('0x13')],_0x1396b2);_0x105e17(_0x2953ee[_0x7063('0x10')](0x1f4,_0x541558[_0x7063('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 22cfb94..cfa1575 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 _0x691c=['path','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/clone','clone','create','put','update','delete','destroy','exports','multer','util'];(function(_0x59ae42,_0x404166){var _0x26bffc=function(_0x3ddc8b){while(--_0x3ddc8b){_0x59ae42['push'](_0x59ae42['shift']());}};_0x26bffc(++_0x404166);}(_0x691c,0x1b6));var _0xc691=function(_0x49f67f,_0x4113a4){_0x49f67f=_0x49f67f-0x0;var _0x4779a1=_0x691c[_0x49f67f];return _0x4779a1;};'use strict';var multer=require(_0xc691('0x0'));var util=require(_0xc691('0x1'));var path=require(_0xc691('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc691('0x3')]();var fs_extra=require(_0xc691('0x4'));var auth=require(_0xc691('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc691('0x6'));var controller=require('./trunk.controller');router[_0xc691('0x7')]('/',auth[_0xc691('0x8')](),controller[_0xc691('0x9')]);router[_0xc691('0x7')](_0xc691('0xa'),auth[_0xc691('0x8')](),controller[_0xc691('0xb')]);router['post'](_0xc691('0xc'),auth[_0xc691('0x8')](),controller[_0xc691('0xd')]);router['post']('/',auth[_0xc691('0x8')](),controller[_0xc691('0xe')]);router[_0xc691('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xc691('0x10')]);router[_0xc691('0x11')](_0xc691('0xa'),auth[_0xc691('0x8')](),controller[_0xc691('0x12')]);module[_0xc691('0x13')]=router; \ No newline at end of file +var _0x1787=['clone','create','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','/:id','isAuthenticated','post','/:id/clone'];(function(_0x28a8cf,_0x2113fa){var _0x71aba7=function(_0x392ede){while(--_0x392ede){_0x28a8cf['push'](_0x28a8cf['shift']());}};_0x71aba7(++_0x2113fa);}(_0x1787,0x15a));var _0x7178=function(_0x3f47dc,_0x450bae){_0x3f47dc=_0x3f47dc-0x0;var _0x291362=_0x1787[_0x3f47dc];return _0x291362;};'use strict';var multer=require(_0x7178('0x0'));var util=require('util');var path=require(_0x7178('0x1'));var timeout=require('connect-timeout');var express=require(_0x7178('0x2'));var router=express[_0x7178('0x3')]();var fs_extra=require(_0x7178('0x4'));var auth=require(_0x7178('0x5'));var interaction=require(_0x7178('0x6'));var config=require(_0x7178('0x7'));var controller=require(_0x7178('0x8'));router[_0x7178('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7178('0x9')](_0x7178('0xa'),auth[_0x7178('0xb')](),controller['show']);router[_0x7178('0xc')](_0x7178('0xd'),auth[_0x7178('0xb')](),controller[_0x7178('0xe')]);router['post']('/',auth[_0x7178('0xb')](),controller[_0x7178('0xf')]);router[_0x7178('0x10')](_0x7178('0xa'),auth[_0x7178('0xb')](),controller[_0x7178('0x11')]);router[_0x7178('0x12')](_0x7178('0xa'),auth[_0x7178('0xb')](),controller[_0x7178('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index b1ede70..7a6276e 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 _0x3ab4=['yes','nonat','outgoing','force_rport,comedia','nat','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x3ab4,0x111));var _0x43ab=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x3ab4[_0x57486e];return _0x5f110b;};'use strict';var Sequelize=require(_0x43ab('0x0'));module[_0x43ab('0x1')]={'name':{'type':Sequelize[_0x43ab('0x2')],'allowNull':![],'unique':_0x43ab('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x43ab('0x4')](_0x43ab('0x5'),_0x43ab('0x6'),'peer'),'allowNull':![],'defaultValue':_0x43ab('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x43ab('0x7')},'callingpres':{'type':Sequelize[_0x43ab('0x4')](_0x43ab('0x8'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x43ab('0x9'),_0x43ab('0xa'),_0x43ab('0xb'),_0x43ab('0xc'),_0x43ab('0xd'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x43ab('0x2')]},'secret':{'type':Sequelize[_0x43ab('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x43ab('0x2')],'defaultValue':'udp','set':function(_0xfd656c){this[_0x43ab('0xe')](_0x43ab('0xf'),_0xfd656c?_0xfd656c[_0x43ab('0x10')](','):null);},'get':function(){return this['getDataValue'](_0x43ab('0xf'))?this['getDataValue']('transport')['split'](','):null;},'comment':_0x43ab('0x11')},'dtmfmode':{'type':Sequelize[_0x43ab('0x4')](_0x43ab('0x12'),'info',_0x43ab('0x13'),'inband',_0x43ab('0x14')),'defaultValue':_0x43ab('0x12')},'directmedia':{'type':Sequelize[_0x43ab('0x4')](_0x43ab('0x15'),'no',_0x43ab('0x16'),'update',_0x43ab('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x43ab('0x4')](_0x43ab('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x43ab('0x2')]},'directmediadeny':{'type':Sequelize[_0x43ab('0x2')]},'nat':{'type':Sequelize[_0x43ab('0x2')],'defaultValue':_0x43ab('0x18'),'set':function(_0x14ea72){this[_0x43ab('0xe')](_0x43ab('0x19'),_0x14ea72?_0x14ea72[_0x43ab('0x10')](','):null);},'get':function(){return this['getDataValue'](_0x43ab('0x19'))?this[_0x43ab('0x1a')](_0x43ab('0x19'))['split'](','):null;},'comment':_0x43ab('0x1b')},'callgroup':{'type':Sequelize[_0x43ab('0x2')]},'namedcallgroup':{'type':Sequelize[_0x43ab('0x2')]},'pickupgroup':{'type':Sequelize[_0x43ab('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x43ab('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x43ab('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x43ab('0x2')],'defaultValue':_0x43ab('0x1c')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x45c3ac){this[_0x43ab('0xe')](_0x43ab('0x1d'),_0x45c3ac?_0x45c3ac[_0x43ab('0x10')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x43ab('0x1a')](_0x43ab('0x1d'))?this[_0x43ab('0x1a')](_0x43ab('0x1d'))[_0x43ab('0x1e')](';'):null;},'comment':_0x43ab('0x1f')},'autoframing':{'type':Sequelize[_0x43ab('0x4')](_0x43ab('0x15'),'no')},'insecure':{'type':Sequelize[_0x43ab('0x2')],'defaultValue':'port,invite','set':function(_0x418009){this[_0x43ab('0xe')]('insecure',_0x418009?_0x418009['join'](','):null);},'get':function(){return this[_0x43ab('0x1a')](_0x43ab('0x20'))?this[_0x43ab('0x1a')](_0x43ab('0x20'))[_0x43ab('0x1e')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x43ab('0x4')](_0x43ab('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x43ab('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x43ab('0x4')](_0x43ab('0x15'),'no','never')},'promiscredir':{'type':Sequelize[_0x43ab('0x4')](_0x43ab('0x15'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x43ab('0x15'),'no')},'accountcode':{'type':Sequelize[_0x43ab('0x21')](0xb)},'setvar':{'type':Sequelize[_0x43ab('0x2')]},'callerid':{'type':Sequelize[_0x43ab('0x2')],'defaultValue':_0x43ab('0x22')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x43ab('0x4')]('yes','no'),'defaultValue':_0x43ab('0x15')},'busylevel':{'type':Sequelize[_0x43ab('0x21')](0xb)},'allowoverlap':{'type':Sequelize[_0x43ab('0x4')](_0x43ab('0x15'),'no')},'allowsubscribe':{'type':Sequelize[_0x43ab('0x4')](_0x43ab('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0x43ab('0x4')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x43ab('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x43ab('0x4')](_0x43ab('0x15'),'no',_0x43ab('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x43ab('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x43ab('0x4')](_0x43ab('0x15'),'no')},'mailbox':{'type':Sequelize[_0x43ab('0x2')]},'session_timers':{'type':Sequelize[_0x43ab('0x4')](_0x43ab('0x24'),_0x43ab('0x25'),_0x43ab('0x26'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x43ab('0x21')](0xb)},'session_refresher':{'type':Sequelize[_0x43ab('0x4')](_0x43ab('0x27'),_0x43ab('0x28')),'defaultValue':_0x43ab('0x28')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x43ab('0x2')]},'fromdomain':{'type':Sequelize[_0x43ab('0x2')]},'fromuser':{'type':Sequelize[_0x43ab('0x2')]},'port':{'type':Sequelize[_0x43ab('0x21')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x43ab('0x15'),'no'),'defaultValue':_0x43ab('0x15')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x43ab('0x2')]},'rtptimeout':{'type':Sequelize[_0x43ab('0x21')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x43ab('0x4')](_0x43ab('0x15'),'no',_0x43ab('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x43ab('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x43ab('0x21')](0xb)},'timerb':{'type':Sequelize[_0x43ab('0x21')](0xb)},'qualifyfreq':{'type':Sequelize[_0x43ab('0x21')](0xb)},'contactpermit':{'type':Sequelize[_0x43ab('0x2')]},'contactdeny':{'type':Sequelize[_0x43ab('0x2')]},'contactacl':{'type':Sequelize[_0x43ab('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x43ab('0x2')]},'use_q850_reason':{'type':Sequelize[_0x43ab('0x2')]},'maxforwards':{'type':Sequelize[_0x43ab('0x21')](0xb)},'encryption':{'type':Sequelize[_0x43ab('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x43ab('0x4')](_0x43ab('0x15'),'no')},'force_avp':{'type':Sequelize[_0x43ab('0x4')](_0x43ab('0x15'),'no')},'icesupport':{'type':Sequelize[_0x43ab('0x4')](_0x43ab('0x15'),'no')},'dtlsenable':{'type':Sequelize[_0x43ab('0x4')](_0x43ab('0x15'),'no')},'dtlsverify':{'type':Sequelize[_0x43ab('0x4')](_0x43ab('0x15'),'no',_0x43ab('0x2a'),_0x43ab('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x43ab('0x21')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x43ab('0x2')]},'dtlscipher':{'type':Sequelize[_0x43ab('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x43ab('0x2')]},'dtlssetup':{'type':Sequelize[_0x43ab('0x4')](_0x43ab('0x2c'),_0x43ab('0x2d'),_0x43ab('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x43ab('0x2')]},'usereqphone':{'type':Sequelize[_0x43ab('0x4')](_0x43ab('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x43ab('0x2')]},'recordofffeature':{'type':Sequelize[_0x43ab('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x43ab('0x15'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x43ab('0x15'),'no')},'vmexten':{'type':Sequelize[_0x43ab('0x2')]},'mohinterpret':{'type':Sequelize[_0x43ab('0x2')]},'mohsuggest':{'type':Sequelize[_0x43ab('0x2')]},'parkinglot':{'type':Sequelize[_0x43ab('0x2')]},'description':{'type':Sequelize[_0x43ab('0x2')]},'host':{'type':Sequelize[_0x43ab('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0x43ab('0x15'),'no','nonat','update',_0x43ab('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x43ab('0x2')]},'otherFields':{'type':Sequelize[_0x43ab('0x2')]},'active':{'type':Sequelize[_0x43ab('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x0086=['originate','uac','uas','pai','certificate','active','passive','dynamic','update','BOOLEAN','exports','STRING','name','friend','peer','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','inband','rfc2833','yes','nonat','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0086,0x136));var _0x6008=function(_0x3c6857,_0x253955){_0x3c6857=_0x3c6857-0x0;var _0x5216aa=_0x0086[_0x3c6857];return _0x5216aa;};'use strict';var Sequelize=require('sequelize');module[_0x6008('0x0')]={'name':{'type':Sequelize[_0x6008('0x1')],'allowNull':![],'unique':_0x6008('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x6008('0x3'),'user',_0x6008('0x4')),'allowNull':![],'defaultValue':_0x6008('0x3')},'context':{'type':Sequelize[_0x6008('0x1')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x6008('0x5')](_0x6008('0x6'),_0x6008('0x7'),_0x6008('0x8'),'ALLOWED',_0x6008('0x9'),_0x6008('0xa'),_0x6008('0xb'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x6008('0x1')]},'secret':{'type':Sequelize[_0x6008('0x1')]},'md5secret':{'type':Sequelize[_0x6008('0x1')]},'remotesecret':{'type':Sequelize[_0x6008('0x1')]},'transport':{'type':Sequelize[_0x6008('0x1')],'defaultValue':'udp','set':function(_0x590781){this[_0x6008('0xc')]('transport',_0x590781?_0x590781[_0x6008('0xd')](','):null);},'get':function(){return this[_0x6008('0xe')](_0x6008('0xf'))?this['getDataValue']('transport')[_0x6008('0x10')](','):null;},'comment':_0x6008('0x11')},'dtmfmode':{'type':Sequelize[_0x6008('0x5')]('rfc2833','info',_0x6008('0x12'),_0x6008('0x13'),'auto'),'defaultValue':_0x6008('0x14')},'directmedia':{'type':Sequelize['ENUM'](_0x6008('0x15'),'no',_0x6008('0x16'),'update',_0x6008('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6008('0x5')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6008('0x1')]},'directmediadeny':{'type':Sequelize[_0x6008('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x6008('0x18'),'set':function(_0x20fb7a){this[_0x6008('0xc')](_0x6008('0x19'),_0x20fb7a?_0x20fb7a['join'](','):null);},'get':function(){return this[_0x6008('0xe')](_0x6008('0x19'))?this['getDataValue'](_0x6008('0x19'))[_0x6008('0x10')](','):null;},'comment':_0x6008('0x1a')},'callgroup':{'type':Sequelize[_0x6008('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x6008('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x6008('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6008('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x6008('0x1')],'defaultValue':_0x6008('0x1b')},'allow':{'type':Sequelize[_0x6008('0x1')],'allowNull':![],'defaultValue':_0x6008('0x1c'),'set':function(_0x288eec){this[_0x6008('0xc')](_0x6008('0x1d'),_0x288eec?_0x288eec['join'](';'):_0x6008('0x1c'));},'get':function(){return this[_0x6008('0xe')](_0x6008('0x1d'))?this[_0x6008('0xe')](_0x6008('0x1d'))[_0x6008('0x10')](';'):null;},'comment':_0x6008('0x1e')},'autoframing':{'type':Sequelize['ENUM'](_0x6008('0x15'),'no')},'insecure':{'type':Sequelize[_0x6008('0x1')],'defaultValue':_0x6008('0x1f'),'set':function(_0x54271d){this['setDataValue'](_0x6008('0x20'),_0x54271d?_0x54271d[_0x6008('0xd')](','):null);},'get':function(){return this[_0x6008('0xe')]('insecure')?this['getDataValue'](_0x6008('0x20'))[_0x6008('0x10')](','):null;},'comment':_0x6008('0x21')},'trustrpid':{'type':Sequelize[_0x6008('0x5')](_0x6008('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6008('0x5')](_0x6008('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6008('0x5')](_0x6008('0x15'),'no',_0x6008('0x22'))},'promiscredir':{'type':Sequelize[_0x6008('0x5')](_0x6008('0x15'),'no')},'useclientcode':{'type':Sequelize[_0x6008('0x5')](_0x6008('0x15'),'no')},'accountcode':{'type':Sequelize[_0x6008('0x23')](0xb)},'setvar':{'type':Sequelize[_0x6008('0x1')]},'callerid':{'type':Sequelize[_0x6008('0x1')],'defaultValue':_0x6008('0x24')},'amaflags':{'type':Sequelize[_0x6008('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0x6008('0x15'),'no'),'defaultValue':_0x6008('0x15')},'busylevel':{'type':Sequelize[_0x6008('0x23')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize[_0x6008('0x5')](_0x6008('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0x6008('0x5')](_0x6008('0x15'),'no')},'ignoresdpversion':{'type':Sequelize[_0x6008('0x5')](_0x6008('0x15'),'no')},'subscribecontext':{'type':Sequelize[_0x6008('0x1')]},'template':{'type':Sequelize[_0x6008('0x1')]},'videosupport':{'type':Sequelize[_0x6008('0x5')](_0x6008('0x15'),'no',_0x6008('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6008('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x6008('0x5')](_0x6008('0x15'),'no')},'mailbox':{'type':Sequelize[_0x6008('0x1')]},'session_timers':{'type':Sequelize[_0x6008('0x5')](_0x6008('0x26'),_0x6008('0x27'),_0x6008('0x28'))},'session_expires':{'type':Sequelize[_0x6008('0x23')](0xb)},'session_minse':{'type':Sequelize[_0x6008('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0x6008('0x5')](_0x6008('0x29'),_0x6008('0x2a')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x6008('0x1')]},'port':{'type':Sequelize[_0x6008('0x23')](0x5)},'qualify':{'type':Sequelize[_0x6008('0x5')]('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x6008('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x6008('0x1')]},'defaultuser':{'type':Sequelize[_0x6008('0x1')]},'rtptimeout':{'type':Sequelize[_0x6008('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x6008('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x6008('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0x6008('0x5')](_0x6008('0x15'),'no',_0x6008('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6008('0x1')]},'callbackextension':{'type':Sequelize[_0x6008('0x1')]},'timert1':{'type':Sequelize[_0x6008('0x23')](0xb)},'timerb':{'type':Sequelize[_0x6008('0x23')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x6008('0x1')]},'contactacl':{'type':Sequelize[_0x6008('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x6008('0x1')]},'use_q850_reason':{'type':Sequelize[_0x6008('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x6008('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6008('0x5')]('yes','no')},'force_avp':{'type':Sequelize[_0x6008('0x5')](_0x6008('0x15'),'no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize[_0x6008('0x5')](_0x6008('0x15'),'no')},'dtlsverify':{'type':Sequelize[_0x6008('0x5')](_0x6008('0x15'),'no','fingerprint',_0x6008('0x2c'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x6008('0x1')]},'dtlscipher':{'type':Sequelize[_0x6008('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x6008('0x1')]},'dtlssetup':{'type':Sequelize[_0x6008('0x5')](_0x6008('0x2d'),_0x6008('0x2e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6008('0x1')]},'usereqphone':{'type':Sequelize['ENUM'](_0x6008('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x6008('0x1')]},'call_limit':{'type':Sequelize[_0x6008('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x6008('0x15'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x6008('0x15'),'no')},'vmexten':{'type':Sequelize[_0x6008('0x1')]},'mohinterpret':{'type':Sequelize[_0x6008('0x1')]},'mohsuggest':{'type':Sequelize[_0x6008('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6008('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x6008('0x2f')},'canreinvite':{'type':Sequelize['ENUM'](_0x6008('0x15'),'no',_0x6008('0x16'),_0x6008('0x30'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x6008('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x6008('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x6008('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index b050b5a..101c3f7 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 _0xe5b3=['then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','clone','find','omit','createdAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request'];(function(_0xde9059,_0x750aab){var _0x23197d=function(_0x457724){while(--_0x457724){_0xde9059['push'](_0xde9059['shift']());}};_0x23197d(++_0x750aab);}(_0xe5b3,0x133));var _0x3e5b=function(_0x24b753,_0x438426){_0x24b753=_0x24b753-0x0;var _0x93552a=_0xe5b3[_0x24b753];return _0x93552a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];var jayson=require(_0x3e5b('0x19'));var client=jayson[_0x3e5b('0x1a')][_0x3e5b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x405e70,_0x560010,_0x39a2a1,_0x5f2f9c){return new BPromise(function(_0x51a188,_0x4d71a3){var _0x3754e3=_0x5f2f9c||client;return _0x3754e3[_0x3e5b('0x1c')](_0x405e70,_0x39a2a1)[_0x3e5b('0x1d')](function(_0x4fb471){logger[_0x3e5b('0x1e')]('Trunk,\x20%s,\x20%s',_0x560010,'request\x20sent');logger[_0x3e5b('0x1f')](_0x3e5b('0x20'),_0x560010,'request\x20sent',JSON[_0x3e5b('0x21')](_0x4fb471));if(_0x4fb471[_0x3e5b('0x22')]){if(_0x4fb471['error'][_0x3e5b('0x23')]===0x1f4){logger[_0x3e5b('0x22')]('Trunk,\x20%s,\x20%s',_0x560010,_0x4fb471['error'][_0x3e5b('0x24')]);return _0x4d71a3(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);return _0x51a188(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}else{logger[_0x3e5b('0x1e')](_0x3e5b('0x25'),_0x560010,_0x3e5b('0x26'));_0x51a188(_0x4fb471[_0x3e5b('0x27')][_0x3e5b('0x24')]);}})['catch'](function(_0x433f9c){logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x433f9c);_0x4d71a3(_0x433f9c);});});}function respondWithStatusCode(_0x150674,_0x50039b){_0x50039b=_0x50039b||0xcc;return function(_0x1eb80f){if(_0x1eb80f){return _0x150674['sendStatus'](_0x50039b);}return _0x150674[_0x3e5b('0x28')](_0x50039b)[_0x3e5b('0x29')]();};}function respondWithResult(_0x4d5e61,_0x41b684){_0x41b684=_0x41b684||0xc8;return function(_0x2f6368){if(_0x2f6368){return _0x4d5e61[_0x3e5b('0x28')](_0x41b684)[_0x3e5b('0x2a')](_0x2f6368);}};}function respondWithFilteredResult(_0x3bb749,_0x26c7f2){return function(_0x160e87){if(_0x160e87){var _0x2ddf57=typeof _0x26c7f2['offset']===_0x3e5b('0x2b')&&typeof _0x26c7f2['limit']===_0x3e5b('0x2b');var _0x4fd64b=_0x160e87[_0x3e5b('0x2c')];var _0x1f6473=_0x2ddf57?0x0:_0x26c7f2[_0x3e5b('0x2d')];var _0x475b39=_0x2ddf57?_0x160e87[_0x3e5b('0x2c')]:_0x26c7f2[_0x3e5b('0x2d')]+_0x26c7f2[_0x3e5b('0x2e')];var _0x9c2123;if(_0x475b39>=_0x4fd64b){_0x475b39=_0x4fd64b;_0x9c2123=0xc8;}else{_0x9c2123=0xce;}_0x3bb749[_0x3e5b('0x28')](_0x9c2123);return _0x3bb749[_0x3e5b('0x2f')](_0x3e5b('0x30'),_0x1f6473+'-'+_0x475b39+'/'+_0x4fd64b)['json'](_0x160e87);}return null;};}function patchUpdates(_0x21bc10){return function(_0x1882aa){try{jsonpatch[_0x3e5b('0x31')](_0x1882aa,_0x21bc10,!![]);}catch(_0x2a14eb){return BPromise[_0x3e5b('0x32')](_0x2a14eb);}return _0x1882aa[_0x3e5b('0x33')]();};}function saveUpdates(_0x345927,_0x4c4e01){return function(_0x33f089){if(_0x33f089){return _0x33f089['update'](_0x345927)['then'](function(_0x32c6b0){return _0x32c6b0;});}return null;};}function removeEntity(_0x78d68a,_0x51ea0d){return function(_0x40e37d){if(_0x40e37d){return _0x40e37d[_0x3e5b('0x34')]()[_0x3e5b('0x1d')](function(){var _0x33e356=_0x40e37d[_0x3e5b('0x35')]({'plain':!![]});var _0x26f842=_0x3e5b('0x36');return db[_0x3e5b('0x37')][_0x3e5b('0x34')]({'where':{'type':_0x26f842,'resourceId':_0x33e356['id']}})[_0x3e5b('0x1d')](function(){return _0x40e37d;});})[_0x3e5b('0x1d')](function(){_0x78d68a[_0x3e5b('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x141b7e,_0xec45c5){return function(_0x53caa2){if(!_0x53caa2){_0x141b7e['sendStatus'](0x194);}return _0x53caa2;};}function handleError(_0x471196,_0x56d7ef){_0x56d7ef=_0x56d7ef||0x1f4;return function(_0x2939da){logger[_0x3e5b('0x22')](_0x2939da[_0x3e5b('0x38')]);if(_0x2939da[_0x3e5b('0x39')]){delete _0x2939da['name'];}_0x471196[_0x3e5b('0x28')](_0x56d7ef)['send'](_0x2939da);};}exports[_0x3e5b('0x3a')]=function(_0x5ec841,_0x47f7c8){var _0x48f414={},_0x10c202={},_0x174ebf={'count':0x0,'rows':[]};var _0x2eaa30=_[_0x3e5b('0x3b')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')],function(_0x5466ac){return{'name':_0x5466ac['fieldName'],'type':_0x5466ac['type']['key']};});_0x10c202['model']=_['map'](_0x2eaa30,'name');_0x10c202[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x5ec841[_0x3e5b('0x3e')]);_0x10c202[_0x3e5b('0x40')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],_0x10c202[_0x3e5b('0x3e')]);_0x48f414[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x5ec841['query'][_0x3e5b('0x44')]));_0x48f414[_0x3e5b('0x43')]=_0x48f414[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x48f414[_0x3e5b('0x43')]:_0x10c202[_0x3e5b('0x42')];if(!_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x46')](_0x3e5b('0x47'))){_0x48f414[_0x3e5b('0x2e')]=qs[_0x3e5b('0x2e')](_0x5ec841['query']['limit']);_0x48f414['offset']=qs['offset'](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x2d')]);}_0x48f414[_0x3e5b('0x48')]=qs[_0x3e5b('0x49')](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x49')]);_0x48f414[_0x3e5b('0x4a')]=qs[_0x3e5b('0x40')](_[_0x3e5b('0x4b')](_0x5ec841[_0x3e5b('0x3e')],_0x10c202['filters']),_0x2eaa30);if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x4c')]){_0x48f414[_0x3e5b('0x4a')]=_[_0x3e5b('0x4d')](_0x48f414[_0x3e5b('0x4a')],{'$or':_['map'](_0x2eaa30,function(_0x588ee7){if(_0x588ee7['type']!==_0x3e5b('0x4e')){var _0x20af6a={};_0x20af6a[_0x588ee7[_0x3e5b('0x39')]]={'$like':'%'+_0x5ec841['query']['filter']+'%'};return _0x20af6a;}})});}_0x48f414=_[_0x3e5b('0x4d')]({},_0x48f414,_0x5ec841[_0x3e5b('0x4f')]);var _0x123947={'where':_0x48f414['where']};return db['Trunk'][_0x3e5b('0x2c')](_0x123947)['then'](function(_0x14b62a){_0x174ebf[_0x3e5b('0x2c')]=_0x14b62a;if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x48f414[_0x3e5b('0x51')]=[{'all':!![]}];}return db[_0x3e5b('0x3c')][_0x3e5b('0x52')](_0x48f414);})[_0x3e5b('0x1d')](function(_0x339852){_0x174ebf['rows']=_0x339852;return _0x174ebf;})[_0x3e5b('0x1d')](respondWithFilteredResult(_0x47f7c8,_0x48f414))['catch'](handleError(_0x47f7c8,null));};exports[_0x3e5b('0x53')]=function(_0x2e7047,_0x26e11e){var _0x3d51fa={'raw':![],'where':{'id':_0x2e7047[_0x3e5b('0x54')]['id']}},_0x291e4d={};_0x291e4d[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x291e4d[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x2e7047[_0x3e5b('0x3e')]);_0x291e4d['filters']=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],_0x291e4d[_0x3e5b('0x3e')]);_0x3d51fa[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],qs['fields'](_0x2e7047[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x3d51fa[_0x3e5b('0x43')]=_0x3d51fa[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x3d51fa[_0x3e5b('0x43')]:_0x291e4d[_0x3e5b('0x42')];if(_0x2e7047[_0x3e5b('0x3e')]['includeAll']){_0x3d51fa[_0x3e5b('0x51')]=[{'all':!![]}];}_0x3d51fa=_['merge']({},_0x3d51fa,_0x2e7047['options']);return db[_0x3e5b('0x3c')]['find'](_0x3d51fa)[_0x3e5b('0x1d')](handleEntityNotFound(_0x26e11e,null))[_0x3e5b('0x1d')](respondWithResult(_0x26e11e,null))[_0x3e5b('0x55')](handleError(_0x26e11e,null));};exports[_0x3e5b('0x56')]=function(_0x4a492b,_0x5ddeee){var _0x545712={'where':{'id':_0x4a492b[_0x3e5b('0x54')]['id']}},_0x581b94={};_0x581b94[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x545712['attributes']=_['intersection'](_0x581b94[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x545712[_0x3e5b('0x43')]=_0x545712['attributes']['length']?_0x545712['attributes']:_0x581b94['model'];if(_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x545712[_0x3e5b('0x51')]=[{'all':!![]}];}_0x545712=_[_0x3e5b('0x4d')]({},_0x545712,_0x4a492b[_0x3e5b('0x4f')]);return db[_0x3e5b('0x3c')][_0x3e5b('0x57')](_0x545712)[_0x3e5b('0x1d')](handleEntityNotFound(_0x5ddeee,null))['then'](function(_0x285db6){if(_0x285db6){var _0x29897b=_0x285db6[_0x3e5b('0x35')]({'plain':!![]});_0x29897b=qs[_0x3e5b('0x58')](_0x29897b,['id',_0x3e5b('0x59'),'updatedAt']);_0x4a492b[_0x3e5b('0x5a')]=_['omit'](_0x4a492b[_0x3e5b('0x5a')],['id',_0x3e5b('0x59'),'updatedAt']);return db['Trunk']['create'](_[_0x3e5b('0x4d')](_0x29897b,_0x4a492b['body']),{'include':_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]?[{'all':!![]}]:undefined})[_0x3e5b('0x1d')](function(_0x40197c){var _0x14f187=_0x4a492b['user']['get']({'plain':!![]});if(!_0x14f187)throw new Error(_0x3e5b('0x5b'));if(_0x14f187[_0x3e5b('0x5c')]===_0x3e5b('0x5d')){var _0x4dfb45=_0x40197c[_0x3e5b('0x35')]({'plain':!![]});var _0x3c5293=_0x3e5b('0x36');return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3c5293,'userProfileId':_0x14f187[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x4a1ce3){if(_0x4a1ce3&&_0x4a1ce3[_0x3e5b('0x60')]===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x4dfb45[_0x3e5b('0x39')],'resourceId':_0x4dfb45['id'],'type':_0x4a1ce3[_0x3e5b('0x39')],'sectionId':_0x4a1ce3['id']},{})[_0x3e5b('0x1d')](function(){return _0x40197c;});}else{return _0x40197c;}})[_0x3e5b('0x55')](function(_0x2411c3){logger[_0x3e5b('0x22')](_0x3e5b('0x62'),_0x2411c3);throw _0x2411c3;});}return _0x40197c;});}})['then'](respondWithResult(_0x5ddeee,0xc9))[_0x3e5b('0x55')](handleError(_0x5ddeee,null));};exports[_0x3e5b('0x61')]=function(_0x5af305,_0x177144,_0x31ef31){var _0x561c78;return db['Trunk']['create'](_0x5af305[_0x3e5b('0x5a')],{'raw':!![]})[_0x3e5b('0x1d')](function(_0x498e6d){_0x561c78=_0x498e6d;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});})['then'](function(_0x3d3bf2){var _0x17f60f=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0x410c7a=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x40103e=ejs[_0x3e5b('0x69')](_0x17f60f,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x40103e);if(_0x561c78['registry']){var _0x590f0c=ejs[_0x3e5b('0x69')](_0x410c7a,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x590f0c);}})[_0x3e5b('0x1d')](function(){return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x61'),{'module':_0x3e5b('0x6d')});})[_0x3e5b('0x1d')](function(){var _0x9deb09=_0x5af305[_0x3e5b('0x5d')]['get']({'plain':!![]});if(!_0x9deb09)throw new Error(_0x3e5b('0x5b'));if(_0x9deb09[_0x3e5b('0x5c')]==='user'){var _0x577747=_0x561c78['get']({'plain':!![]});return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3e5b('0x36'),'userProfileId':_0x9deb09[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x1ba550){if(_0x1ba550&&_0x1ba550['autoAssociation']===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x577747['name'],'resourceId':_0x577747['id'],'type':_0x1ba550[_0x3e5b('0x39')],'sectionId':_0x1ba550['id']},{})['then'](function(){return _0x561c78;});}else{return _0x561c78;}})['catch'](function(_0x211e73){logger[_0x3e5b('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211e73);throw _0x211e73;});}return _0x561c78;})[_0x3e5b('0x1d')](respondWithResult(_0x177144,0xc9))[_0x3e5b('0x55')](handleError(_0x177144,null));};exports['update']=function(_0x2e36af,_0x185640,_0x14baa9){var _0x1425eb;return db[_0x3e5b('0x3c')][_0x3e5b('0x57')]({'where':{'id':_0x2e36af['params']['id']}})['then'](handleEntityNotFound(_0x185640,null))[_0x3e5b('0x1d')](saveUpdates(_0x2e36af['body'],null))['then'](function(_0x25d3d8){if(_0x25d3d8){_0x1425eb=_0x25d3d8;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});}})['then'](function(_0x2e5fa3){if(_0x2e5fa3){var _0x4b8d19=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0xdf2677=fs['readFileSync'](path[_0x3e5b('0x64')](config['root'],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x58ccf3=ejs[_0x3e5b('0x69')](_0x4b8d19,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x58ccf3);var _0x5ad011=ejs[_0x3e5b('0x69')](_0xdf2677,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5ad011);return respondWithRpcPromise('Reload',_0x3e5b('0x6f'),{'module':_0x3e5b('0x6d')});}return null;})['then'](function(_0xd9d941){if(_0xd9d941){return _0x1425eb;}})[_0x3e5b('0x1d')](respondWithResult(_0x185640,null))[_0x3e5b('0x55')](handleError(_0x185640,null));};exports['destroy']=function(_0x3b3306,_0x30e079,_0x352f7e){var _0x1d7c05;return db['Trunk'][_0x3e5b('0x57')]({'where':{'id':_0x3b3306['params']['id']}})[_0x3e5b('0x1d')](handleEntityNotFound(_0x30e079,null))['then'](removeEntity(_0x30e079,null))[_0x3e5b('0x1d')](function(){return db[_0x3e5b('0x3c')]['findAll']({'raw':!![]});})[_0x3e5b('0x1d')](function(_0x2299b9){var _0x56ff9d=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),'utf8');var _0x53328b=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x3d1193=ejs['render'](_0x56ff9d,{'trunks':_0x2299b9});var _0x5d6aae=ejs[_0x3e5b('0x69')](_0x53328b,{'trunks':_0x2299b9});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x3d1193);fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5d6aae);return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x34'),{'module':_0x3e5b('0x6d')});})['catch'](handleError(_0x30e079,null));}; \ No newline at end of file +var _0x24ca=['lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','Trunks','UserProfileResource','destroy','then','end','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','rawAttributes','keys','find','clone','length','omit','createdAt','updatedAt','create','user','role','userProfileId','autoAssociation','body','join','root','server/files/templates/trunk.ejs','readFileSync','server/files/templates/registry.ejs','utf8','writeFileSync','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x21d073,_0x1ad9da){var _0x19b74f=function(_0x483f6e){while(--_0x483f6e){_0x21d073['push'](_0x21d073['shift']());}};_0x19b74f(++_0x1ad9da);}(_0x24ca,0x1bc));var _0xa24c=function(_0x2a2166,_0x3a077f){_0x2a2166=_0x2a2166-0x0;var _0x3bcf50=_0x24ca[_0x2a2166];return _0x3bcf50;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];var jayson=require(_0xa24c('0x1b'));var client=jayson[_0xa24c('0x1c')][_0xa24c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5a9486,_0x3ad0bf,_0x3c23fc,_0x26ff28){return new BPromise(function(_0x2fcd8b,_0x1cb08e){var _0x2d185c=_0x26ff28||client;return _0x2d185c[_0xa24c('0x1e')](_0x5a9486,_0x3c23fc)['then'](function(_0x47a063){logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,'request\x20sent');logger['debug'](_0xa24c('0x21'),_0x3ad0bf,_0xa24c('0x22'),JSON['stringify'](_0x47a063));if(_0x47a063[_0xa24c('0x23')]){if(_0x47a063['error'][_0xa24c('0x24')]===0x1f4){logger[_0xa24c('0x23')](_0xa24c('0x20'),_0x3ad0bf,_0x47a063[_0xa24c('0x23')]['message']);return _0x1cb08e(_0x47a063[_0xa24c('0x23')][_0xa24c('0x25')]);}logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x47a063['error']['message']);return _0x2fcd8b(_0x47a063['error'][_0xa24c('0x25')]);}else{logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,_0xa24c('0x22'));_0x2fcd8b(_0x47a063['result'][_0xa24c('0x25')]);}})['catch'](function(_0x224bca){logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x224bca);_0x1cb08e(_0x224bca);});});}function respondWithStatusCode(_0x346ee8,_0x363d52){_0x363d52=_0x363d52||0xcc;return function(_0x43a0c0){if(_0x43a0c0){return _0x346ee8[_0xa24c('0x26')](_0x363d52);}return _0x346ee8[_0xa24c('0x27')](_0x363d52)['end']();};}function respondWithResult(_0xec9167,_0x5cc9cb){_0x5cc9cb=_0x5cc9cb||0xc8;return function(_0x2365f9){if(_0x2365f9){return _0xec9167[_0xa24c('0x27')](_0x5cc9cb)[_0xa24c('0x28')](_0x2365f9);}};}function respondWithFilteredResult(_0x51dc3f,_0x1beb55){return function(_0x31c4d9){if(_0x31c4d9){var _0x14fd5a=typeof _0x1beb55[_0xa24c('0x29')]===_0xa24c('0x2a')&&typeof _0x1beb55[_0xa24c('0x2b')]===_0xa24c('0x2a');var _0x5b23f4=_0x31c4d9[_0xa24c('0x2c')];var _0x28675f=_0x14fd5a?0x0:_0x1beb55[_0xa24c('0x29')];var _0x12dbdc=_0x14fd5a?_0x31c4d9['count']:_0x1beb55[_0xa24c('0x29')]+_0x1beb55[_0xa24c('0x2b')];var _0x97c08;if(_0x12dbdc>=_0x5b23f4){_0x12dbdc=_0x5b23f4;_0x97c08=0xc8;}else{_0x97c08=0xce;}_0x51dc3f['status'](_0x97c08);return _0x51dc3f[_0xa24c('0x2d')](_0xa24c('0x2e'),_0x28675f+'-'+_0x12dbdc+'/'+_0x5b23f4)[_0xa24c('0x28')](_0x31c4d9);}return null;};}function patchUpdates(_0x4ae35c){return function(_0x245fb2){try{jsonpatch['apply'](_0x245fb2,_0x4ae35c,!![]);}catch(_0x1102ab){return BPromise[_0xa24c('0x2f')](_0x1102ab);}return _0x245fb2[_0xa24c('0x30')]();};}function saveUpdates(_0x5d025a,_0x1f52f8){return function(_0x53f90){if(_0x53f90){return _0x53f90[_0xa24c('0x31')](_0x5d025a)['then'](function(_0x1c1ed3){return _0x1c1ed3;});}return null;};}function removeEntity(_0x57c340,_0xa20091){return function(_0x42ba21){if(_0x42ba21){return _0x42ba21['destroy']()['then'](function(){var _0x20a276=_0x42ba21[_0xa24c('0x32')]({'plain':!![]});var _0x182e86=_0xa24c('0x33');return db[_0xa24c('0x34')][_0xa24c('0x35')]({'where':{'type':_0x182e86,'resourceId':_0x20a276['id']}})[_0xa24c('0x36')](function(){return _0x42ba21;});})['then'](function(){_0x57c340[_0xa24c('0x27')](0xcc)[_0xa24c('0x37')]();});}};}function handleEntityNotFound(_0x12825d,_0xbd24c0){return function(_0xc6337b){if(!_0xc6337b){_0x12825d[_0xa24c('0x26')](0x194);}return _0xc6337b;};}function handleError(_0x86902f,_0x81d471){_0x81d471=_0x81d471||0x1f4;return function(_0x1ea166){logger[_0xa24c('0x23')](_0x1ea166['stack']);if(_0x1ea166[_0xa24c('0x38')]){delete _0x1ea166[_0xa24c('0x38')];}_0x86902f[_0xa24c('0x27')](_0x81d471)[_0xa24c('0x39')](_0x1ea166);};}exports['index']=function(_0x56a485,_0x19a65f){var _0x56ef4d={},_0xb690b5={},_0x13f272={'count':0x0,'rows':[]};var _0x22a316=_[_0xa24c('0x3a')](db[_0xa24c('0x3b')]['rawAttributes'],function(_0x532875){return{'name':_0x532875[_0xa24c('0x3c')],'type':_0x532875[_0xa24c('0x3d')][_0xa24c('0x3e')]};});_0xb690b5[_0xa24c('0x3f')]=_[_0xa24c('0x3a')](_0x22a316,_0xa24c('0x38'));_0xb690b5['query']=_['keys'](_0x56a485[_0xa24c('0x40')]);_0xb690b5[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],_0xb690b5[_0xa24c('0x40')]);_0x56ef4d['attributes']=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],qs['fields'](_0x56a485['query'][_0xa24c('0x43')]));_0x56ef4d[_0xa24c('0x44')]=_0x56ef4d[_0xa24c('0x44')]['length']?_0x56ef4d['attributes']:_0xb690b5[_0xa24c('0x3f')];if(!_0x56a485[_0xa24c('0x40')][_0xa24c('0x45')](_0xa24c('0x46'))){_0x56ef4d[_0xa24c('0x2b')]=qs[_0xa24c('0x2b')](_0x56a485[_0xa24c('0x40')][_0xa24c('0x2b')]);_0x56ef4d['offset']=qs['offset'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x29')]);}_0x56ef4d[_0xa24c('0x47')]=qs['sort'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x48')]);_0x56ef4d[_0xa24c('0x49')]=qs[_0xa24c('0x41')](_[_0xa24c('0x4a')](_0x56a485[_0xa24c('0x40')],_0xb690b5[_0xa24c('0x41')]),_0x22a316);if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]){_0x56ef4d[_0xa24c('0x49')]=_['merge'](_0x56ef4d[_0xa24c('0x49')],{'$or':_[_0xa24c('0x3a')](_0x22a316,function(_0x39a6cd){if(_0x39a6cd['type']!==_0xa24c('0x4c')){var _0x247d2c={};_0x247d2c[_0x39a6cd[_0xa24c('0x38')]]={'$like':'%'+_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]+'%'};return _0x247d2c;}})});}_0x56ef4d=_[_0xa24c('0x4d')]({},_0x56ef4d,_0x56a485[_0xa24c('0x4e')]);var _0x46f725={'where':_0x56ef4d[_0xa24c('0x49')]};return db[_0xa24c('0x3b')][_0xa24c('0x2c')](_0x46f725)['then'](function(_0x29a84d){_0x13f272[_0xa24c('0x2c')]=_0x29a84d;if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x56ef4d[_0xa24c('0x50')]=[{'all':!![]}];}return db[_0xa24c('0x3b')][_0xa24c('0x51')](_0x56ef4d);})[_0xa24c('0x36')](function(_0x184179){_0x13f272['rows']=_0x184179;return _0x13f272;})['then'](respondWithFilteredResult(_0x19a65f,_0x56ef4d))[_0xa24c('0x52')](handleError(_0x19a65f,null));};exports['show']=function(_0xc078ef,_0x1f436c){var _0x4ec677={'raw':![],'where':{'id':_0xc078ef[_0xa24c('0x53')]['id']}},_0x24b3df={};_0x24b3df[_0xa24c('0x3f')]=_['keys'](db['Trunk'][_0xa24c('0x54')]);_0x24b3df['query']=_[_0xa24c('0x55')](_0xc078ef[_0xa24c('0x40')]);_0x24b3df[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],_0x24b3df[_0xa24c('0x40')]);_0x4ec677[_0xa24c('0x44')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0xc078ef['query'][_0xa24c('0x43')]));_0x4ec677[_0xa24c('0x44')]=_0x4ec677[_0xa24c('0x44')]['length']?_0x4ec677['attributes']:_0x24b3df['model'];if(_0xc078ef[_0xa24c('0x40')]['includeAll']){_0x4ec677[_0xa24c('0x50')]=[{'all':!![]}];}_0x4ec677=_[_0xa24c('0x4d')]({},_0x4ec677,_0xc078ef['options']);return db[_0xa24c('0x3b')][_0xa24c('0x56')](_0x4ec677)[_0xa24c('0x36')](handleEntityNotFound(_0x1f436c,null))[_0xa24c('0x36')](respondWithResult(_0x1f436c,null))[_0xa24c('0x52')](handleError(_0x1f436c,null));};exports[_0xa24c('0x57')]=function(_0x3816f7,_0xbeab78){var _0x518c2a={'where':{'id':_0x3816f7['params']['id']}},_0x172645={};_0x172645['model']=_['keys'](db['Trunk']['rawAttributes']);_0x518c2a[_0xa24c('0x44')]=_['intersection'](_0x172645[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0x3816f7[_0xa24c('0x40')][_0xa24c('0x43')]));_0x518c2a[_0xa24c('0x44')]=_0x518c2a[_0xa24c('0x44')][_0xa24c('0x58')]?_0x518c2a[_0xa24c('0x44')]:_0x172645[_0xa24c('0x3f')];if(_0x3816f7[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x518c2a[_0xa24c('0x50')]=[{'all':!![]}];}_0x518c2a=_[_0xa24c('0x4d')]({},_0x518c2a,_0x3816f7[_0xa24c('0x4e')]);return db[_0xa24c('0x3b')]['find'](_0x518c2a)[_0xa24c('0x36')](handleEntityNotFound(_0xbeab78,null))[_0xa24c('0x36')](function(_0x5264a7){if(_0x5264a7){var _0x1e08bb=_0x5264a7[_0xa24c('0x32')]({'plain':!![]});_0x1e08bb=qs[_0xa24c('0x59')](_0x1e08bb,['id',_0xa24c('0x5a'),'updatedAt']);_0x3816f7['body']=_[_0xa24c('0x59')](_0x3816f7['body'],['id','createdAt',_0xa24c('0x5b')]);return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_[_0xa24c('0x4d')](_0x1e08bb,_0x3816f7['body']),{'include':_0x3816f7['query'][_0xa24c('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x52a895){var _0xfcc193=_0x3816f7[_0xa24c('0x5d')][_0xa24c('0x32')]({'plain':!![]});if(!_0xfcc193)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfcc193[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5c3285=_0x52a895[_0xa24c('0x32')]({'plain':!![]});var _0x3f306d=_0xa24c('0x33');return db['UserProfileSection'][_0xa24c('0x56')]({'where':{'name':_0x3f306d,'userProfileId':_0xfcc193[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x7aab6e){if(_0x7aab6e&&_0x7aab6e[_0xa24c('0x60')]===0x0){return db['UserProfileResource'][_0xa24c('0x5c')]({'name':_0x5c3285[_0xa24c('0x38')],'resourceId':_0x5c3285['id'],'type':_0x7aab6e[_0xa24c('0x38')],'sectionId':_0x7aab6e['id']},{})[_0xa24c('0x36')](function(){return _0x52a895;});}else{return _0x52a895;}})[_0xa24c('0x52')](function(_0x2ca3fa){logger[_0xa24c('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ca3fa);throw _0x2ca3fa;});}return _0x52a895;});}})[_0xa24c('0x36')](respondWithResult(_0xbeab78,0xc9))[_0xa24c('0x52')](handleError(_0xbeab78,null));};exports['create']=function(_0xb1048a,_0x3e455b,_0x14da5e){var _0xb460b4;return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_0xb1048a[_0xa24c('0x61')],{'raw':!![]})[_0xa24c('0x36')](function(_0x38cc30){_0xb460b4=_0x38cc30;return db[_0xa24c('0x3b')]['findAll']({'raw':!![]});})[_0xa24c('0x36')](function(_0x3a4abd){var _0x3b894f=fs['readFileSync'](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x64')),'utf8');var _0x3ac3a0=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4f9b56=ejs['render'](_0x3b894f,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4f9b56);if(_0xb460b4[_0xa24c('0x69')]){var _0x1879ae=ejs[_0xa24c('0x6a')](_0x3ac3a0,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')](_0xa24c('0x6b'),_0x1879ae);}})['then'](function(){return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x5c'),{'module':_0xa24c('0x6d')});})[_0xa24c('0x36')](function(){var _0x987aca=_0xb1048a[_0xa24c('0x5d')]['get']({'plain':!![]});if(!_0x987aca)throw new Error(_0xa24c('0x6e'));if(_0x987aca[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5b9ad7=_0xb460b4['get']({'plain':!![]});return db[_0xa24c('0x6f')]['find']({'where':{'name':_0xa24c('0x33'),'userProfileId':_0x987aca[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x180da2){if(_0x180da2&&_0x180da2['autoAssociation']===0x0){return db[_0xa24c('0x34')][_0xa24c('0x5c')]({'name':_0x5b9ad7['name'],'resourceId':_0x5b9ad7['id'],'type':_0x180da2[_0xa24c('0x38')],'sectionId':_0x180da2['id']},{})[_0xa24c('0x36')](function(){return _0xb460b4;});}else{return _0xb460b4;}})[_0xa24c('0x52')](function(_0x3e0c08){logger[_0xa24c('0x23')](_0xa24c('0x70'),_0x3e0c08);throw _0x3e0c08;});}return _0xb460b4;})[_0xa24c('0x36')](respondWithResult(_0x3e455b,0xc9))[_0xa24c('0x52')](handleError(_0x3e455b,null));};exports['update']=function(_0x12508e,_0x3c2726,_0x2cae90){var _0x28c3ff;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x12508e[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3c2726,null))[_0xa24c('0x36')](saveUpdates(_0x12508e[_0xa24c('0x61')],null))[_0xa24c('0x36')](function(_0x5b0127){if(_0x5b0127){_0x28c3ff=_0x5b0127;return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});}})['then'](function(_0x141ccf){if(_0x141ccf){var _0x3f212f=fs[_0xa24c('0x65')](path['join'](config['root'],_0xa24c('0x64')),_0xa24c('0x67'));var _0x53928f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x336898=ejs['render'](_0x3f212f,{'trunks':_0x141ccf||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x336898);var _0x263dab=ejs['render'](_0x53928f,{'trunks':_0x141ccf||[]});fs['writeFileSync'](_0xa24c('0x6b'),_0x263dab);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x31'),{'module':_0xa24c('0x6d')});}return null;})[_0xa24c('0x36')](function(_0x45b2fe){if(_0x45b2fe){return _0x28c3ff;}})[_0xa24c('0x36')](respondWithResult(_0x3c2726,null))[_0xa24c('0x52')](handleError(_0x3c2726,null));};exports[_0xa24c('0x35')]=function(_0x4ee10d,_0x3897ca,_0xa077c8){var _0x16e1db;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x4ee10d[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3897ca,null))[_0xa24c('0x36')](removeEntity(_0x3897ca,null))[_0xa24c('0x36')](function(){return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});})[_0xa24c('0x36')](function(_0x4ecbe9){var _0x1fe0f3=fs[_0xa24c('0x65')](path['join'](config[_0xa24c('0x63')],_0xa24c('0x64')),_0xa24c('0x67'));var _0x4af78f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config['root'],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4c108f=ejs['render'](_0x1fe0f3,{'trunks':_0x4ecbe9});var _0x124d52=ejs[_0xa24c('0x6a')](_0x4af78f,{'trunks':_0x4ecbe9});fs[_0xa24c('0x68')](_0xa24c('0x71'),_0x4c108f);fs['writeFileSync'](_0xa24c('0x6b'),_0x124d52);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x35'),{'module':'chan_sip.so'});})['catch'](handleError(_0x3897ca,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 2bea2be..1ec59c8 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 _0x47ad=['api','moment','bluebird','path','rimraf','exports','define','tools_trunks','util','../../config/logger'];(function(_0x2e7522,_0x5b1548){var _0x200019=function(_0x4aebdd){while(--_0x4aebdd){_0x2e7522['push'](_0x2e7522['shift']());}};_0x200019(++_0x5b1548);}(_0x47ad,0xf8));var _0xd47a=function(_0x9a29ea,_0x5b8b29){_0x9a29ea=_0x9a29ea-0x0;var _0x11f261=_0x47ad[_0x9a29ea];return _0x11f261;};'use strict';var _=require('lodash');var util=require(_0xd47a('0x0'));var logger=require(_0xd47a('0x1'))(_0xd47a('0x2'));var moment=require(_0xd47a('0x3'));var BPromise=require(_0xd47a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd47a('0x5'));var rimraf=require(_0xd47a('0x6'));var config=require('../../config/environment');var attributes=require('./trunk.attributes');module[_0xd47a('0x7')]=function(_0x24ebb0,_0x29ec1e){return _0x24ebb0[_0xd47a('0x8')]('Trunk',attributes,{'tableName':_0xd47a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2c3=['moment','bluebird','request-promise','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util'];(function(_0xf91324,_0x418e81){var _0x5509d0=function(_0x21861d){while(--_0x21861d){_0xf91324['push'](_0xf91324['shift']());}};_0x5509d0(++_0x418e81);}(_0xd2c3,0xb2));var _0x3d2c=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xd2c3[_0x1f36bb];return _0xaf97fa;};'use strict';var _=require(_0x3d2c('0x0'));var util=require(_0x3d2c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3d2c('0x2'));var BPromise=require(_0x3d2c('0x3'));var rp=require(_0x3d2c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d2c('0x5'));var config=require(_0x3d2c('0x6'));var attributes=require(_0x3d2c('0x7'));module[_0x3d2c('0x8')]=function(_0x1bf11c,_0x52040e){return _0x1bf11c[_0x3d2c('0x9')](_0x3d2c('0xa'),attributes,{'tableName':_0x3d2c('0xb'),'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 c0f261f..7b7114f 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 _0x64c2=['catch','GetTrunk','options','where','attributes','limit','include','map','model','ShowTrunk','Trunk','find','raw','then','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x538220,_0x2717e0){var _0xba9cd9=function(_0x4f5a01){while(--_0x4f5a01){_0x538220['push'](_0x538220['shift']());}};_0xba9cd9(++_0x2717e0);}(_0x64c2,0x18f));var _0x264c=function(_0x5c9f58,_0x312476){_0x5c9f58=_0x5c9f58-0x0;var _0x359d94=_0x64c2[_0x5c9f58];return _0x359d94;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x264c('0x0'));var BPromise=require(_0x264c('0x1'));var rs=require(_0x264c('0x2'));var fs=require('fs');var Redis=require(_0x264c('0x3'));var db=require(_0x264c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x264c('0x5'))(_0x264c('0x6'));var config=require(_0x264c('0x7'));var jayson=require(_0x264c('0x8'));var client=jayson[_0x264c('0x9')][_0x264c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x165178,_0x4b4ba1,_0x245611){return new BPromise(function(_0x2d49b0,_0x9a6768){return client[_0x264c('0xb')](_0x165178,_0x245611)['then'](function(_0x2a81b2){logger[_0x264c('0xc')](_0x264c('0xd'),_0x4b4ba1,_0x264c('0xe'));logger[_0x264c('0xf')]('Trunk,\x20%s,\x20%s,\x20%s',_0x4b4ba1,_0x264c('0xe'),JSON[_0x264c('0x10')](_0x2a81b2));if(_0x2a81b2[_0x264c('0x11')]){if(_0x2a81b2['error'][_0x264c('0x12')]===0x1f4){logger[_0x264c('0x11')](_0x264c('0xd'),_0x4b4ba1,_0x2a81b2['error'][_0x264c('0x13')]);return _0x9a6768(_0x2a81b2['error']['message']);}logger[_0x264c('0x11')](_0x264c('0xd'),_0x4b4ba1,_0x2a81b2[_0x264c('0x11')][_0x264c('0x13')]);return _0x2d49b0(_0x2a81b2[_0x264c('0x11')][_0x264c('0x13')]);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x4b4ba1,_0x264c('0xe'));_0x2d49b0(_0x2a81b2[_0x264c('0x14')][_0x264c('0x13')]);}})[_0x264c('0x15')](function(_0x4b09c0){logger[_0x264c('0x11')]('Trunk,\x20%s,\x20%s',_0x4b4ba1,_0x4b09c0);_0x9a6768(_0x4b09c0);});});}exports[_0x264c('0x16')]=function(_0x4b6384){var _0x1b2b97=this;return new Promise(function(_0x91505e,_0x11a20a){return db['Trunk']['findAll']({'raw':_0x4b6384[_0x264c('0x17')]?_0x4b6384[_0x264c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4b6384[_0x264c('0x17')]?_0x4b6384['options'][_0x264c('0x18')]||null:null,'attributes':_0x4b6384[_0x264c('0x17')]?_0x4b6384[_0x264c('0x17')][_0x264c('0x19')]||null:null,'limit':_0x4b6384[_0x264c('0x17')]?_0x4b6384['options'][_0x264c('0x1a')]||null:null,'include':_0x4b6384['options']?_0x4b6384[_0x264c('0x17')][_0x264c('0x1b')]?_[_0x264c('0x1c')](_0x4b6384['options']['include'],function(_0x4fac91){return{'model':db[_0x4fac91[_0x264c('0x1d')]],'as':_0x4fac91['as'],'attributes':_0x4fac91['attributes'],'include':_0x4fac91[_0x264c('0x1b')]?_[_0x264c('0x1c')](_0x4fac91['include'],function(_0x7c28eb){return{'model':db[_0x7c28eb[_0x264c('0x1d')]],'as':_0x7c28eb['as'],'attributes':_0x7c28eb['attributes'],'include':_0x7c28eb[_0x264c('0x1b')]?_[_0x264c('0x1c')](_0x7c28eb[_0x264c('0x1b')],function(_0x5422c2){return{'model':db[_0x5422c2[_0x264c('0x1d')]],'as':_0x5422c2['as'],'attributes':_0x5422c2[_0x264c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46eeb0){logger['info'](_0x264c('0x16'),_0x4b6384);logger[_0x264c('0xf')](_0x264c('0x16'),_0x4b6384,JSON[_0x264c('0x10')](_0x46eeb0));_0x91505e(_0x46eeb0);})['catch'](function(_0x3a249c){logger[_0x264c('0x11')](_0x264c('0x16'),_0x3a249c[_0x264c('0x13')],_0x4b6384);_0x11a20a(_0x1b2b97[_0x264c('0x11')](0x1f4,_0x3a249c[_0x264c('0x13')]));});});};exports[_0x264c('0x1e')]=function(_0x41ceb8){var _0x43dbdd=this;return new Promise(function(_0x85631,_0x1075f1){return db[_0x264c('0x1f')][_0x264c('0x20')]({'raw':_0x41ceb8[_0x264c('0x17')]?_0x41ceb8[_0x264c('0x17')][_0x264c('0x21')]===undefined?!![]:![]:!![],'where':_0x41ceb8[_0x264c('0x17')]?_0x41ceb8[_0x264c('0x17')][_0x264c('0x18')]||null:null,'attributes':_0x41ceb8['options']?_0x41ceb8['options'][_0x264c('0x19')]||null:null,'include':_0x41ceb8['options']?_0x41ceb8[_0x264c('0x17')][_0x264c('0x1b')]?_[_0x264c('0x1c')](_0x41ceb8[_0x264c('0x17')][_0x264c('0x1b')],function(_0x233c37){return{'model':db[_0x233c37[_0x264c('0x1d')]],'as':_0x233c37['as'],'attributes':_0x233c37[_0x264c('0x19')],'include':_0x233c37[_0x264c('0x1b')]?_[_0x264c('0x1c')](_0x233c37[_0x264c('0x1b')],function(_0x346c4d){return{'model':db[_0x346c4d[_0x264c('0x1d')]],'as':_0x346c4d['as'],'attributes':_0x346c4d[_0x264c('0x19')],'include':_0x346c4d[_0x264c('0x1b')]?_['map'](_0x346c4d['include'],function(_0x107369){return{'model':db[_0x107369[_0x264c('0x1d')]],'as':_0x107369['as'],'attributes':_0x107369[_0x264c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x264c('0x22')](function(_0x17ed4e){logger[_0x264c('0xc')](_0x264c('0x1e'),_0x41ceb8);logger[_0x264c('0xf')](_0x264c('0x1e'),_0x41ceb8,JSON[_0x264c('0x10')](_0x17ed4e));_0x85631(_0x17ed4e);})[_0x264c('0x15')](function(_0x496e26){logger[_0x264c('0x11')](_0x264c('0x1e'),_0x496e26[_0x264c('0x13')],_0x41ceb8);_0x1075f1(_0x43dbdd[_0x264c('0x11')](0x1f4,_0x496e26[_0x264c('0x13')]));});});}; \ No newline at end of file +var _0xb0f3=['request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Trunk','findAll','options','include','map','model','attributes','GetTrunk','where','ShowTrunk','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x718985,_0x1637ca){var _0x2904c6=function(_0xc88ac6){while(--_0xc88ac6){_0x718985['push'](_0x718985['shift']());}};_0x2904c6(++_0x1637ca);}(_0xb0f3,0x198));var _0x3b0f=function(_0x5413f5,_0x3154c7){_0x5413f5=_0x5413f5-0x0;var _0x639288=_0xb0f3[_0x5413f5];return _0x639288;};'use strict';var _=require(_0x3b0f('0x0'));var util=require(_0x3b0f('0x1'));var moment=require('moment');var BPromise=require(_0x3b0f('0x2'));var rs=require(_0x3b0f('0x3'));var fs=require('fs');var Redis=require(_0x3b0f('0x4'));var db=require(_0x3b0f('0x5'))['db'];var utils=require(_0x3b0f('0x6'));var logger=require('../../config/logger')(_0x3b0f('0x7'));var config=require(_0x3b0f('0x8'));var jayson=require(_0x3b0f('0x9'));var client=jayson[_0x3b0f('0xa')][_0x3b0f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19fe55,_0x5812f5,_0x48d990){return new BPromise(function(_0x2c065c,_0x369276){return client[_0x3b0f('0xc')](_0x19fe55,_0x48d990)[_0x3b0f('0xd')](function(_0x569380){logger[_0x3b0f('0xe')](_0x3b0f('0xf'),_0x5812f5,_0x3b0f('0x10'));logger[_0x3b0f('0x11')](_0x3b0f('0x12'),_0x5812f5,'request\x20sent',JSON[_0x3b0f('0x13')](_0x569380));if(_0x569380[_0x3b0f('0x14')]){if(_0x569380['error'][_0x3b0f('0x15')]===0x1f4){logger['error'](_0x3b0f('0xf'),_0x5812f5,_0x569380[_0x3b0f('0x14')][_0x3b0f('0x16')]);return _0x369276(_0x569380['error'][_0x3b0f('0x16')]);}logger[_0x3b0f('0x14')](_0x3b0f('0xf'),_0x5812f5,_0x569380[_0x3b0f('0x14')][_0x3b0f('0x16')]);return _0x2c065c(_0x569380['error']['message']);}else{logger[_0x3b0f('0xe')]('Trunk,\x20%s,\x20%s',_0x5812f5,_0x3b0f('0x10'));_0x2c065c(_0x569380[_0x3b0f('0x17')][_0x3b0f('0x16')]);}})[_0x3b0f('0x18')](function(_0x417a40){logger[_0x3b0f('0x14')](_0x3b0f('0xf'),_0x5812f5,_0x417a40);_0x369276(_0x417a40);});});}exports['GetTrunk']=function(_0x4d0b51){var _0x5bb21b=this;return new Promise(function(_0x2f49c8,_0x44a14d){return db[_0x3b0f('0x19')][_0x3b0f('0x1a')]({'raw':_0x4d0b51[_0x3b0f('0x1b')]?_0x4d0b51['options']['raw']===undefined?!![]:![]:!![],'where':_0x4d0b51[_0x3b0f('0x1b')]?_0x4d0b51['options']['where']||null:null,'attributes':_0x4d0b51[_0x3b0f('0x1b')]?_0x4d0b51['options']['attributes']||null:null,'limit':_0x4d0b51[_0x3b0f('0x1b')]?_0x4d0b51[_0x3b0f('0x1b')]['limit']||null:null,'include':_0x4d0b51['options']?_0x4d0b51['options'][_0x3b0f('0x1c')]?_[_0x3b0f('0x1d')](_0x4d0b51['options'][_0x3b0f('0x1c')],function(_0x23d1f7){return{'model':db[_0x23d1f7[_0x3b0f('0x1e')]],'as':_0x23d1f7['as'],'attributes':_0x23d1f7[_0x3b0f('0x1f')],'include':_0x23d1f7[_0x3b0f('0x1c')]?_['map'](_0x23d1f7[_0x3b0f('0x1c')],function(_0x361dae){return{'model':db[_0x361dae[_0x3b0f('0x1e')]],'as':_0x361dae['as'],'attributes':_0x361dae[_0x3b0f('0x1f')],'include':_0x361dae[_0x3b0f('0x1c')]?_[_0x3b0f('0x1d')](_0x361dae[_0x3b0f('0x1c')],function(_0x4a1bee){return{'model':db[_0x4a1bee[_0x3b0f('0x1e')]],'as':_0x4a1bee['as'],'attributes':_0x4a1bee[_0x3b0f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3b0f('0xd')](function(_0x5c0f4a){logger['info']('GetTrunk',_0x4d0b51);logger['debug'](_0x3b0f('0x20'),_0x4d0b51,JSON['stringify'](_0x5c0f4a));_0x2f49c8(_0x5c0f4a);})['catch'](function(_0x9c8e5c){logger[_0x3b0f('0x14')](_0x3b0f('0x20'),_0x9c8e5c['message'],_0x4d0b51);_0x44a14d(_0x5bb21b[_0x3b0f('0x14')](0x1f4,_0x9c8e5c[_0x3b0f('0x16')]));});});};exports['ShowTrunk']=function(_0x248f41){var _0x5cf2fc=this;return new Promise(function(_0xfe42d5,_0x185ad3){return db[_0x3b0f('0x19')]['find']({'raw':_0x248f41[_0x3b0f('0x1b')]?_0x248f41[_0x3b0f('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x248f41['options']?_0x248f41[_0x3b0f('0x1b')][_0x3b0f('0x21')]||null:null,'attributes':_0x248f41['options']?_0x248f41[_0x3b0f('0x1b')][_0x3b0f('0x1f')]||null:null,'include':_0x248f41[_0x3b0f('0x1b')]?_0x248f41[_0x3b0f('0x1b')][_0x3b0f('0x1c')]?_['map'](_0x248f41['options']['include'],function(_0xba403d){return{'model':db[_0xba403d[_0x3b0f('0x1e')]],'as':_0xba403d['as'],'attributes':_0xba403d[_0x3b0f('0x1f')],'include':_0xba403d['include']?_[_0x3b0f('0x1d')](_0xba403d[_0x3b0f('0x1c')],function(_0x4b5e2d){return{'model':db[_0x4b5e2d[_0x3b0f('0x1e')]],'as':_0x4b5e2d['as'],'attributes':_0x4b5e2d[_0x3b0f('0x1f')],'include':_0x4b5e2d['include']?_[_0x3b0f('0x1d')](_0x4b5e2d['include'],function(_0x2519da){return{'model':db[_0x2519da[_0x3b0f('0x1e')]],'as':_0x2519da['as'],'attributes':_0x2519da[_0x3b0f('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bc3c1){logger['info']('ShowTrunk',_0x248f41);logger[_0x3b0f('0x11')](_0x3b0f('0x22'),_0x248f41,JSON[_0x3b0f('0x13')](_0x2bc3c1));_0xfe42d5(_0x2bc3c1);})[_0x3b0f('0x18')](function(_0x4b1b92){logger[_0x3b0f('0x14')]('ShowTrunk',_0x4b1b92[_0x3b0f('0x16')],_0x248f41);_0x185ad3(_0x5cf2fc[_0x3b0f('0x14')](0x1f4,_0x4b1b92[_0x3b0f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index b9155b2..6b8660a 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad23=['put','/:id','isAuthenticated','update','exports','express','Router','../../components/auth/service','./user-setting.controller'];(function(_0x463183,_0x56bd4e){var _0xd5fe56=function(_0x55cb29){while(--_0x55cb29){_0x463183['push'](_0x463183['shift']());}};_0xd5fe56(++_0x56bd4e);}(_0xad23,0x9e));var _0x3ad2=function(_0x43f13b,_0x1f319e){_0x43f13b=_0x43f13b-0x0;var _0x5cc313=_0xad23[_0x43f13b];return _0x5cc313;};'use strict';var express=require(_0x3ad2('0x0'));var router=express[_0x3ad2('0x1')]();var auth=require(_0x3ad2('0x2'));var controller=require(_0x3ad2('0x3'));router[_0x3ad2('0x4')](_0x3ad2('0x5'),auth[_0x3ad2('0x6')](),controller[_0x3ad2('0x7')]);module[_0x3ad2('0x8')]=router; \ No newline at end of file +var _0x2efe=['../../components/auth/service','put','isAuthenticated','update','exports','express','Router'];(function(_0x1f320d,_0x140c75){var _0x31f915=function(_0x41fb15){while(--_0x41fb15){_0x1f320d['push'](_0x1f320d['shift']());}};_0x31f915(++_0x140c75);}(_0x2efe,0x1e1));var _0xe2ef=function(_0x42c555,_0xb5bea2){_0x42c555=_0x42c555-0x0;var _0x4de39b=_0x2efe[_0x42c555];return _0x4de39b;};'use strict';var express=require(_0xe2ef('0x0'));var router=express[_0xe2ef('0x1')]();var auth=require(_0xe2ef('0x2'));var controller=require('./user-setting.controller');router[_0xe2ef('0x3')]('/:id',auth[_0xe2ef('0x4')](),controller[_0xe2ef('0x5')]);module[_0xe2ef('0x6')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 2df351d..5fcaea8 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5801=['error','warning','BOOLEAN','TEXT','DATE','INTEGER','UserId'];(function(_0x2d96a1,_0xc663b4){var _0x5b6a52=function(_0x20c40e){while(--_0x20c40e){_0x2d96a1['push'](_0x2d96a1['shift']());}};_0x5b6a52(++_0xc663b4);}(_0x5801,0x181));var _0x1580=function(_0x7b2510,_0x58063d){_0x7b2510=_0x7b2510-0x0;var _0x49bceb=_0x5801[_0x7b2510];return _0x49bceb;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x1580('0x0'),_0x1580('0x1'),'info','debug'];module['exports']={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x1580('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x1580('0x2')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x1580('0x3')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x1580('0x4')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x1580('0x5')],'unique':_0x1580('0x6')}}; \ No newline at end of file +var _0xb26f=['BOOLEAN','DATE','UserId','sequelize','error','warning','info','exports'];(function(_0x53a7af,_0x1408a5){var _0x3cc7f6=function(_0x4bf101){while(--_0x4bf101){_0x53a7af['push'](_0x53a7af['shift']());}};_0x3cc7f6(++_0x1408a5);}(_0xb26f,0x1bb));var _0xfb26=function(_0xba96b0,_0x36e8f8){_0xba96b0=_0xba96b0-0x0;var _0xdad969=_0xb26f[_0xba96b0];return _0xdad969;};'use strict';var Sequelize=require(_0xfb26('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xfb26('0x1'),_0xfb26('0x2'),_0xfb26('0x3'),'debug'];module[_0xfb26('0x4')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xfb26('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xfb26('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xfb26('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0xfb26('0x7')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 80de897..bc9fc35 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x861c=['find','params','catch','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','update','then','error','name','send','user','admin','Unauthorized','Invalid\x20user\x20setting\x20id','UserSetting'];(function(_0x47c43c,_0x30d105){var _0x3c0cf9=function(_0x4e311c){while(--_0x4e311c){_0x47c43c['push'](_0x47c43c['shift']());}};_0x3c0cf9(++_0x30d105);}(_0x861c,0xdb));var _0xc861=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x861c[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xc861('0x0'));var Redis=require(_0xc861('0x1'));var logger=require(_0xc861('0x2'))(_0xc861('0x3'));var config=require(_0xc861('0x4'));var db=require(_0xc861('0x5'))['db'];var socket=require(_0xc861('0x6'))(new Redis(config[_0xc861('0x7')]));require(_0xc861('0x8'))[_0xc861('0x9')](socket);config[_0xc861('0x7')]=_[_0xc861('0xa')](config['redis'],{'host':_0xc861('0xb'),'port':0x18eb});function respondWithResult(_0xad001d,_0x1990b6){_0x1990b6=_0x1990b6||0xc8;return function(_0x36cb1f){if(_0x36cb1f){return _0xad001d[_0xc861('0xc')](_0x1990b6)[_0xc861('0xd')](_0x36cb1f);}};}function saveUpdates(_0x3c9cd6){return function(_0x27420a){if(_0x27420a){return _0x27420a[_0xc861('0xe')](_0x3c9cd6)[_0xc861('0xf')](function(_0x43a775){return _0x43a775;});}return null;};}function handleEntityNotFound(_0x12a16e){return function(_0xa3d51b){if(!_0xa3d51b){_0x12a16e['sendStatus'](0x194);}return _0xa3d51b;};}function handleError(_0x16b61b,_0x2a38b6){_0x2a38b6=_0x2a38b6||0x1f4;return function(_0x2092f0){logger[_0xc861('0x10')](_0x2092f0['stack']);if(_0x2092f0[_0xc861('0x11')]){delete _0x2092f0[_0xc861('0x11')];}_0x16b61b[_0xc861('0xc')](_0x2a38b6)[_0xc861('0x12')](_0x2092f0);};}exports['update']=function(_0x55e8da,_0x210ceb){if(_0x55e8da[_0xc861('0x13')]['role']!==_0xc861('0x14'))throw new Error(_0xc861('0x15'));if(isNaN(Number(_0x55e8da['params']['id'])))throw new Error(_0xc861('0x16'));return db[_0xc861('0x17')][_0xc861('0x18')]({'where':{'id':_0x55e8da[_0xc861('0x19')]['id']}})[_0xc861('0xf')](handleEntityNotFound(_0x210ceb,null))[_0xc861('0xf')](saveUpdates(_0x55e8da['body'],null))['then'](respondWithResult(_0x210ceb,null))[_0xc861('0x1a')](handleError(_0x210ceb,null));}; \ No newline at end of file +var _0x9bde=['stack','name','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','ioredis','api','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','update','then','sendStatus','error'];(function(_0x3630b3,_0x3de772){var _0x2d9034=function(_0x52d7f4){while(--_0x52d7f4){_0x3630b3['push'](_0x3630b3['shift']());}};_0x2d9034(++_0x3de772);}(_0x9bde,0xe1));var _0xe9bd=function(_0xb3e5c5,_0x112b9e){_0xb3e5c5=_0xb3e5c5-0x0;var _0x2545a8=_0x9bde[_0xb3e5c5];return _0x2545a8;};'use strict';var _=require('lodash');var Redis=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var config=require('../../config/environment');var db=require(_0xe9bd('0x2'))['db'];var socket=require(_0xe9bd('0x3'))(new Redis(config[_0xe9bd('0x4')]));require(_0xe9bd('0x5'))[_0xe9bd('0x6')](socket);config[_0xe9bd('0x4')]=_[_0xe9bd('0x7')](config['redis'],{'host':_0xe9bd('0x8'),'port':0x18eb});function respondWithResult(_0x5f18fe,_0x22a438){_0x22a438=_0x22a438||0xc8;return function(_0xa66ae2){if(_0xa66ae2){return _0x5f18fe[_0xe9bd('0x9')](_0x22a438)[_0xe9bd('0xa')](_0xa66ae2);}};}function saveUpdates(_0x29bc2b){return function(_0xbefddb){if(_0xbefddb){return _0xbefddb[_0xe9bd('0xb')](_0x29bc2b)[_0xe9bd('0xc')](function(_0x581602){return _0x581602;});}return null;};}function handleEntityNotFound(_0x5f36c8){return function(_0x3c8e95){if(!_0x3c8e95){_0x5f36c8[_0xe9bd('0xd')](0x194);}return _0x3c8e95;};}function handleError(_0x2601ac,_0x581ab9){_0x581ab9=_0x581ab9||0x1f4;return function(_0x12c96e){logger[_0xe9bd('0xe')](_0x12c96e[_0xe9bd('0xf')]);if(_0x12c96e[_0xe9bd('0x10')]){delete _0x12c96e['name'];}_0x2601ac[_0xe9bd('0x9')](_0x581ab9)['send'](_0x12c96e);};}exports[_0xe9bd('0xb')]=function(_0x429e88,_0x3435b4){if(_0x429e88['user']['role']!==_0xe9bd('0x11'))throw new Error(_0xe9bd('0x12'));if(isNaN(Number(_0x429e88[_0xe9bd('0x13')]['id'])))throw new Error(_0xe9bd('0x14'));return db[_0xe9bd('0x15')][_0xe9bd('0x16')]({'where':{'id':_0x429e88[_0xe9bd('0x13')]['id']}})['then'](handleEntityNotFound(_0x3435b4,null))[_0xe9bd('0xc')](saveUpdates(_0x429e88[_0xe9bd('0x17')],null))[_0xe9bd('0xc')](respondWithResult(_0x3435b4,null))['catch'](handleError(_0x3435b4,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 91b2084..2806747 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2dca=['exports','../../mysqldb','UserSetting','setMaxListeners','save','remove','emit','hook'];(function(_0x2cfc3f,_0x176243){var _0xc01baa=function(_0x3a5b83){while(--_0x3a5b83){_0x2cfc3f['push'](_0x2cfc3f['shift']());}};_0xc01baa(++_0x176243);}(_0x2dca,0x99));var _0xa2dc=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x2dca[_0x50a0c2];return _0x5ebadd;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0xa2dc('0x0'))['db'][_0xa2dc('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xa2dc('0x2')](0x0);var events={'afterCreate':_0xa2dc('0x3'),'afterUpdate':'update','afterDestroy':_0xa2dc('0x4')};function emitEvent(_0x38325e){return function(_0x4a7731,_0x50b315,_0xeccd57){UserSettingEvents['emit'](_0x38325e+':'+_0x4a7731['id'],_0x4a7731);UserSettingEvents[_0xa2dc('0x5')](_0x38325e,_0x4a7731);_0xeccd57(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0xa2dc('0x6')](e,emitEvent(event));}}module[_0xa2dc('0x7')]=UserSettingEvents; \ No newline at end of file +var _0x25e0=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x25e0,0x179));var _0x025e=function(_0x20cf60,_0x19e3a9){_0x20cf60=_0x20cf60-0x0;var _0x3b28e7=_0x25e0[_0x20cf60];return _0x3b28e7;};'use strict';var EventEmitter=require(_0x025e('0x0'));var UserSetting=require(_0x025e('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x025e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x025e('0x3'),'afterDestroy':_0x025e('0x4')};function emitEvent(_0x2e9590){return function(_0x5c8cad,_0x31f6b9,_0x5695b3){UserSettingEvents[_0x025e('0x5')](_0x2e9590+':'+_0x5c8cad['id'],_0x5c8cad);UserSettingEvents['emit'](_0x2e9590,_0x5c8cad);_0x5695b3(null);};}for(var e in events){if(events[_0x025e('0x6')](e)){var event=events[e];UserSetting[_0x025e('0x7')](e,emitEvent(event));}}module[_0x025e('0x8')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 89a0288..89eae5c 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0bb5=['UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0bb5,0x148));var _0x50bb=function(_0x1dd834,_0x92887a){_0x1dd834=_0x1dd834-0x0;var _0x38d271=_0x0bb5[_0x1dd834];return _0x38d271;};'use strict';var attributes=require(_0x50bb('0x0'));module[_0x50bb('0x1')]=function(_0x5e61cf){return _0x5e61cf['define'](_0x50bb('0x2'),attributes,{'tableName':_0x50bb('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x6b7575){if(!_0x6b7575[_0x50bb('0x4')])_0x6b7575[_0x50bb('0x5')]=null;else if(_0x6b7575[_0x50bb('0x5')]===null)_0x6b7575[_0x50bb('0x5')]=new Date();}}});}; \ No newline at end of file +var _0x9d02=['./user-setting.attributes','UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9d02,0x118));var _0x29d0=function(_0x58463e,_0x11476){_0x58463e=_0x58463e-0x0;var _0x5f42d1=_0x9d02[_0x58463e];return _0x5f42d1;};'use strict';var attributes=require(_0x29d0('0x0'));module['exports']=function(_0x38b711){return _0x38b711['define'](_0x29d0('0x1'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x10d9e4){if(!_0x10d9e4[_0x29d0('0x2')])_0x10d9e4['clientSideLoggingEnabledSince']=null;else if(_0x10d9e4[_0x29d0('0x3')]===null)_0x10d9e4[_0x29d0('0x3')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 60d0ccd..1ff326b 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc7ac=['remove','update','emit','user-setting:update:user-','register','length','user-setting:','./user-setting.events'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc7ac,0x12f));var _0xcc7a=function(_0x357a2e,_0x273786){_0x357a2e=_0x357a2e-0x0;var _0x5503e1=_0xc7ac[_0x357a2e];return _0x5503e1;};'use strict';var UserSettingEvents=require(_0xcc7a('0x0'));var events=['save',_0xcc7a('0x1'),_0xcc7a('0x2')];function createListener(_0xc4435f,_0xd5026b){return function(_0x24d160){_0xd5026b[_0xcc7a('0x3')](_0xc4435f,_0x24d160);if(_0xc4435f==='user-setting:update'){_0xd5026b[_0xcc7a('0x3')](_0xcc7a('0x4')+_0x24d160['UserId'],_0x24d160);}};}exports[_0xcc7a('0x5')]=function(_0x5e0124){for(var _0x459740=0x0,_0x2b8128=events[_0xcc7a('0x6')];_0x459740<_0x2b8128;_0x459740++){var _0x2fd428=events[_0x459740];var _0x177db9=createListener(_0xcc7a('0x7')+_0x2fd428,_0x5e0124);UserSettingEvents['on'](_0x2fd428,_0x177db9);}}; \ No newline at end of file +var _0x8b00=['user-setting:update','user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events','save','update','emit'];(function(_0x2c0011,_0x41391b){var _0x850b00=function(_0x2394e6){while(--_0x2394e6){_0x2c0011['push'](_0x2c0011['shift']());}};_0x850b00(++_0x41391b);}(_0x8b00,0x1d2));var _0x08b0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8b00[_0x321bb2];return _0x9c12ed;};'use strict';var UserSettingEvents=require(_0x08b0('0x0'));var events=[_0x08b0('0x1'),'remove',_0x08b0('0x2')];function createListener(_0xd32329,_0xe13c72){return function(_0x475fab){_0xe13c72[_0x08b0('0x3')](_0xd32329,_0x475fab);if(_0xd32329===_0x08b0('0x4')){_0xe13c72[_0x08b0('0x3')](_0x08b0('0x5')+_0x475fab[_0x08b0('0x6')],_0x475fab);}};}exports[_0x08b0('0x7')]=function(_0x545205){for(var _0x423db5=0x0,_0x285904=events[_0x08b0('0x8')];_0x423db5<_0x285904;_0x423db5++){var _0x56b123=events[_0x423db5];var _0x305297=createListener(_0x08b0('0x9')+_0x56b123,_0x545205);UserSettingEvents['on'](_0x56b123,_0x305297);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index eb6c36d..9593c61 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 _0x4f6f=['addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','createApiKey','update','put','/:id/password','changePassword','delete','removeQueues','removeTeams','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeWhatsappAccounts','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./user.controller','isAuthenticated','index','get','/whoami','whoami','/presence','/:id','show','/:id/avatar','/:id/open_tabs','/:id/contacts','/:id/queues','getVoiceQueuesRt','getGroups','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','getScheduledCalls','/:id/api_key','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','addAvatar','/:id/login','login','/:id/logout','/:id/pause','/:id/unpause','addTeams','/:id/chat_interactions'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0x4f6f,0x157));var _0xf4f6=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x4f6f[_0x4ea69d];return _0x5318e0;};'use strict';var multer=require(_0xf4f6('0x0'));var util=require(_0xf4f6('0x1'));var path=require(_0xf4f6('0x2'));var timeout=require('connect-timeout');var express=require(_0xf4f6('0x3'));var router=express['Router']();var fs_extra=require(_0xf4f6('0x4'));var auth=require(_0xf4f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf4f6('0x6'));var controller=require(_0xf4f6('0x7'));router['get']('/',auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x9')]);router[_0xf4f6('0xa')]('/describe',auth[_0xf4f6('0x8')](),controller['describe']);router['get'](_0xf4f6('0xb'),auth[_0xf4f6('0x8')](),controller[_0xf4f6('0xc')]);router[_0xf4f6('0xa')](_0xf4f6('0xd'),auth[_0xf4f6('0x8')](),controller['getPresence']);router[_0xf4f6('0xa')](_0xf4f6('0xe'),auth[_0xf4f6('0x8')](),controller[_0xf4f6('0xf')]);router[_0xf4f6('0xa')](_0xf4f6('0x10'),controller['getAvatar']);router[_0xf4f6('0xa')](_0xf4f6('0x11'),auth['isAuthenticated'](),controller['getOpenTabs']);router[_0xf4f6('0xa')](_0xf4f6('0x12'),auth[_0xf4f6('0x8')](),controller['getContacts']);router[_0xf4f6('0xa')](_0xf4f6('0x13'),auth[_0xf4f6('0x8')](),controller['getQueues']);router[_0xf4f6('0xa')]('/:id/queues_rt',auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x14')]);router[_0xf4f6('0xa')]('/:id/groups',auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x15')]);router[_0xf4f6('0xa')]('/:id/recordings',auth[_0xf4f6('0x8')](),controller['getRecordings']);router[_0xf4f6('0xa')](_0xf4f6('0x16'),auth[_0xf4f6('0x8')](),controller['getScreenRecordings']);router[_0xf4f6('0xa')](_0xf4f6('0x17'),auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x18')]);router[_0xf4f6('0xa')](_0xf4f6('0x19'),auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x1a')]);router[_0xf4f6('0xa')](_0xf4f6('0x1b'),auth[_0xf4f6('0x8')](),controller['getMailInteractions']);router[_0xf4f6('0xa')](_0xf4f6('0x1c'),auth[_0xf4f6('0x8')](),controller['getSmsInteractions']);router[_0xf4f6('0xa')](_0xf4f6('0x1d'),auth['isAuthenticated'](),controller[_0xf4f6('0x1e')]);router[_0xf4f6('0xa')](_0xf4f6('0x1f'),auth['isAuthenticated'](),controller[_0xf4f6('0x20')]);router[_0xf4f6('0xa')](_0xf4f6('0x21'),auth[_0xf4f6('0x8')](),controller['getTeams']);router[_0xf4f6('0xa')](_0xf4f6('0x22'),auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x23')]);router[_0xf4f6('0xa')](_0xf4f6('0x24'),auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x25')]);router['get'](_0xf4f6('0x26'),auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x27')]);router['get'](_0xf4f6('0x28'),auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x29')]);router[_0xf4f6('0xa')](_0xf4f6('0x2a'),auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x2b')]);router[_0xf4f6('0xa')](_0xf4f6('0x2c'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router[_0xf4f6('0xa')](_0xf4f6('0x2d'),auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x2e')]);router[_0xf4f6('0xa')](_0xf4f6('0x2f'),auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x30')]);router[_0xf4f6('0xa')]('/:id/whatsapp_accounts',auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x31')]);router[_0xf4f6('0xa')]('/:id/scheduled_calls',auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x32')]);router[_0xf4f6('0xa')](_0xf4f6('0x33'),auth[_0xf4f6('0x8')](),controller['getApiKey']);router[_0xf4f6('0x34')](_0xf4f6('0x12'),auth['isAuthenticated'](),controller[_0xf4f6('0x35')]);router[_0xf4f6('0x34')]('/',auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x36')]);router['post'](_0xf4f6('0x37'),auth['isAuthenticated'](),controller[_0xf4f6('0x38')]);router[_0xf4f6('0x34')](_0xf4f6('0x13'),auth['isAuthenticated'](),controller[_0xf4f6('0x39')]);var upload=multer({'storage':multer[_0xf4f6('0x3a')]({'destination':function(_0x46f9b9,_0xf11e25,_0x540a42){_0x540a42(null,path[_0xf4f6('0x3b')](config[_0xf4f6('0x3c')],_0xf4f6('0x3d')));},'filename':function(_0x5c8311,_0x1f3580,_0x4f40d7){_0x4f40d7(null,util[_0xf4f6('0x3e')](_0xf4f6('0x3f'),Date[_0xf4f6('0x40')](),_0x1f3580['originalname']));}})});router[_0xf4f6('0x34')](_0xf4f6('0x10'),upload['single']('file'),controller[_0xf4f6('0x41')]);router[_0xf4f6('0x34')](_0xf4f6('0x42'),auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x43')]);router[_0xf4f6('0x34')](_0xf4f6('0x44'),auth[_0xf4f6('0x8')](),controller['logout']);router[_0xf4f6('0x34')](_0xf4f6('0x45'),auth[_0xf4f6('0x8')](),controller['pause']);router[_0xf4f6('0x34')](_0xf4f6('0x46'),auth[_0xf4f6('0x8')](),controller['unpause']);router[_0xf4f6('0x34')](_0xf4f6('0x21'),auth['isAuthenticated'](),controller[_0xf4f6('0x47')]);router['post'](_0xf4f6('0x48'),auth['isAuthenticated'](),controller[_0xf4f6('0x49')]);router[_0xf4f6('0x34')](_0xf4f6('0x4a'),auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x4b')]);router[_0xf4f6('0x34')](_0xf4f6('0x4c'),auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x4d')]);router[_0xf4f6('0x34')](_0xf4f6('0x4e'),auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x4f')]);router[_0xf4f6('0x34')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router[_0xf4f6('0x34')](_0xf4f6('0x50'),auth['isAuthenticated'](),controller[_0xf4f6('0x51')]);router['post'](_0xf4f6('0x28'),auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x52')]);router[_0xf4f6('0x34')](_0xf4f6('0x2a'),auth['isAuthenticated'](),controller[_0xf4f6('0x53')]);router['post'](_0xf4f6('0x2c'),auth[_0xf4f6('0x8')](),controller['addOpenchannelAccounts']);router[_0xf4f6('0x34')](_0xf4f6('0x2d'),auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x54')]);router['post'](_0xf4f6('0x2f'),auth['isAuthenticated'](),controller[_0xf4f6('0x55')]);router[_0xf4f6('0x34')](_0xf4f6('0x56'),auth['isAuthenticated'](),controller['addWhatsappAccounts']);router[_0xf4f6('0x34')](_0xf4f6('0x33'),auth['isAuthenticated'](),controller[_0xf4f6('0x57')]);router['put'](_0xf4f6('0xe'),auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x58')]);router[_0xf4f6('0x59')](_0xf4f6('0x5a'),auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x5b')]);router[_0xf4f6('0x5c')](_0xf4f6('0x13'),auth['isAuthenticated'](),controller[_0xf4f6('0x5d')]);router[_0xf4f6('0x5c')]('/:id/teams',auth['isAuthenticated'](),controller[_0xf4f6('0x5e')]);router[_0xf4f6('0x5c')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xf4f6('0x5c')](_0xf4f6('0x48'),auth['isAuthenticated'](),controller['removeChatInteractions']);router[_0xf4f6('0x5c')](_0xf4f6('0x4a'),auth[_0xf4f6('0x8')](),controller['removeMailInteractions']);router['delete'](_0xf4f6('0x4c'),auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x5f')]);router[_0xf4f6('0x5c')](_0xf4f6('0x4e'),auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x60')]);router[_0xf4f6('0x5c')](_0xf4f6('0x61'),auth[_0xf4f6('0x8')](),controller['removeOpenchannelInteractions']);router['delete'](_0xf4f6('0x50'),auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x62')]);router[_0xf4f6('0x5c')](_0xf4f6('0x28'),auth['isAuthenticated'](),controller[_0xf4f6('0x63')]);router['delete'](_0xf4f6('0x2a'),auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x64')]);router[_0xf4f6('0x5c')](_0xf4f6('0x2c'),auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x65')]);router[_0xf4f6('0x5c')](_0xf4f6('0x2d'),auth[_0xf4f6('0x8')](),controller['removeSmsAccounts']);router[_0xf4f6('0x5c')](_0xf4f6('0x2f'),auth[_0xf4f6('0x8')](),controller['removeChatWebsites']);router[_0xf4f6('0x5c')](_0xf4f6('0x56'),auth[_0xf4f6('0x8')](),controller[_0xf4f6('0x66')]);router['delete'](_0xf4f6('0x33'),auth[_0xf4f6('0x8')](),controller['removeApiKey']);module[_0xf4f6('0x67')]=router; \ No newline at end of file +var _0x9e0d=['addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','createApiKey','put','/:id','/:id/password','changePassword','delete','removeQueues','/:id/teams','destroy','removeChatInteractions','removeMailInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeWhatsappAccounts','removeApiKey','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','index','get','/describe','isAuthenticated','describe','whoami','/presence','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/queues','getQueues','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getScheduledCalls','/:id/api_key','post','/:id/contacts','addContacts','/create_many','bulkCreate','addQueues','diskStorage','join','root','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts'];(function(_0xf1402a,_0x187f5c){var _0x4f7ead=function(_0x57dfd9){while(--_0x57dfd9){_0xf1402a['push'](_0xf1402a['shift']());}};_0x4f7ead(++_0x187f5c);}(_0x9e0d,0xf7));var _0xd9e0=function(_0x1025f6,_0x57597c){_0x1025f6=_0x1025f6-0x0;var _0x1b163a=_0x9e0d[_0x1025f6];return _0x1b163a;};'use strict';var multer=require(_0xd9e0('0x0'));var util=require(_0xd9e0('0x1'));var path=require(_0xd9e0('0x2'));var timeout=require(_0xd9e0('0x3'));var express=require('express');var router=express[_0xd9e0('0x4')]();var fs_extra=require(_0xd9e0('0x5'));var auth=require(_0xd9e0('0x6'));var interaction=require(_0xd9e0('0x7'));var config=require(_0xd9e0('0x8'));var controller=require(_0xd9e0('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xd9e0('0xa')]);router[_0xd9e0('0xb')](_0xd9e0('0xc'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0xe')]);router[_0xd9e0('0xb')]('/whoami',auth[_0xd9e0('0xd')](),controller[_0xd9e0('0xf')]);router[_0xd9e0('0xb')](_0xd9e0('0x10'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x11')]);router[_0xd9e0('0xb')]('/:id',auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x12')]);router['get'](_0xd9e0('0x13'),controller[_0xd9e0('0x14')]);router[_0xd9e0('0xb')](_0xd9e0('0x15'),auth[_0xd9e0('0xd')](),controller['getOpenTabs']);router[_0xd9e0('0xb')]('/:id/contacts',auth[_0xd9e0('0xd')](),controller['getContacts']);router[_0xd9e0('0xb')](_0xd9e0('0x16'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x17')]);router[_0xd9e0('0xb')]('/:id/queues_rt',auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0xd9e0('0xb')](_0xd9e0('0x18'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x19')]);router['get'](_0xd9e0('0x1a'),auth['isAuthenticated'](),controller['getRecordings']);router[_0xd9e0('0xb')](_0xd9e0('0x1b'),auth['isAuthenticated'](),controller['getScreenRecordings']);router[_0xd9e0('0xb')](_0xd9e0('0x1c'),auth['isAuthenticated'](),controller[_0xd9e0('0x1d')]);router[_0xd9e0('0xb')](_0xd9e0('0x1e'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x1f')]);router[_0xd9e0('0xb')](_0xd9e0('0x20'),auth['isAuthenticated'](),controller[_0xd9e0('0x21')]);router[_0xd9e0('0xb')]('/:id/sms/interactions',auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x22')]);router['get'](_0xd9e0('0x23'),auth['isAuthenticated'](),controller[_0xd9e0('0x24')]);router[_0xd9e0('0xb')]('/:id/whatsapp/interactions',auth[_0xd9e0('0xd')](),controller['getWhatsappInteractions']);router['get']('/:id/teams',auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x25')]);router[_0xd9e0('0xb')](_0xd9e0('0x26'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x27')]);router[_0xd9e0('0xb')]('/:id/agents',auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x28')]);router[_0xd9e0('0xb')](_0xd9e0('0x29'),auth[_0xd9e0('0xd')](),controller['getVoicePrefixes']);router['get']('/:id/fax_accounts',auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x2a')]);router['get'](_0xd9e0('0x2b'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x2c')]);router[_0xd9e0('0xb')](_0xd9e0('0x2d'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x2e')]);router['get'](_0xd9e0('0x2f'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x30')]);router[_0xd9e0('0xb')](_0xd9e0('0x31'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x32')]);router[_0xd9e0('0xb')](_0xd9e0('0x33'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x34')]);router[_0xd9e0('0xb')]('/:id/scheduled_calls',auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x35')]);router[_0xd9e0('0xb')](_0xd9e0('0x36'),auth[_0xd9e0('0xd')](),controller['getApiKey']);router[_0xd9e0('0x37')](_0xd9e0('0x38'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x39')]);router['post']('/',auth[_0xd9e0('0xd')](),controller['create']);router[_0xd9e0('0x37')](_0xd9e0('0x3a'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x3b')]);router[_0xd9e0('0x37')](_0xd9e0('0x16'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x3c')]);var upload=multer({'storage':multer[_0xd9e0('0x3d')]({'destination':function(_0x5065f7,_0x318679,_0x1c9d50){_0x1c9d50(null,path[_0xd9e0('0x3e')](config[_0xd9e0('0x3f')],'server/files/images/'));},'filename':function(_0x38ad8c,_0x8317a8,_0x3df1ac){_0x3df1ac(null,util[_0xd9e0('0x40')](_0xd9e0('0x41'),Date[_0xd9e0('0x42')](),_0x8317a8[_0xd9e0('0x43')]));}})});router[_0xd9e0('0x37')](_0xd9e0('0x13'),upload[_0xd9e0('0x44')](_0xd9e0('0x45')),controller[_0xd9e0('0x46')]);router[_0xd9e0('0x37')](_0xd9e0('0x47'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x48')]);router['post'](_0xd9e0('0x49'),auth[_0xd9e0('0xd')](),controller['logout']);router[_0xd9e0('0x37')]('/:id/pause',auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x4a')]);router[_0xd9e0('0x37')](_0xd9e0('0x4b'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x4c')]);router['post']('/:id/teams',auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x4d')]);router[_0xd9e0('0x37')](_0xd9e0('0x4e'),auth[_0xd9e0('0xd')](),controller['addChatInteractions']);router[_0xd9e0('0x37')](_0xd9e0('0x4f'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x50')]);router['post'](_0xd9e0('0x51'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x52')]);router['post']('/:id/sms_interactions',auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x53')]);router['post']('/:id/openchannel_interactions',auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x54')]);router[_0xd9e0('0x37')](_0xd9e0('0x55'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x56')]);router[_0xd9e0('0x37')](_0xd9e0('0x57'),auth['isAuthenticated'](),controller[_0xd9e0('0x58')]);router[_0xd9e0('0x37')]('/:id/mail_accounts',auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x59')]);router[_0xd9e0('0x37')](_0xd9e0('0x2d'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x5a')]);router[_0xd9e0('0x37')](_0xd9e0('0x2f'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x5b')]);router[_0xd9e0('0x37')](_0xd9e0('0x31'),auth['isAuthenticated'](),controller[_0xd9e0('0x5c')]);router[_0xd9e0('0x37')]('/:id/whatsapp_accounts',auth[_0xd9e0('0xd')](),controller['addWhatsappAccounts']);router[_0xd9e0('0x37')](_0xd9e0('0x36'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x5d')]);router[_0xd9e0('0x5e')](_0xd9e0('0x5f'),auth[_0xd9e0('0xd')](),controller['update']);router[_0xd9e0('0x5e')](_0xd9e0('0x60'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x61')]);router[_0xd9e0('0x62')]('/:id/queues',auth['isAuthenticated'](),controller[_0xd9e0('0x63')]);router['delete'](_0xd9e0('0x64'),auth[_0xd9e0('0xd')](),controller['removeTeams']);router['delete'](_0xd9e0('0x5f'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x65')]);router['delete'](_0xd9e0('0x4e'),auth['isAuthenticated'](),controller[_0xd9e0('0x66')]);router[_0xd9e0('0x62')](_0xd9e0('0x4f'),auth['isAuthenticated'](),controller[_0xd9e0('0x67')]);router['delete'](_0xd9e0('0x51'),auth[_0xd9e0('0xd')](),controller['removeFaxInteractions']);router[_0xd9e0('0x62')](_0xd9e0('0x68'),auth['isAuthenticated'](),controller[_0xd9e0('0x69')]);router[_0xd9e0('0x62')]('/:id/openchannel_interactions',auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x6a')]);router['delete'](_0xd9e0('0x55'),auth[_0xd9e0('0xd')](),controller['removeWhatsappInteractions']);router[_0xd9e0('0x62')](_0xd9e0('0x57'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x6b')]);router[_0xd9e0('0x62')](_0xd9e0('0x2b'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x6c')]);router[_0xd9e0('0x62')](_0xd9e0('0x2d'),auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router['delete'](_0xd9e0('0x2f'),auth['isAuthenticated'](),controller[_0xd9e0('0x6d')]);router[_0xd9e0('0x62')](_0xd9e0('0x31'),auth[_0xd9e0('0xd')](),controller['removeChatWebsites']);router[_0xd9e0('0x62')](_0xd9e0('0x33'),auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x6e')]);router[_0xd9e0('0x62')]('/:id/api_key',auth[_0xd9e0('0xd')](),controller[_0xd9e0('0x6f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 4a0253c..bb4cb7d 100644 --- a/server/api/user/user.attributes.js +++ b/server/api/user/user.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['certificate','passive','nonat','update,nonat','TEXT','showWebBar','wss','encryption','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','avpf','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','split','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas'];(function(_0xdd82b4,_0x5cd8b8){var _0x549bb2=function(_0x426fd9){while(--_0x426fd9){_0xdd82b4['push'](_0xdd82b4['shift']());}};_0x549bb2(++_0x5cd8b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x0a9e('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x14')},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x16'),_0x0a9e('0xc'),_0x0a9e('0x17')),'allowNull':!![],'defaultValue':_0x0a9e('0x16')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')]('ALLOWED_NOT_SCREENED',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),'PROHIB_PASSED_SCREEN',_0x0a9e('0x1d'),_0x0a9e('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x540530){this[_0x0a9e('0x4')]('transport',_0x540530?_0x540530[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))['split'](','):null;},'comment':_0x0a9e('0x22')},'dtmfmode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x23'),_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27')),'allowNull':!![],'defaultValue':_0x0a9e('0x23')},'directmedia':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no','nonat',_0x0a9e('0x29'),_0x0a9e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0x15de0e){this['setDataValue']('nat',_0x15de0e?_0x15de0e[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this[_0x0a9e('0x8')](_0x0a9e('0x2c'))[_0x0a9e('0x2d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x0a9e('0x3')]},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0a9e('0x3')]},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a9e('0x2e'),'set':function(_0x40d766){this['setDataValue'](_0x0a9e('0x2f'),_0x40d766?_0x40d766[_0x0a9e('0x20')](';'):_0x0a9e('0x2e'));},'get':function(){return this[_0x0a9e('0x8')]('allow')?this['getDataValue'](_0x0a9e('0x2f'))[_0x0a9e('0x2d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x5b4f5e){this[_0x0a9e('0x4')](_0x0a9e('0x30'),_0x5b4f5e?_0x5b4f5e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x30'))?this[_0x0a9e('0x8')](_0x0a9e('0x30'))[_0x0a9e('0x2d')](','):null;},'comment':_0x0a9e('0x31')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x32')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x28')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x34'),_0x0a9e('0x35'),_0x0a9e('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38')),'allowNull':!![],'defaultValue':_0x0a9e('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','fingerprint',_0x0a9e('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no',_0x0a9e('0x3b'),_0x0a9e('0x29'),_0x0a9e('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x0a9e('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3649cc){this['setDataValue'](_0x0a9e('0x3e'),_0x3649cc);var _0x5ba1f9=this['get']({'plain':!![]});switch(_0x3649cc){case 0x0:case 0x1:var _0x5674ee=_0x5ba1f9[_0x0a9e('0x21')]?_['isArray'](_0x5ba1f9[_0x0a9e('0x21')])?_0x5ba1f9[_0x0a9e('0x21')][_0x0a9e('0x20')]():_0x5ba1f9[_0x0a9e('0x21')]:_0x0a9e('0x1f');if(_0x5674ee===_0x0a9e('0x3f')){_0x5674ee='udp';}this[_0x0a9e('0x4')]('transport',_0x5674ee);this[_0x0a9e('0x4')](_0x0a9e('0x40'),'no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x41'),null);this[_0x0a9e('0x4')](_0x0a9e('0x42'),null);this['setDataValue'](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('dtlsverify',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this[_0x0a9e('0x4')]('dtlsprivatekey',null);this[_0x0a9e('0x4')](_0x0a9e('0x46'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x3f'));this['setDataValue']('encryption',_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x47'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x41'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x42'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x49'));this['setDataValue'](_0x0a9e('0x45'),_0x5ba1f9[_0x0a9e('0x45')]||_0x0a9e('0x4a'));this['setDataValue'](_0x0a9e('0x4b'),_0x5ba1f9[_0x0a9e('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x0a9e('0x3d')],'set':function(_0x13b5c0){this['setDataValue']('permissions',_0x13b5c0?_0x13b5c0['join'](','):[]);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x4c'))?_[_0x0a9e('0x4d')](this[_0x0a9e('0x8')](_0x0a9e('0x4c'))[_0x0a9e('0x2d')](','),function(_0xeef20){return parseInt(_0xeef20,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0a9e('0x4e')],'get':function(){return this[_0x0a9e('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0x0a9e('0x8')](_0x0a9e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0xdb98ca){if(typeof _0xdb98ca===_0x0a9e('0x50')){var _0x3df0e3=_0xdb98ca==='1'?!![]:_0xdb98ca==='0'?![]:_0xdb98ca===_0x0a9e('0x51')?!![]:_0xdb98ca===_0x0a9e('0x52')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0x3df0e3);}else{this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0xdb98ca);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xf4120f){this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0xf4120f);if(_0xf4120f===!![]){this['setDataValue'](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')](_0x0a9e('0x56'),0x0);}else{this[_0x0a9e('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x0a9e('0xf')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['certificate','passive','nonat','update,nonat','TEXT','showWebBar','wss','encryption','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','avpf','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','split','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas'];(function(_0x36b037,_0x2b234e){var _0x409194=function(_0xddc9dc){while(--_0xddc9dc){_0x36b037['push'](_0x36b037['shift']());}};_0x409194(++_0x2b234e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x0a9e('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x14')},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x16'),_0x0a9e('0xc'),_0x0a9e('0x17')),'allowNull':!![],'defaultValue':_0x0a9e('0x16')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')]('ALLOWED_NOT_SCREENED',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),'PROHIB_PASSED_SCREEN',_0x0a9e('0x1d'),_0x0a9e('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x540530){this[_0x0a9e('0x4')]('transport',_0x540530?_0x540530[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))['split'](','):null;},'comment':_0x0a9e('0x22')},'dtmfmode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x23'),_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27')),'allowNull':!![],'defaultValue':_0x0a9e('0x23')},'directmedia':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no','nonat',_0x0a9e('0x29'),_0x0a9e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0x15de0e){this['setDataValue']('nat',_0x15de0e?_0x15de0e[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this[_0x0a9e('0x8')](_0x0a9e('0x2c'))[_0x0a9e('0x2d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x0a9e('0x3')]},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0a9e('0x3')]},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a9e('0x2e'),'set':function(_0x40d766){this['setDataValue'](_0x0a9e('0x2f'),_0x40d766?_0x40d766[_0x0a9e('0x20')](';'):_0x0a9e('0x2e'));},'get':function(){return this[_0x0a9e('0x8')]('allow')?this['getDataValue'](_0x0a9e('0x2f'))[_0x0a9e('0x2d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x5b4f5e){this[_0x0a9e('0x4')](_0x0a9e('0x30'),_0x5b4f5e?_0x5b4f5e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x30'))?this[_0x0a9e('0x8')](_0x0a9e('0x30'))[_0x0a9e('0x2d')](','):null;},'comment':_0x0a9e('0x31')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x32')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x28')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x34'),_0x0a9e('0x35'),_0x0a9e('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38')),'allowNull':!![],'defaultValue':_0x0a9e('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','fingerprint',_0x0a9e('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no',_0x0a9e('0x3b'),_0x0a9e('0x29'),_0x0a9e('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x0a9e('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3649cc){this['setDataValue'](_0x0a9e('0x3e'),_0x3649cc);var _0x5ba1f9=this['get']({'plain':!![]});switch(_0x3649cc){case 0x0:case 0x1:var _0x5674ee=_0x5ba1f9[_0x0a9e('0x21')]?_['isArray'](_0x5ba1f9[_0x0a9e('0x21')])?_0x5ba1f9[_0x0a9e('0x21')][_0x0a9e('0x20')]():_0x5ba1f9[_0x0a9e('0x21')]:_0x0a9e('0x1f');if(_0x5674ee===_0x0a9e('0x3f')){_0x5674ee='udp';}this[_0x0a9e('0x4')]('transport',_0x5674ee);this[_0x0a9e('0x4')](_0x0a9e('0x40'),'no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x41'),null);this[_0x0a9e('0x4')](_0x0a9e('0x42'),null);this['setDataValue'](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('dtlsverify',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this[_0x0a9e('0x4')]('dtlsprivatekey',null);this[_0x0a9e('0x4')](_0x0a9e('0x46'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x3f'));this['setDataValue']('encryption',_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x47'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x41'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x42'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x49'));this['setDataValue'](_0x0a9e('0x45'),_0x5ba1f9[_0x0a9e('0x45')]||_0x0a9e('0x4a'));this['setDataValue'](_0x0a9e('0x4b'),_0x5ba1f9[_0x0a9e('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x0a9e('0x3d')],'set':function(_0x13b5c0){this['setDataValue']('permissions',_0x13b5c0?_0x13b5c0['join'](','):[]);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x4c'))?_[_0x0a9e('0x4d')](this[_0x0a9e('0x8')](_0x0a9e('0x4c'))[_0x0a9e('0x2d')](','),function(_0xeef20){return parseInt(_0xeef20,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0a9e('0x4e')],'get':function(){return this[_0x0a9e('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0x0a9e('0x8')](_0x0a9e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0xdb98ca){if(typeof _0xdb98ca===_0x0a9e('0x50')){var _0x3df0e3=_0xdb98ca==='1'?!![]:_0xdb98ca==='0'?![]:_0xdb98ca===_0x0a9e('0x51')?!![]:_0xdb98ca===_0x0a9e('0x52')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0x3df0e3);}else{this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0xdb98ca);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xf4120f){this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0xf4120f);if(_0xf4120f===!![]){this['setDataValue'](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')](_0x0a9e('0x56'),0x0);}else{this[_0x0a9e('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x0a9e('0xf')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 4b640bd..25eddcf 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 _0x7d02=['openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','unpause','getTeams','addTeams','transaction','Team','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$or','$gte','$lt','$lte','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$notILike','$overlap','$contained','firstName','Contact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','generateApiKey','iat','removeApiKey','apiKeyNonce','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','teams','inbound','queues','flatten','lower','toString','asc','uniqBy','orderBy','http','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','unavailable','ringing','busy','slice','toUpperCase','select','InteractionId','ui.createdAt','ui.UserId\x20=\x20?','moment','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','../../mysqldb','socket.io-emitter','redis','register','defaults','client','request','then','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','code','message','error','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','update','userNotification:recalc:','destroy','get','role','admin','Users','user','agent','Telephones','telephone','ignore','map','value','includes','name','UserProfileResource','stack','send','rawAttributes','fieldName','type','key','filter','salt','getOptions','where','User','query','includeAll','include','userSetting','true','attributes','push','findAll','rows','openTabs','length','chat','dataValues','sms','fax','show','model','keys','password','filters','fields','UserSetting','merge','find','whatsapp','mail','body','params','describe','addContacts','ids','omit','Setting','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','sequelize','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','113','104','105','107','108','109','100','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','Agents','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','some','all','isEmpty','compact','changePassword','oldPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','passwordHistoryLimit','validatePasswordHistory','previousPasswords','updatePasswordsHistory','addQueues','loginInPause','voicePause','interface','Unknown\x20channel','toLowerCase','Queues','penalty','spread','capitalize','QueueId','emit','Queue:save','voice','online','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','isValidChannel','channel','isArray','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','openchannel','ChatOpenTabs','CHAT','FaxOpenTabs','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','intersection','order','sort','pick','CmList','Tag','Tags','tag','hasOwnProperty','nolimit','getQueues','Queue','options','Unknown\x20role','getVoiceQueuesRt','ChatGroup','getGroups','getRecordings','VoiceRecording','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','getMailInteractions','MailInteraction','UserId','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','phone','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','YYYY-MM-DD\x20HH:mm:ss','forEach','LOGIN','device','PAUSE','LOGININPAUSE','MemberReport','resolve','logout','pause','updateAttributes','getChannels','DEFAULT\x20PAUSE','mailPause','chatPause','faxPause'];(function(_0x3993f0,_0x40c90e){var _0x4545d9=function(_0x2c6b8a){while(--_0x2c6b8a){_0x3993f0['push'](_0x3993f0['shift']());}};_0x4545d9(++_0x40c90e);}(_0x7d02,0x7a));var _0x27d0=function(_0x28601a,_0x3cf908){_0x28601a=_0x28601a-0x0;var _0x3824ea=_0x7d02[_0x28601a];return _0x3824ea;};'use strict';var moment=require(_0x27d0('0x0'));var util=require(_0x27d0('0x1'));var path=require(_0x27d0('0x2'));var fs=require('fs');var _=require(_0x27d0('0x3'));var squel=require('squel');var jayson=require('jayson/promise');var Redis=require(_0x27d0('0x4'));var authService=require('../../components/auth/service');var qs=require(_0x27d0('0x5'));var logger=require(_0x27d0('0x6'))(_0x27d0('0x7'));var utils=require('../../config/utils');var config=require(_0x27d0('0x8'));var licenseUtil=require(_0x27d0('0x9'));var APIBadRequestError=require(_0x27d0('0xa'))[_0x27d0('0xb')];var APINotFoundError=require(_0x27d0('0xa'))['APINotFoundError'];var APIHandleError=require('../../errors/api')['handleError'];var db=require(_0x27d0('0xc'))['db'];var socket=require(_0x27d0('0xd'))(new Redis(config[_0x27d0('0xe')]));require('./user.socket')[_0x27d0('0xf')](socket);config[_0x27d0('0xe')]=_[_0x27d0('0x10')](config[_0x27d0('0xe')],{'host':'localhost','port':0x18eb});var amiClient=jayson[_0x27d0('0x11')]['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x534613,_0x308dc4,_0x24374c,_0x2d261f){return new Promise(function(_0x75a0c8,_0x408210){var _0x27633c=_0x2d261f||amiClient;return _0x27633c[_0x27d0('0x12')](_0x534613,_0x24374c)[_0x27d0('0x13')](function(_0x7b589f){logger['info'](_0x27d0('0x14'),_0x308dc4,_0x27d0('0x15'));logger[_0x27d0('0x16')](_0x27d0('0x17'),_0x308dc4,_0x27d0('0x15'),JSON[_0x27d0('0x18')](_0x7b589f));if(_0x7b589f['error']){if(_0x7b589f['error'][_0x27d0('0x19')]===0x1f4){logger['error'](_0x27d0('0x14'),_0x308dc4,_0x7b589f['error'][_0x27d0('0x1a')]);return _0x408210(_0x7b589f[_0x27d0('0x1b')][_0x27d0('0x1a')]);}logger[_0x27d0('0x1b')](_0x27d0('0x14'),_0x308dc4,_0x7b589f[_0x27d0('0x1b')][_0x27d0('0x1a')]);return _0x75a0c8(_0x7b589f['error'][_0x27d0('0x1a')]);}else{logger['info'](_0x27d0('0x14'),_0x308dc4,_0x27d0('0x15'));_0x75a0c8(_0x7b589f[_0x27d0('0x1c')][_0x27d0('0x1a')]);}})[_0x27d0('0x1d')](function(_0x133184){logger[_0x27d0('0x1b')](_0x27d0('0x14'),_0x308dc4,_0x133184);_0x408210(_0x133184);});});}function respondWithStatusCode(_0x40c7a5,_0x9a115d){_0x9a115d=_0x9a115d||0xcc;return function(_0x273e2b){if(_0x273e2b){return _0x40c7a5[_0x27d0('0x1e')](_0x9a115d);}return _0x40c7a5[_0x27d0('0x1f')](_0x9a115d)[_0x27d0('0x20')]();};}function respondWithResult(_0x4454e0,_0xd6ae8f){_0xd6ae8f=_0xd6ae8f||0xc8;return function(_0x5a4c4e){if(_0x5a4c4e){return _0x4454e0[_0x27d0('0x1f')](_0xd6ae8f)[_0x27d0('0x21')](_0x5a4c4e);}};}function respondWithFilteredResult(_0x41b44c,_0x470f38){return function(_0x324f73){if(_0x324f73){var _0x11a9b8=typeof _0x470f38[_0x27d0('0x22')]===_0x27d0('0x23')&&typeof _0x470f38[_0x27d0('0x24')]===_0x27d0('0x23');var _0x2a1f70=_0x324f73[_0x27d0('0x25')];var _0x30acfb=_0x11a9b8?0x0:_0x470f38[_0x27d0('0x22')];var _0x1e44e3=_0x11a9b8?_0x324f73['count']:_0x470f38[_0x27d0('0x22')]+_0x470f38[_0x27d0('0x24')];var _0xcd585;if(_0x1e44e3>=_0x2a1f70){_0x1e44e3=_0x2a1f70;_0xcd585=0xc8;}else{_0xcd585=0xce;}_0x41b44c[_0x27d0('0x1f')](_0xcd585);return _0x41b44c[_0x27d0('0x26')]('Content-Range',_0x30acfb+'-'+_0x1e44e3+'/'+_0x2a1f70)[_0x27d0('0x21')](_0x324f73);}return null;};}function saveUpdates(_0x103fe2){return function(_0x219865){if(_0x219865){return _0x219865[_0x27d0('0x27')](_0x103fe2)[_0x27d0('0x13')](function(_0x8838a6){socket['emit'](_0x27d0('0x28')+_0x8838a6['id'],{});return _0x8838a6;});}return null;};}function removeEntity(_0x388546){return function(_0x1ac78e){if(_0x1ac78e){return _0x1ac78e[_0x27d0('0x29')]()['then'](function(){var _0x317f81=_0x1ac78e[_0x27d0('0x2a')]({'plain':!![]});if(_0x317f81[_0x27d0('0x2b')]===_0x27d0('0x2c'))return;var _0x5b8351=[{'name':_0x27d0('0x2d'),'value':_0x27d0('0x2e'),'ignore':!![]},{'name':'Agents','value':_0x27d0('0x2f'),'ignore':![]},{'name':_0x27d0('0x30'),'value':_0x27d0('0x31'),'ignore':![]}];var _0x22890d=_(_0x5b8351)['filter'](_0x27d0('0x32'))[_0x27d0('0x33')](_0x27d0('0x34'))[_0x27d0('0x34')]();if(_[_0x27d0('0x35')](_0x22890d,_0x317f81[_0x27d0('0x2b')])){return;}var _0x420ef8=_['find'](_0x5b8351,['value',_0x317f81[_0x27d0('0x2b')]])[_0x27d0('0x36')];return db[_0x27d0('0x37')][_0x27d0('0x29')]({'where':{'type':_0x420ef8,'resourceId':_0x317f81['id']}})[_0x27d0('0x13')](function(){return _0x1ac78e;});})[_0x27d0('0x13')](function(){_0x388546[_0x27d0('0x1f')](0xcc)[_0x27d0('0x20')]();});}};}function handleEntityNotFound(_0x24734a){return function(_0x9c192d){if(!_0x9c192d){_0x24734a['sendStatus'](0x194);}return _0x9c192d;};}function handleError(_0x527bb6,_0x4e5f3d){_0x4e5f3d=_0x4e5f3d||0x1f4;return function(_0xcdaf98){logger[_0x27d0('0x1b')](_0xcdaf98[_0x27d0('0x38')]);if(_0xcdaf98[_0x27d0('0x36')]){delete _0xcdaf98['name'];}_0x527bb6['status'](_0x4e5f3d)[_0x27d0('0x39')](_0xcdaf98);};}exports['index']=function(_0x88f47c,_0x5b7c99){var _0x2db0da={},_0x22fa84={'count':0x0,'rows':[]};var _0xa0b870=_(db['User'][_0x27d0('0x3a')])[_0x27d0('0x33')](function(_0x4ec528){return{'name':_0x4ec528[_0x27d0('0x3b')],'type':_0x4ec528[_0x27d0('0x3c')][_0x27d0('0x3d')]};})[_0x27d0('0x3e')](function(_0x3b51a8){return!_[_0x27d0('0x35')](['password',_0x27d0('0x3f')],_0x3b51a8[_0x27d0('0x36')]);})['value']();_0x2db0da=qs[_0x27d0('0x40')](_0xa0b870,_0x88f47c);var _0x3be395={'where':_0x2db0da[_0x27d0('0x41')]};return db[_0x27d0('0x42')][_0x27d0('0x25')](_0x3be395)[_0x27d0('0x13')](function(_0x5886b6){_0x22fa84[_0x27d0('0x25')]=_0x5886b6;if(_0x88f47c[_0x27d0('0x43')][_0x27d0('0x44')]){_0x2db0da[_0x27d0('0x45')]=[{'all':!![]}];}if(_0x88f47c[_0x27d0('0x43')][_0x27d0('0x46')]===_0x27d0('0x47')){_0x2db0da[_0x27d0('0x45')]=[{'model':db['UserSetting'],'as':'userSetting'}];}if(!_[_0x27d0('0x35')](_0x2db0da['attributes'],'id')){_0x2db0da[_0x27d0('0x48')][_0x27d0('0x49')]('id');}return db[_0x27d0('0x42')][_0x27d0('0x4a')](_0x2db0da);})['then'](function(_0x2163da){_0x22fa84[_0x27d0('0x4b')]=_0x2163da;if(_0x88f47c[_0x27d0('0x43')][_0x27d0('0x4c')]===_0x27d0('0x47')){var _0x189ce4=[];for(var _0x51fdfd=0x0;_0x51fdfd<_0x22fa84[_0x27d0('0x4b')][_0x27d0('0x4d')];_0x51fdfd++){_0x189ce4[_0x27d0('0x49')](get_open_tabs(_0x27d0('0x4e'),_0x22fa84[_0x27d0('0x4b')][_0x51fdfd][_0x27d0('0x4f')]));_0x189ce4[_0x27d0('0x49')](get_open_tabs(_0x27d0('0x50'),_0x22fa84[_0x27d0('0x4b')][_0x51fdfd][_0x27d0('0x4f')]));_0x189ce4[_0x27d0('0x49')](get_open_tabs(_0x27d0('0x51'),_0x22fa84[_0x27d0('0x4b')][_0x51fdfd][_0x27d0('0x4f')]));_0x189ce4[_0x27d0('0x49')](get_open_tabs('mail',_0x22fa84[_0x27d0('0x4b')][_0x51fdfd][_0x27d0('0x4f')]));_0x189ce4['push'](get_open_tabs('openchannel',_0x22fa84[_0x27d0('0x4b')][_0x51fdfd][_0x27d0('0x4f')]));_0x189ce4['push'](get_open_tabs('whatsapp',_0x22fa84['rows'][_0x51fdfd]['dataValues']));}return Promise['all'](_0x189ce4)['then'](function(){return _0x22fa84;});}else{return _0x22fa84;}})[_0x27d0('0x13')](respondWithFilteredResult(_0x5b7c99,_0x2db0da))['catch'](handleError(_0x5b7c99,null));};exports[_0x27d0('0x52')]=function(_0x1b13f0,_0x2dcdb3){var _0x2d1768={'raw':![],'where':{'id':_0x1b13f0['params']['id']}},_0x434278={};_0x434278[_0x27d0('0x53')]=_['differenceBy'](_[_0x27d0('0x54')](db[_0x27d0('0x42')][_0x27d0('0x3a')]),[_0x27d0('0x55'),_0x27d0('0x3f')]);_0x434278[_0x27d0('0x43')]=_[_0x27d0('0x54')](_0x1b13f0['query']);_0x434278[_0x27d0('0x56')]=_['intersection'](_0x434278[_0x27d0('0x53')],_0x434278['query']);_0x2d1768[_0x27d0('0x48')]=_['intersection'](_0x434278[_0x27d0('0x53')],qs[_0x27d0('0x57')](_0x1b13f0[_0x27d0('0x43')][_0x27d0('0x57')]));_0x2d1768[_0x27d0('0x48')]=_0x2d1768[_0x27d0('0x48')][_0x27d0('0x4d')]?_0x2d1768[_0x27d0('0x48')]:_0x434278[_0x27d0('0x53')];if(_0x1b13f0[_0x27d0('0x43')][_0x27d0('0x44')]){_0x2d1768['include']=[{'all':!![]}];}if(_0x1b13f0['query']['userSetting']===_0x27d0('0x47')){_0x2d1768[_0x27d0('0x45')]=[{'model':db[_0x27d0('0x58')],'as':_0x27d0('0x46')}];}_0x2d1768=_[_0x27d0('0x59')]({},_0x2d1768,_0x1b13f0['options']);if(!_[_0x27d0('0x35')](_0x2d1768[_0x27d0('0x48')],'id')){_0x2d1768[_0x27d0('0x48')][_0x27d0('0x49')]('id');}return db['User'][_0x27d0('0x5a')](_0x2d1768)[_0x27d0('0x13')](handleEntityNotFound(_0x2dcdb3,null))[_0x27d0('0x13')](function(_0x339aa1){var _0x119ee7=[];values=_0x339aa1;if(_0x1b13f0[_0x27d0('0x43')][_0x27d0('0x4c')]==='true'){_0x119ee7[_0x27d0('0x49')](get_open_tabs('chat',_0x339aa1['dataValues']));_0x119ee7[_0x27d0('0x49')](get_open_tabs('sms',_0x339aa1[_0x27d0('0x4f')]));_0x119ee7[_0x27d0('0x49')](get_open_tabs('openchannel',_0x339aa1[_0x27d0('0x4f')]));_0x119ee7[_0x27d0('0x49')](get_open_tabs(_0x27d0('0x5b'),_0x339aa1[_0x27d0('0x4f')]));_0x119ee7[_0x27d0('0x49')](get_open_tabs(_0x27d0('0x51'),_0x339aa1['dataValues']));_0x119ee7[_0x27d0('0x49')](get_open_tabs(_0x27d0('0x5c'),_0x339aa1[_0x27d0('0x4f')]));return Promise['all'](_0x119ee7);}else{return values;}})[_0x27d0('0x13')](function(){return values;})[_0x27d0('0x13')](respondWithResult(_0x2dcdb3,null))['catch'](handleError(_0x2dcdb3,null));};exports[_0x27d0('0x27')]=function(_0x837fce,_0x2179b7){if(_0x837fce[_0x27d0('0x5d')]['id']){delete _0x837fce['body']['id'];}delete _0x837fce['body']['role'];return db[_0x27d0('0x42')][_0x27d0('0x5a')]({'where':{'id':_0x837fce[_0x27d0('0x5e')]['id']}})[_0x27d0('0x13')](handleEntityNotFound(_0x2179b7,null))[_0x27d0('0x13')](saveUpdates(_0x837fce[_0x27d0('0x5d')],null))[_0x27d0('0x13')](respondWithResult(_0x2179b7,null))[_0x27d0('0x1d')](handleError(_0x2179b7,null));};exports[_0x27d0('0x5f')]=function(_0x4a70f8,_0x15e01b){return db['User']['describe']()[_0x27d0('0x13')](respondWithResult(_0x15e01b,null))[_0x27d0('0x1d')](handleError(_0x15e01b,null));};exports['addContacts']=function(_0x1e076d,_0x5ce6a8){return db[_0x27d0('0x42')]['find']({'where':{'id':_0x1e076d[_0x27d0('0x5e')]['id']}})[_0x27d0('0x13')](handleEntityNotFound(_0x5ce6a8,null))[_0x27d0('0x13')](function(_0x5528b5){if(_0x5528b5){return _0x5528b5[_0x27d0('0x60')](_0x1e076d[_0x27d0('0x5d')][_0x27d0('0x61')],_[_0x27d0('0x62')](_0x1e076d['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x5ce6a8,null))[_0x27d0('0x1d')](handleError(_0x5ce6a8,null));};function validateUser(_0x5605d3){return new Promise(function(_0x2ce030,_0x497f06){if(_0x5605d3['internal'])return _0x2ce030(_0x5605d3);return db[_0x27d0('0x63')][_0x27d0('0x64')](0x1)['then'](function(_0x2a63cb){if(_0x2a63cb[_0x27d0('0x65')])authService[_0x27d0('0x66')](_0x5605d3[_0x27d0('0x55')]);db[_0x27d0('0x42')][_0x27d0('0x67')]('internal')[_0x27d0('0x13')](function(_0x13a75c){if(_[_0x27d0('0x68')](_0x13a75c)){_0x5605d3['internal']=_0x2a63cb['min_internal']||0x1;return;}if(_[_0x27d0('0x68')](_0x2a63cb['min_internal'])||_0x2a63cb[_0x27d0('0x69')]===_0x13a75c){_0x5605d3[_0x27d0('0x6a')]=_0x13a75c+0x1;return;}if(_0x2a63cb[_0x27d0('0x69')]>_0x13a75c){_0x5605d3[_0x27d0('0x6a')]=_0x2a63cb['min_internal'];return;}return db['sequelize'][_0x27d0('0x43')](_0x27d0('0x6b'),{'type':db[_0x27d0('0x6c')][_0x27d0('0x6d')][_0x27d0('0x6e')]})[_0x27d0('0x13')](function(_0x56e3a0){if(_0x56e3a0&&_0x56e3a0['length']){for(var _0x66f08=0x0,_0x4b0996=_0x56e3a0[_0x27d0('0x4d')];_0x66f08<_0x4b0996&&_[_0x27d0('0x68')](_0x5605d3[_0x27d0('0x6a')]);_0x66f08++){if(_0x2a63cb['min_internal']<=_0x56e3a0[_0x66f08]['from']){_0x5605d3[_0x27d0('0x6a')]=_0x56e3a0[_0x66f08][_0x27d0('0x6f')];}else if(_0x2a63cb[_0x27d0('0x69')]>_0x56e3a0[_0x66f08][_0x27d0('0x6f')]&&_0x2a63cb[_0x27d0('0x69')]<=_0x56e3a0[_0x66f08]['to']){_0x5605d3['internal']=_0x2a63cb['min_internal'];}}}if(_['isNil'](_0x5605d3['internal'])){_0x5605d3['internal']=_0x13a75c+0x1;}return _0x2ce030(_0x5605d3);});});})[_0x27d0('0x1d')](function(_0x1a99ec){_0x497f06(_0x1a99ec);});});}function updateUser(_0x347474){return new Promise(function(_0xf61aee,_0x44549c){try{if(_0x347474[_0x27d0('0x70')]){_0x347474[_0x27d0('0x71')]=_0x347474['internal'];_0x347474[_0x27d0('0x72')]={'mailbox':_0x347474[_0x27d0('0x6a')],'password':_0x347474[_0x27d0('0x55')],'fullname':_0x347474[_0x27d0('0x73')],'email':_0x347474[_0x27d0('0x74')]};}if(_0x347474['role']===_0x27d0('0x2f')){if(!_0x347474[_0x27d0('0x75')])_0x347474[_0x27d0('0x75')]=[_0x27d0('0x76'),_0x27d0('0x77'),'103',_0x27d0('0x78'),'110',_0x27d0('0x79'),_0x27d0('0x7a'),'106',_0x27d0('0x7b'),_0x27d0('0x7c'),_0x27d0('0x7d'),_0x27d0('0x7e'),'111','114','115'];}_0xf61aee(_0x347474);}catch(_0x416bd0){_0x44549c(_0x416bd0);}});}exports[_0x27d0('0x7f')]=function(_0x1d92d1,_0xc5aeca){if(_0x1d92d1['user'][_0x27d0('0x2b')]===_0x27d0('0x2f'))throw new Error(_0x27d0('0x80'));if(_0x1d92d1[_0x27d0('0x5d')]['role']===_0x27d0('0x2e')&&_0x1d92d1[_0x27d0('0x2e')][_0x27d0('0x2b')]!==_0x27d0('0x2c')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x1d92d1[_0x27d0('0x5d')][_0x27d0('0x2b')]===_0x27d0('0x2c')&&_0x1d92d1[_0x27d0('0x2e')][_0x27d0('0x2b')]!==_0x27d0('0x2c')){throw new Error(_0x27d0('0x81'));}return licenseUtil[_0x27d0('0x82')]([_0x1d92d1[_0x27d0('0x5d')]])[_0x27d0('0x13')](function(){return validateUser(_0x1d92d1[_0x27d0('0x5d')]);})['then'](function(_0x1a95bc){return updateUser(_0x1a95bc)[_0x27d0('0x13')](function(_0x346b77){if(_0x346b77[_0x27d0('0x2b')]===_0x27d0('0x2c')){_0x346b77[_0x27d0('0x83')]=_0x1d92d1[_0x27d0('0x2e')]['settingsEnabled'];delete _0x346b77[_0x27d0('0x84')];}return _0x346b77;});})[_0x27d0('0x13')](function(_0x1d111){return db[_0x27d0('0x42')][_0x27d0('0x7f')](_0x1d111,{'include':[{'model':db[_0x27d0('0x72')],'as':_0x27d0('0x72')}]});})[_0x27d0('0x13')](function(_0x23e838){if(_0x1d92d1[_0x27d0('0x5d')][_0x27d0('0x2b')]===_0x27d0('0x2e'))return _0x23e838;if(_0x1d92d1[_0x27d0('0x2e')]['role']!==_0x27d0('0x2e'))return _0x23e838;return db[_0x27d0('0x85')][_0x27d0('0x5a')]({'where':{'name':_0x23e838[_0x27d0('0x2b')]===_0x27d0('0x2f')?_0x27d0('0x86'):_0x27d0('0x30'),'userProfileId':_0x1d92d1[_0x27d0('0x2e')][_0x27d0('0x84')]},'raw':!![]})[_0x27d0('0x13')](function(_0x1c2ba2){if(!_0x1c2ba2||_0x1c2ba2[_0x27d0('0x87')]!=0x0)return _0x23e838;return db[_0x27d0('0x37')][_0x27d0('0x7f')]({'name':_0x23e838[_0x27d0('0x36')],'resourceId':_0x23e838['id'],'type':_0x1c2ba2[_0x27d0('0x36')],'sectionId':_0x1c2ba2['id']},{})['then'](function(){return _0x23e838;});})[_0x27d0('0x1d')](function(_0x55b62f){logger['error'](_0x27d0('0x88'),_0x55b62f);throw _0x55b62f;});})[_0x27d0('0x13')](respondWithResult(_0xc5aeca,0xc9))[_0x27d0('0x1d')](handleError(_0xc5aeca,null));};exports[_0x27d0('0x89')]=function(_0x323231,_0x1f65e5){var _0x28ab15=_0x323231[_0x27d0('0x5d')];var _0x46983b=[];if(_0x323231[_0x27d0('0x2e')][_0x27d0('0x2b')]==='agent')throw new Error('Unauthorized');if(_['some'](_0x28ab15,[_0x27d0('0x2b'),_0x27d0('0x2e')])&&_0x323231[_0x27d0('0x2e')][_0x27d0('0x2b')]!=='admin'){throw new Error(_0x27d0('0x8a'));}if(_[_0x27d0('0x8b')](_0x28ab15,['role','admin'])&&_0x323231['user'][_0x27d0('0x2b')]!==_0x27d0('0x2c')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x27d0('0x82')](_0x28ab15)['then'](function(){return validateUser(_0x28ab15[0x0]);})[_0x27d0('0x13')](function(){for(var _0x179d33=0x1;_0x179d33<_0x28ab15[_0x27d0('0x4d')];_0x179d33++){var _0x1dc2d9=_0x28ab15[_0x179d33-0x1][_0x27d0('0x6a')];if(!_0x28ab15[_0x179d33][_0x27d0('0x6a')])_0x28ab15[_0x179d33]['internal']=_0x1dc2d9+0x1;_0x46983b[_0x27d0('0x49')](validateUser(_0x28ab15[_0x179d33]));}return Promise[_0x27d0('0x8c')](_0x46983b);})[_0x27d0('0x13')](function(){_0x46983b=[];for(var _0x3d48e6=0x0;_0x3d48e6<_0x28ab15[_0x27d0('0x4d')];_0x3d48e6++){_0x46983b[_0x27d0('0x49')](updateUser(_0x28ab15[_0x3d48e6]));}return Promise[_0x27d0('0x8c')](_0x46983b);})[_0x27d0('0x13')](function(){_0x46983b=_0x28ab15[_0x27d0('0x33')](function(_0x59272d){return db[_0x27d0('0x42')][_0x27d0('0x7f')](_0x59272d,{'include':[{'model':db[_0x27d0('0x72')],'as':_0x27d0('0x72')}]})[_0x27d0('0x13')](function(_0x17559e){_0x59272d['id']=_0x17559e['id'];return _0x59272d;});});return Promise[_0x27d0('0x8c')](_0x46983b);})[_0x27d0('0x13')](function(_0x4a35fd){if(_0x323231[_0x27d0('0x5d')]['role']===_0x27d0('0x2e'))return _0x4a35fd;if(_0x323231[_0x27d0('0x2e')][_0x27d0('0x2b')]!==_0x27d0('0x2e'))return _0x4a35fd;var _0x5a31ae=_[_0x27d0('0x8b')](_0x4a35fd,function(_0x4f565a){return _0x4f565a['role']===_0x27d0('0x2f')||_0x4f565a[_0x27d0('0x2b')]==='telephone';});if(!_0x5a31ae)return _0x4a35fd;return db[_0x27d0('0x85')][_0x27d0('0x4a')]({'where':{'name':{'$or':[_0x27d0('0x86'),_0x27d0('0x30')]},'userProfileId':_0x323231[_0x27d0('0x2e')][_0x27d0('0x84')]},'raw':!![]})[_0x27d0('0x13')](function(_0xb3413f){if(_[_0x27d0('0x8d')](_0xb3413f)||!_[_0x27d0('0x8b')](_0xb3413f,['autoAssociation',0x0]))return _0x4a35fd;_0x46983b=[];var _0x49fc73=_(_0xb3413f)[_0x27d0('0x33')](function(_0x58fda7){if(_0x58fda7[_0x27d0('0x87')]===0x1)return;return _0x58fda7[_0x27d0('0x36')]===_0x27d0('0x86')?_0x27d0('0x2f'):_0x27d0('0x31');})[_0x27d0('0x8e')]()[_0x27d0('0x34')]();for(var _0xd4eff5=0x0;_0xd4eff5<_0x4a35fd[_0x27d0('0x4d')];_0xd4eff5++){if(!_[_0x27d0('0x35')](_0x49fc73,_0x4a35fd[_0xd4eff5][_0x27d0('0x2b')]))return;var _0x205cb8=_0x4a35fd[_0xd4eff5]['role']==='agent'?'Agents':_0x27d0('0x30');_0x46983b[_0x27d0('0x49')](db[_0x27d0('0x37')]['create']({'name':_0x4a35fd[_0xd4eff5]['name'],'resourceId':_0x4a35fd[_0xd4eff5]['id'],'type':_0x205cb8,'sectionId':_[_0x27d0('0x5a')](_0xb3413f,[_0x27d0('0x36'),_0x205cb8])['id']},{}));}return Promise['all'](_0x46983b);});})[_0x27d0('0x13')](respondWithResult(_0x1f65e5,0xc9))['catch'](handleError(_0x1f65e5,null));};exports[_0x27d0('0x8f')]=function(_0x5bf931,_0x40b5a9){if(_0x5bf931[_0x27d0('0x5d')]['id']){delete _0x5bf931[_0x27d0('0x5d')]['id'];}return db[_0x27d0('0x42')]['find']({'where':{'id':_0x5bf931['params']['id']}})[_0x27d0('0x13')](function(_0x15a2d6){if(!_0x15a2d6)return null;if(_0x15a2d6['id']===_0x5bf931['user']['id']){if(!_0x5bf931[_0x27d0('0x5d')][_0x27d0('0x90')]||!_0x5bf931['body']['newPassword']){throw new db[(_0x27d0('0x91'))][(_0x27d0('0x92'))](_0x27d0('0x93'));}if(!_0x15a2d6[_0x27d0('0x94')](_0x5bf931['body']['oldPassword'])){throw new db[(_0x27d0('0x91'))][(_0x27d0('0x92'))]('Wrong\x20credentials');}if(_0x5bf931['body']['oldPassword']===_0x5bf931[_0x27d0('0x5d')][_0x27d0('0x95')]){throw new db[(_0x27d0('0x91'))]['ValidationError'](_0x27d0('0x96'));}}else if(_0x5bf931[_0x27d0('0x2e')]['role']===_0x27d0('0x2c')){if(!_0x5bf931[_0x27d0('0x5d')][_0x27d0('0x95')]){throw new db[(_0x27d0('0x91'))]['ValidationError'](_0x27d0('0x97'));}}else if(_0x5bf931[_0x27d0('0x2e')][_0x27d0('0x2b')]===_0x27d0('0x2e')){if(!_0x5bf931[_0x27d0('0x5d')][_0x27d0('0x95')]){throw new db[(_0x27d0('0x91'))][(_0x27d0('0x92'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x15a2d6['role']!==_0x27d0('0x2f')){throw new db[(_0x27d0('0x91'))][(_0x27d0('0x92'))]('Unauthorized');}}else{throw new db[(_0x27d0('0x91'))][(_0x27d0('0x92'))]('Unauthorized');}return _0x15a2d6;})[_0x27d0('0x13')](handleEntityNotFound(_0x40b5a9,null))['then'](function(_0x557bd7){return db[_0x27d0('0x63')][_0x27d0('0x98')]({'attributes':['id',_0x27d0('0x65'),'enforcePasswordHistory',_0x27d0('0x99')]})[_0x27d0('0x13')](function(_0x411c36){if(_0x411c36['securePassword'])authService[_0x27d0('0x66')](_0x5bf931[_0x27d0('0x5d')][_0x27d0('0x95')]);if(!_0x411c36['enforcePasswordHistory']||!_0x557bd7['previousPasswords'])return _0x557bd7;authService[_0x27d0('0x9a')](_0x5bf931['body'][_0x27d0('0x95')],_0x557bd7[_0x27d0('0x9b')],_0x411c36[_0x27d0('0x99')]);return _0x557bd7;})[_0x27d0('0x13')](saveUpdates({'password':_0x5bf931[_0x27d0('0x5d')]['newPassword'],'passwordResetAt':_0x5bf931[_0x27d0('0x2e')]['id']==_0x5bf931[_0x27d0('0x5e')]['id']?moment():null,'previousPasswords':authService[_0x27d0('0x9c')](_0x5bf931[_0x27d0('0x5d')][_0x27d0('0x95')],_0x557bd7['previousPasswords'])},null));})[_0x27d0('0x13')](respondWithResult(_0x40b5a9,null))[_0x27d0('0x1d')](handleError(_0x40b5a9,null));};exports[_0x27d0('0x9d')]=function(_0x4ce61d,_0x1b6132){var _0xb025c2=_0x4ce61d[_0x27d0('0x5d')]['channel'];return db[_0x27d0('0x42')][_0x27d0('0x5a')]({'where':{'id':_0x4ce61d['params']['id']},'attributes':['id','name','role','online',_0x27d0('0x9e'),_0x27d0('0x9f'),_0x27d0('0xa0')]})[_0x27d0('0x13')](handleEntityNotFound(_0x1b6132,null))[_0x27d0('0x13')](function(_0x585de8){if(_0x585de8){if(!utils['isValidChannel'](_0xb025c2)){throw new db[(_0x27d0('0x91'))][(_0x27d0('0x92'))](_0x27d0('0xa1'));}return _0x585de8['add'+_['capitalize'](_0xb025c2[_0x27d0('0xa2')]())+_0x27d0('0xa3')](_0x4ce61d['body'][_0x27d0('0x61')],{'penalty':_0x4ce61d[_0x27d0('0x5d')][_0x27d0('0xa4')]||0x0})[_0x27d0('0xa5')](function(_0x196b36){for(var _0xd0ac5c=0x0;_0xd0ac5c<_0x4ce61d[_0x27d0('0x5d')]['ids'][_0x27d0('0x4d')];_0xd0ac5c+=0x1){var _0x3d5ead={'UserId':Number(_0x4ce61d[_0x27d0('0x5e')]['id'])};_0x3d5ead[_[_0x27d0('0xa6')](_0xb025c2['toLowerCase']())+_0x27d0('0xa7')]=Number(_0x4ce61d[_0x27d0('0x5d')][_0x27d0('0x61')][_0xd0ac5c]);socket[_0x27d0('0xa8')]('user'+_[_0x27d0('0xa6')](_0xb025c2[_0x27d0('0xa2')]())+_0x27d0('0xa9'),_0x3d5ead);}return _0x196b36;})[_0x27d0('0x13')](function(){if(_0xb025c2==='voice'){return db['VoiceQueue'][_0x27d0('0x4a')]({'where':{'id':_0x4ce61d[_0x27d0('0x5d')][_0x27d0('0x61')]||[]},'raw':!![],'attributes':['id',_0x27d0('0x36')]});}})[_0x27d0('0x13')](function(_0x5f361b){var _0x5b9797=_0x585de8[_0x27d0('0x2a')]({'plain':!![]});var _0xb48e44=[];if(_0xb025c2===_0x27d0('0xaa')&&_0x5b9797['role']==='agent'&&_0x5b9797[_0x27d0('0xab')]){for(let _0x554ba6=0x0;_0x554ba6<_0x5f361b[_0x27d0('0x4d')];_0x554ba6+=0x1){_0xb48e44[_0x27d0('0x49')]({'membername':_0x5b9797[_0x27d0('0x36')],'UserId':_0x5b9797['id'],'queue_name':_0x5f361b[_0x554ba6][_0x27d0('0x36')],'VoiceQueueId':_0x5f361b[_0x554ba6]['id'],'interface':_[_0x27d0('0x68')](_0x5b9797[_0x27d0('0xa0')])?util[_0x27d0('0xac')](_0x27d0('0xad'),_0x5b9797['name']):_0x5b9797['interface'],'paused':_0x5b9797[_0x27d0('0x9f')]||![],'penalty':_0x4ce61d[_0x27d0('0x5d')][_0x27d0('0xa4')]||0x0});}return Promise['all'](_0xb48e44['map'](function(_0x36c2bf){return db[_0x27d0('0xae')][_0x27d0('0xaf')](_0x36c2bf);}));}return _0x585de8;});}})[_0x27d0('0x13')](respondWithStatusCode(_0x1b6132,null))[_0x27d0('0x1d')](handleError(_0x1b6132,null));};exports[_0x27d0('0xb0')]=function(_0x580afa,_0x4934b2){var _0x2d9c6c,_0x2842b2;return db[_0x27d0('0x42')]['find']({'where':{'id':_0x580afa[_0x27d0('0x5e')]['id']},'attributes':['id',_0x27d0('0x36'),'role']})[_0x27d0('0x13')](handleEntityNotFound(_0x4934b2,null))[_0x27d0('0x13')](function(_0x5c3bec){if(_0x5c3bec){_0x2d9c6c=_0x5c3bec;if(!_0x580afa[_0x27d0('0x43')]['channel']||!utils[_0x27d0('0xb1')](_0x580afa[_0x27d0('0x43')][_0x27d0('0xb2')])){throw new db[(_0x27d0('0x91'))][(_0x27d0('0x92'))](_0x27d0('0xa1'));}return _0x5c3bec['remove'+_['capitalize'](_0x580afa[_0x27d0('0x43')]['channel'][_0x27d0('0xa2')]())+'Queues'](_0x580afa[_0x27d0('0x43')][_0x27d0('0x61')]);}})['then'](function(_0x113908){if(_[_0x27d0('0xb3')](_0x580afa[_0x27d0('0x43')][_0x27d0('0x61')])){for(var _0x18829c=0x0;_0x18829c<_0x580afa[_0x27d0('0x43')]['ids'][_0x27d0('0x4d')];_0x18829c+=0x1){_0x2842b2={'UserId':Number(_0x580afa[_0x27d0('0x5e')]['id'])};_0x2842b2[_[_0x27d0('0xa6')](_0x580afa['query'][_0x27d0('0xb2')][_0x27d0('0xa2')]())+_0x27d0('0xa7')]=Number(_0x580afa[_0x27d0('0x43')][_0x27d0('0x61')][_0x18829c]);socket['emit'](_0x27d0('0x2e')+_['capitalize'](_0x580afa[_0x27d0('0x43')][_0x27d0('0xb2')]['toLowerCase']())+'Queue:remove',_0x2842b2);}}else{_0x2842b2={'UserId':Number(_0x580afa[_0x27d0('0x5e')]['id'])};_0x2842b2[_[_0x27d0('0xa6')](_0x580afa[_0x27d0('0x43')][_0x27d0('0xb2')][_0x27d0('0xa2')]())+'QueueId']=Number(_0x580afa['query'][_0x27d0('0x61')]);socket[_0x27d0('0xa8')](_0x27d0('0x2e')+_[_0x27d0('0xa6')](_0x580afa[_0x27d0('0x43')][_0x27d0('0xb2')][_0x27d0('0xa2')]())+_0x27d0('0xb4'),_0x2842b2);}return _0x113908;})[_0x27d0('0x13')](function(){if(_0x580afa[_0x27d0('0x43')][_0x27d0('0xb2')]===_0x27d0('0xaa')){return db[_0x27d0('0xae')][_0x27d0('0x29')]({'where':{'UserId':_0x580afa[_0x27d0('0x5e')]['id'],'VoiceQueueId':_0x580afa[_0x27d0('0x43')][_0x27d0('0x61')]},'individualHooks':!![]})[_0x27d0('0x13')](function(){return _0x2d9c6c;});}return _0x2d9c6c;})['then'](respondWithStatusCode(_0x4934b2,null))[_0x27d0('0x1d')](handleError(_0x4934b2,null));};exports[_0x27d0('0xb5')]=function(_0x39e278,_0x5e6339){_0x39e278['body'][_0x27d0('0xb6')]=_0x39e278[_0x27d0('0xb7')][_0x27d0('0xb8')];return db[_0x27d0('0x42')][_0x27d0('0x5a')]({'where':{'id':_0x39e278[_0x27d0('0x5e')]['id']}})[_0x27d0('0x13')](handleEntityNotFound(_0x5e6339,null))[_0x27d0('0x13')](saveUpdates(_0x39e278[_0x27d0('0x5d')],null))[_0x27d0('0x13')](respondWithResult(_0x5e6339,null))[_0x27d0('0x1d')](handleError(_0x5e6339,null));};exports[_0x27d0('0xb9')]=function(_0x374ba2,_0x3ff96a){var _0x373bb3=path[_0x27d0('0xba')](config[_0x27d0('0xbb')],_0x27d0('0xbc'));return db['User'][_0x27d0('0x5a')]({'where':{'id':_0x374ba2[_0x27d0('0x5e')]['id']},'attributes':['id',_0x27d0('0xb6')],'raw':!![]})[_0x27d0('0x13')](handleEntityNotFound(_0x3ff96a,null))[_0x27d0('0x13')](function(_0x77c470){if(_0x77c470){if(_[_0x27d0('0x68')](_0x77c470['userpic'])){return _0x3ff96a[_0x27d0('0xbd')](_0x373bb3);}else{if(!fs[_0x27d0('0xbe')](path[_0x27d0('0xba')](config['root'],_0x27d0('0xbf'),_0x77c470[_0x27d0('0xb6')]))){return _0x3ff96a[_0x27d0('0xbd')](_0x373bb3);}return _0x3ff96a[_0x27d0('0xbd')](path[_0x27d0('0xba')](config[_0x27d0('0xbb')],'server/files/images/',_0x77c470[_0x27d0('0xb6')]));}}})[_0x27d0('0x1d')](handleError(_0x3ff96a,null));};exports['getOpenTabs']=function(_0x315348,_0x2f7f0b){return db[_0x27d0('0x42')][_0x27d0('0x5a')]({'where':{'id':_0x315348[_0x27d0('0x5e')]['id']},'attributes':['id']})[_0x27d0('0x13')](handleEntityNotFound(_0x2f7f0b,null))[_0x27d0('0x13')](function(_0x3038e1){var _0x7ad9=[];values=_0x3038e1[_0x27d0('0x4f')];_0x7ad9[_0x27d0('0x49')](get_open_tabs(_0x27d0('0x4e'),_0x3038e1[_0x27d0('0x4f')]));_0x7ad9[_0x27d0('0x49')](get_open_tabs(_0x27d0('0x50'),_0x3038e1[_0x27d0('0x4f')]));_0x7ad9[_0x27d0('0x49')](get_open_tabs(_0x27d0('0xc0'),_0x3038e1[_0x27d0('0x4f')]));_0x7ad9[_0x27d0('0x49')](get_open_tabs(_0x27d0('0x5b'),_0x3038e1[_0x27d0('0x4f')]));_0x7ad9[_0x27d0('0x49')](get_open_tabs(_0x27d0('0x51'),_0x3038e1['dataValues']));_0x7ad9['push'](get_open_tabs('mail',_0x3038e1['dataValues']));return Promise[_0x27d0('0x8c')](_0x7ad9);})[_0x27d0('0x13')](function(_0x47b279){if(_0x47b279){var _0xd2b093=_[_0x27d0('0x33')](values[_0x27d0('0xc1')],function(_0x9513f1){return{'channel':_0x27d0('0xc2'),'id':_0x9513f1['id'],'createdAt':_0x9513f1['createdAt']};});var _0x3c096b=_[_0x27d0('0x33')](values[_0x27d0('0xc3')],function(_0x2ad8cc){return{'channel':_0x27d0('0xc4'),'id':_0x2ad8cc['id'],'createdAt':_0x2ad8cc[_0x27d0('0xc5')]};});var _0x303a99=_[_0x27d0('0x33')](values[_0x27d0('0xc6')],function(_0x1ca62d){return{'channel':_0x27d0('0xc7'),'id':_0x1ca62d['id'],'createdAt':_0x1ca62d[_0x27d0('0xc5')]};});var _0x309b80=_[_0x27d0('0x33')](values['MailOpenTabs'],function(_0x563f38){return{'channel':'MAIL','id':_0x563f38['id'],'createdAt':_0x563f38[_0x27d0('0xc5')]};});var _0x5196d7=_['map'](values[_0x27d0('0xc8')],function(_0x18ced8){return{'channel':_0x27d0('0xc9'),'id':_0x18ced8['id'],'createdAt':_0x18ced8['createdAt']};});var _0x45e6c1=_['map'](values[_0x27d0('0xca')],function(_0x438281){return{'channel':_0x27d0('0xcb'),'id':_0x438281['id'],'createdAt':_0x438281['createdAt']};});var _0x13fd36=_[_0x27d0('0xcc')](_0xd2b093,_0x3c096b,_0x303a99,_0x309b80,_0x5196d7,_0x45e6c1);var _0x28781a={'count':_0x13fd36[_0x27d0('0x4d')],'rows':_0x13fd36};return _0x28781a;}else return null;})[_0x27d0('0x13')](respondWithResult(_0x2f7f0b,null))['catch'](handleError(_0x2f7f0b,null));};exports[_0x27d0('0xcd')]=function(_0x4ca3a1,_0x4ef87f){var _0x49491a={};var _0x4ab68f={};var _0x238546;var _0x1ca15c;return db[_0x27d0('0x42')][_0x27d0('0x98')]({'where':{'id':_0x4ca3a1[_0x27d0('0x5e')]['id']}})[_0x27d0('0x13')](handleEntityNotFound(_0x4ef87f,null))[_0x27d0('0x13')](function(_0x23cf02){if(_0x23cf02){_0x238546=_0x23cf02;_0x4ab68f[_0x27d0('0x53')]=_[_0x27d0('0x54')](db['CmContact'][_0x27d0('0x3a')]);_0x4ab68f[_0x27d0('0x43')]=_['keys'](_0x4ca3a1[_0x27d0('0x43')]);_0x4ab68f[_0x27d0('0x56')]=_[_0x27d0('0xce')](_0x4ab68f[_0x27d0('0x53')],_0x4ab68f[_0x27d0('0x43')]);_0x49491a[_0x27d0('0x48')]=_[_0x27d0('0xce')](_0x4ab68f['model'],qs['fields'](_0x4ca3a1[_0x27d0('0x43')][_0x27d0('0x57')]));_0x49491a['attributes']=_0x49491a['attributes']['length']?_0x49491a[_0x27d0('0x48')]:_0x4ab68f['model'];_0x49491a[_0x27d0('0xcf')]=qs[_0x27d0('0xd0')](_0x4ca3a1[_0x27d0('0x43')][_0x27d0('0xd0')]);_0x49491a[_0x27d0('0x41')]=qs['filters'](_[_0x27d0('0xd1')](_0x4ca3a1[_0x27d0('0x43')],_0x4ab68f[_0x27d0('0x56')]));if(_0x4ca3a1[_0x27d0('0x43')][_0x27d0('0x3e')]){_0x49491a[_0x27d0('0x41')]=_[_0x27d0('0x59')](_0x49491a[_0x27d0('0x41')],{'$or':_['map'](_0x49491a[_0x27d0('0x48')],function(_0x1edbd6){var _0x5e1027={};_0x5e1027[_0x1edbd6]={'$like':'%'+_0x4ca3a1[_0x27d0('0x43')][_0x27d0('0x3e')]+'%'};return _0x5e1027;})});}_0x49491a=_[_0x27d0('0x59')]({},_0x49491a,_0x4ca3a1['options']);return _0x238546['getContacts'](_0x49491a);}})[_0x27d0('0x13')](function(_0x106413){if(_0x106413){_0x1ca15c=_0x106413[_0x27d0('0x4d')];if(_0x4ca3a1[_0x27d0('0x43')]['hasOwnProperty'](_0x27d0('0x44'))){_0x49491a[_0x27d0('0x45')]=[{'model':db[_0x27d0('0xd2')],'as':'List','required':![]},{'model':db[_0x27d0('0xd3')],'as':_0x27d0('0xd4'),'attributes':['id','name','color'],'where':_0x4ca3a1['query']['tag']?{'id':_0x4ca3a1[_0x27d0('0x43')][_0x27d0('0xd5')]}:undefined,'required':_0x4ca3a1[_0x27d0('0x43')]['tag']?!![]:![]}];}if(!_0x4ca3a1['query'][_0x27d0('0xd6')](_0x27d0('0xd7'))){_0x49491a[_0x27d0('0x24')]=qs[_0x27d0('0x24')](_0x4ca3a1[_0x27d0('0x43')][_0x27d0('0x24')]);_0x49491a[_0x27d0('0x22')]=qs[_0x27d0('0x22')](_0x4ca3a1[_0x27d0('0x43')]['offset']);}return _0x238546[_0x27d0('0xcd')](_0x49491a);}})[_0x27d0('0x13')](function(_0x337aec){if(_0x337aec){return _0x337aec?{'count':_0x1ca15c,'rows':_0x337aec}:null;}})[_0x27d0('0x13')](respondWithResult(_0x4ef87f,null))[_0x27d0('0x1d')](handleError(_0x4ef87f,null));};exports[_0x27d0('0xd8')]=function(_0x4a6068,_0xe3e7e0){var _0x14ac7c;var _0x4d0b72={};var _0x114568;return db[_0x27d0('0x42')][_0x27d0('0x98')]({'where':{'id':_0x4a6068[_0x27d0('0x5e')]['id']},'attributes':['id',_0x27d0('0x36'),_0x27d0('0x2b')]})[_0x27d0('0x13')](handleEntityNotFound(_0xe3e7e0,null))[_0x27d0('0x13')](function(_0x117e78){if(!utils[_0x27d0('0xb1')](_0x4a6068[_0x27d0('0x43')]['channel'])){throw new db[(_0x27d0('0x91'))][(_0x27d0('0x92'))](_0x27d0('0xa1'));}_0x14ac7c=_0x117e78;var _0x4508c0={};_0x4508c0[_0x27d0('0x53')]=_[_0x27d0('0x54')](db[_[_0x27d0('0xa6')](_0x4a6068[_0x27d0('0x43')][_0x27d0('0xb2')])+_0x27d0('0xd9')][_0x27d0('0x3a')]);_0x4508c0[_0x27d0('0x43')]=_[_0x27d0('0x54')](_0x4a6068[_0x27d0('0x43')]);_0x4508c0[_0x27d0('0x56')]=_[_0x27d0('0xce')](_0x4508c0[_0x27d0('0x53')],_0x4508c0[_0x27d0('0x43')]);_0x4d0b72[_0x27d0('0x48')]=_['intersection'](_0x4508c0[_0x27d0('0x53')],qs['fields'](_0x4a6068['query']['fields']));_0x4d0b72[_0x27d0('0x48')]=_0x4d0b72[_0x27d0('0x48')][_0x27d0('0x4d')]?_0x4d0b72['attributes']:_0x4508c0['model'];_0x4d0b72[_0x27d0('0xcf')]=qs['sort'](_0x4a6068[_0x27d0('0x43')][_0x27d0('0xd0')]);_0x4d0b72[_0x27d0('0x41')]=qs[_0x27d0('0x56')](_[_0x27d0('0xd1')](_0x4a6068['query'],_0x4508c0[_0x27d0('0x56')]));if(_0x4a6068[_0x27d0('0x43')][_0x27d0('0x3e')]){_0x4d0b72[_0x27d0('0x41')]=_[_0x27d0('0x59')](_0x4d0b72[_0x27d0('0x41')],{'$or':_[_0x27d0('0x33')](_0x4d0b72['attributes'],function(_0x341f7c){var _0x380e76={};_0x380e76[_0x341f7c]={'$like':'%'+_0x4a6068[_0x27d0('0x43')][_0x27d0('0x3e')]+'%'};return _0x380e76;})});}_0x4d0b72=_['merge']({},_0x4d0b72,_0x4a6068[_0x27d0('0xda')]);switch(_0x14ac7c[_0x27d0('0x2b')]){case'admin':return db[_['capitalize'](_0x4a6068[_0x27d0('0x43')][_0x27d0('0xb2')])+_0x27d0('0xd9')][_0x27d0('0x4a')](_0x4d0b72);case _0x27d0('0x2e'):case _0x27d0('0x2f'):return _0x14ac7c[_0x27d0('0x2a')+_['capitalize'](_0x4a6068[_0x27d0('0x43')][_0x27d0('0xb2')])+_0x27d0('0xa3')](_0x4d0b72);default:throw new db[(_0x27d0('0x91'))][(_0x27d0('0x92'))](_0x27d0('0xdb'));}})['then'](function(_0x17cf8a){_0x114568=_0x17cf8a[_0x27d0('0x4d')];if(!_0x4a6068[_0x27d0('0x43')][_0x27d0('0xd6')](_0x27d0('0xd7'))){_0x4d0b72[_0x27d0('0x24')]=qs[_0x27d0('0x24')](_0x4a6068[_0x27d0('0x43')]['limit']);_0x4d0b72['offset']=qs[_0x27d0('0x22')](_0x4a6068[_0x27d0('0x43')][_0x27d0('0x22')]);}switch(_0x14ac7c[_0x27d0('0x2b')]){case _0x27d0('0x2c'):return db[_[_0x27d0('0xa6')](_0x4a6068[_0x27d0('0x43')][_0x27d0('0xb2')])+'Queue'][_0x27d0('0x4a')](_0x4d0b72);case _0x27d0('0x2e'):case'agent':return _0x14ac7c[_0x27d0('0x2a')+_[_0x27d0('0xa6')](_0x4a6068[_0x27d0('0x43')][_0x27d0('0xb2')])+_0x27d0('0xa3')](_0x4d0b72);}})['then'](function(_0x4ae336){return{'count':_0x114568,'rows':_0x4ae336};})['then'](respondWithResult(_0xe3e7e0,null))[_0x27d0('0x1d')](handleError(_0xe3e7e0,null));};exports[_0x27d0('0xdc')]=function(_0x1ca976,_0x50c07a){var _0x5043c8={};var _0x573dcc={};var _0x4432f3;var _0x5ba2c4;return db[_0x27d0('0x42')][_0x27d0('0x98')]({'where':{'id':_0x1ca976[_0x27d0('0x5e')]['id']}})[_0x27d0('0x13')](handleEntityNotFound(_0x50c07a,null))[_0x27d0('0x13')](function(_0x249259){if(_0x249259){_0x4432f3=_0x249259;_0x573dcc[_0x27d0('0x53')]=_[_0x27d0('0x54')](db[_0x27d0('0xae')][_0x27d0('0x3a')]);_0x573dcc[_0x27d0('0x43')]=_[_0x27d0('0x54')](_0x1ca976[_0x27d0('0x43')]);_0x573dcc[_0x27d0('0x56')]=_['intersection'](_0x573dcc[_0x27d0('0x53')],_0x573dcc['query']);_0x5043c8['attributes']=_[_0x27d0('0xce')](_0x573dcc['model'],qs['fields'](_0x1ca976['query'][_0x27d0('0x57')]));_0x5043c8[_0x27d0('0x48')]=_0x5043c8[_0x27d0('0x48')][_0x27d0('0x4d')]?_0x5043c8[_0x27d0('0x48')]:_0x573dcc[_0x27d0('0x53')];_0x5043c8['order']=qs[_0x27d0('0xd0')](_0x1ca976[_0x27d0('0x43')][_0x27d0('0xd0')]);_0x5043c8[_0x27d0('0x41')]=qs[_0x27d0('0x56')](_[_0x27d0('0xd1')](_0x1ca976['query'],_0x573dcc[_0x27d0('0x56')]));if(_0x1ca976['query'][_0x27d0('0x3e')]){_0x5043c8[_0x27d0('0x41')]=_[_0x27d0('0x59')](_0x5043c8[_0x27d0('0x41')],{'$or':_['map'](_0x5043c8[_0x27d0('0x48')],function(_0x3397a5){var _0x1ff8fa={};_0x1ff8fa[_0x3397a5]={'$like':'%'+_0x1ca976[_0x27d0('0x43')]['filter']+'%'};return _0x1ff8fa;})});}_0x5043c8=_[_0x27d0('0x59')]({},_0x5043c8,_0x1ca976['options']);return _0x4432f3[_0x27d0('0xdc')](_0x5043c8);}})[_0x27d0('0x13')](function(_0x478499){if(_0x478499){_0x5ba2c4=_0x478499[_0x27d0('0x4d')];if(!_0x1ca976[_0x27d0('0x43')][_0x27d0('0xd6')](_0x27d0('0xd7'))){_0x5043c8[_0x27d0('0x24')]=qs[_0x27d0('0x24')](_0x1ca976[_0x27d0('0x43')]['limit']);_0x5043c8[_0x27d0('0x22')]=qs[_0x27d0('0x22')](_0x1ca976[_0x27d0('0x43')]['offset']);}return _0x4432f3[_0x27d0('0xdc')](_0x5043c8);}})[_0x27d0('0x13')](function(_0xf59abe){if(_0xf59abe){return _0xf59abe?{'count':_0x5ba2c4,'rows':_0xf59abe}:null;}})[_0x27d0('0x13')](respondWithResult(_0x50c07a,null))[_0x27d0('0x1d')](handleError(_0x50c07a,null));};exports['getGroups']=function(_0x356e96,_0x43bd37){var _0x57dd36={};var _0x348f8e={};var _0x5590e5;var _0x2648b8;return db[_0x27d0('0x42')][_0x27d0('0x98')]({'where':{'id':_0x356e96[_0x27d0('0x5e')]['id']}})[_0x27d0('0x13')](handleEntityNotFound(_0x43bd37,null))[_0x27d0('0x13')](function(_0x5a5fe8){if(_0x5a5fe8){_0x5590e5=_0x5a5fe8;_0x348f8e['model']=_['keys'](db[_0x27d0('0xdd')][_0x27d0('0x3a')]);_0x348f8e[_0x27d0('0x43')]=_[_0x27d0('0x54')](_0x356e96[_0x27d0('0x43')]);_0x348f8e[_0x27d0('0x56')]=_['intersection'](_0x348f8e[_0x27d0('0x53')],_0x348f8e[_0x27d0('0x43')]);_0x57dd36['attributes']=_[_0x27d0('0xce')](_0x348f8e[_0x27d0('0x53')],qs[_0x27d0('0x57')](_0x356e96['query'][_0x27d0('0x57')]));_0x57dd36[_0x27d0('0x48')]=_0x57dd36[_0x27d0('0x48')][_0x27d0('0x4d')]?_0x57dd36[_0x27d0('0x48')]:_0x348f8e[_0x27d0('0x53')];_0x57dd36[_0x27d0('0xcf')]=qs[_0x27d0('0xd0')](_0x356e96['query'][_0x27d0('0xd0')]);_0x57dd36[_0x27d0('0x41')]=qs[_0x27d0('0x56')](_[_0x27d0('0xd1')](_0x356e96[_0x27d0('0x43')],_0x348f8e[_0x27d0('0x56')]));if(_0x356e96[_0x27d0('0x43')][_0x27d0('0x3e')]){_0x57dd36[_0x27d0('0x41')]=_[_0x27d0('0x59')](_0x57dd36[_0x27d0('0x41')],{'$or':_['map'](_0x57dd36['attributes'],function(_0x1436f7){var _0x55e02c={};_0x55e02c[_0x1436f7]={'$like':'%'+_0x356e96[_0x27d0('0x43')][_0x27d0('0x3e')]+'%'};return _0x55e02c;})});}_0x57dd36=_['merge']({},_0x57dd36,_0x356e96[_0x27d0('0xda')]);return _0x5590e5[_0x27d0('0xde')](_0x57dd36);}})[_0x27d0('0x13')](function(_0x1fb70d){if(_0x1fb70d){_0x2648b8=_0x1fb70d['length'];if(!_0x356e96[_0x27d0('0x43')][_0x27d0('0xd6')](_0x27d0('0xd7'))){_0x57dd36[_0x27d0('0x24')]=qs[_0x27d0('0x24')](_0x356e96[_0x27d0('0x43')]['limit']);_0x57dd36[_0x27d0('0x22')]=qs[_0x27d0('0x22')](_0x356e96['query'][_0x27d0('0x22')]);}return _0x5590e5['getGroups'](_0x57dd36);}})[_0x27d0('0x13')](function(_0x7a2394){if(_0x7a2394){return _0x7a2394?{'count':_0x2648b8,'rows':_0x7a2394}:null;}})[_0x27d0('0x13')](respondWithResult(_0x43bd37,null))[_0x27d0('0x1d')](handleError(_0x43bd37,null));};exports[_0x27d0('0xdf')]=function(_0x2a3f9c,_0x40b994){var _0x549e68={'raw':!![],'where':{}};var _0x5f3b56={};var _0x3c8397={'count':0x0,'rows':[]};return db[_0x27d0('0x42')][_0x27d0('0x98')]({'where':{'id':_0x2a3f9c['params']['id']}})[_0x27d0('0x13')](handleEntityNotFound(_0x40b994,null))['then'](function(_0x4a748b){if(_0x4a748b){_0x5f3b56[_0x27d0('0x53')]=_['keys'](db[_0x27d0('0xe0')][_0x27d0('0x3a')]);_0x5f3b56[_0x27d0('0x43')]=_['keys'](_0x2a3f9c['query']);_0x5f3b56[_0x27d0('0x56')]=_[_0x27d0('0xce')](_0x5f3b56[_0x27d0('0x53')],_0x5f3b56[_0x27d0('0x43')]);_0x549e68[_0x27d0('0x48')]=_['intersection'](_0x5f3b56[_0x27d0('0x53')],qs[_0x27d0('0x57')](_0x2a3f9c[_0x27d0('0x43')][_0x27d0('0x57')]));_0x549e68[_0x27d0('0x48')]=_0x549e68[_0x27d0('0x48')][_0x27d0('0x4d')]?_0x549e68[_0x27d0('0x48')]:_0x5f3b56[_0x27d0('0x53')];if(!_0x2a3f9c[_0x27d0('0x43')][_0x27d0('0xd6')]('nolimit')){_0x549e68[_0x27d0('0x24')]=qs[_0x27d0('0x24')](_0x2a3f9c[_0x27d0('0x43')]['limit']);_0x549e68[_0x27d0('0x22')]=qs[_0x27d0('0x22')](_0x2a3f9c[_0x27d0('0x43')][_0x27d0('0x22')]);}_0x549e68['order']=qs[_0x27d0('0xd0')](_0x2a3f9c[_0x27d0('0x43')][_0x27d0('0xd0')]);_0x549e68[_0x27d0('0x41')]=qs[_0x27d0('0x56')](_['pick'](_0x2a3f9c[_0x27d0('0x43')],_0x5f3b56[_0x27d0('0x56')]));_0x549e68[_0x27d0('0x41')]['UserId']=_0x4a748b['id'];if(_0x2a3f9c[_0x27d0('0x43')][_0x27d0('0x3e')]){_0x549e68[_0x27d0('0x41')]=_[_0x27d0('0x59')](_0x549e68['where'],{'$or':_[_0x27d0('0x33')](_0x549e68[_0x27d0('0x48')],function(_0xe8304e){var _0x47be0d={};_0x47be0d[_0xe8304e]={'$like':'%'+_0x2a3f9c[_0x27d0('0x43')][_0x27d0('0x3e')]+'%'};return _0x47be0d;})});}_0x549e68=_[_0x27d0('0x59')]({},_0x549e68,_0x2a3f9c[_0x27d0('0xda')]);return db[_0x27d0('0xe0')][_0x27d0('0x25')]({'where':_0x549e68['where']})[_0x27d0('0x13')](function(_0x207349){_0x3c8397[_0x27d0('0x25')]=_0x207349;if(_0x2a3f9c[_0x27d0('0x43')][_0x27d0('0x44')]){_0x549e68[_0x27d0('0x45')]=[{'all':!![]}];}return db[_0x27d0('0xe0')][_0x27d0('0x4a')](_0x549e68);})[_0x27d0('0x13')](function(_0x31cce5){_0x3c8397[_0x27d0('0x4b')]=_0x31cce5;return _0x3c8397;});}})[_0x27d0('0x13')](respondWithFilteredResult(_0x40b994,_0x549e68))[_0x27d0('0x1d')](handleError(_0x40b994,null));};exports[_0x27d0('0xe1')]=function(_0x21b7c4,_0x10c416){var _0x27bbcb={'raw':!![],'where':{}};var _0x2c4d7e={};var _0x3dbef6={'count':0x0,'rows':[]};return db[_0x27d0('0x42')][_0x27d0('0x98')]({'where':{'id':_0x21b7c4['params']['id']}})[_0x27d0('0x13')](handleEntityNotFound(_0x10c416,null))[_0x27d0('0x13')](function(_0x1c59df){if(_0x1c59df){_0x2c4d7e['model']=_[_0x27d0('0x54')](db[_0x27d0('0xe2')][_0x27d0('0x3a')]);_0x2c4d7e[_0x27d0('0x43')]=_[_0x27d0('0x54')](_0x21b7c4[_0x27d0('0x43')]);_0x2c4d7e[_0x27d0('0x56')]=_[_0x27d0('0xce')](_0x2c4d7e[_0x27d0('0x53')],_0x2c4d7e[_0x27d0('0x43')]);_0x27bbcb[_0x27d0('0x48')]=_['intersection'](_0x2c4d7e[_0x27d0('0x53')],qs['fields'](_0x21b7c4['query'][_0x27d0('0x57')]));_0x27bbcb[_0x27d0('0x48')]=_0x27bbcb['attributes'][_0x27d0('0x4d')]?_0x27bbcb[_0x27d0('0x48')]:_0x2c4d7e[_0x27d0('0x53')];if(!_0x21b7c4[_0x27d0('0x43')]['hasOwnProperty'](_0x27d0('0xd7'))){_0x27bbcb[_0x27d0('0x24')]=qs[_0x27d0('0x24')](_0x21b7c4[_0x27d0('0x43')][_0x27d0('0x24')]);_0x27bbcb['offset']=qs[_0x27d0('0x22')](_0x21b7c4[_0x27d0('0x43')][_0x27d0('0x22')]);}_0x27bbcb['order']=qs['sort'](_0x21b7c4[_0x27d0('0x43')][_0x27d0('0xd0')]);_0x27bbcb[_0x27d0('0x41')]=qs['filters'](_[_0x27d0('0xd1')](_0x21b7c4[_0x27d0('0x43')],_0x2c4d7e[_0x27d0('0x56')]));_0x27bbcb[_0x27d0('0x41')]['UserId']=_0x1c59df['id'];if(_0x21b7c4[_0x27d0('0x43')][_0x27d0('0x3e')]){_0x27bbcb[_0x27d0('0x41')]=_[_0x27d0('0x59')](_0x27bbcb[_0x27d0('0x41')],{'$or':_[_0x27d0('0x33')](_0x27bbcb[_0x27d0('0x48')],function(_0x2b1e92){var _0x454f40={};_0x454f40[_0x2b1e92]={'$like':'%'+_0x21b7c4[_0x27d0('0x43')][_0x27d0('0x3e')]+'%'};return _0x454f40;})});}_0x27bbcb=_[_0x27d0('0x59')]({},_0x27bbcb,_0x21b7c4[_0x27d0('0xda')]);return db[_0x27d0('0xe2')][_0x27d0('0x25')]({'where':_0x27bbcb[_0x27d0('0x41')]})[_0x27d0('0x13')](function(_0x5b8a8b){_0x3dbef6['count']=_0x5b8a8b;if(_0x21b7c4[_0x27d0('0x43')][_0x27d0('0x44')]){_0x27bbcb[_0x27d0('0x45')]=[{'all':!![]}];}return db[_0x27d0('0xe2')][_0x27d0('0x4a')](_0x27bbcb);})['then'](function(_0x1482c0){_0x3dbef6['rows']=_0x1482c0;return _0x3dbef6;});}})[_0x27d0('0x13')](respondWithFilteredResult(_0x10c416,_0x27bbcb))['catch'](handleError(_0x10c416,null));};exports['getChatInteractions']=function(_0x13c999,_0x1864f1){var _0x229684={};var _0x56e9dd={};var _0x4c94b5;var _0x151fa6;return db[_0x27d0('0x42')]['findOne']({'where':{'id':_0x13c999['params']['id']}})[_0x27d0('0x13')](handleEntityNotFound(_0x1864f1,null))['then'](function(_0x16dffa){if(_0x16dffa){_0x4c94b5=_0x16dffa;_0x56e9dd[_0x27d0('0x53')]=_[_0x27d0('0x54')](db[_0x27d0('0xe3')][_0x27d0('0x3a')]);_0x56e9dd[_0x27d0('0x43')]=_['keys'](_0x13c999[_0x27d0('0x43')]);_0x56e9dd['filters']=_[_0x27d0('0xce')](_0x56e9dd[_0x27d0('0x53')],_0x56e9dd['query']);_0x229684[_0x27d0('0x48')]=_[_0x27d0('0xce')](_0x56e9dd[_0x27d0('0x53')],qs['fields'](_0x13c999[_0x27d0('0x43')][_0x27d0('0x57')]));_0x229684[_0x27d0('0x48')]=_0x229684[_0x27d0('0x48')][_0x27d0('0x4d')]?_0x229684['attributes']:_0x56e9dd[_0x27d0('0x53')];_0x229684[_0x27d0('0xcf')]=qs[_0x27d0('0xd0')](_0x13c999[_0x27d0('0x43')][_0x27d0('0xd0')]);_0x229684[_0x27d0('0x41')]=qs[_0x27d0('0x56')](_['pick'](_0x13c999['query'],_0x56e9dd[_0x27d0('0x56')]));if(_0x13c999[_0x27d0('0x43')]['filter']){_0x229684[_0x27d0('0x41')]=_['merge'](_0x229684['where'],{'$or':_[_0x27d0('0x33')](_0x229684['attributes'],function(_0x39329a){var _0x41bdaf={};_0x41bdaf[_0x39329a]={'$like':'%'+_0x13c999[_0x27d0('0x43')]['filter']+'%'};return _0x41bdaf;})});}_0x229684=_[_0x27d0('0x59')]({},_0x229684,_0x13c999[_0x27d0('0xda')]);return _0x4c94b5['getChatInteractions'](_0x229684);}})[_0x27d0('0x13')](function(_0x466569){if(_0x466569){_0x151fa6=_0x466569[_0x27d0('0x4d')];if(!_0x13c999[_0x27d0('0x43')][_0x27d0('0xd6')](_0x27d0('0xd7'))){_0x229684[_0x27d0('0x24')]=qs[_0x27d0('0x24')](_0x13c999['query'][_0x27d0('0x24')]);_0x229684[_0x27d0('0x22')]=qs[_0x27d0('0x22')](_0x13c999['query']['offset']);}return _0x4c94b5[_0x27d0('0xe4')](_0x229684);}})[_0x27d0('0x13')](function(_0x41b658){if(_0x41b658){return _0x41b658?{'count':_0x151fa6,'rows':_0x41b658}:null;}})[_0x27d0('0x13')](respondWithResult(_0x1864f1,null))[_0x27d0('0x1d')](handleError(_0x1864f1,null));};exports[_0x27d0('0xe5')]=function(_0x1081e7,_0x34f527){var _0x394698={};var _0x38a1dc={};var _0x2c7eb4;var _0xf17a56;return db[_0x27d0('0x42')]['findOne']({'where':{'id':_0x1081e7['params']['id']}})[_0x27d0('0x13')](handleEntityNotFound(_0x34f527,null))[_0x27d0('0x13')](function(_0x764dd0){if(_0x764dd0){_0x2c7eb4=_0x764dd0;_0x38a1dc['model']=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x38a1dc[_0x27d0('0x43')]=_['keys'](_0x1081e7[_0x27d0('0x43')]);_0x38a1dc['filters']=_[_0x27d0('0xce')](_0x38a1dc[_0x27d0('0x53')],_0x38a1dc[_0x27d0('0x43')]);_0x394698[_0x27d0('0x48')]=_[_0x27d0('0xce')](_0x38a1dc[_0x27d0('0x53')],qs['fields'](_0x1081e7[_0x27d0('0x43')][_0x27d0('0x57')]));_0x394698[_0x27d0('0x48')]=_0x394698[_0x27d0('0x48')][_0x27d0('0x4d')]?_0x394698[_0x27d0('0x48')]:_0x38a1dc[_0x27d0('0x53')];_0x394698['order']=qs['sort'](_0x1081e7['query'][_0x27d0('0xd0')]);_0x394698[_0x27d0('0x41')]=qs['filters'](_['pick'](_0x1081e7[_0x27d0('0x43')],_0x38a1dc[_0x27d0('0x56')]));if(_0x1081e7['query']['filter']){_0x394698[_0x27d0('0x41')]=_[_0x27d0('0x59')](_0x394698[_0x27d0('0x41')],{'$or':_['map'](_0x394698[_0x27d0('0x48')],function(_0x3635ef){var _0x1165b7={};_0x1165b7[_0x3635ef]={'$like':'%'+_0x1081e7[_0x27d0('0x43')][_0x27d0('0x3e')]+'%'};return _0x1165b7;})});}_0x394698=_[_0x27d0('0x59')]({},_0x394698,_0x1081e7[_0x27d0('0xda')]);return _0x2c7eb4[_0x27d0('0xe5')](_0x394698);}})[_0x27d0('0x13')](function(_0x386147){if(_0x386147){_0xf17a56=_0x386147[_0x27d0('0x4d')];if(!_0x1081e7[_0x27d0('0x43')]['hasOwnProperty'](_0x27d0('0xd7'))){_0x394698[_0x27d0('0x24')]=qs['limit'](_0x1081e7['query'][_0x27d0('0x24')]);_0x394698[_0x27d0('0x22')]=qs[_0x27d0('0x22')](_0x1081e7[_0x27d0('0x43')]['offset']);}return _0x2c7eb4[_0x27d0('0xe5')](_0x394698);}})['then'](function(_0x58e5ef){if(_0x58e5ef){return _0x58e5ef?{'count':_0xf17a56,'rows':_0x58e5ef}:null;}})[_0x27d0('0x13')](respondWithResult(_0x34f527,null))[_0x27d0('0x1d')](handleError(_0x34f527,null));};exports[_0x27d0('0xe6')]=function(_0x5068bb,_0x768d56){var _0x3bb55b={'raw':!![],'where':{}};var _0x38e025={};var _0x1f9f5d={'count':0x0,'rows':[]};return db[_0x27d0('0x42')][_0x27d0('0x98')]({'where':{'id':_0x5068bb[_0x27d0('0x5e')]['id']}})[_0x27d0('0x13')](handleEntityNotFound(_0x768d56,null))[_0x27d0('0x13')](function(_0x5a6014){if(_0x5a6014){_0x38e025['model']=_[_0x27d0('0x54')](db[_0x27d0('0xe7')][_0x27d0('0x3a')]);_0x38e025[_0x27d0('0x43')]=_[_0x27d0('0x54')](_0x5068bb['query']);_0x38e025[_0x27d0('0x56')]=_[_0x27d0('0xce')](_0x38e025[_0x27d0('0x53')],_0x38e025['query']);_0x3bb55b[_0x27d0('0x48')]=_['intersection'](_0x38e025[_0x27d0('0x53')],qs['fields'](_0x5068bb[_0x27d0('0x43')][_0x27d0('0x57')]));_0x3bb55b[_0x27d0('0x48')]=_0x3bb55b[_0x27d0('0x48')][_0x27d0('0x4d')]?_0x3bb55b['attributes']:_0x38e025[_0x27d0('0x53')];if(!_0x5068bb[_0x27d0('0x43')][_0x27d0('0xd6')](_0x27d0('0xd7'))){_0x3bb55b[_0x27d0('0x24')]=qs[_0x27d0('0x24')](_0x5068bb[_0x27d0('0x43')]['limit']);_0x3bb55b[_0x27d0('0x22')]=qs[_0x27d0('0x22')](_0x5068bb[_0x27d0('0x43')][_0x27d0('0x22')]);}_0x3bb55b[_0x27d0('0xcf')]=qs[_0x27d0('0xd0')](_0x5068bb[_0x27d0('0x43')][_0x27d0('0xd0')]);_0x3bb55b['where']=qs[_0x27d0('0x56')](_['pick'](_0x5068bb[_0x27d0('0x43')],_0x38e025[_0x27d0('0x56')]));_0x3bb55b['where'][_0x27d0('0xe8')]=_0x5a6014['id'];if(_0x5068bb[_0x27d0('0x43')][_0x27d0('0x3e')]){_0x3bb55b['where']=_[_0x27d0('0x59')](_0x3bb55b[_0x27d0('0x41')],{'$or':_[_0x27d0('0x33')](_0x3bb55b[_0x27d0('0x48')],function(_0x4e82d9){var _0x3b61af={};_0x3b61af[_0x4e82d9]={'$like':'%'+_0x5068bb[_0x27d0('0x43')][_0x27d0('0x3e')]+'%'};return _0x3b61af;})});}_0x3bb55b=_[_0x27d0('0x59')]({},_0x3bb55b,_0x5068bb[_0x27d0('0xda')]);return db[_0x27d0('0xe7')]['count']({'where':_0x3bb55b[_0x27d0('0x41')]})[_0x27d0('0x13')](function(_0x47fd0a){_0x1f9f5d['count']=_0x47fd0a;if(_0x5068bb[_0x27d0('0x43')]['includeAll']){_0x3bb55b['include']=[{'all':!![]}];}return db[_0x27d0('0xe7')][_0x27d0('0x4a')](_0x3bb55b);})[_0x27d0('0x13')](function(_0x4c2d38){_0x1f9f5d[_0x27d0('0x4b')]=_0x4c2d38;return _0x1f9f5d;});}})[_0x27d0('0x13')](respondWithFilteredResult(_0x768d56,_0x3bb55b))[_0x27d0('0x1d')](handleError(_0x768d56,null));};exports[_0x27d0('0xe9')]=function(_0x5973b2,_0x32f4a6){var _0x34efbd={};var _0x3be781={};var _0x2fa6df;var _0x2ab8a3;return db[_0x27d0('0x42')][_0x27d0('0x98')]({'where':{'id':_0x5973b2[_0x27d0('0x5e')]['id']}})[_0x27d0('0x13')](handleEntityNotFound(_0x32f4a6,null))[_0x27d0('0x13')](function(_0x52fc0f){if(_0x52fc0f){_0x2fa6df=_0x52fc0f;_0x3be781[_0x27d0('0x53')]=_[_0x27d0('0x54')](db[_0x27d0('0xea')]['rawAttributes']);_0x3be781[_0x27d0('0x43')]=_['keys'](_0x5973b2[_0x27d0('0x43')]);_0x3be781[_0x27d0('0x56')]=_['intersection'](_0x3be781[_0x27d0('0x53')],_0x3be781[_0x27d0('0x43')]);_0x34efbd[_0x27d0('0x48')]=_[_0x27d0('0xce')](_0x3be781[_0x27d0('0x53')],qs[_0x27d0('0x57')](_0x5973b2[_0x27d0('0x43')][_0x27d0('0x57')]));_0x34efbd[_0x27d0('0x48')]=_0x34efbd['attributes'][_0x27d0('0x4d')]?_0x34efbd[_0x27d0('0x48')]:_0x3be781[_0x27d0('0x53')];_0x34efbd[_0x27d0('0xcf')]=qs[_0x27d0('0xd0')](_0x5973b2[_0x27d0('0x43')][_0x27d0('0xd0')]);_0x34efbd['where']=qs[_0x27d0('0x56')](_[_0x27d0('0xd1')](_0x5973b2[_0x27d0('0x43')],_0x3be781[_0x27d0('0x56')]));if(_0x5973b2['query'][_0x27d0('0x3e')]){_0x34efbd['where']=_['merge'](_0x34efbd[_0x27d0('0x41')],{'$or':_[_0x27d0('0x33')](_0x34efbd[_0x27d0('0x48')],function(_0x308738){var _0xe0e4b8={};_0xe0e4b8[_0x308738]={'$like':'%'+_0x5973b2['query'][_0x27d0('0x3e')]+'%'};return _0xe0e4b8;})});}_0x34efbd=_['merge']({},_0x34efbd,_0x5973b2[_0x27d0('0xda')]);return _0x2fa6df[_0x27d0('0xe9')](_0x34efbd);}})['then'](function(_0x469ce4){if(_0x469ce4){_0x2ab8a3=_0x469ce4[_0x27d0('0x4d')];if(!_0x5973b2[_0x27d0('0x43')][_0x27d0('0xd6')](_0x27d0('0xd7'))){_0x34efbd[_0x27d0('0x24')]=qs[_0x27d0('0x24')](_0x5973b2[_0x27d0('0x43')][_0x27d0('0x24')]);_0x34efbd[_0x27d0('0x22')]=qs[_0x27d0('0x22')](_0x5973b2[_0x27d0('0x43')][_0x27d0('0x22')]);}return _0x2fa6df[_0x27d0('0xe9')](_0x34efbd);}})[_0x27d0('0x13')](function(_0x141b1c){if(_0x141b1c){return _0x141b1c?{'count':_0x2ab8a3,'rows':_0x141b1c}:null;}})[_0x27d0('0x13')](respondWithResult(_0x32f4a6,null))[_0x27d0('0x1d')](handleError(_0x32f4a6,null));};exports[_0x27d0('0xeb')]=function(_0x3c2ad2,_0x3e9049){var _0x17c7c7={};var _0x393f79={};var _0x14cdc6;var _0x6ca4ef;return db[_0x27d0('0x42')][_0x27d0('0x98')]({'where':{'id':_0x3c2ad2[_0x27d0('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3e9049,null))[_0x27d0('0x13')](function(_0x522bf1){if(_0x522bf1){_0x14cdc6=_0x522bf1;_0x393f79[_0x27d0('0x53')]=_[_0x27d0('0x54')](db[_0x27d0('0xec')][_0x27d0('0x3a')]);_0x393f79[_0x27d0('0x43')]=_[_0x27d0('0x54')](_0x3c2ad2['query']);_0x393f79['filters']=_[_0x27d0('0xce')](_0x393f79[_0x27d0('0x53')],_0x393f79[_0x27d0('0x43')]);_0x17c7c7['attributes']=_['intersection'](_0x393f79[_0x27d0('0x53')],qs[_0x27d0('0x57')](_0x3c2ad2[_0x27d0('0x43')][_0x27d0('0x57')]));_0x17c7c7['attributes']=_0x17c7c7[_0x27d0('0x48')][_0x27d0('0x4d')]?_0x17c7c7['attributes']:_0x393f79[_0x27d0('0x53')];_0x17c7c7['order']=qs[_0x27d0('0xd0')](_0x3c2ad2[_0x27d0('0x43')][_0x27d0('0xd0')]);_0x17c7c7['where']=qs[_0x27d0('0x56')](_[_0x27d0('0xd1')](_0x3c2ad2['query'],_0x393f79[_0x27d0('0x56')]));if(_0x3c2ad2['query'][_0x27d0('0x3e')]){_0x17c7c7[_0x27d0('0x41')]=_[_0x27d0('0x59')](_0x17c7c7[_0x27d0('0x41')],{'$or':_[_0x27d0('0x33')](_0x17c7c7[_0x27d0('0x48')],function(_0x5cc905){var _0x2cade2={};_0x2cade2[_0x5cc905]={'$like':'%'+_0x3c2ad2[_0x27d0('0x43')]['filter']+'%'};return _0x2cade2;})});}_0x17c7c7=_['merge']({},_0x17c7c7,_0x3c2ad2[_0x27d0('0xda')]);return _0x14cdc6[_0x27d0('0xeb')](_0x17c7c7);}})[_0x27d0('0x13')](function(_0x52e508){if(_0x52e508){_0x6ca4ef=_0x52e508[_0x27d0('0x4d')];if(!_0x3c2ad2[_0x27d0('0x43')][_0x27d0('0xd6')](_0x27d0('0xd7'))){_0x17c7c7[_0x27d0('0x24')]=qs[_0x27d0('0x24')](_0x3c2ad2[_0x27d0('0x43')][_0x27d0('0x24')]);_0x17c7c7['offset']=qs[_0x27d0('0x22')](_0x3c2ad2['query']['offset']);}return _0x14cdc6['getFaxInteractions'](_0x17c7c7);}})[_0x27d0('0x13')](function(_0x43218f){if(_0x43218f){return _0x43218f?{'count':_0x6ca4ef,'rows':_0x43218f}:null;}})[_0x27d0('0x13')](respondWithResult(_0x3e9049,null))['catch'](handleError(_0x3e9049,null));};exports[_0x27d0('0xed')]=function(_0x106e57,_0x2aba4d){var _0x47bbed={};var _0x418faf={};var _0x5ced7f;var _0x13a335;return db[_0x27d0('0x42')][_0x27d0('0x98')]({'where':{'id':_0x106e57[_0x27d0('0x5e')]['id']}})[_0x27d0('0x13')](handleEntityNotFound(_0x2aba4d,null))[_0x27d0('0x13')](function(_0x154475){if(_0x154475){_0x5ced7f=_0x154475;_0x418faf[_0x27d0('0x53')]=_['keys'](db[_0x27d0('0xee')][_0x27d0('0x3a')]);_0x418faf[_0x27d0('0x43')]=_[_0x27d0('0x54')](_0x106e57[_0x27d0('0x43')]);_0x418faf[_0x27d0('0x56')]=_[_0x27d0('0xce')](_0x418faf[_0x27d0('0x53')],_0x418faf[_0x27d0('0x43')]);_0x47bbed[_0x27d0('0x48')]=_[_0x27d0('0xce')](_0x418faf[_0x27d0('0x53')],qs[_0x27d0('0x57')](_0x106e57['query'][_0x27d0('0x57')]));_0x47bbed[_0x27d0('0x48')]=_0x47bbed[_0x27d0('0x48')][_0x27d0('0x4d')]?_0x47bbed[_0x27d0('0x48')]:_0x418faf['model'];_0x47bbed[_0x27d0('0xcf')]=qs[_0x27d0('0xd0')](_0x106e57[_0x27d0('0x43')][_0x27d0('0xd0')]);_0x47bbed['where']=qs[_0x27d0('0x56')](_[_0x27d0('0xd1')](_0x106e57[_0x27d0('0x43')],_0x418faf[_0x27d0('0x56')]));if(_0x106e57[_0x27d0('0x43')][_0x27d0('0x3e')]){_0x47bbed[_0x27d0('0x41')]=_['merge'](_0x47bbed[_0x27d0('0x41')],{'$or':_[_0x27d0('0x33')](_0x47bbed[_0x27d0('0x48')],function(_0x27bf8c){var _0x2f98f0={};_0x2f98f0[_0x27bf8c]={'$like':'%'+_0x106e57[_0x27d0('0x43')][_0x27d0('0x3e')]+'%'};return _0x2f98f0;})});}_0x47bbed=_[_0x27d0('0x59')]({},_0x47bbed,_0x106e57[_0x27d0('0xda')]);return _0x5ced7f[_0x27d0('0xed')](_0x47bbed);}})[_0x27d0('0x13')](function(_0x33fb68){if(_0x33fb68){_0x13a335=_0x33fb68[_0x27d0('0x4d')];if(!_0x106e57[_0x27d0('0x43')][_0x27d0('0xd6')](_0x27d0('0xd7'))){_0x47bbed['limit']=qs[_0x27d0('0x24')](_0x106e57[_0x27d0('0x43')][_0x27d0('0x24')]);_0x47bbed[_0x27d0('0x22')]=qs[_0x27d0('0x22')](_0x106e57[_0x27d0('0x43')][_0x27d0('0x22')]);}return _0x5ced7f[_0x27d0('0xed')](_0x47bbed);}})[_0x27d0('0x13')](function(_0x36fa44){if(_0x36fa44){return _0x36fa44?{'count':_0x13a335,'rows':_0x36fa44}:null;}})[_0x27d0('0x13')](respondWithResult(_0x2aba4d,null))['catch'](handleError(_0x2aba4d,null));};exports['login']=function(_0x2d26fa,_0xd8d035,_0x3c15f4){var _0x3464bc;var _0x3168f1;var _0x4cdeb8;var _0x447652=!_[_0x27d0('0x68')](_0x2d26fa[_0x27d0('0x5e')]['id'])?_0x2d26fa[_0x27d0('0x5e')]['id']:!_[_0x27d0('0x68')](_0x2d26fa[_0x27d0('0x2e')]['id'])?_0x2d26fa[_0x27d0('0x2e')]['id']:null;return db['User'][_0x27d0('0x5a')]({'where':{'id':_0x447652,'role':{'$or':[_0x27d0('0x2c'),_0x27d0('0x2e'),_0x27d0('0x2f')]}},'attributes':['id',_0x27d0('0x36'),_0x27d0('0xef'),'mobile',_0x27d0('0x2b'),_0x27d0('0x6a'),_0x27d0('0x9e')]})[_0x27d0('0x13')](function(_0x1b4bfd){if(_0x1b4bfd){if(_0x1b4bfd[_0x27d0('0x2b')]===_0x27d0('0x2f')){_0x3464bc=_0x1b4bfd;if(_0x2d26fa[_0x27d0('0x5d')]['interface']){_0x4cdeb8=util[_0x27d0('0xac')](_0x27d0('0xf0'),_0x3464bc[_0x2d26fa[_0x27d0('0x5d')]['interface']]);}else if(_0x2d26fa[_0x27d0('0x5d')][_0x27d0('0xf1')]){_0x4cdeb8=util[_0x27d0('0xac')]('SIP/%s',_0x2d26fa[_0x27d0('0x5d')][_0x27d0('0xf1')]);}else{_0x4cdeb8=util['format']('SIP/%s',_0x3464bc[_0x27d0('0x36')]);}socket['to'](util[_0x27d0('0xac')](_0x27d0('0xf2'),_0x3464bc[_0x27d0('0x36')]))['emit'](_0x27d0('0xf3'),{'user':{'id':_0x3464bc['id'],'name':_0x3464bc[_0x27d0('0x36')]},'ip':_0x2d26fa[_0x27d0('0xf4')]['x-forwarded-for']||_0x2d26fa[_0x27d0('0xf5')][_0x27d0('0xf6')]||_0x2d26fa[_0x27d0('0xf7')][_0x27d0('0xf6')]||_0x2d26fa[_0x27d0('0xf5')][_0x27d0('0xf7')]['remoteAddress']});return db[_0x27d0('0xae')][_0x27d0('0x29')]({'where':{'membername':_0x3464bc[_0x27d0('0x36')]},'individualHooks':!![]});}}else{throw new db[(_0x27d0('0x91'))][(_0x27d0('0x92'))](_0x27d0('0xf8'));}})[_0x27d0('0x13')](function(){if(_0x3464bc){return _0x3464bc[_0x27d0('0xf9')]({'raw':!![]});}})['then'](function(_0x2c976a){if(_0x3464bc){if(_0x2c976a){_0x3168f1=_0x2c976a;if(_0x3168f1['length']){var _0x3147a5=_0x3168f1[_0x27d0('0x33')](function(_0x4238d7){var _0x39dd2e={'membername':_0x3464bc['name'],'UserId':_0x3464bc['id'],'queue_name':_0x4238d7[_0x27d0('0x36')],'VoiceQueueId':_0x4238d7['id'],'interface':_0x4cdeb8,'paused':_0x3464bc[_0x27d0('0x9e')]||![],'penalty':_0x4238d7['UserVoiceQueue.penalty']||0x0};return db['UserVoiceQueueRt'][_0x27d0('0xaf')](_0x39dd2e);});return Promise[_0x27d0('0x8c')](_0x3147a5);}}}})[_0x27d0('0x13')](function(){if(_0x3464bc){return db['MemberReport'][_0x27d0('0x4a')]({'where':{'membername':_0x3464bc[_0x27d0('0x36')],'exitAt':null}});}})[_0x27d0('0x13')](function(_0x37bcdb){if(_0x3464bc){var _0x1d5e0f=[];_0x37bcdb['forEach'](function(_0x203d9b){_0x1d5e0f['push'](_0x203d9b[_0x27d0('0x27')]({'exitAt':moment()['format'](_0x27d0('0xfa'))}));});return Promise['all'](_0x1d5e0f);}})[_0x27d0('0x13')](function(){if(_0x3464bc){var _0x21d709=[];var _0xdb27b7=[];var _0x1dd0fc=utils['getChannels']();var _0x482730={'membername':_0x3464bc[_0x27d0('0x36')],'interface':_0x4cdeb8,'enterAt':moment()[_0x27d0('0xac')](_0x27d0('0xfa')),'role':_0x3464bc[_0x27d0('0x2b')],'internal':_0x3464bc[_0x27d0('0x6a')]};_0x1dd0fc[_0x27d0('0xfb')](function(_0x2923d8){_0x21d709[_0x27d0('0x49')](_['merge']({'channel':_0x2923d8,'type':_0x27d0('0xfc'),'data1':_0x2d26fa[_0x27d0('0x5d')][_0x27d0('0xfd')],'data2':_0x4cdeb8},_0x482730));if(_0x3464bc[_0x27d0('0x9e')]){_0xdb27b7['push'](_[_0x27d0('0x59')]({'channel':_0x2923d8,'type':_0x27d0('0xfe'),'data1':_0x27d0('0xff')},_0x482730));}});return db[_0x27d0('0x100')][_0x27d0('0x89')](_0x21d709[_0x27d0('0xcc')](_0xdb27b7),{'individualHooks':!![]});}})[_0x27d0('0x13')](function(){if(_0x3464bc){return _0x3464bc[_0x27d0('0x27')]({'online':!![],'lastLoginAt':moment()[_0x27d0('0xac')](_0x27d0('0xfa')),'voicePause':_0x3464bc[_0x27d0('0x9e')]||![],'mailPause':_0x3464bc[_0x27d0('0x9e')]||![],'chatPause':_0x3464bc[_0x27d0('0x9e')]||![],'faxPause':_0x3464bc['loginInPause']||![],'smsPause':_0x3464bc[_0x27d0('0x9e')]||![],'openchannelPause':_0x3464bc[_0x27d0('0x9e')]||![],'whatsappPause':_0x3464bc['loginInPause']||![],'pauseType':_0x3464bc[_0x27d0('0x9e')]?_0x27d0('0xff'):null,'interface':_0x4cdeb8,'lastPauseAt':moment()['format'](_0x27d0('0xfa'))});}})[_0x27d0('0x13')](function(_0x2d828a){if(_0x2d26fa['isMiddleware']){return _0x3c15f4();}else{return Promise[_0x27d0('0x101')](_0x2d828a)[_0x27d0('0x13')](respondWithResult(_0xd8d035,null));}})['catch'](handleError(_0xd8d035,null));};exports[_0x27d0('0x102')]=function(_0x340dba,_0x31326c){var _0xb666a6;return db[_0x27d0('0x42')]['find']({'where':{'id':_0x340dba[_0x27d0('0x5e')]['id'],'role':'agent'},'attributes':['id','name','role']})[_0x27d0('0x13')](handleEntityNotFound(_0x31326c,null))[_0x27d0('0x13')](function(_0x238484){if(_0x238484){_0xb666a6=_0x238484;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0xb666a6[_0x27d0('0x36')]},'individualHooks':!![]});}})[_0x27d0('0x13')](function(){return db[_0x27d0('0x100')][_0x27d0('0x4a')]({'where':{'membername':_0xb666a6[_0x27d0('0x36')],'exitAt':null}});})[_0x27d0('0x13')](function(_0x3bee90){var _0x455bca=[];_0x3bee90[_0x27d0('0xfb')](function(_0x39550d){_0x455bca['push'](_0x39550d[_0x27d0('0x27')]({'exitAt':moment()[_0x27d0('0xac')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x27d0('0x8c')](_0x455bca);})[_0x27d0('0x13')](function(){return _0xb666a6[_0x27d0('0x27')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x27d0('0x13')](respondWithResult(_0x31326c,null))[_0x27d0('0x1d')](handleError(_0x31326c,null));};exports[_0x27d0('0x103')]=function(_0x2f3aa8,_0x36394d){var _0xe1d4da;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x2f3aa8[_0x27d0('0x5e')]['id']},'individualHooks':!![]})[_0x27d0('0x13')](function(){return db[_0x27d0('0x42')][_0x27d0('0x5a')]({'where':{'id':_0x2f3aa8[_0x27d0('0x5e')]['id'],'role':_0x27d0('0x2f')},'attributes':['id',_0x27d0('0x36'),_0x27d0('0x2b'),_0x27d0('0x6a'),'interface',_0x27d0('0xab')]});})[_0x27d0('0x13')](handleEntityNotFound(_0x36394d,null))[_0x27d0('0x13')](function(_0x11ac48){if(_0x11ac48){_0xe1d4da=_0x11ac48;return respondWithRpcPromise('QueuePause',_0x27d0('0x103'),{'id':_0xe1d4da['id'],'name':_0xe1d4da['name'],'pause':!![]});}})['then'](function(){if(_0xe1d4da){return db[_0x27d0('0x100')]['findAll']({'where':{'membername':_0xe1d4da[_0x27d0('0x36')],'type':_0x27d0('0xfe'),'exitAt':null}});}})[_0x27d0('0x13')](function(_0x1bb1fb){if(_0x1bb1fb['length']){var _0x4c5a69=moment()[_0x27d0('0xac')](_0x27d0('0xfa'));for(var _0x5ba9f0=0x0,_0x44102f=_0x1bb1fb[_0x27d0('0x4d')];_0x5ba9f0<_0x44102f;_0x5ba9f0++){_0x1bb1fb[_0x5ba9f0][_0x27d0('0x104')]({'exitAt':_0x4c5a69});}}})['then'](function(){var _0xa017bd=[];var _0x2f38d6=utils[_0x27d0('0x105')]();_0x2f38d6[_0x27d0('0xfb')](function(_0x45fdc1){_0xa017bd[_0x27d0('0x49')]({'channel':_0x45fdc1,'membername':_0xe1d4da[_0x27d0('0x36')],'interface':_[_0x27d0('0x68')](_0xe1d4da['interface'])?util[_0x27d0('0xac')](_0x27d0('0xad'),_0xe1d4da[_0x27d0('0x36')]):_0xe1d4da[_0x27d0('0xa0')],'type':'PAUSE','enterAt':moment()[_0x27d0('0xac')](_0x27d0('0xfa')),'data1':_0x2f3aa8[_0x27d0('0x5d')][_0x27d0('0x3c')]||_0x27d0('0x106'),'role':_0xe1d4da['role'],'internal':_0xe1d4da[_0x27d0('0x6a')]});});return db['MemberReport'][_0x27d0('0x89')](_0xa017bd,{'individualHooks':!![]});})[_0x27d0('0x13')](function(){return _0xe1d4da[_0x27d0('0x27')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2f3aa8[_0x27d0('0x5d')][_0x27d0('0x3c')]||_0x27d0('0x106'),'lastPauseAt':moment()['format'](_0x27d0('0xfa'))});})[_0x27d0('0x13')](respondWithResult(_0x36394d,null))['catch'](handleError(_0x36394d,null));};exports['unpause']=function(_0x3ecc16,_0x57f95a){if(_0x3ecc16['body']['channel']&&!utils[_0x27d0('0xb1')](_0x3ecc16[_0x27d0('0x5d')][_0x27d0('0xb2')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x3ecc16[_0x27d0('0x5d')]['channel']));}return db[_0x27d0('0x42')]['find']({'where':{'id':_0x3ecc16['params']['id']},'attributes':['id',_0x27d0('0x36'),'role',_0x27d0('0x6a'),_0x27d0('0xa0'),'online','voicePause',_0x27d0('0x107'),_0x27d0('0x108'),_0x27d0('0x109'),_0x27d0('0x10a'),_0x27d0('0x10b'),_0x27d0('0x10c'),_0x27d0('0x10d'),_0x27d0('0x10e')]})[_0x27d0('0x13')](function(_0x5e8c08){if(!_0x5e8c08){throw new APINotFoundError(util[_0x27d0('0xac')](_0x27d0('0x10f'),_0x3ecc16[_0x27d0('0x5e')]['id']));}return _0x5e8c08[_0x27d0('0x110')](_0x3ecc16[_0x27d0('0x5d')]['channel']);})[_0x27d0('0x13')](respondWithResult(_0x57f95a,null))[_0x27d0('0x1d')](APIHandleError(_0x57f95a));};exports[_0x27d0('0x111')]=function(_0x4408d3,_0x3b21b0){var _0x16773f={};var _0xd14cd8={};var _0x4f2e7d;var _0x52aeab;return db['User']['findOne']({'where':{'id':_0x4408d3[_0x27d0('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3b21b0,null))[_0x27d0('0x13')](function(_0x4464c2){if(_0x4464c2){_0x4f2e7d=_0x4464c2;_0xd14cd8[_0x27d0('0x53')]=_[_0x27d0('0x54')](db['Team'][_0x27d0('0x3a')]);_0xd14cd8[_0x27d0('0x43')]=_['keys'](_0x4408d3[_0x27d0('0x43')]);_0xd14cd8[_0x27d0('0x56')]=_[_0x27d0('0xce')](_0xd14cd8[_0x27d0('0x53')],_0xd14cd8[_0x27d0('0x43')]);_0x16773f[_0x27d0('0x48')]=_[_0x27d0('0xce')](_0xd14cd8[_0x27d0('0x53')],qs['fields'](_0x4408d3[_0x27d0('0x43')]['fields']));_0x16773f[_0x27d0('0x48')]=_0x16773f['attributes'][_0x27d0('0x4d')]?_0x16773f[_0x27d0('0x48')]:_0xd14cd8[_0x27d0('0x53')];_0x16773f[_0x27d0('0xcf')]=qs['sort'](_0x4408d3[_0x27d0('0x43')][_0x27d0('0xd0')]);_0x16773f[_0x27d0('0x41')]=qs[_0x27d0('0x56')](_['pick'](_0x4408d3['query'],_0xd14cd8[_0x27d0('0x56')]));if(_0x4408d3[_0x27d0('0x43')][_0x27d0('0x3e')]){_0x16773f['where']=_[_0x27d0('0x59')](_0x16773f[_0x27d0('0x41')],{'$or':_[_0x27d0('0x33')](_0x16773f[_0x27d0('0x48')],function(_0x126cfe){var _0x3e9897={};_0x3e9897[_0x126cfe]={'$like':'%'+_0x4408d3['query']['filter']+'%'};return _0x3e9897;})});}_0x16773f=_[_0x27d0('0x59')]({},_0x16773f,_0x4408d3[_0x27d0('0xda')]);return _0x4f2e7d[_0x27d0('0x111')](_0x16773f);}})[_0x27d0('0x13')](function(_0x5c8943){if(_0x5c8943){_0x52aeab=_0x5c8943[_0x27d0('0x4d')];if(!_0x4408d3[_0x27d0('0x43')][_0x27d0('0xd6')]('nolimit')){_0x16773f['limit']=qs['limit'](_0x4408d3[_0x27d0('0x43')][_0x27d0('0x24')]);_0x16773f[_0x27d0('0x22')]=qs['offset'](_0x4408d3[_0x27d0('0x43')][_0x27d0('0x22')]);}return _0x4f2e7d['getTeams'](_0x16773f);}})[_0x27d0('0x13')](function(_0x3aa333){if(_0x3aa333){return _0x3aa333?{'count':_0x52aeab,'rows':_0x3aa333}:null;}})[_0x27d0('0x13')](respondWithResult(_0x3b21b0,null))['catch'](handleError(_0x3b21b0,null));};exports[_0x27d0('0x112')]=function(_0x4b4ffe,_0x12d2cb){var _0x3aed1d=_0x4b4ffe[_0x27d0('0x5e')]['id'];var _0x2c1663=_0x4b4ffe['body']?_0x4b4ffe['body'][_0x27d0('0x61')]:null;var _0x5a8a1d=[];return Promise['resolve']()['then'](function(){if(!_0x2c1663)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x27d0('0x13')](function(){return db[_0x27d0('0x42')][_0x27d0('0x98')]({'where':{'id':_0x3aed1d}});})[_0x27d0('0x13')](function(_0x52b879){if(!_0x52b879)throw new APINotFoundError(util['format'](_0x27d0('0x10f'),_0x4b4ffe[_0x27d0('0x5e')]['id']));return db[_0x27d0('0x6c')][_0x27d0('0x113')](function(_0x4b0b13){return _0x52b879[_0x27d0('0x112')](_0x2c1663,{'transaction':_0x4b0b13})[_0x27d0('0x13')](function(){return db[_0x27d0('0x114')][_0x27d0('0x4a')]({'where':{'id':{'$in':_0x2c1663}}});})[_0x27d0('0x13')](function(_0x2d3d55){var _0x4a214e=_['map'](_0x2d3d55,function(_0x282cd8){return _0x282cd8[_0x27d0('0x115')]();});return Promise['all'](_0x4a214e);})['then'](function(_0x284a1e){_0x5a8a1d=_[_0x27d0('0x116')](_0x284a1e);var _0xe72687=_[_0x27d0('0x33')](_0x5a8a1d,function(_0x239d76){return _0x239d76[_0x27d0('0x117')](_0x52b879['id'],{'transaction':_0x4b0b13});});return Promise['all'](_0xe72687);})[_0x27d0('0x13')](function(){if(!_0x52b879[_0x27d0('0xab')])return;var _0x1879c4=_['filter'](_0x5a8a1d,function(_0x5c1868){return _0x5c1868[_0x27d0('0x118')](_0x27d0('0xb2'))===_0x27d0('0x119');});var _0x2c4e6e=_[_0x27d0('0x33')](_0x1879c4,function(_0x1fa63e){return db['UserVoiceQueueRt'][_0x27d0('0xaf')]({'membername':_0x52b879[_0x27d0('0x36')],'UserId':_0x52b879['id'],'queue_name':_0x1fa63e[_0x27d0('0x36')],'VoiceQueueId':_0x1fa63e['id'],'interface':_[_0x27d0('0x68')](_0x52b879[_0x27d0('0xa0')])?util[_0x27d0('0xac')](_0x27d0('0xad'),_0x52b879[_0x27d0('0x36')]):_0x52b879[_0x27d0('0xa0')],'paused':_0x52b879[_0x27d0('0x9f')]||![],'penalty':_0x52b879[_0x27d0('0xa4')]},{'transaction':_0x4b0b13});});return Promise[_0x27d0('0x8c')](_0x2c4e6e);})[_0x27d0('0x13')](function(){return db['TeamVoicePrefix'][_0x27d0('0x4a')]({'where':{'teamId':{'$in':_0x2c1663}}});})[_0x27d0('0x13')](function(_0xbc89b1){var _0x276883=_[_0x27d0('0x33')](_0xbc89b1,function(_0x3edf83){return db['UserVoicePrefix'][_0x27d0('0x7f')]({'UserId':_0x52b879['id'],'VoicePrefixId':_0x3edf83['VoicePrefixId']},{'transaction':_0x4b0b13});});return Promise['all'](_0x276883);});});})[_0x27d0('0x13')](function(){for(var _0x19e57b=0x0;_0x19e57b<_0x5a8a1d[_0x27d0('0x4d')];_0x19e57b++){var _0x42fbd6=_0x5a8a1d[_0x19e57b][_0x27d0('0x118')](_0x27d0('0xb2'));var _0x34b638=_0x42fbd6+'QueueId';socket['emit'](_0x27d0('0x2e')+_0x42fbd6+'Queue:save',{'UserId':_0x3aed1d,['queueField']:_0x5a8a1d[_0x19e57b]['id']});}})[_0x27d0('0x13')](respondWithStatusCode(_0x12d2cb,null))[_0x27d0('0x1d')](APIHandleError(_0x12d2cb));};exports[_0x27d0('0x11a')]=function(_0x436eba,_0x21686f){var _0x15998e=_0x436eba[_0x27d0('0x5e')]['id'];var _0x12beac=null;if(_0x436eba[_0x27d0('0x43')][_0x27d0('0x61')]){_0x12beac=_[_0x27d0('0xb3')](_0x436eba[_0x27d0('0x43')][_0x27d0('0x61')])?_0x436eba[_0x27d0('0x43')][_0x27d0('0x61')]:[_0x436eba[_0x27d0('0x43')][_0x27d0('0x61')]];}var _0x490e32=[];return Promise[_0x27d0('0x101')]()[_0x27d0('0x13')](function(){if(!_0x12beac)throw new APIBadRequestError(_0x27d0('0x11b'));})[_0x27d0('0x13')](function(){return db['User'][_0x27d0('0x98')]({'where':{'id':_0x15998e}});})[_0x27d0('0x13')](function(_0x454a82){if(!_0x454a82)throw new APINotFoundError(util[_0x27d0('0xac')](_0x27d0('0x10f'),_0x436eba[_0x27d0('0x5e')]['id']));return db[_0x27d0('0x6c')][_0x27d0('0x113')](function(_0x3e74fd){return _0x454a82[_0x27d0('0x11a')](_0x12beac,{'transaction':_0x3e74fd})[_0x27d0('0x13')](function(){return db['Team'][_0x27d0('0x4a')]({'where':{'id':{'$in':_0x12beac}}});})[_0x27d0('0x13')](function(_0x2ad622){var _0x318e31=_['map'](_0x2ad622,function(_0x3febf0){return _0x3febf0['getAssociatedQueues']();});return Promise['all'](_0x318e31);})[_0x27d0('0x13')](function(_0x858d21){_0x490e32=_[_0x27d0('0x116')](_0x858d21);var _0x3b21db=_[_0x27d0('0x33')](_0x490e32,function(_0x347b7b){return _0x347b7b[_0x27d0('0x11c')](_0x454a82['id'],{'transaction':_0x3e74fd});});return Promise['all'](_0x3b21db);})[_0x27d0('0x13')](function(){if(!_0x454a82[_0x27d0('0xab')])return;var _0x353bd9=_[_0x27d0('0x3e')](_0x490e32,function(_0x2d97e0){return _0x2d97e0['getDataValue'](_0x27d0('0xb2'))==='Voice';});var _0x59ae33=_[_0x27d0('0x33')](_0x353bd9,function(_0x3772e9){return db[_0x27d0('0xae')]['destroy']({'where':{'VoiceQueueId':_0x3772e9['id'],'UserId':_0x454a82['id']},'transaction':_0x3e74fd});});return Promise[_0x27d0('0x8c')](_0x59ae33);})[_0x27d0('0x13')](function(){return db[_0x27d0('0x11d')][_0x27d0('0x4a')]({'where':{'teamId':{'$in':_0x12beac}}});})[_0x27d0('0x13')](function(_0x2d146e){var _0x44dc6a=_['map'](_0x2d146e,function(_0x39d45b){return db[_0x27d0('0x11e')][_0x27d0('0x29')]({'where':{'UserId':_0x454a82['id'],'VoicePrefixId':_0x39d45b[_0x27d0('0x11f')]}},{'transaction':_0x3e74fd});});return Promise[_0x27d0('0x8c')](_0x44dc6a);});});})[_0x27d0('0x13')](function(){for(var _0x17d1c3=0x0;_0x17d1c3<_0x490e32[_0x27d0('0x4d')];_0x17d1c3++){var _0x2c05e0=_0x490e32[_0x17d1c3][_0x27d0('0x118')](_0x27d0('0xb2'));var _0x147540=_0x2c05e0+_0x27d0('0xa7');socket[_0x27d0('0xa8')]('user'+_0x2c05e0+_0x27d0('0xb4'),{'UserId':_0x15998e,['queueField']:_0x490e32[_0x17d1c3]['id']});}})['then'](respondWithStatusCode(_0x21686f,null))[_0x27d0('0x1d')](APIHandleError(_0x21686f));};exports[_0x27d0('0x120')]=function(_0x38d037,_0x2d97c9){var _0x2411c6={};var _0x43271f={};var _0x3893e2;var _0x186edc;return db[_0x27d0('0x42')][_0x27d0('0x98')]({'where':{'id':_0x38d037[_0x27d0('0x5e')]['id']}})[_0x27d0('0x13')](handleEntityNotFound(_0x2d97c9,null))[_0x27d0('0x13')](function(_0x50d169){if(_0x50d169){_0x3893e2=_0x50d169;_0x43271f['model']=_['keys'](db[_0x27d0('0xd2')][_0x27d0('0x3a')]);_0x43271f[_0x27d0('0x43')]=_[_0x27d0('0x54')](_0x38d037[_0x27d0('0x43')]);_0x43271f[_0x27d0('0x56')]=_[_0x27d0('0xce')](_0x43271f[_0x27d0('0x53')],_0x43271f[_0x27d0('0x43')]);_0x2411c6[_0x27d0('0x48')]=_[_0x27d0('0xce')](_0x43271f['model'],qs[_0x27d0('0x57')](_0x38d037[_0x27d0('0x43')][_0x27d0('0x57')]));_0x2411c6[_0x27d0('0x48')]=_0x2411c6[_0x27d0('0x48')]['length']?_0x2411c6['attributes']:_0x43271f[_0x27d0('0x53')];_0x2411c6['order']=qs[_0x27d0('0xd0')](_0x38d037['query']['sort']);_0x2411c6[_0x27d0('0x41')]=qs[_0x27d0('0x56')](_[_0x27d0('0xd1')](_0x38d037[_0x27d0('0x43')],_0x43271f[_0x27d0('0x56')]));if(_0x38d037[_0x27d0('0x43')][_0x27d0('0x3e')]){_0x2411c6[_0x27d0('0x41')]=_[_0x27d0('0x59')](_0x2411c6['where'],{'$or':_[_0x27d0('0x33')](_0x2411c6[_0x27d0('0x48')],function(_0x3b5907){var _0x3aa6df={};_0x3aa6df[_0x3b5907]={'$like':'%'+_0x38d037[_0x27d0('0x43')][_0x27d0('0x3e')]+'%'};return _0x3aa6df;})});}_0x2411c6=_['merge']({},_0x2411c6,_0x38d037[_0x27d0('0xda')]);return _0x3893e2[_0x27d0('0x120')](_0x2411c6);}})['then'](function(_0x235155){if(_0x235155){_0x186edc=_0x235155[_0x27d0('0x4d')];if(!_0x38d037[_0x27d0('0x43')][_0x27d0('0xd6')](_0x27d0('0xd7'))){_0x2411c6[_0x27d0('0x24')]=qs[_0x27d0('0x24')](_0x38d037['query'][_0x27d0('0x24')]);_0x2411c6[_0x27d0('0x22')]=qs[_0x27d0('0x22')](_0x38d037[_0x27d0('0x43')][_0x27d0('0x22')]);}return _0x3893e2['getLists'](_0x2411c6);}})[_0x27d0('0x13')](function(_0x47c12e){if(_0x47c12e){return _0x47c12e?{'count':_0x186edc,'rows':_0x47c12e}:null;}})['then'](respondWithResult(_0x2d97c9,null))[_0x27d0('0x1d')](handleError(_0x2d97c9,null));};exports[_0x27d0('0x121')]=function(_0x5ada0f,_0x5af41a){var _0x3deb35={};var _0x52ba32={};var _0x22821c;return db[_0x27d0('0x42')][_0x27d0('0x98')]({'where':{'id':_0x5ada0f[_0x27d0('0x5e')]['id']}})[_0x27d0('0x13')](handleEntityNotFound(_0x5af41a,null))[_0x27d0('0x13')](function(_0xaefbf){if(_0xaefbf){_0x22821c=_0xaefbf;_0x52ba32[_0x27d0('0x53')]=_[_0x27d0('0x54')](db['User'][_0x27d0('0x3a')]);_0x52ba32[_0x27d0('0x43')]=_[_0x27d0('0x54')](_0x5ada0f[_0x27d0('0x43')]);_0x52ba32[_0x27d0('0x56')]=_[_0x27d0('0xce')](_0x52ba32['model'],_0x52ba32[_0x27d0('0x43')]);_0x3deb35[_0x27d0('0x48')]=_[_0x27d0('0xce')](_0x52ba32[_0x27d0('0x53')],qs[_0x27d0('0x57')](_0x5ada0f[_0x27d0('0x43')][_0x27d0('0x57')]));_0x3deb35[_0x27d0('0x48')]=_0x3deb35[_0x27d0('0x48')]['length']?_0x3deb35[_0x27d0('0x48')]:_0x52ba32[_0x27d0('0x53')];_0x3deb35[_0x27d0('0xcf')]=qs[_0x27d0('0xd0')](_0x5ada0f[_0x27d0('0x43')]['sort']);_0x3deb35[_0x27d0('0x41')]=qs[_0x27d0('0x56')](_[_0x27d0('0xd1')](_0x5ada0f['query'],_0x52ba32[_0x27d0('0x56')]));if(_0x5ada0f[_0x27d0('0x43')][_0x27d0('0x3e')]){_0x3deb35[_0x27d0('0x41')]=_['merge'](_0x3deb35['where'],{'$or':_[_0x27d0('0x33')](_0x3deb35[_0x27d0('0x48')],function(_0x1a51b3){var _0x33f6bc={};_0x33f6bc[_0x1a51b3]={'$like':'%'+_0x5ada0f[_0x27d0('0x43')][_0x27d0('0x3e')]+'%'};return _0x33f6bc;})});}_0x3deb35[_0x27d0('0x53')]=db[_0x27d0('0x42')];_0x3deb35['as']='Agents';_0x3deb35=_[_0x27d0('0x59')]({},_0x3deb35,_0x5ada0f[_0x27d0('0xda')]);return _0x22821c[_0x27d0('0xf9')]({'include':[_0x3deb35]});}})[_0x27d0('0x13')](function(_0x20bfea){if(_0x20bfea){var _0xce6622={},_0x2cdfef=[];for(var _0x3fff1f=0x0;_0x3fff1f<_0x20bfea[_0x27d0('0x4d')];_0x3fff1f+=0x1){for(var _0x2b4780=0x0,_0x4133b3;_0x2b4780<_0x20bfea[_0x3fff1f]['Agents'][_0x27d0('0x4d')];_0x2b4780+=0x1){_0x4133b3=_0x20bfea[_0x3fff1f]['Agents'][_0x2b4780][_0x27d0('0x2a')]({'plain':!![]});_0xce6622[_0x4133b3['id']]=_0x4133b3;}}_0xce6622=_['values'](_0xce6622);for(var _0x5926ea=qs[_0x27d0('0x22')](_0x5ada0f[_0x27d0('0x43')][_0x27d0('0x22')]);_0x5926ea<_0xce6622[_0x27d0('0x4d')]&&_0x2cdfef[_0x27d0('0x4d')]=_0x351e94){_0x5a0875=_0x351e94;_0x2f8fbe=0xc8;}else{_0x2f8fbe=0xce;}_0x4f651f[_0x3af0('0x20')](_0x2f8fbe);return _0x4f651f['set'](_0x3af0('0x26'),_0x49ac49+'-'+_0x5a0875+'/'+_0x351e94)[_0x3af0('0x27')](_0xc0d8d7);}return null;};}function saveUpdates(_0x451d94){return function(_0x3b510b){if(_0x3b510b){return _0x3b510b[_0x3af0('0x28')](_0x451d94)[_0x3af0('0x13')](function(_0x368c3c){socket[_0x3af0('0x29')](_0x3af0('0x2a')+_0x368c3c['id'],{});return _0x368c3c;});}return null;};}function removeEntity(_0x2baf0c){return function(_0x2a1b29){if(_0x2a1b29){return _0x2a1b29[_0x3af0('0x2b')]()[_0x3af0('0x13')](function(){var _0x4621d9=_0x2a1b29['get']({'plain':!![]});if(_0x4621d9['role']===_0x3af0('0x2c'))return;var _0x215151=[{'name':_0x3af0('0x2d'),'value':_0x3af0('0x2e'),'ignore':!![]},{'name':_0x3af0('0x2f'),'value':_0x3af0('0x30'),'ignore':![]},{'name':_0x3af0('0x31'),'value':_0x3af0('0x32'),'ignore':![]}];var _0x1d8fef=_(_0x215151)[_0x3af0('0x33')]('ignore')[_0x3af0('0x34')](_0x3af0('0x35'))[_0x3af0('0x35')]();if(_[_0x3af0('0x36')](_0x1d8fef,_0x4621d9[_0x3af0('0x37')])){return;}var _0x3560ac=_[_0x3af0('0x38')](_0x215151,[_0x3af0('0x35'),_0x4621d9[_0x3af0('0x37')]])['name'];return db['UserProfileResource'][_0x3af0('0x2b')]({'where':{'type':_0x3560ac,'resourceId':_0x4621d9['id']}})[_0x3af0('0x13')](function(){return _0x2a1b29;});})[_0x3af0('0x13')](function(){_0x2baf0c[_0x3af0('0x20')](0xcc)[_0x3af0('0x21')]();});}};}function handleEntityNotFound(_0x24bb64){return function(_0x10c841){if(!_0x10c841){_0x24bb64[_0x3af0('0x1f')](0x194);}return _0x10c841;};}function handleError(_0x1d4704,_0x26ca0f){_0x26ca0f=_0x26ca0f||0x1f4;return function(_0x2a575e){logger[_0x3af0('0x1a')](_0x2a575e[_0x3af0('0x39')]);if(_0x2a575e[_0x3af0('0x3a')]){delete _0x2a575e['name'];}_0x1d4704['status'](_0x26ca0f)['send'](_0x2a575e);};}exports['index']=function(_0x1a9c64,_0x20f29e){var _0x26cde3={},_0x3f8e53={'count':0x0,'rows':[]};var _0x47dba5=_(db[_0x3af0('0x3b')][_0x3af0('0x3c')])['map'](function(_0x2bbe2){return{'name':_0x2bbe2['fieldName'],'type':_0x2bbe2[_0x3af0('0x3d')]['key']};})['filter'](function(_0x311d4e){return!_[_0x3af0('0x36')]([_0x3af0('0x3e'),_0x3af0('0x3f')],_0x311d4e[_0x3af0('0x3a')]);})[_0x3af0('0x35')]();_0x26cde3=qs['getOptions'](_0x47dba5,_0x1a9c64);var _0x452ede={'where':_0x26cde3['where']};return db['User']['count'](_0x452ede)['then'](function(_0x363bf1){_0x3f8e53[_0x3af0('0x25')]=_0x363bf1;if(_0x1a9c64[_0x3af0('0x40')]['includeAll']){_0x26cde3[_0x3af0('0x41')]=[{'all':!![]}];}if(_0x1a9c64['query']['userSetting']==='true'){_0x26cde3['include']=[{'model':db[_0x3af0('0x42')],'as':_0x3af0('0x43')}];}if(!_['includes'](_0x26cde3[_0x3af0('0x44')],'id')){_0x26cde3[_0x3af0('0x44')][_0x3af0('0x45')]('id');}return db[_0x3af0('0x3b')][_0x3af0('0x46')](_0x26cde3);})[_0x3af0('0x13')](function(_0x3dc1b5){_0x3f8e53[_0x3af0('0x47')]=_0x3dc1b5;if(_0x1a9c64[_0x3af0('0x40')]['openTabs']===_0x3af0('0x48')){var _0x2bd116=[];for(var _0x282429=0x0;_0x282429<_0x3f8e53[_0x3af0('0x47')][_0x3af0('0x49')];_0x282429++){_0x2bd116['push'](get_open_tabs(_0x3af0('0x4a'),_0x3f8e53[_0x3af0('0x47')][_0x282429]['dataValues']));_0x2bd116[_0x3af0('0x45')](get_open_tabs(_0x3af0('0x4b'),_0x3f8e53['rows'][_0x282429][_0x3af0('0x4c')]));_0x2bd116[_0x3af0('0x45')](get_open_tabs(_0x3af0('0x4d'),_0x3f8e53[_0x3af0('0x47')][_0x282429][_0x3af0('0x4c')]));_0x2bd116[_0x3af0('0x45')](get_open_tabs(_0x3af0('0x4e'),_0x3f8e53[_0x3af0('0x47')][_0x282429][_0x3af0('0x4c')]));_0x2bd116[_0x3af0('0x45')](get_open_tabs('openchannel',_0x3f8e53[_0x3af0('0x47')][_0x282429]['dataValues']));_0x2bd116[_0x3af0('0x45')](get_open_tabs(_0x3af0('0x4f'),_0x3f8e53['rows'][_0x282429][_0x3af0('0x4c')]));}return Promise['all'](_0x2bd116)[_0x3af0('0x13')](function(){return _0x3f8e53;});}else{return _0x3f8e53;}})[_0x3af0('0x13')](respondWithFilteredResult(_0x20f29e,_0x26cde3))[_0x3af0('0x1e')](handleError(_0x20f29e,null));};exports[_0x3af0('0x50')]=function(_0x2c40a7,_0x4fd13f){var _0x233907={'raw':![],'where':{'id':_0x2c40a7[_0x3af0('0x51')]['id']}},_0x5052dc={};_0x5052dc[_0x3af0('0x52')]=_['differenceBy'](_['keys'](db[_0x3af0('0x3b')][_0x3af0('0x3c')]),['password','salt']);_0x5052dc[_0x3af0('0x40')]=_['keys'](_0x2c40a7[_0x3af0('0x40')]);_0x5052dc['filters']=_[_0x3af0('0x53')](_0x5052dc[_0x3af0('0x52')],_0x5052dc[_0x3af0('0x40')]);_0x233907['attributes']=_['intersection'](_0x5052dc['model'],qs[_0x3af0('0x54')](_0x2c40a7[_0x3af0('0x40')]['fields']));_0x233907['attributes']=_0x233907[_0x3af0('0x44')]['length']?_0x233907[_0x3af0('0x44')]:_0x5052dc[_0x3af0('0x52')];if(_0x2c40a7['query'][_0x3af0('0x55')]){_0x233907[_0x3af0('0x41')]=[{'all':!![]}];}if(_0x2c40a7[_0x3af0('0x40')][_0x3af0('0x43')]==='true'){_0x233907[_0x3af0('0x41')]=[{'model':db[_0x3af0('0x42')],'as':_0x3af0('0x43')}];}_0x233907=_[_0x3af0('0x56')]({},_0x233907,_0x2c40a7[_0x3af0('0x57')]);if(!_[_0x3af0('0x36')](_0x233907[_0x3af0('0x44')],'id')){_0x233907[_0x3af0('0x44')][_0x3af0('0x45')]('id');}return db[_0x3af0('0x3b')]['find'](_0x233907)[_0x3af0('0x13')](handleEntityNotFound(_0x4fd13f,null))[_0x3af0('0x13')](function(_0x124b1b){var _0x490780=[];values=_0x124b1b;if(_0x2c40a7['query']['openTabs']==='true'){_0x490780[_0x3af0('0x45')](get_open_tabs(_0x3af0('0x4a'),_0x124b1b[_0x3af0('0x4c')]));_0x490780[_0x3af0('0x45')](get_open_tabs(_0x3af0('0x4b'),_0x124b1b[_0x3af0('0x4c')]));_0x490780[_0x3af0('0x45')](get_open_tabs(_0x3af0('0x58'),_0x124b1b[_0x3af0('0x4c')]));_0x490780['push'](get_open_tabs(_0x3af0('0x4f'),_0x124b1b[_0x3af0('0x4c')]));_0x490780[_0x3af0('0x45')](get_open_tabs('fax',_0x124b1b[_0x3af0('0x4c')]));_0x490780[_0x3af0('0x45')](get_open_tabs(_0x3af0('0x4e'),_0x124b1b[_0x3af0('0x4c')]));return Promise[_0x3af0('0x59')](_0x490780);}else{return values;}})[_0x3af0('0x13')](function(){return values;})[_0x3af0('0x13')](respondWithResult(_0x4fd13f,null))[_0x3af0('0x1e')](handleError(_0x4fd13f,null));};exports[_0x3af0('0x28')]=function(_0x6ec7be,_0x547039){if(_0x6ec7be[_0x3af0('0x5a')]['id']){delete _0x6ec7be['body']['id'];}delete _0x6ec7be['body'][_0x3af0('0x37')];return db['User'][_0x3af0('0x38')]({'where':{'id':_0x6ec7be['params']['id']}})[_0x3af0('0x13')](handleEntityNotFound(_0x547039,null))[_0x3af0('0x13')](saveUpdates(_0x6ec7be['body'],null))[_0x3af0('0x13')](respondWithResult(_0x547039,null))[_0x3af0('0x1e')](handleError(_0x547039,null));};exports[_0x3af0('0x5b')]=function(_0xa7f3f7,_0x4841a9){return db[_0x3af0('0x3b')][_0x3af0('0x5b')]()[_0x3af0('0x13')](respondWithResult(_0x4841a9,null))['catch'](handleError(_0x4841a9,null));};exports[_0x3af0('0x5c')]=function(_0x3f0826,_0x1b7a64){return db[_0x3af0('0x3b')][_0x3af0('0x38')]({'where':{'id':_0x3f0826[_0x3af0('0x51')]['id']}})[_0x3af0('0x13')](handleEntityNotFound(_0x1b7a64,null))[_0x3af0('0x13')](function(_0x13a47d){if(_0x13a47d){return _0x13a47d[_0x3af0('0x5c')](_0x3f0826[_0x3af0('0x5a')][_0x3af0('0x5d')],_[_0x3af0('0x5e')](_0x3f0826[_0x3af0('0x5a')],[_0x3af0('0x5d'),'id'])||{});}})[_0x3af0('0x13')](respondWithResult(_0x1b7a64,null))[_0x3af0('0x1e')](handleError(_0x1b7a64,null));};function validateUser(_0x455996){return new Promise(function(_0x4e1370,_0x3bfc79){if(_0x455996[_0x3af0('0x5f')])return _0x4e1370(_0x455996);return db[_0x3af0('0x60')]['findById'](0x1)[_0x3af0('0x13')](function(_0x57efd6){if(_0x57efd6[_0x3af0('0x61')])authService[_0x3af0('0x62')](_0x455996[_0x3af0('0x3e')]);db['User']['max'](_0x3af0('0x5f'))[_0x3af0('0x13')](function(_0x5eb3ad){if(_['isNil'](_0x5eb3ad)){_0x455996[_0x3af0('0x5f')]=_0x57efd6[_0x3af0('0x63')]||0x1;return;}if(_[_0x3af0('0x64')](_0x57efd6[_0x3af0('0x63')])||_0x57efd6['min_internal']===_0x5eb3ad){_0x455996[_0x3af0('0x5f')]=_0x5eb3ad+0x1;return;}if(_0x57efd6[_0x3af0('0x63')]>_0x5eb3ad){_0x455996[_0x3af0('0x5f')]=_0x57efd6[_0x3af0('0x63')];return;}return db[_0x3af0('0x65')]['query'](_0x3af0('0x66'),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0x3af0('0x13')](function(_0x261700){if(_0x261700&&_0x261700['length']){for(var _0x3744ef=0x0,_0x5d3e54=_0x261700['length'];_0x3744ef<_0x5d3e54&&_[_0x3af0('0x64')](_0x455996[_0x3af0('0x5f')]);_0x3744ef++){if(_0x57efd6[_0x3af0('0x63')]<=_0x261700[_0x3744ef][_0x3af0('0x67')]){_0x455996[_0x3af0('0x5f')]=_0x261700[_0x3744ef][_0x3af0('0x67')];}else if(_0x57efd6[_0x3af0('0x63')]>_0x261700[_0x3744ef][_0x3af0('0x67')]&&_0x57efd6[_0x3af0('0x63')]<=_0x261700[_0x3744ef]['to']){_0x455996[_0x3af0('0x5f')]=_0x57efd6['min_internal'];}}}if(_[_0x3af0('0x64')](_0x455996[_0x3af0('0x5f')])){_0x455996[_0x3af0('0x5f')]=_0x5eb3ad+0x1;}return _0x4e1370(_0x455996);});});})[_0x3af0('0x1e')](function(_0x257aba){_0x3bfc79(_0x257aba);});});}function updateUser(_0x3fdbb2){return new Promise(function(_0x418daf,_0x55df80){try{if(_0x3fdbb2[_0x3af0('0x68')]){_0x3fdbb2['mailbox']=_0x3fdbb2['internal'];_0x3fdbb2[_0x3af0('0x69')]={'mailbox':_0x3fdbb2[_0x3af0('0x5f')],'password':_0x3fdbb2['password'],'fullname':_0x3fdbb2[_0x3af0('0x6a')],'email':_0x3fdbb2[_0x3af0('0x6b')]};}if(_0x3fdbb2[_0x3af0('0x37')]===_0x3af0('0x30')){if(!_0x3fdbb2['permissions'])_0x3fdbb2[_0x3af0('0x6c')]=[_0x3af0('0x6d'),_0x3af0('0x6e'),'103',_0x3af0('0x6f'),_0x3af0('0x70'),_0x3af0('0x71'),_0x3af0('0x72'),_0x3af0('0x73'),'107','108',_0x3af0('0x74'),_0x3af0('0x75'),_0x3af0('0x76'),_0x3af0('0x77'),'115'];}_0x418daf(_0x3fdbb2);}catch(_0x3e3ac0){_0x55df80(_0x3e3ac0);}});}exports[_0x3af0('0x78')]=function(_0x2e6431,_0x1df9f8){if(_0x2e6431[_0x3af0('0x2e')]['role']===_0x3af0('0x30'))throw new Error('Unauthorized');if(_0x2e6431[_0x3af0('0x5a')][_0x3af0('0x37')]===_0x3af0('0x2e')&&_0x2e6431[_0x3af0('0x2e')][_0x3af0('0x37')]!==_0x3af0('0x2c')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x2e6431['body'][_0x3af0('0x37')]===_0x3af0('0x2c')&&_0x2e6431['user']['role']!=='admin'){throw new Error(_0x3af0('0x79'));}return licenseUtil[_0x3af0('0x7a')]([_0x2e6431[_0x3af0('0x5a')]])[_0x3af0('0x13')](function(){return validateUser(_0x2e6431['body']);})[_0x3af0('0x13')](function(_0x4e4f3e){return updateUser(_0x4e4f3e)[_0x3af0('0x13')](function(_0x133d81){if(_0x133d81[_0x3af0('0x37')]===_0x3af0('0x2c')){_0x133d81[_0x3af0('0x7b')]=_0x2e6431[_0x3af0('0x2e')]['settingsEnabled'];delete _0x133d81[_0x3af0('0x7c')];}return _0x133d81;});})[_0x3af0('0x13')](function(_0xeaadf5){return db['User'][_0x3af0('0x78')](_0xeaadf5,{'include':[{'model':db[_0x3af0('0x69')],'as':_0x3af0('0x69')}]});})[_0x3af0('0x13')](function(_0x25be9c){if(_0x2e6431[_0x3af0('0x5a')][_0x3af0('0x37')]===_0x3af0('0x2e'))return _0x25be9c;if(_0x2e6431[_0x3af0('0x2e')][_0x3af0('0x37')]!=='user')return _0x25be9c;return db['UserProfileSection']['find']({'where':{'name':_0x25be9c[_0x3af0('0x37')]==='agent'?_0x3af0('0x2f'):_0x3af0('0x31'),'userProfileId':_0x2e6431[_0x3af0('0x2e')][_0x3af0('0x7c')]},'raw':!![]})[_0x3af0('0x13')](function(_0x183a11){if(!_0x183a11||_0x183a11[_0x3af0('0x7d')]!=0x0)return _0x25be9c;return db['UserProfileResource'][_0x3af0('0x78')]({'name':_0x25be9c['name'],'resourceId':_0x25be9c['id'],'type':_0x183a11[_0x3af0('0x3a')],'sectionId':_0x183a11['id']},{})[_0x3af0('0x13')](function(){return _0x25be9c;});})['catch'](function(_0x407c1a){logger[_0x3af0('0x1a')](_0x3af0('0x7e'),_0x407c1a);throw _0x407c1a;});})[_0x3af0('0x13')](respondWithResult(_0x1df9f8,0xc9))[_0x3af0('0x1e')](handleError(_0x1df9f8,null));};exports[_0x3af0('0x7f')]=function(_0x149fe0,_0x2b94cb){var _0x30b36a=_0x149fe0['body'];var _0x185b5c=[];if(_0x149fe0['user']['role']===_0x3af0('0x30'))throw new Error(_0x3af0('0x80'));if(_[_0x3af0('0x81')](_0x30b36a,[_0x3af0('0x37'),'user'])&&_0x149fe0[_0x3af0('0x2e')][_0x3af0('0x37')]!=='admin'){throw new Error(_0x3af0('0x82'));}if(_[_0x3af0('0x81')](_0x30b36a,[_0x3af0('0x37'),_0x3af0('0x2c')])&&_0x149fe0['user']['role']!==_0x3af0('0x2c')){throw new Error(_0x3af0('0x83'));}return licenseUtil['checkUserLimits'](_0x30b36a)['then'](function(){return validateUser(_0x30b36a[0x0]);})[_0x3af0('0x13')](function(){for(var _0x478e08=0x1;_0x478e08<_0x30b36a['length'];_0x478e08++){var _0x2c5ec0=_0x30b36a[_0x478e08-0x1][_0x3af0('0x5f')];if(!_0x30b36a[_0x478e08][_0x3af0('0x5f')])_0x30b36a[_0x478e08][_0x3af0('0x5f')]=_0x2c5ec0+0x1;_0x185b5c['push'](validateUser(_0x30b36a[_0x478e08]));}return Promise[_0x3af0('0x59')](_0x185b5c);})[_0x3af0('0x13')](function(){_0x185b5c=[];for(var _0x39e538=0x0;_0x39e538<_0x30b36a['length'];_0x39e538++){_0x185b5c[_0x3af0('0x45')](updateUser(_0x30b36a[_0x39e538]));}return Promise[_0x3af0('0x59')](_0x185b5c);})[_0x3af0('0x13')](function(){_0x185b5c=_0x30b36a[_0x3af0('0x34')](function(_0x13d7c8){return db[_0x3af0('0x3b')][_0x3af0('0x78')](_0x13d7c8,{'include':[{'model':db[_0x3af0('0x69')],'as':_0x3af0('0x69')}]})[_0x3af0('0x13')](function(_0xb75594){_0x13d7c8['id']=_0xb75594['id'];return _0x13d7c8;});});return Promise[_0x3af0('0x59')](_0x185b5c);})[_0x3af0('0x13')](function(_0xbf5cd9){if(_0x149fe0[_0x3af0('0x5a')][_0x3af0('0x37')]==='user')return _0xbf5cd9;if(_0x149fe0[_0x3af0('0x2e')][_0x3af0('0x37')]!==_0x3af0('0x2e'))return _0xbf5cd9;var _0x18ddc5=_['some'](_0xbf5cd9,function(_0x5b1194){return _0x5b1194[_0x3af0('0x37')]===_0x3af0('0x30')||_0x5b1194[_0x3af0('0x37')]===_0x3af0('0x32');});if(!_0x18ddc5)return _0xbf5cd9;return db[_0x3af0('0x84')]['findAll']({'where':{'name':{'$or':[_0x3af0('0x2f'),_0x3af0('0x31')]},'userProfileId':_0x149fe0[_0x3af0('0x2e')][_0x3af0('0x7c')]},'raw':!![]})['then'](function(_0x3449ae){if(_[_0x3af0('0x85')](_0x3449ae)||!_[_0x3af0('0x81')](_0x3449ae,['autoAssociation',0x0]))return _0xbf5cd9;_0x185b5c=[];var _0x446862=_(_0x3449ae)[_0x3af0('0x34')](function(_0x21daf1){if(_0x21daf1['autoAssociation']===0x1)return;return _0x21daf1[_0x3af0('0x3a')]===_0x3af0('0x2f')?_0x3af0('0x30'):_0x3af0('0x32');})[_0x3af0('0x86')]()[_0x3af0('0x35')]();for(var _0x15083c=0x0;_0x15083c<_0xbf5cd9['length'];_0x15083c++){if(!_['includes'](_0x446862,_0xbf5cd9[_0x15083c][_0x3af0('0x37')]))return;var _0x58ec56=_0xbf5cd9[_0x15083c]['role']===_0x3af0('0x30')?_0x3af0('0x2f'):_0x3af0('0x31');_0x185b5c[_0x3af0('0x45')](db[_0x3af0('0x87')][_0x3af0('0x78')]({'name':_0xbf5cd9[_0x15083c][_0x3af0('0x3a')],'resourceId':_0xbf5cd9[_0x15083c]['id'],'type':_0x58ec56,'sectionId':_[_0x3af0('0x38')](_0x3449ae,[_0x3af0('0x3a'),_0x58ec56])['id']},{}));}return Promise[_0x3af0('0x59')](_0x185b5c);});})[_0x3af0('0x13')](respondWithResult(_0x2b94cb,0xc9))[_0x3af0('0x1e')](handleError(_0x2b94cb,null));};exports[_0x3af0('0x88')]=function(_0x5e1baf,_0x555c95){if(_0x5e1baf[_0x3af0('0x5a')]['id']){delete _0x5e1baf[_0x3af0('0x5a')]['id'];}return db['User'][_0x3af0('0x38')]({'where':{'id':_0x5e1baf[_0x3af0('0x51')]['id']}})[_0x3af0('0x13')](function(_0x55b4a6){if(!_0x55b4a6)return null;if(_0x55b4a6['id']===_0x5e1baf['user']['id']){if(!_0x5e1baf[_0x3af0('0x5a')]['oldPassword']||!_0x5e1baf[_0x3af0('0x5a')][_0x3af0('0x89')]){throw new db[(_0x3af0('0x8a'))][(_0x3af0('0x8b'))](_0x3af0('0x8c'));}if(!_0x55b4a6[_0x3af0('0x8d')](_0x5e1baf[_0x3af0('0x5a')][_0x3af0('0x8e')])){throw new db[(_0x3af0('0x8a'))][(_0x3af0('0x8b'))]('Wrong\x20credentials');}if(_0x5e1baf['body'][_0x3af0('0x8e')]===_0x5e1baf[_0x3af0('0x5a')][_0x3af0('0x89')]){throw new db[(_0x3af0('0x8a'))]['ValidationError'](_0x3af0('0x8f'));}}else if(_0x5e1baf[_0x3af0('0x2e')]['role']===_0x3af0('0x2c')){if(!_0x5e1baf[_0x3af0('0x5a')]['newPassword']){throw new db[(_0x3af0('0x8a'))][(_0x3af0('0x8b'))](_0x3af0('0x90'));}}else if(_0x5e1baf[_0x3af0('0x2e')][_0x3af0('0x37')]===_0x3af0('0x2e')){if(!_0x5e1baf[_0x3af0('0x5a')][_0x3af0('0x89')]){throw new db['Sequelize'][(_0x3af0('0x8b'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x55b4a6[_0x3af0('0x37')]!=='agent'){throw new db[(_0x3af0('0x8a'))][(_0x3af0('0x8b'))](_0x3af0('0x80'));}}else{throw new db[(_0x3af0('0x8a'))][(_0x3af0('0x8b'))](_0x3af0('0x80'));}return _0x55b4a6;})[_0x3af0('0x13')](handleEntityNotFound(_0x555c95,null))['then'](function(_0x40e5da){return db[_0x3af0('0x60')][_0x3af0('0x91')]({'attributes':['id',_0x3af0('0x61'),_0x3af0('0x92'),_0x3af0('0x93')]})[_0x3af0('0x13')](function(_0x66f90e){if(_0x66f90e[_0x3af0('0x61')])authService[_0x3af0('0x62')](_0x5e1baf[_0x3af0('0x5a')][_0x3af0('0x89')]);if(!_0x66f90e['enforcePasswordHistory']||!_0x40e5da[_0x3af0('0x94')])return _0x40e5da;authService[_0x3af0('0x95')](_0x5e1baf[_0x3af0('0x5a')][_0x3af0('0x89')],_0x40e5da[_0x3af0('0x94')],_0x66f90e[_0x3af0('0x93')]);return _0x40e5da;})[_0x3af0('0x13')](saveUpdates({'password':_0x5e1baf[_0x3af0('0x5a')][_0x3af0('0x89')],'passwordResetAt':_0x5e1baf[_0x3af0('0x2e')]['id']==_0x5e1baf[_0x3af0('0x51')]['id']?moment():null,'previousPasswords':authService[_0x3af0('0x96')](_0x5e1baf[_0x3af0('0x5a')][_0x3af0('0x89')],_0x40e5da[_0x3af0('0x94')])},null));})['then'](respondWithResult(_0x555c95,null))[_0x3af0('0x1e')](handleError(_0x555c95,null));};exports[_0x3af0('0x97')]=function(_0x50b2f6,_0x2828c6){var _0x42136b=_0x50b2f6[_0x3af0('0x5a')]['channel'];return db[_0x3af0('0x3b')][_0x3af0('0x38')]({'where':{'id':_0x50b2f6[_0x3af0('0x51')]['id']},'attributes':['id','name',_0x3af0('0x37'),_0x3af0('0x98'),'loginInPause','voicePause',_0x3af0('0x99')]})[_0x3af0('0x13')](handleEntityNotFound(_0x2828c6,null))['then'](function(_0x575476){if(_0x575476){if(!utils[_0x3af0('0x9a')](_0x42136b)){throw new db[(_0x3af0('0x8a'))][(_0x3af0('0x8b'))](_0x3af0('0x9b'));}return _0x575476[_0x3af0('0x9c')+_['capitalize'](_0x42136b[_0x3af0('0x9d')]())+'Queues'](_0x50b2f6[_0x3af0('0x5a')]['ids'],{'penalty':_0x50b2f6['body'][_0x3af0('0x9e')]||0x0})['spread'](function(_0x43830a){for(var _0x1cfb6d=0x0;_0x1cfb6d<_0x50b2f6[_0x3af0('0x5a')][_0x3af0('0x5d')][_0x3af0('0x49')];_0x1cfb6d+=0x1){var _0x357394={'UserId':Number(_0x50b2f6[_0x3af0('0x51')]['id'])};_0x357394[_['capitalize'](_0x42136b['toLowerCase']())+_0x3af0('0x9f')]=Number(_0x50b2f6['body']['ids'][_0x1cfb6d]);socket['emit'](_0x3af0('0x2e')+_['capitalize'](_0x42136b[_0x3af0('0x9d')]())+_0x3af0('0xa0'),_0x357394);}return _0x43830a;})[_0x3af0('0x13')](function(){if(_0x42136b===_0x3af0('0xa1')){return db[_0x3af0('0xa2')]['findAll']({'where':{'id':_0x50b2f6[_0x3af0('0x5a')][_0x3af0('0x5d')]||[]},'raw':!![],'attributes':['id',_0x3af0('0x3a')]});}})[_0x3af0('0x13')](function(_0x5cd2bf){var _0x2a6930=_0x575476[_0x3af0('0xa3')]({'plain':!![]});var _0x53a393=[];if(_0x42136b===_0x3af0('0xa1')&&_0x2a6930[_0x3af0('0x37')]==='agent'&&_0x2a6930[_0x3af0('0x98')]){for(let _0x36f85e=0x0;_0x36f85e<_0x5cd2bf[_0x3af0('0x49')];_0x36f85e+=0x1){_0x53a393[_0x3af0('0x45')]({'membername':_0x2a6930[_0x3af0('0x3a')],'UserId':_0x2a6930['id'],'queue_name':_0x5cd2bf[_0x36f85e][_0x3af0('0x3a')],'VoiceQueueId':_0x5cd2bf[_0x36f85e]['id'],'interface':_[_0x3af0('0x64')](_0x2a6930[_0x3af0('0x99')])?util[_0x3af0('0xa4')](_0x3af0('0xa5'),_0x2a6930[_0x3af0('0x3a')]):_0x2a6930[_0x3af0('0x99')],'paused':_0x2a6930[_0x3af0('0xa6')]||![],'penalty':_0x50b2f6[_0x3af0('0x5a')][_0x3af0('0x9e')]||0x0});}return Promise[_0x3af0('0x59')](_0x53a393[_0x3af0('0x34')](function(_0x1ac2fd){return db[_0x3af0('0xa7')][_0x3af0('0xa8')](_0x1ac2fd);}));}return _0x575476;});}})[_0x3af0('0x13')](respondWithStatusCode(_0x2828c6,null))[_0x3af0('0x1e')](handleError(_0x2828c6,null));};exports['removeQueues']=function(_0x2304b3,_0x31c0d1){var _0x41c02d,_0x4ae19d;return db[_0x3af0('0x3b')]['find']({'where':{'id':_0x2304b3['params']['id']},'attributes':['id',_0x3af0('0x3a'),_0x3af0('0x37')]})['then'](handleEntityNotFound(_0x31c0d1,null))[_0x3af0('0x13')](function(_0x3cc089){if(_0x3cc089){_0x41c02d=_0x3cc089;if(!_0x2304b3[_0x3af0('0x40')][_0x3af0('0xa9')]||!utils['isValidChannel'](_0x2304b3[_0x3af0('0x40')]['channel'])){throw new db[(_0x3af0('0x8a'))][(_0x3af0('0x8b'))]('Unknown\x20channel');}return _0x3cc089['remove'+_[_0x3af0('0xaa')](_0x2304b3[_0x3af0('0x40')]['channel'][_0x3af0('0x9d')]())+_0x3af0('0xab')](_0x2304b3[_0x3af0('0x40')][_0x3af0('0x5d')]);}})['then'](function(_0x3bf2b1){if(_[_0x3af0('0xac')](_0x2304b3['query'][_0x3af0('0x5d')])){for(var _0x451f61=0x0;_0x451f61<_0x2304b3[_0x3af0('0x40')][_0x3af0('0x5d')]['length'];_0x451f61+=0x1){_0x4ae19d={'UserId':Number(_0x2304b3[_0x3af0('0x51')]['id'])};_0x4ae19d[_['capitalize'](_0x2304b3[_0x3af0('0x40')][_0x3af0('0xa9')][_0x3af0('0x9d')]())+'QueueId']=Number(_0x2304b3['query'][_0x3af0('0x5d')][_0x451f61]);socket['emit'](_0x3af0('0x2e')+_[_0x3af0('0xaa')](_0x2304b3[_0x3af0('0x40')][_0x3af0('0xa9')][_0x3af0('0x9d')]())+'Queue:remove',_0x4ae19d);}}else{_0x4ae19d={'UserId':Number(_0x2304b3[_0x3af0('0x51')]['id'])};_0x4ae19d[_[_0x3af0('0xaa')](_0x2304b3[_0x3af0('0x40')][_0x3af0('0xa9')][_0x3af0('0x9d')]())+_0x3af0('0x9f')]=Number(_0x2304b3[_0x3af0('0x40')][_0x3af0('0x5d')]);socket[_0x3af0('0x29')](_0x3af0('0x2e')+_['capitalize'](_0x2304b3[_0x3af0('0x40')][_0x3af0('0xa9')]['toLowerCase']())+'Queue:remove',_0x4ae19d);}return _0x3bf2b1;})[_0x3af0('0x13')](function(){if(_0x2304b3[_0x3af0('0x40')][_0x3af0('0xa9')]===_0x3af0('0xa1')){return db[_0x3af0('0xa7')][_0x3af0('0x2b')]({'where':{'UserId':_0x2304b3[_0x3af0('0x51')]['id'],'VoiceQueueId':_0x2304b3['query']['ids']},'individualHooks':!![]})[_0x3af0('0x13')](function(){return _0x41c02d;});}return _0x41c02d;})[_0x3af0('0x13')](respondWithStatusCode(_0x31c0d1,null))[_0x3af0('0x1e')](handleError(_0x31c0d1,null));};exports[_0x3af0('0xad')]=function(_0x2f75f8,_0x37ff54){_0x2f75f8[_0x3af0('0x5a')]['userpic']=_0x2f75f8[_0x3af0('0xae')][_0x3af0('0xaf')];return db['User'][_0x3af0('0x38')]({'where':{'id':_0x2f75f8[_0x3af0('0x51')]['id']}})['then'](handleEntityNotFound(_0x37ff54,null))[_0x3af0('0x13')](saveUpdates(_0x2f75f8[_0x3af0('0x5a')],null))[_0x3af0('0x13')](respondWithResult(_0x37ff54,null))[_0x3af0('0x1e')](handleError(_0x37ff54,null));};exports['getAvatar']=function(_0x1b4ec4,_0x284ea4){var _0x507951=path[_0x3af0('0xb0')](config[_0x3af0('0xb1')],_0x3af0('0xb2'));return db[_0x3af0('0x3b')][_0x3af0('0x38')]({'where':{'id':_0x1b4ec4[_0x3af0('0x51')]['id']},'attributes':['id',_0x3af0('0xb3')],'raw':!![]})[_0x3af0('0x13')](handleEntityNotFound(_0x284ea4,null))['then'](function(_0x1e40ce){if(_0x1e40ce){if(_['isNil'](_0x1e40ce[_0x3af0('0xb3')])){return _0x284ea4[_0x3af0('0xb4')](_0x507951);}else{if(!fs[_0x3af0('0xb5')](path[_0x3af0('0xb0')](config['root'],_0x3af0('0xb6'),_0x1e40ce[_0x3af0('0xb3')]))){return _0x284ea4[_0x3af0('0xb4')](_0x507951);}return _0x284ea4[_0x3af0('0xb4')](path[_0x3af0('0xb0')](config[_0x3af0('0xb1')],_0x3af0('0xb6'),_0x1e40ce['userpic']));}}})[_0x3af0('0x1e')](handleError(_0x284ea4,null));};exports[_0x3af0('0xb7')]=function(_0x30c3d0,_0x49a459){return db['User'][_0x3af0('0x38')]({'where':{'id':_0x30c3d0[_0x3af0('0x51')]['id']},'attributes':['id']})[_0x3af0('0x13')](handleEntityNotFound(_0x49a459,null))['then'](function(_0x4c83a8){var _0x3bc9b6=[];values=_0x4c83a8[_0x3af0('0x4c')];_0x3bc9b6['push'](get_open_tabs(_0x3af0('0x4a'),_0x4c83a8[_0x3af0('0x4c')]));_0x3bc9b6[_0x3af0('0x45')](get_open_tabs('sms',_0x4c83a8[_0x3af0('0x4c')]));_0x3bc9b6[_0x3af0('0x45')](get_open_tabs(_0x3af0('0x58'),_0x4c83a8[_0x3af0('0x4c')]));_0x3bc9b6[_0x3af0('0x45')](get_open_tabs('whatsapp',_0x4c83a8[_0x3af0('0x4c')]));_0x3bc9b6['push'](get_open_tabs(_0x3af0('0x4d'),_0x4c83a8['dataValues']));_0x3bc9b6[_0x3af0('0x45')](get_open_tabs('mail',_0x4c83a8[_0x3af0('0x4c')]));return Promise['all'](_0x3bc9b6);})['then'](function(_0x119ca1){if(_0x119ca1){var _0x4fedce=_[_0x3af0('0x34')](values[_0x3af0('0xb8')],function(_0x1ca46b){return{'channel':_0x3af0('0xb9'),'id':_0x1ca46b['id'],'createdAt':_0x1ca46b[_0x3af0('0xba')]};});var _0x27d7e4=_[_0x3af0('0x34')](values[_0x3af0('0xbb')],function(_0x378af7){return{'channel':_0x3af0('0xbc'),'id':_0x378af7['id'],'createdAt':_0x378af7[_0x3af0('0xba')]};});var _0x1f56c7=_['map'](values[_0x3af0('0xbd')],function(_0x2f23a2){return{'channel':_0x3af0('0xbe'),'id':_0x2f23a2['id'],'createdAt':_0x2f23a2[_0x3af0('0xba')]};});var _0x5c4dec=_['map'](values[_0x3af0('0xbf')],function(_0x4f58b1){return{'channel':_0x3af0('0xc0'),'id':_0x4f58b1['id'],'createdAt':_0x4f58b1['createdAt']};});var _0x151a22=_['map'](values[_0x3af0('0xc1')],function(_0x2f9d19){return{'channel':_0x3af0('0xc2'),'id':_0x2f9d19['id'],'createdAt':_0x2f9d19[_0x3af0('0xba')]};});var _0x297c60=_[_0x3af0('0x34')](values[_0x3af0('0xc3')],function(_0x238d11){return{'channel':'WHATSAPP','id':_0x238d11['id'],'createdAt':_0x238d11[_0x3af0('0xba')]};});var _0x3c2f56=_[_0x3af0('0xc4')](_0x4fedce,_0x27d7e4,_0x1f56c7,_0x5c4dec,_0x151a22,_0x297c60);var _0x1feb19={'count':_0x3c2f56['length'],'rows':_0x3c2f56};return _0x1feb19;}else return null;})[_0x3af0('0x13')](respondWithResult(_0x49a459,null))['catch'](handleError(_0x49a459,null));};exports['getContacts']=function(_0x50919a,_0x29e83f){var _0xd0c39d={};var _0x328fe8={};var _0x415ed5;var _0x30b48d;return db[_0x3af0('0x3b')][_0x3af0('0x91')]({'where':{'id':_0x50919a[_0x3af0('0x51')]['id']}})[_0x3af0('0x13')](handleEntityNotFound(_0x29e83f,null))[_0x3af0('0x13')](function(_0x2f3660){if(_0x2f3660){_0x415ed5=_0x2f3660;_0x328fe8['model']=_['keys'](db[_0x3af0('0xc5')]['rawAttributes']);_0x328fe8[_0x3af0('0x40')]=_['keys'](_0x50919a[_0x3af0('0x40')]);_0x328fe8[_0x3af0('0xc6')]=_[_0x3af0('0x53')](_0x328fe8[_0x3af0('0x52')],_0x328fe8[_0x3af0('0x40')]);_0xd0c39d[_0x3af0('0x44')]=_[_0x3af0('0x53')](_0x328fe8[_0x3af0('0x52')],qs['fields'](_0x50919a[_0x3af0('0x40')]['fields']));_0xd0c39d[_0x3af0('0x44')]=_0xd0c39d[_0x3af0('0x44')][_0x3af0('0x49')]?_0xd0c39d[_0x3af0('0x44')]:_0x328fe8[_0x3af0('0x52')];_0xd0c39d[_0x3af0('0xc7')]=qs[_0x3af0('0xc8')](_0x50919a['query'][_0x3af0('0xc8')]);_0xd0c39d[_0x3af0('0xc9')]=qs['filters'](_[_0x3af0('0xca')](_0x50919a[_0x3af0('0x40')],_0x328fe8[_0x3af0('0xc6')]));if(_0x50919a[_0x3af0('0x40')][_0x3af0('0x33')]){_0xd0c39d['where']=_['merge'](_0xd0c39d[_0x3af0('0xc9')],{'$or':_[_0x3af0('0x34')](_0xd0c39d[_0x3af0('0x44')],function(_0x5cec25){var _0x4f72a8={};_0x4f72a8[_0x5cec25]={'$like':'%'+_0x50919a[_0x3af0('0x40')][_0x3af0('0x33')]+'%'};return _0x4f72a8;})});}_0xd0c39d=_[_0x3af0('0x56')]({},_0xd0c39d,_0x50919a[_0x3af0('0x57')]);return _0x415ed5[_0x3af0('0xcb')](_0xd0c39d);}})[_0x3af0('0x13')](function(_0x493801){if(_0x493801){_0x30b48d=_0x493801[_0x3af0('0x49')];if(_0x50919a[_0x3af0('0x40')][_0x3af0('0xcc')](_0x3af0('0x55'))){_0xd0c39d[_0x3af0('0x41')]=[{'model':db['CmList'],'as':_0x3af0('0xcd'),'required':![]},{'model':db[_0x3af0('0xce')],'as':_0x3af0('0xcf'),'attributes':['id',_0x3af0('0x3a'),_0x3af0('0xd0')],'where':_0x50919a[_0x3af0('0x40')]['tag']?{'id':_0x50919a[_0x3af0('0x40')][_0x3af0('0xd1')]}:undefined,'required':_0x50919a[_0x3af0('0x40')][_0x3af0('0xd1')]?!![]:![]}];}if(!_0x50919a[_0x3af0('0x40')][_0x3af0('0xcc')](_0x3af0('0xd2'))){_0xd0c39d['limit']=qs[_0x3af0('0x23')](_0x50919a[_0x3af0('0x40')][_0x3af0('0x23')]);_0xd0c39d['offset']=qs[_0x3af0('0x24')](_0x50919a[_0x3af0('0x40')][_0x3af0('0x24')]);}return _0x415ed5['getContacts'](_0xd0c39d);}})['then'](function(_0x1dd146){if(_0x1dd146){return _0x1dd146?{'count':_0x30b48d,'rows':_0x1dd146}:null;}})[_0x3af0('0x13')](respondWithResult(_0x29e83f,null))['catch'](handleError(_0x29e83f,null));};exports['getQueues']=function(_0x27e66e,_0x2cb1b8){var _0x170c70;var _0x1e63c8={};var _0x6a1681;return db['User']['findOne']({'where':{'id':_0x27e66e[_0x3af0('0x51')]['id']},'attributes':['id','name',_0x3af0('0x37')]})[_0x3af0('0x13')](handleEntityNotFound(_0x2cb1b8,null))[_0x3af0('0x13')](function(_0x3d52d4){if(!utils[_0x3af0('0x9a')](_0x27e66e[_0x3af0('0x40')][_0x3af0('0xa9')])){throw new db[(_0x3af0('0x8a'))][(_0x3af0('0x8b'))]('Unknown\x20channel');}_0x170c70=_0x3d52d4;var _0x56f079={};_0x56f079[_0x3af0('0x52')]=_[_0x3af0('0xd3')](db[_[_0x3af0('0xaa')](_0x27e66e[_0x3af0('0x40')][_0x3af0('0xa9')])+_0x3af0('0xd4')]['rawAttributes']);_0x56f079[_0x3af0('0x40')]=_[_0x3af0('0xd3')](_0x27e66e[_0x3af0('0x40')]);_0x56f079[_0x3af0('0xc6')]=_[_0x3af0('0x53')](_0x56f079[_0x3af0('0x52')],_0x56f079[_0x3af0('0x40')]);_0x1e63c8[_0x3af0('0x44')]=_[_0x3af0('0x53')](_0x56f079[_0x3af0('0x52')],qs['fields'](_0x27e66e[_0x3af0('0x40')][_0x3af0('0x54')]));_0x1e63c8[_0x3af0('0x44')]=_0x1e63c8['attributes'][_0x3af0('0x49')]?_0x1e63c8[_0x3af0('0x44')]:_0x56f079[_0x3af0('0x52')];_0x1e63c8['order']=qs[_0x3af0('0xc8')](_0x27e66e[_0x3af0('0x40')][_0x3af0('0xc8')]);_0x1e63c8[_0x3af0('0xc9')]=qs['filters'](_['pick'](_0x27e66e[_0x3af0('0x40')],_0x56f079['filters']));if(_0x27e66e['query'][_0x3af0('0x33')]){_0x1e63c8[_0x3af0('0xc9')]=_[_0x3af0('0x56')](_0x1e63c8[_0x3af0('0xc9')],{'$or':_[_0x3af0('0x34')](_0x1e63c8[_0x3af0('0x44')],function(_0x2fc5b0){var _0xd46645={};_0xd46645[_0x2fc5b0]={'$like':'%'+_0x27e66e['query'][_0x3af0('0x33')]+'%'};return _0xd46645;})});}_0x1e63c8=_[_0x3af0('0x56')]({},_0x1e63c8,_0x27e66e[_0x3af0('0x57')]);switch(_0x170c70[_0x3af0('0x37')]){case _0x3af0('0x2c'):return db[_['capitalize'](_0x27e66e['query'][_0x3af0('0xa9')])+_0x3af0('0xd4')]['findAll'](_0x1e63c8);case _0x3af0('0x2e'):case _0x3af0('0x30'):return _0x170c70[_0x3af0('0xa3')+_[_0x3af0('0xaa')](_0x27e66e[_0x3af0('0x40')][_0x3af0('0xa9')])+_0x3af0('0xab')](_0x1e63c8);default:throw new db[(_0x3af0('0x8a'))]['ValidationError'](_0x3af0('0xd5'));}})[_0x3af0('0x13')](function(_0x8da65e){_0x6a1681=_0x8da65e[_0x3af0('0x49')];if(!_0x27e66e['query']['hasOwnProperty'](_0x3af0('0xd2'))){_0x1e63c8[_0x3af0('0x23')]=qs[_0x3af0('0x23')](_0x27e66e[_0x3af0('0x40')][_0x3af0('0x23')]);_0x1e63c8[_0x3af0('0x24')]=qs[_0x3af0('0x24')](_0x27e66e[_0x3af0('0x40')][_0x3af0('0x24')]);}switch(_0x170c70[_0x3af0('0x37')]){case _0x3af0('0x2c'):return db[_[_0x3af0('0xaa')](_0x27e66e[_0x3af0('0x40')][_0x3af0('0xa9')])+'Queue']['findAll'](_0x1e63c8);case _0x3af0('0x2e'):case'agent':return _0x170c70[_0x3af0('0xa3')+_[_0x3af0('0xaa')](_0x27e66e[_0x3af0('0x40')][_0x3af0('0xa9')])+_0x3af0('0xab')](_0x1e63c8);}})[_0x3af0('0x13')](function(_0x2c2e5e){return{'count':_0x6a1681,'rows':_0x2c2e5e};})['then'](respondWithResult(_0x2cb1b8,null))[_0x3af0('0x1e')](handleError(_0x2cb1b8,null));};exports[_0x3af0('0xd6')]=function(_0x4f00eb,_0x24d419){var _0x41811a={};var _0x4e9f5c={};var _0x1b3b5e;var _0x138430;return db[_0x3af0('0x3b')][_0x3af0('0x91')]({'where':{'id':_0x4f00eb['params']['id']}})[_0x3af0('0x13')](handleEntityNotFound(_0x24d419,null))[_0x3af0('0x13')](function(_0x5d19a1){if(_0x5d19a1){_0x1b3b5e=_0x5d19a1;_0x4e9f5c[_0x3af0('0x52')]=_[_0x3af0('0xd3')](db[_0x3af0('0xa7')][_0x3af0('0x3c')]);_0x4e9f5c[_0x3af0('0x40')]=_['keys'](_0x4f00eb['query']);_0x4e9f5c[_0x3af0('0xc6')]=_['intersection'](_0x4e9f5c['model'],_0x4e9f5c[_0x3af0('0x40')]);_0x41811a['attributes']=_[_0x3af0('0x53')](_0x4e9f5c[_0x3af0('0x52')],qs['fields'](_0x4f00eb[_0x3af0('0x40')][_0x3af0('0x54')]));_0x41811a[_0x3af0('0x44')]=_0x41811a[_0x3af0('0x44')][_0x3af0('0x49')]?_0x41811a['attributes']:_0x4e9f5c[_0x3af0('0x52')];_0x41811a[_0x3af0('0xc7')]=qs[_0x3af0('0xc8')](_0x4f00eb[_0x3af0('0x40')][_0x3af0('0xc8')]);_0x41811a[_0x3af0('0xc9')]=qs['filters'](_[_0x3af0('0xca')](_0x4f00eb[_0x3af0('0x40')],_0x4e9f5c['filters']));if(_0x4f00eb[_0x3af0('0x40')][_0x3af0('0x33')]){_0x41811a[_0x3af0('0xc9')]=_[_0x3af0('0x56')](_0x41811a[_0x3af0('0xc9')],{'$or':_[_0x3af0('0x34')](_0x41811a[_0x3af0('0x44')],function(_0x20db42){var _0x3bb74e={};_0x3bb74e[_0x20db42]={'$like':'%'+_0x4f00eb[_0x3af0('0x40')][_0x3af0('0x33')]+'%'};return _0x3bb74e;})});}_0x41811a=_[_0x3af0('0x56')]({},_0x41811a,_0x4f00eb['options']);return _0x1b3b5e[_0x3af0('0xd6')](_0x41811a);}})[_0x3af0('0x13')](function(_0x4c0220){if(_0x4c0220){_0x138430=_0x4c0220[_0x3af0('0x49')];if(!_0x4f00eb[_0x3af0('0x40')][_0x3af0('0xcc')](_0x3af0('0xd2'))){_0x41811a[_0x3af0('0x23')]=qs[_0x3af0('0x23')](_0x4f00eb[_0x3af0('0x40')][_0x3af0('0x23')]);_0x41811a[_0x3af0('0x24')]=qs[_0x3af0('0x24')](_0x4f00eb[_0x3af0('0x40')][_0x3af0('0x24')]);}return _0x1b3b5e['getVoiceQueuesRt'](_0x41811a);}})[_0x3af0('0x13')](function(_0x24b989){if(_0x24b989){return _0x24b989?{'count':_0x138430,'rows':_0x24b989}:null;}})['then'](respondWithResult(_0x24d419,null))['catch'](handleError(_0x24d419,null));};exports[_0x3af0('0xd7')]=function(_0x152573,_0xd111a9){var _0xac9c5b={};var _0x4a0724={};var _0x447a56;var _0x42776b;return db[_0x3af0('0x3b')][_0x3af0('0x91')]({'where':{'id':_0x152573[_0x3af0('0x51')]['id']}})[_0x3af0('0x13')](handleEntityNotFound(_0xd111a9,null))['then'](function(_0x103416){if(_0x103416){_0x447a56=_0x103416;_0x4a0724[_0x3af0('0x52')]=_[_0x3af0('0xd3')](db[_0x3af0('0xd8')][_0x3af0('0x3c')]);_0x4a0724[_0x3af0('0x40')]=_[_0x3af0('0xd3')](_0x152573[_0x3af0('0x40')]);_0x4a0724[_0x3af0('0xc6')]=_['intersection'](_0x4a0724[_0x3af0('0x52')],_0x4a0724[_0x3af0('0x40')]);_0xac9c5b[_0x3af0('0x44')]=_[_0x3af0('0x53')](_0x4a0724['model'],qs[_0x3af0('0x54')](_0x152573[_0x3af0('0x40')][_0x3af0('0x54')]));_0xac9c5b['attributes']=_0xac9c5b[_0x3af0('0x44')][_0x3af0('0x49')]?_0xac9c5b['attributes']:_0x4a0724[_0x3af0('0x52')];_0xac9c5b[_0x3af0('0xc7')]=qs[_0x3af0('0xc8')](_0x152573['query'][_0x3af0('0xc8')]);_0xac9c5b[_0x3af0('0xc9')]=qs[_0x3af0('0xc6')](_[_0x3af0('0xca')](_0x152573[_0x3af0('0x40')],_0x4a0724[_0x3af0('0xc6')]));if(_0x152573[_0x3af0('0x40')][_0x3af0('0x33')]){_0xac9c5b['where']=_[_0x3af0('0x56')](_0xac9c5b['where'],{'$or':_[_0x3af0('0x34')](_0xac9c5b['attributes'],function(_0x284d06){var _0x27106b={};_0x27106b[_0x284d06]={'$like':'%'+_0x152573[_0x3af0('0x40')]['filter']+'%'};return _0x27106b;})});}_0xac9c5b=_[_0x3af0('0x56')]({},_0xac9c5b,_0x152573[_0x3af0('0x57')]);return _0x447a56['getGroups'](_0xac9c5b);}})[_0x3af0('0x13')](function(_0x8ca4e5){if(_0x8ca4e5){_0x42776b=_0x8ca4e5[_0x3af0('0x49')];if(!_0x152573[_0x3af0('0x40')]['hasOwnProperty'](_0x3af0('0xd2'))){_0xac9c5b['limit']=qs['limit'](_0x152573['query'][_0x3af0('0x23')]);_0xac9c5b[_0x3af0('0x24')]=qs[_0x3af0('0x24')](_0x152573[_0x3af0('0x40')][_0x3af0('0x24')]);}return _0x447a56[_0x3af0('0xd7')](_0xac9c5b);}})[_0x3af0('0x13')](function(_0x57c123){if(_0x57c123){return _0x57c123?{'count':_0x42776b,'rows':_0x57c123}:null;}})[_0x3af0('0x13')](respondWithResult(_0xd111a9,null))[_0x3af0('0x1e')](handleError(_0xd111a9,null));};exports[_0x3af0('0xd9')]=function(_0x20b492,_0x3a83cd){var _0x540dec={'raw':!![],'where':{}};var _0x2dc541={};var _0x1d5fbc={'count':0x0,'rows':[]};return db[_0x3af0('0x3b')][_0x3af0('0x91')]({'where':{'id':_0x20b492[_0x3af0('0x51')]['id']}})['then'](handleEntityNotFound(_0x3a83cd,null))[_0x3af0('0x13')](function(_0x2a4530){if(_0x2a4530){_0x2dc541[_0x3af0('0x52')]=_[_0x3af0('0xd3')](db['VoiceRecording'][_0x3af0('0x3c')]);_0x2dc541[_0x3af0('0x40')]=_[_0x3af0('0xd3')](_0x20b492[_0x3af0('0x40')]);_0x2dc541['filters']=_[_0x3af0('0x53')](_0x2dc541['model'],_0x2dc541['query']);_0x540dec[_0x3af0('0x44')]=_[_0x3af0('0x53')](_0x2dc541['model'],qs[_0x3af0('0x54')](_0x20b492['query'][_0x3af0('0x54')]));_0x540dec['attributes']=_0x540dec[_0x3af0('0x44')][_0x3af0('0x49')]?_0x540dec[_0x3af0('0x44')]:_0x2dc541['model'];if(!_0x20b492[_0x3af0('0x40')][_0x3af0('0xcc')](_0x3af0('0xd2'))){_0x540dec[_0x3af0('0x23')]=qs['limit'](_0x20b492['query']['limit']);_0x540dec[_0x3af0('0x24')]=qs[_0x3af0('0x24')](_0x20b492[_0x3af0('0x40')][_0x3af0('0x24')]);}_0x540dec[_0x3af0('0xc7')]=qs[_0x3af0('0xc8')](_0x20b492[_0x3af0('0x40')][_0x3af0('0xc8')]);_0x540dec[_0x3af0('0xc9')]=qs[_0x3af0('0xc6')](_[_0x3af0('0xca')](_0x20b492['query'],_0x2dc541[_0x3af0('0xc6')]));_0x540dec['where'][_0x3af0('0xda')]=_0x2a4530['id'];if(_0x20b492[_0x3af0('0x40')][_0x3af0('0x33')]){_0x540dec[_0x3af0('0xc9')]=_[_0x3af0('0x56')](_0x540dec[_0x3af0('0xc9')],{'$or':_[_0x3af0('0x34')](_0x540dec[_0x3af0('0x44')],function(_0x3b18f8){var _0x5280f0={};_0x5280f0[_0x3b18f8]={'$like':'%'+_0x20b492[_0x3af0('0x40')][_0x3af0('0x33')]+'%'};return _0x5280f0;})});}_0x540dec=_[_0x3af0('0x56')]({},_0x540dec,_0x20b492[_0x3af0('0x57')]);return db['VoiceRecording']['count']({'where':_0x540dec[_0x3af0('0xc9')]})[_0x3af0('0x13')](function(_0x35c9e6){_0x1d5fbc[_0x3af0('0x25')]=_0x35c9e6;if(_0x20b492[_0x3af0('0x40')][_0x3af0('0x55')]){_0x540dec[_0x3af0('0x41')]=[{'all':!![]}];}return db[_0x3af0('0xdb')][_0x3af0('0x46')](_0x540dec);})['then'](function(_0x38af84){_0x1d5fbc['rows']=_0x38af84;return _0x1d5fbc;});}})[_0x3af0('0x13')](respondWithFilteredResult(_0x3a83cd,_0x540dec))['catch'](handleError(_0x3a83cd,null));};exports[_0x3af0('0xdc')]=function(_0x6570c9,_0x525c92){var _0x41fcbf={'raw':!![],'where':{}};var _0x381bd4={};var _0x3369cb={'count':0x0,'rows':[]};return db['User'][_0x3af0('0x91')]({'where':{'id':_0x6570c9[_0x3af0('0x51')]['id']}})[_0x3af0('0x13')](handleEntityNotFound(_0x525c92,null))[_0x3af0('0x13')](function(_0x2cf143){if(_0x2cf143){_0x381bd4[_0x3af0('0x52')]=_[_0x3af0('0xd3')](db[_0x3af0('0xdd')][_0x3af0('0x3c')]);_0x381bd4[_0x3af0('0x40')]=_[_0x3af0('0xd3')](_0x6570c9[_0x3af0('0x40')]);_0x381bd4['filters']=_[_0x3af0('0x53')](_0x381bd4[_0x3af0('0x52')],_0x381bd4[_0x3af0('0x40')]);_0x41fcbf['attributes']=_[_0x3af0('0x53')](_0x381bd4[_0x3af0('0x52')],qs[_0x3af0('0x54')](_0x6570c9['query']['fields']));_0x41fcbf['attributes']=_0x41fcbf[_0x3af0('0x44')][_0x3af0('0x49')]?_0x41fcbf[_0x3af0('0x44')]:_0x381bd4[_0x3af0('0x52')];if(!_0x6570c9[_0x3af0('0x40')][_0x3af0('0xcc')](_0x3af0('0xd2'))){_0x41fcbf[_0x3af0('0x23')]=qs[_0x3af0('0x23')](_0x6570c9[_0x3af0('0x40')]['limit']);_0x41fcbf[_0x3af0('0x24')]=qs[_0x3af0('0x24')](_0x6570c9['query'][_0x3af0('0x24')]);}_0x41fcbf[_0x3af0('0xc7')]=qs[_0x3af0('0xc8')](_0x6570c9[_0x3af0('0x40')][_0x3af0('0xc8')]);_0x41fcbf[_0x3af0('0xc9')]=qs[_0x3af0('0xc6')](_['pick'](_0x6570c9[_0x3af0('0x40')],_0x381bd4['filters']));_0x41fcbf[_0x3af0('0xc9')]['UserId']=_0x2cf143['id'];if(_0x6570c9[_0x3af0('0x40')][_0x3af0('0x33')]){_0x41fcbf['where']=_[_0x3af0('0x56')](_0x41fcbf[_0x3af0('0xc9')],{'$or':_['map'](_0x41fcbf[_0x3af0('0x44')],function(_0x22d924){var _0x477734={};_0x477734[_0x22d924]={'$like':'%'+_0x6570c9[_0x3af0('0x40')][_0x3af0('0x33')]+'%'};return _0x477734;})});}_0x41fcbf=_[_0x3af0('0x56')]({},_0x41fcbf,_0x6570c9['options']);return db[_0x3af0('0xdd')][_0x3af0('0x25')]({'where':_0x41fcbf['where']})[_0x3af0('0x13')](function(_0x1f14f5){_0x3369cb['count']=_0x1f14f5;if(_0x6570c9['query']['includeAll']){_0x41fcbf[_0x3af0('0x41')]=[{'all':!![]}];}return db[_0x3af0('0xdd')][_0x3af0('0x46')](_0x41fcbf);})['then'](function(_0x57b0b4){_0x3369cb[_0x3af0('0x47')]=_0x57b0b4;return _0x3369cb;});}})[_0x3af0('0x13')](respondWithFilteredResult(_0x525c92,_0x41fcbf))['catch'](handleError(_0x525c92,null));};exports[_0x3af0('0xde')]=function(_0x547a5c,_0x3d9e05){var _0x337938={};var _0x5ef40c={};var _0x44ff9f;var _0x594b57;return db[_0x3af0('0x3b')]['findOne']({'where':{'id':_0x547a5c[_0x3af0('0x51')]['id']}})[_0x3af0('0x13')](handleEntityNotFound(_0x3d9e05,null))[_0x3af0('0x13')](function(_0x4f415c){if(_0x4f415c){_0x44ff9f=_0x4f415c;_0x5ef40c[_0x3af0('0x52')]=_[_0x3af0('0xd3')](db[_0x3af0('0xdf')]['rawAttributes']);_0x5ef40c[_0x3af0('0x40')]=_['keys'](_0x547a5c[_0x3af0('0x40')]);_0x5ef40c[_0x3af0('0xc6')]=_['intersection'](_0x5ef40c['model'],_0x5ef40c[_0x3af0('0x40')]);_0x337938['attributes']=_[_0x3af0('0x53')](_0x5ef40c[_0x3af0('0x52')],qs[_0x3af0('0x54')](_0x547a5c[_0x3af0('0x40')][_0x3af0('0x54')]));_0x337938[_0x3af0('0x44')]=_0x337938[_0x3af0('0x44')][_0x3af0('0x49')]?_0x337938[_0x3af0('0x44')]:_0x5ef40c['model'];_0x337938[_0x3af0('0xc7')]=qs[_0x3af0('0xc8')](_0x547a5c[_0x3af0('0x40')][_0x3af0('0xc8')]);_0x337938[_0x3af0('0xc9')]=qs[_0x3af0('0xc6')](_[_0x3af0('0xca')](_0x547a5c['query'],_0x5ef40c[_0x3af0('0xc6')]));if(_0x547a5c['query'][_0x3af0('0x33')]){_0x337938[_0x3af0('0xc9')]=_[_0x3af0('0x56')](_0x337938['where'],{'$or':_[_0x3af0('0x34')](_0x337938[_0x3af0('0x44')],function(_0x461151){var _0x517b79={};_0x517b79[_0x461151]={'$like':'%'+_0x547a5c[_0x3af0('0x40')][_0x3af0('0x33')]+'%'};return _0x517b79;})});}_0x337938=_[_0x3af0('0x56')]({},_0x337938,_0x547a5c[_0x3af0('0x57')]);return _0x44ff9f[_0x3af0('0xde')](_0x337938);}})[_0x3af0('0x13')](function(_0x511a2d){if(_0x511a2d){_0x594b57=_0x511a2d['length'];if(!_0x547a5c['query'][_0x3af0('0xcc')](_0x3af0('0xd2'))){_0x337938[_0x3af0('0x23')]=qs[_0x3af0('0x23')](_0x547a5c[_0x3af0('0x40')]['limit']);_0x337938['offset']=qs[_0x3af0('0x24')](_0x547a5c[_0x3af0('0x40')][_0x3af0('0x24')]);}return _0x44ff9f[_0x3af0('0xde')](_0x337938);}})[_0x3af0('0x13')](function(_0xc0ec3){if(_0xc0ec3){return _0xc0ec3?{'count':_0x594b57,'rows':_0xc0ec3}:null;}})[_0x3af0('0x13')](respondWithResult(_0x3d9e05,null))['catch'](handleError(_0x3d9e05,null));};exports['getOpenchannelInteractions']=function(_0x598cc1,_0x45478e){var _0x1037cb={};var _0x204faa={};var _0x385045;var _0x24feec;return db['User'][_0x3af0('0x91')]({'where':{'id':_0x598cc1[_0x3af0('0x51')]['id']}})[_0x3af0('0x13')](handleEntityNotFound(_0x45478e,null))['then'](function(_0x3bcada){if(_0x3bcada){_0x385045=_0x3bcada;_0x204faa['model']=_[_0x3af0('0xd3')](db[_0x3af0('0xe0')]['rawAttributes']);_0x204faa['query']=_[_0x3af0('0xd3')](_0x598cc1[_0x3af0('0x40')]);_0x204faa[_0x3af0('0xc6')]=_[_0x3af0('0x53')](_0x204faa[_0x3af0('0x52')],_0x204faa[_0x3af0('0x40')]);_0x1037cb[_0x3af0('0x44')]=_['intersection'](_0x204faa[_0x3af0('0x52')],qs[_0x3af0('0x54')](_0x598cc1['query'][_0x3af0('0x54')]));_0x1037cb['attributes']=_0x1037cb[_0x3af0('0x44')][_0x3af0('0x49')]?_0x1037cb[_0x3af0('0x44')]:_0x204faa['model'];_0x1037cb[_0x3af0('0xc7')]=qs['sort'](_0x598cc1['query'][_0x3af0('0xc8')]);_0x1037cb[_0x3af0('0xc9')]=qs[_0x3af0('0xc6')](_['pick'](_0x598cc1[_0x3af0('0x40')],_0x204faa[_0x3af0('0xc6')]));if(_0x598cc1[_0x3af0('0x40')][_0x3af0('0x33')]){_0x1037cb['where']=_[_0x3af0('0x56')](_0x1037cb[_0x3af0('0xc9')],{'$or':_[_0x3af0('0x34')](_0x1037cb[_0x3af0('0x44')],function(_0xb41b07){var _0xa58a4={};_0xa58a4[_0xb41b07]={'$like':'%'+_0x598cc1[_0x3af0('0x40')][_0x3af0('0x33')]+'%'};return _0xa58a4;})});}_0x1037cb=_[_0x3af0('0x56')]({},_0x1037cb,_0x598cc1[_0x3af0('0x57')]);return _0x385045[_0x3af0('0xe1')](_0x1037cb);}})[_0x3af0('0x13')](function(_0xf81b69){if(_0xf81b69){_0x24feec=_0xf81b69[_0x3af0('0x49')];if(!_0x598cc1[_0x3af0('0x40')][_0x3af0('0xcc')](_0x3af0('0xd2'))){_0x1037cb[_0x3af0('0x23')]=qs[_0x3af0('0x23')](_0x598cc1[_0x3af0('0x40')]['limit']);_0x1037cb['offset']=qs[_0x3af0('0x24')](_0x598cc1[_0x3af0('0x40')][_0x3af0('0x24')]);}return _0x385045[_0x3af0('0xe1')](_0x1037cb);}})[_0x3af0('0x13')](function(_0x26336f){if(_0x26336f){return _0x26336f?{'count':_0x24feec,'rows':_0x26336f}:null;}})['then'](respondWithResult(_0x45478e,null))['catch'](handleError(_0x45478e,null));};exports[_0x3af0('0xe2')]=function(_0x397611,_0x196035){var _0x1e1eb0={'raw':!![],'where':{}};var _0x490393={};var _0x1def57={'count':0x0,'rows':[]};return db[_0x3af0('0x3b')]['findOne']({'where':{'id':_0x397611[_0x3af0('0x51')]['id']}})['then'](handleEntityNotFound(_0x196035,null))[_0x3af0('0x13')](function(_0x4b9f7d){if(_0x4b9f7d){_0x490393[_0x3af0('0x52')]=_['keys'](db[_0x3af0('0xe3')][_0x3af0('0x3c')]);_0x490393['query']=_[_0x3af0('0xd3')](_0x397611[_0x3af0('0x40')]);_0x490393[_0x3af0('0xc6')]=_[_0x3af0('0x53')](_0x490393['model'],_0x490393[_0x3af0('0x40')]);_0x1e1eb0[_0x3af0('0x44')]=_['intersection'](_0x490393['model'],qs[_0x3af0('0x54')](_0x397611[_0x3af0('0x40')][_0x3af0('0x54')]));_0x1e1eb0[_0x3af0('0x44')]=_0x1e1eb0[_0x3af0('0x44')][_0x3af0('0x49')]?_0x1e1eb0['attributes']:_0x490393['model'];if(!_0x397611[_0x3af0('0x40')]['hasOwnProperty'](_0x3af0('0xd2'))){_0x1e1eb0[_0x3af0('0x23')]=qs[_0x3af0('0x23')](_0x397611[_0x3af0('0x40')][_0x3af0('0x23')]);_0x1e1eb0[_0x3af0('0x24')]=qs['offset'](_0x397611[_0x3af0('0x40')][_0x3af0('0x24')]);}_0x1e1eb0[_0x3af0('0xc7')]=qs['sort'](_0x397611[_0x3af0('0x40')]['sort']);_0x1e1eb0['where']=qs['filters'](_[_0x3af0('0xca')](_0x397611[_0x3af0('0x40')],_0x490393['filters']));_0x1e1eb0[_0x3af0('0xc9')][_0x3af0('0xda')]=_0x4b9f7d['id'];if(_0x397611[_0x3af0('0x40')][_0x3af0('0x33')]){_0x1e1eb0['where']=_[_0x3af0('0x56')](_0x1e1eb0[_0x3af0('0xc9')],{'$or':_['map'](_0x1e1eb0[_0x3af0('0x44')],function(_0x16a56e){var _0x4cc525={};_0x4cc525[_0x16a56e]={'$like':'%'+_0x397611[_0x3af0('0x40')][_0x3af0('0x33')]+'%'};return _0x4cc525;})});}_0x1e1eb0=_[_0x3af0('0x56')]({},_0x1e1eb0,_0x397611[_0x3af0('0x57')]);return db[_0x3af0('0xe3')][_0x3af0('0x25')]({'where':_0x1e1eb0[_0x3af0('0xc9')]})['then'](function(_0xabd103){_0x1def57[_0x3af0('0x25')]=_0xabd103;if(_0x397611['query'][_0x3af0('0x55')]){_0x1e1eb0[_0x3af0('0x41')]=[{'all':!![]}];}return db[_0x3af0('0xe3')][_0x3af0('0x46')](_0x1e1eb0);})[_0x3af0('0x13')](function(_0x36e697){_0x1def57[_0x3af0('0x47')]=_0x36e697;return _0x1def57;});}})[_0x3af0('0x13')](respondWithFilteredResult(_0x196035,_0x1e1eb0))[_0x3af0('0x1e')](handleError(_0x196035,null));};exports[_0x3af0('0xe4')]=function(_0x32a8df,_0x4c2dc0){var _0x411eee={};var _0x57fc09={};var _0x374f95;var _0x511eff;return db[_0x3af0('0x3b')]['findOne']({'where':{'id':_0x32a8df[_0x3af0('0x51')]['id']}})[_0x3af0('0x13')](handleEntityNotFound(_0x4c2dc0,null))['then'](function(_0x8a20a2){if(_0x8a20a2){_0x374f95=_0x8a20a2;_0x57fc09[_0x3af0('0x52')]=_[_0x3af0('0xd3')](db[_0x3af0('0xe5')][_0x3af0('0x3c')]);_0x57fc09[_0x3af0('0x40')]=_[_0x3af0('0xd3')](_0x32a8df[_0x3af0('0x40')]);_0x57fc09[_0x3af0('0xc6')]=_['intersection'](_0x57fc09['model'],_0x57fc09[_0x3af0('0x40')]);_0x411eee[_0x3af0('0x44')]=_['intersection'](_0x57fc09[_0x3af0('0x52')],qs[_0x3af0('0x54')](_0x32a8df[_0x3af0('0x40')][_0x3af0('0x54')]));_0x411eee[_0x3af0('0x44')]=_0x411eee[_0x3af0('0x44')][_0x3af0('0x49')]?_0x411eee[_0x3af0('0x44')]:_0x57fc09[_0x3af0('0x52')];_0x411eee['order']=qs['sort'](_0x32a8df['query']['sort']);_0x411eee[_0x3af0('0xc9')]=qs[_0x3af0('0xc6')](_[_0x3af0('0xca')](_0x32a8df[_0x3af0('0x40')],_0x57fc09[_0x3af0('0xc6')]));if(_0x32a8df[_0x3af0('0x40')][_0x3af0('0x33')]){_0x411eee[_0x3af0('0xc9')]=_[_0x3af0('0x56')](_0x411eee[_0x3af0('0xc9')],{'$or':_[_0x3af0('0x34')](_0x411eee[_0x3af0('0x44')],function(_0x4b614f){var _0x34dc9d={};_0x34dc9d[_0x4b614f]={'$like':'%'+_0x32a8df[_0x3af0('0x40')][_0x3af0('0x33')]+'%'};return _0x34dc9d;})});}_0x411eee=_[_0x3af0('0x56')]({},_0x411eee,_0x32a8df[_0x3af0('0x57')]);return _0x374f95[_0x3af0('0xe4')](_0x411eee);}})[_0x3af0('0x13')](function(_0x3c0eca){if(_0x3c0eca){_0x511eff=_0x3c0eca[_0x3af0('0x49')];if(!_0x32a8df[_0x3af0('0x40')]['hasOwnProperty'](_0x3af0('0xd2'))){_0x411eee['limit']=qs[_0x3af0('0x23')](_0x32a8df[_0x3af0('0x40')][_0x3af0('0x23')]);_0x411eee[_0x3af0('0x24')]=qs[_0x3af0('0x24')](_0x32a8df[_0x3af0('0x40')][_0x3af0('0x24')]);}return _0x374f95['getSmsInteractions'](_0x411eee);}})['then'](function(_0x2a4169){if(_0x2a4169){return _0x2a4169?{'count':_0x511eff,'rows':_0x2a4169}:null;}})[_0x3af0('0x13')](respondWithResult(_0x4c2dc0,null))[_0x3af0('0x1e')](handleError(_0x4c2dc0,null));};exports[_0x3af0('0xe6')]=function(_0x591885,_0x2d4dc2){var _0x46f8da={};var _0x4f69c4={};var _0x3f9bc4;var _0x9ac809;return db[_0x3af0('0x3b')][_0x3af0('0x91')]({'where':{'id':_0x591885[_0x3af0('0x51')]['id']}})['then'](handleEntityNotFound(_0x2d4dc2,null))[_0x3af0('0x13')](function(_0x2662f2){if(_0x2662f2){_0x3f9bc4=_0x2662f2;_0x4f69c4['model']=_[_0x3af0('0xd3')](db[_0x3af0('0xe7')][_0x3af0('0x3c')]);_0x4f69c4[_0x3af0('0x40')]=_['keys'](_0x591885[_0x3af0('0x40')]);_0x4f69c4[_0x3af0('0xc6')]=_['intersection'](_0x4f69c4['model'],_0x4f69c4[_0x3af0('0x40')]);_0x46f8da[_0x3af0('0x44')]=_[_0x3af0('0x53')](_0x4f69c4[_0x3af0('0x52')],qs[_0x3af0('0x54')](_0x591885[_0x3af0('0x40')][_0x3af0('0x54')]));_0x46f8da['attributes']=_0x46f8da[_0x3af0('0x44')]['length']?_0x46f8da[_0x3af0('0x44')]:_0x4f69c4['model'];_0x46f8da[_0x3af0('0xc7')]=qs[_0x3af0('0xc8')](_0x591885[_0x3af0('0x40')][_0x3af0('0xc8')]);_0x46f8da[_0x3af0('0xc9')]=qs[_0x3af0('0xc6')](_[_0x3af0('0xca')](_0x591885[_0x3af0('0x40')],_0x4f69c4['filters']));if(_0x591885[_0x3af0('0x40')][_0x3af0('0x33')]){_0x46f8da[_0x3af0('0xc9')]=_[_0x3af0('0x56')](_0x46f8da[_0x3af0('0xc9')],{'$or':_[_0x3af0('0x34')](_0x46f8da['attributes'],function(_0x134b57){var _0x1110ac={};_0x1110ac[_0x134b57]={'$like':'%'+_0x591885[_0x3af0('0x40')]['filter']+'%'};return _0x1110ac;})});}_0x46f8da=_[_0x3af0('0x56')]({},_0x46f8da,_0x591885[_0x3af0('0x57')]);return _0x3f9bc4[_0x3af0('0xe6')](_0x46f8da);}})[_0x3af0('0x13')](function(_0x1897ca){if(_0x1897ca){_0x9ac809=_0x1897ca['length'];if(!_0x591885[_0x3af0('0x40')]['hasOwnProperty']('nolimit')){_0x46f8da['limit']=qs[_0x3af0('0x23')](_0x591885['query'][_0x3af0('0x23')]);_0x46f8da[_0x3af0('0x24')]=qs[_0x3af0('0x24')](_0x591885[_0x3af0('0x40')]['offset']);}return _0x3f9bc4['getFaxInteractions'](_0x46f8da);}})[_0x3af0('0x13')](function(_0x2acb4f){if(_0x2acb4f){return _0x2acb4f?{'count':_0x9ac809,'rows':_0x2acb4f}:null;}})[_0x3af0('0x13')](respondWithResult(_0x2d4dc2,null))[_0x3af0('0x1e')](handleError(_0x2d4dc2,null));};exports['getWhatsappInteractions']=function(_0xbe6762,_0x1d377a){var _0x181bff={};var _0x5d9466={};var _0x7e6201;var _0x2d7d4c;return db['User'][_0x3af0('0x91')]({'where':{'id':_0xbe6762[_0x3af0('0x51')]['id']}})[_0x3af0('0x13')](handleEntityNotFound(_0x1d377a,null))[_0x3af0('0x13')](function(_0x22876e){if(_0x22876e){_0x7e6201=_0x22876e;_0x5d9466[_0x3af0('0x52')]=_[_0x3af0('0xd3')](db[_0x3af0('0xe8')]['rawAttributes']);_0x5d9466[_0x3af0('0x40')]=_['keys'](_0xbe6762['query']);_0x5d9466[_0x3af0('0xc6')]=_[_0x3af0('0x53')](_0x5d9466[_0x3af0('0x52')],_0x5d9466[_0x3af0('0x40')]);_0x181bff[_0x3af0('0x44')]=_[_0x3af0('0x53')](_0x5d9466['model'],qs[_0x3af0('0x54')](_0xbe6762['query'][_0x3af0('0x54')]));_0x181bff[_0x3af0('0x44')]=_0x181bff['attributes'][_0x3af0('0x49')]?_0x181bff[_0x3af0('0x44')]:_0x5d9466[_0x3af0('0x52')];_0x181bff['order']=qs[_0x3af0('0xc8')](_0xbe6762[_0x3af0('0x40')][_0x3af0('0xc8')]);_0x181bff[_0x3af0('0xc9')]=qs[_0x3af0('0xc6')](_[_0x3af0('0xca')](_0xbe6762[_0x3af0('0x40')],_0x5d9466[_0x3af0('0xc6')]));if(_0xbe6762[_0x3af0('0x40')][_0x3af0('0x33')]){_0x181bff[_0x3af0('0xc9')]=_[_0x3af0('0x56')](_0x181bff['where'],{'$or':_[_0x3af0('0x34')](_0x181bff['attributes'],function(_0x14a517){var _0x21bbdc={};_0x21bbdc[_0x14a517]={'$like':'%'+_0xbe6762[_0x3af0('0x40')][_0x3af0('0x33')]+'%'};return _0x21bbdc;})});}_0x181bff=_[_0x3af0('0x56')]({},_0x181bff,_0xbe6762[_0x3af0('0x57')]);return _0x7e6201[_0x3af0('0xe9')](_0x181bff);}})['then'](function(_0x43e437){if(_0x43e437){_0x2d7d4c=_0x43e437[_0x3af0('0x49')];if(!_0xbe6762[_0x3af0('0x40')]['hasOwnProperty'](_0x3af0('0xd2'))){_0x181bff[_0x3af0('0x23')]=qs[_0x3af0('0x23')](_0xbe6762[_0x3af0('0x40')]['limit']);_0x181bff[_0x3af0('0x24')]=qs[_0x3af0('0x24')](_0xbe6762[_0x3af0('0x40')][_0x3af0('0x24')]);}return _0x7e6201[_0x3af0('0xe9')](_0x181bff);}})['then'](function(_0x456d27){if(_0x456d27){return _0x456d27?{'count':_0x2d7d4c,'rows':_0x456d27}:null;}})['then'](respondWithResult(_0x1d377a,null))[_0x3af0('0x1e')](handleError(_0x1d377a,null));};exports['login']=function(_0x23919e,_0x27398d,_0x4e51b1){var _0x52f431;var _0xc798f3;var _0x2ad265;var _0x218922=!_['isNil'](_0x23919e[_0x3af0('0x51')]['id'])?_0x23919e[_0x3af0('0x51')]['id']:!_['isNil'](_0x23919e[_0x3af0('0x2e')]['id'])?_0x23919e[_0x3af0('0x2e')]['id']:null;return db[_0x3af0('0x3b')][_0x3af0('0x38')]({'where':{'id':_0x218922,'role':{'$or':['admin','user','agent']}},'attributes':['id',_0x3af0('0x3a'),_0x3af0('0xea'),_0x3af0('0xeb'),'role','internal','loginInPause']})[_0x3af0('0x13')](function(_0x3c1abd){if(_0x3c1abd){if(_0x3c1abd[_0x3af0('0x37')]==='agent'){_0x52f431=_0x3c1abd;if(_0x23919e[_0x3af0('0x5a')]['interface']){_0x2ad265=util['format'](_0x3af0('0xec'),_0x52f431[_0x23919e[_0x3af0('0x5a')][_0x3af0('0x99')]]);}else if(_0x23919e[_0x3af0('0x5a')][_0x3af0('0xed')]){_0x2ad265=util['format'](_0x3af0('0xa5'),_0x23919e[_0x3af0('0x5a')][_0x3af0('0xed')]);}else{_0x2ad265=util[_0x3af0('0xa4')](_0x3af0('0xa5'),_0x52f431[_0x3af0('0x3a')]);}socket['to'](util[_0x3af0('0xa4')](_0x3af0('0xee'),_0x52f431[_0x3af0('0x3a')]))['emit'](_0x3af0('0xef'),{'user':{'id':_0x52f431['id'],'name':_0x52f431['name']},'ip':_0x23919e['headers'][_0x3af0('0xf0')]||_0x23919e[_0x3af0('0xf1')][_0x3af0('0xf2')]||_0x23919e[_0x3af0('0xf3')]['remoteAddress']||_0x23919e[_0x3af0('0xf1')][_0x3af0('0xf3')]['remoteAddress']});return db['UserVoiceQueueRt'][_0x3af0('0x2b')]({'where':{'membername':_0x52f431['name']},'individualHooks':!![]});}}else{throw new db[(_0x3af0('0x8a'))][(_0x3af0('0x8b'))](_0x3af0('0xf4'));}})[_0x3af0('0x13')](function(){if(_0x52f431){return _0x52f431[_0x3af0('0xf5')]({'raw':!![]});}})[_0x3af0('0x13')](function(_0xd52d39){if(_0x52f431){if(_0xd52d39){_0xc798f3=_0xd52d39;if(_0xc798f3[_0x3af0('0x49')]){var _0x1216de=_0xc798f3[_0x3af0('0x34')](function(_0x302761){var _0x1a2f6a={'membername':_0x52f431[_0x3af0('0x3a')],'UserId':_0x52f431['id'],'queue_name':_0x302761[_0x3af0('0x3a')],'VoiceQueueId':_0x302761['id'],'interface':_0x2ad265,'paused':_0x52f431[_0x3af0('0xf6')]||![],'penalty':_0x302761[_0x3af0('0xf7')]||0x0};return db[_0x3af0('0xa7')][_0x3af0('0xa8')](_0x1a2f6a);});return Promise[_0x3af0('0x59')](_0x1216de);}}}})['then'](function(){if(_0x52f431){return db['MemberReport']['findAll']({'where':{'membername':_0x52f431[_0x3af0('0x3a')],'exitAt':null}});}})[_0x3af0('0x13')](function(_0x2526cb){if(_0x52f431){var _0x34aac4=[];_0x2526cb[_0x3af0('0xf8')](function(_0xa9e294){_0x34aac4[_0x3af0('0x45')](_0xa9e294[_0x3af0('0x28')]({'exitAt':moment()[_0x3af0('0xa4')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x3af0('0x59')](_0x34aac4);}})['then'](function(){if(_0x52f431){var _0x5e59a9=[];var _0x5695bd=[];var _0x2a985e=utils[_0x3af0('0xf9')]();var _0x256dbc={'membername':_0x52f431[_0x3af0('0x3a')],'interface':_0x2ad265,'enterAt':moment()[_0x3af0('0xa4')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x52f431[_0x3af0('0x37')],'internal':_0x52f431[_0x3af0('0x5f')]};_0x2a985e[_0x3af0('0xf8')](function(_0x71557f){_0x5e59a9['push'](_[_0x3af0('0x56')]({'channel':_0x71557f,'type':'LOGIN','data1':_0x23919e[_0x3af0('0x5a')][_0x3af0('0xfa')],'data2':_0x2ad265},_0x256dbc));if(_0x52f431[_0x3af0('0xf6')]){_0x5695bd['push'](_[_0x3af0('0x56')]({'channel':_0x71557f,'type':_0x3af0('0xfb'),'data1':_0x3af0('0xfc')},_0x256dbc));}});return db[_0x3af0('0xfd')][_0x3af0('0x7f')](_0x5e59a9[_0x3af0('0xc4')](_0x5695bd),{'individualHooks':!![]});}})['then'](function(){if(_0x52f431){return _0x52f431['update']({'online':!![],'lastLoginAt':moment()[_0x3af0('0xa4')](_0x3af0('0xfe')),'voicePause':_0x52f431[_0x3af0('0xf6')]||![],'mailPause':_0x52f431[_0x3af0('0xf6')]||![],'chatPause':_0x52f431['loginInPause']||![],'faxPause':_0x52f431['loginInPause']||![],'smsPause':_0x52f431['loginInPause']||![],'openchannelPause':_0x52f431[_0x3af0('0xf6')]||![],'whatsappPause':_0x52f431[_0x3af0('0xf6')]||![],'pauseType':_0x52f431[_0x3af0('0xf6')]?_0x3af0('0xfc'):null,'interface':_0x2ad265,'lastPauseAt':moment()['format'](_0x3af0('0xfe'))});}})[_0x3af0('0x13')](function(_0x3f1259){if(_0x23919e[_0x3af0('0xff')]){return _0x4e51b1();}else{return Promise[_0x3af0('0x100')](_0x3f1259)[_0x3af0('0x13')](respondWithResult(_0x27398d,null));}})['catch'](handleError(_0x27398d,null));};exports[_0x3af0('0x101')]=function(_0x31452a,_0x330b44){var _0x1bc2e1;return db['User'][_0x3af0('0x38')]({'where':{'id':_0x31452a['params']['id'],'role':_0x3af0('0x30')},'attributes':['id',_0x3af0('0x3a'),_0x3af0('0x37')]})[_0x3af0('0x13')](handleEntityNotFound(_0x330b44,null))['then'](function(_0x1b6b60){if(_0x1b6b60){_0x1bc2e1=_0x1b6b60;return db['UserVoiceQueueRt'][_0x3af0('0x2b')]({'where':{'membername':_0x1bc2e1['name']},'individualHooks':!![]});}})[_0x3af0('0x13')](function(){return db[_0x3af0('0xfd')][_0x3af0('0x46')]({'where':{'membername':_0x1bc2e1[_0x3af0('0x3a')],'exitAt':null}});})[_0x3af0('0x13')](function(_0x1b77a1){var _0x557688=[];_0x1b77a1[_0x3af0('0xf8')](function(_0x1ce57f){_0x557688['push'](_0x1ce57f['update']({'exitAt':moment()[_0x3af0('0xa4')](_0x3af0('0xfe'))}));});return Promise[_0x3af0('0x59')](_0x557688);})[_0x3af0('0x13')](function(){return _0x1bc2e1[_0x3af0('0x28')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x3af0('0x13')](respondWithResult(_0x330b44,null))[_0x3af0('0x1e')](handleError(_0x330b44,null));};exports['pause']=function(_0x420619,_0x24aa4a){var _0x3184e4;return db[_0x3af0('0xa7')][_0x3af0('0x28')]({'paused':0x1},{'where':{'UserId':_0x420619[_0x3af0('0x51')]['id']},'individualHooks':!![]})[_0x3af0('0x13')](function(){return db['User']['find']({'where':{'id':_0x420619[_0x3af0('0x51')]['id'],'role':_0x3af0('0x30')},'attributes':['id',_0x3af0('0x3a'),_0x3af0('0x37'),_0x3af0('0x5f'),_0x3af0('0x99'),_0x3af0('0x98')]});})[_0x3af0('0x13')](handleEntityNotFound(_0x24aa4a,null))['then'](function(_0x33a91b){if(_0x33a91b){_0x3184e4=_0x33a91b;return respondWithRpcPromise(_0x3af0('0x102'),'pause',{'id':_0x3184e4['id'],'name':_0x3184e4[_0x3af0('0x3a')],'pause':!![]});}})[_0x3af0('0x13')](function(){if(_0x3184e4){return db['MemberReport'][_0x3af0('0x46')]({'where':{'membername':_0x3184e4[_0x3af0('0x3a')],'type':_0x3af0('0xfb'),'exitAt':null}});}})[_0x3af0('0x13')](function(_0x172715){if(_0x172715['length']){var _0x1ddceb=moment()['format'](_0x3af0('0xfe'));for(var _0x3ec2da=0x0,_0x56f9b8=_0x172715[_0x3af0('0x49')];_0x3ec2da<_0x56f9b8;_0x3ec2da++){_0x172715[_0x3ec2da][_0x3af0('0x103')]({'exitAt':_0x1ddceb});}}})[_0x3af0('0x13')](function(){var _0x4366db=[];var _0x5a1280=utils[_0x3af0('0xf9')]();_0x5a1280[_0x3af0('0xf8')](function(_0x2290b2){_0x4366db[_0x3af0('0x45')]({'channel':_0x2290b2,'membername':_0x3184e4['name'],'interface':_['isNil'](_0x3184e4[_0x3af0('0x99')])?util[_0x3af0('0xa4')]('SIP/%s',_0x3184e4[_0x3af0('0x3a')]):_0x3184e4[_0x3af0('0x99')],'type':_0x3af0('0xfb'),'enterAt':moment()[_0x3af0('0xa4')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x420619[_0x3af0('0x5a')][_0x3af0('0x3d')]||'DEFAULT\x20PAUSE','role':_0x3184e4[_0x3af0('0x37')],'internal':_0x3184e4[_0x3af0('0x5f')]});});return db['MemberReport'][_0x3af0('0x7f')](_0x4366db,{'individualHooks':!![]});})[_0x3af0('0x13')](function(){return _0x3184e4[_0x3af0('0x28')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x420619[_0x3af0('0x5a')]['type']||_0x3af0('0x104'),'lastPauseAt':moment()[_0x3af0('0xa4')](_0x3af0('0xfe'))});})[_0x3af0('0x13')](respondWithResult(_0x24aa4a,null))[_0x3af0('0x1e')](handleError(_0x24aa4a,null));};exports[_0x3af0('0x105')]=function(_0x360992,_0x1a1c21){if(_0x360992[_0x3af0('0x5a')][_0x3af0('0xa9')]&&!utils['isValidChannel'](_0x360992['body']['channel'])){throw new APIBadRequestError(util[_0x3af0('0xa4')](_0x3af0('0x106'),_0x360992[_0x3af0('0x5a')][_0x3af0('0xa9')]));}return db[_0x3af0('0x3b')]['find']({'where':{'id':_0x360992[_0x3af0('0x51')]['id']},'attributes':['id',_0x3af0('0x3a'),_0x3af0('0x37'),_0x3af0('0x5f'),_0x3af0('0x99'),'online','voicePause',_0x3af0('0x107'),'chatPause',_0x3af0('0x108'),_0x3af0('0x109'),_0x3af0('0x10a'),_0x3af0('0x10b'),_0x3af0('0x10c'),_0x3af0('0x10d')]})[_0x3af0('0x13')](function(_0x23f2b6){if(!_0x23f2b6){throw new APINotFoundError(util[_0x3af0('0xa4')](_0x3af0('0x10e'),_0x360992[_0x3af0('0x51')]['id']));}return _0x23f2b6[_0x3af0('0x105')](_0x360992[_0x3af0('0x5a')][_0x3af0('0xa9')]);})[_0x3af0('0x13')](respondWithResult(_0x1a1c21,null))[_0x3af0('0x1e')](APIHandleError(_0x1a1c21));};exports[_0x3af0('0x10f')]=function(_0x13c6da,_0x16f127){var _0x197fad={};var _0x4f7aff={};var _0x2fc0fa;var _0x247b85;return db['User'][_0x3af0('0x91')]({'where':{'id':_0x13c6da[_0x3af0('0x51')]['id']}})[_0x3af0('0x13')](handleEntityNotFound(_0x16f127,null))[_0x3af0('0x13')](function(_0x31f9a4){if(_0x31f9a4){_0x2fc0fa=_0x31f9a4;_0x4f7aff['model']=_['keys'](db[_0x3af0('0x110')][_0x3af0('0x3c')]);_0x4f7aff['query']=_[_0x3af0('0xd3')](_0x13c6da[_0x3af0('0x40')]);_0x4f7aff['filters']=_[_0x3af0('0x53')](_0x4f7aff['model'],_0x4f7aff['query']);_0x197fad[_0x3af0('0x44')]=_['intersection'](_0x4f7aff['model'],qs[_0x3af0('0x54')](_0x13c6da['query']['fields']));_0x197fad[_0x3af0('0x44')]=_0x197fad[_0x3af0('0x44')]['length']?_0x197fad[_0x3af0('0x44')]:_0x4f7aff[_0x3af0('0x52')];_0x197fad[_0x3af0('0xc7')]=qs['sort'](_0x13c6da[_0x3af0('0x40')][_0x3af0('0xc8')]);_0x197fad[_0x3af0('0xc9')]=qs[_0x3af0('0xc6')](_[_0x3af0('0xca')](_0x13c6da[_0x3af0('0x40')],_0x4f7aff[_0x3af0('0xc6')]));if(_0x13c6da[_0x3af0('0x40')][_0x3af0('0x33')]){_0x197fad[_0x3af0('0xc9')]=_['merge'](_0x197fad['where'],{'$or':_[_0x3af0('0x34')](_0x197fad['attributes'],function(_0x343c76){var _0x387e8a={};_0x387e8a[_0x343c76]={'$like':'%'+_0x13c6da[_0x3af0('0x40')][_0x3af0('0x33')]+'%'};return _0x387e8a;})});}_0x197fad=_[_0x3af0('0x56')]({},_0x197fad,_0x13c6da[_0x3af0('0x57')]);return _0x2fc0fa[_0x3af0('0x10f')](_0x197fad);}})[_0x3af0('0x13')](function(_0x265706){if(_0x265706){_0x247b85=_0x265706[_0x3af0('0x49')];if(!_0x13c6da[_0x3af0('0x40')][_0x3af0('0xcc')]('nolimit')){_0x197fad[_0x3af0('0x23')]=qs[_0x3af0('0x23')](_0x13c6da['query'][_0x3af0('0x23')]);_0x197fad[_0x3af0('0x24')]=qs[_0x3af0('0x24')](_0x13c6da['query']['offset']);}return _0x2fc0fa[_0x3af0('0x10f')](_0x197fad);}})[_0x3af0('0x13')](function(_0x8423a0){if(_0x8423a0){return _0x8423a0?{'count':_0x247b85,'rows':_0x8423a0}:null;}})['then'](respondWithResult(_0x16f127,null))[_0x3af0('0x1e')](handleError(_0x16f127,null));};exports['addTeams']=function(_0x5ecd96,_0x11f28d){var _0x55aad9=_0x5ecd96['params']['id'];var _0x3aff38=_0x5ecd96[_0x3af0('0x5a')]?_0x5ecd96['body'][_0x3af0('0x5d')]:null;var _0x4e504d=[];return Promise[_0x3af0('0x100')]()['then'](function(){if(!_0x3aff38)throw new APIBadRequestError(_0x3af0('0x111'));})[_0x3af0('0x13')](function(){return db['User'][_0x3af0('0x91')]({'where':{'id':_0x55aad9}});})[_0x3af0('0x13')](function(_0x11e0bb){if(!_0x11e0bb)throw new APINotFoundError(util[_0x3af0('0xa4')](_0x3af0('0x10e'),_0x5ecd96[_0x3af0('0x51')]['id']));return db[_0x3af0('0x65')][_0x3af0('0x112')](function(_0xa85ce6){return _0x11e0bb[_0x3af0('0x113')](_0x3aff38,{'transaction':_0xa85ce6})['then'](function(){return db[_0x3af0('0x110')]['findAll']({'where':{'id':{'$in':_0x3aff38}}});})[_0x3af0('0x13')](function(_0x1b95fe){var _0x4c0341=_[_0x3af0('0x34')](_0x1b95fe,function(_0x490c3e){return _0x490c3e[_0x3af0('0x114')]();});return Promise[_0x3af0('0x59')](_0x4c0341);})[_0x3af0('0x13')](function(_0x1e220d){_0x4e504d=_['flattenDeep'](_0x1e220d);var _0x40f270=_[_0x3af0('0x34')](_0x4e504d,function(_0x125e37){return _0x125e37[_0x3af0('0x115')](_0x11e0bb['id'],{'transaction':_0xa85ce6});});return Promise['all'](_0x40f270);})[_0x3af0('0x13')](function(){if(!_0x11e0bb[_0x3af0('0x98')])return;var _0x4272ef=_[_0x3af0('0x33')](_0x4e504d,function(_0x25b811){return _0x25b811[_0x3af0('0x116')](_0x3af0('0xa9'))===_0x3af0('0x117');});var _0x3e7ca3=_[_0x3af0('0x34')](_0x4272ef,function(_0x62c759){return db[_0x3af0('0xa7')]['upsert']({'membername':_0x11e0bb[_0x3af0('0x3a')],'UserId':_0x11e0bb['id'],'queue_name':_0x62c759[_0x3af0('0x3a')],'VoiceQueueId':_0x62c759['id'],'interface':_[_0x3af0('0x64')](_0x11e0bb[_0x3af0('0x99')])?util['format']('SIP/%s',_0x11e0bb[_0x3af0('0x3a')]):_0x11e0bb[_0x3af0('0x99')],'paused':_0x11e0bb[_0x3af0('0xa6')]||![],'penalty':_0x11e0bb[_0x3af0('0x9e')]},{'transaction':_0xa85ce6});});return Promise[_0x3af0('0x59')](_0x3e7ca3);})[_0x3af0('0x13')](function(){return db[_0x3af0('0x118')][_0x3af0('0x46')]({'where':{'teamId':{'$in':_0x3aff38}}});})[_0x3af0('0x13')](function(_0x1e1d5b){var _0x3fe0cd=_[_0x3af0('0x34')](_0x1e1d5b,function(_0x1991f5){return db[_0x3af0('0x119')][_0x3af0('0x78')]({'UserId':_0x11e0bb['id'],'VoicePrefixId':_0x1991f5[_0x3af0('0x11a')]},{'transaction':_0xa85ce6});});return Promise[_0x3af0('0x59')](_0x3fe0cd);});});})[_0x3af0('0x13')](function(){for(var _0x491dad=0x0;_0x491dad<_0x4e504d[_0x3af0('0x49')];_0x491dad++){var _0xfc503d=_0x4e504d[_0x491dad][_0x3af0('0x116')]('channel');var _0x53b352=_0xfc503d+_0x3af0('0x9f');socket['emit'](_0x3af0('0x2e')+_0xfc503d+'Queue:save',{'UserId':_0x55aad9,['queueField']:_0x4e504d[_0x491dad]['id']});}})[_0x3af0('0x13')](respondWithStatusCode(_0x11f28d,null))[_0x3af0('0x1e')](APIHandleError(_0x11f28d));};exports[_0x3af0('0x11b')]=function(_0x7eb9db,_0x52cee1){var _0x3cd3b3=_0x7eb9db['params']['id'];var _0x3bb903=null;if(_0x7eb9db['query'][_0x3af0('0x5d')]){_0x3bb903=_[_0x3af0('0xac')](_0x7eb9db[_0x3af0('0x40')][_0x3af0('0x5d')])?_0x7eb9db[_0x3af0('0x40')]['ids']:[_0x7eb9db['query'][_0x3af0('0x5d')]];}var _0x295aa4=[];return Promise[_0x3af0('0x100')]()[_0x3af0('0x13')](function(){if(!_0x3bb903)throw new APIBadRequestError(_0x3af0('0x11c'));})['then'](function(){return db[_0x3af0('0x3b')]['findOne']({'where':{'id':_0x3cd3b3}});})[_0x3af0('0x13')](function(_0x1efc89){if(!_0x1efc89)throw new APINotFoundError(util[_0x3af0('0xa4')](_0x3af0('0x10e'),_0x7eb9db[_0x3af0('0x51')]['id']));return db['sequelize']['transaction'](function(_0x440e34){return _0x1efc89[_0x3af0('0x11b')](_0x3bb903,{'transaction':_0x440e34})[_0x3af0('0x13')](function(){return db[_0x3af0('0x110')]['findAll']({'where':{'id':{'$in':_0x3bb903}}});})['then'](function(_0x53f857){var _0x12764a=_[_0x3af0('0x34')](_0x53f857,function(_0x22598f){return _0x22598f[_0x3af0('0x114')]();});return Promise[_0x3af0('0x59')](_0x12764a);})[_0x3af0('0x13')](function(_0xb3137e){_0x295aa4=_[_0x3af0('0x11d')](_0xb3137e);var _0x1d223a=_['map'](_0x295aa4,function(_0x484a36){return _0x484a36['removeAgent'](_0x1efc89['id'],{'transaction':_0x440e34});});return Promise[_0x3af0('0x59')](_0x1d223a);})[_0x3af0('0x13')](function(){if(!_0x1efc89[_0x3af0('0x98')])return;var _0x4335b2=_['filter'](_0x295aa4,function(_0x25fbc1){return _0x25fbc1['getDataValue'](_0x3af0('0xa9'))===_0x3af0('0x117');});var _0x32c107=_[_0x3af0('0x34')](_0x4335b2,function(_0x1139bc){return db[_0x3af0('0xa7')][_0x3af0('0x2b')]({'where':{'VoiceQueueId':_0x1139bc['id'],'UserId':_0x1efc89['id']},'transaction':_0x440e34});});return Promise['all'](_0x32c107);})[_0x3af0('0x13')](function(){return db[_0x3af0('0x118')][_0x3af0('0x46')]({'where':{'teamId':{'$in':_0x3bb903}}});})['then'](function(_0x20d638){var _0x56813f=_['map'](_0x20d638,function(_0x512b1a){return db[_0x3af0('0x119')][_0x3af0('0x2b')]({'where':{'UserId':_0x1efc89['id'],'VoicePrefixId':_0x512b1a['VoicePrefixId']}},{'transaction':_0x440e34});});return Promise[_0x3af0('0x59')](_0x56813f);});});})[_0x3af0('0x13')](function(){for(var _0x3878c2=0x0;_0x3878c2<_0x295aa4[_0x3af0('0x49')];_0x3878c2++){var _0x213da2=_0x295aa4[_0x3878c2][_0x3af0('0x116')](_0x3af0('0xa9'));var _0x10c3e9=_0x213da2+_0x3af0('0x9f');socket[_0x3af0('0x29')](_0x3af0('0x2e')+_0x213da2+'Queue:remove',{'UserId':_0x3cd3b3,['queueField']:_0x295aa4[_0x3878c2]['id']});}})[_0x3af0('0x13')](respondWithStatusCode(_0x52cee1,null))['catch'](APIHandleError(_0x52cee1));};exports[_0x3af0('0x11e')]=function(_0x4f0d65,_0x140077){var _0x4d2681={};var _0x152d87={};var _0x586354;var _0x709f00;return db['User'][_0x3af0('0x91')]({'where':{'id':_0x4f0d65[_0x3af0('0x51')]['id']}})['then'](handleEntityNotFound(_0x140077,null))[_0x3af0('0x13')](function(_0x1c22b9){if(_0x1c22b9){_0x586354=_0x1c22b9;_0x152d87[_0x3af0('0x52')]=_[_0x3af0('0xd3')](db[_0x3af0('0x11f')][_0x3af0('0x3c')]);_0x152d87[_0x3af0('0x40')]=_['keys'](_0x4f0d65[_0x3af0('0x40')]);_0x152d87[_0x3af0('0xc6')]=_['intersection'](_0x152d87[_0x3af0('0x52')],_0x152d87['query']);_0x4d2681[_0x3af0('0x44')]=_['intersection'](_0x152d87['model'],qs[_0x3af0('0x54')](_0x4f0d65[_0x3af0('0x40')][_0x3af0('0x54')]));_0x4d2681[_0x3af0('0x44')]=_0x4d2681['attributes'][_0x3af0('0x49')]?_0x4d2681['attributes']:_0x152d87[_0x3af0('0x52')];_0x4d2681[_0x3af0('0xc7')]=qs[_0x3af0('0xc8')](_0x4f0d65[_0x3af0('0x40')][_0x3af0('0xc8')]);_0x4d2681[_0x3af0('0xc9')]=qs[_0x3af0('0xc6')](_[_0x3af0('0xca')](_0x4f0d65[_0x3af0('0x40')],_0x152d87[_0x3af0('0xc6')]));if(_0x4f0d65[_0x3af0('0x40')]['filter']){_0x4d2681[_0x3af0('0xc9')]=_[_0x3af0('0x56')](_0x4d2681['where'],{'$or':_[_0x3af0('0x34')](_0x4d2681[_0x3af0('0x44')],function(_0x34fc73){var _0x7064cc={};_0x7064cc[_0x34fc73]={'$like':'%'+_0x4f0d65[_0x3af0('0x40')]['filter']+'%'};return _0x7064cc;})});}_0x4d2681=_[_0x3af0('0x56')]({},_0x4d2681,_0x4f0d65['options']);return _0x586354[_0x3af0('0x11e')](_0x4d2681);}})[_0x3af0('0x13')](function(_0x54a909){if(_0x54a909){_0x709f00=_0x54a909[_0x3af0('0x49')];if(!_0x4f0d65['query'][_0x3af0('0xcc')](_0x3af0('0xd2'))){_0x4d2681[_0x3af0('0x23')]=qs[_0x3af0('0x23')](_0x4f0d65[_0x3af0('0x40')][_0x3af0('0x23')]);_0x4d2681[_0x3af0('0x24')]=qs[_0x3af0('0x24')](_0x4f0d65['query'][_0x3af0('0x24')]);}return _0x586354[_0x3af0('0x11e')](_0x4d2681);}})['then'](function(_0x31f815){if(_0x31f815){return _0x31f815?{'count':_0x709f00,'rows':_0x31f815}:null;}})[_0x3af0('0x13')](respondWithResult(_0x140077,null))[_0x3af0('0x1e')](handleError(_0x140077,null));};exports['getAgents']=function(_0x45fbcc,_0x44e3a7){var _0x5522e2={};var _0x5d2bfe={};var _0x432b3f;return db[_0x3af0('0x3b')][_0x3af0('0x91')]({'where':{'id':_0x45fbcc[_0x3af0('0x51')]['id']}})[_0x3af0('0x13')](handleEntityNotFound(_0x44e3a7,null))[_0x3af0('0x13')](function(_0x5c174a){if(_0x5c174a){_0x432b3f=_0x5c174a;_0x5d2bfe[_0x3af0('0x52')]=_[_0x3af0('0xd3')](db[_0x3af0('0x3b')]['rawAttributes']);_0x5d2bfe[_0x3af0('0x40')]=_[_0x3af0('0xd3')](_0x45fbcc[_0x3af0('0x40')]);_0x5d2bfe[_0x3af0('0xc6')]=_[_0x3af0('0x53')](_0x5d2bfe[_0x3af0('0x52')],_0x5d2bfe[_0x3af0('0x40')]);_0x5522e2[_0x3af0('0x44')]=_[_0x3af0('0x53')](_0x5d2bfe['model'],qs[_0x3af0('0x54')](_0x45fbcc['query'][_0x3af0('0x54')]));_0x5522e2['attributes']=_0x5522e2[_0x3af0('0x44')][_0x3af0('0x49')]?_0x5522e2[_0x3af0('0x44')]:_0x5d2bfe['model'];_0x5522e2[_0x3af0('0xc7')]=qs[_0x3af0('0xc8')](_0x45fbcc[_0x3af0('0x40')][_0x3af0('0xc8')]);_0x5522e2[_0x3af0('0xc9')]=qs[_0x3af0('0xc6')](_[_0x3af0('0xca')](_0x45fbcc[_0x3af0('0x40')],_0x5d2bfe[_0x3af0('0xc6')]));if(_0x45fbcc['query']['filter']){_0x5522e2['where']=_[_0x3af0('0x56')](_0x5522e2['where'],{'$or':_[_0x3af0('0x34')](_0x5522e2[_0x3af0('0x44')],function(_0x5058f0){var _0x2df26c={};_0x2df26c[_0x5058f0]={'$like':'%'+_0x45fbcc[_0x3af0('0x40')][_0x3af0('0x33')]+'%'};return _0x2df26c;})});}_0x5522e2[_0x3af0('0x52')]=db['User'];_0x5522e2['as']='Agents';_0x5522e2=_[_0x3af0('0x56')]({},_0x5522e2,_0x45fbcc[_0x3af0('0x57')]);return _0x432b3f[_0x3af0('0xf5')]({'include':[_0x5522e2]});}})[_0x3af0('0x13')](function(_0x195fd1){if(_0x195fd1){var _0x3131ad={},_0x459b21=[];for(var _0x32cb0d=0x0;_0x32cb0d<_0x195fd1[_0x3af0('0x49')];_0x32cb0d+=0x1){for(var _0x2671c3=0x0,_0x11908a;_0x2671c3<_0x195fd1[_0x32cb0d]['Agents'][_0x3af0('0x49')];_0x2671c3+=0x1){_0x11908a=_0x195fd1[_0x32cb0d][_0x3af0('0x2f')][_0x2671c3][_0x3af0('0xa3')]({'plain':!![]});_0x3131ad[_0x11908a['id']]=_0x11908a;}}_0x3131ad=_[_0x3af0('0x120')](_0x3131ad);for(var _0x2a99e7=qs[_0x3af0('0x24')](_0x45fbcc[_0x3af0('0x40')][_0x3af0('0x24')]);_0x2a99e7<_0x3131ad[_0x3af0('0x49')]&&_0x459b21[_0x3af0('0x49')]=_0x57e333['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x2356('0x14')](function(){if(_0x23b1cd){return db[_0x2356('0x22')][_0x2356('0x4d')]({'where':{'membername':_0x23b1cd[_0x2356('0x1f')]},'individualHooks':!![]});}})[_0x2356('0x14')](function(){if(_0x23b1cd){return _0x23b1cd[_0x2356('0x4e')]({'raw':!![]});}})[_0x2356('0x14')](function(_0xc132cd){if(_0x23b1cd){if(_0xc132cd){var _0x15d45f=[];_0x358c11=_0xc132cd;if(_0x358c11[_0x2356('0x25')]){for(var _0x519025=0x0;_0x519025<_0x358c11[_0x2356('0x25')];_0x519025++){_0x15d45f[_0x2356('0x43')](db['UserVoiceQueueRt'][_0x2356('0x4f')]({'membername':_0x23b1cd[_0x2356('0x1f')],'UserId':_0x23b1cd['id'],'queue_name':_0x358c11[_0x519025]['name'],'VoiceQueueId':_0x358c11[_0x519025]['id'],'interface':_0x3f3d21,'paused':_0x23b1cd[_0x2356('0x46')]||![],'penalty':_0x358c11[_0x519025][_0x2356('0x50')]||0x0}));}return BPromise['all'](_0x15d45f);}}}})[_0x2356('0x14')](function(){if(_0x23b1cd){return db[_0x2356('0x41')][_0x2356('0x42')]({'where':{'membername':_0x23b1cd['name'],'exitAt':null}});}})[_0x2356('0x14')](function(_0x530aad){if(_0x23b1cd){if(_0x530aad&&_0x530aad['length']){var _0x26e94e=[];_0x530aad['forEach'](function(_0x125c70){_0x26e94e[_0x2356('0x43')](_0x125c70[_0x2356('0x23')]({'exitAt':moment()[_0x2356('0x26')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x2356('0x44')](_0x26e94e);}}})['then'](function(){if(_0x23b1cd){var _0x1d6c38=[];var _0x3ab9e4=[];var _0x251790=utils[_0x2356('0x28')]();var _0x26cde9={'membername':_0x23b1cd[_0x2356('0x1f')],'interface':_0x3f3d21,'enterAt':moment()[_0x2356('0x26')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x23b1cd[_0x2356('0x20')],'internal':_0x23b1cd[_0x2356('0x2e')]};_0x251790[_0x2356('0x29')](function(_0x1b78a5){_0x1d6c38['push'](_['merge']({'channel':_0x1b78a5,'type':_0x2356('0x51'),'data1':_0x2356('0x52'),'data2':_0x3f3d21},_0x26cde9));if(_0x23b1cd[_0x2356('0x46')]){_0x3ab9e4[_0x2356('0x43')](_[_0x2356('0x53')]({'channel':_0x1b78a5,'type':_0x2356('0x24'),'data1':_0x2356('0x54')},_0x26cde9));}});return db[_0x2356('0x41')][_0x2356('0x30')](_0x1d6c38[_0x2356('0x55')](_0x3ab9e4),{'individualHooks':!![]});}})[_0x2356('0x14')](function(){if(_0x23b1cd){return _0x23b1cd[_0x2356('0x23')]({'online':!![],'lastLoginAt':moment()[_0x2356('0x26')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x23b1cd['loginInPause']||![],'mailPause':_0x23b1cd[_0x2356('0x46')]||![],'chatPause':_0x23b1cd[_0x2356('0x46')]||![],'faxPause':_0x23b1cd[_0x2356('0x46')]||![],'smsPause':_0x23b1cd[_0x2356('0x46')]||![],'openchannelPause':_0x23b1cd[_0x2356('0x46')]||![],'pauseType':_0x23b1cd['loginInPause']?_0x2356('0x54'):null,'lastPauseAt':moment()[_0x2356('0x26')](_0x2356('0x2a')),'interface':_0x3f3d21});}})[_0x2356('0x14')](function(_0x529ab5){_0x4fe8fb(_0x529ab5);})['catch'](function(_0x5de007){_0x3c5425(_0x38421d[_0x2356('0x19')](0x1f4,_0x5de007[_0x2356('0x1a')]));});});}; \ No newline at end of file +var _0x95cf=['length','format','updateAttributes','getChannels','SIP/%s','body','type','uniqueid','bulkCreate','DEFAULT\x20PAUSE','YYYY-MM-DD\x20HH:mm:ss','UnpauseUser','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','mailPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','User\x20with\x20id\x20%s\x20not\x20found','params','unpause','system','LogoutUser','UserVoiceQueueRt','push','update','mobile','phone','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','loginInPause','UserVoiceQueue.penalty','all','forEach','merge','LOGIN','callysquare','LOGININPAUSE','concat','util','moment','../../mysqldb','../../config/logger','rpc','defaults','localhost','socket.io-emitter','redis','./user.socket','register','GetUser','User','findAll','options','raw','attributes','limit','include','map','model','debug','stringify','catch','error','message','find','where','then','info','ShowUser','PauseUser','name','role','internal','interface','MemberReport','PAUSE'];(function(_0x6b6340,_0x6302c4){var _0x3609bf=function(_0x1620a0){while(--_0x1620a0){_0x6b6340['push'](_0x6b6340['shift']());}};_0x3609bf(++_0x6302c4);}(_0x95cf,0xdf));var _0xf95c=function(_0x51f33f,_0x57b0f5){_0x51f33f=_0x51f33f-0x0;var _0x33fcd4=_0x95cf[_0x51f33f];return _0x33fcd4;};'use strict';var _=require('lodash');var util=require(_0xf95c('0x0'));var moment=require(_0xf95c('0x1'));var BPromise=require('bluebird');var Redis=require('ioredis');var db=require(_0xf95c('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xf95c('0x3'))(_0xf95c('0x4'));var config=require('../../config/environment');config['redis']=_[_0xf95c('0x5')](config['redis'],{'host':_0xf95c('0x6'),'port':0x18eb});var socket=require(_0xf95c('0x7'))(new Redis(config[_0xf95c('0x8')]));require(_0xf95c('0x9'))[_0xf95c('0xa')](socket);exports[_0xf95c('0xb')]=function(_0x4bcf24){var _0x7d9455=this;return new Promise(function(_0xb93bf6,_0x526235){return db[_0xf95c('0xc')][_0xf95c('0xd')]({'raw':_0x4bcf24[_0xf95c('0xe')]?_0x4bcf24[_0xf95c('0xe')][_0xf95c('0xf')]===undefined?!![]:![]:!![],'where':_0x4bcf24[_0xf95c('0xe')]?_0x4bcf24['options']['where']||null:null,'attributes':_0x4bcf24[_0xf95c('0xe')]?_0x4bcf24[_0xf95c('0xe')][_0xf95c('0x10')]||null:null,'limit':_0x4bcf24[_0xf95c('0xe')]?_0x4bcf24['options'][_0xf95c('0x11')]||null:null,'include':_0x4bcf24[_0xf95c('0xe')]?_0x4bcf24['options'][_0xf95c('0x12')]?_[_0xf95c('0x13')](_0x4bcf24[_0xf95c('0xe')][_0xf95c('0x12')],function(_0x1ebce6){return{'model':db[_0x1ebce6[_0xf95c('0x14')]],'as':_0x1ebce6['as'],'attributes':_0x1ebce6[_0xf95c('0x10')],'include':_0x1ebce6[_0xf95c('0x12')]?_[_0xf95c('0x13')](_0x1ebce6['include'],function(_0x217f9f){return{'model':db[_0x217f9f[_0xf95c('0x14')]],'as':_0x217f9f['as'],'attributes':_0x217f9f[_0xf95c('0x10')],'include':_0x217f9f[_0xf95c('0x12')]?_[_0xf95c('0x13')](_0x217f9f[_0xf95c('0x12')],function(_0x39cc78){return{'model':db[_0x39cc78[_0xf95c('0x14')]],'as':_0x39cc78['as'],'attributes':_0x39cc78[_0xf95c('0x10')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x100150){logger['info'](_0xf95c('0xb'),_0x4bcf24);logger[_0xf95c('0x15')]('GetUser',_0x4bcf24,JSON[_0xf95c('0x16')](_0x100150));_0xb93bf6(_0x100150);})[_0xf95c('0x17')](function(_0x15425a){logger[_0xf95c('0x18')](_0xf95c('0xb'),_0x15425a[_0xf95c('0x19')],_0x4bcf24);_0x526235(_0x7d9455[_0xf95c('0x18')](0x1f4,_0x15425a[_0xf95c('0x19')]));});});};exports['ShowUser']=function(_0x270011){var _0x3bfb1d=this;return new Promise(function(_0x4faf76,_0x10cc7f){return db[_0xf95c('0xc')][_0xf95c('0x1a')]({'raw':_0x270011['options']?_0x270011['options'][_0xf95c('0xf')]===undefined?!![]:![]:!![],'where':_0x270011[_0xf95c('0xe')]?_0x270011[_0xf95c('0xe')][_0xf95c('0x1b')]||null:null,'attributes':_0x270011['options']?_0x270011['options'][_0xf95c('0x10')]||null:null,'include':_0x270011['options']?_0x270011[_0xf95c('0xe')]['include']?_['map'](_0x270011[_0xf95c('0xe')][_0xf95c('0x12')],function(_0x3f7b1d){return{'model':db[_0x3f7b1d['model']],'as':_0x3f7b1d['as'],'attributes':_0x3f7b1d[_0xf95c('0x10')],'include':_0x3f7b1d[_0xf95c('0x12')]?_[_0xf95c('0x13')](_0x3f7b1d[_0xf95c('0x12')],function(_0x5a835a){return{'model':db[_0x5a835a[_0xf95c('0x14')]],'as':_0x5a835a['as'],'attributes':_0x5a835a[_0xf95c('0x10')],'include':_0x5a835a['include']?_[_0xf95c('0x13')](_0x5a835a[_0xf95c('0x12')],function(_0x5b3c97){return{'model':db[_0x5b3c97[_0xf95c('0x14')]],'as':_0x5b3c97['as'],'attributes':_0x5b3c97[_0xf95c('0x10')]};}):[]};}):[]};}):[]:[]})[_0xf95c('0x1c')](function(_0x1b74a2){logger[_0xf95c('0x1d')]('ShowUser',_0x270011);logger['debug']('ShowUser',_0x270011,JSON['stringify'](_0x1b74a2));_0x4faf76(_0x1b74a2);})['catch'](function(_0x203a32){logger[_0xf95c('0x18')](_0xf95c('0x1e'),_0x203a32[_0xf95c('0x19')],_0x270011);_0x10cc7f(_0x3bfb1d[_0xf95c('0x18')](0x1f4,_0x203a32[_0xf95c('0x19')]));});});};exports[_0xf95c('0x1f')]=function(_0x3b6dc3){var _0x47dea5=this;return new Promise(function(_0x29631b,_0x174795){var _0x785110;return db['User'][_0xf95c('0x1a')]({'where':_0x3b6dc3[_0xf95c('0xe')][_0xf95c('0x1b')]||{},'attributes':['id',_0xf95c('0x20'),_0xf95c('0x21'),_0xf95c('0x22'),_0xf95c('0x23')]})[_0xf95c('0x1c')](function(_0x5daf44){if(_0x5daf44){_0x785110=_0x5daf44;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x785110['id']},'individualHooks':!![]});}})[_0xf95c('0x1c')](function(){if(_0x785110){return db[_0xf95c('0x24')][_0xf95c('0xd')]({'where':{'membername':_0x785110[_0xf95c('0x20')],'type':_0xf95c('0x25'),'exitAt':null}});}})['then'](function(_0x453327){if(_0x785110){if(_0x453327&&_0x453327[_0xf95c('0x26')]){var _0xfb1859=moment()[_0xf95c('0x27')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x243326=0x0,_0x286dd9=_0x453327[_0xf95c('0x26')];_0x243326<_0x286dd9;_0x243326++){_0x453327[_0x243326][_0xf95c('0x28')]({'exitAt':_0xfb1859});}}}})[_0xf95c('0x1c')](function(){if(_0x785110){var _0x53ef81=[];var _0x5e8c3a=utils[_0xf95c('0x29')]();_0x5e8c3a['forEach'](function(_0x40d50c){_0x53ef81['push']({'channel':_0x40d50c,'membername':_0x785110[_0xf95c('0x20')],'interface':_['isNil'](_0x785110['interface'])?util['format'](_0xf95c('0x2a'),_0x785110[_0xf95c('0x20')]):_0x785110['interface'],'type':_0xf95c('0x25'),'enterAt':moment()[_0xf95c('0x27')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x3b6dc3[_0xf95c('0x2b')][_0xf95c('0x2c')]||'DEFAULT\x20PAUSE','role':_0x785110[_0xf95c('0x21')],'internal':_0x785110['internal'],'uniqueid':_0x3b6dc3[_0xf95c('0x2b')][_0xf95c('0x2d')]||null});});return db[_0xf95c('0x24')][_0xf95c('0x2e')](_0x53ef81,{'individualHooks':!![]});}})[_0xf95c('0x1c')](function(){if(_0x785110){return _0x785110['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x3b6dc3[_0xf95c('0x2b')][_0xf95c('0x2c')]||_0xf95c('0x2f'),'lastPauseAt':moment()['format'](_0xf95c('0x30'))});}})[_0xf95c('0x1c')](function(_0x188f9d){_0x29631b(_0x188f9d);})[_0xf95c('0x17')](function(_0x3fa14f){_0x174795(_0x47dea5[_0xf95c('0x18')](0x1f4,_0x3fa14f[_0xf95c('0x19')]));});});};exports[_0xf95c('0x31')]=function(_0x42342d){var _0x58f7a8=this;return new Promise(function(_0x370a04,_0x212b17){if(_0x42342d[_0xf95c('0x2b')][_0xf95c('0x32')]&&!utils[_0xf95c('0x33')](_0x42342d[_0xf95c('0x2b')][_0xf95c('0x32')])){throw new Error(util[_0xf95c('0x27')](_0xf95c('0x34'),_0x42342d['body']['channel']));}return db[_0xf95c('0xc')][_0xf95c('0x35')]({'where':_0x42342d[_0xf95c('0xe')][_0xf95c('0x1b')]||{},'attributes':['id',_0xf95c('0x20'),_0xf95c('0x21'),_0xf95c('0x22'),_0xf95c('0x23'),'online','voicePause',_0xf95c('0x36'),'chatPause',_0xf95c('0x37'),_0xf95c('0x38'),_0xf95c('0x39'),_0xf95c('0x3a'),_0xf95c('0x3b'),'lastPauseAt']})[_0xf95c('0x1c')](function(_0x445e8f){if(!_0x445e8f){throw new Error(util[_0xf95c('0x27')](_0xf95c('0x3c'),_0x42342d[_0xf95c('0x3d')]['id']));}return _0x445e8f[_0xf95c('0x3e')](_0x42342d[_0xf95c('0x2b')][_0xf95c('0x32')],_0xf95c('0x3f'));})[_0xf95c('0x1c')](function(_0x26cae5){_0x370a04(_0x26cae5);})[_0xf95c('0x17')](function(_0x2643fd){_0x212b17(_0x58f7a8[_0xf95c('0x18')](0x1f4,_0x2643fd['message']));});});};exports[_0xf95c('0x40')]=function(_0x246853){var _0x7917ff=this;return new Promise(function(_0xc7ab81,_0x284809){var _0x152ee3;return db[_0xf95c('0xc')]['findOne']({'where':_0x246853['options'][_0xf95c('0x1b')]||{},'attributes':['id',_0xf95c('0x20')]})[_0xf95c('0x1c')](function(_0x157eca){if(_0x157eca){_0x152ee3=_0x157eca;return db[_0xf95c('0x41')]['destroy']({'where':{'membername':_0x152ee3[_0xf95c('0x20')]},'individualHooks':!![]});}})[_0xf95c('0x1c')](function(){if(_0x152ee3){return db[_0xf95c('0x24')][_0xf95c('0xd')]({'where':{'membername':_0x152ee3['name'],'exitAt':null}});}})[_0xf95c('0x1c')](function(_0x39227e){if(_0x152ee3){if(_0x39227e&&_0x39227e[_0xf95c('0x26')]){var _0x2ed6af=[];_0x39227e['forEach'](function(_0x4cc2ed){_0x2ed6af[_0xf95c('0x42')](_0x4cc2ed[_0xf95c('0x43')]({'exitAt':moment()['format'](_0xf95c('0x30'))}));});return BPromise['all'](_0x2ed6af);}}})[_0xf95c('0x1c')](function(){if(_0x152ee3){return _0x152ee3['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xf95c('0x1c')](function(_0x488575){_0xc7ab81(_0x488575);})[_0xf95c('0x17')](function(_0x40663f){_0x284809(_0x7917ff[_0xf95c('0x18')](0x1f4,_0x40663f[_0xf95c('0x19')]));});});};exports['LoginUser']=function(_0x27437d){var _0x26e34d=this;return new Promise(function(_0x56f2c1,_0x30895f){var _0x24e90b;var _0x5e9526;var _0x2f597e;var _0x3edd27;return db[_0xf95c('0xc')][_0xf95c('0x35')]({'where':_0x27437d[_0xf95c('0xe')]['where']||{},'attributes':['id',_0xf95c('0x20'),_0xf95c('0x21'),_0xf95c('0x44'),_0xf95c('0x45'),_0xf95c('0x22'),'loginInPause',_0xf95c('0x23')]})[_0xf95c('0x1c')](function(_0x5b257a){if(_0x5b257a){_0x24e90b=_0x5b257a;_0x3edd27=_0x27437d['body'][_0xf95c('0x23')]?_0x27437d[_0xf95c('0x2b')][_0xf95c('0x23')]:util[_0xf95c('0x27')](_0xf95c('0x2a'),_0x24e90b[_0xf95c('0x20')]);return db[_0xf95c('0xc')][_0xf95c('0x46')]({'where':{'role':_0xf95c('0x47'),'online':!![],'id':{'$ne':_0x24e90b['id']}}});}})[_0xf95c('0x1c')](function(_0x1392b4){if(_0x1392b4){_0x2f597e=_0x1392b4;return require(_0xf95c('0x48'))[_0xf95c('0x49')]();}})['then'](function(_0x32ecde){if(_0x32ecde&&_0x32ecde['agents']&&_0x2f597e>=_0x32ecde[_0xf95c('0x4a')]){throw new Error(_0xf95c('0x4b'));}})[_0xf95c('0x1c')](function(){if(_0x24e90b){return db[_0xf95c('0x41')][_0xf95c('0x4c')]({'where':{'membername':_0x24e90b[_0xf95c('0x20')]},'individualHooks':!![]});}})[_0xf95c('0x1c')](function(){if(_0x24e90b){return _0x24e90b[_0xf95c('0x4d')]({'raw':!![]});}})[_0xf95c('0x1c')](function(_0x5899d2){if(_0x24e90b){if(_0x5899d2){var _0xc2bdc1=[];_0x5e9526=_0x5899d2;if(_0x5e9526[_0xf95c('0x26')]){for(var _0x241d6e=0x0;_0x241d6e<_0x5e9526[_0xf95c('0x26')];_0x241d6e++){_0xc2bdc1[_0xf95c('0x42')](db[_0xf95c('0x41')]['upsert']({'membername':_0x24e90b[_0xf95c('0x20')],'UserId':_0x24e90b['id'],'queue_name':_0x5e9526[_0x241d6e]['name'],'VoiceQueueId':_0x5e9526[_0x241d6e]['id'],'interface':_0x3edd27,'paused':_0x24e90b[_0xf95c('0x4e')]||![],'penalty':_0x5e9526[_0x241d6e][_0xf95c('0x4f')]||0x0}));}return BPromise[_0xf95c('0x50')](_0xc2bdc1);}}}})['then'](function(){if(_0x24e90b){return db[_0xf95c('0x24')][_0xf95c('0xd')]({'where':{'membername':_0x24e90b['name'],'exitAt':null}});}})[_0xf95c('0x1c')](function(_0x5b6c61){if(_0x24e90b){if(_0x5b6c61&&_0x5b6c61['length']){var _0xb0a644=[];_0x5b6c61[_0xf95c('0x51')](function(_0x48e53d){_0xb0a644[_0xf95c('0x42')](_0x48e53d[_0xf95c('0x43')]({'exitAt':moment()[_0xf95c('0x27')](_0xf95c('0x30'))}));});return BPromise[_0xf95c('0x50')](_0xb0a644);}}})[_0xf95c('0x1c')](function(){if(_0x24e90b){var _0x3095c3=[];var _0xeb485e=[];var _0x56afdf=utils[_0xf95c('0x29')]();var _0x256059={'membername':_0x24e90b[_0xf95c('0x20')],'interface':_0x3edd27,'enterAt':moment()[_0xf95c('0x27')](_0xf95c('0x30')),'role':_0x24e90b[_0xf95c('0x21')],'internal':_0x24e90b[_0xf95c('0x22')]};_0x56afdf[_0xf95c('0x51')](function(_0x465620){_0x3095c3[_0xf95c('0x42')](_[_0xf95c('0x52')]({'channel':_0x465620,'type':_0xf95c('0x53'),'data1':_0xf95c('0x54'),'data2':_0x3edd27},_0x256059));if(_0x24e90b[_0xf95c('0x4e')]){_0xeb485e[_0xf95c('0x42')](_[_0xf95c('0x52')]({'channel':_0x465620,'type':_0xf95c('0x25'),'data1':_0xf95c('0x55')},_0x256059));}});return db[_0xf95c('0x24')][_0xf95c('0x2e')](_0x3095c3[_0xf95c('0x56')](_0xeb485e),{'individualHooks':!![]});}})[_0xf95c('0x1c')](function(){if(_0x24e90b){return _0x24e90b['update']({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x24e90b[_0xf95c('0x4e')]||![],'mailPause':_0x24e90b[_0xf95c('0x4e')]||![],'chatPause':_0x24e90b[_0xf95c('0x4e')]||![],'faxPause':_0x24e90b[_0xf95c('0x4e')]||![],'smsPause':_0x24e90b[_0xf95c('0x4e')]||![],'openchannelPause':_0x24e90b[_0xf95c('0x4e')]||![],'pauseType':_0x24e90b['loginInPause']?_0xf95c('0x55'):null,'lastPauseAt':moment()[_0xf95c('0x27')](_0xf95c('0x30')),'interface':_0x3edd27});}})[_0xf95c('0x1c')](function(_0x1b6066){_0x56f2c1(_0x1b6066);})[_0xf95c('0x17')](function(_0x35df8c){_0x30895f(_0x26e34d[_0xf95c('0x18')](0x1f4,_0x35df8c[_0xf95c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 91e0915..8784e95 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 _0x4015=['length','user:','./user.events','save','update','emit','register'];(function(_0x108c02,_0x3ad677){var _0x13029c=function(_0x22ded5){while(--_0x22ded5){_0x108c02['push'](_0x108c02['shift']());}};_0x13029c(++_0x3ad677);}(_0x4015,0x136));var _0x5401=function(_0x529abc,_0x17b97e){_0x529abc=_0x529abc-0x0;var _0x453afa=_0x4015[_0x529abc];return _0x453afa;};'use strict';var UserEvents=require(_0x5401('0x0'));var events=[_0x5401('0x1'),'remove',_0x5401('0x2')];function createListener(_0x68a1d5,_0x60696f){return function(_0x2fb40b){_0x60696f[_0x5401('0x3')](_0x68a1d5,_0x2fb40b);};}function removeListener(_0x42dde2,_0x4e0e90){return function(){UserEvents['removeListener'](_0x42dde2,_0x4e0e90);};}exports[_0x5401('0x4')]=function(_0x14b6e7){for(var _0x2371d8=0x0,_0x5b865d=events[_0x5401('0x5')];_0x2371d8<_0x5b865d;_0x2371d8++){var _0x3e694c=events[_0x2371d8];var _0x133839=createListener(_0x5401('0x6')+_0x3e694c,_0x14b6e7);UserEvents['on'](_0x3e694c,_0x133839);}}; \ No newline at end of file +var _0x8e46=['remove','update','removeListener','register','length','./user.events'];(function(_0x88fb01,_0x884cfa){var _0x5a1c31=function(_0x28ba2c){while(--_0x28ba2c){_0x88fb01['push'](_0x88fb01['shift']());}};_0x5a1c31(++_0x884cfa);}(_0x8e46,0x125));var _0x68e4=function(_0x25f3e3,_0x207891){_0x25f3e3=_0x25f3e3-0x0;var _0xa89b6d=_0x8e46[_0x25f3e3];return _0xa89b6d;};'use strict';var UserEvents=require(_0x68e4('0x0'));var events=['save',_0x68e4('0x1'),_0x68e4('0x2')];function createListener(_0x4cf412,_0x11c5f7){return function(_0x53218e){_0x11c5f7['emit'](_0x4cf412,_0x53218e);};}function removeListener(_0x4a1b28,_0x91aa00){return function(){UserEvents[_0x68e4('0x3')](_0x4a1b28,_0x91aa00);};}exports[_0x68e4('0x4')]=function(_0x4e943d){for(var _0x4a9859=0x0,_0x484b1d=events[_0x68e4('0x5')];_0x4a9859<_0x484b1d;_0x4a9859++){var _0x133647=events[_0x4a9859];var _0x71d55c=createListener('user:'+_0x133647,_0x4e943d);UserEvents['on'](_0x133647,_0x71d55c);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index f4e31af..d175b2e 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x292afb,_0x59baf3){var _0x249ed8=function(_0x5e4dfe){while(--_0x5e4dfe){_0x292afb['push'](_0x292afb['shift']());}};_0x249ed8(++_0x59baf3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xcd9ece,_0x33ff67){var _0x36f54f=function(_0x54ec76){while(--_0x54ec76){_0xcd9ece['push'](_0xcd9ece['shift']());}};_0x36f54f(++_0x33ff67);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'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 9006424..480f590 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x352d=['sequelize','exports','INTEGER'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x352d,0xe1));var _0xd352=function(_0x4a5f1b,_0x4184ce){_0x4a5f1b=_0x4a5f1b-0x0;var _0x14078e=_0x352d[_0x4a5f1b];return _0x14078e;};'use strict';var Sequelize=require(_0xd352('0x0'));module[_0xd352('0x1')]={'penalty':{'type':Sequelize[_0xd352('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 71c6788..5d662f1 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 _0xdf42=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','UserChatQueue','user_has_chat_queues','util'];(function(_0x5ac5e8,_0xc333d2){var _0x5eb1ff=function(_0x2c4802){while(--_0x2c4802){_0x5ac5e8['push'](_0x5ac5e8['shift']());}};_0x5eb1ff(++_0xc333d2);}(_0xdf42,0x11d));var _0x2df4=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xdf42[_0x164eca];return _0x2ce562;};'use strict';var _=require('lodash');var util=require(_0x2df4('0x0'));var logger=require(_0x2df4('0x1'))(_0x2df4('0x2'));var moment=require(_0x2df4('0x3'));var BPromise=require(_0x2df4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2df4('0x5'));var rimraf=require(_0x2df4('0x6'));var config=require(_0x2df4('0x7'));var attributes=require('./userChatQueue.attributes');module['exports']=function(_0x229bd8,_0x401525){return _0x229bd8[_0x2df4('0x8')](_0x2df4('0x9'),attributes,{'tableName':_0x2df4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07d7=['path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','user_has_chat_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x41532b,_0x27fd36){var _0x28abeb=function(_0x2bb0ec){while(--_0x2bb0ec){_0x41532b['push'](_0x41532b['shift']());}};_0x28abeb(++_0x27fd36);}(_0x07d7,0xf7));var _0x707d=function(_0x1b51ea,_0x394fd9){_0x1b51ea=_0x1b51ea-0x0;var _0x18bbdc=_0x07d7[_0x1b51ea];return _0x18bbdc;};'use strict';var _=require(_0x707d('0x0'));var util=require(_0x707d('0x1'));var logger=require(_0x707d('0x2'))('api');var moment=require(_0x707d('0x3'));var BPromise=require(_0x707d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x707d('0x5'));var rimraf=require(_0x707d('0x6'));var config=require(_0x707d('0x7'));var attributes=require(_0x707d('0x8'));module[_0x707d('0x9')]=function(_0x4f8ada,_0x44ae0a){return _0x4f8ada[_0x707d('0xa')]('UserChatQueue',attributes,{'tableName':_0x707d('0xb'),'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 d6b2681..2ae9224 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 _0x2f32=['catch','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','error','code','UserChatQueue,\x20%s,\x20%s','message'];(function(_0x27d2fc,_0x1b484c){var _0x23eb07=function(_0x269f2e){while(--_0x269f2e){_0x27d2fc['push'](_0x27d2fc['shift']());}};_0x23eb07(++_0x1b484c);}(_0x2f32,0x91));var _0x22f3=function(_0x4091a5,_0x49bbc0){_0x4091a5=_0x4091a5-0x0;var _0x1e8a69=_0x2f32[_0x4091a5];return _0x1e8a69;};'use strict';var _=require('lodash');var util=require(_0x22f3('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x22f3('0x1'));var fs=require('fs');var Redis=require(_0x22f3('0x2'));var db=require(_0x22f3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x22f3('0x4'))(_0x22f3('0x5'));var config=require(_0x22f3('0x6'));var jayson=require(_0x22f3('0x7'));var client=jayson['client'][_0x22f3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x244541,_0x777975,_0x3774c0){return new BPromise(function(_0x5a5643,_0x55f4b7){return client[_0x22f3('0x9')](_0x244541,_0x3774c0)['then'](function(_0x3fe3e5){logger[_0x22f3('0xa')]('UserChatQueue,\x20%s,\x20%s',_0x777975,_0x22f3('0xb'));logger[_0x22f3('0xc')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x777975,_0x22f3('0xb'),JSON['stringify'](_0x3fe3e5));if(_0x3fe3e5[_0x22f3('0xd')]){if(_0x3fe3e5[_0x22f3('0xd')][_0x22f3('0xe')]===0x1f4){logger[_0x22f3('0xd')](_0x22f3('0xf'),_0x777975,_0x3fe3e5[_0x22f3('0xd')][_0x22f3('0x10')]);return _0x55f4b7(_0x3fe3e5['error'][_0x22f3('0x10')]);}logger['error'](_0x22f3('0xf'),_0x777975,_0x3fe3e5[_0x22f3('0xd')]['message']);return _0x5a5643(_0x3fe3e5[_0x22f3('0xd')][_0x22f3('0x10')]);}else{logger[_0x22f3('0xa')](_0x22f3('0xf'),_0x777975,_0x22f3('0xb'));_0x5a5643(_0x3fe3e5['result']['message']);}})[_0x22f3('0x11')](function(_0x342b70){logger[_0x22f3('0xd')](_0x22f3('0xf'),_0x777975,_0x342b70);_0x55f4b7(_0x342b70);});});} \ No newline at end of file +var _0x3ac9=['then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xcdbea9,_0x2eeda0){var _0x5efe84=function(_0x2675fa){while(--_0x2675fa){_0xcdbea9['push'](_0xcdbea9['shift']());}};_0x5efe84(++_0x2eeda0);}(_0x3ac9,0xe8));var _0x93ac=function(_0x51be7f,_0xd159f3){_0x51be7f=_0x51be7f-0x0;var _0x58f88c=_0x3ac9[_0x51be7f];return _0x58f88c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x93ac('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x93ac('0x1'));var db=require(_0x93ac('0x2'))['db'];var utils=require(_0x93ac('0x3'));var logger=require('../../config/logger')(_0x93ac('0x4'));var config=require(_0x93ac('0x5'));var jayson=require(_0x93ac('0x6'));var client=jayson[_0x93ac('0x7')][_0x93ac('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x6c8850,_0xa58aef,_0x131b57){return new BPromise(function(_0x43193f,_0x3fd627){return client[_0x93ac('0x9')](_0x6c8850,_0x131b57)[_0x93ac('0xa')](function(_0xb16124){logger[_0x93ac('0xb')](_0x93ac('0xc'),_0xa58aef,_0x93ac('0xd'));logger[_0x93ac('0xe')](_0x93ac('0xf'),_0xa58aef,_0x93ac('0xd'),JSON[_0x93ac('0x10')](_0xb16124));if(_0xb16124[_0x93ac('0x11')]){if(_0xb16124[_0x93ac('0x11')][_0x93ac('0x12')]===0x1f4){logger['error'](_0x93ac('0xc'),_0xa58aef,_0xb16124['error'][_0x93ac('0x13')]);return _0x3fd627(_0xb16124['error'][_0x93ac('0x13')]);}logger[_0x93ac('0x11')]('UserChatQueue,\x20%s,\x20%s',_0xa58aef,_0xb16124[_0x93ac('0x11')]['message']);return _0x43193f(_0xb16124[_0x93ac('0x11')]['message']);}else{logger[_0x93ac('0xb')]('UserChatQueue,\x20%s,\x20%s',_0xa58aef,'request\x20sent');_0x43193f(_0xb16124[_0x93ac('0x14')][_0x93ac('0x13')]);}})[_0x93ac('0x15')](function(_0x210b64){logger[_0x93ac('0x11')](_0x93ac('0xc'),_0xa58aef,_0x210b64);_0x3fd627(_0x210b64);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 85672cb..397309c 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x556db9,_0x28d510){var _0x51a027=function(_0x294e5f){while(--_0x294e5f){_0x556db9['push'](_0x556db9['shift']());}};_0x51a027(++_0x28d510);}(_0xedd9,0xfc));var _0x9edd=function(_0x38b958,_0x3a30af){_0x38b958=_0x38b958-0x0;var _0x3173d1=_0xedd9[_0x38b958];return _0x3173d1;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x201ac3,_0x3028b4){var _0x927d33=function(_0x5cdc3f){while(--_0x5cdc3f){_0x201ac3['push'](_0x201ac3['shift']());}};_0x927d33(++_0x3028b4);}(_0xe706,0xa3));var _0x6e70=function(_0x498789,_0x465536){_0x498789=_0x498789-0x0;var _0x3f8b64=_0xe706[_0x498789];return _0x3f8b64;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 72e2c56..10e8c70 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 _0xd71c=['STRING','sequelize','exports','INTEGER'];(function(_0x47cba1,_0x32a0f8){var _0x5caab0=function(_0x29a324){while(--_0x29a324){_0x47cba1['push'](_0x47cba1['shift']());}};_0x5caab0(++_0x32a0f8);}(_0xd71c,0x139));var _0xcd71=function(_0x36531b,_0x4a8df2){_0x36531b=_0x36531b-0x0;var _0x961b06=_0xd71c[_0x36531b];return _0x961b06;};'use strict';var Sequelize=require(_0xcd71('0x0'));module[_0xcd71('0x1')]={'penalty':{'type':Sequelize[_0xcd71('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xcd71('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xcd71('0x3')]}}; \ No newline at end of file +var _0x02a1=['INTEGER','exports'];(function(_0x38a6b0,_0x1a6a18){var _0x14188b=function(_0x45d78b){while(--_0x45d78b){_0x38a6b0['push'](_0x38a6b0['shift']());}};_0x14188b(++_0x1a6a18);}(_0x02a1,0x193));var _0x102a=function(_0x394c21,_0x49e8ea){_0x394c21=_0x394c21-0x0;var _0x3ed986=_0x02a1[_0x394c21];return _0x3ed986;};'use strict';var Sequelize=require('sequelize');module[_0x102a('0x0')]={'penalty':{'type':Sequelize[_0x102a('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x102a('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 248f05a..e6ff9cd 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 _0xf79f=['exports','define','UserFaxQueue','user_has_fax_queues','lodash','../../config/logger','moment','bluebird','path','./userFaxQueue.attributes'];(function(_0x319aa,_0x504bb0){var _0x551e8c=function(_0x50589b){while(--_0x50589b){_0x319aa['push'](_0x319aa['shift']());}};_0x551e8c(++_0x504bb0);}(_0xf79f,0x162));var _0xff79=function(_0x4ff5a2,_0xb33150){_0x4ff5a2=_0x4ff5a2-0x0;var _0xe162f6=_0xf79f[_0x4ff5a2];return _0xe162f6;};'use strict';var _=require(_0xff79('0x0'));var util=require('util');var logger=require(_0xff79('0x1'))('api');var moment=require(_0xff79('0x2'));var BPromise=require(_0xff79('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xff79('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xff79('0x5'));module[_0xff79('0x6')]=function(_0x38eefd,_0x2ae250){return _0x38eefd[_0xff79('0x7')](_0xff79('0x8'),attributes,{'tableName':_0xff79('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e91=['user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue'];(function(_0x10b9af,_0xb84271){var _0x296330=function(_0x1987f){while(--_0x1987f){_0x10b9af['push'](_0x10b9af['shift']());}};_0x296330(++_0xb84271);}(_0x6e91,0xb7));var _0x16e9=function(_0x175273,_0x176533){_0x175273=_0x175273-0x0;var _0x50eea7=_0x6e91[_0x175273];return _0x50eea7;};'use strict';var _=require(_0x16e9('0x0'));var util=require(_0x16e9('0x1'));var logger=require(_0x16e9('0x2'))(_0x16e9('0x3'));var moment=require(_0x16e9('0x4'));var BPromise=require(_0x16e9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x16e9('0x6'));var config=require(_0x16e9('0x7'));var attributes=require(_0x16e9('0x8'));module[_0x16e9('0x9')]=function(_0x344fc9,_0x13bfd3){return _0x344fc9[_0x16e9('0xa')](_0x16e9('0xb'),attributes,{'tableName':_0x16e9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index ad67b6e..0c5dadc 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 _0x13b2=['client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x547775,_0x1578ce){var _0x2bd191=function(_0x404215){while(--_0x404215){_0x547775['push'](_0x547775['shift']());}};_0x2bd191(++_0x1578ce);}(_0x13b2,0x1ee));var _0x213b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x13b2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x213b('0x0'));var util=require(_0x213b('0x1'));var moment=require(_0x213b('0x2'));var BPromise=require(_0x213b('0x3'));var rs=require(_0x213b('0x4'));var fs=require('fs');var Redis=require(_0x213b('0x5'));var db=require(_0x213b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x213b('0x7'))(_0x213b('0x8'));var config=require(_0x213b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x213b('0xa')][_0x213b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c23df,_0xd87a7c,_0x574657){return new BPromise(function(_0x519003,_0xf04ce){return client[_0x213b('0xc')](_0x3c23df,_0x574657)[_0x213b('0xd')](function(_0x110606){logger[_0x213b('0xe')](_0x213b('0xf'),_0xd87a7c,_0x213b('0x10'));logger[_0x213b('0x11')](_0x213b('0x12'),_0xd87a7c,_0x213b('0x10'),JSON[_0x213b('0x13')](_0x110606));if(_0x110606[_0x213b('0x14')]){if(_0x110606[_0x213b('0x14')]['code']===0x1f4){logger[_0x213b('0x14')](_0x213b('0xf'),_0xd87a7c,_0x110606[_0x213b('0x14')][_0x213b('0x15')]);return _0xf04ce(_0x110606[_0x213b('0x14')]['message']);}logger[_0x213b('0x14')](_0x213b('0xf'),_0xd87a7c,_0x110606[_0x213b('0x14')]['message']);return _0x519003(_0x110606['error']['message']);}else{logger[_0x213b('0xe')](_0x213b('0xf'),_0xd87a7c,'request\x20sent');_0x519003(_0x110606[_0x213b('0x16')][_0x213b('0x15')]);}})[_0x213b('0x17')](function(_0x5f1c26){logger[_0x213b('0x14')](_0x213b('0xf'),_0xd87a7c,_0x5f1c26);_0xf04ce(_0x5f1c26);});});} \ No newline at end of file +var _0xdb10=['client','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','ioredis','../../config/utils','../../config/logger'];(function(_0x50b064,_0x22151b){var _0x38bdda=function(_0x260a0f){while(--_0x260a0f){_0x50b064['push'](_0x50b064['shift']());}};_0x38bdda(++_0x22151b);}(_0xdb10,0x199));var _0x0db1=function(_0x553a87,_0x1d621f){_0x553a87=_0x553a87-0x0;var _0x12d1e6=_0xdb10[_0x553a87];return _0x12d1e6;};'use strict';var _=require('lodash');var util=require(_0x0db1('0x0'));var moment=require(_0x0db1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0db1('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0db1('0x3'));var logger=require(_0x0db1('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0db1('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d7d5e,_0x2376de,_0x8e329a){return new BPromise(function(_0x4b465e,_0x19c964){return client[_0x0db1('0x6')](_0x3d7d5e,_0x8e329a)[_0x0db1('0x7')](function(_0x5b7931){logger[_0x0db1('0x8')](_0x0db1('0x9'),_0x2376de,_0x0db1('0xa'));logger[_0x0db1('0xb')](_0x0db1('0xc'),_0x2376de,_0x0db1('0xa'),JSON[_0x0db1('0xd')](_0x5b7931));if(_0x5b7931[_0x0db1('0xe')]){if(_0x5b7931[_0x0db1('0xe')][_0x0db1('0xf')]===0x1f4){logger[_0x0db1('0xe')](_0x0db1('0x9'),_0x2376de,_0x5b7931[_0x0db1('0xe')]['message']);return _0x19c964(_0x5b7931['error'][_0x0db1('0x10')]);}logger[_0x0db1('0xe')](_0x0db1('0x9'),_0x2376de,_0x5b7931[_0x0db1('0xe')][_0x0db1('0x10')]);return _0x4b465e(_0x5b7931['error']['message']);}else{logger[_0x0db1('0x8')](_0x0db1('0x9'),_0x2376de,'request\x20sent');_0x4b465e(_0x5b7931[_0x0db1('0x11')][_0x0db1('0x10')]);}})['catch'](function(_0x36cb3a){logger[_0x0db1('0xe')](_0x0db1('0x9'),_0x2376de,_0x36cb3a);_0x19c964(_0x36cb3a);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 457f409..f6e06db 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x34e750,_0x1c7082){var _0x1f1a08=function(_0x48949d){while(--_0x48949d){_0x34e750['push'](_0x34e750['shift']());}};_0x1f1a08(++_0x1c7082);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x10852d,_0x4cdcc6){_0x10852d=_0x10852d-0x0;var _0x13a8d6=_0xcb91[_0x10852d];return _0x13a8d6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x596229,_0x383f54){var _0x5093b6=function(_0x575555){while(--_0x575555){_0x596229['push'](_0x596229['shift']());}};_0x5093b6(++_0x383f54);}(_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 763a111..8db4e89 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 _0xc53a=['INTEGER','sequelize','exports'];(function(_0x2c4884,_0x3fbf90){var _0x4576ef=function(_0x5bcb89){while(--_0x5bcb89){_0x2c4884['push'](_0x2c4884['shift']());}};_0x4576ef(++_0x3fbf90);}(_0xc53a,0xd6));var _0xac53=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc53a[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xac53('0x0'));module[_0xac53('0x1')]={'penalty':{'type':Sequelize[_0xac53('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7a55=['exports','sequelize'];(function(_0x5ca380,_0x5b3bb8){var _0x36b837=function(_0x5c4c01){while(--_0x5c4c01){_0x5ca380['push'](_0x5ca380['shift']());}};_0x36b837(++_0x5b3bb8);}(_0x7a55,0x173));var _0x57a5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7a55[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x57a5('0x0'));module[_0x57a5('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index e63eede..753ff32 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 _0x12a4=['user_has_mail_queues','lodash','util','../../config/logger','api','moment','request-promise','path','./userMailQueue.attributes','exports','define'];(function(_0x23dc90,_0x18add1){var _0x1ec4de=function(_0x1a7e53){while(--_0x1a7e53){_0x23dc90['push'](_0x23dc90['shift']());}};_0x1ec4de(++_0x18add1);}(_0x12a4,0x161));var _0x412a=function(_0x509c83,_0x511882){_0x509c83=_0x509c83-0x0;var _0x534626=_0x12a4[_0x509c83];return _0x534626;};'use strict';var _=require(_0x412a('0x0'));var util=require(_0x412a('0x1'));var logger=require(_0x412a('0x2'))(_0x412a('0x3'));var moment=require(_0x412a('0x4'));var BPromise=require('bluebird');var rp=require(_0x412a('0x5'));var fs=require('fs');var path=require(_0x412a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x412a('0x7'));module[_0x412a('0x8')]=function(_0x318e23,_0x2b4587){return _0x318e23[_0x412a('0x9')]('UserMailQueue',attributes,{'tableName':_0x412a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc838=['request-promise','../../config/environment','./userMailQueue.attributes','UserMailQueue','user_has_mail_queues','lodash','util','api','moment','bluebird'];(function(_0x1aa089,_0x2519d6){var _0x9783cb=function(_0x1f44ce){while(--_0x1f44ce){_0x1aa089['push'](_0x1aa089['shift']());}};_0x9783cb(++_0x2519d6);}(_0xc838,0xd7));var _0x8c83=function(_0x46a27b,_0x11d725){_0x46a27b=_0x46a27b-0x0;var _0x27b2ef=_0xc838[_0x46a27b];return _0x27b2ef;};'use strict';var _=require(_0x8c83('0x0'));var util=require(_0x8c83('0x1'));var logger=require('../../config/logger')(_0x8c83('0x2'));var moment=require(_0x8c83('0x3'));var BPromise=require(_0x8c83('0x4'));var rp=require(_0x8c83('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8c83('0x6'));var attributes=require(_0x8c83('0x7'));module['exports']=function(_0x561693,_0x397695){return _0x561693['define'](_0x8c83('0x8'),attributes,{'tableName':_0x8c83('0x9'),'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 fbb7cf3..1133f06 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','UserMailQueue,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x16edd9,_0xa9a0a4){var _0x11c95b=function(_0x14180a){while(--_0x14180a){_0x16edd9['push'](_0x16edd9['shift']());}};_0x11c95b(++_0xa9a0a4);}(_0x3e74,0x175));var _0x43e7=function(_0x5b1f73,_0x56ffc8){_0x5b1f73=_0x5b1f73-0x0;var _0x32aa90=_0x3e74[_0x5b1f73];return _0x32aa90;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file +var _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(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x7217,0x19e));var _0x7721=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x7217[_0x481bf7];return _0x461787;};'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 diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 1ae5612..f9ea6c0 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 _0x709c=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports'];(function(_0x2584bc,_0x35d9f5){var _0x405f2c=function(_0x4a1d1e){while(--_0x4a1d1e){_0x2584bc['push'](_0x2584bc['shift']());}};_0x405f2c(++_0x35d9f5);}(_0x709c,0x78));var _0xc709=function(_0x5b406e,_0x357ded){_0x5b406e=_0x5b406e-0x0;var _0x89ca76=_0x709c[_0x5b406e];return _0x89ca76;};'use strict';var multer=require(_0xc709('0x0'));var util=require(_0xc709('0x1'));var path=require(_0xc709('0x2'));var timeout=require(_0xc709('0x3'));var express=require(_0xc709('0x4'));var router=express[_0xc709('0x5')]();var fs_extra=require(_0xc709('0x6'));var auth=require(_0xc709('0x7'));var interaction=require(_0xc709('0x8'));var config=require(_0xc709('0x9'));var controller=require(_0xc709('0xa'));router[_0xc709('0xb')]('/',auth[_0xc709('0xc')](),controller[_0xc709('0xd')]);module[_0xc709('0xe')]=router; \ No newline at end of file +var _0xc185=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','sendUserNotification'];(function(_0x454e6d,_0x1e1f38){var _0x4bc294=function(_0x2c803a){while(--_0x2c803a){_0x454e6d['push'](_0x454e6d['shift']());}};_0x4bc294(++_0x1e1f38);}(_0xc185,0x140));var _0x5c18=function(_0x3fa885,_0x5f0f0d){_0x3fa885=_0x3fa885-0x0;var _0x32fd03=_0xc185[_0x3fa885];return _0x32fd03;};'use strict';var multer=require(_0x5c18('0x0'));var util=require(_0x5c18('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5c18('0x2'));var router=express[_0x5c18('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5c18('0x4'));var interaction=require(_0x5c18('0x5'));var config=require(_0x5c18('0x6'));var controller=require(_0x5c18('0x7'));router[_0x5c18('0x8')]('/',auth['isAuthenticated'](),controller[_0x5c18('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index ca81b92..c0f23e8 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 _0x949a=['sequelize','TEXT','STRING','BOOLEAN'];(function(_0x68f626,_0x4caec2){var _0xbdbb05=function(_0x317ac0){while(--_0x317ac0){_0x68f626['push'](_0x68f626['shift']());}};_0xbdbb05(++_0x4caec2);}(_0x949a,0x94));var _0xa949=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x949a[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xa949('0x0'));module['exports']={'body':{'type':Sequelize[_0xa949('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xa949('0x1')]},'recipientsDescription':{'type':Sequelize[_0xa949('0x2')]},'beep':{'type':Sequelize[_0xa949('0x3')]}}; \ No newline at end of file +var _0xf764=['BOOLEAN','exports','STRING'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xf764,0x1ed));var _0x4f76=function(_0x51dcc4,_0x3b457f){_0x51dcc4=_0x51dcc4-0x0;var _0xc9784f=_0xf764[_0x51dcc4];return _0xc9784f;};'use strict';var Sequelize=require('sequelize');module[_0x4f76('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x4f76('0x1')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x4f76('0x1')]},'beep':{'type':Sequelize[_0x4f76('0x2')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index c99ff93..994f00b 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 _0x2215=['join','sequelize','transaction','UserNotification','create','beep','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','union','ids','queue','replace','Queue','push','all','flatten','getAgents','map','eml-format','zip-dir','request-promise','moment','mustache','path','sox','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','body','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','SenderId','recipientsId'];(function(_0x1d0499,_0x23e22f){var _0x153fb3=function(_0x40c19c){while(--_0x40c19c){_0x1d0499['push'](_0x1d0499['shift']());}};_0x153fb3(++_0x23e22f);}(_0x2215,0x7d));var _0x5221=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2215[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x5221('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5221('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5221('0x2'));var moment=require(_0x5221('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5221('0x4'));var util=require('util');var path=require(_0x5221('0x5'));var sox=require(_0x5221('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5221('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x5221('0x8'));var toCsv=require(_0x5221('0x9'));var querystring=require(_0x5221('0xa'));var Papa=require(_0x5221('0xb'));var Redis=require('ioredis');var authService=require(_0x5221('0xc'));var qs=require(_0x5221('0xd'));var as=require(_0x5221('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5221('0xf'));var utils=require(_0x5221('0x10'));var config=require(_0x5221('0x11'));var licenseUtil=require(_0x5221('0x12'));var db=require(_0x5221('0x13'))['db'];config[_0x5221('0x14')]=_[_0x5221('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5221('0x14')]));require('./userNotification.socket')[_0x5221('0x16')](socket);function respondWithStatusCode(_0x2bfe1b,_0xa7776f){_0xa7776f=_0xa7776f||0xcc;return function(_0x40d34f){if(_0x40d34f){return _0x2bfe1b[_0x5221('0x17')](_0xa7776f);}return _0x2bfe1b[_0x5221('0x18')](_0xa7776f)[_0x5221('0x19')]();};}function respondWithResult(_0x2621d4,_0x1ab4c6){_0x1ab4c6=_0x1ab4c6||0xc8;return function(_0x1bfc12){if(_0x1bfc12){return _0x2621d4['status'](_0x1ab4c6)[_0x5221('0x1a')](_0x1bfc12);}};}function respondWithFilteredResult(_0x2e9cdd,_0x24664a){return function(_0x13037a){if(_0x13037a){var _0x3076bd=typeof _0x24664a[_0x5221('0x1b')]===_0x5221('0x1c')&&typeof _0x24664a[_0x5221('0x1d')]===_0x5221('0x1c');var _0x292639=_0x13037a['count'];var _0x41409b=_0x3076bd?0x0:_0x24664a[_0x5221('0x1b')];var _0x175c0a=_0x3076bd?_0x13037a['count']:_0x24664a['offset']+_0x24664a['limit'];var _0x4bbe48;if(_0x175c0a>=_0x292639){_0x175c0a=_0x292639;_0x4bbe48=0xc8;}else{_0x4bbe48=0xce;}_0x2e9cdd['status'](_0x4bbe48);return _0x2e9cdd[_0x5221('0x1e')](_0x5221('0x1f'),_0x41409b+'-'+_0x175c0a+'/'+_0x292639)[_0x5221('0x1a')](_0x13037a);}return null;};}function patchUpdates(_0x3d79f2){return function(_0x5cd7d4){try{jsonpatch[_0x5221('0x20')](_0x5cd7d4,_0x3d79f2,!![]);}catch(_0x2b9fb6){return BPromise[_0x5221('0x21')](_0x2b9fb6);}return _0x5cd7d4[_0x5221('0x22')]();};}function saveUpdates(_0x4373f5,_0x41c0e2){return function(_0x4e479e){if(_0x4e479e){return _0x4e479e[_0x5221('0x23')](_0x4373f5)[_0x5221('0x24')](function(_0xd5d50e){return _0xd5d50e;});}return null;};}function removeEntity(_0x3882a4,_0x2d0bd6){return function(_0x59e4a5){if(_0x59e4a5){return _0x59e4a5[_0x5221('0x25')]()[_0x5221('0x24')](function(){_0x3882a4[_0x5221('0x18')](0xcc)[_0x5221('0x19')]();});}};}function handleEntityNotFound(_0xa1b4d8,_0x39e55b){return function(_0x57104f){if(!_0x57104f){_0xa1b4d8['sendStatus'](0x194);}return _0x57104f;};}function handleError(_0x5a99d8,_0x582314){_0x582314=_0x582314||0x1f4;return function(_0x5bc41a){logger[_0x5221('0x26')](_0x5bc41a[_0x5221('0x27')]);if(_0x5bc41a[_0x5221('0x28')]){delete _0x5bc41a[_0x5221('0x28')];}_0x5a99d8[_0x5221('0x18')](_0x582314)[_0x5221('0x29')](_0x5bc41a);};}exports[_0x5221('0x2a')]=function(_0x2d4619,_0x12d0bd,_0x5929e8){if(!_0x2d4619['body'][_0x5221('0x2b')](_0x5221('0x2c'))&&!_0x2d4619['body'][_0x5221('0x2b')](_0x5221('0x2d'))){throw new db[(_0x5221('0x2e'))][(_0x5221('0x2f'))](_0x5221('0x30'));}else{if(_0x2d4619[_0x5221('0x31')][_0x5221('0x2b')](_0x5221('0x2d'))&&!_0x2d4619['body']['hasOwnProperty'](_0x5221('0x32'))){throw new db[(_0x5221('0x2e'))][(_0x5221('0x2f'))](_0x5221('0x33'));}if(!_0x2d4619['body']['hasOwnProperty'](_0x5221('0x34'))){throw new db['Sequelize'][(_0x5221('0x2f'))](_0x5221('0x35'));}else{try{var _0x4d549a=JSON[_0x5221('0x36')](_0x2d4619[_0x5221('0x31')][_0x5221('0x34')]);}catch(_0x189bbc){logger[_0x5221('0x26')](_0x189bbc);throw new db[(_0x5221('0x2e'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x459ee5=[_0x5221('0x37'),_0x5221('0x38'),'mailqueue',_0x5221('0x39'),_0x5221('0x3a'),_0x5221('0x3b'),'whatsappqueue','team',_0x5221('0x3c')];if(_[_0x5221('0x3d')](_0x4d549a,function(_0x34fe5e){return!_[_0x5221('0x3e')](_0x459ee5,_0x34fe5e[_0x5221('0x3f')][_0x5221('0x40')]());})){throw new db[(_0x5221('0x2e'))][(_0x5221('0x2f'))](_0x5221('0x41'));}}}var _0x1e02b2={};_0x1e02b2[_0x5221('0x42')]=_0x2d4619['body']['hasOwnProperty'](_0x5221('0x42'))?_0x2d4619['body'][_0x5221('0x42')]:_0x2d4619[_0x5221('0x3c')][_0x5221('0x43')];_0x1e02b2['recipientsDescription']=_['isEmpty'](_0x2d4619['body'][_0x5221('0x44')])?null:_0x2d4619[_0x5221('0x31')][_0x5221('0x44')];_0x1e02b2['beep']=_0x2d4619[_0x5221('0x31')]['beep']||![];_0x1e02b2[_0x5221('0x45')]=_0x2d4619[_0x5221('0x3c')]['id'];return getContent(_0x2d4619[_0x5221('0x31')])[_0x5221('0x24')](function(_0x376e8d){_0x1e02b2[_0x5221('0x31')]=_0x376e8d;return getRecipients(_0x4d549a);})['then'](function(_0x32bfcb){_0x1e02b2[_0x5221('0x46')]=_['sortBy'](_0x32bfcb)[_0x5221('0x47')](',');return db[_0x5221('0x48')][_0x5221('0x49')](function(_0x274089){return db[_0x5221('0x4a')][_0x5221('0x4b')](_0x1e02b2,{'raw':!![],'transaction':_0x274089})[_0x5221('0x24')](function(_0x4d4ec2){var _0x1f7d55={'sender':_0x1e02b2[_0x5221('0x42')],'description':_0x1e02b2[_0x5221('0x44')],'content':_0x1e02b2[_0x5221('0x31')],'beep':_0x1e02b2[_0x5221('0x4c')]};_0x32bfcb[_0x5221('0x4d')](function(_0x566730){_0x1f7d55[_0x5221('0x4e')]=_0x566730;socket[_0x5221('0x4f')](_0x5221('0x50'),_0x1f7d55);});return _0x4d4ec2;});});})['then'](respondWithResult(_0x12d0bd,0xc9))[_0x5221('0x51')](handleError(_0x12d0bd,null));};function getContent(_0x52c933){return new BPromise(function(_0x567fbb,_0x595169){if(_0x52c933['text']){_0x567fbb(_0x52c933[_0x5221('0x2c')]);return;}return db[_0x5221('0x52')][_0x5221('0x53')]({'attributes':[_0x5221('0x54')],'where':{'id':_0x52c933[_0x5221('0x2d')]},'raw':!![]})[_0x5221('0x24')](function(_0x4a0ff6){if(!_0x4a0ff6)throw new db[(_0x5221('0x2e'))][(_0x5221('0x2f'))](_0x5221('0x55'));var _0x6c5eb7=Mustache[_0x5221('0x56')](_0x4a0ff6[_0x5221('0x54')],_0x52c933['view']);_0x567fbb(_0x6c5eb7);})[_0x5221('0x51')](function(_0x18fd81){_0x595169(_0x18fd81);});});}function getRecipients(_0x18594c){return new BPromise(function(_0x4a745d,_0x29f8f7){var _0x5a6de5=[];var _0xd02400=[];_0x18594c[_0x5221('0x4d')](function(_0x2cb999){var _0x1bc0fc=_[_0x5221('0x57')](_0x2cb999['model'][_0x5221('0x40')]());if(_0x1bc0fc==='User'){_0x5a6de5=_[_0x5221('0x58')](_0x5a6de5,_0x2cb999[_0x5221('0x59')]);}else{if(_[_0x5221('0x3e')](_0x1bc0fc,_0x5221('0x5a')))_0x1bc0fc=_0x1bc0fc[_0x5221('0x5b')]('queue',_0x5221('0x5c'));_0x2cb999['ids'][_0x5221('0x4d')](function(_0x46d5f2){_0xd02400[_0x5221('0x5d')](getAgents(_0x1bc0fc,_0x46d5f2));});}});return BPromise[_0x5221('0x5e')](_0xd02400)[_0x5221('0x24')](function(_0x45356e){_0x5a6de5=_[_0x5221('0x58')](_0x5a6de5,_[_0x5221('0x5f')](_0x45356e));_0x4a745d(_0x5a6de5);})[_0x5221('0x51')](function(_0x39adb0){_0x29f8f7(_0x39adb0);});});}function getAgents(_0x511b2b,_0x4e6385){return new BPromise(function(_0x154dd0,_0x5035f4){return db[_0x511b2b]['findOne']({'where':{'id':_0x4e6385}})[_0x5221('0x24')](function(_0xeb0cc9){return _0xeb0cc9[_0x5221('0x60')]({'attributes':['id'],'raw':!![]})[_0x5221('0x24')](function(_0xa1279a){var _0x384f0a=_[_0x5221('0x61')](_0xa1279a,'id');_0x154dd0(_0x384f0a);});})[_0x5221('0x51')](function(_0x1c1b20){_0x5035f4(_0x1c1b20);});});} \ No newline at end of file +var _0xe856=['sortBy','transaction','UserNotification','create','userNotification:send','catch','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','forEach','startCase','User','union','replace','queue','Queue','all','findOne','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','offset','limit','count','set','Content-Range','json','apply','update','then','stack','name','sendUserNotification','hasOwnProperty','text','body','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','recipientsId'];(function(_0x432f97,_0x31a8a0){var _0x162e48=function(_0x36c1c4){while(--_0x36c1c4){_0x432f97['push'](_0x432f97['shift']());}};_0x162e48(++_0x31a8a0);}(_0xe856,0x194));var _0x6e85=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xe856[_0x8c43de];return _0xa6591b;};'use strict';var emlformat=require(_0x6e85('0x0'));var rimraf=require(_0x6e85('0x1'));var zipdir=require(_0x6e85('0x2'));var jsonpatch=require(_0x6e85('0x3'));var rp=require(_0x6e85('0x4'));var moment=require('moment');var BPromise=require(_0x6e85('0x5'));var Mustache=require(_0x6e85('0x6'));var util=require('util');var path=require(_0x6e85('0x7'));var sox=require(_0x6e85('0x8'));var csv=require(_0x6e85('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6e85('0xa'));var _=require('lodash');var squel=require(_0x6e85('0xb'));var crypto=require(_0x6e85('0xc'));var jsforce=require(_0x6e85('0xd'));var deskjs=require(_0x6e85('0xe'));var toCsv=require(_0x6e85('0x9'));var querystring=require(_0x6e85('0xf'));var Papa=require(_0x6e85('0x10'));var Redis=require(_0x6e85('0x11'));var authService=require(_0x6e85('0x12'));var qs=require(_0x6e85('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e85('0x14'));var logger=require(_0x6e85('0x15'))(_0x6e85('0x16'));var utils=require('../../config/utils');var config=require(_0x6e85('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6e85('0x18'))['db'];config[_0x6e85('0x19')]=_[_0x6e85('0x1a')](config[_0x6e85('0x19')],{'host':_0x6e85('0x1b'),'port':0x18eb});var socket=require(_0x6e85('0x1c'))(new Redis(config[_0x6e85('0x19')]));require(_0x6e85('0x1d'))[_0x6e85('0x1e')](socket);function respondWithStatusCode(_0x4c358c,_0x5b9bc2){_0x5b9bc2=_0x5b9bc2||0xcc;return function(_0x6a2284){if(_0x6a2284){return _0x4c358c[_0x6e85('0x1f')](_0x5b9bc2);}return _0x4c358c[_0x6e85('0x20')](_0x5b9bc2)['end']();};}function respondWithResult(_0x401a45,_0x2cbb5e){_0x2cbb5e=_0x2cbb5e||0xc8;return function(_0x4c9bcf){if(_0x4c9bcf){return _0x401a45['status'](_0x2cbb5e)['json'](_0x4c9bcf);}};}function respondWithFilteredResult(_0x53e055,_0x5b9a55){return function(_0x7aa501){if(_0x7aa501){var _0x515f5c=typeof _0x5b9a55[_0x6e85('0x21')]==='undefined'&&typeof _0x5b9a55[_0x6e85('0x22')]==='undefined';var _0x3ac3ea=_0x7aa501[_0x6e85('0x23')];var _0x137ab9=_0x515f5c?0x0:_0x5b9a55[_0x6e85('0x21')];var _0x2afde2=_0x515f5c?_0x7aa501[_0x6e85('0x23')]:_0x5b9a55[_0x6e85('0x21')]+_0x5b9a55[_0x6e85('0x22')];var _0x82c33b;if(_0x2afde2>=_0x3ac3ea){_0x2afde2=_0x3ac3ea;_0x82c33b=0xc8;}else{_0x82c33b=0xce;}_0x53e055[_0x6e85('0x20')](_0x82c33b);return _0x53e055[_0x6e85('0x24')](_0x6e85('0x25'),_0x137ab9+'-'+_0x2afde2+'/'+_0x3ac3ea)[_0x6e85('0x26')](_0x7aa501);}return null;};}function patchUpdates(_0x595acb){return function(_0x22aaa1){try{jsonpatch[_0x6e85('0x27')](_0x22aaa1,_0x595acb,!![]);}catch(_0x3de6cc){return BPromise['reject'](_0x3de6cc);}return _0x22aaa1['save']();};}function saveUpdates(_0x4e82c4,_0x522c78){return function(_0x323acc){if(_0x323acc){return _0x323acc[_0x6e85('0x28')](_0x4e82c4)[_0x6e85('0x29')](function(_0x3129aa){return _0x3129aa;});}return null;};}function removeEntity(_0x391009,_0x2fc68e){return function(_0x23b044){if(_0x23b044){return _0x23b044['destroy']()[_0x6e85('0x29')](function(){_0x391009['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b287d,_0x205c9f){return function(_0x29bf80){if(!_0x29bf80){_0x5b287d['sendStatus'](0x194);}return _0x29bf80;};}function handleError(_0x3f18d8,_0x38763e){_0x38763e=_0x38763e||0x1f4;return function(_0x5429e2){logger['error'](_0x5429e2[_0x6e85('0x2a')]);if(_0x5429e2[_0x6e85('0x2b')]){delete _0x5429e2[_0x6e85('0x2b')];}_0x3f18d8[_0x6e85('0x20')](_0x38763e)['send'](_0x5429e2);};}exports[_0x6e85('0x2c')]=function(_0x5daf37,_0x505e3c,_0x438657){if(!_0x5daf37['body'][_0x6e85('0x2d')](_0x6e85('0x2e'))&&!_0x5daf37[_0x6e85('0x2f')][_0x6e85('0x2d')]('TemplateId')){throw new db[(_0x6e85('0x30'))][(_0x6e85('0x31'))](_0x6e85('0x32'));}else{if(_0x5daf37[_0x6e85('0x2f')][_0x6e85('0x2d')](_0x6e85('0x33'))&&!_0x5daf37['body'][_0x6e85('0x2d')](_0x6e85('0x34'))){throw new db['Sequelize'][(_0x6e85('0x31'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x5daf37[_0x6e85('0x2f')][_0x6e85('0x2d')]('recipients')){throw new db[(_0x6e85('0x30'))]['ValidationError'](_0x6e85('0x35'));}else{try{var _0x1d18a1=JSON[_0x6e85('0x36')](_0x5daf37['body']['recipients']);}catch(_0x4f5923){logger[_0x6e85('0x37')](_0x4f5923);throw new db[(_0x6e85('0x30'))][(_0x6e85('0x31'))](_0x6e85('0x38'));}var _0x35e082=[_0x6e85('0x39'),_0x6e85('0x3a'),_0x6e85('0x3b'),_0x6e85('0x3c'),_0x6e85('0x3d'),_0x6e85('0x3e'),_0x6e85('0x3f'),_0x6e85('0x40'),_0x6e85('0x41')];if(_[_0x6e85('0x42')](_0x1d18a1,function(_0x28eaf6){return!_[_0x6e85('0x43')](_0x35e082,_0x28eaf6[_0x6e85('0x44')][_0x6e85('0x45')]());})){throw new db['Sequelize'][(_0x6e85('0x31'))](_0x6e85('0x46'));}}}var _0x4f13f9={};_0x4f13f9[_0x6e85('0x47')]=_0x5daf37[_0x6e85('0x2f')][_0x6e85('0x2d')](_0x6e85('0x47'))?_0x5daf37['body'][_0x6e85('0x47')]:_0x5daf37[_0x6e85('0x41')]['fullname'];_0x4f13f9[_0x6e85('0x48')]=_[_0x6e85('0x49')](_0x5daf37['body']['recipientsDescription'])?null:_0x5daf37[_0x6e85('0x2f')][_0x6e85('0x48')];_0x4f13f9[_0x6e85('0x4a')]=_0x5daf37[_0x6e85('0x2f')][_0x6e85('0x4a')]||![];_0x4f13f9['SenderId']=_0x5daf37[_0x6e85('0x41')]['id'];return getContent(_0x5daf37[_0x6e85('0x2f')])[_0x6e85('0x29')](function(_0x30d521){_0x4f13f9[_0x6e85('0x2f')]=_0x30d521;return getRecipients(_0x1d18a1);})['then'](function(_0x41db1c){_0x4f13f9[_0x6e85('0x4b')]=_[_0x6e85('0x4c')](_0x41db1c)['join'](',');return db['sequelize'][_0x6e85('0x4d')](function(_0x396733){return db[_0x6e85('0x4e')][_0x6e85('0x4f')](_0x4f13f9,{'raw':!![],'transaction':_0x396733})[_0x6e85('0x29')](function(_0x2615ce){var _0x26da1d={'sender':_0x4f13f9[_0x6e85('0x47')],'description':_0x4f13f9[_0x6e85('0x48')],'content':_0x4f13f9[_0x6e85('0x2f')],'beep':_0x4f13f9[_0x6e85('0x4a')]};_0x41db1c['forEach'](function(_0x1b1635){_0x26da1d['recipient']=_0x1b1635;socket['emit'](_0x6e85('0x50'),_0x26da1d);});return _0x2615ce;});});})[_0x6e85('0x29')](respondWithResult(_0x505e3c,0xc9))[_0x6e85('0x51')](handleError(_0x505e3c,null));};function getContent(_0x562a5a){return new BPromise(function(_0x227a5a,_0x475f18){if(_0x562a5a[_0x6e85('0x2e')]){_0x227a5a(_0x562a5a[_0x6e85('0x2e')]);return;}return db[_0x6e85('0x52')]['findOne']({'attributes':[_0x6e85('0x53')],'where':{'id':_0x562a5a[_0x6e85('0x33')]},'raw':!![]})[_0x6e85('0x29')](function(_0x5d4d28){if(!_0x5d4d28)throw new db[(_0x6e85('0x30'))][(_0x6e85('0x31'))](_0x6e85('0x54'));var _0x4eccdd=Mustache['render'](_0x5d4d28[_0x6e85('0x53')],_0x562a5a['view']);_0x227a5a(_0x4eccdd);})['catch'](function(_0xda6928){_0x475f18(_0xda6928);});});}function getRecipients(_0x189a71){return new BPromise(function(_0x5cef30,_0x9ce661){var _0x21f1e6=[];var _0x23a37b=[];_0x189a71[_0x6e85('0x55')](function(_0x28d15c){var _0x2979fc=_[_0x6e85('0x56')](_0x28d15c['model'][_0x6e85('0x45')]());if(_0x2979fc===_0x6e85('0x57')){_0x21f1e6=_[_0x6e85('0x58')](_0x21f1e6,_0x28d15c['ids']);}else{if(_['includes'](_0x2979fc,'queue'))_0x2979fc=_0x2979fc[_0x6e85('0x59')](_0x6e85('0x5a'),_0x6e85('0x5b'));_0x28d15c['ids'][_0x6e85('0x55')](function(_0x5c939c){_0x23a37b['push'](getAgents(_0x2979fc,_0x5c939c));});}});return BPromise[_0x6e85('0x5c')](_0x23a37b)[_0x6e85('0x29')](function(_0x54d9e3){_0x21f1e6=_['union'](_0x21f1e6,_['flatten'](_0x54d9e3));_0x5cef30(_0x21f1e6);})[_0x6e85('0x51')](function(_0xd6e5d0){_0x9ce661(_0xd6e5d0);});});}function getAgents(_0x4415ac,_0x12abfc){return new BPromise(function(_0x320b15,_0x550241){return db[_0x4415ac][_0x6e85('0x5d')]({'where':{'id':_0x12abfc}})[_0x6e85('0x29')](function(_0x40bcd0){return _0x40bcd0[_0x6e85('0x5e')]({'attributes':['id'],'raw':!![]})[_0x6e85('0x29')](function(_0x3cbfb7){var _0x6ffac2=_[_0x6e85('0x5f')](_0x3cbfb7,'id');_0x320b15(_0x6ffac2);});})[_0x6e85('0x51')](function(_0xc05acb){_0x550241(_0xc05acb);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 2764ebe..8322933 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 _0xde2d=['../../mysqldb','UserNotification','save','update','remove','emit','hook','exports'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xde2d,0x110));var _0xdde2=function(_0x35b80e,_0x120fd7){_0x35b80e=_0x35b80e-0x0;var _0x363914=_0xde2d[_0x35b80e];return _0x363914;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xdde2('0x0'))['db'][_0xdde2('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdde2('0x2'),'afterUpdate':_0xdde2('0x3'),'afterDestroy':_0xdde2('0x4')};function emitEvent(_0xd9db89){return function(_0x3162ef,_0x538f24,_0x819c11){UserNotificationEvents[_0xdde2('0x5')](_0xd9db89+':'+_0x3162ef['id'],_0x3162ef);UserNotificationEvents['emit'](_0xd9db89,_0x3162ef);_0x819c11(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xdde2('0x6')](e,emitEvent(event));}}module[_0xdde2('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0xb7f6=['save','update','remove','hasOwnProperty','exports','events','../../mysqldb','UserNotification'];(function(_0xc66996,_0x13f61a){var _0x16d061=function(_0xcc8f79){while(--_0xcc8f79){_0xc66996['push'](_0xc66996['shift']());}};_0x16d061(++_0x13f61a);}(_0xb7f6,0xc5));var _0x6b7f=function(_0x4a749b,_0x2be4d0){_0x4a749b=_0x4a749b-0x0;var _0x560731=_0xb7f6[_0x4a749b];return _0x560731;};'use strict';var EventEmitter=require(_0x6b7f('0x0'));var UserNotification=require(_0x6b7f('0x1'))['db'][_0x6b7f('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6b7f('0x3'),'afterUpdate':_0x6b7f('0x4'),'afterDestroy':_0x6b7f('0x5')};function emitEvent(_0x12adc6){return function(_0x485f41,_0x24be32,_0x5421c1){UserNotificationEvents['emit'](_0x12adc6+':'+_0x485f41['id'],_0x485f41);UserNotificationEvents['emit'](_0x12adc6,_0x485f41);_0x5421c1(null);};}for(var e in events){if(events[_0x6b7f('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x6b7f('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 47cca6a..1274dfa 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 _0x467b=['userNotifications','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','UserNotification'];(function(_0x218bda,_0xfbee7){var _0x4ea5d2=function(_0x4457c0){while(--_0x4457c0){_0x218bda['push'](_0x218bda['shift']());}};_0x4ea5d2(++_0xfbee7);}(_0x467b,0x15e));var _0xb467=function(_0x44d184,_0x57099e){_0x44d184=_0x44d184-0x0;var _0x5148ca=_0x467b[_0x44d184];return _0x5148ca;};'use strict';var _=require('lodash');var util=require(_0xb467('0x0'));var logger=require('../../config/logger')(_0xb467('0x1'));var moment=require(_0xb467('0x2'));var BPromise=require(_0xb467('0x3'));var rp=require(_0xb467('0x4'));var fs=require('fs');var path=require(_0xb467('0x5'));var rimraf=require('rimraf');var config=require(_0xb467('0x6'));var attributes=require('./userNotification.attributes');module[_0xb467('0x7')]=function(_0x31a705,_0x1153a6){return _0x31a705[_0xb467('0x8')](_0xb467('0x9'),attributes,{'tableName':_0xb467('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb467('0xb')});}; \ No newline at end of file +var _0x52ae=['request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','userNotifications','utf8mb4','utf8mb4_unicode_ci','moment','bluebird'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x52ae,0x17e));var _0xe52a=function(_0x5f12fd,_0x33c70d){_0x5f12fd=_0x5f12fd-0x0;var _0x58bd80=_0x52ae[_0x5f12fd];return _0x58bd80;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe52a('0x0'));var BPromise=require(_0xe52a('0x1'));var rp=require(_0xe52a('0x2'));var fs=require('fs');var path=require(_0xe52a('0x3'));var rimraf=require(_0xe52a('0x4'));var config=require(_0xe52a('0x5'));var attributes=require(_0xe52a('0x6'));module[_0xe52a('0x7')]=function(_0x3f7afd,_0x3f7e5e){return _0x3f7afd[_0xe52a('0x8')]('UserNotification',attributes,{'tableName':_0xe52a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe52a('0xa'),'collate':_0xe52a('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 7fb204b..de940eb 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 _0x87fb=['redis','defaults','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4116e9,_0x23be1b){var _0x55e7ee=function(_0x4006cd){while(--_0x4006cd){_0x4116e9['push'](_0x4116e9['shift']());}};_0x55e7ee(++_0x23be1b);}(_0x87fb,0xde));var _0xb87f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x87fb[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xb87f('0x0'));var util=require(_0xb87f('0x1'));var moment=require(_0xb87f('0x2'));var BPromise=require('bluebird');var rs=require(_0xb87f('0x3'));var fs=require('fs');var Redis=require(_0xb87f('0x4'));var db=require(_0xb87f('0x5'))['db'];var utils=require(_0xb87f('0x6'));var logger=require('../../config/logger')(_0xb87f('0x7'));var config=require(_0xb87f('0x8'));var jayson=require(_0xb87f('0x9'));var client=jayson[_0xb87f('0xa')][_0xb87f('0xb')]({'port':0x232a});config[_0xb87f('0xc')]=_[_0xb87f('0xd')](config[_0xb87f('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb87f('0xe'))[_0xb87f('0xf')](socket);function respondWithRpcPromise(_0x4b757d,_0x6d00d,_0x1955b9){return new BPromise(function(_0x1202fc,_0x476457){return client[_0xb87f('0x10')](_0x4b757d,_0x1955b9)[_0xb87f('0x11')](function(_0x240d01){logger[_0xb87f('0x12')](_0xb87f('0x13'),_0x6d00d,_0xb87f('0x14'));logger['debug'](_0xb87f('0x15'),_0x6d00d,_0xb87f('0x14'),JSON[_0xb87f('0x16')](_0x240d01));if(_0x240d01[_0xb87f('0x17')]){if(_0x240d01[_0xb87f('0x17')]['code']===0x1f4){logger['error'](_0xb87f('0x13'),_0x6d00d,_0x240d01[_0xb87f('0x17')][_0xb87f('0x18')]);return _0x476457(_0x240d01[_0xb87f('0x17')][_0xb87f('0x18')]);}logger[_0xb87f('0x17')](_0xb87f('0x13'),_0x6d00d,_0x240d01[_0xb87f('0x17')]['message']);return _0x1202fc(_0x240d01[_0xb87f('0x17')][_0xb87f('0x18')]);}else{logger['info'](_0xb87f('0x13'),_0x6d00d,_0xb87f('0x14'));_0x1202fc(_0x240d01[_0xb87f('0x19')][_0xb87f('0x18')]);}})['catch'](function(_0x5742dd){logger[_0xb87f('0x17')](_0xb87f('0x13'),_0x6d00d,_0x5742dd);_0x476457(_0x5742dd);});});} \ No newline at end of file +var _0xd070=['stringify','error','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','redis','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s'];(function(_0x20a316,_0x3e60af){var _0x45553e=function(_0x22b540){while(--_0x22b540){_0x20a316['push'](_0x20a316['shift']());}};_0x45553e(++_0x3e60af);}(_0xd070,0x114));var _0x0d07=function(_0x25f699,_0x1d141a){_0x25f699=_0x25f699-0x0;var _0x2936db=_0xd070[_0x25f699];return _0x2936db;};'use strict';var _=require(_0x0d07('0x0'));var util=require(_0x0d07('0x1'));var moment=require('moment');var BPromise=require(_0x0d07('0x2'));var rs=require(_0x0d07('0x3'));var fs=require('fs');var Redis=require(_0x0d07('0x4'));var db=require(_0x0d07('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d07('0x6'))(_0x0d07('0x7'));var config=require(_0x0d07('0x8'));var jayson=require(_0x0d07('0x9'));var client=jayson['client'][_0x0d07('0xa')]({'port':0x232a});config['redis']=_[_0x0d07('0xb')](config['redis'],{'host':_0x0d07('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d07('0xd')]));require(_0x0d07('0xe'))['register'](socket);function respondWithRpcPromise(_0x49727e,_0x18fbb6,_0x5a67e8){return new BPromise(function(_0x58d428,_0x2255e8){return client[_0x0d07('0xf')](_0x49727e,_0x5a67e8)[_0x0d07('0x10')](function(_0x25383a){logger[_0x0d07('0x11')](_0x0d07('0x12'),_0x18fbb6,'request\x20sent');logger[_0x0d07('0x13')](_0x0d07('0x14'),_0x18fbb6,'request\x20sent',JSON[_0x0d07('0x15')](_0x25383a));if(_0x25383a[_0x0d07('0x16')]){if(_0x25383a['error']['code']===0x1f4){logger[_0x0d07('0x16')](_0x0d07('0x12'),_0x18fbb6,_0x25383a['error']['message']);return _0x2255e8(_0x25383a[_0x0d07('0x16')][_0x0d07('0x17')]);}logger[_0x0d07('0x16')](_0x0d07('0x12'),_0x18fbb6,_0x25383a[_0x0d07('0x16')][_0x0d07('0x17')]);return _0x58d428(_0x25383a['error'][_0x0d07('0x17')]);}else{logger['info'](_0x0d07('0x12'),_0x18fbb6,_0x0d07('0x18'));_0x58d428(_0x25383a[_0x0d07('0x19')][_0x0d07('0x17')]);}})[_0x0d07('0x1a')](function(_0x10c917){logger['error'](_0x0d07('0x12'),_0x18fbb6,_0x10c917);_0x2255e8(_0x10c917);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index da044c2..e2b79a4 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 _0x3d9c=['removeListener','length','userNotification:','remove','update','emit'];(function(_0x34363a,_0x377853){var _0x252742=function(_0x5c3c3b){while(--_0x5c3c3b){_0x34363a['push'](_0x34363a['shift']());}};_0x252742(++_0x377853);}(_0x3d9c,0x129));var _0xc3d9=function(_0x1eb2af,_0x1bbb9f){_0x1eb2af=_0x1eb2af-0x0;var _0x20b2c7=_0x3d9c[_0x1eb2af];return _0x20b2c7;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=['save',_0xc3d9('0x0'),_0xc3d9('0x1')];function createListener(_0x416c7b,_0x366999){return function(_0x4dc96a){_0x366999[_0xc3d9('0x2')](_0x416c7b,_0x4dc96a);};}function removeListener(_0x128658,_0x33c189){return function(){UserNotificationEvents[_0xc3d9('0x3')](_0x128658,_0x33c189);};}exports['register']=function(_0x5eb60f){for(var _0x12948a=0x0,_0x30af8f=events[_0xc3d9('0x4')];_0x12948a<_0x30af8f;_0x12948a++){var _0x100731=events[_0x12948a];var _0x50a234=createListener(_0xc3d9('0x5')+_0x100731,_0x5eb60f);UserNotificationEvents['on'](_0x100731,_0x50a234);}}; \ No newline at end of file +var _0x90e0=['length','userNotification:','./userNotification.events','save','remove','emit','removeListener'];(function(_0xa3c06b,_0x490f99){var _0x33aa1d=function(_0x23a88e){while(--_0x23a88e){_0xa3c06b['push'](_0xa3c06b['shift']());}};_0x33aa1d(++_0x490f99);}(_0x90e0,0xc6));var _0x090e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90e0[_0x3dd15e];return _0x231fd0;};'use strict';var UserNotificationEvents=require(_0x090e('0x0'));var events=[_0x090e('0x1'),_0x090e('0x2'),'update'];function createListener(_0x1f896d,_0xd10244){return function(_0xbd6d08){_0xd10244[_0x090e('0x3')](_0x1f896d,_0xbd6d08);};}function removeListener(_0x18889,_0x3eca05){return function(){UserNotificationEvents[_0x090e('0x4')](_0x18889,_0x3eca05);};}exports['register']=function(_0x1259ea){for(var _0x4a19a3=0x0,_0x412497=events[_0x090e('0x5')];_0x4a19a3<_0x412497;_0x4a19a3++){var _0x5e89fe=events[_0x4a19a3];var _0x6c0a57=createListener(_0x090e('0x6')+_0x5e89fe,_0x1259ea);UserNotificationEvents['on'](_0x5e89fe,_0x6c0a57);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index f544b94..5808b63 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1a3243,_0x201872){var _0x33f2ca=function(_0x59d32e){while(--_0x59d32e){_0x1a3243['push'](_0x1a3243['shift']());}};_0x33f2ca(++_0x201872);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x41ecd4,_0x4876f3){var _0x457945=function(_0x397e58){while(--_0x397e58){_0x41ecd4['push'](_0x41ecd4['shift']());}};_0x457945(++_0x4876f3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0xcb91[_0x270adf];return _0x29eda9;};'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 c451d2b..b47bb7f 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 _0xf206=['exports','INTEGER'];(function(_0x53c176,_0x156103){var _0x119fed=function(_0x10f774){while(--_0x10f774){_0x53c176['push'](_0x53c176['shift']());}};_0x119fed(++_0x156103);}(_0xf206,0x1f0));var _0x6f20=function(_0x3ff9bd,_0x4ca8c6){_0x3ff9bd=_0x3ff9bd-0x0;var _0x5aef17=_0xf206[_0x3ff9bd];return _0x5aef17;};'use strict';var Sequelize=require('sequelize');module[_0x6f20('0x0')]={'penalty':{'type':Sequelize[_0x6f20('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x11db=['sequelize','exports','INTEGER'];(function(_0x284e9e,_0x3bc517){var _0x420d8b=function(_0x2b2dce){while(--_0x2b2dce){_0x284e9e['push'](_0x284e9e['shift']());}};_0x420d8b(++_0x3bc517);}(_0x11db,0x195));var _0xb11d=function(_0x395bfe,_0x4db521){_0x395bfe=_0x395bfe-0x0;var _0x35c81c=_0x11db[_0x395bfe];return _0x35c81c;};'use strict';var Sequelize=require(_0xb11d('0x0'));module[_0xb11d('0x1')]={'penalty':{'type':Sequelize[_0xb11d('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 71243b6..66d7501 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 _0x95db=['exports','user_has_openchannel_queues','lodash','util','moment','bluebird','rimraf','../../config/environment','./userOpenchannelQueue.attributes'];(function(_0x97f6d2,_0x5567c2){var _0x285063=function(_0x431d23){while(--_0x431d23){_0x97f6d2['push'](_0x97f6d2['shift']());}};_0x285063(++_0x5567c2);}(_0x95db,0xc8));var _0xb95d=function(_0x30815e,_0x1fef60){_0x30815e=_0x30815e-0x0;var _0x5e1d58=_0x95db[_0x30815e];return _0x5e1d58;};'use strict';var _=require(_0xb95d('0x0'));var util=require(_0xb95d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb95d('0x2'));var BPromise=require(_0xb95d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb95d('0x4'));var config=require(_0xb95d('0x5'));var attributes=require(_0xb95d('0x6'));module[_0xb95d('0x7')]=function(_0x568cdf,_0x4a96c4){return _0x568cdf['define']('UserOpenchannelQueue',attributes,{'tableName':_0xb95d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9f7=['moment','bluebird','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger'];(function(_0x5c6022,_0x5cd10b){var _0x4ab5af=function(_0x988aff){while(--_0x988aff){_0x5c6022['push'](_0x5c6022['shift']());}};_0x4ab5af(++_0x5cd10b);}(_0xe9f7,0xfb));var _0x7e9f=function(_0x180c9b,_0x13d173){_0x180c9b=_0x180c9b-0x0;var _0x3ff116=_0xe9f7[_0x180c9b];return _0x3ff116;};'use strict';var _=require('lodash');var util=require(_0x7e9f('0x0'));var logger=require(_0x7e9f('0x1'))('api');var moment=require(_0x7e9f('0x2'));var BPromise=require(_0x7e9f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7e9f('0x4'));var rimraf=require(_0x7e9f('0x5'));var config=require(_0x7e9f('0x6'));var attributes=require(_0x7e9f('0x7'));module[_0x7e9f('0x8')]=function(_0x327657,_0x5ca7c4){return _0x327657['define'](_0x7e9f('0x9'),attributes,{'tableName':_0x7e9f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index f5f2f18..381b79b 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 _0x0a2b=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0a2b,0xbe));var _0xb0a2=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0x0a2b[_0x2f71f6];return _0x2b23ea;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb0a2('0x0'));var BPromise=require('bluebird');var rs=require(_0xb0a2('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb0a2('0x2'))['db'];var utils=require(_0xb0a2('0x3'));var logger=require(_0xb0a2('0x4'))('rpc');var config=require(_0xb0a2('0x5'));var jayson=require(_0xb0a2('0x6'));var client=jayson[_0xb0a2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1207f9,_0x2da41c,_0x296383){return new BPromise(function(_0x46696a,_0x353f17){return client['request'](_0x1207f9,_0x296383)[_0xb0a2('0x8')](function(_0x154daa){logger[_0xb0a2('0x9')](_0xb0a2('0xa'),_0x2da41c,'request\x20sent');logger[_0xb0a2('0xb')](_0xb0a2('0xc'),_0x2da41c,_0xb0a2('0xd'),JSON[_0xb0a2('0xe')](_0x154daa));if(_0x154daa[_0xb0a2('0xf')]){if(_0x154daa['error'][_0xb0a2('0x10')]===0x1f4){logger[_0xb0a2('0xf')](_0xb0a2('0xa'),_0x2da41c,_0x154daa[_0xb0a2('0xf')][_0xb0a2('0x11')]);return _0x353f17(_0x154daa[_0xb0a2('0xf')][_0xb0a2('0x11')]);}logger[_0xb0a2('0xf')](_0xb0a2('0xa'),_0x2da41c,_0x154daa[_0xb0a2('0xf')][_0xb0a2('0x11')]);return _0x46696a(_0x154daa[_0xb0a2('0xf')][_0xb0a2('0x11')]);}else{logger[_0xb0a2('0x9')](_0xb0a2('0xa'),_0x2da41c,_0xb0a2('0xd'));_0x46696a(_0x154daa['result'][_0xb0a2('0x11')]);}})[_0xb0a2('0x12')](function(_0x308bea){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x2da41c,_0x308bea);_0x353f17(_0x308bea);});});} \ No newline at end of file +var _0xa43b=['request','then','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise'];(function(_0x4d7b6d,_0x233fad){var _0x5e930a=function(_0x2015c2){while(--_0x2015c2){_0x4d7b6d['push'](_0x4d7b6d['shift']());}};_0x5e930a(++_0x233fad);}(_0xa43b,0x174));var _0xba43=function(_0x3a1fa1,_0x4f3541){_0x3a1fa1=_0x3a1fa1-0x0;var _0x117961=_0xa43b[_0x3a1fa1];return _0x117961;};'use strict';var _=require(_0xba43('0x0'));var util=require(_0xba43('0x1'));var moment=require(_0xba43('0x2'));var BPromise=require(_0xba43('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba43('0x4'));var db=require(_0xba43('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xba43('0x6'));var config=require('../../config/environment');var jayson=require(_0xba43('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x453d99,_0xcd2071,_0x1fc8bf){return new BPromise(function(_0x1c8e79,_0x343109){return client[_0xba43('0x8')](_0x453d99,_0x1fc8bf)[_0xba43('0x9')](function(_0x561489){logger[_0xba43('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0xcd2071,_0xba43('0xb'));logger[_0xba43('0xc')](_0xba43('0xd'),_0xcd2071,_0xba43('0xb'),JSON[_0xba43('0xe')](_0x561489));if(_0x561489[_0xba43('0xf')]){if(_0x561489[_0xba43('0xf')][_0xba43('0x10')]===0x1f4){logger[_0xba43('0xf')](_0xba43('0x11'),_0xcd2071,_0x561489[_0xba43('0xf')][_0xba43('0x12')]);return _0x343109(_0x561489[_0xba43('0xf')][_0xba43('0x12')]);}logger[_0xba43('0xf')](_0xba43('0x11'),_0xcd2071,_0x561489[_0xba43('0xf')][_0xba43('0x12')]);return _0x1c8e79(_0x561489[_0xba43('0xf')]['message']);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0xcd2071,_0xba43('0xb'));_0x1c8e79(_0x561489['result'][_0xba43('0x12')]);}})[_0xba43('0x13')](function(_0x39b448){logger[_0xba43('0xf')](_0xba43('0x11'),_0xcd2071,_0x39b448);_0x343109(_0x39b448);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index f91b78e..145d2d5 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 _0xc918=['removeSections','removeResources','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','show','get','getSections','/:id/resources','create','post','/:id/clone','clone','/:id/sections','addSections','addResources','/:id','update','delete','destroy'];(function(_0x10794b,_0x532da7){var _0x47a598=function(_0x35f1aa){while(--_0x35f1aa){_0x10794b['push'](_0x10794b['shift']());}};_0x47a598(++_0x532da7);}(_0xc918,0xb9));var _0x8c91=function(_0x325f87,_0x3fffdf){_0x325f87=_0x325f87-0x0;var _0x4b7b28=_0xc918[_0x325f87];return _0x4b7b28;};'use strict';var multer=require(_0x8c91('0x0'));var util=require(_0x8c91('0x1'));var path=require('path');var timeout=require(_0x8c91('0x2'));var express=require('express');var router=express[_0x8c91('0x3')]();var fs_extra=require(_0x8c91('0x4'));var auth=require(_0x8c91('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8c91('0x6'));var controller=require('./userProfile.controller');router['get']('/',auth[_0x8c91('0x7')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x8c91('0x7')](),controller[_0x8c91('0x8')]);router[_0x8c91('0x9')]('/:id/sections',auth['isAuthenticated'](),controller[_0x8c91('0xa')]);router[_0x8c91('0x9')](_0x8c91('0xb'),auth['isAuthenticated'](),controller['getResources']);router['post']('/',auth[_0x8c91('0x7')](),controller[_0x8c91('0xc')]);router[_0x8c91('0xd')](_0x8c91('0xe'),auth[_0x8c91('0x7')](),controller[_0x8c91('0xf')]);router['post'](_0x8c91('0x10'),auth[_0x8c91('0x7')](),controller[_0x8c91('0x11')]);router['post'](_0x8c91('0xb'),auth[_0x8c91('0x7')](),controller[_0x8c91('0x12')]);router['put'](_0x8c91('0x13'),auth[_0x8c91('0x7')](),controller[_0x8c91('0x14')]);router[_0x8c91('0x15')](_0x8c91('0x13'),auth[_0x8c91('0x7')](),controller[_0x8c91('0x16')]);router[_0x8c91('0x15')](_0x8c91('0x10'),auth[_0x8c91('0x7')](),controller[_0x8c91('0x17')]);router['delete'](_0x8c91('0xb'),auth[_0x8c91('0x7')](),controller[_0x8c91('0x18')]);module[_0x8c91('0x19')]=router; \ No newline at end of file +var _0x8e62=['describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','put','update','delete','destroy','removeSections','removeResources','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe'];(function(_0x5d148c,_0x3cd1a3){var _0x5deaa7=function(_0x44cb66){while(--_0x44cb66){_0x5d148c['push'](_0x5d148c['shift']());}};_0x5deaa7(++_0x3cd1a3);}(_0x8e62,0x187));var _0x28e6=function(_0x23bed6,_0x45f84f){_0x23bed6=_0x23bed6-0x0;var _0x1f9d5b=_0x8e62[_0x23bed6];return _0x1f9d5b;};'use strict';var multer=require(_0x28e6('0x0'));var util=require(_0x28e6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x28e6('0x2'));var router=express[_0x28e6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x28e6('0x4'));var interaction=require(_0x28e6('0x5'));var config=require(_0x28e6('0x6'));var controller=require(_0x28e6('0x7'));router[_0x28e6('0x8')]('/',auth[_0x28e6('0x9')](),controller[_0x28e6('0xa')]);router[_0x28e6('0x8')](_0x28e6('0xb'),auth['isAuthenticated'](),controller[_0x28e6('0xc')]);router['get'](_0x28e6('0xd'),auth[_0x28e6('0x9')](),controller[_0x28e6('0xe')]);router[_0x28e6('0x8')](_0x28e6('0xf'),auth[_0x28e6('0x9')](),controller[_0x28e6('0x10')]);router[_0x28e6('0x8')](_0x28e6('0x11'),auth[_0x28e6('0x9')](),controller[_0x28e6('0x12')]);router[_0x28e6('0x13')]('/',auth[_0x28e6('0x9')](),controller[_0x28e6('0x14')]);router[_0x28e6('0x13')](_0x28e6('0x15'),auth[_0x28e6('0x9')](),controller[_0x28e6('0x16')]);router[_0x28e6('0x13')](_0x28e6('0xf'),auth[_0x28e6('0x9')](),controller[_0x28e6('0x17')]);router['post'](_0x28e6('0x11'),auth[_0x28e6('0x9')](),controller['addResources']);router[_0x28e6('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x28e6('0x19')]);router[_0x28e6('0x1a')](_0x28e6('0xd'),auth[_0x28e6('0x9')](),controller[_0x28e6('0x1b')]);router['delete']('/:id/sections',auth[_0x28e6('0x9')](),controller[_0x28e6('0x1c')]);router[_0x28e6('0x1a')](_0x28e6('0x11'),auth[_0x28e6('0x9')](),controller[_0x28e6('0x1d')]);module[_0x28e6('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 b76c9e6..107004d 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 _0x4e83=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','crudPermissions','join'];(function(_0x2a2799,_0x5e25a8){var _0x17f761=function(_0x523b8a){while(--_0x523b8a){_0x2a2799['push'](_0x2a2799['shift']());}};_0x17f761(++_0x5e25a8);}(_0x4e83,0x1e3));var _0x34e8=function(_0x5dc0de,_0x25bba4){_0x5dc0de=_0x5dc0de-0x0;var _0x54ba0e=_0x4e83[_0x5dc0de];return _0x54ba0e;};'use strict';var Sequelize=require(_0x34e8('0x0'));module[_0x34e8('0x1')]={'name':{'type':Sequelize[_0x34e8('0x2')],'allowNull':![],'unique':_0x34e8('0x3')},'crudPermissions':{'type':Sequelize[_0x34e8('0x2')],'set':function(_0xf23ccc){this[_0x34e8('0x4')](_0x34e8('0x5'),_0xf23ccc?_0xf23ccc[_0x34e8('0x6')](''):[]);},'get':function(){return this[_0x34e8('0x7')](_0x34e8('0x5'))?this[_0x34e8('0x7')](_0x34e8('0x5'))[_0x34e8('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x34e8('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x34e8('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x34e8('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x34e8('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x34e8('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x34e8('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x34e8('0x9')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4dff=['BOOLEAN','sequelize','exports','STRING','name','setDataValue','crudPermissions','join','getDataValue'];(function(_0x5c97e3,_0x3d8242){var _0x5b4857=function(_0x78d3e1){while(--_0x78d3e1){_0x5c97e3['push'](_0x5c97e3['shift']());}};_0x5b4857(++_0x3d8242);}(_0x4dff,0x10f));var _0xf4df=function(_0x3a58fa,_0x93b7f5){_0x3a58fa=_0x3a58fa-0x0;var _0x266d97=_0x4dff[_0x3a58fa];return _0x266d97;};'use strict';var Sequelize=require(_0xf4df('0x0'));module[_0xf4df('0x1')]={'name':{'type':Sequelize[_0xf4df('0x2')],'allowNull':![],'unique':_0xf4df('0x3')},'crudPermissions':{'type':Sequelize[_0xf4df('0x2')],'set':function(_0x5534de){this[_0xf4df('0x4')](_0xf4df('0x5'),_0x5534de?_0x5534de[_0xf4df('0x6')](''):[]);},'get':function(){return this[_0xf4df('0x7')](_0xf4df('0x5'))?this[_0xf4df('0x7')](_0xf4df('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xf4df('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xf4df('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xf4df('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xf4df('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xf4df('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xf4df('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xf4df('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index a0c2dfb..684d0f9 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 _0xee9c=['rows','catch','show','params','rawAttributes','include','find','create','clone','omit','createdAt','updatedAt','body','sequelize','transaction','get','UserProfileSection','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','each','push','removeSections','getSections','enabled','includes','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','UserProfile','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll'];(function(_0x5012b3,_0xb55527){var _0x55dfce=function(_0x85efa2){while(--_0x85efa2){_0x5012b3['push'](_0x5012b3['shift']());}};_0x55dfce(++_0xb55527);}(_0xee9c,0x1e6));var _0xcee9=function(_0x2f37e0,_0x393ef9){_0x2f37e0=_0x2f37e0-0x0;var _0x43ccce=_0xee9c[_0x2f37e0];return _0x43ccce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcee9('0x0'));var zipdir=require(_0xcee9('0x1'));var jsonpatch=require(_0xcee9('0x2'));var rp=require(_0xcee9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcee9('0x4'));var util=require(_0xcee9('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xcee9('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcee9('0x7'));var _=require(_0xcee9('0x8'));var squel=require(_0xcee9('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcee9('0xa'));var toCsv=require(_0xcee9('0x6'));var querystring=require('querystring');var Papa=require(_0xcee9('0xb'));var Redis=require(_0xcee9('0xc'));var authService=require(_0xcee9('0xd'));var qs=require(_0xcee9('0xe'));var as=require(_0xcee9('0xf'));var hardwareService=require(_0xcee9('0x10'));var logger=require('../../config/logger')(_0xcee9('0x11'));var utils=require(_0xcee9('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xcee9('0x13'));var db=require(_0xcee9('0x14'))['db'];config[_0xcee9('0x15')]=_['defaults'](config[_0xcee9('0x15')],{'host':_0xcee9('0x16'),'port':0x18eb});var socket=require(_0xcee9('0x17'))(new Redis(config[_0xcee9('0x15')]));require(_0xcee9('0x18'))['register'](socket);function respondWithStatusCode(_0x5e9930,_0x3e54f8){_0x3e54f8=_0x3e54f8||0xcc;return function(_0x9031f2){if(_0x9031f2){return _0x5e9930[_0xcee9('0x19')](_0x3e54f8);}return _0x5e9930[_0xcee9('0x1a')](_0x3e54f8)[_0xcee9('0x1b')]();};}function respondWithResult(_0x1e3790,_0x3addfc){_0x3addfc=_0x3addfc||0xc8;return function(_0x12320c){if(_0x12320c){return _0x1e3790[_0xcee9('0x1a')](_0x3addfc)[_0xcee9('0x1c')](_0x12320c);}};}function respondWithFilteredResult(_0x1eec39,_0x309191){return function(_0x552ca1){if(_0x552ca1){var _0x10e6b5=typeof _0x309191[_0xcee9('0x1d')]===_0xcee9('0x1e')&&typeof _0x309191[_0xcee9('0x1f')]===_0xcee9('0x1e');var _0x492fd6=_0x552ca1[_0xcee9('0x20')];var _0x16dfd1=_0x10e6b5?0x0:_0x309191[_0xcee9('0x1d')];var _0x961900=_0x10e6b5?_0x552ca1['count']:_0x309191[_0xcee9('0x1d')]+_0x309191[_0xcee9('0x1f')];var _0x4e5a1a;if(_0x961900>=_0x492fd6){_0x961900=_0x492fd6;_0x4e5a1a=0xc8;}else{_0x4e5a1a=0xce;}_0x1eec39['status'](_0x4e5a1a);return _0x1eec39[_0xcee9('0x21')](_0xcee9('0x22'),_0x16dfd1+'-'+_0x961900+'/'+_0x492fd6)[_0xcee9('0x1c')](_0x552ca1);}return null;};}function patchUpdates(_0x49afe8){return function(_0x121322){try{jsonpatch[_0xcee9('0x23')](_0x121322,_0x49afe8,!![]);}catch(_0x39956f){return BPromise['reject'](_0x39956f);}return _0x121322[_0xcee9('0x24')]();};}function saveUpdates(_0x5c1250,_0x26c694){return function(_0x3397bd){if(_0x3397bd){return _0x3397bd[_0xcee9('0x25')](_0x5c1250)[_0xcee9('0x26')](function(_0xef4b0a){return _0xef4b0a;});}return null;};}function removeEntity(_0x3ce813,_0x1c8d26){return function(_0x591eaa){if(_0x591eaa){return _0x591eaa[_0xcee9('0x27')]()[_0xcee9('0x26')](function(){_0x3ce813['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19a25e,_0x5180f5){return function(_0x4593bc){if(!_0x4593bc){_0x19a25e[_0xcee9('0x19')](0x194);}return _0x4593bc;};}function handleError(_0x20365d,_0x45a2b6){_0x45a2b6=_0x45a2b6||0x1f4;return function(_0x5911bf){logger[_0xcee9('0x28')](_0x5911bf[_0xcee9('0x29')]);if(_0x5911bf[_0xcee9('0x2a')]){delete _0x5911bf['name'];}_0x20365d[_0xcee9('0x1a')](_0x45a2b6)[_0xcee9('0x2b')](_0x5911bf);};}exports[_0xcee9('0x2c')]=function(_0x527c2d,_0x6a9aa8){var _0x6bfe80={},_0x423287={},_0x2e44dc={'count':0x0,'rows':[]};var _0x4de639=_[_0xcee9('0x2d')](db[_0xcee9('0x2e')]['rawAttributes'],function(_0x3fb329){return{'name':_0x3fb329[_0xcee9('0x2f')],'type':_0x3fb329[_0xcee9('0x30')][_0xcee9('0x31')]};});_0x423287['model']=_['map'](_0x4de639,_0xcee9('0x2a'));_0x423287[_0xcee9('0x32')]=_[_0xcee9('0x33')](_0x527c2d[_0xcee9('0x32')]);_0x423287[_0xcee9('0x34')]=_[_0xcee9('0x35')](_0x423287[_0xcee9('0x36')],_0x423287['query']);_0x6bfe80[_0xcee9('0x37')]=_[_0xcee9('0x35')](_0x423287[_0xcee9('0x36')],qs['fields'](_0x527c2d[_0xcee9('0x32')][_0xcee9('0x38')]));_0x6bfe80[_0xcee9('0x37')]=_0x6bfe80[_0xcee9('0x37')][_0xcee9('0x39')]?_0x6bfe80['attributes']:_0x423287['model'];if(!_0x527c2d[_0xcee9('0x32')][_0xcee9('0x3a')](_0xcee9('0x3b'))){_0x6bfe80['limit']=qs[_0xcee9('0x1f')](_0x527c2d[_0xcee9('0x32')][_0xcee9('0x1f')]);_0x6bfe80[_0xcee9('0x1d')]=qs[_0xcee9('0x1d')](_0x527c2d[_0xcee9('0x32')]['offset']);}_0x6bfe80[_0xcee9('0x3c')]=qs[_0xcee9('0x3d')](_0x527c2d[_0xcee9('0x32')][_0xcee9('0x3d')]);_0x6bfe80['where']=qs['filters'](_[_0xcee9('0x3e')](_0x527c2d[_0xcee9('0x32')],_0x423287['filters']),_0x4de639);if(_0x527c2d['query'][_0xcee9('0x3f')]){_0x6bfe80[_0xcee9('0x40')]=_['merge'](_0x6bfe80[_0xcee9('0x40')],{'$or':_[_0xcee9('0x2d')](_0x4de639,function(_0x1327e0){if(_0x1327e0['type']!=='VIRTUAL'){var _0x35dbfc={};_0x35dbfc[_0x1327e0[_0xcee9('0x2a')]]={'$like':'%'+_0x527c2d[_0xcee9('0x32')][_0xcee9('0x3f')]+'%'};return _0x35dbfc;}})});}_0x6bfe80=_[_0xcee9('0x41')]({},_0x6bfe80,_0x527c2d[_0xcee9('0x42')]);var _0x30923e={'where':_0x6bfe80[_0xcee9('0x40')]};return db[_0xcee9('0x2e')][_0xcee9('0x20')](_0x30923e)[_0xcee9('0x26')](function(_0x5827ae){_0x2e44dc['count']=_0x5827ae;if(_0x527c2d[_0xcee9('0x32')][_0xcee9('0x43')]){_0x6bfe80['include']=[{'all':!![]}];}return db[_0xcee9('0x2e')][_0xcee9('0x44')](_0x6bfe80);})[_0xcee9('0x26')](function(_0x53409e){_0x2e44dc[_0xcee9('0x45')]=_0x53409e;return _0x2e44dc;})['then'](respondWithFilteredResult(_0x6a9aa8,_0x6bfe80))[_0xcee9('0x46')](handleError(_0x6a9aa8,null));};exports[_0xcee9('0x47')]=function(_0x369f31,_0x4ca507){var _0x45d13f={'raw':![],'where':{'id':_0x369f31[_0xcee9('0x48')]['id']}},_0x2929d0={};_0x2929d0['model']=_[_0xcee9('0x33')](db['UserProfile'][_0xcee9('0x49')]);_0x2929d0[_0xcee9('0x32')]=_[_0xcee9('0x33')](_0x369f31[_0xcee9('0x32')]);_0x2929d0[_0xcee9('0x34')]=_[_0xcee9('0x35')](_0x2929d0[_0xcee9('0x36')],_0x2929d0[_0xcee9('0x32')]);_0x45d13f[_0xcee9('0x37')]=_[_0xcee9('0x35')](_0x2929d0[_0xcee9('0x36')],qs[_0xcee9('0x38')](_0x369f31['query']['fields']));_0x45d13f[_0xcee9('0x37')]=_0x45d13f[_0xcee9('0x37')][_0xcee9('0x39')]?_0x45d13f['attributes']:_0x2929d0['model'];if(_0x369f31['query'][_0xcee9('0x43')]){_0x45d13f[_0xcee9('0x4a')]=[{'all':!![]}];}_0x45d13f=_[_0xcee9('0x41')]({},_0x45d13f,_0x369f31[_0xcee9('0x42')]);return db['UserProfile'][_0xcee9('0x4b')](_0x45d13f)['then'](handleEntityNotFound(_0x4ca507,null))[_0xcee9('0x26')](respondWithResult(_0x4ca507,null))[_0xcee9('0x46')](handleError(_0x4ca507,null));};exports[_0xcee9('0x4c')]=function(_0x315446,_0x499152){return db['UserProfile']['create'](_0x315446['body'],{})['then'](respondWithResult(_0x499152,0xc9))['catch'](handleError(_0x499152,null));};exports[_0xcee9('0x4d')]=function(_0x244fe5,_0x5ae137){var _0x2db398={'where':{'id':_0x244fe5[_0xcee9('0x48')]['id']}},_0x352c7b={};_0x352c7b['model']=_[_0xcee9('0x33')](db['UserProfile'][_0xcee9('0x49')]);_0x2db398[_0xcee9('0x37')]=_[_0xcee9('0x35')](_0x352c7b[_0xcee9('0x36')],qs[_0xcee9('0x38')](_0x244fe5['query'][_0xcee9('0x38')]));_0x2db398[_0xcee9('0x37')]=_0x2db398[_0xcee9('0x37')]['length']?_0x2db398['attributes']:_0x352c7b[_0xcee9('0x36')];if(_0x244fe5[_0xcee9('0x32')][_0xcee9('0x43')]){_0x2db398[_0xcee9('0x4a')]=[{'all':!![]}];}_0x2db398=_[_0xcee9('0x41')]({},_0x2db398,_0x244fe5[_0xcee9('0x42')]);return db[_0xcee9('0x2e')]['find'](_0x2db398)[_0xcee9('0x26')](handleEntityNotFound(_0x5ae137,null))[_0xcee9('0x26')](function(_0x2c7ee8){if(_0x2c7ee8){var _0x159b12=_0x2c7ee8['get']({'plain':!![]});_0x159b12=qs[_0xcee9('0x4e')](_0x159b12,['id',_0xcee9('0x4f'),_0xcee9('0x50'),'crudPermissions']);_0x244fe5[_0xcee9('0x51')]=_['omit'](_0x244fe5['body'],['id',_0xcee9('0x4f'),_0xcee9('0x50')]);return db[_0xcee9('0x52')][_0xcee9('0x53')](function(_0x231f7a){return db[_0xcee9('0x2e')][_0xcee9('0x4c')](_[_0xcee9('0x41')](_0x159b12,_0x244fe5[_0xcee9('0x51')]),{'include':_0x244fe5[_0xcee9('0x32')][_0xcee9('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x231f7a})['then'](function(_0xfb9790){var _0x139fbd=_0xfb9790[_0xcee9('0x54')]({'plain':!![]});return db[_0xcee9('0x55')][_0xcee9('0x44')]({'where':{'userProfileId':_0x244fe5[_0xcee9('0x48')]['id']},'raw':!![]})[_0xcee9('0x26')](function(_0x549293){if(_0x549293){return BPromise['each'](_0x549293,function(_0x5bd977){return new BPromise(function(_0x39ab3b,_0x22069d){if(_0x5bd977[_0xcee9('0x56')]===null||_0x5bd977['autoAssociation']===0x1)_0x39ab3b(null);return db[_0xcee9('0x57')][_0xcee9('0x44')]({'where':{'sectionId':_0x5bd977['id']},'raw':!![]})[_0xcee9('0x26')](function(_0x31cf21){var _0x33ccd9=_['map'](_0x31cf21,function(_0xaab4e4){return qs[_0xcee9('0x4e')](_0xaab4e4,['id','createdAt','updatedAt',_0xcee9('0x58')]);});_0x39ab3b(_0x33ccd9);})[_0xcee9('0x46')](function(_0x323c76){_0x22069d(_0x323c76);});})[_0xcee9('0x26')](function(_0xf92a2b){var _0x36211d=qs[_0xcee9('0x4e')](_0x5bd977,['id',_0xcee9('0x4f'),_0xcee9('0x50')]);_0x36211d[_0xcee9('0x59')]=_0x139fbd['id'];if(_0xf92a2b)_0x36211d['Resources']=_0xf92a2b;return _0x36211d;})['then'](function(_0x4620eb){return db[_0xcee9('0x55')][_0xcee9('0x4c')](_0x4620eb,{'include':[{'model':db['UserProfileResource'],'as':_0xcee9('0x5a')}],'raw':!![],'transaction':_0x231f7a});});})[_0xcee9('0x26')](function(){return _0x139fbd;});}});});});}})[_0xcee9('0x26')](respondWithResult(_0x5ae137,0xc9))[_0xcee9('0x46')](handleError(_0x5ae137,null));};exports[_0xcee9('0x25')]=function(_0x3ab3e7,_0x56a9a6){if(_0x3ab3e7[_0xcee9('0x51')]['id']){delete _0x3ab3e7[_0xcee9('0x51')]['id'];}return db[_0xcee9('0x2e')][_0xcee9('0x4b')]({'where':{'id':_0x3ab3e7[_0xcee9('0x48')]['id']}})['then'](handleEntityNotFound(_0x56a9a6,null))[_0xcee9('0x26')](saveUpdates(_0x3ab3e7[_0xcee9('0x51')],null))[_0xcee9('0x26')](respondWithResult(_0x56a9a6,null))[_0xcee9('0x46')](handleError(_0x56a9a6,null));};exports[_0xcee9('0x27')]=function(_0x3b20ec,_0x34e485){return db['UserProfile']['find']({'where':{'id':_0x3b20ec[_0xcee9('0x48')]['id']}})['then'](handleEntityNotFound(_0x34e485,null))[_0xcee9('0x26')](removeEntity(_0x34e485,null))[_0xcee9('0x46')](handleError(_0x34e485,null));};exports[_0xcee9('0x5b')]=function(_0x4b3868,_0x42752e){return db[_0xcee9('0x2e')][_0xcee9('0x5b')]()[_0xcee9('0x26')](respondWithResult(_0x42752e,null))[_0xcee9('0x46')](handleError(_0x42752e,null));};exports['addSections']=function(_0x1cd48f,_0x2c5705){var _0x1eddc1=_0x1cd48f[_0xcee9('0x51')];return db[_0xcee9('0x2e')][_0xcee9('0x4b')]({'where':{'id':_0x1cd48f[_0xcee9('0x48')]['id']}})['then'](handleEntityNotFound(_0x2c5705,null))[_0xcee9('0x26')](function(_0x40a0f9){if(_0x40a0f9){return db['sequelize'][_0xcee9('0x53')](function(_0x184223){return db[_0xcee9('0x55')][_0xcee9('0x27')]({'where':{'userProfileId':_0x1cd48f[_0xcee9('0x48')]['id'],'sectionId':_[_0xcee9('0x2d')](_0x1eddc1,function(_0x45d0f0){return _0x45d0f0[_0xcee9('0x58')];})},'transaction':_0x184223})['then'](function(){var _0x3853bd=_[_0xcee9('0x2d')](_0x1eddc1,function(_0x4d4605){_0x4d4605['userProfileId']=_0x1cd48f['params']['id'];return _0x4d4605;});var _0x46fa8e=[];return BPromise[_0xcee9('0x5c')](_0x3853bd,function(_0x762bcc){return db[_0xcee9('0x55')][_0xcee9('0x4c')](_0x762bcc,{'include':[{'model':db['UserProfileResource'],'as':_0xcee9('0x5a')}],'raw':!![],'transaction':_0x184223})[_0xcee9('0x26')](function(_0x4dfbf0){_0x46fa8e[_0xcee9('0x5d')](_0x4dfbf0['get']({'plain':!![]}));});})[_0xcee9('0x26')](function(){return _0x46fa8e;});});});}})[_0xcee9('0x26')](function(_0x26e715){return _0x26e715;})[_0xcee9('0x26')](respondWithResult(_0x2c5705,null))[_0xcee9('0x46')](handleError(_0x2c5705,null));};exports[_0xcee9('0x5e')]=function(_0x327c1,_0x391fb2){var _0x150824;return db[_0xcee9('0x2e')][_0xcee9('0x4b')]({'where':{'id':_0x327c1[_0xcee9('0x48')]['id']},'attributes':['id',_0xcee9('0x2a')]})['then'](handleEntityNotFound(_0x391fb2,null))[_0xcee9('0x26')](function(_0x588389){if(_0x588389){_0x150824=_0x588389;return db[_0xcee9('0x55')]['destroy']({'where':{'userProfileId':_0x327c1[_0xcee9('0x48')]['id'],'sectionId':_0x327c1[_0xcee9('0x32')]['ids']}});}})[_0xcee9('0x26')](function(){return _0x150824;})[_0xcee9('0x26')](respondWithStatusCode(_0x391fb2,null))['catch'](handleError(_0x391fb2,null));};exports[_0xcee9('0x5f')]=function(_0x596b5e,_0x48eef3){var _0x8ce10f=[];var _0x2b8ef0=[];return db[_0xcee9('0x55')][_0xcee9('0x44')]({'where':{'userProfileId':_0x596b5e[_0xcee9('0x48')]['id']},'raw':!![]})[_0xcee9('0x26')](function(_0x50f082){_0x8ce10f=_[_0xcee9('0x3f')](_0x50f082,function(_0x41c8a2){return _0x41c8a2[_0xcee9('0x60')]===0x1||_[_0xcee9('0x61')]([0x3eb,0x709],_0x41c8a2[_0xcee9('0x58')]);});if(!_['isEmpty'](_0x8ce10f)){return _[_0xcee9('0x2d')](_0x8ce10f,function(_0x206a25){return _0x206a25[_0xcee9('0x58')];});}else{return;}})[_0xcee9('0x26')](function(_0x11c7a6){if(_0x11c7a6)_0x2b8ef0=_0x11c7a6;if(_['includes'](_0x2b8ef0,0x64)){var _0x9143e8=_[_0xcee9('0x4b')](_0x8ce10f,{'sectionId':0x64});return hasDefaultDashboard(_0x9143e8)[_0xcee9('0x26')](function(_0x5154f5){return _[_0xcee9('0x2d')](_0x8ce10f,function(_0x3828f1){if(_0x3828f1[_0xcee9('0x58')]===0x64){_0x3828f1['subsections']=_0x5154f5;}return _0x3828f1;});});}else{return;}})[_0xcee9('0x26')](function(_0x2d7b6b){if(_0x2d7b6b)_0x8ce10f=_0x2d7b6b;if(_['includes'](_0x2b8ef0,0x3eb)){var _0x404aca=_[_0xcee9('0x4b')](_0x8ce10f,{'sectionId':0x3eb});return getCustomDashboards(_0x404aca)[_0xcee9('0x26')](function(_0x2a5484){return _[_0xcee9('0x2d')](_0x8ce10f,function(_0x1f7c2a){if(_0x404aca[_0xcee9('0x60')]){if(_0x1f7c2a['sectionId']===0x3eb){_0x1f7c2a[_0xcee9('0x62')]=_0x2a5484;}}else{if(_0x1f7c2a[_0xcee9('0x58')]===0x64){_0x1f7c2a['subsections']=_0x2a5484;}}return _0x1f7c2a;});});}else{return;}})[_0xcee9('0x26')](function(_0x20d370){if(_0x20d370)_0x8ce10f=_0x20d370;if(_[_0xcee9('0x61')](_0x2b8ef0,0x709)){var _0x241172=_['find'](_0x8ce10f,{'sectionId':0x709});return getPlugins(_0x241172)['then'](function(_0x58549){if(_0x241172['enabled']){return _[_0xcee9('0x2d')](_0x8ce10f,function(_0x1ad60b){if(_0x1ad60b['sectionId']===0x709){_0x1ad60b['subsections']=_0x58549;}return _0x1ad60b;});}else{var _0x2c46ce={'sectionId':0x76c,'enabled':0x1,'subsections':_0x58549};var _0x29e4c7=_[_0xcee9('0x2d')](_0x8ce10f);_0x29e4c7[_0xcee9('0x5d')](_0x2c46ce);return _0x29e4c7;}});}else{return;}})[_0xcee9('0x26')](function(_0x3ee224){if(_0x3ee224)_0x8ce10f=_0x3ee224;return _[_0xcee9('0x3f')](_0x8ce10f,[_0xcee9('0x60'),0x1]);})[_0xcee9('0x26')](respondWithResult(_0x48eef3,null))[_0xcee9('0x46')](handleError(_0x48eef3,null));};function hasDefaultDashboard(_0x1d2668){var _0x1f4c87=[0x65];return new BPromise(function(_0x105b99,_0x3908f9){try{if(_0x1d2668[_0xcee9('0x56')]){_0x105b99(_0x1f4c87);}else{return db['UserProfileResource'][_0xcee9('0x63')]({'where':{'sectionId':_0x1d2668['id']},'raw':!![]})[_0xcee9('0x26')](function(_0xb9e388){_0xb9e388?_0x105b99(_0x1f4c87):_0x105b99();});}}catch(_0x171b13){_0x3908f9(_0x171b13);}});}function getCustomDashboards(_0x4297ce){var _0x4ce9a5=[];return new BPromise(function(_0x35f5ba,_0x5a1395){try{if(_0x4297ce[_0xcee9('0x56')]){return db[_0xcee9('0x64')][_0xcee9('0x44')]({'raw':!![]})['then'](function(_0xd1d4b2){_0xd1d4b2[_0xcee9('0x65')](function(_0x396243){_0x4ce9a5['push'](_0x396243['id']+0x1869f);});_0x35f5ba(_0x4ce9a5);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x4297ce['id']},'raw':!![]})['then'](function(_0x1d56e0){_0x1d56e0[_0xcee9('0x65')](function(_0x46663b){_0x4ce9a5[_0xcee9('0x5d')](_0x46663b[_0xcee9('0x66')]+0x1869f);});_0x35f5ba(_0x4ce9a5);});}}catch(_0x487b10){_0x5a1395(_0x487b10);}});}function getPlugins(_0x3c5b92){var _0x4fbee6=[];return new BPromise(function(_0x5e41f3,_0xc8786f){try{if(_0x3c5b92[_0xcee9('0x56')]){return db[_0xcee9('0x67')][_0xcee9('0x44')]({'raw':!![]})[_0xcee9('0x26')](function(_0x4b391f){_0x4b391f[_0xcee9('0x65')](function(_0x166614){_0x4fbee6['push'](_0x166614['id']+0x15b38);});_0x5e41f3(_0x4fbee6);});}else{return db[_0xcee9('0x57')][_0xcee9('0x44')]({'where':{'sectionId':_0x3c5b92['id']},'raw':!![]})[_0xcee9('0x26')](function(_0x459ad1){_0x459ad1[_0xcee9('0x65')](function(_0x1d1d1a){_0x4fbee6[_0xcee9('0x5d')](_0x1d1d1a[_0xcee9('0x66')]+0x15b38);});_0x5e41f3(_0x4fbee6);});}}catch(_0x4bc259){_0xc8786f(_0x4bc259);}});}exports[_0xcee9('0x68')]=function(_0xc1b414,_0x139eeb){return db[_0xcee9('0x2e')][_0xcee9('0x4b')]({'where':{'id':_0xc1b414[_0xcee9('0x48')]['id']}})[_0xcee9('0x26')](handleEntityNotFound(_0x139eeb,null))['then'](function(_0x523fad){if(_0x523fad){return db[_0xcee9('0x52')][_0xcee9('0x53')](function(_0x3dd5eb){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0xc1b414['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x5ceef4){if(_0x5ceef4){return db[_0xcee9('0x55')][_0xcee9('0x27')]({'where':{'userProfileId':_0xc1b414['params']['id'],'id':_[_0xcee9('0x2d')](_0x5ceef4,function(_0x5ee91d){return _0x5ee91d['id'];})},'transaction':_0x3dd5eb});}})['then'](function(_0x55866a){var _0x562ba7=_[_0xcee9('0x2d')](_0xc1b414['body'],function(_0x3f9ccc){_0x3f9ccc[_0xcee9('0x59')]=_0xc1b414[_0xcee9('0x48')]['id'];return _0x3f9ccc;});return db[_0xcee9('0x55')][_0xcee9('0x69')](_0x562ba7,{'raw':!![],'transaction':_0x3dd5eb});})[_0xcee9('0x26')](function(_0x1a4ca){var _0x4e26dd=_[_0xcee9('0x3f')](_['map'](_0x1a4ca,function(_0x4cd385){return _0x4cd385[_0xcee9('0x54')]({'plain':!![]});}),{'includeAll':![]});if(_0x4e26dd){return db['UserProfileSection'][_0xcee9('0x44')]({'where':{'userProfileId':_0xc1b414[_0xcee9('0x48')]['id'],'sectionId':_[_0xcee9('0x2d')](_0x4e26dd,function(_0x5944bd){return _0x5944bd[_0xcee9('0x58')];})},'attributes':['id',_0xcee9('0x58')],'raw':!![]})[_0xcee9('0x26')](function(_0x49e467){var _0x593847=_['map'](_0xc1b414[_0xcee9('0x51')],function(_0x34bf31){_0x34bf31['userProfileId']=_0xc1b414[_0xcee9('0x48')]['id'];return _0x34bf31;});return db[_0xcee9('0x57')][_0xcee9('0x69')](_0x593847,{'raw':!![],'transaction':_0x3dd5eb});});}})[_0xcee9('0x46')](handleError(_0x139eeb,null));});}})[_0xcee9('0x26')](function(_0x57d22b){var _0x30ef29=_[_0xcee9('0x2d')](_0x57d22b,function(_0x39d25c){return _0x39d25c[_0xcee9('0x54')]({'plain':!![]});});})['then'](respondWithResult(_0x139eeb,null))[_0xcee9('0x46')](handleError(_0x139eeb,null));};exports[_0xcee9('0x6a')]=function(_0x441eab,_0x4032f8,_0x281d01){return db[_0xcee9('0x2e')][_0xcee9('0x4b')]({'where':{'id':_0x441eab[_0xcee9('0x48')]['id']}})[_0xcee9('0x26')](handleEntityNotFound(_0x4032f8,null))['then'](function(_0x3e7ff1){if(_0x3e7ff1){return _0x3e7ff1[_0xcee9('0x6a')](_0x441eab['query']['ids']);}})[_0xcee9('0x26')](respondWithStatusCode(_0x4032f8,null))[_0xcee9('0x46')](handleError(_0x4032f8,null));};exports[_0xcee9('0x6b')]=function(_0x34fc2e,_0x5d5db5){var _0x3f0e18={};if(!_0x34fc2e[_0xcee9('0x32')][_0xcee9('0x6c')])throw new Error(_0xcee9('0x6d'));if(!_0x34fc2e['query'][_0xcee9('0x3a')](_0xcee9('0x3b'))){_0x3f0e18[_0xcee9('0x1f')]=qs[_0xcee9('0x1f')](_0x34fc2e[_0xcee9('0x32')][_0xcee9('0x1f')]);_0x3f0e18[_0xcee9('0x1d')]=qs[_0xcee9('0x1d')](_0x34fc2e[_0xcee9('0x32')]['offset']);}return db['UserProfile']['find']({'where':{'id':_0x34fc2e[_0xcee9('0x48')]['id']}})[_0xcee9('0x26')](function(_0x252057){if(!_0x252057)throw new Error(_0xcee9('0x6e')+_0x34fc2e[_0xcee9('0x48')]['id']);return db[_0xcee9('0x2e')][_0xcee9('0x6b')](_0x34fc2e);})[_0xcee9('0x26')](respondWithFilteredResult(_0x5d5db5,_0x3f0e18))[_0xcee9('0x46')](handleError(_0x5d5db5,null));}; \ No newline at end of file +var _0xb4f4=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','includeAll','catch','create','body','find','get','omit','createdAt','crudPermissions','updatedAt','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','update','describe','addSections','push','removeSections','ids','getSections','enabled','includes','subsections','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce'];(function(_0x179163,_0x516295){var _0x5a2cb2=function(_0x4f503d){while(--_0x4f503d){_0x179163['push'](_0x179163['shift']());}};_0x5a2cb2(++_0x516295);}(_0xb4f4,0xda));var _0x4b4f=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0xb4f4[_0x36ed3c];return _0x52a2e0;};'use strict';var emlformat=require(_0x4b4f('0x0'));var rimraf=require(_0x4b4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b4f('0x2'));var rp=require(_0x4b4f('0x3'));var moment=require(_0x4b4f('0x4'));var BPromise=require(_0x4b4f('0x5'));var Mustache=require('mustache');var util=require(_0x4b4f('0x6'));var path=require(_0x4b4f('0x7'));var sox=require(_0x4b4f('0x8'));var csv=require(_0x4b4f('0x9'));var ejs=require(_0x4b4f('0xa'));var fs=require('fs');var fs_extra=require(_0x4b4f('0xb'));var _=require(_0x4b4f('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4b4f('0xd'));var deskjs=require(_0x4b4f('0xe'));var toCsv=require(_0x4b4f('0x9'));var querystring=require(_0x4b4f('0xf'));var Papa=require(_0x4b4f('0x10'));var Redis=require('ioredis');var authService=require(_0x4b4f('0x11'));var qs=require(_0x4b4f('0x12'));var as=require(_0x4b4f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b4f('0x14'))(_0x4b4f('0x15'));var utils=require('../../config/utils');var config=require(_0x4b4f('0x16'));var licenseUtil=require(_0x4b4f('0x17'));var db=require(_0x4b4f('0x18'))['db'];config[_0x4b4f('0x19')]=_[_0x4b4f('0x1a')](config[_0x4b4f('0x19')],{'host':_0x4b4f('0x1b'),'port':0x18eb});var socket=require(_0x4b4f('0x1c'))(new Redis(config['redis']));require('./userProfile.socket')[_0x4b4f('0x1d')](socket);function respondWithStatusCode(_0x12f125,_0x568657){_0x568657=_0x568657||0xcc;return function(_0x1a2a7d){if(_0x1a2a7d){return _0x12f125[_0x4b4f('0x1e')](_0x568657);}return _0x12f125[_0x4b4f('0x1f')](_0x568657)['end']();};}function respondWithResult(_0x1c74d4,_0x46343e){_0x46343e=_0x46343e||0xc8;return function(_0x178a62){if(_0x178a62){return _0x1c74d4['status'](_0x46343e)[_0x4b4f('0x20')](_0x178a62);}};}function respondWithFilteredResult(_0x2a6f66,_0x32f747){return function(_0x3a0ae3){if(_0x3a0ae3){var _0x246cde=typeof _0x32f747[_0x4b4f('0x21')]===_0x4b4f('0x22')&&typeof _0x32f747[_0x4b4f('0x23')]===_0x4b4f('0x22');var _0x4be517=_0x3a0ae3[_0x4b4f('0x24')];var _0x17895c=_0x246cde?0x0:_0x32f747[_0x4b4f('0x21')];var _0x8a182=_0x246cde?_0x3a0ae3[_0x4b4f('0x24')]:_0x32f747[_0x4b4f('0x21')]+_0x32f747[_0x4b4f('0x23')];var _0x34b915;if(_0x8a182>=_0x4be517){_0x8a182=_0x4be517;_0x34b915=0xc8;}else{_0x34b915=0xce;}_0x2a6f66[_0x4b4f('0x1f')](_0x34b915);return _0x2a6f66[_0x4b4f('0x25')](_0x4b4f('0x26'),_0x17895c+'-'+_0x8a182+'/'+_0x4be517)['json'](_0x3a0ae3);}return null;};}function patchUpdates(_0x3b5fab){return function(_0x1e7ab3){try{jsonpatch[_0x4b4f('0x27')](_0x1e7ab3,_0x3b5fab,!![]);}catch(_0x51e07e){return BPromise[_0x4b4f('0x28')](_0x51e07e);}return _0x1e7ab3['save']();};}function saveUpdates(_0x2c6405,_0x5b422a){return function(_0x248112){if(_0x248112){return _0x248112['update'](_0x2c6405)[_0x4b4f('0x29')](function(_0x403b0e){return _0x403b0e;});}return null;};}function removeEntity(_0x556791,_0x291d6a){return function(_0x36501c){if(_0x36501c){return _0x36501c[_0x4b4f('0x2a')]()[_0x4b4f('0x29')](function(){_0x556791[_0x4b4f('0x1f')](0xcc)[_0x4b4f('0x2b')]();});}};}function handleEntityNotFound(_0x13376e,_0x84af04){return function(_0x5978c9){if(!_0x5978c9){_0x13376e['sendStatus'](0x194);}return _0x5978c9;};}function handleError(_0x2f2fbb,_0x323b9d){_0x323b9d=_0x323b9d||0x1f4;return function(_0x422e1a){logger[_0x4b4f('0x2c')](_0x422e1a[_0x4b4f('0x2d')]);if(_0x422e1a[_0x4b4f('0x2e')]){delete _0x422e1a[_0x4b4f('0x2e')];}_0x2f2fbb[_0x4b4f('0x1f')](_0x323b9d)[_0x4b4f('0x2f')](_0x422e1a);};}exports[_0x4b4f('0x30')]=function(_0x3b8e14,_0x4b404e){var _0x4c4dde={},_0x337bde={},_0x5d87a2={'count':0x0,'rows':[]};var _0x32fdc4=_[_0x4b4f('0x31')](db[_0x4b4f('0x32')][_0x4b4f('0x33')],function(_0x5a3e6d){return{'name':_0x5a3e6d[_0x4b4f('0x34')],'type':_0x5a3e6d[_0x4b4f('0x35')][_0x4b4f('0x36')]};});_0x337bde['model']=_[_0x4b4f('0x31')](_0x32fdc4,'name');_0x337bde[_0x4b4f('0x37')]=_['keys'](_0x3b8e14[_0x4b4f('0x37')]);_0x337bde[_0x4b4f('0x38')]=_[_0x4b4f('0x39')](_0x337bde['model'],_0x337bde[_0x4b4f('0x37')]);_0x4c4dde[_0x4b4f('0x3a')]=_[_0x4b4f('0x39')](_0x337bde[_0x4b4f('0x3b')],qs[_0x4b4f('0x3c')](_0x3b8e14[_0x4b4f('0x37')][_0x4b4f('0x3c')]));_0x4c4dde[_0x4b4f('0x3a')]=_0x4c4dde[_0x4b4f('0x3a')][_0x4b4f('0x3d')]?_0x4c4dde[_0x4b4f('0x3a')]:_0x337bde[_0x4b4f('0x3b')];if(!_0x3b8e14[_0x4b4f('0x37')][_0x4b4f('0x3e')]('nolimit')){_0x4c4dde[_0x4b4f('0x23')]=qs[_0x4b4f('0x23')](_0x3b8e14['query'][_0x4b4f('0x23')]);_0x4c4dde[_0x4b4f('0x21')]=qs['offset'](_0x3b8e14[_0x4b4f('0x37')][_0x4b4f('0x21')]);}_0x4c4dde[_0x4b4f('0x3f')]=qs[_0x4b4f('0x40')](_0x3b8e14[_0x4b4f('0x37')][_0x4b4f('0x40')]);_0x4c4dde[_0x4b4f('0x41')]=qs[_0x4b4f('0x38')](_['pick'](_0x3b8e14[_0x4b4f('0x37')],_0x337bde[_0x4b4f('0x38')]),_0x32fdc4);if(_0x3b8e14[_0x4b4f('0x37')][_0x4b4f('0x42')]){_0x4c4dde[_0x4b4f('0x41')]=_[_0x4b4f('0x43')](_0x4c4dde[_0x4b4f('0x41')],{'$or':_[_0x4b4f('0x31')](_0x32fdc4,function(_0x245bdd){if(_0x245bdd[_0x4b4f('0x35')]!==_0x4b4f('0x44')){var _0x26c815={};_0x26c815[_0x245bdd[_0x4b4f('0x2e')]]={'$like':'%'+_0x3b8e14[_0x4b4f('0x37')][_0x4b4f('0x42')]+'%'};return _0x26c815;}})});}_0x4c4dde=_[_0x4b4f('0x43')]({},_0x4c4dde,_0x3b8e14[_0x4b4f('0x45')]);var _0x2139fd={'where':_0x4c4dde[_0x4b4f('0x41')]};return db[_0x4b4f('0x32')][_0x4b4f('0x24')](_0x2139fd)[_0x4b4f('0x29')](function(_0x12ba8e){_0x5d87a2['count']=_0x12ba8e;if(_0x3b8e14[_0x4b4f('0x37')]['includeAll']){_0x4c4dde[_0x4b4f('0x46')]=[{'all':!![]}];}return db[_0x4b4f('0x32')][_0x4b4f('0x47')](_0x4c4dde);})[_0x4b4f('0x29')](function(_0xd0f0d5){_0x5d87a2[_0x4b4f('0x48')]=_0xd0f0d5;return _0x5d87a2;})[_0x4b4f('0x29')](respondWithFilteredResult(_0x4b404e,_0x4c4dde))['catch'](handleError(_0x4b404e,null));};exports[_0x4b4f('0x49')]=function(_0x362e8c,_0x5020e9){var _0x18dc59={'raw':![],'where':{'id':_0x362e8c[_0x4b4f('0x4a')]['id']}},_0x2f8574={};_0x2f8574['model']=_[_0x4b4f('0x4b')](db[_0x4b4f('0x32')]['rawAttributes']);_0x2f8574[_0x4b4f('0x37')]=_[_0x4b4f('0x4b')](_0x362e8c[_0x4b4f('0x37')]);_0x2f8574[_0x4b4f('0x38')]=_[_0x4b4f('0x39')](_0x2f8574['model'],_0x2f8574[_0x4b4f('0x37')]);_0x18dc59['attributes']=_[_0x4b4f('0x39')](_0x2f8574[_0x4b4f('0x3b')],qs['fields'](_0x362e8c[_0x4b4f('0x37')]['fields']));_0x18dc59['attributes']=_0x18dc59[_0x4b4f('0x3a')][_0x4b4f('0x3d')]?_0x18dc59[_0x4b4f('0x3a')]:_0x2f8574[_0x4b4f('0x3b')];if(_0x362e8c[_0x4b4f('0x37')][_0x4b4f('0x4c')]){_0x18dc59[_0x4b4f('0x46')]=[{'all':!![]}];}_0x18dc59=_[_0x4b4f('0x43')]({},_0x18dc59,_0x362e8c[_0x4b4f('0x45')]);return db[_0x4b4f('0x32')]['find'](_0x18dc59)[_0x4b4f('0x29')](handleEntityNotFound(_0x5020e9,null))[_0x4b4f('0x29')](respondWithResult(_0x5020e9,null))[_0x4b4f('0x4d')](handleError(_0x5020e9,null));};exports[_0x4b4f('0x4e')]=function(_0xe6decf,_0x4cf80f){return db[_0x4b4f('0x32')][_0x4b4f('0x4e')](_0xe6decf[_0x4b4f('0x4f')],{})[_0x4b4f('0x29')](respondWithResult(_0x4cf80f,0xc9))[_0x4b4f('0x4d')](handleError(_0x4cf80f,null));};exports['clone']=function(_0x55ef1f,_0x85a835){var _0x3e21c1={'where':{'id':_0x55ef1f[_0x4b4f('0x4a')]['id']}},_0x21fee6={};_0x21fee6[_0x4b4f('0x3b')]=_['keys'](db[_0x4b4f('0x32')][_0x4b4f('0x33')]);_0x3e21c1[_0x4b4f('0x3a')]=_[_0x4b4f('0x39')](_0x21fee6['model'],qs[_0x4b4f('0x3c')](_0x55ef1f[_0x4b4f('0x37')][_0x4b4f('0x3c')]));_0x3e21c1[_0x4b4f('0x3a')]=_0x3e21c1[_0x4b4f('0x3a')]['length']?_0x3e21c1['attributes']:_0x21fee6[_0x4b4f('0x3b')];if(_0x55ef1f[_0x4b4f('0x37')][_0x4b4f('0x4c')]){_0x3e21c1[_0x4b4f('0x46')]=[{'all':!![]}];}_0x3e21c1=_[_0x4b4f('0x43')]({},_0x3e21c1,_0x55ef1f[_0x4b4f('0x45')]);return db[_0x4b4f('0x32')][_0x4b4f('0x50')](_0x3e21c1)['then'](handleEntityNotFound(_0x85a835,null))[_0x4b4f('0x29')](function(_0x5d004a){if(_0x5d004a){var _0x662fa1=_0x5d004a[_0x4b4f('0x51')]({'plain':!![]});_0x662fa1=qs[_0x4b4f('0x52')](_0x662fa1,['id',_0x4b4f('0x53'),'updatedAt',_0x4b4f('0x54')]);_0x55ef1f['body']=_[_0x4b4f('0x52')](_0x55ef1f[_0x4b4f('0x4f')],['id',_0x4b4f('0x53'),_0x4b4f('0x55')]);return db[_0x4b4f('0x56')][_0x4b4f('0x57')](function(_0x31b00e){return db[_0x4b4f('0x32')][_0x4b4f('0x4e')](_[_0x4b4f('0x43')](_0x662fa1,_0x55ef1f[_0x4b4f('0x4f')]),{'include':_0x55ef1f[_0x4b4f('0x37')][_0x4b4f('0x4c')]?[{'all':!![]}]:undefined,'transaction':_0x31b00e})[_0x4b4f('0x29')](function(_0x1cccbb){var _0x31c808=_0x1cccbb[_0x4b4f('0x51')]({'plain':!![]});return db[_0x4b4f('0x58')][_0x4b4f('0x47')]({'where':{'userProfileId':_0x55ef1f['params']['id']},'raw':!![]})['then'](function(_0x375ef4){if(_0x375ef4){return BPromise[_0x4b4f('0x59')](_0x375ef4,function(_0x5c95dd){return new BPromise(function(_0x10626f,_0x1b2e05){if(_0x5c95dd[_0x4b4f('0x5a')]===null||_0x5c95dd[_0x4b4f('0x5a')]===0x1)_0x10626f(null);return db[_0x4b4f('0x5b')][_0x4b4f('0x47')]({'where':{'sectionId':_0x5c95dd['id']},'raw':!![]})[_0x4b4f('0x29')](function(_0x38d691){var _0x315bc7=_[_0x4b4f('0x31')](_0x38d691,function(_0x2d46bc){return qs['omit'](_0x2d46bc,['id',_0x4b4f('0x53'),_0x4b4f('0x55'),_0x4b4f('0x5c')]);});_0x10626f(_0x315bc7);})[_0x4b4f('0x4d')](function(_0x4e1ef8){_0x1b2e05(_0x4e1ef8);});})[_0x4b4f('0x29')](function(_0x1437a8){var _0x5a4148=qs['omit'](_0x5c95dd,['id','createdAt',_0x4b4f('0x55')]);_0x5a4148[_0x4b4f('0x5d')]=_0x31c808['id'];if(_0x1437a8)_0x5a4148[_0x4b4f('0x5e')]=_0x1437a8;return _0x5a4148;})['then'](function(_0x2f8e18){return db['UserProfileSection'][_0x4b4f('0x4e')](_0x2f8e18,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x31b00e});});})['then'](function(){return _0x31c808;});}});});});}})[_0x4b4f('0x29')](respondWithResult(_0x85a835,0xc9))[_0x4b4f('0x4d')](handleError(_0x85a835,null));};exports[_0x4b4f('0x5f')]=function(_0xcc1cbc,_0x418d34){if(_0xcc1cbc['body']['id']){delete _0xcc1cbc[_0x4b4f('0x4f')]['id'];}return db[_0x4b4f('0x32')][_0x4b4f('0x50')]({'where':{'id':_0xcc1cbc[_0x4b4f('0x4a')]['id']}})[_0x4b4f('0x29')](handleEntityNotFound(_0x418d34,null))[_0x4b4f('0x29')](saveUpdates(_0xcc1cbc[_0x4b4f('0x4f')],null))[_0x4b4f('0x29')](respondWithResult(_0x418d34,null))[_0x4b4f('0x4d')](handleError(_0x418d34,null));};exports[_0x4b4f('0x2a')]=function(_0x16af49,_0x396383){return db[_0x4b4f('0x32')][_0x4b4f('0x50')]({'where':{'id':_0x16af49[_0x4b4f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x396383,null))[_0x4b4f('0x29')](removeEntity(_0x396383,null))[_0x4b4f('0x4d')](handleError(_0x396383,null));};exports[_0x4b4f('0x60')]=function(_0x1d2539,_0x10a118){return db[_0x4b4f('0x32')][_0x4b4f('0x60')]()[_0x4b4f('0x29')](respondWithResult(_0x10a118,null))[_0x4b4f('0x4d')](handleError(_0x10a118,null));};exports[_0x4b4f('0x61')]=function(_0x528124,_0x50abd1){var _0x4ea2c2=_0x528124[_0x4b4f('0x4f')];return db[_0x4b4f('0x32')][_0x4b4f('0x50')]({'where':{'id':_0x528124[_0x4b4f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x50abd1,null))[_0x4b4f('0x29')](function(_0xd073){if(_0xd073){return db['sequelize'][_0x4b4f('0x57')](function(_0x11b119){return db[_0x4b4f('0x58')][_0x4b4f('0x2a')]({'where':{'userProfileId':_0x528124[_0x4b4f('0x4a')]['id'],'sectionId':_[_0x4b4f('0x31')](_0x4ea2c2,function(_0x57b525){return _0x57b525[_0x4b4f('0x5c')];})},'transaction':_0x11b119})[_0x4b4f('0x29')](function(){var _0x2f67a2=_[_0x4b4f('0x31')](_0x4ea2c2,function(_0x4f2bd6){_0x4f2bd6[_0x4b4f('0x5d')]=_0x528124['params']['id'];return _0x4f2bd6;});var _0x4fc51c=[];return BPromise[_0x4b4f('0x59')](_0x2f67a2,function(_0x39ba8c){return db[_0x4b4f('0x58')][_0x4b4f('0x4e')](_0x39ba8c,{'include':[{'model':db['UserProfileResource'],'as':_0x4b4f('0x5e')}],'raw':!![],'transaction':_0x11b119})['then'](function(_0x1e713f){_0x4fc51c[_0x4b4f('0x62')](_0x1e713f[_0x4b4f('0x51')]({'plain':!![]}));});})[_0x4b4f('0x29')](function(){return _0x4fc51c;});});});}})[_0x4b4f('0x29')](function(_0x231f10){return _0x231f10;})['then'](respondWithResult(_0x50abd1,null))[_0x4b4f('0x4d')](handleError(_0x50abd1,null));};exports[_0x4b4f('0x63')]=function(_0x1bae71,_0x168f69){var _0x26b29b;return db['UserProfile'][_0x4b4f('0x50')]({'where':{'id':_0x1bae71[_0x4b4f('0x4a')]['id']},'attributes':['id',_0x4b4f('0x2e')]})[_0x4b4f('0x29')](handleEntityNotFound(_0x168f69,null))[_0x4b4f('0x29')](function(_0x766aca){if(_0x766aca){_0x26b29b=_0x766aca;return db['UserProfileSection'][_0x4b4f('0x2a')]({'where':{'userProfileId':_0x1bae71['params']['id'],'sectionId':_0x1bae71[_0x4b4f('0x37')][_0x4b4f('0x64')]}});}})[_0x4b4f('0x29')](function(){return _0x26b29b;})[_0x4b4f('0x29')](respondWithStatusCode(_0x168f69,null))['catch'](handleError(_0x168f69,null));};exports[_0x4b4f('0x65')]=function(_0x2ee548,_0x5eda71){var _0x198459=[];var _0x1290a0=[];return db[_0x4b4f('0x58')][_0x4b4f('0x47')]({'where':{'userProfileId':_0x2ee548['params']['id']},'raw':!![]})['then'](function(_0x2a87a5){_0x198459=_[_0x4b4f('0x42')](_0x2a87a5,function(_0x59d2c9){return _0x59d2c9[_0x4b4f('0x66')]===0x1||_[_0x4b4f('0x67')]([0x3eb,0x709],_0x59d2c9[_0x4b4f('0x5c')]);});if(!_['isEmpty'](_0x198459)){return _[_0x4b4f('0x31')](_0x198459,function(_0x1f1076){return _0x1f1076[_0x4b4f('0x5c')];});}else{return;}})['then'](function(_0x3f00d0){if(_0x3f00d0)_0x1290a0=_0x3f00d0;if(_['includes'](_0x1290a0,0x64)){var _0x12b733=_[_0x4b4f('0x50')](_0x198459,{'sectionId':0x64});return hasDefaultDashboard(_0x12b733)['then'](function(_0x323221){return _[_0x4b4f('0x31')](_0x198459,function(_0x379905){if(_0x379905[_0x4b4f('0x5c')]===0x64){_0x379905['subsections']=_0x323221;}return _0x379905;});});}else{return;}})[_0x4b4f('0x29')](function(_0x182287){if(_0x182287)_0x198459=_0x182287;if(_[_0x4b4f('0x67')](_0x1290a0,0x3eb)){var _0x231ce3=_['find'](_0x198459,{'sectionId':0x3eb});return getCustomDashboards(_0x231ce3)[_0x4b4f('0x29')](function(_0x215ee4){return _['map'](_0x198459,function(_0x1d5269){if(_0x231ce3['enabled']){if(_0x1d5269[_0x4b4f('0x5c')]===0x3eb){_0x1d5269['subsections']=_0x215ee4;}}else{if(_0x1d5269['sectionId']===0x64){_0x1d5269['subsections']=_0x215ee4;}}return _0x1d5269;});});}else{return;}})['then'](function(_0x406412){if(_0x406412)_0x198459=_0x406412;if(_[_0x4b4f('0x67')](_0x1290a0,0x709)){var _0x56d634=_[_0x4b4f('0x50')](_0x198459,{'sectionId':0x709});return getPlugins(_0x56d634)['then'](function(_0x578e31){if(_0x56d634['enabled']){return _[_0x4b4f('0x31')](_0x198459,function(_0x149c19){if(_0x149c19[_0x4b4f('0x5c')]===0x709){_0x149c19[_0x4b4f('0x68')]=_0x578e31;}return _0x149c19;});}else{var _0x281002={'sectionId':0x76c,'enabled':0x1,'subsections':_0x578e31};var _0x1bfed1=_['map'](_0x198459);_0x1bfed1[_0x4b4f('0x62')](_0x281002);return _0x1bfed1;}});}else{return;}})[_0x4b4f('0x29')](function(_0xc4c959){if(_0xc4c959)_0x198459=_0xc4c959;return _[_0x4b4f('0x42')](_0x198459,['enabled',0x1]);})[_0x4b4f('0x29')](respondWithResult(_0x5eda71,null))['catch'](handleError(_0x5eda71,null));};function hasDefaultDashboard(_0x3e0fe3){var _0x3bbe68=[0x65];return new BPromise(function(_0x3eaecd,_0x412f23){try{if(_0x3e0fe3['autoAssociation']){_0x3eaecd(_0x3bbe68);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x3e0fe3['id']},'raw':!![]})[_0x4b4f('0x29')](function(_0x274d45){_0x274d45?_0x3eaecd(_0x3bbe68):_0x3eaecd();});}}catch(_0x3f4ab8){_0x412f23(_0x3f4ab8);}});}function getCustomDashboards(_0x25758d){var _0x5624fa=[];return new BPromise(function(_0x948261,_0x2f76bb){try{if(_0x25758d[_0x4b4f('0x5a')]){return db[_0x4b4f('0x69')][_0x4b4f('0x47')]({'raw':!![]})['then'](function(_0x412f68){_0x412f68[_0x4b4f('0x6a')](function(_0x5e8977){_0x5624fa[_0x4b4f('0x62')](_0x5e8977['id']+0x1869f);});_0x948261(_0x5624fa);});}else{return db[_0x4b4f('0x5b')][_0x4b4f('0x47')]({'where':{'sectionId':_0x25758d['id']},'raw':!![]})[_0x4b4f('0x29')](function(_0x592d0){_0x592d0[_0x4b4f('0x6a')](function(_0x53119e){_0x5624fa[_0x4b4f('0x62')](_0x53119e[_0x4b4f('0x6b')]+0x1869f);});_0x948261(_0x5624fa);});}}catch(_0x1d1029){_0x2f76bb(_0x1d1029);}});}function getPlugins(_0x550d37){var _0x252a16=[];return new BPromise(function(_0x2ac6b4,_0x4c9cea){try{if(_0x550d37[_0x4b4f('0x5a')]){return db[_0x4b4f('0x6c')]['findAll']({'raw':!![]})['then'](function(_0x5c2764){_0x5c2764[_0x4b4f('0x6a')](function(_0x39f89a){_0x252a16['push'](_0x39f89a['id']+0x15b38);});_0x2ac6b4(_0x252a16);});}else{return db[_0x4b4f('0x5b')][_0x4b4f('0x47')]({'where':{'sectionId':_0x550d37['id']},'raw':!![]})['then'](function(_0x18e64b){_0x18e64b[_0x4b4f('0x6a')](function(_0x554f4d){_0x252a16[_0x4b4f('0x62')](_0x554f4d['resourceId']+0x15b38);});_0x2ac6b4(_0x252a16);});}}catch(_0x31828f){_0x4c9cea(_0x31828f);}});}exports[_0x4b4f('0x6d')]=function(_0x268c71,_0x12fa92){return db[_0x4b4f('0x32')][_0x4b4f('0x50')]({'where':{'id':_0x268c71[_0x4b4f('0x4a')]['id']}})[_0x4b4f('0x29')](handleEntityNotFound(_0x12fa92,null))['then'](function(_0x46456c){if(_0x46456c){return db['sequelize']['transaction'](function(_0x379cc8){return db[_0x4b4f('0x58')]['findAll']({'where':{'userProfileId':_0x268c71[_0x4b4f('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0x4b4f('0x29')](function(_0x5367fc){if(_0x5367fc){return db[_0x4b4f('0x58')][_0x4b4f('0x2a')]({'where':{'userProfileId':_0x268c71[_0x4b4f('0x4a')]['id'],'id':_[_0x4b4f('0x31')](_0x5367fc,function(_0x472f5d){return _0x472f5d['id'];})},'transaction':_0x379cc8});}})[_0x4b4f('0x29')](function(_0x5275af){var _0xff2e9e=_['map'](_0x268c71[_0x4b4f('0x4f')],function(_0x187a26){_0x187a26[_0x4b4f('0x5d')]=_0x268c71['params']['id'];return _0x187a26;});return db[_0x4b4f('0x58')]['bulkCreate'](_0xff2e9e,{'raw':!![],'transaction':_0x379cc8});})[_0x4b4f('0x29')](function(_0xcdb7c7){var _0xd1f55f=_[_0x4b4f('0x42')](_[_0x4b4f('0x31')](_0xcdb7c7,function(_0x3c7d86){return _0x3c7d86[_0x4b4f('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0xd1f55f){return db[_0x4b4f('0x58')]['findAll']({'where':{'userProfileId':_0x268c71['params']['id'],'sectionId':_[_0x4b4f('0x31')](_0xd1f55f,function(_0x518d83){return _0x518d83[_0x4b4f('0x5c')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x535958){var _0x31cb75=_[_0x4b4f('0x31')](_0x268c71[_0x4b4f('0x4f')],function(_0x4a348c){_0x4a348c['userProfileId']=_0x268c71[_0x4b4f('0x4a')]['id'];return _0x4a348c;});return db[_0x4b4f('0x5b')][_0x4b4f('0x6e')](_0x31cb75,{'raw':!![],'transaction':_0x379cc8});});}})['catch'](handleError(_0x12fa92,null));});}})['then'](function(_0x3f7f6a){var _0x5cdce6=_[_0x4b4f('0x31')](_0x3f7f6a,function(_0x56aa0c){return _0x56aa0c[_0x4b4f('0x51')]({'plain':!![]});});})[_0x4b4f('0x29')](respondWithResult(_0x12fa92,null))[_0x4b4f('0x4d')](handleError(_0x12fa92,null));};exports[_0x4b4f('0x6f')]=function(_0x2d5501,_0x554974,_0x4f44b7){return db[_0x4b4f('0x32')][_0x4b4f('0x50')]({'where':{'id':_0x2d5501[_0x4b4f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x554974,null))[_0x4b4f('0x29')](function(_0x5274d7){if(_0x5274d7){return _0x5274d7[_0x4b4f('0x6f')](_0x2d5501[_0x4b4f('0x37')][_0x4b4f('0x64')]);}})[_0x4b4f('0x29')](respondWithStatusCode(_0x554974,null))[_0x4b4f('0x4d')](handleError(_0x554974,null));};exports[_0x4b4f('0x70')]=function(_0x4a7f21,_0x5630f8){var _0x6bc2cf={};if(!_0x4a7f21[_0x4b4f('0x37')][_0x4b4f('0x71')])throw new Error(_0x4b4f('0x72'));if(!_0x4a7f21[_0x4b4f('0x37')][_0x4b4f('0x3e')](_0x4b4f('0x73'))){_0x6bc2cf[_0x4b4f('0x23')]=qs[_0x4b4f('0x23')](_0x4a7f21[_0x4b4f('0x37')][_0x4b4f('0x23')]);_0x6bc2cf['offset']=qs[_0x4b4f('0x21')](_0x4a7f21['query']['offset']);}return db[_0x4b4f('0x32')]['find']({'where':{'id':_0x4a7f21[_0x4b4f('0x4a')]['id']}})[_0x4b4f('0x29')](function(_0x64da75){if(!_0x64da75)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x4a7f21[_0x4b4f('0x4a')]['id']);return db[_0x4b4f('0x32')][_0x4b4f('0x70')](_0x4a7f21);})[_0x4b4f('0x29')](respondWithFilteredResult(_0x5630f8,_0x6bc2cf))[_0x4b4f('0x4d')](handleError(_0x5630f8,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 060c836..36746d4 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 _0x753c=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0xbf5d50,_0x107ec5){var _0x430d17=function(_0x31cbfc){while(--_0x31cbfc){_0xbf5d50['push'](_0xbf5d50['shift']());}};_0x430d17(++_0x107ec5);}(_0x753c,0x96));var _0xc753=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x753c[_0x126558];return _0x1f6d14;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xc753('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xc753('0x1')](0x0);var events={'afterCreate':_0xc753('0x2'),'afterUpdate':_0xc753('0x3'),'afterDestroy':_0xc753('0x4')};function emitEvent(_0x3f5dc4){return function(_0x44ff14,_0x3990bd,_0x4668e2){UserProfileEvents[_0xc753('0x5')](_0x3f5dc4+':'+_0x44ff14['id'],_0x44ff14);UserProfileEvents[_0xc753('0x5')](_0x3f5dc4,_0x44ff14);_0x4668e2(null);};}for(var e in events){if(events[_0xc753('0x6')](e)){var event=events[e];UserProfile[_0xc753('0x7')](e,emitEvent(event));}}module[_0xc753('0x8')]=UserProfileEvents; \ No newline at end of file +var _0xcb22=['hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x45fc6a,_0x166adb){var _0x14bcfd=function(_0x3ba718){while(--_0x3ba718){_0x45fc6a['push'](_0x45fc6a['shift']());}};_0x14bcfd(++_0x166adb);}(_0xcb22,0xc8));var _0x2cb2=function(_0x3ea906,_0x37d9c9){_0x3ea906=_0x3ea906-0x0;var _0x4e1825=_0xcb22[_0x3ea906];return _0x4e1825;};'use strict';var EventEmitter=require(_0x2cb2('0x0'));var UserProfile=require(_0x2cb2('0x1'))['db'][_0x2cb2('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x2cb2('0x3')](0x0);var events={'afterCreate':_0x2cb2('0x4'),'afterUpdate':_0x2cb2('0x5'),'afterDestroy':_0x2cb2('0x6')};function emitEvent(_0xe763ff){return function(_0x386f8b,_0x3b1af5,_0x3dec93){UserProfileEvents['emit'](_0xe763ff+':'+_0x386f8b['id'],_0x386f8b);UserProfileEvents[_0x2cb2('0x7')](_0xe763ff,_0x386f8b);_0x3dec93(null);};}for(var e in events){if(events[_0x2cb2('0x8')](e)){var event=events[e];UserProfile[_0x2cb2('0x9')](e,emitEvent(event));}}module[_0x2cb2('0xa')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 2317e3a..30b9f20 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 _0x0246=['find','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','merge','key','VIRTUAL','foreignKey','where','forEach','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','includeAll','CmContact','include','Tags','color','tag','ThroughTags','Agents','openTabs','sms','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','field','filter','findAll','map','catch','value','model','then','associatedResources','name','resolve','UserProfileResource','AnalyticExtractedReport','type','resourceId','toLowerCase','childModel','odbc','SquareOdbc','SquareRecording','parentSections','SquareProjects','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','membername','User','role','agent','Telephones','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','queuecampaigns','VoiceQueues','users','agents','Users','zendeskaccounts','ZendeskAccount','salesforceaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','tags','Tag','templates','Template','triggers','Trigger','trunks','variables','plugins','Reports','reportId','metrics','AnalyticMetric','charAt','slice','Sequelize','SELECT','select','ui.','ui.createdAt','from','user_has_','_interactions','sequelize','query','toString','OpenTabs','UserProfile','user_profiles','section','isEmpty','push','UserProfileSection','params','all','ignore','union','length'];(function(_0x671d3f,_0x3e1d78){var _0x598500=function(_0x5e1a97){while(--_0x5e1a97){_0x671d3f['push'](_0x671d3f['shift']());}};_0x598500(++_0x3e1d78);}(_0x0246,0x1b2));var _0x6024=function(_0x5d95a3,_0x125d09){_0x5d95a3=_0x5d95a3-0x0;var _0x37ed57=_0x0246[_0x5d95a3];return _0x37ed57;};'use strict';var _=require(_0x6024('0x0'));var attributes=require(_0x6024('0x1'));var qs=require(_0x6024('0x2'));var squel=require(_0x6024('0x3'));module[_0x6024('0x4')]=function(_0xbf335d){var _0x755dcd=_0xbf335d[_0x6024('0x5')];function _0x39904b(_0x3869a7,_0x20f82e){return new Promise(function(_0x189eb7,_0x579fbe){if(!_0x20f82e)return _0x189eb7(null);var _0x173511=_0x20f82e['filter']?{[_0x20f82e['filter'][_0x6024('0x6')]]:_0x20f82e[_0x6024('0x7')]['value']}:undefined;return _0x755dcd[_0x3869a7][_0x6024('0x8')]({'where':_0x173511,'raw':!![]})['then'](function(_0x1a4399){_0x20f82e['associatedResources']=_[_0x6024('0x9')](_0x1a4399,'id');_0x189eb7(_0x20f82e);})[_0x6024('0xa')](function(_0x25b022){_0x579fbe(_0x25b022);});});}function _0x4c5849(_0x371391,_0x38b487){return new Promise(function(_0x584c69,_0x55976c){var _0x7359eb=_0x371391[_0x6024('0x7')]?{[_0x371391['filter']['field']]:_0x371391[_0x6024('0x7')][_0x6024('0xb')]}:undefined;return _0x755dcd[_0x371391[_0x6024('0xc')]][_0x6024('0x8')]({'where':_0x7359eb,'raw':!![]})[_0x6024('0xd')](function(_0x3924e3){_0x38b487[_0x6024('0xe')]=_[_0x6024('0x9')](_0x3924e3,function(_0x465025){return _0x465025[_0x6024('0xf')];});_0x584c69(_0x38b487);})[_0x6024('0xa')](function(_0x2a9e05){_0x55976c(_0x2a9e05);});});}function _0xd8d20a(_0x1e08c5,_0x3bdc10,_0xde0a33){if(!_0x3bdc10)return Promise[_0x6024('0x10')](null);return new Promise(function(_0x47884d,_0x214d82){return _0x755dcd[_0x6024('0x11')][_0x6024('0x8')]({'where':{'sectionId':_0x3bdc10['id']},'raw':!![]})[_0x6024('0xd')](function(_0x4d227d){if(_0x1e08c5[_0x6024('0x6')]&&_0x1e08c5[_0x6024('0x6')]!=='id'){_0x3bdc10[_0x6024('0xe')]=_[_0x6024('0x9')](_0x4d227d,function(_0x35cf69){return _0x35cf69[_0x1e08c5[_0x6024('0x6')]];});}else{if(_0xde0a33===_0x6024('0x12')){_0x3bdc10['associatedResources']=_[_0x6024('0x9')](_0x4d227d,function(_0x14ddbb){return{'id':_0x14ddbb['resourceId'],'type':_0x14ddbb[_0x6024('0x13')]};});}else{_0x3bdc10[_0x6024('0xe')]=_[_0x6024('0x9')](_0x4d227d,function(_0x3c528a){return _0x3c528a[_0x6024('0x14')];});}}_0x47884d(_0x3bdc10);})[_0x6024('0xa')](function(_0x4df3e6){_0x214d82(_0x4df3e6);});});}function _0x15a476(_0x56a24d,_0x5751c9){var _0x11f486={'parentSections':[]};switch(_0x56a24d[_0x6024('0x15')]()){case'squareprojects':_0x11f486[_0x6024('0x16')]='SquareProject';break;case _0x6024('0x17'):_0x11f486[_0x6024('0x16')]=_0x6024('0x18');break;case'squarerecordings':_0x11f486[_0x6024('0x16')]=_0x6024('0x19');_0x11f486[_0x6024('0x1a')]=[{'name':_0x6024('0x1b'),'field':_0x6024('0xf'),'foreignKey':'projectName'}];break;case _0x6024('0x1c'):_0x11f486['childModel']=_0x6024('0x1d');break;case _0x6024('0x1e'):_0x11f486[_0x6024('0x16')]='CmContact';_0x11f486[_0x6024('0x1a')]=[{'name':_0x6024('0x1f'),'field':'id','foreignKey':_0x6024('0x20')}];break;case _0x6024('0x21'):_0x11f486['childModel']=_0x6024('0x22');break;case'companies':_0x11f486['childModel']=_0x6024('0x23');break;case'globalcustomfields':_0x11f486[_0x6024('0x16')]=_0x6024('0x24');break;case _0x6024('0x25'):_0x11f486[_0x6024('0x16')]=_0x6024('0x26');break;case _0x6024('0x27'):_0x11f486[_0x6024('0x16')]=_0x6024('0x28');break;case _0x6024('0x29'):_0x11f486['childModel']=_0x6024('0x2a');break;case _0x6024('0x2b'):_0x11f486['childModel']=_0x6024('0x2c');break;case _0x6024('0x2d'):case _0x6024('0x2e'):case _0x6024('0x2f'):_0x11f486['childModel']='VoiceExtension';break;case _0x6024('0x30'):_0x11f486[_0x6024('0x16')]=_0x6024('0x31');break;case _0x6024('0x32'):_0x11f486[_0x6024('0x16')]='VoiceMail';break;case _0x6024('0x33'):_0x11f486['childModel']=_0x6024('0x34');_0x11f486[_0x6024('0x1a')]=[{'name':'Agents','field':_0x6024('0xf'),'foreignKey':_0x6024('0x35'),'model':_0x6024('0x36'),'filter':{'field':_0x6024('0x37'),'value':[_0x6024('0x38')]}},{'name':_0x6024('0x39'),'field':'name','foreignKey':_0x6024('0x35'),'model':_0x6024('0x36'),'filter':{'field':_0x6024('0x37'),'value':['telephone']}},{'name':'VoiceQueues','field':_0x6024('0xf'),'foreignKey':_0x6024('0x3a'),'model':_0x6024('0x3b'),'filter':{'field':_0x6024('0x13'),'value':[_0x6024('0x3c')]}},{'name':_0x6024('0x3d'),'field':_0x6024('0xf'),'foreignKey':'queue','model':_0x6024('0x3b'),'filter':{'field':'type','value':[_0x6024('0x3e')]}}];break;case _0x6024('0x3f'):_0x11f486[_0x6024('0x16')]=_0x6024('0x40');break;case'chanspies':_0x11f486[_0x6024('0x16')]='VoiceChanSpy';break;case'voiceprefixes':_0x11f486['childModel']=_0x6024('0x41');break;case _0x6024('0x42'):_0x11f486[_0x6024('0x16')]=_0x6024('0x43');break;case _0x6024('0x44'):_0x11f486[_0x6024('0x16')]=_0x6024('0x45');break;case _0x6024('0x46'):_0x11f486['childModel']=_0x6024('0x47');break;case _0x6024('0x48'):_0x11f486[_0x6024('0x16')]=_0x6024('0x49');break;case _0x6024('0x4a'):_0x11f486[_0x6024('0x16')]=_0x6024('0x4b');break;case _0x6024('0x4c'):_0x11f486['childModel']='OpenchannelAccount';break;case _0x6024('0x4d'):_0x11f486[_0x6024('0x16')]=_0x6024('0x4e');break;case'smsaccounts':_0x11f486[_0x6024('0x16')]=_0x6024('0x4f');break;case'whatsappqueues':_0x11f486['childModel']=_0x6024('0x50');break;case _0x6024('0x51'):_0x11f486[_0x6024('0x16')]=_0x6024('0x52');break;case'teams':_0x11f486[_0x6024('0x16')]=_0x6024('0x53');break;case'voicequeues':case _0x6024('0x54'):_0x11f486[_0x6024('0x16')]=_0x6024('0x3b');if(_0x5751c9){_0x11f486[_0x6024('0x1a')]=[{'name':_0x6024('0x55')},{'name':_0x6024('0x3d')}];}break;case _0x6024('0x56'):case _0x6024('0x57'):case'telephones':_0x11f486[_0x6024('0x16')]='User';if(_0x5751c9){_0x11f486['parentSections']=[{'name':_0x6024('0x58'),'filter':{'field':_0x6024('0x37'),'value':['admin','user']},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0x6024('0x59'):_0x11f486[_0x6024('0x16')]=_0x6024('0x5a');break;case _0x6024('0x5b'):_0x11f486[_0x6024('0x16')]='SalesforceAccount';break;case'freshdeskaccounts':_0x11f486[_0x6024('0x16')]=_0x6024('0x5c');break;case _0x6024('0x5d'):_0x11f486['childModel']=_0x6024('0x5e');break;case _0x6024('0x5f'):_0x11f486[_0x6024('0x16')]=_0x6024('0x60');break;case _0x6024('0x61'):_0x11f486[_0x6024('0x16')]=_0x6024('0x62');break;case _0x6024('0x63'):_0x11f486[_0x6024('0x16')]=_0x6024('0x36');break;case _0x6024('0x64'):_0x11f486['childModel']=_0x6024('0x65');break;case _0x6024('0x66'):_0x11f486[_0x6024('0x16')]=_0x6024('0x67');break;case _0x6024('0x68'):_0x11f486[_0x6024('0x16')]=_0x6024('0x69');break;case _0x6024('0x6a'):_0x11f486[_0x6024('0x16')]=_0x6024('0x6b');break;case _0x6024('0x6c'):_0x11f486[_0x6024('0x16')]=_0x6024('0x6d');break;case _0x6024('0x6e'):_0x11f486[_0x6024('0x16')]=_0x6024('0x6f');break;case _0x6024('0x70'):_0x11f486['childModel']='Sound';break;case _0x6024('0x71'):_0x11f486['childModel']=_0x6024('0x72');break;case _0x6024('0x73'):_0x11f486['childModel']=_0x6024('0x74');break;case _0x6024('0x75'):_0x11f486[_0x6024('0x16')]=_0x6024('0x76');break;case _0x6024('0x77'):_0x11f486[_0x6024('0x16')]='Trunk';break;case _0x6024('0x78'):_0x11f486[_0x6024('0x16')]='Variable';break;case _0x6024('0x79'):_0x11f486[_0x6024('0x16')]='Plugin';break;case'extractedreports':_0x11f486['childModel']=_0x6024('0x12');_0x11f486[_0x6024('0x1a')]=[{'name':_0x6024('0x7a'),'field':'id','foreignKey':_0x6024('0x7b')}];break;case _0x6024('0x7c'):_0x11f486[_0x6024('0x16')]=_0x6024('0x7d');break;}return _0x11f486;}function _0x4a1621(_0x4ed52f,_0x2e2c54){var _0x1e9978=_0x4ed52f[_0x6024('0x7e')](0x0)['toUpperCase']()+_0x4ed52f[_0x6024('0x7f')](0x1);var _0x32915f={'type':_0x755dcd[_0x6024('0x80')]['QueryTypes'][_0x6024('0x81')],'raw':!![]};return new Promise(function(_0x143e55,_0x4687da){var _0x383d6c=squel[_0x6024('0x82')]()[_0x6024('0x6')](_0x6024('0x83')+_0x1e9978+'InteractionId','id')[_0x6024('0x6')](_0x6024('0x84'))[_0x6024('0x85')](_0x6024('0x86')+_0x4ed52f+_0x6024('0x87'),'ui')['where']('ui.UserId\x20=\x20?',_0x2e2c54['id']);return _0x755dcd[_0x6024('0x88')][_0x6024('0x89')](_0x383d6c[_0x6024('0x8a')](),_0x32915f)['then'](function(_0x5defca){_0x2e2c54[_0x1e9978+_0x6024('0x8b')]=_0x5defca;_0x143e55(_0x5defca);})['catch'](function(_0x1e87df){_0x4687da(_0x1e87df);});});}return _0xbf335d['define'](_0x6024('0x8c'),attributes,{'tableName':_0x6024('0x8d'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x17b80d){var _0x5947cc={'raw':_0x17b80d[_0x6024('0x89')]['raw'],'where':{}};var _0x88e99a={};var _0x2151aa={'count':0x0,'rows':[]};var _0x2ef380=_0x17b80d[_0x6024('0x89')][_0x6024('0x8e')];var _0x5763e6=_0x17b80d[_0x6024('0x89')]['mergeResources']||![];var _0x43ddad=_0x15a476(_0x2ef380,_0x5763e6);if(!_0x43ddad['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0x2ef380+'\x27');var _0x40e03d=[{'name':_0x2ef380}];if(!_[_0x6024('0x8f')](_0x43ddad[_0x6024('0x1a')]))_0x40e03d=_0x43ddad[_0x6024('0x1a')];var _0x37346f=[];for(var _0x5b8715=0x0;_0x5b8715<_0x40e03d['length'];_0x5b8715++){_0x37346f[_0x6024('0x90')](_0x755dcd[_0x6024('0x91')]['find']({'where':{'userProfileId':_0x17b80d[_0x6024('0x92')]['id'],'name':_0x40e03d[_0x5b8715][_0x6024('0xf')]},'raw':!![]}));}return Promise[_0x6024('0x93')](_0x37346f)[_0x6024('0xd')](function(_0x54a95b){var _0x139931=_[_0x6024('0x7')](_0x54a95b,function(_0x3f5fea){return _0x3f5fea?_0x3f5fea:undefined;});var _0x4cda97=_[_0x6024('0x7')](_0x40e03d,[_0x6024('0x94'),!![]]);var _0x7c7292=_[_0x6024('0x8f')](_0x139931)&&_[_0x6024('0x8f')](_0x4cda97)?null:_[_0x6024('0x95')](_0x4cda97,_0x139931);if(!_0x7c7292)return null;var _0x4279b4=[];for(var _0x4e80fb=0x0;_0x4e80fb<_0x7c7292[_0x6024('0x96')];_0x4e80fb++){var _0xf406ab=_[_0x6024('0x97')](_0x40e03d,function(_0x27e809){return _0x7c7292[_0x4e80fb]?_0x27e809[_0x6024('0xf')]===_0x7c7292[_0x4e80fb]['name']:null;});if(_0xf406ab){if(_0x7c7292[_0x4e80fb][_0x6024('0x94')]){_0x4279b4['push'](_0x39904b(_0x43ddad[_0x6024('0x16')],_0x7c7292[_0x4e80fb]));}else{if(!_0x7c7292[_0x4e80fb][_0x6024('0x98')]){_0x4279b4['push'](_0xd8d20a(_0xf406ab,_0x7c7292[_0x4e80fb],_0x43ddad[_0x6024('0x16')]));}else{if(_0xf406ab[_0x6024('0xc')]){_0x4279b4['push'](_0x4c5849(_0xf406ab,_0x7c7292[_0x4e80fb]));}}}}}return Promise[_0x6024('0x93')](_0x4279b4);})[_0x6024('0xd')](function(_0x52c810){var _0x249a27=_0x52c810;var _0x25518f=null;if(_0x249a27){_0x25518f=_0x249a27[_0x6024('0x96')]===0x1?_0x249a27[0x0]:null;}if(!_0x25518f&&!_0x249a27)return _0x2151aa;var _0x82d299=_0x755dcd[_0x43ddad[_0x6024('0x16')]][_0x6024('0x99')];_0x88e99a[_0x6024('0xc')]=_[_0x6024('0x9a')](_0x82d299);_0x88e99a[_0x6024('0x89')]=_[_0x6024('0x9a')](_0x17b80d['query']);_0x88e99a[_0x6024('0x9b')]=_[_0x6024('0x9c')](_0x88e99a[_0x6024('0xc')],_0x88e99a['query']);_0x5947cc[_0x6024('0x9d')]=_[_0x6024('0x9c')](_0x88e99a[_0x6024('0xc')],qs['fields'](_0x17b80d[_0x6024('0x89')][_0x6024('0x9e')]));_0x5947cc[_0x6024('0x9d')]=_0x5947cc[_0x6024('0x9d')][_0x6024('0x96')]?_0x5947cc[_0x6024('0x9d')]:_0x88e99a[_0x6024('0xc')];if(!_0x17b80d[_0x6024('0x89')][_0x6024('0x9f')]('nolimit')){_0x5947cc[_0x6024('0xa0')]=qs[_0x6024('0xa0')](_0x17b80d[_0x6024('0x89')][_0x6024('0xa0')]);_0x5947cc[_0x6024('0xa1')]=qs[_0x6024('0xa1')](_0x17b80d[_0x6024('0x89')][_0x6024('0xa1')]);}_0x5947cc[_0x6024('0xa2')]=qs[_0x6024('0xa3')](_0x17b80d[_0x6024('0x89')][_0x6024('0xa3')]);_0x5947cc['where']=qs[_0x6024('0x9b')](_['pick'](_0x17b80d['query'],_0x88e99a[_0x6024('0x9b')]));if(_0x17b80d[_0x6024('0x89')][_0x6024('0x7')]){_0x5947cc['where']=_[_0x6024('0xa4')](_0x5947cc['where'],{'$or':_[_0x6024('0x9')](_0x82d299,function(_0x5e0342){if(_0x5e0342[_0x6024('0x13')][_0x6024('0xa5')]!==_0x6024('0xa6')){var _0x6180d={};_0x6180d[_0x5e0342[_0x6024('0x6')]]={'$like':'%'+_0x17b80d[_0x6024('0x89')][_0x6024('0x7')]+'%'};return _0x6180d;}})});}var _0x13ed31=[];var _0x54ab01=null;var _0x498049={};if(_0x25518f){_0x54ab01=_['find'](_0x40e03d,[_0x6024('0xf'),_0x25518f['name']]);if(_0x54ab01['field']){_0x498049={};if(_0x43ddad[_0x6024('0x16')]===_0x6024('0x12')){_0x498049[_0x54ab01[_0x6024('0xa7')]]=_[_0x6024('0x9')](_0x25518f[_0x6024('0xe')],'id');}else{_0x498049[_0x54ab01[_0x6024('0xa7')]]=_0x25518f['associatedResources'];}_0x13ed31[_0x6024('0x90')](_0x498049);}else{_0x5947cc[_0x6024('0xa8')]['id']=_0x25518f[_0x6024('0xe')];}}else{for(var _0x7d14e3=0x0;_0x7d14e3<_0x249a27['length'];_0x7d14e3++){_0x54ab01=_[_0x6024('0x97')](_0x40e03d,[_0x6024('0xf'),_0x249a27[_0x7d14e3]['name']]);if(_0x54ab01[_0x6024('0x6')]){_0x498049={};_0x498049[_0x54ab01['foreignKey']]=_0x249a27[_0x7d14e3][_0x6024('0xe')];_0x13ed31[_0x6024('0x90')](_0x498049);}else{if(!_0x5947cc[_0x6024('0xa8')]['id'])_0x5947cc[_0x6024('0xa8')]['id']=[];_0x249a27[_0x7d14e3][_0x6024('0xe')][_0x6024('0xa9')](function(_0x8f8401){_0x5947cc['where']['id'][_0x6024('0x90')](_0x8f8401);});}}}if(!_['isEmpty'](_0x13ed31)){_0x5947cc['where']=_[_0x6024('0xa4')](_0x5947cc[_0x6024('0xa8')],{'$and':{'$or':_0x13ed31}});}_0x5947cc=_[_0x6024('0xa4')]({},_0x5947cc,_0x17b80d['options']);if(_0x25518f&&!_0x25518f['autoAssociation']&&_0x43ddad['childModel']===_0x6024('0x12')){if(_0x17b80d[_0x6024('0x89')]['includeAll']){_0x5947cc['include']=[{'all':!![]}];}return _0x755dcd[_0x43ddad['childModel']][_0x6024('0x8')](_0x5947cc)['then'](function(_0x535592){var _0x3041c8=[];_0x535592[_0x6024('0xa9')](function(_0x15c3f0){var _0x286dc6;switch(_0x15c3f0[_0x6024('0xaa')]){case _0x6024('0xab'):_0x286dc6=_[_0x6024('0x97')](_0x25518f[_0x6024('0xe')],function(_0x4f61d7){return _0x4f61d7['id']===_0x15c3f0[_0x6024('0x7b')]&&_0x4f61d7[_0x6024('0x13')]===_0x6024('0xac');});break;case _0x6024('0xad'):_0x286dc6=_[_0x6024('0x97')](_0x25518f[_0x6024('0xe')],function(_0x2f7651){return _0x2f7651['id']===_0x15c3f0[_0x6024('0x7b')]&&_0x2f7651[_0x6024('0x13')]===_0x6024('0xae');});break;}if(_0x286dc6)_0x3041c8['push'](_0x15c3f0);});_0x2151aa[_0x6024('0xaf')]=_0x3041c8[_0x6024('0x96')];_0x2151aa[_0x6024('0xb0')]=_0x3041c8;return _0x2151aa;});}else{if(!_[_0x6024('0x8f')](_0x17b80d[_0x6024('0x89')][_0x6024('0xb1')])){_0x5947cc['where']['id']=_0x5947cc['where']['id']?_[_0x6024('0x9c')](_0x5947cc[_0x6024('0xa8')]['id'],_0x17b80d[_0x6024('0x89')][_0x6024('0xb1')]):_0x17b80d[_0x6024('0x89')]['ids'];if(_0x17b80d[_0x6024('0x89')]['customSorting']){_0x5947cc[_0x6024('0xa2')]=_0x17b80d[_0x6024('0x89')][_0x6024('0xb2')];}}if(_0x17b80d[_0x6024('0x89')][_0x6024('0xb3')]){_0x5947cc[_0x6024('0xa8')]=_[_0x6024('0xa4')](_0x5947cc[_0x6024('0xa8')],{'$and':_0x17b80d[_0x6024('0x89')][_0x6024('0xb3')]});}return _0x755dcd[_0x43ddad[_0x6024('0x16')]][_0x6024('0xaf')]({'where':_0x5947cc[_0x6024('0xa8')]})['then'](function(_0x542b00){_0x2151aa['count']=_0x542b00;if(_0x17b80d[_0x6024('0x89')][_0x6024('0xb4')]){if(_0x43ddad[_0x6024('0x16')]===_0x6024('0xb5')){_0x5947cc[_0x6024('0xb6')]=[{'model':_0x755dcd['Tag'],'as':_0x6024('0xb7'),'attributes':['id',_0x6024('0xf'),_0x6024('0xb8')],'required':_0x17b80d['query'][_0x6024('0xb9')]?!![]:![]},{'model':_0x755dcd[_0x6024('0x72')],'as':_0x6024('0xba'),'attributes':['id',_0x6024('0xf'),_0x6024('0xb8')],'through':_0x17b80d['query'][_0x6024('0xb9')]?{'attributes':[],'where':{'TagId':_0x17b80d[_0x6024('0x89')][_0x6024('0xb9')]||undefined}}:{},'required':_0x17b80d['query'][_0x6024('0xb9')]?!![]:![]}];}else{_0x5947cc[_0x6024('0xb6')]=[{'all':!![]}];}}return _0x755dcd[_0x43ddad[_0x6024('0x16')]][_0x6024('0x8')](_0x5947cc);})['then'](function(_0x32354c){_0x2151aa['rows']=_0x32354c;if(_0x2ef380===_0x6024('0xbb')&&_0x17b80d[_0x6024('0x89')][_0x6024('0xbc')]==='true'){var _0x3acd6b=[];for(var _0x149756=0x0;_0x149756<_0x2151aa['rows']['length'];_0x149756++){_0x3acd6b['push'](_0x4a1621('chat',_0x2151aa[_0x6024('0xb0')][_0x149756]['dataValues']));_0x3acd6b[_0x6024('0x90')](_0x4a1621(_0x6024('0xbd'),_0x2151aa[_0x6024('0xb0')][_0x149756][_0x6024('0xbe')]));_0x3acd6b['push'](_0x4a1621(_0x6024('0xbf'),_0x2151aa[_0x6024('0xb0')][_0x149756]['dataValues']));_0x3acd6b['push'](_0x4a1621(_0x6024('0xc0'),_0x2151aa[_0x6024('0xb0')][_0x149756][_0x6024('0xbe')]));_0x3acd6b[_0x6024('0x90')](_0x4a1621(_0x6024('0xc1'),_0x2151aa[_0x6024('0xb0')][_0x149756]['dataValues']));_0x3acd6b['push'](_0x4a1621(_0x6024('0xc2'),_0x2151aa['rows'][_0x149756][_0x6024('0xbe')]));}return Promise[_0x6024('0x93')](_0x3acd6b)['then'](function(){return _0x2151aa;});}return _0x2151aa;});}});}}});}; \ No newline at end of file +var _0x7f09=['User','role','agent','queue','VoiceQueue','QueueCampaigns','type','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','teams','Team','voicequeues','queuecampaigns','VoiceQueues','users','agents','Users','admin','Telephones','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','zohoaccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','templates','Template','triggers','trunks','Trunk','variables','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','metrics','AnalyticMetric','charAt','slice','Sequelize','QueryTypes','select','ui.','user_has_','_interactions','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','Invalid\x20section\x20\x27','isEmpty','push','find','params','all','length','ignore','autoAssociation','rawAttributes','keys','attributes','intersection','fields','limit','offset','order','sort','where','filters','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','reportId','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tag','tag','ThroughTags','color','true','chat','dataValues','sms','fax','mail','whatsapp','../../components/parsers/qs','squel','exports','filter','field','value','findAll','associatedResources','map','model','then','name','catch','UserProfileResource','resourceId','toLowerCase','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','projectName','JscriptyProject','CmContact','Lists','lists','CmList','companies','CmCompany','globalcustomfields','chatqueues','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','VoiceRecording','Agents','membername'];(function(_0x349a33,_0xdeb5bd){var _0x1226fe=function(_0x585fcf){while(--_0x585fcf){_0x349a33['push'](_0x349a33['shift']());}};_0x1226fe(++_0xdeb5bd);}(_0x7f09,0x88));var _0x97f0=function(_0xd81120,_0x1fbf3a){_0xd81120=_0xd81120-0x0;var _0x915005=_0x7f09[_0xd81120];return _0x915005;};'use strict';var _=require('lodash');var attributes=require('./userProfile.attributes');var qs=require(_0x97f0('0x0'));var squel=require(_0x97f0('0x1'));module[_0x97f0('0x2')]=function(_0x2d8092){var _0x4a9f7e=_0x2d8092['models'];function _0x54234f(_0x3770f5,_0x30c4d0){return new Promise(function(_0x313a99,_0xdbc70){if(!_0x30c4d0)return _0x313a99(null);var _0x1c8bb1=_0x30c4d0[_0x97f0('0x3')]?{[_0x30c4d0[_0x97f0('0x3')][_0x97f0('0x4')]]:_0x30c4d0[_0x97f0('0x3')][_0x97f0('0x5')]}:undefined;return _0x4a9f7e[_0x3770f5][_0x97f0('0x6')]({'where':_0x1c8bb1,'raw':!![]})['then'](function(_0xd0db28){_0x30c4d0[_0x97f0('0x7')]=_[_0x97f0('0x8')](_0xd0db28,'id');_0x313a99(_0x30c4d0);})['catch'](function(_0x4652c9){_0xdbc70(_0x4652c9);});});}function _0xe16751(_0x543db4,_0x2d756d){return new Promise(function(_0x54a864,_0x5513c7){var _0x5b2176=_0x543db4[_0x97f0('0x3')]?{[_0x543db4[_0x97f0('0x3')][_0x97f0('0x4')]]:_0x543db4[_0x97f0('0x3')][_0x97f0('0x5')]}:undefined;return _0x4a9f7e[_0x543db4[_0x97f0('0x9')]][_0x97f0('0x6')]({'where':_0x5b2176,'raw':!![]})[_0x97f0('0xa')](function(_0x466f5e){_0x2d756d[_0x97f0('0x7')]=_[_0x97f0('0x8')](_0x466f5e,function(_0x4502e0){return _0x4502e0[_0x97f0('0xb')];});_0x54a864(_0x2d756d);})[_0x97f0('0xc')](function(_0x5b9587){_0x5513c7(_0x5b9587);});});}function _0x11f0c5(_0x407ce0,_0x240823,_0x5557b1){if(!_0x240823)return Promise['resolve'](null);return new Promise(function(_0x15aa10,_0x2d659d){return _0x4a9f7e[_0x97f0('0xd')]['findAll']({'where':{'sectionId':_0x240823['id']},'raw':!![]})[_0x97f0('0xa')](function(_0x261d76){if(_0x407ce0[_0x97f0('0x4')]&&_0x407ce0[_0x97f0('0x4')]!=='id'){_0x240823['associatedResources']=_[_0x97f0('0x8')](_0x261d76,function(_0x1c7d41){return _0x1c7d41[_0x407ce0[_0x97f0('0x4')]];});}else{if(_0x5557b1==='AnalyticExtractedReport'){_0x240823[_0x97f0('0x7')]=_['map'](_0x261d76,function(_0x1eee5a){return{'id':_0x1eee5a['resourceId'],'type':_0x1eee5a['type']};});}else{_0x240823[_0x97f0('0x7')]=_[_0x97f0('0x8')](_0x261d76,function(_0xdbc111){return _0xdbc111[_0x97f0('0xe')];});}}_0x15aa10(_0x240823);})['catch'](function(_0x466c40){_0x2d659d(_0x466c40);});});}function _0x40ac2d(_0x21e183,_0xea5c9f){var _0x322731={'parentSections':[]};switch(_0x21e183[_0x97f0('0xf')]()){case'squareprojects':_0x322731[_0x97f0('0x10')]=_0x97f0('0x11');break;case _0x97f0('0x12'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x13');break;case _0x97f0('0x14'):_0x322731['childModel']=_0x97f0('0x15');_0x322731[_0x97f0('0x16')]=[{'name':'SquareProjects','field':_0x97f0('0xb'),'foreignKey':_0x97f0('0x17')}];break;case'projects':_0x322731['childModel']=_0x97f0('0x18');break;case'contacts':_0x322731[_0x97f0('0x10')]=_0x97f0('0x19');_0x322731['parentSections']=[{'name':_0x97f0('0x1a'),'field':'id','foreignKey':'ListId'}];break;case _0x97f0('0x1b'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x1c');break;case _0x97f0('0x1d'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x1e');break;case _0x97f0('0x1f'):_0x322731[_0x97f0('0x10')]='CmCustomField';break;case _0x97f0('0x20'):_0x322731[_0x97f0('0x10')]='ChatQueue';break;case'chatwebsites':_0x322731[_0x97f0('0x10')]=_0x97f0('0x21');break;case _0x97f0('0x22'):_0x322731['childModel']=_0x97f0('0x23');break;case _0x97f0('0x24'):_0x322731['childModel']=_0x97f0('0x25');break;case'inboundroutes':case _0x97f0('0x26'):case _0x97f0('0x27'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x28');break;case _0x97f0('0x29'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x2a');break;case'voicemails':_0x322731[_0x97f0('0x10')]=_0x97f0('0x2b');break;case'voicerecordings':_0x322731[_0x97f0('0x10')]=_0x97f0('0x2c');_0x322731[_0x97f0('0x16')]=[{'name':_0x97f0('0x2d'),'field':_0x97f0('0xb'),'foreignKey':_0x97f0('0x2e'),'model':_0x97f0('0x2f'),'filter':{'field':_0x97f0('0x30'),'value':[_0x97f0('0x31')]}},{'name':'Telephones','field':'name','foreignKey':_0x97f0('0x2e'),'model':_0x97f0('0x2f'),'filter':{'field':'role','value':['telephone']}},{'name':'VoiceQueues','field':_0x97f0('0xb'),'foreignKey':_0x97f0('0x32'),'model':_0x97f0('0x33'),'filter':{'field':'type','value':['inbound']}},{'name':_0x97f0('0x34'),'field':_0x97f0('0xb'),'foreignKey':'queue','model':_0x97f0('0x33'),'filter':{'field':_0x97f0('0x35'),'value':['outbound']}}];break;case _0x97f0('0x36'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x37');break;case _0x97f0('0x38'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x39');break;case _0x97f0('0x3a'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x3b');break;case _0x97f0('0x3c'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x3d');break;case'mailqueues':_0x322731[_0x97f0('0x10')]='MailQueue';break;case _0x97f0('0x3e'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x3f');break;case _0x97f0('0x40'):_0x322731['childModel']=_0x97f0('0x41');break;case _0x97f0('0x42'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x43');break;case _0x97f0('0x44'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x45');break;case _0x97f0('0x46'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x47');break;case _0x97f0('0x48'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x49');break;case'whatsappqueues':_0x322731[_0x97f0('0x10')]='WhatsappQueue';break;case'whatsappaccounts':_0x322731['childModel']='WhatsappAccount';break;case _0x97f0('0x4a'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x4b');break;case _0x97f0('0x4c'):case _0x97f0('0x4d'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x33');if(_0xea5c9f){_0x322731['parentSections']=[{'name':_0x97f0('0x4e')},{'name':_0x97f0('0x34')}];}break;case _0x97f0('0x4f'):case _0x97f0('0x50'):case'telephones':_0x322731['childModel']='User';if(_0xea5c9f){_0x322731[_0x97f0('0x16')]=[{'name':_0x97f0('0x51'),'filter':{'field':'role','value':[_0x97f0('0x52'),'user']},'ignore':!![]},{'name':_0x97f0('0x2d')},{'name':_0x97f0('0x53')}];}break;case _0x97f0('0x54'):_0x322731[_0x97f0('0x10')]='ZendeskAccount';break;case _0x97f0('0x55'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x56');break;case _0x97f0('0x57'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x58');break;case _0x97f0('0x59'):_0x322731['childModel']='SugarcrmAccount';break;case'deskaccounts':_0x322731[_0x97f0('0x10')]='DeskAccount';break;case _0x97f0('0x5a'):_0x322731['childModel']='ZohoAccount';break;case'vtigeraccounts':_0x322731[_0x97f0('0x10')]=_0x97f0('0x2f');break;case _0x97f0('0x5b'):_0x322731['childModel']=_0x97f0('0x5c');break;case _0x97f0('0x5d'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x5e');break;case _0x97f0('0x5f'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x60');break;case _0x97f0('0x61'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x62');break;case _0x97f0('0x63'):_0x322731['childModel']=_0x97f0('0x64');break;case _0x97f0('0x65'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x66');break;case _0x97f0('0x67'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x68');break;case _0x97f0('0x69'):_0x322731[_0x97f0('0x10')]='Tag';break;case _0x97f0('0x6a'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x6b');break;case _0x97f0('0x6c'):_0x322731['childModel']='Trigger';break;case _0x97f0('0x6d'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x6e');break;case _0x97f0('0x6f'):_0x322731['childModel']='Variable';break;case _0x97f0('0x70'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x71');break;case _0x97f0('0x72'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x73');_0x322731[_0x97f0('0x16')]=[{'name':_0x97f0('0x74'),'field':'id','foreignKey':'reportId'}];break;case _0x97f0('0x75'):_0x322731[_0x97f0('0x10')]=_0x97f0('0x76');break;}return _0x322731;}function _0x1f89e7(_0x1d8193,_0xce2937){var _0x869748=_0x1d8193[_0x97f0('0x77')](0x0)['toUpperCase']()+_0x1d8193[_0x97f0('0x78')](0x1);var _0x587f9e={'type':_0x4a9f7e[_0x97f0('0x79')][_0x97f0('0x7a')]['SELECT'],'raw':!![]};return new Promise(function(_0x51a946,_0x30d89a){var _0x3e19c2=squel[_0x97f0('0x7b')]()['field'](_0x97f0('0x7c')+_0x869748+'InteractionId','id')[_0x97f0('0x4')]('ui.createdAt')['from'](_0x97f0('0x7d')+_0x1d8193+_0x97f0('0x7e'),'ui')['where'](_0x97f0('0x7f'),_0xce2937['id']);return _0x4a9f7e['sequelize'][_0x97f0('0x80')](_0x3e19c2[_0x97f0('0x81')](),_0x587f9e)[_0x97f0('0xa')](function(_0x48a989){_0xce2937[_0x869748+_0x97f0('0x82')]=_0x48a989;_0x51a946(_0x48a989);})[_0x97f0('0xc')](function(_0x58765d){_0x30d89a(_0x58765d);});});}return _0x2d8092[_0x97f0('0x83')](_0x97f0('0x84'),attributes,{'tableName':_0x97f0('0x85'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3ac6f7){var _0x3707e4={'raw':_0x3ac6f7[_0x97f0('0x80')][_0x97f0('0x86')],'where':{}};var _0xd66aec={};var _0x283c83={'count':0x0,'rows':[]};var _0x38dd0c=_0x3ac6f7['query'][_0x97f0('0x87')];var _0x31842a=_0x3ac6f7[_0x97f0('0x80')]['mergeResources']||![];var _0x54247b=_0x40ac2d(_0x38dd0c,_0x31842a);if(!_0x54247b[_0x97f0('0x10')])throw new Error(_0x97f0('0x88')+_0x38dd0c+'\x27');var _0x5b71d3=[{'name':_0x38dd0c}];if(!_[_0x97f0('0x89')](_0x54247b[_0x97f0('0x16')]))_0x5b71d3=_0x54247b[_0x97f0('0x16')];var _0x586a8a=[];for(var _0x5ddaed=0x0;_0x5ddaed<_0x5b71d3['length'];_0x5ddaed++){_0x586a8a[_0x97f0('0x8a')](_0x4a9f7e['UserProfileSection'][_0x97f0('0x8b')]({'where':{'userProfileId':_0x3ac6f7[_0x97f0('0x8c')]['id'],'name':_0x5b71d3[_0x5ddaed][_0x97f0('0xb')]},'raw':!![]}));}return Promise[_0x97f0('0x8d')](_0x586a8a)[_0x97f0('0xa')](function(_0x3403df){var _0x14714c=_[_0x97f0('0x3')](_0x3403df,function(_0x34d58a){return _0x34d58a?_0x34d58a:undefined;});var _0x46f2c7=_['filter'](_0x5b71d3,['ignore',!![]]);var _0x19ec98=_[_0x97f0('0x89')](_0x14714c)&&_['isEmpty'](_0x46f2c7)?null:_['union'](_0x46f2c7,_0x14714c);if(!_0x19ec98)return null;var _0x139715=[];for(var _0x30afd5=0x0;_0x30afd5<_0x19ec98[_0x97f0('0x8e')];_0x30afd5++){var _0x4d344a=_[_0x97f0('0x8b')](_0x5b71d3,function(_0x4e68f1){return _0x19ec98[_0x30afd5]?_0x4e68f1[_0x97f0('0xb')]===_0x19ec98[_0x30afd5][_0x97f0('0xb')]:null;});if(_0x4d344a){if(_0x19ec98[_0x30afd5][_0x97f0('0x8f')]){_0x139715[_0x97f0('0x8a')](_0x54234f(_0x54247b[_0x97f0('0x10')],_0x19ec98[_0x30afd5]));}else{if(!_0x19ec98[_0x30afd5][_0x97f0('0x90')]){_0x139715[_0x97f0('0x8a')](_0x11f0c5(_0x4d344a,_0x19ec98[_0x30afd5],_0x54247b['childModel']));}else{if(_0x4d344a[_0x97f0('0x9')]){_0x139715[_0x97f0('0x8a')](_0xe16751(_0x4d344a,_0x19ec98[_0x30afd5]));}}}}}return Promise[_0x97f0('0x8d')](_0x139715);})[_0x97f0('0xa')](function(_0x111a47){var _0x2e6975=_0x111a47;var _0x2beb26=null;if(_0x2e6975){_0x2beb26=_0x2e6975[_0x97f0('0x8e')]===0x1?_0x2e6975[0x0]:null;}if(!_0x2beb26&&!_0x2e6975)return _0x283c83;var _0x11274d=_0x4a9f7e[_0x54247b[_0x97f0('0x10')]][_0x97f0('0x91')];_0xd66aec['model']=_[_0x97f0('0x92')](_0x11274d);_0xd66aec[_0x97f0('0x80')]=_[_0x97f0('0x92')](_0x3ac6f7[_0x97f0('0x80')]);_0xd66aec['filters']=_['intersection'](_0xd66aec['model'],_0xd66aec[_0x97f0('0x80')]);_0x3707e4[_0x97f0('0x93')]=_[_0x97f0('0x94')](_0xd66aec[_0x97f0('0x9')],qs[_0x97f0('0x95')](_0x3ac6f7[_0x97f0('0x80')][_0x97f0('0x95')]));_0x3707e4['attributes']=_0x3707e4[_0x97f0('0x93')][_0x97f0('0x8e')]?_0x3707e4['attributes']:_0xd66aec['model'];if(!_0x3ac6f7[_0x97f0('0x80')]['hasOwnProperty']('nolimit')){_0x3707e4[_0x97f0('0x96')]=qs[_0x97f0('0x96')](_0x3ac6f7[_0x97f0('0x80')]['limit']);_0x3707e4['offset']=qs[_0x97f0('0x97')](_0x3ac6f7[_0x97f0('0x80')]['offset']);}_0x3707e4[_0x97f0('0x98')]=qs[_0x97f0('0x99')](_0x3ac6f7[_0x97f0('0x80')]['sort']);_0x3707e4[_0x97f0('0x9a')]=qs[_0x97f0('0x9b')](_[_0x97f0('0x9c')](_0x3ac6f7[_0x97f0('0x80')],_0xd66aec[_0x97f0('0x9b')]));if(_0x3ac6f7[_0x97f0('0x80')]['filter']){_0x3707e4[_0x97f0('0x9a')]=_[_0x97f0('0x9d')](_0x3707e4[_0x97f0('0x9a')],{'$or':_[_0x97f0('0x8')](_0x11274d,function(_0x45fab7){if(_0x45fab7[_0x97f0('0x35')][_0x97f0('0x9e')]!==_0x97f0('0x9f')){var _0x29191b={};_0x29191b[_0x45fab7[_0x97f0('0x4')]]={'$like':'%'+_0x3ac6f7[_0x97f0('0x80')][_0x97f0('0x3')]+'%'};return _0x29191b;}})});}var _0x4b75fb=[];var _0x37067c=null;var _0x2fd3da={};if(_0x2beb26){_0x37067c=_[_0x97f0('0x8b')](_0x5b71d3,[_0x97f0('0xb'),_0x2beb26[_0x97f0('0xb')]]);if(_0x37067c[_0x97f0('0x4')]){_0x2fd3da={};if(_0x54247b[_0x97f0('0x10')]===_0x97f0('0x73')){_0x2fd3da[_0x37067c[_0x97f0('0xa0')]]=_[_0x97f0('0x8')](_0x2beb26[_0x97f0('0x7')],'id');}else{_0x2fd3da[_0x37067c['foreignKey']]=_0x2beb26[_0x97f0('0x7')];}_0x4b75fb[_0x97f0('0x8a')](_0x2fd3da);}else{_0x3707e4[_0x97f0('0x9a')]['id']=_0x2beb26[_0x97f0('0x7')];}}else{for(var _0x6f394b=0x0;_0x6f394b<_0x2e6975[_0x97f0('0x8e')];_0x6f394b++){_0x37067c=_['find'](_0x5b71d3,[_0x97f0('0xb'),_0x2e6975[_0x6f394b][_0x97f0('0xb')]]);if(_0x37067c[_0x97f0('0x4')]){_0x2fd3da={};_0x2fd3da[_0x37067c['foreignKey']]=_0x2e6975[_0x6f394b][_0x97f0('0x7')];_0x4b75fb['push'](_0x2fd3da);}else{if(!_0x3707e4[_0x97f0('0x9a')]['id'])_0x3707e4[_0x97f0('0x9a')]['id']=[];_0x2e6975[_0x6f394b]['associatedResources'][_0x97f0('0xa1')](function(_0x547207){_0x3707e4['where']['id'][_0x97f0('0x8a')](_0x547207);});}}}if(!_[_0x97f0('0x89')](_0x4b75fb)){_0x3707e4['where']=_['merge'](_0x3707e4[_0x97f0('0x9a')],{'$and':{'$or':_0x4b75fb}});}_0x3707e4=_['merge']({},_0x3707e4,_0x3ac6f7[_0x97f0('0xa2')]);if(_0x2beb26&&!_0x2beb26['autoAssociation']&&_0x54247b[_0x97f0('0x10')]===_0x97f0('0x73')){if(_0x3ac6f7[_0x97f0('0x80')][_0x97f0('0xa3')]){_0x3707e4['include']=[{'all':!![]}];}return _0x4a9f7e[_0x54247b[_0x97f0('0x10')]][_0x97f0('0x6')](_0x3707e4)['then'](function(_0x230c69){var _0x1feef3=[];_0x230c69[_0x97f0('0xa1')](function(_0x47f4e5){var _0x1f213b;switch(_0x47f4e5['reportType']){case'default':_0x1f213b=_['find'](_0x2beb26['associatedResources'],function(_0x4522c2){return _0x4522c2['id']===_0x47f4e5[_0x97f0('0xa4')]&&_0x4522c2[_0x97f0('0x35')]==='DefaultReports';});break;case _0x97f0('0xa5'):_0x1f213b=_[_0x97f0('0x8b')](_0x2beb26[_0x97f0('0x7')],function(_0x9a3b3d){return _0x9a3b3d['id']===_0x47f4e5[_0x97f0('0xa4')]&&_0x9a3b3d[_0x97f0('0x35')]===_0x97f0('0xa6');});break;}if(_0x1f213b)_0x1feef3[_0x97f0('0x8a')](_0x47f4e5);});_0x283c83[_0x97f0('0xa7')]=_0x1feef3[_0x97f0('0x8e')];_0x283c83[_0x97f0('0xa8')]=_0x1feef3;return _0x283c83;});}else{if(!_[_0x97f0('0x89')](_0x3ac6f7[_0x97f0('0x80')][_0x97f0('0xa9')])){_0x3707e4[_0x97f0('0x9a')]['id']=_0x3707e4[_0x97f0('0x9a')]['id']?_['intersection'](_0x3707e4[_0x97f0('0x9a')]['id'],_0x3ac6f7[_0x97f0('0x80')][_0x97f0('0xa9')]):_0x3ac6f7[_0x97f0('0x80')][_0x97f0('0xa9')];if(_0x3ac6f7['query'][_0x97f0('0xaa')]){_0x3707e4[_0x97f0('0x98')]=_0x3ac6f7[_0x97f0('0x80')][_0x97f0('0xaa')];}}if(_0x3ac6f7['query'][_0x97f0('0xab')]){_0x3707e4[_0x97f0('0x9a')]=_[_0x97f0('0x9d')](_0x3707e4[_0x97f0('0x9a')],{'$and':_0x3ac6f7[_0x97f0('0x80')][_0x97f0('0xab')]});}return _0x4a9f7e[_0x54247b[_0x97f0('0x10')]][_0x97f0('0xa7')]({'where':_0x3707e4['where']})[_0x97f0('0xa')](function(_0x4d5b85){_0x283c83['count']=_0x4d5b85;if(_0x3ac6f7[_0x97f0('0x80')][_0x97f0('0xa3')]){if(_0x54247b[_0x97f0('0x10')]===_0x97f0('0x19')){_0x3707e4['include']=[{'model':_0x4a9f7e[_0x97f0('0xac')],'as':'Tags','attributes':['id',_0x97f0('0xb'),'color'],'required':_0x3ac6f7[_0x97f0('0x80')][_0x97f0('0xad')]?!![]:![]},{'model':_0x4a9f7e[_0x97f0('0xac')],'as':_0x97f0('0xae'),'attributes':['id','name',_0x97f0('0xaf')],'through':_0x3ac6f7[_0x97f0('0x80')][_0x97f0('0xad')]?{'attributes':[],'where':{'TagId':_0x3ac6f7[_0x97f0('0x80')][_0x97f0('0xad')]||undefined}}:{},'required':_0x3ac6f7['query'][_0x97f0('0xad')]?!![]:![]}];}else{_0x3707e4['include']=[{'all':!![]}];}}return _0x4a9f7e[_0x54247b[_0x97f0('0x10')]]['findAll'](_0x3707e4);})[_0x97f0('0xa')](function(_0x5b45c2){_0x283c83[_0x97f0('0xa8')]=_0x5b45c2;if(_0x38dd0c===_0x97f0('0x2d')&&_0x3ac6f7['query']['openTabs']===_0x97f0('0xb0')){var _0x305afb=[];for(var _0x1e6c8a=0x0;_0x1e6c8a<_0x283c83[_0x97f0('0xa8')][_0x97f0('0x8e')];_0x1e6c8a++){_0x305afb[_0x97f0('0x8a')](_0x1f89e7(_0x97f0('0xb1'),_0x283c83[_0x97f0('0xa8')][_0x1e6c8a][_0x97f0('0xb2')]));_0x305afb[_0x97f0('0x8a')](_0x1f89e7(_0x97f0('0xb3'),_0x283c83[_0x97f0('0xa8')][_0x1e6c8a]['dataValues']));_0x305afb[_0x97f0('0x8a')](_0x1f89e7(_0x97f0('0xb4'),_0x283c83[_0x97f0('0xa8')][_0x1e6c8a][_0x97f0('0xb2')]));_0x305afb[_0x97f0('0x8a')](_0x1f89e7(_0x97f0('0xb5'),_0x283c83[_0x97f0('0xa8')][_0x1e6c8a][_0x97f0('0xb2')]));_0x305afb[_0x97f0('0x8a')](_0x1f89e7('openchannel',_0x283c83[_0x97f0('0xa8')][_0x1e6c8a][_0x97f0('0xb2')]));_0x305afb[_0x97f0('0x8a')](_0x1f89e7(_0x97f0('0xb6'),_0x283c83[_0x97f0('0xa8')][_0x1e6c8a][_0x97f0('0xb2')]));}return Promise['all'](_0x305afb)['then'](function(){return _0x283c83;});}return _0x283c83;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index b9ef2e9..c7158a3 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 _0x02b6=['error','code','message','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','then','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0x02b6,0xfe));var _0x602b=function(_0x1df83f,_0x345b08){_0x1df83f=_0x1df83f-0x0;var _0x4c6578=_0x02b6[_0x1df83f];return _0x4c6578;};'use strict';var _=require(_0x602b('0x0'));var util=require('util');var moment=require(_0x602b('0x1'));var BPromise=require(_0x602b('0x2'));var rs=require(_0x602b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x602b('0x4'));var logger=require(_0x602b('0x5'))(_0x602b('0x6'));var config=require(_0x602b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x602b('0x8')]['http']({'port':0x232a});config[_0x602b('0x9')]=_[_0x602b('0xa')](config[_0x602b('0x9')],{'host':_0x602b('0xb'),'port':0x18eb});var socket=require(_0x602b('0xc'))(new Redis(config[_0x602b('0x9')]));require(_0x602b('0xd'))[_0x602b('0xe')](socket);function respondWithRpcPromise(_0x20c7cf,_0x1687ca,_0x4fb0a2){return new BPromise(function(_0x470cf0,_0x5ca85d){return client['request'](_0x20c7cf,_0x4fb0a2)[_0x602b('0xf')](function(_0x568461){logger[_0x602b('0x10')](_0x602b('0x11'),_0x1687ca,'request\x20sent');logger[_0x602b('0x12')](_0x602b('0x13'),_0x1687ca,_0x602b('0x14'),JSON['stringify'](_0x568461));if(_0x568461[_0x602b('0x15')]){if(_0x568461[_0x602b('0x15')][_0x602b('0x16')]===0x1f4){logger[_0x602b('0x15')](_0x602b('0x11'),_0x1687ca,_0x568461[_0x602b('0x15')][_0x602b('0x17')]);return _0x5ca85d(_0x568461['error']['message']);}logger[_0x602b('0x15')](_0x602b('0x11'),_0x1687ca,_0x568461[_0x602b('0x15')][_0x602b('0x17')]);return _0x470cf0(_0x568461[_0x602b('0x15')][_0x602b('0x17')]);}else{logger[_0x602b('0x10')](_0x602b('0x11'),_0x1687ca,_0x602b('0x14'));_0x470cf0(_0x568461['result'][_0x602b('0x17')]);}})[_0x602b('0x18')](function(_0x3ddabd){logger['error'](_0x602b('0x11'),_0x1687ca,_0x3ddabd);_0x5ca85d(_0x3ddabd);});});} \ No newline at end of file +var _0xfdbd=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','localhost','socket.io-emitter','./userProfile.socket','register','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment'];(function(_0x21b76e,_0x5a1247){var _0x5a1006=function(_0x2bd163){while(--_0x2bd163){_0x21b76e['push'](_0x21b76e['shift']());}};_0x5a1006(++_0x5a1247);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x23c3f4,_0x24f0b3){_0x23c3f4=_0x23c3f4-0x0;var _0x82f0f1=_0xfdbd[_0x23c3f4];return _0x82f0f1;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var moment=require(_0xdfdb('0x2'));var BPromise=require(_0xdfdb('0x3'));var rs=require(_0xdfdb('0x4'));var fs=require('fs');var Redis=require(_0xdfdb('0x5'));var db=require(_0xdfdb('0x6'))['db'];var utils=require(_0xdfdb('0x7'));var logger=require(_0xdfdb('0x8'))('rpc');var config=require(_0xdfdb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdfdb('0xa')][_0xdfdb('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xdfdb('0xc'),'port':0x18eb});var socket=require(_0xdfdb('0xd'))(new Redis(config['redis']));require(_0xdfdb('0xe'))[_0xdfdb('0xf')](socket);function respondWithRpcPromise(_0x24eb73,_0x27ddcd,_0x3a44a9){return new BPromise(function(_0x1ace28,_0x2bb8d4){return client['request'](_0x24eb73,_0x3a44a9)[_0xdfdb('0x10')](function(_0x1972db){logger['info'](_0xdfdb('0x11'),_0x27ddcd,_0xdfdb('0x12'));logger[_0xdfdb('0x13')](_0xdfdb('0x14'),_0x27ddcd,_0xdfdb('0x12'),JSON[_0xdfdb('0x15')](_0x1972db));if(_0x1972db[_0xdfdb('0x16')]){if(_0x1972db[_0xdfdb('0x16')]['code']===0x1f4){logger['error'](_0xdfdb('0x11'),_0x27ddcd,_0x1972db['error'][_0xdfdb('0x17')]);return _0x2bb8d4(_0x1972db[_0xdfdb('0x16')][_0xdfdb('0x17')]);}logger[_0xdfdb('0x16')](_0xdfdb('0x11'),_0x27ddcd,_0x1972db[_0xdfdb('0x16')]['message']);return _0x1ace28(_0x1972db['error'][_0xdfdb('0x17')]);}else{logger[_0xdfdb('0x18')](_0xdfdb('0x11'),_0x27ddcd,'request\x20sent');_0x1ace28(_0x1972db[_0xdfdb('0x19')][_0xdfdb('0x17')]);}})[_0xdfdb('0x1a')](function(_0xd60a30){logger[_0xdfdb('0x16')](_0xdfdb('0x11'),_0x27ddcd,_0xd60a30);_0x2bb8d4(_0xd60a30);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index e832543..cb9bb9b 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 _0xe0a7=['userProfile:','./userProfile.events','remove','update','emit','length'];(function(_0x1f0213,_0x3c3c9e){var _0x2048c4=function(_0x26d0c6){while(--_0x26d0c6){_0x1f0213['push'](_0x1f0213['shift']());}};_0x2048c4(++_0x3c3c9e);}(_0xe0a7,0x73));var _0x7e0a=function(_0x4378d7,_0x56b721){_0x4378d7=_0x4378d7-0x0;var _0x331458=_0xe0a7[_0x4378d7];return _0x331458;};'use strict';var UserProfileEvents=require(_0x7e0a('0x0'));var events=['save',_0x7e0a('0x1'),_0x7e0a('0x2')];function createListener(_0x462d25,_0x2f26ae){return function(_0x1e039c){_0x2f26ae[_0x7e0a('0x3')](_0x462d25,_0x1e039c);};}function removeListener(_0x173eb7,_0x33c416){return function(){UserProfileEvents['removeListener'](_0x173eb7,_0x33c416);};}exports['register']=function(_0x1961fe){for(var _0x31b849=0x0,_0x20c7c4=events[_0x7e0a('0x4')];_0x31b849<_0x20c7c4;_0x31b849++){var _0x9ac02e=events[_0x31b849];var _0x4be9e9=createListener(_0x7e0a('0x5')+_0x9ac02e,_0x1961fe);UserProfileEvents['on'](_0x9ac02e,_0x4be9e9);}}; \ No newline at end of file +var _0x519a=['register','length','./userProfile.events','save','remove','emit','removeListener'];(function(_0x1f9214,_0x30799b){var _0x59c7d0=function(_0x3747c2){while(--_0x3747c2){_0x1f9214['push'](_0x1f9214['shift']());}};_0x59c7d0(++_0x30799b);}(_0x519a,0xb8));var _0xa519=function(_0x4a4922,_0x82cb8f){_0x4a4922=_0x4a4922-0x0;var _0x55a8c6=_0x519a[_0x4a4922];return _0x55a8c6;};'use strict';var UserProfileEvents=require(_0xa519('0x0'));var events=[_0xa519('0x1'),_0xa519('0x2'),'update'];function createListener(_0xea4a49,_0x311093){return function(_0xdfbfad){_0x311093[_0xa519('0x3')](_0xea4a49,_0xdfbfad);};}function removeListener(_0x5d6000,_0x30ac14){return function(){UserProfileEvents[_0xa519('0x4')](_0x5d6000,_0x30ac14);};}exports[_0xa519('0x5')]=function(_0x2bab1b){for(var _0x4e299f=0x0,_0x1e11d3=events[_0xa519('0x6')];_0x4e299f<_0x1e11d3;_0x4e299f++){var _0x1ab2df=events[_0x4e299f];var _0x31e18e=createListener('userProfile:'+_0x1ab2df,_0x2bab1b);UserProfileEvents['on'](_0x1ab2df,_0x31e18e);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index df5da02..2414fbd 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 _0xd52b=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','create','put','/:id','exports'];(function(_0x1d3ec7,_0x4e3e27){var _0x286aa3=function(_0x4ff999){while(--_0x4ff999){_0x1d3ec7['push'](_0x1d3ec7['shift']());}};_0x286aa3(++_0x4e3e27);}(_0xd52b,0x144));var _0xbd52=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xd52b[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0xbd52('0x0'));var util=require(_0xbd52('0x1'));var path=require(_0xbd52('0x2'));var timeout=require(_0xbd52('0x3'));var express=require(_0xbd52('0x4'));var router=express[_0xbd52('0x5')]();var fs_extra=require(_0xbd52('0x6'));var auth=require(_0xbd52('0x7'));var interaction=require(_0xbd52('0x8'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router[_0xbd52('0x9')]('/',auth[_0xbd52('0xa')](),controller[_0xbd52('0xb')]);router[_0xbd52('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xbd52('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xbd52('0xc')]);router[_0xbd52('0xd')]('/',auth[_0xbd52('0xa')](),controller[_0xbd52('0xe')]);router[_0xbd52('0xf')](_0xbd52('0x10'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xbd52('0x10'),auth[_0xbd52('0xa')](),controller['destroy']);module[_0xbd52('0x11')]=router; \ No newline at end of file +var _0x1a37=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x25a8c5,_0x227f9d){var _0x1d698d=function(_0x580650){while(--_0x580650){_0x25a8c5['push'](_0x25a8c5['shift']());}};_0x1d698d(++_0x227f9d);}(_0x1a37,0x127));var _0x71a3=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x1a37[_0x15c421];return _0x5e5ed5;};'use strict';var multer=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var path=require(_0x71a3('0x2'));var timeout=require(_0x71a3('0x3'));var express=require(_0x71a3('0x4'));var router=express[_0x71a3('0x5')]();var fs_extra=require(_0x71a3('0x6'));var auth=require(_0x71a3('0x7'));var interaction=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var controller=require(_0x71a3('0xa'));router[_0x71a3('0xb')]('/',auth[_0x71a3('0xc')](),controller[_0x71a3('0xd')]);router[_0x71a3('0xb')](_0x71a3('0xe'),auth[_0x71a3('0xc')](),controller[_0x71a3('0xf')]);router[_0x71a3('0xb')](_0x71a3('0x10'),auth['isAuthenticated'](),controller[_0x71a3('0x11')]);router[_0x71a3('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x71a3('0x13')]('/:id',auth[_0x71a3('0xc')](),controller[_0x71a3('0x14')]);router[_0x71a3('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x71a3('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 1f20ff4..86a2e22 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 _0x22a3=['STRING','INTEGER','exports'];(function(_0x4c2089,_0x2c22a1){var _0x4d2a71=function(_0x539162){while(--_0x539162){_0x4c2089['push'](_0x4c2089['shift']());}};_0x4d2a71(++_0x2c22a1);}(_0x22a3,0x143));var _0x322a=function(_0x1df803,_0x25192d){_0x1df803=_0x1df803-0x0;var _0x20ef12=_0x22a3[_0x1df803];return _0x20ef12;};'use strict';var Sequelize=require('sequelize');module[_0x322a('0x0')]={'name':{'type':Sequelize[_0x322a('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x322a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x322a('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x5597=['INTEGER','sequelize','exports','STRING'];(function(_0x2b9d54,_0x4ad9ee){var _0x3edc0e=function(_0x372425){while(--_0x372425){_0x2b9d54['push'](_0x2b9d54['shift']());}};_0x3edc0e(++_0x4ad9ee);}(_0x5597,0x1b9));var _0x7559=function(_0x960743,_0x4008b7){_0x960743=_0x960743-0x0;var _0x2002d9=_0x5597[_0x960743];return _0x2002d9;};'use strict';var Sequelize=require(_0x7559('0x0'));module[_0x7559('0x1')]={'name':{'type':Sequelize[_0x7559('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x7559('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x7559('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 fbda200..664a9d0 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 _0x4c60=['../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','end','error','stack','name','index','map','UserProfileResource','rawAttributes','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','includeAll','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x113566,_0x78c52a){var _0x359407=function(_0x2fa3ad){while(--_0x2fa3ad){_0x113566['push'](_0x113566['shift']());}};_0x359407(++_0x78c52a);}(_0x4c60,0xc1));var _0x04c6=function(_0x4ba72d,_0x34af51){_0x4ba72d=_0x4ba72d-0x0;var _0x1a0b93=_0x4c60[_0x4ba72d];return _0x1a0b93;};'use strict';var emlformat=require(_0x04c6('0x0'));var rimraf=require(_0x04c6('0x1'));var zipdir=require(_0x04c6('0x2'));var jsonpatch=require(_0x04c6('0x3'));var rp=require('request-promise');var moment=require(_0x04c6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x04c6('0x5'));var csv=require(_0x04c6('0x6'));var ejs=require(_0x04c6('0x7'));var fs=require('fs');var fs_extra=require(_0x04c6('0x8'));var _=require(_0x04c6('0x9'));var squel=require(_0x04c6('0xa'));var crypto=require(_0x04c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04c6('0xc'));var toCsv=require(_0x04c6('0x6'));var querystring=require(_0x04c6('0xd'));var Papa=require(_0x04c6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x04c6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04c6('0x10'))(_0x04c6('0x11'));var utils=require('../../config/utils');var config=require(_0x04c6('0x12'));var licenseUtil=require(_0x04c6('0x13'));var db=require(_0x04c6('0x14'))['db'];function respondWithStatusCode(_0x4e5e6,_0x52cdcf){_0x52cdcf=_0x52cdcf||0xcc;return function(_0x257a0a){if(_0x257a0a){return _0x4e5e6[_0x04c6('0x15')](_0x52cdcf);}return _0x4e5e6[_0x04c6('0x16')](_0x52cdcf)['end']();};}function respondWithResult(_0x12d1c5,_0x15cbe0){_0x15cbe0=_0x15cbe0||0xc8;return function(_0x28632e){if(_0x28632e){return _0x12d1c5[_0x04c6('0x16')](_0x15cbe0)[_0x04c6('0x17')](_0x28632e);}};}function respondWithFilteredResult(_0x19a26f,_0x1cd963){return function(_0x3d46a9){if(_0x3d46a9){var _0x5a5a66=typeof _0x1cd963[_0x04c6('0x18')]===_0x04c6('0x19')&&typeof _0x1cd963[_0x04c6('0x1a')]===_0x04c6('0x19');var _0x43596a=_0x3d46a9[_0x04c6('0x1b')];var _0x21674a=_0x5a5a66?0x0:_0x1cd963[_0x04c6('0x18')];var _0x47f400=_0x5a5a66?_0x3d46a9[_0x04c6('0x1b')]:_0x1cd963[_0x04c6('0x18')]+_0x1cd963[_0x04c6('0x1a')];var _0x558b43;if(_0x47f400>=_0x43596a){_0x47f400=_0x43596a;_0x558b43=0xc8;}else{_0x558b43=0xce;}_0x19a26f['status'](_0x558b43);return _0x19a26f['set'](_0x04c6('0x1c'),_0x21674a+'-'+_0x47f400+'/'+_0x43596a)[_0x04c6('0x17')](_0x3d46a9);}return null;};}function patchUpdates(_0x50dd61){return function(_0x5a5e9e){try{jsonpatch[_0x04c6('0x1d')](_0x5a5e9e,_0x50dd61,!![]);}catch(_0x2eed94){return BPromise[_0x04c6('0x1e')](_0x2eed94);}return _0x5a5e9e['save']();};}function saveUpdates(_0x33a0f7,_0x13f2dc){return function(_0x9d41f8){if(_0x9d41f8){return _0x9d41f8['update'](_0x33a0f7)[_0x04c6('0x1f')](function(_0x41e29f){return _0x41e29f;});}return null;};}function removeEntity(_0x562491,_0x54a8b0){return function(_0x4c8d72){if(_0x4c8d72){return _0x4c8d72[_0x04c6('0x20')]()[_0x04c6('0x1f')](function(){_0x562491[_0x04c6('0x16')](0xcc)[_0x04c6('0x21')]();});}};}function handleEntityNotFound(_0x3e1328,_0x52e5f5){return function(_0x562952){if(!_0x562952){_0x3e1328[_0x04c6('0x15')](0x194);}return _0x562952;};}function handleError(_0x2ab1d2,_0x9acfa){_0x9acfa=_0x9acfa||0x1f4;return function(_0x3233d7){logger[_0x04c6('0x22')](_0x3233d7[_0x04c6('0x23')]);if(_0x3233d7['name']){delete _0x3233d7[_0x04c6('0x24')];}_0x2ab1d2[_0x04c6('0x16')](_0x9acfa)['send'](_0x3233d7);};}exports[_0x04c6('0x25')]=function(_0x1cd16a,_0x5f1331){var _0x5c9003={},_0x115d84={},_0x3a6d92={'count':0x0,'rows':[]};var _0x2a191f=_[_0x04c6('0x26')](db[_0x04c6('0x27')][_0x04c6('0x28')],function(_0x49c4ed){return{'name':_0x49c4ed['fieldName'],'type':_0x49c4ed['type'][_0x04c6('0x29')]};});_0x115d84['model']=_[_0x04c6('0x26')](_0x2a191f,_0x04c6('0x24'));_0x115d84['query']=_[_0x04c6('0x2a')](_0x1cd16a[_0x04c6('0x2b')]);_0x115d84[_0x04c6('0x2c')]=_[_0x04c6('0x2d')](_0x115d84['model'],_0x115d84[_0x04c6('0x2b')]);_0x5c9003[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0x115d84[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x30')]));_0x5c9003[_0x04c6('0x2e')]=_0x5c9003[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x5c9003[_0x04c6('0x2e')]:_0x115d84[_0x04c6('0x2f')];if(!_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x32')](_0x04c6('0x33'))){_0x5c9003['limit']=qs[_0x04c6('0x1a')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x1a')]);_0x5c9003[_0x04c6('0x18')]=qs['offset'](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x18')]);}_0x5c9003['order']=qs['sort'](_0x1cd16a['query'][_0x04c6('0x34')]);_0x5c9003[_0x04c6('0x35')]=qs['filters'](_[_0x04c6('0x36')](_0x1cd16a['query'],_0x115d84[_0x04c6('0x2c')]),_0x2a191f);if(_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x37')]){_0x5c9003[_0x04c6('0x35')]=_['merge'](_0x5c9003['where'],{'$or':_[_0x04c6('0x26')](_0x2a191f,function(_0x3a9a3b){if(_0x3a9a3b['type']!==_0x04c6('0x38')){var _0x5ce4b0={};_0x5ce4b0[_0x3a9a3b['name']]={'$like':'%'+_0x1cd16a[_0x04c6('0x2b')]['filter']+'%'};return _0x5ce4b0;}})});}_0x5c9003=_[_0x04c6('0x39')]({},_0x5c9003,_0x1cd16a[_0x04c6('0x3a')]);var _0x59ca18={'where':_0x5c9003[_0x04c6('0x35')]};return db['UserProfileResource'][_0x04c6('0x1b')](_0x59ca18)[_0x04c6('0x1f')](function(_0x2d83eb){_0x3a6d92[_0x04c6('0x1b')]=_0x2d83eb;if(_0x1cd16a[_0x04c6('0x2b')]['includeAll']){_0x5c9003[_0x04c6('0x3b')]=[{'all':!![]}];}return db['UserProfileResource'][_0x04c6('0x3c')](_0x5c9003);})['then'](function(_0x1f7ead){_0x3a6d92[_0x04c6('0x3d')]=_0x1f7ead;return _0x3a6d92;})[_0x04c6('0x1f')](respondWithFilteredResult(_0x5f1331,_0x5c9003))[_0x04c6('0x3e')](handleError(_0x5f1331,null));};exports[_0x04c6('0x3f')]=function(_0x2cdf34,_0x40477f){var _0x4a3c45={'raw':![],'where':{'id':_0x2cdf34['params']['id']}},_0xdfdc34={};_0xdfdc34[_0x04c6('0x2f')]=_['keys'](db['UserProfileResource'][_0x04c6('0x28')]);_0xdfdc34['query']=_[_0x04c6('0x2a')](_0x2cdf34[_0x04c6('0x2b')]);_0xdfdc34[_0x04c6('0x2c')]=_['intersection'](_0xdfdc34[_0x04c6('0x2f')],_0xdfdc34[_0x04c6('0x2b')]);_0x4a3c45[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0xdfdc34[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x2cdf34[_0x04c6('0x2b')]['fields']));_0x4a3c45['attributes']=_0x4a3c45[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x4a3c45[_0x04c6('0x2e')]:_0xdfdc34['model'];if(_0x2cdf34[_0x04c6('0x2b')][_0x04c6('0x40')]){_0x4a3c45[_0x04c6('0x3b')]=[{'all':!![]}];}_0x4a3c45=_['merge']({},_0x4a3c45,_0x2cdf34['options']);return db['UserProfileResource'][_0x04c6('0x41')](_0x4a3c45)[_0x04c6('0x1f')](handleEntityNotFound(_0x40477f,null))['then'](respondWithResult(_0x40477f,null))[_0x04c6('0x3e')](handleError(_0x40477f,null));};exports[_0x04c6('0x42')]=function(_0x2bd045,_0x4ef366){return db[_0x04c6('0x27')][_0x04c6('0x42')](_0x2bd045['body'],{})[_0x04c6('0x1f')](respondWithResult(_0x4ef366,0xc9))[_0x04c6('0x3e')](handleError(_0x4ef366,null));};exports[_0x04c6('0x43')]=function(_0xee2822,_0x4cfde2){if(_0xee2822[_0x04c6('0x44')]['id']){delete _0xee2822[_0x04c6('0x44')]['id'];}return db[_0x04c6('0x27')][_0x04c6('0x41')]({'where':{'id':_0xee2822['params']['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x4cfde2,null))[_0x04c6('0x1f')](saveUpdates(_0xee2822[_0x04c6('0x44')],null))[_0x04c6('0x1f')](respondWithResult(_0x4cfde2,null))['catch'](handleError(_0x4cfde2,null));};exports[_0x04c6('0x20')]=function(_0x42273e,_0x15ec61){return db['UserProfileResource'][_0x04c6('0x41')]({'where':{'id':_0x42273e[_0x04c6('0x45')]['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x15ec61,null))[_0x04c6('0x1f')](removeEntity(_0x15ec61,null))[_0x04c6('0x3e')](handleError(_0x15ec61,null));};exports[_0x04c6('0x46')]=function(_0x1b8fa4,_0x160f91){return db[_0x04c6('0x27')][_0x04c6('0x46')]()[_0x04c6('0x1f')](respondWithResult(_0x160f91,null))[_0x04c6('0x3e')](handleError(_0x160f91,null));}; \ No newline at end of file +var _0x0295=['params','intersection','include','find','create','body','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','UserProfileResource','includeAll','rows','catch','show'];(function(_0x4b6507,_0x5518b5){var _0x2001ec=function(_0x330ddf){while(--_0x330ddf){_0x4b6507['push'](_0x4b6507['shift']());}};_0x2001ec(++_0x5518b5);}(_0x0295,0x1f0));var _0x5029=function(_0x3f7855,_0x535342){_0x3f7855=_0x3f7855-0x0;var _0x301fb7=_0x0295[_0x3f7855];return _0x301fb7;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=typeof _0x317c20[_0x5029('0x18')]===_0x5029('0x19')&&typeof _0x317c20[_0x5029('0x1a')]===_0x5029('0x19');var _0x343918=_0x10bf55['count'];var _0x1ed567=_0x326923?0x0:_0x317c20[_0x5029('0x18')];var _0x35de81=_0x326923?_0x10bf55[_0x5029('0x1b')]:_0x317c20[_0x5029('0x18')]+_0x317c20[_0x5029('0x1a')];var _0xaba461;if(_0x35de81>=_0x343918){_0x35de81=_0x343918;_0xaba461=0xc8;}else{_0xaba461=0xce;}_0xe278b7['status'](_0xaba461);return _0xe278b7[_0x5029('0x1c')]('Content-Range',_0x1ed567+'-'+_0x35de81+'/'+_0x343918)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x8a414c){return function(_0x2710aa){try{jsonpatch[_0x5029('0x1d')](_0x2710aa,_0x8a414c,!![]);}catch(_0x4b5854){return BPromise['reject'](_0x4b5854);}return _0x2710aa[_0x5029('0x1e')]();};}function saveUpdates(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1f')](_0x4a49b6)[_0x5029('0x20')](function(_0x16bd22){return _0x16bd22;});}return null;};}function removeEntity(_0x3a3e52,_0x125c26){return function(_0x356dac){if(_0x356dac){return _0x356dac[_0x5029('0x21')]()['then'](function(){_0x3a3e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x22')]);if(_0x36d810[_0x5029('0x23')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x16')](_0x1e7e61)[_0x5029('0x24')](_0x36d810);};}exports[_0x5029('0x25')]=function(_0x4a24b9,_0x32da06){var _0x251f99={},_0xe5313e={},_0x4b6f92={'count':0x0,'rows':[]};var _0x2cedf6=_[_0x5029('0x26')](db['UserProfileResource'][_0x5029('0x27')],function(_0x25032b){return{'name':_0x25032b[_0x5029('0x28')],'type':_0x25032b[_0x5029('0x29')][_0x5029('0x2a')]};});_0xe5313e[_0x5029('0x2b')]=_[_0x5029('0x26')](_0x2cedf6,_0x5029('0x23'));_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2d')](_0x4a24b9[_0x5029('0x2c')]);_0xe5313e[_0x5029('0x2e')]=_['intersection'](_0xe5313e[_0x5029('0x2b')],_0xe5313e['query']);_0x251f99[_0x5029('0x2f')]=_['intersection'](_0xe5313e['model'],qs[_0x5029('0x30')](_0x4a24b9[_0x5029('0x2c')][_0x5029('0x30')]));_0x251f99['attributes']=_0x251f99[_0x5029('0x2f')][_0x5029('0x31')]?_0x251f99[_0x5029('0x2f')]:_0xe5313e[_0x5029('0x2b')];if(!_0x4a24b9[_0x5029('0x2c')][_0x5029('0x32')](_0x5029('0x33'))){_0x251f99[_0x5029('0x1a')]=qs[_0x5029('0x1a')](_0x4a24b9['query'][_0x5029('0x1a')]);_0x251f99[_0x5029('0x18')]=qs[_0x5029('0x18')](_0x4a24b9[_0x5029('0x2c')]['offset']);}_0x251f99[_0x5029('0x34')]=qs[_0x5029('0x35')](_0x4a24b9[_0x5029('0x2c')]['sort']);_0x251f99['where']=qs[_0x5029('0x2e')](_[_0x5029('0x36')](_0x4a24b9['query'],_0xe5313e['filters']),_0x2cedf6);if(_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]){_0x251f99[_0x5029('0x38')]=_[_0x5029('0x39')](_0x251f99[_0x5029('0x38')],{'$or':_[_0x5029('0x26')](_0x2cedf6,function(_0x3cb84e){if(_0x3cb84e[_0x5029('0x29')]!==_0x5029('0x3a')){var _0x3effa4={};_0x3effa4[_0x3cb84e[_0x5029('0x23')]]={'$like':'%'+_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]+'%'};return _0x3effa4;}})});}_0x251f99=_[_0x5029('0x39')]({},_0x251f99,_0x4a24b9['options']);var _0x57c2b5={'where':_0x251f99[_0x5029('0x38')]};return db[_0x5029('0x3b')][_0x5029('0x1b')](_0x57c2b5)['then'](function(_0x32d8a3){_0x4b6f92[_0x5029('0x1b')]=_0x32d8a3;if(_0x4a24b9['query'][_0x5029('0x3c')]){_0x251f99['include']=[{'all':!![]}];}return db[_0x5029('0x3b')]['findAll'](_0x251f99);})[_0x5029('0x20')](function(_0x359838){_0x4b6f92[_0x5029('0x3d')]=_0x359838;return _0x4b6f92;})[_0x5029('0x20')](respondWithFilteredResult(_0x32da06,_0x251f99))[_0x5029('0x3e')](handleError(_0x32da06,null));};exports[_0x5029('0x3f')]=function(_0x4b2219,_0x1021ea){var _0x2ae047={'raw':![],'where':{'id':_0x4b2219[_0x5029('0x40')]['id']}},_0x5a3e4d={};_0x5a3e4d[_0x5029('0x2b')]=_[_0x5029('0x2d')](db[_0x5029('0x3b')][_0x5029('0x27')]);_0x5a3e4d[_0x5029('0x2c')]=_['keys'](_0x4b2219[_0x5029('0x2c')]);_0x5a3e4d[_0x5029('0x2e')]=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],_0x5a3e4d[_0x5029('0x2c')]);_0x2ae047['attributes']=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],qs[_0x5029('0x30')](_0x4b2219[_0x5029('0x2c')][_0x5029('0x30')]));_0x2ae047[_0x5029('0x2f')]=_0x2ae047[_0x5029('0x2f')][_0x5029('0x31')]?_0x2ae047[_0x5029('0x2f')]:_0x5a3e4d['model'];if(_0x4b2219[_0x5029('0x2c')][_0x5029('0x3c')]){_0x2ae047[_0x5029('0x42')]=[{'all':!![]}];}_0x2ae047=_[_0x5029('0x39')]({},_0x2ae047,_0x4b2219['options']);return db['UserProfileResource'][_0x5029('0x43')](_0x2ae047)[_0x5029('0x20')](handleEntityNotFound(_0x1021ea,null))[_0x5029('0x20')](respondWithResult(_0x1021ea,null))[_0x5029('0x3e')](handleError(_0x1021ea,null));};exports[_0x5029('0x44')]=function(_0x3dfc08,_0x2bb7fc){return db[_0x5029('0x3b')][_0x5029('0x44')](_0x3dfc08[_0x5029('0x45')],{})[_0x5029('0x20')](respondWithResult(_0x2bb7fc,0xc9))[_0x5029('0x3e')](handleError(_0x2bb7fc,null));};exports[_0x5029('0x1f')]=function(_0x18f1f5,_0x3168bd){if(_0x18f1f5[_0x5029('0x45')]['id']){delete _0x18f1f5[_0x5029('0x45')]['id'];}return db[_0x5029('0x3b')][_0x5029('0x43')]({'where':{'id':_0x18f1f5[_0x5029('0x40')]['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x3168bd,null))['then'](saveUpdates(_0x18f1f5[_0x5029('0x45')],null))['then'](respondWithResult(_0x3168bd,null))[_0x5029('0x3e')](handleError(_0x3168bd,null));};exports[_0x5029('0x21')]=function(_0x4d788a,_0x5343c6){return db[_0x5029('0x3b')]['find']({'where':{'id':_0x4d788a['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x5343c6,null))[_0x5029('0x20')](removeEntity(_0x5343c6,null))[_0x5029('0x3e')](handleError(_0x5343c6,null));};exports['describe']=function(_0x544fb3,_0x1510bb){return db[_0x5029('0x3b')]['describe']()[_0x5029('0x20')](respondWithResult(_0x1510bb,null))['catch'](handleError(_0x1510bb,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index c822e3a..a052143 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 _0xea80=['UserProfileResource','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes'];(function(_0x530f50,_0x5da7d6){var _0x373031=function(_0x23ccf6){while(--_0x23ccf6){_0x530f50['push'](_0x530f50['shift']());}};_0x373031(++_0x5da7d6);}(_0xea80,0x112));var _0x0ea8=function(_0x311374,_0x7ec0b4){_0x311374=_0x311374-0x0;var _0x8fe9ba=_0xea80[_0x311374];return _0x8fe9ba;};'use strict';var _=require(_0x0ea8('0x0'));var util=require(_0x0ea8('0x1'));var logger=require(_0x0ea8('0x2'))(_0x0ea8('0x3'));var moment=require(_0x0ea8('0x4'));var BPromise=require(_0x0ea8('0x5'));var rp=require(_0x0ea8('0x6'));var fs=require('fs');var path=require(_0x0ea8('0x7'));var rimraf=require(_0x0ea8('0x8'));var config=require(_0x0ea8('0x9'));var attributes=require(_0x0ea8('0xa'));module['exports']=function(_0x37dc69,_0x11ca2d){return _0x37dc69['define'](_0x0ea8('0xb'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x0ea8('0xc'),'fields':[_0x0ea8('0xd'),_0x0ea8('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x187a=['../../config/logger','api','bluebird','path','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','lodash','util'];(function(_0x23bb5e,_0x53d3c4){var _0x1132b2=function(_0x4a24db){while(--_0x4a24db){_0x23bb5e['push'](_0x23bb5e['shift']());}};_0x1132b2(++_0x53d3c4);}(_0x187a,0x1c5));var _0xa187=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x187a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xa187('0x0'));var util=require(_0xa187('0x1'));var logger=require(_0xa187('0x2'))(_0xa187('0x3'));var moment=require('moment');var BPromise=require(_0xa187('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa187('0x5'));var rimraf=require('rimraf');var config=require(_0xa187('0x6'));var attributes=require(_0xa187('0x7'));module[_0xa187('0x8')]=function(_0x5a18c5,_0x3cd5ce){return _0x5a18c5['define'](_0xa187('0x9'),attributes,{'tableName':_0xa187('0xa'),'paranoid':![],'indexes':[{'name':_0xa187('0xb'),'fields':[_0xa187('0xc'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 7c0b1e3..10a5ba8 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 _0x54a6=['http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1daa02,_0x4c7dc4){var _0x39205a=function(_0x398306){while(--_0x398306){_0x1daa02['push'](_0x1daa02['shift']());}};_0x39205a(++_0x4c7dc4);}(_0x54a6,0xb5));var _0x654a=function(_0x5ed366,_0x40c3a2){_0x5ed366=_0x5ed366-0x0;var _0x2f3a12=_0x54a6[_0x5ed366];return _0x2f3a12;};'use strict';var _=require(_0x654a('0x0'));var util=require('util');var moment=require(_0x654a('0x1'));var BPromise=require(_0x654a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x654a('0x3'));var db=require(_0x654a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x654a('0x5'))('rpc');var config=require(_0x654a('0x6'));var jayson=require(_0x654a('0x7'));var client=jayson['client'][_0x654a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x19d43d,_0x405278,_0x1d1f55){return new BPromise(function(_0x1a60aa,_0x3e01e9){return client[_0x654a('0x9')](_0x19d43d,_0x1d1f55)[_0x654a('0xa')](function(_0x312019){logger[_0x654a('0xb')](_0x654a('0xc'),_0x405278,_0x654a('0xd'));logger[_0x654a('0xe')](_0x654a('0xf'),_0x405278,_0x654a('0xd'),JSON[_0x654a('0x10')](_0x312019));if(_0x312019[_0x654a('0x11')]){if(_0x312019[_0x654a('0x11')][_0x654a('0x12')]===0x1f4){logger[_0x654a('0x11')](_0x654a('0xc'),_0x405278,_0x312019[_0x654a('0x11')][_0x654a('0x13')]);return _0x3e01e9(_0x312019[_0x654a('0x11')]['message']);}logger[_0x654a('0x11')](_0x654a('0xc'),_0x405278,_0x312019[_0x654a('0x11')][_0x654a('0x13')]);return _0x1a60aa(_0x312019['error'][_0x654a('0x13')]);}else{logger[_0x654a('0xb')](_0x654a('0xc'),_0x405278,'request\x20sent');_0x1a60aa(_0x312019[_0x654a('0x14')][_0x654a('0x13')]);}})['catch'](function(_0x1a30cb){logger[_0x654a('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x405278,_0x1a30cb);_0x3e01e9(_0x1a30cb);});});} \ No newline at end of file +var _0x1339=['error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s'];(function(_0x1c7ce8,_0x25cec6){var _0x2d8631=function(_0x426fec){while(--_0x426fec){_0x1c7ce8['push'](_0x1c7ce8['shift']());}};_0x2d8631(++_0x25cec6);}(_0x1339,0x1bf));var _0x9133=function(_0x30fe88,_0x345836){_0x30fe88=_0x30fe88-0x0;var _0x277096=_0x1339[_0x30fe88];return _0x277096;};'use strict';var _=require(_0x9133('0x0'));var util=require(_0x9133('0x1'));var moment=require('moment');var BPromise=require(_0x9133('0x2'));var rs=require(_0x9133('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9133('0x4'));var logger=require(_0x9133('0x5'))('rpc');var config=require(_0x9133('0x6'));var jayson=require(_0x9133('0x7'));var client=jayson[_0x9133('0x8')][_0x9133('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x81460c,_0x524719,_0x4c7852){return new BPromise(function(_0x2c37ce,_0x5762bc){return client[_0x9133('0xa')](_0x81460c,_0x4c7852)['then'](function(_0x41af31){logger['info'](_0x9133('0xb'),_0x524719,_0x9133('0xc'));logger[_0x9133('0xd')](_0x9133('0xe'),_0x524719,'request\x20sent',JSON['stringify'](_0x41af31));if(_0x41af31['error']){if(_0x41af31[_0x9133('0xf')][_0x9133('0x10')]===0x1f4){logger[_0x9133('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x524719,_0x41af31[_0x9133('0xf')][_0x9133('0x11')]);return _0x5762bc(_0x41af31[_0x9133('0xf')][_0x9133('0x11')]);}logger[_0x9133('0xf')](_0x9133('0xb'),_0x524719,_0x41af31[_0x9133('0xf')][_0x9133('0x11')]);return _0x2c37ce(_0x41af31[_0x9133('0xf')]['message']);}else{logger[_0x9133('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x524719,'request\x20sent');_0x2c37ce(_0x41af31[_0x9133('0x13')][_0x9133('0x11')]);}})[_0x9133('0x14')](function(_0x34432e){logger[_0x9133('0xf')](_0x9133('0xb'),_0x524719,_0x34432e);_0x5762bc(_0x34432e);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 4573d55..5bcfa36 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 _0xe62d=['index','/describe','describe','/:id','show','create','put','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated'];(function(_0x40dd56,_0x726ca5){var _0x4f850f=function(_0x5f899e){while(--_0x5f899e){_0x40dd56['push'](_0x40dd56['shift']());}};_0x4f850f(++_0x726ca5);}(_0xe62d,0x1ad));var _0xde62=function(_0x2d85a5,_0x26861c){_0x2d85a5=_0x2d85a5-0x0;var _0x27d75b=_0xe62d[_0x2d85a5];return _0x27d75b;};'use strict';var multer=require(_0xde62('0x0'));var util=require('util');var path=require(_0xde62('0x1'));var timeout=require(_0xde62('0x2'));var express=require(_0xde62('0x3'));var router=express[_0xde62('0x4')]();var fs_extra=require(_0xde62('0x5'));var auth=require(_0xde62('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xde62('0x7'));var controller=require(_0xde62('0x8'));router[_0xde62('0x9')]('/',auth[_0xde62('0xa')](),controller[_0xde62('0xb')]);router[_0xde62('0x9')](_0xde62('0xc'),auth[_0xde62('0xa')](),controller[_0xde62('0xd')]);router[_0xde62('0x9')](_0xde62('0xe'),auth[_0xde62('0xa')](),controller[_0xde62('0xf')]);router['post']('/',auth[_0xde62('0xa')](),controller[_0xde62('0x10')]);router[_0xde62('0x11')]('/:id',auth[_0xde62('0xa')](),controller[_0xde62('0x12')]);router['delete'](_0xde62('0xe'),auth[_0xde62('0xa')](),controller[_0xde62('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0a39=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','put','/:id','update','destroy'];(function(_0x483d8b,_0x526c52){var _0x6500f1=function(_0x372797){while(--_0x372797){_0x483d8b['push'](_0x483d8b['shift']());}};_0x6500f1(++_0x526c52);}(_0x0a39,0x121));var _0x90a3=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0a39[_0x19950b];return _0x3c6b41;};'use strict';var multer=require('multer');var util=require(_0x90a3('0x0'));var path=require(_0x90a3('0x1'));var timeout=require(_0x90a3('0x2'));var express=require(_0x90a3('0x3'));var router=express[_0x90a3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x90a3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x90a3('0x6'));var controller=require(_0x90a3('0x7'));router[_0x90a3('0x8')]('/',auth[_0x90a3('0x9')](),controller[_0x90a3('0xa')]);router['get'](_0x90a3('0xb'),auth['isAuthenticated'](),controller[_0x90a3('0xc')]);router[_0x90a3('0x8')]('/:id',auth[_0x90a3('0x9')](),controller['show']);router['post']('/',auth[_0x90a3('0x9')](),controller['create']);router[_0x90a3('0xd')](_0x90a3('0xe'),auth[_0x90a3('0x9')](),controller[_0x90a3('0xf')]);router['delete'](_0x90a3('0xe'),auth[_0x90a3('0x9')](),controller[_0x90a3('0x10')]);module[_0x90a3('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 766422a..cef4d86 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 _0x0972=['crudPermissions','join','getDataValue','split','exports','STRING','BOOLEAN','setDataValue'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x0972,0x64));var _0x2097=function(_0x8237ae,_0x193aeb){_0x8237ae=_0x8237ae-0x0;var _0x2baa65=_0x0972[_0x8237ae];return _0x2baa65;};'use strict';var Sequelize=require('sequelize');module[_0x2097('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x2097('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x2097('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x2097('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x348ad8){this[_0x2097('0x3')](_0x2097('0x4'),_0x348ad8?_0x348ad8[_0x2097('0x5')](''):[]);},'get':function(){return this[_0x2097('0x6')](_0x2097('0x4'))?this[_0x2097('0x6')]('crudPermissions')[_0x2097('0x7')](''):[];}}}; \ No newline at end of file +var _0xb62e=['STRING','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb62e,0x1de));var _0xeb62=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb62e[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0xeb62('0x0'));module[_0xeb62('0x1')]={'name':{'type':Sequelize[_0xeb62('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xeb62('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xeb62('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xeb62('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xeb62('0x2')],'set':function(_0x929329){this[_0xeb62('0x4')](_0xeb62('0x5'),_0x929329?_0x929329['join'](''):[]);},'get':function(){return this[_0xeb62('0x6')](_0xeb62('0x5'))?this[_0xeb62('0x6')]('crudPermissions')[_0xeb62('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index cafe474..022618b 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 _0x0e4f=['hasOwnProperty','nolimit','order','sort','where','filters','merge','map','type','VIRTUAL','filter','options','then','includeAll','include','findAll','show','params','create','body','catch','update','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','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','apply','reject','save','destroy','stack','name','send','index','UserProfileSection','rawAttributes','key','model','query','keys','intersection','fields','attributes','length'];(function(_0x57c108,_0xd03b1d){var _0x31077c=function(_0x39e8f2){while(--_0x39e8f2){_0x57c108['push'](_0x57c108['shift']());}};_0x31077c(++_0xd03b1d);}(_0x0e4f,0xb4));var _0xf0e4=function(_0x4a8647,_0x53db7e){_0x4a8647=_0x4a8647-0x0;var _0x3cdd66=_0x0e4f[_0x4a8647];return _0x3cdd66;};'use strict';var emlformat=require(_0xf0e4('0x0'));var rimraf=require(_0xf0e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf0e4('0x2'));var rp=require(_0xf0e4('0x3'));var moment=require(_0xf0e4('0x4'));var BPromise=require(_0xf0e4('0x5'));var Mustache=require(_0xf0e4('0x6'));var util=require(_0xf0e4('0x7'));var path=require(_0xf0e4('0x8'));var sox=require(_0xf0e4('0x9'));var csv=require(_0xf0e4('0xa'));var ejs=require(_0xf0e4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf0e4('0xc'));var squel=require(_0xf0e4('0xd'));var crypto=require(_0xf0e4('0xe'));var jsforce=require(_0xf0e4('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf0e4('0xa'));var querystring=require(_0xf0e4('0x10'));var Papa=require(_0xf0e4('0x11'));var Redis=require(_0xf0e4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf0e4('0x13'));var as=require(_0xf0e4('0x14'));var hardwareService=require(_0xf0e4('0x15'));var logger=require(_0xf0e4('0x16'))(_0xf0e4('0x17'));var utils=require(_0xf0e4('0x18'));var config=require(_0xf0e4('0x19'));var licenseUtil=require(_0xf0e4('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cbcd8,_0x27f724){_0x27f724=_0x27f724||0xcc;return function(_0x56896f){if(_0x56896f){return _0x5cbcd8[_0xf0e4('0x1b')](_0x27f724);}return _0x5cbcd8[_0xf0e4('0x1c')](_0x27f724)[_0xf0e4('0x1d')]();};}function respondWithResult(_0x352797,_0x3b9ea4){_0x3b9ea4=_0x3b9ea4||0xc8;return function(_0x20e010){if(_0x20e010){return _0x352797[_0xf0e4('0x1c')](_0x3b9ea4)[_0xf0e4('0x1e')](_0x20e010);}};}function respondWithFilteredResult(_0x2534d9,_0x250cad){return function(_0x1d2c11){if(_0x1d2c11){var _0x41a8e1=typeof _0x250cad[_0xf0e4('0x1f')]===_0xf0e4('0x20')&&typeof _0x250cad[_0xf0e4('0x21')]===_0xf0e4('0x20');var _0x2186d2=_0x1d2c11[_0xf0e4('0x22')];var _0x335b9a=_0x41a8e1?0x0:_0x250cad[_0xf0e4('0x1f')];var _0x44968d=_0x41a8e1?_0x1d2c11['count']:_0x250cad[_0xf0e4('0x1f')]+_0x250cad[_0xf0e4('0x21')];var _0x38bb67;if(_0x44968d>=_0x2186d2){_0x44968d=_0x2186d2;_0x38bb67=0xc8;}else{_0x38bb67=0xce;}_0x2534d9[_0xf0e4('0x1c')](_0x38bb67);return _0x2534d9[_0xf0e4('0x23')]('Content-Range',_0x335b9a+'-'+_0x44968d+'/'+_0x2186d2)[_0xf0e4('0x1e')](_0x1d2c11);}return null;};}function patchUpdates(_0x41f747){return function(_0x22e843){try{jsonpatch[_0xf0e4('0x24')](_0x22e843,_0x41f747,!![]);}catch(_0x206384){return BPromise[_0xf0e4('0x25')](_0x206384);}return _0x22e843[_0xf0e4('0x26')]();};}function saveUpdates(_0x2e4bfe,_0x27acd3){return function(_0x560779){if(_0x560779){return _0x560779['update'](_0x2e4bfe)['then'](function(_0x27c754){return _0x27c754;});}return null;};}function removeEntity(_0x592cc3,_0x563a12){return function(_0x1e35ac){if(_0x1e35ac){return _0x1e35ac[_0xf0e4('0x27')]()['then'](function(){_0x592cc3[_0xf0e4('0x1c')](0xcc)[_0xf0e4('0x1d')]();});}};}function handleEntityNotFound(_0x255e30,_0x2ef8bc){return function(_0x86a140){if(!_0x86a140){_0x255e30[_0xf0e4('0x1b')](0x194);}return _0x86a140;};}function handleError(_0x1c3367,_0x2c9291){_0x2c9291=_0x2c9291||0x1f4;return function(_0x432a90){logger['error'](_0x432a90[_0xf0e4('0x28')]);if(_0x432a90[_0xf0e4('0x29')]){delete _0x432a90[_0xf0e4('0x29')];}_0x1c3367[_0xf0e4('0x1c')](_0x2c9291)[_0xf0e4('0x2a')](_0x432a90);};}exports[_0xf0e4('0x2b')]=function(_0x3faf07,_0x56984f){var _0x2def0f={},_0x226960={},_0xa782be={'count':0x0,'rows':[]};var _0x46e75d=_['map'](db[_0xf0e4('0x2c')][_0xf0e4('0x2d')],function(_0x3885c1){return{'name':_0x3885c1['fieldName'],'type':_0x3885c1['type'][_0xf0e4('0x2e')]};});_0x226960[_0xf0e4('0x2f')]=_['map'](_0x46e75d,_0xf0e4('0x29'));_0x226960[_0xf0e4('0x30')]=_[_0xf0e4('0x31')](_0x3faf07[_0xf0e4('0x30')]);_0x226960['filters']=_[_0xf0e4('0x32')](_0x226960[_0xf0e4('0x2f')],_0x226960[_0xf0e4('0x30')]);_0x2def0f['attributes']=_['intersection'](_0x226960[_0xf0e4('0x2f')],qs[_0xf0e4('0x33')](_0x3faf07[_0xf0e4('0x30')][_0xf0e4('0x33')]));_0x2def0f['attributes']=_0x2def0f[_0xf0e4('0x34')][_0xf0e4('0x35')]?_0x2def0f[_0xf0e4('0x34')]:_0x226960[_0xf0e4('0x2f')];if(!_0x3faf07[_0xf0e4('0x30')][_0xf0e4('0x36')](_0xf0e4('0x37'))){_0x2def0f[_0xf0e4('0x21')]=qs[_0xf0e4('0x21')](_0x3faf07[_0xf0e4('0x30')][_0xf0e4('0x21')]);_0x2def0f[_0xf0e4('0x1f')]=qs[_0xf0e4('0x1f')](_0x3faf07[_0xf0e4('0x30')]['offset']);}_0x2def0f[_0xf0e4('0x38')]=qs['sort'](_0x3faf07[_0xf0e4('0x30')][_0xf0e4('0x39')]);_0x2def0f[_0xf0e4('0x3a')]=qs['filters'](_['pick'](_0x3faf07[_0xf0e4('0x30')],_0x226960[_0xf0e4('0x3b')]),_0x46e75d);if(_0x3faf07[_0xf0e4('0x30')]['filter']){_0x2def0f[_0xf0e4('0x3a')]=_[_0xf0e4('0x3c')](_0x2def0f['where'],{'$or':_[_0xf0e4('0x3d')](_0x46e75d,function(_0xcb7dcc){if(_0xcb7dcc[_0xf0e4('0x3e')]!==_0xf0e4('0x3f')){var _0x12a50c={};_0x12a50c[_0xcb7dcc[_0xf0e4('0x29')]]={'$like':'%'+_0x3faf07[_0xf0e4('0x30')][_0xf0e4('0x40')]+'%'};return _0x12a50c;}})});}_0x2def0f=_[_0xf0e4('0x3c')]({},_0x2def0f,_0x3faf07[_0xf0e4('0x41')]);var _0x4011ae={'where':_0x2def0f[_0xf0e4('0x3a')]};return db[_0xf0e4('0x2c')][_0xf0e4('0x22')](_0x4011ae)[_0xf0e4('0x42')](function(_0x1868ae){_0xa782be[_0xf0e4('0x22')]=_0x1868ae;if(_0x3faf07[_0xf0e4('0x30')][_0xf0e4('0x43')]){_0x2def0f[_0xf0e4('0x44')]=[{'all':!![]}];}return db['UserProfileSection'][_0xf0e4('0x45')](_0x2def0f);})[_0xf0e4('0x42')](function(_0x5b8906){_0xa782be['rows']=_0x5b8906;return _0xa782be;})[_0xf0e4('0x42')](respondWithFilteredResult(_0x56984f,_0x2def0f))['catch'](handleError(_0x56984f,null));};exports[_0xf0e4('0x46')]=function(_0x193d48,_0x364eda){var _0x3bd53a={'raw':![],'where':{'id':_0x193d48[_0xf0e4('0x47')]['id']}},_0x3aabf2={};_0x3aabf2[_0xf0e4('0x2f')]=_[_0xf0e4('0x31')](db[_0xf0e4('0x2c')][_0xf0e4('0x2d')]);_0x3aabf2[_0xf0e4('0x30')]=_[_0xf0e4('0x31')](_0x193d48[_0xf0e4('0x30')]);_0x3aabf2[_0xf0e4('0x3b')]=_[_0xf0e4('0x32')](_0x3aabf2[_0xf0e4('0x2f')],_0x3aabf2[_0xf0e4('0x30')]);_0x3bd53a[_0xf0e4('0x34')]=_[_0xf0e4('0x32')](_0x3aabf2[_0xf0e4('0x2f')],qs['fields'](_0x193d48[_0xf0e4('0x30')][_0xf0e4('0x33')]));_0x3bd53a['attributes']=_0x3bd53a[_0xf0e4('0x34')][_0xf0e4('0x35')]?_0x3bd53a[_0xf0e4('0x34')]:_0x3aabf2[_0xf0e4('0x2f')];if(_0x193d48[_0xf0e4('0x30')][_0xf0e4('0x43')]){_0x3bd53a[_0xf0e4('0x44')]=[{'all':!![]}];}_0x3bd53a=_['merge']({},_0x3bd53a,_0x193d48[_0xf0e4('0x41')]);return db[_0xf0e4('0x2c')]['find'](_0x3bd53a)[_0xf0e4('0x42')](handleEntityNotFound(_0x364eda,null))[_0xf0e4('0x42')](respondWithResult(_0x364eda,null))['catch'](handleError(_0x364eda,null));};exports[_0xf0e4('0x48')]=function(_0x546e12,_0x588ffe){return db[_0xf0e4('0x2c')][_0xf0e4('0x48')](_0x546e12[_0xf0e4('0x49')],{})['then'](respondWithResult(_0x588ffe,0xc9))[_0xf0e4('0x4a')](handleError(_0x588ffe,null));};exports[_0xf0e4('0x4b')]=function(_0x5f5874,_0x557eec){if(_0x5f5874[_0xf0e4('0x49')]['id']){delete _0x5f5874[_0xf0e4('0x49')]['id'];}return db[_0xf0e4('0x2c')][_0xf0e4('0x4c')]({'where':{'id':_0x5f5874[_0xf0e4('0x47')]['id']}})[_0xf0e4('0x42')](handleEntityNotFound(_0x557eec,null))[_0xf0e4('0x42')](saveUpdates(_0x5f5874['body'],null))[_0xf0e4('0x42')](respondWithResult(_0x557eec,null))['catch'](handleError(_0x557eec,null));};exports[_0xf0e4('0x27')]=function(_0x5df058,_0x37d560){return db['UserProfileSection'][_0xf0e4('0x4c')]({'where':{'id':_0x5df058[_0xf0e4('0x47')]['id']}})[_0xf0e4('0x42')](handleEntityNotFound(_0x37d560,null))[_0xf0e4('0x42')](removeEntity(_0x37d560,null))[_0xf0e4('0x4a')](handleError(_0x37d560,null));};exports[_0xf0e4('0x4d')]=function(_0x5c60f3,_0x31140d){return db[_0xf0e4('0x2c')][_0xf0e4('0x4d')]()[_0xf0e4('0x42')](respondWithResult(_0x31140d,null))['catch'](handleError(_0x31140d,null));}; \ No newline at end of file +var _0x1040=['send','index','UserProfileSection','fieldName','type','key','model','map','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','length','includeAll','find','body','describe','rimraf','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0x1925e5,_0x9ff010){var _0x585848=function(_0x38805a){while(--_0x38805a){_0x1925e5['push'](_0x1925e5['shift']());}};_0x585848(++_0x9ff010);}(_0x1040,0x6e));var _0x0104=function(_0x5f6a8a,_0x45f474){_0x5f6a8a=_0x5f6a8a-0x0;var _0x2cce4d=_0x1040[_0x5f6a8a];return _0x2cce4d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0104('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0104('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0104('0x2'));var util=require(_0x0104('0x3'));var path=require(_0x0104('0x4'));var sox=require(_0x0104('0x5'));var csv=require(_0x0104('0x6'));var ejs=require(_0x0104('0x7'));var fs=require('fs');var fs_extra=require(_0x0104('0x8'));var _=require(_0x0104('0x9'));var squel=require(_0x0104('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0104('0xb'));var toCsv=require(_0x0104('0x6'));var querystring=require(_0x0104('0xc'));var Papa=require(_0x0104('0xd'));var Redis=require(_0x0104('0xe'));var authService=require(_0x0104('0xf'));var qs=require(_0x0104('0x10'));var as=require(_0x0104('0x11'));var hardwareService=require(_0x0104('0x12'));var logger=require(_0x0104('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x0104('0x14'));var licenseUtil=require(_0x0104('0x15'));var db=require(_0x0104('0x16'))['db'];function respondWithStatusCode(_0x7dd661,_0x793138){_0x793138=_0x793138||0xcc;return function(_0x41ae33){if(_0x41ae33){return _0x7dd661[_0x0104('0x17')](_0x793138);}return _0x7dd661[_0x0104('0x18')](_0x793138)[_0x0104('0x19')]();};}function respondWithResult(_0x585176,_0x2285a6){_0x2285a6=_0x2285a6||0xc8;return function(_0x579144){if(_0x579144){return _0x585176['status'](_0x2285a6)[_0x0104('0x1a')](_0x579144);}};}function respondWithFilteredResult(_0x220e86,_0x499e79){return function(_0x1e942d){if(_0x1e942d){var _0x28242a=typeof _0x499e79[_0x0104('0x1b')]===_0x0104('0x1c')&&typeof _0x499e79[_0x0104('0x1d')]===_0x0104('0x1c');var _0x1a0b97=_0x1e942d['count'];var _0x11268c=_0x28242a?0x0:_0x499e79['offset'];var _0x5748d6=_0x28242a?_0x1e942d[_0x0104('0x1e')]:_0x499e79['offset']+_0x499e79['limit'];var _0x3852d3;if(_0x5748d6>=_0x1a0b97){_0x5748d6=_0x1a0b97;_0x3852d3=0xc8;}else{_0x3852d3=0xce;}_0x220e86[_0x0104('0x18')](_0x3852d3);return _0x220e86[_0x0104('0x1f')](_0x0104('0x20'),_0x11268c+'-'+_0x5748d6+'/'+_0x1a0b97)[_0x0104('0x1a')](_0x1e942d);}return null;};}function patchUpdates(_0x24cd2e){return function(_0x512f75){try{jsonpatch[_0x0104('0x21')](_0x512f75,_0x24cd2e,!![]);}catch(_0x717bba){return BPromise[_0x0104('0x22')](_0x717bba);}return _0x512f75[_0x0104('0x23')]();};}function saveUpdates(_0x13ffb7,_0x56987c){return function(_0x4a1172){if(_0x4a1172){return _0x4a1172[_0x0104('0x24')](_0x13ffb7)[_0x0104('0x25')](function(_0x528834){return _0x528834;});}return null;};}function removeEntity(_0x52f8cd,_0x4d6e6b){return function(_0x1ac5fc){if(_0x1ac5fc){return _0x1ac5fc[_0x0104('0x26')]()[_0x0104('0x25')](function(){_0x52f8cd[_0x0104('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b7a90,_0x9ad7e3){return function(_0x36011c){if(!_0x36011c){_0x4b7a90[_0x0104('0x17')](0x194);}return _0x36011c;};}function handleError(_0x59bc2a,_0x3f6630){_0x3f6630=_0x3f6630||0x1f4;return function(_0x8328b4){logger[_0x0104('0x27')](_0x8328b4[_0x0104('0x28')]);if(_0x8328b4[_0x0104('0x29')]){delete _0x8328b4['name'];}_0x59bc2a['status'](_0x3f6630)[_0x0104('0x2a')](_0x8328b4);};}exports[_0x0104('0x2b')]=function(_0x16cb23,_0x4747c4){var _0x57347b={},_0x42589b={},_0x1905d2={'count':0x0,'rows':[]};var _0x2af79f=_['map'](db[_0x0104('0x2c')]['rawAttributes'],function(_0x133a70){return{'name':_0x133a70[_0x0104('0x2d')],'type':_0x133a70[_0x0104('0x2e')][_0x0104('0x2f')]};});_0x42589b[_0x0104('0x30')]=_[_0x0104('0x31')](_0x2af79f,_0x0104('0x29'));_0x42589b[_0x0104('0x32')]=_['keys'](_0x16cb23[_0x0104('0x32')]);_0x42589b['filters']=_[_0x0104('0x33')](_0x42589b[_0x0104('0x30')],_0x42589b['query']);_0x57347b[_0x0104('0x34')]=_[_0x0104('0x33')](_0x42589b['model'],qs[_0x0104('0x35')](_0x16cb23[_0x0104('0x32')][_0x0104('0x35')]));_0x57347b[_0x0104('0x34')]=_0x57347b[_0x0104('0x34')]['length']?_0x57347b['attributes']:_0x42589b[_0x0104('0x30')];if(!_0x16cb23[_0x0104('0x32')]['hasOwnProperty'](_0x0104('0x36'))){_0x57347b['limit']=qs['limit'](_0x16cb23['query'][_0x0104('0x1d')]);_0x57347b['offset']=qs[_0x0104('0x1b')](_0x16cb23[_0x0104('0x32')][_0x0104('0x1b')]);}_0x57347b[_0x0104('0x37')]=qs[_0x0104('0x38')](_0x16cb23['query'][_0x0104('0x38')]);_0x57347b[_0x0104('0x39')]=qs[_0x0104('0x3a')](_[_0x0104('0x3b')](_0x16cb23['query'],_0x42589b[_0x0104('0x3a')]),_0x2af79f);if(_0x16cb23[_0x0104('0x32')][_0x0104('0x3c')]){_0x57347b[_0x0104('0x39')]=_[_0x0104('0x3d')](_0x57347b[_0x0104('0x39')],{'$or':_[_0x0104('0x31')](_0x2af79f,function(_0x2dd2c0){if(_0x2dd2c0[_0x0104('0x2e')]!==_0x0104('0x3e')){var _0x48137c={};_0x48137c[_0x2dd2c0[_0x0104('0x29')]]={'$like':'%'+_0x16cb23[_0x0104('0x32')][_0x0104('0x3c')]+'%'};return _0x48137c;}})});}_0x57347b=_[_0x0104('0x3d')]({},_0x57347b,_0x16cb23[_0x0104('0x3f')]);var _0xce2233={'where':_0x57347b['where']};return db[_0x0104('0x2c')][_0x0104('0x1e')](_0xce2233)[_0x0104('0x25')](function(_0x12e525){_0x1905d2['count']=_0x12e525;if(_0x16cb23[_0x0104('0x32')]['includeAll']){_0x57347b[_0x0104('0x40')]=[{'all':!![]}];}return db[_0x0104('0x2c')][_0x0104('0x41')](_0x57347b);})['then'](function(_0x4fe1db){_0x1905d2[_0x0104('0x42')]=_0x4fe1db;return _0x1905d2;})[_0x0104('0x25')](respondWithFilteredResult(_0x4747c4,_0x57347b))[_0x0104('0x43')](handleError(_0x4747c4,null));};exports[_0x0104('0x44')]=function(_0x2af53f,_0x291fef){var _0x20e257={'raw':![],'where':{'id':_0x2af53f[_0x0104('0x45')]['id']}},_0x34a000={};_0x34a000['model']=_[_0x0104('0x46')](db[_0x0104('0x2c')]['rawAttributes']);_0x34a000[_0x0104('0x32')]=_[_0x0104('0x46')](_0x2af53f[_0x0104('0x32')]);_0x34a000[_0x0104('0x3a')]=_['intersection'](_0x34a000['model'],_0x34a000[_0x0104('0x32')]);_0x20e257[_0x0104('0x34')]=_[_0x0104('0x33')](_0x34a000[_0x0104('0x30')],qs[_0x0104('0x35')](_0x2af53f[_0x0104('0x32')]['fields']));_0x20e257[_0x0104('0x34')]=_0x20e257[_0x0104('0x34')][_0x0104('0x47')]?_0x20e257[_0x0104('0x34')]:_0x34a000[_0x0104('0x30')];if(_0x2af53f[_0x0104('0x32')][_0x0104('0x48')]){_0x20e257[_0x0104('0x40')]=[{'all':!![]}];}_0x20e257=_[_0x0104('0x3d')]({},_0x20e257,_0x2af53f[_0x0104('0x3f')]);return db[_0x0104('0x2c')][_0x0104('0x49')](_0x20e257)[_0x0104('0x25')](handleEntityNotFound(_0x291fef,null))[_0x0104('0x25')](respondWithResult(_0x291fef,null))['catch'](handleError(_0x291fef,null));};exports['create']=function(_0x2100e3,_0x517396){return db['UserProfileSection']['create'](_0x2100e3['body'],{})[_0x0104('0x25')](respondWithResult(_0x517396,0xc9))[_0x0104('0x43')](handleError(_0x517396,null));};exports[_0x0104('0x24')]=function(_0x22a273,_0x40b642){if(_0x22a273[_0x0104('0x4a')]['id']){delete _0x22a273[_0x0104('0x4a')]['id'];}return db[_0x0104('0x2c')][_0x0104('0x49')]({'where':{'id':_0x22a273[_0x0104('0x45')]['id']}})['then'](handleEntityNotFound(_0x40b642,null))[_0x0104('0x25')](saveUpdates(_0x22a273['body'],null))[_0x0104('0x25')](respondWithResult(_0x40b642,null))['catch'](handleError(_0x40b642,null));};exports['destroy']=function(_0x38eeb8,_0x1e5f9a){return db[_0x0104('0x2c')][_0x0104('0x49')]({'where':{'id':_0x38eeb8[_0x0104('0x45')]['id']}})[_0x0104('0x25')](handleEntityNotFound(_0x1e5f9a,null))[_0x0104('0x25')](removeEntity(_0x1e5f9a,null))['catch'](handleError(_0x1e5f9a,null));};exports[_0x0104('0x4b')]=function(_0x514454,_0x395757){return db[_0x0104('0x2c')][_0x0104('0x4b')]()[_0x0104('0x25')](respondWithResult(_0x395757,null))[_0x0104('0x43')](handleError(_0x395757,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index a87e5f4..a3256fb 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 _0x8dbf=['UserProfileSection','compositeIndex','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','define'];(function(_0x58c277,_0x3ba9e1){var _0x3768b8=function(_0x466fa4){while(--_0x466fa4){_0x58c277['push'](_0x58c277['shift']());}};_0x3768b8(++_0x3ba9e1);}(_0x8dbf,0x14d));var _0xf8db=function(_0x30108e,_0x4a8406){_0x30108e=_0x30108e-0x0;var _0xe16f6=_0x8dbf[_0x30108e];return _0xe16f6;};'use strict';var _=require(_0xf8db('0x0'));var util=require(_0xf8db('0x1'));var logger=require(_0xf8db('0x2'))(_0xf8db('0x3'));var moment=require(_0xf8db('0x4'));var BPromise=require(_0xf8db('0x5'));var rp=require(_0xf8db('0x6'));var fs=require('fs');var path=require(_0xf8db('0x7'));var rimraf=require(_0xf8db('0x8'));var config=require(_0xf8db('0x9'));var attributes=require(_0xf8db('0xa'));module['exports']=function(_0x5d65a6,_0x2dbdb2){return _0x5d65a6[_0xf8db('0xb')](_0xf8db('0xc'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xf8db('0xd'),'fields':[_0xf8db('0xe'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3fc8=['util','../../config/logger','request-promise','rimraf','../../config/environment','exports','define','UserProfileSection','compositeIndex','userProfileId','lodash'];(function(_0x1af748,_0x57b69c){var _0x115fbe=function(_0x26ba7d){while(--_0x26ba7d){_0x1af748['push'](_0x1af748['shift']());}};_0x115fbe(++_0x57b69c);}(_0x3fc8,0x128));var _0x83fc=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x3fc8[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x83fc('0x0'));var util=require(_0x83fc('0x1'));var logger=require(_0x83fc('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x83fc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x83fc('0x4'));var config=require(_0x83fc('0x5'));var attributes=require('./userProfileSection.attributes');module[_0x83fc('0x6')]=function(_0xc8a2a8,_0x47e2c0){return _0xc8a2a8[_0x83fc('0x7')](_0x83fc('0x8'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x83fc('0x9'),'fields':['sectionId',_0x83fc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index b771265..092a013 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 _0xe5c9=['then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x3cb161,_0x58bf18){var _0x2a5c41=function(_0x1a0851){while(--_0x1a0851){_0x3cb161['push'](_0x3cb161['shift']());}};_0x2a5c41(++_0x58bf18);}(_0xe5c9,0x1a8));var _0x9e5c=function(_0x57c4bc,_0x452b16){_0x57c4bc=_0x57c4bc-0x0;var _0x5bddfc=_0xe5c9[_0x57c4bc];return _0x5bddfc;};'use strict';var _=require(_0x9e5c('0x0'));var util=require('util');var moment=require(_0x9e5c('0x1'));var BPromise=require(_0x9e5c('0x2'));var rs=require(_0x9e5c('0x3'));var fs=require('fs');var Redis=require(_0x9e5c('0x4'));var db=require(_0x9e5c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9e5c('0x6'))(_0x9e5c('0x7'));var config=require(_0x9e5c('0x8'));var jayson=require(_0x9e5c('0x9'));var client=jayson[_0x9e5c('0xa')][_0x9e5c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf71f80,_0x86fa09,_0x4cd837){return new BPromise(function(_0x1b407b,_0x5e7543){return client[_0x9e5c('0xc')](_0xf71f80,_0x4cd837)[_0x9e5c('0xd')](function(_0x3f754a){logger[_0x9e5c('0xe')](_0x9e5c('0xf'),_0x86fa09,_0x9e5c('0x10'));logger['debug'](_0x9e5c('0x11'),_0x86fa09,_0x9e5c('0x10'),JSON[_0x9e5c('0x12')](_0x3f754a));if(_0x3f754a[_0x9e5c('0x13')]){if(_0x3f754a[_0x9e5c('0x13')][_0x9e5c('0x14')]===0x1f4){logger[_0x9e5c('0x13')](_0x9e5c('0xf'),_0x86fa09,_0x3f754a[_0x9e5c('0x13')][_0x9e5c('0x15')]);return _0x5e7543(_0x3f754a[_0x9e5c('0x13')][_0x9e5c('0x15')]);}logger[_0x9e5c('0x13')](_0x9e5c('0xf'),_0x86fa09,_0x3f754a[_0x9e5c('0x13')][_0x9e5c('0x15')]);return _0x1b407b(_0x3f754a[_0x9e5c('0x13')][_0x9e5c('0x15')]);}else{logger['info'](_0x9e5c('0xf'),_0x86fa09,_0x9e5c('0x10'));_0x1b407b(_0x3f754a[_0x9e5c('0x16')]['message']);}})['catch'](function(_0x13cad8){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x86fa09,_0x13cad8);_0x5e7543(_0x13cad8);});});} \ No newline at end of file +var _0x46b7=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment'];(function(_0x455555,_0x2147fd){var _0x3cb183=function(_0x516a72){while(--_0x516a72){_0x455555['push'](_0x455555['shift']());}};_0x3cb183(++_0x2147fd);}(_0x46b7,0xc5));var _0x746b=function(_0x3cdb8c,_0x53f35a){_0x3cdb8c=_0x3cdb8c-0x0;var _0x2ea14a=_0x46b7[_0x3cdb8c];return _0x2ea14a;};'use strict';var _=require(_0x746b('0x0'));var util=require(_0x746b('0x1'));var moment=require(_0x746b('0x2'));var BPromise=require(_0x746b('0x3'));var rs=require(_0x746b('0x4'));var fs=require('fs');var Redis=require(_0x746b('0x5'));var db=require(_0x746b('0x6'))['db'];var utils=require(_0x746b('0x7'));var logger=require(_0x746b('0x8'))(_0x746b('0x9'));var config=require(_0x746b('0xa'));var jayson=require(_0x746b('0xb'));var client=jayson[_0x746b('0xc')][_0x746b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x380317,_0x4a33dd,_0x1f8c1f){return new BPromise(function(_0x15b2ad,_0xcc9ae5){return client[_0x746b('0xe')](_0x380317,_0x1f8c1f)[_0x746b('0xf')](function(_0x4bafd3){logger[_0x746b('0x10')](_0x746b('0x11'),_0x4a33dd,'request\x20sent');logger[_0x746b('0x12')](_0x746b('0x13'),_0x4a33dd,_0x746b('0x14'),JSON[_0x746b('0x15')](_0x4bafd3));if(_0x4bafd3[_0x746b('0x16')]){if(_0x4bafd3[_0x746b('0x16')]['code']===0x1f4){logger[_0x746b('0x16')](_0x746b('0x11'),_0x4a33dd,_0x4bafd3[_0x746b('0x16')]['message']);return _0xcc9ae5(_0x4bafd3[_0x746b('0x16')][_0x746b('0x17')]);}logger[_0x746b('0x16')](_0x746b('0x11'),_0x4a33dd,_0x4bafd3[_0x746b('0x16')]['message']);return _0x15b2ad(_0x4bafd3['error'][_0x746b('0x17')]);}else{logger[_0x746b('0x10')](_0x746b('0x11'),_0x4a33dd,_0x746b('0x14'));_0x15b2ad(_0x4bafd3[_0x746b('0x18')][_0x746b('0x17')]);}})['catch'](function(_0x133791){logger[_0x746b('0x16')](_0x746b('0x11'),_0x4a33dd,_0x133791);_0xcc9ae5(_0x133791);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index e4ae1a9..7d5a9bb 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3d91fd,_0x3a768b){var _0x137a3a=function(_0x19f617){while(--_0x19f617){_0x3d91fd['push'](_0x3d91fd['shift']());}};_0x137a3a(++_0x3a768b);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2e88ab,_0xca98b5){var _0x238c6b=function(_0x1a52c8){while(--_0x1a52c8){_0x2e88ab['push'](_0x2e88ab['shift']());}};_0x238c6b(++_0xca98b5);}(_0xe706,0xa3));var _0x6e70=function(_0x32e264,_0x41cee8){_0x32e264=_0x32e264-0x0;var _0x1d7175=_0xe706[_0x32e264];return _0x1d7175;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 0a5a75d..d68dba5 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 _0xc009=['INTEGER','sequelize','exports'];(function(_0xe9d0da,_0x4f3577){var _0x1bf08c=function(_0x386ede){while(--_0x386ede){_0xe9d0da['push'](_0xe9d0da['shift']());}};_0x1bf08c(++_0x4f3577);}(_0xc009,0x1de));var _0x9c00=function(_0x391674,_0x7ed97b){_0x391674=_0x391674-0x0;var _0x306b2a=_0xc009[_0x391674];return _0x306b2a;};'use strict';var Sequelize=require(_0x9c00('0x0'));module[_0x9c00('0x1')]={'penalty':{'type':Sequelize[_0x9c00('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbe36=['INTEGER','exports'];(function(_0x4feefd,_0x24a1ad){var _0x560053=function(_0x2cee9d){while(--_0x2cee9d){_0x4feefd['push'](_0x4feefd['shift']());}};_0x560053(++_0x24a1ad);}(_0xbe36,0xd7));var _0x6be3=function(_0x19c262,_0x5f1cb0){_0x19c262=_0x19c262-0x0;var _0xfc5def=_0xbe36[_0x19c262];return _0xfc5def;};'use strict';var Sequelize=require('sequelize');module[_0x6be3('0x0')]={'penalty':{'type':Sequelize[_0x6be3('0x1')],'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 acb55ef..cff42e4 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 _0x2b29=['path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','moment','request-promise'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x2b29,0x163));var _0x92b2=function(_0x1ac129,_0x1759c8){_0x1ac129=_0x1ac129-0x0;var _0xd407ca=_0x2b29[_0x1ac129];return _0xd407ca;};'use strict';var _=require('lodash');var util=require(_0x92b2('0x0'));var logger=require(_0x92b2('0x1'))(_0x92b2('0x2'));var moment=require(_0x92b2('0x3'));var BPromise=require('bluebird');var rp=require(_0x92b2('0x4'));var fs=require('fs');var path=require(_0x92b2('0x5'));var rimraf=require(_0x92b2('0x6'));var config=require(_0x92b2('0x7'));var attributes=require(_0x92b2('0x8'));module[_0x92b2('0x9')]=function(_0x47c522,_0xb1d856){return _0x47c522['define'](_0x92b2('0xa'),attributes,{'tableName':_0x92b2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5af=['exports','UserSmsQueue','user_has_sms_queues','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x53084c,_0x4a10a7){var _0x3725c5=function(_0x2d650c){while(--_0x2d650c){_0x53084c['push'](_0x53084c['shift']());}};_0x3725c5(++_0x4a10a7);}(_0xe5af,0x9c));var _0xfe5a=function(_0x56ec4b,_0x110a5a){_0x56ec4b=_0x56ec4b-0x0;var _0x45ea8c=_0xe5af[_0x56ec4b];return _0x45ea8c;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var logger=require(_0xfe5a('0x1'))('api');var moment=require(_0xfe5a('0x2'));var BPromise=require(_0xfe5a('0x3'));var rp=require(_0xfe5a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe5a('0x5'));var config=require('../../config/environment');var attributes=require('./userSmsQueue.attributes');module[_0xfe5a('0x6')]=function(_0x2039cd,_0x4e418f){return _0x2039cd['define'](_0xfe5a('0x7'),attributes,{'tableName':_0xfe5a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 5991a3f..6e9ba56 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 _0x6828=['client','http','request','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x505336,_0x3708dd){var _0x8a93fe=function(_0x1071f4){while(--_0x1071f4){_0x505336['push'](_0x505336['shift']());}};_0x8a93fe(++_0x3708dd);}(_0x6828,0x80));var _0x8682=function(_0x54be5b,_0x1d8b65){_0x54be5b=_0x54be5b-0x0;var _0x1ffcca=_0x6828[_0x54be5b];return _0x1ffcca;};'use strict';var _=require('lodash');var util=require(_0x8682('0x0'));var moment=require(_0x8682('0x1'));var BPromise=require(_0x8682('0x2'));var rs=require(_0x8682('0x3'));var fs=require('fs');var Redis=require(_0x8682('0x4'));var db=require(_0x8682('0x5'))['db'];var utils=require(_0x8682('0x6'));var logger=require(_0x8682('0x7'))(_0x8682('0x8'));var config=require(_0x8682('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8682('0xa')][_0x8682('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x204366,_0xf2d9ad,_0x1b9b5f){return new BPromise(function(_0xca173b,_0x39aa89){return client[_0x8682('0xc')](_0x204366,_0x1b9b5f)['then'](function(_0x5ce01e){logger['info'](_0x8682('0xd'),_0xf2d9ad,_0x8682('0xe'));logger[_0x8682('0xf')](_0x8682('0x10'),_0xf2d9ad,'request\x20sent',JSON[_0x8682('0x11')](_0x5ce01e));if(_0x5ce01e['error']){if(_0x5ce01e[_0x8682('0x12')][_0x8682('0x13')]===0x1f4){logger[_0x8682('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0xf2d9ad,_0x5ce01e[_0x8682('0x12')][_0x8682('0x14')]);return _0x39aa89(_0x5ce01e['error'][_0x8682('0x14')]);}logger[_0x8682('0x12')](_0x8682('0xd'),_0xf2d9ad,_0x5ce01e[_0x8682('0x12')]['message']);return _0xca173b(_0x5ce01e['error'][_0x8682('0x14')]);}else{logger[_0x8682('0x15')](_0x8682('0xd'),_0xf2d9ad,'request\x20sent');_0xca173b(_0x5ce01e['result'][_0x8682('0x14')]);}})[_0x8682('0x16')](function(_0x34dbcc){logger['error'](_0x8682('0xd'),_0xf2d9ad,_0x34dbcc);_0x39aa89(_0x34dbcc);});});} \ No newline at end of file +var _0x682f=['rpc','../../config/environment','client','http','request','info','debug','request\x20sent','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4c5564,_0x59f4c7){var _0x55b8de=function(_0x192dd7){while(--_0x192dd7){_0x4c5564['push'](_0x4c5564['shift']());}};_0x55b8de(++_0x59f4c7);}(_0x682f,0x19c));var _0xf682=function(_0x5f165e,_0x3fbad3){_0x5f165e=_0x5f165e-0x0;var _0x328662=_0x682f[_0x5f165e];return _0x328662;};'use strict';var _=require(_0xf682('0x0'));var util=require('util');var moment=require(_0xf682('0x1'));var BPromise=require(_0xf682('0x2'));var rs=require(_0xf682('0x3'));var fs=require('fs');var Redis=require(_0xf682('0x4'));var db=require(_0xf682('0x5'))['db'];var utils=require(_0xf682('0x6'));var logger=require(_0xf682('0x7'))(_0xf682('0x8'));var config=require(_0xf682('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf682('0xa')][_0xf682('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39049b,_0x10eca3,_0x47b3d2){return new BPromise(function(_0x247e7d,_0x5cd6eb){return client[_0xf682('0xc')](_0x39049b,_0x47b3d2)['then'](function(_0x494339){logger[_0xf682('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x10eca3,'request\x20sent');logger[_0xf682('0xe')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x10eca3,_0xf682('0xf'),JSON['stringify'](_0x494339));if(_0x494339[_0xf682('0x10')]){if(_0x494339[_0xf682('0x10')][_0xf682('0x11')]===0x1f4){logger[_0xf682('0x10')](_0xf682('0x12'),_0x10eca3,_0x494339['error']['message']);return _0x5cd6eb(_0x494339[_0xf682('0x10')][_0xf682('0x13')]);}logger[_0xf682('0x10')](_0xf682('0x12'),_0x10eca3,_0x494339[_0xf682('0x10')][_0xf682('0x13')]);return _0x247e7d(_0x494339[_0xf682('0x10')][_0xf682('0x13')]);}else{logger[_0xf682('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x10eca3,_0xf682('0xf'));_0x247e7d(_0x494339[_0xf682('0x14')][_0xf682('0x13')]);}})['catch'](function(_0x4a784e){logger[_0xf682('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x10eca3,_0x4a784e);_0x5cd6eb(_0x4a784e);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 01f2db1..5d18ddd 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 _0x662e=['sequelize','exports'];(function(_0x389508,_0x1cb838){var _0x1bbc6a=function(_0x2d4fd5){while(--_0x2d4fd5){_0x389508['push'](_0x389508['shift']());}};_0x1bbc6a(++_0x1cb838);}(_0x662e,0x10c));var _0xe662=function(_0x424974,_0x492bff){_0x424974=_0x424974-0x0;var _0x116a91=_0x662e[_0x424974];return _0x116a91;};'use strict';var Sequelize=require(_0xe662('0x0'));module[_0xe662('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xa04c=['INTEGER','exports'];(function(_0x4a6362,_0x9e782a){var _0x2653a5=function(_0x52b12b){while(--_0x52b12b){_0x4a6362['push'](_0x4a6362['shift']());}};_0x2653a5(++_0x9e782a);}(_0xa04c,0x83));var _0xca04=function(_0x48ea0d,_0x1fac7d){_0x48ea0d=_0x48ea0d-0x0;var _0x43f2af=_0xa04c[_0x48ea0d];return _0x43f2af;};'use strict';var Sequelize=require('sequelize');module[_0xca04('0x0')]={'UserId':{'type':Sequelize[_0xca04('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xca04('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 292762e..f2ce2a0 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(_0x4e4271,_0x4e40dc){var _0x2cd230=function(_0x33d68b){while(--_0x33d68b){_0x4e4271['push'](_0x4e4271['shift']());}};_0x2cd230(++_0x4e40dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x44144b,_0x46eef0){var _0x244e3b=function(_0x2b7612){while(--_0x2b7612){_0x44144b['push'](_0x44144b['shift']());}};_0x244e3b(++_0x46eef0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 dc7f459..f1013ce 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x9388c8,_0x2cdf84){var _0x6f1d3a=function(_0x6a3073){while(--_0x6a3073){_0x9388c8['push'](_0x9388c8['shift']());}};_0x6f1d3a(++_0x2cdf84);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'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(_0x3c23b5,_0x26a327){var _0x3ad3bc=function(_0x343935){while(--_0x343935){_0x3c23b5['push'](_0x3c23b5['shift']());}};_0x3ad3bc(++_0x26a327);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 3de7927..ff0bdbe 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 _0x8178=['exports','sequelize'];(function(_0xa49ed9,_0x2b0c0a){var _0x36f4b8=function(_0x31282c){while(--_0x31282c){_0xa49ed9['push'](_0xa49ed9['shift']());}};_0x36f4b8(++_0x2b0c0a);}(_0x8178,0x8f));var _0x8817=function(_0x46c30c,_0x42422f){_0x46c30c=_0x46c30c-0x0;var _0x44198e=_0x8178[_0x46c30c];return _0x44198e;};'use strict';var Sequelize=require(_0x8817('0x0'));module[_0x8817('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbf4e=['INTEGER','sequelize','exports'];(function(_0x2fe689,_0x5794e5){var _0x35ea44=function(_0x51b9d6){while(--_0x51b9d6){_0x2fe689['push'](_0x2fe689['shift']());}};_0x35ea44(++_0x5794e5);}(_0xbf4e,0x172));var _0xebf4=function(_0x464386,_0xac72fe){_0x464386=_0x464386-0x0;var _0x4c2c06=_0xbf4e[_0x464386];return _0x4c2c06;};'use strict';var Sequelize=require(_0xebf4('0x0'));module[_0xebf4('0x1')]={'penalty':{'type':Sequelize[_0xebf4('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index c4ed284..5443ae4 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 _0x08ab=['path','rimraf','../../config/environment','./userVoiceQueue.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x08ab,0xf5));var _0xb08a=function(_0x14cc32,_0x5d4d31){_0x14cc32=_0x14cc32-0x0;var _0x1759f0=_0x08ab[_0x14cc32];return _0x1759f0;};'use strict';var _=require(_0xb08a('0x0'));var util=require(_0xb08a('0x1'));var logger=require(_0xb08a('0x2'))(_0xb08a('0x3'));var moment=require(_0xb08a('0x4'));var BPromise=require(_0xb08a('0x5'));var rp=require(_0xb08a('0x6'));var fs=require('fs');var path=require(_0xb08a('0x7'));var rimraf=require(_0xb08a('0x8'));var config=require(_0xb08a('0x9'));var attributes=require(_0xb08a('0xa'));module['exports']=function(_0x33a58b,_0x32cee4){return _0x33a58b[_0xb08a('0xb')]('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x294e=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserVoiceQueue','lodash','util','../../config/logger','api','moment'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0x294e,0x1a8));var _0xe294=function(_0x1b60a6,_0x40598f){_0x1b60a6=_0x1b60a6-0x0;var _0x43d3b7=_0x294e[_0x1b60a6];return _0x43d3b7;};'use strict';var _=require(_0xe294('0x0'));var util=require(_0xe294('0x1'));var logger=require(_0xe294('0x2'))(_0xe294('0x3'));var moment=require(_0xe294('0x4'));var BPromise=require(_0xe294('0x5'));var rp=require(_0xe294('0x6'));var fs=require('fs');var path=require(_0xe294('0x7'));var rimraf=require(_0xe294('0x8'));var config=require(_0xe294('0x9'));var attributes=require('./userVoiceQueue.attributes');module[_0xe294('0xa')]=function(_0x2b9ed5,_0x26ea74){return _0x2b9ed5[_0xe294('0xb')](_0xe294('0xc'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 4873fa3..a7b1130 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 _0x7539=['error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x7539,0x180));var _0x9753=function(_0x2f1677,_0x668f){_0x2f1677=_0x2f1677-0x0;var _0x359eff=_0x7539[_0x2f1677];return _0x359eff;};'use strict';var _=require(_0x9753('0x0'));var util=require('util');var moment=require(_0x9753('0x1'));var BPromise=require(_0x9753('0x2'));var rs=require(_0x9753('0x3'));var fs=require('fs');var Redis=require(_0x9753('0x4'));var db=require(_0x9753('0x5'))['db'];var utils=require(_0x9753('0x6'));var logger=require(_0x9753('0x7'))(_0x9753('0x8'));var config=require('../../config/environment');var jayson=require(_0x9753('0x9'));var client=jayson['client'][_0x9753('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7c222b,_0x1fc161,_0x47bde2){return new BPromise(function(_0x3b26f8,_0x22adb0){return client[_0x9753('0xb')](_0x7c222b,_0x47bde2)['then'](function(_0x4744f6){logger[_0x9753('0xc')](_0x9753('0xd'),_0x1fc161,_0x9753('0xe'));logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x1fc161,_0x9753('0xe'),JSON['stringify'](_0x4744f6));if(_0x4744f6[_0x9753('0xf')]){if(_0x4744f6[_0x9753('0xf')][_0x9753('0x10')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x1fc161,_0x4744f6['error'][_0x9753('0x11')]);return _0x22adb0(_0x4744f6['error'][_0x9753('0x11')]);}logger[_0x9753('0xf')](_0x9753('0xd'),_0x1fc161,_0x4744f6[_0x9753('0xf')][_0x9753('0x11')]);return _0x3b26f8(_0x4744f6[_0x9753('0xf')][_0x9753('0x11')]);}else{logger[_0x9753('0xc')](_0x9753('0xd'),_0x1fc161,_0x9753('0xe'));_0x3b26f8(_0x4744f6['result'][_0x9753('0x11')]);}})[_0x9753('0x12')](function(_0x30baa0){logger['error'](_0x9753('0xd'),_0x1fc161,_0x30baa0);_0x22adb0(_0x30baa0);});});} \ No newline at end of file +var _0xdcf9=['../../config/logger','jayson/promise','client','http','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','../../config/utils'];(function(_0x10c16d,_0x2b3e14){var _0x5896f4=function(_0x4306b9){while(--_0x4306b9){_0x10c16d['push'](_0x10c16d['shift']());}};_0x5896f4(++_0x2b3e14);}(_0xdcf9,0x150));var _0x9dcf=function(_0x521adf,_0x1bd4c1){_0x521adf=_0x521adf-0x0;var _0x462ae6=_0xdcf9[_0x521adf];return _0x462ae6;};'use strict';var _=require(_0x9dcf('0x0'));var util=require('util');var moment=require(_0x9dcf('0x1'));var BPromise=require(_0x9dcf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9dcf('0x3'));var logger=require(_0x9dcf('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9dcf('0x5'));var client=jayson[_0x9dcf('0x6')][_0x9dcf('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4bf449,_0xe7e8a6,_0x2899f8){return new BPromise(function(_0x4247de,_0x54b27b){return client[_0x9dcf('0x8')](_0x4bf449,_0x2899f8)['then'](function(_0x5c32c3){logger[_0x9dcf('0x9')](_0x9dcf('0xa'),_0xe7e8a6,_0x9dcf('0xb'));logger[_0x9dcf('0xc')](_0x9dcf('0xd'),_0xe7e8a6,_0x9dcf('0xb'),JSON[_0x9dcf('0xe')](_0x5c32c3));if(_0x5c32c3[_0x9dcf('0xf')]){if(_0x5c32c3[_0x9dcf('0xf')][_0x9dcf('0x10')]===0x1f4){logger[_0x9dcf('0xf')](_0x9dcf('0xa'),_0xe7e8a6,_0x5c32c3[_0x9dcf('0xf')][_0x9dcf('0x11')]);return _0x54b27b(_0x5c32c3[_0x9dcf('0xf')][_0x9dcf('0x11')]);}logger['error'](_0x9dcf('0xa'),_0xe7e8a6,_0x5c32c3[_0x9dcf('0xf')][_0x9dcf('0x11')]);return _0x4247de(_0x5c32c3[_0x9dcf('0xf')]['message']);}else{logger[_0x9dcf('0x9')](_0x9dcf('0xa'),_0xe7e8a6,'request\x20sent');_0x4247de(_0x5c32c3[_0x9dcf('0x12')][_0x9dcf('0x11')]);}})[_0x9dcf('0x13')](function(_0x57d28f){logger[_0x9dcf('0xf')](_0x9dcf('0xa'),_0xe7e8a6,_0x57d28f);_0x54b27b(_0x57d28f);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index c94eb77..5e69ab1 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x269c23,_0x289264){var _0x184ecd=function(_0x32756b){while(--_0x32756b){_0x269c23['push'](_0x269c23['shift']());}};_0x184ecd(++_0x289264);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3da9d9,_0x38ddeb){var _0x6c09c0=function(_0xf26f9){while(--_0xf26f9){_0x3da9d9['push'](_0x3da9d9['shift']());}};_0x6c09c0(++_0x38ddeb);}(_0xe706,0xa3));var _0x6e70=function(_0xbae21b,_0x449cfb){_0xbae21b=_0xbae21b-0x0;var _0x10f16f=_0xe706[_0xbae21b];return _0x10f16f;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 7a0131b..a19affd 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 _0x5c0e=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5c0e,0x160));var _0xe5c0=function(_0x2d7a4b,_0xa36b04){_0x2d7a4b=_0x2d7a4b-0x0;var _0x603707=_0x5c0e[_0x2d7a4b];return _0x603707;};'use strict';var Sequelize=require(_0xe5c0('0x0'));module[_0xe5c0('0x1')]={'uniqueid':{'type':Sequelize[_0xe5c0('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xe5c0('0x3')},'membername':{'type':Sequelize[_0xe5c0('0x4')],'allowNull':![],'comment':_0xe5c0('0x3')},'UserId':{'type':Sequelize[_0xe5c0('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe5c0('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xe5c0('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xe5c0('0x4')],'allowNull':![],'unique':_0xe5c0('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xe5c0('0x2')](0xb),'defaultValue':0x0,'comment':_0xe5c0('0x3')},'paused':{'type':Sequelize[_0xe5c0('0x2')](0xb),'defaultValue':0x0,'comment':_0xe5c0('0x3')}}; \ No newline at end of file +var _0x3b34=['exports','INTEGER','STRING','queue_interface','Required\x20by\x20Asterisk','sequelize'];(function(_0x341738,_0x39e2e0){var _0x523cd5=function(_0x1bb1fd){while(--_0x1bb1fd){_0x341738['push'](_0x341738['shift']());}};_0x523cd5(++_0x39e2e0);}(_0x3b34,0xe3));var _0x43b3=function(_0xe628c,_0x378190){_0xe628c=_0xe628c-0x0;var _0x132149=_0x3b34[_0xe628c];return _0x132149;};'use strict';var Sequelize=require(_0x43b3('0x0'));module[_0x43b3('0x1')]={'uniqueid':{'type':Sequelize[_0x43b3('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x43b3('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x43b3('0x3')],'allowNull':![],'unique':_0x43b3('0x4'),'comment':_0x43b3('0x5')},'VoiceQueueId':{'type':Sequelize[_0x43b3('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x43b3('0x3')],'allowNull':![],'unique':_0x43b3('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x43b3('0x2')](0xb),'defaultValue':0x0,'comment':_0x43b3('0x5')},'paused':{'type':Sequelize[_0x43b3('0x2')](0xb),'defaultValue':0x0,'comment':_0x43b3('0x5')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 1d8f008..17a52a4 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 _0x20fe=['UserVoiceQueueRt','setMaxListeners','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x4e657a,_0x4d0027){var _0x229cbc=function(_0x23e6b6){while(--_0x23e6b6){_0x4e657a['push'](_0x4e657a['shift']());}};_0x229cbc(++_0x4d0027);}(_0x20fe,0x66));var _0xe20f=function(_0x560dd8,_0x44c7a6){_0x560dd8=_0x560dd8-0x0;var _0xc13db=_0x20fe[_0x560dd8];return _0xc13db;};'use strict';var EventEmitter=require(_0xe20f('0x0'));var UserVoiceQueueRt=require(_0xe20f('0x1'))['db'][_0xe20f('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xe20f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe20f('0x4'),'afterDestroy':_0xe20f('0x5')};function emitEvent(_0x1c3d5e){return function(_0x3c1a26,_0x4a1f20,_0x3cde2c){UserVoiceQueueRtEvents[_0xe20f('0x6')](_0x1c3d5e+':'+_0x3c1a26['id'],_0x3c1a26);UserVoiceQueueRtEvents['emit'](_0x1c3d5e,_0x3c1a26);_0x3cde2c(null);};}for(var e in events){if(events[_0xe20f('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x049c=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x339eb0,_0x517573){var _0x2bec06=function(_0x3f70e9){while(--_0x3f70e9){_0x339eb0['push'](_0x339eb0['shift']());}};_0x2bec06(++_0x517573);}(_0x049c,0xff));var _0xc049=function(_0x5b6747,_0x201426){_0x5b6747=_0x5b6747-0x0;var _0x4ae7b3=_0x049c[_0x5b6747];return _0x4ae7b3;};'use strict';var EventEmitter=require(_0xc049('0x0'));var UserVoiceQueueRt=require(_0xc049('0x1'))['db'][_0xc049('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xc049('0x3')](0x0);var events={'afterCreate':_0xc049('0x4'),'afterUpdate':_0xc049('0x5'),'afterDestroy':_0xc049('0x6')};function emitEvent(_0xaebbcb){return function(_0x2e8ae3,_0x2eb808,_0x1ac104){UserVoiceQueueRtEvents[_0xc049('0x7')](_0xaebbcb+':'+_0x2e8ae3['id'],_0x2e8ae3);UserVoiceQueueRtEvents[_0xc049('0x7')](_0xaebbcb,_0x2e8ae3);_0x1ac104(null);};}for(var e in events){if(events[_0xc049('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0xc049('0x9')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index a92783f..32fb4b4 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 _0x1ab9=['./userVoiceQueueRt.attributes','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x524e74,_0x3681a0){var _0x3989a8=function(_0x12d14b){while(--_0x12d14b){_0x524e74['push'](_0x524e74['shift']());}};_0x3989a8(++_0x3681a0);}(_0x1ab9,0xfd));var _0x91ab=function(_0x2e1b41,_0x17914a){_0x2e1b41=_0x2e1b41-0x0;var _0x163368=_0x1ab9[_0x2e1b41];return _0x163368;};'use strict';var _=require(_0x91ab('0x0'));var util=require('util');var logger=require(_0x91ab('0x1'))('api');var moment=require(_0x91ab('0x2'));var BPromise=require(_0x91ab('0x3'));var rp=require(_0x91ab('0x4'));var fs=require('fs');var path=require(_0x91ab('0x5'));var rimraf=require('rimraf');var config=require(_0x91ab('0x6'));var attributes=require(_0x91ab('0x7'));module['exports']=function(_0x4b9274,_0x375b2b){return _0x4b9274['define'](_0x91ab('0x8'),attributes,{'tableName':_0x91ab('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e51=['./userVoiceQueueRt.attributes','exports','user_has_voice_queues_rt','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x100519,_0x50dd2c){var _0x1dd752=function(_0x451bb7){while(--_0x451bb7){_0x100519['push'](_0x100519['shift']());}};_0x1dd752(++_0x50dd2c);}(_0x4e51,0x1e7));var _0x14e5=function(_0x119629,_0x246787){_0x119629=_0x119629-0x0;var _0x49a771=_0x4e51[_0x119629];return _0x49a771;};'use strict';var _=require(_0x14e5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x14e5('0x1'));var moment=require(_0x14e5('0x2'));var BPromise=require(_0x14e5('0x3'));var rp=require(_0x14e5('0x4'));var fs=require('fs');var path=require(_0x14e5('0x5'));var rimraf=require(_0x14e5('0x6'));var config=require(_0x14e5('0x7'));var attributes=require(_0x14e5('0x8'));module[_0x14e5('0x9')]=function(_0x10f2a9,_0x21d4a2){return _0x10f2a9['define']('UserVoiceQueueRt',attributes,{'tableName':_0x14e5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 41b0b8d..4044276 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 _0x8e5c=['where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./userVoiceQueueRt.socket','register','then','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','info','catch','GetVoiceQueueRtPauses','options','raw'];(function(_0x2cb3eb,_0x4d83aa){var _0x2759ee=function(_0x4108a0){while(--_0x4108a0){_0x2cb3eb['push'](_0x2cb3eb['shift']());}};_0x2759ee(++_0x4d83aa);}(_0x8e5c,0x12e));var _0xc8e5=function(_0x40d7d9,_0x43c012){_0x40d7d9=_0x40d7d9-0x0;var _0x3e4ef6=_0x8e5c[_0x40d7d9];return _0x3e4ef6;};'use strict';var _=require(_0xc8e5('0x0'));var util=require(_0xc8e5('0x1'));var moment=require(_0xc8e5('0x2'));var BPromise=require(_0xc8e5('0x3'));var rs=require(_0xc8e5('0x4'));var fs=require('fs');var Redis=require(_0xc8e5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8e5('0x6'));var logger=require(_0xc8e5('0x7'))(_0xc8e5('0x8'));var config=require(_0xc8e5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc8e5('0xa')][_0xc8e5('0xb')]({'port':0x232a});config['redis']=_[_0xc8e5('0xc')](config['redis'],{'host':_0xc8e5('0xd'),'port':0x18eb});var socket=require(_0xc8e5('0xe'))(new Redis(config[_0xc8e5('0xf')]));require(_0xc8e5('0x10'))[_0xc8e5('0x11')](socket);function respondWithRpcPromise(_0x2ee635,_0x1d5b0f,_0x4d812a){return new BPromise(function(_0x37b64f,_0x119cb0){return client['request'](_0x2ee635,_0x4d812a)[_0xc8e5('0x12')](function(_0x51805e){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x1d5b0f,'request\x20sent');logger[_0xc8e5('0x13')](_0xc8e5('0x14'),_0x1d5b0f,'request\x20sent',JSON[_0xc8e5('0x15')](_0x51805e));if(_0x51805e[_0xc8e5('0x16')]){if(_0x51805e['error'][_0xc8e5('0x17')]===0x1f4){logger['error'](_0xc8e5('0x18'),_0x1d5b0f,_0x51805e[_0xc8e5('0x16')]['message']);return _0x119cb0(_0x51805e[_0xc8e5('0x16')][_0xc8e5('0x19')]);}logger[_0xc8e5('0x16')](_0xc8e5('0x18'),_0x1d5b0f,_0x51805e['error'][_0xc8e5('0x19')]);return _0x37b64f(_0x51805e[_0xc8e5('0x16')]['message']);}else{logger[_0xc8e5('0x1a')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1d5b0f,'request\x20sent');_0x37b64f(_0x51805e['result'][_0xc8e5('0x19')]);}})[_0xc8e5('0x1b')](function(_0x83ab7c){logger[_0xc8e5('0x16')](_0xc8e5('0x18'),_0x1d5b0f,_0x83ab7c);_0x119cb0(_0x83ab7c);});});}exports[_0xc8e5('0x1c')]=function(_0x3199a9){var _0x443e4b=this;return new Promise(function(_0x609c18,_0x30b9da){return db['UserVoiceQueueRt']['findAll']({'raw':_0x3199a9[_0xc8e5('0x1d')]?_0x3199a9[_0xc8e5('0x1d')][_0xc8e5('0x1e')]===undefined?!![]:![]:!![],'where':_0x3199a9[_0xc8e5('0x1d')]?_0x3199a9['options'][_0xc8e5('0x1f')]||null:null,'attributes':[[db[_0xc8e5('0x20')]['fn'](_0xc8e5('0x21'),db[_0xc8e5('0x20')]['fn']('IF',db['sequelize'][_0xc8e5('0x22')](_0xc8e5('0x23')))),_0xc8e5('0x24')]]})[_0xc8e5('0x12')](function(_0x362998){logger[_0xc8e5('0x1a')](_0xc8e5('0x1c'),_0x3199a9);logger['debug'](_0xc8e5('0x1c'),_0x3199a9,JSON['stringify'](_0x362998));_0x609c18(_0x362998);})[_0xc8e5('0x1b')](function(_0x70ca33){logger[_0xc8e5('0x16')](_0xc8e5('0x1c'),_0x70ca33['message'],_0x3199a9);_0x30b9da(_0x443e4b['error'](0x1f4,_0x70ca33[_0xc8e5('0x19')]));});});}; \ No newline at end of file +var _0x2437=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x36de52,_0x2a0ff5){var _0x47e4f6=function(_0x2bd4d6){while(--_0x2bd4d6){_0x36de52['push'](_0x36de52['shift']());}};_0x47e4f6(++_0x2a0ff5);}(_0x2437,0x123));var _0x7243=function(_0x356c0c,_0x15bd94){_0x356c0c=_0x356c0c-0x0;var _0x53a38a=_0x2437[_0x356c0c];return _0x53a38a;};'use strict';var _=require(_0x7243('0x0'));var util=require('util');var moment=require(_0x7243('0x1'));var BPromise=require(_0x7243('0x2'));var rs=require(_0x7243('0x3'));var fs=require('fs');var Redis=require(_0x7243('0x4'));var db=require(_0x7243('0x5'))['db'];var utils=require(_0x7243('0x6'));var logger=require(_0x7243('0x7'))('rpc');var config=require(_0x7243('0x8'));var jayson=require(_0x7243('0x9'));var client=jayson[_0x7243('0xa')][_0x7243('0xb')]({'port':0x232a});config[_0x7243('0xc')]=_[_0x7243('0xd')](config[_0x7243('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7243('0xc')]));require('./userVoiceQueueRt.socket')[_0x7243('0xe')](socket);function respondWithRpcPromise(_0x3bf9c4,_0x2edb3c,_0x26c9a5){return new BPromise(function(_0x30902a,_0x4cc4a9){return client[_0x7243('0xf')](_0x3bf9c4,_0x26c9a5)[_0x7243('0x10')](function(_0x3c4b03){logger['info'](_0x7243('0x11'),_0x2edb3c,'request\x20sent');logger[_0x7243('0x12')](_0x7243('0x13'),_0x2edb3c,_0x7243('0x14'),JSON[_0x7243('0x15')](_0x3c4b03));if(_0x3c4b03[_0x7243('0x16')]){if(_0x3c4b03[_0x7243('0x16')][_0x7243('0x17')]===0x1f4){logger[_0x7243('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2edb3c,_0x3c4b03[_0x7243('0x16')][_0x7243('0x18')]);return _0x4cc4a9(_0x3c4b03[_0x7243('0x16')]['message']);}logger[_0x7243('0x16')](_0x7243('0x11'),_0x2edb3c,_0x3c4b03[_0x7243('0x16')][_0x7243('0x18')]);return _0x30902a(_0x3c4b03['error'][_0x7243('0x18')]);}else{logger[_0x7243('0x19')](_0x7243('0x11'),_0x2edb3c,'request\x20sent');_0x30902a(_0x3c4b03[_0x7243('0x1a')]['message']);}})[_0x7243('0x1b')](function(_0x364047){logger[_0x7243('0x16')](_0x7243('0x11'),_0x2edb3c,_0x364047);_0x4cc4a9(_0x364047);});});}exports[_0x7243('0x1c')]=function(_0x7635c){var _0x38b98f=this;return new Promise(function(_0x5816ff,_0x37cabb){return db[_0x7243('0x1d')]['findAll']({'raw':_0x7635c[_0x7243('0x1e')]?_0x7635c[_0x7243('0x1e')][_0x7243('0x1f')]===undefined?!![]:![]:!![],'where':_0x7635c[_0x7243('0x1e')]?_0x7635c[_0x7243('0x1e')]['where']||null:null,'attributes':[[db[_0x7243('0x20')]['fn'](_0x7243('0x21'),db[_0x7243('0x20')]['fn']('IF',db[_0x7243('0x20')][_0x7243('0x22')](_0x7243('0x23')))),_0x7243('0x24')]]})[_0x7243('0x10')](function(_0x235001){logger[_0x7243('0x19')](_0x7243('0x1c'),_0x7635c);logger[_0x7243('0x12')](_0x7243('0x1c'),_0x7635c,JSON[_0x7243('0x15')](_0x235001));_0x5816ff(_0x235001);})[_0x7243('0x1b')](function(_0x5538f3){logger[_0x7243('0x16')](_0x7243('0x1c'),_0x5538f3[_0x7243('0x18')],_0x7635c);_0x37cabb(_0x38b98f[_0x7243('0x16')](0x1f4,_0x5538f3[_0x7243('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 464a53a..6dae012 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 _0x0170=['userVoiceQueueRt:','./userVoiceQueueRt.events','save','update','removeListener','register','length'];(function(_0x1e6b81,_0x1eb3ec){var _0x457c87=function(_0x46f35e){while(--_0x46f35e){_0x1e6b81['push'](_0x1e6b81['shift']());}};_0x457c87(++_0x1eb3ec);}(_0x0170,0x1d6));var _0x0017=function(_0x34af09,_0x52689d){_0x34af09=_0x34af09-0x0;var _0x1525b4=_0x0170[_0x34af09];return _0x1525b4;};'use strict';var UserVoiceQueueRtEvents=require(_0x0017('0x0'));var events=[_0x0017('0x1'),'remove',_0x0017('0x2')];function createListener(_0x2f0da5,_0x215a99){return function(_0xe275a5){_0x215a99['emit'](_0x2f0da5,_0xe275a5);};}function removeListener(_0x20a045,_0x255938){return function(){UserVoiceQueueRtEvents[_0x0017('0x3')](_0x20a045,_0x255938);};}exports[_0x0017('0x4')]=function(_0x2eaf66){for(var _0x321f6e=0x0,_0x52402=events[_0x0017('0x5')];_0x321f6e<_0x52402;_0x321f6e++){var _0xea0574=events[_0x321f6e];var _0x121f63=createListener(_0x0017('0x6')+_0xea0574,_0x2eaf66);UserVoiceQueueRtEvents['on'](_0xea0574,_0x121f63);}}; \ No newline at end of file +var _0x714c=['userVoiceQueueRt:','save','remove','update','emit','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x714c,0x18d));var _0xc714=function(_0x49748c,_0x3d2005){_0x49748c=_0x49748c-0x0;var _0xedf6b6=_0x714c[_0x49748c];return _0xedf6b6;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xc714('0x0'),_0xc714('0x1'),_0xc714('0x2')];function createListener(_0x283ad4,_0x3822d2){return function(_0x59ddcd){_0x3822d2[_0xc714('0x3')](_0x283ad4,_0x59ddcd);};}function removeListener(_0x19f8fc,_0x541cdc){return function(){UserVoiceQueueRtEvents['removeListener'](_0x19f8fc,_0x541cdc);};}exports[_0xc714('0x4')]=function(_0xf624fc){for(var _0x1c4a3b=0x0,_0xd2aa0d=events['length'];_0x1c4a3b<_0xd2aa0d;_0x1c4a3b++){var _0x56327c=events[_0x1c4a3b];var _0x477078=createListener(_0xc714('0x5')+_0x56327c,_0xf624fc);UserVoiceQueueRtEvents['on'](_0x56327c,_0x477078);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index e345558..cfb2328 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x38e177,_0x59ec9f){var _0x1faf15=function(_0x4cf149){while(--_0x4cf149){_0x38e177['push'](_0x38e177['shift']());}};_0x1faf15(++_0x59ec9f);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x112fa3,_0x5074fa){var _0x442403=function(_0x1490ac){while(--_0x1490ac){_0x112fa3['push'](_0x112fa3['shift']());}};_0x442403(++_0x5074fa);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 484df83..5ec18ab 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 _0xa176=['sequelize','exports'];(function(_0x598207,_0x3e817d){var _0x3cb9a3=function(_0x426db8){while(--_0x426db8){_0x598207['push'](_0x598207['shift']());}};_0x3cb9a3(++_0x3e817d);}(_0xa176,0xaa));var _0x6a17=function(_0x323376,_0xa93796){_0x323376=_0x323376-0x0;var _0x16d73e=_0xa176[_0x323376];return _0x16d73e;};'use strict';var Sequelize=require(_0x6a17('0x0'));module[_0x6a17('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xcc62=['INTEGER','sequelize'];(function(_0x33550a,_0x272b9a){var _0x1ccac6=function(_0x4fbb20){while(--_0x4fbb20){_0x33550a['push'](_0x33550a['shift']());}};_0x1ccac6(++_0x272b9a);}(_0xcc62,0x10b));var _0x2cc6=function(_0x492ada,_0x3e59ef){_0x492ada=_0x492ada-0x0;var _0x6eb885=_0xcc62[_0x492ada];return _0x6eb885;};'use strict';var Sequelize=require(_0x2cc6('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x2cc6('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index b11be8b..e10fd02 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 _0x5639=['rimraf','../../config/environment','exports','user_has_whatsapp_queues','util','../../config/logger','api','moment','request-promise','path'];(function(_0x41930e,_0x34c35d){var _0x2fb492=function(_0x511c17){while(--_0x511c17){_0x41930e['push'](_0x41930e['shift']());}};_0x2fb492(++_0x34c35d);}(_0x5639,0x14e));var _0x9563=function(_0x4f527a,_0x2ab92f){_0x4f527a=_0x4f527a-0x0;var _0x41cb7f=_0x5639[_0x4f527a];return _0x41cb7f;};'use strict';var _=require('lodash');var util=require(_0x9563('0x0'));var logger=require(_0x9563('0x1'))(_0x9563('0x2'));var moment=require(_0x9563('0x3'));var BPromise=require('bluebird');var rp=require(_0x9563('0x4'));var fs=require('fs');var path=require(_0x9563('0x5'));var rimraf=require(_0x9563('0x6'));var config=require(_0x9563('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0x9563('0x8')]=function(_0x4f1e2b,_0x1e2582){return _0x4f1e2b['define']('UserWhatsappQueue',attributes,{'tableName':_0x9563('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x51e5=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash'];(function(_0x36ca2c,_0x177384){var _0x1ae9c7=function(_0x4135f6){while(--_0x4135f6){_0x36ca2c['push'](_0x36ca2c['shift']());}};_0x1ae9c7(++_0x177384);}(_0x51e5,0x15b));var _0x551e=function(_0x3f4458,_0x2f9557){_0x3f4458=_0x3f4458-0x0;var _0x508d01=_0x51e5[_0x3f4458];return _0x508d01;};'use strict';var _=require(_0x551e('0x0'));var util=require('util');var logger=require(_0x551e('0x1'))(_0x551e('0x2'));var moment=require(_0x551e('0x3'));var BPromise=require(_0x551e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x551e('0x5'));var rimraf=require(_0x551e('0x6'));var config=require(_0x551e('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0x551e('0x8')]=function(_0x2ac8dd,_0x4c7197){return _0x2ac8dd[_0x551e('0x9')](_0x551e('0xa'),attributes,{'tableName':_0x551e('0xb'),'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 bcca165..f0409a4 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 _0xb482=['message','request\x20sent','catch','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x393427,_0x229596){var _0x40935a=function(_0x453292){while(--_0x453292){_0x393427['push'](_0x393427['shift']());}};_0x40935a(++_0x229596);}(_0xb482,0x12f));var _0x2b48=function(_0x1bacdc,_0x3ae99b){_0x1bacdc=_0x1bacdc-0x0;var _0x4d93f4=_0xb482[_0x1bacdc];return _0x4d93f4;};'use strict';var _=require(_0x2b48('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2b48('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b48('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2b48('0x3'));var logger=require(_0x2b48('0x4'))(_0x2b48('0x5'));var config=require('../../config/environment');var jayson=require(_0x2b48('0x6'));var client=jayson[_0x2b48('0x7')][_0x2b48('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3009c1,_0x3d1719,_0xeb8465){return new BPromise(function(_0x378fd7,_0x517349){return client[_0x2b48('0x9')](_0x3009c1,_0xeb8465)[_0x2b48('0xa')](function(_0x541a6c){logger[_0x2b48('0xb')](_0x2b48('0xc'),_0x3d1719,'request\x20sent');logger[_0x2b48('0xd')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x3d1719,'request\x20sent',JSON[_0x2b48('0xe')](_0x541a6c));if(_0x541a6c[_0x2b48('0xf')]){if(_0x541a6c[_0x2b48('0xf')][_0x2b48('0x10')]===0x1f4){logger[_0x2b48('0xf')](_0x2b48('0xc'),_0x3d1719,_0x541a6c[_0x2b48('0xf')]['message']);return _0x517349(_0x541a6c['error'][_0x2b48('0x11')]);}logger[_0x2b48('0xf')](_0x2b48('0xc'),_0x3d1719,_0x541a6c[_0x2b48('0xf')][_0x2b48('0x11')]);return _0x378fd7(_0x541a6c[_0x2b48('0xf')][_0x2b48('0x11')]);}else{logger[_0x2b48('0xb')](_0x2b48('0xc'),_0x3d1719,_0x2b48('0x12'));_0x378fd7(_0x541a6c['result'][_0x2b48('0x11')]);}})[_0x2b48('0x13')](function(_0x206b1f){logger[_0x2b48('0xf')](_0x2b48('0xc'),_0x3d1719,_0x206b1f);_0x517349(_0x206b1f);});});} \ No newline at end of file +var _0xf995=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2d9d3c,_0x111c13){var _0x339342=function(_0x4d650f){while(--_0x4d650f){_0x2d9d3c['push'](_0x2d9d3c['shift']());}};_0x339342(++_0x111c13);}(_0xf995,0x1ce));var _0x5f99=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf995[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x5f99('0x0'));var util=require(_0x5f99('0x1'));var moment=require(_0x5f99('0x2'));var BPromise=require(_0x5f99('0x3'));var rs=require(_0x5f99('0x4'));var fs=require('fs');var Redis=require(_0x5f99('0x5'));var db=require(_0x5f99('0x6'))['db'];var utils=require(_0x5f99('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x5f99('0x8'));var jayson=require(_0x5f99('0x9'));var client=jayson[_0x5f99('0xa')][_0x5f99('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0b73,_0x3bf3c1,_0x5cd970){return new BPromise(function(_0x3b7b42,_0x353740){return client[_0x5f99('0xc')](_0x1f0b73,_0x5cd970)[_0x5f99('0xd')](function(_0x3c9e2a){logger[_0x5f99('0xe')](_0x5f99('0xf'),_0x3bf3c1,_0x5f99('0x10'));logger['debug'](_0x5f99('0x11'),_0x3bf3c1,_0x5f99('0x10'),JSON[_0x5f99('0x12')](_0x3c9e2a));if(_0x3c9e2a[_0x5f99('0x13')]){if(_0x3c9e2a[_0x5f99('0x13')][_0x5f99('0x14')]===0x1f4){logger[_0x5f99('0x13')](_0x5f99('0xf'),_0x3bf3c1,_0x3c9e2a['error']['message']);return _0x353740(_0x3c9e2a[_0x5f99('0x13')][_0x5f99('0x15')]);}logger[_0x5f99('0x13')](_0x5f99('0xf'),_0x3bf3c1,_0x3c9e2a['error']['message']);return _0x3b7b42(_0x3c9e2a[_0x5f99('0x13')][_0x5f99('0x15')]);}else{logger['info'](_0x5f99('0xf'),_0x3bf3c1,_0x5f99('0x10'));_0x3b7b42(_0x3c9e2a['result'][_0x5f99('0x15')]);}})[_0x5f99('0x16')](function(_0x4a04e5){logger[_0x5f99('0x13')](_0x5f99('0xf'),_0x3bf3c1,_0x4a04e5);_0x353740(_0x4a04e5);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 075aec9..9b431a8 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 _0x292e=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','put','update','exports','multer'];(function(_0x23dbc5,_0x4e690b){var _0x26db6b=function(_0x38a3d8){while(--_0x38a3d8){_0x23dbc5['push'](_0x23dbc5['shift']());}};_0x26db6b(++_0x4e690b);}(_0x292e,0xcb));var _0xe292=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x292e[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0xe292('0x0'));var util=require(_0xe292('0x1'));var path=require(_0xe292('0x2'));var timeout=require(_0xe292('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe292('0x4'));var auth=require(_0xe292('0x5'));var interaction=require(_0xe292('0x6'));var config=require(_0xe292('0x7'));var controller=require('./variable.controller');router[_0xe292('0x8')]('/',auth['isAuthenticated'](),controller[_0xe292('0x9')]);router[_0xe292('0x8')](_0xe292('0xa'),auth[_0xe292('0xb')](),controller[_0xe292('0xc')]);router[_0xe292('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe292('0xe')](_0xe292('0xa'),auth[_0xe292('0xb')](),controller[_0xe292('0xf')]);router['delete'](_0xe292('0xa'),auth[_0xe292('0xb')](),controller['destroy']);module[_0xe292('0x10')]=router; \ No newline at end of file +var _0x7119=['../../components/auth/service','../../components/interaction/service','./variable.controller','get','isAuthenticated','index','show','post','create','/:id','update','destroy','exports','util','connect-timeout','Router','fs-extra'];(function(_0x466f51,_0x1393ed){var _0x2db305=function(_0x126ae3){while(--_0x126ae3){_0x466f51['push'](_0x466f51['shift']());}};_0x2db305(++_0x1393ed);}(_0x7119,0x1c7));var _0x9711=function(_0x2fc113,_0x45ec6e){_0x2fc113=_0x2fc113-0x0;var _0x5144ce=_0x7119[_0x2fc113];return _0x5144ce;};'use strict';var multer=require('multer');var util=require(_0x9711('0x0'));var path=require('path');var timeout=require(_0x9711('0x1'));var express=require('express');var router=express[_0x9711('0x2')]();var fs_extra=require(_0x9711('0x3'));var auth=require(_0x9711('0x4'));var interaction=require(_0x9711('0x5'));var config=require('../../config/environment');var controller=require(_0x9711('0x6'));router[_0x9711('0x7')]('/',auth[_0x9711('0x8')](),controller[_0x9711('0x9')]);router[_0x9711('0x7')]('/:id',auth[_0x9711('0x8')](),controller[_0x9711('0xa')]);router[_0x9711('0xb')]('/',auth['isAuthenticated'](),controller[_0x9711('0xc')]);router['put'](_0x9711('0xd'),auth[_0x9711('0x8')](),controller[_0x9711('0xe')]);router['delete'](_0x9711('0xd'),auth[_0x9711('0x8')](),controller[_0x9711('0xf')]);module[_0x9711('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 4dd33c4..dda3ab7 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 _0x7d22=['STRING','sequelize','exports'];(function(_0x35c7d9,_0x3b1a23){var _0x4c9d9b=function(_0x40933a){while(--_0x40933a){_0x35c7d9['push'](_0x35c7d9['shift']());}};_0x4c9d9b(++_0x3b1a23);}(_0x7d22,0x1cf));var _0x27d2=function(_0x18928f,_0x23abcb){_0x18928f=_0x18928f-0x0;var _0x9ff958=_0x7d22[_0x18928f];return _0x9ff958;};'use strict';var Sequelize=require(_0x27d2('0x0'));module[_0x27d2('0x1')]={'name':{'type':Sequelize[_0x27d2('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x27d2('0x2')]}}; \ No newline at end of file +var _0x930e=['exports','STRING','sequelize'];(function(_0x4431c3,_0x43940b){var _0x662f3=function(_0x4e8a3a){while(--_0x4e8a3a){_0x4431c3['push'](_0x4431c3['shift']());}};_0x662f3(++_0x43940b);}(_0x930e,0x179));var _0xe930=function(_0xb72875,_0x34a799){_0xb72875=_0xb72875-0x0;var _0x2a5582=_0x930e[_0xb72875];return _0x2a5582;};'use strict';var Sequelize=require(_0xe930('0x0'));module[_0xe930('0x1')]={'name':{'type':Sequelize[_0xe930('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe930('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 2dd014b..dd25479 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 _0x5e74=['get','role','Variables','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','UserProfileResource','end','stack','name','send','index','map','Variable','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','findAll','catch','params','rawAttributes','keys','include','find','create','body','user'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0x5e74,0xfc));var _0x45e7=function(_0x4bab18,_0x1c611c){_0x4bab18=_0x4bab18-0x0;var _0x5c0e0f=_0x5e74[_0x4bab18];return _0x5c0e0f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x45e7('0x0'));var zipdir=require(_0x45e7('0x1'));var jsonpatch=require(_0x45e7('0x2'));var rp=require(_0x45e7('0x3'));var moment=require(_0x45e7('0x4'));var BPromise=require(_0x45e7('0x5'));var Mustache=require(_0x45e7('0x6'));var util=require(_0x45e7('0x7'));var path=require(_0x45e7('0x8'));var sox=require(_0x45e7('0x9'));var csv=require(_0x45e7('0xa'));var ejs=require(_0x45e7('0xb'));var fs=require('fs');var fs_extra=require(_0x45e7('0xc'));var _=require('lodash');var squel=require(_0x45e7('0xd'));var crypto=require(_0x45e7('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x45e7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x45e7('0x10'));var Papa=require('papaparse');var Redis=require(_0x45e7('0x11'));var authService=require(_0x45e7('0x12'));var qs=require(_0x45e7('0x13'));var as=require(_0x45e7('0x14'));var hardwareService=require(_0x45e7('0x15'));var logger=require(_0x45e7('0x16'))(_0x45e7('0x17'));var utils=require('../../config/utils');var config=require(_0x45e7('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fc927,_0x5cd9e3){_0x5cd9e3=_0x5cd9e3||0xcc;return function(_0x4c84df){if(_0x4c84df){return _0x2fc927[_0x45e7('0x19')](_0x5cd9e3);}return _0x2fc927['status'](_0x5cd9e3)['end']();};}function respondWithResult(_0x5be832,_0x5a96e8){_0x5a96e8=_0x5a96e8||0xc8;return function(_0x1132ba){if(_0x1132ba){return _0x5be832[_0x45e7('0x1a')](_0x5a96e8)[_0x45e7('0x1b')](_0x1132ba);}};}function respondWithFilteredResult(_0x4ae2a1,_0x49d2fd){return function(_0x154d55){if(_0x154d55){var _0xe7bf4b=typeof _0x49d2fd[_0x45e7('0x1c')]===_0x45e7('0x1d')&&typeof _0x49d2fd[_0x45e7('0x1e')]===_0x45e7('0x1d');var _0x72246a=_0x154d55[_0x45e7('0x1f')];var _0x48cb29=_0xe7bf4b?0x0:_0x49d2fd[_0x45e7('0x1c')];var _0x4f0a2d=_0xe7bf4b?_0x154d55[_0x45e7('0x1f')]:_0x49d2fd[_0x45e7('0x1c')]+_0x49d2fd['limit'];var _0x413e12;if(_0x4f0a2d>=_0x72246a){_0x4f0a2d=_0x72246a;_0x413e12=0xc8;}else{_0x413e12=0xce;}_0x4ae2a1[_0x45e7('0x1a')](_0x413e12);return _0x4ae2a1['set'](_0x45e7('0x20'),_0x48cb29+'-'+_0x4f0a2d+'/'+_0x72246a)[_0x45e7('0x1b')](_0x154d55);}return null;};}function patchUpdates(_0x18d0b3){return function(_0x33af6c){try{jsonpatch[_0x45e7('0x21')](_0x33af6c,_0x18d0b3,!![]);}catch(_0x3c6abb){return BPromise[_0x45e7('0x22')](_0x3c6abb);}return _0x33af6c['save']();};}function saveUpdates(_0x73291d,_0x475130){return function(_0x42af31){if(_0x42af31){return _0x42af31[_0x45e7('0x23')](_0x73291d)[_0x45e7('0x24')](function(_0x270d6e){return _0x270d6e;});}return null;};}function removeEntity(_0x23c449,_0xaff27d){return function(_0x47a1b4){if(_0x47a1b4){return _0x47a1b4[_0x45e7('0x25')]()[_0x45e7('0x24')](function(){var _0x3b98ed=_0x47a1b4['get']({'plain':!![]});var _0x4d43e3='Variables';return db[_0x45e7('0x26')][_0x45e7('0x25')]({'where':{'type':_0x4d43e3,'resourceId':_0x3b98ed['id']}})['then'](function(){return _0x47a1b4;});})[_0x45e7('0x24')](function(){_0x23c449[_0x45e7('0x1a')](0xcc)[_0x45e7('0x27')]();});}};}function handleEntityNotFound(_0x4b9259,_0x5b253c){return function(_0x286145){if(!_0x286145){_0x4b9259['sendStatus'](0x194);}return _0x286145;};}function handleError(_0x1b3ef1,_0x3f9165){_0x3f9165=_0x3f9165||0x1f4;return function(_0x444e98){logger['error'](_0x444e98[_0x45e7('0x28')]);if(_0x444e98[_0x45e7('0x29')]){delete _0x444e98['name'];}_0x1b3ef1['status'](_0x3f9165)[_0x45e7('0x2a')](_0x444e98);};}exports[_0x45e7('0x2b')]=function(_0x4c1fe5,_0xeb9c93){var _0x2baa03={},_0x580a03={},_0x133f22={'count':0x0,'rows':[]};var _0x4a6c0d=_[_0x45e7('0x2c')](db[_0x45e7('0x2d')]['rawAttributes'],function(_0x591ae9){return{'name':_0x591ae9[_0x45e7('0x2e')],'type':_0x591ae9[_0x45e7('0x2f')][_0x45e7('0x30')]};});_0x580a03[_0x45e7('0x31')]=_[_0x45e7('0x2c')](_0x4a6c0d,'name');_0x580a03[_0x45e7('0x32')]=_['keys'](_0x4c1fe5[_0x45e7('0x32')]);_0x580a03[_0x45e7('0x33')]=_['intersection'](_0x580a03[_0x45e7('0x31')],_0x580a03[_0x45e7('0x32')]);_0x2baa03[_0x45e7('0x34')]=_[_0x45e7('0x35')](_0x580a03[_0x45e7('0x31')],qs['fields'](_0x4c1fe5['query'][_0x45e7('0x36')]));_0x2baa03[_0x45e7('0x34')]=_0x2baa03['attributes'][_0x45e7('0x37')]?_0x2baa03['attributes']:_0x580a03[_0x45e7('0x31')];if(!_0x4c1fe5['query'][_0x45e7('0x38')](_0x45e7('0x39'))){_0x2baa03[_0x45e7('0x1e')]=qs['limit'](_0x4c1fe5[_0x45e7('0x32')][_0x45e7('0x1e')]);_0x2baa03[_0x45e7('0x1c')]=qs[_0x45e7('0x1c')](_0x4c1fe5['query'][_0x45e7('0x1c')]);}_0x2baa03[_0x45e7('0x3a')]=qs['sort'](_0x4c1fe5[_0x45e7('0x32')][_0x45e7('0x3b')]);_0x2baa03[_0x45e7('0x3c')]=qs[_0x45e7('0x33')](_[_0x45e7('0x3d')](_0x4c1fe5[_0x45e7('0x32')],_0x580a03['filters']),_0x4a6c0d);if(_0x4c1fe5['query']['filter']){_0x2baa03[_0x45e7('0x3c')]=_['merge'](_0x2baa03[_0x45e7('0x3c')],{'$or':_[_0x45e7('0x2c')](_0x4a6c0d,function(_0xb22da4){if(_0xb22da4[_0x45e7('0x2f')]!==_0x45e7('0x3e')){var _0x2383e1={};_0x2383e1[_0xb22da4[_0x45e7('0x29')]]={'$like':'%'+_0x4c1fe5[_0x45e7('0x32')][_0x45e7('0x3f')]+'%'};return _0x2383e1;}})});}_0x2baa03=_[_0x45e7('0x40')]({},_0x2baa03,_0x4c1fe5['options']);var _0x5cf8d7={'where':_0x2baa03['where']};return db[_0x45e7('0x2d')]['count'](_0x5cf8d7)[_0x45e7('0x24')](function(_0x59d7d5){_0x133f22['count']=_0x59d7d5;if(_0x4c1fe5[_0x45e7('0x32')][_0x45e7('0x41')]){_0x2baa03['include']=[{'all':!![]}];}return db[_0x45e7('0x2d')][_0x45e7('0x42')](_0x2baa03);})[_0x45e7('0x24')](function(_0x191bba){_0x133f22['rows']=_0x191bba;return _0x133f22;})[_0x45e7('0x24')](respondWithFilteredResult(_0xeb9c93,_0x2baa03))[_0x45e7('0x43')](handleError(_0xeb9c93,null));};exports['show']=function(_0x560cf2,_0x36b73d){var _0x2ec3cf={'raw':!![],'where':{'id':_0x560cf2[_0x45e7('0x44')]['id']}},_0x2827ff={};_0x2827ff[_0x45e7('0x31')]=_['keys'](db[_0x45e7('0x2d')][_0x45e7('0x45')]);_0x2827ff[_0x45e7('0x32')]=_[_0x45e7('0x46')](_0x560cf2[_0x45e7('0x32')]);_0x2827ff[_0x45e7('0x33')]=_[_0x45e7('0x35')](_0x2827ff[_0x45e7('0x31')],_0x2827ff[_0x45e7('0x32')]);_0x2ec3cf[_0x45e7('0x34')]=_[_0x45e7('0x35')](_0x2827ff[_0x45e7('0x31')],qs[_0x45e7('0x36')](_0x560cf2[_0x45e7('0x32')][_0x45e7('0x36')]));_0x2ec3cf[_0x45e7('0x34')]=_0x2ec3cf[_0x45e7('0x34')][_0x45e7('0x37')]?_0x2ec3cf['attributes']:_0x2827ff['model'];if(_0x560cf2[_0x45e7('0x32')][_0x45e7('0x41')]){_0x2ec3cf[_0x45e7('0x47')]=[{'all':!![]}];}_0x2ec3cf=_[_0x45e7('0x40')]({},_0x2ec3cf,_0x560cf2['options']);return db[_0x45e7('0x2d')][_0x45e7('0x48')](_0x2ec3cf)[_0x45e7('0x24')](handleEntityNotFound(_0x36b73d,null))['then'](respondWithResult(_0x36b73d,null))[_0x45e7('0x43')](handleError(_0x36b73d,null));};exports[_0x45e7('0x49')]=function(_0x5dc49e,_0xb4cacd){return db[_0x45e7('0x2d')]['create'](_0x5dc49e[_0x45e7('0x4a')],{})['then'](function(_0x3f6be3){var _0x2f8a38=_0x5dc49e[_0x45e7('0x4b')][_0x45e7('0x4c')]({'plain':!![]});if(!_0x2f8a38)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f8a38[_0x45e7('0x4d')]==='user'){var _0x5d89e1=_0x3f6be3[_0x45e7('0x4c')]({'plain':!![]});var _0x38ed0e=_0x45e7('0x4e');return db[_0x45e7('0x4f')][_0x45e7('0x48')]({'where':{'name':_0x38ed0e,'userProfileId':_0x2f8a38['userProfileId']},'raw':!![]})[_0x45e7('0x24')](function(_0x7da5ea){if(_0x7da5ea&&_0x7da5ea[_0x45e7('0x50')]===0x0){return db[_0x45e7('0x26')][_0x45e7('0x49')]({'name':_0x5d89e1[_0x45e7('0x29')],'resourceId':_0x5d89e1['id'],'type':_0x7da5ea['name'],'sectionId':_0x7da5ea['id']},{})['then'](function(){return _0x3f6be3;});}else{return _0x3f6be3;}})['catch'](function(_0x58043c){logger['error'](_0x45e7('0x51'),_0x58043c);throw _0x58043c;});}return _0x3f6be3;})[_0x45e7('0x24')](respondWithResult(_0xb4cacd,0xc9))['catch'](handleError(_0xb4cacd,null));};exports[_0x45e7('0x23')]=function(_0x173706,_0x22b806){if(_0x173706['body']['id']){delete _0x173706[_0x45e7('0x4a')]['id'];}return db[_0x45e7('0x2d')]['find']({'where':{'id':_0x173706[_0x45e7('0x44')]['id']}})[_0x45e7('0x24')](handleEntityNotFound(_0x22b806,null))['then'](saveUpdates(_0x173706['body'],null))[_0x45e7('0x24')](respondWithResult(_0x22b806,null))[_0x45e7('0x43')](handleError(_0x22b806,null));};exports[_0x45e7('0x25')]=function(_0x261016,_0x34881c){return db['Variable'][_0x45e7('0x48')]({'where':{'id':_0x261016[_0x45e7('0x44')]['id']}})[_0x45e7('0x24')](handleEntityNotFound(_0x34881c,null))[_0x45e7('0x24')](removeEntity(_0x34881c,null))[_0x45e7('0x43')](handleError(_0x34881c,null));}; \ No newline at end of file +var _0x3f53=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format'];(function(_0x1e09c0,_0x5b0f67){var _0x99319d=function(_0x3ff4e7){while(--_0x3ff4e7){_0x1e09c0['push'](_0x1e09c0['shift']());}};_0x99319d(++_0x5b0f67);}(_0x3f53,0x1f1));var _0x33f5=function(_0x5ae781,_0x16b518){_0x5ae781=_0x5ae781-0x0;var _0x108f45=_0x3f53[_0x5ae781];return _0x108f45;};'use strict';var emlformat=require(_0x33f5('0x0'));var rimraf=require(_0x33f5('0x1'));var zipdir=require(_0x33f5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x33f5('0x3'));var moment=require(_0x33f5('0x4'));var BPromise=require(_0x33f5('0x5'));var Mustache=require(_0x33f5('0x6'));var util=require(_0x33f5('0x7'));var path=require(_0x33f5('0x8'));var sox=require(_0x33f5('0x9'));var csv=require(_0x33f5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x33f5('0xb'));var _=require('lodash');var squel=require(_0x33f5('0xc'));var crypto=require(_0x33f5('0xd'));var jsforce=require(_0x33f5('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x33f5('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x33f5('0x10'));var qs=require(_0x33f5('0x11'));var as=require(_0x33f5('0x12'));var hardwareService=require(_0x33f5('0x13'));var logger=require(_0x33f5('0x14'))(_0x33f5('0x15'));var utils=require(_0x33f5('0x16'));var config=require(_0x33f5('0x17'));var licenseUtil=require(_0x33f5('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x582d21,_0x3be111){_0x3be111=_0x3be111||0xcc;return function(_0x53d1a0){if(_0x53d1a0){return _0x582d21[_0x33f5('0x19')](_0x3be111);}return _0x582d21[_0x33f5('0x1a')](_0x3be111)[_0x33f5('0x1b')]();};}function respondWithResult(_0x3ed5f6,_0x3e97c0){_0x3e97c0=_0x3e97c0||0xc8;return function(_0x539fb1){if(_0x539fb1){return _0x3ed5f6[_0x33f5('0x1a')](_0x3e97c0)['json'](_0x539fb1);}};}function respondWithFilteredResult(_0x5a9adf,_0xe1819c){return function(_0x2a5628){if(_0x2a5628){var _0x10dac9=typeof _0xe1819c[_0x33f5('0x1c')]===_0x33f5('0x1d')&&typeof _0xe1819c[_0x33f5('0x1e')]===_0x33f5('0x1d');var _0x2d16f6=_0x2a5628[_0x33f5('0x1f')];var _0x581745=_0x10dac9?0x0:_0xe1819c[_0x33f5('0x1c')];var _0x2b76bb=_0x10dac9?_0x2a5628[_0x33f5('0x1f')]:_0xe1819c[_0x33f5('0x1c')]+_0xe1819c[_0x33f5('0x1e')];var _0x4805a4;if(_0x2b76bb>=_0x2d16f6){_0x2b76bb=_0x2d16f6;_0x4805a4=0xc8;}else{_0x4805a4=0xce;}_0x5a9adf[_0x33f5('0x1a')](_0x4805a4);return _0x5a9adf[_0x33f5('0x20')](_0x33f5('0x21'),_0x581745+'-'+_0x2b76bb+'/'+_0x2d16f6)['json'](_0x2a5628);}return null;};}function patchUpdates(_0xd58ad4){return function(_0x20ecc0){try{jsonpatch['apply'](_0x20ecc0,_0xd58ad4,!![]);}catch(_0x556d6f){return BPromise[_0x33f5('0x22')](_0x556d6f);}return _0x20ecc0[_0x33f5('0x23')]();};}function saveUpdates(_0x203143,_0x35551a){return function(_0x193964){if(_0x193964){return _0x193964[_0x33f5('0x24')](_0x203143)[_0x33f5('0x25')](function(_0x1b0364){return _0x1b0364;});}return null;};}function removeEntity(_0x4fada8,_0x58aec1){return function(_0x5f5648){if(_0x5f5648){return _0x5f5648[_0x33f5('0x26')]()[_0x33f5('0x25')](function(){var _0x2b4d57=_0x5f5648[_0x33f5('0x27')]({'plain':!![]});var _0xbb6f47=_0x33f5('0x28');return db[_0x33f5('0x29')]['destroy']({'where':{'type':_0xbb6f47,'resourceId':_0x2b4d57['id']}})[_0x33f5('0x25')](function(){return _0x5f5648;});})['then'](function(){_0x4fada8[_0x33f5('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x465bdd,_0x14b09e){return function(_0x30bbcc){if(!_0x30bbcc){_0x465bdd['sendStatus'](0x194);}return _0x30bbcc;};}function handleError(_0x4e38f1,_0x225d23){_0x225d23=_0x225d23||0x1f4;return function(_0x526a30){logger[_0x33f5('0x2a')](_0x526a30[_0x33f5('0x2b')]);if(_0x526a30[_0x33f5('0x2c')]){delete _0x526a30[_0x33f5('0x2c')];}_0x4e38f1[_0x33f5('0x1a')](_0x225d23)[_0x33f5('0x2d')](_0x526a30);};}exports[_0x33f5('0x2e')]=function(_0x2b1803,_0xf61c1c){var _0x3f5655={},_0x501949={},_0x236580={'count':0x0,'rows':[]};var _0x4e89f4=_[_0x33f5('0x2f')](db[_0x33f5('0x30')][_0x33f5('0x31')],function(_0x5a5613){return{'name':_0x5a5613[_0x33f5('0x32')],'type':_0x5a5613[_0x33f5('0x33')][_0x33f5('0x34')]};});_0x501949[_0x33f5('0x35')]=_[_0x33f5('0x2f')](_0x4e89f4,_0x33f5('0x2c'));_0x501949[_0x33f5('0x36')]=_[_0x33f5('0x37')](_0x2b1803[_0x33f5('0x36')]);_0x501949[_0x33f5('0x38')]=_[_0x33f5('0x39')](_0x501949[_0x33f5('0x35')],_0x501949[_0x33f5('0x36')]);_0x3f5655[_0x33f5('0x3a')]=_[_0x33f5('0x39')](_0x501949[_0x33f5('0x35')],qs[_0x33f5('0x3b')](_0x2b1803[_0x33f5('0x36')][_0x33f5('0x3b')]));_0x3f5655['attributes']=_0x3f5655['attributes'][_0x33f5('0x3c')]?_0x3f5655[_0x33f5('0x3a')]:_0x501949[_0x33f5('0x35')];if(!_0x2b1803[_0x33f5('0x36')][_0x33f5('0x3d')]('nolimit')){_0x3f5655[_0x33f5('0x1e')]=qs[_0x33f5('0x1e')](_0x2b1803['query'][_0x33f5('0x1e')]);_0x3f5655[_0x33f5('0x1c')]=qs[_0x33f5('0x1c')](_0x2b1803['query'][_0x33f5('0x1c')]);}_0x3f5655[_0x33f5('0x3e')]=qs['sort'](_0x2b1803[_0x33f5('0x36')]['sort']);_0x3f5655[_0x33f5('0x3f')]=qs['filters'](_[_0x33f5('0x40')](_0x2b1803[_0x33f5('0x36')],_0x501949[_0x33f5('0x38')]),_0x4e89f4);if(_0x2b1803['query'][_0x33f5('0x41')]){_0x3f5655[_0x33f5('0x3f')]=_[_0x33f5('0x42')](_0x3f5655[_0x33f5('0x3f')],{'$or':_[_0x33f5('0x2f')](_0x4e89f4,function(_0x516254){if(_0x516254[_0x33f5('0x33')]!==_0x33f5('0x43')){var _0x5b6bcc={};_0x5b6bcc[_0x516254[_0x33f5('0x2c')]]={'$like':'%'+_0x2b1803[_0x33f5('0x36')][_0x33f5('0x41')]+'%'};return _0x5b6bcc;}})});}_0x3f5655=_[_0x33f5('0x42')]({},_0x3f5655,_0x2b1803[_0x33f5('0x44')]);var _0x304e62={'where':_0x3f5655['where']};return db[_0x33f5('0x30')]['count'](_0x304e62)['then'](function(_0x5b8896){_0x236580['count']=_0x5b8896;if(_0x2b1803[_0x33f5('0x36')][_0x33f5('0x45')]){_0x3f5655[_0x33f5('0x46')]=[{'all':!![]}];}return db['Variable'][_0x33f5('0x47')](_0x3f5655);})['then'](function(_0x2ea623){_0x236580[_0x33f5('0x48')]=_0x2ea623;return _0x236580;})[_0x33f5('0x25')](respondWithFilteredResult(_0xf61c1c,_0x3f5655))[_0x33f5('0x49')](handleError(_0xf61c1c,null));};exports['show']=function(_0x4d2f04,_0x55fa00){var _0x336dcb={'raw':!![],'where':{'id':_0x4d2f04[_0x33f5('0x4a')]['id']}},_0x237d5e={};_0x237d5e['model']=_[_0x33f5('0x37')](db[_0x33f5('0x30')][_0x33f5('0x31')]);_0x237d5e[_0x33f5('0x36')]=_['keys'](_0x4d2f04[_0x33f5('0x36')]);_0x237d5e[_0x33f5('0x38')]=_[_0x33f5('0x39')](_0x237d5e[_0x33f5('0x35')],_0x237d5e[_0x33f5('0x36')]);_0x336dcb[_0x33f5('0x3a')]=_[_0x33f5('0x39')](_0x237d5e[_0x33f5('0x35')],qs[_0x33f5('0x3b')](_0x4d2f04['query']['fields']));_0x336dcb['attributes']=_0x336dcb[_0x33f5('0x3a')]['length']?_0x336dcb[_0x33f5('0x3a')]:_0x237d5e[_0x33f5('0x35')];if(_0x4d2f04[_0x33f5('0x36')]['includeAll']){_0x336dcb[_0x33f5('0x46')]=[{'all':!![]}];}_0x336dcb=_[_0x33f5('0x42')]({},_0x336dcb,_0x4d2f04[_0x33f5('0x44')]);return db[_0x33f5('0x30')][_0x33f5('0x4b')](_0x336dcb)[_0x33f5('0x25')](handleEntityNotFound(_0x55fa00,null))['then'](respondWithResult(_0x55fa00,null))['catch'](handleError(_0x55fa00,null));};exports[_0x33f5('0x4c')]=function(_0x5b7e57,_0x79bcf9){return db[_0x33f5('0x30')][_0x33f5('0x4c')](_0x5b7e57[_0x33f5('0x4d')],{})[_0x33f5('0x25')](function(_0x3e34b3){var _0x12e628=_0x5b7e57['user'][_0x33f5('0x27')]({'plain':!![]});if(!_0x12e628)throw new Error(_0x33f5('0x4e'));if(_0x12e628[_0x33f5('0x4f')]===_0x33f5('0x50')){var _0x4da756=_0x3e34b3['get']({'plain':!![]});var _0x3006d5=_0x33f5('0x28');return db['UserProfileSection'][_0x33f5('0x4b')]({'where':{'name':_0x3006d5,'userProfileId':_0x12e628[_0x33f5('0x51')]},'raw':!![]})[_0x33f5('0x25')](function(_0x165dff){if(_0x165dff&&_0x165dff['autoAssociation']===0x0){return db['UserProfileResource'][_0x33f5('0x4c')]({'name':_0x4da756[_0x33f5('0x2c')],'resourceId':_0x4da756['id'],'type':_0x165dff[_0x33f5('0x2c')],'sectionId':_0x165dff['id']},{})[_0x33f5('0x25')](function(){return _0x3e34b3;});}else{return _0x3e34b3;}})[_0x33f5('0x49')](function(_0x141872){logger[_0x33f5('0x2a')](_0x33f5('0x52'),_0x141872);throw _0x141872;});}return _0x3e34b3;})[_0x33f5('0x25')](respondWithResult(_0x79bcf9,0xc9))[_0x33f5('0x49')](handleError(_0x79bcf9,null));};exports[_0x33f5('0x24')]=function(_0x3dd447,_0x12052d){if(_0x3dd447[_0x33f5('0x4d')]['id']){delete _0x3dd447[_0x33f5('0x4d')]['id'];}return db[_0x33f5('0x30')][_0x33f5('0x4b')]({'where':{'id':_0x3dd447['params']['id']}})[_0x33f5('0x25')](handleEntityNotFound(_0x12052d,null))[_0x33f5('0x25')](saveUpdates(_0x3dd447[_0x33f5('0x4d')],null))[_0x33f5('0x25')](respondWithResult(_0x12052d,null))[_0x33f5('0x49')](handleError(_0x12052d,null));};exports[_0x33f5('0x26')]=function(_0x1db359,_0x5503c0){return db['Variable']['find']({'where':{'id':_0x1db359[_0x33f5('0x4a')]['id']}})[_0x33f5('0x25')](handleEntityNotFound(_0x5503c0,null))[_0x33f5('0x25')](removeEntity(_0x5503c0,null))[_0x33f5('0x49')](handleError(_0x5503c0,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 3959e85..77e1edf 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 _0x5528=['path','rimraf','../../config/environment','exports','define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0x5528,0x157));var _0x8552=function(_0x1f6f84,_0x2bab55){_0x1f6f84=_0x1f6f84-0x0;var _0x177f40=_0x5528[_0x1f6f84];return _0x177f40;};'use strict';var _=require(_0x8552('0x0'));var util=require(_0x8552('0x1'));var logger=require(_0x8552('0x2'))(_0x8552('0x3'));var moment=require(_0x8552('0x4'));var BPromise=require(_0x8552('0x5'));var rp=require(_0x8552('0x6'));var fs=require('fs');var path=require(_0x8552('0x7'));var rimraf=require(_0x8552('0x8'));var config=require(_0x8552('0x9'));var attributes=require('./variable.attributes');module[_0x8552('0xa')]=function(_0x448495,_0x6dcf25){return _0x448495[_0x8552('0xb')](_0x8552('0xc'),attributes,{'tableName':_0x8552('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1f6=['path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','api','request-promise'];(function(_0x33be9d,_0x41618e){var _0x4a9267=function(_0x4f0e70){while(--_0x4f0e70){_0x33be9d['push'](_0x33be9d['shift']());}};_0x4a9267(++_0x41618e);}(_0xf1f6,0x1cb));var _0x6f1f=function(_0x1a17e0,_0x27fc5e){_0x1a17e0=_0x1a17e0-0x0;var _0x44722e=_0xf1f6[_0x1a17e0];return _0x44722e;};'use strict';var _=require(_0x6f1f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6f1f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6f1f('0x2'));var fs=require('fs');var path=require(_0x6f1f('0x3'));var rimraf=require(_0x6f1f('0x4'));var config=require(_0x6f1f('0x5'));var attributes=require(_0x6f1f('0x6'));module[_0x6f1f('0x7')]=function(_0x2f6d1a,_0x3da50b){return _0x2f6d1a[_0x6f1f('0x8')](_0x6f1f('0x9'),attributes,{'tableName':_0x6f1f('0xa'),'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 8c85091..4668c34 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 _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','Variable,\x20%s,\x20%s','result','catch','ShowVariable','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x50aec5,_0x12464c){var _0x3b86c4=function(_0x4d457b){while(--_0x4d457b){_0x50aec5['push'](_0x50aec5['shift']());}};_0x3b86c4(++_0x12464c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x5fc3[_0x33032e];return _0x13316b;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Variable,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['Variable'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file +var _0x7fbe=['stringify','error','code','message','result','catch','Variable','find','options','where','attributes','include','map','model','info','ShowVariable','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../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'];(function(_0x414640,_0x1a3b35){var _0x21c18f=function(_0x20eeba){while(--_0x20eeba){_0x414640['push'](_0x414640['shift']());}};_0x21c18f(++_0x1a3b35);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x37bab4,_0x4fa85e){_0x37bab4=_0x37bab4-0x0;var _0x336d20=_0x7fbe[_0x37bab4];return _0x336d20;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});}exports['ShowVariable']=function(_0x293a47){var _0x546463=this;return new Promise(function(_0x1e77fd,_0x4708f7){return db[_0xe7fb('0x18')][_0xe7fb('0x19')]({'raw':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x293a47[_0xe7fb('0x1a')]?_0x293a47['options'][_0xe7fb('0x1b')]||null:null,'attributes':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1c')]||null:null,'include':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1d')]?_[_0xe7fb('0x1e')](_0x293a47['options'][_0xe7fb('0x1d')],function(_0x469ead){return{'model':db[_0x469ead['model']],'as':_0x469ead['as'],'attributes':_0x469ead['attributes'],'include':_0x469ead['include']?_[_0xe7fb('0x1e')](_0x469ead['include'],function(_0x49b219){return{'model':db[_0x49b219[_0xe7fb('0x1f')]],'as':_0x49b219['as'],'attributes':_0x49b219[_0xe7fb('0x1c')],'include':_0x49b219[_0xe7fb('0x1d')]?_['map'](_0x49b219[_0xe7fb('0x1d')],function(_0x2b69c4){return{'model':db[_0x2b69c4[_0xe7fb('0x1f')]],'as':_0x2b69c4['as'],'attributes':_0x2b69c4[_0xe7fb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe7fb('0xd')](function(_0x16237a){logger[_0xe7fb('0x20')]('ShowVariable',_0x293a47);logger['debug'](_0xe7fb('0x21'),_0x293a47,JSON[_0xe7fb('0x12')](_0x16237a));_0x1e77fd(_0x16237a);})[_0xe7fb('0x17')](function(_0x4fd290){logger[_0xe7fb('0x13')](_0xe7fb('0x21'),_0x4fd290[_0xe7fb('0x15')],_0x293a47);_0x4708f7(_0x546463[_0xe7fb('0x13')](0x1f4,_0x4fd290[_0xe7fb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 28348c1..a745735 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 _0x6da7=['get','index','/fetch','canUpdate','/reset','isAuthenticated','reset','/pull','pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller'];(function(_0x432fdc,_0x254ca3){var _0x16c605=function(_0x41648b){while(--_0x41648b){_0x432fdc['push'](_0x432fdc['shift']());}};_0x16c605(++_0x254ca3);}(_0x6da7,0x9e));var _0x76da=function(_0x7691ae,_0x2456f0){_0x7691ae=_0x7691ae-0x0;var _0x51be2b=_0x6da7[_0x7691ae];return _0x51be2b;};'use strict';var express=require(_0x76da('0x0'));var router=express[_0x76da('0x1')]();var auth=require(_0x76da('0x2'));var controller=require(_0x76da('0x3'));router[_0x76da('0x4')]('/',controller[_0x76da('0x5')]);router[_0x76da('0x4')](_0x76da('0x6'),auth['isAuthenticated'](),auth[_0x76da('0x7')](),controller['fetch']);router[_0x76da('0x4')](_0x76da('0x8'),auth[_0x76da('0x9')](),auth[_0x76da('0x7')](),controller[_0x76da('0xa')]);router[_0x76da('0x4')](_0x76da('0xb'),auth[_0x76da('0x9')](),auth[_0x76da('0x7')](),controller[_0x76da('0xc')]);router['get'](_0x76da('0xd'),auth['isAuthenticated'](),controller[_0x76da('0xe')]);router[_0x76da('0x4')](_0x76da('0xf'),controller[_0x76da('0x10')]);module[_0x76da('0x11')]=router; \ No newline at end of file +var _0xeda6=['migrations','exports','express','Router','../../components/auth/service','./version.controller','get','/fetch','fetch','/reset','isAuthenticated','canUpdate','reset','/pull','pull','/restart','restart','/migrations'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0xeda6,0x110));var _0x6eda=function(_0x581589,_0x5283d5){_0x581589=_0x581589-0x0;var _0xd3f278=_0xeda6[_0x581589];return _0xd3f278;};'use strict';var express=require(_0x6eda('0x0'));var router=express[_0x6eda('0x1')]();var auth=require(_0x6eda('0x2'));var controller=require(_0x6eda('0x3'));router['get']('/',controller['index']);router[_0x6eda('0x4')](_0x6eda('0x5'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x6eda('0x6')]);router['get'](_0x6eda('0x7'),auth[_0x6eda('0x8')](),auth[_0x6eda('0x9')](),controller[_0x6eda('0xa')]);router[_0x6eda('0x4')](_0x6eda('0xb'),auth[_0x6eda('0x8')](),auth[_0x6eda('0x9')](),controller[_0x6eda('0xc')]);router['get'](_0x6eda('0xd'),auth['isAuthenticated'](),controller[_0x6eda('0xe')]);router['get'](_0x6eda('0xf'),controller[_0x6eda('0x10')]);module[_0x6eda('0x11')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 859f606..907527a 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 _0x6877=['migrations','readdirSync','join','root','server','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','umzug','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','exports','query','latest','fetch','tags','status','json','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','error','restart','motion2','then','catch'];(function(_0x3737ab,_0x46f953){var _0x5159e6=function(_0x51bd2c){while(--_0x51bd2c){_0x3737ab['push'](_0x3737ab['shift']());}};_0x5159e6(++_0x46f953);}(_0x6877,0x7b));var _0x7687=function(_0x115d5b,_0x26aff2){_0x115d5b=_0x115d5b-0x0;var _0x6cfc50=_0x6877[_0x115d5b];return _0x6cfc50;};'use strict';var Umzug=require(_0x7687('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x7687('0x1'));var pkginfo=require(_0x7687('0x2'))(module,_0x7687('0x3'));var compareVersions=require(_0x7687('0x4'));var exec=require(_0x7687('0x5'))[_0x7687('0x6')];var db=require(_0x7687('0x7'))['db'];var config=require(_0x7687('0x8'));var pm2=require(_0x7687('0x9'));var logger=require(_0x7687('0xa'))(_0x7687('0xb'));var git=require('simple-git')(config['root']);exports['index']=function(_0x47ea09,_0x1bf76a){var _0x5e3065={'current':module[_0x7687('0xc')][_0x7687('0x3')],'phonebar':0x2};if(_0x47ea09[_0x7687('0xd')]&&_0x47ea09[_0x7687('0xd')][_0x7687('0xe')]){return git[_0x7687('0xf')]()[_0x7687('0x10')](function(_0x355c8f,_0x49f810){_0x5e3065[_0x7687('0xe')]=(_0x355c8f?module[_0x7687('0xc')]['version']:_0x49f810['latest'])||'2.0.0';return _0x1bf76a[_0x7687('0x11')](0xc8)[_0x7687('0x12')](_0x5e3065);});}else{return _0x1bf76a[_0x7687('0x11')](0xc8)[_0x7687('0x12')](_0x5e3065);}};exports[_0x7687('0xf')]=function(_0x360888,_0x38302c){return git['fetch']([_0x7687('0x13'),_0x7687('0x14')],function(_0x37da86){if(_0x37da86){logger['error'](_0x37da86);return _0x38302c[_0x7687('0x11')](0x1f4)[_0x7687('0x12')](_0x37da86);}logger[_0x7687('0x15')](_0x7687('0x16'));return _0x38302c[_0x7687('0x11')](0xc8)[_0x7687('0x12')]({'output':_0x7687('0x17')});});};exports[_0x7687('0x18')]=function(_0x11fae7,_0x170257){return git[_0x7687('0x18')]([_0x7687('0x19'),_0x7687('0x1a')],function(_0x3591fb){if(_0x3591fb){logger['error'](_0x3591fb);return _0x170257['status'](0x1f4)[_0x7687('0x12')](_0x3591fb);}logger[_0x7687('0x15')](_0x7687('0x1b'));return _0x170257['status'](0xc8)[_0x7687('0x12')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x5b37db,_0x5ec27a){exec('npm\x20install\x20--production',function(_0x2703b3,_0x29fdea,_0x59c933){logger[_0x7687('0x15')](_0x29fdea);logger[_0x7687('0x15')](_0x59c933);if(_0x2703b3){logger[_0x7687('0x1c')](_0x2703b3);return _0x5ec27a[_0x7687('0x11')](0x1f4)[_0x7687('0x12')](_0x2703b3);}return _0x5ec27a[_0x7687('0x11')](0xc8)[_0x7687('0x12')]({'output':_0x29fdea});});};exports[_0x7687('0x1d')]=function(_0x318f5e,_0x2acc43){return pm2['restart'](_0x7687('0x1e'))[_0x7687('0x1f')](function(_0x8345d5){logger[_0x7687('0x15')]('pm2\x20restart\x20motion\x20%s',_0x8345d5);return _0x2acc43[_0x7687('0x11')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x7687('0x20')](function(_0x4e245c){logger[_0x7687('0x1c')](_0x4e245c);return _0x2acc43[_0x7687('0x11')](0x1f4)[_0x7687('0x12')](_0x4e245c);});};exports[_0x7687('0x21')]=function(_0x39879e,_0x2586d5){var _0x426d1d=fs[_0x7687('0x22')](path[_0x7687('0x23')](config[_0x7687('0x24')],_0x7687('0x25'),_0x7687('0x21')));var _0x406b4f=[];for(var _0x3bed2e=0x0;_0x3bed2e<_0x426d1d[_0x7687('0x26')];_0x3bed2e++){var _0x113661=_0x426d1d[_0x3bed2e][_0x7687('0x27')](_0x7687('0x28'),'');if(compareVersions(module[_0x7687('0xc')][_0x7687('0x3')],_0x113661)===-0x1){_0x406b4f[_0x7687('0x29')](_0x113661);}}if(_0x406b4f[_0x7687('0x26')]){var _0x12a5f7=_0x406b4f[_0x7687('0x2a')](compareVersions);var _0xaede63=new Umzug({'storage':_0x7687('0x2b'),'storageOptions':{'model':db[_0x7687('0x2c')],'modelName':_0x7687('0x2c'),'columnName':_0x7687('0x3')},'migrations':{'params':[db[_0x7687('0x2b')][_0x7687('0x2d')](),db[_0x7687('0x2b')][_0x7687('0x2e')],function(){throw new Error(_0x7687('0x2f'));}],'path':path[_0x7687('0x23')](config[_0x7687('0x24')],_0x7687('0x25'),'migrations'),'pattern':/\.js$/}});_0xaede63['up']({'migrations':_[_0x7687('0x30')](_0x12a5f7,function(_0x29cafb){return _0x29cafb+_0x7687('0x28');})})[_0x7687('0x1f')](function(){return _0x2586d5[_0x7687('0x11')](0xc8)[_0x7687('0x12')]({'output':_0x7687('0x31')+module['exports'][_0x7687('0x3')]+_0x7687('0x32')+_[_0x7687('0x33')](_0x12a5f7),'migrations':_[_0x7687('0x23')](_0x12a5f7)});})[_0x7687('0x20')](function(_0x32e633){if(_0x32e633 instanceof db[_0x7687('0x2b')]['UniqueConstraintError']){return _0x2586d5[_0x7687('0x11')](0xc8)[_0x7687('0x12')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x2586d5['status'](0x1f4)[_0x7687('0x12')](_0x32e633);}});}else{return _0x2586d5[_0x7687('0x11')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x6d08=['exports','query','fetch','latest','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','pull','npm\x20install\x20--production','restart','then','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','root','server','length','replace','.js','push','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','catch','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','index'];(function(_0x401d67,_0xeb1592){var _0x25076b=function(_0x233577){while(--_0x233577){_0x401d67['push'](_0x401d67['shift']());}};_0x25076b(++_0xeb1592);}(_0x6d08,0x95));var _0x86d0=function(_0x5bc220,_0x1bead5){_0x5bc220=_0x5bc220-0x0;var _0x3736c4=_0x6d08[_0x5bc220];return _0x3736c4;};'use strict';var Umzug=require('umzug');var path=require(_0x86d0('0x0'));var fs=require('fs');var _=require(_0x86d0('0x1'));var pkginfo=require(_0x86d0('0x2'))(module,_0x86d0('0x3'));var compareVersions=require(_0x86d0('0x4'));var exec=require(_0x86d0('0x5'))[_0x86d0('0x6')];var db=require(_0x86d0('0x7'))['db'];var config=require('../../config/environment');var pm2=require(_0x86d0('0x8'));var logger=require(_0x86d0('0x9'))(_0x86d0('0xa'));var git=require(_0x86d0('0xb'))(config['root']);exports[_0x86d0('0xc')]=function(_0x166c35,_0xace8e4){var _0x3afdd4={'current':module[_0x86d0('0xd')][_0x86d0('0x3')],'phonebar':0x2};if(_0x166c35[_0x86d0('0xe')]&&_0x166c35[_0x86d0('0xe')]['latest']){return git[_0x86d0('0xf')]()['tags'](function(_0x259292,_0x48af84){_0x3afdd4[_0x86d0('0x10')]=(_0x259292?module['exports'][_0x86d0('0x3')]:_0x48af84['latest'])||_0x86d0('0x11');return _0xace8e4[_0x86d0('0x12')](0xc8)['json'](_0x3afdd4);});}else{return _0xace8e4[_0x86d0('0x12')](0xc8)[_0x86d0('0x13')](_0x3afdd4);}};exports[_0x86d0('0xf')]=function(_0x13da88,_0x35f6dd){return git[_0x86d0('0xf')]([_0x86d0('0x14'),_0x86d0('0x15')],function(_0x26004d){if(_0x26004d){logger[_0x86d0('0x16')](_0x26004d);return _0x35f6dd['status'](0x1f4)[_0x86d0('0x13')](_0x26004d);}logger[_0x86d0('0x17')](_0x86d0('0x18'));return _0x35f6dd[_0x86d0('0x12')](0xc8)[_0x86d0('0x13')]({'output':_0x86d0('0x19')});});};exports[_0x86d0('0x1a')]=function(_0x6d0e27,_0x1c32a0){return git[_0x86d0('0x1a')]([_0x86d0('0x1b'),_0x86d0('0x1c')],function(_0xf7e63b){if(_0xf7e63b){logger[_0x86d0('0x16')](_0xf7e63b);return _0x1c32a0[_0x86d0('0x12')](0x1f4)['json'](_0xf7e63b);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x1c32a0[_0x86d0('0x12')](0xc8)[_0x86d0('0x13')]({'output':'git\x20reset\x20--hard'});});};exports[_0x86d0('0x1d')]=function(_0x33840f,_0x34cc64){exec(_0x86d0('0x1e'),function(_0x15a7e5,_0x56d6ed,_0x566778){logger['info'](_0x56d6ed);logger['info'](_0x566778);if(_0x15a7e5){logger[_0x86d0('0x16')](_0x15a7e5);return _0x34cc64[_0x86d0('0x12')](0x1f4)[_0x86d0('0x13')](_0x15a7e5);}return _0x34cc64[_0x86d0('0x12')](0xc8)['json']({'output':_0x56d6ed});});};exports[_0x86d0('0x1f')]=function(_0x4a30b0,_0x4d13c8){return pm2[_0x86d0('0x1f')]('motion2')[_0x86d0('0x20')](function(_0x3bb4e1){logger[_0x86d0('0x17')]('pm2\x20restart\x20motion\x20%s',_0x3bb4e1);return _0x4d13c8[_0x86d0('0x12')](0xc8)[_0x86d0('0x13')]({'output':_0x86d0('0x21')});})['catch'](function(_0x5be963){logger['error'](_0x5be963);return _0x4d13c8[_0x86d0('0x12')](0x1f4)[_0x86d0('0x13')](_0x5be963);});};exports[_0x86d0('0x22')]=function(_0x380743,_0x3ca902){var _0x39dedc=fs[_0x86d0('0x23')](path['join'](config[_0x86d0('0x24')],_0x86d0('0x25'),_0x86d0('0x22')));var _0x6be80b=[];for(var _0x3da09d=0x0;_0x3da09d<_0x39dedc[_0x86d0('0x26')];_0x3da09d++){var _0x44b6ef=_0x39dedc[_0x3da09d][_0x86d0('0x27')](_0x86d0('0x28'),'');if(compareVersions(module[_0x86d0('0xd')][_0x86d0('0x3')],_0x44b6ef)===-0x1){_0x6be80b[_0x86d0('0x29')](_0x44b6ef);}}if(_0x6be80b['length']){var _0x3dfcdc=_0x6be80b[_0x86d0('0x2a')](compareVersions);var _0x34390b=new Umzug({'storage':_0x86d0('0x2b'),'storageOptions':{'model':db[_0x86d0('0x2c')],'modelName':_0x86d0('0x2c'),'columnName':_0x86d0('0x3')},'migrations':{'params':[db[_0x86d0('0x2b')]['getQueryInterface'](),db[_0x86d0('0x2b')][_0x86d0('0x2d')],function(){throw new Error(_0x86d0('0x2e'));}],'path':path[_0x86d0('0x2f')](config[_0x86d0('0x24')],_0x86d0('0x25'),_0x86d0('0x22')),'pattern':/\.js$/}});_0x34390b['up']({'migrations':_[_0x86d0('0x30')](_0x3dfcdc,function(_0x4dd1f8){return _0x4dd1f8+_0x86d0('0x28');})})[_0x86d0('0x20')](function(){return _0x3ca902[_0x86d0('0x12')](0xc8)['json']({'output':_0x86d0('0x31')+module[_0x86d0('0xd')][_0x86d0('0x3')]+_0x86d0('0x32')+_['last'](_0x3dfcdc),'migrations':_[_0x86d0('0x2f')](_0x3dfcdc)});})[_0x86d0('0x33')](function(_0x33e75a){if(_0x33e75a instanceof db[_0x86d0('0x2b')][_0x86d0('0x34')]){return _0x3ca902[_0x86d0('0x12')](0xc8)[_0x86d0('0x13')]({'output':_0x86d0('0x35')});}else{return _0x3ca902[_0x86d0('0x12')](0x1f4)[_0x86d0('0x13')](_0x33e75a);}});}else{return _0x3ca902[_0x86d0('0x12')](0xc8)[_0x86d0('0x13')]({'output':_0x86d0('0x35')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index a771ccc..be167ef 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 _0x2b3c=['index','/describe','describe','/:id','show','post','put','update','delete','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated'];(function(_0x1ae4a9,_0x4c0ed9){var _0x54d0b0=function(_0x4fff20){while(--_0x4fff20){_0x1ae4a9['push'](_0x1ae4a9['shift']());}};_0x54d0b0(++_0x4c0ed9);}(_0x2b3c,0x1be));var _0xc2b3=function(_0xcca9e4,_0x57ccb4){_0xcca9e4=_0xcca9e4-0x0;var _0xa83bda=_0x2b3c[_0xcca9e4];return _0xa83bda;};'use strict';var multer=require(_0xc2b3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc2b3('0x1'));var express=require('express');var router=express[_0xc2b3('0x2')]();var fs_extra=require(_0xc2b3('0x3'));var auth=require(_0xc2b3('0x4'));var interaction=require(_0xc2b3('0x5'));var config=require(_0xc2b3('0x6'));var controller=require(_0xc2b3('0x7'));router[_0xc2b3('0x8')]('/',auth[_0xc2b3('0x9')](),controller[_0xc2b3('0xa')]);router[_0xc2b3('0x8')](_0xc2b3('0xb'),auth[_0xc2b3('0x9')](),controller[_0xc2b3('0xc')]);router[_0xc2b3('0x8')](_0xc2b3('0xd'),auth[_0xc2b3('0x9')](),controller[_0xc2b3('0xe')]);router[_0xc2b3('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc2b3('0x10')](_0xc2b3('0xd'),auth[_0xc2b3('0x9')](),controller[_0xc2b3('0x11')]);router[_0xc2b3('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9378=['show','post','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','index','/describe','isAuthenticated'];(function(_0x1c223c,_0x3cef2f){var _0x141766=function(_0x5c09ed){while(--_0x5c09ed){_0x1c223c['push'](_0x1c223c['shift']());}};_0x141766(++_0x3cef2f);}(_0x9378,0x14a));var _0x8937=function(_0xa9b07,_0x134e8a){_0xa9b07=_0xa9b07-0x0;var _0x1cc77b=_0x9378[_0xa9b07];return _0x1cc77b;};'use strict';var multer=require(_0x8937('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8937('0x1'));var express=require(_0x8937('0x2'));var router=express[_0x8937('0x3')]();var fs_extra=require(_0x8937('0x4'));var auth=require(_0x8937('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8937('0x6'));var controller=require(_0x8937('0x7'));router[_0x8937('0x8')]('/',auth['isAuthenticated'](),controller[_0x8937('0x9')]);router[_0x8937('0x8')](_0x8937('0xa'),auth[_0x8937('0xb')](),controller['describe']);router[_0x8937('0x8')]('/:id',auth[_0x8937('0xb')](),controller[_0x8937('0xc')]);router[_0x8937('0xd')]('/',auth[_0x8937('0xb')](),controller['create']);router[_0x8937('0xe')]('/:id',auth[_0x8937('0xb')](),controller[_0x8937('0xf')]);router[_0x8937('0x10')]('/:id',auth[_0x8937('0xb')](),controller[_0x8937('0x11')]);module[_0x8937('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index f5dd39b..0d5ceb5 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 _0xa8b1=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x2d1dcd,_0x20ae0f){var _0x2a5a40=function(_0x51bbe7){while(--_0x51bbe7){_0x2d1dcd['push'](_0x2d1dcd['shift']());}};_0x2a5a40(++_0x20ae0f);}(_0xa8b1,0x182));var _0x1a8b=function(_0x3aa33b,_0x188c63){_0x3aa33b=_0x3aa33b-0x0;var _0x7f7d9f=_0xa8b1[_0x3aa33b];return _0x7f7d9f;};'use strict';var Sequelize=require(_0x1a8b('0x0'));module[_0x1a8b('0x1')]={'type':{'type':Sequelize[_0x1a8b('0x2')]},'uniqueid':{'type':Sequelize[_0x1a8b('0x2')]},'calleridnum':{'type':Sequelize[_0x1a8b('0x2')]},'calleridname':{'type':Sequelize[_0x1a8b('0x2')]},'queue':{'type':Sequelize[_0x1a8b('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x1a8b('0x3')]},'agentconnectAt':{'type':Sequelize[_0x1a8b('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x1a8b('0x3')]},'agentdumpAt':{'type':Sequelize[_0x1a8b('0x3')]},'holdtime':{'type':Sequelize[_0x1a8b('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x1a8b('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x1a8b('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x1a8b('0x4')]},'agentacw':{'type':Sequelize[_0x1a8b('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1a8b('0x4')]},'reason':{'type':Sequelize[_0x1a8b('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1a8b('0x2')]},'channelstate':{'type':Sequelize[_0x1a8b('0x4')]},'channelstatedesc':{'type':Sequelize[_0x1a8b('0x2')]},'connectedlinenum':{'type':Sequelize[_0x1a8b('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x1a8b('0x2')]},'accountcode':{'type':Sequelize[_0x1a8b('0x2')]},'context':{'type':Sequelize[_0x1a8b('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x1a8b('0x2')]},'destchannelstate':{'type':Sequelize[_0x1a8b('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x1a8b('0x2')]},'destcalleridname':{'type':Sequelize[_0x1a8b('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x1a8b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x1a8b('0x2')]},'destlanguage':{'type':Sequelize[_0x1a8b('0x2')]},'destaccountcode':{'type':Sequelize[_0x1a8b('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x1a8b('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x1a8b('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x1a8b('0x2')]},'transfer':{'type':Sequelize[_0x1a8b('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x1a8b('0x2')],'comment':_0x1a8b('0x6')},'transferexten':{'type':Sequelize[_0x1a8b('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x1a8b('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf7d9=['BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x53b122,_0x80bb3d){var _0x15f954=function(_0x27f9b4){while(--_0x27f9b4){_0x53b122['push'](_0x53b122['shift']());}};_0x15f954(++_0x80bb3d);}(_0xf7d9,0x122));var _0x9f7d=function(_0x2f1690,_0xf2c5fe){_0x2f1690=_0x2f1690-0x0;var _0x4ff2eb=_0xf7d9[_0x2f1690];return _0x4ff2eb;};'use strict';var Sequelize=require(_0x9f7d('0x0'));module[_0x9f7d('0x1')]={'type':{'type':Sequelize[_0x9f7d('0x2')]},'uniqueid':{'type':Sequelize[_0x9f7d('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x9f7d('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9f7d('0x2')]},'agentcalledAt':{'type':Sequelize[_0x9f7d('0x3')]},'agentconnectAt':{'type':Sequelize[_0x9f7d('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x9f7d('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x9f7d('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x9f7d('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x9f7d('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x9f7d('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x9f7d('0x5')]},'agentacw':{'type':Sequelize[_0x9f7d('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x9f7d('0x5')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x9f7d('0x2')]},'channel':{'type':Sequelize[_0x9f7d('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x9f7d('0x2')]},'connectedlinenum':{'type':Sequelize[_0x9f7d('0x2')]},'connectedlinename':{'type':Sequelize[_0x9f7d('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9f7d('0x2')]},'context':{'type':Sequelize[_0x9f7d('0x2')]},'exten':{'type':Sequelize[_0x9f7d('0x2')]},'priority':{'type':Sequelize[_0x9f7d('0x2')]},'destchannel':{'type':Sequelize[_0x9f7d('0x2')]},'destchannelstate':{'type':Sequelize[_0x9f7d('0x5')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x9f7d('0x2')]},'destcalleridname':{'type':Sequelize[_0x9f7d('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x9f7d('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x9f7d('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x9f7d('0x2')]},'destcontext':{'type':Sequelize[_0x9f7d('0x2')]},'destexten':{'type':Sequelize[_0x9f7d('0x2')]},'destpriority':{'type':Sequelize[_0x9f7d('0x2')]},'destuniqueid':{'type':Sequelize[_0x9f7d('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x9f7d('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x9f7d('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x9f7d('0x6')},'transferexten':{'type':Sequelize[_0x9f7d('0x2')]},'transferuniqueid':{'type':Sequelize[_0x9f7d('0x2')]},'agententerreason':{'type':Sequelize[_0x9f7d('0x5')],'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 30a6e4c..2aec6c7 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(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 03da8d0..cc1f348 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 _0xfd87=['path','rimraf','../../config/environment','./voiceAgentReport.attributes','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7fd8('0x0'));var util=require(_0x7fd8('0x1'));var logger=require(_0x7fd8('0x2'))(_0x7fd8('0x3'));var moment=require(_0x7fd8('0x4'));var BPromise=require(_0x7fd8('0x5'));var rp=require(_0x7fd8('0x6'));var fs=require('fs');var path=require(_0x7fd8('0x7'));var rimraf=require(_0x7fd8('0x8'));var config=require(_0x7fd8('0x9'));var attributes=require(_0x7fd8('0xa'));module['exports']=function(_0x1395b6,_0x10a778){return _0x1395b6['define'](_0x7fd8('0xb'),attributes,{'tableName':_0x7fd8('0xc'),'paranoid':![],'indexes':[{'fields':[_0x7fd8('0xd'),_0x7fd8('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf006=['./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','destuniqueid','../../config/logger','api','bluebird','path'];(function(_0x53d1e4,_0x534613){var _0x507fbf=function(_0xe85f4e){while(--_0xe85f4e){_0x53d1e4['push'](_0x53d1e4['shift']());}};_0x507fbf(++_0x534613);}(_0xf006,0x146));var _0x6f00=function(_0x32eb22,_0x362767){_0x32eb22=_0x32eb22-0x0;var _0x8929fa=_0xf006[_0x32eb22];return _0x8929fa;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6f00('0x0'))(_0x6f00('0x1'));var moment=require('moment');var BPromise=require(_0x6f00('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f00('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6f00('0x4'));module[_0x6f00('0x5')]=function(_0x141e71,_0x52c9a2){return _0x141e71[_0x6f00('0x6')]('VoiceAgentReport',attributes,{'tableName':_0x6f00('0x7'),'paranoid':![],'indexes':[{'fields':[_0x6f00('0x8'),_0x6f00('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 84de941..fbf2991 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 _0xd1c1=['where','attributes','limit','UpdateVoiceAgentReport','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','update','body'];(function(_0x1dccbc,_0x427fb9){var _0x533e4f=function(_0x361af5){while(--_0x361af5){_0x1dccbc['push'](_0x1dccbc['shift']());}};_0x533e4f(++_0x427fb9);}(_0xd1c1,0x1c5));var _0x1d1c=function(_0x40822a,_0x582b60){_0x40822a=_0x40822a-0x0;var _0x357420=_0xd1c1[_0x40822a];return _0x357420;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1d1c('0x0'));var BPromise=require('bluebird');var rs=require(_0x1d1c('0x1'));var fs=require('fs');var Redis=require(_0x1d1c('0x2'));var db=require(_0x1d1c('0x3'))['db'];var utils=require(_0x1d1c('0x4'));var logger=require(_0x1d1c('0x5'))(_0x1d1c('0x6'));var config=require(_0x1d1c('0x7'));var jayson=require(_0x1d1c('0x8'));var client=jayson['client'][_0x1d1c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x534dc6,_0x5e7d92,_0xe06221){return new BPromise(function(_0x258a8e,_0x2e90f2){return client[_0x1d1c('0xa')](_0x534dc6,_0xe06221)[_0x1d1c('0xb')](function(_0x468434){logger[_0x1d1c('0xc')](_0x1d1c('0xd'),_0x5e7d92,'request\x20sent');logger[_0x1d1c('0xe')](_0x1d1c('0xf'),_0x5e7d92,'request\x20sent',JSON[_0x1d1c('0x10')](_0x468434));if(_0x468434[_0x1d1c('0x11')]){if(_0x468434[_0x1d1c('0x11')]['code']===0x1f4){logger[_0x1d1c('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x5e7d92,_0x468434[_0x1d1c('0x11')][_0x1d1c('0x12')]);return _0x2e90f2(_0x468434['error'][_0x1d1c('0x12')]);}logger[_0x1d1c('0x11')](_0x1d1c('0xd'),_0x5e7d92,_0x468434[_0x1d1c('0x11')][_0x1d1c('0x12')]);return _0x258a8e(_0x468434['error']['message']);}else{logger['info'](_0x1d1c('0xd'),_0x5e7d92,_0x1d1c('0x13'));_0x258a8e(_0x468434['result'][_0x1d1c('0x12')]);}})['catch'](function(_0x98fba3){logger[_0x1d1c('0x11')](_0x1d1c('0xd'),_0x5e7d92,_0x98fba3);_0x2e90f2(_0x98fba3);});});}exports[_0x1d1c('0x14')]=function(_0x46b539){var _0x38fd1c=this;return new Promise(function(_0x594748,_0x3e64d0){return db[_0x1d1c('0x15')][_0x1d1c('0x16')](_0x46b539['body'],{'raw':_0x46b539[_0x1d1c('0x17')]?_0x46b539['options'][_0x1d1c('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x1ca309){logger[_0x1d1c('0xc')](_0x1d1c('0x14'),_0x46b539);logger[_0x1d1c('0xe')](_0x1d1c('0x14'),_0x46b539,JSON['stringify'](_0x1ca309));_0x594748(_0x1ca309);})['catch'](function(_0x118d0a){logger[_0x1d1c('0x11')](_0x1d1c('0x14'),_0x118d0a[_0x1d1c('0x12')],_0x46b539);_0x3e64d0(_0x38fd1c[_0x1d1c('0x11')](0x1f4,_0x118d0a[_0x1d1c('0x12')]));});});};exports['UpdateVoiceAgentReport']=function(_0x3185d3){var _0x150a73=this;return new Promise(function(_0x5b1825,_0x8f24d2){return db[_0x1d1c('0x15')][_0x1d1c('0x19')](_0x3185d3[_0x1d1c('0x1a')],{'raw':_0x3185d3[_0x1d1c('0x17')]?_0x3185d3[_0x1d1c('0x17')][_0x1d1c('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3185d3['options']?_0x3185d3[_0x1d1c('0x17')][_0x1d1c('0x1b')]||null:null,'attributes':_0x3185d3['options']?_0x3185d3[_0x1d1c('0x17')][_0x1d1c('0x1c')]||null:null,'limit':_0x3185d3[_0x1d1c('0x17')]?_0x3185d3['options'][_0x1d1c('0x1d')]||null:null})['then'](function(_0x3e92de){logger['info']('UpdateVoiceAgentReport',_0x3185d3);logger[_0x1d1c('0xe')](_0x1d1c('0x1e'),_0x3185d3,JSON[_0x1d1c('0x10')](_0x3e92de));_0x5b1825(_0x3e92de);})[_0x1d1c('0x1f')](function(_0x510d36){logger['error']('UpdateVoiceAgentReport',_0x510d36['message'],_0x3185d3);_0x8f24d2(_0x150a73[_0x1d1c('0x11')](0x1f4,_0x510d36[_0x1d1c('0x12')]));});});}; \ No newline at end of file +var _0x4960=['VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateVoiceAgentReport','VoiceAgentReport','create','body','debug','catch','update','options','where','attributes','limit','UpdateVoiceAgentReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info'];(function(_0xebb1cd,_0x550111){var _0x516042=function(_0x3990bb){while(--_0x3990bb){_0xebb1cd['push'](_0xebb1cd['shift']());}};_0x516042(++_0x550111);}(_0x4960,0x11b));var _0x0496=function(_0xc1ecb5,_0x5742e5){_0xc1ecb5=_0xc1ecb5-0x0;var _0x2cff12=_0x4960[_0xc1ecb5];return _0x2cff12;};'use strict';var _=require(_0x0496('0x0'));var util=require('util');var moment=require(_0x0496('0x1'));var BPromise=require(_0x0496('0x2'));var rs=require(_0x0496('0x3'));var fs=require('fs');var Redis=require(_0x0496('0x4'));var db=require(_0x0496('0x5'))['db'];var utils=require(_0x0496('0x6'));var logger=require(_0x0496('0x7'))(_0x0496('0x8'));var config=require(_0x0496('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0496('0xa')][_0x0496('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dad2d,_0x55b0ed,_0x352c23){return new BPromise(function(_0xdff7de,_0x442535){return client['request'](_0x5dad2d,_0x352c23)[_0x0496('0xc')](function(_0x5bff62){logger[_0x0496('0xd')](_0x0496('0xe'),_0x55b0ed,_0x0496('0xf'));logger['debug'](_0x0496('0x10'),_0x55b0ed,_0x0496('0xf'),JSON[_0x0496('0x11')](_0x5bff62));if(_0x5bff62[_0x0496('0x12')]){if(_0x5bff62[_0x0496('0x12')]['code']===0x1f4){logger[_0x0496('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x55b0ed,_0x5bff62[_0x0496('0x12')][_0x0496('0x13')]);return _0x442535(_0x5bff62[_0x0496('0x12')]['message']);}logger[_0x0496('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x55b0ed,_0x5bff62['error'][_0x0496('0x13')]);return _0xdff7de(_0x5bff62['error'][_0x0496('0x13')]);}else{logger['info'](_0x0496('0xe'),_0x55b0ed,_0x0496('0xf'));_0xdff7de(_0x5bff62[_0x0496('0x14')][_0x0496('0x13')]);}})['catch'](function(_0x338e85){logger['error'](_0x0496('0xe'),_0x55b0ed,_0x338e85);_0x442535(_0x338e85);});});}exports[_0x0496('0x15')]=function(_0x4e7958){var _0xdcdf4a=this;return new Promise(function(_0x49adc7,_0x4a89f8){return db[_0x0496('0x16')][_0x0496('0x17')](_0x4e7958[_0x0496('0x18')],{'raw':_0x4e7958['options']?_0x4e7958['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x14b22d){logger['info'](_0x0496('0x15'),_0x4e7958);logger[_0x0496('0x19')](_0x0496('0x15'),_0x4e7958,JSON[_0x0496('0x11')](_0x14b22d));_0x49adc7(_0x14b22d);})[_0x0496('0x1a')](function(_0x5da76f){logger[_0x0496('0x12')](_0x0496('0x15'),_0x5da76f[_0x0496('0x13')],_0x4e7958);_0x4a89f8(_0xdcdf4a[_0x0496('0x12')](0x1f4,_0x5da76f[_0x0496('0x13')]));});});};exports['UpdateVoiceAgentReport']=function(_0x20275f){var _0xb082cd=this;return new Promise(function(_0x36a6be,_0x2ef14e){return db['VoiceAgentReport'][_0x0496('0x1b')](_0x20275f[_0x0496('0x18')],{'raw':_0x20275f[_0x0496('0x1c')]?_0x20275f[_0x0496('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20275f[_0x0496('0x1c')]?_0x20275f[_0x0496('0x1c')][_0x0496('0x1d')]||null:null,'attributes':_0x20275f[_0x0496('0x1c')]?_0x20275f[_0x0496('0x1c')][_0x0496('0x1e')]||null:null,'limit':_0x20275f[_0x0496('0x1c')]?_0x20275f['options'][_0x0496('0x1f')]||null:null})[_0x0496('0xc')](function(_0x40ee57){logger[_0x0496('0xd')]('UpdateVoiceAgentReport',_0x20275f);logger[_0x0496('0x19')](_0x0496('0x20'),_0x20275f,JSON[_0x0496('0x11')](_0x40ee57));_0x36a6be(_0x40ee57);})[_0x0496('0x1a')](function(_0x1a0fc2){logger[_0x0496('0x12')](_0x0496('0x20'),_0x1a0fc2['message'],_0x20275f);_0x2ef14e(_0xb082cd['error'](0x1f4,_0x1a0fc2[_0x0496('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 6b15687..bdf0186 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 _0xa630=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','/describe'];(function(_0x17b0f6,_0x1cace2){var _0x10f645=function(_0x3307fd){while(--_0x3307fd){_0x17b0f6['push'](_0x17b0f6['shift']());}};_0x10f645(++_0x1cace2);}(_0xa630,0xbe));var _0x0a63=function(_0x19cfc0,_0x2a0e2e){_0x19cfc0=_0x19cfc0-0x0;var _0x2350bd=_0xa630[_0x19cfc0];return _0x2350bd;};'use strict';var multer=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a63('0x2'));var router=express['Router']();var fs_extra=require(_0x0a63('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var controller=require(_0x0a63('0x6'));router[_0x0a63('0x7')]('/',auth[_0x0a63('0x8')](),controller['index']);router[_0x0a63('0x7')](_0x0a63('0x9'),auth[_0x0a63('0x8')](),controller[_0x0a63('0xa')]);router[_0x0a63('0x7')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0xc')]);router[_0x0a63('0xd')]('/',auth[_0x0a63('0x8')](),controller[_0x0a63('0xe')]);router[_0x0a63('0xf')](_0x0a63('0xb'),auth[_0x0a63('0x8')](),controller[_0x0a63('0x10')]);router[_0x0a63('0x11')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0x12')]);module[_0x0a63('0x13')]=router; \ No newline at end of file +var _0xc978=['/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x39156e,_0x275f1d){var _0x2bfe85=function(_0x84460d){while(--_0x84460d){_0x39156e['push'](_0x39156e['shift']());}};_0x2bfe85(++_0x275f1d);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var path=require(_0x8c97('0x2'));var timeout=require(_0x8c97('0x3'));var express=require(_0x8c97('0x4'));var router=express[_0x8c97('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8c97('0x6'));var interaction=require(_0x8c97('0x7'));var config=require(_0x8c97('0x8'));var controller=require(_0x8c97('0x9'));router[_0x8c97('0xa')]('/',auth[_0x8c97('0xb')](),controller[_0x8c97('0xc')]);router['get'](_0x8c97('0xd'),auth[_0x8c97('0xb')](),controller[_0x8c97('0xe')]);router[_0x8c97('0xa')](_0x8c97('0xf'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x10')]);router['post']('/',auth[_0x8c97('0xb')](),controller[_0x8c97('0x11')]);router[_0x8c97('0x12')](_0x8c97('0xf'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x13')]);router[_0x8c97('0x14')](_0x8c97('0xf'),auth[_0x8c97('0xb')](),controller['destroy']);module[_0x8c97('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index da72d45..e07e207 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 _0x9626=['outbound','inbound-fax','outbound-fax','dialer','DATE','INTEGER','sequelize','exports','STRING','inbound'];(function(_0x22d01a,_0x23e5b7){var _0x56ab8a=function(_0x32cd73){while(--_0x32cd73){_0x22d01a['push'](_0x22d01a['shift']());}};_0x56ab8a(++_0x23e5b7);}(_0x9626,0x196));var _0x6962=function(_0x3729d7,_0x1443a7){_0x3729d7=_0x3729d7-0x0;var _0x1b852e=_0x9626[_0x3729d7];return _0x1b852e;};'use strict';var Sequelize=require(_0x6962('0x0'));module[_0x6962('0x1')]={'uniqueid':{'type':Sequelize[_0x6962('0x2')]},'type':{'type':Sequelize['ENUM'](_0x6962('0x3'),'internal',_0x6962('0x4'),_0x6962('0x5'),_0x6962('0x6'),_0x6962('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x6962('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x6962('0x2')]},'destinationcontext':{'type':Sequelize[_0x6962('0x2')]},'callerid':{'type':Sequelize[_0x6962('0x2')]},'channel':{'type':Sequelize[_0x6962('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x6962('0x8')]},'systemanswertime':{'type':Sequelize[_0x6962('0x8')]},'answertime':{'type':Sequelize[_0x6962('0x8')]},'endtime':{'type':Sequelize[_0x6962('0x8')]},'duration':{'type':Sequelize[_0x6962('0x9')]},'billableseconds':{'type':Sequelize[_0x6962('0x9')]},'mohtime':{'type':Sequelize[_0x6962('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x6962('0x2')]},'userDisposition':{'type':Sequelize[_0x6962('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x6962('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x6962('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x6962('0x2')]},'routeid':{'type':Sequelize[_0x6962('0x9')]},'sipcallid':{'type':Sequelize[_0x6962('0x2')]}}; \ No newline at end of file +var _0x3fa7=['INTEGER','sequelize','exports','STRING','ENUM','inbound','outbound','inbound-fax','dialer','TEXT','DATE'];(function(_0x21d0c3,_0x16c71c){var _0x4df18e=function(_0x576bfe){while(--_0x576bfe){_0x21d0c3['push'](_0x21d0c3['shift']());}};_0x4df18e(++_0x16c71c);}(_0x3fa7,0x198));var _0x73fa=function(_0x448029,_0x28081c){_0x448029=_0x448029-0x0;var _0x5c5b5c=_0x3fa7[_0x448029];return _0x5c5b5c;};'use strict';var Sequelize=require(_0x73fa('0x0'));module[_0x73fa('0x1')]={'uniqueid':{'type':Sequelize[_0x73fa('0x2')]},'type':{'type':Sequelize[_0x73fa('0x3')](_0x73fa('0x4'),'internal',_0x73fa('0x5'),_0x73fa('0x6'),'outbound-fax',_0x73fa('0x7'))},'tag':{'type':Sequelize[_0x73fa('0x2')]},'accountcode':{'type':Sequelize[_0x73fa('0x2')]},'source':{'type':Sequelize[_0x73fa('0x2')]},'destination':{'type':Sequelize[_0x73fa('0x2')]},'destinationcontext':{'type':Sequelize[_0x73fa('0x2')]},'callerid':{'type':Sequelize[_0x73fa('0x2')]},'channel':{'type':Sequelize[_0x73fa('0x2')]},'destinationchannel':{'type':Sequelize[_0x73fa('0x2')]},'lastapplication':{'type':Sequelize[_0x73fa('0x2')]},'lastdata':{'type':Sequelize[_0x73fa('0x8')]},'starttime':{'type':Sequelize[_0x73fa('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x73fa('0x9')]},'endtime':{'type':Sequelize[_0x73fa('0x9')]},'duration':{'type':Sequelize[_0x73fa('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x73fa('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x73fa('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x73fa('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x73fa('0x2')]},'prefix':{'type':Sequelize[_0x73fa('0x2')]},'routeid':{'type':Sequelize[_0x73fa('0xa')]},'sipcallid':{'type':Sequelize[_0x73fa('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index fa41c82..1d4617b 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 _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f66[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file +var _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5f66[_0x5f0089];return _0x193892;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 0d85239..9e04967 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 _0x96eb=['./voiceCallReport.attributes','exports','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4d4cab,_0x24ac20){var _0x1e9e65=function(_0x41be9b){while(--_0x41be9b){_0x4d4cab['push'](_0x4d4cab['shift']());}};_0x1e9e65(++_0x24ac20);}(_0x96eb,0x113));var _0xb96e=function(_0x13bb4b,_0x5eca61){_0x13bb4b=_0x13bb4b-0x0;var _0x53de6c=_0x96eb[_0x13bb4b];return _0x53de6c;};'use strict';var _=require(_0xb96e('0x0'));var util=require(_0xb96e('0x1'));var logger=require(_0xb96e('0x2'))(_0xb96e('0x3'));var moment=require(_0xb96e('0x4'));var BPromise=require(_0xb96e('0x5'));var rp=require(_0xb96e('0x6'));var fs=require('fs');var path=require(_0xb96e('0x7'));var rimraf=require(_0xb96e('0x8'));var config=require(_0xb96e('0x9'));var attributes=require(_0xb96e('0xa'));module[_0xb96e('0xb')]=function(_0xbda7a7,_0x2f6997){return _0xbda7a7['define'](_0xb96e('0xc'),attributes,{'tableName':_0xb96e('0xd'),'paranoid':![],'indexes':[{'fields':[_0xb96e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7cd2=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports','VoiceCallReport','uniqueid'];(function(_0x2d8419,_0x35c250){var _0x186a98=function(_0x2f26d7){while(--_0x2f26d7){_0x2d8419['push'](_0x2d8419['shift']());}};_0x186a98(++_0x35c250);}(_0x7cd2,0x118));var _0x27cd=function(_0x22eae8,_0x1c0ab1){_0x22eae8=_0x22eae8-0x0;var _0x50257a=_0x7cd2[_0x22eae8];return _0x50257a;};'use strict';var _=require('lodash');var util=require(_0x27cd('0x0'));var logger=require(_0x27cd('0x1'))(_0x27cd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x27cd('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x27cd('0x4'));var config=require(_0x27cd('0x5'));var attributes=require(_0x27cd('0x6'));module[_0x27cd('0x7')]=function(_0x2646a9,_0x38098b){return _0x2646a9['define'](_0x27cd('0x8'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x27cd('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 7132214..7af0f82 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 _0x41ea=['attributes','limit','map','model','include','CreateVoiceCallReport','create','body','raw','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where'];(function(_0x22010c,_0x485fee){var _0x2ae378=function(_0x37e542){while(--_0x37e542){_0x22010c['push'](_0x22010c['shift']());}};_0x2ae378(++_0x485fee);}(_0x41ea,0x77));var _0xa41e=function(_0x35ffb5,_0x43415b){_0x35ffb5=_0x35ffb5-0x0;var _0x244c62=_0x41ea[_0x35ffb5];return _0x244c62;};'use strict';var _=require(_0xa41e('0x0'));var util=require(_0xa41e('0x1'));var moment=require(_0xa41e('0x2'));var BPromise=require(_0xa41e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa41e('0x4'))['db'];var utils=require(_0xa41e('0x5'));var logger=require('../../config/logger')(_0xa41e('0x6'));var config=require(_0xa41e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa41e('0x8')][_0xa41e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1df862,_0x3939a3,_0x15d0eb){return new BPromise(function(_0x2b71ae,_0x3b32a6){return client['request'](_0x1df862,_0x15d0eb)[_0xa41e('0xa')](function(_0xfcab40){logger[_0xa41e('0xb')](_0xa41e('0xc'),_0x3939a3,_0xa41e('0xd'));logger[_0xa41e('0xe')](_0xa41e('0xf'),_0x3939a3,'request\x20sent',JSON[_0xa41e('0x10')](_0xfcab40));if(_0xfcab40[_0xa41e('0x11')]){if(_0xfcab40[_0xa41e('0x11')]['code']===0x1f4){logger[_0xa41e('0x11')](_0xa41e('0xc'),_0x3939a3,_0xfcab40[_0xa41e('0x11')]['message']);return _0x3b32a6(_0xfcab40[_0xa41e('0x11')][_0xa41e('0x12')]);}logger[_0xa41e('0x11')](_0xa41e('0xc'),_0x3939a3,_0xfcab40[_0xa41e('0x11')][_0xa41e('0x12')]);return _0x2b71ae(_0xfcab40[_0xa41e('0x11')]['message']);}else{logger[_0xa41e('0xb')](_0xa41e('0xc'),_0x3939a3,_0xa41e('0xd'));_0x2b71ae(_0xfcab40['result'][_0xa41e('0x12')]);}})[_0xa41e('0x13')](function(_0x11b714){logger[_0xa41e('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x3939a3,_0x11b714);_0x3b32a6(_0x11b714);});});}exports[_0xa41e('0x14')]=function(_0x514010){var _0x1f25ab=this;return new Promise(function(_0xb27ece,_0x25d698){return db[_0xa41e('0x15')][_0xa41e('0x16')]({'raw':_0x514010[_0xa41e('0x17')]?_0x514010[_0xa41e('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x514010[_0xa41e('0x17')]?_0x514010[_0xa41e('0x17')][_0xa41e('0x18')]||null:null,'attributes':_0x514010['options']?_0x514010[_0xa41e('0x17')][_0xa41e('0x19')]||null:null,'limit':_0x514010[_0xa41e('0x17')]?_0x514010[_0xa41e('0x17')][_0xa41e('0x1a')]||null:null,'include':_0x514010[_0xa41e('0x17')]?_0x514010[_0xa41e('0x17')]['include']?_[_0xa41e('0x1b')](_0x514010[_0xa41e('0x17')]['include'],function(_0x20884b){return{'model':db[_0x20884b[_0xa41e('0x1c')]],'as':_0x20884b['as'],'attributes':_0x20884b[_0xa41e('0x19')],'include':_0x20884b[_0xa41e('0x1d')]?_[_0xa41e('0x1b')](_0x20884b[_0xa41e('0x1d')],function(_0x2484fb){return{'model':db[_0x2484fb[_0xa41e('0x1c')]],'as':_0x2484fb['as'],'attributes':_0x2484fb[_0xa41e('0x19')],'include':_0x2484fb['include']?_[_0xa41e('0x1b')](_0x2484fb[_0xa41e('0x1d')],function(_0x43508b){return{'model':db[_0x43508b['model']],'as':_0x43508b['as'],'attributes':_0x43508b[_0xa41e('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa41e('0xa')](function(_0x3e876f){logger['info']('GetVoiceCallReport',_0x514010);logger[_0xa41e('0xe')]('GetVoiceCallReport',_0x514010,JSON[_0xa41e('0x10')](_0x3e876f));_0xb27ece(_0x3e876f);})[_0xa41e('0x13')](function(_0x2bae67){logger[_0xa41e('0x11')](_0xa41e('0x14'),_0x2bae67[_0xa41e('0x12')],_0x514010);_0x25d698(_0x1f25ab[_0xa41e('0x11')](0x1f4,_0x2bae67['message']));});});};exports[_0xa41e('0x1e')]=function(_0x55c87a){var _0x8551f6=this;return new Promise(function(_0x59ce3f,_0x452305){return db[_0xa41e('0x15')][_0xa41e('0x1f')](_0x55c87a[_0xa41e('0x20')],{'raw':_0x55c87a[_0xa41e('0x17')]?_0x55c87a['options'][_0xa41e('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x579a60){logger[_0xa41e('0xb')]('CreateVoiceCallReport',_0x55c87a);logger[_0xa41e('0xe')](_0xa41e('0x1e'),_0x55c87a,JSON[_0xa41e('0x10')](_0x579a60));_0x59ce3f(_0x579a60);})['catch'](function(_0x36aa12){logger[_0xa41e('0x11')](_0xa41e('0x1e'),_0x36aa12['message'],_0x55c87a);_0x452305(_0x8551f6[_0xa41e('0x11')](0x1f4,_0x36aa12[_0xa41e('0x12')]));});});};exports[_0xa41e('0x22')]=function(_0x33fce1){var _0x978945=this;return new Promise(function(_0x415f65,_0x1510e6){return db[_0xa41e('0x15')][_0xa41e('0x23')](_0x33fce1[_0xa41e('0x20')],{'raw':_0x33fce1[_0xa41e('0x17')]?_0x33fce1['options'][_0xa41e('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33fce1[_0xa41e('0x17')]?_0x33fce1[_0xa41e('0x17')][_0xa41e('0x18')]||null:null,'attributes':_0x33fce1[_0xa41e('0x17')]?_0x33fce1[_0xa41e('0x17')][_0xa41e('0x19')]||null:null,'limit':_0x33fce1[_0xa41e('0x17')]?_0x33fce1[_0xa41e('0x17')][_0xa41e('0x1a')]||null:null})[_0xa41e('0xa')](function(_0x47cc2f){logger[_0xa41e('0xb')](_0xa41e('0x22'),_0x33fce1);logger[_0xa41e('0xe')](_0xa41e('0x22'),_0x33fce1,JSON[_0xa41e('0x10')](_0x47cc2f));_0x415f65(_0x47cc2f);})[_0xa41e('0x13')](function(_0x521e47){logger[_0xa41e('0x11')]('UpdateVoiceCallReport',_0x521e47[_0xa41e('0x12')],_0x33fce1);_0x1510e6(_0x978945[_0xa41e('0x11')](0x1f4,_0x521e47['message']));});});}; \ No newline at end of file +var _0x8f7a=['jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','include','map','model','debug','CreateVoiceCallReport','body','UpdateVoiceCallReport','update','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8f7a,0x68));var _0xa8f7=function(_0x55cc6a,_0x5dbd65){_0x55cc6a=_0x55cc6a-0x0;var _0x26e2cd=_0x8f7a[_0x55cc6a];return _0x26e2cd;};'use strict';var _=require(_0xa8f7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa8f7('0x1'));var rs=require(_0xa8f7('0x2'));var fs=require('fs');var Redis=require(_0xa8f7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8f7('0x4'));var logger=require('../../config/logger')(_0xa8f7('0x5'));var config=require(_0xa8f7('0x6'));var jayson=require(_0xa8f7('0x7'));var client=jayson[_0xa8f7('0x8')][_0xa8f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4033ad,_0x3150ce,_0x586a28){return new BPromise(function(_0x5a220a,_0x17f7d1){return client[_0xa8f7('0xa')](_0x4033ad,_0x586a28)[_0xa8f7('0xb')](function(_0x2d8ad6){logger[_0xa8f7('0xc')](_0xa8f7('0xd'),_0x3150ce,_0xa8f7('0xe'));logger['debug'](_0xa8f7('0xf'),_0x3150ce,_0xa8f7('0xe'),JSON[_0xa8f7('0x10')](_0x2d8ad6));if(_0x2d8ad6[_0xa8f7('0x11')]){if(_0x2d8ad6[_0xa8f7('0x11')][_0xa8f7('0x12')]===0x1f4){logger[_0xa8f7('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x3150ce,_0x2d8ad6['error']['message']);return _0x17f7d1(_0x2d8ad6[_0xa8f7('0x11')]['message']);}logger[_0xa8f7('0x11')](_0xa8f7('0xd'),_0x3150ce,_0x2d8ad6[_0xa8f7('0x11')][_0xa8f7('0x13')]);return _0x5a220a(_0x2d8ad6[_0xa8f7('0x11')]['message']);}else{logger[_0xa8f7('0xc')](_0xa8f7('0xd'),_0x3150ce,_0xa8f7('0xe'));_0x5a220a(_0x2d8ad6[_0xa8f7('0x14')][_0xa8f7('0x13')]);}})[_0xa8f7('0x15')](function(_0x5e5bb0){logger[_0xa8f7('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x3150ce,_0x5e5bb0);_0x17f7d1(_0x5e5bb0);});});}exports[_0xa8f7('0x16')]=function(_0x36af8c){var _0x25b810=this;return new Promise(function(_0x2ed1cf,_0x50dffd){return db[_0xa8f7('0x17')]['findAll']({'raw':_0x36af8c['options']?_0x36af8c[_0xa8f7('0x18')][_0xa8f7('0x19')]===undefined?!![]:![]:!![],'where':_0x36af8c[_0xa8f7('0x18')]?_0x36af8c[_0xa8f7('0x18')][_0xa8f7('0x1a')]||null:null,'attributes':_0x36af8c[_0xa8f7('0x18')]?_0x36af8c[_0xa8f7('0x18')][_0xa8f7('0x1b')]||null:null,'limit':_0x36af8c[_0xa8f7('0x18')]?_0x36af8c[_0xa8f7('0x18')][_0xa8f7('0x1c')]||null:null,'include':_0x36af8c[_0xa8f7('0x18')]?_0x36af8c[_0xa8f7('0x18')][_0xa8f7('0x1d')]?_[_0xa8f7('0x1e')](_0x36af8c[_0xa8f7('0x18')]['include'],function(_0x3a7b74){return{'model':db[_0x3a7b74[_0xa8f7('0x1f')]],'as':_0x3a7b74['as'],'attributes':_0x3a7b74[_0xa8f7('0x1b')],'include':_0x3a7b74[_0xa8f7('0x1d')]?_['map'](_0x3a7b74[_0xa8f7('0x1d')],function(_0xad94fb){return{'model':db[_0xad94fb[_0xa8f7('0x1f')]],'as':_0xad94fb['as'],'attributes':_0xad94fb['attributes'],'include':_0xad94fb[_0xa8f7('0x1d')]?_['map'](_0xad94fb['include'],function(_0x455f64){return{'model':db[_0x455f64[_0xa8f7('0x1f')]],'as':_0x455f64['as'],'attributes':_0x455f64[_0xa8f7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa8f7('0xb')](function(_0x465fd4){logger[_0xa8f7('0xc')](_0xa8f7('0x16'),_0x36af8c);logger[_0xa8f7('0x20')]('GetVoiceCallReport',_0x36af8c,JSON['stringify'](_0x465fd4));_0x2ed1cf(_0x465fd4);})[_0xa8f7('0x15')](function(_0x501d95){logger[_0xa8f7('0x11')](_0xa8f7('0x16'),_0x501d95['message'],_0x36af8c);_0x50dffd(_0x25b810[_0xa8f7('0x11')](0x1f4,_0x501d95[_0xa8f7('0x13')]));});});};exports[_0xa8f7('0x21')]=function(_0x3ff5ef){var _0x285693=this;return new Promise(function(_0x3afbd5,_0xc4734f){return db[_0xa8f7('0x17')]['create'](_0x3ff5ef[_0xa8f7('0x22')],{'raw':_0x3ff5ef[_0xa8f7('0x18')]?_0x3ff5ef[_0xa8f7('0x18')][_0xa8f7('0x19')]===undefined?!![]:![]:!![]})[_0xa8f7('0xb')](function(_0x267ebc){logger[_0xa8f7('0xc')](_0xa8f7('0x21'),_0x3ff5ef);logger['debug'](_0xa8f7('0x21'),_0x3ff5ef,JSON[_0xa8f7('0x10')](_0x267ebc));_0x3afbd5(_0x267ebc);})['catch'](function(_0x48e479){logger[_0xa8f7('0x11')]('CreateVoiceCallReport',_0x48e479[_0xa8f7('0x13')],_0x3ff5ef);_0xc4734f(_0x285693[_0xa8f7('0x11')](0x1f4,_0x48e479[_0xa8f7('0x13')]));});});};exports[_0xa8f7('0x23')]=function(_0xd71194){var _0x30f76c=this;return new Promise(function(_0x563d26,_0x577700){return db[_0xa8f7('0x17')][_0xa8f7('0x24')](_0xd71194[_0xa8f7('0x22')],{'raw':_0xd71194[_0xa8f7('0x18')]?_0xd71194[_0xa8f7('0x18')][_0xa8f7('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd71194['options']?_0xd71194['options'][_0xa8f7('0x1a')]||null:null,'attributes':_0xd71194[_0xa8f7('0x18')]?_0xd71194[_0xa8f7('0x18')][_0xa8f7('0x1b')]||null:null,'limit':_0xd71194['options']?_0xd71194[_0xa8f7('0x18')][_0xa8f7('0x1c')]||null:null})['then'](function(_0x4fe49c){logger[_0xa8f7('0xc')](_0xa8f7('0x23'),_0xd71194);logger[_0xa8f7('0x20')](_0xa8f7('0x23'),_0xd71194,JSON[_0xa8f7('0x10')](_0x4fe49c));_0x563d26(_0x4fe49c);})[_0xa8f7('0x15')](function(_0x3b578d){logger['error']('UpdateVoiceCallReport',_0x3b578d[_0xa8f7('0x13')],_0xd71194);_0x577700(_0x30f76c[_0xa8f7('0x11')](0x1f4,_0x3b578d[_0xa8f7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 17be731..daa3c2c 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 _0x0bc9=['express','Router','fs-extra','./voiceChanSpy.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','destroy','exports','path','connect-timeout'];(function(_0x4caade,_0x549ce1){var _0x2041ff=function(_0x402f3a){while(--_0x402f3a){_0x4caade['push'](_0x4caade['shift']());}};_0x2041ff(++_0x549ce1);}(_0x0bc9,0x130));var _0x90bc=function(_0x2378b1,_0x3f001f){_0x2378b1=_0x2378b1-0x0;var _0x49974d=_0x0bc9[_0x2378b1];return _0x49974d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x90bc('0x0'));var timeout=require(_0x90bc('0x1'));var express=require(_0x90bc('0x2'));var router=express[_0x90bc('0x3')]();var fs_extra=require(_0x90bc('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x90bc('0x5'));router['get']('/',auth[_0x90bc('0x6')](),controller[_0x90bc('0x7')]);router[_0x90bc('0x8')](_0x90bc('0x9'),auth[_0x90bc('0x6')](),controller[_0x90bc('0xa')]);router[_0x90bc('0xb')]('/',auth[_0x90bc('0x6')](),controller[_0x90bc('0xc')]);router['put'](_0x90bc('0x9'),auth[_0x90bc('0x6')](),controller[_0x90bc('0xd')]);router[_0x90bc('0xe')]('/:id',auth[_0x90bc('0x6')](),controller[_0x90bc('0xf')]);module[_0x90bc('0x10')]=router; \ No newline at end of file +var _0x5ef5=['../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x37acd3,_0x14d8f9){var _0xb5a13c=function(_0x3ba8c3){while(--_0x3ba8c3){_0x37acd3['push'](_0x37acd3['shift']());}};_0xb5a13c(++_0x14d8f9);}(_0x5ef5,0x118));var _0x55ef=function(_0x32066d,_0x270f1c){_0x32066d=_0x32066d-0x0;var _0x3d856d=_0x5ef5[_0x32066d];return _0x3d856d;};'use strict';var multer=require('multer');var util=require(_0x55ef('0x0'));var path=require('path');var timeout=require(_0x55ef('0x1'));var express=require(_0x55ef('0x2'));var router=express[_0x55ef('0x3')]();var fs_extra=require(_0x55ef('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x55ef('0x5'));var config=require(_0x55ef('0x6'));var controller=require(_0x55ef('0x7'));router['get']('/',auth[_0x55ef('0x8')](),controller['index']);router[_0x55ef('0x9')](_0x55ef('0xa'),auth[_0x55ef('0x8')](),controller[_0x55ef('0xb')]);router[_0x55ef('0xc')]('/',auth[_0x55ef('0x8')](),controller[_0x55ef('0xd')]);router[_0x55ef('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x55ef('0xf')]);router[_0x55ef('0x10')]('/:id',auth[_0x55ef('0x8')](),controller[_0x55ef('0x11')]);module[_0x55ef('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 0d4ec04..c17629a 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 _0x1ba5=['setDataValue','options','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ba5,0xcd));var _0x51ba=function(_0x207a02,_0x278c56){_0x207a02=_0x207a02-0x0;var _0xd995c3=_0x1ba5[_0x207a02];return _0xd995c3;};'use strict';var Sequelize=require(_0x51ba('0x0'));module[_0x51ba('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x51ba('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x51ba('0x2')],'set':function(_0xc49942){this[_0x51ba('0x3')](_0x51ba('0x4'),_0xc49942?_0xc49942['join'](''):[]);},'get':function(){return this[_0x51ba('0x5')](_0x51ba('0x4'))?this[_0x51ba('0x5')](_0x51ba('0x4'))[_0x51ba('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x51ba('0x2')]},'record':{'type':Sequelize[_0x51ba('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x51ba('0x2')]},'description':{'type':Sequelize[_0x51ba('0x2')]}}; \ No newline at end of file +var _0x441c=['sequelize','exports','name','STRING','setDataValue','options','join','getDataValue','split','BOOLEAN'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x441c,0x8c));var _0xc441=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x441c[_0x257642];return _0x3d813b;};'use strict';var Sequelize=require(_0xc441('0x0'));module[_0xc441('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0xc441('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xc441('0x3')],'set':function(_0x51d816){this[_0xc441('0x4')](_0xc441('0x5'),_0x51d816?_0x51d816[_0xc441('0x6')](''):[]);},'get':function(){return this[_0xc441('0x7')]('options')?this['getDataValue'](_0xc441('0x5'))[_0xc441('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xc441('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xc441('0x3')]},'description':{'type':Sequelize[_0xc441('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 81318c8..b1e2b1b 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 _0x5a8c=['catch','create','body','user','UserProfileSection','autoAssociation','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../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','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','includeAll','show','params','find'];(function(_0xa0d3ad,_0x5623f7){var _0x1fdadd=function(_0x12a923){while(--_0x12a923){_0xa0d3ad['push'](_0xa0d3ad['shift']());}};_0x1fdadd(++_0x5623f7);}(_0x5a8c,0x1da));var _0xc5a8=function(_0x111d75,_0x3baa4c){_0x111d75=_0x111d75-0x0;var _0x17a1e3=_0x5a8c[_0x111d75];return _0x17a1e3;};'use strict';var emlformat=require(_0xc5a8('0x0'));var rimraf=require(_0xc5a8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc5a8('0x2'));var rp=require(_0xc5a8('0x3'));var moment=require(_0xc5a8('0x4'));var BPromise=require(_0xc5a8('0x5'));var Mustache=require('mustache');var util=require(_0xc5a8('0x6'));var path=require(_0xc5a8('0x7'));var sox=require('sox');var csv=require(_0xc5a8('0x8'));var ejs=require(_0xc5a8('0x9'));var fs=require('fs');var fs_extra=require(_0xc5a8('0xa'));var _=require(_0xc5a8('0xb'));var squel=require(_0xc5a8('0xc'));var crypto=require(_0xc5a8('0xd'));var jsforce=require(_0xc5a8('0xe'));var deskjs=require(_0xc5a8('0xf'));var toCsv=require(_0xc5a8('0x8'));var querystring=require(_0xc5a8('0x10'));var Papa=require(_0xc5a8('0x11'));var Redis=require('ioredis');var authService=require(_0xc5a8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc5a8('0x13'));var hardwareService=require(_0xc5a8('0x14'));var logger=require(_0xc5a8('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xc5a8('0x16'));var licenseUtil=require(_0xc5a8('0x17'));var db=require(_0xc5a8('0x18'))['db'];function respondWithStatusCode(_0x2c4875,_0x445926){_0x445926=_0x445926||0xcc;return function(_0x5d2d2c){if(_0x5d2d2c){return _0x2c4875[_0xc5a8('0x19')](_0x445926);}return _0x2c4875[_0xc5a8('0x1a')](_0x445926)[_0xc5a8('0x1b')]();};}function respondWithResult(_0x3a820f,_0x3d6990){_0x3d6990=_0x3d6990||0xc8;return function(_0x219823){if(_0x219823){return _0x3a820f[_0xc5a8('0x1a')](_0x3d6990)[_0xc5a8('0x1c')](_0x219823);}};}function respondWithFilteredResult(_0x168e76,_0x9a94e3){return function(_0x26177f){if(_0x26177f){var _0x443376=typeof _0x9a94e3[_0xc5a8('0x1d')]===_0xc5a8('0x1e')&&typeof _0x9a94e3[_0xc5a8('0x1f')]===_0xc5a8('0x1e');var _0x22b230=_0x26177f[_0xc5a8('0x20')];var _0x506c10=_0x443376?0x0:_0x9a94e3[_0xc5a8('0x1d')];var _0x184749=_0x443376?_0x26177f[_0xc5a8('0x20')]:_0x9a94e3[_0xc5a8('0x1d')]+_0x9a94e3['limit'];var _0x326baf;if(_0x184749>=_0x22b230){_0x184749=_0x22b230;_0x326baf=0xc8;}else{_0x326baf=0xce;}_0x168e76['status'](_0x326baf);return _0x168e76[_0xc5a8('0x21')](_0xc5a8('0x22'),_0x506c10+'-'+_0x184749+'/'+_0x22b230)[_0xc5a8('0x1c')](_0x26177f);}return null;};}function patchUpdates(_0x52ca0a){return function(_0x59dd9b){try{jsonpatch['apply'](_0x59dd9b,_0x52ca0a,!![]);}catch(_0x332ee2){return BPromise[_0xc5a8('0x23')](_0x332ee2);}return _0x59dd9b[_0xc5a8('0x24')]();};}function saveUpdates(_0x403b80,_0x4b126d){return function(_0x1a8662){if(_0x1a8662){return _0x1a8662[_0xc5a8('0x25')](_0x403b80)[_0xc5a8('0x26')](function(_0x36d2c6){return _0x36d2c6;});}return null;};}function removeEntity(_0x5d8e5e,_0x411470){return function(_0x4865dd){if(_0x4865dd){return _0x4865dd[_0xc5a8('0x27')]()[_0xc5a8('0x26')](function(){var _0x2b8a67=_0x4865dd[_0xc5a8('0x28')]({'plain':!![]});var _0x5c8705=_0xc5a8('0x29');return db[_0xc5a8('0x2a')][_0xc5a8('0x27')]({'where':{'type':_0x5c8705,'resourceId':_0x2b8a67['id']}})[_0xc5a8('0x26')](function(){return _0x4865dd;});})[_0xc5a8('0x26')](function(){_0x5d8e5e[_0xc5a8('0x1a')](0xcc)[_0xc5a8('0x1b')]();});}};}function handleEntityNotFound(_0x165ee0,_0x4ebb64){return function(_0x75a5e5){if(!_0x75a5e5){_0x165ee0['sendStatus'](0x194);}return _0x75a5e5;};}function handleError(_0x32ef14,_0x58bd05){_0x58bd05=_0x58bd05||0x1f4;return function(_0x19e4f4){logger[_0xc5a8('0x2b')](_0x19e4f4['stack']);if(_0x19e4f4[_0xc5a8('0x2c')]){delete _0x19e4f4[_0xc5a8('0x2c')];}_0x32ef14[_0xc5a8('0x1a')](_0x58bd05)[_0xc5a8('0x2d')](_0x19e4f4);};}exports[_0xc5a8('0x2e')]=function(_0x2d7fae,_0x316ccb){var _0x4ec715={},_0x106a0b={},_0x367ecf={'count':0x0,'rows':[]};var _0x27efa2=_[_0xc5a8('0x2f')](db[_0xc5a8('0x30')][_0xc5a8('0x31')],function(_0x434d67){return{'name':_0x434d67[_0xc5a8('0x32')],'type':_0x434d67[_0xc5a8('0x33')][_0xc5a8('0x34')]};});_0x106a0b[_0xc5a8('0x35')]=_[_0xc5a8('0x2f')](_0x27efa2,_0xc5a8('0x2c'));_0x106a0b[_0xc5a8('0x36')]=_[_0xc5a8('0x37')](_0x2d7fae['query']);_0x106a0b['filters']=_[_0xc5a8('0x38')](_0x106a0b[_0xc5a8('0x35')],_0x106a0b[_0xc5a8('0x36')]);_0x4ec715['attributes']=_[_0xc5a8('0x38')](_0x106a0b[_0xc5a8('0x35')],qs[_0xc5a8('0x39')](_0x2d7fae[_0xc5a8('0x36')]['fields']));_0x4ec715['attributes']=_0x4ec715['attributes'][_0xc5a8('0x3a')]?_0x4ec715[_0xc5a8('0x3b')]:_0x106a0b[_0xc5a8('0x35')];if(!_0x2d7fae[_0xc5a8('0x36')][_0xc5a8('0x3c')]('nolimit')){_0x4ec715[_0xc5a8('0x1f')]=qs[_0xc5a8('0x1f')](_0x2d7fae['query'][_0xc5a8('0x1f')]);_0x4ec715['offset']=qs[_0xc5a8('0x1d')](_0x2d7fae[_0xc5a8('0x36')][_0xc5a8('0x1d')]);}_0x4ec715[_0xc5a8('0x3d')]=qs[_0xc5a8('0x3e')](_0x2d7fae[_0xc5a8('0x36')]['sort']);_0x4ec715[_0xc5a8('0x3f')]=qs[_0xc5a8('0x40')](_[_0xc5a8('0x41')](_0x2d7fae[_0xc5a8('0x36')],_0x106a0b[_0xc5a8('0x40')]),_0x27efa2);if(_0x2d7fae[_0xc5a8('0x36')][_0xc5a8('0x42')]){_0x4ec715[_0xc5a8('0x3f')]=_['merge'](_0x4ec715[_0xc5a8('0x3f')],{'$or':_[_0xc5a8('0x2f')](_0x27efa2,function(_0x3ea1e3){if(_0x3ea1e3[_0xc5a8('0x33')]!=='VIRTUAL'){var _0x1123fc={};_0x1123fc[_0x3ea1e3['name']]={'$like':'%'+_0x2d7fae[_0xc5a8('0x36')][_0xc5a8('0x42')]+'%'};return _0x1123fc;}})});}_0x4ec715=_[_0xc5a8('0x43')]({},_0x4ec715,_0x2d7fae['options']);var _0x351d49={'where':_0x4ec715[_0xc5a8('0x3f')]};return db[_0xc5a8('0x30')]['count'](_0x351d49)['then'](function(_0x5ee3b6){_0x367ecf[_0xc5a8('0x20')]=_0x5ee3b6;if(_0x2d7fae[_0xc5a8('0x36')][_0xc5a8('0x44')]){_0x4ec715['include']=[{'all':!![]}];}return db[_0xc5a8('0x30')]['findAll'](_0x4ec715);})['then'](function(_0x5b2284){_0x367ecf['rows']=_0x5b2284;return _0x367ecf;})['then'](respondWithFilteredResult(_0x316ccb,_0x4ec715))['catch'](handleError(_0x316ccb,null));};exports[_0xc5a8('0x45')]=function(_0x273932,_0x5c2968){var _0x36945b={'raw':![],'where':{'id':_0x273932[_0xc5a8('0x46')]['id']}},_0x922cc4={};_0x922cc4[_0xc5a8('0x35')]=_[_0xc5a8('0x37')](db[_0xc5a8('0x30')]['rawAttributes']);_0x922cc4[_0xc5a8('0x36')]=_[_0xc5a8('0x37')](_0x273932[_0xc5a8('0x36')]);_0x922cc4[_0xc5a8('0x40')]=_['intersection'](_0x922cc4[_0xc5a8('0x35')],_0x922cc4[_0xc5a8('0x36')]);_0x36945b[_0xc5a8('0x3b')]=_[_0xc5a8('0x38')](_0x922cc4['model'],qs['fields'](_0x273932[_0xc5a8('0x36')][_0xc5a8('0x39')]));_0x36945b[_0xc5a8('0x3b')]=_0x36945b['attributes'][_0xc5a8('0x3a')]?_0x36945b[_0xc5a8('0x3b')]:_0x922cc4[_0xc5a8('0x35')];if(_0x273932[_0xc5a8('0x36')][_0xc5a8('0x44')]){_0x36945b['include']=[{'all':!![]}];}_0x36945b=_[_0xc5a8('0x43')]({},_0x36945b,_0x273932['options']);return db[_0xc5a8('0x30')][_0xc5a8('0x47')](_0x36945b)['then'](handleEntityNotFound(_0x5c2968,null))['then'](respondWithResult(_0x5c2968,null))[_0xc5a8('0x48')](handleError(_0x5c2968,null));};exports[_0xc5a8('0x49')]=function(_0x4929b5,_0x526d11){return db[_0xc5a8('0x30')][_0xc5a8('0x49')](_0x4929b5[_0xc5a8('0x4a')],{})[_0xc5a8('0x26')](function(_0x3c84d8){var _0x1fd68b=_0x4929b5['user']['get']({'plain':!![]});if(!_0x1fd68b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1fd68b['role']===_0xc5a8('0x4b')){var _0x395fa6=_0x3c84d8[_0xc5a8('0x28')]({'plain':!![]});var _0x4a930c='ChanSpies';return db[_0xc5a8('0x4c')][_0xc5a8('0x47')]({'where':{'name':_0x4a930c,'userProfileId':_0x1fd68b['userProfileId']},'raw':!![]})['then'](function(_0x65798f){if(_0x65798f&&_0x65798f[_0xc5a8('0x4d')]===0x0){return db[_0xc5a8('0x2a')]['create']({'name':_0x395fa6[_0xc5a8('0x2c')],'resourceId':_0x395fa6['id'],'type':_0x65798f[_0xc5a8('0x2c')],'sectionId':_0x65798f['id']},{})[_0xc5a8('0x26')](function(){return _0x3c84d8;});}else{return _0x3c84d8;}})[_0xc5a8('0x48')](function(_0x3be874){logger[_0xc5a8('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3be874);throw _0x3be874;});}return _0x3c84d8;})[_0xc5a8('0x26')](respondWithResult(_0x526d11,0xc9))[_0xc5a8('0x48')](handleError(_0x526d11,null));};exports[_0xc5a8('0x25')]=function(_0x4fa548,_0xc334f3){if(_0x4fa548[_0xc5a8('0x4a')]['id']){delete _0x4fa548[_0xc5a8('0x4a')]['id'];}return db[_0xc5a8('0x30')][_0xc5a8('0x47')]({'where':{'id':_0x4fa548[_0xc5a8('0x46')]['id']}})[_0xc5a8('0x26')](handleEntityNotFound(_0xc334f3,null))[_0xc5a8('0x26')](saveUpdates(_0x4fa548[_0xc5a8('0x4a')],null))[_0xc5a8('0x26')](respondWithResult(_0xc334f3,null))['catch'](handleError(_0xc334f3,null));};exports['destroy']=function(_0x309371,_0x7b5b7){return db[_0xc5a8('0x30')][_0xc5a8('0x47')]({'where':{'id':_0x309371[_0xc5a8('0x46')]['id']}})['then'](handleEntityNotFound(_0x7b5b7,null))[_0xc5a8('0x26')](removeEntity(_0x7b5b7,null))[_0xc5a8('0x48')](handleError(_0x7b5b7,null));}; \ No newline at end of file +var _0x3cd1=['VIRTUAL','filter','options','include','rows','catch','show','params','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','destroy','then','get','ChanSpies','UserProfileResource','error','stack','name','index','VoiceChanSpy','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge'];(function(_0x27ad07,_0x2d3d47){var _0x3148b4=function(_0x3e8f75){while(--_0x3e8f75){_0x27ad07['push'](_0x27ad07['shift']());}};_0x3148b4(++_0x2d3d47);}(_0x3cd1,0x112));var _0x13cd=function(_0x1cc90a,_0x69e33c){_0x1cc90a=_0x1cc90a-0x0;var _0x4264c9=_0x3cd1[_0x1cc90a];return _0x4264c9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x13cd('0x0'));var zipdir=require(_0x13cd('0x1'));var jsonpatch=require(_0x13cd('0x2'));var rp=require(_0x13cd('0x3'));var moment=require(_0x13cd('0x4'));var BPromise=require(_0x13cd('0x5'));var Mustache=require(_0x13cd('0x6'));var util=require(_0x13cd('0x7'));var path=require('path');var sox=require(_0x13cd('0x8'));var csv=require(_0x13cd('0x9'));var ejs=require(_0x13cd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x13cd('0xb'));var crypto=require(_0x13cd('0xc'));var jsforce=require(_0x13cd('0xd'));var deskjs=require(_0x13cd('0xe'));var toCsv=require('to-csv');var querystring=require(_0x13cd('0xf'));var Papa=require(_0x13cd('0x10'));var Redis=require(_0x13cd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x13cd('0x12'));var hardwareService=require(_0x13cd('0x13'));var logger=require(_0x13cd('0x14'))(_0x13cd('0x15'));var utils=require(_0x13cd('0x16'));var config=require(_0x13cd('0x17'));var licenseUtil=require(_0x13cd('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1da3a7,_0x2fe1a0){_0x2fe1a0=_0x2fe1a0||0xcc;return function(_0x4bab73){if(_0x4bab73){return _0x1da3a7[_0x13cd('0x19')](_0x2fe1a0);}return _0x1da3a7[_0x13cd('0x1a')](_0x2fe1a0)[_0x13cd('0x1b')]();};}function respondWithResult(_0xfff1f2,_0x29e672){_0x29e672=_0x29e672||0xc8;return function(_0x473e50){if(_0x473e50){return _0xfff1f2[_0x13cd('0x1a')](_0x29e672)[_0x13cd('0x1c')](_0x473e50);}};}function respondWithFilteredResult(_0x5cf7a4,_0x24b647){return function(_0x4afa7a){if(_0x4afa7a){var _0x3d790d=typeof _0x24b647[_0x13cd('0x1d')]==='undefined'&&typeof _0x24b647[_0x13cd('0x1e')]===_0x13cd('0x1f');var _0x1af3e3=_0x4afa7a[_0x13cd('0x20')];var _0x1442eb=_0x3d790d?0x0:_0x24b647[_0x13cd('0x1d')];var _0x45b9de=_0x3d790d?_0x4afa7a[_0x13cd('0x20')]:_0x24b647['offset']+_0x24b647[_0x13cd('0x1e')];var _0x4dc631;if(_0x45b9de>=_0x1af3e3){_0x45b9de=_0x1af3e3;_0x4dc631=0xc8;}else{_0x4dc631=0xce;}_0x5cf7a4[_0x13cd('0x1a')](_0x4dc631);return _0x5cf7a4[_0x13cd('0x21')](_0x13cd('0x22'),_0x1442eb+'-'+_0x45b9de+'/'+_0x1af3e3)[_0x13cd('0x1c')](_0x4afa7a);}return null;};}function patchUpdates(_0x5d12b8){return function(_0x2f4368){try{jsonpatch['apply'](_0x2f4368,_0x5d12b8,!![]);}catch(_0x3d4eca){return BPromise[_0x13cd('0x23')](_0x3d4eca);}return _0x2f4368[_0x13cd('0x24')]();};}function saveUpdates(_0x10f682,_0x439ba1){return function(_0x17cfb3){if(_0x17cfb3){return _0x17cfb3['update'](_0x10f682)['then'](function(_0x2c3925){return _0x2c3925;});}return null;};}function removeEntity(_0x4fc1c2,_0x5144cc){return function(_0xc0503f){if(_0xc0503f){return _0xc0503f[_0x13cd('0x25')]()[_0x13cd('0x26')](function(){var _0x4882ae=_0xc0503f[_0x13cd('0x27')]({'plain':!![]});var _0x11124f=_0x13cd('0x28');return db[_0x13cd('0x29')][_0x13cd('0x25')]({'where':{'type':_0x11124f,'resourceId':_0x4882ae['id']}})[_0x13cd('0x26')](function(){return _0xc0503f;});})[_0x13cd('0x26')](function(){_0x4fc1c2[_0x13cd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x785bcc,_0x529613){return function(_0x4462f6){if(!_0x4462f6){_0x785bcc[_0x13cd('0x19')](0x194);}return _0x4462f6;};}function handleError(_0x4af387,_0x8dc9d7){_0x8dc9d7=_0x8dc9d7||0x1f4;return function(_0x136825){logger[_0x13cd('0x2a')](_0x136825[_0x13cd('0x2b')]);if(_0x136825[_0x13cd('0x2c')]){delete _0x136825[_0x13cd('0x2c')];}_0x4af387[_0x13cd('0x1a')](_0x8dc9d7)['send'](_0x136825);};}exports[_0x13cd('0x2d')]=function(_0x4a674b,_0x5ace47){var _0x1fbb8c={},_0x5b9eba={},_0x5e7c8a={'count':0x0,'rows':[]};var _0x2d65ee=_['map'](db[_0x13cd('0x2e')][_0x13cd('0x2f')],function(_0x8d24dc){return{'name':_0x8d24dc[_0x13cd('0x30')],'type':_0x8d24dc[_0x13cd('0x31')][_0x13cd('0x32')]};});_0x5b9eba[_0x13cd('0x33')]=_[_0x13cd('0x34')](_0x2d65ee,_0x13cd('0x2c'));_0x5b9eba[_0x13cd('0x35')]=_['keys'](_0x4a674b['query']);_0x5b9eba['filters']=_[_0x13cd('0x36')](_0x5b9eba[_0x13cd('0x33')],_0x5b9eba[_0x13cd('0x35')]);_0x1fbb8c['attributes']=_[_0x13cd('0x36')](_0x5b9eba[_0x13cd('0x33')],qs[_0x13cd('0x37')](_0x4a674b[_0x13cd('0x35')][_0x13cd('0x37')]));_0x1fbb8c['attributes']=_0x1fbb8c[_0x13cd('0x38')][_0x13cd('0x39')]?_0x1fbb8c[_0x13cd('0x38')]:_0x5b9eba[_0x13cd('0x33')];if(!_0x4a674b[_0x13cd('0x35')][_0x13cd('0x3a')](_0x13cd('0x3b'))){_0x1fbb8c[_0x13cd('0x1e')]=qs[_0x13cd('0x1e')](_0x4a674b['query']['limit']);_0x1fbb8c['offset']=qs[_0x13cd('0x1d')](_0x4a674b['query'][_0x13cd('0x1d')]);}_0x1fbb8c[_0x13cd('0x3c')]=qs[_0x13cd('0x3d')](_0x4a674b[_0x13cd('0x35')][_0x13cd('0x3d')]);_0x1fbb8c[_0x13cd('0x3e')]=qs[_0x13cd('0x3f')](_[_0x13cd('0x40')](_0x4a674b[_0x13cd('0x35')],_0x5b9eba[_0x13cd('0x3f')]),_0x2d65ee);if(_0x4a674b['query']['filter']){_0x1fbb8c[_0x13cd('0x3e')]=_[_0x13cd('0x41')](_0x1fbb8c[_0x13cd('0x3e')],{'$or':_[_0x13cd('0x34')](_0x2d65ee,function(_0x1bee6f){if(_0x1bee6f['type']!==_0x13cd('0x42')){var _0x41c605={};_0x41c605[_0x1bee6f[_0x13cd('0x2c')]]={'$like':'%'+_0x4a674b[_0x13cd('0x35')][_0x13cd('0x43')]+'%'};return _0x41c605;}})});}_0x1fbb8c=_[_0x13cd('0x41')]({},_0x1fbb8c,_0x4a674b[_0x13cd('0x44')]);var _0x492edf={'where':_0x1fbb8c[_0x13cd('0x3e')]};return db[_0x13cd('0x2e')][_0x13cd('0x20')](_0x492edf)[_0x13cd('0x26')](function(_0x4ba5f6){_0x5e7c8a['count']=_0x4ba5f6;if(_0x4a674b[_0x13cd('0x35')]['includeAll']){_0x1fbb8c[_0x13cd('0x45')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x1fbb8c);})[_0x13cd('0x26')](function(_0x10bd80){_0x5e7c8a[_0x13cd('0x46')]=_0x10bd80;return _0x5e7c8a;})[_0x13cd('0x26')](respondWithFilteredResult(_0x5ace47,_0x1fbb8c))[_0x13cd('0x47')](handleError(_0x5ace47,null));};exports[_0x13cd('0x48')]=function(_0x4ae440,_0xc47ef2){var _0x2d3eef={'raw':![],'where':{'id':_0x4ae440[_0x13cd('0x49')]['id']}},_0x570563={};_0x570563[_0x13cd('0x33')]=_[_0x13cd('0x4a')](db['VoiceChanSpy'][_0x13cd('0x2f')]);_0x570563[_0x13cd('0x35')]=_['keys'](_0x4ae440['query']);_0x570563[_0x13cd('0x3f')]=_[_0x13cd('0x36')](_0x570563[_0x13cd('0x33')],_0x570563[_0x13cd('0x35')]);_0x2d3eef[_0x13cd('0x38')]=_[_0x13cd('0x36')](_0x570563[_0x13cd('0x33')],qs[_0x13cd('0x37')](_0x4ae440[_0x13cd('0x35')]['fields']));_0x2d3eef['attributes']=_0x2d3eef[_0x13cd('0x38')][_0x13cd('0x39')]?_0x2d3eef[_0x13cd('0x38')]:_0x570563[_0x13cd('0x33')];if(_0x4ae440['query'][_0x13cd('0x4b')]){_0x2d3eef[_0x13cd('0x45')]=[{'all':!![]}];}_0x2d3eef=_[_0x13cd('0x41')]({},_0x2d3eef,_0x4ae440[_0x13cd('0x44')]);return db['VoiceChanSpy']['find'](_0x2d3eef)[_0x13cd('0x26')](handleEntityNotFound(_0xc47ef2,null))['then'](respondWithResult(_0xc47ef2,null))[_0x13cd('0x47')](handleError(_0xc47ef2,null));};exports[_0x13cd('0x4c')]=function(_0x10f94a,_0x5810ad){return db[_0x13cd('0x2e')]['create'](_0x10f94a[_0x13cd('0x4d')],{})['then'](function(_0x3f2c9e){var _0x53fa43=_0x10f94a[_0x13cd('0x4e')][_0x13cd('0x27')]({'plain':!![]});if(!_0x53fa43)throw new Error(_0x13cd('0x4f'));if(_0x53fa43['role']===_0x13cd('0x4e')){var _0x12af6d=_0x3f2c9e[_0x13cd('0x27')]({'plain':!![]});var _0x4f65ff='ChanSpies';return db[_0x13cd('0x50')][_0x13cd('0x51')]({'where':{'name':_0x4f65ff,'userProfileId':_0x53fa43['userProfileId']},'raw':!![]})[_0x13cd('0x26')](function(_0x1af6e7){if(_0x1af6e7&&_0x1af6e7[_0x13cd('0x52')]===0x0){return db[_0x13cd('0x29')]['create']({'name':_0x12af6d[_0x13cd('0x2c')],'resourceId':_0x12af6d['id'],'type':_0x1af6e7[_0x13cd('0x2c')],'sectionId':_0x1af6e7['id']},{})['then'](function(){return _0x3f2c9e;});}else{return _0x3f2c9e;}})[_0x13cd('0x47')](function(_0x442939){logger[_0x13cd('0x2a')](_0x13cd('0x53'),_0x442939);throw _0x442939;});}return _0x3f2c9e;})[_0x13cd('0x26')](respondWithResult(_0x5810ad,0xc9))[_0x13cd('0x47')](handleError(_0x5810ad,null));};exports[_0x13cd('0x54')]=function(_0xd18785,_0x292793){if(_0xd18785[_0x13cd('0x4d')]['id']){delete _0xd18785[_0x13cd('0x4d')]['id'];}return db[_0x13cd('0x2e')][_0x13cd('0x51')]({'where':{'id':_0xd18785['params']['id']}})[_0x13cd('0x26')](handleEntityNotFound(_0x292793,null))[_0x13cd('0x26')](saveUpdates(_0xd18785[_0x13cd('0x4d')],null))[_0x13cd('0x26')](respondWithResult(_0x292793,null))[_0x13cd('0x47')](handleError(_0x292793,null));};exports[_0x13cd('0x25')]=function(_0x58b87c,_0x385250){return db[_0x13cd('0x2e')][_0x13cd('0x51')]({'where':{'id':_0x58b87c['params']['id']}})['then'](handleEntityNotFound(_0x385250,null))['then'](removeEntity(_0x385250,null))[_0x13cd('0x47')](handleError(_0x385250,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index a7ee086..e4eca6a 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 _0x00aa=['record','MixMonitor','recordingFormat','auth','Authenticate','password','SIP/%s,%s','options','join','StopMixMonitor','concat','internal','name','User','findAll','catch','exports','define','VoiceChanSpy','voice_chanspy','then','length','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','%s%s','system','push','merge','format','chanspy'];(function(_0x28fd43,_0x9e5cbb){var _0x6b0189=function(_0x387cff){while(--_0x387cff){_0x28fd43['push'](_0x28fd43['shift']());}};_0x6b0189(++_0x9e5cbb);}(_0x00aa,0x11c));var _0xa00a=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x00aa[_0x266618];return _0x54dbf5;};'use strict';var _=require(_0xa00a('0x0'));var util=require(_0xa00a('0x1'));var BPromise=require(_0xa00a('0x2'));var attributes=require(_0xa00a('0x3'));var getUserApplications=function(_0x19e24b,_0x541f27,_0x1055ed){var _0x4c720b=0x1;var _0x327682=[];var _0x21daa1={'context':_0x541f27[_0xa00a('0x4')]||_0xa00a('0x5'),'exten':util['format'](_0xa00a('0x6'),_0x19e24b['prefix'],_0x1055ed),'type':_0xa00a('0x7'),'isApp':![],'ChanSpyId':_0x19e24b['id'],'UserId':_0x541f27['id']};_0x327682[_0xa00a('0x8')](_[_0xa00a('0x9')]({'app':'Set','appdata':util[_0xa00a('0xa')]('CDR(type)=%s',_0xa00a('0xb')),'priority':_0x4c720b++},_0x21daa1));if(_0x19e24b[_0xa00a('0xc')]){_0x327682[_0xa00a('0x8')](_[_0xa00a('0x9')]({'app':_0xa00a('0xd'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x19e24b[_0xa00a('0xe')]),'priority':_0x4c720b++},_0x21daa1));}if(_0x19e24b[_0xa00a('0xf')]){_0x327682[_0xa00a('0x8')](_[_0xa00a('0x9')]({'app':_0xa00a('0x10'),'appdata':_0x19e24b[_0xa00a('0x11')],'priority':_0x4c720b++},_0x21daa1));}_0x327682['push'](_[_0xa00a('0x9')]({'app':'ChanSpy','appdata':util['format'](_0xa00a('0x12'),_0x541f27['name'],_0x19e24b[_0xa00a('0x13')]?_0x19e24b[_0xa00a('0x13')][_0xa00a('0x14')](''):''),'priority':_0x4c720b++},_0x21daa1));if(_0x19e24b[_0xa00a('0xc')]){_0x327682[_0xa00a('0x8')](_['merge']({'app':_0xa00a('0x15'),'priority':_0x4c720b++},_0x21daa1));}return _0x327682;};var getChanSpyApplications=function(_0x521a4f,_0x261773){var _0x115ce0=[];for(var _0x30f299=0x0,_0x59e020=0x1;_0x30f299<_0x261773['length'];_0x30f299++,_0x59e020=0x1){_0x115ce0=_0x115ce0[_0xa00a('0x16')](getUserApplications(_0x521a4f,_0x261773[_0x30f299],_0x261773[_0x30f299][_0xa00a('0x17')]));if(_0x261773[_0x30f299][_0xa00a('0x17')]!=_0x261773[_0x30f299][_0xa00a('0x18')]){_0x115ce0=_0x115ce0[_0xa00a('0x16')](getUserApplications(_0x521a4f,_0x261773[_0x30f299],_0x261773[_0x30f299]['name']));}}return _0x115ce0;};var getChanSpyPromise=function(_0x68446f,_0x1c8ecc){return new BPromise(function(_0x208eff,_0x4ed702){return _0x68446f[_0xa00a('0x19')][_0xa00a('0x1a')]({'attributes':['id',_0xa00a('0x18'),_0xa00a('0x17')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x5a711c){if(_0x5a711c){return _0x208eff(getChanSpyApplications(_0x1c8ecc,_0x5a711c));}return _0x208eff([]);})[_0xa00a('0x1b')](function(_0x2dcc63){_0x4ed702(_0x2dcc63);});});};module[_0xa00a('0x1c')]=function(_0x4b043d,_0x2b8d0b){var _0x5290f5=_0x4b043d['models'];return _0x4b043d[_0xa00a('0x1d')](_0xa00a('0x1e'),attributes,{'tableName':_0xa00a('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1d0043,_0x12f80e,_0x3f6b4f){return getChanSpyPromise(_0x5290f5,_0x1d0043)[_0xa00a('0x20')](function(_0x28aee5){if(_0x28aee5&&_0x28aee5[_0xa00a('0x21')]){return _0x5290f5[_0xa00a('0x22')][_0xa00a('0x23')](_0x28aee5);}})[_0xa00a('0x20')](function(){_0x3f6b4f();})[_0xa00a('0x1b')](function(_0x1dd80e){_0x3f6b4f(_0x1dd80e);});},'afterUpdate':function(_0x6069fa,_0x4cc147,_0x3aab1e){return _0x5290f5[_0xa00a('0x22')][_0xa00a('0x24')]({'where':{'ChanSpyId':_0x6069fa['id']}})[_0xa00a('0x20')](function(){return getChanSpyPromise(_0x5290f5,_0x6069fa);})[_0xa00a('0x20')](function(_0x1e6f21){if(_0x1e6f21&&_0x1e6f21[_0xa00a('0x21')]){return _0x5290f5['VoiceExtension'][_0xa00a('0x23')](_0x1e6f21);}})['then'](function(){_0x3aab1e();})[_0xa00a('0x1b')](function(_0x449399){_0x3aab1e(_0x449399);});},'afterDestroy':function(_0x5cfc99,_0x12b70a,_0x58dd3c){return _0x5290f5['VoiceExtension'][_0xa00a('0x24')]({'where':{'ChanSpyId':_0x5cfc99['id']}})[_0xa00a('0x20')](function(){_0x58dd3c();})['catch'](function(_0x5e6e99){_0x58dd3c(_0x5e6e99);});}}});}; \ No newline at end of file +var _0x961d=['recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','length','concat','internal','name','User','findAll','agent','then','catch','models','define','VoiceChanSpy','voice_chanspy','bulkCreate','VoiceExtension','destroy','lodash','bluebird','context','from-sip','format','%s%s','prefix','push','merge','Set','record','MixMonitor','${UNIQUEID}.%s,a'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x961d,0x65));var _0xd961=function(_0xbb14db,_0x3ee8c6){_0xbb14db=_0xbb14db-0x0;var _0x36bed7=_0x961d[_0xbb14db];return _0x36bed7;};'use strict';var _=require(_0xd961('0x0'));var util=require('util');var BPromise=require(_0xd961('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x17c8a8,_0x3b8a49,_0x13d949){var _0x51d2f=0x1;var _0x3a6914=[];var _0x17f439={'context':_0x3b8a49[_0xd961('0x2')]||_0xd961('0x3'),'exten':util[_0xd961('0x4')](_0xd961('0x5'),_0x17c8a8[_0xd961('0x6')],_0x13d949),'type':'system','isApp':![],'ChanSpyId':_0x17c8a8['id'],'UserId':_0x3b8a49['id']};_0x3a6914[_0xd961('0x7')](_[_0xd961('0x8')]({'app':_0xd961('0x9'),'appdata':util[_0xd961('0x4')]('CDR(type)=%s','chanspy'),'priority':_0x51d2f++},_0x17f439));if(_0x17c8a8[_0xd961('0xa')]){_0x3a6914[_0xd961('0x7')](_[_0xd961('0x8')]({'app':_0xd961('0xb'),'appdata':util[_0xd961('0x4')](_0xd961('0xc'),_0x17c8a8[_0xd961('0xd')]),'priority':_0x51d2f++},_0x17f439));}if(_0x17c8a8[_0xd961('0xe')]){_0x3a6914['push'](_[_0xd961('0x8')]({'app':_0xd961('0xf'),'appdata':_0x17c8a8[_0xd961('0x10')],'priority':_0x51d2f++},_0x17f439));}_0x3a6914[_0xd961('0x7')](_[_0xd961('0x8')]({'app':_0xd961('0x11'),'appdata':util[_0xd961('0x4')](_0xd961('0x12'),_0x3b8a49['name'],_0x17c8a8[_0xd961('0x13')]?_0x17c8a8[_0xd961('0x13')][_0xd961('0x14')](''):''),'priority':_0x51d2f++},_0x17f439));if(_0x17c8a8['record']){_0x3a6914['push'](_[_0xd961('0x8')]({'app':_0xd961('0x15'),'priority':_0x51d2f++},_0x17f439));}return _0x3a6914;};var getChanSpyApplications=function(_0x5c0e0d,_0x3cef05){var _0x12aabd=[];for(var _0x470c81=0x0,_0x38b0f4=0x1;_0x470c81<_0x3cef05[_0xd961('0x16')];_0x470c81++,_0x38b0f4=0x1){_0x12aabd=_0x12aabd[_0xd961('0x17')](getUserApplications(_0x5c0e0d,_0x3cef05[_0x470c81],_0x3cef05[_0x470c81][_0xd961('0x18')]));if(_0x3cef05[_0x470c81][_0xd961('0x18')]!=_0x3cef05[_0x470c81][_0xd961('0x19')]){_0x12aabd=_0x12aabd['concat'](getUserApplications(_0x5c0e0d,_0x3cef05[_0x470c81],_0x3cef05[_0x470c81][_0xd961('0x19')]));}}return _0x12aabd;};var getChanSpyPromise=function(_0x39e6fc,_0x2f6345){return new BPromise(function(_0x300098,_0x278185){return _0x39e6fc[_0xd961('0x1a')][_0xd961('0x1b')]({'attributes':['id',_0xd961('0x19'),_0xd961('0x18')],'where':{'role':_0xd961('0x1c'),'chanspy':!![]},'raw':!![]})[_0xd961('0x1d')](function(_0x1018fd){if(_0x1018fd){return _0x300098(getChanSpyApplications(_0x2f6345,_0x1018fd));}return _0x300098([]);})[_0xd961('0x1e')](function(_0x36479b){_0x278185(_0x36479b);});});};module['exports']=function(_0x1ee8b3,_0x521e0b){var _0x4d02c1=_0x1ee8b3[_0xd961('0x1f')];return _0x1ee8b3[_0xd961('0x20')](_0xd961('0x21'),attributes,{'tableName':_0xd961('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f315d,_0x412d05,_0x317d24){return getChanSpyPromise(_0x4d02c1,_0x4f315d)[_0xd961('0x1d')](function(_0x617764){if(_0x617764&&_0x617764[_0xd961('0x16')]){return _0x4d02c1['VoiceExtension'][_0xd961('0x23')](_0x617764);}})[_0xd961('0x1d')](function(){_0x317d24();})['catch'](function(_0xd91b42){_0x317d24(_0xd91b42);});},'afterUpdate':function(_0x50d9c9,_0x54a37f,_0x2d2465){return _0x4d02c1[_0xd961('0x24')]['destroy']({'where':{'ChanSpyId':_0x50d9c9['id']}})[_0xd961('0x1d')](function(){return getChanSpyPromise(_0x4d02c1,_0x50d9c9);})[_0xd961('0x1d')](function(_0x3b5d7d){if(_0x3b5d7d&&_0x3b5d7d[_0xd961('0x16')]){return _0x4d02c1[_0xd961('0x24')]['bulkCreate'](_0x3b5d7d);}})[_0xd961('0x1d')](function(){_0x2d2465();})[_0xd961('0x1e')](function(_0xfe99ac){_0x2d2465(_0xfe99ac);});},'afterDestroy':function(_0x13b326,_0x226211,_0x10181f){return _0x4d02c1[_0xd961('0x24')][_0xd961('0x25')]({'where':{'ChanSpyId':_0x13b326['id']}})[_0xd961('0x1d')](function(){_0x10181f();})[_0xd961('0x1e')](function(_0x2e5155){_0x10181f(_0x2e5155);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index a0c961b..8ba05c0 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 _0x4ea3=['VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x4ea3,0x70));var _0x34ea=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4ea3[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var moment=require(_0x34ea('0x2'));var BPromise=require(_0x34ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ea('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x34ea('0x6'));var jayson=require(_0x34ea('0x7'));var client=jayson[_0x34ea('0x8')][_0x34ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40434e,_0x18b461,_0x22b09e){return new BPromise(function(_0x5bec7c,_0x341727){return client[_0x34ea('0xa')](_0x40434e,_0x22b09e)[_0x34ea('0xb')](function(_0x5132c4){logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,'request\x20sent');logger['debug'](_0x34ea('0xe'),_0x18b461,_0x34ea('0xf'),JSON[_0x34ea('0x10')](_0x5132c4));if(_0x5132c4['error']){if(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x12')]===0x1f4){logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);return _0x341727(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')]['message']);return _0x5bec7c(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}else{logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,_0x34ea('0xf'));_0x5bec7c(_0x5132c4['result'][_0x34ea('0x13')]);}})[_0x34ea('0x14')](function(_0x3fa3b0){logger[_0x34ea('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x18b461,_0x3fa3b0);_0x341727(_0x3fa3b0);});});} \ No newline at end of file +var _0x422f=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceChanSpy,\x20%s,\x20%s','result','catch','util'];(function(_0x1314d4,_0xb0b16d){var _0x584ba5=function(_0x394269){while(--_0x394269){_0x1314d4['push'](_0x1314d4['shift']());}};_0x584ba5(++_0xb0b16d);}(_0x422f,0x1c7));var _0xf422=function(_0x182cbd,_0x3b513a){_0x182cbd=_0x182cbd-0x0;var _0x48ade4=_0x422f[_0x182cbd];return _0x48ade4;};'use strict';var _=require('lodash');var util=require(_0xf422('0x0'));var moment=require('moment');var BPromise=require(_0xf422('0x1'));var rs=require(_0xf422('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf422('0x3'))['db'];var utils=require(_0xf422('0x4'));var logger=require(_0xf422('0x5'))(_0xf422('0x6'));var config=require(_0xf422('0x7'));var jayson=require(_0xf422('0x8'));var client=jayson[_0xf422('0x9')][_0xf422('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x350b2d,_0x583283,_0x3f4801){return new BPromise(function(_0x1037fa,_0xc2c9f5){return client[_0xf422('0xb')](_0x350b2d,_0x3f4801)[_0xf422('0xc')](function(_0x5f02da){logger[_0xf422('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x583283,'request\x20sent');logger[_0xf422('0xe')](_0xf422('0xf'),_0x583283,_0xf422('0x10'),JSON[_0xf422('0x11')](_0x5f02da));if(_0x5f02da[_0xf422('0x12')]){if(_0x5f02da['error'][_0xf422('0x13')]===0x1f4){logger[_0xf422('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x583283,_0x5f02da[_0xf422('0x12')][_0xf422('0x14')]);return _0xc2c9f5(_0x5f02da[_0xf422('0x12')][_0xf422('0x14')]);}logger[_0xf422('0x12')](_0xf422('0x15'),_0x583283,_0x5f02da[_0xf422('0x12')][_0xf422('0x14')]);return _0x1037fa(_0x5f02da[_0xf422('0x12')]['message']);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x583283,_0xf422('0x10'));_0x1037fa(_0x5f02da[_0xf422('0x16')][_0xf422('0x14')]);}})[_0xf422('0x17')](function(_0x5f3de5){logger[_0xf422('0x12')](_0xf422('0x15'),_0x583283,_0x5f3de5);_0xc2c9f5(_0x5f3de5);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 287944f..bd43ecc 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 _0xda6a=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xda6a,0x17a));var _0xada6=function(_0x5203c1,_0x367d00){_0x5203c1=_0x5203c1-0x0;var _0x5d95da=_0xda6a[_0x5203c1];return _0x5d95da;};'use strict';var multer=require(_0xada6('0x0'));var util=require(_0xada6('0x1'));var path=require(_0xada6('0x2'));var timeout=require(_0xada6('0x3'));var express=require(_0xada6('0x4'));var router=express[_0xada6('0x5')]();var fs_extra=require(_0xada6('0x6'));var auth=require(_0xada6('0x7'));var interaction=require(_0xada6('0x8'));var config=require(_0xada6('0x9'));var controller=require(_0xada6('0xa'));router[_0xada6('0xb')]('/',auth['isAuthenticated'](),controller[_0xada6('0xc')]);router['get'](_0xada6('0xd'),auth[_0xada6('0xe')](),controller[_0xada6('0xf')]);router[_0xada6('0x10')]('/',auth[_0xada6('0xe')](),controller[_0xada6('0x11')]);router['put'](_0xada6('0xd'),auth[_0xada6('0xe')](),controller[_0xada6('0x12')]);router[_0xada6('0x13')](_0xada6('0xd'),auth[_0xada6('0xe')](),controller[_0xada6('0x14')]);module[_0xada6('0x15')]=router; \ No newline at end of file +var _0xa622=['update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0x308da6,_0x52483c){var _0x140992=function(_0x2a66a1){while(--_0x2a66a1){_0x308da6['push'](_0x308da6['shift']());}};_0x140992(++_0x52483c);}(_0xa622,0x1f1));var _0x2a62=function(_0x334b28,_0x323128){_0x334b28=_0x334b28-0x0;var _0x51ad67=_0xa622[_0x334b28];return _0x51ad67;};'use strict';var multer=require(_0x2a62('0x0'));var util=require(_0x2a62('0x1'));var path=require(_0x2a62('0x2'));var timeout=require(_0x2a62('0x3'));var express=require(_0x2a62('0x4'));var router=express[_0x2a62('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2a62('0x6'));var interaction=require(_0x2a62('0x7'));var config=require(_0x2a62('0x8'));var controller=require(_0x2a62('0x9'));router[_0x2a62('0xa')]('/',auth[_0x2a62('0xb')](),controller[_0x2a62('0xc')]);router[_0x2a62('0xa')](_0x2a62('0xd'),auth[_0x2a62('0xb')](),controller['show']);router[_0x2a62('0xe')]('/',auth[_0x2a62('0xb')](),controller[_0x2a62('0xf')]);router['put']('/:id',auth[_0x2a62('0xb')](),controller[_0x2a62('0x10')]);router[_0x2a62('0x11')](_0x2a62('0xd'),auth[_0x2a62('0xb')](),controller['destroy']);module[_0x2a62('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 7042de6..15a27aa 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 _0x6e14=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x12efa0,_0x579590){var _0x158c02=function(_0x311422){while(--_0x311422){_0x12efa0['push'](_0x12efa0['shift']());}};_0x158c02(++_0x579590);}(_0x6e14,0xd1));var _0x46e1=function(_0x50c114,_0x253fde){_0x50c114=_0x50c114-0x0;var _0xd645b4=_0x6e14[_0x50c114];return _0xd645b4;};'use strict';var Sequelize=require(_0x46e1('0x0'));module[_0x46e1('0x1')]={'name':{'type':Sequelize[_0x46e1('0x2')],'unique':_0x46e1('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x46e1('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7833=['exports','STRING','name','sequelize'];(function(_0x4eb067,_0x4f551e){var _0x4a94f3=function(_0x3e823f){while(--_0x3e823f){_0x4eb067['push'](_0x4eb067['shift']());}};_0x4a94f3(++_0x4f551e);}(_0x7833,0x14f));var _0x3783=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0x7833[_0x4b91c4];return _0x25cb80;};'use strict';var Sequelize=require(_0x3783('0x0'));module[_0x3783('0x1')]={'name':{'type':Sequelize[_0x3783('0x2')],'unique':_0x3783('0x3')},'description':{'type':Sequelize[_0x3783('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index cd3a3ea..880243d 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 _0x9e0e=['Contexts','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','findAll','rows','catch','include','merge','create','body','root','server/files/templates/context.ejs','utf8','render','writeFileSync','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/extensions_xcally_contexts.conf','params','readFileSync','join','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','sendStatus','status','end','count','offset','limit','set','json','reject','update','destroy','get'];(function(_0x1a614e,_0x514212){var _0x581c44=function(_0x5361e3){while(--_0x5361e3){_0x1a614e['push'](_0x1a614e['shift']());}};_0x581c44(++_0x514212);}(_0x9e0e,0x1cd));var _0xe9e0=function(_0x25910f,_0x3904fd){_0x25910f=_0x25910f-0x0;var _0x3ac51e=_0x9e0e[_0x25910f];return _0x3ac51e;};'use strict';var emlformat=require(_0xe9e0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe9e0('0x1'));var jsonpatch=require(_0xe9e0('0x2'));var rp=require(_0xe9e0('0x3'));var moment=require(_0xe9e0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe9e0('0x5'));var path=require(_0xe9e0('0x6'));var sox=require('sox');var csv=require(_0xe9e0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9e0('0x8'));var _=require(_0xe9e0('0x9'));var squel=require(_0xe9e0('0xa'));var crypto=require(_0xe9e0('0xb'));var jsforce=require(_0xe9e0('0xc'));var deskjs=require(_0xe9e0('0xd'));var toCsv=require(_0xe9e0('0x7'));var querystring=require(_0xe9e0('0xe'));var Papa=require(_0xe9e0('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe9e0('0x10'));var as=require(_0xe9e0('0x11'));var hardwareService=require(_0xe9e0('0x12'));var logger=require(_0xe9e0('0x13'))(_0xe9e0('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe9e0('0x15'));var db=require(_0xe9e0('0x16'))['db'];var jayson=require(_0xe9e0('0x17'));var client=jayson[_0xe9e0('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x354717,_0x1761b8,_0x4d0fee,_0x532d60){return new BPromise(function(_0x2d81f6,_0x54676e){var _0x3cfb05=_0x532d60||client;return _0x3cfb05[_0xe9e0('0x19')](_0x354717,_0x4d0fee)[_0xe9e0('0x1a')](function(_0x5ca84d){logger[_0xe9e0('0x1b')]('VoiceContext,\x20%s,\x20%s',_0x1761b8,_0xe9e0('0x1c'));logger[_0xe9e0('0x1d')](_0xe9e0('0x1e'),_0x1761b8,_0xe9e0('0x1c'),JSON[_0xe9e0('0x1f')](_0x5ca84d));if(_0x5ca84d[_0xe9e0('0x20')]){if(_0x5ca84d[_0xe9e0('0x20')][_0xe9e0('0x21')]===0x1f4){logger[_0xe9e0('0x20')](_0xe9e0('0x22'),_0x1761b8,_0x5ca84d[_0xe9e0('0x20')]['message']);return _0x54676e(_0x5ca84d['error'][_0xe9e0('0x23')]);}logger[_0xe9e0('0x20')](_0xe9e0('0x22'),_0x1761b8,_0x5ca84d['error']['message']);return _0x2d81f6(_0x5ca84d[_0xe9e0('0x20')]['message']);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x1761b8,'request\x20sent');_0x2d81f6(_0x5ca84d[_0xe9e0('0x24')][_0xe9e0('0x23')]);}})['catch'](function(_0x25b9f9){logger[_0xe9e0('0x20')](_0xe9e0('0x22'),_0x1761b8,_0x25b9f9);_0x54676e(_0x25b9f9);});});}function respondWithStatusCode(_0x5e0d10,_0x36b25d){_0x36b25d=_0x36b25d||0xcc;return function(_0x9194c8){if(_0x9194c8){return _0x5e0d10[_0xe9e0('0x25')](_0x36b25d);}return _0x5e0d10[_0xe9e0('0x26')](_0x36b25d)[_0xe9e0('0x27')]();};}function respondWithResult(_0x2b03d7,_0x5c6fff){_0x5c6fff=_0x5c6fff||0xc8;return function(_0x5b3bb2){if(_0x5b3bb2){return _0x2b03d7[_0xe9e0('0x26')](_0x5c6fff)['json'](_0x5b3bb2);}};}function respondWithFilteredResult(_0x16c6e0,_0x19a542){return function(_0x1300ad){if(_0x1300ad){var _0x54c113=typeof _0x19a542['offset']==='undefined'&&typeof _0x19a542['limit']==='undefined';var _0x4559bd=_0x1300ad[_0xe9e0('0x28')];var _0x1e7eb9=_0x54c113?0x0:_0x19a542['offset'];var _0x27f8e1=_0x54c113?_0x1300ad[_0xe9e0('0x28')]:_0x19a542[_0xe9e0('0x29')]+_0x19a542[_0xe9e0('0x2a')];var _0x498cf3;if(_0x27f8e1>=_0x4559bd){_0x27f8e1=_0x4559bd;_0x498cf3=0xc8;}else{_0x498cf3=0xce;}_0x16c6e0[_0xe9e0('0x26')](_0x498cf3);return _0x16c6e0[_0xe9e0('0x2b')]('Content-Range',_0x1e7eb9+'-'+_0x27f8e1+'/'+_0x4559bd)[_0xe9e0('0x2c')](_0x1300ad);}return null;};}function patchUpdates(_0x386176){return function(_0x320274){try{jsonpatch['apply'](_0x320274,_0x386176,!![]);}catch(_0x328f56){return BPromise[_0xe9e0('0x2d')](_0x328f56);}return _0x320274['save']();};}function saveUpdates(_0x1f7735,_0x2f4dd5){return function(_0x2e6fab){if(_0x2e6fab){return _0x2e6fab[_0xe9e0('0x2e')](_0x1f7735)['then'](function(_0x44a4e7){return _0x44a4e7;});}return null;};}function removeEntity(_0x4008bf,_0x57cf33){return function(_0x4c58fb){if(_0x4c58fb){return _0x4c58fb[_0xe9e0('0x2f')]()[_0xe9e0('0x1a')](function(){var _0x536021=_0x4c58fb[_0xe9e0('0x30')]({'plain':!![]});var _0x351b6a=_0xe9e0('0x31');return db['UserProfileResource'][_0xe9e0('0x2f')]({'where':{'type':_0x351b6a,'resourceId':_0x536021['id']}})[_0xe9e0('0x1a')](function(){return _0x4c58fb;});})[_0xe9e0('0x1a')](function(){_0x4008bf[_0xe9e0('0x26')](0xcc)[_0xe9e0('0x27')]();});}};}function handleEntityNotFound(_0x3dc42a,_0x134fd6){return function(_0xd1841f){if(!_0xd1841f){_0x3dc42a['sendStatus'](0x194);}return _0xd1841f;};}function handleError(_0x20d13f,_0xdab130){_0xdab130=_0xdab130||0x1f4;return function(_0x57ab49){logger[_0xe9e0('0x20')](_0x57ab49[_0xe9e0('0x32')]);if(_0x57ab49['name']){delete _0x57ab49[_0xe9e0('0x33')];}_0x20d13f[_0xe9e0('0x26')](_0xdab130)[_0xe9e0('0x34')](_0x57ab49);};}exports[_0xe9e0('0x35')]=function(_0x147ebb,_0x53f76a){var _0x18a215={},_0x33e439={},_0x1ef138={'count':0x0,'rows':[]};var _0x15aa6b=_[_0xe9e0('0x36')](db[_0xe9e0('0x37')][_0xe9e0('0x38')],function(_0x1b8cfb){return{'name':_0x1b8cfb[_0xe9e0('0x39')],'type':_0x1b8cfb['type'][_0xe9e0('0x3a')]};});_0x33e439[_0xe9e0('0x3b')]=_[_0xe9e0('0x36')](_0x15aa6b,_0xe9e0('0x33'));_0x33e439['query']=_[_0xe9e0('0x3c')](_0x147ebb[_0xe9e0('0x3d')]);_0x33e439[_0xe9e0('0x3e')]=_[_0xe9e0('0x3f')](_0x33e439['model'],_0x33e439[_0xe9e0('0x3d')]);_0x18a215['attributes']=_[_0xe9e0('0x3f')](_0x33e439[_0xe9e0('0x3b')],qs[_0xe9e0('0x40')](_0x147ebb[_0xe9e0('0x3d')][_0xe9e0('0x40')]));_0x18a215[_0xe9e0('0x41')]=_0x18a215['attributes'][_0xe9e0('0x42')]?_0x18a215[_0xe9e0('0x41')]:_0x33e439[_0xe9e0('0x3b')];if(!_0x147ebb['query'][_0xe9e0('0x43')](_0xe9e0('0x44'))){_0x18a215[_0xe9e0('0x2a')]=qs[_0xe9e0('0x2a')](_0x147ebb[_0xe9e0('0x3d')][_0xe9e0('0x2a')]);_0x18a215[_0xe9e0('0x29')]=qs[_0xe9e0('0x29')](_0x147ebb[_0xe9e0('0x3d')][_0xe9e0('0x29')]);}_0x18a215[_0xe9e0('0x45')]=qs['sort'](_0x147ebb['query'][_0xe9e0('0x46')]);_0x18a215[_0xe9e0('0x47')]=qs[_0xe9e0('0x3e')](_[_0xe9e0('0x48')](_0x147ebb[_0xe9e0('0x3d')],_0x33e439[_0xe9e0('0x3e')]),_0x15aa6b);if(_0x147ebb[_0xe9e0('0x3d')]['filter']){_0x18a215[_0xe9e0('0x47')]=_['merge'](_0x18a215[_0xe9e0('0x47')],{'$or':_[_0xe9e0('0x36')](_0x15aa6b,function(_0x302ac9){if(_0x302ac9['type']!==_0xe9e0('0x49')){var _0x4b6169={};_0x4b6169[_0x302ac9[_0xe9e0('0x33')]]={'$like':'%'+_0x147ebb[_0xe9e0('0x3d')][_0xe9e0('0x4a')]+'%'};return _0x4b6169;}})});}_0x18a215=_['merge']({},_0x18a215,_0x147ebb[_0xe9e0('0x4b')]);var _0x240643={'where':_0x18a215['where']};return db[_0xe9e0('0x37')][_0xe9e0('0x28')](_0x240643)['then'](function(_0xc5e724){_0x1ef138[_0xe9e0('0x28')]=_0xc5e724;if(_0x147ebb[_0xe9e0('0x3d')][_0xe9e0('0x4c')]){_0x18a215['include']=[{'all':!![]}];}return db[_0xe9e0('0x37')][_0xe9e0('0x4d')](_0x18a215);})['then'](function(_0x15cd89){_0x1ef138[_0xe9e0('0x4e')]=_0x15cd89;return _0x1ef138;})['then'](respondWithFilteredResult(_0x53f76a,_0x18a215))[_0xe9e0('0x4f')](handleError(_0x53f76a,null));};exports['show']=function(_0x1f6494,_0x47907d){var _0x3986b1={'raw':![],'where':{'id':_0x1f6494['params']['id']}},_0x212e91={};_0x212e91[_0xe9e0('0x3b')]=_[_0xe9e0('0x3c')](db[_0xe9e0('0x37')][_0xe9e0('0x38')]);_0x212e91['query']=_[_0xe9e0('0x3c')](_0x1f6494[_0xe9e0('0x3d')]);_0x212e91[_0xe9e0('0x3e')]=_[_0xe9e0('0x3f')](_0x212e91['model'],_0x212e91[_0xe9e0('0x3d')]);_0x3986b1['attributes']=_[_0xe9e0('0x3f')](_0x212e91['model'],qs['fields'](_0x1f6494[_0xe9e0('0x3d')][_0xe9e0('0x40')]));_0x3986b1[_0xe9e0('0x41')]=_0x3986b1[_0xe9e0('0x41')][_0xe9e0('0x42')]?_0x3986b1[_0xe9e0('0x41')]:_0x212e91[_0xe9e0('0x3b')];if(_0x1f6494['query'][_0xe9e0('0x4c')]){_0x3986b1[_0xe9e0('0x50')]=[{'all':!![]}];}_0x3986b1=_[_0xe9e0('0x51')]({},_0x3986b1,_0x1f6494['options']);return db['VoiceContext']['find'](_0x3986b1)[_0xe9e0('0x1a')](handleEntityNotFound(_0x47907d,null))[_0xe9e0('0x1a')](respondWithResult(_0x47907d,null))['catch'](handleError(_0x47907d,null));};exports[_0xe9e0('0x52')]=function(_0x135c33,_0x28e178,_0x39549a){var _0x3df5d0;return db[_0xe9e0('0x37')][_0xe9e0('0x52')](_0x135c33[_0xe9e0('0x53')],{'raw':!![]})[_0xe9e0('0x1a')](function(_0x3c8ed1){_0x3df5d0=_0x3c8ed1;return db[_0xe9e0('0x37')][_0xe9e0('0x4d')]({'raw':!![]});})[_0xe9e0('0x1a')](function(_0x284ae2){var _0x476906=fs['readFileSync'](path['join'](config[_0xe9e0('0x54')],_0xe9e0('0x55')),_0xe9e0('0x56'));var _0x3bf84c=ejs[_0xe9e0('0x57')](_0x476906,{'contexts':_0x284ae2||[]});fs[_0xe9e0('0x58')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x3bf84c);})[_0xe9e0('0x1a')](function(){return respondWithRpcPromise(_0xe9e0('0x59'),_0xe9e0('0x52'),{'module':_0xe9e0('0x5a')});})['then'](function(){var _0x1dc1f4=_0x135c33[_0xe9e0('0x5b')][_0xe9e0('0x30')]({'plain':!![]});if(!_0x1dc1f4)throw new Error(_0xe9e0('0x5c'));if(_0x1dc1f4['role']==='user'){var _0x53cd59=_0x3df5d0['get']({'plain':!![]});return db['UserProfileSection'][_0xe9e0('0x5d')]({'where':{'name':_0xe9e0('0x31'),'userProfileId':_0x1dc1f4[_0xe9e0('0x5e')]},'raw':!![]})[_0xe9e0('0x1a')](function(_0x155e2b){if(_0x155e2b&&_0x155e2b[_0xe9e0('0x5f')]===0x0){return db[_0xe9e0('0x60')][_0xe9e0('0x52')]({'name':_0x53cd59['name'],'resourceId':_0x53cd59['id'],'type':_0x155e2b[_0xe9e0('0x33')],'sectionId':_0x155e2b['id']},{})[_0xe9e0('0x1a')](function(){return _0x3df5d0;});}else{return _0x3df5d0;}})[_0xe9e0('0x4f')](function(_0x726c82){logger['error'](_0xe9e0('0x61'),_0x726c82);throw _0x726c82;});}return _0x3df5d0;})['then'](respondWithResult(_0x28e178,0xc9))['catch'](handleError(_0x28e178,null));};exports[_0xe9e0('0x2e')]=function(_0x2c7ad6,_0x117c87,_0x5c8f30){var _0x18fb80;return db[_0xe9e0('0x37')][_0xe9e0('0x5d')]({'where':{'id':_0x2c7ad6['params']['id']}})[_0xe9e0('0x1a')](handleEntityNotFound(_0x117c87,null))[_0xe9e0('0x1a')](saveUpdates(_0x2c7ad6['body'],null))['then'](function(_0x154eb5){if(_0x154eb5){_0x18fb80=_0x154eb5;return db[_0xe9e0('0x37')][_0xe9e0('0x4d')]({'raw':!![]});}})['then'](function(_0x4da10b){var _0x349fca=fs['readFileSync'](path['join'](config[_0xe9e0('0x54')],'server/files/templates/context.ejs'),_0xe9e0('0x56'));var _0x114ad5=ejs[_0xe9e0('0x57')](_0x349fca,{'contexts':_0x4da10b||[]});fs[_0xe9e0('0x58')](_0xe9e0('0x62'),_0x114ad5);})['then'](function(){return respondWithRpcPromise(_0xe9e0('0x59'),_0xe9e0('0x2e'),{'module':_0xe9e0('0x5a')});})[_0xe9e0('0x1a')](function(){return _0x18fb80;})['then'](respondWithResult(_0x117c87,null))[_0xe9e0('0x4f')](handleError(_0x117c87,null));};exports[_0xe9e0('0x2f')]=function(_0xfedb6b,_0x26777d,_0x2ea1fa){var _0xebffe5;return db[_0xe9e0('0x37')][_0xe9e0('0x5d')]({'where':{'id':_0xfedb6b[_0xe9e0('0x63')]['id']}})[_0xe9e0('0x1a')](handleEntityNotFound(_0x26777d,null))[_0xe9e0('0x1a')](removeEntity(_0x26777d,null))[_0xe9e0('0x1a')](function(){return db[_0xe9e0('0x37')][_0xe9e0('0x4d')]({'raw':!![]});})[_0xe9e0('0x1a')](function(_0x2698f3){var _0x22e3e6=fs[_0xe9e0('0x64')](path[_0xe9e0('0x65')](config[_0xe9e0('0x54')],'server/files/templates/context.ejs'),_0xe9e0('0x56'));var _0x120125=ejs[_0xe9e0('0x57')](_0x22e3e6,{'contexts':_0x2698f3});fs[_0xe9e0('0x58')](_0xe9e0('0x62'),_0x120125);return respondWithRpcPromise(_0xe9e0('0x59'),_0xe9e0('0x2f'),{'module':_0xe9e0('0x5a')});})[_0xe9e0('0x4f')](handleError(_0x26777d,null));}; \ No newline at end of file +var _0x088a=['apply','reject','update','destroy','get','Contexts','UserProfileResource','stack','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','filter','merge','type','VIRTUAL','options','VoiceContext','includeAll','include','findAll','rows','keys','length','create','body','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','readFileSync','Reload','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','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','client','then','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','count','set'];(function(_0x30dc14,_0x538ed3){var _0x730a68=function(_0x4012f8){while(--_0x4012f8){_0x30dc14['push'](_0x30dc14['shift']());}};_0x730a68(++_0x538ed3);}(_0x088a,0xa2));var _0xa088=function(_0x469492,_0x20cd06){_0x469492=_0x469492-0x0;var _0x2bf499=_0x088a[_0x469492];return _0x2bf499;};'use strict';var emlformat=require(_0xa088('0x0'));var rimraf=require(_0xa088('0x1'));var zipdir=require(_0xa088('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa088('0x3'));var moment=require(_0xa088('0x4'));var BPromise=require(_0xa088('0x5'));var Mustache=require(_0xa088('0x6'));var util=require(_0xa088('0x7'));var path=require(_0xa088('0x8'));var sox=require('sox');var csv=require(_0xa088('0x9'));var ejs=require(_0xa088('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa088('0xb'));var crypto=require('crypto');var jsforce=require(_0xa088('0xc'));var deskjs=require(_0xa088('0xd'));var toCsv=require(_0xa088('0x9'));var querystring=require(_0xa088('0xe'));var Papa=require(_0xa088('0xf'));var Redis=require(_0xa088('0x10'));var authService=require(_0xa088('0x11'));var qs=require(_0xa088('0x12'));var as=require(_0xa088('0x13'));var hardwareService=require(_0xa088('0x14'));var logger=require(_0xa088('0x15'))(_0xa088('0x16'));var utils=require(_0xa088('0x17'));var config=require(_0xa088('0x18'));var licenseUtil=require(_0xa088('0x19'));var db=require(_0xa088('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xa088('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f6972,_0x57a430,_0x13edc9,_0x283d94){return new BPromise(function(_0x57dc0e,_0x42fe87){var _0x1cc91b=_0x283d94||client;return _0x1cc91b['request'](_0x3f6972,_0x13edc9)[_0xa088('0x1c')](function(_0x3c6370){logger['info'](_0xa088('0x1d'),_0x57a430,_0xa088('0x1e'));logger['debug'](_0xa088('0x1f'),_0x57a430,'request\x20sent',JSON[_0xa088('0x20')](_0x3c6370));if(_0x3c6370[_0xa088('0x21')]){if(_0x3c6370[_0xa088('0x21')][_0xa088('0x22')]===0x1f4){logger[_0xa088('0x21')](_0xa088('0x1d'),_0x57a430,_0x3c6370[_0xa088('0x21')][_0xa088('0x23')]);return _0x42fe87(_0x3c6370[_0xa088('0x21')][_0xa088('0x23')]);}logger[_0xa088('0x21')](_0xa088('0x1d'),_0x57a430,_0x3c6370[_0xa088('0x21')][_0xa088('0x23')]);return _0x57dc0e(_0x3c6370['error'][_0xa088('0x23')]);}else{logger[_0xa088('0x24')]('VoiceContext,\x20%s,\x20%s',_0x57a430,'request\x20sent');_0x57dc0e(_0x3c6370[_0xa088('0x25')][_0xa088('0x23')]);}})[_0xa088('0x26')](function(_0x926060){logger[_0xa088('0x21')](_0xa088('0x1d'),_0x57a430,_0x926060);_0x42fe87(_0x926060);});});}function respondWithStatusCode(_0x33606a,_0x2eb65d){_0x2eb65d=_0x2eb65d||0xcc;return function(_0x8cc5b5){if(_0x8cc5b5){return _0x33606a[_0xa088('0x27')](_0x2eb65d);}return _0x33606a[_0xa088('0x28')](_0x2eb65d)[_0xa088('0x29')]();};}function respondWithResult(_0x680c4,_0x142d77){_0x142d77=_0x142d77||0xc8;return function(_0x4a2c86){if(_0x4a2c86){return _0x680c4[_0xa088('0x28')](_0x142d77)[_0xa088('0x2a')](_0x4a2c86);}};}function respondWithFilteredResult(_0x35eaba,_0x28a878){return function(_0xf7461a){if(_0xf7461a){var _0x24c23a=typeof _0x28a878[_0xa088('0x2b')]==='undefined'&&typeof _0x28a878['limit']==='undefined';var _0x2fb34e=_0xf7461a['count'];var _0x29c24d=_0x24c23a?0x0:_0x28a878['offset'];var _0x5daf51=_0x24c23a?_0xf7461a[_0xa088('0x2c')]:_0x28a878[_0xa088('0x2b')]+_0x28a878['limit'];var _0x4690be;if(_0x5daf51>=_0x2fb34e){_0x5daf51=_0x2fb34e;_0x4690be=0xc8;}else{_0x4690be=0xce;}_0x35eaba['status'](_0x4690be);return _0x35eaba[_0xa088('0x2d')]('Content-Range',_0x29c24d+'-'+_0x5daf51+'/'+_0x2fb34e)[_0xa088('0x2a')](_0xf7461a);}return null;};}function patchUpdates(_0x107ca7){return function(_0x42c7b9){try{jsonpatch[_0xa088('0x2e')](_0x42c7b9,_0x107ca7,!![]);}catch(_0x469ef2){return BPromise[_0xa088('0x2f')](_0x469ef2);}return _0x42c7b9['save']();};}function saveUpdates(_0x4598b4,_0x460c50){return function(_0x5c0b5d){if(_0x5c0b5d){return _0x5c0b5d[_0xa088('0x30')](_0x4598b4)[_0xa088('0x1c')](function(_0x3647a2){return _0x3647a2;});}return null;};}function removeEntity(_0x5ae6f1,_0x50ef50){return function(_0x4d143b){if(_0x4d143b){return _0x4d143b[_0xa088('0x31')]()[_0xa088('0x1c')](function(){var _0x2b158b=_0x4d143b[_0xa088('0x32')]({'plain':!![]});var _0xdf51ee=_0xa088('0x33');return db[_0xa088('0x34')]['destroy']({'where':{'type':_0xdf51ee,'resourceId':_0x2b158b['id']}})[_0xa088('0x1c')](function(){return _0x4d143b;});})[_0xa088('0x1c')](function(){_0x5ae6f1[_0xa088('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x146e6f,_0x1bed4e){return function(_0x128295){if(!_0x128295){_0x146e6f[_0xa088('0x27')](0x194);}return _0x128295;};}function handleError(_0x134b5c,_0x48afe0){_0x48afe0=_0x48afe0||0x1f4;return function(_0x10ec88){logger[_0xa088('0x21')](_0x10ec88[_0xa088('0x35')]);if(_0x10ec88[_0xa088('0x36')]){delete _0x10ec88[_0xa088('0x36')];}_0x134b5c['status'](_0x48afe0)['send'](_0x10ec88);};}exports[_0xa088('0x37')]=function(_0x523aab,_0x9e3526){var _0x275ab3={},_0x5ea24f={},_0xbef096={'count':0x0,'rows':[]};var _0x5ecba0=_[_0xa088('0x38')](db['VoiceContext'][_0xa088('0x39')],function(_0x181b95){return{'name':_0x181b95[_0xa088('0x3a')],'type':_0x181b95['type'][_0xa088('0x3b')]};});_0x5ea24f[_0xa088('0x3c')]=_[_0xa088('0x38')](_0x5ecba0,_0xa088('0x36'));_0x5ea24f['query']=_['keys'](_0x523aab[_0xa088('0x3d')]);_0x5ea24f[_0xa088('0x3e')]=_['intersection'](_0x5ea24f[_0xa088('0x3c')],_0x5ea24f[_0xa088('0x3d')]);_0x275ab3['attributes']=_[_0xa088('0x3f')](_0x5ea24f['model'],qs[_0xa088('0x40')](_0x523aab[_0xa088('0x3d')][_0xa088('0x40')]));_0x275ab3[_0xa088('0x41')]=_0x275ab3[_0xa088('0x41')]['length']?_0x275ab3['attributes']:_0x5ea24f['model'];if(!_0x523aab[_0xa088('0x3d')][_0xa088('0x42')](_0xa088('0x43'))){_0x275ab3[_0xa088('0x44')]=qs[_0xa088('0x44')](_0x523aab[_0xa088('0x3d')]['limit']);_0x275ab3[_0xa088('0x2b')]=qs[_0xa088('0x2b')](_0x523aab[_0xa088('0x3d')]['offset']);}_0x275ab3['order']=qs[_0xa088('0x45')](_0x523aab[_0xa088('0x3d')][_0xa088('0x45')]);_0x275ab3[_0xa088('0x46')]=qs['filters'](_['pick'](_0x523aab[_0xa088('0x3d')],_0x5ea24f[_0xa088('0x3e')]),_0x5ecba0);if(_0x523aab['query'][_0xa088('0x47')]){_0x275ab3['where']=_[_0xa088('0x48')](_0x275ab3[_0xa088('0x46')],{'$or':_[_0xa088('0x38')](_0x5ecba0,function(_0x5e5bc5){if(_0x5e5bc5[_0xa088('0x49')]!==_0xa088('0x4a')){var _0x945b4b={};_0x945b4b[_0x5e5bc5['name']]={'$like':'%'+_0x523aab[_0xa088('0x3d')][_0xa088('0x47')]+'%'};return _0x945b4b;}})});}_0x275ab3=_[_0xa088('0x48')]({},_0x275ab3,_0x523aab[_0xa088('0x4b')]);var _0x47e171={'where':_0x275ab3[_0xa088('0x46')]};return db[_0xa088('0x4c')][_0xa088('0x2c')](_0x47e171)[_0xa088('0x1c')](function(_0xc09056){_0xbef096[_0xa088('0x2c')]=_0xc09056;if(_0x523aab[_0xa088('0x3d')][_0xa088('0x4d')]){_0x275ab3[_0xa088('0x4e')]=[{'all':!![]}];}return db[_0xa088('0x4c')][_0xa088('0x4f')](_0x275ab3);})[_0xa088('0x1c')](function(_0x4dd942){_0xbef096[_0xa088('0x50')]=_0x4dd942;return _0xbef096;})['then'](respondWithFilteredResult(_0x9e3526,_0x275ab3))[_0xa088('0x26')](handleError(_0x9e3526,null));};exports['show']=function(_0x3a95c8,_0x33e9b1){var _0x350cdd={'raw':![],'where':{'id':_0x3a95c8['params']['id']}},_0x448b15={};_0x448b15['model']=_[_0xa088('0x51')](db['VoiceContext']['rawAttributes']);_0x448b15[_0xa088('0x3d')]=_['keys'](_0x3a95c8[_0xa088('0x3d')]);_0x448b15['filters']=_[_0xa088('0x3f')](_0x448b15[_0xa088('0x3c')],_0x448b15[_0xa088('0x3d')]);_0x350cdd[_0xa088('0x41')]=_['intersection'](_0x448b15[_0xa088('0x3c')],qs[_0xa088('0x40')](_0x3a95c8[_0xa088('0x3d')]['fields']));_0x350cdd[_0xa088('0x41')]=_0x350cdd[_0xa088('0x41')][_0xa088('0x52')]?_0x350cdd[_0xa088('0x41')]:_0x448b15[_0xa088('0x3c')];if(_0x3a95c8[_0xa088('0x3d')][_0xa088('0x4d')]){_0x350cdd['include']=[{'all':!![]}];}_0x350cdd=_['merge']({},_0x350cdd,_0x3a95c8['options']);return db[_0xa088('0x4c')]['find'](_0x350cdd)[_0xa088('0x1c')](handleEntityNotFound(_0x33e9b1,null))[_0xa088('0x1c')](respondWithResult(_0x33e9b1,null))['catch'](handleError(_0x33e9b1,null));};exports[_0xa088('0x53')]=function(_0x560c9a,_0x375e12,_0x566c1a){var _0x306d46;return db[_0xa088('0x4c')][_0xa088('0x53')](_0x560c9a[_0xa088('0x54')],{'raw':!![]})[_0xa088('0x1c')](function(_0x4505a7){_0x306d46=_0x4505a7;return db[_0xa088('0x4c')]['findAll']({'raw':!![]});})[_0xa088('0x1c')](function(_0xb6c281){var _0x2b805f=fs['readFileSync'](path[_0xa088('0x55')](config[_0xa088('0x56')],_0xa088('0x57')),_0xa088('0x58'));var _0x3ce303=ejs[_0xa088('0x59')](_0x2b805f,{'contexts':_0xb6c281||[]});fs[_0xa088('0x5a')](_0xa088('0x5b'),_0x3ce303);})[_0xa088('0x1c')](function(){return respondWithRpcPromise('Reload',_0xa088('0x53'),{'module':_0xa088('0x5c')});})['then'](function(){var _0x214425=_0x560c9a[_0xa088('0x5d')]['get']({'plain':!![]});if(!_0x214425)throw new Error(_0xa088('0x5e'));if(_0x214425[_0xa088('0x5f')]===_0xa088('0x5d')){var _0x124d7b=_0x306d46['get']({'plain':!![]});return db[_0xa088('0x60')]['find']({'where':{'name':_0xa088('0x33'),'userProfileId':_0x214425[_0xa088('0x61')]},'raw':!![]})[_0xa088('0x1c')](function(_0x313fa0){if(_0x313fa0&&_0x313fa0[_0xa088('0x62')]===0x0){return db[_0xa088('0x34')]['create']({'name':_0x124d7b[_0xa088('0x36')],'resourceId':_0x124d7b['id'],'type':_0x313fa0[_0xa088('0x36')],'sectionId':_0x313fa0['id']},{})[_0xa088('0x1c')](function(){return _0x306d46;});}else{return _0x306d46;}})[_0xa088('0x26')](function(_0x2436bc){logger[_0xa088('0x21')](_0xa088('0x63'),_0x2436bc);throw _0x2436bc;});}return _0x306d46;})['then'](respondWithResult(_0x375e12,0xc9))[_0xa088('0x26')](handleError(_0x375e12,null));};exports['update']=function(_0x117ba9,_0x4f08bf,_0x5161d6){var _0x24f594;return db[_0xa088('0x4c')][_0xa088('0x64')]({'where':{'id':_0x117ba9[_0xa088('0x65')]['id']}})['then'](handleEntityNotFound(_0x4f08bf,null))[_0xa088('0x1c')](saveUpdates(_0x117ba9[_0xa088('0x54')],null))['then'](function(_0x46b2cf){if(_0x46b2cf){_0x24f594=_0x46b2cf;return db['VoiceContext']['findAll']({'raw':!![]});}})['then'](function(_0x4444e2){var _0x2d782f=fs[_0xa088('0x66')](path[_0xa088('0x55')](config[_0xa088('0x56')],_0xa088('0x57')),_0xa088('0x58'));var _0x28f94c=ejs['render'](_0x2d782f,{'contexts':_0x4444e2||[]});fs[_0xa088('0x5a')](_0xa088('0x5b'),_0x28f94c);})[_0xa088('0x1c')](function(){return respondWithRpcPromise('Reload',_0xa088('0x30'),{'module':_0xa088('0x5c')});})[_0xa088('0x1c')](function(){return _0x24f594;})['then'](respondWithResult(_0x4f08bf,null))[_0xa088('0x26')](handleError(_0x4f08bf,null));};exports['destroy']=function(_0x3e74e9,_0x597953,_0xa78c82){var _0x3f9116;return db[_0xa088('0x4c')]['find']({'where':{'id':_0x3e74e9['params']['id']}})[_0xa088('0x1c')](handleEntityNotFound(_0x597953,null))[_0xa088('0x1c')](removeEntity(_0x597953,null))[_0xa088('0x1c')](function(){return db[_0xa088('0x4c')][_0xa088('0x4f')]({'raw':!![]});})[_0xa088('0x1c')](function(_0x2424df){var _0x221e95=fs[_0xa088('0x66')](path[_0xa088('0x55')](config[_0xa088('0x56')],_0xa088('0x57')),_0xa088('0x58'));var _0x2ed375=ejs[_0xa088('0x59')](_0x221e95,{'contexts':_0x2424df});fs[_0xa088('0x5a')](_0xa088('0x5b'),_0x2ed375);return respondWithRpcPromise(_0xa088('0x67'),'destroy',{'module':_0xa088('0x5c')});})[_0xa088('0x26')](handleError(_0x597953,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 8625da2..d269dc6 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 _0x88e8=['api','moment','bluebird','request-promise','rimraf','./voiceContext.attributes','exports','VoiceContext','voice_contexts','util','../../config/logger'];(function(_0x151eda,_0x12bf51){var _0x554100=function(_0x256548){while(--_0x256548){_0x151eda['push'](_0x151eda['shift']());}};_0x554100(++_0x12bf51);}(_0x88e8,0xcf));var _0x888e=function(_0x5e968c,_0x3d9d44){_0x5e968c=_0x5e968c-0x0;var _0x5a9fb3=_0x88e8[_0x5e968c];return _0x5a9fb3;};'use strict';var _=require('lodash');var util=require(_0x888e('0x0'));var logger=require(_0x888e('0x1'))(_0x888e('0x2'));var moment=require(_0x888e('0x3'));var BPromise=require(_0x888e('0x4'));var rp=require(_0x888e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x888e('0x6'));var config=require('../../config/environment');var attributes=require(_0x888e('0x7'));module[_0x888e('0x8')]=function(_0x3a77aa,_0x4b9ff5){return _0x3a77aa['define'](_0x888e('0x9'),attributes,{'tableName':_0x888e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47ca=['voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','VoiceContext'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x47ca,0x1c9));var _0xa47c=function(_0x1867ab,_0x4ba9b1){_0x1867ab=_0x1867ab-0x0;var _0x4c6a0d=_0x47ca[_0x1867ab];return _0x4c6a0d;};'use strict';var _=require(_0xa47c('0x0'));var util=require(_0xa47c('0x1'));var logger=require(_0xa47c('0x2'))(_0xa47c('0x3'));var moment=require(_0xa47c('0x4'));var BPromise=require(_0xa47c('0x5'));var rp=require(_0xa47c('0x6'));var fs=require('fs');var path=require(_0xa47c('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module[_0xa47c('0x8')]=function(_0x46dbf3,_0x364c56){return _0x46dbf3[_0xa47c('0x9')](_0xa47c('0xa'),attributes,{'tableName':_0xa47c('0xb'),'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 9723b82..954801e 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 _0x3d3b=['request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x486d83,_0x1e3cc1){var _0x4aa55e=function(_0x4c9a92){while(--_0x4c9a92){_0x486d83['push'](_0x486d83['shift']());}};_0x4aa55e(++_0x1e3cc1);}(_0x3d3b,0x1af));var _0xb3d3=function(_0x2afbb0,_0x44f16d){_0x2afbb0=_0x2afbb0-0x0;var _0x411ff2=_0x3d3b[_0x2afbb0];return _0x411ff2;};'use strict';var _=require(_0xb3d3('0x0'));var util=require('util');var moment=require(_0xb3d3('0x1'));var BPromise=require(_0xb3d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3d3('0x3'))['db'];var utils=require(_0xb3d3('0x4'));var logger=require(_0xb3d3('0x5'))(_0xb3d3('0x6'));var config=require(_0xb3d3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb3d3('0x8')][_0xb3d3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1538c5,_0x2c14d8,_0x41a457){return new BPromise(function(_0x50db26,_0x47e24e){return client[_0xb3d3('0xa')](_0x1538c5,_0x41a457)[_0xb3d3('0xb')](function(_0x25c44d){logger[_0xb3d3('0xc')](_0xb3d3('0xd'),_0x2c14d8,'request\x20sent');logger[_0xb3d3('0xe')](_0xb3d3('0xf'),_0x2c14d8,_0xb3d3('0x10'),JSON['stringify'](_0x25c44d));if(_0x25c44d[_0xb3d3('0x11')]){if(_0x25c44d[_0xb3d3('0x11')][_0xb3d3('0x12')]===0x1f4){logger[_0xb3d3('0x11')](_0xb3d3('0xd'),_0x2c14d8,_0x25c44d[_0xb3d3('0x11')][_0xb3d3('0x13')]);return _0x47e24e(_0x25c44d[_0xb3d3('0x11')][_0xb3d3('0x13')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x2c14d8,_0x25c44d[_0xb3d3('0x11')][_0xb3d3('0x13')]);return _0x50db26(_0x25c44d['error'][_0xb3d3('0x13')]);}else{logger[_0xb3d3('0xc')]('VoiceContext,\x20%s,\x20%s',_0x2c14d8,'request\x20sent');_0x50db26(_0x25c44d['result'][_0xb3d3('0x13')]);}})[_0xb3d3('0x14')](function(_0x251316){logger[_0xb3d3('0x11')](_0xb3d3('0xd'),_0x2c14d8,_0x251316);_0x47e24e(_0x251316);});});} \ No newline at end of file +var _0x6cb4=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','request\x20sent','debug','stringify','error','VoiceContext,\x20%s,\x20%s'];(function(_0x2034e0,_0x138d2c){var _0x100e04=function(_0x2d06c1){while(--_0x2d06c1){_0x2034e0['push'](_0x2034e0['shift']());}};_0x100e04(++_0x138d2c);}(_0x6cb4,0xff));var _0x46cb=function(_0x4bb139,_0x4c5c2c){_0x4bb139=_0x4bb139-0x0;var _0x330097=_0x6cb4[_0x4bb139];return _0x330097;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rs=require(_0x46cb('0x4'));var fs=require('fs');var Redis=require(_0x46cb('0x5'));var db=require(_0x46cb('0x6'))['db'];var utils=require(_0x46cb('0x7'));var logger=require(_0x46cb('0x8'))('rpc');var config=require(_0x46cb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46cb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11262d,_0x148d0f,_0x31b35b){return new BPromise(function(_0x2d6c29,_0x24b4f5){return client[_0x46cb('0xb')](_0x11262d,_0x31b35b)['then'](function(_0x3d7663){logger[_0x46cb('0xc')]('VoiceContext,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'));logger[_0x46cb('0xe')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'),JSON[_0x46cb('0xf')](_0x3d7663));if(_0x3d7663['error']){if(_0x3d7663['error']['code']===0x1f4){logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x24b4f5(_0x3d7663['error'][_0x46cb('0x12')]);}logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x2d6c29(_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);}else{logger[_0x46cb('0xc')](_0x46cb('0x11'),_0x148d0f,_0x46cb('0xd'));_0x2d6c29(_0x3d7663[_0x46cb('0x13')]['message']);}})[_0x46cb('0x14')](function(_0x5796d2){logger[_0x46cb('0x10')]('VoiceContext,\x20%s,\x20%s',_0x148d0f,_0x5796d2);_0x24b4f5(_0x5796d2);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index c1c7f49..373a4d9 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 _0x4bcc=['put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','describe','/:id','isAuthenticated','show','create'];(function(_0x312c4d,_0x19f1de){var _0x1d52d2=function(_0x108bde){while(--_0x108bde){_0x312c4d['push'](_0x312c4d['shift']());}};_0x1d52d2(++_0x19f1de);}(_0x4bcc,0x1a6));var _0xc4bc=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x4bcc[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0xc4bc('0x0'));var util=require(_0xc4bc('0x1'));var path=require(_0xc4bc('0x2'));var timeout=require(_0xc4bc('0x3'));var express=require('express');var router=express[_0xc4bc('0x4')]();var fs_extra=require(_0xc4bc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc4bc('0x6'));var config=require(_0xc4bc('0x7'));var controller=require('./voiceDialReport.controller');router[_0xc4bc('0x8')]('/',auth['isAuthenticated'](),controller[_0xc4bc('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xc4bc('0xa')]);router[_0xc4bc('0x8')](_0xc4bc('0xb'),auth[_0xc4bc('0xc')](),controller[_0xc4bc('0xd')]);router['post']('/',auth[_0xc4bc('0xc')](),controller[_0xc4bc('0xe')]);router[_0xc4bc('0xf')]('/:id',auth[_0xc4bc('0xc')](),controller['update']);router[_0xc4bc('0x10')](_0xc4bc('0xb'),auth[_0xc4bc('0xc')](),controller[_0xc4bc('0x11')]);module[_0xc4bc('0x12')]=router; \ No newline at end of file +var _0xa739=['exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0xa739,0x1e1));var _0x9a73=function(_0x5dfe58,_0x7a0f08){_0x5dfe58=_0x5dfe58-0x0;var _0x40e79e=_0xa739[_0x5dfe58];return _0x40e79e;};'use strict';var multer=require('multer');var util=require(_0x9a73('0x0'));var path=require('path');var timeout=require(_0x9a73('0x1'));var express=require(_0x9a73('0x2'));var router=express['Router']();var fs_extra=require(_0x9a73('0x3'));var auth=require(_0x9a73('0x4'));var interaction=require(_0x9a73('0x5'));var config=require('../../config/environment');var controller=require(_0x9a73('0x6'));router[_0x9a73('0x7')]('/',auth[_0x9a73('0x8')](),controller[_0x9a73('0x9')]);router[_0x9a73('0x7')](_0x9a73('0xa'),auth[_0x9a73('0x8')](),controller[_0x9a73('0xb')]);router['get'](_0x9a73('0xc'),auth['isAuthenticated'](),controller[_0x9a73('0xd')]);router[_0x9a73('0xe')]('/',auth[_0x9a73('0x8')](),controller['create']);router[_0x9a73('0xf')](_0x9a73('0xc'),auth['isAuthenticated'](),controller[_0x9a73('0x10')]);router[_0x9a73('0x11')](_0x9a73('0xc'),auth['isAuthenticated'](),controller[_0x9a73('0x12')]);module[_0x9a73('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 58365b5..8b94b9e 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 _0xf3cd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x5a1ee2,_0x4e7f77){var _0x96e231=function(_0x15d77e){while(--_0x15d77e){_0x5a1ee2['push'](_0x5a1ee2['shift']());}};_0x96e231(++_0x4e7f77);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x32f05c,_0x273aef){_0x32f05c=_0x32f05c-0x0;var _0x4307ed=_0xf3cd[_0x32f05c];return _0x4307ed;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'privilege':{'type':Sequelize[_0xdf3c('0x2')]},'channel':{'type':Sequelize[_0xdf3c('0x2')]},'channelstate':{'type':Sequelize[_0xdf3c('0x3')]},'channelstatedesc':{'type':Sequelize[_0xdf3c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinename':{'type':Sequelize[_0xdf3c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xdf3c('0x2')]},'context':{'type':Sequelize[_0xdf3c('0x2')]},'exten':{'type':Sequelize[_0xdf3c('0x2')]},'priority':{'type':Sequelize[_0xdf3c('0x3')]},'uniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'linkedid':{'type':Sequelize[_0xdf3c('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xdf3c('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xdf3c('0x2')]},'destaccountcode':{'type':Sequelize[_0xdf3c('0x2')]},'destcontext':{'type':Sequelize[_0xdf3c('0x2')]},'destexten':{'type':Sequelize[_0xdf3c('0x2')]},'destpriority':{'type':Sequelize[_0xdf3c('0x3')]},'destuniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'destlinkedid':{'type':Sequelize[_0xdf3c('0x2')]},'dialstring':{'type':Sequelize[_0xdf3c('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xdf3c('0x4')]},'answertime':{'type':Sequelize[_0xdf3c('0x4')]},'endtime':{'type':Sequelize[_0xdf3c('0x4')]},'lastevent':{'type':Sequelize[_0xdf3c('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xdf3c('0x3')]},'duration':{'type':Sequelize[_0xdf3c('0x3')]},'holdtime':{'type':Sequelize[_0xdf3c('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x24ca=['STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x22f17b,_0x3102db){var _0x10a8a4=function(_0x1a4da6){while(--_0x1a4da6){_0x22f17b['push'](_0x22f17b['shift']());}};_0x10a8a4(++_0x3102db);}(_0x24ca,0x1bc));var _0xa24c=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x24ca[_0x363ef8];return _0x148822;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xa24c('0x1')]},'channel':{'type':Sequelize[_0xa24c('0x1')]},'channelstate':{'type':Sequelize[_0xa24c('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa24c('0x1')]},'calleridname':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'language':{'type':Sequelize[_0xa24c('0x1')]},'accountcode':{'type':Sequelize[_0xa24c('0x1')]},'context':{'type':Sequelize[_0xa24c('0x1')]},'exten':{'type':Sequelize[_0xa24c('0x1')]},'priority':{'type':Sequelize[_0xa24c('0x2')]},'uniqueid':{'type':Sequelize[_0xa24c('0x1')]},'linkedid':{'type':Sequelize[_0xa24c('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xa24c('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridnum':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'destlanguage':{'type':Sequelize[_0xa24c('0x1')]},'destaccountcode':{'type':Sequelize[_0xa24c('0x1')]},'destcontext':{'type':Sequelize[_0xa24c('0x1')]},'destexten':{'type':Sequelize[_0xa24c('0x1')]},'destpriority':{'type':Sequelize[_0xa24c('0x2')]},'destuniqueid':{'type':Sequelize[_0xa24c('0x1')]},'destlinkedid':{'type':Sequelize[_0xa24c('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xa24c('0x1')]},'starttime':{'type':Sequelize[_0xa24c('0x3')]},'answertime':{'type':Sequelize[_0xa24c('0x3')]},'endtime':{'type':Sequelize[_0xa24c('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xa24c('0x4')},'routeId':{'type':Sequelize[_0xa24c('0x2')]},'duration':{'type':Sequelize[_0xa24c('0x2')]},'holdtime':{'type':Sequelize[_0xa24c('0x2')]},'billableseconds':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index c76e57b..c529c1f 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 _0xae46=['offset','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','query','keys','filters','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','undefined','limit','count'];(function(_0x35d775,_0x25431e){var _0x59384d=function(_0x1a0c15){while(--_0x1a0c15){_0x35d775['push'](_0x35d775['shift']());}};_0x59384d(++_0x25431e);}(_0xae46,0x198));var _0x6ae4=function(_0x1cdec9,_0x564674){_0x1cdec9=_0x1cdec9-0x0;var _0x52639f=_0xae46[_0x1cdec9];return _0x52639f;};'use strict';var emlformat=require(_0x6ae4('0x0'));var rimraf=require(_0x6ae4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6ae4('0x2'));var rp=require(_0x6ae4('0x3'));var moment=require(_0x6ae4('0x4'));var BPromise=require(_0x6ae4('0x5'));var Mustache=require('mustache');var util=require(_0x6ae4('0x6'));var path=require('path');var sox=require(_0x6ae4('0x7'));var csv=require(_0x6ae4('0x8'));var ejs=require(_0x6ae4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6ae4('0xa'));var squel=require(_0x6ae4('0xb'));var crypto=require(_0x6ae4('0xc'));var jsforce=require(_0x6ae4('0xd'));var deskjs=require(_0x6ae4('0xe'));var toCsv=require(_0x6ae4('0x8'));var querystring=require('querystring');var Papa=require(_0x6ae4('0xf'));var Redis=require('ioredis');var authService=require(_0x6ae4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6ae4('0x11'));var hardwareService=require(_0x6ae4('0x12'));var logger=require(_0x6ae4('0x13'))(_0x6ae4('0x14'));var utils=require(_0x6ae4('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6ae4('0x16'))['db'];function respondWithStatusCode(_0x15fd07,_0x24f768){_0x24f768=_0x24f768||0xcc;return function(_0x250077){if(_0x250077){return _0x15fd07[_0x6ae4('0x17')](_0x24f768);}return _0x15fd07['status'](_0x24f768)[_0x6ae4('0x18')]();};}function respondWithResult(_0x283b78,_0x1c4914){_0x1c4914=_0x1c4914||0xc8;return function(_0x55764d){if(_0x55764d){return _0x283b78[_0x6ae4('0x19')](_0x1c4914)[_0x6ae4('0x1a')](_0x55764d);}};}function respondWithFilteredResult(_0x294d9a,_0x19d18d){return function(_0x1533fe){if(_0x1533fe){var _0x2da1a6=typeof _0x19d18d['offset']===_0x6ae4('0x1b')&&typeof _0x19d18d[_0x6ae4('0x1c')]==='undefined';var _0x84196a=_0x1533fe[_0x6ae4('0x1d')];var _0x26520f=_0x2da1a6?0x0:_0x19d18d[_0x6ae4('0x1e')];var _0x5591bd=_0x2da1a6?_0x1533fe['count']:_0x19d18d[_0x6ae4('0x1e')]+_0x19d18d[_0x6ae4('0x1c')];var _0x58f03f;if(_0x5591bd>=_0x84196a){_0x5591bd=_0x84196a;_0x58f03f=0xc8;}else{_0x58f03f=0xce;}_0x294d9a[_0x6ae4('0x19')](_0x58f03f);return _0x294d9a[_0x6ae4('0x1f')](_0x6ae4('0x20'),_0x26520f+'-'+_0x5591bd+'/'+_0x84196a)[_0x6ae4('0x1a')](_0x1533fe);}return null;};}function patchUpdates(_0x3499a5){return function(_0x349ae2){try{jsonpatch[_0x6ae4('0x21')](_0x349ae2,_0x3499a5,!![]);}catch(_0x1f3076){return BPromise['reject'](_0x1f3076);}return _0x349ae2['save']();};}function saveUpdates(_0xd999d0,_0x22d6e8){return function(_0x4ecfb3){if(_0x4ecfb3){return _0x4ecfb3[_0x6ae4('0x22')](_0xd999d0)[_0x6ae4('0x23')](function(_0x5a7e3a){return _0x5a7e3a;});}return null;};}function removeEntity(_0x4450ea,_0x126851){return function(_0x4443b5){if(_0x4443b5){return _0x4443b5[_0x6ae4('0x24')]()[_0x6ae4('0x23')](function(){_0x4450ea['status'](0xcc)[_0x6ae4('0x18')]();});}};}function handleEntityNotFound(_0x3ce849,_0x41995c){return function(_0x17906f){if(!_0x17906f){_0x3ce849['sendStatus'](0x194);}return _0x17906f;};}function handleError(_0x31d866,_0x5892f5){_0x5892f5=_0x5892f5||0x1f4;return function(_0x4cae82){logger[_0x6ae4('0x25')](_0x4cae82[_0x6ae4('0x26')]);if(_0x4cae82[_0x6ae4('0x27')]){delete _0x4cae82[_0x6ae4('0x27')];}_0x31d866['status'](_0x5892f5)[_0x6ae4('0x28')](_0x4cae82);};}exports[_0x6ae4('0x29')]=function(_0xb342f9,_0x3451f9){var _0x1bdc37={},_0x4b84f7={},_0x3f644e={'count':0x0,'rows':[]};var _0x5dc283=_[_0x6ae4('0x2a')](db[_0x6ae4('0x2b')][_0x6ae4('0x2c')],function(_0x31aeaa){return{'name':_0x31aeaa[_0x6ae4('0x2d')],'type':_0x31aeaa[_0x6ae4('0x2e')]['key']};});_0x4b84f7['model']=_[_0x6ae4('0x2a')](_0x5dc283,_0x6ae4('0x27'));_0x4b84f7[_0x6ae4('0x2f')]=_[_0x6ae4('0x30')](_0xb342f9[_0x6ae4('0x2f')]);_0x4b84f7[_0x6ae4('0x31')]=_['intersection'](_0x4b84f7['model'],_0x4b84f7[_0x6ae4('0x2f')]);_0x1bdc37[_0x6ae4('0x32')]=_['intersection'](_0x4b84f7[_0x6ae4('0x33')],qs[_0x6ae4('0x34')](_0xb342f9[_0x6ae4('0x2f')][_0x6ae4('0x34')]));_0x1bdc37[_0x6ae4('0x32')]=_0x1bdc37[_0x6ae4('0x32')][_0x6ae4('0x35')]?_0x1bdc37[_0x6ae4('0x32')]:_0x4b84f7[_0x6ae4('0x33')];if(!_0xb342f9[_0x6ae4('0x2f')][_0x6ae4('0x36')](_0x6ae4('0x37'))){_0x1bdc37[_0x6ae4('0x1c')]=qs[_0x6ae4('0x1c')](_0xb342f9[_0x6ae4('0x2f')][_0x6ae4('0x1c')]);_0x1bdc37[_0x6ae4('0x1e')]=qs[_0x6ae4('0x1e')](_0xb342f9['query']['offset']);}_0x1bdc37['order']=qs[_0x6ae4('0x38')](_0xb342f9[_0x6ae4('0x2f')][_0x6ae4('0x38')]);_0x1bdc37[_0x6ae4('0x39')]=qs[_0x6ae4('0x31')](_['pick'](_0xb342f9[_0x6ae4('0x2f')],_0x4b84f7['filters']),_0x5dc283);if(_0xb342f9[_0x6ae4('0x2f')]['filter']){_0x1bdc37[_0x6ae4('0x39')]=_[_0x6ae4('0x3a')](_0x1bdc37[_0x6ae4('0x39')],{'$or':_[_0x6ae4('0x2a')](_0x5dc283,function(_0x501c6e){if(_0x501c6e[_0x6ae4('0x2e')]!=='VIRTUAL'){var _0xae480={};_0xae480[_0x501c6e[_0x6ae4('0x27')]]={'$like':'%'+_0xb342f9[_0x6ae4('0x2f')][_0x6ae4('0x3b')]+'%'};return _0xae480;}})});}_0x1bdc37=_[_0x6ae4('0x3a')]({},_0x1bdc37,_0xb342f9[_0x6ae4('0x3c')]);var _0x1673ec={'where':_0x1bdc37[_0x6ae4('0x39')]};return db['VoiceDialReport'][_0x6ae4('0x1d')](_0x1673ec)['then'](function(_0x1e932b){_0x3f644e['count']=_0x1e932b;if(_0xb342f9[_0x6ae4('0x2f')][_0x6ae4('0x3d')]){_0x1bdc37[_0x6ae4('0x3e')]=[{'all':!![]}];}return db[_0x6ae4('0x2b')][_0x6ae4('0x3f')](_0x1bdc37);})[_0x6ae4('0x23')](function(_0x27daca){_0x3f644e[_0x6ae4('0x40')]=_0x27daca;return _0x3f644e;})[_0x6ae4('0x23')](respondWithFilteredResult(_0x3451f9,_0x1bdc37))[_0x6ae4('0x41')](handleError(_0x3451f9,null));};exports[_0x6ae4('0x42')]=function(_0x278d41,_0x39f659){var _0x4ec52d={'raw':!![],'where':{'id':_0x278d41[_0x6ae4('0x43')]['id']}},_0x5e3cfd={};_0x5e3cfd[_0x6ae4('0x33')]=_['keys'](db[_0x6ae4('0x2b')]['rawAttributes']);_0x5e3cfd[_0x6ae4('0x2f')]=_['keys'](_0x278d41[_0x6ae4('0x2f')]);_0x5e3cfd['filters']=_['intersection'](_0x5e3cfd[_0x6ae4('0x33')],_0x5e3cfd['query']);_0x4ec52d[_0x6ae4('0x32')]=_[_0x6ae4('0x44')](_0x5e3cfd[_0x6ae4('0x33')],qs[_0x6ae4('0x34')](_0x278d41[_0x6ae4('0x2f')]['fields']));_0x4ec52d[_0x6ae4('0x32')]=_0x4ec52d[_0x6ae4('0x32')][_0x6ae4('0x35')]?_0x4ec52d[_0x6ae4('0x32')]:_0x5e3cfd[_0x6ae4('0x33')];if(_0x278d41[_0x6ae4('0x2f')]['includeAll']){_0x4ec52d[_0x6ae4('0x3e')]=[{'all':!![]}];}_0x4ec52d=_[_0x6ae4('0x3a')]({},_0x4ec52d,_0x278d41[_0x6ae4('0x3c')]);return db[_0x6ae4('0x2b')][_0x6ae4('0x45')](_0x4ec52d)['then'](handleEntityNotFound(_0x39f659,null))['then'](respondWithResult(_0x39f659,null))[_0x6ae4('0x41')](handleError(_0x39f659,null));};exports[_0x6ae4('0x46')]=function(_0x573124,_0x41ae2b){return db[_0x6ae4('0x2b')][_0x6ae4('0x46')](_0x573124[_0x6ae4('0x47')],{})['then'](respondWithResult(_0x41ae2b,0xc9))['catch'](handleError(_0x41ae2b,null));};exports[_0x6ae4('0x22')]=function(_0x164b0e,_0x641819){if(_0x164b0e[_0x6ae4('0x47')]['id']){delete _0x164b0e['body']['id'];}return db['VoiceDialReport']['find']({'where':{'id':_0x164b0e[_0x6ae4('0x43')]['id']}})[_0x6ae4('0x23')](handleEntityNotFound(_0x641819,null))[_0x6ae4('0x23')](saveUpdates(_0x164b0e[_0x6ae4('0x47')],null))[_0x6ae4('0x23')](respondWithResult(_0x641819,null))[_0x6ae4('0x41')](handleError(_0x641819,null));};exports[_0x6ae4('0x24')]=function(_0x4c187f,_0x959ae8){return db[_0x6ae4('0x2b')]['find']({'where':{'id':_0x4c187f['params']['id']}})['then'](handleEntityNotFound(_0x959ae8,null))[_0x6ae4('0x23')](removeEntity(_0x959ae8,null))[_0x6ae4('0x41')](handleError(_0x959ae8,null));};exports[_0x6ae4('0x48')]=function(_0x3d7e94,_0xd52167){return db[_0x6ae4('0x2b')][_0x6ae4('0x48')]()[_0x6ae4('0x23')](respondWithResult(_0xd52167,null))[_0x6ae4('0x41')](handleError(_0xd52167,null));}; \ No newline at end of file +var _0xe9bd=['count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','show','params','fields','catch','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x198c51,_0x6f96a8){var _0x1b0ead=function(_0x120fc9){while(--_0x120fc9){_0x198c51['push'](_0x198c51['shift']());}};_0x1b0ead(++_0x6f96a8);}(_0xe9bd,0xcc));var _0xde9b=function(_0x5937b5,_0x1a8855){_0x5937b5=_0x5937b5-0x0;var _0x1e1452=_0xe9bd[_0x5937b5];return _0x1e1452;};'use strict';var emlformat=require(_0xde9b('0x0'));var rimraf=require(_0xde9b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xde9b('0x2'));var rp=require(_0xde9b('0x3'));var moment=require(_0xde9b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xde9b('0x5'));var util=require(_0xde9b('0x6'));var path=require(_0xde9b('0x7'));var sox=require(_0xde9b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xde9b('0x9'));var _=require(_0xde9b('0xa'));var squel=require(_0xde9b('0xb'));var crypto=require(_0xde9b('0xc'));var jsforce=require(_0xde9b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xde9b('0xe'));var querystring=require(_0xde9b('0xf'));var Papa=require(_0xde9b('0x10'));var Redis=require(_0xde9b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xde9b('0x12'));var as=require(_0xde9b('0x13'));var hardwareService=require(_0xde9b('0x14'));var logger=require(_0xde9b('0x15'))(_0xde9b('0x16'));var utils=require(_0xde9b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xde9b('0x18'));var db=require(_0xde9b('0x19'))['db'];function respondWithStatusCode(_0x530215,_0x4417e2){_0x4417e2=_0x4417e2||0xcc;return function(_0x3e162f){if(_0x3e162f){return _0x530215[_0xde9b('0x1a')](_0x4417e2);}return _0x530215[_0xde9b('0x1b')](_0x4417e2)[_0xde9b('0x1c')]();};}function respondWithResult(_0x5611b0,_0x1ae9ad){_0x1ae9ad=_0x1ae9ad||0xc8;return function(_0x2a129f){if(_0x2a129f){return _0x5611b0[_0xde9b('0x1b')](_0x1ae9ad)[_0xde9b('0x1d')](_0x2a129f);}};}function respondWithFilteredResult(_0x271073,_0x5e0fb9){return function(_0x3924aa){if(_0x3924aa){var _0x292496=typeof _0x5e0fb9[_0xde9b('0x1e')]===_0xde9b('0x1f')&&typeof _0x5e0fb9[_0xde9b('0x20')]===_0xde9b('0x1f');var _0x5a4acf=_0x3924aa[_0xde9b('0x21')];var _0x149b26=_0x292496?0x0:_0x5e0fb9[_0xde9b('0x1e')];var _0x2e6c81=_0x292496?_0x3924aa[_0xde9b('0x21')]:_0x5e0fb9[_0xde9b('0x1e')]+_0x5e0fb9['limit'];var _0x161367;if(_0x2e6c81>=_0x5a4acf){_0x2e6c81=_0x5a4acf;_0x161367=0xc8;}else{_0x161367=0xce;}_0x271073[_0xde9b('0x1b')](_0x161367);return _0x271073[_0xde9b('0x22')](_0xde9b('0x23'),_0x149b26+'-'+_0x2e6c81+'/'+_0x5a4acf)['json'](_0x3924aa);}return null;};}function patchUpdates(_0x1bcd7c){return function(_0x502874){try{jsonpatch[_0xde9b('0x24')](_0x502874,_0x1bcd7c,!![]);}catch(_0x197e47){return BPromise[_0xde9b('0x25')](_0x197e47);}return _0x502874[_0xde9b('0x26')]();};}function saveUpdates(_0x44cfc1,_0x10051c){return function(_0x4a6517){if(_0x4a6517){return _0x4a6517[_0xde9b('0x27')](_0x44cfc1)['then'](function(_0x42bbde){return _0x42bbde;});}return null;};}function removeEntity(_0x3c8d54,_0x26b226){return function(_0x57ca80){if(_0x57ca80){return _0x57ca80[_0xde9b('0x28')]()[_0xde9b('0x29')](function(){_0x3c8d54[_0xde9b('0x1b')](0xcc)[_0xde9b('0x1c')]();});}};}function handleEntityNotFound(_0x42a9ab,_0x43fc77){return function(_0x3050fb){if(!_0x3050fb){_0x42a9ab['sendStatus'](0x194);}return _0x3050fb;};}function handleError(_0x180883,_0x4aa00c){_0x4aa00c=_0x4aa00c||0x1f4;return function(_0xba0f40){logger[_0xde9b('0x2a')](_0xba0f40[_0xde9b('0x2b')]);if(_0xba0f40['name']){delete _0xba0f40[_0xde9b('0x2c')];}_0x180883[_0xde9b('0x1b')](_0x4aa00c)[_0xde9b('0x2d')](_0xba0f40);};}exports[_0xde9b('0x2e')]=function(_0x1b4a7f,_0x4dc512){var _0x158bd2={},_0x25662a={},_0x1ac6a1={'count':0x0,'rows':[]};var _0x3f813e=_[_0xde9b('0x2f')](db[_0xde9b('0x30')][_0xde9b('0x31')],function(_0x1ceac7){return{'name':_0x1ceac7[_0xde9b('0x32')],'type':_0x1ceac7[_0xde9b('0x33')]['key']};});_0x25662a[_0xde9b('0x34')]=_[_0xde9b('0x2f')](_0x3f813e,_0xde9b('0x2c'));_0x25662a[_0xde9b('0x35')]=_[_0xde9b('0x36')](_0x1b4a7f[_0xde9b('0x35')]);_0x25662a['filters']=_[_0xde9b('0x37')](_0x25662a[_0xde9b('0x34')],_0x25662a['query']);_0x158bd2[_0xde9b('0x38')]=_['intersection'](_0x25662a[_0xde9b('0x34')],qs['fields'](_0x1b4a7f[_0xde9b('0x35')]['fields']));_0x158bd2[_0xde9b('0x38')]=_0x158bd2['attributes'][_0xde9b('0x39')]?_0x158bd2[_0xde9b('0x38')]:_0x25662a[_0xde9b('0x34')];if(!_0x1b4a7f[_0xde9b('0x35')][_0xde9b('0x3a')](_0xde9b('0x3b'))){_0x158bd2['limit']=qs['limit'](_0x1b4a7f['query']['limit']);_0x158bd2['offset']=qs[_0xde9b('0x1e')](_0x1b4a7f['query']['offset']);}_0x158bd2[_0xde9b('0x3c')]=qs[_0xde9b('0x3d')](_0x1b4a7f[_0xde9b('0x35')][_0xde9b('0x3d')]);_0x158bd2[_0xde9b('0x3e')]=qs[_0xde9b('0x3f')](_[_0xde9b('0x40')](_0x1b4a7f['query'],_0x25662a[_0xde9b('0x3f')]),_0x3f813e);if(_0x1b4a7f['query']['filter']){_0x158bd2['where']=_['merge'](_0x158bd2[_0xde9b('0x3e')],{'$or':_['map'](_0x3f813e,function(_0x17330f){if(_0x17330f[_0xde9b('0x33')]!=='VIRTUAL'){var _0x276fb7={};_0x276fb7[_0x17330f[_0xde9b('0x2c')]]={'$like':'%'+_0x1b4a7f[_0xde9b('0x35')][_0xde9b('0x41')]+'%'};return _0x276fb7;}})});}_0x158bd2=_[_0xde9b('0x42')]({},_0x158bd2,_0x1b4a7f[_0xde9b('0x43')]);var _0x27b3e7={'where':_0x158bd2[_0xde9b('0x3e')]};return db[_0xde9b('0x30')][_0xde9b('0x21')](_0x27b3e7)[_0xde9b('0x29')](function(_0x2b67b0){_0x1ac6a1[_0xde9b('0x21')]=_0x2b67b0;if(_0x1b4a7f[_0xde9b('0x35')][_0xde9b('0x44')]){_0x158bd2[_0xde9b('0x45')]=[{'all':!![]}];}return db[_0xde9b('0x30')][_0xde9b('0x46')](_0x158bd2);})[_0xde9b('0x29')](function(_0x215682){_0x1ac6a1['rows']=_0x215682;return _0x1ac6a1;})[_0xde9b('0x29')](respondWithFilteredResult(_0x4dc512,_0x158bd2))['catch'](handleError(_0x4dc512,null));};exports[_0xde9b('0x47')]=function(_0xee5cec,_0x89951f){var _0x504fdb={'raw':!![],'where':{'id':_0xee5cec[_0xde9b('0x48')]['id']}},_0x1d9ed4={};_0x1d9ed4['model']=_[_0xde9b('0x36')](db[_0xde9b('0x30')][_0xde9b('0x31')]);_0x1d9ed4[_0xde9b('0x35')]=_['keys'](_0xee5cec[_0xde9b('0x35')]);_0x1d9ed4[_0xde9b('0x3f')]=_[_0xde9b('0x37')](_0x1d9ed4[_0xde9b('0x34')],_0x1d9ed4[_0xde9b('0x35')]);_0x504fdb['attributes']=_[_0xde9b('0x37')](_0x1d9ed4['model'],qs['fields'](_0xee5cec[_0xde9b('0x35')][_0xde9b('0x49')]));_0x504fdb[_0xde9b('0x38')]=_0x504fdb['attributes'][_0xde9b('0x39')]?_0x504fdb[_0xde9b('0x38')]:_0x1d9ed4['model'];if(_0xee5cec[_0xde9b('0x35')][_0xde9b('0x44')]){_0x504fdb[_0xde9b('0x45')]=[{'all':!![]}];}_0x504fdb=_[_0xde9b('0x42')]({},_0x504fdb,_0xee5cec[_0xde9b('0x43')]);return db[_0xde9b('0x30')]['find'](_0x504fdb)['then'](handleEntityNotFound(_0x89951f,null))[_0xde9b('0x29')](respondWithResult(_0x89951f,null))[_0xde9b('0x4a')](handleError(_0x89951f,null));};exports[_0xde9b('0x4b')]=function(_0x159960,_0x4e4abc){return db[_0xde9b('0x30')]['create'](_0x159960[_0xde9b('0x4c')],{})[_0xde9b('0x29')](respondWithResult(_0x4e4abc,0xc9))[_0xde9b('0x4a')](handleError(_0x4e4abc,null));};exports[_0xde9b('0x27')]=function(_0x4a2056,_0x2512a1){if(_0x4a2056[_0xde9b('0x4c')]['id']){delete _0x4a2056[_0xde9b('0x4c')]['id'];}return db[_0xde9b('0x30')][_0xde9b('0x4d')]({'where':{'id':_0x4a2056[_0xde9b('0x48')]['id']}})[_0xde9b('0x29')](handleEntityNotFound(_0x2512a1,null))[_0xde9b('0x29')](saveUpdates(_0x4a2056[_0xde9b('0x4c')],null))[_0xde9b('0x29')](respondWithResult(_0x2512a1,null))[_0xde9b('0x4a')](handleError(_0x2512a1,null));};exports[_0xde9b('0x28')]=function(_0xcea940,_0x5b9026){return db['VoiceDialReport'][_0xde9b('0x4d')]({'where':{'id':_0xcea940[_0xde9b('0x48')]['id']}})['then'](handleEntityNotFound(_0x5b9026,null))[_0xde9b('0x29')](removeEntity(_0x5b9026,null))[_0xde9b('0x4a')](handleError(_0x5b9026,null));};exports[_0xde9b('0x4e')]=function(_0x9e6410,_0x37e68f){return db['VoiceDialReport'][_0xde9b('0x4e')]()[_0xde9b('0x29')](respondWithResult(_0x37e68f,null))['catch'](handleError(_0x37e68f,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 12db496..8fb16fb 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 _0x25b4=['path','rimraf','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','report_dial','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1b8e60,_0x21b885){var _0x363363=function(_0x5987c7){while(--_0x5987c7){_0x1b8e60['push'](_0x1b8e60['shift']());}};_0x363363(++_0x21b885);}(_0x25b4,0x1ab));var _0x425b=function(_0x39bfb6,_0x4272c8){_0x39bfb6=_0x39bfb6-0x0;var _0x23fef9=_0x25b4[_0x39bfb6];return _0x23fef9;};'use strict';var _=require(_0x425b('0x0'));var util=require('util');var logger=require(_0x425b('0x1'))(_0x425b('0x2'));var moment=require(_0x425b('0x3'));var BPromise=require(_0x425b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x425b('0x5'));var rimraf=require(_0x425b('0x6'));var config=require(_0x425b('0x7'));var attributes=require(_0x425b('0x8'));module['exports']=function(_0x27e02e,_0x1e22e4){return _0x27e02e[_0x425b('0x9')](_0x425b('0xa'),attributes,{'tableName':_0x425b('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf684=['define','VoiceDialReport','uniqueid','lodash','../../config/logger','moment','path','rimraf','./voiceDialReport.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf684,0x1d9));var _0x4f68=function(_0x3e7ce6,_0x38913e){_0x3e7ce6=_0x3e7ce6-0x0;var _0x558426=_0xf684[_0x3e7ce6];return _0x558426;};'use strict';var _=require(_0x4f68('0x0'));var util=require('util');var logger=require(_0x4f68('0x1'))('api');var moment=require(_0x4f68('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f68('0x3'));var rimraf=require(_0x4f68('0x4'));var config=require('../../config/environment');var attributes=require(_0x4f68('0x5'));module[_0x4f68('0x6')]=function(_0x996aec,_0x2173b7){return _0x996aec[_0x4f68('0x7')](_0x4f68('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x4f68('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 e631e94..a679be9 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 _0x5f3e=['VoiceDialReport','attributes','limit','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','create','body','options','raw','UpdateVoiceDialReport'];(function(_0x18baea,_0x52f617){var _0x19a0b4=function(_0x5e9e01){while(--_0x5e9e01){_0x18baea['push'](_0x18baea['shift']());}};_0x19a0b4(++_0x52f617);}(_0x5f3e,0x1c5));var _0xe5f3=function(_0x40c55f,_0x2581fa){_0x40c55f=_0x40c55f-0x0;var _0x5df2c4=_0x5f3e[_0x40c55f];return _0x5df2c4;};'use strict';var _=require(_0xe5f3('0x0'));var util=require(_0xe5f3('0x1'));var moment=require('moment');var BPromise=require(_0xe5f3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5f3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe5f3('0x4'));var logger=require(_0xe5f3('0x5'))(_0xe5f3('0x6'));var config=require('../../config/environment');var jayson=require(_0xe5f3('0x7'));var client=jayson[_0xe5f3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x103a87,_0x751bda,_0x3f7047){return new BPromise(function(_0x5800ca,_0x5605f1){return client[_0xe5f3('0x9')](_0x103a87,_0x3f7047)[_0xe5f3('0xa')](function(_0x1fcd1a){logger['info'](_0xe5f3('0xb'),_0x751bda,_0xe5f3('0xc'));logger[_0xe5f3('0xd')](_0xe5f3('0xe'),_0x751bda,_0xe5f3('0xc'),JSON[_0xe5f3('0xf')](_0x1fcd1a));if(_0x1fcd1a[_0xe5f3('0x10')]){if(_0x1fcd1a[_0xe5f3('0x10')][_0xe5f3('0x11')]===0x1f4){logger[_0xe5f3('0x10')](_0xe5f3('0xb'),_0x751bda,_0x1fcd1a[_0xe5f3('0x10')][_0xe5f3('0x12')]);return _0x5605f1(_0x1fcd1a[_0xe5f3('0x10')][_0xe5f3('0x12')]);}logger[_0xe5f3('0x10')](_0xe5f3('0xb'),_0x751bda,_0x1fcd1a[_0xe5f3('0x10')][_0xe5f3('0x12')]);return _0x5800ca(_0x1fcd1a[_0xe5f3('0x10')][_0xe5f3('0x12')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x751bda,'request\x20sent');_0x5800ca(_0x1fcd1a[_0xe5f3('0x13')][_0xe5f3('0x12')]);}})[_0xe5f3('0x14')](function(_0x3f0f45){logger[_0xe5f3('0x10')](_0xe5f3('0xb'),_0x751bda,_0x3f0f45);_0x5605f1(_0x3f0f45);});});}exports[_0xe5f3('0x15')]=function(_0x266529){var _0x353009=this;return new Promise(function(_0x5267ef,_0x350d88){return db['VoiceDialReport'][_0xe5f3('0x16')](_0x266529[_0xe5f3('0x17')],{'raw':_0x266529[_0xe5f3('0x18')]?_0x266529[_0xe5f3('0x18')][_0xe5f3('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x2e29f6){logger['info'](_0xe5f3('0x15'),_0x266529);logger['debug'](_0xe5f3('0x15'),_0x266529,JSON[_0xe5f3('0xf')](_0x2e29f6));_0x5267ef(_0x2e29f6);})['catch'](function(_0x44ffa4){logger['error']('CreateVoiceDialReport',_0x44ffa4['message'],_0x266529);_0x350d88(_0x353009[_0xe5f3('0x10')](0x1f4,_0x44ffa4['message']));});});};exports[_0xe5f3('0x1a')]=function(_0x5eb6d0){var _0x53093e=this;return new Promise(function(_0x12d968,_0x5d72a0){return db[_0xe5f3('0x1b')]['update'](_0x5eb6d0['body'],{'raw':_0x5eb6d0[_0xe5f3('0x18')]?_0x5eb6d0[_0xe5f3('0x18')][_0xe5f3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5eb6d0['options']?_0x5eb6d0[_0xe5f3('0x18')]['where']||null:null,'attributes':_0x5eb6d0[_0xe5f3('0x18')]?_0x5eb6d0['options'][_0xe5f3('0x1c')]||null:null,'limit':_0x5eb6d0[_0xe5f3('0x18')]?_0x5eb6d0[_0xe5f3('0x18')][_0xe5f3('0x1d')]||null:null})['then'](function(_0x46a743){logger['info'](_0xe5f3('0x1a'),_0x5eb6d0);logger[_0xe5f3('0xd')](_0xe5f3('0x1a'),_0x5eb6d0,JSON[_0xe5f3('0xf')](_0x46a743));_0x12d968(_0x46a743);})[_0xe5f3('0x14')](function(_0x1b451d){logger[_0xe5f3('0x10')](_0xe5f3('0x1a'),_0x1b451d[_0xe5f3('0x12')],_0x5eb6d0);_0x5d72a0(_0x53093e[_0xe5f3('0x10')](0x1f4,_0x1b451d['message']));});});}; \ No newline at end of file +var _0x6a76=['result','VoiceDialReport','create','options','raw','info','CreateVoiceDialReport','UpdateVoiceDialReport','update','body','attributes','limit','then','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5192d7,_0x3dc1ae){var _0x3d79f4=function(_0x5b0a94){while(--_0x5b0a94){_0x5192d7['push'](_0x5192d7['shift']());}};_0x3d79f4(++_0x3dc1ae);}(_0x6a76,0x1c8));var _0x66a7=function(_0x4c44ba,_0x4be39d){_0x4c44ba=_0x4c44ba-0x0;var _0x49a77a=_0x6a76[_0x4c44ba];return _0x49a77a;};'use strict';var _=require(_0x66a7('0x0'));var util=require(_0x66a7('0x1'));var moment=require(_0x66a7('0x2'));var BPromise=require(_0x66a7('0x3'));var rs=require(_0x66a7('0x4'));var fs=require('fs');var Redis=require(_0x66a7('0x5'));var db=require(_0x66a7('0x6'))['db'];var utils=require(_0x66a7('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x66a7('0x8'));var client=jayson[_0x66a7('0x9')][_0x66a7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36201e,_0x5bdfe1,_0x4dcd4b){return new BPromise(function(_0x228115,_0x2762dc){return client[_0x66a7('0xb')](_0x36201e,_0x4dcd4b)['then'](function(_0x39eb09){logger['info'](_0x66a7('0xc'),_0x5bdfe1,_0x66a7('0xd'));logger[_0x66a7('0xe')](_0x66a7('0xf'),_0x5bdfe1,_0x66a7('0xd'),JSON[_0x66a7('0x10')](_0x39eb09));if(_0x39eb09[_0x66a7('0x11')]){if(_0x39eb09[_0x66a7('0x11')][_0x66a7('0x12')]===0x1f4){logger[_0x66a7('0x11')](_0x66a7('0xc'),_0x5bdfe1,_0x39eb09['error'][_0x66a7('0x13')]);return _0x2762dc(_0x39eb09[_0x66a7('0x11')][_0x66a7('0x13')]);}logger[_0x66a7('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x5bdfe1,_0x39eb09[_0x66a7('0x11')][_0x66a7('0x13')]);return _0x228115(_0x39eb09[_0x66a7('0x11')][_0x66a7('0x13')]);}else{logger['info'](_0x66a7('0xc'),_0x5bdfe1,'request\x20sent');_0x228115(_0x39eb09[_0x66a7('0x14')]['message']);}})['catch'](function(_0x2013db){logger[_0x66a7('0x11')](_0x66a7('0xc'),_0x5bdfe1,_0x2013db);_0x2762dc(_0x2013db);});});}exports['CreateVoiceDialReport']=function(_0x78f69e){var _0x2c9b48=this;return new Promise(function(_0x1e6394,_0x35bf09){return db[_0x66a7('0x15')][_0x66a7('0x16')](_0x78f69e['body'],{'raw':_0x78f69e['options']?_0x78f69e[_0x66a7('0x17')][_0x66a7('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x455344){logger[_0x66a7('0x19')]('CreateVoiceDialReport',_0x78f69e);logger['debug'](_0x66a7('0x1a'),_0x78f69e,JSON[_0x66a7('0x10')](_0x455344));_0x1e6394(_0x455344);})['catch'](function(_0xecacdd){logger[_0x66a7('0x11')](_0x66a7('0x1a'),_0xecacdd[_0x66a7('0x13')],_0x78f69e);_0x35bf09(_0x2c9b48[_0x66a7('0x11')](0x1f4,_0xecacdd[_0x66a7('0x13')]));});});};exports[_0x66a7('0x1b')]=function(_0x115ff6){var _0x595f1a=this;return new Promise(function(_0x5ae83f,_0x491581){return db[_0x66a7('0x15')][_0x66a7('0x1c')](_0x115ff6[_0x66a7('0x1d')],{'raw':_0x115ff6[_0x66a7('0x17')]?_0x115ff6[_0x66a7('0x17')][_0x66a7('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x115ff6[_0x66a7('0x17')]?_0x115ff6[_0x66a7('0x17')]['where']||null:null,'attributes':_0x115ff6[_0x66a7('0x17')]?_0x115ff6['options'][_0x66a7('0x1e')]||null:null,'limit':_0x115ff6[_0x66a7('0x17')]?_0x115ff6[_0x66a7('0x17')][_0x66a7('0x1f')]||null:null})[_0x66a7('0x20')](function(_0x5a57ab){logger[_0x66a7('0x19')](_0x66a7('0x1b'),_0x115ff6);logger['debug']('UpdateVoiceDialReport',_0x115ff6,JSON[_0x66a7('0x10')](_0x5a57ab));_0x5ae83f(_0x5a57ab);})[_0x66a7('0x21')](function(_0x3c8ef7){logger[_0x66a7('0x11')](_0x66a7('0x1b'),_0x3c8ef7[_0x66a7('0x13')],_0x115ff6);_0x491581(_0x595f1a[_0x66a7('0x11')](0x1f4,_0x3c8ef7[_0x66a7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 1888464..51f4a9b 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 _0x3d5b=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x25cd2c,_0x57498e){var _0x1e364c=function(_0x35ac2e){while(--_0x35ac2e){_0x25cd2c['push'](_0x25cd2c['shift']());}};_0x1e364c(++_0x57498e);}(_0x3d5b,0x180));var _0xb3d5=function(_0x2d7ed5,_0x54fb3a){_0x2d7ed5=_0x2d7ed5-0x0;var _0x243020=_0x3d5b[_0x2d7ed5];return _0x243020;};'use strict';var multer=require(_0xb3d5('0x0'));var util=require(_0xb3d5('0x1'));var path=require(_0xb3d5('0x2'));var timeout=require(_0xb3d5('0x3'));var express=require(_0xb3d5('0x4'));var router=express['Router']();var fs_extra=require(_0xb3d5('0x5'));var auth=require(_0xb3d5('0x6'));var interaction=require(_0xb3d5('0x7'));var config=require(_0xb3d5('0x8'));var controller=require(_0xb3d5('0x9'));router[_0xb3d5('0xa')]('/',auth[_0xb3d5('0xb')](),controller[_0xb3d5('0xc')]);router[_0xb3d5('0xa')](_0xb3d5('0xd'),auth[_0xb3d5('0xb')](),controller[_0xb3d5('0xe')]);router[_0xb3d5('0xf')]('/',auth[_0xb3d5('0xb')](),controller[_0xb3d5('0x10')]);router['post'](_0xb3d5('0x11'),auth['isAuthenticated'](),controller[_0xb3d5('0x12')]);router['put'](_0xb3d5('0xd'),auth['isAuthenticated'](),controller[_0xb3d5('0x13')]);router[_0xb3d5('0x14')](_0xb3d5('0xd'),auth[_0xb3d5('0xb')](),controller[_0xb3d5('0x15')]);module[_0xb3d5('0x16')]=router; \ No newline at end of file +var _0x427a=['./voiceExtension.controller','get','index','/:id','isAuthenticated','show','create','post','/:id/applications','addApplications','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x455f19,_0x4f8f3a){var _0x422f21=function(_0x4537cd){while(--_0x4537cd){_0x455f19['push'](_0x455f19['shift']());}};_0x422f21(++_0x4f8f3a);}(_0x427a,0x15e));var _0xa427=function(_0x82d06e,_0xb52ffa){_0x82d06e=_0x82d06e-0x0;var _0x36de13=_0x427a[_0x82d06e];return _0x36de13;};'use strict';var multer=require(_0xa427('0x0'));var util=require('util');var path=require(_0xa427('0x1'));var timeout=require(_0xa427('0x2'));var express=require(_0xa427('0x3'));var router=express[_0xa427('0x4')]();var fs_extra=require(_0xa427('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa427('0x6'));var config=require('../../config/environment');var controller=require(_0xa427('0x7'));router[_0xa427('0x8')]('/',auth['isAuthenticated'](),controller[_0xa427('0x9')]);router[_0xa427('0x8')](_0xa427('0xa'),auth[_0xa427('0xb')](),controller[_0xa427('0xc')]);router['post']('/',auth[_0xa427('0xb')](),controller[_0xa427('0xd')]);router[_0xa427('0xe')](_0xa427('0xf'),auth[_0xa427('0xb')](),controller[_0xa427('0x10')]);router[_0xa427('0x11')](_0xa427('0xa'),auth[_0xa427('0xb')](),controller[_0xa427('0x12')]);router[_0xa427('0x13')]('/:id',auth[_0xa427('0xb')](),controller[_0xa427('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 85c952d..a428ce2 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 _0x89dc=['getDataValue','exten','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','any','INTEGER','BOOLEAN','VIRTUAL'];(function(_0x15cef4,_0x448b97){var _0x384430=function(_0x38ebce){while(--_0x38ebce){_0x15cef4['push'](_0x15cef4['shift']());}};_0x384430(++_0x448b97);}(_0x89dc,0x132));var _0xc89d=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x89dc[_0x5c3c0b];return _0x52ecd2;};'use strict';var Sequelize=require('sequelize');module[_0xc89d('0x0')]={'context':{'type':Sequelize[_0xc89d('0x1')],'allowNull':![],'unique':_0xc89d('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xc89d('0x1')],'allowNull':![],'unique':_0xc89d('0x2')},'priority':{'type':Sequelize[_0xc89d('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xc89d('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xc89d('0x1')],'allowNull':![],'defaultValue':_0xc89d('0x3')},'appdata':{'type':Sequelize[_0xc89d('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xc89d('0x4')](_0xc89d('0x5'),_0xc89d('0x6'),_0xc89d('0x7'),_0xc89d('0x8'),_0xc89d('0x9'),'system',_0xc89d('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0xc89d('0x1')]},'interval':{'type':Sequelize[_0xc89d('0x1')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xc89d('0xb')]},'isApp':{'type':Sequelize[_0xc89d('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xc89d('0x1')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0xc89d('0x1')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xc89d('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0xc89d('0xd')],'get':function(_0x31d7bf){return this[_0xc89d('0xe')](_0xc89d('0xf'));}},'alias':{'type':Sequelize[_0xc89d('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xb6e5=['BOOLEAN','wav','VIRTUAL','exten','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system','any','INTEGER'];(function(_0x589f71,_0x4d056b){var _0x2b5a85=function(_0x36ebb5){while(--_0x36ebb5){_0x589f71['push'](_0x589f71['shift']());}};_0x2b5a85(++_0x4d056b);}(_0xb6e5,0x146));var _0x5b6e=function(_0x508904,_0x1ba1bf){_0x508904=_0x508904-0x0;var _0x372db8=_0xb6e5[_0x508904];return _0x372db8;};'use strict';var Sequelize=require('sequelize');module[_0x5b6e('0x0')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x5b6e('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x5b6e('0x2')},'tag':{'type':Sequelize[_0x5b6e('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x5b6e('0x1')],'allowNull':![],'defaultValue':_0x5b6e('0x3')},'appdata':{'type':Sequelize[_0x5b6e('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x5b6e('0x4'),_0x5b6e('0x5'),_0x5b6e('0x6'),'inbound-fax','outbound-fax',_0x5b6e('0x7'),_0x5b6e('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0x5b6e('0x1')]},'interval':{'type':Sequelize[_0x5b6e('0x1')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x5b6e('0x9')]},'isApp':{'type':Sequelize[_0x5b6e('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x5b6e('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x5b6e('0x9')]},'recordingFormat':{'type':Sequelize[_0x5b6e('0x1')],'defaultValue':_0x5b6e('0xb')},'answer':{'type':Sequelize[_0x5b6e('0xa')],'defaultValue':!![]},'name':{'type':Sequelize[_0x5b6e('0xc')],'get':function(_0x3e5d8b){return this['getDataValue'](_0x5b6e('0xd'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 8d5d386..9787f78 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 _0xdf28=['autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','register','sendStatus','status','json','undefined','count','offset','limit','Content-Range','destroy','then','get','inbound','OutboundRoutes','outbound','internal','filter','ignore','map','value','includes','type','error','stack','index','VoiceExtension','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','name','includeAll','include','findAll','catch','params','rawAttributes','options','find','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','InternalRoutes','UserProfileSection','userProfileId'];(function(_0x140410,_0x4806bd){var _0x14c739=function(_0x4fdc14){while(--_0x4fdc14){_0x140410['push'](_0x140410['shift']());}};_0x14c739(++_0x4806bd);}(_0xdf28,0x192));var _0x8df2=function(_0x158988,_0x30addd){_0x158988=_0x158988-0x0;var _0x2bd5cd=_0xdf28[_0x158988];return _0x2bd5cd;};'use strict';var _=require(_0x8df2('0x0'));var Redis=require(_0x8df2('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x8df2('0x2'))(_0x8df2('0x3'));var config=require(_0x8df2('0x4'));var db=require(_0x8df2('0x5'))['db'];config[_0x8df2('0x6')]=_[_0x8df2('0x7')](config[_0x8df2('0x6')],{'host':_0x8df2('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8df2('0x6')]));require(_0x8df2('0x9'))[_0x8df2('0xa')](socket);function respondWithStatusCode(_0x2b939a,_0x58ae9b){_0x58ae9b=_0x58ae9b||0xcc;return function(_0x440027){if(_0x440027){return _0x2b939a[_0x8df2('0xb')](_0x58ae9b);}return _0x2b939a[_0x8df2('0xc')](_0x58ae9b)['end']();};}function respondWithResult(_0x258a9c,_0x55d40f){_0x55d40f=_0x55d40f||0xc8;return function(_0x3724b3){if(_0x3724b3){return _0x258a9c[_0x8df2('0xc')](_0x55d40f)[_0x8df2('0xd')](_0x3724b3);}};}function respondWithFilteredResult(_0x34698a,_0x40d071){return function(_0x5008cc){if(_0x5008cc){var _0xe1cd23=typeof _0x40d071['offset']===_0x8df2('0xe')&&typeof _0x40d071['limit']===_0x8df2('0xe');var _0x5ecd49=_0x5008cc[_0x8df2('0xf')];var _0x22fb20=_0xe1cd23?0x0:_0x40d071[_0x8df2('0x10')];var _0x4de7f2=_0xe1cd23?_0x5008cc[_0x8df2('0xf')]:_0x40d071[_0x8df2('0x10')]+_0x40d071[_0x8df2('0x11')];var _0x5e2a36;if(_0x4de7f2>=_0x5ecd49){_0x4de7f2=_0x5ecd49;_0x5e2a36=0xc8;}else{_0x5e2a36=0xce;}_0x34698a[_0x8df2('0xc')](_0x5e2a36);return _0x34698a['set'](_0x8df2('0x12'),_0x22fb20+'-'+_0x4de7f2+'/'+_0x5ecd49)[_0x8df2('0xd')](_0x5008cc);}return null;};}function removeEntity(_0x5e0d48){return function(_0x4d226b){if(_0x4d226b){return _0x4d226b[_0x8df2('0x13')]()[_0x8df2('0x14')](function(){var _0x156b96=_0x4d226b[_0x8df2('0x15')]({'plain':!![]});var _0xdf6c4a=[{'name':'InboundRoutes','value':_0x8df2('0x16'),'ignore':![]},{'name':_0x8df2('0x17'),'value':_0x8df2('0x18'),'ignore':![]},{'name':'InternalRoutes','value':_0x8df2('0x19'),'ignore':![]}];var _0x27de40=_(_0xdf6c4a)[_0x8df2('0x1a')](_0x8df2('0x1b'))[_0x8df2('0x1c')]('value')[_0x8df2('0x1d')]();if(_[_0x8df2('0x1e')](_0x27de40,_0x156b96['type'])){return;}var _0x2100d3=_['find'](_0xdf6c4a,[_0x8df2('0x1d'),_0x156b96[_0x8df2('0x1f')]])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x2100d3,'resourceId':_0x156b96['id']}})[_0x8df2('0x14')](function(){return _0x4d226b;});})[_0x8df2('0x14')](function(){_0x5e0d48[_0x8df2('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13b92){return function(_0x150b99){if(!_0x150b99){_0x13b92[_0x8df2('0xb')](0x194);}return _0x150b99;};}function handleError(_0x27b208,_0x46138d){_0x46138d=_0x46138d||0x1f4;return function(_0x4643e0){logger[_0x8df2('0x20')](_0x4643e0[_0x8df2('0x21')]);if(_0x4643e0['name']){delete _0x4643e0['name'];}_0x27b208[_0x8df2('0xc')](_0x46138d)['send'](_0x4643e0);};}exports[_0x8df2('0x22')]=function(_0x90c5b7,_0x1a4c66){var _0x433fd8={},_0xf6ee17={},_0x577acc={'count':0x0,'rows':[]};var _0x276ad3=_[_0x8df2('0x1c')](db[_0x8df2('0x23')]['rawAttributes'],function(_0x8f106b){return{'name':_0x8f106b[_0x8df2('0x24')],'type':_0x8f106b[_0x8df2('0x1f')][_0x8df2('0x25')]};});_0xf6ee17[_0x8df2('0x26')]=_['map'](_0x276ad3,'name');_0xf6ee17[_0x8df2('0x27')]=_[_0x8df2('0x28')](_0x90c5b7[_0x8df2('0x27')]);_0xf6ee17[_0x8df2('0x29')]=_[_0x8df2('0x2a')](_0xf6ee17[_0x8df2('0x26')],_0xf6ee17[_0x8df2('0x27')]);_0x433fd8[_0x8df2('0x2b')]=_[_0x8df2('0x2a')](_0xf6ee17[_0x8df2('0x26')],qs['fields'](_0x90c5b7[_0x8df2('0x27')][_0x8df2('0x2c')]));_0x433fd8[_0x8df2('0x2b')]=_0x433fd8['attributes'][_0x8df2('0x2d')]?_0x433fd8[_0x8df2('0x2b')]:_0xf6ee17[_0x8df2('0x26')];if(!_0x90c5b7[_0x8df2('0x27')][_0x8df2('0x2e')](_0x8df2('0x2f'))){_0x433fd8[_0x8df2('0x11')]=qs['limit'](_0x90c5b7['query'][_0x8df2('0x11')]);_0x433fd8[_0x8df2('0x10')]=qs[_0x8df2('0x10')](_0x90c5b7[_0x8df2('0x27')]['offset']);}_0x433fd8[_0x8df2('0x30')]=qs['sort'](_0x90c5b7['query']['sort']);_0x433fd8[_0x8df2('0x31')]=qs[_0x8df2('0x29')](_[_0x8df2('0x32')](_0x90c5b7[_0x8df2('0x27')],_0xf6ee17['filters']),_0x276ad3);if(_0x90c5b7['query']['filter']){_0x433fd8[_0x8df2('0x31')]=_[_0x8df2('0x33')](_0x433fd8[_0x8df2('0x31')],{'$or':_[_0x8df2('0x1c')](_0x276ad3,function(_0x2357ff){if(_0x2357ff[_0x8df2('0x1f')]!=='VIRTUAL'){var _0x217a62={};_0x217a62[_0x2357ff[_0x8df2('0x34')]]={'$like':'%'+_0x90c5b7[_0x8df2('0x27')]['filter']+'%'};return _0x217a62;}})});}_0x433fd8=_['merge']({},_0x433fd8,_0x90c5b7['options']);var _0x4f152a={'where':_0x433fd8[_0x8df2('0x31')]};return db[_0x8df2('0x23')][_0x8df2('0xf')](_0x4f152a)[_0x8df2('0x14')](function(_0x1139d2){_0x577acc[_0x8df2('0xf')]=_0x1139d2;if(_0x90c5b7[_0x8df2('0x27')][_0x8df2('0x35')]){_0x433fd8[_0x8df2('0x36')]=[{'all':!![]}];}return db['VoiceExtension'][_0x8df2('0x37')](_0x433fd8);})['then'](function(_0x2141c8){_0x577acc['rows']=_0x2141c8;return _0x577acc;})[_0x8df2('0x14')](respondWithFilteredResult(_0x1a4c66,_0x433fd8))[_0x8df2('0x38')](handleError(_0x1a4c66,null));};exports['show']=function(_0x27e663,_0x4320dd){var _0x54faf1={'raw':![],'where':{'id':_0x27e663[_0x8df2('0x39')]['id']}},_0x496ec8={};_0x496ec8[_0x8df2('0x26')]=_[_0x8df2('0x28')](db['VoiceExtension'][_0x8df2('0x3a')]);_0x496ec8[_0x8df2('0x27')]=_[_0x8df2('0x28')](_0x27e663[_0x8df2('0x27')]);_0x496ec8[_0x8df2('0x29')]=_['intersection'](_0x496ec8[_0x8df2('0x26')],_0x496ec8[_0x8df2('0x27')]);_0x54faf1['attributes']=_[_0x8df2('0x2a')](_0x496ec8[_0x8df2('0x26')],qs['fields'](_0x27e663[_0x8df2('0x27')][_0x8df2('0x2c')]));_0x54faf1[_0x8df2('0x2b')]=_0x54faf1[_0x8df2('0x2b')][_0x8df2('0x2d')]?_0x54faf1[_0x8df2('0x2b')]:_0x496ec8[_0x8df2('0x26')];if(_0x27e663['query'][_0x8df2('0x35')]){_0x54faf1['include']=[{'all':!![]}];}_0x54faf1=_[_0x8df2('0x33')]({},_0x54faf1,_0x27e663[_0x8df2('0x3b')]);return db[_0x8df2('0x23')][_0x8df2('0x3c')](_0x54faf1)['then'](handleEntityNotFound(_0x4320dd,null))['then'](respondWithResult(_0x4320dd,null))['catch'](handleError(_0x4320dd,null));};exports['destroy']=function(_0x302209,_0x1aebb2){return db[_0x8df2('0x23')]['find']({'where':{'id':_0x302209[_0x8df2('0x39')]['id']}})[_0x8df2('0x14')](handleEntityNotFound(_0x1aebb2,null))[_0x8df2('0x14')](removeEntity(_0x1aebb2,null))[_0x8df2('0x38')](handleError(_0x1aebb2,null));};exports[_0x8df2('0x3d')]=function(_0xcc1654,_0x17426d){if(_0xcc1654[_0x8df2('0x3e')][_0x8df2('0x1f')]===_0x8df2('0x18')&&!_[_0x8df2('0x3f')](_0xcc1654[_0x8df2('0x3e')][_0x8df2('0x40')],'_')){_0xcc1654[_0x8df2('0x3e')]['exten']='_'[_0x8df2('0x41')](_0xcc1654[_0x8df2('0x3e')][_0x8df2('0x40')]);}return db[_0x8df2('0x23')][_0x8df2('0x3d')](_0xcc1654[_0x8df2('0x3e')],{'raw':![]})[_0x8df2('0x14')](function(_0x2b5c15){var _0x17d681=_0xcc1654[_0x8df2('0x42')]['get']({'plain':!![]});if(!_0x17d681)throw new Error(_0x8df2('0x43'));if(_0x17d681[_0x8df2('0x44')]===_0x8df2('0x42')){var _0x5b300f=_0x2b5c15[_0x8df2('0x15')]({'plain':!![]});var _0x4f274b=[{'name':_0x8df2('0x45'),'value':_0x8df2('0x16')},{'name':'OutboundRoutes','value':_0x8df2('0x18')},{'name':_0x8df2('0x46'),'value':'internal'}];var _0x2ece17=_['find'](_0x4f274b,['value',_0x5b300f[_0x8df2('0x1f')]])[_0x8df2('0x34')];return db[_0x8df2('0x47')][_0x8df2('0x3c')]({'where':{'name':_0x2ece17,'userProfileId':_0x17d681[_0x8df2('0x48')]},'raw':!![]})[_0x8df2('0x14')](function(_0x32cd5b){if(_0x32cd5b&&_0x32cd5b[_0x8df2('0x49')]===0x0){return db[_0x8df2('0x4a')][_0x8df2('0x3d')]({'name':_0x5b300f[_0x8df2('0x34')],'resourceId':_0x5b300f['id'],'type':_0x32cd5b[_0x8df2('0x34')],'sectionId':_0x32cd5b['id']},{})[_0x8df2('0x14')](function(){return _0x2b5c15;});}else{return _0x2b5c15;}})[_0x8df2('0x38')](function(_0x27d5c5){logger[_0x8df2('0x20')](_0x8df2('0x4b'),_0x27d5c5);throw _0x27d5c5;});}return _0x2b5c15;})['then'](respondWithResult(_0x17426d,0xc9))['catch'](handleError(_0x17426d,null));};exports[_0x8df2('0x4c')]=function(_0x32efcd,_0x4a6c4c){if(_0x32efcd['body']['id']){delete _0x32efcd[_0x8df2('0x3e')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x32efcd[_0x8df2('0x39')]['id']}})[_0x8df2('0x14')](handleEntityNotFound(_0x4a6c4c,null))['then'](function(_0x1fe618){if(_0x1fe618){return db[_0x8df2('0x23')]['update'](_['pick'](_0x32efcd[_0x8df2('0x3e')],[_0x8df2('0x40'),_0x8df2('0x4d'),_0x8df2('0x4e'),_0x8df2('0x4f'),_0x8df2('0x50'),_0x8df2('0x51'),'alias']),{'where':{'context':_0x1fe618[_0x8df2('0x4d')],'exten':_0x1fe618[_0x8df2('0x40')]},'individualHooks':!![]})[_0x8df2('0x14')](function(_0x427ab1){return _0x427ab1;});}return null;})[_0x8df2('0x14')](respondWithStatusCode(_0x4a6c4c,null))[_0x8df2('0x38')](handleError(_0x4a6c4c,null));};exports[_0x8df2('0x52')]=function(_0x31828f,_0x1d5453){var _0x427385=_0x31828f[_0x8df2('0x39')]['id'];var _0x1387c2=_0x31828f[_0x8df2('0x3e')];var _0xc43d24=0xc8;var _0x158eb4=null;return db[_0x8df2('0x53')][_0x8df2('0x54')]({'isolationLevel':db[_0x8df2('0x53')][_0x8df2('0x55')][_0x8df2('0x56')][_0x8df2('0x57')]},function(_0x147187){return db['VoiceExtension'][_0x8df2('0x58')]({'where':{'id':_0x427385},'transaction':_0x147187})[_0x8df2('0x14')](function(_0x22862a){if(_0x22862a){return db['VoiceExtension'][_0x8df2('0x13')]({'where':{'VoiceExtensionId':_0x427385},'transaction':_0x147187})[_0x8df2('0x14')](function(){var _0x186df1=_['map'](_0x1387c2,function(_0x444919){_0x444919[_0x8df2('0x59')]=_0x427385;_0x444919[_0x8df2('0x5a')]=!![];return _0x444919;});return _0x22862a['createRouting'](_0x186df1);})[_0x8df2('0x14')](function(_0x350fd2){return db[_0x8df2('0x23')][_0x8df2('0x5b')](_0x350fd2,{'transaction':_0x147187});});}else{_0xc43d24=0x194;_0x158eb4=[];}});})['then'](function(){if(_0xc43d24!==0x194){return db[_0x8df2('0x23')][_0x8df2('0x5c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x427385},'order':_0x8df2('0x5d')})[_0x8df2('0x14')](function(_0x1880bd){_0x158eb4=_0x1880bd;});}})['catch'](function(_0x171ee5){_0xc43d24=0x1f4;logger[_0x8df2('0x20')](_0x171ee5[_0x8df2('0x21')]);if(_0x171ee5['name']){delete _0x171ee5[_0x8df2('0x34')];}_0x158eb4=_0x171ee5;})[_0x8df2('0x5e')](function(){if(_0x158eb4===null){_0x1d5453[_0x8df2('0xb')](_0xc43d24);}else{if(_0xc43d24===0x1f4){_0x1d5453[_0x8df2('0xc')](_0xc43d24)['send'](_0x158eb4);}else{_0x1d5453[_0x8df2('0xc')](_0xc43d24)[_0x8df2('0xd')](_0x158eb4);}}});}; \ No newline at end of file +var _0xdc93=['stack','index','fieldName','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','options','includeAll','VoiceExtension','findAll','rows','catch','show','params','rawAttributes','include','create','body','outbound','startsWith','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','internal','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','finally','send','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','destroy','then','OutboundRoutes','InternalRoutes','filter','map','value','includes','type','find','name','UserProfileResource','end','error'];(function(_0xc4d9ac,_0x313006){var _0x17f386=function(_0x273365){while(--_0x273365){_0xc4d9ac['push'](_0xc4d9ac['shift']());}};_0x17f386(++_0x313006);}(_0xdc93,0x105));var _0x3dc9=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0xdc93[_0x3de8a4];return _0x4635cf;};'use strict';var _=require(_0x3dc9('0x0'));var Redis=require(_0x3dc9('0x1'));var qs=require(_0x3dc9('0x2'));var logger=require(_0x3dc9('0x3'))('api');var config=require(_0x3dc9('0x4'));var db=require('../../mysqldb')['db'];config[_0x3dc9('0x5')]=_[_0x3dc9('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3dc9('0x7'))(new Redis(config[_0x3dc9('0x5')]));require(_0x3dc9('0x8'))[_0x3dc9('0x9')](socket);function respondWithStatusCode(_0x10b506,_0x1e7565){_0x1e7565=_0x1e7565||0xcc;return function(_0x5b84c1){if(_0x5b84c1){return _0x10b506[_0x3dc9('0xa')](_0x1e7565);}return _0x10b506[_0x3dc9('0xb')](_0x1e7565)['end']();};}function respondWithResult(_0x3b932,_0x2c4d7f){_0x2c4d7f=_0x2c4d7f||0xc8;return function(_0x3e7369){if(_0x3e7369){return _0x3b932[_0x3dc9('0xb')](_0x2c4d7f)['json'](_0x3e7369);}};}function respondWithFilteredResult(_0x1cb0cd,_0x2e5eac){return function(_0x412735){if(_0x412735){var _0x248ff6=typeof _0x2e5eac[_0x3dc9('0xc')]===_0x3dc9('0xd')&&typeof _0x2e5eac['limit']===_0x3dc9('0xd');var _0x802fb0=_0x412735['count'];var _0x524565=_0x248ff6?0x0:_0x2e5eac[_0x3dc9('0xc')];var _0x592cbc=_0x248ff6?_0x412735[_0x3dc9('0xe')]:_0x2e5eac['offset']+_0x2e5eac[_0x3dc9('0xf')];var _0x1ed7b9;if(_0x592cbc>=_0x802fb0){_0x592cbc=_0x802fb0;_0x1ed7b9=0xc8;}else{_0x1ed7b9=0xce;}_0x1cb0cd[_0x3dc9('0xb')](_0x1ed7b9);return _0x1cb0cd[_0x3dc9('0x10')](_0x3dc9('0x11'),_0x524565+'-'+_0x592cbc+'/'+_0x802fb0)[_0x3dc9('0x12')](_0x412735);}return null;};}function removeEntity(_0x189b53){return function(_0x3860b9){if(_0x3860b9){return _0x3860b9[_0x3dc9('0x13')]()[_0x3dc9('0x14')](function(){var _0xc20460=_0x3860b9['get']({'plain':!![]});var _0x4f8288=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x3dc9('0x15'),'value':'outbound','ignore':![]},{'name':_0x3dc9('0x16'),'value':'internal','ignore':![]}];var _0x4c0cb7=_(_0x4f8288)[_0x3dc9('0x17')]('ignore')[_0x3dc9('0x18')](_0x3dc9('0x19'))[_0x3dc9('0x19')]();if(_[_0x3dc9('0x1a')](_0x4c0cb7,_0xc20460[_0x3dc9('0x1b')])){return;}var _0x4088ab=_[_0x3dc9('0x1c')](_0x4f8288,[_0x3dc9('0x19'),_0xc20460['type']])[_0x3dc9('0x1d')];return db[_0x3dc9('0x1e')][_0x3dc9('0x13')]({'where':{'type':_0x4088ab,'resourceId':_0xc20460['id']}})['then'](function(){return _0x3860b9;});})[_0x3dc9('0x14')](function(){_0x189b53['status'](0xcc)[_0x3dc9('0x1f')]();});}};}function handleEntityNotFound(_0x4e9369){return function(_0x54c70a){if(!_0x54c70a){_0x4e9369[_0x3dc9('0xa')](0x194);}return _0x54c70a;};}function handleError(_0x5991c9,_0x18a2b3){_0x18a2b3=_0x18a2b3||0x1f4;return function(_0x358058){logger[_0x3dc9('0x20')](_0x358058[_0x3dc9('0x21')]);if(_0x358058[_0x3dc9('0x1d')]){delete _0x358058['name'];}_0x5991c9[_0x3dc9('0xb')](_0x18a2b3)['send'](_0x358058);};}exports[_0x3dc9('0x22')]=function(_0x80865c,_0x2b524d){var _0x4c4690={},_0x31649a={},_0x22a372={'count':0x0,'rows':[]};var _0x5c2919=_[_0x3dc9('0x18')](db['VoiceExtension']['rawAttributes'],function(_0x158743){return{'name':_0x158743[_0x3dc9('0x23')],'type':_0x158743[_0x3dc9('0x1b')][_0x3dc9('0x24')]};});_0x31649a['model']=_['map'](_0x5c2919,_0x3dc9('0x1d'));_0x31649a['query']=_[_0x3dc9('0x25')](_0x80865c[_0x3dc9('0x26')]);_0x31649a[_0x3dc9('0x27')]=_[_0x3dc9('0x28')](_0x31649a[_0x3dc9('0x29')],_0x31649a[_0x3dc9('0x26')]);_0x4c4690['attributes']=_[_0x3dc9('0x28')](_0x31649a[_0x3dc9('0x29')],qs[_0x3dc9('0x2a')](_0x80865c[_0x3dc9('0x26')][_0x3dc9('0x2a')]));_0x4c4690['attributes']=_0x4c4690[_0x3dc9('0x2b')][_0x3dc9('0x2c')]?_0x4c4690[_0x3dc9('0x2b')]:_0x31649a[_0x3dc9('0x29')];if(!_0x80865c['query'][_0x3dc9('0x2d')](_0x3dc9('0x2e'))){_0x4c4690[_0x3dc9('0xf')]=qs[_0x3dc9('0xf')](_0x80865c[_0x3dc9('0x26')][_0x3dc9('0xf')]);_0x4c4690['offset']=qs['offset'](_0x80865c['query'][_0x3dc9('0xc')]);}_0x4c4690[_0x3dc9('0x2f')]=qs[_0x3dc9('0x30')](_0x80865c[_0x3dc9('0x26')][_0x3dc9('0x30')]);_0x4c4690['where']=qs[_0x3dc9('0x27')](_[_0x3dc9('0x31')](_0x80865c[_0x3dc9('0x26')],_0x31649a['filters']),_0x5c2919);if(_0x80865c['query'][_0x3dc9('0x17')]){_0x4c4690['where']=_[_0x3dc9('0x32')](_0x4c4690[_0x3dc9('0x33')],{'$or':_['map'](_0x5c2919,function(_0x64ec06){if(_0x64ec06[_0x3dc9('0x1b')]!=='VIRTUAL'){var _0x44c8b6={};_0x44c8b6[_0x64ec06[_0x3dc9('0x1d')]]={'$like':'%'+_0x80865c[_0x3dc9('0x26')][_0x3dc9('0x17')]+'%'};return _0x44c8b6;}})});}_0x4c4690=_[_0x3dc9('0x32')]({},_0x4c4690,_0x80865c[_0x3dc9('0x34')]);var _0x3b1c09={'where':_0x4c4690[_0x3dc9('0x33')]};return db['VoiceExtension'][_0x3dc9('0xe')](_0x3b1c09)[_0x3dc9('0x14')](function(_0x34de3a){_0x22a372['count']=_0x34de3a;if(_0x80865c['query'][_0x3dc9('0x35')]){_0x4c4690['include']=[{'all':!![]}];}return db[_0x3dc9('0x36')][_0x3dc9('0x37')](_0x4c4690);})[_0x3dc9('0x14')](function(_0x55905b){_0x22a372[_0x3dc9('0x38')]=_0x55905b;return _0x22a372;})['then'](respondWithFilteredResult(_0x2b524d,_0x4c4690))[_0x3dc9('0x39')](handleError(_0x2b524d,null));};exports[_0x3dc9('0x3a')]=function(_0x19011e,_0x2d090e){var _0x5a6b6f={'raw':![],'where':{'id':_0x19011e[_0x3dc9('0x3b')]['id']}},_0x32b056={};_0x32b056[_0x3dc9('0x29')]=_['keys'](db['VoiceExtension'][_0x3dc9('0x3c')]);_0x32b056[_0x3dc9('0x26')]=_[_0x3dc9('0x25')](_0x19011e[_0x3dc9('0x26')]);_0x32b056[_0x3dc9('0x27')]=_[_0x3dc9('0x28')](_0x32b056['model'],_0x32b056[_0x3dc9('0x26')]);_0x5a6b6f[_0x3dc9('0x2b')]=_['intersection'](_0x32b056[_0x3dc9('0x29')],qs[_0x3dc9('0x2a')](_0x19011e[_0x3dc9('0x26')][_0x3dc9('0x2a')]));_0x5a6b6f[_0x3dc9('0x2b')]=_0x5a6b6f[_0x3dc9('0x2b')]['length']?_0x5a6b6f[_0x3dc9('0x2b')]:_0x32b056[_0x3dc9('0x29')];if(_0x19011e[_0x3dc9('0x26')][_0x3dc9('0x35')]){_0x5a6b6f[_0x3dc9('0x3d')]=[{'all':!![]}];}_0x5a6b6f=_[_0x3dc9('0x32')]({},_0x5a6b6f,_0x19011e[_0x3dc9('0x34')]);return db[_0x3dc9('0x36')][_0x3dc9('0x1c')](_0x5a6b6f)[_0x3dc9('0x14')](handleEntityNotFound(_0x2d090e,null))[_0x3dc9('0x14')](respondWithResult(_0x2d090e,null))[_0x3dc9('0x39')](handleError(_0x2d090e,null));};exports[_0x3dc9('0x13')]=function(_0x3047fb,_0x694e6d){return db[_0x3dc9('0x36')][_0x3dc9('0x1c')]({'where':{'id':_0x3047fb[_0x3dc9('0x3b')]['id']}})[_0x3dc9('0x14')](handleEntityNotFound(_0x694e6d,null))[_0x3dc9('0x14')](removeEntity(_0x694e6d,null))[_0x3dc9('0x39')](handleError(_0x694e6d,null));};exports[_0x3dc9('0x3e')]=function(_0x28b9d1,_0x318c3d){if(_0x28b9d1[_0x3dc9('0x3f')][_0x3dc9('0x1b')]===_0x3dc9('0x40')&&!_[_0x3dc9('0x41')](_0x28b9d1['body'][_0x3dc9('0x42')],'_')){_0x28b9d1[_0x3dc9('0x3f')]['exten']='_'[_0x3dc9('0x43')](_0x28b9d1['body']['exten']);}return db[_0x3dc9('0x36')]['create'](_0x28b9d1[_0x3dc9('0x3f')],{'raw':![]})[_0x3dc9('0x14')](function(_0x3b663e){var _0x49af5e=_0x28b9d1[_0x3dc9('0x44')][_0x3dc9('0x45')]({'plain':!![]});if(!_0x49af5e)throw new Error(_0x3dc9('0x46'));if(_0x49af5e[_0x3dc9('0x47')]===_0x3dc9('0x44')){var _0x29effb=_0x3b663e['get']({'plain':!![]});var _0x42323f=[{'name':'InboundRoutes','value':_0x3dc9('0x48')},{'name':_0x3dc9('0x15'),'value':_0x3dc9('0x40')},{'name':'InternalRoutes','value':_0x3dc9('0x49')}];var _0x50e0be=_[_0x3dc9('0x1c')](_0x42323f,['value',_0x29effb[_0x3dc9('0x1b')]])[_0x3dc9('0x1d')];return db['UserProfileSection']['find']({'where':{'name':_0x50e0be,'userProfileId':_0x49af5e[_0x3dc9('0x4a')]},'raw':!![]})[_0x3dc9('0x14')](function(_0x548749){if(_0x548749&&_0x548749[_0x3dc9('0x4b')]===0x0){return db[_0x3dc9('0x1e')][_0x3dc9('0x3e')]({'name':_0x29effb[_0x3dc9('0x1d')],'resourceId':_0x29effb['id'],'type':_0x548749[_0x3dc9('0x1d')],'sectionId':_0x548749['id']},{})[_0x3dc9('0x14')](function(){return _0x3b663e;});}else{return _0x3b663e;}})[_0x3dc9('0x39')](function(_0x49d142){logger['error'](_0x3dc9('0x4c'),_0x49d142);throw _0x49d142;});}return _0x3b663e;})[_0x3dc9('0x14')](respondWithResult(_0x318c3d,0xc9))['catch'](handleError(_0x318c3d,null));};exports[_0x3dc9('0x4d')]=function(_0x7f88b4,_0x4f624e){if(_0x7f88b4[_0x3dc9('0x3f')]['id']){delete _0x7f88b4[_0x3dc9('0x3f')]['id'];}return db[_0x3dc9('0x36')][_0x3dc9('0x1c')]({'where':{'id':_0x7f88b4[_0x3dc9('0x3b')]['id']}})[_0x3dc9('0x14')](handleEntityNotFound(_0x4f624e,null))['then'](function(_0x4f3b40){if(_0x4f3b40){return db['VoiceExtension'][_0x3dc9('0x4d')](_[_0x3dc9('0x31')](_0x7f88b4[_0x3dc9('0x3f')],[_0x3dc9('0x42'),'context',_0x3dc9('0x4e'),_0x3dc9('0x4f'),_0x3dc9('0x50'),_0x3dc9('0x51'),_0x3dc9('0x52')]),{'where':{'context':_0x4f3b40[_0x3dc9('0x53')],'exten':_0x4f3b40['exten']},'individualHooks':!![]})[_0x3dc9('0x14')](function(_0x381493){return _0x381493;});}return null;})[_0x3dc9('0x14')](respondWithStatusCode(_0x4f624e,null))[_0x3dc9('0x39')](handleError(_0x4f624e,null));};exports[_0x3dc9('0x54')]=function(_0x144a91,_0x55ee3b){var _0x482612=_0x144a91['params']['id'];var _0x22f303=_0x144a91[_0x3dc9('0x3f')];var _0xafc260=0xc8;var _0x541c93=null;return db[_0x3dc9('0x55')][_0x3dc9('0x56')]({'isolationLevel':db['sequelize'][_0x3dc9('0x57')][_0x3dc9('0x58')][_0x3dc9('0x59')]},function(_0x36f69e){return db[_0x3dc9('0x36')][_0x3dc9('0x5a')]({'where':{'id':_0x482612},'transaction':_0x36f69e})[_0x3dc9('0x14')](function(_0xa11c38){if(_0xa11c38){return db['VoiceExtension'][_0x3dc9('0x13')]({'where':{'VoiceExtensionId':_0x482612},'transaction':_0x36f69e})[_0x3dc9('0x14')](function(){var _0x411215=_[_0x3dc9('0x18')](_0x22f303,function(_0x48f9f9){_0x48f9f9[_0x3dc9('0x5b')]=_0x482612;_0x48f9f9[_0x3dc9('0x5c')]=!![];return _0x48f9f9;});return _0xa11c38[_0x3dc9('0x5d')](_0x411215);})[_0x3dc9('0x14')](function(_0x313f57){return db['VoiceExtension'][_0x3dc9('0x5e')](_0x313f57,{'transaction':_0x36f69e});});}else{_0xafc260=0x194;_0x541c93=[];}});})[_0x3dc9('0x14')](function(){if(_0xafc260!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x482612},'order':_0x3dc9('0x5f')})[_0x3dc9('0x14')](function(_0x53e241){_0x541c93=_0x53e241;});}})[_0x3dc9('0x39')](function(_0x38269e){_0xafc260=0x1f4;logger[_0x3dc9('0x20')](_0x38269e[_0x3dc9('0x21')]);if(_0x38269e[_0x3dc9('0x1d')]){delete _0x38269e['name'];}_0x541c93=_0x38269e;})[_0x3dc9('0x60')](function(){if(_0x541c93===null){_0x55ee3b[_0x3dc9('0xa')](_0xafc260);}else{if(_0xafc260===0x1f4){_0x55ee3b['status'](_0xafc260)[_0x3dc9('0x61')](_0x541c93);}else{_0x55ee3b[_0x3dc9('0xb')](_0xafc260)[_0x3dc9('0x12')](_0x541c93);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index c81f15c..99b97cf 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 _0x275c=['emit','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove'];(function(_0x1e2ccf,_0x367b8b){var _0x1c4080=function(_0x4511ad){while(--_0x4511ad){_0x1e2ccf['push'](_0x1e2ccf['shift']());}};_0x1c4080(++_0x367b8b);}(_0x275c,0xad));var _0xc275=function(_0x38b44f,_0x51bc24){_0x38b44f=_0x38b44f-0x0;var _0x3f6779=_0x275c[_0x38b44f];return _0x3f6779;};'use strict';var EventEmitter=require(_0xc275('0x0'));var VoiceExtension=require(_0xc275('0x1'))['db'][_0xc275('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xc275('0x3')](0x0);var events={'afterCreate':_0xc275('0x4'),'afterUpdate':_0xc275('0x5'),'afterDestroy':_0xc275('0x6')};function emitEvent(_0x34aa1f){return function(_0x2495b5,_0x34db43,_0x185d9b){VoiceExtensionEvents[_0xc275('0x7')](_0x34aa1f+':'+_0x2495b5['id'],_0x2495b5);VoiceExtensionEvents[_0xc275('0x7')](_0x34aa1f,_0x2495b5);_0x185d9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xc275('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0xde00=['hook','exports','VoiceExtension','setMaxListeners','update','remove','emit'];(function(_0x4176fb,_0x5a6c88){var _0x16fcbe=function(_0x356969){while(--_0x356969){_0x4176fb['push'](_0x4176fb['shift']());}};_0x16fcbe(++_0x5a6c88);}(_0xde00,0x10c));var _0x0de0=function(_0x1c011c,_0x384710){_0x1c011c=_0x1c011c-0x0;var _0x277506=_0xde00[_0x1c011c];return _0x277506;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0x0de0('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x0de0('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0de0('0x2'),'afterDestroy':_0x0de0('0x3')};function emitEvent(_0x344556){return function(_0x9a7487,_0x278979,_0x294f67){VoiceExtensionEvents[_0x0de0('0x4')](_0x344556+':'+_0x9a7487['id'],_0x9a7487);VoiceExtensionEvents[_0x0de0('0x4')](_0x344556,_0x9a7487);_0x294f67(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x0de0('0x5')](e,emitEvent(event));}}module[_0x0de0('0x6')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 59360f3..789d72d 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 _0xe444=['url','length','name','param','split','prefix','phone','SIP','join','indexOf','replace','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','IntervalId','interval','*,*,*,*','intervals','filter','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','queue','playback','includes','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','then','lodash','./voiceExtension.attributes','models','type','Set','CDR(type)=','context','exten','alias','CDR(routeAlias)=','No\x20alias\x20set','push','inbound','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options'];(function(_0x2bf8f2,_0x27c758){var _0x1ba2fa=function(_0x1439f8){while(--_0x1439f8){_0x2bf8f2['push'](_0x2bf8f2['shift']());}};_0x1ba2fa(++_0x27c758);}(_0xe444,0xe0));var _0x4e44=function(_0x224901,_0x1a0a77){_0x224901=_0x224901-0x0;var _0x522d85=_0xe444[_0x224901];return _0x522d85;};'use strict';var _=require(_0x4e44('0x0'));var attributes=require(_0x4e44('0x1'));module['exports']=function(_0x53341e){var _0x234992=_0x53341e[_0x4e44('0x2')];function _0x33fde8(_0x433beb){var _0x5aa738=0x2;var _0x4c8454=[{'type':_0x433beb[_0x4e44('0x3')],'app':_0x4e44('0x4'),'appdata':_0x4e44('0x5')+_0x433beb['type'],'context':_0x433beb[_0x4e44('0x6')],'exten':_0x433beb[_0x4e44('0x7')],'priority':_0x5aa738++,'VoiceExtensionId':_0x433beb['id']},{'type':_0x433beb[_0x4e44('0x3')],'app':_0x433beb['alias']?_0x4e44('0x4'):'NoOp','appdata':_0x433beb[_0x4e44('0x8')]?_0x4e44('0x9')+_0x433beb[_0x4e44('0x8')]:_0x4e44('0xa'),'context':_0x433beb[_0x4e44('0x6')],'exten':_0x433beb['exten'],'priority':_0x5aa738++,'VoiceExtensionId':_0x433beb['id']}];if(_0x433beb[_0x4e44('0x3')]==='inbound'){_0x4c8454[_0x4e44('0xb')]({'type':_0x4e44('0xc'),'app':_0x4e44('0x4'),'appdata':_0x4e44('0xd')+_0x433beb['id'],'context':_0x433beb[_0x4e44('0x6')],'exten':_0x433beb['exten'],'priority':_0x5aa738++,'VoiceExtensionId':_0x433beb['id']});}_0x4c8454['push']({'type':_0x433beb['type'],'app':_0x4e44('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x433beb[_0x4e44('0x6')],'exten':_0x433beb[_0x4e44('0x7')],'priority':_0x5aa738++,'VoiceExtensionId':_0x433beb['id']},{'type':_0x433beb[_0x4e44('0x3')],'app':_0x4e44('0x4'),'appdata':_0x4e44('0xe'),'context':_0x433beb[_0x4e44('0x6')],'exten':_0x433beb[_0x4e44('0x7')],'priority':_0x5aa738++,'VoiceExtensionId':_0x433beb['id']},{'type':_0x433beb['type'],'app':_0x4e44('0x4'),'appdata':_0x4e44('0xf'),'context':_0x433beb[_0x4e44('0x6')],'exten':_0x433beb[_0x4e44('0x7')],'priority':_0x5aa738++,'VoiceExtensionId':_0x433beb['id']});return _0x4c8454;}function _0x18501f(_0x1245c3){var _0x45744e=0x2;var _0x54e362=[{'type':_0x4e44('0x10'),'app':_0x4e44('0x4'),'appdata':_0x4e44('0x11'),'context':_0x1245c3[_0x4e44('0x6')],'exten':_0x1245c3[_0x4e44('0x7')],'priority':_0x45744e++,'VoiceExtensionId':_0x1245c3['id']},{'type':_0x4e44('0x10'),'app':_0x1245c3['alias']?_0x4e44('0x4'):'NoOp','appdata':_0x1245c3[_0x4e44('0x8')]?_0x4e44('0x9')+_0x1245c3[_0x4e44('0x8')]:_0x4e44('0xa'),'context':_0x1245c3[_0x4e44('0x6')],'exten':_0x1245c3[_0x4e44('0x7')],'priority':_0x45744e++,'VoiceExtensionId':_0x1245c3['id']},{'type':_0x4e44('0x10'),'app':_0x4e44('0x4'),'appdata':_0x4e44('0x12')+(_0x1245c3[_0x4e44('0x13')]?_0x4e44('0x14')+_0x1245c3[_0x4e44('0x13')]+'}':_0x4e44('0x15')),'context':_0x1245c3[_0x4e44('0x6')],'exten':_0x1245c3[_0x4e44('0x7')],'priority':_0x45744e++,'VoiceExtensionId':_0x1245c3['id']},{'type':_0x4e44('0x10'),'app':'Set','appdata':_0x4e44('0xd')+_0x1245c3['id'],'context':_0x1245c3[_0x4e44('0x6')],'exten':_0x1245c3[_0x4e44('0x7')],'priority':_0x45744e++,'VoiceExtensionId':_0x1245c3['id']},{'type':_0x4e44('0x10'),'app':_0x4e44('0x16'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x45744e+0x2)+_0x4e44('0x17')+(_0x45744e+0x1)+')','context':_0x1245c3[_0x4e44('0x6')],'exten':_0x1245c3[_0x4e44('0x7')],'priority':_0x45744e++,'VoiceExtensionId':_0x1245c3['id']},{'type':_0x4e44('0x10'),'app':'Set','appdata':_0x1245c3[_0x4e44('0x13')]?_0x4e44('0x18')+_0x1245c3[_0x4e44('0x13')]+'}':_0x4e44('0x19'),'context':_0x1245c3['context'],'exten':_0x1245c3[_0x4e44('0x7')],'priority':_0x45744e++,'VoiceExtensionId':_0x1245c3['id']},{'type':_0x4e44('0x10'),'app':_0x4e44('0x4'),'appdata':_0x4e44('0x1a'),'context':_0x1245c3[_0x4e44('0x6')],'exten':_0x1245c3['exten'],'priority':_0x45744e++,'VoiceExtensionId':_0x1245c3['id']},{'type':'outbound','app':'Set','appdata':_0x4e44('0xe'),'context':_0x1245c3[_0x4e44('0x6')],'exten':_0x1245c3[_0x4e44('0x7')],'priority':_0x45744e++,'VoiceExtensionId':_0x1245c3['id']},{'type':_0x4e44('0x10'),'app':_0x4e44('0x4'),'appdata':_0x4e44('0xf'),'context':_0x1245c3[_0x4e44('0x6')],'exten':_0x1245c3['exten'],'priority':_0x45744e++,'VoiceExtensionId':_0x1245c3['id']},{'type':'outbound','app':_0x4e44('0x4'),'appdata':_0x4e44('0x1b')+_0x1245c3['id'],'context':_0x1245c3['context'],'exten':_0x1245c3['exten'],'priority':_0x45744e++,'VoiceExtensionId':_0x1245c3['id']}];if(_0x1245c3[_0x4e44('0x1c')](_0x4e44('0x1d'))&&_0x1245c3[_0x4e44('0x1d')]!==_0x4e44('0x1e')){_0x54e362[_0x4e44('0xb')]({'type':_0x4e44('0x10'),'app':_0x4e44('0x4'),'appdata':_0x4e44('0x1f'),'context':_0x1245c3['context'],'exten':_0x1245c3[_0x4e44('0x7')],'priority':_0x45744e++,'VoiceExtensionId':_0x1245c3['id']},{'type':_0x4e44('0x10'),'app':'Set','appdata':_0x4e44('0x20')+_0x1245c3[_0x4e44('0x1d')]||_0x4e44('0x21'),'context':_0x1245c3[_0x4e44('0x6')],'exten':_0x1245c3['exten'],'priority':_0x45744e++,'VoiceExtensionId':_0x1245c3['id']});}return _0x54e362;}function _0x3fd8e6(_0x24dfbb,_0x21ea63){var _0x50486e=[{'name':_0x4e44('0x22'),'param':0x0},{'name':_0x4e44('0x23'),'param':0x1},{'name':_0x4e44('0x24'),'param':0x2},{'name':_0x4e44('0x25'),'param':0x3}];var _0x5f46a5={};var _0x1be167=_0x21ea63['split'](',');var _0x52aa3f=[];for(var _0x83fb83=0x0;_0x83fb83<_0x50486e[_0x4e44('0x26')];_0x83fb83++){switch(_0x50486e[_0x83fb83][_0x4e44('0x27')]){case _0x4e44('0x22'):_0x5f46a5[_0x4e44('0x22')]=_0x1be167[_0x50486e[_0x83fb83][_0x4e44('0x28')]]['split']('/')[0x1];_0x5f46a5['phone']=_0x1be167[_0x50486e[_0x83fb83][_0x4e44('0x28')]][_0x4e44('0x29')]('/')[0x2];_0x5f46a5[_0x4e44('0x2a')]=_0x5f46a5[_0x4e44('0x2b')]?_0x5f46a5[_0x4e44('0x2b')][_0x4e44('0x29')]('$')[0x0]:undefined;_0x5f46a5[_0x4e44('0x2b')]=_0x24dfbb['cutdigits']?(_0x5f46a5[_0x4e44('0x2a')]||'')+_0x4e44('0x14')+_0x24dfbb['cutdigits']+'}':(_0x5f46a5[_0x4e44('0x2a')]||'')+_0x4e44('0x15');_0x52aa3f[_0x50486e[_0x83fb83][_0x4e44('0x28')]]=[_0x4e44('0x2c'),_0x5f46a5[_0x4e44('0x22')],_0x5f46a5[_0x4e44('0x2b')]][_0x4e44('0x2d')]('/');break;case _0x4e44('0x24'):_0x5f46a5[_0x4e44('0x24')]=_0x1be167[_0x50486e[_0x83fb83]['param']];if(_0x24dfbb[_0x4e44('0x1d')]!=='none'){if(_0x5f46a5[_0x4e44('0x24')][_0x4e44('0x2e')]('U(xcally-mixmonitor-context)')<0x0){_0x5f46a5[_0x4e44('0x24')]+='U(xcally-mixmonitor-context)';}}else{_0x5f46a5['options']=_0x5f46a5[_0x4e44('0x24')][_0x4e44('0x2f')](_0x4e44('0x30'),'');}_0x52aa3f[_0x50486e[_0x83fb83][_0x4e44('0x28')]]=_0x5f46a5[_0x4e44('0x24')];break;default:_0x52aa3f[_0x50486e[_0x83fb83][_0x4e44('0x28')]]=_0x1be167[_0x50486e[_0x83fb83][_0x4e44('0x28')]];}}return _0x52aa3f[_0x4e44('0x2d')](',');}function _0xa1c209(_0x1c528d,_0xff4a7b,_0x4f6539){return new Promise(function(_0x10fbc4,_0x1bd0db){var _0x1c62a0=[];if(_[_0x4e44('0x31')](_0xff4a7b))return _0x10fbc4(_0x1c62a0);_0x234992[_0x4e44('0x32')][_0x4e44('0x33')]({'attributes':['id','interval',_0x4e44('0x34')],'raw':!![]})['then'](function(_0x395d8c){for(var _0xd75551=0x0,_0x87f2d8=0x0;_0xd75551<_0xff4a7b[_0x4e44('0x26')];_0xd75551++,_0x87f2d8=0x0){var _0x3f9ce0=_0xff4a7b[_0xd75551];var _0x512c68=[];var _0x39b254=[];delete _0x3f9ce0['id'];if(_0x3f9ce0[_0x4e44('0x35')]!==_0x4e44('0x36')){_0x3f9ce0[_0x4e44('0x37')]=[_0x3f9ce0[_0x4e44('0x35')]];}else{_0x3f9ce0[_0x4e44('0x37')]=_0x3f9ce0[_0x4e44('0x34')]?_['map'](_[_0x4e44('0x38')](_0x395d8c,{'IntervalId':_0x3f9ce0['IntervalId']}),_0x4e44('0x35')):[];}_0x3f9ce0[_0x4e44('0x6')]=_0x1c528d['context'];_0x3f9ce0[_0x4e44('0x7')]=_0x1c528d['exten'];if(_0x3f9ce0[_0x4e44('0x3')])_0x3f9ce0[_0x4e44('0x3')]=_0x3f9ce0[_0x4e44('0x3')][_0x4e44('0x39')]();if(_0x1c528d[_0x4e44('0x3')]===_0x4e44('0x10')){if(_0x3f9ce0[_0x4e44('0x1c')](_0x4e44('0x3a'))&&_0x3f9ce0[_0x4e44('0x3a')]&&_0x3f9ce0[_0x4e44('0x3a')]!=='--'){_0x512c68['push']({'type':_0x3f9ce0[_0x4e44('0x3')][_0x4e44('0x39')](),'app':_0x4e44('0x4'),'appdata':'CDR(tag)='+_0x3f9ce0['tag'],'context':_0x1c528d['context'],'exten':_0x1c528d[_0x4e44('0x7')],'priority':_0x3f9ce0[_0x4e44('0x37')][_0x4e44('0x26')]+_0x4f6539+_0x87f2d8++,'VoiceExtensionId':_0x1c528d['id']});}_0x512c68[_0x4e44('0xb')]({'type':_0x3f9ce0[_0x4e44('0x3')][_0x4e44('0x39')](),'app':_0x4e44('0x16'),'appdata':_0x4e44('0x3b')+(_0x3f9ce0[_0x4e44('0x3c')]?_0x4e44('0x3d')+_0x3f9ce0[_0x4e44('0x3c')]+')':'NoOp(No\x20number\x20available)'),'context':_0x1c528d[_0x4e44('0x6')],'exten':_0x1c528d[_0x4e44('0x7')],'priority':_0x3f9ce0[_0x4e44('0x37')][_0x4e44('0x26')]+_0x4f6539+_0x87f2d8++,'VoiceExtensionId':_0x1c528d['id']});}else{if(_0x3f9ce0[_0x4e44('0x1c')](_0x4e44('0x3e'))){if([_0x4e44('0x3f'),_0x4e44('0x40')][_0x4e44('0x41')](_0x3f9ce0[_0x4e44('0x42')]['toLowerCase']())&&_0x3f9ce0['appType']!==_0x4e44('0x43')){if(_0x3f9ce0[_0x4e44('0x3e')]){_0x512c68[_0x4e44('0xb')]({'type':_0x3f9ce0[_0x4e44('0x3')][_0x4e44('0x39')](),'app':_0x4e44('0x16'),'appdata':_0x4e44('0x44'),'context':_0x1c528d['context'],'exten':_0x1c528d[_0x4e44('0x7')],'priority':_0x3f9ce0[_0x4e44('0x37')]['length']+_0x4f6539+_0x87f2d8++,'VoiceExtensionId':_0x1c528d['id']});_0x512c68['push']({'type':_0x3f9ce0[_0x4e44('0x3')][_0x4e44('0x39')](),'app':'Set','appdata':_0x4e44('0x45'),'context':_0x1c528d['context'],'exten':_0x1c528d[_0x4e44('0x7')],'priority':_0x3f9ce0['intervals'][_0x4e44('0x26')]+_0x4f6539+_0x87f2d8++,'VoiceExtensionId':_0x1c528d['id']});}else{_0x512c68[_0x4e44('0xb')]({'type':_0x3f9ce0[_0x4e44('0x3')][_0x4e44('0x39')](),'app':_0x4e44('0x16'),'appdata':_0x4e44('0x46'),'context':_0x1c528d[_0x4e44('0x6')],'exten':_0x1c528d[_0x4e44('0x7')],'priority':_0x3f9ce0[_0x4e44('0x37')][_0x4e44('0x26')]+_0x4f6539+_0x87f2d8++,'VoiceExtensionId':_0x1c528d['id']});_0x512c68[_0x4e44('0xb')]({'type':_0x3f9ce0[_0x4e44('0x3')]['toLowerCase'](),'app':_0x4e44('0x4'),'appdata':_0x4e44('0x47'),'context':_0x1c528d[_0x4e44('0x6')],'exten':_0x1c528d[_0x4e44('0x7')],'priority':_0x3f9ce0[_0x4e44('0x37')][_0x4e44('0x26')]+_0x4f6539+_0x87f2d8++,'VoiceExtensionId':_0x1c528d['id']});}}}}for(var _0x292876=0x0;_0x292876<_0x3f9ce0[_0x4e44('0x37')][_0x4e44('0x26')];_0x292876++){var _0xd83fc2=_0x4f6539+_0x3f9ce0[_0x4e44('0x37')][_0x4e44('0x26')];var _0x798b6a=_0x292876===_0x3f9ce0[_0x4e44('0x37')][_0x4e44('0x26')]-0x1?_0x4f6539+_0x512c68[_0x4e44('0x26')]+_0x39b254[_0x4e44('0x26')]+0x2:_0x4f6539+_0x292876+0x1;_0x512c68[_0x4e44('0x48')](_0x292876,0x0,{'type':_0x1c528d[_0x4e44('0x3')],'app':_0x4e44('0x49'),'appdata':_0x3f9ce0[_0x4e44('0x37')][_0x292876]+'?'+_0x1c528d['context']+_0x4e44('0x4a')+_0xd83fc2+':'+_0x1c528d[_0x4e44('0x6')]+_0x4e44('0x4a')+_0x798b6a,'exten':_0x1c528d[_0x4e44('0x7')],'context':_0x1c528d[_0x4e44('0x6')],'priority':_0x4f6539+_0x292876,'VoiceExtensionId':_0x1c528d['id']});}if(_0x3f9ce0[_0x4e44('0x4b')]===_0x4e44('0x4c'))_0x3f9ce0['appdata']=_0x3fd8e6(_0x1c528d,_0x3f9ce0[_0x4e44('0x4d')]);_0x3f9ce0[_0x4e44('0x4e')]=_0x512c68[_0x4e44('0x26')]?_[_0x4e44('0x4f')](_0x512c68)[_0x4e44('0x4e')]+0x1:_0x4f6539;_0x1c62a0=_[_0x4e44('0x50')](_0x1c62a0,_0x512c68,[_0x3f9ce0],_0x39b254);_0x4f6539=_['last'](_0x1c62a0)[_0x4e44('0x4e')]+0x1;}return _0x10fbc4(_0x1c62a0);})[_0x4e44('0x51')](function(_0x3f07ad){_0x1bd0db(_0x3f07ad);});});}return _0x53341e[_0x4e44('0x52')](_0x4e44('0x53'),attributes,{'tableName':_0x4e44('0x54'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4da1e7){var _0x47eaef=this[_0x4e44('0x55')]({'plain':!![]});var _0x4b4130=_0x47eaef[_0x4e44('0x3')]===_0x4e44('0x10')?_0x18501f(_0x47eaef):_0x33fde8(_0x47eaef);return _0xa1c209(_0x47eaef,_0x4da1e7,_[_0x4e44('0x4f')](_0x4b4130)[_0x4e44('0x4e')]+0x1)[_0x4e44('0x56')](function(_0x30cfa0){var _0x1616b4=_[_0x4e44('0x50')](_0x4b4130,_0x30cfa0);_0x1616b4[_0x4e44('0xb')]({'type':_0x47eaef['type'],'app':'Hangup','exten':_0x47eaef[_0x4e44('0x7')],'context':_0x47eaef[_0x4e44('0x6')],'priority':_[_0x4e44('0x4f')](_0x1616b4)['priority']+0x1,'VoiceExtensionId':_0x47eaef['id']});return _0x1616b4;});}}});}; \ No newline at end of file +var _0xb194=['$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','appType','outboundDial','priority','last','concat','catch','define','VoiceExtension','voice_extensions','Hangup','lodash','exports','models','Set','type','exten','alias','No\x20alias\x20set','context','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','NoOp','CDR(routeAlias)=','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','url','split','length','name','param','phone','prefix','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval','*,*,*,*','intervals','map','filter','IntervalId','tag','toLowerCase','ExecIf'];(function(_0x73ead2,_0xdfda9d){var _0x4f780e=function(_0x2e27c9){while(--_0x2e27c9){_0x73ead2['push'](_0x73ead2['shift']());}};_0x4f780e(++_0xdfda9d);}(_0xb194,0x1b2));var _0x4b19=function(_0x14dad8,_0x595247){_0x14dad8=_0x14dad8-0x0;var _0x3713f2=_0xb194[_0x14dad8];return _0x3713f2;};'use strict';var _=require(_0x4b19('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x4b19('0x1')]=function(_0x2bea30){var _0x10bd69=_0x2bea30[_0x4b19('0x2')];function _0x3ba6e4(_0x5c07ad){var _0x46faa3=0x2;var _0x3a4700=[{'type':_0x5c07ad['type'],'app':_0x4b19('0x3'),'appdata':'CDR(type)='+_0x5c07ad[_0x4b19('0x4')],'context':_0x5c07ad['context'],'exten':_0x5c07ad[_0x4b19('0x5')],'priority':_0x46faa3++,'VoiceExtensionId':_0x5c07ad['id']},{'type':_0x5c07ad[_0x4b19('0x4')],'app':_0x5c07ad[_0x4b19('0x6')]?'Set':'NoOp','appdata':_0x5c07ad[_0x4b19('0x6')]?'CDR(routeAlias)='+_0x5c07ad[_0x4b19('0x6')]:_0x4b19('0x7'),'context':_0x5c07ad[_0x4b19('0x8')],'exten':_0x5c07ad[_0x4b19('0x5')],'priority':_0x46faa3++,'VoiceExtensionId':_0x5c07ad['id']}];if(_0x5c07ad[_0x4b19('0x4')]===_0x4b19('0x9')){_0x3a4700[_0x4b19('0xa')]({'type':_0x4b19('0x9'),'app':'Set','appdata':_0x4b19('0xb')+_0x5c07ad['id'],'context':_0x5c07ad['context'],'exten':_0x5c07ad[_0x4b19('0x5')],'priority':_0x46faa3++,'VoiceExtensionId':_0x5c07ad['id']});}_0x3a4700[_0x4b19('0xa')]({'type':_0x5c07ad['type'],'app':_0x4b19('0x3'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x5c07ad[_0x4b19('0x8')],'exten':_0x5c07ad[_0x4b19('0x5')],'priority':_0x46faa3++,'VoiceExtensionId':_0x5c07ad['id']},{'type':_0x5c07ad[_0x4b19('0x4')],'app':_0x4b19('0x3'),'appdata':_0x4b19('0xc'),'context':_0x5c07ad['context'],'exten':_0x5c07ad[_0x4b19('0x5')],'priority':_0x46faa3++,'VoiceExtensionId':_0x5c07ad['id']},{'type':_0x5c07ad[_0x4b19('0x4')],'app':_0x4b19('0x3'),'appdata':_0x4b19('0xd'),'context':_0x5c07ad[_0x4b19('0x8')],'exten':_0x5c07ad[_0x4b19('0x5')],'priority':_0x46faa3++,'VoiceExtensionId':_0x5c07ad['id']});return _0x3a4700;}function _0x5d8335(_0xb01cb6){var _0xd3f210=0x2;var _0x21e845=[{'type':_0x4b19('0xe'),'app':_0x4b19('0x3'),'appdata':_0x4b19('0xf'),'context':_0xb01cb6[_0x4b19('0x8')],'exten':_0xb01cb6[_0x4b19('0x5')],'priority':_0xd3f210++,'VoiceExtensionId':_0xb01cb6['id']},{'type':'outbound','app':_0xb01cb6[_0x4b19('0x6')]?'Set':_0x4b19('0x10'),'appdata':_0xb01cb6[_0x4b19('0x6')]?_0x4b19('0x11')+_0xb01cb6[_0x4b19('0x6')]:_0x4b19('0x7'),'context':_0xb01cb6[_0x4b19('0x8')],'exten':_0xb01cb6['exten'],'priority':_0xd3f210++,'VoiceExtensionId':_0xb01cb6['id']},{'type':_0x4b19('0xe'),'app':'Set','appdata':_0x4b19('0x12')+(_0xb01cb6[_0x4b19('0x13')]?_0x4b19('0x14')+_0xb01cb6['cutdigits']+'}':_0x4b19('0x15')),'context':_0xb01cb6['context'],'exten':_0xb01cb6[_0x4b19('0x5')],'priority':_0xd3f210++,'VoiceExtensionId':_0xb01cb6['id']},{'type':_0x4b19('0xe'),'app':'Set','appdata':_0x4b19('0xb')+_0xb01cb6['id'],'context':_0xb01cb6[_0x4b19('0x8')],'exten':_0xb01cb6[_0x4b19('0x5')],'priority':_0xd3f210++,'VoiceExtensionId':_0xb01cb6['id']},{'type':_0x4b19('0xe'),'app':'ExecIf','appdata':_0x4b19('0x16')+(_0xd3f210+0x2)+'):Goto('+(_0xd3f210+0x1)+')','context':_0xb01cb6['context'],'exten':_0xb01cb6[_0x4b19('0x5')],'priority':_0xd3f210++,'VoiceExtensionId':_0xb01cb6['id']},{'type':'outbound','app':_0x4b19('0x3'),'appdata':_0xb01cb6[_0x4b19('0x13')]?_0x4b19('0x17')+_0xb01cb6[_0x4b19('0x13')]+'}':'CDR(prefix)=noprefix','context':_0xb01cb6[_0x4b19('0x8')],'exten':_0xb01cb6[_0x4b19('0x5')],'priority':_0xd3f210++,'VoiceExtensionId':_0xb01cb6['id']},{'type':'outbound','app':_0x4b19('0x3'),'appdata':_0x4b19('0x18'),'context':_0xb01cb6[_0x4b19('0x8')],'exten':_0xb01cb6['exten'],'priority':_0xd3f210++,'VoiceExtensionId':_0xb01cb6['id']},{'type':'outbound','app':_0x4b19('0x3'),'appdata':_0x4b19('0xc'),'context':_0xb01cb6[_0x4b19('0x8')],'exten':_0xb01cb6[_0x4b19('0x5')],'priority':_0xd3f210++,'VoiceExtensionId':_0xb01cb6['id']},{'type':_0x4b19('0xe'),'app':'Set','appdata':_0x4b19('0xd'),'context':_0xb01cb6[_0x4b19('0x8')],'exten':_0xb01cb6[_0x4b19('0x5')],'priority':_0xd3f210++,'VoiceExtensionId':_0xb01cb6['id']},{'type':_0x4b19('0xe'),'app':_0x4b19('0x3'),'appdata':_0x4b19('0x19')+_0xb01cb6['id'],'context':_0xb01cb6[_0x4b19('0x8')],'exten':_0xb01cb6[_0x4b19('0x5')],'priority':_0xd3f210++,'VoiceExtensionId':_0xb01cb6['id']}];if(_0xb01cb6[_0x4b19('0x1a')](_0x4b19('0x1b'))&&_0xb01cb6[_0x4b19('0x1b')]!==_0x4b19('0x1c')){_0x21e845['push']({'type':_0x4b19('0xe'),'app':'Set','appdata':_0x4b19('0x1d'),'context':_0xb01cb6[_0x4b19('0x8')],'exten':_0xb01cb6['exten'],'priority':_0xd3f210++,'VoiceExtensionId':_0xb01cb6['id']},{'type':_0x4b19('0xe'),'app':_0x4b19('0x3'),'appdata':_0x4b19('0x1e')+_0xb01cb6[_0x4b19('0x1b')]||_0x4b19('0x1f'),'context':_0xb01cb6[_0x4b19('0x8')],'exten':_0xb01cb6[_0x4b19('0x5')],'priority':_0xd3f210++,'VoiceExtensionId':_0xb01cb6['id']});}return _0x21e845;}function _0x22d5e7(_0x8907e9,_0x1a88b3){var _0x3ffe55=[{'name':_0x4b19('0x20'),'param':0x0},{'name':_0x4b19('0x21'),'param':0x1},{'name':'options','param':0x2},{'name':_0x4b19('0x22'),'param':0x3}];var _0x5a7452={};var _0x52bbb2=_0x1a88b3[_0x4b19('0x23')](',');var _0x31eabc=[];for(var _0x273986=0x0;_0x273986<_0x3ffe55[_0x4b19('0x24')];_0x273986++){switch(_0x3ffe55[_0x273986][_0x4b19('0x25')]){case _0x4b19('0x20'):_0x5a7452[_0x4b19('0x20')]=_0x52bbb2[_0x3ffe55[_0x273986][_0x4b19('0x26')]][_0x4b19('0x23')]('/')[0x1];_0x5a7452[_0x4b19('0x27')]=_0x52bbb2[_0x3ffe55[_0x273986][_0x4b19('0x26')]]['split']('/')[0x2];_0x5a7452[_0x4b19('0x28')]=_0x5a7452[_0x4b19('0x27')]?_0x5a7452['phone']['split']('$')[0x0]:undefined;_0x5a7452[_0x4b19('0x27')]=_0x8907e9[_0x4b19('0x13')]?(_0x5a7452[_0x4b19('0x28')]||'')+_0x4b19('0x14')+_0x8907e9[_0x4b19('0x13')]+'}':(_0x5a7452['prefix']||'')+'${EXTEN}';_0x31eabc[_0x3ffe55[_0x273986][_0x4b19('0x26')]]=[_0x4b19('0x29'),_0x5a7452[_0x4b19('0x20')],_0x5a7452[_0x4b19('0x27')]][_0x4b19('0x2a')]('/');break;case _0x4b19('0x2b'):_0x5a7452[_0x4b19('0x2b')]=_0x52bbb2[_0x3ffe55[_0x273986][_0x4b19('0x26')]];if(_0x8907e9[_0x4b19('0x1b')]!==_0x4b19('0x1c')){if(_0x5a7452[_0x4b19('0x2b')][_0x4b19('0x2c')](_0x4b19('0x2d'))<0x0){_0x5a7452['options']+=_0x4b19('0x2d');}}else{_0x5a7452[_0x4b19('0x2b')]=_0x5a7452[_0x4b19('0x2b')]['replace'](_0x4b19('0x2d'),'');}_0x31eabc[_0x3ffe55[_0x273986][_0x4b19('0x26')]]=_0x5a7452[_0x4b19('0x2b')];break;default:_0x31eabc[_0x3ffe55[_0x273986][_0x4b19('0x26')]]=_0x52bbb2[_0x3ffe55[_0x273986][_0x4b19('0x26')]];}}return _0x31eabc['join'](',');}function _0x1d1b86(_0x5a9a48,_0x45d91c,_0x78a534){return new Promise(function(_0x351035,_0x54f535){var _0x1c3b80=[];if(_[_0x4b19('0x2e')](_0x45d91c))return _0x351035(_0x1c3b80);_0x10bd69[_0x4b19('0x2f')][_0x4b19('0x30')]({'attributes':['id','interval','IntervalId'],'raw':!![]})['then'](function(_0x14902d){for(var _0xc6fc22=0x0,_0x3084bc=0x0;_0xc6fc22<_0x45d91c['length'];_0xc6fc22++,_0x3084bc=0x0){var _0x45fed4=_0x45d91c[_0xc6fc22];var _0x4d8aa8=[];var _0x4db0aa=[];delete _0x45fed4['id'];if(_0x45fed4[_0x4b19('0x31')]!==_0x4b19('0x32')){_0x45fed4[_0x4b19('0x33')]=[_0x45fed4[_0x4b19('0x31')]];}else{_0x45fed4[_0x4b19('0x33')]=_0x45fed4['IntervalId']?_[_0x4b19('0x34')](_[_0x4b19('0x35')](_0x14902d,{'IntervalId':_0x45fed4[_0x4b19('0x36')]}),_0x4b19('0x31')):[];}_0x45fed4[_0x4b19('0x8')]=_0x5a9a48['context'];_0x45fed4['exten']=_0x5a9a48[_0x4b19('0x5')];if(_0x45fed4[_0x4b19('0x4')])_0x45fed4[_0x4b19('0x4')]=_0x45fed4[_0x4b19('0x4')]['toLowerCase']();if(_0x5a9a48['type']===_0x4b19('0xe')){if(_0x45fed4[_0x4b19('0x1a')]('tag')&&_0x45fed4['tag']&&_0x45fed4[_0x4b19('0x37')]!=='--'){_0x4d8aa8[_0x4b19('0xa')]({'type':_0x45fed4[_0x4b19('0x4')][_0x4b19('0x38')](),'app':_0x4b19('0x3'),'appdata':'CDR(tag)='+_0x45fed4[_0x4b19('0x37')],'context':_0x5a9a48[_0x4b19('0x8')],'exten':_0x5a9a48['exten'],'priority':_0x45fed4[_0x4b19('0x33')][_0x4b19('0x24')]+_0x78a534+_0x3084bc++,'VoiceExtensionId':_0x5a9a48['id']});}_0x4d8aa8['push']({'type':_0x45fed4[_0x4b19('0x4')][_0x4b19('0x38')](),'app':_0x4b19('0x39'),'appdata':_0x4b19('0x3a')+(_0x45fed4[_0x4b19('0x3b')]?_0x4b19('0x3c')+_0x45fed4[_0x4b19('0x3b')]+')':_0x4b19('0x3d')),'context':_0x5a9a48[_0x4b19('0x8')],'exten':_0x5a9a48[_0x4b19('0x5')],'priority':_0x45fed4[_0x4b19('0x33')][_0x4b19('0x24')]+_0x78a534+_0x3084bc++,'VoiceExtensionId':_0x5a9a48['id']});}else{if(_0x45fed4['hasOwnProperty'](_0x4b19('0x3e'))){if([_0x4b19('0x3f'),_0x4b19('0x40')][_0x4b19('0x41')](_0x45fed4[_0x4b19('0x42')][_0x4b19('0x38')]())&&_0x45fed4['appType']!==_0x4b19('0x43')){if(_0x45fed4['answer']){_0x4d8aa8[_0x4b19('0xa')]({'type':_0x45fed4[_0x4b19('0x4')][_0x4b19('0x38')](),'app':'ExecIf','appdata':_0x4b19('0x44'),'context':_0x5a9a48[_0x4b19('0x8')],'exten':_0x5a9a48[_0x4b19('0x5')],'priority':_0x45fed4['intervals']['length']+_0x78a534+_0x3084bc++,'VoiceExtensionId':_0x5a9a48['id']});_0x4d8aa8[_0x4b19('0xa')]({'type':_0x45fed4[_0x4b19('0x4')][_0x4b19('0x38')](),'app':_0x4b19('0x3'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x5a9a48[_0x4b19('0x8')],'exten':_0x5a9a48[_0x4b19('0x5')],'priority':_0x45fed4['intervals'][_0x4b19('0x24')]+_0x78a534+_0x3084bc++,'VoiceExtensionId':_0x5a9a48['id']});}else{_0x4d8aa8['push']({'type':_0x45fed4[_0x4b19('0x4')][_0x4b19('0x38')](),'app':_0x4b19('0x39'),'appdata':_0x4b19('0x45'),'context':_0x5a9a48['context'],'exten':_0x5a9a48[_0x4b19('0x5')],'priority':_0x45fed4[_0x4b19('0x33')][_0x4b19('0x24')]+_0x78a534+_0x3084bc++,'VoiceExtensionId':_0x5a9a48['id']});_0x4d8aa8[_0x4b19('0xa')]({'type':_0x45fed4[_0x4b19('0x4')]['toLowerCase'](),'app':_0x4b19('0x3'),'appdata':_0x4b19('0x46'),'context':_0x5a9a48[_0x4b19('0x8')],'exten':_0x5a9a48[_0x4b19('0x5')],'priority':_0x45fed4[_0x4b19('0x33')][_0x4b19('0x24')]+_0x78a534+_0x3084bc++,'VoiceExtensionId':_0x5a9a48['id']});}}}}for(var _0x5e20e6=0x0;_0x5e20e6<_0x45fed4[_0x4b19('0x33')][_0x4b19('0x24')];_0x5e20e6++){var _0xb936b8=_0x78a534+_0x45fed4['intervals']['length'];var _0x507490=_0x5e20e6===_0x45fed4['intervals']['length']-0x1?_0x78a534+_0x4d8aa8[_0x4b19('0x24')]+_0x4db0aa[_0x4b19('0x24')]+0x2:_0x78a534+_0x5e20e6+0x1;_0x4d8aa8['splice'](_0x5e20e6,0x0,{'type':_0x5a9a48['type'],'app':'GotoIfTime','appdata':_0x45fed4[_0x4b19('0x33')][_0x5e20e6]+'?'+_0x5a9a48[_0x4b19('0x8')]+_0x4b19('0x47')+_0xb936b8+':'+_0x5a9a48['context']+_0x4b19('0x47')+_0x507490,'exten':_0x5a9a48[_0x4b19('0x5')],'context':_0x5a9a48[_0x4b19('0x8')],'priority':_0x78a534+_0x5e20e6,'VoiceExtensionId':_0x5a9a48['id']});}if(_0x45fed4[_0x4b19('0x48')]===_0x4b19('0x49'))_0x45fed4['appdata']=_0x22d5e7(_0x5a9a48,_0x45fed4['appdata']);_0x45fed4[_0x4b19('0x4a')]=_0x4d8aa8[_0x4b19('0x24')]?_[_0x4b19('0x4b')](_0x4d8aa8)['priority']+0x1:_0x78a534;_0x1c3b80=_[_0x4b19('0x4c')](_0x1c3b80,_0x4d8aa8,[_0x45fed4],_0x4db0aa);_0x78a534=_['last'](_0x1c3b80)[_0x4b19('0x4a')]+0x1;}return _0x351035(_0x1c3b80);})[_0x4b19('0x4d')](function(_0x261834){_0x54f535(_0x261834);});});}return _0x2bea30[_0x4b19('0x4e')](_0x4b19('0x4f'),attributes,{'tableName':_0x4b19('0x50'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5b6503){var _0x2481fe=this['get']({'plain':!![]});var _0x240359=_0x2481fe[_0x4b19('0x4')]===_0x4b19('0xe')?_0x5d8335(_0x2481fe):_0x3ba6e4(_0x2481fe);return _0x1d1b86(_0x2481fe,_0x5b6503,_['last'](_0x240359)[_0x4b19('0x4a')]+0x1)['then'](function(_0xcdb048){var _0x8f3f10=_[_0x4b19('0x4c')](_0x240359,_0xcdb048);_0x8f3f10[_0x4b19('0xa')]({'type':_0x2481fe[_0x4b19('0x4')],'app':_0x4b19('0x51'),'exten':_0x2481fe['exten'],'context':_0x2481fe[_0x4b19('0x8')],'priority':_[_0x4b19('0x4b')](_0x8f3f10)['priority']+0x1,'VoiceExtensionId':_0x2481fe['id']});return _0x8f3f10;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 97677be..50793d2 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 _0xcddb=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetVoiceExtension','VoiceExtension','options','raw','where','attributes','include','map','model','lodash','util','moment'];(function(_0x152121,_0x120c53){var _0x592a85=function(_0x241cab){while(--_0x241cab){_0x152121['push'](_0x152121['shift']());}};_0x592a85(++_0x120c53);}(_0xcddb,0x1c4));var _0xbcdd=function(_0xb94022,_0xd47629){_0xb94022=_0xb94022-0x0;var _0x155851=_0xcddb[_0xb94022];return _0x155851;};'use strict';var _=require(_0xbcdd('0x0'));var util=require(_0xbcdd('0x1'));var moment=require(_0xbcdd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbcdd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbcdd('0x4'));var logger=require(_0xbcdd('0x5'))(_0xbcdd('0x6'));var config=require(_0xbcdd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbcdd('0x8')]['http']({'port':0x232a});config[_0xbcdd('0x9')]=_[_0xbcdd('0xa')](config['redis'],{'host':_0xbcdd('0xb'),'port':0x18eb});var socket=require(_0xbcdd('0xc'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0xbcdd('0xd')](socket);function respondWithRpcPromise(_0x276423,_0xc35a10,_0x4d3060){return new BPromise(function(_0xbe49f,_0x434c14){return client[_0xbcdd('0xe')](_0x276423,_0x4d3060)[_0xbcdd('0xf')](function(_0x50a271){logger[_0xbcdd('0x10')](_0xbcdd('0x11'),_0xc35a10,'request\x20sent');logger[_0xbcdd('0x12')](_0xbcdd('0x13'),_0xc35a10,'request\x20sent',JSON[_0xbcdd('0x14')](_0x50a271));if(_0x50a271[_0xbcdd('0x15')]){if(_0x50a271['error']['code']===0x1f4){logger[_0xbcdd('0x15')](_0xbcdd('0x11'),_0xc35a10,_0x50a271[_0xbcdd('0x15')][_0xbcdd('0x16')]);return _0x434c14(_0x50a271[_0xbcdd('0x15')]['message']);}logger[_0xbcdd('0x15')](_0xbcdd('0x11'),_0xc35a10,_0x50a271['error'][_0xbcdd('0x16')]);return _0xbe49f(_0x50a271['error'][_0xbcdd('0x16')]);}else{logger[_0xbcdd('0x10')](_0xbcdd('0x11'),_0xc35a10,_0xbcdd('0x17'));_0xbe49f(_0x50a271[_0xbcdd('0x18')][_0xbcdd('0x16')]);}})[_0xbcdd('0x19')](function(_0x33f1fb){logger[_0xbcdd('0x15')]('VoiceExtension,\x20%s,\x20%s',_0xc35a10,_0x33f1fb);_0x434c14(_0x33f1fb);});});}exports[_0xbcdd('0x1a')]=function(_0x3396bb){var _0x1d165b=this;return new Promise(function(_0x1477f1,_0x45ae83){return db[_0xbcdd('0x1b')]['findAll']({'raw':_0x3396bb[_0xbcdd('0x1c')]?_0x3396bb['options'][_0xbcdd('0x1d')]===undefined?!![]:![]:!![],'where':_0x3396bb[_0xbcdd('0x1c')]?_0x3396bb[_0xbcdd('0x1c')][_0xbcdd('0x1e')]||null:null,'attributes':_0x3396bb['options']?_0x3396bb[_0xbcdd('0x1c')][_0xbcdd('0x1f')]||null:null,'limit':_0x3396bb[_0xbcdd('0x1c')]?_0x3396bb[_0xbcdd('0x1c')]['limit']||null:null,'include':_0x3396bb[_0xbcdd('0x1c')]?_0x3396bb[_0xbcdd('0x1c')][_0xbcdd('0x20')]?_[_0xbcdd('0x21')](_0x3396bb[_0xbcdd('0x1c')]['include'],function(_0x1f334d){return{'model':db[_0x1f334d[_0xbcdd('0x22')]],'as':_0x1f334d['as'],'attributes':_0x1f334d[_0xbcdd('0x1f')],'include':_0x1f334d[_0xbcdd('0x20')]?_[_0xbcdd('0x21')](_0x1f334d['include'],function(_0x340fc0){return{'model':db[_0x340fc0[_0xbcdd('0x22')]],'as':_0x340fc0['as'],'attributes':_0x340fc0['attributes'],'include':_0x340fc0[_0xbcdd('0x20')]?_[_0xbcdd('0x21')](_0x340fc0[_0xbcdd('0x20')],function(_0x18b13b){return{'model':db[_0x18b13b[_0xbcdd('0x22')]],'as':_0x18b13b['as'],'attributes':_0x18b13b['attributes']};}):[]};}):[]};}):[]:[]})[_0xbcdd('0xf')](function(_0x485696){logger['info'](_0xbcdd('0x1a'),_0x3396bb);logger[_0xbcdd('0x12')]('GetVoiceExtension',_0x3396bb,JSON[_0xbcdd('0x14')](_0x485696));_0x1477f1(_0x485696);})[_0xbcdd('0x19')](function(_0x3cdcb3){logger[_0xbcdd('0x15')](_0xbcdd('0x1a'),_0x3cdcb3[_0xbcdd('0x16')],_0x3396bb);_0x45ae83(_0x1d165b[_0xbcdd('0x15')](0x1f4,_0x3cdcb3[_0xbcdd('0x16')]));});});}; \ No newline at end of file +var _0x432b=['VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','info','request\x20sent','debug'];(function(_0x1e939e,_0x60edf8){var _0x21dcb8=function(_0x280c39){while(--_0x280c39){_0x1e939e['push'](_0x1e939e['shift']());}};_0x21dcb8(++_0x60edf8);}(_0x432b,0x161));var _0xb432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x432b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb432('0x0'));var util=require('util');var moment=require(_0xb432('0x1'));var BPromise=require(_0xb432('0x2'));var rs=require(_0xb432('0x3'));var fs=require('fs');var Redis=require(_0xb432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb432('0x5'))('rpc');var config=require(_0xb432('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb432('0x7')][_0xb432('0x8')]({'port':0x232a});config[_0xb432('0x9')]=_[_0xb432('0xa')](config[_0xb432('0x9')],{'host':_0xb432('0xb'),'port':0x18eb});var socket=require(_0xb432('0xc'))(new Redis(config[_0xb432('0x9')]));require('./voiceExtension.socket')[_0xb432('0xd')](socket);function respondWithRpcPromise(_0xca5a23,_0x2bc6e5,_0x4288c3){return new BPromise(function(_0x28fdde,_0x2b2afb){return client['request'](_0xca5a23,_0x4288c3)['then'](function(_0x3c1a43){logger[_0xb432('0xe')]('VoiceExtension,\x20%s,\x20%s',_0x2bc6e5,_0xb432('0xf'));logger[_0xb432('0x10')](_0xb432('0x11'),_0x2bc6e5,'request\x20sent',JSON[_0xb432('0x12')](_0x3c1a43));if(_0x3c1a43[_0xb432('0x13')]){if(_0x3c1a43['error'][_0xb432('0x14')]===0x1f4){logger[_0xb432('0x13')](_0xb432('0x15'),_0x2bc6e5,_0x3c1a43[_0xb432('0x13')][_0xb432('0x16')]);return _0x2b2afb(_0x3c1a43['error']['message']);}logger[_0xb432('0x13')](_0xb432('0x15'),_0x2bc6e5,_0x3c1a43[_0xb432('0x13')][_0xb432('0x16')]);return _0x28fdde(_0x3c1a43[_0xb432('0x13')][_0xb432('0x16')]);}else{logger[_0xb432('0xe')](_0xb432('0x15'),_0x2bc6e5,_0xb432('0xf'));_0x28fdde(_0x3c1a43[_0xb432('0x17')]['message']);}})['catch'](function(_0x26c96e){logger[_0xb432('0x13')](_0xb432('0x15'),_0x2bc6e5,_0x26c96e);_0x2b2afb(_0x26c96e);});});}exports[_0xb432('0x18')]=function(_0x4f22ae){var _0x34febc=this;return new Promise(function(_0x2bcded,_0x284b5a){return db[_0xb432('0x19')][_0xb432('0x1a')]({'raw':_0x4f22ae[_0xb432('0x1b')]?_0x4f22ae[_0xb432('0x1b')][_0xb432('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f22ae['options']?_0x4f22ae[_0xb432('0x1b')][_0xb432('0x1d')]||null:null,'attributes':_0x4f22ae['options']?_0x4f22ae[_0xb432('0x1b')][_0xb432('0x1e')]||null:null,'limit':_0x4f22ae[_0xb432('0x1b')]?_0x4f22ae[_0xb432('0x1b')][_0xb432('0x1f')]||null:null,'include':_0x4f22ae[_0xb432('0x1b')]?_0x4f22ae[_0xb432('0x1b')][_0xb432('0x20')]?_[_0xb432('0x21')](_0x4f22ae[_0xb432('0x1b')]['include'],function(_0x19d249){return{'model':db[_0x19d249[_0xb432('0x22')]],'as':_0x19d249['as'],'attributes':_0x19d249[_0xb432('0x1e')],'include':_0x19d249[_0xb432('0x20')]?_[_0xb432('0x21')](_0x19d249[_0xb432('0x20')],function(_0x5ce616){return{'model':db[_0x5ce616[_0xb432('0x22')]],'as':_0x5ce616['as'],'attributes':_0x5ce616[_0xb432('0x1e')],'include':_0x5ce616[_0xb432('0x20')]?_[_0xb432('0x21')](_0x5ce616[_0xb432('0x20')],function(_0x3a155e){return{'model':db[_0x3a155e[_0xb432('0x22')]],'as':_0x3a155e['as'],'attributes':_0x3a155e[_0xb432('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb432('0x23')](function(_0x5257a3){logger[_0xb432('0xe')](_0xb432('0x18'),_0x4f22ae);logger[_0xb432('0x10')](_0xb432('0x18'),_0x4f22ae,JSON[_0xb432('0x12')](_0x5257a3));_0x2bcded(_0x5257a3);})[_0xb432('0x24')](function(_0xdead73){logger[_0xb432('0x13')](_0xb432('0x18'),_0xdead73[_0xb432('0x16')],_0x4f22ae);_0x284b5a(_0x34febc[_0xb432('0x13')](0x1f4,_0xdead73[_0xb432('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 688f943..0fb71ca 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 _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x4fe4c6,_0x39aee2){var _0x165ea7=function(_0x33b4bc){while(--_0x33b4bc){_0x4fe4c6['push'](_0x4fe4c6['shift']());}};_0x165ea7(++_0x39aee2);}(_0x326f,0xd1));var _0xf326=function(_0x5db84d,_0x286856){_0x5db84d=_0x5db84d-0x0;var _0x4cf888=_0x326f[_0x5db84d];return _0x4cf888;};'use strict';var VoiceExtensionEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){VoiceExtensionEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('voiceExtension:'+_0x165f95,_0x3ace29);VoiceExtensionEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file +var _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0x21ce16,_0x1a6dbb){var _0x4c61ef=function(_0x42d956){while(--_0x42d956){_0x21ce16['push'](_0x21ce16['shift']());}};_0x4c61ef(++_0x1a6dbb);}(_0x4975,0x86));var _0x5497=function(_0x2bab01,_0x11999a){_0x2bab01=_0x2bab01-0x0;var _0xd836d9=_0x4975[_0x2bab01];return _0xd836d9;};'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 088f9fa..df725d1 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 _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMail.controller','isAuthenticated','get','/:id','show','/:id/messages','getMessages','post','create','put'];(function(_0x4d8fd4,_0x5addc9){var _0x1ba633=function(_0x19f919){while(--_0x19f919){_0x4d8fd4['push'](_0x4d8fd4['shift']());}};_0x1ba633(++_0x5addc9);}(_0x53ec,0x192));var _0xc53e=function(_0x3d1244,_0x156028){_0x3d1244=_0x3d1244-0x0;var _0x5d6372=_0x53ec[_0x3d1244];return _0x5d6372;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file +var _0x82c4=['express','Router','fs-extra','../../components/interaction/service','./voiceMail.controller','isAuthenticated','get','/:id','show','getMessages','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x82c4,0x1ca));var _0x482c=function(_0x4afdbe,_0x478132){_0x4afdbe=_0x4afdbe-0x0;var _0x434c4a=_0x82c4[_0x4afdbe];return _0x434c4a;};'use strict';var multer=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var path=require(_0x482c('0x2'));var timeout=require(_0x482c('0x3'));var express=require(_0x482c('0x4'));var router=express[_0x482c('0x5')]();var fs_extra=require(_0x482c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x482c('0x7'));var config=require('../../config/environment');var controller=require(_0x482c('0x8'));router['get']('/',auth[_0x482c('0x9')](),controller['index']);router[_0x482c('0xa')](_0x482c('0xb'),auth[_0x482c('0x9')](),controller[_0x482c('0xc')]);router[_0x482c('0xa')]('/:id/messages',auth[_0x482c('0x9')](),controller[_0x482c('0xd')]);router[_0x482c('0xe')]('/',auth[_0x482c('0x9')](),controller[_0x482c('0xf')]);router[_0x482c('0x10')]('/:id',auth[_0x482c('0x9')](),controller[_0x482c('0x11')]);router[_0x482c('0x12')]('/:id',auth[_0x482c('0x9')](),controller[_0x482c('0x13')]);module[_0x482c('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 2ad3ab8..ffc1cec 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 _0x2b75=['fullname','mailbox','exports','from-voicemail','contest_mailbox','STRING','setDataValue','email','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER'];(function(_0xa73433,_0x36b6f8){var _0x4279be=function(_0x159358){while(--_0x159358){_0xa73433['push'](_0xa73433['shift']());}};_0x4279be(++_0x36b6f8);}(_0x2b75,0xb6));var _0x52b7=function(_0x5dd799,_0x591d52){_0x5dd799=_0x5dd799-0x0;var _0x3a7037=_0x2b75[_0x5dd799];return _0x3a7037;};'use strict';var Sequelize=require('sequelize');module[_0x52b7('0x0')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0x52b7('0x1'),'unique':_0x52b7('0x2')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x52b7('0x2')},'password':{'type':Sequelize[_0x52b7('0x3')]},'fullname':{'type':Sequelize[_0x52b7('0x3')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x2e7160){this[_0x52b7('0x4')](_0x52b7('0x5'),typeof _0x2e7160==='string'&&_0x2e7160[_0x52b7('0x6')]()?_0x2e7160['trim']():null);}},'pager':{'type':Sequelize[_0x52b7('0x3')]},'tz':{'type':Sequelize[_0x52b7('0x3')],'defaultValue':_0x52b7('0x7')},'attach':{'type':Sequelize[_0x52b7('0x8')](_0x52b7('0x9'),'no'),'defaultValue':_0x52b7('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x52b7('0x9'),'no'),'defaultValue':_0x52b7('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x52b7('0x3')]},'callback':{'type':Sequelize[_0x52b7('0x3')]},'review':{'type':Sequelize[_0x52b7('0x8')](_0x52b7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x52b7('0x8')](_0x52b7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x52b7('0x8')](_0x52b7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x52b7('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x52b7('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x52b7('0x8')](_0x52b7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x52b7('0x8')](_0x52b7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x52b7('0x8')](_0x52b7('0x9'),'no'),'defaultValue':_0x52b7('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x52b7('0x8')](_0x52b7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x52b7('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x52b7('0x8')](_0x52b7('0x9'),'no'),'defaultValue':_0x52b7('0x9'),'allowNull':![]},'stamp':{'type':_0x52b7('0xb')},'emailsubject':{'type':Sequelize[_0x52b7('0x3')]},'emailbody':{'type':Sequelize[_0x52b7('0x3')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x52b7('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x52b7('0xd'))+'\x20-\x20'+this['getDataValue'](_0x52b7('0xe'));}}}; \ No newline at end of file +var _0x21e8=['VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TIMESTAMP','INTEGER'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0x21e8,0xe9));var _0x821e=function(_0x14550f,_0x4dac62){_0x14550f=_0x14550f-0x0;var _0x3da6dc=_0x21e8[_0x14550f];return _0x3da6dc;};'use strict';var Sequelize=require(_0x821e('0x0'));module[_0x821e('0x1')]={'customer_id':{'type':Sequelize[_0x821e('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x821e('0x3'),'unique':_0x821e('0x4')},'mailbox':{'type':Sequelize[_0x821e('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x821e('0x2')]},'email':{'type':Sequelize[_0x821e('0x2')],'validate':{'isEmail':!![]},'set':function(_0x17400d){this[_0x821e('0x5')](_0x821e('0x6'),typeof _0x17400d===_0x821e('0x7')&&_0x17400d['trim']()?_0x17400d[_0x821e('0x8')]():null);}},'pager':{'type':Sequelize[_0x821e('0x2')]},'tz':{'type':Sequelize[_0x821e('0x2')],'defaultValue':_0x821e('0x9')},'attach':{'type':Sequelize[_0x821e('0xa')]('yes','no'),'defaultValue':_0x821e('0xb'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x821e('0xb'),'no'),'defaultValue':_0x821e('0xb'),'allowNull':![]},'dialout':{'type':Sequelize[_0x821e('0x2')]},'callback':{'type':Sequelize[_0x821e('0x2')]},'review':{'type':Sequelize['ENUM'](_0x821e('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x821e('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x821e('0xa')](_0x821e('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x821e('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x821e('0xa')](_0x821e('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x821e('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x821e('0xa')](_0x821e('0xb'),'no'),'defaultValue':_0x821e('0xb'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x821e('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x821e('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x821e('0xa')](_0x821e('0xb'),'no'),'defaultValue':_0x821e('0xb'),'allowNull':![]},'stamp':{'type':_0x821e('0xc')},'emailsubject':{'type':Sequelize[_0x821e('0x2')]},'emailbody':{'type':Sequelize[_0x821e('0x2')]},'maxsecs':{'type':Sequelize[_0x821e('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x821e('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x821e('0xe')],'get':function(){return this[_0x821e('0xf')](_0x821e('0x10'))+_0x821e('0x11')+this[_0x821e('0xf')](_0x821e('0x12'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 3ad15f1..024b00c 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 _0x1339=['../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','limit','offset','Content-Range','then','destroy','get','Voicemails','UserProfileResource','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VoiceMail','count','includeAll','include','findAll','catch','show','params','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','VoiceMailMessage','pick','findAndCountAll','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1339,0x1ed));var _0x9133=function(_0x26d968,_0x473e25){_0x26d968=_0x26d968-0x0;var _0x318cf4=_0x1339[_0x26d968];return _0x318cf4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9133('0x0'));var jsonpatch=require(_0x9133('0x1'));var rp=require(_0x9133('0x2'));var moment=require(_0x9133('0x3'));var BPromise=require(_0x9133('0x4'));var Mustache=require(_0x9133('0x5'));var util=require(_0x9133('0x6'));var path=require(_0x9133('0x7'));var sox=require('sox');var csv=require(_0x9133('0x8'));var ejs=require(_0x9133('0x9'));var fs=require('fs');var fs_extra=require(_0x9133('0xa'));var _=require('lodash');var squel=require(_0x9133('0xb'));var crypto=require(_0x9133('0xc'));var jsforce=require(_0x9133('0xd'));var deskjs=require(_0x9133('0xe'));var toCsv=require(_0x9133('0x8'));var querystring=require(_0x9133('0xf'));var Papa=require(_0x9133('0x10'));var Redis=require(_0x9133('0x11'));var authService=require(_0x9133('0x12'));var qs=require(_0x9133('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9133('0x14'));var logger=require(_0x9133('0x15'))(_0x9133('0x16'));var utils=require(_0x9133('0x17'));var config=require(_0x9133('0x18'));var licenseUtil=require(_0x9133('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb64550,_0x7cc59e){_0x7cc59e=_0x7cc59e||0xcc;return function(_0x4bbfdc){if(_0x4bbfdc){return _0xb64550['sendStatus'](_0x7cc59e);}return _0xb64550[_0x9133('0x1a')](_0x7cc59e)['end']();};}function respondWithResult(_0x22132a,_0x439e1a){_0x439e1a=_0x439e1a||0xc8;return function(_0x17dfd1){if(_0x17dfd1){return _0x22132a[_0x9133('0x1a')](_0x439e1a)[_0x9133('0x1b')](_0x17dfd1);}};}function respondWithFilteredResult(_0x4327b3,_0x49cc5d){return function(_0x13f8fc){if(_0x13f8fc){var _0x1e23ce=typeof _0x49cc5d['offset']===_0x9133('0x1c')&&typeof _0x49cc5d[_0x9133('0x1d')]===_0x9133('0x1c');var _0x427663=_0x13f8fc['count'];var _0x1f3484=_0x1e23ce?0x0:_0x49cc5d['offset'];var _0x3c48ef=_0x1e23ce?_0x13f8fc['count']:_0x49cc5d[_0x9133('0x1e')]+_0x49cc5d[_0x9133('0x1d')];var _0x5e8620;if(_0x3c48ef>=_0x427663){_0x3c48ef=_0x427663;_0x5e8620=0xc8;}else{_0x5e8620=0xce;}_0x4327b3[_0x9133('0x1a')](_0x5e8620);return _0x4327b3['set'](_0x9133('0x1f'),_0x1f3484+'-'+_0x3c48ef+'/'+_0x427663)['json'](_0x13f8fc);}return null;};}function patchUpdates(_0x5e4f0c){return function(_0x2f7354){try{jsonpatch['apply'](_0x2f7354,_0x5e4f0c,!![]);}catch(_0x12c2d4){return BPromise['reject'](_0x12c2d4);}return _0x2f7354['save']();};}function saveUpdates(_0x4c846e,_0x2e99a1){return function(_0x2dcfb8){if(_0x2dcfb8){return _0x2dcfb8['update'](_0x4c846e)[_0x9133('0x20')](function(_0x3f5d0e){return _0x3f5d0e;});}return null;};}function removeEntity(_0xff08d5,_0x26190c){return function(_0x4f26e8){if(_0x4f26e8){return _0x4f26e8[_0x9133('0x21')]()['then'](function(){var _0x187e32=_0x4f26e8[_0x9133('0x22')]({'plain':!![]});var _0x3f278d=_0x9133('0x23');return db[_0x9133('0x24')][_0x9133('0x21')]({'where':{'type':_0x3f278d,'resourceId':_0x187e32['id']}})[_0x9133('0x20')](function(){return _0x4f26e8;});})[_0x9133('0x20')](function(){_0xff08d5[_0x9133('0x1a')](0xcc)[_0x9133('0x25')]();});}};}function handleEntityNotFound(_0x51de62,_0x517e7b){return function(_0x477bf1){if(!_0x477bf1){_0x51de62[_0x9133('0x26')](0x194);}return _0x477bf1;};}function handleError(_0x428e18,_0x348486){_0x348486=_0x348486||0x1f4;return function(_0x4de894){logger['error'](_0x4de894[_0x9133('0x27')]);if(_0x4de894[_0x9133('0x28')]){delete _0x4de894[_0x9133('0x28')];}_0x428e18[_0x9133('0x1a')](_0x348486)[_0x9133('0x29')](_0x4de894);};}exports[_0x9133('0x2a')]=function(_0x48c713,_0x58afe0){var _0x5a27c1={},_0x1ad222={},_0x4a4a8e={'count':0x0,'rows':[]};var _0x43b5f3=_[_0x9133('0x2b')](db['VoiceMail'][_0x9133('0x2c')],function(_0x5dd90b){return{'name':_0x5dd90b[_0x9133('0x2d')],'type':_0x5dd90b[_0x9133('0x2e')][_0x9133('0x2f')]};});_0x1ad222['model']=_[_0x9133('0x2b')](_0x43b5f3,_0x9133('0x28'));_0x1ad222[_0x9133('0x30')]=_['keys'](_0x48c713[_0x9133('0x30')]);_0x1ad222[_0x9133('0x31')]=_[_0x9133('0x32')](_0x1ad222['model'],_0x1ad222[_0x9133('0x30')]);_0x5a27c1[_0x9133('0x33')]=_[_0x9133('0x32')](_0x1ad222[_0x9133('0x34')],qs['fields'](_0x48c713[_0x9133('0x30')][_0x9133('0x35')]));_0x5a27c1['attributes']=_0x5a27c1[_0x9133('0x33')][_0x9133('0x36')]?_0x5a27c1[_0x9133('0x33')]:_0x1ad222[_0x9133('0x34')];if(!_0x48c713[_0x9133('0x30')][_0x9133('0x37')](_0x9133('0x38'))){_0x5a27c1[_0x9133('0x1d')]=qs[_0x9133('0x1d')](_0x48c713[_0x9133('0x30')][_0x9133('0x1d')]);_0x5a27c1['offset']=qs[_0x9133('0x1e')](_0x48c713[_0x9133('0x30')]['offset']);}_0x5a27c1[_0x9133('0x39')]=qs[_0x9133('0x3a')](_0x48c713[_0x9133('0x30')][_0x9133('0x3a')]);_0x5a27c1[_0x9133('0x3b')]=qs[_0x9133('0x31')](_['pick'](_0x48c713['query'],_0x1ad222[_0x9133('0x31')]),_0x43b5f3);if(_0x48c713[_0x9133('0x30')][_0x9133('0x3c')]){_0x5a27c1[_0x9133('0x3b')]=_[_0x9133('0x3d')](_0x5a27c1[_0x9133('0x3b')],{'$or':_[_0x9133('0x2b')](_0x43b5f3,function(_0x2ee83e){if(_0x2ee83e[_0x9133('0x2e')]!=='VIRTUAL'){var _0xafd8f9={};_0xafd8f9[_0x2ee83e[_0x9133('0x28')]]={'$like':'%'+_0x48c713[_0x9133('0x30')][_0x9133('0x3c')]+'%'};return _0xafd8f9;}})});}_0x5a27c1=_[_0x9133('0x3d')]({},_0x5a27c1,_0x48c713['options']);var _0x3c691e={'where':_0x5a27c1[_0x9133('0x3b')]};return db[_0x9133('0x3e')][_0x9133('0x3f')](_0x3c691e)['then'](function(_0x146734){_0x4a4a8e[_0x9133('0x3f')]=_0x146734;if(_0x48c713[_0x9133('0x30')][_0x9133('0x40')]){_0x5a27c1[_0x9133('0x41')]=[{'all':!![]}];}return db[_0x9133('0x3e')][_0x9133('0x42')](_0x5a27c1);})['then'](function(_0x7f6cd9){_0x4a4a8e['rows']=_0x7f6cd9;return _0x4a4a8e;})['then'](respondWithFilteredResult(_0x58afe0,_0x5a27c1))[_0x9133('0x43')](handleError(_0x58afe0,null));};exports[_0x9133('0x44')]=function(_0x46156d,_0x264df4){var _0xdd485f={'raw':!![],'where':{'id':_0x46156d[_0x9133('0x45')]['id']}},_0x2d2bf7={};_0x2d2bf7[_0x9133('0x34')]=_[_0x9133('0x46')](db['VoiceMail'][_0x9133('0x2c')]);_0x2d2bf7[_0x9133('0x30')]=_[_0x9133('0x46')](_0x46156d['query']);_0x2d2bf7['filters']=_[_0x9133('0x32')](_0x2d2bf7[_0x9133('0x34')],_0x2d2bf7['query']);_0xdd485f[_0x9133('0x33')]=_[_0x9133('0x32')](_0x2d2bf7[_0x9133('0x34')],qs[_0x9133('0x35')](_0x46156d[_0x9133('0x30')]['fields']));_0xdd485f[_0x9133('0x33')]=_0xdd485f[_0x9133('0x33')][_0x9133('0x36')]?_0xdd485f['attributes']:_0x2d2bf7[_0x9133('0x34')];if(_0x46156d[_0x9133('0x30')]['includeAll']){_0xdd485f['include']=[{'all':!![]}];}_0xdd485f=_[_0x9133('0x3d')]({},_0xdd485f,_0x46156d[_0x9133('0x47')]);return db[_0x9133('0x3e')][_0x9133('0x48')](_0xdd485f)[_0x9133('0x20')](handleEntityNotFound(_0x264df4,null))[_0x9133('0x20')](respondWithResult(_0x264df4,null))[_0x9133('0x43')](handleError(_0x264df4,null));};exports[_0x9133('0x49')]=function(_0x23f134,_0xf07fbb){return db[_0x9133('0x3e')][_0x9133('0x49')](_0x23f134['body'],{})['then'](function(_0xf2e098){var _0x4dc2f3=_0x23f134[_0x9133('0x4a')][_0x9133('0x22')]({'plain':!![]});if(!_0x4dc2f3)throw new Error(_0x9133('0x4b'));if(_0x4dc2f3[_0x9133('0x4c')]==='user'){var _0x2a3848=_0xf2e098[_0x9133('0x22')]({'plain':!![]});var _0x799772='Voicemails';return db[_0x9133('0x4d')][_0x9133('0x48')]({'where':{'name':_0x799772,'userProfileId':_0x4dc2f3[_0x9133('0x4e')]},'raw':!![]})['then'](function(_0x14c825){if(_0x14c825&&_0x14c825['autoAssociation']===0x0){return db[_0x9133('0x24')][_0x9133('0x49')]({'name':_0x2a3848[_0x9133('0x28')],'resourceId':_0x2a3848['id'],'type':_0x14c825[_0x9133('0x28')],'sectionId':_0x14c825['id']},{})['then'](function(){return _0xf2e098;});}else{return _0xf2e098;}})['catch'](function(_0x2f09f6){logger[_0x9133('0x4f')](_0x9133('0x50'),_0x2f09f6);throw _0x2f09f6;});}return _0xf2e098;})[_0x9133('0x20')](respondWithResult(_0xf07fbb,0xc9))[_0x9133('0x43')](handleError(_0xf07fbb,null));};exports['update']=function(_0x554bb9,_0x33599b){if(_0x554bb9[_0x9133('0x51')]['id']){delete _0x554bb9['body']['id'];}return db[_0x9133('0x3e')][_0x9133('0x48')]({'where':{'id':_0x554bb9['params']['id']}})['then'](handleEntityNotFound(_0x33599b,null))['then'](saveUpdates(_0x554bb9[_0x9133('0x51')],null))['then'](respondWithResult(_0x33599b,null))[_0x9133('0x43')](handleError(_0x33599b,null));};exports[_0x9133('0x21')]=function(_0x439258,_0x3d6daa){return db['VoiceMail'][_0x9133('0x48')]({'where':{'id':_0x439258['params']['id']}})[_0x9133('0x20')](handleEntityNotFound(_0x3d6daa,null))[_0x9133('0x20')](removeEntity(_0x3d6daa,null))[_0x9133('0x43')](handleError(_0x3d6daa,null));};exports[_0x9133('0x52')]=function(_0x3b9927,_0x3534bf,_0x56861c){return db['VoiceMail']['findOne']({'where':{'id':_0x3b9927[_0x9133('0x45')]['id']}})[_0x9133('0x20')](handleEntityNotFound(_0x3534bf,null))[_0x9133('0x20')](function(_0x54a330){var _0x3f4cd7;var _0x1f6684={},_0x415d55={};_0x415d55[_0x9133('0x34')]=_[_0x9133('0x46')](db[_0x9133('0x53')][_0x9133('0x2c')]);_0x415d55[_0x9133('0x30')]=_['keys'](_0x3b9927[_0x9133('0x30')]);_0x415d55['filters']=_[_0x9133('0x32')](_0x415d55['model'],_0x415d55[_0x9133('0x30')]);_0x1f6684[_0x9133('0x33')]=_['intersection'](_0x415d55['model'],qs[_0x9133('0x35')](_0x3b9927[_0x9133('0x30')][_0x9133('0x35')]));_0x1f6684[_0x9133('0x33')]=_0x1f6684[_0x9133('0x33')][_0x9133('0x36')]?_0x1f6684[_0x9133('0x33')]:_0x415d55[_0x9133('0x34')];if(!_0x3b9927[_0x9133('0x30')][_0x9133('0x37')](_0x9133('0x38'))){_0x1f6684['limit']=qs[_0x9133('0x1d')](_0x3b9927['query'][_0x9133('0x1d')]);_0x1f6684[_0x9133('0x1e')]=qs[_0x9133('0x1e')](_0x3b9927[_0x9133('0x30')][_0x9133('0x1e')]);}_0x1f6684['order']=qs[_0x9133('0x3a')](_0x3b9927[_0x9133('0x30')][_0x9133('0x3a')]);_0x1f6684[_0x9133('0x3b')]=qs['filters'](_[_0x9133('0x54')](_0x3b9927[_0x9133('0x30')],_0x415d55[_0x9133('0x31')]));if(_0x3b9927[_0x9133('0x30')]['filter']){_0x1f6684['where']=_[_0x9133('0x3d')](_0x1f6684[_0x9133('0x3b')],{'$or':_[_0x9133('0x2b')](_0x1f6684[_0x9133('0x33')],function(_0x28cc46){var _0x2cfaf8={};_0x2cfaf8[_0x28cc46]={'$like':'%'+_0x3b9927['query'][_0x9133('0x3c')]+'%'};return _0x2cfaf8;})});}_0x1f6684[_0x9133('0x3b')]=_[_0x9133('0x3d')](_0x1f6684[_0x9133('0x3b')],{'mailboxuser':_0x54a330['mailbox']});_0x1f6684=_[_0x9133('0x3d')]({},_0x1f6684,_0x3b9927['options']);return db[_0x9133('0x53')][_0x9133('0x55')](_0x1f6684)[_0x9133('0x20')](respondWithFilteredResult(_0x3534bf,_0x1f6684));})[_0x9133('0x43')](handleError(_0x3534bf,null));}; \ No newline at end of file +var _0x36ee=['set','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','stack','index','map','VoiceMail','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','mailbox','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','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x28da79,_0x54d56b){var _0x477817=function(_0x3ca4f7){while(--_0x3ca4f7){_0x28da79['push'](_0x28da79['shift']());}};_0x477817(++_0x54d56b);}(_0x36ee,0xe8));var _0xe36e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x36ee[_0x1facfa];return _0x9ec701;};'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'];function respondWithStatusCode(_0x4fbdb2,_0x32981d){_0x32981d=_0x32981d||0xcc;return function(_0x27841e){if(_0x27841e){return _0x4fbdb2[_0xe36e('0x19')](_0x32981d);}return _0x4fbdb2[_0xe36e('0x1a')](_0x32981d)['end']();};}function respondWithResult(_0x3e264a,_0x521afa){_0x521afa=_0x521afa||0xc8;return function(_0x525155){if(_0x525155){return _0x3e264a[_0xe36e('0x1a')](_0x521afa)[_0xe36e('0x1b')](_0x525155);}};}function respondWithFilteredResult(_0x26fb37,_0x278135){return function(_0xd6828e){if(_0xd6828e){var _0x924cd5=typeof _0x278135[_0xe36e('0x1c')]===_0xe36e('0x1d')&&typeof _0x278135[_0xe36e('0x1e')]===_0xe36e('0x1d');var _0x5792e8=_0xd6828e[_0xe36e('0x1f')];var _0x2184ae=_0x924cd5?0x0:_0x278135['offset'];var _0x21d9a3=_0x924cd5?_0xd6828e['count']:_0x278135[_0xe36e('0x1c')]+_0x278135[_0xe36e('0x1e')];var _0x5e15f5;if(_0x21d9a3>=_0x5792e8){_0x21d9a3=_0x5792e8;_0x5e15f5=0xc8;}else{_0x5e15f5=0xce;}_0x26fb37[_0xe36e('0x1a')](_0x5e15f5);return _0x26fb37[_0xe36e('0x20')](_0xe36e('0x21'),_0x2184ae+'-'+_0x21d9a3+'/'+_0x5792e8)['json'](_0xd6828e);}return null;};}function patchUpdates(_0x21e95e){return function(_0x21bcf9){try{jsonpatch[_0xe36e('0x22')](_0x21bcf9,_0x21e95e,!![]);}catch(_0x3c4017){return BPromise[_0xe36e('0x23')](_0x3c4017);}return _0x21bcf9[_0xe36e('0x24')]();};}function saveUpdates(_0x4f438a,_0xd71137){return function(_0x4f214a){if(_0x4f214a){return _0x4f214a[_0xe36e('0x25')](_0x4f438a)[_0xe36e('0x26')](function(_0x437f3f){return _0x437f3f;});}return null;};}function removeEntity(_0x53e13a,_0x598a7a){return function(_0x4749a8){if(_0x4749a8){return _0x4749a8[_0xe36e('0x27')]()[_0xe36e('0x26')](function(){var _0xb32195=_0x4749a8[_0xe36e('0x28')]({'plain':!![]});var _0x1507f9=_0xe36e('0x29');return db['UserProfileResource'][_0xe36e('0x27')]({'where':{'type':_0x1507f9,'resourceId':_0xb32195['id']}})[_0xe36e('0x26')](function(){return _0x4749a8;});})[_0xe36e('0x26')](function(){_0x53e13a[_0xe36e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d757c,_0x5a3133){return function(_0xf7b02e){if(!_0xf7b02e){_0x2d757c['sendStatus'](0x194);}return _0xf7b02e;};}function handleError(_0x19f001,_0x5884cb){_0x5884cb=_0x5884cb||0x1f4;return function(_0x410504){logger['error'](_0x410504[_0xe36e('0x2a')]);if(_0x410504['name']){delete _0x410504['name'];}_0x19f001['status'](_0x5884cb)['send'](_0x410504);};}exports[_0xe36e('0x2b')]=function(_0x1fc639,_0x4cf185){var _0x4ac819={},_0x1fa1ec={},_0xb8d44e={'count':0x0,'rows':[]};var _0x259e19=_[_0xe36e('0x2c')](db[_0xe36e('0x2d')][_0xe36e('0x2e')],function(_0x57bb9b){return{'name':_0x57bb9b[_0xe36e('0x2f')],'type':_0x57bb9b[_0xe36e('0x30')]['key']};});_0x1fa1ec[_0xe36e('0x31')]=_[_0xe36e('0x2c')](_0x259e19,_0xe36e('0x32'));_0x1fa1ec[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x1fc639[_0xe36e('0x33')]);_0x1fa1ec[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x1fa1ec[_0xe36e('0x31')],_0x1fa1ec[_0xe36e('0x33')]);_0x4ac819[_0xe36e('0x37')]=_['intersection'](_0x1fa1ec[_0xe36e('0x31')],qs['fields'](_0x1fc639['query'][_0xe36e('0x38')]));_0x4ac819['attributes']=_0x4ac819[_0xe36e('0x37')][_0xe36e('0x39')]?_0x4ac819[_0xe36e('0x37')]:_0x1fa1ec[_0xe36e('0x31')];if(!_0x1fc639['query']['hasOwnProperty'](_0xe36e('0x3a'))){_0x4ac819[_0xe36e('0x1e')]=qs[_0xe36e('0x1e')](_0x1fc639[_0xe36e('0x33')]['limit']);_0x4ac819[_0xe36e('0x1c')]=qs[_0xe36e('0x1c')](_0x1fc639[_0xe36e('0x33')]['offset']);}_0x4ac819[_0xe36e('0x3b')]=qs[_0xe36e('0x3c')](_0x1fc639['query'][_0xe36e('0x3c')]);_0x4ac819[_0xe36e('0x3d')]=qs[_0xe36e('0x35')](_[_0xe36e('0x3e')](_0x1fc639[_0xe36e('0x33')],_0x1fa1ec[_0xe36e('0x35')]),_0x259e19);if(_0x1fc639[_0xe36e('0x33')][_0xe36e('0x3f')]){_0x4ac819[_0xe36e('0x3d')]=_[_0xe36e('0x40')](_0x4ac819[_0xe36e('0x3d')],{'$or':_[_0xe36e('0x2c')](_0x259e19,function(_0x3c4703){if(_0x3c4703['type']!==_0xe36e('0x41')){var _0x134fb2={};_0x134fb2[_0x3c4703[_0xe36e('0x32')]]={'$like':'%'+_0x1fc639[_0xe36e('0x33')][_0xe36e('0x3f')]+'%'};return _0x134fb2;}})});}_0x4ac819=_['merge']({},_0x4ac819,_0x1fc639['options']);var _0x4094c6={'where':_0x4ac819[_0xe36e('0x3d')]};return db[_0xe36e('0x2d')][_0xe36e('0x1f')](_0x4094c6)[_0xe36e('0x26')](function(_0x34a1ba){_0xb8d44e[_0xe36e('0x1f')]=_0x34a1ba;if(_0x1fc639[_0xe36e('0x33')]['includeAll']){_0x4ac819[_0xe36e('0x42')]=[{'all':!![]}];}return db[_0xe36e('0x2d')]['findAll'](_0x4ac819);})[_0xe36e('0x26')](function(_0x5ef3e4){_0xb8d44e[_0xe36e('0x43')]=_0x5ef3e4;return _0xb8d44e;})[_0xe36e('0x26')](respondWithFilteredResult(_0x4cf185,_0x4ac819))[_0xe36e('0x44')](handleError(_0x4cf185,null));};exports[_0xe36e('0x45')]=function(_0x3b1269,_0x4c5e10){var _0x2ffc34={'raw':!![],'where':{'id':_0x3b1269[_0xe36e('0x46')]['id']}},_0x2961c9={};_0x2961c9[_0xe36e('0x31')]=_[_0xe36e('0x34')](db[_0xe36e('0x2d')]['rawAttributes']);_0x2961c9[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x3b1269[_0xe36e('0x33')]);_0x2961c9[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x2961c9['model'],_0x2961c9[_0xe36e('0x33')]);_0x2ffc34[_0xe36e('0x37')]=_[_0xe36e('0x36')](_0x2961c9[_0xe36e('0x31')],qs[_0xe36e('0x38')](_0x3b1269[_0xe36e('0x33')][_0xe36e('0x38')]));_0x2ffc34[_0xe36e('0x37')]=_0x2ffc34[_0xe36e('0x37')]['length']?_0x2ffc34['attributes']:_0x2961c9[_0xe36e('0x31')];if(_0x3b1269['query'][_0xe36e('0x47')]){_0x2ffc34[_0xe36e('0x42')]=[{'all':!![]}];}_0x2ffc34=_[_0xe36e('0x40')]({},_0x2ffc34,_0x3b1269[_0xe36e('0x48')]);return db['VoiceMail'][_0xe36e('0x49')](_0x2ffc34)[_0xe36e('0x26')](handleEntityNotFound(_0x4c5e10,null))['then'](respondWithResult(_0x4c5e10,null))[_0xe36e('0x44')](handleError(_0x4c5e10,null));};exports[_0xe36e('0x4a')]=function(_0x2c26e6,_0x42eae5){return db[_0xe36e('0x2d')][_0xe36e('0x4a')](_0x2c26e6[_0xe36e('0x4b')],{})[_0xe36e('0x26')](function(_0x17555e){var _0x3a99aa=_0x2c26e6[_0xe36e('0x4c')][_0xe36e('0x28')]({'plain':!![]});if(!_0x3a99aa)throw new Error(_0xe36e('0x4d'));if(_0x3a99aa[_0xe36e('0x4e')]===_0xe36e('0x4c')){var _0x5678d3=_0x17555e[_0xe36e('0x28')]({'plain':!![]});var _0x55aadf='Voicemails';return db[_0xe36e('0x4f')][_0xe36e('0x49')]({'where':{'name':_0x55aadf,'userProfileId':_0x3a99aa['userProfileId']},'raw':!![]})[_0xe36e('0x26')](function(_0x3814eb){if(_0x3814eb&&_0x3814eb[_0xe36e('0x50')]===0x0){return db[_0xe36e('0x51')][_0xe36e('0x4a')]({'name':_0x5678d3[_0xe36e('0x32')],'resourceId':_0x5678d3['id'],'type':_0x3814eb[_0xe36e('0x32')],'sectionId':_0x3814eb['id']},{})[_0xe36e('0x26')](function(){return _0x17555e;});}else{return _0x17555e;}})[_0xe36e('0x44')](function(_0x55d190){logger[_0xe36e('0x52')](_0xe36e('0x53'),_0x55d190);throw _0x55d190;});}return _0x17555e;})['then'](respondWithResult(_0x42eae5,0xc9))[_0xe36e('0x44')](handleError(_0x42eae5,null));};exports[_0xe36e('0x25')]=function(_0x3e1040,_0x206f75){if(_0x3e1040[_0xe36e('0x4b')]['id']){delete _0x3e1040['body']['id'];}return db['VoiceMail']['find']({'where':{'id':_0x3e1040['params']['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x206f75,null))[_0xe36e('0x26')](saveUpdates(_0x3e1040[_0xe36e('0x4b')],null))[_0xe36e('0x26')](respondWithResult(_0x206f75,null))[_0xe36e('0x44')](handleError(_0x206f75,null));};exports[_0xe36e('0x27')]=function(_0x7c3766,_0x17965c){return db[_0xe36e('0x2d')]['find']({'where':{'id':_0x7c3766[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x17965c,null))['then'](removeEntity(_0x17965c,null))[_0xe36e('0x44')](handleError(_0x17965c,null));};exports[_0xe36e('0x54')]=function(_0x169369,_0x443154,_0x700b63){return db[_0xe36e('0x2d')][_0xe36e('0x55')]({'where':{'id':_0x169369[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x443154,null))[_0xe36e('0x26')](function(_0x56718a){var _0x2cf7fc;var _0x389e91={},_0x6f979f={};_0x6f979f[_0xe36e('0x31')]=_[_0xe36e('0x34')](db[_0xe36e('0x56')][_0xe36e('0x2e')]);_0x6f979f[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x169369[_0xe36e('0x33')]);_0x6f979f[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x6f979f[_0xe36e('0x31')],_0x6f979f[_0xe36e('0x33')]);_0x389e91['attributes']=_[_0xe36e('0x36')](_0x6f979f[_0xe36e('0x31')],qs['fields'](_0x169369[_0xe36e('0x33')][_0xe36e('0x38')]));_0x389e91[_0xe36e('0x37')]=_0x389e91[_0xe36e('0x37')][_0xe36e('0x39')]?_0x389e91[_0xe36e('0x37')]:_0x6f979f['model'];if(!_0x169369[_0xe36e('0x33')]['hasOwnProperty'](_0xe36e('0x3a'))){_0x389e91[_0xe36e('0x1e')]=qs[_0xe36e('0x1e')](_0x169369[_0xe36e('0x33')][_0xe36e('0x1e')]);_0x389e91[_0xe36e('0x1c')]=qs[_0xe36e('0x1c')](_0x169369[_0xe36e('0x33')]['offset']);}_0x389e91[_0xe36e('0x3b')]=qs[_0xe36e('0x3c')](_0x169369['query'][_0xe36e('0x3c')]);_0x389e91[_0xe36e('0x3d')]=qs[_0xe36e('0x35')](_[_0xe36e('0x3e')](_0x169369[_0xe36e('0x33')],_0x6f979f[_0xe36e('0x35')]));if(_0x169369[_0xe36e('0x33')]['filter']){_0x389e91[_0xe36e('0x3d')]=_[_0xe36e('0x40')](_0x389e91[_0xe36e('0x3d')],{'$or':_[_0xe36e('0x2c')](_0x389e91[_0xe36e('0x37')],function(_0x43d8c2){var _0xc1daf8={};_0xc1daf8[_0x43d8c2]={'$like':'%'+_0x169369[_0xe36e('0x33')][_0xe36e('0x3f')]+'%'};return _0xc1daf8;})});}_0x389e91[_0xe36e('0x3d')]=_[_0xe36e('0x40')](_0x389e91['where'],{'mailboxuser':_0x56718a[_0xe36e('0x57')]});_0x389e91=_[_0xe36e('0x40')]({},_0x389e91,_0x169369[_0xe36e('0x48')]);return db[_0xe36e('0x56')]['findAndCountAll'](_0x389e91)['then'](respondWithFilteredResult(_0x443154,_0x389e91));})[_0xe36e('0x44')](handleError(_0x443154,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 893ab46..f7ceec1 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 _0xef2a=['voice_voicemail','context','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define'];(function(_0x56139f,_0x13b0b0){var _0x1290c6=function(_0x25aa7a){while(--_0x25aa7a){_0x56139f['push'](_0x56139f['shift']());}};_0x1290c6(++_0x13b0b0);}(_0xef2a,0xf9));var _0xaef2=function(_0x2024f9,_0x6e406f){_0x2024f9=_0x2024f9-0x0;var _0x4ee0b3=_0xef2a[_0x2024f9];return _0x4ee0b3;};'use strict';var _=require(_0xaef2('0x0'));var util=require(_0xaef2('0x1'));var logger=require('../../config/logger')(_0xaef2('0x2'));var moment=require(_0xaef2('0x3'));var BPromise=require(_0xaef2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaef2('0x5'));var rimraf=require(_0xaef2('0x6'));var config=require(_0xaef2('0x7'));var attributes=require(_0xaef2('0x8'));module[_0xaef2('0x9')]=function(_0x2ded0c,_0x41b96d){return _0x2ded0c[_0xaef2('0xa')]('VoiceMail',attributes,{'tableName':_0xaef2('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0xaef2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7166=['api','moment','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','lodash','../../config/logger'];(function(_0x59cce8,_0x316c4d){var _0x569475=function(_0x50d92e){while(--_0x50d92e){_0x59cce8['push'](_0x59cce8['shift']());}};_0x569475(++_0x316c4d);}(_0x7166,0xa6));var _0x6716=function(_0x2af160,_0x765b1){_0x2af160=_0x2af160-0x0;var _0x439d67=_0x7166[_0x2af160];return _0x439d67;};'use strict';var _=require(_0x6716('0x0'));var util=require('util');var logger=require(_0x6716('0x1'))(_0x6716('0x2'));var moment=require(_0x6716('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6716('0x4'));var rimraf=require(_0x6716('0x5'));var config=require(_0x6716('0x6'));var attributes=require(_0x6716('0x7'));module[_0x6716('0x8')]=function(_0x247955,_0x2ddd39){return _0x247955[_0x6716('0x9')](_0x6716('0xa'),attributes,{'tableName':_0x6716('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','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 629df3a..4ef1ee9 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 _0x8f61=['client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x379989,_0x2f9dd5){var _0x4bab65=function(_0x5919ab){while(--_0x5919ab){_0x379989['push'](_0x379989['shift']());}};_0x4bab65(++_0x2f9dd5);}(_0x8f61,0xf0));var _0x18f6=function(_0x4c0219,_0x2bfd8e){_0x4c0219=_0x4c0219-0x0;var _0x592277=_0x8f61[_0x4c0219];return _0x592277;};'use strict';var _=require(_0x18f6('0x0'));var util=require('util');var moment=require(_0x18f6('0x1'));var BPromise=require(_0x18f6('0x2'));var rs=require(_0x18f6('0x3'));var fs=require('fs');var Redis=require(_0x18f6('0x4'));var db=require(_0x18f6('0x5'))['db'];var utils=require(_0x18f6('0x6'));var logger=require(_0x18f6('0x7'))('rpc');var config=require(_0x18f6('0x8'));var jayson=require(_0x18f6('0x9'));var client=jayson[_0x18f6('0xa')][_0x18f6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25782f,_0x423bf0,_0x165d49){return new BPromise(function(_0x597c52,_0x3d90b8){return client[_0x18f6('0xc')](_0x25782f,_0x165d49)[_0x18f6('0xd')](function(_0x495311){logger[_0x18f6('0xe')](_0x18f6('0xf'),_0x423bf0,_0x18f6('0x10'));logger[_0x18f6('0x11')](_0x18f6('0x12'),_0x423bf0,'request\x20sent',JSON[_0x18f6('0x13')](_0x495311));if(_0x495311['error']){if(_0x495311[_0x18f6('0x14')][_0x18f6('0x15')]===0x1f4){logger[_0x18f6('0x14')](_0x18f6('0xf'),_0x423bf0,_0x495311['error'][_0x18f6('0x16')]);return _0x3d90b8(_0x495311['error'][_0x18f6('0x16')]);}logger['error'](_0x18f6('0xf'),_0x423bf0,_0x495311[_0x18f6('0x14')]['message']);return _0x597c52(_0x495311[_0x18f6('0x14')][_0x18f6('0x16')]);}else{logger[_0x18f6('0xe')]('VoiceMail,\x20%s,\x20%s',_0x423bf0,_0x18f6('0x10'));_0x597c52(_0x495311[_0x18f6('0x17')]['message']);}})[_0x18f6('0x18')](function(_0x52b09a){logger[_0x18f6('0x14')]('VoiceMail,\x20%s,\x20%s',_0x423bf0,_0x52b09a);_0x3d90b8(_0x52b09a);});});} \ No newline at end of file +var _0x4829=['stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s'];(function(_0x21124f,_0x4d27b6){var _0x12b0aa=function(_0x2aa04b){while(--_0x2aa04b){_0x21124f['push'](_0x21124f['shift']());}};_0x12b0aa(++_0x4d27b6);}(_0x4829,0x83));var _0x9482=function(_0x2ca2d0,_0x3ea8e4){_0x2ca2d0=_0x2ca2d0-0x0;var _0x521c23=_0x4829[_0x2ca2d0];return _0x521c23;};'use strict';var _=require(_0x9482('0x0'));var util=require(_0x9482('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9482('0x2'));var fs=require('fs');var Redis=require(_0x9482('0x3'));var db=require(_0x9482('0x4'))['db'];var utils=require(_0x9482('0x5'));var logger=require(_0x9482('0x6'))(_0x9482('0x7'));var config=require(_0x9482('0x8'));var jayson=require(_0x9482('0x9'));var client=jayson[_0x9482('0xa')][_0x9482('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3169ab,_0x41b726,_0x43249a){return new BPromise(function(_0xd0c956,_0x3be2d5){return client[_0x9482('0xc')](_0x3169ab,_0x43249a)[_0x9482('0xd')](function(_0x4ab3b1){logger[_0x9482('0xe')](_0x9482('0xf'),_0x41b726,_0x9482('0x10'));logger[_0x9482('0x11')](_0x9482('0x12'),_0x41b726,_0x9482('0x10'),JSON[_0x9482('0x13')](_0x4ab3b1));if(_0x4ab3b1['error']){if(_0x4ab3b1[_0x9482('0x14')][_0x9482('0x15')]===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x41b726,_0x4ab3b1[_0x9482('0x14')][_0x9482('0x16')]);return _0x3be2d5(_0x4ab3b1[_0x9482('0x14')][_0x9482('0x16')]);}logger[_0x9482('0x14')]('VoiceMail,\x20%s,\x20%s',_0x41b726,_0x4ab3b1[_0x9482('0x14')][_0x9482('0x16')]);return _0xd0c956(_0x4ab3b1['error']['message']);}else{logger['info'](_0x9482('0xf'),_0x41b726,_0x9482('0x10'));_0xd0c956(_0x4ab3b1[_0x9482('0x17')][_0x9482('0x16')]);}})[_0x9482('0x18')](function(_0x17fbfc){logger['error']('VoiceMail,\x20%s,\x20%s',_0x41b726,_0x17fbfc);_0x3be2d5(_0x17fbfc);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 1ec26a1..a7ae24c 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 _0x6291=['../../config/environment','get','isAuthenticated','index','/:id','/:id/download','post','create','put','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1de641,_0x44d464){var _0xccacbc=function(_0x1ed9fb){while(--_0x1ed9fb){_0x1de641['push'](_0x1de641['shift']());}};_0xccacbc(++_0x44d464);}(_0x6291,0x6b));var _0x1629=function(_0x47f4c2,_0x134e7b){_0x47f4c2=_0x47f4c2-0x0;var _0x22c63e=_0x6291[_0x47f4c2];return _0x22c63e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1629('0x0'));var timeout=require(_0x1629('0x1'));var express=require(_0x1629('0x2'));var router=express[_0x1629('0x3')]();var fs_extra=require(_0x1629('0x4'));var auth=require(_0x1629('0x5'));var interaction=require(_0x1629('0x6'));var config=require(_0x1629('0x7'));var controller=require('./voiceMailMessage.controller');router[_0x1629('0x8')]('/',auth[_0x1629('0x9')](),controller[_0x1629('0xa')]);router[_0x1629('0x8')](_0x1629('0xb'),auth[_0x1629('0x9')](),controller['show']);router[_0x1629('0x8')](_0x1629('0xc'),auth[_0x1629('0x9')](),controller['download']);router[_0x1629('0xd')]('/',auth['isAuthenticated'](),controller[_0x1629('0xe')]);router[_0x1629('0xf')](_0x1629('0xb'),auth[_0x1629('0x9')](),controller['update']);router[_0x1629('0x10')](_0x1629('0xb'),auth[_0x1629('0x9')](),controller[_0x1629('0x11')]);module[_0x1629('0x12')]=router; \ No newline at end of file +var _0x3a12=['get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller'];(function(_0x235f49,_0x2992b4){var _0x551139=function(_0x35565c){while(--_0x35565c){_0x235f49['push'](_0x235f49['shift']());}};_0x551139(++_0x2992b4);}(_0x3a12,0x72));var _0x23a1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3a12[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x23a1('0x0'));var util=require(_0x23a1('0x1'));var path=require(_0x23a1('0x2'));var timeout=require(_0x23a1('0x3'));var express=require(_0x23a1('0x4'));var router=express[_0x23a1('0x5')]();var fs_extra=require(_0x23a1('0x6'));var auth=require(_0x23a1('0x7'));var interaction=require(_0x23a1('0x8'));var config=require(_0x23a1('0x9'));var controller=require(_0x23a1('0xa'));router[_0x23a1('0xb')]('/',auth[_0x23a1('0xc')](),controller[_0x23a1('0xd')]);router[_0x23a1('0xb')](_0x23a1('0xe'),auth['isAuthenticated'](),controller[_0x23a1('0xf')]);router[_0x23a1('0xb')](_0x23a1('0x10'),auth[_0x23a1('0xc')](),controller[_0x23a1('0x11')]);router[_0x23a1('0x12')]('/',auth['isAuthenticated'](),controller[_0x23a1('0x13')]);router[_0x23a1('0x14')](_0x23a1('0xe'),auth['isAuthenticated'](),controller[_0x23a1('0x15')]);router[_0x23a1('0x16')](_0x23a1('0xe'),auth[_0x23a1('0xc')](),controller[_0x23a1('0x17')]);module[_0x23a1('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index dc92f80..c9323d9 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 _0xd457=['BLOB','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','INTEGER','STRING'];(function(_0x25fa90,_0xc200af){var _0x372a8b=function(_0x3f69a9){while(--_0x3f69a9){_0x25fa90['push'](_0x25fa90['shift']());}};_0x372a8b(++_0xc200af);}(_0xd457,0x19c));var _0x7d45=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xd457[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require('sequelize');module[_0x7d45('0x0')]={'name':{'type':Sequelize[_0x7d45('0x1')],'get':function(_0x3c3f96){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x7d45('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x7d45('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x7d45('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x7d45('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x7d45('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x7d45('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x7d45('0x4')](_0x7d45('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x7d45('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x7d45('0x6'),'defaultValue':Sequelize['literal'](_0x7d45('0x7'))}}; \ No newline at end of file +var _0x68ff=['sequelize','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x37dd60,_0x1e597d){var _0x35137a=function(_0x164e5d){while(--_0x164e5d){_0x37dd60['push'](_0x37dd60['shift']());}};_0x35137a(++_0x1e597d);}(_0x68ff,0x14a));var _0xf68f=function(_0x171234,_0x285b56){_0x171234=_0x171234-0x0;var _0x1cea9d=_0x68ff[_0x171234];return _0x1cea9d;};'use strict';var Sequelize=require(_0xf68f('0x0'));module['exports']={'name':{'type':Sequelize[_0xf68f('0x1')],'get':function(_0x27ceb6){return this[_0xf68f('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xf68f('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xf68f('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xf68f('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xf68f('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xf68f('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xf68f('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xf68f('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xf68f('0x5')](_0xf68f('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xf68f('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xf68f('0x4')],'defaultValue':''},'stamp':{'type':_0xf68f('0x7'),'defaultValue':Sequelize[_0xf68f('0x8')](_0xf68f('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 8427d78..55cbf81 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 _0xd2b3=['msg_id','Content-Disposition','attachment;\x20filename=\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','show','params','includeAll','include','find','catch','create','body','update','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment'];(function(_0x618a2b,_0x2c3f04){var _0x167b4e=function(_0x3051ce){while(--_0x3051ce){_0x618a2b['push'](_0x618a2b['shift']());}};_0x167b4e(++_0x2c3f04);}(_0xd2b3,0xb7));var _0x3d2b=function(_0x21f8a8,_0x1d7071){_0x21f8a8=_0x21f8a8-0x0;var _0x21d3d5=_0xd2b3[_0x21f8a8];return _0x21d3d5;};'use strict';var emlformat=require(_0x3d2b('0x0'));var rimraf=require(_0x3d2b('0x1'));var zipdir=require(_0x3d2b('0x2'));var jsonpatch=require(_0x3d2b('0x3'));var rp=require(_0x3d2b('0x4'));var moment=require(_0x3d2b('0x5'));var BPromise=require(_0x3d2b('0x6'));var Mustache=require(_0x3d2b('0x7'));var util=require(_0x3d2b('0x8'));var path=require(_0x3d2b('0x9'));var sox=require(_0x3d2b('0xa'));var csv=require(_0x3d2b('0xb'));var ejs=require(_0x3d2b('0xc'));var fs=require('fs');var fs_extra=require(_0x3d2b('0xd'));var _=require(_0x3d2b('0xe'));var squel=require(_0x3d2b('0xf'));var crypto=require(_0x3d2b('0x10'));var jsforce=require(_0x3d2b('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x3d2b('0xb'));var querystring=require(_0x3d2b('0x12'));var Papa=require(_0x3d2b('0x13'));var Redis=require(_0x3d2b('0x14'));var authService=require(_0x3d2b('0x15'));var qs=require(_0x3d2b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d2b('0x17'));var logger=require(_0x3d2b('0x18'))('api');var utils=require(_0x3d2b('0x19'));var config=require(_0x3d2b('0x1a'));var licenseUtil=require(_0x3d2b('0x1b'));var db=require(_0x3d2b('0x1c'))['db'];function respondWithStatusCode(_0x49526b,_0x44f7c5){_0x44f7c5=_0x44f7c5||0xcc;return function(_0x2f7e53){if(_0x2f7e53){return _0x49526b[_0x3d2b('0x1d')](_0x44f7c5);}return _0x49526b[_0x3d2b('0x1e')](_0x44f7c5)[_0x3d2b('0x1f')]();};}function respondWithResult(_0x58da84,_0x33fa4a){_0x33fa4a=_0x33fa4a||0xc8;return function(_0xa73624){if(_0xa73624){return _0x58da84[_0x3d2b('0x1e')](_0x33fa4a)[_0x3d2b('0x20')](_0xa73624);}};}function respondWithFilteredResult(_0x46cbd4,_0xf8adfd){return function(_0x45436c){if(_0x45436c){var _0x12721a=typeof _0xf8adfd[_0x3d2b('0x21')]===_0x3d2b('0x22')&&typeof _0xf8adfd[_0x3d2b('0x23')]===_0x3d2b('0x22');var _0x1d3e55=_0x45436c[_0x3d2b('0x24')];var _0x481032=_0x12721a?0x0:_0xf8adfd[_0x3d2b('0x21')];var _0x47027f=_0x12721a?_0x45436c[_0x3d2b('0x24')]:_0xf8adfd[_0x3d2b('0x21')]+_0xf8adfd['limit'];var _0x2c1618;if(_0x47027f>=_0x1d3e55){_0x47027f=_0x1d3e55;_0x2c1618=0xc8;}else{_0x2c1618=0xce;}_0x46cbd4[_0x3d2b('0x1e')](_0x2c1618);return _0x46cbd4[_0x3d2b('0x25')](_0x3d2b('0x26'),_0x481032+'-'+_0x47027f+'/'+_0x1d3e55)[_0x3d2b('0x20')](_0x45436c);}return null;};}function patchUpdates(_0x1d7632){return function(_0x4305b8){try{jsonpatch[_0x3d2b('0x27')](_0x4305b8,_0x1d7632,!![]);}catch(_0x33b140){return BPromise[_0x3d2b('0x28')](_0x33b140);}return _0x4305b8[_0x3d2b('0x29')]();};}function saveUpdates(_0x971df6,_0x4edd0e){return function(_0x5aa73b){if(_0x5aa73b){return _0x5aa73b['update'](_0x971df6)[_0x3d2b('0x2a')](function(_0x3c171f){return _0x3c171f;});}return null;};}function removeEntity(_0x51d106,_0xe4093d){return function(_0x3af83b){if(_0x3af83b){return _0x3af83b[_0x3d2b('0x2b')]()[_0x3d2b('0x2a')](function(){_0x51d106[_0x3d2b('0x1e')](0xcc)[_0x3d2b('0x1f')]();});}};}function handleEntityNotFound(_0x7fd133,_0x1afcc8){return function(_0x284d61){if(!_0x284d61){_0x7fd133[_0x3d2b('0x1d')](0x194);}return _0x284d61;};}function handleError(_0x3bc90c,_0x4835ad){_0x4835ad=_0x4835ad||0x1f4;return function(_0x3da44b){logger['error'](_0x3da44b['stack']);if(_0x3da44b[_0x3d2b('0x2c')]){delete _0x3da44b['name'];}_0x3bc90c['status'](_0x4835ad)[_0x3d2b('0x2d')](_0x3da44b);};}exports[_0x3d2b('0x2e')]=function(_0x11b374,_0x4be822){var _0x5e5298={},_0x427767={},_0x4a61cd={'count':0x0,'rows':[]};var _0x1db72e=_[_0x3d2b('0x2f')](db[_0x3d2b('0x30')][_0x3d2b('0x31')],function(_0x45c984){return{'name':_0x45c984[_0x3d2b('0x32')],'type':_0x45c984[_0x3d2b('0x33')][_0x3d2b('0x34')]};});_0x427767[_0x3d2b('0x35')]=_[_0x3d2b('0x36')](_[_0x3d2b('0x2f')](_0x1db72e,_0x3d2b('0x2c')),[_0x3d2b('0x2c')]);_0x427767[_0x3d2b('0x37')]=_[_0x3d2b('0x38')](_0x11b374['query']);_0x427767['filters']=_[_0x3d2b('0x39')](_0x427767['model'],_0x427767[_0x3d2b('0x37')]);_0x5e5298[_0x3d2b('0x3a')]=_[_0x3d2b('0x39')](_0x427767[_0x3d2b('0x35')],qs['fields'](_0x11b374[_0x3d2b('0x37')][_0x3d2b('0x3b')]));_0x5e5298[_0x3d2b('0x3a')]=_0x5e5298[_0x3d2b('0x3a')][_0x3d2b('0x3c')]?_0x5e5298[_0x3d2b('0x3a')]:_0x427767['model'];if(!_0x11b374[_0x3d2b('0x37')][_0x3d2b('0x3d')](_0x3d2b('0x3e'))){_0x5e5298['limit']=qs[_0x3d2b('0x23')](_0x11b374[_0x3d2b('0x37')][_0x3d2b('0x23')]);_0x5e5298[_0x3d2b('0x21')]=qs[_0x3d2b('0x21')](_0x11b374['query'][_0x3d2b('0x21')]);}_0x5e5298[_0x3d2b('0x3f')]=qs[_0x3d2b('0x40')](_0x11b374[_0x3d2b('0x37')][_0x3d2b('0x40')]);_0x5e5298[_0x3d2b('0x41')]=qs[_0x3d2b('0x42')](_[_0x3d2b('0x43')](_0x11b374[_0x3d2b('0x37')],_0x427767[_0x3d2b('0x42')]),_0x1db72e);if(_0x11b374[_0x3d2b('0x37')][_0x3d2b('0x44')]){_0x5e5298[_0x3d2b('0x41')]=_[_0x3d2b('0x45')](_0x5e5298['where'],{'$or':_[_0x3d2b('0x2f')](_0x1db72e,function(_0x1fd25f){if(_0x1fd25f['type']!==_0x3d2b('0x46')){var _0xe25db5={};_0xe25db5[_0x1fd25f[_0x3d2b('0x2c')]]={'$like':'%'+_0x11b374['query']['filter']+'%'};return _0xe25db5;}})});}_0x5e5298=_[_0x3d2b('0x45')]({},_0x5e5298,_0x11b374[_0x3d2b('0x47')]);var _0x4f71da={'where':_0x5e5298[_0x3d2b('0x41')]};return db[_0x3d2b('0x30')][_0x3d2b('0x24')](_0x4f71da)[_0x3d2b('0x2a')](function(_0x2fa3fe){_0x4a61cd['count']=_0x2fa3fe;if(_0x11b374[_0x3d2b('0x37')]['includeAll']){_0x5e5298['include']=[{'all':!![]}];}return db['VoiceMailMessage'][_0x3d2b('0x48')](_0x5e5298);})[_0x3d2b('0x2a')](function(_0x3b7c6b){_0x4a61cd['rows']=_0x3b7c6b;return _0x4a61cd;})['then'](respondWithFilteredResult(_0x4be822,_0x5e5298))['catch'](handleError(_0x4be822,null));};exports[_0x3d2b('0x49')]=function(_0x4f38e9,_0x45fd92){var _0x4a38fb={'raw':!![],'where':{'id':_0x4f38e9[_0x3d2b('0x4a')]['id']}},_0x2c03a6={};_0x2c03a6[_0x3d2b('0x35')]=_[_0x3d2b('0x38')](db['VoiceMailMessage'][_0x3d2b('0x31')]);_0x2c03a6[_0x3d2b('0x37')]=_[_0x3d2b('0x38')](_0x4f38e9[_0x3d2b('0x37')]);_0x2c03a6[_0x3d2b('0x42')]=_['intersection'](_0x2c03a6[_0x3d2b('0x35')],_0x2c03a6[_0x3d2b('0x37')]);_0x4a38fb[_0x3d2b('0x3a')]=_[_0x3d2b('0x39')](_0x2c03a6[_0x3d2b('0x35')],qs['fields'](_0x4f38e9[_0x3d2b('0x37')][_0x3d2b('0x3b')]));_0x4a38fb[_0x3d2b('0x3a')]=_0x4a38fb[_0x3d2b('0x3a')][_0x3d2b('0x3c')]?_0x4a38fb[_0x3d2b('0x3a')]:_0x2c03a6['model'];if(_0x4f38e9['query'][_0x3d2b('0x4b')]){_0x4a38fb[_0x3d2b('0x4c')]=[{'all':!![]}];}_0x4a38fb=_[_0x3d2b('0x45')]({},_0x4a38fb,_0x4f38e9[_0x3d2b('0x47')]);return db[_0x3d2b('0x30')][_0x3d2b('0x4d')](_0x4a38fb)[_0x3d2b('0x2a')](handleEntityNotFound(_0x45fd92,null))[_0x3d2b('0x2a')](respondWithResult(_0x45fd92,null))[_0x3d2b('0x4e')](handleError(_0x45fd92,null));};exports[_0x3d2b('0x4f')]=function(_0x185ea7,_0x33a88b){return db['VoiceMailMessage'][_0x3d2b('0x4f')](_0x185ea7[_0x3d2b('0x50')],{})[_0x3d2b('0x2a')](respondWithResult(_0x33a88b,0xc9))[_0x3d2b('0x4e')](handleError(_0x33a88b,null));};exports[_0x3d2b('0x51')]=function(_0x5c02e5,_0x4d8c2a){if(_0x5c02e5[_0x3d2b('0x50')]['id']){delete _0x5c02e5[_0x3d2b('0x50')]['id'];}return db[_0x3d2b('0x30')]['find']({'where':{'id':_0x5c02e5['params']['id']}})[_0x3d2b('0x2a')](handleEntityNotFound(_0x4d8c2a,null))['then'](saveUpdates(_0x5c02e5['body'],null))[_0x3d2b('0x2a')](respondWithResult(_0x4d8c2a,null))[_0x3d2b('0x4e')](handleError(_0x4d8c2a,null));};exports[_0x3d2b('0x2b')]=function(_0xcf61d4,_0xbab009){return db[_0x3d2b('0x30')]['find']({'where':{'id':_0xcf61d4[_0x3d2b('0x4a')]['id']}})[_0x3d2b('0x2a')](handleEntityNotFound(_0xbab009,null))['then'](removeEntity(_0xbab009,null))['catch'](handleError(_0xbab009,null));};exports['download']=function(_0x2c918c,_0x1d1fb1,_0x4322c2){return db['VoiceMailMessage']['find']({'where':{'id':_0x2c918c['params']['id']},'attributes':['id',_0x3d2b('0x52'),'msg_id']})[_0x3d2b('0x2a')](handleEntityNotFound(_0x1d1fb1,null))[_0x3d2b('0x2a')](function(_0x57d16d){if(_0x57d16d){if(!_0x57d16d[_0x3d2b('0x52')]){throw new db[(_0x3d2b('0x53'))][(_0x3d2b('0x54'))](_0x3d2b('0x55'));}var _0x3bdc5a={'Content-Type':'audio/wav','Content-Disposition':_0x3d2b('0x56')};if(_0x57d16d[_0x3d2b('0x57')]){_0x3bdc5a[_0x3d2b('0x58')]=_0x3d2b('0x59')+_0x57d16d[_0x3d2b('0x57')]+'.wav\x22';}_0x1d1fb1[_0x3d2b('0x25')](_0x3bdc5a);return _0x1d1fb1[_0x3d2b('0x2d')](new Buffer(_0x57d16d['recording']));}})[_0x3d2b('0x4e')](handleError(_0x1d1fb1,null));}; \ No newline at end of file +var _0xff8d=['update','then','destroy','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','type','filter','options','VoiceMailMessage','includeAll','findAll','rows','catch','show','include','find','create','body','params','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','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','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0xc6d89e,_0x20e99c){var _0x3d5476=function(_0x268ec1){while(--_0x268ec1){_0xc6d89e['push'](_0xc6d89e['shift']());}};_0x3d5476(++_0x20e99c);}(_0xff8d,0x133));var _0xdff8=function(_0x5df456,_0x150995){_0x5df456=_0x5df456-0x0;var _0x240188=_0xff8d[_0x5df456];return _0x240188;};'use strict';var emlformat=require(_0xdff8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdff8('0x1'));var jsonpatch=require(_0xdff8('0x2'));var rp=require(_0xdff8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdff8('0x4'));var path=require(_0xdff8('0x5'));var sox=require(_0xdff8('0x6'));var csv=require(_0xdff8('0x7'));var ejs=require(_0xdff8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdff8('0x9'));var squel=require(_0xdff8('0xa'));var crypto=require(_0xdff8('0xb'));var jsforce=require(_0xdff8('0xc'));var deskjs=require(_0xdff8('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdff8('0xe'));var Redis=require(_0xdff8('0xf'));var authService=require(_0xdff8('0x10'));var qs=require(_0xdff8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdff8('0x12'))(_0xdff8('0x13'));var utils=require(_0xdff8('0x14'));var config=require(_0xdff8('0x15'));var licenseUtil=require(_0xdff8('0x16'));var db=require(_0xdff8('0x17'))['db'];function respondWithStatusCode(_0x3b9a6d,_0x53bb9c){_0x53bb9c=_0x53bb9c||0xcc;return function(_0x40fb89){if(_0x40fb89){return _0x3b9a6d[_0xdff8('0x18')](_0x53bb9c);}return _0x3b9a6d[_0xdff8('0x19')](_0x53bb9c)[_0xdff8('0x1a')]();};}function respondWithResult(_0x29fbc1,_0x533296){_0x533296=_0x533296||0xc8;return function(_0x25a488){if(_0x25a488){return _0x29fbc1[_0xdff8('0x19')](_0x533296)[_0xdff8('0x1b')](_0x25a488);}};}function respondWithFilteredResult(_0x8add,_0x4bfedd){return function(_0x3dd464){if(_0x3dd464){var _0x27e318=typeof _0x4bfedd[_0xdff8('0x1c')]===_0xdff8('0x1d')&&typeof _0x4bfedd[_0xdff8('0x1e')]===_0xdff8('0x1d');var _0x44a2f5=_0x3dd464[_0xdff8('0x1f')];var _0x11ceb0=_0x27e318?0x0:_0x4bfedd[_0xdff8('0x1c')];var _0x2cb3d3=_0x27e318?_0x3dd464[_0xdff8('0x1f')]:_0x4bfedd['offset']+_0x4bfedd['limit'];var _0x74a24;if(_0x2cb3d3>=_0x44a2f5){_0x2cb3d3=_0x44a2f5;_0x74a24=0xc8;}else{_0x74a24=0xce;}_0x8add['status'](_0x74a24);return _0x8add[_0xdff8('0x20')](_0xdff8('0x21'),_0x11ceb0+'-'+_0x2cb3d3+'/'+_0x44a2f5)[_0xdff8('0x1b')](_0x3dd464);}return null;};}function patchUpdates(_0x2dccb7){return function(_0x53250e){try{jsonpatch[_0xdff8('0x22')](_0x53250e,_0x2dccb7,!![]);}catch(_0x1f7375){return BPromise[_0xdff8('0x23')](_0x1f7375);}return _0x53250e[_0xdff8('0x24')]();};}function saveUpdates(_0x20994e,_0x1e0d6c){return function(_0x23945b){if(_0x23945b){return _0x23945b[_0xdff8('0x25')](_0x20994e)[_0xdff8('0x26')](function(_0x27af5a){return _0x27af5a;});}return null;};}function removeEntity(_0xa3b9a6,_0x3b76b1){return function(_0xa19474){if(_0xa19474){return _0xa19474[_0xdff8('0x27')]()[_0xdff8('0x26')](function(){_0xa3b9a6['status'](0xcc)[_0xdff8('0x1a')]();});}};}function handleEntityNotFound(_0x1255f7,_0x527e88){return function(_0x35df95){if(!_0x35df95){_0x1255f7[_0xdff8('0x18')](0x194);}return _0x35df95;};}function handleError(_0x333880,_0x53db10){_0x53db10=_0x53db10||0x1f4;return function(_0x4d462a){logger['error'](_0x4d462a['stack']);if(_0x4d462a[_0xdff8('0x28')]){delete _0x4d462a[_0xdff8('0x28')];}_0x333880[_0xdff8('0x19')](_0x53db10)[_0xdff8('0x29')](_0x4d462a);};}exports[_0xdff8('0x2a')]=function(_0x54d6b1,_0x2208a9){var _0x56df3e={},_0x124d2c={},_0x2f5223={'count':0x0,'rows':[]};var _0x6fa74=_[_0xdff8('0x2b')](db['VoiceMailMessage'][_0xdff8('0x2c')],function(_0x51f8bd){return{'name':_0x51f8bd[_0xdff8('0x2d')],'type':_0x51f8bd['type'][_0xdff8('0x2e')]};});_0x124d2c[_0xdff8('0x2f')]=_['differenceBy'](_['map'](_0x6fa74,_0xdff8('0x28')),['name']);_0x124d2c[_0xdff8('0x30')]=_[_0xdff8('0x31')](_0x54d6b1[_0xdff8('0x30')]);_0x124d2c['filters']=_[_0xdff8('0x32')](_0x124d2c[_0xdff8('0x2f')],_0x124d2c[_0xdff8('0x30')]);_0x56df3e[_0xdff8('0x33')]=_['intersection'](_0x124d2c[_0xdff8('0x2f')],qs[_0xdff8('0x34')](_0x54d6b1[_0xdff8('0x30')]['fields']));_0x56df3e['attributes']=_0x56df3e[_0xdff8('0x33')][_0xdff8('0x35')]?_0x56df3e[_0xdff8('0x33')]:_0x124d2c[_0xdff8('0x2f')];if(!_0x54d6b1[_0xdff8('0x30')][_0xdff8('0x36')]('nolimit')){_0x56df3e[_0xdff8('0x1e')]=qs['limit'](_0x54d6b1[_0xdff8('0x30')][_0xdff8('0x1e')]);_0x56df3e[_0xdff8('0x1c')]=qs['offset'](_0x54d6b1[_0xdff8('0x30')][_0xdff8('0x1c')]);}_0x56df3e[_0xdff8('0x37')]=qs['sort'](_0x54d6b1['query'][_0xdff8('0x38')]);_0x56df3e[_0xdff8('0x39')]=qs[_0xdff8('0x3a')](_[_0xdff8('0x3b')](_0x54d6b1[_0xdff8('0x30')],_0x124d2c['filters']),_0x6fa74);if(_0x54d6b1[_0xdff8('0x30')]['filter']){_0x56df3e['where']=_[_0xdff8('0x3c')](_0x56df3e['where'],{'$or':_[_0xdff8('0x2b')](_0x6fa74,function(_0x202153){if(_0x202153[_0xdff8('0x3d')]!=='VIRTUAL'){var _0x546efd={};_0x546efd[_0x202153[_0xdff8('0x28')]]={'$like':'%'+_0x54d6b1[_0xdff8('0x30')][_0xdff8('0x3e')]+'%'};return _0x546efd;}})});}_0x56df3e=_[_0xdff8('0x3c')]({},_0x56df3e,_0x54d6b1[_0xdff8('0x3f')]);var _0x4efac8={'where':_0x56df3e[_0xdff8('0x39')]};return db[_0xdff8('0x40')][_0xdff8('0x1f')](_0x4efac8)[_0xdff8('0x26')](function(_0x871e4a){_0x2f5223[_0xdff8('0x1f')]=_0x871e4a;if(_0x54d6b1[_0xdff8('0x30')][_0xdff8('0x41')]){_0x56df3e['include']=[{'all':!![]}];}return db['VoiceMailMessage'][_0xdff8('0x42')](_0x56df3e);})['then'](function(_0x5ede91){_0x2f5223[_0xdff8('0x43')]=_0x5ede91;return _0x2f5223;})[_0xdff8('0x26')](respondWithFilteredResult(_0x2208a9,_0x56df3e))[_0xdff8('0x44')](handleError(_0x2208a9,null));};exports[_0xdff8('0x45')]=function(_0x43823b,_0x5eafda){var _0x30a4da={'raw':!![],'where':{'id':_0x43823b['params']['id']}},_0x286006={};_0x286006[_0xdff8('0x2f')]=_[_0xdff8('0x31')](db[_0xdff8('0x40')][_0xdff8('0x2c')]);_0x286006[_0xdff8('0x30')]=_[_0xdff8('0x31')](_0x43823b[_0xdff8('0x30')]);_0x286006[_0xdff8('0x3a')]=_[_0xdff8('0x32')](_0x286006[_0xdff8('0x2f')],_0x286006[_0xdff8('0x30')]);_0x30a4da[_0xdff8('0x33')]=_[_0xdff8('0x32')](_0x286006[_0xdff8('0x2f')],qs[_0xdff8('0x34')](_0x43823b[_0xdff8('0x30')][_0xdff8('0x34')]));_0x30a4da['attributes']=_0x30a4da['attributes'][_0xdff8('0x35')]?_0x30a4da[_0xdff8('0x33')]:_0x286006['model'];if(_0x43823b[_0xdff8('0x30')]['includeAll']){_0x30a4da[_0xdff8('0x46')]=[{'all':!![]}];}_0x30a4da=_[_0xdff8('0x3c')]({},_0x30a4da,_0x43823b[_0xdff8('0x3f')]);return db[_0xdff8('0x40')][_0xdff8('0x47')](_0x30a4da)[_0xdff8('0x26')](handleEntityNotFound(_0x5eafda,null))[_0xdff8('0x26')](respondWithResult(_0x5eafda,null))[_0xdff8('0x44')](handleError(_0x5eafda,null));};exports[_0xdff8('0x48')]=function(_0x4d5db7,_0x40c9ed){return db[_0xdff8('0x40')][_0xdff8('0x48')](_0x4d5db7[_0xdff8('0x49')],{})[_0xdff8('0x26')](respondWithResult(_0x40c9ed,0xc9))[_0xdff8('0x44')](handleError(_0x40c9ed,null));};exports['update']=function(_0xc639e,_0x4525b3){if(_0xc639e[_0xdff8('0x49')]['id']){delete _0xc639e[_0xdff8('0x49')]['id'];}return db['VoiceMailMessage'][_0xdff8('0x47')]({'where':{'id':_0xc639e[_0xdff8('0x4a')]['id']}})[_0xdff8('0x26')](handleEntityNotFound(_0x4525b3,null))[_0xdff8('0x26')](saveUpdates(_0xc639e[_0xdff8('0x49')],null))['then'](respondWithResult(_0x4525b3,null))[_0xdff8('0x44')](handleError(_0x4525b3,null));};exports[_0xdff8('0x27')]=function(_0x39c858,_0x38bdd0){return db[_0xdff8('0x40')][_0xdff8('0x47')]({'where':{'id':_0x39c858['params']['id']}})['then'](handleEntityNotFound(_0x38bdd0,null))[_0xdff8('0x26')](removeEntity(_0x38bdd0,null))[_0xdff8('0x44')](handleError(_0x38bdd0,null));};exports[_0xdff8('0x4b')]=function(_0x236700,_0x512104,_0x346c08){return db['VoiceMailMessage'][_0xdff8('0x47')]({'where':{'id':_0x236700[_0xdff8('0x4a')]['id']},'attributes':['id',_0xdff8('0x4c'),_0xdff8('0x4d')]})[_0xdff8('0x26')](handleEntityNotFound(_0x512104,null))[_0xdff8('0x26')](function(_0x10c694){if(_0x10c694){if(!_0x10c694[_0xdff8('0x4c')]){throw new db[(_0xdff8('0x4e'))][(_0xdff8('0x4f'))](_0xdff8('0x50'));}var _0x3990a7={'Content-Type':_0xdff8('0x51'),'Content-Disposition':_0xdff8('0x52')};if(_0x10c694['msg_id']){_0x3990a7[_0xdff8('0x53')]=_0xdff8('0x54')+_0x10c694[_0xdff8('0x4d')]+_0xdff8('0x55');}_0x512104['set'](_0x3990a7);return _0x512104[_0xdff8('0x29')](new Buffer(_0x10c694['recording']));}})[_0xdff8('0x44')](handleError(_0x512104,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 251f917..170d313 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 _0xc029=['moment','bluebird','path','rimraf','./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir','lodash','api'];(function(_0xf1ead1,_0x5b0c54){var _0x24c361=function(_0x92ddb6){while(--_0x92ddb6){_0xf1ead1['push'](_0xf1ead1['shift']());}};_0x24c361(++_0x5b0c54);}(_0xc029,0x15e));var _0x9c02=function(_0x211f66,_0x6d409f){_0x211f66=_0x211f66-0x0;var _0x324240=_0xc029[_0x211f66];return _0x324240;};'use strict';var _=require(_0x9c02('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9c02('0x1'));var moment=require(_0x9c02('0x2'));var BPromise=require(_0x9c02('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c02('0x4'));var rimraf=require(_0x9c02('0x5'));var config=require('../../config/environment');var attributes=require(_0x9c02('0x6'));module[_0x9c02('0x7')]=function(_0x55f46e,_0x542adf){return _0x55f46e[_0x9c02('0x8')]('VoiceMailMessage',attributes,{'tableName':_0x9c02('0x9'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x9c02('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x0041=['request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','moment','bluebird'];(function(_0x43ebb8,_0x465ce6){var _0x146b49=function(_0x8b517c){while(--_0x8b517c){_0x43ebb8['push'](_0x43ebb8['shift']());}};_0x146b49(++_0x465ce6);}(_0x0041,0x105));var _0x1004=function(_0x5cc6aa,_0x56c449){_0x5cc6aa=_0x5cc6aa-0x0;var _0x41fa80=_0x0041[_0x5cc6aa];return _0x41fa80;};'use strict';var _=require(_0x1004('0x0'));var util=require(_0x1004('0x1'));var logger=require(_0x1004('0x2'))('api');var moment=require(_0x1004('0x3'));var BPromise=require(_0x1004('0x4'));var rp=require(_0x1004('0x5'));var fs=require('fs');var path=require(_0x1004('0x6'));var rimraf=require(_0x1004('0x7'));var config=require(_0x1004('0x8'));var attributes=require(_0x1004('0x9'));module[_0x1004('0xa')]=function(_0x379235,_0x5811e8){return _0x379235['define'](_0x1004('0xb'),attributes,{'tableName':_0x1004('0xc'),'paranoid':![],'indexes':[{'name':_0x1004('0xd'),'fields':[_0x1004('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 9c3f3f6..296a0df 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 _0x12e7=['util','moment','bluebird','../../config/utils','../../config/environment','jayson/promise','http','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash'];(function(_0x26f68f,_0x125079){var _0x3047dd=function(_0xa2b931){while(--_0xa2b931){_0x26f68f['push'](_0x26f68f['shift']());}};_0x3047dd(++_0x125079);}(_0x12e7,0x18b));var _0x712e=function(_0x33ac0d,_0x1074f1){_0x33ac0d=_0x33ac0d-0x0;var _0x4064ed=_0x12e7[_0x33ac0d];return _0x4064ed;};'use strict';var _=require(_0x712e('0x0'));var util=require(_0x712e('0x1'));var moment=require(_0x712e('0x2'));var BPromise=require(_0x712e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x712e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x712e('0x5'));var jayson=require(_0x712e('0x6'));var client=jayson['client'][_0x712e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x19c207,_0x2e1784,_0x1d167e){return new BPromise(function(_0x507935,_0x3a938a){return client[_0x712e('0x8')](_0x19c207,_0x1d167e)[_0x712e('0x9')](function(_0x2ffd45){logger['info'](_0x712e('0xa'),_0x2e1784,_0x712e('0xb'));logger[_0x712e('0xc')](_0x712e('0xd'),_0x2e1784,_0x712e('0xb'),JSON[_0x712e('0xe')](_0x2ffd45));if(_0x2ffd45[_0x712e('0xf')]){if(_0x2ffd45['error']['code']===0x1f4){logger[_0x712e('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x2e1784,_0x2ffd45[_0x712e('0xf')][_0x712e('0x10')]);return _0x3a938a(_0x2ffd45[_0x712e('0xf')]['message']);}logger['error'](_0x712e('0xa'),_0x2e1784,_0x2ffd45[_0x712e('0xf')][_0x712e('0x10')]);return _0x507935(_0x2ffd45[_0x712e('0xf')]['message']);}else{logger['info'](_0x712e('0xa'),_0x2e1784,_0x712e('0xb'));_0x507935(_0x2ffd45[_0x712e('0x11')][_0x712e('0x10')]);}})['catch'](function(_0x31f8bc){logger[_0x712e('0xf')](_0x712e('0xa'),_0x2e1784,_0x31f8bc);_0x3a938a(_0x31f8bc);});});} \ No newline at end of file +var _0x007c=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x007c,0x1c7));var _0xc007=function(_0x134f37,_0x17eba8){_0x134f37=_0x134f37-0x0;var _0x595857=_0x007c[_0x134f37];return _0x595857;};'use strict';var _=require(_0xc007('0x0'));var util=require(_0xc007('0x1'));var moment=require(_0xc007('0x2'));var BPromise=require(_0xc007('0x3'));var rs=require(_0xc007('0x4'));var fs=require('fs');var Redis=require(_0xc007('0x5'));var db=require(_0xc007('0x6'))['db'];var utils=require(_0xc007('0x7'));var logger=require(_0xc007('0x8'))(_0xc007('0x9'));var config=require('../../config/environment');var jayson=require(_0xc007('0xa'));var client=jayson[_0xc007('0xb')][_0xc007('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x547a03,_0x5b31c3,_0x3c9767){return new BPromise(function(_0x7dc06,_0x3a6302){return client[_0xc007('0xd')](_0x547a03,_0x3c9767)['then'](function(_0x415a8f){logger[_0xc007('0xe')](_0xc007('0xf'),_0x5b31c3,'request\x20sent');logger[_0xc007('0x10')](_0xc007('0x11'),_0x5b31c3,_0xc007('0x12'),JSON[_0xc007('0x13')](_0x415a8f));if(_0x415a8f['error']){if(_0x415a8f[_0xc007('0x14')][_0xc007('0x15')]===0x1f4){logger[_0xc007('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0x5b31c3,_0x415a8f[_0xc007('0x14')][_0xc007('0x16')]);return _0x3a6302(_0x415a8f['error'][_0xc007('0x16')]);}logger[_0xc007('0x14')](_0xc007('0xf'),_0x5b31c3,_0x415a8f[_0xc007('0x14')]['message']);return _0x7dc06(_0x415a8f[_0xc007('0x14')][_0xc007('0x16')]);}else{logger[_0xc007('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x5b31c3,_0xc007('0x12'));_0x7dc06(_0x415a8f[_0xc007('0x17')]['message']);}})[_0xc007('0x18')](function(_0x1358d0){logger[_0xc007('0x14')](_0xc007('0xf'),_0x5b31c3,_0x1358d0);_0x3a6302(_0x1358d0);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 1d42d3b..0bde78e 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 _0x88df=['isAuthenticated','/:id','show','/:id/sounds','post','addSound','put','update','/:id/sounds/:id2','removeSound','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get'];(function(_0x49c68e,_0x1c1673){var _0x33032b=function(_0x42ac31){while(--_0x42ac31){_0x49c68e['push'](_0x49c68e['shift']());}};_0x33032b(++_0x1c1673);}(_0x88df,0x9e));var _0xf88d=function(_0x19fce5,_0x3414ad){_0x19fce5=_0x19fce5-0x0;var _0x2be1f2=_0x88df[_0x19fce5];return _0x2be1f2;};'use strict';var multer=require('multer');var util=require(_0xf88d('0x0'));var path=require(_0xf88d('0x1'));var timeout=require(_0xf88d('0x2'));var express=require('express');var router=express[_0xf88d('0x3')]();var fs_extra=require(_0xf88d('0x4'));var auth=require(_0xf88d('0x5'));var interaction=require(_0xf88d('0x6'));var config=require(_0xf88d('0x7'));var controller=require(_0xf88d('0x8'));router[_0xf88d('0x9')]('/',auth[_0xf88d('0xa')](),controller['index']);router[_0xf88d('0x9')](_0xf88d('0xb'),auth[_0xf88d('0xa')](),controller[_0xf88d('0xc')]);router[_0xf88d('0x9')](_0xf88d('0xd'),auth[_0xf88d('0xa')](),controller['getSounds']);router[_0xf88d('0xe')]('/',auth[_0xf88d('0xa')](),controller['create']);router[_0xf88d('0xe')](_0xf88d('0xd'),auth[_0xf88d('0xa')](),controller[_0xf88d('0xf')]);router[_0xf88d('0x10')](_0xf88d('0xb'),auth[_0xf88d('0xa')](),controller[_0xf88d('0x11')]);router['delete']('/:id',auth[_0xf88d('0xa')](),controller['destroy']);router['delete'](_0xf88d('0x12'),auth[_0xf88d('0xa')](),controller[_0xf88d('0x13')]);module[_0xf88d('0x14')]=router; \ No newline at end of file +var _0xaeb0=['index','get','show','getSounds','post','create','/:id/sounds','addSound','update','destroy','delete','/:id/sounds/:id2','removeSound','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x473ee7,_0x4dd754){var _0x30f0d4=function(_0x4d961d){while(--_0x4d961d){_0x473ee7['push'](_0x473ee7['shift']());}};_0x30f0d4(++_0x4dd754);}(_0xaeb0,0xcb));var _0x0aeb=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xaeb0[_0x346737];return _0x1ade2e;};'use strict';var multer=require('multer');var util=require(_0x0aeb('0x0'));var path=require('path');var timeout=require(_0x0aeb('0x1'));var express=require('express');var router=express[_0x0aeb('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0aeb('0x3'));var interaction=require(_0x0aeb('0x4'));var config=require(_0x0aeb('0x5'));var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth[_0x0aeb('0x6')](),controller[_0x0aeb('0x7')]);router[_0x0aeb('0x8')]('/:id',auth[_0x0aeb('0x6')](),controller[_0x0aeb('0x9')]);router[_0x0aeb('0x8')]('/:id/sounds',auth[_0x0aeb('0x6')](),controller[_0x0aeb('0xa')]);router[_0x0aeb('0xb')]('/',auth[_0x0aeb('0x6')](),controller[_0x0aeb('0xc')]);router[_0x0aeb('0xb')](_0x0aeb('0xd'),auth[_0x0aeb('0x6')](),controller[_0x0aeb('0xe')]);router['put']('/:id',auth[_0x0aeb('0x6')](),controller[_0x0aeb('0xf')]);router['delete']('/:id',auth[_0x0aeb('0x6')](),controller[_0x0aeb('0x10')]);router[_0x0aeb('0x11')](_0x0aeb('0x12'),auth['isAuthenticated'](),controller[_0x0aeb('0x13')]);module[_0x0aeb('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index a8af58d..5f6050e 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 _0x3ab7=['sequelize','exports','STRING','custom','files','mp3nb','quietmp3nb','quietmp3','alpha','TIMESTAMP','BOOLEAN'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x3ab7,0xd1));var _0x73ab=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x3ab7[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x73ab('0x0'));module[_0x73ab('0x1')]={'name':{'type':Sequelize[_0x73ab('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0x73ab('0x3'),_0x73ab('0x4'),_0x73ab('0x5'),_0x73ab('0x6'),_0x73ab('0x7'),'mp3'),'allowNull':!![],'defaultValue':_0x73ab('0x4')},'directory':{'type':Sequelize[_0x73ab('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x73ab('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x73ab('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x73ab('0x8')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x73ab('0x9')},'defaultEntry':{'type':Sequelize[_0x73ab('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x569a=['custom','files','mp3nb','quietmp3nb','quietmp3','alpha','TIMESTAMP','BOOLEAN','sequelize','STRING','name'];(function(_0x499210,_0x325b29){var _0x2e153d=function(_0x951263){while(--_0x951263){_0x499210['push'](_0x499210['shift']());}};_0x2e153d(++_0x325b29);}(_0x569a,0x6b));var _0xa569=function(_0x4d7a70,_0x2d3bfa){_0x4d7a70=_0x4d7a70-0x0;var _0x3aafbb=_0x569a[_0x4d7a70];return _0x3aafbb;};'use strict';var Sequelize=require(_0xa569('0x0'));module['exports']={'name':{'type':Sequelize[_0xa569('0x1')],'allowNull':![],'unique':_0xa569('0x2')},'mode':{'type':Sequelize['ENUM'](_0xa569('0x3'),_0xa569('0x4'),_0xa569('0x5'),_0xa569('0x6'),_0xa569('0x7'),'mp3'),'allowNull':!![],'defaultValue':_0xa569('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xa569('0x1')],'allowNull':!![],'defaultValue':_0xa569('0x8')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xa569('0x9')},'defaultEntry':{'type':Sequelize[_0xa569('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 6e5337d..5ba44d6 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 _0x0dc6=['order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','map','VoiceMusicOnHold','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','body','create','sequelize','transaction','mode','files','directory','join','server/files/moh','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','MusicOnHolds','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','Sound','findOne','converted_format','createdAt','root','server/files/sounds/converted','%s.%s','basename','extname','save_name','format','symlinkSync','removeSound','id2','ValidationError','message','getSounds'];(function(_0x2812c2,_0x2b382d){var _0x218ac9=function(_0x2fe4c4){while(--_0x2fe4c4){_0x2812c2['push'](_0x2812c2['shift']());}};_0x218ac9(++_0x2b382d);}(_0x0dc6,0x142));var _0x60dc=function(_0x3d9176,_0x399d6f){_0x3d9176=_0x3d9176-0x0;var _0x12adc5=_0x0dc6[_0x3d9176];return _0x12adc5;};'use strict';var emlformat=require(_0x60dc('0x0'));var rimraf=require(_0x60dc('0x1'));var zipdir=require(_0x60dc('0x2'));var jsonpatch=require(_0x60dc('0x3'));var rp=require(_0x60dc('0x4'));var moment=require(_0x60dc('0x5'));var BPromise=require(_0x60dc('0x6'));var Mustache=require('mustache');var util=require(_0x60dc('0x7'));var path=require(_0x60dc('0x8'));var sox=require(_0x60dc('0x9'));var csv=require(_0x60dc('0xa'));var ejs=require(_0x60dc('0xb'));var fs=require('fs');var fs_extra=require(_0x60dc('0xc'));var _=require('lodash');var squel=require(_0x60dc('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x60dc('0xe'));var toCsv=require(_0x60dc('0xa'));var querystring=require('querystring');var Papa=require(_0x60dc('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x60dc('0x10'));var as=require(_0x60dc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x60dc('0x12'));var utils=require(_0x60dc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x60dc('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x126f9b,_0x2e4429){_0x2e4429=_0x2e4429||0xcc;return function(_0x35c3b0){if(_0x35c3b0){return _0x126f9b[_0x60dc('0x15')](_0x2e4429);}return _0x126f9b[_0x60dc('0x16')](_0x2e4429)[_0x60dc('0x17')]();};}function respondWithResult(_0x188fe9,_0x2a997c){_0x2a997c=_0x2a997c||0xc8;return function(_0x506efc){if(_0x506efc){return _0x188fe9[_0x60dc('0x16')](_0x2a997c)[_0x60dc('0x18')](_0x506efc);}};}function respondWithFilteredResult(_0x5e7892,_0xeb6867){return function(_0x594320){if(_0x594320){var _0x42759c=typeof _0xeb6867[_0x60dc('0x19')]==='undefined'&&typeof _0xeb6867[_0x60dc('0x1a')]===_0x60dc('0x1b');var _0x313b39=_0x594320[_0x60dc('0x1c')];var _0x3c958d=_0x42759c?0x0:_0xeb6867[_0x60dc('0x19')];var _0x324219=_0x42759c?_0x594320[_0x60dc('0x1c')]:_0xeb6867[_0x60dc('0x19')]+_0xeb6867[_0x60dc('0x1a')];var _0x21a376;if(_0x324219>=_0x313b39){_0x324219=_0x313b39;_0x21a376=0xc8;}else{_0x21a376=0xce;}_0x5e7892[_0x60dc('0x16')](_0x21a376);return _0x5e7892['set'](_0x60dc('0x1d'),_0x3c958d+'-'+_0x324219+'/'+_0x313b39)['json'](_0x594320);}return null;};}function patchUpdates(_0x5f1e22){return function(_0x24202e){try{jsonpatch['apply'](_0x24202e,_0x5f1e22,!![]);}catch(_0x4e1699){return BPromise[_0x60dc('0x1e')](_0x4e1699);}return _0x24202e[_0x60dc('0x1f')]();};}function saveUpdates(_0x438152,_0x228cd6){return function(_0x151aca){if(_0x151aca){return _0x151aca[_0x60dc('0x20')](_0x438152)[_0x60dc('0x21')](function(_0x2e3cca){return _0x2e3cca;});}return null;};}function removeEntity(_0x1de540,_0x3bd6ac){return function(_0x31faab){if(_0x31faab){return _0x31faab['destroy']()[_0x60dc('0x21')](function(){var _0x3b2660=_0x31faab[_0x60dc('0x22')]({'plain':!![]});var _0xa6fedb='MusicOnHolds';return db[_0x60dc('0x23')][_0x60dc('0x24')]({'where':{'type':_0xa6fedb,'resourceId':_0x3b2660['id']}})[_0x60dc('0x21')](function(){return _0x31faab;});})[_0x60dc('0x21')](function(){_0x1de540['status'](0xcc)[_0x60dc('0x17')]();});}};}function handleEntityNotFound(_0x608190,_0x188949){return function(_0x1a149d){if(!_0x1a149d){_0x608190['sendStatus'](0x194);}return _0x1a149d;};}function handleError(_0x416cc5,_0xe84ae6){_0xe84ae6=_0xe84ae6||0x1f4;return function(_0x5b33b1){logger[_0x60dc('0x25')](_0x5b33b1[_0x60dc('0x26')]);if(_0x5b33b1[_0x60dc('0x27')]){delete _0x5b33b1[_0x60dc('0x27')];}_0x416cc5[_0x60dc('0x16')](_0xe84ae6)['send'](_0x5b33b1);};}exports['index']=function(_0x2f727f,_0xb82341){var _0x5be51f={},_0x1eb1ba={},_0x49a94f={'count':0x0,'rows':[]};var _0x346bdc=_[_0x60dc('0x28')](db[_0x60dc('0x29')]['rawAttributes'],function(_0x34c419){return{'name':_0x34c419[_0x60dc('0x2a')],'type':_0x34c419['type']['key']};});_0x1eb1ba[_0x60dc('0x2b')]=_[_0x60dc('0x28')](_0x346bdc,_0x60dc('0x27'));_0x1eb1ba['query']=_[_0x60dc('0x2c')](_0x2f727f[_0x60dc('0x2d')]);_0x1eb1ba[_0x60dc('0x2e')]=_[_0x60dc('0x2f')](_0x1eb1ba[_0x60dc('0x2b')],_0x1eb1ba['query']);_0x5be51f[_0x60dc('0x30')]=_['intersection'](_0x1eb1ba[_0x60dc('0x2b')],qs[_0x60dc('0x31')](_0x2f727f['query'][_0x60dc('0x31')]));_0x5be51f['attributes']=_0x5be51f[_0x60dc('0x30')][_0x60dc('0x32')]?_0x5be51f[_0x60dc('0x30')]:_0x1eb1ba[_0x60dc('0x2b')];if(!_0x2f727f['query'][_0x60dc('0x33')](_0x60dc('0x34'))){_0x5be51f[_0x60dc('0x1a')]=qs[_0x60dc('0x1a')](_0x2f727f[_0x60dc('0x2d')][_0x60dc('0x1a')]);_0x5be51f['offset']=qs[_0x60dc('0x19')](_0x2f727f[_0x60dc('0x2d')][_0x60dc('0x19')]);}_0x5be51f['order']=qs[_0x60dc('0x35')](_0x2f727f[_0x60dc('0x2d')][_0x60dc('0x35')]);delete _0x2f727f[_0x60dc('0x2d')][_0x60dc('0x35')];_0x5be51f[_0x60dc('0x36')]=qs[_0x60dc('0x2e')](_[_0x60dc('0x37')](_0x2f727f[_0x60dc('0x2d')],_0x1eb1ba[_0x60dc('0x2e')]),_0x346bdc);if(_0x2f727f[_0x60dc('0x2d')][_0x60dc('0x38')]){_0x5be51f[_0x60dc('0x36')]=_[_0x60dc('0x39')](_0x5be51f[_0x60dc('0x36')],{'$or':_[_0x60dc('0x28')](_0x346bdc,function(_0x409cd8){if(_0x409cd8[_0x60dc('0x3a')]!==_0x60dc('0x3b')){var _0x3e4bbe={};_0x3e4bbe[_0x409cd8[_0x60dc('0x27')]]={'$like':'%'+_0x2f727f[_0x60dc('0x2d')][_0x60dc('0x38')]+'%'};return _0x3e4bbe;}})});}_0x5be51f=_[_0x60dc('0x39')]({},_0x5be51f,_0x2f727f[_0x60dc('0x3c')]);var _0x1ef046={'where':_0x5be51f[_0x60dc('0x36')]};return db[_0x60dc('0x29')]['count'](_0x1ef046)[_0x60dc('0x21')](function(_0x47119a){_0x49a94f[_0x60dc('0x1c')]=_0x47119a;if(_0x2f727f[_0x60dc('0x2d')][_0x60dc('0x3d')]){_0x5be51f[_0x60dc('0x3e')]=[{'all':!![]}];}return db[_0x60dc('0x29')]['findAll'](_0x5be51f);})[_0x60dc('0x21')](function(_0x4a0ba3){_0x49a94f[_0x60dc('0x3f')]=_0x4a0ba3;return _0x49a94f;})[_0x60dc('0x21')](respondWithFilteredResult(_0xb82341,_0x5be51f))[_0x60dc('0x40')](handleError(_0xb82341,null));};exports[_0x60dc('0x41')]=function(_0x45f539,_0x377163){var _0x2743b6={'raw':![],'where':{'id':_0x45f539[_0x60dc('0x42')]['id']}},_0x577282={};_0x577282[_0x60dc('0x2b')]=_[_0x60dc('0x2c')](db[_0x60dc('0x29')][_0x60dc('0x43')]);_0x577282[_0x60dc('0x2d')]=_[_0x60dc('0x2c')](_0x45f539[_0x60dc('0x2d')]);_0x577282[_0x60dc('0x2e')]=_[_0x60dc('0x2f')](_0x577282[_0x60dc('0x2b')],_0x577282[_0x60dc('0x2d')]);_0x2743b6['attributes']=_[_0x60dc('0x2f')](_0x577282[_0x60dc('0x2b')],qs['fields'](_0x45f539['query'][_0x60dc('0x31')]));_0x2743b6['attributes']=_0x2743b6[_0x60dc('0x30')][_0x60dc('0x32')]?_0x2743b6[_0x60dc('0x30')]:_0x577282['model'];if(_0x45f539[_0x60dc('0x2d')][_0x60dc('0x3d')]){_0x2743b6['include']=[{'all':!![]}];}_0x2743b6=_[_0x60dc('0x39')]({},_0x2743b6,_0x45f539['options']);return db['VoiceMusicOnHold'][_0x60dc('0x44')](_0x2743b6)[_0x60dc('0x21')](handleEntityNotFound(_0x377163,null))[_0x60dc('0x21')](respondWithResult(_0x377163,null))[_0x60dc('0x40')](handleError(_0x377163,null));};exports[_0x60dc('0x20')]=function(_0x11ac36,_0x464e71){if(_0x11ac36[_0x60dc('0x45')]['id']){delete _0x11ac36['body']['id'];}return db[_0x60dc('0x29')][_0x60dc('0x44')]({'where':{'id':_0x11ac36[_0x60dc('0x42')]['id']}})['then'](handleEntityNotFound(_0x464e71,null))['then'](saveUpdates(_0x11ac36[_0x60dc('0x45')],null))['then'](respondWithResult(_0x464e71,null))['catch'](handleError(_0x464e71,null));};exports[_0x60dc('0x46')]=function(_0x461f9e,_0x3128d8,_0x2d7d6e){return db[_0x60dc('0x47')][_0x60dc('0x48')](function(_0xa1f8f5){if(_0x461f9e[_0x60dc('0x45')][_0x60dc('0x49')]===_0x60dc('0x4a')){_0x461f9e['body'][_0x60dc('0x4b')]=path[_0x60dc('0x4c')](config['root'],_0x60dc('0x4d'),_0x461f9e[_0x60dc('0x45')][_0x60dc('0x27')]);}return db['VoiceMusicOnHold'][_0x60dc('0x46')](_0x461f9e[_0x60dc('0x45')],{'transaction':_0xa1f8f5})['then'](function(_0x571a79){if(_0x461f9e[_0x60dc('0x45')][_0x60dc('0x49')]===_0x60dc('0x4a')){fs['mkdirSync'](_0x571a79['directory'],parseInt(_0x60dc('0x4e'),0x8));}var _0x4982f7=_0x461f9e['user'][_0x60dc('0x22')]({'plain':!![]});if(!_0x4982f7)throw new Error(_0x60dc('0x4f'));if(_0x4982f7['role']===_0x60dc('0x50')){var _0x342710=_0x571a79[_0x60dc('0x22')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x60dc('0x51'),'userProfileId':_0x4982f7[_0x60dc('0x52')]},'raw':!![]})[_0x60dc('0x21')](function(_0x3d75d6){if(_0x3d75d6&&_0x3d75d6['autoAssociation']===0x0){return db[_0x60dc('0x23')][_0x60dc('0x46')]({'name':_0x342710[_0x60dc('0x27')],'resourceId':_0x342710['id'],'type':_0x3d75d6[_0x60dc('0x27')],'sectionId':_0x3d75d6['id']},{})[_0x60dc('0x21')](function(){return _0x571a79;});}else{return _0x571a79;}})[_0x60dc('0x40')](function(_0x1ba3a5){logger[_0x60dc('0x25')](_0x60dc('0x53'),_0x1ba3a5);});}return _0x571a79;});})[_0x60dc('0x21')](respondWithResult(_0x3128d8,0xc9))['catch'](handleError(_0x3128d8,null));};exports[_0x60dc('0x24')]=function(_0x5971f6,_0x5c54ab,_0x18b1da){var _0x5a8f49;return db[_0x60dc('0x29')][_0x60dc('0x44')]({'where':{'id':_0x5971f6['params']['id']}})[_0x60dc('0x21')](function(_0x5d75a2){if(_0x5d75a2){return db[_0x60dc('0x47')][_0x60dc('0x48')](function(_0x1259a8){return _0x5d75a2['destroy']({'transaction':_0x1259a8,'raw':!![]})[_0x60dc('0x21')](function(_0x3a8922){if(_0x3a8922[_0x60dc('0x4b')]){fs[_0x60dc('0x54')](_0x3a8922['directory'])[_0x60dc('0x55')](function(_0x57adae){fs[_0x60dc('0x56')](path[_0x60dc('0x4c')](_0x3a8922[_0x60dc('0x4b')],_0x57adae));});fs[_0x60dc('0x57')](_0x3a8922['directory']);}return _0x3a8922;});})[_0x60dc('0x40')](function(_0x3e7546){throw new db[(_0x60dc('0x58'))]['ValidationError'](_0x3e7546['message']);});}})[_0x60dc('0x21')](handleEntityNotFound(_0x5c54ab,null))[_0x60dc('0x21')](removeEntity(_0x5c54ab,null))[_0x60dc('0x40')](handleError(_0x5c54ab,null));};exports['addSound']=function(_0x37f05e,_0x4aa3a0,_0x1883ef){return db[_0x60dc('0x47')]['transaction'](function(_0x4da23a){var _0x57dcc4;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x37f05e[_0x60dc('0x42')]['id']}})[_0x60dc('0x21')](function(_0x57e6c7){if(_0x57e6c7){_0x57dcc4=_0x57e6c7;return _0x57e6c7['addSound'](_0x37f05e[_0x60dc('0x45')]['id'],{'transaction':_0x4da23a});}})[_0x60dc('0x21')](function(_0x44480b){if(_0x44480b){return db[_0x60dc('0x59')][_0x60dc('0x5a')]({'where':{'id':_0x37f05e[_0x60dc('0x45')]['id']},'attributes':['id',_0x60dc('0x27'),'save_name',_0x60dc('0x5b'),_0x60dc('0x5c')],'raw':!![]});}})['then'](function(_0x1d2c54){if(_0x1d2c54){var _0x569dc4=path['join'](config[_0x60dc('0x5d')],_0x60dc('0x5e'),util['format'](_0x60dc('0x5f'),path[_0x60dc('0x60')](_0x1d2c54['save_name'],path[_0x60dc('0x61')](_0x1d2c54[_0x60dc('0x62')])),_0x1d2c54[_0x60dc('0x5b')]));var _0x5a4482=path['join'](config[_0x60dc('0x5d')],_0x60dc('0x4d'),_0x57dcc4[_0x60dc('0x27')],util[_0x60dc('0x63')](_0x60dc('0x5f'),_0x1d2c54['name'],_0x1d2c54[_0x60dc('0x5b')]));fs[_0x60dc('0x64')](_0x569dc4,_0x5a4482);return _0x1d2c54;}})[_0x60dc('0x40')](function(_0x5127a6){throw new db[(_0x60dc('0x58'))]['ValidationError'](_0x5127a6['message']);});})['then'](handleEntityNotFound(_0x4aa3a0,null))['then'](respondWithResult(_0x4aa3a0,0xc9))[_0x60dc('0x40')](handleError(_0x4aa3a0,null));};exports[_0x60dc('0x65')]=function(_0x5cb144,_0x29468f,_0x52f7f1){return db[_0x60dc('0x47')][_0x60dc('0x48')](function(_0x3f752b){var _0x1c871b;return db[_0x60dc('0x29')][_0x60dc('0x5a')]({'where':{'id':_0x5cb144[_0x60dc('0x42')]['id']}})[_0x60dc('0x21')](handleEntityNotFound(_0x29468f,null))[_0x60dc('0x21')](function(_0x339924){if(_0x339924){_0x1c871b=_0x339924;return _0x339924[_0x60dc('0x65')](_0x5cb144[_0x60dc('0x42')][_0x60dc('0x66')]);}})['then'](function(_0x3e2737){if(_0x3e2737){return db[_0x60dc('0x59')][_0x60dc('0x5a')]({'where':{'id':_0x5cb144[_0x60dc('0x42')][_0x60dc('0x66')]},'attributes':['id',_0x60dc('0x27'),_0x60dc('0x62'),'converted_format',_0x60dc('0x5c')],'raw':!![]});}})[_0x60dc('0x21')](function(_0x36686c){if(_0x36686c){fs[_0x60dc('0x56')](path[_0x60dc('0x4c')](_0x1c871b[_0x60dc('0x4b')],util['format'](_0x60dc('0x5f'),_0x36686c['name'],_0x36686c['converted_format'])));return _0x36686c;}})['catch'](function(_0x3c3d94){throw new db['Sequelize'][(_0x60dc('0x67'))](_0x3c3d94[_0x60dc('0x68')]);});})[_0x60dc('0x21')](handleEntityNotFound(_0x29468f,null))[_0x60dc('0x21')](respondWithStatusCode(_0x29468f,0xcc))[_0x60dc('0x40')](handleError(_0x29468f,null));};exports[_0x60dc('0x69')]=function(_0x599dba,_0xf55e7,_0x4f3764){var _0x52cc2a={};var _0x546ca0={};var _0x26b6b8;var _0x59fef9;return db[_0x60dc('0x29')][_0x60dc('0x5a')]({'where':{'id':_0x599dba[_0x60dc('0x42')]['id']}})[_0x60dc('0x21')](handleEntityNotFound(_0xf55e7,null))[_0x60dc('0x21')](function(_0x226480){if(_0x226480){_0x26b6b8=_0x226480;_0x546ca0[_0x60dc('0x2b')]=_[_0x60dc('0x2c')](db[_0x60dc('0x59')][_0x60dc('0x43')]);_0x546ca0[_0x60dc('0x2d')]=_['keys'](_0x599dba[_0x60dc('0x2d')]);_0x546ca0['filters']=_['intersection'](_0x546ca0[_0x60dc('0x2b')],_0x546ca0[_0x60dc('0x2d')]);_0x52cc2a['attributes']=_[_0x60dc('0x2f')](_0x546ca0[_0x60dc('0x2b')],qs[_0x60dc('0x31')](_0x599dba[_0x60dc('0x2d')]['fields']));_0x52cc2a[_0x60dc('0x30')]=_0x52cc2a[_0x60dc('0x30')][_0x60dc('0x32')]?_0x52cc2a['attributes']:_0x546ca0[_0x60dc('0x2b')];_0x52cc2a[_0x60dc('0x6a')]=qs[_0x60dc('0x35')](_0x599dba['query'][_0x60dc('0x35')]);_0x52cc2a[_0x60dc('0x36')]=qs['filters'](_['pick'](_0x599dba[_0x60dc('0x2d')],_0x546ca0[_0x60dc('0x2e')]));if(_0x599dba[_0x60dc('0x2d')][_0x60dc('0x38')]){_0x52cc2a[_0x60dc('0x36')]=_[_0x60dc('0x39')](_0x52cc2a[_0x60dc('0x36')],{'$or':_[_0x60dc('0x28')](_0x52cc2a['attributes'],function(_0x4b5c0c){var _0x1e302c={};_0x1e302c[_0x4b5c0c]={'$like':'%'+_0x599dba['query']['filter']+'%'};return _0x1e302c;})});}_0x52cc2a=_[_0x60dc('0x39')]({},_0x52cc2a,_0x599dba[_0x60dc('0x3c')]);return _0x26b6b8['getSounds'](_0x52cc2a);}})[_0x60dc('0x21')](function(_0x1ea8ef){if(_0x1ea8ef){_0x59fef9=_0x1ea8ef[_0x60dc('0x32')];if(!_0x599dba[_0x60dc('0x2d')][_0x60dc('0x33')](_0x60dc('0x34'))){_0x52cc2a[_0x60dc('0x1a')]=qs[_0x60dc('0x1a')](_0x599dba['query'][_0x60dc('0x1a')]);_0x52cc2a[_0x60dc('0x19')]=qs[_0x60dc('0x19')](_0x599dba[_0x60dc('0x2d')][_0x60dc('0x19')]);}return _0x26b6b8['getSounds'](_0x52cc2a);}})['then'](function(_0x273845){if(_0x273845){return _0x273845?{'count':_0x59fef9,'rows':_0x273845}:null;}})['then'](respondWithResult(_0xf55e7,null))[_0x60dc('0x40')](handleError(_0xf55e7,null));}; \ No newline at end of file +var _0x4024=['VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','body','create','sequelize','mode','files','directory','join','root','mkdirSync','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','transaction','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','basename','extname','%s.%s','symlinkSync','removeSound','id2','getSounds','order','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','MusicOnHolds','UserProfileResource','then','error','name','send','index','map','VoiceMusicOnHold','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge'];(function(_0x3c3460,_0x3dfa0c){var _0x502d08=function(_0x2d19ef){while(--_0x2d19ef){_0x3c3460['push'](_0x3c3460['shift']());}};_0x502d08(++_0x3dfa0c);}(_0x4024,0x173));var _0x4402=function(_0x324afa,_0x279fe6){_0x324afa=_0x324afa-0x0;var _0x22c95a=_0x4024[_0x324afa];return _0x22c95a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4402('0x0'));var rp=require(_0x4402('0x1'));var moment=require(_0x4402('0x2'));var BPromise=require(_0x4402('0x3'));var Mustache=require(_0x4402('0x4'));var util=require(_0x4402('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x4402('0x6'));var ejs=require(_0x4402('0x7'));var fs=require('fs');var fs_extra=require(_0x4402('0x8'));var _=require(_0x4402('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4402('0xa'));var toCsv=require(_0x4402('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4402('0xb'));var authService=require(_0x4402('0xc'));var qs=require(_0x4402('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4402('0xe'))(_0x4402('0xf'));var utils=require('../../config/utils');var config=require(_0x4402('0x10'));var licenseUtil=require(_0x4402('0x11'));var db=require(_0x4402('0x12'))['db'];function respondWithStatusCode(_0x180765,_0x245aea){_0x245aea=_0x245aea||0xcc;return function(_0x37d0cd){if(_0x37d0cd){return _0x180765[_0x4402('0x13')](_0x245aea);}return _0x180765[_0x4402('0x14')](_0x245aea)[_0x4402('0x15')]();};}function respondWithResult(_0x321d26,_0x4d1955){_0x4d1955=_0x4d1955||0xc8;return function(_0x47f9f3){if(_0x47f9f3){return _0x321d26[_0x4402('0x14')](_0x4d1955)[_0x4402('0x16')](_0x47f9f3);}};}function respondWithFilteredResult(_0x2b005c,_0x1adf94){return function(_0x902fa7){if(_0x902fa7){var _0x287daf=typeof _0x1adf94['offset']===_0x4402('0x17')&&typeof _0x1adf94[_0x4402('0x18')]===_0x4402('0x17');var _0x4745f7=_0x902fa7['count'];var _0x3c768d=_0x287daf?0x0:_0x1adf94['offset'];var _0x5f1e33=_0x287daf?_0x902fa7[_0x4402('0x19')]:_0x1adf94[_0x4402('0x1a')]+_0x1adf94[_0x4402('0x18')];var _0x4ef201;if(_0x5f1e33>=_0x4745f7){_0x5f1e33=_0x4745f7;_0x4ef201=0xc8;}else{_0x4ef201=0xce;}_0x2b005c[_0x4402('0x14')](_0x4ef201);return _0x2b005c[_0x4402('0x1b')]('Content-Range',_0x3c768d+'-'+_0x5f1e33+'/'+_0x4745f7)[_0x4402('0x16')](_0x902fa7);}return null;};}function patchUpdates(_0x420616){return function(_0x13314b){try{jsonpatch['apply'](_0x13314b,_0x420616,!![]);}catch(_0x59da89){return BPromise[_0x4402('0x1c')](_0x59da89);}return _0x13314b[_0x4402('0x1d')]();};}function saveUpdates(_0x4310ad,_0x266fde){return function(_0xe32189){if(_0xe32189){return _0xe32189[_0x4402('0x1e')](_0x4310ad)['then'](function(_0x41d118){return _0x41d118;});}return null;};}function removeEntity(_0x13c083,_0x29df60){return function(_0x1cd2ec){if(_0x1cd2ec){return _0x1cd2ec['destroy']()['then'](function(){var _0x1ec96d=_0x1cd2ec['get']({'plain':!![]});var _0x4d5361=_0x4402('0x1f');return db[_0x4402('0x20')]['destroy']({'where':{'type':_0x4d5361,'resourceId':_0x1ec96d['id']}})[_0x4402('0x21')](function(){return _0x1cd2ec;});})['then'](function(){_0x13c083[_0x4402('0x14')](0xcc)[_0x4402('0x15')]();});}};}function handleEntityNotFound(_0x589d3e,_0x5244af){return function(_0x21ac1c){if(!_0x21ac1c){_0x589d3e[_0x4402('0x13')](0x194);}return _0x21ac1c;};}function handleError(_0x5c142d,_0x14ab2a){_0x14ab2a=_0x14ab2a||0x1f4;return function(_0x17e8ce){logger[_0x4402('0x22')](_0x17e8ce['stack']);if(_0x17e8ce[_0x4402('0x23')]){delete _0x17e8ce[_0x4402('0x23')];}_0x5c142d[_0x4402('0x14')](_0x14ab2a)[_0x4402('0x24')](_0x17e8ce);};}exports[_0x4402('0x25')]=function(_0x26aeb3,_0x493657){var _0x5f2dd5={},_0x51a075={},_0x155d80={'count':0x0,'rows':[]};var _0x4a5e87=_[_0x4402('0x26')](db[_0x4402('0x27')][_0x4402('0x28')],function(_0x4a70ab){return{'name':_0x4a70ab['fieldName'],'type':_0x4a70ab[_0x4402('0x29')][_0x4402('0x2a')]};});_0x51a075[_0x4402('0x2b')]=_[_0x4402('0x26')](_0x4a5e87,_0x4402('0x23'));_0x51a075['query']=_['keys'](_0x26aeb3[_0x4402('0x2c')]);_0x51a075['filters']=_[_0x4402('0x2d')](_0x51a075['model'],_0x51a075['query']);_0x5f2dd5['attributes']=_[_0x4402('0x2d')](_0x51a075[_0x4402('0x2b')],qs[_0x4402('0x2e')](_0x26aeb3[_0x4402('0x2c')][_0x4402('0x2e')]));_0x5f2dd5[_0x4402('0x2f')]=_0x5f2dd5[_0x4402('0x2f')][_0x4402('0x30')]?_0x5f2dd5[_0x4402('0x2f')]:_0x51a075[_0x4402('0x2b')];if(!_0x26aeb3[_0x4402('0x2c')][_0x4402('0x31')](_0x4402('0x32'))){_0x5f2dd5[_0x4402('0x18')]=qs['limit'](_0x26aeb3[_0x4402('0x2c')][_0x4402('0x18')]);_0x5f2dd5[_0x4402('0x1a')]=qs[_0x4402('0x1a')](_0x26aeb3[_0x4402('0x2c')]['offset']);}_0x5f2dd5['order']=qs[_0x4402('0x33')](_0x26aeb3[_0x4402('0x2c')][_0x4402('0x33')]);delete _0x26aeb3[_0x4402('0x2c')][_0x4402('0x33')];_0x5f2dd5[_0x4402('0x34')]=qs[_0x4402('0x35')](_[_0x4402('0x36')](_0x26aeb3['query'],_0x51a075['filters']),_0x4a5e87);if(_0x26aeb3[_0x4402('0x2c')][_0x4402('0x37')]){_0x5f2dd5[_0x4402('0x34')]=_[_0x4402('0x38')](_0x5f2dd5[_0x4402('0x34')],{'$or':_['map'](_0x4a5e87,function(_0x2ac133){if(_0x2ac133['type']!==_0x4402('0x39')){var _0x2576f3={};_0x2576f3[_0x2ac133['name']]={'$like':'%'+_0x26aeb3[_0x4402('0x2c')][_0x4402('0x37')]+'%'};return _0x2576f3;}})});}_0x5f2dd5=_[_0x4402('0x38')]({},_0x5f2dd5,_0x26aeb3[_0x4402('0x3a')]);var _0x12d826={'where':_0x5f2dd5[_0x4402('0x34')]};return db[_0x4402('0x27')][_0x4402('0x19')](_0x12d826)[_0x4402('0x21')](function(_0x28b7a9){_0x155d80[_0x4402('0x19')]=_0x28b7a9;if(_0x26aeb3[_0x4402('0x2c')][_0x4402('0x3b')]){_0x5f2dd5[_0x4402('0x3c')]=[{'all':!![]}];}return db[_0x4402('0x27')]['findAll'](_0x5f2dd5);})['then'](function(_0x26334b){_0x155d80[_0x4402('0x3d')]=_0x26334b;return _0x155d80;})[_0x4402('0x21')](respondWithFilteredResult(_0x493657,_0x5f2dd5))[_0x4402('0x3e')](handleError(_0x493657,null));};exports[_0x4402('0x3f')]=function(_0x23ae4a,_0x53621c){var _0x51f4c5={'raw':![],'where':{'id':_0x23ae4a[_0x4402('0x40')]['id']}},_0x508a0e={};_0x508a0e[_0x4402('0x2b')]=_[_0x4402('0x41')](db[_0x4402('0x27')]['rawAttributes']);_0x508a0e['query']=_[_0x4402('0x41')](_0x23ae4a[_0x4402('0x2c')]);_0x508a0e['filters']=_[_0x4402('0x2d')](_0x508a0e[_0x4402('0x2b')],_0x508a0e[_0x4402('0x2c')]);_0x51f4c5['attributes']=_[_0x4402('0x2d')](_0x508a0e['model'],qs[_0x4402('0x2e')](_0x23ae4a[_0x4402('0x2c')][_0x4402('0x2e')]));_0x51f4c5[_0x4402('0x2f')]=_0x51f4c5[_0x4402('0x2f')][_0x4402('0x30')]?_0x51f4c5['attributes']:_0x508a0e[_0x4402('0x2b')];if(_0x23ae4a[_0x4402('0x2c')][_0x4402('0x3b')]){_0x51f4c5[_0x4402('0x3c')]=[{'all':!![]}];}_0x51f4c5=_[_0x4402('0x38')]({},_0x51f4c5,_0x23ae4a[_0x4402('0x3a')]);return db[_0x4402('0x27')][_0x4402('0x42')](_0x51f4c5)['then'](handleEntityNotFound(_0x53621c,null))[_0x4402('0x21')](respondWithResult(_0x53621c,null))[_0x4402('0x3e')](handleError(_0x53621c,null));};exports['update']=function(_0x411199,_0x5d3eac){if(_0x411199[_0x4402('0x43')]['id']){delete _0x411199[_0x4402('0x43')]['id'];}return db[_0x4402('0x27')][_0x4402('0x42')]({'where':{'id':_0x411199['params']['id']}})['then'](handleEntityNotFound(_0x5d3eac,null))['then'](saveUpdates(_0x411199[_0x4402('0x43')],null))[_0x4402('0x21')](respondWithResult(_0x5d3eac,null))['catch'](handleError(_0x5d3eac,null));};exports[_0x4402('0x44')]=function(_0x2c93d8,_0x2b105a,_0x5153e7){return db[_0x4402('0x45')]['transaction'](function(_0x4bea89){if(_0x2c93d8['body'][_0x4402('0x46')]===_0x4402('0x47')){_0x2c93d8[_0x4402('0x43')][_0x4402('0x48')]=path[_0x4402('0x49')](config[_0x4402('0x4a')],'server/files/moh',_0x2c93d8[_0x4402('0x43')][_0x4402('0x23')]);}return db['VoiceMusicOnHold']['create'](_0x2c93d8[_0x4402('0x43')],{'transaction':_0x4bea89})['then'](function(_0x43e6ad){if(_0x2c93d8[_0x4402('0x43')]['mode']===_0x4402('0x47')){fs[_0x4402('0x4b')](_0x43e6ad['directory'],parseInt(_0x4402('0x4c'),0x8));}var _0x27af39=_0x2c93d8[_0x4402('0x4d')][_0x4402('0x4e')]({'plain':!![]});if(!_0x27af39)throw new Error(_0x4402('0x4f'));if(_0x27af39['role']===_0x4402('0x4d')){var _0x5ef4f4=_0x43e6ad[_0x4402('0x4e')]({'plain':!![]});return db['UserProfileSection'][_0x4402('0x42')]({'where':{'name':_0x4402('0x1f'),'userProfileId':_0x27af39[_0x4402('0x50')]},'raw':!![]})['then'](function(_0x486001){if(_0x486001&&_0x486001[_0x4402('0x51')]===0x0){return db[_0x4402('0x20')][_0x4402('0x44')]({'name':_0x5ef4f4[_0x4402('0x23')],'resourceId':_0x5ef4f4['id'],'type':_0x486001['name'],'sectionId':_0x486001['id']},{})[_0x4402('0x21')](function(){return _0x43e6ad;});}else{return _0x43e6ad;}})[_0x4402('0x3e')](function(_0x1cd525){logger[_0x4402('0x22')](_0x4402('0x52'),_0x1cd525);});}return _0x43e6ad;});})['then'](respondWithResult(_0x2b105a,0xc9))[_0x4402('0x3e')](handleError(_0x2b105a,null));};exports[_0x4402('0x53')]=function(_0x22fcfa,_0x5dfe9d,_0x44b2ce){var _0x228394;return db[_0x4402('0x27')][_0x4402('0x42')]({'where':{'id':_0x22fcfa['params']['id']}})[_0x4402('0x21')](function(_0x5cd4aa){if(_0x5cd4aa){return db[_0x4402('0x45')][_0x4402('0x54')](function(_0x25a722){return _0x5cd4aa[_0x4402('0x53')]({'transaction':_0x25a722,'raw':!![]})[_0x4402('0x21')](function(_0x378d59){if(_0x378d59[_0x4402('0x48')]){fs['readdirSync'](_0x378d59[_0x4402('0x48')])[_0x4402('0x55')](function(_0x1d386b){fs[_0x4402('0x56')](path[_0x4402('0x49')](_0x378d59[_0x4402('0x48')],_0x1d386b));});fs[_0x4402('0x57')](_0x378d59[_0x4402('0x48')]);}return _0x378d59;});})[_0x4402('0x3e')](function(_0x22a642){throw new db[(_0x4402('0x58'))][(_0x4402('0x59'))](_0x22a642[_0x4402('0x5a')]);});}})[_0x4402('0x21')](handleEntityNotFound(_0x5dfe9d,null))[_0x4402('0x21')](removeEntity(_0x5dfe9d,null))[_0x4402('0x3e')](handleError(_0x5dfe9d,null));};exports['addSound']=function(_0x28b6a7,_0xc15c13,_0x2ec5c6){return db[_0x4402('0x45')][_0x4402('0x54')](function(_0x37db01){var _0x2eed3c;return db[_0x4402('0x27')][_0x4402('0x42')]({'where':{'id':_0x28b6a7['params']['id']}})[_0x4402('0x21')](function(_0x1d7b2c){if(_0x1d7b2c){_0x2eed3c=_0x1d7b2c;return _0x1d7b2c[_0x4402('0x5b')](_0x28b6a7[_0x4402('0x43')]['id'],{'transaction':_0x37db01});}})[_0x4402('0x21')](function(_0x558d36){if(_0x558d36){return db[_0x4402('0x5c')][_0x4402('0x5d')]({'where':{'id':_0x28b6a7['body']['id']},'attributes':['id',_0x4402('0x23'),_0x4402('0x5e'),_0x4402('0x5f'),_0x4402('0x60')],'raw':!![]});}})[_0x4402('0x21')](function(_0x13c8f4){if(_0x13c8f4){var _0x1abcca=path[_0x4402('0x49')](config[_0x4402('0x4a')],_0x4402('0x61'),util[_0x4402('0x62')]('%s.%s',path[_0x4402('0x63')](_0x13c8f4[_0x4402('0x5e')],path[_0x4402('0x64')](_0x13c8f4[_0x4402('0x5e')])),_0x13c8f4[_0x4402('0x5f')]));var _0x381631=path['join'](config[_0x4402('0x4a')],'server/files/moh',_0x2eed3c[_0x4402('0x23')],util[_0x4402('0x62')](_0x4402('0x65'),_0x13c8f4[_0x4402('0x23')],_0x13c8f4[_0x4402('0x5f')]));fs[_0x4402('0x66')](_0x1abcca,_0x381631);return _0x13c8f4;}})[_0x4402('0x3e')](function(_0x5525d7){throw new db[(_0x4402('0x58'))][(_0x4402('0x59'))](_0x5525d7[_0x4402('0x5a')]);});})['then'](handleEntityNotFound(_0xc15c13,null))[_0x4402('0x21')](respondWithResult(_0xc15c13,0xc9))[_0x4402('0x3e')](handleError(_0xc15c13,null));};exports[_0x4402('0x67')]=function(_0xe74323,_0x44c1cb,_0x346693){return db[_0x4402('0x45')][_0x4402('0x54')](function(_0x37fe09){var _0x282809;return db[_0x4402('0x27')]['findOne']({'where':{'id':_0xe74323['params']['id']}})[_0x4402('0x21')](handleEntityNotFound(_0x44c1cb,null))[_0x4402('0x21')](function(_0x40325a){if(_0x40325a){_0x282809=_0x40325a;return _0x40325a[_0x4402('0x67')](_0xe74323[_0x4402('0x40')][_0x4402('0x68')]);}})['then'](function(_0x527d04){if(_0x527d04){return db[_0x4402('0x5c')][_0x4402('0x5d')]({'where':{'id':_0xe74323[_0x4402('0x40')][_0x4402('0x68')]},'attributes':['id','name',_0x4402('0x5e'),_0x4402('0x5f'),_0x4402('0x60')],'raw':!![]});}})[_0x4402('0x21')](function(_0x442718){if(_0x442718){fs[_0x4402('0x56')](path[_0x4402('0x49')](_0x282809[_0x4402('0x48')],util[_0x4402('0x62')]('%s.%s',_0x442718['name'],_0x442718[_0x4402('0x5f')])));return _0x442718;}})['catch'](function(_0x27dc1c){throw new db[(_0x4402('0x58'))][(_0x4402('0x59'))](_0x27dc1c[_0x4402('0x5a')]);});})[_0x4402('0x21')](handleEntityNotFound(_0x44c1cb,null))[_0x4402('0x21')](respondWithStatusCode(_0x44c1cb,0xcc))[_0x4402('0x3e')](handleError(_0x44c1cb,null));};exports[_0x4402('0x69')]=function(_0xd97252,_0x491a45,_0x254463){var _0x58cd09={};var _0x1b5e9f={};var _0x7051bc;var _0x4cf032;return db[_0x4402('0x27')][_0x4402('0x5d')]({'where':{'id':_0xd97252[_0x4402('0x40')]['id']}})[_0x4402('0x21')](handleEntityNotFound(_0x491a45,null))[_0x4402('0x21')](function(_0x165e5b){if(_0x165e5b){_0x7051bc=_0x165e5b;_0x1b5e9f[_0x4402('0x2b')]=_[_0x4402('0x41')](db[_0x4402('0x5c')][_0x4402('0x28')]);_0x1b5e9f[_0x4402('0x2c')]=_[_0x4402('0x41')](_0xd97252[_0x4402('0x2c')]);_0x1b5e9f[_0x4402('0x35')]=_[_0x4402('0x2d')](_0x1b5e9f[_0x4402('0x2b')],_0x1b5e9f[_0x4402('0x2c')]);_0x58cd09[_0x4402('0x2f')]=_[_0x4402('0x2d')](_0x1b5e9f[_0x4402('0x2b')],qs['fields'](_0xd97252['query']['fields']));_0x58cd09[_0x4402('0x2f')]=_0x58cd09['attributes'][_0x4402('0x30')]?_0x58cd09[_0x4402('0x2f')]:_0x1b5e9f[_0x4402('0x2b')];_0x58cd09[_0x4402('0x6a')]=qs[_0x4402('0x33')](_0xd97252[_0x4402('0x2c')][_0x4402('0x33')]);_0x58cd09['where']=qs[_0x4402('0x35')](_['pick'](_0xd97252[_0x4402('0x2c')],_0x1b5e9f[_0x4402('0x35')]));if(_0xd97252['query']['filter']){_0x58cd09[_0x4402('0x34')]=_[_0x4402('0x38')](_0x58cd09['where'],{'$or':_[_0x4402('0x26')](_0x58cd09[_0x4402('0x2f')],function(_0x1f0225){var _0x558515={};_0x558515[_0x1f0225]={'$like':'%'+_0xd97252['query'][_0x4402('0x37')]+'%'};return _0x558515;})});}_0x58cd09=_[_0x4402('0x38')]({},_0x58cd09,_0xd97252[_0x4402('0x3a')]);return _0x7051bc[_0x4402('0x69')](_0x58cd09);}})[_0x4402('0x21')](function(_0x43eade){if(_0x43eade){_0x4cf032=_0x43eade[_0x4402('0x30')];if(!_0xd97252[_0x4402('0x2c')]['hasOwnProperty'](_0x4402('0x32'))){_0x58cd09[_0x4402('0x18')]=qs[_0x4402('0x18')](_0xd97252['query'][_0x4402('0x18')]);_0x58cd09[_0x4402('0x1a')]=qs[_0x4402('0x1a')](_0xd97252[_0x4402('0x2c')][_0x4402('0x1a')]);}return _0x7051bc[_0x4402('0x69')](_0x58cd09);}})['then'](function(_0x2dcb7d){if(_0x2dcb7d){return _0x2dcb7d?{'count':_0x4cf032,'rows':_0x2dcb7d}:null;}})[_0x4402('0x21')](respondWithResult(_0x491a45,null))['catch'](handleError(_0x491a45,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 3b6a1e9..c3fb22a 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 _0x5282=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','lodash','../../config/logger','api'];(function(_0xa818e3,_0x4f7563){var _0x1ce31a=function(_0x489338){while(--_0x489338){_0xa818e3['push'](_0xa818e3['shift']());}};_0x1ce31a(++_0x4f7563);}(_0x5282,0x111));var _0x2528=function(_0x28509b,_0x5831ff){_0x28509b=_0x28509b-0x0;var _0x1e0b6=_0x5282[_0x28509b];return _0x1e0b6;};'use strict';var _=require(_0x2528('0x0'));var util=require('util');var logger=require(_0x2528('0x1'))(_0x2528('0x2'));var moment=require(_0x2528('0x3'));var BPromise=require(_0x2528('0x4'));var rp=require(_0x2528('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2528('0x6'));var config=require(_0x2528('0x7'));var attributes=require(_0x2528('0x8'));module[_0x2528('0x9')]=function(_0x266084,_0x1f51f9){return _0x266084[_0x2528('0xa')](_0x2528('0xb'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc29=['../../config/environment','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x5b765d,_0x191380){var _0x44ea34=function(_0x5161a9){while(--_0x5161a9){_0x5b765d['push'](_0x5b765d['shift']());}};_0x44ea34(++_0x191380);}(_0xbc29,0x1de));var _0x9bc2=function(_0x32e35e,_0x528101){_0x32e35e=_0x32e35e-0x0;var _0x4c9768=_0xbc29[_0x32e35e];return _0x4c9768;};'use strict';var _=require('lodash');var util=require(_0x9bc2('0x0'));var logger=require(_0x9bc2('0x1'))(_0x9bc2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9bc2('0x3'));var fs=require('fs');var path=require(_0x9bc2('0x4'));var rimraf=require(_0x9bc2('0x5'));var config=require(_0x9bc2('0x6'));var attributes=require(_0x9bc2('0x7'));module[_0x9bc2('0x8')]=function(_0x3ce731,_0x2ca3ed){return _0x3ce731[_0x9bc2('0x9')]('VoiceMusicOnHold',attributes,{'tableName':_0x9bc2('0xa'),'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 ae90bbf..7d74009 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3fde10,_0x52b984){var _0x4769d0=function(_0x144689){while(--_0x144689){_0x3fde10['push'](_0x3fde10['shift']());}};_0x4769d0(++_0x52b984);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3bbad6,_0x100c43){var _0x3ba426=function(_0x2f4009){while(--_0x2f4009){_0x3bbad6['push'](_0x3bbad6['shift']());}};_0x3ba426(++_0x100c43);}(_0x70e0,0x17b));var _0x070e=function(_0x31c834,_0x15272b){_0x31c834=_0x31c834-0x0;var _0x29be9d=_0x70e0[_0x31c834];return _0x29be9d;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 4ba2c25..55ee243 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 _0x6108=['/:id/teams','getTeams','post','addAgents','update','destroy','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/users','getAgents'];(function(_0x7f6e9,_0x2cf772){var _0x5a3124=function(_0x4d1156){while(--_0x4d1156){_0x7f6e9['push'](_0x7f6e9['shift']());}};_0x5a3124(++_0x2cf772);}(_0x6108,0xbc));var _0x8610=function(_0x4ea9de,_0x2e52f0){_0x4ea9de=_0x4ea9de-0x0;var _0x26b69e=_0x6108[_0x4ea9de];return _0x26b69e;};'use strict';var multer=require(_0x8610('0x0'));var util=require('util');var path=require(_0x8610('0x1'));var timeout=require(_0x8610('0x2'));var express=require(_0x8610('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8610('0x4'));var interaction=require(_0x8610('0x5'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0x8610('0x6')]('/',auth[_0x8610('0x7')](),controller[_0x8610('0x8')]);router[_0x8610('0x6')]('/describe',auth[_0x8610('0x7')](),controller['describe']);router[_0x8610('0x6')](_0x8610('0x9'),auth[_0x8610('0x7')](),controller['show']);router[_0x8610('0x6')](_0x8610('0xa'),auth[_0x8610('0x7')](),controller[_0x8610('0xb')]);router[_0x8610('0x6')](_0x8610('0xc'),auth['isAuthenticated'](),controller[_0x8610('0xd')]);router[_0x8610('0xe')]('/',auth[_0x8610('0x7')](),controller['create']);router[_0x8610('0xe')]('/:id/users',auth[_0x8610('0x7')](),controller[_0x8610('0xf')]);router[_0x8610('0xe')](_0x8610('0xc'),auth[_0x8610('0x7')](),controller['addTeams']);router['put'](_0x8610('0x9'),auth[_0x8610('0x7')](),controller[_0x8610('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8610('0x11')]);router[_0x8610('0x12')](_0x8610('0xa'),auth[_0x8610('0x7')](),controller['removeAgents']);router['delete'](_0x8610('0xc'),auth['isAuthenticated'](),controller['removeTeams']);module[_0x8610('0x13')]=router; \ No newline at end of file +var _0x6f49=['connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','create','post','addAgents','update','delete','removeAgents','removeTeams','util','path'];(function(_0x192ca0,_0x218c57){var _0x2f4c40=function(_0x41bf55){while(--_0x41bf55){_0x192ca0['push'](_0x192ca0['shift']());}};_0x2f4c40(++_0x218c57);}(_0x6f49,0xa6));var _0x96f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f49[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x96f4('0x0'));var path=require(_0x96f4('0x1'));var timeout=require(_0x96f4('0x2'));var express=require(_0x96f4('0x3'));var router=express[_0x96f4('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x96f4('0x5'));var controller=require('./voicePrefix.controller');router[_0x96f4('0x6')]('/',auth[_0x96f4('0x7')](),controller[_0x96f4('0x8')]);router['get'](_0x96f4('0x9'),auth[_0x96f4('0x7')](),controller[_0x96f4('0xa')]);router[_0x96f4('0x6')](_0x96f4('0xb'),auth[_0x96f4('0x7')](),controller[_0x96f4('0xc')]);router[_0x96f4('0x6')](_0x96f4('0xd'),auth['isAuthenticated'](),controller[_0x96f4('0xe')]);router[_0x96f4('0x6')](_0x96f4('0xf'),auth[_0x96f4('0x7')](),controller[_0x96f4('0x10')]);router['post']('/',auth[_0x96f4('0x7')](),controller[_0x96f4('0x11')]);router[_0x96f4('0x12')]('/:id/users',auth[_0x96f4('0x7')](),controller[_0x96f4('0x13')]);router[_0x96f4('0x12')](_0x96f4('0xf'),auth['isAuthenticated'](),controller['addTeams']);router['put'](_0x96f4('0xb'),auth[_0x96f4('0x7')](),controller[_0x96f4('0x14')]);router[_0x96f4('0x15')](_0x96f4('0xb'),auth[_0x96f4('0x7')](),controller['destroy']);router[_0x96f4('0x15')](_0x96f4('0xd'),auth[_0x96f4('0x7')](),controller[_0x96f4('0x16')]);router['delete'](_0x96f4('0xf'),auth[_0x96f4('0x7')](),controller[_0x96f4('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 793a076..c839e7c 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 _0xedc8=['getDataValue','name','INTEGER','sequelize','exports','STRING','system-'];(function(_0x2cb622,_0x493492){var _0x56f480=function(_0x3cfd50){while(--_0x3cfd50){_0x2cb622['push'](_0x2cb622['shift']());}};_0x56f480(++_0x493492);}(_0xedc8,0x129));var _0x8edc=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0xedc8[_0x39e283];return _0x7de89f;};'use strict';var Sequelize=require(_0x8edc('0x0'));module[_0x8edc('0x1')]={'name':{'type':Sequelize[_0x8edc('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x248df3){return _0x8edc('0x3')+this[_0x8edc('0x4')](_0x8edc('0x5'))+'-';}},'description':{'type':Sequelize[_0x8edc('0x2')]},'callerIdAll':{'type':Sequelize[_0x8edc('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x8edc('0x6')]}}; \ No newline at end of file +var _0xcbed=['sequelize','STRING','name','VIRTUAL','system-','getDataValue','INTEGER'];(function(_0x4bea61,_0x1cb615){var _0x55031b=function(_0x1b4d0b){while(--_0x1b4d0b){_0x4bea61['push'](_0x4bea61['shift']());}};_0x55031b(++_0x1cb615);}(_0xcbed,0x9a));var _0xdcbe=function(_0x2134e5,_0x30f20b){_0x2134e5=_0x2134e5-0x0;var _0x3ccec2=_0xcbed[_0x2134e5];return _0x3ccec2;};'use strict';var Sequelize=require(_0xdcbe('0x0'));module['exports']={'name':{'type':Sequelize[_0xdcbe('0x1')],'allowNull':![],'unique':_0xdcbe('0x2')},'prefix':{'type':Sequelize[_0xdcbe('0x3')],'get':function(_0x785f92){return _0xdcbe('0x4')+this[_0xdcbe('0x5')](_0xdcbe('0x2'))+'-';}},'description':{'type':Sequelize[_0xdcbe('0x1')]},'callerIdAll':{'type':Sequelize[_0xdcbe('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xdcbe('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index d1301b7..7df6d80 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 _0xfff0=['moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./voicePrefix.socket','register','status','json','offset','undefined','limit','set','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','sendStatus','error','stack','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','include','findAll','rows','show','params','includeAll','options','find','catch','describe','create','sequelize','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','transaction','findById','addAgents','ids','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','findOne','User','getAgents','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','each','upsert','UserVoicePrefix','findOrCreate','select','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','all','value','removeTeams','isEmpty','rimraf','zip-dir','fast-json-patch'];(function(_0x32cefe,_0x1befba){var _0x283e79=function(_0x1609f1){while(--_0x1609f1){_0x32cefe['push'](_0x32cefe['shift']());}};_0x283e79(++_0x1befba);}(_0xfff0,0x139));var _0x0fff=function(_0x228f8c,_0x169c6d){_0x228f8c=_0x228f8c-0x0;var _0x1742e8=_0xfff0[_0x228f8c];return _0x1742e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fff('0x0'));var zipdir=require(_0x0fff('0x1'));var jsonpatch=require(_0x0fff('0x2'));var rp=require('request-promise');var moment=require(_0x0fff('0x3'));var BPromise=require(_0x0fff('0x4'));var Mustache=require(_0x0fff('0x5'));var util=require('util');var path=require(_0x0fff('0x6'));var sox=require(_0x0fff('0x7'));var csv=require('to-csv');var ejs=require(_0x0fff('0x8'));var fs=require('fs');var fs_extra=require(_0x0fff('0x9'));var _=require(_0x0fff('0xa'));var squel=require('squel');var crypto=require(_0x0fff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0fff('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0fff('0xd'));var Papa=require(_0x0fff('0xe'));var Redis=require('ioredis');var authService=require(_0x0fff('0xf'));var qs=require(_0x0fff('0x10'));var as=require(_0x0fff('0x11'));var hardwareService=require(_0x0fff('0x12'));var logger=require(_0x0fff('0x13'))(_0x0fff('0x14'));var utils=require(_0x0fff('0x15'));var config=require(_0x0fff('0x16'));var licenseUtil=require(_0x0fff('0x17'));var db=require(_0x0fff('0x18'))['db'];config[_0x0fff('0x19')]=_['defaults'](config[_0x0fff('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x0fff('0x1a'))(new Redis(config[_0x0fff('0x19')]));require(_0x0fff('0x1b'))[_0x0fff('0x1c')](socket);function respondWithStatusCode(_0x55e5fa,_0x53bde9){_0x53bde9=_0x53bde9||0xcc;return function(_0x1daf30){if(_0x1daf30){return _0x55e5fa['sendStatus'](_0x53bde9);}return _0x55e5fa['status'](_0x53bde9)['end']();};}function respondWithResult(_0x1fb430,_0x41e2e7){_0x41e2e7=_0x41e2e7||0xc8;return function(_0x5eab2e){if(_0x5eab2e){return _0x1fb430[_0x0fff('0x1d')](_0x41e2e7)[_0x0fff('0x1e')](_0x5eab2e);}};}function respondWithFilteredResult(_0x540a67,_0x528071){return function(_0x48f36d){if(_0x48f36d){var _0x2337f=typeof _0x528071[_0x0fff('0x1f')]===_0x0fff('0x20')&&typeof _0x528071[_0x0fff('0x21')]===_0x0fff('0x20');var _0xe89b4a=_0x48f36d['count'];var _0x44a54a=_0x2337f?0x0:_0x528071[_0x0fff('0x1f')];var _0x48e6f9=_0x2337f?_0x48f36d['count']:_0x528071['offset']+_0x528071[_0x0fff('0x21')];var _0x330e29;if(_0x48e6f9>=_0xe89b4a){_0x48e6f9=_0xe89b4a;_0x330e29=0xc8;}else{_0x330e29=0xce;}_0x540a67[_0x0fff('0x1d')](_0x330e29);return _0x540a67[_0x0fff('0x22')]('Content-Range',_0x44a54a+'-'+_0x48e6f9+'/'+_0xe89b4a)[_0x0fff('0x1e')](_0x48f36d);}return null;};}function patchUpdates(_0x2f8665){return function(_0x29d703){try{jsonpatch[_0x0fff('0x23')](_0x29d703,_0x2f8665,!![]);}catch(_0x16e7f4){return BPromise[_0x0fff('0x24')](_0x16e7f4);}return _0x29d703['save']();};}function saveUpdates(_0x6a116c,_0x29f702){return function(_0x37e090){if(_0x37e090){return _0x37e090[_0x0fff('0x25')](_0x6a116c)[_0x0fff('0x26')](function(_0x23d9f8){return _0x23d9f8;});}return null;};}function removeEntity(_0x482e1e,_0x2c9725){return function(_0x87b3a6){if(_0x87b3a6){return _0x87b3a6[_0x0fff('0x27')]()[_0x0fff('0x26')](function(){var _0x36d268=_0x87b3a6[_0x0fff('0x28')]({'plain':!![]});var _0x27bd76=_0x0fff('0x29');return db[_0x0fff('0x2a')][_0x0fff('0x27')]({'where':{'type':_0x27bd76,'resourceId':_0x36d268['id']}})[_0x0fff('0x26')](function(){return _0x87b3a6;});})[_0x0fff('0x26')](function(){_0x482e1e['status'](0xcc)[_0x0fff('0x2b')]();});}};}function handleEntityNotFound(_0x2d1800,_0x17ab6f){return function(_0x42441e){if(!_0x42441e){_0x2d1800[_0x0fff('0x2c')](0x194);}return _0x42441e;};}function handleError(_0x125844,_0x47dde0){_0x47dde0=_0x47dde0||0x1f4;return function(_0x31f9a4){logger[_0x0fff('0x2d')](_0x31f9a4[_0x0fff('0x2e')]);if(_0x31f9a4['name']){delete _0x31f9a4[_0x0fff('0x2f')];}_0x125844[_0x0fff('0x1d')](_0x47dde0)['send'](_0x31f9a4);};}exports[_0x0fff('0x30')]=function(_0x433de6,_0x15bb46){var _0x15ae24={},_0x25ab2a={},_0x263e9e={'count':0x0,'rows':[]};var _0x1da352=_[_0x0fff('0x31')](db[_0x0fff('0x32')][_0x0fff('0x33')],function(_0x58469b){return{'name':_0x58469b[_0x0fff('0x34')],'type':_0x58469b[_0x0fff('0x35')][_0x0fff('0x36')]};});_0x25ab2a[_0x0fff('0x37')]=_[_0x0fff('0x31')](_0x1da352,'name');_0x25ab2a['query']=_[_0x0fff('0x38')](_0x433de6[_0x0fff('0x39')]);_0x25ab2a[_0x0fff('0x3a')]=_[_0x0fff('0x3b')](_0x25ab2a['model'],_0x25ab2a[_0x0fff('0x39')]);_0x15ae24[_0x0fff('0x3c')]=_[_0x0fff('0x3b')](_0x25ab2a[_0x0fff('0x37')],qs['fields'](_0x433de6[_0x0fff('0x39')][_0x0fff('0x3d')]));_0x15ae24[_0x0fff('0x3c')]=_0x15ae24[_0x0fff('0x3c')][_0x0fff('0x3e')]?_0x15ae24[_0x0fff('0x3c')]:_0x25ab2a[_0x0fff('0x37')];if(!_0x433de6[_0x0fff('0x39')][_0x0fff('0x3f')](_0x0fff('0x40'))){_0x15ae24[_0x0fff('0x21')]=qs[_0x0fff('0x21')](_0x433de6['query'][_0x0fff('0x21')]);_0x15ae24[_0x0fff('0x1f')]=qs[_0x0fff('0x1f')](_0x433de6[_0x0fff('0x39')][_0x0fff('0x1f')]);}_0x15ae24[_0x0fff('0x41')]=qs['sort'](_0x433de6[_0x0fff('0x39')][_0x0fff('0x42')]);_0x15ae24[_0x0fff('0x43')]=qs[_0x0fff('0x3a')](_[_0x0fff('0x44')](_0x433de6[_0x0fff('0x39')],_0x25ab2a[_0x0fff('0x3a')]),_0x1da352);if(_0x433de6[_0x0fff('0x39')][_0x0fff('0x45')]){_0x15ae24['where']=_[_0x0fff('0x46')](_0x15ae24['where'],{'$or':_[_0x0fff('0x31')](_0x1da352,function(_0x30f329){if(_0x30f329[_0x0fff('0x35')]!=='VIRTUAL'){var _0x5d4c24={};_0x5d4c24[_0x30f329[_0x0fff('0x2f')]]={'$like':'%'+_0x433de6[_0x0fff('0x39')][_0x0fff('0x45')]+'%'};return _0x5d4c24;}})});}_0x15ae24=_['merge']({},_0x15ae24,_0x433de6['options']);var _0x4668b3={'where':_0x15ae24['where']};return db[_0x0fff('0x32')][_0x0fff('0x47')](_0x4668b3)[_0x0fff('0x26')](function(_0x309d75){_0x263e9e[_0x0fff('0x47')]=_0x309d75;if(_0x433de6[_0x0fff('0x39')]['includeAll']){_0x15ae24[_0x0fff('0x48')]=[{'all':!![]}];}return db[_0x0fff('0x32')][_0x0fff('0x49')](_0x15ae24);})[_0x0fff('0x26')](function(_0x7157e5){_0x263e9e[_0x0fff('0x4a')]=_0x7157e5;return _0x263e9e;})[_0x0fff('0x26')](respondWithFilteredResult(_0x15bb46,_0x15ae24))['catch'](handleError(_0x15bb46,null));};exports[_0x0fff('0x4b')]=function(_0x244a27,_0x101b3a){var _0x56a121={'raw':![],'where':{'id':_0x244a27[_0x0fff('0x4c')]['id']}},_0x2de540={};_0x2de540[_0x0fff('0x37')]=_[_0x0fff('0x38')](db[_0x0fff('0x32')][_0x0fff('0x33')]);_0x2de540[_0x0fff('0x39')]=_[_0x0fff('0x38')](_0x244a27[_0x0fff('0x39')]);_0x2de540[_0x0fff('0x3a')]=_[_0x0fff('0x3b')](_0x2de540['model'],_0x2de540[_0x0fff('0x39')]);_0x56a121[_0x0fff('0x3c')]=_['intersection'](_0x2de540[_0x0fff('0x37')],qs[_0x0fff('0x3d')](_0x244a27[_0x0fff('0x39')]['fields']));_0x56a121['attributes']=_0x56a121[_0x0fff('0x3c')]['length']?_0x56a121['attributes']:_0x2de540[_0x0fff('0x37')];if(_0x244a27[_0x0fff('0x39')][_0x0fff('0x4d')]){_0x56a121[_0x0fff('0x48')]=[{'all':!![]}];}_0x56a121=_[_0x0fff('0x46')]({},_0x56a121,_0x244a27[_0x0fff('0x4e')]);return db['VoicePrefix'][_0x0fff('0x4f')](_0x56a121)[_0x0fff('0x26')](handleEntityNotFound(_0x101b3a,null))[_0x0fff('0x26')](respondWithResult(_0x101b3a,null))[_0x0fff('0x50')](handleError(_0x101b3a,null));};exports[_0x0fff('0x27')]=function(_0x2c725c,_0x5d1739){return db[_0x0fff('0x32')][_0x0fff('0x4f')]({'where':{'id':_0x2c725c['params']['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x5d1739,null))['then'](removeEntity(_0x5d1739,null))['catch'](handleError(_0x5d1739,null));};exports['describe']=function(_0x218e1c,_0x30967c){return db[_0x0fff('0x32')][_0x0fff('0x51')]()[_0x0fff('0x26')](respondWithResult(_0x30967c,null))['catch'](handleError(_0x30967c,null));};exports[_0x0fff('0x52')]=function(_0x2c765f,_0x2cbe43){var _0x3b6c98;return db[_0x0fff('0x53')]['transaction'](function(_0x3b401c){return db[_0x0fff('0x32')][_0x0fff('0x52')](_0x2c765f[_0x0fff('0x54')],{'transaction':_0x3b401c})[_0x0fff('0x26')](function(_0x2e8242){_0x3b6c98=_0x2e8242[_0x0fff('0x28')]({'plain':!![]});return db[_0x0fff('0x55')][_0x0fff('0x4f')]({'where':{'id':_0x3b6c98[_0x0fff('0x56')]},'raw':!![]})[_0x0fff('0x26')](function(_0x38168e){return createVoicePrefixExtensions(_0x3b6c98,_0x38168e,_0x3b401c);});});})[_0x0fff('0x26')](function(){var _0x2608be=_0x2c765f[_0x0fff('0x57')][_0x0fff('0x28')]({'plain':!![]});if(!_0x2608be)throw new Error(_0x0fff('0x58'));if(_0x2608be[_0x0fff('0x59')]===_0x0fff('0x57')){var _0x398513=_0x3b6c98;return db[_0x0fff('0x5a')]['find']({'where':{'name':_0x0fff('0x29'),'userProfileId':_0x2608be[_0x0fff('0x5b')]},'raw':!![]})[_0x0fff('0x26')](function(_0x2744b4){if(_0x2744b4&&_0x2744b4['autoAssociation']===0x0){return db[_0x0fff('0x2a')]['create']({'name':_0x398513[_0x0fff('0x2f')],'resourceId':_0x398513['id'],'type':_0x2744b4[_0x0fff('0x2f')],'sectionId':_0x2744b4['id']},{})[_0x0fff('0x26')](function(){return _0x3b6c98;});}else{return _0x3b6c98;}})[_0x0fff('0x50')](function(_0x4bf865){logger[_0x0fff('0x2d')](_0x0fff('0x5c'),_0x4bf865);throw _0x4bf865;});}return _0x3b6c98;})[_0x0fff('0x26')](respondWithResult(_0x2cbe43,null))[_0x0fff('0x50')](handleError(_0x2cbe43,null));};function Extension(_0x4cf619,_0x5ba7e7,_0x449da4,_0x40b8f0){this[_0x0fff('0x5d')]=_0x0fff('0x5e');this[_0x0fff('0x5f')]=_0x4cf619;this[_0x0fff('0x60')]=_0x449da4;this['type']='system';this[_0x0fff('0x61')]=_0x0fff('0x62');this[_0x0fff('0x63')]=_0x5ba7e7;this[_0x0fff('0x64')]=_0x40b8f0;}function createVoicePrefixExtensions(_0x28403f,_0x6a37c9,_0x33eb07){return new BPromise(function(_0x40e5ec,_0x5f2fcc){var _0x12fe95=new Extension(formatPrefixName(_0x28403f['prefix']),0x1,_0x0fff('0x65'),_0x0fff('0x66'));_0x12fe95[_0x0fff('0x67')]=_0x28403f['id'];return db['VoiceExtension']['create'](_0x12fe95,{'transaction':_0x33eb07})[_0x0fff('0x26')](function(_0x504212){var _0x140a35=_0x504212[_0x0fff('0x28')]({'plain':!![]});var _0x452160=_[_0x0fff('0x31')](addVoicePrefixExtensions(_0x28403f,_0x6a37c9),function(_0x4e3a31){_0x4e3a31[_0x0fff('0x56')]=_0x140a35['id'];_0x4e3a31[_0x0fff('0x67')]=_0x28403f['id'];return _0x4e3a31;});return db['VoiceExtension'][_0x0fff('0x68')](_0x452160,{'transaction':_0x33eb07})[_0x0fff('0x26')](function(_0x1111c8){if(!_0x1111c8){return _0x5f2fcc('Extensions\x20creation\x20failed');}else{return _0x40e5ec(_0x1111c8);}})[_0x0fff('0x50')](function(_0x1dc3d6){return _0x5f2fcc(_0x1dc3d6);});});;});};function addVoicePrefixExtensions(_0x1414af,_0x383d78){var _0x3bb183=[];var _0xf4fb1e=formatPrefixName(_0x1414af[_0x0fff('0x69')]);_0x3bb183[_0x0fff('0x6a')](new Extension(_0xf4fb1e,0x2,_0x0fff('0x6b'),_0x0fff('0x6c')+_0x1414af[_0x0fff('0x2f')]));if(_0x1414af[_0x0fff('0x6d')]){_0x3bb183['push'](new Extension(_0xf4fb1e,0x3,'Set',_0x0fff('0x6e')+_0x1414af['callerIdAll']));}else{_0x3bb183['push'](new Extension(_0xf4fb1e,0x3,_0x0fff('0x65'),_0x0fff('0x6f')));}_0x3bb183[_0x0fff('0x6a')](new Extension(_0xf4fb1e,0x4,'goto',_0x383d78['context']+','+_0x0fff('0x70')+(0x8+_0x1414af[_0x0fff('0x2f')][_0x0fff('0x3e')])+'}'+','+0x1));return _0x3bb183;}function formatPrefixName(_0x2586c6){var _0x5af278='_';for(var _0x2f865a=0x0;_0x2f865a<_0x2586c6[_0x0fff('0x3e')];_0x2f865a++){if(_0x2586c6[_0x0fff('0x71')](_0x2f865a)=='-'){_0x5af278+=_0x2586c6[_0x0fff('0x71')](_0x2f865a);}else{_0x5af278+='['+_0x2586c6['charAt'](_0x2f865a)+']';}}_0x5af278+='.';return _0x5af278;}exports[_0x0fff('0x25')]=function(_0x1858fb,_0x4c08c3,_0x51fbf5){var _0x33ed23=_0x1858fb[_0x0fff('0x54')];_0x33ed23[_0x0fff('0x69')]=_0x0fff('0x72')+_0x33ed23[_0x0fff('0x2f')]+'-';return db['sequelize'][_0x0fff('0x73')](function(_0x7b040){return db[_0x0fff('0x32')][_0x0fff('0x25')](_0x33ed23,{'where':{'id':_0x33ed23['id']},'transaction':_0x7b040})[_0x0fff('0x26')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x33ed23['id']},'transaction':_0x7b040})[_0x0fff('0x26')](function(){return db['VoiceExtension'][_0x0fff('0x4f')]({'where':{'id':_0x33ed23[_0x0fff('0x56')]},'raw':!![]})[_0x0fff('0x26')](function(_0x712db4){return createVoicePrefixExtensions(_0x33ed23,_0x712db4,_0x7b040);});});});})[_0x0fff('0x26')](function(){return db['VoicePrefix'][_0x0fff('0x74')](_0x33ed23['id']);})[_0x0fff('0x26')](respondWithResult(_0x4c08c3,null))[_0x0fff('0x50')](handleError(_0x4c08c3,null));};exports[_0x0fff('0x75')]=function(_0x31ff4e,_0x15ab8e,_0x38e2e9){return db[_0x0fff('0x32')][_0x0fff('0x4f')]({'where':{'id':_0x31ff4e[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x15ab8e,null))['then'](function(_0x134012){if(_0x134012){return _0x134012[_0x0fff('0x75')](_0x31ff4e['body'][_0x0fff('0x76')],_['omit'](_0x31ff4e[_0x0fff('0x54')],[_0x0fff('0x76'),'id'])||{})[_0x0fff('0x77')](function(_0x8799c2){for(var _0x13d90e=0x0;_0x13d90e<_0x31ff4e['body'][_0x0fff('0x76')][_0x0fff('0x3e')];_0x13d90e+=0x1){socket['emit'](_0x0fff('0x78'),{'UserId':Number(_0x31ff4e[_0x0fff('0x54')][_0x0fff('0x76')][_0x13d90e]),'VoicePrefixId':Number(_0x31ff4e['params']['id'])});}return _0x8799c2;});}})[_0x0fff('0x26')](respondWithResult(_0x15ab8e,null))[_0x0fff('0x50')](handleError(_0x15ab8e,null));};exports['removeAgents']=function(_0x567544,_0x404b97,_0x49711a){return db['VoicePrefix'][_0x0fff('0x4f')]({'where':{'id':_0x567544[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x404b97,null))['then'](function(_0x4f7282){if(_0x4f7282){return _0x4f7282[_0x0fff('0x79')](_0x567544['query'][_0x0fff('0x76')])[_0x0fff('0x26')](function(){if(_[_0x0fff('0x7a')](_0x567544[_0x0fff('0x39')][_0x0fff('0x76')])){for(var _0x1e940c=0x0;_0x1e940c<_0x567544[_0x0fff('0x39')]['ids'][_0x0fff('0x3e')];_0x1e940c+=0x1){socket[_0x0fff('0x7b')](_0x0fff('0x7c'),{'UserId':Number(_0x567544[_0x0fff('0x39')][_0x0fff('0x76')][_0x1e940c]),'VoicePrefixId':Number(_0x567544[_0x0fff('0x4c')]['id'])});}}else{socket['emit'](_0x0fff('0x7c'),{'UserId':Number(_0x567544['query'][_0x0fff('0x76')]),'VoicePrefixId':Number(_0x567544[_0x0fff('0x4c')]['id'])});}});}})[_0x0fff('0x26')](respondWithStatusCode(_0x404b97,null))[_0x0fff('0x50')](handleError(_0x404b97,null));};exports['getAgents']=function(_0x4fc7c7,_0x34dd99,_0x5baf7f){var _0x3d820e={};var _0x125b12={};var _0x5093fc;var _0x5b04f2;return db[_0x0fff('0x32')][_0x0fff('0x7d')]({'where':{'id':_0x4fc7c7[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x34dd99,null))['then'](function(_0x407f0a){if(_0x407f0a){_0x5093fc=_0x407f0a;_0x125b12['model']=_[_0x0fff('0x38')](db[_0x0fff('0x7e')][_0x0fff('0x33')]);_0x125b12['query']=_['keys'](_0x4fc7c7['query']);_0x125b12[_0x0fff('0x3a')]=_['intersection'](_0x125b12[_0x0fff('0x37')],_0x125b12[_0x0fff('0x39')]);_0x3d820e[_0x0fff('0x3c')]=_[_0x0fff('0x3b')](_0x125b12[_0x0fff('0x37')],qs[_0x0fff('0x3d')](_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x3d')]));_0x3d820e[_0x0fff('0x3c')]=_0x3d820e[_0x0fff('0x3c')][_0x0fff('0x3e')]?_0x3d820e['attributes']:_0x125b12[_0x0fff('0x37')];_0x3d820e[_0x0fff('0x41')]=qs[_0x0fff('0x42')](_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x42')]);_0x3d820e['where']=qs[_0x0fff('0x3a')](_[_0x0fff('0x44')](_0x4fc7c7['query'],_0x125b12[_0x0fff('0x3a')]));if(_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x45')]){_0x3d820e[_0x0fff('0x43')]=_[_0x0fff('0x46')](_0x3d820e[_0x0fff('0x43')],{'$or':_[_0x0fff('0x31')](_0x3d820e[_0x0fff('0x3c')],function(_0x40c4f3){var _0x1c059b={};_0x1c059b[_0x40c4f3]={'$like':'%'+_0x4fc7c7['query'][_0x0fff('0x45')]+'%'};return _0x1c059b;})});}_0x3d820e=_[_0x0fff('0x46')]({},_0x3d820e,_0x4fc7c7[_0x0fff('0x4e')]);return _0x5093fc[_0x0fff('0x7f')](_0x3d820e);}})[_0x0fff('0x26')](function(_0x2fdf96){if(_0x2fdf96){_0x5b04f2=_0x2fdf96[_0x0fff('0x3e')];if(!_0x4fc7c7['query'][_0x0fff('0x3f')]('nolimit')){_0x3d820e[_0x0fff('0x21')]=qs[_0x0fff('0x21')](_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x21')]);_0x3d820e[_0x0fff('0x1f')]=qs['offset'](_0x4fc7c7[_0x0fff('0x39')]['offset']);}return _0x5093fc['getAgents'](_0x3d820e);}})[_0x0fff('0x26')](function(_0x173b44){if(_0x173b44){return _0x173b44?{'count':_0x5b04f2,'rows':_0x173b44}:null;}})[_0x0fff('0x26')](respondWithResult(_0x34dd99,null))[_0x0fff('0x50')](handleError(_0x34dd99,null));};exports[_0x0fff('0x80')]=function(_0x3995b9,_0x5bc4e1,_0x50f95c){var _0x5b637e={};var _0x1bd02a={};var _0x41b755;var _0x4012aa;return db[_0x0fff('0x32')][_0x0fff('0x7d')]({'where':{'id':_0x3995b9[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x5bc4e1,null))[_0x0fff('0x26')](function(_0xed7e93){if(_0xed7e93){_0x41b755=_0xed7e93;_0x1bd02a[_0x0fff('0x37')]=_[_0x0fff('0x38')](db[_0x0fff('0x81')][_0x0fff('0x33')]);_0x1bd02a[_0x0fff('0x39')]=_[_0x0fff('0x38')](_0x3995b9[_0x0fff('0x39')]);_0x1bd02a[_0x0fff('0x3a')]=_['intersection'](_0x1bd02a[_0x0fff('0x37')],_0x1bd02a[_0x0fff('0x39')]);_0x5b637e[_0x0fff('0x3c')]=_[_0x0fff('0x3b')](_0x1bd02a[_0x0fff('0x37')],qs[_0x0fff('0x3d')](_0x3995b9[_0x0fff('0x39')]['fields']));_0x5b637e[_0x0fff('0x3c')]=_0x5b637e[_0x0fff('0x3c')]['length']?_0x5b637e[_0x0fff('0x3c')]:_0x1bd02a['model'];_0x5b637e[_0x0fff('0x41')]=qs[_0x0fff('0x42')](_0x3995b9['query']['sort']);_0x5b637e['where']=qs[_0x0fff('0x3a')](_['pick'](_0x3995b9['query'],_0x1bd02a['filters']));if(_0x3995b9['query'][_0x0fff('0x45')]){_0x5b637e['where']=_[_0x0fff('0x46')](_0x5b637e['where'],{'$or':_[_0x0fff('0x31')](_0x5b637e['attributes'],function(_0x465dde){var _0x9ca531={};_0x9ca531[_0x465dde]={'$like':'%'+_0x3995b9['query']['filter']+'%'};return _0x9ca531;})});}_0x5b637e=_[_0x0fff('0x46')]({},_0x5b637e,_0x3995b9[_0x0fff('0x4e')]);return _0x41b755[_0x0fff('0x80')](_0x5b637e);}})[_0x0fff('0x26')](function(_0x675250){if(_0x675250){_0x4012aa=_0x675250[_0x0fff('0x3e')];if(!_0x3995b9[_0x0fff('0x39')]['hasOwnProperty'](_0x0fff('0x40'))){_0x5b637e[_0x0fff('0x21')]=qs[_0x0fff('0x21')](_0x3995b9[_0x0fff('0x39')]['limit']);_0x5b637e[_0x0fff('0x1f')]=qs[_0x0fff('0x1f')](_0x3995b9[_0x0fff('0x39')]['offset']);}return _0x41b755['getTeams'](_0x5b637e);}})[_0x0fff('0x26')](function(_0x37b5b4){if(_0x37b5b4){return _0x37b5b4?{'count':_0x4012aa,'rows':_0x37b5b4}:null;}})['then'](respondWithResult(_0x5bc4e1,null))[_0x0fff('0x50')](handleError(_0x5bc4e1,null));};exports[_0x0fff('0x82')]=function(_0x4ab665,_0x2ab827,_0x2a2af9){var _0x2ca40b=_0x4ab665['body']['ids'];var _0x2eeee9;return db[_0x0fff('0x81')]['findAll']({'where':{'id':_0x2ca40b},'attributes':['id'],'include':[{'model':db[_0x0fff('0x7e')],'as':_0x0fff('0x83'),'attributes':['id',_0x0fff('0x2f'),_0x0fff('0x84'),_0x0fff('0x85'),_0x0fff('0x86')],'raw':!![]}]})[_0x0fff('0x26')](function(_0x1b500a){if(_0x1b500a){_0x2eeee9=_0x1b500a;var _0x327b5=_[_0x0fff('0x87')](_0x1b500a,function(_0x10aa61){var _0xc99224=_0x10aa61['get']({'plain':!![]});return _0xc99224[_0x0fff('0x83')];});return db['VoicePrefix'][_0x0fff('0x4f')]({'where':{'id':_0x4ab665['params']['id']}})[_0x0fff('0x26')](function(_0x5336){return db[_0x0fff('0x53')][_0x0fff('0x73')](function(_0x42fbff){return _0x5336[_0x0fff('0x82')](_0x2ca40b,{'transaction':_0x42fbff})['then'](function(){return BPromise[_0x0fff('0x88')](_0x2eeee9,function(_0x39565f){return db['TeamVoicePrefix'][_0x0fff('0x89')]({'TeamId':_0x39565f['id'],'VoicePrefixId':_0x4ab665['params']['id']},{'transaction':_0x42fbff});});})['then'](function(){return BPromise[_0x0fff('0x88')](_0x327b5,function(_0x2e38c3){return db[_0x0fff('0x8a')][_0x0fff('0x8b')]({'where':{'UserId':_0x2e38c3['id'],'VoicePrefixId':_0x4ab665[_0x0fff('0x4c')]['id']},'transaction':_0x42fbff});});})[_0x0fff('0x26')](function(){_0x327b5['forEach'](function(_0xe02ca6){socket[_0x0fff('0x7b')](_0x0fff('0x78'),{'UserId':_0xe02ca6['id'],'VoicePrefixId':_0x5336['id']});});});});});}})[_0x0fff('0x26')](respondWithStatusCode(_0x2ab827,null))[_0x0fff('0x50')](handleError(_0x2ab827,null));};exports['removeTeams']=function(_0x25e9f2,_0xf73eb6,_0x87df03){return db[_0x0fff('0x81')][_0x0fff('0x49')]({'where':{'id':_0x25e9f2[_0x0fff('0x39')][_0x0fff('0x76')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0fff('0x26')](handleEntityNotFound(_0xf73eb6,null))['then'](function(_0x2d206c){var _0x5ed120=_['map'](_0x2d206c,'id');var _0x592341=[];var _0x2e1625=[];var _0x128fe1=squel[_0x0fff('0x8c')]();_0x128fe1[_0x0fff('0x8d')](_0x0fff('0x8e'))['from'](_0x0fff('0x8f'),'tq')[_0x0fff('0x90')](_0x0fff('0x91'),'ut',_0x0fff('0x92'))[_0x0fff('0x43')](_0x0fff('0x93'),_0x25e9f2[_0x0fff('0x4c')]['id']);for(var _0x115445=0x0;_0x115445<_0x2d206c['length'];_0x115445+=0x1){let _0x596074=_0x2d206c[_0x115445];for(var _0x1f1946=0x0;_0x1f1946<_0x596074[_0x0fff('0x83')][_0x0fff('0x3e')];_0x1f1946+=0x1){let _0x47ff09=_0x596074[_0x0fff('0x83')][_0x1f1946];var _0x2ae986=_0x128fe1[_0x0fff('0x94')]();_0x2ae986['where'](_0x0fff('0x95'),_0x47ff09['id']);_0x2e1625[_0x0fff('0x6a')](db[_0x0fff('0x53')][_0x0fff('0x39')](_0x2ae986[_0x0fff('0x96')](),{'type':db[_0x0fff('0x53')][_0x0fff('0x97')]['SELECT']})['then'](function(_0x4a70ee){if(_0x4a70ee[_0x0fff('0x3e')]===0x1){return _0x47ff09['id'];}else{var _0x425412=_[_0x0fff('0x98')](_[_0x0fff('0x31')](_0x4a70ee,_0x0fff('0x99')),function(_0x41afce){return _['includes'](_0x5ed120,_0x41afce);});if(_0x425412){return _0x47ff09['id'];}}}));}}return BPromise[_0x0fff('0x9a')](_0x2e1625)[_0x0fff('0x26')](function(_0x7928f7){_0x592341=_(_0x592341)['union'](_0x7928f7)['compact']()[_0x0fff('0x9b')]();return db['VoicePrefix'][_0x0fff('0x4f')]({'where':{'id':_0x25e9f2[_0x0fff('0x4c')]['id']}})['then'](function(_0x1bf39f){return db[_0x0fff('0x53')]['transaction'](function(_0xb6faf){return _0x1bf39f[_0x0fff('0x9c')](_0x25e9f2[_0x0fff('0x39')][_0x0fff('0x76')],{'transaction':_0xb6faf})[_0x0fff('0x26')](function(){if(!_[_0x0fff('0x9d')](_0x592341)){return _0x1bf39f['removeAgents'](_0x592341,{'transaction':_0xb6faf});}})[_0x0fff('0x26')](function(){_0x592341['forEach'](function(_0xf72b2b){socket['emit'](_0x0fff('0x7c'),{'UserId':_0xf72b2b,'VoicePrefixId':_0x1bf39f['id']});});});});});});})['then'](respondWithStatusCode(_0xf73eb6,null))[_0x0fff('0x50')](handleError(_0xf73eb6,null));}; \ No newline at end of file +var _0x087b=['status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','VoicePrefixes','UserProfileResource','end','error','stack','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','merge','VIRTUAL','where','include','catch','options','find','describe','create','sequelize','transaction','VoiceExtension','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','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','Set','CDR(prefix)=','callerIdAll','push','No\x20callerid\x20available','context','charAt','body','system-','findById','addAgents','params','omit','ids','spread','removeAgents','isArray','emit','userVoicePrefix:remove','findOne','User','pick','getAgents','nolimit','getTeams','Team','addTeams','findAll','interface','flatMap','Agents','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','union','compact','value','removeTeams','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus'];(function(_0xdf4f84,_0x537715){var _0x23e1f4=function(_0x428c79){while(--_0x428c79){_0xdf4f84['push'](_0xdf4f84['shift']());}};_0x23e1f4(++_0x537715);}(_0x087b,0x11a));var _0xb087=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x087b[_0x5f3f88];return _0xd08119;};'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 hardwareService=require(_0xb087('0x15'));var logger=require(_0xb087('0x16'))(_0xb087('0x17'));var utils=require(_0xb087('0x18'));var config=require(_0xb087('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb087('0x1a'))['db'];config[_0xb087('0x1b')]=_[_0xb087('0x1c')](config['redis'],{'host':_0xb087('0x1d'),'port':0x18eb});var socket=require(_0xb087('0x1e'))(new Redis(config[_0xb087('0x1b')]));require(_0xb087('0x1f'))[_0xb087('0x20')](socket);function respondWithStatusCode(_0x12d0db,_0x5e9757){_0x5e9757=_0x5e9757||0xcc;return function(_0x5147e3){if(_0x5147e3){return _0x12d0db[_0xb087('0x21')](_0x5e9757);}return _0x12d0db[_0xb087('0x22')](_0x5e9757)['end']();};}function respondWithResult(_0x43e576,_0x412b48){_0x412b48=_0x412b48||0xc8;return function(_0x597478){if(_0x597478){return _0x43e576[_0xb087('0x22')](_0x412b48)[_0xb087('0x23')](_0x597478);}};}function respondWithFilteredResult(_0x2e9e74,_0x5bb80b){return function(_0x330005){if(_0x330005){var _0x3c680f=typeof _0x5bb80b[_0xb087('0x24')]===_0xb087('0x25')&&typeof _0x5bb80b['limit']===_0xb087('0x25');var _0x28428e=_0x330005[_0xb087('0x26')];var _0x23c1b6=_0x3c680f?0x0:_0x5bb80b['offset'];var _0x5aeab1=_0x3c680f?_0x330005['count']:_0x5bb80b['offset']+_0x5bb80b[_0xb087('0x27')];var _0x17be8e;if(_0x5aeab1>=_0x28428e){_0x5aeab1=_0x28428e;_0x17be8e=0xc8;}else{_0x17be8e=0xce;}_0x2e9e74[_0xb087('0x22')](_0x17be8e);return _0x2e9e74[_0xb087('0x28')](_0xb087('0x29'),_0x23c1b6+'-'+_0x5aeab1+'/'+_0x28428e)[_0xb087('0x23')](_0x330005);}return null;};}function patchUpdates(_0x31ae01){return function(_0x5587f7){try{jsonpatch[_0xb087('0x2a')](_0x5587f7,_0x31ae01,!![]);}catch(_0x466397){return BPromise[_0xb087('0x2b')](_0x466397);}return _0x5587f7[_0xb087('0x2c')]();};}function saveUpdates(_0x3ad74e,_0x4d9028){return function(_0x183eab){if(_0x183eab){return _0x183eab[_0xb087('0x2d')](_0x3ad74e)['then'](function(_0x5a2dc6){return _0x5a2dc6;});}return null;};}function removeEntity(_0x50745a,_0x598b99){return function(_0x5a4ee0){if(_0x5a4ee0){return _0x5a4ee0[_0xb087('0x2e')]()[_0xb087('0x2f')](function(){var _0x1d124f=_0x5a4ee0[_0xb087('0x30')]({'plain':!![]});var _0xd9ec66=_0xb087('0x31');return db[_0xb087('0x32')][_0xb087('0x2e')]({'where':{'type':_0xd9ec66,'resourceId':_0x1d124f['id']}})[_0xb087('0x2f')](function(){return _0x5a4ee0;});})[_0xb087('0x2f')](function(){_0x50745a[_0xb087('0x22')](0xcc)[_0xb087('0x33')]();});}};}function handleEntityNotFound(_0xb0baf6,_0x263259){return function(_0x593b78){if(!_0x593b78){_0xb0baf6[_0xb087('0x21')](0x194);}return _0x593b78;};}function handleError(_0x1335d9,_0x20183f){_0x20183f=_0x20183f||0x1f4;return function(_0x15c9ac){logger[_0xb087('0x34')](_0x15c9ac[_0xb087('0x35')]);if(_0x15c9ac[_0xb087('0x36')]){delete _0x15c9ac[_0xb087('0x36')];}_0x1335d9['status'](_0x20183f)['send'](_0x15c9ac);};}exports[_0xb087('0x37')]=function(_0xedd164,_0x4cb5a8){var _0x60bfe2={},_0x7d3776={},_0x2a48d3={'count':0x0,'rows':[]};var _0x32b20d=_[_0xb087('0x38')](db[_0xb087('0x39')][_0xb087('0x3a')],function(_0x3b7ace){return{'name':_0x3b7ace[_0xb087('0x3b')],'type':_0x3b7ace[_0xb087('0x3c')][_0xb087('0x3d')]};});_0x7d3776[_0xb087('0x3e')]=_['map'](_0x32b20d,_0xb087('0x36'));_0x7d3776['query']=_[_0xb087('0x3f')](_0xedd164[_0xb087('0x40')]);_0x7d3776[_0xb087('0x41')]=_[_0xb087('0x42')](_0x7d3776[_0xb087('0x3e')],_0x7d3776[_0xb087('0x40')]);_0x60bfe2[_0xb087('0x43')]=_[_0xb087('0x42')](_0x7d3776[_0xb087('0x3e')],qs['fields'](_0xedd164['query'][_0xb087('0x44')]));_0x60bfe2[_0xb087('0x43')]=_0x60bfe2[_0xb087('0x43')][_0xb087('0x45')]?_0x60bfe2[_0xb087('0x43')]:_0x7d3776['model'];if(!_0xedd164[_0xb087('0x40')][_0xb087('0x46')]('nolimit')){_0x60bfe2['limit']=qs[_0xb087('0x27')](_0xedd164[_0xb087('0x40')][_0xb087('0x27')]);_0x60bfe2['offset']=qs[_0xb087('0x24')](_0xedd164[_0xb087('0x40')][_0xb087('0x24')]);}_0x60bfe2[_0xb087('0x47')]=qs[_0xb087('0x48')](_0xedd164['query'][_0xb087('0x48')]);_0x60bfe2['where']=qs[_0xb087('0x41')](_['pick'](_0xedd164[_0xb087('0x40')],_0x7d3776[_0xb087('0x41')]),_0x32b20d);if(_0xedd164['query'][_0xb087('0x49')]){_0x60bfe2['where']=_[_0xb087('0x4a')](_0x60bfe2['where'],{'$or':_[_0xb087('0x38')](_0x32b20d,function(_0x326934){if(_0x326934[_0xb087('0x3c')]!==_0xb087('0x4b')){var _0x1785e0={};_0x1785e0[_0x326934[_0xb087('0x36')]]={'$like':'%'+_0xedd164[_0xb087('0x40')]['filter']+'%'};return _0x1785e0;}})});}_0x60bfe2=_[_0xb087('0x4a')]({},_0x60bfe2,_0xedd164['options']);var _0x2a2b9c={'where':_0x60bfe2[_0xb087('0x4c')]};return db['VoicePrefix'][_0xb087('0x26')](_0x2a2b9c)[_0xb087('0x2f')](function(_0x7650c5){_0x2a48d3['count']=_0x7650c5;if(_0xedd164[_0xb087('0x40')]['includeAll']){_0x60bfe2[_0xb087('0x4d')]=[{'all':!![]}];}return db[_0xb087('0x39')]['findAll'](_0x60bfe2);})[_0xb087('0x2f')](function(_0x302ce7){_0x2a48d3['rows']=_0x302ce7;return _0x2a48d3;})[_0xb087('0x2f')](respondWithFilteredResult(_0x4cb5a8,_0x60bfe2))[_0xb087('0x4e')](handleError(_0x4cb5a8,null));};exports['show']=function(_0x93ada7,_0x46c713){var _0x1d7f80={'raw':![],'where':{'id':_0x93ada7['params']['id']}},_0x174c10={};_0x174c10['model']=_[_0xb087('0x3f')](db[_0xb087('0x39')][_0xb087('0x3a')]);_0x174c10[_0xb087('0x40')]=_[_0xb087('0x3f')](_0x93ada7[_0xb087('0x40')]);_0x174c10['filters']=_['intersection'](_0x174c10[_0xb087('0x3e')],_0x174c10['query']);_0x1d7f80[_0xb087('0x43')]=_[_0xb087('0x42')](_0x174c10[_0xb087('0x3e')],qs[_0xb087('0x44')](_0x93ada7['query'][_0xb087('0x44')]));_0x1d7f80['attributes']=_0x1d7f80[_0xb087('0x43')][_0xb087('0x45')]?_0x1d7f80[_0xb087('0x43')]:_0x174c10[_0xb087('0x3e')];if(_0x93ada7[_0xb087('0x40')]['includeAll']){_0x1d7f80[_0xb087('0x4d')]=[{'all':!![]}];}_0x1d7f80=_[_0xb087('0x4a')]({},_0x1d7f80,_0x93ada7[_0xb087('0x4f')]);return db['VoicePrefix'][_0xb087('0x50')](_0x1d7f80)['then'](handleEntityNotFound(_0x46c713,null))['then'](respondWithResult(_0x46c713,null))[_0xb087('0x4e')](handleError(_0x46c713,null));};exports[_0xb087('0x2e')]=function(_0x5eacf3,_0x4362d4){return db[_0xb087('0x39')][_0xb087('0x50')]({'where':{'id':_0x5eacf3['params']['id']}})['then'](handleEntityNotFound(_0x4362d4,null))[_0xb087('0x2f')](removeEntity(_0x4362d4,null))['catch'](handleError(_0x4362d4,null));};exports['describe']=function(_0x1e52e4,_0x3bafca){return db[_0xb087('0x39')][_0xb087('0x51')]()[_0xb087('0x2f')](respondWithResult(_0x3bafca,null))[_0xb087('0x4e')](handleError(_0x3bafca,null));};exports[_0xb087('0x52')]=function(_0xfb8827,_0x1fe178){var _0x18d93b;return db[_0xb087('0x53')][_0xb087('0x54')](function(_0x55e653){return db[_0xb087('0x39')][_0xb087('0x52')](_0xfb8827['body'],{'transaction':_0x55e653})[_0xb087('0x2f')](function(_0x458301){_0x18d93b=_0x458301[_0xb087('0x30')]({'plain':!![]});return db[_0xb087('0x55')][_0xb087('0x50')]({'where':{'id':_0x18d93b[_0xb087('0x56')]},'raw':!![]})[_0xb087('0x2f')](function(_0x298169){return createVoicePrefixExtensions(_0x18d93b,_0x298169,_0x55e653);});});})[_0xb087('0x2f')](function(){var _0x357616=_0xfb8827[_0xb087('0x57')]['get']({'plain':!![]});if(!_0x357616)throw new Error(_0xb087('0x58'));if(_0x357616['role']===_0xb087('0x57')){var _0x575cc4=_0x18d93b;return db[_0xb087('0x59')][_0xb087('0x50')]({'where':{'name':_0xb087('0x31'),'userProfileId':_0x357616[_0xb087('0x5a')]},'raw':!![]})[_0xb087('0x2f')](function(_0x465ef6){if(_0x465ef6&&_0x465ef6[_0xb087('0x5b')]===0x0){return db[_0xb087('0x32')][_0xb087('0x52')]({'name':_0x575cc4[_0xb087('0x36')],'resourceId':_0x575cc4['id'],'type':_0x465ef6[_0xb087('0x36')],'sectionId':_0x465ef6['id']},{})[_0xb087('0x2f')](function(){return _0x18d93b;});}else{return _0x18d93b;}})[_0xb087('0x4e')](function(_0x22be05){logger[_0xb087('0x34')](_0xb087('0x5c'),_0x22be05);throw _0x22be05;});}return _0x18d93b;})[_0xb087('0x2f')](respondWithResult(_0x1fe178,null))[_0xb087('0x4e')](handleError(_0x1fe178,null));};function Extension(_0x40ff74,_0xe3cb2,_0x4053c8,_0x459c5b){this['context']=_0xb087('0x5d');this[_0xb087('0x5e')]=_0x40ff74;this[_0xb087('0x5f')]=_0x4053c8;this['type']=_0xb087('0x60');this[_0xb087('0x61')]='Voice\x20Prefix\x20Extension';this[_0xb087('0x62')]=_0xe3cb2;this[_0xb087('0x63')]=_0x459c5b;}function createVoicePrefixExtensions(_0x2e3a14,_0x596264,_0x133c58){return new BPromise(function(_0x257894,_0x3d7f74){var _0x43ef22=new Extension(formatPrefixName(_0x2e3a14[_0xb087('0x64')]),0x1,_0xb087('0x65'),_0xb087('0x66'));_0x43ef22[_0xb087('0x67')]=_0x2e3a14['id'];return db['VoiceExtension'][_0xb087('0x52')](_0x43ef22,{'transaction':_0x133c58})[_0xb087('0x2f')](function(_0x44548f){var _0x47b2c7=_0x44548f[_0xb087('0x30')]({'plain':!![]});var _0x4a26d0=_['map'](addVoicePrefixExtensions(_0x2e3a14,_0x596264),function(_0x3516d4){_0x3516d4[_0xb087('0x56')]=_0x47b2c7['id'];_0x3516d4['VoicePrefixId']=_0x2e3a14['id'];return _0x3516d4;});return db[_0xb087('0x55')]['bulkCreate'](_0x4a26d0,{'transaction':_0x133c58})[_0xb087('0x2f')](function(_0x1a8237){if(!_0x1a8237){return _0x3d7f74('Extensions\x20creation\x20failed');}else{return _0x257894(_0x1a8237);}})['catch'](function(_0x22219d){return _0x3d7f74(_0x22219d);});});;});};function addVoicePrefixExtensions(_0x5c43c8,_0x5ede2e){var _0x3c97ab=[];var _0x52d72a=formatPrefixName(_0x5c43c8[_0xb087('0x64')]);_0x3c97ab['push'](new Extension(_0x52d72a,0x2,_0xb087('0x68'),_0xb087('0x69')+_0x5c43c8[_0xb087('0x36')]));if(_0x5c43c8[_0xb087('0x6a')]){_0x3c97ab[_0xb087('0x6b')](new Extension(_0x52d72a,0x3,_0xb087('0x68'),'PREFIX-CALLERIDALL='+_0x5c43c8[_0xb087('0x6a')]));}else{_0x3c97ab['push'](new Extension(_0x52d72a,0x3,_0xb087('0x65'),_0xb087('0x6c')));}_0x3c97ab[_0xb087('0x6b')](new Extension(_0x52d72a,0x4,'goto',_0x5ede2e[_0xb087('0x6d')]+','+'${EXTEN:'+(0x8+_0x5c43c8[_0xb087('0x36')][_0xb087('0x45')])+'}'+','+0x1));return _0x3c97ab;}function formatPrefixName(_0x66f15b){var _0x2ee63f='_';for(var _0x16cb87=0x0;_0x16cb87<_0x66f15b[_0xb087('0x45')];_0x16cb87++){if(_0x66f15b['charAt'](_0x16cb87)=='-'){_0x2ee63f+=_0x66f15b[_0xb087('0x6e')](_0x16cb87);}else{_0x2ee63f+='['+_0x66f15b[_0xb087('0x6e')](_0x16cb87)+']';}}_0x2ee63f+='.';return _0x2ee63f;}exports['update']=function(_0x25a45f,_0x58de88,_0x19238d){var _0x38f5d2=_0x25a45f[_0xb087('0x6f')];_0x38f5d2[_0xb087('0x64')]=_0xb087('0x70')+_0x38f5d2[_0xb087('0x36')]+'-';return db[_0xb087('0x53')][_0xb087('0x54')](function(_0x509ee7){return db['VoicePrefix']['update'](_0x38f5d2,{'where':{'id':_0x38f5d2['id']},'transaction':_0x509ee7})[_0xb087('0x2f')](function(){return db['VoiceExtension'][_0xb087('0x2e')]({'where':{'VoicePrefixId':_0x38f5d2['id']},'transaction':_0x509ee7})['then'](function(){return db[_0xb087('0x55')][_0xb087('0x50')]({'where':{'id':_0x38f5d2[_0xb087('0x56')]},'raw':!![]})[_0xb087('0x2f')](function(_0x49d0d3){return createVoicePrefixExtensions(_0x38f5d2,_0x49d0d3,_0x509ee7);});});});})[_0xb087('0x2f')](function(){return db['VoicePrefix'][_0xb087('0x71')](_0x38f5d2['id']);})[_0xb087('0x2f')](respondWithResult(_0x58de88,null))[_0xb087('0x4e')](handleError(_0x58de88,null));};exports[_0xb087('0x72')]=function(_0x5b5ad3,_0x49d26a,_0x38f296){return db['VoicePrefix'][_0xb087('0x50')]({'where':{'id':_0x5b5ad3[_0xb087('0x73')]['id']}})[_0xb087('0x2f')](handleEntityNotFound(_0x49d26a,null))[_0xb087('0x2f')](function(_0x4a9193){if(_0x4a9193){return _0x4a9193['addAgents'](_0x5b5ad3[_0xb087('0x6f')]['ids'],_[_0xb087('0x74')](_0x5b5ad3[_0xb087('0x6f')],[_0xb087('0x75'),'id'])||{})[_0xb087('0x76')](function(_0x142b0f){for(var _0x581ad4=0x0;_0x581ad4<_0x5b5ad3[_0xb087('0x6f')][_0xb087('0x75')]['length'];_0x581ad4+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':Number(_0x5b5ad3[_0xb087('0x6f')][_0xb087('0x75')][_0x581ad4]),'VoicePrefixId':Number(_0x5b5ad3[_0xb087('0x73')]['id'])});}return _0x142b0f;});}})[_0xb087('0x2f')](respondWithResult(_0x49d26a,null))[_0xb087('0x4e')](handleError(_0x49d26a,null));};exports[_0xb087('0x77')]=function(_0x47ea48,_0xd1f58a,_0x25e097){return db[_0xb087('0x39')][_0xb087('0x50')]({'where':{'id':_0x47ea48[_0xb087('0x73')]['id']}})[_0xb087('0x2f')](handleEntityNotFound(_0xd1f58a,null))[_0xb087('0x2f')](function(_0x50454b){if(_0x50454b){return _0x50454b[_0xb087('0x77')](_0x47ea48[_0xb087('0x40')][_0xb087('0x75')])['then'](function(){if(_[_0xb087('0x78')](_0x47ea48['query'][_0xb087('0x75')])){for(var _0x5fb869=0x0;_0x5fb869<_0x47ea48[_0xb087('0x40')][_0xb087('0x75')][_0xb087('0x45')];_0x5fb869+=0x1){socket[_0xb087('0x79')]('userVoicePrefix:remove',{'UserId':Number(_0x47ea48['query'][_0xb087('0x75')][_0x5fb869]),'VoicePrefixId':Number(_0x47ea48[_0xb087('0x73')]['id'])});}}else{socket['emit'](_0xb087('0x7a'),{'UserId':Number(_0x47ea48[_0xb087('0x40')][_0xb087('0x75')]),'VoicePrefixId':Number(_0x47ea48[_0xb087('0x73')]['id'])});}});}})[_0xb087('0x2f')](respondWithStatusCode(_0xd1f58a,null))[_0xb087('0x4e')](handleError(_0xd1f58a,null));};exports['getAgents']=function(_0x15ff29,_0x141859,_0x2c92f6){var _0x3114ce={};var _0x416e05={};var _0x3d6d1a;var _0xf286de;return db[_0xb087('0x39')][_0xb087('0x7b')]({'where':{'id':_0x15ff29['params']['id']}})[_0xb087('0x2f')](handleEntityNotFound(_0x141859,null))['then'](function(_0x2a32d0){if(_0x2a32d0){_0x3d6d1a=_0x2a32d0;_0x416e05[_0xb087('0x3e')]=_['keys'](db[_0xb087('0x7c')][_0xb087('0x3a')]);_0x416e05[_0xb087('0x40')]=_[_0xb087('0x3f')](_0x15ff29[_0xb087('0x40')]);_0x416e05[_0xb087('0x41')]=_['intersection'](_0x416e05[_0xb087('0x3e')],_0x416e05[_0xb087('0x40')]);_0x3114ce[_0xb087('0x43')]=_[_0xb087('0x42')](_0x416e05[_0xb087('0x3e')],qs['fields'](_0x15ff29[_0xb087('0x40')][_0xb087('0x44')]));_0x3114ce[_0xb087('0x43')]=_0x3114ce[_0xb087('0x43')][_0xb087('0x45')]?_0x3114ce[_0xb087('0x43')]:_0x416e05[_0xb087('0x3e')];_0x3114ce[_0xb087('0x47')]=qs[_0xb087('0x48')](_0x15ff29[_0xb087('0x40')][_0xb087('0x48')]);_0x3114ce['where']=qs['filters'](_[_0xb087('0x7d')](_0x15ff29[_0xb087('0x40')],_0x416e05[_0xb087('0x41')]));if(_0x15ff29[_0xb087('0x40')][_0xb087('0x49')]){_0x3114ce['where']=_[_0xb087('0x4a')](_0x3114ce[_0xb087('0x4c')],{'$or':_[_0xb087('0x38')](_0x3114ce[_0xb087('0x43')],function(_0x3e58be){var _0xbe2a4c={};_0xbe2a4c[_0x3e58be]={'$like':'%'+_0x15ff29['query'][_0xb087('0x49')]+'%'};return _0xbe2a4c;})});}_0x3114ce=_['merge']({},_0x3114ce,_0x15ff29['options']);return _0x3d6d1a[_0xb087('0x7e')](_0x3114ce);}})[_0xb087('0x2f')](function(_0x3a446d){if(_0x3a446d){_0xf286de=_0x3a446d[_0xb087('0x45')];if(!_0x15ff29['query'][_0xb087('0x46')](_0xb087('0x7f'))){_0x3114ce['limit']=qs[_0xb087('0x27')](_0x15ff29['query']['limit']);_0x3114ce[_0xb087('0x24')]=qs[_0xb087('0x24')](_0x15ff29[_0xb087('0x40')][_0xb087('0x24')]);}return _0x3d6d1a[_0xb087('0x7e')](_0x3114ce);}})['then'](function(_0x3cf818){if(_0x3cf818){return _0x3cf818?{'count':_0xf286de,'rows':_0x3cf818}:null;}})[_0xb087('0x2f')](respondWithResult(_0x141859,null))[_0xb087('0x4e')](handleError(_0x141859,null));};exports[_0xb087('0x80')]=function(_0x48e2c6,_0x489b1f,_0x544a68){var _0x5ebb4f={};var _0x17f0af={};var _0x3296c9;var _0x10e4b6;return db[_0xb087('0x39')][_0xb087('0x7b')]({'where':{'id':_0x48e2c6[_0xb087('0x73')]['id']}})[_0xb087('0x2f')](handleEntityNotFound(_0x489b1f,null))['then'](function(_0x5d45e7){if(_0x5d45e7){_0x3296c9=_0x5d45e7;_0x17f0af[_0xb087('0x3e')]=_[_0xb087('0x3f')](db[_0xb087('0x81')][_0xb087('0x3a')]);_0x17f0af['query']=_[_0xb087('0x3f')](_0x48e2c6['query']);_0x17f0af[_0xb087('0x41')]=_['intersection'](_0x17f0af[_0xb087('0x3e')],_0x17f0af[_0xb087('0x40')]);_0x5ebb4f[_0xb087('0x43')]=_[_0xb087('0x42')](_0x17f0af['model'],qs[_0xb087('0x44')](_0x48e2c6['query']['fields']));_0x5ebb4f['attributes']=_0x5ebb4f[_0xb087('0x43')]['length']?_0x5ebb4f[_0xb087('0x43')]:_0x17f0af[_0xb087('0x3e')];_0x5ebb4f[_0xb087('0x47')]=qs[_0xb087('0x48')](_0x48e2c6[_0xb087('0x40')][_0xb087('0x48')]);_0x5ebb4f[_0xb087('0x4c')]=qs[_0xb087('0x41')](_[_0xb087('0x7d')](_0x48e2c6[_0xb087('0x40')],_0x17f0af[_0xb087('0x41')]));if(_0x48e2c6[_0xb087('0x40')][_0xb087('0x49')]){_0x5ebb4f[_0xb087('0x4c')]=_[_0xb087('0x4a')](_0x5ebb4f[_0xb087('0x4c')],{'$or':_[_0xb087('0x38')](_0x5ebb4f[_0xb087('0x43')],function(_0x4e42eb){var _0x15e2f9={};_0x15e2f9[_0x4e42eb]={'$like':'%'+_0x48e2c6['query'][_0xb087('0x49')]+'%'};return _0x15e2f9;})});}_0x5ebb4f=_[_0xb087('0x4a')]({},_0x5ebb4f,_0x48e2c6[_0xb087('0x4f')]);return _0x3296c9[_0xb087('0x80')](_0x5ebb4f);}})[_0xb087('0x2f')](function(_0x2e4d22){if(_0x2e4d22){_0x10e4b6=_0x2e4d22[_0xb087('0x45')];if(!_0x48e2c6['query']['hasOwnProperty']('nolimit')){_0x5ebb4f[_0xb087('0x27')]=qs[_0xb087('0x27')](_0x48e2c6[_0xb087('0x40')][_0xb087('0x27')]);_0x5ebb4f[_0xb087('0x24')]=qs[_0xb087('0x24')](_0x48e2c6[_0xb087('0x40')][_0xb087('0x24')]);}return _0x3296c9[_0xb087('0x80')](_0x5ebb4f);}})['then'](function(_0x2de517){if(_0x2de517){return _0x2de517?{'count':_0x10e4b6,'rows':_0x2de517}:null;}})['then'](respondWithResult(_0x489b1f,null))[_0xb087('0x4e')](handleError(_0x489b1f,null));};exports[_0xb087('0x82')]=function(_0x597d80,_0x4c3aef,_0x2f2597){var _0x2ae274=_0x597d80[_0xb087('0x6f')][_0xb087('0x75')];var _0x5069f2;return db[_0xb087('0x81')][_0xb087('0x83')]({'where':{'id':_0x2ae274},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xb087('0x36'),'online','voicePause',_0xb087('0x84')],'raw':!![]}]})['then'](function(_0x4059ac){if(_0x4059ac){_0x5069f2=_0x4059ac;var _0x12976c=_[_0xb087('0x85')](_0x4059ac,function(_0x1e48cc){var _0x2de831=_0x1e48cc[_0xb087('0x30')]({'plain':!![]});return _0x2de831[_0xb087('0x86')];});return db[_0xb087('0x39')]['find']({'where':{'id':_0x597d80[_0xb087('0x73')]['id']}})['then'](function(_0x5acf13){return db[_0xb087('0x53')][_0xb087('0x54')](function(_0x1fdb0f){return _0x5acf13['addTeams'](_0x2ae274,{'transaction':_0x1fdb0f})[_0xb087('0x2f')](function(){return BPromise[_0xb087('0x87')](_0x5069f2,function(_0x313d4b){return db[_0xb087('0x88')]['upsert']({'TeamId':_0x313d4b['id'],'VoicePrefixId':_0x597d80[_0xb087('0x73')]['id']},{'transaction':_0x1fdb0f});});})[_0xb087('0x2f')](function(){return BPromise[_0xb087('0x87')](_0x12976c,function(_0x46f5e6){return db[_0xb087('0x89')][_0xb087('0x8a')]({'where':{'UserId':_0x46f5e6['id'],'VoicePrefixId':_0x597d80[_0xb087('0x73')]['id']},'transaction':_0x1fdb0f});});})['then'](function(){_0x12976c[_0xb087('0x8b')](function(_0xfc3490){socket[_0xb087('0x79')](_0xb087('0x8c'),{'UserId':_0xfc3490['id'],'VoicePrefixId':_0x5acf13['id']});});});});});}})[_0xb087('0x2f')](respondWithStatusCode(_0x4c3aef,null))[_0xb087('0x4e')](handleError(_0x4c3aef,null));};exports['removeTeams']=function(_0x44c8cb,_0x15bbda,_0x149020){return db['Team']['findAll']({'where':{'id':_0x44c8cb[_0xb087('0x40')][_0xb087('0x75')]},'attributes':['id'],'include':[{'model':db[_0xb087('0x7c')],'as':_0xb087('0x86'),'attributes':['id'],'raw':!![]}]})[_0xb087('0x2f')](handleEntityNotFound(_0x15bbda,null))[_0xb087('0x2f')](function(_0x42528a){var _0x2795e9=_[_0xb087('0x38')](_0x42528a,'id');var _0xa58050=[];var _0x5ef263=[];var _0x1a7486=squel[_0xb087('0x8d')]();_0x1a7486[_0xb087('0x8e')](_0xb087('0x8f'))[_0xb087('0x90')]('team_has_voice_prefixes','tq')[_0xb087('0x91')](_0xb087('0x92'),'ut',_0xb087('0x93'))[_0xb087('0x4c')]('VoicePrefixId\x20=\x20?',_0x44c8cb[_0xb087('0x73')]['id']);for(var _0x547968=0x0;_0x547968<_0x42528a[_0xb087('0x45')];_0x547968+=0x1){let _0x532682=_0x42528a[_0x547968];for(var _0x5f4312=0x0;_0x5f4312<_0x532682[_0xb087('0x86')][_0xb087('0x45')];_0x5f4312+=0x1){let _0x1cb959=_0x532682['Agents'][_0x5f4312];var _0x595faa=_0x1a7486[_0xb087('0x94')]();_0x595faa[_0xb087('0x4c')](_0xb087('0x95'),_0x1cb959['id']);_0x5ef263[_0xb087('0x6b')](db[_0xb087('0x53')]['query'](_0x595faa[_0xb087('0x96')](),{'type':db[_0xb087('0x53')][_0xb087('0x97')][_0xb087('0x98')]})[_0xb087('0x2f')](function(_0x14737){if(_0x14737['length']===0x1){return _0x1cb959['id'];}else{var _0x5777d0=_[_0xb087('0x99')](_[_0xb087('0x38')](_0x14737,'TeamId'),function(_0x1f28dd){return _['includes'](_0x2795e9,_0x1f28dd);});if(_0x5777d0){return _0x1cb959['id'];}}}));}}return BPromise['all'](_0x5ef263)[_0xb087('0x2f')](function(_0x3193c8){_0xa58050=_(_0xa58050)[_0xb087('0x9a')](_0x3193c8)[_0xb087('0x9b')]()[_0xb087('0x9c')]();return db[_0xb087('0x39')][_0xb087('0x50')]({'where':{'id':_0x44c8cb[_0xb087('0x73')]['id']}})[_0xb087('0x2f')](function(_0xff9c0c){return db['sequelize']['transaction'](function(_0x5e704a){return _0xff9c0c[_0xb087('0x9d')](_0x44c8cb['query'][_0xb087('0x75')],{'transaction':_0x5e704a})['then'](function(){if(!_['isEmpty'](_0xa58050)){return _0xff9c0c[_0xb087('0x77')](_0xa58050,{'transaction':_0x5e704a});}})[_0xb087('0x2f')](function(){_0xa58050[_0xb087('0x8b')](function(_0x170d9e){socket[_0xb087('0x79')](_0xb087('0x7a'),{'UserId':_0x170d9e,'VoicePrefixId':_0xff9c0c['id']});});});});});});})[_0xb087('0x2f')](respondWithStatusCode(_0x15bbda,null))[_0xb087('0x4e')](handleError(_0x15bbda,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index e9b6c9e..5b67f3e 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 _0xb41c=['events','../../mysqldb','VoicePrefix','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x445ff0,_0x71bcb4){var _0xf094a0=function(_0x3be058){while(--_0x3be058){_0x445ff0['push'](_0x445ff0['shift']());}};_0xf094a0(++_0x71bcb4);}(_0xb41c,0x6c));var _0xcb41=function(_0x5af92b,_0x3c411f){_0x5af92b=_0x5af92b-0x0;var _0x1b2373=_0xb41c[_0x5af92b];return _0x1b2373;};'use strict';var EventEmitter=require(_0xcb41('0x0'));var VoicePrefix=require(_0xcb41('0x1'))['db'][_0xcb41('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xcb41('0x3')](0x0);var events={'afterCreate':_0xcb41('0x4'),'afterUpdate':'update','afterDestroy':_0xcb41('0x5')};function emitEvent(_0x5a3cc3){return function(_0x5a2890,_0x3033e8,_0x513c2c){VoicePrefixEvents[_0xcb41('0x6')](_0x5a3cc3+':'+_0x5a2890['id'],_0x5a2890);VoicePrefixEvents[_0xcb41('0x6')](_0x5a3cc3,_0x5a2890);_0x513c2c(null);};}for(var e in events){if(events[_0xcb41('0x7')](e)){var event=events[e];VoicePrefix[_0xcb41('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x7c57=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','../../mysqldb','VoicePrefix'];(function(_0x31767b,_0x787958){var _0x290fc2=function(_0x20c64b){while(--_0x20c64b){_0x31767b['push'](_0x31767b['shift']());}};_0x290fc2(++_0x787958);}(_0x7c57,0x17e));var _0x77c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c57[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x77c5('0x0'))['db'][_0x77c5('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x77c5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x77c5('0x3'),'afterDestroy':_0x77c5('0x4')};function emitEvent(_0x44da1b){return function(_0x1bf3e6,_0x415d3a,_0x581e25){VoicePrefixEvents[_0x77c5('0x5')](_0x44da1b+':'+_0x1bf3e6['id'],_0x1bf3e6);VoicePrefixEvents['emit'](_0x44da1b,_0x1bf3e6);_0x581e25(null);};}for(var e in events){if(events[_0x77c5('0x6')](e)){var event=events[e];VoicePrefix[_0x77c5('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index dd82e09..d1124a1 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 _0x90e2=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes'];(function(_0x1673a0,_0x34cac8){var _0x59fd4c=function(_0x2a865e){while(--_0x2a865e){_0x1673a0['push'](_0x1673a0['shift']());}};_0x59fd4c(++_0x34cac8);}(_0x90e2,0x1ee));var _0x290e=function(_0x1255e1,_0x339642){_0x1255e1=_0x1255e1-0x0;var _0xbab0d=_0x90e2[_0x1255e1];return _0xbab0d;};'use strict';var _=require(_0x290e('0x0'));var util=require('util');var logger=require(_0x290e('0x1'))(_0x290e('0x2'));var moment=require(_0x290e('0x3'));var BPromise=require(_0x290e('0x4'));var rp=require(_0x290e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x290e('0x6'));var config=require(_0x290e('0x7'));var attributes=require(_0x290e('0x8'));module[_0x290e('0x9')]=function(_0x502532,_0x37a7d1){return _0x502532[_0x290e('0xa')](_0x290e('0xb'),attributes,{'tableName':_0x290e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f44=['./voicePrefix.attributes','exports','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x1f44,0xac));var _0x41f4=function(_0x1b2125,_0x1875e6){_0x1b2125=_0x1b2125-0x0;var _0x5cd920=_0x1f44[_0x1b2125];return _0x5cd920;};'use strict';var _=require(_0x41f4('0x0'));var util=require(_0x41f4('0x1'));var logger=require(_0x41f4('0x2'))('api');var moment=require(_0x41f4('0x3'));var BPromise=require(_0x41f4('0x4'));var rp=require(_0x41f4('0x5'));var fs=require('fs');var path=require(_0x41f4('0x6'));var rimraf=require('rimraf');var config=require(_0x41f4('0x7'));var attributes=require(_0x41f4('0x8'));module[_0x41f4('0x9')]=function(_0x1cee1e,_0x4158ba){return _0x1cee1e['define'](_0x41f4('0xa'),attributes,{'tableName':_0x41f4('0xb'),'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 4049377..8c33dc6 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 _0xd69e=['request\x20sent','error','code','message','info','catch','lodash','util','moment','randomstring','ioredis','../../config/environment','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','then','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s'];(function(_0x177fb8,_0x41bb55){var _0xa52dc2=function(_0x421c8f){while(--_0x421c8f){_0x177fb8['push'](_0x177fb8['shift']());}};_0xa52dc2(++_0x41bb55);}(_0xd69e,0xa0));var _0xed69=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xd69e[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xed69('0x0'));var util=require(_0xed69('0x1'));var moment=require(_0xed69('0x2'));var BPromise=require('bluebird');var rs=require(_0xed69('0x3'));var fs=require('fs');var Redis=require(_0xed69('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xed69('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xed69('0x6')]({'port':0x232a});config[_0xed69('0x7')]=_[_0xed69('0x8')](config[_0xed69('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xed69('0x9'))(new Redis(config['redis']));require(_0xed69('0xa'))[_0xed69('0xb')](socket);function respondWithRpcPromise(_0x47da53,_0x2dc08a,_0x1eb1f8){return new BPromise(function(_0x4ebc85,_0x51e609){return client['request'](_0x47da53,_0x1eb1f8)[_0xed69('0xc')](function(_0x218c3c){logger['info'](_0xed69('0xd'),_0x2dc08a,'request\x20sent');logger[_0xed69('0xe')](_0xed69('0xf'),_0x2dc08a,_0xed69('0x10'),JSON['stringify'](_0x218c3c));if(_0x218c3c['error']){if(_0x218c3c[_0xed69('0x11')][_0xed69('0x12')]===0x1f4){logger[_0xed69('0x11')](_0xed69('0xd'),_0x2dc08a,_0x218c3c[_0xed69('0x11')]['message']);return _0x51e609(_0x218c3c[_0xed69('0x11')][_0xed69('0x13')]);}logger[_0xed69('0x11')](_0xed69('0xd'),_0x2dc08a,_0x218c3c[_0xed69('0x11')][_0xed69('0x13')]);return _0x4ebc85(_0x218c3c[_0xed69('0x11')][_0xed69('0x13')]);}else{logger[_0xed69('0x14')](_0xed69('0xd'),_0x2dc08a,'request\x20sent');_0x4ebc85(_0x218c3c['result']['message']);}})[_0xed69('0x15')](function(_0x2cd704){logger[_0xed69('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x2dc08a,_0x2cd704);_0x51e609(_0x2cd704);});});} \ No newline at end of file +var _0xac6a=['localhost','socket.io-emitter','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x4a4ad1,_0x582f17){var _0x2121ed=function(_0x29c91d){while(--_0x29c91d){_0x4a4ad1['push'](_0x4a4ad1['shift']());}};_0x2121ed(++_0x582f17);}(_0xac6a,0xc2));var _0xaac6=function(_0x13f584,_0x3f916e){_0x13f584=_0x13f584-0x0;var _0x5ebee2=_0xac6a[_0x13f584];return _0x5ebee2;};'use strict';var _=require(_0xaac6('0x0'));var util=require(_0xaac6('0x1'));var moment=require(_0xaac6('0x2'));var BPromise=require(_0xaac6('0x3'));var rs=require(_0xaac6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaac6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaac6('0x6'))(_0xaac6('0x7'));var config=require(_0xaac6('0x8'));var jayson=require(_0xaac6('0x9'));var client=jayson[_0xaac6('0xa')][_0xaac6('0xb')]({'port':0x232a});config[_0xaac6('0xc')]=_[_0xaac6('0xd')](config[_0xaac6('0xc')],{'host':_0xaac6('0xe'),'port':0x18eb});var socket=require(_0xaac6('0xf'))(new Redis(config[_0xaac6('0xc')]));require('./voicePrefix.socket')[_0xaac6('0x10')](socket);function respondWithRpcPromise(_0x160834,_0x31fa92,_0x37c3ba){return new BPromise(function(_0x19345a,_0x2b9460){return client['request'](_0x160834,_0x37c3ba)[_0xaac6('0x11')](function(_0x1605a3){logger[_0xaac6('0x12')](_0xaac6('0x13'),_0x31fa92,_0xaac6('0x14'));logger['debug'](_0xaac6('0x15'),_0x31fa92,_0xaac6('0x14'),JSON['stringify'](_0x1605a3));if(_0x1605a3['error']){if(_0x1605a3[_0xaac6('0x16')][_0xaac6('0x17')]===0x1f4){logger[_0xaac6('0x16')](_0xaac6('0x13'),_0x31fa92,_0x1605a3[_0xaac6('0x16')][_0xaac6('0x18')]);return _0x2b9460(_0x1605a3[_0xaac6('0x16')][_0xaac6('0x18')]);}logger[_0xaac6('0x16')](_0xaac6('0x13'),_0x31fa92,_0x1605a3[_0xaac6('0x16')][_0xaac6('0x18')]);return _0x19345a(_0x1605a3['error']['message']);}else{logger[_0xaac6('0x12')](_0xaac6('0x13'),_0x31fa92,_0xaac6('0x14'));_0x19345a(_0x1605a3[_0xaac6('0x19')][_0xaac6('0x18')]);}})['catch'](function(_0x22d66e){logger[_0xaac6('0x16')](_0xaac6('0x13'),_0x31fa92,_0x22d66e);_0x2b9460(_0x22d66e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index f4804e9..b16d250 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 _0x0506=['emit','length','voicePrefix:','./voicePrefix.events','save','remove'];(function(_0x14f902,_0x458963){var _0x1610a4=function(_0x3155d1){while(--_0x3155d1){_0x14f902['push'](_0x14f902['shift']());}};_0x1610a4(++_0x458963);}(_0x0506,0x1d1));var _0x6050=function(_0xe0dd9a,_0x170c49){_0xe0dd9a=_0xe0dd9a-0x0;var _0x4ebecc=_0x0506[_0xe0dd9a];return _0x4ebecc;};'use strict';var VoicePrefixEvents=require(_0x6050('0x0'));var events=[_0x6050('0x1'),_0x6050('0x2'),'update'];function createListener(_0x52f82b,_0x5139c7){return function(_0x49a1ca){_0x5139c7[_0x6050('0x3')](_0x52f82b,_0x49a1ca);};}function removeListener(_0x58e2a9,_0x3cbb1f){return function(){VoicePrefixEvents['removeListener'](_0x58e2a9,_0x3cbb1f);};}exports['register']=function(_0xfd44cc){for(var _0x269be3=0x0,_0x2a3644=events[_0x6050('0x4')];_0x269be3<_0x2a3644;_0x269be3++){var _0x3512ba=events[_0x269be3];var _0xf64de5=createListener(_0x6050('0x5')+_0x3512ba,_0xfd44cc);VoicePrefixEvents['on'](_0x3512ba,_0xf64de5);}}; \ No newline at end of file +var _0x851a=['update','emit','register','length','voicePrefix:','./voicePrefix.events','remove'];(function(_0x51a1ae,_0x33c3b2){var _0x2bb8d8=function(_0xccc30a){while(--_0xccc30a){_0x51a1ae['push'](_0x51a1ae['shift']());}};_0x2bb8d8(++_0x33c3b2);}(_0x851a,0x19b));var _0xa851=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x851a[_0x2112d4];return _0x434972;};'use strict';var VoicePrefixEvents=require(_0xa851('0x0'));var events=['save',_0xa851('0x1'),_0xa851('0x2')];function createListener(_0x38707a,_0x52489c){return function(_0xd7442b){_0x52489c[_0xa851('0x3')](_0x38707a,_0xd7442b);};}function removeListener(_0x1b30dc,_0x3f317d){return function(){VoicePrefixEvents['removeListener'](_0x1b30dc,_0x3f317d);};}exports[_0xa851('0x4')]=function(_0x57a7c4){for(var _0x1cba67=0x0,_0x2fc0e0=events[_0xa851('0x5')];_0x1cba67<_0x2fc0e0;_0x1cba67++){var _0x551e16=events[_0x1cba67];var _0x3e1e9d=createListener(_0xa851('0x6')+_0x551e16,_0x57a7c4);VoicePrefixEvents['on'](_0x551e16,_0x3e1e9d);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 2401056..344dcd3 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(_0x1f997b,_0x316cc8){var _0xc879f2=function(_0x5e6da3){while(--_0x5e6da3){_0x1f997b['push'](_0x1f997b['shift']());}};_0xc879f2(++_0x316cc8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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(_0x1e48d3,_0x5d8c43){var _0x2852b1=function(_0x11d7b3){while(--_0x11d7b3){_0x1e48d3['push'](_0x1e48d3['shift']());}};_0x2852b1(++_0x5d8c43);}(_0xb10b,0x12a));var _0xbb10=function(_0x10b4b8,_0x450fea){_0x10b4b8=_0x10b4b8-0x0;var _0x424293=_0xb10b[_0x10b4b8];return _0x424293;};'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 8a6f693..fe459f2 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 _0x0be2=['ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','inbound','outbound','default','ENUM','ringall','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','type','getDataValue','dialMethod','roundrobin','predictive','INTEGER','yes','all','once','TEXT','periodic_announce','split','join','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','booked','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','UNSIGNED','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC'];(function(_0x22c700,_0x1f3f36){var _0x556c78=function(_0x9fac45){while(--_0x9fac45){_0x22c700['push'](_0x22c700['shift']());}};_0x556c78(++_0x1f3f36);}(_0x0be2,0x154));var _0x20be=function(_0x393500,_0x1037af){_0x393500=_0x393500-0x0;var _0x120d3b=_0x0be2[_0x393500];return _0x120d3b;};'use strict';var Sequelize=require(_0x20be('0x0'));module[_0x20be('0x1')]={'name':{'type':Sequelize[_0x20be('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x20be('0x3'),_0x20be('0x4')),'allowNull':![],'defaultValue':_0x20be('0x3')},'musiconhold':{'type':Sequelize[_0x20be('0x2')],'defaultValue':_0x20be('0x5')},'announce':{'type':Sequelize[_0x20be('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x20be('0x6')]('rr',_0x20be('0x7'),'leastrecent',_0x20be('0x8'),_0x20be('0x9'),_0x20be('0xa'),_0x20be('0xb'),_0x20be('0xc'),_0x20be('0xd')),'allowNull':![],'defaultValue':'ringall','set':function(_0xfa7518){this[_0x20be('0xe')](_0x20be('0xf'),_0xfa7518?_0xfa7518:_0x20be('0xa'));},'get':function(){var _0x2ccdaa=this['getDataValue'](_0x20be('0x10'));var _0x483b8b=this[_0x20be('0x11')](_0x20be('0x12'));var _0x4912b5=this[_0x20be('0x11')](_0x20be('0xf'));if(_0x2ccdaa===_0x20be('0x3')){return _0x4912b5;}if(_0x483b8b==='booked'&&_0x4912b5===_0x20be('0xa')||_0x483b8b==='booked'&&_0x4912b5===_0x20be('0x13')){return _0x4912b5;}if(_0x483b8b==='progressive'||_0x483b8b===_0x20be('0x14')||_0x483b8b==='power'){return _0x4912b5;}return null;}},'servicelevel':{'type':Sequelize[_0x20be('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x20be('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x20be('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x20be('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x20be('0x6')](_0x20be('0x16'),'no'),'defaultValue':_0x20be('0x16')},'autopause':{'type':Sequelize[_0x20be('0x6')](_0x20be('0x16'),'no',_0x20be('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x20be('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0x20be('0x6')](_0x20be('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x20be('0x6')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x20be('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x20be('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM']('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x20be('0x6')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x20be('0x6')](_0x20be('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x20be('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x20be('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x20be('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x20be('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x20be('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x20be('0x6')](_0x20be('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x20be('0x6')](_0x20be('0x16'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x20be('0x6')]('yes','no',_0x20be('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x20be('0x6')](_0x20be('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x20be('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x20be('0x6')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x20be('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x20be('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x20be('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x20be('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x20be('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x20be('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x20be('0x2')]},'queue_less_than':{'type':Sequelize[_0x20be('0x2')]},'periodic_announce':{'type':Sequelize[_0x20be('0x19')],'set':function(_0x1e99b8){this['setDataValue'](_0x20be('0x1a'),_0x1e99b8?_0x1e99b8['join'](','):[]);},'get':function(){return this[_0x20be('0x11')](_0x20be('0x1a'))?this['getDataValue'](_0x20be('0x1a'))[_0x20be('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x20be('0x2')],'defaultValue':_0x20be('0x16'),'set':function(_0xb9556a){this['setDataValue']('joinempty',_0xb9556a?_0xb9556a[_0x20be('0x1c')](','):undefined);},'get':function(){return this[_0x20be('0x11')](_0x20be('0x1d'))?this[_0x20be('0x11')](_0x20be('0x1d'))[_0x20be('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x20be('0x2')],'defaultValue':'no','set':function(_0x5ebf1b){this[_0x20be('0xe')](_0x20be('0x1e'),_0x5ebf1b?_0x5ebf1b['join'](','):undefined);},'get':function(){return this[_0x20be('0x11')](_0x20be('0x1e'))?this['getDataValue'](_0x20be('0x1e'))[_0x20be('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x20be('0x6')](_0x20be('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x20be('0x6')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x20be('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x20be('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x20be('0x2')]},'description':{'type':Sequelize[_0x20be('0x2')]},'acw':{'type':Sequelize[_0x20be('0x1f')],'defaultValue':0x0,'set':function(_0x427f3f){this[_0x20be('0xe')](_0x20be('0x20'),_0x427f3f);if(_0x427f3f){if(this[_0x20be('0x11')](_0x20be('0x21'))<0x2){this[_0x20be('0xe')](_0x20be('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x20be('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x20be('0x1f')],'defaultValue':0x0,'comment':_0x20be('0x22')},'dialMethod':{'type':Sequelize[_0x20be('0x6')]('preview',_0x20be('0x23'),_0x20be('0x24'),_0x20be('0x14'),_0x20be('0x25')),'defaultValue':'progressive','comment':_0x20be('0x26')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x20be('0x27')},'dialLimitQueue':{'type':Sequelize[_0x20be('0x15')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x20be('0x28')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x20be('0x29')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x20be('0x2a')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x20be('0x2b'),'dropRate'),'defaultValue':'dropRate','comment':_0x20be('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x20be('0x15')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x20be('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0x20be('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x20be('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x20be('0x15')](0x3)[_0x20be('0x29')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x20be('0x2e')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x20be('0x2f'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x20be('0x15')](0x3)[_0x20be('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x20be('0x30')},'dialQueueProject':{'type':Sequelize[_0x20be('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x20be('0x15')](0x3)[_0x20be('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x20be('0x15')](0x5)[_0x20be('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x20be('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x20be('0x15')](0x3)[_0x20be('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x20be('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x20be('0x15')](0x5)[_0x20be('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x20be('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x20be('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x20be('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x20be('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0x20be('0x15')](0x3)[_0x20be('0x29')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x20be('0x36')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x20be('0x2')],'defaultValue':_0x20be('0x37')},'dialPrefix':{'type':Sequelize[_0x20be('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x20be('0x6')](_0x20be('0x38'),_0x20be('0x39'),_0x20be('0x3a')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x20be('0x1f')],'defaultValue':0x0,'comment':_0x20be('0x3b')},'dialAMDInitialSilence':{'type':Sequelize[_0x20be('0x15')](0x9)[_0x20be('0x29')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x20be('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0x20be('0x15')](0x9)[_0x20be('0x29')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x20be('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x20be('0x15')](0x9)[_0x20be('0x29')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x20be('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x20be('0x15')](0x9)[_0x20be('0x29')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x20be('0x3f')},'dialAMDMinWordLength':{'type':Sequelize[_0x20be('0x15')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x20be('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x20be('0x15')](0x9)[_0x20be('0x29')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x20be('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x20be('0x15')](0x9)[_0x20be('0x29')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x20be('0x42')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x20be('0x15')](0x5)[_0x20be('0x29')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x20be('0x15')](0x9)[_0x20be('0x29')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x20be('0x29')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x20be('0x43')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x20be('0x44')},'dialOrderByScheduledAt':{'type':Sequelize[_0x20be('0x6')](_0x20be('0x45'),_0x20be('0x46')),'defaultValue':_0x20be('0x45')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x20be('0x47')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x20be('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x20be('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x20be('0x15')](0x3)[_0x20be('0x29')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x20be('0x48')},'dialCutDigit':{'type':Sequelize[_0x20be('0x15')](0x3)[_0x20be('0x29')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x20be('0x49')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x20be('0x15')](0x3)[_0x20be('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x20be('0x15')](0x5)[_0x20be('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x20be('0x15')](0x3)[_0x20be('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x20be('0x4a')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x20be('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x20be('0x4b')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x20be('0x15')](0x3)[_0x20be('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x20be('0x4c')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x20be('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x20be('0x4d')},'dialMachineRetryFrequency':{'type':Sequelize[_0x20be('0x15')](0x5)[_0x20be('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x20be('0x4e')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x20be('0x15')](0x3)[_0x20be('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x20be('0x4f')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x20be('0x15')](0x5)[_0x20be('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x20be('0x15')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x20be('0x1f')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5a9733){if(!_0x5a9733)this[_0x20be('0xe')](_0x20be('0x50'),null);this[_0x20be('0xe')](_0x20be('0x51'),_0x5a9733);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x20be('0x15')](0x3)[_0x20be('0x29')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x20be('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x20be('0x15')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x20be('0x1f')],'defaultValue':![]}}; \ No newline at end of file +var _0xce3f=['tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports','name','inbound','STRING','default','ringall','leastrecent','fewestcalls','linear','wrandom','rrordered','setDataValue','strategy','rrmemory','getDataValue','type','booked','roundrobin','progressive','predictive','power','INTEGER','ENUM','yes','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'];(function(_0x163b92,_0x31d23a){var _0x5e4b1a=function(_0x184f17){while(--_0x184f17){_0x163b92['push'](_0x163b92['shift']());}};_0x5e4b1a(++_0x31d23a);}(_0xce3f,0xca));var _0xfce3=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xce3f[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0xfce3('0x0'));module[_0xfce3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfce3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xfce3('0x3'),'outbound'),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0xfce3('0x4')],'defaultValue':_0xfce3('0x5')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xfce3('0x6'),_0xfce3('0x7'),_0xfce3('0x8'),'random','rrmemory',_0xfce3('0x9'),_0xfce3('0xa'),_0xfce3('0xb')),'allowNull':![],'defaultValue':_0xfce3('0x6'),'set':function(_0x2573bc){this[_0xfce3('0xc')](_0xfce3('0xd'),_0x2573bc?_0x2573bc:_0xfce3('0xe'));},'get':function(){var _0x1513bc=this[_0xfce3('0xf')](_0xfce3('0x10'));var _0x51a83e=this[_0xfce3('0xf')]('dialMethod');var _0x52531f=this['getDataValue'](_0xfce3('0xd'));if(_0x1513bc===_0xfce3('0x3')){return _0x52531f;}if(_0x51a83e===_0xfce3('0x11')&&_0x52531f===_0xfce3('0xe')||_0x51a83e===_0xfce3('0x11')&&_0x52531f===_0xfce3('0x12')){return _0x52531f;}if(_0x51a83e===_0xfce3('0x13')||_0x51a83e===_0xfce3('0x14')||_0x51a83e===_0xfce3('0x15')){return _0x52531f;}return null;}},'servicelevel':{'type':Sequelize[_0xfce3('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xfce3('0x16')](0xb)},'timeout':{'type':Sequelize[_0xfce3('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xfce3('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xfce3('0x4')]},'weight':{'type':Sequelize[_0xfce3('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xfce3('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xfce3('0x17')]('yes','no'),'defaultValue':_0xfce3('0x18')},'autopause':{'type':Sequelize['ENUM'](_0xfce3('0x18'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xfce3('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0xfce3('0x17')](_0xfce3('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xfce3('0x17')](_0xfce3('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xfce3('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xfce3('0x17')](_0xfce3('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xfce3('0x17')](_0xfce3('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xfce3('0x17')](_0xfce3('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xfce3('0x17')](_0xfce3('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xfce3('0x4')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xfce3('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xfce3('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xfce3('0x17')](_0xfce3('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xfce3('0x17')](_0xfce3('0x18'),'no'),'defaultValue':_0xfce3('0x18')},'announce_holdtime':{'type':Sequelize['ENUM'](_0xfce3('0x18'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xfce3('0x4')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xfce3('0x17')](_0xfce3('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0xfce3('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xfce3('0x17')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xfce3('0x4')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xfce3('0x4')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xfce3('0x4')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xfce3('0x4')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xfce3('0x4')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xfce3('0x4')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xfce3('0x4')]},'queue_quantity1':{'type':Sequelize[_0xfce3('0x4')]},'queue_quantity2':{'type':Sequelize[_0xfce3('0x4')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xfce3('0x4')]},'periodic_announce':{'type':Sequelize[_0xfce3('0x19')],'set':function(_0x734993){this[_0xfce3('0xc')](_0xfce3('0x1a'),_0x734993?_0x734993[_0xfce3('0x1b')](','):[]);},'get':function(){return this[_0xfce3('0xf')](_0xfce3('0x1a'))?this[_0xfce3('0xf')]('periodic_announce')[_0xfce3('0x1c')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xfce3('0x18'),'set':function(_0x3b9f48){this[_0xfce3('0xc')](_0xfce3('0x1d'),_0x3b9f48?_0x3b9f48[_0xfce3('0x1b')](','):undefined);},'get':function(){return this[_0xfce3('0xf')](_0xfce3('0x1d'))?this[_0xfce3('0xf')](_0xfce3('0x1d'))[_0xfce3('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xfce3('0x4')],'defaultValue':'no','set':function(_0x40bcb7){this['setDataValue'](_0xfce3('0x1e'),_0x40bcb7?_0x40bcb7[_0xfce3('0x1b')](','):undefined);},'get':function(){return this[_0xfce3('0xf')]('leavewhenempty')?this['getDataValue'](_0xfce3('0x1e'))[_0xfce3('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xfce3('0x17')](_0xfce3('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xfce3('0x17')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xfce3('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xfce3('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xfce3('0x4')]},'description':{'type':Sequelize[_0xfce3('0x4')]},'acw':{'type':Sequelize[_0xfce3('0x1f')],'defaultValue':0x0,'set':function(_0x261e69){this['setDataValue'](_0xfce3('0x20'),_0x261e69);if(_0x261e69){if(this[_0xfce3('0xf')](_0xfce3('0x21'))<0x2){this['setDataValue'](_0xfce3('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xfce3('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xfce3('0x22')},'dialMethod':{'type':Sequelize[_0xfce3('0x17')]('preview',_0xfce3('0x13'),_0xfce3('0x15'),'predictive','booked'),'defaultValue':'progressive','comment':_0xfce3('0x23')},'dialLimitChannel':{'type':Sequelize[_0xfce3('0x16')](0x4)[_0xfce3('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xfce3('0x25')},'dialLimitQueue':{'type':Sequelize[_0xfce3('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xfce3('0x26')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xfce3('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xfce3('0x27')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xfce3('0x28'),_0xfce3('0x29')),'defaultValue':_0xfce3('0x29'),'comment':_0xfce3('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xfce3('0x2b')](0x2)[_0xfce3('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xfce3('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0xfce3('0x16')](0x3)[_0xfce3('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xfce3('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xfce3('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0xfce3('0x16')](0x3)[_0xfce3('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfce3('0x2e')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0xfce3('0x2f'),'comment':_0xfce3('0x30')},'dialQueueTimeout':{'type':Sequelize[_0xfce3('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfce3('0x31')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xfce3('0x16')](0x3)[_0xfce3('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfce3('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xfce3('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfce3('0x33')},'dialBusyMaxRetry':{'type':Sequelize[_0xfce3('0x16')](0x3)[_0xfce3('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfce3('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0xfce3('0x16')](0x5)[_0xfce3('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfce3('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xfce3('0x16')](0x3)[_0xfce3('0x24')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfce3('0x36')},'dialGlobalMaxRetry':{'type':Sequelize[_0xfce3('0x16')](0x3)[_0xfce3('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xfce3('0x37')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xfce3('0x38')},'dialPrefix':{'type':Sequelize[_0xfce3('0x4')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xfce3('0x39'),_0xfce3('0x3a'),'onlyIfOpen'),'defaultValue':_0xfce3('0x39')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xfce3('0x3b')},'dialAMDInitialSilence':{'type':Sequelize[_0xfce3('0x16')](0x9)[_0xfce3('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xfce3('0x3c')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xfce3('0x16')](0x9)[_0xfce3('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xfce3('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xfce3('0x16')](0x9)[_0xfce3('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfce3('0x3e')},'dialAMDMinWordLength':{'type':Sequelize[_0xfce3('0x16')](0x9)[_0xfce3('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xfce3('0x3f')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xfce3('0x40')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xfce3('0x16')](0x9)[_0xfce3('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xfce3('0x41')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xfce3('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xfce3('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfce3('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0xfce3('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xfce3('0x43')},'dialRecallInQueue':{'type':Sequelize[_0xfce3('0x1f')],'defaultValue':0x0,'comment':_0xfce3('0x44')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xfce3('0x45'),'ASC'),'defaultValue':_0xfce3('0x45')},'dialQueueProject2':{'type':Sequelize[_0xfce3('0x4')],'comment':_0xfce3('0x46')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xfce3('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xfce3('0x16')](0x3)[_0xfce3('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfce3('0x47')},'dialCutDigit':{'type':Sequelize[_0xfce3('0x16')](0x3)[_0xfce3('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfce3('0x48')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfce3('0x49')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xfce3('0x16')](0x5)[_0xfce3('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfce3('0x4a')},'dialDropMaxRetry':{'type':Sequelize[_0xfce3('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfce3('0x4b')},'dialDropRetryFrequency':{'type':Sequelize[_0xfce3('0x16')](0x5)[_0xfce3('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xfce3('0x16')](0x3)[_0xfce3('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfce3('0x4c')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xfce3('0x16')](0x5)[_0xfce3('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xfce3('0x16')](0x3)[_0xfce3('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfce3('0x4d')},'dialMachineRetryFrequency':{'type':Sequelize[_0xfce3('0x16')](0x5)[_0xfce3('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xfce3('0x16')](0x3)[_0xfce3('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfce3('0x4e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xfce3('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfce3('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfce3('0x16')],'allowNull':!![],'comment':_0xfce3('0x50')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xfce3('0x51'),'set':function(_0x4aae7b){if(!_0x4aae7b)this['setDataValue'](_0xfce3('0x52'),null);this['setDataValue']('mandatoryDisposition',_0x4aae7b);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xfce3('0x16')](0x3)[_0xfce3('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xfce3('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xfce3('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xfce3('0x16')](0x3)[_0xfce3('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 5ed645d..efc3c21 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 _0x6808=['CmHopperId','OrderBy','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','get','VoiceQueues','inbound','QueueCampaigns','ignore','value','includes','type','find','name','UserProfileResource','destroy','end','error','stack','send','index','map','VoiceQueue','fieldName','key','model','query','filters','attributes','intersection','fields','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','outbound','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','UserProfileSection','getHoppers','findOne','CmHopper','hasOwnProperty','VoiceQueueId','getHopperHistories','CmHopperHistory','order','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','addTeams','Team','User','online','voicePause','interface','flatMap','penalty','Agents','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','forEach','emit','removeTeams','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','all','union','isEmpty','userVoiceQueue:remove','addAgents','ids','spread','SIP/%s','removeAgents','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','scheduledAt','CmListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6808,0xd1));var _0x8680=function(_0x334b15,_0x4283f0){_0x334b15=_0x334b15-0x0;var _0x1b368e=_0x6808[_0x334b15];return _0x1b368e;};'use strict';var emlformat=require(_0x8680('0x0'));var rimraf=require(_0x8680('0x1'));var zipdir=require(_0x8680('0x2'));var jsonpatch=require(_0x8680('0x3'));var rp=require(_0x8680('0x4'));var moment=require(_0x8680('0x5'));var BPromise=require(_0x8680('0x6'));var Mustache=require(_0x8680('0x7'));var util=require('util');var path=require(_0x8680('0x8'));var sox=require(_0x8680('0x9'));var csv=require(_0x8680('0xa'));var ejs=require(_0x8680('0xb'));var fs=require('fs');var fs_extra=require(_0x8680('0xc'));var _=require('lodash');var squel=require(_0x8680('0xd'));var crypto=require(_0x8680('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8680('0xa'));var querystring=require(_0x8680('0xf'));var Papa=require('papaparse');var Redis=require(_0x8680('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8680('0x11'));var logger=require(_0x8680('0x12'))(_0x8680('0x13'));var utils=require(_0x8680('0x14'));var config=require(_0x8680('0x15'));var licenseUtil=require(_0x8680('0x16'));var db=require(_0x8680('0x17'))['db'];config['redis']=_['defaults'](config[_0x8680('0x18')],{'host':_0x8680('0x19'),'port':0x18eb});var socket=require(_0x8680('0x1a'))(new Redis(config['redis']));require(_0x8680('0x1b'))[_0x8680('0x1c')](socket);function respondWithStatusCode(_0x3951ee,_0x36a2b9){_0x36a2b9=_0x36a2b9||0xcc;return function(_0x4707e6){if(_0x4707e6){return _0x3951ee[_0x8680('0x1d')](_0x36a2b9);}return _0x3951ee[_0x8680('0x1e')](_0x36a2b9)['end']();};}function respondWithResult(_0x42fb98,_0x5d6737){_0x5d6737=_0x5d6737||0xc8;return function(_0x2f5bcb){if(_0x2f5bcb){return _0x42fb98['status'](_0x5d6737)[_0x8680('0x1f')](_0x2f5bcb);}};}function respondWithFilteredResult(_0x3d2443,_0x5184ea){return function(_0x2b1d1f){if(_0x2b1d1f){var _0x90fbd7=typeof _0x5184ea[_0x8680('0x20')]==='undefined'&&typeof _0x5184ea['limit']===_0x8680('0x21');var _0x25929e=_0x2b1d1f[_0x8680('0x22')];var _0x1db50f=_0x90fbd7?0x0:_0x5184ea[_0x8680('0x20')];var _0x42938b=_0x90fbd7?_0x2b1d1f[_0x8680('0x22')]:_0x5184ea[_0x8680('0x20')]+_0x5184ea['limit'];var _0x29fdef;if(_0x42938b>=_0x25929e){_0x42938b=_0x25929e;_0x29fdef=0xc8;}else{_0x29fdef=0xce;}_0x3d2443['status'](_0x29fdef);return _0x3d2443[_0x8680('0x23')](_0x8680('0x24'),_0x1db50f+'-'+_0x42938b+'/'+_0x25929e)[_0x8680('0x1f')](_0x2b1d1f);}return null;};}function patchUpdates(_0x5b247a){return function(_0xc3977){try{jsonpatch[_0x8680('0x25')](_0xc3977,_0x5b247a,!![]);}catch(_0x25f5db){return BPromise[_0x8680('0x26')](_0x25f5db);}return _0xc3977[_0x8680('0x27')]();};}function saveUpdates(_0x692a22,_0x60feaf){return function(_0x20aec2){if(_0x20aec2){return _0x20aec2[_0x8680('0x28')](_0x692a22)[_0x8680('0x29')](function(_0xd6b559){return _0xd6b559;});}return null;};}function removeEntity(_0x12bf2a,_0x41e4a0){return function(_0x335c62){if(_0x335c62){return _0x335c62['destroy']()[_0x8680('0x29')](function(){var _0x5cb33c=_0x335c62[_0x8680('0x2a')]({'plain':!![]});var _0x2796d3=[{'name':_0x8680('0x2b'),'value':_0x8680('0x2c'),'ignore':![]},{'name':_0x8680('0x2d'),'value':'outbound','ignore':![]}];var _0x388856=_(_0x2796d3)['filter'](_0x8680('0x2e'))['map'](_0x8680('0x2f'))[_0x8680('0x2f')]();if(_[_0x8680('0x30')](_0x388856,_0x5cb33c[_0x8680('0x31')])){return;}var _0x1b5f8b=_[_0x8680('0x32')](_0x2796d3,[_0x8680('0x2f'),_0x5cb33c[_0x8680('0x31')]])[_0x8680('0x33')];return db[_0x8680('0x34')][_0x8680('0x35')]({'where':{'type':_0x1b5f8b,'resourceId':_0x5cb33c['id']}})['then'](function(){return _0x335c62;});})[_0x8680('0x29')](function(){_0x12bf2a[_0x8680('0x1e')](0xcc)[_0x8680('0x36')]();});}};}function handleEntityNotFound(_0x178ccf,_0x22efbe){return function(_0x1151aa){if(!_0x1151aa){_0x178ccf[_0x8680('0x1d')](0x194);}return _0x1151aa;};}function handleError(_0x5976eb,_0x52c9fa){_0x52c9fa=_0x52c9fa||0x1f4;return function(_0x212d2a){logger[_0x8680('0x37')](_0x212d2a[_0x8680('0x38')]);if(_0x212d2a[_0x8680('0x33')]){delete _0x212d2a[_0x8680('0x33')];}_0x5976eb[_0x8680('0x1e')](_0x52c9fa)[_0x8680('0x39')](_0x212d2a);};}exports[_0x8680('0x3a')]=function(_0x37a2fa,_0x1c3bac){var _0x53bfff={},_0x25cd62={},_0x4dc990={'count':0x0,'rows':[]};var _0x22c92d=_[_0x8680('0x3b')](db[_0x8680('0x3c')]['rawAttributes'],function(_0x512ab3){return{'name':_0x512ab3[_0x8680('0x3d')],'type':_0x512ab3[_0x8680('0x31')][_0x8680('0x3e')]};});_0x25cd62[_0x8680('0x3f')]=_[_0x8680('0x3b')](_0x22c92d,_0x8680('0x33'));_0x25cd62[_0x8680('0x40')]=_['keys'](_0x37a2fa[_0x8680('0x40')]);_0x25cd62[_0x8680('0x41')]=_['intersection'](_0x25cd62['model'],_0x25cd62[_0x8680('0x40')]);_0x53bfff[_0x8680('0x42')]=_[_0x8680('0x43')](_0x25cd62[_0x8680('0x3f')],qs[_0x8680('0x44')](_0x37a2fa[_0x8680('0x40')][_0x8680('0x44')]));_0x53bfff[_0x8680('0x42')]=_0x53bfff[_0x8680('0x42')]['length']?_0x53bfff['attributes']:_0x25cd62['model'];if(!_0x37a2fa[_0x8680('0x40')]['hasOwnProperty'](_0x8680('0x45'))){_0x53bfff['limit']=qs[_0x8680('0x46')](_0x37a2fa['query'][_0x8680('0x46')]);_0x53bfff[_0x8680('0x20')]=qs['offset'](_0x37a2fa['query'][_0x8680('0x20')]);}_0x53bfff['order']=qs[_0x8680('0x47')](_0x37a2fa[_0x8680('0x40')][_0x8680('0x47')]);_0x53bfff[_0x8680('0x48')]=qs[_0x8680('0x41')](_[_0x8680('0x49')](_0x37a2fa[_0x8680('0x40')],_0x25cd62[_0x8680('0x41')]),_0x22c92d);if(_0x37a2fa[_0x8680('0x40')][_0x8680('0x4a')]){_0x53bfff[_0x8680('0x48')]=_[_0x8680('0x4b')](_0x53bfff[_0x8680('0x48')],{'$or':_['map'](_0x22c92d,function(_0x4ae03a){if(_0x4ae03a[_0x8680('0x31')]!==_0x8680('0x4c')){var _0x17c57e={};_0x17c57e[_0x4ae03a['name']]={'$like':'%'+_0x37a2fa[_0x8680('0x40')][_0x8680('0x4a')]+'%'};return _0x17c57e;}})});}_0x53bfff=_[_0x8680('0x4b')]({},_0x53bfff,_0x37a2fa['options']);var _0x46cd16={'where':_0x53bfff[_0x8680('0x48')]};return db[_0x8680('0x3c')][_0x8680('0x22')](_0x46cd16)[_0x8680('0x29')](function(_0x1bac47){_0x4dc990[_0x8680('0x22')]=_0x1bac47;if(_0x37a2fa[_0x8680('0x40')][_0x8680('0x4d')]){_0x53bfff[_0x8680('0x4e')]=[{'all':!![]}];}return db[_0x8680('0x3c')][_0x8680('0x4f')](_0x53bfff);})[_0x8680('0x29')](function(_0xb2f530){_0x4dc990[_0x8680('0x50')]=_0xb2f530;return _0x4dc990;})[_0x8680('0x29')](respondWithFilteredResult(_0x1c3bac,_0x53bfff))[_0x8680('0x51')](handleError(_0x1c3bac,null));};exports[_0x8680('0x52')]=function(_0x313485,_0x1eec08){var _0x4018dc={'raw':![],'where':{'id':_0x313485[_0x8680('0x53')]['id']}},_0x34aba6={};_0x34aba6[_0x8680('0x3f')]=_[_0x8680('0x54')](db['VoiceQueue'][_0x8680('0x55')]);_0x34aba6[_0x8680('0x40')]=_[_0x8680('0x54')](_0x313485[_0x8680('0x40')]);_0x34aba6['filters']=_[_0x8680('0x43')](_0x34aba6['model'],_0x34aba6[_0x8680('0x40')]);_0x4018dc['attributes']=_[_0x8680('0x43')](_0x34aba6['model'],qs[_0x8680('0x44')](_0x313485[_0x8680('0x40')][_0x8680('0x44')]));_0x4018dc[_0x8680('0x42')]=_0x4018dc[_0x8680('0x42')][_0x8680('0x56')]?_0x4018dc[_0x8680('0x42')]:_0x34aba6[_0x8680('0x3f')];if(_0x313485['query'][_0x8680('0x4d')]){_0x4018dc['include']=[{'all':!![]}];}_0x4018dc=_['merge']({},_0x4018dc,_0x313485[_0x8680('0x57')]);return db['VoiceQueue']['find'](_0x4018dc)['then'](handleEntityNotFound(_0x1eec08,null))[_0x8680('0x29')](respondWithResult(_0x1eec08,null))[_0x8680('0x51')](handleError(_0x1eec08,null));};exports[_0x8680('0x58')]=function(_0x6167cc,_0x59aad8){return db['VoiceQueue'][_0x8680('0x58')](_0x6167cc[_0x8680('0x59')],{})[_0x8680('0x29')](function(_0x9708da){var _0x2ee047=_0x6167cc[_0x8680('0x5a')]['get']({'plain':!![]});if(!_0x2ee047)throw new Error(_0x8680('0x5b'));if(_0x2ee047['role']===_0x8680('0x5a')){var _0xaf9229=_0x9708da['get']({'plain':!![]});var _0x450910=[{'name':_0x8680('0x2b'),'value':_0x8680('0x2c')},{'name':'QueueCampaigns','value':_0x8680('0x5c')}];var _0x5197a8=_[_0x8680('0x32')](_0x450910,[_0x8680('0x2f'),_0xaf9229[_0x8680('0x31')]])[_0x8680('0x33')];return db['UserProfileSection'][_0x8680('0x32')]({'where':{'name':_0x5197a8,'userProfileId':_0x2ee047[_0x8680('0x5d')]},'raw':!![]})['then'](function(_0x5adc32){if(_0x5adc32&&_0x5adc32[_0x8680('0x5e')]===0x0){return db[_0x8680('0x34')][_0x8680('0x58')]({'name':_0xaf9229[_0x8680('0x33')],'resourceId':_0xaf9229['id'],'type':_0x5adc32[_0x8680('0x33')],'sectionId':_0x5adc32['id']},{})[_0x8680('0x29')](function(){return _0x9708da;});}else{return _0x9708da;}})[_0x8680('0x51')](function(_0x1c69af){logger[_0x8680('0x37')](_0x8680('0x5f'),_0x1c69af);throw _0x1c69af;});}return _0x9708da;})[_0x8680('0x29')](respondWithResult(_0x59aad8,0xc9))[_0x8680('0x51')](handleError(_0x59aad8,null));};exports[_0x8680('0x60')]=function(_0x365d2c,_0x14155c){var _0x4d81e6={'where':{'id':_0x365d2c[_0x8680('0x53')]['id']}},_0x30244b={};_0x30244b[_0x8680('0x3f')]=_[_0x8680('0x54')](db[_0x8680('0x3c')]['rawAttributes']);_0x4d81e6[_0x8680('0x42')]=_[_0x8680('0x43')](_0x30244b['model'],qs[_0x8680('0x44')](_0x365d2c['query'][_0x8680('0x44')]));_0x4d81e6[_0x8680('0x42')]=_0x4d81e6[_0x8680('0x42')][_0x8680('0x56')]?_0x4d81e6[_0x8680('0x42')]:_0x30244b[_0x8680('0x3f')];if(_0x365d2c[_0x8680('0x40')][_0x8680('0x4d')]){_0x4d81e6['include']=[{'all':!![]}];}_0x4d81e6=_[_0x8680('0x4b')]({},_0x4d81e6,_0x365d2c[_0x8680('0x57')]);return db[_0x8680('0x3c')][_0x8680('0x32')](_0x4d81e6)[_0x8680('0x29')](handleEntityNotFound(_0x14155c,null))[_0x8680('0x29')](function(_0x1718c5){if(_0x1718c5){var _0x4c07d4=_0x1718c5['get']({'plain':!![]});_0x4c07d4=qs['omit'](_0x4c07d4,['id',_0x8680('0x61'),_0x8680('0x62')]);_0x365d2c[_0x8680('0x59')]=_[_0x8680('0x63')](_0x365d2c[_0x8680('0x59')],['id',_0x8680('0x61'),'updatedAt']);return db[_0x8680('0x3c')][_0x8680('0x58')](_[_0x8680('0x4b')](_0x4c07d4,_0x365d2c[_0x8680('0x59')]),{'include':_0x365d2c[_0x8680('0x40')][_0x8680('0x4d')]?[{'all':!![]}]:undefined})[_0x8680('0x29')](function(_0x5ab00d){var _0x401200=_0x365d2c[_0x8680('0x5a')][_0x8680('0x2a')]({'plain':!![]});if(!_0x401200)throw new Error(_0x8680('0x5b'));if(_0x401200['role']===_0x8680('0x5a')){var _0x92568=_0x5ab00d[_0x8680('0x2a')]({'plain':!![]});var _0x3b865e=[{'name':_0x8680('0x2b'),'value':_0x8680('0x2c')},{'name':_0x8680('0x2d'),'value':_0x8680('0x5c')}];var _0x43bae5=_[_0x8680('0x32')](_0x3b865e,[_0x8680('0x2f'),_0x92568[_0x8680('0x31')]])['name'];return db[_0x8680('0x64')][_0x8680('0x32')]({'where':{'name':_0x43bae5,'userProfileId':_0x401200[_0x8680('0x5d')]},'raw':!![]})[_0x8680('0x29')](function(_0x56ad05){if(_0x56ad05&&_0x56ad05['autoAssociation']===0x0){return db[_0x8680('0x34')][_0x8680('0x58')]({'name':_0x92568[_0x8680('0x33')],'resourceId':_0x92568['id'],'type':_0x56ad05[_0x8680('0x33')],'sectionId':_0x56ad05['id']},{})[_0x8680('0x29')](function(){return _0x5ab00d;});}else{return _0x5ab00d;}})['catch'](function(_0x5d728c){logger[_0x8680('0x37')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d728c);throw _0x5d728c;});}return _0x5ab00d;});}})['then'](respondWithResult(_0x14155c,0xc9))['catch'](handleError(_0x14155c,null));};exports['update']=function(_0x4e42c6,_0x372922){if(_0x4e42c6['body']['id']){delete _0x4e42c6['body']['id'];}return db[_0x8680('0x3c')][_0x8680('0x32')]({'where':{'id':_0x4e42c6[_0x8680('0x53')]['id']}})['then'](handleEntityNotFound(_0x372922,null))['then'](saveUpdates(_0x4e42c6[_0x8680('0x59')],null))['then'](respondWithResult(_0x372922,null))[_0x8680('0x51')](handleError(_0x372922,null));};exports[_0x8680('0x35')]=function(_0x1d1d85,_0x17e3da){return db[_0x8680('0x3c')][_0x8680('0x32')]({'where':{'id':_0x1d1d85['params']['id']}})[_0x8680('0x29')](handleEntityNotFound(_0x17e3da,null))[_0x8680('0x29')](removeEntity(_0x17e3da,null))['catch'](handleError(_0x17e3da,null));};exports[_0x8680('0x65')]=function(_0x783887,_0x226c0e,_0x54105){var _0x5bf158={'raw':![],'where':{}};var _0x498d5a={};var _0xa6e032={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x8680('0x66')]({'where':{'id':_0x783887[_0x8680('0x53')]['id']}})['then'](handleEntityNotFound(_0x226c0e,null))['then'](function(_0x3f1ef5){if(_0x3f1ef5){_0x498d5a['model']=_['keys'](db[_0x8680('0x67')]['rawAttributes']);_0x498d5a[_0x8680('0x40')]=_['keys'](_0x783887[_0x8680('0x40')]);_0x498d5a[_0x8680('0x41')]=_[_0x8680('0x43')](_0x498d5a[_0x8680('0x3f')],_0x498d5a[_0x8680('0x40')]);_0x5bf158[_0x8680('0x42')]=_[_0x8680('0x43')](_0x498d5a['model'],qs[_0x8680('0x44')](_0x783887[_0x8680('0x40')][_0x8680('0x44')]));_0x5bf158[_0x8680('0x42')]=_0x5bf158['attributes'][_0x8680('0x56')]?_0x5bf158[_0x8680('0x42')]:_0x498d5a['model'];if(!_0x783887['query'][_0x8680('0x68')](_0x8680('0x45'))){_0x5bf158[_0x8680('0x46')]=qs[_0x8680('0x46')](_0x783887[_0x8680('0x40')]['limit']);_0x5bf158[_0x8680('0x20')]=qs[_0x8680('0x20')](_0x783887['query']['offset']);}_0x5bf158['order']=qs['sort'](_0x783887[_0x8680('0x40')][_0x8680('0x47')]);_0x5bf158['where']=qs[_0x8680('0x41')](_[_0x8680('0x49')](_0x783887[_0x8680('0x40')],_0x498d5a['filters']));_0x5bf158[_0x8680('0x48')][_0x8680('0x69')]=_0x3f1ef5['id'];if(_0x783887[_0x8680('0x40')]['filter']){_0x5bf158[_0x8680('0x48')]=_[_0x8680('0x4b')](_0x5bf158[_0x8680('0x48')],{'$or':_[_0x8680('0x3b')](_0x5bf158[_0x8680('0x42')],function(_0x171c86){var _0x436d8b={};_0x436d8b[_0x171c86]={'$like':'%'+_0x783887[_0x8680('0x40')][_0x8680('0x4a')]+'%'};return _0x436d8b;})});}_0x5bf158=_[_0x8680('0x4b')]({},_0x5bf158,_0x783887[_0x8680('0x57')]);return db[_0x8680('0x67')][_0x8680('0x22')]({'where':_0x5bf158['where']})[_0x8680('0x29')](function(_0x294065){_0xa6e032[_0x8680('0x22')]=_0x294065;if(_0x783887['query']['includeAll']){_0x5bf158['include']=[{'all':!![]}];}return db[_0x8680('0x67')]['findAll'](_0x5bf158);})[_0x8680('0x29')](function(_0x7af89d){_0xa6e032[_0x8680('0x50')]=_0x7af89d;return _0xa6e032;});}})['then'](respondWithFilteredResult(_0x226c0e,_0x5bf158))[_0x8680('0x51')](handleError(_0x226c0e,null));};exports[_0x8680('0x6a')]=function(_0x5827f9,_0x19a580,_0x3556d5){var _0x993198={'raw':!![],'where':{}};var _0xf5dcff={};var _0x2e6b41={'count':0x0,'rows':[]};return db[_0x8680('0x3c')][_0x8680('0x66')]({'where':{'id':_0x5827f9[_0x8680('0x53')]['id']}})[_0x8680('0x29')](handleEntityNotFound(_0x19a580,null))[_0x8680('0x29')](function(_0x271431){if(_0x271431){_0xf5dcff[_0x8680('0x3f')]=_['keys'](db[_0x8680('0x6b')][_0x8680('0x55')]);_0xf5dcff[_0x8680('0x40')]=_[_0x8680('0x54')](_0x5827f9[_0x8680('0x40')]);_0xf5dcff[_0x8680('0x41')]=_['intersection'](_0xf5dcff[_0x8680('0x3f')],_0xf5dcff[_0x8680('0x40')]);_0x993198[_0x8680('0x42')]=_['intersection'](_0xf5dcff[_0x8680('0x3f')],qs[_0x8680('0x44')](_0x5827f9[_0x8680('0x40')][_0x8680('0x44')]));_0x993198['attributes']=_0x993198[_0x8680('0x42')][_0x8680('0x56')]?_0x993198[_0x8680('0x42')]:_0xf5dcff['model'];if(!_0x5827f9['query']['hasOwnProperty'](_0x8680('0x45'))){_0x993198[_0x8680('0x46')]=qs['limit'](_0x5827f9[_0x8680('0x40')][_0x8680('0x46')]);_0x993198[_0x8680('0x20')]=qs[_0x8680('0x20')](_0x5827f9['query'][_0x8680('0x20')]);}_0x993198[_0x8680('0x6c')]=qs[_0x8680('0x47')](_0x5827f9[_0x8680('0x40')][_0x8680('0x47')]);_0x993198[_0x8680('0x48')]=qs['filters'](_['pick'](_0x5827f9[_0x8680('0x40')],_0xf5dcff[_0x8680('0x41')]));_0x993198[_0x8680('0x48')][_0x8680('0x69')]=_0x271431['id'];if(_0x5827f9['query'][_0x8680('0x4a')]){_0x993198[_0x8680('0x48')]=_[_0x8680('0x4b')](_0x993198['where'],{'$or':_['map'](_0x993198[_0x8680('0x42')],function(_0x1d2de5){var _0xce5257={};_0xce5257[_0x1d2de5]={'$like':'%'+_0x5827f9[_0x8680('0x40')][_0x8680('0x4a')]+'%'};return _0xce5257;})});}_0x993198=_[_0x8680('0x4b')]({},_0x993198,_0x5827f9[_0x8680('0x57')]);return db[_0x8680('0x6b')][_0x8680('0x22')]({'where':_0x993198[_0x8680('0x48')]})[_0x8680('0x29')](function(_0x5892f8){_0x2e6b41[_0x8680('0x22')]=_0x5892f8;if(_0x5827f9['query']['includeAll']){_0x993198[_0x8680('0x4e')]=[{'all':!![]}];}return db[_0x8680('0x6b')]['findAll'](_0x993198);})[_0x8680('0x29')](function(_0x212b44){_0x2e6b41['rows']=_0x212b44;return _0x2e6b41;});}})[_0x8680('0x29')](respondWithFilteredResult(_0x19a580,_0x993198))['catch'](handleError(_0x19a580,null));};exports[_0x8680('0x6d')]=function(_0x5e00cf,_0x2cb9ea,_0x722170){var _0x491a5e={'raw':!![],'where':{}};var _0x388121={};var _0x22bf29={'count':0x0,'rows':[]};return db[_0x8680('0x3c')]['findOne']({'where':{'id':_0x5e00cf[_0x8680('0x53')]['id']}})[_0x8680('0x29')](handleEntityNotFound(_0x2cb9ea,null))['then'](function(_0xba65b1){if(_0xba65b1){_0x388121['model']=_['keys'](db[_0x8680('0x6e')][_0x8680('0x55')]);_0x388121[_0x8680('0x40')]=_[_0x8680('0x54')](_0x5e00cf[_0x8680('0x40')]);_0x388121[_0x8680('0x41')]=_[_0x8680('0x43')](_0x388121[_0x8680('0x3f')],_0x388121[_0x8680('0x40')]);_0x491a5e[_0x8680('0x42')]=_[_0x8680('0x43')](_0x388121[_0x8680('0x3f')],qs[_0x8680('0x44')](_0x5e00cf['query'][_0x8680('0x44')]));_0x491a5e[_0x8680('0x42')]=_0x491a5e[_0x8680('0x42')][_0x8680('0x56')]?_0x491a5e[_0x8680('0x42')]:_0x388121[_0x8680('0x3f')];if(!_0x5e00cf[_0x8680('0x40')][_0x8680('0x68')](_0x8680('0x45'))){_0x491a5e['limit']=qs['limit'](_0x5e00cf[_0x8680('0x40')]['limit']);_0x491a5e['offset']=qs['offset'](_0x5e00cf[_0x8680('0x40')][_0x8680('0x20')]);}_0x491a5e[_0x8680('0x6c')]=qs[_0x8680('0x47')](_0x5e00cf[_0x8680('0x40')]['sort']);_0x491a5e[_0x8680('0x48')]=qs[_0x8680('0x41')](_['pick'](_0x5e00cf[_0x8680('0x40')],_0x388121[_0x8680('0x41')]));_0x491a5e[_0x8680('0x48')][_0x8680('0x69')]=_0xba65b1['id'];if(_0x5e00cf['query'][_0x8680('0x4a')]){_0x491a5e['where']=_['merge'](_0x491a5e[_0x8680('0x48')],{'$or':_[_0x8680('0x3b')](_0x491a5e[_0x8680('0x42')],function(_0x433182){var _0x434b17={};_0x434b17[_0x433182]={'$like':'%'+_0x5e00cf[_0x8680('0x40')][_0x8680('0x4a')]+'%'};return _0x434b17;})});}_0x491a5e=_['merge']({},_0x491a5e,_0x5e00cf[_0x8680('0x57')]);return db[_0x8680('0x6e')][_0x8680('0x22')]({'where':_0x491a5e[_0x8680('0x48')]})['then'](function(_0x4c89cb){_0x22bf29[_0x8680('0x22')]=_0x4c89cb;if(_0x5e00cf[_0x8680('0x40')]['includeAll']){_0x491a5e['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x491a5e);})['then'](function(_0x80459){_0x22bf29['rows']=_0x80459;return _0x22bf29;});}})[_0x8680('0x29')](respondWithFilteredResult(_0x2cb9ea,_0x491a5e))['catch'](handleError(_0x2cb9ea,null));};exports['getHopperBlacks']=function(_0x312791,_0x1521bb,_0x5e7dfd){var _0xe91494={'raw':!![],'where':{}};var _0x2cea18={};var _0x3771c0={'count':0x0,'rows':[]};return db[_0x8680('0x3c')]['findOne']({'where':{'id':_0x312791[_0x8680('0x53')]['id']}})[_0x8680('0x29')](handleEntityNotFound(_0x1521bb,null))[_0x8680('0x29')](function(_0x506955){if(_0x506955){_0x2cea18[_0x8680('0x3f')]=_[_0x8680('0x54')](db[_0x8680('0x6f')][_0x8680('0x55')]);_0x2cea18[_0x8680('0x40')]=_[_0x8680('0x54')](_0x312791['query']);_0x2cea18['filters']=_[_0x8680('0x43')](_0x2cea18['model'],_0x2cea18[_0x8680('0x40')]);_0xe91494['attributes']=_[_0x8680('0x43')](_0x2cea18[_0x8680('0x3f')],qs['fields'](_0x312791[_0x8680('0x40')][_0x8680('0x44')]));_0xe91494[_0x8680('0x42')]=_0xe91494[_0x8680('0x42')][_0x8680('0x56')]?_0xe91494[_0x8680('0x42')]:_0x2cea18[_0x8680('0x3f')];if(!_0x312791[_0x8680('0x40')][_0x8680('0x68')](_0x8680('0x45'))){_0xe91494[_0x8680('0x46')]=qs[_0x8680('0x46')](_0x312791['query'][_0x8680('0x46')]);_0xe91494[_0x8680('0x20')]=qs[_0x8680('0x20')](_0x312791['query'][_0x8680('0x20')]);}_0xe91494[_0x8680('0x6c')]=qs[_0x8680('0x47')](_0x312791['query'][_0x8680('0x47')]);_0xe91494['where']=qs[_0x8680('0x41')](_[_0x8680('0x49')](_0x312791[_0x8680('0x40')],_0x2cea18[_0x8680('0x41')]));_0xe91494[_0x8680('0x48')][_0x8680('0x69')]=_0x506955['id'];if(_0x312791[_0x8680('0x40')][_0x8680('0x4a')]){_0xe91494[_0x8680('0x48')]=_[_0x8680('0x4b')](_0xe91494[_0x8680('0x48')],{'$or':_[_0x8680('0x3b')](_0xe91494['attributes'],function(_0x4d9efa){var _0x5ef9cf={};_0x5ef9cf[_0x4d9efa]={'$like':'%'+_0x312791[_0x8680('0x40')][_0x8680('0x4a')]+'%'};return _0x5ef9cf;})});}_0xe91494=_['merge']({},_0xe91494,_0x312791[_0x8680('0x57')]);return db[_0x8680('0x6f')][_0x8680('0x22')]({'where':_0xe91494['where']})[_0x8680('0x29')](function(_0x55b519){_0x3771c0[_0x8680('0x22')]=_0x55b519;if(_0x312791[_0x8680('0x40')][_0x8680('0x4d')]){_0xe91494['include']=[{'all':!![]}];}return db[_0x8680('0x6f')][_0x8680('0x4f')](_0xe91494);})[_0x8680('0x29')](function(_0x4ad27e){_0x3771c0['rows']=_0x4ad27e;return _0x3771c0;});}})[_0x8680('0x29')](respondWithFilteredResult(_0x1521bb,_0xe91494))['catch'](handleError(_0x1521bb,null));};exports[_0x8680('0x70')]=function(_0x41e373,_0x555d92,_0x3cf5fd){var _0x4bf456={};var _0x270822={};var _0x44fa78;var _0x3097a6;return db['VoiceQueue']['findOne']({'where':{'id':_0x41e373[_0x8680('0x53')]['id']}})['then'](handleEntityNotFound(_0x555d92,null))[_0x8680('0x29')](function(_0x276c36){if(_0x276c36){_0x44fa78=_0x276c36;_0x270822[_0x8680('0x3f')]=_['keys'](db['Team'][_0x8680('0x55')]);_0x270822[_0x8680('0x40')]=_[_0x8680('0x54')](_0x41e373[_0x8680('0x40')]);_0x270822[_0x8680('0x41')]=_[_0x8680('0x43')](_0x270822[_0x8680('0x3f')],_0x270822[_0x8680('0x40')]);_0x4bf456[_0x8680('0x42')]=_[_0x8680('0x43')](_0x270822['model'],qs[_0x8680('0x44')](_0x41e373[_0x8680('0x40')][_0x8680('0x44')]));_0x4bf456[_0x8680('0x42')]=_0x4bf456[_0x8680('0x42')][_0x8680('0x56')]?_0x4bf456['attributes']:_0x270822[_0x8680('0x3f')];_0x4bf456['order']=qs[_0x8680('0x47')](_0x41e373[_0x8680('0x40')]['sort']);_0x4bf456[_0x8680('0x48')]=qs[_0x8680('0x41')](_[_0x8680('0x49')](_0x41e373[_0x8680('0x40')],_0x270822[_0x8680('0x41')]));if(_0x41e373[_0x8680('0x40')][_0x8680('0x4a')]){_0x4bf456[_0x8680('0x48')]=_[_0x8680('0x4b')](_0x4bf456['where'],{'$or':_['map'](_0x4bf456[_0x8680('0x42')],function(_0x71ede4){var _0x44c76e={};_0x44c76e[_0x71ede4]={'$like':'%'+_0x41e373[_0x8680('0x40')]['filter']+'%'};return _0x44c76e;})});}_0x4bf456=_[_0x8680('0x4b')]({},_0x4bf456,_0x41e373[_0x8680('0x57')]);return _0x44fa78[_0x8680('0x70')](_0x4bf456);}})['then'](function(_0x59795f){if(_0x59795f){_0x3097a6=_0x59795f[_0x8680('0x56')];if(!_0x41e373[_0x8680('0x40')][_0x8680('0x68')](_0x8680('0x45'))){_0x4bf456[_0x8680('0x46')]=qs[_0x8680('0x46')](_0x41e373[_0x8680('0x40')][_0x8680('0x46')]);_0x4bf456[_0x8680('0x20')]=qs[_0x8680('0x20')](_0x41e373[_0x8680('0x40')][_0x8680('0x20')]);}return _0x44fa78[_0x8680('0x70')](_0x4bf456);}})[_0x8680('0x29')](function(_0x1141be){if(_0x1141be){return _0x1141be?{'count':_0x3097a6,'rows':_0x1141be}:null;}})[_0x8680('0x29')](respondWithResult(_0x555d92,null))[_0x8680('0x51')](handleError(_0x555d92,null));};exports[_0x8680('0x71')]=function(_0x5de1bc,_0x534adb,_0x3d0e83){var _0x350885=_0x5de1bc['body']['teams'];var _0x5157a3=_[_0x8680('0x3b')](_0x350885,'id');return db[_0x8680('0x72')]['findAll']({'where':{'id':_0x5157a3},'attributes':['id'],'include':[{'model':db[_0x8680('0x73')],'as':'Agents','attributes':['id','name',_0x8680('0x74'),_0x8680('0x75'),_0x8680('0x76')],'raw':!![]}]})[_0x8680('0x29')](function(_0x27b809){if(_0x27b809){var _0xaa6857=_[_0x8680('0x77')](_0x27b809,function(_0x320194){var _0x2308de=_0x320194[_0x8680('0x2a')]({'plain':!![]});_0x2308de['Agents']['forEach'](function(_0x12f514){_0x12f514[_0x8680('0x78')]=_[_0x8680('0x32')](_0x350885,{'id':_0x2308de['id']})[_0x8680('0x78')];});return _0x2308de[_0x8680('0x79')];});return db[_0x8680('0x3c')]['find']({'where':{'id':_0x5de1bc[_0x8680('0x53')]['id']}})[_0x8680('0x29')](function(_0x2b0040){return db[_0x8680('0x7a')][_0x8680('0x7b')](function(_0x337bd7){return _0x2b0040[_0x8680('0x71')](_0x5157a3,{'transaction':_0x337bd7})[_0x8680('0x29')](function(){return BPromise[_0x8680('0x7c')](_0x350885,function(_0x569954){return db[_0x8680('0x7d')][_0x8680('0x7e')]({'TeamId':_0x569954['id'],'VoiceQueueId':_0x5de1bc[_0x8680('0x53')]['id'],'penalty':_0x569954[_0x8680('0x78')]},{'transaction':_0x337bd7});});})[_0x8680('0x29')](function(){return BPromise[_0x8680('0x7c')](_0xaa6857,function(_0x4afcfa){return db['UserVoiceQueue'][_0x8680('0x7f')]({'where':{'UserId':_0x4afcfa['id'],'VoiceQueueId':_0x5de1bc[_0x8680('0x53')]['id']},'defaults':{'penalty':_0x4afcfa[_0x8680('0x78')]},'transaction':_0x337bd7});});})[_0x8680('0x29')](function(){return BPromise[_0x8680('0x7c')](_[_0x8680('0x4a')](_0xaa6857,{'online':!![]}),function(_0x488d32){return db[_0x8680('0x80')]['upsert']({'membername':_0x488d32[_0x8680('0x33')],'UserId':_0x488d32['id'],'queue_name':_0x2b0040['name'],'VoiceQueueId':_0x2b0040['id'],'interface':_[_0x8680('0x81')](_0x488d32[_0x8680('0x76')])?util[_0x8680('0x82')]('SIP/%s',_0x488d32['name']):_0x488d32[_0x8680('0x76')],'paused':_0x488d32[_0x8680('0x75')]||![],'penalty':_0x488d32[_0x8680('0x78')]},{'transaction':_0x337bd7});});})[_0x8680('0x29')](function(){_0xaa6857[_0x8680('0x83')](function(_0x31f742){socket[_0x8680('0x84')]('userVoiceQueue:save',{'UserId':_0x31f742['id'],'VoiceQueueId':_0x2b0040['id']});});});});});}})[_0x8680('0x29')](respondWithStatusCode(_0x534adb,null))[_0x8680('0x51')](handleError(_0x534adb,null));};exports[_0x8680('0x85')]=function(_0x1043b3,_0x2828ac,_0x41a00f){return db['Team'][_0x8680('0x4f')]({'where':{'id':_0x1043b3[_0x8680('0x40')]['ids']},'attributes':['id'],'include':[{'model':db[_0x8680('0x73')],'as':_0x8680('0x79'),'attributes':['id'],'raw':!![]}]})[_0x8680('0x29')](handleEntityNotFound(_0x2828ac,null))[_0x8680('0x29')](function(_0x5476d5){var _0x1af97c=_['map'](_0x5476d5,'id');var _0x37dfff=[];var _0x27ff16=[];var _0x52e4af=squel['select']();_0x52e4af[_0x8680('0x86')](_0x8680('0x87'))[_0x8680('0x88')](_0x8680('0x89'),'tq')[_0x8680('0x8a')](_0x8680('0x8b'),'ut',_0x8680('0x8c'))[_0x8680('0x48')]('VoiceQueueId\x20=\x20?',_0x1043b3['params']['id']);for(var _0x145fd2=0x0;_0x145fd2<_0x5476d5[_0x8680('0x56')];_0x145fd2+=0x1){let _0x5b6746=_0x5476d5[_0x145fd2];for(var _0x22fdaa=0x0;_0x22fdaa<_0x5b6746[_0x8680('0x79')][_0x8680('0x56')];_0x22fdaa+=0x1){let _0xec466d=_0x5b6746['Agents'][_0x22fdaa];var _0x48e782=_0x52e4af[_0x8680('0x60')]();_0x48e782[_0x8680('0x48')](_0x8680('0x8d'),_0xec466d['id']);_0x27ff16[_0x8680('0x8e')](db[_0x8680('0x7a')][_0x8680('0x40')](_0x48e782[_0x8680('0x8f')](),{'type':db[_0x8680('0x7a')][_0x8680('0x90')][_0x8680('0x91')]})[_0x8680('0x29')](function(_0x1dfe31){if(_0x1dfe31[_0x8680('0x56')]===0x1){return _0xec466d['id'];}else{var _0x413ff6=_['every'](_[_0x8680('0x3b')](_0x1dfe31,'TeamId'),function(_0x4c69df){return _[_0x8680('0x30')](_0x1af97c,_0x4c69df);});if(_0x413ff6){return _0xec466d['id'];}}}));}}return BPromise[_0x8680('0x92')](_0x27ff16)[_0x8680('0x29')](function(_0x1d970e){_0x37dfff=_(_0x37dfff)[_0x8680('0x93')](_0x1d970e)['compact']()[_0x8680('0x2f')]();return db['VoiceQueue']['find']({'where':{'id':_0x1043b3['params']['id']}})['then'](function(_0x206f0e){return db[_0x8680('0x7a')]['transaction'](function(_0x2daa92){return _0x206f0e[_0x8680('0x85')](_0x1043b3[_0x8680('0x40')]['ids'],{'transaction':_0x2daa92})['then'](function(){if(!_[_0x8680('0x94')](_0x37dfff)){return _0x206f0e['removeAgents'](_0x37dfff,{'transaction':_0x2daa92})[_0x8680('0x29')](function(){return db[_0x8680('0x80')][_0x8680('0x35')]({'where':{'VoiceQueueId':_0x1043b3[_0x8680('0x53')]['id'],'UserId':_0x37dfff},'transaction':_0x2daa92});});}})[_0x8680('0x29')](function(){_0x37dfff[_0x8680('0x83')](function(_0x1bb4cc){socket['emit'](_0x8680('0x95'),{'UserId':_0x1bb4cc,'VoiceQueueId':_0x206f0e['id']});});});});});});})[_0x8680('0x29')](respondWithStatusCode(_0x2828ac,null))['catch'](handleError(_0x2828ac,null));};exports[_0x8680('0x96')]=function(_0x202df0,_0x566dcc,_0xba7637){var _0x46cb08,_0xf0769c;return db[_0x8680('0x3c')][_0x8680('0x32')]({'where':{'id':_0x202df0['params']['id']}})[_0x8680('0x29')](handleEntityNotFound(_0x566dcc,null))[_0x8680('0x29')](function(_0x1d8363){if(_0x1d8363){_0xf0769c=_0x1d8363;return _0x1d8363[_0x8680('0x96')](_0x202df0[_0x8680('0x59')]['ids'],_[_0x8680('0x63')](_0x202df0[_0x8680('0x59')],[_0x8680('0x97'),'id'])||{})[_0x8680('0x98')](function(_0x8fe5cd){for(var _0x3c4395=0x0;_0x3c4395<_0x202df0[_0x8680('0x59')]['ids'][_0x8680('0x56')];_0x3c4395+=0x1){socket[_0x8680('0x84')]('userVoiceQueue:save',{'UserId':Number(_0x202df0[_0x8680('0x59')][_0x8680('0x97')][_0x3c4395]),'VoiceQueueId':Number(_0x202df0[_0x8680('0x53')]['id'])});}return _0x8fe5cd;});}})[_0x8680('0x29')](function(_0x45c039){_0x46cb08=_0x45c039||[];if(_0xf0769c){return db[_0x8680('0x73')][_0x8680('0x4f')]({'where':{'id':_0x202df0['body'][_0x8680('0x97')]},'attributes':['id',_0x8680('0x33'),_0x8680('0x74'),_0x8680('0x75'),_0x8680('0x76')],'raw':!![]});}})[_0x8680('0x29')](function(_0x1b2179){if(!_[_0x8680('0x94')](_0x1b2179)){var _0x385308=[];for(var _0x5f5687=0x0;_0x5f5687<_0x1b2179[_0x8680('0x56')];_0x5f5687++){if(_0x1b2179[_0x5f5687]['online']){_0x385308[_0x8680('0x8e')](db[_0x8680('0x80')][_0x8680('0x7e')]({'membername':_0x1b2179[_0x5f5687]['name'],'UserId':_0x1b2179[_0x5f5687]['id'],'queue_name':_0xf0769c['name'],'VoiceQueueId':_0xf0769c['id'],'interface':_[_0x8680('0x81')](_0x1b2179[_0x5f5687][_0x8680('0x76')])?util[_0x8680('0x82')](_0x8680('0x99'),_0x1b2179[_0x5f5687][_0x8680('0x33')]):_0x1b2179[_0x5f5687][_0x8680('0x76')],'paused':_0x1b2179[_0x5f5687][_0x8680('0x75')]||![],'penalty':_0x202df0[_0x8680('0x59')][_0x8680('0x78')]||0x0}));}}return BPromise[_0x8680('0x92')](_0x385308);}})['then'](function(){return _0x46cb08;})[_0x8680('0x29')](respondWithResult(_0x566dcc,null))['catch'](handleError(_0x566dcc,null));};exports[_0x8680('0x9a')]=function(_0x204939,_0x489664,_0x570b4b){return db[_0x8680('0x3c')]['find']({'where':{'id':_0x204939[_0x8680('0x53')]['id']}})['then'](handleEntityNotFound(_0x489664,null))[_0x8680('0x29')](function(_0x2a3970){if(_0x2a3970){return _0x2a3970[_0x8680('0x9a')](_0x204939[_0x8680('0x40')][_0x8680('0x97')])[_0x8680('0x29')](function(){if(_[_0x8680('0x9b')](_0x204939['query']['ids'])){for(var _0x530f64=0x0;_0x530f64<_0x204939[_0x8680('0x40')][_0x8680('0x97')][_0x8680('0x56')];_0x530f64+=0x1){socket['emit'](_0x8680('0x95'),{'UserId':Number(_0x204939['query'][_0x8680('0x97')][_0x530f64]),'VoiceQueueId':Number(_0x204939[_0x8680('0x53')]['id'])});}}else{socket['emit'](_0x8680('0x95'),{'UserId':Number(_0x204939[_0x8680('0x40')][_0x8680('0x97')]),'VoiceQueueId':Number(_0x204939[_0x8680('0x53')]['id'])});}});}})[_0x8680('0x29')](function(_0x3d317e){return db[_0x8680('0x80')][_0x8680('0x35')]({'where':{'VoiceQueueId':_0x204939[_0x8680('0x53')]['id'],'UserId':_0x204939['query'][_0x8680('0x97')]}})['then'](function(){return _0x3d317e;});})[_0x8680('0x29')](respondWithStatusCode(_0x489664,null))['catch'](handleError(_0x489664,null));};exports[_0x8680('0x9c')]=function(_0x97793,_0x431797,_0x4213e7){var _0x2c37c7={};var _0x19472a={};var _0xf954ca;var _0x7cc61b;return db['VoiceQueue'][_0x8680('0x66')]({'where':{'id':_0x97793['params']['id']}})[_0x8680('0x29')](handleEntityNotFound(_0x431797,null))[_0x8680('0x29')](function(_0x500c0a){if(_0x500c0a){_0xf954ca=_0x500c0a;_0x19472a['model']=_[_0x8680('0x54')](db['User'][_0x8680('0x55')]);_0x19472a[_0x8680('0x40')]=_['keys'](_0x97793['query']);_0x19472a[_0x8680('0x41')]=_[_0x8680('0x43')](_0x19472a['model'],_0x19472a[_0x8680('0x40')]);_0x2c37c7['attributes']=_[_0x8680('0x43')](_0x19472a[_0x8680('0x3f')],qs[_0x8680('0x44')](_0x97793[_0x8680('0x40')][_0x8680('0x44')]));_0x2c37c7[_0x8680('0x42')]=_0x2c37c7[_0x8680('0x42')]['length']?_0x2c37c7[_0x8680('0x42')]:_0x19472a[_0x8680('0x3f')];_0x2c37c7['order']=qs[_0x8680('0x47')](_0x97793[_0x8680('0x40')][_0x8680('0x47')]);_0x2c37c7[_0x8680('0x48')]=qs[_0x8680('0x41')](_[_0x8680('0x49')](_0x97793[_0x8680('0x40')],_0x19472a[_0x8680('0x41')]));if(_0x97793[_0x8680('0x40')][_0x8680('0x4a')]){_0x2c37c7['where']=_[_0x8680('0x4b')](_0x2c37c7['where'],{'$or':_['map'](_0x2c37c7['attributes'],function(_0x5985ec){var _0x7d9588={};_0x7d9588[_0x5985ec]={'$like':'%'+_0x97793[_0x8680('0x40')]['filter']+'%'};return _0x7d9588;})});}_0x2c37c7=_[_0x8680('0x4b')]({},_0x2c37c7,_0x97793['options']);return _0xf954ca[_0x8680('0x9c')](_0x2c37c7);}})[_0x8680('0x29')](function(_0x20fc8d){if(_0x20fc8d){_0x7cc61b=_0x20fc8d['length'];if(!_0x97793[_0x8680('0x40')]['hasOwnProperty']('nolimit')){_0x2c37c7[_0x8680('0x46')]=qs['limit'](_0x97793[_0x8680('0x40')][_0x8680('0x46')]);_0x2c37c7[_0x8680('0x20')]=qs[_0x8680('0x20')](_0x97793[_0x8680('0x40')][_0x8680('0x20')]);}return _0xf954ca['getAgents'](_0x2c37c7);}})[_0x8680('0x29')](function(_0xf82dc5){if(_0xf82dc5){return _0xf82dc5?{'count':_0x7cc61b,'rows':_0xf82dc5}:null;}})['then'](respondWithResult(_0x431797,null))['catch'](handleError(_0x431797,null));};exports[_0x8680('0x9d')]=function(_0x5471be,_0x88a865,_0x2ad73c){var _0x33109a={};var _0x49d74a={};var _0x3ba11f;var _0x13ddcf;return db[_0x8680('0x3c')][_0x8680('0x66')]({'where':{'id':_0x5471be['params']['id']}})[_0x8680('0x29')](handleEntityNotFound(_0x88a865,null))['then'](function(_0x5a1097){if(_0x5a1097){_0x3ba11f=_0x5a1097;_0x49d74a[_0x8680('0x3f')]=_[_0x8680('0x54')](db['UserVoiceQueueRt'][_0x8680('0x55')]);_0x49d74a[_0x8680('0x40')]=_[_0x8680('0x54')](_0x5471be[_0x8680('0x40')]);_0x49d74a[_0x8680('0x41')]=_['intersection'](_0x49d74a[_0x8680('0x3f')],_0x49d74a[_0x8680('0x40')]);_0x33109a['attributes']=_[_0x8680('0x43')](_0x49d74a[_0x8680('0x3f')],qs[_0x8680('0x44')](_0x5471be[_0x8680('0x40')][_0x8680('0x44')]));_0x33109a[_0x8680('0x42')]=_0x33109a[_0x8680('0x42')][_0x8680('0x56')]?_0x33109a[_0x8680('0x42')]:_0x49d74a['model'];_0x33109a[_0x8680('0x6c')]=qs[_0x8680('0x47')](_0x5471be[_0x8680('0x40')][_0x8680('0x47')]);_0x33109a[_0x8680('0x48')]=qs[_0x8680('0x41')](_[_0x8680('0x49')](_0x5471be[_0x8680('0x40')],_0x49d74a[_0x8680('0x41')]));if(_0x5471be['query'][_0x8680('0x4a')]){_0x33109a[_0x8680('0x48')]=_['merge'](_0x33109a[_0x8680('0x48')],{'$or':_['map'](_0x33109a['attributes'],function(_0x24066e){var _0x5a038a={};_0x5a038a[_0x24066e]={'$like':'%'+_0x5471be['query'][_0x8680('0x4a')]+'%'};return _0x5a038a;})});}_0x33109a=_[_0x8680('0x4b')]({},_0x33109a,_0x5471be[_0x8680('0x57')]);return _0x3ba11f[_0x8680('0x9d')](_0x33109a);}})[_0x8680('0x29')](function(_0xc4694d){if(_0xc4694d){_0x13ddcf=_0xc4694d[_0x8680('0x56')];if(!_0x5471be['query']['hasOwnProperty'](_0x8680('0x45'))){_0x33109a[_0x8680('0x46')]=qs['limit'](_0x5471be[_0x8680('0x40')][_0x8680('0x46')]);_0x33109a[_0x8680('0x20')]=qs['offset'](_0x5471be[_0x8680('0x40')][_0x8680('0x20')]);}return _0x3ba11f[_0x8680('0x9d')](_0x33109a);}})[_0x8680('0x29')](function(_0x50498b){return _0x50498b?{'count':_0x13ddcf,'rows':_0x50498b}:null;})[_0x8680('0x29')](respondWithResult(_0x88a865,null))[_0x8680('0x51')](handleError(_0x88a865,null));};exports[_0x8680('0x9e')]=function(_0x504583,_0x52efe4,_0x13730f){var _0x314525={};var _0xe41f4a={};var _0x390a76;var _0x4ef07e;return db['VoiceQueue'][_0x8680('0x66')]({'where':{'id':_0x504583[_0x8680('0x53')]['id']}})[_0x8680('0x29')](handleEntityNotFound(_0x52efe4,null))[_0x8680('0x29')](function(_0x467613){if(_0x467613){_0x390a76=_0x467613;_0xe41f4a['model']=_[_0x8680('0x54')](db[_0x8680('0x9f')][_0x8680('0x55')]);_0xe41f4a[_0x8680('0x40')]=_[_0x8680('0x54')](_0x504583[_0x8680('0x40')]);_0xe41f4a[_0x8680('0x41')]=_[_0x8680('0x43')](_0xe41f4a[_0x8680('0x3f')],_0xe41f4a[_0x8680('0x40')]);_0x314525['attributes']=_['intersection'](_0xe41f4a['model'],qs[_0x8680('0x44')](_0x504583[_0x8680('0x40')][_0x8680('0x44')]));_0x314525['attributes']=_0x314525['attributes']['length']?_0x314525[_0x8680('0x42')]:_0xe41f4a[_0x8680('0x3f')];_0x314525[_0x8680('0x6c')]=qs[_0x8680('0x47')](_0x504583[_0x8680('0x40')][_0x8680('0x47')]);_0x314525[_0x8680('0x48')]=qs[_0x8680('0x41')](_['pick'](_0x504583[_0x8680('0x40')],_0xe41f4a[_0x8680('0x41')]));if(_0x504583[_0x8680('0x40')][_0x8680('0x4a')]){_0x314525['where']=_[_0x8680('0x4b')](_0x314525[_0x8680('0x48')],{'$or':_[_0x8680('0x3b')](_0x314525[_0x8680('0x42')],function(_0x54ece2){var _0x35fb61={};_0x35fb61[_0x54ece2]={'$like':'%'+_0x504583[_0x8680('0x40')][_0x8680('0x4a')]+'%'};return _0x35fb61;})});}_0x314525=_['merge']({},_0x314525,_0x504583[_0x8680('0x57')]);return _0x390a76[_0x8680('0x9e')](_0x314525);}})['then'](function(_0x7de046){if(_0x7de046){_0x4ef07e=_0x7de046[_0x8680('0x56')];if(!_0x504583[_0x8680('0x40')][_0x8680('0x68')](_0x8680('0x45'))){_0x314525[_0x8680('0x46')]=qs['limit'](_0x504583['query'][_0x8680('0x46')]);_0x314525[_0x8680('0x20')]=qs[_0x8680('0x20')](_0x504583[_0x8680('0x40')][_0x8680('0x20')]);}return _0x390a76[_0x8680('0x9e')](_0x314525);}})['then'](function(_0x245be3){if(_0x245be3){return _0x245be3?{'count':_0x4ef07e,'rows':_0x245be3}:null;}})[_0x8680('0x29')](respondWithResult(_0x52efe4,null))[_0x8680('0x51')](handleError(_0x52efe4,null));};exports[_0x8680('0xa0')]=function(_0x4529c3,_0x525a76,_0x27c028){var _0x2fd72a=moment()[_0x8680('0x82')](_0x8680('0xa1'));var _0x293887,_0x3908ea;return db[_0x8680('0x3c')][_0x8680('0x32')]({'where':{'id':_0x4529c3[_0x8680('0x53')]['id']}})[_0x8680('0x29')](handleEntityNotFound(_0x525a76,null))['then'](function(_0x255253){if(_0x255253){_0x3908ea=_0x255253;return _0x255253['addLists'](_0x4529c3['body'][_0x8680('0x97')],_[_0x8680('0x63')](_0x4529c3[_0x8680('0x59')],[_0x8680('0x97'),'id'])||{});}return null;})[_0x8680('0x98')](function(_0x2e6702){var _0x3777f7;_0x293887=_0x2e6702||[];var _0x127ede=[];if(_0x2e6702){for(var _0x3d282c=0x0;_0x3d282c<_0x2e6702['length'];_0x3d282c+=0x1){var _0x6c545e=_0x2e6702[_0x3d282c][_0x8680('0x2a')]({'plain':!![]});_0x3908ea['dialCheckDuplicateType']=_0x4529c3[_0x8680('0x59')][_0x8680('0xa2')]?_0x4529c3[_0x8680('0x59')][_0x8680('0xa2')]:_0x3908ea[_0x8680('0xa2')];switch(_0x3908ea[_0x8680('0xa2')]){case _0x8680('0xa3'):_0x3777f7=squel[_0x8680('0xa4')]()[_0x8680('0xa5')](_0x8680('0xa6'))[_0x8680('0xa7')]([_0x8680('0xa8'),'scheduledAt',_0x8680('0xa9'),_0x8680('0xaa'),'VoiceQueueId',_0x8680('0x61'),_0x8680('0x62')],squel['select']()['field'](_0x8680('0xa8'),_0x8680('0xa8'))[_0x8680('0x86')]('\x27'+_0x2fd72a+'\x27',_0x8680('0xab'))[_0x8680('0x86')]('id',_0x8680('0xa9'))[_0x8680('0x86')](_0x6c545e[_0x8680('0xac')]['toString'](),_0x8680('0xaa'))[_0x8680('0x86')](_0x4529c3[_0x8680('0x53')]['id'][_0x8680('0x8f')](),'VoiceQueueId')['field']('\x27'+_0x2fd72a+'\x27',_0x8680('0x61'))[_0x8680('0x86')]('\x27'+_0x2fd72a+'\x27',_0x8680('0x62'))['from'](_0x8680('0xad'))[_0x8680('0x48')]('deletedAt\x20IS\x20NULL')['where'](_0x8680('0xae'),_0x6c545e[_0x8680('0xac')][_0x8680('0x8f')]())[_0x8680('0x48')](_0x8680('0xaf'))[_0x8680('0x48')](_0x8680('0xb0'),squel[_0x8680('0xb1')]()[_0x8680('0x86')]('COALESCE(calleridnum,\x27\x27)')[_0x8680('0x88')](_0x8680('0xb2'))[_0x8680('0x48')](_0x8680('0xb3'),_0x4529c3[_0x8680('0x53')]['id'][_0x8680('0x8f')]()))[_0x8680('0x48')](_0x8680('0xb0'),squel[_0x8680('0xb1')]()[_0x8680('0x86')](_0x8680('0xb4'))[_0x8680('0x88')](_0x8680('0xa6'))[_0x8680('0x48')](_0x8680('0xb3'),_0x4529c3[_0x8680('0x53')]['id'][_0x8680('0x8f')]())))['toString']();break;case _0x8680('0xb5'):_0x3777f7=squel[_0x8680('0xa4')]()['into'](_0x8680('0xa6'))[_0x8680('0xa7')](['phone',_0x8680('0xab'),_0x8680('0xa9'),_0x8680('0xaa'),_0x8680('0x69'),_0x8680('0x61'),'updatedAt'],squel[_0x8680('0xb1')]()['field'](_0x8680('0xa8'),_0x8680('0xa8'))[_0x8680('0x86')]('\x27'+_0x2fd72a+'\x27',_0x8680('0xab'))['field']('id',_0x8680('0xa9'))[_0x8680('0x86')](_0x6c545e['CmListId'][_0x8680('0x8f')](),_0x8680('0xaa'))[_0x8680('0x86')](_0x4529c3['params']['id']['toString'](),_0x8680('0x69'))[_0x8680('0x86')]('\x27'+_0x2fd72a+'\x27','createdAt')['field']('\x27'+_0x2fd72a+'\x27',_0x8680('0x62'))['from']('cm_contacts')[_0x8680('0x48')](_0x8680('0xb6'))['where'](_0x8680('0xae'),_0x6c545e[_0x8680('0xac')][_0x8680('0x8f')]())[_0x8680('0x48')](_0x8680('0xaf'))[_0x8680('0x48')](_0x8680('0xb0'),squel[_0x8680('0xb1')]()[_0x8680('0x86')](_0x8680('0xb4'))[_0x8680('0x88')](_0x8680('0xa6'))[_0x8680('0x48')]('VoiceQueueId\x20=\x20?',_0x4529c3[_0x8680('0x53')]['id'][_0x8680('0x8f')]())))[_0x8680('0x8f')]();break;default:_0x3777f7=squel[_0x8680('0xa4')]()['into']('cm_hopper')[_0x8680('0xa7')]([_0x8680('0xa8'),_0x8680('0xab'),'ContactId',_0x8680('0xaa'),_0x8680('0x69'),_0x8680('0x61'),_0x8680('0x62')],squel[_0x8680('0xb1')]()['field'](_0x8680('0xa8'),'phone')[_0x8680('0x86')]('\x27'+_0x2fd72a+'\x27',_0x8680('0xab'))[_0x8680('0x86')]('id',_0x8680('0xa9'))[_0x8680('0x86')](_0x6c545e[_0x8680('0xac')][_0x8680('0x8f')](),_0x8680('0xaa'))[_0x8680('0x86')](_0x4529c3[_0x8680('0x53')]['id'][_0x8680('0x8f')](),'VoiceQueueId')[_0x8680('0x86')]('\x27'+_0x2fd72a+'\x27',_0x8680('0x61'))[_0x8680('0x86')]('\x27'+_0x2fd72a+'\x27',_0x8680('0x62'))['from'](_0x8680('0xad'))[_0x8680('0x48')]('deletedAt\x20IS\x20NULL')[_0x8680('0x48')](_0x8680('0xae'),_0x6c545e['CmListId']['toString']())[_0x8680('0x48')](_0x8680('0xaf')))['toString']();}_0x127ede[_0x8680('0x8e')](db['sequelize'][_0x8680('0x40')](_0x3777f7));}return BPromise[_0x8680('0x92')](_0x127ede);}})[_0x8680('0x29')](function(){var _0x1b3291=[];var _0x10f943=squel[_0x8680('0xa4')]()['into']('cm_hopper_additional_phones')[_0x8680('0xa7')]([_0x8680('0xb7'),_0x8680('0xa8'),_0x8680('0xb8'),_0x8680('0x61'),_0x8680('0x62')],squel[_0x8680('0xb1')]()['field']('h.id')[_0x8680('0x86')](_0x8680('0xb9'))[_0x8680('0x86')]('ci.OrderBy+1')['field']('\x27'+_0x2fd72a+'\x27','createdAt')[_0x8680('0x86')]('\x27'+_0x2fd72a+'\x27',_0x8680('0x62'))[_0x8680('0x88')](_0x8680('0xba'),'ci')[_0x8680('0x8a')](_0x8680('0xa6'),'h',_0x8680('0xbb'))[_0x8680('0x48')](_0x8680('0xbc'),_0x2fd72a)['where'](_0x8680('0xbd'),'PHONE'))['toString']();_0x1b3291[_0x8680('0x8e')](db[_0x8680('0x7a')][_0x8680('0x40')](_0x10f943));return BPromise[_0x8680('0x92')](_0x1b3291);})[_0x8680('0x29')](function(){return _0x293887;})[_0x8680('0x29')](respondWithResult(_0x525a76,null))['catch'](handleError(_0x525a76,null));};exports['removeLists']=function(_0x1da622,_0x4d7c3c,_0x26211e){return db['VoiceQueue']['find']({'where':{'id':_0x1da622['params']['id']}})[_0x8680('0x29')](handleEntityNotFound(_0x4d7c3c,null))[_0x8680('0x29')](function(_0x37348){if(_0x37348){return _0x37348[_0x8680('0xbe')](_0x1da622[_0x8680('0x40')][_0x8680('0x97')]);}})[_0x8680('0x29')](function(_0x254d55){if(_0x254d55){return db[_0x8680('0x67')]['destroy']({'where':{'ListId':_0x1da622[_0x8680('0x40')]['ids'],'VoiceQueueId':_0x1da622[_0x8680('0x53')]['id']}})[_0x8680('0x29')](function(){return _0x254d55;});}})[_0x8680('0x29')](respondWithStatusCode(_0x4d7c3c,null))['catch'](handleError(_0x4d7c3c,null));};exports['getBlackLists']=function(_0x44430d,_0x133c2c,_0x2d6cf2){var _0xd16d85={};var _0x482c8c={};var _0x10a26c;var _0x30444e;return db[_0x8680('0x3c')][_0x8680('0x66')]({'where':{'id':_0x44430d[_0x8680('0x53')]['id']}})['then'](handleEntityNotFound(_0x133c2c,null))[_0x8680('0x29')](function(_0x12f7d1){if(_0x12f7d1){_0x10a26c=_0x12f7d1;_0x482c8c[_0x8680('0x3f')]=_[_0x8680('0x54')](db['CmList'][_0x8680('0x55')]);_0x482c8c[_0x8680('0x40')]=_[_0x8680('0x54')](_0x44430d[_0x8680('0x40')]);_0x482c8c[_0x8680('0x41')]=_[_0x8680('0x43')](_0x482c8c[_0x8680('0x3f')],_0x482c8c[_0x8680('0x40')]);_0xd16d85[_0x8680('0x42')]=_['intersection'](_0x482c8c['model'],qs[_0x8680('0x44')](_0x44430d[_0x8680('0x40')]['fields']));_0xd16d85[_0x8680('0x42')]=_0xd16d85['attributes'][_0x8680('0x56')]?_0xd16d85[_0x8680('0x42')]:_0x482c8c[_0x8680('0x3f')];_0xd16d85[_0x8680('0x6c')]=qs[_0x8680('0x47')](_0x44430d[_0x8680('0x40')][_0x8680('0x47')]);_0xd16d85[_0x8680('0x48')]=qs[_0x8680('0x41')](_[_0x8680('0x49')](_0x44430d['query'],_0x482c8c[_0x8680('0x41')]));if(_0x44430d[_0x8680('0x40')][_0x8680('0x4a')]){_0xd16d85[_0x8680('0x48')]=_[_0x8680('0x4b')](_0xd16d85[_0x8680('0x48')],{'$or':_[_0x8680('0x3b')](_0xd16d85[_0x8680('0x42')],function(_0x40291c){var _0x28283c={};_0x28283c[_0x40291c]={'$like':'%'+_0x44430d[_0x8680('0x40')][_0x8680('0x4a')]+'%'};return _0x28283c;})});}_0xd16d85=_[_0x8680('0x4b')]({},_0xd16d85,_0x44430d['options']);return _0x10a26c[_0x8680('0xbf')](_0xd16d85);}})['then'](function(_0x2d2acd){if(_0x2d2acd){_0x30444e=_0x2d2acd[_0x8680('0x56')];if(!_0x44430d[_0x8680('0x40')][_0x8680('0x68')]('nolimit')){_0xd16d85['limit']=qs[_0x8680('0x46')](_0x44430d[_0x8680('0x40')][_0x8680('0x46')]);_0xd16d85['offset']=qs[_0x8680('0x20')](_0x44430d['query'][_0x8680('0x20')]);}return _0x10a26c[_0x8680('0xbf')](_0xd16d85);}})[_0x8680('0x29')](function(_0x38c900){if(_0x38c900){return _0x38c900?{'count':_0x30444e,'rows':_0x38c900}:null;}})[_0x8680('0x29')](respondWithResult(_0x133c2c,null))[_0x8680('0x51')](handleError(_0x133c2c,null));};exports[_0x8680('0xc0')]=function(_0x521265,_0x34329d,_0x5237f2){var _0x50a194,_0x98c10e;return db[_0x8680('0x3c')][_0x8680('0x32')]({'where':{'id':_0x521265['params']['id']}})[_0x8680('0x29')](handleEntityNotFound(_0x34329d,null))['then'](function(_0x55c529){if(_0x55c529){_0x98c10e=_0x55c529;return _0x55c529['addBlackLists'](_0x521265[_0x8680('0x59')][_0x8680('0x97')],_[_0x8680('0x63')](_0x521265[_0x8680('0x59')],['ids','id'])||{});}return null;})[_0x8680('0x98')](function(_0x102848){var _0x3579c2;_0x50a194=_0x102848||[];var _0x3e36a9=[];if(_0x102848){for(var _0x16ecaf=0x0;_0x16ecaf<_0x102848[_0x8680('0x56')];_0x16ecaf+=0x1){var _0x2ad0cc=_0x102848[_0x16ecaf][_0x8680('0x2a')]({'plain':!![]});_0x3579c2=squel['insert']()[_0x8680('0xa5')](_0x8680('0xc1'))[_0x8680('0xa7')]([_0x8680('0xa8'),_0x8680('0xa9'),'ListId',_0x8680('0x69'),'createdAt',_0x8680('0x62')],squel[_0x8680('0xb1')]()[_0x8680('0x86')]('phone',_0x8680('0xa8'))['field']('id',_0x8680('0xa9'))[_0x8680('0x86')](_0x2ad0cc[_0x8680('0xac')][_0x8680('0x8f')](),_0x8680('0xaa'))[_0x8680('0x86')](_0x521265[_0x8680('0x53')]['id'][_0x8680('0x8f')](),_0x8680('0x69'))['field'](_0x8680('0xc2'),'createdAt')[_0x8680('0x86')]('NOW()',_0x8680('0x62'))[_0x8680('0x88')]('cm_contacts')[_0x8680('0x48')]('deletedAt\x20IS\x20NULL')[_0x8680('0x48')](_0x8680('0xae'),_0x2ad0cc[_0x8680('0xac')][_0x8680('0x8f')]())[_0x8680('0x48')](_0x8680('0xaf')))[_0x8680('0x8f')]();_0x3e36a9[_0x8680('0x8e')](db[_0x8680('0x7a')][_0x8680('0x40')](_0x3579c2));}return BPromise[_0x8680('0x92')](_0x3e36a9);}})[_0x8680('0x29')](function(){return _0x50a194;})[_0x8680('0x29')](respondWithResult(_0x34329d,null))['catch'](handleError(_0x34329d,null));};exports[_0x8680('0xc3')]=function(_0x48f431,_0x18bac1,_0x5627ac){return db[_0x8680('0x3c')][_0x8680('0x32')]({'where':{'id':_0x48f431[_0x8680('0x53')]['id']}})[_0x8680('0x29')](handleEntityNotFound(_0x18bac1,null))[_0x8680('0x29')](function(_0x5edde8){if(_0x5edde8){return _0x5edde8['removeBlackLists'](_0x48f431[_0x8680('0x40')][_0x8680('0x97')]);}})[_0x8680('0x29')](function(_0x295fb1){if(_0x295fb1){return db[_0x8680('0x6f')][_0x8680('0x35')]({'where':{'ListId':_0x48f431['query'][_0x8680('0x97')],'VoiceQueueId':_0x48f431[_0x8680('0x53')]['id']}})[_0x8680('0x29')](function(){return _0x295fb1;});}})[_0x8680('0x29')](respondWithStatusCode(_0x18bac1,null))[_0x8680('0x51')](handleError(_0x18bac1,null));}; \ No newline at end of file +var _0xf603=['body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','error','createdAt','omit','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','CmHopper','hasOwnProperty','order','VoiceQueueId','findAll','rows','getHopperHistories','CmHopperHistory','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','online','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','TeamVoiceQueue','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_voice_queues','clone','push','toString','QueryTypes','SELECT','every','all','compact','userVoiceQueue:remove','addAgents','spread','removeAgents','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','updatedAt','from','cm_contacts','deletedAt\x20IS\x20NULL','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','onlyIfOpen','insert','ListId\x20=\x20?','cm_hopper_additional_phones','OrderBy','join','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','localhost','./voiceQueue.socket','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','stack','send','index','rawAttributes','fieldName','query','keys','filters','model','attributes','fields','nolimit','offset','sort','where','pick','merge','options','VoiceQueue','includeAll','include','catch','show','params','intersection','length','create'];(function(_0x4e990c,_0x574201){var _0x219948=function(_0x7594f9){while(--_0x7594f9){_0x4e990c['push'](_0x4e990c['shift']());}};_0x219948(++_0x574201);}(_0xf603,0x124));var _0x3f60=function(_0x2122a5,_0x3fc445){_0x2122a5=_0x2122a5-0x0;var _0x5b7deb=_0xf603[_0x2122a5];return _0x5b7deb;};'use strict';var emlformat=require(_0x3f60('0x0'));var rimraf=require(_0x3f60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f60('0x2'));var rp=require(_0x3f60('0x3'));var moment=require(_0x3f60('0x4'));var BPromise=require(_0x3f60('0x5'));var Mustache=require(_0x3f60('0x6'));var util=require(_0x3f60('0x7'));var path=require(_0x3f60('0x8'));var sox=require(_0x3f60('0x9'));var csv=require(_0x3f60('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3f60('0xb'));var crypto=require(_0x3f60('0xc'));var jsforce=require(_0x3f60('0xd'));var deskjs=require(_0x3f60('0xe'));var toCsv=require(_0x3f60('0xa'));var querystring=require(_0x3f60('0xf'));var Papa=require(_0x3f60('0x10'));var Redis=require(_0x3f60('0x11'));var authService=require(_0x3f60('0x12'));var qs=require(_0x3f60('0x13'));var as=require(_0x3f60('0x14'));var hardwareService=require(_0x3f60('0x15'));var logger=require(_0x3f60('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3f60('0x17'));var db=require(_0x3f60('0x18'))['db'];config[_0x3f60('0x19')]=_['defaults'](config[_0x3f60('0x19')],{'host':_0x3f60('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3f60('0x19')]));require(_0x3f60('0x1b'))['register'](socket);function respondWithStatusCode(_0x1ec7f4,_0x5a047a){_0x5a047a=_0x5a047a||0xcc;return function(_0x39ce92){if(_0x39ce92){return _0x1ec7f4[_0x3f60('0x1c')](_0x5a047a);}return _0x1ec7f4['status'](_0x5a047a)[_0x3f60('0x1d')]();};}function respondWithResult(_0x4e84b5,_0x2fe94a){_0x2fe94a=_0x2fe94a||0xc8;return function(_0x4fe8ee){if(_0x4fe8ee){return _0x4e84b5[_0x3f60('0x1e')](_0x2fe94a)[_0x3f60('0x1f')](_0x4fe8ee);}};}function respondWithFilteredResult(_0xbc26c,_0x2b893c){return function(_0x3ae771){if(_0x3ae771){var _0xe64a00=typeof _0x2b893c['offset']===_0x3f60('0x20')&&typeof _0x2b893c[_0x3f60('0x21')]===_0x3f60('0x20');var _0x9c845f=_0x3ae771[_0x3f60('0x22')];var _0x14f44a=_0xe64a00?0x0:_0x2b893c['offset'];var _0x35dcd8=_0xe64a00?_0x3ae771[_0x3f60('0x22')]:_0x2b893c['offset']+_0x2b893c[_0x3f60('0x21')];var _0x2dba08;if(_0x35dcd8>=_0x9c845f){_0x35dcd8=_0x9c845f;_0x2dba08=0xc8;}else{_0x2dba08=0xce;}_0xbc26c[_0x3f60('0x1e')](_0x2dba08);return _0xbc26c[_0x3f60('0x23')](_0x3f60('0x24'),_0x14f44a+'-'+_0x35dcd8+'/'+_0x9c845f)[_0x3f60('0x1f')](_0x3ae771);}return null;};}function patchUpdates(_0x44b665){return function(_0x15f705){try{jsonpatch[_0x3f60('0x25')](_0x15f705,_0x44b665,!![]);}catch(_0x31847d){return BPromise[_0x3f60('0x26')](_0x31847d);}return _0x15f705[_0x3f60('0x27')]();};}function saveUpdates(_0x1f9390,_0x39ba85){return function(_0x2e3918){if(_0x2e3918){return _0x2e3918['update'](_0x1f9390)[_0x3f60('0x28')](function(_0x3cdef4){return _0x3cdef4;});}return null;};}function removeEntity(_0x15315b,_0x4581d6){return function(_0x1e1af4){if(_0x1e1af4){return _0x1e1af4[_0x3f60('0x29')]()[_0x3f60('0x28')](function(){var _0x23e265=_0x1e1af4['get']({'plain':!![]});var _0x473bd7=[{'name':_0x3f60('0x2a'),'value':_0x3f60('0x2b'),'ignore':![]},{'name':_0x3f60('0x2c'),'value':_0x3f60('0x2d'),'ignore':![]}];var _0xa69033=_(_0x473bd7)[_0x3f60('0x2e')](_0x3f60('0x2f'))[_0x3f60('0x30')](_0x3f60('0x31'))[_0x3f60('0x31')]();if(_[_0x3f60('0x32')](_0xa69033,_0x23e265[_0x3f60('0x33')])){return;}var _0x23ec35=_[_0x3f60('0x34')](_0x473bd7,[_0x3f60('0x31'),_0x23e265[_0x3f60('0x33')]])[_0x3f60('0x35')];return db[_0x3f60('0x36')][_0x3f60('0x29')]({'where':{'type':_0x23ec35,'resourceId':_0x23e265['id']}})[_0x3f60('0x28')](function(){return _0x1e1af4;});})[_0x3f60('0x28')](function(){_0x15315b[_0x3f60('0x1e')](0xcc)[_0x3f60('0x1d')]();});}};}function handleEntityNotFound(_0x1a4ebb,_0x34f212){return function(_0x3e2401){if(!_0x3e2401){_0x1a4ebb[_0x3f60('0x1c')](0x194);}return _0x3e2401;};}function handleError(_0x271d20,_0xdacf71){_0xdacf71=_0xdacf71||0x1f4;return function(_0x9e5918){logger['error'](_0x9e5918[_0x3f60('0x37')]);if(_0x9e5918[_0x3f60('0x35')]){delete _0x9e5918['name'];}_0x271d20[_0x3f60('0x1e')](_0xdacf71)[_0x3f60('0x38')](_0x9e5918);};}exports[_0x3f60('0x39')]=function(_0x12c79e,_0x54680c){var _0x1a6e0d={},_0x14292c={},_0x5e6bb4={'count':0x0,'rows':[]};var _0x5c6685=_[_0x3f60('0x30')](db['VoiceQueue'][_0x3f60('0x3a')],function(_0x3658fe){return{'name':_0x3658fe[_0x3f60('0x3b')],'type':_0x3658fe[_0x3f60('0x33')]['key']};});_0x14292c['model']=_[_0x3f60('0x30')](_0x5c6685,_0x3f60('0x35'));_0x14292c[_0x3f60('0x3c')]=_[_0x3f60('0x3d')](_0x12c79e[_0x3f60('0x3c')]);_0x14292c[_0x3f60('0x3e')]=_['intersection'](_0x14292c[_0x3f60('0x3f')],_0x14292c['query']);_0x1a6e0d[_0x3f60('0x40')]=_['intersection'](_0x14292c[_0x3f60('0x3f')],qs[_0x3f60('0x41')](_0x12c79e[_0x3f60('0x3c')][_0x3f60('0x41')]));_0x1a6e0d[_0x3f60('0x40')]=_0x1a6e0d['attributes']['length']?_0x1a6e0d[_0x3f60('0x40')]:_0x14292c[_0x3f60('0x3f')];if(!_0x12c79e[_0x3f60('0x3c')]['hasOwnProperty'](_0x3f60('0x42'))){_0x1a6e0d[_0x3f60('0x21')]=qs['limit'](_0x12c79e['query'][_0x3f60('0x21')]);_0x1a6e0d[_0x3f60('0x43')]=qs[_0x3f60('0x43')](_0x12c79e[_0x3f60('0x3c')][_0x3f60('0x43')]);}_0x1a6e0d['order']=qs[_0x3f60('0x44')](_0x12c79e[_0x3f60('0x3c')][_0x3f60('0x44')]);_0x1a6e0d[_0x3f60('0x45')]=qs[_0x3f60('0x3e')](_[_0x3f60('0x46')](_0x12c79e['query'],_0x14292c['filters']),_0x5c6685);if(_0x12c79e[_0x3f60('0x3c')][_0x3f60('0x2e')]){_0x1a6e0d['where']=_['merge'](_0x1a6e0d['where'],{'$or':_[_0x3f60('0x30')](_0x5c6685,function(_0x1a3d5f){if(_0x1a3d5f['type']!=='VIRTUAL'){var _0x4f38d5={};_0x4f38d5[_0x1a3d5f[_0x3f60('0x35')]]={'$like':'%'+_0x12c79e['query']['filter']+'%'};return _0x4f38d5;}})});}_0x1a6e0d=_[_0x3f60('0x47')]({},_0x1a6e0d,_0x12c79e[_0x3f60('0x48')]);var _0x572059={'where':_0x1a6e0d['where']};return db[_0x3f60('0x49')]['count'](_0x572059)[_0x3f60('0x28')](function(_0x4a1c9f){_0x5e6bb4[_0x3f60('0x22')]=_0x4a1c9f;if(_0x12c79e[_0x3f60('0x3c')][_0x3f60('0x4a')]){_0x1a6e0d[_0x3f60('0x4b')]=[{'all':!![]}];}return db[_0x3f60('0x49')]['findAll'](_0x1a6e0d);})[_0x3f60('0x28')](function(_0x3f7372){_0x5e6bb4['rows']=_0x3f7372;return _0x5e6bb4;})['then'](respondWithFilteredResult(_0x54680c,_0x1a6e0d))[_0x3f60('0x4c')](handleError(_0x54680c,null));};exports[_0x3f60('0x4d')]=function(_0x1e56a0,_0xe70ab0){var _0x44444d={'raw':![],'where':{'id':_0x1e56a0[_0x3f60('0x4e')]['id']}},_0x55851d={};_0x55851d['model']=_[_0x3f60('0x3d')](db[_0x3f60('0x49')][_0x3f60('0x3a')]);_0x55851d['query']=_[_0x3f60('0x3d')](_0x1e56a0[_0x3f60('0x3c')]);_0x55851d[_0x3f60('0x3e')]=_['intersection'](_0x55851d[_0x3f60('0x3f')],_0x55851d['query']);_0x44444d[_0x3f60('0x40')]=_[_0x3f60('0x4f')](_0x55851d[_0x3f60('0x3f')],qs[_0x3f60('0x41')](_0x1e56a0['query'][_0x3f60('0x41')]));_0x44444d[_0x3f60('0x40')]=_0x44444d['attributes'][_0x3f60('0x50')]?_0x44444d['attributes']:_0x55851d['model'];if(_0x1e56a0['query']['includeAll']){_0x44444d['include']=[{'all':!![]}];}_0x44444d=_[_0x3f60('0x47')]({},_0x44444d,_0x1e56a0['options']);return db[_0x3f60('0x49')][_0x3f60('0x34')](_0x44444d)[_0x3f60('0x28')](handleEntityNotFound(_0xe70ab0,null))['then'](respondWithResult(_0xe70ab0,null))[_0x3f60('0x4c')](handleError(_0xe70ab0,null));};exports[_0x3f60('0x51')]=function(_0xaa97d7,_0x749daa){return db[_0x3f60('0x49')][_0x3f60('0x51')](_0xaa97d7[_0x3f60('0x52')],{})[_0x3f60('0x28')](function(_0x291bbf){var _0x403976=_0xaa97d7['user'][_0x3f60('0x53')]({'plain':!![]});if(!_0x403976)throw new Error(_0x3f60('0x54'));if(_0x403976[_0x3f60('0x55')]===_0x3f60('0x56')){var _0x46a3fb=_0x291bbf[_0x3f60('0x53')]({'plain':!![]});var _0x461ccb=[{'name':_0x3f60('0x2a'),'value':_0x3f60('0x2b')},{'name':_0x3f60('0x2c'),'value':_0x3f60('0x2d')}];var _0x1ce71c=_[_0x3f60('0x34')](_0x461ccb,[_0x3f60('0x31'),_0x46a3fb[_0x3f60('0x33')]])[_0x3f60('0x35')];return db['UserProfileSection'][_0x3f60('0x34')]({'where':{'name':_0x1ce71c,'userProfileId':_0x403976[_0x3f60('0x57')]},'raw':!![]})['then'](function(_0x648ba5){if(_0x648ba5&&_0x648ba5[_0x3f60('0x58')]===0x0){return db[_0x3f60('0x36')]['create']({'name':_0x46a3fb['name'],'resourceId':_0x46a3fb['id'],'type':_0x648ba5['name'],'sectionId':_0x648ba5['id']},{})[_0x3f60('0x28')](function(){return _0x291bbf;});}else{return _0x291bbf;}})[_0x3f60('0x4c')](function(_0x19fbf1){logger[_0x3f60('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19fbf1);throw _0x19fbf1;});}return _0x291bbf;})[_0x3f60('0x28')](respondWithResult(_0x749daa,0xc9))[_0x3f60('0x4c')](handleError(_0x749daa,null));};exports['clone']=function(_0x262bf9,_0x52eb53){var _0x1d1999={'where':{'id':_0x262bf9[_0x3f60('0x4e')]['id']}},_0x1f3478={};_0x1f3478[_0x3f60('0x3f')]=_[_0x3f60('0x3d')](db[_0x3f60('0x49')]['rawAttributes']);_0x1d1999[_0x3f60('0x40')]=_[_0x3f60('0x4f')](_0x1f3478[_0x3f60('0x3f')],qs[_0x3f60('0x41')](_0x262bf9[_0x3f60('0x3c')][_0x3f60('0x41')]));_0x1d1999[_0x3f60('0x40')]=_0x1d1999['attributes']['length']?_0x1d1999[_0x3f60('0x40')]:_0x1f3478[_0x3f60('0x3f')];if(_0x262bf9[_0x3f60('0x3c')][_0x3f60('0x4a')]){_0x1d1999['include']=[{'all':!![]}];}_0x1d1999=_[_0x3f60('0x47')]({},_0x1d1999,_0x262bf9[_0x3f60('0x48')]);return db['VoiceQueue'][_0x3f60('0x34')](_0x1d1999)['then'](handleEntityNotFound(_0x52eb53,null))[_0x3f60('0x28')](function(_0x3878b6){if(_0x3878b6){var _0x40e444=_0x3878b6[_0x3f60('0x53')]({'plain':!![]});_0x40e444=qs['omit'](_0x40e444,['id',_0x3f60('0x5a'),'updatedAt']);_0x262bf9[_0x3f60('0x52')]=_[_0x3f60('0x5b')](_0x262bf9[_0x3f60('0x52')],['id',_0x3f60('0x5a'),'updatedAt']);return db['VoiceQueue']['create'](_['merge'](_0x40e444,_0x262bf9[_0x3f60('0x52')]),{'include':_0x262bf9[_0x3f60('0x3c')][_0x3f60('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x2d4563){var _0xf5e02=_0x262bf9[_0x3f60('0x56')][_0x3f60('0x53')]({'plain':!![]});if(!_0xf5e02)throw new Error(_0x3f60('0x54'));if(_0xf5e02[_0x3f60('0x55')]===_0x3f60('0x56')){var _0x52c643=_0x2d4563[_0x3f60('0x53')]({'plain':!![]});var _0x4cbbb2=[{'name':_0x3f60('0x2a'),'value':'inbound'},{'name':_0x3f60('0x2c'),'value':_0x3f60('0x2d')}];var _0x58656f=_[_0x3f60('0x34')](_0x4cbbb2,[_0x3f60('0x31'),_0x52c643[_0x3f60('0x33')]])['name'];return db['UserProfileSection'][_0x3f60('0x34')]({'where':{'name':_0x58656f,'userProfileId':_0xf5e02[_0x3f60('0x57')]},'raw':!![]})[_0x3f60('0x28')](function(_0x223151){if(_0x223151&&_0x223151[_0x3f60('0x58')]===0x0){return db['UserProfileResource'][_0x3f60('0x51')]({'name':_0x52c643[_0x3f60('0x35')],'resourceId':_0x52c643['id'],'type':_0x223151[_0x3f60('0x35')],'sectionId':_0x223151['id']},{})['then'](function(){return _0x2d4563;});}else{return _0x2d4563;}})[_0x3f60('0x4c')](function(_0x31f78e){logger[_0x3f60('0x59')](_0x3f60('0x5c'),_0x31f78e);throw _0x31f78e;});}return _0x2d4563;});}})['then'](respondWithResult(_0x52eb53,0xc9))['catch'](handleError(_0x52eb53,null));};exports[_0x3f60('0x5d')]=function(_0x59716a,_0x13cf62){if(_0x59716a[_0x3f60('0x52')]['id']){delete _0x59716a[_0x3f60('0x52')]['id'];}return db[_0x3f60('0x49')]['find']({'where':{'id':_0x59716a[_0x3f60('0x4e')]['id']}})[_0x3f60('0x28')](handleEntityNotFound(_0x13cf62,null))['then'](saveUpdates(_0x59716a[_0x3f60('0x52')],null))[_0x3f60('0x28')](respondWithResult(_0x13cf62,null))[_0x3f60('0x4c')](handleError(_0x13cf62,null));};exports['destroy']=function(_0x54a943,_0x192c37){return db[_0x3f60('0x49')][_0x3f60('0x34')]({'where':{'id':_0x54a943[_0x3f60('0x4e')]['id']}})[_0x3f60('0x28')](handleEntityNotFound(_0x192c37,null))[_0x3f60('0x28')](removeEntity(_0x192c37,null))['catch'](handleError(_0x192c37,null));};exports['getHoppers']=function(_0x395cc7,_0x5025cb,_0x44b98e){var _0x3b39a0={'raw':![],'where':{}};var _0x71b68={};var _0x3221e1={'count':0x0,'rows':[]};return db[_0x3f60('0x49')]['findOne']({'where':{'id':_0x395cc7['params']['id']}})[_0x3f60('0x28')](handleEntityNotFound(_0x5025cb,null))['then'](function(_0x14536f){if(_0x14536f){_0x71b68[_0x3f60('0x3f')]=_[_0x3f60('0x3d')](db[_0x3f60('0x5e')]['rawAttributes']);_0x71b68[_0x3f60('0x3c')]=_['keys'](_0x395cc7['query']);_0x71b68[_0x3f60('0x3e')]=_[_0x3f60('0x4f')](_0x71b68[_0x3f60('0x3f')],_0x71b68[_0x3f60('0x3c')]);_0x3b39a0['attributes']=_[_0x3f60('0x4f')](_0x71b68[_0x3f60('0x3f')],qs[_0x3f60('0x41')](_0x395cc7[_0x3f60('0x3c')][_0x3f60('0x41')]));_0x3b39a0[_0x3f60('0x40')]=_0x3b39a0[_0x3f60('0x40')][_0x3f60('0x50')]?_0x3b39a0[_0x3f60('0x40')]:_0x71b68[_0x3f60('0x3f')];if(!_0x395cc7[_0x3f60('0x3c')][_0x3f60('0x5f')](_0x3f60('0x42'))){_0x3b39a0[_0x3f60('0x21')]=qs[_0x3f60('0x21')](_0x395cc7[_0x3f60('0x3c')][_0x3f60('0x21')]);_0x3b39a0[_0x3f60('0x43')]=qs[_0x3f60('0x43')](_0x395cc7['query'][_0x3f60('0x43')]);}_0x3b39a0[_0x3f60('0x60')]=qs['sort'](_0x395cc7[_0x3f60('0x3c')][_0x3f60('0x44')]);_0x3b39a0['where']=qs[_0x3f60('0x3e')](_[_0x3f60('0x46')](_0x395cc7[_0x3f60('0x3c')],_0x71b68['filters']));_0x3b39a0[_0x3f60('0x45')][_0x3f60('0x61')]=_0x14536f['id'];if(_0x395cc7[_0x3f60('0x3c')][_0x3f60('0x2e')]){_0x3b39a0[_0x3f60('0x45')]=_['merge'](_0x3b39a0[_0x3f60('0x45')],{'$or':_[_0x3f60('0x30')](_0x3b39a0['attributes'],function(_0x4b5f94){var _0x102df3={};_0x102df3[_0x4b5f94]={'$like':'%'+_0x395cc7[_0x3f60('0x3c')][_0x3f60('0x2e')]+'%'};return _0x102df3;})});}_0x3b39a0=_[_0x3f60('0x47')]({},_0x3b39a0,_0x395cc7[_0x3f60('0x48')]);return db[_0x3f60('0x5e')][_0x3f60('0x22')]({'where':_0x3b39a0['where']})[_0x3f60('0x28')](function(_0x345d51){_0x3221e1['count']=_0x345d51;if(_0x395cc7[_0x3f60('0x3c')][_0x3f60('0x4a')]){_0x3b39a0[_0x3f60('0x4b')]=[{'all':!![]}];}return db[_0x3f60('0x5e')][_0x3f60('0x62')](_0x3b39a0);})[_0x3f60('0x28')](function(_0x2874a7){_0x3221e1[_0x3f60('0x63')]=_0x2874a7;return _0x3221e1;});}})['then'](respondWithFilteredResult(_0x5025cb,_0x3b39a0))['catch'](handleError(_0x5025cb,null));};exports[_0x3f60('0x64')]=function(_0x4d5cd7,_0x438084,_0x181826){var _0x38a6d3={'raw':!![],'where':{}};var _0x11b3e1={};var _0x37ed84={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x4d5cd7[_0x3f60('0x4e')]['id']}})['then'](handleEntityNotFound(_0x438084,null))['then'](function(_0x51aa38){if(_0x51aa38){_0x11b3e1[_0x3f60('0x3f')]=_[_0x3f60('0x3d')](db[_0x3f60('0x65')][_0x3f60('0x3a')]);_0x11b3e1['query']=_[_0x3f60('0x3d')](_0x4d5cd7[_0x3f60('0x3c')]);_0x11b3e1[_0x3f60('0x3e')]=_[_0x3f60('0x4f')](_0x11b3e1['model'],_0x11b3e1[_0x3f60('0x3c')]);_0x38a6d3[_0x3f60('0x40')]=_['intersection'](_0x11b3e1[_0x3f60('0x3f')],qs[_0x3f60('0x41')](_0x4d5cd7[_0x3f60('0x3c')][_0x3f60('0x41')]));_0x38a6d3[_0x3f60('0x40')]=_0x38a6d3['attributes'][_0x3f60('0x50')]?_0x38a6d3[_0x3f60('0x40')]:_0x11b3e1[_0x3f60('0x3f')];if(!_0x4d5cd7[_0x3f60('0x3c')][_0x3f60('0x5f')](_0x3f60('0x42'))){_0x38a6d3['limit']=qs['limit'](_0x4d5cd7['query']['limit']);_0x38a6d3[_0x3f60('0x43')]=qs['offset'](_0x4d5cd7['query']['offset']);}_0x38a6d3[_0x3f60('0x60')]=qs[_0x3f60('0x44')](_0x4d5cd7[_0x3f60('0x3c')][_0x3f60('0x44')]);_0x38a6d3[_0x3f60('0x45')]=qs[_0x3f60('0x3e')](_[_0x3f60('0x46')](_0x4d5cd7[_0x3f60('0x3c')],_0x11b3e1[_0x3f60('0x3e')]));_0x38a6d3['where'][_0x3f60('0x61')]=_0x51aa38['id'];if(_0x4d5cd7[_0x3f60('0x3c')][_0x3f60('0x2e')]){_0x38a6d3['where']=_[_0x3f60('0x47')](_0x38a6d3[_0x3f60('0x45')],{'$or':_[_0x3f60('0x30')](_0x38a6d3[_0x3f60('0x40')],function(_0x25e1f3){var _0x30c0f2={};_0x30c0f2[_0x25e1f3]={'$like':'%'+_0x4d5cd7['query'][_0x3f60('0x2e')]+'%'};return _0x30c0f2;})});}_0x38a6d3=_[_0x3f60('0x47')]({},_0x38a6d3,_0x4d5cd7['options']);return db['CmHopperHistory'][_0x3f60('0x22')]({'where':_0x38a6d3[_0x3f60('0x45')]})[_0x3f60('0x28')](function(_0x45f896){_0x37ed84[_0x3f60('0x22')]=_0x45f896;if(_0x4d5cd7['query']['includeAll']){_0x38a6d3[_0x3f60('0x4b')]=[{'all':!![]}];}return db[_0x3f60('0x65')][_0x3f60('0x62')](_0x38a6d3);})[_0x3f60('0x28')](function(_0x39a6fa){_0x37ed84[_0x3f60('0x63')]=_0x39a6fa;return _0x37ed84;});}})[_0x3f60('0x28')](respondWithFilteredResult(_0x438084,_0x38a6d3))[_0x3f60('0x4c')](handleError(_0x438084,null));};exports['getHopperFinals']=function(_0x9b8949,_0x7cf08a,_0x22fa44){var _0x18eaaa={'raw':!![],'where':{}};var _0x4d6c6f={};var _0x25fb62={'count':0x0,'rows':[]};return db[_0x3f60('0x49')][_0x3f60('0x66')]({'where':{'id':_0x9b8949[_0x3f60('0x4e')]['id']}})[_0x3f60('0x28')](handleEntityNotFound(_0x7cf08a,null))[_0x3f60('0x28')](function(_0x2b427e){if(_0x2b427e){_0x4d6c6f[_0x3f60('0x3f')]=_[_0x3f60('0x3d')](db[_0x3f60('0x67')]['rawAttributes']);_0x4d6c6f[_0x3f60('0x3c')]=_[_0x3f60('0x3d')](_0x9b8949[_0x3f60('0x3c')]);_0x4d6c6f[_0x3f60('0x3e')]=_['intersection'](_0x4d6c6f[_0x3f60('0x3f')],_0x4d6c6f[_0x3f60('0x3c')]);_0x18eaaa[_0x3f60('0x40')]=_[_0x3f60('0x4f')](_0x4d6c6f['model'],qs['fields'](_0x9b8949[_0x3f60('0x3c')][_0x3f60('0x41')]));_0x18eaaa[_0x3f60('0x40')]=_0x18eaaa[_0x3f60('0x40')][_0x3f60('0x50')]?_0x18eaaa[_0x3f60('0x40')]:_0x4d6c6f[_0x3f60('0x3f')];if(!_0x9b8949[_0x3f60('0x3c')][_0x3f60('0x5f')](_0x3f60('0x42'))){_0x18eaaa[_0x3f60('0x21')]=qs[_0x3f60('0x21')](_0x9b8949[_0x3f60('0x3c')]['limit']);_0x18eaaa['offset']=qs['offset'](_0x9b8949['query'][_0x3f60('0x43')]);}_0x18eaaa['order']=qs['sort'](_0x9b8949[_0x3f60('0x3c')][_0x3f60('0x44')]);_0x18eaaa['where']=qs[_0x3f60('0x3e')](_[_0x3f60('0x46')](_0x9b8949['query'],_0x4d6c6f[_0x3f60('0x3e')]));_0x18eaaa[_0x3f60('0x45')][_0x3f60('0x61')]=_0x2b427e['id'];if(_0x9b8949[_0x3f60('0x3c')]['filter']){_0x18eaaa[_0x3f60('0x45')]=_[_0x3f60('0x47')](_0x18eaaa[_0x3f60('0x45')],{'$or':_[_0x3f60('0x30')](_0x18eaaa[_0x3f60('0x40')],function(_0x17050f){var _0x2b4711={};_0x2b4711[_0x17050f]={'$like':'%'+_0x9b8949[_0x3f60('0x3c')][_0x3f60('0x2e')]+'%'};return _0x2b4711;})});}_0x18eaaa=_[_0x3f60('0x47')]({},_0x18eaaa,_0x9b8949['options']);return db[_0x3f60('0x67')][_0x3f60('0x22')]({'where':_0x18eaaa[_0x3f60('0x45')]})['then'](function(_0x1ceb8a){_0x25fb62[_0x3f60('0x22')]=_0x1ceb8a;if(_0x9b8949['query'][_0x3f60('0x4a')]){_0x18eaaa[_0x3f60('0x4b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x3f60('0x62')](_0x18eaaa);})[_0x3f60('0x28')](function(_0x14659c){_0x25fb62[_0x3f60('0x63')]=_0x14659c;return _0x25fb62;});}})[_0x3f60('0x28')](respondWithFilteredResult(_0x7cf08a,_0x18eaaa))['catch'](handleError(_0x7cf08a,null));};exports[_0x3f60('0x68')]=function(_0x5cde2f,_0x3aa1af,_0x4f20ae){var _0x5315bb={'raw':!![],'where':{}};var _0x312be7={};var _0x40c2ae={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x3f60('0x66')]({'where':{'id':_0x5cde2f['params']['id']}})[_0x3f60('0x28')](handleEntityNotFound(_0x3aa1af,null))[_0x3f60('0x28')](function(_0x4715f9){if(_0x4715f9){_0x312be7[_0x3f60('0x3f')]=_[_0x3f60('0x3d')](db[_0x3f60('0x69')][_0x3f60('0x3a')]);_0x312be7['query']=_[_0x3f60('0x3d')](_0x5cde2f[_0x3f60('0x3c')]);_0x312be7['filters']=_[_0x3f60('0x4f')](_0x312be7[_0x3f60('0x3f')],_0x312be7[_0x3f60('0x3c')]);_0x5315bb['attributes']=_[_0x3f60('0x4f')](_0x312be7['model'],qs[_0x3f60('0x41')](_0x5cde2f['query'][_0x3f60('0x41')]));_0x5315bb[_0x3f60('0x40')]=_0x5315bb[_0x3f60('0x40')]['length']?_0x5315bb[_0x3f60('0x40')]:_0x312be7[_0x3f60('0x3f')];if(!_0x5cde2f[_0x3f60('0x3c')][_0x3f60('0x5f')](_0x3f60('0x42'))){_0x5315bb[_0x3f60('0x21')]=qs[_0x3f60('0x21')](_0x5cde2f[_0x3f60('0x3c')][_0x3f60('0x21')]);_0x5315bb[_0x3f60('0x43')]=qs['offset'](_0x5cde2f['query'][_0x3f60('0x43')]);}_0x5315bb[_0x3f60('0x60')]=qs[_0x3f60('0x44')](_0x5cde2f[_0x3f60('0x3c')][_0x3f60('0x44')]);_0x5315bb[_0x3f60('0x45')]=qs[_0x3f60('0x3e')](_[_0x3f60('0x46')](_0x5cde2f[_0x3f60('0x3c')],_0x312be7[_0x3f60('0x3e')]));_0x5315bb['where'][_0x3f60('0x61')]=_0x4715f9['id'];if(_0x5cde2f[_0x3f60('0x3c')][_0x3f60('0x2e')]){_0x5315bb[_0x3f60('0x45')]=_[_0x3f60('0x47')](_0x5315bb[_0x3f60('0x45')],{'$or':_[_0x3f60('0x30')](_0x5315bb['attributes'],function(_0xa0d7bd){var _0xbe8580={};_0xbe8580[_0xa0d7bd]={'$like':'%'+_0x5cde2f['query'][_0x3f60('0x2e')]+'%'};return _0xbe8580;})});}_0x5315bb=_[_0x3f60('0x47')]({},_0x5315bb,_0x5cde2f[_0x3f60('0x48')]);return db[_0x3f60('0x69')][_0x3f60('0x22')]({'where':_0x5315bb[_0x3f60('0x45')]})[_0x3f60('0x28')](function(_0x28544e){_0x40c2ae['count']=_0x28544e;if(_0x5cde2f[_0x3f60('0x3c')]['includeAll']){_0x5315bb[_0x3f60('0x4b')]=[{'all':!![]}];}return db[_0x3f60('0x69')][_0x3f60('0x62')](_0x5315bb);})[_0x3f60('0x28')](function(_0x24d356){_0x40c2ae[_0x3f60('0x63')]=_0x24d356;return _0x40c2ae;});}})[_0x3f60('0x28')](respondWithFilteredResult(_0x3aa1af,_0x5315bb))[_0x3f60('0x4c')](handleError(_0x3aa1af,null));};exports[_0x3f60('0x6a')]=function(_0x435111,_0x37a06f,_0x2acd37){var _0x2a3296={};var _0x195a81={};var _0x5777a4;var _0x4743d9;return db[_0x3f60('0x49')][_0x3f60('0x66')]({'where':{'id':_0x435111['params']['id']}})[_0x3f60('0x28')](handleEntityNotFound(_0x37a06f,null))['then'](function(_0x4876db){if(_0x4876db){_0x5777a4=_0x4876db;_0x195a81[_0x3f60('0x3f')]=_['keys'](db['Team'][_0x3f60('0x3a')]);_0x195a81[_0x3f60('0x3c')]=_[_0x3f60('0x3d')](_0x435111[_0x3f60('0x3c')]);_0x195a81['filters']=_['intersection'](_0x195a81[_0x3f60('0x3f')],_0x195a81[_0x3f60('0x3c')]);_0x2a3296['attributes']=_[_0x3f60('0x4f')](_0x195a81[_0x3f60('0x3f')],qs['fields'](_0x435111[_0x3f60('0x3c')][_0x3f60('0x41')]));_0x2a3296[_0x3f60('0x40')]=_0x2a3296[_0x3f60('0x40')][_0x3f60('0x50')]?_0x2a3296[_0x3f60('0x40')]:_0x195a81[_0x3f60('0x3f')];_0x2a3296[_0x3f60('0x60')]=qs['sort'](_0x435111['query'][_0x3f60('0x44')]);_0x2a3296[_0x3f60('0x45')]=qs[_0x3f60('0x3e')](_['pick'](_0x435111[_0x3f60('0x3c')],_0x195a81['filters']));if(_0x435111['query'][_0x3f60('0x2e')]){_0x2a3296[_0x3f60('0x45')]=_['merge'](_0x2a3296[_0x3f60('0x45')],{'$or':_['map'](_0x2a3296[_0x3f60('0x40')],function(_0x4f020a){var _0xe8fbdf={};_0xe8fbdf[_0x4f020a]={'$like':'%'+_0x435111[_0x3f60('0x3c')]['filter']+'%'};return _0xe8fbdf;})});}_0x2a3296=_['merge']({},_0x2a3296,_0x435111['options']);return _0x5777a4['getTeams'](_0x2a3296);}})[_0x3f60('0x28')](function(_0x3f54ff){if(_0x3f54ff){_0x4743d9=_0x3f54ff[_0x3f60('0x50')];if(!_0x435111[_0x3f60('0x3c')][_0x3f60('0x5f')](_0x3f60('0x42'))){_0x2a3296[_0x3f60('0x21')]=qs['limit'](_0x435111['query'][_0x3f60('0x21')]);_0x2a3296[_0x3f60('0x43')]=qs['offset'](_0x435111[_0x3f60('0x3c')]['offset']);}return _0x5777a4[_0x3f60('0x6a')](_0x2a3296);}})[_0x3f60('0x28')](function(_0x458a10){if(_0x458a10){return _0x458a10?{'count':_0x4743d9,'rows':_0x458a10}:null;}})['then'](respondWithResult(_0x37a06f,null))['catch'](handleError(_0x37a06f,null));};exports[_0x3f60('0x6b')]=function(_0x5eb441,_0x1144e6,_0x36169d){var _0x37f0c4=_0x5eb441[_0x3f60('0x52')][_0x3f60('0x6c')];var _0x478a0b=_['map'](_0x37f0c4,'id');return db[_0x3f60('0x6d')][_0x3f60('0x62')]({'where':{'id':_0x478a0b},'attributes':['id'],'include':[{'model':db[_0x3f60('0x6e')],'as':'Agents','attributes':['id','name',_0x3f60('0x6f'),'voicePause',_0x3f60('0x70')],'raw':!![]}]})[_0x3f60('0x28')](function(_0x599ed6){if(_0x599ed6){var _0x242a6e=_[_0x3f60('0x71')](_0x599ed6,function(_0x5c4b36){var _0x4f21f6=_0x5c4b36['get']({'plain':!![]});_0x4f21f6[_0x3f60('0x72')][_0x3f60('0x73')](function(_0x5e0c61){_0x5e0c61[_0x3f60('0x74')]=_['find'](_0x37f0c4,{'id':_0x4f21f6['id']})['penalty'];});return _0x4f21f6[_0x3f60('0x72')];});return db['VoiceQueue'][_0x3f60('0x34')]({'where':{'id':_0x5eb441[_0x3f60('0x4e')]['id']}})['then'](function(_0x3e5289){return db[_0x3f60('0x75')][_0x3f60('0x76')](function(_0x460d02){return _0x3e5289['addTeams'](_0x478a0b,{'transaction':_0x460d02})[_0x3f60('0x28')](function(){return BPromise['each'](_0x37f0c4,function(_0x64b02f){return db[_0x3f60('0x77')]['upsert']({'TeamId':_0x64b02f['id'],'VoiceQueueId':_0x5eb441[_0x3f60('0x4e')]['id'],'penalty':_0x64b02f[_0x3f60('0x74')]},{'transaction':_0x460d02});});})[_0x3f60('0x28')](function(){return BPromise[_0x3f60('0x78')](_0x242a6e,function(_0x5d79d5){return db[_0x3f60('0x79')][_0x3f60('0x7a')]({'where':{'UserId':_0x5d79d5['id'],'VoiceQueueId':_0x5eb441[_0x3f60('0x4e')]['id']},'defaults':{'penalty':_0x5d79d5[_0x3f60('0x74')]},'transaction':_0x460d02});});})['then'](function(){return BPromise[_0x3f60('0x78')](_['filter'](_0x242a6e,{'online':!![]}),function(_0x3db3b8){return db[_0x3f60('0x7b')][_0x3f60('0x7c')]({'membername':_0x3db3b8[_0x3f60('0x35')],'UserId':_0x3db3b8['id'],'queue_name':_0x3e5289['name'],'VoiceQueueId':_0x3e5289['id'],'interface':_[_0x3f60('0x7d')](_0x3db3b8['interface'])?util[_0x3f60('0x7e')](_0x3f60('0x7f'),_0x3db3b8[_0x3f60('0x35')]):_0x3db3b8[_0x3f60('0x70')],'paused':_0x3db3b8[_0x3f60('0x80')]||![],'penalty':_0x3db3b8[_0x3f60('0x74')]},{'transaction':_0x460d02});});})['then'](function(){_0x242a6e['forEach'](function(_0x53d6a4){socket[_0x3f60('0x81')](_0x3f60('0x82'),{'UserId':_0x53d6a4['id'],'VoiceQueueId':_0x3e5289['id']});});});});});}})['then'](respondWithStatusCode(_0x1144e6,null))[_0x3f60('0x4c')](handleError(_0x1144e6,null));};exports[_0x3f60('0x83')]=function(_0x3d0b8c,_0x37ecbd,_0x38c7fc){return db[_0x3f60('0x6d')]['findAll']({'where':{'id':_0x3d0b8c[_0x3f60('0x3c')][_0x3f60('0x84')]},'attributes':['id'],'include':[{'model':db[_0x3f60('0x6e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x3f60('0x28')](handleEntityNotFound(_0x37ecbd,null))[_0x3f60('0x28')](function(_0xad04c7){var _0x2c33ab=_[_0x3f60('0x30')](_0xad04c7,'id');var _0x484ed7=[];var _0xe1c7ac=[];var _0x250883=squel[_0x3f60('0x85')]();_0x250883[_0x3f60('0x86')](_0x3f60('0x87'))['from'](_0x3f60('0x88'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3f60('0x45')]('VoiceQueueId\x20=\x20?',_0x3d0b8c[_0x3f60('0x4e')]['id']);for(var _0x5d7071=0x0;_0x5d7071<_0xad04c7['length'];_0x5d7071+=0x1){let _0x114315=_0xad04c7[_0x5d7071];for(var _0x2f68b2=0x0;_0x2f68b2<_0x114315[_0x3f60('0x72')][_0x3f60('0x50')];_0x2f68b2+=0x1){let _0x26244e=_0x114315[_0x3f60('0x72')][_0x2f68b2];var _0x5323ce=_0x250883[_0x3f60('0x89')]();_0x5323ce[_0x3f60('0x45')]('ut.UserId\x20=\x20?',_0x26244e['id']);_0xe1c7ac[_0x3f60('0x8a')](db[_0x3f60('0x75')]['query'](_0x5323ce[_0x3f60('0x8b')](),{'type':db[_0x3f60('0x75')][_0x3f60('0x8c')][_0x3f60('0x8d')]})['then'](function(_0x4ac864){if(_0x4ac864['length']===0x1){return _0x26244e['id'];}else{var _0x29b5b7=_[_0x3f60('0x8e')](_[_0x3f60('0x30')](_0x4ac864,'TeamId'),function(_0xe98cb8){return _[_0x3f60('0x32')](_0x2c33ab,_0xe98cb8);});if(_0x29b5b7){return _0x26244e['id'];}}}));}}return BPromise[_0x3f60('0x8f')](_0xe1c7ac)[_0x3f60('0x28')](function(_0x7f8774){_0x484ed7=_(_0x484ed7)['union'](_0x7f8774)[_0x3f60('0x90')]()[_0x3f60('0x31')]();return db[_0x3f60('0x49')][_0x3f60('0x34')]({'where':{'id':_0x3d0b8c[_0x3f60('0x4e')]['id']}})[_0x3f60('0x28')](function(_0x3217c1){return db[_0x3f60('0x75')][_0x3f60('0x76')](function(_0x3020cd){return _0x3217c1['removeTeams'](_0x3d0b8c[_0x3f60('0x3c')][_0x3f60('0x84')],{'transaction':_0x3020cd})[_0x3f60('0x28')](function(){if(!_['isEmpty'](_0x484ed7)){return _0x3217c1['removeAgents'](_0x484ed7,{'transaction':_0x3020cd})[_0x3f60('0x28')](function(){return db[_0x3f60('0x7b')][_0x3f60('0x29')]({'where':{'VoiceQueueId':_0x3d0b8c[_0x3f60('0x4e')]['id'],'UserId':_0x484ed7},'transaction':_0x3020cd});});}})['then'](function(){_0x484ed7[_0x3f60('0x73')](function(_0x4bea74){socket[_0x3f60('0x81')](_0x3f60('0x91'),{'UserId':_0x4bea74,'VoiceQueueId':_0x3217c1['id']});});});});});});})[_0x3f60('0x28')](respondWithStatusCode(_0x37ecbd,null))[_0x3f60('0x4c')](handleError(_0x37ecbd,null));};exports[_0x3f60('0x92')]=function(_0x8844d,_0x489e77,_0x3d2d6c){var _0x11c5fb,_0x41fd84;return db[_0x3f60('0x49')]['find']({'where':{'id':_0x8844d[_0x3f60('0x4e')]['id']}})[_0x3f60('0x28')](handleEntityNotFound(_0x489e77,null))['then'](function(_0x121518){if(_0x121518){_0x41fd84=_0x121518;return _0x121518[_0x3f60('0x92')](_0x8844d[_0x3f60('0x52')][_0x3f60('0x84')],_[_0x3f60('0x5b')](_0x8844d[_0x3f60('0x52')],['ids','id'])||{})[_0x3f60('0x93')](function(_0x3143b0){for(var _0xa27a93=0x0;_0xa27a93<_0x8844d['body'][_0x3f60('0x84')][_0x3f60('0x50')];_0xa27a93+=0x1){socket[_0x3f60('0x81')](_0x3f60('0x82'),{'UserId':Number(_0x8844d[_0x3f60('0x52')][_0x3f60('0x84')][_0xa27a93]),'VoiceQueueId':Number(_0x8844d[_0x3f60('0x4e')]['id'])});}return _0x3143b0;});}})[_0x3f60('0x28')](function(_0x262647){_0x11c5fb=_0x262647||[];if(_0x41fd84){return db[_0x3f60('0x6e')][_0x3f60('0x62')]({'where':{'id':_0x8844d[_0x3f60('0x52')][_0x3f60('0x84')]},'attributes':['id',_0x3f60('0x35'),_0x3f60('0x6f'),_0x3f60('0x80'),_0x3f60('0x70')],'raw':!![]});}})[_0x3f60('0x28')](function(_0x4037a1){if(!_['isEmpty'](_0x4037a1)){var _0x45d28c=[];for(var _0x594c3e=0x0;_0x594c3e<_0x4037a1[_0x3f60('0x50')];_0x594c3e++){if(_0x4037a1[_0x594c3e]['online']){_0x45d28c[_0x3f60('0x8a')](db['UserVoiceQueueRt'][_0x3f60('0x7c')]({'membername':_0x4037a1[_0x594c3e][_0x3f60('0x35')],'UserId':_0x4037a1[_0x594c3e]['id'],'queue_name':_0x41fd84[_0x3f60('0x35')],'VoiceQueueId':_0x41fd84['id'],'interface':_[_0x3f60('0x7d')](_0x4037a1[_0x594c3e]['interface'])?util[_0x3f60('0x7e')](_0x3f60('0x7f'),_0x4037a1[_0x594c3e][_0x3f60('0x35')]):_0x4037a1[_0x594c3e][_0x3f60('0x70')],'paused':_0x4037a1[_0x594c3e]['voicePause']||![],'penalty':_0x8844d[_0x3f60('0x52')][_0x3f60('0x74')]||0x0}));}}return BPromise['all'](_0x45d28c);}})[_0x3f60('0x28')](function(){return _0x11c5fb;})[_0x3f60('0x28')](respondWithResult(_0x489e77,null))['catch'](handleError(_0x489e77,null));};exports[_0x3f60('0x94')]=function(_0x1c1a64,_0x38922a,_0x98e7c4){return db['VoiceQueue']['find']({'where':{'id':_0x1c1a64[_0x3f60('0x4e')]['id']}})['then'](handleEntityNotFound(_0x38922a,null))[_0x3f60('0x28')](function(_0x1e9b04){if(_0x1e9b04){return _0x1e9b04[_0x3f60('0x94')](_0x1c1a64['query'][_0x3f60('0x84')])[_0x3f60('0x28')](function(){if(_['isArray'](_0x1c1a64[_0x3f60('0x3c')][_0x3f60('0x84')])){for(var _0x10428e=0x0;_0x10428e<_0x1c1a64['query'][_0x3f60('0x84')][_0x3f60('0x50')];_0x10428e+=0x1){socket['emit'](_0x3f60('0x91'),{'UserId':Number(_0x1c1a64[_0x3f60('0x3c')]['ids'][_0x10428e]),'VoiceQueueId':Number(_0x1c1a64[_0x3f60('0x4e')]['id'])});}}else{socket[_0x3f60('0x81')](_0x3f60('0x91'),{'UserId':Number(_0x1c1a64[_0x3f60('0x3c')][_0x3f60('0x84')]),'VoiceQueueId':Number(_0x1c1a64['params']['id'])});}});}})[_0x3f60('0x28')](function(_0x316964){return db[_0x3f60('0x7b')]['destroy']({'where':{'VoiceQueueId':_0x1c1a64[_0x3f60('0x4e')]['id'],'UserId':_0x1c1a64[_0x3f60('0x3c')]['ids']}})[_0x3f60('0x28')](function(){return _0x316964;});})[_0x3f60('0x28')](respondWithStatusCode(_0x38922a,null))['catch'](handleError(_0x38922a,null));};exports[_0x3f60('0x95')]=function(_0xe78b93,_0x33273c,_0x5598cb){var _0x14a0db={};var _0x5a4f01={};var _0x48ff63;var _0x4e83d9;return db[_0x3f60('0x49')][_0x3f60('0x66')]({'where':{'id':_0xe78b93[_0x3f60('0x4e')]['id']}})[_0x3f60('0x28')](handleEntityNotFound(_0x33273c,null))[_0x3f60('0x28')](function(_0x3e9ec9){if(_0x3e9ec9){_0x48ff63=_0x3e9ec9;_0x5a4f01[_0x3f60('0x3f')]=_['keys'](db[_0x3f60('0x6e')][_0x3f60('0x3a')]);_0x5a4f01['query']=_[_0x3f60('0x3d')](_0xe78b93[_0x3f60('0x3c')]);_0x5a4f01[_0x3f60('0x3e')]=_[_0x3f60('0x4f')](_0x5a4f01[_0x3f60('0x3f')],_0x5a4f01[_0x3f60('0x3c')]);_0x14a0db[_0x3f60('0x40')]=_[_0x3f60('0x4f')](_0x5a4f01[_0x3f60('0x3f')],qs['fields'](_0xe78b93[_0x3f60('0x3c')]['fields']));_0x14a0db[_0x3f60('0x40')]=_0x14a0db[_0x3f60('0x40')][_0x3f60('0x50')]?_0x14a0db[_0x3f60('0x40')]:_0x5a4f01[_0x3f60('0x3f')];_0x14a0db[_0x3f60('0x60')]=qs[_0x3f60('0x44')](_0xe78b93['query'][_0x3f60('0x44')]);_0x14a0db[_0x3f60('0x45')]=qs['filters'](_['pick'](_0xe78b93[_0x3f60('0x3c')],_0x5a4f01[_0x3f60('0x3e')]));if(_0xe78b93[_0x3f60('0x3c')][_0x3f60('0x2e')]){_0x14a0db[_0x3f60('0x45')]=_[_0x3f60('0x47')](_0x14a0db[_0x3f60('0x45')],{'$or':_[_0x3f60('0x30')](_0x14a0db[_0x3f60('0x40')],function(_0x11b081){var _0x39be80={};_0x39be80[_0x11b081]={'$like':'%'+_0xe78b93[_0x3f60('0x3c')]['filter']+'%'};return _0x39be80;})});}_0x14a0db=_[_0x3f60('0x47')]({},_0x14a0db,_0xe78b93[_0x3f60('0x48')]);return _0x48ff63[_0x3f60('0x95')](_0x14a0db);}})[_0x3f60('0x28')](function(_0x5e2dbb){if(_0x5e2dbb){_0x4e83d9=_0x5e2dbb[_0x3f60('0x50')];if(!_0xe78b93['query'][_0x3f60('0x5f')](_0x3f60('0x42'))){_0x14a0db[_0x3f60('0x21')]=qs[_0x3f60('0x21')](_0xe78b93[_0x3f60('0x3c')][_0x3f60('0x21')]);_0x14a0db[_0x3f60('0x43')]=qs[_0x3f60('0x43')](_0xe78b93[_0x3f60('0x3c')][_0x3f60('0x43')]);}return _0x48ff63[_0x3f60('0x95')](_0x14a0db);}})[_0x3f60('0x28')](function(_0x116748){if(_0x116748){return _0x116748?{'count':_0x4e83d9,'rows':_0x116748}:null;}})['then'](respondWithResult(_0x33273c,null))[_0x3f60('0x4c')](handleError(_0x33273c,null));};exports[_0x3f60('0x96')]=function(_0x1b219c,_0x2d444b,_0x3e681d){var _0x39a88e={};var _0x18c3fd={};var _0x20cfcf;var _0x4d8301;return db[_0x3f60('0x49')][_0x3f60('0x66')]({'where':{'id':_0x1b219c[_0x3f60('0x4e')]['id']}})[_0x3f60('0x28')](handleEntityNotFound(_0x2d444b,null))['then'](function(_0x4a91e9){if(_0x4a91e9){_0x20cfcf=_0x4a91e9;_0x18c3fd[_0x3f60('0x3f')]=_[_0x3f60('0x3d')](db[_0x3f60('0x7b')][_0x3f60('0x3a')]);_0x18c3fd[_0x3f60('0x3c')]=_[_0x3f60('0x3d')](_0x1b219c[_0x3f60('0x3c')]);_0x18c3fd[_0x3f60('0x3e')]=_[_0x3f60('0x4f')](_0x18c3fd[_0x3f60('0x3f')],_0x18c3fd[_0x3f60('0x3c')]);_0x39a88e[_0x3f60('0x40')]=_['intersection'](_0x18c3fd[_0x3f60('0x3f')],qs[_0x3f60('0x41')](_0x1b219c['query'][_0x3f60('0x41')]));_0x39a88e[_0x3f60('0x40')]=_0x39a88e[_0x3f60('0x40')]['length']?_0x39a88e[_0x3f60('0x40')]:_0x18c3fd[_0x3f60('0x3f')];_0x39a88e['order']=qs[_0x3f60('0x44')](_0x1b219c[_0x3f60('0x3c')][_0x3f60('0x44')]);_0x39a88e[_0x3f60('0x45')]=qs['filters'](_[_0x3f60('0x46')](_0x1b219c[_0x3f60('0x3c')],_0x18c3fd[_0x3f60('0x3e')]));if(_0x1b219c[_0x3f60('0x3c')][_0x3f60('0x2e')]){_0x39a88e[_0x3f60('0x45')]=_['merge'](_0x39a88e['where'],{'$or':_[_0x3f60('0x30')](_0x39a88e['attributes'],function(_0x3cdee4){var _0x586932={};_0x586932[_0x3cdee4]={'$like':'%'+_0x1b219c['query'][_0x3f60('0x2e')]+'%'};return _0x586932;})});}_0x39a88e=_[_0x3f60('0x47')]({},_0x39a88e,_0x1b219c['options']);return _0x20cfcf[_0x3f60('0x96')](_0x39a88e);}})[_0x3f60('0x28')](function(_0x1a4136){if(_0x1a4136){_0x4d8301=_0x1a4136[_0x3f60('0x50')];if(!_0x1b219c[_0x3f60('0x3c')]['hasOwnProperty'](_0x3f60('0x42'))){_0x39a88e[_0x3f60('0x21')]=qs[_0x3f60('0x21')](_0x1b219c[_0x3f60('0x3c')][_0x3f60('0x21')]);_0x39a88e[_0x3f60('0x43')]=qs[_0x3f60('0x43')](_0x1b219c[_0x3f60('0x3c')]['offset']);}return _0x20cfcf[_0x3f60('0x96')](_0x39a88e);}})[_0x3f60('0x28')](function(_0x4fb1a7){return _0x4fb1a7?{'count':_0x4d8301,'rows':_0x4fb1a7}:null;})['then'](respondWithResult(_0x2d444b,null))[_0x3f60('0x4c')](handleError(_0x2d444b,null));};exports['getLists']=function(_0x476bb0,_0x5751cb,_0x362e04){var _0x442671={};var _0x357999={};var _0x23223e;var _0x41b903;return db[_0x3f60('0x49')]['findOne']({'where':{'id':_0x476bb0[_0x3f60('0x4e')]['id']}})[_0x3f60('0x28')](handleEntityNotFound(_0x5751cb,null))[_0x3f60('0x28')](function(_0xda6687){if(_0xda6687){_0x23223e=_0xda6687;_0x357999[_0x3f60('0x3f')]=_[_0x3f60('0x3d')](db[_0x3f60('0x97')][_0x3f60('0x3a')]);_0x357999[_0x3f60('0x3c')]=_[_0x3f60('0x3d')](_0x476bb0[_0x3f60('0x3c')]);_0x357999['filters']=_[_0x3f60('0x4f')](_0x357999[_0x3f60('0x3f')],_0x357999[_0x3f60('0x3c')]);_0x442671[_0x3f60('0x40')]=_[_0x3f60('0x4f')](_0x357999[_0x3f60('0x3f')],qs[_0x3f60('0x41')](_0x476bb0[_0x3f60('0x3c')][_0x3f60('0x41')]));_0x442671['attributes']=_0x442671[_0x3f60('0x40')][_0x3f60('0x50')]?_0x442671[_0x3f60('0x40')]:_0x357999[_0x3f60('0x3f')];_0x442671['order']=qs[_0x3f60('0x44')](_0x476bb0['query'][_0x3f60('0x44')]);_0x442671['where']=qs[_0x3f60('0x3e')](_[_0x3f60('0x46')](_0x476bb0[_0x3f60('0x3c')],_0x357999[_0x3f60('0x3e')]));if(_0x476bb0[_0x3f60('0x3c')]['filter']){_0x442671[_0x3f60('0x45')]=_['merge'](_0x442671[_0x3f60('0x45')],{'$or':_[_0x3f60('0x30')](_0x442671[_0x3f60('0x40')],function(_0x17f411){var _0x3e7883={};_0x3e7883[_0x17f411]={'$like':'%'+_0x476bb0[_0x3f60('0x3c')][_0x3f60('0x2e')]+'%'};return _0x3e7883;})});}_0x442671=_[_0x3f60('0x47')]({},_0x442671,_0x476bb0[_0x3f60('0x48')]);return _0x23223e['getLists'](_0x442671);}})[_0x3f60('0x28')](function(_0x17a629){if(_0x17a629){_0x41b903=_0x17a629['length'];if(!_0x476bb0[_0x3f60('0x3c')][_0x3f60('0x5f')](_0x3f60('0x42'))){_0x442671[_0x3f60('0x21')]=qs[_0x3f60('0x21')](_0x476bb0[_0x3f60('0x3c')][_0x3f60('0x21')]);_0x442671[_0x3f60('0x43')]=qs[_0x3f60('0x43')](_0x476bb0[_0x3f60('0x3c')]['offset']);}return _0x23223e[_0x3f60('0x98')](_0x442671);}})[_0x3f60('0x28')](function(_0x22446e){if(_0x22446e){return _0x22446e?{'count':_0x41b903,'rows':_0x22446e}:null;}})[_0x3f60('0x28')](respondWithResult(_0x5751cb,null))[_0x3f60('0x4c')](handleError(_0x5751cb,null));};exports[_0x3f60('0x99')]=function(_0x1401c0,_0x61c416,_0x1e713a){var _0x25994b=moment()[_0x3f60('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');var _0x35697f,_0x3ac401;return db['VoiceQueue'][_0x3f60('0x34')]({'where':{'id':_0x1401c0['params']['id']}})['then'](handleEntityNotFound(_0x61c416,null))[_0x3f60('0x28')](function(_0x1c3f60){if(_0x1c3f60){_0x3ac401=_0x1c3f60;return _0x1c3f60[_0x3f60('0x99')](_0x1401c0[_0x3f60('0x52')]['ids'],_[_0x3f60('0x5b')](_0x1401c0[_0x3f60('0x52')],[_0x3f60('0x84'),'id'])||{});}return null;})[_0x3f60('0x93')](function(_0x3b8c60){var _0x368fd9;_0x35697f=_0x3b8c60||[];var _0x402c43=[];if(_0x3b8c60){for(var _0x307763=0x0;_0x307763<_0x3b8c60[_0x3f60('0x50')];_0x307763+=0x1){var _0x322d11=_0x3b8c60[_0x307763][_0x3f60('0x53')]({'plain':!![]});_0x3ac401['dialCheckDuplicateType']=_0x1401c0['body'][_0x3f60('0x9a')]?_0x1401c0[_0x3f60('0x52')][_0x3f60('0x9a')]:_0x3ac401['dialCheckDuplicateType'];switch(_0x3ac401['dialCheckDuplicateType']){case _0x3f60('0x9b'):_0x368fd9=squel['insert']()[_0x3f60('0x9c')](_0x3f60('0x9d'))[_0x3f60('0x9e')]([_0x3f60('0x9f'),_0x3f60('0xa0'),_0x3f60('0xa1'),_0x3f60('0xa2'),_0x3f60('0x61'),_0x3f60('0x5a'),_0x3f60('0xa3')],squel['select']()['field']('phone','phone')[_0x3f60('0x86')]('\x27'+_0x25994b+'\x27','scheduledAt')[_0x3f60('0x86')]('id',_0x3f60('0xa1'))[_0x3f60('0x86')](_0x322d11['CmListId'][_0x3f60('0x8b')](),_0x3f60('0xa2'))['field'](_0x1401c0[_0x3f60('0x4e')]['id'][_0x3f60('0x8b')](),'VoiceQueueId')[_0x3f60('0x86')]('\x27'+_0x25994b+'\x27','createdAt')[_0x3f60('0x86')]('\x27'+_0x25994b+'\x27','updatedAt')[_0x3f60('0xa4')](_0x3f60('0xa5'))['where'](_0x3f60('0xa6'))[_0x3f60('0x45')]('ListId\x20=\x20?',_0x322d11[_0x3f60('0xa7')]['toString']())['where'](_0x3f60('0xa8'))['where'](_0x3f60('0xa9'),squel[_0x3f60('0x85')]()['field'](_0x3f60('0xaa'))[_0x3f60('0xa4')]('cm_hopper_final')[_0x3f60('0x45')](_0x3f60('0xab'),_0x1401c0[_0x3f60('0x4e')]['id'][_0x3f60('0x8b')]()))[_0x3f60('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3f60('0x85')]()[_0x3f60('0x86')]('COALESCE(phone,\x27\x27)')[_0x3f60('0xa4')]('cm_hopper')[_0x3f60('0x45')]('VoiceQueueId\x20=\x20?',_0x1401c0[_0x3f60('0x4e')]['id'][_0x3f60('0x8b')]())))[_0x3f60('0x8b')]();break;case _0x3f60('0xac'):_0x368fd9=squel[_0x3f60('0xad')]()['into'](_0x3f60('0x9d'))[_0x3f60('0x9e')]([_0x3f60('0x9f'),_0x3f60('0xa0'),'ContactId',_0x3f60('0xa2'),_0x3f60('0x61'),_0x3f60('0x5a'),_0x3f60('0xa3')],squel[_0x3f60('0x85')]()[_0x3f60('0x86')](_0x3f60('0x9f'),_0x3f60('0x9f'))[_0x3f60('0x86')]('\x27'+_0x25994b+'\x27',_0x3f60('0xa0'))[_0x3f60('0x86')]('id',_0x3f60('0xa1'))[_0x3f60('0x86')](_0x322d11[_0x3f60('0xa7')]['toString'](),'ListId')[_0x3f60('0x86')](_0x1401c0[_0x3f60('0x4e')]['id'][_0x3f60('0x8b')](),_0x3f60('0x61'))[_0x3f60('0x86')]('\x27'+_0x25994b+'\x27',_0x3f60('0x5a'))['field']('\x27'+_0x25994b+'\x27',_0x3f60('0xa3'))[_0x3f60('0xa4')](_0x3f60('0xa5'))[_0x3f60('0x45')](_0x3f60('0xa6'))['where'](_0x3f60('0xae'),_0x322d11[_0x3f60('0xa7')]['toString']())['where'](_0x3f60('0xa8'))['where'](_0x3f60('0xa9'),squel['select']()[_0x3f60('0x86')]('COALESCE(phone,\x27\x27)')[_0x3f60('0xa4')](_0x3f60('0x9d'))[_0x3f60('0x45')](_0x3f60('0xab'),_0x1401c0['params']['id'][_0x3f60('0x8b')]())))['toString']();break;default:_0x368fd9=squel[_0x3f60('0xad')]()[_0x3f60('0x9c')](_0x3f60('0x9d'))[_0x3f60('0x9e')]([_0x3f60('0x9f'),'scheduledAt',_0x3f60('0xa1'),_0x3f60('0xa2'),_0x3f60('0x61'),_0x3f60('0x5a'),_0x3f60('0xa3')],squel['select']()[_0x3f60('0x86')](_0x3f60('0x9f'),_0x3f60('0x9f'))['field']('\x27'+_0x25994b+'\x27',_0x3f60('0xa0'))[_0x3f60('0x86')]('id',_0x3f60('0xa1'))[_0x3f60('0x86')](_0x322d11['CmListId']['toString'](),_0x3f60('0xa2'))[_0x3f60('0x86')](_0x1401c0[_0x3f60('0x4e')]['id']['toString'](),_0x3f60('0x61'))[_0x3f60('0x86')]('\x27'+_0x25994b+'\x27','createdAt')[_0x3f60('0x86')]('\x27'+_0x25994b+'\x27',_0x3f60('0xa3'))[_0x3f60('0xa4')]('cm_contacts')[_0x3f60('0x45')]('deletedAt\x20IS\x20NULL')[_0x3f60('0x45')](_0x3f60('0xae'),_0x322d11[_0x3f60('0xa7')][_0x3f60('0x8b')]())[_0x3f60('0x45')](_0x3f60('0xa8')))['toString']();}_0x402c43[_0x3f60('0x8a')](db[_0x3f60('0x75')]['query'](_0x368fd9));}return BPromise[_0x3f60('0x8f')](_0x402c43);}})[_0x3f60('0x28')](function(){var _0x3278ae=[];var _0x2d608b=squel['insert']()['into'](_0x3f60('0xaf'))[_0x3f60('0x9e')](['CmHopperId',_0x3f60('0x9f'),_0x3f60('0xb0'),_0x3f60('0x5a'),_0x3f60('0xa3')],squel[_0x3f60('0x85')]()[_0x3f60('0x86')]('h.id')[_0x3f60('0x86')]('ci.item')[_0x3f60('0x86')]('ci.OrderBy+1')['field']('\x27'+_0x25994b+'\x27',_0x3f60('0x5a'))[_0x3f60('0x86')]('\x27'+_0x25994b+'\x27','updatedAt')[_0x3f60('0xa4')]('cm_contact_has_items','ci')[_0x3f60('0xb1')](_0x3f60('0x9d'),'h',_0x3f60('0xb2'))[_0x3f60('0x45')](_0x3f60('0xb3'),_0x25994b)[_0x3f60('0x45')](_0x3f60('0xb4'),_0x3f60('0xb5')))[_0x3f60('0x8b')]();_0x3278ae['push'](db['sequelize'][_0x3f60('0x3c')](_0x2d608b));return BPromise[_0x3f60('0x8f')](_0x3278ae);})['then'](function(){return _0x35697f;})[_0x3f60('0x28')](respondWithResult(_0x61c416,null))[_0x3f60('0x4c')](handleError(_0x61c416,null));};exports['removeLists']=function(_0x36f237,_0x15eea0,_0x360be4){return db[_0x3f60('0x49')][_0x3f60('0x34')]({'where':{'id':_0x36f237['params']['id']}})[_0x3f60('0x28')](handleEntityNotFound(_0x15eea0,null))[_0x3f60('0x28')](function(_0x4b168f){if(_0x4b168f){return _0x4b168f[_0x3f60('0xb6')](_0x36f237[_0x3f60('0x3c')]['ids']);}})[_0x3f60('0x28')](function(_0x365c6d){if(_0x365c6d){return db[_0x3f60('0x5e')][_0x3f60('0x29')]({'where':{'ListId':_0x36f237[_0x3f60('0x3c')]['ids'],'VoiceQueueId':_0x36f237[_0x3f60('0x4e')]['id']}})[_0x3f60('0x28')](function(){return _0x365c6d;});}})[_0x3f60('0x28')](respondWithStatusCode(_0x15eea0,null))[_0x3f60('0x4c')](handleError(_0x15eea0,null));};exports['getBlackLists']=function(_0x9b7d59,_0x1e67fe,_0x54a502){var _0x557fb5={};var _0x3f94af={};var _0x5bdae4;var _0x34f8a3;return db['VoiceQueue'][_0x3f60('0x66')]({'where':{'id':_0x9b7d59[_0x3f60('0x4e')]['id']}})[_0x3f60('0x28')](handleEntityNotFound(_0x1e67fe,null))[_0x3f60('0x28')](function(_0x3dcda9){if(_0x3dcda9){_0x5bdae4=_0x3dcda9;_0x3f94af[_0x3f60('0x3f')]=_[_0x3f60('0x3d')](db[_0x3f60('0x97')][_0x3f60('0x3a')]);_0x3f94af['query']=_[_0x3f60('0x3d')](_0x9b7d59[_0x3f60('0x3c')]);_0x3f94af[_0x3f60('0x3e')]=_[_0x3f60('0x4f')](_0x3f94af[_0x3f60('0x3f')],_0x3f94af['query']);_0x557fb5[_0x3f60('0x40')]=_['intersection'](_0x3f94af['model'],qs[_0x3f60('0x41')](_0x9b7d59[_0x3f60('0x3c')]['fields']));_0x557fb5[_0x3f60('0x40')]=_0x557fb5[_0x3f60('0x40')][_0x3f60('0x50')]?_0x557fb5['attributes']:_0x3f94af['model'];_0x557fb5['order']=qs[_0x3f60('0x44')](_0x9b7d59[_0x3f60('0x3c')][_0x3f60('0x44')]);_0x557fb5[_0x3f60('0x45')]=qs['filters'](_[_0x3f60('0x46')](_0x9b7d59[_0x3f60('0x3c')],_0x3f94af[_0x3f60('0x3e')]));if(_0x9b7d59['query']['filter']){_0x557fb5['where']=_[_0x3f60('0x47')](_0x557fb5[_0x3f60('0x45')],{'$or':_['map'](_0x557fb5[_0x3f60('0x40')],function(_0x14b2bd){var _0x54d192={};_0x54d192[_0x14b2bd]={'$like':'%'+_0x9b7d59[_0x3f60('0x3c')]['filter']+'%'};return _0x54d192;})});}_0x557fb5=_[_0x3f60('0x47')]({},_0x557fb5,_0x9b7d59[_0x3f60('0x48')]);return _0x5bdae4[_0x3f60('0xb7')](_0x557fb5);}})[_0x3f60('0x28')](function(_0x1f9509){if(_0x1f9509){_0x34f8a3=_0x1f9509[_0x3f60('0x50')];if(!_0x9b7d59[_0x3f60('0x3c')][_0x3f60('0x5f')](_0x3f60('0x42'))){_0x557fb5['limit']=qs[_0x3f60('0x21')](_0x9b7d59[_0x3f60('0x3c')]['limit']);_0x557fb5[_0x3f60('0x43')]=qs['offset'](_0x9b7d59[_0x3f60('0x3c')][_0x3f60('0x43')]);}return _0x5bdae4[_0x3f60('0xb7')](_0x557fb5);}})[_0x3f60('0x28')](function(_0x2288c7){if(_0x2288c7){return _0x2288c7?{'count':_0x34f8a3,'rows':_0x2288c7}:null;}})[_0x3f60('0x28')](respondWithResult(_0x1e67fe,null))['catch'](handleError(_0x1e67fe,null));};exports[_0x3f60('0xb8')]=function(_0x261948,_0x3272ab,_0xf54b75){var _0x10c3d2,_0x3bc18d;return db[_0x3f60('0x49')][_0x3f60('0x34')]({'where':{'id':_0x261948[_0x3f60('0x4e')]['id']}})[_0x3f60('0x28')](handleEntityNotFound(_0x3272ab,null))['then'](function(_0x5d7a54){if(_0x5d7a54){_0x3bc18d=_0x5d7a54;return _0x5d7a54[_0x3f60('0xb8')](_0x261948[_0x3f60('0x52')]['ids'],_[_0x3f60('0x5b')](_0x261948['body'],[_0x3f60('0x84'),'id'])||{});}return null;})[_0x3f60('0x93')](function(_0x412348){var _0x17388b;_0x10c3d2=_0x412348||[];var _0x322823=[];if(_0x412348){for(var _0xc24848=0x0;_0xc24848<_0x412348[_0x3f60('0x50')];_0xc24848+=0x1){var _0x20e075=_0x412348[_0xc24848]['get']({'plain':!![]});_0x17388b=squel[_0x3f60('0xad')]()['into'](_0x3f60('0xb9'))[_0x3f60('0x9e')]([_0x3f60('0x9f'),_0x3f60('0xa1'),_0x3f60('0xa2'),_0x3f60('0x61'),_0x3f60('0x5a'),_0x3f60('0xa3')],squel[_0x3f60('0x85')]()[_0x3f60('0x86')](_0x3f60('0x9f'),'phone')[_0x3f60('0x86')]('id',_0x3f60('0xa1'))[_0x3f60('0x86')](_0x20e075[_0x3f60('0xa7')][_0x3f60('0x8b')](),_0x3f60('0xa2'))['field'](_0x261948[_0x3f60('0x4e')]['id'][_0x3f60('0x8b')](),_0x3f60('0x61'))[_0x3f60('0x86')]('NOW()',_0x3f60('0x5a'))['field']('NOW()',_0x3f60('0xa3'))['from']('cm_contacts')[_0x3f60('0x45')](_0x3f60('0xa6'))[_0x3f60('0x45')](_0x3f60('0xae'),_0x20e075[_0x3f60('0xa7')][_0x3f60('0x8b')]())[_0x3f60('0x45')](_0x3f60('0xa8')))[_0x3f60('0x8b')]();_0x322823['push'](db[_0x3f60('0x75')][_0x3f60('0x3c')](_0x17388b));}return BPromise['all'](_0x322823);}})[_0x3f60('0x28')](function(){return _0x10c3d2;})['then'](respondWithResult(_0x3272ab,null))[_0x3f60('0x4c')](handleError(_0x3272ab,null));};exports[_0x3f60('0xba')]=function(_0x5b8243,_0x598edd,_0x4b2f9d){return db[_0x3f60('0x49')][_0x3f60('0x34')]({'where':{'id':_0x5b8243['params']['id']}})[_0x3f60('0x28')](handleEntityNotFound(_0x598edd,null))[_0x3f60('0x28')](function(_0x432c54){if(_0x432c54){return _0x432c54[_0x3f60('0xba')](_0x5b8243[_0x3f60('0x3c')]['ids']);}})['then'](function(_0x56cdf4){if(_0x56cdf4){return db[_0x3f60('0x69')]['destroy']({'where':{'ListId':_0x5b8243[_0x3f60('0x3c')][_0x3f60('0x84')],'VoiceQueueId':_0x5b8243['params']['id']}})[_0x3f60('0x28')](function(){return _0x56cdf4;});}})[_0x3f60('0x28')](respondWithStatusCode(_0x598edd,null))[_0x3f60('0x4c')](handleError(_0x598edd,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 4dca405..f50e3d2 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 _0xdaaf=['hook','VoiceQueue','save','remove','emit','hasOwnProperty'];(function(_0x152b25,_0x5da2a5){var _0x41b54a=function(_0x515690){while(--_0x515690){_0x152b25['push'](_0x152b25['shift']());}};_0x41b54a(++_0x5da2a5);}(_0xdaaf,0x1d5));var _0xfdaa=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xdaaf[_0x57b54c];return _0x59cc19;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db'][_0xfdaa('0x0')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfdaa('0x1'),'afterUpdate':'update','afterDestroy':_0xfdaa('0x2')};function emitEvent(_0x38519f){return function(_0x52f9e9,_0x11fea7,_0x5f0a7e){VoiceQueueEvents[_0xfdaa('0x3')](_0x38519f+':'+_0x52f9e9['id'],_0x52f9e9);VoiceQueueEvents[_0xfdaa('0x3')](_0x38519f,_0x52f9e9);_0x5f0a7e(null);};}for(var e in events){if(events[_0xfdaa('0x4')](e)){var event=events[e];VoiceQueue[_0xfdaa('0x5')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xb6a5=['save','update','remove','emit','exports','events','../../mysqldb','setMaxListeners'];(function(_0x28bcbd,_0x3c7e7c){var _0x3532cd=function(_0x10ec85){while(--_0x10ec85){_0x28bcbd['push'](_0x28bcbd['shift']());}};_0x3532cd(++_0x3c7e7c);}(_0xb6a5,0x95));var _0x5b6a=function(_0x1ecbd5,_0xf05f7c){_0x1ecbd5=_0x1ecbd5-0x0;var _0x1be527=_0xb6a5[_0x1ecbd5];return _0x1be527;};'use strict';var EventEmitter=require(_0x5b6a('0x0'));var VoiceQueue=require(_0x5b6a('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x5b6a('0x2')](0x0);var events={'afterCreate':_0x5b6a('0x3'),'afterUpdate':_0x5b6a('0x4'),'afterDestroy':_0x5b6a('0x5')};function emitEvent(_0x22ef27){return function(_0x5751cb,_0x178cc2,_0x1534af){VoiceQueueEvents['emit'](_0x22ef27+':'+_0x5751cb['id'],_0x5751cb);VoiceQueueEvents[_0x5b6a('0x6')](_0x22ef27,_0x5751cb);_0x1534af(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x5b6a('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 0754b3e..559469c 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 _0x55ca=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0x55ca,0x126));var _0xa55c=function(_0x3a07c1,_0x34d57f){_0x3a07c1=_0x3a07c1-0x0;var _0x2bbe15=_0x55ca[_0x3a07c1];return _0x2bbe15;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('VoiceQueue',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x178a9c,_0x562a28){var _0x3fd933=function(_0x37a0e2){while(--_0x37a0e2){_0x178a9c['push'](_0x178a9c['shift']());}};_0x3fd933(++_0x562a28);}(_0x3e74,0x175));var _0x43e7=function(_0xc10194,_0x275fc4){_0xc10194=_0xc10194-0x0;var _0x1c7743=_0x3e74[_0xc10194];return _0x1c7743;};'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/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 93663c7..847f288 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 _0x391c=['client','http','redis','socket.io-emitter','./voiceQueue.socket','register','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueue','options','raw','where','attributes','include','map','model','then','ShowVoiceQueue','VoiceQueue','find','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3bdd36,_0x139fe0){var _0x4c3089=function(_0x3f6dcb){while(--_0x3f6dcb){_0x3bdd36['push'](_0x3bdd36['shift']());}};_0x4c3089(++_0x139fe0);}(_0x391c,0x1e5));var _0xc391=function(_0x4fb7b7,_0x5a6f8c){_0x4fb7b7=_0x4fb7b7-0x0;var _0x3ebcc5=_0x391c[_0x4fb7b7];return _0x3ebcc5;};'use strict';var _=require(_0xc391('0x0'));var util=require(_0xc391('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc391('0x2'));var fs=require('fs');var Redis=require(_0xc391('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc391('0x4'));var logger=require(_0xc391('0x5'))(_0xc391('0x6'));var config=require(_0xc391('0x7'));var jayson=require(_0xc391('0x8'));var client=jayson[_0xc391('0x9')][_0xc391('0xa')]({'port':0x232a});config[_0xc391('0xb')]=_['defaults'](config[_0xc391('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xc391('0xc'))(new Redis(config[_0xc391('0xb')]));require(_0xc391('0xd'))[_0xc391('0xe')](socket);function respondWithRpcPromise(_0x1207f1,_0x4f5900,_0x42e4f8){return new BPromise(function(_0x33a3ae,_0xcbc04f){return client['request'](_0x1207f1,_0x42e4f8)['then'](function(_0x10548b){logger[_0xc391('0xf')](_0xc391('0x10'),_0x4f5900,_0xc391('0x11'));logger[_0xc391('0x12')](_0xc391('0x13'),_0x4f5900,_0xc391('0x11'),JSON[_0xc391('0x14')](_0x10548b));if(_0x10548b['error']){if(_0x10548b[_0xc391('0x15')][_0xc391('0x16')]===0x1f4){logger[_0xc391('0x15')](_0xc391('0x10'),_0x4f5900,_0x10548b[_0xc391('0x15')][_0xc391('0x17')]);return _0xcbc04f(_0x10548b[_0xc391('0x15')][_0xc391('0x17')]);}logger[_0xc391('0x15')](_0xc391('0x10'),_0x4f5900,_0x10548b[_0xc391('0x15')]['message']);return _0x33a3ae(_0x10548b[_0xc391('0x15')][_0xc391('0x17')]);}else{logger[_0xc391('0xf')](_0xc391('0x10'),_0x4f5900,_0xc391('0x11'));_0x33a3ae(_0x10548b[_0xc391('0x18')]['message']);}})[_0xc391('0x19')](function(_0x566643){logger[_0xc391('0x15')](_0xc391('0x10'),_0x4f5900,_0x566643);_0xcbc04f(_0x566643);});});}exports[_0xc391('0x1a')]=function(_0x285856){var _0x442063=this;return new Promise(function(_0xd0649e,_0xc196b7){return db['VoiceQueue']['findAll']({'raw':_0x285856[_0xc391('0x1b')]?_0x285856[_0xc391('0x1b')][_0xc391('0x1c')]===undefined?!![]:![]:!![],'where':_0x285856['options']?_0x285856[_0xc391('0x1b')][_0xc391('0x1d')]||null:null,'attributes':_0x285856[_0xc391('0x1b')]?_0x285856[_0xc391('0x1b')][_0xc391('0x1e')]||null:null,'limit':_0x285856[_0xc391('0x1b')]?_0x285856[_0xc391('0x1b')]['limit']||null:null,'include':_0x285856[_0xc391('0x1b')]?_0x285856[_0xc391('0x1b')][_0xc391('0x1f')]?_[_0xc391('0x20')](_0x285856[_0xc391('0x1b')][_0xc391('0x1f')],function(_0x27441a){return{'model':db[_0x27441a[_0xc391('0x21')]],'as':_0x27441a['as'],'attributes':_0x27441a['attributes'],'include':_0x27441a[_0xc391('0x1f')]?_[_0xc391('0x20')](_0x27441a[_0xc391('0x1f')],function(_0x56317e){return{'model':db[_0x56317e[_0xc391('0x21')]],'as':_0x56317e['as'],'attributes':_0x56317e[_0xc391('0x1e')],'include':_0x56317e[_0xc391('0x1f')]?_[_0xc391('0x20')](_0x56317e[_0xc391('0x1f')],function(_0x20bff5){return{'model':db[_0x20bff5['model']],'as':_0x20bff5['as'],'attributes':_0x20bff5[_0xc391('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc391('0x22')](function(_0x2f1c12){logger[_0xc391('0xf')](_0xc391('0x1a'),_0x285856);logger[_0xc391('0x12')]('GetVoiceQueue',_0x285856,JSON[_0xc391('0x14')](_0x2f1c12));_0xd0649e(_0x2f1c12);})['catch'](function(_0x2537e3){logger[_0xc391('0x15')](_0xc391('0x1a'),_0x2537e3['message'],_0x285856);_0xc196b7(_0x442063['error'](0x1f4,_0x2537e3[_0xc391('0x17')]));});});};exports[_0xc391('0x23')]=function(_0x3f8169){var _0x117b7c=this;return new Promise(function(_0x16f575,_0x3511f5){return db[_0xc391('0x24')][_0xc391('0x25')]({'raw':_0x3f8169[_0xc391('0x1b')]?_0x3f8169[_0xc391('0x1b')][_0xc391('0x1c')]===undefined?!![]:![]:!![],'where':_0x3f8169[_0xc391('0x1b')]?_0x3f8169['options']['where']||null:null,'attributes':_0x3f8169[_0xc391('0x1b')]?_0x3f8169[_0xc391('0x1b')][_0xc391('0x1e')]||null:null,'include':_0x3f8169['options']?_0x3f8169[_0xc391('0x1b')]['include']?_['map'](_0x3f8169[_0xc391('0x1b')][_0xc391('0x1f')],function(_0x4c0b8a){return{'model':db[_0x4c0b8a[_0xc391('0x21')]],'as':_0x4c0b8a['as'],'attributes':_0x4c0b8a[_0xc391('0x1e')],'include':_0x4c0b8a['include']?_[_0xc391('0x20')](_0x4c0b8a[_0xc391('0x1f')],function(_0x35193c){return{'model':db[_0x35193c[_0xc391('0x21')]],'as':_0x35193c['as'],'attributes':_0x35193c['attributes'],'include':_0x35193c['include']?_[_0xc391('0x20')](_0x35193c['include'],function(_0x268215){return{'model':db[_0x268215['model']],'as':_0x268215['as'],'attributes':_0x268215[_0xc391('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc391('0x22')](function(_0x3c83d6){logger[_0xc391('0xf')](_0xc391('0x23'),_0x3f8169);logger[_0xc391('0x12')](_0xc391('0x23'),_0x3f8169,JSON[_0xc391('0x14')](_0x3c83d6));_0x16f575(_0x3c83d6);})['catch'](function(_0x2398c0){logger['error'](_0xc391('0x23'),_0x2398c0[_0xc391('0x17')],_0x3f8169);_0x3511f5(_0x117b7c[_0xc391('0x15')](0x1f4,_0x2398c0[_0xc391('0x17')]));});});}; \ No newline at end of file +var _0x1208=['randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','options','raw','limit','include','map','model','attributes','ShowVoiceQueue','find','lodash','moment','bluebird'];(function(_0x4488fd,_0x462ac4){var _0x5a258f=function(_0x26204d){while(--_0x26204d){_0x4488fd['push'](_0x4488fd['shift']());}};_0x5a258f(++_0x462ac4);}(_0x1208,0x6f));var _0x8120=function(_0x574929,_0x201e5e){_0x574929=_0x574929-0x0;var _0x4626bf=_0x1208[_0x574929];return _0x4626bf;};'use strict';var _=require(_0x8120('0x0'));var util=require('util');var moment=require(_0x8120('0x1'));var BPromise=require(_0x8120('0x2'));var rs=require(_0x8120('0x3'));var fs=require('fs');var Redis=require(_0x8120('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8120('0x5'))('rpc');var config=require(_0x8120('0x6'));var jayson=require(_0x8120('0x7'));var client=jayson[_0x8120('0x8')][_0x8120('0x9')]({'port':0x232a});config[_0x8120('0xa')]=_[_0x8120('0xb')](config[_0x8120('0xa')],{'host':_0x8120('0xc'),'port':0x18eb});var socket=require(_0x8120('0xd'))(new Redis(config['redis']));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x536c56,_0x18975c,_0x15214d){return new BPromise(function(_0x11f201,_0x4d2927){return client[_0x8120('0xe')](_0x536c56,_0x15214d)[_0x8120('0xf')](function(_0x6bbdc7){logger[_0x8120('0x10')](_0x8120('0x11'),_0x18975c,_0x8120('0x12'));logger[_0x8120('0x13')](_0x8120('0x14'),_0x18975c,_0x8120('0x12'),JSON[_0x8120('0x15')](_0x6bbdc7));if(_0x6bbdc7[_0x8120('0x16')]){if(_0x6bbdc7[_0x8120('0x16')][_0x8120('0x17')]===0x1f4){logger[_0x8120('0x16')](_0x8120('0x11'),_0x18975c,_0x6bbdc7[_0x8120('0x16')][_0x8120('0x18')]);return _0x4d2927(_0x6bbdc7['error'][_0x8120('0x18')]);}logger[_0x8120('0x16')](_0x8120('0x11'),_0x18975c,_0x6bbdc7['error'][_0x8120('0x18')]);return _0x11f201(_0x6bbdc7[_0x8120('0x16')]['message']);}else{logger[_0x8120('0x10')](_0x8120('0x11'),_0x18975c,_0x8120('0x12'));_0x11f201(_0x6bbdc7[_0x8120('0x19')][_0x8120('0x18')]);}})[_0x8120('0x1a')](function(_0xedeced){logger[_0x8120('0x16')](_0x8120('0x11'),_0x18975c,_0xedeced);_0x4d2927(_0xedeced);});});}exports[_0x8120('0x1b')]=function(_0xce071d){var _0x4b15c5=this;return new Promise(function(_0x245e64,_0x4d9e84){return db[_0x8120('0x1c')]['findAll']({'raw':_0xce071d[_0x8120('0x1d')]?_0xce071d['options'][_0x8120('0x1e')]===undefined?!![]:![]:!![],'where':_0xce071d['options']?_0xce071d[_0x8120('0x1d')]['where']||null:null,'attributes':_0xce071d[_0x8120('0x1d')]?_0xce071d[_0x8120('0x1d')]['attributes']||null:null,'limit':_0xce071d[_0x8120('0x1d')]?_0xce071d['options'][_0x8120('0x1f')]||null:null,'include':_0xce071d['options']?_0xce071d[_0x8120('0x1d')][_0x8120('0x20')]?_[_0x8120('0x21')](_0xce071d[_0x8120('0x1d')][_0x8120('0x20')],function(_0x5c5e80){return{'model':db[_0x5c5e80[_0x8120('0x22')]],'as':_0x5c5e80['as'],'attributes':_0x5c5e80[_0x8120('0x23')],'include':_0x5c5e80[_0x8120('0x20')]?_[_0x8120('0x21')](_0x5c5e80[_0x8120('0x20')],function(_0x5a8aa5){return{'model':db[_0x5a8aa5['model']],'as':_0x5a8aa5['as'],'attributes':_0x5a8aa5['attributes'],'include':_0x5a8aa5['include']?_[_0x8120('0x21')](_0x5a8aa5[_0x8120('0x20')],function(_0x3f00ac){return{'model':db[_0x3f00ac[_0x8120('0x22')]],'as':_0x3f00ac['as'],'attributes':_0x3f00ac['attributes']};}):[]};}):[]};}):[]:[]})[_0x8120('0xf')](function(_0xff04f8){logger['info'](_0x8120('0x1b'),_0xce071d);logger['debug'](_0x8120('0x1b'),_0xce071d,JSON[_0x8120('0x15')](_0xff04f8));_0x245e64(_0xff04f8);})['catch'](function(_0x3f983b){logger['error'](_0x8120('0x1b'),_0x3f983b[_0x8120('0x18')],_0xce071d);_0x4d9e84(_0x4b15c5[_0x8120('0x16')](0x1f4,_0x3f983b[_0x8120('0x18')]));});});};exports[_0x8120('0x24')]=function(_0xa8282){var _0x19ba79=this;return new Promise(function(_0x408a78,_0x204fca){return db[_0x8120('0x1c')][_0x8120('0x25')]({'raw':_0xa8282['options']?_0xa8282[_0x8120('0x1d')][_0x8120('0x1e')]===undefined?!![]:![]:!![],'where':_0xa8282[_0x8120('0x1d')]?_0xa8282[_0x8120('0x1d')]['where']||null:null,'attributes':_0xa8282['options']?_0xa8282[_0x8120('0x1d')][_0x8120('0x23')]||null:null,'include':_0xa8282['options']?_0xa8282[_0x8120('0x1d')][_0x8120('0x20')]?_[_0x8120('0x21')](_0xa8282[_0x8120('0x1d')]['include'],function(_0x530c1c){return{'model':db[_0x530c1c[_0x8120('0x22')]],'as':_0x530c1c['as'],'attributes':_0x530c1c[_0x8120('0x23')],'include':_0x530c1c['include']?_['map'](_0x530c1c['include'],function(_0xf7f624){return{'model':db[_0xf7f624[_0x8120('0x22')]],'as':_0xf7f624['as'],'attributes':_0xf7f624['attributes'],'include':_0xf7f624[_0x8120('0x20')]?_[_0x8120('0x21')](_0xf7f624[_0x8120('0x20')],function(_0x4b50cc){return{'model':db[_0x4b50cc[_0x8120('0x22')]],'as':_0x4b50cc['as'],'attributes':_0x4b50cc['attributes']};}):[]};}):[]};}):[]:[]})[_0x8120('0xf')](function(_0x341bf6){logger[_0x8120('0x10')](_0x8120('0x24'),_0xa8282);logger[_0x8120('0x13')](_0x8120('0x24'),_0xa8282,JSON[_0x8120('0x15')](_0x341bf6));_0x408a78(_0x341bf6);})['catch'](function(_0xe00da6){logger['error'](_0x8120('0x24'),_0xe00da6['message'],_0xa8282);_0x204fca(_0x19ba79[_0x8120('0x16')](0x1f4,_0xe00da6['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 66f5121..e961ca6 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 _0xbe96=['removeListener','register','length','voiceQueue:','./voiceQueue.events','update'];(function(_0x3b9a65,_0x8463e2){var _0x1cf725=function(_0x3cfdad){while(--_0x3cfdad){_0x3b9a65['push'](_0x3b9a65['shift']());}};_0x1cf725(++_0x8463e2);}(_0xbe96,0x130));var _0x6be9=function(_0xdfe5d1,_0x4c33c0){_0xdfe5d1=_0xdfe5d1-0x0;var _0x2c69ba=_0xbe96[_0xdfe5d1];return _0x2c69ba;};'use strict';var VoiceQueueEvents=require(_0x6be9('0x0'));var events=['save','remove',_0x6be9('0x1')];function createListener(_0x5ef6b0,_0x20d7d5){return function(_0x260df7){_0x20d7d5['emit'](_0x5ef6b0,_0x260df7);};}function removeListener(_0x47c28f,_0x47289f){return function(){VoiceQueueEvents[_0x6be9('0x2')](_0x47c28f,_0x47289f);};}exports[_0x6be9('0x3')]=function(_0x20e965){for(var _0x44c366=0x0,_0x298d38=events[_0x6be9('0x4')];_0x44c366<_0x298d38;_0x44c366++){var _0x1a7267=events[_0x44c366];var _0x1a1c3b=createListener(_0x6be9('0x5')+_0x1a7267,_0x20e965);VoiceQueueEvents['on'](_0x1a7267,_0x1a1c3b);}}; \ No newline at end of file +var _0x2cdf=['remove','update','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x2cdf,0x16f));var _0xf2cd=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x2cdf[_0x500419];return _0x241c1a;};'use strict';var VoiceQueueEvents=require(_0xf2cd('0x0'));var events=[_0xf2cd('0x1'),_0xf2cd('0x2'),_0xf2cd('0x3')];function createListener(_0x218aba,_0x15bf45){return function(_0x4bfda8){_0x15bf45[_0xf2cd('0x4')](_0x218aba,_0x4bfda8);};}function removeListener(_0x42c53f,_0x14a040){return function(){VoiceQueueEvents[_0xf2cd('0x5')](_0x42c53f,_0x14a040);};}exports[_0xf2cd('0x6')]=function(_0xabb7c8){for(var _0x5ef0bd=0x0,_0x54185a=events[_0xf2cd('0x7')];_0x5ef0bd<_0x54185a;_0x5ef0bd++){var _0x1098db=events[_0x5ef0bd];var _0x2d7ba9=createListener(_0xf2cd('0x8')+_0x1098db,_0xabb7c8);VoiceQueueEvents['on'](_0x1098db,_0x2d7ba9);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 7974f31..b7b383b 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 _0x544d=['isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','post','create','put','update','delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get'];(function(_0x513661,_0x250a4d){var _0x3e659e=function(_0x2d9199){while(--_0x2d9199){_0x513661['push'](_0x513661['shift']());}};_0x3e659e(++_0x250a4d);}(_0x544d,0x16d));var _0xd544=function(_0x1e72ad,_0x2c8652){_0x1e72ad=_0x1e72ad-0x0;var _0x4bf7ff=_0x544d[_0x1e72ad];return _0x4bf7ff;};'use strict';var multer=require(_0xd544('0x0'));var util=require('util');var path=require(_0xd544('0x1'));var timeout=require('connect-timeout');var express=require(_0xd544('0x2'));var router=express[_0xd544('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd544('0x4'));var interaction=require(_0xd544('0x5'));var config=require(_0xd544('0x6'));var controller=require(_0xd544('0x7'));router[_0xd544('0x8')]('/',auth[_0xd544('0x9')](),controller[_0xd544('0xa')]);router[_0xd544('0x8')](_0xd544('0xb'),auth[_0xd544('0x9')](),controller[_0xd544('0xc')]);router[_0xd544('0x8')](_0xd544('0xd'),auth[_0xd544('0x9')](),controller[_0xd544('0xe')]);router[_0xd544('0x8')](_0xd544('0xf'),auth['isAuthenticated'](),controller['show']);router[_0xd544('0x10')]('/',auth[_0xd544('0x9')](),controller[_0xd544('0x11')]);router[_0xd544('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xd544('0x13')]);router[_0xd544('0x14')](_0xd544('0xf'),auth[_0xd544('0x9')](),controller[_0xd544('0x15')]);module['exports']=router; \ No newline at end of file +var _0xfcaa=['isAuthenticated','/describe','describe','/index','/:id','show','post','create','put','update','delete','destroy','path','Router','fs-extra','../../config/environment','./voiceQueueReport.controller','get'];(function(_0x53ffbf,_0x1e36a5){var _0x5014cc=function(_0x3783f8){while(--_0x3783f8){_0x53ffbf['push'](_0x53ffbf['shift']());}};_0x5014cc(++_0x1e36a5);}(_0xfcaa,0x186));var _0xafca=function(_0x3755bc,_0x2ff885){_0x3755bc=_0x3755bc-0x0;var _0xc2723a=_0xfcaa[_0x3755bc];return _0xc2723a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xafca('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xafca('0x1')]();var fs_extra=require(_0xafca('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xafca('0x3'));var controller=require(_0xafca('0x4'));router[_0xafca('0x5')]('/',auth[_0xafca('0x6')](),controller['index']);router['get'](_0xafca('0x7'),auth[_0xafca('0x6')](),controller[_0xafca('0x8')]);router[_0xafca('0x5')](_0xafca('0x9'),auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router['get'](_0xafca('0xa'),auth['isAuthenticated'](),controller[_0xafca('0xb')]);router[_0xafca('0xc')]('/',auth[_0xafca('0x6')](),controller[_0xafca('0xd')]);router[_0xafca('0xe')](_0xafca('0xa'),auth[_0xafca('0x6')](),controller[_0xafca('0xf')]);router[_0xafca('0x10')](_0xafca('0xa'),auth[_0xafca('0x6')](),controller[_0xafca('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 024ad04..eddc194 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 _0xa669=['queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE'];(function(_0x3666f5,_0x296815){var _0xf7db1c=function(_0x1bacce){while(--_0x1bacce){_0x3666f5['push'](_0x3666f5['shift']());}};_0xf7db1c(++_0x296815);}(_0xa669,0x109));var _0x9a66=function(_0x4c72a9,_0x1ad0a5){_0x4c72a9=_0x4c72a9-0x0;var _0x1fe56c=_0xa669[_0x4c72a9];return _0x1fe56c;};'use strict';var Sequelize=require(_0x9a66('0x0'));var moment=require(_0x9a66('0x1'));module[_0x9a66('0x2')]={'type':{'type':Sequelize[_0x9a66('0x3')]},'uniqueid':{'type':Sequelize[_0x9a66('0x3')]},'calleridnum':{'type':Sequelize[_0x9a66('0x3')]},'calleridname':{'type':Sequelize[_0x9a66('0x3')]},'queue':{'type':Sequelize[_0x9a66('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x9a66('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x9a66('0x4')],'set':function(_0x233d2d){var _0x559245=moment(_0x233d2d);var _0x394f3b=moment(this['getDataValue'](_0x9a66('0x5')))['format'](_0x9a66('0x6'));var _0x48c10a=_0x559245[_0x9a66('0x7')](_0x394f3b,_0x9a66('0x8'));this[_0x9a66('0x9')](_0x9a66('0xa'),_0x233d2d);this[_0x9a66('0x9')](_0x9a66('0xb'),_0x48c10a||null);}},'position':{'type':Sequelize[_0x9a66('0xc')]},'count':{'type':Sequelize[_0x9a66('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x9a66('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x9a66('0x3')],'comment':_0x9a66('0xe')},'originalposition':{'type':Sequelize[_0x9a66('0xc')]},'channel':{'type':Sequelize[_0x9a66('0x3')]},'connectedlinenum':{'type':Sequelize[_0x9a66('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9a66('0x3')]},'context':{'type':Sequelize[_0x9a66('0x3')]},'exten':{'type':Sequelize[_0x9a66('0x3')]},'priority':{'type':Sequelize[_0x9a66('0x3')]},'holdtime':{'type':Sequelize[_0x9a66('0xc')]},'mohtime':{'type':Sequelize[_0x9a66('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9a66('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x9a66('0x3')]},'transfer':{'type':Sequelize[_0x9a66('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x9a66('0x3')]},'disposition':{'type':Sequelize[_0x9a66('0x3')]},'secondDisposition':{'type':Sequelize[_0x9a66('0x3')]},'thirdDisposition':{'type':Sequelize[_0x9a66('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x9a66('0xc')],'defaultValue':0x0},'note':{'type':Sequelize[_0x9a66('0x3')]}}; \ No newline at end of file +var _0xbe89=['COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds','queuecallerleaveAt','INTEGER','BOOLEAN'];(function(_0x681c4c,_0x412d1f){var _0x578058=function(_0x1e29dd){while(--_0x1e29dd){_0x681c4c['push'](_0x681c4c['shift']());}};_0x578058(++_0x412d1f);}(_0xbe89,0x91));var _0x9be8=function(_0x4acf3a,_0x1681d5){_0x4acf3a=_0x4acf3a-0x0;var _0x1c85e8=_0xbe89[_0x4acf3a];return _0x1c85e8;};'use strict';var Sequelize=require(_0x9be8('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x9be8('0x1')]},'uniqueid':{'type':Sequelize[_0x9be8('0x1')]},'calleridnum':{'type':Sequelize[_0x9be8('0x1')]},'calleridname':{'type':Sequelize[_0x9be8('0x1')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x9be8('0x2')],'set':function(_0x489ba6){var _0x5967aa=moment(_0x489ba6);var _0x2f1347=moment(this[_0x9be8('0x3')](_0x9be8('0x4')))[_0x9be8('0x5')](_0x9be8('0x6'));var _0x1ab035=_0x5967aa['diff'](_0x2f1347,_0x9be8('0x7'));this['setDataValue'](_0x9be8('0x8'),_0x489ba6);this['setDataValue']('holdtime',_0x1ab035||null);}},'position':{'type':Sequelize[_0x9be8('0x9')]},'count':{'type':Sequelize[_0x9be8('0x9')]},'queuecallerabandon':{'type':Sequelize[_0x9be8('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x9be8('0x2')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x9be8('0x2')]},'queuecallerexit':{'type':Sequelize[_0x9be8('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x9be8('0x2')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x9be8('0xb')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x9be8('0x1')]},'connectedlinename':{'type':Sequelize[_0x9be8('0x1')]},'accountcode':{'type':Sequelize[_0x9be8('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x9be8('0x1')]},'priority':{'type':Sequelize[_0x9be8('0x1')]},'holdtime':{'type':Sequelize[_0x9be8('0x9')]},'mohtime':{'type':Sequelize[_0x9be8('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x9be8('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9be8('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x9be8('0x1')]},'transferuniqueid':{'type':Sequelize[_0x9be8('0x1')]},'disposition':{'type':Sequelize[_0x9be8('0x1')]},'secondDisposition':{'type':Sequelize[_0x9be8('0x1')]},'thirdDisposition':{'type':Sequelize[_0x9be8('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x9be8('0x9')],'defaultValue':0x0},'note':{'type':Sequelize[_0x9be8('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 8713ff8..9b53f7f 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 _0xacdb=['fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','type','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','nolimit','pick','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','offset','undefined','limit','set','json','reject','save','update','then','destroy','stack','name','send','index','map','VoiceQueueReport','rawAttributes'];(function(_0x58cf07,_0x2e3858){var _0x42afe0=function(_0x3c71ff){while(--_0x3c71ff){_0x58cf07['push'](_0x58cf07['shift']());}};_0x42afe0(++_0x2e3858);}(_0xacdb,0x1ce));var _0xbacd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xacdb[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xbacd('0x0'));var rimraf=require(_0xbacd('0x1'));var zipdir=require(_0xbacd('0x2'));var jsonpatch=require(_0xbacd('0x3'));var rp=require(_0xbacd('0x4'));var moment=require('moment');var BPromise=require(_0xbacd('0x5'));var Mustache=require('mustache');var util=require(_0xbacd('0x6'));var path=require(_0xbacd('0x7'));var sox=require(_0xbacd('0x8'));var csv=require(_0xbacd('0x9'));var ejs=require(_0xbacd('0xa'));var fs=require('fs');var fs_extra=require(_0xbacd('0xb'));var _=require(_0xbacd('0xc'));var squel=require(_0xbacd('0xd'));var crypto=require(_0xbacd('0xe'));var jsforce=require(_0xbacd('0xf'));var deskjs=require(_0xbacd('0x10'));var toCsv=require(_0xbacd('0x9'));var querystring=require('querystring');var Papa=require(_0xbacd('0x11'));var Redis=require(_0xbacd('0x12'));var authService=require(_0xbacd('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xbacd('0x14'));var hardwareService=require(_0xbacd('0x15'));var logger=require(_0xbacd('0x16'))(_0xbacd('0x17'));var utils=require(_0xbacd('0x18'));var config=require(_0xbacd('0x19'));var licenseUtil=require(_0xbacd('0x1a'));var db=require(_0xbacd('0x1b'))['db'];config[_0xbacd('0x1c')]=_[_0xbacd('0x1d')](config['redis'],{'host':_0xbacd('0x1e'),'port':0x18eb});var socket=require(_0xbacd('0x1f'))(new Redis(config[_0xbacd('0x1c')]));require(_0xbacd('0x20'))[_0xbacd('0x21')](socket);function respondWithStatusCode(_0x408ab3,_0x227ed7){_0x227ed7=_0x227ed7||0xcc;return function(_0x563677){if(_0x563677){return _0x408ab3[_0xbacd('0x22')](_0x227ed7);}return _0x408ab3['status'](_0x227ed7)[_0xbacd('0x23')]();};}function respondWithResult(_0x1ef53c,_0x1ec024){_0x1ec024=_0x1ec024||0xc8;return function(_0x3a1cdc){if(_0x3a1cdc){return _0x1ef53c[_0xbacd('0x24')](_0x1ec024)['json'](_0x3a1cdc);}};}function respondWithFilteredResult(_0x45a342,_0x509854){return function(_0xf81020){if(_0xf81020){var _0x4fea3a=typeof _0x509854[_0xbacd('0x25')]===_0xbacd('0x26')&&typeof _0x509854[_0xbacd('0x27')]===_0xbacd('0x26');var _0x505773=_0xf81020['count'];var _0xe80b64=_0x4fea3a?0x0:_0x509854['offset'];var _0x2dc0be=_0x4fea3a?_0xf81020['count']:_0x509854[_0xbacd('0x25')]+_0x509854[_0xbacd('0x27')];var _0x112f67;if(_0x2dc0be>=_0x505773){_0x2dc0be=_0x505773;_0x112f67=0xc8;}else{_0x112f67=0xce;}_0x45a342[_0xbacd('0x24')](_0x112f67);return _0x45a342[_0xbacd('0x28')]('Content-Range',_0xe80b64+'-'+_0x2dc0be+'/'+_0x505773)[_0xbacd('0x29')](_0xf81020);}return null;};}function patchUpdates(_0x398590){return function(_0xe8d4c4){try{jsonpatch['apply'](_0xe8d4c4,_0x398590,!![]);}catch(_0x2bb242){return BPromise[_0xbacd('0x2a')](_0x2bb242);}return _0xe8d4c4[_0xbacd('0x2b')]();};}function saveUpdates(_0x43677a,_0x4bba0a){return function(_0x1f81b4){if(_0x1f81b4){return _0x1f81b4[_0xbacd('0x2c')](_0x43677a)[_0xbacd('0x2d')](function(_0x4a8a4a){return _0x4a8a4a;});}return null;};}function removeEntity(_0xc6b958,_0x2aff85){return function(_0x596131){if(_0x596131){return _0x596131[_0xbacd('0x2e')]()[_0xbacd('0x2d')](function(){_0xc6b958[_0xbacd('0x24')](0xcc)[_0xbacd('0x23')]();});}};}function handleEntityNotFound(_0x14618b,_0x3d8f1f){return function(_0x30b448){if(!_0x30b448){_0x14618b[_0xbacd('0x22')](0x194);}return _0x30b448;};}function handleError(_0x2b1f6b,_0x2fd0bf){_0x2fd0bf=_0x2fd0bf||0x1f4;return function(_0x148998){logger['error'](_0x148998[_0xbacd('0x2f')]);if(_0x148998[_0xbacd('0x30')]){delete _0x148998[_0xbacd('0x30')];}_0x2b1f6b[_0xbacd('0x24')](_0x2fd0bf)[_0xbacd('0x31')](_0x148998);};}exports[_0xbacd('0x32')]=function(_0x519c19,_0x5af7e0){var _0x2a51b8={},_0x4e5178={},_0x357795={'count':0x0,'rows':[]};var _0x10eadd=_[_0xbacd('0x33')](db[_0xbacd('0x34')][_0xbacd('0x35')],function(_0x403ae0){return{'name':_0x403ae0[_0xbacd('0x36')],'type':_0x403ae0['type'][_0xbacd('0x37')]};});_0x4e5178[_0xbacd('0x38')]=_['map'](_0x10eadd,_0xbacd('0x30'));_0x4e5178['query']=_[_0xbacd('0x39')](_0x519c19[_0xbacd('0x3a')]);_0x4e5178[_0xbacd('0x3b')]=_[_0xbacd('0x3c')](_0x4e5178[_0xbacd('0x38')],_0x4e5178[_0xbacd('0x3a')]);_0x2a51b8['attributes']=_[_0xbacd('0x3c')](_0x4e5178[_0xbacd('0x38')],qs[_0xbacd('0x3d')](_0x519c19[_0xbacd('0x3a')][_0xbacd('0x3d')]));_0x2a51b8[_0xbacd('0x3e')]=_0x2a51b8[_0xbacd('0x3e')][_0xbacd('0x3f')]?_0x2a51b8[_0xbacd('0x3e')]:_0x4e5178['model'];if(!_0x519c19[_0xbacd('0x3a')][_0xbacd('0x40')]('nolimit')){_0x2a51b8[_0xbacd('0x27')]=qs[_0xbacd('0x27')](_0x519c19[_0xbacd('0x3a')][_0xbacd('0x27')]);_0x2a51b8[_0xbacd('0x25')]=qs[_0xbacd('0x25')](_0x519c19['query'][_0xbacd('0x25')]);}_0x2a51b8[_0xbacd('0x41')]=qs['sort'](_0x519c19['query'][_0xbacd('0x42')]);_0x2a51b8[_0xbacd('0x43')]=qs[_0xbacd('0x3b')](_['pick'](_0x519c19[_0xbacd('0x3a')],_0x4e5178['filters']),_0x10eadd);if(_0x519c19[_0xbacd('0x3a')][_0xbacd('0x44')]){_0x2a51b8[_0xbacd('0x43')]=_[_0xbacd('0x45')](_0x2a51b8[_0xbacd('0x43')],{'$or':_[_0xbacd('0x33')](_0x10eadd,function(_0x6f4ff){if(_0x6f4ff[_0xbacd('0x46')]!=='VIRTUAL'){var _0x25bf79={};_0x25bf79[_0x6f4ff[_0xbacd('0x30')]]={'$like':'%'+_0x519c19[_0xbacd('0x3a')][_0xbacd('0x44')]+'%'};return _0x25bf79;}})});}_0x2a51b8=_[_0xbacd('0x45')]({},_0x2a51b8,_0x519c19[_0xbacd('0x47')]);var _0x2c6b39={'where':_0x2a51b8[_0xbacd('0x43')]};return db[_0xbacd('0x34')][_0xbacd('0x48')](_0x2c6b39)[_0xbacd('0x2d')](function(_0x3c2e0d){_0x357795[_0xbacd('0x48')]=_0x3c2e0d;if(_0x519c19[_0xbacd('0x3a')][_0xbacd('0x49')]){_0x2a51b8[_0xbacd('0x4a')]=[{'all':!![]}];}return db[_0xbacd('0x34')][_0xbacd('0x4b')](_0x2a51b8);})['then'](function(_0x4146a2){_0x357795[_0xbacd('0x4c')]=_0x4146a2;return _0x357795;})[_0xbacd('0x2d')](respondWithFilteredResult(_0x5af7e0,_0x2a51b8))[_0xbacd('0x4d')](handleError(_0x5af7e0,null));};exports[_0xbacd('0x4e')]=function(_0x451cd8,_0x4d228f){var _0x5247ee={'raw':![],'where':{'id':_0x451cd8[_0xbacd('0x4f')]['id']}},_0x4a9435={};_0x4a9435[_0xbacd('0x38')]=_[_0xbacd('0x39')](db[_0xbacd('0x34')][_0xbacd('0x35')]);_0x4a9435['query']=_[_0xbacd('0x39')](_0x451cd8[_0xbacd('0x3a')]);_0x4a9435[_0xbacd('0x3b')]=_[_0xbacd('0x3c')](_0x4a9435[_0xbacd('0x38')],_0x4a9435[_0xbacd('0x3a')]);_0x5247ee[_0xbacd('0x3e')]=_[_0xbacd('0x3c')](_0x4a9435[_0xbacd('0x38')],qs[_0xbacd('0x3d')](_0x451cd8[_0xbacd('0x3a')][_0xbacd('0x3d')]));_0x5247ee[_0xbacd('0x3e')]=_0x5247ee[_0xbacd('0x3e')]['length']?_0x5247ee[_0xbacd('0x3e')]:_0x4a9435[_0xbacd('0x38')];if(_0x451cd8[_0xbacd('0x3a')]['includeAll']){_0x5247ee[_0xbacd('0x4a')]=[{'all':!![]}];}_0x5247ee=_[_0xbacd('0x45')]({},_0x5247ee,_0x451cd8[_0xbacd('0x47')]);return db[_0xbacd('0x34')][_0xbacd('0x50')](_0x5247ee)[_0xbacd('0x2d')](handleEntityNotFound(_0x4d228f,null))[_0xbacd('0x2d')](respondWithResult(_0x4d228f,null))[_0xbacd('0x4d')](handleError(_0x4d228f,null));};exports[_0xbacd('0x51')]=function(_0x2e2fe4,_0x1097f4){return db[_0xbacd('0x34')][_0xbacd('0x51')](_0x2e2fe4[_0xbacd('0x52')],{})[_0xbacd('0x2d')](respondWithResult(_0x1097f4,0xc9))[_0xbacd('0x4d')](handleError(_0x1097f4,null));};exports['update']=function(_0x481a0c,_0x408529){if(_0x481a0c['body']['id']){delete _0x481a0c[_0xbacd('0x52')]['id'];}return db[_0xbacd('0x34')][_0xbacd('0x50')]({'where':{'id':_0x481a0c[_0xbacd('0x4f')]['id']}})[_0xbacd('0x2d')](handleEntityNotFound(_0x408529,null))[_0xbacd('0x2d')](saveUpdates(_0x481a0c[_0xbacd('0x52')],null))[_0xbacd('0x2d')](respondWithResult(_0x408529,null))[_0xbacd('0x4d')](handleError(_0x408529,null));};exports[_0xbacd('0x2e')]=function(_0x5d226b,_0x32d83f){return db['VoiceQueueReport'][_0xbacd('0x50')]({'where':{'id':_0x5d226b[_0xbacd('0x4f')]['id']}})[_0xbacd('0x2d')](handleEntityNotFound(_0x32d83f,null))[_0xbacd('0x2d')](removeEntity(_0x32d83f,null))[_0xbacd('0x4d')](handleError(_0x32d83f,null));};exports['describe']=function(_0xf68459,_0x310372){return db[_0xbacd('0x34')]['describe']()[_0xbacd('0x2d')](respondWithResult(_0x310372,null))[_0xbacd('0x4d')](handleError(_0x310372,null));};exports['getVoiceQueuesReport']=function(_0x27e6b3,_0x47d1bc){var _0x3d36a2={},_0x390b9e={},_0x4ec43e={'count':0x0,'rows':[]};_0x390b9e[_0xbacd('0x38')]=_[_0xbacd('0x39')](db[_0xbacd('0x34')][_0xbacd('0x35')]);_0x390b9e[_0xbacd('0x3a')]=_['keys'](_0x27e6b3[_0xbacd('0x3a')]);_0x390b9e[_0xbacd('0x3b')]=_[_0xbacd('0x3c')](_0x390b9e[_0xbacd('0x38')],_0x390b9e[_0xbacd('0x3a')]);_0x3d36a2[_0xbacd('0x3e')]=_[_0xbacd('0x3c')](_0x390b9e['model'],qs['fields'](_0x27e6b3[_0xbacd('0x3a')][_0xbacd('0x3d')]));_0x3d36a2[_0xbacd('0x3e')]=_0x3d36a2[_0xbacd('0x3e')][_0xbacd('0x3f')]?_0x3d36a2[_0xbacd('0x3e')]:_0x390b9e[_0xbacd('0x38')];if(!_0x27e6b3[_0xbacd('0x3a')][_0xbacd('0x40')](_0xbacd('0x53'))){_0x3d36a2[_0xbacd('0x27')]=qs[_0xbacd('0x27')](_0x27e6b3['query'][_0xbacd('0x27')]);_0x3d36a2[_0xbacd('0x25')]=qs[_0xbacd('0x25')](_0x27e6b3[_0xbacd('0x3a')][_0xbacd('0x25')]);}_0x3d36a2['order']=qs['sort'](_0x27e6b3[_0xbacd('0x3a')][_0xbacd('0x42')]);_0x3d36a2[_0xbacd('0x43')]=qs['filters'](_[_0xbacd('0x54')](_0x27e6b3[_0xbacd('0x3a')],_0x390b9e['filters']));if(_0x27e6b3['query'][_0xbacd('0x44')]){_0x3d36a2[_0xbacd('0x43')]=_[_0xbacd('0x45')](_0x3d36a2[_0xbacd('0x43')],{'$or':_[_0xbacd('0x33')](_0x3d36a2[_0xbacd('0x3e')],function(_0x411a9a){var _0x1ab2b4={};_0x1ab2b4[_0x411a9a]={'$like':'%'+_0x27e6b3[_0xbacd('0x3a')]['filter']+'%'};return _0x1ab2b4;})});}_0x3d36a2=_[_0xbacd('0x45')]({},_0x3d36a2,_0x27e6b3['options']);var _0x47b201={'where':_0x3d36a2['where']};return db[_0xbacd('0x34')]['count'](_0x47b201)[_0xbacd('0x2d')](function(_0x456044){_0x4ec43e[_0xbacd('0x48')]=_0x456044;if(_0x27e6b3['query'][_0xbacd('0x49')]){_0x3d36a2[_0xbacd('0x4a')]=[{'all':!![]}];}return db[_0xbacd('0x34')][_0xbacd('0x4b')](_0x3d36a2);})[_0xbacd('0x2d')](function(_0x5cdcdc){_0x4ec43e[_0xbacd('0x4c')]=_0x5cdcdc;return _0x4ec43e;})['then'](respondWithFilteredResult(_0x47d1bc,_0x3d36a2,'getVoiceQueuesReport'))['catch'](handleError(_0x47d1bc,null,_0xbacd('0x55')));}; \ No newline at end of file +var _0x1648=['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/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','length','find','create','body','describe','intersection','findAll','getVoiceQueuesReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x1648,0xf5));var _0x8164=function(_0x5e3d3b,_0x1c54a9){_0x5e3d3b=_0x5e3d3b-0x0;var _0x5d20cf=_0x1648[_0x5e3d3b];return _0x5d20cf;};'use strict';var emlformat=require(_0x8164('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8164('0x1'));var jsonpatch=require(_0x8164('0x2'));var rp=require(_0x8164('0x3'));var moment=require(_0x8164('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8164('0x5'));var path=require(_0x8164('0x6'));var sox=require(_0x8164('0x7'));var csv=require(_0x8164('0x8'));var ejs=require(_0x8164('0x9'));var fs=require('fs');var fs_extra=require(_0x8164('0xa'));var _=require(_0x8164('0xb'));var squel=require(_0x8164('0xc'));var crypto=require('crypto');var jsforce=require(_0x8164('0xd'));var deskjs=require(_0x8164('0xe'));var toCsv=require(_0x8164('0x8'));var querystring=require(_0x8164('0xf'));var Papa=require(_0x8164('0x10'));var Redis=require(_0x8164('0x11'));var authService=require(_0x8164('0x12'));var qs=require(_0x8164('0x13'));var as=require(_0x8164('0x14'));var hardwareService=require(_0x8164('0x15'));var logger=require('../../config/logger')(_0x8164('0x16'));var utils=require('../../config/utils');var config=require(_0x8164('0x17'));var licenseUtil=require(_0x8164('0x18'));var db=require(_0x8164('0x19'))['db'];config[_0x8164('0x1a')]=_[_0x8164('0x1b')](config[_0x8164('0x1a')],{'host':_0x8164('0x1c'),'port':0x18eb});var socket=require(_0x8164('0x1d'))(new Redis(config[_0x8164('0x1a')]));require(_0x8164('0x1e'))[_0x8164('0x1f')](socket);function respondWithStatusCode(_0x3a413e,_0xc402fe){_0xc402fe=_0xc402fe||0xcc;return function(_0x44df4c){if(_0x44df4c){return _0x3a413e[_0x8164('0x20')](_0xc402fe);}return _0x3a413e[_0x8164('0x21')](_0xc402fe)[_0x8164('0x22')]();};}function respondWithResult(_0x292e26,_0x4f8d02){_0x4f8d02=_0x4f8d02||0xc8;return function(_0x54506d){if(_0x54506d){return _0x292e26[_0x8164('0x21')](_0x4f8d02)['json'](_0x54506d);}};}function respondWithFilteredResult(_0x13965b,_0x5ea149){return function(_0x394c7e){if(_0x394c7e){var _0x2c7db4=typeof _0x5ea149['offset']==='undefined'&&typeof _0x5ea149[_0x8164('0x23')]===_0x8164('0x24');var _0x5d7515=_0x394c7e[_0x8164('0x25')];var _0x18fe13=_0x2c7db4?0x0:_0x5ea149['offset'];var _0x10877f=_0x2c7db4?_0x394c7e[_0x8164('0x25')]:_0x5ea149[_0x8164('0x26')]+_0x5ea149[_0x8164('0x23')];var _0x505ea2;if(_0x10877f>=_0x5d7515){_0x10877f=_0x5d7515;_0x505ea2=0xc8;}else{_0x505ea2=0xce;}_0x13965b['status'](_0x505ea2);return _0x13965b[_0x8164('0x27')](_0x8164('0x28'),_0x18fe13+'-'+_0x10877f+'/'+_0x5d7515)['json'](_0x394c7e);}return null;};}function patchUpdates(_0x196fcc){return function(_0x269b42){try{jsonpatch[_0x8164('0x29')](_0x269b42,_0x196fcc,!![]);}catch(_0x3d04a6){return BPromise[_0x8164('0x2a')](_0x3d04a6);}return _0x269b42['save']();};}function saveUpdates(_0x30c6a1,_0x1bf163){return function(_0x69826d){if(_0x69826d){return _0x69826d[_0x8164('0x2b')](_0x30c6a1)[_0x8164('0x2c')](function(_0x117fa7){return _0x117fa7;});}return null;};}function removeEntity(_0x142005,_0x3bed9a){return function(_0x625adf){if(_0x625adf){return _0x625adf[_0x8164('0x2d')]()['then'](function(){_0x142005['status'](0xcc)[_0x8164('0x22')]();});}};}function handleEntityNotFound(_0x5c173f,_0x2e5d46){return function(_0x48108f){if(!_0x48108f){_0x5c173f[_0x8164('0x20')](0x194);}return _0x48108f;};}function handleError(_0x509a74,_0x3e1b61){_0x3e1b61=_0x3e1b61||0x1f4;return function(_0x33ec00){logger[_0x8164('0x2e')](_0x33ec00['stack']);if(_0x33ec00[_0x8164('0x2f')]){delete _0x33ec00[_0x8164('0x2f')];}_0x509a74[_0x8164('0x21')](_0x3e1b61)[_0x8164('0x30')](_0x33ec00);};}exports[_0x8164('0x31')]=function(_0x3d74a7,_0x3f2259){var _0x976b15={},_0x146be9={},_0x8781bb={'count':0x0,'rows':[]};var _0x187bb6=_[_0x8164('0x32')](db[_0x8164('0x33')][_0x8164('0x34')],function(_0x44e196){return{'name':_0x44e196[_0x8164('0x35')],'type':_0x44e196[_0x8164('0x36')][_0x8164('0x37')]};});_0x146be9[_0x8164('0x38')]=_[_0x8164('0x32')](_0x187bb6,_0x8164('0x2f'));_0x146be9[_0x8164('0x39')]=_[_0x8164('0x3a')](_0x3d74a7['query']);_0x146be9['filters']=_['intersection'](_0x146be9[_0x8164('0x38')],_0x146be9[_0x8164('0x39')]);_0x976b15[_0x8164('0x3b')]=_['intersection'](_0x146be9[_0x8164('0x38')],qs['fields'](_0x3d74a7[_0x8164('0x39')][_0x8164('0x3c')]));_0x976b15[_0x8164('0x3b')]=_0x976b15[_0x8164('0x3b')]['length']?_0x976b15[_0x8164('0x3b')]:_0x146be9[_0x8164('0x38')];if(!_0x3d74a7['query'][_0x8164('0x3d')](_0x8164('0x3e'))){_0x976b15[_0x8164('0x23')]=qs[_0x8164('0x23')](_0x3d74a7['query'][_0x8164('0x23')]);_0x976b15[_0x8164('0x26')]=qs[_0x8164('0x26')](_0x3d74a7[_0x8164('0x39')]['offset']);}_0x976b15['order']=qs[_0x8164('0x3f')](_0x3d74a7[_0x8164('0x39')]['sort']);_0x976b15['where']=qs[_0x8164('0x40')](_[_0x8164('0x41')](_0x3d74a7[_0x8164('0x39')],_0x146be9[_0x8164('0x40')]),_0x187bb6);if(_0x3d74a7['query'][_0x8164('0x42')]){_0x976b15[_0x8164('0x43')]=_[_0x8164('0x44')](_0x976b15[_0x8164('0x43')],{'$or':_[_0x8164('0x32')](_0x187bb6,function(_0x1ae330){if(_0x1ae330[_0x8164('0x36')]!==_0x8164('0x45')){var _0xef9ce2={};_0xef9ce2[_0x1ae330[_0x8164('0x2f')]]={'$like':'%'+_0x3d74a7[_0x8164('0x39')][_0x8164('0x42')]+'%'};return _0xef9ce2;}})});}_0x976b15=_[_0x8164('0x44')]({},_0x976b15,_0x3d74a7[_0x8164('0x46')]);var _0x3e35f0={'where':_0x976b15[_0x8164('0x43')]};return db[_0x8164('0x33')]['count'](_0x3e35f0)['then'](function(_0x156e8a){_0x8781bb['count']=_0x156e8a;if(_0x3d74a7['query'][_0x8164('0x47')]){_0x976b15[_0x8164('0x48')]=[{'all':!![]}];}return db[_0x8164('0x33')]['findAll'](_0x976b15);})[_0x8164('0x2c')](function(_0x1e5bb6){_0x8781bb[_0x8164('0x49')]=_0x1e5bb6;return _0x8781bb;})[_0x8164('0x2c')](respondWithFilteredResult(_0x3f2259,_0x976b15))[_0x8164('0x4a')](handleError(_0x3f2259,null));};exports['show']=function(_0x2d8f17,_0x12c549){var _0x1b6917={'raw':![],'where':{'id':_0x2d8f17[_0x8164('0x4b')]['id']}},_0x408482={};_0x408482[_0x8164('0x38')]=_[_0x8164('0x3a')](db['VoiceQueueReport'][_0x8164('0x34')]);_0x408482[_0x8164('0x39')]=_[_0x8164('0x3a')](_0x2d8f17[_0x8164('0x39')]);_0x408482[_0x8164('0x40')]=_['intersection'](_0x408482['model'],_0x408482[_0x8164('0x39')]);_0x1b6917['attributes']=_['intersection'](_0x408482['model'],qs[_0x8164('0x3c')](_0x2d8f17[_0x8164('0x39')][_0x8164('0x3c')]));_0x1b6917['attributes']=_0x1b6917['attributes'][_0x8164('0x4c')]?_0x1b6917[_0x8164('0x3b')]:_0x408482[_0x8164('0x38')];if(_0x2d8f17[_0x8164('0x39')][_0x8164('0x47')]){_0x1b6917[_0x8164('0x48')]=[{'all':!![]}];}_0x1b6917=_[_0x8164('0x44')]({},_0x1b6917,_0x2d8f17[_0x8164('0x46')]);return db[_0x8164('0x33')][_0x8164('0x4d')](_0x1b6917)['then'](handleEntityNotFound(_0x12c549,null))[_0x8164('0x2c')](respondWithResult(_0x12c549,null))[_0x8164('0x4a')](handleError(_0x12c549,null));};exports[_0x8164('0x4e')]=function(_0x58211d,_0x2b5de4){return db[_0x8164('0x33')][_0x8164('0x4e')](_0x58211d[_0x8164('0x4f')],{})[_0x8164('0x2c')](respondWithResult(_0x2b5de4,0xc9))[_0x8164('0x4a')](handleError(_0x2b5de4,null));};exports[_0x8164('0x2b')]=function(_0x1d078f,_0x234b41){if(_0x1d078f['body']['id']){delete _0x1d078f[_0x8164('0x4f')]['id'];}return db[_0x8164('0x33')][_0x8164('0x4d')]({'where':{'id':_0x1d078f[_0x8164('0x4b')]['id']}})['then'](handleEntityNotFound(_0x234b41,null))[_0x8164('0x2c')](saveUpdates(_0x1d078f[_0x8164('0x4f')],null))[_0x8164('0x2c')](respondWithResult(_0x234b41,null))[_0x8164('0x4a')](handleError(_0x234b41,null));};exports['destroy']=function(_0x152d09,_0x4852d6){return db['VoiceQueueReport'][_0x8164('0x4d')]({'where':{'id':_0x152d09[_0x8164('0x4b')]['id']}})[_0x8164('0x2c')](handleEntityNotFound(_0x4852d6,null))[_0x8164('0x2c')](removeEntity(_0x4852d6,null))[_0x8164('0x4a')](handleError(_0x4852d6,null));};exports[_0x8164('0x50')]=function(_0x1abaf6,_0x4ba4f9){return db[_0x8164('0x33')][_0x8164('0x50')]()[_0x8164('0x2c')](respondWithResult(_0x4ba4f9,null))[_0x8164('0x4a')](handleError(_0x4ba4f9,null));};exports['getVoiceQueuesReport']=function(_0x57f41b,_0x259216){var _0x2a6566={},_0x75503c={},_0x368728={'count':0x0,'rows':[]};_0x75503c[_0x8164('0x38')]=_[_0x8164('0x3a')](db[_0x8164('0x33')][_0x8164('0x34')]);_0x75503c[_0x8164('0x39')]=_['keys'](_0x57f41b[_0x8164('0x39')]);_0x75503c[_0x8164('0x40')]=_['intersection'](_0x75503c[_0x8164('0x38')],_0x75503c[_0x8164('0x39')]);_0x2a6566[_0x8164('0x3b')]=_[_0x8164('0x51')](_0x75503c['model'],qs['fields'](_0x57f41b[_0x8164('0x39')][_0x8164('0x3c')]));_0x2a6566['attributes']=_0x2a6566[_0x8164('0x3b')][_0x8164('0x4c')]?_0x2a6566['attributes']:_0x75503c[_0x8164('0x38')];if(!_0x57f41b[_0x8164('0x39')][_0x8164('0x3d')](_0x8164('0x3e'))){_0x2a6566['limit']=qs[_0x8164('0x23')](_0x57f41b[_0x8164('0x39')][_0x8164('0x23')]);_0x2a6566[_0x8164('0x26')]=qs[_0x8164('0x26')](_0x57f41b[_0x8164('0x39')][_0x8164('0x26')]);}_0x2a6566['order']=qs[_0x8164('0x3f')](_0x57f41b[_0x8164('0x39')][_0x8164('0x3f')]);_0x2a6566[_0x8164('0x43')]=qs['filters'](_[_0x8164('0x41')](_0x57f41b['query'],_0x75503c[_0x8164('0x40')]));if(_0x57f41b['query'][_0x8164('0x42')]){_0x2a6566[_0x8164('0x43')]=_[_0x8164('0x44')](_0x2a6566[_0x8164('0x43')],{'$or':_['map'](_0x2a6566[_0x8164('0x3b')],function(_0x5c46d8){var _0xb3384={};_0xb3384[_0x5c46d8]={'$like':'%'+_0x57f41b[_0x8164('0x39')][_0x8164('0x42')]+'%'};return _0xb3384;})});}_0x2a6566=_['merge']({},_0x2a6566,_0x57f41b['options']);var _0x2e362c={'where':_0x2a6566['where']};return db[_0x8164('0x33')][_0x8164('0x25')](_0x2e362c)[_0x8164('0x2c')](function(_0x14a085){_0x368728[_0x8164('0x25')]=_0x14a085;if(_0x57f41b[_0x8164('0x39')][_0x8164('0x47')]){_0x2a6566['include']=[{'all':!![]}];}return db[_0x8164('0x33')][_0x8164('0x52')](_0x2a6566);})[_0x8164('0x2c')](function(_0x435aed){_0x368728[_0x8164('0x49')]=_0x435aed;return _0x368728;})['then'](respondWithFilteredResult(_0x259216,_0x2a6566,_0x8164('0x53')))[_0x8164('0x4a')](handleError(_0x259216,null,_0x8164('0x53')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 7c58733..76aad65 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 _0x7b64=['hook','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3787f8,_0x3359cd){var _0x582e35=function(_0x46a9b9){while(--_0x46a9b9){_0x3787f8['push'](_0x3787f8['shift']());}};_0x582e35(++_0x3359cd);}(_0x7b64,0x109));var _0x47b6=function(_0x45322e,_0x59ef1a){_0x45322e=_0x45322e-0x0;var _0x3fc706=_0x7b64[_0x45322e];return _0x3fc706;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x47b6('0x0'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x47b6('0x1')](0x0);var events={'afterCreate':_0x47b6('0x2'),'afterUpdate':_0x47b6('0x3'),'afterDestroy':_0x47b6('0x4')};function emitEvent(_0x2959e7){return function(_0x5e490f,_0x21d0d7,_0x44ec70){VoiceQueueReportEvents[_0x47b6('0x5')](_0x2959e7+':'+_0x5e490f['id'],_0x5e490f);VoiceQueueReportEvents['emit'](_0x2959e7,_0x5e490f);_0x44ec70(null);};}for(var e in events){if(events[_0x47b6('0x6')](e)){var event=events[e];VoiceQueueReport[_0x47b6('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x88a4=['save','remove','hasOwnProperty','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners'];(function(_0x42bfb7,_0x25a3ec){var _0x5c497d=function(_0x48e83e){while(--_0x48e83e){_0x42bfb7['push'](_0x42bfb7['shift']());}};_0x5c497d(++_0x25a3ec);}(_0x88a4,0x134));var _0x488a=function(_0x58eab5,_0xef78ec){_0x58eab5=_0x58eab5-0x0;var _0x72776b=_0x88a4[_0x58eab5];return _0x72776b;};'use strict';var EventEmitter=require(_0x488a('0x0'));var VoiceQueueReport=require(_0x488a('0x1'))['db'][_0x488a('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x488a('0x3')](0x0);var events={'afterCreate':_0x488a('0x4'),'afterUpdate':'update','afterDestroy':_0x488a('0x5')};function emitEvent(_0x16c614){return function(_0x1aac82,_0x57a803,_0x374981){VoiceQueueReportEvents['emit'](_0x16c614+':'+_0x1aac82['id'],_0x1aac82);VoiceQueueReportEvents['emit'](_0x16c614,_0x1aac82);_0x374981(null);};}for(var e in events){if(events[_0x488a('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x488a('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index d9813dd..e2f25b9 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 _0x28f5=['bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue','uniqueid','util','api','moment'];(function(_0x10c51f,_0x11270f){var _0x56a0cd=function(_0x563ac6){while(--_0x563ac6){_0x10c51f['push'](_0x10c51f['shift']());}};_0x56a0cd(++_0x11270f);}(_0x28f5,0x141));var _0x528f=function(_0x2931ce,_0x2bc93c){_0x2931ce=_0x2931ce-0x0;var _0x16744e=_0x28f5[_0x2931ce];return _0x16744e;};'use strict';var _=require('lodash');var util=require(_0x528f('0x0'));var logger=require('../../config/logger')(_0x528f('0x1'));var moment=require(_0x528f('0x2'));var BPromise=require(_0x528f('0x3'));var rp=require(_0x528f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x528f('0x5'));var config=require(_0x528f('0x6'));var attributes=require(_0x528f('0x7'));module[_0x528f('0x8')]=function(_0x99ebbd,_0x180043){return _0x99ebbd['define'](_0x528f('0x9'),attributes,{'tableName':_0x528f('0xa'),'paranoid':![],'indexes':[{'fields':[_0x528f('0xb')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x80ea=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api'];(function(_0x36c603,_0xfd664e){var _0x4f611f=function(_0x18cb6b){while(--_0x18cb6b){_0x36c603['push'](_0x36c603['shift']());}};_0x4f611f(++_0xfd664e);}(_0x80ea,0x15c));var _0xa80e=function(_0x4cf7db,_0x461dbc){_0x4cf7db=_0x4cf7db-0x0;var _0x2a9d4b=_0x80ea[_0x4cf7db];return _0x2a9d4b;};'use strict';var _=require(_0xa80e('0x0'));var util=require(_0xa80e('0x1'));var logger=require(_0xa80e('0x2'))(_0xa80e('0x3'));var moment=require(_0xa80e('0x4'));var BPromise=require(_0xa80e('0x5'));var rp=require(_0xa80e('0x6'));var fs=require('fs');var path=require(_0xa80e('0x7'));var rimraf=require(_0xa80e('0x8'));var config=require(_0xa80e('0x9'));var attributes=require(_0xa80e('0xa'));module[_0xa80e('0xb')]=function(_0x2b3c6f,_0x39a910){return _0x2b3c6f['define'](_0xa80e('0xc'),attributes,{'tableName':_0xa80e('0xd'),'paranoid':![],'indexes':[{'fields':[_0xa80e('0xe')]},{'fields':[_0xa80e('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 70b9c72..8f30157 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 _0xc2c1=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','limit','include','map','model','attributes','then','CreateVoiceQueueReport','debug','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring'];(function(_0x53275b,_0x5206a2){var _0x4dcf81=function(_0x53b922){while(--_0x53b922){_0x53275b['push'](_0x53275b['shift']());}};_0x4dcf81(++_0x5206a2);}(_0xc2c1,0x143));var _0x1c2c=function(_0x388689,_0x21f337){_0x388689=_0x388689-0x0;var _0x35ca33=_0xc2c1[_0x388689];return _0x35ca33;};'use strict';var _=require(_0x1c2c('0x0'));var util=require(_0x1c2c('0x1'));var moment=require(_0x1c2c('0x2'));var BPromise=require(_0x1c2c('0x3'));var rs=require(_0x1c2c('0x4'));var fs=require('fs');var Redis=require(_0x1c2c('0x5'));var db=require(_0x1c2c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1c2c('0x7'))(_0x1c2c('0x8'));var config=require(_0x1c2c('0x9'));var jayson=require(_0x1c2c('0xa'));var client=jayson[_0x1c2c('0xb')][_0x1c2c('0xc')]({'port':0x232a});config[_0x1c2c('0xd')]=_['defaults'](config[_0x1c2c('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x1c2c('0xe'))(new Redis(config[_0x1c2c('0xd')]));require('./voiceQueueReport.socket')[_0x1c2c('0xf')](socket);function respondWithRpcPromise(_0x51a1cb,_0x414b81,_0x13b17c){return new BPromise(function(_0x43fdcb,_0x258e64){return client[_0x1c2c('0x10')](_0x51a1cb,_0x13b17c)['then'](function(_0x4e8014){logger[_0x1c2c('0x11')](_0x1c2c('0x12'),_0x414b81,_0x1c2c('0x13'));logger['debug'](_0x1c2c('0x14'),_0x414b81,_0x1c2c('0x13'),JSON[_0x1c2c('0x15')](_0x4e8014));if(_0x4e8014[_0x1c2c('0x16')]){if(_0x4e8014[_0x1c2c('0x16')]['code']===0x1f4){logger['error'](_0x1c2c('0x12'),_0x414b81,_0x4e8014[_0x1c2c('0x16')][_0x1c2c('0x17')]);return _0x258e64(_0x4e8014[_0x1c2c('0x16')][_0x1c2c('0x17')]);}logger[_0x1c2c('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x414b81,_0x4e8014['error'][_0x1c2c('0x17')]);return _0x43fdcb(_0x4e8014[_0x1c2c('0x16')][_0x1c2c('0x17')]);}else{logger[_0x1c2c('0x11')](_0x1c2c('0x12'),_0x414b81,_0x1c2c('0x13'));_0x43fdcb(_0x4e8014[_0x1c2c('0x18')][_0x1c2c('0x17')]);}})[_0x1c2c('0x19')](function(_0x9a85d1){logger[_0x1c2c('0x16')](_0x1c2c('0x12'),_0x414b81,_0x9a85d1);_0x258e64(_0x9a85d1);});});}exports[_0x1c2c('0x1a')]=function(_0x53fb9d){var _0x13b824=this;return new Promise(function(_0xedb051,_0x338305){return db[_0x1c2c('0x1b')]['findAll']({'raw':_0x53fb9d['options']?_0x53fb9d[_0x1c2c('0x1c')][_0x1c2c('0x1d')]===undefined?!![]:![]:!![],'where':_0x53fb9d['options']?_0x53fb9d['options'][_0x1c2c('0x1e')]||null:null,'attributes':_0x53fb9d[_0x1c2c('0x1c')]?_0x53fb9d['options']['attributes']||null:null,'limit':_0x53fb9d[_0x1c2c('0x1c')]?_0x53fb9d[_0x1c2c('0x1c')][_0x1c2c('0x1f')]||null:null,'include':_0x53fb9d['options']?_0x53fb9d[_0x1c2c('0x1c')][_0x1c2c('0x20')]?_['map'](_0x53fb9d[_0x1c2c('0x1c')][_0x1c2c('0x20')],function(_0xccf8ad){return{'model':db[_0xccf8ad['model']],'as':_0xccf8ad['as'],'attributes':_0xccf8ad['attributes'],'include':_0xccf8ad[_0x1c2c('0x20')]?_[_0x1c2c('0x21')](_0xccf8ad[_0x1c2c('0x20')],function(_0x38355b){return{'model':db[_0x38355b[_0x1c2c('0x22')]],'as':_0x38355b['as'],'attributes':_0x38355b[_0x1c2c('0x23')],'include':_0x38355b[_0x1c2c('0x20')]?_['map'](_0x38355b['include'],function(_0x3f0211){return{'model':db[_0x3f0211['model']],'as':_0x3f0211['as'],'attributes':_0x3f0211[_0x1c2c('0x23')]};}):[]};}):[]};}):[]:[]})[_0x1c2c('0x24')](function(_0x197956){logger[_0x1c2c('0x11')](_0x1c2c('0x1a'),_0x53fb9d);logger['debug'](_0x1c2c('0x1a'),_0x53fb9d,JSON[_0x1c2c('0x15')](_0x197956));_0xedb051(_0x197956);})['catch'](function(_0x26ab7d){logger[_0x1c2c('0x16')](_0x1c2c('0x1a'),_0x26ab7d[_0x1c2c('0x17')],_0x53fb9d);_0x338305(_0x13b824[_0x1c2c('0x16')](0x1f4,_0x26ab7d[_0x1c2c('0x17')]));});});};exports[_0x1c2c('0x25')]=function(_0x14496e){var _0x138de6=this;return new Promise(function(_0x57cedb,_0x3e3961){return db[_0x1c2c('0x1b')]['create'](_0x14496e['body'],{'raw':_0x14496e['options']?_0x14496e[_0x1c2c('0x1c')][_0x1c2c('0x1d')]===undefined?!![]:![]:!![]})[_0x1c2c('0x24')](function(_0x5a9f62){logger['info']('CreateVoiceQueueReport',_0x14496e);logger[_0x1c2c('0x26')](_0x1c2c('0x25'),_0x14496e,JSON[_0x1c2c('0x15')](_0x5a9f62));_0x57cedb(_0x5a9f62);})[_0x1c2c('0x19')](function(_0x1ab8e6){logger['error'](_0x1c2c('0x25'),_0x1ab8e6['message'],_0x14496e);_0x3e3961(_0x138de6[_0x1c2c('0x16')](0x1f4,_0x1ab8e6[_0x1c2c('0x17')]));});});};exports[_0x1c2c('0x27')]=function(_0x56808f){var _0x5626b7=this;return new Promise(function(_0x344899,_0x13eb30){return db['VoiceQueueReport'][_0x1c2c('0x28')](_0x56808f['body'],{'raw':_0x56808f['options']?_0x56808f['options'][_0x1c2c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56808f[_0x1c2c('0x1c')]?_0x56808f[_0x1c2c('0x1c')][_0x1c2c('0x1e')]||null:null,'attributes':_0x56808f[_0x1c2c('0x1c')]?_0x56808f['options'][_0x1c2c('0x23')]||null:null,'limit':_0x56808f['options']?_0x56808f[_0x1c2c('0x1c')][_0x1c2c('0x1f')]||null:null})[_0x1c2c('0x24')](function(_0x28e8ce){logger[_0x1c2c('0x11')]('UpdateVoiceQueueReport',_0x56808f);logger[_0x1c2c('0x26')](_0x1c2c('0x27'),_0x56808f,JSON[_0x1c2c('0x15')](_0x28e8ce));_0x344899(_0x28e8ce);})['catch'](function(_0x2dbc31){logger[_0x1c2c('0x16')]('UpdateVoiceQueueReport',_0x2dbc31[_0x1c2c('0x17')],_0x56808f);_0x13eb30(_0x5626b7[_0x1c2c('0x16')](0x1f4,_0x2dbc31['message']));});});}; \ No newline at end of file +var _0x664e=['model','then','GetVoiceQueueReport','catch','CreateVoiceQueueReport','VoiceQueueReport','create','body','UpdateVoiceQueueReport','update','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','info','request\x20sent','debug','stringify','error','message','VoiceQueueReport,\x20%s,\x20%s','result','options','raw','where','attributes','include','map'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x664e,0x18e));var _0xe664=function(_0xf1081a,_0xfe4f04){_0xf1081a=_0xf1081a-0x0;var _0x311841=_0x664e[_0xf1081a];return _0x311841;};'use strict';var _=require(_0xe664('0x0'));var util=require(_0xe664('0x1'));var moment=require('moment');var BPromise=require(_0xe664('0x2'));var rs=require(_0xe664('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe664('0x4'))['db'];var utils=require(_0xe664('0x5'));var logger=require(_0xe664('0x6'))('rpc');var config=require(_0xe664('0x7'));var jayson=require(_0xe664('0x8'));var client=jayson[_0xe664('0x9')][_0xe664('0xa')]({'port':0x232a});config[_0xe664('0xb')]=_[_0xe664('0xc')](config[_0xe664('0xb')],{'host':_0xe664('0xd'),'port':0x18eb});var socket=require(_0xe664('0xe'))(new Redis(config[_0xe664('0xb')]));require(_0xe664('0xf'))[_0xe664('0x10')](socket);function respondWithRpcPromise(_0x579e5f,_0x5ef1a8,_0x45352a){return new BPromise(function(_0x22a9bc,_0x530c56){return client[_0xe664('0x11')](_0x579e5f,_0x45352a)['then'](function(_0x2f91f9){logger[_0xe664('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x5ef1a8,_0xe664('0x13'));logger[_0xe664('0x14')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x5ef1a8,_0xe664('0x13'),JSON[_0xe664('0x15')](_0x2f91f9));if(_0x2f91f9[_0xe664('0x16')]){if(_0x2f91f9[_0xe664('0x16')]['code']===0x1f4){logger[_0xe664('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x5ef1a8,_0x2f91f9[_0xe664('0x16')][_0xe664('0x17')]);return _0x530c56(_0x2f91f9[_0xe664('0x16')][_0xe664('0x17')]);}logger[_0xe664('0x16')](_0xe664('0x18'),_0x5ef1a8,_0x2f91f9[_0xe664('0x16')][_0xe664('0x17')]);return _0x22a9bc(_0x2f91f9[_0xe664('0x16')][_0xe664('0x17')]);}else{logger[_0xe664('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x5ef1a8,_0xe664('0x13'));_0x22a9bc(_0x2f91f9[_0xe664('0x19')][_0xe664('0x17')]);}})['catch'](function(_0x6189a){logger[_0xe664('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x5ef1a8,_0x6189a);_0x530c56(_0x6189a);});});}exports['GetVoiceQueueReport']=function(_0xd4c78a){var _0x66dd65=this;return new Promise(function(_0x449526,_0x169df8){return db['VoiceQueueReport']['findAll']({'raw':_0xd4c78a[_0xe664('0x1a')]?_0xd4c78a[_0xe664('0x1a')][_0xe664('0x1b')]===undefined?!![]:![]:!![],'where':_0xd4c78a['options']?_0xd4c78a['options'][_0xe664('0x1c')]||null:null,'attributes':_0xd4c78a[_0xe664('0x1a')]?_0xd4c78a['options'][_0xe664('0x1d')]||null:null,'limit':_0xd4c78a[_0xe664('0x1a')]?_0xd4c78a[_0xe664('0x1a')]['limit']||null:null,'include':_0xd4c78a['options']?_0xd4c78a[_0xe664('0x1a')][_0xe664('0x1e')]?_[_0xe664('0x1f')](_0xd4c78a[_0xe664('0x1a')][_0xe664('0x1e')],function(_0x5159b8){return{'model':db[_0x5159b8['model']],'as':_0x5159b8['as'],'attributes':_0x5159b8[_0xe664('0x1d')],'include':_0x5159b8[_0xe664('0x1e')]?_[_0xe664('0x1f')](_0x5159b8[_0xe664('0x1e')],function(_0x2f98a9){return{'model':db[_0x2f98a9[_0xe664('0x20')]],'as':_0x2f98a9['as'],'attributes':_0x2f98a9[_0xe664('0x1d')],'include':_0x2f98a9['include']?_[_0xe664('0x1f')](_0x2f98a9[_0xe664('0x1e')],function(_0x468109){return{'model':db[_0x468109[_0xe664('0x20')]],'as':_0x468109['as'],'attributes':_0x468109['attributes']};}):[]};}):[]};}):[]:[]})[_0xe664('0x21')](function(_0x1a2ee0){logger[_0xe664('0x12')](_0xe664('0x22'),_0xd4c78a);logger[_0xe664('0x14')]('GetVoiceQueueReport',_0xd4c78a,JSON['stringify'](_0x1a2ee0));_0x449526(_0x1a2ee0);})[_0xe664('0x23')](function(_0x23bcb7){logger[_0xe664('0x16')](_0xe664('0x22'),_0x23bcb7[_0xe664('0x17')],_0xd4c78a);_0x169df8(_0x66dd65['error'](0x1f4,_0x23bcb7[_0xe664('0x17')]));});});};exports[_0xe664('0x24')]=function(_0x4f7fdd){var _0x12c588=this;return new Promise(function(_0x440a46,_0x54debf){return db[_0xe664('0x25')][_0xe664('0x26')](_0x4f7fdd[_0xe664('0x27')],{'raw':_0x4f7fdd['options']?_0x4f7fdd['options'][_0xe664('0x1b')]===undefined?!![]:![]:!![]})[_0xe664('0x21')](function(_0xee7ec0){logger[_0xe664('0x12')](_0xe664('0x24'),_0x4f7fdd);logger[_0xe664('0x14')]('CreateVoiceQueueReport',_0x4f7fdd,JSON['stringify'](_0xee7ec0));_0x440a46(_0xee7ec0);})[_0xe664('0x23')](function(_0x4973ae){logger[_0xe664('0x16')](_0xe664('0x24'),_0x4973ae[_0xe664('0x17')],_0x4f7fdd);_0x54debf(_0x12c588['error'](0x1f4,_0x4973ae['message']));});});};exports[_0xe664('0x28')]=function(_0xe78d4a){var _0x27a789=this;return new Promise(function(_0xec6041,_0x2186e6){return db[_0xe664('0x25')][_0xe664('0x29')](_0xe78d4a[_0xe664('0x27')],{'raw':_0xe78d4a['options']?_0xe78d4a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe78d4a[_0xe664('0x1a')]?_0xe78d4a[_0xe664('0x1a')][_0xe664('0x1c')]||null:null,'attributes':_0xe78d4a[_0xe664('0x1a')]?_0xe78d4a[_0xe664('0x1a')][_0xe664('0x1d')]||null:null,'limit':_0xe78d4a['options']?_0xe78d4a[_0xe664('0x1a')][_0xe664('0x2a')]||null:null})[_0xe664('0x21')](function(_0xc867b4){logger[_0xe664('0x12')](_0xe664('0x28'),_0xe78d4a);logger[_0xe664('0x14')]('UpdateVoiceQueueReport',_0xe78d4a,JSON[_0xe664('0x15')](_0xc867b4));_0xec6041(_0xc867b4);})[_0xe664('0x23')](function(_0x1beb86){logger[_0xe664('0x16')](_0xe664('0x28'),_0x1beb86['message'],_0xe78d4a);_0x2186e6(_0x27a789[_0xe664('0x16')](0x1f4,_0x1beb86['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 6c6406e..fc21994 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 _0xef72=['length','voiceQueueReport:','./voiceQueueReport.events','save','remove','removeListener'];(function(_0x5ef161,_0x27d16c){var _0x1c6e9e=function(_0x8fc2a6){while(--_0x8fc2a6){_0x5ef161['push'](_0x5ef161['shift']());}};_0x1c6e9e(++_0x27d16c);}(_0xef72,0xf8));var _0x2ef7=function(_0x3a5c6e,_0x19bf4a){_0x3a5c6e=_0x3a5c6e-0x0;var _0x337bf4=_0xef72[_0x3a5c6e];return _0x337bf4;};'use strict';var VoiceQueueReportEvents=require(_0x2ef7('0x0'));var events=[_0x2ef7('0x1'),_0x2ef7('0x2'),'update'];function createListener(_0x4cbda5,_0x52afb2){return function(_0x3cd266){_0x52afb2['emit'](_0x4cbda5,_0x3cd266);};}function removeListener(_0x1ceba3,_0x473662){return function(){VoiceQueueReportEvents[_0x2ef7('0x3')](_0x1ceba3,_0x473662);};}exports['register']=function(_0x12ce1b){for(var _0x4ff788=0x0,_0x2186f4=events[_0x2ef7('0x4')];_0x4ff788<_0x2186f4;_0x4ff788++){var _0x113d5f=events[_0x4ff788];var _0x46c61c=createListener(_0x2ef7('0x5')+_0x113d5f,_0x12ce1b);VoiceQueueReportEvents['on'](_0x113d5f,_0x46c61c);}}; \ No newline at end of file +var _0x6dc0=['./voiceQueueReport.events','remove','update','removeListener','length','voiceQueueReport:'];(function(_0x21481c,_0x1b51ba){var _0x5dd77a=function(_0x4ee13c){while(--_0x4ee13c){_0x21481c['push'](_0x21481c['shift']());}};_0x5dd77a(++_0x1b51ba);}(_0x6dc0,0x18c));var _0x06dc=function(_0x2ca975,_0x592c7e){_0x2ca975=_0x2ca975-0x0;var _0x5003f9=_0x6dc0[_0x2ca975];return _0x5003f9;};'use strict';var VoiceQueueReportEvents=require(_0x06dc('0x0'));var events=['save',_0x06dc('0x1'),_0x06dc('0x2')];function createListener(_0x4434e2,_0xc40894){return function(_0x414760){_0xc40894['emit'](_0x4434e2,_0x414760);};}function removeListener(_0x4effcf,_0x2cad0f){return function(){VoiceQueueReportEvents[_0x06dc('0x3')](_0x4effcf,_0x2cad0f);};}exports['register']=function(_0x45a093){for(var _0x26b287=0x0,_0x4ac3b4=events[_0x06dc('0x4')];_0x26b287<_0x4ac3b4;_0x26b287++){var _0x523fb5=events[_0x26b287];var _0xeac52b=createListener(_0x06dc('0x5')+_0x523fb5,_0x45a093);VoiceQueueReportEvents['on'](_0x523fb5,_0xeac52b);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index c59a73a..ad7084e 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 _0xf6d1=['../../components/interaction/service','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2aea65,_0x156c7c){var _0x20c8dd=function(_0x32d646){while(--_0x32d646){_0x2aea65['push'](_0x2aea65['shift']());}};_0x20c8dd(++_0x156c7c);}(_0xf6d1,0x99));var _0x1f6d=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xf6d1[_0x2b5eae];return _0x5f3ac9;};'use strict';var multer=require(_0x1f6d('0x0'));var util=require(_0x1f6d('0x1'));var path=require(_0x1f6d('0x2'));var timeout=require(_0x1f6d('0x3'));var express=require(_0x1f6d('0x4'));var router=express[_0x1f6d('0x5')]();var fs_extra=require(_0x1f6d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1f6d('0x7'));var config=require('../../config/environment');var controller=require(_0x1f6d('0x8'));router[_0x1f6d('0x9')]('/',auth[_0x1f6d('0xa')](),controller[_0x1f6d('0xb')]);router[_0x1f6d('0x9')](_0x1f6d('0xc'),auth[_0x1f6d('0xa')](),controller[_0x1f6d('0xd')]);router[_0x1f6d('0xe')]('/',auth[_0x1f6d('0xa')](),controller[_0x1f6d('0xf')]);router[_0x1f6d('0x10')]('/:id',auth[_0x1f6d('0xa')](),controller['update']);router[_0x1f6d('0x11')]('/:id',auth[_0x1f6d('0xa')](),controller[_0x1f6d('0x12')]);module[_0x1f6d('0x13')]=router; \ No newline at end of file +var _0x4703=['isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get'];(function(_0x560715,_0xc2897){var _0x25e4f4=function(_0x35b2a9){while(--_0x35b2a9){_0x560715['push'](_0x560715['shift']());}};_0x25e4f4(++_0xc2897);}(_0x4703,0xda));var _0x3470=function(_0xbee69a,_0x27bf4b){_0xbee69a=_0xbee69a-0x0;var _0x52c17d=_0x4703[_0xbee69a];return _0x52c17d;};'use strict';var multer=require(_0x3470('0x0'));var util=require(_0x3470('0x1'));var path=require(_0x3470('0x2'));var timeout=require(_0x3470('0x3'));var express=require(_0x3470('0x4'));var router=express[_0x3470('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3470('0x6'));var config=require(_0x3470('0x7'));var controller=require(_0x3470('0x8'));router[_0x3470('0x9')]('/',auth[_0x3470('0xa')](),controller['index']);router[_0x3470('0x9')](_0x3470('0xb'),auth[_0x3470('0xa')](),controller['show']);router[_0x3470('0xc')]('/',auth[_0x3470('0xa')](),controller[_0x3470('0xd')]);router[_0x3470('0xe')](_0x3470('0xb'),auth[_0x3470('0xa')](),controller[_0x3470('0xf')]);router[_0x3470('0x10')](_0x3470('0xb'),auth['isAuthenticated'](),controller[_0x3470('0x11')]);module[_0x3470('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 3ef563f..0ac8855 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 _0x2adf=['moment','exports','STRING','DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x21d979,_0x2dbf50){var _0x5b06a1=function(_0x4dd412){while(--_0x4dd412){_0x21d979['push'](_0x21d979['shift']());}};_0x5b06a1(++_0x2dbf50);}(_0x2adf,0x143));var _0xf2ad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2adf[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf2ad('0x0'));var moment=require(_0xf2ad('0x1'));module[_0xf2ad('0x2')]={'time':{'type':Sequelize[_0xf2ad('0x3')]},'callid':{'type':Sequelize[_0xf2ad('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xf2ad('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xf2ad('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xf2ad('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xf2ad('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xf2ad('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xf2ad('0x4')],'allowNull':![],'defaultValue':Sequelize['literal'](_0xf2ad('0x5'))}}; \ No newline at end of file +var _0x1ba1=['DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports','STRING'];(function(_0x45f50f,_0x3a1574){var _0x5d3974=function(_0x219145){while(--_0x219145){_0x45f50f['push'](_0x45f50f['shift']());}};_0x5d3974(++_0x3a1574);}(_0x1ba1,0xc7));var _0x11ba=function(_0x4a3bf4,_0x55e2a1){_0x4a3bf4=_0x4a3bf4-0x0;var _0x2c4e45=_0x1ba1[_0x4a3bf4];return _0x2c4e45;};'use strict';var Sequelize=require(_0x11ba('0x0'));var moment=require(_0x11ba('0x1'));module[_0x11ba('0x2')]={'time':{'type':Sequelize[_0x11ba('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x11ba('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x11ba('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x11ba('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x11ba('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x11ba('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x11ba('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x11ba('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x11ba('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x11ba('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x11ba('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x11ba('0x5')](_0x11ba('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 108bc36..4075361 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 _0xa2da=['eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','to-csv','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','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','limit','sort','where','filter','merge','VIRTUAL','options','VoiceQueuesLog','includeAll','include','findAll','rows','catch','show','params','find','body'];(function(_0x14534f,_0x5d4277){var _0x238a46=function(_0x50e4fc){while(--_0x50e4fc){_0x14534f['push'](_0x14534f['shift']());}};_0x238a46(++_0x5d4277);}(_0xa2da,0xd2));var _0xaa2d=function(_0x4eb6ec,_0x7f2520){_0x4eb6ec=_0x4eb6ec-0x0;var _0x58881b=_0xa2da[_0x4eb6ec];return _0x58881b;};'use strict';var emlformat=require(_0xaa2d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaa2d('0x1'));var rp=require(_0xaa2d('0x2'));var moment=require(_0xaa2d('0x3'));var BPromise=require(_0xaa2d('0x4'));var Mustache=require(_0xaa2d('0x5'));var util=require(_0xaa2d('0x6'));var path=require(_0xaa2d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaa2d('0x8'));var _=require(_0xaa2d('0x9'));var squel=require(_0xaa2d('0xa'));var crypto=require(_0xaa2d('0xb'));var jsforce=require(_0xaa2d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xaa2d('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaa2d('0xe'));var authService=require(_0xaa2d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xaa2d('0x10'));var hardwareService=require(_0xaa2d('0x11'));var logger=require(_0xaa2d('0x12'))(_0xaa2d('0x13'));var utils=require(_0xaa2d('0x14'));var config=require(_0xaa2d('0x15'));var licenseUtil=require(_0xaa2d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f1fe2,_0x43fd49){_0x43fd49=_0x43fd49||0xcc;return function(_0x311410){if(_0x311410){return _0x1f1fe2[_0xaa2d('0x17')](_0x43fd49);}return _0x1f1fe2[_0xaa2d('0x18')](_0x43fd49)[_0xaa2d('0x19')]();};}function respondWithResult(_0x3c5cc4,_0x473d9d){_0x473d9d=_0x473d9d||0xc8;return function(_0x49c20d){if(_0x49c20d){return _0x3c5cc4['status'](_0x473d9d)['json'](_0x49c20d);}};}function respondWithFilteredResult(_0x4972d0,_0x2000ae){return function(_0x464c7a){if(_0x464c7a){var _0x268e42=typeof _0x2000ae[_0xaa2d('0x1a')]===_0xaa2d('0x1b')&&typeof _0x2000ae['limit']===_0xaa2d('0x1b');var _0x2e2c6a=_0x464c7a[_0xaa2d('0x1c')];var _0x19ff77=_0x268e42?0x0:_0x2000ae[_0xaa2d('0x1a')];var _0x133a3b=_0x268e42?_0x464c7a[_0xaa2d('0x1c')]:_0x2000ae['offset']+_0x2000ae['limit'];var _0x234030;if(_0x133a3b>=_0x2e2c6a){_0x133a3b=_0x2e2c6a;_0x234030=0xc8;}else{_0x234030=0xce;}_0x4972d0[_0xaa2d('0x18')](_0x234030);return _0x4972d0[_0xaa2d('0x1d')](_0xaa2d('0x1e'),_0x19ff77+'-'+_0x133a3b+'/'+_0x2e2c6a)[_0xaa2d('0x1f')](_0x464c7a);}return null;};}function patchUpdates(_0x19fe3b){return function(_0x5bf1b4){try{jsonpatch['apply'](_0x5bf1b4,_0x19fe3b,!![]);}catch(_0x5729dc){return BPromise[_0xaa2d('0x20')](_0x5729dc);}return _0x5bf1b4[_0xaa2d('0x21')]();};}function saveUpdates(_0xedda1d,_0x1f64f4){return function(_0x2327f1){if(_0x2327f1){return _0x2327f1[_0xaa2d('0x22')](_0xedda1d)[_0xaa2d('0x23')](function(_0x2a65d3){return _0x2a65d3;});}return null;};}function removeEntity(_0x2112b1,_0xfbe506){return function(_0x1e8fb6){if(_0x1e8fb6){return _0x1e8fb6[_0xaa2d('0x24')]()[_0xaa2d('0x23')](function(){_0x2112b1[_0xaa2d('0x18')](0xcc)[_0xaa2d('0x19')]();});}};}function handleEntityNotFound(_0x263573,_0x26dc32){return function(_0x3ecac6){if(!_0x3ecac6){_0x263573[_0xaa2d('0x17')](0x194);}return _0x3ecac6;};}function handleError(_0x42cfbf,_0x336ca0){_0x336ca0=_0x336ca0||0x1f4;return function(_0x47066e){logger[_0xaa2d('0x25')](_0x47066e[_0xaa2d('0x26')]);if(_0x47066e[_0xaa2d('0x27')]){delete _0x47066e['name'];}_0x42cfbf[_0xaa2d('0x18')](_0x336ca0)[_0xaa2d('0x28')](_0x47066e);};}exports['index']=function(_0x2984f0,_0x1b746a){var _0x27ca9d={},_0x3e6054={},_0x528945={'count':0x0,'rows':[]};var _0x5b0ff9=_[_0xaa2d('0x29')](db['VoiceQueuesLog'][_0xaa2d('0x2a')],function(_0x1e16b3){return{'name':_0x1e16b3[_0xaa2d('0x2b')],'type':_0x1e16b3[_0xaa2d('0x2c')]['key']};});_0x3e6054['model']=_['map'](_0x5b0ff9,_0xaa2d('0x27'));_0x3e6054[_0xaa2d('0x2d')]=_[_0xaa2d('0x2e')](_0x2984f0[_0xaa2d('0x2d')]);_0x3e6054[_0xaa2d('0x2f')]=_[_0xaa2d('0x30')](_0x3e6054['model'],_0x3e6054['query']);_0x27ca9d[_0xaa2d('0x31')]=_[_0xaa2d('0x30')](_0x3e6054[_0xaa2d('0x32')],qs[_0xaa2d('0x33')](_0x2984f0[_0xaa2d('0x2d')][_0xaa2d('0x33')]));_0x27ca9d[_0xaa2d('0x31')]=_0x27ca9d[_0xaa2d('0x31')][_0xaa2d('0x34')]?_0x27ca9d[_0xaa2d('0x31')]:_0x3e6054[_0xaa2d('0x32')];if(!_0x2984f0[_0xaa2d('0x2d')]['hasOwnProperty']('nolimit')){_0x27ca9d[_0xaa2d('0x35')]=qs[_0xaa2d('0x35')](_0x2984f0[_0xaa2d('0x2d')][_0xaa2d('0x35')]);_0x27ca9d[_0xaa2d('0x1a')]=qs['offset'](_0x2984f0[_0xaa2d('0x2d')][_0xaa2d('0x1a')]);}_0x27ca9d['order']=qs[_0xaa2d('0x36')](_0x2984f0['query'][_0xaa2d('0x36')]);_0x27ca9d[_0xaa2d('0x37')]=qs[_0xaa2d('0x2f')](_['pick'](_0x2984f0[_0xaa2d('0x2d')],_0x3e6054[_0xaa2d('0x2f')]),_0x5b0ff9);if(_0x2984f0[_0xaa2d('0x2d')][_0xaa2d('0x38')]){_0x27ca9d[_0xaa2d('0x37')]=_[_0xaa2d('0x39')](_0x27ca9d['where'],{'$or':_['map'](_0x5b0ff9,function(_0x2f39c4){if(_0x2f39c4[_0xaa2d('0x2c')]!==_0xaa2d('0x3a')){var _0x1660c3={};_0x1660c3[_0x2f39c4[_0xaa2d('0x27')]]={'$like':'%'+_0x2984f0['query'][_0xaa2d('0x38')]+'%'};return _0x1660c3;}})});}_0x27ca9d=_[_0xaa2d('0x39')]({},_0x27ca9d,_0x2984f0[_0xaa2d('0x3b')]);var _0xcc80ac={'where':_0x27ca9d[_0xaa2d('0x37')]};return db[_0xaa2d('0x3c')][_0xaa2d('0x1c')](_0xcc80ac)[_0xaa2d('0x23')](function(_0x442de6){_0x528945[_0xaa2d('0x1c')]=_0x442de6;if(_0x2984f0['query'][_0xaa2d('0x3d')]){_0x27ca9d[_0xaa2d('0x3e')]=[{'all':!![]}];}return db[_0xaa2d('0x3c')][_0xaa2d('0x3f')](_0x27ca9d);})[_0xaa2d('0x23')](function(_0x4aa769){_0x528945[_0xaa2d('0x40')]=_0x4aa769;return _0x528945;})['then'](respondWithFilteredResult(_0x1b746a,_0x27ca9d))[_0xaa2d('0x41')](handleError(_0x1b746a,null));};exports[_0xaa2d('0x42')]=function(_0x2c057a,_0x15e2ae){var _0x89c816={'raw':!![],'where':{'id':_0x2c057a[_0xaa2d('0x43')]['id']}},_0x17d773={};_0x17d773['model']=_[_0xaa2d('0x2e')](db[_0xaa2d('0x3c')][_0xaa2d('0x2a')]);_0x17d773['query']=_['keys'](_0x2c057a[_0xaa2d('0x2d')]);_0x17d773[_0xaa2d('0x2f')]=_[_0xaa2d('0x30')](_0x17d773['model'],_0x17d773[_0xaa2d('0x2d')]);_0x89c816[_0xaa2d('0x31')]=_[_0xaa2d('0x30')](_0x17d773[_0xaa2d('0x32')],qs[_0xaa2d('0x33')](_0x2c057a[_0xaa2d('0x2d')]['fields']));_0x89c816['attributes']=_0x89c816[_0xaa2d('0x31')][_0xaa2d('0x34')]?_0x89c816[_0xaa2d('0x31')]:_0x17d773[_0xaa2d('0x32')];if(_0x2c057a[_0xaa2d('0x2d')][_0xaa2d('0x3d')]){_0x89c816[_0xaa2d('0x3e')]=[{'all':!![]}];}_0x89c816=_[_0xaa2d('0x39')]({},_0x89c816,_0x2c057a[_0xaa2d('0x3b')]);return db[_0xaa2d('0x3c')][_0xaa2d('0x44')](_0x89c816)[_0xaa2d('0x23')](handleEntityNotFound(_0x15e2ae,null))['then'](respondWithResult(_0x15e2ae,null))[_0xaa2d('0x41')](handleError(_0x15e2ae,null));};exports['create']=function(_0x15be50,_0x513968){return db[_0xaa2d('0x3c')]['create'](_0x15be50[_0xaa2d('0x45')],{})[_0xaa2d('0x23')](respondWithResult(_0x513968,0xc9))[_0xaa2d('0x41')](handleError(_0x513968,null));};exports[_0xaa2d('0x22')]=function(_0x2b3701,_0x5e9b9c){if(_0x2b3701['body']['id']){delete _0x2b3701[_0xaa2d('0x45')]['id'];}return db[_0xaa2d('0x3c')][_0xaa2d('0x44')]({'where':{'id':_0x2b3701[_0xaa2d('0x43')]['id']}})[_0xaa2d('0x23')](handleEntityNotFound(_0x5e9b9c,null))[_0xaa2d('0x23')](saveUpdates(_0x2b3701[_0xaa2d('0x45')],null))[_0xaa2d('0x23')](respondWithResult(_0x5e9b9c,null))['catch'](handleError(_0x5e9b9c,null));};exports[_0xaa2d('0x24')]=function(_0xa520dc,_0x6a73b1){return db['VoiceQueuesLog']['find']({'where':{'id':_0xa520dc[_0xaa2d('0x43')]['id']}})[_0xaa2d('0x23')](handleEntityNotFound(_0x6a73b1,null))['then'](removeEntity(_0x6a73b1,null))[_0xaa2d('0x41')](handleError(_0x6a73b1,null));}; \ No newline at end of file +var _0x7ff3=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceQueuesLog','then','findAll','rows','catch','show','params','include','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis'];(function(_0x533e4e,_0x4eba54){var _0x1f14bb=function(_0x33a485){while(--_0x33a485){_0x533e4e['push'](_0x533e4e['shift']());}};_0x1f14bb(++_0x4eba54);}(_0x7ff3,0x125));var _0x37ff=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x7ff3[_0xc6be3a];return _0x56a310;};'use strict';var emlformat=require(_0x37ff('0x0'));var rimraf=require(_0x37ff('0x1'));var zipdir=require(_0x37ff('0x2'));var jsonpatch=require(_0x37ff('0x3'));var rp=require(_0x37ff('0x4'));var moment=require(_0x37ff('0x5'));var BPromise=require(_0x37ff('0x6'));var Mustache=require(_0x37ff('0x7'));var util=require(_0x37ff('0x8'));var path=require(_0x37ff('0x9'));var sox=require(_0x37ff('0xa'));var csv=require(_0x37ff('0xb'));var ejs=require(_0x37ff('0xc'));var fs=require('fs');var fs_extra=require(_0x37ff('0xd'));var _=require('lodash');var squel=require(_0x37ff('0xe'));var crypto=require(_0x37ff('0xf'));var jsforce=require(_0x37ff('0x10'));var deskjs=require(_0x37ff('0x11'));var toCsv=require(_0x37ff('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x37ff('0x12'));var authService=require(_0x37ff('0x13'));var qs=require(_0x37ff('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x37ff('0x15'));var logger=require(_0x37ff('0x16'))(_0x37ff('0x17'));var utils=require('../../config/utils');var config=require(_0x37ff('0x18'));var licenseUtil=require(_0x37ff('0x19'));var db=require(_0x37ff('0x1a'))['db'];function respondWithStatusCode(_0x4b645b,_0x766bfa){_0x766bfa=_0x766bfa||0xcc;return function(_0x5cce84){if(_0x5cce84){return _0x4b645b[_0x37ff('0x1b')](_0x766bfa);}return _0x4b645b[_0x37ff('0x1c')](_0x766bfa)[_0x37ff('0x1d')]();};}function respondWithResult(_0x5934a3,_0x23e403){_0x23e403=_0x23e403||0xc8;return function(_0x77ece7){if(_0x77ece7){return _0x5934a3[_0x37ff('0x1c')](_0x23e403)[_0x37ff('0x1e')](_0x77ece7);}};}function respondWithFilteredResult(_0x5a7547,_0x15f1a9){return function(_0x204c96){if(_0x204c96){var _0x518a6f=typeof _0x15f1a9['offset']===_0x37ff('0x1f')&&typeof _0x15f1a9[_0x37ff('0x20')]===_0x37ff('0x1f');var _0x4afea4=_0x204c96[_0x37ff('0x21')];var _0x5729df=_0x518a6f?0x0:_0x15f1a9[_0x37ff('0x22')];var _0x313458=_0x518a6f?_0x204c96[_0x37ff('0x21')]:_0x15f1a9[_0x37ff('0x22')]+_0x15f1a9[_0x37ff('0x20')];var _0x22626c;if(_0x313458>=_0x4afea4){_0x313458=_0x4afea4;_0x22626c=0xc8;}else{_0x22626c=0xce;}_0x5a7547['status'](_0x22626c);return _0x5a7547[_0x37ff('0x23')]('Content-Range',_0x5729df+'-'+_0x313458+'/'+_0x4afea4)[_0x37ff('0x1e')](_0x204c96);}return null;};}function patchUpdates(_0x4c42b6){return function(_0x6be65d){try{jsonpatch[_0x37ff('0x24')](_0x6be65d,_0x4c42b6,!![]);}catch(_0x59ebd0){return BPromise[_0x37ff('0x25')](_0x59ebd0);}return _0x6be65d[_0x37ff('0x26')]();};}function saveUpdates(_0x4dffdc,_0x5b6a9d){return function(_0x41ccbb){if(_0x41ccbb){return _0x41ccbb[_0x37ff('0x27')](_0x4dffdc)['then'](function(_0x115a20){return _0x115a20;});}return null;};}function removeEntity(_0x37a859,_0x304da6){return function(_0x2c4740){if(_0x2c4740){return _0x2c4740['destroy']()['then'](function(){_0x37a859[_0x37ff('0x1c')](0xcc)[_0x37ff('0x1d')]();});}};}function handleEntityNotFound(_0x3e97cc,_0x37a9ff){return function(_0x56c9bb){if(!_0x56c9bb){_0x3e97cc[_0x37ff('0x1b')](0x194);}return _0x56c9bb;};}function handleError(_0x372e60,_0x574bbe){_0x574bbe=_0x574bbe||0x1f4;return function(_0x3cb93e){logger['error'](_0x3cb93e[_0x37ff('0x28')]);if(_0x3cb93e[_0x37ff('0x29')]){delete _0x3cb93e[_0x37ff('0x29')];}_0x372e60['status'](_0x574bbe)[_0x37ff('0x2a')](_0x3cb93e);};}exports[_0x37ff('0x2b')]=function(_0xd5eb8e,_0x565278){var _0x537269={},_0x4ff13e={},_0x3ffea0={'count':0x0,'rows':[]};var _0x3a6c43=_[_0x37ff('0x2c')](db['VoiceQueuesLog'][_0x37ff('0x2d')],function(_0x486465){return{'name':_0x486465['fieldName'],'type':_0x486465[_0x37ff('0x2e')][_0x37ff('0x2f')]};});_0x4ff13e[_0x37ff('0x30')]=_[_0x37ff('0x2c')](_0x3a6c43,_0x37ff('0x29'));_0x4ff13e[_0x37ff('0x31')]=_[_0x37ff('0x32')](_0xd5eb8e[_0x37ff('0x31')]);_0x4ff13e[_0x37ff('0x33')]=_[_0x37ff('0x34')](_0x4ff13e['model'],_0x4ff13e[_0x37ff('0x31')]);_0x537269[_0x37ff('0x35')]=_['intersection'](_0x4ff13e[_0x37ff('0x30')],qs[_0x37ff('0x36')](_0xd5eb8e[_0x37ff('0x31')][_0x37ff('0x36')]));_0x537269[_0x37ff('0x35')]=_0x537269[_0x37ff('0x35')][_0x37ff('0x37')]?_0x537269['attributes']:_0x4ff13e[_0x37ff('0x30')];if(!_0xd5eb8e[_0x37ff('0x31')][_0x37ff('0x38')](_0x37ff('0x39'))){_0x537269[_0x37ff('0x20')]=qs[_0x37ff('0x20')](_0xd5eb8e[_0x37ff('0x31')][_0x37ff('0x20')]);_0x537269['offset']=qs['offset'](_0xd5eb8e[_0x37ff('0x31')]['offset']);}_0x537269[_0x37ff('0x3a')]=qs[_0x37ff('0x3b')](_0xd5eb8e[_0x37ff('0x31')]['sort']);_0x537269[_0x37ff('0x3c')]=qs[_0x37ff('0x33')](_[_0x37ff('0x3d')](_0xd5eb8e[_0x37ff('0x31')],_0x4ff13e['filters']),_0x3a6c43);if(_0xd5eb8e[_0x37ff('0x31')][_0x37ff('0x3e')]){_0x537269[_0x37ff('0x3c')]=_[_0x37ff('0x3f')](_0x537269[_0x37ff('0x3c')],{'$or':_[_0x37ff('0x2c')](_0x3a6c43,function(_0x4f3d89){if(_0x4f3d89[_0x37ff('0x2e')]!==_0x37ff('0x40')){var _0x422923={};_0x422923[_0x4f3d89[_0x37ff('0x29')]]={'$like':'%'+_0xd5eb8e['query']['filter']+'%'};return _0x422923;}})});}_0x537269=_['merge']({},_0x537269,_0xd5eb8e[_0x37ff('0x41')]);var _0x25582f={'where':_0x537269[_0x37ff('0x3c')]};return db[_0x37ff('0x42')][_0x37ff('0x21')](_0x25582f)[_0x37ff('0x43')](function(_0x1fec00){_0x3ffea0[_0x37ff('0x21')]=_0x1fec00;if(_0xd5eb8e[_0x37ff('0x31')]['includeAll']){_0x537269['include']=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x37ff('0x44')](_0x537269);})['then'](function(_0x5b501e){_0x3ffea0[_0x37ff('0x45')]=_0x5b501e;return _0x3ffea0;})[_0x37ff('0x43')](respondWithFilteredResult(_0x565278,_0x537269))[_0x37ff('0x46')](handleError(_0x565278,null));};exports[_0x37ff('0x47')]=function(_0x34d12d,_0x491e20){var _0x44e24a={'raw':!![],'where':{'id':_0x34d12d[_0x37ff('0x48')]['id']}},_0x67a23a={};_0x67a23a['model']=_[_0x37ff('0x32')](db[_0x37ff('0x42')][_0x37ff('0x2d')]);_0x67a23a[_0x37ff('0x31')]=_[_0x37ff('0x32')](_0x34d12d[_0x37ff('0x31')]);_0x67a23a[_0x37ff('0x33')]=_['intersection'](_0x67a23a[_0x37ff('0x30')],_0x67a23a[_0x37ff('0x31')]);_0x44e24a[_0x37ff('0x35')]=_[_0x37ff('0x34')](_0x67a23a[_0x37ff('0x30')],qs[_0x37ff('0x36')](_0x34d12d[_0x37ff('0x31')][_0x37ff('0x36')]));_0x44e24a[_0x37ff('0x35')]=_0x44e24a['attributes'][_0x37ff('0x37')]?_0x44e24a['attributes']:_0x67a23a[_0x37ff('0x30')];if(_0x34d12d[_0x37ff('0x31')]['includeAll']){_0x44e24a[_0x37ff('0x49')]=[{'all':!![]}];}_0x44e24a=_[_0x37ff('0x3f')]({},_0x44e24a,_0x34d12d[_0x37ff('0x41')]);return db[_0x37ff('0x42')]['find'](_0x44e24a)[_0x37ff('0x43')](handleEntityNotFound(_0x491e20,null))['then'](respondWithResult(_0x491e20,null))[_0x37ff('0x46')](handleError(_0x491e20,null));};exports[_0x37ff('0x4a')]=function(_0x1da937,_0xebb759){return db['VoiceQueuesLog'][_0x37ff('0x4a')](_0x1da937['body'],{})[_0x37ff('0x43')](respondWithResult(_0xebb759,0xc9))[_0x37ff('0x46')](handleError(_0xebb759,null));};exports[_0x37ff('0x27')]=function(_0x1e480c,_0x37dbf4){if(_0x1e480c[_0x37ff('0x4b')]['id']){delete _0x1e480c[_0x37ff('0x4b')]['id'];}return db[_0x37ff('0x42')][_0x37ff('0x4c')]({'where':{'id':_0x1e480c['params']['id']}})['then'](handleEntityNotFound(_0x37dbf4,null))[_0x37ff('0x43')](saveUpdates(_0x1e480c[_0x37ff('0x4b')],null))[_0x37ff('0x43')](respondWithResult(_0x37dbf4,null))[_0x37ff('0x46')](handleError(_0x37dbf4,null));};exports[_0x37ff('0x4d')]=function(_0xbc04f9,_0x84bae5){return db['VoiceQueuesLog'][_0x37ff('0x4c')]({'where':{'id':_0xbc04f9['params']['id']}})[_0x37ff('0x43')](handleEntityNotFound(_0x84bae5,null))[_0x37ff('0x43')](removeEntity(_0x84bae5,null))['catch'](handleError(_0x84bae5,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index d3dba53..6eb410a 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 _0xbf97=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','util','../../config/logger'];(function(_0x3f9c5d,_0x283784){var _0x2f2c73=function(_0x22bb42){while(--_0x22bb42){_0x3f9c5d['push'](_0x3f9c5d['shift']());}};_0x2f2c73(++_0x283784);}(_0xbf97,0xa6));var _0x7bf9=function(_0x4da381,_0x366592){_0x4da381=_0x4da381-0x0;var _0x30223b=_0xbf97[_0x4da381];return _0x30223b;};'use strict';var _=require('lodash');var util=require(_0x7bf9('0x0'));var logger=require(_0x7bf9('0x1'))(_0x7bf9('0x2'));var moment=require(_0x7bf9('0x3'));var BPromise=require('bluebird');var rp=require(_0x7bf9('0x4'));var fs=require('fs');var path=require(_0x7bf9('0x5'));var rimraf=require(_0x7bf9('0x6'));var config=require(_0x7bf9('0x7'));var attributes=require('./voiceQueuesLog.attributes');module[_0x7bf9('0x8')]=function(_0x4ba3f9,_0x3a8af9){return _0x4ba3f9[_0x7bf9('0x9')](_0x7bf9('0xa'),attributes,{'tableName':_0x7bf9('0xb'),'paranoid':![],'indexes':[{'name':_0x7bf9('0xc'),'fields':['event',_0x7bf9('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xa7ee=['rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4759f1,_0x1607af){var _0x56f0c9=function(_0x23659a){while(--_0x23659a){_0x4759f1['push'](_0x4759f1['shift']());}};_0x56f0c9(++_0x1607af);}(_0xa7ee,0x119));var _0xea7e=function(_0xd21fe7,_0x225a39){_0xd21fe7=_0xd21fe7-0x0;var _0x14d570=_0xa7ee[_0xd21fe7];return _0x14d570;};'use strict';var _=require(_0xea7e('0x0'));var util=require(_0xea7e('0x1'));var logger=require(_0xea7e('0x2'))(_0xea7e('0x3'));var moment=require(_0xea7e('0x4'));var BPromise=require(_0xea7e('0x5'));var rp=require(_0xea7e('0x6'));var fs=require('fs');var path=require(_0xea7e('0x7'));var rimraf=require(_0xea7e('0x8'));var config=require(_0xea7e('0x9'));var attributes=require(_0xea7e('0xa'));module[_0xea7e('0xb')]=function(_0xc6b99d,_0x3d9e5e){return _0xc6b99d[_0xea7e('0xc')]('VoiceQueuesLog',attributes,{'tableName':_0xea7e('0xd'),'paranoid':![],'indexes':[{'name':_0xea7e('0xe'),'fields':[_0xea7e('0xf'),_0xea7e('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index a7a8858..8900861 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 _0xd959=['message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x9cbfe0,_0x56aada){var _0x1f1534=function(_0x422947){while(--_0x422947){_0x9cbfe0['push'](_0x9cbfe0['shift']());}};_0x1f1534(++_0x56aada);}(_0xd959,0xd3));var _0x9d95=function(_0x323bd5,_0x414c1f){_0x323bd5=_0x323bd5-0x0;var _0x6c51aa=_0xd959[_0x323bd5];return _0x6c51aa;};'use strict';var _=require(_0x9d95('0x0'));var util=require(_0x9d95('0x1'));var moment=require(_0x9d95('0x2'));var BPromise=require(_0x9d95('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9d95('0x4'));var db=require(_0x9d95('0x5'))['db'];var utils=require(_0x9d95('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9d95('0x7'));var jayson=require(_0x9d95('0x8'));var client=jayson[_0x9d95('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e4f68,_0x4e6126,_0x203822){return new BPromise(function(_0x3a338f,_0xe79021){return client['request'](_0x1e4f68,_0x203822)['then'](function(_0x14fb9d){logger[_0x9d95('0xa')](_0x9d95('0xb'),_0x4e6126,'request\x20sent');logger[_0x9d95('0xc')](_0x9d95('0xd'),_0x4e6126,_0x9d95('0xe'),JSON['stringify'](_0x14fb9d));if(_0x14fb9d[_0x9d95('0xf')]){if(_0x14fb9d[_0x9d95('0xf')][_0x9d95('0x10')]===0x1f4){logger[_0x9d95('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4e6126,_0x14fb9d[_0x9d95('0xf')][_0x9d95('0x11')]);return _0xe79021(_0x14fb9d['error']['message']);}logger[_0x9d95('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4e6126,_0x14fb9d[_0x9d95('0xf')][_0x9d95('0x11')]);return _0x3a338f(_0x14fb9d[_0x9d95('0xf')][_0x9d95('0x11')]);}else{logger[_0x9d95('0xa')](_0x9d95('0xb'),_0x4e6126,_0x9d95('0xe'));_0x3a338f(_0x14fb9d['result']['message']);}})[_0x9d95('0x12')](function(_0x4b964f){logger[_0x9d95('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4e6126,_0x4b964f);_0xe79021(_0x4b964f);});});} \ No newline at end of file +var _0x9965=['error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x30f5d7,_0x462d8f){var _0x31a057=function(_0x124690){while(--_0x124690){_0x30f5d7['push'](_0x30f5d7['shift']());}};_0x31a057(++_0x462d8f);}(_0x9965,0xf4));var _0x5996=function(_0x4381a0,_0x3196e6){_0x4381a0=_0x4381a0-0x0;var _0x3a6d72=_0x9965[_0x4381a0];return _0x3a6d72;};'use strict';var _=require(_0x5996('0x0'));var util=require(_0x5996('0x1'));var moment=require(_0x5996('0x2'));var BPromise=require(_0x5996('0x3'));var rs=require(_0x5996('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5996('0x5'))['db'];var utils=require(_0x5996('0x6'));var logger=require(_0x5996('0x7'))(_0x5996('0x8'));var config=require(_0x5996('0x9'));var jayson=require(_0x5996('0xa'));var client=jayson['client'][_0x5996('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2108e3,_0x141d78,_0x20491b){return new BPromise(function(_0x13c564,_0x978f0e){return client[_0x5996('0xc')](_0x2108e3,_0x20491b)[_0x5996('0xd')](function(_0x3b24b9){logger[_0x5996('0xe')](_0x5996('0xf'),_0x141d78,'request\x20sent');logger[_0x5996('0x10')](_0x5996('0x11'),_0x141d78,_0x5996('0x12'),JSON[_0x5996('0x13')](_0x3b24b9));if(_0x3b24b9[_0x5996('0x14')]){if(_0x3b24b9[_0x5996('0x14')][_0x5996('0x15')]===0x1f4){logger[_0x5996('0x14')](_0x5996('0xf'),_0x141d78,_0x3b24b9['error'][_0x5996('0x16')]);return _0x978f0e(_0x3b24b9[_0x5996('0x14')][_0x5996('0x16')]);}logger[_0x5996('0x14')](_0x5996('0xf'),_0x141d78,_0x3b24b9['error']['message']);return _0x13c564(_0x3b24b9['error'][_0x5996('0x16')]);}else{logger[_0x5996('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x141d78,_0x5996('0x12'));_0x13c564(_0x3b24b9[_0x5996('0x17')][_0x5996('0x16')]);}})['catch'](function(_0xf7e22e){logger['error'](_0x5996('0xf'),_0x141d78,_0xf7e22e);_0x978f0e(_0xf7e22e);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index e2da849..19887be 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 _0xcd2d=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','downloads','/:id/transcribe','downloadTranscribe','create','post','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceRecording.controller'];(function(_0x3c6310,_0x13601d){var _0x320122=function(_0x596176){while(--_0x596176){_0x3c6310['push'](_0x3c6310['shift']());}};_0x320122(++_0x13601d);}(_0xcd2d,0x1cb));var _0xdcd2=function(_0x481f21,_0x2fb05b){_0x481f21=_0x481f21-0x0;var _0x4c5a44=_0xcd2d[_0x481f21];return _0x4c5a44;};'use strict';var multer=require(_0xdcd2('0x0'));var util=require(_0xdcd2('0x1'));var path=require(_0xdcd2('0x2'));var timeout=require('connect-timeout');var express=require(_0xdcd2('0x3'));var router=express[_0xdcd2('0x4')]();var fs_extra=require(_0xdcd2('0x5'));var auth=require(_0xdcd2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdcd2('0x7'));var controller=require(_0xdcd2('0x8'));router[_0xdcd2('0x9')]('/',auth[_0xdcd2('0xa')](),controller[_0xdcd2('0xb')]);router[_0xdcd2('0x9')](_0xdcd2('0xc'),auth['isAuthenticated'](),controller[_0xdcd2('0xd')]);router['get'](_0xdcd2('0xe'),auth[_0xdcd2('0xa')](),controller[_0xdcd2('0xf')]);router[_0xdcd2('0x9')](_0xdcd2('0x10'),auth[_0xdcd2('0xa')](),controller[_0xdcd2('0x11')]);router[_0xdcd2('0x9')]('/:id/downloads',controller[_0xdcd2('0x12')]);router[_0xdcd2('0x9')](_0xdcd2('0x13'),auth[_0xdcd2('0xa')](),controller[_0xdcd2('0x14')]);router['post']('/',auth[_0xdcd2('0xa')](),controller[_0xdcd2('0x15')]);router[_0xdcd2('0x16')](_0xdcd2('0x13'),auth[_0xdcd2('0xa')](),controller['runTranscribe']);router[_0xdcd2('0x17')](_0xdcd2('0xe'),auth[_0xdcd2('0xa')](),controller['update']);router['delete'](_0xdcd2('0xe'),auth[_0xdcd2('0xa')](),controller[_0xdcd2('0x18')]);module[_0xdcd2('0x19')]=router; \ No newline at end of file +var _0xf11d=['downloads','/:id/transcribe','downloadTranscribe','post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','/:id/downloads'];(function(_0x4c6c46,_0x4d5b50){var _0x4eca5e=function(_0x2478b3){while(--_0x2478b3){_0x4c6c46['push'](_0x4c6c46['shift']());}};_0x4eca5e(++_0x4d5b50);}(_0xf11d,0x1dc));var _0xdf11=function(_0x5201f6,_0x1733d3){_0x5201f6=_0x5201f6-0x0;var _0x475ecd=_0xf11d[_0x5201f6];return _0x475ecd;};'use strict';var multer=require(_0xdf11('0x0'));var util=require(_0xdf11('0x1'));var path=require(_0xdf11('0x2'));var timeout=require(_0xdf11('0x3'));var express=require('express');var router=express[_0xdf11('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdf11('0x5'));var interaction=require(_0xdf11('0x6'));var config=require(_0xdf11('0x7'));var controller=require(_0xdf11('0x8'));router[_0xdf11('0x9')]('/',auth[_0xdf11('0xa')](),controller[_0xdf11('0xb')]);router['get']('/describe',auth[_0xdf11('0xa')](),controller[_0xdf11('0xc')]);router[_0xdf11('0x9')](_0xdf11('0xd'),auth[_0xdf11('0xa')](),controller[_0xdf11('0xe')]);router['get'](_0xdf11('0xf'),auth['isAuthenticated'](),controller[_0xdf11('0x10')]);router[_0xdf11('0x9')](_0xdf11('0x11'),controller[_0xdf11('0x12')]);router[_0xdf11('0x9')](_0xdf11('0x13'),auth[_0xdf11('0xa')](),controller[_0xdf11('0x14')]);router['post']('/',auth[_0xdf11('0xa')](),controller['create']);router[_0xdf11('0x15')]('/:id/transcribe',auth['isAuthenticated'](),controller['runTranscribe']);router[_0xdf11('0x16')](_0xdf11('0xd'),auth[_0xdf11('0xa')](),controller[_0xdf11('0x17')]);router['delete'](_0xdf11('0xd'),auth[_0xdf11('0xa')](),controller[_0xdf11('0x18')]);module[_0xdf11('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index e50a78d..99e3407 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(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 6aba677..d55c955 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 _0x5164=['download','../../components/encryptor','uniqueid','value','format','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','sequelize','MD5','col','token','$and','push','%s.cypher','secrets','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','transcribeAccountId','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','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe'];(function(_0x92811e,_0x51a418){var _0xd40f93=function(_0x402113){while(--_0x402113){_0x92811e['push'](_0x92811e['shift']());}};_0xd40f93(++_0x51a418);}(_0x5164,0x18c));var _0x4516=function(_0x590863,_0x5a74d5){_0x590863=_0x590863-0x0;var _0x5c26d4=_0x5164[_0x590863];return _0x5c26d4;};'use strict';var emlformat=require(_0x4516('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4516('0x1'));var jsonpatch=require(_0x4516('0x2'));var rp=require(_0x4516('0x3'));var moment=require(_0x4516('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4516('0x5'));var sox=require(_0x4516('0x6'));var csv=require(_0x4516('0x7'));var ejs=require(_0x4516('0x8'));var fs=require('fs');var fs_extra=require(_0x4516('0x9'));var _=require(_0x4516('0xa'));var squel=require(_0x4516('0xb'));var crypto=require(_0x4516('0xc'));var jsforce=require(_0x4516('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4516('0xe'));var Papa=require(_0x4516('0xf'));var AWS=require(_0x4516('0x10'));var uuidv4=require(_0x4516('0x11'));var Redis=require('ioredis');var authService=require(_0x4516('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4516('0x13'));var hardwareService=require(_0x4516('0x14'));var logger=require(_0x4516('0x15'))(_0x4516('0x16'));var utils=require(_0x4516('0x17'));var config=require(_0x4516('0x18'));var licenseUtil=require(_0x4516('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x123b7b,_0x43ee05){_0x43ee05=_0x43ee05||0xcc;return function(_0x14e5f9){if(_0x14e5f9){return _0x123b7b[_0x4516('0x1a')](_0x43ee05);}return _0x123b7b[_0x4516('0x1b')](_0x43ee05)['end']();};}function respondWithResult(_0xd3860,_0x1da7b8){_0x1da7b8=_0x1da7b8||0xc8;return function(_0xe10024){if(_0xe10024){return _0xd3860[_0x4516('0x1b')](_0x1da7b8)[_0x4516('0x1c')](_0xe10024);}};}function respondWithFilteredResult(_0x439b1a,_0x418cea){return function(_0xe445a1){if(_0xe445a1){var _0x15aacd=typeof _0x418cea[_0x4516('0x1d')]===_0x4516('0x1e')&&typeof _0x418cea[_0x4516('0x1f')]===_0x4516('0x1e');var _0x34d1f8=_0xe445a1[_0x4516('0x20')];var _0x42f842=_0x15aacd?0x0:_0x418cea[_0x4516('0x1d')];var _0x19dc65=_0x15aacd?_0xe445a1[_0x4516('0x20')]:_0x418cea[_0x4516('0x1d')]+_0x418cea[_0x4516('0x1f')];var _0x5d7ddc;if(_0x19dc65>=_0x34d1f8){_0x19dc65=_0x34d1f8;_0x5d7ddc=0xc8;}else{_0x5d7ddc=0xce;}_0x439b1a[_0x4516('0x1b')](_0x5d7ddc);return _0x439b1a[_0x4516('0x21')](_0x4516('0x22'),_0x42f842+'-'+_0x19dc65+'/'+_0x34d1f8)[_0x4516('0x1c')](_0xe445a1);}return null;};}function patchUpdates(_0x5706f5){return function(_0x32ac55){try{jsonpatch['apply'](_0x32ac55,_0x5706f5,!![]);}catch(_0x2449ce){return BPromise[_0x4516('0x23')](_0x2449ce);}return _0x32ac55[_0x4516('0x24')]();};}function saveUpdates(_0x48fbdb,_0x5a8e5b){return function(_0x4eced4){if(_0x4eced4){return _0x4eced4[_0x4516('0x25')](_0x48fbdb)[_0x4516('0x26')](function(_0xc6d218){return _0xc6d218;});}return null;};}function removeEntity(_0x4dc906,_0x4f732c){return function(_0x1def76){if(_0x1def76){return _0x1def76[_0x4516('0x27')]()[_0x4516('0x26')](function(){_0x4dc906[_0x4516('0x1b')](0xcc)[_0x4516('0x28')]();});}};}function handleEntityNotFound(_0x415461,_0x5554e4){return function(_0x48a9d0){if(!_0x48a9d0){_0x415461['sendStatus'](0x194);}return _0x48a9d0;};}function handleError(_0x3561b6,_0x61ccd0){_0x61ccd0=_0x61ccd0||0x1f4;return function(_0xa93c9){logger[_0x4516('0x29')](_0xa93c9[_0x4516('0x2a')]);if(_0xa93c9[_0x4516('0x2b')]){delete _0xa93c9['name'];}_0x3561b6[_0x4516('0x1b')](_0x61ccd0)[_0x4516('0x2c')](_0xa93c9);};}exports[_0x4516('0x2d')]=function(_0x386352,_0x2ea50e){var _0xc74ec8={},_0x1d9ff1={},_0x27ed6f={'count':0x0,'rows':[]};var _0x2ea748=_[_0x4516('0x2e')](db[_0x4516('0x2f')][_0x4516('0x30')],function(_0x5a97ca){return{'name':_0x5a97ca[_0x4516('0x31')],'type':_0x5a97ca[_0x4516('0x32')][_0x4516('0x33')]};});_0x1d9ff1[_0x4516('0x34')]=_['differenceBy'](_[_0x4516('0x2e')](_0x2ea748,'name'),['format']);_0x1d9ff1[_0x4516('0x35')]=_[_0x4516('0x36')](_0x386352[_0x4516('0x35')]);_0x1d9ff1[_0x4516('0x37')]=_[_0x4516('0x38')](_0x1d9ff1[_0x4516('0x34')],_0x1d9ff1['query']);_0xc74ec8[_0x4516('0x39')]=_[_0x4516('0x38')](_0x1d9ff1['model'],qs[_0x4516('0x3a')](_0x386352['query'][_0x4516('0x3a')]));_0xc74ec8[_0x4516('0x39')]=_0xc74ec8[_0x4516('0x39')]['length']?_0xc74ec8[_0x4516('0x39')]:_0x1d9ff1['model'];if(!_0x386352[_0x4516('0x35')][_0x4516('0x3b')](_0x4516('0x3c'))){_0xc74ec8['limit']=qs[_0x4516('0x1f')](_0x386352[_0x4516('0x35')][_0x4516('0x1f')]);_0xc74ec8[_0x4516('0x1d')]=qs['offset'](_0x386352[_0x4516('0x35')]['offset']);}_0xc74ec8[_0x4516('0x3d')]=qs['sort'](_0x386352[_0x4516('0x35')][_0x4516('0x3e')]);_0xc74ec8[_0x4516('0x3f')]=qs[_0x4516('0x37')](_[_0x4516('0x40')](_0x386352[_0x4516('0x35')],_0x1d9ff1[_0x4516('0x37')]),_0x2ea748);if(_0x386352[_0x4516('0x35')]['filter']){_0xc74ec8[_0x4516('0x3f')]=_['merge'](_0xc74ec8[_0x4516('0x3f')],{'$or':_[_0x4516('0x2e')](_0x2ea748,function(_0x147310){if(_0x147310['type']!==_0x4516('0x41')){var _0x375542={};_0x375542[_0x147310[_0x4516('0x2b')]]={'$like':'%'+_0x386352['query'][_0x4516('0x42')]+'%'};return _0x375542;}})});}_0xc74ec8=_[_0x4516('0x43')]({},_0xc74ec8,_0x386352[_0x4516('0x44')]);var _0x256976={'where':_0xc74ec8[_0x4516('0x3f')]};return db[_0x4516('0x2f')][_0x4516('0x20')](_0x256976)[_0x4516('0x26')](function(_0x1dcc7c){_0x27ed6f[_0x4516('0x20')]=_0x1dcc7c;if(_0x386352[_0x4516('0x35')][_0x4516('0x45')]){_0xc74ec8[_0x4516('0x46')]=[{'all':!![]}];}return db[_0x4516('0x2f')][_0x4516('0x47')](_0xc74ec8);})[_0x4516('0x26')](function(_0x51d086){_0x27ed6f[_0x4516('0x48')]=_0x51d086;return _0x27ed6f;})['then'](respondWithFilteredResult(_0x2ea50e,_0xc74ec8))[_0x4516('0x49')](handleError(_0x2ea50e,null));};exports[_0x4516('0x4a')]=function(_0xde1f4d,_0xf25323){var _0x7db35={'raw':![],'where':{'id':_0xde1f4d[_0x4516('0x4b')]['id']}},_0x468b35={};_0x468b35[_0x4516('0x34')]=_[_0x4516('0x36')](db[_0x4516('0x2f')][_0x4516('0x30')]);_0x468b35[_0x4516('0x35')]=_[_0x4516('0x36')](_0xde1f4d[_0x4516('0x35')]);_0x468b35[_0x4516('0x37')]=_['intersection'](_0x468b35[_0x4516('0x34')],_0x468b35[_0x4516('0x35')]);_0x7db35[_0x4516('0x39')]=_[_0x4516('0x38')](_0x468b35[_0x4516('0x34')],qs[_0x4516('0x3a')](_0xde1f4d[_0x4516('0x35')][_0x4516('0x3a')]));_0x7db35[_0x4516('0x39')]=_0x7db35[_0x4516('0x39')][_0x4516('0x4c')]?_0x7db35[_0x4516('0x39')]:_0x468b35[_0x4516('0x34')];if(_0xde1f4d[_0x4516('0x35')][_0x4516('0x45')]){_0x7db35[_0x4516('0x46')]=[{'all':!![]}];}_0x7db35=_['merge']({},_0x7db35,_0xde1f4d['options']);return db[_0x4516('0x2f')][_0x4516('0x4d')](_0x7db35)[_0x4516('0x26')](handleEntityNotFound(_0xf25323,null))[_0x4516('0x26')](respondWithResult(_0xf25323,null))[_0x4516('0x49')](handleError(_0xf25323,null));};exports[_0x4516('0x4e')]=function(_0x1a72c7,_0x555a66){return db[_0x4516('0x2f')]['create'](_0x1a72c7[_0x4516('0x4f')],{})[_0x4516('0x26')](respondWithResult(_0x555a66,0xc9))['catch'](handleError(_0x555a66,null));};exports['update']=function(_0x277b7a,_0x40c9d5){if(_0x277b7a[_0x4516('0x4f')]['id']){delete _0x277b7a['body']['id'];}return db[_0x4516('0x2f')][_0x4516('0x4d')]({'where':{'id':_0x277b7a[_0x4516('0x4b')]['id']}})[_0x4516('0x26')](handleEntityNotFound(_0x40c9d5,null))[_0x4516('0x26')](saveUpdates(_0x277b7a[_0x4516('0x4f')],null))[_0x4516('0x26')](respondWithResult(_0x40c9d5,null))[_0x4516('0x49')](handleError(_0x40c9d5,null));};exports['describe']=function(_0x356bb5,_0x341734){return db['VoiceRecording'][_0x4516('0x50')]()[_0x4516('0x26')](respondWithResult(_0x341734,null))['catch'](handleError(_0x341734,null));};exports[_0x4516('0x51')]=function(_0x3f7831,_0x447eed,_0x59d501){var _0x371ddd=require(_0x4516('0x52'));var _0x12d9ac=![];var _0x231420={};if(_0x3f7831['query'][_0x4516('0x32')]&&_0x3f7831['query']['type']==='uniqueid'){_0x231420[_0x4516('0x53')]=_0x3f7831['params']['id'];}else{_0x231420['id']=_0x3f7831[_0x4516('0x4b')]['id'];}return db['VoiceRecording'][_0x4516('0x4d')]({'where':_0x231420,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x447eed,null))[_0x4516('0x26')](function(_0x4c673d){if(_0x4c673d){var _0x15a0a9=_0x4c673d[_0x4516('0x54')];var _0x94d44e=util[_0x4516('0x55')]('%s.cypher',_0x15a0a9);if(fs[_0x4516('0x56')](_0x94d44e)){_0x12d9ac=!![];return _0x371ddd[_0x4516('0x57')](_0x94d44e,_0x15a0a9,config['secrets'][_0x4516('0x58')])[_0x4516('0x26')](function(){return _0x4c673d;});}return _0x4c673d;}})[_0x4516('0x26')](function(_0x4490ed){if(_0x4490ed){var _0x28968e=_0x4490ed['value'];if(!fs[_0x4516('0x56')](_0x28968e)){throw new db[(_0x4516('0x59'))][(_0x4516('0x5a'))](_0x4516('0x5b'));}if(_0x4490ed[_0x4516('0x5c')]){return _0x447eed[_0x4516('0x51')](_0x28968e,_0x4490ed[_0x4516('0x5c')]+path[_0x4516('0x5d')](_0x28968e),function(){if(_0x12d9ac){fs[_0x4516('0x5e')](_0x28968e);}});}else{return _0x447eed[_0x4516('0x51')](_0x28968e,function(_0x146f04){if(_0x12d9ac){fs[_0x4516('0x5e')](_0x28968e);}});}}})[_0x4516('0x49')](function(_0x24936f){if(_0x24936f[_0x4516('0x5f')]===_0x4516('0x5b')){_0x447eed[_0x4516('0x1b')](0x194)[_0x4516('0x2c')]('Not\x20found');}else{return handleError(_0x447eed,null);}});};exports[_0x4516('0x60')]=function(_0x1059da,_0x1eff6b,_0x16ef69){var _0x453a3d=require(_0x4516('0x52'));var _0xc4b194=![];var _0x5eb227={'$and':[db[_0x4516('0x61')][_0x4516('0x3f')](db['sequelize']['fn'](_0x4516('0x62'),db[_0x4516('0x61')][_0x4516('0x63')]('uniqueid')),_0x1059da[_0x4516('0x35')][_0x4516('0x64')])]};if(_0x1059da['query']['type']&&_0x1059da['query'][_0x4516('0x32')]===_0x4516('0x53')){_0x5eb227[_0x4516('0x65')]['push']({'uniqueid':_0x1059da[_0x4516('0x4b')]['id']});}else{_0x5eb227[_0x4516('0x65')][_0x4516('0x66')]({'id':_0x1059da[_0x4516('0x4b')]['id']});}return db[_0x4516('0x2f')][_0x4516('0x4d')]({'where':_0x5eb227,'attributes':['id',_0x4516('0x54')],'raw':!![]})[_0x4516('0x26')](handleEntityNotFound(_0x1eff6b,null))['then'](function(_0x2694b5){if(_0x2694b5){var _0x56832d=util[_0x4516('0x55')](_0x4516('0x67'),_0x2694b5[_0x4516('0x54')]);if(fs[_0x4516('0x56')](_0x56832d)){_0xc4b194=!![];return _0x453a3d['decryptFile'](_0x56832d,_0x2694b5['value'],config[_0x4516('0x68')][_0x4516('0x58')])[_0x4516('0x26')](function(){return _0x2694b5;});}return _0x2694b5;}})[_0x4516('0x26')](function(_0x54b88f){if(_0x54b88f){if(!fs[_0x4516('0x56')](_0x54b88f[_0x4516('0x54')])){throw new db[(_0x4516('0x59'))][(_0x4516('0x5a'))](_0x4516('0x5b'));}if(_0x54b88f['filename']){return _0x1eff6b['download'](_0x54b88f[_0x4516('0x54')],_0x54b88f[_0x4516('0x5c')]+path[_0x4516('0x5d')](_0x54b88f[_0x4516('0x54')]),function(){if(_0xc4b194){fs[_0x4516('0x5e')](_0x54b88f[_0x4516('0x54')]);}});}else{return _0x1eff6b[_0x4516('0x51')](_0x54b88f[_0x4516('0x54')],function(_0xdfff1d){if(_0xc4b194){fs['unlink'](_0x54b88f[_0x4516('0x54')]);}});}}})[_0x4516('0x49')](handleError(_0x1eff6b,null));};exports[_0x4516('0x27')]=function(_0x2daa2f,_0x1ccecb){return db['VoiceRecording'][_0x4516('0x4d')]({'where':{'id':_0x2daa2f[_0x4516('0x4b')]['id']}})[_0x4516('0x26')](function(_0x3869e6){if(_[_0x4516('0x69')](_0x3869e6)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3869e6;})['then'](function(_0x2bafbd){var _0x2e8e5a=_0x2bafbd[_0x4516('0x54')];logger[_0x4516('0x6a')](_0x4516('0x6b'),_0x2e8e5a);if(!_[_0x4516('0x69')](_0x2bafbd[_0x4516('0x54')])&&fs[_0x4516('0x56')](_0x2e8e5a)){logger[_0x4516('0x6a')](_0x4516('0x6c')+_0x2e8e5a+_0x4516('0x6d'));fs[_0x4516('0x6e')](_0x2e8e5a);}_0x2e8e5a=_0x2e8e5a+_0x4516('0x6f');if(!_[_0x4516('0x69')](_0x2bafbd[_0x4516('0x54')])&&fs['existsSync'](_0x2e8e5a)){logger['info'](_0x4516('0x6c')+_0x2e8e5a+_0x4516('0x6d'));fs[_0x4516('0x6e')](_0x2e8e5a);}return _0x2bafbd;})['then'](function(_0x2a402c){if(!_0x2a402c)throw new InternalError();return _0x2a402c[_0x4516('0x27')]();})[_0x4516('0x26')](function(){_0x1ccecb[_0x4516('0x1b')](0xcc)[_0x4516('0x28')]();})['catch'](handleError(_0x1ccecb,null));};function getBucketslist(_0x482f8d,_0x49cdab,_0x506af8){return new Promise(function(_0x32582f,_0x348c34){var _0x12c01a=new AWS['S3']({'accessKeyId':_0x49cdab,'secretAccessKey':_0x482f8d,'region':_0x506af8});_0x12c01a[_0x4516('0x70')]({},function(_0x53097c,_0x3a4ed9){if(_0x53097c){return _0x348c34(_0x53097c);}else{return _0x32582f(_0x3a4ed9);}});});}function createBucket(_0x12efac,_0x189877,_0x510909,_0x33a9e9){return new Promise(function(_0xb8bacd,_0x205b0e){var _0x4ca57c=new AWS['S3']({'accessKeyId':_0x189877,'secretAccessKey':_0x12efac,'region':_0x510909});_0x4ca57c[_0x4516('0x71')]({'Bucket':_0x33a9e9},function(_0x1efd7d,_0x4126be){if(_0x1efd7d){return _0x205b0e(_0x1efd7d);}else{return _0xb8bacd(_0x4126be);}});});}function uploadFile(_0x1b4519,_0x56ab12,_0x124a22,_0xecbecc,_0x2684e8,_0x4456fd){return new Promise(function(_0x32343e,_0x3e7ca8){var _0x29ccf2=new AWS['S3']({'accessKeyId':_0x56ab12,'secretAccessKey':_0x1b4519,'region':_0x124a22});_0x29ccf2[_0x4516('0x72')]({'Bucket':_0xecbecc,'Key':_0x2684e8,'Body':_0x4456fd},function(_0x1f8ac0,_0x218711){if(_0x1f8ac0){return _0x3e7ca8(_0x1f8ac0);}else{return _0x32343e(_0x218711);}});});}function startTranscribe(_0x11b6af,_0xba416e,_0x1c649f,_0x4e565f,_0x1afd8f,_0x32a6eb){return new Promise(function(_0x59bd6a,_0x14daaf){var _0x223977=new AWS['TranscribeService']({'accessKeyId':_0xba416e,'secretAccessKey':_0x11b6af,'region':_0x1c649f});_0x223977[_0x4516('0x73')]({'TranscriptionJobName':_0x4e565f,'LanguageCode':_0x1afd8f,'Media':{'MediaFileUri':_0x32a6eb}},function(_0x367f00,_0x4a962e){if(_0x367f00){return _0x14daaf(_0x367f00);}else{return _0x59bd6a(_0x4a962e);}});});}function transcribe(_0x3451b4,_0x58daf4,_0x5b8079,_0xf4df44,_0x26338d,_0x2b54df,_0x294deb){return new Promise(function(_0x5d239f,_0x2412d5){var _0x3d0784={};logger[_0x4516('0x6a')](util[_0x4516('0x55')](_0x4516('0x74'),_0x3451b4,_0x26338d));return uploadFile(_0x58daf4,_0x5b8079,_0xf4df44,_0x26338d,path[_0x4516('0x75')](_0x2b54df),fs[_0x4516('0x76')](_0x2b54df))['then'](function(_0x3cc46c){logger[_0x4516('0x6a')](util['format'](_0x4516('0x77'),_0x3451b4,_0x26338d,_0x3cc46c['Location']));_0x3d0784[_0x4516('0x78')]=_0x3cc46c[_0x4516('0x79')];_0x3d0784['location']=_0x3cc46c[_0x4516('0x7a')];logger[_0x4516('0x6a')](util[_0x4516('0x55')](_0x4516('0x7b'),_0x3451b4));return startTranscribe(_0x58daf4,_0x5b8079,_0xf4df44,uuidv4(),_0x294deb,_0x3cc46c[_0x4516('0x7a')]);})[_0x4516('0x26')](function(_0x5aa85f){logger[_0x4516('0x6a')](util['format'](_0x4516('0x7c'),_0x3451b4,_0x5aa85f['TranscriptionJob'][_0x4516('0x7d')]));_0x3d0784[_0x4516('0x7e')]=_0x5aa85f[_0x4516('0x7f')]['TranscriptionJobName'];_0x3d0784[_0x4516('0x80')]=_0x5aa85f[_0x4516('0x7f')][_0x4516('0x81')];return _0x5d239f(_0x3d0784);})[_0x4516('0x49')](function(_0x2ca2b8){return _0x2412d5(_0x2ca2b8);});});}exports[_0x4516('0x82')]=function(_0x58d659,_0x576974,_0x511b1a){var _0x1e37c7;var _0x46b8be;var _0x14e0e1;var _0x41d700=require('../../components/encryptor');return db[_0x4516('0x2f')][_0x4516('0x83')]({'where':{'id':_0x58d659[_0x4516('0x4b')]['id']}})['then'](function(_0x3402a8){if(_0x3402a8){var _0xcb5826=util[_0x4516('0x55')](_0x4516('0x67'),_0x3402a8[_0x4516('0x54')]);if(fs[_0x4516('0x56')](_0xcb5826)){cypher=!![];return _0x41d700[_0x4516('0x57')](_0xcb5826,_0x3402a8['value'],config[_0x4516('0x68')][_0x4516('0x58')])[_0x4516('0x26')](function(){return _0x3402a8;});}return _0x3402a8;}})[_0x4516('0x26')](function(_0x2bd30a){if(!_0x2bd30a){throw new db[(_0x4516('0x59'))]['ValidationError'](_0x4516('0x84'));}_0x46b8be=_0x2bd30a;return db[_0x4516('0x85')][_0x4516('0x83')]({'where':{'id':0x1}});})[_0x4516('0x26')](handleEntityNotFound(_0x576974,null))[_0x4516('0x26')](function(_0x15ebdb){if(_0x15ebdb){_0x1e37c7=_0x15ebdb;if(!_0x1e37c7['transcribe']||!_0x1e37c7['transcribeAccountId']||!_0x1e37c7[_0x4516('0x86')]||!_0x1e37c7[_0x4516('0x87')]||!_0x1e37c7['bucket']){throw new db[(_0x4516('0x59'))][(_0x4516('0x5a'))](_0x4516('0x88'));}if(_0x58d659[_0x4516('0x4f')][_0x4516('0x89')]&&(!_0x1e37c7[_0x4516('0x8a')]||!_0x1e37c7[_0x4516('0x8b')]||!_0x1e37c7[_0x4516('0x8c')]||!_0x1e37c7[_0x4516('0x87')]||!_0x1e37c7[_0x4516('0x78')])){throw new db[(_0x4516('0x59'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x4516('0x8d')][_0x4516('0x83')]({'where':{'id':_0x1e37c7[_0x4516('0x8e')]}});}})[_0x4516('0x26')](function(_0x5b6eff){if(!_0x5b6eff){throw new db[(_0x4516('0x59'))][(_0x4516('0x5a'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5b6eff[_0x4516('0x8f')]||!_0x5b6eff[_0x4516('0x90')]){throw new db[(_0x4516('0x59'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x14e0e1=_0x5b6eff;return getBucketslist(_0x14e0e1['data1'],_0x14e0e1['data2'],_0x1e37c7[_0x4516('0x86')]);})['then'](function(_0x1f9de8){if(_0x1f9de8&&_0x1f9de8[_0x4516('0x91')]){var _0x17a083=_[_0x4516('0x4d')](_0x1f9de8[_0x4516('0x91')],function(_0x56fd2b){return _0x56fd2b[_0x4516('0x92')]===_0x1e37c7[_0x4516('0x78')];});if(!_0x17a083){logger['info'](util[_0x4516('0x55')](_0x4516('0x93'),_0x58d659[_0x4516('0x4b')]['id'],_0x1e37c7['bucket']));return createBucket(_0x14e0e1['data1'],_0x14e0e1[_0x4516('0x90')],_0x1e37c7[_0x4516('0x86')],_0x1e37c7['bucket']);}logger[_0x4516('0x6a')](util[_0x4516('0x55')](_0x4516('0x94'),_0x58d659[_0x4516('0x4b')]['id'],_0x1e37c7[_0x4516('0x78')]));return;}})[_0x4516('0x26')](function(_0x471ea7){if(_0x46b8be[_0x4516('0x80')]===_0x4516('0x95')){return transcribe(_0x58d659[_0x4516('0x4b')]['id'],_0x14e0e1['data1'],_0x14e0e1['data2'],_0x1e37c7[_0x4516('0x86')],_0x1e37c7[_0x4516('0x78')],_0x46b8be[_0x4516('0x54')],_0x1e37c7[_0x4516('0x87')]);}else{logger[_0x4516('0x6a')](util[_0x4516('0x55')](_0x4516('0x96'),_0x58d659[_0x4516('0x4b')]['id']));return{'transcribeStatus':_0x4516('0x97')};}})[_0x4516('0x26')](function(_0x1279bf){if(_0x1279bf){_0x1279bf[_0x4516('0x98')]=_0x58d659[_0x4516('0x4f')][_0x4516('0x89')];return _0x46b8be[_0x4516('0x99')](_0x1279bf);}})[_0x4516('0x26')](respondWithResult(_0x576974,null))[_0x4516('0x49')](handleError(_0x576974,null));};function writeFile(_0x152c5c,_0x59d3c8){return new Promise(function(_0x14fb5d,_0x5734cb){fs['writeFile'](_0x59d3c8,_0x152c5c,function(_0x3c9afa,_0x51fe87){if(_0x3c9afa){return _0x5734cb(_0x3c9afa);}else{return _0x14fb5d(_0x51fe87);}});});}exports['downloadTranscribe']=function(_0x44cd30,_0x513f26,_0x18e33a){return db[_0x4516('0x2f')][_0x4516('0x83')]({'where':{'id':_0x44cd30[_0x4516('0x4b')]['id']}})['then'](handleEntityNotFound(_0x513f26))[_0x4516('0x26')](function(_0xbc1761){if(_0xbc1761&&_0xbc1761['fileText']){var _0x54f4f0=_0xbc1761[_0x4516('0x9a')];var _0x3dec3a=config[_0x4516('0x9b')]+_0x4516('0x9c')+_0xbc1761['id']+_0x4516('0x9d');if(fs[_0x4516('0x56')](_0x3dec3a)){return _0x3dec3a;}return writeFile(_0x54f4f0,_0x3dec3a)[_0x4516('0x26')](function(){return _0x3dec3a;});}else{throw new db[(_0x4516('0x59'))][(_0x4516('0x5a'))](_0x4516('0x9e'));}})[_0x4516('0x26')](function(_0x291430){return _0x513f26['download'](_0x291430);})[_0x4516('0x49')](handleError(_0x513f26));}; \ No newline at end of file +var _0x667f=['location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','findOne','Setting','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','data1','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','map','VoiceRecording','rawAttributes','type','key','model','differenceBy','format','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys','length','options','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','sequelize','col','token','$and','push','extname','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket'];(function(_0x4d2c83,_0x12b17f){var _0x28b486=function(_0x4ee751){while(--_0x4ee751){_0x4d2c83['push'](_0x4d2c83['shift']());}};_0x28b486(++_0x12b17f);}(_0x667f,0x153));var _0xf667=function(_0x57b432,_0x4a6aff){_0x57b432=_0x57b432-0x0;var _0x1e6e45=_0x667f[_0x57b432];return _0x1e6e45;};'use strict';var emlformat=require(_0xf667('0x0'));var rimraf=require(_0xf667('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf667('0x2'));var rp=require(_0xf667('0x3'));var moment=require(_0xf667('0x4'));var BPromise=require(_0xf667('0x5'));var Mustache=require(_0xf667('0x6'));var util=require(_0xf667('0x7'));var path=require(_0xf667('0x8'));var sox=require(_0xf667('0x9'));var csv=require(_0xf667('0xa'));var ejs=require(_0xf667('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf667('0xc'));var jsforce=require(_0xf667('0xd'));var deskjs=require(_0xf667('0xe'));var toCsv=require(_0xf667('0xa'));var querystring=require(_0xf667('0xf'));var Papa=require(_0xf667('0x10'));var AWS=require(_0xf667('0x11'));var uuidv4=require(_0xf667('0x12'));var Redis=require(_0xf667('0x13'));var authService=require(_0xf667('0x14'));var qs=require(_0xf667('0x15'));var as=require(_0xf667('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf667('0x17'))(_0xf667('0x18'));var utils=require(_0xf667('0x19'));var config=require(_0xf667('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xf667('0x1b'))['db'];function respondWithStatusCode(_0x22be61,_0x3c9c42){_0x3c9c42=_0x3c9c42||0xcc;return function(_0x20ceac){if(_0x20ceac){return _0x22be61['sendStatus'](_0x3c9c42);}return _0x22be61[_0xf667('0x1c')](_0x3c9c42)['end']();};}function respondWithResult(_0x32d766,_0x3b57e3){_0x3b57e3=_0x3b57e3||0xc8;return function(_0x570388){if(_0x570388){return _0x32d766[_0xf667('0x1c')](_0x3b57e3)['json'](_0x570388);}};}function respondWithFilteredResult(_0x38edc1,_0x70721f){return function(_0x54f5c8){if(_0x54f5c8){var _0x5607d3=typeof _0x70721f['offset']===_0xf667('0x1d')&&typeof _0x70721f[_0xf667('0x1e')]===_0xf667('0x1d');var _0x377ae3=_0x54f5c8[_0xf667('0x1f')];var _0x16911f=_0x5607d3?0x0:_0x70721f['offset'];var _0x152dad=_0x5607d3?_0x54f5c8[_0xf667('0x1f')]:_0x70721f[_0xf667('0x20')]+_0x70721f[_0xf667('0x1e')];var _0xb59b58;if(_0x152dad>=_0x377ae3){_0x152dad=_0x377ae3;_0xb59b58=0xc8;}else{_0xb59b58=0xce;}_0x38edc1['status'](_0xb59b58);return _0x38edc1[_0xf667('0x21')](_0xf667('0x22'),_0x16911f+'-'+_0x152dad+'/'+_0x377ae3)['json'](_0x54f5c8);}return null;};}function patchUpdates(_0x1f3f33){return function(_0x4ecce7){try{jsonpatch['apply'](_0x4ecce7,_0x1f3f33,!![]);}catch(_0x52a074){return BPromise[_0xf667('0x23')](_0x52a074);}return _0x4ecce7[_0xf667('0x24')]();};}function saveUpdates(_0x3e4d32,_0x1c6eec){return function(_0x4cceae){if(_0x4cceae){return _0x4cceae[_0xf667('0x25')](_0x3e4d32)[_0xf667('0x26')](function(_0x271733){return _0x271733;});}return null;};}function removeEntity(_0x1e4da6,_0x1d22b5){return function(_0x585ce3){if(_0x585ce3){return _0x585ce3[_0xf667('0x27')]()['then'](function(){_0x1e4da6[_0xf667('0x1c')](0xcc)[_0xf667('0x28')]();});}};}function handleEntityNotFound(_0x3f84c0,_0x7c5ff7){return function(_0xf743ad){if(!_0xf743ad){_0x3f84c0[_0xf667('0x29')](0x194);}return _0xf743ad;};}function handleError(_0x41c00f,_0x3301c0){_0x3301c0=_0x3301c0||0x1f4;return function(_0x45264a){logger['error'](_0x45264a[_0xf667('0x2a')]);if(_0x45264a[_0xf667('0x2b')]){delete _0x45264a[_0xf667('0x2b')];}_0x41c00f[_0xf667('0x1c')](_0x3301c0)[_0xf667('0x2c')](_0x45264a);};}exports[_0xf667('0x2d')]=function(_0x41646f,_0x550e82){var _0x44ac03={},_0x4d7ac8={},_0x56da97={'count':0x0,'rows':[]};var _0x3e3c53=_[_0xf667('0x2e')](db[_0xf667('0x2f')][_0xf667('0x30')],function(_0x28f0ea){return{'name':_0x28f0ea['fieldName'],'type':_0x28f0ea[_0xf667('0x31')][_0xf667('0x32')]};});_0x4d7ac8[_0xf667('0x33')]=_[_0xf667('0x34')](_[_0xf667('0x2e')](_0x3e3c53,_0xf667('0x2b')),[_0xf667('0x35')]);_0x4d7ac8['query']=_['keys'](_0x41646f[_0xf667('0x36')]);_0x4d7ac8[_0xf667('0x37')]=_['intersection'](_0x4d7ac8[_0xf667('0x33')],_0x4d7ac8[_0xf667('0x36')]);_0x44ac03[_0xf667('0x38')]=_[_0xf667('0x39')](_0x4d7ac8['model'],qs['fields'](_0x41646f[_0xf667('0x36')][_0xf667('0x3a')]));_0x44ac03['attributes']=_0x44ac03[_0xf667('0x38')]['length']?_0x44ac03[_0xf667('0x38')]:_0x4d7ac8[_0xf667('0x33')];if(!_0x41646f[_0xf667('0x36')][_0xf667('0x3b')](_0xf667('0x3c'))){_0x44ac03[_0xf667('0x1e')]=qs[_0xf667('0x1e')](_0x41646f[_0xf667('0x36')][_0xf667('0x1e')]);_0x44ac03[_0xf667('0x20')]=qs[_0xf667('0x20')](_0x41646f[_0xf667('0x36')][_0xf667('0x20')]);}_0x44ac03[_0xf667('0x3d')]=qs[_0xf667('0x3e')](_0x41646f['query']['sort']);_0x44ac03[_0xf667('0x3f')]=qs['filters'](_[_0xf667('0x40')](_0x41646f[_0xf667('0x36')],_0x4d7ac8[_0xf667('0x37')]),_0x3e3c53);if(_0x41646f[_0xf667('0x36')][_0xf667('0x41')]){_0x44ac03[_0xf667('0x3f')]=_['merge'](_0x44ac03['where'],{'$or':_[_0xf667('0x2e')](_0x3e3c53,function(_0xd6d3c7){if(_0xd6d3c7[_0xf667('0x31')]!==_0xf667('0x42')){var _0x1dfcad={};_0x1dfcad[_0xd6d3c7[_0xf667('0x2b')]]={'$like':'%'+_0x41646f[_0xf667('0x36')][_0xf667('0x41')]+'%'};return _0x1dfcad;}})});}_0x44ac03=_[_0xf667('0x43')]({},_0x44ac03,_0x41646f['options']);var _0x20358c={'where':_0x44ac03[_0xf667('0x3f')]};return db[_0xf667('0x2f')][_0xf667('0x1f')](_0x20358c)[_0xf667('0x26')](function(_0x210108){_0x56da97[_0xf667('0x1f')]=_0x210108;if(_0x41646f[_0xf667('0x36')][_0xf667('0x44')]){_0x44ac03[_0xf667('0x45')]=[{'all':!![]}];}return db[_0xf667('0x2f')][_0xf667('0x46')](_0x44ac03);})[_0xf667('0x26')](function(_0x60802b){_0x56da97[_0xf667('0x47')]=_0x60802b;return _0x56da97;})[_0xf667('0x26')](respondWithFilteredResult(_0x550e82,_0x44ac03))[_0xf667('0x48')](handleError(_0x550e82,null));};exports[_0xf667('0x49')]=function(_0x588458,_0x58040e){var _0x1f0318={'raw':![],'where':{'id':_0x588458[_0xf667('0x4a')]['id']}},_0x329cf5={};_0x329cf5[_0xf667('0x33')]=_[_0xf667('0x4b')](db[_0xf667('0x2f')][_0xf667('0x30')]);_0x329cf5[_0xf667('0x36')]=_[_0xf667('0x4b')](_0x588458[_0xf667('0x36')]);_0x329cf5[_0xf667('0x37')]=_[_0xf667('0x39')](_0x329cf5[_0xf667('0x33')],_0x329cf5[_0xf667('0x36')]);_0x1f0318[_0xf667('0x38')]=_[_0xf667('0x39')](_0x329cf5[_0xf667('0x33')],qs[_0xf667('0x3a')](_0x588458['query'][_0xf667('0x3a')]));_0x1f0318[_0xf667('0x38')]=_0x1f0318[_0xf667('0x38')][_0xf667('0x4c')]?_0x1f0318[_0xf667('0x38')]:_0x329cf5[_0xf667('0x33')];if(_0x588458[_0xf667('0x36')][_0xf667('0x44')]){_0x1f0318[_0xf667('0x45')]=[{'all':!![]}];}_0x1f0318=_[_0xf667('0x43')]({},_0x1f0318,_0x588458[_0xf667('0x4d')]);return db[_0xf667('0x2f')][_0xf667('0x4e')](_0x1f0318)[_0xf667('0x26')](handleEntityNotFound(_0x58040e,null))[_0xf667('0x26')](respondWithResult(_0x58040e,null))[_0xf667('0x48')](handleError(_0x58040e,null));};exports[_0xf667('0x4f')]=function(_0x3fe5bb,_0x6c3641){return db[_0xf667('0x2f')]['create'](_0x3fe5bb[_0xf667('0x50')],{})['then'](respondWithResult(_0x6c3641,0xc9))[_0xf667('0x48')](handleError(_0x6c3641,null));};exports['update']=function(_0x811319,_0x515fad){if(_0x811319[_0xf667('0x50')]['id']){delete _0x811319[_0xf667('0x50')]['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x811319['params']['id']}})[_0xf667('0x26')](handleEntityNotFound(_0x515fad,null))[_0xf667('0x26')](saveUpdates(_0x811319[_0xf667('0x50')],null))['then'](respondWithResult(_0x515fad,null))[_0xf667('0x48')](handleError(_0x515fad,null));};exports['describe']=function(_0xd9894a,_0x8bdf20){return db['VoiceRecording'][_0xf667('0x51')]()[_0xf667('0x26')](respondWithResult(_0x8bdf20,null))[_0xf667('0x48')](handleError(_0x8bdf20,null));};exports[_0xf667('0x52')]=function(_0x198df3,_0x38585c,_0x2768c7){var _0x37f07b=require(_0xf667('0x53'));var _0xda06e4=![];var _0x19c757={};if(_0x198df3['query'][_0xf667('0x31')]&&_0x198df3[_0xf667('0x36')][_0xf667('0x31')]===_0xf667('0x54')){_0x19c757[_0xf667('0x54')]=_0x198df3['params']['id'];}else{_0x19c757['id']=_0x198df3['params']['id'];}return db[_0xf667('0x2f')][_0xf667('0x4e')]({'where':_0x19c757,'attributes':['id',_0xf667('0x55')],'raw':!![]})[_0xf667('0x26')](handleEntityNotFound(_0x38585c,null))['then'](function(_0x112c05){if(_0x112c05){var _0x1f531a=_0x112c05[_0xf667('0x55')];var _0x30212e=util['format'](_0xf667('0x56'),_0x1f531a);if(fs[_0xf667('0x57')](_0x30212e)){_0xda06e4=!![];return _0x37f07b[_0xf667('0x58')](_0x30212e,_0x1f531a,config[_0xf667('0x59')][_0xf667('0x5a')])[_0xf667('0x26')](function(){return _0x112c05;});}return _0x112c05;}})['then'](function(_0x382414){if(_0x382414){var _0x25b67d=_0x382414[_0xf667('0x55')];if(!fs[_0xf667('0x57')](_0x25b67d)){throw new db[(_0xf667('0x5b'))][(_0xf667('0x5c'))](_0xf667('0x5d'));}if(_0x382414[_0xf667('0x5e')]){return _0x38585c[_0xf667('0x52')](_0x25b67d,_0x382414[_0xf667('0x5e')]+path['extname'](_0x25b67d),function(){if(_0xda06e4){fs[_0xf667('0x5f')](_0x25b67d);}});}else{return _0x38585c['download'](_0x25b67d,function(_0x3b5f37){if(_0xda06e4){fs[_0xf667('0x5f')](_0x25b67d);}});}}})['catch'](function(_0x4e603a){if(_0x4e603a[_0xf667('0x60')]==='VoiceRecording\x20not\x20found'){_0x38585c[_0xf667('0x1c')](0x194)[_0xf667('0x2c')](_0xf667('0x61'));}else{return handleError(_0x38585c,null);}});};exports[_0xf667('0x62')]=function(_0x4e9c78,_0x1b1759,_0x25160d){var _0x58681b=require(_0xf667('0x53'));var _0x390a45=![];var _0x58681d={'$and':[db[_0xf667('0x63')][_0xf667('0x3f')](db[_0xf667('0x63')]['fn']('MD5',db[_0xf667('0x63')][_0xf667('0x64')](_0xf667('0x54'))),_0x4e9c78['query'][_0xf667('0x65')])]};if(_0x4e9c78[_0xf667('0x36')]['type']&&_0x4e9c78[_0xf667('0x36')][_0xf667('0x31')]===_0xf667('0x54')){_0x58681d[_0xf667('0x66')][_0xf667('0x67')]({'uniqueid':_0x4e9c78[_0xf667('0x4a')]['id']});}else{_0x58681d[_0xf667('0x66')][_0xf667('0x67')]({'id':_0x4e9c78[_0xf667('0x4a')]['id']});}return db[_0xf667('0x2f')]['find']({'where':_0x58681d,'attributes':['id',_0xf667('0x55')],'raw':!![]})[_0xf667('0x26')](handleEntityNotFound(_0x1b1759,null))[_0xf667('0x26')](function(_0x342a84){if(_0x342a84){var _0x59e44c=util[_0xf667('0x35')](_0xf667('0x56'),_0x342a84[_0xf667('0x55')]);if(fs[_0xf667('0x57')](_0x59e44c)){_0x390a45=!![];return _0x58681b[_0xf667('0x58')](_0x59e44c,_0x342a84['value'],config[_0xf667('0x59')][_0xf667('0x5a')])['then'](function(){return _0x342a84;});}return _0x342a84;}})[_0xf667('0x26')](function(_0x36b123){if(_0x36b123){if(!fs['existsSync'](_0x36b123[_0xf667('0x55')])){throw new db[(_0xf667('0x5b'))][(_0xf667('0x5c'))]('VoiceRecording\x20not\x20found');}if(_0x36b123[_0xf667('0x5e')]){return _0x1b1759[_0xf667('0x52')](_0x36b123['value'],_0x36b123[_0xf667('0x5e')]+path[_0xf667('0x68')](_0x36b123[_0xf667('0x55')]),function(){if(_0x390a45){fs[_0xf667('0x5f')](_0x36b123[_0xf667('0x55')]);}});}else{return _0x1b1759[_0xf667('0x52')](_0x36b123[_0xf667('0x55')],function(_0x357016){if(_0x390a45){fs[_0xf667('0x5f')](_0x36b123[_0xf667('0x55')]);}});}}})['catch'](handleError(_0x1b1759,null));};exports[_0xf667('0x27')]=function(_0x3e45b7,_0x452f63){return db['VoiceRecording'][_0xf667('0x4e')]({'where':{'id':_0x3e45b7[_0xf667('0x4a')]['id']}})[_0xf667('0x26')](function(_0x58f5c5){if(_['isNil'](_0x58f5c5)){throw new ReferenceError('Entity\x20not\x20found');}return _0x58f5c5;})[_0xf667('0x26')](function(_0x506c6c){var _0x1da864=_0x506c6c['value'];logger[_0xf667('0x69')]('cancellazione\x20fisica\x20documento\x20%s',_0x1da864);if(!_[_0xf667('0x6a')](_0x506c6c[_0xf667('0x55')])&&fs[_0xf667('0x57')](_0x1da864)){logger['info'](_0xf667('0x6b')+_0x1da864+_0xf667('0x6c'));fs[_0xf667('0x6d')](_0x1da864);}_0x1da864=_0x1da864+_0xf667('0x6e');if(!_[_0xf667('0x6a')](_0x506c6c[_0xf667('0x55')])&&fs[_0xf667('0x57')](_0x1da864)){logger[_0xf667('0x69')](_0xf667('0x6b')+_0x1da864+_0xf667('0x6c'));fs[_0xf667('0x6d')](_0x1da864);}return _0x506c6c;})['then'](function(_0x4d82c7){if(!_0x4d82c7)throw new InternalError();return _0x4d82c7['destroy']();})[_0xf667('0x26')](function(){_0x452f63[_0xf667('0x1c')](0xcc)['end']();})[_0xf667('0x48')](handleError(_0x452f63,null));};function getBucketslist(_0x1a9aa3,_0x3ba73d,_0x4d027d){return new Promise(function(_0x5d8f7e,_0x272d9f){var _0x3546b7=new AWS['S3']({'accessKeyId':_0x3ba73d,'secretAccessKey':_0x1a9aa3,'region':_0x4d027d});_0x3546b7[_0xf667('0x6f')]({},function(_0x3f79b4,_0x5101bc){if(_0x3f79b4){return _0x272d9f(_0x3f79b4);}else{return _0x5d8f7e(_0x5101bc);}});});}function createBucket(_0x1dbe38,_0x2826e9,_0x54e80a,_0x48b87c){return new Promise(function(_0x36f5bd,_0x20b108){var _0x1d0194=new AWS['S3']({'accessKeyId':_0x2826e9,'secretAccessKey':_0x1dbe38,'region':_0x54e80a});_0x1d0194['createBucket']({'Bucket':_0x48b87c},function(_0x19932a,_0x822c8e){if(_0x19932a){return _0x20b108(_0x19932a);}else{return _0x36f5bd(_0x822c8e);}});});}function uploadFile(_0x26692f,_0x327f93,_0x34a8da,_0xcd6420,_0x50b1c9,_0x1a9c5d){return new Promise(function(_0x1939ec,_0x457e40){var _0x1df576=new AWS['S3']({'accessKeyId':_0x327f93,'secretAccessKey':_0x26692f,'region':_0x34a8da});_0x1df576[_0xf667('0x70')]({'Bucket':_0xcd6420,'Key':_0x50b1c9,'Body':_0x1a9c5d},function(_0x4dd74e,_0x3badd4){if(_0x4dd74e){return _0x457e40(_0x4dd74e);}else{return _0x1939ec(_0x3badd4);}});});}function startTranscribe(_0x463899,_0x6e8b7e,_0x45e99c,_0x257dfe,_0x445c3f,_0x1834f5){return new Promise(function(_0x19a977,_0x4d561e){var _0x48e70c=new AWS[(_0xf667('0x71'))]({'accessKeyId':_0x6e8b7e,'secretAccessKey':_0x463899,'region':_0x45e99c});_0x48e70c['startTranscriptionJob']({'TranscriptionJobName':_0x257dfe,'LanguageCode':_0x445c3f,'Media':{'MediaFileUri':_0x1834f5}},function(_0x4a4224,_0x432a66){if(_0x4a4224){return _0x4d561e(_0x4a4224);}else{return _0x19a977(_0x432a66);}});});}function transcribe(_0x921e66,_0x1e90b9,_0x140c2d,_0x384741,_0x5cb7c4,_0x3c5286,_0x45b810){return new Promise(function(_0xb9c13f,_0x309096){var _0x281015={};logger['info'](util[_0xf667('0x35')](_0xf667('0x72'),_0x921e66,_0x5cb7c4));return uploadFile(_0x1e90b9,_0x140c2d,_0x384741,_0x5cb7c4,path[_0xf667('0x73')](_0x3c5286),fs['readFileSync'](_0x3c5286))['then'](function(_0x235cc3){logger['info'](util[_0xf667('0x35')](_0xf667('0x74'),_0x921e66,_0x5cb7c4,_0x235cc3[_0xf667('0x75')]));_0x281015[_0xf667('0x76')]=_0x235cc3[_0xf667('0x77')];_0x281015[_0xf667('0x78')]=_0x235cc3[_0xf667('0x75')];logger[_0xf667('0x69')](util['format'](_0xf667('0x79'),_0x921e66));return startTranscribe(_0x1e90b9,_0x140c2d,_0x384741,uuidv4(),_0x45b810,_0x235cc3[_0xf667('0x75')]);})[_0xf667('0x26')](function(_0x4af3e3){logger[_0xf667('0x69')](util[_0xf667('0x35')](_0xf667('0x7a'),_0x921e66,_0x4af3e3[_0xf667('0x7b')][_0xf667('0x7c')]));_0x281015[_0xf667('0x7d')]=_0x4af3e3['TranscriptionJob'][_0xf667('0x7c')];_0x281015[_0xf667('0x7e')]=_0x4af3e3[_0xf667('0x7b')][_0xf667('0x7f')];return _0xb9c13f(_0x281015);})['catch'](function(_0x11e8d2){return _0x309096(_0x11e8d2);});});}exports['runTranscribe']=function(_0x34812a,_0x26f089,_0x238fb9){var _0x17663b;var _0x349fd6;var _0x219fa3;var _0x37de57=require(_0xf667('0x53'));return db['VoiceRecording'][_0xf667('0x80')]({'where':{'id':_0x34812a['params']['id']}})['then'](function(_0x20360d){if(_0x20360d){var _0x5b063e=util[_0xf667('0x35')]('%s.cypher',_0x20360d[_0xf667('0x55')]);if(fs[_0xf667('0x57')](_0x5b063e)){cypher=!![];return _0x37de57[_0xf667('0x58')](_0x5b063e,_0x20360d[_0xf667('0x55')],config[_0xf667('0x59')][_0xf667('0x5a')])[_0xf667('0x26')](function(){return _0x20360d;});}return _0x20360d;}})[_0xf667('0x26')](function(_0x5a320e){if(!_0x5a320e){throw new db[(_0xf667('0x5b'))][(_0xf667('0x5c'))]('Voice\x20Recording\x20not\x20found');}_0x349fd6=_0x5a320e;return db[_0xf667('0x81')]['findOne']({'where':{'id':0x1}});})[_0xf667('0x26')](handleEntityNotFound(_0x26f089,null))[_0xf667('0x26')](function(_0x380e31){if(_0x380e31){_0x17663b=_0x380e31;if(!_0x17663b['transcribe']||!_0x17663b[_0xf667('0x82')]||!_0x17663b[_0xf667('0x83')]||!_0x17663b[_0xf667('0x84')]||!_0x17663b[_0xf667('0x76')]){throw new db['Sequelize'][(_0xf667('0x5c'))](_0xf667('0x85'));}if(_0x34812a[_0xf667('0x50')][_0xf667('0x86')]&&(!_0x17663b['sentiment']||!_0x17663b[_0xf667('0x87')]||!_0x17663b[_0xf667('0x88')]||!_0x17663b[_0xf667('0x84')]||!_0x17663b[_0xf667('0x76')])){throw new db[(_0xf667('0x5b'))][(_0xf667('0x5c'))](_0xf667('0x89'));}return db['CloudProvider']['findOne']({'where':{'id':_0x17663b[_0xf667('0x82')]}});}})[_0xf667('0x26')](function(_0x5b1b5d){if(!_0x5b1b5d){throw new db['Sequelize'][(_0xf667('0x5c'))](_0xf667('0x8a'));}if(!_0x5b1b5d['data1']||!_0x5b1b5d['data2']){throw new db[(_0xf667('0x5b'))][(_0xf667('0x5c'))](_0xf667('0x8b'));}_0x219fa3=_0x5b1b5d;return getBucketslist(_0x219fa3['data1'],_0x219fa3[_0xf667('0x8c')],_0x17663b['transcribeRegion']);})['then'](function(_0x1c466f){if(_0x1c466f&&_0x1c466f['Buckets']){var _0x4a6334=_[_0xf667('0x4e')](_0x1c466f[_0xf667('0x8d')],function(_0x47abe8){return _0x47abe8[_0xf667('0x8e')]===_0x17663b[_0xf667('0x76')];});if(!_0x4a6334){logger[_0xf667('0x69')](util['format'](_0xf667('0x8f'),_0x34812a[_0xf667('0x4a')]['id'],_0x17663b[_0xf667('0x76')]));return createBucket(_0x219fa3['data1'],_0x219fa3[_0xf667('0x8c')],_0x17663b['transcribeRegion'],_0x17663b[_0xf667('0x76')]);}logger['info'](util[_0xf667('0x35')](_0xf667('0x90'),_0x34812a[_0xf667('0x4a')]['id'],_0x17663b[_0xf667('0x76')]));return;}})['then'](function(_0x415d62){if(_0x349fd6[_0xf667('0x7e')]===_0xf667('0x91')){return transcribe(_0x34812a[_0xf667('0x4a')]['id'],_0x219fa3[_0xf667('0x92')],_0x219fa3[_0xf667('0x8c')],_0x17663b[_0xf667('0x83')],_0x17663b[_0xf667('0x76')],_0x349fd6[_0xf667('0x55')],_0x17663b[_0xf667('0x84')]);}else{logger[_0xf667('0x69')](util['format'](_0xf667('0x93'),_0x34812a[_0xf667('0x4a')]['id']));return{'transcribeStatus':_0xf667('0x94')};}})['then'](function(_0x2ce34b){if(_0x2ce34b){_0x2ce34b[_0xf667('0x95')]=_0x34812a[_0xf667('0x50')][_0xf667('0x86')];return _0x349fd6[_0xf667('0x96')](_0x2ce34b);}})['then'](respondWithResult(_0x26f089,null))[_0xf667('0x48')](handleError(_0x26f089,null));};function writeFile(_0x21bdf3,_0x267700){return new Promise(function(_0x1b6319,_0x2c7f19){fs['writeFile'](_0x267700,_0x21bdf3,function(_0x503733,_0x5e91bd){if(_0x503733){return _0x2c7f19(_0x503733);}else{return _0x1b6319(_0x5e91bd);}});});}exports['downloadTranscribe']=function(_0x826828,_0x1af570,_0x4047df){return db[_0xf667('0x2f')][_0xf667('0x80')]({'where':{'id':_0x826828['params']['id']}})[_0xf667('0x26')](handleEntityNotFound(_0x1af570))[_0xf667('0x26')](function(_0x42d3fb){if(_0x42d3fb&&_0x42d3fb['fileText']){var _0x687769=_0x42d3fb['fileText'];var _0x5c324f=config['root']+_0xf667('0x97')+_0x42d3fb['id']+_0xf667('0x98');if(fs[_0xf667('0x57')](_0x5c324f)){return _0x5c324f;}return writeFile(_0x687769,_0x5c324f)[_0xf667('0x26')](function(){return _0x5c324f;});}else{throw new db[(_0xf667('0x5b'))]['ValidationError']('Transcript\x20not\x20available');}})[_0xf667('0x26')](function(_0x3a6c66){return _0x1af570[_0xf667('0x52')](_0x3a6c66);})[_0xf667('0x48')](handleError(_0x1af570));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 5fa2754..78ae70c 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 _0xfc65=['define','VoiceRecording','voice_recordings','uniqueid','./voiceRecording.attributes','exports'];(function(_0x378b4,_0x5ca7fa){var _0x11d07b=function(_0x35d420){while(--_0x35d420){_0x378b4['push'](_0x378b4['shift']());}};_0x11d07b(++_0x5ca7fa);}(_0xfc65,0x1b4));var _0x5fc6=function(_0x2d2525,_0x538a4e){_0x2d2525=_0x2d2525-0x0;var _0x2c9a86=_0xfc65[_0x2d2525];return _0x2c9a86;};'use strict';var attributes=require(_0x5fc6('0x0'));module[_0x5fc6('0x1')]=function(_0xf3a57b,_0x469799){return _0xf3a57b[_0x5fc6('0x2')](_0x5fc6('0x3'),attributes,{'tableName':_0x5fc6('0x4'),'paranoid':![],'indexes':[{'name':_0x5fc6('0x5'),'fields':[_0x5fc6('0x5')]},{'name':'transcribeStatus','fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0x25b0=['define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x1d1cc2,_0x38d11b){var _0x10d113=function(_0x3bec11){while(--_0x3bec11){_0x1d1cc2['push'](_0x1d1cc2['shift']());}};_0x10d113(++_0x38d11b);}(_0x25b0,0x140));var _0x025b=function(_0x81f000,_0x15df85){_0x81f000=_0x81f000-0x0;var _0x337aa2=_0x25b0[_0x81f000];return _0x337aa2;};'use strict';var attributes=require(_0x025b('0x0'));module[_0x025b('0x1')]=function(_0x41b40c,_0xf310aa){return _0x41b40c[_0x025b('0x2')](_0x025b('0x3'),attributes,{'tableName':_0x025b('0x4'),'paranoid':![],'indexes':[{'name':_0x025b('0x5'),'fields':[_0x025b('0x5')]},{'name':_0x025b('0x6'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index f213b94..7863be3 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 _0x8ace=['VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','options','raw','where','attributes','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','create','body','callRecordingEncryption','value','format','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x277721,_0x46971e){var _0x286051=function(_0x130c98){while(--_0x130c98){_0x277721['push'](_0x277721['shift']());}};_0x286051(++_0x46971e);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x2d0bfd,_0x2ba336){_0x2d0bfd=_0x2d0bfd-0x0;var _0x4d806c=_0x8ace[_0x2d0bfd];return _0x4d806c;};'use strict';var _=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var moment=require(_0xe8ac('0x2'));var BPromise=require(_0xe8ac('0x3'));var rs=require(_0xe8ac('0x4'));var fs=require('fs');var Redis=require(_0xe8ac('0x5'));var db=require(_0xe8ac('0x6'))['db'];var utils=require(_0xe8ac('0x7'));var logger=require(_0xe8ac('0x8'))(_0xe8ac('0x9'));var config=require(_0xe8ac('0xa'));var jayson=require(_0xe8ac('0xb'));var client=jayson[_0xe8ac('0xc')][_0xe8ac('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4eb087,_0x2d56f0,_0x1357ed){return new BPromise(function(_0x4f9233,_0x5c83e1){return client[_0xe8ac('0xe')](_0x4eb087,_0x1357ed)['then'](function(_0x1b5467){logger[_0xe8ac('0xf')](_0xe8ac('0x10'),_0x2d56f0,_0xe8ac('0x11'));logger[_0xe8ac('0x12')](_0xe8ac('0x13'),_0x2d56f0,'request\x20sent',JSON[_0xe8ac('0x14')](_0x1b5467));if(_0x1b5467[_0xe8ac('0x15')]){if(_0x1b5467[_0xe8ac('0x15')]['code']===0x1f4){logger[_0xe8ac('0x15')](_0xe8ac('0x10'),_0x2d56f0,_0x1b5467['error'][_0xe8ac('0x16')]);return _0x5c83e1(_0x1b5467[_0xe8ac('0x15')][_0xe8ac('0x16')]);}logger[_0xe8ac('0x15')](_0xe8ac('0x10'),_0x2d56f0,_0x1b5467[_0xe8ac('0x15')][_0xe8ac('0x16')]);return _0x4f9233(_0x1b5467[_0xe8ac('0x15')][_0xe8ac('0x16')]);}else{logger[_0xe8ac('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x2d56f0,_0xe8ac('0x11'));_0x4f9233(_0x1b5467[_0xe8ac('0x17')]['message']);}})[_0xe8ac('0x18')](function(_0x3a7939){logger[_0xe8ac('0x15')](_0xe8ac('0x10'),_0x2d56f0,_0x3a7939);_0x5c83e1(_0x3a7939);});});}exports[_0xe8ac('0x19')]=function(_0x36759c){var _0x4892d0=this;return new Promise(function(_0x59df3d,_0x5f3433){return db[_0xe8ac('0x1a')][_0xe8ac('0x1b')](_0x36759c['body'],{'raw':_0x36759c[_0xe8ac('0x1c')]?_0x36759c['options'][_0xe8ac('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36759c[_0xe8ac('0x1c')]?_0x36759c['options'][_0xe8ac('0x1e')]||null:null,'attributes':_0x36759c[_0xe8ac('0x1c')]?_0x36759c[_0xe8ac('0x1c')][_0xe8ac('0x1f')]||null:null,'limit':_0x36759c['options']?_0x36759c[_0xe8ac('0x1c')]['limit']||null:null})[_0xe8ac('0x20')](function(_0x3933d2){logger[_0xe8ac('0xf')](_0xe8ac('0x19'),_0x36759c);logger[_0xe8ac('0x12')](_0xe8ac('0x19'),_0x36759c,JSON[_0xe8ac('0x14')](_0x3933d2));_0x59df3d(_0x3933d2);})['catch'](function(_0x1c3ea4){logger[_0xe8ac('0x15')](_0xe8ac('0x19'),_0x1c3ea4[_0xe8ac('0x16')],_0x36759c);_0x5f3433(_0x4892d0[_0xe8ac('0x15')](0x1f4,_0x1c3ea4[_0xe8ac('0x16')]));});});};exports[_0xe8ac('0x21')]=function(_0x3e3fc2){var _0x44b07c=this;return new Promise(function(_0x562e44,_0x5a1b69){var _0x346dcb=require(_0xe8ac('0x22'));var _0x59512c;return db[_0xe8ac('0x23')][_0xe8ac('0x24')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})['then'](function(_0x1f1e44){_0x59512c=_0x1f1e44;return db[_0xe8ac('0x1a')][_0xe8ac('0x25')](_0x3e3fc2[_0xe8ac('0x26')]);})[_0xe8ac('0x20')](function(_0x41ffe8){if(_0x59512c[_0xe8ac('0x27')]&&fs['existsSync'](_0x41ffe8[_0xe8ac('0x28')])){var _0x5459e5=util[_0xe8ac('0x29')]('%s.cypher',_0x41ffe8['value']);return _0x346dcb['encryptFile'](_0x41ffe8['value'],_0x5459e5,config[_0xe8ac('0x2a')][_0xe8ac('0x2b')])[_0xe8ac('0x20')](function(){fs[_0xe8ac('0x2c')](_0x41ffe8[_0xe8ac('0x28')]);logger[_0xe8ac('0xf')](_0xe8ac('0x2d'));return _0x41ffe8;});}return _0x41ffe8;})['then'](function(_0x1cacb0){logger['info']('CreateVoiceRecording',_0x3e3fc2);logger['debug'](_0xe8ac('0x21'),_0x3e3fc2,JSON[_0xe8ac('0x14')](_0x1cacb0));_0x562e44(_0x1cacb0);})[_0xe8ac('0x18')](function(_0x56feff){logger['error'](_0xe8ac('0x21'),_0x56feff[_0xe8ac('0x16')],_0x3e3fc2);_0x5a1b69(_0x44b07c[_0xe8ac('0x15')](0x1f4,_0x56feff[_0xe8ac('0x16')]));});});}; \ No newline at end of file +var _0x5430=['info','request\x20sent','debug','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','UpdateVoiceRecording','VoiceRecording','options','raw','limit','catch','CreateVoiceRecording','../../components/encryptor','findOne','callRecordingEncryption','create','body','existsSync','format','%s.cypher','value','encryptFile','secrets','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','then'];(function(_0xfd8a9e,_0xf49c03){var _0x157a88=function(_0x16c3c5){while(--_0x16c3c5){_0xfd8a9e['push'](_0xfd8a9e['shift']());}};_0x157a88(++_0xf49c03);}(_0x5430,0x10c));var _0x0543=function(_0x22a71d,_0x18dbc6){_0x22a71d=_0x22a71d-0x0;var _0x4b242b=_0x5430[_0x22a71d];return _0x4b242b;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var BPromise=require(_0x0543('0x3'));var rs=require(_0x0543('0x4'));var fs=require('fs');var Redis=require(_0x0543('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0543('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0543('0x7'));var client=jayson[_0x0543('0x8')][_0x0543('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x319568,_0x46bca7,_0x5ac352){return new BPromise(function(_0x372974,_0x7b8280){return client[_0x0543('0xa')](_0x319568,_0x5ac352)[_0x0543('0xb')](function(_0x2fb723){logger[_0x0543('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'));logger[_0x0543('0xe')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'),JSON[_0x0543('0xf')](_0x2fb723));if(_0x2fb723[_0x0543('0x10')]){if(_0x2fb723[_0x0543('0x10')][_0x0543('0x11')]===0x1f4){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x7b8280(_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);}logger[_0x0543('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x372974(_0x2fb723['error']['message']);}else{logger[_0x0543('0xc')](_0x0543('0x12'),_0x46bca7,_0x0543('0xd'));_0x372974(_0x2fb723[_0x0543('0x14')][_0x0543('0x13')]);}})['catch'](function(_0xe69a3d){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0xe69a3d);_0x7b8280(_0xe69a3d);});});}exports[_0x0543('0x15')]=function(_0x20b396){var _0x285080=this;return new Promise(function(_0x577cf0,_0x5eb03e){return db[_0x0543('0x16')]['update'](_0x20b396['body'],{'raw':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20b396['options']?_0x20b396[_0x0543('0x17')]['where']||null:null,'attributes':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')]['attributes']||null:null,'limit':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x19')]||null:null})[_0x0543('0xb')](function(_0x37347e){logger[_0x0543('0xc')]('UpdateVoiceRecording',_0x20b396);logger['debug']('UpdateVoiceRecording',_0x20b396,JSON[_0x0543('0xf')](_0x37347e));_0x577cf0(_0x37347e);})[_0x0543('0x1a')](function(_0x15ebeb){logger[_0x0543('0x10')](_0x0543('0x15'),_0x15ebeb[_0x0543('0x13')],_0x20b396);_0x5eb03e(_0x285080[_0x0543('0x10')](0x1f4,_0x15ebeb[_0x0543('0x13')]));});});};exports[_0x0543('0x1b')]=function(_0xf1eccf){var _0x40a261=this;return new Promise(function(_0x21fc63,_0x547a88){var _0x25e6f1=require(_0x0543('0x1c'));var _0x30ad9e;return db['Setting'][_0x0543('0x1d')]({'attributes':['id',_0x0543('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0543('0xb')](function(_0x10b881){_0x30ad9e=_0x10b881;return db['VoiceRecording'][_0x0543('0x1f')](_0xf1eccf[_0x0543('0x20')]);})['then'](function(_0x576084){if(_0x30ad9e[_0x0543('0x1e')]&&fs[_0x0543('0x21')](_0x576084['value'])){var _0x3b879b=util[_0x0543('0x22')](_0x0543('0x23'),_0x576084[_0x0543('0x24')]);return _0x25e6f1[_0x0543('0x25')](_0x576084[_0x0543('0x24')],_0x3b879b,config[_0x0543('0x26')]['recording'])[_0x0543('0xb')](function(){fs['unlink'](_0x576084[_0x0543('0x24')]);logger[_0x0543('0xc')](_0x0543('0x27'));return _0x576084;});}return _0x576084;})[_0x0543('0xb')](function(_0x28307f){logger['info'](_0x0543('0x1b'),_0xf1eccf);logger['debug'](_0x0543('0x1b'),_0xf1eccf,JSON[_0x0543('0xf')](_0x28307f));_0x21fc63(_0x28307f);})[_0x0543('0x1a')](function(_0x327027){logger['error'](_0x0543('0x1b'),_0x327027['message'],_0xf1eccf);_0x547a88(_0x40a261[_0x0543('0x10')](0x1f4,_0x327027[_0x0543('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index a2b28e1..93731a4 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 _0x0b3b=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe','show','post','put','/:id','update','delete','destroy'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0b3b,0x115));var _0xb0b3=function(_0x18eb35,_0x266e44){_0x18eb35=_0x18eb35-0x0;var _0x123b1e=_0x0b3b[_0x18eb35];return _0x123b1e;};'use strict';var multer=require(_0xb0b3('0x0'));var util=require(_0xb0b3('0x1'));var path=require(_0xb0b3('0x2'));var timeout=require(_0xb0b3('0x3'));var express=require(_0xb0b3('0x4'));var router=express[_0xb0b3('0x5')]();var fs_extra=require(_0xb0b3('0x6'));var auth=require(_0xb0b3('0x7'));var interaction=require(_0xb0b3('0x8'));var config=require(_0xb0b3('0x9'));var controller=require(_0xb0b3('0xa'));router[_0xb0b3('0xb')]('/',auth[_0xb0b3('0xc')](),controller['index']);router[_0xb0b3('0xb')](_0xb0b3('0xd'),auth['isAuthenticated'](),controller[_0xb0b3('0xe')]);router[_0xb0b3('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xb0b3('0xf')]);router[_0xb0b3('0x10')]('/',auth[_0xb0b3('0xc')](),controller['create']);router[_0xb0b3('0x11')](_0xb0b3('0x12'),auth[_0xb0b3('0xc')](),controller[_0xb0b3('0x13')]);router[_0xb0b3('0x14')](_0xb0b3('0x12'),auth[_0xb0b3('0xc')](),controller[_0xb0b3('0x15')]);module[_0xb0b3('0x16')]=router; \ No newline at end of file +var _0x29cd=['/describe','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated'];(function(_0x155265,_0x132b4f){var _0x1ff896=function(_0x13797b){while(--_0x13797b){_0x155265['push'](_0x155265['shift']());}};_0x1ff896(++_0x132b4f);}(_0x29cd,0x186));var _0xd29c=function(_0x3c9fc9,_0x6f5012){_0x3c9fc9=_0x3c9fc9-0x0;var _0x2ec8ca=_0x29cd[_0x3c9fc9];return _0x2ec8ca;};'use strict';var multer=require(_0xd29c('0x0'));var util=require(_0xd29c('0x1'));var path=require(_0xd29c('0x2'));var timeout=require(_0xd29c('0x3'));var express=require(_0xd29c('0x4'));var router=express[_0xd29c('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd29c('0x6'));var controller=require('./voiceTransferReport.controller');router[_0xd29c('0x7')]('/',auth[_0xd29c('0x8')](),controller['index']);router[_0xd29c('0x7')](_0xd29c('0x9'),auth[_0xd29c('0x8')](),controller['describe']);router[_0xd29c('0x7')]('/:id',auth[_0xd29c('0x8')](),controller[_0xd29c('0xa')]);router[_0xd29c('0xb')]('/',auth['isAuthenticated'](),controller[_0xd29c('0xc')]);router[_0xd29c('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xd29c('0xe')]);router[_0xd29c('0xf')](_0xd29c('0x10'),auth[_0xd29c('0x8')](),controller[_0xd29c('0x11')]);module[_0xd29c('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index b65d50f..56a0456 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 _0x3ef9=['STRING','Yes','sequelize','moment','exports','ENUM','blind','attended'];(function(_0x39cbe4,_0x4a7958){var _0xe76ba7=function(_0x332a08){while(--_0x332a08){_0x39cbe4['push'](_0x39cbe4['shift']());}};_0xe76ba7(++_0x4a7958);}(_0x3ef9,0x10a));var _0x93ef=function(_0x28ab07,_0x134567){_0x28ab07=_0x28ab07-0x0;var _0x27317d=_0x3ef9[_0x28ab07];return _0x27317d;};'use strict';var Sequelize=require(_0x93ef('0x0'));var moment=require(_0x93ef('0x1'));module[_0x93ef('0x2')]={'type':{'type':Sequelize[_0x93ef('0x3')](_0x93ef('0x4'),_0x93ef('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x93ef('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x93ef('0x6')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x93ef('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x93ef('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x93ef('0x6')]},'transferercontext':{'type':Sequelize[_0x93ef('0x6')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x93ef('0x6')]},'transfereechannel':{'type':Sequelize[_0x93ef('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x93ef('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x93ef('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x93ef('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0x93ef('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x93ef('0x6')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x93ef('0x6')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x93ef('0x3')](_0x93ef('0x7'),'No')},'context':{'type':Sequelize[_0x93ef('0x6')]},'extension':{'type':Sequelize[_0x93ef('0x6')]}}; \ No newline at end of file +var _0x0c72=['moment','attended','STRING','ENUM','Yes','sequelize'];(function(_0x28a4a3,_0xfda898){var _0x4b8985=function(_0x1bf88f){while(--_0x1bf88f){_0x28a4a3['push'](_0x28a4a3['shift']());}};_0x4b8985(++_0xfda898);}(_0x0c72,0x14f));var _0x20c7=function(_0x10f4d2,_0x51a2bc){_0x10f4d2=_0x10f4d2-0x0;var _0x514947=_0x0c72[_0x10f4d2];return _0x514947;};'use strict';var Sequelize=require(_0x20c7('0x0'));var moment=require(_0x20c7('0x1'));module['exports']={'type':{'type':Sequelize['ENUM']('blind',_0x20c7('0x2'))},'result':{'type':Sequelize[_0x20c7('0x3')]},'transfererchannel':{'type':Sequelize[_0x20c7('0x3')]},'transferercalleridnum':{'type':Sequelize[_0x20c7('0x3')]},'transferercalleridname':{'type':Sequelize[_0x20c7('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0x20c7('0x3')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x20c7('0x3')]},'transfereechannel':{'type':Sequelize[_0x20c7('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x20c7('0x3')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x20c7('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0x20c7('0x3')]},'transfereecontext':{'type':Sequelize[_0x20c7('0x3')]},'transfereeexten':{'type':Sequelize[_0x20c7('0x3')]},'transfereelinkedid':{'type':Sequelize[_0x20c7('0x3')]},'isexternal':{'type':Sequelize[_0x20c7('0x4')](_0x20c7('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x20c7('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index c686b61..23ba9cc 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 _0x4705=['sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','length','VoiceTransferReport','catch','create','body','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','sendStatus','error','stack','index','map','rawAttributes','type','key','model','name','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order'];(function(_0xa5b956,_0x2da979){var _0x1a43d6=function(_0x588ac9){while(--_0x588ac9){_0xa5b956['push'](_0xa5b956['shift']());}};_0x1a43d6(++_0x2da979);}(_0x4705,0x1a1));var _0x5470=function(_0x1441fb,_0x32efdd){_0x1441fb=_0x1441fb-0x0;var _0x1816ee=_0x4705[_0x1441fb];return _0x1816ee;};'use strict';var emlformat=require(_0x5470('0x0'));var rimraf=require(_0x5470('0x1'));var zipdir=require(_0x5470('0x2'));var jsonpatch=require(_0x5470('0x3'));var rp=require('request-promise');var moment=require(_0x5470('0x4'));var BPromise=require(_0x5470('0x5'));var Mustache=require(_0x5470('0x6'));var util=require(_0x5470('0x7'));var path=require(_0x5470('0x8'));var sox=require(_0x5470('0x9'));var csv=require(_0x5470('0xa'));var ejs=require(_0x5470('0xb'));var fs=require('fs');var fs_extra=require(_0x5470('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5470('0xd'));var deskjs=require(_0x5470('0xe'));var toCsv=require(_0x5470('0xa'));var querystring=require(_0x5470('0xf'));var Papa=require('papaparse');var Redis=require(_0x5470('0x10'));var authService=require(_0x5470('0x11'));var qs=require(_0x5470('0x12'));var as=require(_0x5470('0x13'));var hardwareService=require(_0x5470('0x14'));var logger=require(_0x5470('0x15'))(_0x5470('0x16'));var utils=require(_0x5470('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5470('0x18'));var db=require(_0x5470('0x19'))['db'];function respondWithStatusCode(_0x5ca8b1,_0x428859){_0x428859=_0x428859||0xcc;return function(_0x1a0b08){if(_0x1a0b08){return _0x5ca8b1['sendStatus'](_0x428859);}return _0x5ca8b1[_0x5470('0x1a')](_0x428859)[_0x5470('0x1b')]();};}function respondWithResult(_0x2c5518,_0x5b8914){_0x5b8914=_0x5b8914||0xc8;return function(_0x4adc60){if(_0x4adc60){return _0x2c5518['status'](_0x5b8914)['json'](_0x4adc60);}};}function respondWithFilteredResult(_0xa19880,_0x558b8f){return function(_0x34b895){if(_0x34b895){var _0x45ec3f=typeof _0x558b8f[_0x5470('0x1c')]===_0x5470('0x1d')&&typeof _0x558b8f['limit']===_0x5470('0x1d');var _0x29d24a=_0x34b895[_0x5470('0x1e')];var _0x266e1d=_0x45ec3f?0x0:_0x558b8f[_0x5470('0x1c')];var _0x32dc36=_0x45ec3f?_0x34b895[_0x5470('0x1e')]:_0x558b8f[_0x5470('0x1c')]+_0x558b8f[_0x5470('0x1f')];var _0x75dc93;if(_0x32dc36>=_0x29d24a){_0x32dc36=_0x29d24a;_0x75dc93=0xc8;}else{_0x75dc93=0xce;}_0xa19880[_0x5470('0x1a')](_0x75dc93);return _0xa19880[_0x5470('0x20')](_0x5470('0x21'),_0x266e1d+'-'+_0x32dc36+'/'+_0x29d24a)[_0x5470('0x22')](_0x34b895);}return null;};}function patchUpdates(_0x1100b2){return function(_0x3a0bfd){try{jsonpatch[_0x5470('0x23')](_0x3a0bfd,_0x1100b2,!![]);}catch(_0x55b2ea){return BPromise['reject'](_0x55b2ea);}return _0x3a0bfd[_0x5470('0x24')]();};}function saveUpdates(_0x280fb4,_0x2b7f61){return function(_0x30a53c){if(_0x30a53c){return _0x30a53c[_0x5470('0x25')](_0x280fb4)[_0x5470('0x26')](function(_0x3a7e3f){return _0x3a7e3f;});}return null;};}function removeEntity(_0x223edc,_0x3c1630){return function(_0x40a0c6){if(_0x40a0c6){return _0x40a0c6['destroy']()[_0x5470('0x26')](function(){_0x223edc[_0x5470('0x1a')](0xcc)[_0x5470('0x1b')]();});}};}function handleEntityNotFound(_0x53364f,_0x4f865c){return function(_0x14eda9){if(!_0x14eda9){_0x53364f[_0x5470('0x27')](0x194);}return _0x14eda9;};}function handleError(_0x969288,_0x188518){_0x188518=_0x188518||0x1f4;return function(_0x4d3338){logger[_0x5470('0x28')](_0x4d3338[_0x5470('0x29')]);if(_0x4d3338['name']){delete _0x4d3338['name'];}_0x969288[_0x5470('0x1a')](_0x188518)['send'](_0x4d3338);};}exports[_0x5470('0x2a')]=function(_0x4c285b,_0x225eef){var _0x50a0fb={},_0x3d0190={},_0x388133={'count':0x0,'rows':[]};var _0x4fa37e=_[_0x5470('0x2b')](db['VoiceTransferReport'][_0x5470('0x2c')],function(_0x1582a3){return{'name':_0x1582a3['fieldName'],'type':_0x1582a3[_0x5470('0x2d')][_0x5470('0x2e')]};});_0x3d0190[_0x5470('0x2f')]=_[_0x5470('0x2b')](_0x4fa37e,_0x5470('0x30'));_0x3d0190['query']=_['keys'](_0x4c285b[_0x5470('0x31')]);_0x3d0190[_0x5470('0x32')]=_[_0x5470('0x33')](_0x3d0190[_0x5470('0x2f')],_0x3d0190[_0x5470('0x31')]);_0x50a0fb['attributes']=_[_0x5470('0x33')](_0x3d0190[_0x5470('0x2f')],qs[_0x5470('0x34')](_0x4c285b[_0x5470('0x31')][_0x5470('0x34')]));_0x50a0fb[_0x5470('0x35')]=_0x50a0fb[_0x5470('0x35')]['length']?_0x50a0fb[_0x5470('0x35')]:_0x3d0190['model'];if(!_0x4c285b[_0x5470('0x31')][_0x5470('0x36')](_0x5470('0x37'))){_0x50a0fb[_0x5470('0x1f')]=qs['limit'](_0x4c285b['query'][_0x5470('0x1f')]);_0x50a0fb['offset']=qs[_0x5470('0x1c')](_0x4c285b['query'][_0x5470('0x1c')]);}_0x50a0fb[_0x5470('0x38')]=qs[_0x5470('0x39')](_0x4c285b['query'][_0x5470('0x39')]);_0x50a0fb[_0x5470('0x3a')]=qs[_0x5470('0x32')](_[_0x5470('0x3b')](_0x4c285b['query'],_0x3d0190[_0x5470('0x32')]),_0x4fa37e);if(_0x4c285b[_0x5470('0x31')][_0x5470('0x3c')]){_0x50a0fb['where']=_['merge'](_0x50a0fb[_0x5470('0x3a')],{'$or':_[_0x5470('0x2b')](_0x4fa37e,function(_0x4ed506){if(_0x4ed506[_0x5470('0x2d')]!==_0x5470('0x3d')){var _0x230559={};_0x230559[_0x4ed506['name']]={'$like':'%'+_0x4c285b['query'][_0x5470('0x3c')]+'%'};return _0x230559;}})});}_0x50a0fb=_[_0x5470('0x3e')]({},_0x50a0fb,_0x4c285b[_0x5470('0x3f')]);var _0x8e95b5={'where':_0x50a0fb['where']};return db['VoiceTransferReport'][_0x5470('0x1e')](_0x8e95b5)[_0x5470('0x26')](function(_0x5a7a14){_0x388133['count']=_0x5a7a14;if(_0x4c285b[_0x5470('0x31')][_0x5470('0x40')]){_0x50a0fb[_0x5470('0x41')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x5470('0x42')](_0x50a0fb);})[_0x5470('0x26')](function(_0x4448f8){_0x388133[_0x5470('0x43')]=_0x4448f8;return _0x388133;})[_0x5470('0x26')](respondWithFilteredResult(_0x225eef,_0x50a0fb))['catch'](handleError(_0x225eef,null));};exports[_0x5470('0x44')]=function(_0x4d2fb0,_0x4ee601){var _0x551cc1={'raw':!![],'where':{'id':_0x4d2fb0[_0x5470('0x45')]['id']}},_0xebd4c5={};_0xebd4c5[_0x5470('0x2f')]=_[_0x5470('0x46')](db['VoiceTransferReport']['rawAttributes']);_0xebd4c5[_0x5470('0x31')]=_[_0x5470('0x46')](_0x4d2fb0[_0x5470('0x31')]);_0xebd4c5[_0x5470('0x32')]=_[_0x5470('0x33')](_0xebd4c5[_0x5470('0x2f')],_0xebd4c5['query']);_0x551cc1[_0x5470('0x35')]=_[_0x5470('0x33')](_0xebd4c5['model'],qs[_0x5470('0x34')](_0x4d2fb0[_0x5470('0x31')][_0x5470('0x34')]));_0x551cc1['attributes']=_0x551cc1[_0x5470('0x35')][_0x5470('0x47')]?_0x551cc1['attributes']:_0xebd4c5[_0x5470('0x2f')];if(_0x4d2fb0[_0x5470('0x31')][_0x5470('0x40')]){_0x551cc1[_0x5470('0x41')]=[{'all':!![]}];}_0x551cc1=_[_0x5470('0x3e')]({},_0x551cc1,_0x4d2fb0[_0x5470('0x3f')]);return db[_0x5470('0x48')]['find'](_0x551cc1)['then'](handleEntityNotFound(_0x4ee601,null))[_0x5470('0x26')](respondWithResult(_0x4ee601,null))[_0x5470('0x49')](handleError(_0x4ee601,null));};exports[_0x5470('0x4a')]=function(_0x1962aa,_0x390e08){return db[_0x5470('0x48')]['create'](_0x1962aa[_0x5470('0x4b')],{})[_0x5470('0x26')](respondWithResult(_0x390e08,0xc9))[_0x5470('0x49')](handleError(_0x390e08,null));};exports[_0x5470('0x25')]=function(_0x1184ff,_0x1b55dd){if(_0x1184ff[_0x5470('0x4b')]['id']){delete _0x1184ff[_0x5470('0x4b')]['id'];}return db[_0x5470('0x48')]['find']({'where':{'id':_0x1184ff[_0x5470('0x45')]['id']}})[_0x5470('0x26')](handleEntityNotFound(_0x1b55dd,null))[_0x5470('0x26')](saveUpdates(_0x1184ff[_0x5470('0x4b')],null))[_0x5470('0x26')](respondWithResult(_0x1b55dd,null))[_0x5470('0x49')](handleError(_0x1b55dd,null));};exports[_0x5470('0x4c')]=function(_0x192ee9,_0x21766b){return db['VoiceTransferReport'][_0x5470('0x4d')]({'where':{'id':_0x192ee9[_0x5470('0x45')]['id']}})[_0x5470('0x26')](handleEntityNotFound(_0x21766b,null))[_0x5470('0x26')](removeEntity(_0x21766b,null))[_0x5470('0x49')](handleError(_0x21766b,null));};exports['describe']=function(_0x4a2b5c,_0x2558f6){return db[_0x5470('0x48')][_0x5470('0x4e')]()[_0x5470('0x26')](respondWithResult(_0x2558f6,null))[_0x5470('0x49')](handleError(_0x2558f6,null));}; \ No newline at end of file +var _0x381a=['findAll','rows','catch','show','params','keys','include','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x10f897,_0x20cb16){var _0x2bdffc=function(_0x237dbb){while(--_0x237dbb){_0x10f897['push'](_0x10f897['shift']());}};_0x2bdffc(++_0x20cb16);}(_0x381a,0x182));var _0xa381=function(_0x5a5574,_0x23271e){_0x5a5574=_0x5a5574-0x0;var _0x53e1bb=_0x381a[_0x5a5574];return _0x53e1bb;};'use strict';var emlformat=require(_0xa381('0x0'));var rimraf=require(_0xa381('0x1'));var zipdir=require(_0xa381('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa381('0x3'));var moment=require(_0xa381('0x4'));var BPromise=require(_0xa381('0x5'));var Mustache=require(_0xa381('0x6'));var util=require(_0xa381('0x7'));var path=require('path');var sox=require(_0xa381('0x8'));var csv=require(_0xa381('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa381('0xa'));var _=require(_0xa381('0xb'));var squel=require('squel');var crypto=require(_0xa381('0xc'));var jsforce=require(_0xa381('0xd'));var deskjs=require(_0xa381('0xe'));var toCsv=require(_0xa381('0x9'));var querystring=require(_0xa381('0xf'));var Papa=require('papaparse');var Redis=require(_0xa381('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa381('0x11'));var as=require(_0xa381('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa381('0x13'))(_0xa381('0x14'));var utils=require(_0xa381('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa381('0x16'));var db=require(_0xa381('0x17'))['db'];function respondWithStatusCode(_0x522d82,_0x4402f4){_0x4402f4=_0x4402f4||0xcc;return function(_0x1be7a0){if(_0x1be7a0){return _0x522d82[_0xa381('0x18')](_0x4402f4);}return _0x522d82[_0xa381('0x19')](_0x4402f4)['end']();};}function respondWithResult(_0x5ca036,_0x32c141){_0x32c141=_0x32c141||0xc8;return function(_0x70cfa0){if(_0x70cfa0){return _0x5ca036[_0xa381('0x19')](_0x32c141)[_0xa381('0x1a')](_0x70cfa0);}};}function respondWithFilteredResult(_0x44d24d,_0x31a18b){return function(_0x322c6f){if(_0x322c6f){var _0x593372=typeof _0x31a18b['offset']===_0xa381('0x1b')&&typeof _0x31a18b['limit']===_0xa381('0x1b');var _0x32ba33=_0x322c6f[_0xa381('0x1c')];var _0x8158a7=_0x593372?0x0:_0x31a18b['offset'];var _0x358024=_0x593372?_0x322c6f[_0xa381('0x1c')]:_0x31a18b['offset']+_0x31a18b[_0xa381('0x1d')];var _0x37208c;if(_0x358024>=_0x32ba33){_0x358024=_0x32ba33;_0x37208c=0xc8;}else{_0x37208c=0xce;}_0x44d24d[_0xa381('0x19')](_0x37208c);return _0x44d24d[_0xa381('0x1e')](_0xa381('0x1f'),_0x8158a7+'-'+_0x358024+'/'+_0x32ba33)[_0xa381('0x1a')](_0x322c6f);}return null;};}function patchUpdates(_0x48f5d5){return function(_0x3a66b9){try{jsonpatch['apply'](_0x3a66b9,_0x48f5d5,!![]);}catch(_0x360ad8){return BPromise[_0xa381('0x20')](_0x360ad8);}return _0x3a66b9[_0xa381('0x21')]();};}function saveUpdates(_0x4d79e2,_0x1bd6e5){return function(_0xc0e544){if(_0xc0e544){return _0xc0e544[_0xa381('0x22')](_0x4d79e2)['then'](function(_0x1e1341){return _0x1e1341;});}return null;};}function removeEntity(_0x477559,_0x17e91a){return function(_0x2133e8){if(_0x2133e8){return _0x2133e8[_0xa381('0x23')]()[_0xa381('0x24')](function(){_0x477559[_0xa381('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13419d,_0x49d657){return function(_0x96690b){if(!_0x96690b){_0x13419d['sendStatus'](0x194);}return _0x96690b;};}function handleError(_0x2b7050,_0x58ee52){_0x58ee52=_0x58ee52||0x1f4;return function(_0x3536a2){logger[_0xa381('0x25')](_0x3536a2['stack']);if(_0x3536a2[_0xa381('0x26')]){delete _0x3536a2[_0xa381('0x26')];}_0x2b7050[_0xa381('0x19')](_0x58ee52)[_0xa381('0x27')](_0x3536a2);};}exports[_0xa381('0x28')]=function(_0x35c953,_0x33a633){var _0x41f84f={},_0x5d395a={},_0x3599c3={'count':0x0,'rows':[]};var _0x535041=_[_0xa381('0x29')](db[_0xa381('0x2a')][_0xa381('0x2b')],function(_0x28f55f){return{'name':_0x28f55f[_0xa381('0x2c')],'type':_0x28f55f[_0xa381('0x2d')]['key']};});_0x5d395a[_0xa381('0x2e')]=_[_0xa381('0x29')](_0x535041,'name');_0x5d395a['query']=_['keys'](_0x35c953[_0xa381('0x2f')]);_0x5d395a[_0xa381('0x30')]=_[_0xa381('0x31')](_0x5d395a[_0xa381('0x2e')],_0x5d395a[_0xa381('0x2f')]);_0x41f84f['attributes']=_[_0xa381('0x31')](_0x5d395a[_0xa381('0x2e')],qs[_0xa381('0x32')](_0x35c953[_0xa381('0x2f')][_0xa381('0x32')]));_0x41f84f[_0xa381('0x33')]=_0x41f84f[_0xa381('0x33')][_0xa381('0x34')]?_0x41f84f[_0xa381('0x33')]:_0x5d395a[_0xa381('0x2e')];if(!_0x35c953[_0xa381('0x2f')][_0xa381('0x35')]('nolimit')){_0x41f84f[_0xa381('0x1d')]=qs['limit'](_0x35c953[_0xa381('0x2f')]['limit']);_0x41f84f[_0xa381('0x36')]=qs[_0xa381('0x36')](_0x35c953[_0xa381('0x2f')][_0xa381('0x36')]);}_0x41f84f[_0xa381('0x37')]=qs[_0xa381('0x38')](_0x35c953[_0xa381('0x2f')][_0xa381('0x38')]);_0x41f84f[_0xa381('0x39')]=qs[_0xa381('0x30')](_[_0xa381('0x3a')](_0x35c953[_0xa381('0x2f')],_0x5d395a[_0xa381('0x30')]),_0x535041);if(_0x35c953[_0xa381('0x2f')][_0xa381('0x3b')]){_0x41f84f[_0xa381('0x39')]=_[_0xa381('0x3c')](_0x41f84f['where'],{'$or':_[_0xa381('0x29')](_0x535041,function(_0x3aca62){if(_0x3aca62[_0xa381('0x2d')]!==_0xa381('0x3d')){var _0x2b4243={};_0x2b4243[_0x3aca62[_0xa381('0x26')]]={'$like':'%'+_0x35c953[_0xa381('0x2f')][_0xa381('0x3b')]+'%'};return _0x2b4243;}})});}_0x41f84f=_[_0xa381('0x3c')]({},_0x41f84f,_0x35c953[_0xa381('0x3e')]);var _0x14beb3={'where':_0x41f84f[_0xa381('0x39')]};return db[_0xa381('0x2a')][_0xa381('0x1c')](_0x14beb3)[_0xa381('0x24')](function(_0x36ea44){_0x3599c3['count']=_0x36ea44;if(_0x35c953['query'][_0xa381('0x3f')]){_0x41f84f['include']=[{'all':!![]}];}return db[_0xa381('0x2a')][_0xa381('0x40')](_0x41f84f);})[_0xa381('0x24')](function(_0xf00745){_0x3599c3[_0xa381('0x41')]=_0xf00745;return _0x3599c3;})['then'](respondWithFilteredResult(_0x33a633,_0x41f84f))[_0xa381('0x42')](handleError(_0x33a633,null));};exports[_0xa381('0x43')]=function(_0x5e89e3,_0x1f8a4f){var _0x52a512={'raw':!![],'where':{'id':_0x5e89e3[_0xa381('0x44')]['id']}},_0x1c61d0={};_0x1c61d0['model']=_[_0xa381('0x45')](db[_0xa381('0x2a')][_0xa381('0x2b')]);_0x1c61d0['query']=_[_0xa381('0x45')](_0x5e89e3[_0xa381('0x2f')]);_0x1c61d0[_0xa381('0x30')]=_[_0xa381('0x31')](_0x1c61d0['model'],_0x1c61d0['query']);_0x52a512[_0xa381('0x33')]=_['intersection'](_0x1c61d0[_0xa381('0x2e')],qs[_0xa381('0x32')](_0x5e89e3[_0xa381('0x2f')][_0xa381('0x32')]));_0x52a512[_0xa381('0x33')]=_0x52a512[_0xa381('0x33')][_0xa381('0x34')]?_0x52a512[_0xa381('0x33')]:_0x1c61d0[_0xa381('0x2e')];if(_0x5e89e3[_0xa381('0x2f')][_0xa381('0x3f')]){_0x52a512[_0xa381('0x46')]=[{'all':!![]}];}_0x52a512=_['merge']({},_0x52a512,_0x5e89e3['options']);return db[_0xa381('0x2a')]['find'](_0x52a512)[_0xa381('0x24')](handleEntityNotFound(_0x1f8a4f,null))['then'](respondWithResult(_0x1f8a4f,null))[_0xa381('0x42')](handleError(_0x1f8a4f,null));};exports[_0xa381('0x47')]=function(_0x2234f8,_0xa401d3){return db['VoiceTransferReport'][_0xa381('0x47')](_0x2234f8[_0xa381('0x48')],{})['then'](respondWithResult(_0xa401d3,0xc9))[_0xa381('0x42')](handleError(_0xa401d3,null));};exports[_0xa381('0x22')]=function(_0x331fd9,_0x3ca112){if(_0x331fd9['body']['id']){delete _0x331fd9[_0xa381('0x48')]['id'];}return db['VoiceTransferReport'][_0xa381('0x49')]({'where':{'id':_0x331fd9[_0xa381('0x44')]['id']}})[_0xa381('0x24')](handleEntityNotFound(_0x3ca112,null))[_0xa381('0x24')](saveUpdates(_0x331fd9[_0xa381('0x48')],null))[_0xa381('0x24')](respondWithResult(_0x3ca112,null))[_0xa381('0x42')](handleError(_0x3ca112,null));};exports[_0xa381('0x23')]=function(_0x2b6bf5,_0x5ba064){return db['VoiceTransferReport']['find']({'where':{'id':_0x2b6bf5[_0xa381('0x44')]['id']}})['then'](handleEntityNotFound(_0x5ba064,null))[_0xa381('0x24')](removeEntity(_0x5ba064,null))[_0xa381('0x42')](handleError(_0x5ba064,null));};exports[_0xa381('0x4a')]=function(_0x31e81f,_0x3a236b){return db['VoiceTransferReport'][_0xa381('0x4a')]()['then'](respondWithResult(_0x3a236b,null))['catch'](handleError(_0x3a236b,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 90e5d60..f45b7ed 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 _0x5e89=['./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x585d81,_0xf6d74f){var _0x1aca0d=function(_0x3782d3){while(--_0x3782d3){_0x585d81['push'](_0x585d81['shift']());}};_0x1aca0d(++_0xf6d74f);}(_0x5e89,0x1dd));var _0x95e8=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x5e89[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0x95e8('0x0'));var util=require('util');var logger=require(_0x95e8('0x1'))(_0x95e8('0x2'));var moment=require(_0x95e8('0x3'));var BPromise=require(_0x95e8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x95e8('0x5'));var rimraf=require(_0x95e8('0x6'));var config=require('../../config/environment');var attributes=require(_0x95e8('0x7'));module['exports']=function(_0x1808af,_0x1d159e){return _0x1808af[_0x95e8('0x8')](_0x95e8('0x9'),attributes,{'tableName':_0x95e8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf8a7=['rimraf','../../config/environment','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf8a7,0x1a9));var _0x7f8a=function(_0xbd8ae3,_0xe95f68){_0xbd8ae3=_0xbd8ae3-0x0;var _0x445320=_0xf8a7[_0xbd8ae3];return _0x445320;};'use strict';var _=require(_0x7f8a('0x0'));var util=require(_0x7f8a('0x1'));var logger=require(_0x7f8a('0x2'))(_0x7f8a('0x3'));var moment=require(_0x7f8a('0x4'));var BPromise=require(_0x7f8a('0x5'));var rp=require(_0x7f8a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7f8a('0x7'));var config=require(_0x7f8a('0x8'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x5d5f9f,_0x5c411e){return _0x5d5f9f[_0x7f8a('0x9')](_0x7f8a('0xa'),attributes,{'tableName':_0x7f8a('0xb'),'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 bcda931..b43cd3b 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 _0xbead=['debug','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw'];(function(_0x2cef86,_0xbae0a6){var _0x46dfd6=function(_0x52e464){while(--_0x52e464){_0x2cef86['push'](_0x2cef86['shift']());}};_0x46dfd6(++_0xbae0a6);}(_0xbead,0xcd));var _0xdbea=function(_0x385c76,_0xb97335){_0x385c76=_0x385c76-0x0;var _0x5c8367=_0xbead[_0x385c76];return _0x5c8367;};'use strict';var _=require(_0xdbea('0x0'));var util=require('util');var moment=require(_0xdbea('0x1'));var BPromise=require(_0xdbea('0x2'));var rs=require(_0xdbea('0x3'));var fs=require('fs');var Redis=require(_0xdbea('0x4'));var db=require(_0xdbea('0x5'))['db'];var utils=require(_0xdbea('0x6'));var logger=require(_0xdbea('0x7'))(_0xdbea('0x8'));var config=require(_0xdbea('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdbea('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x387cae,_0x57beac,_0x453dff){return new BPromise(function(_0x36822d,_0x1ed262){return client[_0xdbea('0xb')](_0x387cae,_0x453dff)[_0xdbea('0xc')](function(_0x1ee248){logger[_0xdbea('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x57beac,_0xdbea('0xe'));logger['debug'](_0xdbea('0xf'),_0x57beac,_0xdbea('0xe'),JSON['stringify'](_0x1ee248));if(_0x1ee248['error']){if(_0x1ee248[_0xdbea('0x10')][_0xdbea('0x11')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x57beac,_0x1ee248[_0xdbea('0x10')]['message']);return _0x1ed262(_0x1ee248['error']['message']);}logger[_0xdbea('0x10')](_0xdbea('0x12'),_0x57beac,_0x1ee248[_0xdbea('0x10')][_0xdbea('0x13')]);return _0x36822d(_0x1ee248[_0xdbea('0x10')]['message']);}else{logger[_0xdbea('0xd')](_0xdbea('0x12'),_0x57beac,_0xdbea('0xe'));_0x36822d(_0x1ee248[_0xdbea('0x14')][_0xdbea('0x13')]);}})[_0xdbea('0x15')](function(_0x6696d7){logger[_0xdbea('0x10')](_0xdbea('0x12'),_0x57beac,_0x6696d7);_0x1ed262(_0x6696d7);});});}exports[_0xdbea('0x16')]=function(_0x220f75){var _0x5a3133=this;return new Promise(function(_0x96daf5,_0x2f9882){return db[_0xdbea('0x17')][_0xdbea('0x18')](_0x220f75['body'],{'raw':_0x220f75[_0xdbea('0x19')]?_0x220f75[_0xdbea('0x19')][_0xdbea('0x1a')]===undefined?!![]:![]:!![]})[_0xdbea('0xc')](function(_0x2fb8b1){logger[_0xdbea('0xd')]('CreateVoiceTransferReport',_0x220f75);logger[_0xdbea('0x1b')]('CreateVoiceTransferReport',_0x220f75,JSON[_0xdbea('0x1c')](_0x2fb8b1));_0x96daf5(_0x2fb8b1);})[_0xdbea('0x15')](function(_0x16249f){logger[_0xdbea('0x10')](_0xdbea('0x16'),_0x16249f[_0xdbea('0x13')],_0x220f75);_0x2f9882(_0x5a3133['error'](0x1f4,_0x16249f['message']));});});}; \ No newline at end of file +var _0x94d7=['../../config/utils','../../config/logger','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateVoiceTransferReport','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x4ec270,_0x3e1ef1){var _0x2efea7=function(_0xf2f3e){while(--_0xf2f3e){_0x4ec270['push'](_0x4ec270['shift']());}};_0x2efea7(++_0x3e1ef1);}(_0x94d7,0x11a));var _0x794d=function(_0x3bf101,_0x2f2274){_0x3bf101=_0x3bf101-0x0;var _0x46ae81=_0x94d7[_0x3bf101];return _0x46ae81;};'use strict';var _=require(_0x794d('0x0'));var util=require(_0x794d('0x1'));var moment=require(_0x794d('0x2'));var BPromise=require(_0x794d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x794d('0x4'));var db=require(_0x794d('0x5'))['db'];var utils=require(_0x794d('0x6'));var logger=require(_0x794d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x218c57,_0x13136b,_0x521506){return new BPromise(function(_0x1cce29,_0x96f247){return client['request'](_0x218c57,_0x521506)[_0x794d('0x8')](function(_0x48b981){logger[_0x794d('0x9')](_0x794d('0xa'),_0x13136b,_0x794d('0xb'));logger[_0x794d('0xc')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x13136b,'request\x20sent',JSON[_0x794d('0xd')](_0x48b981));if(_0x48b981[_0x794d('0xe')]){if(_0x48b981[_0x794d('0xe')][_0x794d('0xf')]===0x1f4){logger[_0x794d('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x13136b,_0x48b981[_0x794d('0xe')]['message']);return _0x96f247(_0x48b981[_0x794d('0xe')]['message']);}logger[_0x794d('0xe')](_0x794d('0xa'),_0x13136b,_0x48b981[_0x794d('0xe')]['message']);return _0x1cce29(_0x48b981[_0x794d('0xe')][_0x794d('0x10')]);}else{logger[_0x794d('0x9')](_0x794d('0xa'),_0x13136b,_0x794d('0xb'));_0x1cce29(_0x48b981[_0x794d('0x11')][_0x794d('0x10')]);}})[_0x794d('0x12')](function(_0x2ef5f1){logger[_0x794d('0xe')](_0x794d('0xa'),_0x13136b,_0x2ef5f1);_0x96f247(_0x2ef5f1);});});}exports[_0x794d('0x13')]=function(_0x5d8d12){var _0x3c220e=this;return new Promise(function(_0xaff997,_0x549dad){return db['VoiceTransferReport'][_0x794d('0x14')](_0x5d8d12[_0x794d('0x15')],{'raw':_0x5d8d12[_0x794d('0x16')]?_0x5d8d12[_0x794d('0x16')][_0x794d('0x17')]===undefined?!![]:![]:!![]})[_0x794d('0x8')](function(_0x400406){logger['info'](_0x794d('0x13'),_0x5d8d12);logger[_0x794d('0xc')](_0x794d('0x13'),_0x5d8d12,JSON[_0x794d('0xd')](_0x400406));_0xaff997(_0x400406);})['catch'](function(_0x30093c){logger[_0x794d('0xe')](_0x794d('0x13'),_0x30093c[_0x794d('0x10')],_0x5d8d12);_0x549dad(_0x3c220e['error'](0x1f4,_0x30093c['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index e1ed47d..0152d5c 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 _0xb821=['/unhold','unhold','/calls','calls','/transfer','Router','../../components/auth/service','/originate','originate','post','/hangup','isAuthenticated','hangup','/answer','isWebrtcLicence','answer','/hold','hold'];(function(_0x261c53,_0x497f83){var _0xa39042=function(_0x2673fb){while(--_0x2673fb){_0x261c53['push'](_0x261c53['shift']());}};_0xa39042(++_0x497f83);}(_0xb821,0xa7));var _0x1b82=function(_0x2bf95a,_0x1949c5){_0x2bf95a=_0x2bf95a-0x0;var _0x5bea51=_0xb821[_0x2bf95a];return _0x5bea51;};'use strict';var express=require('express');var router=express[_0x1b82('0x0')]();var auth=require(_0x1b82('0x1'));var controller=require('./webbar.controller');router['post'](_0x1b82('0x2'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x1b82('0x3')]);router[_0x1b82('0x4')](_0x1b82('0x5'),auth[_0x1b82('0x6')](),auth['isWebrtcLicence'](),controller[_0x1b82('0x7')]);router[_0x1b82('0x4')](_0x1b82('0x8'),auth[_0x1b82('0x6')](),auth[_0x1b82('0x9')](),controller[_0x1b82('0xa')]);router[_0x1b82('0x4')](_0x1b82('0xb'),auth[_0x1b82('0x6')](),auth['isWebrtcLicence'](),controller[_0x1b82('0xc')]);router[_0x1b82('0x4')](_0x1b82('0xd'),auth[_0x1b82('0x6')](),auth[_0x1b82('0x9')](),controller[_0x1b82('0xe')]);router[_0x1b82('0x4')](_0x1b82('0xf'),auth['isAuthenticated'](),auth[_0x1b82('0x9')](),controller[_0x1b82('0x10')]);router[_0x1b82('0x4')](_0x1b82('0x11'),auth['isAuthenticated'](),auth[_0x1b82('0x9')](),controller['transfer']);module['exports']=router; \ No newline at end of file +var _0xf4eb=['/hangup','isAuthenticated','isWebrtcLicence','hangup','/hold','hold','/unhold','unhold','/calls','calls','transfer','exports','express','/originate','originate','post'];(function(_0x29f768,_0x1fea80){var _0x56cb7c=function(_0x4c0552){while(--_0x4c0552){_0x29f768['push'](_0x29f768['shift']());}};_0x56cb7c(++_0x1fea80);}(_0xf4eb,0xec));var _0xbf4e=function(_0x15e7ff,_0x114e21){_0x15e7ff=_0x15e7ff-0x0;var _0x253e35=_0xf4eb[_0x15e7ff];return _0x253e35;};'use strict';var express=require(_0xbf4e('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router['post'](_0xbf4e('0x1'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbf4e('0x2')]);router[_0xbf4e('0x3')](_0xbf4e('0x4'),auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x3')]('/answer',auth[_0xbf4e('0x5')](),auth['isWebrtcLicence'](),controller['answer']);router[_0xbf4e('0x3')](_0xbf4e('0x8'),auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x3')](_0xbf4e('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbf4e('0xb')]);router['post'](_0xbf4e('0xc'),auth[_0xbf4e('0x5')](),auth['isWebrtcLicence'](),controller[_0xbf4e('0xd')]);router['post']('/transfer',auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xe')]);module[_0xbf4e('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 0357c20..4bb96bc 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 _0x4c4e=['../../config/environment','util','jayson/promise','client','http','webbarapi','redis','defaults','localhost','socket.io-emitter','validate','number','callNumber\x20is\x20required','string','userId\x20is\x20required','sessionId\x20is\x20required','info','stringify','emit','log','handleError:','error','name','status','send','NotFound','request','then','message','catch','findOne','VoiceChannels','filter','rows','sessionId','length','sessionId\x20','\x20not\x20found!','body','json','userId','callNumber','callerId','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','entityFound:','webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','webbar:hold','unhold','webbar:unhold','calls','calls\x20fired:','all','UserId','conference','webbar:conference','transfer','path','../../mysqldb'];(function(_0x40e584,_0x1ae762){var _0x431da3=function(_0x591d27){while(--_0x591d27){_0x40e584['push'](_0x40e584['shift']());}};_0x431da3(++_0x1ae762);}(_0x4c4e,0x152));var _0xe4c4=function(_0x191037,_0x1c33dd){_0x191037=_0x191037-0x0;var _0x2e90bc=_0x4c4e[_0x191037];return _0x2e90bc;};'use strict';var path=require(_0xe4c4('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0xe4c4('0x1'))['db'];var config=require(_0xe4c4('0x2'));var util=require(_0xe4c4('0x3'));var BPromise=require('bluebird');var jayson=require(_0xe4c4('0x4'));var amiClient=jayson[_0xe4c4('0x5')][_0xe4c4('0x6')]({'port':0x232a});var logger=require('../../config/logger')(_0xe4c4('0x7'));var Redis=require('ioredis');config[_0xe4c4('0x8')]=_[_0xe4c4('0x9')](config[_0xe4c4('0x8')],{'host':_0xe4c4('0xa'),'port':0x18eb});var io=require(_0xe4c4('0xb'))(new Redis(config[_0xe4c4('0x8')]));var Schema=require(_0xe4c4('0xc'));var originateValidation=new Schema({'userId':{'type':_0xe4c4('0xd'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0xe4c4('0xe')]},'callerId':{'type':_0xe4c4('0xf')},'callbackUrl':{'type':_0xe4c4('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xe4c4('0xd'),'required':[!![],_0xe4c4('0x10')]},'sessionId':{'type':_0xe4c4('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe4c4('0x10')]},'sessionId':{'type':_0xe4c4('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xe4c4('0xd'),'required':[!![],_0xe4c4('0x10')]},'sessionId':{'type':'string','required':[!![],_0xe4c4('0x11')]},'transferNumber':{'type':_0xe4c4('0xf'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xe4c4('0xd'),'required':[!![],_0xe4c4('0x10')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xe4c4('0xd'),'required':[!![],_0xe4c4('0x10')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xe4c4('0xd'),'required':[!![],_0xe4c4('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0xe4c4('0xd'),'required':[!![],_0xe4c4('0x10')]}});function emit(_0x19e59b,_0x882be2,_0x1f637e){logger[_0xe4c4('0x12')](_0x19e59b,_0x882be2,JSON[_0xe4c4('0x13')](_0x1f637e));io['to'](_0x19e59b)[_0xe4c4('0x14')](_0x882be2,_0x1f637e);}function handleError(_0x23b7e6){return function(_0x42242c){console[_0xe4c4('0x15')](_0xe4c4('0x16'),_0x42242c,_0x42242c instanceof RangeError);logger[_0xe4c4('0x17')](_0x42242c['stack']);if(_0x42242c instanceof RangeError){if(_0x42242c[_0xe4c4('0x18')]){delete _0x42242c[_0xe4c4('0x18')];}_0x23b7e6[_0xe4c4('0x19')](0x194)[_0xe4c4('0x1a')](_0x42242c);}else{if(_0x42242c['name']){delete _0x42242c[_0xe4c4('0x18')];}_0x23b7e6[_0xe4c4('0x19')](0x1f4)[_0xe4c4('0x1a')](_0x42242c);}};}function checkError(){return function(_0x30d56a){if(!_0x30d56a){throw new RangeError(_0xe4c4('0x1b'));}return _0x30d56a;};}function respondWithRpcPromise(_0x435940,_0x1d4597){return new BPromise(function(_0x393c96,_0x21bbb1){var _0x1a7690=amiClient;return _0x1a7690[_0xe4c4('0x1c')](_0x435940,_0x1d4597)[_0xe4c4('0x1d')](function(_0x138ead){if(_0x138ead[_0xe4c4('0x17')]){if(_0x138ead[_0xe4c4('0x17')]['code']===0x1f4){return _0x21bbb1(_0x138ead['error'][_0xe4c4('0x1e')]);}return _0x393c96(_0x138ead['error'][_0xe4c4('0x1e')]);}else{_0x393c96(_0x138ead['result']);}})[_0xe4c4('0x1f')](function(_0x5efc4c){_0x21bbb1(_0x5efc4c);});});}function getAgent(_0x34d667){return db['User'][_0xe4c4('0x20')]({'where':{'id':_0x34d667,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x4cea1f,_0x5d66ab){return new BPromise(function(_0x3221cd,_0x48cfe0){var _0x5b5ea5=respondWithRpcPromise(_0xe4c4('0x21'));var _0x11deab=getAgent(_0x4cea1f);Promise['all']([_0x5b5ea5,_0x11deab])['then'](function(_0x7428ad){var _0x33de43=_0x7428ad[0x0];var _0x4aa6c1=_0x7428ad[0x1];var _0x158432=_[_0xe4c4('0x22')](_0x33de43[_0xe4c4('0x23')],function(_0x48060e){return _0x48060e['UserId']==_0x4aa6c1['id']&&_0x48060e[_0xe4c4('0x24')]==_0x5d66ab;});if(_0x158432[_0xe4c4('0x25')]==0x1){_0x3221cd(_0x4aa6c1);}else{_0x48cfe0(new RangeError(_0xe4c4('0x26')+_0x5d66ab+_0xe4c4('0x27')));}});});}exports['originate']=function(_0x49c913,_0x1731c8){logger[_0xe4c4('0x12')]('originate\x20fired:',_0x49c913[_0xe4c4('0x28')]);var _0x1ad3e6=originateValidation[_0xe4c4('0xc')](_0x49c913['body']);if(_0x1ad3e6[_0xe4c4('0x25')]>0x0){return _0x1731c8['status'](0x190)[_0xe4c4('0x29')](_0x1ad3e6);}var _0x4239ba=_0x49c913[_0xe4c4('0x28')][_0xe4c4('0x2a')];var _0x2bd5c1=_0x49c913[_0xe4c4('0x28')][_0xe4c4('0x2b')];var _0x20a3b0=_0x49c913[_0xe4c4('0x28')][_0xe4c4('0x2c')];var _0x4136a2=_0x49c913[_0xe4c4('0x28')]['callbackUrl'];return getAgent(_0x4239ba)[_0xe4c4('0x1d')](function(_0x25eb81){logger[_0xe4c4('0x12')]('entityFound:',_0x25eb81[_0xe4c4('0x18')]);emit(util[_0xe4c4('0x2d')](_0xe4c4('0x2e'),_0x25eb81['name']),_0xe4c4('0x2f'),{'callNumber':_0x2bd5c1,'callerId':_0x20a3b0,'callbackUrl':_0x4136a2});return _0x1731c8[_0xe4c4('0x19')](0xc8)[_0xe4c4('0x29')]({'error':![],'message':_0xe4c4('0x30')});})[_0xe4c4('0x1f')](handleError(_0x1731c8));};exports[_0xe4c4('0x31')]=function(_0x2f8a21,_0x44f4eb){logger[_0xe4c4('0x12')](_0xe4c4('0x32'),_0x2f8a21['body']);var _0x153df2=hangupValidation[_0xe4c4('0xc')](_0x2f8a21[_0xe4c4('0x28')]);if(_0x153df2[_0xe4c4('0x25')]>0x0){return _0x44f4eb['status'](0x190)[_0xe4c4('0x29')](_0x153df2);}var _0xc50508=_0x2f8a21['body'][_0xe4c4('0x2a')];var _0x185959=_0x2f8a21['body'][_0xe4c4('0x24')];return getAgent(_0xc50508)[_0xe4c4('0x1d')](function(_0x127bcd){logger[_0xe4c4('0x12')](_0xe4c4('0x33'),_0x127bcd[_0xe4c4('0x18')]);emit(util[_0xe4c4('0x2d')](_0xe4c4('0x2e'),_0x127bcd[_0xe4c4('0x18')]),_0xe4c4('0x34'),{'sessionId':_0x185959});return _0x44f4eb[_0xe4c4('0x19')](0xc8)[_0xe4c4('0x29')]({'error':![],'message':'hangup\x20executed!'});})[_0xe4c4('0x1f')](handleError(_0x44f4eb));};exports[_0xe4c4('0x35')]=function(_0x2b306d,_0x2e4c44){logger[_0xe4c4('0x12')](_0xe4c4('0x36'),_0x2b306d['body']);var _0x312a49=answerValidation['validate'](_0x2b306d[_0xe4c4('0x28')]);if(_0x312a49[_0xe4c4('0x25')]>0x0){return _0x2e4c44[_0xe4c4('0x19')](0x190)[_0xe4c4('0x29')](_0x312a49);}var _0x48177f=_0x2b306d['body']['userId'];var _0x23a668=_0x2b306d[_0xe4c4('0x28')][_0xe4c4('0x24')];return getAgent(_0x48177f)['then'](function(_0xaa4bdf){logger[_0xe4c4('0x12')](_0xe4c4('0x33'),_0xaa4bdf[_0xe4c4('0x18')]);emit(util['format'](_0xe4c4('0x2e'),_0xaa4bdf[_0xe4c4('0x18')]),_0xe4c4('0x37'),{'sessionId':_0x23a668});return _0x2e4c44[_0xe4c4('0x19')](0xc8)[_0xe4c4('0x29')]({'error':![],'message':_0xe4c4('0x38')});})[_0xe4c4('0x1f')](handleError(_0x2e4c44));};exports[_0xe4c4('0x39')]=function(_0x3ee4db,_0x5c7c4d){logger[_0xe4c4('0x12')]('hold\x20fired:',_0x3ee4db[_0xe4c4('0x28')]);var _0x7a40c2=holdValidation[_0xe4c4('0xc')](_0x3ee4db[_0xe4c4('0x28')]);if(_0x7a40c2[_0xe4c4('0x25')]>0x0){return _0x5c7c4d[_0xe4c4('0x19')](0x190)[_0xe4c4('0x29')](_0x7a40c2);}var _0xeb6432=_0x3ee4db[_0xe4c4('0x28')][_0xe4c4('0x2a')];var _0x3ff2ae=_0x3ee4db[_0xe4c4('0x28')][_0xe4c4('0x24')];return getAgent(_0xeb6432)[_0xe4c4('0x1d')](function(_0x535bcc){logger['info'](_0xe4c4('0x33'),_0x535bcc[_0xe4c4('0x18')]);emit(util['format'](_0xe4c4('0x2e'),_0x535bcc[_0xe4c4('0x18')]),_0xe4c4('0x3a'),{'sessionId':_0x3ff2ae});return _0x5c7c4d[_0xe4c4('0x19')](0xc8)[_0xe4c4('0x29')]({'error':![],'message':'hold\x20executed!'});})[_0xe4c4('0x1f')](handleError(_0x5c7c4d));};exports[_0xe4c4('0x3b')]=function(_0x4f6e03,_0x2e2d0e){logger[_0xe4c4('0x12')]('unhold\x20fired:',_0x4f6e03[_0xe4c4('0x28')]);var _0x53699d=unholdValidation[_0xe4c4('0xc')](_0x4f6e03[_0xe4c4('0x28')]);if(_0x53699d[_0xe4c4('0x25')]>0x0){return _0x2e2d0e[_0xe4c4('0x19')](0x190)[_0xe4c4('0x29')](_0x53699d);}var _0x525534=_0x4f6e03[_0xe4c4('0x28')][_0xe4c4('0x2a')];var _0x33bcec=_0x4f6e03[_0xe4c4('0x28')][_0xe4c4('0x24')];return getAgent(_0x525534)[_0xe4c4('0x1d')](function(_0x3ddcbe){logger[_0xe4c4('0x12')](_0xe4c4('0x33'),_0x3ddcbe[_0xe4c4('0x18')]);emit(util[_0xe4c4('0x2d')](_0xe4c4('0x2e'),_0x3ddcbe[_0xe4c4('0x18')]),_0xe4c4('0x3c'),{'sessionId':_0x33bcec});return _0x2e2d0e[_0xe4c4('0x19')](0xc8)[_0xe4c4('0x29')]({'error':![],'message':'unhold\x20executed!'});})[_0xe4c4('0x1f')](handleError(_0x2e2d0e));};exports[_0xe4c4('0x3d')]=function(_0x752847,_0x4ad6ac){logger[_0xe4c4('0x12')](_0xe4c4('0x3e'),_0x4ad6ac[_0xe4c4('0x28')]);var _0x512ca9=callsValidation[_0xe4c4('0xc')](_0x752847['body']);if(_0x512ca9[_0xe4c4('0x25')]>0x0){return _0x4ad6ac[_0xe4c4('0x19')](0x190)[_0xe4c4('0x29')](_0x512ca9);}var _0x5b7194=_0x752847['body'][_0xe4c4('0x2a')];var _0x7d4896=respondWithRpcPromise(_0xe4c4('0x21'));var _0x5edcae=getAgent(_0x5b7194);return Promise[_0xe4c4('0x3f')]([_0x7d4896,_0x5edcae])['then'](function(_0x4b93ba){var _0x5a6176=_0x4b93ba[0x0];var _0x4e08ec=_0x4b93ba[0x1];var _0x1ca931=_[_0xe4c4('0x22')](_0x5a6176[_0xe4c4('0x23')],function(_0x2ea066){return _0x2ea066[_0xe4c4('0x40')]==_0x4e08ec['id'];});return _0x4ad6ac[_0xe4c4('0x19')](0xc8)['json']({'count':_0x1ca931[_0xe4c4('0x25')],'rows':_0x1ca931});})[_0xe4c4('0x1f')](handleError(_0x4ad6ac));};exports[_0xe4c4('0x41')]=function(_0x125652,_0x261341){logger[_0xe4c4('0x12')]('conference\x20fired:',_0x125652['body']);var _0x27599b=conferenceValidation[_0xe4c4('0xc')](_0x125652[_0xe4c4('0x28')]);if(_0x27599b[_0xe4c4('0x25')]>0x0){return _0x261341[_0xe4c4('0x19')](0x190)[_0xe4c4('0x29')](_0x27599b);}var _0x1dfc2d=_0x125652[_0xe4c4('0x28')][_0xe4c4('0x2a')];return getAgent(_0x1dfc2d)['then'](function(_0x59f033){logger[_0xe4c4('0x12')]('entityFound:',_0x59f033[_0xe4c4('0x18')]);emit(util[_0xe4c4('0x2d')](_0xe4c4('0x2e'),_0x59f033['name']),_0xe4c4('0x42'));return _0x261341['status'](0xc8)[_0xe4c4('0x29')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x261341));};exports[_0xe4c4('0x43')]=function(_0xd12e2e,_0xfe9714){logger['info']('transfer\x20fired:',_0xd12e2e['body']);var _0x1f91f4=transferValidation[_0xe4c4('0xc')](_0xd12e2e['body']);if(_0x1f91f4[_0xe4c4('0x25')]>0x0){return _0xfe9714[_0xe4c4('0x19')](0x190)[_0xe4c4('0x29')](_0x1f91f4);}var _0x5c389b=_0xd12e2e['body'][_0xe4c4('0x2a')];var _0x2e9185=_0xd12e2e[_0xe4c4('0x28')][_0xe4c4('0x24')];var _0x375aa9=_0xd12e2e[_0xe4c4('0x28')]['transferNumber'];return getAgent(_0x5c389b)[_0xe4c4('0x1d')](function(_0x1bddd5){logger[_0xe4c4('0x12')]('entityFound:',_0x1bddd5[_0xe4c4('0x18')]);emit(util[_0xe4c4('0x2d')](_0xe4c4('0x2e'),_0x1bddd5['name']),'webbar:transfer',{'sessionId':_0x2e9185,'transferNumber':_0x375aa9});return _0xfe9714[_0xe4c4('0x19')](0xc8)['json']({'error':![],'message':'transfer\x20executed!'});})[_0xe4c4('0x1f')](handleError(_0xfe9714));}; \ No newline at end of file +var _0x98e5=['jayson/promise','client','../../config/logger','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','code','message','result','catch','User','findOne','then','VoiceChannels','all','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate','body','userId','callNumber','callerId','entityFound:','user:%s','webbar:originate','json','format','webbar:hangup','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','../../config/environment','util'];(function(_0x4209ee,_0x1876cf){var _0x35dac2=function(_0x4b057c){while(--_0x4b057c){_0x4209ee['push'](_0x4209ee['shift']());}};_0x35dac2(++_0x1876cf);}(_0x98e5,0x8a));var _0x598e=function(_0x1fc7a8,_0x3b9db3){_0x1fc7a8=_0x1fc7a8-0x0;var _0x3ac9a5=_0x98e5[_0x1fc7a8];return _0x3ac9a5;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0x598e('0x0'));var util=require(_0x598e('0x1'));var BPromise=require('bluebird');var jayson=require(_0x598e('0x2'));var amiClient=jayson[_0x598e('0x3')]['http']({'port':0x232a});var logger=require(_0x598e('0x4'))('webbarapi');var Redis=require('ioredis');config[_0x598e('0x5')]=_['defaults'](config[_0x598e('0x5')],{'host':_0x598e('0x6'),'port':0x18eb});var io=require(_0x598e('0x7'))(new Redis(config[_0x598e('0x5')]));var Schema=require(_0x598e('0x8'));var originateValidation=new Schema({'userId':{'type':_0x598e('0x9'),'required':[!![],_0x598e('0xa')]},'callNumber':{'type':_0x598e('0xb'),'required':[!![],_0x598e('0xc')]},'callerId':{'type':_0x598e('0xb')},'callbackUrl':{'type':_0x598e('0xb')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x598e('0xa')]},'sessionId':{'type':_0x598e('0xb'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x598e('0xa')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x598e('0x9'),'required':[!![],_0x598e('0xa')]},'sessionId':{'type':_0x598e('0xb'),'required':[!![],_0x598e('0xd')]},'transferNumber':{'type':_0x598e('0xb'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x598e('0x9'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x598e('0xb'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x598e('0x9'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x598e('0xb'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x598e('0x9'),'required':[!![],_0x598e('0xa')]}});var conferenceValidation=new Schema({'userId':{'type':_0x598e('0x9'),'required':[!![],_0x598e('0xa')]}});function emit(_0x93ba6c,_0x157bb8,_0x4ed7ad){logger[_0x598e('0xe')](_0x93ba6c,_0x157bb8,JSON[_0x598e('0xf')](_0x4ed7ad));io['to'](_0x93ba6c)[_0x598e('0x10')](_0x157bb8,_0x4ed7ad);}function handleError(_0xa59147){return function(_0x50ffbb){console[_0x598e('0x11')](_0x598e('0x12'),_0x50ffbb,_0x50ffbb instanceof RangeError);logger[_0x598e('0x13')](_0x50ffbb[_0x598e('0x14')]);if(_0x50ffbb instanceof RangeError){if(_0x50ffbb[_0x598e('0x15')]){delete _0x50ffbb[_0x598e('0x15')];}_0xa59147[_0x598e('0x16')](0x194)[_0x598e('0x17')](_0x50ffbb);}else{if(_0x50ffbb[_0x598e('0x15')]){delete _0x50ffbb[_0x598e('0x15')];}_0xa59147[_0x598e('0x16')](0x1f4)[_0x598e('0x17')](_0x50ffbb);}};}function checkError(){return function(_0x128666){if(!_0x128666){throw new RangeError(_0x598e('0x18'));}return _0x128666;};}function respondWithRpcPromise(_0x1b47e9,_0xa7579a){return new BPromise(function(_0x233f16,_0x5b9c3){var _0x4a483b=amiClient;return _0x4a483b[_0x598e('0x19')](_0x1b47e9,_0xa7579a)['then'](function(_0xdec363){if(_0xdec363[_0x598e('0x13')]){if(_0xdec363['error'][_0x598e('0x1a')]===0x1f4){return _0x5b9c3(_0xdec363[_0x598e('0x13')][_0x598e('0x1b')]);}return _0x233f16(_0xdec363[_0x598e('0x13')][_0x598e('0x1b')]);}else{_0x233f16(_0xdec363[_0x598e('0x1c')]);}})[_0x598e('0x1d')](function(_0x2a8fbc){_0x5b9c3(_0x2a8fbc);});});}function getAgent(_0x23dd81){return db[_0x598e('0x1e')][_0x598e('0x1f')]({'where':{'id':_0x23dd81,'role':'agent'}})[_0x598e('0x20')](checkError());}function getAgentCheckSession(_0x534d83,_0x475d3a){return new BPromise(function(_0x25e095,_0x21739a){var _0x49a760=respondWithRpcPromise(_0x598e('0x21'));var _0xc81d68=getAgent(_0x534d83);Promise[_0x598e('0x22')]([_0x49a760,_0xc81d68])[_0x598e('0x20')](function(_0x43ddf0){var _0x5ecac3=_0x43ddf0[0x0];var _0x4fad2d=_0x43ddf0[0x1];var _0x5c541c=_[_0x598e('0x23')](_0x5ecac3[_0x598e('0x24')],function(_0x2ee4a5){return _0x2ee4a5[_0x598e('0x25')]==_0x4fad2d['id']&&_0x2ee4a5[_0x598e('0x26')]==_0x475d3a;});if(_0x5c541c[_0x598e('0x27')]==0x1){_0x25e095(_0x4fad2d);}else{_0x21739a(new RangeError('sessionId\x20'+_0x475d3a+_0x598e('0x28')));}});});}exports[_0x598e('0x29')]=function(_0x9922ca,_0x1e5b3f){logger[_0x598e('0xe')]('originate\x20fired:',_0x9922ca[_0x598e('0x2a')]);var _0x3e05b7=originateValidation[_0x598e('0x8')](_0x9922ca['body']);if(_0x3e05b7[_0x598e('0x27')]>0x0){return _0x1e5b3f[_0x598e('0x16')](0x190)['json'](_0x3e05b7);}var _0x366b23=_0x9922ca[_0x598e('0x2a')][_0x598e('0x2b')];var _0x20ef77=_0x9922ca[_0x598e('0x2a')][_0x598e('0x2c')];var _0x4c4baa=_0x9922ca[_0x598e('0x2a')][_0x598e('0x2d')];var _0x2cce05=_0x9922ca['body']['callbackUrl'];return getAgent(_0x366b23)[_0x598e('0x20')](function(_0x4bef09){logger[_0x598e('0xe')](_0x598e('0x2e'),_0x4bef09['name']);emit(util['format'](_0x598e('0x2f'),_0x4bef09['name']),_0x598e('0x30'),{'callNumber':_0x20ef77,'callerId':_0x4c4baa,'callbackUrl':_0x2cce05});return _0x1e5b3f[_0x598e('0x16')](0xc8)[_0x598e('0x31')]({'error':![],'message':'originate\x20executed!'});})[_0x598e('0x1d')](handleError(_0x1e5b3f));};exports['hangup']=function(_0x4c7c19,_0x26948c){logger[_0x598e('0xe')]('hangup\x20fired:',_0x4c7c19['body']);var _0xa3de11=hangupValidation[_0x598e('0x8')](_0x4c7c19['body']);if(_0xa3de11[_0x598e('0x27')]>0x0){return _0x26948c[_0x598e('0x16')](0x190)[_0x598e('0x31')](_0xa3de11);}var _0x20c522=_0x4c7c19[_0x598e('0x2a')][_0x598e('0x2b')];var _0x88c75f=_0x4c7c19['body'][_0x598e('0x26')];return getAgent(_0x20c522)[_0x598e('0x20')](function(_0x2873ee){logger[_0x598e('0xe')](_0x598e('0x2e'),_0x2873ee[_0x598e('0x15')]);emit(util[_0x598e('0x32')](_0x598e('0x2f'),_0x2873ee[_0x598e('0x15')]),_0x598e('0x33'),{'sessionId':_0x88c75f});return _0x26948c[_0x598e('0x16')](0xc8)[_0x598e('0x31')]({'error':![],'message':_0x598e('0x34')});})['catch'](handleError(_0x26948c));};exports['answer']=function(_0x3629d9,_0x10218f){logger[_0x598e('0xe')](_0x598e('0x35'),_0x3629d9['body']);var _0x3799c7=answerValidation[_0x598e('0x8')](_0x3629d9[_0x598e('0x2a')]);if(_0x3799c7['length']>0x0){return _0x10218f[_0x598e('0x16')](0x190)[_0x598e('0x31')](_0x3799c7);}var _0x1b36c7=_0x3629d9[_0x598e('0x2a')][_0x598e('0x2b')];var _0x19eef9=_0x3629d9[_0x598e('0x2a')][_0x598e('0x26')];return getAgent(_0x1b36c7)[_0x598e('0x20')](function(_0x33ecf9){logger[_0x598e('0xe')]('entityFound:',_0x33ecf9['name']);emit(util['format'](_0x598e('0x2f'),_0x33ecf9[_0x598e('0x15')]),_0x598e('0x36'),{'sessionId':_0x19eef9});return _0x10218f['status'](0xc8)[_0x598e('0x31')]({'error':![],'message':_0x598e('0x37')});})[_0x598e('0x1d')](handleError(_0x10218f));};exports['hold']=function(_0x307d2e,_0x1b405b){logger[_0x598e('0xe')]('hold\x20fired:',_0x307d2e[_0x598e('0x2a')]);var _0x2018d3=holdValidation[_0x598e('0x8')](_0x307d2e[_0x598e('0x2a')]);if(_0x2018d3[_0x598e('0x27')]>0x0){return _0x1b405b[_0x598e('0x16')](0x190)['json'](_0x2018d3);}var _0x2c7c8f=_0x307d2e[_0x598e('0x2a')]['userId'];var _0x3804ea=_0x307d2e[_0x598e('0x2a')][_0x598e('0x26')];return getAgent(_0x2c7c8f)['then'](function(_0x59e67b){logger['info'](_0x598e('0x2e'),_0x59e67b[_0x598e('0x15')]);emit(util['format']('user:%s',_0x59e67b[_0x598e('0x15')]),_0x598e('0x38'),{'sessionId':_0x3804ea});return _0x1b405b['status'](0xc8)['json']({'error':![],'message':_0x598e('0x39')});})[_0x598e('0x1d')](handleError(_0x1b405b));};exports[_0x598e('0x3a')]=function(_0x34a43d,_0x5cbe61){logger['info'](_0x598e('0x3b'),_0x34a43d['body']);var _0x36279f=unholdValidation['validate'](_0x34a43d[_0x598e('0x2a')]);if(_0x36279f[_0x598e('0x27')]>0x0){return _0x5cbe61[_0x598e('0x16')](0x190)[_0x598e('0x31')](_0x36279f);}var _0x40eb24=_0x34a43d[_0x598e('0x2a')][_0x598e('0x2b')];var _0x5b06b5=_0x34a43d[_0x598e('0x2a')][_0x598e('0x26')];return getAgent(_0x40eb24)[_0x598e('0x20')](function(_0x358adf){logger['info'](_0x598e('0x2e'),_0x358adf[_0x598e('0x15')]);emit(util[_0x598e('0x32')](_0x598e('0x2f'),_0x358adf[_0x598e('0x15')]),_0x598e('0x3c'),{'sessionId':_0x5b06b5});return _0x5cbe61[_0x598e('0x16')](0xc8)['json']({'error':![],'message':_0x598e('0x3d')});})[_0x598e('0x1d')](handleError(_0x5cbe61));};exports[_0x598e('0x3e')]=function(_0x32d5fe,_0x5226bc){logger[_0x598e('0xe')]('calls\x20fired:',_0x5226bc['body']);var _0x41dd04=callsValidation[_0x598e('0x8')](_0x32d5fe[_0x598e('0x2a')]);if(_0x41dd04[_0x598e('0x27')]>0x0){return _0x5226bc[_0x598e('0x16')](0x190)[_0x598e('0x31')](_0x41dd04);}var _0x386a55=_0x32d5fe[_0x598e('0x2a')][_0x598e('0x2b')];var _0x253afe=respondWithRpcPromise('VoiceChannels');var _0x4d2162=getAgent(_0x386a55);return Promise[_0x598e('0x22')]([_0x253afe,_0x4d2162])[_0x598e('0x20')](function(_0x3919c4){var _0x279007=_0x3919c4[0x0];var _0x37606d=_0x3919c4[0x1];var _0x15c69d=_[_0x598e('0x23')](_0x279007[_0x598e('0x24')],function(_0x2850d0){return _0x2850d0['UserId']==_0x37606d['id'];});return _0x5226bc['status'](0xc8)[_0x598e('0x31')]({'count':_0x15c69d[_0x598e('0x27')],'rows':_0x15c69d});})[_0x598e('0x1d')](handleError(_0x5226bc));};exports['conference']=function(_0x3d294a,_0x2dd358){logger[_0x598e('0xe')](_0x598e('0x3f'),_0x3d294a['body']);var _0x52bf2d=conferenceValidation['validate'](_0x3d294a[_0x598e('0x2a')]);if(_0x52bf2d['length']>0x0){return _0x2dd358[_0x598e('0x16')](0x190)[_0x598e('0x31')](_0x52bf2d);}var _0x199f45=_0x3d294a[_0x598e('0x2a')][_0x598e('0x2b')];return getAgent(_0x199f45)[_0x598e('0x20')](function(_0x10d836){logger['info'](_0x598e('0x2e'),_0x10d836['name']);emit(util[_0x598e('0x32')]('user:%s',_0x10d836[_0x598e('0x15')]),_0x598e('0x40'));return _0x2dd358[_0x598e('0x16')](0xc8)[_0x598e('0x31')]({'error':![],'message':_0x598e('0x41')});})[_0x598e('0x1d')](handleError(_0x2dd358));};exports[_0x598e('0x42')]=function(_0x1a1673,_0x25933e){logger[_0x598e('0xe')](_0x598e('0x43'),_0x1a1673['body']);var _0x49db94=transferValidation[_0x598e('0x8')](_0x1a1673['body']);if(_0x49db94[_0x598e('0x27')]>0x0){return _0x25933e[_0x598e('0x16')](0x190)['json'](_0x49db94);}var _0x558f88=_0x1a1673[_0x598e('0x2a')]['userId'];var _0x6ed2b6=_0x1a1673[_0x598e('0x2a')][_0x598e('0x26')];var _0x15ed32=_0x1a1673[_0x598e('0x2a')]['transferNumber'];return getAgent(_0x558f88)[_0x598e('0x20')](function(_0x5eaefe){logger[_0x598e('0xe')]('entityFound:',_0x5eaefe[_0x598e('0x15')]);emit(util['format']('user:%s',_0x5eaefe[_0x598e('0x15')]),_0x598e('0x44'),{'sessionId':_0x6ed2b6,'transferNumber':_0x15ed32});return _0x25933e[_0x598e('0x16')](0xc8)[_0x598e('0x31')]({'error':![],'message':_0x598e('0x45')});})['catch'](handleError(_0x25933e));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 76915b9..da8025c 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 _0xd117=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/users','getAgents','getApplications','create','post','addDisposition','/:id/canned_answers','addAnswer','addAgents','/:id/applications','/:id/notify','send','put','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout'];(function(_0x594ece,_0x2a1f27){var _0x471bc4=function(_0x31941c){while(--_0x31941c){_0x594ece['push'](_0x594ece['shift']());}};_0x471bc4(++_0x2a1f27);}(_0xd117,0x182));var _0x7d11=function(_0x5944e9,_0xf3da60){_0x5944e9=_0x5944e9-0x0;var _0x1098b8=_0xd117[_0x5944e9];return _0x1098b8;};'use strict';var multer=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var path=require(_0x7d11('0x2'));var timeout=require(_0x7d11('0x3'));var express=require(_0x7d11('0x4'));var router=express[_0x7d11('0x5')]();var fs_extra=require(_0x7d11('0x6'));var auth=require(_0x7d11('0x7'));var interaction=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var controller=require(_0x7d11('0xa'));router[_0x7d11('0xb')]('/',auth[_0x7d11('0xc')](),controller[_0x7d11('0xd')]);router[_0x7d11('0xb')](_0x7d11('0xe'),auth['isAuthenticated'](),controller[_0x7d11('0xf')]);router[_0x7d11('0xb')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x11')]);router[_0x7d11('0xb')](_0x7d11('0x12'),auth['isAuthenticated'](),controller[_0x7d11('0x13')]);router['get']('/:id/canned_answers',auth[_0x7d11('0xc')](),controller['getAnswers']);router['get'](_0x7d11('0x14'),auth['isAuthenticated'](),controller[_0x7d11('0x15')]);router[_0x7d11('0xb')]('/:id/applications',auth[_0x7d11('0xc')](),controller[_0x7d11('0x16')]);router['post']('/',auth[_0x7d11('0xc')](),controller[_0x7d11('0x17')]);router[_0x7d11('0x18')](_0x7d11('0x12'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x19')]);router[_0x7d11('0x18')](_0x7d11('0x1a'),auth['isAuthenticated'](),controller[_0x7d11('0x1b')]);router[_0x7d11('0x18')](_0x7d11('0x14'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x1c')]);router['post'](_0x7d11('0x1d'),auth[_0x7d11('0xc')](),controller['addApplications']);router['post'](_0x7d11('0x1e'),controller['notify']);router[_0x7d11('0x18')]('/:id/send',auth[_0x7d11('0xc')](),controller[_0x7d11('0x1f')]);router[_0x7d11('0x20')](_0x7d11('0x10'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x21')]);router[_0x7d11('0x22')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x23')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x7d11('0x24')]);router[_0x7d11('0x22')](_0x7d11('0x1a'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x25')]);router[_0x7d11('0x22')](_0x7d11('0x14'),auth[_0x7d11('0xc')](),controller['removeAgents']);module[_0x7d11('0x26')]=router; \ No newline at end of file +var _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','/:id/canned_answers','addAgents','addApplications','notify','send','put','update','delete','destroy','removeAnswers','exports'];(function(_0x336fb8,_0x17f2cf){var _0x3f043f=function(_0x53c524){while(--_0x53c524){_0x336fb8['push'](_0x336fb8['shift']());}};_0x3f043f(++_0x17f2cf);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./whatsappAccount.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['show']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/canned_answers',auth[_0x65f6('0x8')](),controller['getAnswers']);router['get'](_0x65f6('0xe'),auth['isAuthenticated'](),controller[_0x65f6('0xf')]);router['get'](_0x65f6('0x10'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);router[_0x65f6('0x12')]('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0x13')]);router[_0x65f6('0x12')](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x14')]);router['post'](_0x65f6('0x15'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x65f6('0x12')](_0x65f6('0xe'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x16')]);router[_0x65f6('0x12')](_0x65f6('0x10'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x17')]);router['post']('/:id/notify',controller[_0x65f6('0x18')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x65f6('0x19')]);router[_0x65f6('0x1a')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0x1b')]);router[_0x65f6('0x1c')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1d')]);router['delete'](_0x65f6('0xc'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x65f6('0x1c')](_0x65f6('0x15'),auth['isAuthenticated'](),controller[_0x65f6('0x1e')]);router[_0x65f6('0x1c')](_0x65f6('0xe'),auth[_0x65f6('0x8')](),controller['removeAgents']);module[_0x65f6('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 45f530b..f5ac8ab 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 _0x7171=['STRING','generate','ENUM','twilio','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','name'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x7171,0xa1));var _0x1717=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x7171[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require(_0x1717('0x0'));var rs=require(_0x1717('0x1'));module[_0x1717('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x1717('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x1717('0x4')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x1717('0x5')]();}},'phone':{'type':Sequelize[_0x1717('0x4')]},'type':{'type':Sequelize[_0x1717('0x6')](_0x1717('0x7'),_0x1717('0x8'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x1717('0x4')]},'authToken':{'type':Sequelize[_0x1717('0x4')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x1717('0x9');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x1717('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1717('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1717('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1717('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1717('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1717('0xb')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1717('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x220aaf){if(!_0x220aaf){this['setDataValue'](_0x1717('0xc'),null);}this[_0x1717('0xd')](_0x1717('0xe'),_0x220aaf);}},'description':{'type':Sequelize[_0x1717('0x4')]}}; \ No newline at end of file +var _0xf9fd=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring','name','STRING','ENUM','twilio','sinch'];(function(_0x3d2768,_0x5ceeb8){var _0x5a3eee=function(_0x8f2d41){while(--_0x8f2d41){_0x3d2768['push'](_0x3d2768['shift']());}};_0x5a3eee(++_0x5ceeb8);}(_0xf9fd,0x19d));var _0xdf9f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf9fd[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xdf9f('0x0'));var rs=require(_0xdf9f('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xdf9f('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xdf9f('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xdf9f('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xdf9f('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xdf9f('0x4')](_0xdf9f('0x5'),_0xdf9f('0x6'))},'accountSid':{'type':Sequelize[_0xdf9f('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xdf9f('0x7')],'defaultValue':function(){return _0xdf9f('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xdf9f('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdf9f('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdf9f('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdf9f('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdf9f('0xa')],'comment':_0xdf9f('0xb')},'mandatoryDisposition':{'type':Sequelize[_0xdf9f('0x9')],'defaultValue':![],'comment':_0xdf9f('0xc'),'set':function(_0x7dc87){if(!_0x7dc87){this[_0xdf9f('0xd')]('mandatoryDispositionPauseId',null);}this[_0xdf9f('0xd')]('mandatoryDisposition',_0x7dc87);}},'description':{'type':Sequelize[_0xdf9f('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 865b001..0ebab19 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 _0x7789=['offset','set','Content-Range','reject','update','then','destroy','get','sendStatus','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','hasOwnProperty','findAll','rows','removeDispositions','CannedAnswer','findOne','removeAnswers','ids','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','sequelize','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','timestamp','message_id','applications','orderBy','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','twilio','from','replace','Body','messageId','notifications','isNil','ValidationError','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','DESC','list','Contacts','WhatsappInteraction','interaction','created','autoclose','close','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','ListId','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','end','json','undefined','limit','count'];(function(_0x401ad1,_0x2f1962){var _0x18bb19=function(_0x1d1403){while(--_0x1d1403){_0x401ad1['push'](_0x401ad1['shift']());}};_0x18bb19(++_0x2f1962);}(_0x7789,0x8e));var _0x9778=function(_0x13a29e,_0x478d71){_0x13a29e=_0x13a29e-0x0;var _0x252406=_0x7789[_0x13a29e];return _0x252406;};'use strict';var emlformat=require(_0x9778('0x0'));var rimraf=require(_0x9778('0x1'));var zipdir=require(_0x9778('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9778('0x3'));var moment=require(_0x9778('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9778('0x5'));var util=require(_0x9778('0x6'));var path=require(_0x9778('0x7'));var sox=require(_0x9778('0x8'));var csv=require(_0x9778('0x9'));var ejs=require(_0x9778('0xa'));var fs=require('fs');var fs_extra=require(_0x9778('0xb'));var _=require(_0x9778('0xc'));var squel=require(_0x9778('0xd'));var crypto=require(_0x9778('0xe'));var jsforce=require(_0x9778('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9778('0x9'));var querystring=require(_0x9778('0x10'));var Papa=require(_0x9778('0x11'));var Redis=require(_0x9778('0x12'));var authService=require(_0x9778('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9778('0x14'));var hardwareService=require(_0x9778('0x15'));var logger=require(_0x9778('0x16'))(_0x9778('0x17'));var utils=require(_0x9778('0x18'));var config=require(_0x9778('0x19'));var licenseUtil=require(_0x9778('0x1a'));var db=require(_0x9778('0x1b'))['db'];config[_0x9778('0x1c')]=_[_0x9778('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9778('0x1e'))(new Redis(config[_0x9778('0x1c')]));require(_0x9778('0x1f'))[_0x9778('0x20')](socket);var jayson=require(_0x9778('0x21'));var client=jayson[_0x9778('0x22')][_0x9778('0x23')]({'port':0x232c});function respondWithRpcPromise(_0xa769d0,_0x25abbd,_0x121633,_0x5e0bc1){return new BPromise(function(_0x47aede,_0x20adf1){var _0x4d85f9=_0x5e0bc1||client;return _0x4d85f9[_0x9778('0x24')](_0xa769d0,_0x121633)['then'](function(_0x3c5941){logger[_0x9778('0x25')](_0x9778('0x26'),_0x25abbd,_0x9778('0x27'));logger['debug'](_0x9778('0x28'),_0x25abbd,_0x9778('0x27'),JSON[_0x9778('0x29')](_0x3c5941));if(_0x3c5941['error']){if(_0x3c5941[_0x9778('0x2a')]['code']===0x1f4){logger[_0x9778('0x2a')](_0x9778('0x26'),_0x25abbd,_0x3c5941[_0x9778('0x2a')][_0x9778('0x2b')]);return _0x20adf1(_0x3c5941['error'][_0x9778('0x2b')]);}logger[_0x9778('0x2a')](_0x9778('0x26'),_0x25abbd,_0x3c5941[_0x9778('0x2a')][_0x9778('0x2b')]);return _0x47aede(_0x3c5941['error'][_0x9778('0x2b')]);}else{logger['info'](_0x9778('0x26'),_0x25abbd,_0x9778('0x27'));_0x47aede(_0x3c5941[_0x9778('0x2c')][_0x9778('0x2b')]);}})['catch'](function(_0x338e90){logger[_0x9778('0x2a')](_0x9778('0x26'),_0x25abbd,_0x338e90);_0x20adf1(_0x338e90);});});}function respondWithStatusCode(_0x56dce0,_0x14cd8c){_0x14cd8c=_0x14cd8c||0xcc;return function(_0x446594){if(_0x446594){return _0x56dce0['sendStatus'](_0x14cd8c);}return _0x56dce0[_0x9778('0x2d')](_0x14cd8c)[_0x9778('0x2e')]();};}function respondWithResult(_0x13c60f,_0x1afa06){_0x1afa06=_0x1afa06||0xc8;return function(_0x3c5b93){if(_0x3c5b93){return _0x13c60f[_0x9778('0x2d')](_0x1afa06)[_0x9778('0x2f')](_0x3c5b93);}};}function respondWithFilteredResult(_0x1a45a1,_0x8903cb){return function(_0x219b8e){if(_0x219b8e){var _0x3e2d2a=typeof _0x8903cb['offset']===_0x9778('0x30')&&typeof _0x8903cb[_0x9778('0x31')]===_0x9778('0x30');var _0x353d2a=_0x219b8e[_0x9778('0x32')];var _0x102c41=_0x3e2d2a?0x0:_0x8903cb[_0x9778('0x33')];var _0x47aa41=_0x3e2d2a?_0x219b8e['count']:_0x8903cb[_0x9778('0x33')]+_0x8903cb[_0x9778('0x31')];var _0x484942;if(_0x47aa41>=_0x353d2a){_0x47aa41=_0x353d2a;_0x484942=0xc8;}else{_0x484942=0xce;}_0x1a45a1[_0x9778('0x2d')](_0x484942);return _0x1a45a1[_0x9778('0x34')](_0x9778('0x35'),_0x102c41+'-'+_0x47aa41+'/'+_0x353d2a)[_0x9778('0x2f')](_0x219b8e);}return null;};}function patchUpdates(_0x38c992){return function(_0x35556b){try{jsonpatch['apply'](_0x35556b,_0x38c992,!![]);}catch(_0x504b38){return BPromise[_0x9778('0x36')](_0x504b38);}return _0x35556b['save']();};}function saveUpdates(_0x3433f1,_0x25616f){return function(_0x49abd4){if(_0x49abd4){return _0x49abd4[_0x9778('0x37')](_0x3433f1)[_0x9778('0x38')](function(_0x112d2c){return _0x112d2c;});}return null;};}function removeEntity(_0xbb6436,_0x5d8bbc){return function(_0x3a47a9){if(_0x3a47a9){return _0x3a47a9[_0x9778('0x39')]()[_0x9778('0x38')](function(){var _0x59d965=_0x3a47a9[_0x9778('0x3a')]({'plain':!![]});var _0x4dedd6='WhatsappAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x4dedd6,'resourceId':_0x59d965['id']}})[_0x9778('0x38')](function(){return _0x3a47a9;});})[_0x9778('0x38')](function(){_0xbb6436[_0x9778('0x2d')](0xcc)[_0x9778('0x2e')]();});}};}function handleEntityNotFound(_0x1e415a,_0x19999a){return function(_0x1e5aa8){if(!_0x1e5aa8){_0x1e415a[_0x9778('0x3b')](0x194);}return _0x1e5aa8;};}function handleError(_0x218079,_0x3f4a3b){_0x3f4a3b=_0x3f4a3b||0x1f4;return function(_0x20fcf){logger[_0x9778('0x2a')](_0x20fcf['stack']);if(_0x20fcf[_0x9778('0x3c')]){delete _0x20fcf[_0x9778('0x3c')];}_0x218079[_0x9778('0x2d')](_0x3f4a3b)[_0x9778('0x3d')](_0x20fcf);};}exports[_0x9778('0x3e')]=function(_0x395259,_0x16f5f1){var _0x1785f6={'include':[{'model':db[_0x9778('0x3f')],'as':_0x9778('0x40')}]},_0x1aaba2={},_0x30ac92={'count':0x0,'rows':[]};var _0xbcd2d6=_[_0x9778('0x41')](db[_0x9778('0x42')][_0x9778('0x43')],function(_0xe4ddb8){return{'name':_0xe4ddb8[_0x9778('0x44')],'type':_0xe4ddb8[_0x9778('0x45')][_0x9778('0x46')]};});_0x1aaba2['model']=_[_0x9778('0x41')](_0xbcd2d6,'name');_0x1aaba2[_0x9778('0x47')]=_[_0x9778('0x48')](_0x395259[_0x9778('0x47')]);_0x1aaba2['filters']=_[_0x9778('0x49')](_0x1aaba2[_0x9778('0x4a')],_0x1aaba2[_0x9778('0x47')]);_0x1785f6[_0x9778('0x4b')]=_[_0x9778('0x49')](_0x1aaba2[_0x9778('0x4a')],qs[_0x9778('0x4c')](_0x395259[_0x9778('0x47')][_0x9778('0x4c')]));_0x1785f6[_0x9778('0x4b')]=_0x1785f6[_0x9778('0x4b')][_0x9778('0x4d')]?_0x1785f6[_0x9778('0x4b')]:_0x1aaba2[_0x9778('0x4a')];if(!_0x395259[_0x9778('0x47')]['hasOwnProperty'](_0x9778('0x4e'))){_0x1785f6['limit']=qs[_0x9778('0x31')](_0x395259['query'][_0x9778('0x31')]);_0x1785f6[_0x9778('0x33')]=qs[_0x9778('0x33')](_0x395259['query'][_0x9778('0x33')]);}_0x1785f6[_0x9778('0x4f')]=qs[_0x9778('0x50')](_0x395259[_0x9778('0x47')][_0x9778('0x50')]);_0x1785f6['where']=qs[_0x9778('0x51')](_[_0x9778('0x52')](_0x395259[_0x9778('0x47')],_0x1aaba2[_0x9778('0x51')]),_0xbcd2d6);if(_0x395259['query'][_0x9778('0x53')]){_0x1785f6[_0x9778('0x54')]=_[_0x9778('0x55')](_0x1785f6[_0x9778('0x54')],{'$or':_[_0x9778('0x41')](_0xbcd2d6,function(_0x14b3a2){if(_0x14b3a2['type']!=='VIRTUAL'){var _0x441329={};_0x441329[_0x14b3a2[_0x9778('0x3c')]]={'$like':'%'+_0x395259[_0x9778('0x47')][_0x9778('0x53')]+'%'};return _0x441329;}})});}_0x1785f6=_[_0x9778('0x55')]({},_0x1785f6,_0x395259[_0x9778('0x56')]);var _0x13bcc4={'where':_0x1785f6[_0x9778('0x54')]};return db[_0x9778('0x42')]['count'](_0x13bcc4)[_0x9778('0x38')](function(_0x4387a5){_0x30ac92[_0x9778('0x32')]=_0x4387a5;if(_0x395259[_0x9778('0x47')][_0x9778('0x57')]){_0x1785f6[_0x9778('0x58')]=[{'all':!![]}];}return db[_0x9778('0x42')]['findAll'](_0x1785f6);})[_0x9778('0x38')](function(_0x5b1557){_0x30ac92['rows']=_0x5b1557;return _0x30ac92;})['then'](respondWithFilteredResult(_0x16f5f1,_0x1785f6))[_0x9778('0x59')](handleError(_0x16f5f1,null));};exports[_0x9778('0x5a')]=function(_0x266b3e,_0x54e8d6){var _0x4297ab={'raw':![],'where':{'id':_0x266b3e[_0x9778('0x5b')]['id']},'include':[{'model':db[_0x9778('0x3f')],'as':_0x9778('0x40')}]},_0x570483={};_0x570483[_0x9778('0x4a')]=_[_0x9778('0x48')](db[_0x9778('0x42')][_0x9778('0x43')]);_0x570483[_0x9778('0x47')]=_[_0x9778('0x48')](_0x266b3e[_0x9778('0x47')]);_0x570483[_0x9778('0x51')]=_[_0x9778('0x49')](_0x570483[_0x9778('0x4a')],_0x570483[_0x9778('0x47')]);_0x4297ab[_0x9778('0x4b')]=_[_0x9778('0x49')](_0x570483[_0x9778('0x4a')],qs[_0x9778('0x4c')](_0x266b3e[_0x9778('0x47')]['fields']));_0x4297ab[_0x9778('0x4b')]=_0x4297ab[_0x9778('0x4b')][_0x9778('0x4d')]?_0x4297ab['attributes']:_0x570483['model'];if(_0x266b3e[_0x9778('0x47')][_0x9778('0x57')]){_0x4297ab[_0x9778('0x58')]=[{'all':!![]}];}_0x4297ab=_['merge']({},_0x4297ab,_0x266b3e['options']);return db[_0x9778('0x42')][_0x9778('0x5c')](_0x4297ab)['then'](handleEntityNotFound(_0x54e8d6,null))[_0x9778('0x38')](respondWithResult(_0x54e8d6,null))['catch'](handleError(_0x54e8d6,null));};exports[_0x9778('0x5d')]=function(_0x4503c5,_0x26020a){return db[_0x9778('0x42')][_0x9778('0x5d')](_0x4503c5[_0x9778('0x5e')],{})[_0x9778('0x38')](function(_0x26466c){var _0x1065e5=_0x4503c5[_0x9778('0x5f')][_0x9778('0x3a')]({'plain':!![]});if(!_0x1065e5)throw new Error(_0x9778('0x60'));if(_0x1065e5['role']==='user'){var _0x2a2ce8=_0x26466c[_0x9778('0x3a')]({'plain':!![]});var _0x48f33d='WhatsappAccounts';return db[_0x9778('0x61')][_0x9778('0x5c')]({'where':{'name':_0x48f33d,'userProfileId':_0x1065e5[_0x9778('0x62')]},'raw':!![]})[_0x9778('0x38')](function(_0x437e9d){if(_0x437e9d&&_0x437e9d[_0x9778('0x63')]===0x0){return db['UserProfileResource'][_0x9778('0x5d')]({'name':_0x2a2ce8[_0x9778('0x3c')],'resourceId':_0x2a2ce8['id'],'type':_0x437e9d['name'],'sectionId':_0x437e9d['id']},{})[_0x9778('0x38')](function(){return _0x26466c;});}else{return _0x26466c;}})[_0x9778('0x59')](function(_0x37c229){logger[_0x9778('0x2a')](_0x9778('0x64'),_0x37c229);throw _0x37c229;});}return _0x26466c;})[_0x9778('0x38')](respondWithResult(_0x26020a,0xc9))[_0x9778('0x59')](handleError(_0x26020a,null));};exports[_0x9778('0x37')]=function(_0x47164a,_0x549b85){if(_0x47164a[_0x9778('0x5e')]['id']){delete _0x47164a[_0x9778('0x5e')]['id'];}return db[_0x9778('0x42')][_0x9778('0x5c')]({'where':{'id':_0x47164a['params']['id']},'include':[{'model':db[_0x9778('0x3f')],'as':_0x9778('0x40')}]})['then'](handleEntityNotFound(_0x549b85,null))[_0x9778('0x38')](saveUpdates(_0x47164a[_0x9778('0x5e')],null))[_0x9778('0x38')](respondWithResult(_0x549b85,null))[_0x9778('0x59')](handleError(_0x549b85,null));};exports[_0x9778('0x39')]=function(_0x46af0a,_0xd5f4d6){return db[_0x9778('0x42')][_0x9778('0x5c')]({'where':{'id':_0x46af0a[_0x9778('0x5b')]['id']}})[_0x9778('0x38')](handleEntityNotFound(_0xd5f4d6,null))[_0x9778('0x38')](removeEntity(_0xd5f4d6,null))['catch'](handleError(_0xd5f4d6,null));};exports[_0x9778('0x65')]=function(_0x43405b,_0xa797a){return db[_0x9778('0x42')][_0x9778('0x65')]()[_0x9778('0x38')](respondWithResult(_0xa797a,null))['catch'](handleError(_0xa797a,null));};exports[_0x9778('0x66')]=function(_0xcde14d,_0x1f8de8,_0x502fb2){if(_0xcde14d[_0x9778('0x5e')]['id']){delete _0xcde14d[_0x9778('0x5e')]['id'];}return db[_0x9778('0x42')]['find']({'where':{'id':_0xcde14d[_0x9778('0x5b')]['id']}})[_0x9778('0x38')](handleEntityNotFound(_0x1f8de8,null))['then'](function(_0x489a77){if(_0x489a77){_0xcde14d[_0x9778('0x5e')][_0x9778('0x67')]=_0x489a77['id'];return db[_0x9778('0x68')][_0x9778('0x5d')](_0xcde14d[_0x9778('0x5e')]);}})[_0x9778('0x38')](respondWithResult(_0x1f8de8,null))[_0x9778('0x59')](handleError(_0x1f8de8,null));};exports[_0x9778('0x69')]=function(_0x2e503f,_0x2dad83,_0x376d8f){var _0x459847={'raw':![],'where':{}};var _0x5a2869={};var _0x2c4e6a={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x2e503f[_0x9778('0x5b')]['id']}})[_0x9778('0x38')](handleEntityNotFound(_0x2dad83,null))['then'](function(_0x328023){if(_0x328023){_0x5a2869[_0x9778('0x4a')]=_[_0x9778('0x48')](db[_0x9778('0x68')][_0x9778('0x43')]);_0x5a2869[_0x9778('0x47')]=_[_0x9778('0x48')](_0x2e503f[_0x9778('0x47')]);_0x5a2869['filters']=_[_0x9778('0x49')](_0x5a2869[_0x9778('0x4a')],_0x5a2869[_0x9778('0x47')]);_0x459847[_0x9778('0x4b')]=_['intersection'](_0x5a2869[_0x9778('0x4a')],qs[_0x9778('0x4c')](_0x2e503f[_0x9778('0x47')][_0x9778('0x4c')]));_0x459847['attributes']=_0x459847['attributes'][_0x9778('0x4d')]?_0x459847['attributes']:_0x5a2869[_0x9778('0x4a')];if(!_0x2e503f[_0x9778('0x47')][_0x9778('0x6a')](_0x9778('0x4e'))){_0x459847[_0x9778('0x31')]=qs[_0x9778('0x31')](_0x2e503f[_0x9778('0x47')]['limit']);_0x459847[_0x9778('0x33')]=qs['offset'](_0x2e503f[_0x9778('0x47')]['offset']);}_0x459847['order']=qs[_0x9778('0x50')](_0x2e503f['query'][_0x9778('0x50')]);_0x459847[_0x9778('0x54')]=qs[_0x9778('0x51')](_[_0x9778('0x52')](_0x2e503f[_0x9778('0x47')],_0x5a2869['filters']));_0x459847[_0x9778('0x54')][_0x9778('0x67')]=_0x328023['id'];if(_0x2e503f[_0x9778('0x47')]['filter']){_0x459847[_0x9778('0x54')]=_['merge'](_0x459847['where'],{'$or':_[_0x9778('0x41')](_0x459847[_0x9778('0x4b')],function(_0x56faf){var _0x51a4a5={};_0x51a4a5[_0x56faf]={'$like':'%'+_0x2e503f[_0x9778('0x47')]['filter']+'%'};return _0x51a4a5;})});}_0x459847=_[_0x9778('0x55')]({},_0x459847,_0x2e503f[_0x9778('0x56')]);return db['Disposition'][_0x9778('0x32')]({'where':_0x459847['where']})[_0x9778('0x38')](function(_0x179058){_0x2c4e6a[_0x9778('0x32')]=_0x179058;if(_0x2e503f[_0x9778('0x47')][_0x9778('0x57')]){_0x459847[_0x9778('0x58')]=[{'all':!![]}];}return db['Disposition'][_0x9778('0x6b')](_0x459847);})[_0x9778('0x38')](function(_0x363fe2){_0x2c4e6a[_0x9778('0x6c')]=_0x363fe2;return _0x2c4e6a;});}})[_0x9778('0x38')](respondWithFilteredResult(_0x2dad83,_0x459847))[_0x9778('0x59')](handleError(_0x2dad83,null));};exports[_0x9778('0x6d')]=function(_0x40a607,_0x5270cf,_0x118d4d){return db[_0x9778('0x42')][_0x9778('0x5c')]({'where':{'id':_0x40a607[_0x9778('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5270cf,null))[_0x9778('0x38')](function(_0x362bcd){if(_0x362bcd){return _0x362bcd[_0x9778('0x6d')](_0x40a607[_0x9778('0x47')]['ids']);}})[_0x9778('0x38')](respondWithStatusCode(_0x5270cf,null))[_0x9778('0x59')](handleError(_0x5270cf,null));};exports['addAnswer']=function(_0x4a0f98,_0x10fef5,_0x2fed74){if(_0x4a0f98[_0x9778('0x5e')]['id']){delete _0x4a0f98[_0x9778('0x5e')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x4a0f98['params']['id']}})['then'](handleEntityNotFound(_0x10fef5,null))[_0x9778('0x38')](function(_0x50c39c){if(_0x50c39c){_0x4a0f98[_0x9778('0x5e')]['WhatsappAccountId']=_0x50c39c['id'];return db[_0x9778('0x6e')][_0x9778('0x5d')](_0x4a0f98[_0x9778('0x5e')]);}})[_0x9778('0x38')](respondWithResult(_0x10fef5,null))['catch'](handleError(_0x10fef5,null));};exports['getAnswers']=function(_0x2b7f48,_0x5319b4,_0x1953b1){var _0x9fc0e5={'raw':![],'where':{}};var _0xd01b83={};var _0x351c23={'count':0x0,'rows':[]};return db[_0x9778('0x42')][_0x9778('0x6f')]({'where':{'id':_0x2b7f48['params']['id']}})[_0x9778('0x38')](handleEntityNotFound(_0x5319b4,null))[_0x9778('0x38')](function(_0x2a2f5e){if(_0x2a2f5e){_0xd01b83[_0x9778('0x4a')]=_[_0x9778('0x48')](db[_0x9778('0x6e')]['rawAttributes']);_0xd01b83['query']=_[_0x9778('0x48')](_0x2b7f48[_0x9778('0x47')]);_0xd01b83[_0x9778('0x51')]=_['intersection'](_0xd01b83['model'],_0xd01b83[_0x9778('0x47')]);_0x9fc0e5[_0x9778('0x4b')]=_[_0x9778('0x49')](_0xd01b83[_0x9778('0x4a')],qs['fields'](_0x2b7f48[_0x9778('0x47')][_0x9778('0x4c')]));_0x9fc0e5['attributes']=_0x9fc0e5[_0x9778('0x4b')][_0x9778('0x4d')]?_0x9fc0e5[_0x9778('0x4b')]:_0xd01b83[_0x9778('0x4a')];if(!_0x2b7f48[_0x9778('0x47')][_0x9778('0x6a')](_0x9778('0x4e'))){_0x9fc0e5[_0x9778('0x31')]=qs[_0x9778('0x31')](_0x2b7f48[_0x9778('0x47')][_0x9778('0x31')]);_0x9fc0e5[_0x9778('0x33')]=qs[_0x9778('0x33')](_0x2b7f48[_0x9778('0x47')][_0x9778('0x33')]);}_0x9fc0e5[_0x9778('0x4f')]=qs[_0x9778('0x50')](_0x2b7f48['query'][_0x9778('0x50')]);_0x9fc0e5[_0x9778('0x54')]=qs[_0x9778('0x51')](_[_0x9778('0x52')](_0x2b7f48['query'],_0xd01b83['filters']));_0x9fc0e5[_0x9778('0x54')]['WhatsappAccountId']=_0x2a2f5e['id'];if(_0x2b7f48[_0x9778('0x47')][_0x9778('0x53')]){_0x9fc0e5[_0x9778('0x54')]=_[_0x9778('0x55')](_0x9fc0e5[_0x9778('0x54')],{'$or':_['map'](_0x9fc0e5[_0x9778('0x4b')],function(_0x191f88){var _0x359a5a={};_0x359a5a[_0x191f88]={'$like':'%'+_0x2b7f48[_0x9778('0x47')][_0x9778('0x53')]+'%'};return _0x359a5a;})});}_0x9fc0e5=_[_0x9778('0x55')]({},_0x9fc0e5,_0x2b7f48[_0x9778('0x56')]);return db[_0x9778('0x6e')][_0x9778('0x32')]({'where':_0x9fc0e5[_0x9778('0x54')]})[_0x9778('0x38')](function(_0x48493d){_0x351c23[_0x9778('0x32')]=_0x48493d;if(_0x2b7f48[_0x9778('0x47')][_0x9778('0x57')]){_0x9fc0e5[_0x9778('0x58')]=[{'all':!![]}];}return db[_0x9778('0x6e')]['findAll'](_0x9fc0e5);})[_0x9778('0x38')](function(_0x14d848){_0x351c23[_0x9778('0x6c')]=_0x14d848;return _0x351c23;});}})[_0x9778('0x38')](respondWithFilteredResult(_0x5319b4,_0x9fc0e5))[_0x9778('0x59')](handleError(_0x5319b4,null));};exports[_0x9778('0x70')]=function(_0x192d4c,_0x30c94a,_0x28d4f3){return db['WhatsappAccount']['find']({'where':{'id':_0x192d4c[_0x9778('0x5b')]['id']}})[_0x9778('0x38')](handleEntityNotFound(_0x30c94a,null))[_0x9778('0x38')](function(_0x537133){if(_0x537133){return _0x537133[_0x9778('0x70')](_0x192d4c[_0x9778('0x47')][_0x9778('0x71')]);}})[_0x9778('0x38')](respondWithStatusCode(_0x30c94a,null))['catch'](handleError(_0x30c94a,null));};exports[_0x9778('0x72')]=function(_0x36b6c5,_0x474056,_0x1779fd){return db[_0x9778('0x42')][_0x9778('0x5c')]({'where':{'id':_0x36b6c5[_0x9778('0x5b')]['id']}})['then'](handleEntityNotFound(_0x474056,null))[_0x9778('0x38')](function(_0x47be8e){if(_0x47be8e){return _0x47be8e['addAgents'](_0x36b6c5[_0x9778('0x5e')]['ids'],_[_0x9778('0x73')](_0x36b6c5[_0x9778('0x5e')],[_0x9778('0x71'),'id'])||{})[_0x9778('0x74')](function(_0x3c6ffa){for(var _0x4dc902=0x0;_0x4dc902<_0x36b6c5[_0x9778('0x5e')][_0x9778('0x71')][_0x9778('0x4d')];_0x4dc902+=0x1){socket[_0x9778('0x75')](_0x9778('0x76'),{'UserId':Number(_0x36b6c5['body'][_0x9778('0x71')][_0x4dc902]),'WhatsappAccountId':Number(_0x36b6c5[_0x9778('0x5b')]['id'])});}return _0x3c6ffa;});}})['then'](respondWithResult(_0x474056,null))[_0x9778('0x59')](handleError(_0x474056,null));};exports[_0x9778('0x77')]=function(_0x399f1a,_0x320895,_0x3b7348){return db[_0x9778('0x42')][_0x9778('0x5c')]({'where':{'id':_0x399f1a[_0x9778('0x5b')]['id']}})[_0x9778('0x38')](handleEntityNotFound(_0x320895,null))['then'](function(_0x4a208b){if(_0x4a208b){return _0x4a208b['removeAgents'](_0x399f1a['query'][_0x9778('0x71')])[_0x9778('0x38')](function(){if(_[_0x9778('0x78')](_0x399f1a[_0x9778('0x47')]['ids'])){for(var _0x1565f2=0x0;_0x1565f2<_0x399f1a[_0x9778('0x47')]['ids'][_0x9778('0x4d')];_0x1565f2+=0x1){socket[_0x9778('0x75')](_0x9778('0x79'),{'UserId':Number(_0x399f1a[_0x9778('0x47')]['ids'][_0x1565f2]),'WhatsappAccountId':Number(_0x399f1a[_0x9778('0x5b')]['id'])});}}else{socket[_0x9778('0x75')]('userWhatsappAccount:remove',{'UserId':Number(_0x399f1a['query'][_0x9778('0x71')]),'WhatsappAccountId':Number(_0x399f1a['params']['id'])});}});}})['then'](respondWithStatusCode(_0x320895,null))[_0x9778('0x59')](handleError(_0x320895,null));};exports[_0x9778('0x7a')]=function(_0x49e530,_0x3ee782,_0x15e879){var _0x403fde={};var _0x1ce0d1={};var _0x48669b;var _0x47cfe8;return db['WhatsappAccount']['findOne']({'where':{'id':_0x49e530[_0x9778('0x5b')]['id']}})[_0x9778('0x38')](handleEntityNotFound(_0x3ee782,null))[_0x9778('0x38')](function(_0x141705){if(_0x141705){_0x48669b=_0x141705;_0x1ce0d1[_0x9778('0x4a')]=_[_0x9778('0x48')](db['User']['rawAttributes']);_0x1ce0d1[_0x9778('0x47')]=_[_0x9778('0x48')](_0x49e530[_0x9778('0x47')]);_0x1ce0d1[_0x9778('0x51')]=_[_0x9778('0x49')](_0x1ce0d1[_0x9778('0x4a')],_0x1ce0d1[_0x9778('0x47')]);_0x403fde[_0x9778('0x4b')]=_[_0x9778('0x49')](_0x1ce0d1[_0x9778('0x4a')],qs[_0x9778('0x4c')](_0x49e530['query']['fields']));_0x403fde[_0x9778('0x4b')]=_0x403fde[_0x9778('0x4b')][_0x9778('0x4d')]?_0x403fde['attributes']:_0x1ce0d1[_0x9778('0x4a')];_0x403fde[_0x9778('0x4f')]=qs[_0x9778('0x50')](_0x49e530[_0x9778('0x47')]['sort']);_0x403fde['where']=qs[_0x9778('0x51')](_[_0x9778('0x52')](_0x49e530[_0x9778('0x47')],_0x1ce0d1[_0x9778('0x51')]));if(_0x49e530[_0x9778('0x47')][_0x9778('0x53')]){_0x403fde[_0x9778('0x54')]=_[_0x9778('0x55')](_0x403fde[_0x9778('0x54')],{'$or':_[_0x9778('0x41')](_0x403fde['attributes'],function(_0x3b57ad){var _0x5172a5={};_0x5172a5[_0x3b57ad]={'$like':'%'+_0x49e530[_0x9778('0x47')][_0x9778('0x53')]+'%'};return _0x5172a5;})});}_0x403fde=_[_0x9778('0x55')]({},_0x403fde,_0x49e530[_0x9778('0x56')]);return _0x48669b[_0x9778('0x7a')](_0x403fde);}})[_0x9778('0x38')](function(_0x56f40c){if(_0x56f40c){_0x47cfe8=_0x56f40c['length'];if(!_0x49e530[_0x9778('0x47')][_0x9778('0x6a')]('nolimit')){_0x403fde[_0x9778('0x31')]=qs[_0x9778('0x31')](_0x49e530[_0x9778('0x47')][_0x9778('0x31')]);_0x403fde[_0x9778('0x33')]=qs['offset'](_0x49e530[_0x9778('0x47')]['offset']);}return _0x48669b[_0x9778('0x7a')](_0x403fde);}})[_0x9778('0x38')](function(_0xcef8a3){if(_0xcef8a3){return _0xcef8a3?{'count':_0x47cfe8,'rows':_0xcef8a3}:null;}})[_0x9778('0x38')](respondWithResult(_0x3ee782,null))['catch'](handleError(_0x3ee782,null));};exports['addApplications']=function(_0x1f7fbd,_0x36a60a){var _0x46a1dd=_0x1f7fbd[_0x9778('0x5b')]['id'];var _0x10a2ec=_0x1f7fbd[_0x9778('0x5e')];var _0x290443=0xc8;var _0x48e854=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x9778('0x7b')]['Transaction'][_0x9778('0x7c')][_0x9778('0x7d')]},function(_0x62795c){return db[_0x9778('0x42')][_0x9778('0x6f')]({'where':{'id':_0x46a1dd},'transaction':_0x62795c})['then'](function(_0x32c5d8){if(_0x32c5d8){return db[_0x9778('0x7e')]['destroy']({'where':{'WhatsappAccountId':_0x46a1dd},'transaction':_0x62795c})[_0x9778('0x38')](function(){var _0x26635f=_[_0x9778('0x41')](_0x10a2ec,function(_0x15eadb){_0x15eadb[_0x9778('0x67')]=_0x46a1dd;return _0x15eadb;});return db[_0x9778('0x7e')][_0x9778('0x7f')](_0x26635f,{'transaction':_0x62795c});});}else{_0x290443=0x194;_0x48e854=[];}});})[_0x9778('0x38')](function(){if(_0x290443!==0x194){return db[_0x9778('0x7e')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x46a1dd},'order':_0x9778('0x80')})[_0x9778('0x38')](function(_0x25bc00){_0x48e854=_0x25bc00;});}})[_0x9778('0x59')](function(_0x3adc64){_0x290443=0x1f4;logger[_0x9778('0x2a')](_0x3adc64['stack']);if(_0x3adc64[_0x9778('0x3c')]){delete _0x3adc64[_0x9778('0x3c')];}_0x48e854=_0x3adc64;})[_0x9778('0x81')](function(){if(_0x48e854===null){_0x36a60a['sendStatus'](_0x290443);}else{if(_0x290443===0x1f4){_0x36a60a['status'](_0x290443)[_0x9778('0x3d')](_0x48e854);}else{_0x36a60a[_0x9778('0x2d')](_0x290443)[_0x9778('0x2f')](_0x48e854);}}});};exports[_0x9778('0x82')]=function(_0x51b3ea,_0xc407e3,_0x537cbc){var _0x56e902={};var _0x2fc14e={};var _0x1f6f0d;var _0x46b05b;return db[_0x9778('0x42')][_0x9778('0x6f')]({'where':{'id':_0x51b3ea[_0x9778('0x5b')]['id']}})[_0x9778('0x38')](handleEntityNotFound(_0xc407e3,null))['then'](function(_0x3e0fb3){if(_0x3e0fb3){_0x1f6f0d=_0x3e0fb3;_0x2fc14e['model']=_[_0x9778('0x48')](db[_0x9778('0x7e')][_0x9778('0x43')]);_0x2fc14e[_0x9778('0x47')]=_[_0x9778('0x48')](_0x51b3ea['query']);_0x2fc14e['filters']=_[_0x9778('0x49')](_0x2fc14e[_0x9778('0x4a')],_0x2fc14e[_0x9778('0x47')]);_0x56e902[_0x9778('0x4b')]=_[_0x9778('0x49')](_0x2fc14e[_0x9778('0x4a')],qs[_0x9778('0x4c')](_0x51b3ea[_0x9778('0x47')][_0x9778('0x4c')]));_0x56e902[_0x9778('0x4b')]=_0x56e902[_0x9778('0x4b')][_0x9778('0x4d')]?_0x56e902[_0x9778('0x4b')]:_0x2fc14e['model'];_0x56e902[_0x9778('0x4f')]=qs[_0x9778('0x50')](_0x51b3ea[_0x9778('0x47')][_0x9778('0x50')]);_0x56e902['where']=qs['filters'](_[_0x9778('0x52')](_0x51b3ea[_0x9778('0x47')],_0x2fc14e[_0x9778('0x51')]));if(_0x51b3ea['query'][_0x9778('0x53')]){_0x56e902['where']=_['merge'](_0x56e902[_0x9778('0x54')],{'$or':_['map'](_0x56e902[_0x9778('0x4b')],function(_0x5793ed){var _0x199755={};_0x199755[_0x5793ed]={'$like':'%'+_0x51b3ea[_0x9778('0x47')]['filter']+'%'};return _0x199755;})});}_0x56e902=_[_0x9778('0x55')]({},_0x56e902,_0x51b3ea['options']);return _0x1f6f0d[_0x9778('0x82')](_0x56e902);}})[_0x9778('0x38')](function(_0x553626){if(_0x553626){_0x46b05b=_0x553626[_0x9778('0x4d')];if(!_0x51b3ea[_0x9778('0x47')][_0x9778('0x6a')](_0x9778('0x4e'))){_0x56e902[_0x9778('0x31')]=qs[_0x9778('0x31')](_0x51b3ea[_0x9778('0x47')][_0x9778('0x31')]);_0x56e902['offset']=qs[_0x9778('0x33')](_0x51b3ea['query']['offset']);}return _0x1f6f0d['getApplications'](_0x56e902);}})[_0x9778('0x38')](function(_0x1306d0){if(_0x1306d0){return _0x1306d0?{'count':_0x46b05b,'rows':_0x1306d0}:null;}})[_0x9778('0x38')](respondWithResult(_0xc407e3,null))[_0x9778('0x59')](handleError(_0xc407e3,null));};exports[_0x9778('0x83')]=function(_0x2fcb54,_0x4bf505,_0x307eaf){var _0x83b7df={'channel':_0x9778('0x84')};var _0x29f9a6=[];var _0x5e1e71=[];var _0x4dfa67={};return db[_0x9778('0x42')][_0x9778('0x5c')]({'where':{'id':_0x2fcb54['params']['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x9778('0x85')}]})[_0x9778('0x38')](handleEntityNotFound(_0x4bf505,null))[_0x9778('0x38')](function(_0x2a734d){_0x83b7df[_0x9778('0x86')]=_0x2a734d;if(_0x83b7df[_0x9778('0x86')]&&_0x83b7df[_0x9778('0x86')][_0x9778('0x45')]===_0x9778('0x87')&&_0x2fcb54[_0x9778('0x5e')]['statuses']){if(_0x2fcb54[_0x9778('0x5e')][_0x9778('0x88')]['length']===0x0)return;if(_0x2fcb54[_0x9778('0x5e')]['statuses'][0x0][_0x9778('0x89')]!=='read')return;return db['WhatsappMessage']['update']({'read':!![],'readAt':_0x2fcb54[_0x9778('0x5e')]['statuses'][0x0][_0x9778('0x8a')]},{'where':{'messageId':_0x2fcb54[_0x9778('0x5e')][_0x9778('0x88')][0x0][_0x9778('0x8b')]},'individualHooks':!![]})[_0x9778('0x38')](function(_0x3ada9d){return _0x4bf505['status'](0xc8)[_0x9778('0x2f')](_0x3ada9d);});}_0x83b7df[_0x9778('0x8c')]=_[_0x9778('0x8d')](_0x2a734d[_0x9778('0x85')],[_0x9778('0x80')],[_0x9778('0x8e')]);if(_0x83b7df['account']['Applications']){delete _0x83b7df[_0x9778('0x86')]['Applications'];}return db[_0x9778('0x8f')][_0x9778('0x65')]()[_0x9778('0x38')](function(_0x3d88e9){if(!_0x3d88e9){throw new db[(_0x9778('0x90'))]['ValidationError'](_0x9778('0x91'));}_0x29f9a6=_[_0x9778('0x92')](_[_0x9778('0x48')](_0x3d88e9),[_0x9778('0x93'),_0x9778('0x94')]);_0x5e1e71=_[_0x9778('0x92')](_[_0x9778('0x48')](_0x3d88e9),[_0x9778('0x93'),_0x9778('0x94'),_0x9778('0x95'),'ListId']);_0x83b7df[_0x9778('0x5e')]={'mapKey':'mobile'};if(_0x83b7df[_0x9778('0x86')]&&_0x83b7df[_0x9778('0x86')][_0x9778('0x45')]===_0x9778('0x96')){_0x83b7df[_0x9778('0x5e')][_0x9778('0x97')]=_0x2fcb54[_0x9778('0x5e')]['From'][_0x9778('0x98')]('whatsapp:','');_0x83b7df[_0x9778('0x5e')][_0x9778('0x5e')]=_0x2fcb54['body'][_0x9778('0x99')];_0x83b7df[_0x9778('0x5e')][_0x9778('0x9a')]=_0x2fcb54['body']['MessageSid'];}if(_0x83b7df[_0x9778('0x86')]&&_0x83b7df[_0x9778('0x86')][_0x9778('0x45')]===_0x9778('0x87')){_0x83b7df[_0x9778('0x5e')][_0x9778('0x97')]=_0x2fcb54[_0x9778('0x5e')][_0x9778('0x9b')][0x0]['from'];_0x83b7df[_0x9778('0x5e')]['body']=_0x2fcb54['body'][_0x9778('0x9b')][0x0]['message']['body'];_0x83b7df[_0x9778('0x5e')][_0x9778('0x9a')]=_0x2fcb54['body']['notifications'][0x0][_0x9778('0x8b')];}if(_0x83b7df[_0x9778('0x5e')]['id']){delete _0x83b7df[_0x9778('0x5e')]['id'];}if(_[_0x9778('0x9c')](_0x83b7df[_0x9778('0x5e')][_0x9778('0x97')])){throw new db['Sequelize'][(_0x9778('0x9d'))]('from\x20is\x20mandatory');}if(_[_0x9778('0x9c')](_0x83b7df[_0x9778('0x5e')][_0x9778('0x5e')])||_0x83b7df[_0x9778('0x5e')][_0x9778('0x5e')]===''){throw new db[(_0x9778('0x90'))][(_0x9778('0x9d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x83b7df[_0x9778('0x5e')][_0x9778('0x9e')])){throw new db[(_0x9778('0x90'))][(_0x9778('0x9d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5e1e71);}if(!_[_0x9778('0x9f')](_0x5e1e71,_0x83b7df[_0x9778('0x5e')][_0x9778('0x9e')])){throw new db[(_0x9778('0x90'))][(_0x9778('0x9d'))](_0x9778('0xa0')+_0x5e1e71);}_0x4dfa67[_0x83b7df[_0x9778('0x5e')][_0x9778('0x9e')]]=_0x83b7df[_0x9778('0x5e')][_0x9778('0x97')];return db['CmList'][_0x9778('0x5c')]({'where':{'id':_0x83b7df[_0x9778('0x86')]['ListId']},'include':[{'model':db[_0x9778('0x8f')],'as':'Contacts','where':_0x4dfa67,'limit':0x1,'order':[[_0x9778('0x94'),_0x9778('0xa1')]]}]});})[_0x9778('0x38')](handleEntityNotFound(_0x4bf505,null))[_0x9778('0x38')](function(_0x55e389){if(_0x55e389){_0x83b7df[_0x9778('0xa2')]=_[_0x9778('0x73')](_0x55e389,[_0x9778('0xa3')]);if(_0x55e389[_0x9778('0xa3')]['length']){return _0x55e389['Contacts'][0x0];}var _0x595695=_[_0x9778('0x1d')](_0x83b7df[_0x9778('0x5e')],{'firstName':_0x83b7df['body'][_0x9778('0x97')],'ListId':_0x55e389['id']});_0x595695[_0x83b7df[_0x9778('0x5e')][_0x9778('0x9e')]]=_0x83b7df[_0x9778('0x5e')][_0x9778('0x97')];return db[_0x9778('0x8f')][_0x9778('0x5d')](_0x595695,{'fields':_0x29f9a6,'raw':!![]});}})[_0x9778('0x38')](handleEntityNotFound(_0x4bf505,null))['then'](function(_0x592485){if(_0x592485){_0x83b7df['contact']=_0x592485;var _0xf3f4fe={'ContactId':_0x592485['id'],'phone':_0x83b7df['body'][_0x9778('0x97')],'WhatsappAccountId':_0x2fcb54[_0x9778('0x5b')]['id']};var _0x5469cb={'ContactId':_0x592485['id'],'WhatsappAccountId':_0x2fcb54['params']['id'],'closed':![]};return db[_0x9778('0xa4')]['find']({'where':_0x5469cb})[_0x9778('0x38')](function(_0x387726){if(_0x387726){return[_0x387726,![]];}return db['WhatsappInteraction']['create'](_0xf3f4fe)[_0x9778('0x38')](function(_0x1d3415){return[_0x1d3415,!![]];});});}})[_0x9778('0x74')](function(_0x51c702,_0xd274){_0x83b7df[_0x9778('0xa5')]=_0x51c702[_0x9778('0x3a')]({'plain':!![]});_0x83b7df[_0x9778('0xa5')][_0x9778('0xa6')]=![];if(_0xd274){if(_0x83b7df['account'][_0x9778('0xa7')]){_0x83b7df['applications']['push']({'id':0x0,'priority':_0x83b7df[_0x9778('0x8c')][_0x9778('0x4d')]+0x1,'app':_0x9778('0xa8'),'appdata':'unmanaged','interval':_0x9778('0xa9')});}_0x83b7df[_0x9778('0xa5')][_0x9778('0xa6')]=!![];}return db[_0x9778('0xaa')][_0x9778('0x5d')]({'phone':_0x83b7df['body'][_0x9778('0x97')],'messageId':_0x83b7df[_0x9778('0x5e')][_0x9778('0x9a')],'body':_0x83b7df[_0x9778('0x5e')][_0x9778('0x5e')],'WhatsappAccountId':_0x2fcb54[_0x9778('0x5b')]['id'],'WhatsappInteractionId':_0x51c702['id'],'direction':'in','ContactId':_0x51c702[_0x9778('0xab')],'AttachmentId':_0x83b7df[_0x9778('0x5e')][_0x9778('0xac')]});})[_0x9778('0x38')](function(_0x37235b){_0x83b7df[_0x9778('0x2b')]=_0x37235b;if(_0x83b7df[_0x9778('0xa5')][_0x9778('0xad')]){return db[_0x9778('0xae')][_0x9778('0x5c')]({'attributes':['id','name'],'where':{'id':_0x83b7df[_0x9778('0xa5')]['UserId']}})[_0x9778('0x38')](function(_0x33b4e6){if(_0x33b4e6){_0x83b7df['applications'][_0x9778('0xaf')]({'id':0x0,'priority':0x0,'app':_0x9778('0xb0'),'appdata':_0x33b4e6[_0x9778('0x3c')]+','+(_0x83b7df['account'][_0x9778('0xb1')]||0xa),'interval':_0x9778('0xa9')});}return respondWithRpcPromise(_0x9778('0xb2'),_0x9778('0xb3'),_0x83b7df);});}return respondWithRpcPromise(_0x9778('0xb2'),'startRouting',_0x83b7df);})[_0x9778('0x38')](function(_0x449961){if(_0x449961){var _0x50481e=0xc8;var _0x1832b5=_0x9778('0xb4');logger[_0x9778('0x25')](_0x9778('0x28'),_0x1832b5,_0x50481e,'entity\x20found');logger['debug'](_0x9778('0xb5'),_0x1832b5,_0x50481e,_0x9778('0xb6'),JSON[_0x9778('0x29')](_0x449961));if(_0x83b7df[_0x9778('0x86')][_0x9778('0x45')]===_0x9778('0x96')){return _0x4bf505[_0x9778('0x2d')](_0x50481e)['set'](_0x9778('0xb7'),_0x9778('0xb8'))[_0x9778('0x3d')](_0x9778('0xb9'));}else{return _0x4bf505['status'](_0x50481e)[_0x9778('0x2f')](_0x449961);}}});})[_0x9778('0x59')](handleError(_0x4bf505,null));};exports[_0x9778('0x3d')]=function(_0x50e415,_0x1dcee5,_0xfa1403){var _0x43d9f3,_0x937681,_0x5aab49;if(_[_0x9778('0x9c')](_0x50e415[_0x9778('0x5e')][_0x9778('0x5e')])||_0x50e415[_0x9778('0x5e')]['body']===''){throw new db['Sequelize'][(_0x9778('0x9d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x50e415[_0x9778('0x5e')]['to'])){throw new db[(_0x9778('0x90'))][(_0x9778('0x9d'))](_0x9778('0xba'));}_0x43d9f3=_0x50e415[_0x9778('0x5e')]['to'];return db[_0x9778('0x42')][_0x9778('0x5c')]({'where':{'id':_0x50e415[_0x9778('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0x9778('0xbb'),'include':[{'model':db[_0x9778('0x8f')],'as':_0x9778('0xa3'),'where':{'mobile':_0x43d9f3},'limit':0x1,'order':[[_0x9778('0x94'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x1dcee5,null))['then'](function(_0x5a19b3){if(_0x5a19b3&&_0x5a19b3[_0x9778('0xbb')]){_0x937681=_0x5a19b3[_0x9778('0x3a')]({'plain':!![]});if(_0x937681[_0x9778('0xbb')]&&_0x937681[_0x9778('0xbb')][_0x9778('0xa3')][_0x9778('0x4d')]){return _0x937681[_0x9778('0xbb')][_0x9778('0xa3')][0x0];}return db[_0x9778('0x8f')][_0x9778('0x5d')](_[_0x9778('0x1d')](_0x50e415[_0x9778('0x5e')],{'firstName':_0x43d9f3,'mobile':_0x43d9f3,'phone':_0x43d9f3,'ListId':_0x937681[_0x9778('0xbc')]}));}})[_0x9778('0x38')](handleEntityNotFound(_0x1dcee5,null))[_0x9778('0x38')](function(_0x1cb19e){if(_0x1cb19e){_0x5aab49=_0x1cb19e;return db['WhatsappInteraction']['find']({'where':{'ContactId':_0x5aab49['id'],'closed':![],'WhatsappAccountId':_0x937681['id']}})[_0x9778('0x38')](function(_0x21bdf9){if(_0x21bdf9){return[_0x21bdf9,![]];}return db['WhatsappInteraction'][_0x9778('0x5d')]({'UserId':_0x50e415[_0x9778('0x5f')]['id'],'ContactId':_0x5aab49['id'],'WhatsappAccountId':_0x937681['id'],'phone':_0x43d9f3,'firstMsgDirection':_0x9778('0xbd'),'Messages':[_[_0x9778('0x55')](_0x50e415[_0x9778('0x5e')],{'read':![],'body':_0x50e415[_0x9778('0x5e')][_0x9778('0x5e')],'phone':_0x43d9f3,'WhatsappAccountId':_0x937681['id'],'UserId':_0x50e415[_0x9778('0x5f')]['id'],'ContactId':_0x5aab49['id']})]},{'include':[{'model':db[_0x9778('0xaa')],'as':_0x9778('0xbe')}]})[_0x9778('0x38')](function(_0x2a137f){return[_0x2a137f,!![]];});});}})[_0x9778('0x74')](function(_0x55999d,_0x5683de){if(_0x5683de){return _0x55999d;}return db[_0x9778('0xaa')][_0x9778('0x5d')](_[_0x9778('0x55')](_0x50e415[_0x9778('0x5e')],{'read':![],'body':_0x50e415['body'][_0x9778('0x5e')],'phone':_0x43d9f3,'WhatsappAccountId':_0x937681['id'],'WhatsappInteractionId':_0x55999d['id'],'UserId':_0x50e415[_0x9778('0x5f')]['id'],'ContactId':_0x5aab49['id']}))[_0x9778('0x38')](function(_0x2d89f5){_0x55999d[_0x9778('0xbf')][_0x9778('0xbe')]=[];_0x55999d[_0x9778('0xbf')][_0x9778('0xbe')][_0x9778('0xc0')](_0x2d89f5['dataValues']);return _0x55999d;});})[_0x9778('0x38')](respondWithResult(_0x1dcee5,null))[_0x9778('0x59')](handleError(_0x1dcee5,null));}; \ No newline at end of file +var _0x3ff8=['statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','Sequelize','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','push','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','user','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','get','UserProfileResource','sendStatus','stack','name','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','params','Pause','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','Disposition','findOne','pick','findAll','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','send','hasOwnProperty','whatsapp','Applications','account','sinch'];(function(_0x12a071,_0x1b8211){var _0x5c499c=function(_0x297bc5){while(--_0x297bc5){_0x12a071['push'](_0x12a071['shift']());}};_0x5c499c(++_0x1b8211);}(_0x3ff8,0x1c3));var _0x83ff=function(_0x17cded,_0xa51b6b){_0x17cded=_0x17cded-0x0;var _0x41b11f=_0x3ff8[_0x17cded];return _0x41b11f;};'use strict';var emlformat=require(_0x83ff('0x0'));var rimraf=require(_0x83ff('0x1'));var zipdir=require(_0x83ff('0x2'));var jsonpatch=require(_0x83ff('0x3'));var rp=require(_0x83ff('0x4'));var moment=require(_0x83ff('0x5'));var BPromise=require(_0x83ff('0x6'));var Mustache=require('mustache');var util=require(_0x83ff('0x7'));var path=require(_0x83ff('0x8'));var sox=require(_0x83ff('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x83ff('0xa'));var _=require(_0x83ff('0xb'));var squel=require('squel');var crypto=require(_0x83ff('0xc'));var jsforce=require(_0x83ff('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x83ff('0xe'));var querystring=require(_0x83ff('0xf'));var Papa=require(_0x83ff('0x10'));var Redis=require(_0x83ff('0x11'));var authService=require(_0x83ff('0x12'));var qs=require(_0x83ff('0x13'));var as=require(_0x83ff('0x14'));var hardwareService=require(_0x83ff('0x15'));var logger=require(_0x83ff('0x16'))(_0x83ff('0x17'));var utils=require(_0x83ff('0x18'));var config=require(_0x83ff('0x19'));var licenseUtil=require(_0x83ff('0x1a'));var db=require(_0x83ff('0x1b'))['db'];config[_0x83ff('0x1c')]=_[_0x83ff('0x1d')](config[_0x83ff('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x83ff('0x1e'))(new Redis(config[_0x83ff('0x1c')]));require(_0x83ff('0x1f'))['register'](socket);var jayson=require(_0x83ff('0x20'));var client=jayson[_0x83ff('0x21')][_0x83ff('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x2f65f5,_0x4d4be2,_0x1be7c6,_0x2f6cc2){return new BPromise(function(_0x2c0c9a,_0x20ce20){var _0x99b873=_0x2f6cc2||client;return _0x99b873[_0x83ff('0x23')](_0x2f65f5,_0x1be7c6)[_0x83ff('0x24')](function(_0x4ec714){logger['info'](_0x83ff('0x25'),_0x4d4be2,'request\x20sent');logger[_0x83ff('0x26')](_0x83ff('0x27'),_0x4d4be2,_0x83ff('0x28'),JSON[_0x83ff('0x29')](_0x4ec714));if(_0x4ec714[_0x83ff('0x2a')]){if(_0x4ec714[_0x83ff('0x2a')][_0x83ff('0x2b')]===0x1f4){logger[_0x83ff('0x2a')](_0x83ff('0x25'),_0x4d4be2,_0x4ec714['error'][_0x83ff('0x2c')]);return _0x20ce20(_0x4ec714[_0x83ff('0x2a')]['message']);}logger['error'](_0x83ff('0x25'),_0x4d4be2,_0x4ec714[_0x83ff('0x2a')][_0x83ff('0x2c')]);return _0x2c0c9a(_0x4ec714['error'][_0x83ff('0x2c')]);}else{logger[_0x83ff('0x2d')]('WhatsappAccount,\x20%s,\x20%s',_0x4d4be2,'request\x20sent');_0x2c0c9a(_0x4ec714['result'][_0x83ff('0x2c')]);}})[_0x83ff('0x2e')](function(_0x40321d){logger[_0x83ff('0x2a')](_0x83ff('0x25'),_0x4d4be2,_0x40321d);_0x20ce20(_0x40321d);});});}function respondWithStatusCode(_0xf1dc45,_0x6b1013){_0x6b1013=_0x6b1013||0xcc;return function(_0x407f61){if(_0x407f61){return _0xf1dc45['sendStatus'](_0x6b1013);}return _0xf1dc45[_0x83ff('0x2f')](_0x6b1013)['end']();};}function respondWithResult(_0x2a196b,_0x1ccf26){_0x1ccf26=_0x1ccf26||0xc8;return function(_0x257117){if(_0x257117){return _0x2a196b[_0x83ff('0x2f')](_0x1ccf26)[_0x83ff('0x30')](_0x257117);}};}function respondWithFilteredResult(_0x40e9eb,_0x576074){return function(_0x1e2b7f){if(_0x1e2b7f){var _0xee2d5e=typeof _0x576074[_0x83ff('0x31')]===_0x83ff('0x32')&&typeof _0x576074[_0x83ff('0x33')]===_0x83ff('0x32');var _0x58d07c=_0x1e2b7f['count'];var _0x513a87=_0xee2d5e?0x0:_0x576074[_0x83ff('0x31')];var _0x4f0781=_0xee2d5e?_0x1e2b7f[_0x83ff('0x34')]:_0x576074[_0x83ff('0x31')]+_0x576074[_0x83ff('0x33')];var _0x36ddd4;if(_0x4f0781>=_0x58d07c){_0x4f0781=_0x58d07c;_0x36ddd4=0xc8;}else{_0x36ddd4=0xce;}_0x40e9eb[_0x83ff('0x2f')](_0x36ddd4);return _0x40e9eb[_0x83ff('0x35')](_0x83ff('0x36'),_0x513a87+'-'+_0x4f0781+'/'+_0x58d07c)[_0x83ff('0x30')](_0x1e2b7f);}return null;};}function patchUpdates(_0x48b306){return function(_0xca177d){try{jsonpatch['apply'](_0xca177d,_0x48b306,!![]);}catch(_0x36554a){return BPromise[_0x83ff('0x37')](_0x36554a);}return _0xca177d['save']();};}function saveUpdates(_0x2a2e65,_0x5213b4){return function(_0x58438a){if(_0x58438a){return _0x58438a[_0x83ff('0x38')](_0x2a2e65)[_0x83ff('0x24')](function(_0x2c7c7d){return _0x2c7c7d;});}return null;};}function removeEntity(_0x26ad5a,_0x39310d){return function(_0x36b473){if(_0x36b473){return _0x36b473[_0x83ff('0x39')]()[_0x83ff('0x24')](function(){var _0xddee92=_0x36b473[_0x83ff('0x3a')]({'plain':!![]});var _0x48f420='WhatsappAccounts';return db[_0x83ff('0x3b')]['destroy']({'where':{'type':_0x48f420,'resourceId':_0xddee92['id']}})['then'](function(){return _0x36b473;});})['then'](function(){_0x26ad5a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47f191,_0x15e75d){return function(_0x51dde0){if(!_0x51dde0){_0x47f191[_0x83ff('0x3c')](0x194);}return _0x51dde0;};}function handleError(_0x99ca9,_0x3fa11d){_0x3fa11d=_0x3fa11d||0x1f4;return function(_0x16ee17){logger[_0x83ff('0x2a')](_0x16ee17[_0x83ff('0x3d')]);if(_0x16ee17[_0x83ff('0x3e')]){delete _0x16ee17[_0x83ff('0x3e')];}_0x99ca9[_0x83ff('0x2f')](_0x3fa11d)['send'](_0x16ee17);};}exports[_0x83ff('0x3f')]=function(_0x1504ae,_0x209b92){var _0x2d0112={'include':[{'model':db['Pause'],'as':_0x83ff('0x40')}]},_0x5b1643={},_0x17db76={'count':0x0,'rows':[]};var _0xf51685=_[_0x83ff('0x41')](db[_0x83ff('0x42')][_0x83ff('0x43')],function(_0x560e71){return{'name':_0x560e71[_0x83ff('0x44')],'type':_0x560e71['type']['key']};});_0x5b1643[_0x83ff('0x45')]=_[_0x83ff('0x41')](_0xf51685,_0x83ff('0x3e'));_0x5b1643[_0x83ff('0x46')]=_[_0x83ff('0x47')](_0x1504ae[_0x83ff('0x46')]);_0x5b1643[_0x83ff('0x48')]=_[_0x83ff('0x49')](_0x5b1643['model'],_0x5b1643[_0x83ff('0x46')]);_0x2d0112[_0x83ff('0x4a')]=_[_0x83ff('0x49')](_0x5b1643['model'],qs[_0x83ff('0x4b')](_0x1504ae[_0x83ff('0x46')][_0x83ff('0x4b')]));_0x2d0112[_0x83ff('0x4a')]=_0x2d0112[_0x83ff('0x4a')][_0x83ff('0x4c')]?_0x2d0112['attributes']:_0x5b1643[_0x83ff('0x45')];if(!_0x1504ae[_0x83ff('0x46')]['hasOwnProperty'](_0x83ff('0x4d'))){_0x2d0112[_0x83ff('0x33')]=qs[_0x83ff('0x33')](_0x1504ae['query'][_0x83ff('0x33')]);_0x2d0112[_0x83ff('0x31')]=qs[_0x83ff('0x31')](_0x1504ae[_0x83ff('0x46')][_0x83ff('0x31')]);}_0x2d0112[_0x83ff('0x4e')]=qs['sort'](_0x1504ae[_0x83ff('0x46')][_0x83ff('0x4f')]);_0x2d0112[_0x83ff('0x50')]=qs['filters'](_['pick'](_0x1504ae[_0x83ff('0x46')],_0x5b1643[_0x83ff('0x48')]),_0xf51685);if(_0x1504ae[_0x83ff('0x46')][_0x83ff('0x51')]){_0x2d0112[_0x83ff('0x50')]=_[_0x83ff('0x52')](_0x2d0112[_0x83ff('0x50')],{'$or':_[_0x83ff('0x41')](_0xf51685,function(_0x286f0a){if(_0x286f0a[_0x83ff('0x53')]!==_0x83ff('0x54')){var _0x57baa4={};_0x57baa4[_0x286f0a[_0x83ff('0x3e')]]={'$like':'%'+_0x1504ae['query'][_0x83ff('0x51')]+'%'};return _0x57baa4;}})});}_0x2d0112=_[_0x83ff('0x52')]({},_0x2d0112,_0x1504ae[_0x83ff('0x55')]);var _0x268dbb={'where':_0x2d0112[_0x83ff('0x50')]};return db[_0x83ff('0x42')][_0x83ff('0x34')](_0x268dbb)[_0x83ff('0x24')](function(_0x2eb181){_0x17db76['count']=_0x2eb181;if(_0x1504ae[_0x83ff('0x46')][_0x83ff('0x56')]){_0x2d0112['include']=[{'all':!![]}];}return db[_0x83ff('0x42')]['findAll'](_0x2d0112);})[_0x83ff('0x24')](function(_0x50fad5){_0x17db76['rows']=_0x50fad5;return _0x17db76;})[_0x83ff('0x24')](respondWithFilteredResult(_0x209b92,_0x2d0112))[_0x83ff('0x2e')](handleError(_0x209b92,null));};exports['show']=function(_0x55854e,_0x500145){var _0x2b2f44={'raw':![],'where':{'id':_0x55854e[_0x83ff('0x57')]['id']},'include':[{'model':db[_0x83ff('0x58')],'as':'mandatoryDispositionPause'}]},_0x5d686d={};_0x5d686d[_0x83ff('0x45')]=_['keys'](db[_0x83ff('0x42')][_0x83ff('0x43')]);_0x5d686d[_0x83ff('0x46')]=_[_0x83ff('0x47')](_0x55854e[_0x83ff('0x46')]);_0x5d686d[_0x83ff('0x48')]=_['intersection'](_0x5d686d[_0x83ff('0x45')],_0x5d686d['query']);_0x2b2f44[_0x83ff('0x4a')]=_[_0x83ff('0x49')](_0x5d686d[_0x83ff('0x45')],qs['fields'](_0x55854e[_0x83ff('0x46')][_0x83ff('0x4b')]));_0x2b2f44['attributes']=_0x2b2f44['attributes']['length']?_0x2b2f44[_0x83ff('0x4a')]:_0x5d686d[_0x83ff('0x45')];if(_0x55854e[_0x83ff('0x46')][_0x83ff('0x56')]){_0x2b2f44[_0x83ff('0x59')]=[{'all':!![]}];}_0x2b2f44=_[_0x83ff('0x52')]({},_0x2b2f44,_0x55854e[_0x83ff('0x55')]);return db[_0x83ff('0x42')][_0x83ff('0x5a')](_0x2b2f44)[_0x83ff('0x24')](handleEntityNotFound(_0x500145,null))[_0x83ff('0x24')](respondWithResult(_0x500145,null))[_0x83ff('0x2e')](handleError(_0x500145,null));};exports[_0x83ff('0x5b')]=function(_0x46892e,_0x302e92){return db['WhatsappAccount'][_0x83ff('0x5b')](_0x46892e['body'],{})[_0x83ff('0x24')](function(_0xd2cd21){var _0x237d8b=_0x46892e['user'][_0x83ff('0x3a')]({'plain':!![]});if(!_0x237d8b)throw new Error(_0x83ff('0x5c'));if(_0x237d8b[_0x83ff('0x5d')]==='user'){var _0x55cf49=_0xd2cd21['get']({'plain':!![]});var _0x19296d=_0x83ff('0x5e');return db[_0x83ff('0x5f')]['find']({'where':{'name':_0x19296d,'userProfileId':_0x237d8b[_0x83ff('0x60')]},'raw':!![]})[_0x83ff('0x24')](function(_0x107496){if(_0x107496&&_0x107496[_0x83ff('0x61')]===0x0){return db[_0x83ff('0x3b')][_0x83ff('0x5b')]({'name':_0x55cf49[_0x83ff('0x3e')],'resourceId':_0x55cf49['id'],'type':_0x107496[_0x83ff('0x3e')],'sectionId':_0x107496['id']},{})[_0x83ff('0x24')](function(){return _0xd2cd21;});}else{return _0xd2cd21;}})[_0x83ff('0x2e')](function(_0x372cd5){logger['error'](_0x83ff('0x62'),_0x372cd5);throw _0x372cd5;});}return _0xd2cd21;})[_0x83ff('0x24')](respondWithResult(_0x302e92,0xc9))['catch'](handleError(_0x302e92,null));};exports['update']=function(_0x50d90b,_0x542a00){if(_0x50d90b[_0x83ff('0x63')]['id']){delete _0x50d90b[_0x83ff('0x63')]['id'];}return db[_0x83ff('0x42')][_0x83ff('0x5a')]({'where':{'id':_0x50d90b[_0x83ff('0x57')]['id']},'include':[{'model':db[_0x83ff('0x58')],'as':_0x83ff('0x40')}]})[_0x83ff('0x24')](handleEntityNotFound(_0x542a00,null))[_0x83ff('0x24')](saveUpdates(_0x50d90b[_0x83ff('0x63')],null))[_0x83ff('0x24')](respondWithResult(_0x542a00,null))[_0x83ff('0x2e')](handleError(_0x542a00,null));};exports[_0x83ff('0x39')]=function(_0xfda0e7,_0x5730ea){return db[_0x83ff('0x42')][_0x83ff('0x5a')]({'where':{'id':_0xfda0e7[_0x83ff('0x57')]['id']}})['then'](handleEntityNotFound(_0x5730ea,null))[_0x83ff('0x24')](removeEntity(_0x5730ea,null))['catch'](handleError(_0x5730ea,null));};exports[_0x83ff('0x64')]=function(_0x32a993,_0x2d13dd){return db[_0x83ff('0x42')][_0x83ff('0x64')]()[_0x83ff('0x24')](respondWithResult(_0x2d13dd,null))[_0x83ff('0x2e')](handleError(_0x2d13dd,null));};exports[_0x83ff('0x65')]=function(_0x54870d,_0x1e38c2,_0x13be07){if(_0x54870d[_0x83ff('0x63')]['id']){delete _0x54870d[_0x83ff('0x63')]['id'];}return db['WhatsappAccount'][_0x83ff('0x5a')]({'where':{'id':_0x54870d[_0x83ff('0x57')]['id']}})[_0x83ff('0x24')](handleEntityNotFound(_0x1e38c2,null))[_0x83ff('0x24')](function(_0x46866f){if(_0x46866f){_0x54870d[_0x83ff('0x63')][_0x83ff('0x66')]=_0x46866f['id'];return db[_0x83ff('0x67')][_0x83ff('0x5b')](_0x54870d['body']);}})[_0x83ff('0x24')](respondWithResult(_0x1e38c2,null))[_0x83ff('0x2e')](handleError(_0x1e38c2,null));};exports['getDispositions']=function(_0x134c96,_0x5c723b,_0x18bff6){var _0x232199={'raw':![],'where':{}};var _0x19a1cf={};var _0x2e8321={'count':0x0,'rows':[]};return db[_0x83ff('0x42')][_0x83ff('0x68')]({'where':{'id':_0x134c96[_0x83ff('0x57')]['id']}})[_0x83ff('0x24')](handleEntityNotFound(_0x5c723b,null))[_0x83ff('0x24')](function(_0x268ed6){if(_0x268ed6){_0x19a1cf[_0x83ff('0x45')]=_[_0x83ff('0x47')](db[_0x83ff('0x67')][_0x83ff('0x43')]);_0x19a1cf[_0x83ff('0x46')]=_[_0x83ff('0x47')](_0x134c96[_0x83ff('0x46')]);_0x19a1cf[_0x83ff('0x48')]=_[_0x83ff('0x49')](_0x19a1cf[_0x83ff('0x45')],_0x19a1cf[_0x83ff('0x46')]);_0x232199['attributes']=_['intersection'](_0x19a1cf[_0x83ff('0x45')],qs[_0x83ff('0x4b')](_0x134c96[_0x83ff('0x46')][_0x83ff('0x4b')]));_0x232199[_0x83ff('0x4a')]=_0x232199[_0x83ff('0x4a')][_0x83ff('0x4c')]?_0x232199[_0x83ff('0x4a')]:_0x19a1cf[_0x83ff('0x45')];if(!_0x134c96[_0x83ff('0x46')]['hasOwnProperty'](_0x83ff('0x4d'))){_0x232199[_0x83ff('0x33')]=qs[_0x83ff('0x33')](_0x134c96[_0x83ff('0x46')][_0x83ff('0x33')]);_0x232199[_0x83ff('0x31')]=qs[_0x83ff('0x31')](_0x134c96[_0x83ff('0x46')][_0x83ff('0x31')]);}_0x232199[_0x83ff('0x4e')]=qs[_0x83ff('0x4f')](_0x134c96[_0x83ff('0x46')][_0x83ff('0x4f')]);_0x232199[_0x83ff('0x50')]=qs[_0x83ff('0x48')](_[_0x83ff('0x69')](_0x134c96[_0x83ff('0x46')],_0x19a1cf[_0x83ff('0x48')]));_0x232199['where']['WhatsappAccountId']=_0x268ed6['id'];if(_0x134c96[_0x83ff('0x46')][_0x83ff('0x51')]){_0x232199[_0x83ff('0x50')]=_[_0x83ff('0x52')](_0x232199[_0x83ff('0x50')],{'$or':_['map'](_0x232199[_0x83ff('0x4a')],function(_0x27b4b2){var _0x69a80d={};_0x69a80d[_0x27b4b2]={'$like':'%'+_0x134c96[_0x83ff('0x46')][_0x83ff('0x51')]+'%'};return _0x69a80d;})});}_0x232199=_[_0x83ff('0x52')]({},_0x232199,_0x134c96[_0x83ff('0x55')]);return db[_0x83ff('0x67')][_0x83ff('0x34')]({'where':_0x232199[_0x83ff('0x50')]})[_0x83ff('0x24')](function(_0xcb9dfc){_0x2e8321['count']=_0xcb9dfc;if(_0x134c96[_0x83ff('0x46')][_0x83ff('0x56')]){_0x232199[_0x83ff('0x59')]=[{'all':!![]}];}return db['Disposition'][_0x83ff('0x6a')](_0x232199);})[_0x83ff('0x24')](function(_0x10d777){_0x2e8321[_0x83ff('0x6b')]=_0x10d777;return _0x2e8321;});}})[_0x83ff('0x24')](respondWithFilteredResult(_0x5c723b,_0x232199))[_0x83ff('0x2e')](handleError(_0x5c723b,null));};exports[_0x83ff('0x6c')]=function(_0xbe1f16,_0x207635,_0x4866a8){return db[_0x83ff('0x42')][_0x83ff('0x5a')]({'where':{'id':_0xbe1f16[_0x83ff('0x57')]['id']}})[_0x83ff('0x24')](handleEntityNotFound(_0x207635,null))[_0x83ff('0x24')](function(_0x506752){if(_0x506752){return _0x506752[_0x83ff('0x6c')](_0xbe1f16[_0x83ff('0x46')][_0x83ff('0x6d')]);}})[_0x83ff('0x24')](respondWithStatusCode(_0x207635,null))['catch'](handleError(_0x207635,null));};exports[_0x83ff('0x6e')]=function(_0x1cb270,_0xed6e88,_0x250f25){if(_0x1cb270[_0x83ff('0x63')]['id']){delete _0x1cb270[_0x83ff('0x63')]['id'];}return db[_0x83ff('0x42')][_0x83ff('0x5a')]({'where':{'id':_0x1cb270['params']['id']}})[_0x83ff('0x24')](handleEntityNotFound(_0xed6e88,null))[_0x83ff('0x24')](function(_0x512910){if(_0x512910){_0x1cb270[_0x83ff('0x63')][_0x83ff('0x66')]=_0x512910['id'];return db['CannedAnswer'][_0x83ff('0x5b')](_0x1cb270[_0x83ff('0x63')]);}})['then'](respondWithResult(_0xed6e88,null))[_0x83ff('0x2e')](handleError(_0xed6e88,null));};exports[_0x83ff('0x6f')]=function(_0x140d6d,_0x562525,_0x41ab1f){var _0x4276fe={'raw':![],'where':{}};var _0x1f7cf3={};var _0x2a2731={'count':0x0,'rows':[]};return db[_0x83ff('0x42')][_0x83ff('0x68')]({'where':{'id':_0x140d6d[_0x83ff('0x57')]['id']}})[_0x83ff('0x24')](handleEntityNotFound(_0x562525,null))['then'](function(_0x4af210){if(_0x4af210){_0x1f7cf3['model']=_['keys'](db[_0x83ff('0x70')][_0x83ff('0x43')]);_0x1f7cf3[_0x83ff('0x46')]=_[_0x83ff('0x47')](_0x140d6d[_0x83ff('0x46')]);_0x1f7cf3['filters']=_['intersection'](_0x1f7cf3['model'],_0x1f7cf3[_0x83ff('0x46')]);_0x4276fe['attributes']=_['intersection'](_0x1f7cf3['model'],qs[_0x83ff('0x4b')](_0x140d6d[_0x83ff('0x46')][_0x83ff('0x4b')]));_0x4276fe[_0x83ff('0x4a')]=_0x4276fe['attributes'][_0x83ff('0x4c')]?_0x4276fe['attributes']:_0x1f7cf3[_0x83ff('0x45')];if(!_0x140d6d['query']['hasOwnProperty'](_0x83ff('0x4d'))){_0x4276fe[_0x83ff('0x33')]=qs[_0x83ff('0x33')](_0x140d6d[_0x83ff('0x46')]['limit']);_0x4276fe[_0x83ff('0x31')]=qs[_0x83ff('0x31')](_0x140d6d['query'][_0x83ff('0x31')]);}_0x4276fe[_0x83ff('0x4e')]=qs[_0x83ff('0x4f')](_0x140d6d[_0x83ff('0x46')][_0x83ff('0x4f')]);_0x4276fe[_0x83ff('0x50')]=qs[_0x83ff('0x48')](_[_0x83ff('0x69')](_0x140d6d[_0x83ff('0x46')],_0x1f7cf3[_0x83ff('0x48')]));_0x4276fe[_0x83ff('0x50')]['WhatsappAccountId']=_0x4af210['id'];if(_0x140d6d[_0x83ff('0x46')][_0x83ff('0x51')]){_0x4276fe[_0x83ff('0x50')]=_[_0x83ff('0x52')](_0x4276fe[_0x83ff('0x50')],{'$or':_[_0x83ff('0x41')](_0x4276fe[_0x83ff('0x4a')],function(_0x86f23b){var _0x5de724={};_0x5de724[_0x86f23b]={'$like':'%'+_0x140d6d[_0x83ff('0x46')][_0x83ff('0x51')]+'%'};return _0x5de724;})});}_0x4276fe=_[_0x83ff('0x52')]({},_0x4276fe,_0x140d6d[_0x83ff('0x55')]);return db[_0x83ff('0x70')]['count']({'where':_0x4276fe[_0x83ff('0x50')]})[_0x83ff('0x24')](function(_0x2c31e5){_0x2a2731[_0x83ff('0x34')]=_0x2c31e5;if(_0x140d6d[_0x83ff('0x46')]['includeAll']){_0x4276fe[_0x83ff('0x59')]=[{'all':!![]}];}return db[_0x83ff('0x70')][_0x83ff('0x6a')](_0x4276fe);})['then'](function(_0x10a390){_0x2a2731[_0x83ff('0x6b')]=_0x10a390;return _0x2a2731;});}})[_0x83ff('0x24')](respondWithFilteredResult(_0x562525,_0x4276fe))[_0x83ff('0x2e')](handleError(_0x562525,null));};exports[_0x83ff('0x71')]=function(_0x2ab8ee,_0x32ced8,_0x3ea883){return db[_0x83ff('0x42')][_0x83ff('0x5a')]({'where':{'id':_0x2ab8ee['params']['id']}})['then'](handleEntityNotFound(_0x32ced8,null))[_0x83ff('0x24')](function(_0x3e4a4f){if(_0x3e4a4f){return _0x3e4a4f[_0x83ff('0x71')](_0x2ab8ee[_0x83ff('0x46')][_0x83ff('0x6d')]);}})[_0x83ff('0x24')](respondWithStatusCode(_0x32ced8,null))['catch'](handleError(_0x32ced8,null));};exports[_0x83ff('0x72')]=function(_0x44a717,_0x482e0e,_0x4e0116){return db['WhatsappAccount']['find']({'where':{'id':_0x44a717[_0x83ff('0x57')]['id']}})[_0x83ff('0x24')](handleEntityNotFound(_0x482e0e,null))[_0x83ff('0x24')](function(_0x485d5a){if(_0x485d5a){return _0x485d5a['addAgents'](_0x44a717['body'][_0x83ff('0x6d')],_[_0x83ff('0x73')](_0x44a717[_0x83ff('0x63')],[_0x83ff('0x6d'),'id'])||{})[_0x83ff('0x74')](function(_0x382431){for(var _0xaf5358=0x0;_0xaf5358<_0x44a717[_0x83ff('0x63')][_0x83ff('0x6d')][_0x83ff('0x4c')];_0xaf5358+=0x1){socket[_0x83ff('0x75')](_0x83ff('0x76'),{'UserId':Number(_0x44a717['body'][_0x83ff('0x6d')][_0xaf5358]),'WhatsappAccountId':Number(_0x44a717[_0x83ff('0x57')]['id'])});}return _0x382431;});}})['then'](respondWithResult(_0x482e0e,null))[_0x83ff('0x2e')](handleError(_0x482e0e,null));};exports[_0x83ff('0x77')]=function(_0x22dfb4,_0xb5087,_0x2949c6){return db[_0x83ff('0x42')][_0x83ff('0x5a')]({'where':{'id':_0x22dfb4['params']['id']}})[_0x83ff('0x24')](handleEntityNotFound(_0xb5087,null))['then'](function(_0x149a93){if(_0x149a93){return _0x149a93[_0x83ff('0x77')](_0x22dfb4['query'][_0x83ff('0x6d')])['then'](function(){if(_[_0x83ff('0x78')](_0x22dfb4[_0x83ff('0x46')]['ids'])){for(var _0x23120f=0x0;_0x23120f<_0x22dfb4[_0x83ff('0x46')][_0x83ff('0x6d')][_0x83ff('0x4c')];_0x23120f+=0x1){socket['emit'](_0x83ff('0x79'),{'UserId':Number(_0x22dfb4[_0x83ff('0x46')]['ids'][_0x23120f]),'WhatsappAccountId':Number(_0x22dfb4[_0x83ff('0x57')]['id'])});}}else{socket[_0x83ff('0x75')]('userWhatsappAccount:remove',{'UserId':Number(_0x22dfb4['query'][_0x83ff('0x6d')]),'WhatsappAccountId':Number(_0x22dfb4[_0x83ff('0x57')]['id'])});}});}})[_0x83ff('0x24')](respondWithStatusCode(_0xb5087,null))[_0x83ff('0x2e')](handleError(_0xb5087,null));};exports[_0x83ff('0x7a')]=function(_0x59a1e6,_0x2cfc99,_0x4a73f4){var _0x363eb4={};var _0x16983c={};var _0x558dcf;var _0x7ab248;return db[_0x83ff('0x42')][_0x83ff('0x68')]({'where':{'id':_0x59a1e6[_0x83ff('0x57')]['id']}})[_0x83ff('0x24')](handleEntityNotFound(_0x2cfc99,null))[_0x83ff('0x24')](function(_0x8198bc){if(_0x8198bc){_0x558dcf=_0x8198bc;_0x16983c['model']=_[_0x83ff('0x47')](db[_0x83ff('0x7b')][_0x83ff('0x43')]);_0x16983c[_0x83ff('0x46')]=_[_0x83ff('0x47')](_0x59a1e6[_0x83ff('0x46')]);_0x16983c[_0x83ff('0x48')]=_['intersection'](_0x16983c['model'],_0x16983c[_0x83ff('0x46')]);_0x363eb4['attributes']=_[_0x83ff('0x49')](_0x16983c[_0x83ff('0x45')],qs[_0x83ff('0x4b')](_0x59a1e6['query']['fields']));_0x363eb4[_0x83ff('0x4a')]=_0x363eb4['attributes'][_0x83ff('0x4c')]?_0x363eb4[_0x83ff('0x4a')]:_0x16983c[_0x83ff('0x45')];_0x363eb4[_0x83ff('0x4e')]=qs[_0x83ff('0x4f')](_0x59a1e6[_0x83ff('0x46')]['sort']);_0x363eb4[_0x83ff('0x50')]=qs[_0x83ff('0x48')](_[_0x83ff('0x69')](_0x59a1e6[_0x83ff('0x46')],_0x16983c['filters']));if(_0x59a1e6['query']['filter']){_0x363eb4[_0x83ff('0x50')]=_[_0x83ff('0x52')](_0x363eb4[_0x83ff('0x50')],{'$or':_[_0x83ff('0x41')](_0x363eb4[_0x83ff('0x4a')],function(_0x4d64a5){var _0x30b0f7={};_0x30b0f7[_0x4d64a5]={'$like':'%'+_0x59a1e6[_0x83ff('0x46')][_0x83ff('0x51')]+'%'};return _0x30b0f7;})});}_0x363eb4=_[_0x83ff('0x52')]({},_0x363eb4,_0x59a1e6['options']);return _0x558dcf[_0x83ff('0x7a')](_0x363eb4);}})[_0x83ff('0x24')](function(_0x4dbc8a){if(_0x4dbc8a){_0x7ab248=_0x4dbc8a['length'];if(!_0x59a1e6[_0x83ff('0x46')]['hasOwnProperty'](_0x83ff('0x4d'))){_0x363eb4[_0x83ff('0x33')]=qs[_0x83ff('0x33')](_0x59a1e6[_0x83ff('0x46')][_0x83ff('0x33')]);_0x363eb4[_0x83ff('0x31')]=qs[_0x83ff('0x31')](_0x59a1e6[_0x83ff('0x46')][_0x83ff('0x31')]);}return _0x558dcf['getAgents'](_0x363eb4);}})[_0x83ff('0x24')](function(_0x2c7696){if(_0x2c7696){return _0x2c7696?{'count':_0x7ab248,'rows':_0x2c7696}:null;}})[_0x83ff('0x24')](respondWithResult(_0x2cfc99,null))['catch'](handleError(_0x2cfc99,null));};exports['addApplications']=function(_0xb9861,_0x278aaa){var _0x5713d8=_0xb9861[_0x83ff('0x57')]['id'];var _0x1de3b9=_0xb9861['body'];var _0xeca10f=0xc8;var _0x35d46e=null;return db[_0x83ff('0x7c')][_0x83ff('0x7d')]({'isolationLevel':db[_0x83ff('0x7c')][_0x83ff('0x7e')][_0x83ff('0x7f')][_0x83ff('0x80')]},function(_0x4c1a67){return db[_0x83ff('0x42')][_0x83ff('0x68')]({'where':{'id':_0x5713d8},'transaction':_0x4c1a67})[_0x83ff('0x24')](function(_0x210537){if(_0x210537){return db[_0x83ff('0x81')][_0x83ff('0x39')]({'where':{'WhatsappAccountId':_0x5713d8},'transaction':_0x4c1a67})[_0x83ff('0x24')](function(){var _0x4889a8=_[_0x83ff('0x41')](_0x1de3b9,function(_0x14ba50){_0x14ba50[_0x83ff('0x66')]=_0x5713d8;return _0x14ba50;});return db[_0x83ff('0x81')][_0x83ff('0x82')](_0x4889a8,{'transaction':_0x4c1a67});});}else{_0xeca10f=0x194;_0x35d46e=[];}});})[_0x83ff('0x24')](function(){if(_0xeca10f!==0x194){return db[_0x83ff('0x81')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x5713d8},'order':'priority'})['then'](function(_0x51c5af){_0x35d46e=_0x51c5af;});}})[_0x83ff('0x2e')](function(_0x2867ef){_0xeca10f=0x1f4;logger[_0x83ff('0x2a')](_0x2867ef['stack']);if(_0x2867ef['name']){delete _0x2867ef[_0x83ff('0x3e')];}_0x35d46e=_0x2867ef;})['finally'](function(){if(_0x35d46e===null){_0x278aaa['sendStatus'](_0xeca10f);}else{if(_0xeca10f===0x1f4){_0x278aaa['status'](_0xeca10f)[_0x83ff('0x83')](_0x35d46e);}else{_0x278aaa[_0x83ff('0x2f')](_0xeca10f)['json'](_0x35d46e);}}});};exports['getApplications']=function(_0x3d66fb,_0x2ee44f,_0x48710d){var _0x2f5325={};var _0xd39c0c={};var _0x579fc6;var _0x386309;return db[_0x83ff('0x42')][_0x83ff('0x68')]({'where':{'id':_0x3d66fb[_0x83ff('0x57')]['id']}})['then'](handleEntityNotFound(_0x2ee44f,null))[_0x83ff('0x24')](function(_0x21bf6a){if(_0x21bf6a){_0x579fc6=_0x21bf6a;_0xd39c0c['model']=_[_0x83ff('0x47')](db[_0x83ff('0x81')][_0x83ff('0x43')]);_0xd39c0c['query']=_[_0x83ff('0x47')](_0x3d66fb[_0x83ff('0x46')]);_0xd39c0c[_0x83ff('0x48')]=_[_0x83ff('0x49')](_0xd39c0c['model'],_0xd39c0c[_0x83ff('0x46')]);_0x2f5325['attributes']=_['intersection'](_0xd39c0c['model'],qs[_0x83ff('0x4b')](_0x3d66fb[_0x83ff('0x46')]['fields']));_0x2f5325[_0x83ff('0x4a')]=_0x2f5325[_0x83ff('0x4a')][_0x83ff('0x4c')]?_0x2f5325[_0x83ff('0x4a')]:_0xd39c0c[_0x83ff('0x45')];_0x2f5325[_0x83ff('0x4e')]=qs['sort'](_0x3d66fb[_0x83ff('0x46')]['sort']);_0x2f5325['where']=qs[_0x83ff('0x48')](_[_0x83ff('0x69')](_0x3d66fb[_0x83ff('0x46')],_0xd39c0c[_0x83ff('0x48')]));if(_0x3d66fb[_0x83ff('0x46')]['filter']){_0x2f5325['where']=_[_0x83ff('0x52')](_0x2f5325[_0x83ff('0x50')],{'$or':_[_0x83ff('0x41')](_0x2f5325[_0x83ff('0x4a')],function(_0x10edbe){var _0x3b275a={};_0x3b275a[_0x10edbe]={'$like':'%'+_0x3d66fb[_0x83ff('0x46')][_0x83ff('0x51')]+'%'};return _0x3b275a;})});}_0x2f5325=_[_0x83ff('0x52')]({},_0x2f5325,_0x3d66fb[_0x83ff('0x55')]);return _0x579fc6['getApplications'](_0x2f5325);}})[_0x83ff('0x24')](function(_0x341218){if(_0x341218){_0x386309=_0x341218[_0x83ff('0x4c')];if(!_0x3d66fb['query'][_0x83ff('0x84')](_0x83ff('0x4d'))){_0x2f5325[_0x83ff('0x33')]=qs[_0x83ff('0x33')](_0x3d66fb[_0x83ff('0x46')][_0x83ff('0x33')]);_0x2f5325['offset']=qs[_0x83ff('0x31')](_0x3d66fb[_0x83ff('0x46')][_0x83ff('0x31')]);}return _0x579fc6['getApplications'](_0x2f5325);}})[_0x83ff('0x24')](function(_0x525684){if(_0x525684){return _0x525684?{'count':_0x386309,'rows':_0x525684}:null;}})[_0x83ff('0x24')](respondWithResult(_0x2ee44f,null))[_0x83ff('0x2e')](handleError(_0x2ee44f,null));};exports['notify']=function(_0x3b29c7,_0x2c3e8c,_0x3b3cdc){var _0x71b004={'channel':_0x83ff('0x85')};var _0x5f121f=[];var _0x1adf32=[];var _0x2e4503={};return db['WhatsappAccount']['find']({'where':{'id':_0x3b29c7[_0x83ff('0x57')]['id']},'include':[{'model':db[_0x83ff('0x81')],'as':_0x83ff('0x86')}]})['then'](handleEntityNotFound(_0x2c3e8c,null))[_0x83ff('0x24')](function(_0xfbec96){_0x71b004[_0x83ff('0x87')]=_0xfbec96;if(_0x71b004[_0x83ff('0x87')]&&_0x71b004[_0x83ff('0x87')][_0x83ff('0x53')]===_0x83ff('0x88')&&_0x3b29c7['body'][_0x83ff('0x89')]){if(_0x3b29c7['body'][_0x83ff('0x89')][_0x83ff('0x4c')]===0x0)return;if(_0x3b29c7[_0x83ff('0x63')][_0x83ff('0x89')][0x0][_0x83ff('0x8a')]!==_0x83ff('0x8b'))return;return db[_0x83ff('0x8c')][_0x83ff('0x38')]({'read':!![],'readAt':_0x3b29c7['body'][_0x83ff('0x89')][0x0][_0x83ff('0x8d')]},{'where':{'messageId':_0x3b29c7[_0x83ff('0x63')]['statuses'][0x0][_0x83ff('0x8e')]},'individualHooks':!![]})[_0x83ff('0x24')](function(_0x53aeec){return _0x2c3e8c[_0x83ff('0x2f')](0xc8)[_0x83ff('0x30')](_0x53aeec);});}_0x71b004[_0x83ff('0x8f')]=_[_0x83ff('0x90')](_0xfbec96[_0x83ff('0x86')],['priority'],['asc']);if(_0x71b004['account'][_0x83ff('0x86')]){delete _0x71b004[_0x83ff('0x87')]['Applications'];}return db[_0x83ff('0x91')][_0x83ff('0x64')]()[_0x83ff('0x24')](function(_0x37335b){if(!_0x37335b){throw new db['Sequelize'][(_0x83ff('0x92'))](_0x83ff('0x93'));}_0x5f121f=_['difference'](_[_0x83ff('0x47')](_0x37335b),['createdAt','updatedAt']);_0x1adf32=_['difference'](_[_0x83ff('0x47')](_0x37335b),[_0x83ff('0x94'),_0x83ff('0x95'),_0x83ff('0x96'),_0x83ff('0x97')]);_0x71b004[_0x83ff('0x63')]={'mapKey':'mobile'};if(_0x71b004[_0x83ff('0x87')]&&_0x71b004['account'][_0x83ff('0x53')]===_0x83ff('0x98')){_0x71b004[_0x83ff('0x63')][_0x83ff('0x99')]=_0x3b29c7[_0x83ff('0x63')][_0x83ff('0x9a')][_0x83ff('0x9b')](_0x83ff('0x9c'),'');_0x71b004[_0x83ff('0x63')][_0x83ff('0x63')]=_0x3b29c7[_0x83ff('0x63')][_0x83ff('0x9d')];_0x71b004[_0x83ff('0x63')][_0x83ff('0x9e')]=_0x3b29c7[_0x83ff('0x63')][_0x83ff('0x9f')];}if(_0x71b004[_0x83ff('0x87')]&&_0x71b004['account']['type']==='sinch'){_0x71b004[_0x83ff('0x63')][_0x83ff('0x99')]=_0x3b29c7['body']['notifications'][0x0]['from'];_0x71b004[_0x83ff('0x63')]['body']=_0x3b29c7[_0x83ff('0x63')][_0x83ff('0xa0')][0x0][_0x83ff('0x2c')]['body'];_0x71b004[_0x83ff('0x63')]['messageId']=_0x3b29c7['body'][_0x83ff('0xa0')][0x0][_0x83ff('0x8e')];}if(_0x71b004['body']['id']){delete _0x71b004[_0x83ff('0x63')]['id'];}if(_['isNil'](_0x71b004[_0x83ff('0x63')][_0x83ff('0x99')])){throw new db[(_0x83ff('0xa1'))][(_0x83ff('0x92'))]('from\x20is\x20mandatory');}if(_[_0x83ff('0xa2')](_0x71b004['body'][_0x83ff('0x63')])||_0x71b004['body']['body']===''){throw new db[(_0x83ff('0xa1'))][(_0x83ff('0x92'))](_0x83ff('0xa3'));}if(_[_0x83ff('0xa2')](_0x71b004[_0x83ff('0x63')]['mapKey'])){throw new db[(_0x83ff('0xa1'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1adf32);}if(!_['includes'](_0x1adf32,_0x71b004[_0x83ff('0x63')][_0x83ff('0xa4')])){throw new db[(_0x83ff('0xa1'))][(_0x83ff('0x92'))](_0x83ff('0xa5')+_0x1adf32);}_0x2e4503[_0x71b004[_0x83ff('0x63')][_0x83ff('0xa4')]]=_0x71b004[_0x83ff('0x63')][_0x83ff('0x99')];return db[_0x83ff('0xa6')][_0x83ff('0x5a')]({'where':{'id':_0x71b004[_0x83ff('0x87')][_0x83ff('0x97')]},'include':[{'model':db[_0x83ff('0x91')],'as':_0x83ff('0xa7'),'where':_0x2e4503,'limit':0x1,'order':[[_0x83ff('0x95'),_0x83ff('0xa8')]]}]});})[_0x83ff('0x24')](handleEntityNotFound(_0x2c3e8c,null))[_0x83ff('0x24')](function(_0x1df49b){if(_0x1df49b){_0x71b004[_0x83ff('0xa9')]=_[_0x83ff('0x73')](_0x1df49b,[_0x83ff('0xa7')]);if(_0x1df49b[_0x83ff('0xa7')][_0x83ff('0x4c')]){return _0x1df49b[_0x83ff('0xa7')][0x0];}var _0x42f542=_[_0x83ff('0x1d')](_0x71b004['body'],{'firstName':_0x71b004[_0x83ff('0x63')][_0x83ff('0x99')],'ListId':_0x1df49b['id']});_0x42f542[_0x71b004[_0x83ff('0x63')][_0x83ff('0xa4')]]=_0x71b004[_0x83ff('0x63')]['from'];return db[_0x83ff('0x91')][_0x83ff('0x5b')](_0x42f542,{'fields':_0x5f121f,'raw':!![]});}})['then'](handleEntityNotFound(_0x2c3e8c,null))[_0x83ff('0x24')](function(_0x5897ca){if(_0x5897ca){_0x71b004[_0x83ff('0xaa')]=_0x5897ca;var _0x2b865d={'ContactId':_0x5897ca['id'],'phone':_0x71b004[_0x83ff('0x63')][_0x83ff('0x99')],'WhatsappAccountId':_0x3b29c7[_0x83ff('0x57')]['id']};var _0x3bfee1={'ContactId':_0x5897ca['id'],'WhatsappAccountId':_0x3b29c7[_0x83ff('0x57')]['id'],'closed':![]};return db[_0x83ff('0xab')][_0x83ff('0x5a')]({'where':_0x3bfee1})[_0x83ff('0x24')](function(_0x7400b0){if(_0x7400b0){return[_0x7400b0,![]];}return db[_0x83ff('0xab')][_0x83ff('0x5b')](_0x2b865d)[_0x83ff('0x24')](function(_0xbe131b){return[_0xbe131b,!![]];});});}})[_0x83ff('0x74')](function(_0x57120d,_0x344586){_0x71b004['interaction']=_0x57120d['get']({'plain':!![]});_0x71b004[_0x83ff('0xac')][_0x83ff('0xad')]=![];if(_0x344586){if(_0x71b004['account'][_0x83ff('0xae')]){_0x71b004['applications'][_0x83ff('0xaf')]({'id':0x0,'priority':_0x71b004['applications'][_0x83ff('0x4c')]+0x1,'app':'close','appdata':_0x83ff('0xb0'),'interval':_0x83ff('0xb1')});}_0x71b004[_0x83ff('0xac')][_0x83ff('0xad')]=!![];}return db[_0x83ff('0x8c')][_0x83ff('0x5b')]({'phone':_0x71b004['body'][_0x83ff('0x99')],'messageId':_0x71b004[_0x83ff('0x63')][_0x83ff('0x9e')],'body':_0x71b004['body'][_0x83ff('0x63')],'WhatsappAccountId':_0x3b29c7[_0x83ff('0x57')]['id'],'WhatsappInteractionId':_0x57120d['id'],'direction':'in','ContactId':_0x57120d[_0x83ff('0xb2')],'AttachmentId':_0x71b004[_0x83ff('0x63')][_0x83ff('0xb3')]});})['then'](function(_0x265a33){_0x71b004[_0x83ff('0x2c')]=_0x265a33;if(_0x71b004[_0x83ff('0xac')][_0x83ff('0xb4')]){return db[_0x83ff('0x7b')][_0x83ff('0x5a')]({'attributes':['id','name'],'where':{'id':_0x71b004['interaction'][_0x83ff('0xb4')]}})['then'](function(_0x25edd2){if(_0x25edd2){_0x71b004[_0x83ff('0x8f')][_0x83ff('0xb5')]({'id':0x0,'priority':0x0,'app':_0x83ff('0xb6'),'appdata':_0x25edd2[_0x83ff('0x3e')]+','+(_0x71b004[_0x83ff('0x87')][_0x83ff('0xb7')]||0xa),'interval':_0x83ff('0xb1')});}return respondWithRpcPromise('Start',_0x83ff('0xb8'),_0x71b004);});}return respondWithRpcPromise('Start',_0x83ff('0xb8'),_0x71b004);})[_0x83ff('0x24')](function(_0x177c5b){if(_0x177c5b){var _0x378461=0xc8;var _0xd2f60=_0x83ff('0xb9');logger['info'](_0x83ff('0x27'),_0xd2f60,_0x378461,'entity\x20found');logger[_0x83ff('0x26')](_0x83ff('0xba'),_0xd2f60,_0x378461,_0x83ff('0xbb'),JSON[_0x83ff('0x29')](_0x177c5b));if(_0x71b004[_0x83ff('0x87')][_0x83ff('0x53')]===_0x83ff('0x98')){return _0x2c3e8c[_0x83ff('0x2f')](_0x378461)[_0x83ff('0x35')](_0x83ff('0xbc'),_0x83ff('0xbd'))['send'](_0x83ff('0xbe'));}else{return _0x2c3e8c[_0x83ff('0x2f')](_0x378461)[_0x83ff('0x30')](_0x177c5b);}}});})[_0x83ff('0x2e')](handleError(_0x2c3e8c,null));};exports[_0x83ff('0x83')]=function(_0x487bca,_0x50bef7,_0x1573af){var _0x3a4bd4,_0x1e611c,_0x451b89;if(_[_0x83ff('0xa2')](_0x487bca[_0x83ff('0x63')]['body'])||_0x487bca['body'][_0x83ff('0x63')]===''){throw new db[(_0x83ff('0xa1'))]['ValidationError'](_0x83ff('0xa3'));}if(_['isNil'](_0x487bca[_0x83ff('0x63')]['to'])){throw new db[(_0x83ff('0xa1'))][(_0x83ff('0x92'))](_0x83ff('0xbf'));}_0x3a4bd4=_0x487bca[_0x83ff('0x63')]['to'];return db[_0x83ff('0x42')][_0x83ff('0x5a')]({'where':{'id':_0x487bca[_0x83ff('0x57')]['id']},'include':[{'model':db[_0x83ff('0xa6')],'as':_0x83ff('0xc0'),'include':[{'model':db[_0x83ff('0x91')],'as':_0x83ff('0xa7'),'where':{'mobile':_0x3a4bd4},'limit':0x1,'order':[[_0x83ff('0x95'),_0x83ff('0xa8')]]}]}]})[_0x83ff('0x24')](handleEntityNotFound(_0x50bef7,null))[_0x83ff('0x24')](function(_0x37fd1d){if(_0x37fd1d&&_0x37fd1d[_0x83ff('0xc0')]){_0x1e611c=_0x37fd1d[_0x83ff('0x3a')]({'plain':!![]});if(_0x1e611c[_0x83ff('0xc0')]&&_0x1e611c[_0x83ff('0xc0')][_0x83ff('0xa7')][_0x83ff('0x4c')]){return _0x1e611c[_0x83ff('0xc0')][_0x83ff('0xa7')][0x0];}return db['CmContact'][_0x83ff('0x5b')](_['defaults'](_0x487bca[_0x83ff('0x63')],{'firstName':_0x3a4bd4,'mobile':_0x3a4bd4,'phone':_0x3a4bd4,'ListId':_0x1e611c[_0x83ff('0x97')]}));}})[_0x83ff('0x24')](handleEntityNotFound(_0x50bef7,null))[_0x83ff('0x24')](function(_0x34c000){if(_0x34c000){_0x451b89=_0x34c000;return db['WhatsappInteraction'][_0x83ff('0x5a')]({'where':{'ContactId':_0x451b89['id'],'closed':![],'WhatsappAccountId':_0x1e611c['id']}})[_0x83ff('0x24')](function(_0x2d1c03){if(_0x2d1c03){return[_0x2d1c03,![]];}return db[_0x83ff('0xab')]['create']({'UserId':_0x487bca[_0x83ff('0xc1')]['id'],'ContactId':_0x451b89['id'],'WhatsappAccountId':_0x1e611c['id'],'phone':_0x3a4bd4,'firstMsgDirection':'out','Messages':[_[_0x83ff('0x52')](_0x487bca['body'],{'read':![],'body':_0x487bca[_0x83ff('0x63')][_0x83ff('0x63')],'phone':_0x3a4bd4,'WhatsappAccountId':_0x1e611c['id'],'UserId':_0x487bca[_0x83ff('0xc1')]['id'],'ContactId':_0x451b89['id']})]},{'include':[{'model':db[_0x83ff('0x8c')],'as':'Messages'}]})[_0x83ff('0x24')](function(_0x16e471){return[_0x16e471,!![]];});});}})[_0x83ff('0x74')](function(_0x2d194f,_0x534d47){if(_0x534d47){return _0x2d194f;}return db[_0x83ff('0x8c')]['create'](_[_0x83ff('0x52')](_0x487bca[_0x83ff('0x63')],{'read':![],'body':_0x487bca[_0x83ff('0x63')][_0x83ff('0x63')],'phone':_0x3a4bd4,'WhatsappAccountId':_0x1e611c['id'],'WhatsappInteractionId':_0x2d194f['id'],'UserId':_0x487bca['user']['id'],'ContactId':_0x451b89['id']}))[_0x83ff('0x24')](function(_0x3e9a2a){_0x2d194f['dataValues']['Messages']=[];_0x2d194f[_0x83ff('0xc2')][_0x83ff('0xc3')]['push'](_0x3e9a2a['dataValues']);return _0x2d194f;});})[_0x83ff('0x24')](respondWithResult(_0x50bef7,null))[_0x83ff('0x2e')](handleError(_0x50bef7,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index c9bb16c..144cd0d 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 _0xfed3=['hasOwnProperty','hook','exports','events','WhatsappAccount','setMaxListeners','save','update','remove','emit'];(function(_0x90a39a,_0x32020d){var _0x2b62f7=function(_0x6841cc){while(--_0x6841cc){_0x90a39a['push'](_0x90a39a['shift']());}};_0x2b62f7(++_0x32020d);}(_0xfed3,0xe9));var _0x3fed=function(_0x40df5f,_0x8fd59f){_0x40df5f=_0x40df5f-0x0;var _0x1573f1=_0xfed3[_0x40df5f];return _0x1573f1;};'use strict';var EventEmitter=require(_0x3fed('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x3fed('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x3fed('0x2')](0x0);var events={'afterCreate':_0x3fed('0x3'),'afterUpdate':_0x3fed('0x4'),'afterDestroy':_0x3fed('0x5')};function emitEvent(_0x3cd10b){return function(_0x736881,_0x1c5784,_0x1ca8d7){WhatsappAccountEvents[_0x3fed('0x6')](_0x3cd10b+':'+_0x736881['id'],_0x736881);WhatsappAccountEvents['emit'](_0x3cd10b,_0x736881);_0x1ca8d7(null);};}for(var e in events){if(events[_0x3fed('0x7')](e)){var event=events[e];WhatsappAccount[_0x3fed('0x8')](e,emitEvent(event));}}module[_0x3fed('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x3219=['update','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x4f6fff,_0x557207){var _0x48556c=function(_0x508f09){while(--_0x508f09){_0x4f6fff['push'](_0x4f6fff['shift']());}};_0x48556c(++_0x557207);}(_0x3219,0x1b4));var _0x9321=function(_0x4551f6,_0x48151b){_0x4551f6=_0x4551f6-0x0;var _0x581dc2=_0x3219[_0x4551f6];return _0x581dc2;};'use strict';var EventEmitter=require(_0x9321('0x0'));var WhatsappAccount=require(_0x9321('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x9321('0x2')](0x0);var events={'afterCreate':_0x9321('0x3'),'afterUpdate':_0x9321('0x4'),'afterDestroy':'remove'};function emitEvent(_0xf68ee4){return function(_0x1d5c95,_0x5eb249,_0x579b36){WhatsappAccountEvents['emit'](_0xf68ee4+':'+_0x1d5c95['id'],_0x1d5c95);WhatsappAccountEvents['emit'](_0xf68ee4,_0x1d5c95);_0x579b36(null);};}for(var e in events){if(events[_0x9321('0x5')](e)){var event=events[e];WhatsappAccount[_0x9321('0x6')](e,emitEvent(event));}}module[_0x9321('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index ce435c5..159f2c3 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 _0xfecf=['util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','whatsapp_accounts','lodash'];(function(_0x1e5228,_0x5da578){var _0x2d43fc=function(_0x1653e7){while(--_0x1653e7){_0x1e5228['push'](_0x1e5228['shift']());}};_0x2d43fc(++_0x5da578);}(_0xfecf,0x1b7));var _0xffec=function(_0x2b9816,_0x49d6d8){_0x2b9816=_0x2b9816-0x0;var _0x29fc55=_0xfecf[_0x2b9816];return _0x29fc55;};'use strict';var _=require(_0xffec('0x0'));var util=require(_0xffec('0x1'));var logger=require(_0xffec('0x2'))('api');var moment=require(_0xffec('0x3'));var BPromise=require('bluebird');var rp=require(_0xffec('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xffec('0x5'));var config=require(_0xffec('0x6'));var attributes=require(_0xffec('0x7'));module[_0xffec('0x8')]=function(_0x2e5070,_0x5ace83){return _0x2e5070[_0xffec('0x9')]('WhatsappAccount',attributes,{'tableName':_0xffec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c2d=['./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x2f1a10,_0x6d5e90){var _0x4b1d97=function(_0x27b85d){while(--_0x27b85d){_0x2f1a10['push'](_0x2f1a10['shift']());}};_0x4b1d97(++_0x6d5e90);}(_0x1c2d,0x1ef));var _0xd1c2=function(_0x2e3a9a,_0x359c4f){_0x2e3a9a=_0x2e3a9a-0x0;var _0x106931=_0x1c2d[_0x2e3a9a];return _0x106931;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd1c2('0x0'))('api');var moment=require('moment');var BPromise=require(_0xd1c2('0x1'));var rp=require(_0xd1c2('0x2'));var fs=require('fs');var path=require(_0xd1c2('0x3'));var rimraf=require(_0xd1c2('0x4'));var config=require('../../config/environment');var attributes=require(_0xd1c2('0x5'));module[_0xd1c2('0x6')]=function(_0x16b861,_0x4861aa){return _0x16b861[_0xd1c2('0x7')](_0xd1c2('0x8'),attributes,{'tableName':_0xd1c2('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 0128335..a00199f 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 _0xda4e=['message','result','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','map','model','include','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x14679f,_0x4afd91){var _0x35c8e7=function(_0x2bfaee){while(--_0x2bfaee){_0x14679f['push'](_0x14679f['shift']());}};_0x35c8e7(++_0x4afd91);}(_0xda4e,0x1a4));var _0xeda4=function(_0x49920d,_0x2a06da){_0x49920d=_0x49920d-0x0;var _0x543df5=_0xda4e[_0x49920d];return _0x543df5;};'use strict';var _=require(_0xeda4('0x0'));var util=require(_0xeda4('0x1'));var moment=require(_0xeda4('0x2'));var BPromise=require(_0xeda4('0x3'));var rs=require(_0xeda4('0x4'));var fs=require('fs');var Redis=require(_0xeda4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xeda4('0x6'));var logger=require('../../config/logger')(_0xeda4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xeda4('0x8')]({'port':0x232a});config[_0xeda4('0x9')]=_[_0xeda4('0xa')](config['redis'],{'host':_0xeda4('0xb'),'port':0x18eb});var socket=require(_0xeda4('0xc'))(new Redis(config['redis']));require(_0xeda4('0xd'))['register'](socket);function respondWithRpcPromise(_0xa31394,_0x343106,_0x3a2acc){return new BPromise(function(_0x151c7f,_0x1c2cdc){return client[_0xeda4('0xe')](_0xa31394,_0x3a2acc)[_0xeda4('0xf')](function(_0x1da6b9){logger[_0xeda4('0x10')](_0xeda4('0x11'),_0x343106,_0xeda4('0x12'));logger[_0xeda4('0x13')](_0xeda4('0x14'),_0x343106,'request\x20sent',JSON[_0xeda4('0x15')](_0x1da6b9));if(_0x1da6b9['error']){if(_0x1da6b9['error'][_0xeda4('0x16')]===0x1f4){logger[_0xeda4('0x17')](_0xeda4('0x11'),_0x343106,_0x1da6b9['error'][_0xeda4('0x18')]);return _0x1c2cdc(_0x1da6b9[_0xeda4('0x17')][_0xeda4('0x18')]);}logger[_0xeda4('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x343106,_0x1da6b9[_0xeda4('0x17')][_0xeda4('0x18')]);return _0x151c7f(_0x1da6b9['error'][_0xeda4('0x18')]);}else{logger[_0xeda4('0x10')](_0xeda4('0x11'),_0x343106,_0xeda4('0x12'));_0x151c7f(_0x1da6b9[_0xeda4('0x19')][_0xeda4('0x18')]);}})['catch'](function(_0x5f347a){logger[_0xeda4('0x17')](_0xeda4('0x11'),_0x343106,_0x5f347a);_0x1c2cdc(_0x5f347a);});});}exports[_0xeda4('0x1a')]=function(_0x3fdb8f){var _0x24980a=this;return new Promise(function(_0x4bd3a9,_0x10d4b8){return db[_0xeda4('0x1b')][_0xeda4('0x1c')]({'raw':_0x3fdb8f[_0xeda4('0x1d')]?_0x3fdb8f[_0xeda4('0x1d')][_0xeda4('0x1e')]===undefined?!![]:![]:!![],'where':_0x3fdb8f[_0xeda4('0x1d')]?_0x3fdb8f[_0xeda4('0x1d')][_0xeda4('0x1f')]||null:null,'attributes':_0x3fdb8f[_0xeda4('0x1d')]?_0x3fdb8f['options'][_0xeda4('0x20')]||null:null,'include':_0x3fdb8f[_0xeda4('0x1d')]?_0x3fdb8f[_0xeda4('0x1d')]['include']?_[_0xeda4('0x21')](_0x3fdb8f[_0xeda4('0x1d')]['include'],function(_0x59165f){return{'model':db[_0x59165f[_0xeda4('0x22')]],'as':_0x59165f['as'],'attributes':_0x59165f[_0xeda4('0x20')],'include':_0x59165f[_0xeda4('0x23')]?_[_0xeda4('0x21')](_0x59165f[_0xeda4('0x23')],function(_0x33d828){return{'model':db[_0x33d828[_0xeda4('0x22')]],'as':_0x33d828['as'],'attributes':_0x33d828[_0xeda4('0x20')],'include':_0x33d828[_0xeda4('0x23')]?_[_0xeda4('0x21')](_0x33d828['include'],function(_0x4700c8){return{'model':db[_0x4700c8[_0xeda4('0x22')]],'as':_0x4700c8['as'],'attributes':_0x4700c8[_0xeda4('0x20')]};}):[]};}):[]};}):[]:[]})[_0xeda4('0xf')](function(_0x3d6a55){logger[_0xeda4('0x10')]('ShowWhatsappAccount',_0x3fdb8f);logger[_0xeda4('0x13')](_0xeda4('0x1a'),_0x3fdb8f,JSON[_0xeda4('0x15')](_0x3d6a55));_0x4bd3a9(_0x3d6a55);})[_0xeda4('0x24')](function(_0x3b4581){logger[_0xeda4('0x17')](_0xeda4('0x1a'),_0x3b4581['message'],_0x3fdb8f);_0x10d4b8(_0x24980a['error'](0x1f4,_0x3b4581[_0xeda4('0x18')]));});});}; \ No newline at end of file +var _0x1e99=['debug','ShowWhatsappAccount','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','WhatsappAccount','find','raw','options','attributes','include','map','model'];(function(_0x3fb5f7,_0x3b234b){var _0x344db7=function(_0x4a6485){while(--_0x4a6485){_0x3fb5f7['push'](_0x3fb5f7['shift']());}};_0x344db7(++_0x3b234b);}(_0x1e99,0x1d7));var _0x91e9=function(_0x1d38d4,_0xe00b02){_0x1d38d4=_0x1d38d4-0x0;var _0x25acef=_0x1e99[_0x1d38d4];return _0x25acef;};'use strict';var _=require(_0x91e9('0x0'));var util=require(_0x91e9('0x1'));var moment=require(_0x91e9('0x2'));var BPromise=require(_0x91e9('0x3'));var rs=require(_0x91e9('0x4'));var fs=require('fs');var Redis=require(_0x91e9('0x5'));var db=require(_0x91e9('0x6'))['db'];var utils=require(_0x91e9('0x7'));var logger=require(_0x91e9('0x8'))('rpc');var config=require(_0x91e9('0x9'));var jayson=require(_0x91e9('0xa'));var client=jayson[_0x91e9('0xb')][_0x91e9('0xc')]({'port':0x232a});config[_0x91e9('0xd')]=_[_0x91e9('0xe')](config[_0x91e9('0xd')],{'host':_0x91e9('0xf'),'port':0x18eb});var socket=require(_0x91e9('0x10'))(new Redis(config[_0x91e9('0xd')]));require(_0x91e9('0x11'))['register'](socket);function respondWithRpcPromise(_0x30e1c8,_0x3f8fa0,_0xacedba){return new BPromise(function(_0x19b29d,_0x1c1050){return client[_0x91e9('0x12')](_0x30e1c8,_0xacedba)[_0x91e9('0x13')](function(_0x35ec46){logger[_0x91e9('0x14')](_0x91e9('0x15'),_0x3f8fa0,_0x91e9('0x16'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3f8fa0,_0x91e9('0x16'),JSON[_0x91e9('0x17')](_0x35ec46));if(_0x35ec46['error']){if(_0x35ec46[_0x91e9('0x18')][_0x91e9('0x19')]===0x1f4){logger[_0x91e9('0x18')](_0x91e9('0x15'),_0x3f8fa0,_0x35ec46[_0x91e9('0x18')][_0x91e9('0x1a')]);return _0x1c1050(_0x35ec46[_0x91e9('0x18')][_0x91e9('0x1a')]);}logger[_0x91e9('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x3f8fa0,_0x35ec46['error'][_0x91e9('0x1a')]);return _0x19b29d(_0x35ec46[_0x91e9('0x18')][_0x91e9('0x1a')]);}else{logger[_0x91e9('0x14')](_0x91e9('0x15'),_0x3f8fa0,_0x91e9('0x16'));_0x19b29d(_0x35ec46[_0x91e9('0x1b')][_0x91e9('0x1a')]);}})['catch'](function(_0x471084){logger[_0x91e9('0x18')](_0x91e9('0x15'),_0x3f8fa0,_0x471084);_0x1c1050(_0x471084);});});}exports['ShowWhatsappAccount']=function(_0x424bdf){var _0x3177c6=this;return new Promise(function(_0x22b3ea,_0x41158e){return db[_0x91e9('0x1c')][_0x91e9('0x1d')]({'raw':_0x424bdf['options']?_0x424bdf['options'][_0x91e9('0x1e')]===undefined?!![]:![]:!![],'where':_0x424bdf['options']?_0x424bdf['options']['where']||null:null,'attributes':_0x424bdf['options']?_0x424bdf[_0x91e9('0x1f')][_0x91e9('0x20')]||null:null,'include':_0x424bdf[_0x91e9('0x1f')]?_0x424bdf[_0x91e9('0x1f')][_0x91e9('0x21')]?_[_0x91e9('0x22')](_0x424bdf[_0x91e9('0x1f')][_0x91e9('0x21')],function(_0x24588b){return{'model':db[_0x24588b[_0x91e9('0x23')]],'as':_0x24588b['as'],'attributes':_0x24588b[_0x91e9('0x20')],'include':_0x24588b[_0x91e9('0x21')]?_[_0x91e9('0x22')](_0x24588b[_0x91e9('0x21')],function(_0x13c307){return{'model':db[_0x13c307[_0x91e9('0x23')]],'as':_0x13c307['as'],'attributes':_0x13c307[_0x91e9('0x20')],'include':_0x13c307[_0x91e9('0x21')]?_[_0x91e9('0x22')](_0x13c307[_0x91e9('0x21')],function(_0x24f327){return{'model':db[_0x24f327[_0x91e9('0x23')]],'as':_0x24f327['as'],'attributes':_0x24f327[_0x91e9('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1782b4){logger[_0x91e9('0x14')]('ShowWhatsappAccount',_0x424bdf);logger[_0x91e9('0x24')](_0x91e9('0x25'),_0x424bdf,JSON[_0x91e9('0x17')](_0x1782b4));_0x22b3ea(_0x1782b4);})[_0x91e9('0x26')](function(_0x12318d){logger['error']('ShowWhatsappAccount',_0x12318d[_0x91e9('0x1a')],_0x424bdf);_0x41158e(_0x3177c6[_0x91e9('0x18')](0x1f4,_0x12318d[_0x91e9('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 5128e5e..5d21213 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 _0xd983=['save','update','emit','removeListener','length','./whatsappAccount.events'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0xd983,0xdd));var _0x3d98=function(_0x2bbca2,_0x20c91b){_0x2bbca2=_0x2bbca2-0x0;var _0x2490b3=_0xd983[_0x2bbca2];return _0x2490b3;};'use strict';var WhatsappAccountEvents=require(_0x3d98('0x0'));var events=[_0x3d98('0x1'),'remove',_0x3d98('0x2')];function createListener(_0x20b2f9,_0x429e65){return function(_0x178015){_0x429e65[_0x3d98('0x3')](_0x20b2f9,_0x178015);};}function removeListener(_0x522af,_0x5473bc){return function(){WhatsappAccountEvents[_0x3d98('0x4')](_0x522af,_0x5473bc);};}exports['register']=function(_0x47e709){for(var _0x535851=0x0,_0x4876f5=events[_0x3d98('0x5')];_0x535851<_0x4876f5;_0x535851++){var _0x1063b5=events[_0x535851];var _0x8458c3=createListener('whatsappAccount:'+_0x1063b5,_0x47e709);WhatsappAccountEvents['on'](_0x1063b5,_0x8458c3);}}; \ No newline at end of file +var _0xf5f2=['save','remove','update','emit','whatsappAccount:','./whatsappAccount.events'];(function(_0x2991f6,_0x386557){var _0x308a0f=function(_0x45d29e){while(--_0x45d29e){_0x2991f6['push'](_0x2991f6['shift']());}};_0x308a0f(++_0x386557);}(_0xf5f2,0x1a3));var _0x2f5f=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xf5f2[_0x160c73];return _0xd9302;};'use strict';var WhatsappAccountEvents=require(_0x2f5f('0x0'));var events=[_0x2f5f('0x1'),_0x2f5f('0x2'),_0x2f5f('0x3')];function createListener(_0x4365d3,_0x509c41){return function(_0x34941c){_0x509c41[_0x2f5f('0x4')](_0x4365d3,_0x34941c);};}function removeListener(_0x2db429,_0x4d35ab){return function(){WhatsappAccountEvents['removeListener'](_0x2db429,_0x4d35ab);};}exports['register']=function(_0x134053){for(var _0x1e3426=0x0,_0x279f6b=events['length'];_0x1e3426<_0x279f6b;_0x1e3426++){var _0x3740f5=events[_0x1e3426];var _0x2f99f4=createListener(_0x2f5f('0x5')+_0x3740f5,_0x134053);WhatsappAccountEvents['on'](_0x3740f5,_0x2f99f4);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 8d9e0f7..fe7b67e 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 _0x9926=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','update'];(function(_0x58de65,_0x218b80){var _0x2282db=function(_0x26bc86){while(--_0x26bc86){_0x58de65['push'](_0x58de65['shift']());}};_0x2282db(++_0x218b80);}(_0x9926,0x1cb));var _0x6992=function(_0x45ec62,_0x2d0024){_0x45ec62=_0x45ec62-0x0;var _0x5e39c1=_0x9926[_0x45ec62];return _0x5e39c1;};'use strict';var multer=require(_0x6992('0x0'));var util=require(_0x6992('0x1'));var path=require('path');var timeout=require(_0x6992('0x2'));var express=require(_0x6992('0x3'));var router=express[_0x6992('0x4')]();var fs_extra=require(_0x6992('0x5'));var auth=require(_0x6992('0x6'));var interaction=require(_0x6992('0x7'));var config=require(_0x6992('0x8'));var controller=require(_0x6992('0x9'));router[_0x6992('0xa')]('/',auth[_0x6992('0xb')](),controller[_0x6992('0xc')]);router[_0x6992('0xa')](_0x6992('0xd'),auth[_0x6992('0xb')](),controller[_0x6992('0xe')]);router['post']('/',auth[_0x6992('0xb')](),controller['create']);router['put']('/:id',auth[_0x6992('0xb')](),controller[_0x6992('0xf')]);router[_0x6992('0x10')](_0x6992('0xd'),auth[_0x6992('0xb')](),controller[_0x6992('0x11')]);module[_0x6992('0x12')]=router; \ No newline at end of file +var _0xb31f=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','isAuthenticated','index','/:id','show','post'];(function(_0x3718b7,_0x2da677){var _0xf8c91e=function(_0x2519b4){while(--_0x2519b4){_0x3718b7['push'](_0x3718b7['shift']());}};_0xf8c91e(++_0x2da677);}(_0xb31f,0x1aa));var _0xfb31=function(_0x602ca8,_0x568e82){_0x602ca8=_0x602ca8-0x0;var _0x26e8ab=_0xb31f[_0x602ca8];return _0x26e8ab;};'use strict';var multer=require(_0xfb31('0x0'));var util=require(_0xfb31('0x1'));var path=require(_0xfb31('0x2'));var timeout=require(_0xfb31('0x3'));var express=require(_0xfb31('0x4'));var router=express['Router']();var fs_extra=require(_0xfb31('0x5'));var auth=require(_0xfb31('0x6'));var interaction=require(_0xfb31('0x7'));var config=require('../../config/environment');var controller=require(_0xfb31('0x8'));router['get']('/',auth[_0xfb31('0x9')](),controller[_0xfb31('0xa')]);router['get'](_0xfb31('0xb'),auth['isAuthenticated'](),controller[_0xfb31('0xc')]);router[_0xfb31('0xd')]('/',auth[_0xfb31('0x9')](),controller[_0xfb31('0xe')]);router[_0xfb31('0xf')]('/:id',auth[_0xfb31('0x9')](),controller[_0xfb31('0x10')]);router[_0xfb31('0x11')](_0xfb31('0xb'),auth[_0xfb31('0x9')](),controller[_0xfb31('0x12')]);module[_0xfb31('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 98742ba..24a7185 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 _0xc5e9=['*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x5a532a,_0x3eaad1){var _0x41a89b=function(_0x2f6dfe){while(--_0x2f6dfe){_0x5a532a['push'](_0x5a532a['shift']());}};_0x41a89b(++_0x3eaad1);}(_0xc5e9,0xe7));var _0x9c5e=function(_0x30cb72,_0x454f13){_0x30cb72=_0x30cb72-0x0;var _0x2fcc04=_0xc5e9[_0x30cb72];return _0x2fcc04;};'use strict';var Sequelize=require(_0x9c5e('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9c5e('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9c5e('0x2')],'allowNull':![],'defaultValue':_0x9c5e('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9c5e('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9c5e('0x4')}}; \ No newline at end of file +var _0x186c=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x494b8c,_0x26e8f9){var _0x1b3230=function(_0x4d2fa9){while(--_0x4d2fa9){_0x494b8c['push'](_0x494b8c['shift']());}};_0x1b3230(++_0x26e8f9);}(_0x186c,0xa9));var _0xc186=function(_0x49036e,_0x1eed49){_0x49036e=_0x49036e-0x0;var _0xb21daf=_0x186c[_0x49036e];return _0xb21daf;};'use strict';var Sequelize=require(_0xc186('0x0'));module[_0xc186('0x1')]={'priority':{'type':Sequelize[_0xc186('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc186('0x3')],'allowNull':![],'defaultValue':_0xc186('0x4')},'appdata':{'type':Sequelize[_0xc186('0x5')]()},'description':{'type':Sequelize[_0xc186('0x3')]},'interval':{'type':Sequelize[_0xc186('0x3')],'defaultValue':_0xc186('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 58d1eb0..58a5fbb 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 _0x7ebb=['destroy','error','stack','name','send','index','WhatsappApplication','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then'];(function(_0x1430e4,_0x5c7281){var _0x186e50=function(_0x1b79f4){while(--_0x1b79f4){_0x1430e4['push'](_0x1430e4['shift']());}};_0x186e50(++_0x5c7281);}(_0x7ebb,0x161));var _0xb7eb=function(_0x4ce2c7,_0x269739){_0x4ce2c7=_0x4ce2c7-0x0;var _0x518f70=_0x7ebb[_0x4ce2c7];return _0x518f70;};'use strict';var emlformat=require(_0xb7eb('0x0'));var rimraf=require(_0xb7eb('0x1'));var zipdir=require(_0xb7eb('0x2'));var jsonpatch=require(_0xb7eb('0x3'));var rp=require(_0xb7eb('0x4'));var moment=require(_0xb7eb('0x5'));var BPromise=require(_0xb7eb('0x6'));var Mustache=require('mustache');var util=require(_0xb7eb('0x7'));var path=require(_0xb7eb('0x8'));var sox=require(_0xb7eb('0x9'));var csv=require(_0xb7eb('0xa'));var ejs=require(_0xb7eb('0xb'));var fs=require('fs');var fs_extra=require(_0xb7eb('0xc'));var _=require(_0xb7eb('0xd'));var squel=require(_0xb7eb('0xe'));var crypto=require(_0xb7eb('0xf'));var jsforce=require(_0xb7eb('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb7eb('0x11'));var Papa=require(_0xb7eb('0x12'));var Redis=require(_0xb7eb('0x13'));var authService=require(_0xb7eb('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xb7eb('0x15'));var hardwareService=require(_0xb7eb('0x16'));var logger=require('../../config/logger')(_0xb7eb('0x17'));var utils=require(_0xb7eb('0x18'));var config=require(_0xb7eb('0x19'));var licenseUtil=require(_0xb7eb('0x1a'));var db=require(_0xb7eb('0x1b'))['db'];function respondWithStatusCode(_0x24e51b,_0x3cf3ca){_0x3cf3ca=_0x3cf3ca||0xcc;return function(_0x5932b9){if(_0x5932b9){return _0x24e51b[_0xb7eb('0x1c')](_0x3cf3ca);}return _0x24e51b[_0xb7eb('0x1d')](_0x3cf3ca)[_0xb7eb('0x1e')]();};}function respondWithResult(_0x5e50f0,_0x3b2af5){_0x3b2af5=_0x3b2af5||0xc8;return function(_0xbd0a5a){if(_0xbd0a5a){return _0x5e50f0[_0xb7eb('0x1d')](_0x3b2af5)[_0xb7eb('0x1f')](_0xbd0a5a);}};}function respondWithFilteredResult(_0x560f8f,_0x348cc5){return function(_0x55c850){if(_0x55c850){var _0x4977b5=typeof _0x348cc5[_0xb7eb('0x20')]===_0xb7eb('0x21')&&typeof _0x348cc5['limit']===_0xb7eb('0x21');var _0x2186ae=_0x55c850[_0xb7eb('0x22')];var _0x1c0294=_0x4977b5?0x0:_0x348cc5['offset'];var _0x36fc4d=_0x4977b5?_0x55c850['count']:_0x348cc5[_0xb7eb('0x20')]+_0x348cc5[_0xb7eb('0x23')];var _0x4b74f3;if(_0x36fc4d>=_0x2186ae){_0x36fc4d=_0x2186ae;_0x4b74f3=0xc8;}else{_0x4b74f3=0xce;}_0x560f8f[_0xb7eb('0x1d')](_0x4b74f3);return _0x560f8f['set'](_0xb7eb('0x24'),_0x1c0294+'-'+_0x36fc4d+'/'+_0x2186ae)[_0xb7eb('0x1f')](_0x55c850);}return null;};}function patchUpdates(_0x1b6036){return function(_0x24657e){try{jsonpatch[_0xb7eb('0x25')](_0x24657e,_0x1b6036,!![]);}catch(_0x36beb6){return BPromise[_0xb7eb('0x26')](_0x36beb6);}return _0x24657e[_0xb7eb('0x27')]();};}function saveUpdates(_0x874ba5,_0x4c5cc8){return function(_0x53071f){if(_0x53071f){return _0x53071f[_0xb7eb('0x28')](_0x874ba5)[_0xb7eb('0x29')](function(_0x3ad448){return _0x3ad448;});}return null;};}function removeEntity(_0x29e197,_0x68c3d0){return function(_0x5bdadf){if(_0x5bdadf){return _0x5bdadf[_0xb7eb('0x2a')]()[_0xb7eb('0x29')](function(){_0x29e197[_0xb7eb('0x1d')](0xcc)[_0xb7eb('0x1e')]();});}};}function handleEntityNotFound(_0x48e4d7,_0x202b4d){return function(_0x48dabb){if(!_0x48dabb){_0x48e4d7[_0xb7eb('0x1c')](0x194);}return _0x48dabb;};}function handleError(_0x1b7617,_0xbba0bb){_0xbba0bb=_0xbba0bb||0x1f4;return function(_0x56a5d7){logger[_0xb7eb('0x2b')](_0x56a5d7[_0xb7eb('0x2c')]);if(_0x56a5d7[_0xb7eb('0x2d')]){delete _0x56a5d7[_0xb7eb('0x2d')];}_0x1b7617[_0xb7eb('0x1d')](_0xbba0bb)[_0xb7eb('0x2e')](_0x56a5d7);};}exports[_0xb7eb('0x2f')]=function(_0x23aee6,_0x841096){var _0x156e2b={},_0xc68143={},_0x3d75ed={'count':0x0,'rows':[]};var _0x2d19bf=_['map'](db[_0xb7eb('0x30')]['rawAttributes'],function(_0x20f0c0){return{'name':_0x20f0c0['fieldName'],'type':_0x20f0c0[_0xb7eb('0x31')][_0xb7eb('0x32')]};});_0xc68143['model']=_[_0xb7eb('0x33')](_0x2d19bf,_0xb7eb('0x2d'));_0xc68143[_0xb7eb('0x34')]=_['keys'](_0x23aee6[_0xb7eb('0x34')]);_0xc68143[_0xb7eb('0x35')]=_[_0xb7eb('0x36')](_0xc68143[_0xb7eb('0x37')],_0xc68143[_0xb7eb('0x34')]);_0x156e2b[_0xb7eb('0x38')]=_['intersection'](_0xc68143[_0xb7eb('0x37')],qs[_0xb7eb('0x39')](_0x23aee6[_0xb7eb('0x34')][_0xb7eb('0x39')]));_0x156e2b['attributes']=_0x156e2b[_0xb7eb('0x38')][_0xb7eb('0x3a')]?_0x156e2b['attributes']:_0xc68143[_0xb7eb('0x37')];if(!_0x23aee6[_0xb7eb('0x34')][_0xb7eb('0x3b')]('nolimit')){_0x156e2b[_0xb7eb('0x23')]=qs['limit'](_0x23aee6[_0xb7eb('0x34')][_0xb7eb('0x23')]);_0x156e2b[_0xb7eb('0x20')]=qs[_0xb7eb('0x20')](_0x23aee6['query']['offset']);}_0x156e2b[_0xb7eb('0x3c')]=qs[_0xb7eb('0x3d')](_0x23aee6['query'][_0xb7eb('0x3d')]);_0x156e2b[_0xb7eb('0x3e')]=qs[_0xb7eb('0x35')](_[_0xb7eb('0x3f')](_0x23aee6[_0xb7eb('0x34')],_0xc68143[_0xb7eb('0x35')]),_0x2d19bf);if(_0x23aee6[_0xb7eb('0x34')][_0xb7eb('0x40')]){_0x156e2b['where']=_[_0xb7eb('0x41')](_0x156e2b['where'],{'$or':_[_0xb7eb('0x33')](_0x2d19bf,function(_0x33e229){if(_0x33e229[_0xb7eb('0x31')]!==_0xb7eb('0x42')){var _0x5a8ecf={};_0x5a8ecf[_0x33e229[_0xb7eb('0x2d')]]={'$like':'%'+_0x23aee6[_0xb7eb('0x34')][_0xb7eb('0x40')]+'%'};return _0x5a8ecf;}})});}_0x156e2b=_[_0xb7eb('0x41')]({},_0x156e2b,_0x23aee6[_0xb7eb('0x43')]);var _0x4add76={'where':_0x156e2b[_0xb7eb('0x3e')]};return db['WhatsappApplication'][_0xb7eb('0x22')](_0x4add76)[_0xb7eb('0x29')](function(_0x57e3e6){_0x3d75ed[_0xb7eb('0x22')]=_0x57e3e6;if(_0x23aee6[_0xb7eb('0x34')][_0xb7eb('0x44')]){_0x156e2b[_0xb7eb('0x45')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x156e2b);})['then'](function(_0x3ee221){_0x3d75ed[_0xb7eb('0x46')]=_0x3ee221;return _0x3d75ed;})[_0xb7eb('0x29')](respondWithFilteredResult(_0x841096,_0x156e2b))[_0xb7eb('0x47')](handleError(_0x841096,null));};exports[_0xb7eb('0x48')]=function(_0x5147e8,_0x4d65e5){var _0x381fc3={'raw':!![],'where':{'id':_0x5147e8[_0xb7eb('0x49')]['id']}},_0x5c3a07={};_0x5c3a07[_0xb7eb('0x37')]=_[_0xb7eb('0x4a')](db['WhatsappApplication'][_0xb7eb('0x4b')]);_0x5c3a07[_0xb7eb('0x34')]=_[_0xb7eb('0x4a')](_0x5147e8['query']);_0x5c3a07[_0xb7eb('0x35')]=_[_0xb7eb('0x36')](_0x5c3a07[_0xb7eb('0x37')],_0x5c3a07[_0xb7eb('0x34')]);_0x381fc3[_0xb7eb('0x38')]=_[_0xb7eb('0x36')](_0x5c3a07[_0xb7eb('0x37')],qs[_0xb7eb('0x39')](_0x5147e8[_0xb7eb('0x34')][_0xb7eb('0x39')]));_0x381fc3[_0xb7eb('0x38')]=_0x381fc3[_0xb7eb('0x38')][_0xb7eb('0x3a')]?_0x381fc3[_0xb7eb('0x38')]:_0x5c3a07[_0xb7eb('0x37')];if(_0x5147e8[_0xb7eb('0x34')][_0xb7eb('0x44')]){_0x381fc3[_0xb7eb('0x45')]=[{'all':!![]}];}_0x381fc3=_[_0xb7eb('0x41')]({},_0x381fc3,_0x5147e8['options']);return db[_0xb7eb('0x30')][_0xb7eb('0x4c')](_0x381fc3)[_0xb7eb('0x29')](handleEntityNotFound(_0x4d65e5,null))[_0xb7eb('0x29')](respondWithResult(_0x4d65e5,null))[_0xb7eb('0x47')](handleError(_0x4d65e5,null));};exports['create']=function(_0x9d509b,_0xa3c387){return db['WhatsappApplication'][_0xb7eb('0x4d')](_0x9d509b[_0xb7eb('0x4e')],{})['then'](respondWithResult(_0xa3c387,0xc9))['catch'](handleError(_0xa3c387,null));};exports[_0xb7eb('0x28')]=function(_0x13741b,_0x2f20d3){if(_0x13741b[_0xb7eb('0x4e')]['id']){delete _0x13741b[_0xb7eb('0x4e')]['id'];}return db[_0xb7eb('0x30')][_0xb7eb('0x4c')]({'where':{'id':_0x13741b['params']['id']}})[_0xb7eb('0x29')](handleEntityNotFound(_0x2f20d3,null))[_0xb7eb('0x29')](saveUpdates(_0x13741b['body'],null))[_0xb7eb('0x29')](respondWithResult(_0x2f20d3,null))['catch'](handleError(_0x2f20d3,null));};exports['destroy']=function(_0x4bb9c2,_0x217dfd){return db[_0xb7eb('0x30')]['find']({'where':{'id':_0x4bb9c2['params']['id']}})[_0xb7eb('0x29')](handleEntityNotFound(_0x217dfd,null))[_0xb7eb('0x29')](removeEntity(_0x217dfd,null))[_0xb7eb('0x47')](handleError(_0x217dfd,null));}; \ No newline at end of file +var _0xa848=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','rawAttributes','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','WhatsappApplication','includeAll','include','findAll','rows','catch','params','options','find','create','body','eml-format','rimraf','zip-dir'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xa848,0x99));var _0x8a84=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa848[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x8a84('0x0'));var rimraf=require(_0x8a84('0x1'));var zipdir=require(_0x8a84('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a84('0x3'));var moment=require(_0x8a84('0x4'));var BPromise=require(_0x8a84('0x5'));var Mustache=require(_0x8a84('0x6'));var util=require(_0x8a84('0x7'));var path=require(_0x8a84('0x8'));var sox=require(_0x8a84('0x9'));var csv=require(_0x8a84('0xa'));var ejs=require(_0x8a84('0xb'));var fs=require('fs');var fs_extra=require(_0x8a84('0xc'));var _=require(_0x8a84('0xd'));var squel=require(_0x8a84('0xe'));var crypto=require(_0x8a84('0xf'));var jsforce=require(_0x8a84('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x8a84('0xa'));var querystring=require(_0x8a84('0x11'));var Papa=require(_0x8a84('0x12'));var Redis=require('ioredis');var authService=require(_0x8a84('0x13'));var qs=require(_0x8a84('0x14'));var as=require(_0x8a84('0x15'));var hardwareService=require(_0x8a84('0x16'));var logger=require(_0x8a84('0x17'))(_0x8a84('0x18'));var utils=require(_0x8a84('0x19'));var config=require(_0x8a84('0x1a'));var licenseUtil=require(_0x8a84('0x1b'));var db=require(_0x8a84('0x1c'))['db'];function respondWithStatusCode(_0x130d92,_0x372ca3){_0x372ca3=_0x372ca3||0xcc;return function(_0x57576e){if(_0x57576e){return _0x130d92[_0x8a84('0x1d')](_0x372ca3);}return _0x130d92[_0x8a84('0x1e')](_0x372ca3)[_0x8a84('0x1f')]();};}function respondWithResult(_0x5628ba,_0x978e95){_0x978e95=_0x978e95||0xc8;return function(_0x2de032){if(_0x2de032){return _0x5628ba[_0x8a84('0x1e')](_0x978e95)['json'](_0x2de032);}};}function respondWithFilteredResult(_0x2a939e,_0x2558d9){return function(_0x50a338){if(_0x50a338){var _0x44144a=typeof _0x2558d9[_0x8a84('0x20')]===_0x8a84('0x21')&&typeof _0x2558d9[_0x8a84('0x22')]==='undefined';var _0x70847=_0x50a338[_0x8a84('0x23')];var _0x37b243=_0x44144a?0x0:_0x2558d9[_0x8a84('0x20')];var _0x292013=_0x44144a?_0x50a338[_0x8a84('0x23')]:_0x2558d9['offset']+_0x2558d9[_0x8a84('0x22')];var _0x51d369;if(_0x292013>=_0x70847){_0x292013=_0x70847;_0x51d369=0xc8;}else{_0x51d369=0xce;}_0x2a939e[_0x8a84('0x1e')](_0x51d369);return _0x2a939e['set'](_0x8a84('0x24'),_0x37b243+'-'+_0x292013+'/'+_0x70847)[_0x8a84('0x25')](_0x50a338);}return null;};}function patchUpdates(_0x1ddfcb){return function(_0x56cb73){try{jsonpatch[_0x8a84('0x26')](_0x56cb73,_0x1ddfcb,!![]);}catch(_0x3c4a98){return BPromise[_0x8a84('0x27')](_0x3c4a98);}return _0x56cb73[_0x8a84('0x28')]();};}function saveUpdates(_0x21e766,_0x4d245e){return function(_0xdd27df){if(_0xdd27df){return _0xdd27df[_0x8a84('0x29')](_0x21e766)[_0x8a84('0x2a')](function(_0x370454){return _0x370454;});}return null;};}function removeEntity(_0x1f01da,_0x4bef10){return function(_0x176059){if(_0x176059){return _0x176059[_0x8a84('0x2b')]()[_0x8a84('0x2a')](function(){_0x1f01da[_0x8a84('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34b0dd,_0x244126){return function(_0x260f6d){if(!_0x260f6d){_0x34b0dd[_0x8a84('0x1d')](0x194);}return _0x260f6d;};}function handleError(_0x4a9f05,_0x5060f4){_0x5060f4=_0x5060f4||0x1f4;return function(_0x52db42){logger[_0x8a84('0x2c')](_0x52db42[_0x8a84('0x2d')]);if(_0x52db42['name']){delete _0x52db42[_0x8a84('0x2e')];}_0x4a9f05['status'](_0x5060f4)['send'](_0x52db42);};}exports['index']=function(_0x4940af,_0x482067){var _0x141921={},_0x3083c0={},_0x396c46={'count':0x0,'rows':[]};var _0x474e5a=_[_0x8a84('0x2f')](db['WhatsappApplication'][_0x8a84('0x30')],function(_0x29fe41){return{'name':_0x29fe41['fieldName'],'type':_0x29fe41[_0x8a84('0x31')]['key']};});_0x3083c0['model']=_[_0x8a84('0x2f')](_0x474e5a,_0x8a84('0x2e'));_0x3083c0[_0x8a84('0x32')]=_[_0x8a84('0x33')](_0x4940af[_0x8a84('0x32')]);_0x3083c0[_0x8a84('0x34')]=_[_0x8a84('0x35')](_0x3083c0['model'],_0x3083c0['query']);_0x141921[_0x8a84('0x36')]=_['intersection'](_0x3083c0[_0x8a84('0x37')],qs[_0x8a84('0x38')](_0x4940af[_0x8a84('0x32')][_0x8a84('0x38')]));_0x141921['attributes']=_0x141921[_0x8a84('0x36')][_0x8a84('0x39')]?_0x141921[_0x8a84('0x36')]:_0x3083c0['model'];if(!_0x4940af[_0x8a84('0x32')][_0x8a84('0x3a')](_0x8a84('0x3b'))){_0x141921['limit']=qs[_0x8a84('0x22')](_0x4940af[_0x8a84('0x32')][_0x8a84('0x22')]);_0x141921[_0x8a84('0x20')]=qs[_0x8a84('0x20')](_0x4940af[_0x8a84('0x32')][_0x8a84('0x20')]);}_0x141921[_0x8a84('0x3c')]=qs[_0x8a84('0x3d')](_0x4940af[_0x8a84('0x32')][_0x8a84('0x3d')]);_0x141921[_0x8a84('0x3e')]=qs[_0x8a84('0x34')](_[_0x8a84('0x3f')](_0x4940af['query'],_0x3083c0['filters']),_0x474e5a);if(_0x4940af[_0x8a84('0x32')][_0x8a84('0x40')]){_0x141921[_0x8a84('0x3e')]=_[_0x8a84('0x41')](_0x141921[_0x8a84('0x3e')],{'$or':_['map'](_0x474e5a,function(_0x43e8d8){if(_0x43e8d8[_0x8a84('0x31')]!==_0x8a84('0x42')){var _0x4f1691={};_0x4f1691[_0x43e8d8[_0x8a84('0x2e')]]={'$like':'%'+_0x4940af[_0x8a84('0x32')][_0x8a84('0x40')]+'%'};return _0x4f1691;}})});}_0x141921=_[_0x8a84('0x41')]({},_0x141921,_0x4940af['options']);var _0x50cb9f={'where':_0x141921['where']};return db[_0x8a84('0x43')][_0x8a84('0x23')](_0x50cb9f)['then'](function(_0x31817f){_0x396c46[_0x8a84('0x23')]=_0x31817f;if(_0x4940af['query'][_0x8a84('0x44')]){_0x141921[_0x8a84('0x45')]=[{'all':!![]}];}return db[_0x8a84('0x43')][_0x8a84('0x46')](_0x141921);})[_0x8a84('0x2a')](function(_0x1117cc){_0x396c46[_0x8a84('0x47')]=_0x1117cc;return _0x396c46;})['then'](respondWithFilteredResult(_0x482067,_0x141921))[_0x8a84('0x48')](handleError(_0x482067,null));};exports['show']=function(_0x3b9f86,_0x52be84){var _0x511edb={'raw':!![],'where':{'id':_0x3b9f86[_0x8a84('0x49')]['id']}},_0x195361={};_0x195361[_0x8a84('0x37')]=_['keys'](db[_0x8a84('0x43')][_0x8a84('0x30')]);_0x195361[_0x8a84('0x32')]=_[_0x8a84('0x33')](_0x3b9f86['query']);_0x195361[_0x8a84('0x34')]=_[_0x8a84('0x35')](_0x195361[_0x8a84('0x37')],_0x195361[_0x8a84('0x32')]);_0x511edb[_0x8a84('0x36')]=_[_0x8a84('0x35')](_0x195361[_0x8a84('0x37')],qs[_0x8a84('0x38')](_0x3b9f86[_0x8a84('0x32')]['fields']));_0x511edb['attributes']=_0x511edb['attributes'][_0x8a84('0x39')]?_0x511edb[_0x8a84('0x36')]:_0x195361[_0x8a84('0x37')];if(_0x3b9f86['query'][_0x8a84('0x44')]){_0x511edb['include']=[{'all':!![]}];}_0x511edb=_[_0x8a84('0x41')]({},_0x511edb,_0x3b9f86[_0x8a84('0x4a')]);return db['WhatsappApplication'][_0x8a84('0x4b')](_0x511edb)[_0x8a84('0x2a')](handleEntityNotFound(_0x52be84,null))['then'](respondWithResult(_0x52be84,null))[_0x8a84('0x48')](handleError(_0x52be84,null));};exports[_0x8a84('0x4c')]=function(_0x4a951f,_0x426fcd){return db['WhatsappApplication'][_0x8a84('0x4c')](_0x4a951f[_0x8a84('0x4d')],{})[_0x8a84('0x2a')](respondWithResult(_0x426fcd,0xc9))[_0x8a84('0x48')](handleError(_0x426fcd,null));};exports['update']=function(_0x4bea7a,_0x4925af){if(_0x4bea7a['body']['id']){delete _0x4bea7a['body']['id'];}return db[_0x8a84('0x43')][_0x8a84('0x4b')]({'where':{'id':_0x4bea7a[_0x8a84('0x49')]['id']}})[_0x8a84('0x2a')](handleEntityNotFound(_0x4925af,null))[_0x8a84('0x2a')](saveUpdates(_0x4bea7a['body'],null))[_0x8a84('0x2a')](respondWithResult(_0x4925af,null))['catch'](handleError(_0x4925af,null));};exports[_0x8a84('0x2b')]=function(_0x855234,_0x32e577){return db['WhatsappApplication'][_0x8a84('0x4b')]({'where':{'id':_0x855234[_0x8a84('0x49')]['id']}})[_0x8a84('0x2a')](handleEntityNotFound(_0x32e577,null))[_0x8a84('0x2a')](removeEntity(_0x32e577,null))['catch'](handleError(_0x32e577,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 8df8f1a..bb7ae52 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 _0x6c7b=['whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','moment','request-promise','path','rimraf','./whatsappApplication.attributes','exports','define'];(function(_0x5ebe34,_0x421337){var _0x36a3ee=function(_0x1d3306){while(--_0x1d3306){_0x5ebe34['push'](_0x5ebe34['shift']());}};_0x36a3ee(++_0x421337);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x234848,_0x5e2944){_0x234848=_0x234848-0x0;var _0x360b93=_0x6c7b[_0x234848];return _0x360b93;};'use strict';var _=require(_0xb6c7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb6c7('0x1'));var BPromise=require('bluebird');var rp=require(_0xb6c7('0x2'));var fs=require('fs');var path=require(_0xb6c7('0x3'));var rimraf=require(_0xb6c7('0x4'));var config=require('../../config/environment');var attributes=require(_0xb6c7('0x5'));module[_0xb6c7('0x6')]=function(_0xfe3eb9,_0x219abc){return _0xfe3eb9[_0xb6c7('0x7')]('WhatsappApplication',attributes,{'tableName':_0xb6c7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb6c7('0x9'),'collate':_0xb6c7('0xa')});}; \ No newline at end of file +var _0xd2bb=['util','api','moment','bluebird','request-promise','path','rimraf','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x339783,_0x3e0255){var _0x8c4d86=function(_0x25641c){while(--_0x25641c){_0x339783['push'](_0x339783['shift']());}};_0x8c4d86(++_0x3e0255);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x107d80,_0x1c8d7d){_0x107d80=_0x107d80-0x0;var _0x599251=_0xd2bb[_0x107d80];return _0x599251;};'use strict';var _=require('lodash');var util=require(_0xbd2b('0x0'));var logger=require('../../config/logger')(_0xbd2b('0x1'));var moment=require(_0xbd2b('0x2'));var BPromise=require(_0xbd2b('0x3'));var rp=require(_0xbd2b('0x4'));var fs=require('fs');var path=require(_0xbd2b('0x5'));var rimraf=require(_0xbd2b('0x6'));var config=require('../../config/environment');var attributes=require(_0xbd2b('0x7'));module[_0xbd2b('0x8')]=function(_0xdcd8bd,_0x2f64a8){return _0xdcd8bd[_0xbd2b('0x9')](_0xbd2b('0xa'),attributes,{'tableName':_0xbd2b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbd2b('0xc'),'collate':_0xbd2b('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index d4b82dc..a55c24c 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 _0xd2ea=['../../config/environment','jayson/promise','client','request','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x56996f,_0x5ca155){var _0x2164f6=function(_0x4f2192){while(--_0x4f2192){_0x56996f['push'](_0x56996f['shift']());}};_0x2164f6(++_0x5ca155);}(_0xd2ea,0x15f));var _0xad2e=function(_0x5ab245,_0x315129){_0x5ab245=_0x5ab245-0x0;var _0x4ae844=_0xd2ea[_0x5ab245];return _0x4ae844;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var moment=require(_0xad2e('0x2'));var BPromise=require(_0xad2e('0x3'));var rs=require(_0xad2e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad2e('0x5'))['db'];var utils=require(_0xad2e('0x6'));var logger=require(_0xad2e('0x7'))(_0xad2e('0x8'));var config=require(_0xad2e('0x9'));var jayson=require(_0xad2e('0xa'));var client=jayson[_0xad2e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b5170,_0x3e3d1f,_0x2ff7b2){return new BPromise(function(_0x5710ac,_0x1e0e9e){return client[_0xad2e('0xc')](_0x3b5170,_0x2ff7b2)['then'](function(_0x1eed2f){logger['info'](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));logger[_0xad2e('0xf')](_0xad2e('0x10'),_0x3e3d1f,'request\x20sent',JSON[_0xad2e('0x11')](_0x1eed2f));if(_0x1eed2f['error']){if(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x13')]===0x1f4){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0x1eed2f['error'][_0xad2e('0x14')]);return _0x1e0e9e(_0x1eed2f['error'][_0xad2e('0x14')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x3e3d1f,_0x1eed2f['error']['message']);return _0x5710ac(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x14')]);}else{logger[_0xad2e('0x15')](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));_0x5710ac(_0x1eed2f[_0xad2e('0x16')][_0xad2e('0x14')]);}})[_0xad2e('0x17')](function(_0xd40b31){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0xd40b31);_0x1e0e9e(_0xd40b31);});});} \ No newline at end of file +var _0x425d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x13e725,_0x48beb3){var _0x2417ea=function(_0x517cd6){while(--_0x517cd6){_0x13e725['push'](_0x13e725['shift']());}};_0x2417ea(++_0x48beb3);}(_0x425d,0x1e0));var _0xd425=function(_0x1a7e4b,_0x2fbd40){_0x1a7e4b=_0x1a7e4b-0x0;var _0x37a8fd=_0x425d[_0x1a7e4b];return _0x37a8fd;};'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});function respondWithRpcPromise(_0x1d97d9,_0x1d2ed0,_0x50b061){return new BPromise(function(_0xb6ba8e,_0x374c3d){return client[_0xd425('0xc')](_0x1d97d9,_0x50b061)[_0xd425('0xd')](function(_0x2db9da){logger[_0xd425('0xe')](_0xd425('0xf'),_0x1d2ed0,_0xd425('0x10'));logger[_0xd425('0x11')](_0xd425('0x12'),_0x1d2ed0,_0xd425('0x10'),JSON[_0xd425('0x13')](_0x2db9da));if(_0x2db9da[_0xd425('0x14')]){if(_0x2db9da[_0xd425('0x14')][_0xd425('0x15')]===0x1f4){logger[_0xd425('0x14')](_0xd425('0xf'),_0x1d2ed0,_0x2db9da[_0xd425('0x14')][_0xd425('0x16')]);return _0x374c3d(_0x2db9da[_0xd425('0x14')]['message']);}logger[_0xd425('0x14')](_0xd425('0xf'),_0x1d2ed0,_0x2db9da[_0xd425('0x14')]['message']);return _0xb6ba8e(_0x2db9da[_0xd425('0x14')][_0xd425('0x16')]);}else{logger[_0xd425('0xe')](_0xd425('0xf'),_0x1d2ed0,_0xd425('0x10'));_0xb6ba8e(_0x2db9da['result'][_0xd425('0x16')]);}})[_0xd425('0x17')](function(_0x7e267e){logger[_0xd425('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x1d2ed0,_0x7e267e);_0x374c3d(_0x7e267e);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 6a3d4a8..f0f5597 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 _0x4745=['../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','isAuthenticated','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x41ac1f,_0x183672){var _0x3b5516=function(_0x47b950){while(--_0x47b950){_0x41ac1f['push'](_0x41ac1f['shift']());}};_0x3b5516(++_0x183672);}(_0x4745,0x1e7));var _0x5474=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4745[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var path=require(_0x5474('0x2'));var timeout=require(_0x5474('0x3'));var express=require(_0x5474('0x4'));var router=express[_0x5474('0x5')]();var fs_extra=require(_0x5474('0x6'));var auth=require(_0x5474('0x7'));var interaction=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var controller=require(_0x5474('0xa'));router[_0x5474('0xb')]('/',auth['isAuthenticated'](),controller[_0x5474('0xc')]);router[_0x5474('0xb')]('/describe',auth[_0x5474('0xd')](),controller['describe']);router[_0x5474('0xb')](_0x5474('0xe'),auth['isAuthenticated'](),controller[_0x5474('0xf')]);router[_0x5474('0xb')](_0x5474('0x10'),auth[_0x5474('0xd')](),controller[_0x5474('0x11')]);router[_0x5474('0xb')](_0x5474('0x12'),auth[_0x5474('0xd')](),controller['download']);router[_0x5474('0x13')]('/',auth[_0x5474('0xd')](),controller[_0x5474('0x14')]);router[_0x5474('0x13')](_0x5474('0x10'),auth[_0x5474('0xd')](),controller[_0x5474('0x15')]);router[_0x5474('0x13')](_0x5474('0x16'),auth['isAuthenticated'](),interaction[_0x5474('0x17')](_0x5474('0x18'),_0x5474('0x19')),controller[_0x5474('0x1a')]);router['put']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x5474('0x18'),_0x5474('0x1b')),controller[_0x5474('0x1c')]);router['delete'](_0x5474('0xe'),auth[_0x5474('0xd')](),interaction['tracked'](_0x5474('0x18'),_0x5474('0x1d')),controller[_0x5474('0x1e')]);router[_0x5474('0x1f')](_0x5474('0x16'),auth['isAuthenticated'](),controller[_0x5474('0x20')]);module['exports']=router; \ No newline at end of file +var _0xf494=['isAuthenticated','index','describe','/:id','show','/:id/messages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','whatsapp','addTags','put','whatsappinteraction:update','update','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get'];(function(_0x4ab62e,_0x241ac6){var _0x53baa0=function(_0x417dbe){while(--_0x417dbe){_0x4ab62e['push'](_0x4ab62e['shift']());}};_0x53baa0(++_0x241ac6);}(_0xf494,0x1c6));var _0x4f49=function(_0x31fe63,_0x40e64c){_0x31fe63=_0x31fe63-0x0;var _0x156ee8=_0xf494[_0x31fe63];return _0x156ee8;};'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['getMessages']);router[_0x4f49('0xa')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4f49('0x13')]);router[_0x4f49('0x14')]('/:id/messages',auth[_0x4f49('0xb')](),controller[_0x4f49('0x15')]);router[_0x4f49('0x14')](_0x4f49('0x16'),auth[_0x4f49('0xb')](),interaction[_0x4f49('0x17')](_0x4f49('0x18'),'whatsappinteraction:addtags'),controller[_0x4f49('0x19')]);router[_0x4f49('0x1a')](_0x4f49('0xe'),auth['isAuthenticated'](),interaction['tracked'](_0x4f49('0x18'),_0x4f49('0x1b')),controller[_0x4f49('0x1c')]);router['delete'](_0x4f49('0xe'),auth[_0x4f49('0xb')](),interaction[_0x4f49('0x17')]('whatsapp','whatsappinteraction:destroy'),controller['destroy']);router['delete'](_0x4f49('0x16'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1d')]);module[_0x4f49('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index bb3e46e..6a497a8 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 _0x6dd1=['sequelize','exports','BOOLEAN','STRING','DATE','ENUM','out'];(function(_0xf5eaa0,_0x5bfa29){var _0x47039e=function(_0x4b47a6){while(--_0x4b47a6){_0xf5eaa0['push'](_0xf5eaa0['shift']());}};_0x47039e(++_0x5bfa29);}(_0x6dd1,0x111));var _0x16dd=function(_0x5dea68,_0x3e7be0){_0x5dea68=_0x5dea68-0x0;var _0x392cb6=_0x6dd1[_0x5dea68];return _0x392cb6;};'use strict';var Sequelize=require(_0x16dd('0x0'));var moment=require('moment');module[_0x16dd('0x1')]={'closed':{'type':Sequelize[_0x16dd('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x16dd('0x3')]},'secondDisposition':{'type':Sequelize[_0x16dd('0x3')]},'thirdDisposition':{'type':Sequelize[_0x16dd('0x3')]},'note':{'type':Sequelize[_0x16dd('0x3')]},'phone':{'type':Sequelize[_0x16dd('0x3')]},'read1stAt':{'type':Sequelize[_0x16dd('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x16dd('0x5')]('in',_0x16dd('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x16dd('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xfb8f=['moment','DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x25e7f3,_0x6791ab){var _0x41cfb2=function(_0x41e515){while(--_0x41e515){_0x25e7f3['push'](_0x25e7f3['shift']());}};_0x41cfb2(++_0x6791ab);}(_0xfb8f,0x18c));var _0xffb8=function(_0x18b7f0,_0x403e49){_0x18b7f0=_0x18b7f0-0x0;var _0x38a953=_0xfb8f[_0x18b7f0];return _0x38a953;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xffb8('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xffb8('0x1')]},'disposition':{'type':Sequelize[_0xffb8('0x2')]},'secondDisposition':{'type':Sequelize[_0xffb8('0x2')]},'thirdDisposition':{'type':Sequelize[_0xffb8('0x2')]},'note':{'type':Sequelize[_0xffb8('0x2')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xffb8('0x1')]},'firstMsgDirection':{'type':Sequelize[_0xffb8('0x3')]('in',_0xffb8('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xffb8('0x1')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xffb8('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 1ba5631..eb59d3c 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 _0xfdf2=['localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','error','stack','name','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','findAll','query','user','show','keys','filters','model','intersection','fields','attributes','length','includeAll','include','merge','options','find','catch','body','params','destroy','describe','addMessage','WhatsappMessage','omit','ids','hasOwnProperty','order','sort','where','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','read','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','log','err','zip-dir','moment','bluebird','util','path','lodash','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis'];(function(_0x50b908,_0x16815d){var _0x489edd=function(_0xe219bd){while(--_0xe219bd){_0x50b908['push'](_0x50b908['shift']());}};_0x489edd(++_0x16815d);}(_0xfdf2,0xf3));var _0x2fdf=function(_0x4eecd0,_0x1bdf1f){_0x4eecd0=_0x4eecd0-0x0;var _0x2489ad=_0xfdf2[_0x4eecd0];return _0x2489ad;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x2fdf('0x0'));var moment=require(_0x2fdf('0x1'));var BPromise=require(_0x2fdf('0x2'));var util=require(_0x2fdf('0x3'));var path=require(_0x2fdf('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2fdf('0x5'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0x2fdf('0x6'));var logger=require(_0x2fdf('0x7'))(_0x2fdf('0x8'));var config=require('../../config/environment');var db=require(_0x2fdf('0x9'))['db'];config[_0x2fdf('0xa')]=_['defaults'](config[_0x2fdf('0xa')],{'host':_0x2fdf('0xb'),'port':0x18eb});var socket=require(_0x2fdf('0xc'))(new Redis(config[_0x2fdf('0xa')]));require(_0x2fdf('0xd'))[_0x2fdf('0xe')](socket);function respondWithStatusCode(_0x3ffeaa,_0x43a971){_0x43a971=_0x43a971||0xcc;return function(_0x326e43){if(_0x326e43){return _0x3ffeaa[_0x2fdf('0xf')](_0x43a971);}return _0x3ffeaa['status'](_0x43a971)['end']();};}function respondWithResult(_0x516c15,_0x466863){_0x466863=_0x466863||0xc8;return function(_0x4ddc8a){if(_0x4ddc8a){return _0x516c15[_0x2fdf('0x10')](_0x466863)[_0x2fdf('0x11')](_0x4ddc8a);}};}function respondWithFilteredResult(_0x127b94,_0x34cde7){return function(_0x4a280e){if(_0x4a280e){var _0xad6a81=typeof _0x34cde7[_0x2fdf('0x12')]===_0x2fdf('0x13')&&typeof _0x34cde7[_0x2fdf('0x14')]===_0x2fdf('0x13');var _0x410371=_0x4a280e[_0x2fdf('0x15')];var _0x26846b=_0xad6a81?0x0:_0x34cde7[_0x2fdf('0x12')];var _0x39e72c=_0xad6a81?_0x4a280e[_0x2fdf('0x15')]:_0x34cde7[_0x2fdf('0x12')]+_0x34cde7[_0x2fdf('0x14')];var _0x53dddd;if(_0x39e72c>=_0x410371){_0x39e72c=_0x410371;_0x53dddd=0xc8;}else{_0x53dddd=0xce;}_0x127b94[_0x2fdf('0x10')](_0x53dddd);return _0x127b94[_0x2fdf('0x16')](_0x2fdf('0x17'),_0x26846b+'-'+_0x39e72c+'/'+_0x410371)[_0x2fdf('0x11')](_0x4a280e);}return null;};}function saveUpdates(_0x114f81){return function(_0x883141){if(_0x883141){return _0x883141[_0x2fdf('0x18')](_0x114f81)[_0x2fdf('0x19')](function(_0x2f7712){return _0x2f7712;});}return null;};}function removeEntity(_0x4c5f19){return function(_0x3de070){if(_0x3de070){return _0x3de070['destroy']()[_0x2fdf('0x19')](function(){_0x4c5f19[_0x2fdf('0x10')](0xcc)[_0x2fdf('0x1a')]();});}};}function handleEntityNotFound(_0x398554){return function(_0x2dc3ee){if(!_0x2dc3ee){_0x398554[_0x2fdf('0xf')](0x194);}return _0x2dc3ee;};}function handleError(_0x466f57,_0x2df846){_0x2df846=_0x2df846||0x1f4;return function(_0x310d68){logger[_0x2fdf('0x1b')](_0x310d68[_0x2fdf('0x1c')]);if(_0x310d68[_0x2fdf('0x1d')]){delete _0x310d68['name'];}_0x466f57[_0x2fdf('0x10')](_0x2df846)['send'](_0x310d68);};}exports[_0x2fdf('0x1e')]=function(_0x310ce3,_0x41349c){var _0x4d2077={};var _0x1d5447=_[_0x2fdf('0x1f')](db[_0x2fdf('0x20')][_0x2fdf('0x21')],function(_0x4b2599){return{'name':_0x4b2599[_0x2fdf('0x22')],'type':_0x4b2599[_0x2fdf('0x23')][_0x2fdf('0x24')]};});_0x4d2077=qs['getOptions'](_0x1d5447,_0x310ce3);return interaction[_0x2fdf('0x25')]('whatsapp',_0x310ce3[_0x2fdf('0x26')],_0x310ce3[_0x2fdf('0x27')],_0x4d2077,_0x1d5447)['then'](respondWithFilteredResult(_0x41349c,_0x4d2077))['catch'](handleError(_0x41349c,null));};exports[_0x2fdf('0x28')]=function(_0x33dff9,_0xf89f82){var _0xc86436={'raw':![],'where':{'id':_0x33dff9['params']['id']}},_0x4a6d98={};_0x4a6d98['model']=_[_0x2fdf('0x29')](db['WhatsappInteraction'][_0x2fdf('0x21')]);_0x4a6d98[_0x2fdf('0x26')]=_[_0x2fdf('0x29')](_0x33dff9[_0x2fdf('0x26')]);_0x4a6d98[_0x2fdf('0x2a')]=_['intersection'](_0x4a6d98[_0x2fdf('0x2b')],_0x4a6d98[_0x2fdf('0x26')]);_0xc86436['attributes']=_[_0x2fdf('0x2c')](_0x4a6d98[_0x2fdf('0x2b')],qs['fields'](_0x33dff9['query'][_0x2fdf('0x2d')]));_0xc86436[_0x2fdf('0x2e')]=_0xc86436[_0x2fdf('0x2e')][_0x2fdf('0x2f')]?_0xc86436[_0x2fdf('0x2e')]:_0x4a6d98[_0x2fdf('0x2b')];if(_0x33dff9[_0x2fdf('0x26')][_0x2fdf('0x30')]){_0xc86436[_0x2fdf('0x31')]=[{'all':!![]}];}_0xc86436=_[_0x2fdf('0x32')]({},_0xc86436,_0x33dff9[_0x2fdf('0x33')]);return db['WhatsappInteraction'][_0x2fdf('0x34')](_0xc86436)[_0x2fdf('0x19')](handleEntityNotFound(_0xf89f82,null))[_0x2fdf('0x19')](respondWithResult(_0xf89f82,null))[_0x2fdf('0x35')](handleError(_0xf89f82,null));};exports['create']=function(_0x48a4e7,_0x390e79){return db['WhatsappInteraction']['create'](_0x48a4e7[_0x2fdf('0x36')],{})[_0x2fdf('0x19')](respondWithResult(_0x390e79,0xc9))[_0x2fdf('0x35')](handleError(_0x390e79,null));};exports[_0x2fdf('0x18')]=function(_0x169852,_0x3e2dd7){if(_0x169852[_0x2fdf('0x36')]['id']){delete _0x169852['body']['id'];}return db[_0x2fdf('0x20')][_0x2fdf('0x34')]({'where':{'id':_0x169852[_0x2fdf('0x37')]['id']}})[_0x2fdf('0x19')](handleEntityNotFound(_0x3e2dd7,null))['then'](saveUpdates(_0x169852[_0x2fdf('0x36')],null))['then'](respondWithResult(_0x3e2dd7,null))[_0x2fdf('0x35')](handleError(_0x3e2dd7,null));};exports[_0x2fdf('0x38')]=function(_0x4604de,_0x2b9e82){return db[_0x2fdf('0x20')][_0x2fdf('0x34')]({'where':{'id':_0x4604de[_0x2fdf('0x37')]['id']}})[_0x2fdf('0x19')](handleEntityNotFound(_0x2b9e82,null))[_0x2fdf('0x19')](removeEntity(_0x2b9e82,null))[_0x2fdf('0x35')](handleError(_0x2b9e82,null));};exports[_0x2fdf('0x39')]=function(_0x71c678,_0x4b73db){return db[_0x2fdf('0x20')][_0x2fdf('0x39')]()['then'](respondWithResult(_0x4b73db,null))[_0x2fdf('0x35')](handleError(_0x4b73db,null));};exports[_0x2fdf('0x3a')]=function(_0x1b9eb3,_0x501013){return db[_0x2fdf('0x3b')]['find']({'where':{'id':_0x1b9eb3['params']['id']}})['then'](handleEntityNotFound(_0x501013,null))[_0x2fdf('0x19')](function(_0x9af7da){if(_0x9af7da){return _0x9af7da['addMessage'](_0x1b9eb3[_0x2fdf('0x36')]['ids'],_[_0x2fdf('0x3c')](_0x1b9eb3[_0x2fdf('0x36')],[_0x2fdf('0x3d'),'id'])||{});}})[_0x2fdf('0x19')](respondWithResult(_0x501013,null))[_0x2fdf('0x35')](handleError(_0x501013,null));};exports['getMessages']=function(_0xbe2c4d,_0x4a9b75){var _0x5c3a6c={'raw':![],'where':{}};var _0x1b7801={};var _0x132f6d={'count':0x0,'rows':[]};return db[_0x2fdf('0x20')]['findOne']({'where':{'id':_0xbe2c4d[_0x2fdf('0x37')]['id']}})[_0x2fdf('0x19')](handleEntityNotFound(_0x4a9b75,null))['then'](function(_0x41ab08){if(_0x41ab08){_0x1b7801['model']=_[_0x2fdf('0x29')](db[_0x2fdf('0x3b')][_0x2fdf('0x21')]);_0x1b7801['query']=_['keys'](_0xbe2c4d[_0x2fdf('0x26')]);_0x1b7801[_0x2fdf('0x2a')]=_['intersection'](_0x1b7801['model'],_0x1b7801[_0x2fdf('0x26')]);_0x5c3a6c[_0x2fdf('0x2e')]=_[_0x2fdf('0x2c')](_0x1b7801[_0x2fdf('0x2b')],qs[_0x2fdf('0x2d')](_0xbe2c4d['query'][_0x2fdf('0x2d')]));_0x5c3a6c['attributes']=_0x5c3a6c[_0x2fdf('0x2e')][_0x2fdf('0x2f')]?_0x5c3a6c['attributes']:_0x1b7801[_0x2fdf('0x2b')];if(!_0xbe2c4d[_0x2fdf('0x26')][_0x2fdf('0x3e')]('nolimit')){_0x5c3a6c[_0x2fdf('0x14')]=qs[_0x2fdf('0x14')](_0xbe2c4d[_0x2fdf('0x26')][_0x2fdf('0x14')]);_0x5c3a6c[_0x2fdf('0x12')]=qs[_0x2fdf('0x12')](_0xbe2c4d[_0x2fdf('0x26')][_0x2fdf('0x12')]);}_0x5c3a6c[_0x2fdf('0x3f')]=qs[_0x2fdf('0x40')](_0xbe2c4d[_0x2fdf('0x26')][_0x2fdf('0x40')]);_0x5c3a6c[_0x2fdf('0x41')]=qs[_0x2fdf('0x2a')](_['pick'](_0xbe2c4d[_0x2fdf('0x26')],_0x1b7801[_0x2fdf('0x2a')]));_0x5c3a6c[_0x2fdf('0x41')][_0x2fdf('0x42')]=_0x41ab08['id'];if(_0xbe2c4d['query'][_0x2fdf('0x43')]){_0x5c3a6c['where']=_['merge'](_0x5c3a6c[_0x2fdf('0x41')],{'$or':_[_0x2fdf('0x1f')](_0x5c3a6c[_0x2fdf('0x2e')],function(_0x553ec7){var _0x536165={};_0x536165[_0x553ec7]={'$like':'%'+_0xbe2c4d['query'][_0x2fdf('0x43')]+'%'};return _0x536165;})});}if(_0xbe2c4d[_0x2fdf('0x26')][_0x2fdf('0x44')]){var _0x5df56b=_0xbe2c4d[_0x2fdf('0x26')]['$gte'][_0x2fdf('0x45')](',');var _0x2a0546={};_0x2a0546[_0x5df56b[0x0]]={'$gte':moment(_0x5df56b[0x1])[_0x2fdf('0x46')](_0x2fdf('0x47'))};_0x5c3a6c[_0x2fdf('0x41')]=_['merge'](_0x5c3a6c[_0x2fdf('0x41')],_0x2a0546);}_0x5c3a6c=_[_0x2fdf('0x32')]({},_0x5c3a6c,_0xbe2c4d[_0x2fdf('0x33')]);return db[_0x2fdf('0x3b')][_0x2fdf('0x15')]({'where':_0x5c3a6c['where']})[_0x2fdf('0x19')](function(_0x662982){_0x132f6d[_0x2fdf('0x15')]=_0x662982;if(_0xbe2c4d[_0x2fdf('0x26')]['includeAll']){_0x5c3a6c['include']=[{'all':!![]}];}return db[_0x2fdf('0x3b')][_0x2fdf('0x25')](_0x5c3a6c);})['then'](function(_0x4fea8f){_0x132f6d[_0x2fdf('0x48')]=_0x4fea8f;return _0x132f6d;});}})['then'](respondWithFilteredResult(_0x4a9b75,_0x5c3a6c))[_0x2fdf('0x35')](handleError(_0x4a9b75,null));};exports[_0x2fdf('0x49')]=function(_0x3086e2,_0x2a5b0a){return db[_0x2fdf('0x20')]['find']({'where':{'id':_0x3086e2[_0x2fdf('0x37')]['id']}})[_0x2fdf('0x19')](handleEntityNotFound(_0x2a5b0a,null))[_0x2fdf('0x19')](function(_0xab1589){if(_0xab1589){return _0xab1589[_0x2fdf('0x4a')](_0x3086e2[_0x2fdf('0x36')][_0x2fdf('0x3d')],_[_0x2fdf('0x3c')](_0x3086e2[_0x2fdf('0x36')],[_0x2fdf('0x3d'),'id'])||{})[_0x2fdf('0x4b')](function(){return db[_0x2fdf('0x4c')][_0x2fdf('0x25')]({'attributes':['id',_0x2fdf('0x1d'),_0x2fdf('0x4d')],'where':{'id':_0x3086e2[_0x2fdf('0x36')][_0x2fdf('0x3d')]}});})['then'](function(_0x48b9de){socket[_0x2fdf('0x4e')](_0x2fdf('0x4f'),{'id':Number(_0x3086e2[_0x2fdf('0x37')]['id']),'tags':_0x48b9de||[]});return{'id':Number(_0x3086e2[_0x2fdf('0x37')]['id']),'tags':_0x48b9de||[]};});}})[_0x2fdf('0x19')](respondWithResult(_0x2a5b0a,null))['catch'](handleError(_0x2a5b0a,null));};exports[_0x2fdf('0x50')]=function(_0x100548,_0x2a6f56){return db['WhatsappInteraction'][_0x2fdf('0x34')]({'where':{'id':_0x100548[_0x2fdf('0x37')]['id']}})[_0x2fdf('0x19')](handleEntityNotFound(_0x2a6f56,null))[_0x2fdf('0x19')](function(_0x4752e6){if(_0x4752e6){return _0x4752e6['removeTags'](_0x100548[_0x2fdf('0x26')]['ids']);}})[_0x2fdf('0x19')](respondWithStatusCode(_0x2a6f56,null))[_0x2fdf('0x35')](handleError(_0x2a6f56,null));};exports[_0x2fdf('0x51')]=function(_0x12706c,_0x2bb144){var _0x2acf1d=moment()[_0x2fdf('0x52')]()[_0x2fdf('0x53')]();var _0x1bc055=path[_0x2fdf('0x54')](config[_0x2fdf('0x55')],_0x2fdf('0x56'),_0x2fdf('0x57'),_0x2fdf('0x58'));var _0x42b905=path[_0x2fdf('0x54')](config[_0x2fdf('0x55')],_0x2fdf('0x56'),_0x2fdf('0x57'),_0x2fdf('0x59'));var _0x2a7910=path[_0x2fdf('0x54')](_0x1bc055,_0x2acf1d);var _0x34f0e0=util[_0x2fdf('0x46')]('transcript-%d-%s.zip',_0x12706c[_0x2fdf('0x37')]['id'],_0x2acf1d);var _0x1723ec=path[_0x2fdf('0x54')](_0x1bc055,_0x34f0e0);var _0x56c9df=[];_0x56c9df[_0x2fdf('0x5a')]({'model':db[_0x2fdf('0x5b')],'as':_0x2fdf('0x5b'),'attributes':['id',_0x2fdf('0x5c')],'raw':!![]});_0x56c9df[_0x2fdf('0x5a')]({'model':db[_0x2fdf('0x5d')],'as':_0x2fdf('0x5e'),'attributes':['id',_0x2fdf('0x5f'),_0x2fdf('0x60')],'raw':!![]});if(_0x12706c[_0x2fdf('0x26')]['attachments']){_0x56c9df['push']({'model':db[_0x2fdf('0x61')],'as':_0x2fdf('0x61'),'raw':!![]});}var _0x542e1a=[{'model':db[_0x2fdf('0x3b')],'as':_0x2fdf('0x62'),'attributes':['id',_0x2fdf('0x36'),_0x2fdf('0x63'),_0x2fdf('0x64'),_0x2fdf('0x65'),'read'],'include':_0x56c9df}];_0x542e1a[_0x2fdf('0x5a')]({'model':db[_0x2fdf('0x66')],'as':_0x2fdf('0x67'),'attributes':['id',_0x2fdf('0x1d')]});_0x542e1a[_0x2fdf('0x5a')]({'model':db[_0x2fdf('0x5b')],'as':_0x2fdf('0x68'),'attributes':['id',_0x2fdf('0x5c')]});return db[_0x2fdf('0x20')][_0x2fdf('0x34')]({'where':{'id':_0x12706c[_0x2fdf('0x37')]['id']},'include':_0x542e1a})['then'](handleEntityNotFound(_0x2bb144,null))[_0x2fdf('0x19')](function(_0x202bc9){if(_0x202bc9){var _0x20d008=_0x202bc9[_0x2fdf('0x69')]({'plain':!![]});fs[_0x2fdf('0x6a')](_0x2a7910);var _0x1d665b={'channel':_0x2fdf('0x6b'),'account':_0x20d008['Account'][_0x2fdf('0x1d')],'agent':_0x20d008[_0x2fdf('0x68')]?_0x20d008[_0x2fdf('0x68')][_0x2fdf('0x5c')]:_0x2fdf('0x6c'),'createdAt':moment(_0x20d008[_0x2fdf('0x63')])[_0x2fdf('0x46')](_0x2fdf('0x47'))[_0x2fdf('0x53')](),'closedAt':_0x20d008[_0x2fdf('0x6d')]?moment(_0x20d008[_0x2fdf('0x6e')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x20d008[_0x2fdf('0x6f')],'messages':_(_0x20d008[_0x2fdf('0x62')])[_0x2fdf('0x43')]({'secret':![]})['map'](function(_0x335645){if(_0x335645[_0x2fdf('0x61')]){var _0x55cdf1=path[_0x2fdf('0x54')](_0x42b905,_0x335645[_0x2fdf('0x61')][_0x2fdf('0x70')]);if(fs[_0x2fdf('0x71')](_0x55cdf1)){fs[_0x2fdf('0x72')](_0x55cdf1)[_0x2fdf('0x73')](fs[_0x2fdf('0x74')](path[_0x2fdf('0x54')](_0x2a7910,_0x335645[_0x2fdf('0x61')][_0x2fdf('0x70')])));}}return{'date':moment(_0x335645[_0x2fdf('0x63')])[_0x2fdf('0x46')](_0x2fdf('0x47'))[_0x2fdf('0x53')](),'sender':_0x335645[_0x2fdf('0x64')]===_0x2fdf('0x75')?_0x335645[_0x2fdf('0x5b')]?_0x335645[_0x2fdf('0x5b')][_0x2fdf('0x5c')]:_0x2fdf('0x76'):_0x335645[_0x2fdf('0x5e')][_0x2fdf('0x5f')]+(_0x335645[_0x2fdf('0x5e')][_0x2fdf('0x60')]?'\x20'+_0x335645[_0x2fdf('0x5e')][_0x2fdf('0x60')]:''),'body':_0x335645[_0x2fdf('0x61')]?_0x335645['Attachment'][_0x2fdf('0x70')]:_0x335645[_0x2fdf('0x36')],'direction':_0x335645[_0x2fdf('0x64')]==='out'?'A':'C','secret':_0x335645[_0x2fdf('0x65')],'read':_0x335645[_0x2fdf('0x77')],'attachment':_0x335645[_0x2fdf('0x61')]};})[_0x2fdf('0x78')]()};return ejs[_0x2fdf('0x79')](path[_0x2fdf('0x54')](config[_0x2fdf('0x55')],_0x2fdf('0x56'),'views',_0x2fdf('0x7a')),{'interaction':_0x1d665b})['then'](function(_0x1708e7){var _0xa6aa5=path['join'](_0x2a7910,_0x2fdf('0x7b')+_0x20d008['id']+'-'+_0x2acf1d+_0x2fdf('0x7c'));var _0x5678f2={'path':_0xa6aa5,'channel':_0x2fdf('0x6b'),'interactionId':_0x20d008['id']};return pdf['createPdfFromHTML'](_0x1708e7,_0x5678f2);})['then'](function(){return new BPromise(function(_0x5411ad,_0x5910b2){zipdir(_0x2a7910,{'saveTo':_0x1723ec},function(_0x383e76,_0x47ca7c){if(_0x383e76)return _0x5910b2(_0x383e76);return _0x5411ad(_0x47ca7c);});})[_0x2fdf('0x19')](function(){return new BPromise(function(_0x37fea4,_0xcde132){rimraf(_0x2a7910,function(_0x437d21){if(_0x437d21)_0xcde132(_0x437d21);return _0x37fea4();});});})[_0x2fdf('0x19')](function(){return _0x2bb144[_0x2fdf('0x51')](_0x1723ec,_0x34f0e0,function(_0x428b54){if(_0x428b54){console[_0x2fdf('0x7d')](_0x2fdf('0x7e'),_0x428b54);}else{fs['unlinkSync'](_0x1723ec);}});});});}else{return _0x2bb144[_0x2fdf('0xf')](0xc8);}})['catch'](handleError(_0x2bb144,null));}; \ No newline at end of file +var _0xf4e6=['findAll','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','includeAll','create','body','find','destroy','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','hasOwnProperty','order','sort','where','pick','WhatsappInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','include','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','lastName','attachments','Attachment','Messages','read','WhatsappAccount','Account','Owner','get','mkdirSync','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','createdAt','direction','out','System','value','renderFile','views','Whatsapp','err','unlinkSync','zip-dir','moment','bluebird','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','register','status','end','json','offset','undefined','limit','count','set','update','then','sendStatus','error','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','key','getOptions'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0xf4e6,0xd5));var _0x6f4e=function(_0x2ac4af,_0x288c53){_0x2ac4af=_0x2ac4af-0x0;var _0x3a36df=_0xf4e6[_0x2ac4af];return _0x3a36df;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x6f4e('0x0'));var moment=require(_0x6f4e('0x1'));var BPromise=require(_0x6f4e('0x2'));var util=require('util');var path=require(_0x6f4e('0x3'));var ejs=require(_0x6f4e('0x4'));var fs=require('fs');var _=require(_0x6f4e('0x5'));var Redis=require('ioredis');var interaction=require(_0x6f4e('0x6'));var qs=require(_0x6f4e('0x7'));var pdf=require(_0x6f4e('0x8'));var logger=require(_0x6f4e('0x9'))(_0x6f4e('0xa'));var config=require(_0x6f4e('0xb'));var db=require(_0x6f4e('0xc'))['db'];config[_0x6f4e('0xd')]=_['defaults'](config['redis'],{'host':_0x6f4e('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f4e('0xd')]));require('./whatsappInteraction.socket')[_0x6f4e('0xf')](socket);function respondWithStatusCode(_0x401e1e,_0x7762c){_0x7762c=_0x7762c||0xcc;return function(_0x33c650){if(_0x33c650){return _0x401e1e['sendStatus'](_0x7762c);}return _0x401e1e[_0x6f4e('0x10')](_0x7762c)[_0x6f4e('0x11')]();};}function respondWithResult(_0x35f0f4,_0x331692){_0x331692=_0x331692||0xc8;return function(_0x596414){if(_0x596414){return _0x35f0f4[_0x6f4e('0x10')](_0x331692)[_0x6f4e('0x12')](_0x596414);}};}function respondWithFilteredResult(_0x52d8cc,_0x1f0e2a){return function(_0x1e3ea1){if(_0x1e3ea1){var _0x22f62f=typeof _0x1f0e2a[_0x6f4e('0x13')]===_0x6f4e('0x14')&&typeof _0x1f0e2a[_0x6f4e('0x15')]===_0x6f4e('0x14');var _0x1bf39b=_0x1e3ea1[_0x6f4e('0x16')];var _0x522fa0=_0x22f62f?0x0:_0x1f0e2a['offset'];var _0x34a853=_0x22f62f?_0x1e3ea1[_0x6f4e('0x16')]:_0x1f0e2a['offset']+_0x1f0e2a[_0x6f4e('0x15')];var _0x2f1090;if(_0x34a853>=_0x1bf39b){_0x34a853=_0x1bf39b;_0x2f1090=0xc8;}else{_0x2f1090=0xce;}_0x52d8cc[_0x6f4e('0x10')](_0x2f1090);return _0x52d8cc[_0x6f4e('0x17')]('Content-Range',_0x522fa0+'-'+_0x34a853+'/'+_0x1bf39b)[_0x6f4e('0x12')](_0x1e3ea1);}return null;};}function saveUpdates(_0x2457f8){return function(_0x1e60cc){if(_0x1e60cc){return _0x1e60cc[_0x6f4e('0x18')](_0x2457f8)[_0x6f4e('0x19')](function(_0x36e5c0){return _0x36e5c0;});}return null;};}function removeEntity(_0x3bd878){return function(_0x58479b){if(_0x58479b){return _0x58479b['destroy']()[_0x6f4e('0x19')](function(){_0x3bd878[_0x6f4e('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c9605){return function(_0x4c7b02){if(!_0x4c7b02){_0x3c9605[_0x6f4e('0x1a')](0x194);}return _0x4c7b02;};}function handleError(_0x23d23c,_0x513be7){_0x513be7=_0x513be7||0x1f4;return function(_0x579873){logger[_0x6f4e('0x1b')](_0x579873['stack']);if(_0x579873[_0x6f4e('0x1c')]){delete _0x579873[_0x6f4e('0x1c')];}_0x23d23c[_0x6f4e('0x10')](_0x513be7)[_0x6f4e('0x1d')](_0x579873);};}exports[_0x6f4e('0x1e')]=function(_0x3ac970,_0x535f2f){var _0x572cbc={};var _0x1f5178=_[_0x6f4e('0x1f')](db[_0x6f4e('0x20')][_0x6f4e('0x21')],function(_0xa1a447){return{'name':_0xa1a447[_0x6f4e('0x22')],'type':_0xa1a447['type'][_0x6f4e('0x23')]};});_0x572cbc=qs[_0x6f4e('0x24')](_0x1f5178,_0x3ac970);return interaction[_0x6f4e('0x25')]('whatsapp',_0x3ac970[_0x6f4e('0x26')],_0x3ac970[_0x6f4e('0x27')],_0x572cbc,_0x1f5178)[_0x6f4e('0x19')](respondWithFilteredResult(_0x535f2f,_0x572cbc))[_0x6f4e('0x28')](handleError(_0x535f2f,null));};exports[_0x6f4e('0x29')]=function(_0x43d3b1,_0x1645ea){var _0x5c7737={'raw':![],'where':{'id':_0x43d3b1[_0x6f4e('0x2a')]['id']}},_0x7667af={};_0x7667af[_0x6f4e('0x2b')]=_[_0x6f4e('0x2c')](db[_0x6f4e('0x20')]['rawAttributes']);_0x7667af[_0x6f4e('0x26')]=_[_0x6f4e('0x2c')](_0x43d3b1['query']);_0x7667af[_0x6f4e('0x2d')]=_[_0x6f4e('0x2e')](_0x7667af[_0x6f4e('0x2b')],_0x7667af[_0x6f4e('0x26')]);_0x5c7737[_0x6f4e('0x2f')]=_[_0x6f4e('0x2e')](_0x7667af[_0x6f4e('0x2b')],qs['fields'](_0x43d3b1[_0x6f4e('0x26')][_0x6f4e('0x30')]));_0x5c7737[_0x6f4e('0x2f')]=_0x5c7737[_0x6f4e('0x2f')]['length']?_0x5c7737[_0x6f4e('0x2f')]:_0x7667af[_0x6f4e('0x2b')];if(_0x43d3b1[_0x6f4e('0x26')][_0x6f4e('0x31')]){_0x5c7737['include']=[{'all':!![]}];}_0x5c7737=_['merge']({},_0x5c7737,_0x43d3b1['options']);return db[_0x6f4e('0x20')]['find'](_0x5c7737)[_0x6f4e('0x19')](handleEntityNotFound(_0x1645ea,null))[_0x6f4e('0x19')](respondWithResult(_0x1645ea,null))['catch'](handleError(_0x1645ea,null));};exports[_0x6f4e('0x32')]=function(_0x4d28cc,_0x1d5095){return db[_0x6f4e('0x20')]['create'](_0x4d28cc['body'],{})[_0x6f4e('0x19')](respondWithResult(_0x1d5095,0xc9))[_0x6f4e('0x28')](handleError(_0x1d5095,null));};exports['update']=function(_0x48c5f4,_0x2afe8b){if(_0x48c5f4[_0x6f4e('0x33')]['id']){delete _0x48c5f4[_0x6f4e('0x33')]['id'];}return db[_0x6f4e('0x20')][_0x6f4e('0x34')]({'where':{'id':_0x48c5f4['params']['id']}})[_0x6f4e('0x19')](handleEntityNotFound(_0x2afe8b,null))['then'](saveUpdates(_0x48c5f4[_0x6f4e('0x33')],null))[_0x6f4e('0x19')](respondWithResult(_0x2afe8b,null))[_0x6f4e('0x28')](handleError(_0x2afe8b,null));};exports[_0x6f4e('0x35')]=function(_0x28bb6b,_0x423e4f){return db[_0x6f4e('0x20')][_0x6f4e('0x34')]({'where':{'id':_0x28bb6b[_0x6f4e('0x2a')]['id']}})['then'](handleEntityNotFound(_0x423e4f,null))[_0x6f4e('0x19')](removeEntity(_0x423e4f,null))[_0x6f4e('0x28')](handleError(_0x423e4f,null));};exports[_0x6f4e('0x36')]=function(_0x1e4060,_0x1809a0){return db['WhatsappInteraction'][_0x6f4e('0x36')]()[_0x6f4e('0x19')](respondWithResult(_0x1809a0,null))[_0x6f4e('0x28')](handleError(_0x1809a0,null));};exports[_0x6f4e('0x37')]=function(_0x5078e6,_0x3bac6e){return db[_0x6f4e('0x38')][_0x6f4e('0x34')]({'where':{'id':_0x5078e6[_0x6f4e('0x2a')]['id']}})[_0x6f4e('0x19')](handleEntityNotFound(_0x3bac6e,null))[_0x6f4e('0x19')](function(_0x58a27a){if(_0x58a27a){return _0x58a27a[_0x6f4e('0x37')](_0x5078e6['body'][_0x6f4e('0x39')],_[_0x6f4e('0x3a')](_0x5078e6[_0x6f4e('0x33')],['ids','id'])||{});}})['then'](respondWithResult(_0x3bac6e,null))[_0x6f4e('0x28')](handleError(_0x3bac6e,null));};exports[_0x6f4e('0x3b')]=function(_0x1fb49e,_0x13ae30){var _0x326b4b={'raw':![],'where':{}};var _0x3feafa={};var _0x5be6a3={'count':0x0,'rows':[]};return db[_0x6f4e('0x20')][_0x6f4e('0x3c')]({'where':{'id':_0x1fb49e[_0x6f4e('0x2a')]['id']}})['then'](handleEntityNotFound(_0x13ae30,null))[_0x6f4e('0x19')](function(_0x40c464){if(_0x40c464){_0x3feafa[_0x6f4e('0x2b')]=_[_0x6f4e('0x2c')](db[_0x6f4e('0x38')][_0x6f4e('0x21')]);_0x3feafa['query']=_[_0x6f4e('0x2c')](_0x1fb49e[_0x6f4e('0x26')]);_0x3feafa[_0x6f4e('0x2d')]=_[_0x6f4e('0x2e')](_0x3feafa[_0x6f4e('0x2b')],_0x3feafa[_0x6f4e('0x26')]);_0x326b4b['attributes']=_['intersection'](_0x3feafa['model'],qs[_0x6f4e('0x30')](_0x1fb49e[_0x6f4e('0x26')]['fields']));_0x326b4b[_0x6f4e('0x2f')]=_0x326b4b[_0x6f4e('0x2f')]['length']?_0x326b4b[_0x6f4e('0x2f')]:_0x3feafa[_0x6f4e('0x2b')];if(!_0x1fb49e['query'][_0x6f4e('0x3d')]('nolimit')){_0x326b4b[_0x6f4e('0x15')]=qs[_0x6f4e('0x15')](_0x1fb49e[_0x6f4e('0x26')]['limit']);_0x326b4b['offset']=qs['offset'](_0x1fb49e['query'][_0x6f4e('0x13')]);}_0x326b4b[_0x6f4e('0x3e')]=qs[_0x6f4e('0x3f')](_0x1fb49e[_0x6f4e('0x26')][_0x6f4e('0x3f')]);_0x326b4b[_0x6f4e('0x40')]=qs[_0x6f4e('0x2d')](_[_0x6f4e('0x41')](_0x1fb49e[_0x6f4e('0x26')],_0x3feafa[_0x6f4e('0x2d')]));_0x326b4b[_0x6f4e('0x40')][_0x6f4e('0x42')]=_0x40c464['id'];if(_0x1fb49e[_0x6f4e('0x26')][_0x6f4e('0x43')]){_0x326b4b[_0x6f4e('0x40')]=_[_0x6f4e('0x44')](_0x326b4b[_0x6f4e('0x40')],{'$or':_['map'](_0x326b4b['attributes'],function(_0xc5f7d4){var _0x421c1d={};_0x421c1d[_0xc5f7d4]={'$like':'%'+_0x1fb49e[_0x6f4e('0x26')][_0x6f4e('0x43')]+'%'};return _0x421c1d;})});}if(_0x1fb49e[_0x6f4e('0x26')][_0x6f4e('0x45')]){var _0x2224a0=_0x1fb49e[_0x6f4e('0x26')][_0x6f4e('0x45')][_0x6f4e('0x46')](',');var _0x55c58e={};_0x55c58e[_0x2224a0[0x0]]={'$gte':moment(_0x2224a0[0x1])[_0x6f4e('0x47')](_0x6f4e('0x48'))};_0x326b4b[_0x6f4e('0x40')]=_[_0x6f4e('0x44')](_0x326b4b['where'],_0x55c58e);}_0x326b4b=_[_0x6f4e('0x44')]({},_0x326b4b,_0x1fb49e[_0x6f4e('0x49')]);return db['WhatsappMessage']['count']({'where':_0x326b4b[_0x6f4e('0x40')]})['then'](function(_0x347193){_0x5be6a3['count']=_0x347193;if(_0x1fb49e['query'][_0x6f4e('0x31')]){_0x326b4b[_0x6f4e('0x4a')]=[{'all':!![]}];}return db[_0x6f4e('0x38')][_0x6f4e('0x25')](_0x326b4b);})[_0x6f4e('0x19')](function(_0x156016){_0x5be6a3['rows']=_0x156016;return _0x5be6a3;});}})[_0x6f4e('0x19')](respondWithFilteredResult(_0x13ae30,_0x326b4b))[_0x6f4e('0x28')](handleError(_0x13ae30,null));};exports[_0x6f4e('0x4b')]=function(_0x17e0ec,_0x5de1cb){return db['WhatsappInteraction'][_0x6f4e('0x34')]({'where':{'id':_0x17e0ec[_0x6f4e('0x2a')]['id']}})[_0x6f4e('0x19')](handleEntityNotFound(_0x5de1cb,null))[_0x6f4e('0x19')](function(_0x4131a1){if(_0x4131a1){return _0x4131a1[_0x6f4e('0x4c')](_0x17e0ec[_0x6f4e('0x33')]['ids'],_[_0x6f4e('0x3a')](_0x17e0ec[_0x6f4e('0x33')],[_0x6f4e('0x39'),'id'])||{})[_0x6f4e('0x4d')](function(){return db[_0x6f4e('0x4e')][_0x6f4e('0x25')]({'attributes':['id',_0x6f4e('0x1c'),_0x6f4e('0x4f')],'where':{'id':_0x17e0ec['body']['ids']}});})['then'](function(_0x29a6db){socket[_0x6f4e('0x50')]('whatsappInteractionTags:save',{'id':Number(_0x17e0ec['params']['id']),'tags':_0x29a6db||[]});return{'id':Number(_0x17e0ec['params']['id']),'tags':_0x29a6db||[]};});}})[_0x6f4e('0x19')](respondWithResult(_0x5de1cb,null))[_0x6f4e('0x28')](handleError(_0x5de1cb,null));};exports[_0x6f4e('0x51')]=function(_0x7c0426,_0xabd879){return db[_0x6f4e('0x20')][_0x6f4e('0x34')]({'where':{'id':_0x7c0426[_0x6f4e('0x2a')]['id']}})[_0x6f4e('0x19')](handleEntityNotFound(_0xabd879,null))[_0x6f4e('0x19')](function(_0x38076d){if(_0x38076d){return _0x38076d[_0x6f4e('0x51')](_0x7c0426['query']['ids']);}})['then'](respondWithStatusCode(_0xabd879,null))[_0x6f4e('0x28')](handleError(_0xabd879,null));};exports[_0x6f4e('0x52')]=function(_0x5bcec0,_0x4b2872){var _0x1b7a3c=moment()[_0x6f4e('0x53')]()[_0x6f4e('0x54')]();var _0x4def37=path[_0x6f4e('0x55')](config[_0x6f4e('0x56')],_0x6f4e('0x57'),_0x6f4e('0x58'),_0x6f4e('0x59'));var _0x31f357=path['join'](config[_0x6f4e('0x56')],_0x6f4e('0x57'),_0x6f4e('0x58'),'attachments');var _0x3a5a84=path[_0x6f4e('0x55')](_0x4def37,_0x1b7a3c);var _0x123aad=util[_0x6f4e('0x47')](_0x6f4e('0x5a'),_0x5bcec0[_0x6f4e('0x2a')]['id'],_0x1b7a3c);var _0x168c36=path[_0x6f4e('0x55')](_0x4def37,_0x123aad);var _0xf893e7=[];_0xf893e7['push']({'model':db['User'],'as':_0x6f4e('0x5b'),'attributes':['id',_0x6f4e('0x5c')],'raw':!![]});_0xf893e7[_0x6f4e('0x5d')]({'model':db[_0x6f4e('0x5e')],'as':_0x6f4e('0x5f'),'attributes':['id',_0x6f4e('0x60'),_0x6f4e('0x61')],'raw':!![]});if(_0x5bcec0[_0x6f4e('0x26')][_0x6f4e('0x62')]){_0xf893e7[_0x6f4e('0x5d')]({'model':db['Attachment'],'as':_0x6f4e('0x63'),'raw':!![]});}var _0x55dfa9=[{'model':db[_0x6f4e('0x38')],'as':_0x6f4e('0x64'),'attributes':['id',_0x6f4e('0x33'),'createdAt','direction','secret',_0x6f4e('0x65')],'include':_0xf893e7}];_0x55dfa9[_0x6f4e('0x5d')]({'model':db[_0x6f4e('0x66')],'as':_0x6f4e('0x67'),'attributes':['id',_0x6f4e('0x1c')]});_0x55dfa9['push']({'model':db[_0x6f4e('0x5b')],'as':_0x6f4e('0x68'),'attributes':['id',_0x6f4e('0x5c')]});return db[_0x6f4e('0x20')]['find']({'where':{'id':_0x5bcec0[_0x6f4e('0x2a')]['id']},'include':_0x55dfa9})['then'](handleEntityNotFound(_0x4b2872,null))[_0x6f4e('0x19')](function(_0xbe1040){if(_0xbe1040){var _0x511758=_0xbe1040[_0x6f4e('0x69')]({'plain':!![]});fs[_0x6f4e('0x6a')](_0x3a5a84);var _0x108b2a={'channel':'Whatsapp','account':_0x511758[_0x6f4e('0x67')][_0x6f4e('0x1c')],'agent':_0x511758['Owner']?_0x511758['Owner'][_0x6f4e('0x5c')]:'N.A.','createdAt':moment(_0x511758['createdAt'])[_0x6f4e('0x47')](_0x6f4e('0x48'))[_0x6f4e('0x54')](),'closedAt':_0x511758[_0x6f4e('0x6b')]?moment(_0x511758[_0x6f4e('0x6c')])['format'](_0x6f4e('0x48'))[_0x6f4e('0x54')]():'','disposition':_0x511758[_0x6f4e('0x6d')],'messages':_(_0x511758[_0x6f4e('0x64')])[_0x6f4e('0x43')]({'secret':![]})['map'](function(_0x1e7972){if(_0x1e7972[_0x6f4e('0x63')]){var _0x2f4cd0=path['join'](_0x31f357,_0x1e7972['Attachment'][_0x6f4e('0x6e')]);if(fs[_0x6f4e('0x6f')](_0x2f4cd0)){fs[_0x6f4e('0x70')](_0x2f4cd0)[_0x6f4e('0x71')](fs[_0x6f4e('0x72')](path[_0x6f4e('0x55')](_0x3a5a84,_0x1e7972[_0x6f4e('0x63')]['basename'])));}}return{'date':moment(_0x1e7972[_0x6f4e('0x73')])[_0x6f4e('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6f4e('0x54')](),'sender':_0x1e7972[_0x6f4e('0x74')]===_0x6f4e('0x75')?_0x1e7972[_0x6f4e('0x5b')]?_0x1e7972[_0x6f4e('0x5b')][_0x6f4e('0x5c')]:_0x6f4e('0x76'):_0x1e7972['Contact'][_0x6f4e('0x60')]+(_0x1e7972['Contact'][_0x6f4e('0x61')]?'\x20'+_0x1e7972[_0x6f4e('0x5f')][_0x6f4e('0x61')]:''),'body':_0x1e7972[_0x6f4e('0x63')]?_0x1e7972['Attachment'][_0x6f4e('0x6e')]:_0x1e7972[_0x6f4e('0x33')],'direction':_0x1e7972[_0x6f4e('0x74')]===_0x6f4e('0x75')?'A':'C','secret':_0x1e7972['secret'],'read':_0x1e7972['read'],'attachment':_0x1e7972['Attachment']};})[_0x6f4e('0x77')]()};return ejs[_0x6f4e('0x78')](path[_0x6f4e('0x55')](config[_0x6f4e('0x56')],_0x6f4e('0x57'),_0x6f4e('0x79'),'downloadInteraction.ejs'),{'interaction':_0x108b2a})[_0x6f4e('0x19')](function(_0x5aa8ca){var _0x11f039=path[_0x6f4e('0x55')](_0x3a5a84,'transcript-'+_0x511758['id']+'-'+_0x1b7a3c+'.pdf');var _0xdd883d={'path':_0x11f039,'channel':_0x6f4e('0x7a'),'interactionId':_0x511758['id']};return pdf['createPdfFromHTML'](_0x5aa8ca,_0xdd883d);})[_0x6f4e('0x19')](function(){return new BPromise(function(_0x1a597b,_0xcab6c2){zipdir(_0x3a5a84,{'saveTo':_0x168c36},function(_0x5cfbed,_0x1955ad){if(_0x5cfbed)return _0xcab6c2(_0x5cfbed);return _0x1a597b(_0x1955ad);});})['then'](function(){return new BPromise(function(_0x5cbc2f,_0x33b72a){rimraf(_0x3a5a84,function(_0x3e1f25){if(_0x3e1f25)_0x33b72a(_0x3e1f25);return _0x5cbc2f();});});})[_0x6f4e('0x19')](function(){return _0x4b2872[_0x6f4e('0x52')](_0x168c36,_0x123aad,function(_0x2d4e82){if(_0x2d4e82){console['log'](_0x6f4e('0x7b'),_0x2d4e82);}else{fs[_0x6f4e('0x7c')](_0x168c36);}});});});}else{return _0x4b2872[_0x6f4e('0x1a')](0xc8);}})[_0x6f4e('0x28')](handleError(_0x4b2872,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 39aabb0..9f37293 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 _0x40ca=['Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','remove','then','setDataValue'];(function(_0x3be715,_0x54cb1f){var _0x10406b=function(_0x40f083){while(--_0x40f083){_0x3be715['push'](_0x3be715['shift']());}};_0x10406b(++_0x54cb1f);}(_0x40ca,0x1a1));var _0xa40c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x40ca[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require(_0xa40c('0x0'));var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xa40c('0x1'))['db'][_0xa40c('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xa40c('0x3')](0x0);var events={'afterCreate':_0xa40c('0x4'),'afterUpdate':'update','afterDestroy':_0xa40c('0x5')};function emitEvent(_0x4b3c47){return function(_0x5c9818,_0x51bd6e,_0x46eff2){_0x5c9818['getUsers']({'attributes':['id'],'raw':!![]})[_0xa40c('0x6')](function(_0xc55713){_0x5c9818[_0xa40c('0x7')](_0xa40c('0x8'),_0xc55713[_0xa40c('0x9')](function(_0x59ed3d){return{'id':_0x59ed3d['id']};}));return WhatsappMessage[_0xa40c('0xa')]({'where':{'WhatsappInteractionId':_0x5c9818['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa40c('0x6')](function(_0x13c7e5){_0x5c9818[_0xa40c('0x7')](_0xa40c('0xb'),_0x13c7e5[_0xa40c('0xc')]);WhatsappInteractionEvents[_0xa40c('0xd')](_0x4b3c47+':'+_0x5c9818['id'],_0x5c9818);WhatsappInteractionEvents[_0xa40c('0xd')](_0x4b3c47,_0x5c9818);_0x46eff2(null);})[_0xa40c('0xe')](_0x46eff2(null));};}for(var e in events){if(events[_0xa40c('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xa40c('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x636f=['exports','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners','save','remove','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook'];(function(_0x24e94e,_0x5e5f84){var _0x139079=function(_0x1b58de){while(--_0x1b58de){_0x24e94e['push'](_0x24e94e['shift']());}};_0x139079(++_0x5e5f84);}(_0x636f,0x188));var _0xf636=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x636f[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db'][_0xf636('0x0')];var WhatsappMessage=require(_0xf636('0x1'))['db'][_0xf636('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xf636('0x3')](0x0);var events={'afterCreate':_0xf636('0x4'),'afterUpdate':'update','afterDestroy':_0xf636('0x5')};function emitEvent(_0x1479ae){return function(_0x1291af,_0x16d1f6,_0x39c5f1){_0x1291af['getUsers']({'attributes':['id'],'raw':!![]})[_0xf636('0x6')](function(_0x46a395){_0x1291af[_0xf636('0x7')](_0xf636('0x8'),_0x46a395[_0xf636('0x9')](function(_0x1b4f04){return{'id':_0x1b4f04['id']};}));return WhatsappMessage[_0xf636('0xa')]({'where':{'WhatsappInteractionId':_0x1291af['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf636('0x6')](function(_0xf9e996){_0x1291af[_0xf636('0x7')]('unreadMessages',_0xf9e996[_0xf636('0xb')]);WhatsappInteractionEvents[_0xf636('0xc')](_0x1479ae+':'+_0x1291af['id'],_0x1291af);WhatsappInteractionEvents['emit'](_0x1479ae,_0x1291af);_0x39c5f1(null);})[_0xf636('0xd')](_0x39c5f1(null));};}for(var e in events){if(events[_0xf636('0xe')](e)){var event=events[e];WhatsappInteraction[_0xf636('0xf')](e,emitEvent(event));}}module[_0xf636('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 587f318..fec93f1 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 _0x3d7e=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','closed'];(function(_0x4d3eaf,_0xe31230){var _0x15e0e7=function(_0x4b48c2){while(--_0x4b48c2){_0x4d3eaf['push'](_0x4d3eaf['shift']());}};_0x15e0e7(++_0xe31230);}(_0x3d7e,0x133));var _0xe3d7=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x3d7e[_0x42bc91];return _0x3f5507;};'use strict';var _=require('lodash');var util=require(_0xe3d7('0x0'));var logger=require('../../config/logger')(_0xe3d7('0x1'));var moment=require(_0xe3d7('0x2'));var BPromise=require(_0xe3d7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3d7('0x4'));var rimraf=require(_0xe3d7('0x5'));var config=require(_0xe3d7('0x6'));var attributes=require(_0xe3d7('0x7'));module[_0xe3d7('0x8')]=function(_0x229cb5,_0x62f4d8){return _0x229cb5[_0xe3d7('0x9')](_0xe3d7('0xa'),attributes,{'tableName':_0xe3d7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2fb00b,_0x5a9673,_0xe331f){if(_0x2fb00b['changed'](_0xe3d7('0xc'))){_0x2fb00b[_0xe3d7('0xd')]=moment()[_0xe3d7('0xe')](_0xe3d7('0xf'));}_0xe331f(null,_0x2fb00b);}}});}; \ No newline at end of file +var _0xce17=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./whatsappInteraction.attributes','exports','define','changed','closed','closedAt','format'];(function(_0x36b9ab,_0x2a59e0){var _0x6dbd8e=function(_0x3d6b90){while(--_0x3d6b90){_0x36b9ab['push'](_0x36b9ab['shift']());}};_0x6dbd8e(++_0x2a59e0);}(_0xce17,0x88));var _0x7ce1=function(_0x367e5b,_0x5721e4){_0x367e5b=_0x367e5b-0x0;var _0x4b909e=_0xce17[_0x367e5b];return _0x4b909e;};'use strict';var _=require(_0x7ce1('0x0'));var util=require(_0x7ce1('0x1'));var logger=require(_0x7ce1('0x2'))(_0x7ce1('0x3'));var moment=require(_0x7ce1('0x4'));var BPromise=require(_0x7ce1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7ce1('0x6'));var attributes=require(_0x7ce1('0x7'));module[_0x7ce1('0x8')]=function(_0x65ca18,_0x1b91ae){return _0x65ca18[_0x7ce1('0x9')]('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x40d147,_0x39f35e,_0x2d7ec4){if(_0x40d147[_0x7ce1('0xa')](_0x7ce1('0xb'))){_0x40d147[_0x7ce1('0xc')]=moment()[_0x7ce1('0xd')](_0x7ce1('0xe'));}_0x2d7ec4(null,_0x40d147);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 372e4f1..82bd081 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 _0xed05=['limit','stringify','AddTagsToWhatsappInteraction','where','addTags','ids','omit','spread','AddTags','lodash','moment','randomstring','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed05,0xa9));var _0x5ed0=function(_0x55bae1,_0x2232f3){_0x55bae1=_0x55bae1-0x0;var _0x572cbb=_0xed05[_0x55bae1];return _0x572cbb;};'use strict';var _=require(_0x5ed0('0x0'));var util=require('util');var moment=require(_0x5ed0('0x1'));var BPromise=require('bluebird');var rs=require(_0x5ed0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ed0('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5ed0('0x4'));var config=require(_0x5ed0('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x5ed0('0x6')][_0x5ed0('0x7')]({'port':0x232a});config[_0x5ed0('0x8')]=_[_0x5ed0('0x9')](config[_0x5ed0('0x8')],{'host':_0x5ed0('0xa'),'port':0x18eb});var socket=require(_0x5ed0('0xb'))(new Redis(config['redis']));require(_0x5ed0('0xc'))[_0x5ed0('0xd')](socket);function respondWithRpcPromise(_0x4113a7,_0x2be942,_0x2c38dc){return new BPromise(function(_0x46c01f,_0x458775){return client[_0x5ed0('0xe')](_0x4113a7,_0x2c38dc)[_0x5ed0('0xf')](function(_0x3930e9){logger[_0x5ed0('0x10')](_0x5ed0('0x11'),_0x2be942,_0x5ed0('0x12'));logger[_0x5ed0('0x13')](_0x5ed0('0x14'),_0x2be942,_0x5ed0('0x12'),JSON['stringify'](_0x3930e9));if(_0x3930e9[_0x5ed0('0x15')]){if(_0x3930e9[_0x5ed0('0x15')][_0x5ed0('0x16')]===0x1f4){logger[_0x5ed0('0x15')](_0x5ed0('0x11'),_0x2be942,_0x3930e9[_0x5ed0('0x15')][_0x5ed0('0x17')]);return _0x458775(_0x3930e9[_0x5ed0('0x15')]['message']);}logger['error'](_0x5ed0('0x11'),_0x2be942,_0x3930e9['error'][_0x5ed0('0x17')]);return _0x46c01f(_0x3930e9['error'][_0x5ed0('0x17')]);}else{logger[_0x5ed0('0x10')](_0x5ed0('0x11'),_0x2be942,_0x5ed0('0x12'));_0x46c01f(_0x3930e9[_0x5ed0('0x18')][_0x5ed0('0x17')]);}})[_0x5ed0('0x19')](function(_0x383c77){logger[_0x5ed0('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x2be942,_0x383c77);_0x458775(_0x383c77);});});}exports[_0x5ed0('0x1a')]=function(_0x4a5373){var _0x4d3b7d=this;return new Promise(function(_0x35a65c,_0x5409da){return db[_0x5ed0('0x1b')]['update'](_0x4a5373[_0x5ed0('0x1c')],{'raw':_0x4a5373[_0x5ed0('0x1d')]?_0x4a5373['options'][_0x5ed0('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a5373[_0x5ed0('0x1d')]?_0x4a5373[_0x5ed0('0x1d')]['where']||null:null,'attributes':_0x4a5373[_0x5ed0('0x1d')]?_0x4a5373[_0x5ed0('0x1d')]['attributes']||null:null,'limit':_0x4a5373[_0x5ed0('0x1d')]?_0x4a5373[_0x5ed0('0x1d')][_0x5ed0('0x1f')]||null:null})[_0x5ed0('0xf')](function(_0x26a342){logger[_0x5ed0('0x10')](_0x5ed0('0x1a'),_0x4a5373);logger[_0x5ed0('0x13')](_0x5ed0('0x1a'),_0x4a5373,JSON[_0x5ed0('0x20')](_0x26a342));_0x35a65c(_0x26a342);})[_0x5ed0('0x19')](function(_0x16b5c9){logger[_0x5ed0('0x15')](_0x5ed0('0x1a'),_0x16b5c9[_0x5ed0('0x17')],_0x4a5373);_0x5409da(_0x4d3b7d['error'](0x1f4,_0x16b5c9[_0x5ed0('0x17')]));});});};exports[_0x5ed0('0x21')]=function(_0x587afb){return new Promise(function(_0x46f279,_0x1755cb){return db[_0x5ed0('0x1b')]['find']({'where':_0x587afb[_0x5ed0('0x1d')]?_0x587afb[_0x5ed0('0x1d')][_0x5ed0('0x22')]||null:null})[_0x5ed0('0xf')](function(_0x24c650){if(_0x24c650){return _0x24c650[_0x5ed0('0x23')](_0x587afb[_0x5ed0('0x1c')][_0x5ed0('0x24')],_[_0x5ed0('0x25')](_0x587afb[_0x5ed0('0x1c')],[_0x5ed0('0x24'),'id'])||{});}})[_0x5ed0('0x26')](function(_0x32b48e){logger[_0x5ed0('0x10')](_0x5ed0('0x27'),_0x587afb);logger['debug'](_0x5ed0('0x27'),_0x587afb,JSON[_0x5ed0('0x20')](_0x32b48e));_0x46f279(_0x32b48e);})[_0x5ed0('0x19')](function(_0x2e86dd){logger['error'](_0x5ed0('0x27'),_0x2e86dd[_0x5ed0('0x17')],_0x587afb);_0x1755cb(_this[_0x5ed0('0x15')](0x1f4,_0x2e86dd[_0x5ed0('0x17')]));});});}; \ No newline at end of file +var _0x795b=['error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','attributes','then','debug','stringify','where','body','ids','spread','AddTags','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x795b,0x184));var _0xb795=function(_0x810f61,_0x3cd628){_0x810f61=_0x810f61-0x0;var _0x1475af=_0x795b[_0x810f61];return _0x1475af;};'use strict';var _=require(_0xb795('0x0'));var util=require('util');var moment=require(_0xb795('0x1'));var BPromise=require(_0xb795('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb795('0x3'))['db'];var utils=require(_0xb795('0x4'));var logger=require(_0xb795('0x5'))(_0xb795('0x6'));var config=require(_0xb795('0x7'));var jayson=require(_0xb795('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xb795('0x9')](config['redis'],{'host':_0xb795('0xa'),'port':0x18eb});var socket=require(_0xb795('0xb'))(new Redis(config['redis']));require(_0xb795('0xc'))[_0xb795('0xd')](socket);function respondWithRpcPromise(_0x527bac,_0x23adf4,_0x2a06af){return new BPromise(function(_0x24b58e,_0x5f493d){return client[_0xb795('0xe')](_0x527bac,_0x2a06af)['then'](function(_0x525cf3){logger[_0xb795('0xf')](_0xb795('0x10'),_0x23adf4,_0xb795('0x11'));logger['debug'](_0xb795('0x12'),_0x23adf4,_0xb795('0x11'),JSON['stringify'](_0x525cf3));if(_0x525cf3[_0xb795('0x13')]){if(_0x525cf3['error']['code']===0x1f4){logger[_0xb795('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x23adf4,_0x525cf3['error']['message']);return _0x5f493d(_0x525cf3[_0xb795('0x13')][_0xb795('0x14')]);}logger['error'](_0xb795('0x10'),_0x23adf4,_0x525cf3['error'][_0xb795('0x14')]);return _0x24b58e(_0x525cf3[_0xb795('0x13')][_0xb795('0x14')]);}else{logger['info'](_0xb795('0x10'),_0x23adf4,'request\x20sent');_0x24b58e(_0x525cf3[_0xb795('0x15')][_0xb795('0x14')]);}})[_0xb795('0x16')](function(_0x415c6a){logger[_0xb795('0x13')](_0xb795('0x10'),_0x23adf4,_0x415c6a);_0x5f493d(_0x415c6a);});});}exports[_0xb795('0x17')]=function(_0xddce39){var _0x36652b=this;return new Promise(function(_0x55f353,_0x15fe5f){return db[_0xb795('0x18')][_0xb795('0x19')](_0xddce39['body'],{'raw':_0xddce39[_0xb795('0x1a')]?_0xddce39['options'][_0xb795('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xddce39['options']?_0xddce39[_0xb795('0x1a')]['where']||null:null,'attributes':_0xddce39[_0xb795('0x1a')]?_0xddce39[_0xb795('0x1a')][_0xb795('0x1c')]||null:null,'limit':_0xddce39[_0xb795('0x1a')]?_0xddce39[_0xb795('0x1a')]['limit']||null:null})[_0xb795('0x1d')](function(_0x5309f8){logger[_0xb795('0xf')](_0xb795('0x17'),_0xddce39);logger[_0xb795('0x1e')](_0xb795('0x17'),_0xddce39,JSON[_0xb795('0x1f')](_0x5309f8));_0x55f353(_0x5309f8);})[_0xb795('0x16')](function(_0x5e1306){logger[_0xb795('0x13')](_0xb795('0x17'),_0x5e1306['message'],_0xddce39);_0x15fe5f(_0x36652b['error'](0x1f4,_0x5e1306['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x333203){return new Promise(function(_0xe0f492,_0x42eb3d){return db['WhatsappInteraction']['find']({'where':_0x333203[_0xb795('0x1a')]?_0x333203['options'][_0xb795('0x20')]||null:null})['then'](function(_0xc80a41){if(_0xc80a41){return _0xc80a41['addTags'](_0x333203[_0xb795('0x21')][_0xb795('0x22')],_['omit'](_0x333203['body'],[_0xb795('0x22'),'id'])||{});}})[_0xb795('0x23')](function(_0x45cace){logger['info']('AddTags',_0x333203);logger[_0xb795('0x1e')](_0xb795('0x24'),_0x333203,JSON[_0xb795('0x1f')](_0x45cace));_0xe0f492(_0x45cace);})[_0xb795('0x16')](function(_0x40ec23){logger[_0xb795('0x13')](_0xb795('0x24'),_0x40ec23[_0xb795('0x14')],_0x333203);_0x42eb3d(_this[_0xb795('0x13')](0x1f4,_0x40ec23['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index afb372b..13d1f93 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 _0x882c=['save','remove','update','emit','register','length','whatsappInteraction:'];(function(_0x14ac4f,_0x375df1){var _0x523cb5=function(_0x9aa904){while(--_0x9aa904){_0x14ac4f['push'](_0x14ac4f['shift']());}};_0x523cb5(++_0x375df1);}(_0x882c,0x196));var _0xc882=function(_0x5ee0ee,_0x3ce413){_0x5ee0ee=_0x5ee0ee-0x0;var _0x198093=_0x882c[_0x5ee0ee];return _0x198093;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xc882('0x0'),_0xc882('0x1'),_0xc882('0x2')];function createListener(_0x119c33,_0x2919cc){return function(_0x4c1489){_0x2919cc[_0xc882('0x3')](_0x119c33,_0x4c1489);};}function removeListener(_0x2473c4,_0x8b6df){return function(){WhatsappInteractionEvents['removeListener'](_0x2473c4,_0x8b6df);};}exports[_0xc882('0x4')]=function(_0x245aae){for(var _0xde6b60=0x0,_0x828330=events[_0xc882('0x5')];_0xde6b60<_0x828330;_0xde6b60++){var _0x4d1e92=events[_0xde6b60];var _0x5c73c8=createListener(_0xc882('0x6')+_0x4d1e92,_0x245aae);WhatsappInteractionEvents['on'](_0x4d1e92,_0x5c73c8);}}; \ No newline at end of file +var _0xbd93=['./whatsappInteraction.events','update','emit','removeListener','length'];(function(_0x1144ab,_0x386ae2){var _0xae3512=function(_0xadd542){while(--_0xadd542){_0x1144ab['push'](_0x1144ab['shift']());}};_0xae3512(++_0x386ae2);}(_0xbd93,0xf0));var _0x3bd9=function(_0x8cd0ef,_0x36a0fb){_0x8cd0ef=_0x8cd0ef-0x0;var _0x41fcc2=_0xbd93[_0x8cd0ef];return _0x41fcc2;};'use strict';var WhatsappInteractionEvents=require(_0x3bd9('0x0'));var events=['save','remove',_0x3bd9('0x1')];function createListener(_0x2a099d,_0x54c145){return function(_0x40446d){_0x54c145[_0x3bd9('0x2')](_0x2a099d,_0x40446d);};}function removeListener(_0x2b9c96,_0x5f3d5c){return function(){WhatsappInteractionEvents[_0x3bd9('0x3')](_0x2b9c96,_0x5f3d5c);};}exports['register']=function(_0x3033ae){for(var _0x3d54ea=0x0,_0x3995fb=events[_0x3bd9('0x4')];_0x3d54ea<_0x3995fb;_0x3d54ea++){var _0x544912=events[_0x3d54ea];var _0x45e2ca=createListener('whatsappInteraction:'+_0x544912,_0x3033ae);WhatsappInteractionEvents['on'](_0x544912,_0x45e2ca);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 7dad56c..99c926e 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 _0xc993=['connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','/describe','describe','/:id','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path'];(function(_0x2bf926,_0x1048a0){var _0x38484c=function(_0x1b9403){while(--_0x1b9403){_0x2bf926['push'](_0x2bf926['shift']());}};_0x38484c(++_0x1048a0);}(_0xc993,0x1c0));var _0x3c99=function(_0x517032,_0x317ad8){_0x517032=_0x517032-0x0;var _0x2ce5b5=_0xc993[_0x517032];return _0x2ce5b5;};'use strict';var multer=require(_0x3c99('0x0'));var util=require('util');var path=require(_0x3c99('0x1'));var timeout=require(_0x3c99('0x2'));var express=require(_0x3c99('0x3'));var router=express['Router']();var fs_extra=require(_0x3c99('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3c99('0x5'));var controller=require('./whatsappMessage.controller');router[_0x3c99('0x6')]('/',auth[_0x3c99('0x7')](),controller['index']);router[_0x3c99('0x6')](_0x3c99('0x8'),auth['isAuthenticated'](),controller[_0x3c99('0x9')]);router[_0x3c99('0x6')](_0x3c99('0xa'),auth[_0x3c99('0x7')](),controller['show']);router[_0x3c99('0xb')]('/',auth['isAuthenticated'](),interaction[_0x3c99('0xc')](_0x3c99('0xd'),_0x3c99('0xe')),controller[_0x3c99('0xf')]);router[_0x3c99('0xb')](_0x3c99('0x10'),controller['status']);router[_0x3c99('0x11')]('/:id',auth[_0x3c99('0x7')](),controller['update']);router['put'](_0x3c99('0x12'),auth['isAuthenticated'](),controller[_0x3c99('0x13')]);router[_0x3c99('0x11')](_0x3c99('0x14'),auth[_0x3c99('0x7')](),controller[_0x3c99('0x15')]);router[_0x3c99('0x16')]('/:id',auth[_0x3c99('0x7')](),controller[_0x3c99('0x17')]);module[_0x3c99('0x18')]=router; \ No newline at end of file +var _0xc6ce=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','show','post','tracked','whatsapp','whatsappmessage:create','create','put','accept','/:id/reject','reject','destroy','exports','multer','util','path','express'];(function(_0x582244,_0x4d7036){var _0x38e72=function(_0x1928aa){while(--_0x1928aa){_0x582244['push'](_0x582244['shift']());}};_0x38e72(++_0x4d7036);}(_0xc6ce,0x1a5));var _0xec6c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc6ce[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xec6c('0x0'));var util=require(_0xec6c('0x1'));var path=require(_0xec6c('0x2'));var timeout=require('connect-timeout');var express=require(_0xec6c('0x3'));var router=express['Router']();var fs_extra=require(_0xec6c('0x4'));var auth=require(_0xec6c('0x5'));var interaction=require(_0xec6c('0x6'));var config=require(_0xec6c('0x7'));var controller=require(_0xec6c('0x8'));router[_0xec6c('0x9')]('/',auth[_0xec6c('0xa')](),controller[_0xec6c('0xb')]);router['get'](_0xec6c('0xc'),auth[_0xec6c('0xa')](),controller['describe']);router[_0xec6c('0x9')]('/:id',auth[_0xec6c('0xa')](),controller[_0xec6c('0xd')]);router[_0xec6c('0xe')]('/',auth[_0xec6c('0xa')](),interaction[_0xec6c('0xf')](_0xec6c('0x10'),_0xec6c('0x11')),controller[_0xec6c('0x12')]);router['post']('/:id/status',controller['status']);router[_0xec6c('0x13')]('/:id',auth[_0xec6c('0xa')](),controller['update']);router[_0xec6c('0x13')]('/:id/accept',auth[_0xec6c('0xa')](),controller[_0xec6c('0x14')]);router['put'](_0xec6c('0x15'),auth['isAuthenticated'](),controller[_0xec6c('0x16')]);router['delete']('/:id',auth[_0xec6c('0xa')](),controller[_0xec6c('0x17')]);module[_0xec6c('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 3872d3d..5f17d80 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 _0x5da8=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x190f92,_0x5180cc){var _0x3297f1=function(_0x73abfa){while(--_0x73abfa){_0x190f92['push'](_0x190f92['shift']());}};_0x3297f1(++_0x5180cc);}(_0x5da8,0x1b0));var _0x85da=function(_0x3da399,_0x34ee17){_0x3da399=_0x3da399-0x0;var _0x32103d=_0x5da8[_0x3da399];return _0x32103d;};'use strict';var Sequelize=require(_0x85da('0x0'));module[_0x85da('0x1')]={'body':{'type':Sequelize[_0x85da('0x2')](_0x85da('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x85da('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x85da('0x5')]('in',_0x85da('0x6')),'defaultValue':_0x85da('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x85da('0x7')](0xbe)},'phone':{'type':Sequelize[_0x85da('0x7')]},'readAt':{'type':Sequelize[_0x85da('0x8')]},'secret':{'type':Sequelize[_0x85da('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x85da('0x7')]},'providerResponse':{'type':Sequelize[_0x85da('0x2')]}}; \ No newline at end of file +var _0x7f3a=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x58f7ae,_0x239ffc){var _0x2216e7=function(_0x3b1f1f){while(--_0x3b1f1f){_0x58f7ae['push'](_0x58f7ae['shift']());}};_0x2216e7(++_0x239ffc);}(_0x7f3a,0x19f));var _0xa7f3=function(_0x20ed89,_0x476a27){_0x20ed89=_0x20ed89-0x0;var _0x21ef97=_0x7f3a[_0x20ed89];return _0x21ef97;};'use strict';var Sequelize=require(_0xa7f3('0x0'));module[_0xa7f3('0x1')]={'body':{'type':Sequelize[_0xa7f3('0x2')](_0xa7f3('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa7f3('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa7f3('0x5')),'defaultValue':_0xa7f3('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa7f3('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xa7f3('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xa7f3('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 65d1282..0ed0ce5 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 _0x24d9=['motionChannel','event','acceptmessage','whatsapp-interactions','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','agent','interface','EventManager','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','update','then','destroy','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','length','find','create','body','params','describe','accept','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','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','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel'];(function(_0x42eee6,_0x35f745){var _0x4981dd=function(_0x2326a9){while(--_0x2326a9){_0x42eee6['push'](_0x42eee6['shift']());}};_0x4981dd(++_0x35f745);}(_0x24d9,0xa8));var _0x924d=function(_0x29b1d3,_0x1f3c5a){_0x29b1d3=_0x29b1d3-0x0;var _0x3566dc=_0x24d9[_0x29b1d3];return _0x3566dc;};'use strict';var emlformat=require(_0x924d('0x0'));var rimraf=require(_0x924d('0x1'));var zipdir=require(_0x924d('0x2'));var jsonpatch=require(_0x924d('0x3'));var rp=require(_0x924d('0x4'));var moment=require(_0x924d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x924d('0x6'));var util=require(_0x924d('0x7'));var path=require(_0x924d('0x8'));var sox=require(_0x924d('0x9'));var csv=require(_0x924d('0xa'));var ejs=require(_0x924d('0xb'));var fs=require('fs');var fs_extra=require(_0x924d('0xc'));var _=require(_0x924d('0xd'));var squel=require(_0x924d('0xe'));var crypto=require(_0x924d('0xf'));var jsforce=require(_0x924d('0x10'));var deskjs=require(_0x924d('0x11'));var toCsv=require(_0x924d('0xa'));var querystring=require(_0x924d('0x12'));var Papa=require(_0x924d('0x13'));var Redis=require(_0x924d('0x14'));var authService=require(_0x924d('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x924d('0x16'));var hardwareService=require(_0x924d('0x17'));var logger=require(_0x924d('0x18'))(_0x924d('0x19'));var utils=require(_0x924d('0x1a'));var config=require(_0x924d('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x924d('0x1c'))['db'];config[_0x924d('0x1d')]=_[_0x924d('0x1e')](config['redis'],{'host':_0x924d('0x1f'),'port':0x18eb});var socket=require(_0x924d('0x20'))(new Redis(config[_0x924d('0x1d')]));require(_0x924d('0x21'))[_0x924d('0x22')](socket);var jayson=require(_0x924d('0x23'));var client=jayson[_0x924d('0x24')]['http']({'port':0x232c});var client9002=jayson[_0x924d('0x24')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a8bc1,_0x300f06,_0x1a4a5f,_0x2d8eb9){return new BPromise(function(_0x187334,_0x2354e6){var _0x3d5f16=_0x2d8eb9||client;return _0x3d5f16[_0x924d('0x25')](_0x5a8bc1,_0x1a4a5f)['then'](function(_0x52d867){logger[_0x924d('0x26')](_0x924d('0x27'),_0x300f06,_0x924d('0x28'));logger[_0x924d('0x29')](_0x924d('0x2a'),_0x300f06,_0x924d('0x28'),JSON[_0x924d('0x2b')](_0x52d867));if(_0x52d867[_0x924d('0x2c')]){if(_0x52d867[_0x924d('0x2c')][_0x924d('0x2d')]===0x1f4){logger[_0x924d('0x2c')](_0x924d('0x27'),_0x300f06,_0x52d867[_0x924d('0x2c')][_0x924d('0x2e')]);return _0x2354e6(_0x52d867[_0x924d('0x2c')][_0x924d('0x2e')]);}logger[_0x924d('0x2c')](_0x924d('0x27'),_0x300f06,_0x52d867['error'][_0x924d('0x2e')]);return _0x187334(_0x52d867[_0x924d('0x2c')][_0x924d('0x2e')]);}else{logger[_0x924d('0x26')](_0x924d('0x27'),_0x300f06,'request\x20sent');_0x187334(_0x52d867[_0x924d('0x2f')][_0x924d('0x2e')]);}})[_0x924d('0x30')](function(_0x49bb4b){logger['error'](_0x924d('0x27'),_0x300f06,_0x49bb4b);_0x2354e6(_0x49bb4b);});});}function respondWithStatusCode(_0x555f61,_0x39a084){_0x39a084=_0x39a084||0xcc;return function(_0x1e6ee8){if(_0x1e6ee8){return _0x555f61[_0x924d('0x31')](_0x39a084);}return _0x555f61[_0x924d('0x32')](_0x39a084)[_0x924d('0x33')]();};}function respondWithResult(_0x4eccb0,_0x5a04c5){_0x5a04c5=_0x5a04c5||0xc8;return function(_0x4ff444){if(_0x4ff444){return _0x4eccb0['status'](_0x5a04c5)['json'](_0x4ff444);}};}function respondWithFilteredResult(_0x460761,_0x1d80af){return function(_0x41b4a5){if(_0x41b4a5){var _0x12e6eb=typeof _0x1d80af[_0x924d('0x34')]===_0x924d('0x35')&&typeof _0x1d80af[_0x924d('0x36')]===_0x924d('0x35');var _0x34ffa3=_0x41b4a5[_0x924d('0x37')];var _0x55fac7=_0x12e6eb?0x0:_0x1d80af[_0x924d('0x34')];var _0x324685=_0x12e6eb?_0x41b4a5['count']:_0x1d80af['offset']+_0x1d80af[_0x924d('0x36')];var _0x169b38;if(_0x324685>=_0x34ffa3){_0x324685=_0x34ffa3;_0x169b38=0xc8;}else{_0x169b38=0xce;}_0x460761[_0x924d('0x32')](_0x169b38);return _0x460761[_0x924d('0x38')]('Content-Range',_0x55fac7+'-'+_0x324685+'/'+_0x34ffa3)['json'](_0x41b4a5);}return null;};}function patchUpdates(_0x47f0eb){return function(_0xf39da8){try{jsonpatch[_0x924d('0x39')](_0xf39da8,_0x47f0eb,!![]);}catch(_0x688677){return BPromise[_0x924d('0x3a')](_0x688677);}return _0xf39da8['save']();};}function saveUpdates(_0x46cf51,_0x3ac34e){return function(_0x170c08){if(_0x170c08){return _0x170c08[_0x924d('0x3b')](_0x46cf51)[_0x924d('0x3c')](function(_0x3d584c){return _0x3d584c;});}return null;};}function removeEntity(_0xc2d82b,_0x4067fd){return function(_0x2842a3){if(_0x2842a3){return _0x2842a3[_0x924d('0x3d')]()['then'](function(){_0xc2d82b['status'](0xcc)[_0x924d('0x33')]();});}};}function handleEntityNotFound(_0x311132,_0x117514){return function(_0xbc5822){if(!_0xbc5822){_0x311132[_0x924d('0x31')](0x194);}return _0xbc5822;};}function handleError(_0x196fde,_0x276901){_0x276901=_0x276901||0x1f4;return function(_0xba54b8){logger['error'](_0xba54b8['stack']);if(_0xba54b8[_0x924d('0x3e')]){delete _0xba54b8['name'];}_0x196fde[_0x924d('0x32')](_0x276901)[_0x924d('0x3f')](_0xba54b8);};}exports[_0x924d('0x40')]=function(_0x242349,_0x4bdbbf){var _0x43aca2={},_0x487633={},_0x321144={'count':0x0,'rows':[]};var _0x29aa53=_[_0x924d('0x41')](db[_0x924d('0x42')][_0x924d('0x43')],function(_0xc218a7){return{'name':_0xc218a7[_0x924d('0x44')],'type':_0xc218a7[_0x924d('0x45')][_0x924d('0x46')]};});_0x487633[_0x924d('0x47')]=_[_0x924d('0x41')](_0x29aa53,_0x924d('0x3e'));_0x487633[_0x924d('0x48')]=_[_0x924d('0x49')](_0x242349[_0x924d('0x48')]);_0x487633['filters']=_['intersection'](_0x487633['model'],_0x487633[_0x924d('0x48')]);_0x43aca2[_0x924d('0x4a')]=_[_0x924d('0x4b')](_0x487633[_0x924d('0x47')],qs[_0x924d('0x4c')](_0x242349[_0x924d('0x48')][_0x924d('0x4c')]));_0x43aca2[_0x924d('0x4a')]=_0x43aca2[_0x924d('0x4a')]['length']?_0x43aca2['attributes']:_0x487633[_0x924d('0x47')];if(!_0x242349['query'][_0x924d('0x4d')](_0x924d('0x4e'))){_0x43aca2[_0x924d('0x36')]=qs[_0x924d('0x36')](_0x242349[_0x924d('0x48')][_0x924d('0x36')]);_0x43aca2[_0x924d('0x34')]=qs['offset'](_0x242349[_0x924d('0x48')][_0x924d('0x34')]);}_0x43aca2[_0x924d('0x4f')]=qs[_0x924d('0x50')](_0x242349[_0x924d('0x48')][_0x924d('0x50')]);_0x43aca2['where']=qs[_0x924d('0x51')](_[_0x924d('0x52')](_0x242349[_0x924d('0x48')],_0x487633[_0x924d('0x51')]),_0x29aa53);if(_0x242349[_0x924d('0x48')][_0x924d('0x53')]){_0x43aca2[_0x924d('0x54')]=_[_0x924d('0x55')](_0x43aca2['where'],{'$or':_[_0x924d('0x41')](_0x29aa53,function(_0x29ace9){if(_0x29ace9[_0x924d('0x45')]!==_0x924d('0x56')){var _0x4dd9fd={};_0x4dd9fd[_0x29ace9['name']]={'$like':'%'+_0x242349[_0x924d('0x48')][_0x924d('0x53')]+'%'};return _0x4dd9fd;}})});}_0x43aca2=_['merge']({},_0x43aca2,_0x242349[_0x924d('0x57')]);var _0x227c44={'where':_0x43aca2[_0x924d('0x54')]};return db['WhatsappMessage'][_0x924d('0x37')](_0x227c44)[_0x924d('0x3c')](function(_0x580228){_0x321144['count']=_0x580228;if(_0x242349[_0x924d('0x48')][_0x924d('0x58')]){_0x43aca2[_0x924d('0x59')]=[{'all':!![]}];}return db[_0x924d('0x42')][_0x924d('0x5a')](_0x43aca2);})[_0x924d('0x3c')](function(_0x5cc145){_0x321144[_0x924d('0x5b')]=_0x5cc145;return _0x321144;})['then'](respondWithFilteredResult(_0x4bdbbf,_0x43aca2))[_0x924d('0x30')](handleError(_0x4bdbbf,null));};exports[_0x924d('0x5c')]=function(_0x290e07,_0x336cc6){var _0x3559ce={'raw':!![],'where':{'id':_0x290e07['params']['id']}},_0x376540={};_0x376540[_0x924d('0x47')]=_[_0x924d('0x49')](db[_0x924d('0x42')]['rawAttributes']);_0x376540['query']=_[_0x924d('0x49')](_0x290e07[_0x924d('0x48')]);_0x376540[_0x924d('0x51')]=_[_0x924d('0x4b')](_0x376540[_0x924d('0x47')],_0x376540[_0x924d('0x48')]);_0x3559ce['attributes']=_[_0x924d('0x4b')](_0x376540[_0x924d('0x47')],qs[_0x924d('0x4c')](_0x290e07[_0x924d('0x48')][_0x924d('0x4c')]));_0x3559ce[_0x924d('0x4a')]=_0x3559ce[_0x924d('0x4a')][_0x924d('0x5d')]?_0x3559ce[_0x924d('0x4a')]:_0x376540[_0x924d('0x47')];if(_0x290e07[_0x924d('0x48')][_0x924d('0x58')]){_0x3559ce[_0x924d('0x59')]=[{'all':!![]}];}_0x3559ce=_[_0x924d('0x55')]({},_0x3559ce,_0x290e07[_0x924d('0x57')]);return db[_0x924d('0x42')][_0x924d('0x5e')](_0x3559ce)['then'](handleEntityNotFound(_0x336cc6,null))[_0x924d('0x3c')](respondWithResult(_0x336cc6,null))[_0x924d('0x30')](handleError(_0x336cc6,null));};exports[_0x924d('0x5f')]=function(_0x38e242,_0x5a41a1){return db['WhatsappMessage'][_0x924d('0x5f')](_0x38e242[_0x924d('0x60')],{})['then'](respondWithResult(_0x5a41a1,0xc9))[_0x924d('0x30')](handleError(_0x5a41a1,null));};exports[_0x924d('0x3b')]=function(_0x188923,_0x183d26){if(_0x188923[_0x924d('0x60')]['id']){delete _0x188923['body']['id'];}return db[_0x924d('0x42')][_0x924d('0x5e')]({'where':{'id':_0x188923[_0x924d('0x61')]['id']}})['then'](handleEntityNotFound(_0x183d26,null))[_0x924d('0x3c')](saveUpdates(_0x188923[_0x924d('0x60')],null))[_0x924d('0x3c')](respondWithResult(_0x183d26,null))['catch'](handleError(_0x183d26,null));};exports[_0x924d('0x3d')]=function(_0x35f83a,_0x3df68d){return db[_0x924d('0x42')][_0x924d('0x5e')]({'where':{'id':_0x35f83a[_0x924d('0x61')]['id']}})['then'](handleEntityNotFound(_0x3df68d,null))[_0x924d('0x3c')](removeEntity(_0x3df68d,null))[_0x924d('0x30')](handleError(_0x3df68d,null));};exports[_0x924d('0x62')]=function(_0x3d59be,_0x156ff6){return db[_0x924d('0x42')][_0x924d('0x62')]()[_0x924d('0x3c')](respondWithResult(_0x156ff6,null))[_0x924d('0x30')](handleError(_0x156ff6,null));};var interaction_log=require(_0x924d('0x18'))('whatsapp-interactions');exports[_0x924d('0x63')]=function(_0x24d46b,_0x1a79ed,_0x228f43){var _0x4af00f={'agent':{},'channel':_0x924d('0x64')};if(_0x24d46b[_0x924d('0x60')]['id']){delete _0x24d46b['body']['id'];}_0x24d46b['body'][_0x924d('0x65')]=!![];_0x24d46b['body']['readAt']=moment()[_0x924d('0x66')](_0x924d('0x67'));_0x24d46b['body'][_0x924d('0x68')]=_0x24d46b[_0x924d('0x60')][_0x924d('0x68')]||_0x24d46b[_0x924d('0x69')]['id'];_0x4af00f['agent']['id']=_0x24d46b['body'][_0x924d('0x68')];return db[_0x924d('0x42')]['find']({'where':{'id':_0x24d46b[_0x924d('0x61')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1a79ed,null))[_0x924d('0x3c')](saveUpdates(_0x24d46b[_0x924d('0x60')],null))[_0x924d('0x3c')](function(_0x5e6fa9){if(_0x5e6fa9){_0x4af00f['message']=_0x5e6fa9[_0x924d('0x6a')]({'plain':!![]});return db[_0x924d('0x6b')]['find']({'where':{'id':_0x5e6fa9[_0x924d('0x6c')]}});}return null;})[_0x924d('0x3c')](handleEntityNotFound(_0x1a79ed,null))[_0x924d('0x3c')](function(_0x40e1e9){if(_0x40e1e9){return _0x40e1e9[_0x924d('0x3b')]({'UserId':_0x24d46b['body'][_0x924d('0x68')],'read1stAt':_[_0x924d('0x6d')](_0x40e1e9[_0x924d('0x6e')])?moment()[_0x924d('0x66')](_0x924d('0x67')):undefined});}return null;})[_0x924d('0x3c')](function(_0x27cbb8){if(_0x27cbb8){_0x4af00f[_0x924d('0x6f')]=_0x27cbb8[_0x924d('0x6a')]({'plain':!![]});interaction_log[_0x924d('0x26')](_0x924d('0x70'),_0x24d46b[_0x924d('0x69')]['id'],_0x24d46b[_0x924d('0x69')]['name'],_0x24d46b[_0x924d('0x69')][_0x924d('0x71')],_0x4af00f[_0x924d('0x6f')]['id'],_0x24d46b[_0x924d('0x60')]?JSON[_0x924d('0x2b')](_0x24d46b[_0x924d('0x60')]):_0x924d('0x72'));return respondWithRpcPromise(_0x924d('0x73'),_0x924d('0x74'),_0x4af00f);}return null;})[_0x924d('0x3c')](function(_0x4be7dd){var _0x5e84a8=_0x924d('0x75')+_0x4be7dd['message']['ContactId'];return db[_0x924d('0x76')][_0x924d('0x48')](_0x5e84a8,{'type':db[_0x924d('0x77')][_0x924d('0x78')][_0x924d('0x79')],'raw':!![]})[_0x924d('0x3c')](function(_0x2e93c5){return _0x2e93c5;});})[_0x924d('0x3c')](function(_0xb3d1a0){if(_0xb3d1a0){_0x4af00f['message'][_0x924d('0x7a')]=_0xb3d1a0[0x0];if(!_0x24d46b[_0x924d('0x60')][_0x924d('0x68')])return;return db[_0x924d('0x7b')][_0x924d('0x5e')]({'where':{'id':_0x24d46b[_0x924d('0x60')][_0x924d('0x68')],'role':'agent'},'attributes':['id','name',_0x924d('0x7c'),_0x924d('0x7d'),_0x924d('0x7e')],'raw':!![]});}return null;})[_0x924d('0x3c')](function(_0x55fd13){if(!_0x55fd13)return null;_0x4af00f['message']['agent']=_0x55fd13;return _0x4af00f;})[_0x924d('0x3c')](function(_0x356e16){if(_0x356e16){if(_0x24d46b[_0x924d('0x60')][_0x924d('0x7f')]){_0x4af00f[_0x924d('0x2e')]['interface']=util['format'](_0x924d('0x80'),_0x24d46b[_0x924d('0x69')][_0x924d('0x3e')]);_0x4af00f[_0x924d('0x2e')][_0x924d('0x81')]=_0x4af00f[_0x924d('0x81')];_0x4af00f['message'][_0x924d('0x82')]=_0x4af00f['channel'];_0x4af00f['message'][_0x924d('0x83')]=_0x924d('0x63');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x924d('0x84'),'message':_0x4af00f['message']},client9002)[_0x924d('0x3c')](function(){return _0x4af00f;});}return _0x4af00f;}return null;})[_0x924d('0x3c')](respondWithResult(_0x1a79ed,null))[_0x924d('0x30')](handleError(_0x1a79ed,null));};var interaction_log=require(_0x924d('0x18'))(_0x924d('0x85'));exports['reject']=function(_0x58cfb1,_0x4a8fac,_0x233ad8){var _0x3d35f7={'agent':{},'channel':'whatsapp'};if(_0x58cfb1[_0x924d('0x60')]['id']){delete _0x58cfb1[_0x924d('0x60')]['id'];}_0x58cfb1[_0x924d('0x60')]['UserId']=_0x58cfb1['body'][_0x924d('0x68')]||_0x58cfb1[_0x924d('0x69')]['id'];_0x3d35f7['agent']['id']=_0x58cfb1['body'][_0x924d('0x68')];return db[_0x924d('0x42')]['find']({'where':{'id':_0x58cfb1['params']['id'],'UserId':null}})[_0x924d('0x3c')](handleEntityNotFound(_0x4a8fac,null))[_0x924d('0x3c')](function(_0x3fe958){if(_0x3fe958){_0x3d35f7[_0x924d('0x2e')]=_0x3fe958[_0x924d('0x6a')]({'plain':!![]});return db['WhatsappInteraction'][_0x924d('0x5e')]({'where':{'id':_0x3fe958[_0x924d('0x6c')]}});}return null;})['then'](handleEntityNotFound(_0x4a8fac,null))[_0x924d('0x3c')](function(_0x3790ce){if(_0x3790ce){_0x3d35f7['interaction']=_0x3790ce[_0x924d('0x6a')]({'plain':!![]});interaction_log[_0x924d('0x26')](_0x924d('0x86'),_0x58cfb1[_0x924d('0x69')]['id'],_0x58cfb1[_0x924d('0x69')]['name'],_0x58cfb1[_0x924d('0x69')][_0x924d('0x71')],_0x3d35f7['interaction']['id'],_0x58cfb1[_0x924d('0x60')]?JSON['stringify'](_0x58cfb1['body']):_0x924d('0x72'));return respondWithRpcPromise(_0x924d('0x87'),_0x924d('0x88'),_0x3d35f7);}return null;})['then'](function(_0x35a294){var _0xa40b2c=_0x924d('0x75')+_0x35a294[_0x924d('0x2e')][_0x924d('0x89')];return db[_0x924d('0x76')][_0x924d('0x48')](_0xa40b2c,{'type':db[_0x924d('0x77')][_0x924d('0x78')]['SELECT'],'raw':!![]})['then'](function(_0x1129af){return _0x1129af;});})[_0x924d('0x3c')](function(_0x4bc849){if(_0x4bc849){_0x3d35f7[_0x924d('0x2e')][_0x924d('0x7a')]=_0x4bc849[0x0];if(!_0x58cfb1[_0x924d('0x60')][_0x924d('0x68')])return;return db[_0x924d('0x7b')][_0x924d('0x5e')]({'where':{'id':_0x58cfb1[_0x924d('0x60')][_0x924d('0x68')],'role':'agent'},'attributes':['id',_0x924d('0x3e'),_0x924d('0x7c'),_0x924d('0x7d'),_0x924d('0x7e')],'raw':!![]});}return null;})[_0x924d('0x3c')](function(_0x5189ef){if(!_0x5189ef)return null;_0x3d35f7[_0x924d('0x2e')][_0x924d('0x8a')]=_0x5189ef;return _0x3d35f7;})['then'](function(_0x3c2080){if(_0x3c2080){_0x3c2080[_0x924d('0x2e')][_0x924d('0x8b')]=util[_0x924d('0x66')](_0x924d('0x80'),_0x58cfb1[_0x924d('0x69')]['name']);_0x3c2080[_0x924d('0x2e')][_0x924d('0x81')]=_0x3d35f7[_0x924d('0x81')];_0x3c2080['message'][_0x924d('0x82')]=_0x3d35f7[_0x924d('0x81')];_0x3c2080[_0x924d('0x2e')][_0x924d('0x83')]=_0x924d('0x3a');respondWithRpcPromise('EventManager',_0x924d('0x8c'),{'event':_0x924d('0x8d'),'message':_0x3c2080[_0x924d('0x2e')]},client9002);return _0x3d35f7;}return null;})[_0x924d('0x3c')](respondWithResult(_0x4a8fac,null))[_0x924d('0x30')](handleError(_0x4a8fac,null));};exports[_0x924d('0x32')]=function(_0x50fe17,_0x67860e,_0x463a99){if(_0x50fe17[_0x924d('0x60')]['id']){delete _0x50fe17[_0x924d('0x60')]['id'];}var _0x2834ae;return db[_0x924d('0x42')][_0x924d('0x5e')]({'where':{'id':_0x50fe17['params']['id']}})[_0x924d('0x3c')](handleEntityNotFound(_0x67860e,null))[_0x924d('0x3c')](function(_0x985906){if(_0x985906){_0x2834ae=_0x985906;return db[_0x924d('0x8e')][_0x924d('0x5e')]({'where':{'id':_0x985906[_0x924d('0x8f')]}});}})['then'](handleEntityNotFound(_0x67860e,null))[_0x924d('0x3c')](function(_0x1074c5){if(_0x1074c5){logger[_0x924d('0x29')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x924d('0x32'),_0x924d('0x90'),_0x1074c5[_0x924d('0x45')],util[_0x924d('0x91')](_0x50fe17[_0x924d('0x60')],{'showHidden':![],'depth':null}));switch(_0x1074c5['type']){case _0x924d('0x92'):if(_0x50fe17[_0x924d('0x60')]['MessageSid']&&_0x50fe17[_0x924d('0x60')][_0x924d('0x93')]===_0x2834ae['messageId']&&_0x50fe17[_0x924d('0x60')][_0x924d('0x94')]&&_0x50fe17['body'][_0x924d('0x94')]===_0x924d('0x65')){return _0x2834ae[_0x924d('0x3b')]({'read':!![]});}else{logger[_0x924d('0x2c')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x924d('0x32'),_0x924d('0x92'),util[_0x924d('0x91')](_0x50fe17['body'],{'showHidden':![],'depth':null}));}break;}return _0x2834ae;}})['then'](respondWithResult(_0x67860e,null))[_0x924d('0x30')](handleError(_0x67860e,null));}; \ No newline at end of file +var _0x2d02=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','find','describe','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','sequelize','Sequelize','contact','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SELECT','User','email','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x2d02,0x92));var _0x22d0=function(_0x458fc0,_0x3e7a67){_0x458fc0=_0x458fc0-0x0;var _0x3cc021=_0x2d02[_0x458fc0];return _0x3cc021;};'use strict';var emlformat=require(_0x22d0('0x0'));var rimraf=require(_0x22d0('0x1'));var zipdir=require(_0x22d0('0x2'));var jsonpatch=require(_0x22d0('0x3'));var rp=require(_0x22d0('0x4'));var moment=require(_0x22d0('0x5'));var BPromise=require(_0x22d0('0x6'));var Mustache=require(_0x22d0('0x7'));var util=require(_0x22d0('0x8'));var path=require(_0x22d0('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x22d0('0xa'));var fs=require('fs');var fs_extra=require(_0x22d0('0xb'));var _=require(_0x22d0('0xc'));var squel=require(_0x22d0('0xd'));var crypto=require(_0x22d0('0xe'));var jsforce=require(_0x22d0('0xf'));var deskjs=require(_0x22d0('0x10'));var toCsv=require(_0x22d0('0x11'));var querystring=require('querystring');var Papa=require(_0x22d0('0x12'));var Redis=require(_0x22d0('0x13'));var authService=require(_0x22d0('0x14'));var qs=require(_0x22d0('0x15'));var as=require(_0x22d0('0x16'));var hardwareService=require(_0x22d0('0x17'));var logger=require(_0x22d0('0x18'))(_0x22d0('0x19'));var utils=require(_0x22d0('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x22d0('0x1b'));var db=require(_0x22d0('0x1c'))['db'];config[_0x22d0('0x1d')]=_[_0x22d0('0x1e')](config['redis'],{'host':_0x22d0('0x1f'),'port':0x18eb});var socket=require(_0x22d0('0x20'))(new Redis(config['redis']));require(_0x22d0('0x21'))['register'](socket);var jayson=require(_0x22d0('0x22'));var client=jayson[_0x22d0('0x23')]['http']({'port':0x232c});var client9002=jayson[_0x22d0('0x23')][_0x22d0('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x31b8d1,_0x3f4826,_0x5b2b06,_0x48290a){return new BPromise(function(_0x11ec21,_0x173755){var _0x5aea3a=_0x48290a||client;return _0x5aea3a[_0x22d0('0x25')](_0x31b8d1,_0x5b2b06)[_0x22d0('0x26')](function(_0xdf8f2){logger[_0x22d0('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x3f4826,_0x22d0('0x28'));logger[_0x22d0('0x29')](_0x22d0('0x2a'),_0x3f4826,'request\x20sent',JSON[_0x22d0('0x2b')](_0xdf8f2));if(_0xdf8f2[_0x22d0('0x2c')]){if(_0xdf8f2[_0x22d0('0x2c')][_0x22d0('0x2d')]===0x1f4){logger[_0x22d0('0x2c')](_0x22d0('0x2e'),_0x3f4826,_0xdf8f2['error'][_0x22d0('0x2f')]);return _0x173755(_0xdf8f2[_0x22d0('0x2c')][_0x22d0('0x2f')]);}logger[_0x22d0('0x2c')](_0x22d0('0x2e'),_0x3f4826,_0xdf8f2[_0x22d0('0x2c')][_0x22d0('0x2f')]);return _0x11ec21(_0xdf8f2[_0x22d0('0x2c')][_0x22d0('0x2f')]);}else{logger[_0x22d0('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x3f4826,_0x22d0('0x28'));_0x11ec21(_0xdf8f2[_0x22d0('0x30')][_0x22d0('0x2f')]);}})[_0x22d0('0x31')](function(_0x4987ec){logger['error'](_0x22d0('0x2e'),_0x3f4826,_0x4987ec);_0x173755(_0x4987ec);});});}function respondWithStatusCode(_0x1c3163,_0x1a7f0e){_0x1a7f0e=_0x1a7f0e||0xcc;return function(_0x48615a){if(_0x48615a){return _0x1c3163[_0x22d0('0x32')](_0x1a7f0e);}return _0x1c3163[_0x22d0('0x33')](_0x1a7f0e)[_0x22d0('0x34')]();};}function respondWithResult(_0x2205af,_0x244307){_0x244307=_0x244307||0xc8;return function(_0x197557){if(_0x197557){return _0x2205af[_0x22d0('0x33')](_0x244307)[_0x22d0('0x35')](_0x197557);}};}function respondWithFilteredResult(_0x504485,_0x4a93d3){return function(_0x5b6e95){if(_0x5b6e95){var _0x57cce3=typeof _0x4a93d3[_0x22d0('0x36')]===_0x22d0('0x37')&&typeof _0x4a93d3['limit']===_0x22d0('0x37');var _0x8474=_0x5b6e95[_0x22d0('0x38')];var _0x3cf7bf=_0x57cce3?0x0:_0x4a93d3[_0x22d0('0x36')];var _0x5039f3=_0x57cce3?_0x5b6e95[_0x22d0('0x38')]:_0x4a93d3['offset']+_0x4a93d3['limit'];var _0x4954b0;if(_0x5039f3>=_0x8474){_0x5039f3=_0x8474;_0x4954b0=0xc8;}else{_0x4954b0=0xce;}_0x504485['status'](_0x4954b0);return _0x504485['set'](_0x22d0('0x39'),_0x3cf7bf+'-'+_0x5039f3+'/'+_0x8474)[_0x22d0('0x35')](_0x5b6e95);}return null;};}function patchUpdates(_0x12b5ac){return function(_0x369796){try{jsonpatch[_0x22d0('0x3a')](_0x369796,_0x12b5ac,!![]);}catch(_0x2e57ec){return BPromise[_0x22d0('0x3b')](_0x2e57ec);}return _0x369796[_0x22d0('0x3c')]();};}function saveUpdates(_0x4bd286,_0x1c1546){return function(_0x4bedfa){if(_0x4bedfa){return _0x4bedfa[_0x22d0('0x3d')](_0x4bd286)[_0x22d0('0x26')](function(_0xe1614a){return _0xe1614a;});}return null;};}function removeEntity(_0x2077d9,_0x1b7394){return function(_0xe34fd3){if(_0xe34fd3){return _0xe34fd3[_0x22d0('0x3e')]()[_0x22d0('0x26')](function(){_0x2077d9['status'](0xcc)[_0x22d0('0x34')]();});}};}function handleEntityNotFound(_0x3fdfa7,_0x4e732f){return function(_0x5210bb){if(!_0x5210bb){_0x3fdfa7['sendStatus'](0x194);}return _0x5210bb;};}function handleError(_0x1d9829,_0x34dfbf){_0x34dfbf=_0x34dfbf||0x1f4;return function(_0x926eda){logger['error'](_0x926eda[_0x22d0('0x3f')]);if(_0x926eda[_0x22d0('0x40')]){delete _0x926eda['name'];}_0x1d9829[_0x22d0('0x33')](_0x34dfbf)[_0x22d0('0x41')](_0x926eda);};}exports[_0x22d0('0x42')]=function(_0x223338,_0x402898){var _0x5bc80e={},_0x15f926={},_0x3108c6={'count':0x0,'rows':[]};var _0x5d79b3=_[_0x22d0('0x43')](db[_0x22d0('0x44')][_0x22d0('0x45')],function(_0x23a645){return{'name':_0x23a645['fieldName'],'type':_0x23a645[_0x22d0('0x46')][_0x22d0('0x47')]};});_0x15f926['model']=_[_0x22d0('0x43')](_0x5d79b3,_0x22d0('0x40'));_0x15f926[_0x22d0('0x48')]=_[_0x22d0('0x49')](_0x223338[_0x22d0('0x48')]);_0x15f926[_0x22d0('0x4a')]=_[_0x22d0('0x4b')](_0x15f926[_0x22d0('0x4c')],_0x15f926['query']);_0x5bc80e[_0x22d0('0x4d')]=_[_0x22d0('0x4b')](_0x15f926[_0x22d0('0x4c')],qs[_0x22d0('0x4e')](_0x223338['query'][_0x22d0('0x4e')]));_0x5bc80e[_0x22d0('0x4d')]=_0x5bc80e[_0x22d0('0x4d')][_0x22d0('0x4f')]?_0x5bc80e['attributes']:_0x15f926[_0x22d0('0x4c')];if(!_0x223338['query']['hasOwnProperty']('nolimit')){_0x5bc80e['limit']=qs['limit'](_0x223338['query'][_0x22d0('0x50')]);_0x5bc80e[_0x22d0('0x36')]=qs['offset'](_0x223338[_0x22d0('0x48')][_0x22d0('0x36')]);}_0x5bc80e[_0x22d0('0x51')]=qs[_0x22d0('0x52')](_0x223338[_0x22d0('0x48')][_0x22d0('0x52')]);_0x5bc80e[_0x22d0('0x53')]=qs['filters'](_[_0x22d0('0x54')](_0x223338[_0x22d0('0x48')],_0x15f926[_0x22d0('0x4a')]),_0x5d79b3);if(_0x223338[_0x22d0('0x48')][_0x22d0('0x55')]){_0x5bc80e[_0x22d0('0x53')]=_[_0x22d0('0x56')](_0x5bc80e[_0x22d0('0x53')],{'$or':_['map'](_0x5d79b3,function(_0x25aa76){if(_0x25aa76[_0x22d0('0x46')]!==_0x22d0('0x57')){var _0x2a6fcc={};_0x2a6fcc[_0x25aa76[_0x22d0('0x40')]]={'$like':'%'+_0x223338[_0x22d0('0x48')][_0x22d0('0x55')]+'%'};return _0x2a6fcc;}})});}_0x5bc80e=_[_0x22d0('0x56')]({},_0x5bc80e,_0x223338[_0x22d0('0x58')]);var _0x38ba71={'where':_0x5bc80e[_0x22d0('0x53')]};return db[_0x22d0('0x44')][_0x22d0('0x38')](_0x38ba71)[_0x22d0('0x26')](function(_0x176192){_0x3108c6['count']=_0x176192;if(_0x223338[_0x22d0('0x48')][_0x22d0('0x59')]){_0x5bc80e[_0x22d0('0x5a')]=[{'all':!![]}];}return db[_0x22d0('0x44')][_0x22d0('0x5b')](_0x5bc80e);})[_0x22d0('0x26')](function(_0x2fae89){_0x3108c6[_0x22d0('0x5c')]=_0x2fae89;return _0x3108c6;})[_0x22d0('0x26')](respondWithFilteredResult(_0x402898,_0x5bc80e))[_0x22d0('0x31')](handleError(_0x402898,null));};exports[_0x22d0('0x5d')]=function(_0x4b54fe,_0xebaaea){var _0x9eb21a={'raw':!![],'where':{'id':_0x4b54fe[_0x22d0('0x5e')]['id']}},_0x3e7b87={};_0x3e7b87[_0x22d0('0x4c')]=_['keys'](db[_0x22d0('0x44')][_0x22d0('0x45')]);_0x3e7b87[_0x22d0('0x48')]=_['keys'](_0x4b54fe['query']);_0x3e7b87[_0x22d0('0x4a')]=_[_0x22d0('0x4b')](_0x3e7b87[_0x22d0('0x4c')],_0x3e7b87[_0x22d0('0x48')]);_0x9eb21a[_0x22d0('0x4d')]=_[_0x22d0('0x4b')](_0x3e7b87[_0x22d0('0x4c')],qs['fields'](_0x4b54fe[_0x22d0('0x48')][_0x22d0('0x4e')]));_0x9eb21a[_0x22d0('0x4d')]=_0x9eb21a[_0x22d0('0x4d')]['length']?_0x9eb21a['attributes']:_0x3e7b87[_0x22d0('0x4c')];if(_0x4b54fe['query'][_0x22d0('0x59')]){_0x9eb21a[_0x22d0('0x5a')]=[{'all':!![]}];}_0x9eb21a=_[_0x22d0('0x56')]({},_0x9eb21a,_0x4b54fe[_0x22d0('0x58')]);return db[_0x22d0('0x44')]['find'](_0x9eb21a)[_0x22d0('0x26')](handleEntityNotFound(_0xebaaea,null))[_0x22d0('0x26')](respondWithResult(_0xebaaea,null))[_0x22d0('0x31')](handleError(_0xebaaea,null));};exports[_0x22d0('0x5f')]=function(_0x3d39be,_0x5a34e9){return db[_0x22d0('0x44')]['create'](_0x3d39be[_0x22d0('0x60')],{})['then'](respondWithResult(_0x5a34e9,0xc9))[_0x22d0('0x31')](handleError(_0x5a34e9,null));};exports['update']=function(_0x32d2f9,_0x3597a5){if(_0x32d2f9[_0x22d0('0x60')]['id']){delete _0x32d2f9['body']['id'];}return db['WhatsappMessage'][_0x22d0('0x61')]({'where':{'id':_0x32d2f9[_0x22d0('0x5e')]['id']}})[_0x22d0('0x26')](handleEntityNotFound(_0x3597a5,null))[_0x22d0('0x26')](saveUpdates(_0x32d2f9[_0x22d0('0x60')],null))[_0x22d0('0x26')](respondWithResult(_0x3597a5,null))[_0x22d0('0x31')](handleError(_0x3597a5,null));};exports[_0x22d0('0x3e')]=function(_0x44b6b4,_0x533132){return db[_0x22d0('0x44')]['find']({'where':{'id':_0x44b6b4[_0x22d0('0x5e')]['id']}})['then'](handleEntityNotFound(_0x533132,null))[_0x22d0('0x26')](removeEntity(_0x533132,null))[_0x22d0('0x31')](handleError(_0x533132,null));};exports['describe']=function(_0x4644c3,_0x1e6c41){return db[_0x22d0('0x44')][_0x22d0('0x62')]()[_0x22d0('0x26')](respondWithResult(_0x1e6c41,null))[_0x22d0('0x31')](handleError(_0x1e6c41,null));};var interaction_log=require(_0x22d0('0x18'))('whatsapp-interactions');exports[_0x22d0('0x63')]=function(_0x10e892,_0x38046b,_0x40c051){var _0x3b50ab={'agent':{},'channel':_0x22d0('0x64')};if(_0x10e892[_0x22d0('0x60')]['id']){delete _0x10e892[_0x22d0('0x60')]['id'];}_0x10e892[_0x22d0('0x60')][_0x22d0('0x65')]=!![];_0x10e892[_0x22d0('0x60')][_0x22d0('0x66')]=moment()[_0x22d0('0x67')](_0x22d0('0x68'));_0x10e892[_0x22d0('0x60')][_0x22d0('0x69')]=_0x10e892[_0x22d0('0x60')][_0x22d0('0x69')]||_0x10e892[_0x22d0('0x6a')]['id'];_0x3b50ab[_0x22d0('0x6b')]['id']=_0x10e892['body']['UserId'];return db[_0x22d0('0x44')][_0x22d0('0x61')]({'where':{'id':_0x10e892[_0x22d0('0x5e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x38046b,null))[_0x22d0('0x26')](saveUpdates(_0x10e892[_0x22d0('0x60')],null))[_0x22d0('0x26')](function(_0x278525){if(_0x278525){_0x3b50ab[_0x22d0('0x2f')]=_0x278525[_0x22d0('0x6c')]({'plain':!![]});return db['WhatsappInteraction'][_0x22d0('0x61')]({'where':{'id':_0x278525[_0x22d0('0x6d')]}});}return null;})[_0x22d0('0x26')](handleEntityNotFound(_0x38046b,null))[_0x22d0('0x26')](function(_0x4471a6){if(_0x4471a6){return _0x4471a6[_0x22d0('0x3d')]({'UserId':_0x10e892[_0x22d0('0x60')][_0x22d0('0x69')],'read1stAt':_[_0x22d0('0x6e')](_0x4471a6[_0x22d0('0x6f')])?moment()[_0x22d0('0x67')](_0x22d0('0x68')):undefined});}return null;})[_0x22d0('0x26')](function(_0x1c9d88){if(_0x1c9d88){_0x3b50ab[_0x22d0('0x70')]=_0x1c9d88[_0x22d0('0x6c')]({'plain':!![]});interaction_log[_0x22d0('0x27')](_0x22d0('0x71'),_0x10e892['user']['id'],_0x10e892[_0x22d0('0x6a')][_0x22d0('0x40')],_0x10e892[_0x22d0('0x6a')]['role'],_0x3b50ab['interaction']['id'],_0x10e892[_0x22d0('0x60')]?JSON[_0x22d0('0x2b')](_0x10e892[_0x22d0('0x60')]):_0x22d0('0x72'));return respondWithRpcPromise(_0x22d0('0x73'),_0x22d0('0x74'),_0x3b50ab);}return null;})[_0x22d0('0x26')](function(_0x2f59f7){var _0x1ce3c3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2f59f7['message']['ContactId'];return db[_0x22d0('0x75')]['query'](_0x1ce3c3,{'type':db[_0x22d0('0x76')]['QueryTypes']['SELECT'],'raw':!![]})[_0x22d0('0x26')](function(_0x27cf41){return _0x27cf41;});})[_0x22d0('0x26')](function(_0x30ca3d){if(_0x30ca3d){_0x3b50ab[_0x22d0('0x2f')][_0x22d0('0x77')]=_0x30ca3d[0x0];if(!_0x10e892[_0x22d0('0x60')][_0x22d0('0x69')])return;return db['User'][_0x22d0('0x61')]({'where':{'id':_0x10e892['body'][_0x22d0('0x69')],'role':_0x22d0('0x6b')},'attributes':['id',_0x22d0('0x40'),_0x22d0('0x78'),'email',_0x22d0('0x79')],'raw':!![]});}return null;})[_0x22d0('0x26')](function(_0x165813){if(!_0x165813)return null;_0x3b50ab[_0x22d0('0x2f')]['agent']=_0x165813;return _0x3b50ab;})[_0x22d0('0x26')](function(_0x51fe46){if(_0x51fe46){if(_0x10e892[_0x22d0('0x60')][_0x22d0('0x7a')]){_0x3b50ab[_0x22d0('0x2f')][_0x22d0('0x7b')]=util[_0x22d0('0x67')](_0x22d0('0x7c'),_0x10e892[_0x22d0('0x6a')][_0x22d0('0x40')]);_0x3b50ab[_0x22d0('0x2f')][_0x22d0('0x7d')]=_0x3b50ab[_0x22d0('0x7d')];_0x3b50ab[_0x22d0('0x2f')][_0x22d0('0x7e')]=_0x3b50ab[_0x22d0('0x7d')];_0x3b50ab['message'][_0x22d0('0x7f')]=_0x22d0('0x63');return respondWithRpcPromise(_0x22d0('0x80'),'EventManager',{'event':'acceptmessage','message':_0x3b50ab[_0x22d0('0x2f')]},client9002)[_0x22d0('0x26')](function(){return _0x3b50ab;});}return _0x3b50ab;}return null;})[_0x22d0('0x26')](respondWithResult(_0x38046b,null))[_0x22d0('0x31')](handleError(_0x38046b,null));};var interaction_log=require(_0x22d0('0x18'))('whatsapp-interactions');exports[_0x22d0('0x3b')]=function(_0x5abf9a,_0x38212,_0x573469){var _0x1628f9={'agent':{},'channel':_0x22d0('0x64')};if(_0x5abf9a['body']['id']){delete _0x5abf9a[_0x22d0('0x60')]['id'];}_0x5abf9a[_0x22d0('0x60')][_0x22d0('0x69')]=_0x5abf9a[_0x22d0('0x60')]['UserId']||_0x5abf9a[_0x22d0('0x6a')]['id'];_0x1628f9[_0x22d0('0x6b')]['id']=_0x5abf9a[_0x22d0('0x60')][_0x22d0('0x69')];return db[_0x22d0('0x44')][_0x22d0('0x61')]({'where':{'id':_0x5abf9a['params']['id'],'UserId':null}})[_0x22d0('0x26')](handleEntityNotFound(_0x38212,null))[_0x22d0('0x26')](function(_0x7ac125){if(_0x7ac125){_0x1628f9[_0x22d0('0x2f')]=_0x7ac125[_0x22d0('0x6c')]({'plain':!![]});return db[_0x22d0('0x81')][_0x22d0('0x61')]({'where':{'id':_0x7ac125[_0x22d0('0x6d')]}});}return null;})['then'](handleEntityNotFound(_0x38212,null))[_0x22d0('0x26')](function(_0x330eac){if(_0x330eac){_0x1628f9[_0x22d0('0x70')]=_0x330eac[_0x22d0('0x6c')]({'plain':!![]});interaction_log['info'](_0x22d0('0x82'),_0x5abf9a[_0x22d0('0x6a')]['id'],_0x5abf9a[_0x22d0('0x6a')]['name'],_0x5abf9a[_0x22d0('0x6a')]['role'],_0x1628f9[_0x22d0('0x70')]['id'],_0x5abf9a[_0x22d0('0x60')]?JSON[_0x22d0('0x2b')](_0x5abf9a['body']):_0x22d0('0x72'));return respondWithRpcPromise(_0x22d0('0x83'),'rejectMessage',_0x1628f9);}return null;})[_0x22d0('0x26')](function(_0x42cf24){var _0x613e05=_0x22d0('0x84')+_0x42cf24['message']['ContactId'];return db[_0x22d0('0x75')][_0x22d0('0x48')](_0x613e05,{'type':db[_0x22d0('0x76')][_0x22d0('0x85')][_0x22d0('0x86')],'raw':!![]})['then'](function(_0x3767d2){return _0x3767d2;});})[_0x22d0('0x26')](function(_0x321114){if(_0x321114){_0x1628f9[_0x22d0('0x2f')]['contact']=_0x321114[0x0];if(!_0x5abf9a[_0x22d0('0x60')]['UserId'])return;return db[_0x22d0('0x87')][_0x22d0('0x61')]({'where':{'id':_0x5abf9a[_0x22d0('0x60')][_0x22d0('0x69')],'role':'agent'},'attributes':['id',_0x22d0('0x40'),_0x22d0('0x78'),_0x22d0('0x88'),_0x22d0('0x79')],'raw':!![]});}return null;})[_0x22d0('0x26')](function(_0xf88e29){if(!_0xf88e29)return null;_0x1628f9[_0x22d0('0x2f')]['agent']=_0xf88e29;return _0x1628f9;})[_0x22d0('0x26')](function(_0x28e379){if(_0x28e379){_0x28e379['message']['interface']=util[_0x22d0('0x67')](_0x22d0('0x7c'),_0x5abf9a['user'][_0x22d0('0x40')]);_0x28e379[_0x22d0('0x2f')]['channel']=_0x1628f9[_0x22d0('0x7d')];_0x28e379[_0x22d0('0x2f')][_0x22d0('0x7e')]=_0x1628f9['channel'];_0x28e379[_0x22d0('0x2f')][_0x22d0('0x7f')]=_0x22d0('0x3b');respondWithRpcPromise(_0x22d0('0x80'),_0x22d0('0x80'),{'event':'rejectmessage','message':_0x28e379['message']},client9002);return _0x1628f9;}return null;})[_0x22d0('0x26')](respondWithResult(_0x38212,null))[_0x22d0('0x31')](handleError(_0x38212,null));};exports[_0x22d0('0x33')]=function(_0x5e4fe3,_0x587881,_0x49bbc4){if(_0x5e4fe3['body']['id']){delete _0x5e4fe3[_0x22d0('0x60')]['id'];}var _0x5a461a;return db[_0x22d0('0x44')][_0x22d0('0x61')]({'where':{'id':_0x5e4fe3[_0x22d0('0x5e')]['id']}})['then'](handleEntityNotFound(_0x587881,null))['then'](function(_0xafc4cb){if(_0xafc4cb){_0x5a461a=_0xafc4cb;return db[_0x22d0('0x89')][_0x22d0('0x61')]({'where':{'id':_0xafc4cb[_0x22d0('0x8a')]}});}})[_0x22d0('0x26')](handleEntityNotFound(_0x587881,null))[_0x22d0('0x26')](function(_0x52ccd8){if(_0x52ccd8){logger[_0x22d0('0x29')](_0x22d0('0x8b'),_0x22d0('0x33'),_0x22d0('0x8c'),_0x52ccd8['type'],util['inspect'](_0x5e4fe3[_0x22d0('0x60')],{'showHidden':![],'depth':null}));switch(_0x52ccd8[_0x22d0('0x46')]){case _0x22d0('0x8d'):if(_0x5e4fe3['body'][_0x22d0('0x8e')]&&_0x5e4fe3['body'][_0x22d0('0x8e')]===_0x5a461a[_0x22d0('0x8f')]&&_0x5e4fe3['body'][_0x22d0('0x90')]&&_0x5e4fe3[_0x22d0('0x60')]['MessageStatus']===_0x22d0('0x65')){return _0x5a461a['update']({'read':!![]});}else{logger[_0x22d0('0x2c')](_0x22d0('0x91'),_0x22d0('0x33'),_0x22d0('0x8d'),util[_0x22d0('0x92')](_0x5e4fe3[_0x22d0('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x5a461a;}})[_0x22d0('0x26')](respondWithResult(_0x587881,null))[_0x22d0('0x31')](handleError(_0x587881,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 397948e..487a5f2 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 _0xc2da=['emit','hasOwnProperty','hook','exports','events','WhatsappMessage','save','remove'];(function(_0x1d4449,_0x495153){var _0x4dcde3=function(_0x36d549){while(--_0x36d549){_0x1d4449['push'](_0x1d4449['shift']());}};_0x4dcde3(++_0x495153);}(_0xc2da,0x124));var _0xac2d=function(_0x5a56cc,_0x29650c){_0x5a56cc=_0x5a56cc-0x0;var _0x589caa=_0xc2da[_0x5a56cc];return _0x589caa;};'use strict';var EventEmitter=require(_0xac2d('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xac2d('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xac2d('0x2'),'afterUpdate':'update','afterDestroy':_0xac2d('0x3')};function emitEvent(_0xb261fc){return function(_0xff0fff,_0x332f28,_0x120263){WhatsappMessageEvents[_0xac2d('0x4')](_0xb261fc+':'+_0xff0fff['id'],_0xff0fff);WhatsappMessageEvents[_0xac2d('0x4')](_0xb261fc,_0xff0fff);_0x120263(null);};}for(var e in events){if(events[_0xac2d('0x5')](e)){var event=events[e];WhatsappMessage[_0xac2d('0x6')](e,emitEvent(event));}}module[_0xac2d('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x49f8=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x49f8,0xff));var _0x849f=function(_0x4e44d6,_0x395d6d){_0x4e44d6=_0x4e44d6-0x0;var _0x1f328c=_0x49f8[_0x4e44d6];return _0x1f328c;};'use strict';var EventEmitter=require(_0x849f('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x849f('0x1')](0x0);var events={'afterCreate':_0x849f('0x2'),'afterUpdate':'update','afterDestroy':_0x849f('0x3')};function emitEvent(_0x5bd156){return function(_0xdf19d3,_0x59d2a8,_0x4786cc){WhatsappMessageEvents['emit'](_0x5bd156+':'+_0xdf19d3['id'],_0xdf19d3);WhatsappMessageEvents[_0x849f('0x4')](_0x5bd156,_0xdf19d3);_0x4786cc(null);};}for(var e in events){if(events[_0x849f('0x5')](e)){var event=events[e];WhatsappMessage[_0x849f('0x6')](e,emitEvent(event));}}module[_0x849f('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index ea52c14..9ae1011 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 _0x0176=['twilio','accountSid','authToken','phone','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','message_id','statuses','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','find','WhatsappAccountId','type'];(function(_0x59f11c,_0x24879a){var _0x38272a=function(_0x2c692a){while(--_0x2c692a){_0x59f11c['push'](_0x59f11c['shift']());}};_0x38272a(++_0x24879a);}(_0x0176,0x163));var _0x6017=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0176[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6017('0x0'))(_0x6017('0x1'));var moment=require(_0x6017('0x2'));var BPromise=require(_0x6017('0x3'));var rp=require('request-promise');var fetch=require(_0x6017('0x4'));var fs=require('fs');var path=require(_0x6017('0x5'));var rimraf=require(_0x6017('0x6'));var config=require(_0x6017('0x7'));var attributes=require(_0x6017('0x8'));module[_0x6017('0x9')]=function(_0x514016,_0x1194ba){return _0x514016[_0x6017('0xa')](_0x6017('0xb'),attributes,{'tableName':_0x6017('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x6017('0xd')]},{'name':_0x6017('0xe'),'fields':[_0x6017('0xf')],'type':_0x6017('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3854b9,_0x6e954f,_0x31c6e){var _0x27ba26=_0x514016['models'];var _0x541fd7=_0x3854b9[_0x6017('0x11')]({'plain':!![]});if(_0x541fd7[_0x6017('0x12')][_0x6017('0x13')]()==='in'||_0x541fd7['direction'][_0x6017('0x13')]()===_0x6017('0x14')&&!_0x541fd7[_0x6017('0x15')]&&!_[_0x6017('0x16')](_0x541fd7[_0x6017('0x17')])){_0x27ba26[_0x6017('0x18')][_0x6017('0x19')]({'where':{'id':_0x541fd7[_0x6017('0x1a')]}})[_0x6017('0x1b')](function(_0x40954c){if(_0x40954c){_0x40954c[_0x6017('0x1c')]({'lastMsgAt':_0x541fd7[_0x6017('0x1d')],'lastMsgDirection':_0x541fd7['direction'][_0x6017('0x13')]()});}})[_0x6017('0x1e')](function(_0x1b50b7){console[_0x6017('0x1f')](_0x1b50b7);});}if(_0x541fd7[_0x6017('0x12')]==='out'&&!_0x541fd7[_0x6017('0x15')]){var _0x227071;_0x27ba26['WhatsappAccount'][_0x6017('0x20')]({'where':{'id':_0x541fd7[_0x6017('0x21')]},'raw':!![]})[_0x6017('0x1b')](function(_0x4ff583){_0x227071=_0x4ff583;if(_0x227071&&_0x227071[_0x6017('0x22')]){switch(_0x227071[_0x6017('0x22')]){case'twilio':var _0xa2b49e=require(_0x6017('0x23'));if(_0x227071[_0x6017('0x24')]&&_0x227071[_0x6017('0x25')]&&_0x227071[_0x6017('0x26')]){var _0x261856=new _0xa2b49e(_0x227071[_0x6017('0x24')],_0x227071[_0x6017('0x25')]);_0x261856['messages'][_0x6017('0x27')]({'body':_0x541fd7['body'],'to':_0x6017('0x28')+_0x541fd7[_0x6017('0x26')],'from':'whatsapp:'+_0x227071['phone'],'statusCallback':_0x227071[_0x6017('0x29')]+_0x6017('0x2a')+_0x541fd7['id']+_0x6017('0x2b')+_0x227071[_0x6017('0x2c')]})[_0x6017('0x1b')](function(_0x5b5fc7){if(_0x5b5fc7[_0x6017('0x2d')]){return _0x3854b9[_0x6017('0x1c')]({'messageId':_0x5b5fc7[_0x6017('0x2d')]});}})[_0x6017('0x1e')](function(_0x5b59e2){logger[_0x6017('0x1f')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x6017('0x2e'),_0x6017('0x23'),util[_0x6017('0x2f')](_0x5b59e2,{'showHidden':![],'depth':null}));});}else{logger[_0x6017('0x1f')](_0x6017('0x30'),_0x6017('0x2e'),_0x6017('0x23'),_0x6017('0x31'));}break;case _0x6017('0x32'):var _0x3d4537=_0x227071[_0x6017('0x24')];var _0x5922ff=_0x227071[_0x6017('0x25')];var _0x4d2f30=_0x227071[_0x6017('0x33')]+_0x6017('0x34')+_0x3d4537+_0x6017('0x35');var _0x3b8c92={'to':[_0x541fd7[_0x6017('0x26')]],'message':{'type':_0x6017('0x36'),'text':_0x541fd7[_0x6017('0xf')]}};var _0x531780={'method':_0x6017('0x37'),'uri':_0x4d2f30,'headers':{'Authorization':_0x6017('0x38')+_0x5922ff,'Content-Type':_0x6017('0x39')},'body':_0x3b8c92,'json':!![]};rp(_0x531780)[_0x6017('0x1b')](function(_0x58cd83){if(_0x58cd83['statuses'][0x0][_0x6017('0x3a')]){return _0x3854b9['update']({'messageId':_0x58cd83[_0x6017('0x3b')][0x0][_0x6017('0x3a')]});}})[_0x6017('0x1e')](function(_0x18ef5b){logger[_0x6017('0x3c')](_0x6017('0x3d'),_0x18ef5b);});break;}}})[_0x6017('0x3e')](function(){_0x31c6e();});}else{_0x31c6e();}}},'charset':_0x6017('0x3f'),'collate':_0x6017('0x40')});}; \ No newline at end of file +var _0xed95=['/whatsapp/v1/','/messages/','text','application/json','message_id','statuses','catch','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','FULLTEXT','get','direction','toLowerCase','out','secret','WhatsappInteraction','findOne','then','error','type','twilio','accountSid','messages','create','body','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','authToken','baseUrl'];(function(_0x34b6aa,_0x5ddd29){var _0x3ead29=function(_0x53979c){while(--_0x53979c){_0x34b6aa['push'](_0x34b6aa['shift']());}};_0x3ead29(++_0x5ddd29);}(_0xed95,0xb9));var _0x5ed9=function(_0xf5b289,_0x57a0db){_0xf5b289=_0xf5b289-0x0;var _0x5ccbc8=_0xed95[_0xf5b289];return _0x5ccbc8;};'use strict';var _=require(_0x5ed9('0x0'));var util=require(_0x5ed9('0x1'));var logger=require(_0x5ed9('0x2'))(_0x5ed9('0x3'));var moment=require(_0x5ed9('0x4'));var BPromise=require(_0x5ed9('0x5'));var rp=require(_0x5ed9('0x6'));var fetch=require(_0x5ed9('0x7'));var fs=require('fs');var path=require(_0x5ed9('0x8'));var rimraf=require(_0x5ed9('0x9'));var config=require(_0x5ed9('0xa'));var attributes=require(_0x5ed9('0xb'));module['exports']=function(_0x48efa8,_0x2612a8){return _0x48efa8[_0x5ed9('0xc')](_0x5ed9('0xd'),attributes,{'tableName':_0x5ed9('0xe'),'paranoid':![],'indexes':[{'name':_0x5ed9('0xf'),'fields':[_0x5ed9('0xf')]},{'name':'fti_whatsapp_messages','fields':['body'],'type':_0x5ed9('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xbe4c01,_0x46fc84,_0x41fc93){var _0x526924=_0x48efa8['models'];var _0x28e087=_0xbe4c01[_0x5ed9('0x11')]({'plain':!![]});if(_0x28e087[_0x5ed9('0x12')][_0x5ed9('0x13')]()==='in'||_0x28e087['direction'][_0x5ed9('0x13')]()===_0x5ed9('0x14')&&!_0x28e087[_0x5ed9('0x15')]&&!_['isNil'](_0x28e087['UserId'])){_0x526924[_0x5ed9('0x16')][_0x5ed9('0x17')]({'where':{'id':_0x28e087['WhatsappInteractionId']}})[_0x5ed9('0x18')](function(_0x34ed28){if(_0x34ed28){_0x34ed28['update']({'lastMsgAt':_0x28e087['createdAt'],'lastMsgDirection':_0x28e087[_0x5ed9('0x12')][_0x5ed9('0x13')]()});}})['catch'](function(_0x3de09e){console[_0x5ed9('0x19')](_0x3de09e);});}if(_0x28e087['direction']===_0x5ed9('0x14')&&!_0x28e087[_0x5ed9('0x15')]){var _0x54a570;_0x526924['WhatsappAccount']['find']({'where':{'id':_0x28e087['WhatsappAccountId']},'raw':!![]})[_0x5ed9('0x18')](function(_0x409a26){_0x54a570=_0x409a26;if(_0x54a570&&_0x54a570[_0x5ed9('0x1a')]){switch(_0x54a570[_0x5ed9('0x1a')]){case'twilio':var _0x120a60=require(_0x5ed9('0x1b'));if(_0x54a570['accountSid']&&_0x54a570['authToken']&&_0x54a570['phone']){var _0x302ec1=new _0x120a60(_0x54a570[_0x5ed9('0x1c')],_0x54a570['authToken']);_0x302ec1[_0x5ed9('0x1d')][_0x5ed9('0x1e')]({'body':_0x28e087[_0x5ed9('0x1f')],'to':_0x5ed9('0x20')+_0x28e087['phone'],'from':_0x5ed9('0x20')+_0x54a570[_0x5ed9('0x21')],'statusCallback':_0x54a570[_0x5ed9('0x22')]+_0x5ed9('0x23')+_0x28e087['id']+_0x5ed9('0x24')+_0x54a570[_0x5ed9('0x25')]})['then'](function(_0x492f36){if(_0x492f36[_0x5ed9('0x26')]){return _0xbe4c01[_0x5ed9('0x27')]({'messageId':_0x492f36[_0x5ed9('0x26')]});}})['catch'](function(_0x4ed7a2){logger[_0x5ed9('0x19')](_0x5ed9('0x28'),_0x5ed9('0x29'),'twilio',util[_0x5ed9('0x2a')](_0x4ed7a2,{'showHidden':![],'depth':null}));});}else{logger[_0x5ed9('0x19')](_0x5ed9('0x28'),'afterCreate',_0x5ed9('0x1b'),_0x5ed9('0x2b'));}break;case _0x5ed9('0x2c'):var _0x124b55=_0x54a570['accountSid'];var _0x5bf824=_0x54a570[_0x5ed9('0x2d')];var _0x5d6599=_0x54a570[_0x5ed9('0x2e')]+_0x5ed9('0x2f')+_0x124b55+_0x5ed9('0x30');var _0x1a53eb={'to':[_0x28e087[_0x5ed9('0x21')]],'message':{'type':_0x5ed9('0x31'),'text':_0x28e087[_0x5ed9('0x1f')]}};var _0x4a47f5={'method':'POST','uri':_0x5d6599,'headers':{'Authorization':'Bearer\x20'+_0x5bf824,'Content-Type':_0x5ed9('0x32')},'body':_0x1a53eb,'json':!![]};rp(_0x4a47f5)[_0x5ed9('0x18')](function(_0x2cb3d2){if(_0x2cb3d2['statuses'][0x0][_0x5ed9('0x33')]){return _0xbe4c01['update']({'messageId':_0x2cb3d2[_0x5ed9('0x34')][0x0][_0x5ed9('0x33')]});}})[_0x5ed9('0x35')](function(_0x441d4d){logger[_0x5ed9('0x36')](_0x5ed9('0x37'),_0x441d4d);});break;}}})['finally'](function(){_0x41fc93();});}else{_0x41fc93();}}},'charset':_0x5ed9('0x38'),'collate':_0x5ed9('0x39')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index cdaf1d0..15a0fff 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 _0x1531=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateWhatsappMessage','create','body','options','raw','info','lodash','util','moment'];(function(_0x31604a,_0x15363e){var _0x591eb3=function(_0x2bb3b5){while(--_0x2bb3b5){_0x31604a['push'](_0x31604a['shift']());}};_0x591eb3(++_0x15363e);}(_0x1531,0x151));var _0x1153=function(_0x1cc9d5,_0x464c67){_0x1cc9d5=_0x1cc9d5-0x0;var _0x695a62=_0x1531[_0x1cc9d5];return _0x695a62;};'use strict';var _=require(_0x1153('0x0'));var util=require(_0x1153('0x1'));var moment=require(_0x1153('0x2'));var BPromise=require(_0x1153('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1153('0x4'));var db=require(_0x1153('0x5'))['db'];var utils=require(_0x1153('0x6'));var logger=require(_0x1153('0x7'))(_0x1153('0x8'));var config=require(_0x1153('0x9'));var jayson=require(_0x1153('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x1153('0xb')](config[_0x1153('0xc')],{'host':_0x1153('0xd'),'port':0x18eb});var socket=require(_0x1153('0xe'))(new Redis(config[_0x1153('0xc')]));require(_0x1153('0xf'))[_0x1153('0x10')](socket);function respondWithRpcPromise(_0x389e7e,_0x5db4eb,_0x587731){return new BPromise(function(_0xc670f0,_0x53dc78){return client[_0x1153('0x11')](_0x389e7e,_0x587731)[_0x1153('0x12')](function(_0x12e369){logger['info'](_0x1153('0x13'),_0x5db4eb,_0x1153('0x14'));logger[_0x1153('0x15')](_0x1153('0x16'),_0x5db4eb,_0x1153('0x14'),JSON[_0x1153('0x17')](_0x12e369));if(_0x12e369[_0x1153('0x18')]){if(_0x12e369['error']['code']===0x1f4){logger[_0x1153('0x18')](_0x1153('0x13'),_0x5db4eb,_0x12e369['error']['message']);return _0x53dc78(_0x12e369[_0x1153('0x18')][_0x1153('0x19')]);}logger[_0x1153('0x18')](_0x1153('0x13'),_0x5db4eb,_0x12e369[_0x1153('0x18')][_0x1153('0x19')]);return _0xc670f0(_0x12e369[_0x1153('0x18')][_0x1153('0x19')]);}else{logger['info'](_0x1153('0x13'),_0x5db4eb,_0x1153('0x14'));_0xc670f0(_0x12e369[_0x1153('0x1a')][_0x1153('0x19')]);}})[_0x1153('0x1b')](function(_0x58d528){logger[_0x1153('0x18')](_0x1153('0x13'),_0x5db4eb,_0x58d528);_0x53dc78(_0x58d528);});});}exports[_0x1153('0x1c')]=function(_0x5e873b){var _0x69377e=this;return new Promise(function(_0x508517,_0x4dfe83){return db['WhatsappMessage'][_0x1153('0x1d')](_0x5e873b[_0x1153('0x1e')],{'raw':_0x5e873b[_0x1153('0x1f')]?_0x5e873b[_0x1153('0x1f')][_0x1153('0x20')]===undefined?!![]:![]:!![]})[_0x1153('0x12')](function(_0x3300c9){logger[_0x1153('0x21')](_0x1153('0x1c'),_0x5e873b);logger[_0x1153('0x15')]('CreateWhatsappMessage',_0x5e873b,JSON[_0x1153('0x17')](_0x3300c9));_0x508517(_0x3300c9);})['catch'](function(_0xbd02d2){logger[_0x1153('0x18')](_0x1153('0x1c'),_0xbd02d2[_0x1153('0x19')],_0x5e873b);_0x4dfe83(_0x69377e[_0x1153('0x18')](0x1f4,_0xbd02d2['message']));});});}; \ No newline at end of file +var _0x36ff=['WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateWhatsappMessage','WhatsappMessage','options','raw','then','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','info'];(function(_0x2fa3c6,_0x36842c){var _0x755771=function(_0x18ae02){while(--_0x18ae02){_0x2fa3c6['push'](_0x2fa3c6['shift']());}};_0x755771(++_0x36842c);}(_0x36ff,0xe7));var _0xf36f=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x36ff[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xf36f('0x0'));var util=require(_0xf36f('0x1'));var moment=require('moment');var BPromise=require(_0xf36f('0x2'));var rs=require(_0xf36f('0x3'));var fs=require('fs');var Redis=require(_0xf36f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf36f('0x5'))('rpc');var config=require(_0xf36f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf36f('0x7')][_0xf36f('0x8')]({'port':0x232a});config[_0xf36f('0x9')]=_[_0xf36f('0xa')](config[_0xf36f('0x9')],{'host':_0xf36f('0xb'),'port':0x18eb});var socket=require(_0xf36f('0xc'))(new Redis(config['redis']));require(_0xf36f('0xd'))[_0xf36f('0xe')](socket);function respondWithRpcPromise(_0x457222,_0xdba1d2,_0x1412ce){return new BPromise(function(_0x4c96aa,_0x513fe5){return client[_0xf36f('0xf')](_0x457222,_0x1412ce)['then'](function(_0x1db197){logger[_0xf36f('0x10')](_0xf36f('0x11'),_0xdba1d2,_0xf36f('0x12'));logger[_0xf36f('0x13')](_0xf36f('0x14'),_0xdba1d2,_0xf36f('0x12'),JSON[_0xf36f('0x15')](_0x1db197));if(_0x1db197[_0xf36f('0x16')]){if(_0x1db197[_0xf36f('0x16')]['code']===0x1f4){logger['error'](_0xf36f('0x11'),_0xdba1d2,_0x1db197[_0xf36f('0x16')]['message']);return _0x513fe5(_0x1db197[_0xf36f('0x16')][_0xf36f('0x17')]);}logger['error'](_0xf36f('0x11'),_0xdba1d2,_0x1db197[_0xf36f('0x16')][_0xf36f('0x17')]);return _0x4c96aa(_0x1db197[_0xf36f('0x16')]['message']);}else{logger[_0xf36f('0x10')](_0xf36f('0x11'),_0xdba1d2,_0xf36f('0x12'));_0x4c96aa(_0x1db197[_0xf36f('0x18')][_0xf36f('0x17')]);}})['catch'](function(_0x4dd8e2){logger['error'](_0xf36f('0x11'),_0xdba1d2,_0x4dd8e2);_0x513fe5(_0x4dd8e2);});});}exports[_0xf36f('0x19')]=function(_0x2fd6c1){var _0x166f5a=this;return new Promise(function(_0x28fbfc,_0x3dc888){return db[_0xf36f('0x1a')]['create'](_0x2fd6c1['body'],{'raw':_0x2fd6c1[_0xf36f('0x1b')]?_0x2fd6c1[_0xf36f('0x1b')][_0xf36f('0x1c')]===undefined?!![]:![]:!![]})[_0xf36f('0x1d')](function(_0x1ae3ad){logger[_0xf36f('0x10')]('CreateWhatsappMessage',_0x2fd6c1);logger[_0xf36f('0x13')](_0xf36f('0x19'),_0x2fd6c1,JSON[_0xf36f('0x15')](_0x1ae3ad));_0x28fbfc(_0x1ae3ad);})[_0xf36f('0x1e')](function(_0x1fddcd){logger[_0xf36f('0x16')]('CreateWhatsappMessage',_0x1fddcd[_0xf36f('0x17')],_0x2fd6c1);_0x3dc888(_0x166f5a['error'](0x1f4,_0x1fddcd[_0xf36f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index c1781e3..d3d6d1f 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 _0x50bb=['removeListener','register','length','remove','update','emit'];(function(_0x1bfb48,_0x2de37a){var _0x1f432a=function(_0x5d4b71){while(--_0x5d4b71){_0x1bfb48['push'](_0x1bfb48['shift']());}};_0x1f432a(++_0x2de37a);}(_0x50bb,0x14d));var _0xb50b=function(_0x2cbeed,_0x3521e4){_0x2cbeed=_0x2cbeed-0x0;var _0x14f905=_0x50bb[_0x2cbeed];return _0x14f905;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save',_0xb50b('0x0'),_0xb50b('0x1')];function createListener(_0x31d744,_0x36e34d){return function(_0x34bcf4){_0x36e34d[_0xb50b('0x2')](_0x31d744,_0x34bcf4);};}function removeListener(_0x2ea7d3,_0x572fb0){return function(){WhatsappMessageEvents[_0xb50b('0x3')](_0x2ea7d3,_0x572fb0);};}exports[_0xb50b('0x4')]=function(_0x5cb985){for(var _0x54b67d=0x0,_0x498cab=events[_0xb50b('0x5')];_0x54b67d<_0x498cab;_0x54b67d++){var _0x334c22=events[_0x54b67d];var _0x17f06c=createListener('whatsappMessage:'+_0x334c22,_0x5cb985);WhatsappMessageEvents['on'](_0x334c22,_0x17f06c);}}; \ No newline at end of file +var _0xc036=['./whatsappMessage.events','save','remove','update','emit','removeListener','register','length','whatsappMessage:'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xc036,0x144));var _0x6c03=function(_0x47604d,_0x15a014){_0x47604d=_0x47604d-0x0;var _0x388e4c=_0xc036[_0x47604d];return _0x388e4c;};'use strict';var WhatsappMessageEvents=require(_0x6c03('0x0'));var events=[_0x6c03('0x1'),_0x6c03('0x2'),_0x6c03('0x3')];function createListener(_0x463783,_0x13c3a9){return function(_0x5ba02d){_0x13c3a9[_0x6c03('0x4')](_0x463783,_0x5ba02d);};}function removeListener(_0x191e34,_0x4e9f06){return function(){WhatsappMessageEvents[_0x6c03('0x5')](_0x191e34,_0x4e9f06);};}exports[_0x6c03('0x6')]=function(_0x362752){for(var _0x5c5186=0x0,_0x288a1f=events[_0x6c03('0x7')];_0x5c5186<_0x288a1f;_0x5c5186++){var _0x3bbf84=events[_0x5c5186];var _0x3d1707=createListener(_0x6c03('0x8')+_0x3bbf84,_0x362752);WhatsappMessageEvents['on'](_0x3bbf84,_0x3d1707);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 6e8510a..5d9c0ef 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 _0xc5c3=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','get','getTeams','/:id/users','post','/:id/teams','addTeams','addAgents','put','update','delete','removeTeams','exports','multer'];(function(_0x22b8a3,_0x2a79a7){var _0x199a0c=function(_0x544c66){while(--_0x544c66){_0x22b8a3['push'](_0x22b8a3['shift']());}};_0x199a0c(++_0x2a79a7);}(_0xc5c3,0xae));var _0x3c5c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc5c3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3c5c('0x0'));var util=require(_0x3c5c('0x1'));var path=require(_0x3c5c('0x2'));var timeout=require(_0x3c5c('0x3'));var express=require(_0x3c5c('0x4'));var router=express[_0x3c5c('0x5')]();var fs_extra=require(_0x3c5c('0x6'));var auth=require(_0x3c5c('0x7'));var interaction=require(_0x3c5c('0x8'));var config=require(_0x3c5c('0x9'));var controller=require('./whatsappQueue.controller');router['get']('/',auth[_0x3c5c('0xa')](),controller[_0x3c5c('0xb')]);router['get']('/describe',auth[_0x3c5c('0xa')](),controller['describe']);router['get'](_0x3c5c('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x3c5c('0xd')]('/:id/members',auth[_0x3c5c('0xa')](),controller['getMembers']);router[_0x3c5c('0xd')]('/:id/teams',auth[_0x3c5c('0xa')](),controller[_0x3c5c('0xe')]);router['get'](_0x3c5c('0xf'),auth[_0x3c5c('0xa')](),controller['getAgents']);router[_0x3c5c('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x3c5c('0x11'),auth[_0x3c5c('0xa')](),controller[_0x3c5c('0x12')]);router[_0x3c5c('0x10')]('/:id/users',auth[_0x3c5c('0xa')](),controller[_0x3c5c('0x13')]);router[_0x3c5c('0x14')](_0x3c5c('0xc'),auth['isAuthenticated'](),controller[_0x3c5c('0x15')]);router[_0x3c5c('0x16')](_0x3c5c('0xc'),auth[_0x3c5c('0xa')](),controller['destroy']);router[_0x3c5c('0x16')](_0x3c5c('0x11'),auth[_0x3c5c('0xa')](),controller[_0x3c5c('0x17')]);router[_0x3c5c('0x16')](_0x3c5c('0xf'),auth[_0x3c5c('0xa')](),controller['removeAgents']);module[_0x3c5c('0x18')]=router; \ No newline at end of file +var _0x781d=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addAgents','/:id','update','delete','destroy','removeTeams','removeAgents','exports'];(function(_0x51bc31,_0x18ba18){var _0x66e6e6=function(_0x2f6c85){while(--_0x2f6c85){_0x51bc31['push'](_0x51bc31['shift']());}};_0x66e6e6(++_0x18ba18);}(_0x781d,0x14a));var _0xd781=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x781d[_0x5b644e];return _0x49c6bf;};'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',auth[_0xd781('0xa')](),controller['show']);router[_0xd781('0x9')](_0xd781('0xe'),auth['isAuthenticated'](),controller[_0xd781('0xf')]);router[_0xd781('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0xd781('0x10')]);router[_0xd781('0x9')](_0xd781('0x11'),auth[_0xd781('0xa')](),controller[_0xd781('0x12')]);router[_0xd781('0x13')]('/',auth[_0xd781('0xa')](),controller[_0xd781('0x14')]);router[_0xd781('0x13')](_0xd781('0x15'),auth[_0xd781('0xa')](),controller['addTeams']);router[_0xd781('0x13')](_0xd781('0x11'),auth['isAuthenticated'](),controller[_0xd781('0x16')]);router['put'](_0xd781('0x17'),auth[_0xd781('0xa')](),controller[_0xd781('0x18')]);router[_0xd781('0x19')](_0xd781('0x17'),auth[_0xd781('0xa')](),controller[_0xd781('0x1a')]);router['delete'](_0xd781('0x15'),auth[_0xd781('0xa')](),controller[_0xd781('0x1b')]);router[_0xd781('0x19')](_0xd781('0x11'),auth[_0xd781('0xa')](),controller[_0xd781('0x1c')]);module[_0xd781('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index dcbac5e..64f1995 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 _0x9181=['roundrobin','sequelize','exports','STRING','name','INTEGER','rrmemory'];(function(_0x514eb9,_0x1511e6){var _0x433e49=function(_0xadbd4d){while(--_0xadbd4d){_0x514eb9['push'](_0x514eb9['shift']());}};_0x433e49(++_0x1511e6);}(_0x9181,0x182));var _0x1918=function(_0x3098cb,_0x2f8f40){_0x3098cb=_0x3098cb-0x0;var _0x317f4a=_0x9181[_0x3098cb];return _0x317f4a;};'use strict';var Sequelize=require(_0x1918('0x0'));module[_0x1918('0x1')]={'name':{'type':Sequelize[_0x1918('0x2')],'unique':_0x1918('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x1918('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x1918('0x5'),'beepall',_0x1918('0x6'))},'description':{'type':Sequelize[_0x1918('0x2')]}}; \ No newline at end of file +var _0xc3b0=['STRING','name','rrmemory','beepall','sequelize','exports'];(function(_0x3b2712,_0x2995e4){var _0x33f479=function(_0x4ee33d){while(--_0x4ee33d){_0x3b2712['push'](_0x3b2712['shift']());}};_0x33f479(++_0x2995e4);}(_0xc3b0,0x166));var _0x0c3b=function(_0x578cda,_0xceec87){_0x578cda=_0x578cda-0x0;var _0x43d7f5=_0xc3b0[_0x578cda];return _0x43d7f5;};'use strict';var Sequelize=require(_0x0c3b('0x0'));module[_0x0c3b('0x1')]={'name':{'type':Sequelize[_0x0c3b('0x2')],'unique':_0x0c3b('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0c3b('0x4'),_0x0c3b('0x5'),'roundrobin')},'description':{'type':Sequelize[_0x0c3b('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index ef05a05..c12f02b 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 _0x6ce2=['isEmpty','removeAgents','addAgents','omit','spread','emit','userWhatsappQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','includeAll','include','rows','catch','params','find','create','user','get','role','WhatsappQueues','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserWhatsappQueue','pick','options','findAll','User','findAndCountAll','UserId','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','hasOwnProperty','online','voicePause','interface','flatMap','Agents','sequelize','addTeams','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','field','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','union','transaction','ids'];(function(_0x34b233,_0x519fd8){var _0x387834=function(_0x4572f0){while(--_0x4572f0){_0x34b233['push'](_0x34b233['shift']());}};_0x387834(++_0x519fd8);}(_0x6ce2,0x11e));var _0x26ce=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x6ce2[_0x6cf19c];return _0xce14f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x26ce('0x0'));var zipdir=require(_0x26ce('0x1'));var jsonpatch=require(_0x26ce('0x2'));var rp=require(_0x26ce('0x3'));var moment=require(_0x26ce('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x26ce('0x5'));var util=require(_0x26ce('0x6'));var path=require(_0x26ce('0x7'));var sox=require(_0x26ce('0x8'));var csv=require(_0x26ce('0x9'));var ejs=require(_0x26ce('0xa'));var fs=require('fs');var fs_extra=require(_0x26ce('0xb'));var _=require(_0x26ce('0xc'));var squel=require(_0x26ce('0xd'));var crypto=require('crypto');var jsforce=require(_0x26ce('0xe'));var deskjs=require(_0x26ce('0xf'));var toCsv=require(_0x26ce('0x9'));var querystring=require(_0x26ce('0x10'));var Papa=require('papaparse');var Redis=require(_0x26ce('0x11'));var authService=require(_0x26ce('0x12'));var qs=require(_0x26ce('0x13'));var as=require(_0x26ce('0x14'));var hardwareService=require(_0x26ce('0x15'));var logger=require(_0x26ce('0x16'))(_0x26ce('0x17'));var utils=require(_0x26ce('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x26ce('0x19'));var db=require(_0x26ce('0x1a'))['db'];config[_0x26ce('0x1b')]=_['defaults'](config[_0x26ce('0x1b')],{'host':_0x26ce('0x1c'),'port':0x18eb});var socket=require(_0x26ce('0x1d'))(new Redis(config[_0x26ce('0x1b')]));require(_0x26ce('0x1e'))[_0x26ce('0x1f')](socket);function respondWithStatusCode(_0x246391,_0x337f1c){_0x337f1c=_0x337f1c||0xcc;return function(_0x43775d){if(_0x43775d){return _0x246391[_0x26ce('0x20')](_0x337f1c);}return _0x246391[_0x26ce('0x21')](_0x337f1c)[_0x26ce('0x22')]();};}function respondWithResult(_0x54b049,_0x46848f){_0x46848f=_0x46848f||0xc8;return function(_0x5d14b2){if(_0x5d14b2){return _0x54b049[_0x26ce('0x21')](_0x46848f)['json'](_0x5d14b2);}};}function respondWithFilteredResult(_0x1417e2,_0x5e219f){return function(_0x76b925){if(_0x76b925){var _0x5ee2bb=typeof _0x5e219f[_0x26ce('0x23')]===_0x26ce('0x24')&&typeof _0x5e219f[_0x26ce('0x25')]===_0x26ce('0x24');var _0x3f451f=_0x76b925[_0x26ce('0x26')];var _0x4f691a=_0x5ee2bb?0x0:_0x5e219f[_0x26ce('0x23')];var _0x55433d=_0x5ee2bb?_0x76b925[_0x26ce('0x26')]:_0x5e219f['offset']+_0x5e219f[_0x26ce('0x25')];var _0x4abbe7;if(_0x55433d>=_0x3f451f){_0x55433d=_0x3f451f;_0x4abbe7=0xc8;}else{_0x4abbe7=0xce;}_0x1417e2[_0x26ce('0x21')](_0x4abbe7);return _0x1417e2[_0x26ce('0x27')]('Content-Range',_0x4f691a+'-'+_0x55433d+'/'+_0x3f451f)[_0x26ce('0x28')](_0x76b925);}return null;};}function patchUpdates(_0xf9d482){return function(_0x1e888a){try{jsonpatch[_0x26ce('0x29')](_0x1e888a,_0xf9d482,!![]);}catch(_0x393601){return BPromise[_0x26ce('0x2a')](_0x393601);}return _0x1e888a[_0x26ce('0x2b')]();};}function saveUpdates(_0x1694e2,_0x39d4d0){return function(_0x191826){if(_0x191826){return _0x191826[_0x26ce('0x2c')](_0x1694e2)[_0x26ce('0x2d')](function(_0x55ee63){return _0x55ee63;});}return null;};}function removeEntity(_0x555116,_0x1b53e0){return function(_0x18d331){if(_0x18d331){return _0x18d331['destroy']()['then'](function(){var _0x4b01dc=_0x18d331['get']({'plain':!![]});var _0x1c3639='WhatsappQueues';return db['UserProfileResource'][_0x26ce('0x2e')]({'where':{'type':_0x1c3639,'resourceId':_0x4b01dc['id']}})[_0x26ce('0x2d')](function(){return _0x18d331;});})[_0x26ce('0x2d')](function(){_0x555116[_0x26ce('0x21')](0xcc)[_0x26ce('0x22')]();});}};}function handleEntityNotFound(_0x53fed2,_0x17f5e0){return function(_0x3a60db){if(!_0x3a60db){_0x53fed2[_0x26ce('0x20')](0x194);}return _0x3a60db;};}function handleError(_0xb5aadd,_0x5a4bbc){_0x5a4bbc=_0x5a4bbc||0x1f4;return function(_0x1124a3){logger['error'](_0x1124a3['stack']);if(_0x1124a3[_0x26ce('0x2f')]){delete _0x1124a3[_0x26ce('0x2f')];}_0xb5aadd[_0x26ce('0x21')](_0x5a4bbc)[_0x26ce('0x30')](_0x1124a3);};}exports[_0x26ce('0x31')]=function(_0x441607,_0x4b2d2d){var _0x467ddf={},_0x26f1dc={},_0x42d903={'count':0x0,'rows':[]};var _0x25a601=_[_0x26ce('0x32')](db[_0x26ce('0x33')][_0x26ce('0x34')],function(_0x2d4920){return{'name':_0x2d4920[_0x26ce('0x35')],'type':_0x2d4920[_0x26ce('0x36')]['key']};});_0x26f1dc['model']=_['map'](_0x25a601,_0x26ce('0x2f'));_0x26f1dc[_0x26ce('0x37')]=_[_0x26ce('0x38')](_0x441607['query']);_0x26f1dc['filters']=_[_0x26ce('0x39')](_0x26f1dc[_0x26ce('0x3a')],_0x26f1dc[_0x26ce('0x37')]);_0x467ddf[_0x26ce('0x3b')]=_['intersection'](_0x26f1dc['model'],qs[_0x26ce('0x3c')](_0x441607[_0x26ce('0x37')][_0x26ce('0x3c')]));_0x467ddf[_0x26ce('0x3b')]=_0x467ddf[_0x26ce('0x3b')][_0x26ce('0x3d')]?_0x467ddf['attributes']:_0x26f1dc[_0x26ce('0x3a')];if(!_0x441607[_0x26ce('0x37')]['hasOwnProperty'](_0x26ce('0x3e'))){_0x467ddf[_0x26ce('0x25')]=qs[_0x26ce('0x25')](_0x441607['query'][_0x26ce('0x25')]);_0x467ddf['offset']=qs[_0x26ce('0x23')](_0x441607[_0x26ce('0x37')][_0x26ce('0x23')]);}_0x467ddf[_0x26ce('0x3f')]=qs[_0x26ce('0x40')](_0x441607[_0x26ce('0x37')][_0x26ce('0x40')]);_0x467ddf[_0x26ce('0x41')]=qs[_0x26ce('0x42')](_['pick'](_0x441607[_0x26ce('0x37')],_0x26f1dc[_0x26ce('0x42')]),_0x25a601);if(_0x441607['query'][_0x26ce('0x43')]){_0x467ddf['where']=_[_0x26ce('0x44')](_0x467ddf[_0x26ce('0x41')],{'$or':_[_0x26ce('0x32')](_0x25a601,function(_0x538061){if(_0x538061['type']!=='VIRTUAL'){var _0x126acb={};_0x126acb[_0x538061[_0x26ce('0x2f')]]={'$like':'%'+_0x441607[_0x26ce('0x37')][_0x26ce('0x43')]+'%'};return _0x126acb;}})});}_0x467ddf=_[_0x26ce('0x44')]({},_0x467ddf,_0x441607['options']);var _0x304be1={'where':_0x467ddf[_0x26ce('0x41')]};return db['WhatsappQueue']['count'](_0x304be1)[_0x26ce('0x2d')](function(_0x5e3ce9){_0x42d903[_0x26ce('0x26')]=_0x5e3ce9;if(_0x441607[_0x26ce('0x37')][_0x26ce('0x45')]){_0x467ddf[_0x26ce('0x46')]=[{'all':!![]}];}return db['WhatsappQueue']['findAll'](_0x467ddf);})[_0x26ce('0x2d')](function(_0x570878){_0x42d903[_0x26ce('0x47')]=_0x570878;return _0x42d903;})[_0x26ce('0x2d')](respondWithFilteredResult(_0x4b2d2d,_0x467ddf))[_0x26ce('0x48')](handleError(_0x4b2d2d,null));};exports['show']=function(_0x41e9cc,_0x29a9c5){var _0x52d05b={'raw':!![],'where':{'id':_0x41e9cc[_0x26ce('0x49')]['id']}},_0x2d85f1={};_0x2d85f1[_0x26ce('0x3a')]=_[_0x26ce('0x38')](db['WhatsappQueue']['rawAttributes']);_0x2d85f1[_0x26ce('0x37')]=_[_0x26ce('0x38')](_0x41e9cc[_0x26ce('0x37')]);_0x2d85f1[_0x26ce('0x42')]=_[_0x26ce('0x39')](_0x2d85f1['model'],_0x2d85f1[_0x26ce('0x37')]);_0x52d05b['attributes']=_['intersection'](_0x2d85f1[_0x26ce('0x3a')],qs[_0x26ce('0x3c')](_0x41e9cc[_0x26ce('0x37')][_0x26ce('0x3c')]));_0x52d05b['attributes']=_0x52d05b[_0x26ce('0x3b')][_0x26ce('0x3d')]?_0x52d05b['attributes']:_0x2d85f1['model'];if(_0x41e9cc['query'][_0x26ce('0x45')]){_0x52d05b[_0x26ce('0x46')]=[{'all':!![]}];}_0x52d05b=_[_0x26ce('0x44')]({},_0x52d05b,_0x41e9cc['options']);return db[_0x26ce('0x33')][_0x26ce('0x4a')](_0x52d05b)['then'](handleEntityNotFound(_0x29a9c5,null))[_0x26ce('0x2d')](respondWithResult(_0x29a9c5,null))[_0x26ce('0x48')](handleError(_0x29a9c5,null));};exports[_0x26ce('0x4b')]=function(_0x1cc6a3,_0x3c5496){return db[_0x26ce('0x33')]['create'](_0x1cc6a3['body'],{})[_0x26ce('0x2d')](function(_0x4c50b4){var _0x3e01cd=_0x1cc6a3[_0x26ce('0x4c')][_0x26ce('0x4d')]({'plain':!![]});if(!_0x3e01cd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e01cd[_0x26ce('0x4e')]===_0x26ce('0x4c')){var _0x46d9ce=_0x4c50b4[_0x26ce('0x4d')]({'plain':!![]});var _0x232fee=_0x26ce('0x4f');return db['UserProfileSection']['find']({'where':{'name':_0x232fee,'userProfileId':_0x3e01cd['userProfileId']},'raw':!![]})[_0x26ce('0x2d')](function(_0x3f8f62){if(_0x3f8f62&&_0x3f8f62[_0x26ce('0x50')]===0x0){return db['UserProfileResource'][_0x26ce('0x4b')]({'name':_0x46d9ce['name'],'resourceId':_0x46d9ce['id'],'type':_0x3f8f62[_0x26ce('0x2f')],'sectionId':_0x3f8f62['id']},{})[_0x26ce('0x2d')](function(){return _0x4c50b4;});}else{return _0x4c50b4;}})[_0x26ce('0x48')](function(_0x29cd51){logger['error'](_0x26ce('0x51'),_0x29cd51);throw _0x29cd51;});}return _0x4c50b4;})[_0x26ce('0x2d')](respondWithResult(_0x3c5496,0xc9))[_0x26ce('0x48')](handleError(_0x3c5496,null));};exports[_0x26ce('0x2c')]=function(_0x233501,_0x78b257){if(_0x233501[_0x26ce('0x52')]['id']){delete _0x233501[_0x26ce('0x52')]['id'];}return db[_0x26ce('0x33')][_0x26ce('0x4a')]({'where':{'id':_0x233501[_0x26ce('0x49')]['id']}})[_0x26ce('0x2d')](handleEntityNotFound(_0x78b257,null))['then'](saveUpdates(_0x233501['body'],null))['then'](respondWithResult(_0x78b257,null))[_0x26ce('0x48')](handleError(_0x78b257,null));};exports[_0x26ce('0x2e')]=function(_0x2c4ab9,_0x9fc2cb){return db[_0x26ce('0x33')]['find']({'where':{'id':_0x2c4ab9['params']['id']}})[_0x26ce('0x2d')](handleEntityNotFound(_0x9fc2cb,null))['then'](removeEntity(_0x9fc2cb,null))[_0x26ce('0x48')](handleError(_0x9fc2cb,null));};exports[_0x26ce('0x53')]=function(_0x4cc590,_0x1fa47c){return db['WhatsappQueue'][_0x26ce('0x53')]()['then'](respondWithResult(_0x1fa47c,null))['catch'](handleError(_0x1fa47c,null));};exports[_0x26ce('0x54')]=function(_0x2ede33,_0x2fe898,_0xa21f58){var _0x4e79d6={'raw':!![],'where':{}},_0x5dd9b4={},_0x186639;return db[_0x26ce('0x33')]['findOne']({'where':{'id':_0x2ede33[_0x26ce('0x49')]['id']}})[_0x26ce('0x2d')](handleEntityNotFound(_0x2fe898,null))[_0x26ce('0x2d')](function(_0x14a41d){if(_0x14a41d){_0x186639=_0x14a41d[_0x26ce('0x4d')]({'plain':!![]});_0x5dd9b4['model']=_['keys'](db[_0x26ce('0x55')][_0x26ce('0x34')]);_0x5dd9b4[_0x26ce('0x37')]=_[_0x26ce('0x38')](_0x2ede33[_0x26ce('0x37')]);_0x5dd9b4['filters']=_[_0x26ce('0x39')](_0x5dd9b4[_0x26ce('0x3a')],_0x5dd9b4[_0x26ce('0x37')]);_0x4e79d6['attributes']=_['intersection'](_0x5dd9b4[_0x26ce('0x3a')],qs['fields'](_0x2ede33[_0x26ce('0x37')][_0x26ce('0x3c')]));_0x4e79d6['attributes']=_0x4e79d6[_0x26ce('0x3b')][_0x26ce('0x3d')]?_0x4e79d6[_0x26ce('0x3b')]:_0x5dd9b4[_0x26ce('0x3a')];if(!_0x2ede33[_0x26ce('0x37')]['hasOwnProperty'](_0x26ce('0x3e'))){_0x4e79d6['limit']=qs[_0x26ce('0x25')](_0x2ede33[_0x26ce('0x37')][_0x26ce('0x25')]);_0x4e79d6[_0x26ce('0x23')]=qs['offset'](_0x2ede33['query'][_0x26ce('0x23')]);}_0x4e79d6[_0x26ce('0x3f')]=qs[_0x26ce('0x40')](_0x2ede33['query'][_0x26ce('0x40')]);_0x4e79d6[_0x26ce('0x41')]=qs[_0x26ce('0x42')](_[_0x26ce('0x56')](_0x2ede33[_0x26ce('0x37')],_0x5dd9b4[_0x26ce('0x42')]));_0x4e79d6['where']['WhatsappQueueId']=_0x14a41d['id'];if(_0x2ede33[_0x26ce('0x37')][_0x26ce('0x43')]){_0x4e79d6['where']=_[_0x26ce('0x44')](_0x4e79d6[_0x26ce('0x41')],{'$or':_[_0x26ce('0x32')](_0x4e79d6[_0x26ce('0x3b')],function(_0x2a1d17){var _0x2d5199={};_0x2d5199[_0x2a1d17]={'$like':'%'+_0x2ede33[_0x26ce('0x37')][_0x26ce('0x43')]+'%'};return _0x2d5199;})});}_0x4e79d6=_[_0x26ce('0x44')]({},_0x4e79d6,_0x2ede33[_0x26ce('0x57')]);return db[_0x26ce('0x55')][_0x26ce('0x58')](_0x4e79d6);}})[_0x26ce('0x2d')](function(_0x381e44){if(_0x381e44){return db[_0x26ce('0x59')][_0x26ce('0x5a')]({'where':{'id':_[_0x26ce('0x32')](_0x381e44,_0x26ce('0x5b')),'role':'agent'},'attributes':['id',_0x26ce('0x2f'),_0x26ce('0x5c'),_0x26ce('0x5d'),_0x26ce('0x5e')]});}})['then'](function(_0x4d9b44){if(_0x4d9b44){return{'count':_0x4d9b44[_0x26ce('0x26')],'rows':_[_0x26ce('0x32')](_0x4d9b44['rows'],function(_0x24f01d){return{'membername':_0x24f01d['name'],'UserId':_0x24f01d['id'],'queue_name':_0x186639[_0x26ce('0x2f')],'WhatsappQueueId':_0x186639['id'],'interface':util[_0x26ce('0x5f')](_0x26ce('0x60'),_0x26ce('0x61'),_0x24f01d[_0x26ce('0x2f')]),'penalty':0x0,'paused':_0x24f01d[_0x26ce('0x5c')],'createdAt':_0x24f01d[_0x26ce('0x5e')],'updatedAt':_0x24f01d[_0x26ce('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x26ce('0x2d')](respondWithFilteredResult(_0x2fe898,_0x4e79d6))[_0x26ce('0x48')](handleError(_0x2fe898,null));};exports[_0x26ce('0x62')]=function(_0x4c9265,_0x45d1f0,_0x1c7665){var _0x23e3a1={};var _0x596081={};var _0x7abfc9;var _0x1160d6;return db[_0x26ce('0x33')][_0x26ce('0x63')]({'where':{'id':_0x4c9265[_0x26ce('0x49')]['id']}})[_0x26ce('0x2d')](handleEntityNotFound(_0x45d1f0,null))[_0x26ce('0x2d')](function(_0x2e0577){if(_0x2e0577){_0x7abfc9=_0x2e0577;_0x596081[_0x26ce('0x3a')]=_[_0x26ce('0x38')](db[_0x26ce('0x64')][_0x26ce('0x34')]);_0x596081[_0x26ce('0x37')]=_[_0x26ce('0x38')](_0x4c9265[_0x26ce('0x37')]);_0x596081[_0x26ce('0x42')]=_[_0x26ce('0x39')](_0x596081[_0x26ce('0x3a')],_0x596081['query']);_0x23e3a1[_0x26ce('0x3b')]=_[_0x26ce('0x39')](_0x596081['model'],qs[_0x26ce('0x3c')](_0x4c9265[_0x26ce('0x37')][_0x26ce('0x3c')]));_0x23e3a1['attributes']=_0x23e3a1[_0x26ce('0x3b')][_0x26ce('0x3d')]?_0x23e3a1[_0x26ce('0x3b')]:_0x596081['model'];_0x23e3a1['order']=qs[_0x26ce('0x40')](_0x4c9265[_0x26ce('0x37')][_0x26ce('0x40')]);_0x23e3a1[_0x26ce('0x41')]=qs['filters'](_[_0x26ce('0x56')](_0x4c9265[_0x26ce('0x37')],_0x596081[_0x26ce('0x42')]));if(_0x4c9265[_0x26ce('0x37')][_0x26ce('0x43')]){_0x23e3a1[_0x26ce('0x41')]=_[_0x26ce('0x44')](_0x23e3a1[_0x26ce('0x41')],{'$or':_[_0x26ce('0x32')](_0x23e3a1[_0x26ce('0x3b')],function(_0x4f7e4a){var _0x1998d6={};_0x1998d6[_0x4f7e4a]={'$like':'%'+_0x4c9265[_0x26ce('0x37')][_0x26ce('0x43')]+'%'};return _0x1998d6;})});}_0x23e3a1=_[_0x26ce('0x44')]({},_0x23e3a1,_0x4c9265[_0x26ce('0x57')]);return _0x7abfc9[_0x26ce('0x62')](_0x23e3a1);}})[_0x26ce('0x2d')](function(_0x2c308c){if(_0x2c308c){_0x1160d6=_0x2c308c[_0x26ce('0x3d')];if(!_0x4c9265[_0x26ce('0x37')][_0x26ce('0x65')]('nolimit')){_0x23e3a1[_0x26ce('0x25')]=qs['limit'](_0x4c9265['query'][_0x26ce('0x25')]);_0x23e3a1[_0x26ce('0x23')]=qs[_0x26ce('0x23')](_0x4c9265[_0x26ce('0x37')][_0x26ce('0x23')]);}return _0x7abfc9['getTeams'](_0x23e3a1);}})[_0x26ce('0x2d')](function(_0x7351a8){if(_0x7351a8){return _0x7351a8?{'count':_0x1160d6,'rows':_0x7351a8}:null;}})[_0x26ce('0x2d')](respondWithResult(_0x45d1f0,null))['catch'](handleError(_0x45d1f0,null));};exports['addTeams']=function(_0x16f927,_0x45de81,_0x40a69e){var _0x306b1e=_0x16f927[_0x26ce('0x52')]['ids'];return db[_0x26ce('0x64')]['findAll']({'where':{'id':_0x306b1e},'attributes':['id'],'include':[{'model':db[_0x26ce('0x59')],'as':'Agents','attributes':['id',_0x26ce('0x2f'),_0x26ce('0x66'),_0x26ce('0x67'),_0x26ce('0x68')],'raw':!![]}]})[_0x26ce('0x2d')](function(_0x380714){if(_0x380714){var _0xcf0483=_[_0x26ce('0x69')](_0x380714,function(_0x3ff4dc){var _0x1f3d3f=_0x3ff4dc[_0x26ce('0x4d')]({'plain':!![]});return _0x1f3d3f[_0x26ce('0x6a')];});return db[_0x26ce('0x33')]['find']({'where':{'id':_0x16f927[_0x26ce('0x49')]['id']}})[_0x26ce('0x2d')](function(_0x17c12b){return db[_0x26ce('0x6b')]['transaction'](function(_0x3457e5){return _0x17c12b[_0x26ce('0x6c')](_0x306b1e,{'transaction':_0x3457e5})[_0x26ce('0x2d')](function(){return BPromise[_0x26ce('0x6d')](_0xcf0483,function(_0x58454a){return db[_0x26ce('0x55')][_0x26ce('0x6e')]({'where':{'UserId':_0x58454a['id'],'WhatsappQueueId':_0x16f927[_0x26ce('0x49')]['id']},'transaction':_0x3457e5});});})[_0x26ce('0x2d')](function(){_0xcf0483[_0x26ce('0x6f')](function(_0x3c14cd){socket['emit'](_0x26ce('0x70'),{'UserId':_0x3c14cd['id'],'WhatsappQueueId':_0x17c12b['id']});});});});});}})['then'](respondWithStatusCode(_0x45de81,null))[_0x26ce('0x48')](handleError(_0x45de81,null));};exports[_0x26ce('0x71')]=function(_0x58f77a,_0xa0e124,_0x482172){return db[_0x26ce('0x64')][_0x26ce('0x58')]({'where':{'id':_0x58f77a['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x26ce('0x59')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x26ce('0x2d')](handleEntityNotFound(_0xa0e124,null))[_0x26ce('0x2d')](function(_0x3ce8e1){var _0x154a64=_[_0x26ce('0x32')](_0x3ce8e1,'id');var _0x238dd7=[];var _0x48d995=[];var _0x3bd7f2=squel[_0x26ce('0x72')]();_0x3bd7f2[_0x26ce('0x73')]('tq.TeamId')['from'](_0x26ce('0x74'),'tq')[_0x26ce('0x75')](_0x26ce('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x26ce('0x41')](_0x26ce('0x77'),_0x58f77a[_0x26ce('0x49')]['id']);for(var _0x5b653e=0x0;_0x5b653e<_0x3ce8e1[_0x26ce('0x3d')];_0x5b653e+=0x1){let _0x548d78=_0x3ce8e1[_0x5b653e];for(var _0x59969d=0x0;_0x59969d<_0x548d78[_0x26ce('0x6a')][_0x26ce('0x3d')];_0x59969d+=0x1){let _0x2de9d8=_0x548d78['Agents'][_0x59969d];var _0x2e64b6=_0x3bd7f2[_0x26ce('0x78')]();_0x2e64b6[_0x26ce('0x41')](_0x26ce('0x79'),_0x2de9d8['id']);_0x48d995['push'](db['sequelize'][_0x26ce('0x37')](_0x2e64b6[_0x26ce('0x7a')](),{'type':db[_0x26ce('0x6b')]['QueryTypes'][_0x26ce('0x7b')]})[_0x26ce('0x2d')](function(_0xa03b84){if(_0xa03b84[_0x26ce('0x3d')]===0x1){return _0x2de9d8['id'];}else{var _0x2d881e=_[_0x26ce('0x7c')](_['map'](_0xa03b84,_0x26ce('0x7d')),function(_0x47555e){return _[_0x26ce('0x7e')](_0x154a64,_0x47555e);});if(_0x2d881e){return _0x2de9d8['id'];}}}));}}return BPromise[_0x26ce('0x7f')](_0x48d995)[_0x26ce('0x2d')](function(_0x2fe7c4){_0x238dd7=_(_0x238dd7)[_0x26ce('0x80')](_0x2fe7c4)['compact']()['value']();return db['WhatsappQueue']['find']({'where':{'id':_0x58f77a[_0x26ce('0x49')]['id']}})['then'](function(_0x4d1350){return db[_0x26ce('0x6b')][_0x26ce('0x81')](function(_0x29572c){return _0x4d1350[_0x26ce('0x71')](_0x58f77a[_0x26ce('0x37')][_0x26ce('0x82')],{'transaction':_0x29572c})['then'](function(){if(!_[_0x26ce('0x83')](_0x238dd7)){return _0x4d1350[_0x26ce('0x84')](_0x238dd7,{'transaction':_0x29572c});}})[_0x26ce('0x2d')](function(){_0x238dd7[_0x26ce('0x6f')](function(_0x1b4649){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x1b4649,'WhatsappQueueId':_0x4d1350['id']});});});});});});})[_0x26ce('0x2d')](respondWithStatusCode(_0xa0e124,null))[_0x26ce('0x48')](handleError(_0xa0e124,null));};exports[_0x26ce('0x85')]=function(_0x16d3af,_0x2ef439,_0x213669){return db[_0x26ce('0x33')]['find']({'where':{'id':_0x16d3af[_0x26ce('0x49')]['id']}})[_0x26ce('0x2d')](handleEntityNotFound(_0x2ef439,null))[_0x26ce('0x2d')](function(_0x5d886e){if(_0x5d886e){return _0x5d886e[_0x26ce('0x85')](_0x16d3af[_0x26ce('0x52')]['ids'],_[_0x26ce('0x86')](_0x16d3af['body'],['ids','id'])||{})[_0x26ce('0x87')](function(_0x39bc04){for(var _0x535df0=0x0;_0x535df0<_0x16d3af['body'][_0x26ce('0x82')][_0x26ce('0x3d')];_0x535df0+=0x1){socket[_0x26ce('0x88')](_0x26ce('0x70'),{'UserId':Number(_0x16d3af[_0x26ce('0x52')][_0x26ce('0x82')][_0x535df0]),'WhatsappQueueId':Number(_0x16d3af[_0x26ce('0x49')]['id'])});}return _0x39bc04;});}})[_0x26ce('0x2d')](respondWithResult(_0x2ef439,null))[_0x26ce('0x48')](handleError(_0x2ef439,null));};exports[_0x26ce('0x84')]=function(_0x10a422,_0x53d8e8,_0x1bc4b1){return db['WhatsappQueue'][_0x26ce('0x4a')]({'where':{'id':_0x10a422[_0x26ce('0x49')]['id']}})[_0x26ce('0x2d')](handleEntityNotFound(_0x53d8e8,null))[_0x26ce('0x2d')](function(_0xd32f6b){if(_0xd32f6b){return _0xd32f6b[_0x26ce('0x84')](_0x10a422[_0x26ce('0x37')][_0x26ce('0x82')])[_0x26ce('0x2d')](function(){if(_['isArray'](_0x10a422[_0x26ce('0x37')][_0x26ce('0x82')])){for(var _0x2a82b0=0x0;_0x2a82b0<_0x10a422['query'][_0x26ce('0x82')][_0x26ce('0x3d')];_0x2a82b0+=0x1){socket[_0x26ce('0x88')](_0x26ce('0x89'),{'UserId':Number(_0x10a422[_0x26ce('0x37')]['ids'][_0x2a82b0]),'WhatsappQueueId':Number(_0x10a422[_0x26ce('0x49')]['id'])});}}else{socket['emit'](_0x26ce('0x89'),{'UserId':Number(_0x10a422[_0x26ce('0x37')]['ids']),'WhatsappQueueId':Number(_0x10a422[_0x26ce('0x49')]['id'])});}});}})[_0x26ce('0x2d')](respondWithStatusCode(_0x53d8e8,null))[_0x26ce('0x48')](handleError(_0x53d8e8,null));};exports[_0x26ce('0x8a')]=function(_0x4936d3,_0x4d385b,_0x4f44db){var _0x3e5fba={};var _0xfe7586={};var _0x37d37a;var _0xd3d7ce;return db[_0x26ce('0x33')][_0x26ce('0x63')]({'where':{'id':_0x4936d3['params']['id']}})['then'](handleEntityNotFound(_0x4d385b,null))['then'](function(_0x5d4f9c){if(_0x5d4f9c){_0x37d37a=_0x5d4f9c;_0xfe7586[_0x26ce('0x3a')]=_[_0x26ce('0x38')](db[_0x26ce('0x59')]['rawAttributes']);_0xfe7586['query']=_[_0x26ce('0x38')](_0x4936d3[_0x26ce('0x37')]);_0xfe7586['filters']=_[_0x26ce('0x39')](_0xfe7586[_0x26ce('0x3a')],_0xfe7586['query']);_0x3e5fba[_0x26ce('0x3b')]=_[_0x26ce('0x39')](_0xfe7586[_0x26ce('0x3a')],qs['fields'](_0x4936d3[_0x26ce('0x37')][_0x26ce('0x3c')]));_0x3e5fba[_0x26ce('0x3b')]=_0x3e5fba['attributes'][_0x26ce('0x3d')]?_0x3e5fba[_0x26ce('0x3b')]:_0xfe7586[_0x26ce('0x3a')];_0x3e5fba['order']=qs['sort'](_0x4936d3[_0x26ce('0x37')]['sort']);_0x3e5fba[_0x26ce('0x41')]=qs[_0x26ce('0x42')](_[_0x26ce('0x56')](_0x4936d3[_0x26ce('0x37')],_0xfe7586[_0x26ce('0x42')]));if(_0x4936d3[_0x26ce('0x37')]['filter']){_0x3e5fba[_0x26ce('0x41')]=_[_0x26ce('0x44')](_0x3e5fba['where'],{'$or':_[_0x26ce('0x32')](_0x3e5fba['attributes'],function(_0x426ac1){var _0x852559={};_0x852559[_0x426ac1]={'$like':'%'+_0x4936d3[_0x26ce('0x37')][_0x26ce('0x43')]+'%'};return _0x852559;})});}_0x3e5fba=_['merge']({},_0x3e5fba,_0x4936d3[_0x26ce('0x57')]);return _0x37d37a[_0x26ce('0x8a')](_0x3e5fba);}})[_0x26ce('0x2d')](function(_0x18499d){if(_0x18499d){_0xd3d7ce=_0x18499d[_0x26ce('0x3d')];if(!_0x4936d3['query'][_0x26ce('0x65')](_0x26ce('0x3e'))){_0x3e5fba[_0x26ce('0x25')]=qs[_0x26ce('0x25')](_0x4936d3[_0x26ce('0x37')][_0x26ce('0x25')]);_0x3e5fba[_0x26ce('0x23')]=qs[_0x26ce('0x23')](_0x4936d3[_0x26ce('0x37')][_0x26ce('0x23')]);}return _0x37d37a[_0x26ce('0x8a')](_0x3e5fba);}})[_0x26ce('0x2d')](function(_0x519cd1){if(_0x519cd1){return _0x519cd1?{'count':_0xd3d7ce,'rows':_0x519cd1}:null;}})[_0x26ce('0x2d')](respondWithResult(_0x4d385b,null))['catch'](handleError(_0x4d385b,null));}; \ No newline at end of file +var _0xee45=['from','team_has_whatsapp_queues','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','union','removeAgents','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','get','WhatsappQueues','UserProfileResource','destroy','sendStatus','error','stack','name','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','include','findAll','rows','show','find','catch','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','getMembers','findOne','pick','UserWhatsappQueue','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','tq.TeamId'];(function(_0x45132e,_0x401967){var _0x1605f5=function(_0x3f0f48){while(--_0x3f0f48){_0x45132e['push'](_0x45132e['shift']());}};_0x1605f5(++_0x401967);}(_0xee45,0x12f));var _0x5ee4=function(_0x4eaacf,_0x8cb70){_0x4eaacf=_0x4eaacf-0x0;var _0x16630e=_0xee45[_0x4eaacf];return _0x16630e;};'use strict';var emlformat=require(_0x5ee4('0x0'));var rimraf=require(_0x5ee4('0x1'));var zipdir=require(_0x5ee4('0x2'));var jsonpatch=require(_0x5ee4('0x3'));var rp=require(_0x5ee4('0x4'));var moment=require(_0x5ee4('0x5'));var BPromise=require(_0x5ee4('0x6'));var Mustache=require(_0x5ee4('0x7'));var util=require(_0x5ee4('0x8'));var path=require(_0x5ee4('0x9'));var sox=require(_0x5ee4('0xa'));var csv=require(_0x5ee4('0xb'));var ejs=require(_0x5ee4('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ee4('0xd'));var squel=require(_0x5ee4('0xe'));var crypto=require(_0x5ee4('0xf'));var jsforce=require(_0x5ee4('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x5ee4('0xb'));var querystring=require(_0x5ee4('0x11'));var Papa=require(_0x5ee4('0x12'));var Redis=require(_0x5ee4('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5ee4('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ee4('0x15'));var logger=require(_0x5ee4('0x16'))(_0x5ee4('0x17'));var utils=require(_0x5ee4('0x18'));var config=require(_0x5ee4('0x19'));var licenseUtil=require(_0x5ee4('0x1a'));var db=require(_0x5ee4('0x1b'))['db'];config[_0x5ee4('0x1c')]=_[_0x5ee4('0x1d')](config[_0x5ee4('0x1c')],{'host':_0x5ee4('0x1e'),'port':0x18eb});var socket=require(_0x5ee4('0x1f'))(new Redis(config[_0x5ee4('0x1c')]));require(_0x5ee4('0x20'))['register'](socket);function respondWithStatusCode(_0xa261d4,_0x5ef5cf){_0x5ef5cf=_0x5ef5cf||0xcc;return function(_0x53ffea){if(_0x53ffea){return _0xa261d4['sendStatus'](_0x5ef5cf);}return _0xa261d4[_0x5ee4('0x21')](_0x5ef5cf)[_0x5ee4('0x22')]();};}function respondWithResult(_0xfb4981,_0x22f674){_0x22f674=_0x22f674||0xc8;return function(_0x423106){if(_0x423106){return _0xfb4981[_0x5ee4('0x21')](_0x22f674)[_0x5ee4('0x23')](_0x423106);}};}function respondWithFilteredResult(_0x183c05,_0x139473){return function(_0x518a9d){if(_0x518a9d){var _0x5c3238=typeof _0x139473['offset']===_0x5ee4('0x24')&&typeof _0x139473[_0x5ee4('0x25')]===_0x5ee4('0x24');var _0x2ca69d=_0x518a9d[_0x5ee4('0x26')];var _0x67a5c5=_0x5c3238?0x0:_0x139473[_0x5ee4('0x27')];var _0x459261=_0x5c3238?_0x518a9d[_0x5ee4('0x26')]:_0x139473[_0x5ee4('0x27')]+_0x139473[_0x5ee4('0x25')];var _0x38b229;if(_0x459261>=_0x2ca69d){_0x459261=_0x2ca69d;_0x38b229=0xc8;}else{_0x38b229=0xce;}_0x183c05[_0x5ee4('0x21')](_0x38b229);return _0x183c05[_0x5ee4('0x28')](_0x5ee4('0x29'),_0x67a5c5+'-'+_0x459261+'/'+_0x2ca69d)[_0x5ee4('0x23')](_0x518a9d);}return null;};}function patchUpdates(_0x2fe0b1){return function(_0x162ecb){try{jsonpatch[_0x5ee4('0x2a')](_0x162ecb,_0x2fe0b1,!![]);}catch(_0x422b31){return BPromise[_0x5ee4('0x2b')](_0x422b31);}return _0x162ecb['save']();};}function saveUpdates(_0x15ae04,_0x43e0ef){return function(_0x43198a){if(_0x43198a){return _0x43198a['update'](_0x15ae04)[_0x5ee4('0x2c')](function(_0x2227b4){return _0x2227b4;});}return null;};}function removeEntity(_0x4738bd,_0x175763){return function(_0x5df3f8){if(_0x5df3f8){return _0x5df3f8['destroy']()[_0x5ee4('0x2c')](function(){var _0x6987a7=_0x5df3f8[_0x5ee4('0x2d')]({'plain':!![]});var _0x2a7aed=_0x5ee4('0x2e');return db[_0x5ee4('0x2f')][_0x5ee4('0x30')]({'where':{'type':_0x2a7aed,'resourceId':_0x6987a7['id']}})[_0x5ee4('0x2c')](function(){return _0x5df3f8;});})['then'](function(){_0x4738bd[_0x5ee4('0x21')](0xcc)[_0x5ee4('0x22')]();});}};}function handleEntityNotFound(_0x325185,_0x5f1f4e){return function(_0x3b4afa){if(!_0x3b4afa){_0x325185[_0x5ee4('0x31')](0x194);}return _0x3b4afa;};}function handleError(_0x3cb8cf,_0x258896){_0x258896=_0x258896||0x1f4;return function(_0x4831f7){logger[_0x5ee4('0x32')](_0x4831f7[_0x5ee4('0x33')]);if(_0x4831f7[_0x5ee4('0x34')]){delete _0x4831f7[_0x5ee4('0x34')];}_0x3cb8cf[_0x5ee4('0x21')](_0x258896)['send'](_0x4831f7);};}exports[_0x5ee4('0x35')]=function(_0x476b16,_0x46646b){var _0x523fa9={},_0x400318={},_0x274b57={'count':0x0,'rows':[]};var _0x406446=_[_0x5ee4('0x36')](db[_0x5ee4('0x37')][_0x5ee4('0x38')],function(_0x2fc4cd){return{'name':_0x2fc4cd[_0x5ee4('0x39')],'type':_0x2fc4cd[_0x5ee4('0x3a')][_0x5ee4('0x3b')]};});_0x400318[_0x5ee4('0x3c')]=_[_0x5ee4('0x36')](_0x406446,'name');_0x400318[_0x5ee4('0x3d')]=_[_0x5ee4('0x3e')](_0x476b16[_0x5ee4('0x3d')]);_0x400318['filters']=_[_0x5ee4('0x3f')](_0x400318['model'],_0x400318[_0x5ee4('0x3d')]);_0x523fa9[_0x5ee4('0x40')]=_[_0x5ee4('0x3f')](_0x400318['model'],qs[_0x5ee4('0x41')](_0x476b16['query']['fields']));_0x523fa9['attributes']=_0x523fa9[_0x5ee4('0x40')][_0x5ee4('0x42')]?_0x523fa9[_0x5ee4('0x40')]:_0x400318[_0x5ee4('0x3c')];if(!_0x476b16['query'][_0x5ee4('0x43')](_0x5ee4('0x44'))){_0x523fa9[_0x5ee4('0x25')]=qs['limit'](_0x476b16['query'][_0x5ee4('0x25')]);_0x523fa9[_0x5ee4('0x27')]=qs[_0x5ee4('0x27')](_0x476b16['query'][_0x5ee4('0x27')]);}_0x523fa9[_0x5ee4('0x45')]=qs['sort'](_0x476b16['query'][_0x5ee4('0x46')]);_0x523fa9[_0x5ee4('0x47')]=qs[_0x5ee4('0x48')](_['pick'](_0x476b16['query'],_0x400318[_0x5ee4('0x48')]),_0x406446);if(_0x476b16[_0x5ee4('0x3d')][_0x5ee4('0x49')]){_0x523fa9['where']=_[_0x5ee4('0x4a')](_0x523fa9['where'],{'$or':_[_0x5ee4('0x36')](_0x406446,function(_0x4f24ef){if(_0x4f24ef[_0x5ee4('0x3a')]!=='VIRTUAL'){var _0x8edd7e={};_0x8edd7e[_0x4f24ef['name']]={'$like':'%'+_0x476b16[_0x5ee4('0x3d')][_0x5ee4('0x49')]+'%'};return _0x8edd7e;}})});}_0x523fa9=_[_0x5ee4('0x4a')]({},_0x523fa9,_0x476b16[_0x5ee4('0x4b')]);var _0x5a9b03={'where':_0x523fa9[_0x5ee4('0x47')]};return db[_0x5ee4('0x37')][_0x5ee4('0x26')](_0x5a9b03)[_0x5ee4('0x2c')](function(_0x517eea){_0x274b57[_0x5ee4('0x26')]=_0x517eea;if(_0x476b16['query']['includeAll']){_0x523fa9[_0x5ee4('0x4c')]=[{'all':!![]}];}return db[_0x5ee4('0x37')][_0x5ee4('0x4d')](_0x523fa9);})[_0x5ee4('0x2c')](function(_0x5d6463){_0x274b57[_0x5ee4('0x4e')]=_0x5d6463;return _0x274b57;})[_0x5ee4('0x2c')](respondWithFilteredResult(_0x46646b,_0x523fa9))['catch'](handleError(_0x46646b,null));};exports[_0x5ee4('0x4f')]=function(_0x1b2926,_0x351547){var _0x385355={'raw':!![],'where':{'id':_0x1b2926['params']['id']}},_0x248520={};_0x248520[_0x5ee4('0x3c')]=_[_0x5ee4('0x3e')](db['WhatsappQueue'][_0x5ee4('0x38')]);_0x248520[_0x5ee4('0x3d')]=_[_0x5ee4('0x3e')](_0x1b2926[_0x5ee4('0x3d')]);_0x248520[_0x5ee4('0x48')]=_[_0x5ee4('0x3f')](_0x248520[_0x5ee4('0x3c')],_0x248520[_0x5ee4('0x3d')]);_0x385355[_0x5ee4('0x40')]=_[_0x5ee4('0x3f')](_0x248520[_0x5ee4('0x3c')],qs[_0x5ee4('0x41')](_0x1b2926[_0x5ee4('0x3d')][_0x5ee4('0x41')]));_0x385355[_0x5ee4('0x40')]=_0x385355[_0x5ee4('0x40')][_0x5ee4('0x42')]?_0x385355[_0x5ee4('0x40')]:_0x248520[_0x5ee4('0x3c')];if(_0x1b2926[_0x5ee4('0x3d')]['includeAll']){_0x385355[_0x5ee4('0x4c')]=[{'all':!![]}];}_0x385355=_['merge']({},_0x385355,_0x1b2926[_0x5ee4('0x4b')]);return db['WhatsappQueue'][_0x5ee4('0x50')](_0x385355)['then'](handleEntityNotFound(_0x351547,null))[_0x5ee4('0x2c')](respondWithResult(_0x351547,null))[_0x5ee4('0x51')](handleError(_0x351547,null));};exports['create']=function(_0x425be4,_0x12cd62){return db[_0x5ee4('0x37')]['create'](_0x425be4['body'],{})['then'](function(_0x1e6347){var _0x37297b=_0x425be4[_0x5ee4('0x52')][_0x5ee4('0x2d')]({'plain':!![]});if(!_0x37297b)throw new Error(_0x5ee4('0x53'));if(_0x37297b[_0x5ee4('0x54')]==='user'){var _0x3093=_0x1e6347[_0x5ee4('0x2d')]({'plain':!![]});var _0x1759b3=_0x5ee4('0x2e');return db[_0x5ee4('0x55')]['find']({'where':{'name':_0x1759b3,'userProfileId':_0x37297b['userProfileId']},'raw':!![]})[_0x5ee4('0x2c')](function(_0x11fced){if(_0x11fced&&_0x11fced['autoAssociation']===0x0){return db[_0x5ee4('0x2f')]['create']({'name':_0x3093[_0x5ee4('0x34')],'resourceId':_0x3093['id'],'type':_0x11fced['name'],'sectionId':_0x11fced['id']},{})[_0x5ee4('0x2c')](function(){return _0x1e6347;});}else{return _0x1e6347;}})[_0x5ee4('0x51')](function(_0x2aff59){logger[_0x5ee4('0x32')](_0x5ee4('0x56'),_0x2aff59);throw _0x2aff59;});}return _0x1e6347;})[_0x5ee4('0x2c')](respondWithResult(_0x12cd62,0xc9))[_0x5ee4('0x51')](handleError(_0x12cd62,null));};exports[_0x5ee4('0x57')]=function(_0x14df4e,_0x233340){if(_0x14df4e['body']['id']){delete _0x14df4e[_0x5ee4('0x58')]['id'];}return db[_0x5ee4('0x37')][_0x5ee4('0x50')]({'where':{'id':_0x14df4e[_0x5ee4('0x59')]['id']}})[_0x5ee4('0x2c')](handleEntityNotFound(_0x233340,null))[_0x5ee4('0x2c')](saveUpdates(_0x14df4e[_0x5ee4('0x58')],null))['then'](respondWithResult(_0x233340,null))['catch'](handleError(_0x233340,null));};exports[_0x5ee4('0x30')]=function(_0x218c98,_0x16c4d9){return db[_0x5ee4('0x37')][_0x5ee4('0x50')]({'where':{'id':_0x218c98['params']['id']}})[_0x5ee4('0x2c')](handleEntityNotFound(_0x16c4d9,null))['then'](removeEntity(_0x16c4d9,null))[_0x5ee4('0x51')](handleError(_0x16c4d9,null));};exports['describe']=function(_0x56553b,_0x2dd6e1){return db[_0x5ee4('0x37')][_0x5ee4('0x5a')]()[_0x5ee4('0x2c')](respondWithResult(_0x2dd6e1,null))['catch'](handleError(_0x2dd6e1,null));};exports[_0x5ee4('0x5b')]=function(_0x37ee5c,_0x528328,_0x590351){var _0x1f0b3f={'raw':!![],'where':{}},_0x409405={},_0x3b51f6;return db[_0x5ee4('0x37')][_0x5ee4('0x5c')]({'where':{'id':_0x37ee5c[_0x5ee4('0x59')]['id']}})[_0x5ee4('0x2c')](handleEntityNotFound(_0x528328,null))[_0x5ee4('0x2c')](function(_0x3d734c){if(_0x3d734c){_0x3b51f6=_0x3d734c[_0x5ee4('0x2d')]({'plain':!![]});_0x409405['model']=_[_0x5ee4('0x3e')](db['UserWhatsappQueue'][_0x5ee4('0x38')]);_0x409405[_0x5ee4('0x3d')]=_[_0x5ee4('0x3e')](_0x37ee5c[_0x5ee4('0x3d')]);_0x409405[_0x5ee4('0x48')]=_['intersection'](_0x409405['model'],_0x409405[_0x5ee4('0x3d')]);_0x1f0b3f[_0x5ee4('0x40')]=_[_0x5ee4('0x3f')](_0x409405['model'],qs[_0x5ee4('0x41')](_0x37ee5c[_0x5ee4('0x3d')]['fields']));_0x1f0b3f[_0x5ee4('0x40')]=_0x1f0b3f[_0x5ee4('0x40')][_0x5ee4('0x42')]?_0x1f0b3f['attributes']:_0x409405[_0x5ee4('0x3c')];if(!_0x37ee5c[_0x5ee4('0x3d')][_0x5ee4('0x43')](_0x5ee4('0x44'))){_0x1f0b3f[_0x5ee4('0x25')]=qs['limit'](_0x37ee5c[_0x5ee4('0x3d')][_0x5ee4('0x25')]);_0x1f0b3f[_0x5ee4('0x27')]=qs[_0x5ee4('0x27')](_0x37ee5c['query'][_0x5ee4('0x27')]);}_0x1f0b3f['order']=qs[_0x5ee4('0x46')](_0x37ee5c['query'][_0x5ee4('0x46')]);_0x1f0b3f['where']=qs['filters'](_[_0x5ee4('0x5d')](_0x37ee5c[_0x5ee4('0x3d')],_0x409405[_0x5ee4('0x48')]));_0x1f0b3f[_0x5ee4('0x47')]['WhatsappQueueId']=_0x3d734c['id'];if(_0x37ee5c['query']['filter']){_0x1f0b3f[_0x5ee4('0x47')]=_[_0x5ee4('0x4a')](_0x1f0b3f[_0x5ee4('0x47')],{'$or':_[_0x5ee4('0x36')](_0x1f0b3f[_0x5ee4('0x40')],function(_0x5008ec){var _0x1aaf7d={};_0x1aaf7d[_0x5008ec]={'$like':'%'+_0x37ee5c[_0x5ee4('0x3d')][_0x5ee4('0x49')]+'%'};return _0x1aaf7d;})});}_0x1f0b3f=_[_0x5ee4('0x4a')]({},_0x1f0b3f,_0x37ee5c[_0x5ee4('0x4b')]);return db[_0x5ee4('0x5e')][_0x5ee4('0x4d')](_0x1f0b3f);}})[_0x5ee4('0x2c')](function(_0x232b49){if(_0x232b49){return db[_0x5ee4('0x5f')][_0x5ee4('0x60')]({'where':{'id':_[_0x5ee4('0x36')](_0x232b49,'UserId'),'role':_0x5ee4('0x61')},'attributes':['id',_0x5ee4('0x34'),_0x5ee4('0x62'),_0x5ee4('0x63'),_0x5ee4('0x64')]});}})[_0x5ee4('0x2c')](function(_0x80286e){if(_0x80286e){return{'count':_0x80286e[_0x5ee4('0x26')],'rows':_[_0x5ee4('0x36')](_0x80286e[_0x5ee4('0x4e')],function(_0x1edc14){return{'membername':_0x1edc14[_0x5ee4('0x34')],'UserId':_0x1edc14['id'],'queue_name':_0x3b51f6[_0x5ee4('0x34')],'WhatsappQueueId':_0x3b51f6['id'],'interface':util[_0x5ee4('0x65')](_0x5ee4('0x66'),_0x5ee4('0x67'),_0x1edc14[_0x5ee4('0x34')]),'penalty':0x0,'paused':_0x1edc14[_0x5ee4('0x62')],'createdAt':_0x1edc14['createdAt'],'updatedAt':_0x1edc14[_0x5ee4('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5ee4('0x2c')](respondWithFilteredResult(_0x528328,_0x1f0b3f))[_0x5ee4('0x51')](handleError(_0x528328,null));};exports[_0x5ee4('0x68')]=function(_0x3b1d00,_0x29da37,_0x1f8648){var _0x3e2c4f={};var _0x4e7b79={};var _0x9e4114;var _0x548a87;return db[_0x5ee4('0x37')][_0x5ee4('0x5c')]({'where':{'id':_0x3b1d00[_0x5ee4('0x59')]['id']}})[_0x5ee4('0x2c')](handleEntityNotFound(_0x29da37,null))[_0x5ee4('0x2c')](function(_0x20694f){if(_0x20694f){_0x9e4114=_0x20694f;_0x4e7b79[_0x5ee4('0x3c')]=_['keys'](db[_0x5ee4('0x69')][_0x5ee4('0x38')]);_0x4e7b79[_0x5ee4('0x3d')]=_['keys'](_0x3b1d00[_0x5ee4('0x3d')]);_0x4e7b79['filters']=_['intersection'](_0x4e7b79[_0x5ee4('0x3c')],_0x4e7b79[_0x5ee4('0x3d')]);_0x3e2c4f[_0x5ee4('0x40')]=_[_0x5ee4('0x3f')](_0x4e7b79[_0x5ee4('0x3c')],qs[_0x5ee4('0x41')](_0x3b1d00[_0x5ee4('0x3d')]['fields']));_0x3e2c4f[_0x5ee4('0x40')]=_0x3e2c4f[_0x5ee4('0x40')][_0x5ee4('0x42')]?_0x3e2c4f[_0x5ee4('0x40')]:_0x4e7b79[_0x5ee4('0x3c')];_0x3e2c4f['order']=qs[_0x5ee4('0x46')](_0x3b1d00[_0x5ee4('0x3d')][_0x5ee4('0x46')]);_0x3e2c4f['where']=qs[_0x5ee4('0x48')](_['pick'](_0x3b1d00[_0x5ee4('0x3d')],_0x4e7b79[_0x5ee4('0x48')]));if(_0x3b1d00['query'][_0x5ee4('0x49')]){_0x3e2c4f[_0x5ee4('0x47')]=_['merge'](_0x3e2c4f[_0x5ee4('0x47')],{'$or':_[_0x5ee4('0x36')](_0x3e2c4f[_0x5ee4('0x40')],function(_0x30f866){var _0x5d0112={};_0x5d0112[_0x30f866]={'$like':'%'+_0x3b1d00[_0x5ee4('0x3d')][_0x5ee4('0x49')]+'%'};return _0x5d0112;})});}_0x3e2c4f=_[_0x5ee4('0x4a')]({},_0x3e2c4f,_0x3b1d00[_0x5ee4('0x4b')]);return _0x9e4114[_0x5ee4('0x68')](_0x3e2c4f);}})[_0x5ee4('0x2c')](function(_0x29f17c){if(_0x29f17c){_0x548a87=_0x29f17c[_0x5ee4('0x42')];if(!_0x3b1d00[_0x5ee4('0x3d')][_0x5ee4('0x43')]('nolimit')){_0x3e2c4f['limit']=qs['limit'](_0x3b1d00[_0x5ee4('0x3d')][_0x5ee4('0x25')]);_0x3e2c4f[_0x5ee4('0x27')]=qs[_0x5ee4('0x27')](_0x3b1d00[_0x5ee4('0x3d')][_0x5ee4('0x27')]);}return _0x9e4114['getTeams'](_0x3e2c4f);}})[_0x5ee4('0x2c')](function(_0x54decd){if(_0x54decd){return _0x54decd?{'count':_0x548a87,'rows':_0x54decd}:null;}})[_0x5ee4('0x2c')](respondWithResult(_0x29da37,null))[_0x5ee4('0x51')](handleError(_0x29da37,null));};exports[_0x5ee4('0x6a')]=function(_0x20cb3d,_0x1fa009,_0x52accc){var _0x21afed=_0x20cb3d[_0x5ee4('0x58')][_0x5ee4('0x6b')];return db['Team'][_0x5ee4('0x4d')]({'where':{'id':_0x21afed},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x5ee4('0x34'),_0x5ee4('0x6c'),_0x5ee4('0x6d'),_0x5ee4('0x6e')],'raw':!![]}]})[_0x5ee4('0x2c')](function(_0x32fbb9){if(_0x32fbb9){var _0x43ce44=_[_0x5ee4('0x6f')](_0x32fbb9,function(_0x291390){var _0x13d572=_0x291390['get']({'plain':!![]});return _0x13d572[_0x5ee4('0x70')];});return db[_0x5ee4('0x37')][_0x5ee4('0x50')]({'where':{'id':_0x20cb3d[_0x5ee4('0x59')]['id']}})[_0x5ee4('0x2c')](function(_0x21ab0f){return db[_0x5ee4('0x71')][_0x5ee4('0x72')](function(_0x4eb87e){return _0x21ab0f['addTeams'](_0x21afed,{'transaction':_0x4eb87e})[_0x5ee4('0x2c')](function(){return BPromise[_0x5ee4('0x73')](_0x43ce44,function(_0xfd4dd6){return db['UserWhatsappQueue'][_0x5ee4('0x74')]({'where':{'UserId':_0xfd4dd6['id'],'WhatsappQueueId':_0x20cb3d['params']['id']},'transaction':_0x4eb87e});});})[_0x5ee4('0x2c')](function(){_0x43ce44[_0x5ee4('0x75')](function(_0x184c18){socket[_0x5ee4('0x76')](_0x5ee4('0x77'),{'UserId':_0x184c18['id'],'WhatsappQueueId':_0x21ab0f['id']});});});});});}})[_0x5ee4('0x2c')](respondWithStatusCode(_0x1fa009,null))[_0x5ee4('0x51')](handleError(_0x1fa009,null));};exports[_0x5ee4('0x78')]=function(_0x2e9be9,_0x1ba249,_0x555296){return db[_0x5ee4('0x69')][_0x5ee4('0x4d')]({'where':{'id':_0x2e9be9[_0x5ee4('0x3d')][_0x5ee4('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x5ee4('0x5f')],'as':_0x5ee4('0x70'),'attributes':['id'],'raw':!![]}]})[_0x5ee4('0x2c')](handleEntityNotFound(_0x1ba249,null))[_0x5ee4('0x2c')](function(_0x2ffaf7){var _0x28ed5a=_[_0x5ee4('0x36')](_0x2ffaf7,'id');var _0x2588f7=[];var _0x33ceed=[];var _0x2c9999=squel[_0x5ee4('0x79')]();_0x2c9999['field'](_0x5ee4('0x7a'))[_0x5ee4('0x7b')](_0x5ee4('0x7c'),'tq')['join'](_0x5ee4('0x7d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x5ee4('0x47')](_0x5ee4('0x7e'),_0x2e9be9['params']['id']);for(var _0x411c1f=0x0;_0x411c1f<_0x2ffaf7['length'];_0x411c1f+=0x1){let _0x1db6e3=_0x2ffaf7[_0x411c1f];for(var _0x27d408=0x0;_0x27d408<_0x1db6e3[_0x5ee4('0x70')][_0x5ee4('0x42')];_0x27d408+=0x1){let _0x22d556=_0x1db6e3[_0x5ee4('0x70')][_0x27d408];var _0x433ce6=_0x2c9999[_0x5ee4('0x7f')]();_0x433ce6[_0x5ee4('0x47')](_0x5ee4('0x80'),_0x22d556['id']);_0x33ceed['push'](db[_0x5ee4('0x71')][_0x5ee4('0x3d')](_0x433ce6['toString'](),{'type':db['sequelize'][_0x5ee4('0x81')][_0x5ee4('0x82')]})[_0x5ee4('0x2c')](function(_0x2e4b67){if(_0x2e4b67[_0x5ee4('0x42')]===0x1){return _0x22d556['id'];}else{var _0x5c0d4d=_[_0x5ee4('0x83')](_[_0x5ee4('0x36')](_0x2e4b67,_0x5ee4('0x84')),function(_0x84d359){return _[_0x5ee4('0x85')](_0x28ed5a,_0x84d359);});if(_0x5c0d4d){return _0x22d556['id'];}}}));}}return BPromise[_0x5ee4('0x86')](_0x33ceed)[_0x5ee4('0x2c')](function(_0x2cd5ff){_0x2588f7=_(_0x2588f7)[_0x5ee4('0x87')](_0x2cd5ff)['compact']()['value']();return db[_0x5ee4('0x37')][_0x5ee4('0x50')]({'where':{'id':_0x2e9be9[_0x5ee4('0x59')]['id']}})[_0x5ee4('0x2c')](function(_0x16feb4){return db['sequelize'][_0x5ee4('0x72')](function(_0x58927c){return _0x16feb4[_0x5ee4('0x78')](_0x2e9be9[_0x5ee4('0x3d')][_0x5ee4('0x6b')],{'transaction':_0x58927c})[_0x5ee4('0x2c')](function(){if(!_['isEmpty'](_0x2588f7)){return _0x16feb4[_0x5ee4('0x88')](_0x2588f7,{'transaction':_0x58927c});}})['then'](function(){_0x2588f7[_0x5ee4('0x75')](function(_0x1b4e2e){socket[_0x5ee4('0x76')](_0x5ee4('0x89'),{'UserId':_0x1b4e2e,'WhatsappQueueId':_0x16feb4['id']});});});});});});})['then'](respondWithStatusCode(_0x1ba249,null))['catch'](handleError(_0x1ba249,null));};exports[_0x5ee4('0x8a')]=function(_0x1891a2,_0x400d1e,_0x1d0975){return db[_0x5ee4('0x37')][_0x5ee4('0x50')]({'where':{'id':_0x1891a2[_0x5ee4('0x59')]['id']}})[_0x5ee4('0x2c')](handleEntityNotFound(_0x400d1e,null))[_0x5ee4('0x2c')](function(_0x1527ef){if(_0x1527ef){return _0x1527ef[_0x5ee4('0x8a')](_0x1891a2[_0x5ee4('0x58')][_0x5ee4('0x6b')],_[_0x5ee4('0x8b')](_0x1891a2['body'],[_0x5ee4('0x6b'),'id'])||{})['spread'](function(_0x25e4c8){for(var _0x4417ea=0x0;_0x4417ea<_0x1891a2['body'][_0x5ee4('0x6b')][_0x5ee4('0x42')];_0x4417ea+=0x1){socket[_0x5ee4('0x76')]('userWhatsappQueue:save',{'UserId':Number(_0x1891a2['body'][_0x5ee4('0x6b')][_0x4417ea]),'WhatsappQueueId':Number(_0x1891a2['params']['id'])});}return _0x25e4c8;});}})['then'](respondWithResult(_0x400d1e,null))[_0x5ee4('0x51')](handleError(_0x400d1e,null));};exports['removeAgents']=function(_0x3a80bd,_0x2a5ef6,_0xc6321a){return db['WhatsappQueue']['find']({'where':{'id':_0x3a80bd[_0x5ee4('0x59')]['id']}})[_0x5ee4('0x2c')](handleEntityNotFound(_0x2a5ef6,null))[_0x5ee4('0x2c')](function(_0x32b61f){if(_0x32b61f){return _0x32b61f[_0x5ee4('0x88')](_0x3a80bd[_0x5ee4('0x3d')][_0x5ee4('0x6b')])[_0x5ee4('0x2c')](function(){if(_[_0x5ee4('0x8c')](_0x3a80bd['query'][_0x5ee4('0x6b')])){for(var _0x226cae=0x0;_0x226cae<_0x3a80bd[_0x5ee4('0x3d')]['ids'][_0x5ee4('0x42')];_0x226cae+=0x1){socket[_0x5ee4('0x76')](_0x5ee4('0x89'),{'UserId':Number(_0x3a80bd[_0x5ee4('0x3d')][_0x5ee4('0x6b')][_0x226cae]),'WhatsappQueueId':Number(_0x3a80bd[_0x5ee4('0x59')]['id'])});}}else{socket[_0x5ee4('0x76')](_0x5ee4('0x89'),{'UserId':Number(_0x3a80bd[_0x5ee4('0x3d')]['ids']),'WhatsappQueueId':Number(_0x3a80bd[_0x5ee4('0x59')]['id'])});}});}})[_0x5ee4('0x2c')](respondWithStatusCode(_0x2a5ef6,null))[_0x5ee4('0x51')](handleError(_0x2a5ef6,null));};exports[_0x5ee4('0x8d')]=function(_0x48af2c,_0x12fff3,_0x3c558f){var _0x59feac={};var _0x46af91={};var _0x8b6117;var _0x57d2de;return db[_0x5ee4('0x37')][_0x5ee4('0x5c')]({'where':{'id':_0x48af2c[_0x5ee4('0x59')]['id']}})['then'](handleEntityNotFound(_0x12fff3,null))[_0x5ee4('0x2c')](function(_0x306b80){if(_0x306b80){_0x8b6117=_0x306b80;_0x46af91[_0x5ee4('0x3c')]=_[_0x5ee4('0x3e')](db[_0x5ee4('0x5f')][_0x5ee4('0x38')]);_0x46af91[_0x5ee4('0x3d')]=_[_0x5ee4('0x3e')](_0x48af2c[_0x5ee4('0x3d')]);_0x46af91[_0x5ee4('0x48')]=_[_0x5ee4('0x3f')](_0x46af91[_0x5ee4('0x3c')],_0x46af91[_0x5ee4('0x3d')]);_0x59feac['attributes']=_['intersection'](_0x46af91[_0x5ee4('0x3c')],qs[_0x5ee4('0x41')](_0x48af2c['query']['fields']));_0x59feac[_0x5ee4('0x40')]=_0x59feac[_0x5ee4('0x40')][_0x5ee4('0x42')]?_0x59feac['attributes']:_0x46af91[_0x5ee4('0x3c')];_0x59feac[_0x5ee4('0x45')]=qs[_0x5ee4('0x46')](_0x48af2c[_0x5ee4('0x3d')][_0x5ee4('0x46')]);_0x59feac[_0x5ee4('0x47')]=qs['filters'](_['pick'](_0x48af2c[_0x5ee4('0x3d')],_0x46af91[_0x5ee4('0x48')]));if(_0x48af2c[_0x5ee4('0x3d')][_0x5ee4('0x49')]){_0x59feac[_0x5ee4('0x47')]=_[_0x5ee4('0x4a')](_0x59feac['where'],{'$or':_[_0x5ee4('0x36')](_0x59feac[_0x5ee4('0x40')],function(_0x3025b0){var _0x158a8f={};_0x158a8f[_0x3025b0]={'$like':'%'+_0x48af2c[_0x5ee4('0x3d')][_0x5ee4('0x49')]+'%'};return _0x158a8f;})});}_0x59feac=_[_0x5ee4('0x4a')]({},_0x59feac,_0x48af2c['options']);return _0x8b6117[_0x5ee4('0x8d')](_0x59feac);}})[_0x5ee4('0x2c')](function(_0x22026a){if(_0x22026a){_0x57d2de=_0x22026a[_0x5ee4('0x42')];if(!_0x48af2c[_0x5ee4('0x3d')][_0x5ee4('0x43')](_0x5ee4('0x44'))){_0x59feac[_0x5ee4('0x25')]=qs['limit'](_0x48af2c[_0x5ee4('0x3d')]['limit']);_0x59feac[_0x5ee4('0x27')]=qs[_0x5ee4('0x27')](_0x48af2c[_0x5ee4('0x3d')][_0x5ee4('0x27')]);}return _0x8b6117[_0x5ee4('0x8d')](_0x59feac);}})['then'](function(_0x3bde34){if(_0x3bde34){return _0x3bde34?{'count':_0x57d2de,'rows':_0x3bde34}:null;}})['then'](respondWithResult(_0x12fff3,null))[_0x5ee4('0x51')](handleError(_0x12fff3,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 2f3d95a..44e9aa2 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 _0x9335=['WhatsappQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3636ac,_0x55f9c2){var _0x1589e9=function(_0x494d62){while(--_0x494d62){_0x3636ac['push'](_0x3636ac['shift']());}};_0x1589e9(++_0x55f9c2);}(_0x9335,0x7d));var _0x5933=function(_0xbbf5ef,_0x4e0a06){_0xbbf5ef=_0xbbf5ef-0x0;var _0xfc776=_0x9335[_0xbbf5ef];return _0xfc776;};'use strict';var EventEmitter=require(_0x5933('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x5933('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x5933('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5933('0x3'),'afterDestroy':_0x5933('0x4')};function emitEvent(_0x24290e){return function(_0x3f3b77,_0x16c5dd,_0x402fea){WhatsappQueueEvents['emit'](_0x24290e+':'+_0x3f3b77['id'],_0x3f3b77);WhatsappQueueEvents[_0x5933('0x5')](_0x24290e,_0x3f3b77);_0x402fea(null);};}for(var e in events){if(events[_0x5933('0x6')](e)){var event=events[e];WhatsappQueue[_0x5933('0x7')](e,emitEvent(event));}}module[_0x5933('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xa3d8=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue'];(function(_0x47a7b8,_0x58c838){var _0x5eb161=function(_0x1c38ba){while(--_0x1c38ba){_0x47a7b8['push'](_0x47a7b8['shift']());}};_0x5eb161(++_0x58c838);}(_0xa3d8,0xd5));var _0x8a3d=function(_0x563eae,_0xbc18ba){_0x563eae=_0x563eae-0x0;var _0xa76934=_0xa3d8[_0x563eae];return _0xa76934;};'use strict';var EventEmitter=require(_0x8a3d('0x0'));var WhatsappQueue=require(_0x8a3d('0x1'))['db'][_0x8a3d('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8a3d('0x3'),'afterDestroy':_0x8a3d('0x4')};function emitEvent(_0x48ccd1){return function(_0x463dae,_0x529d32,_0xceec6d){WhatsappQueueEvents[_0x8a3d('0x5')](_0x48ccd1+':'+_0x463dae['id'],_0x463dae);WhatsappQueueEvents[_0x8a3d('0x5')](_0x48ccd1,_0x463dae);_0xceec6d(null);};}for(var e in events){if(events[_0x8a3d('0x6')](e)){var event=events[e];WhatsappQueue[_0x8a3d('0x7')](e,emitEvent(event));}}module[_0x8a3d('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index bdc2cf4..20876ba 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 _0x9fc3=['path','rimraf','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x32b30c,_0x2d5ec8){var _0xcfc212=function(_0x42e668){while(--_0x42e668){_0x32b30c['push'](_0x32b30c['shift']());}};_0xcfc212(++_0x2d5ec8);}(_0x9fc3,0x14a));var _0x39fc=function(_0x53f869,_0x34e05d){_0x53f869=_0x53f869-0x0;var _0x53643b=_0x9fc3[_0x53f869];return _0x53643b;};'use strict';var _=require(_0x39fc('0x0'));var util=require(_0x39fc('0x1'));var logger=require(_0x39fc('0x2'))(_0x39fc('0x3'));var moment=require(_0x39fc('0x4'));var BPromise=require(_0x39fc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x39fc('0x6'));var rimraf=require(_0x39fc('0x7'));var config=require('../../config/environment');var attributes=require(_0x39fc('0x8'));module[_0x39fc('0x9')]=function(_0x42463b,_0x456626){return _0x42463b['define'](_0x39fc('0xa'),attributes,{'tableName':_0x39fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa37e=['lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','exports','define','WhatsappQueue','whatsapp_queues'];(function(_0x10e3f6,_0x255640){var _0x44ab4e=function(_0x58d6d6){while(--_0x58d6d6){_0x10e3f6['push'](_0x10e3f6['shift']());}};_0x44ab4e(++_0x255640);}(_0xa37e,0x13f));var _0xea37=function(_0xa16a9c,_0x650067){_0xa16a9c=_0xa16a9c-0x0;var _0x47bdc4=_0xa37e[_0xa16a9c];return _0x47bdc4;};'use strict';var _=require(_0xea37('0x0'));var util=require(_0xea37('0x1'));var logger=require(_0xea37('0x2'))(_0xea37('0x3'));var moment=require(_0xea37('0x4'));var BPromise=require(_0xea37('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xea37('0x6'));var attributes=require('./whatsappQueue.attributes');module[_0xea37('0x7')]=function(_0x3c8ce5,_0x351cf4){return _0x3c8ce5[_0xea37('0x8')](_0xea37('0x9'),attributes,{'tableName':_0xea37('0xa'),'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 f97d94c..7f6f6fd 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 _0x1332=['../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','options','raw','where','attributes','include','map','model','ShowWhatsappQueue','find','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2e20aa,_0xc7f24b){var _0x563564=function(_0x54b0e1){while(--_0x54b0e1){_0x2e20aa['push'](_0x2e20aa['shift']());}};_0x563564(++_0xc7f24b);}(_0x1332,0x15a));var _0x2133=function(_0x164879,_0x2844e3){_0x164879=_0x164879-0x0;var _0x5919eb=_0x1332[_0x164879];return _0x5919eb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2133('0x0'));var BPromise=require('bluebird');var rs=require(_0x2133('0x1'));var fs=require('fs');var Redis=require(_0x2133('0x2'));var db=require(_0x2133('0x3'))['db'];var utils=require(_0x2133('0x4'));var logger=require(_0x2133('0x5'))(_0x2133('0x6'));var config=require(_0x2133('0x7'));var jayson=require(_0x2133('0x8'));var client=jayson['client'][_0x2133('0x9')]({'port':0x232a});config[_0x2133('0xa')]=_[_0x2133('0xb')](config[_0x2133('0xa')],{'host':_0x2133('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2133('0xd'))[_0x2133('0xe')](socket);function respondWithRpcPromise(_0x432115,_0xbaed06,_0x58e256){return new BPromise(function(_0x46609f,_0x4370fc){return client[_0x2133('0xf')](_0x432115,_0x58e256)[_0x2133('0x10')](function(_0xce89e8){logger[_0x2133('0x11')](_0x2133('0x12'),_0xbaed06,_0x2133('0x13'));logger[_0x2133('0x14')](_0x2133('0x15'),_0xbaed06,'request\x20sent',JSON[_0x2133('0x16')](_0xce89e8));if(_0xce89e8[_0x2133('0x17')]){if(_0xce89e8[_0x2133('0x17')][_0x2133('0x18')]===0x1f4){logger[_0x2133('0x17')](_0x2133('0x12'),_0xbaed06,_0xce89e8['error'][_0x2133('0x19')]);return _0x4370fc(_0xce89e8[_0x2133('0x17')][_0x2133('0x19')]);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0xbaed06,_0xce89e8[_0x2133('0x17')]['message']);return _0x46609f(_0xce89e8['error'][_0x2133('0x19')]);}else{logger[_0x2133('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0xbaed06,_0x2133('0x13'));_0x46609f(_0xce89e8[_0x2133('0x1a')][_0x2133('0x19')]);}})[_0x2133('0x1b')](function(_0x490d3c){logger[_0x2133('0x17')](_0x2133('0x12'),_0xbaed06,_0x490d3c);_0x4370fc(_0x490d3c);});});}exports[_0x2133('0x1c')]=function(_0x551b96){var _0x1ad033=this;return new Promise(function(_0x5125e7,_0x2f0ddc){return db[_0x2133('0x1d')]['findAll']({'raw':_0x551b96[_0x2133('0x1e')]?_0x551b96['options'][_0x2133('0x1f')]===undefined?!![]:![]:!![],'where':_0x551b96[_0x2133('0x1e')]?_0x551b96[_0x2133('0x1e')][_0x2133('0x20')]||null:null,'attributes':_0x551b96[_0x2133('0x1e')]?_0x551b96[_0x2133('0x1e')][_0x2133('0x21')]||null:null,'limit':_0x551b96['options']?_0x551b96[_0x2133('0x1e')]['limit']||null:null,'include':_0x551b96['options']?_0x551b96['options'][_0x2133('0x22')]?_[_0x2133('0x23')](_0x551b96[_0x2133('0x1e')][_0x2133('0x22')],function(_0xfe289e){return{'model':db[_0xfe289e['model']],'as':_0xfe289e['as'],'attributes':_0xfe289e[_0x2133('0x21')],'include':_0xfe289e[_0x2133('0x22')]?_['map'](_0xfe289e[_0x2133('0x22')],function(_0x474b49){return{'model':db[_0x474b49[_0x2133('0x24')]],'as':_0x474b49['as'],'attributes':_0x474b49[_0x2133('0x21')],'include':_0x474b49[_0x2133('0x22')]?_[_0x2133('0x23')](_0x474b49[_0x2133('0x22')],function(_0x3a388f){return{'model':db[_0x3a388f[_0x2133('0x24')]],'as':_0x3a388f['as'],'attributes':_0x3a388f['attributes']};}):[]};}):[]};}):[]:[]})[_0x2133('0x10')](function(_0x3ae5a1){logger[_0x2133('0x11')](_0x2133('0x1c'),_0x551b96);logger['debug'](_0x2133('0x1c'),_0x551b96,JSON['stringify'](_0x3ae5a1));_0x5125e7(_0x3ae5a1);})[_0x2133('0x1b')](function(_0xf6fbbd){logger[_0x2133('0x17')](_0x2133('0x1c'),_0xf6fbbd[_0x2133('0x19')],_0x551b96);_0x2f0ddc(_0x1ad033[_0x2133('0x17')](0x1f4,_0xf6fbbd[_0x2133('0x19')]));});});};exports[_0x2133('0x25')]=function(_0x5a2f0a){var _0x2aada0=this;return new Promise(function(_0x5609dc,_0x260e46){return db[_0x2133('0x1d')][_0x2133('0x26')]({'raw':_0x5a2f0a[_0x2133('0x1e')]?_0x5a2f0a['options']['raw']===undefined?!![]:![]:!![],'where':_0x5a2f0a[_0x2133('0x1e')]?_0x5a2f0a[_0x2133('0x1e')][_0x2133('0x20')]||null:null,'attributes':_0x5a2f0a[_0x2133('0x1e')]?_0x5a2f0a[_0x2133('0x1e')]['attributes']||null:null,'include':_0x5a2f0a[_0x2133('0x1e')]?_0x5a2f0a[_0x2133('0x1e')][_0x2133('0x22')]?_[_0x2133('0x23')](_0x5a2f0a[_0x2133('0x1e')][_0x2133('0x22')],function(_0x56be6e){return{'model':db[_0x56be6e[_0x2133('0x24')]],'as':_0x56be6e['as'],'attributes':_0x56be6e[_0x2133('0x21')],'include':_0x56be6e[_0x2133('0x22')]?_[_0x2133('0x23')](_0x56be6e['include'],function(_0x48b82a){return{'model':db[_0x48b82a[_0x2133('0x24')]],'as':_0x48b82a['as'],'attributes':_0x48b82a['attributes'],'include':_0x48b82a[_0x2133('0x22')]?_[_0x2133('0x23')](_0x48b82a[_0x2133('0x22')],function(_0x546751){return{'model':db[_0x546751[_0x2133('0x24')]],'as':_0x546751['as'],'attributes':_0x546751[_0x2133('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2133('0x10')](function(_0x5f3670){logger[_0x2133('0x11')]('ShowWhatsappQueue',_0x5a2f0a);logger[_0x2133('0x14')](_0x2133('0x25'),_0x5a2f0a,JSON['stringify'](_0x5f3670));_0x5609dc(_0x5f3670);})[_0x2133('0x1b')](function(_0x3ee6fd){logger[_0x2133('0x17')]('ShowWhatsappQueue',_0x3ee6fd[_0x2133('0x19')],_0x5a2f0a);_0x260e46(_0x2aada0[_0x2133('0x17')](0x1f4,_0x3ee6fd[_0x2133('0x19')]));});});}; \ No newline at end of file +var _0x28f5=['map','include','model','then','debug','ShowWhatsappQueue','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit'];(function(_0xaa694a,_0x198a20){var _0x73f51b=function(_0x198dcd){while(--_0x198dcd){_0xaa694a['push'](_0xaa694a['shift']());}};_0x73f51b(++_0x198a20);}(_0x28f5,0x1ab));var _0x528f=function(_0xbe3ff0,_0x51d3f2){_0xbe3ff0=_0xbe3ff0-0x0;var _0x15b337=_0x28f5[_0xbe3ff0];return _0x15b337;};'use strict';var _=require(_0x528f('0x0'));var util=require(_0x528f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x528f('0x2'));var fs=require('fs');var Redis=require(_0x528f('0x3'));var db=require(_0x528f('0x4'))['db'];var utils=require(_0x528f('0x5'));var logger=require('../../config/logger')(_0x528f('0x6'));var config=require(_0x528f('0x7'));var jayson=require(_0x528f('0x8'));var client=jayson[_0x528f('0x9')][_0x528f('0xa')]({'port':0x232a});config[_0x528f('0xb')]=_[_0x528f('0xc')](config['redis'],{'host':_0x528f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x528f('0xb')]));require(_0x528f('0xe'))[_0x528f('0xf')](socket);function respondWithRpcPromise(_0x3476cd,_0x287981,_0x48c594){return new BPromise(function(_0x4219e3,_0x1e747a){return client[_0x528f('0x10')](_0x3476cd,_0x48c594)['then'](function(_0x5911cd){logger[_0x528f('0x11')](_0x528f('0x12'),_0x287981,'request\x20sent');logger['debug'](_0x528f('0x13'),_0x287981,_0x528f('0x14'),JSON[_0x528f('0x15')](_0x5911cd));if(_0x5911cd[_0x528f('0x16')]){if(_0x5911cd[_0x528f('0x16')][_0x528f('0x17')]===0x1f4){logger[_0x528f('0x16')](_0x528f('0x12'),_0x287981,_0x5911cd['error'][_0x528f('0x18')]);return _0x1e747a(_0x5911cd['error'][_0x528f('0x18')]);}logger[_0x528f('0x16')](_0x528f('0x12'),_0x287981,_0x5911cd['error'][_0x528f('0x18')]);return _0x4219e3(_0x5911cd[_0x528f('0x16')][_0x528f('0x18')]);}else{logger[_0x528f('0x11')](_0x528f('0x12'),_0x287981,_0x528f('0x14'));_0x4219e3(_0x5911cd[_0x528f('0x19')][_0x528f('0x18')]);}})[_0x528f('0x1a')](function(_0x133324){logger[_0x528f('0x16')](_0x528f('0x12'),_0x287981,_0x133324);_0x1e747a(_0x133324);});});}exports[_0x528f('0x1b')]=function(_0x2e8260){var _0x208b67=this;return new Promise(function(_0x126b57,_0x487528){return db[_0x528f('0x1c')][_0x528f('0x1d')]({'raw':_0x2e8260[_0x528f('0x1e')]?_0x2e8260['options'][_0x528f('0x1f')]===undefined?!![]:![]:!![],'where':_0x2e8260['options']?_0x2e8260['options'][_0x528f('0x20')]||null:null,'attributes':_0x2e8260[_0x528f('0x1e')]?_0x2e8260['options'][_0x528f('0x21')]||null:null,'limit':_0x2e8260[_0x528f('0x1e')]?_0x2e8260[_0x528f('0x1e')][_0x528f('0x22')]||null:null,'include':_0x2e8260[_0x528f('0x1e')]?_0x2e8260[_0x528f('0x1e')]['include']?_[_0x528f('0x23')](_0x2e8260[_0x528f('0x1e')][_0x528f('0x24')],function(_0x2528bd){return{'model':db[_0x2528bd[_0x528f('0x25')]],'as':_0x2528bd['as'],'attributes':_0x2528bd['attributes'],'include':_0x2528bd[_0x528f('0x24')]?_['map'](_0x2528bd['include'],function(_0x1a8d2a){return{'model':db[_0x1a8d2a['model']],'as':_0x1a8d2a['as'],'attributes':_0x1a8d2a[_0x528f('0x21')],'include':_0x1a8d2a[_0x528f('0x24')]?_[_0x528f('0x23')](_0x1a8d2a[_0x528f('0x24')],function(_0x4f2882){return{'model':db[_0x4f2882[_0x528f('0x25')]],'as':_0x4f2882['as'],'attributes':_0x4f2882['attributes']};}):[]};}):[]};}):[]:[]})[_0x528f('0x26')](function(_0x52cd14){logger[_0x528f('0x11')](_0x528f('0x1b'),_0x2e8260);logger[_0x528f('0x27')](_0x528f('0x1b'),_0x2e8260,JSON[_0x528f('0x15')](_0x52cd14));_0x126b57(_0x52cd14);})[_0x528f('0x1a')](function(_0x166054){logger[_0x528f('0x16')](_0x528f('0x1b'),_0x166054['message'],_0x2e8260);_0x487528(_0x208b67['error'](0x1f4,_0x166054[_0x528f('0x18')]));});});};exports[_0x528f('0x28')]=function(_0x315bf7){var _0x47f7a3=this;return new Promise(function(_0x4e0b2b,_0x2068e2){return db[_0x528f('0x1c')][_0x528f('0x29')]({'raw':_0x315bf7[_0x528f('0x1e')]?_0x315bf7[_0x528f('0x1e')][_0x528f('0x1f')]===undefined?!![]:![]:!![],'where':_0x315bf7['options']?_0x315bf7[_0x528f('0x1e')][_0x528f('0x20')]||null:null,'attributes':_0x315bf7[_0x528f('0x1e')]?_0x315bf7[_0x528f('0x1e')][_0x528f('0x21')]||null:null,'include':_0x315bf7[_0x528f('0x1e')]?_0x315bf7[_0x528f('0x1e')][_0x528f('0x24')]?_['map'](_0x315bf7[_0x528f('0x1e')][_0x528f('0x24')],function(_0x20b149){return{'model':db[_0x20b149['model']],'as':_0x20b149['as'],'attributes':_0x20b149[_0x528f('0x21')],'include':_0x20b149[_0x528f('0x24')]?_[_0x528f('0x23')](_0x20b149[_0x528f('0x24')],function(_0x395373){return{'model':db[_0x395373[_0x528f('0x25')]],'as':_0x395373['as'],'attributes':_0x395373[_0x528f('0x21')],'include':_0x395373[_0x528f('0x24')]?_[_0x528f('0x23')](_0x395373['include'],function(_0x21239d){return{'model':db[_0x21239d[_0x528f('0x25')]],'as':_0x21239d['as'],'attributes':_0x21239d[_0x528f('0x21')]};}):[]};}):[]};}):[]:[]})[_0x528f('0x26')](function(_0x411502){logger[_0x528f('0x11')]('ShowWhatsappQueue',_0x315bf7);logger[_0x528f('0x27')](_0x528f('0x28'),_0x315bf7,JSON['stringify'](_0x411502));_0x4e0b2b(_0x411502);})['catch'](function(_0x56022e){logger['error']('ShowWhatsappQueue',_0x56022e[_0x528f('0x18')],_0x315bf7);_0x2068e2(_0x47f7a3[_0x528f('0x16')](0x1f4,_0x56022e['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index b9e7838..cd72179 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 _0xe530=['register','whatsappQueue:','emit','removeListener'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0xe530,0x162));var _0x0e53=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xe530[_0x2b4411];return _0x8e41ef;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=['save','remove','update'];function createListener(_0x2fc5a7,_0x49f79c){return function(_0x25696d){_0x49f79c[_0x0e53('0x0')](_0x2fc5a7,_0x25696d);};}function removeListener(_0x383806,_0x716420){return function(){WhatsappQueueEvents[_0x0e53('0x1')](_0x383806,_0x716420);};}exports[_0x0e53('0x2')]=function(_0x545253){for(var _0x3b1c30=0x0,_0x107574=events['length'];_0x3b1c30<_0x107574;_0x3b1c30++){var _0x3fc3e7=events[_0x3b1c30];var _0x3d74b4=createListener(_0x0e53('0x3')+_0x3fc3e7,_0x545253);WhatsappQueueEvents['on'](_0x3fc3e7,_0x3d74b4);}}; \ No newline at end of file +var _0x2394=['emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','remove','update'];(function(_0x42e35e,_0x27b4d6){var _0x54a49c=function(_0x1e2366){while(--_0x1e2366){_0x42e35e['push'](_0x42e35e['shift']());}};_0x54a49c(++_0x27b4d6);}(_0x2394,0x1e2));var _0x4239=function(_0x5bc9d4,_0x3e0a1a){_0x5bc9d4=_0x5bc9d4-0x0;var _0xae536b=_0x2394[_0x5bc9d4];return _0xae536b;};'use strict';var WhatsappQueueEvents=require(_0x4239('0x0'));var events=[_0x4239('0x1'),_0x4239('0x2'),_0x4239('0x3')];function createListener(_0x50e93a,_0x7d7256){return function(_0x295950){_0x7d7256[_0x4239('0x4')](_0x50e93a,_0x295950);};}function removeListener(_0x50fa90,_0x1f1372){return function(){WhatsappQueueEvents[_0x4239('0x5')](_0x50fa90,_0x1f1372);};}exports[_0x4239('0x6')]=function(_0x4fde35){for(var _0x16a29d=0x0,_0x2a373a=events[_0x4239('0x7')];_0x16a29d<_0x2a373a;_0x16a29d++){var _0x53fff8=events[_0x16a29d];var _0x4a2824=createListener(_0x4239('0x8')+_0x53fff8,_0x4fde35);WhatsappQueueEvents['on'](_0x53fff8,_0x4a2824);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index be140ec..fa18669 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 _0x6847=['isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappQueueReport.controller','index','get','/describe'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6847,0x164));var _0x7684=function(_0x204eb7,_0x4974c3){_0x204eb7=_0x204eb7-0x0;var _0x37e444=_0x6847[_0x204eb7];return _0x37e444;};'use strict';var multer=require(_0x7684('0x0'));var util=require(_0x7684('0x1'));var path=require(_0x7684('0x2'));var timeout=require(_0x7684('0x3'));var express=require(_0x7684('0x4'));var router=express[_0x7684('0x5')]();var fs_extra=require(_0x7684('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7684('0x7'));var controller=require(_0x7684('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7684('0x9')]);router[_0x7684('0xa')](_0x7684('0xb'),auth[_0x7684('0xc')](),controller[_0x7684('0xd')]);router[_0x7684('0xa')](_0x7684('0xe'),auth[_0x7684('0xc')](),controller[_0x7684('0xf')]);router[_0x7684('0x10')]('/',auth[_0x7684('0xc')](),controller[_0x7684('0x11')]);router[_0x7684('0x12')](_0x7684('0xe'),auth['isAuthenticated'](),controller[_0x7684('0x13')]);router[_0x7684('0x14')](_0x7684('0xe'),auth['isAuthenticated'](),controller[_0x7684('0x15')]);module[_0x7684('0x16')]=router; \ No newline at end of file +var _0xcc73=['post','create','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','index','describe','/:id','isAuthenticated','show'];(function(_0xe9ee36,_0x4c1b34){var _0x5ab0bd=function(_0x259c20){while(--_0x259c20){_0xe9ee36['push'](_0xe9ee36['shift']());}};_0x5ab0bd(++_0x4c1b34);}(_0xcc73,0x195));var _0x3cc7=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xcc73[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x3cc7('0x0'));var util=require(_0x3cc7('0x1'));var path=require(_0x3cc7('0x2'));var timeout=require('connect-timeout');var express=require(_0x3cc7('0x3'));var router=express[_0x3cc7('0x4')]();var fs_extra=require(_0x3cc7('0x5'));var auth=require(_0x3cc7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3cc7('0x7'));var controller=require(_0x3cc7('0x8'));router[_0x3cc7('0x9')]('/',auth['isAuthenticated'](),controller[_0x3cc7('0xa')]);router[_0x3cc7('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x3cc7('0xb')]);router[_0x3cc7('0x9')](_0x3cc7('0xc'),auth[_0x3cc7('0xd')](),controller[_0x3cc7('0xe')]);router[_0x3cc7('0xf')]('/',auth['isAuthenticated'](),controller[_0x3cc7('0x10')]);router['put']('/:id',auth[_0x3cc7('0xd')](),controller['update']);router[_0x3cc7('0x11')](_0x3cc7('0xc'),auth['isAuthenticated'](),controller[_0x3cc7('0x12')]);module[_0x3cc7('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index f3485d5..0118694 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(_0x6236fc,_0x76e1cd){var _0x31b1dd=function(_0x3bd247){while(--_0x3bd247){_0x6236fc['push'](_0x6236fc['shift']());}};_0x31b1dd(++_0x76e1cd);}(_0x7a54,0x106));var _0x47a5=function(_0x3e43b6,_0x4172c5){_0x3e43b6=_0x3e43b6-0x0;var _0x814afe=_0x7a54[_0x3e43b6];return _0x814afe;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x376df2,_0x4e4af0){var _0x3d818d=function(_0x51faaf){while(--_0x51faaf){_0x376df2['push'](_0x376df2['shift']());}};_0x3d818d(++_0x4e4af0);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index a90559b..da7515f 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 _0x4b17=['save','update','then','destroy','end','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','show','params','rawAttributes','options','find','catch','create','body','describe','eml-format','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','Content-Range','apply'];(function(_0x38ea39,_0xfae870){var _0x1bf05f=function(_0xbb9e1b){while(--_0xbb9e1b){_0x38ea39['push'](_0x38ea39['shift']());}};_0x1bf05f(++_0xfae870);}(_0x4b17,0x10f));var _0x74b1=function(_0x69a451,_0x49fd37){_0x69a451=_0x69a451-0x0;var _0x3d6ef5=_0x4b17[_0x69a451];return _0x3d6ef5;};'use strict';var emlformat=require(_0x74b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x74b1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74b1('0x2'));var moment=require(_0x74b1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x74b1('0x4'));var util=require('util');var path=require('path');var sox=require(_0x74b1('0x5'));var csv=require(_0x74b1('0x6'));var ejs=require(_0x74b1('0x7'));var fs=require('fs');var fs_extra=require(_0x74b1('0x8'));var _=require(_0x74b1('0x9'));var squel=require(_0x74b1('0xa'));var crypto=require(_0x74b1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x74b1('0xc'));var toCsv=require(_0x74b1('0x6'));var querystring=require(_0x74b1('0xd'));var Papa=require(_0x74b1('0xe'));var Redis=require(_0x74b1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x74b1('0x10'));var as=require(_0x74b1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x74b1('0x12'))(_0x74b1('0x13'));var utils=require(_0x74b1('0x14'));var config=require(_0x74b1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x74b1('0x16'))['db'];function respondWithStatusCode(_0x5cfe85,_0x5f2865){_0x5f2865=_0x5f2865||0xcc;return function(_0x239d04){if(_0x239d04){return _0x5cfe85[_0x74b1('0x17')](_0x5f2865);}return _0x5cfe85['status'](_0x5f2865)['end']();};}function respondWithResult(_0x500ce2,_0x86390){_0x86390=_0x86390||0xc8;return function(_0x5c12eb){if(_0x5c12eb){return _0x500ce2['status'](_0x86390)[_0x74b1('0x18')](_0x5c12eb);}};}function respondWithFilteredResult(_0x12a2c0,_0x3779c5){return function(_0x420662){if(_0x420662){var _0x16b147=typeof _0x3779c5[_0x74b1('0x19')]==='undefined'&&typeof _0x3779c5[_0x74b1('0x1a')]===_0x74b1('0x1b');var _0x1a0851=_0x420662[_0x74b1('0x1c')];var _0xde2736=_0x16b147?0x0:_0x3779c5[_0x74b1('0x19')];var _0x1ab838=_0x16b147?_0x420662['count']:_0x3779c5[_0x74b1('0x19')]+_0x3779c5[_0x74b1('0x1a')];var _0x524ece;if(_0x1ab838>=_0x1a0851){_0x1ab838=_0x1a0851;_0x524ece=0xc8;}else{_0x524ece=0xce;}_0x12a2c0[_0x74b1('0x1d')](_0x524ece);return _0x12a2c0[_0x74b1('0x1e')](_0x74b1('0x1f'),_0xde2736+'-'+_0x1ab838+'/'+_0x1a0851)[_0x74b1('0x18')](_0x420662);}return null;};}function patchUpdates(_0x13bb44){return function(_0x33fee9){try{jsonpatch[_0x74b1('0x20')](_0x33fee9,_0x13bb44,!![]);}catch(_0xaac5f7){return BPromise['reject'](_0xaac5f7);}return _0x33fee9[_0x74b1('0x21')]();};}function saveUpdates(_0x4f1ec9,_0x5da0f7){return function(_0x481bf2){if(_0x481bf2){return _0x481bf2[_0x74b1('0x22')](_0x4f1ec9)[_0x74b1('0x23')](function(_0x405a22){return _0x405a22;});}return null;};}function removeEntity(_0x44bf7e,_0x563781){return function(_0x4ee88b){if(_0x4ee88b){return _0x4ee88b[_0x74b1('0x24')]()['then'](function(){_0x44bf7e[_0x74b1('0x1d')](0xcc)[_0x74b1('0x25')]();});}};}function handleEntityNotFound(_0xb5af0,_0x14a651){return function(_0x3239d8){if(!_0x3239d8){_0xb5af0[_0x74b1('0x17')](0x194);}return _0x3239d8;};}function handleError(_0x115918,_0x33fa8e){_0x33fa8e=_0x33fa8e||0x1f4;return function(_0x4c7f05){logger[_0x74b1('0x26')](_0x4c7f05[_0x74b1('0x27')]);if(_0x4c7f05[_0x74b1('0x28')]){delete _0x4c7f05['name'];}_0x115918[_0x74b1('0x1d')](_0x33fa8e)[_0x74b1('0x29')](_0x4c7f05);};}exports[_0x74b1('0x2a')]=function(_0x1b011a,_0x26d9f1){var _0x273ff1={},_0x436eda={},_0x3ce043={'count':0x0,'rows':[]};var _0x4fbe3d=_[_0x74b1('0x2b')](db[_0x74b1('0x2c')]['rawAttributes'],function(_0x543b5){return{'name':_0x543b5[_0x74b1('0x2d')],'type':_0x543b5[_0x74b1('0x2e')]['key']};});_0x436eda[_0x74b1('0x2f')]=_[_0x74b1('0x2b')](_0x4fbe3d,'name');_0x436eda[_0x74b1('0x30')]=_[_0x74b1('0x31')](_0x1b011a[_0x74b1('0x30')]);_0x436eda[_0x74b1('0x32')]=_[_0x74b1('0x33')](_0x436eda[_0x74b1('0x2f')],_0x436eda[_0x74b1('0x30')]);_0x273ff1[_0x74b1('0x34')]=_['intersection'](_0x436eda[_0x74b1('0x2f')],qs['fields'](_0x1b011a['query'][_0x74b1('0x35')]));_0x273ff1['attributes']=_0x273ff1['attributes'][_0x74b1('0x36')]?_0x273ff1[_0x74b1('0x34')]:_0x436eda[_0x74b1('0x2f')];if(!_0x1b011a[_0x74b1('0x30')][_0x74b1('0x37')](_0x74b1('0x38'))){_0x273ff1[_0x74b1('0x1a')]=qs[_0x74b1('0x1a')](_0x1b011a['query']['limit']);_0x273ff1['offset']=qs[_0x74b1('0x19')](_0x1b011a['query']['offset']);}_0x273ff1[_0x74b1('0x39')]=qs[_0x74b1('0x3a')](_0x1b011a[_0x74b1('0x30')]['sort']);_0x273ff1[_0x74b1('0x3b')]=qs['filters'](_[_0x74b1('0x3c')](_0x1b011a[_0x74b1('0x30')],_0x436eda['filters']),_0x4fbe3d);if(_0x1b011a['query'][_0x74b1('0x3d')]){_0x273ff1[_0x74b1('0x3b')]=_['merge'](_0x273ff1['where'],{'$or':_[_0x74b1('0x2b')](_0x4fbe3d,function(_0x5298f6){if(_0x5298f6[_0x74b1('0x2e')]!==_0x74b1('0x3e')){var _0x15e695={};_0x15e695[_0x5298f6[_0x74b1('0x28')]]={'$like':'%'+_0x1b011a[_0x74b1('0x30')]['filter']+'%'};return _0x15e695;}})});}_0x273ff1=_[_0x74b1('0x3f')]({},_0x273ff1,_0x1b011a['options']);var _0x41a78b={'where':_0x273ff1['where']};return db[_0x74b1('0x2c')]['count'](_0x41a78b)['then'](function(_0xcdb873){_0x3ce043[_0x74b1('0x1c')]=_0xcdb873;if(_0x1b011a[_0x74b1('0x30')]['includeAll']){_0x273ff1[_0x74b1('0x40')]=[{'all':!![]}];}return db[_0x74b1('0x2c')][_0x74b1('0x41')](_0x273ff1);})['then'](function(_0xfecdc){_0x3ce043[_0x74b1('0x42')]=_0xfecdc;return _0x3ce043;})['then'](respondWithFilteredResult(_0x26d9f1,_0x273ff1))['catch'](handleError(_0x26d9f1,null));};exports[_0x74b1('0x43')]=function(_0x2dcaf6,_0x416c8d){var _0x444870={'raw':!![],'where':{'id':_0x2dcaf6[_0x74b1('0x44')]['id']}},_0x1d9f5b={};_0x1d9f5b[_0x74b1('0x2f')]=_['keys'](db[_0x74b1('0x2c')][_0x74b1('0x45')]);_0x1d9f5b[_0x74b1('0x30')]=_[_0x74b1('0x31')](_0x2dcaf6[_0x74b1('0x30')]);_0x1d9f5b['filters']=_[_0x74b1('0x33')](_0x1d9f5b[_0x74b1('0x2f')],_0x1d9f5b['query']);_0x444870['attributes']=_[_0x74b1('0x33')](_0x1d9f5b[_0x74b1('0x2f')],qs['fields'](_0x2dcaf6[_0x74b1('0x30')][_0x74b1('0x35')]));_0x444870[_0x74b1('0x34')]=_0x444870[_0x74b1('0x34')][_0x74b1('0x36')]?_0x444870[_0x74b1('0x34')]:_0x1d9f5b[_0x74b1('0x2f')];if(_0x2dcaf6['query']['includeAll']){_0x444870['include']=[{'all':!![]}];}_0x444870=_[_0x74b1('0x3f')]({},_0x444870,_0x2dcaf6[_0x74b1('0x46')]);return db[_0x74b1('0x2c')][_0x74b1('0x47')](_0x444870)[_0x74b1('0x23')](handleEntityNotFound(_0x416c8d,null))['then'](respondWithResult(_0x416c8d,null))[_0x74b1('0x48')](handleError(_0x416c8d,null));};exports[_0x74b1('0x49')]=function(_0x18687c,_0x33c215){return db[_0x74b1('0x2c')][_0x74b1('0x49')](_0x18687c[_0x74b1('0x4a')],{})[_0x74b1('0x23')](respondWithResult(_0x33c215,0xc9))[_0x74b1('0x48')](handleError(_0x33c215,null));};exports[_0x74b1('0x22')]=function(_0x186516,_0x3038f9){if(_0x186516['body']['id']){delete _0x186516[_0x74b1('0x4a')]['id'];}return db[_0x74b1('0x2c')]['find']({'where':{'id':_0x186516[_0x74b1('0x44')]['id']}})['then'](handleEntityNotFound(_0x3038f9,null))[_0x74b1('0x23')](saveUpdates(_0x186516[_0x74b1('0x4a')],null))['then'](respondWithResult(_0x3038f9,null))[_0x74b1('0x48')](handleError(_0x3038f9,null));};exports[_0x74b1('0x24')]=function(_0x326b98,_0x549f03){return db[_0x74b1('0x2c')][_0x74b1('0x47')]({'where':{'id':_0x326b98[_0x74b1('0x44')]['id']}})[_0x74b1('0x23')](handleEntityNotFound(_0x549f03,null))[_0x74b1('0x23')](removeEntity(_0x549f03,null))['catch'](handleError(_0x549f03,null));};exports[_0x74b1('0x4b')]=function(_0x594411,_0x11bfca){return db[_0x74b1('0x2c')]['describe']()[_0x74b1('0x23')](respondWithResult(_0x11bfca,null))[_0x74b1('0x48')](handleError(_0x11bfca,null));}; \ No newline at end of file +var _0x0102=['filters','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','options','then','findAll','rows','catch','params','rawAttributes','intersection','include','find','create','update','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','save','sendStatus','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','key','model','query','keys'];(function(_0xc219d2,_0x31c104){var _0x189f0f=function(_0x3e1621){while(--_0x3e1621){_0xc219d2['push'](_0xc219d2['shift']());}};_0x189f0f(++_0x31c104);}(_0x0102,0x186));var _0x2010=function(_0x52a5a2,_0x29b546){_0x52a5a2=_0x52a5a2-0x0;var _0x444cd8=_0x0102[_0x52a5a2];return _0x444cd8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2010('0x0'));var zipdir=require(_0x2010('0x1'));var jsonpatch=require(_0x2010('0x2'));var rp=require(_0x2010('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2010('0x4'));var csv=require(_0x2010('0x5'));var ejs=require(_0x2010('0x6'));var fs=require('fs');var fs_extra=require(_0x2010('0x7'));var _=require('lodash');var squel=require(_0x2010('0x8'));var crypto=require('crypto');var jsforce=require(_0x2010('0x9'));var deskjs=require(_0x2010('0xa'));var toCsv=require('to-csv');var querystring=require(_0x2010('0xb'));var Papa=require(_0x2010('0xc'));var Redis=require(_0x2010('0xd'));var authService=require(_0x2010('0xe'));var qs=require(_0x2010('0xf'));var as=require(_0x2010('0x10'));var hardwareService=require(_0x2010('0x11'));var logger=require(_0x2010('0x12'))(_0x2010('0x13'));var utils=require(_0x2010('0x14'));var config=require(_0x2010('0x15'));var licenseUtil=require(_0x2010('0x16'));var db=require(_0x2010('0x17'))['db'];function respondWithStatusCode(_0x3f307c,_0x3e8624){_0x3e8624=_0x3e8624||0xcc;return function(_0x388991){if(_0x388991){return _0x3f307c['sendStatus'](_0x3e8624);}return _0x3f307c['status'](_0x3e8624)[_0x2010('0x18')]();};}function respondWithResult(_0x385720,_0x2e8ec2){_0x2e8ec2=_0x2e8ec2||0xc8;return function(_0x10b587){if(_0x10b587){return _0x385720[_0x2010('0x19')](_0x2e8ec2)[_0x2010('0x1a')](_0x10b587);}};}function respondWithFilteredResult(_0x517ff4,_0x3195fa){return function(_0x136418){if(_0x136418){var _0x5ad412=typeof _0x3195fa[_0x2010('0x1b')]===_0x2010('0x1c')&&typeof _0x3195fa[_0x2010('0x1d')]===_0x2010('0x1c');var _0x2d0bf2=_0x136418[_0x2010('0x1e')];var _0x83cd35=_0x5ad412?0x0:_0x3195fa[_0x2010('0x1b')];var _0x309477=_0x5ad412?_0x136418['count']:_0x3195fa['offset']+_0x3195fa[_0x2010('0x1d')];var _0x38a15a;if(_0x309477>=_0x2d0bf2){_0x309477=_0x2d0bf2;_0x38a15a=0xc8;}else{_0x38a15a=0xce;}_0x517ff4[_0x2010('0x19')](_0x38a15a);return _0x517ff4[_0x2010('0x1f')]('Content-Range',_0x83cd35+'-'+_0x309477+'/'+_0x2d0bf2)['json'](_0x136418);}return null;};}function patchUpdates(_0x22c252){return function(_0x171e45){try{jsonpatch[_0x2010('0x20')](_0x171e45,_0x22c252,!![]);}catch(_0x26facc){return BPromise[_0x2010('0x21')](_0x26facc);}return _0x171e45[_0x2010('0x22')]();};}function saveUpdates(_0x4f621c,_0x3db13d){return function(_0x1cfa57){if(_0x1cfa57){return _0x1cfa57['update'](_0x4f621c)['then'](function(_0x50aecc){return _0x50aecc;});}return null;};}function removeEntity(_0x424453,_0x574719){return function(_0x277dcc){if(_0x277dcc){return _0x277dcc['destroy']()['then'](function(){_0x424453[_0x2010('0x19')](0xcc)[_0x2010('0x18')]();});}};}function handleEntityNotFound(_0x52b4fe,_0x99ebe0){return function(_0x4cff59){if(!_0x4cff59){_0x52b4fe[_0x2010('0x23')](0x194);}return _0x4cff59;};}function handleError(_0x27b425,_0x3929d9){_0x3929d9=_0x3929d9||0x1f4;return function(_0x3dcea4){logger[_0x2010('0x24')](_0x3dcea4[_0x2010('0x25')]);if(_0x3dcea4[_0x2010('0x26')]){delete _0x3dcea4[_0x2010('0x26')];}_0x27b425[_0x2010('0x19')](_0x3929d9)[_0x2010('0x27')](_0x3dcea4);};}exports[_0x2010('0x28')]=function(_0x2ebdbb,_0x499cbe){var _0x2a4691={},_0x52fe5e={},_0x5b52fb={'count':0x0,'rows':[]};var _0x147a5a=_[_0x2010('0x29')](db[_0x2010('0x2a')]['rawAttributes'],function(_0x554f66){return{'name':_0x554f66[_0x2010('0x2b')],'type':_0x554f66['type'][_0x2010('0x2c')]};});_0x52fe5e[_0x2010('0x2d')]=_['map'](_0x147a5a,_0x2010('0x26'));_0x52fe5e[_0x2010('0x2e')]=_[_0x2010('0x2f')](_0x2ebdbb[_0x2010('0x2e')]);_0x52fe5e[_0x2010('0x30')]=_['intersection'](_0x52fe5e[_0x2010('0x2d')],_0x52fe5e[_0x2010('0x2e')]);_0x2a4691[_0x2010('0x31')]=_['intersection'](_0x52fe5e['model'],qs[_0x2010('0x32')](_0x2ebdbb[_0x2010('0x2e')][_0x2010('0x32')]));_0x2a4691['attributes']=_0x2a4691['attributes'][_0x2010('0x33')]?_0x2a4691[_0x2010('0x31')]:_0x52fe5e[_0x2010('0x2d')];if(!_0x2ebdbb[_0x2010('0x2e')][_0x2010('0x34')]('nolimit')){_0x2a4691['limit']=qs['limit'](_0x2ebdbb[_0x2010('0x2e')][_0x2010('0x1d')]);_0x2a4691[_0x2010('0x1b')]=qs['offset'](_0x2ebdbb[_0x2010('0x2e')][_0x2010('0x1b')]);}_0x2a4691[_0x2010('0x35')]=qs[_0x2010('0x36')](_0x2ebdbb['query'][_0x2010('0x36')]);_0x2a4691[_0x2010('0x37')]=qs[_0x2010('0x30')](_['pick'](_0x2ebdbb[_0x2010('0x2e')],_0x52fe5e['filters']),_0x147a5a);if(_0x2ebdbb[_0x2010('0x2e')][_0x2010('0x38')]){_0x2a4691[_0x2010('0x37')]=_[_0x2010('0x39')](_0x2a4691[_0x2010('0x37')],{'$or':_[_0x2010('0x29')](_0x147a5a,function(_0x53c09e){if(_0x53c09e[_0x2010('0x3a')]!=='VIRTUAL'){var _0x3e5422={};_0x3e5422[_0x53c09e[_0x2010('0x26')]]={'$like':'%'+_0x2ebdbb[_0x2010('0x2e')][_0x2010('0x38')]+'%'};return _0x3e5422;}})});}_0x2a4691=_[_0x2010('0x39')]({},_0x2a4691,_0x2ebdbb[_0x2010('0x3b')]);var _0x398f10={'where':_0x2a4691[_0x2010('0x37')]};return db[_0x2010('0x2a')][_0x2010('0x1e')](_0x398f10)[_0x2010('0x3c')](function(_0x2f37ca){_0x5b52fb[_0x2010('0x1e')]=_0x2f37ca;if(_0x2ebdbb[_0x2010('0x2e')]['includeAll']){_0x2a4691['include']=[{'all':!![]}];}return db[_0x2010('0x2a')][_0x2010('0x3d')](_0x2a4691);})[_0x2010('0x3c')](function(_0x35d631){_0x5b52fb[_0x2010('0x3e')]=_0x35d631;return _0x5b52fb;})[_0x2010('0x3c')](respondWithFilteredResult(_0x499cbe,_0x2a4691))[_0x2010('0x3f')](handleError(_0x499cbe,null));};exports['show']=function(_0x392576,_0x578645){var _0x27fd64={'raw':!![],'where':{'id':_0x392576[_0x2010('0x40')]['id']}},_0x3ff496={};_0x3ff496[_0x2010('0x2d')]=_[_0x2010('0x2f')](db['WhatsappQueueReport'][_0x2010('0x41')]);_0x3ff496[_0x2010('0x2e')]=_[_0x2010('0x2f')](_0x392576[_0x2010('0x2e')]);_0x3ff496['filters']=_[_0x2010('0x42')](_0x3ff496['model'],_0x3ff496['query']);_0x27fd64['attributes']=_[_0x2010('0x42')](_0x3ff496[_0x2010('0x2d')],qs[_0x2010('0x32')](_0x392576[_0x2010('0x2e')][_0x2010('0x32')]));_0x27fd64[_0x2010('0x31')]=_0x27fd64['attributes'][_0x2010('0x33')]?_0x27fd64[_0x2010('0x31')]:_0x3ff496[_0x2010('0x2d')];if(_0x392576['query']['includeAll']){_0x27fd64[_0x2010('0x43')]=[{'all':!![]}];}_0x27fd64=_['merge']({},_0x27fd64,_0x392576[_0x2010('0x3b')]);return db[_0x2010('0x2a')][_0x2010('0x44')](_0x27fd64)[_0x2010('0x3c')](handleEntityNotFound(_0x578645,null))['then'](respondWithResult(_0x578645,null))[_0x2010('0x3f')](handleError(_0x578645,null));};exports[_0x2010('0x45')]=function(_0x2e2703,_0x231db7){return db[_0x2010('0x2a')][_0x2010('0x45')](_0x2e2703['body'],{})[_0x2010('0x3c')](respondWithResult(_0x231db7,0xc9))[_0x2010('0x3f')](handleError(_0x231db7,null));};exports[_0x2010('0x46')]=function(_0x4dc0cf,_0x30e5d0){if(_0x4dc0cf[_0x2010('0x47')]['id']){delete _0x4dc0cf['body']['id'];}return db[_0x2010('0x2a')][_0x2010('0x44')]({'where':{'id':_0x4dc0cf[_0x2010('0x40')]['id']}})[_0x2010('0x3c')](handleEntityNotFound(_0x30e5d0,null))[_0x2010('0x3c')](saveUpdates(_0x4dc0cf[_0x2010('0x47')],null))[_0x2010('0x3c')](respondWithResult(_0x30e5d0,null))[_0x2010('0x3f')](handleError(_0x30e5d0,null));};exports['destroy']=function(_0x5258b9,_0xc9f070){return db[_0x2010('0x2a')]['find']({'where':{'id':_0x5258b9[_0x2010('0x40')]['id']}})[_0x2010('0x3c')](handleEntityNotFound(_0xc9f070,null))[_0x2010('0x3c')](removeEntity(_0xc9f070,null))[_0x2010('0x3f')](handleError(_0xc9f070,null));};exports[_0x2010('0x48')]=function(_0x506943,_0x5f4e98){return db[_0x2010('0x2a')][_0x2010('0x48')]()[_0x2010('0x3c')](respondWithResult(_0x5f4e98,null))[_0x2010('0x3f')](handleError(_0x5f4e98,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index ce3f95a..f7fe14b 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 _0xba67=['path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x114c1c,_0x5bfd6d){var _0x50a0a6=function(_0x4f97f0){while(--_0x4f97f0){_0x114c1c['push'](_0x114c1c['shift']());}};_0x50a0a6(++_0x5bfd6d);}(_0xba67,0xca));var _0x7ba6=function(_0x3b9498,_0x425a96){_0x3b9498=_0x3b9498-0x0;var _0x5d9ee5=_0xba67[_0x3b9498];return _0x5d9ee5;};'use strict';var _=require(_0x7ba6('0x0'));var util=require(_0x7ba6('0x1'));var logger=require(_0x7ba6('0x2'))(_0x7ba6('0x3'));var moment=require(_0x7ba6('0x4'));var BPromise=require(_0x7ba6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ba6('0x6'));var rimraf=require(_0x7ba6('0x7'));var config=require(_0x7ba6('0x8'));var attributes=require(_0x7ba6('0x9'));module[_0x7ba6('0xa')]=function(_0x1e7e31,_0x2df8fd){return _0x1e7e31[_0x7ba6('0xb')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x7ba6('0xc'),'fields':[_0x7ba6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa14e=['../../config/environment','exports','define','report_whatsapp_queue','uniqueid','lodash','util','api','bluebird','rimraf'];(function(_0x284f8a,_0x50f372){var _0x2a0399=function(_0x43602e){while(--_0x43602e){_0x284f8a['push'](_0x284f8a['shift']());}};_0x2a0399(++_0x50f372);}(_0xa14e,0x163));var _0xea14=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa14e[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xea14('0x0'));var util=require(_0xea14('0x1'));var logger=require('../../config/logger')(_0xea14('0x2'));var moment=require('moment');var BPromise=require(_0xea14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xea14('0x4'));var config=require(_0xea14('0x5'));var attributes=require('./whatsappQueueReport.attributes');module[_0xea14('0x6')]=function(_0x2c8e35,_0x512cab){return _0x2c8e35[_0xea14('0x7')]('WhatsappQueueReport',attributes,{'tableName':_0xea14('0x8'),'paranoid':![],'indexes':[{'name':_0xea14('0x9'),'fields':[_0xea14('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 74f1f24..7d099f8 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 _0xba13=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','UpdateWhatsappQueueReport','update','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring'];(function(_0xbdfb77,_0x5c88a2){var _0x4cc78f=function(_0x2c9015){while(--_0x2c9015){_0xbdfb77['push'](_0xbdfb77['shift']());}};_0x4cc78f(++_0x5c88a2);}(_0xba13,0x87));var _0x3ba1=function(_0x1b5aea,_0x1afe6f){_0x1b5aea=_0x1b5aea-0x0;var _0x51cae9=_0xba13[_0x1b5aea];return _0x51cae9;};'use strict';var _=require(_0x3ba1('0x0'));var util=require(_0x3ba1('0x1'));var moment=require(_0x3ba1('0x2'));var BPromise=require(_0x3ba1('0x3'));var rs=require(_0x3ba1('0x4'));var fs=require('fs');var Redis=require(_0x3ba1('0x5'));var db=require(_0x3ba1('0x6'))['db'];var utils=require(_0x3ba1('0x7'));var logger=require(_0x3ba1('0x8'))(_0x3ba1('0x9'));var config=require(_0x3ba1('0xa'));var jayson=require(_0x3ba1('0xb'));var client=jayson['client'][_0x3ba1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x490537,_0x3868b,_0x528cb3){return new BPromise(function(_0x20d6c4,_0x507915){return client['request'](_0x490537,_0x528cb3)['then'](function(_0x485fef){logger[_0x3ba1('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3868b,_0x3ba1('0xe'));logger[_0x3ba1('0xf')](_0x3ba1('0x10'),_0x3868b,_0x3ba1('0xe'),JSON[_0x3ba1('0x11')](_0x485fef));if(_0x485fef[_0x3ba1('0x12')]){if(_0x485fef['error'][_0x3ba1('0x13')]===0x1f4){logger['error'](_0x3ba1('0x14'),_0x3868b,_0x485fef['error']['message']);return _0x507915(_0x485fef['error'][_0x3ba1('0x15')]);}logger[_0x3ba1('0x12')](_0x3ba1('0x14'),_0x3868b,_0x485fef['error']['message']);return _0x20d6c4(_0x485fef[_0x3ba1('0x12')][_0x3ba1('0x15')]);}else{logger['info'](_0x3ba1('0x14'),_0x3868b,_0x3ba1('0xe'));_0x20d6c4(_0x485fef[_0x3ba1('0x16')][_0x3ba1('0x15')]);}})[_0x3ba1('0x17')](function(_0xb6145d){logger[_0x3ba1('0x12')](_0x3ba1('0x14'),_0x3868b,_0xb6145d);_0x507915(_0xb6145d);});});}exports[_0x3ba1('0x18')]=function(_0x11dfd7){var _0x4df94c=this;return new Promise(function(_0x45d62c,_0x274eac){return db[_0x3ba1('0x19')]['create'](_0x11dfd7[_0x3ba1('0x1a')],{'raw':_0x11dfd7[_0x3ba1('0x1b')]?_0x11dfd7['options'][_0x3ba1('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x32f830){logger[_0x3ba1('0xd')]('CreateWhatsappQueueReport',_0x11dfd7);logger['debug']('CreateWhatsappQueueReport',_0x11dfd7,JSON['stringify'](_0x32f830));_0x45d62c(_0x32f830);})[_0x3ba1('0x17')](function(_0x22c4d7){logger[_0x3ba1('0x12')](_0x3ba1('0x18'),_0x22c4d7['message'],_0x11dfd7);_0x274eac(_0x4df94c[_0x3ba1('0x12')](0x1f4,_0x22c4d7[_0x3ba1('0x15')]));});});};exports[_0x3ba1('0x1d')]=function(_0x4cd89e){var _0x2f59db=this;return new Promise(function(_0x31f092,_0x1f2b84){return db[_0x3ba1('0x19')][_0x3ba1('0x1e')](_0x4cd89e[_0x3ba1('0x1a')],{'raw':_0x4cd89e[_0x3ba1('0x1b')]?_0x4cd89e[_0x3ba1('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cd89e[_0x3ba1('0x1b')]?_0x4cd89e[_0x3ba1('0x1b')][_0x3ba1('0x1f')]||null:null,'attributes':_0x4cd89e[_0x3ba1('0x1b')]?_0x4cd89e['options'][_0x3ba1('0x20')]||null:null,'limit':_0x4cd89e[_0x3ba1('0x1b')]?_0x4cd89e[_0x3ba1('0x1b')][_0x3ba1('0x21')]||null:null})[_0x3ba1('0x22')](function(_0x4c9bae){logger[_0x3ba1('0xd')](_0x3ba1('0x1d'),_0x4cd89e);logger[_0x3ba1('0xf')]('UpdateWhatsappQueueReport',_0x4cd89e,JSON['stringify'](_0x4c9bae));_0x31f092(_0x4c9bae);})[_0x3ba1('0x17')](function(_0xaa05a1){logger[_0x3ba1('0x12')](_0x3ba1('0x1d'),_0xaa05a1[_0x3ba1('0x15')],_0x4cd89e);_0x1f2b84(_0x2f59db[_0x3ba1('0x12')](0x1f4,_0xaa05a1[_0x3ba1('0x15')]));});});}; \ No newline at end of file +var _0x1612=['error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','update','attributes','limit','UpdateWhatsappQueueReport','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x1612,0xc8));var _0x2161=function(_0x3e7555,_0x442ce2){_0x3e7555=_0x3e7555-0x0;var _0x3719e9=_0x1612[_0x3e7555];return _0x3719e9;};'use strict';var _=require(_0x2161('0x0'));var util=require('util');var moment=require(_0x2161('0x1'));var BPromise=require('bluebird');var rs=require(_0x2161('0x2'));var fs=require('fs');var Redis=require(_0x2161('0x3'));var db=require(_0x2161('0x4'))['db'];var utils=require(_0x2161('0x5'));var logger=require(_0x2161('0x6'))(_0x2161('0x7'));var config=require('../../config/environment');var jayson=require(_0x2161('0x8'));var client=jayson['client'][_0x2161('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c04fd,_0x412a36,_0x1e052f){return new BPromise(function(_0x28ea7c,_0x4cee91){return client['request'](_0x1c04fd,_0x1e052f)[_0x2161('0xa')](function(_0x2d182b){logger[_0x2161('0xb')](_0x2161('0xc'),_0x412a36,_0x2161('0xd'));logger[_0x2161('0xe')](_0x2161('0xf'),_0x412a36,_0x2161('0xd'),JSON[_0x2161('0x10')](_0x2d182b));if(_0x2d182b[_0x2161('0x11')]){if(_0x2d182b['error'][_0x2161('0x12')]===0x1f4){logger[_0x2161('0x11')](_0x2161('0xc'),_0x412a36,_0x2d182b[_0x2161('0x11')][_0x2161('0x13')]);return _0x4cee91(_0x2d182b[_0x2161('0x11')][_0x2161('0x13')]);}logger[_0x2161('0x11')](_0x2161('0xc'),_0x412a36,_0x2d182b['error']['message']);return _0x28ea7c(_0x2d182b['error'][_0x2161('0x13')]);}else{logger[_0x2161('0xb')](_0x2161('0xc'),_0x412a36,'request\x20sent');_0x28ea7c(_0x2d182b[_0x2161('0x14')][_0x2161('0x13')]);}})[_0x2161('0x15')](function(_0x59b385){logger[_0x2161('0x11')](_0x2161('0xc'),_0x412a36,_0x59b385);_0x4cee91(_0x59b385);});});}exports[_0x2161('0x16')]=function(_0x55bb6a){var _0x3e0b72=this;return new Promise(function(_0x544ac1,_0x5918ec){return db[_0x2161('0x17')]['create'](_0x55bb6a[_0x2161('0x18')],{'raw':_0x55bb6a['options']?_0x55bb6a[_0x2161('0x19')][_0x2161('0x1a')]===undefined?!![]:![]:!![]})[_0x2161('0xa')](function(_0x1c3968){logger[_0x2161('0xb')](_0x2161('0x16'),_0x55bb6a);logger[_0x2161('0xe')](_0x2161('0x16'),_0x55bb6a,JSON[_0x2161('0x10')](_0x1c3968));_0x544ac1(_0x1c3968);})[_0x2161('0x15')](function(_0x7ef8f6){logger[_0x2161('0x11')](_0x2161('0x16'),_0x7ef8f6[_0x2161('0x13')],_0x55bb6a);_0x5918ec(_0x3e0b72[_0x2161('0x11')](0x1f4,_0x7ef8f6[_0x2161('0x13')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x2e7002){var _0x232246=this;return new Promise(function(_0x21ba00,_0x50f3fb){return db[_0x2161('0x17')][_0x2161('0x1b')](_0x2e7002['body'],{'raw':_0x2e7002[_0x2161('0x19')]?_0x2e7002['options'][_0x2161('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e7002['options']?_0x2e7002['options']['where']||null:null,'attributes':_0x2e7002[_0x2161('0x19')]?_0x2e7002[_0x2161('0x19')][_0x2161('0x1c')]||null:null,'limit':_0x2e7002[_0x2161('0x19')]?_0x2e7002[_0x2161('0x19')][_0x2161('0x1d')]||null:null})[_0x2161('0xa')](function(_0x59d248){logger[_0x2161('0xb')](_0x2161('0x1e'),_0x2e7002);logger[_0x2161('0xe')](_0x2161('0x1e'),_0x2e7002,JSON[_0x2161('0x10')](_0x59d248));_0x21ba00(_0x59d248);})[_0x2161('0x15')](function(_0x183418){logger[_0x2161('0x11')]('UpdateWhatsappQueueReport',_0x183418[_0x2161('0x13')],_0x2e7002);_0x50f3fb(_0x232246[_0x2161('0x11')](0x1f4,_0x183418['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 3a30a5e..807fb05 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 _0x8ab8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','describe','/:id','isAuthenticated','post','create','put','update','exports','multer','util','path','connect-timeout','Router'];(function(_0x3195a3,_0x202942){var _0x49b4f8=function(_0x2b8789){while(--_0x2b8789){_0x3195a3['push'](_0x3195a3['shift']());}};_0x49b4f8(++_0x202942);}(_0x8ab8,0x1b0));var _0x88ab=function(_0x14ad64,_0x5d2f4b){_0x14ad64=_0x14ad64-0x0;var _0x1755df=_0x8ab8[_0x14ad64];return _0x1755df;};'use strict';var multer=require(_0x88ab('0x0'));var util=require(_0x88ab('0x1'));var path=require(_0x88ab('0x2'));var timeout=require(_0x88ab('0x3'));var express=require('express');var router=express[_0x88ab('0x4')]();var fs_extra=require(_0x88ab('0x5'));var auth=require(_0x88ab('0x6'));var interaction=require(_0x88ab('0x7'));var config=require(_0x88ab('0x8'));var controller=require(_0x88ab('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x88ab('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x88ab('0xb')]);router['get'](_0x88ab('0xc'),auth[_0x88ab('0xd')](),controller['show']);router[_0x88ab('0xe')]('/',auth[_0x88ab('0xd')](),controller[_0x88ab('0xf')]);router[_0x88ab('0x10')](_0x88ab('0xc'),auth[_0x88ab('0xd')](),controller[_0x88ab('0x11')]);router['delete'](_0x88ab('0xc'),auth[_0x88ab('0xd')](),controller['destroy']);module[_0x88ab('0x12')]=router; \ No newline at end of file +var _0x0d11=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy'];(function(_0x56a291,_0xa8558d){var _0x4989ee=function(_0x152ce4){while(--_0x152ce4){_0x56a291['push'](_0x56a291['shift']());}};_0x4989ee(++_0xa8558d);}(_0x0d11,0x1b6));var _0x10d1=function(_0x1f55f3,_0xac0628){_0x1f55f3=_0x1f55f3-0x0;var _0x456d70=_0x0d11[_0x1f55f3];return _0x456d70;};'use strict';var multer=require(_0x10d1('0x0'));var util=require(_0x10d1('0x1'));var path=require(_0x10d1('0x2'));var timeout=require(_0x10d1('0x3'));var express=require('express');var router=express[_0x10d1('0x4')]();var fs_extra=require(_0x10d1('0x5'));var auth=require(_0x10d1('0x6'));var interaction=require(_0x10d1('0x7'));var config=require(_0x10d1('0x8'));var controller=require(_0x10d1('0x9'));router[_0x10d1('0xa')]('/',auth['isAuthenticated'](),controller[_0x10d1('0xb')]);router[_0x10d1('0xa')](_0x10d1('0xc'),auth[_0x10d1('0xd')](),controller[_0x10d1('0xe')]);router[_0x10d1('0xa')](_0x10d1('0xf'),auth[_0x10d1('0xd')](),controller[_0x10d1('0x10')]);router[_0x10d1('0x11')]('/',auth[_0x10d1('0xd')](),controller[_0x10d1('0x12')]);router[_0x10d1('0x13')](_0x10d1('0xf'),auth[_0x10d1('0xd')](),controller[_0x10d1('0x14')]);router['delete'](_0x10d1('0xf'),auth['isAuthenticated'](),controller[_0x10d1('0x15')]);module[_0x10d1('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 366d862..4197614 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 _0x0c3a=['STRING','ENUM','account','agent','queue','sequelize','exports'];(function(_0x6e15be,_0x191b5c){var _0x230e97=function(_0x180f71){while(--_0x180f71){_0x6e15be['push'](_0x6e15be['shift']());}};_0x230e97(++_0x191b5c);}(_0x0c3a,0x171));var _0xa0c3=function(_0x3e8c6d,_0x1b536f){_0x3e8c6d=_0x3e8c6d-0x0;var _0x450309=_0x0c3a[_0x3e8c6d];return _0x450309;};'use strict';var Sequelize=require(_0xa0c3('0x0'));module[_0xa0c3('0x1')]={'uniqueid':{'type':Sequelize[_0xa0c3('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa0c3('0x3')](_0xa0c3('0x4'),_0xa0c3('0x5'),_0xa0c3('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x6e1c=['queue','DATE','sequelize','ENUM','account','agent'];(function(_0x232cac,_0x391421){var _0x42b279=function(_0x219c51){while(--_0x219c51){_0x232cac['push'](_0x232cac['shift']());}};_0x42b279(++_0x391421);}(_0x6e1c,0xb6));var _0xc6e1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e1c[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xc6e1('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xc6e1('0x1')](_0xc6e1('0x2'),_0xc6e1('0x3'),_0xc6e1('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xc6e1('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index e92e6e3..cb61d89 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 _0x2d07=['error','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','include','findAll','rows','catch','show','options','create','body','params','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','end'];(function(_0x1f73e2,_0x8c866f){var _0x167ea5=function(_0x502c5f){while(--_0x502c5f){_0x1f73e2['push'](_0x1f73e2['shift']());}};_0x167ea5(++_0x8c866f);}(_0x2d07,0x13a));var _0x72d0=function(_0x229a9d,_0x4d3229){_0x229a9d=_0x229a9d-0x0;var _0x5bd600=_0x2d07[_0x229a9d];return _0x5bd600;};'use strict';var emlformat=require(_0x72d0('0x0'));var rimraf=require(_0x72d0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x72d0('0x2'));var rp=require(_0x72d0('0x3'));var moment=require('moment');var BPromise=require(_0x72d0('0x4'));var Mustache=require(_0x72d0('0x5'));var util=require(_0x72d0('0x6'));var path=require(_0x72d0('0x7'));var sox=require(_0x72d0('0x8'));var csv=require(_0x72d0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x72d0('0xa'));var _=require(_0x72d0('0xb'));var squel=require(_0x72d0('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x72d0('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x72d0('0xe'));var authService=require(_0x72d0('0xf'));var qs=require(_0x72d0('0x10'));var as=require(_0x72d0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x72d0('0x12'));var config=require(_0x72d0('0x13'));var licenseUtil=require(_0x72d0('0x14'));var db=require(_0x72d0('0x15'))['db'];function respondWithStatusCode(_0x262274,_0x4fdaf7){_0x4fdaf7=_0x4fdaf7||0xcc;return function(_0x23edb6){if(_0x23edb6){return _0x262274[_0x72d0('0x16')](_0x4fdaf7);}return _0x262274[_0x72d0('0x17')](_0x4fdaf7)['end']();};}function respondWithResult(_0x183dc7,_0xe75447){_0xe75447=_0xe75447||0xc8;return function(_0x140ae1){if(_0x140ae1){return _0x183dc7[_0x72d0('0x17')](_0xe75447)[_0x72d0('0x18')](_0x140ae1);}};}function respondWithFilteredResult(_0xea1112,_0x50c274){return function(_0x1e2089){if(_0x1e2089){var _0x197179=typeof _0x50c274[_0x72d0('0x19')]===_0x72d0('0x1a')&&typeof _0x50c274[_0x72d0('0x1b')]===_0x72d0('0x1a');var _0x35184d=_0x1e2089[_0x72d0('0x1c')];var _0x2fe17f=_0x197179?0x0:_0x50c274['offset'];var _0x440f9c=_0x197179?_0x1e2089[_0x72d0('0x1c')]:_0x50c274[_0x72d0('0x19')]+_0x50c274[_0x72d0('0x1b')];var _0xf9d806;if(_0x440f9c>=_0x35184d){_0x440f9c=_0x35184d;_0xf9d806=0xc8;}else{_0xf9d806=0xce;}_0xea1112[_0x72d0('0x17')](_0xf9d806);return _0xea1112['set'](_0x72d0('0x1d'),_0x2fe17f+'-'+_0x440f9c+'/'+_0x35184d)['json'](_0x1e2089);}return null;};}function patchUpdates(_0x4cbdf1){return function(_0x57e7c8){try{jsonpatch[_0x72d0('0x1e')](_0x57e7c8,_0x4cbdf1,!![]);}catch(_0x3c2441){return BPromise['reject'](_0x3c2441);}return _0x57e7c8[_0x72d0('0x1f')]();};}function saveUpdates(_0x30cb19,_0x47d89a){return function(_0x306d4b){if(_0x306d4b){return _0x306d4b[_0x72d0('0x20')](_0x30cb19)['then'](function(_0xb4be9d){return _0xb4be9d;});}return null;};}function removeEntity(_0x1c39e3,_0x350184){return function(_0x5b7034){if(_0x5b7034){return _0x5b7034[_0x72d0('0x21')]()[_0x72d0('0x22')](function(){_0x1c39e3[_0x72d0('0x17')](0xcc)[_0x72d0('0x23')]();});}};}function handleEntityNotFound(_0x4bc137,_0x30a509){return function(_0x136d5e){if(!_0x136d5e){_0x4bc137[_0x72d0('0x16')](0x194);}return _0x136d5e;};}function handleError(_0x1c7627,_0x160e8f){_0x160e8f=_0x160e8f||0x1f4;return function(_0x7f45){logger[_0x72d0('0x24')](_0x7f45['stack']);if(_0x7f45[_0x72d0('0x25')]){delete _0x7f45['name'];}_0x1c7627[_0x72d0('0x17')](_0x160e8f)[_0x72d0('0x26')](_0x7f45);};}exports[_0x72d0('0x27')]=function(_0x2191db,_0xf53e37){var _0x4d4790={},_0x12a92b={},_0x174cd0={'count':0x0,'rows':[]};var _0x51947c=_[_0x72d0('0x28')](db[_0x72d0('0x29')][_0x72d0('0x2a')],function(_0x480fbe){return{'name':_0x480fbe[_0x72d0('0x2b')],'type':_0x480fbe[_0x72d0('0x2c')]['key']};});_0x12a92b[_0x72d0('0x2d')]=_['map'](_0x51947c,_0x72d0('0x25'));_0x12a92b[_0x72d0('0x2e')]=_[_0x72d0('0x2f')](_0x2191db[_0x72d0('0x2e')]);_0x12a92b[_0x72d0('0x30')]=_[_0x72d0('0x31')](_0x12a92b[_0x72d0('0x2d')],_0x12a92b[_0x72d0('0x2e')]);_0x4d4790[_0x72d0('0x32')]=_[_0x72d0('0x31')](_0x12a92b[_0x72d0('0x2d')],qs[_0x72d0('0x33')](_0x2191db['query'][_0x72d0('0x33')]));_0x4d4790[_0x72d0('0x32')]=_0x4d4790[_0x72d0('0x32')][_0x72d0('0x34')]?_0x4d4790[_0x72d0('0x32')]:_0x12a92b[_0x72d0('0x2d')];if(!_0x2191db[_0x72d0('0x2e')][_0x72d0('0x35')]('nolimit')){_0x4d4790[_0x72d0('0x1b')]=qs[_0x72d0('0x1b')](_0x2191db['query']['limit']);_0x4d4790[_0x72d0('0x19')]=qs[_0x72d0('0x19')](_0x2191db[_0x72d0('0x2e')][_0x72d0('0x19')]);}_0x4d4790[_0x72d0('0x36')]=qs[_0x72d0('0x37')](_0x2191db[_0x72d0('0x2e')][_0x72d0('0x37')]);_0x4d4790[_0x72d0('0x38')]=qs[_0x72d0('0x30')](_[_0x72d0('0x39')](_0x2191db[_0x72d0('0x2e')],_0x12a92b[_0x72d0('0x30')]),_0x51947c);if(_0x2191db[_0x72d0('0x2e')]['filter']){_0x4d4790['where']=_[_0x72d0('0x3a')](_0x4d4790[_0x72d0('0x38')],{'$or':_['map'](_0x51947c,function(_0x3f019d){if(_0x3f019d[_0x72d0('0x2c')]!=='VIRTUAL'){var _0x3a8a76={};_0x3a8a76[_0x3f019d[_0x72d0('0x25')]]={'$like':'%'+_0x2191db[_0x72d0('0x2e')]['filter']+'%'};return _0x3a8a76;}})});}_0x4d4790=_[_0x72d0('0x3a')]({},_0x4d4790,_0x2191db['options']);var _0x5d1d78={'where':_0x4d4790[_0x72d0('0x38')]};return db['WhatsappTransferReport'][_0x72d0('0x1c')](_0x5d1d78)[_0x72d0('0x22')](function(_0x45690b){_0x174cd0[_0x72d0('0x1c')]=_0x45690b;if(_0x2191db[_0x72d0('0x2e')]['includeAll']){_0x4d4790[_0x72d0('0x3b')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x72d0('0x3c')](_0x4d4790);})[_0x72d0('0x22')](function(_0x398a01){_0x174cd0[_0x72d0('0x3d')]=_0x398a01;return _0x174cd0;})['then'](respondWithFilteredResult(_0xf53e37,_0x4d4790))[_0x72d0('0x3e')](handleError(_0xf53e37,null));};exports[_0x72d0('0x3f')]=function(_0x393d62,_0x24d683){var _0x789a8a={'raw':!![],'where':{'id':_0x393d62['params']['id']}},_0x5a2213={};_0x5a2213[_0x72d0('0x2d')]=_[_0x72d0('0x2f')](db['WhatsappTransferReport'][_0x72d0('0x2a')]);_0x5a2213[_0x72d0('0x2e')]=_['keys'](_0x393d62[_0x72d0('0x2e')]);_0x5a2213[_0x72d0('0x30')]=_[_0x72d0('0x31')](_0x5a2213[_0x72d0('0x2d')],_0x5a2213[_0x72d0('0x2e')]);_0x789a8a[_0x72d0('0x32')]=_[_0x72d0('0x31')](_0x5a2213[_0x72d0('0x2d')],qs[_0x72d0('0x33')](_0x393d62[_0x72d0('0x2e')]['fields']));_0x789a8a['attributes']=_0x789a8a[_0x72d0('0x32')]['length']?_0x789a8a['attributes']:_0x5a2213[_0x72d0('0x2d')];if(_0x393d62[_0x72d0('0x2e')]['includeAll']){_0x789a8a[_0x72d0('0x3b')]=[{'all':!![]}];}_0x789a8a=_[_0x72d0('0x3a')]({},_0x789a8a,_0x393d62[_0x72d0('0x40')]);return db['WhatsappTransferReport']['find'](_0x789a8a)[_0x72d0('0x22')](handleEntityNotFound(_0x24d683,null))['then'](respondWithResult(_0x24d683,null))[_0x72d0('0x3e')](handleError(_0x24d683,null));};exports['create']=function(_0x3548b2,_0xd68442){return db[_0x72d0('0x29')][_0x72d0('0x41')](_0x3548b2[_0x72d0('0x42')],{})[_0x72d0('0x22')](respondWithResult(_0xd68442,0xc9))[_0x72d0('0x3e')](handleError(_0xd68442,null));};exports[_0x72d0('0x20')]=function(_0x3a9f11,_0xbb923a){if(_0x3a9f11['body']['id']){delete _0x3a9f11[_0x72d0('0x42')]['id'];}return db[_0x72d0('0x29')]['find']({'where':{'id':_0x3a9f11[_0x72d0('0x43')]['id']}})['then'](handleEntityNotFound(_0xbb923a,null))[_0x72d0('0x22')](saveUpdates(_0x3a9f11['body'],null))['then'](respondWithResult(_0xbb923a,null))[_0x72d0('0x3e')](handleError(_0xbb923a,null));};exports[_0x72d0('0x21')]=function(_0xb13628,_0x4af27f){return db[_0x72d0('0x29')][_0x72d0('0x44')]({'where':{'id':_0xb13628['params']['id']}})[_0x72d0('0x22')](handleEntityNotFound(_0x4af27f,null))[_0x72d0('0x22')](removeEntity(_0x4af27f,null))[_0x72d0('0x3e')](handleError(_0x4af27f,null));};exports[_0x72d0('0x45')]=function(_0x1fc221,_0x1ff5be){return db[_0x72d0('0x29')][_0x72d0('0x45')]()[_0x72d0('0x22')](respondWithResult(_0x1ff5be,null))['catch'](handleError(_0x1ff5be,null));}; \ No newline at end of file +var _0x20b9=['update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','options','WhatsappTransferReport','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','fast-json-patch','request-promise','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save'];(function(_0x225f01,_0x20e2f9){var _0x23a892=function(_0x35c5d0){while(--_0x35c5d0){_0x225f01['push'](_0x225f01['shift']());}};_0x23a892(++_0x20e2f9);}(_0x20b9,0xfe));var _0x920b=function(_0x333aa4,_0x5dbce8){_0x333aa4=_0x333aa4-0x0;var _0x51ff0e=_0x20b9[_0x333aa4];return _0x51ff0e;};'use strict';var emlformat=require(_0x920b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x920b('0x1'));var rp=require(_0x920b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x920b('0x3'));var path=require(_0x920b('0x4'));var sox=require(_0x920b('0x5'));var csv=require(_0x920b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x920b('0x7'));var _=require(_0x920b('0x8'));var squel=require(_0x920b('0x9'));var crypto=require(_0x920b('0xa'));var jsforce=require(_0x920b('0xb'));var deskjs=require(_0x920b('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x920b('0xd'));var Redis=require(_0x920b('0xe'));var authService=require(_0x920b('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x920b('0x10'));var logger=require(_0x920b('0x11'))('api');var utils=require(_0x920b('0x12'));var config=require(_0x920b('0x13'));var licenseUtil=require(_0x920b('0x14'));var db=require(_0x920b('0x15'))['db'];function respondWithStatusCode(_0x407a70,_0x183b25){_0x183b25=_0x183b25||0xcc;return function(_0x577c93){if(_0x577c93){return _0x407a70[_0x920b('0x16')](_0x183b25);}return _0x407a70['status'](_0x183b25)[_0x920b('0x17')]();};}function respondWithResult(_0x4be9c3,_0x369939){_0x369939=_0x369939||0xc8;return function(_0x2a6747){if(_0x2a6747){return _0x4be9c3[_0x920b('0x18')](_0x369939)[_0x920b('0x19')](_0x2a6747);}};}function respondWithFilteredResult(_0x2a5372,_0x14df51){return function(_0x407900){if(_0x407900){var _0x463619=typeof _0x14df51['offset']===_0x920b('0x1a')&&typeof _0x14df51[_0x920b('0x1b')]===_0x920b('0x1a');var _0x1fd36a=_0x407900[_0x920b('0x1c')];var _0x21d9d5=_0x463619?0x0:_0x14df51[_0x920b('0x1d')];var _0x4855ce=_0x463619?_0x407900[_0x920b('0x1c')]:_0x14df51[_0x920b('0x1d')]+_0x14df51[_0x920b('0x1b')];var _0x2d92ca;if(_0x4855ce>=_0x1fd36a){_0x4855ce=_0x1fd36a;_0x2d92ca=0xc8;}else{_0x2d92ca=0xce;}_0x2a5372['status'](_0x2d92ca);return _0x2a5372[_0x920b('0x1e')](_0x920b('0x1f'),_0x21d9d5+'-'+_0x4855ce+'/'+_0x1fd36a)['json'](_0x407900);}return null;};}function patchUpdates(_0x2c3334){return function(_0x8a881d){try{jsonpatch[_0x920b('0x20')](_0x8a881d,_0x2c3334,!![]);}catch(_0x561c5c){return BPromise['reject'](_0x561c5c);}return _0x8a881d[_0x920b('0x21')]();};}function saveUpdates(_0x108ab0,_0x2b55f0){return function(_0x368971){if(_0x368971){return _0x368971[_0x920b('0x22')](_0x108ab0)[_0x920b('0x23')](function(_0x227a42){return _0x227a42;});}return null;};}function removeEntity(_0x11c2ff,_0x38e359){return function(_0x270561){if(_0x270561){return _0x270561[_0x920b('0x24')]()[_0x920b('0x23')](function(){_0x11c2ff['status'](0xcc)[_0x920b('0x17')]();});}};}function handleEntityNotFound(_0x51f473,_0x584dbc){return function(_0x5c91e6){if(!_0x5c91e6){_0x51f473[_0x920b('0x16')](0x194);}return _0x5c91e6;};}function handleError(_0x1896c7,_0x3c9715){_0x3c9715=_0x3c9715||0x1f4;return function(_0xbecf96){logger[_0x920b('0x25')](_0xbecf96[_0x920b('0x26')]);if(_0xbecf96[_0x920b('0x27')]){delete _0xbecf96[_0x920b('0x27')];}_0x1896c7['status'](_0x3c9715)[_0x920b('0x28')](_0xbecf96);};}exports[_0x920b('0x29')]=function(_0x22521e,_0x57086){var _0xa46eee={},_0x3ca9d3={},_0x4a2566={'count':0x0,'rows':[]};var _0x58f961=_[_0x920b('0x2a')](db['WhatsappTransferReport'][_0x920b('0x2b')],function(_0x39f17b){return{'name':_0x39f17b[_0x920b('0x2c')],'type':_0x39f17b['type']['key']};});_0x3ca9d3[_0x920b('0x2d')]=_[_0x920b('0x2a')](_0x58f961,_0x920b('0x27'));_0x3ca9d3[_0x920b('0x2e')]=_[_0x920b('0x2f')](_0x22521e[_0x920b('0x2e')]);_0x3ca9d3[_0x920b('0x30')]=_[_0x920b('0x31')](_0x3ca9d3[_0x920b('0x2d')],_0x3ca9d3['query']);_0xa46eee[_0x920b('0x32')]=_[_0x920b('0x31')](_0x3ca9d3[_0x920b('0x2d')],qs[_0x920b('0x33')](_0x22521e[_0x920b('0x2e')][_0x920b('0x33')]));_0xa46eee[_0x920b('0x32')]=_0xa46eee['attributes'][_0x920b('0x34')]?_0xa46eee[_0x920b('0x32')]:_0x3ca9d3[_0x920b('0x2d')];if(!_0x22521e[_0x920b('0x2e')][_0x920b('0x35')]('nolimit')){_0xa46eee[_0x920b('0x1b')]=qs[_0x920b('0x1b')](_0x22521e[_0x920b('0x2e')][_0x920b('0x1b')]);_0xa46eee['offset']=qs['offset'](_0x22521e[_0x920b('0x2e')][_0x920b('0x1d')]);}_0xa46eee[_0x920b('0x36')]=qs[_0x920b('0x37')](_0x22521e[_0x920b('0x2e')][_0x920b('0x37')]);_0xa46eee[_0x920b('0x38')]=qs[_0x920b('0x30')](_[_0x920b('0x39')](_0x22521e[_0x920b('0x2e')],_0x3ca9d3[_0x920b('0x30')]),_0x58f961);if(_0x22521e[_0x920b('0x2e')]['filter']){_0xa46eee[_0x920b('0x38')]=_[_0x920b('0x3a')](_0xa46eee[_0x920b('0x38')],{'$or':_[_0x920b('0x2a')](_0x58f961,function(_0x1fe032){if(_0x1fe032[_0x920b('0x3b')]!=='VIRTUAL'){var _0x1811eb={};_0x1811eb[_0x1fe032['name']]={'$like':'%'+_0x22521e[_0x920b('0x2e')]['filter']+'%'};return _0x1811eb;}})});}_0xa46eee=_[_0x920b('0x3a')]({},_0xa46eee,_0x22521e[_0x920b('0x3c')]);var _0x106a37={'where':_0xa46eee[_0x920b('0x38')]};return db[_0x920b('0x3d')][_0x920b('0x1c')](_0x106a37)[_0x920b('0x23')](function(_0x4f7e34){_0x4a2566[_0x920b('0x1c')]=_0x4f7e34;if(_0x22521e['query'][_0x920b('0x3e')]){_0xa46eee[_0x920b('0x3f')]=[{'all':!![]}];}return db[_0x920b('0x3d')][_0x920b('0x40')](_0xa46eee);})[_0x920b('0x23')](function(_0x5e7b87){_0x4a2566['rows']=_0x5e7b87;return _0x4a2566;})['then'](respondWithFilteredResult(_0x57086,_0xa46eee))[_0x920b('0x41')](handleError(_0x57086,null));};exports[_0x920b('0x42')]=function(_0x4f6148,_0x24b4f2){var _0x512fe6={'raw':!![],'where':{'id':_0x4f6148[_0x920b('0x43')]['id']}},_0x3babc2={};_0x3babc2[_0x920b('0x2d')]=_[_0x920b('0x2f')](db[_0x920b('0x3d')][_0x920b('0x2b')]);_0x3babc2['query']=_[_0x920b('0x2f')](_0x4f6148[_0x920b('0x2e')]);_0x3babc2[_0x920b('0x30')]=_['intersection'](_0x3babc2[_0x920b('0x2d')],_0x3babc2[_0x920b('0x2e')]);_0x512fe6[_0x920b('0x32')]=_['intersection'](_0x3babc2[_0x920b('0x2d')],qs[_0x920b('0x33')](_0x4f6148['query'][_0x920b('0x33')]));_0x512fe6[_0x920b('0x32')]=_0x512fe6[_0x920b('0x32')][_0x920b('0x34')]?_0x512fe6[_0x920b('0x32')]:_0x3babc2['model'];if(_0x4f6148[_0x920b('0x2e')][_0x920b('0x3e')]){_0x512fe6[_0x920b('0x3f')]=[{'all':!![]}];}_0x512fe6=_[_0x920b('0x3a')]({},_0x512fe6,_0x4f6148[_0x920b('0x3c')]);return db['WhatsappTransferReport'][_0x920b('0x44')](_0x512fe6)[_0x920b('0x23')](handleEntityNotFound(_0x24b4f2,null))[_0x920b('0x23')](respondWithResult(_0x24b4f2,null))[_0x920b('0x41')](handleError(_0x24b4f2,null));};exports[_0x920b('0x45')]=function(_0x26d742,_0x5af6da){return db[_0x920b('0x3d')]['create'](_0x26d742[_0x920b('0x46')],{})[_0x920b('0x23')](respondWithResult(_0x5af6da,0xc9))[_0x920b('0x41')](handleError(_0x5af6da,null));};exports[_0x920b('0x22')]=function(_0x1e1242,_0x345a93){if(_0x1e1242[_0x920b('0x46')]['id']){delete _0x1e1242[_0x920b('0x46')]['id'];}return db[_0x920b('0x3d')][_0x920b('0x44')]({'where':{'id':_0x1e1242[_0x920b('0x43')]['id']}})['then'](handleEntityNotFound(_0x345a93,null))[_0x920b('0x23')](saveUpdates(_0x1e1242['body'],null))['then'](respondWithResult(_0x345a93,null))['catch'](handleError(_0x345a93,null));};exports[_0x920b('0x24')]=function(_0x276a61,_0x5829b3){return db[_0x920b('0x3d')]['find']({'where':{'id':_0x276a61[_0x920b('0x43')]['id']}})[_0x920b('0x23')](handleEntityNotFound(_0x5829b3,null))['then'](removeEntity(_0x5829b3,null))[_0x920b('0x41')](handleError(_0x5829b3,null));};exports[_0x920b('0x47')]=function(_0x128684,_0x5e3bdb){return db[_0x920b('0x3d')][_0x920b('0x47')]()['then'](respondWithResult(_0x5e3bdb,null))[_0x920b('0x41')](handleError(_0x5e3bdb,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 3edd42a..e99e94b 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 _0x1ed3=['report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','./whatsappTransferReport.attributes','exports','WhatsappTransferReport'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x1ed3,0x120));var _0x31ed=function(_0x540687,_0x1f5277){_0x540687=_0x540687-0x0;var _0x53e71a=_0x1ed3[_0x540687];return _0x53e71a;};'use strict';var _=require(_0x31ed('0x0'));var util=require(_0x31ed('0x1'));var logger=require(_0x31ed('0x2'))(_0x31ed('0x3'));var moment=require('moment');var BPromise=require(_0x31ed('0x4'));var rp=require(_0x31ed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x31ed('0x6'));module[_0x31ed('0x7')]=function(_0x19e1db,_0x40e816){return _0x19e1db['define'](_0x31ed('0x8'),attributes,{'tableName':_0x31ed('0x9'),'paranoid':![],'indexes':[{'name':_0x31ed('0xa'),'fields':[_0x31ed('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8f5d=['../../config/environment','exports','define','report_whatsapp_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x506d1c,_0x5136fd){var _0x387d7b=function(_0x4ff693){while(--_0x4ff693){_0x506d1c['push'](_0x506d1c['shift']());}};_0x387d7b(++_0x5136fd);}(_0x8f5d,0x6d));var _0xd8f5=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x8f5d[_0x1589dd];return _0x1bddd1;};'use strict';var _=require(_0xd8f5('0x0'));var util=require(_0xd8f5('0x1'));var logger=require('../../config/logger')(_0xd8f5('0x2'));var moment=require(_0xd8f5('0x3'));var BPromise=require(_0xd8f5('0x4'));var rp=require(_0xd8f5('0x5'));var fs=require('fs');var path=require(_0xd8f5('0x6'));var rimraf=require(_0xd8f5('0x7'));var config=require(_0xd8f5('0x8'));var attributes=require('./whatsappTransferReport.attributes');module[_0xd8f5('0x9')]=function(_0x32a2a4,_0x30a971){return _0x32a2a4[_0xd8f5('0xa')]('WhatsappTransferReport',attributes,{'tableName':_0xd8f5('0xb'),'paranoid':![],'indexes':[{'name':_0xd8f5('0xc'),'fields':[_0xd8f5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 456379f..75abd2a 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 _0xaad2=['then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','randomstring','../../config/utils','../../config/logger','jayson/promise','request'];(function(_0x595196,_0x797219){var _0x1e46fd=function(_0xb8bceb){while(--_0xb8bceb){_0x595196['push'](_0x595196['shift']());}};_0x1e46fd(++_0x797219);}(_0xaad2,0x18a));var _0x2aad=function(_0x1ae491,_0x5b83b9){_0x1ae491=_0x1ae491-0x0;var _0x4958a5=_0xaad2[_0x1ae491];return _0x4958a5;};'use strict';var _=require(_0x2aad('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2aad('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2aad('0x2'));var logger=require(_0x2aad('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2aad('0x4'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x311a03,_0x10d29f,_0x363410){return new BPromise(function(_0x36b59c,_0x42ae2c){return client[_0x2aad('0x5')](_0x311a03,_0x363410)[_0x2aad('0x6')](function(_0x3c18c2){logger[_0x2aad('0x7')](_0x2aad('0x8'),_0x10d29f,_0x2aad('0x9'));logger[_0x2aad('0xa')](_0x2aad('0xb'),_0x10d29f,_0x2aad('0x9'),JSON[_0x2aad('0xc')](_0x3c18c2));if(_0x3c18c2['error']){if(_0x3c18c2[_0x2aad('0xd')]['code']===0x1f4){logger[_0x2aad('0xd')](_0x2aad('0x8'),_0x10d29f,_0x3c18c2[_0x2aad('0xd')][_0x2aad('0xe')]);return _0x42ae2c(_0x3c18c2[_0x2aad('0xd')]['message']);}logger[_0x2aad('0xd')](_0x2aad('0x8'),_0x10d29f,_0x3c18c2['error']['message']);return _0x36b59c(_0x3c18c2[_0x2aad('0xd')][_0x2aad('0xe')]);}else{logger[_0x2aad('0x7')](_0x2aad('0x8'),_0x10d29f,_0x2aad('0x9'));_0x36b59c(_0x3c18c2[_0x2aad('0xf')]['message']);}})['catch'](function(_0x313ef3){logger[_0x2aad('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x10d29f,_0x313ef3);_0x42ae2c(_0x313ef3);});});} \ No newline at end of file +var _0x5647=['info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x197185,_0x251145){var _0x2c8af1=function(_0x1dbcfd){while(--_0x1dbcfd){_0x197185['push'](_0x197185['shift']());}};_0x2c8af1(++_0x251145);}(_0x5647,0xb6));var _0x7564=function(_0x5457f6,_0x36e0e4){_0x5457f6=_0x5457f6-0x0;var _0x57339d=_0x5647[_0x5457f6];return _0x57339d;};'use strict';var _=require(_0x7564('0x0'));var util=require(_0x7564('0x1'));var moment=require('moment');var BPromise=require(_0x7564('0x2'));var rs=require(_0x7564('0x3'));var fs=require('fs');var Redis=require(_0x7564('0x4'));var db=require(_0x7564('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7564('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7564('0x7'));var client=jayson[_0x7564('0x8')][_0x7564('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17cfca,_0x349aad,_0xd6bac6){return new BPromise(function(_0x400d73,_0x5969d7){return client[_0x7564('0xa')](_0x17cfca,_0xd6bac6)['then'](function(_0x22d759){logger['info'](_0x7564('0xb'),_0x349aad,_0x7564('0xc'));logger['debug'](_0x7564('0xd'),_0x349aad,_0x7564('0xc'),JSON[_0x7564('0xe')](_0x22d759));if(_0x22d759[_0x7564('0xf')]){if(_0x22d759[_0x7564('0xf')][_0x7564('0x10')]===0x1f4){logger[_0x7564('0xf')](_0x7564('0xb'),_0x349aad,_0x22d759[_0x7564('0xf')]['message']);return _0x5969d7(_0x22d759[_0x7564('0xf')][_0x7564('0x11')]);}logger[_0x7564('0xf')](_0x7564('0xb'),_0x349aad,_0x22d759['error'][_0x7564('0x11')]);return _0x400d73(_0x22d759[_0x7564('0xf')]['message']);}else{logger[_0x7564('0x12')](_0x7564('0xb'),_0x349aad,_0x7564('0xc'));_0x400d73(_0x22d759[_0x7564('0x13')][_0x7564('0x11')]);}})['catch'](function(_0x208a8e){logger['error'](_0x7564('0xb'),_0x349aad,_0x208a8e);_0x5969d7(_0x208a8e);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 62afdb4..e3eff05 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbcc7=['\x20processes\x20failed\x20at\x20startup:\x20','pm2_env','name','online','join','Offline\x20apps:','map','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/license','./config/logger','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','seedDB','then','default','listen','start','info','filter','exitCode','number','length'];(function(_0xc6d82f,_0x35d57e){var _0x341699=function(_0x222897){while(--_0x222897){_0xc6d82f['push'](_0xc6d82f['shift']());}};_0x341699(++_0x35d57e);}(_0xbcc7,0x19a));var _0x7bcc=function(_0x4d4ff3,_0x266eaa){_0x4d4ff3=_0x4d4ff3-0x0;var _0x5a41ef=_0xbcc7[_0x4d4ff3];return _0x5a41ef;};'use strict';var _=require(_0x7bcc('0x0'));var db=require(_0x7bcc('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x7bcc('0x2'));var rpc=require('./rpc');var config=require('./config/environment');var logger=require(_0x7bcc('0x3'))('app');var pm2=require(_0x7bcc('0x4'));var pm2Config=require(_0x7bcc('0x5'));var schedule=require('./config/schedule');var chat=require(_0x7bcc('0x6'));var whatsapp=require(_0x7bcc('0x7'));var transcribe=require(_0x7bcc('0x8'));var provider=require(_0x7bcc('0x9'));function main(){return db[_0x7bcc('0xa')][_0x7bcc('0xb')]()['then'](function(){if(config[_0x7bcc('0xc')]){return seedDb['default']();}})[_0x7bcc('0xd')](function(){return checkLicense[_0x7bcc('0xe')]();})['then'](function(){return rpc[_0x7bcc('0xf')]();})['then'](function(_0x58e035){logger['info'](_0x58e035);return chat[_0x7bcc('0x10')]();})[_0x7bcc('0xd')](function(){return whatsapp[_0x7bcc('0x10')]();})[_0x7bcc('0xd')](function(){return schedule[_0x7bcc('0x10')]();})[_0x7bcc('0xd')](function(){return transcribe[_0x7bcc('0x10')]();})['then'](function(){return provider[_0x7bcc('0x10')]();})[_0x7bcc('0xd')](function(_0x4659c5){logger[_0x7bcc('0x11')](_0x4659c5);return pm2[_0x7bcc('0x10')](pm2Config);})[_0x7bcc('0xd')](function(_0x4a2539){var _0x3998c5=_0x4a2539[_0x7bcc('0x12')](function(_0x148618){return typeof _0x148618[_0x7bcc('0x13')]===_0x7bcc('0x14')&&_0x148618[_0x7bcc('0x13')]>=0x0;});if(_0x3998c5[_0x7bcc('0x15')]>0x0){throw new Error(_0x3998c5['length']+_0x7bcc('0x16')+_['map'](_0x3998c5,function(_0x3156f3){return'\x22'+_0x3156f3[_0x7bcc('0x17')][_0x7bcc('0x18')]+'\x22';}));}logger[_0x7bcc('0x11')]('Online\x20apps:',_['map'](_[_0x7bcc('0x12')](_0x4a2539,{'status':_0x7bcc('0x19')}),_0x7bcc('0x18'))[_0x7bcc('0x1a')]());logger[_0x7bcc('0x11')](_0x7bcc('0x1b'),_[_0x7bcc('0x1c')](_[_0x7bcc('0x12')](_0x4a2539,function(_0x15b2c3){return _0x15b2c3['status']!=='online';}),_0x7bcc('0x18'))[_0x7bcc('0x1a')]()||_0x7bcc('0x1d'));console[_0x7bcc('0x1e')](_0x7bcc('0x1f'));})[_0x7bcc('0x20')](function(_0x416af4){console[_0x7bcc('0x1e')](_0x7bcc('0x21'),_0x416af4);logger['error'](_0x7bcc('0x22'),_0x416af4);process[_0x7bcc('0x23')](0x1);});}main(); \ No newline at end of file +var _0x106f=['./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','listen','info','start','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','Online\x20apps:','online','name','join','Offline\x20apps:','status','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/license','./rpc','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x106f,0x162));var _0xf106=function(_0x3d665a,_0x51a653){_0x3d665a=_0x3d665a-0x0;var _0x3db2b7=_0x106f[_0x3d665a];return _0x3db2b7;};'use strict';var _=require(_0xf106('0x0'));var db=require(_0xf106('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0xf106('0x2'));var rpc=require(_0xf106('0x3'));var config=require('./config/environment');var logger=require(_0xf106('0x4'))('app');var pm2=require(_0xf106('0x5'));var pm2Config=require(_0xf106('0x6'));var schedule=require(_0xf106('0x7'));var chat=require(_0xf106('0x8'));var whatsapp=require(_0xf106('0x9'));var transcribe=require(_0xf106('0xa'));var provider=require(_0xf106('0xb'));function main(){return db['sequelize'][_0xf106('0xc')]()[_0xf106('0xd')](function(){if(config['seedDB']){return seedDb['default']();}})['then'](function(){return checkLicense['default']();})['then'](function(){return rpc[_0xf106('0xe')]();})[_0xf106('0xd')](function(_0x1b5921){logger[_0xf106('0xf')](_0x1b5921);return chat[_0xf106('0x10')]();})[_0xf106('0xd')](function(){return whatsapp[_0xf106('0x10')]();})[_0xf106('0xd')](function(){return schedule[_0xf106('0x10')]();})[_0xf106('0xd')](function(){return transcribe[_0xf106('0x10')]();})['then'](function(){return provider[_0xf106('0x10')]();})[_0xf106('0xd')](function(_0x52cbb5){logger['info'](_0x52cbb5);return pm2[_0xf106('0x10')](pm2Config);})[_0xf106('0xd')](function(_0x292a0d){var _0x4bc341=_0x292a0d[_0xf106('0x11')](function(_0x26186f){return typeof _0x26186f[_0xf106('0x12')]==='number'&&_0x26186f[_0xf106('0x12')]>=0x0;});if(_0x4bc341[_0xf106('0x13')]>0x0){throw new Error(_0x4bc341['length']+_0xf106('0x14')+_[_0xf106('0x15')](_0x4bc341,function(_0x62352){return'\x22'+_0x62352['pm2_env']['name']+'\x22';}));}logger[_0xf106('0xf')](_0xf106('0x16'),_[_0xf106('0x15')](_['filter'](_0x292a0d,{'status':_0xf106('0x17')}),_0xf106('0x18'))[_0xf106('0x19')]());logger[_0xf106('0xf')](_0xf106('0x1a'),_[_0xf106('0x15')](_[_0xf106('0x11')](_0x292a0d,function(_0x232a54){return _0x232a54[_0xf106('0x1b')]!=='online';}),'name')[_0xf106('0x19')]()||'None');console[_0xf106('0x1c')](_0xf106('0x1d'));})[_0xf106('0x1e')](function(_0x228afc){console[_0xf106('0x1c')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x228afc);logger['error'](_0xf106('0x1f'),_0x228afc);process[_0xf106('0x20')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 6b8ea08..ac7a5ee 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 _0x9bde=['whatsappAutoanswerDelay','isChatInteractionAuthorized','use','user','ChatInteraction','params','closed','disposition','then','status','unmanaged','Forbidden.','catch','isAuthenticated','headers','authorization','startsWith','User','find','authenticate','pass','json','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','send','isNil','generateApiKey','regenerateApiKey','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','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','unshift','encryptString','join','sign','secret','payload','options','promisify','verify','randomBytes','toString','hex','floor','now','HS512','../../config/environment','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','chatPause','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9bde,0xe1));var _0xe9bd=function(_0x23d7e5,_0x37fdc0){_0x23d7e5=_0x23d7e5-0x0;var _0x4727ff=_0x9bde[_0x23d7e5];return _0x4727ff;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xe9bd('0x0'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xe9bd('0x1'));var encryptor=require('../encryptor');var _=require(_0xe9bd('0x2'));var jwt=require(_0xe9bd('0x3'));var expressJwt=require(_0xe9bd('0x4'));var compose=require(_0xe9bd('0x5'));var basicAuth=require(_0xe9bd('0x6'));var crypto=require(_0xe9bd('0x7'));var BPromise=require(_0xe9bd('0x8'));var util=require('util');var moment=require(_0xe9bd('0x9'));var validateJwt=expressJwt({'secret':config[_0xe9bd('0xa')][_0xe9bd('0xb')]});var userAttributes=['id',_0xe9bd('0xc'),_0xe9bd('0xd'),_0xe9bd('0xe'),_0xe9bd('0xf'),_0xe9bd('0x10'),_0xe9bd('0x11'),_0xe9bd('0x12'),'md5secret','voicePause',_0xe9bd('0x13'),_0xe9bd('0x14'),_0xe9bd('0x15'),'smsPause',_0xe9bd('0x16'),_0xe9bd('0x17'),_0xe9bd('0x18'),_0xe9bd('0x19'),'lastPauseAt',_0xe9bd('0x1a'),'allowmessenger',_0xe9bd('0x1b'),_0xe9bd('0x1c'),_0xe9bd('0x1d'),'phoneBarAutoAnswerDelay','phoneBarDnd',_0xe9bd('0x1e'),_0xe9bd('0x1f'),_0xe9bd('0x20'),_0xe9bd('0x21'),_0xe9bd('0x22'),_0xe9bd('0x23'),_0xe9bd('0x24'),'hotdesk',_0xe9bd('0x25'),_0xe9bd('0x26'),_0xe9bd('0x27'),'settingsEnabled',_0xe9bd('0x28'),_0xe9bd('0x29'),_0xe9bd('0x2a'),_0xe9bd('0x2b'),'ignorePauseForPreviewCalls',_0xe9bd('0x2c'),'chatAutoanswer',_0xe9bd('0x2d'),'emailAutoanswer',_0xe9bd('0x2e'),_0xe9bd('0x2f'),_0xe9bd('0x30'),_0xe9bd('0x31'),_0xe9bd('0x32'),_0xe9bd('0x33'),_0xe9bd('0x34'),'whatsappAutoanswer',_0xe9bd('0x35')];exports[_0xe9bd('0x36')]=function(){return this['isAuthenticated'](!![])[_0xe9bd('0x37')](function(_0x505c23,_0x238ab1,_0x1b9cc9){if(_0x505c23[_0xe9bd('0x38')]){_0x1b9cc9();}else{return db[_0xe9bd('0x39')]['findOne']({'where':{'id':_0x505c23[_0xe9bd('0x3a')]['id']},'attributes':['id',_0xe9bd('0x3b'),_0xe9bd('0x3c')],'raw':!![]})[_0xe9bd('0x3d')](function(_0x2641be){if(_0x2641be&&_0x2641be[_0xe9bd('0x3b')]){return _0x238ab1[_0xe9bd('0x3e')](_0x2641be[_0xe9bd('0x3c')]===_0xe9bd('0x3f')?0x195:0x193)['json']({'message':_0x2641be[_0xe9bd('0x3c')]===_0xe9bd('0x3f')?'Unmanaged.':_0xe9bd('0x40')});}else{_0x1b9cc9();}})[_0xe9bd('0x41')](function(_0x119672){_0x1b9cc9(_0x119672);});}});};exports[_0xe9bd('0x42')]=function isAuthenticated(_0x141b95){return compose()[_0xe9bd('0x37')](function(_0x519f48,_0x5b7f1d,_0x1de54c){var _0x56e409;if(_0x519f48[_0xe9bd('0x43')][_0xe9bd('0x44')]){if(_[_0xe9bd('0x45')](_0x519f48[_0xe9bd('0x43')][_0xe9bd('0x44')],'Basic')){var _0x4b7bc2=basicAuth(_0x519f48);db[_0xe9bd('0x46')][_0xe9bd('0x47')]({'where':{'name':_0x4b7bc2[_0xe9bd('0xe')]}})[_0xe9bd('0x3d')](function(_0xe2436){if(!_0xe2436||!_0xe2436[_0xe9bd('0x48')](_0x4b7bc2[_0xe9bd('0x49')])){return _0x5b7f1d[_0xe9bd('0x3e')](0x191)[_0xe9bd('0x4a')]({'message':'Wrong\x20credentials.'});}_0x519f48[_0xe9bd('0x38')]={'id':_0xe2436['id']};_0x1de54c();})[_0xe9bd('0x41')](function(_0x390a43){_0x1de54c(_0x390a43);});}else if(_['startsWith'](_0x519f48['headers'][_0xe9bd('0x44')],_0xe9bd('0x4b'))){validateJwt(_0x519f48,_0x5b7f1d,_0x1de54c);}else{if(_0x141b95){_0x1de54c();}else{return _0x5b7f1d[_0xe9bd('0x3e')](0x193)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x4c')});}}}else if(_0x519f48[_0xe9bd('0x4d')][_0xe9bd('0x4e')]){try{var _0x1c6173={'audience':hardwareConf[_0xe9bd('0x4f')](),'issuer':hardwareConf[_0xe9bd('0x4f')]()};verifyJwt(_0x519f48[_0xe9bd('0x4d')][_0xe9bd('0x4e')],_0x1c6173)[_0xe9bd('0x3d')](function(_0x199477){return db[_0xe9bd('0x46')][_0xe9bd('0x47')]({'where':{'id':_0x199477[_0xe9bd('0x50')]}})[_0xe9bd('0x3d')](function(_0x4c689d){_0x56e409=_0x4c689d;return db[_0xe9bd('0x51')][_0xe9bd('0x52')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xe9bd('0x53')],'raw':!![]});})[_0xe9bd('0x3d')](function(_0x4c7d47){if(!_0x56e409||!_['isEqual'](_0x56e409[_0xe9bd('0x54')],_0x199477[_0xe9bd('0x55')])){return _0x5b7f1d['status'](0x191)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x56')});}if(_0x56e409[_0xe9bd('0x57')]){return _0x5b7f1d['status'](0x191)[_0xe9bd('0x4a')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x56e409[_0xe9bd('0x58')]){if(_0x4c7d47[_0xe9bd('0x53')]>0x0){if(moment(_0x56e409[_0xe9bd('0x59')])[_0xe9bd('0x5a')](_0x4c7d47['blockDuration'],_0xe9bd('0x5b'))>moment()){return _0x5b7f1d[_0xe9bd('0x3e')](0x191)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5c')});}}else{return _0x5b7f1d[_0xe9bd('0x3e')](0x191)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5c')});}}_0x519f48[_0xe9bd('0x38')]={'id':_0x56e409['id']};_0x1de54c();});})[_0xe9bd('0x41')](function(){return _0x5b7f1d[_0xe9bd('0x3e')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0xcf9a0c){_0x1de54c(_0xcf9a0c);}}else if(_0x141b95){_0x1de54c();}else{return _0x5b7f1d['status'](0x193)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x4c')});}})[_0xe9bd('0x37')](function(_0x480797,_0x1ba613,_0x2923cf){if(_0x480797[_0xe9bd('0x38')]){db['User'][_0xe9bd('0x47')]({'where':{'id':_0x480797[_0xe9bd('0x38')]['id']},'attributes':userAttributes})[_0xe9bd('0x3d')](function(_0x388132){if(!_0x388132){return _0x1ba613[_0xe9bd('0x3e')](0x194)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5d')});}_0x480797[_0xe9bd('0x38')]=_0x388132;_0x2923cf();})[_0xe9bd('0x41')](function(_0x300e07){_0x2923cf(_0x300e07);});}else if(_0x141b95){_0x2923cf();}else{return _0x1ba613[_0xe9bd('0x3e')](0x194)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5e')});}});};exports[_0xe9bd('0x5f')]=function canUpdate(){return compose()[_0xe9bd('0x37')](function(_0x5b70d3,_0x5a86fd,_0x283e67){return licenseUtil[_0xe9bd('0x60')]()[_0xe9bd('0x3d')](function(_0x58828b){if(_0x58828b['update']){_0x283e67();}else{return _0x5a86fd[_0xe9bd('0x3e')](0x193)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x61')});}})[_0xe9bd('0x41')](function(_0x39fb61){_0x283e67(_0x39fb61);});});};exports[_0xe9bd('0x62')]=function isWebrtcLicence(){return compose()[_0xe9bd('0x37')](function(_0x512899,_0x1e45fc,_0x4cc146){return licenseUtil[_0xe9bd('0x60')]()[_0xe9bd('0x3d')](function(_0x33ba69){if(_0x33ba69[_0xe9bd('0x63')]){_0x4cc146();}else{return _0x1e45fc[_0xe9bd('0x3e')](0x193)['json']({'message':_0xe9bd('0x61')});}})[_0xe9bd('0x41')](function(_0xe14fa4){_0x4cc146(_0xe14fa4);});});};exports['isMiddleware']=function(_0xff4e14,_0x476f23,_0x34f787){_0xff4e14['isMiddleware']=!![];return _0x34f787();};exports[_0xe9bd('0x64')]=function signToken(_0x27e7b0){return signJwt(_0x27e7b0);};exports[_0xe9bd('0x65')]=function(_0x10ec29,_0x1ee09c){if(!_0x10ec29['user']){return _0x1ee09c[_0xe9bd('0x3e')](0x194)['json']({'message':_0xe9bd('0x66')});}var _0x239be9={'payload':{'id':_0x10ec29[_0xe9bd('0x38')]['id'],'role':_0x10ec29[_0xe9bd('0x38')][_0xe9bd('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x239be9)['then'](function(_0x15d1d0){_0x1ee09c['cookie'](_0xe9bd('0x67'),_0x15d1d0);_0x1ee09c[_0xe9bd('0x68')]('/dashboards/general');})['catch'](function(_0x1ce539){return _0x1ee09c['status'](0x1f4)[_0xe9bd('0x69')](_0x1ce539);});};exports['retrieveApiKey']=function(_0x26b25a){if(_[_0xe9bd('0x6a')](_0x26b25a['apiKeyNonce'])||_[_0xe9bd('0x6a')](_0x26b25a['apiKeyIat'])){return null;}else{return createJwt(_0x26b25a);}};exports[_0xe9bd('0x6b')]=function(_0x2d9a94){_0x2d9a94[_0xe9bd('0x54')]=generateNonce();_0x2d9a94['apiKeyIat']=generateIssuedAt();return createJwt(_0x2d9a94);};exports[_0xe9bd('0x6c')]=function(_0x1d703f,_0x45b69e){var _0x232a36=_0x1d703f['query']['apikey'];if(_0x232a36){var _0x441f89={'nonce':_0x45b69e['apiKeyNonce'],'iat':_0x45b69e[_0xe9bd('0x6d')],'audience':hardwareConf[_0xe9bd('0x4f')](),'issuer':hardwareConf[_0xe9bd('0x4f')]()};return verifyJwt(_0x232a36,_0x441f89)[_0xe9bd('0x3d')](function(){return generateApiKey(_0x45b69e);});}else{throw{'message':_0xe9bd('0x6e')};}};exports[_0xe9bd('0x6f')]=function(_0x373057){var _0x3381ee=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3381ee[_0xe9bd('0x70')](_0x373057))throw new db[(_0xe9bd('0x71'))][(_0xe9bd('0x72'))](_0xe9bd('0x73'));return;};exports['validatePasswordHistory']=function(_0x596a7d,_0x566dd8,_0x10e685){var _0x5a516e=encryptor[_0xe9bd('0x74')](_0x566dd8)[_0xe9bd('0x75')](',');for(var _0x90db01=0x0;_0x90db01<_0x10e685;_0x90db01++){if(!_0x5a516e[_0x90db01])break;if(_0x596a7d[_0xe9bd('0x76')]()===_0x5a516e[_0x90db01][_0xe9bd('0x76')]()){var _0xaf6ffd=util[_0xe9bd('0x77')](_0xe9bd('0x78'),_0x10e685);if(_0x10e685===0x1){_0xaf6ffd=_0xe9bd('0x79');}throw new db['Sequelize'][(_0xe9bd('0x72'))](_0xaf6ffd);}}return;};exports[_0xe9bd('0x7a')]=function(_0x3d3e74,_0x3f848d){var _0x4d58c1=_0x3f848d?encryptor[_0xe9bd('0x74')](_0x3f848d)[_0xe9bd('0x75')](','):[];if(_0x4d58c1[_0xe9bd('0x7b')]===0x5){_0x4d58c1['splice'](-0x1,0x1);}_0x4d58c1[_0xe9bd('0x7c')](_0x3d3e74);return encryptor[_0xe9bd('0x7d')](_0x4d58c1[_0xe9bd('0x7e')](','));};function signJwt(_0xfe82f7){var _0x4ee26a=BPromise['promisify'](jwt[_0xe9bd('0x7f')],{'context':jwt});var _0x188891=_0xfe82f7[_0xe9bd('0x80')]||config[_0xe9bd('0xa')]['session'];return new BPromise(function(_0x49add9,_0x305efa){_0x4ee26a(_0xfe82f7[_0xe9bd('0x81')],_0x188891,_0xfe82f7[_0xe9bd('0x82')])[_0xe9bd('0x3d')](function(_0x1fd2b5){_0x49add9(_0x1fd2b5);})[_0xe9bd('0x41')](function(_0x4870f8){_0x305efa(_0x4870f8);});});}function verifyJwt(_0x179c8d,_0x5681ab,_0x27e07c){var _0x28dd03=BPromise[_0xe9bd('0x83')](jwt[_0xe9bd('0x84')],{'context':jwt});var _0x5bc1f8=_0x27e07c||config[_0xe9bd('0xa')][_0xe9bd('0xb')];return new BPromise(function(_0x3b0190,_0x4f35c4){_0x28dd03(_0x179c8d,_0x5bc1f8,_0x5681ab)[_0xe9bd('0x3d')](function(_0x1a9d0c){_0x3b0190(_0x1a9d0c);})[_0xe9bd('0x41')](function(_0x3e3e05){_0x4f35c4(_0x3e3e05);});});}function generateNonce(){return crypto[_0xe9bd('0x85')](0x10)[_0xe9bd('0x86')](_0xe9bd('0x87'));}function generateIssuedAt(){return Math[_0xe9bd('0x88')](Date[_0xe9bd('0x89')]()/0x3e8)[_0xe9bd('0x86')]();}function createJwt(_0x14c599){var _0x37d07a={'payload':{'iat':_0x14c599['apiKeyIat'],'nonce':_0x14c599[_0xe9bd('0x54')]},'options':{'algorithm':_0xe9bd('0x8a'),'subject':_0x14c599['id']['toString'](),'issuer':hardwareConf[_0xe9bd('0x4f')](),'audience':hardwareConf[_0xe9bd('0x4f')]()}};return signJwt(_0x37d07a)['then'](function(_0x561165){return{'iat':_0x14c599[_0xe9bd('0x6d')],'nonce':_0x14c599[_0xe9bd('0x54')],'token':_0x561165};});} \ No newline at end of file +var _0xa41a=['passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','User','name','then','status','json','Wrong\x20credentials.','startsWith','Bearer','query','apikey','getUuid','find','sub','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','Forbidden','isWebrtcLicence','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','length','splice','unshift','join','promisify','sign','secret','verify','secrets','session','randomBytes','now','toString','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','util','moment','role','fullname','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','openchannelPause','pauseType','lastPauseAt','allowmessenger'];(function(_0x4b8d8e,_0x479a0a){var _0x2cc0a6=function(_0x3936f6){while(--_0x3936f6){_0x4b8d8e['push'](_0x4b8d8e['shift']());}};_0x2cc0a6(++_0x479a0a);}(_0xa41a,0x6b));var _0xaa41=function(_0xd1f236,_0x174637){_0xd1f236=_0xd1f236-0x0;var _0xe68c12=_0xa41a[_0xd1f236];return _0xe68c12;};'use strict';var db=require(_0xaa41('0x0'))['db'];var config=require(_0xaa41('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xaa41('0x2'));var encryptor=require(_0xaa41('0x3'));var _=require(_0xaa41('0x4'));var jwt=require(_0xaa41('0x5'));var expressJwt=require(_0xaa41('0x6'));var compose=require(_0xaa41('0x7'));var basicAuth=require(_0xaa41('0x8'));var crypto=require(_0xaa41('0x9'));var BPromise=require('bluebird');var util=require(_0xaa41('0xa'));var moment=require(_0xaa41('0xb'));var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0xaa41('0xc'),_0xaa41('0xd'),'name',_0xaa41('0xe'),_0xaa41('0xf'),_0xaa41('0x10'),_0xaa41('0x11'),_0xaa41('0x12'),_0xaa41('0x13'),_0xaa41('0x14'),_0xaa41('0x15'),_0xaa41('0x16'),'smsPause',_0xaa41('0x17'),_0xaa41('0x18'),'showWebBar','lastLoginAt',_0xaa41('0x19'),'crudPermissions',_0xaa41('0x1a'),_0xaa41('0x1b'),_0xaa41('0x1c'),_0xaa41('0x1d'),_0xaa41('0x1e'),'phoneBarDnd',_0xaa41('0x1f'),_0xaa41('0x20'),_0xaa41('0x21'),_0xaa41('0x22'),_0xaa41('0x23'),_0xaa41('0x24'),_0xaa41('0x25'),'hotdesk',_0xaa41('0x26'),_0xaa41('0x27'),_0xaa41('0x28'),_0xaa41('0x29'),_0xaa41('0x2a'),_0xaa41('0x2b'),_0xaa41('0x2c'),_0xaa41('0x2d'),_0xaa41('0x2e'),'selectRecallMeCampaign','chatAutoanswer',_0xaa41('0x2f'),_0xaa41('0x30'),_0xaa41('0x31'),'smsAutoanswer',_0xaa41('0x32'),_0xaa41('0x33'),'openchannelAutoanswerDelay','faxAutoanswer',_0xaa41('0x34'),'whatsappAutoanswer',_0xaa41('0x35')];exports[_0xaa41('0x36')]=function(){return this[_0xaa41('0x37')](!![])[_0xaa41('0x38')](function(_0x1d623c,_0x4eb01f,_0x43c430){if(_0x1d623c[_0xaa41('0x39')]){_0x43c430();}else{return db[_0xaa41('0x3a')][_0xaa41('0x3b')]({'where':{'id':_0x1d623c[_0xaa41('0x3c')]['id']},'attributes':['id',_0xaa41('0x3d'),'disposition'],'raw':!![]})['then'](function(_0x16aec5){if(_0x16aec5&&_0x16aec5['closed']){return _0x4eb01f['status'](_0x16aec5[_0xaa41('0x3e')]==='unmanaged'?0x195:0x193)['json']({'message':_0x16aec5[_0xaa41('0x3e')]===_0xaa41('0x3f')?_0xaa41('0x40'):_0xaa41('0x41')});}else{_0x43c430();}})[_0xaa41('0x42')](function(_0xa7269f){_0x43c430(_0xa7269f);});}});};exports['isAuthenticated']=function isAuthenticated(_0x30a174){return compose()[_0xaa41('0x38')](function(_0x63c18c,_0x9a16e3,_0x1d8c2b){var _0x4466a3;if(_0x63c18c[_0xaa41('0x43')][_0xaa41('0x44')]){if(_['startsWith'](_0x63c18c[_0xaa41('0x43')]['authorization'],'Basic')){var _0x714537=basicAuth(_0x63c18c);db[_0xaa41('0x45')]['find']({'where':{'name':_0x714537[_0xaa41('0x46')]}})[_0xaa41('0x47')](function(_0x4e3b44){if(!_0x4e3b44||!_0x4e3b44['authenticate'](_0x714537['pass'])){return _0x9a16e3[_0xaa41('0x48')](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x4a')});}_0x63c18c[_0xaa41('0x39')]={'id':_0x4e3b44['id']};_0x1d8c2b();})['catch'](function(_0x289c4a){_0x1d8c2b(_0x289c4a);});}else if(_[_0xaa41('0x4b')](_0x63c18c[_0xaa41('0x43')]['authorization'],_0xaa41('0x4c'))){validateJwt(_0x63c18c,_0x9a16e3,_0x1d8c2b);}else{if(_0x30a174){_0x1d8c2b();}else{return _0x9a16e3[_0xaa41('0x48')](0x193)[_0xaa41('0x49')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x63c18c[_0xaa41('0x4d')][_0xaa41('0x4e')]){try{var _0x57fe1d={'audience':hardwareConf[_0xaa41('0x4f')](),'issuer':hardwareConf[_0xaa41('0x4f')]()};verifyJwt(_0x63c18c[_0xaa41('0x4d')]['apikey'],_0x57fe1d)[_0xaa41('0x47')](function(_0x48335f){return db[_0xaa41('0x45')][_0xaa41('0x50')]({'where':{'id':_0x48335f[_0xaa41('0x51')]}})['then'](function(_0x526377){_0x4466a3=_0x526377;return db['Setting'][_0xaa41('0x3b')]({'where':{'id':0x1},'attributes':[_0xaa41('0x52'),_0xaa41('0x53')],'raw':!![]});})[_0xaa41('0x47')](function(_0x4fbb92){if(!_0x4466a3||!_['isEqual'](_0x4466a3[_0xaa41('0x54')],_0x48335f[_0xaa41('0x55')])){return _0x9a16e3[_0xaa41('0x48')](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x56')});}if(_0x4466a3[_0xaa41('0x57')]){return _0x9a16e3[_0xaa41('0x48')](0x191)['json']({'message':_0xaa41('0x58')});}if(_0x4466a3[_0xaa41('0x59')]){if(_0x4fbb92[_0xaa41('0x53')]>0x0){if(moment(_0x4466a3[_0xaa41('0x5a')])['add'](_0x4fbb92['blockDuration'],_0xaa41('0x5b'))>moment()){return _0x9a16e3[_0xaa41('0x48')](0x191)['json']({'message':_0xaa41('0x58')});}}else{return _0x9a16e3['status'](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x58')});}}_0x63c18c[_0xaa41('0x39')]={'id':_0x4466a3['id']};_0x1d8c2b();});})[_0xaa41('0x42')](function(){return _0x9a16e3[_0xaa41('0x48')](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x58')});});}catch(_0x21f204){_0x1d8c2b(_0x21f204);}}else if(_0x30a174){_0x1d8c2b();}else{return _0x9a16e3['status'](0x193)[_0xaa41('0x49')]({'message':_0xaa41('0x5c')});}})[_0xaa41('0x38')](function(_0x398c35,_0xc84fb8,_0x1e2eb2){if(_0x398c35['user']){db['User'][_0xaa41('0x50')]({'where':{'id':_0x398c35['user']['id']},'attributes':userAttributes})[_0xaa41('0x47')](function(_0x215896){if(!_0x215896){return _0xc84fb8[_0xaa41('0x48')](0x194)[_0xaa41('0x49')]({'message':_0xaa41('0x5d')});}_0x398c35[_0xaa41('0x39')]=_0x215896;_0x1e2eb2();})[_0xaa41('0x42')](function(_0x5ee74c){_0x1e2eb2(_0x5ee74c);});}else if(_0x30a174){_0x1e2eb2();}else{return _0xc84fb8[_0xaa41('0x48')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xaa41('0x5e')]=function canUpdate(){return compose()['use'](function(_0x57240d,_0x5274c9,_0x3bad48){return licenseUtil['getLicense']()[_0xaa41('0x47')](function(_0x198716){if(_0x198716['update']){_0x3bad48();}else{return _0x5274c9['status'](0x193)[_0xaa41('0x49')]({'message':_0xaa41('0x5f')});}})[_0xaa41('0x42')](function(_0x2af8ba){_0x3bad48(_0x2af8ba);});});};exports[_0xaa41('0x60')]=function isWebrtcLicence(){return compose()[_0xaa41('0x38')](function(_0x258096,_0x37bf5d,_0x2fa6ec){return licenseUtil['getLicense']()[_0xaa41('0x47')](function(_0x22d512){if(_0x22d512[_0xaa41('0x61')]){_0x2fa6ec();}else{return _0x37bf5d[_0xaa41('0x48')](0x193)[_0xaa41('0x49')]({'message':_0xaa41('0x5f')});}})['catch'](function(_0x406824){_0x2fa6ec(_0x406824);});});};exports[_0xaa41('0x62')]=function(_0x1f50c,_0x2288f8,_0x57d1f6){_0x1f50c[_0xaa41('0x62')]=!![];return _0x57d1f6();};exports['signToken']=function signToken(_0x49fedd){return signJwt(_0x49fedd);};exports[_0xaa41('0x63')]=function(_0xe0eec0,_0x3e16ef){if(!_0xe0eec0['user']){return _0x3e16ef[_0xaa41('0x48')](0x194)[_0xaa41('0x49')]({'message':_0xaa41('0x64')});}var _0x48fa37={'payload':{'id':_0xe0eec0[_0xaa41('0x39')]['id'],'role':_0xe0eec0[_0xaa41('0x39')][_0xaa41('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x48fa37)[_0xaa41('0x47')](function(_0x37fbe2){_0x3e16ef[_0xaa41('0x65')](_0xaa41('0x66'),_0x37fbe2);_0x3e16ef[_0xaa41('0x67')]('/dashboards/general');})[_0xaa41('0x42')](function(_0x5bef5f){return _0x3e16ef['status'](0x1f4)[_0xaa41('0x68')](_0x5bef5f);});};exports[_0xaa41('0x69')]=function(_0x3fef3e){if(_[_0xaa41('0x6a')](_0x3fef3e[_0xaa41('0x54')])||_[_0xaa41('0x6a')](_0x3fef3e[_0xaa41('0x6b')])){return null;}else{return createJwt(_0x3fef3e);}};exports[_0xaa41('0x6c')]=function(_0x519e39){_0x519e39[_0xaa41('0x54')]=generateNonce();_0x519e39[_0xaa41('0x6b')]=generateIssuedAt();return createJwt(_0x519e39);};exports[_0xaa41('0x6d')]=function(_0x4f9e92,_0x2e0f53){var _0x35f664=_0x4f9e92['query'][_0xaa41('0x4e')];if(_0x35f664){var _0xd36d1a={'nonce':_0x2e0f53[_0xaa41('0x54')],'iat':_0x2e0f53['apiKeyIat'],'audience':hardwareConf[_0xaa41('0x4f')](),'issuer':hardwareConf[_0xaa41('0x4f')]()};return verifyJwt(_0x35f664,_0xd36d1a)['then'](function(){return generateApiKey(_0x2e0f53);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xaa41('0x6e')]=function(_0x3cd14f){var _0x3a29d2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3a29d2['test'](_0x3cd14f))throw new db[(_0xaa41('0x6f'))][(_0xaa41('0x70'))](_0xaa41('0x71'));return;};exports[_0xaa41('0x72')]=function(_0x2abb78,_0x5ccdc5,_0x2ae70c){var _0x57cb70=encryptor['decryptString'](_0x5ccdc5)[_0xaa41('0x73')](',');for(var _0x52ae7f=0x0;_0x52ae7f<_0x2ae70c;_0x52ae7f++){if(!_0x57cb70[_0x52ae7f])break;if(_0x2abb78[_0xaa41('0x74')]()===_0x57cb70[_0x52ae7f][_0xaa41('0x74')]()){var _0x169ddf=util['format'](_0xaa41('0x75'),_0x2ae70c);if(_0x2ae70c===0x1){_0x169ddf=_0xaa41('0x76');}throw new db[(_0xaa41('0x6f'))][(_0xaa41('0x70'))](_0x169ddf);}}return;};exports[_0xaa41('0x77')]=function(_0x332a3c,_0xc56018){var _0x337059=_0xc56018?encryptor[_0xaa41('0x78')](_0xc56018)['split'](','):[];if(_0x337059[_0xaa41('0x79')]===0x5){_0x337059[_0xaa41('0x7a')](-0x1,0x1);}_0x337059[_0xaa41('0x7b')](_0x332a3c);return encryptor['encryptString'](_0x337059[_0xaa41('0x7c')](','));};function signJwt(_0x2caf5c){var _0x157898=BPromise[_0xaa41('0x7d')](jwt[_0xaa41('0x7e')],{'context':jwt});var _0xfbe748=_0x2caf5c[_0xaa41('0x7f')]||config['secrets']['session'];return new BPromise(function(_0x5cb34d,_0x540325){_0x157898(_0x2caf5c['payload'],_0xfbe748,_0x2caf5c['options'])[_0xaa41('0x47')](function(_0x50b598){_0x5cb34d(_0x50b598);})['catch'](function(_0x24c6f3){_0x540325(_0x24c6f3);});});}function verifyJwt(_0x40a524,_0x1a877b,_0x312eee){var _0x5cabc4=BPromise[_0xaa41('0x7d')](jwt[_0xaa41('0x80')],{'context':jwt});var _0x1ddb6c=_0x312eee||config[_0xaa41('0x81')][_0xaa41('0x82')];return new BPromise(function(_0x41ca40,_0x46ebcd){_0x5cabc4(_0x40a524,_0x1ddb6c,_0x1a877b)[_0xaa41('0x47')](function(_0x1795d1){_0x41ca40(_0x1795d1);})['catch'](function(_0x185600){_0x46ebcd(_0x185600);});});}function generateNonce(){return crypto[_0xaa41('0x83')](0x10)['toString']('hex');}function generateIssuedAt(){return Math['floor'](Date[_0xaa41('0x84')]()/0x3e8)['toString']();}function createJwt(_0x1eac4a){var _0x5c8028={'payload':{'iat':_0x1eac4a[_0xaa41('0x6b')],'nonce':_0x1eac4a[_0xaa41('0x54')]},'options':{'algorithm':'HS512','subject':_0x1eac4a['id'][_0xaa41('0x85')](),'issuer':hardwareConf[_0xaa41('0x4f')](),'audience':hardwareConf[_0xaa41('0x4f')]()}};return signJwt(_0x5c8028)[_0xaa41('0x47')](function(_0x5a2683){return{'iat':_0x1eac4a['apiKeyIat'],'nonce':_0x1eac4a[_0xaa41('0x54')],'token':_0x5a2683};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 11b4a3e..ee9a8f1 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['skip','ids','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','rows','catch','CmContact','describe','keys','startsWith','slice','length','cf_','type','map','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','parseAdvancedSearchFilter','search','parseQueryParameters','where','default','fields','filter','clause','tags','user'];(function(_0x3e9e01,_0x1447c8){var _0x513c1b=function(_0x3dfebc){while(--_0x3dfebc){_0x3e9e01['push'](_0x3e9e01['shift']());}};_0x513c1b(++_0x1447c8);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var sqlUtils=require(_0x0baf('0x0'));var db=require(_0x0baf('0x1'))['db'];exports[_0x0baf('0x2')]=function(_0x263f79,_0x1688bc,_0x4d2e72,_0x5a3e42){var _0x232cc7={'count':0x0,'rows':[]};var _0x1c383e=sqlUtils[_0x0baf('0x3')](_0x1688bc,_0x263f79);if(_0x1c383e){return Promise[_0x0baf('0x4')](_0x232cc7);}var _0xe4c3c4=sqlUtils[_0x0baf('0x5')]();var _0x1a10b1={};var _0x2dcaac=![];var _0x1d0a0d=![];return Promise['resolve']()[_0x0baf('0x6')](function(){if(_0x263f79['search']){return sqlUtils[_0x0baf('0x7')](_0x263f79[_0x0baf('0x8')],_0x5a3e42);}else{return sqlUtils[_0x0baf('0x9')](_0x263f79,_0x5a3e42);}})[_0x0baf('0x6')](function(_0x7f54d4){_0xe4c3c4[_0x0baf('0xa')](_0x7f54d4[_0x0baf('0xb')]);_0xe4c3c4[_0x0baf('0xa')](_0x7f54d4[_0x0baf('0xc')]);_0xe4c3c4[_0x0baf('0xa')](_0x7f54d4[_0x0baf('0xd')]);_0xe4c3c4['where'](_0x7f54d4['user'][_0x0baf('0xe')]);_0x1a10b1=_0x7f54d4[_0x0baf('0xf')];_0x1d0a0d=_0x7f54d4[_0x0baf('0x10')][_0x0baf('0x11')];return sqlUtils['checkListsRestrictions'](_0x1688bc,_0x263f79,_0x1d0a0d);})[_0x0baf('0x6')](function(_0x49e44b){_0xe4c3c4[_0x0baf('0xa')](_0x49e44b);var _0x1f50c3=_0x263f79[_0x0baf('0x8')]?_0x1a10b1[_0x0baf('0x12')]:_0x263f79[_0x0baf('0x13')];_0x2dcaac=_0x1f50c3?!![]:![];return sqlUtils[_0x0baf('0x14')](_0xe4c3c4,_0x1f50c3);})['then'](function(_0x4cd79d){_0x232cc7[_0x0baf('0x15')]=_0x4cd79d;if(_0x232cc7[_0x0baf('0x15')]===0x0){return;}return sqlUtils[_0x0baf('0x16')](_0xe4c3c4,_0x263f79[_0x0baf('0xc')],_0x4d2e72,_0x2dcaac,_0x1a10b1[_0x0baf('0xe')],_0x1d0a0d);})[_0x0baf('0x6')](function(_0x53c338){if(!_0x53c338){return[];}return sqlUtils[_0x0baf('0x17')](_0x53c338,_0x263f79,_0x4d2e72);})[_0x0baf('0x6')](function(_0x1ef0e5){_0x232cc7[_0x0baf('0x18')]=_0x1ef0e5;return _0x232cc7;})[_0x0baf('0x19')](function(_0x42b7f2){throw _0x42b7f2;});};exports['describe']=function(){var _0x5cff5d={};var _0x1410ec=[];return db[_0x0baf('0x1a')][_0x0baf('0x1b')]()[_0x0baf('0x6')](function(_0x1fa92b){_0x5cff5d=_0x1fa92b;var _0x3e3e20=Object[_0x0baf('0x1c')](_0x5cff5d)[_0x0baf('0xd')](function(_0x2c42e2){return _[_0x0baf('0x1d')](_0x2c42e2,'cf_')?_0x2c42e2:undefined;});var _0x334bd6=_0x3e3e20['map'](function(_0xf6c158){return db['CmCustomField']['findOne']({'where':{'id':_0xf6c158[_0x0baf('0x1e')](0x3)},'raw':!![]});});return Promise['all'](_0x334bd6);})['then'](function(_0x47c4b){for(var _0x27b59c=0x0;_0x27b59c<_0x47c4b[_0x0baf('0x1f')];_0x27b59c++){if(_0x47c4b[_0x27b59c]){var _0x19d9fd=_0x0baf('0x20')+_0x47c4b[_0x27b59c]['id'];_0x5cff5d[_0x19d9fd]['fieldType']=_0x47c4b[_0x27b59c][_0x0baf('0x21')];}}_0x1410ec=_[_0x0baf('0x22')](Object[_0x0baf('0x1c')](_0x5cff5d),function(_0x366e71){return{'name':_0x366e71,'type':_0x5cff5d[_0x366e71][_0x0baf('0x21')]};});return _0x1410ec;})[_0x0baf('0x19')](function(_0x453525){throw _0x453525;});}; \ No newline at end of file +var _0x5f2f=['rows','catch','keys','filter','startsWith','cf_','map','CmCustomField','findOne','slice','length','fieldType','type','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseQueryParameters','where','fields','user','clause','tags','skip','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts'];(function(_0x3c30ef,_0x2a8600){var _0x15f0eb=function(_0x4f038f){while(--_0x4f038f){_0x3c30ef['push'](_0x3c30ef['shift']());}};_0x15f0eb(++_0x2a8600);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2dcf9a,_0x2713b8){_0x2dcf9a=_0x2dcf9a-0x0;var _0xda55a0=_0x5f2f[_0x2dcf9a];return _0xda55a0;};'use strict';var _=require(_0xf5f2('0x0'));var sqlUtils=require(_0xf5f2('0x1'));var db=require(_0xf5f2('0x2'))['db'];exports[_0xf5f2('0x3')]=function(_0x1172dd,_0x174bc7,_0x3c72ee,_0x107cf){var _0x501fbd={'count':0x0,'rows':[]};var _0x4854b6=sqlUtils[_0xf5f2('0x4')](_0x174bc7,_0x1172dd);if(_0x4854b6){return Promise[_0xf5f2('0x5')](_0x501fbd);}var _0xad7f65=sqlUtils[_0xf5f2('0x6')]();var _0x3133bc={};var _0x473100=![];var _0x5907aa=![];return Promise[_0xf5f2('0x5')]()[_0xf5f2('0x7')](function(){if(_0x1172dd[_0xf5f2('0x8')]){return sqlUtils['parseAdvancedSearchFilter'](_0x1172dd[_0xf5f2('0x8')],_0x107cf);}else{return sqlUtils[_0xf5f2('0x9')](_0x1172dd,_0x107cf);}})[_0xf5f2('0x7')](function(_0x4e0e6b){_0xad7f65[_0xf5f2('0xa')](_0x4e0e6b['default']);_0xad7f65['where'](_0x4e0e6b[_0xf5f2('0xb')]);_0xad7f65[_0xf5f2('0xa')](_0x4e0e6b['filter']);_0xad7f65[_0xf5f2('0xa')](_0x4e0e6b[_0xf5f2('0xc')][_0xf5f2('0xd')]);_0x3133bc=_0x4e0e6b[_0xf5f2('0xe')];_0x5907aa=_0x4e0e6b[_0xf5f2('0xc')][_0xf5f2('0xf')];return sqlUtils['checkListsRestrictions'](_0x174bc7,_0x1172dd,_0x5907aa);})[_0xf5f2('0x7')](function(_0xea612c){_0xad7f65[_0xf5f2('0xa')](_0xea612c);var _0x1c1a5c=_0x1172dd[_0xf5f2('0x8')]?_0x3133bc['ids']:_0x1172dd[_0xf5f2('0x10')];_0x473100=_0x1c1a5c?!![]:![];return sqlUtils[_0xf5f2('0x11')](_0xad7f65,_0x1c1a5c);})[_0xf5f2('0x7')](function(_0x1b6dd2){_0x501fbd[_0xf5f2('0x12')]=_0x1b6dd2;if(_0x501fbd[_0xf5f2('0x12')]===0x0){return;}return sqlUtils[_0xf5f2('0x13')](_0xad7f65,_0x1172dd[_0xf5f2('0xb')],_0x3c72ee,_0x473100,_0x3133bc[_0xf5f2('0xd')],_0x5907aa);})[_0xf5f2('0x7')](function(_0x20fccd){if(!_0x20fccd){return[];}return sqlUtils[_0xf5f2('0x14')](_0x20fccd,_0x1172dd,_0x3c72ee);})[_0xf5f2('0x7')](function(_0x3ee69){_0x501fbd[_0xf5f2('0x15')]=_0x3ee69;return _0x501fbd;})[_0xf5f2('0x16')](function(_0x1bf655){throw _0x1bf655;});};exports['describe']=function(){var _0x34706d={};var _0x47101e=[];return db['CmContact']['describe']()[_0xf5f2('0x7')](function(_0x388e6c){_0x34706d=_0x388e6c;var _0x4ae323=Object[_0xf5f2('0x17')](_0x34706d)[_0xf5f2('0x18')](function(_0x39e44a){return _[_0xf5f2('0x19')](_0x39e44a,_0xf5f2('0x1a'))?_0x39e44a:undefined;});var _0x4c691a=_0x4ae323[_0xf5f2('0x1b')](function(_0x4669a6){return db[_0xf5f2('0x1c')][_0xf5f2('0x1d')]({'where':{'id':_0x4669a6[_0xf5f2('0x1e')](0x3)},'raw':!![]});});return Promise['all'](_0x4c691a);})['then'](function(_0x5f1124){for(var _0x3f79d5=0x0;_0x3f79d5<_0x5f1124[_0xf5f2('0x1f')];_0x3f79d5++){if(_0x5f1124[_0x3f79d5]){var _0x1a5bb3=_0xf5f2('0x1a')+_0x5f1124[_0x3f79d5]['id'];_0x34706d[_0x1a5bb3][_0xf5f2('0x20')]=_0x5f1124[_0x3f79d5][_0xf5f2('0x21')];}}_0x47101e=_[_0xf5f2('0x1b')](Object[_0xf5f2('0x17')](_0x34706d),function(_0x4ab014){return{'name':_0x4ab014,'type':_0x34706d[_0x4ab014][_0xf5f2('0x21')]};});return _0x47101e;})[_0xf5f2('0x16')](function(_0x375ca8){throw _0x375ca8;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 65cfdba..ead21b9 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b27=['t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','agent','search','ListId','autocomplete','from','cm_contacts','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','ct.CmContactId\x20=\x20','lastName','phone','mobile','fax','email','createdAt','updatedAt','deletedAt','includes','push','forEach','TagIds','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','length','find','name','fieldType','datetime','castTo','buildExpression','type','default','text','start','value','end','Tag','split','map','tags','clause','user','and','uc.UserId\x20=\x20?','skip','keys','some','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','role','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','color','Sequelize','SELECT','CmContact','sequelize','query','toString','Tags','clone','where'];(function(_0x2060ea,_0x2cd466){var _0x30f1cb=function(_0x424b28){while(--_0x424b28){_0x2060ea['push'](_0x2060ea['shift']());}};_0x30f1cb(++_0x2cd466);}(_0x7b27,0xd6));var _0x77b2=function(_0xb3d5f,_0x1c4f31){_0xb3d5f=_0xb3d5f-0x0;var _0x3448d6=_0x7b27[_0xb3d5f];return _0x3448d6;};'use strict';var _=require(_0x77b2('0x0'));var squel=require(_0x77b2('0x1'));var as=require(_0x77b2('0x2'));var qs=require(_0x77b2('0x3'));var utils=require(_0x77b2('0x4'));var db=require(_0x77b2('0x5'))['db'];function skipContactsQuery(_0x3e5b76,_0x4628d9){var _0x2d8062=![];if(_0x3e5b76['role']===_0x77b2('0x6')&&!_0x4628d9[_0x77b2('0x7')]&&!_0x4628d9[_0x77b2('0x8')]&&_0x4628d9[_0x77b2('0x9')]!=='true'){_0x2d8062=!![];}return _0x2d8062;}function getContactsSubquery(){return squel['select']()[_0x77b2('0xa')](_0x77b2('0xb'),'c')['where']('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x21a574,_0x133768){var _0x4359dc=_0x133768?'c':_0x77b2('0xc');_0x21a574[_0x77b2('0xd')](_0x77b2('0xe'),'uc',_0x77b2('0xf')+_0x4359dc+_0x77b2('0x10'))[_0x77b2('0xd')]('cm_contact_has_tags','ct',_0x77b2('0x11')+_0x4359dc+_0x77b2('0x10'))['left_join']('tools_tags','t','t.id\x20=\x20ct.TagId');return _0x21a574;}function addFieldsToQuery(_0x22a7a4,_0x492df1,_0x4d4fad,_0x5efe2b,_0x37fa6d){var _0x145785=_0x37fa6d?'c':'subqry';if(!_0x492df1){_0x492df1=['id','firstName',_0x77b2('0x12'),_0x77b2('0x13'),_0x77b2('0x14'),_0x77b2('0x15'),_0x77b2('0x16'),'ListId','CompanyId',_0x77b2('0x17'),_0x77b2('0x18'),_0x77b2('0x19'),'TagIds'];}else if(!_0x492df1[_0x77b2('0x1a')]('id')){_0x492df1[_0x77b2('0x1b')]('id');}var _0x5358d1=_0x4d4fad&&_0x37fa6d||!_0x4d4fad&&!_0x37fa6d;if(_0x5efe2b){_0x5358d1=_0x5efe2b&&_0x37fa6d||!_0x5efe2b&&!_0x37fa6d;}_0x492df1[_0x77b2('0x1c')](function(_0x273f1d){if(_0x273f1d===_0x77b2('0x1d')){if(_0x5358d1){_0x22a7a4[_0x77b2('0x1e')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x273f1d);}else if(_0x4d4fad||_0x5efe2b){_0x22a7a4[_0x77b2('0x1e')](_0x145785+'.'+_0x273f1d);}}else{_0x22a7a4[_0x77b2('0x1e')](_0x145785+'.'+_0x273f1d);}});return _0x22a7a4;}function getSqlClauses(){var _0x47ca25={'default':squel[_0x77b2('0x1f')](),'fields':squel[_0x77b2('0x1f')](),'filter':squel[_0x77b2('0x1f')](),'tags':{'clause':squel[_0x77b2('0x1f')](),'ids':null},'user':{'clause':squel[_0x77b2('0x1f')](),'skip':![]}};return _0x47ca25;}function parseTagParameter(_0x4153af){var _0x6f6f92=squel[_0x77b2('0x1f')]();if(_0x4153af){var _0x14a01f=utils[_0x77b2('0x20')](_0x4153af);_0x14a01f[_0x77b2('0x1c')](function(_0x4ffe9f){_0x6f6f92['or'](_0x77b2('0x21'),'%,'+_0x4ffe9f+',%');});}return _0x6f6f92;}function parseSearchFilter(_0x277f27){var _0x117757=squel[_0x77b2('0x1f')]();if(_0x277f27){var _0x44458a=_0x277f27['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x44458a['split']('\x20')['length']>0x1){_0x117757['or'](_0x77b2('0x22'),qs[_0x77b2('0x23')](_0x44458a),null);}else{if(qs[_0x77b2('0x24')](_0x44458a)){_0x117757['or'](_0x77b2('0x25'),_0x44458a+'%');_0x117757['or'](_0x77b2('0x26'),_0x44458a+'%');_0x117757['or'](_0x77b2('0x27'),_0x44458a+'%');_0x117757['or'](_0x77b2('0x28'),_0x44458a+'%');}else if(qs[_0x77b2('0x29')](_0x44458a)){_0x117757['or'](_0x77b2('0x2a'),_0x44458a+'%');}else{_0x117757['or']('c.firstName\x20LIKE\x20?','%'+_0x44458a+'%');_0x117757['or'](_0x77b2('0x2b'),'%'+_0x44458a+'%');_0x117757['or'](_0x77b2('0x2a'),'%'+_0x44458a+'%');}}}return _0x117757;}function parseAdvancedSearchFilter(_0x70222,_0x13207e){var _0x5142d0=getSqlClauses();var _0x612f6c=as[_0x77b2('0x2c')](_0x70222);var _0x321e3a=_0x612f6c[_0x77b2('0x2d')];for(var _0x261767=0x0;_0x261767<_0x612f6c[_0x77b2('0x2e')][_0x77b2('0x2f')];_0x261767++){var _0x2196a3=_0x612f6c[_0x77b2('0x2e')][_0x261767];var _0x392b6f='c';var _0x160f72=_[_0x77b2('0x30')](_0x13207e,[_0x77b2('0x31'),_0x2196a3['field']]);if(_0x160f72){if(_0x2196a3[_0x77b2('0x1e')]==='dateOfBirth'||_0x160f72[_0x77b2('0x32')]===_0x77b2('0x33')){_0x2196a3[_0x77b2('0x34')]='DATE';}var _0x514a7b=as[_0x77b2('0x35')](_0x392b6f,_0x160f72[_0x77b2('0x36')],_0x2196a3);_0x5142d0[_0x77b2('0x37')][_0x321e3a](_0x514a7b[_0x77b2('0x38')],_0x514a7b['value'][_0x77b2('0x39')],_0x514a7b[_0x77b2('0x3a')][_0x77b2('0x3b')]);}else{if(_0x2196a3[_0x77b2('0x1e')]===_0x77b2('0x3c')){var _0x23fd86=_0x2196a3[_0x77b2('0x3a')][_0x77b2('0x3d')](',')[_0x77b2('0x3e')](function(_0x47f094){return Number(_0x47f094);});var _0x4b27c3=parseTagParameter(_0x23fd86);_0x5142d0[_0x77b2('0x3f')][_0x77b2('0x40')]['and'](_0x4b27c3);_0x5142d0['tags']['ids']=_0x23fd86;}else if(_0x2196a3[_0x77b2('0x1e')]==='User'){_0x5142d0[_0x77b2('0x41')][_0x77b2('0x40')][_0x77b2('0x42')](_0x77b2('0x43'),_0x2196a3[_0x77b2('0x3a')]);_0x5142d0[_0x77b2('0x41')][_0x77b2('0x44')]=!![];}}}return _0x5142d0;}function parseModelFields(_0x4c1929,_0x54c83f){var _0xef7bad=squel['expr']();var _0x3da3c6=_(_0x4c1929)[_0x77b2('0x45')]()[_0x77b2('0x3e')](function(_0x1393b6){return _[_0x77b2('0x46')](_0x54c83f,[_0x77b2('0x31'),_0x1393b6])?_0x1393b6:undefined;})['compact']()[_0x77b2('0x3a')]();if(_0x4c1929[_0x77b2('0x47')]){_0x3da3c6[_0x77b2('0x1b')](_0x77b2('0x47'));}if(_0x3da3c6[_0x77b2('0x2f')]>0x0){_0x3da3c6[_0x77b2('0x1c')](function(_0x14ab5b){if(_0x14ab5b===_0x77b2('0x8')){_0xef7bad['and'](_0x77b2('0x48'),[][_0x77b2('0x49')](_0x4c1929[_0x14ab5b]));}else if(_0x14ab5b===_0x77b2('0x47')){var _0x427082='%'+_0x4c1929[_0x14ab5b]+'%';_0xef7bad[_0x77b2('0x42')](_0x77b2('0x4a'),_0x427082);}else{_0xef7bad[_0x77b2('0x42')]('c.'+_0x14ab5b+_0x77b2('0x4b'),_0x4c1929[_0x14ab5b]);}});}return _0xef7bad;}function parseQueryParameters(_0x529ef8,_0x1ed5c9){var _0x1aeb69=getSqlClauses();return Promise[_0x77b2('0x4c')]()[_0x77b2('0x4d')](function(){return parseModelFields(_0x529ef8,_0x1ed5c9);})[_0x77b2('0x4d')](function(_0x2877a0){_0x1aeb69[_0x77b2('0x4e')][_0x77b2('0x42')](_0x2877a0);return parseTagParameter(_0x529ef8[_0x77b2('0x4f')]);})[_0x77b2('0x4d')](function(_0x23a4af){_0x1aeb69[_0x77b2('0x3f')][_0x77b2('0x40')]['and'](_0x23a4af);return parseSearchFilter(_0x529ef8[_0x77b2('0x50')]);})[_0x77b2('0x4d')](function(_0x2e6238){_0x1aeb69[_0x77b2('0x50')]=_0x2e6238;return _0x1aeb69;});}function checkListsRestrictions(_0x5da124,_0x11d4a4,_0x12ce90){var _0x4c2982=squel[_0x77b2('0x1f')]();return Promise[_0x77b2('0x4c')]()[_0x77b2('0x4d')](function(){if(_0x11d4a4['search']&&_0x5da124[_0x77b2('0x51')]===_0x77b2('0x6')&&!_0x12ce90){return _0x5da124[_0x77b2('0x52')]({'attributes':['id'],'raw':!![]});}})[_0x77b2('0x4d')](function(_0x168f77){if(_0x168f77){if(_0x168f77[_0x77b2('0x2f')]===0x0){_0x4c2982[_0x77b2('0x42')](_0x77b2('0x53'));}else{_0x4c2982[_0x77b2('0x42')](_0x77b2('0x48'),_[_0x77b2('0x3e')](_0x168f77,'id'));}}})[_0x77b2('0x4d')](function(){return _0x4c2982;});}function buildContactsQuery(_0x358761,_0x33c69d,_0x11d4bc,_0x1c27bd,_0x14c30a,_0x428b35){if(_0x33c69d){_0x33c69d=_0x11d4bc[_0x77b2('0x54')];}_0x358761=addFieldsToQuery(_0x358761,_0x33c69d,_0x1c27bd,_0x428b35,!![]);var _0x301bb2=squel['select']();_0x301bb2=addFieldsToQuery(_0x301bb2,_0x33c69d,_0x1c27bd,_0x428b35,![]);if(_0x1c27bd||_0x428b35){_0x358761=applyJoinClauses(_0x358761,!![]);_0x358761[_0x77b2('0x55')](_0x77b2('0x56'));if(_0x11d4bc[_0x77b2('0x57')]){_0x301bb2['limit'](_0x11d4bc['limit']);}if(_0x11d4bc[_0x77b2('0x58')]){_0x301bb2['offset'](_0x11d4bc[_0x77b2('0x58')]);}}else{_0x301bb2=applyJoinClauses(_0x301bb2,![]);_0x301bb2['group'](_0x77b2('0x59'));if(_0x11d4bc[_0x77b2('0x57')]){_0x358761[_0x77b2('0x57')](_0x11d4bc[_0x77b2('0x57')]);}if(_0x11d4bc[_0x77b2('0x58')]){_0x358761[_0x77b2('0x58')](_0x11d4bc['offset']);}}_0x301bb2[_0x77b2('0x5a')](_0x14c30a);if(_0x11d4bc[_0x77b2('0x5b')]){_0x11d4bc[_0x77b2('0x5b')][_0x77b2('0x1c')](function(_0x4a73fb){_0x358761[_0x77b2('0x5b')]('c.'+_0x4a73fb[0x0],_0x4a73fb[0x1]===_0x77b2('0x5c')?![]:!![]);_0x301bb2[_0x77b2('0x5b')](_0x77b2('0x5d')+_0x4a73fb[0x0],_0x4a73fb[0x1]===_0x77b2('0x5c')?![]:!![]);});}_0x301bb2['from'](_0x358761,'subqry');return _0x301bb2;}function getFilteredContacts(_0x220b87){var _0x128f0b=[];return db[_0x77b2('0x3c')]['findAll']({'attributes':['id',_0x77b2('0x31'),_0x77b2('0x5e')],'raw':!![]})[_0x77b2('0x4d')](function(_0x3d5036){_0x128f0b=_['keyBy'](_0x3d5036,'id');var _0x3f7345={'type':db[_0x77b2('0x5f')]['QueryTypes'][_0x77b2('0x60')],'model':db[_0x77b2('0x61')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x77b2('0x62')][_0x77b2('0x63')](_0x220b87[_0x77b2('0x64')](),_0x3f7345);})[_0x77b2('0x4d')](function(_0x58a13e){_0x58a13e[_0x77b2('0x1c')](function(_0x4a0649){if(_0x4a0649[_0x77b2('0x1d')]){_0x4a0649[_0x77b2('0x65')]=[];_0x4a0649[_0x77b2('0x1d')][_0x77b2('0x3d')](',')[_0x77b2('0x1c')](function(_0x3a9a5c){_0x4a0649[_0x77b2('0x65')][_0x77b2('0x1b')](_0x128f0b[_0x3a9a5c]);});}delete _0x4a0649[_0x77b2('0x1d')];});return _0x58a13e;});}function countFilteredContacts(_0x2d79fd,_0x4ad20c){var _0x43c942=_0x2d79fd[_0x77b2('0x66')]();_0x43c942[_0x77b2('0x1e')]('COUNT(*)');_0x43c942=applyJoinClauses(_0x43c942,!![]);_0x2d79fd[_0x77b2('0x55')](_0x77b2('0x56'));var _0x562616=utils[_0x77b2('0x20')](_0x4ad20c);if(!_['isEmpty'](_0x562616)){_0x43c942[_0x77b2('0x67')](_0x77b2('0x68'),_0x562616);}var _0x287aab={'type':db[_0x77b2('0x5f')]['QueryTypes'][_0x77b2('0x60')],'raw':!![]};return db[_0x77b2('0x62')]['query'](_0x43c942[_0x77b2('0x64')](),_0x287aab)['then'](function(_0x2528e4){return _0x2528e4[0x0]['COUNT(*)'];});}module[_0x77b2('0x69')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xc99a=['c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','dateOfBirth','fieldType','datetime','castTo','DATE','type','text','value','end','Tag','split','map','tags','and','ids','user','clause','uc.UserId\x20=\x20?','skip','some','name','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','getLists','attributes','group','limit','offset','having','order','DESC','subqry.','from','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','toString','Tags','clone','COUNT(*)','c.id','isEmpty','t.id\x20IN\x20?','sequelize','query','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../../mysqldb','agent','search','true','select','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','firstName','lastName','phone','fax','ListId','CompanyId','createdAt','updatedAt','TagIds','includes','push','field','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?'];(function(_0x1599cf,_0x2f7533){var _0x2e2496=function(_0x37f09e){while(--_0x37f09e){_0x1599cf['push'](_0x1599cf['shift']());}};_0x2e2496(++_0x2f7533);}(_0xc99a,0xab));var _0xac99=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc99a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xac99('0x0'));var squel=require(_0xac99('0x1'));var as=require(_0xac99('0x2'));var qs=require(_0xac99('0x3'));var utils=require('../interaction/utils');var db=require(_0xac99('0x4'))['db'];function skipContactsQuery(_0x46921c,_0xf7f2ad){var _0x22a4b5=![];if(_0x46921c['role']===_0xac99('0x5')&&!_0xf7f2ad[_0xac99('0x6')]&&!_0xf7f2ad['ListId']&&_0xf7f2ad['autocomplete']!==_0xac99('0x7')){_0x22a4b5=!![];}return _0x22a4b5;}function getContactsSubquery(){return squel[_0xac99('0x8')]()['from'](_0xac99('0x9'),'c')[_0xac99('0xa')](_0xac99('0xb'));}function applyJoinClauses(_0xecf7ac,_0xb1e07d){var _0x43df5c=_0xb1e07d?'c':_0xac99('0xc');_0xecf7ac[_0xac99('0xd')]('cm_user_has_contacts','uc',_0xac99('0xe')+_0x43df5c+_0xac99('0xf'))[_0xac99('0xd')](_0xac99('0x10'),'ct',_0xac99('0x11')+_0x43df5c+_0xac99('0xf'))[_0xac99('0xd')](_0xac99('0x12'),'t','t.id\x20=\x20ct.TagId');return _0xecf7ac;}function addFieldsToQuery(_0x2ee66a,_0x5a075c,_0x4c25ff,_0x3d876b,_0x20d7f2){var _0x5d6bba=_0x20d7f2?'c':'subqry';if(!_0x5a075c){_0x5a075c=['id',_0xac99('0x13'),_0xac99('0x14'),_0xac99('0x15'),'mobile',_0xac99('0x16'),'email',_0xac99('0x17'),_0xac99('0x18'),_0xac99('0x19'),_0xac99('0x1a'),'deletedAt',_0xac99('0x1b')];}else if(!_0x5a075c[_0xac99('0x1c')]('id')){_0x5a075c[_0xac99('0x1d')]('id');}var _0x215ae9=_0x4c25ff&&_0x20d7f2||!_0x4c25ff&&!_0x20d7f2;if(_0x3d876b){_0x215ae9=_0x3d876b&&_0x20d7f2||!_0x3d876b&&!_0x20d7f2;}_0x5a075c['forEach'](function(_0xe9c0e7){if(_0xe9c0e7==='TagIds'){if(_0x215ae9){_0x2ee66a[_0xac99('0x1e')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xe9c0e7);}else if(_0x4c25ff||_0x3d876b){_0x2ee66a[_0xac99('0x1e')](_0x5d6bba+'.'+_0xe9c0e7);}}else{_0x2ee66a[_0xac99('0x1e')](_0x5d6bba+'.'+_0xe9c0e7);}});return _0x2ee66a;}function getSqlClauses(){var _0x5b3c1f={'default':squel[_0xac99('0x1f')](),'fields':squel['expr'](),'filter':squel[_0xac99('0x1f')](),'tags':{'clause':squel[_0xac99('0x1f')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x5b3c1f;}function parseTagParameter(_0x245173){var _0x44b682=squel[_0xac99('0x1f')]();if(_0x245173){var _0x186c6a=utils[_0xac99('0x20')](_0x245173);_0x186c6a[_0xac99('0x21')](function(_0x18af24){_0x44b682['or'](_0xac99('0x22'),'%,'+_0x18af24+',%');});}return _0x44b682;}function parseSearchFilter(_0x2e8718){var _0x246608=squel[_0xac99('0x1f')]();if(_0x2e8718){var _0x1f48f3=_0x2e8718[_0xac99('0x23')]('\x5c','\x5c\x5c')[_0xac99('0x23')](/'/g,'\x27\x27');if(_0x1f48f3['split']('\x20')[_0xac99('0x24')]>0x1){_0x246608['or'](_0xac99('0x25'),qs[_0xac99('0x26')](_0x1f48f3),null);}else{if(qs[_0xac99('0x27')](_0x1f48f3)){_0x246608['or'](_0xac99('0x28'),_0x1f48f3+'%');_0x246608['or'](_0xac99('0x29'),_0x1f48f3+'%');_0x246608['or'](_0xac99('0x2a'),_0x1f48f3+'%');_0x246608['or'](_0xac99('0x2b'),_0x1f48f3+'%');}else if(qs[_0xac99('0x2c')](_0x1f48f3)){_0x246608['or'](_0xac99('0x2d'),_0x1f48f3+'%');}else{_0x246608['or'](_0xac99('0x2e'),'%'+_0x1f48f3+'%');_0x246608['or'](_0xac99('0x2f'),'%'+_0x1f48f3+'%');_0x246608['or'](_0xac99('0x2d'),'%'+_0x1f48f3+'%');}}}return _0x246608;}function parseAdvancedSearchFilter(_0xd09733,_0x25cfd5){var _0x35571e=getSqlClauses();var _0x5d6698=as[_0xac99('0x30')](_0xd09733);var _0x1a6edd=_0x5d6698[_0xac99('0x31')];for(var _0x5c4a4e=0x0;_0x5c4a4e<_0x5d6698['conditions'][_0xac99('0x24')];_0x5c4a4e++){var _0x41ddd1=_0x5d6698[_0xac99('0x32')][_0x5c4a4e];var _0x2729e9='c';var _0x4f831a=_[_0xac99('0x33')](_0x25cfd5,['name',_0x41ddd1[_0xac99('0x1e')]]);if(_0x4f831a){if(_0x41ddd1['field']===_0xac99('0x34')||_0x4f831a[_0xac99('0x35')]===_0xac99('0x36')){_0x41ddd1[_0xac99('0x37')]=_0xac99('0x38');}var _0x18ef24=as['buildExpression'](_0x2729e9,_0x4f831a[_0xac99('0x39')],_0x41ddd1);_0x35571e['default'][_0x1a6edd](_0x18ef24[_0xac99('0x3a')],_0x18ef24[_0xac99('0x3b')]['start'],_0x18ef24[_0xac99('0x3b')][_0xac99('0x3c')]);}else{if(_0x41ddd1[_0xac99('0x1e')]===_0xac99('0x3d')){var _0x7d9b52=_0x41ddd1[_0xac99('0x3b')][_0xac99('0x3e')](',')[_0xac99('0x3f')](function(_0x3ff7ce){return Number(_0x3ff7ce);});var _0x565128=parseTagParameter(_0x7d9b52);_0x35571e[_0xac99('0x40')]['clause'][_0xac99('0x41')](_0x565128);_0x35571e[_0xac99('0x40')][_0xac99('0x42')]=_0x7d9b52;}else if(_0x41ddd1['field']==='User'){_0x35571e[_0xac99('0x43')][_0xac99('0x44')]['and'](_0xac99('0x45'),_0x41ddd1['value']);_0x35571e[_0xac99('0x43')][_0xac99('0x46')]=!![];}}}return _0x35571e;}function parseModelFields(_0x1a065e,_0x2321db){var _0x4c1cf3=squel[_0xac99('0x1f')]();var _0x15e5c7=_(_0x1a065e)['keys']()[_0xac99('0x3f')](function(_0x15dba4){return _[_0xac99('0x47')](_0x2321db,[_0xac99('0x48'),_0x15dba4])?_0x15dba4:undefined;})['compact']()[_0xac99('0x3b')]();if(_0x1a065e[_0xac99('0x49')]){_0x15e5c7[_0xac99('0x1d')]('Contact');}if(_0x15e5c7[_0xac99('0x24')]>0x0){_0x15e5c7[_0xac99('0x21')](function(_0x50b278){if(_0x50b278===_0xac99('0x17')){_0x4c1cf3['and'](_0xac99('0x4a'),[][_0xac99('0x4b')](_0x1a065e[_0x50b278]));}else if(_0x50b278===_0xac99('0x49')){var _0x5dfd07='%'+_0x1a065e[_0x50b278]+'%';_0x4c1cf3[_0xac99('0x41')](_0xac99('0x4c'),_0x5dfd07);}else{_0x4c1cf3[_0xac99('0x41')]('c.'+_0x50b278+_0xac99('0x4d'),_0x1a065e[_0x50b278]);}});}return _0x4c1cf3;}function parseQueryParameters(_0x261205,_0x2c16ca){var _0x4cdd02=getSqlClauses();return Promise[_0xac99('0x4e')]()['then'](function(){return parseModelFields(_0x261205,_0x2c16ca);})[_0xac99('0x4f')](function(_0x22865c){_0x4cdd02[_0xac99('0x50')][_0xac99('0x41')](_0x22865c);return parseTagParameter(_0x261205[_0xac99('0x51')]);})[_0xac99('0x4f')](function(_0x163db3){_0x4cdd02['tags'][_0xac99('0x44')][_0xac99('0x41')](_0x163db3);return parseSearchFilter(_0x261205[_0xac99('0x52')]);})[_0xac99('0x4f')](function(_0x1322ae){_0x4cdd02[_0xac99('0x52')]=_0x1322ae;return _0x4cdd02;});}function checkListsRestrictions(_0xc4deb5,_0x1d43ee,_0x2d8adc){var _0x24680e=squel[_0xac99('0x1f')]();return Promise['resolve']()[_0xac99('0x4f')](function(){if(_0x1d43ee[_0xac99('0x6')]&&_0xc4deb5['role']===_0xac99('0x5')&&!_0x2d8adc){return _0xc4deb5[_0xac99('0x53')]({'attributes':['id'],'raw':!![]});}})[_0xac99('0x4f')](function(_0x21f7bf){if(_0x21f7bf){if(_0x21f7bf['length']===0x0){_0x24680e[_0xac99('0x41')]('c.ListId\x20IS\x20NULL');}else{_0x24680e[_0xac99('0x41')](_0xac99('0x4a'),_[_0xac99('0x3f')](_0x21f7bf,'id'));}}})[_0xac99('0x4f')](function(){return _0x24680e;});}function buildContactsQuery(_0x4b7684,_0x3b93f2,_0x13da63,_0xcd0d31,_0x4cc51d,_0x605f85){if(_0x3b93f2){_0x3b93f2=_0x13da63[_0xac99('0x54')];}_0x4b7684=addFieldsToQuery(_0x4b7684,_0x3b93f2,_0xcd0d31,_0x605f85,!![]);var _0x4d4042=squel[_0xac99('0x8')]();_0x4d4042=addFieldsToQuery(_0x4d4042,_0x3b93f2,_0xcd0d31,_0x605f85,![]);if(_0xcd0d31||_0x605f85){_0x4b7684=applyJoinClauses(_0x4b7684,!![]);_0x4b7684[_0xac99('0x55')]('c.id');if(_0x13da63[_0xac99('0x56')]){_0x4d4042[_0xac99('0x56')](_0x13da63[_0xac99('0x56')]);}if(_0x13da63['offset']){_0x4d4042[_0xac99('0x57')](_0x13da63['offset']);}}else{_0x4d4042=applyJoinClauses(_0x4d4042,![]);_0x4d4042[_0xac99('0x55')]('subqry.id');if(_0x13da63[_0xac99('0x56')]){_0x4b7684[_0xac99('0x56')](_0x13da63[_0xac99('0x56')]);}if(_0x13da63['offset']){_0x4b7684[_0xac99('0x57')](_0x13da63[_0xac99('0x57')]);}}_0x4d4042[_0xac99('0x58')](_0x4cc51d);if(_0x13da63[_0xac99('0x59')]){_0x13da63[_0xac99('0x59')][_0xac99('0x21')](function(_0x36dc26){_0x4b7684[_0xac99('0x59')]('c.'+_0x36dc26[0x0],_0x36dc26[0x1]===_0xac99('0x5a')?![]:!![]);_0x4d4042['order'](_0xac99('0x5b')+_0x36dc26[0x0],_0x36dc26[0x1]==='DESC'?![]:!![]);});}_0x4d4042[_0xac99('0x5c')](_0x4b7684,_0xac99('0xc'));return _0x4d4042;}function getFilteredContacts(_0xdc390){var _0x116855=[];return db[_0xac99('0x3d')]['findAll']({'attributes':['id','name',_0xac99('0x5d')],'raw':!![]})[_0xac99('0x4f')](function(_0x25c5b4){_0x116855=_[_0xac99('0x5e')](_0x25c5b4,'id');var _0x57e5f4={'type':db[_0xac99('0x5f')][_0xac99('0x60')][_0xac99('0x61')],'model':db[_0xac99('0x62')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize']['query'](_0xdc390[_0xac99('0x63')](),_0x57e5f4);})[_0xac99('0x4f')](function(_0x5d39c8){_0x5d39c8[_0xac99('0x21')](function(_0x1dfdcf){if(_0x1dfdcf[_0xac99('0x1b')]){_0x1dfdcf[_0xac99('0x64')]=[];_0x1dfdcf['TagIds']['split'](',')[_0xac99('0x21')](function(_0x1a8bcc){_0x1dfdcf['Tags'][_0xac99('0x1d')](_0x116855[_0x1a8bcc]);});}delete _0x1dfdcf[_0xac99('0x1b')];});return _0x5d39c8;});}function countFilteredContacts(_0x262287,_0x18976a){var _0x407fac=_0x262287[_0xac99('0x65')]();_0x407fac[_0xac99('0x1e')](_0xac99('0x66'));_0x407fac=applyJoinClauses(_0x407fac,!![]);_0x262287['group'](_0xac99('0x67'));var _0x4805b5=utils[_0xac99('0x20')](_0x18976a);if(!_[_0xac99('0x68')](_0x4805b5)){_0x407fac[_0xac99('0xa')](_0xac99('0x69'),_0x4805b5);}var _0x339762={'type':db[_0xac99('0x5f')]['QueryTypes'][_0xac99('0x61')],'raw':!![]};return db[_0xac99('0x6a')][_0xac99('0x6b')](_0x407fac['toString'](),_0x339762)[_0xac99('0x4f')](function(_0x252040){return _0x252040[0x0][_0xac99('0x66')];});}module[_0xac99('0x6c')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 64c7b35..5210634 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 _0xd518=['encryptString','secret','decryptString','base64','utf8','crypto','bluebird','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','binary','end','final','write','close','unlink','decryptFile','createDecipher','update'];(function(_0x2f00b4,_0x22d6d7){var _0x18ba44=function(_0x582a4a){while(--_0x582a4a){_0x2f00b4['push'](_0x2f00b4['shift']());}};_0x18ba44(++_0x22d6d7);}(_0xd518,0x115));var _0x8d51=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd518[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require(_0x8d51('0x0'));var fs=require('fs');var BPromise=require(_0x8d51('0x1'));var _=require('lodash');var config=require('../../config/environment');var logger=require(_0x8d51('0x2'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x8d51('0x3')][_0x8d51('0x4')],'algorithm':_0x8d51('0x5')};const fileOptions={'algorithm':_0x8d51('0x6')};if(config[_0x8d51('0x7')]&&config[_0x8d51('0x7')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x8d51('0x7')][_0x8d51('0x8')]);if(isSupported){fileOptions[_0x8d51('0x8')]=config[_0x8d51('0x7')][_0x8d51('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x8d51('0x9')](',\x20');logger[_0x8d51('0xa')](config[_0x8d51('0x7')][_0x8d51('0x8')],_0x8d51('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x42d656){return AES_SUPPORTED_RX[_0x8d51('0xc')](_0x42d656);}function getSupportedCiphers(){return crypto['getCiphers']()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x5776c9){return getSupportedCiphers()[_0x8d51('0xd')](_0x5776c9)>-0x1;}function combineOptions(_0x2b8bd4){var _0x231c7e={};for(var _0x5ce973 in fileOptions){if(fileOptions[_0x8d51('0xe')](_0x5ce973)){_0x231c7e[_0x5ce973]=fileOptions[_0x5ce973];}}if(_0x2b8bd4){for(var _0xc680c4 in _0x2b8bd4){if(_0x2b8bd4[_0x8d51('0xe')](_0xc680c4)){_0x231c7e[_0xc680c4]=_0x2b8bd4[_0xc680c4];}}}return _0x231c7e;}exports[_0x8d51('0xf')]=function(_0x4cc335,_0x542212,_0xf8598a,_0x3f8180){return new BPromise(function(_0x2eb520,_0x4efcb8){_0x3f8180=combineOptions(_0x3f8180);var _0x30b8df=new Buffer(_0xf8598a);var _0x29580b=fs[_0x8d51('0x10')](_0x4cc335);var _0x31f8d5=fs[_0x8d51('0x11')](_0x542212);var _0x1c3b91=crypto[_0x8d51('0x12')](_0x3f8180[_0x8d51('0x8')],_0x30b8df);_0x29580b['on'](_0x8d51('0x13'),function(_0x46e38e){var _0x34cc48=new Buffer(_0x1c3b91['update'](_0x46e38e),_0x8d51('0x14'));_0x31f8d5['write'](_0x34cc48);});_0x29580b['on'](_0x8d51('0x15'),function(){try{var _0x5126ef=new Buffer(_0x1c3b91[_0x8d51('0x16')](_0x8d51('0x14')),_0x8d51('0x14'));_0x31f8d5[_0x8d51('0x17')](_0x5126ef);_0x31f8d5[_0x8d51('0x15')]();_0x31f8d5['on'](_0x8d51('0x18'),function(){return _0x2eb520(_0x542212);});}catch(_0xfe85d7){fs[_0x8d51('0x19')](_0x542212);return _0x4efcb8(_0xfe85d7);}});});};exports[_0x8d51('0x1a')]=function(_0x5df7ea,_0x92581c,_0x2e7900,_0xe77f7d){return new BPromise(function(_0x20f691,_0x41735d){_0xe77f7d=combineOptions(_0xe77f7d);var _0x5b231e=new Buffer(_0x2e7900);var _0x1b62d5=fs[_0x8d51('0x10')](_0x5df7ea);var _0x5ba994=fs[_0x8d51('0x11')](_0x92581c);var _0x13b8f5=crypto[_0x8d51('0x1b')](_0xe77f7d[_0x8d51('0x8')],_0x5b231e);_0x1b62d5['on']('data',function(_0x29a6e3){var _0x314553=new Buffer(_0x13b8f5[_0x8d51('0x1c')](_0x29a6e3),_0x8d51('0x14'));_0x5ba994[_0x8d51('0x17')](_0x314553);});_0x1b62d5['on'](_0x8d51('0x15'),function(){try{var _0x3553f4=new Buffer(_0x13b8f5[_0x8d51('0x16')](_0x8d51('0x14')),_0x8d51('0x14'));_0x5ba994[_0x8d51('0x17')](_0x3553f4);_0x5ba994[_0x8d51('0x15')]();_0x5ba994['on'](_0x8d51('0x18'),function(){return _0x20f691(_0x92581c);});}catch(_0x50bc17){fs['unlink'](_0x92581c);return _0x41735d(_0x50bc17);}});});};exports[_0x8d51('0x1d')]=function(_0x1c78d0,_0x4d1b0e,_0x17d0b7){var _0x431cc0=_0x17d0b7||stringOptions[_0x8d51('0x8')];var _0x4b95bb=_0x4d1b0e||stringOptions[_0x8d51('0x1e')];var _0x621ff4=crypto['createCipher'](_0x431cc0,_0x4b95bb);var _0x9fb612=_0x621ff4[_0x8d51('0x1c')](_0x1c78d0,'utf8','base64');_0x9fb612+=_0x621ff4['final']('base64');return _0x9fb612;};exports[_0x8d51('0x1f')]=function(_0x1449f7,_0x389618,_0x52b698){var _0x45b3e3=_0x52b698||stringOptions['algorithm'];var _0x1c72e0=_0x389618||stringOptions['secret'];var _0x3a1743=crypto[_0x8d51('0x1b')](_0x45b3e3,_0x1c72e0);var _0x4bb141=_0x3a1743[_0x8d51('0x1c')](_0x1449f7,_0x8d51('0x20'),_0x8d51('0x21'));_0x4bb141+=_0x3a1743[_0x8d51('0x16')](_0x8d51('0x21'));return _0x4bb141;}; \ No newline at end of file +var _0x20c8=['base64','decryptString','createDecipher','bluebird','lodash','../../config/environment','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','error','test','getCiphers','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data','update','binary','end','final','close','unlink','decryptFile','encryptString','createCipher','utf8'];(function(_0x2c8271,_0x4dec9d){var _0x4a0651=function(_0x29c87f){while(--_0x29c87f){_0x2c8271['push'](_0x2c8271['shift']());}};_0x4a0651(++_0x4dec9d);}(_0x20c8,0x1b5));var _0x820c=function(_0x50cc63,_0x33dce3){_0x50cc63=_0x50cc63-0x0;var _0x2eddf9=_0x20c8[_0x50cc63];return _0x2eddf9;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x820c('0x0'));var _=require(_0x820c('0x1'));var config=require(_0x820c('0x2'));var logger=require(_0x820c('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x820c('0x4')][_0x820c('0x5')],'algorithm':_0x820c('0x6')};const fileOptions={'algorithm':_0x820c('0x7')};if(config[_0x820c('0x8')]&&config[_0x820c('0x8')][_0x820c('0x9')]){var isSupported=isAlgorithmSupported(config[_0x820c('0x8')][_0x820c('0x9')]);if(isSupported){fileOptions[_0x820c('0x9')]=config[_0x820c('0x8')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x820c('0xa')](config['encrypt'][_0x820c('0x9')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x219de3){return AES_SUPPORTED_RX[_0x820c('0xb')](_0x219de3);}function getSupportedCiphers(){return crypto[_0x820c('0xc')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0xc64632){return getSupportedCiphers()['indexOf'](_0xc64632)>-0x1;}function combineOptions(_0x5c239d){var _0x501ed3={};for(var _0x2dca7a in fileOptions){if(fileOptions[_0x820c('0xd')](_0x2dca7a)){_0x501ed3[_0x2dca7a]=fileOptions[_0x2dca7a];}}if(_0x5c239d){for(var _0x87751 in _0x5c239d){if(_0x5c239d[_0x820c('0xd')](_0x87751)){_0x501ed3[_0x87751]=_0x5c239d[_0x87751];}}}return _0x501ed3;}exports[_0x820c('0xe')]=function(_0x52e10b,_0x18505c,_0x1a92f3,_0x9cdfb3){return new BPromise(function(_0xb8ee92,_0xf61da7){_0x9cdfb3=combineOptions(_0x9cdfb3);var _0x44a40c=new Buffer(_0x1a92f3);var _0x54d50c=fs[_0x820c('0xf')](_0x52e10b);var _0x2dd2bc=fs[_0x820c('0x10')](_0x18505c);var _0x2328ab=crypto['createCipher'](_0x9cdfb3[_0x820c('0x9')],_0x44a40c);_0x54d50c['on'](_0x820c('0x11'),function(_0x5129cf){var _0x22603a=new Buffer(_0x2328ab[_0x820c('0x12')](_0x5129cf),_0x820c('0x13'));_0x2dd2bc['write'](_0x22603a);});_0x54d50c['on'](_0x820c('0x14'),function(){try{var _0x2da35f=new Buffer(_0x2328ab[_0x820c('0x15')](_0x820c('0x13')),_0x820c('0x13'));_0x2dd2bc['write'](_0x2da35f);_0x2dd2bc[_0x820c('0x14')]();_0x2dd2bc['on'](_0x820c('0x16'),function(){return _0xb8ee92(_0x18505c);});}catch(_0xdeb0c1){fs[_0x820c('0x17')](_0x18505c);return _0xf61da7(_0xdeb0c1);}});});};exports[_0x820c('0x18')]=function(_0x227f43,_0xe7576d,_0x4c310b,_0x5db120){return new BPromise(function(_0x22c850,_0x10f97e){_0x5db120=combineOptions(_0x5db120);var _0x2f689a=new Buffer(_0x4c310b);var _0x4f0fd0=fs[_0x820c('0xf')](_0x227f43);var _0x333a12=fs[_0x820c('0x10')](_0xe7576d);var _0xcfff6f=crypto['createDecipher'](_0x5db120[_0x820c('0x9')],_0x2f689a);_0x4f0fd0['on'](_0x820c('0x11'),function(_0x3d34e4){var _0xa4714f=new Buffer(_0xcfff6f[_0x820c('0x12')](_0x3d34e4),'binary');_0x333a12['write'](_0xa4714f);});_0x4f0fd0['on'](_0x820c('0x14'),function(){try{var _0x58cc52=new Buffer(_0xcfff6f[_0x820c('0x15')](_0x820c('0x13')),'binary');_0x333a12['write'](_0x58cc52);_0x333a12[_0x820c('0x14')]();_0x333a12['on'](_0x820c('0x16'),function(){return _0x22c850(_0xe7576d);});}catch(_0xc85707){fs[_0x820c('0x17')](_0xe7576d);return _0x10f97e(_0xc85707);}});});};exports[_0x820c('0x19')]=function(_0x39877d,_0x298246,_0x1ed191){var _0x491a62=_0x1ed191||stringOptions[_0x820c('0x9')];var _0x3c49ed=_0x298246||stringOptions['secret'];var _0x42322a=crypto[_0x820c('0x1a')](_0x491a62,_0x3c49ed);var _0x2612df=_0x42322a[_0x820c('0x12')](_0x39877d,_0x820c('0x1b'),'base64');_0x2612df+=_0x42322a[_0x820c('0x15')](_0x820c('0x1c'));return _0x2612df;};exports[_0x820c('0x1d')]=function(_0x814b65,_0x459b79,_0x46c76d){var _0x4060ad=_0x46c76d||stringOptions[_0x820c('0x9')];var _0x16699b=_0x459b79||stringOptions['secret'];var _0x583ad6=crypto[_0x820c('0x1e')](_0x4060ad,_0x16699b);var _0x464cd6=_0x583ad6[_0x820c('0x12')](_0x814b65,'base64','utf8');_0x464cd6+=_0x583ad6[_0x820c('0x15')](_0x820c('0x1b'));return _0x464cd6;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index b693e8b..7e5e76b 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 _0x5911=['savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','mkdirSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','finally','exit','util','path','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv'];(function(_0x3470db,_0x2a20d5){var _0x4748c6=function(_0x4ec557){while(--_0x4ec557){_0x3470db['push'](_0x3470db['shift']());}};_0x4748c6(++_0x2a20d5);}(_0x5911,0x184));var _0x1591=function(_0x3238ad,_0x205c12){_0x3238ad=_0x3238ad-0x0;var _0x31c347=_0x5911[_0x3238ad];return _0x31c347;};'use strict';var util=require(_0x1591('0x0'));var path=require(_0x1591('0x1'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x1591('0x2'));var rimraf=require(_0x1591('0x3'));var db=require(_0x1591('0x4'))['db'];var dbH=require(_0x1591('0x4'))[_0x1591('0x5')];var logger=require('../../config/logger')(_0x1591('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x1591('0x7')][0x2]);var QUERY=process[_0x1591('0x7')][0x3];var PATH=process[_0x1591('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x25d279,_0x3a7566){var _0x4e0c9a={'status':_0x25d279};var _0x128ab7={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3a7566){_0x4e0c9a[_0x1591('0x8')]=_0x3a7566;}return db[_0x1591('0x9')][_0x1591('0xa')](_0x4e0c9a,_0x128ab7);}function main(){var _0x383530=0x1388;var _0x513044;logger[_0x1591('0xb')](util[_0x1591('0xc')](_0x1591('0xd'),EXTRACTED_REPORT_ID,_0x1591('0xe')));return db[_0x1591('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1591('0x10'),_0x1591('0x11')]})[_0x1591('0x12')](function(_0x5d9456){if(_0x5d9456){_0x513044=_0x5d9456;_0x383530=_0x513044['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x1591('0x13')][_0x1591('0x14')](util[_0x1591('0xc')](_0x1591('0x15'),QUERY),{'type':dbH[_0x1591('0x13')][_0x1591('0x16')][_0x1591('0x17')]});})['then'](function(_0x22eef7){if(!_0x22eef7[0x0][_0x1591('0x18')]){return analyticExtractedReport('Empty');}var _0x46c975=[];var _0x2f8538=0x0;if(_0x513044[_0x1591('0x10')]){if(_0x22eef7&&_0x22eef7[_0x1591('0x19')]){var _0x548d3c=_['range'](_0x22eef7[0x0][_0x1591('0x18')]/_0x383530);var _0x4eabb4=Number['isInteger'](_0x22eef7[0x0][_0x1591('0x18')]/_0x383530)?_0x22eef7[0x0][_0x1591('0x18')]%_0x383530:0x0;_0x548d3c[_0x1591('0x1a')](function(_0x2c03d5){if(_0x2c03d5>0x0){_0x2f8538+=_0x383530;}_0x46c975['push'](dbH[_0x1591('0x13')]['query'](util[_0x1591('0xc')](_0x1591('0x1b'),QUERY,_0x383530,_0x2f8538),{'type':dbH[_0x1591('0x13')][_0x1591('0x16')]['SELECT']}));});if(_0x4eabb4>0x0){_0x2f8538+=_0x383530;_0x46c975[_0x1591('0x1c')](dbH['sequelize']['query'](util[_0x1591('0xc')](_0x1591('0x1b'),QUERY,_0x4eabb4,_0x2f8538),{'type':dbH[_0x1591('0x13')]['QueryTypes'][_0x1591('0x17')]}));}}}else{_0x46c975['push'](dbH['sequelize'][_0x1591('0x14')](QUERY,{'type':dbH[_0x1591('0x13')][_0x1591('0x16')][_0x1591('0x17')]}));}var _0x33c96f=path['dirname'](PATH);var _0x25ad5d=path['basename'](PATH,'.csv');var _0x2caab9=_0x513044[_0x1591('0x10')]&&_0x46c975[_0x1591('0x19')]>0x1;var _0x29998e=[];if(!fs['existsSync'](path['join'](_0x33c96f,_0x25ad5d))&&_0x2caab9){fs[_0x1591('0x1d')](path[_0x1591('0x1e')](_0x33c96f,_0x25ad5d));}return BPromise[_0x1591('0x1f')](_0x46c975,function(_0xa9b547){_0x29998e[_0x1591('0x1c')](_0xa9b547);})[_0x1591('0x12')](function(){for(var _0x427914=0x0;_0x427914<_0x29998e[_0x1591('0x19')];_0x427914+=0x1){var _0x49ae2a;var _0x450ef3=_0x29998e[_0x427914];if(_0x2caab9){_0x49ae2a=path[_0x1591('0x1e')](_0x33c96f,_0x25ad5d,util[_0x1591('0xc')](_0x1591('0x20'),_0x25ad5d,_0x427914,_0x1591('0x21')));}else{_0x49ae2a=path[_0x1591('0x1e')](_0x33c96f,util[_0x1591('0xc')](_0x1591('0x22'),_0x25ad5d,_0x1591('0x21')));}fs[_0x1591('0x23')](_0x49ae2a,csv(_0x450ef3));}})[_0x1591('0x12')](function(){if(_0x2caab9){return new Promise(function(_0x2638bc){zipdir(path['join'](_0x33c96f,_0x25ad5d),{'saveTo':path[_0x1591('0x1e')](_0x33c96f,util[_0x1591('0xc')]('%s.%s',_0x25ad5d,_0x1591('0x24')))},function(_0x326ad4,_0x4aaa6e){rimraf(path[_0x1591('0x1e')](_0x33c96f,_0x25ad5d),function(){});_0x2638bc('zip\x20finished');});});}})[_0x1591('0x12')](function(){logger[_0x1591('0xb')](util[_0x1591('0xc')](_0x1591('0x25'),EXTRACTED_REPORT_ID,_0x1591('0xe')));return analyticExtractedReport(_0x1591('0x26'),_0x2caab9?util[_0x1591('0xc')]('%s.%s',_0x25ad5d,_0x2caab9?_0x1591('0x24'):_0x1591('0x21')):null);});})[_0x1591('0x27')](function(_0x1fafaf){logger[_0x1591('0xb')](util[_0x1591('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x1591('0xe')),util[_0x1591('0x28')](_0x1fafaf,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1591('0x29'));})[_0x1591('0x2a')](function(){process[_0x1591('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x582f=['%s\x20limit\x20%d\x20OFFSET\x20%d','query','push','dirname','basename','.csv','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','path','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','forEach'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x582f,0x1bd));var _0xf582=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0x582f[_0x173f10];return _0x53142d;};'use strict';var util=require('util');var path=require(_0xf582('0x0'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xf582('0x1'));var rimraf=require(_0xf582('0x2'));var db=require('../../mysqldb')['db'];var dbH=require(_0xf582('0x3'))[_0xf582('0x4')];var logger=require(_0xf582('0x5'))(_0xf582('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xf582('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xf582('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x591752,_0x29398f){var _0x454477={'status':_0x591752};var _0x199e2c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x29398f){_0x454477[_0xf582('0x8')]=_0x29398f;}return db[_0xf582('0x9')]['update'](_0x454477,_0x199e2c);}function main(){var _0x35a1d8=0x1388;var _0x2ecc52;logger['info'](util[_0xf582('0xa')](_0xf582('0xb'),EXTRACTED_REPORT_ID,_0xf582('0xc')));return db[_0xf582('0xd')][_0xf582('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf582('0xf'),_0xf582('0x10')]})[_0xf582('0x11')](function(_0x276f00){if(_0x276f00){_0x2ecc52=_0x276f00;_0x35a1d8=_0x2ecc52[_0xf582('0x10')]||0x1388;}})[_0xf582('0x11')](function(){return dbH[_0xf582('0x12')]['query'](util['format'](_0xf582('0x13'),QUERY),{'type':dbH[_0xf582('0x12')][_0xf582('0x14')][_0xf582('0x15')]});})[_0xf582('0x11')](function(_0x2e8670){if(!_0x2e8670[0x0][_0xf582('0x16')]){return analyticExtractedReport('Empty');}var _0x4f0354=[];var _0xe2f07a=0x0;if(_0x2ecc52[_0xf582('0xf')]){if(_0x2e8670&&_0x2e8670[_0xf582('0x17')]){var _0x5a2173=_['range'](_0x2e8670[0x0][_0xf582('0x16')]/_0x35a1d8);var _0x3d882b=Number['isInteger'](_0x2e8670[0x0][_0xf582('0x16')]/_0x35a1d8)?_0x2e8670[0x0][_0xf582('0x16')]%_0x35a1d8:0x0;_0x5a2173[_0xf582('0x18')](function(_0x3b7eb5){if(_0x3b7eb5>0x0){_0xe2f07a+=_0x35a1d8;}_0x4f0354['push'](dbH['sequelize']['query'](util[_0xf582('0xa')](_0xf582('0x19'),QUERY,_0x35a1d8,_0xe2f07a),{'type':dbH[_0xf582('0x12')][_0xf582('0x14')][_0xf582('0x15')]}));});if(_0x3d882b>0x0){_0xe2f07a+=_0x35a1d8;_0x4f0354['push'](dbH[_0xf582('0x12')][_0xf582('0x1a')](util[_0xf582('0xa')](_0xf582('0x19'),QUERY,_0x3d882b,_0xe2f07a),{'type':dbH[_0xf582('0x12')][_0xf582('0x14')]['SELECT']}));}}}else{_0x4f0354[_0xf582('0x1b')](dbH[_0xf582('0x12')][_0xf582('0x1a')](QUERY,{'type':dbH[_0xf582('0x12')][_0xf582('0x14')]['SELECT']}));}var _0x2f12eb=path[_0xf582('0x1c')](PATH);var _0x1d7260=path[_0xf582('0x1d')](PATH,_0xf582('0x1e'));var _0x1186b4=_0x2ecc52['split']&&_0x4f0354[_0xf582('0x17')]>0x1;var _0x1238f3=[];if(!fs[_0xf582('0x1f')](path[_0xf582('0x20')](_0x2f12eb,_0x1d7260))&&_0x1186b4){fs['mkdirSync'](path[_0xf582('0x20')](_0x2f12eb,_0x1d7260));}return BPromise[_0xf582('0x21')](_0x4f0354,function(_0x56a3f6){_0x1238f3[_0xf582('0x1b')](_0x56a3f6);})[_0xf582('0x11')](function(){for(var _0x3879f4=0x0;_0x3879f4<_0x1238f3[_0xf582('0x17')];_0x3879f4+=0x1){var _0x475dcb;var _0x2f8b59=_0x1238f3[_0x3879f4];if(_0x1186b4){_0x475dcb=path['join'](_0x2f12eb,_0x1d7260,util[_0xf582('0xa')](_0xf582('0x22'),_0x1d7260,_0x3879f4,_0xf582('0x23')));}else{_0x475dcb=path[_0xf582('0x20')](_0x2f12eb,util[_0xf582('0xa')](_0xf582('0x24'),_0x1d7260,_0xf582('0x23')));}fs[_0xf582('0x25')](_0x475dcb,csv(_0x2f8b59));}})['then'](function(){if(_0x1186b4){return new Promise(function(_0x4ac8bd){zipdir(path[_0xf582('0x20')](_0x2f12eb,_0x1d7260),{'saveTo':path[_0xf582('0x20')](_0x2f12eb,util['format'](_0xf582('0x24'),_0x1d7260,_0xf582('0x26')))},function(_0x40ca18,_0x148922){rimraf(path[_0xf582('0x20')](_0x2f12eb,_0x1d7260),function(){});_0x4ac8bd(_0xf582('0x27'));});});}})[_0xf582('0x11')](function(){logger['info'](util[_0xf582('0xa')](_0xf582('0x28'),EXTRACTED_REPORT_ID,_0xf582('0xc')));return analyticExtractedReport(_0xf582('0x29'),_0x1186b4?util[_0xf582('0xa')]('%s.%s',_0x1d7260,_0x1186b4?'zip':_0xf582('0x23')):null);});})['catch'](function(_0x3f146f){logger[_0xf582('0x2a')](util[_0xf582('0xa')](_0xf582('0x2b'),EXTRACTED_REPORT_ID,_0xf582('0xc')),util[_0xf582('0x2c')](_0x3f146f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf582('0x2d'));})['finally'](function(){process[_0xf582('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 0ae7973..43dcdc4 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 _0xbca8=['interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','window','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','update','map','pick','toString','length','auto','body','chunk','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','right','num','Empty','Setting','find','splitSizePdf','then','split','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','basename','join','each','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','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xbca8,0xbf));var _0x8bca=function(_0xf842fa,_0x56edb3){_0xf842fa=_0xf842fa-0x0;var _0x5093d8=_0xbca8[_0xf842fa];return _0x5093d8;};'use strict';var _=require(_0x8bca('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x8bca('0x1'));var moment=require(_0x8bca('0x2'));var htmlToPdfmake=require(_0x8bca('0x3'));var PdfPrinter=require(_0x8bca('0x4'));var zipdir=require(_0x8bca('0x5'));var rimraf=require(_0x8bca('0x6'));var JSDOM=require(_0x8bca('0x7'))['JSDOM'];var window=new JSDOM('')[_0x8bca('0x8')];var BPromise=require('bluebird');var db=require(_0x8bca('0x9'))['db'];var dbH=require(_0x8bca('0x9'))[_0x8bca('0xa')];var logger=require('../../config/logger')(_0x8bca('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0x8bca('0xc')][0x2]);var QUERY=process[_0x8bca('0xc')][0x3];var PATH=process[_0x8bca('0xc')][0x4];var NAME=process[_0x8bca('0xc')][0x5];var FORMAT=_0x8bca('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x269b22,_0x36b640){var _0x17e230={'status':_0x269b22};var _0x276985={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x36b640){_0x17e230['savename']=_0x36b640;}return db['AnalyticExtractedReport'][_0x8bca('0xe')](_0x17e230,_0x276985);}function getHeaders(_0x5a294d){return _[_0x8bca('0xf')](_0x5a294d,function(_0x71d82c){return{'text':_0x71d82c,'style':'tableHeader'};});}function getRows(_0xa06d55,_0x40fa6a){return _[_0x8bca('0xf')](_0x40fa6a,function(_0x260d2b){return _(_0x260d2b)[_0x8bca('0x10')](_0xa06d55)[_0x8bca('0xf')](function(_0x3868a3){return _0x3868a3?_[_0x8bca('0x11')](_0x3868a3):'';})['value']();});}function createTable(_0x3e4af6,_0x1aa8d6){var _0x17a306={'widths':_['fill'](Array(_0x3e4af6[_0x8bca('0x12')]),0x91),'heights':function(_0x3fb1a7){return _0x3fb1a7===0x0?_0x8bca('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5a0e4f=getHeaders(_0x3e4af6);_0x17a306[_0x8bca('0x14')]['push'](_0x5a0e4f);var _0x4fa585=getRows(_0x3e4af6,_0x1aa8d6);_0x17a306['body']=_0x17a306[_0x8bca('0x14')]['concat'](_0x4fa585);return _0x17a306;}function createTables(_0xf42515){var _0x54ad71=[];var _0x544220=_[_0x8bca('0x15')](Object['keys'](_0xf42515[0x0]),0x5);_0x544220[_0x8bca('0x16')](function(_0x46971d){_0x54ad71[_0x8bca('0x17')](createTable(_0x46971d,_0xf42515));});return _0x54ad71;}function getPDFDocDefinition(_0x16dcb9){var _0x296f53=util[_0x8bca('0x18')](_0x8bca('0x19'),NAME,EXTRACTED_REPORT[_0x8bca('0x1a')],moment(EXTRACTED_REPORT['startDate'])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x8bca('0x18')](FORMAT));var _0x1285c5=[];for(var _0x2d5c68=0x0;_0x2d5c68<_0x16dcb9[_0x8bca('0x12')];_0x2d5c68++){var _0x5a0688=[];if(_0x2d5c68===0x0){_0x5a0688['push']({'text':_0x296f53,'style':_0x8bca('0x1b')});}var _0x2542a2={'table':_0x16dcb9[_0x2d5c68]};if(_0x2d5c68>0x0){_0x2542a2[_0x8bca('0x1c')]=_0x8bca('0x1d');_0x2542a2[_0x8bca('0x1e')]=[0x0,0x46,0x0,0x0];}_0x5a0688['push'](_0x2542a2);_0x1285c5[_0x8bca('0x17')](_0x5a0688);}return{'pageSize':'A4','pageOrientation':_0x8bca('0x1f'),'content':_0x1285c5,'footer':function(_0x27954c,_0x4e1382){return{'text':_0x27954c[_0x8bca('0x11')]()+_0x8bca('0x20')+_0x4e1382,'style':_0x8bca('0x21')};},'defaultStyle':{'font':_0x8bca('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x8bca('0x23'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x29a5bb){var _0x3e5e8a=0x1388;var _0x363540;if(!_0x29a5bb[0x0][_0x8bca('0x24')]){return analyticExtractedReport(_0x8bca('0x25'));}return db[_0x8bca('0x26')][_0x8bca('0x27')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x8bca('0x28')]})[_0x8bca('0x29')](function(_0x12e92c){if(_0x12e92c){_0x363540=_0x12e92c;_0x3e5e8a=_0x363540['splitSizePdf']||0x3e8;}})[_0x8bca('0x29')](function(){var _0x18f730=[];var _0x18ee33=0x0;if(_0x363540[_0x8bca('0x2a')]){if(_0x29a5bb&&_0x29a5bb['length']){var _0x62cb97=_[_0x8bca('0x2b')](_0x29a5bb[0x0][_0x8bca('0x24')]/_0x3e5e8a);var _0x6e959a=Number[_0x8bca('0x2c')](_0x29a5bb[0x0][_0x8bca('0x24')]/_0x3e5e8a)?_0x29a5bb[0x0][_0x8bca('0x24')]%_0x3e5e8a:0x0;_0x62cb97[_0x8bca('0x16')](function(_0x309eee){if(_0x309eee>0x0){_0x18ee33+=_0x3e5e8a;}_0x18f730[_0x8bca('0x17')](dbH[_0x8bca('0x2d')][_0x8bca('0x2e')](util[_0x8bca('0x18')](_0x8bca('0x2f'),QUERY,_0x3e5e8a,_0x18ee33),{'type':dbH[_0x8bca('0x2d')]['QueryTypes'][_0x8bca('0x30')]}));});if(_0x6e959a>0x0){_0x18ee33+=_0x3e5e8a;_0x18f730[_0x8bca('0x17')](dbH[_0x8bca('0x2d')][_0x8bca('0x2e')](util[_0x8bca('0x18')](_0x8bca('0x2f'),QUERY,_0x6e959a,_0x18ee33),{'type':dbH[_0x8bca('0x2d')][_0x8bca('0x31')][_0x8bca('0x30')]}));}}}else{_0x18f730[_0x8bca('0x17')](dbH[_0x8bca('0x2d')][_0x8bca('0x2e')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x8bca('0x30')]}));}var _0x2aaf67=path['dirname'](PATH);var _0x23bd5a=path[_0x8bca('0x32')](PATH,'.pdf');var _0x56c7a3=_0x363540[_0x8bca('0x2a')]&&_0x18f730[_0x8bca('0x12')]>0x1;var _0x3ed816=[];if(!fs['existsSync'](path['join'](_0x2aaf67,_0x23bd5a))&&_0x56c7a3){fs['mkdirSync'](path[_0x8bca('0x33')](_0x2aaf67,_0x23bd5a));}return BPromise[_0x8bca('0x34')](_0x18f730,function(_0x579ad0){_0x3ed816['push'](_0x579ad0);})[_0x8bca('0x29')](function(){var _0x46bbcf=[];for(var _0x5884cf=0x0;_0x5884cf<_0x3ed816['length'];_0x5884cf+=0x1){var _0x3bc4b5=_0x3ed816[_0x5884cf];var _0x524e5c=createTables(_['flatten'](_0x3bc4b5));var _0x273511;var _0x98d3d1=getPDFDocDefinition(_0x524e5c);var _0x39ee5f=getPDFPrinter();var _0x13319a=_0x39ee5f[_0x8bca('0x35')](_0x98d3d1);if(_0x56c7a3){_0x273511=path[_0x8bca('0x33')](_0x2aaf67,_0x23bd5a,util[_0x8bca('0x18')](_0x8bca('0x36'),_0x23bd5a,_0x5884cf,_0x8bca('0x37')));}else{_0x273511=path[_0x8bca('0x33')](_0x2aaf67,util[_0x8bca('0x18')](_0x8bca('0x38'),_0x23bd5a,_0x8bca('0x37')));}_0x46bbcf['push'](writePDFDocument(_0x13319a,_0x273511));}return Promise[_0x8bca('0x39')](_0x46bbcf);})['then'](function(){if(_0x56c7a3){return new Promise(function(_0x46947b){zipdir(path[_0x8bca('0x33')](_0x2aaf67,_0x23bd5a),{'saveTo':path[_0x8bca('0x33')](_0x2aaf67,util[_0x8bca('0x18')](_0x8bca('0x38'),_0x23bd5a,_0x8bca('0x3a')))},function(){rimraf(path[_0x8bca('0x33')](_0x2aaf67,_0x23bd5a),function(){});_0x46947b(_0x8bca('0x3b'));});});}})['then'](function(){if(!_0x56c7a3)return;rimraf(path[_0x8bca('0x33')](_0x2aaf67,_0x23bd5a),function(){});})[_0x8bca('0x29')](function(){logger[_0x8bca('0x3c')](util['format'](_0x8bca('0x3d'),EXTRACTED_REPORT_ID,_0x8bca('0x3e')));return analyticExtractedReport(_0x8bca('0x3f'),_0x56c7a3?util[_0x8bca('0x18')]('%s.%s',_0x23bd5a,_0x56c7a3?_0x8bca('0x3a'):_0x8bca('0x37')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x8bca('0x3c')](util['format'](_0x8bca('0x40'),EXTRACTED_REPORT_ID,_0x8bca('0x3e')));return db[_0x8bca('0x41')][_0x8bca('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x8bca('0x29')](function(_0x551bc6){EXTRACTED_REPORT=_0x551bc6;return dbH['sequelize']['query'](util[_0x8bca('0x18')](_0x8bca('0x43'),QUERY),{'type':dbH['sequelize'][_0x8bca('0x31')]['SELECT']});})[_0x8bca('0x29')](extractReport)[_0x8bca('0x44')](function(_0x5dd08b){logger['info'](util[_0x8bca('0x18')](_0x8bca('0x45'),EXTRACTED_REPORT_ID,_0x8bca('0x3e')),util[_0x8bca('0x46')](_0x5dd08b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8bca('0x47'));})[_0x8bca('0x48')](function(){process[_0x8bca('0x49')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5ec166=new PdfPrinter({'Arial':{'normal':__dirname+_0x8bca('0x4a'),'bold':__dirname+_0x8bca('0x4b'),'italics':__dirname+_0x8bca('0x4c'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x5ec166;}function getPDFDocDefinitionFromHTML(_0xbf150,_0x3bc755){var _0x15f783=util[_0x8bca('0x18')](_0x8bca('0x4d'),_0x3bc755[_0x8bca('0x4e')],_0x3bc755[_0x8bca('0x4f')]);var _0x58c32b=moment()['format'](_0x8bca('0x50'))[_0x8bca('0x11')]();var _0x37a1fb=htmlToPdfmake(_0xbf150,{'window':window,'tableAutoSize':!![]});return{'content':[_0x37a1fb],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x8bca('0x51'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x8bca('0x51'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x8bca('0x51')}},'header':function(){return[{'text':_0x8bca('0x52'),'style':'header'}];},'footer':function(_0x187136,_0x5cf933){return[{'text':util[_0x8bca('0x18')](_0x8bca('0x53'),_0x15f783,_0x187136,_0x5cf933,_0x58c32b),'style':'footer'}];}};}function writePDFDocument(_0x5afd22,_0x39349c){return new Promise(function(_0x131e93,_0x1346b3){var _0x48876a=_0x5afd22[_0x8bca('0x54')](fs[_0x8bca('0x55')](_0x39349c));_0x48876a['on'](_0x8bca('0x56'),function(){_0x131e93(_0x8bca('0x56'));});_0x48876a['on'](_0x8bca('0x57'),function(_0x3a9bc2){_0x1346b3(_0x3a9bc2);});_0x5afd22[_0x8bca('0x58')]();});}exports[_0x8bca('0x59')]=function(_0x25ccf5,_0x4ea429){var _0x4b9359=getPDFPrinter();var _0x4c22de=getPDFDocDefinitionFromHTML(_0x25ccf5,_0x4ea429);var _0x178a3d=_0x4b9359[_0x8bca('0x35')](_0x4c22de);return writePDFDocument(_0x178a3d,_0x4ea429['path'])[_0x8bca('0x44')](function(_0x35b374){throw _0x35b374;});}; \ No newline at end of file +var _0x0e86=['zip','zip\x20finished','info','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','error','createPdfFromHTML','createPdfKitDocument','path','catch','lodash','util','moment','pdfmake/src/printer','zip-dir','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','map','tableHeader','toString','value','length','push','body','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','before','\x20/\x20','footer','Arial','black','right','Empty','Setting','split','splitSizePdf','then','range','num','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','basename','.pdf','mkdirSync','each','flatten','join','pdf','%s.%s'];(function(_0x26e2d9,_0x1771d7){var _0x3753ab=function(_0x51ee84){while(--_0x51ee84){_0x26e2d9['push'](_0x26e2d9['shift']());}};_0x3753ab(++_0x1771d7);}(_0x0e86,0x1bd));var _0x60e8=function(_0x3ddda7,_0x39eaf3){_0x3ddda7=_0x3ddda7-0x0;var _0x38f5b4=_0x0e86[_0x3ddda7];return _0x38f5b4;};'use strict';var _=require(_0x60e8('0x0'));var fs=require('fs');var util=require(_0x60e8('0x1'));var path=require('path');var moment=require(_0x60e8('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x60e8('0x3'));var zipdir=require(_0x60e8('0x4'));var rimraf=require('rimraf');var JSDOM=require(_0x60e8('0x5'))[_0x60e8('0x6')];var window=new JSDOM('')[_0x60e8('0x7')];var BPromise=require(_0x60e8('0x8'));var db=require('../../mysqldb')['db'];var dbH=require(_0x60e8('0x9'))[_0x60e8('0xa')];var logger=require(_0x60e8('0xb'))(_0x60e8('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0x60e8('0xd')][0x2]);var QUERY=process[_0x60e8('0xd')][0x3];var PATH=process[_0x60e8('0xd')][0x4];var NAME=process[_0x60e8('0xd')][0x5];var FORMAT=_0x60e8('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1abc26,_0x35db6b){var _0x5791fa={'status':_0x1abc26};var _0xdbd0a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x35db6b){_0x5791fa[_0x60e8('0xf')]=_0x35db6b;}return db['AnalyticExtractedReport']['update'](_0x5791fa,_0xdbd0a);}function getHeaders(_0x1eda92){return _[_0x60e8('0x10')](_0x1eda92,function(_0x4f48ad){return{'text':_0x4f48ad,'style':_0x60e8('0x11')};});}function getRows(_0x1f3fda,_0x5ef50c){return _['map'](_0x5ef50c,function(_0x54140b){return _(_0x54140b)['pick'](_0x1f3fda)[_0x60e8('0x10')](function(_0x15e571){return _0x15e571?_[_0x60e8('0x12')](_0x15e571):'';})[_0x60e8('0x13')]();});}function createTable(_0x11c1c2,_0x469dc7){var _0x52e1f6={'widths':_['fill'](Array(_0x11c1c2[_0x60e8('0x14')]),0x91),'heights':function(_0x4345f7){return _0x4345f7===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4b1c56=getHeaders(_0x11c1c2);_0x52e1f6['body'][_0x60e8('0x15')](_0x4b1c56);var _0x3d3ea0=getRows(_0x11c1c2,_0x469dc7);_0x52e1f6[_0x60e8('0x16')]=_0x52e1f6[_0x60e8('0x16')]['concat'](_0x3d3ea0);return _0x52e1f6;}function createTables(_0x1fc07a){var _0x3714a1=[];var _0xc69153=_[_0x60e8('0x17')](Object['keys'](_0x1fc07a[0x0]),0x5);_0xc69153[_0x60e8('0x18')](function(_0x2d4202){_0x3714a1[_0x60e8('0x15')](createTable(_0x2d4202,_0x1fc07a));});return _0x3714a1;}function getPDFDocDefinition(_0x521865){var _0xcabab0=util[_0x60e8('0x19')](_0x60e8('0x1a'),NAME,EXTRACTED_REPORT[_0x60e8('0x1b')],moment(EXTRACTED_REPORT[_0x60e8('0x1c')])[_0x60e8('0x19')](FORMAT),moment(EXTRACTED_REPORT[_0x60e8('0x1d')])[_0x60e8('0x19')](FORMAT));var _0x335ed1=[];for(var _0x522fb9=0x0;_0x522fb9<_0x521865['length'];_0x522fb9++){var _0x27e2e9=[];if(_0x522fb9===0x0){_0x27e2e9[_0x60e8('0x15')]({'text':_0xcabab0,'style':_0x60e8('0x1e')});}var _0x2be7ae={'table':_0x521865[_0x522fb9]};if(_0x522fb9>0x0){_0x2be7ae[_0x60e8('0x1f')]=_0x60e8('0x20');_0x2be7ae['margin']=[0x0,0x46,0x0,0x0];}_0x27e2e9[_0x60e8('0x15')](_0x2be7ae);_0x335ed1[_0x60e8('0x15')](_0x27e2e9);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x335ed1,'footer':function(_0x151e91,_0x507f09){return{'text':_0x151e91[_0x60e8('0x12')]()+_0x60e8('0x21')+_0x507f09,'style':_0x60e8('0x22')};},'defaultStyle':{'font':_0x60e8('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x60e8('0x24')},'footer':{'alignment':_0x60e8('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x20cb55){var _0xf937af=0x1388;var _0x5b5bb7;if(!_0x20cb55[0x0]['num']){return analyticExtractedReport(_0x60e8('0x26'));}return db[_0x60e8('0x27')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x60e8('0x28'),_0x60e8('0x29')]})[_0x60e8('0x2a')](function(_0x31f95e){if(_0x31f95e){_0x5b5bb7=_0x31f95e;_0xf937af=_0x5b5bb7[_0x60e8('0x29')]||0x3e8;}})['then'](function(){var _0x33315e=[];var _0x2b6a51=0x0;if(_0x5b5bb7[_0x60e8('0x28')]){if(_0x20cb55&&_0x20cb55[_0x60e8('0x14')]){var _0x5b4590=_[_0x60e8('0x2b')](_0x20cb55[0x0]['num']/_0xf937af);var _0x16637b=Number['isInteger'](_0x20cb55[0x0][_0x60e8('0x2c')]/_0xf937af)?_0x20cb55[0x0][_0x60e8('0x2c')]%_0xf937af:0x0;_0x5b4590[_0x60e8('0x18')](function(_0x47463a){if(_0x47463a>0x0){_0x2b6a51+=_0xf937af;}_0x33315e[_0x60e8('0x15')](dbH[_0x60e8('0x2d')][_0x60e8('0x2e')](util[_0x60e8('0x19')](_0x60e8('0x2f'),QUERY,_0xf937af,_0x2b6a51),{'type':dbH[_0x60e8('0x2d')]['QueryTypes'][_0x60e8('0x30')]}));});if(_0x16637b>0x0){_0x2b6a51+=_0xf937af;_0x33315e['push'](dbH['sequelize']['query'](util[_0x60e8('0x19')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x16637b,_0x2b6a51),{'type':dbH['sequelize'][_0x60e8('0x31')][_0x60e8('0x30')]}));}}}else{_0x33315e[_0x60e8('0x15')](dbH[_0x60e8('0x2d')][_0x60e8('0x2e')](QUERY,{'type':dbH['sequelize'][_0x60e8('0x31')]['SELECT']}));}var _0x2bf054=path[_0x60e8('0x32')](PATH);var _0x24f830=path[_0x60e8('0x33')](PATH,_0x60e8('0x34'));var _0x5bd4d1=_0x5b5bb7['split']&&_0x33315e[_0x60e8('0x14')]>0x1;var _0x3cd0be=[];if(!fs['existsSync'](path['join'](_0x2bf054,_0x24f830))&&_0x5bd4d1){fs[_0x60e8('0x35')](path['join'](_0x2bf054,_0x24f830));}return BPromise[_0x60e8('0x36')](_0x33315e,function(_0x55a7e0){_0x3cd0be['push'](_0x55a7e0);})[_0x60e8('0x2a')](function(){var _0x4e333f=[];for(var _0x336617=0x0;_0x336617<_0x3cd0be[_0x60e8('0x14')];_0x336617+=0x1){var _0x357a4a=_0x3cd0be[_0x336617];var _0x48f291=createTables(_[_0x60e8('0x37')](_0x357a4a));var _0x49afcd;var _0x55067b=getPDFDocDefinition(_0x48f291);var _0x1603d3=getPDFPrinter();var _0x4a8959=_0x1603d3['createPdfKitDocument'](_0x55067b);if(_0x5bd4d1){_0x49afcd=path[_0x60e8('0x38')](_0x2bf054,_0x24f830,util[_0x60e8('0x19')]('%s%d.%s',_0x24f830,_0x336617,_0x60e8('0x39')));}else{_0x49afcd=path[_0x60e8('0x38')](_0x2bf054,util[_0x60e8('0x19')]('%s.%s',_0x24f830,_0x60e8('0x39')));}_0x4e333f[_0x60e8('0x15')](writePDFDocument(_0x4a8959,_0x49afcd));}return Promise['all'](_0x4e333f);})[_0x60e8('0x2a')](function(){if(_0x5bd4d1){return new Promise(function(_0x586c17){zipdir(path[_0x60e8('0x38')](_0x2bf054,_0x24f830),{'saveTo':path[_0x60e8('0x38')](_0x2bf054,util['format'](_0x60e8('0x3a'),_0x24f830,_0x60e8('0x3b')))},function(){rimraf(path[_0x60e8('0x38')](_0x2bf054,_0x24f830),function(){});_0x586c17(_0x60e8('0x3c'));});});}})[_0x60e8('0x2a')](function(){if(!_0x5bd4d1)return;rimraf(path[_0x60e8('0x38')](_0x2bf054,_0x24f830),function(){});})[_0x60e8('0x2a')](function(){logger[_0x60e8('0x3d')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x60e8('0x3e')));return analyticExtractedReport(_0x60e8('0x3f'),_0x5bd4d1?util['format']('%s.%s',_0x24f830,_0x5bd4d1?_0x60e8('0x3b'):_0x60e8('0x39')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x60e8('0x3d')](util[_0x60e8('0x19')](_0x60e8('0x40'),EXTRACTED_REPORT_ID,_0x60e8('0x3e')));return db[_0x60e8('0x41')][_0x60e8('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x60e8('0x2a')](function(_0x4d198d){EXTRACTED_REPORT=_0x4d198d;return dbH[_0x60e8('0x2d')][_0x60e8('0x2e')](util[_0x60e8('0x19')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x60e8('0x2d')][_0x60e8('0x31')][_0x60e8('0x30')]});})[_0x60e8('0x2a')](extractReport)['catch'](function(_0x5414e9){logger['info'](util[_0x60e8('0x19')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x60e8('0x3e')),util['inspect'](_0x5414e9,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x60e8('0x43')](function(){process[_0x60e8('0x44')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3478cd=new PdfPrinter({'Arial':{'normal':__dirname+_0x60e8('0x45'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x60e8('0x46'),'bolditalics':__dirname+_0x60e8('0x47')}});return _0x3478cd;}function getPDFDocDefinitionFromHTML(_0x2f5aea,_0x2703e3){var _0x1e1c6c=util[_0x60e8('0x19')](_0x60e8('0x48'),_0x2703e3[_0x60e8('0x49')],_0x2703e3['interactionId']);var _0x19be3e=moment()[_0x60e8('0x19')](_0x60e8('0x4a'))[_0x60e8('0x12')]();var _0xd9faf=htmlToPdfmake(_0x2f5aea,{'window':window,'tableAutoSize':!![]});return{'content':[_0xd9faf],'defaultStyle':{'font':_0x60e8('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x60e8('0x4b'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x60e8('0x4b')}},'header':function(){return[{'text':_0x60e8('0x4c'),'style':'header'}];},'footer':function(_0x45dfe1,_0x9ebd68){return[{'text':util[_0x60e8('0x19')](_0x60e8('0x4d'),_0x1e1c6c,_0x45dfe1,_0x9ebd68,_0x19be3e),'style':_0x60e8('0x22')}];}};}function writePDFDocument(_0x450013,_0x38667d){return new Promise(function(_0x448874,_0x2e81e5){var _0x275788=_0x450013[_0x60e8('0x4e')](fs['createWriteStream'](_0x38667d));_0x275788['on']('finish',function(){_0x448874('finish');});_0x275788['on'](_0x60e8('0x4f'),function(_0x2a2ae5){_0x2e81e5(_0x2a2ae5);});_0x450013['end']();});}exports[_0x60e8('0x50')]=function(_0x416b92,_0x28b33d){var _0x38fe5b=getPDFPrinter();var _0x3b3f94=getPDFDocDefinitionFromHTML(_0x416b92,_0x28b33d);var _0x2d8e6b=_0x38fe5b[_0x60e8('0x51')](_0x3b3f94);return writePDFDocument(_0x2d8e6b,_0x28b33d[_0x60e8('0x52')])[_0x60e8('0x53')](function(_0x495aa4){throw _0x495aa4;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 9d14c3d..5df4626 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 _0x8168=['Failed','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','analytics','argv','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','existsSync','join','mkdirSync','xlsx','%s.%s','binary','zip','info','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect'];(function(_0x200d78,_0x2820e0){var _0x383a9a=function(_0x45c9a0){while(--_0x45c9a0){_0x200d78['push'](_0x200d78['shift']());}};_0x383a9a(++_0x2820e0);}(_0x8168,0x111));var _0x8816=function(_0x2f1114,_0x4561f1){_0x2f1114=_0x2f1114-0x0;var _0x2fe856=_0x8168[_0x2f1114];return _0x2fe856;};'use strict';var util=require(_0x8816('0x0'));var path=require(_0x8816('0x1'));var _=require(_0x8816('0x2'));var fs=require('fs');var json2xls=require(_0x8816('0x3'));var BPromise=require(_0x8816('0x4'));var zipdir=require(_0x8816('0x5'));var rimraf=require(_0x8816('0x6'));var db=require(_0x8816('0x7'))['db'];var dbH=require(_0x8816('0x7'))['dbH'];var logger=require('../../config/logger')(_0x8816('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x8816('0x9')][0x2]);var QUERY=process[_0x8816('0x9')][0x3];var PATH=process[_0x8816('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x586024,_0x22bfda){var _0x47860b={'status':_0x586024};var _0x3c7b2f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x22bfda){_0x47860b['savename']=_0x22bfda;}return db['AnalyticExtractedReport']['update'](_0x47860b,_0x3c7b2f);}function main(){var _0x3abcc3=0x1388;var _0x38ccae;logger['info'](util['format'](_0x8816('0xa'),EXTRACTED_REPORT_ID,_0x8816('0xb')));return db[_0x8816('0xc')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8816('0xd'),_0x8816('0xe')]})['then'](function(_0x46186c){if(_0x46186c){_0x38ccae=_0x46186c;_0x3abcc3=_0x38ccae['splitSizeXlsx']||0x1388;}})[_0x8816('0xf')](function(){return dbH[_0x8816('0x10')][_0x8816('0x11')](util[_0x8816('0x12')](_0x8816('0x13'),QUERY),{'type':dbH[_0x8816('0x10')][_0x8816('0x14')][_0x8816('0x15')]});})[_0x8816('0xf')](function(_0x2d2a5e){if(!_0x2d2a5e[0x0][_0x8816('0x16')]){return analyticExtractedReport(_0x8816('0x17'));}var _0x107035=[];var _0x1545fc=0x0;if(_0x38ccae[_0x8816('0xd')]){if(_0x2d2a5e&&_0x2d2a5e[_0x8816('0x18')]){var _0x2ae336=_[_0x8816('0x19')](_0x2d2a5e[0x0][_0x8816('0x16')]/_0x3abcc3);var _0x3dcc99=Number[_0x8816('0x1a')](_0x2d2a5e[0x0][_0x8816('0x16')]/_0x3abcc3)?_0x2d2a5e[0x0][_0x8816('0x16')]%_0x3abcc3:0x0;_0x2ae336[_0x8816('0x1b')](function(_0x3eaa7f){if(_0x3eaa7f>0x0){_0x1545fc+=_0x3abcc3;}_0x107035['push'](dbH[_0x8816('0x10')][_0x8816('0x11')](util[_0x8816('0x12')](_0x8816('0x1c'),QUERY,_0x3abcc3,_0x1545fc),{'type':dbH[_0x8816('0x10')]['QueryTypes'][_0x8816('0x15')]}));});if(_0x3dcc99>0x0){_0x1545fc+=_0x3abcc3;_0x107035[_0x8816('0x1d')](dbH['sequelize'][_0x8816('0x11')](util[_0x8816('0x12')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3dcc99,_0x1545fc),{'type':dbH[_0x8816('0x10')][_0x8816('0x14')][_0x8816('0x15')]}));}}}else{_0x107035[_0x8816('0x1d')](dbH['sequelize'][_0x8816('0x11')](QUERY,{'type':dbH[_0x8816('0x10')][_0x8816('0x14')][_0x8816('0x15')]}));}var _0x51e206=path[_0x8816('0x1e')](PATH);var _0x242ca4=path['basename'](PATH,'.xlsx');var _0x3d6547=_0x38ccae[_0x8816('0xd')]&&_0x107035[_0x8816('0x18')]>0x1;var _0x233689=[];if(!fs[_0x8816('0x1f')](path[_0x8816('0x20')](_0x51e206,_0x242ca4))&&_0x3d6547){fs[_0x8816('0x21')](path[_0x8816('0x20')](_0x51e206,_0x242ca4));}return BPromise['each'](_0x107035,function(_0x36808c){_0x233689[_0x8816('0x1d')](_0x36808c);})[_0x8816('0xf')](function(){for(var _0xbfc4a=0x0;_0xbfc4a<_0x233689[_0x8816('0x18')];_0xbfc4a+=0x1){var _0x424963;var _0x13ee8d=_0x233689[_0xbfc4a];if(_0x3d6547){_0x424963=path[_0x8816('0x20')](_0x51e206,_0x242ca4,util['format']('%s%d.%s',_0x242ca4,_0xbfc4a,_0x8816('0x22')));}else{_0x424963=path['join'](_0x51e206,util[_0x8816('0x12')](_0x8816('0x23'),_0x242ca4,_0x8816('0x22')));}fs['writeFileSync'](_0x424963,json2xls(_0x13ee8d),_0x8816('0x24'));}})[_0x8816('0xf')](function(){if(_0x3d6547){return new Promise(function(_0x257f41){zipdir(path[_0x8816('0x20')](_0x51e206,_0x242ca4),{'saveTo':path[_0x8816('0x20')](_0x51e206,util[_0x8816('0x12')](_0x8816('0x23'),_0x242ca4,_0x8816('0x25')))},function(_0x5bb29d,_0x4a4b53){rimraf(path['join'](_0x51e206,_0x242ca4),function(){});_0x257f41('zip\x20finished');});});}})[_0x8816('0xf')](function(){logger[_0x8816('0x26')](util[_0x8816('0x12')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x8816('0xb')));return analyticExtractedReport(_0x8816('0x27'),_0x3d6547?util['format'](_0x8816('0x23'),_0x242ca4,_0x3d6547?'zip':'xlsx'):null);});})['catch'](function(_0x4d1d4d){logger['info'](util[_0x8816('0x12')](_0x8816('0x28'),EXTRACTED_REPORT_ID,_0x8816('0xb')),util[_0x8816('0x29')](_0x4d1d4d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8816('0x2a'));})[_0x8816('0x2b')](function(){process[_0x8816('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x6351=['isInteger','push','dirname','.xlsx','mkdirSync','each','join','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','info','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','split','length','range'];(function(_0x20a646,_0x486fc0){var _0x4bb624=function(_0xc2fa5f){while(--_0xc2fa5f){_0x20a646['push'](_0x20a646['shift']());}};_0x4bb624(++_0x486fc0);}(_0x6351,0x12f));var _0x1635=function(_0x180632,_0x3a229e){_0x180632=_0x180632-0x0;var _0x151961=_0x6351[_0x180632];return _0x151961;};'use strict';var util=require(_0x1635('0x0'));var path=require(_0x1635('0x1'));var _=require(_0x1635('0x2'));var fs=require('fs');var json2xls=require(_0x1635('0x3'));var BPromise=require(_0x1635('0x4'));var zipdir=require(_0x1635('0x5'));var rimraf=require('rimraf');var db=require(_0x1635('0x6'))['db'];var dbH=require(_0x1635('0x6'))[_0x1635('0x7')];var logger=require(_0x1635('0x8'))(_0x1635('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x1635('0xa')][0x2]);var QUERY=process[_0x1635('0xa')][0x3];var PATH=process[_0x1635('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x503be8,_0x2799ec){var _0x145894={'status':_0x503be8};var _0x52757a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2799ec){_0x145894['savename']=_0x2799ec;}return db[_0x1635('0xb')]['update'](_0x145894,_0x52757a);}function main(){var _0x171ac7=0x1388;var _0xf373ff;logger['info'](util[_0x1635('0xc')](_0x1635('0xd'),EXTRACTED_REPORT_ID,_0x1635('0xe')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x1635('0xf')]})[_0x1635('0x10')](function(_0xb8422d){if(_0xb8422d){_0xf373ff=_0xb8422d;_0x171ac7=_0xf373ff['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH[_0x1635('0x11')]['query'](util[_0x1635('0xc')](_0x1635('0x12'),QUERY),{'type':dbH[_0x1635('0x11')][_0x1635('0x13')][_0x1635('0x14')]});})['then'](function(_0x5ba0b6){if(!_0x5ba0b6[0x0][_0x1635('0x15')]){return analyticExtractedReport(_0x1635('0x16'));}var _0x4fd4f7=[];var _0x52f578=0x0;if(_0xf373ff[_0x1635('0x17')]){if(_0x5ba0b6&&_0x5ba0b6[_0x1635('0x18')]){var _0xb2293a=_[_0x1635('0x19')](_0x5ba0b6[0x0][_0x1635('0x15')]/_0x171ac7);var _0x255e49=Number[_0x1635('0x1a')](_0x5ba0b6[0x0][_0x1635('0x15')]/_0x171ac7)?_0x5ba0b6[0x0][_0x1635('0x15')]%_0x171ac7:0x0;_0xb2293a['forEach'](function(_0x1e673d){if(_0x1e673d>0x0){_0x52f578+=_0x171ac7;}_0x4fd4f7[_0x1635('0x1b')](dbH[_0x1635('0x11')]['query'](util[_0x1635('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x171ac7,_0x52f578),{'type':dbH[_0x1635('0x11')][_0x1635('0x13')]['SELECT']}));});if(_0x255e49>0x0){_0x52f578+=_0x171ac7;_0x4fd4f7['push'](dbH[_0x1635('0x11')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x255e49,_0x52f578),{'type':dbH[_0x1635('0x11')][_0x1635('0x13')][_0x1635('0x14')]}));}}}else{_0x4fd4f7[_0x1635('0x1b')](dbH[_0x1635('0x11')]['query'](QUERY,{'type':dbH[_0x1635('0x11')][_0x1635('0x13')][_0x1635('0x14')]}));}var _0x2f35ac=path[_0x1635('0x1c')](PATH);var _0x23e393=path['basename'](PATH,_0x1635('0x1d'));var _0x4d0483=_0xf373ff[_0x1635('0x17')]&&_0x4fd4f7[_0x1635('0x18')]>0x1;var _0x2a4c82=[];if(!fs['existsSync'](path['join'](_0x2f35ac,_0x23e393))&&_0x4d0483){fs[_0x1635('0x1e')](path['join'](_0x2f35ac,_0x23e393));}return BPromise[_0x1635('0x1f')](_0x4fd4f7,function(_0x44c8f3){_0x2a4c82[_0x1635('0x1b')](_0x44c8f3);})[_0x1635('0x10')](function(){for(var _0x93af5d=0x0;_0x93af5d<_0x2a4c82[_0x1635('0x18')];_0x93af5d+=0x1){var _0x39fdf9;var _0x57fb1e=_0x2a4c82[_0x93af5d];if(_0x4d0483){_0x39fdf9=path[_0x1635('0x20')](_0x2f35ac,_0x23e393,util['format']('%s%d.%s',_0x23e393,_0x93af5d,_0x1635('0x21')));}else{_0x39fdf9=path[_0x1635('0x20')](_0x2f35ac,util['format'](_0x1635('0x22'),_0x23e393,_0x1635('0x21')));}fs[_0x1635('0x23')](_0x39fdf9,json2xls(_0x57fb1e),_0x1635('0x24'));}})[_0x1635('0x10')](function(){if(_0x4d0483){return new Promise(function(_0x307a2a){zipdir(path[_0x1635('0x20')](_0x2f35ac,_0x23e393),{'saveTo':path[_0x1635('0x20')](_0x2f35ac,util[_0x1635('0xc')](_0x1635('0x22'),_0x23e393,_0x1635('0x25')))},function(_0x2bf9d5,_0x1da8f6){rimraf(path[_0x1635('0x20')](_0x2f35ac,_0x23e393),function(){});_0x307a2a(_0x1635('0x26'));});});}})[_0x1635('0x10')](function(){logger['info'](util[_0x1635('0xc')](_0x1635('0x27'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x1635('0x28'),_0x4d0483?util[_0x1635('0xc')](_0x1635('0x22'),_0x23e393,_0x4d0483?_0x1635('0x25'):_0x1635('0x21')):null);});})[_0x1635('0x29')](function(_0x35e69c){logger[_0x1635('0x2a')](util[_0x1635('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x1635('0xe')),util[_0x1635('0x2b')](_0x35e69c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1635('0x2c'));})[_0x1635('0x2d')](function(){process[_0x1635('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index fd6863f..2ce6230 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 _0x4fe2=['find','push','Set','format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','extensions','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','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)=','appType','custom','answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','hasOwnProperty','priority','extension'];(function(_0x1f83a5,_0x59843f){var _0x45edf0=function(_0x431e25){while(--_0x431e25){_0x1f83a5['push'](_0x1f83a5['shift']());}};_0x45edf0(++_0x59843f);}(_0x4fe2,0x1c9));var _0x24fe=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4fe2[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x24fe('0x0'));var util=require(_0x24fe('0x1'));function rewrite(_0x38aff0,_0x33899d){var _0x2cbb09=this;return _0x38aff0[_0x24fe('0x2')][_0x24fe('0x3')][_0x24fe('0x4')]({'raw':!![]})[_0x24fe('0x5')](function(_0x2daac1){_0x2cbb09[_0x24fe('0x6')]=_0x2daac1;return _0x38aff0[_0x24fe('0x2')][_0x24fe('0x7')][_0x24fe('0x4')]({'where':{'IntervalId':_0x33899d[_0x24fe('0x8')]},'raw':!![]});})['then'](function(_0x57860e){return _0x38aff0[_0x24fe('0x2')][_0x24fe('0x7')]['findAll']({'where':{'exten':{'$in':_[_0x24fe('0x9')](_[_0x24fe('0xa')](_0x57860e,_0x24fe('0xb')))}},'order':[{'raw':_0x24fe('0xc')}],'raw':!![]});})[_0x24fe('0x5')](function(_0x7429e6){var _0x3e4fdf=_[_0x24fe('0xd')](_0x7429e6,{'priority':'1'});var _0x59db33=_[_0x24fe('0xd')](_0x7429e6,{'isApp':0x1});var _0x559c23=_[_0x24fe('0xe')](_0x59db33,'exten');var _0x45de78=[_0x24fe('0xf'),'playback'];var _0x3b0d8e=[];var _0x18f506=[];for(var _0x4cf3fd in _0x559c23){if(_0x559c23[_0x24fe('0x10')](_0x4cf3fd)){_0x2cbb09[_0x24fe('0x11')]=0x2;_0x2cbb09['extensions']=[];_0x2cbb09[_0x24fe('0x12')]=_[_0x24fe('0x13')](_0x3e4fdf,{'exten':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0xb')]});_0x2cbb09['extensions'][_0x24fe('0x14')]({'type':_0x559c23[_0x4cf3fd][0x0]['type'],'app':_0x24fe('0x15'),'appdata':util[_0x24fe('0x16')](_0x24fe('0x17'),_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x18')]),'context':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x19')],'exten':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0xb')],'priority':_0x2cbb09[_0x24fe('0x11')]++,'VoiceExtensionId':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x1a')]});if(_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x18')]===_0x24fe('0x1b')){_0x2cbb09[_0x24fe('0x1c')]['push']({'type':_0x559c23[_0x4cf3fd][0x0]['type'],'app':_0x24fe('0x15'),'appdata':'CDR(routeid)='+_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x1a')],'context':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x19')],'exten':_0x559c23[_0x4cf3fd][0x0]['exten'],'priority':_0x2cbb09[_0x24fe('0x11')]++,'VoiceExtensionId':_0x559c23[_0x4cf3fd][0x0]['VoiceExtensionId']});}else if(_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x18')]===_0x24fe('0x1d')){if(_0x2cbb09[_0x24fe('0x12')]){_0x2cbb09[_0x24fe('0x1c')][_0x24fe('0x14')]({'type':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x18')],'app':_0x24fe('0x15'),'appdata':_0x24fe('0x1e')+(_0x2cbb09[_0x24fe('0x12')]['cutdigits']?_0x24fe('0x1f')+_0x2cbb09[_0x24fe('0x12')][_0x24fe('0x20')]+'}':_0x24fe('0x21')),'context':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x19')],'exten':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0xb')],'priority':_0x2cbb09['priority']++,'VoiceExtensionId':_0x559c23[_0x4cf3fd][0x0]['VoiceExtensionId']});}_0x2cbb09[_0x24fe('0x1c')][_0x24fe('0x14')]({'type':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x18')],'app':_0x24fe('0x15'),'appdata':'CDR(routeid)='+_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x1a')],'context':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x19')],'exten':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0xb')],'priority':_0x2cbb09['priority']++,'VoiceExtensionId':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x1a')]});var _0x2fcb4d=_0x2cbb09['priority']++;_0x2cbb09[_0x24fe('0x1c')]['push']({'type':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x18')],'app':_0x24fe('0x22'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x2fcb4d+0x2)+'):Goto('+(_0x2fcb4d+0x1)+')','context':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x19')],'exten':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0xb')],'priority':_0x2fcb4d,'VoiceExtensionId':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x1a')]});if(_0x2cbb09[_0x24fe('0x12')]){_0x2cbb09[_0x24fe('0x1c')][_0x24fe('0x14')]({'type':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x18')],'app':_0x24fe('0x15'),'appdata':_0x2cbb09['extension']['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x2cbb09[_0x24fe('0x12')][_0x24fe('0x20')]+'}':_0x24fe('0x23'),'context':_0x559c23[_0x4cf3fd][0x0]['context'],'exten':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0xb')],'priority':_0x2cbb09['priority']++,'VoiceExtensionId':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x1a')]});}_0x2cbb09[_0x24fe('0x1c')][_0x24fe('0x14')]({'type':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x18')],'app':_0x24fe('0x15'),'appdata':_0x24fe('0x24')+_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x1a')],'context':_0x559c23[_0x4cf3fd][0x0]['context'],'exten':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0xb')],'priority':_0x2cbb09[_0x24fe('0x11')]++,'VoiceExtensionId':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x1a')]});if(_0x2cbb09[_0x24fe('0x12')]&&_0x2cbb09['extension'][_0x24fe('0x10')](_0x24fe('0x25'))&&_0x2cbb09['extension'][_0x24fe('0x25')]!==_0x24fe('0x26')){_0x2cbb09[_0x24fe('0x1c')][_0x24fe('0x14')]({'type':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x18')],'app':_0x24fe('0x15'),'appdata':_0x24fe('0x27'),'context':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x19')],'exten':_0x559c23[_0x4cf3fd][0x0]['exten'],'priority':_0x2cbb09[_0x24fe('0x11')]++,'VoiceExtensionId':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x1a')]});_0x2cbb09[_0x24fe('0x1c')]['push']({'type':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x18')],'app':_0x24fe('0x15'),'appdata':_0x24fe('0x28')+_0x2cbb09[_0x24fe('0x12')][_0x24fe('0x25')]||_0x24fe('0x29'),'context':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x19')],'exten':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0xb')],'priority':_0x2cbb09[_0x24fe('0x11')]++,'VoiceExtensionId':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x1a')]});}}_0x2cbb09[_0x24fe('0x1c')][_0x24fe('0x14')]({'type':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x18')],'app':_0x24fe('0x15'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x559c23[_0x4cf3fd][0x0]['context'],'exten':_0x559c23[_0x4cf3fd][0x0]['exten'],'priority':_0x2cbb09[_0x24fe('0x11')]++,'VoiceExtensionId':_0x559c23[_0x4cf3fd][0x0]['VoiceExtensionId']});_0x2cbb09['extensions'][_0x24fe('0x14')]({'type':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x18')],'app':_0x24fe('0x15'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x559c23[_0x4cf3fd][0x0]['context'],'exten':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0xb')],'priority':_0x2cbb09['priority']++,'VoiceExtensionId':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x1a')]});_0x2cbb09[_0x24fe('0x1c')][_0x24fe('0x14')]({'type':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x18')],'app':_0x24fe('0x15'),'appdata':_0x24fe('0x2a'),'context':_0x559c23[_0x4cf3fd][0x0]['context'],'exten':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0xb')],'priority':_0x2cbb09[_0x24fe('0x11')]++,'VoiceExtensionId':_0x559c23[_0x4cf3fd][0x0]['VoiceExtensionId']});for(var _0x41e372=0x0,_0x1509bd=0x0;_0x41e372<_0x559c23[_0x4cf3fd][_0x24fe('0x2b')];_0x41e372+=0x1,_0x1509bd=0x0){var _0x18becb=_0x559c23[_0x4cf3fd][_0x41e372];if(_0x18becb[_0x24fe('0x18')]){_0x18becb[_0x24fe('0x18')]=_0x18becb['type'][_0x24fe('0x2c')]();}var _0x4ee12a=[];var _0x2e4256=[];delete _0x18becb['id'];delete _0x18becb[_0x24fe('0x2d')];delete _0x18becb[_0x24fe('0x2e')];var _0x2fbd4e=_0x18becb[_0x24fe('0x2f')]!==_0x24fe('0x30')?[_0x18becb['interval']]:_0x18becb['IntervalId']?_[_0x24fe('0xa')](_[_0x24fe('0xd')](_0x2cbb09[_0x24fe('0x6')],{'IntervalId':_0x18becb['IntervalId']}),_0x24fe('0x2f')):[];if(_0x18becb[_0x24fe('0x10')](_0x24fe('0x31'))){if(_0x18becb[_0x24fe('0x31')]&&_0x18becb['tag']!=='--'){_0x4ee12a[_0x24fe('0x14')]({'type':_0x18becb['type'],'app':'Set','appdata':_0x24fe('0x32')+_0x18becb['tag'],'context':_0x18becb[_0x24fe('0x19')],'exten':_0x18becb[_0x24fe('0xb')],'priority':_0x2fbd4e[_0x24fe('0x2b')]+_0x2cbb09[_0x24fe('0x11')]+_0x1509bd++,'VoiceExtensionId':_0x18becb['VoiceExtensionId']});}}if(_0x18becb[_0x24fe('0x18')]==='outbound'&&_0x18becb[_0x24fe('0x10')]('callerID')){if(_0x18becb[_0x24fe('0x33')]){_0x4ee12a[_0x24fe('0x14')]({'type':_0x18becb[_0x24fe('0x18')],'app':_0x24fe('0x22'),'appdata':_0x24fe('0x34')+_0x18becb[_0x24fe('0x33')]+')','context':_0x18becb['context'],'exten':_0x18becb[_0x24fe('0xb')],'priority':_0x2fbd4e[_0x24fe('0x2b')]+_0x2cbb09['priority']+_0x1509bd++,'VoiceExtensionId':_0x18becb[_0x24fe('0x1a')]});}else{_0x4ee12a['push']({'type':_0x18becb[_0x24fe('0x18')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x18becb[_0x24fe('0x19')],'exten':_0x18becb[_0x24fe('0xb')],'priority':_0x2fbd4e[_0x24fe('0x2b')]+_0x2cbb09[_0x24fe('0x11')]+_0x1509bd++,'VoiceExtensionId':_0x18becb[_0x24fe('0x1a')]});}}if(_0x18becb[_0x24fe('0x10')]('answer')){if(_0x45de78['indexOf'](_0x18becb['app'][_0x24fe('0x2c')]())>=0x0&&_0x18becb[_0x24fe('0x35')]!==_0x24fe('0x36')){if(_0x18becb[_0x24fe('0x37')]){_0x4ee12a[_0x24fe('0x14')]({'type':_0x18becb[_0x24fe('0x18')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x18becb[_0x24fe('0x19')],'exten':_0x18becb[_0x24fe('0xb')],'priority':_0x2fbd4e[_0x24fe('0x2b')]+_0x2cbb09[_0x24fe('0x11')]+_0x1509bd++,'VoiceExtensionId':_0x18becb[_0x24fe('0x1a')]});_0x4ee12a[_0x24fe('0x14')]({'type':_0x18becb[_0x24fe('0x18')],'app':_0x24fe('0x15'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x18becb[_0x24fe('0x19')],'exten':_0x18becb[_0x24fe('0xb')],'priority':_0x2fbd4e[_0x24fe('0x2b')]+_0x2cbb09['priority']+_0x1509bd++,'VoiceExtensionId':_0x18becb[_0x24fe('0x1a')]});}else{_0x4ee12a['push']({'type':_0x18becb['type'],'app':_0x24fe('0x22'),'appdata':_0x24fe('0x38'),'context':_0x18becb['context'],'exten':_0x18becb['exten'],'priority':_0x2fbd4e[_0x24fe('0x2b')]+_0x2cbb09['priority']+_0x1509bd++,'VoiceExtensionId':_0x18becb[_0x24fe('0x1a')]});_0x4ee12a['push']({'type':_0x18becb[_0x24fe('0x18')],'app':_0x24fe('0x15'),'appdata':_0x24fe('0x39'),'context':_0x18becb[_0x24fe('0x19')],'exten':_0x18becb['exten'],'priority':_0x2fbd4e[_0x24fe('0x2b')]+_0x2cbb09[_0x24fe('0x11')]+_0x1509bd++,'VoiceExtensionId':_0x18becb['VoiceExtensionId']});}}}for(var _0x5c1322=0x0;_0x5c1322<_0x2fbd4e[_0x24fe('0x2b')];_0x5c1322+=0x1){var _0xd0ee74=_0x2cbb09[_0x24fe('0x11')]+_0x2fbd4e['length'];var _0x28c52d=_0x5c1322===_0x2fbd4e[_0x24fe('0x2b')]-0x1?_0x2cbb09['priority']+_0x4ee12a[_0x24fe('0x2b')]+_0x2e4256[_0x24fe('0x2b')]+0x2:_0x2cbb09[_0x24fe('0x11')]+_0x5c1322+0x1;_0x4ee12a['splice'](_0x5c1322,0x0,{'type':_0x18becb[_0x24fe('0x18')],'app':'GotoIfTime','appdata':_0x2fbd4e[_0x5c1322]+'?'+_0x18becb[_0x24fe('0x19')]+_0x24fe('0x3a')+_0xd0ee74+':'+_0x18becb[_0x24fe('0x19')]+_0x24fe('0x3a')+_0x28c52d,'exten':_0x18becb['exten'],'context':_0x18becb[_0x24fe('0x19')],'priority':_0x2cbb09[_0x24fe('0x11')]+_0x5c1322,'VoiceExtensionId':_0x559c23[_0x4cf3fd][0x0]['VoiceExtensionId']});}_0x18becb[_0x24fe('0x11')]=_0x4ee12a[_0x24fe('0x2b')]?_[_0x24fe('0x3b')](_0x4ee12a)['priority']+0x1:_0x2cbb09[_0x24fe('0x11')];_0x2cbb09['priority']=(_0x2e4256[_0x24fe('0x2b')]?_[_0x24fe('0x3b')](_0x2e4256)[_0x24fe('0x11')]:_0x18becb[_0x24fe('0x11')])+0x1;_0x2cbb09['extensions']=_[_0x24fe('0x3c')](_0x2cbb09[_0x24fe('0x1c')],_0x4ee12a,[_0x18becb],_0x2e4256);}_0x2cbb09[_0x24fe('0x1c')]['push']({'type':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x18')],'app':_0x24fe('0x3d'),'exten':_0x559c23[_0x4cf3fd][0x0][_0x24fe('0xb')],'context':_0x559c23[_0x4cf3fd][0x0]['context'],'priority':_0x2cbb09['priority'],'VoiceExtensionId':_0x559c23[_0x4cf3fd][0x0]['VoiceExtensionId']});_0x3b0d8e[_0x24fe('0x14')](_0x559c23[_0x4cf3fd][0x0][_0x24fe('0x1a')]);_0x18f506=_['concat'](_0x18f506,_0x2cbb09[_0x24fe('0x1c')]);}}return _0x38aff0[_0x24fe('0x3e')](function(_0x39ee85){return _0x38aff0[_0x24fe('0x2')][_0x24fe('0x7')][_0x24fe('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x3b0d8e}},'transaction':_0x39ee85})['then'](function(_0x5051bb){return _0x38aff0[_0x24fe('0x2')][_0x24fe('0x7')][_0x24fe('0x40')](_[_0x24fe('0x41')](_0x18f506,_0x24fe('0x11')),{'transaction':_0x39ee85});});});})['catch'](function(_0x12b32d){console[_0x24fe('0x42')](_0x12b32d);});}exports[_0x24fe('0x43')]=rewrite; \ No newline at end of file +var _0x939a=['priority','extensions','extension','find','push','type','format','CDR(type)=%s','inbound','Set','CDR(routeid)=','context','cutdigits','${EXTEN:','${EXTEN}','VoiceExtensionId','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','tag','CDR(tag)=','length','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','catch','error','rewrite','lodash','util','models','findAll','intervals','VoiceExtension','IntervalId','then','uniq','map','exten','filter','groupBy','queue','playback','hasOwnProperty'];(function(_0x11f03a,_0x545fa8){var _0x1d92ad=function(_0x39b875){while(--_0x39b875){_0x11f03a['push'](_0x11f03a['shift']());}};_0x1d92ad(++_0x545fa8);}(_0x939a,0x82));var _0xa939=function(_0x4f6df2,_0x13492f){_0x4f6df2=_0x4f6df2-0x0;var _0x492794=_0x939a[_0x4f6df2];return _0x492794;};'use strict';var _=require(_0xa939('0x0'));var util=require(_0xa939('0x1'));function rewrite(_0x3f7fff,_0x4b9dee){var _0x54740c=this;return _0x3f7fff[_0xa939('0x2')]['Interval'][_0xa939('0x3')]({'raw':!![]})['then'](function(_0x463756){_0x54740c[_0xa939('0x4')]=_0x463756;return _0x3f7fff[_0xa939('0x2')][_0xa939('0x5')][_0xa939('0x3')]({'where':{'IntervalId':_0x4b9dee[_0xa939('0x6')]},'raw':!![]});})[_0xa939('0x7')](function(_0x1ea996){return _0x3f7fff[_0xa939('0x2')][_0xa939('0x5')]['findAll']({'where':{'exten':{'$in':_[_0xa939('0x8')](_[_0xa939('0x9')](_0x1ea996,_0xa939('0xa')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xa939('0x7')](function(_0x326c60){var _0x10a6dd=_[_0xa939('0xb')](_0x326c60,{'priority':'1'});var _0x96bc9c=_[_0xa939('0xb')](_0x326c60,{'isApp':0x1});var _0x963e74=_[_0xa939('0xc')](_0x96bc9c,_0xa939('0xa'));var _0x429441=[_0xa939('0xd'),_0xa939('0xe')];var _0x5cb6f2=[];var _0x34eb05=[];for(var _0x2e0575 in _0x963e74){if(_0x963e74[_0xa939('0xf')](_0x2e0575)){_0x54740c[_0xa939('0x10')]=0x2;_0x54740c[_0xa939('0x11')]=[];_0x54740c[_0xa939('0x12')]=_[_0xa939('0x13')](_0x10a6dd,{'exten':_0x963e74[_0x2e0575][0x0]['exten']});_0x54740c[_0xa939('0x11')][_0xa939('0x14')]({'type':_0x963e74[_0x2e0575][0x0][_0xa939('0x15')],'app':'Set','appdata':util[_0xa939('0x16')](_0xa939('0x17'),_0x963e74[_0x2e0575][0x0]['type']),'context':_0x963e74[_0x2e0575][0x0]['context'],'exten':_0x963e74[_0x2e0575][0x0][_0xa939('0xa')],'priority':_0x54740c[_0xa939('0x10')]++,'VoiceExtensionId':_0x963e74[_0x2e0575][0x0]['VoiceExtensionId']});if(_0x963e74[_0x2e0575][0x0][_0xa939('0x15')]===_0xa939('0x18')){_0x54740c[_0xa939('0x11')][_0xa939('0x14')]({'type':_0x963e74[_0x2e0575][0x0][_0xa939('0x15')],'app':_0xa939('0x19'),'appdata':_0xa939('0x1a')+_0x963e74[_0x2e0575][0x0]['VoiceExtensionId'],'context':_0x963e74[_0x2e0575][0x0][_0xa939('0x1b')],'exten':_0x963e74[_0x2e0575][0x0][_0xa939('0xa')],'priority':_0x54740c[_0xa939('0x10')]++,'VoiceExtensionId':_0x963e74[_0x2e0575][0x0]['VoiceExtensionId']});}else if(_0x963e74[_0x2e0575][0x0][_0xa939('0x15')]==='outbound'){if(_0x54740c[_0xa939('0x12')]){_0x54740c[_0xa939('0x11')]['push']({'type':_0x963e74[_0x2e0575][0x0]['type'],'app':_0xa939('0x19'),'appdata':'CDR(destination)='+(_0x54740c[_0xa939('0x12')][_0xa939('0x1c')]?_0xa939('0x1d')+_0x54740c[_0xa939('0x12')]['cutdigits']+'}':_0xa939('0x1e')),'context':_0x963e74[_0x2e0575][0x0]['context'],'exten':_0x963e74[_0x2e0575][0x0][_0xa939('0xa')],'priority':_0x54740c[_0xa939('0x10')]++,'VoiceExtensionId':_0x963e74[_0x2e0575][0x0][_0xa939('0x1f')]});}_0x54740c[_0xa939('0x11')]['push']({'type':_0x963e74[_0x2e0575][0x0][_0xa939('0x15')],'app':_0xa939('0x19'),'appdata':_0xa939('0x1a')+_0x963e74[_0x2e0575][0x0][_0xa939('0x1f')],'context':_0x963e74[_0x2e0575][0x0][_0xa939('0x1b')],'exten':_0x963e74[_0x2e0575][0x0][_0xa939('0xa')],'priority':_0x54740c[_0xa939('0x10')]++,'VoiceExtensionId':_0x963e74[_0x2e0575][0x0][_0xa939('0x1f')]});var _0x1b29a4=_0x54740c[_0xa939('0x10')]++;_0x54740c[_0xa939('0x11')]['push']({'type':_0x963e74[_0x2e0575][0x0][_0xa939('0x15')],'app':_0xa939('0x20'),'appdata':_0xa939('0x21')+(_0x1b29a4+0x2)+_0xa939('0x22')+(_0x1b29a4+0x1)+')','context':_0x963e74[_0x2e0575][0x0]['context'],'exten':_0x963e74[_0x2e0575][0x0][_0xa939('0xa')],'priority':_0x1b29a4,'VoiceExtensionId':_0x963e74[_0x2e0575][0x0][_0xa939('0x1f')]});if(_0x54740c[_0xa939('0x12')]){_0x54740c[_0xa939('0x11')][_0xa939('0x14')]({'type':_0x963e74[_0x2e0575][0x0]['type'],'app':'Set','appdata':_0x54740c[_0xa939('0x12')]['cutdigits']?_0xa939('0x23')+_0x54740c[_0xa939('0x12')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x963e74[_0x2e0575][0x0][_0xa939('0x1b')],'exten':_0x963e74[_0x2e0575][0x0][_0xa939('0xa')],'priority':_0x54740c[_0xa939('0x10')]++,'VoiceExtensionId':_0x963e74[_0x2e0575][0x0][_0xa939('0x1f')]});}_0x54740c['extensions']['push']({'type':_0x963e74[_0x2e0575][0x0]['type'],'app':_0xa939('0x19'),'appdata':_0xa939('0x24')+_0x963e74[_0x2e0575][0x0][_0xa939('0x1f')],'context':_0x963e74[_0x2e0575][0x0][_0xa939('0x1b')],'exten':_0x963e74[_0x2e0575][0x0]['exten'],'priority':_0x54740c[_0xa939('0x10')]++,'VoiceExtensionId':_0x963e74[_0x2e0575][0x0][_0xa939('0x1f')]});if(_0x54740c['extension']&&_0x54740c[_0xa939('0x12')][_0xa939('0xf')](_0xa939('0x25'))&&_0x54740c['extension'][_0xa939('0x25')]!==_0xa939('0x26')){_0x54740c['extensions']['push']({'type':_0x963e74[_0x2e0575][0x0][_0xa939('0x15')],'app':_0xa939('0x19'),'appdata':_0xa939('0x27'),'context':_0x963e74[_0x2e0575][0x0][_0xa939('0x1b')],'exten':_0x963e74[_0x2e0575][0x0][_0xa939('0xa')],'priority':_0x54740c[_0xa939('0x10')]++,'VoiceExtensionId':_0x963e74[_0x2e0575][0x0][_0xa939('0x1f')]});_0x54740c[_0xa939('0x11')]['push']({'type':_0x963e74[_0x2e0575][0x0]['type'],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x54740c[_0xa939('0x12')][_0xa939('0x25')]||'wav','context':_0x963e74[_0x2e0575][0x0]['context'],'exten':_0x963e74[_0x2e0575][0x0][_0xa939('0xa')],'priority':_0x54740c[_0xa939('0x10')]++,'VoiceExtensionId':_0x963e74[_0x2e0575][0x0][_0xa939('0x1f')]});}}_0x54740c[_0xa939('0x11')]['push']({'type':_0x963e74[_0x2e0575][0x0][_0xa939('0x15')],'app':_0xa939('0x19'),'appdata':_0xa939('0x28'),'context':_0x963e74[_0x2e0575][0x0][_0xa939('0x1b')],'exten':_0x963e74[_0x2e0575][0x0][_0xa939('0xa')],'priority':_0x54740c[_0xa939('0x10')]++,'VoiceExtensionId':_0x963e74[_0x2e0575][0x0]['VoiceExtensionId']});_0x54740c['extensions'][_0xa939('0x14')]({'type':_0x963e74[_0x2e0575][0x0]['type'],'app':_0xa939('0x19'),'appdata':_0xa939('0x29'),'context':_0x963e74[_0x2e0575][0x0][_0xa939('0x1b')],'exten':_0x963e74[_0x2e0575][0x0][_0xa939('0xa')],'priority':_0x54740c['priority']++,'VoiceExtensionId':_0x963e74[_0x2e0575][0x0][_0xa939('0x1f')]});_0x54740c['extensions']['push']({'type':_0x963e74[_0x2e0575][0x0][_0xa939('0x15')],'app':_0xa939('0x19'),'appdata':_0xa939('0x2a'),'context':_0x963e74[_0x2e0575][0x0][_0xa939('0x1b')],'exten':_0x963e74[_0x2e0575][0x0][_0xa939('0xa')],'priority':_0x54740c[_0xa939('0x10')]++,'VoiceExtensionId':_0x963e74[_0x2e0575][0x0][_0xa939('0x1f')]});for(var _0x6d9b26=0x0,_0x132790=0x0;_0x6d9b26<_0x963e74[_0x2e0575]['length'];_0x6d9b26+=0x1,_0x132790=0x0){var _0x42c210=_0x963e74[_0x2e0575][_0x6d9b26];if(_0x42c210[_0xa939('0x15')]){_0x42c210[_0xa939('0x15')]=_0x42c210[_0xa939('0x15')][_0xa939('0x2b')]();}var _0x390e18=[];var _0x36c092=[];delete _0x42c210['id'];delete _0x42c210[_0xa939('0x2c')];delete _0x42c210[_0xa939('0x2d')];var _0x281f46=_0x42c210['interval']!=='*,*,*,*'?[_0x42c210[_0xa939('0x2e')]]:_0x42c210[_0xa939('0x6')]?_[_0xa939('0x9')](_[_0xa939('0xb')](_0x54740c[_0xa939('0x4')],{'IntervalId':_0x42c210['IntervalId']}),_0xa939('0x2e')):[];if(_0x42c210['hasOwnProperty'](_0xa939('0x2f'))){if(_0x42c210[_0xa939('0x2f')]&&_0x42c210[_0xa939('0x2f')]!=='--'){_0x390e18['push']({'type':_0x42c210['type'],'app':_0xa939('0x19'),'appdata':_0xa939('0x30')+_0x42c210[_0xa939('0x2f')],'context':_0x42c210[_0xa939('0x1b')],'exten':_0x42c210['exten'],'priority':_0x281f46[_0xa939('0x31')]+_0x54740c['priority']+_0x132790++,'VoiceExtensionId':_0x42c210[_0xa939('0x1f')]});}}if(_0x42c210[_0xa939('0x15')]===_0xa939('0x32')&&_0x42c210[_0xa939('0xf')](_0xa939('0x33'))){if(_0x42c210[_0xa939('0x33')]){_0x390e18[_0xa939('0x14')]({'type':_0x42c210[_0xa939('0x15')],'app':_0xa939('0x20'),'appdata':_0xa939('0x34')+_0x42c210[_0xa939('0x33')]+')','context':_0x42c210[_0xa939('0x1b')],'exten':_0x42c210['exten'],'priority':_0x281f46[_0xa939('0x31')]+_0x54740c[_0xa939('0x10')]+_0x132790++,'VoiceExtensionId':_0x42c210[_0xa939('0x1f')]});}else{_0x390e18[_0xa939('0x14')]({'type':_0x42c210[_0xa939('0x15')],'app':'ExecIf','appdata':_0xa939('0x35'),'context':_0x42c210[_0xa939('0x1b')],'exten':_0x42c210[_0xa939('0xa')],'priority':_0x281f46[_0xa939('0x31')]+_0x54740c['priority']+_0x132790++,'VoiceExtensionId':_0x42c210[_0xa939('0x1f')]});}}if(_0x42c210['hasOwnProperty'](_0xa939('0x36'))){if(_0x429441[_0xa939('0x37')](_0x42c210[_0xa939('0x38')][_0xa939('0x2b')]())>=0x0&&_0x42c210[_0xa939('0x39')]!==_0xa939('0x3a')){if(_0x42c210[_0xa939('0x36')]){_0x390e18['push']({'type':_0x42c210[_0xa939('0x15')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x42c210[_0xa939('0x1b')],'exten':_0x42c210[_0xa939('0xa')],'priority':_0x281f46[_0xa939('0x31')]+_0x54740c[_0xa939('0x10')]+_0x132790++,'VoiceExtensionId':_0x42c210[_0xa939('0x1f')]});_0x390e18[_0xa939('0x14')]({'type':_0x42c210[_0xa939('0x15')],'app':'Set','appdata':_0xa939('0x3b'),'context':_0x42c210['context'],'exten':_0x42c210[_0xa939('0xa')],'priority':_0x281f46[_0xa939('0x31')]+_0x54740c[_0xa939('0x10')]+_0x132790++,'VoiceExtensionId':_0x42c210[_0xa939('0x1f')]});}else{_0x390e18[_0xa939('0x14')]({'type':_0x42c210['type'],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x42c210['context'],'exten':_0x42c210[_0xa939('0xa')],'priority':_0x281f46[_0xa939('0x31')]+_0x54740c['priority']+_0x132790++,'VoiceExtensionId':_0x42c210[_0xa939('0x1f')]});_0x390e18[_0xa939('0x14')]({'type':_0x42c210[_0xa939('0x15')],'app':'Set','appdata':_0xa939('0x3c'),'context':_0x42c210[_0xa939('0x1b')],'exten':_0x42c210[_0xa939('0xa')],'priority':_0x281f46['length']+_0x54740c[_0xa939('0x10')]+_0x132790++,'VoiceExtensionId':_0x42c210[_0xa939('0x1f')]});}}}for(var _0x5b17de=0x0;_0x5b17de<_0x281f46[_0xa939('0x31')];_0x5b17de+=0x1){var _0x1cecdf=_0x54740c[_0xa939('0x10')]+_0x281f46[_0xa939('0x31')];var _0x24f882=_0x5b17de===_0x281f46[_0xa939('0x31')]-0x1?_0x54740c[_0xa939('0x10')]+_0x390e18[_0xa939('0x31')]+_0x36c092['length']+0x2:_0x54740c[_0xa939('0x10')]+_0x5b17de+0x1;_0x390e18[_0xa939('0x3d')](_0x5b17de,0x0,{'type':_0x42c210[_0xa939('0x15')],'app':_0xa939('0x3e'),'appdata':_0x281f46[_0x5b17de]+'?'+_0x42c210[_0xa939('0x1b')]+',${EXTEN},'+_0x1cecdf+':'+_0x42c210[_0xa939('0x1b')]+_0xa939('0x3f')+_0x24f882,'exten':_0x42c210[_0xa939('0xa')],'context':_0x42c210[_0xa939('0x1b')],'priority':_0x54740c[_0xa939('0x10')]+_0x5b17de,'VoiceExtensionId':_0x963e74[_0x2e0575][0x0][_0xa939('0x1f')]});}_0x42c210[_0xa939('0x10')]=_0x390e18[_0xa939('0x31')]?_[_0xa939('0x40')](_0x390e18)[_0xa939('0x10')]+0x1:_0x54740c[_0xa939('0x10')];_0x54740c[_0xa939('0x10')]=(_0x36c092['length']?_[_0xa939('0x40')](_0x36c092)[_0xa939('0x10')]:_0x42c210[_0xa939('0x10')])+0x1;_0x54740c[_0xa939('0x11')]=_[_0xa939('0x41')](_0x54740c[_0xa939('0x11')],_0x390e18,[_0x42c210],_0x36c092);}_0x54740c['extensions'][_0xa939('0x14')]({'type':_0x963e74[_0x2e0575][0x0][_0xa939('0x15')],'app':_0xa939('0x42'),'exten':_0x963e74[_0x2e0575][0x0]['exten'],'context':_0x963e74[_0x2e0575][0x0]['context'],'priority':_0x54740c[_0xa939('0x10')],'VoiceExtensionId':_0x963e74[_0x2e0575][0x0][_0xa939('0x1f')]});_0x5cb6f2[_0xa939('0x14')](_0x963e74[_0x2e0575][0x0][_0xa939('0x1f')]);_0x34eb05=_['concat'](_0x34eb05,_0x54740c['extensions']);}}return _0x3f7fff[_0xa939('0x43')](function(_0x58d9e3){return _0x3f7fff[_0xa939('0x2')][_0xa939('0x5')][_0xa939('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x5cb6f2}},'transaction':_0x58d9e3})[_0xa939('0x7')](function(_0x11d25e){return _0x3f7fff['models'][_0xa939('0x5')]['bulkCreate'](_[_0xa939('0x45')](_0x34eb05,'priority'),{'transaction':_0x58d9e3});});});})[_0xa939('0x46')](function(_0x54741a){console[_0xa939('0x47')](_0x54741a);});}exports[_0xa939('0x48')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 9a03e0d..8f69abe 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 _0xbd17=['../../../config/environment','../../../config/logger','api','redis','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','insert','into','phone','scheduledAt','updatedAt','select','field','ContactId','toString','NOW()','createdAt','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','\x20=\x20?','fromQuery','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','dialCheckDuplicateType','CmList','get','always','sequelize','query','catch','VoiceQueueId','all','outbound','Campaign','Lists','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','resume','emit','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','resolve','CmContact','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','ioredis','../../../mysqldb'];(function(_0x258363,_0x20bb31){var _0x33a199=function(_0x15f586){while(--_0x15f586){_0x258363['push'](_0x258363['shift']());}};_0x33a199(++_0x20bb31);}(_0xbd17,0x66));var _0x7bd1=function(_0x2bdaf6,_0x5a48fe){_0x2bdaf6=_0x2bdaf6-0x0;var _0x33c743=_0xbd17[_0x2bdaf6];return _0x33c743;};'use strict';var BPromise=require(_0x7bd1('0x0'));var util=require(_0x7bd1('0x1'));var _=require(_0x7bd1('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x7bd1('0x3'));var Redis=require(_0x7bd1('0x4'));var db=require(_0x7bd1('0x5'))['db'];var config=require(_0x7bd1('0x6'));var logger=require(_0x7bd1('0x7'))(_0x7bd1('0x8'));config[_0x7bd1('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7bd1('0xa'))(new Redis(config[_0x7bd1('0x9')]));require('../../../api/cmContact/cmContact.socket')[_0x7bd1('0xb')](socket);try{if(!process[_0x7bd1('0xc')][0x2]||process[_0x7bd1('0xc')][0x2]===_0x7bd1('0xd')||process[_0x7bd1('0xc')][0x2]===_0x7bd1('0xe')){throw new Error(_0x7bd1('0xf'));}var FILEPATH=process[_0x7bd1('0xc')][0x2];if(!process[_0x7bd1('0xc')][0x3]||process['argv'][0x3]===_0x7bd1('0xd')||process[_0x7bd1('0xc')][0x3]===_0x7bd1('0xe')||!process[_0x7bd1('0xc')][0x4]||process['argv'][0x4]===_0x7bd1('0xd')||process[_0x7bd1('0xc')][0x4]==='null'){throw new Error(_0x7bd1('0x10'));}var FIELDS=_[_0x7bd1('0x11')](process[_0x7bd1('0xc')][0x3][_0x7bd1('0x12')](','),process[_0x7bd1('0xc')][0x4]['split'](','));if(!process['argv'][0x5]||process[_0x7bd1('0xc')][0x5]==='undefined'||process[_0x7bd1('0xc')][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x7bd1('0xc')][0x6]&&process[_0x7bd1('0xc')][0x6]!==_0x7bd1('0xd')&&process['argv'][0x6]!==_0x7bd1('0xe')?process['argv'][0x6]:null;var DUPLICATES=process[_0x7bd1('0xc')][0x7]&&process[_0x7bd1('0xc')][0x7]!=='undefined'&&process[_0x7bd1('0xc')][0x7]!==_0x7bd1('0xe')?process[_0x7bd1('0xc')][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]===_0x7bd1('0xd')||process[_0x7bd1('0xc')][0x8]===_0x7bd1('0xe')){throw new Error(_0x7bd1('0x13'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x5bb8d3){logger[_0x7bd1('0x14')](_0x5bb8d3);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(_0x2fc465,_0x2c4aa8,_0x591e46,_0x1e5289){var _0x2e3485={'message':_0x2c4aa8};_0x2e3485[_0x2fc465]=!![];if(_0x591e46){_0x2e3485[_0x7bd1('0x15')]=_0x591e46;}if(_0x1e5289){_0x2e3485[_0x7bd1('0x16')]=_0x1e5289;}return _0x2e3485;}function isEmail(_0x5a464a){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))*$/[_0x7bd1('0x17')](_0x5a464a);}function checkRow(_0x361548,_0x3e23e5,_0x58590c){return new BPromise(function(_0x18da79,_0x2ac3e6){if(_[_0x7bd1('0x18')](_0x361548)){return _0x2ac3e6(handleCheckRowError('error',_0x7bd1('0x19'),null,_0x58590c));}if(_0x361548[_0x7bd1('0x1a')]&&_0x361548['errors'][_0x7bd1('0x1b')]){var _0x5ea564=_[_0x7bd1('0x1c')](_0x361548[_0x7bd1('0x1a')],_0x7bd1('0x1d'))[_0x7bd1('0x1e')](';');return _0x2ac3e6(handleCheckRowError('error',_0x5ea564,null,_0x58590c));}var _0x16cbee={};for(var _0x454232 in FIELDS){if(FIELDS['hasOwnProperty'](_0x454232)&&FIELDS[_0x454232]){_0x16cbee[_0x454232]=_0x361548[_0x7bd1('0x1f')][0x0][FIELDS[_0x454232]]||_0x361548[_0x7bd1('0x1f')][0x0]['\ufeff'+FIELDS[_0x454232]];}}if(!_0x16cbee[_0x7bd1('0x20')]){return _0x2ac3e6(handleCheckRowError('error',_0x7bd1('0x21'),null,_0x58590c));}if(!_0x16cbee['phone']){return _0x2ac3e6(handleCheckRowError(_0x7bd1('0x14'),_0x7bd1('0x22'),null,_0x58590c));}if(_0x16cbee[_0x7bd1('0x23')]){var _0x48176d=moment(_0x16cbee[_0x7bd1('0x23')],_0x7bd1('0x24'));if(!_0x48176d['isValid']()){return _0x2ac3e6(handleCheckRowError(_0x7bd1('0x14'),_0x7bd1('0x25'),null,_0x58590c));}}if(_0x16cbee['email']){if(!isEmail(_0x16cbee['email'])){return _0x2ac3e6(handleCheckRowError(_0x7bd1('0x14'),_0x7bd1('0x26'),null,_0x58590c));}}_0x16cbee[_0x7bd1('0x27')]=LISTID;_0x16cbee[_0x7bd1('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7bd1('0x1b')]&&_0x3e23e5){var _0x179df5={};for(var _0x226394=0x0,_0x5572ca=DUPLICATES['length'];_0x226394<_0x5572ca;_0x226394+=0x1){_0x179df5[DUPLICATES[_0x226394]]=_0x16cbee[DUPLICATES[_0x226394]];}var _0x262187=_[_0x7bd1('0x29')](_0x3e23e5,_0x179df5);if(_0x262187){return _0x2ac3e6(handleCheckRowError(_0x7bd1('0x2a'),'Duplicate\x20Contact',_0x262187,_0x58590c));}}return db['CmContact']['create'](_0x16cbee,{'raw':!![],'hooks':![],'fields':_[_0x7bd1('0x2b')](_0x16cbee)})[_0x7bd1('0x2c')](function(_0x21a276){if(DUPLICATES&&DUPLICATES[_0x7bd1('0x1b')]&&_0x3e23e5){_0x3e23e5[_0x7bd1('0x2d')](_[_0x7bd1('0x2e')](_0x16cbee,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x21a276['id'];return _0x18da79();})['catch'](function(_0x4051ea){return _0x2ac3e6(handleCheckRowError(_0x7bd1('0x14'),_0x7bd1('0x2f')+(_0x4051ea[_0x7bd1('0x1d')]||JSON[_0x7bd1('0x30')](_0x4051ea)),null,_0x58590c));});});}function checkHopper(){function _0x2a5da0(){return function(_0x380308){logger['error'](_0x7bd1('0x31'),_0x7bd1('0x32'),util['inspect'](_0x380308,{'showHidden':![],'depth':null}));};}var _0x7e30a0=function(_0x38b6d4,_0x8bf7e6){var _0x1263ae=squel[_0x7bd1('0x33')]()[_0x7bd1('0x34')]('cm_hopper')['fromQuery']([_0x7bd1('0x35'),_0x7bd1('0x36'),'ContactId',_0x7bd1('0x27'),_0x8bf7e6,'createdAt',_0x7bd1('0x37')],squel[_0x7bd1('0x38')]()[_0x7bd1('0x39')](_0x7bd1('0x35'),'phone')['field']('NOW()',_0x7bd1('0x36'))[_0x7bd1('0x39')]('id',_0x7bd1('0x3a'))[_0x7bd1('0x39')](LISTID[_0x7bd1('0x3b')](),'ListId')[_0x7bd1('0x39')](_0x38b6d4['id'][_0x7bd1('0x3b')](),_0x8bf7e6)['field'](_0x7bd1('0x3c'),_0x7bd1('0x3d'))[_0x7bd1('0x39')](_0x7bd1('0x3c'),_0x7bd1('0x37'))[_0x7bd1('0x3e')](_0x7bd1('0x3f'))['where'](_0x7bd1('0x40'))['where'](_0x7bd1('0x41'),LISTID[_0x7bd1('0x3b')]())[_0x7bd1('0x42')](_0x7bd1('0x43'))['where'](_0x7bd1('0x44'),squel[_0x7bd1('0x38')]()['field'](_0x7bd1('0x35'))[_0x7bd1('0x3e')](_0x7bd1('0x45'))['where'](_0x8bf7e6+_0x7bd1('0x46'),_0x38b6d4['id'][_0x7bd1('0x3b')]())))[_0x7bd1('0x3b')]();return _0x1263ae;};var _0x19f0a7=function(_0x8625c1,_0x3283ae){var _0x24916e=squel[_0x7bd1('0x33')]()[_0x7bd1('0x34')](_0x7bd1('0x45'))[_0x7bd1('0x47')]([_0x7bd1('0x35'),'scheduledAt',_0x7bd1('0x3a'),_0x7bd1('0x27'),_0x3283ae,_0x7bd1('0x3d'),_0x7bd1('0x37')],squel[_0x7bd1('0x38')]()['field'](_0x7bd1('0x35'),_0x7bd1('0x35'))['field'](_0x7bd1('0x3c'),_0x7bd1('0x36'))[_0x7bd1('0x39')]('id',_0x7bd1('0x3a'))[_0x7bd1('0x39')](LISTID[_0x7bd1('0x3b')](),_0x7bd1('0x27'))[_0x7bd1('0x39')](_0x8625c1['id'][_0x7bd1('0x3b')](),_0x3283ae)['field'](_0x7bd1('0x3c'),'createdAt')[_0x7bd1('0x39')](_0x7bd1('0x3c'),_0x7bd1('0x37'))['from'](_0x7bd1('0x3f'))[_0x7bd1('0x42')]('deletedAt\x20IS\x20NULL')['where'](_0x7bd1('0x41'),LISTID[_0x7bd1('0x3b')]())['where'](_0x7bd1('0x48'),squel[_0x7bd1('0x49')](hopperContacts))[_0x7bd1('0x42')](_0x7bd1('0x43'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x7bd1('0x38')]()[_0x7bd1('0x39')](_0x7bd1('0x4a'))[_0x7bd1('0x3e')](_0x7bd1('0x4b'))['where'](_0x3283ae+_0x7bd1('0x46'),_0x8625c1['id'][_0x7bd1('0x3b')]()))[_0x7bd1('0x42')](_0x7bd1('0x44'),squel[_0x7bd1('0x38')]()[_0x7bd1('0x39')](_0x7bd1('0x35'))[_0x7bd1('0x3e')](_0x7bd1('0x45'))['where'](_0x3283ae+_0x7bd1('0x46'),_0x8625c1['id']['toString']())))[_0x7bd1('0x3b')]();return _0x24916e;};function _0xe3e7e0(_0x37c6d7,_0x3d7bb5){var _0x2d3030=squel[_0x7bd1('0x33')]()[_0x7bd1('0x34')](_0x7bd1('0x45'))[_0x7bd1('0x47')]([_0x7bd1('0x35'),_0x7bd1('0x36'),_0x7bd1('0x3a'),_0x7bd1('0x27'),_0x3d7bb5,_0x7bd1('0x3d'),_0x7bd1('0x37')],squel[_0x7bd1('0x38')]()[_0x7bd1('0x39')](_0x7bd1('0x35'),_0x7bd1('0x35'))[_0x7bd1('0x39')]('NOW()','scheduledAt')['field']('id',_0x7bd1('0x3a'))['field'](LISTID[_0x7bd1('0x3b')](),'ListId')[_0x7bd1('0x39')](_0x37c6d7['id'][_0x7bd1('0x3b')](),_0x3d7bb5)[_0x7bd1('0x39')](_0x7bd1('0x3c'),_0x7bd1('0x3d'))[_0x7bd1('0x39')](_0x7bd1('0x3c'),'updatedAt')[_0x7bd1('0x3e')]('cm_contacts')[_0x7bd1('0x42')](_0x7bd1('0x40'))[_0x7bd1('0x42')](_0x7bd1('0x41'),LISTID[_0x7bd1('0x3b')]())['where'](_0x7bd1('0x48'),squel[_0x7bd1('0x49')](hopperContacts))[_0x7bd1('0x42')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x2d3030;}function _0x1b60ef(_0x4c215f,_0xf10640){var _0x1f47f2=squel['insert']()[_0x7bd1('0x34')](_0x7bd1('0x4c'))['fromQuery']([_0x7bd1('0x35'),_0x7bd1('0x3a'),_0x7bd1('0x27'),_0xf10640,_0x7bd1('0x3d'),'updatedAt'],squel['select']()[_0x7bd1('0x39')](_0x7bd1('0x35'),_0x7bd1('0x35'))['field']('id',_0x7bd1('0x3a'))[_0x7bd1('0x39')](LISTID[_0x7bd1('0x3b')](),_0x7bd1('0x27'))[_0x7bd1('0x39')](_0x4c215f['id']['toString'](),_0xf10640)[_0x7bd1('0x39')]('NOW()',_0x7bd1('0x3d'))[_0x7bd1('0x39')](_0x7bd1('0x3c'),_0x7bd1('0x37'))[_0x7bd1('0x3e')](_0x7bd1('0x3f'))['where'](_0x7bd1('0x40'))[_0x7bd1('0x42')](_0x7bd1('0x41'),LISTID[_0x7bd1('0x3b')]())[_0x7bd1('0x42')](_0x7bd1('0x48'),squel[_0x7bd1('0x49')](hopperContacts))[_0x7bd1('0x42')](_0x7bd1('0x43')))[_0x7bd1('0x3b')]();return _0x1f47f2;}return db[_0x7bd1('0x4d')][_0x7bd1('0x4e')]({'where':{'type':'outbound'},'attributes':['id',_0x7bd1('0x4f')],'include':[{'model':db[_0x7bd1('0x50')],'as':'Lists','where':{'id':LISTID}}]})[_0x7bd1('0x2c')](function(_0x55c898){var _0x78cdad=[];if(_0x55c898){var _0x383e77;for(var _0xb1d9e8=0x0,_0x222765;_0xb1d9e8<_0x55c898[_0x7bd1('0x1b')];_0xb1d9e8+=0x1){_0x222765=_0x55c898[_0xb1d9e8][_0x7bd1('0x51')]({'plain':!![]});switch(_0x222765['dialCheckDuplicateType']){case _0x7bd1('0x52'):_0x78cdad[_0x7bd1('0x2d')](db[_0x7bd1('0x53')][_0x7bd1('0x54')](_0x19f0a7(_0x222765,'VoiceQueueId'))[_0x7bd1('0x2c')](function(){})[_0x7bd1('0x55')](_0x2a5da0()));break;case'onlyIfOpen':_0x78cdad[_0x7bd1('0x2d')](db[_0x7bd1('0x53')][_0x7bd1('0x54')](_0x7e30a0(_0x222765,'VoiceQueueId'))[_0x7bd1('0x2c')](function(){})['catch'](_0x2a5da0()));break;default:_0x78cdad[_0x7bd1('0x2d')](db['sequelize'][_0x7bd1('0x54')](_0xe3e7e0(_0x222765,_0x7bd1('0x56')))['then'](function(){})[_0x7bd1('0x55')](_0x2a5da0()));}}}return _0x78cdad;})[_0x7bd1('0x57')]()[_0x7bd1('0x2c')](function(){return db[_0x7bd1('0x4d')]['findAll']({'where':{'type':_0x7bd1('0x58')},'attributes':['id'],'include':[{'model':db[_0x7bd1('0x50')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x420e75){var _0x86a89b=[];if(_0x420e75){var _0x1b0719;for(var _0x18c817=0x0,_0x4bc6f0;_0x18c817<_0x420e75[_0x7bd1('0x1b')];_0x18c817+=0x1){_0x4bc6f0=_0x420e75[_0x18c817]['get']({'plain':!![]});_0x86a89b[_0x7bd1('0x2d')](db[_0x7bd1('0x53')][_0x7bd1('0x54')](_0x1b60ef(_0x4bc6f0,_0x7bd1('0x56')))[_0x7bd1('0x2c')](function(){})[_0x7bd1('0x55')](_0x2a5da0()));}}return _0x86a89b;})['all']();})[_0x7bd1('0x2c')](function(){return db[_0x7bd1('0x59')][_0x7bd1('0x4e')]({'attributes':['id',_0x7bd1('0x4f')],'include':[{'model':db[_0x7bd1('0x50')],'as':_0x7bd1('0x5a'),'where':{'id':LISTID}}]})[_0x7bd1('0x2c')](function(_0x5f4071){var _0x53e14a=[];if(_0x5f4071){for(var _0x1a5f65=0x0,_0xbdb0f5;_0x1a5f65<_0x5f4071['length'];_0x1a5f65+=0x1){_0xbdb0f5=_0x5f4071[_0x1a5f65][_0x7bd1('0x51')]({'plain':!![]});switch(_0xbdb0f5[_0x7bd1('0x4f')]){case'always':_0x53e14a['push'](db[_0x7bd1('0x53')][_0x7bd1('0x54')](_0x19f0a7(_0xbdb0f5,_0x7bd1('0x5b')))[_0x7bd1('0x2c')](function(){})[_0x7bd1('0x55')](_0x2a5da0()));break;case'onlyIfOpen':_0x53e14a[_0x7bd1('0x2d')](db[_0x7bd1('0x53')][_0x7bd1('0x54')](_0x7e30a0(_0xbdb0f5,'CampaignId'))[_0x7bd1('0x2c')](function(){})[_0x7bd1('0x55')](_0x2a5da0()));break;default:_0x53e14a[_0x7bd1('0x2d')](db[_0x7bd1('0x53')][_0x7bd1('0x54')](_0xe3e7e0(_0xbdb0f5,'CampaignId'))[_0x7bd1('0x2c')](function(){})[_0x7bd1('0x55')](_0x2a5da0()));}}}return _0x53e14a;})[_0x7bd1('0x57')]();})['then'](function(){return db['Campaign'][_0x7bd1('0x4e')]({'attributes':['id'],'include':[{'model':db[_0x7bd1('0x50')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0xbbc1d8){var _0x3ed0ea=[];if(_0xbbc1d8){for(var _0x3bd4e6=0x0,_0xa5e962;_0x3bd4e6<_0xbbc1d8['length'];_0x3bd4e6+=0x1){_0xa5e962=_0xbbc1d8[_0x3bd4e6]['get']({'plain':!![]});_0x3ed0ea[_0x7bd1('0x2d')](db[_0x7bd1('0x53')][_0x7bd1('0x54')](_0x1b60ef(_0xa5e962,_0x7bd1('0x5b')))['then'](function(){})[_0x7bd1('0x55')](_0x2a5da0()));}}return _0x3ed0ea;})[_0x7bd1('0x57')]();})[_0x7bd1('0x55')](function(_0x7052b6){logger[_0x7bd1('0x14')](_0x7bd1('0x5c'),_0x7bd1('0x5d'),_0x7052b6[_0x7bd1('0x1d')]);});}var processPromises=function(_0x218673){return BPromise[_0x7bd1('0x57')](promises)[_0x7bd1('0x2c')](function(_0x5d3761){})[_0x7bd1('0x55')](function(_0x1fc046){logger['error'](_0x7bd1('0x5e'),JSON[_0x7bd1('0x30')](_0x1fc046));})['finally'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x218673){return _0x218673[_0x7bd1('0x5f')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x7bd1('0x2c')](function(){socket[_0x7bd1('0x60')](_0x7bd1('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7bd1('0x62')](FILEPATH);}catch(_0x494dca){logger['error'](_0x7bd1('0x63'),JSON[_0x7bd1('0x30')](_0x494dca));}finally{process[_0x7bd1('0x64')](0x0);}});};process['on'](_0x7bd1('0x65'),function(){logger[_0x7bd1('0x66')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x7bd1('0x67')]()[_0x7bd1('0x2c')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7bd1('0x12')](',');return db[_0x7bd1('0x68')][_0x7bd1('0x4e')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7bd1('0x2c')](function(_0xd13735){var _0xc4ab90=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0xc4ab90,{'header':!![],'skipEmptyLines':!![],'step':function(_0x31f4c2,_0x1ffec5){total+=0x1;var _0x5d9422=total;promises['push'](checkRow(_0x31f4c2,_0xd13735,_0x5d9422)[_0x7bd1('0x2c')](function(){success+=0x1;})[_0x7bd1('0x55')](function(_0xb2c5e9){if(_0xb2c5e9[_0x7bd1('0x14')]){errors+=0x1;delete _0xb2c5e9[_0x7bd1('0x14')];}else if(_0xb2c5e9[_0x7bd1('0x2a')]){duplicates+=0x1;delete _0xb2c5e9[_0x7bd1('0x2a')];}rows[_0x7bd1('0x2d')](_0xb2c5e9);}));if(total%0xc8===0x0){_0x1ffec5[_0x7bd1('0x69')]();return processPromises(_0x1ffec5);}},'complete':function(){return processPromises()[_0x7bd1('0x2c')](function(){logger[_0x7bd1('0x66')](_0x7bd1('0x6a'));endCsv();});},'error':function(_0x1c6b63,_0x4f0948){logger[_0x7bd1('0x66')]('CSV\x20parse\x20error',JSON[_0x7bd1('0x30')](_0x1c6b63));endCsv();}});})['catch'](function(_0x490e53){logger[_0x7bd1('0x14')](_0x7bd1('0x6b'),JSON['stringify'](_0x490e53));});}main(); \ No newline at end of file +var _0x1026=['duplicate','Duplicate\x20Contact','create','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','into','cm_hopper','fromQuery','ContactId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','\x20=\x20?','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','from','cm_hopper_final','cm_contacts','VoiceQueue','findAll','outbound','CmList','get','dialCheckDuplicateType','always','push','sequelize','query','VoiceQueueId','onlyIfOpen','all','BlackLists','Campaign','Lists','CampaignId','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','parse','pause','CSV\x20parse\x20error','bluebird','lodash','squel','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','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!','ListId','CompanyId','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1026,0x18c));var _0x6102=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x1026[_0xaa0309];return _0x5de7ce;};'use strict';var BPromise=require(_0x6102('0x0'));var util=require('util');var _=require(_0x6102('0x1'));var fs=require('fs');var squel=require(_0x6102('0x2'));var Papa=require('papaparse');var Redis=require('ioredis');var db=require(_0x6102('0x3'))['db'];var config=require(_0x6102('0x4'));var logger=require(_0x6102('0x5'))(_0x6102('0x6'));config[_0x6102('0x7')]=_[_0x6102('0x8')](config['redis'],{'host':_0x6102('0x9'),'port':0x18eb});var socket=require(_0x6102('0xa'))(new Redis(config['redis']));require(_0x6102('0xb'))[_0x6102('0xc')](socket);try{if(!process[_0x6102('0xd')][0x2]||process[_0x6102('0xd')][0x2]==='undefined'||process['argv'][0x2]===_0x6102('0xe')){throw new Error(_0x6102('0xf'));}var FILEPATH=process[_0x6102('0xd')][0x2];if(!process[_0x6102('0xd')][0x3]||process[_0x6102('0xd')][0x3]===_0x6102('0x10')||process['argv'][0x3]===_0x6102('0xe')||!process[_0x6102('0xd')][0x4]||process['argv'][0x4]===_0x6102('0x10')||process[_0x6102('0xd')][0x4]===_0x6102('0xe')){throw new Error(_0x6102('0x11'));}var FIELDS=_[_0x6102('0x12')](process['argv'][0x3][_0x6102('0x13')](','),process[_0x6102('0xd')][0x4][_0x6102('0x13')](','));if(!process[_0x6102('0xd')][0x5]||process[_0x6102('0xd')][0x5]===_0x6102('0x10')||process[_0x6102('0xd')][0x5]===_0x6102('0xe')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x6102('0xd')][0x5];var COMPANYID=process[_0x6102('0xd')][0x6]&&process[_0x6102('0xd')][0x6]!==_0x6102('0x10')&&process[_0x6102('0xd')][0x6]!==_0x6102('0xe')?process[_0x6102('0xd')][0x6]:null;var DUPLICATES=process[_0x6102('0xd')][0x7]&&process['argv'][0x7]!==_0x6102('0x10')&&process[_0x6102('0xd')][0x7]!==_0x6102('0xe')?process[_0x6102('0xd')][0x7]:null;if(!process[_0x6102('0xd')][0x8]||process[_0x6102('0xd')][0x8]==='undefined'||process[_0x6102('0xd')][0x8]===_0x6102('0xe')){throw new Error(_0x6102('0x14'));}var SOCKET_TIMESTAMP=process[_0x6102('0xd')][0x8];}catch(_0x57aea1){logger['error'](_0x57aea1);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(_0x1809ab,_0x4e0b8,_0x4f39a3,_0x222e9c){var _0x1954f0={'message':_0x4e0b8};_0x1954f0[_0x1809ab]=!![];if(_0x4f39a3){_0x1954f0[_0x6102('0x15')]=_0x4f39a3;}if(_0x222e9c){_0x1954f0[_0x6102('0x16')]=_0x222e9c;}return _0x1954f0;}function isEmail(_0x7fdcdd){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))*$/[_0x6102('0x17')](_0x7fdcdd);}function checkRow(_0xc9cfb1,_0x4d005f,_0x41505c){return new BPromise(function(_0x2573c3,_0x4226d5){if(_['isNil'](_0xc9cfb1)){return _0x4226d5(handleCheckRowError(_0x6102('0x18'),_0x6102('0x19'),null,_0x41505c));}if(_0xc9cfb1[_0x6102('0x1a')]&&_0xc9cfb1[_0x6102('0x1a')][_0x6102('0x1b')]){var _0xca35f1=_[_0x6102('0x1c')](_0xc9cfb1[_0x6102('0x1a')],_0x6102('0x1d'))[_0x6102('0x1e')](';');return _0x4226d5(handleCheckRowError('error',_0xca35f1,null,_0x41505c));}var _0x1826de={};for(var _0x52f307 in FIELDS){if(FIELDS['hasOwnProperty'](_0x52f307)&&FIELDS[_0x52f307]){_0x1826de[_0x52f307]=_0xc9cfb1[_0x6102('0x1f')][0x0][FIELDS[_0x52f307]]||_0xc9cfb1[_0x6102('0x1f')][0x0]['\ufeff'+FIELDS[_0x52f307]];}}if(!_0x1826de[_0x6102('0x20')]){return _0x4226d5(handleCheckRowError(_0x6102('0x18'),_0x6102('0x21'),null,_0x41505c));}if(!_0x1826de[_0x6102('0x22')]){return _0x4226d5(handleCheckRowError(_0x6102('0x18'),_0x6102('0x23'),null,_0x41505c));}if(_0x1826de[_0x6102('0x24')]){var _0x1de2e1=moment(_0x1826de[_0x6102('0x24')],_0x6102('0x25'));if(!_0x1de2e1[_0x6102('0x26')]()){return _0x4226d5(handleCheckRowError(_0x6102('0x18'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x41505c));}}if(_0x1826de[_0x6102('0x27')]){if(!isEmail(_0x1826de[_0x6102('0x27')])){return _0x4226d5(handleCheckRowError('error',_0x6102('0x28'),null,_0x41505c));}}_0x1826de[_0x6102('0x29')]=LISTID;_0x1826de[_0x6102('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x6102('0x1b')]&&_0x4d005f){var _0x17ef4b={};for(var _0x5ea233=0x0,_0x2f2d12=DUPLICATES[_0x6102('0x1b')];_0x5ea233<_0x2f2d12;_0x5ea233+=0x1){_0x17ef4b[DUPLICATES[_0x5ea233]]=_0x1826de[DUPLICATES[_0x5ea233]];}var _0x3b0cc3=_[_0x6102('0x2b')](_0x4d005f,_0x17ef4b);if(_0x3b0cc3){return _0x4226d5(handleCheckRowError(_0x6102('0x2c'),_0x6102('0x2d'),_0x3b0cc3,_0x41505c));}}return db['CmContact'][_0x6102('0x2e')](_0x1826de,{'raw':!![],'hooks':![],'fields':_[_0x6102('0x2f')](_0x1826de)})[_0x6102('0x30')](function(_0x1c37b7){if(DUPLICATES&&DUPLICATES['length']&&_0x4d005f){_0x4d005f['push'](_[_0x6102('0x31')](_0x1826de,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1c37b7['id'];return _0x2573c3();})[_0x6102('0x32')](function(_0x562e09){return _0x4226d5(handleCheckRowError('error',_0x6102('0x33')+(_0x562e09[_0x6102('0x1d')]||JSON[_0x6102('0x34')](_0x562e09)),null,_0x41505c));});});}function checkHopper(){function _0x1ebd1e(){return function(_0x3c01ff){logger[_0x6102('0x18')]('cmContact',_0x6102('0x35'),util[_0x6102('0x36')](_0x3c01ff,{'showHidden':![],'depth':null}));};}var _0x3bb54f=function(_0x388d1b,_0x40e7b9){var _0x1cb351=squel[_0x6102('0x37')]()[_0x6102('0x38')](_0x6102('0x39'))[_0x6102('0x3a')]([_0x6102('0x22'),'scheduledAt',_0x6102('0x3b'),_0x6102('0x29'),_0x40e7b9,_0x6102('0x3c'),_0x6102('0x3d')],squel[_0x6102('0x3e')]()[_0x6102('0x3f')](_0x6102('0x22'),_0x6102('0x22'))[_0x6102('0x3f')](_0x6102('0x40'),_0x6102('0x41'))[_0x6102('0x3f')]('id','ContactId')[_0x6102('0x3f')](LISTID[_0x6102('0x42')](),_0x6102('0x29'))[_0x6102('0x3f')](_0x388d1b['id'][_0x6102('0x42')](),_0x40e7b9)[_0x6102('0x3f')](_0x6102('0x40'),_0x6102('0x3c'))[_0x6102('0x3f')]('NOW()',_0x6102('0x3d'))['from']('cm_contacts')[_0x6102('0x43')](_0x6102('0x44'))[_0x6102('0x43')](_0x6102('0x45'),LISTID[_0x6102('0x42')]())['where'](_0x6102('0x46'))[_0x6102('0x43')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x6102('0x3f')](_0x6102('0x22'))['from'](_0x6102('0x39'))[_0x6102('0x43')](_0x40e7b9+_0x6102('0x47'),_0x388d1b['id'][_0x6102('0x42')]())))[_0x6102('0x42')]();return _0x1cb351;};var _0x169666=function(_0x118d44,_0x1b4210){var _0x1e0428=squel[_0x6102('0x37')]()['into'](_0x6102('0x39'))[_0x6102('0x3a')]([_0x6102('0x22'),'scheduledAt',_0x6102('0x3b'),_0x6102('0x29'),_0x1b4210,_0x6102('0x3c'),_0x6102('0x3d')],squel['select']()[_0x6102('0x3f')]('phone',_0x6102('0x22'))[_0x6102('0x3f')](_0x6102('0x40'),_0x6102('0x41'))[_0x6102('0x3f')]('id',_0x6102('0x3b'))[_0x6102('0x3f')](LISTID[_0x6102('0x42')](),_0x6102('0x29'))['field'](_0x118d44['id'][_0x6102('0x42')](),_0x1b4210)['field'](_0x6102('0x40'),'createdAt')[_0x6102('0x3f')](_0x6102('0x40'),_0x6102('0x3d'))['from']('cm_contacts')[_0x6102('0x43')](_0x6102('0x44'))[_0x6102('0x43')](_0x6102('0x45'),LISTID[_0x6102('0x42')]())[_0x6102('0x43')](_0x6102('0x48'),squel[_0x6102('0x49')](hopperContacts))['where'](_0x6102('0x46'))['where'](_0x6102('0x4a'),squel[_0x6102('0x3e')]()[_0x6102('0x3f')]('calleridnum')[_0x6102('0x4b')](_0x6102('0x4c'))[_0x6102('0x43')](_0x1b4210+_0x6102('0x47'),_0x118d44['id'][_0x6102('0x42')]()))[_0x6102('0x43')](_0x6102('0x4a'),squel[_0x6102('0x3e')]()['field'](_0x6102('0x22'))[_0x6102('0x4b')](_0x6102('0x39'))[_0x6102('0x43')](_0x1b4210+_0x6102('0x47'),_0x118d44['id'][_0x6102('0x42')]())))[_0x6102('0x42')]();return _0x1e0428;};function _0x3d6271(_0x5295ac,_0x9a95b){var _0x2c3bbc=squel[_0x6102('0x37')]()[_0x6102('0x38')](_0x6102('0x39'))[_0x6102('0x3a')]([_0x6102('0x22'),'scheduledAt','ContactId','ListId',_0x9a95b,'createdAt',_0x6102('0x3d')],squel[_0x6102('0x3e')]()['field'](_0x6102('0x22'),_0x6102('0x22'))[_0x6102('0x3f')](_0x6102('0x40'),_0x6102('0x41'))[_0x6102('0x3f')]('id',_0x6102('0x3b'))[_0x6102('0x3f')](LISTID[_0x6102('0x42')](),'ListId')[_0x6102('0x3f')](_0x5295ac['id'][_0x6102('0x42')](),_0x9a95b)[_0x6102('0x3f')](_0x6102('0x40'),'createdAt')[_0x6102('0x3f')](_0x6102('0x40'),_0x6102('0x3d'))[_0x6102('0x4b')](_0x6102('0x4d'))[_0x6102('0x43')](_0x6102('0x44'))[_0x6102('0x43')](_0x6102('0x45'),LISTID['toString']())[_0x6102('0x43')](_0x6102('0x48'),squel['str'](hopperContacts))[_0x6102('0x43')](_0x6102('0x46')))[_0x6102('0x42')]();return _0x2c3bbc;}function _0x1585d3(_0x17e73e,_0xa4bb46){var _0x40374e=squel[_0x6102('0x37')]()[_0x6102('0x38')]('cm_hopper_black')[_0x6102('0x3a')]([_0x6102('0x22'),_0x6102('0x3b'),_0x6102('0x29'),_0xa4bb46,_0x6102('0x3c'),_0x6102('0x3d')],squel[_0x6102('0x3e')]()[_0x6102('0x3f')](_0x6102('0x22'),_0x6102('0x22'))[_0x6102('0x3f')]('id',_0x6102('0x3b'))[_0x6102('0x3f')](LISTID[_0x6102('0x42')](),'ListId')[_0x6102('0x3f')](_0x17e73e['id'][_0x6102('0x42')](),_0xa4bb46)[_0x6102('0x3f')](_0x6102('0x40'),'createdAt')[_0x6102('0x3f')]('NOW()','updatedAt')['from'](_0x6102('0x4d'))[_0x6102('0x43')](_0x6102('0x44'))[_0x6102('0x43')](_0x6102('0x45'),LISTID['toString']())[_0x6102('0x43')](_0x6102('0x48'),squel['str'](hopperContacts))[_0x6102('0x43')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x40374e;}return db[_0x6102('0x4e')][_0x6102('0x4f')]({'where':{'type':_0x6102('0x50')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x6102('0x51')],'as':'Lists','where':{'id':LISTID}}]})[_0x6102('0x30')](function(_0x46e52c){var _0x45fddf=[];if(_0x46e52c){var _0x53cf32;for(var _0x47a506=0x0,_0x1e5de5;_0x47a506<_0x46e52c[_0x6102('0x1b')];_0x47a506+=0x1){_0x1e5de5=_0x46e52c[_0x47a506][_0x6102('0x52')]({'plain':!![]});switch(_0x1e5de5[_0x6102('0x53')]){case _0x6102('0x54'):_0x45fddf[_0x6102('0x55')](db[_0x6102('0x56')][_0x6102('0x57')](_0x169666(_0x1e5de5,_0x6102('0x58')))[_0x6102('0x30')](function(){})[_0x6102('0x32')](_0x1ebd1e()));break;case _0x6102('0x59'):_0x45fddf[_0x6102('0x55')](db['sequelize'][_0x6102('0x57')](_0x3bb54f(_0x1e5de5,_0x6102('0x58')))[_0x6102('0x30')](function(){})[_0x6102('0x32')](_0x1ebd1e()));break;default:_0x45fddf[_0x6102('0x55')](db[_0x6102('0x56')][_0x6102('0x57')](_0x3d6271(_0x1e5de5,_0x6102('0x58')))[_0x6102('0x30')](function(){})['catch'](_0x1ebd1e()));}}}return _0x45fddf;})[_0x6102('0x5a')]()[_0x6102('0x30')](function(){return db['VoiceQueue'][_0x6102('0x4f')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x6102('0x51')],'as':_0x6102('0x5b'),'where':{'id':LISTID}}]})[_0x6102('0x30')](function(_0xfc07a5){var _0x525bd5=[];if(_0xfc07a5){var _0x80058a;for(var _0x21d105=0x0,_0x3e1976;_0x21d105<_0xfc07a5['length'];_0x21d105+=0x1){_0x3e1976=_0xfc07a5[_0x21d105][_0x6102('0x52')]({'plain':!![]});_0x525bd5[_0x6102('0x55')](db[_0x6102('0x56')][_0x6102('0x57')](_0x1585d3(_0x3e1976,'VoiceQueueId'))['then'](function(){})[_0x6102('0x32')](_0x1ebd1e()));}}return _0x525bd5;})[_0x6102('0x5a')]();})[_0x6102('0x30')](function(){return db[_0x6102('0x5c')][_0x6102('0x4f')]({'attributes':['id',_0x6102('0x53')],'include':[{'model':db[_0x6102('0x51')],'as':_0x6102('0x5d'),'where':{'id':LISTID}}]})[_0x6102('0x30')](function(_0x2e6b13){var _0x5bf6a7=[];if(_0x2e6b13){for(var _0x250ff1=0x0,_0x421507;_0x250ff1<_0x2e6b13[_0x6102('0x1b')];_0x250ff1+=0x1){_0x421507=_0x2e6b13[_0x250ff1][_0x6102('0x52')]({'plain':!![]});switch(_0x421507['dialCheckDuplicateType']){case _0x6102('0x54'):_0x5bf6a7[_0x6102('0x55')](db[_0x6102('0x56')][_0x6102('0x57')](_0x169666(_0x421507,_0x6102('0x5e')))[_0x6102('0x30')](function(){})[_0x6102('0x32')](_0x1ebd1e()));break;case _0x6102('0x59'):_0x5bf6a7[_0x6102('0x55')](db['sequelize'][_0x6102('0x57')](_0x3bb54f(_0x421507,_0x6102('0x5e')))[_0x6102('0x30')](function(){})['catch'](_0x1ebd1e()));break;default:_0x5bf6a7['push'](db[_0x6102('0x56')][_0x6102('0x57')](_0x3d6271(_0x421507,_0x6102('0x5e')))[_0x6102('0x30')](function(){})[_0x6102('0x32')](_0x1ebd1e()));}}}return _0x5bf6a7;})['all']();})[_0x6102('0x30')](function(){return db['Campaign'][_0x6102('0x4f')]({'attributes':['id'],'include':[{'model':db[_0x6102('0x51')],'as':_0x6102('0x5b'),'where':{'id':LISTID}}]})[_0x6102('0x30')](function(_0x14baea){var _0x19e4ef=[];if(_0x14baea){for(var _0x4b7927=0x0,_0x4d405e;_0x4b7927<_0x14baea[_0x6102('0x1b')];_0x4b7927+=0x1){_0x4d405e=_0x14baea[_0x4b7927][_0x6102('0x52')]({'plain':!![]});_0x19e4ef[_0x6102('0x55')](db[_0x6102('0x56')][_0x6102('0x57')](_0x1585d3(_0x4d405e,_0x6102('0x5e')))[_0x6102('0x30')](function(){})['catch'](_0x1ebd1e()));}}return _0x19e4ef;})[_0x6102('0x5a')]();})['catch'](function(_0x4c0595){logger[_0x6102('0x18')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x4c0595[_0x6102('0x1d')]);});}var processPromises=function(_0x5ce234){return BPromise[_0x6102('0x5a')](promises)['then'](function(_0x514163){})[_0x6102('0x32')](function(_0x13deba){logger['error'](_0x6102('0x5f'),JSON[_0x6102('0x34')](_0x13deba));})[_0x6102('0x60')](function(){socket[_0x6102('0x61')](_0x6102('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5ce234){return _0x5ce234[_0x6102('0x63')]();}});};var endCsv=function(){return BPromise[_0x6102('0x64')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x6102('0x30')](function(){socket[_0x6102('0x61')](_0x6102('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x509b4c){logger[_0x6102('0x18')](_0x6102('0x65'),JSON[_0x6102('0x34')](_0x509b4c));}finally{process[_0x6102('0x66')](0x0);}});};process['on'](_0x6102('0x67'),function(){logger[_0x6102('0x68')](_0x6102('0x69'));endCsv();});function main(){return BPromise[_0x6102('0x64')]()[_0x6102('0x30')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x6102('0x13')](',');return db[_0x6102('0x6a')][_0x6102('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x6102('0x30')](function(_0x26f593){var _0x99e4b6=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x6102('0x6b')](_0x99e4b6,{'header':!![],'skipEmptyLines':!![],'step':function(_0x529cbf,_0xaeb632){total+=0x1;var _0x1417e4=total;promises[_0x6102('0x55')](checkRow(_0x529cbf,_0x26f593,_0x1417e4)[_0x6102('0x30')](function(){success+=0x1;})[_0x6102('0x32')](function(_0x21459c){if(_0x21459c[_0x6102('0x18')]){errors+=0x1;delete _0x21459c[_0x6102('0x18')];}else if(_0x21459c['duplicate']){duplicates+=0x1;delete _0x21459c[_0x6102('0x2c')];}rows[_0x6102('0x55')](_0x21459c);}));if(total%0xc8===0x0){_0xaeb632[_0x6102('0x6c')]();return processPromises(_0xaeb632);}},'complete':function(){return processPromises()[_0x6102('0x30')](function(){logger[_0x6102('0x68')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x39ee8e,_0x4c386e){logger[_0x6102('0x68')](_0x6102('0x6d'),JSON[_0x6102('0x34')](_0x39ee8e));endCsv();}});})[_0x6102('0x32')](function(_0x591800){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x6102('0x34')](_0x591800));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index e421336..82c024e 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 _0xf78f=['\x22onlyIfOpen\x22','into','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','info','Received\x20SIGINT','error','message','exit','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','utcOffset','set','offset','send','binding','clone','root','server/files/tmp','.csv','includes','ContactItemType','findAll','name','_description','writeFileSync','parse','createReadStream','data','rows','errors','find','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email\x20wrong\x20format','YYYY-MM-DD','firstName','\x20not\x20specified','hasOwnProperty','description','replace','SystemRow','appendFileSync','contact:import:','Abort\x20parser','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','contactId','contactTypeId','orderBy','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns','CampaignId','campaigns_has_cm_blacklists','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','moment','squel','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','where','CmContact','AdditionalPhones','then','length','all','isNil','split','filter','push','CmContactHasItem','findOne','update','create','PHONE','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','phone','scheduledat','ContactId','ListId','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_hopper_black','fromQuery','createdAt','ListId\x20=\x20?','\x20=\x20','toString','date_add(cm_contacts.scheduledat,interval\x20'];(function(_0x30a97e,_0x550a6f){var _0x2d808f=function(_0x4319da){while(--_0x4319da){_0x30a97e['push'](_0x30a97e['shift']());}};_0x2d808f(++_0x550a6f);}(_0xf78f,0x72));var _0xff78=function(_0x35862d,_0x5cdb07){_0x35862d=_0x35862d-0x0;var _0x58601c=_0xf78f[_0x35862d];return _0x58601c;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xff78('0x0'));var Papa=require(_0xff78('0x1'));var util=require(_0xff78('0x2'));var BPromise=require(_0xff78('0x3'));var moment=require(_0xff78('0x4'));var squel=require(_0xff78('0x5'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var shared=require('../../../config/environment/shared');var logger=require('../../../config/logger')(_0xff78('0x6'));config['redis']=_[_0xff78('0x7')](config[_0xff78('0x8')],{'host':_0xff78('0x9'),'port':0x18eb});var socket=require(_0xff78('0xa'))(new Redis(config[_0xff78('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xff78('0xb')](_0xff78('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xff78('0xb')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x4eaba5){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))*$/[_0xff78('0xd')](_0x4eaba5);}function selectNotIn(_0xa55092,_0x1ea7d4,_0x35e6d3,_0x36fe52,_0x2e22e3){return squel[_0xff78('0xe')]()[_0xff78('0xf')]('phone')[_0xff78('0x10')](_0x36fe52)[_0xff78('0x11')](_0x1ea7d4,null,_0x1ea7d4+'.id\x20=\x20'+_0x36fe52+'.'+_0x35e6d3)[_0xff78('0x12')](_0x36fe52+'.'+_0x35e6d3+'\x20=\x20'+_0xa55092+'.'+_0x35e6d3)[_0xff78('0x12')](_0x1ea7d4+'.dialCheckDuplicateType\x20IN\x20('+_0x2e22e3[_0xff78('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x27c281,_0x205176){promisesAdditionalPhones=[];return db[_0xff78('0x13')]['findAll']({'raw':!![],'attributes':['id',_0xff78('0x14')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xff78('0x15')](function(_0x21b5ef){if(_0x21b5ef!==null){var _0x2b47c8=[];for(var _0x3691a2=0x0;_0x3691a2<_0x21b5ef[_0xff78('0x16')];_0x3691a2++){var _0x10e41f=_0x21b5ef[_0x3691a2];_0x2b47c8['push'](insertAdditionalPhones(_0x10e41f));}}Promise[_0xff78('0x17')](_0x2b47c8)[_0xff78('0x15')](function(){_0x27c281({'val':0x1});});});});}function insertAdditionalPhones(_0x2eda17){return new Promise(function(_0x201af4,_0x38aa08){var _0x41a06e=_0x2eda17[_0xff78('0x14')];var _0xf0c91b=_0x41a06e['split'](';');var _0x279494=[];orderBy=0x0;for(var _0x126f6c=0x0;_0x126f6c<_0xf0c91b[_0xff78('0x16')];_0x126f6c++){_0x279494['push'](splitAdditionalPhone(_0x2eda17['id'],_0xf0c91b[_0x126f6c]));}Promise[_0xff78('0x17')](_0x279494)['then'](function(){_0x201af4({'val':_0xf0c91b[_0xff78('0x16')]});});});}function splitAdditionalPhone(_0x40836e,_0x350c50){return new Promise(function(_0xe2be6e,_0xe22c7e){var _0x4ebf5e=_0x350c50['split'](':');var _0x2e5bfa=_0x4ebf5e[0x0];var _0x9f79f=_0x4ebf5e[0x1];if(!_[_0xff78('0x18')](_0x9f79f)){var _0x600dbe=_0x9f79f[_0xff78('0x19')]('|');var _0x2161b6=[];for(var _0x2e4b93=0x0;_0x2e4b93<_0x600dbe[_0xff78('0x16')];_0x2e4b93++){if(_0x600dbe[_0x2e4b93]!==''){var _0x51722f=_[_0xff78('0x1a')](promisesAdditionalPhones,{'contactId':_0x40836e,'phone':_0x600dbe[_0x2e4b93]});if(_0x51722f[_0xff78('0x16')]==0x0){orderBy++;promisesAdditionalPhones[_0xff78('0x1b')]({'contactId':_0x40836e,'contactTypeId':_0x2e5bfa,'phone':_0x600dbe[_0x2e4b93],'orderBy':orderBy});}}}_0xe2be6e({'ok':0x1});}else _0xe2be6e({'res':0x0});});}function createAdditionalPhone(_0x6cff13,_0x5591fa,_0x2e4176,_0xb77e22){var _0x246991='';var _0x1b04fd='';var _0x1c5da9=_0x2e4176['split']('§');_0x246991=_0x1c5da9[0x0];if(_0x1c5da9[_0xff78('0x16')]==0x2)_0x1b04fd=_0x1c5da9[0x1];return new Promise(function(_0x185107,_0xb2015b){return db[_0xff78('0x1c')][_0xff78('0x1d')]({'where':{'CmContactId':_0x6cff13,'item':_0x246991}})[_0xff78('0x15')](function(_0x3500cc){if(_0x3500cc){return db[_0xff78('0x1c')][_0xff78('0x1e')]({'ItemTypeId':_0x5591fa,'description':_0x1b04fd,'OrderBy':_0xb77e22},{'where':{'CmContactId':_0x6cff13,'item':_0x246991}})[_0xff78('0x15')](function(_0x12324e){_0x185107({'res':'updated'});});}else{return db[_0xff78('0x1c')][_0xff78('0x1f')]({'CmContactId':_0x6cff13,'item':_0x246991,'description':_0x1b04fd,'ItemTypeId':_0x5591fa,'OrderBy':_0xb77e22,'ItemClass':_0xff78('0x20')})[_0xff78('0x15')](function(_0x598095){_0x185107({'res':_0xff78('0x21')});});}});});}function insertCmHopper(_0x5911a7,_0x383d71,_0x24ede2,_0x44387b,_0x4c75a3){var _0x15c652=[_0xff78('0x22'),'cm_contacts.scheduledat',_0xff78('0x23'),_0xff78('0x24'),_0x383d71+'.'+_0x44387b,_0xff78('0x25'),_0xff78('0x26'),_0xff78('0x27'),_0xff78('0x28'),'\x22'+_0x4c75a3+'\x22'];return squel[_0xff78('0x29')]()['into'](_0xff78('0x2a'))['fromQuery']([_0xff78('0x2b'),_0xff78('0x2c'),_0xff78('0x2d'),_0xff78('0x2e'),_0x44387b,'createdAt',_0xff78('0x2f'),_0xff78('0x30'),_0xff78('0x31'),_0xff78('0x32')],squel[_0xff78('0xe')]()[_0xff78('0x33')](_0x15c652)[_0xff78('0x10')](_0x383d71)[_0xff78('0x11')](_0xff78('0x34'),null,_0xff78('0x35')+_0x383d71+_0xff78('0x36'))['join'](_0x24ede2,null,_0x24ede2+_0xff78('0x37')+_0x383d71+'.'+_0x44387b)[_0xff78('0x12')](_0x383d71+_0xff78('0x38'),_0x5911a7)[_0xff78('0x12')](_0xff78('0x39'),NOW)[_0xff78('0x12')](_0xff78('0x3a'),selectNotIn(_0x383d71,_0x24ede2,_0x44387b,_0xff78('0x2a'),[_0xff78('0x3b'),'\x22onlyIfOpen\x22']))['where'](_0xff78('0x3a'),selectNotIn(_0x383d71,_0x24ede2,_0x44387b,_0xff78('0x2a'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x526246,_0xbd3c14,_0x4ebf6a,_0x456c68){var _0x2afd94=[_0xff78('0x22'),_0xff78('0x23'),_0xff78('0x24'),_0xbd3c14+'.'+_0x456c68,'cm_contacts.createdAt',_0xff78('0x26')];return squel[_0xff78('0x29')]()['into'](_0xff78('0x3c'))[_0xff78('0x3d')]([_0xff78('0x2b'),'ContactId',_0xff78('0x2e'),_0x456c68,_0xff78('0x3e'),_0xff78('0x2f')],squel['select']()[_0xff78('0x33')](_0x2afd94)[_0xff78('0x10')](_0xbd3c14)[_0xff78('0x11')](_0xff78('0x34'),null,_0xff78('0x35')+_0xbd3c14+_0xff78('0x36'))[_0xff78('0x11')](_0x4ebf6a,null,_0x4ebf6a+_0xff78('0x37')+_0xbd3c14+'.'+_0x456c68)[_0xff78('0x12')](_0xbd3c14+_0xff78('0x38'),_0x526246)[_0xff78('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xff78('0x3a'),squel['select']()[_0xff78('0xf')](_0xff78('0x2b'))[_0xff78('0x10')](_0xff78('0x3c'))[_0xff78('0x12')](_0xff78('0x3f'),_0x526246)[_0xff78('0x12')](_0x456c68+_0xff78('0x40')+_0xbd3c14+'.'+_0x456c68)))[_0xff78('0x41')]();}function insertTzCmHopper(_0x376caa,_0x18bf5f,_0x22c0c6,_0x3389de,_0x504617,_0x45b8b6){var _0x2d0e83=[_0xff78('0x22'),_0xff78('0x42')+_0x45b8b6+'.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.id','cm_contacts.ListId',_0x18bf5f+'.'+_0x3389de,_0xff78('0x25'),_0xff78('0x26'),_0xff78('0x27'),_0xff78('0x28'),'\x22'+_0x504617+'\x22'];var _0x48a900=squel[_0xff78('0x29')]()['into'](_0xff78('0x2a'))[_0xff78('0x3d')]([_0xff78('0x2b'),_0xff78('0x2c'),_0xff78('0x2d'),_0xff78('0x2e'),_0x3389de,_0xff78('0x3e'),'updatedAt','priority',_0xff78('0x31'),_0xff78('0x32')],squel['select']()[_0xff78('0x33')](_0x2d0e83)['from'](_0x18bf5f)[_0xff78('0x11')](_0xff78('0x34'),null,_0xff78('0x35')+_0x18bf5f+_0xff78('0x36'))[_0xff78('0x11')](_0x22c0c6,null,_0x22c0c6+_0xff78('0x37')+_0x18bf5f+'.'+_0x3389de)[_0xff78('0x11')](_0x45b8b6,null,_0x45b8b6+_0xff78('0x37')+_0x18bf5f+'.'+_0x3389de)[_0xff78('0x12')](_0x18bf5f+_0xff78('0x38'),_0x376caa)[_0xff78('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xff78('0x12')](_0xff78('0x3a'),selectNotIn(_0x18bf5f,_0x22c0c6,_0x3389de,_0xff78('0x2a'),[_0xff78('0x3b'),_0xff78('0x43')]))[_0xff78('0x12')](_0xff78('0x3a'),selectNotIn(_0x18bf5f,_0x22c0c6,_0x3389de,_0xff78('0x2a'),[_0xff78('0x3b')])))['toString']();return _0x48a900;}function insertTzCmHopperBlack(_0x5e7519,_0x5048e6,_0x1df0da,_0x3de038){var _0x3ad425=[_0xff78('0x22'),_0xff78('0x23'),_0xff78('0x24'),_0x5048e6+'.'+_0x3de038,_0xff78('0x25'),_0xff78('0x26')];return squel[_0xff78('0x29')]()[_0xff78('0x44')](_0xff78('0x3c'))['fromQuery']([_0xff78('0x2b'),_0xff78('0x2d'),_0xff78('0x2e'),_0x3de038,_0xff78('0x3e'),'updatedAt'],squel[_0xff78('0xe')]()[_0xff78('0x33')](_0x3ad425)[_0xff78('0x10')](_0x5048e6)[_0xff78('0x11')](_0xff78('0x34'),null,_0xff78('0x35')+_0x5048e6+'.CmListId')[_0xff78('0x11')](_0x1df0da,null,_0x1df0da+_0xff78('0x37')+_0x5048e6+'.'+_0x3de038)[_0xff78('0x12')](_0x5048e6+'.CmListId\x20=\x20?',_0x5e7519)[_0xff78('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xff78('0x12')](_0xff78('0x3a'),squel[_0xff78('0xe')]()[_0xff78('0xf')](_0xff78('0x2b'))[_0xff78('0x10')](_0xff78('0x3c'))[_0xff78('0x12')]('ListId\x20=\x20?',_0x5e7519)[_0xff78('0x12')](_0x3de038+'\x20=\x20'+_0x5048e6+'.'+_0x3de038)))[_0xff78('0x41')]();}function insertCmHopperAdditionalPhones(_0x1f9d8f){var _0x13c87f=[_0xff78('0x45'),_0xff78('0x46'),_0xff78('0x47'),_0xff78('0x48'),_0xff78('0x49')];return squel[_0xff78('0x29')]()[_0xff78('0x44')](_0xff78('0x4a'))[_0xff78('0x3d')](['CmHopperId',_0xff78('0x2b'),_0xff78('0x4b'),_0xff78('0x3e'),_0xff78('0x2f')],squel[_0xff78('0xe')]()[_0xff78('0x33')](_0x13c87f)[_0xff78('0x10')](_0xff78('0x2a'))[_0xff78('0x11')]('cm_contacts',null,_0xff78('0x4c'))['join'](_0xff78('0x4d'),null,_0xff78('0x4e'))[_0xff78('0x12')]('cm_hopper.ListId\x20=\x20?',_0x1f9d8f)[_0xff78('0x12')](_0xff78('0x39'),NOW))[_0xff78('0x41')]();}function insertCmContact(_0x461b67,_0x28a913,_0x2d80d5,_0x561c44){var _0x23f8e4=_[_0xff78('0x4f')](_[_0xff78('0x50')](_0x561c44),[_0xff78('0x2e'),_0xff78('0x51'),_0xff78('0x3e'),_0xff78('0x2f')]);return squel[_0xff78('0x29')]()[_0xff78('0x44')](_0xff78('0x34'))[_0xff78('0x3d')](_0x23f8e4,squel[_0xff78('0xe')]()[_0xff78('0x33')](_0x23f8e4)[_0xff78('0x10')](_0x28a913)[_0xff78('0x12')]('('+_0x2d80d5[_0xff78('0x11')](',')+_0xff78('0x52'),squel[_0xff78('0xe')]()[_0xff78('0x33')](_0x2d80d5)[_0xff78('0x10')](_0xff78('0x34'))[_0xff78('0x12')](_0xff78('0x3f'),_0x461b67)['where'](_0xff78('0x53')))[_0xff78('0x12')]('id\x20IN\x20?',squel[_0xff78('0xe')]()[_0xff78('0xf')](_0xff78('0x54'),_0xff78('0x55'))[_0xff78('0x10')](_0x28a913)['group'](_0x2d80d5['join'](','))))[_0xff78('0x41')]();}function handleStop(){logger[_0xff78('0x56')](_0xff78('0x57'));stopped=!![];}function handleUncaughtException(_0x480400){logger[_0xff78('0x58')](_0x480400[_0xff78('0x59')]);process[_0xff78('0x5a')](0x1);}function handleError(_0x18b31a,_0x203e0b){stats['errors'][_0xff78('0x1b')]({'name':_0x203e0b['code'],'message':_0x203e0b[_0xff78('0x59')],'row':_0x18b31a});}function handleQuery(_0x362e7c){logger[_0xff78('0x56')](_0x362e7c);return db[_0xff78('0x5b')][_0xff78('0x5c')](_0x362e7c)[_0xff78('0x5d')](function(_0x5372ff){results[_0xff78('0x1b')](_0x5372ff);})[_0xff78('0x5e')](function(_0xcbcd7d){logger[_0xff78('0x58')](_0xcbcd7d[_0xff78('0x59')]);});}function updateTzCampaigns(_0x336ef6){return new Promise(function(_0x59fc2e,_0x568b12){var _0x40a9e8=squel[_0xff78('0xe')]()['fields']([_0xff78('0x5f'),_0xff78('0x60')])[_0xff78('0x10')]('campaigns')['join'](_0xff78('0x61'),null,_0xff78('0x62'))[_0xff78('0x12')](_0xff78('0x63')+_0x336ef6);db[_0xff78('0x5b')][_0xff78('0x5c')](_0x40a9e8['toString']())[_0xff78('0x5d')](function(_0xfc6c08){var _0x206c8f=[];for(var _0x30c55e=0x0;_0x30c55e<_0xfc6c08[_0xff78('0x16')];_0x30c55e++){_0x206c8f[_0xff78('0x1b')](getTimezoneData(_0xfc6c08[_0x30c55e],tmp_campaigns));}BPromise[_0xff78('0x17')](_0x206c8f)[_0xff78('0x15')](function(){_0x59fc2e({'val':0x1});});})[_0xff78('0x5e')](function(_0x7f2492){logger[_0xff78('0x58')](_0x7f2492[_0xff78('0x59')]);_0x59fc2e({'val':0x0});});});}function updateTzVoiceQueues(_0x2fa1df){return new Promise(function(_0x34faf8,_0x5eec9c){var _0x219e60=squel[_0xff78('0xe')]()[_0xff78('0x33')]([_0xff78('0x64'),'voice_queues.dialTimezone'])[_0xff78('0x10')]('voice_queues')[_0xff78('0x11')](_0xff78('0x65'),null,_0xff78('0x66'))['where']('voice_queues_has_cm_lists.CmListId='+_0x2fa1df);db[_0xff78('0x5b')][_0xff78('0x5c')](_0x219e60[_0xff78('0x41')]())['spread'](function(_0x2c3bc7){var _0x2be94c=[];for(var _0x370ef5=0x0;_0x370ef5<_0x2c3bc7['length'];_0x370ef5++){_0x2be94c[_0xff78('0x1b')](getTimezoneData(_0x2c3bc7[_0x370ef5],tmp_voice_queues));}BPromise[_0xff78('0x17')](_0x2be94c)[_0xff78('0x15')](function(){_0x34faf8({'val':0x1});});})[_0xff78('0x5e')](function(_0x2eea49){logger[_0xff78('0x58')](_0x2eea49[_0xff78('0x59')]);_0x34faf8({'val':0x0});});});}function getTimezoneData(_0x54dbf0,_0xabaa11){return new Promise(function(_0x50041a,_0x20e4f1){var _0x203025=shared[_0xff78('0x67')];var _0x70d309=_0x203025[_0x54dbf0[_0xff78('0x68')]];if(_[_0xff78('0x18')](_0x70d309)){_0x50041a({'ret':0x1});}else{var _0x586cdb=_0x70d309[_0xff78('0x69')];var _0x5b3d25=squel['insert']()[_0xff78('0x44')](_0xabaa11)[_0xff78('0x6a')]('id',_0x54dbf0['id'])[_0xff78('0x6a')](_0xff78('0x6b'),_0x586cdb)[_0xff78('0x6a')]('dialTimezone',_0x54dbf0[_0xff78('0x68')])[_0xff78('0x41')]();return db[_0xff78('0x5b')]['query'](_0x5b3d25)[_0xff78('0x5d')](function(_0x5638e5){_0x50041a({'ret':0x1});})['catch'](function(_0x28bab3){logger['error'](_0x28bab3[_0xff78('0x59')]);_0x20e4f1({'ret':0x1});});}});}function handleTZQuery(_0x54e030){logger[_0xff78('0x56')](_0x54e030);return db['sequelize'][_0xff78('0x5c')](_0x54e030)[_0xff78('0x5d')](function(_0xb3bb58){})[_0xff78('0x5e')](function(_0x27e134){logger[_0xff78('0x58')](_0x27e134[_0xff78('0x59')]);});}function main(_0x2c5eb8,_0x22ca1c,_0x13e8ce,_0x243ac3){logger[_0xff78('0x56')]('main',_0x2c5eb8,JSON['stringify'](_0x22ca1c));process[_0xff78('0x6c')]('start');var _0x5e7c3a=_0x22ca1c[_0xff78('0x6d')];var _0x51ff58=_[_0xff78('0x6e')](_0x5e7c3a);var _0x2a4ffd=_0x22ca1c['socket_timestamp'];var _0x597f49=path['join'](config[_0xff78('0x6f')],_0xff78('0x70'),_0x2a4ffd+_0xff78('0x71'));hasTZ=_[_0xff78('0x50')](_0x5e7c3a)[_0xff78('0x72')](_0xff78('0x68'));var _0x4e1715=_['keys'](_0x5e7c3a)['join']();logger[_0xff78('0x56')]('header',_0x4e1715);db[_0xff78('0x73')][_0xff78('0x74')]({'raw':!![],'attributes':['id',_0xff78('0x75')]})[_0xff78('0x15')](function(_0x75b222){for(var _0x553c31=0x0;_0x553c31<_0x75b222[_0xff78('0x16')];_0x553c31++){if(_0x75b222[_0x553c31][_0xff78('0x75')]in _0x5e7c3a){contactItemTypes[_0xff78('0x1b')](_0x75b222[_0x553c31]);delete _0x51ff58[_0x75b222[_0x553c31][_0xff78('0x75')]];hasAdditionalPhones=!![];}for(var _0x56f031 in _0x5e7c3a){if(_0x75b222[_0x553c31][_0xff78('0x75')]+_0xff78('0x76')===_0x56f031){phoneDescriptions['push']({'itemTypeId':_0x75b222[_0x553c31]['id'],'description':_0x56f031});delete _0x51ff58[_0x56f031];}}}if(hasAdditionalPhones)_0x51ff58[_0xff78('0x14')]='';var _0x4ddd2b=_[_0xff78('0x50')](_0x51ff58)[_0xff78('0x11')]();logger[_0xff78('0x56')]('header',_0x4ddd2b);fs[_0xff78('0x77')](_0x597f49,_0x4ddd2b+'\x0a');Papa[_0xff78('0x78')](fs[_0xff78('0x79')](_0x2c5eb8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3bb53a,_0x207b5d){try{for(var _0x43df57=0x0,_0x244d44=[];_0x43df57<_0x3bb53a[_0xff78('0x7a')][_0xff78('0x16')];_0x43df57++){stats[_0xff78('0x7b')]+=0x1;if(_0x3bb53a['errors'][_0x43df57]){handleError(_0x3bb53a['data'][_0x43df57],_0x3bb53a[_0xff78('0x7c')][_0x43df57]);}else{var _0xf902b=[];var _0x1ee885=[];var _0x9772e7={};for(var _0x2b34bd in _0x5e7c3a){let _0x2de37b=contactItemTypes[_0xff78('0x7d')](_0x47ffd8=>_0x47ffd8[_0xff78('0x75')]===_0x2b34bd);let _0x3cec3b=contactItemTypes[_0xff78('0x7d')](_0x42eedd=>_0x42eedd[_0xff78('0x75')]+_0xff78('0x76')===_0x2b34bd);if(_[_0xff78('0x18')](_0x2de37b)&&_[_0xff78('0x18')](_0x3cec3b)){if(_0x5e7c3a['hasOwnProperty'](_0x2b34bd)){if(_0x3bb53a['data'][_0x43df57][_0x5e7c3a[_0x2b34bd]]){var _0x32e64e=_[_0xff78('0x7e')](_0x3bb53a[_0xff78('0x7a')][_0x43df57][_0x5e7c3a[_0x2b34bd]]['replace'](/"/g,'\x27'));switch(_0x2b34bd){case _0xff78('0x2c'):var _0x380202=moment(_0x32e64e,_0xff78('0xc'),!![]);if(_0x380202[_0xff78('0x7f')]()){_0x244d44[_0xff78('0x1b')]('\x22'+_0x32e64e+'\x22');}else{_0xf902b['push'](_0xff78('0x80'));}break;case _0xff78('0x30'):var _0x109724=parseInt(_0x32e64e);_0x32e64e=_[_0xff78('0x81')](_0x109724)||_0x109724<0x0||_0x109724>0x4?_0x243ac3?0x3:0x2:_0x109724;_0x244d44[_0xff78('0x1b')]('\x22'+_0x32e64e+'\x22');break;case'UserId':var _0x37dab0=parseInt(_0x32e64e);if(_[_0xff78('0x82')](_0x37dab0)&&_[_0xff78('0x72')](_0x13e8ce,_0x37dab0)){_0x244d44[_0xff78('0x1b')]('\x22'+_0x37dab0+'\x22');}else{_0xf902b[_0xff78('0x1b')](_0xff78('0x83'));}break;case'email':if(isEmail(_0x32e64e)){_0x244d44[_0xff78('0x1b')]('\x22'+_0x32e64e+'\x22');}else{_0xf902b[_0xff78('0x1b')](_0xff78('0x84'));}break;case'dateOfBirth':var _0x570c6b=moment(_0x32e64e,_0xff78('0x85'),!![]);if(_0x570c6b['isValid']()){_0x244d44['push']('\x22'+_0x32e64e+'\x22');}else{_0xf902b[_0xff78('0x1b')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0xff78('0x68'):var _0x2293b1=shared[_0xff78('0x67')];var _0x39b191=_0x2293b1[_0x32e64e];if(!_[_0xff78('0x18')](_0x39b191)){var _0x540544=_0x39b191[_0xff78('0x69')];_0x244d44[_0xff78('0x1b')]('\x22'+_0x32e64e+'\x22');_0x244d44[_0xff78('0x1b')]('\x22'+_0x540544+'\x22');}break;default:_0x244d44[_0xff78('0x1b')]('\x22'+_0x32e64e+'\x22');}}else{switch(_0x2b34bd){case _0xff78('0x86'):case'phone':_0xf902b[_0xff78('0x1b')](_0x2b34bd+_0xff78('0x87'));break;default:_0x244d44['push']('\x22\x22');}}}}else{var _0x37ad4c='';if(!_['isNil'](_0x2de37b)){if(!_0x9772e7[_0xff78('0x88')](_0x2de37b['id'])){if(!_[_0xff78('0x18')](_0x3bb53a[_0xff78('0x7a')][_0x43df57][_0x5e7c3a[_0x2b34bd]])){var _0x32e64e=_['trim'](_0x3bb53a['data'][_0x43df57][_0x5e7c3a[_0x2b34bd]]['replace'](/"/g,'\x27'));var _0x21aeda=phoneDescriptions['find'](_0x27dbf5=>_0x27dbf5['itemTypeId']===_0x2de37b['id']);if(!_[_0xff78('0x18')](_0x21aeda)){var _0x5affba=_[_0xff78('0x7e')](_0x3bb53a[_0xff78('0x7a')][_0x43df57][_0x5e7c3a[_0x21aeda[_0xff78('0x89')]]][_0xff78('0x8a')](/"/g,'\x27'));if(!_[_0xff78('0x18')](_0x5affba))_0x32e64e=_0x32e64e+'§'+_0x5affba;}if(_0x37ad4c=='')_0x37ad4c=_0x32e64e;else _0x37ad4c+='|'+_0x32e64e;}_0x1ee885[_0xff78('0x1b')](_0x2de37b['id']+':'+_0x37ad4c);_0x9772e7[_0x2de37b['id']]=0x1;}}}}if(hasAdditionalPhones){_0x244d44[_0xff78('0x1b')]('\x22'+_0x1ee885[_0xff78('0x11')](';')+'\x22');}if(_0xf902b['length']){handleError(_0x3bb53a[_0xff78('0x7a')][_0x43df57],{'code':_0xff78('0x8b'),'message':_0xf902b[_0xff78('0x11')]()});}else{fs[_0xff78('0x8c')](_0x597f49,_0x244d44[_0xff78('0x11')]()+'\x0a');}_0x244d44=[];}if(!(stats[_0xff78('0x7b')]%0xc8)){socket['emit'](_0xff78('0x8d')+_0x2a4ffd,stats);stats[_0xff78('0x7c')]=[];}}if(stopped){logger[_0xff78('0x56')](_0xff78('0x8e'));_0x207b5d['abort']();}}catch(_0x4fd993){handleError(_0x3bb53a[_0xff78('0x7a')][_0x43df57],{'code':'SystemError','message':_0x4fd993['message']});logger[_0xff78('0x58')](_0xff78('0x8f'),_0x4fd993[_0xff78('0x59')]);}},'complete':function(){try{var _0x30b07d=[];var _0x3a1830=[];var _0x2fec58=_0xff78('0x34');if(_0x22ca1c[_0xff78('0x90')]&&_0x22ca1c[_0xff78('0x90')][_0xff78('0x16')]){_0x2fec58=_0xff78('0x91')+_0x2a4ffd;_0x30b07d[_0xff78('0x1b')](_0xff78('0x92')+_0x2fec58+_0xff78('0x93'));}tmp_campaigns=_0xff78('0x94')+_0x2a4ffd;tmp_voice_queues='voice_queues_'+_0x2a4ffd;_0x3a1830[_0xff78('0x1b')](_0xff78('0x92')+tmp_campaigns+_0xff78('0x95'));_0x3a1830[_0xff78('0x1b')](_0xff78('0x92')+tmp_voice_queues+_0xff78('0x95'));BPromise[_0xff78('0x96')](_0x3a1830,handleTZQuery)['then'](function(_0xc464a){updateTzCampaigns(_0x22ca1c[_0xff78('0x2e')])[_0xff78('0x15')](function(_0x8e90fa){updateTzVoiceQueues(_0x22ca1c[_0xff78('0x2e')])[_0xff78('0x15')](function(_0x2707cd){if(hasTZ)_0x4ddd2b=_0x4ddd2b[_0xff78('0x8a')](_0xff78('0x68'),'dialTimezone,utcOffset');var _0x35d466=util[_0xff78('0xb')](_0xff78('0x97'),_0x597f49,_0x2fec58,_0x4ddd2b,_0x22ca1c[_0xff78('0x2e')],_0x22ca1c[_0xff78('0x51')]||null,NOW,NOW);if(_[_0xff78('0x18')](_0x5e7c3a['scheduledat'])){_0x35d466+=_0xff78('0x98');}_0x30b07d[_0xff78('0x1b')](_0x35d466);if(_0x22ca1c[_0xff78('0x90')]&&_0x22ca1c[_0xff78('0x90')][_0xff78('0x16')]){_0x30b07d[_0xff78('0x1b')](insertCmContact(_0x22ca1c['ListId'],_0x2fec58,_0x22ca1c[_0xff78('0x90')],_0x5e7c3a));_0x30b07d[_0xff78('0x1b')]('DROP\x20TABLE\x20'+_0x2fec58+';');}BPromise['each'](_0x30b07d,handleQuery)[_0xff78('0x15')](function(_0x4c81ab){BPromise['all']([handleAdditionalPhones()])[_0xff78('0x15')](function(){_0x30b07d=[];for(var _0x26d4a3=0x0;_0x26d4a3\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','defaults','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','test','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','filter','CmContactHasItem','findOne','update','updated','PHONE','inserted','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','into','cm_hopper','scheduledat','ListId','createdAt','updatedAt','priority','UserId','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','toString','cm_contacts.phone','insert','fromQuery','ContactId','cm_hopper_black','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.priority','\x22always\x22','field','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','group','info','Received\x20SIGINT','error','exit','errors','code','message','sequelize','query','spread'];(function(_0x310eb9,_0x1aed15){var _0x28915c=function(_0x457fd6){while(--_0x457fd6){_0x310eb9['push'](_0x310eb9['shift']());}};_0x28915c(++_0x1aed15);}(_0x4dbc,0x1df));var _0xc4db=function(_0x342e17,_0x5c8041){_0x342e17=_0x342e17-0x0;var _0x235049=_0x4dbc[_0x342e17];return _0x235049;};'use strict';var fs=require('fs');var path=require(_0xc4db('0x0'));var _=require(_0xc4db('0x1'));var Papa=require(_0xc4db('0x2'));var util=require(_0xc4db('0x3'));var BPromise=require(_0xc4db('0x4'));var moment=require(_0xc4db('0x5'));var squel=require('squel');var Redis=require(_0xc4db('0x6'));var db=require(_0xc4db('0x7'))['db'];var config=require('../../../config/environment');var shared=require(_0xc4db('0x8'));var logger=require(_0xc4db('0x9'))('import');config['redis']=_[_0xc4db('0xa')](config[_0xc4db('0xb')],{'host':_0xc4db('0xc'),'port':0x18eb});var socket=require(_0xc4db('0xd'))(new Redis(config[_0xc4db('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0xc4db('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xc4db('0xf')](_0xc4db('0xe'));function isEmail(_0x157721){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))*$/[_0xc4db('0x10')](_0x157721);}function selectNotIn(_0x3204c9,_0x471324,_0x494b7b,_0xc305af,_0x54965e){return squel['select']()['field'](_0xc4db('0x11'))[_0xc4db('0x12')](_0xc305af)[_0xc4db('0x13')](_0x471324,null,_0x471324+_0xc4db('0x14')+_0xc305af+'.'+_0x494b7b)[_0xc4db('0x15')](_0xc305af+'.'+_0x494b7b+_0xc4db('0x16')+_0x3204c9+'.'+_0x494b7b)['where'](_0x471324+_0xc4db('0x17')+_0x54965e[_0xc4db('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1ea304,_0xde47bd){promisesAdditionalPhones=[];return db[_0xc4db('0x18')][_0xc4db('0x19')]({'raw':!![],'attributes':['id',_0xc4db('0x1a')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xc4db('0x1b')](function(_0x2c2b00){if(_0x2c2b00!==null){var _0x100b83=[];for(var _0x30c603=0x0;_0x30c603<_0x2c2b00[_0xc4db('0x1c')];_0x30c603++){var _0x16b34e=_0x2c2b00[_0x30c603];_0x100b83[_0xc4db('0x1d')](insertAdditionalPhones(_0x16b34e));}}Promise[_0xc4db('0x1e')](_0x100b83)[_0xc4db('0x1b')](function(){_0x1ea304({'val':0x1});});});});}function insertAdditionalPhones(_0x13a73b){return new Promise(function(_0x18d1dd,_0x298275){var _0x1359be=_0x13a73b['AdditionalPhones'];var _0x5b4e2f=_0x1359be[_0xc4db('0x1f')](';');var _0x5bc0c1=[];orderBy=0x0;for(var _0x4ec974=0x0;_0x4ec974<_0x5b4e2f[_0xc4db('0x1c')];_0x4ec974++){_0x5bc0c1[_0xc4db('0x1d')](splitAdditionalPhone(_0x13a73b['id'],_0x5b4e2f[_0x4ec974]));}Promise[_0xc4db('0x1e')](_0x5bc0c1)[_0xc4db('0x1b')](function(){_0x18d1dd({'val':_0x5b4e2f[_0xc4db('0x1c')]});});});}function splitAdditionalPhone(_0x156ca8,_0x4cbdfe){return new Promise(function(_0x3a8655,_0x3fd934){var _0x12f5d3=_0x4cbdfe['split'](':');var _0x8be150=_0x12f5d3[0x0];var _0x31b887=_0x12f5d3[0x1];if(!_[_0xc4db('0x20')](_0x31b887)){var _0x1eafae=_0x31b887[_0xc4db('0x1f')]('|');var _0x437d35=[];for(var _0x14bf3e=0x0;_0x14bf3e<_0x1eafae['length'];_0x14bf3e++){if(_0x1eafae[_0x14bf3e]!==''){var _0x1fa0a8=_[_0xc4db('0x21')](promisesAdditionalPhones,{'contactId':_0x156ca8,'phone':_0x1eafae[_0x14bf3e]});if(_0x1fa0a8[_0xc4db('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0xc4db('0x1d')]({'contactId':_0x156ca8,'contactTypeId':_0x8be150,'phone':_0x1eafae[_0x14bf3e],'orderBy':orderBy});}}}_0x3a8655({'ok':0x1});}else _0x3a8655({'res':0x0});});}function createAdditionalPhone(_0x287453,_0x14f235,_0xc34471,_0x2b619e){var _0x3f2650='';var _0x340ba0='';var _0x4e334e=_0xc34471['split']('§');_0x3f2650=_0x4e334e[0x0];if(_0x4e334e['length']==0x2)_0x340ba0=_0x4e334e[0x1];return new Promise(function(_0x2face0,_0x332807){return db[_0xc4db('0x22')][_0xc4db('0x23')]({'where':{'CmContactId':_0x287453,'item':_0x3f2650}})['then'](function(_0x5a7bd0){if(_0x5a7bd0){return db[_0xc4db('0x22')][_0xc4db('0x24')]({'ItemTypeId':_0x14f235,'description':_0x340ba0,'OrderBy':_0x2b619e},{'where':{'CmContactId':_0x287453,'item':_0x3f2650}})[_0xc4db('0x1b')](function(_0x208b60){_0x2face0({'res':_0xc4db('0x25')});});}else{return db[_0xc4db('0x22')]['create']({'CmContactId':_0x287453,'item':_0x3f2650,'description':_0x340ba0,'ItemTypeId':_0x14f235,'OrderBy':_0x2b619e,'ItemClass':_0xc4db('0x26')})['then'](function(_0x237caf){_0x2face0({'res':_0xc4db('0x27')});});}});});}function insertCmHopper(_0x59f86a,_0x5d415c,_0x4de955,_0x12c9a9,_0x4904a2){var _0x1bc752=['cm_contacts.phone',_0xc4db('0x28'),_0xc4db('0x29'),_0xc4db('0x2a'),_0x5d415c+'.'+_0x12c9a9,_0xc4db('0x2b'),_0xc4db('0x2c'),'cm_contacts.priority',_0xc4db('0x2d'),'\x22'+_0x4904a2+'\x22'];return squel['insert']()[_0xc4db('0x2e')](_0xc4db('0x2f'))['fromQuery']([_0xc4db('0x11'),_0xc4db('0x30'),'ContactId',_0xc4db('0x31'),_0x12c9a9,_0xc4db('0x32'),_0xc4db('0x33'),_0xc4db('0x34'),_0xc4db('0x35'),_0xc4db('0x36')],squel[_0xc4db('0x37')]()[_0xc4db('0x38')](_0x1bc752)[_0xc4db('0x12')](_0x5d415c)[_0xc4db('0x13')](_0xc4db('0x39'),null,_0xc4db('0x3a')+_0x5d415c+_0xc4db('0x3b'))[_0xc4db('0x13')](_0x4de955,null,_0x4de955+_0xc4db('0x14')+_0x5d415c+'.'+_0x12c9a9)[_0xc4db('0x15')](_0x5d415c+_0xc4db('0x3c'),_0x59f86a)[_0xc4db('0x15')](_0xc4db('0x3d'),NOW)[_0xc4db('0x15')](_0xc4db('0x3e'),selectNotIn(_0x5d415c,_0x4de955,_0x12c9a9,_0xc4db('0x2f'),['\x22always\x22',_0xc4db('0x3f')]))[_0xc4db('0x15')](_0xc4db('0x3e'),selectNotIn(_0x5d415c,_0x4de955,_0x12c9a9,_0xc4db('0x2f'),['\x22always\x22'])))[_0xc4db('0x40')]();}function insertCmHopperBlack(_0xfb9b06,_0x504d2a,_0x49e5b2,_0x5316c1){var _0x529322=[_0xc4db('0x41'),_0xc4db('0x29'),_0xc4db('0x2a'),_0x504d2a+'.'+_0x5316c1,'cm_contacts.createdAt',_0xc4db('0x2c')];return squel[_0xc4db('0x42')]()[_0xc4db('0x2e')]('cm_hopper_black')[_0xc4db('0x43')]([_0xc4db('0x11'),_0xc4db('0x44'),'ListId',_0x5316c1,'createdAt',_0xc4db('0x33')],squel[_0xc4db('0x37')]()['fields'](_0x529322)[_0xc4db('0x12')](_0x504d2a)[_0xc4db('0x13')](_0xc4db('0x39'),null,_0xc4db('0x3a')+_0x504d2a+'.CmListId')[_0xc4db('0x13')](_0x49e5b2,null,_0x49e5b2+_0xc4db('0x14')+_0x504d2a+'.'+_0x5316c1)[_0xc4db('0x15')](_0x504d2a+_0xc4db('0x3c'),_0xfb9b06)[_0xc4db('0x15')](_0xc4db('0x3d'),NOW)[_0xc4db('0x15')](_0xc4db('0x3e'),squel['select']()['field']('phone')['from'](_0xc4db('0x45'))[_0xc4db('0x15')](_0xc4db('0x46'),_0xfb9b06)['where'](_0x5316c1+_0xc4db('0x16')+_0x504d2a+'.'+_0x5316c1)))[_0xc4db('0x40')]();}function insertTzCmHopper(_0x28351f,_0x24f938,_0x4a81c8,_0x266046,_0x1c9861,_0x4bc620){var _0x3207d2=[_0xc4db('0x41'),_0xc4db('0x47')+_0x4bc620+_0xc4db('0x48'),_0xc4db('0x29'),_0xc4db('0x2a'),_0x24f938+'.'+_0x266046,_0xc4db('0x2b'),_0xc4db('0x2c'),_0xc4db('0x49'),_0xc4db('0x2d'),'\x22'+_0x1c9861+'\x22'];var _0x45f12d=squel[_0xc4db('0x42')]()[_0xc4db('0x2e')](_0xc4db('0x2f'))[_0xc4db('0x43')]([_0xc4db('0x11'),_0xc4db('0x30'),_0xc4db('0x44'),_0xc4db('0x31'),_0x266046,_0xc4db('0x32'),_0xc4db('0x33'),_0xc4db('0x34'),_0xc4db('0x35'),_0xc4db('0x36')],squel['select']()['fields'](_0x3207d2)['from'](_0x24f938)[_0xc4db('0x13')](_0xc4db('0x39'),null,_0xc4db('0x3a')+_0x24f938+'.CmListId')[_0xc4db('0x13')](_0x4a81c8,null,_0x4a81c8+_0xc4db('0x14')+_0x24f938+'.'+_0x266046)['join'](_0x4bc620,null,_0x4bc620+_0xc4db('0x14')+_0x24f938+'.'+_0x266046)[_0xc4db('0x15')](_0x24f938+_0xc4db('0x3c'),_0x28351f)[_0xc4db('0x15')](_0xc4db('0x3d'),NOW)[_0xc4db('0x15')](_0xc4db('0x3e'),selectNotIn(_0x24f938,_0x4a81c8,_0x266046,'cm_hopper',[_0xc4db('0x4a'),'\x22onlyIfOpen\x22']))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x24f938,_0x4a81c8,_0x266046,_0xc4db('0x2f'),[_0xc4db('0x4a')])))['toString']();return _0x45f12d;}function insertTzCmHopperBlack(_0x3dc294,_0x48ddac,_0x335a81,_0x2bc7cc){var _0x8626cd=[_0xc4db('0x41'),_0xc4db('0x29'),'cm_contacts.ListId',_0x48ddac+'.'+_0x2bc7cc,'cm_contacts.createdAt',_0xc4db('0x2c')];return squel[_0xc4db('0x42')]()[_0xc4db('0x2e')](_0xc4db('0x45'))[_0xc4db('0x43')](['phone',_0xc4db('0x44'),'ListId',_0x2bc7cc,_0xc4db('0x32'),_0xc4db('0x33')],squel[_0xc4db('0x37')]()[_0xc4db('0x38')](_0x8626cd)['from'](_0x48ddac)[_0xc4db('0x13')](_0xc4db('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x48ddac+_0xc4db('0x3b'))[_0xc4db('0x13')](_0x335a81,null,_0x335a81+_0xc4db('0x14')+_0x48ddac+'.'+_0x2bc7cc)[_0xc4db('0x15')](_0x48ddac+_0xc4db('0x3c'),_0x3dc294)[_0xc4db('0x15')](_0xc4db('0x3d'),NOW)['where'](_0xc4db('0x3e'),squel[_0xc4db('0x37')]()[_0xc4db('0x4b')](_0xc4db('0x11'))[_0xc4db('0x12')](_0xc4db('0x45'))[_0xc4db('0x15')](_0xc4db('0x46'),_0x3dc294)[_0xc4db('0x15')](_0x2bc7cc+'\x20=\x20'+_0x48ddac+'.'+_0x2bc7cc)))[_0xc4db('0x40')]();}function insertCmHopperAdditionalPhones(_0x57e60e){var _0x54c2cd=[_0xc4db('0x4c'),_0xc4db('0x4d'),_0xc4db('0x4e'),_0xc4db('0x4f'),_0xc4db('0x50')];return squel[_0xc4db('0x42')]()[_0xc4db('0x2e')]('cm_hopper_additional_phones')[_0xc4db('0x43')]([_0xc4db('0x51'),'phone',_0xc4db('0x52'),'createdAt',_0xc4db('0x33')],squel[_0xc4db('0x37')]()['fields'](_0x54c2cd)[_0xc4db('0x12')](_0xc4db('0x2f'))[_0xc4db('0x13')](_0xc4db('0x39'),null,_0xc4db('0x53'))['join'](_0xc4db('0x54'),null,_0xc4db('0x55'))[_0xc4db('0x15')](_0xc4db('0x56'),_0x57e60e)[_0xc4db('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xc4db('0x40')]();}function insertCmContact(_0x1c5867,_0x4d3273,_0x51e412,_0x5d3488){var _0x56537b=_[_0xc4db('0x57')](_[_0xc4db('0x58')](_0x5d3488),[_0xc4db('0x31'),_0xc4db('0x59'),_0xc4db('0x32'),_0xc4db('0x33')]);return squel[_0xc4db('0x42')]()[_0xc4db('0x2e')](_0xc4db('0x39'))[_0xc4db('0x43')](_0x56537b,squel[_0xc4db('0x37')]()['fields'](_0x56537b)[_0xc4db('0x12')](_0x4d3273)['where']('('+_0x51e412[_0xc4db('0x13')](',')+_0xc4db('0x5a'),squel[_0xc4db('0x37')]()[_0xc4db('0x38')](_0x51e412)[_0xc4db('0x12')]('cm_contacts')[_0xc4db('0x15')]('ListId\x20=\x20?',_0x1c5867)['where'](_0xc4db('0x5b')))[_0xc4db('0x15')]('id\x20IN\x20?',squel[_0xc4db('0x37')]()[_0xc4db('0x4b')]('MIN(id)','min_id')[_0xc4db('0x12')](_0x4d3273)[_0xc4db('0x5c')](_0x51e412[_0xc4db('0x13')](','))))[_0xc4db('0x40')]();}function handleStop(){logger[_0xc4db('0x5d')](_0xc4db('0x5e'));stopped=!![];}function handleUncaughtException(_0x1345bd){logger[_0xc4db('0x5f')](_0x1345bd['message']);process[_0xc4db('0x60')](0x1);}function handleError(_0x17ebc2,_0x517beb){stats[_0xc4db('0x61')][_0xc4db('0x1d')]({'name':_0x517beb[_0xc4db('0x62')],'message':_0x517beb[_0xc4db('0x63')],'row':_0x17ebc2});}function handleQuery(_0x16a7c3){logger['info'](_0x16a7c3);return db[_0xc4db('0x64')][_0xc4db('0x65')](_0x16a7c3)[_0xc4db('0x66')](function(_0x1ba870){results[_0xc4db('0x1d')](_0x1ba870);})['catch'](function(_0x156255){logger[_0xc4db('0x5f')](_0x156255[_0xc4db('0x63')]);});}function updateTzCampaigns(_0x2ad3f0){return new Promise(function(_0x2e3fbb,_0x59c500){var _0x2f39d9=squel[_0xc4db('0x37')]()[_0xc4db('0x38')]([_0xc4db('0x67'),_0xc4db('0x68')])[_0xc4db('0x12')](_0xc4db('0x69'))[_0xc4db('0x13')](_0xc4db('0x6a'),null,_0xc4db('0x6b'))[_0xc4db('0x15')](_0xc4db('0x6c')+_0x2ad3f0);db['sequelize'][_0xc4db('0x65')](_0x2f39d9[_0xc4db('0x40')]())['spread'](function(_0x423333){var _0x4ecd82=[];for(var _0x5fc700=0x0;_0x5fc700<_0x423333['length'];_0x5fc700++){_0x4ecd82['push'](getTimezoneData(_0x423333[_0x5fc700],tmp_campaigns));}BPromise[_0xc4db('0x1e')](_0x4ecd82)[_0xc4db('0x1b')](function(){_0x2e3fbb({'val':0x1});});})['catch'](function(_0x54c094){logger[_0xc4db('0x5f')](_0x54c094['message']);_0x2e3fbb({'val':0x0});});});}function updateTzVoiceQueues(_0xf170ae){return new Promise(function(_0x76f54d,_0x1f771c){var _0x350e58=squel[_0xc4db('0x37')]()[_0xc4db('0x38')]([_0xc4db('0x6d'),_0xc4db('0x6e')])[_0xc4db('0x12')](_0xc4db('0x6f'))['join'](_0xc4db('0x70'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')['where']('voice_queues_has_cm_lists.CmListId='+_0xf170ae);db[_0xc4db('0x64')]['query'](_0x350e58[_0xc4db('0x40')]())['spread'](function(_0x5c6742){var _0xd9bb49=[];for(var _0x2d9db1=0x0;_0x2d9db1<_0x5c6742[_0xc4db('0x1c')];_0x2d9db1++){_0xd9bb49['push'](getTimezoneData(_0x5c6742[_0x2d9db1],tmp_voice_queues));}BPromise[_0xc4db('0x1e')](_0xd9bb49)[_0xc4db('0x1b')](function(){_0x76f54d({'val':0x1});});})[_0xc4db('0x71')](function(_0x5ef9c6){logger[_0xc4db('0x5f')](_0x5ef9c6['message']);_0x76f54d({'val':0x0});});});}function getTimezoneData(_0x52028f,_0x1e45c9){return new Promise(function(_0x30d16e,_0x4f6d57){var _0x58c195=shared[_0xc4db('0x72')];var _0x5e681f=_0x58c195[_0x52028f[_0xc4db('0x73')]];if(_[_0xc4db('0x20')](_0x5e681f)){_0x30d16e({'ret':0x1});}else{var _0x591cfe=_0x5e681f[_0xc4db('0x74')];var _0x4fc3d5=squel['insert']()[_0xc4db('0x2e')](_0x1e45c9)[_0xc4db('0x75')]('id',_0x52028f['id'])[_0xc4db('0x75')](_0xc4db('0x76'),_0x591cfe)['set'](_0xc4db('0x73'),_0x52028f[_0xc4db('0x73')])[_0xc4db('0x40')]();return db[_0xc4db('0x64')]['query'](_0x4fc3d5)[_0xc4db('0x66')](function(_0x533e6c){_0x30d16e({'ret':0x1});})['catch'](function(_0x3d26a5){logger[_0xc4db('0x5f')](_0x3d26a5['message']);_0x4f6d57({'ret':0x1});});}});}function handleTZQuery(_0x59143f){logger[_0xc4db('0x5d')](_0x59143f);return db[_0xc4db('0x64')][_0xc4db('0x65')](_0x59143f)[_0xc4db('0x66')](function(_0xf1ea63){})[_0xc4db('0x71')](function(_0x20940f){logger[_0xc4db('0x5f')](_0x20940f[_0xc4db('0x63')]);});}function main(_0x175db0,_0x392f62,_0x8f205b,_0x18c362){logger[_0xc4db('0x5d')]('main',_0x175db0,JSON[_0xc4db('0x77')](_0x392f62));process[_0xc4db('0x78')](_0xc4db('0x79'));var _0x2a4fa3=_0x392f62['binding'];var _0x241b9f=_[_0xc4db('0x7a')](_0x2a4fa3);var _0x435689=_0x392f62[_0xc4db('0x7b')];var _0x10ac7a=path['join'](config['root'],_0xc4db('0x7c'),_0x435689+_0xc4db('0x7d'));hasTZ=_[_0xc4db('0x58')](_0x2a4fa3)[_0xc4db('0x7e')](_0xc4db('0x73'));var _0x3c4c84=_[_0xc4db('0x58')](_0x2a4fa3)[_0xc4db('0x13')]();logger[_0xc4db('0x5d')](_0xc4db('0x7f'),_0x3c4c84);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0xc4db('0x80')]})['then'](function(_0x408460){for(var _0x34b68f=0x0;_0x34b68f<_0x408460[_0xc4db('0x1c')];_0x34b68f++){if(_0x408460[_0x34b68f][_0xc4db('0x80')]in _0x2a4fa3){contactItemTypes[_0xc4db('0x1d')](_0x408460[_0x34b68f]);delete _0x241b9f[_0x408460[_0x34b68f][_0xc4db('0x80')]];hasAdditionalPhones=!![];}for(var _0x3bdc17 in _0x2a4fa3){if(_0x408460[_0x34b68f]['name']+_0xc4db('0x81')===_0x3bdc17){phoneDescriptions[_0xc4db('0x1d')]({'itemTypeId':_0x408460[_0x34b68f]['id'],'description':_0x3bdc17});delete _0x241b9f[_0x3bdc17];}}}if(hasAdditionalPhones)_0x241b9f[_0xc4db('0x1a')]='';var _0x12f139=_[_0xc4db('0x58')](_0x241b9f)[_0xc4db('0x13')]();logger[_0xc4db('0x5d')](_0xc4db('0x7f'),_0x12f139);fs[_0xc4db('0x82')](_0x10ac7a,_0x12f139+'\x0a');Papa[_0xc4db('0x83')](fs[_0xc4db('0x84')](_0x175db0),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2d91b1,_0x222b0e){try{for(var _0x7ee90a=0x0,_0x1909d2=[];_0x7ee90a<_0x2d91b1[_0xc4db('0x85')][_0xc4db('0x1c')];_0x7ee90a++){stats[_0xc4db('0x86')]+=0x1;if(_0x2d91b1[_0xc4db('0x61')][_0x7ee90a]){handleError(_0x2d91b1[_0xc4db('0x85')][_0x7ee90a],_0x2d91b1[_0xc4db('0x61')][_0x7ee90a]);}else{var _0x3a8e02=[];var _0x2d5604=[];var _0x437b4a={};for(var _0x4da10b in _0x2a4fa3){let _0x417cac=contactItemTypes[_0xc4db('0x87')](_0x2fe668=>_0x2fe668[_0xc4db('0x80')]===_0x4da10b);let _0x42679c=contactItemTypes[_0xc4db('0x87')](_0x4910d2=>_0x4910d2[_0xc4db('0x80')]+'_description'===_0x4da10b);if(_[_0xc4db('0x20')](_0x417cac)&&_[_0xc4db('0x20')](_0x42679c)){if(_0x2a4fa3['hasOwnProperty'](_0x4da10b)){if(_0x2d91b1[_0xc4db('0x85')][_0x7ee90a][_0x2a4fa3[_0x4da10b]]){var _0x5baee0=_[_0xc4db('0x88')](_0x2d91b1[_0xc4db('0x85')][_0x7ee90a][_0x2a4fa3[_0x4da10b]][_0xc4db('0x89')](/"/g,'\x27'));switch(_0x4da10b){case _0xc4db('0x30'):var _0x13835b=moment(_0x5baee0,_0xc4db('0xe'),!![]);if(_0x13835b['isValid']()){_0x1909d2[_0xc4db('0x1d')]('\x22'+_0x5baee0+'\x22');}else{_0x3a8e02[_0xc4db('0x1d')](_0xc4db('0x8a'));}break;case _0xc4db('0x34'):var _0xec087c=parseInt(_0x5baee0);_0x5baee0=_[_0xc4db('0x8b')](_0xec087c)||_0xec087c<0x0||_0xec087c>0x4?_0x18c362?0x3:0x2:_0xec087c;_0x1909d2[_0xc4db('0x1d')]('\x22'+_0x5baee0+'\x22');break;case _0xc4db('0x35'):var _0x3d6da9=parseInt(_0x5baee0);if(_[_0xc4db('0x8c')](_0x3d6da9)&&_['includes'](_0x8f205b,_0x3d6da9)){_0x1909d2[_0xc4db('0x1d')]('\x22'+_0x3d6da9+'\x22');}else{_0x3a8e02[_0xc4db('0x1d')](_0xc4db('0x8d'));}break;case _0xc4db('0x8e'):if(isEmail(_0x5baee0)){_0x1909d2[_0xc4db('0x1d')]('\x22'+_0x5baee0+'\x22');}else{_0x3a8e02[_0xc4db('0x1d')](_0xc4db('0x8f'));}break;case _0xc4db('0x90'):var _0x3ae089=moment(_0x5baee0,_0xc4db('0x91'),!![]);if(_0x3ae089[_0xc4db('0x92')]()){_0x1909d2[_0xc4db('0x1d')]('\x22'+_0x5baee0+'\x22');}else{_0x3a8e02['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0xc4db('0x73'):var _0x10c502=shared[_0xc4db('0x72')];var _0x34ce04=_0x10c502[_0x5baee0];if(!_['isNil'](_0x34ce04)){var _0x277f8e=_0x34ce04['utcOffset'];_0x1909d2[_0xc4db('0x1d')]('\x22'+_0x5baee0+'\x22');_0x1909d2[_0xc4db('0x1d')]('\x22'+_0x277f8e+'\x22');}break;default:_0x1909d2[_0xc4db('0x1d')]('\x22'+_0x5baee0+'\x22');}}else{switch(_0x4da10b){case _0xc4db('0x93'):case _0xc4db('0x11'):_0x3a8e02[_0xc4db('0x1d')](_0x4da10b+_0xc4db('0x94'));break;default:_0x1909d2[_0xc4db('0x1d')]('\x22\x22');}}}}else{var _0x1f2def='';if(!_[_0xc4db('0x20')](_0x417cac)){if(!_0x437b4a[_0xc4db('0x95')](_0x417cac['id'])){if(!_[_0xc4db('0x20')](_0x2d91b1['data'][_0x7ee90a][_0x2a4fa3[_0x4da10b]])){var _0x5baee0=_[_0xc4db('0x88')](_0x2d91b1[_0xc4db('0x85')][_0x7ee90a][_0x2a4fa3[_0x4da10b]]['replace'](/"/g,'\x27'));var _0x2cc0ed=phoneDescriptions[_0xc4db('0x87')](_0x3e667e=>_0x3e667e[_0xc4db('0x96')]===_0x417cac['id']);if(!_['isNil'](_0x2cc0ed)){var _0xf208cb=_[_0xc4db('0x88')](_0x2d91b1['data'][_0x7ee90a][_0x2a4fa3[_0x2cc0ed[_0xc4db('0x97')]]][_0xc4db('0x89')](/"/g,'\x27'));if(!_[_0xc4db('0x20')](_0xf208cb))_0x5baee0=_0x5baee0+'§'+_0xf208cb;}if(_0x1f2def=='')_0x1f2def=_0x5baee0;else _0x1f2def+='|'+_0x5baee0;}_0x2d5604[_0xc4db('0x1d')](_0x417cac['id']+':'+_0x1f2def);_0x437b4a[_0x417cac['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1909d2[_0xc4db('0x1d')]('\x22'+_0x2d5604['join'](';')+'\x22');}if(_0x3a8e02['length']){handleError(_0x2d91b1[_0xc4db('0x85')][_0x7ee90a],{'code':_0xc4db('0x98'),'message':_0x3a8e02[_0xc4db('0x13')]()});}else{fs[_0xc4db('0x99')](_0x10ac7a,_0x1909d2[_0xc4db('0x13')]()+'\x0a');}_0x1909d2=[];}if(!(stats['rows']%0xc8)){socket[_0xc4db('0x9a')](_0xc4db('0x9b')+_0x435689,stats);stats[_0xc4db('0x61')]=[];}}if(stopped){logger[_0xc4db('0x5d')](_0xc4db('0x9c'));_0x222b0e[_0xc4db('0x9d')]();}}catch(_0x51fda4){handleError(_0x2d91b1[_0xc4db('0x85')][_0x7ee90a],{'code':'SystemError','message':_0x51fda4[_0xc4db('0x63')]});logger[_0xc4db('0x5f')](_0xc4db('0x9e'),_0x51fda4['message']);}},'complete':function(){try{var _0x4bf5a1=[];var _0x52424d=[];var _0x4134c6=_0xc4db('0x39');if(_0x392f62[_0xc4db('0x9f')]&&_0x392f62[_0xc4db('0x9f')][_0xc4db('0x1c')]){_0x4134c6=_0xc4db('0xa0')+_0x435689;_0x4bf5a1['push'](_0xc4db('0xa1')+_0x4134c6+_0xc4db('0xa2'));}tmp_campaigns=_0xc4db('0xa3')+_0x435689;tmp_voice_queues=_0xc4db('0xa4')+_0x435689;_0x52424d[_0xc4db('0x1d')](_0xc4db('0xa1')+tmp_campaigns+_0xc4db('0xa5'));_0x52424d[_0xc4db('0x1d')](_0xc4db('0xa1')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0xc4db('0xa6')](_0x52424d,handleTZQuery)[_0xc4db('0x1b')](function(_0xb37c74){updateTzCampaigns(_0x392f62[_0xc4db('0x31')])[_0xc4db('0x1b')](function(_0x2115a9){updateTzVoiceQueues(_0x392f62['ListId'])['then'](function(_0x45427e){if(hasTZ)_0x12f139=_0x12f139[_0xc4db('0x89')]('dialTimezone',_0xc4db('0xa7'));var _0x104149=util[_0xc4db('0xf')](_0xc4db('0xa8'),_0x10ac7a,_0x4134c6,_0x12f139,_0x392f62[_0xc4db('0x31')],_0x392f62['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x2a4fa3['scheduledat'])){_0x104149+=_0xc4db('0xa9');}_0x4bf5a1[_0xc4db('0x1d')](_0x104149);if(_0x392f62[_0xc4db('0x9f')]&&_0x392f62[_0xc4db('0x9f')][_0xc4db('0x1c')]){_0x4bf5a1['push'](insertCmContact(_0x392f62[_0xc4db('0x31')],_0x4134c6,_0x392f62[_0xc4db('0x9f')],_0x2a4fa3));_0x4bf5a1[_0xc4db('0x1d')](_0xc4db('0xaa')+_0x4134c6+';');}BPromise['each'](_0x4bf5a1,handleQuery)['then'](function(_0x41cc1a){BPromise['all']([handleAdditionalPhones()])[_0xc4db('0x1b')](function(){_0x4bf5a1=[];for(var _0x7fb521=0x0;_0x7fb521\x20\x20','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','query','select\x20*\x20from\x20','spread','length','isNil','phone','push','all','then','catch','error','message','split','CmContactHasItem','findOne','create','PHONE','CmContact','update','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','ContactId','ListId','updatedAt','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','cm_hopper_black','createdAt','cm_contacts','cm_contacts.createdAt\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','CompanyId','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','exit','errors','code','sequelize','main','stringify','send','binding','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','name','_description','keys','header'];(function(_0x5445ca,_0x13c0be){var _0x5a9445=function(_0x40d3d0){while(--_0x40d3d0){_0x5445ca['push'](_0x5445ca['shift']());}};_0x5a9445(++_0x13c0be);}(_0xbb58,0x17b));var _0x8bb5=function(_0x4e2f91,_0x3e6825){_0x4e2f91=_0x4e2f91-0x0;var _0x3101b8=_0xbb58[_0x4e2f91];return _0x3101b8;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x8bb5('0x0'));var Papa=require(_0x8bb5('0x1'));var util=require(_0x8bb5('0x2'));var BPromise=require(_0x8bb5('0x3'));var moment=require(_0x8bb5('0x4'));var squel=require('squel');var Redis=require(_0x8bb5('0x5'));var db=require(_0x8bb5('0x6'))['db'];var config=require(_0x8bb5('0x7'));var logger=require(_0x8bb5('0x8'))(_0x8bb5('0x9'));config['redis']=_['defaults'](config[_0x8bb5('0xa')],{'host':_0x8bb5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8bb5('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x8bb5('0xc')](_0x8bb5('0xd'));var tempTableName=_0x8bb5('0xe')+moment()[_0x8bb5('0xc')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x46cf73){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))*$/[_0x8bb5('0xf')](_0x46cf73);}function selectNotIn(_0x49fae9,_0x411b78,_0x1db8db,_0x39f734,_0x50d818){return squel[_0x8bb5('0x10')]()[_0x8bb5('0x11')]('phone')[_0x8bb5('0x12')](_0x39f734)[_0x8bb5('0x13')](_0x411b78,null,_0x411b78+_0x8bb5('0x14')+_0x39f734+'.'+_0x1db8db)[_0x8bb5('0x15')](_0x39f734+'.'+_0x1db8db+_0x8bb5('0x16')+_0x49fae9+'.'+_0x1db8db)[_0x8bb5('0x15')](_0x411b78+'.dialCheckDuplicateType\x20IN\x20('+_0x50d818['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3c2fde,_0x129ced){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0x8bb5('0x17')](_0x8bb5('0x18')+tempTableName)[_0x8bb5('0x19')](function(_0x3960fd){if(_0x3960fd!==null){var _0x2fb420=[];for(var _0x51bf7b=0x0;_0x51bf7b<_0x3960fd[_0x8bb5('0x1a')];_0x51bf7b++){var _0x472d30=_0x3960fd[_0x51bf7b];if(!_[_0x8bb5('0x1b')](_0x472d30[_0x8bb5('0x1c')])){if(!_[_0x8bb5('0x1b')](_0x472d30['AdditionalPhones']))_0x2fb420[_0x8bb5('0x1d')](insertAdditionalPhones(_0x472d30));promisesContact[_0x8bb5('0x1d')]({'contact':_0x472d30});}}}Promise[_0x8bb5('0x1e')](_0x2fb420)[_0x8bb5('0x1f')](function(){_0x3c2fde({'val':0x1});});})[_0x8bb5('0x20')](function(_0x5b98ef){logger[_0x8bb5('0x21')](_0x5b98ef[_0x8bb5('0x22')]);});});}function insertAdditionalPhones(_0x1b1bef){return new Promise(function(_0x3dc753,_0x10e23c){var _0x1503b8=_0x1b1bef['AdditionalPhones'];if(_['isNil'](_0x1503b8))_0x10e23c({'val':0x0});else{var _0x5df20d=_0x1503b8[_0x8bb5('0x23')](';');var _0x389018=[];orderBy=0x0;for(var _0x541afa=0x0;_0x541afa<_0x5df20d['length'];_0x541afa++){_0x389018[_0x8bb5('0x1d')](splitAdditionalPhone(_0x1b1bef['id'],_0x5df20d[_0x541afa]));}Promise[_0x8bb5('0x1e')](_0x389018)['then'](function(){_0x3dc753({'val':_0x5df20d[_0x8bb5('0x1a')]});});}});}function splitAdditionalPhone(_0xb29f16,_0x56e4d3){return new Promise(function(_0x170b8a,_0x3c5f01){var _0x2a3339=_0x56e4d3[_0x8bb5('0x23')](':');var _0x2cc575=_0x2a3339[0x0];var _0x14e762=_0x2a3339[0x1];if(_0x14e762!==''){var _0x4c514e=_0x14e762[_0x8bb5('0x23')]('|');var _0x2f5eda=[];for(var _0x53bb4e=0x0;_0x53bb4e<_0x4c514e[_0x8bb5('0x1a')];_0x53bb4e++){if(_0x4c514e[_0x53bb4e]!==''){var _0xfc438c=_['filter'](promisesAdditionalPhones,{'contactId':_0xb29f16,'phone':_0x4c514e[_0x53bb4e]});if(_0xfc438c[_0x8bb5('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0x8bb5('0x1d')]({'contactId':_0xb29f16,'contactTypeId':_0x2cc575,'phone':_0x4c514e[_0x53bb4e],'orderBy':orderBy});}}}_0x170b8a({'ok':0x1});}else _0x170b8a({'res':0x0});});}function createAdditionalPhone(_0x35106a,_0x40f31a,_0x40a628,_0x33115a){var _0x205aa0='';var _0x179f27='';var _0x4be499=_0x40a628[_0x8bb5('0x23')]('§');_0x205aa0=_0x4be499[0x0];if(_0x4be499['length']==0x2)_0x179f27=_0x4be499[0x1];return new Promise(function(_0x3cd789,_0x1f8e39){return db[_0x8bb5('0x24')][_0x8bb5('0x25')]({'where':{'CmContactId':_0x35106a,'item':_0x205aa0}})['then'](function(_0x4d21f1){if(_0x4d21f1){return db[_0x8bb5('0x24')]['update']({'ItemTypeId':_0x40f31a,'description':_0x179f27,'OrderBy':_0x33115a},{'where':{'CmContactId':_0x35106a,'item':_0x205aa0}})[_0x8bb5('0x1f')](function(_0x501d24){_0x3cd789({'res':'updated'});});}else{return db[_0x8bb5('0x24')][_0x8bb5('0x26')]({'CmContactId':_0x35106a,'item':_0x205aa0,'ItemTypeId':_0x40f31a,'description':_0x179f27,'OrderBy':_0x33115a,'ItemClass':_0x8bb5('0x27')})['then'](function(_0x175526){_0x3cd789({'res':'inserted'});});}});});}function updateContact(_0x5c6073){return new Promise(function(_0x40ca0d,_0x2b5717){var _0x257023=_0x5c6073['id'];delete _0x5c6073['id'];return db[_0x8bb5('0x28')][_0x8bb5('0x29')](_0x5c6073,{'where':{'id':_0x257023}})[_0x8bb5('0x1f')](function(_0x1f740e){updatedRows+=0x1;return db[_0x8bb5('0x2a')]['update']({'phone':_0x5c6073[_0x8bb5('0x1c')]},{'where':{'ContactId':_0x257023}})[_0x8bb5('0x1f')](function(_0x557a31){_0x40ca0d({'ret':'OK'});});});});}function insertCmHopper(_0xda25d8,_0x223f9f,_0x49c946,_0x431cd8,_0x2cae68){var _0x2216ac=[_0x8bb5('0x2b'),_0x8bb5('0x2c'),'cm_contacts.id',_0x8bb5('0x2d'),_0x223f9f+'.'+_0x431cd8,_0x8bb5('0x2e'),_0x8bb5('0x2f'),_0x8bb5('0x30'),_0x8bb5('0x31'),'\x22'+_0x2cae68+'\x22'];return squel[_0x8bb5('0x32')]()[_0x8bb5('0x33')]('cm_hopper')[_0x8bb5('0x34')]([_0x8bb5('0x1c'),'scheduledat',_0x8bb5('0x35'),_0x8bb5('0x36'),_0x431cd8,'createdAt',_0x8bb5('0x37'),'priority','UserId',_0x8bb5('0x38')],squel['select']()[_0x8bb5('0x39')](_0x2216ac)[_0x8bb5('0x12')](_0x223f9f)[_0x8bb5('0x13')]('cm_contacts',null,_0x8bb5('0x3a')+_0x223f9f+_0x8bb5('0x3b'))[_0x8bb5('0x13')](_0x49c946,null,_0x49c946+'.id\x20=\x20'+_0x223f9f+'.'+_0x431cd8)[_0x8bb5('0x15')](_0x223f9f+_0x8bb5('0x3c'),_0xda25d8)[_0x8bb5('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x8bb5('0x15')](_0x8bb5('0x3d'),selectNotIn(_0x223f9f,_0x49c946,_0x431cd8,_0x8bb5('0x3e'),[_0x8bb5('0x3f'),_0x8bb5('0x40')]))[_0x8bb5('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x223f9f,_0x49c946,_0x431cd8,_0x8bb5('0x3e'),[_0x8bb5('0x3f')])))[_0x8bb5('0x41')]();}function insertCmHopperBlack(_0x31d93c,_0x47f9c0,_0x1c700e,_0x400a6a){var _0x1eb40b=[_0x8bb5('0x2b'),_0x8bb5('0x42'),_0x8bb5('0x2d'),_0x47f9c0+'.'+_0x400a6a,_0x8bb5('0x2e'),_0x8bb5('0x2f')];return squel[_0x8bb5('0x32')]()[_0x8bb5('0x33')](_0x8bb5('0x43'))[_0x8bb5('0x34')]([_0x8bb5('0x1c'),_0x8bb5('0x35'),'ListId',_0x400a6a,_0x8bb5('0x44'),'updatedAt'],squel[_0x8bb5('0x10')]()[_0x8bb5('0x39')](_0x1eb40b)[_0x8bb5('0x12')](_0x47f9c0)[_0x8bb5('0x13')](_0x8bb5('0x45'),null,_0x8bb5('0x3a')+_0x47f9c0+_0x8bb5('0x3b'))[_0x8bb5('0x13')](_0x1c700e,null,_0x1c700e+_0x8bb5('0x14')+_0x47f9c0+'.'+_0x400a6a)[_0x8bb5('0x15')](_0x47f9c0+_0x8bb5('0x3c'),_0x31d93c)['where'](_0x8bb5('0x46'),NOW)['where'](_0x8bb5('0x3d'),squel[_0x8bb5('0x10')]()[_0x8bb5('0x11')]('phone')['from'](_0x8bb5('0x43'))[_0x8bb5('0x15')]('ListId\x20=\x20?',_0x31d93c)[_0x8bb5('0x15')](_0x400a6a+'\x20=\x20?',_0x47f9c0+'.'+_0x400a6a)))[_0x8bb5('0x41')]();}function insertCmHopperAdditionalPhones(_0x4cd8a1){var _0x325b7d=[_0x8bb5('0x47'),_0x8bb5('0x48'),_0x8bb5('0x49'),'cm_contact_has_items.createdAt',_0x8bb5('0x4a')];return squel[_0x8bb5('0x32')]()[_0x8bb5('0x33')](_0x8bb5('0x4b'))['fromQuery'](['CmHopperId',_0x8bb5('0x1c'),_0x8bb5('0x4c'),_0x8bb5('0x44'),'updatedAt'],squel[_0x8bb5('0x10')]()[_0x8bb5('0x39')](_0x325b7d)[_0x8bb5('0x12')](_0x8bb5('0x3e'))[_0x8bb5('0x13')](_0x8bb5('0x45'),null,_0x8bb5('0x4d'))[_0x8bb5('0x13')](_0x8bb5('0x4e'),null,_0x8bb5('0x4f'))[_0x8bb5('0x15')]('cm_hopper.ListId\x20=\x20?',_0x4cd8a1)[_0x8bb5('0x15')](_0x8bb5('0x46'),NOW))[_0x8bb5('0x41')]();}function insertCmContact(_0x400973,_0x50a29c,_0x4b6964,_0xe00c76){var _0x39d8da=_['concat'](_['keys'](_0xe00c76),[_0x8bb5('0x36'),_0x8bb5('0x50'),_0x8bb5('0x44'),_0x8bb5('0x37')]);return squel[_0x8bb5('0x32')]()[_0x8bb5('0x33')](_0x8bb5('0x45'))['fromQuery'](_0x39d8da,squel['select']()[_0x8bb5('0x39')](_0x39d8da)['from'](_0x50a29c)[_0x8bb5('0x15')]('('+_0x4b6964['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x8bb5('0x10')]()[_0x8bb5('0x39')](_0x4b6964)['from'](_0x8bb5('0x45'))[_0x8bb5('0x15')]('ListId\x20=\x20?',_0x400973))['where'](_0x8bb5('0x51'),squel['select']()[_0x8bb5('0x11')]('MIN(id)',_0x8bb5('0x52'))['from'](_0x50a29c)[_0x8bb5('0x53')](_0x4b6964[_0x8bb5('0x13')](','))))[_0x8bb5('0x41')]();}function handleStop(){logger[_0x8bb5('0x54')](_0x8bb5('0x55'));stopped=!![];}function handleUncaughtException(_0x9376b){logger[_0x8bb5('0x21')](_0x9376b[_0x8bb5('0x22')]);process[_0x8bb5('0x56')](0x1);}function handleError(_0x276bad,_0x3d7145){stats[_0x8bb5('0x57')]['push']({'name':_0x3d7145[_0x8bb5('0x58')],'message':_0x3d7145[_0x8bb5('0x22')],'row':_0x276bad});}function handleQuery(_0x5a6ce8){logger[_0x8bb5('0x54')](_0x5a6ce8);return db[_0x8bb5('0x59')][_0x8bb5('0x17')](_0x5a6ce8)[_0x8bb5('0x19')](function(_0x309a91){results[_0x8bb5('0x1d')](_0x309a91);})[_0x8bb5('0x20')](function(_0x33aaba){logger[_0x8bb5('0x21')](_0x33aaba['message']);});}function main(_0x16ae7f,_0x366740,_0x66dd38,_0x269736){logger[_0x8bb5('0x54')](_0x8bb5('0x5a'),_0x16ae7f,JSON[_0x8bb5('0x5b')](_0x366740));process[_0x8bb5('0x5c')]('start');var _0x4688bb=_0x366740[_0x8bb5('0x5d')];var _0x4dcf3e=_['clone'](_0x4688bb);var _0xd666e5=_0x366740[_0x8bb5('0x5e')];var _0x1c8211=path['join'](config[_0x8bb5('0x5f')],_0x8bb5('0x60'),_0xd666e5+_0x8bb5('0x61'));logger[_0x8bb5('0x54')](_0x8bb5('0x62'),_0x366740);db[_0x8bb5('0x63')]['findAll']({'raw':!![],'attributes':['id',_0x8bb5('0x64')]})['then'](function(_0x3fb76d){for(var _0x31d74b=0x0;_0x31d74b<_0x3fb76d[_0x8bb5('0x1a')];_0x31d74b++){if(_0x3fb76d[_0x31d74b][_0x8bb5('0x64')]in _0x4688bb){contactItemTypes[_0x8bb5('0x1d')](_0x3fb76d[_0x31d74b]);delete _0x4dcf3e[_0x3fb76d[_0x31d74b][_0x8bb5('0x64')]];hasAdditionalPhones=!![];}for(var _0x55baea in _0x4688bb){if(_0x3fb76d[_0x31d74b]['name']+_0x8bb5('0x65')===_0x55baea){phoneDescriptions[_0x8bb5('0x1d')]({'itemTypeId':_0x3fb76d[_0x31d74b]['id'],'description':_0x55baea});delete _0x4dcf3e[_0x55baea];}}}if(hasAdditionalPhones)_0x4dcf3e['AdditionalPhones']='';var _0x3adc88=_[_0x8bb5('0x66')](_0x4dcf3e)[_0x8bb5('0x13')]();logger[_0x8bb5('0x54')](_0x8bb5('0x67'),_0x3adc88);fs[_0x8bb5('0x68')](_0x1c8211,_0x3adc88+'\x0a');Papa['parse'](fs[_0x8bb5('0x69')](_0x16ae7f),{'header':!![],'skipEmptyLines':!![],'step':function(_0x58b613,_0x5cd7fd){try{for(var _0x15e055=0x0,_0x1d6350=[];_0x15e055<_0x58b613['data']['length'];_0x15e055++){stats[_0x8bb5('0x6a')]+=0x1;if(_0x58b613[_0x8bb5('0x57')][_0x15e055]){handleError(_0x58b613['data'][_0x15e055],_0x58b613['errors'][_0x15e055]);}else{var _0x286d50=[];var _0x2515b5=[];var _0x1abbb0={};for(var _0x280548 in _0x4688bb){let _0x20aca0=contactItemTypes[_0x8bb5('0x6b')](_0x4255da=>_0x4255da[_0x8bb5('0x64')]===_0x280548);let _0x74001d=contactItemTypes[_0x8bb5('0x6b')](_0x2f1f6b=>_0x2f1f6b[_0x8bb5('0x64')]+_0x8bb5('0x65')===_0x280548);if(_['isNil'](_0x20aca0)&&_[_0x8bb5('0x1b')](_0x74001d)){if(_0x4688bb['hasOwnProperty'](_0x280548)){if(_0x58b613[_0x8bb5('0x6c')][_0x15e055][_0x4688bb[_0x280548]]){var _0x1b64a2=_['trim'](_0x58b613[_0x8bb5('0x6c')][_0x15e055][_0x4688bb[_0x280548]][_0x8bb5('0x6d')](/"/g,'\x27'));switch(_0x280548){case _0x8bb5('0x6e'):var _0x2c786b=moment(_0x1b64a2,_0x8bb5('0xd'),!![]);if(_0x2c786b[_0x8bb5('0x6f')]()){_0x1d6350['push']('\x22'+_0x1b64a2+'\x22');}else{_0x286d50[_0x8bb5('0x1d')](_0x8bb5('0x70'));}break;case _0x8bb5('0x71'):var _0x48daf3=parseInt(_0x1b64a2);_0x1b64a2=_[_0x8bb5('0x72')](_0x48daf3)||_0x48daf3<0x0||_0x48daf3>0x4?_0x269736?0x3:0x2:_0x48daf3;_0x1d6350[_0x8bb5('0x1d')]('\x22'+_0x1b64a2+'\x22');break;case _0x8bb5('0x73'):var _0x58dac9=parseInt(_0x1b64a2);if(_[_0x8bb5('0x74')](_0x58dac9)&&_[_0x8bb5('0x75')](_0x66dd38,_0x58dac9)){_0x1d6350[_0x8bb5('0x1d')]('\x22'+_0x58dac9+'\x22');}else{_0x286d50['push'](_0x8bb5('0x76'));}break;case _0x8bb5('0x77'):if(isEmail(_0x1b64a2)){_0x1d6350[_0x8bb5('0x1d')]('\x22'+_0x1b64a2+'\x22');}else{_0x286d50[_0x8bb5('0x1d')](_0x8bb5('0x78'));}break;case _0x8bb5('0x79'):var _0x2a9a14=moment(_0x1b64a2,'YYYY-MM-DD',!![]);if(_0x2a9a14['isValid']()){_0x1d6350[_0x8bb5('0x1d')]('\x22'+_0x1b64a2+'\x22');}else{_0x286d50['push'](_0x8bb5('0x7a'));}break;default:_0x1d6350[_0x8bb5('0x1d')]('\x22'+_0x1b64a2+'\x22');}}else{switch(_0x280548){case _0x8bb5('0x7b'):case _0x8bb5('0x1c'):_0x286d50['push'](_0x280548+_0x8bb5('0x7c'));break;default:_0x1d6350['push']('\x22\x22');}}}}else{var _0x3ef358='';if(!_['isNil'](_0x20aca0)){if(!_0x1abbb0[_0x8bb5('0x7d')](_0x20aca0['id'])){for(var _0x408bb5=0x0;_0x408bb5<_0x4688bb[_0x280548][_0x8bb5('0x1a')];_0x408bb5++){var _0x1b64a2=_[_0x8bb5('0x7e')](_0x58b613['data'][_0x15e055][_0x4688bb[_0x280548][_0x408bb5]][_0x8bb5('0x6d')](/"/g,'\x27'));var _0x29cc44=phoneDescriptions['find'](_0x23e1f1=>_0x23e1f1['itemTypeId']===_0x20aca0['id']);if(!_['isNil'](_0x29cc44)){var _0x40d710=_[_0x8bb5('0x7e')](_0x58b613['data'][_0x15e055][_0x4688bb[_0x29cc44[_0x8bb5('0x7f')]][0x0]][_0x8bb5('0x6d')](/"/g,'\x27'));if(!_[_0x8bb5('0x1b')](_0x40d710))_0x1b64a2=_0x1b64a2+'§'+_0x40d710;}if(_0x3ef358=='')_0x3ef358=_0x1b64a2;else _0x3ef358+='|'+_0x1b64a2;}_0x2515b5['push'](_0x20aca0['id']+':'+_0x3ef358);_0x1abbb0[_0x20aca0['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1d6350[_0x8bb5('0x1d')]('\x22'+_0x2515b5[_0x8bb5('0x13')](';')+'\x22');}if(_0x286d50[_0x8bb5('0x1a')]){handleError(_0x58b613[_0x8bb5('0x6c')][_0x15e055],{'code':_0x8bb5('0x80'),'message':_0x286d50[_0x8bb5('0x13')]()});}else{fs[_0x8bb5('0x81')](_0x1c8211,_0x1d6350[_0x8bb5('0x13')]()+'\x0a');}_0x1d6350=[];}if(!(stats[_0x8bb5('0x6a')]%0xc8)){socket[_0x8bb5('0x82')](_0x8bb5('0x83')+_0xd666e5,stats);stats[_0x8bb5('0x57')]=[];}}if(stopped){logger[_0x8bb5('0x54')]('Abort\x20parser');_0x5cd7fd[_0x8bb5('0x84')]();}}catch(_0x275e48){handleError(_0x58b613['data'][_0x15e055],{'code':_0x8bb5('0x85'),'message':_0x275e48[_0x8bb5('0x22')]});logger[_0x8bb5('0x21')](_0x8bb5('0x86'),_0x275e48[_0x8bb5('0x22')]);}},'complete':function(){try{var _0x3cd299=[];var _0xdf15a=tempTableName;_0x3cd299[_0x8bb5('0x1d')](_0x8bb5('0x87')+_0xdf15a+_0x8bb5('0x88'));logger[_0x8bb5('0x54')](_0x8bb5('0x89'),contactItemTypes[_0x8bb5('0x1a')]);var _0x308d25=util['format'](_0x8bb5('0x8a'),_0x1c8211,_0xdf15a,_0x3adc88,_0x366740['ListId'],_0x366740[_0x8bb5('0x50')]||null,NOW,NOW);if(_[_0x8bb5('0x1b')](_0x4688bb['scheduledat'])){_0x308d25+=_0x8bb5('0x8b');}_0x3cd299[_0x8bb5('0x1d')](_0x308d25);BPromise[_0x8bb5('0x8c')](_0x3cd299,handleQuery)['then'](function(_0x23e5c3){BPromise[_0x8bb5('0x1e')]([handleAdditionalPhones()])[_0x8bb5('0x1f')](function(){_0x3cd299=[];for(var _0x477c97=0x0;_0x477c97_0x60226d[_0xb7a2('0x6a')]===_0x29fcdf);let _0x16e329=contactItemTypes['find'](_0x5cfe1a=>_0x5cfe1a[_0xb7a2('0x6a')]+'_description'===_0x29fcdf);if(_['isNil'](_0x3f4b01)&&_[_0xb7a2('0x17')](_0x16e329)){if(_0x805f14[_0xb7a2('0x74')](_0x29fcdf)){if(_0x17187f['data'][_0x543ba9][_0x805f14[_0x29fcdf]]){var _0x2e343b=_['trim'](_0x17187f[_0xb7a2('0x71')][_0x543ba9][_0x805f14[_0x29fcdf]][_0xb7a2('0x75')](/"/g,'\x27'));switch(_0x29fcdf){case _0xb7a2('0x33'):var _0x1493c7=moment(_0x2e343b,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x1493c7[_0xb7a2('0x76')]()){_0x57db92['push']('\x22'+_0x2e343b+'\x22');}else{_0x3dfb01[_0xb7a2('0x19')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x5d3191=parseInt(_0x2e343b);_0x2e343b=_[_0xb7a2('0x77')](_0x5d3191)||_0x5d3191<0x0||_0x5d3191>0x4?_0x880179?0x3:0x2:_0x5d3191;_0x57db92[_0xb7a2('0x19')]('\x22'+_0x2e343b+'\x22');break;case _0xb7a2('0x39'):var _0x29e7bc=parseInt(_0x2e343b);if(_['isNumber'](_0x29e7bc)&&_[_0xb7a2('0x78')](_0x58bb2d,_0x29e7bc)){_0x57db92[_0xb7a2('0x19')]('\x22'+_0x29e7bc+'\x22');}else{_0x3dfb01[_0xb7a2('0x19')]('agent\x20not\x20exists');}break;case _0xb7a2('0x79'):if(isEmail(_0x2e343b)){_0x57db92[_0xb7a2('0x19')]('\x22'+_0x2e343b+'\x22');}else{_0x3dfb01[_0xb7a2('0x19')](_0xb7a2('0x7a'));}break;case _0xb7a2('0x7b'):var _0x3eb38e=moment(_0x2e343b,'YYYY-MM-DD',!![]);if(_0x3eb38e[_0xb7a2('0x76')]()){_0x57db92['push']('\x22'+_0x2e343b+'\x22');}else{_0x3dfb01['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x57db92[_0xb7a2('0x19')]('\x22'+_0x2e343b+'\x22');}}else{switch(_0x29fcdf){case _0xb7a2('0x7c'):case _0xb7a2('0x11'):_0x3dfb01[_0xb7a2('0x19')](_0x29fcdf+_0xb7a2('0x7d'));break;default:_0x57db92['push']('\x22\x22');}}}}else{var _0x64d122='';if(!_[_0xb7a2('0x17')](_0x3f4b01)){if(!_0x2dbb2f['hasOwnProperty'](_0x3f4b01['id'])){for(var _0x2ac670=0x0;_0x2ac670<_0x805f14[_0x29fcdf][_0xb7a2('0x20')];_0x2ac670++){var _0x2e343b=_[_0xb7a2('0x7e')](_0x17187f[_0xb7a2('0x71')][_0x543ba9][_0x805f14[_0x29fcdf][_0x2ac670]][_0xb7a2('0x75')](/"/g,'\x27'));var _0x54a5e9=phoneDescriptions['find'](_0xa15846=>_0xa15846[_0xb7a2('0x7f')]===_0x3f4b01['id']);if(!_[_0xb7a2('0x17')](_0x54a5e9)){var _0x335304=_['trim'](_0x17187f[_0xb7a2('0x71')][_0x543ba9][_0x805f14[_0x54a5e9[_0xb7a2('0x80')]][0x0]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x335304))_0x2e343b=_0x2e343b+'§'+_0x335304;}if(_0x64d122=='')_0x64d122=_0x2e343b;else _0x64d122+='|'+_0x2e343b;}_0x5497f7[_0xb7a2('0x19')](_0x3f4b01['id']+':'+_0x64d122);_0x2dbb2f[_0x3f4b01['id']]=0x1;}}}}if(hasAdditionalPhones){_0x57db92[_0xb7a2('0x19')]('\x22'+_0x5497f7['join'](';')+'\x22');}if(_0x3dfb01['length']){handleError(_0x17187f[_0xb7a2('0x71')][_0x543ba9],{'code':_0xb7a2('0x81'),'message':_0x3dfb01['join']()});}else{fs[_0xb7a2('0x82')](_0x20d6e4,_0x57db92[_0xb7a2('0x13')]()+'\x0a');}_0x57db92=[];}if(!(stats['rows']%0xc8)){socket[_0xb7a2('0x83')](_0xb7a2('0x84')+_0x19e755,stats);stats[_0xb7a2('0x5d')]=[];}}if(stopped){logger['info'](_0xb7a2('0x85'));_0x11e525[_0xb7a2('0x86')]();}}catch(_0x2339cd){handleError(_0x17187f[_0xb7a2('0x71')][_0x543ba9],{'code':_0xb7a2('0x87'),'message':_0x2339cd[_0xb7a2('0x1e')]});logger['error'](_0xb7a2('0x88'),_0x2339cd[_0xb7a2('0x1e')]);}},'complete':function(){try{var _0x3d4268=[];var _0x1002e4=tempTableName;_0x3d4268[_0xb7a2('0x19')](_0xb7a2('0x89')+_0x1002e4+_0xb7a2('0x8a'));logger['info'](_0xb7a2('0x8b'),contactItemTypes[_0xb7a2('0x20')]);var _0x283716=util[_0xb7a2('0xd')](_0xb7a2('0x8c'),_0x20d6e4,_0x1002e4,_0xef6eaa,_0x34fd45[_0xb7a2('0x35')],_0x34fd45[_0xb7a2('0x55')]||null,NOW,NOW);if(_[_0xb7a2('0x17')](_0x805f14['scheduledat'])){_0x283716+=_0xb7a2('0x8d');}_0x3d4268[_0xb7a2('0x19')](_0x283716);BPromise[_0xb7a2('0x8e')](_0x3d4268,handleQuery)[_0xb7a2('0x1b')](function(_0x3659be){BPromise[_0xb7a2('0x1a')]([handleAdditionalPhones()])[_0xb7a2('0x1b')](function(){_0x3d4268=[];for(var _0x3691a3=0x0;_0x3691a3\x20\x20');}var _0x6abdda=path[_0xb7a2('0x13')](config[_0xb7a2('0x98')],_0xb7a2('0x66'),process[_0xb7a2('0x99')][0x2]);if(!fs[_0xb7a2('0x9a')](_0x6abdda)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x14e13d={};try{_0x14e13d=JSON[_0xb7a2('0x6f')](process[_0xb7a2('0x99')][0x3]);if(!_0x14e13d[_0xb7a2('0x63')]){throw new Error('binding\x20doesn\x27t\x20exists');}var _0x24f43a=0x0;if(_0x14e13d['binding'][_0xb7a2('0x39')]){_0x24f43a=0x1;}if(!_0x14e13d['ListId']){throw new Error(_0xb7a2('0x9b'));}}catch(_0x11b00c){throw new Error(_0xb7a2('0x9c'));}var _0x21431a=[];try{_0x21431a=_[_0xb7a2('0x9d')](JSON[_0xb7a2('0x6f')](process[_0xb7a2('0x99')][0x4]),'id');}catch(_0x3a3cb4){logger[_0xb7a2('0x5b')](_0xb7a2('0x9e'));}main(_0x6abdda,_0x14e13d,_0x21431a,_0x24f43a);}validate();process['on']('SIGINT',handleStop);process['on'](_0xb7a2('0x9f'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 646dd2a..dd8904e 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 _0xd6db=['getDescriptions','***\x20Call\x20Info\x20***','calleridname','keyValue','Call\x20To','destexten','Queue','UniqueId','uniqueid','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','agentcalledAt','agentconnectAt','Agent\x20Complete','Hold\x20Time','Talk\x20Time','talktime','outbound','Called\x20Number','Member\x20Name','membername','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','Billable\x20Time','getSubjects','string','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','push','variable','queue','calleridnum','Outbound\x20Call','destcalleridnum'];(function(_0x557795,_0x308615){var _0x4de6c4=function(_0x2208ea){while(--_0x2208ea){_0x557795['push'](_0x557795['shift']());}};_0x4de6c4(++_0x308615);}(_0xd6db,0x11a));var _0xbd6d=function(_0x36131c,_0x3f74a9){_0x36131c=_0x36131c-0x0;var _0x3896a7=_0xd6db[_0x36131c];return _0x3896a7;};'use strict';exports[_0xbd6d('0x0')]=function(_0x58dd48,_0x59b0e9){var _0x2524b0=[{'type':_0xbd6d('0x1'),'content':_0xbd6d('0x2'),'variableName':null}];switch(_0x58dd48['toLowerCase']()){case _0xbd6d('0x3'):switch(_0x59b0e9[_0xbd6d('0x4')]()){case _0xbd6d('0x5'):_0x2524b0[_0xbd6d('0x6')]({'type':_0xbd6d('0x7'),'content':'','variableName':_0xbd6d('0x8')});_0x2524b0['push']({'type':'variable','content':'','variableName':_0xbd6d('0x9')});break;case'outbound':_0x2524b0[_0xbd6d('0x6')]({'type':_0xbd6d('0x1'),'content':_0xbd6d('0xa'),'variableName':null});_0x2524b0[_0xbd6d('0x6')]({'type':'variable','content':'','variableName':_0xbd6d('0xb')});break;}}return _0x2524b0;};exports[_0xbd6d('0xc')]=function(_0x5231ca,_0x2895ef){var _0x456811=[];switch(_0x5231ca[_0xbd6d('0x4')]()){case _0xbd6d('0x3'):switch(_0x2895ef[_0xbd6d('0x4')]()){case _0xbd6d('0x5'):_0x456811=[{'type':_0xbd6d('0x1'),'content':_0xbd6d('0xd'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Caller\x20Number','keyType':_0xbd6d('0x7'),'variableName':_0xbd6d('0x9')},{'type':'keyValue','content':'','key':'Caller\x20Name','keyType':'variable','variableName':_0xbd6d('0xe')},{'type':_0xbd6d('0xf'),'content':'','key':_0xbd6d('0x10'),'keyType':_0xbd6d('0x7'),'variableName':_0xbd6d('0x11')},{'type':_0xbd6d('0xf'),'content':'','key':_0xbd6d('0x12'),'keyType':_0xbd6d('0x7'),'variableName':_0xbd6d('0x8')},{'type':'keyValue','content':'','key':_0xbd6d('0x13'),'keyType':_0xbd6d('0x7'),'variableName':_0xbd6d('0x14')},{'type':'keyValue','content':'','key':'Date','keyType':_0xbd6d('0x7'),'variableName':'agentcalledAt'},{'type':'string','content':_0xbd6d('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0xbd6d('0xf'),'content':'','key':'Agent\x20Name','keyType':_0xbd6d('0x7'),'variableName':_0xbd6d('0x16')},{'type':'keyValue','content':'','key':_0xbd6d('0x17'),'keyType':_0xbd6d('0x7'),'variableName':'destcalleridnum'},{'type':_0xbd6d('0x1'),'content':_0xbd6d('0x18'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Ring','keyType':_0xbd6d('0x7'),'variableName':_0xbd6d('0x19')},{'type':_0xbd6d('0xf'),'content':'','key':'Agent\x20Connect','keyType':_0xbd6d('0x7'),'variableName':_0xbd6d('0x1a')},{'type':_0xbd6d('0xf'),'content':'','key':_0xbd6d('0x1b'),'keyType':_0xbd6d('0x7'),'variableName':'agentcompleteAt'},{'type':'keyValue','content':'','key':_0xbd6d('0x1c'),'keyType':_0xbd6d('0x7'),'variableName':'holdtime'},{'type':_0xbd6d('0xf'),'content':'','key':_0xbd6d('0x1d'),'keyType':_0xbd6d('0x7'),'variableName':_0xbd6d('0x1e')}];break;case _0xbd6d('0x1f'):_0x456811=[{'type':'string','content':_0xbd6d('0xd'),'variableName':null},{'type':_0xbd6d('0xf'),'content':'','key':_0xbd6d('0x20'),'keyType':_0xbd6d('0x7'),'keyContent':'','variableName':_0xbd6d('0xb')},{'type':_0xbd6d('0xf'),'content':'','key':_0xbd6d('0x21'),'keyType':'variable','keyContent':'','variableName':_0xbd6d('0x22')},{'type':'keyValue','content':'','key':_0xbd6d('0x13'),'keyType':_0xbd6d('0x7'),'keyContent':'','variableName':_0xbd6d('0x14')},{'type':'keyValue','content':'','key':'Date','keyType':_0xbd6d('0x7'),'keyContent':'','variableName':_0xbd6d('0x23')},{'type':_0xbd6d('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0xbd6d('0xf'),'content':'','key':_0xbd6d('0x24'),'keyType':_0xbd6d('0x7'),'keyContent':'','variableName':_0xbd6d('0x25')},{'type':_0xbd6d('0xf'),'content':'','key':_0xbd6d('0x26'),'keyType':'variable','keyContent':'','variableName':_0xbd6d('0x27')},{'type':_0xbd6d('0xf'),'content':'','key':_0xbd6d('0x28'),'keyType':_0xbd6d('0x7'),'keyContent':'','variableName':'duration'},{'type':_0xbd6d('0xf'),'content':'','key':_0xbd6d('0x29'),'keyType':_0xbd6d('0x7'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x456811;}; \ No newline at end of file +var _0x0669=['calleridnum','outbound','Outbound\x20Call','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','Answer\x20Time','answertime','endtime','Duration','duration','getSubjects','string','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','push','variable','queue'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x0669,0x1a5));var _0x9066=function(_0x470d13,_0x3f22fa){_0x470d13=_0x470d13-0x0;var _0x18cc32=_0x0669[_0x470d13];return _0x18cc32;};'use strict';exports[_0x9066('0x0')]=function(_0x4c4a9d,_0x5d14b5){var _0x28a9b8=[{'type':_0x9066('0x1'),'content':_0x9066('0x2'),'variableName':null}];switch(_0x4c4a9d['toLowerCase']()){case _0x9066('0x3'):switch(_0x5d14b5[_0x9066('0x4')]()){case _0x9066('0x5'):_0x28a9b8[_0x9066('0x6')]({'type':_0x9066('0x7'),'content':'','variableName':_0x9066('0x8')});_0x28a9b8[_0x9066('0x6')]({'type':_0x9066('0x7'),'content':'','variableName':_0x9066('0x9')});break;case _0x9066('0xa'):_0x28a9b8[_0x9066('0x6')]({'type':_0x9066('0x1'),'content':_0x9066('0xb'),'variableName':null});_0x28a9b8['push']({'type':_0x9066('0x7'),'content':'','variableName':'destcalleridnum'});break;}}return _0x28a9b8;};exports['getDescriptions']=function(_0x223ff8,_0x5233fc){var _0x4d9a3a=[];switch(_0x223ff8['toLowerCase']()){case'voice':switch(_0x5233fc[_0x9066('0x4')]()){case _0x9066('0x5'):_0x4d9a3a=[{'type':_0x9066('0x1'),'content':_0x9066('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x9066('0xd'),'content':'','key':_0x9066('0xe'),'keyType':'variable','variableName':_0x9066('0x9')},{'type':_0x9066('0xd'),'content':'','key':_0x9066('0xf'),'keyType':_0x9066('0x7'),'variableName':_0x9066('0x10')},{'type':_0x9066('0xd'),'content':'','key':_0x9066('0x11'),'keyType':_0x9066('0x7'),'variableName':_0x9066('0x12')},{'type':_0x9066('0xd'),'content':'','key':_0x9066('0x13'),'keyType':_0x9066('0x7'),'variableName':_0x9066('0x8')},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0x9066('0x7'),'variableName':_0x9066('0x14')},{'type':_0x9066('0xd'),'content':'','key':_0x9066('0x15'),'keyType':_0x9066('0x7'),'variableName':_0x9066('0x16')},{'type':_0x9066('0x1'),'content':_0x9066('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x9066('0xd'),'content':'','key':_0x9066('0x18'),'keyType':_0x9066('0x7'),'variableName':_0x9066('0x19')},{'type':_0x9066('0xd'),'content':'','key':'Agent\x20Number','keyType':'variable','variableName':_0x9066('0x1a')},{'type':_0x9066('0x1'),'content':_0x9066('0x1b'),'key':null,'keyType':null,'variableName':null},{'type':_0x9066('0xd'),'content':'','key':_0x9066('0x1c'),'keyType':_0x9066('0x7'),'variableName':_0x9066('0x16')},{'type':_0x9066('0xd'),'content':'','key':'Agent\x20Connect','keyType':'variable','variableName':_0x9066('0x1d')},{'type':_0x9066('0xd'),'content':'','key':'Agent\x20Complete','keyType':_0x9066('0x7'),'variableName':_0x9066('0x1e')},{'type':'keyValue','content':'','key':_0x9066('0x1f'),'keyType':_0x9066('0x7'),'variableName':_0x9066('0x20')},{'type':'keyValue','content':'','key':_0x9066('0x21'),'keyType':_0x9066('0x7'),'variableName':_0x9066('0x22')}];break;case _0x9066('0xa'):_0x4d9a3a=[{'type':_0x9066('0x1'),'content':_0x9066('0xc'),'variableName':null},{'type':'keyValue','content':'','key':_0x9066('0x23'),'keyType':_0x9066('0x7'),'keyContent':'','variableName':_0x9066('0x1a')},{'type':_0x9066('0xd'),'content':'','key':_0x9066('0x24'),'keyType':_0x9066('0x7'),'keyContent':'','variableName':_0x9066('0x25')},{'type':_0x9066('0xd'),'content':'','key':'UniqueId','keyType':'variable','keyContent':'','variableName':'uniqueid'},{'type':_0x9066('0xd'),'content':'','key':_0x9066('0x15'),'keyType':'variable','keyContent':'','variableName':'starttime'},{'type':_0x9066('0x1'),'content':_0x9066('0x1b')},{'type':_0x9066('0xd'),'content':'','key':_0x9066('0x26'),'keyType':'variable','keyContent':'','variableName':_0x9066('0x27')},{'type':_0x9066('0xd'),'content':'','key':'Complete\x20Time','keyType':'variable','keyContent':'','variableName':_0x9066('0x28')},{'type':_0x9066('0xd'),'content':'','key':_0x9066('0x29'),'keyType':_0x9066('0x7'),'keyContent':'','variableName':_0x9066('0x2a')},{'type':_0x9066('0xd'),'content':'','key':'Billable\x20Time','keyType':_0x9066('0x7'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x4d9a3a;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 9692879..e60c87f 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 _0x03a7=['./utils','findAll','skipInteractionsQuery','resolve','then','search','parseAdvancedSearchFilter','where','body','contact','default','filter','having','read','tags','checkAccountsRestrictions','countFilteredInteractions','order','forEach','contactName','closed','getClosedOrderClause','getFilteredInteractions','rows','catch','tracked','user','query','phone','fax','lodash','./sql-utils'];(function(_0x31991b,_0xaf75d2){var _0x307304=function(_0x2f36c5){while(--_0x2f36c5){_0x31991b['push'](_0x31991b['shift']());}};_0x307304(++_0xaf75d2);}(_0x03a7,0x17e));var _0x703a=function(_0x5f391d,_0x3d53f0){_0x5f391d=_0x5f391d-0x0;var _0x475d94=_0x03a7[_0x5f391d];return _0x475d94;};'use strict';var _=require(_0x703a('0x0'));var sqlUtils=require(_0x703a('0x1'));var utils=require(_0x703a('0x2'));exports[_0x703a('0x3')]=function(_0xb8dcde,_0xeb7948,_0x2cc1da,_0x415816,_0x39743b){var _0x20081b={'count':0x0,'rows':[]};var _0x460946=sqlUtils[_0x703a('0x4')](_0xb8dcde,_0x2cc1da,_0xeb7948);if(_0x460946){return Promise[_0x703a('0x5')](_0x20081b);}var _0x12ac87=sqlUtils['getInteractionsQuery'](_0xb8dcde);var _0x1ed19d={};return Promise[_0x703a('0x5')]()[_0x703a('0x6')](function(){if(_0xeb7948[_0x703a('0x7')]){return sqlUtils[_0x703a('0x8')](_0xeb7948['search'],_0x39743b);}else{return sqlUtils['parseQueryParameters'](_0xb8dcde,_0xeb7948,_0x39743b);}})[_0x703a('0x6')](function(_0x5e3f9b){_0x12ac87[_0x703a('0x9')](_0x5e3f9b[_0x703a('0xa')]);_0x12ac87[_0x703a('0x9')](_0x5e3f9b[_0x703a('0xb')]);_0x12ac87[_0x703a('0x9')](_0x5e3f9b[_0x703a('0xc')]);_0x12ac87[_0x703a('0x9')](_0x5e3f9b['fields']);_0x12ac87['where'](_0x5e3f9b[_0x703a('0xd')]);_0x12ac87[_0x703a('0x9')](_0x5e3f9b['user']);_0x12ac87[_0x703a('0xe')](_0x5e3f9b[_0x703a('0xf')]);_0x1ed19d=_0x5e3f9b[_0x703a('0x10')];return sqlUtils[_0x703a('0x11')](_0xb8dcde,_0x2cc1da,_0xeb7948);})[_0x703a('0x6')](function(_0x14827d){_0x12ac87['where'](_0x14827d);_0x12ac87['group']('i.id');var _0x1eb0c5=_0xeb7948['search']?_0x1ed19d['ids']:_0xeb7948['tag'];return sqlUtils[_0x703a('0x12')](_0x12ac87,_0x1eb0c5);})['then'](function(_0x47097b){_0x20081b['count']=_0x47097b['length'];if(_0x20081b['count']===0x0){return[];}_0x12ac87[_0x703a('0xe')](_0x1ed19d['clause']);if(_0x415816[_0x703a('0x13')]){_0x415816[_0x703a('0x13')][_0x703a('0x14')](function(_0x3e20e6){var _0x337e00=_0x3e20e6[0x0]===_0x703a('0x15')?_0x3e20e6[0x0]:'i.'+_0x3e20e6[0x0];_0x12ac87['order'](_0x337e00,_0x3e20e6[0x1]==='DESC'?![]:!![]);if(_0x3e20e6[0x0]===_0x703a('0x16')){var _0x16fefc=sqlUtils[_0x703a('0x17')](_0xb8dcde,_0xeb7948);_0x12ac87[_0x703a('0x13')](_0x16fefc,_0x3e20e6[0x1]==='DESC'?![]:!![]);}});}return sqlUtils[_0x703a('0x18')](_0xb8dcde,_0x12ac87,_0xeb7948,_0x415816);})['then'](function(_0x15de00){_0x20081b[_0x703a('0x19')]=_0x15de00;return _0x20081b;})[_0x703a('0x1a')](function(_0x1ac39a){throw _0x1ac39a;});};exports[_0x703a('0x1b')]=function(_0x16bc72,_0x338ae7){return function(_0x4f6f9d,_0x169b4a,_0x1eec06){var _0x554ca3=_0x4f6f9d[_0x703a('0x1c')];var _0x204447={};var _0xecec6=_0x4f6f9d[_0x703a('0x1d')];if(_0x204447){_0x204447=_['clone'](_0x4f6f9d[_0x703a('0xa')]);_0x204447=_['omit'](_0x204447,['body','html',_0x703a('0x1e'),_0x703a('0x1f'),'mobile']);}utils['updateUser'](_0x554ca3,_0x204447,_0xecec6,_0x16bc72,_0x338ae7);_0x1eec06(null);};}; \ No newline at end of file +var _0x95c3=['tag','countFilteredInteractions','count','length','clause','order','forEach','closed','getClosedOrderClause','DESC','getFilteredInteractions','rows','tracked','query','body','html','phone','fax','mobile','./sql-utils','./utils','findAll','getInteractionsQuery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','contact','user','having','tags','checkAccountsRestrictions','group','ids'];(function(_0x5e806a,_0x4bac51){var _0x5333a7=function(_0x5cbd26){while(--_0x5cbd26){_0x5e806a['push'](_0x5e806a['shift']());}};_0x5333a7(++_0x4bac51);}(_0x95c3,0x10f));var _0x395c=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x95c3[_0xbe200f];return _0x192597;};'use strict';var _=require('lodash');var sqlUtils=require(_0x395c('0x0'));var utils=require(_0x395c('0x1'));exports[_0x395c('0x2')]=function(_0x4e87e3,_0x13b2cc,_0x3285b1,_0x500679,_0x199749){var _0x2787c1={'count':0x0,'rows':[]};var _0x27baab=sqlUtils['skipInteractionsQuery'](_0x4e87e3,_0x3285b1,_0x13b2cc);if(_0x27baab){return Promise['resolve'](_0x2787c1);}var _0x53c881=sqlUtils[_0x395c('0x3')](_0x4e87e3);var _0x4f9989={};return Promise[_0x395c('0x4')]()[_0x395c('0x5')](function(){if(_0x13b2cc[_0x395c('0x6')]){return sqlUtils[_0x395c('0x7')](_0x13b2cc['search'],_0x199749);}else{return sqlUtils[_0x395c('0x8')](_0x4e87e3,_0x13b2cc,_0x199749);}})[_0x395c('0x5')](function(_0x4b01a9){_0x53c881[_0x395c('0x9')](_0x4b01a9['body']);_0x53c881[_0x395c('0x9')](_0x4b01a9[_0x395c('0xa')]);_0x53c881[_0x395c('0x9')](_0x4b01a9['default']);_0x53c881[_0x395c('0x9')](_0x4b01a9['fields']);_0x53c881[_0x395c('0x9')](_0x4b01a9['filter']);_0x53c881[_0x395c('0x9')](_0x4b01a9[_0x395c('0xb')]);_0x53c881[_0x395c('0xc')](_0x4b01a9['read']);_0x4f9989=_0x4b01a9[_0x395c('0xd')];return sqlUtils[_0x395c('0xe')](_0x4e87e3,_0x3285b1,_0x13b2cc);})['then'](function(_0x61c4e1){_0x53c881[_0x395c('0x9')](_0x61c4e1);_0x53c881[_0x395c('0xf')]('i.id');var _0x3a5873=_0x13b2cc[_0x395c('0x6')]?_0x4f9989[_0x395c('0x10')]:_0x13b2cc[_0x395c('0x11')];return sqlUtils[_0x395c('0x12')](_0x53c881,_0x3a5873);})[_0x395c('0x5')](function(_0x2872fd){_0x2787c1[_0x395c('0x13')]=_0x2872fd[_0x395c('0x14')];if(_0x2787c1['count']===0x0){return[];}_0x53c881[_0x395c('0xc')](_0x4f9989[_0x395c('0x15')]);if(_0x500679[_0x395c('0x16')]){_0x500679[_0x395c('0x16')][_0x395c('0x17')](function(_0x3d6500){var _0x3e0485=_0x3d6500[0x0]==='contactName'?_0x3d6500[0x0]:'i.'+_0x3d6500[0x0];_0x53c881[_0x395c('0x16')](_0x3e0485,_0x3d6500[0x1]==='DESC'?![]:!![]);if(_0x3d6500[0x0]===_0x395c('0x18')){var _0x489132=sqlUtils[_0x395c('0x19')](_0x4e87e3,_0x13b2cc);_0x53c881[_0x395c('0x16')](_0x489132,_0x3d6500[0x1]===_0x395c('0x1a')?![]:!![]);}});}return sqlUtils[_0x395c('0x1b')](_0x4e87e3,_0x53c881,_0x13b2cc,_0x500679);})[_0x395c('0x5')](function(_0x2ea2f7){_0x2787c1[_0x395c('0x1c')]=_0x2ea2f7;return _0x2787c1;})['catch'](function(_0x503db6){throw _0x503db6;});};exports[_0x395c('0x1d')]=function(_0xc7f6da,_0x51e51f){return function(_0x55d34b,_0x2e64b0,_0x251668){var _0x5f1900=_0x55d34b[_0x395c('0xb')];var _0x40653c={};var _0x1b541d=_0x55d34b[_0x395c('0x1e')];if(_0x40653c){_0x40653c=_['clone'](_0x55d34b[_0x395c('0x1f')]);_0x40653c=_['omit'](_0x40653c,[_0x395c('0x1f'),_0x395c('0x20'),_0x395c('0x21'),_0x395c('0x22'),_0x395c('0x23')]);}utils['updateUser'](_0x5f1900,_0x40653c,_0x1b541d,_0xc7f6da,_0x51e51f);_0x251668(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index a3b5007..235343f 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaaa2=['isEmpty','where','QueryTypes','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','../../mysqldb','getAccountFK','role','search','field','tools_tags','getInteractionFK','_interactions','select','u.id','u.fullname','ui.','from','left_join','users','length','\x20IN\x20?','getInteractionsTables','cm_contacts','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','it.','t.id\x20=\x20it.TagId','expr','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','parseSearch','conditions','buildExpression','type','text','value','start','end','unreadMessages','read','and','Contact','operator','$substring','split','contact','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?','find','ContactId','Tag','map','tags','clause','User','name','UserId','body','plainBody','keys','compact','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','then','fields','tag','filter','capitalize','chat','Accounts','resolve','agent','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','mail','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','SELECT','sequelize','toString','keyBy','merge','attributes','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','query','groupBy','Setting','enableEmailPreview','all','clone','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','getSelectedTags'];(function(_0x3ea3ae,_0x29dd29){var _0x2aa587=function(_0x1d6dca){while(--_0x1d6dca){_0x3ea3ae['push'](_0x3ea3ae['shift']());}};_0x2aa587(++_0x29dd29);}(_0xaaa2,0xac));var _0x2aaa=function(_0x248836,_0x475ce0){_0x248836=_0x248836-0x0;var _0x4bb40b=_0xaaa2[_0x248836];return _0x4bb40b;};'use strict';var _=require(_0x2aaa('0x0'));var squel=require(_0x2aaa('0x1'));var as=require(_0x2aaa('0x2'));var qs=require(_0x2aaa('0x3'));var updateInteraction=require(_0x2aaa('0x4'))[_0x2aaa('0x5')];var utils=require('./utils');var db=require(_0x2aaa('0x6'))['db'];function skipInteractionsQuery(_0x482489,_0x35b5c8,_0x340071){var _0x4e949b=![];var _0x25cb1d=utils[_0x2aaa('0x7')](_0x482489);if(_0x35b5c8[_0x2aaa('0x8')]==='agent'&&!_0x340071[_0x2aaa('0x9')]&&!_0x340071[_0x25cb1d]){_0x4e949b=!![];}return _0x4e949b;}function getTagsQuery(){return squel['select']()['field']('id')[_0x2aaa('0xa')]('name')[_0x2aaa('0xa')]('color')['from'](_0x2aaa('0xb'));}function getUsersQuery(_0x438f88,_0x5e1347){var _0x6e1a2d=utils[_0x2aaa('0xc')](_0x438f88);var _0x2e3bd2='user_has_'+_0x438f88+_0x2aaa('0xd');var _0x1d7162=squel[_0x2aaa('0xe')]()[_0x2aaa('0xa')](_0x2aaa('0xf'))[_0x2aaa('0xa')](_0x2aaa('0x10'))[_0x2aaa('0xa')](_0x2aaa('0x11')+_0x6e1a2d)[_0x2aaa('0x12')](_0x2e3bd2,'ui')[_0x2aaa('0x13')](_0x2aaa('0x14'),'u','u.id\x20=\x20ui.UserId');if(_0x5e1347[_0x2aaa('0x15')]>0x0){_0x1d7162['where'](_0x2aaa('0x11')+_0x6e1a2d+_0x2aaa('0x16'),_['map'](_0x5e1347,'id'));}return _0x1d7162;}function getInteractionsQuery(_0x50ffea){var _0x50a767=utils[_0x2aaa('0x17')](_0x50ffea);var _0x1dc0ba=utils[_0x2aaa('0x7')](_0x50ffea);var _0x3b94bf=utils[_0x2aaa('0xc')](_0x50ffea);return squel[_0x2aaa('0xe')]()[_0x2aaa('0x12')](_0x50a767['interactions'],'i')[_0x2aaa('0x13')](_0x2aaa('0x18'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x2aaa('0x13')]('users','o','o.id\x20=\x20i.UserId')[_0x2aaa('0x13')](_0x50a767[_0x2aaa('0x19')],'a',_0x2aaa('0x1a')+_0x1dc0ba)[_0x2aaa('0x13')](_0x50a767[_0x2aaa('0x1b')],'me',_0x2aaa('0x1c')+_0x3b94bf+_0x2aaa('0x1d'))[_0x2aaa('0x13')](_0x50a767['interactionsTags'],'it',_0x2aaa('0x1e')+_0x3b94bf+_0x2aaa('0x1d'))['left_join']('tools_tags','t',_0x2aaa('0x1f'));}function getSqlClauses(){var _0x4d7151={'body':squel[_0x2aaa('0x20')](),'contact':squel[_0x2aaa('0x20')](),'default':squel['expr'](),'fields':squel[_0x2aaa('0x20')](),'filter':squel[_0x2aaa('0x20')](),'read':squel['expr'](),'tags':{'clause':squel[_0x2aaa('0x20')](),'ids':null},'user':squel[_0x2aaa('0x20')]()};return _0x4d7151;}function parseTagParameter(_0x41253c){var _0x5371cd=squel[_0x2aaa('0x20')]();if(_0x41253c){var _0x2d69fb=utils['getSelectedTags'](_0x41253c);_0x2d69fb['forEach'](function(_0x3af929){_0x5371cd['or'](_0x2aaa('0x21'),'%,'+_0x3af929+',%');});}return _0x5371cd;}function parseReadParameter(_0x2f9772){var _0xd9891d='';if(_0x2f9772){_0xd9891d=_0x2aaa('0x22');if(_0x2f9772==='1'){_0xd9891d=_0xd9891d[_0x2aaa('0x23')](_0x2aaa('0x24'),'=');}else{_0xd9891d=_0xd9891d[_0x2aaa('0x23')](_0x2aaa('0x24'),'>');}}return _0xd9891d;}function parseSearchFilter(_0x19472b,_0x39788b){var _0x3ba051=squel['expr']();if(_0x39788b){var _0x101b6e=_0x39788b['replace']('\x5c','\x5c\x5c')[_0x2aaa('0x23')](/'/g,'\x27\x27');if(qs[_0x2aaa('0x25')](_0x101b6e)){_0x3ba051['or'](_0x2aaa('0x26'),_0x101b6e+'%');if([_0x2aaa('0x27'),_0x2aaa('0x28')][_0x2aaa('0x29')](_0x19472b)){_0x3ba051['or'](_0x2aaa('0x2a'),_0x101b6e+'%');}else if(_0x19472b===_0x2aaa('0x2b')){_0x3ba051['or'](_0x2aaa('0x2c'),_0x101b6e+'%');}else if(_0x19472b===_0x2aaa('0x2d')){_0x3ba051['or']('i.from\x20LIKE\x20?',_0x101b6e+'%');}}else if(_0x19472b==='mail'&&qs['isEmail'](_0x101b6e)){_0x3ba051['or']('c.email\x20LIKE\x20?',_0x101b6e+'%');}else{if(_0x19472b==='mail'){_0x3ba051['or'](_0x2aaa('0x2e'),qs[_0x2aaa('0x2f')](_0x101b6e))['or'](_0x2aaa('0x30'),qs[_0x2aaa('0x2f')](_0x101b6e));}else{if(_0x19472b!==_0x2aaa('0x2b')){_0x3ba051['or'](_0x2aaa('0x31'),qs[_0x2aaa('0x2f')](_0x101b6e));}_0x3ba051['or'](_0x2aaa('0x32'),_0x101b6e+'%');}}}return _0x3ba051;}function parseAdvancedSearchFilter(_0x5e9fdf,_0x34353b){var _0x274e4b=getSqlClauses();var _0x535586=as[_0x2aaa('0x33')](_0x5e9fdf);var _0x1c2e27=_0x535586['sqlOperator'];for(var _0x39f8aa=0x0;_0x39f8aa<_0x535586[_0x2aaa('0x34')][_0x2aaa('0x15')];_0x39f8aa++){var _0x1915fe=_0x535586[_0x2aaa('0x34')][_0x39f8aa];var _0x278b3a='i';var _0x525802=_['find'](_0x34353b,['name',_0x1915fe[_0x2aaa('0xa')]]);if(_0x525802){var _0x4dc768=as[_0x2aaa('0x35')](_0x278b3a,_0x525802[_0x2aaa('0x36')],_0x1915fe);_0x274e4b['default'][_0x1c2e27](_0x4dc768[_0x2aaa('0x37')],_0x4dc768[_0x2aaa('0x38')][_0x2aaa('0x39')],_0x4dc768['value'][_0x2aaa('0x3a')]);}else{switch(_0x1915fe[_0x2aaa('0xa')]){case _0x2aaa('0x3b'):var _0x1da9e9=parseReadParameter(_0x1915fe['value']);_0x274e4b[_0x2aaa('0x3c')][_0x2aaa('0x3d')](_0x1da9e9);break;case _0x2aaa('0x3e'):if(_0x1915fe[_0x2aaa('0x3f')]===_0x2aaa('0x40')){if(_0x1915fe[_0x2aaa('0x38')][_0x2aaa('0x41')]('\x20')[_0x2aaa('0x15')]>0x1){_0x274e4b[_0x2aaa('0x42')][_0x1c2e27](_0x2aaa('0x43'),qs[_0x2aaa('0x2f')](_0x1915fe[_0x2aaa('0x38')]),null);}else{var _0x1fc05f='%'+_0x1915fe['value']+'%';_0x274e4b[_0x2aaa('0x42')][_0x1c2e27](_0x2aaa('0x44'),_0x1fc05f,_0x1fc05f,_0x1fc05f);}}else{_0x525802=_[_0x2aaa('0x45')](_0x34353b,['name',_0x2aaa('0x46')]);_0x1915fe[_0x2aaa('0xa')]=_0x2aaa('0x46');_0x4dc768=as['buildExpression'](_0x278b3a,_0x525802[_0x2aaa('0x36')],_0x1915fe);_0x274e4b[_0x2aaa('0x42')][_0x1c2e27](_0x4dc768[_0x2aaa('0x37')],_0x4dc768['value']['start'],_0x4dc768[_0x2aaa('0x38')][_0x2aaa('0x3a')]);}break;case _0x2aaa('0x47'):var _0x4cee1a=_0x1915fe[_0x2aaa('0x38')][_0x2aaa('0x41')](',')[_0x2aaa('0x48')](function(_0x2d639a){return Number(_0x2d639a);});var _0x29556c=parseTagParameter(_0x4cee1a);_0x274e4b[_0x2aaa('0x49')][_0x2aaa('0x4a')][_0x2aaa('0x3d')](_0x29556c);_0x274e4b['tags']['ids']=_0x4cee1a;break;case _0x2aaa('0x4b'):if(_0x1915fe['operator']===_0x2aaa('0x40')){_0x274e4b['user'][_0x1c2e27]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1915fe['value']+'%',null);}else{_0x525802=_[_0x2aaa('0x45')](_0x34353b,[_0x2aaa('0x4c'),'UserId']);_0x1915fe[_0x2aaa('0xa')]=_0x2aaa('0x4d');_0x4dc768=as['buildExpression'](_0x278b3a,_0x525802[_0x2aaa('0x36')],_0x1915fe);_0x274e4b['user'][_0x1c2e27](_0x4dc768[_0x2aaa('0x37')],_0x4dc768[_0x2aaa('0x38')]['start'],_0x4dc768[_0x2aaa('0x38')][_0x2aaa('0x3a')]);}break;case _0x2aaa('0x4e'):case _0x2aaa('0x4f'):_0x4dc768=as[_0x2aaa('0x35')]('me',null,_0x1915fe);_0x274e4b['body'][_0x1c2e27](_0x4dc768['text'],_0x4dc768['value'][_0x2aaa('0x39')],_0x4dc768[_0x2aaa('0x38')][_0x2aaa('0x3a')]);break;}}}return _0x274e4b;}function parseModelFields(_0x393073,_0x23290d,_0x2b3774){var _0x33be5f=utils[_0x2aaa('0x7')](_0x393073);var _0x17cf10=squel['expr']();var _0x22ccf0=_(_0x23290d)[_0x2aaa('0x50')]()[_0x2aaa('0x48')](function(_0xdf8683){return _['some'](_0x2b3774,[_0x2aaa('0x4c'),_0xdf8683])?_0xdf8683:undefined;})[_0x2aaa('0x51')]()[_0x2aaa('0x38')]();if(_0x22ccf0['length']>0x0){_0x22ccf0['forEach'](function(_0x1d29b6){if(_0x1d29b6===_0x33be5f){_0x17cf10[_0x2aaa('0x3d')]('i.'+_0x33be5f+_0x2aaa('0x16'),[][_0x2aaa('0x52')](_0x23290d[_0x1d29b6]));}else if(_0x1d29b6==='createdAt'){var _0x4f6707=JSON['parse'](_0x23290d[_0x1d29b6])['$gte'];var _0x2bac06=JSON[_0x2aaa('0x53')](_0x23290d[_0x1d29b6])[_0x2aaa('0x54')];_0x17cf10['and'](_0x2aaa('0x55'),_0x4f6707,_0x2bac06);}else{if(_0x23290d[_0x1d29b6]===_0x2aaa('0x56')){_0x17cf10[_0x2aaa('0x3d')]('i.'+_0x1d29b6+_0x2aaa('0x57'));}else{_0x17cf10[_0x2aaa('0x3d')]('i.'+_0x1d29b6+_0x2aaa('0x58'),_0x23290d[_0x1d29b6]);}}});}return _0x17cf10;}function parseQueryParameters(_0x1c74de,_0x5f3ebb,_0x2982f0){var _0x521844=getSqlClauses();return Promise['resolve']()[_0x2aaa('0x59')](function(){return parseModelFields(_0x1c74de,_0x5f3ebb,_0x2982f0);})[_0x2aaa('0x59')](function(_0x41aa0e){_0x521844[_0x2aaa('0x5a')][_0x2aaa('0x3d')](_0x41aa0e);return parseReadParameter(_0x5f3ebb['read']);})[_0x2aaa('0x59')](function(_0x29fd41){_0x521844[_0x2aaa('0x3c')][_0x2aaa('0x3d')](_0x29fd41);return parseTagParameter(_0x5f3ebb[_0x2aaa('0x5b')]);})[_0x2aaa('0x59')](function(_0x474e75){_0x521844[_0x2aaa('0x49')][_0x2aaa('0x4a')][_0x2aaa('0x3d')](_0x474e75);return parseSearchFilter(_0x1c74de,_0x5f3ebb[_0x2aaa('0x5c')]);})[_0x2aaa('0x59')](function(_0x2f13ee){_0x521844[_0x2aaa('0x5c')]=_0x2f13ee;return _0x521844;});}function checkAccountsRestrictions(_0x142f53,_0x5c9edb,_0x30a7f6){var _0x21426c=utils['getAccountFK'](_0x142f53);var _0x4437f5='get'+_[_0x2aaa('0x5d')](_0x142f53)+(_0x142f53===_0x2aaa('0x5e')?'Websites':_0x2aaa('0x5f'));var _0x3f446a=squel[_0x2aaa('0x20')]();return Promise[_0x2aaa('0x60')]()['then'](function(){if(_0x30a7f6[_0x2aaa('0x9')]&&_0x5c9edb['role']===_0x2aaa('0x61')){return _0x5c9edb[_0x4437f5]({'attributes':['id'],'raw':!![]});}})[_0x2aaa('0x59')](function(_0x4c0d44){if(_0x4c0d44){if(_0x4c0d44[_0x2aaa('0x15')]===0x0){_0x3f446a[_0x2aaa('0x3d')]('i.'+_0x21426c+_0x2aaa('0x57'));}else{_0x3f446a[_0x2aaa('0x3d')]('i.'+_0x21426c+_0x2aaa('0x16'),_[_0x2aaa('0x48')](_0x4c0d44,'id'));}}else if(!_0x30a7f6[_0x21426c]){_0x3f446a[_0x2aaa('0x3d')]('i.'+_0x21426c+_0x2aaa('0x62'));}})[_0x2aaa('0x59')](function(){return _0x3f446a;});}function getClosedOrderClause(_0x48585a,_0x142645){var _0x558882='';var _0x1bc03f=[_0x2aaa('0x63'),_0x2aaa('0x64'),_0x2aaa('0x65')];if(_0x48585a===_0x2aaa('0x66')){_0x1bc03f[_0x2aaa('0x67')](_0x2aaa('0x68'));}if(_0x142645['closed']==='0'&&_0x48585a==='mail'){_0x558882=_0x2aaa('0x68');}else{if(_0x142645[_0x2aaa('0x69')]==='1'){_0x1bc03f[_0x2aaa('0x6a')]();}_0x558882=_0x2aaa('0x6b')+_0x1bc03f[_0x2aaa('0x6c')](',\x20')+')';}return _0x558882;}function getFilteredInteractions(_0x487cc3,_0x5598e4,_0x59b574,_0x2426da){var _0xcb7dff=utils[_0x2aaa('0xc')](_0x487cc3);var _0x1726f2=_[_0x2aaa('0x5d')](_0x487cc3)+_0x2aaa('0x6d');var _0x2b6eca=[];var _0x4926c4=getTagsQuery();var _0x2fca31={'type':db[_0x2aaa('0x6e')]['QueryTypes'][_0x2aaa('0x6f')],'raw':!![]};var _0x47dd6b=[];var _0x22741a=[];return db[_0x2aaa('0x70')]['query'](_0x4926c4[_0x2aaa('0x71')](),_0x2fca31)['then'](function(_0x9530c){_0x2b6eca=_[_0x2aaa('0x72')](_0x9530c,'id');_0x2fca31=_[_0x2aaa('0x73')](_0x2fca31,{'model':db[_0x1726f2],'mapToModel':!![],'nest':!![]});if(_0x59b574['fields']){_0x2426da[_0x2aaa('0x74')]['forEach'](function(_0x23c076){_0x5598e4['field']('i.'+_0x23c076);});}else{_0x5598e4[_0x2aaa('0xa')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x2aaa('0x3b'));_0x5598e4[_0x2aaa('0xa')](_0x2aaa('0x75'),_0x2aaa('0x76'));_0x5598e4[_0x2aaa('0xa')](_0x2aaa('0x77'),_0x2aaa('0x78'));if(_0x487cc3===_0x2aaa('0x66')){_0x5598e4['field'](_0x2aaa('0x79'),_0x2aaa('0x7a'));_0x5598e4[_0x2aaa('0xa')](_0x2aaa('0x7b'),_0x2aaa('0x7c'));_0x5598e4[_0x2aaa('0xa')](_0x2aaa('0x7d'));_0x5598e4[_0x2aaa('0xa')]('i.createdAt');_0x5598e4[_0x2aaa('0xa')](_0x2aaa('0x7e'));_0x5598e4['field'](_0x2aaa('0x7f'));_0x5598e4['field']('i.closedAt');_0x5598e4[_0x2aaa('0xa')](_0x2aaa('0x80'));_0x5598e4['field'](_0x2aaa('0x81'));_0x5598e4['field'](_0x2aaa('0x82'));_0x5598e4[_0x2aaa('0xa')](_0x2aaa('0x83'));_0x5598e4[_0x2aaa('0xa')](_0x2aaa('0x65'));_0x5598e4[_0x2aaa('0xa')](_0x2aaa('0x64'));_0x5598e4[_0x2aaa('0xa')](_0x2aaa('0x63'));_0x5598e4[_0x2aaa('0xa')](_0x2aaa('0x68'));_0x5598e4[_0x2aaa('0xa')](_0x2aaa('0x84'));_0x5598e4[_0x2aaa('0xa')](_0x2aaa('0x85'));_0x5598e4[_0x2aaa('0xa')]('i.MailAccountId');_0x5598e4['field'](_0x2aaa('0x86'));}else if(_0x487cc3===_0x2aaa('0x2d')){_0x5598e4[_0x2aaa('0xa')](_0x2aaa('0x87'),_0x2aaa('0x7c'));}else{_0x5598e4['field'](_0x2aaa('0x88'),_0x2aaa('0x7c'));}if(_0x487cc3!==_0x2aaa('0x66')){_0x5598e4[_0x2aaa('0xa')](_0x2aaa('0x89'));}_0x5598e4['field'](_0x2aaa('0x8a'),_0x2aaa('0x8b'));_0x5598e4[_0x2aaa('0xa')](_0x2aaa('0x8c'),_0x2aaa('0x8d'));_0x5598e4['field'](_0x2aaa('0x8e'),'Contact.email');_0x5598e4[_0x2aaa('0xa')](_0x2aaa('0x8f'),'Contact.phone');_0x5598e4[_0x2aaa('0xa')](_0x2aaa('0x90'),_0x2aaa('0x91'));_0x5598e4[_0x2aaa('0xa')](_0x2aaa('0x92'),_0x2aaa('0x93'));_0x5598e4['field'](_0x2aaa('0x94'),'Owner.fullname');_0x5598e4[_0x2aaa('0xa')](_0x2aaa('0x95'),_0x2aaa('0x96'));_0x5598e4[_0x2aaa('0xa')](_0x2aaa('0x97'),_0x2aaa('0x98'));}if(_0x2426da['limit']){_0x5598e4[_0x2aaa('0x99')](_0x2426da[_0x2aaa('0x99')]);}if(_0x2426da[_0x2aaa('0x9a')]){_0x5598e4[_0x2aaa('0x9a')](_0x2426da[_0x2aaa('0x9a')]);}return db[_0x2aaa('0x70')][_0x2aaa('0x9b')](_0x5598e4[_0x2aaa('0x71')](),_0x2fca31);})[_0x2aaa('0x59')](function(_0x412d68){_0x47dd6b=_0x412d68;var _0x178c50=getUsersQuery(_0x487cc3,_0x47dd6b);return db[_0x2aaa('0x70')][_0x2aaa('0x9b')](_0x178c50[_0x2aaa('0x71')](),_0x2fca31);})[_0x2aaa('0x59')](function(_0x3a3d0b){_0x22741a=_[_0x2aaa('0x9c')](_0x3a3d0b,_0xcb7dff);if(_0x487cc3===_0x2aaa('0x66')){return db[_0x2aaa('0x9d')]['findOne']({'attributes':[_0x2aaa('0x9e')],'raw':!![]});}})['then'](function(_0x11ddcf){var _0x5d5e1e=_0x11ddcf?_0x11ddcf[_0x2aaa('0x9e')]:undefined;var _0x3d0fa0=_0x47dd6b['map'](function(_0x3a2d83){return updateInteraction(_0x3a2d83,_0x2b6eca,_0x22741a,_0x5d5e1e);});return Promise[_0x2aaa('0x9f')](_0x3d0fa0);});}function countFilteredInteractions(_0x45052e,_0x44cce4){var _0x1384ba=_0x45052e[_0x2aaa('0xa0')]();_0x1384ba[_0x2aaa('0xa')](_0x2aaa('0xa1'));_0x1384ba['field'](_0x2aaa('0xa2'),_0x2aaa('0x3b'));var _0x2b98d0=utils[_0x2aaa('0xa3')](_0x44cce4);if(!_[_0x2aaa('0xa4')](_0x2b98d0)){_0x1384ba[_0x2aaa('0xa5')]('t.id\x20IN\x20?',_0x2b98d0);}var _0x1d908f={'type':db[_0x2aaa('0x6e')][_0x2aaa('0xa6')][_0x2aaa('0x6f')],'raw':!![]};return db[_0x2aaa('0x70')][_0x2aaa('0x9b')](_0x1384ba[_0x2aaa('0x71')](),_0x1d908f);}module[_0x2aaa('0xa7')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x55ea=['toString','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','contactName','i.createdAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.thirdDisposition','i.substatus','i.to','i.UserId','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','Sequelize','exports','lodash','squel','../parsers/advancedSearch','./update-interaction','updateInteraction','./utils','../../mysqldb','agent','search','select','field','name','color','from','getInteractionFK','user_has_','u.id','u.fullname','ui.','left_join','users','length','where','\x20IN\x20?','map','getInteractionsTables','interactions','cm_contacts','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','it.','tools_tags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','replace','isNumeric','i.id\x20LIKE\x20?','whatsapp','includes','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','isEmail','mail','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','buildExpression','text','value','start','end','unreadMessages','read','and','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','Tag','split','tags','clause','user','UserId','body','plainBody','some','compact','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','filter','getAccountFK','get','capitalize','chat','Websites','Accounts','role','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','unshift','CONCAT_WS(\x27\x27,\x20','join','QueryTypes','SELECT','query'];(function(_0x2d76c1,_0x108a0a){var _0x304845=function(_0x565c24){while(--_0x565c24){_0x2d76c1['push'](_0x2d76c1['shift']());}};_0x304845(++_0x108a0a);}(_0x55ea,0xc9));var _0xa55e=function(_0x1727f8,_0x1fbd8d){_0x1727f8=_0x1727f8-0x0;var _0x29014e=_0x55ea[_0x1727f8];return _0x29014e;};'use strict';var _=require(_0xa55e('0x0'));var squel=require(_0xa55e('0x1'));var as=require(_0xa55e('0x2'));var qs=require('../parsers/qs');var updateInteraction=require(_0xa55e('0x3'))[_0xa55e('0x4')];var utils=require(_0xa55e('0x5'));var db=require(_0xa55e('0x6'))['db'];function skipInteractionsQuery(_0x95af3d,_0x54f178,_0x2d1040){var _0x56ca45=![];var _0x515646=utils['getAccountFK'](_0x95af3d);if(_0x54f178['role']===_0xa55e('0x7')&&!_0x2d1040[_0xa55e('0x8')]&&!_0x2d1040[_0x515646]){_0x56ca45=!![];}return _0x56ca45;}function getTagsQuery(){return squel[_0xa55e('0x9')]()[_0xa55e('0xa')]('id')[_0xa55e('0xa')](_0xa55e('0xb'))[_0xa55e('0xa')](_0xa55e('0xc'))[_0xa55e('0xd')]('tools_tags');}function getUsersQuery(_0x5e38fa,_0x13f6d7){var _0x15ec5e=utils[_0xa55e('0xe')](_0x5e38fa);var _0x8cdcf0=_0xa55e('0xf')+_0x5e38fa+'_interactions';var _0x1c1ca3=squel['select']()[_0xa55e('0xa')](_0xa55e('0x10'))[_0xa55e('0xa')](_0xa55e('0x11'))[_0xa55e('0xa')](_0xa55e('0x12')+_0x15ec5e)[_0xa55e('0xd')](_0x8cdcf0,'ui')[_0xa55e('0x13')](_0xa55e('0x14'),'u','u.id\x20=\x20ui.UserId');if(_0x13f6d7[_0xa55e('0x15')]>0x0){_0x1c1ca3[_0xa55e('0x16')](_0xa55e('0x12')+_0x15ec5e+_0xa55e('0x17'),_[_0xa55e('0x18')](_0x13f6d7,'id'));}return _0x1c1ca3;}function getInteractionsQuery(_0x339f1e){var _0x585d3a=utils[_0xa55e('0x19')](_0x339f1e);var _0x5dbfe6=utils['getAccountFK'](_0x339f1e);var _0x4599b9=utils[_0xa55e('0xe')](_0x339f1e);return squel[_0xa55e('0x9')]()[_0xa55e('0xd')](_0x585d3a[_0xa55e('0x1a')],'i')['left_join'](_0xa55e('0x1b'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xa55e('0x14'),'o',_0xa55e('0x1c'))[_0xa55e('0x13')](_0x585d3a[_0xa55e('0x1d')],'a',_0xa55e('0x1e')+_0x5dbfe6)[_0xa55e('0x13')](_0x585d3a[_0xa55e('0x1f')],'me',_0xa55e('0x20')+_0x4599b9+_0xa55e('0x21'))['left_join'](_0x585d3a['interactionsTags'],'it',_0xa55e('0x22')+_0x4599b9+'\x20=\x20i.id')[_0xa55e('0x13')](_0xa55e('0x23'),'t',_0xa55e('0x24'));}function getSqlClauses(){var _0x2842a6={'body':squel[_0xa55e('0x25')](),'contact':squel[_0xa55e('0x25')](),'default':squel[_0xa55e('0x25')](),'fields':squel[_0xa55e('0x25')](),'filter':squel[_0xa55e('0x25')](),'read':squel[_0xa55e('0x25')](),'tags':{'clause':squel[_0xa55e('0x25')](),'ids':null},'user':squel[_0xa55e('0x25')]()};return _0x2842a6;}function parseTagParameter(_0xa05c41){var _0x25142c=squel[_0xa55e('0x25')]();if(_0xa05c41){var _0x50738b=utils[_0xa55e('0x26')](_0xa05c41);_0x50738b[_0xa55e('0x27')](function(_0x875010){_0x25142c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x875010+',%');});}return _0x25142c;}function parseReadParameter(_0x5c218d){var _0x164b55='';if(_0x5c218d){_0x164b55='unreadMessages\x20{OPERATOR}\x200';if(_0x5c218d==='1'){_0x164b55=_0x164b55[_0xa55e('0x28')]('{OPERATOR}','=');}else{_0x164b55=_0x164b55[_0xa55e('0x28')]('{OPERATOR}','>');}}return _0x164b55;}function parseSearchFilter(_0x2758ca,_0x532b13){var _0x231a87=squel[_0xa55e('0x25')]();if(_0x532b13){var _0x4a03ef=_0x532b13[_0xa55e('0x28')]('\x5c','\x5c\x5c')[_0xa55e('0x28')](/'/g,'\x27\x27');if(qs[_0xa55e('0x29')](_0x4a03ef)){_0x231a87['or'](_0xa55e('0x2a'),_0x4a03ef+'%');if(['sms',_0xa55e('0x2b')][_0xa55e('0x2c')](_0x2758ca)){_0x231a87['or']('i.phone\x20LIKE\x20?',_0x4a03ef+'%');}else if(_0x2758ca===_0xa55e('0x2d')){_0x231a87['or'](_0xa55e('0x2e'),_0x4a03ef+'%');}else if(_0x2758ca===_0xa55e('0x2f')){_0x231a87['or'](_0xa55e('0x30'),_0x4a03ef+'%');}}else if(_0x2758ca==='mail'&&qs[_0xa55e('0x31')](_0x4a03ef)){_0x231a87['or']('c.email\x20LIKE\x20?',_0x4a03ef+'%');}else{if(_0x2758ca===_0xa55e('0x32')){_0x231a87['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa55e('0x33')](_0x4a03ef))['or'](_0xa55e('0x34'),qs[_0xa55e('0x33')](_0x4a03ef));}else{if(_0x2758ca!==_0xa55e('0x2d')){_0x231a87['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa55e('0x33')](_0x4a03ef));}_0x231a87['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x4a03ef+'%');}}}return _0x231a87;}function parseAdvancedSearchFilter(_0x15e6e2,_0x138387){var _0x7999ac=getSqlClauses();var _0x56922b=as[_0xa55e('0x35')](_0x15e6e2);var _0x40d00e=_0x56922b[_0xa55e('0x36')];for(var _0x3a579f=0x0;_0x3a579f<_0x56922b[_0xa55e('0x37')][_0xa55e('0x15')];_0x3a579f++){var _0x48d3b5=_0x56922b['conditions'][_0x3a579f];var _0x43bfd9='i';var _0x3c7264=_[_0xa55e('0x38')](_0x138387,[_0xa55e('0xb'),_0x48d3b5[_0xa55e('0xa')]]);if(_0x3c7264){var _0x2b0207=as[_0xa55e('0x39')](_0x43bfd9,_0x3c7264['type'],_0x48d3b5);_0x7999ac['default'][_0x40d00e](_0x2b0207[_0xa55e('0x3a')],_0x2b0207[_0xa55e('0x3b')][_0xa55e('0x3c')],_0x2b0207[_0xa55e('0x3b')][_0xa55e('0x3d')]);}else{switch(_0x48d3b5[_0xa55e('0xa')]){case _0xa55e('0x3e'):var _0x368e71=parseReadParameter(_0x48d3b5[_0xa55e('0x3b')]);_0x7999ac[_0xa55e('0x3f')][_0xa55e('0x40')](_0x368e71);break;case'Contact':if(_0x48d3b5[_0xa55e('0x41')]===_0xa55e('0x42')){if(_0x48d3b5[_0xa55e('0x3b')]['split']('\x20')[_0xa55e('0x15')]>0x1){_0x7999ac['contact'][_0x40d00e](_0xa55e('0x43'),qs[_0xa55e('0x33')](_0x48d3b5[_0xa55e('0x3b')]),null);}else{var _0x164928='%'+_0x48d3b5[_0xa55e('0x3b')]+'%';_0x7999ac[_0xa55e('0x44')][_0x40d00e](_0xa55e('0x45'),_0x164928,_0x164928,_0x164928);}}else{_0x3c7264=_['find'](_0x138387,['name',_0xa55e('0x46')]);_0x48d3b5[_0xa55e('0xa')]=_0xa55e('0x46');_0x2b0207=as['buildExpression'](_0x43bfd9,_0x3c7264[_0xa55e('0x47')],_0x48d3b5);_0x7999ac[_0xa55e('0x44')][_0x40d00e](_0x2b0207[_0xa55e('0x3a')],_0x2b0207[_0xa55e('0x3b')][_0xa55e('0x3c')],_0x2b0207[_0xa55e('0x3b')][_0xa55e('0x3d')]);}break;case _0xa55e('0x48'):var _0x5c1120=_0x48d3b5['value'][_0xa55e('0x49')](',')[_0xa55e('0x18')](function(_0x186dc2){return Number(_0x186dc2);});var _0xdf8b93=parseTagParameter(_0x5c1120);_0x7999ac[_0xa55e('0x4a')][_0xa55e('0x4b')][_0xa55e('0x40')](_0xdf8b93);_0x7999ac[_0xa55e('0x4a')]['ids']=_0x5c1120;break;case'User':if(_0x48d3b5[_0xa55e('0x41')]==='$substring'){_0x7999ac[_0xa55e('0x4c')][_0x40d00e]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x48d3b5['value']+'%',null);}else{_0x3c7264=_[_0xa55e('0x38')](_0x138387,[_0xa55e('0xb'),'UserId']);_0x48d3b5['field']=_0xa55e('0x4d');_0x2b0207=as[_0xa55e('0x39')](_0x43bfd9,_0x3c7264[_0xa55e('0x47')],_0x48d3b5);_0x7999ac[_0xa55e('0x4c')][_0x40d00e](_0x2b0207[_0xa55e('0x3a')],_0x2b0207[_0xa55e('0x3b')]['start'],_0x2b0207['value'][_0xa55e('0x3d')]);}break;case _0xa55e('0x4e'):case _0xa55e('0x4f'):_0x2b0207=as[_0xa55e('0x39')]('me',null,_0x48d3b5);_0x7999ac[_0xa55e('0x4e')][_0x40d00e](_0x2b0207[_0xa55e('0x3a')],_0x2b0207['value'][_0xa55e('0x3c')],_0x2b0207[_0xa55e('0x3b')][_0xa55e('0x3d')]);break;}}}return _0x7999ac;}function parseModelFields(_0x1de3a8,_0x338018,_0x3e2ee){var _0x59dd5c=utils['getAccountFK'](_0x1de3a8);var _0x395e73=squel['expr']();var _0x2f51d9=_(_0x338018)['keys']()[_0xa55e('0x18')](function(_0x1b8286){return _[_0xa55e('0x50')](_0x3e2ee,[_0xa55e('0xb'),_0x1b8286])?_0x1b8286:undefined;})[_0xa55e('0x51')]()[_0xa55e('0x3b')]();if(_0x2f51d9[_0xa55e('0x15')]>0x0){_0x2f51d9[_0xa55e('0x27')](function(_0x5a124f){if(_0x5a124f===_0x59dd5c){_0x395e73[_0xa55e('0x40')]('i.'+_0x59dd5c+_0xa55e('0x17'),[][_0xa55e('0x52')](_0x338018[_0x5a124f]));}else if(_0x5a124f===_0xa55e('0x53')){var _0x1469b1=JSON[_0xa55e('0x54')](_0x338018[_0x5a124f])['$gte'];var _0x1997d1=JSON[_0xa55e('0x54')](_0x338018[_0x5a124f])[_0xa55e('0x55')];_0x395e73[_0xa55e('0x40')](_0xa55e('0x56'),_0x1469b1,_0x1997d1);}else{if(_0x338018[_0x5a124f]===_0xa55e('0x57')){_0x395e73['and']('i.'+_0x5a124f+_0xa55e('0x58'));}else{_0x395e73['and']('i.'+_0x5a124f+_0xa55e('0x59'),_0x338018[_0x5a124f]);}}});}return _0x395e73;}function parseQueryParameters(_0x17b18b,_0x8dc49d,_0x2f9e72){var _0xa01634=getSqlClauses();return Promise[_0xa55e('0x5a')]()['then'](function(){return parseModelFields(_0x17b18b,_0x8dc49d,_0x2f9e72);})[_0xa55e('0x5b')](function(_0x496ae0){_0xa01634[_0xa55e('0x5c')][_0xa55e('0x40')](_0x496ae0);return parseReadParameter(_0x8dc49d['read']);})[_0xa55e('0x5b')](function(_0x1239b8){_0xa01634[_0xa55e('0x3f')][_0xa55e('0x40')](_0x1239b8);return parseTagParameter(_0x8dc49d[_0xa55e('0x5d')]);})[_0xa55e('0x5b')](function(_0xb5ad5c){_0xa01634['tags'][_0xa55e('0x4b')][_0xa55e('0x40')](_0xb5ad5c);return parseSearchFilter(_0x17b18b,_0x8dc49d[_0xa55e('0x5e')]);})['then'](function(_0x467ea7){_0xa01634[_0xa55e('0x5e')]=_0x467ea7;return _0xa01634;});}function checkAccountsRestrictions(_0x2aeae3,_0x4c8e9e,_0x129a50){var _0x12c5a0=utils[_0xa55e('0x5f')](_0x2aeae3);var _0x2a6a1f=_0xa55e('0x60')+_[_0xa55e('0x61')](_0x2aeae3)+(_0x2aeae3===_0xa55e('0x62')?_0xa55e('0x63'):_0xa55e('0x64'));var _0x3de3a0=squel[_0xa55e('0x25')]();return Promise['resolve']()[_0xa55e('0x5b')](function(){if(_0x129a50['search']&&_0x4c8e9e[_0xa55e('0x65')]===_0xa55e('0x7')){return _0x4c8e9e[_0x2a6a1f]({'attributes':['id'],'raw':!![]});}})[_0xa55e('0x5b')](function(_0x3e9e10){if(_0x3e9e10){if(_0x3e9e10[_0xa55e('0x15')]===0x0){_0x3de3a0[_0xa55e('0x40')]('i.'+_0x12c5a0+_0xa55e('0x58'));}else{_0x3de3a0[_0xa55e('0x40')]('i.'+_0x12c5a0+_0xa55e('0x17'),_[_0xa55e('0x18')](_0x3e9e10,'id'));}}else if(!_0x129a50[_0x12c5a0]){_0x3de3a0[_0xa55e('0x40')]('i.'+_0x12c5a0+_0xa55e('0x66'));}})[_0xa55e('0x5b')](function(){return _0x3de3a0;});}function getClosedOrderClause(_0x17bbc6,_0x73d27f){var _0x448641='';var _0x4fd475=['i.thirdDisposition',_0xa55e('0x67'),_0xa55e('0x68')];if(_0x17bbc6===_0xa55e('0x32')){_0x4fd475[_0xa55e('0x69')]('i.substatus');}if(_0x73d27f['closed']==='0'&&_0x17bbc6===_0xa55e('0x32')){_0x448641='i.substatus';}else{if(_0x73d27f['closed']==='1'){_0x4fd475['shift']();}_0x448641=_0xa55e('0x6a')+_0x4fd475[_0xa55e('0x6b')](',\x20')+')';}return _0x448641;}function getFilteredInteractions(_0x32c1a3,_0x2534c8,_0x4531d0,_0x909ec4){var _0x3e4ce3=utils[_0xa55e('0xe')](_0x32c1a3);var _0x53a064=_[_0xa55e('0x61')](_0x32c1a3)+'Interaction';var _0x100633=[];var _0x3dea8c=getTagsQuery();var _0x1fbd58={'type':db['Sequelize'][_0xa55e('0x6c')][_0xa55e('0x6d')],'raw':!![]};var _0x3dab7b=[];var _0x24d7c8=[];return db['sequelize'][_0xa55e('0x6e')](_0x3dea8c[_0xa55e('0x6f')](),_0x1fbd58)[_0xa55e('0x5b')](function(_0x557df1){_0x100633=_['keyBy'](_0x557df1,'id');_0x1fbd58=_[_0xa55e('0x70')](_0x1fbd58,{'model':db[_0x53a064],'mapToModel':!![],'nest':!![]});if(_0x4531d0['fields']){_0x909ec4[_0xa55e('0x71')]['forEach'](function(_0xd0a742){_0x2534c8[_0xa55e('0xa')]('i.'+_0xd0a742);});}else{_0x2534c8['field'](_0xa55e('0x72'),'unreadMessages');_0x2534c8[_0xa55e('0xa')](_0xa55e('0x73'),'Account.key');_0x2534c8[_0xa55e('0xa')](_0xa55e('0x74'),_0xa55e('0x75'));if(_0x32c1a3===_0xa55e('0x32')){_0x2534c8[_0xa55e('0xa')](_0xa55e('0x76'),_0xa55e('0x77'));_0x2534c8[_0xa55e('0xa')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xa55e('0x78'));_0x2534c8[_0xa55e('0xa')]('i.id');_0x2534c8[_0xa55e('0xa')](_0xa55e('0x79'));_0x2534c8['field']('i.updatedAt');_0x2534c8['field'](_0xa55e('0x7a'));_0x2534c8[_0xa55e('0xa')](_0xa55e('0x7b'));_0x2534c8[_0xa55e('0xa')](_0xa55e('0x7c'));_0x2534c8[_0xa55e('0xa')]('i.lastMsgAt');_0x2534c8[_0xa55e('0xa')](_0xa55e('0x7d'));_0x2534c8[_0xa55e('0xa')](_0xa55e('0x7e'));_0x2534c8['field'](_0xa55e('0x68'));_0x2534c8[_0xa55e('0xa')](_0xa55e('0x67'));_0x2534c8[_0xa55e('0xa')](_0xa55e('0x7f'));_0x2534c8[_0xa55e('0xa')](_0xa55e('0x80'));_0x2534c8[_0xa55e('0xa')](_0xa55e('0x81'));_0x2534c8[_0xa55e('0xa')]('i.ContactId');_0x2534c8[_0xa55e('0xa')]('i.MailAccountId');_0x2534c8[_0xa55e('0xa')](_0xa55e('0x82'));}else if(_0x32c1a3===_0xa55e('0x2f')){_0x2534c8[_0xa55e('0xa')]('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',_0xa55e('0x78'));}else{_0x2534c8[_0xa55e('0xa')](_0xa55e('0x83'),_0xa55e('0x78'));}if(_0x32c1a3!=='mail'){_0x2534c8[_0xa55e('0xa')]('i.*');}_0x2534c8[_0xa55e('0xa')](_0xa55e('0x84'),'Contact.firstName');_0x2534c8[_0xa55e('0xa')]('c.lastName',_0xa55e('0x85'));_0x2534c8[_0xa55e('0xa')]('c.email','Contact.email');_0x2534c8[_0xa55e('0xa')](_0xa55e('0x86'),_0xa55e('0x87'));_0x2534c8['field'](_0xa55e('0x88'),_0xa55e('0x89'));_0x2534c8['field'](_0xa55e('0x8a'),_0xa55e('0x8b'));_0x2534c8['field'](_0xa55e('0x8c'),_0xa55e('0x8d'));_0x2534c8[_0xa55e('0xa')]('o.internal','Owner.internal');_0x2534c8[_0xa55e('0xa')](_0xa55e('0x8e'),_0xa55e('0x8f'));}if(_0x909ec4[_0xa55e('0x90')]){_0x2534c8[_0xa55e('0x90')](_0x909ec4['limit']);}if(_0x909ec4['offset']){_0x2534c8['offset'](_0x909ec4[_0xa55e('0x91')]);}return db[_0xa55e('0x92')][_0xa55e('0x6e')](_0x2534c8[_0xa55e('0x6f')](),_0x1fbd58);})[_0xa55e('0x5b')](function(_0x5eb9e0){_0x3dab7b=_0x5eb9e0;var _0x2d5b31=getUsersQuery(_0x32c1a3,_0x3dab7b);return db[_0xa55e('0x92')][_0xa55e('0x6e')](_0x2d5b31[_0xa55e('0x6f')](),_0x1fbd58);})[_0xa55e('0x5b')](function(_0x4d1a3f){_0x24d7c8=_[_0xa55e('0x93')](_0x4d1a3f,_0x3e4ce3);if(_0x32c1a3===_0xa55e('0x32')){return db[_0xa55e('0x94')][_0xa55e('0x95')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0xa55e('0x5b')](function(_0x4af836){var _0x1f17fc=_0x4af836?_0x4af836[_0xa55e('0x96')]:undefined;var _0x23986e=_0x3dab7b[_0xa55e('0x18')](function(_0x25d487){return updateInteraction(_0x25d487,_0x100633,_0x24d7c8,_0x1f17fc);});return Promise[_0xa55e('0x97')](_0x23986e);});}function countFilteredInteractions(_0x73d562,_0x2a73dc){var _0x462307=_0x73d562[_0xa55e('0x98')]();_0x462307['field'](_0xa55e('0x99'));_0x462307[_0xa55e('0xa')](_0xa55e('0x72'),_0xa55e('0x3e'));var _0x274b98=utils[_0xa55e('0x26')](_0x2a73dc);if(!_['isEmpty'](_0x274b98)){_0x462307[_0xa55e('0x16')]('t.id\x20IN\x20?',_0x274b98);}var _0x1ca718={'type':db[_0xa55e('0x9a')][_0xa55e('0x6c')][_0xa55e('0x6d')],'raw':!![]};return db[_0xa55e('0x92')][_0xa55e('0x6e')](_0x462307[_0xa55e('0x6f')](),_0x1ca718);}module[_0xa55e('0x9b')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 81bfade..2c86e42 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x913c=['map','fullname','split','forEach','waiting','answered','unmanaged','total','closed','abandoned','talking','disposition','UserId','MailMessage','findOne','lastMsgText','trimStart','plainBody','catch','updateInteraction','then','Users','Tags','TagIds','lodash'];(function(_0xfff802,_0x3624f5){var _0x417e70=function(_0x62ec69){while(--_0x62ec69){_0xfff802['push'](_0xfff802['shift']());}};_0x417e70(++_0x3624f5);}(_0x913c,0x112));var _0xc913=function(_0x185610,_0x49c4d){_0x185610=_0x185610-0x0;var _0x1cc304=_0x913c[_0x185610];return _0x1cc304;};'use strict';var _=require(_0xc913('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x3442b3,_0x52b4ba){return new Promise(function(_0x4fd0be,_0x2d8d0f){try{var _0x42c3aa=[];if(_0x52b4ba[_0x3442b3]){_0x42c3aa=_0x52b4ba[_0x3442b3][_0xc913('0x1')](function(_0x5923b8){return{'id':_0x5923b8['id'],'fullname':_0x5923b8[_0xc913('0x2')]};});}return _0x4fd0be(_0x42c3aa);}catch(_0x2618cd){_0x2d8d0f(_0x2618cd);}});}function getInteractionTags(_0x444a36,_0x121eb7){var _0x126d0a=[];if(_0x444a36){_0x444a36[_0xc913('0x3')](',')[_0xc913('0x4')](function(_0x316e69){_0x126d0a['push'](_0x121eb7[_0x316e69]);});}return _0x126d0a;}function updateWaitingCounter(_0xfaaa59){if(_0xfaaa59[_0xc913('0x5')]){_0xfaaa59[_0xc913('0x5')]-=0x1;}}function updateInteractionCounters(_0x5e56c0){_0x5e56c0[_0xc913('0x5')]=0x0;_0x5e56c0['talking']=0x0;_0x5e56c0[_0xc913('0x6')]=0x0;_0x5e56c0[_0xc913('0x7')]=0x0;_0x5e56c0['abandoned']=0x0;_0x5e56c0[_0xc913('0x8')]=0x0;if(_0x5e56c0[_0xc913('0x9')]){if(_0x5e56c0['disposition']==='abandoned'){_0x5e56c0[_0xc913('0xa')]+=0x1;updateWaitingCounter(_0x5e56c0);}if(_0x5e56c0['UserId']){_0x5e56c0['answered']+=0x1;if(_0x5e56c0[_0xc913('0xb')]){_0x5e56c0['talking']-=0x1;}}else{if(_0x5e56c0[_0xc913('0xc')]){_0x5e56c0[_0xc913('0x7')]+=0x1;updateWaitingCounter(_0x5e56c0);}}}else{if(!_0x5e56c0[_0xc913('0xd')]){_0x5e56c0[_0xc913('0x5')]+=0x1;}if(_0x5e56c0[_0xc913('0xd')]){_0x5e56c0[_0xc913('0xb')]+=0x1;updateWaitingCounter(_0x5e56c0);}}_0x5e56c0[_0xc913('0x8')]+=0x1;return _0x5e56c0;}function getLastMessageText(_0x79c7a5){return db[_0xc913('0xe')][_0xc913('0xf')]({'where':{'$and':[{'MailInteractionId':_0x79c7a5['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':'-id','raw':!![]})['then'](function(_0x24edde){if(_0x24edde&&_0x24edde['plainBody']){_0x79c7a5[_0xc913('0x10')]=_[_0xc913('0x11')](_0x24edde[_0xc913('0x12')]);}return _0x79c7a5;})[_0xc913('0x13')](function(_0x38327c){throw _0x38327c;});}exports[_0xc913('0x14')]=function(_0x2a8a44,_0x2823e8,_0x3de803,_0x21d6ea){return new Promise(function(_0x5c07e1,_0x49eb36){return getInteractionUsers(_0x2a8a44['id'],_0x3de803)[_0xc913('0x15')](function(_0x4a39da){_0x2a8a44[_0xc913('0x16')]=_0x4a39da;return getInteractionTags(_0x2a8a44['TagIds'],_0x2823e8);})['then'](function(_0x5ded34){_0x2a8a44[_0xc913('0x17')]=_0x5ded34;delete _0x2a8a44[_0xc913('0x18')];return updateInteractionCounters(_0x2a8a44);})[_0xc913('0x15')](function(_0x39c0ca){if(_0x21d6ea){return getLastMessageText(_0x39c0ca);}else{return _0x39c0ca;}})[_0xc913('0x15')](function(_0x559f86){_0x5c07e1(_0x559f86);})[_0xc913('0x13')](function(_0x4c7557){_0x49eb36(_0x4c7557);});});}; \ No newline at end of file +var _0x7d1e=['forEach','push','waiting','talking','answered','unmanaged','abandoned','total','closed','UserId','disposition','MailMessage','findOne','plainBody','-id','then','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','lodash','../../mysqldb','map','fullname','split'];(function(_0xc185f0,_0x4ecdac){var _0x274e8f=function(_0x571830){while(--_0x571830){_0xc185f0['push'](_0xc185f0['shift']());}};_0x274e8f(++_0x4ecdac);}(_0x7d1e,0x6b));var _0xe7d1=function(_0x456066,_0x14faf4){_0x456066=_0x456066-0x0;var _0x504cd9=_0x7d1e[_0x456066];return _0x504cd9;};'use strict';var _=require(_0xe7d1('0x0'));var db=require(_0xe7d1('0x1'))['db'];function getInteractionUsers(_0x5cb7c4,_0x210ab4){return new Promise(function(_0x57cb7c,_0x1c32db){try{var _0x5d41de=[];if(_0x210ab4[_0x5cb7c4]){_0x5d41de=_0x210ab4[_0x5cb7c4][_0xe7d1('0x2')](function(_0x5a8552){return{'id':_0x5a8552['id'],'fullname':_0x5a8552[_0xe7d1('0x3')]};});}return _0x57cb7c(_0x5d41de);}catch(_0x32ff1a){_0x1c32db(_0x32ff1a);}});}function getInteractionTags(_0x5dbfed,_0x969073){var _0x1e51b4=[];if(_0x5dbfed){_0x5dbfed[_0xe7d1('0x4')](',')[_0xe7d1('0x5')](function(_0x3925d3){_0x1e51b4[_0xe7d1('0x6')](_0x969073[_0x3925d3]);});}return _0x1e51b4;}function updateWaitingCounter(_0x244c44){if(_0x244c44[_0xe7d1('0x7')]){_0x244c44[_0xe7d1('0x7')]-=0x1;}}function updateInteractionCounters(_0x47d7e6){_0x47d7e6[_0xe7d1('0x7')]=0x0;_0x47d7e6[_0xe7d1('0x8')]=0x0;_0x47d7e6[_0xe7d1('0x9')]=0x0;_0x47d7e6[_0xe7d1('0xa')]=0x0;_0x47d7e6[_0xe7d1('0xb')]=0x0;_0x47d7e6[_0xe7d1('0xc')]=0x0;if(_0x47d7e6[_0xe7d1('0xd')]){if(_0x47d7e6['disposition']===_0xe7d1('0xb')){_0x47d7e6[_0xe7d1('0xb')]+=0x1;updateWaitingCounter(_0x47d7e6);}if(_0x47d7e6[_0xe7d1('0xe')]){_0x47d7e6[_0xe7d1('0x9')]+=0x1;if(_0x47d7e6['talking']){_0x47d7e6['talking']-=0x1;}}else{if(_0x47d7e6[_0xe7d1('0xf')]){_0x47d7e6[_0xe7d1('0xa')]+=0x1;updateWaitingCounter(_0x47d7e6);}}}else{if(!_0x47d7e6[_0xe7d1('0xe')]){_0x47d7e6[_0xe7d1('0x7')]+=0x1;}if(_0x47d7e6[_0xe7d1('0xe')]){_0x47d7e6['talking']+=0x1;updateWaitingCounter(_0x47d7e6);}}_0x47d7e6['total']+=0x1;return _0x47d7e6;}function getLastMessageText(_0xe53583){return db[_0xe7d1('0x10')][_0xe7d1('0x11')]({'where':{'$and':[{'MailInteractionId':_0xe53583['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xe7d1('0x12')],'order':_0xe7d1('0x13'),'raw':!![]})[_0xe7d1('0x14')](function(_0x495684){if(_0x495684&&_0x495684[_0xe7d1('0x12')]){_0xe53583[_0xe7d1('0x15')]=_[_0xe7d1('0x16')](_0x495684[_0xe7d1('0x12')]);}return _0xe53583;})[_0xe7d1('0x17')](function(_0x3a2ee9){throw _0x3a2ee9;});}exports[_0xe7d1('0x18')]=function(_0x494abf,_0x42dbed,_0x269023,_0x3f684e){return new Promise(function(_0x1b0fac,_0x4a5860){return getInteractionUsers(_0x494abf['id'],_0x269023)[_0xe7d1('0x14')](function(_0x1a7a99){_0x494abf[_0xe7d1('0x19')]=_0x1a7a99;return getInteractionTags(_0x494abf[_0xe7d1('0x1a')],_0x42dbed);})[_0xe7d1('0x14')](function(_0x3cbd35){_0x494abf[_0xe7d1('0x1b')]=_0x3cbd35;delete _0x494abf['TagIds'];return updateInteractionCounters(_0x494abf);})['then'](function(_0x114e0c){if(_0x3f684e){return getLastMessageText(_0x114e0c);}else{return _0x114e0c;}})[_0xe7d1('0x14')](function(_0x81662f){_0x1b0fac(_0x81662f);})[_0xe7d1('0x17')](function(_0x27fe7e){_0x4a5860(_0x27fe7e);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 1910722..ab02022 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0538=['upperFirst','websites','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','stringify','null','findOne','then','update','info','catch','error','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','whatsapp-interactions','chat','Website','capitalize','InteractionId'];(function(_0x4677a2,_0x5d525a){var _0x1ed1a5=function(_0x1ed4cf){while(--_0x1ed4cf){_0x4677a2['push'](_0x4677a2['shift']());}};_0x1ed1a5(++_0x5d525a);}(_0x0538,0x10e));var _0x8053=function(_0x2a6d45,_0x3c9321){_0x2a6d45=_0x2a6d45-0x0;var _0x295253=_0x0538[_0x2a6d45];return _0x295253;};'use strict';var _=require('lodash');var db=require(_0x8053('0x0'))['db'];var loggers={'openchannel':require(_0x8053('0x1'))(_0x8053('0x2')),'mail':require('../../config/logger')(_0x8053('0x3')),'fax':require(_0x8053('0x1'))('fax-interactions'),'sms':require(_0x8053('0x1'))(_0x8053('0x4')),'chat':require(_0x8053('0x1'))('chat-interactions'),'whatsapp':require('../../config/logger')(_0x8053('0x5'))};function getAccountFK(_0x16e04b){return _['capitalize'](_0x16e04b)+(_0x16e04b===_0x8053('0x6')?_0x8053('0x7'):'Account')+'Id';}function getInteractionFK(_0x454667){return _[_0x8053('0x8')](_0x454667)+_0x8053('0x9');}function getInteractionId(_0x3b6783,_0x26aed6,_0x126f66){if(_0x3b6783&&_0x3b6783[_['upperFirst'](_0x126f66)+'InteractionId']){return _0x3b6783[_[_0x8053('0xa')](_0x126f66)+_0x8053('0x9')];}else if(_0x3b6783&&_0x3b6783['id']){return _0x3b6783['id'];}else if(_0x26aed6&&_0x26aed6['id']){return _0x26aed6['id'];}else{return'unknown';}}function getInteractionsTables(_0xf2ffbf){return{'accounts':_0xf2ffbf+'_'+(_0xf2ffbf===_0x8053('0x6')?_0x8053('0xb'):'accounts'),'interactions':_0xf2ffbf+_0x8053('0xc'),'interactionsTags':_0xf2ffbf+_0x8053('0xd'),'messages':_0xf2ffbf+_0x8053('0xe'),'userInteractions':_0x8053('0xf')+_0xf2ffbf+_0x8053('0xc')};}function getSelectedTags(_0x448e2a){var _0x551949=[];if(_0x448e2a){_0x551949=Array[_0x8053('0x10')](_0x448e2a)?_0x448e2a:[_0x448e2a];}return _0x551949;}function log(_0x4a3399,_0x4a9d15,_0x345123,_0x33e124,_0x206811,_0x55be88){loggers[_0x206811[_0x8053('0x11')]()][_0x4a3399](_0x8053('0x12'),_0x55be88['toUpperCase'](),_0x4a9d15?_0x4a9d15['id']:null,_0x4a9d15?_0x4a9d15[_0x8053('0x13')]:null,_0x4a9d15?_0x4a9d15['role']:null,getInteractionId(_0x345123,_0x33e124,_0x206811),_0x345123?JSON[_0x8053('0x14')](_0x345123):_0x8053('0x15'));}function updateUser(_0x32828d,_0x5dc9a8,_0x1db864,_0x1dcb57,_0x295459){db[_[_0x8053('0xa')](_0x1dcb57)+'Interaction'][_0x8053('0x16')]({'where':{'id':getInteractionId(_0x5dc9a8,_0x1db864,_0x1dcb57)}})[_0x8053('0x17')](function(_0x2f740b){if(_0x2f740b){return _0x2f740b[_0x8053('0x18')]({'UserId':_0x32828d?_0x32828d['id']:null});}})[_0x8053('0x17')](function(_0x180ccf){if(_0x180ccf){log(_0x8053('0x19'),_0x32828d,_0x5dc9a8,_0x1db864,_0x1dcb57,_0x295459);}})[_0x8053('0x1a')](function(){log(_0x8053('0x1b'),_0x32828d,_0x5dc9a8,_0x1db864,_0x1dcb57,_0x295459);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x51f1=['capitalize','chat','Account','InteractionId','upperFirst','unknown','_interactions','_messages','user_has_','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null','Interaction','findOne','then','info','catch','error','exports','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','chat-interactions'];(function(_0x430f44,_0x4ae21b){var _0x1f6b0f=function(_0x35968f){while(--_0x35968f){_0x430f44['push'](_0x430f44['shift']());}};_0x1f6b0f(++_0x4ae21b);}(_0x51f1,0x108));var _0x151f=function(_0xede44e,_0x2540de){_0xede44e=_0xede44e-0x0;var _0x36367b=_0x51f1[_0xede44e];return _0x36367b;};'use strict';var _=require('lodash');var db=require(_0x151f('0x0'))['db'];var loggers={'openchannel':require(_0x151f('0x1'))(_0x151f('0x2')),'mail':require(_0x151f('0x1'))('mail-interactions'),'fax':require(_0x151f('0x1'))(_0x151f('0x3')),'sms':require(_0x151f('0x1'))(_0x151f('0x4')),'chat':require(_0x151f('0x1'))(_0x151f('0x5')),'whatsapp':require(_0x151f('0x1'))('whatsapp-interactions')};function getAccountFK(_0x42b8fa){return _[_0x151f('0x6')](_0x42b8fa)+(_0x42b8fa===_0x151f('0x7')?'Website':_0x151f('0x8'))+'Id';}function getInteractionFK(_0x34ade0){return _[_0x151f('0x6')](_0x34ade0)+_0x151f('0x9');}function getInteractionId(_0x5abb37,_0x1c158f,_0x823d96){if(_0x5abb37&&_0x5abb37[_[_0x151f('0xa')](_0x823d96)+'InteractionId']){return _0x5abb37[_['upperFirst'](_0x823d96)+_0x151f('0x9')];}else if(_0x5abb37&&_0x5abb37['id']){return _0x5abb37['id'];}else if(_0x1c158f&&_0x1c158f['id']){return _0x1c158f['id'];}else{return _0x151f('0xb');}}function getInteractionsTables(_0x5da289){return{'accounts':_0x5da289+'_'+(_0x5da289===_0x151f('0x7')?'websites':'accounts'),'interactions':_0x5da289+_0x151f('0xc'),'interactionsTags':_0x5da289+'_interaction_has_tags','messages':_0x5da289+_0x151f('0xd'),'userInteractions':_0x151f('0xe')+_0x5da289+_0x151f('0xc')};}function getSelectedTags(_0x3ad649){var _0x57ced2=[];if(_0x3ad649){_0x57ced2=Array['isArray'](_0x3ad649)?_0x3ad649:[_0x3ad649];}return _0x57ced2;}function log(_0x8f99aa,_0x3d7bd7,_0x589892,_0x4cd63e,_0x1d0ab5,_0x454ae9){loggers[_0x1d0ab5['toLowerCase']()][_0x8f99aa](_0x151f('0xf'),_0x454ae9['toUpperCase'](),_0x3d7bd7?_0x3d7bd7['id']:null,_0x3d7bd7?_0x3d7bd7[_0x151f('0x10')]:null,_0x3d7bd7?_0x3d7bd7[_0x151f('0x11')]:null,getInteractionId(_0x589892,_0x4cd63e,_0x1d0ab5),_0x589892?JSON[_0x151f('0x12')](_0x589892):_0x151f('0x13'));}function updateUser(_0x54696d,_0x5989d9,_0x1359c3,_0x225fed,_0x3ccc84){db[_[_0x151f('0xa')](_0x225fed)+_0x151f('0x14')][_0x151f('0x15')]({'where':{'id':getInteractionId(_0x5989d9,_0x1359c3,_0x225fed)}})[_0x151f('0x16')](function(_0x5250dc){if(_0x5250dc){return _0x5250dc['update']({'UserId':_0x54696d?_0x54696d['id']:null});}})[_0x151f('0x16')](function(_0x5b4718){if(_0x5b4718){log(_0x151f('0x17'),_0x54696d,_0x5989d9,_0x1359c3,_0x225fed,_0x3ccc84);}})[_0x151f('0x18')](function(){log(_0x151f('0x19'),_0x54696d,_0x5989d9,_0x1359c3,_0x225fed,_0x3ccc84);});}module[_0x151f('0x1a')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 4fd286c..6e9f3b4 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 _0x038b=['base64','utf8','final','parse','hasOwnProperty','use','License','then','status','json','catch','User','user','isUserLimit','crypto','util','../../mysqldb','../../config/environment','data1','license','split','format','%s:%s:%s'];(function(_0x3edc22,_0x371603){var _0x3b8f1b=function(_0x7d44ed){while(--_0x7d44ed){_0x3edc22['push'](_0x3edc22['shift']());}};_0x3b8f1b(++_0x371603);}(_0x038b,0x6a));var _0xb038=function(_0x3475ce,_0x12d410){_0x3475ce=_0x3475ce-0x0;var _0x25a401=_0x038b[_0x3475ce];return _0x25a401;};'use strict';var crypto=require(_0xb038('0x0'));var util=require(_0xb038('0x1'));var compose=require('composable-middleware');var db=require(_0xb038('0x2'))['db'];var config=require(_0xb038('0x3'));function getValueFromLicense(_0x494be4,_0x2d4eeb){if(_0x494be4&&_0x2d4eeb){if(_0x2d4eeb[_0xb038('0x4')]&&_0x2d4eeb[_0xb038('0x5')]){var _0x4f9a8d=_0x2d4eeb[_0xb038('0x4')];var _0x31d5eb=_0x2d4eeb[_0xb038('0x5')];var _0x54f14e=_0x4f9a8d[_0xb038('0x6')]('-')[0x4];var _0xff837a=_0x4f9a8d[_0xb038('0x6')]('-')[0x0];var _0x88907f=crypto['createDecipher']('aes-256-ctr',util[_0xb038('0x7')](_0xb038('0x8'),_0x54f14e,_0x4f9a8d,_0xff837a));var _0x1c8e98=_0x88907f['update'](_0x31d5eb,_0xb038('0x9'),_0xb038('0xa'));_0x1c8e98+=_0x88907f[_0xb038('0xb')]('utf8');var _0x24e5c8=JSON[_0xb038('0xc')](_0x1c8e98);return _0x24e5c8[_0xb038('0xd')](_0x494be4)?_0x24e5c8[_0x494be4]:null;}}return null;}function isLimit(_0x1fc6e7,_0x5df694,_0x3ac093,_0x42a74e){var _0x3fc812=_0x5df694;return compose()[_0xb038('0xe')](function(_0x360f0f,_0x587bb3,_0x16886a){return db[_0xb038('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x2bc842){var _0xb43625=getValueFromLicense(_0x1fc6e7,_0x2bc842);return _0xb43625?_0xb43625:_0x3fc812;})[_0xb038('0x10')](function(_0x571825){_0x3fc812=_0x571825;return _0x3ac093['count'](_0x42a74e);})[_0xb038('0x10')](function(_0xe5d7df){if(_0xe5d7df>=_0x3fc812){return _0x587bb3[_0xb038('0x11')](0x193)[_0xb038('0x12')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x1fc6e7)});}_0x16886a();})[_0xb038('0x13')](function(_0x3238c3){_0x16886a(_0x3238c3);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xb038('0x14')],{'where':{'$or':[{'role':'admin'},{'role':_0xb038('0x15')}]}});}exports[_0xb038('0x16')]=isUserLimit; \ No newline at end of file +var _0x8abb=['count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','isUserLimit','composable-middleware','../../mysqldb','data1','license','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','hasOwnProperty','use','then'];(function(_0x16993a,_0x170a03){var _0x2240b8=function(_0x7d0fa9){while(--_0x7d0fa9){_0x16993a['push'](_0x16993a['shift']());}};_0x2240b8(++_0x170a03);}(_0x8abb,0x11d));var _0xb8ab=function(_0x41f01d,_0x5a899b){_0x41f01d=_0x41f01d-0x0;var _0x119fff=_0x8abb[_0x41f01d];return _0x119fff;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require(_0xb8ab('0x0'));var db=require(_0xb8ab('0x1'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0xfb6bc5,_0xb8a06){if(_0xfb6bc5&&_0xb8a06){if(_0xb8a06[_0xb8ab('0x2')]&&_0xb8a06[_0xb8ab('0x3')]){var _0x18a039=_0xb8a06[_0xb8ab('0x2')];var _0x57e20e=_0xb8a06['license'];var _0x2f9081=_0x18a039[_0xb8ab('0x4')]('-')[0x4];var _0x2b84eb=_0x18a039[_0xb8ab('0x4')]('-')[0x0];var _0x47d19=crypto['createDecipher'](_0xb8ab('0x5'),util[_0xb8ab('0x6')](_0xb8ab('0x7'),_0x2f9081,_0x18a039,_0x2b84eb));var _0x3cd672=_0x47d19[_0xb8ab('0x8')](_0x57e20e,_0xb8ab('0x9'),_0xb8ab('0xa'));_0x3cd672+=_0x47d19['final'](_0xb8ab('0xa'));var _0x1fc0c8=JSON['parse'](_0x3cd672);return _0x1fc0c8[_0xb8ab('0xb')](_0xfb6bc5)?_0x1fc0c8[_0xfb6bc5]:null;}}return null;}function isLimit(_0x4064c7,_0x515d72,_0x5ba5c9,_0x4605a6){var _0x59d789=_0x515d72;return compose()[_0xb8ab('0xc')](function(_0x491e4e,_0x17724b,_0xc55419){return db['License']['findOne']({'where':{'id':0x1},'raw':!![]})[_0xb8ab('0xd')](function(_0x2b6608){var _0x30782a=getValueFromLicense(_0x4064c7,_0x2b6608);return _0x30782a?_0x30782a:_0x59d789;})[_0xb8ab('0xd')](function(_0x1758dc){_0x59d789=_0x1758dc;return _0x5ba5c9[_0xb8ab('0xe')](_0x4605a6);})[_0xb8ab('0xd')](function(_0x8b9fa7){if(_0x8b9fa7>=_0x59d789){return _0x17724b[_0xb8ab('0xf')](0x193)[_0xb8ab('0x10')]({'message':util[_0xb8ab('0x6')](_0xb8ab('0x11'),_0x4064c7)});}_0xc55419();})[_0xb8ab('0x12')](function(_0x469b4a){_0xc55419(_0x469b4a);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xb8ab('0x13')],{'where':{'$or':[{'role':_0xb8ab('0x14')},{'role':_0xb8ab('0x15')}]}});}exports[_0xb8ab('0x16')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 10bae5e..b681607 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 _0xb4d6=['\x20OR\x20','field','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','>\x20?','<=\x20?','$gte','>=\x20?','start','pop','utcOffset','hours','minutes','seconds','format','lodash','moment','parseSearch','sqlOperator','startsWith','replace','[$and]','[$or]','split','length','slice','forEach','shift','match','filter','indexOf','map','conditions','push','DATE','operator','$between','value','includes','$lte','add','castTo','text','CAST(','\x20AS\x20','$ne','$notIn'];(function(_0x1521be,_0x34aa83){var _0x156a8e=function(_0x1b803c){while(--_0x1b803c){_0x1521be['push'](_0x1521be['shift']());}};_0x156a8e(++_0x34aa83);}(_0xb4d6,0x88));var _0x6b4d=function(_0x2fd947,_0x5da260){_0x2fd947=_0x2fd947-0x0;var _0x5228eb=_0xb4d6[_0x2fd947];return _0x5228eb;};'use strict';var _=require(_0x6b4d('0x0'));var moment=require(_0x6b4d('0x1'));exports[_0x6b4d('0x2')]=function(_0x33dcb7){var _0x143763={'conditions':[]};_0x143763[_0x6b4d('0x3')]=_[_0x6b4d('0x4')](_0x33dcb7,'[$or]')?'or':'and';var _0x1a498f=_0x33dcb7[_0x6b4d('0x5')](_0x6b4d('0x6'),'')[_0x6b4d('0x5')](_0x6b4d('0x7'),'')[_0x6b4d('0x8')]('||');for(var _0xd5e9c5=0x0;_0xd5e9c5<_0x1a498f[_0x6b4d('0x9')];_0xd5e9c5++){var _0x13d7fd=_0x1a498f[_0xd5e9c5][_0x6b4d('0x8')](':=');var _0x32b5b9=_0x13d7fd[0x0];var _0x3ecd8f=_0x13d7fd[_0x6b4d('0xa')](0x1);_0x3ecd8f[_0x6b4d('0xb')](function(_0x40e775){var _0x450502=_0x40e775[_0x6b4d('0x8')]('[')[_0x6b4d('0xc')]();var _0x4032cf=_0x40e775[_0x6b4d('0xd')](/\[(.*?)\]/g);_0x4032cf[_0x6b4d('0xb')](function(_0x2affaa){var _0x102ba5=_0x2affaa[_0x6b4d('0x8')]('[')[_0x6b4d('0xe')](function(_0x2705c3){return _0x2705c3[_0x6b4d('0xf')](']')>-0x1;})[_0x6b4d('0x10')](function(_0x44c215){return _0x44c215[_0x6b4d('0x8')](']')[0x0];})[0x0];_0x143763[_0x6b4d('0x11')][_0x6b4d('0x12')]({'field':_0x32b5b9,'operator':_0x450502,'value':_0x102ba5});});});}return _0x143763;};exports['buildExpression']=function(_0x496837,_0x1b011e,_0x8f2f28){var _0xfe6620={};if(_0x1b011e===_0x6b4d('0x13')){if(_0x8f2f28['operator']==='$eq'){_0x8f2f28[_0x6b4d('0x14')]=_0x6b4d('0x15');_0x8f2f28[_0x6b4d('0x16')]+=','+_0x8f2f28[_0x6b4d('0x16')];}else if(_[_0x6b4d('0x17')](['$gt',_0x6b4d('0x18')],_0x8f2f28[_0x6b4d('0x14')])){_0x8f2f28[_0x6b4d('0x16')]=moment(_0x8f2f28['value'])[_0x6b4d('0x19')](0x1,'days')['format']('YYYY-MM-DD');}}if(_0x8f2f28['castTo']){_0x1b011e=_0x8f2f28[_0x6b4d('0x1a')];_0xfe6620[_0x6b4d('0x1b')]=_0x6b4d('0x1c')+_0x496837+'.'+_0x8f2f28['field']+_0x6b4d('0x1d')+_0x8f2f28[_0x6b4d('0x1a')]+')\x20'+parseOperator(_0x8f2f28[_0x6b4d('0x14')]);}else{_0xfe6620[_0x6b4d('0x1b')]=_0x496837+'.'+_0x8f2f28['field']+'\x20'+parseOperator(_0x8f2f28[_0x6b4d('0x14')]);}if(_[_0x6b4d('0x17')]([_0x6b4d('0x1e'),_0x6b4d('0x1f')],_0x8f2f28[_0x6b4d('0x14')]))_0xfe6620[_0x6b4d('0x1b')]='('+_0xfe6620[_0x6b4d('0x1b')]+_0x6b4d('0x20')+_0x496837+'.'+_0x8f2f28[_0x6b4d('0x21')]+_0x6b4d('0x22');_0xfe6620[_0x6b4d('0x16')]=parseValue(_0x1b011e,_0x8f2f28[_0x6b4d('0x14')],_0x8f2f28[_0x6b4d('0x16')]);return _0xfe6620;};function parseOperator(_0xbccd38){var _0xafcbaa;switch(_0xbccd38){case _0x6b4d('0x23'):_0xafcbaa=_0x6b4d('0x24');break;case _0x6b4d('0x1f'):_0xafcbaa=_0x6b4d('0x25');break;case _0x6b4d('0x26'):_0xafcbaa=_0x6b4d('0x27');break;case'$ne':_0xafcbaa='<>\x20?';break;case _0x6b4d('0x28'):case _0x6b4d('0x29'):case _0x6b4d('0x2a'):_0xafcbaa=_0x6b4d('0x2b');break;case _0x6b4d('0x2c'):_0xafcbaa='<\x20?';break;case'$gt':_0xafcbaa=_0x6b4d('0x2d');break;case'$lte':_0xafcbaa=_0x6b4d('0x2e');break;case _0x6b4d('0x2f'):_0xafcbaa=_0x6b4d('0x30');break;case'$between':_0xafcbaa='BETWEEN\x20?\x20AND\x20?';break;}return _0xafcbaa;}function parseValue(_0x1556a2,_0x23d254,_0x45173a){var _0x525fd4={'start':undefined,'end':undefined};switch(_0x23d254){case _0x6b4d('0x23'):case _0x6b4d('0x1f'):_0x525fd4[_0x6b4d('0x31')]=_0x45173a[_0x6b4d('0x8')](',');break;case _0x6b4d('0x28'):_0x525fd4[_0x6b4d('0x31')]='%'+_0x45173a+'%';break;case _0x6b4d('0x29'):_0x525fd4[_0x6b4d('0x31')]=_0x45173a+'%';break;case _0x6b4d('0x2a'):_0x525fd4[_0x6b4d('0x31')]='%'+_0x45173a;break;case'$between':var _0x30e4cf=_0x45173a[_0x6b4d('0x8')](',');var _0x45173a=_0x30e4cf['shift']();var _0x5ee120=_0x30e4cf[_0x6b4d('0x32')]();if(_0x1556a2===_0x6b4d('0x13')){_0x45173a=moment(_0x45173a)[_0x6b4d('0x33')](0x0,!![])['format']();_0x5ee120=moment(_0x5ee120)[_0x6b4d('0x33')](0x0,!![])['add'](0x17,_0x6b4d('0x34'))[_0x6b4d('0x19')](0x3b,_0x6b4d('0x35'))[_0x6b4d('0x19')](0x3b,_0x6b4d('0x36'))[_0x6b4d('0x37')]();}_0x525fd4={'start':_0x45173a,'end':_0x5ee120};break;default:_0x525fd4[_0x6b4d('0x31')]=_0x45173a;break;}return _0x525fd4;} \ No newline at end of file +var _0x1288=['match','filter','map','conditions','buildExpression','operator','$eq','$between','value','includes','$gt','$lte','add','days','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$startsWith','$lt','>\x20?','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$substring','pop','DATE','utcOffset','format','hours','minutes','lodash','moment','parseSearch','sqlOperator','[$or]','and','[$and]','split','length','slice','forEach','shift'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1288,0x1d1));var _0x8128=function(_0x5df10c,_0x5f1e5e){_0x5df10c=_0x5df10c-0x0;var _0x47228b=_0x1288[_0x5df10c];return _0x47228b;};'use strict';var _=require(_0x8128('0x0'));var moment=require(_0x8128('0x1'));exports[_0x8128('0x2')]=function(_0x350b54){var _0x5a8a57={'conditions':[]};_0x5a8a57[_0x8128('0x3')]=_['startsWith'](_0x350b54,_0x8128('0x4'))?'or':_0x8128('0x5');var _0x3132ed=_0x350b54['replace'](_0x8128('0x6'),'')['replace'](_0x8128('0x4'),'')[_0x8128('0x7')]('||');for(var _0x2122ba=0x0;_0x2122ba<_0x3132ed[_0x8128('0x8')];_0x2122ba++){var _0x156ff9=_0x3132ed[_0x2122ba][_0x8128('0x7')](':=');var _0x4b9e0d=_0x156ff9[0x0];var _0xa24c1f=_0x156ff9[_0x8128('0x9')](0x1);_0xa24c1f[_0x8128('0xa')](function(_0x4e458c){var _0xad9ca1=_0x4e458c[_0x8128('0x7')]('[')[_0x8128('0xb')]();var _0x54cde1=_0x4e458c[_0x8128('0xc')](/\[(.*?)\]/g);_0x54cde1[_0x8128('0xa')](function(_0x1af89e){var _0xf48332=_0x1af89e[_0x8128('0x7')]('[')[_0x8128('0xd')](function(_0x4fef93){return _0x4fef93['indexOf'](']')>-0x1;})[_0x8128('0xe')](function(_0xb31525){return _0xb31525[_0x8128('0x7')](']')[0x0];})[0x0];_0x5a8a57[_0x8128('0xf')]['push']({'field':_0x4b9e0d,'operator':_0xad9ca1,'value':_0xf48332});});});}return _0x5a8a57;};exports[_0x8128('0x10')]=function(_0x2365e4,_0xab6d03,_0x529e53){var _0x28c1d1={};if(_0xab6d03==='DATE'){if(_0x529e53[_0x8128('0x11')]===_0x8128('0x12')){_0x529e53[_0x8128('0x11')]=_0x8128('0x13');_0x529e53[_0x8128('0x14')]+=','+_0x529e53[_0x8128('0x14')];}else if(_[_0x8128('0x15')]([_0x8128('0x16'),_0x8128('0x17')],_0x529e53[_0x8128('0x11')])){_0x529e53['value']=moment(_0x529e53['value'])[_0x8128('0x18')](0x1,_0x8128('0x19'))['format']('YYYY-MM-DD');}}if(_0x529e53['castTo']){_0xab6d03=_0x529e53[_0x8128('0x1a')];_0x28c1d1[_0x8128('0x1b')]=_0x8128('0x1c')+_0x2365e4+'.'+_0x529e53[_0x8128('0x1d')]+_0x8128('0x1e')+_0x529e53['castTo']+')\x20'+parseOperator(_0x529e53[_0x8128('0x11')]);}else{_0x28c1d1[_0x8128('0x1b')]=_0x2365e4+'.'+_0x529e53[_0x8128('0x1d')]+'\x20'+parseOperator(_0x529e53[_0x8128('0x11')]);}if(_[_0x8128('0x15')]([_0x8128('0x1f'),_0x8128('0x20')],_0x529e53[_0x8128('0x11')]))_0x28c1d1[_0x8128('0x1b')]='('+_0x28c1d1[_0x8128('0x1b')]+'\x20OR\x20'+_0x2365e4+'.'+_0x529e53[_0x8128('0x1d')]+_0x8128('0x21');_0x28c1d1['value']=parseValue(_0xab6d03,_0x529e53['operator'],_0x529e53[_0x8128('0x14')]);return _0x28c1d1;};function parseOperator(_0x57b188){var _0x402527;switch(_0x57b188){case _0x8128('0x22'):_0x402527=_0x8128('0x23');break;case _0x8128('0x20'):_0x402527=_0x8128('0x24');break;case _0x8128('0x12'):_0x402527=_0x8128('0x25');break;case _0x8128('0x1f'):_0x402527=_0x8128('0x26');break;case'$substring':case _0x8128('0x27'):case'$endsWith':_0x402527='LIKE\x20?';break;case _0x8128('0x28'):_0x402527='<\x20?';break;case'$gt':_0x402527=_0x8128('0x29');break;case _0x8128('0x17'):_0x402527=_0x8128('0x2a');break;case'$gte':_0x402527=_0x8128('0x2b');break;case'$between':_0x402527=_0x8128('0x2c');break;}return _0x402527;}function parseValue(_0x2a5060,_0x1aeba3,_0x167fe9){var _0x19883b={'start':undefined,'end':undefined};switch(_0x1aeba3){case _0x8128('0x22'):case'$notIn':_0x19883b[_0x8128('0x2d')]=_0x167fe9[_0x8128('0x7')](',');break;case _0x8128('0x2e'):_0x19883b[_0x8128('0x2d')]='%'+_0x167fe9+'%';break;case _0x8128('0x27'):_0x19883b[_0x8128('0x2d')]=_0x167fe9+'%';break;case'$endsWith':_0x19883b[_0x8128('0x2d')]='%'+_0x167fe9;break;case'$between':var _0x308a60=_0x167fe9['split'](',');var _0x167fe9=_0x308a60[_0x8128('0xb')]();var _0x38e6e9=_0x308a60[_0x8128('0x2f')]();if(_0x2a5060===_0x8128('0x30')){_0x167fe9=moment(_0x167fe9)[_0x8128('0x31')](0x0,!![])[_0x8128('0x32')]();_0x38e6e9=moment(_0x38e6e9)[_0x8128('0x31')](0x0,!![])[_0x8128('0x18')](0x17,_0x8128('0x33'))[_0x8128('0x18')](0x3b,_0x8128('0x34'))[_0x8128('0x18')](0x3b,'seconds')['format']();}_0x19883b={'start':_0x167fe9,'end':_0x38e6e9};break;default:_0x19883b[_0x8128('0x2d')]=_0x167fe9;break;}return _0x19883b;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 2026247..ad46043 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 _0x84e7=['cast','col','substr','DESC','priority','ASC','omit','length','isObject','isString','unset','isNumeric','^[+]?[0-9]*$','isEmail','match','getFullTextValue','forEach','replace','push','join','$id','query','model','intersection','attributes','hasOwnProperty','nolimit','order','where','object','filter','columns','name','value','map','VIRTUAL','lower','merge','sequelize','moment','keys','includes','fields','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','parse','$gte','YYYY-MM-DD','utc','format','$lte','subtract','isArray','limit','offset','sort','indexOf'];(function(_0x3f9f0f,_0x531b30){var _0x2eb31d=function(_0x43feb1){while(--_0x43feb1){_0x3f9f0f['push'](_0x3f9f0f['shift']());}};_0x2eb31d(++_0x531b30);}(_0x84e7,0x122));var _0x784e=function(_0x30b5f2,_0xe3cee){_0x30b5f2=_0x30b5f2-0x0;var _0x5965e9=_0x84e7[_0x30b5f2];return _0x5965e9;};'use strict';var _=require('lodash');var sequelize=require(_0x784e('0x0'));var moment=require(_0x784e('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5861e2){var _0x3548d2=['ne'];try{var _0x2c1d96=JSON['parse'](_0x5861e2);var _0x45e3ad=Object[_0x784e('0x2')](_0x2c1d96)[0x0];return _0x3548d2[_0x784e('0x3')](_0x45e3ad);}catch(_0xdc7692){return![];}}function getOperatorValue(_0x42993b){var _0x133296=JSON['parse'](_0x42993b);var _0x3cbdd1=Object['keys'](_0x133296)[0x0];var _0xfaa170=_0x133296[_0x3cbdd1];return{['$'+_0x3cbdd1]:_0xfaa170};}exports[_0x784e('0x4')]=function(_0x59a97d){var _0x18be55=null;if(_0x59a97d){_0x18be55=_0x59a97d[_0x784e('0x5')](',');}return _0x18be55;};exports[_0x784e('0x6')]=function(_0x3ddd55,_0x4ac061){var _0x4ae056={};if(!_[_0x784e('0x7')](_0x3ddd55)){_[_0x784e('0x8')](_0x3ddd55,function(_0x17b71f,_0x2fd1b5){try{if(_0x4ac061){var _0x5389cd=_[_0x784e('0x9')](_0x4ac061,{'name':_0x2fd1b5})||{};if(hasSequelizeOperator(_0x17b71f)){_0x4ae056[_0x2fd1b5]=getOperatorValue(_0x17b71f);}else if(_0x5389cd[_0x784e('0xa')]===_0x784e('0xb')&&_[_0x784e('0xc')](_0x17b71f)){var _0x40e0d1=JSON[_0x784e('0xd')](_0x17b71f);var _0x59e179={'$gte':moment(moment(_0x40e0d1[_0x784e('0xe')])['format'](_0x784e('0xf')))[_0x784e('0x10')]()[_0x784e('0x11')](),'$lte':moment(moment(_0x40e0d1[_0x784e('0x12')])[_0x784e('0x11')](_0x784e('0xf')))[_0x784e('0x10')]()[_0x784e('0x13')](0x1,'s')[_0x784e('0x11')]()};_0x4ae056[_0x2fd1b5]=_0x59e179;}else if(_0x5389cd['name']==='uniqueid'){_0x4ae056[_0x2fd1b5]=_0x17b71f;}else{_0x4ae056[_0x2fd1b5]=_[_0x784e('0x14')](_0x17b71f)?_0x17b71f:JSON[_0x784e('0xd')](_0x17b71f);}}else{_0x4ae056[_0x2fd1b5]=_[_0x784e('0x14')](_0x17b71f)?_0x17b71f:JSON[_0x784e('0xd')](_0x17b71f);}}catch(_0x3ac83){_0x4ae056[_0x2fd1b5]=_0x17b71f[_0x784e('0x5')](',');}});}return _0x4ae056;};exports[_0x784e('0x15')]=function(_0x504ebf){_0x504ebf=parseInt(_0x504ebf,0xa);if(!_0x504ebf||_0x504ebf<0x0){_0x504ebf=LIMIT_VALUE;}return _0x504ebf;};exports[_0x784e('0x16')]=function(_0x285ddd){_0x285ddd=parseInt(_0x285ddd,0xa);if(!_0x285ddd||_0x285ddd<0x0){_0x285ddd=0x0;}return _0x285ddd;};exports[_0x784e('0x17')]=function(_0xa417c2){var _0x440cd6,_0x42f894=null;if(_0xa417c2){_0x440cd6=_0xa417c2[_0x784e('0x5')](',');_0x42f894=_['map'](_0x440cd6,function(_0x5add8f){if(_0x5add8f[_0x784e('0x18')]('-')===0x0){return[_0x5add8f==='priority'?sequelize[_0x784e('0x19')](sequelize[_0x784e('0x1a')]('priority'),'unsigned'):_0x5add8f[_0x784e('0x1b')](0x1),_0x784e('0x1c')];}else{return[_0x5add8f===_0x784e('0x1d')?sequelize[_0x784e('0x19')](sequelize['col']('priority'),'unsigned'):_0x5add8f,_0x784e('0x1e')];}});}return _0x42f894;};exports[_0x784e('0x1f')]=function(_0x47f5c2,_0xc225cf){if(_['isEmpty'](_0x47f5c2)){return _0x47f5c2;}if(_[_0x784e('0x14')](_0x47f5c2)){for(var _0x59f315=0x0;_0x59f315<_0x47f5c2[_0x784e('0x20')];_0x59f315+=0x1){_0x47f5c2[_0x59f315]=this[_0x784e('0x1f')](_0x47f5c2[_0x59f315],_0xc225cf);}return _0x47f5c2;}if(!_[_0x784e('0x21')](_0x47f5c2)){return _0x47f5c2;}if(_[_0x784e('0x22')](_0xc225cf)){_0xc225cf=[_0xc225cf];}if(!_['isArray'](_0xc225cf)){return _0x47f5c2;}for(var _0x3668ed=0x0;_0x3668ed<_0xc225cf[_0x784e('0x20')];_0x3668ed+=0x1){_[_0x784e('0x23')](_0x47f5c2,_0xc225cf[_0x3668ed]);}for(var _0x2def08 in _0x47f5c2){if(_0x47f5c2['hasOwnProperty'](_0x2def08)){_0x47f5c2[_0x2def08]=this[_0x784e('0x1f')](_0x47f5c2[_0x2def08],_0xc225cf);}}return _0x47f5c2;};exports[_0x784e('0x24')]=function(_0x5f3da2){return _0x5f3da2['match'](RegExp(_0x784e('0x25')))?!![]:![];};exports[_0x784e('0x26')]=function(_0x17a278){return _0x17a278[_0x784e('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0x784e('0x28')]=function(_0x294a75){var _0x150757=[];_0x294a75[_0x784e('0x5')](/[ ,]+/)[_0x784e('0x29')](function(_0x2e18d6){_0x2e18d6=_0x2e18d6[_0x784e('0x2a')](/([^:]")"+/g,'$1');_0x2e18d6='+'+_0x2e18d6+'*';var _0x8ccdae=/[ `!@#$%^&*()_\-?~]/;if(_0x2e18d6[_0x784e('0x27')](_0x8ccdae))_0x2e18d6='\x22'+_0x2e18d6+'\x22';_0x150757[_0x784e('0x2b')](_0x2e18d6);});return _0x150757[_0x784e('0x2c')]('\x20');};exports['getOptions']=function(_0x32e399,_0x4ea50b,_0xc66635){var _0x14bb3b={},_0x14547a={};if(_0x4ea50b['query'][_0x784e('0x2d')]){_0x4ea50b['query']['id']=_0x4ea50b[_0x784e('0x2e')][_0x784e('0x2d')];delete _0x4ea50b['query'][_0x784e('0x2d')];}_0x14bb3b[_0x784e('0x2f')]=_['map'](_0x32e399,'name');_0x14bb3b[_0x784e('0x2e')]=_[_0x784e('0x2')](_0x4ea50b[_0x784e('0x2e')]);_0x14bb3b[_0x784e('0x6')]=_[_0x784e('0x30')](_0x14bb3b['model'],_0x14bb3b[_0x784e('0x2e')]);_0x14547a[_0x784e('0x31')]=_['intersection'](_0x14bb3b[_0x784e('0x2f')],this['fields'](_0x4ea50b['query']['fields']));_0x14547a[_0x784e('0x31')]=_0x14547a[_0x784e('0x31')]['length']?_0x14547a[_0x784e('0x31')]:_0x14bb3b[_0x784e('0x2f')];if(!_0x4ea50b[_0x784e('0x2e')][_0x784e('0x32')](_0x784e('0x33'))){_0x14547a[_0x784e('0x15')]=this['limit'](_0x4ea50b['query'][_0x784e('0x15')]);_0x14547a[_0x784e('0x16')]=this['offset'](_0x4ea50b['query']['offset']);}_0x14547a[_0x784e('0x34')]=this[_0x784e('0x17')](_0x4ea50b['query'][_0x784e('0x17')]);_0x14547a[_0x784e('0x35')]=this[_0x784e('0x6')](_['pick'](_0x4ea50b[_0x784e('0x2e')],_0x14bb3b['filters']),_0x32e399);if(_0x4ea50b[_0x784e('0x2e')]['filter']){var _0x412ef4=_0x32e399;var _0x14c36b=_0x4ea50b['query']['filter'];if(typeof _0x14c36b===_0x784e('0x36')){_0x412ef4=_[_0x784e('0x37')](_0x32e399,function(_0xa2ed54){return _['includes'](_0x14c36b[_0x784e('0x38')],_0xa2ed54[_0x784e('0x39')]);});_0x14c36b=_0x14c36b[_0x784e('0x3a')];}_0x14547a[_0x784e('0x35')]=_['merge'](_0x14547a[_0x784e('0x35')],{'$or':_[_0x784e('0x3b')](_0x412ef4,function(_0x48d0f0){if(_0x48d0f0['type']!==_0x784e('0x3c')){if(_0xc66635){return sequelize[_0x784e('0x35')](sequelize['fn'](_0x784e('0x3d'),sequelize[_0x784e('0x1a')](_0x48d0f0[_0x784e('0x39')])),{'$like':sequelize['fn']('lower','%'+_0x4ea50b['query']['filter']+'%')});}else{var _0x1c824a={};_0x1c824a[_0x48d0f0[_0x784e('0x39')]]={'$like':'%'+_0x4ea50b[_0x784e('0x2e')][_0x784e('0x37')]+'%'};return _0x1c824a;}}})});}_0x14547a=_[_0x784e('0x3e')]({},_0x14547a,_0x4ea50b['options']);return _0x14547a;}; \ No newline at end of file +var _0x8958=['$gte','format','YYYY-MM-DD','utc','subtract','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','DESC','omit','length','unset','hasOwnProperty','match','^[+]?[0-9]*$','isEmail','forEach','replace','join','$id','query','model','name','intersection','attributes','fields','order','pick','filter','object','columns','lower','options','sequelize','parse','keys','includes','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject'];(function(_0x27f535,_0x5bc62e){var _0x586d0a=function(_0x21d7b9){while(--_0x21d7b9){_0x27f535['push'](_0x27f535['shift']());}};_0x586d0a(++_0x5bc62e);}(_0x8958,0x93));var _0x8895=function(_0x4fca30,_0x1e8012){_0x4fca30=_0x4fca30-0x0;var _0x21d4fc=_0x8958[_0x4fca30];return _0x21d4fc;};'use strict';var _=require('lodash');var sequelize=require(_0x8895('0x0'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4eda63){var _0x5baab1=['ne'];try{var _0x4cea64=JSON[_0x8895('0x1')](_0x4eda63);var _0x56e738=Object[_0x8895('0x2')](_0x4cea64)[0x0];return _0x5baab1[_0x8895('0x3')](_0x56e738);}catch(_0x26d8e3){return![];}}function getOperatorValue(_0x59e641){var _0x22fa52=JSON[_0x8895('0x1')](_0x59e641);var _0x124e1e=Object[_0x8895('0x2')](_0x22fa52)[0x0];var _0x33013a=_0x22fa52[_0x124e1e];return{['$'+_0x124e1e]:_0x33013a};}exports['fields']=function(_0xe018b8){var _0xc2be9f=null;if(_0xe018b8){_0xc2be9f=_0xe018b8[_0x8895('0x4')](',');}return _0xc2be9f;};exports[_0x8895('0x5')]=function(_0x6eab1e,_0x29c126){var _0x22a12b={};if(!_[_0x8895('0x6')](_0x6eab1e)){_[_0x8895('0x7')](_0x6eab1e,function(_0x107d86,_0x4d1358){try{if(_0x29c126){var _0x1cf600=_[_0x8895('0x8')](_0x29c126,{'name':_0x4d1358})||{};if(hasSequelizeOperator(_0x107d86)){_0x22a12b[_0x4d1358]=getOperatorValue(_0x107d86);}else if(_0x1cf600[_0x8895('0x9')]===_0x8895('0xa')&&_[_0x8895('0xb')](_0x107d86)){var _0xaf93bc=JSON['parse'](_0x107d86);var _0x24c53d={'$gte':moment(moment(_0xaf93bc[_0x8895('0xc')])[_0x8895('0xd')]('YYYY-MM-DD'))['utc']()[_0x8895('0xd')](),'$lte':moment(moment(_0xaf93bc['$lte'])[_0x8895('0xd')](_0x8895('0xe')))[_0x8895('0xf')]()[_0x8895('0x10')](0x1,'s')[_0x8895('0xd')]()};_0x22a12b[_0x4d1358]=_0x24c53d;}else if(_0x1cf600['name']===_0x8895('0x11')){_0x22a12b[_0x4d1358]=_0x107d86;}else{_0x22a12b[_0x4d1358]=_[_0x8895('0x12')](_0x107d86)?_0x107d86:JSON[_0x8895('0x1')](_0x107d86);}}else{_0x22a12b[_0x4d1358]=_[_0x8895('0x12')](_0x107d86)?_0x107d86:JSON[_0x8895('0x1')](_0x107d86);}}catch(_0x1b5c82){_0x22a12b[_0x4d1358]=_0x107d86[_0x8895('0x4')](',');}});}return _0x22a12b;};exports[_0x8895('0x13')]=function(_0x135c11){_0x135c11=parseInt(_0x135c11,0xa);if(!_0x135c11||_0x135c11<0x0){_0x135c11=LIMIT_VALUE;}return _0x135c11;};exports[_0x8895('0x14')]=function(_0x24fef0){_0x24fef0=parseInt(_0x24fef0,0xa);if(!_0x24fef0||_0x24fef0<0x0){_0x24fef0=0x0;}return _0x24fef0;};exports[_0x8895('0x15')]=function(_0x2df795){var _0x54e6d4,_0x522a4e=null;if(_0x2df795){_0x54e6d4=_0x2df795['split'](',');_0x522a4e=_[_0x8895('0x16')](_0x54e6d4,function(_0x456282){if(_0x456282[_0x8895('0x17')]('-')===0x0){return[_0x456282===_0x8895('0x18')?sequelize[_0x8895('0x19')](sequelize[_0x8895('0x1a')](_0x8895('0x18')),_0x8895('0x1b')):_0x456282['substr'](0x1),_0x8895('0x1c')];}else{return[_0x456282===_0x8895('0x18')?sequelize[_0x8895('0x19')](sequelize[_0x8895('0x1a')](_0x8895('0x18')),'unsigned'):_0x456282,'ASC'];}});}return _0x522a4e;};exports[_0x8895('0x1d')]=function(_0x398382,_0x38f7ad){if(_[_0x8895('0x6')](_0x398382)){return _0x398382;}if(_['isArray'](_0x398382)){for(var _0x25da11=0x0;_0x25da11<_0x398382[_0x8895('0x1e')];_0x25da11+=0x1){_0x398382[_0x25da11]=this[_0x8895('0x1d')](_0x398382[_0x25da11],_0x38f7ad);}return _0x398382;}if(!_['isObject'](_0x398382)){return _0x398382;}if(_['isString'](_0x38f7ad)){_0x38f7ad=[_0x38f7ad];}if(!_[_0x8895('0x12')](_0x38f7ad)){return _0x398382;}for(var _0x555e60=0x0;_0x555e60<_0x38f7ad[_0x8895('0x1e')];_0x555e60+=0x1){_[_0x8895('0x1f')](_0x398382,_0x38f7ad[_0x555e60]);}for(var _0x10b48f in _0x398382){if(_0x398382[_0x8895('0x20')](_0x10b48f)){_0x398382[_0x10b48f]=this[_0x8895('0x1d')](_0x398382[_0x10b48f],_0x38f7ad);}}return _0x398382;};exports['isNumeric']=function(_0x4d567a){return _0x4d567a[_0x8895('0x21')](RegExp(_0x8895('0x22')))?!![]:![];};exports[_0x8895('0x23')]=function(_0x16b65b){return _0x16b65b[_0x8895('0x21')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x4ce759){var _0x46ae32=[];_0x4ce759[_0x8895('0x4')](/[ ,]+/)[_0x8895('0x24')](function(_0x29f565){_0x29f565=_0x29f565[_0x8895('0x25')](/([^:]")"+/g,'$1');_0x29f565='+'+_0x29f565+'*';var _0x52f2ac=/[ `!@#$%^&*()_\-?~]/;if(_0x29f565[_0x8895('0x21')](_0x52f2ac))_0x29f565='\x22'+_0x29f565+'\x22';_0x46ae32['push'](_0x29f565);});return _0x46ae32[_0x8895('0x26')]('\x20');};exports['getOptions']=function(_0x40ba14,_0x1a3fe5,_0x233473){var _0x3e71fa={},_0x1dca3d={};if(_0x1a3fe5['query'][_0x8895('0x27')]){_0x1a3fe5[_0x8895('0x28')]['id']=_0x1a3fe5[_0x8895('0x28')][_0x8895('0x27')];delete _0x1a3fe5[_0x8895('0x28')]['$id'];}_0x3e71fa[_0x8895('0x29')]=_['map'](_0x40ba14,_0x8895('0x2a'));_0x3e71fa['query']=_[_0x8895('0x2')](_0x1a3fe5[_0x8895('0x28')]);_0x3e71fa[_0x8895('0x5')]=_[_0x8895('0x2b')](_0x3e71fa[_0x8895('0x29')],_0x3e71fa['query']);_0x1dca3d[_0x8895('0x2c')]=_['intersection'](_0x3e71fa[_0x8895('0x29')],this[_0x8895('0x2d')](_0x1a3fe5[_0x8895('0x28')][_0x8895('0x2d')]));_0x1dca3d[_0x8895('0x2c')]=_0x1dca3d[_0x8895('0x2c')]['length']?_0x1dca3d[_0x8895('0x2c')]:_0x3e71fa[_0x8895('0x29')];if(!_0x1a3fe5['query'][_0x8895('0x20')]('nolimit')){_0x1dca3d[_0x8895('0x13')]=this[_0x8895('0x13')](_0x1a3fe5['query'][_0x8895('0x13')]);_0x1dca3d[_0x8895('0x14')]=this['offset'](_0x1a3fe5['query'][_0x8895('0x14')]);}_0x1dca3d[_0x8895('0x2e')]=this[_0x8895('0x15')](_0x1a3fe5[_0x8895('0x28')][_0x8895('0x15')]);_0x1dca3d['where']=this[_0x8895('0x5')](_[_0x8895('0x2f')](_0x1a3fe5[_0x8895('0x28')],_0x3e71fa[_0x8895('0x5')]),_0x40ba14);if(_0x1a3fe5[_0x8895('0x28')][_0x8895('0x30')]){var _0x4a7e22=_0x40ba14;var _0x174be1=_0x1a3fe5['query'][_0x8895('0x30')];if(typeof _0x174be1===_0x8895('0x31')){_0x4a7e22=_['filter'](_0x40ba14,function(_0x1ca234){return _['includes'](_0x174be1[_0x8895('0x32')],_0x1ca234['name']);});_0x174be1=_0x174be1['value'];}_0x1dca3d['where']=_['merge'](_0x1dca3d['where'],{'$or':_['map'](_0x4a7e22,function(_0x447ed6){if(_0x447ed6[_0x8895('0x9')]!=='VIRTUAL'){if(_0x233473){return sequelize['where'](sequelize['fn'](_0x8895('0x33'),sequelize[_0x8895('0x1a')](_0x447ed6['name'])),{'$like':sequelize['fn'](_0x8895('0x33'),'%'+_0x1a3fe5[_0x8895('0x28')][_0x8895('0x30')]+'%')});}else{var _0x3b873b={};_0x3b873b[_0x447ed6[_0x8895('0x2a')]]={'$like':'%'+_0x1a3fe5['query']['filter']+'%'};return _0x3b873b;}}})});}_0x1dca3d=_['merge']({},_0x1dca3d,_0x1a3fe5[_0x8895('0x34')]);return _0x1dca3d;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 2be0bc8..b0a6509 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f9f=['validateSortParameter','sort','pauseType','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','routealias','omit','pick','lodash','client','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','chatStatus','faxStatus','mailStatus','smsStatus','request','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','User','findAll','name','fullname','find','globalStatus','catch','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','internal','substring','indexOf'];(function(_0x118e16,_0x2a6f97){var _0x9f7b89=function(_0xd8909a){while(--_0xd8909a){_0x118e16['push'](_0x118e16['shift']());}};_0x9f7b89(++_0x2a6f97);}(_0x3f9f,0xe4));var _0xf3f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f9f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf3f9('0x0'));var jayson=require('jayson/promise');var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xf3f9('0x1')]['http']({'port':0x232a});var routingClient=jayson[_0xf3f9('0x1')]['http']({'port':0x232c});function isAgentPaused(_0x3a9b79,_0x187ccb){var _0x5dcbac=[_0x3a9b79[_0xf3f9('0x2')],_0x3a9b79[_0xf3f9('0x3')],_0x3a9b79[_0xf3f9('0x4')],_0x3a9b79[_0xf3f9('0x5')],_0x3a9b79[_0xf3f9('0x6')],_0x3a9b79[_0xf3f9('0x7')],_0x3a9b79[_0xf3f9('0x8')]];if(!_0x187ccb)return _[_0xf3f9('0x9')](_0x5dcbac);var _0x559fcc=_[_0xf3f9('0xa')](_0x5dcbac);return _0x559fcc[_0xf3f9('0xb')]>0x0&&_0x559fcc['length']<_0x5dcbac[_0xf3f9('0xb')]?!![]:![];}function isIdle(_0x1f7a4d){return _0x1f7a4d===_0xf3f9('0xc')||_0x1f7a4d===_0xf3f9('0xd')||_0x1f7a4d===_0xf3f9('0xe')||_0x1f7a4d===_0xf3f9('0xf')||_[_0xf3f9('0x10')](_0x1f7a4d);}function isAgentIdle(_0x1fa19f){if(_0x1fa19f[_0xf3f9('0x11')]!=='idle'&&_0x1fa19f['voicePause']){_0x1fa19f[_0xf3f9('0x11')]=_0xf3f9('0x12');return![];}return _[_0xf3f9('0x9')]([_0x1fa19f[_0xf3f9('0x13')],_0x1fa19f[_0xf3f9('0x14')],_0x1fa19f[_0xf3f9('0x15')],_0x1fa19f['openchannelStatus'],_0x1fa19f[_0xf3f9('0x16')],_0x1fa19f[_0xf3f9('0x11')],_0x1fa19f['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0xf3f9('0x17')](_0xf3f9('0x18'),{})['then'](function(_0x20d277){if(_0x20d277['error']){throw new Error(_0xf3f9('0x19'));}var _0x5b2eed=_0x20d277['result'];return routingClient[_0xf3f9('0x17')](_0xf3f9('0x18'),{})[_0xf3f9('0x1a')](function(_0x5a90d9){if(_0x5a90d9['error']){throw new Error(_0xf3f9('0x1b'));}var _0x55ea92=_0x5a90d9[_0xf3f9('0x1c')];return _[_0xf3f9('0x1d')]({},_0x5b2eed,_0x55ea92);});})['catch'](function(_0x5c0b43){throw _0x5c0b43;});}exports[_0xf3f9('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x13d32c){var _0x5157ee='unknown';if(isAgentPaused(_0x13d32c))_0x5157ee=_0xf3f9('0x12');else if(isAgentPaused(_0x13d32c,!![]))_0x5157ee=_0xf3f9('0x1f');else if(isAgentIdle(_0x13d32c))_0x5157ee='idle';else _0x5157ee=_0xf3f9('0x20');return _0x5157ee;}exports[_0xf3f9('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x659409,_0x31f056){var _0x361f1f=_[_0xf3f9('0x22')](_0x659409)?_0x659409:[_0x659409];var _0x46b107=_[_0xf3f9('0x23')](_0x31f056)+_0xf3f9('0x24');var _0x3db4a6=_[_0xf3f9('0x25')](_0x361f1f,function(_0x28ed77){return db[_0x46b107][_0xf3f9('0x26')]({'where':{'id':_0x28ed77}})[_0xf3f9('0x1a')](function(_0x3c933e){if(!_0x3c933e)return[];return _0x3c933e[_0xf3f9('0x27')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x3db4a6)[_0xf3f9('0x1a')](function(_0x3269be){var _0x5e1430=_(_0x3269be)['flatten']()[_0xf3f9('0x25')]('id')[_0xf3f9('0x28')]()[_0xf3f9('0x29')]();return _0x5e1430;});}exports[_0xf3f9('0x2a')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3e0a0e,_0x580709,_0xdfa6e6){try{if(_0x580709[_0xf3f9('0xb')]>0x0){_0x3e0a0e=_0x3e0a0e[_0xf3f9('0xa')](function(_0x5746e5){return _0x580709[_0xf3f9('0x2b')](_0x5746e5['id']);});}var _0x274bcb=_0x3e0a0e['filter'](function(_0x41b57f){var _0x2cf7d8=_0xf3f9('0x20');if(isAgentIdle(_0x41b57f)){_0x2cf7d8=_0xf3f9('0xc');}return _0x2cf7d8===_0xdfa6e6;});return _[_0xf3f9('0x25')](_0x274bcb,'id');}catch(_0x5ed636){throw _0x5ed636;}}exports[_0xf3f9('0x2c')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x5c8159,_0x5d93a7,_0x4b0101){return Promise['resolve']()[_0xf3f9('0x1a')](function(){if(_0x5d93a7[_0xf3f9('0xb')]>0x0){_0x5c8159=_0x5c8159[_0xf3f9('0xa')](function(_0x2a1544){return _0x5d93a7[_0xf3f9('0x2b')](_0x2a1544['id']);});}return _0x5c8159;})[_0xf3f9('0x1a')](function(){return db[_0xf3f9('0x2d')][_0xf3f9('0x2e')]({'attributes':['id',_0xf3f9('0x2f'),_0xf3f9('0x30'),_0xf3f9('0x2'),_0xf3f9('0x3'),_0xf3f9('0x4'),_0xf3f9('0x5'),'smsPause',_0xf3f9('0x7'),_0xf3f9('0x8'),'pauseType'],'where':{'id':{'$in':_[_0xf3f9('0x25')](_0x5c8159,'id')}},'raw':!![]});})[_0xf3f9('0x1a')](function(_0x30361c){return _0x30361c[_0xf3f9('0x25')](function(_0x5d7a96){var _0x43db8f=_[_0xf3f9('0x31')](_0x5c8159,['id',_0x5d7a96['id']]);var _0x4920dc=filterAgentAttributes(_0x43db8f);_[_0xf3f9('0x1d')](_0x5d7a96,_0x4920dc);_0x5d7a96[_0xf3f9('0x32')]=getAgentStatus(_0x5d7a96);return _0x5d7a96;});})[_0xf3f9('0x1a')](function(_0x224298){var _0x4be335=sortAgentsByStatus(_0x224298,_0x4b0101);return _[_0xf3f9('0x25')](_0x4be335,'id');})[_0xf3f9('0x33')](function(_0x1a2f27){throw _0x1a2f27;});}exports[_0xf3f9('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x13cfeb){var _0x4f7fad={'fields':[],'order':null};var _0xce4d45=_0x13cfeb[_0xf3f9('0x35')](',');_0x4f7fad[_0xf3f9('0x36')]=_[_0xf3f9('0xa')](_0xce4d45,function(_0x3f922f){if(!_0x3f922f['includes'](_0xf3f9('0x32'))){return!![];}_0x4f7fad[_0xf3f9('0x37')]=_[_0xf3f9('0x38')](_0x3f922f,'-')?_0xf3f9('0x39'):_0xf3f9('0x3a');return![];});return _0x4f7fad;}exports[_0xf3f9('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0x4eda24){if(_0x4eda24[_0xf3f9('0x2b')](_0xf3f9('0x30'))&&!_0x4eda24[_0xf3f9('0x2b')](_0xf3f9('0x3c'))){var _0x214871=_0x4eda24[_0xf3f9('0x3d')](0x0,_0x4eda24[_0xf3f9('0x3e')](_0xf3f9('0x30')));_0x4eda24+=','+_0x214871+_0xf3f9('0x3c');}return _0x4eda24;}exports[_0xf3f9('0x3f')]=validateSortParameter;function sortAgentsByStatus(_0x17ae26,_0x3db221){var _0x2cd51a=_0x17ae26[_0xf3f9('0x40')](function(_0x87d976,_0xf63334){if(_0x87d976[_0xf3f9('0x32')]===_0xf63334[_0xf3f9('0x32')]){if(_0x87d976[_0xf3f9('0x32')]===_0xf3f9('0x12')){if(_0x3db221===_0xf3f9('0x39')){return(_0x87d976[_0xf3f9('0x41')]||'')<(_0xf63334[_0xf3f9('0x41')]||'')||_0x87d976[_0xf3f9('0x30')][_0xf3f9('0x42')]()>_0xf63334['fullname'][_0xf3f9('0x42')]()?0x1:-0x1;}else{return(_0x87d976[_0xf3f9('0x41')]||'')<(_0xf63334[_0xf3f9('0x41')]||'')||_0x87d976['fullname'][_0xf3f9('0x42')]()>_0xf63334['fullname']['toLowerCase']()?-0x1:0x1;}}else{if(_0x3db221===_0xf3f9('0x39')){return _0x87d976['fullname'][_0xf3f9('0x42')]()<_0xf63334['fullname'][_0xf3f9('0x42')]()?0x1:-0x1;}else{return _0x87d976[_0xf3f9('0x30')][_0xf3f9('0x42')]()<_0xf63334['fullname'][_0xf3f9('0x42')]()?-0x1:0x1;}}}else{if(_0x3db221===_0xf3f9('0x39')){return _0x87d976[_0xf3f9('0x32')]<_0xf63334[_0xf3f9('0x32')]?0x1:-0x1;}else{return _0x87d976[_0xf3f9('0x32')]<_0xf63334[_0xf3f9('0x32')]?-0x1:0x1;}}});return _0x2cd51a;}exports[_0xf3f9('0x43')]=sortAgentsByStatus;function filterAgentAttributes(_0x2d0b55){var _0x459e4c=[_0xf3f9('0x44'),_0xf3f9('0x45'),_0xf3f9('0x46'),_0xf3f9('0x47'),_0xf3f9('0x41'),_0xf3f9('0x47'),_0xf3f9('0x3c'),_0xf3f9('0x48'),_0xf3f9('0x2'),'openchannelPause',_0xf3f9('0x4'),'smsPause','whatsappPause',_0xf3f9('0x3'),'voicePause',_0xf3f9('0x49'),_0xf3f9('0x4a'),_0xf3f9('0x4b'),_0xf3f9('0x4c'),_0xf3f9('0x4d'),_0xf3f9('0x4e'),_0xf3f9('0x4f'),_0xf3f9('0x50'),_0xf3f9('0x51'),_0xf3f9('0x52'),_0xf3f9('0x53'),_0xf3f9('0x54'),'chatStatus',_0xf3f9('0x55'),_0xf3f9('0x15'),'smsStatus','whatsappStatus',_0xf3f9('0x14'),_0xf3f9('0x11'),_0xf3f9('0x56'),_0xf3f9('0x57'),_0xf3f9('0x58'),_0xf3f9('0x59'),'whatsappStatusTime','faxStatusTime',_0xf3f9('0x5a'),_0xf3f9('0x5b'),_0xf3f9('0x5c'),_0xf3f9('0x5d'),'phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording',_0xf3f9('0x5e')];var _0x219bc1=[_0xf3f9('0x2'),_0xf3f9('0x5'),_0xf3f9('0x4'),_0xf3f9('0x6'),'whatsappPause','faxPause',_0xf3f9('0x7'),_0xf3f9('0x45')];var _0x1adb9a=_(_0x2d0b55)[_0xf3f9('0x5f')](_0x219bc1)[_0xf3f9('0x60')](_0x459e4c)[_0xf3f9('0x29')]();return _0x1adb9a;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file +var _0x3943=['openchannelStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','online','omit','pick','filterAgentAttributes','jayson/promise','client','http','chatPause','openchannelPause','voicePause','whatsappPause','every','filter','length','idle','unknown','unavailable','ringing','voiceStatus','pause','faxStatus','mailStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','*pause','busy','map','getAgents','flatten','value','getAgentIdsByQueues','includes','resolve','findAll','name','fullname','faxPause','mailPause','smsPause','pauseType','getSortedAgentsIdsByStatus','split','globalStatus','order','startsWith','DESC','ASC','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','userpic','lastLoginAt','address','chatCapacity','openchannelCapacity','mailCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','faxCurrentCapacity','chatStatus'];(function(_0xe6a5e3,_0x8cbaeb){var _0xba9506=function(_0x4c8d0c){while(--_0x4c8d0c){_0xe6a5e3['push'](_0xe6a5e3['shift']());}};_0xba9506(++_0x8cbaeb);}(_0x3943,0x1b2));var _0x3394=function(_0x39b4b5,_0x2edce7){_0x39b4b5=_0x39b4b5-0x0;var _0x33d92b=_0x3943[_0x39b4b5];return _0x33d92b;};'use strict';var _=require('lodash');var jayson=require(_0x3394('0x0'));var db=require('../../mysqldb')['db'];var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson[_0x3394('0x1')][_0x3394('0x2')]({'port':0x232c});function isAgentPaused(_0x5d2ee9,_0xf3da24){var _0xd3a081=[_0x5d2ee9[_0x3394('0x3')],_0x5d2ee9['faxPause'],_0x5d2ee9['mailPause'],_0x5d2ee9[_0x3394('0x4')],_0x5d2ee9['smsPause'],_0x5d2ee9[_0x3394('0x5')],_0x5d2ee9[_0x3394('0x6')]];if(!_0xf3da24)return _[_0x3394('0x7')](_0xd3a081);var _0x557841=_[_0x3394('0x8')](_0xd3a081);return _0x557841[_0x3394('0x9')]>0x0&&_0x557841[_0x3394('0x9')]<_0xd3a081[_0x3394('0x9')]?!![]:![];}function isIdle(_0x107664){return _0x107664===_0x3394('0xa')||_0x107664===_0x3394('0xb')||_0x107664===_0x3394('0xc')||_0x107664===_0x3394('0xd')||_['isNil'](_0x107664);}function isAgentIdle(_0x1799a2){if(_0x1799a2[_0x3394('0xe')]!=='idle'&&_0x1799a2[_0x3394('0x5')]){_0x1799a2[_0x3394('0xe')]=_0x3394('0xf');return![];}return _[_0x3394('0x7')]([_0x1799a2['chatStatus'],_0x1799a2[_0x3394('0x10')],_0x1799a2[_0x3394('0x11')],_0x1799a2['openchannelStatus'],_0x1799a2[_0x3394('0x12')],_0x1799a2[_0x3394('0xe')],_0x1799a2[_0x3394('0x13')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x3394('0x14')](_0x3394('0x15'),{})[_0x3394('0x16')](function(_0x4a147f){if(_0x4a147f[_0x3394('0x17')]){throw new Error(_0x3394('0x18'));}var _0x18a979=_0x4a147f[_0x3394('0x19')];return routingClient[_0x3394('0x14')](_0x3394('0x15'),{})['then'](function(_0x2f72e2){if(_0x2f72e2[_0x3394('0x17')]){throw new Error(_0x3394('0x1a'));}var _0x3e5587=_0x2f72e2[_0x3394('0x19')];return _[_0x3394('0x1b')]({},_0x18a979,_0x3e5587);});})[_0x3394('0x1c')](function(_0x18844e){throw _0x18844e;});}exports[_0x3394('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x43a2ce){var _0x472c63='unknown';if(isAgentPaused(_0x43a2ce))_0x472c63=_0x3394('0xf');else if(isAgentPaused(_0x43a2ce,!![]))_0x472c63=_0x3394('0x1e');else if(isAgentIdle(_0x43a2ce))_0x472c63='idle';else _0x472c63=_0x3394('0x1f');return _0x472c63;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x146a8a,_0x4c63ed){var _0x42dd6b=_['isArray'](_0x146a8a)?_0x146a8a:[_0x146a8a];var _0x1b6c51=_['startCase'](_0x4c63ed)+'Queue';var _0x52b869=_[_0x3394('0x20')](_0x42dd6b,function(_0x5f14cc){return db[_0x1b6c51]['findOne']({'where':{'id':_0x5f14cc}})[_0x3394('0x16')](function(_0x158896){if(!_0x158896)return[];return _0x158896[_0x3394('0x21')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x52b869)[_0x3394('0x16')](function(_0x536e5c){var _0x315507=_(_0x536e5c)[_0x3394('0x22')]()[_0x3394('0x20')]('id')['uniq']()[_0x3394('0x23')]();return _0x315507;});}exports[_0x3394('0x24')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x1c78e2,_0x3a7277,_0x34248a){try{if(_0x3a7277['length']>0x0){_0x1c78e2=_0x1c78e2[_0x3394('0x8')](function(_0x23ac12){return _0x3a7277[_0x3394('0x25')](_0x23ac12['id']);});}var _0x4a2546=_0x1c78e2[_0x3394('0x8')](function(_0x468010){var _0x4dc887='busy';if(isAgentIdle(_0x468010)){_0x4dc887=_0x3394('0xa');}return _0x4dc887===_0x34248a;});return _[_0x3394('0x20')](_0x4a2546,'id');}catch(_0x321a35){throw _0x321a35;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x510b86,_0x4c6d50,_0x3941ed){return Promise[_0x3394('0x26')]()[_0x3394('0x16')](function(){if(_0x4c6d50[_0x3394('0x9')]>0x0){_0x510b86=_0x510b86[_0x3394('0x8')](function(_0x451924){return _0x4c6d50[_0x3394('0x25')](_0x451924['id']);});}return _0x510b86;})[_0x3394('0x16')](function(){return db['User'][_0x3394('0x27')]({'attributes':['id',_0x3394('0x28'),_0x3394('0x29'),_0x3394('0x3'),_0x3394('0x2a'),_0x3394('0x2b'),'openchannelPause',_0x3394('0x2c'),_0x3394('0x5'),'whatsappPause',_0x3394('0x2d')],'where':{'id':{'$in':_[_0x3394('0x20')](_0x510b86,'id')}},'raw':!![]});})[_0x3394('0x16')](function(_0x5a21d4){return _0x5a21d4['map'](function(_0x5a19a3){var _0x2ccc38=_['find'](_0x510b86,['id',_0x5a19a3['id']]);var _0x17cab1=filterAgentAttributes(_0x2ccc38);_[_0x3394('0x1b')](_0x5a19a3,_0x17cab1);_0x5a19a3['globalStatus']=getAgentStatus(_0x5a19a3);return _0x5a19a3;});})[_0x3394('0x16')](function(_0x3712df){var _0x996c5a=sortAgentsByStatus(_0x3712df,_0x3941ed);return _['map'](_0x996c5a,'id');})[_0x3394('0x1c')](function(_0x32ab18){throw _0x32ab18;});}exports[_0x3394('0x2e')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x4e1869){var _0x149e02={'fields':[],'order':null};var _0x5cbe9f=_0x4e1869[_0x3394('0x2f')](',');_0x149e02['fields']=_[_0x3394('0x8')](_0x5cbe9f,function(_0x16fe21){if(!_0x16fe21['includes'](_0x3394('0x30'))){return!![];}_0x149e02[_0x3394('0x31')]=_[_0x3394('0x32')](_0x16fe21,'-')?_0x3394('0x33'):_0x3394('0x34');return![];});return _0x149e02;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x280f20){if(_0x280f20[_0x3394('0x25')](_0x3394('0x29'))&&!_0x280f20[_0x3394('0x25')](_0x3394('0x35'))){var _0x281b76=_0x280f20[_0x3394('0x36')](0x0,_0x280f20[_0x3394('0x37')](_0x3394('0x29')));_0x280f20+=','+_0x281b76+_0x3394('0x35');}return _0x280f20;}exports[_0x3394('0x38')]=validateSortParameter;function sortAgentsByStatus(_0x289f63,_0x3af587){var _0x2a7956=_0x289f63[_0x3394('0x39')](function(_0x30a5a1,_0x135069){if(_0x30a5a1[_0x3394('0x30')]===_0x135069['globalStatus']){if(_0x30a5a1['globalStatus']===_0x3394('0xf')){if(_0x3af587===_0x3394('0x33')){return(_0x30a5a1[_0x3394('0x2d')]||'')<(_0x135069[_0x3394('0x2d')]||'')||_0x30a5a1[_0x3394('0x29')][_0x3394('0x3a')]()>_0x135069[_0x3394('0x29')][_0x3394('0x3a')]()?0x1:-0x1;}else{return(_0x30a5a1[_0x3394('0x2d')]||'')<(_0x135069['pauseType']||'')||_0x30a5a1[_0x3394('0x29')]['toLowerCase']()>_0x135069[_0x3394('0x29')][_0x3394('0x3a')]()?-0x1:0x1;}}else{if(_0x3af587==='DESC'){return _0x30a5a1[_0x3394('0x29')][_0x3394('0x3a')]()<_0x135069[_0x3394('0x29')][_0x3394('0x3a')]()?0x1:-0x1;}else{return _0x30a5a1[_0x3394('0x29')][_0x3394('0x3a')]()<_0x135069[_0x3394('0x29')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x3af587===_0x3394('0x33')){return _0x30a5a1[_0x3394('0x30')]<_0x135069[_0x3394('0x30')]?0x1:-0x1;}else{return _0x30a5a1[_0x3394('0x30')]<_0x135069[_0x3394('0x30')]?-0x1:0x1;}}});return _0x2a7956;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x46f236){var _0x4b134f=[_0x3394('0x3b'),'online',_0x3394('0x3c'),'lastPauseAt','pauseType','lastPauseAt',_0x3394('0x35'),_0x3394('0x3d'),'chatPause',_0x3394('0x4'),_0x3394('0x2b'),_0x3394('0x2c'),_0x3394('0x6'),_0x3394('0x2a'),_0x3394('0x5'),_0x3394('0x3e'),_0x3394('0x3f'),_0x3394('0x40'),'smsCapacity','whatsappCapacity','faxCapacity',_0x3394('0x41'),_0x3394('0x42'),_0x3394('0x43'),'smsCurrentCapacity','whatsappCurrentCapacity',_0x3394('0x44'),_0x3394('0x45'),_0x3394('0x46'),_0x3394('0x11'),_0x3394('0x12'),'whatsappStatus',_0x3394('0x10'),_0x3394('0xe'),_0x3394('0x47'),_0x3394('0x48'),_0x3394('0x49'),_0x3394('0x4a'),'whatsappStatusTime',_0x3394('0x4b'),'voiceStatusTime','queue',_0x3394('0x4c'),_0x3394('0x4d'),_0x3394('0x4e'),_0x3394('0x4f'),'routealias'];var _0x4b21bf=['chatPause',_0x3394('0x4'),'mailPause',_0x3394('0x2c'),'whatsappPause',_0x3394('0x2a'),_0x3394('0x5'),_0x3394('0x50')];var _0x5a61f4=_(_0x46f236)[_0x3394('0x51')](_0x4b21bf)[_0x3394('0x52')](_0x4b134f)[_0x3394('0x23')]();return _0x5a61f4;}exports[_0x3394('0x53')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index aafd549..3ac137d 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe635=['originated','dialActive','dialMethod','Trunk','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','voice','request','startCase','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','outbound','concat','map','get','loggedIn','talking','find','pick','lodash','jayson/promise','client','http','available','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringInUse','unavailable','pTalking'];(function(_0xd2a736,_0x137882){var _0x33a0b2=function(_0x1792ac){while(--_0x1792ac){_0xd2a736['push'](_0xd2a736['shift']());}};_0x33a0b2(++_0x137882);}(_0xe635,0x1a0));var _0x5e63=function(_0xe73de1,_0x4489e6){_0xe73de1=_0xe73de1-0x0;var _0x12454b=_0xe635[_0xe73de1];return _0x12454b;};'use strict';var _=require(_0x5e63('0x0'));var jayson=require(_0x5e63('0x1'));var util=require('util');var amiClient=jayson[_0x5e63('0x2')][_0x5e63('0x3')]({'port':0x232a});var routingClient=jayson[_0x5e63('0x2')]['http']({'port':0x232c});var QUEUE_DEFAULT_ATTRIBUTES=[_0x5e63('0x4'),'loggedIn',_0x5e63('0x5'),_0x5e63('0x6')];var INBOUND_VOICE_QUEUE_ATTRIBUTES=[_0x5e63('0x7'),_0x5e63('0x8'),_0x5e63('0x9'),_0x5e63('0xa'),_0x5e63('0xb'),_0x5e63('0xc'),'ringing',_0x5e63('0xd'),'talking',_0x5e63('0xe'),'unknown'];var OUTBOUND_VOICE_QUEUE_ATTRIBUTES=[_0x5e63('0xf'),_0x5e63('0x10'),'message',_0x5e63('0x11'),_0x5e63('0x12'),_0x5e63('0x13'),'startPredictive','startProgressive',_0x5e63('0x14'),_0x5e63('0x15'),_0x5e63('0x16'),_0x5e63('0x17'),_0x5e63('0x18'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0x5e63('0x19'),'predictiveIntervalTotalCalls',_0x5e63('0x1a'),_0x5e63('0x1b'),_0x5e63('0x1c'),_0x5e63('0x1d'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x496cda,_0x3a0ed8){var _0x39f7d2=_0x3a0ed8===_0x5e63('0x1e')?amiClient:routingClient;return _0x39f7d2[_0x5e63('0x1f')](_[_0x5e63('0x20')](_0x3a0ed8)+_0x5e63('0x21'),_0x496cda)[_0x5e63('0x22')](function(_0x238ed6){if(_0x238ed6['error'])throw new Error(util[_0x5e63('0x23')](_0x5e63('0x24'),_0x3a0ed8));return _0x238ed6[_0x5e63('0x25')];})[_0x5e63('0x26')](function(_0x3f9ac9){throw _0x3f9ac9;});}exports[_0x5e63('0x27')]=getRealtimeQueues;function initializeQueues(_0x384bb6,_0x54c6f9,_0x3dfe6f,_0x3189cd){var _0x19191d=QUEUE_DEFAULT_ATTRIBUTES;if(_0x3dfe6f==='voice'){if(_0x3189cd===_0x5e63('0x28')){_0x19191d=_0x19191d[_0x5e63('0x29')](OUTBOUND_VOICE_QUEUE_ATTRIBUTES);}else{_0x19191d=_0x19191d[_0x5e63('0x29')](INBOUND_VOICE_QUEUE_ATTRIBUTES);}}return _0x384bb6[_0x5e63('0x2a')](function(_0x20e028){var _0x39cc82=_0x20e028[_0x5e63('0x2b')]({'plain':!![]});_0x39cc82[_0x5e63('0x5')]=0x0;_0x39cc82[_0x5e63('0xa')]=0x0;_0x39cc82[_0x5e63('0x2c')]=0x0;_0x39cc82[_0x5e63('0x4')]=0x0;_0x39cc82[_0x5e63('0x6')]=0x0;if(_0x3dfe6f==='voice'){_0x39cc82[_0x5e63('0x2d')]=0x0;_0x39cc82[_0x5e63('0x7')]=0x0;if(_0x3189cd===_0x5e63('0x28')){_0x39cc82[_0x5e63('0xf')]=0x0;_0x39cc82[_0x5e63('0x10')]=0x0;}}var _0x36d343=_[_0x5e63('0x2e')](_0x54c6f9,['id',_0x39cc82['id']]);if(_0x36d343){_['merge'](_0x39cc82,_[_0x5e63('0x2f')](_0x36d343,_0x19191d));}return _0x39cc82;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file +var _0x95b3=['startCase','Queues','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','outbound','concat','map','get','voice','find','initializeQueues','lodash','jayson/promise','util','client','http','available','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unavailable','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime'];(function(_0x595505,_0x56cc58){var _0x4d62d7=function(_0x47a93f){while(--_0x47a93f){_0x595505['push'](_0x595505['shift']());}};_0x4d62d7(++_0x56cc58);}(_0x95b3,0x164));var _0x395b=function(_0x17dc3a,_0x3264ee){_0x17dc3a=_0x17dc3a-0x0;var _0x1a3012=_0x95b3[_0x17dc3a];return _0x1a3012;};'use strict';var _=require(_0x395b('0x0'));var jayson=require(_0x395b('0x1'));var util=require(_0x395b('0x2'));var amiClient=jayson[_0x395b('0x3')][_0x395b('0x4')]({'port':0x232a});var routingClient=jayson[_0x395b('0x3')][_0x395b('0x4')]({'port':0x232c});var QUEUE_DEFAULT_ATTRIBUTES=[_0x395b('0x5'),'loggedIn',_0x395b('0x6'),_0x395b('0x7')];var INBOUND_VOICE_QUEUE_ATTRIBUTES=[_0x395b('0x8'),_0x395b('0x9'),_0x395b('0xa'),_0x395b('0xb'),_0x395b('0xc'),_0x395b('0xd'),_0x395b('0xe'),_0x395b('0xf'),_0x395b('0x10'),_0x395b('0x11'),'unknown'];var OUTBOUND_VOICE_QUEUE_ATTRIBUTES=[_0x395b('0x12'),_0x395b('0x13'),_0x395b('0x14'),_0x395b('0x15'),_0x395b('0x16'),_0x395b('0x17'),_0x395b('0x18'),_0x395b('0x19'),'erlangCalls','erlangCallToSecond',_0x395b('0x1a'),_0x395b('0x1b'),_0x395b('0x1c'),_0x395b('0x1d'),'dialPredictiveIntervalMinThreshold',_0x395b('0x1e'),_0x395b('0x1f'),_0x395b('0x20'),_0x395b('0x21'),'predictiveIntervalDroppedCallsCallersExit',_0x395b('0x22'),_0x395b('0x23')];function getRealtimeQueues(_0x222f17,_0x53959b){var _0x41ad6e=_0x53959b==='voice'?amiClient:routingClient;return _0x41ad6e['request'](_[_0x395b('0x24')](_0x53959b)+_0x395b('0x25'),_0x222f17)[_0x395b('0x26')](function(_0xe23d9){if(_0xe23d9[_0x395b('0x27')])throw new Error(util['format'](_0x395b('0x28'),_0x53959b));return _0xe23d9[_0x395b('0x29')];})['catch'](function(_0x4b335e){throw _0x4b335e;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x40bae1,_0x553f44,_0x65ff14,_0x1bf4e9){var _0x29c564=QUEUE_DEFAULT_ATTRIBUTES;if(_0x65ff14==='voice'){if(_0x1bf4e9===_0x395b('0x2a')){_0x29c564=_0x29c564['concat'](OUTBOUND_VOICE_QUEUE_ATTRIBUTES);}else{_0x29c564=_0x29c564[_0x395b('0x2b')](INBOUND_VOICE_QUEUE_ATTRIBUTES);}}return _0x40bae1[_0x395b('0x2c')](function(_0x37bcbd){var _0x2dfa72=_0x37bcbd[_0x395b('0x2d')]({'plain':!![]});_0x2dfa72[_0x395b('0x6')]=0x0;_0x2dfa72['loggedInDb']=0x0;_0x2dfa72['loggedIn']=0x0;_0x2dfa72[_0x395b('0x5')]=0x0;_0x2dfa72['waiting']=0x0;if(_0x65ff14===_0x395b('0x2e')){_0x2dfa72[_0x395b('0x10')]=0x0;_0x2dfa72[_0x395b('0x8')]=0x0;if(_0x1bf4e9===_0x395b('0x2a')){_0x2dfa72[_0x395b('0x12')]=0x0;_0x2dfa72[_0x395b('0x13')]=0x0;}}var _0x34a838=_[_0x395b('0x2f')](_0x553f44,['id',_0x2dfa72['id']]);if(_0x34a838){_['merge'](_0x2dfa72,_['pick'](_0x34a838,_0x29c564));}return _0x2dfa72;});}exports[_0x395b('0x30')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 2b8a173..9dadcc8 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x839ecb,_0x1044d2){var _0x3d7e87=function(_0x28e00a){while(--_0x28e00a){_0x839ecb['push'](_0x839ecb['shift']());}};_0x3d7e87(++_0x1044d2);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x4c8232,_0x4e0dea){var _0x3cc8e5=function(_0x248561){while(--_0x248561){_0x4c8232['push'](_0x4c8232['shift']());}};_0x3cc8e5(++_0x4e0dea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 87cba43..dd23bec 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 _0x4c6e=['update','digest','hex','getUuid','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','substring','lodash','bimedia-machine-uuid','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','createHash','md5'];(function(_0x367972,_0x4840b9){var _0x19bef9=function(_0x1a0b79){while(--_0x1a0b79){_0x367972['push'](_0x367972['shift']());}};_0x19bef9(++_0x4840b9);}(_0x4c6e,0xcb));var _0xe4c6=function(_0x3709c9,_0x2e8405){_0x3709c9=_0x3709c9-0x0;var _0x5c2862=_0x4c6e[_0x3709c9];return _0x5c2862;};'use strict';var _=require(_0xe4c6('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0xe4c6('0x1'));var exec=require('child_process')['execSync'];var config=require(_0xe4c6('0x2'));function getInterfaces(){var _0x24ff4b=[];var _0x3cc81f=os[_0xe4c6('0x3')]();var _0x1f885b=_[_0xe4c6('0x4')](_[_0xe4c6('0x5')](_0x3cc81f));for(var _0x227a51=0x0;_0x227a51<_0x1f885b[_0xe4c6('0x6')];_0x227a51++){var _0x5a14a7=_0x3cc81f[_0x1f885b[_0x227a51]][_0xe4c6('0x7')](function(_0x1b9bd5){return _0x1b9bd5[_0xe4c6('0x8')]===_0xe4c6('0x9')&&_0x1b9bd5[_0xe4c6('0xa')]===![];});_0x24ff4b=_0x24ff4b['concat'](_0x5a14a7);}return _0x24ff4b;}function getFirstInterface(){var _0x516e9c=_[_0xe4c6('0xb')](getInterfaces());return{'macAddress':_0x516e9c&&_0x516e9c[_0xe4c6('0xc')]?_0x516e9c[_0xe4c6('0xc')]:_0xe4c6('0xd'),'ipAddress':_0x516e9c&&_0x516e9c['address']?_0x516e9c[_0xe4c6('0xe')]:_0xe4c6('0xf')};}exports[_0xe4c6('0x10')]=getFirstInterface;function getCPUhash(){var _0x4bf1be=_[_0xe4c6('0x4')](os[_0xe4c6('0x11')]()[_0xe4c6('0x12')](function(_0x263dba){return _0x263dba['model'];}))['join'](':');return crypto[_0xe4c6('0x13')](_0xe4c6('0x14'))[_0xe4c6('0x15')](_0x4bf1be)[_0xe4c6('0x16')](_0xe4c6('0x17'));}exports[_0xe4c6('0x18')]=function(){var _0x3a54b4=os['platform']();var _0x5e6ed9=/[0-9a-f-]{36}/;if(config[_0xe4c6('0x19')]&&_0x5e6ed9[_0xe4c6('0x1a')](config[_0xe4c6('0x19')])){return config['licenseToken'];}else if(_0x3a54b4==='win32'){return exec(_0xe4c6('0x1b'),{'encoding':_0xe4c6('0x1c')})[_0xe4c6('0x1d')]('\x0d\x0a','');}else{var _0x20cd88=getFirstInterface();var _0xec85fb=getCPUhash();var _0x3910f8=_0xec85fb+'|'+os['hostname']()+'|'+_0x20cd88[_0xe4c6('0x1e')]+'|'+_0x20cd88['ipAddress'];var _0x55ef81=crypto[_0xe4c6('0x13')](_0xe4c6('0x14'))[_0xe4c6('0x15')](_0x3910f8)[_0xe4c6('0x16')]('hex');return _0x55ef81[_0xe4c6('0x1f')](0x0,0x8)+'-'+_0x55ef81[_0xe4c6('0x1f')](0x8,0xc)+'-'+_0x55ef81[_0xe4c6('0x1f')](0xc,0x10)+'-'+_0x55ef81[_0xe4c6('0x1f')](0x10,0x14)+'-'+_0x55ef81[_0xe4c6('0x1f')](0x14);}}; \ No newline at end of file +var _0x9b3a=['bimedia-machine-uuid','child_process','../environment','networkInterfaces','keys','length','filter','family','IPv4','internal','concat','head','mac','address','127.0.0.1','orderBy','cpus','model','join','createHash','md5','update','hex','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','digest','substring','lodash','crypto'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x9b3a,0x1a2));var _0xa9b3=function(_0x5eeddc,_0x45bb73){_0x5eeddc=_0x5eeddc-0x0;var _0x1ce98b=_0x9b3a[_0x5eeddc];return _0x1ce98b;};'use strict';var _=require(_0xa9b3('0x0'));var os=require('os');var crypto=require(_0xa9b3('0x1'));var machine=require(_0xa9b3('0x2'));var exec=require(_0xa9b3('0x3'))['execSync'];var config=require(_0xa9b3('0x4'));function getInterfaces(){var _0x38d5b3=[];var _0xb77a90=os[_0xa9b3('0x5')]();var _0x4b8e1a=_['orderBy'](_[_0xa9b3('0x6')](_0xb77a90));for(var _0x36cb0c=0x0;_0x36cb0c<_0x4b8e1a[_0xa9b3('0x7')];_0x36cb0c++){var _0x18e88d=_0xb77a90[_0x4b8e1a[_0x36cb0c]][_0xa9b3('0x8')](function(_0x513711){return _0x513711[_0xa9b3('0x9')]===_0xa9b3('0xa')&&_0x513711[_0xa9b3('0xb')]===![];});_0x38d5b3=_0x38d5b3[_0xa9b3('0xc')](_0x18e88d);}return _0x38d5b3;}function getFirstInterface(){var _0x111ee5=_[_0xa9b3('0xd')](getInterfaces());return{'macAddress':_0x111ee5&&_0x111ee5[_0xa9b3('0xe')]?_0x111ee5['mac']:'00:00:00:00:00:00','ipAddress':_0x111ee5&&_0x111ee5[_0xa9b3('0xf')]?_0x111ee5[_0xa9b3('0xf')]:_0xa9b3('0x10')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x2b672d=_[_0xa9b3('0x11')](os[_0xa9b3('0x12')]()['map'](function(_0x34c8ee){return _0x34c8ee[_0xa9b3('0x13')];}))[_0xa9b3('0x14')](':');return crypto[_0xa9b3('0x15')](_0xa9b3('0x16'))[_0xa9b3('0x17')](_0x2b672d)['digest'](_0xa9b3('0x18'));}exports['getUuid']=function(){var _0x2a031e=os['platform']();var _0x29b0f8=/[0-9a-f-]{36}/;if(config[_0xa9b3('0x19')]&&_0x29b0f8[_0xa9b3('0x1a')](config[_0xa9b3('0x19')])){return config[_0xa9b3('0x19')];}else if(_0x2a031e===_0xa9b3('0x1b')){return exec(_0xa9b3('0x1c'),{'encoding':_0xa9b3('0x1d')})[_0xa9b3('0x1e')]('\x0d\x0a','');}else{var _0x491f07=getFirstInterface();var _0x338d75=getCPUhash();var _0x2a1cb3=_0x338d75+'|'+os[_0xa9b3('0x1f')]()+'|'+_0x491f07[_0xa9b3('0x20')]+'|'+_0x491f07['ipAddress'];var _0x594153=crypto[_0xa9b3('0x15')]('md5')[_0xa9b3('0x17')](_0x2a1cb3)[_0xa9b3('0x21')](_0xa9b3('0x18'));return _0x594153[_0xa9b3('0x22')](0x0,0x8)+'-'+_0x594153[_0xa9b3('0x22')](0x8,0xc)+'-'+_0x594153['substring'](0xc,0x10)+'-'+_0x594153['substring'](0x10,0x14)+'-'+_0x594153[_0xa9b3('0x22')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index ca3d763..0a79aab 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 _0x7732=['../logger','license','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','message','default','util','request-promise','version','../../mysqldb','../../components/encryptor','./hardware'];(function(_0x22f007,_0x6b1489){var _0x304409=function(_0x2c945a){while(--_0x2c945a){_0x22f007['push'](_0x22f007['shift']());}};_0x304409(++_0x6b1489);}(_0x7732,0x162));var _0x2773=function(_0x1857d0,_0x6eade0){_0x1857d0=_0x1857d0-0x0;var _0x3e3c46=_0x7732[_0x1857d0];return _0x3e3c46;};'use strict';var util=require(_0x2773('0x0'));var moment=require('moment');var rp=require(_0x2773('0x1'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0x2773('0x2'));var db=require(_0x2773('0x3'))['db'];var encryptor=require(_0x2773('0x4'));var hardware=require(_0x2773('0x5'));var logger=require(_0x2773('0x6'))(_0x2773('0x7'));var HOST=_0x2773('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xaca8b0){return new BPromise(function(_0x195249,_0x37a9cc){var _0x40aaf6=util[_0x2773('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0xaca8b0,module[_0x2773('0xa')][_0x2773('0x2')]);if(oldToken){_0x40aaf6=util[_0x2773('0x9')](_0x2773('0xb'),HOST,_0xaca8b0,module[_0x2773('0xa')][_0x2773('0x2')],oldToken);}var _0x1006b4={'uri':_0x40aaf6,'method':_0x2773('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x1006b4)[_0x2773('0xd')](function(_0x390abe){_0x195249(_0x390abe);})[_0x2773('0xe')](function(_0x3be90a){_0x37a9cc(_0x3be90a);});});}function manageLicense(_0x5105a2,_0xcbcda3){var _0x908eca=_0xcbcda3['get']({'plain':!![]});if(!isOldTokenSent&&_0x908eca[_0x2773('0xf')]!==_0x5105a2&&!_0x908eca[_0x2773('0x10')]){oldToken=_0x908eca['data1'];}httpRequest(_0x5105a2)['then'](function(_0x6f790b){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x6f790b[_0x2773('0x11')]){isOldTokenSent=![];if(!_0x908eca[_0x2773('0x7')]&&_0x908eca[_0x2773('0x7')]!=_0x6f790b[_0x2773('0x7')]||_0x908eca[_0x2773('0x7')]&&_0x908eca['data2']){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x908eca[_0x2773('0x7')]&&!_0x908eca[_0x2773('0x10')]&&_0x908eca[_0x2773('0x7')]!=_0x6f790b['license']){logger[_0x2773('0x12')](_0x2773('0x13'));}if(_0x908eca['license']&&!_0x908eca[_0x2773('0x10')]&&_0x908eca[_0x2773('0x7')]==_0x6f790b[_0x2773('0x7')]){return _0xcbcda3;}return _0xcbcda3[_0x2773('0x14')]({'data1':_0x5105a2,'data2':null,'license':_0x6f790b['license']});}else{if(_0x6f790b['license']||_0x908eca['license']){if(!_0x908eca[_0x2773('0x10')]){if(_0x908eca['data1']==_0x5105a2){GRAY_PERIOD_REASON=_0x2773('0x15');logger[_0x2773('0x12')](_0x2773('0x16'));}else{GRAY_PERIOD_REASON=_0x2773('0x17');logger[_0x2773('0x12')](_0x2773('0x18'),_0x908eca[_0x2773('0xf')],_0x5105a2);}logger['info'](_0x2773('0x19'),GRAY_PERIOD_REASON[_0x2773('0x1a')](),moment()['format'](_0x2773('0x1b')));return _0xcbcda3[_0x2773('0x14')]({'data2':encryptor[_0x2773('0x1c')](moment()[_0x2773('0x9')](_0x2773('0x1b')))});}else{if(moment()[_0x2773('0x1d')](encryptor[_0x2773('0x1e')](_0x908eca['data2']),'days')>DAYS){logger[_0x2773('0x12')](_0x2773('0x1f'),moment()[_0x2773('0x9')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0xcbcda3[_0x2773('0x14')]({'data1':_0x5105a2,'data2':null,'license':null});}}}else{if(_0x908eca[_0x2773('0xf')]!=_0x5105a2){logger[_0x2773('0x12')](_0x2773('0x18'),_0x908eca[_0x2773('0xf')],_0x5105a2);return _0xcbcda3[_0x2773('0x14')]({'data1':_0x5105a2,'data2':null,'license':null});}}}return _0xcbcda3;})[_0x2773('0xd')](function(_0x24de77){_0xcbcda3=_0x24de77;})[_0x2773('0xe')](function(_0x54de30){logger['error'](_0x54de30['message']);})[_0x2773('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0x2773('0x21')](),_0xcbcda3);},TIME);});}function defaultLicense(){var _0x2445c6=hardware[_0x2773('0x21')]();if(_0x2445c6){return db['License'][_0x2773('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x2445c6}})[_0x2773('0x23')](function(_0x30465c,_0xa128cc){logger[_0x2773('0x12')](_0x2773('0x24'),_0x2445c6);manageLicense(_0x2445c6,_0x30465c);})[_0x2773('0xe')](function(_0x314018){logger[_0x2773('0x25')](_0x314018[_0x2773('0x26')]);});}}exports[_0x2773('0x27')]=defaultLicense; \ No newline at end of file +var _0x0350=['%s/api/servers/%s/check?version=%s','exports','version','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','get','data2','data1','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','days','error','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','moment','request-promise','pkginfo','./hardware','../logger','license','https://www.xcallymotion.com'];(function(_0x435348,_0x617493){var _0x35d479=function(_0x17b1af){while(--_0x17b1af){_0x435348['push'](_0x435348['shift']());}};_0x35d479(++_0x617493);}(_0x0350,0x1d9));var _0x0035=function(_0x95196,_0x80c338){_0x95196=_0x95196-0x0;var _0x44d1e6=_0x0350[_0x95196];return _0x44d1e6;};'use strict';var util=require('util');var moment=require(_0x0035('0x0'));var rp=require(_0x0035('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0x0035('0x2'))(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x0035('0x3'));var logger=require(_0x0035('0x4'))(_0x0035('0x5'));var HOST=_0x0035('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x38d56a){return new BPromise(function(_0x5d6467,_0x1a3076){var _0x10a7c1=util['format'](_0x0035('0x7'),HOST,_0x38d56a,module[_0x0035('0x8')][_0x0035('0x9')]);if(oldToken){_0x10a7c1=util[_0x0035('0xa')](_0x0035('0xb'),HOST,_0x38d56a,module[_0x0035('0x8')][_0x0035('0x9')],oldToken);}var _0x3c1f8d={'uri':_0x10a7c1,'method':_0x0035('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x3c1f8d)['then'](function(_0x3e298b){_0x5d6467(_0x3e298b);})[_0x0035('0xd')](function(_0x1dbf3b){_0x1a3076(_0x1dbf3b);});});}function manageLicense(_0x2bde36,_0x531e0a){var _0x3ef328=_0x531e0a[_0x0035('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x3ef328['data1']!==_0x2bde36&&!_0x3ef328[_0x0035('0xf')]){oldToken=_0x3ef328[_0x0035('0x10')];}httpRequest(_0x2bde36)[_0x0035('0x11')](function(_0x39766c){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x39766c[_0x0035('0x12')]){isOldTokenSent=![];if(!_0x3ef328[_0x0035('0x5')]&&_0x3ef328[_0x0035('0x5')]!=_0x39766c['license']||_0x3ef328['license']&&_0x3ef328[_0x0035('0xf')]){logger[_0x0035('0x13')](_0x0035('0x14'));}if(_0x3ef328['license']&&!_0x3ef328[_0x0035('0xf')]&&_0x3ef328[_0x0035('0x5')]!=_0x39766c['license']){logger[_0x0035('0x13')](_0x0035('0x15'));}if(_0x3ef328['license']&&!_0x3ef328[_0x0035('0xf')]&&_0x3ef328['license']==_0x39766c[_0x0035('0x5')]){return _0x531e0a;}return _0x531e0a[_0x0035('0x16')]({'data1':_0x2bde36,'data2':null,'license':_0x39766c['license']});}else{if(_0x39766c[_0x0035('0x5')]||_0x3ef328['license']){if(!_0x3ef328['data2']){if(_0x3ef328[_0x0035('0x10')]==_0x2bde36){GRAY_PERIOD_REASON=_0x0035('0x17');logger[_0x0035('0x13')](_0x0035('0x18'));}else{GRAY_PERIOD_REASON=_0x0035('0x19');logger[_0x0035('0x13')](_0x0035('0x1a'),_0x3ef328['data1'],_0x2bde36);}logger[_0x0035('0x13')](_0x0035('0x1b'),GRAY_PERIOD_REASON[_0x0035('0x1c')](),moment()[_0x0035('0xa')](_0x0035('0x1d')));return _0x531e0a[_0x0035('0x16')]({'data2':encryptor[_0x0035('0x1e')](moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor['decryptString'](_0x3ef328[_0x0035('0xf')]),_0x0035('0x1f'))>DAYS){logger[_0x0035('0x13')]('DEMO\x20START\x20AT\x20%s',moment()['format'](_0x0035('0x1d')));isOldTokenSent=![];return _0x531e0a[_0x0035('0x16')]({'data1':_0x2bde36,'data2':null,'license':null});}}}else{if(_0x3ef328[_0x0035('0x10')]!=_0x2bde36){logger['info'](_0x0035('0x1a'),_0x3ef328['data1'],_0x2bde36);return _0x531e0a['update']({'data1':_0x2bde36,'data2':null,'license':null});}}}return _0x531e0a;})[_0x0035('0x11')](function(_0x5a5491){_0x531e0a=_0x5a5491;})[_0x0035('0xd')](function(_0xfb102d){logger[_0x0035('0x20')](_0xfb102d['message']);})[_0x0035('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0x0035('0x22')](),_0x531e0a);},TIME);});}function defaultLicense(){var _0x2b4ee6=hardware[_0x0035('0x22')]();if(_0x2b4ee6){return db[_0x0035('0x23')][_0x0035('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x2b4ee6}})[_0x0035('0x25')](function(_0x93af5,_0x2b81bd){logger['info'](_0x0035('0x26'),_0x2b4ee6);manageLicense(_0x2b4ee6,_0x93af5);})[_0x0035('0xd')](function(_0x5ea1f1){logger[_0x0035('0x20')](_0x5ea1f1[_0x0035('0x27')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 9cde662..4e9f6e9 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 _0xfbd6=['../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','defaults','catch','uuid','license','License\x20key\x20value\x20not\x20found','data1','data2','split','%s:%s:%s','parse','demo','machineUuid','decryptString','gray','deadline','add','format','changed','disabled','message','then','User','role','COUNT','col','count','telephone','users','telephones','forEach','user','pick','countBy','admin','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor'];(function(_0x4dd7cf,_0x21c6bb){var _0xa4181f=function(_0xd831ed){while(--_0xd831ed){_0x4dd7cf['push'](_0x4dd7cf['shift']());}};_0xa4181f(++_0x21c6bb);}(_0xfbd6,0x14a));var _0x6fbd=function(_0x146830,_0x5b23fc){_0x146830=_0x146830-0x0;var _0x53e9f4=_0xfbd6[_0x146830];return _0x53e9f4;};'use strict';var util=require(_0x6fbd('0x0'));var _=require(_0x6fbd('0x1'));var moment=require(_0x6fbd('0x2'));var BPromise=require(_0x6fbd('0x3'));var hardware=require(_0x6fbd('0x4'));var encryptor=require(_0x6fbd('0x5'));var db=require(_0x6fbd('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6fbd('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x6fbd('0x8'),'machineUuid':hardware[_0x6fbd('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6fbd('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x6fbd('0xa'),'machineUuid':hardware[_0x6fbd('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2a8860){return new BPromise(function(_0xc80699,_0x499420){return db[_0x6fbd('0xb')]['find'](_[_0x6fbd('0xc')](_0x2a8860,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x34097c){return checkLicense(_0x34097c,null);})['then'](function(_0x1e3928){_0xc80699(_0x1e3928);return;})[_0x6fbd('0xd')](function(_0x173aa8){_0x499420(_0x173aa8);});});}function checkLicense(_0x36b247,_0xbbead4){if(!_0x36b247){demoLicense[_0x6fbd('0xe')]=_0x36b247['data1'];return demoLicense;}try{var _0x45a15a=_0xbbead4||_0x36b247[_0x6fbd('0xf')];if(_['isEmpty'](_0x45a15a)){throw new Error(_0x6fbd('0x10'));}var _0x5f3c68=_0x36b247[_0x6fbd('0x11')];var _0x2f78b5=_0x36b247[_0x6fbd('0x12')];var _0x2eb19c=_0x5f3c68[_0x6fbd('0x13')]('-')[0x4];var _0x5e39e1=_0x5f3c68[_0x6fbd('0x13')]('-')[0x0];var _0x477327=encryptor['decryptString'](_0x45a15a,util['format'](_0x6fbd('0x14'),_0x2eb19c,_0x5f3c68,_0x5e39e1));var _0x2c0872=JSON[_0x6fbd('0x15')](_0x477327);_0x2c0872[_0x6fbd('0x16')]=![];_0x2c0872['uuid']=_0x5f3c68;_0x2c0872[_0x6fbd('0x17')]=hardware['getUuid']();if(_0x2f78b5){var _0x4a03b3=encryptor[_0x6fbd('0x18')](_0x2f78b5);_0x2c0872[_0x6fbd('0x19')]=_0x4a03b3;_0x2c0872[_0x6fbd('0x1a')]=moment(_0x4a03b3)[_0x6fbd('0x1b')](0x7,'days')[_0x6fbd('0x1c')]();_0x2c0872['grayReason']=_0x2c0872[_0x6fbd('0xe')]!=_0x2c0872['machineUuid']?_0x6fbd('0x1d'):_0x6fbd('0x1e');}return _0x2c0872;}catch(_0x4acdfb){breakingLicense[_0x6fbd('0xe')]=_0x36b247[_0x6fbd('0x11')];breakingLicense[_0x6fbd('0x1f')]=_0x4acdfb['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xe02403,_0x3a17b6){getLicense()[_0x6fbd('0x20')](function(_0x31688f){return db[_0x6fbd('0x21')]['findAll']({'attributes':[_0x6fbd('0x22'),[db['sequelize']['fn'](_0x6fbd('0x23'),db['sequelize'][_0x6fbd('0x24')](_0x6fbd('0x22'))),_0x6fbd('0x25')]],'group':_0x6fbd('0x22'),'where':{'role':{'$or':['admin','user',_0x6fbd('0x26')]}},'raw':!![]})['then'](function(_0x1bf91a){var _0x34b670={'user':_0x31688f[_0x6fbd('0x27')]||0x0,'telephone':_0x31688f[_0x6fbd('0x28')]||0x0};_0x1bf91a[_0x6fbd('0x29')](function(_0x104000){var _0x299a7b=_0x104000[_0x6fbd('0x22')]==='admin'?_0x6fbd('0x2a'):_0x104000['role'];_0x34b670[_0x299a7b]-=_0x104000['count'];if(_0x34b670[_0x299a7b]<0x0)_0x34b670[_0x299a7b]=0x0;});_0xe02403(_0x34b670);return;});})['catch'](function(_0x5b4603){_0x3a17b6(_0x5b4603);});});}function checkUserLimits(_0x123a9e){return new BPromise(function(_0x36321b,_0x545023){getLimits()[_0x6fbd('0x20')](function(_0x5384d3){var _0x3ecb6e=_[_0x6fbd('0x2b')](_[_0x6fbd('0x2c')](_0x123a9e,_0x6fbd('0x22')),[_0x6fbd('0x2d'),_0x6fbd('0x2a'),_0x6fbd('0x26')]);var _0x2dcce1=(_0x3ecb6e[_0x6fbd('0x2d')]||0x0)+(_0x3ecb6e[_0x6fbd('0x2a')]||0x0);var _0x56f64a=_0x3ecb6e['telephone']||0x0;if(_0x2dcce1>_0x5384d3[_0x6fbd('0x2a')])return _0x545023(_0x6fbd('0x2e'));if(_0x56f64a>_0x5384d3['telephone'])return _0x545023('License\x20limit\x20reached\x20for\x20telephones');return _0x36321b();})[_0x6fbd('0xd')](function(_0xfb1656){_0x545023(_0xfb1656);});});}module[_0x6fbd('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x3947=['message','User','findAll','role','COUNT','sequelize','col','count','admin','user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','gray','deadline','add','days','machineUuid'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x3947,0x71));var _0x7394=function(_0x223a81,_0x4e8c2a){_0x223a81=_0x223a81-0x0;var _0x2e9cbb=_0x3947[_0x223a81];return _0x2e9cbb;};'use strict';var util=require(_0x7394('0x0'));var _=require(_0x7394('0x1'));var moment=require(_0x7394('0x2'));var BPromise=require(_0x7394('0x3'));var hardware=require(_0x7394('0x4'));var encryptor=require(_0x7394('0x5'));var db=require(_0x7394('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7394('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x7394('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7394('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x7394('0x9'),'machineUuid':hardware[_0x7394('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0xf2f773){return new BPromise(function(_0x571513,_0x59e1d9){return db[_0x7394('0xa')][_0x7394('0xb')](_[_0x7394('0xc')](_0xf2f773,{'raw':!![],'where':{'id':0x1}}))[_0x7394('0xd')](function(_0xec8dee){return checkLicense(_0xec8dee,null);})[_0x7394('0xd')](function(_0x33157b){_0x571513(_0x33157b);return;})[_0x7394('0xe')](function(_0x39be78){_0x59e1d9(_0x39be78);});});}function checkLicense(_0x16e0c6,_0x5c1680){if(!_0x16e0c6){demoLicense[_0x7394('0xf')]=_0x16e0c6[_0x7394('0x10')];return demoLicense;}try{var _0x3645a9=_0x5c1680||_0x16e0c6['license'];if(_[_0x7394('0x11')](_0x3645a9)){throw new Error(_0x7394('0x12'));}var _0x57b2db=_0x16e0c6[_0x7394('0x10')];var _0x158e49=_0x16e0c6[_0x7394('0x13')];var _0x4bf970=_0x57b2db[_0x7394('0x14')]('-')[0x4];var _0x4d3ca7=_0x57b2db[_0x7394('0x14')]('-')[0x0];var _0x3e03ac=encryptor[_0x7394('0x15')](_0x3645a9,util[_0x7394('0x16')](_0x7394('0x17'),_0x4bf970,_0x57b2db,_0x4d3ca7));var _0x114ea9=JSON[_0x7394('0x18')](_0x3e03ac);_0x114ea9[_0x7394('0x19')]=![];_0x114ea9[_0x7394('0xf')]=_0x57b2db;_0x114ea9['machineUuid']=hardware[_0x7394('0x8')]();if(_0x158e49){var _0x43c12e=encryptor[_0x7394('0x15')](_0x158e49);_0x114ea9[_0x7394('0x1a')]=_0x43c12e;_0x114ea9[_0x7394('0x1b')]=moment(_0x43c12e)[_0x7394('0x1c')](0x7,_0x7394('0x1d'))['format']();_0x114ea9['grayReason']=_0x114ea9[_0x7394('0xf')]!=_0x114ea9[_0x7394('0x1e')]?'changed':'disabled';}return _0x114ea9;}catch(_0x4a1bcc){breakingLicense[_0x7394('0xf')]=_0x16e0c6[_0x7394('0x10')];breakingLicense['message']=_0x4a1bcc[_0x7394('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x25befe,_0x248f25){getLicense()[_0x7394('0xd')](function(_0x3ac0fa){return db[_0x7394('0x20')][_0x7394('0x21')]({'attributes':[_0x7394('0x22'),[db['sequelize']['fn'](_0x7394('0x23'),db[_0x7394('0x24')][_0x7394('0x25')]('role')),_0x7394('0x26')]],'group':'role','where':{'role':{'$or':[_0x7394('0x27'),_0x7394('0x28'),_0x7394('0x29')]}},'raw':!![]})['then'](function(_0x584d0a){var _0x5cb3ee={'user':_0x3ac0fa[_0x7394('0x2a')]||0x0,'telephone':_0x3ac0fa[_0x7394('0x2b')]||0x0};_0x584d0a[_0x7394('0x2c')](function(_0x173ad8){var _0xcf74f6=_0x173ad8['role']===_0x7394('0x27')?'user':_0x173ad8[_0x7394('0x22')];_0x5cb3ee[_0xcf74f6]-=_0x173ad8[_0x7394('0x26')];if(_0x5cb3ee[_0xcf74f6]<0x0)_0x5cb3ee[_0xcf74f6]=0x0;});_0x25befe(_0x5cb3ee);return;});})[_0x7394('0xe')](function(_0x3455f7){_0x248f25(_0x3455f7);});});}function checkUserLimits(_0x342ffc){return new BPromise(function(_0xe05d7f,_0x19d29d){getLimits()[_0x7394('0xd')](function(_0x2c5183){var _0x9f3305=_[_0x7394('0x2d')](_[_0x7394('0x2e')](_0x342ffc,_0x7394('0x22')),[_0x7394('0x27'),'user',_0x7394('0x29')]);var _0x557e0f=(_0x9f3305[_0x7394('0x27')]||0x0)+(_0x9f3305['user']||0x0);var _0x59905f=_0x9f3305['telephone']||0x0;if(_0x557e0f>_0x2c5183[_0x7394('0x28')])return _0x19d29d('License\x20limit\x20reached\x20for\x20users');if(_0x59905f>_0x2c5183[_0x7394('0x29')])return _0x19d29d(_0x7394('0x2f'));return _0xe05d7f();})[_0x7394('0xe')](function(_0x33f718){_0x19d29d(_0x33f718);});});}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 7a75fb5..dc9ee9a 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 _0x47c5=['app-id','secret','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x1e4d51,_0xccefa7){var _0xdf8a2=function(_0x1690cf){while(--_0x1690cf){_0x1e4d51['push'](_0x1e4d51['shift']());}};_0xdf8a2(++_0xccefa7);}(_0x47c5,0x165));var _0x547c=function(_0x28fe94,_0x120b9b){_0x28fe94=_0x28fe94-0x0;var _0x3560da=_0x47c5[_0x28fe94];return _0x3560da;};'use strict';module[_0x547c('0x0')]={'DOMAIN':_0x547c('0x1'),'SESSION_SECRET':_0x547c('0x2'),'GOOGLE_ID':_0x547c('0x3'),'GOOGLE_SECRET':_0x547c('0x4'),'DEBUG':''}; \ No newline at end of file +var _0xb9be=['app-id','secret','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x3144f6,_0x359806){var _0x5d41d0=function(_0x511f18){while(--_0x511f18){_0x3144f6['push'](_0x3144f6['shift']());}};_0x5d41d0(++_0x359806);}(_0xb9be,0xc5));var _0xeb9b=function(_0x35485a,_0x91cdd4){_0x35485a=_0x35485a-0x0;var _0x5148e6=_0xb9be[_0x35485a];return _0x5148e6;};'use strict';module[_0xeb9b('0x0')]={'DOMAIN':_0xeb9b('0x1'),'SESSION_SECRET':_0xeb9b('0x2'),'GOOGLE_ID':_0xeb9b('0x3'),'GOOGLE_SECRET':_0xeb9b('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 45b4e4b..5c0d734 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf8f=['fileLogger','../utils/loggers'];(function(_0x382f3d,_0x16200f){var _0x4b174a=function(_0x3f0390){while(--_0x3f0390){_0x382f3d['push'](_0x382f3d['shift']());}};_0x4b174a(++_0x16200f);}(_0xcf8f,0xeb));var _0xfcf8=function(_0x1c1259,_0x2db8ee){_0x1c1259=_0x1c1259-0x0;var _0x1dab5c=_0xcf8f[_0x1c1259];return _0x1dab5c;};'use strict';var fileLogger=require(_0xfcf8('0x0'))[_0xfcf8('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0xd419=['fileLogger','exports','../utils/loggers'];(function(_0x28225e,_0x2ffd43){var _0xef9f90=function(_0x864af7){while(--_0x864af7){_0x28225e['push'](_0x28225e['shift']());}};_0xef9f90(++_0x2ffd43);}(_0xd419,0x10d));var _0x9d41=function(_0x526880,_0x14b692){_0x526880=_0x526880-0x0;var _0x3c78e7=_0xd419[_0x526880];return _0x3c78e7;};'use strict';var fileLogger=require(_0x9d41('0x0'))[_0x9d41('0x1')];module[_0x9d41('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 5bfaf80..5b45592 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 _0xfcdf=['../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/ami/index.js','agi'];(function(_0x2ff238,_0x1811d2){var _0x204a56=function(_0x5bf2e1){while(--_0x5bf2e1){_0x2ff238['push'](_0x2ff238['shift']());}};_0x204a56(++_0x1811d2);}(_0xfcdf,0x97));var _0xffcd=function(_0x35e84e,_0x2a41ad){_0x35e84e=_0x35e84e-0x0;var _0x18ca94=_0xfcdf[_0x35e84e];return _0x18ca94;};'use strict';var path=require(_0xffcd('0x0'));var os=require('os');var config={'apps':[{'name':_0xffcd('0x1'),'script':path['join'](__dirname,'../../services/express/index.js')},{'name':'ami','script':path[_0xffcd('0x2')](__dirname,_0xffcd('0x3'))},{'name':_0xffcd('0x4'),'script':path['join'](__dirname,_0xffcd('0x5'))},{'name':'email','script':path[_0xffcd('0x2')](__dirname,_0xffcd('0x6'))},{'name':_0xffcd('0x7'),'script':path[_0xffcd('0x2')](__dirname,_0xffcd('0x8'))},{'name':_0xffcd('0x9'),'script':path['join'](__dirname,_0xffcd('0xa'))}]};module[_0xffcd('0xb')]=config; \ No newline at end of file +var _0x5077=['agi','../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','ami','../../services/ami/index.js'];(function(_0x12324d,_0x15dd3c){var _0x2cc2c9=function(_0xa5a8f6){while(--_0xa5a8f6){_0x12324d['push'](_0x12324d['shift']());}};_0x2cc2c9(++_0x15dd3c);}(_0x5077,0xa4));var _0x7507=function(_0x450758,_0x1d1d59){_0x450758=_0x450758-0x0;var _0x37eb86=_0x5077[_0x450758];return _0x37eb86;};'use strict';var path=require(_0x7507('0x0'));var os=require('os');var config={'apps':[{'name':_0x7507('0x1'),'script':path[_0x7507('0x2')](__dirname,'../../services/express/index.js')},{'name':_0x7507('0x3'),'script':path[_0x7507('0x2')](__dirname,_0x7507('0x4'))},{'name':_0x7507('0x5'),'script':path[_0x7507('0x2')](__dirname,_0x7507('0x6'))},{'name':_0x7507('0x7'),'script':path[_0x7507('0x2')](__dirname,_0x7507('0x8'))},{'name':'routing','script':path[_0x7507('0x2')](__dirname,_0x7507('0x9'))},{'name':_0x7507('0xa'),'script':path[_0x7507('0x2')](__dirname,_0x7507('0xb'))}]};module[_0x7507('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 0893846..cff7d29 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 _0xaf3b=['then','disconnect','restart','list','describe','delete','dump','pm2','bluebird','connect','start'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf3b,0x13b));var _0xbaf3=function(_0x12ea94,_0x5e65a9){_0x12ea94=_0x12ea94-0x0;var _0x311947=_0xaf3b[_0x12ea94];return _0x311947;};'use strict';var pm2=require(_0xbaf3('0x0'));var BPromise=require(_0xbaf3('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x4a304a,_0x146d6c){return pm2[_0xbaf3('0x2')](function(_0x472b32){if(_0x472b32){return _0x146d6c(_0x472b32);}return _0x4a304a('connected');});});};exports[_0xbaf3('0x3')]=function(_0x2c9937){return connect()[_0xbaf3('0x4')](function(){return new BPromise(function(_0x58c351,_0x49dae4){return pm2['start'](_0x2c9937,function(_0x23eebb,_0x3a39da){if(_0x23eebb){return _0x49dae4(_0x23eebb);}pm2['disconnect']();return _0x58c351(_0x3a39da);});});});};exports['stop']=function(_0x51c123){return connect()[_0xbaf3('0x4')](function(){return new BPromise(function(_0x2ef2a0,_0x5c43f5){return pm2['stop'](_0x51c123,function(_0x3433df,_0x989752){if(_0x3433df){return _0x5c43f5(_0x3433df);}pm2[_0xbaf3('0x5')]();return _0x2ef2a0(_0x989752);});});});};exports[_0xbaf3('0x6')]=function(_0x202156){return connect()[_0xbaf3('0x4')](function(){return new BPromise(function(_0x17fd96,_0x198769){return pm2['restart'](_0x202156,function(_0x1ffe9f,_0x48575b){if(_0x1ffe9f){return _0x198769(_0x1ffe9f);}pm2[_0xbaf3('0x5')]();return _0x17fd96(_0x48575b);});});});};exports[_0xbaf3('0x7')]=function(){return connect()[_0xbaf3('0x4')](function(){return new BPromise(function(_0x40af6e,_0x3ec5fe){return pm2[_0xbaf3('0x7')](function(_0x3aa514,_0x4a6547){if(_0x3aa514){return _0x3ec5fe(_0x3aa514);}pm2['disconnect']();return _0x40af6e(_0x4a6547);});});});};exports[_0xbaf3('0x8')]=function(_0x1a592b){return connect()[_0xbaf3('0x4')](function(){return new BPromise(function(_0xce76a,_0x5e4608){return pm2[_0xbaf3('0x8')](_0x1a592b,function(_0x4b39b2,_0x5390c8){if(_0x4b39b2){return _0x5e4608(_0x4b39b2);}pm2[_0xbaf3('0x5')]();return _0xce76a(_0x5390c8);});});});};exports[_0xbaf3('0x9')]=function(_0x404807){return connect()[_0xbaf3('0x4')](function(){return new BPromise(function(_0x1d57df,_0x5bda84){return pm2[_0xbaf3('0x9')](_0x404807,function(_0x466701,_0x58cb7e){if(_0x466701){return _0x5bda84(_0x466701);}pm2[_0xbaf3('0x5')]();return _0x1d57df(_0x58cb7e);});});});};exports['dump']=function(){return connect()[_0xbaf3('0x4')](function(){return new BPromise(function(_0x2f21d4,_0x474b0b){return pm2[_0xbaf3('0xa')](function(_0x45cca9){if(_0x45cca9){return _0x474b0b(_0x45cca9);}return _0x2f21d4('saved');});});});}; \ No newline at end of file +var _0x1eec=['pm2','connect','connected','start','then','disconnect','restart','list','delete','dump','saved'];(function(_0x4aed37,_0x4e90b5){var _0x4dae92=function(_0x502e66){while(--_0x502e66){_0x4aed37['push'](_0x4aed37['shift']());}};_0x4dae92(++_0x4e90b5);}(_0x1eec,0x11e));var _0xc1ee=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x1eec[_0x4a9fb1];return _0x348672;};'use strict';var pm2=require(_0xc1ee('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x30cd0e,_0x19de93){return pm2[_0xc1ee('0x1')](function(_0x12ccc1){if(_0x12ccc1){return _0x19de93(_0x12ccc1);}return _0x30cd0e(_0xc1ee('0x2'));});});};exports[_0xc1ee('0x3')]=function(_0x540deb){return connect()[_0xc1ee('0x4')](function(){return new BPromise(function(_0x4c349e,_0x2f2d8f){return pm2[_0xc1ee('0x3')](_0x540deb,function(_0xd7810b,_0x44f3bf){if(_0xd7810b){return _0x2f2d8f(_0xd7810b);}pm2[_0xc1ee('0x5')]();return _0x4c349e(_0x44f3bf);});});});};exports['stop']=function(_0x320da3){return connect()[_0xc1ee('0x4')](function(){return new BPromise(function(_0x16b747,_0x40c8f9){return pm2['stop'](_0x320da3,function(_0x18dd38,_0x40ff3e){if(_0x18dd38){return _0x40c8f9(_0x18dd38);}pm2['disconnect']();return _0x16b747(_0x40ff3e);});});});};exports[_0xc1ee('0x6')]=function(_0x3ff28d){return connect()['then'](function(){return new BPromise(function(_0x3ab04a,_0x126def){return pm2['restart'](_0x3ff28d,function(_0x1911d9,_0x4f4c5e){if(_0x1911d9){return _0x126def(_0x1911d9);}pm2[_0xc1ee('0x5')]();return _0x3ab04a(_0x4f4c5e);});});});};exports[_0xc1ee('0x7')]=function(){return connect()[_0xc1ee('0x4')](function(){return new BPromise(function(_0x56b3e1,_0x3c4749){return pm2[_0xc1ee('0x7')](function(_0x55e3ec,_0x3d2bd5){if(_0x55e3ec){return _0x3c4749(_0x55e3ec);}pm2[_0xc1ee('0x5')]();return _0x56b3e1(_0x3d2bd5);});});});};exports['describe']=function(_0x241bb5){return connect()[_0xc1ee('0x4')](function(){return new BPromise(function(_0x553e2d,_0x235488){return pm2['describe'](_0x241bb5,function(_0x2906d8,_0x2d66aa){if(_0x2906d8){return _0x235488(_0x2906d8);}pm2[_0xc1ee('0x5')]();return _0x553e2d(_0x2d66aa);});});});};exports[_0xc1ee('0x8')]=function(_0x468b36){return connect()[_0xc1ee('0x4')](function(){return new BPromise(function(_0x5f006a,_0x268d42){return pm2[_0xc1ee('0x8')](_0x468b36,function(_0x35a86a,_0x422fe1){if(_0x35a86a){return _0x268d42(_0x35a86a);}pm2[_0xc1ee('0x5')]();return _0x5f006a(_0x422fe1);});});});};exports[_0xc1ee('0x9')]=function(){return connect()[_0xc1ee('0x4')](function(){return new BPromise(function(_0x5994a5,_0x5db20a){return pm2[_0xc1ee('0x9')](function(_0x1c56e3){if(_0x1c56e3){return _0x5db20a(_0x1c56e3);}return _0x5994a5(_0xc1ee('0xa'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index d8581f5..bf2ba97 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 _0xb15f=['defaults','localhost','socket.io-emitter','Setting','find','then','ChatInteraction','findAll','lastMsgAt','subtract','chatTimeout','minutes','length','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','redis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb15f,0xba));var _0xfb15=function(_0xc9bc47,_0x56c2d0){_0xc9bc47=_0xc9bc47-0x0;var _0xcbb401=_0xb15f[_0xc9bc47];return _0xcbb401;};'use strict';var _=require(_0xfb15('0x0'));var moment=require(_0xfb15('0x1'));var Redis=require(_0xfb15('0x2'));var util=require(_0xfb15('0x3'));var config=require(_0xfb15('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../logger')('schedule');config[_0xfb15('0x5')]=_[_0xfb15('0x6')](config['redis'],{'host':_0xfb15('0x7'),'port':0x18eb});var io=require(_0xfb15('0x8'))(new Redis(config[_0xfb15('0x5')]));function closeInteractions(){var _0x220262=0x0;var _0x497cb2=[];return db[_0xfb15('0x9')][_0xfb15('0xa')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xfb15('0xb')](function(_0xa47e87){_0x220262=_0xa47e87['chatTimeout'];if(_0x220262){return db[_0xfb15('0xc')][_0xfb15('0xd')]({'raw':!![],'attributes':['id',_0xfb15('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xfb15('0xf')](_0xa47e87[_0xfb15('0x10')],_0xfb15('0x11'))}}});}else{return[];}})[_0xfb15('0xb')](function(_0x437f3b){if(_0x437f3b&&_0x437f3b[_0xfb15('0x12')]){_0x497cb2=_['map'](_0x437f3b||[],'id');logger[_0xfb15('0x13')]('[CHAT]\x20Interactions\x20to\x20close:',_0x497cb2[_0xfb15('0x14')]());return db[_0xfb15('0xc')][_0xfb15('0x15')]({'closeReason':_0xfb15('0x16'),'disposition':_0xfb15('0x17'),'closed':!![],'closedAt':moment()[_0xfb15('0x18')](_0xfb15('0x19'))},{'where':{'id':_0x497cb2}});}})[_0xfb15('0xb')](function(){if(_0x497cb2&&_0x497cb2['length']){logger['info'](_0xfb15('0x1a'),_0x497cb2[_0xfb15('0x14')]());for(var _0x425abb=0x0;_0x425abb<_0x497cb2[_0xfb15('0x12')];_0x425abb++){io['emit'](_0xfb15('0x1b'),{'id':_0x497cb2[_0x425abb],'closed':!![]});}}})[_0xfb15('0x1c')](function(_0x299a2a){logger[_0xfb15('0x1d')](_0xfb15('0x1e'),_0x299a2a?util[_0xfb15('0x1f')](_0x299a2a,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xd466=['Setting','find','chatTimeout','then','findAll','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','inspect','start','lodash','moment','util','../../config/environment','../logger','redis','defaults','localhost','socket.io-emitter'];(function(_0x5cebcd,_0xd41509){var _0x4a2deb=function(_0x5ad320){while(--_0x5ad320){_0x5cebcd['push'](_0x5cebcd['shift']());}};_0x4a2deb(++_0xd41509);}(_0xd466,0x18a));var _0x6d46=function(_0x13377f,_0x266756){_0x13377f=_0x13377f-0x0;var _0x5805b9=_0xd466[_0x13377f];return _0x5805b9;};'use strict';var _=require(_0x6d46('0x0'));var moment=require(_0x6d46('0x1'));var Redis=require('ioredis');var util=require(_0x6d46('0x2'));var config=require(_0x6d46('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x6d46('0x4'))('schedule');config[_0x6d46('0x5')]=_[_0x6d46('0x6')](config[_0x6d46('0x5')],{'host':_0x6d46('0x7'),'port':0x18eb});var io=require(_0x6d46('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x2c0725=0x0;var _0x432eab=[];return db[_0x6d46('0x9')][_0x6d46('0xa')]({'raw':!![],'attributes':['id',_0x6d46('0xb')],'where':{'id':0x1}})[_0x6d46('0xc')](function(_0x4e80c7){_0x2c0725=_0x4e80c7[_0x6d46('0xb')];if(_0x2c0725){return db['ChatInteraction'][_0x6d46('0xd')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x6d46('0xe')](_0x4e80c7[_0x6d46('0xb')],_0x6d46('0xf'))}}});}else{return[];}})[_0x6d46('0xc')](function(_0x552540){if(_0x552540&&_0x552540[_0x6d46('0x10')]){_0x432eab=_[_0x6d46('0x11')](_0x552540||[],'id');logger[_0x6d46('0x12')](_0x6d46('0x13'),_0x432eab[_0x6d46('0x14')]());return db[_0x6d46('0x15')][_0x6d46('0x16')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x6d46('0x17')](_0x6d46('0x18'))},{'where':{'id':_0x432eab}});}})['then'](function(){if(_0x432eab&&_0x432eab[_0x6d46('0x10')]){logger[_0x6d46('0x12')](_0x6d46('0x19'),_0x432eab[_0x6d46('0x14')]());for(var _0x17a556=0x0;_0x17a556<_0x432eab['length'];_0x17a556++){io[_0x6d46('0x1a')]('chatInteraction:update',{'id':_0x432eab[_0x17a556],'closed':!![]});}}})[_0x6d46('0x1b')](function(_0x286ad4){logger[_0x6d46('0x1c')]('[CHAT]\x20Error\x20closing\x20interactions',_0x286ad4?util[_0x6d46('0x1d')](_0x286ad4,{'showHidden':![],'depth':null}):'');});}exports[_0x6d46('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index b7c4a99..858f590 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x322c=['startAllRefreshIntervals','exports'];(function(_0x3f8ccf,_0x19f325){var _0x125afa=function(_0x7ce45d){while(--_0x7ce45d){_0x3f8ccf['push'](_0x3f8ccf['shift']());}};_0x125afa(++_0x19f325);}(_0x322c,0x1a4));var _0xc322=function(_0x3e6221,_0x18de7a){_0x3e6221=_0x3e6221-0x0;var _0x9effa=_0x322c[_0x3e6221];return _0x9effa;};'use strict';function start(){var _0x44e223=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x44e223[_0xc322('0x0')]();}module[_0xc322('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xd3de=['../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x401da7,_0xf6b87b){var _0x140d4d=function(_0x27a2cc){while(--_0x27a2cc){_0x401da7['push'](_0x401da7['shift']());}};_0x140d4d(++_0xf6b87b);}(_0xd3de,0x101));var _0xed3d=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xd3de[_0x8c43de];return _0xa6591b;};'use strict';function start(){var _0x54cefc=require(_0xed3d('0x0'));return _0x54cefc['startAllRefreshIntervals']();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 0b9b975..e0f534c 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 _0x3c85=['runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','then','no\x20report\x20id','Schedule','CloudProvider','keys','map','toString','difference','intersection','exists','stop','deleteJob','length','index','my\x20id','resolve','run\x20job','cron','active','endAt','add','start','add\x20cron','isBetween','startAt','update','stop\x20cron','run','util','path','lodash','moment','cron-job-manager','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','\x22%s\x22\x20<%s>','name','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','basename','savename','extname','zip','existsSync','Sent','message','attachments','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','SendMail','error','error\x20mail','data','subtractNumber\x20null\x20or\x20undefined','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s'];(function(_0x568039,_0x570f8e){var _0x1595fc=function(_0x50ac8f){while(--_0x50ac8f){_0x568039['push'](_0x568039['shift']());}};_0x1595fc(++_0x570f8e);}(_0x3c85,0x113));var _0x53c8=function(_0x2db982,_0x565f45){_0x2db982=_0x2db982-0x0;var _0x1b51cc=_0x3c85[_0x2db982];return _0x1b51cc;};'use strict';var fs=require('fs');var util=require(_0x53c8('0x0'));var path=require(_0x53c8('0x1'));var _=require(_0x53c8('0x2'));var moment=require(_0x53c8('0x3'));var CronJobManager=require(_0x53c8('0x4'));var jayson=require('jayson/promise');var BPromise=require(_0x53c8('0x5'));var logger=require('../logger')(_0x53c8('0x6'));var db=require(_0x53c8('0x7'))['db'];var analyticCustomReportController=require(_0x53c8('0x8'));var analyticDefaultReportController=require(_0x53c8('0x9'));var client=jayson[_0x53c8('0xa')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x25c465,_0x494543){return function(){logger[_0x53c8('0xb')](_0x53c8('0xc'),_0x25c465[_0x53c8('0xd')]);var _0x402d2c=!![];var _0x3efdbb=_0x25c465[_0x53c8('0xe')]['getSmtpOptions']();var _0x5091c1={'account':_0x3efdbb,'message':{'from':util[_0x53c8('0xf')](_0x53c8('0x10'),_0x25c465[_0x53c8('0xe')][_0x53c8('0x11')],_0x25c465[_0x53c8('0xe')][_0x53c8('0xd')]||_0x25c465[_0x53c8('0xe')][_0x53c8('0x12')]['user']),'to':_0x25c465[_0x53c8('0xd')],'cc':_0x25c465['cc'],'bcc':_0x25c465[_0x53c8('0x13')],'subject':util[_0x53c8('0xf')](_0x53c8('0x14'),_0x494543[_0x53c8('0x11')],_0x25c465[_0x53c8('0x15')],_0x25c465[_0x53c8('0x16')])}};var _0x93020b=path[_0x53c8('0x17')](__dirname,'../../files/reports');var _0x1a6fcf=_0x494543['savename'];var _0x18b34f=util[_0x53c8('0xf')]('%s.%s',path[_0x53c8('0x18')](_0x494543[_0x53c8('0x19')],path[_0x53c8('0x1a')](_0x494543[_0x53c8('0x19')])),_0x53c8('0x1b'));var _0x2bde5b=path['join'](_0x93020b,_0x1a6fcf);var _0x4822f5=path[_0x53c8('0x17')](_0x93020b,_0x18b34f);if(fs[_0x53c8('0x1c')](_0x2bde5b)){_0x494543['status']=_0x53c8('0x1d');_0x5091c1[_0x53c8('0x1e')][_0x53c8('0x1f')]=[{'filename':_0x1a6fcf,'path':_0x2bde5b}];_0x5091c1[_0x53c8('0x1e')]['text']=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x53c8('0x20')](_0x494543,null,0x2));}else if(fs['existsSync'](_0x4822f5)){_0x494543['status']=_0x53c8('0x1d');_0x5091c1[_0x53c8('0x1e')][_0x53c8('0x1f')]=[{'filename':_0x18b34f,'path':_0x4822f5}];}else{_0x5091c1[_0x53c8('0x1e')][_0x53c8('0x21')]=_0x53c8('0x22');if(!_0x25c465[_0x53c8('0x23')]){_0x402d2c=![];logger[_0x53c8('0xb')](_0x53c8('0x24'));}}if(_0x402d2c){return client['request'](_0x53c8('0x25'),_0x5091c1)['then'](function(_0x211225){if(_0x211225['error']){return logger[_0x53c8('0x26')]('error\x20mail',JSON[_0x53c8('0x20')](_0x211225));}return logger[_0x53c8('0xb')]('email\x20sent');})['catch'](function(_0x1a4bc3){return logger[_0x53c8('0x26')](_0x53c8('0x27'),JSON[_0x53c8('0x20')](_0x1a4bc3));});}};}function handleError(){return function(_0x3f5d08){return logger[_0x53c8('0x26')](JSON['stringify'](_0x3f5d08));};}function handleResult(_0xea678a){return function(_0x28ee28){logger[_0x53c8('0xb')](_0x53c8('0x28'),JSON[_0x53c8('0x20')](_0x28ee28));if(_0xea678a['MailAccount']&&_0xea678a[_0x53c8('0xe')][_0x53c8('0x12')]&&!_['isNil'](_0xea678a['email'])){setTimeout(handleSendEmail(_0xea678a,_0x28ee28),0x3c*0x3e8);}};}function handleJob(_0x5f2ec6){return function(){try{if(_['isNil'](_0x5f2ec6[_0x53c8('0x15')])){return logger[_0x53c8('0xb')](_0x53c8('0x29'));}if(_[_0x53c8('0x2a')](_0x5f2ec6[_0x53c8('0x16')])){return logger[_0x53c8('0xb')](_0x53c8('0x2b'));}var _0xbaad0f={'startDate':moment()[_0x53c8('0x2c')](_0x5f2ec6[_0x53c8('0x15')],_0x5f2ec6[_0x53c8('0x16')])['format'](_0x53c8('0x2d')),'endDate':moment()[_0x53c8('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x53c8('0x2e'),'output':_0x5f2ec6['output'],'name':_0x5f2ec6['name']};if(!_[_0x53c8('0x2a')](_0x5f2ec6[_0x53c8('0x2f')])){logger[_0x53c8('0xb')](_0x53c8('0x30'),_0x5f2ec6[_0x53c8('0x2f')]);return analyticDefaultReportController[_0x53c8('0x31')]({'id':_0x5f2ec6[_0x53c8('0x2f')]},_0xbaad0f)['then'](handleResult(_0x5f2ec6))[_0x53c8('0x32')](handleError());}if(!_['isNil'](_0x5f2ec6[_0x53c8('0x33')])){logger['info'](_0x53c8('0x34'),_0x5f2ec6[_0x53c8('0x33')]);return analyticCustomReportController[_0x53c8('0x31')]({'id':_0x5f2ec6[_0x53c8('0x33')]},_0xbaad0f)[_0x53c8('0x35')](handleResult(_0x5f2ec6))[_0x53c8('0x32')](handleError());}}catch(_0x54e198){logger[_0x53c8('0x26')](JSON['stringify'](_0x54e198));}return logger[_0x53c8('0xb')](_0x53c8('0x36'));};}function getJobs(_0x2adde0){var _0x2ccaab={};if(_0x2adde0){_0x2ccaab['id']=_0x2adde0;}return db[_0x53c8('0x37')]['findAll']({'where':_0x2ccaab,'include':[{'model':db[_0x53c8('0xe')],'attributes':['id',_0x53c8('0x11'),_0x53c8('0xd')],'include':[{'model':db['MailServerOut'],'as':_0x53c8('0x12'),'include':[{'model':db[_0x53c8('0x38')],'as':'CloudProvider'}]}]}]})[_0x53c8('0x35')](function(_0x40313a){var _0x52a8ed=_[_0x53c8('0x39')](manager['jobs']);var _0x5504fe=_[_0x53c8('0x3a')](_0x40313a,function(_0x2bf970){return _0x2bf970['id'][_0x53c8('0x3b')]();});var _0x2e0bc9=_['keyBy'](_0x40313a,function(_0x4b4037){return _0x4b4037['id'][_0x53c8('0x3b')]();});var _0x4e990c=_0x2adde0?_0x5504fe:_[_0x53c8('0x3c')](_0x5504fe,_0x52a8ed);var _0x2946ec=_[_0x53c8('0x3d')](_0x5504fe,_0x52a8ed);var _0x125eb6=_[_0x53c8('0x3c')](_0x52a8ed,_0x5504fe);var _0x3dc8aa;var _0x3ec0b7;for(_0x3dc8aa=0x0;_0x3dc8aa<_0x125eb6['length']&&!_0x2adde0;_0x3dc8aa+=0x1){_0x3ec0b7=_0x125eb6[_0x3dc8aa][_0x53c8('0x3b')]();if(manager[_0x53c8('0x3e')](_0x3ec0b7)){manager[_0x53c8('0x3f')](_0x3ec0b7);manager[_0x53c8('0x40')](_0x3ec0b7);logger[_0x53c8('0xb')]('delete\x20cron',_0x3ec0b7);}}logger[_0x53c8('0xb')]('toRun',JSON[_0x53c8('0x20')](_0x4e990c));for(_0x3dc8aa=0x0;_0x3dc8aa<_0x4e990c[_0x53c8('0x41')];_0x3dc8aa+=0x1){_0x3ec0b7=_0x4e990c[_0x3dc8aa][_0x53c8('0x3b')]();logger[_0x53c8('0xb')](_0x53c8('0x42'),_0x3ec0b7);if(_0x2adde0){logger[_0x53c8('0xb')](_0x53c8('0x43'),_0x2adde0);logger['info'](JSON[_0x53c8('0x20')](_0x2e0bc9[_0x3ec0b7]));BPromise[_0x53c8('0x44')]()[_0x53c8('0x35')](handleJob(_0x2e0bc9[_0x3ec0b7]));logger[_0x53c8('0xb')](_0x53c8('0x45'),_0x2e0bc9[_0x3ec0b7][_0x53c8('0x11')],_0x2e0bc9[_0x3ec0b7][_0x53c8('0x46')]);}else if(_0x2e0bc9[_0x3ec0b7][_0x53c8('0x46')]&&_0x2e0bc9[_0x3ec0b7][_0x53c8('0x47')]&&moment()['isBetween'](_0x2e0bc9[_0x3ec0b7]['startAt'],_0x2e0bc9[_0x3ec0b7][_0x53c8('0x48')])){manager[_0x53c8('0x49')](_0x3ec0b7,_0x2e0bc9[_0x3ec0b7][_0x53c8('0x46')],handleJob(_0x2e0bc9[_0x3ec0b7]));manager[_0x53c8('0x4a')](_0x3ec0b7);logger['info'](_0x53c8('0x4b'),_0x2e0bc9[_0x3ec0b7][_0x53c8('0x11')],_0x2e0bc9[_0x3ec0b7][_0x53c8('0x46')]);}else if(manager[_0x53c8('0x3e')](_0x3ec0b7)){manager['stop'](_0x3ec0b7);manager[_0x53c8('0x40')](_0x3ec0b7);logger['info']('stop\x20cron',_0x2e0bc9[_0x3ec0b7][_0x53c8('0x11')],_0x2e0bc9[_0x3ec0b7][_0x53c8('0x46')]);}}for(_0x3dc8aa=0x0,_0x3ec0b7;_0x3dc8aa<_0x2946ec[_0x53c8('0x41')]&&!_0x2adde0;_0x3dc8aa+=0x1){_0x3ec0b7=_0x2946ec[_0x3dc8aa][_0x53c8('0x3b')]();if(manager['exists'](_0x3ec0b7)){if(_0x2e0bc9[_0x3ec0b7][_0x53c8('0x46')]&&_0x2e0bc9[_0x3ec0b7][_0x53c8('0x47')]&&moment()[_0x53c8('0x4c')](_0x2e0bc9[_0x3ec0b7][_0x53c8('0x4d')],_0x2e0bc9[_0x3ec0b7]['endAt'])){manager[_0x53c8('0x4e')](_0x3ec0b7,_0x2e0bc9[_0x3ec0b7][_0x53c8('0x46')],handleJob(_0x2e0bc9[_0x3ec0b7]));logger[_0x53c8('0xb')]('update\x20cron',_0x2e0bc9[_0x3ec0b7][_0x53c8('0x11')],_0x2e0bc9[_0x3ec0b7][_0x53c8('0x46')]);}else{manager[_0x53c8('0x3f')](_0x3ec0b7);manager[_0x53c8('0x40')](_0x3ec0b7);logger[_0x53c8('0xb')](_0x53c8('0x4f'),_0x2e0bc9[_0x3ec0b7]['name'],_0x2e0bc9[_0x3ec0b7][_0x53c8('0x46')]);}}}})['catch'](function(_0x1bd31a){logger[_0x53c8('0x26')](JSON[_0x53c8('0x20')](_0x1bd31a));});}exports[_0x53c8('0x50')]=function(_0x49bd1d){return getJobs(_0x49bd1d);};exports[_0x53c8('0x4a')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xb1a4=['Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','text','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','stringify','email\x20sent','error\x20mail','data','Smtp','isNil','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','findAll','MailServerOut','CloudProvider','jobs','keyBy','toString','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','add\x20cron','stop\x20cron','start','util','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','Sent','message','attachments'];(function(_0x196ad4,_0xaf4164){var _0x36d6aa=function(_0x37504e){while(--_0x37504e){_0x196ad4['push'](_0x196ad4['shift']());}};_0x36d6aa(++_0xaf4164);}(_0xb1a4,0x12e));var _0x4b1a=function(_0x5463ca,_0x1ab297){_0x5463ca=_0x5463ca-0x0;var _0x5d46af=_0xb1a4[_0x5463ca];return _0x5d46af;};'use strict';var fs=require('fs');var util=require(_0x4b1a('0x0'));var path=require('path');var _=require(_0x4b1a('0x1'));var moment=require(_0x4b1a('0x2'));var CronJobManager=require(_0x4b1a('0x3'));var jayson=require(_0x4b1a('0x4'));var BPromise=require(_0x4b1a('0x5'));var logger=require(_0x4b1a('0x6'))(_0x4b1a('0x7'));var db=require(_0x4b1a('0x8'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x4b1a('0x9'));var client=jayson[_0x4b1a('0xa')][_0x4b1a('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5b2eca,_0xe9ac1){return function(){logger[_0x4b1a('0xc')](_0x4b1a('0xd'),_0x5b2eca[_0x4b1a('0xe')]);var _0x241c69=!![];var _0x20d051=_0x5b2eca[_0x4b1a('0xf')][_0x4b1a('0x10')]();var _0x72f367={'account':_0x20d051,'message':{'from':util[_0x4b1a('0x11')](_0x4b1a('0x12'),_0x5b2eca[_0x4b1a('0xf')][_0x4b1a('0x13')],_0x5b2eca[_0x4b1a('0xf')][_0x4b1a('0xe')]||_0x5b2eca['MailAccount']['Smtp']['user']),'to':_0x5b2eca['email'],'cc':_0x5b2eca['cc'],'bcc':_0x5b2eca[_0x4b1a('0x14')],'subject':util[_0x4b1a('0x11')](_0x4b1a('0x15'),_0xe9ac1[_0x4b1a('0x13')],_0x5b2eca[_0x4b1a('0x16')],_0x5b2eca[_0x4b1a('0x17')])}};var _0x10d4be=path[_0x4b1a('0x18')](__dirname,_0x4b1a('0x19'));var _0x27b096=_0xe9ac1[_0x4b1a('0x1a')];var _0x42ff64=util[_0x4b1a('0x11')](_0x4b1a('0x1b'),path[_0x4b1a('0x1c')](_0xe9ac1['savename'],path[_0x4b1a('0x1d')](_0xe9ac1[_0x4b1a('0x1a')])),_0x4b1a('0x1e'));var _0x591489=path[_0x4b1a('0x18')](_0x10d4be,_0x27b096);var _0x33df46=path[_0x4b1a('0x18')](_0x10d4be,_0x42ff64);if(fs['existsSync'](_0x591489)){_0xe9ac1['status']=_0x4b1a('0x1f');_0x72f367[_0x4b1a('0x20')][_0x4b1a('0x21')]=[{'filename':_0x27b096,'path':_0x591489}];_0x72f367['message']['text']=util['format'](_0x4b1a('0x22'),JSON['stringify'](_0xe9ac1,null,0x2));}else if(fs['existsSync'](_0x33df46)){_0xe9ac1['status']='Sent';_0x72f367[_0x4b1a('0x20')][_0x4b1a('0x21')]=[{'filename':_0x42ff64,'path':_0x33df46}];}else{_0x72f367[_0x4b1a('0x20')][_0x4b1a('0x23')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x5b2eca[_0x4b1a('0x24')]){_0x241c69=![];logger[_0x4b1a('0xc')](_0x4b1a('0x25'));}}if(_0x241c69){return client[_0x4b1a('0x26')](_0x4b1a('0x27'),_0x72f367)['then'](function(_0x25c018){if(_0x25c018[_0x4b1a('0x28')]){return logger['error']('error\x20mail',JSON[_0x4b1a('0x29')](_0x25c018));}return logger[_0x4b1a('0xc')](_0x4b1a('0x2a'));})['catch'](function(_0x3914d3){return logger['error'](_0x4b1a('0x2b'),JSON[_0x4b1a('0x29')](_0x3914d3));});}};}function handleError(){return function(_0x2412c6){return logger[_0x4b1a('0x28')](JSON['stringify'](_0x2412c6));};}function handleResult(_0x1495c8){return function(_0x1e1f1c){logger[_0x4b1a('0xc')](_0x4b1a('0x2c'),JSON[_0x4b1a('0x29')](_0x1e1f1c));if(_0x1495c8['MailAccount']&&_0x1495c8[_0x4b1a('0xf')][_0x4b1a('0x2d')]&&!_[_0x4b1a('0x2e')](_0x1495c8[_0x4b1a('0xe')])){setTimeout(handleSendEmail(_0x1495c8,_0x1e1f1c),0x3c*0x3e8);}};}function handleJob(_0x361697){return function(){try{if(_['isNil'](_0x361697[_0x4b1a('0x16')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x4b1a('0x2e')](_0x361697[_0x4b1a('0x17')])){return logger[_0x4b1a('0xc')]('subtractUnit\x20null\x20or\x20undefined');}var _0x5c18f2={'startDate':moment()[_0x4b1a('0x2f')](_0x361697[_0x4b1a('0x16')],_0x361697[_0x4b1a('0x17')])['format'](_0x4b1a('0x30')),'endDate':moment()[_0x4b1a('0x11')](_0x4b1a('0x30')),'type':'scheduled','output':_0x361697[_0x4b1a('0x31')],'name':_0x361697[_0x4b1a('0x13')]};if(!_['isNil'](_0x361697[_0x4b1a('0x32')])){logger[_0x4b1a('0xc')](_0x4b1a('0x33'),_0x361697[_0x4b1a('0x32')]);return analyticDefaultReportController[_0x4b1a('0x34')]({'id':_0x361697[_0x4b1a('0x32')]},_0x5c18f2)[_0x4b1a('0x35')](handleResult(_0x361697))[_0x4b1a('0x36')](handleError());}if(!_[_0x4b1a('0x2e')](_0x361697[_0x4b1a('0x37')])){logger[_0x4b1a('0xc')](_0x4b1a('0x38'),_0x361697[_0x4b1a('0x37')]);return analyticCustomReportController[_0x4b1a('0x34')]({'id':_0x361697[_0x4b1a('0x37')]},_0x5c18f2)['then'](handleResult(_0x361697))['catch'](handleError());}}catch(_0x3ff862){logger['error'](JSON[_0x4b1a('0x29')](_0x3ff862));}return logger[_0x4b1a('0xc')](_0x4b1a('0x39'));};}function getJobs(_0x45a47c){var _0x5c331c={};if(_0x45a47c){_0x5c331c['id']=_0x45a47c;}return db['Schedule'][_0x4b1a('0x3a')]({'where':_0x5c331c,'include':[{'model':db[_0x4b1a('0xf')],'attributes':['id','name','email'],'include':[{'model':db[_0x4b1a('0x3b')],'as':_0x4b1a('0x2d'),'include':[{'model':db[_0x4b1a('0x3c')],'as':_0x4b1a('0x3c')}]}]}]})[_0x4b1a('0x35')](function(_0x29da2f){var _0x250887=_['keys'](manager[_0x4b1a('0x3d')]);var _0x409dd0=_['map'](_0x29da2f,function(_0x5872e1){return _0x5872e1['id']['toString']();});var _0x21894c=_[_0x4b1a('0x3e')](_0x29da2f,function(_0x50773d){return _0x50773d['id'][_0x4b1a('0x3f')]();});var _0x55f81c=_0x45a47c?_0x409dd0:_[_0x4b1a('0x40')](_0x409dd0,_0x250887);var _0x7fd45b=_[_0x4b1a('0x41')](_0x409dd0,_0x250887);var _0xf4ef96=_[_0x4b1a('0x40')](_0x250887,_0x409dd0);var _0x5ea326;var _0xf12ce0;for(_0x5ea326=0x0;_0x5ea326<_0xf4ef96[_0x4b1a('0x42')]&&!_0x45a47c;_0x5ea326+=0x1){_0xf12ce0=_0xf4ef96[_0x5ea326][_0x4b1a('0x3f')]();if(manager[_0x4b1a('0x43')](_0xf12ce0)){manager[_0x4b1a('0x44')](_0xf12ce0);manager[_0x4b1a('0x45')](_0xf12ce0);logger[_0x4b1a('0xc')](_0x4b1a('0x46'),_0xf12ce0);}}logger[_0x4b1a('0xc')]('toRun',JSON[_0x4b1a('0x29')](_0x55f81c));for(_0x5ea326=0x0;_0x5ea326<_0x55f81c[_0x4b1a('0x42')];_0x5ea326+=0x1){_0xf12ce0=_0x55f81c[_0x5ea326]['toString']();logger[_0x4b1a('0xc')](_0x4b1a('0x47'),_0xf12ce0);if(_0x45a47c){logger[_0x4b1a('0xc')](_0x4b1a('0x48'),_0x45a47c);logger[_0x4b1a('0xc')](JSON[_0x4b1a('0x29')](_0x21894c[_0xf12ce0]));BPromise[_0x4b1a('0x49')]()['then'](handleJob(_0x21894c[_0xf12ce0]));logger[_0x4b1a('0xc')](_0x4b1a('0x4a'),_0x21894c[_0xf12ce0][_0x4b1a('0x13')],_0x21894c[_0xf12ce0][_0x4b1a('0x4b')]);}else if(_0x21894c[_0xf12ce0][_0x4b1a('0x4b')]&&_0x21894c[_0xf12ce0][_0x4b1a('0x4c')]&&moment()[_0x4b1a('0x4d')](_0x21894c[_0xf12ce0][_0x4b1a('0x4e')],_0x21894c[_0xf12ce0][_0x4b1a('0x4f')])){manager[_0x4b1a('0x50')](_0xf12ce0,_0x21894c[_0xf12ce0][_0x4b1a('0x4b')],handleJob(_0x21894c[_0xf12ce0]));manager['start'](_0xf12ce0);logger['info'](_0x4b1a('0x51'),_0x21894c[_0xf12ce0][_0x4b1a('0x13')],_0x21894c[_0xf12ce0][_0x4b1a('0x4b')]);}else if(manager[_0x4b1a('0x43')](_0xf12ce0)){manager[_0x4b1a('0x44')](_0xf12ce0);manager['deleteJob'](_0xf12ce0);logger[_0x4b1a('0xc')](_0x4b1a('0x52'),_0x21894c[_0xf12ce0][_0x4b1a('0x13')],_0x21894c[_0xf12ce0][_0x4b1a('0x4b')]);}}for(_0x5ea326=0x0,_0xf12ce0;_0x5ea326<_0x7fd45b[_0x4b1a('0x42')]&&!_0x45a47c;_0x5ea326+=0x1){_0xf12ce0=_0x7fd45b[_0x5ea326][_0x4b1a('0x3f')]();if(manager[_0x4b1a('0x43')](_0xf12ce0)){if(_0x21894c[_0xf12ce0][_0x4b1a('0x4b')]&&_0x21894c[_0xf12ce0][_0x4b1a('0x4c')]&&moment()[_0x4b1a('0x4d')](_0x21894c[_0xf12ce0][_0x4b1a('0x4e')],_0x21894c[_0xf12ce0]['endAt'])){manager['update'](_0xf12ce0,_0x21894c[_0xf12ce0][_0x4b1a('0x4b')],handleJob(_0x21894c[_0xf12ce0]));logger['info']('update\x20cron',_0x21894c[_0xf12ce0][_0x4b1a('0x13')],_0x21894c[_0xf12ce0][_0x4b1a('0x4b')]);}else{manager[_0x4b1a('0x44')](_0xf12ce0);manager[_0x4b1a('0x45')](_0xf12ce0);logger[_0x4b1a('0xc')](_0x4b1a('0x52'),_0x21894c[_0xf12ce0][_0x4b1a('0x13')],_0x21894c[_0xf12ce0][_0x4b1a('0x4b')]);}}}})[_0x4b1a('0x36')](function(_0x1a1869){logger[_0x4b1a('0x28')](JSON['stringify'](_0x1a1869));});}exports['run']=function(_0x39ddce){return getJobs(_0x39ddce);};exports[_0x4b1a('0x53')]=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 413939e..34dda2b 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 _0xb077=['transcribeName','data2','transcribeRegion','then','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','[RECORDING:%d]\x20Get\x20transcript','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','length','transcripts','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment\x20Analysis\x20not\x20configured','findOne','catch','name','SequelizeValidationError','error','inspect','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','push','all','start','lodash','util','../../mysqldb','../../config/logger','transcribe','Comprehend','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)'];(function(_0x122ec9,_0x421ba4){var _0x290be4=function(_0x356dce){while(--_0x356dce){_0x122ec9['push'](_0x122ec9['shift']());}};_0x290be4(++_0x421ba4);}(_0xb077,0x7a));var _0x7b07=function(_0x2767f0,_0x54ba93){_0x2767f0=_0x2767f0-0x0;var _0x1fd561=_0xb077[_0x2767f0];return _0x1fd561;};var _=require(_0x7b07('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require(_0x7b07('0x1'));var BPromise=require('bluebird');var db=require(_0x7b07('0x2'))['db'];var logger=require(_0x7b07('0x3'))(_0x7b07('0x4'));function getTranscriptionJob(_0x2b0c6c,_0x423957,_0x5df1bf,_0x5722bb){return new Promise(function(_0xdc333,_0x325d95){var _0x110ee5=new AWS['TranscribeService']({'accessKeyId':_0x423957,'secretAccessKey':_0x2b0c6c,'region':_0x5df1bf});_0x110ee5['getTranscriptionJob']({'TranscriptionJobName':_0x5722bb},function(_0x3a82e8,_0x4b6f20){if(_0x3a82e8){return _0x325d95(_0x3a82e8);}else{return _0xdc333(_0x4b6f20);}});});}function sentiment(_0x3dd0ad,_0x292db1,_0x2d3741,_0x214052,_0x1e8092){return new Promise(function(_0x23522e,_0x2f7009){var _0x33a461=new AWS[(_0x7b07('0x5'))]({'accessKeyId':_0x292db1,'secretAccessKey':_0x3dd0ad,'region':_0x2d3741});_0x33a461['detectSentiment']({'Text':_0x214052,'LanguageCode':_0x1e8092[_0x7b07('0x6')](0x0,0x2)},function(_0x282fe2,_0x1ffc7c){if(_0x282fe2){return _0x2f7009(_0x282fe2);}else{return _0x23522e(_0x1ffc7c);}});});}function checkTranscribeJob(_0x5684db,_0xe825c4,_0x3d73c6){var _0x9f3404;return new BPromise(function(_0x7930f1,_0x530d1d){logger[_0x7b07('0x7')](util[_0x7b07('0x8')](_0x7b07('0x9'),_0x5684db['id'],_0x5684db[_0x7b07('0xa')]));return getTranscriptionJob(_0x3d73c6['data1'],_0x3d73c6[_0x7b07('0xb')],_0xe825c4[_0x7b07('0xc')],_0x5684db[_0x7b07('0xa')])[_0x7b07('0xd')](function(_0x4b7d85){logger['info'](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x5684db['id'],_0x5684db[_0x7b07('0xa')],_0x4b7d85[_0x7b07('0xe')][_0x7b07('0xf')]));if(!_0x5684db[_0x7b07('0x10')]){switch(_0x4b7d85[_0x7b07('0xe')][_0x7b07('0xf')]){case _0x7b07('0x11'):var _0x5141d7={'transcribeStatus':_0x4b7d85[_0x7b07('0xe')][_0x7b07('0xf')],'fileUri':_0x4b7d85['TranscriptionJob']['Transcript']['TranscriptFileUri']};logger[_0x7b07('0x7')](util[_0x7b07('0x8')](_0x7b07('0x12'),_0x5684db['id']));return rp({'uri':_0x4b7d85[_0x7b07('0xe')][_0x7b07('0x13')][_0x7b07('0x14')],'json':!![]})[_0x7b07('0xd')](function(_0x481812){logger[_0x7b07('0x7')](util[_0x7b07('0x8')](_0x7b07('0x15'),_0x5684db['id']));if(_0x481812&&_0x481812['results']&&_0x481812[_0x7b07('0x16')]['transcripts']&&_0x481812[_0x7b07('0x16')]['transcripts'][_0x7b07('0x17')]){_0x5141d7[_0x7b07('0x10')]='';for(var _0x23f830=0x0;_0x23f830<_0x481812[_0x7b07('0x16')]['transcripts'][_0x7b07('0x17')];_0x23f830++){_0x5141d7['fileText']+=_0x481812[_0x7b07('0x16')][_0x7b07('0x18')][_0x23f830]['transcript']+'';}}return _0x5684db[_0x7b07('0x19')](_0x5141d7);})[_0x7b07('0xd')](function(){logger[_0x7b07('0x7')](util[_0x7b07('0x8')](_0x7b07('0x1a'),_0x5684db['id']));if(!_0x5684db[_0x7b07('0x1b')]){throw new db[(_0x7b07('0x1c'))][(_0x7b07('0x1d'))](_0x7b07('0x1e'));}if(!_0xe825c4[_0x7b07('0x1f')]||!_0xe825c4[_0x7b07('0x20')]||!_0xe825c4[_0x7b07('0x21')]||!_0xe825c4[_0x7b07('0x22')]||!_0xe825c4[_0x7b07('0x23')]){throw new db[(_0x7b07('0x1c'))][(_0x7b07('0x1d'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x5141d7['fileText']){throw new Error(_0x7b07('0x24'));}if(_0xe825c4[_0x7b07('0x20')]===_0x3d73c6['id']){return _0x3d73c6;}else{return db[_0x7b07('0x25')]['findOne']({'where':{'id':_settings[_0x7b07('0x20')]}});}})[_0x7b07('0xd')](function(_0x15713b){if(!_0x15713b){throw new db[(_0x7b07('0x1c'))]['ValidationError'](_0x7b07('0x26'));}if(!_0x15713b['data1']||!_0x15713b[_0x7b07('0xb')]){throw new db['Sequelize'][(_0x7b07('0x1d'))](_0x7b07('0x27'));}_0x9f3404=_0x15713b;logger['info'](util['format'](_0x7b07('0x28'),_0x5684db['id']));return sentiment(_0x9f3404['data1'],_0x9f3404[_0x7b07('0xb')],_0xe825c4[_0x7b07('0x21')],_0x5141d7['fileText'],_0xe825c4[_0x7b07('0x22')]);})['then'](function(_0x661e89){logger[_0x7b07('0x7')](util[_0x7b07('0x8')](_0x7b07('0x29'),_0x5684db['id']));return _0x5684db[_0x7b07('0x19')]({'sentiment':_0x661e89[_0x7b07('0x2a')],'sPositive':_0x661e89[_0x7b07('0x2b')][_0x7b07('0x2c')],'sNegative':_0x661e89[_0x7b07('0x2b')][_0x7b07('0x2d')],'sMixed':_0x661e89[_0x7b07('0x2b')][_0x7b07('0x2e')],'sNeutral':_0x661e89[_0x7b07('0x2b')][_0x7b07('0x2f')]});})[_0x7b07('0xd')](function(){logger[_0x7b07('0x7')](util[_0x7b07('0x8')](_0x7b07('0x1a'),_0x5684db['id']));_0x7930f1();});case _0x7b07('0x30'):return _0x5684db[_0x7b07('0x19')]({'transcribeStatus':'FAILED','failureReason':_0x4b7d85[_0x7b07('0xe')][_0x7b07('0x31')]})[_0x7b07('0xd')](function(){logger[_0x7b07('0x7')](util[_0x7b07('0x8')](_0x7b07('0x1a'),_0x5684db['id']));_0x7930f1();});default:logger[_0x7b07('0x7')](util[_0x7b07('0x8')](_0x7b07('0x32'),_0x5684db['id']));break;}}else{return BPromise['resolve']()[_0x7b07('0xd')](function(){if(!_0x5684db[_0x7b07('0x1b')]){throw new db['Sequelize'][(_0x7b07('0x1d'))](_0x7b07('0x1e'));}if(!_0xe825c4['sentiment']||!_0xe825c4[_0x7b07('0x20')]||!_0xe825c4[_0x7b07('0x21')]||!_0xe825c4[_0x7b07('0x22')]||!_0xe825c4[_0x7b07('0x23')]){throw new db[(_0x7b07('0x1c'))]['ValidationError'](_0x7b07('0x33'));}if(!_0x5684db[_0x7b07('0x10')]){throw new Error(_0x7b07('0x24'));}if(_0xe825c4[_0x7b07('0x20')]===_0x3d73c6['id']){return _0x3d73c6;}else{return db[_0x7b07('0x25')][_0x7b07('0x34')]({'where':{'id':_settings[_0x7b07('0x20')]}});}})[_0x7b07('0xd')](function(_0x523355){if(!_0x523355){throw new db[(_0x7b07('0x1c'))][(_0x7b07('0x1d'))](_0x7b07('0x26'));}if(!_0x523355['data1']||!_0x523355[_0x7b07('0xb')]){throw new db[(_0x7b07('0x1c'))][(_0x7b07('0x1d'))]('Cloud\x20Provider\x20not\x20configured');}_0x9f3404=_0x523355;logger[_0x7b07('0x7')](util[_0x7b07('0x8')](_0x7b07('0x28'),_0x5684db['id']));return sentiment(_0x9f3404['data1'],_0x9f3404[_0x7b07('0xb')],_0xe825c4['sentimentRegion'],_0x5684db[_0x7b07('0x10')],_0xe825c4[_0x7b07('0x22')]);})[_0x7b07('0xd')](function(_0x55a96d){logger[_0x7b07('0x7')](util[_0x7b07('0x8')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5684db['id']));return _0x5684db['update']({'sentiment':_0x55a96d[_0x7b07('0x2a')],'sPositive':_0x55a96d['SentimentScore'][_0x7b07('0x2c')],'sNegative':_0x55a96d[_0x7b07('0x2b')]['Negative'],'sMixed':_0x55a96d['SentimentScore'][_0x7b07('0x2e')],'sNeutral':_0x55a96d[_0x7b07('0x2b')]['Neutral'],'transcribeStatus':_0x7b07('0x11')});})[_0x7b07('0xd')](function(){logger[_0x7b07('0x7')](util[_0x7b07('0x8')](_0x7b07('0x1a'),_0x5684db['id']));_0x7930f1();});}})[_0x7b07('0x35')](function(_0xddd3b7){if(_0xddd3b7){if(!_0xddd3b7[_0x7b07('0x36')]||_0xddd3b7[_0x7b07('0x36')]!==_0x7b07('0x37')){logger[_0x7b07('0x38')](util[_0x7b07('0x8')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x5684db['id']),util[_0x7b07('0x39')](_0xddd3b7,{'showHidden':![],'depth':null}));}}_0x7930f1();});});}function checkTranscribe(){var _0x30ec1b;var _0x3e5593;var _0x4fc266;return db['VoiceRecording']['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x7b07('0xd')](function(_0x2ed908){if(!_0x2ed908||!_0x2ed908[_0x7b07('0x17')]){throw new db[(_0x7b07('0x1c'))][(_0x7b07('0x1d'))](_0x7b07('0x3a'));}_0x30ec1b=_0x2ed908;return db[_0x7b07('0x3b')][_0x7b07('0x34')]({'where':{'id':0x1}});})['then'](function(_0x2c2605){if(!_0x2c2605){throw new db[(_0x7b07('0x1c'))][(_0x7b07('0x1d'))](_0x7b07('0x3c'));}_0x3e5593=_0x2c2605;if(!_0x3e5593[_0x7b07('0x4')]||!_0x3e5593['transcribeAccountId']||!_0x3e5593[_0x7b07('0xc')]||!_0x3e5593[_0x7b07('0x22')]||!_0x3e5593[_0x7b07('0x23')]){throw new db[(_0x7b07('0x1c'))][(_0x7b07('0x1d'))]('Transcribe\x20not\x20configured');}return db[_0x7b07('0x25')][_0x7b07('0x34')]({'where':{'id':_0x3e5593[_0x7b07('0x3d')]}});})['then'](function(_0x53777d){if(!_0x53777d){throw new db['Sequelize'][(_0x7b07('0x1d'))](_0x7b07('0x26'));}if(!_0x53777d['data1']||!_0x53777d[_0x7b07('0xb')]){throw new db[(_0x7b07('0x1c'))]['ValidationError'](_0x7b07('0x27'));}_0x4fc266=_0x53777d;var _0x92e583=[];_0x30ec1b[_0x7b07('0x3e')](function(_0x516676){_0x92e583[_0x7b07('0x3f')](checkTranscribeJob(_0x516676,_0x3e5593,_0x4fc266));});return BPromise[_0x7b07('0x40')](_0x92e583);})[_0x7b07('0x35')](function(_0x188590){if(_0x188590){if(!_0x188590[_0x7b07('0x36')]||_0x188590['name']!==_0x7b07('0x37')){logger[_0x7b07('0x38')](util[_0x7b07('0x39')](_0x188590,{'showHidden':![],'depth':null}));}}});}exports[_0x7b07('0x41')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x14b7=['results','transcripts','length','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Positive','Negative','Mixed','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','CloudProvider','Neutral','catch','name','SequelizeValidationError','error','inspect','VoiceRecording','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','start','lodash','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x14b7,0x144));var _0x714b=function(_0x13ed6f,_0x515c3c){_0x13ed6f=_0x13ed6f-0x0;var _0x3b42dd=_0x14b7[_0x13ed6f];return _0x3b42dd;};var _=require(_0x714b('0x0'));var AWS=require(_0x714b('0x1'));var rp=require(_0x714b('0x2'));var util=require(_0x714b('0x3'));var BPromise=require('bluebird');var db=require(_0x714b('0x4'))['db'];var logger=require(_0x714b('0x5'))(_0x714b('0x6'));function getTranscriptionJob(_0xb51d07,_0x293652,_0x5c6849,_0x5977b4){return new Promise(function(_0x45c9ae,_0x966048){var _0x2a0a91=new AWS['TranscribeService']({'accessKeyId':_0x293652,'secretAccessKey':_0xb51d07,'region':_0x5c6849});_0x2a0a91[_0x714b('0x7')]({'TranscriptionJobName':_0x5977b4},function(_0x26489c,_0x53f14c){if(_0x26489c){return _0x966048(_0x26489c);}else{return _0x45c9ae(_0x53f14c);}});});}function sentiment(_0x43c9aa,_0x3c106a,_0x50dab0,_0x3169f2,_0x376867){return new Promise(function(_0x18d257,_0x526019){var _0x2b2df8=new AWS['Comprehend']({'accessKeyId':_0x3c106a,'secretAccessKey':_0x43c9aa,'region':_0x50dab0});_0x2b2df8['detectSentiment']({'Text':_0x3169f2,'LanguageCode':_0x376867[_0x714b('0x8')](0x0,0x2)},function(_0x321482,_0x5108a2){if(_0x321482){return _0x526019(_0x321482);}else{return _0x18d257(_0x5108a2);}});});}function checkTranscribeJob(_0x2eff0d,_0x253b28,_0x37bbf3){var _0x2abf13;return new BPromise(function(_0x534226,_0x9a5156){logger['info'](util[_0x714b('0x9')](_0x714b('0xa'),_0x2eff0d['id'],_0x2eff0d[_0x714b('0xb')]));return getTranscriptionJob(_0x37bbf3[_0x714b('0xc')],_0x37bbf3[_0x714b('0xd')],_0x253b28[_0x714b('0xe')],_0x2eff0d[_0x714b('0xb')])[_0x714b('0xf')](function(_0x3e430d){logger[_0x714b('0x10')](util[_0x714b('0x9')](_0x714b('0x11'),_0x2eff0d['id'],_0x2eff0d['transcribeName'],_0x3e430d[_0x714b('0x12')]['TranscriptionJobStatus']));if(!_0x2eff0d[_0x714b('0x13')]){switch(_0x3e430d['TranscriptionJob'][_0x714b('0x14')]){case _0x714b('0x15'):var _0x342190={'transcribeStatus':_0x3e430d[_0x714b('0x12')][_0x714b('0x14')],'fileUri':_0x3e430d[_0x714b('0x12')][_0x714b('0x16')][_0x714b('0x17')]};logger[_0x714b('0x10')](util[_0x714b('0x9')](_0x714b('0x18'),_0x2eff0d['id']));return rp({'uri':_0x3e430d[_0x714b('0x12')][_0x714b('0x16')][_0x714b('0x17')],'json':!![]})[_0x714b('0xf')](function(_0x49c25f){logger[_0x714b('0x10')](util[_0x714b('0x9')](_0x714b('0x19'),_0x2eff0d['id']));if(_0x49c25f&&_0x49c25f[_0x714b('0x1a')]&&_0x49c25f['results']['transcripts']&&_0x49c25f[_0x714b('0x1a')][_0x714b('0x1b')][_0x714b('0x1c')]){_0x342190[_0x714b('0x13')]='';for(var _0x2fb265=0x0;_0x2fb265<_0x49c25f[_0x714b('0x1a')][_0x714b('0x1b')]['length'];_0x2fb265++){_0x342190[_0x714b('0x13')]+=_0x49c25f[_0x714b('0x1a')][_0x714b('0x1b')][_0x2fb265]['transcript']+'';}}return _0x2eff0d['update'](_0x342190);})['then'](function(){logger[_0x714b('0x10')](util[_0x714b('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2eff0d['id']));if(!_0x2eff0d[_0x714b('0x1d')]){throw new db[(_0x714b('0x1e'))][(_0x714b('0x1f'))](_0x714b('0x20'));}if(!_0x253b28[_0x714b('0x21')]||!_0x253b28[_0x714b('0x22')]||!_0x253b28[_0x714b('0x23')]||!_0x253b28[_0x714b('0x24')]||!_0x253b28[_0x714b('0x25')]){throw new db['Sequelize']['ValidationError'](_0x714b('0x26'));}if(!_0x342190[_0x714b('0x13')]){throw new Error(_0x714b('0x27'));}if(_0x253b28[_0x714b('0x22')]===_0x37bbf3['id']){return _0x37bbf3;}else{return db['CloudProvider'][_0x714b('0x28')]({'where':{'id':_settings[_0x714b('0x22')]}});}})['then'](function(_0x2c2af0){if(!_0x2c2af0){throw new db[(_0x714b('0x1e'))][(_0x714b('0x1f'))](_0x714b('0x29'));}if(!_0x2c2af0[_0x714b('0xc')]||!_0x2c2af0[_0x714b('0xd')]){throw new db['Sequelize'][(_0x714b('0x1f'))](_0x714b('0x2a'));}_0x2abf13=_0x2c2af0;logger[_0x714b('0x10')](util[_0x714b('0x9')](_0x714b('0x2b'),_0x2eff0d['id']));return sentiment(_0x2abf13['data1'],_0x2abf13[_0x714b('0xd')],_0x253b28[_0x714b('0x23')],_0x342190[_0x714b('0x13')],_0x253b28[_0x714b('0x24')]);})[_0x714b('0xf')](function(_0xf43de6){logger[_0x714b('0x10')](util[_0x714b('0x9')](_0x714b('0x2c'),_0x2eff0d['id']));return _0x2eff0d[_0x714b('0x2d')]({'sentiment':_0xf43de6[_0x714b('0x2e')],'sPositive':_0xf43de6[_0x714b('0x2f')][_0x714b('0x30')],'sNegative':_0xf43de6['SentimentScore'][_0x714b('0x31')],'sMixed':_0xf43de6['SentimentScore'][_0x714b('0x32')],'sNeutral':_0xf43de6[_0x714b('0x2f')]['Neutral']});})[_0x714b('0xf')](function(){logger['info'](util[_0x714b('0x9')](_0x714b('0x33'),_0x2eff0d['id']));_0x534226();});case'FAILED':return _0x2eff0d[_0x714b('0x2d')]({'transcribeStatus':_0x714b('0x34'),'failureReason':_0x3e430d[_0x714b('0x12')]['FailureReason']})[_0x714b('0xf')](function(){logger[_0x714b('0x10')](util[_0x714b('0x9')](_0x714b('0x33'),_0x2eff0d['id']));_0x534226();});default:logger['info'](util[_0x714b('0x9')](_0x714b('0x35'),_0x2eff0d['id']));break;}}else{return BPromise['resolve']()[_0x714b('0xf')](function(){if(!_0x2eff0d[_0x714b('0x1d')]){throw new db[(_0x714b('0x1e'))][(_0x714b('0x1f'))](_0x714b('0x20'));}if(!_0x253b28[_0x714b('0x21')]||!_0x253b28['sentimentAccountId']||!_0x253b28['sentimentRegion']||!_0x253b28[_0x714b('0x24')]||!_0x253b28[_0x714b('0x25')]){throw new db[(_0x714b('0x1e'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x2eff0d['fileText']){throw new Error(_0x714b('0x27'));}if(_0x253b28[_0x714b('0x22')]===_0x37bbf3['id']){return _0x37bbf3;}else{return db[_0x714b('0x36')][_0x714b('0x28')]({'where':{'id':_settings[_0x714b('0x22')]}});}})[_0x714b('0xf')](function(_0x452b3b){if(!_0x452b3b){throw new db[(_0x714b('0x1e'))][(_0x714b('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x452b3b[_0x714b('0xc')]||!_0x452b3b[_0x714b('0xd')]){throw new db[(_0x714b('0x1e'))][(_0x714b('0x1f'))](_0x714b('0x2a'));}_0x2abf13=_0x452b3b;logger[_0x714b('0x10')](util[_0x714b('0x9')](_0x714b('0x2b'),_0x2eff0d['id']));return sentiment(_0x2abf13[_0x714b('0xc')],_0x2abf13[_0x714b('0xd')],_0x253b28[_0x714b('0x23')],_0x2eff0d[_0x714b('0x13')],_0x253b28[_0x714b('0x24')]);})[_0x714b('0xf')](function(_0x373472){logger[_0x714b('0x10')](util[_0x714b('0x9')](_0x714b('0x2c'),_0x2eff0d['id']));return _0x2eff0d[_0x714b('0x2d')]({'sentiment':_0x373472[_0x714b('0x2e')],'sPositive':_0x373472['SentimentScore'][_0x714b('0x30')],'sNegative':_0x373472[_0x714b('0x2f')]['Negative'],'sMixed':_0x373472[_0x714b('0x2f')][_0x714b('0x32')],'sNeutral':_0x373472[_0x714b('0x2f')][_0x714b('0x37')],'transcribeStatus':'COMPLETED'});})[_0x714b('0xf')](function(){logger['info'](util[_0x714b('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2eff0d['id']));_0x534226();});}})[_0x714b('0x38')](function(_0x2fffe2){if(_0x2fffe2){if(!_0x2fffe2[_0x714b('0x39')]||_0x2fffe2[_0x714b('0x39')]!==_0x714b('0x3a')){logger[_0x714b('0x3b')](util[_0x714b('0x9')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x2eff0d['id']),util[_0x714b('0x3c')](_0x2fffe2,{'showHidden':![],'depth':null}));}}_0x534226();});});}function checkTranscribe(){var _0xa08b62;var _0x408bb1;var _0x3ea939;return db[_0x714b('0x3d')]['findAll']({'where':{'transcribeStatus':_0x714b('0x3e')}})[_0x714b('0xf')](function(_0x4ece45){if(!_0x4ece45||!_0x4ece45[_0x714b('0x1c')]){throw new db[(_0x714b('0x1e'))][(_0x714b('0x1f'))]('No\x20transcribe\x20job\x20to\x20check');}_0xa08b62=_0x4ece45;return db[_0x714b('0x3f')][_0x714b('0x28')]({'where':{'id':0x1}});})[_0x714b('0xf')](function(_0x17ed9b){if(!_0x17ed9b){throw new db['Sequelize'][(_0x714b('0x1f'))](_0x714b('0x40'));}_0x408bb1=_0x17ed9b;if(!_0x408bb1[_0x714b('0x6')]||!_0x408bb1[_0x714b('0x41')]||!_0x408bb1[_0x714b('0xe')]||!_0x408bb1['language']||!_0x408bb1['bucket']){throw new db['Sequelize']['ValidationError'](_0x714b('0x42'));}return db[_0x714b('0x36')][_0x714b('0x28')]({'where':{'id':_0x408bb1[_0x714b('0x41')]}});})[_0x714b('0xf')](function(_0x4f6f79){if(!_0x4f6f79){throw new db['Sequelize'][(_0x714b('0x1f'))](_0x714b('0x29'));}if(!_0x4f6f79[_0x714b('0xc')]||!_0x4f6f79['data2']){throw new db[(_0x714b('0x1e'))][(_0x714b('0x1f'))](_0x714b('0x2a'));}_0x3ea939=_0x4f6f79;var _0x306a0d=[];_0xa08b62[_0x714b('0x43')](function(_0x39803b){_0x306a0d['push'](checkTranscribeJob(_0x39803b,_0x408bb1,_0x3ea939));});return BPromise[_0x714b('0x44')](_0x306a0d);})[_0x714b('0x38')](function(_0x24b849){if(_0x24b849){if(!_0x24b849['name']||_0x24b849[_0x714b('0x39')]!=='SequelizeValidationError'){logger[_0x714b('0x3b')](util[_0x714b('0x3c')](_0x24b849,{'showHidden':![],'depth':null}));}}});}exports[_0x714b('0x45')]=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 90e2708..88895aa 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 _0xeb94=['subtract','hours','then','length','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','defaults','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt'];(function(_0x3dab96,_0x9ad0af){var _0x377a20=function(_0x30495b){while(--_0x30495b){_0x3dab96['push'](_0x3dab96['shift']());}};_0x377a20(++_0x9ad0af);}(_0xeb94,0x1d2));var _0x4eb9=function(_0x1fb038,_0xc3f69b){_0x1fb038=_0x1fb038-0x0;var _0x1600dc=_0xeb94[_0x1fb038];return _0x1600dc;};'use strict';var _=require('lodash');var moment=require(_0x4eb9('0x0'));var Redis=require(_0x4eb9('0x1'));var util=require(_0x4eb9('0x2'));var config=require(_0x4eb9('0x3'));var db=require(_0x4eb9('0x4'))['db'];var logger=require(_0x4eb9('0x5'))(_0x4eb9('0x6'));config['redis']=_[_0x4eb9('0x7')](config[_0x4eb9('0x8')],{'host':_0x4eb9('0x9'),'port':0x18eb});var io=require(_0x4eb9('0xa'))(new Redis(config[_0x4eb9('0x8')]));function closeInteractions(){var _0x19733f=[];return db[_0x4eb9('0xb')][_0x4eb9('0xc')]({'raw':!![],'attributes':['id',_0x4eb9('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x4eb9('0xe')](0x18,_0x4eb9('0xf'))}}})[_0x4eb9('0x10')](function(_0x5faddc){if(_0x5faddc&&_0x5faddc[_0x4eb9('0x11')]){_0x19733f=_['map'](_0x5faddc||[],'id');logger['info'](_0x4eb9('0x12'),_0x19733f[_0x4eb9('0x13')]());return db['WhatsappInteraction']['update']({'closeReason':_0x4eb9('0x14'),'disposition':_0x4eb9('0x15'),'closed':!![],'closedAt':moment()[_0x4eb9('0x16')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x19733f}});}})[_0x4eb9('0x10')](function(){if(_0x19733f&&_0x19733f['length']){logger['info'](_0x4eb9('0x17'),_0x19733f['join']());for(var _0x32791b=0x0;_0x32791b<_0x19733f[_0x4eb9('0x11')];_0x32791b++){io[_0x4eb9('0x18')](_0x4eb9('0x19'),{'id':_0x19733f[_0x32791b],'closed':!![]});}}})[_0x4eb9('0x1a')](function(_0x10ac5a){logger['error'](_0x4eb9('0x1b'),_0x10ac5a?util[_0x4eb9('0x1c')](_0x10ac5a,{'showHidden':![],'depth':null}):'');});}exports[_0x4eb9('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x1e33=['WhatsappInteraction','findAll','lastMsgAt','hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','defaults','redis','localhost'];(function(_0x18060f,_0x4b3a41){var _0x573420=function(_0x2af66f){while(--_0x2af66f){_0x18060f['push'](_0x18060f['shift']());}};_0x573420(++_0x4b3a41);}(_0x1e33,0x8c));var _0x31e3=function(_0x4b21ee,_0x1778d5){_0x4b21ee=_0x4b21ee-0x0;var _0x7009dc=_0x1e33[_0x4b21ee];return _0x7009dc;};'use strict';var _=require('lodash');var moment=require(_0x31e3('0x0'));var Redis=require(_0x31e3('0x1'));var util=require(_0x31e3('0x2'));var config=require(_0x31e3('0x3'));var db=require(_0x31e3('0x4'))['db'];var logger=require(_0x31e3('0x5'))(_0x31e3('0x6'));config['redis']=_[_0x31e3('0x7')](config[_0x31e3('0x8')],{'host':_0x31e3('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x23a835=[];return db[_0x31e3('0xa')][_0x31e3('0xb')]({'raw':!![],'attributes':['id',_0x31e3('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x31e3('0xd'))}}})['then'](function(_0x87c47a){if(_0x87c47a&&_0x87c47a[_0x31e3('0xe')]){_0x23a835=_[_0x31e3('0xf')](_0x87c47a||[],'id');logger[_0x31e3('0x10')](_0x31e3('0x11'),_0x23a835[_0x31e3('0x12')]());return db[_0x31e3('0xa')][_0x31e3('0x13')]({'closeReason':_0x31e3('0x14'),'disposition':_0x31e3('0x15'),'closed':!![],'closedAt':moment()['format'](_0x31e3('0x16'))},{'where':{'id':_0x23a835}});}})[_0x31e3('0x17')](function(){if(_0x23a835&&_0x23a835[_0x31e3('0xe')]){logger[_0x31e3('0x10')](_0x31e3('0x18'),_0x23a835[_0x31e3('0x12')]());for(var _0x436473=0x0;_0x436473<_0x23a835[_0x31e3('0xe')];_0x436473++){io[_0x31e3('0x19')](_0x31e3('0x1a'),{'id':_0x23a835[_0x436473],'closed':!![]});}}})[_0x31e3('0x1b')](function(_0x256ce6){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x256ce6?util[_0x31e3('0x1c')](_0x256ce6,{'showHidden':![],'depth':null}):'');});}exports[_0x31e3('0x1d')]=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 8dca61c..0897599 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x141a=['bulkCreate','finished\x20populating','contacts1','CmHopper','log','CmContact','contacts2','hopper2','catch','util','../mysqldb','push','Biondo','@xcally.com','now','Innocenzo','innocenzo.biondo','destroy','then'];(function(_0x348cad,_0x1c87ef){var _0x4bae05=function(_0x273701){while(--_0x273701){_0x348cad['push'](_0x348cad['shift']());}};_0x4bae05(++_0x1c87ef);}(_0x141a,0x139));var _0xa141=function(_0x10be57,_0x558897){_0x10be57=_0x10be57-0x0;var _0x486cc3=_0x141a[_0x10be57];return _0x486cc3;};'use strict';var util=require(_0xa141('0x0'));var db=require(_0xa141('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xa141('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xa141('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xa141('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xa141('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xa141('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xa141('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xa141('0x2')]({'id':i,'firstName':_0xa141('0x6')+i,'lastName':_0xa141('0x3')+i,'phone':0xf879fb460+i,'email':_0xa141('0x7')+i+_0xa141('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xa141('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xa141('0x5')]()});}db['CmContact'][_0xa141('0x8')]({'where':{}})[_0xa141('0x9')](function(){return db['CmContact'][_0xa141('0xa')](contacts);})[_0xa141('0x9')](function(){console['log'](_0xa141('0xb'),_0xa141('0xc'));return db[_0xa141('0xd')]['destroy']({'where':{}});})['then'](function(){return db[_0xa141('0xd')]['bulkCreate'](hopper);})[_0xa141('0x9')](function(){console[_0xa141('0xe')]('finished\x20populating','hopper1');return db[_0xa141('0xf')][_0xa141('0xa')](contacts2);})['then'](function(){console[_0xa141('0xe')](_0xa141('0xb'),_0xa141('0x10'));return db[_0xa141('0xd')][_0xa141('0xa')](hopper2);})[_0xa141('0x9')](function(){console[_0xa141('0xe')](_0xa141('0xb'),_0xa141('0x11'));})[_0xa141('0x12')](function(_0x58f8f4){console[_0xa141('0xe')](_0x58f8f4);}); \ No newline at end of file +var _0x8e64=['finished\x20populating','CmHopper','log','contacts2','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8e64,0x194));var _0x48e6=function(_0x2c1f10,_0x5aca5f){_0x2c1f10=_0x2c1f10-0x0;var _0x17a226=_0x8e64[_0x2c1f10];return _0x17a226;};'use strict';var util=require(_0x48e6('0x0'));var db=require(_0x48e6('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x48e6('0x2')]({'id':i,'firstName':_0x48e6('0x3')+i,'lastName':_0x48e6('0x4')+i,'phone':0xf879fb460+i,'email':_0x48e6('0x5')+i+_0x48e6('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x48e6('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x48e6('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x48e6('0x7')](),'updatedAt':Date[_0x48e6('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x48e6('0x2')]({'id':i,'firstName':_0x48e6('0x3')+i,'lastName':_0x48e6('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x48e6('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x48e6('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x48e6('0x7')](),'updatedAt':Date['now']()});}db[_0x48e6('0x8')][_0x48e6('0x9')]({'where':{}})[_0x48e6('0xa')](function(){return db[_0x48e6('0x8')][_0x48e6('0xb')](contacts);})[_0x48e6('0xa')](function(){console['log'](_0x48e6('0xc'),'contacts1');return db[_0x48e6('0xd')]['destroy']({'where':{}});})[_0x48e6('0xa')](function(){return db[_0x48e6('0xd')][_0x48e6('0xb')](hopper);})[_0x48e6('0xa')](function(){console[_0x48e6('0xe')](_0x48e6('0xc'),'hopper1');return db[_0x48e6('0x8')][_0x48e6('0xb')](contacts2);})[_0x48e6('0xa')](function(){console[_0x48e6('0xe')](_0x48e6('0xc'),_0x48e6('0xf'));return db[_0x48e6('0xd')]['bulkCreate'](hopper2);})[_0x48e6('0xa')](function(){console['log'](_0x48e6('0xc'),'hopper2');})['catch'](function(_0x1ad892){console[_0x48e6('0xe')](_0x1ad892);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 2882352..c8f110b 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6e8f=['add\x20user','catch','util','../mysqldb','format','%s%s@xcally.com','agent','password','udp','wss','all','ulaw','%s%s','yes','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','log'];(function(_0x243e35,_0x322aa8){var _0x58ea2d=function(_0x488bee){while(--_0x488bee){_0x243e35['push'](_0x243e35['shift']());}};_0x58ea2d(++_0x322aa8);}(_0x6e8f,0x7a));var _0xf6e8=function(_0x1789ed,_0x570335){_0x1789ed=_0x1789ed-0x0;var _0x26c340=_0x6e8f[_0x1789ed];return _0x26c340;};'use strict';var util=require(_0xf6e8('0x0'));var db=require(_0xf6e8('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xf6e8('0x2')]('%s%s','agent',i),'fullname':util[_0xf6e8('0x2')]('%s%s','agent',i),'email':util[_0xf6e8('0x2')](_0xf6e8('0x3'),_0xf6e8('0x4'),i),'role':_0xf6e8('0x4'),'password':_0xf6e8('0x5'),'internal':0xfa0+i,'type':'friend','transport':[_0xf6e8('0x6'),'ws',_0xf6e8('0x7')],'disallow':[_0xf6e8('0x8')],'allow':[_0xf6e8('0x9')],'defaultuser':util[_0xf6e8('0x2')](_0xf6e8('0xa'),'agent',i),'encryption':_0xf6e8('0xb'),'avpf':_0xf6e8('0xb'),'force_avp':_0xf6e8('0xb'),'icesupport':'yes','dtlsenable':_0xf6e8('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xf6e8('0xc'),'dtlssetup':_0xf6e8('0xd'),'callerid':util[_0xf6e8('0x2')]('\x22%s\x22\x20<%s>',util[_0xf6e8('0x2')](_0xf6e8('0xa'),'agent',i),0xfa0+i)});}db[_0xf6e8('0xe')][_0xf6e8('0xf')](users)[_0xf6e8('0x10')](function(){console[_0xf6e8('0x11')](_0xf6e8('0x12'));})[_0xf6e8('0x13')](function(_0x102368){console['log'](_0x102368);}); \ No newline at end of file +var _0xbfc4=['yes','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','format','%s%s','agent','password','friend','all','ulaw'];(function(_0x567194,_0x25fa5a){var _0x537f00=function(_0x50ef1d){while(--_0x50ef1d){_0x567194['push'](_0x567194['shift']());}};_0x537f00(++_0x25fa5a);}(_0xbfc4,0xf3));var _0x4bfc=function(_0x543149,_0x32a57b){_0x543149=_0x543149-0x0;var _0x3cd14b=_0xbfc4[_0x543149];return _0x3cd14b;};'use strict';var util=require(_0x4bfc('0x0'));var db=require(_0x4bfc('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x4bfc('0x2')](_0x4bfc('0x3'),_0x4bfc('0x4'),i),'fullname':util['format']('%s%s','agent',i),'email':util[_0x4bfc('0x2')]('%s%s@xcally.com',_0x4bfc('0x4'),i),'role':_0x4bfc('0x4'),'password':_0x4bfc('0x5'),'internal':0xfa0+i,'type':_0x4bfc('0x6'),'transport':['udp','ws','wss'],'disallow':[_0x4bfc('0x7')],'allow':[_0x4bfc('0x8')],'defaultuser':util[_0x4bfc('0x2')](_0x4bfc('0x3'),_0x4bfc('0x4'),i),'encryption':_0x4bfc('0x9'),'avpf':'yes','force_avp':_0x4bfc('0x9'),'icesupport':_0x4bfc('0x9'),'dtlsenable':_0x4bfc('0x9'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x4bfc('0xa'),'dtlssetup':'actpass','callerid':util[_0x4bfc('0x2')](_0x4bfc('0xb'),util[_0x4bfc('0x2')](_0x4bfc('0x3'),_0x4bfc('0x4'),i),0xfa0+i)});}db[_0x4bfc('0xc')][_0x4bfc('0xd')](users)[_0x4bfc('0xe')](function(){console[_0x4bfc('0xf')](_0x4bfc('0x10'));})[_0x4bfc('0x11')](function(_0x522115){console[_0x4bfc('0xf')](_0x522115);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 3078f3b..8830a5b 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6fc2=['./environment','name','role','agent','telephone','type','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','User','Campaign','where','ivr','Agents','format','user:%s','handshake','find','userProfileId','query','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:inbound','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','sms','mail','openchannel','trunk:%s','leave','removeChatInteractions','emit','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','log','connection','address','request','remotePort','connectedAt','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird'];(function(_0x4291ae,_0x32c6b4){var _0x8e8364=function(_0x45171d){while(--_0x45171d){_0x4291ae['push'](_0x4291ae['shift']());}};_0x8e8364(++_0x32c6b4);}(_0x6fc2,0x117));var _0x26fc=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x6fc2[_0x411017];return _0x2adeea;};'use strict';var _=require(_0x26fc('0x0'));var util=require(_0x26fc('0x1'));var BPromise=require(_0x26fc('0x2'));var db=require('../mysqldb')['db'];var config=require(_0x26fc('0x3'));var queryQueues={'attributes':['id',_0x26fc('0x4')],'include':[{'as':'Agents','model':db['User'],'attributes':['id','name',_0x26fc('0x5')],'raw':!![],'where':{'role':_0x26fc('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x26fc('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x26fc('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x26fc('0x4')],'where':{'role':_0x26fc('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x26fc('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0x5a452d,_0x1d9522,_0x2ea728){return db[_0x26fc('0x9')]['findOne']({'where':{'name':_0x5a452d,'userProfileId':_0x1d9522},'raw':!![]})[_0x26fc('0xa')](function(_0xe22d78){if(_0xe22d78){if(_0xe22d78[_0x26fc('0xb')]){switch(_0x5a452d){case _0x26fc('0xc'):case _0x26fc('0xd'):case _0x26fc('0xe'):case _0x26fc('0xf'):case _0x26fc('0x10'):case _0x26fc('0x11'):case _0x26fc('0x12'):return db[_0x2ea728][_0x26fc('0x13')](queryQueues);case _0x26fc('0x14'):return db[_0x2ea728][_0x26fc('0x13')](queryTelephones);case _0x26fc('0x15'):return db[_0x2ea728][_0x26fc('0x13')](queryTrunks);case _0x26fc('0x16'):return db[_0x2ea728]['findAll'](queryCampaigns);}}else{return db[_0x26fc('0x17')][_0x26fc('0x13')]({'attributes':[_0x26fc('0x18')],'where':{'sectionId':_0xe22d78['id']},'raw':!![]})[_0x26fc('0xa')](function(_0x41d50a){if(_0x41d50a){var _0x29afb9={'where':{'id':_[_0x26fc('0x19')](_0x41d50a,_0x26fc('0x18'))},'raw':!![]};switch(_0x2ea728){case _0x26fc('0x1a'):_0x29afb9['where'][_0x26fc('0x5')]='telephone';break;case _0x26fc('0x1b'):_0x29afb9[_0x26fc('0x1c')][_0x26fc('0x8')]=_0x26fc('0x1d');break;}return db[_0x2ea728]['findAll'](_0x29afb9);}else{return[];}});}}else{return[];}})[_0x26fc('0xa')](function(_0x2d7e32){return _0x2d7e32;});}function joinOrLeaveQueues(_0x1c00ae,_0x9a9c2,_0xa0ca4f,_0x5f454f){_0x1c00ae[_0x9a9c2](util['format']('%s:queue:%s',_0xa0ca4f,_0x5f454f['name']));if(_0x5f454f['Agents']){for(var _0x4fa549=0x0;_0x4fa549<_0x5f454f[_0x26fc('0x1e')]['length'];_0x4fa549+=0x1){_0x1c00ae[_0x9a9c2](util[_0x26fc('0x1f')](_0x26fc('0x20'),_0x5f454f['Agents'][_0x4fa549][_0x26fc('0x4')]));}}}function joinOrLeave(_0x288c8d,_0x12a7ca,_0x1641f2){var _0x2738ee;if(_0x288c8d[_0x26fc('0x21')]['query']['id']){db[_0x26fc('0x1a')][_0x26fc('0x22')]({'attributes':['id',_0x26fc('0x4'),_0x26fc('0x5'),_0x26fc('0x23')],'where':{'id':_0x288c8d[_0x26fc('0x21')][_0x26fc('0x24')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x26fc('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x26fc('0x26')],'as':_0x26fc('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x26fc('0x28')],'as':_0x26fc('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x26fc('0x2a')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x26fc('0x2b')],'as':_0x26fc('0x2c'),'attributes':['id'],'raw':!![]},{'model':db[_0x26fc('0x2d')],'as':_0x26fc('0x2e'),'attributes':['id'],'raw':!![]}]})[_0x26fc('0xa')](function(_0x14ecff){if(_0x14ecff){_0x2738ee=_0x14ecff;_0x288c8d[_0x12a7ca](util[_0x26fc('0x1f')](_0x26fc('0x20'),_0x14ecff['name']));var _0x5457f5=[];switch(_0x14ecff['role']){case _0x26fc('0x2f'):_0x288c8d[_0x12a7ca]('voice:inbound');_0x288c8d[_0x12a7ca]('voice:outbound');if(queryQueues[_0x26fc('0x30')](_0x26fc('0x31'))){delete queryQueues[_0x26fc('0x31')];}_0x5457f5[_0x26fc('0x32')](db[_0x26fc('0x33')][_0x26fc('0x13')](queryQueues));_0x5457f5[_0x26fc('0x32')](db[_0x26fc('0x34')][_0x26fc('0x13')](queryQueues));_0x5457f5[_0x26fc('0x32')](db['FaxQueue'][_0x26fc('0x13')](queryQueues));_0x5457f5[_0x26fc('0x32')](db[_0x26fc('0x35')][_0x26fc('0x13')](queryQueues));_0x5457f5[_0x26fc('0x32')](db[_0x26fc('0x36')][_0x26fc('0x13')](queryQueues));_0x5457f5['push'](db[_0x26fc('0x37')]['findAll'](queryQueues));_0x5457f5[_0x26fc('0x32')](db[_0x26fc('0x38')][_0x26fc('0x13')](queryQueues));_0x5457f5[_0x26fc('0x32')](db[_0x26fc('0x1a')]['findAll'](queryTelephones));_0x5457f5[_0x26fc('0x32')](db[_0x26fc('0x39')]['findAll'](queryTrunks));_0x5457f5[_0x26fc('0x32')](db['Campaign'][_0x26fc('0x13')](queryCampaigns));_0x5457f5[_0x26fc('0x32')](db[_0x26fc('0x1a')][_0x26fc('0x13')](queryAgents));break;case _0x26fc('0x3a'):_0x288c8d[_0x12a7ca](_0x26fc('0x3b'));_0x288c8d[_0x12a7ca]('voice:outbound');_0x5457f5['push'](getAssociatedResources(_0x26fc('0xc'),_0x14ecff[_0x26fc('0x23')],_0x26fc('0x33')));_0x5457f5[_0x26fc('0x32')](getAssociatedResources('ChatQueues',_0x14ecff[_0x26fc('0x23')],_0x26fc('0x34')));_0x5457f5['push'](getAssociatedResources(_0x26fc('0xe'),_0x14ecff[_0x26fc('0x23')],'FaxQueue'));_0x5457f5[_0x26fc('0x32')](getAssociatedResources(_0x26fc('0xf'),_0x14ecff[_0x26fc('0x23')],'SmsQueue'));_0x5457f5[_0x26fc('0x32')](getAssociatedResources(_0x26fc('0x10'),_0x14ecff['userProfileId'],_0x26fc('0x36')));_0x5457f5['push'](getAssociatedResources(_0x26fc('0x11'),_0x14ecff[_0x26fc('0x23')],_0x26fc('0x37')));_0x5457f5[_0x26fc('0x32')](getAssociatedResources(_0x26fc('0x12'),_0x14ecff[_0x26fc('0x23')],_0x26fc('0x38')));_0x5457f5[_0x26fc('0x32')](getAssociatedResources(_0x26fc('0x14'),_0x14ecff[_0x26fc('0x23')],_0x26fc('0x1a')));_0x5457f5[_0x26fc('0x32')](getAssociatedResources('Trunks',_0x14ecff[_0x26fc('0x23')],_0x26fc('0x39')));_0x5457f5[_0x26fc('0x32')](getAssociatedResources(_0x26fc('0x16'),_0x14ecff[_0x26fc('0x23')],_0x26fc('0x1b')));_0x5457f5[_0x26fc('0x32')](db['User']['findAll'](queryAgents));break;case _0x26fc('0x6'):_0x288c8d[_0x12a7ca](_0x26fc('0x3b'));_0x288c8d[_0x12a7ca]('voice:outbound');_0x5457f5[_0x26fc('0x32')](_0x14ecff[_0x26fc('0x3c')]({'attributes':['id',_0x26fc('0x4')]}));_0x5457f5['push'](_0x14ecff[_0x26fc('0x3d')]({'attributes':['id',_0x26fc('0x4')]}));_0x5457f5[_0x26fc('0x32')](_0x14ecff[_0x26fc('0x3e')]({'attributes':['id',_0x26fc('0x4')]}));_0x5457f5[_0x26fc('0x32')](_0x14ecff[_0x26fc('0x3f')]({'attributes':['id',_0x26fc('0x4')]}));_0x5457f5[_0x26fc('0x32')](_0x14ecff[_0x26fc('0x40')]({'attributes':['id',_0x26fc('0x4')]}));_0x5457f5['push'](_0x14ecff[_0x26fc('0x41')]({'attributes':['id',_0x26fc('0x4')]}));_0x5457f5['push'](_0x14ecff[_0x26fc('0x42')]({'attributes':['id',_0x26fc('0x4')]}));break;}return BPromise[_0x26fc('0x43')](_0x5457f5);}})['then'](function(_0x27f00e){if(_0x27f00e&&_0x27f00e[_0x26fc('0x44')]){for(var _0x202412=0x0;_0x202412<_0x27f00e[_0x26fc('0x44')];_0x202412+=0x1){for(var _0x182bb6=0x0;_0x182bb6<_0x27f00e[_0x202412]['length'];_0x182bb6+=0x1){switch(_0x202412){case 0x0:joinOrLeaveQueues(_0x288c8d,_0x12a7ca,_0x26fc('0x45'),_0x27f00e[_0x202412][_0x182bb6]);break;case 0x1:joinOrLeaveQueues(_0x288c8d,_0x12a7ca,_0x26fc('0x46'),_0x27f00e[_0x202412][_0x182bb6]);break;case 0x2:joinOrLeaveQueues(_0x288c8d,_0x12a7ca,'fax',_0x27f00e[_0x202412][_0x182bb6]);break;case 0x3:joinOrLeaveQueues(_0x288c8d,_0x12a7ca,_0x26fc('0x47'),_0x27f00e[_0x202412][_0x182bb6]);break;case 0x4:joinOrLeaveQueues(_0x288c8d,_0x12a7ca,_0x26fc('0x48'),_0x27f00e[_0x202412][_0x182bb6]);break;case 0x5:joinOrLeaveQueues(_0x288c8d,_0x12a7ca,_0x26fc('0x49'),_0x27f00e[_0x202412][_0x182bb6]);break;case 0x6:joinOrLeaveQueues(_0x288c8d,_0x12a7ca,'whatsapp',_0x27f00e[_0x202412][_0x182bb6]);break;case 0x7:if(_0x2738ee[_0x26fc('0x5')]!==_0x26fc('0x6'))_0x288c8d[_0x12a7ca](util[_0x26fc('0x1f')]('telephone:%s',_0x27f00e[_0x202412][_0x182bb6]['name']));break;case 0x8:if(_0x2738ee[_0x26fc('0x5')]!==_0x26fc('0x6'))_0x288c8d[_0x12a7ca](util[_0x26fc('0x1f')](_0x26fc('0x4a'),_0x27f00e[_0x202412][_0x182bb6][_0x26fc('0x4')]));break;case 0x9:if(_0x2738ee['role']!=='agent')_0x288c8d[_0x12a7ca](util[_0x26fc('0x1f')]('campaign:%s:%s',_0x27f00e[_0x202412][_0x182bb6]['type'],_0x27f00e[_0x202412][_0x182bb6][_0x26fc('0x4')]));break;case 0xa:_0x288c8d[_0x12a7ca](util[_0x26fc('0x1f')](_0x26fc('0x20'),_0x27f00e[_0x202412][_0x182bb6][_0x26fc('0x4')]));break;}}}}})[_0x26fc('0xa')](function(){if(_0x12a7ca===_0x26fc('0x4b')){var _0x6c753=_[_0x26fc('0x19')](_0x2738ee[_0x26fc('0x25')],'id');return _0x2738ee[_0x26fc('0x4c')](_0x6c753)['then'](function(){for(var _0x7e6b58=0x0;_0x7e6b58<_0x6c753[_0x26fc('0x44')];_0x7e6b58+=0x1){_0x1641f2[_0x26fc('0x4d')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x6c753[_0x7e6b58]),'UserId':Number(_0x2738ee['id'])});}});}})[_0x26fc('0xa')](function(){if(_0x12a7ca==='leave'){var _0x5ddde5=_[_0x26fc('0x19')](_0x2738ee['MailInteractions'],'id');return _0x2738ee['removeMailInteractions'](_0x5ddde5)[_0x26fc('0xa')](function(){for(var _0x4fc2e6=0x0;_0x4fc2e6<_0x5ddde5[_0x26fc('0x44')];_0x4fc2e6+=0x1){_0x1641f2[_0x26fc('0x4d')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x5ddde5[_0x4fc2e6]),'UserId':Number(_0x2738ee['id'])});}});}})[_0x26fc('0xa')](function(){if(_0x12a7ca===_0x26fc('0x4b')){var _0x2d4b54=_[_0x26fc('0x19')](_0x2738ee[_0x26fc('0x29')],'id');return _0x2738ee[_0x26fc('0x4e')](_0x2d4b54)['then'](function(){for(var _0x33427c=0x0;_0x33427c<_0x2d4b54['length'];_0x33427c+=0x1){_0x1641f2[_0x26fc('0x4d')](_0x26fc('0x4f'),{'FaxInteractionId':Number(_0x2d4b54[_0x33427c]),'UserId':Number(_0x2738ee['id'])});}});}})[_0x26fc('0xa')](function(){if(_0x12a7ca===_0x26fc('0x4b')){var _0x3db60c=_[_0x26fc('0x19')](_0x2738ee[_0x26fc('0x50')],'id');return _0x2738ee['removeSmsInteractions'](_0x3db60c)[_0x26fc('0xa')](function(){for(var _0x32eff8=0x0;_0x32eff8<_0x3db60c[_0x26fc('0x44')];_0x32eff8+=0x1){_0x1641f2[_0x26fc('0x4d')](_0x26fc('0x51'),{'SmsInteractionId':Number(_0x3db60c[_0x32eff8]),'UserId':Number(_0x2738ee['id'])});}});}})[_0x26fc('0xa')](function(){if(_0x12a7ca==='leave'){var _0x2a4a74=_[_0x26fc('0x19')](_0x2738ee[_0x26fc('0x2c')],'id');return _0x2738ee['removeOpenchannelInteractions'](_0x2a4a74)[_0x26fc('0xa')](function(){for(var _0x213d56=0x0;_0x213d56<_0x2a4a74['length'];_0x213d56+=0x1){_0x1641f2[_0x26fc('0x4d')](_0x26fc('0x52'),{'OpenchannelInteractionId':Number(_0x2a4a74[_0x213d56]),'UserId':Number(_0x2738ee['id'])});}});}})[_0x26fc('0xa')](function(){if(_0x12a7ca===_0x26fc('0x4b')){var _0x1773f0=_[_0x26fc('0x19')](_0x2738ee[_0x26fc('0x2e')],'id');return _0x2738ee['removeWhatsappInteractions'](_0x1773f0)[_0x26fc('0xa')](function(){for(var _0x506b4e=0x0;_0x506b4e<_0x1773f0[_0x26fc('0x44')];_0x506b4e+=0x1){_0x1641f2['emit'](_0x26fc('0x53'),{'WhatsappInteractionId':Number(_0x1773f0[_0x506b4e]),'UserId':Number(_0x2738ee['id'])});}});}})['catch'](function(_0x14e4b7){_0x288c8d[_0x26fc('0x54')](_0x14e4b7);});}}function onDisconnect(_0x49f685,_0x34e013){joinOrLeave(_0x49f685,_0x26fc('0x4b'),_0x34e013);}function onConnect(_0xd06ed7){joinOrLeave(_0xd06ed7,'join');}exports['default']=function(_0x4b2c1d){_0x4b2c1d['on'](_0x26fc('0x55'),function(_0x5f5672){_0x5f5672['setMaxListeners'](0x0);_0x5f5672[_0x26fc('0x56')]=_0x5f5672[_0x26fc('0x57')]['connection']['remoteAddress']+':'+_0x5f5672[_0x26fc('0x57')][_0x26fc('0x55')][_0x26fc('0x58')];_0x5f5672[_0x26fc('0x59')]=new Date();_0x5f5672['log']=function(_0x313cea){console['log'](_0x26fc('0x5a')+_0x5f5672['nsp']['name']+'['+_0x5f5672[_0x26fc('0x56')]+']',_0x313cea);};_0x5f5672['on'](_0x26fc('0x5b'),function(){onDisconnect(_0x5f5672,_0x4b2c1d);_0x5f5672[_0x26fc('0x54')](_0x26fc('0x5c'));});onConnect(_0x5f5672);_0x5f5672['log'](_0x26fc('0x5d'));});}; \ No newline at end of file +var _0x3e99=['disconnect','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','role','telephone','agent','type','ivr','UserProfileSection','findOne','then','VoiceQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','User','format','%s:queue:%s','Agents','length','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','ChatQueues','Telephones','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','chat','mail','openchannel','whatsapp','campaign:%s:%s','leave','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp'];(function(_0xfa7cff,_0x42139f){var _0x35c707=function(_0x5aefd6){while(--_0x5aefd6){_0xfa7cff['push'](_0xfa7cff['shift']());}};_0x35c707(++_0x42139f);}(_0x3e99,0x122));var _0x93e9=function(_0x2c1bee,_0x131ecc){_0x2c1bee=_0x2c1bee-0x0;var _0x4925aa=_0x3e99[_0x2c1bee];return _0x4925aa;};'use strict';var _=require(_0x93e9('0x0'));var util=require(_0x93e9('0x1'));var BPromise=require(_0x93e9('0x2'));var db=require(_0x93e9('0x3'))['db'];var config=require(_0x93e9('0x4'));var queryQueues={'attributes':['id',_0x93e9('0x5')],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0x93e9('0x5'),_0x93e9('0x6')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x93e9('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x93e9('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x93e9('0x5')],'where':{'role':_0x93e9('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x93e9('0x5'),_0x93e9('0x9')],'where':{'type':_0x93e9('0xa')}};function getAssociatedResources(_0x5e21f4,_0x536ab8,_0x51cf48){return db[_0x93e9('0xb')][_0x93e9('0xc')]({'where':{'name':_0x5e21f4,'userProfileId':_0x536ab8},'raw':!![]})[_0x93e9('0xd')](function(_0x481293){if(_0x481293){if(_0x481293['autoAssociation']){switch(_0x5e21f4){case _0x93e9('0xe'):case'ChatQueues':case _0x93e9('0xf'):case _0x93e9('0x10'):case _0x93e9('0x11'):case _0x93e9('0x12'):case _0x93e9('0x13'):return db[_0x51cf48][_0x93e9('0x14')](queryQueues);case'Telephones':return db[_0x51cf48]['findAll'](queryTelephones);case _0x93e9('0x15'):return db[_0x51cf48][_0x93e9('0x14')](queryTrunks);case _0x93e9('0x16'):return db[_0x51cf48][_0x93e9('0x14')](queryCampaigns);}}else{return db[_0x93e9('0x17')][_0x93e9('0x14')]({'attributes':[_0x93e9('0x18')],'where':{'sectionId':_0x481293['id']},'raw':!![]})[_0x93e9('0xd')](function(_0x2b05a4){if(_0x2b05a4){var _0x37f94c={'where':{'id':_[_0x93e9('0x19')](_0x2b05a4,'resourceId')},'raw':!![]};switch(_0x51cf48){case _0x93e9('0x1a'):_0x37f94c['where'][_0x93e9('0x6')]=_0x93e9('0x7');break;case'Campaign':_0x37f94c['where'][_0x93e9('0x9')]=_0x93e9('0xa');break;}return db[_0x51cf48]['findAll'](_0x37f94c);}else{return[];}});}}else{return[];}})[_0x93e9('0xd')](function(_0x4dd21e){return _0x4dd21e;});}function joinOrLeaveQueues(_0x85bc53,_0x556347,_0x24dd0f,_0x556caa){_0x85bc53[_0x556347](util[_0x93e9('0x1b')](_0x93e9('0x1c'),_0x24dd0f,_0x556caa[_0x93e9('0x5')]));if(_0x556caa['Agents']){for(var _0x2066fc=0x0;_0x2066fc<_0x556caa[_0x93e9('0x1d')][_0x93e9('0x1e')];_0x2066fc+=0x1){_0x85bc53[_0x556347](util[_0x93e9('0x1b')](_0x93e9('0x1f'),_0x556caa['Agents'][_0x2066fc]['name']));}}}function joinOrLeave(_0x2fb72a,_0x1a1867,_0x18144e){var _0x2a5e07;if(_0x2fb72a[_0x93e9('0x20')][_0x93e9('0x21')]['id']){db[_0x93e9('0x1a')]['find']({'attributes':['id',_0x93e9('0x5'),_0x93e9('0x6'),_0x93e9('0x22')],'where':{'id':_0x2fb72a[_0x93e9('0x20')][_0x93e9('0x21')]['id']},'include':[{'model':db[_0x93e9('0x23')],'as':_0x93e9('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x93e9('0x25')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x93e9('0x26')],'as':_0x93e9('0x27'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x93e9('0x28'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x93e9('0x29')],'as':_0x93e9('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x93e9('0xd')](function(_0x20405d){if(_0x20405d){_0x2a5e07=_0x20405d;_0x2fb72a[_0x1a1867](util['format'](_0x93e9('0x1f'),_0x20405d['name']));var _0x40d01c=[];switch(_0x20405d[_0x93e9('0x6')]){case'admin':_0x2fb72a[_0x1a1867](_0x93e9('0x2b'));_0x2fb72a[_0x1a1867](_0x93e9('0x2c'));if(queryQueues[_0x93e9('0x2d')](_0x93e9('0x2e'))){delete queryQueues[_0x93e9('0x2e')];}_0x40d01c[_0x93e9('0x2f')](db[_0x93e9('0x30')]['findAll'](queryQueues));_0x40d01c[_0x93e9('0x2f')](db[_0x93e9('0x31')][_0x93e9('0x14')](queryQueues));_0x40d01c[_0x93e9('0x2f')](db[_0x93e9('0x32')][_0x93e9('0x14')](queryQueues));_0x40d01c[_0x93e9('0x2f')](db[_0x93e9('0x33')][_0x93e9('0x14')](queryQueues));_0x40d01c[_0x93e9('0x2f')](db[_0x93e9('0x34')][_0x93e9('0x14')](queryQueues));_0x40d01c[_0x93e9('0x2f')](db[_0x93e9('0x35')][_0x93e9('0x14')](queryQueues));_0x40d01c[_0x93e9('0x2f')](db[_0x93e9('0x36')][_0x93e9('0x14')](queryQueues));_0x40d01c[_0x93e9('0x2f')](db[_0x93e9('0x1a')]['findAll'](queryTelephones));_0x40d01c[_0x93e9('0x2f')](db[_0x93e9('0x37')][_0x93e9('0x14')](queryTrunks));_0x40d01c[_0x93e9('0x2f')](db[_0x93e9('0x38')][_0x93e9('0x14')](queryCampaigns));_0x40d01c[_0x93e9('0x2f')](db[_0x93e9('0x1a')][_0x93e9('0x14')](queryAgents));break;case'user':_0x2fb72a[_0x1a1867]('voice:inbound');_0x2fb72a[_0x1a1867](_0x93e9('0x2c'));_0x40d01c['push'](getAssociatedResources('VoiceQueues',_0x20405d[_0x93e9('0x22')],_0x93e9('0x30')));_0x40d01c[_0x93e9('0x2f')](getAssociatedResources(_0x93e9('0x39'),_0x20405d[_0x93e9('0x22')],'ChatQueue'));_0x40d01c[_0x93e9('0x2f')](getAssociatedResources(_0x93e9('0xf'),_0x20405d[_0x93e9('0x22')],_0x93e9('0x32')));_0x40d01c[_0x93e9('0x2f')](getAssociatedResources(_0x93e9('0x10'),_0x20405d[_0x93e9('0x22')],_0x93e9('0x33')));_0x40d01c[_0x93e9('0x2f')](getAssociatedResources('MailQueues',_0x20405d['userProfileId'],_0x93e9('0x34')));_0x40d01c[_0x93e9('0x2f')](getAssociatedResources(_0x93e9('0x12'),_0x20405d[_0x93e9('0x22')],_0x93e9('0x35')));_0x40d01c[_0x93e9('0x2f')](getAssociatedResources('WhatsappQueues',_0x20405d[_0x93e9('0x22')],_0x93e9('0x36')));_0x40d01c[_0x93e9('0x2f')](getAssociatedResources(_0x93e9('0x3a'),_0x20405d['userProfileId'],_0x93e9('0x1a')));_0x40d01c[_0x93e9('0x2f')](getAssociatedResources(_0x93e9('0x15'),_0x20405d[_0x93e9('0x22')],_0x93e9('0x37')));_0x40d01c['push'](getAssociatedResources(_0x93e9('0x16'),_0x20405d[_0x93e9('0x22')],_0x93e9('0x38')));_0x40d01c[_0x93e9('0x2f')](db[_0x93e9('0x1a')][_0x93e9('0x14')](queryAgents));break;case _0x93e9('0x8'):_0x2fb72a[_0x1a1867](_0x93e9('0x2b'));_0x2fb72a[_0x1a1867](_0x93e9('0x2c'));_0x40d01c['push'](_0x20405d['getVoiceQueues']({'attributes':['id',_0x93e9('0x5')]}));_0x40d01c[_0x93e9('0x2f')](_0x20405d[_0x93e9('0x3b')]({'attributes':['id','name']}));_0x40d01c[_0x93e9('0x2f')](_0x20405d['getFaxQueues']({'attributes':['id',_0x93e9('0x5')]}));_0x40d01c['push'](_0x20405d[_0x93e9('0x3c')]({'attributes':['id','name']}));_0x40d01c[_0x93e9('0x2f')](_0x20405d[_0x93e9('0x3d')]({'attributes':['id','name']}));_0x40d01c['push'](_0x20405d[_0x93e9('0x3e')]({'attributes':['id',_0x93e9('0x5')]}));_0x40d01c[_0x93e9('0x2f')](_0x20405d[_0x93e9('0x3f')]({'attributes':['id',_0x93e9('0x5')]}));break;}return BPromise[_0x93e9('0x40')](_0x40d01c);}})[_0x93e9('0xd')](function(_0x487390){if(_0x487390&&_0x487390[_0x93e9('0x1e')]){for(var _0x2cab05=0x0;_0x2cab05<_0x487390['length'];_0x2cab05+=0x1){for(var _0x1be17e=0x0;_0x1be17e<_0x487390[_0x2cab05][_0x93e9('0x1e')];_0x1be17e+=0x1){switch(_0x2cab05){case 0x0:joinOrLeaveQueues(_0x2fb72a,_0x1a1867,'voice',_0x487390[_0x2cab05][_0x1be17e]);break;case 0x1:joinOrLeaveQueues(_0x2fb72a,_0x1a1867,_0x93e9('0x41'),_0x487390[_0x2cab05][_0x1be17e]);break;case 0x2:joinOrLeaveQueues(_0x2fb72a,_0x1a1867,'fax',_0x487390[_0x2cab05][_0x1be17e]);break;case 0x3:joinOrLeaveQueues(_0x2fb72a,_0x1a1867,'sms',_0x487390[_0x2cab05][_0x1be17e]);break;case 0x4:joinOrLeaveQueues(_0x2fb72a,_0x1a1867,_0x93e9('0x42'),_0x487390[_0x2cab05][_0x1be17e]);break;case 0x5:joinOrLeaveQueues(_0x2fb72a,_0x1a1867,_0x93e9('0x43'),_0x487390[_0x2cab05][_0x1be17e]);break;case 0x6:joinOrLeaveQueues(_0x2fb72a,_0x1a1867,_0x93e9('0x44'),_0x487390[_0x2cab05][_0x1be17e]);break;case 0x7:if(_0x2a5e07[_0x93e9('0x6')]!==_0x93e9('0x8'))_0x2fb72a[_0x1a1867](util[_0x93e9('0x1b')]('telephone:%s',_0x487390[_0x2cab05][_0x1be17e][_0x93e9('0x5')]));break;case 0x8:if(_0x2a5e07[_0x93e9('0x6')]!=='agent')_0x2fb72a[_0x1a1867](util[_0x93e9('0x1b')]('trunk:%s',_0x487390[_0x2cab05][_0x1be17e][_0x93e9('0x5')]));break;case 0x9:if(_0x2a5e07[_0x93e9('0x6')]!=='agent')_0x2fb72a[_0x1a1867](util[_0x93e9('0x1b')](_0x93e9('0x45'),_0x487390[_0x2cab05][_0x1be17e][_0x93e9('0x9')],_0x487390[_0x2cab05][_0x1be17e][_0x93e9('0x5')]));break;case 0xa:_0x2fb72a[_0x1a1867](util[_0x93e9('0x1b')](_0x93e9('0x1f'),_0x487390[_0x2cab05][_0x1be17e][_0x93e9('0x5')]));break;}}}}})[_0x93e9('0xd')](function(){if(_0x1a1867===_0x93e9('0x46')){var _0x190ba7=_[_0x93e9('0x19')](_0x2a5e07[_0x93e9('0x24')],'id');return _0x2a5e07['removeChatInteractions'](_0x190ba7)[_0x93e9('0xd')](function(){for(var _0x1ac13d=0x0;_0x1ac13d<_0x190ba7[_0x93e9('0x1e')];_0x1ac13d+=0x1){_0x18144e[_0x93e9('0x47')](_0x93e9('0x48'),{'ChatInteractionId':Number(_0x190ba7[_0x1ac13d]),'UserId':Number(_0x2a5e07['id'])});}});}})['then'](function(){if(_0x1a1867===_0x93e9('0x46')){var _0x1df573=_['map'](_0x2a5e07['MailInteractions'],'id');return _0x2a5e07['removeMailInteractions'](_0x1df573)['then'](function(){for(var _0x8fa259=0x0;_0x8fa259<_0x1df573[_0x93e9('0x1e')];_0x8fa259+=0x1){_0x18144e['emit'](_0x93e9('0x49'),{'MailInteractionId':Number(_0x1df573[_0x8fa259]),'UserId':Number(_0x2a5e07['id'])});}});}})['then'](function(){if(_0x1a1867==='leave'){var _0x39929d=_[_0x93e9('0x19')](_0x2a5e07[_0x93e9('0x27')],'id');return _0x2a5e07['removeFaxInteractions'](_0x39929d)[_0x93e9('0xd')](function(){for(var _0x3d65b2=0x0;_0x3d65b2<_0x39929d[_0x93e9('0x1e')];_0x3d65b2+=0x1){_0x18144e['emit'](_0x93e9('0x4a'),{'FaxInteractionId':Number(_0x39929d[_0x3d65b2]),'UserId':Number(_0x2a5e07['id'])});}});}})[_0x93e9('0xd')](function(){if(_0x1a1867===_0x93e9('0x46')){var _0x56529b=_[_0x93e9('0x19')](_0x2a5e07[_0x93e9('0x28')],'id');return _0x2a5e07[_0x93e9('0x4b')](_0x56529b)[_0x93e9('0xd')](function(){for(var _0x2cbed9=0x0;_0x2cbed9<_0x56529b[_0x93e9('0x1e')];_0x2cbed9+=0x1){_0x18144e['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x56529b[_0x2cbed9]),'UserId':Number(_0x2a5e07['id'])});}});}})['then'](function(){if(_0x1a1867===_0x93e9('0x46')){var _0x5aaa61=_[_0x93e9('0x19')](_0x2a5e07[_0x93e9('0x4c')],'id');return _0x2a5e07[_0x93e9('0x4d')](_0x5aaa61)[_0x93e9('0xd')](function(){for(var _0x79cd91=0x0;_0x79cd91<_0x5aaa61[_0x93e9('0x1e')];_0x79cd91+=0x1){_0x18144e['emit'](_0x93e9('0x4e'),{'OpenchannelInteractionId':Number(_0x5aaa61[_0x79cd91]),'UserId':Number(_0x2a5e07['id'])});}});}})[_0x93e9('0xd')](function(){if(_0x1a1867===_0x93e9('0x46')){var _0x9c89df=_[_0x93e9('0x19')](_0x2a5e07[_0x93e9('0x2a')],'id');return _0x2a5e07[_0x93e9('0x4f')](_0x9c89df)['then'](function(){for(var _0x19b235=0x0;_0x19b235<_0x9c89df[_0x93e9('0x1e')];_0x19b235+=0x1){_0x18144e['emit'](_0x93e9('0x50'),{'WhatsappInteractionId':Number(_0x9c89df[_0x19b235]),'UserId':Number(_0x2a5e07['id'])});}});}})[_0x93e9('0x51')](function(_0x2f31da){_0x2fb72a['log'](_0x2f31da);});}}function onDisconnect(_0x5119b5,_0x425e13){joinOrLeave(_0x5119b5,_0x93e9('0x46'),_0x425e13);}function onConnect(_0x5beb98){joinOrLeave(_0x5beb98,_0x93e9('0x52'));}exports[_0x93e9('0x53')]=function(_0x2b5620){_0x2b5620['on'](_0x93e9('0x54'),function(_0x11aec9){_0x11aec9[_0x93e9('0x55')](0x0);_0x11aec9[_0x93e9('0x56')]=_0x11aec9[_0x93e9('0x57')]['connection'][_0x93e9('0x58')]+':'+_0x11aec9[_0x93e9('0x57')][_0x93e9('0x54')][_0x93e9('0x59')];_0x11aec9[_0x93e9('0x5a')]=new Date();_0x11aec9[_0x93e9('0x5b')]=function(_0x6d89b5){console[_0x93e9('0x5b')](_0x93e9('0x5c')+_0x11aec9[_0x93e9('0x5d')][_0x93e9('0x5')]+'['+_0x11aec9[_0x93e9('0x56')]+']',_0x6d89b5);};_0x11aec9['on'](_0x93e9('0x5e'),function(){onDisconnect(_0x11aec9,_0x2b5620);_0x11aec9[_0x93e9('0x5b')]('DISCONNECTED');});onConnect(_0x11aec9);_0x11aec9[_0x93e9('0x5b')](_0x93e9('0x5f'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index eb200e9..83a908b 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 _0x1387=['UserId','interface','format','SIP/%s','name','agent','incomingmessage','outgoingmessage','catch','AfterCreateMessage','get','motionChannel','offlineMessage','opened','sequelize','AfterCreate','closed','changed','substatus','AfterUpdate','fullname','email','default','hasOwnProperty','model','hook','condition','../../mysqldb','jayson/promise','triggers','client','http','Chat','ChatInteraction','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','afterCreate','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','then','info','Trigger,\x20%s','EventManager','error','code','channel','event','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','query','Sequelize','QueryTypes','SELECT'];(function(_0x1ebc02,_0x295964){var _0x5d6785=function(_0x731e7e){while(--_0x731e7e){_0x1ebc02['push'](_0x1ebc02['shift']());}};_0x5d6785(++_0x295964);}(_0x1387,0xed));var _0x7138=function(_0x1be527,_0x5e9922){_0x1be527=_0x1be527-0x0;var _0xa7d4f9=_0x1387[_0x1be527];return _0xa7d4f9;};'use strict';var util=require('util');var db=require(_0x7138('0x0'))['db'];var jayson=require(_0x7138('0x1'));var logger=require('../logger')(_0x7138('0x2'));var client=jayson[_0x7138('0x3')][_0x7138('0x4')]({'port':0x232a});var triggers=[{'channel':_0x7138('0x5'),'model':_0x7138('0x6'),'event':'afterCreate','condition':_0x7138('0x7'),'callback':afterCreate},{'channel':_0x7138('0x5'),'model':_0x7138('0x6'),'event':_0x7138('0x8'),'condition':_0x7138('0x9'),'callback':afterUpdate},{'channel':_0x7138('0x5'),'model':_0x7138('0xa'),'event':'afterCreate','condition':_0x7138('0xb'),'callback':afterCreateMessage},{'channel':'Chat','model':_0x7138('0xc'),'event':_0x7138('0xd'),'condition':_0x7138('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0x7138('0xe'),'model':_0x7138('0xf'),'event':'afterCreate','condition':_0x7138('0x7'),'callback':afterCreate},{'channel':_0x7138('0xe'),'model':_0x7138('0xf'),'event':_0x7138('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x7138('0xe'),'model':_0x7138('0x10'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x7138('0x11'),'model':_0x7138('0x12'),'event':_0x7138('0xd'),'condition':_0x7138('0x7'),'callback':afterCreate},{'channel':_0x7138('0x11'),'model':'WhatsappInteraction','event':'afterUpdate','condition':_0x7138('0x9'),'callback':afterUpdate},{'channel':'Whatsapp','model':'WhatsappMessage','event':_0x7138('0xd'),'condition':_0x7138('0xb'),'callback':afterCreateMessage},{'channel':_0x7138('0x13'),'model':_0x7138('0x14'),'event':_0x7138('0xd'),'condition':_0x7138('0x7'),'callback':afterCreate},{'channel':_0x7138('0x13'),'model':_0x7138('0x14'),'event':_0x7138('0x8'),'condition':_0x7138('0x9'),'callback':afterUpdate},{'channel':_0x7138('0x13'),'model':_0x7138('0x15'),'event':_0x7138('0xd'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x7138('0x16'),'model':_0x7138('0x17'),'event':'afterCreate','condition':_0x7138('0x7'),'callback':afterCreate},{'channel':'Mail','model':_0x7138('0x17'),'event':_0x7138('0x8'),'condition':_0x7138('0x9'),'callback':afterUpdate},{'channel':_0x7138('0x16'),'model':_0x7138('0x18'),'event':_0x7138('0xd'),'condition':_0x7138('0xb'),'callback':afterCreateMessage},{'channel':_0x7138('0x19'),'model':_0x7138('0x1a'),'event':_0x7138('0xd'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x7138('0x19'),'model':_0x7138('0x1a'),'event':_0x7138('0x8'),'condition':_0x7138('0x9'),'callback':afterUpdate},{'channel':_0x7138('0x19'),'model':_0x7138('0x1b'),'event':_0x7138('0xd'),'condition':_0x7138('0xb'),'callback':afterCreateMessage}];function request(_0x354fea){return client['request']('EventManager',_0x354fea)[_0x7138('0x1c')](function(_0x288b4f){logger[_0x7138('0x1d')](_0x7138('0x1e'),_0x7138('0x1f'),_0x288b4f);if(_0x288b4f[_0x7138('0x20')]){if(_0x288b4f[_0x7138('0x20')][_0x7138('0x21')]===0x1f4){logger['error'](_0x7138('0x1e'),'EventManager',_0x288b4f['error']);}}})['catch'](function(_0x21fa36){logger['error'](_0x7138('0x1e'),_0x7138('0x1f'),_0x21fa36);});}function afterCreateMessage(_0xf5e0ac){return function(_0x3aa917){_0x3aa917=_0x3aa917['get']({'plain':!![]});_0x3aa917[_0x7138('0x22')]=_0xf5e0ac;_0x3aa917['motionChannel']=_0xf5e0ac;_0x3aa917[_0x7138('0x23')]=_0x3aa917['direction'];Promise['resolve']()[_0x7138('0x1c')](function(){if(typeof _0x3aa917[_0x7138('0x24')]===_0x7138('0x25'))return null;var _0x557383=_0x7138('0x26')+_0x3aa917[_0x7138('0x24')];return db['sequelize'][_0x7138('0x27')](_0x557383,{'type':db[_0x7138('0x28')][_0x7138('0x29')][_0x7138('0x2a')],'raw':!![]});})[_0x7138('0x1c')](function(_0x4f66e6){if(_0x4f66e6){_0x3aa917['contact']=_0x4f66e6[0x0];}if(typeof _0x3aa917[_0x7138('0x2b')]===_0x7138('0x25'))return;return getAgent(_0x3aa917['UserId']);})[_0x7138('0x1c')](function(_0x2d099d){if(_0x2d099d){_0x3aa917[_0x7138('0x2c')]=util[_0x7138('0x2d')](_0x7138('0x2e'),_0x2d099d[_0x7138('0x2f')]);_0x3aa917[_0x7138('0x30')]=_0x2d099d;_0x3aa917['channel']=_0xf5e0ac;return request({'event':_0x7138('0x31'),'message':_0x3aa917});}else{return request({'event':_0x7138('0x32'),'message':_0x3aa917});}})[_0x7138('0x33')](function(_0x18227b){logger[_0x7138('0x20')](_0x7138('0x1e'),_0x7138('0x34'),_0x18227b);});};}function afterCreateOfflineMessage(_0x2cb62c){return function(_0x252cc5){_0x252cc5=_0x252cc5[_0x7138('0x35')]({'plain':!![]});_0x252cc5[_0x7138('0x22')]=_0x2cb62c;_0x252cc5[_0x7138('0x36')]=_0x2cb62c;_0x252cc5[_0x7138('0x23')]=_0x7138('0x37');return request({'event':_0x252cc5[_0x7138('0x23')],'message':_0x252cc5});};}function afterCreate(_0xf6800d,_0x4c268d){return function(_0x1627b2){_0x1627b2=_0x1627b2[_0x7138('0x35')]({'plain':!![]});_0x1627b2[_0x7138('0x22')]=_0xf6800d;_0x1627b2[_0x7138('0x36')]=_0xf6800d;_0x1627b2['event']=_0x7138('0x38');Promise['resolve']()['then'](function(){var _0xe6bb64=_0x7138('0x26')+_0x1627b2[_0x7138('0x24')];return db[_0x7138('0x39')][_0x7138('0x27')](_0xe6bb64,{'type':db[_0x7138('0x28')][_0x7138('0x29')][_0x7138('0x2a')],'raw':!![]});})[_0x7138('0x1c')](function(_0x57b1ed){if(_0x57b1ed){_0x1627b2['contact']=_0x57b1ed[0x0];}if(typeof _0x1627b2[_0x7138('0x2b')]===_0x7138('0x25'))return;return getAgent(_0x1627b2['UserId']);})[_0x7138('0x1c')](function(_0x5666ae){if(_0x5666ae){_0x1627b2[_0x7138('0x2c')]=util[_0x7138('0x2d')](_0x7138('0x2e'),_0x5666ae[_0x7138('0x2f')]);_0x1627b2[_0x7138('0x30')]=_0x5666ae;}return request({'event':_0x4c268d,'message':_0x1627b2});})[_0x7138('0x33')](function(_0x56f11c){logger[_0x7138('0x20')](_0x7138('0x1e'),_0x7138('0x3a'),_0x56f11c);});};}function afterUpdate(_0x3170d1){return function(_0x24f146){var _0x2723a1=_0x24f146['changed'](_0x7138('0x3b'))&&_0x24f146[_0x7138('0x3b')];var _0x4e1c6e=_0x24f146[_0x7138('0x3c')](_0x7138('0x3d'));if(_0x2723a1||_0x4e1c6e){var _0x2365aa=_0x2723a1?_0x7138('0x9'):_0x7138('0x3d');var _0x34da48=_0x24f146[_0x7138('0x35')]({'plain':!![]});_0x34da48[_0x7138('0x22')]=_0x3170d1;_0x34da48['motionChannel']=_0x3170d1;_0x34da48[_0x7138('0x23')]=_0x2723a1?_0x7138('0x3b'):_0x7138('0x3d');var _0x22b400=_0x7138('0x26')+_0x34da48[_0x7138('0x24')];return db[_0x7138('0x39')][_0x7138('0x27')](_0x22b400,{'type':db[_0x7138('0x28')]['QueryTypes'][_0x7138('0x2a')],'raw':!![]})[_0x7138('0x1c')](function(_0x515e72){if(_0x515e72){_0x34da48['contact']=_0x515e72[0x0];}if(typeof _0x34da48[_0x7138('0x2b')]==='undefined')return;return getAgent(_0x34da48['UserId']);})['then'](function(_0x20bbd9){if(_0x20bbd9){_0x34da48['interface']=util[_0x7138('0x2d')](_0x7138('0x2e'),_0x20bbd9['name']);_0x34da48['agent']=_0x20bbd9;}return request({'event':_0x2365aa,'message':_0x34da48});})[_0x7138('0x33')](function(_0x27d40b){logger[_0x7138('0x20')]('Trigger,\x20%s',_0x7138('0x3e'),_0x27d40b);});}};}function getAgent(_0x53d3ea){return db['User']['find']({'where':{'id':_0x53d3ea},'attributes':['id',_0x7138('0x2f'),_0x7138('0x3f'),_0x7138('0x40'),'internal'],'raw':!![]})[_0x7138('0x1c')](function(_0x5e5e43){return _0x5e5e43;});}exports[_0x7138('0x41')]=function(){for(var _0xe7913d=0x0;_0xe7913d=_0x3a859f[_0x2a56('0x10')]){throw Error(_0x2a56('0x11'));}_0x1da3be(_0x29f791);})[_0x2a56('0x12')](function(_0x2de99a){_0x160378(_0x2de99a);});});}; \ No newline at end of file +var _0x01f4=['catch','lodash','bluebird','./license/util','voice','mail','chat','whatsapp','openchannel','isValidChannel','clearBlockUser','isUndefined','getLicense','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached'];(function(_0x5d1d54,_0x58487c){var _0x1dd969=function(_0x106068){while(--_0x106068){_0x5d1d54['push'](_0x5d1d54['shift']());}};_0x1dd969(++_0x58487c);}(_0x01f4,0x78));var _0x401f=function(_0x29f47d,_0x29db29){_0x29f47d=_0x29f47d-0x0;var _0x126e95=_0x01f4[_0x29f47d];return _0x126e95;};'use strict';var _=require(_0x401f('0x0'));var BPromise=require(_0x401f('0x1'));var db=require('../mysqldb')['db'];var util=require(_0x401f('0x2'));var channels=[_0x401f('0x3'),_0x401f('0x4'),_0x401f('0x5'),'fax','sms',_0x401f('0x6'),_0x401f('0x7')];exports['getChannels']=function(){return channels;};exports[_0x401f('0x8')]=function(_0x347faf){_0x347faf=_0x347faf['toLowerCase']();return _['includes'](channels,_0x347faf);};exports[_0x401f('0x9')]=function(_0x1956ca,_0x44e666,_0x17784d,_0x3cf856){var _0x26fdd3={'loginAttempts':_0x44e666,'blocked':_0x17784d};if(!_[_0x401f('0xa')](_0x3cf856)){_0x26fdd3['blockedAt']=_0x3cf856;}return _0x1956ca['updateAttributes'](_0x26fdd3);};exports[_0x401f('0xb')]=function(_0x342125){return new BPromise(function(_0x28110d,_0x386154){var _0x4aeb31=0x0;if(_0x342125['role']!==_0x401f('0xc')){_0x28110d(_0x342125);}db['User']['count']({'where':{'role':_0x401f('0xc'),'online':!![],'id':{'$ne':_0x342125['id']}}})['then'](function(_0x49da0a){_0x4aeb31=_0x49da0a;return util[_0x401f('0xb')]();})[_0x401f('0xd')](function(_0x503452){if(_0x503452&&_0x503452[_0x401f('0xe')]&&_0x4aeb31>=_0x503452['agents']){throw Error(_0x401f('0xf'));}_0x28110d(_0x342125);})[_0x401f('0x10')](function(_0x3c7e89){_0x386154(_0x3c7e89);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index faf457e..95f7d85 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found','Forbidden','OutOfInterval','Not\x20Found','status','send','util','../config/logger','api'];(function(_0xa7cf81,_0x34d037){var _0xe55362=function(_0x39c0c3){while(--_0x39c0c3){_0xa7cf81['push'](_0xa7cf81['shift']());}};_0xe55362(++_0x34d037);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var util=require(_0x0a9e('0x0'));var logger=require(_0x0a9e('0x1'))(_0x0a9e('0x2'));var APIError=function(_0x5dd881,_0x550fbc){this[_0x0a9e('0x3')]=_0x5dd881||'Internal\x20Server\x20Error';this[_0x0a9e('0x4')]=_0x550fbc||_0x0a9e('0x5');util[_0x0a9e('0x6')](APIError,Error);};var APIBadRequestError=function(_0x991246){this[_0x0a9e('0x3')]=_0x991246||'Bad\x20Request';this[_0x0a9e('0x4')]=_0x0a9e('0x7');util[_0x0a9e('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x5f41ea){this['message']=_0x5f41ea||_0x0a9e('0x8');this['name']='Not\x20Found';util[_0x0a9e('0x6')](APINotFoundError,APIError);};function getStatusCode(_0xf81284){switch(_0xf81284){case _0x0a9e('0x7'):return 0x190;case _0x0a9e('0x9'),_0x0a9e('0xa'):return 0x193;case _0x0a9e('0xb'):return 0x194;default:return 0x1f4;}}function handleError(_0x4a4c56){return function(_0x50dfb2){logger['error'](_0x50dfb2['stack']);var _0x273d4d=getStatusCode(_0x50dfb2[_0x0a9e('0x4')]);if(_0x50dfb2[_0x0a9e('0x4')])delete _0x50dfb2[_0x0a9e('0x4')];return _0x4a4c56[_0x0a9e('0xc')](_0x273d4d)[_0x0a9e('0xd')](_0x50dfb2);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xb821=['status','exports','../config/logger','api','message','Error','inherits','name','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Forbidden','OutOfInterval','error','stack'];(function(_0x4f6077,_0x514e03){var _0x127dd0=function(_0x524efc){while(--_0x524efc){_0x4f6077['push'](_0x4f6077['shift']());}};_0x127dd0(++_0x514e03);}(_0xb821,0xa7));var _0x1b82=function(_0x13ac0c,_0x3c1a7c){_0x13ac0c=_0x13ac0c-0x0;var _0x5cf2b2=_0xb821[_0x13ac0c];return _0x5cf2b2;};'use strict';var util=require('util');var logger=require(_0x1b82('0x0'))(_0x1b82('0x1'));var APIError=function(_0x5924c6,_0x4a4f81){this[_0x1b82('0x2')]=_0x5924c6||'Internal\x20Server\x20Error';this['name']=_0x4a4f81||_0x1b82('0x3');util[_0x1b82('0x4')](APIError,Error);};var APIBadRequestError=function(_0x3fadf0){this[_0x1b82('0x2')]=_0x3fadf0||'Bad\x20Request';this[_0x1b82('0x5')]=_0x1b82('0x6');util[_0x1b82('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x3632dd){this[_0x1b82('0x2')]=_0x3632dd||_0x1b82('0x7');this[_0x1b82('0x5')]=_0x1b82('0x8');util[_0x1b82('0x4')](APINotFoundError,APIError);};function getStatusCode(_0x4955b5){switch(_0x4955b5){case _0x1b82('0x6'):return 0x190;case _0x1b82('0x9'),_0x1b82('0xa'):return 0x193;case _0x1b82('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0xcffb87){return function(_0x17a96b){logger[_0x1b82('0xb')](_0x17a96b[_0x1b82('0xc')]);var _0x5f521f=getStatusCode(_0x17a96b[_0x1b82('0x5')]);if(_0x17a96b[_0x1b82('0x5')])delete _0x17a96b[_0x1b82('0x5')];return _0xcffb87[_0x1b82('0xd')](_0x5f521f)['send'](_0x17a96b);};}module[_0x1b82('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 5e7228a..be56498 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55f7=['render','json','send','exports','404','status'];(function(_0x2f8827,_0x51222b){var _0x17649e=function(_0x4740ec){while(--_0x4740ec){_0x2f8827['push'](_0x2f8827['shift']());}};_0x17649e(++_0x51222b);}(_0x55f7,0xe1));var _0x755f=function(_0x3cbf4c,_0x3c5832){_0x3cbf4c=_0x3cbf4c-0x0;var _0x5e65b7=_0x55f7[_0x3cbf4c];return _0x5e65b7;};'use strict';module[_0x755f('0x0')][0x194]=function pageNotFound(_0x3b31ed,_0xbf6f3c){var _0x42bd9e=_0x755f('0x1');var _0x470f13=0x194;var _0x356d12={'status':_0x470f13};_0xbf6f3c[_0x755f('0x2')](_0x356d12[_0x755f('0x2')]);_0xbf6f3c[_0x755f('0x3')](_0x42bd9e,{},function(_0x503508,_0x383941){if(_0x503508){return _0xbf6f3c['status'](_0x356d12[_0x755f('0x2')])[_0x755f('0x4')](_0x356d12);}_0xbf6f3c[_0x755f('0x5')](_0x383941);});}; \ No newline at end of file +var _0xa988=['status','render','send','exports','404'];(function(_0x1ab0e6,_0x17ba8d){var _0x248815=function(_0x5d2b40){while(--_0x5d2b40){_0x1ab0e6['push'](_0x1ab0e6['shift']());}};_0x248815(++_0x17ba8d);}(_0xa988,0x1a7));var _0x8a98=function(_0x32db63,_0xb0fa7c){_0x32db63=_0x32db63-0x0;var _0x64465d=_0xa988[_0x32db63];return _0x64465d;};'use strict';module[_0x8a98('0x0')][0x194]=function pageNotFound(_0x3d6ea0,_0x3441ea){var _0x281c23=_0x8a98('0x1');var _0x59970e=0x194;var _0x14901a={'status':_0x59970e};_0x3441ea[_0x8a98('0x2')](_0x14901a[_0x8a98('0x2')]);_0x3441ea[_0x8a98('0x3')](_0x281c23,{},function(_0x3b1af2,_0x28a583){if(_0x3b1af2){return _0x3441ea[_0x8a98('0x2')](_0x14901a[_0x8a98('0x2')])['json'](_0x14901a);}_0x3441ea[_0x8a98('0x4')](_0x28a583);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 5aaaea6..43a50bb 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7932=['Imap','Smtp','Dispositions','CannedAnswer','Answers','Interactions','List','team_has_mail_queues','MailInteractionId','Account','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Interaction','ChatWebsiteId','ChatOfflineMessageId','MailApplication','IntervalId','ListId','ContactId','DashboardItem','Items','FaxAccountId','Exntensions','TagId','FaxInteractionId','Owner','fax_interaction_has_tags','AttachmentId','SmsAccountId','SmsApplication','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','user_has_openchannel_accounts','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ChatProactiveAction','ChatApplication','Agent','Queue','Website','chat_interaction_has_tags','ChatInteractionId','Attachments','ChatGroupId','chat_group_has_users','Phones','JscriptySessions','CmCompany','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','OwnerId','All','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','ParentId','Intervals','Extensions','MailApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','VoiceMusicOnHold','whatsapp_interaction_has_tags','ContactItemType','ItemType','ItemTypeId','Hopper','CmContactId','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticFieldReport','Fields','MetricId','AnalyticMetric','Configurations','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Description','VariableId','Subject','Field','DeskField','ZohoAccount','ZohoField','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerConfiguration','Dynamics365Configuration','FromId','ToId','SessionId','SmsQueueReport','ProjectId','VoiceQueues','team_has_chat_queues','ChatQueues','team_has_fax_queues','OpenchannelQueues','TeamVoicePrefix','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','FromFaxAccountId','ToAgent','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','WhatsappQueueId','team_has_whatsapp_queues','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','sequelizeHistory','mysql','utf8_general_ci','database','username','password','options','User','../api/user/user.model','VoiceChanSpy','import','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../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','UserWhatsappQueue','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','Groups','belongsToMany','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoicePrefixes','UserVoicePrefix','MailQueue','MailQueues','FaxQueues','SmsQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','Applications','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopper','Hoppers','HopperFinals','CmHopperHistory','HopperHistories','CmHopperBlack','HopperBlacks','TrunkId','TrunkBackup','TrunkBackupId','Interval','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','ScreenRecording','Messages','mailboxuser','mailbox','VoiceQueueReport','QueueCalls','uniqueid','CmContact','Contact','MailAccount','MailAccountId','MailServerIn','CloudProviderId','restrict'];(function(_0x2039c3,_0x2e21dc){var _0x971850=function(_0x27705c){while(--_0x27705c){_0x2039c3['push'](_0x2039c3['shift']());}};_0x971850(++_0x2e21dc);}(_0x7932,0x9f));var _0x2793=function(_0x3ace9f,_0x3f0728){_0x3ace9f=_0x3ace9f-0x0;var _0x4c1948=_0x7932[_0x3ace9f];return _0x4c1948;};'use strict';var config=require(_0x2793('0x0'));var Sequelize=require(_0x2793('0x1'));var _=require(_0x2793('0x2'));var jstz=require(_0x2793('0x3'));var timezone=jstz[_0x2793('0x4')]();config[_0x2793('0x1')]=_[_0x2793('0x5')](config['sequelize'],{'database':_0x2793('0x6'),'username':'xcall','password':_0x2793('0x7'),'options':{'host':_0x2793('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x2793('0x9')},'logging':![],'timezone':timezone[_0x2793('0xa')](),'define':{'charset':_0x2793('0xb'),'collate':'utf8_general_ci'}}});config[_0x2793('0xc')]=_[_0x2793('0x5')](config[_0x2793('0xc')],{'database':_0x2793('0x6'),'username':'xcall','password':_0x2793('0x7'),'options':{'host':_0x2793('0x8'),'port':0xcea,'dialect':_0x2793('0xd'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x2793('0xb'),'collate':_0x2793('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2793('0x1')][_0x2793('0xf')],config['sequelize'][_0x2793('0x10')],config[_0x2793('0x1')][_0x2793('0x11')],config[_0x2793('0x1')][_0x2793('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x2793('0xf')],config[_0x2793('0xc')]['username'],config['sequelizeHistory']['password'],config['sequelizeHistory'][_0x2793('0x12')])};db[_0x2793('0x13')]=db['sequelize']['import'](_0x2793('0x14'));db[_0x2793('0x15')]=db[_0x2793('0x1')][_0x2793('0x16')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x2793('0x17')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x18'));db[_0x2793('0x19')]=db[_0x2793('0x1')][_0x2793('0x16')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db['sequelize'][_0x2793('0x16')](_0x2793('0x1a'));db[_0x2793('0x1b')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x1c'));db[_0x2793('0x1d')]=db[_0x2793('0x1')]['import'](_0x2793('0x1e'));db['ScreenRecording']=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x1f'));db[_0x2793('0x20')]=db[_0x2793('0x1')][_0x2793('0x16')]('../api/voiceMail/voiceMail.model');db[_0x2793('0x21')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x22'));db[_0x2793('0x23')]=db[_0x2793('0x1')][_0x2793('0x16')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x24'));db[_0x2793('0x25')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x26'));db['VoiceQueueReport']=db[_0x2793('0x1')][_0x2793('0x16')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x2793('0x27')]=db['sequelize'][_0x2793('0x16')](_0x2793('0x28'));db[_0x2793('0x29')]=db[_0x2793('0x1')]['import'](_0x2793('0x2a'));db[_0x2793('0x2b')]=db['sequelize']['import']('../api/voiceTransferReport/voiceTransferReport.model');db[_0x2793('0x2c')]=db['sequelize']['import'](_0x2793('0x2d'));db[_0x2793('0x2e')]=db['sequelize']['import']('../api/userVoiceQueue/userVoiceQueue.model');db[_0x2793('0x2f')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x30'));db[_0x2793('0x31')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x32'));db[_0x2793('0x33')]=db['sequelize'][_0x2793('0x16')](_0x2793('0x34'));db[_0x2793('0x35')]=db['sequelize']['import'](_0x2793('0x36'));db[_0x2793('0x37')]=db['sequelize'][_0x2793('0x16')](_0x2793('0x38'));db[_0x2793('0x39')]=db['sequelize'][_0x2793('0x16')]('../api/userWhatsappQueue/userWhatsappQueue.model');db['MailServerIn']=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x3a'));db[_0x2793('0x3b')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x3c'));db['MailAccount']=db[_0x2793('0x1')]['import'](_0x2793('0x3d'));db['MailQueue']=db[_0x2793('0x1')][_0x2793('0x16')]('../api/mailQueue/mailQueue.model');db[_0x2793('0x3e')]=db['sequelize'][_0x2793('0x16')](_0x2793('0x3f'));db[_0x2793('0x40')]=db['sequelize'][_0x2793('0x16')](_0x2793('0x41'));db[_0x2793('0x42')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x43'));db['MailApplication']=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x44'));db[_0x2793('0x45')]=db['sequelize']['import'](_0x2793('0x46'));db['Dashboard']=db[_0x2793('0x1')]['import']('../api/dashboard/dashboard.model');db['DashboardItem']=db['sequelize']['import'](_0x2793('0x47'));db[_0x2793('0x48')]=db['sequelize'][_0x2793('0x16')](_0x2793('0x49'));db[_0x2793('0x4a')]=db[_0x2793('0x1')]['import'](_0x2793('0x4b'));db[_0x2793('0x4c')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x4d'));db[_0x2793('0x4e')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x4f'));db[_0x2793('0x50')]=db['sequelize'][_0x2793('0x16')]('../api/faxQueue/faxQueue.model');db[_0x2793('0x51')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x52'));db[_0x2793('0x53')]=db[_0x2793('0x1')][_0x2793('0x16')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db['sequelize']['import'](_0x2793('0x54'));db[_0x2793('0x55')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x56'));db[_0x2793('0x57')]=db['sequelize'][_0x2793('0x16')](_0x2793('0x58'));db[_0x2793('0x59')]=db['sequelize'][_0x2793('0x16')](_0x2793('0x5a'));db[_0x2793('0x5b')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x5c'));db['OpenchannelApplication']=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x5d'));db[_0x2793('0x5e')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x5f'));db[_0x2793('0x60')]=db['sequelize'][_0x2793('0x16')](_0x2793('0x61'));db[_0x2793('0x62')]=db[_0x2793('0x1')]['import'](_0x2793('0x63'));db[_0x2793('0x64')]=db['sequelize']['import'](_0x2793('0x65'));db[_0x2793('0x66')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x67'));db['ChatApplication']=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x68'));db[_0x2793('0x69')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x6a'));db[_0x2793('0x6b')]=db[_0x2793('0x1')][_0x2793('0x16')]('../api/chatMessage/chatMessage.model');db[_0x2793('0x6c')]=db[_0x2793('0x1')]['import'](_0x2793('0x6d'));db[_0x2793('0x6e')]=db['sequelize'][_0x2793('0x16')](_0x2793('0x6f'));db[_0x2793('0x70')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x71'));db['ChatProactiveAction']=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x72'));db['CmCompany']=db[_0x2793('0x1')][_0x2793('0x16')]('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x73'));db['CmHopper']=db['sequelize'][_0x2793('0x16')](_0x2793('0x74'));db['CmHopperBlack']=db['sequelize'][_0x2793('0x16')](_0x2793('0x75'));db[_0x2793('0x76')]=db[_0x2793('0x1')][_0x2793('0x16')]('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x77'));db['ReportAgentPreview']=db['sequelize']['import'](_0x2793('0x78'));db[_0x2793('0x79')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x7a'));db[_0x2793('0x7b')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x7c'));db[_0x2793('0x7d')]=db['sequelize'][_0x2793('0x16')](_0x2793('0x7e'));db['CannedAnswer']=db['sequelize'][_0x2793('0x16')](_0x2793('0x7f'));db[_0x2793('0x80')]=db[_0x2793('0x1')]['import'](_0x2793('0x81'));db[_0x2793('0x82')]=db['sequelize'][_0x2793('0x16')](_0x2793('0x83'));db['Interval']=db['sequelize'][_0x2793('0x16')](_0x2793('0x84'));db[_0x2793('0x85')]=db[_0x2793('0x1')][_0x2793('0x16')]('../api/pause/pause.model');db['Cdr']=db[_0x2793('0x1')]['import'](_0x2793('0x86'));db[_0x2793('0x87')]=db['sequelize'][_0x2793('0x16')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x2793('0x88')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x89'));db['Sound']=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x8a'));db[_0x2793('0x8b')]=db['sequelize'][_0x2793('0x16')](_0x2793('0x8c'));db['ContactItemType']=db[_0x2793('0x1')][_0x2793('0x16')]('../api/contactItemType/contactItemType.model');db[_0x2793('0x8d')]=db[_0x2793('0x1')]['import'](_0x2793('0x8e'));db[_0x2793('0x8f')]=db['sequelize']['import'](_0x2793('0x90'));db[_0x2793('0x91')]=db[_0x2793('0x1')]['import'](_0x2793('0x92'));db['Trigger']=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x93'));db[_0x2793('0x94')]=db[_0x2793('0x1')]['import'](_0x2793('0x95'));db[_0x2793('0x96')]=db[_0x2793('0x1')]['import'](_0x2793('0x97'));db[_0x2793('0x98')]=db[_0x2793('0x1')][_0x2793('0x16')]('../api/integrationReport/integrationReport.model');db[_0x2793('0x99')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x9a'));db[_0x2793('0x9b')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x9c'));db['AnalyticExtractedReport']=db[_0x2793('0x1')]['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db[_0x2793('0x1')]['import'](_0x2793('0x9d'));db['AnalyticFieldReport']=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x9e'));db['AnalyticTreeReport']=db['sequelize'][_0x2793('0x16')](_0x2793('0x9f'));db[_0x2793('0xa0')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xa1'));db[_0x2793('0xa2')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xa3'));db['SalesforceField']=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xa4'));db[_0x2793('0xa5')]=db[_0x2793('0x1')][_0x2793('0x16')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x2793('0xa6')]=db['sequelize'][_0x2793('0x16')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x2793('0xa7')]=db['sequelize']['import']('../api/intSugarcrmField/intSugarcrmField.model');db[_0x2793('0xa8')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xa9'));db[_0x2793('0xaa')]=db[_0x2793('0x1')]['import'](_0x2793('0xab'));db['DeskField']=db[_0x2793('0x1')][_0x2793('0x16')]('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xac'));db[_0x2793('0xad')]=db[_0x2793('0x1')][_0x2793('0x16')]('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db['sequelize'][_0x2793('0x16')](_0x2793('0xae'));db[_0x2793('0xaf')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xb0'));db[_0x2793('0xb1')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xb2'));db['ZendeskField']=db['sequelize'][_0x2793('0x16')](_0x2793('0xb3'));db[_0x2793('0xb4')]=db['sequelize']['import']('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x2793('0xb5')]=db[_0x2793('0x1')][_0x2793('0x16')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db['FreshdeskField']=db['sequelize']['import'](_0x2793('0xb6'));db[_0x2793('0xb7')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xb8'));db['VtigerConfiguration']=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xb9'));db[_0x2793('0xba')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xbb'));db[_0x2793('0xbc')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xbd'));db[_0x2793('0xbe')]=db[_0x2793('0x1')][_0x2793('0x16')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x2793('0xbf')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xc0'));db[_0x2793('0xc1')]=db['sequelize'][_0x2793('0x16')](_0x2793('0xc2'));db['Dynamics365Configuration']=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xc3'));db[_0x2793('0xc4')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xc5'));db[_0x2793('0xc6')]=db[_0x2793('0x1')]['import'](_0x2793('0xc7'));db[_0x2793('0xc8')]=db['sequelize'][_0x2793('0x16')](_0x2793('0xc9'));db[_0x2793('0xca')]=db[_0x2793('0x1')]['import'](_0x2793('0xcb'));db[_0x2793('0x96')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x97'));db[_0x2793('0xcc')]=db['sequelize'][_0x2793('0x16')](_0x2793('0xcd'));db[_0x2793('0xce')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xcf'));db[_0x2793('0xd0')]=db['sequelize'][_0x2793('0x16')](_0x2793('0xd1'));db[_0x2793('0xd2')]=db['sequelize']['import'](_0x2793('0xd3'));db[_0x2793('0xd4')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xd5'));db[_0x2793('0xd6')]=db[_0x2793('0x1')][_0x2793('0x16')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db['sequelize'][_0x2793('0x16')]('../api/smsQueueReport/smsQueueReport.model');db[_0x2793('0xd7')]=db['sequelize'][_0x2793('0x16')](_0x2793('0xd8'));db[_0x2793('0xd9')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xda'));db[_0x2793('0xdb')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xdc'));db[_0x2793('0xdd')]=db[_0x2793('0x1')][_0x2793('0x16')]('../api/setting/setting.model');db[_0x2793('0xde')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xdf'));db[_0x2793('0xe0')]=db['sequelize'][_0x2793('0x16')](_0x2793('0xe1'));db[_0x2793('0xe2')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xe3'));db['SquareMessage']=db[_0x2793('0x1')]['import'](_0x2793('0xe4'));db[_0x2793('0xe5')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xe6'));db['License']=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xe7'));db[_0x2793('0xe8')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xe9'));db[_0x2793('0xea')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xeb'));db[_0x2793('0xec')]=db[_0x2793('0x1')]['import'](_0x2793('0xed'));db[_0x2793('0xee')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xef'));db[_0x2793('0xf0')]=db['sequelize']['import'](_0x2793('0xf1'));db[_0x2793('0xf2')]=db['sequelize'][_0x2793('0x16')](_0x2793('0xf3'));db[_0x2793('0xf4')]=db['sequelize'][_0x2793('0x16')](_0x2793('0xf5'));db[_0x2793('0xf6')]=db['sequelize'][_0x2793('0x16')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x2793('0xf7')]=db['sequelize'][_0x2793('0x16')](_0x2793('0xf8'));db[_0x2793('0xf9')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xfa'));db[_0x2793('0xfb')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xfc'));db[_0x2793('0xfd')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0xfe'));db[_0x2793('0xff')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x100'));db['UserProfileResource']=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x101'));db[_0x2793('0x102')]=db['sequelize']['import']('../api/userNotification/userNotification.model');db[_0x2793('0x103')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x104'));db[_0x2793('0x105')]=db[_0x2793('0x1')]['import'](_0x2793('0x106'));db[_0x2793('0x107')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x108'));db[_0x2793('0x109')]=db[_0x2793('0x1')][_0x2793('0x16')]('../api/whatsappMessage/whatsappMessage.model');db[_0x2793('0x10a')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x10b'));db[_0x2793('0x10c')]=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x10d'));db[_0x2793('0x10e')]=db['sequelize'][_0x2793('0x16')](_0x2793('0x10f'));db[_0x2793('0x110')]=db['sequelize'][_0x2793('0x16')](_0x2793('0x111'));db['TeamVoiceQueue']=db[_0x2793('0x1')][_0x2793('0x16')]('../api/teamVoiceQueue/teamVoiceQueue.model');db['TeamVoicePrefix']=db['sequelize'][_0x2793('0x16')]('../api/teamVoicePrefix/teamVoicePrefix.model');db['UserVoicePrefix']=db[_0x2793('0x1')][_0x2793('0x16')](_0x2793('0x112'));db[_0x2793('0x113')]=db['sequelize'][_0x2793('0x16')](_0x2793('0x114'));db[_0x2793('0x13')][_0x2793('0x115')](db['VoiceMail'],{'as':_0x2793('0x20'),'onDelete':_0x2793('0x116'),'foreignKey':'UserId'});db[_0x2793('0x13')][_0x2793('0x115')](db['UserSetting'],{'as':'userSetting','onDelete':'cascade','foreignKey':_0x2793('0x117')});db[_0x2793('0x13')][_0x2793('0x118')](db[_0x2793('0x1d')],{'as':_0x2793('0x119'),'foreignKey':_0x2793('0x117')});db[_0x2793('0x13')]['hasMany'](db[_0x2793('0x2c')],{'as':_0x2793('0x11a'),'foreignKey':_0x2793('0x117')});db[_0x2793('0x13')][_0x2793('0x118')](db[_0x2793('0x19')],{'as':'Extensions','onDelete':_0x2793('0x116'),'hooks':!![]});db[_0x2793('0x13')]['hasMany'](db[_0x2793('0x76')],{'as':'HopperFinals','foreignKey':_0x2793('0x117')});db[_0x2793('0x13')][_0x2793('0x118')](db['CmHopperHistory'],{'as':_0x2793('0x11b'),'foreignKey':_0x2793('0x117')});db[_0x2793('0x13')][_0x2793('0x118')](db['ReportAgentPreview'],{'as':_0x2793('0x11c'),'foreignKey':_0x2793('0x117')});db[_0x2793('0x13')][_0x2793('0x118')](db[_0x2793('0x5e')],{'as':_0x2793('0x11d'),'foreignKey':_0x2793('0x117')});db[_0x2793('0x13')][_0x2793('0x118')](db[_0x2793('0x69')],{'as':_0x2793('0x11e'),'foreignKey':'UserId'});db[_0x2793('0x13')]['hasMany'](db[_0x2793('0x55')],{'as':_0x2793('0x11f'),'foreignKey':_0x2793('0x117')});db[_0x2793('0x13')]['hasMany'](db[_0x2793('0x4c')],{'as':_0x2793('0x120'),'foreignKey':_0x2793('0x117')});db[_0x2793('0x13')][_0x2793('0x118')](db[_0x2793('0x40')],{'as':_0x2793('0x121'),'foreignKey':_0x2793('0x117')});db[_0x2793('0x13')][_0x2793('0x118')](db['WhatsappInteraction'],{'as':_0x2793('0x122'),'foreignKey':_0x2793('0x117')});db[_0x2793('0x13')][_0x2793('0x118')](db['UserNotification'],{'as':_0x2793('0x123'),'foreignKey':_0x2793('0x124')});db[_0x2793('0x13')][_0x2793('0x125')](db[_0x2793('0xfd')],{'as':_0x2793('0xfd'),'foreignKey':_0x2793('0x126')});db['User']['belongsToMany'](db['ChatGroup'],{'as':_0x2793('0x127'),'through':'chat_group_has_users'});db[_0x2793('0x13')][_0x2793('0x128')](db['CmContact'],{'as':_0x2793('0x129'),'through':_0x2793('0x12a')});db[_0x2793('0x13')]['belongsToMany'](db[_0x2793('0xf9')],{'as':_0x2793('0x12b'),'through':_0x2793('0x12c')});db[_0x2793('0x13')][_0x2793('0x128')](db[_0x2793('0xe5')],{'through':_0x2793('0x12d')});db['User'][_0x2793('0x128')](db[_0x2793('0x40')],{'as':_0x2793('0x121'),'through':'user_has_mail_interactions'});db[_0x2793('0x13')][_0x2793('0x128')](db[_0x2793('0x69')],{'as':_0x2793('0x11e'),'through':_0x2793('0x12e')});db[_0x2793('0x13')]['belongsToMany'](db[_0x2793('0x4c')],{'as':_0x2793('0x120'),'through':_0x2793('0x12f')});db[_0x2793('0x13')][_0x2793('0x128')](db[_0x2793('0x55')],{'as':'SmsInteractions','through':_0x2793('0x130')});db[_0x2793('0x13')][_0x2793('0x128')](db[_0x2793('0x5e')],{'as':_0x2793('0x11d'),'through':_0x2793('0x131')});db[_0x2793('0x13')][_0x2793('0x128')](db[_0x2793('0x107')],{'as':_0x2793('0x122'),'through':_0x2793('0x132')});db[_0x2793('0x13')][_0x2793('0x128')](db[_0x2793('0x1b')],{'as':'VoiceQueues','through':_0x2793('0x2e'),'required':![]});db['User'][_0x2793('0x128')](db[_0x2793('0xfb')],{'as':_0x2793('0x133'),'through':_0x2793('0x134'),'required':![]});db['User'][_0x2793('0x128')](db[_0x2793('0x135')],{'as':_0x2793('0x136'),'through':_0x2793('0x31'),'required':![]});db[_0x2793('0x13')][_0x2793('0x128')](db[_0x2793('0x6e')],{'as':'ChatQueues','through':_0x2793('0x2f'),'required':![],'hooks':!![]});db[_0x2793('0x13')][_0x2793('0x128')](db[_0x2793('0x50')],{'as':_0x2793('0x137'),'through':_0x2793('0x33'),'required':![]});db[_0x2793('0x13')]['belongsToMany'](db[_0x2793('0x59')],{'as':_0x2793('0x138'),'through':_0x2793('0x35'),'required':![]});db[_0x2793('0x13')][_0x2793('0x128')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':_0x2793('0x37'),'required':![]});db['User'][_0x2793('0x128')](db[_0x2793('0x10e')],{'as':_0x2793('0x139'),'through':_0x2793('0x39'),'required':![]});db['User'][_0x2793('0x128')](db[_0x2793('0xf9')],{'through':'cm_user_has_lists'});db[_0x2793('0x13')][_0x2793('0x128')](db[_0x2793('0x64')],{'as':_0x2793('0x13a'),'through':_0x2793('0x13b')});db[_0x2793('0x13')][_0x2793('0x128')](db['FaxAccount'],{'as':_0x2793('0x13c'),'through':_0x2793('0x13d')});db['User'][_0x2793('0x128')](db['MailAccount'],{'as':_0x2793('0x13e'),'through':'user_has_mail_accounts'});db[_0x2793('0x13')]['belongsToMany'](db[_0x2793('0x5b')],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db[_0x2793('0x13')][_0x2793('0x128')](db[_0x2793('0x53')],{'as':_0x2793('0x13f'),'through':_0x2793('0x140')});db['User'][_0x2793('0x128')](db[_0x2793('0x103')],{'as':_0x2793('0x141'),'through':_0x2793('0x142')});db[_0x2793('0x15')][_0x2793('0x118')](db[_0x2793('0x19')],{'as':_0x2793('0x143'),'onDelete':_0x2793('0x116'),'foreignKey':_0x2793('0x144')});db[_0x2793('0x17')][_0x2793('0x118')](db['VoiceExtension'],{'onDelete':'cascade'});db[_0x2793('0x19')][_0x2793('0x118')](db[_0x2793('0x19')],{'as':_0x2793('0x145'),'onDelete':_0x2793('0x116')});db['VoiceMusicOnHold'][_0x2793('0x128')](db[_0x2793('0x146')],{'as':_0x2793('0x147'),'through':_0x2793('0x148')});db[_0x2793('0x1b')][_0x2793('0x118')](db[_0x2793('0x2c')],{'as':_0x2793('0x149'),'foreignKey':_0x2793('0x14a')});db[_0x2793('0x1b')]['hasMany'](db[_0x2793('0x14b')],{'as':_0x2793('0x14c'),'foreignKey':_0x2793('0x14a')});db['VoiceQueue'][_0x2793('0x118')](db[_0x2793('0x76')],{'as':_0x2793('0x14d'),'foreignKey':'VoiceQueueId'});db[_0x2793('0x1b')][_0x2793('0x118')](db[_0x2793('0x14e')],{'as':_0x2793('0x14f'),'foreignKey':_0x2793('0x14a')});db['VoiceQueue']['hasMany'](db[_0x2793('0x11c')],{'as':_0x2793('0x11c'),'foreignKey':'VoiceQueueId'});db[_0x2793('0x1b')][_0x2793('0x118')](db[_0x2793('0x150')],{'as':_0x2793('0x151'),'foreignKey':_0x2793('0x14a')});db['VoiceQueue']['hasMany'](db[_0x2793('0xd6')],{'as':'JscriptySessions','foreignKey':_0x2793('0x14a')});db[_0x2793('0x1b')]['belongsTo'](db[_0x2793('0x29')],{'as':_0x2793('0x29'),'foreignKey':_0x2793('0x152')});db[_0x2793('0x1b')]['belongsTo'](db[_0x2793('0x29')],{'as':_0x2793('0x153'),'foreignKey':_0x2793('0x154')});db[_0x2793('0x1b')][_0x2793('0x125')](db[_0x2793('0x155')],{'as':'Interval','foreignKey':'IntervalId'});db['VoiceQueue']['belongsTo'](db[_0x2793('0x85')],{'as':_0x2793('0x156'),'foreignKey':_0x2793('0x157')});db['VoiceQueue']['belongsToMany'](db[_0x2793('0xf9')],{'as':_0x2793('0x12b'),'through':_0x2793('0x158')});db['VoiceQueue']['belongsToMany'](db['User'],{'as':_0x2793('0x159'),'through':_0x2793('0x2e')});db['VoiceQueue'][_0x2793('0x128')](db['Team'],{'as':_0x2793('0x15a'),'through':_0x2793('0x15b')});db[_0x2793('0x1b')][_0x2793('0x128')](db[_0x2793('0xf9')],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db['VoiceRecording'][_0x2793('0x125')](db[_0x2793('0x13')],{'as':_0x2793('0x13'),'foreignKey':_0x2793('0x117')});db[_0x2793('0x15c')][_0x2793('0x125')](db[_0x2793('0x13')],{'as':'User','foreignKey':'UserId'});db[_0x2793('0x20')]['hasMany'](db[_0x2793('0x21')],{'as':_0x2793('0x15d'),'onDelete':_0x2793('0x116'),'foreignKey':_0x2793('0x15e'),'sourceKey':_0x2793('0x15f')});db[_0x2793('0x21')][_0x2793('0x125')](db[_0x2793('0x20')],{'foreignKey':_0x2793('0x15e'),'targetKey':_0x2793('0x15f')});db[_0x2793('0x23')][_0x2793('0x118')](db[_0x2793('0x160')],{'as':_0x2793('0x161'),'foreignKey':_0x2793('0x162'),'constraints':![]});db[_0x2793('0x23')][_0x2793('0x118')](db[_0x2793('0x25')],{'as':'AgentReports','foreignKey':_0x2793('0x162'),'constraints':![]});db[_0x2793('0x23')]['belongsTo'](db[_0x2793('0x13')],{'as':_0x2793('0x13'),'foreignKey':_0x2793('0x117')});db[_0x2793('0x23')]['belongsTo'](db[_0x2793('0x163')],{'as':_0x2793('0x164'),'foreignKey':'ContactId'});db['MailServerIn'][_0x2793('0x125')](db['MailAccount'],{'as':_0x2793('0x165'),'foreignKey':_0x2793('0x166')});db[_0x2793('0x167')][_0x2793('0x125')](db['CloudProvider'],{'as':_0x2793('0x110'),'foreignKey':_0x2793('0x168'),'onDelete':'restrict'});db[_0x2793('0x3b')][_0x2793('0x125')](db[_0x2793('0x165')],{'as':_0x2793('0x165'),'foreignKey':_0x2793('0x166')});db['MailServerOut']['belongsTo'](db[_0x2793('0x110')],{'as':'CloudProvider','foreignKey':'CloudProviderId','onDelete':_0x2793('0x169')});db['MailAccount']['hasOne'](db[_0x2793('0x167')],{'as':_0x2793('0x16a'),'onDelete':'cascade'});db['MailAccount'][_0x2793('0x115')](db[_0x2793('0x3b')],{'as':_0x2793('0x16b'),'onDelete':_0x2793('0x116')});db['MailAccount'][_0x2793('0x118')](db[_0x2793('0x80')],{'as':_0x2793('0x16c'),'foreignKey':_0x2793('0x166'),'onDelete':'cascade'});db[_0x2793('0x165')][_0x2793('0x118')](db[_0x2793('0x16d')],{'as':_0x2793('0x16e'),'foreignKey':_0x2793('0x166')});db[_0x2793('0x165')]['hasMany'](db['MailMessage'],{'as':_0x2793('0x15d'),'foreignKey':'MailAccountId'});db[_0x2793('0x165')]['hasMany'](db['MailInteraction'],{'as':_0x2793('0x16f')});db[_0x2793('0x165')]['hasMany'](db['MailApplication'],{'as':_0x2793('0x145')});db[_0x2793('0x165')][_0x2793('0x125')](db[_0x2793('0xf9')],{'as':_0x2793('0x170'),'foreignKey':'ListId'});db[_0x2793('0x165')]['belongsTo'](db[_0x2793('0x91')],{'as':_0x2793('0x91'),'foreignKey':'TemplateId'});db[_0x2793('0x165')][_0x2793('0x125')](db[_0x2793('0x85')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x2793('0x165')]['belongsToMany'](db[_0x2793('0x13')],{'as':_0x2793('0x159'),'through':'user_has_mail_accounts'});db['MailQueue']['belongsToMany'](db[_0x2793('0x13')],{'as':'Agents','through':_0x2793('0x31')});db[_0x2793('0x135')]['belongsToMany'](db['Team'],{'through':_0x2793('0x171'),'as':_0x2793('0x15a')});db[_0x2793('0x40')][_0x2793('0x118')](db[_0x2793('0x42')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x2793('0x172')});db[_0x2793('0x40')][_0x2793('0x125')](db[_0x2793('0x165')],{'as':_0x2793('0x173'),'foreignKey':_0x2793('0x166')});db[_0x2793('0x40')]['belongsTo'](db[_0x2793('0x163')],{'as':_0x2793('0x164'),'foreignKey':'ContactId'});db['MailInteraction'][_0x2793('0x125')](db[_0x2793('0x13')],{'as':'Owner','foreignKey':'UserId'});db[_0x2793('0x40')][_0x2793('0x128')](db[_0x2793('0x8b')],{'through':_0x2793('0x174'),'as':_0x2793('0x175')});db[_0x2793('0x40')][_0x2793('0x128')](db[_0x2793('0x8b')],{'through':_0x2793('0x174'),'as':_0x2793('0x176')});db[_0x2793('0x40')][_0x2793('0x128')](db['User'],{'as':_0x2793('0x177'),'through':_0x2793('0x178'),'foreignKey':_0x2793('0x172')});db[_0x2793('0x42')][_0x2793('0x118')](db[_0x2793('0xec')],{'as':'Attachments','onDelete':'cascade'});db[_0x2793('0x42')][_0x2793('0x125')](db[_0x2793('0x13')],{'as':_0x2793('0x13')});db[_0x2793('0x42')]['belongsTo'](db[_0x2793('0x163')],{'onDelete':_0x2793('0x116'),'as':'Contact'});db[_0x2793('0x42')]['belongsTo'](db[_0x2793('0x40')],{'as':_0x2793('0x179'),'foreignKey':_0x2793('0x172')});db[_0x2793('0x42')]['belongsTo'](db[_0x2793('0x165')],{'as':'Account','foreignKey':_0x2793('0x166')});db[_0x2793('0x42')][_0x2793('0x125')](db['ChatWebsite'],{'as':'ChatWebsite','foreignKey':_0x2793('0x17a')});db[_0x2793('0x42')][_0x2793('0x125')](db['ChatOfflineMessage'],{'as':_0x2793('0x6c'),'foreignKey':_0x2793('0x17b')});db[_0x2793('0x17c')][_0x2793('0x125')](db[_0x2793('0x13')],{'onDelete':'restrict'});db[_0x2793('0x17c')][_0x2793('0x125')](db['MailQueue'],{'onDelete':_0x2793('0x169')});db[_0x2793('0x17c')][_0x2793('0x125')](db[_0x2793('0x165')],{'onDelete':_0x2793('0x169')});db[_0x2793('0x17c')][_0x2793('0x125')](db[_0x2793('0x155')],{'onDelete':'restrict','foreignKey':_0x2793('0x17d')});db[_0x2793('0x17c')][_0x2793('0x125')](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x2793('0x45')][_0x2793('0x125')](db[_0x2793('0x165')],{});db['MailQueueReport'][_0x2793('0x125')](db['CmList'],{'as':'List','foreignKey':_0x2793('0x17e')});db[_0x2793('0x45')][_0x2793('0x125')](db[_0x2793('0x163')],{'as':_0x2793('0x164'),'foreignKey':_0x2793('0x17f')});db[_0x2793('0x45')][_0x2793('0x125')](db[_0x2793('0x40')],{});db['MailQueueReport'][_0x2793('0x125')](db[_0x2793('0x42')],{});db[_0x2793('0x45')][_0x2793('0x125')](db[_0x2793('0x13')],{});db[_0x2793('0x45')]['belongsTo'](db[_0x2793('0x135')],{});db['Dashboard']['hasMany'](db[_0x2793('0x180')],{'as':_0x2793('0x181'),'onDelete':_0x2793('0x116')});db[_0x2793('0x48')][_0x2793('0x118')](db[_0x2793('0x80')],{'as':'Dispositions','foreignKey':_0x2793('0x182'),'onDelete':'cascade'});db['FaxAccount']['hasMany'](db[_0x2793('0x16d')],{'as':_0x2793('0x16e'),'foreignKey':'FaxAccountId'});db['FaxAccount']['hasMany'](db[_0x2793('0x4c')],{'as':_0x2793('0x16f')});db[_0x2793('0x48')]['hasMany'](db[_0x2793('0x4a')],{'as':_0x2793('0x145')});db['FaxAccount'][_0x2793('0x118')](db[_0x2793('0x19')],{'as':_0x2793('0x183'),'onDelete':_0x2793('0x116')});db[_0x2793('0x48')][_0x2793('0x118')](db[_0x2793('0x4e')],{'as':_0x2793('0x15d')});db[_0x2793('0x48')][_0x2793('0x125')](db[_0x2793('0x29')],{'as':_0x2793('0x29')});db['FaxAccount'][_0x2793('0x125')](db[_0x2793('0xf9')],{'as':_0x2793('0x170'),'foreignKey':'ListId'});db[_0x2793('0x48')][_0x2793('0x125')](db[_0x2793('0x85')],{'as':_0x2793('0x156'),'foreignKey':_0x2793('0x157')});db[_0x2793('0x48')][_0x2793('0x128')](db[_0x2793('0x13')],{'as':_0x2793('0x159'),'through':_0x2793('0x13d')});db[_0x2793('0x4a')]['belongsTo'](db[_0x2793('0x13')],{'onDelete':_0x2793('0x169')});db[_0x2793('0x4a')]['belongsTo'](db[_0x2793('0x50')],{'onDelete':_0x2793('0x169')});db[_0x2793('0x4a')]['belongsTo'](db[_0x2793('0x48')],{'onDelete':_0x2793('0x169')});db[_0x2793('0x4a')]['belongsTo'](db['Tag'],{'onDelete':_0x2793('0x169'),'foreignKey':_0x2793('0x184')});db['FaxInteraction'][_0x2793('0x118')](db[_0x2793('0x4e')],{'as':_0x2793('0x15d'),'onDelete':_0x2793('0x116'),'foreignKey':_0x2793('0x185')});db[_0x2793('0x4c')]['belongsTo'](db[_0x2793('0x48')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x2793('0x4c')][_0x2793('0x125')](db[_0x2793('0x163')],{'as':'Contact','foreignKey':_0x2793('0x17f')});db[_0x2793('0x4c')][_0x2793('0x125')](db[_0x2793('0x13')],{'as':_0x2793('0x186'),'foreignKey':'UserId'});db[_0x2793('0x4c')][_0x2793('0x128')](db[_0x2793('0x8b')],{'through':_0x2793('0x187'),'as':_0x2793('0x175')});db[_0x2793('0x4c')][_0x2793('0x128')](db[_0x2793('0x8b')],{'through':'fax_interaction_has_tags','as':_0x2793('0x176')});db['FaxInteraction'][_0x2793('0x128')](db[_0x2793('0x13')],{'as':'Users','through':'user_has_fax_interactions','foreignKey':_0x2793('0x185')});db[_0x2793('0x4e')]['belongsTo'](db[_0x2793('0x13')],{'onDelete':_0x2793('0x116'),'as':_0x2793('0x13')});db[_0x2793('0x4e')]['belongsTo'](db[_0x2793('0x4c')],{'as':'Interaction','foreignKey':'FaxInteractionId'});db[_0x2793('0x4e')][_0x2793('0x125')](db[_0x2793('0x163')],{'onDelete':_0x2793('0x116'),'as':_0x2793('0x164')});db['FaxMessage']['belongsTo'](db[_0x2793('0xec')],{'as':'Attachment','foreignKey':_0x2793('0x188')});db['FaxMessage'][_0x2793('0x125')](db['FaxAccount'],{'as':_0x2793('0x173'),'foreignKey':_0x2793('0x182')});db[_0x2793('0x50')][_0x2793('0x128')](db[_0x2793('0x13')],{'as':'Agents','through':_0x2793('0x33')});db[_0x2793('0x50')]['belongsToMany'](db[_0x2793('0xe5')],{'through':'team_has_fax_queues','as':_0x2793('0x15a')});db[_0x2793('0x51')][_0x2793('0x125')](db[_0x2793('0x48')],{});db[_0x2793('0x51')]['belongsTo'](db[_0x2793('0xf9')],{'as':_0x2793('0x170'),'foreignKey':_0x2793('0x17e')});db[_0x2793('0x51')][_0x2793('0x125')](db[_0x2793('0x163')],{'as':_0x2793('0x164'),'foreignKey':_0x2793('0x17f')});db[_0x2793('0x51')][_0x2793('0x125')](db[_0x2793('0x4c')],{});db['FaxQueueReport'][_0x2793('0x125')](db[_0x2793('0x4e')],{});db['FaxQueueReport']['belongsTo'](db[_0x2793('0x13')],{});db[_0x2793('0x51')][_0x2793('0x125')](db[_0x2793('0x50')],{});db['SmsAccount'][_0x2793('0x118')](db['Disposition'],{'as':_0x2793('0x16c'),'foreignKey':_0x2793('0x189'),'onDelete':_0x2793('0x116')});db[_0x2793('0x53')][_0x2793('0x118')](db[_0x2793('0x16d')],{'as':_0x2793('0x16e'),'foreignKey':_0x2793('0x189')});db['SmsAccount'][_0x2793('0x118')](db[_0x2793('0x57')],{'as':'Messages','foreignKey':'SmsAccountId'});db[_0x2793('0x53')]['hasMany'](db[_0x2793('0x55')],{'as':_0x2793('0x16f')});db[_0x2793('0x53')][_0x2793('0x118')](db[_0x2793('0x18a')],{'as':_0x2793('0x145')});db[_0x2793('0x53')][_0x2793('0x125')](db[_0x2793('0xf9')],{'as':_0x2793('0x170'),'foreignKey':'ListId'});db[_0x2793('0x53')][_0x2793('0x125')](db[_0x2793('0x85')],{'as':_0x2793('0x156'),'foreignKey':_0x2793('0x157')});db[_0x2793('0x53')][_0x2793('0x128')](db[_0x2793('0x13')],{'as':_0x2793('0x159'),'through':'user_has_sms_accounts'});db[_0x2793('0x18a')][_0x2793('0x125')](db[_0x2793('0x13')],{'onDelete':_0x2793('0x169')});db['SmsApplication'][_0x2793('0x125')](db[_0x2793('0x59')],{'onDelete':_0x2793('0x169')});db[_0x2793('0x18a')][_0x2793('0x125')](db[_0x2793('0x53')],{'onDelete':_0x2793('0x169')});db['SmsApplication'][_0x2793('0x125')](db[_0x2793('0x155')],{'onDelete':_0x2793('0x169'),'foreignKey':_0x2793('0x17d')});db[_0x2793('0x18a')]['belongsTo'](db[_0x2793('0x8b')],{'onDelete':_0x2793('0x169'),'foreignKey':_0x2793('0x184')});db[_0x2793('0x55')]['hasMany'](db[_0x2793('0x57')],{'as':_0x2793('0x15d'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0x2793('0x55')][_0x2793('0x125')](db[_0x2793('0x53')],{'as':_0x2793('0x173'),'foreignKey':_0x2793('0x189')});db[_0x2793('0x55')][_0x2793('0x125')](db[_0x2793('0x163')],{'as':_0x2793('0x164'),'foreignKey':'ContactId'});db[_0x2793('0x55')][_0x2793('0x125')](db[_0x2793('0x13')],{'as':_0x2793('0x186'),'foreignKey':'UserId'});db['SmsInteraction'][_0x2793('0x128')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x2793('0x175')});db[_0x2793('0x55')][_0x2793('0x128')](db[_0x2793('0x8b')],{'through':_0x2793('0x18b'),'as':_0x2793('0x176')});db['SmsInteraction']['belongsToMany'](db['User'],{'as':_0x2793('0x177'),'through':_0x2793('0x130'),'foreignKey':_0x2793('0x18c')});db[_0x2793('0x57')][_0x2793('0x125')](db['User'],{'as':'User'});db[_0x2793('0x57')][_0x2793('0x125')](db[_0x2793('0x163')],{'onDelete':_0x2793('0x116'),'as':_0x2793('0x164')});db[_0x2793('0x57')][_0x2793('0x125')](db['SmsInteraction'],{'onDelete':_0x2793('0x116'),'as':_0x2793('0x179'),'foreignKey':_0x2793('0x18c')});db[_0x2793('0x57')][_0x2793('0x125')](db['SmsAccount'],{'as':'Account','foreignKey':_0x2793('0x189')});db[_0x2793('0x59')]['belongsToMany'](db[_0x2793('0x13')],{'as':_0x2793('0x159'),'through':_0x2793('0x35'),'foreignKey':_0x2793('0x18d')});db['SmsQueue'][_0x2793('0x128')](db[_0x2793('0xe5')],{'through':_0x2793('0x18e'),'as':_0x2793('0x15a')});db['OpenchannelAccount']['hasMany'](db['Disposition'],{'as':_0x2793('0x16c'),'foreignKey':_0x2793('0x18f'),'onDelete':_0x2793('0x116')});db[_0x2793('0x5b')][_0x2793('0x118')](db[_0x2793('0x16d')],{'as':_0x2793('0x16e'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x2793('0x118')](db['OpenchannelInteraction'],{'as':_0x2793('0x16f'),'foreignKey':_0x2793('0x18f')});db['OpenchannelAccount']['hasMany'](db[_0x2793('0x60')],{'as':'Messages','foreignKey':_0x2793('0x18f')});db[_0x2793('0x5b')]['hasMany'](db[_0x2793('0x190')],{'as':_0x2793('0x145'),'foreignKey':_0x2793('0x18f')});db[_0x2793('0x5b')][_0x2793('0x125')](db[_0x2793('0xf9')],{'as':_0x2793('0x170'),'foreignKey':_0x2793('0x17e')});db[_0x2793('0x5b')][_0x2793('0x125')](db['Pause'],{'as':_0x2793('0x156'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x2793('0x5b')]['belongsToMany'](db[_0x2793('0x13')],{'as':_0x2793('0x159'),'through':_0x2793('0x191')});db['OpenchannelApplication']['belongsTo'](db['User'],{'onDelete':'restrict'});db[_0x2793('0x190')][_0x2793('0x125')](db['OpenchannelQueue'],{'onDelete':_0x2793('0x169'),'foreignKey':'OpenchannelQueueId'});db[_0x2793('0x190')]['belongsTo'](db[_0x2793('0x5b')],{'onDelete':_0x2793('0x169'),'foreignKey':_0x2793('0x18f')});db['OpenchannelApplication'][_0x2793('0x125')](db[_0x2793('0x155')],{'onDelete':'restrict','foreignKey':_0x2793('0x17d')});db[_0x2793('0x190')][_0x2793('0x125')](db[_0x2793('0x8b')],{'onDelete':_0x2793('0x169'),'foreignKey':_0x2793('0x184')});db['OpenchannelInteraction']['hasMany'](db['OpenchannelMessage'],{'as':_0x2793('0x15d'),'onDelete':'cascade','foreignKey':_0x2793('0x192')});db[_0x2793('0x5e')][_0x2793('0x125')](db[_0x2793('0x5b')],{'as':_0x2793('0x173'),'foreignKey':_0x2793('0x18f')});db[_0x2793('0x5e')][_0x2793('0x125')](db['CmContact'],{'as':'Contact','foreignKey':_0x2793('0x17f')});db[_0x2793('0x5e')][_0x2793('0x125')](db[_0x2793('0x13')],{'as':_0x2793('0x186'),'foreignKey':_0x2793('0x117')});db['OpenchannelInteraction'][_0x2793('0x128')](db[_0x2793('0x8b')],{'through':_0x2793('0x193'),'as':_0x2793('0x175')});db[_0x2793('0x5e')][_0x2793('0x128')](db[_0x2793('0x8b')],{'through':_0x2793('0x193'),'as':'ThroughTags'});db[_0x2793('0x5e')][_0x2793('0x128')](db['User'],{'as':'Users','through':_0x2793('0x131'),'foreignKey':_0x2793('0x192')});db[_0x2793('0x60')]['belongsTo'](db['User'],{'onDelete':_0x2793('0x116'),'as':_0x2793('0x13')});db[_0x2793('0x60')][_0x2793('0x125')](db[_0x2793('0x163')],{'onDelete':'cascade','as':_0x2793('0x164')});db[_0x2793('0x60')]['belongsTo'](db[_0x2793('0x5e')],{'onDelete':_0x2793('0x116'),'as':_0x2793('0x179'),'foreignKey':_0x2793('0x192')});db[_0x2793('0x60')][_0x2793('0x125')](db[_0x2793('0xec')],{'as':_0x2793('0xec'),'foreignKey':'AttachmentId'});db[_0x2793('0x60')]['belongsTo'](db[_0x2793('0x5b')],{'as':_0x2793('0x173'),'foreignKey':'OpenchannelAccountId'});db[_0x2793('0x62')][_0x2793('0x128')](db[_0x2793('0x13')],{'as':_0x2793('0x159'),'through':_0x2793('0x37'),'foreignKey':_0x2793('0x194')});db[_0x2793('0x62')][_0x2793('0x128')](db[_0x2793('0xe5')],{'through':_0x2793('0x195'),'as':_0x2793('0x15a')});db[_0x2793('0x64')][_0x2793('0x118')](db[_0x2793('0x80')],{'as':_0x2793('0x16c'),'foreignKey':'ChatWebsiteId','onDelete':'cascade'});db[_0x2793('0x64')][_0x2793('0x118')](db[_0x2793('0x16d')],{'as':_0x2793('0x16e'),'foreignKey':_0x2793('0x17a')});db[_0x2793('0x64')][_0x2793('0x118')](db[_0x2793('0x196')],{'as':'ProactiveActions'});db[_0x2793('0x64')][_0x2793('0x118')](db[_0x2793('0x69')],{'as':_0x2793('0x16f')});db[_0x2793('0x64')][_0x2793('0x118')](db['ChatApplication'],{'as':'Applications'});db[_0x2793('0x64')][_0x2793('0x118')](db[_0x2793('0x6b')],{'as':'Messages'});db[_0x2793('0x64')][_0x2793('0x125')](db[_0x2793('0xf9')],{'as':_0x2793('0x170'),'foreignKey':_0x2793('0x17e')});db[_0x2793('0x64')][_0x2793('0x125')](db['Interval'],{'as':_0x2793('0x155'),'foreignKey':_0x2793('0x17d')});db[_0x2793('0x64')][_0x2793('0x125')](db[_0x2793('0x165')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x2793('0x64')][_0x2793('0x125')](db['Pause'],{'as':_0x2793('0x156'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x2793('0x64')][_0x2793('0x128')](db[_0x2793('0x13')],{'as':'Agents','through':_0x2793('0x13b')});db['OpenchannelQueueReport'][_0x2793('0x125')](db[_0x2793('0x5b')],{});db[_0x2793('0x66')][_0x2793('0x125')](db[_0x2793('0xf9')],{'as':_0x2793('0x170'),'foreignKey':_0x2793('0x17e')});db['OpenchannelQueueReport'][_0x2793('0x125')](db[_0x2793('0x163')],{'as':_0x2793('0x164'),'foreignKey':_0x2793('0x17f')});db['OpenchannelQueueReport'][_0x2793('0x125')](db[_0x2793('0x5e')],{});db[_0x2793('0x66')]['belongsTo'](db['OpenchannelMessage'],{});db[_0x2793('0x66')]['belongsTo'](db[_0x2793('0x13')],{});db[_0x2793('0x66')][_0x2793('0x125')](db[_0x2793('0x62')],{});db[_0x2793('0x197')][_0x2793('0x125')](db[_0x2793('0x13')],{'as':_0x2793('0x198'),'foreignKey':_0x2793('0x117'),'onDelete':_0x2793('0x169')});db[_0x2793('0x197')]['belongsTo'](db[_0x2793('0x6e')],{'as':_0x2793('0x199'),'foreignKey':'ChatQueueId','onDelete':'restrict'});db[_0x2793('0x197')]['belongsTo'](db[_0x2793('0x64')],{'as':_0x2793('0x19a'),'foreignKey':'ChatWebsiteId','onDelete':_0x2793('0x169')});db['ChatApplication'][_0x2793('0x125')](db['Tag'],{'onDelete':_0x2793('0x169'),'foreignKey':_0x2793('0x184')});db[_0x2793('0x69')][_0x2793('0x118')](db['ChatMessage'],{'as':_0x2793('0x15d'),'onDelete':'cascade','foreignKey':'ChatInteractionId'});db[_0x2793('0x69')][_0x2793('0x125')](db[_0x2793('0x64')],{'as':_0x2793('0x173'),'foreignKey':'ChatWebsiteId'});db[_0x2793('0x69')][_0x2793('0x125')](db[_0x2793('0x163')],{'as':_0x2793('0x164'),'foreignKey':_0x2793('0x17f')});db[_0x2793('0x69')]['belongsTo'](db[_0x2793('0x13')],{'as':_0x2793('0x186'),'foreignKey':'UserId'});db['ChatInteraction'][_0x2793('0x128')](db[_0x2793('0x8b')],{'through':_0x2793('0x19b'),'as':_0x2793('0x175')});db['ChatInteraction'][_0x2793('0x128')](db[_0x2793('0x8b')],{'through':_0x2793('0x19b'),'as':_0x2793('0x176')});db[_0x2793('0x69')][_0x2793('0x128')](db[_0x2793('0x13')],{'as':'Users','through':_0x2793('0x12e'),'foreignKey':_0x2793('0x19c')});db[_0x2793('0x6b')][_0x2793('0x125')](db[_0x2793('0x13')],{'onDelete':_0x2793('0x116'),'as':_0x2793('0x13')});db['ChatMessage'][_0x2793('0x125')](db[_0x2793('0x163')],{'onDelete':'cascade','as':_0x2793('0x164'),'foreignKey':_0x2793('0x17f')});db[_0x2793('0x6b')][_0x2793('0x125')](db[_0x2793('0x69')],{'onDelete':_0x2793('0x116'),'as':_0x2793('0x179'),'foreignKey':_0x2793('0x19c')});db[_0x2793('0x6b')]['belongsTo'](db['Attachment'],{'as':_0x2793('0xec'),'foreignKey':'AttachmentId'});db[_0x2793('0x6b')][_0x2793('0x125')](db['ChatWebsite'],{'as':_0x2793('0x173'),'foreignKey':_0x2793('0x17a')});db[_0x2793('0x6c')][_0x2793('0x118')](db['Attachment'],{'as':_0x2793('0x19d'),'foreignKey':_0x2793('0x17b'),'onDelete':_0x2793('0x116'),'hooks':!![]});db['ChatOfflineMessage'][_0x2793('0x125')](db['CmContact'],{'onDelete':_0x2793('0x116'),'as':_0x2793('0x164'),'foreignKey':_0x2793('0x17f')});db[_0x2793('0x6c')][_0x2793('0x125')](db[_0x2793('0x64')],{'as':_0x2793('0x173'),'foreignKey':_0x2793('0x17a')});db[_0x2793('0x6e')][_0x2793('0x128')](db[_0x2793('0x13')],{'as':_0x2793('0x159'),'through':_0x2793('0x2f'),'hooks':!![]});db[_0x2793('0x6e')][_0x2793('0x128')](db[_0x2793('0xe5')],{'through':'team_has_chat_queues','as':_0x2793('0x15a')});db[_0x2793('0x70')][_0x2793('0x118')](db[_0x2793('0xd0')],{'as':'Messages','foreignKey':_0x2793('0x19e'),'onDelete':_0x2793('0x116')});db[_0x2793('0x70')]['belongsToMany'](db[_0x2793('0x13')],{'as':_0x2793('0x149'),'through':_0x2793('0x19f')});db[_0x2793('0x196')][_0x2793('0x125')](db[_0x2793('0x64')],{'as':_0x2793('0x19a'),'foreignKey':_0x2793('0x17a')});db['CmCompany'][_0x2793('0x118')](db[_0x2793('0x163')],{'as':_0x2793('0x129'),'foreignKey':'CompanyId'});db[_0x2793('0x163')][_0x2793('0x118')](db['CmContactHasItem'],{'as':_0x2793('0x1a0'),'foreignKey':'CmContactId'});db['CmContact']['hasMany'](db[_0x2793('0x14b')],{'as':_0x2793('0x14c'),'foreignKey':_0x2793('0x17f')});db[_0x2793('0x163')][_0x2793('0x118')](db[_0x2793('0x76')],{'as':_0x2793('0x14d'),'foreignKey':'ContactId'});db['CmContact'][_0x2793('0x118')](db['CmHopperHistory'],{'as':_0x2793('0x14f'),'foreignKey':'ContactId'});db[_0x2793('0x163')][_0x2793('0x118')](db[_0x2793('0x11c')],{'as':'ReportAgentPreview','foreignKey':_0x2793('0x17f')});db[_0x2793('0x163')][_0x2793('0x118')](db[_0x2793('0xd6')],{'as':_0x2793('0x1a1'),'foreignKey':_0x2793('0x17f')});db[_0x2793('0x163')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x2793('0x11d'),'foreignKey':_0x2793('0x17f'),'onDelete':_0x2793('0x169')});db[_0x2793('0x163')][_0x2793('0x118')](db[_0x2793('0x69')],{'as':_0x2793('0x11e'),'foreignKey':'ContactId','onDelete':_0x2793('0x169')});db['CmContact'][_0x2793('0x118')](db[_0x2793('0x55')],{'as':'SmsInteractions','foreignKey':'ContactId','onDelete':_0x2793('0x169')});db[_0x2793('0x163')][_0x2793('0x118')](db[_0x2793('0x4c')],{'as':'FaxInteractions','foreignKey':_0x2793('0x17f'),'onDelete':_0x2793('0x169')});db[_0x2793('0x163')][_0x2793('0x118')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0x2793('0x17f'),'onDelete':_0x2793('0x169')});db[_0x2793('0x163')][_0x2793('0x125')](db[_0x2793('0x1a2')],{'as':_0x2793('0x1a3'),'foreignKey':'CompanyId'});db['CmContact']['belongsTo'](db[_0x2793('0xf9')],{'as':_0x2793('0x170'),'foreignKey':_0x2793('0x17e'),'onDelete':'cascade'});db['CmContact'][_0x2793('0x128')](db[_0x2793('0x13')],{'as':'Users','through':_0x2793('0x12a')});db[_0x2793('0x163')]['belongsToMany'](db[_0x2793('0x8b')],{'as':_0x2793('0x175'),'through':_0x2793('0x1a4')});db[_0x2793('0x163')]['belongsToMany'](db[_0x2793('0x8b')],{'through':'cm_contact_has_tags','as':_0x2793('0x176')});db[_0x2793('0x14b')][_0x2793('0x118')](db['CmHopperAdditionalPhone'],{'as':_0x2793('0x1a5'),'foreignKey':_0x2793('0x1a6')});db[_0x2793('0x14b')][_0x2793('0x125')](db[_0x2793('0x163')],{'as':_0x2793('0x164'),'foreignKey':_0x2793('0x17f'),'onDelete':'cascade'});db['CmHopper'][_0x2793('0x125')](db[_0x2793('0xf9')],{'as':_0x2793('0x170'),'foreignKey':_0x2793('0x17e'),'onDelete':_0x2793('0x116')});db[_0x2793('0x14b')]['belongsTo'](db[_0x2793('0x13')],{'as':'Agent','foreignKey':'UserId'});db[_0x2793('0x14b')]['belongsTo'](db[_0x2793('0x1b')],{'as':_0x2793('0x199'),'foreignKey':'VoiceQueueId','onDelete':_0x2793('0x116')});db[_0x2793('0x14b')][_0x2793('0x125')](db['Campaign'],{'as':_0x2793('0xe8'),'foreignKey':_0x2793('0x1a7'),'onDelete':_0x2793('0x116')});db['CmHopper'][_0x2793('0x125')](db[_0x2793('0x13')],{'as':_0x2793('0x186'),'foreignKey':_0x2793('0x1a8')});db[_0x2793('0x150')]['belongsTo'](db[_0x2793('0x163')],{'as':_0x2793('0x164'),'foreignKey':_0x2793('0x17f'),'onDelete':_0x2793('0x116')});db[_0x2793('0x150')][_0x2793('0x125')](db['CmList'],{'as':_0x2793('0x170'),'foreignKey':'ListId','onDelete':_0x2793('0x116')});db['CmHopperBlack'][_0x2793('0x125')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x2793('0x14a'),'onDelete':_0x2793('0x116')});db[_0x2793('0x150')][_0x2793('0x125')](db[_0x2793('0xe8')],{'as':_0x2793('0xe8'),'foreignKey':'CampaignId','onDelete':_0x2793('0x116')});db[_0x2793('0x7d')][_0x2793('0x118')](db[_0x2793('0x82')],{'as':{'plural':_0x2793('0x1a9'),'singular':'OneAll'},'foreignKey':_0x2793('0x1aa'),'onDelete':'cascade','hooks':!![]});db[_0x2793('0x7d')][_0x2793('0x118')](db[_0x2793('0x82')],{'as':{'plural':_0x2793('0x1ab'),'singular':_0x2793('0x1ac')},'foreignKey':_0x2793('0x1ad'),'onDelete':_0x2793('0x116'),'hooks':!![]});db[_0x2793('0x7d')][_0x2793('0x118')](db['Action'],{'as':_0x2793('0x1ae'),'foreignKey':'AutomationId','onDelete':_0x2793('0x116'),'hooks':!![]});db[_0x2793('0x80')]['hasMany'](db[_0x2793('0x80')],{'as':_0x2793('0x16c'),'foreignKey':_0x2793('0x1af'),'onDelete':_0x2793('0x116')});db[_0x2793('0x155')][_0x2793('0x118')](db['Interval'],{'as':_0x2793('0x1b0'),'foreignKey':'IntervalId','onDelete':_0x2793('0x116'),'hooks':!![],'required':![]});db[_0x2793('0x155')]['hasMany'](db[_0x2793('0x19')],{'as':_0x2793('0x1b1'),'foreignKey':_0x2793('0x17d'),'onDelete':'restrict'});db['Interval'][_0x2793('0x118')](db[_0x2793('0x17c')],{'as':_0x2793('0x1b2'),'foreignKey':_0x2793('0x17d')});db[_0x2793('0x155')]['hasMany'](db[_0x2793('0x197')],{'as':'ChatApplications','foreignKey':_0x2793('0x17d')});db[_0x2793('0x155')][_0x2793('0x118')](db['FaxApplication'],{'as':_0x2793('0x1b3'),'foreignKey':_0x2793('0x17d')});db[_0x2793('0x155')]['hasMany'](db[_0x2793('0x18a')],{'as':_0x2793('0x1b4'),'foreignKey':_0x2793('0x17d')});db[_0x2793('0x88')][_0x2793('0x125')](db[_0x2793('0x165')],{});db['Schedule']['belongsTo'](db[_0x2793('0x9b')],{'foreignKey':_0x2793('0x1b5')});db[_0x2793('0x88')]['belongsTo'](db[_0x2793('0x99')],{'foreignKey':_0x2793('0x1b6')});db[_0x2793('0x146')]['belongsToMany'](db[_0x2793('0x1b7')],{'as':'Mohs','through':_0x2793('0x148'),'onDelete':_0x2793('0x169')});db[_0x2793('0x8b')][_0x2793('0x128')](db['CmContact'],{'through':'cm_contact_has_tags'});db[_0x2793('0x8b')][_0x2793('0x128')](db[_0x2793('0x69')],{'through':_0x2793('0x19b')});db[_0x2793('0x8b')][_0x2793('0x128')](db[_0x2793('0x40')],{'through':_0x2793('0x174')});db[_0x2793('0x8b')]['belongsToMany'](db[_0x2793('0x55')],{'through':'sms_interaction_has_tags'});db['Tag'][_0x2793('0x128')](db[_0x2793('0x4c')],{'through':_0x2793('0x187')});db['Tag'][_0x2793('0x128')](db[_0x2793('0x5e')],{'through':_0x2793('0x193')});db['Tag'][_0x2793('0x128')](db[_0x2793('0x107')],{'through':_0x2793('0x1b8')});db['CmContactHasItem'][_0x2793('0x125')](db[_0x2793('0x1b9')],{'as':_0x2793('0x1ba'),'foreignKey':_0x2793('0x1bb')});db[_0x2793('0x8f')]['belongsTo'](db[_0x2793('0x14b')],{'as':_0x2793('0x1bc'),'foreignKey':_0x2793('0x1a6')});db[_0x2793('0x8d')][_0x2793('0x125')](db['CmContact'],{'as':'Contact','foreignKey':_0x2793('0x1bd')});db[_0x2793('0x1be')][_0x2793('0x118')](db['Condition'],{'as':{'plural':_0x2793('0x1bf'),'singular':_0x2793('0x1c0')},'foreignKey':_0x2793('0x1c1'),'onDelete':_0x2793('0x116'),'hooks':!![]});db[_0x2793('0x1be')][_0x2793('0x118')](db[_0x2793('0x82')],{'as':{'plural':_0x2793('0x1c2'),'singular':_0x2793('0x1c3')},'foreignKey':_0x2793('0x1c4'),'onDelete':_0x2793('0x116'),'hooks':!![]});db['Trigger'][_0x2793('0x118')](db[_0x2793('0x7b')],{'as':_0x2793('0x1ae'),'foreignKey':'TriggerId','onDelete':'cascade','hooks':!![]});db[_0x2793('0x99')][_0x2793('0x118')](db[_0x2793('0x1c5')],{'as':_0x2793('0x1c6'),'onDelete':_0x2793('0x116'),'foreignKey':_0x2793('0x1b6'),'hooks':!![]});db['AnalyticDefaultReport'][_0x2793('0x118')](db[_0x2793('0x1c5')],{'as':_0x2793('0x1c6'),'onDelete':_0x2793('0x116'),'foreignKey':_0x2793('0x1b5')});db['AnalyticMetric'][_0x2793('0x118')](db['AnalyticFieldReport'],{'as':_0x2793('0x1c6'),'onDelete':_0x2793('0x116'),'foreignKey':_0x2793('0x1c7')});db[_0x2793('0x1c5')][_0x2793('0x125')](db[_0x2793('0x1c8')],{'foreignKey':'MetricId'});db['SalesforceAccount']['hasMany'](db[_0x2793('0xa2')],{'as':_0x2793('0x1c9'),'onDelete':_0x2793('0x116'),'foreignKey':_0x2793('0x1ca')});db[_0x2793('0xa2')][_0x2793('0x118')](db[_0x2793('0x1cb')],{'as':_0x2793('0x1cc'),'onDelete':_0x2793('0x116'),'foreignKey':_0x2793('0x1cd')});db[_0x2793('0xa2')]['hasMany'](db[_0x2793('0x1cb')],{'as':_0x2793('0x1ce'),'onDelete':_0x2793('0x116'),'foreignKey':_0x2793('0x1cf')});db[_0x2793('0xa2')][_0x2793('0x118')](db['SalesforceField'],{'as':_0x2793('0x1c6'),'onDelete':'cascade','foreignKey':_0x2793('0x1d0')});db[_0x2793('0xa2')][_0x2793('0x125')](db[_0x2793('0xa0')],{'as':_0x2793('0x173'),'foreignKey':'AccountId'});db[_0x2793('0x1cb')]['hasMany'](db['SalesforceField'],{'as':'Subject','foreignKey':_0x2793('0x1cd')});db[_0x2793('0x1cb')]['hasMany'](db[_0x2793('0x1cb')],{'as':_0x2793('0x1d1'),'foreignKey':_0x2793('0x1cf')});db[_0x2793('0x1cb')]['hasMany'](db['SalesforceField'],{'as':'Field','foreignKey':'FieldId'});db[_0x2793('0x1cb')]['belongsTo'](db['Variable'],{'as':_0x2793('0x94'),'foreignKey':_0x2793('0x1d2')});db['SugarcrmAccount'][_0x2793('0x118')](db[_0x2793('0xa6')],{'as':_0x2793('0x1c9'),'onDelete':_0x2793('0x116'),'foreignKey':_0x2793('0x1ca')});db[_0x2793('0xa6')][_0x2793('0x118')](db[_0x2793('0xa7')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x2793('0x1cd')});db[_0x2793('0xa6')][_0x2793('0x118')](db[_0x2793('0xa7')],{'as':_0x2793('0x1ce'),'onDelete':'cascade','foreignKey':_0x2793('0x1cf')});db['SugarcrmConfiguration']['hasMany'](db[_0x2793('0xa7')],{'as':_0x2793('0x1c6'),'onDelete':'cascade','foreignKey':_0x2793('0x1d0')});db['SugarcrmConfiguration'][_0x2793('0x125')](db[_0x2793('0xa5')],{'as':_0x2793('0x173'),'foreignKey':_0x2793('0x1ca')});db[_0x2793('0xa7')][_0x2793('0x118')](db[_0x2793('0xa7')],{'as':_0x2793('0x1d3'),'foreignKey':_0x2793('0x1cd')});db[_0x2793('0xa7')]['hasMany'](db['SugarcrmField'],{'as':_0x2793('0x1d1'),'foreignKey':_0x2793('0x1cf')});db[_0x2793('0xa7')]['hasMany'](db[_0x2793('0xa7')],{'as':_0x2793('0x1d4'),'foreignKey':_0x2793('0x1d0')});db[_0x2793('0xa7')]['belongsTo'](db['Variable'],{'as':_0x2793('0x94'),'foreignKey':'VariableId'});db[_0x2793('0xa8')][_0x2793('0x118')](db['DeskConfiguration'],{'as':_0x2793('0x1c9'),'onDelete':_0x2793('0x116'),'foreignKey':'AccountId'});db[_0x2793('0xaa')][_0x2793('0x118')](db[_0x2793('0x1d5')],{'as':_0x2793('0x1cc'),'onDelete':'cascade','foreignKey':_0x2793('0x1cd')});db[_0x2793('0xaa')][_0x2793('0x118')](db[_0x2793('0x1d5')],{'as':'Descriptions','onDelete':_0x2793('0x116'),'foreignKey':'DescriptionId'});db[_0x2793('0xaa')][_0x2793('0x118')](db['DeskField'],{'as':_0x2793('0x1c6'),'onDelete':_0x2793('0x116'),'foreignKey':_0x2793('0x1d0')});db['DeskConfiguration']['belongsTo'](db[_0x2793('0xa8')],{'as':_0x2793('0x173'),'foreignKey':_0x2793('0x1ca')});db['DeskConfiguration'][_0x2793('0x128')](db[_0x2793('0x8b')],{'through':'int_desk_configuration_has_tags'});db[_0x2793('0x1d5')][_0x2793('0x118')](db[_0x2793('0x1d5')],{'as':_0x2793('0x1d3'),'foreignKey':'SubjectId'});db[_0x2793('0x1d5')][_0x2793('0x118')](db[_0x2793('0x1d5')],{'as':_0x2793('0x1d1'),'foreignKey':_0x2793('0x1cf')});db['DeskField']['hasMany'](db[_0x2793('0x1d5')],{'as':_0x2793('0x1d4'),'foreignKey':'FieldId'});db[_0x2793('0x1d5')][_0x2793('0x125')](db[_0x2793('0x94')],{'as':_0x2793('0x94'),'foreignKey':_0x2793('0x1d2')});db[_0x2793('0x1d6')]['hasMany'](db[_0x2793('0xad')],{'as':_0x2793('0x1c9'),'onDelete':_0x2793('0x116'),'foreignKey':_0x2793('0x1ca')});db['ZohoConfiguration'][_0x2793('0x118')](db[_0x2793('0x1d7')],{'as':_0x2793('0x1cc'),'onDelete':_0x2793('0x116'),'foreignKey':_0x2793('0x1cd')});db['ZohoConfiguration'][_0x2793('0x118')](db[_0x2793('0x1d7')],{'as':_0x2793('0x1ce'),'onDelete':_0x2793('0x116'),'foreignKey':_0x2793('0x1cf')});db[_0x2793('0xad')][_0x2793('0x118')](db[_0x2793('0x1d7')],{'as':_0x2793('0x1c6'),'onDelete':_0x2793('0x116'),'foreignKey':_0x2793('0x1d0')});db['ZohoConfiguration'][_0x2793('0x125')](db['ZohoAccount'],{'as':_0x2793('0x173'),'foreignKey':_0x2793('0x1ca')});db[_0x2793('0x1d7')]['hasMany'](db[_0x2793('0x1d7')],{'as':_0x2793('0x1d3'),'foreignKey':'SubjectId'});db['ZohoField'][_0x2793('0x118')](db[_0x2793('0x1d7')],{'as':_0x2793('0x1d1'),'foreignKey':_0x2793('0x1cf')});db[_0x2793('0x1d7')]['hasMany'](db[_0x2793('0x1d7')],{'as':_0x2793('0x1d4'),'foreignKey':_0x2793('0x1d0')});db[_0x2793('0x1d7')]['belongsTo'](db[_0x2793('0x94')],{'as':_0x2793('0x94'),'foreignKey':_0x2793('0x1d2')});db[_0x2793('0xaf')][_0x2793('0x118')](db[_0x2793('0xb1')],{'as':'Configurations','onDelete':_0x2793('0x116'),'foreignKey':'AccountId'});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0x2793('0x1cc'),'foreignKey':_0x2793('0x1cd')});db[_0x2793('0xb1')][_0x2793('0x118')](db['ZendeskField'],{'as':'Descriptions','foreignKey':_0x2793('0x1cf')});db[_0x2793('0xb1')][_0x2793('0x118')](db[_0x2793('0x1d8')],{'as':_0x2793('0x1c6'),'foreignKey':_0x2793('0x1d0')});db[_0x2793('0xb1')][_0x2793('0x125')](db[_0x2793('0xaf')],{'as':_0x2793('0x173'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x2793('0x128')](db['Tag'],{'through':_0x2793('0x1d9')});db[_0x2793('0x1d8')][_0x2793('0x118')](db[_0x2793('0x1d8')],{'as':_0x2793('0x1d3'),'foreignKey':'SubjectId'});db[_0x2793('0x1d8')][_0x2793('0x118')](db[_0x2793('0x1d8')],{'as':_0x2793('0x1d1'),'foreignKey':_0x2793('0x1cf')});db[_0x2793('0x1d8')][_0x2793('0x118')](db[_0x2793('0x1d8')],{'as':_0x2793('0x1d4'),'foreignKey':'FieldId'});db['ZendeskField']['belongsTo'](db[_0x2793('0x94')],{'as':_0x2793('0x94'),'foreignKey':_0x2793('0x1d2')});db[_0x2793('0xb4')][_0x2793('0x118')](db[_0x2793('0xb5')],{'as':'Configurations','onDelete':_0x2793('0x116'),'foreignKey':_0x2793('0x1ca')});db[_0x2793('0xb5')][_0x2793('0x118')](db[_0x2793('0x1da')],{'as':_0x2793('0x1cc'),'onDelete':_0x2793('0x116'),'foreignKey':'SubjectId'});db[_0x2793('0xb5')][_0x2793('0x118')](db[_0x2793('0x1da')],{'as':_0x2793('0x1ce'),'onDelete':_0x2793('0x116'),'foreignKey':_0x2793('0x1cf')});db[_0x2793('0xb5')][_0x2793('0x118')](db['FreshdeskField'],{'as':'Fields','onDelete':_0x2793('0x116'),'foreignKey':'FieldId'});db[_0x2793('0xb5')]['belongsTo'](db['FreshdeskAccount'],{'as':'Account','foreignKey':_0x2793('0x1ca')});db[_0x2793('0xb5')][_0x2793('0x128')](db['Tag'],{'through':_0x2793('0x1db')});db[_0x2793('0x1da')][_0x2793('0x118')](db['FreshdeskField'],{'as':'Subject','foreignKey':_0x2793('0x1cd')});db[_0x2793('0x1da')][_0x2793('0x118')](db[_0x2793('0x1da')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x2793('0x1da')][_0x2793('0x118')](db['FreshdeskField'],{'as':_0x2793('0x1d4'),'foreignKey':_0x2793('0x1d0')});db[_0x2793('0x1da')][_0x2793('0x125')](db[_0x2793('0x94')],{'as':_0x2793('0x94'),'foreignKey':_0x2793('0x1d2')});db[_0x2793('0xb7')][_0x2793('0x118')](db['VtigerConfiguration'],{'as':_0x2793('0x1c9'),'onDelete':_0x2793('0x116'),'foreignKey':'AccountId'});db[_0x2793('0x1dc')][_0x2793('0x118')](db[_0x2793('0xba')],{'as':'Subjects','foreignKey':_0x2793('0x1cd')});db['VtigerConfiguration'][_0x2793('0x118')](db[_0x2793('0xba')],{'as':_0x2793('0x1ce'),'foreignKey':_0x2793('0x1cf')});db[_0x2793('0x1dc')]['hasMany'](db[_0x2793('0xba')],{'as':_0x2793('0x1c6'),'foreignKey':_0x2793('0x1d0')});db['VtigerConfiguration'][_0x2793('0x125')](db[_0x2793('0xb7')],{'as':'Account','foreignKey':_0x2793('0x1ca')});db[_0x2793('0xba')][_0x2793('0x118')](db[_0x2793('0xba')],{'as':_0x2793('0x1d3'),'foreignKey':'SubjectId'});db[_0x2793('0xba')]['hasMany'](db['VtigerField'],{'as':_0x2793('0x1d1'),'foreignKey':_0x2793('0x1cf')});db[_0x2793('0xba')][_0x2793('0x118')](db[_0x2793('0xba')],{'as':'Field','foreignKey':'FieldId'});db['VtigerField']['belongsTo'](db[_0x2793('0x94')],{'as':_0x2793('0x94'),'foreignKey':'VariableId'});db[_0x2793('0xbc')][_0x2793('0x118')](db[_0x2793('0xbe')],{'as':'Configurations','onDelete':_0x2793('0x116'),'foreignKey':'AccountId'});db[_0x2793('0xbe')][_0x2793('0x118')](db[_0x2793('0xbf')],{'as':_0x2793('0x1cc'),'foreignKey':_0x2793('0x1cd')});db['ServicenowConfiguration'][_0x2793('0x118')](db['ServicenowField'],{'as':_0x2793('0x1ce'),'foreignKey':'DescriptionId'});db[_0x2793('0xbe')]['hasMany'](db[_0x2793('0xbf')],{'as':_0x2793('0x1c6'),'foreignKey':'FieldId'});db['ServicenowConfiguration'][_0x2793('0x125')](db[_0x2793('0xbc')],{'as':_0x2793('0x173'),'foreignKey':_0x2793('0x1ca')});db[_0x2793('0xbf')][_0x2793('0x118')](db[_0x2793('0xbf')],{'as':_0x2793('0x1d3'),'foreignKey':_0x2793('0x1cd')});db[_0x2793('0xbf')][_0x2793('0x118')](db[_0x2793('0xbf')],{'as':_0x2793('0x1d1'),'foreignKey':'DescriptionId'});db[_0x2793('0xbf')][_0x2793('0x118')](db[_0x2793('0xbf')],{'as':_0x2793('0x1d4'),'foreignKey':_0x2793('0x1d0')});db[_0x2793('0xbf')][_0x2793('0x125')](db['Variable'],{'as':_0x2793('0x94'),'foreignKey':_0x2793('0x1d2')});db['Dynamics365Account'][_0x2793('0x118')](db[_0x2793('0x1dd')],{'as':_0x2793('0x1c9'),'onDelete':'cascade','foreignKey':_0x2793('0x1ca')});db['Dynamics365Account'][_0x2793('0x125')](db[_0x2793('0x110')],{'as':_0x2793('0x110'),'foreignKey':_0x2793('0x168')});db[_0x2793('0x1dd')][_0x2793('0x118')](db[_0x2793('0xc4')],{'as':_0x2793('0x1cc'),'onDelete':_0x2793('0x116'),'foreignKey':_0x2793('0x1cd')});db['Dynamics365Configuration'][_0x2793('0x118')](db[_0x2793('0xc4')],{'as':_0x2793('0x1ce'),'onDelete':_0x2793('0x116'),'foreignKey':_0x2793('0x1cf')});db['Dynamics365Configuration'][_0x2793('0x118')](db[_0x2793('0xc4')],{'as':_0x2793('0x1c6'),'onDelete':_0x2793('0x116'),'foreignKey':_0x2793('0x1d0')});db[_0x2793('0x1dd')][_0x2793('0x125')](db[_0x2793('0xc1')],{'as':_0x2793('0x173'),'foreignKey':_0x2793('0x1ca')});db[_0x2793('0xc4')][_0x2793('0x118')](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0x2793('0x1cd')});db['Dynamics365Field'][_0x2793('0x118')](db['Dynamics365Field'],{'as':_0x2793('0x1d1'),'foreignKey':_0x2793('0x1cf')});db[_0x2793('0xc4')]['hasMany'](db[_0x2793('0xc4')],{'as':'Field','foreignKey':_0x2793('0x1d0')});db[_0x2793('0xc4')][_0x2793('0x125')](db['Variable'],{'as':'Variable','foreignKey':_0x2793('0x1d2')});db[_0x2793('0xc6')]['hasMany'](db[_0x2793('0xc8')],{'as':_0x2793('0x1c9'),'onDelete':_0x2793('0x116'),'foreignKey':_0x2793('0x1ca')});db[_0x2793('0xc8')][_0x2793('0x118')](db[_0x2793('0xca')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x2793('0xc8')]['hasMany'](db[_0x2793('0xca')],{'as':'Descriptions','foreignKey':_0x2793('0x1cf')});db['FreshsalesConfiguration'][_0x2793('0x118')](db[_0x2793('0xca')],{'as':'Fields','foreignKey':'FieldId'});db['FreshsalesConfiguration'][_0x2793('0x125')](db[_0x2793('0xc6')],{'as':_0x2793('0x173'),'foreignKey':_0x2793('0x1ca')});db[_0x2793('0xca')]['hasMany'](db['FreshsalesField'],{'as':_0x2793('0x1d3'),'foreignKey':'SubjectId'});db['FreshsalesField'][_0x2793('0x118')](db[_0x2793('0xca')],{'as':'Description','foreignKey':'DescriptionId'});db['FreshsalesField'][_0x2793('0x118')](db[_0x2793('0xca')],{'as':'Field','foreignKey':'FieldId'});db[_0x2793('0xca')][_0x2793('0x125')](db[_0x2793('0x94')],{'as':_0x2793('0x94'),'foreignKey':'VariableId'});db['ChatQueueReport'][_0x2793('0x125')](db[_0x2793('0x64')],{});db[_0x2793('0xce')][_0x2793('0x125')](db[_0x2793('0xf9')],{'as':_0x2793('0x170'),'foreignKey':_0x2793('0x17e')});db[_0x2793('0xce')][_0x2793('0x125')](db[_0x2793('0x163')],{'as':'Contact','foreignKey':_0x2793('0x17f')});db['ChatQueueReport'][_0x2793('0x125')](db['ChatInteraction'],{});db['ChatQueueReport'][_0x2793('0x125')](db['ChatMessage'],{});db[_0x2793('0xce')][_0x2793('0x125')](db['User'],{});db[_0x2793('0xce')][_0x2793('0x125')](db['ChatQueue'],{});db[_0x2793('0xd0')][_0x2793('0x125')](db['User'],{'onDelete':_0x2793('0x116'),'foreignKey':_0x2793('0x1de')});db[_0x2793('0xd0')]['belongsTo'](db[_0x2793('0x13')],{'onDelete':'cascade','foreignKey':_0x2793('0x1df')});db[_0x2793('0xd6')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0x2793('0x1e0'),'onDelete':_0x2793('0x116')});db[_0x2793('0xd6')][_0x2793('0x118')](db['JscriptyAnswerReport'],{'foreignKey':_0x2793('0x1e0'),'onDelete':_0x2793('0x116')});db[_0x2793('0x1e1')][_0x2793('0x125')](db[_0x2793('0x53')],{});db['SmsQueueReport'][_0x2793('0x125')](db[_0x2793('0xf9')],{'as':_0x2793('0x170'),'foreignKey':_0x2793('0x17e')});db[_0x2793('0x1e1')][_0x2793('0x125')](db[_0x2793('0x163')],{'as':'Contact','foreignKey':_0x2793('0x17f')});db['SmsQueueReport'][_0x2793('0x125')](db['SmsInteraction'],{});db[_0x2793('0x1e1')][_0x2793('0x125')](db[_0x2793('0x57')],{});db[_0x2793('0x1e1')][_0x2793('0x125')](db[_0x2793('0x13')],{});db[_0x2793('0x1e1')][_0x2793('0x125')](db[_0x2793('0x59')],{});db[_0x2793('0xdb')]['hasMany'](db['JscriptySessionReport'],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x2793('0x118')](db['JscriptyQuestionReport'],{'foreignKey':_0x2793('0x1e2')});db[_0x2793('0xdb')]['hasMany'](db[_0x2793('0xd2')],{'foreignKey':_0x2793('0x1e2')});db['Team'][_0x2793('0x128')](db[_0x2793('0x13')],{'as':_0x2793('0x159'),'through':_0x2793('0x12d')});db['Team'][_0x2793('0x128')](db[_0x2793('0x1b')],{'through':_0x2793('0x15b'),'as':_0x2793('0x1e3')});db['Team']['belongsToMany'](db[_0x2793('0x135')],{'through':_0x2793('0x171'),'as':'MailQueues'});db[_0x2793('0xe5')][_0x2793('0x128')](db[_0x2793('0x6e')],{'through':_0x2793('0x1e4'),'as':_0x2793('0x1e5')});db[_0x2793('0xe5')]['belongsToMany'](db[_0x2793('0x50')],{'through':_0x2793('0x1e6'),'as':_0x2793('0x137')});db['Team']['belongsToMany'](db[_0x2793('0x59')],{'through':_0x2793('0x18e'),'as':'SmsQueues'});db['Team']['belongsToMany'](db[_0x2793('0x62')],{'through':'team_has_openchannel_queues','as':_0x2793('0x1e7')});db[_0x2793('0xe5')]['belongsToMany'](db['WhatsappQueue'],{'through':'team_has_whatsapp_queues','as':_0x2793('0x139')});db[_0x2793('0xe5')][_0x2793('0x128')](db[_0x2793('0xfb')],{'through':_0x2793('0x1e8'),'as':_0x2793('0x133')});db[_0x2793('0xe8')][_0x2793('0x118')](db[_0x2793('0x14b')],{'as':'Hoppers','foreignKey':_0x2793('0x1a7')});db[_0x2793('0xe8')][_0x2793('0x118')](db['CmHopperFinal'],{'as':_0x2793('0x14d'),'foreignKey':_0x2793('0x1a7')});db[_0x2793('0xe8')][_0x2793('0x118')](db[_0x2793('0x14e')],{'as':_0x2793('0x14f'),'foreignKey':_0x2793('0x1a7')});db[_0x2793('0xe8')][_0x2793('0x118')](db[_0x2793('0x150')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x2793('0xe8')][_0x2793('0x125')](db[_0x2793('0x29')],{'as':_0x2793('0x29'),'foreignKey':_0x2793('0x152')});db[_0x2793('0xe8')][_0x2793('0x125')](db[_0x2793('0x29')],{'as':_0x2793('0x153'),'foreignKey':_0x2793('0x154')});db[_0x2793('0xe8')][_0x2793('0x125')](db['Interval'],{'as':'Interval','foreignKey':_0x2793('0x17d')});db[_0x2793('0xe8')][_0x2793('0x125')](db[_0x2793('0xe0')],{'as':_0x2793('0xe0'),'foreignKey':_0x2793('0x1e9')});db[_0x2793('0xe8')][_0x2793('0x128')](db[_0x2793('0xf9')],{'as':_0x2793('0x12b'),'through':_0x2793('0x1ea')});db['Campaign'][_0x2793('0x128')](db[_0x2793('0xf9')],{'as':_0x2793('0x1eb'),'through':_0x2793('0x1ec')});db[_0x2793('0xec')][_0x2793('0x125')](db['ChatOfflineMessage'],{'as':_0x2793('0x6c'),'foreignKey':_0x2793('0x17b')});db[_0x2793('0xf0')]['belongsTo'](db[_0x2793('0x42')],{});db[_0x2793('0xf0')][_0x2793('0x125')](db[_0x2793('0x40')],{});db['MailTransferReport'][_0x2793('0x125')](db[_0x2793('0x165')],{'foreignKey':_0x2793('0x1ed'),'as':_0x2793('0x1ee')});db[_0x2793('0xf0')][_0x2793('0x125')](db[_0x2793('0x13')],{'foreignKey':'FromUserId','as':_0x2793('0x1ef')});db[_0x2793('0xf0')][_0x2793('0x125')](db[_0x2793('0x13')],{'foreignKey':_0x2793('0x1f0'),'as':'ToAgent'});db[_0x2793('0xf0')][_0x2793('0x125')](db[_0x2793('0x135')],{'foreignKey':'ToMailQueueId','as':_0x2793('0x1f1')});db[_0x2793('0xf0')]['belongsTo'](db[_0x2793('0x165')],{'foreignKey':_0x2793('0x1f2'),'as':_0x2793('0x1f3')});db[_0x2793('0xf2')][_0x2793('0x125')](db[_0x2793('0x6b')],{});db[_0x2793('0xf2')][_0x2793('0x125')](db['ChatInteraction'],{});db[_0x2793('0xf2')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x2793('0x1f4'),'as':'FromAccount'});db[_0x2793('0xf2')][_0x2793('0x125')](db[_0x2793('0x13')],{'foreignKey':_0x2793('0x1f5'),'as':_0x2793('0x1ef')});db[_0x2793('0xf2')][_0x2793('0x125')](db[_0x2793('0x13')],{'foreignKey':_0x2793('0x1f0'),'as':'ToAgent'});db[_0x2793('0xf2')][_0x2793('0x125')](db[_0x2793('0x6e')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db[_0x2793('0xf2')][_0x2793('0x125')](db[_0x2793('0x64')],{'foreignKey':'ToChatWebsiteId','as':_0x2793('0x1f3')});db[_0x2793('0xf4')][_0x2793('0x125')](db['FaxMessage'],{});db['FaxTransferReport'][_0x2793('0x125')](db[_0x2793('0x4c')],{});db[_0x2793('0xf4')][_0x2793('0x125')](db['FaxAccount'],{'foreignKey':_0x2793('0x1f6'),'as':_0x2793('0x1ee')});db[_0x2793('0xf4')][_0x2793('0x125')](db['User'],{'foreignKey':'FromUserId','as':_0x2793('0x1ef')});db[_0x2793('0xf4')]['belongsTo'](db['User'],{'foreignKey':_0x2793('0x1f0'),'as':_0x2793('0x1f7')});db[_0x2793('0xf4')][_0x2793('0x125')](db[_0x2793('0x50')],{'foreignKey':_0x2793('0x1f8'),'as':'ToQueue'});db['FaxTransferReport']['belongsTo'](db[_0x2793('0x48')],{'foreignKey':_0x2793('0x1f9'),'as':_0x2793('0x1f3')});db[_0x2793('0xf6')][_0x2793('0x125')](db[_0x2793('0x60')],{});db[_0x2793('0xf6')][_0x2793('0x125')](db['OpenchannelInteraction'],{});db[_0x2793('0xf6')]['belongsTo'](db[_0x2793('0x5b')],{'foreignKey':_0x2793('0x1fa'),'as':'FromAccount'});db[_0x2793('0xf6')][_0x2793('0x125')](db[_0x2793('0x13')],{'foreignKey':_0x2793('0x1f5'),'as':_0x2793('0x1ef')});db[_0x2793('0xf6')]['belongsTo'](db[_0x2793('0x13')],{'foreignKey':'ToUserId','as':_0x2793('0x1f7')});db['OpenchannelTransferReport']['belongsTo'](db[_0x2793('0x62')],{'foreignKey':'ToOpenchannelQueueId','as':_0x2793('0x1f1')});db[_0x2793('0xf6')][_0x2793('0x125')](db[_0x2793('0x5b')],{'foreignKey':_0x2793('0x1fb'),'as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db['SmsMessage'],{});db['SmsTransferReport'][_0x2793('0x125')](db['SmsInteraction'],{});db['SmsTransferReport'][_0x2793('0x125')](db[_0x2793('0x53')],{'foreignKey':_0x2793('0x1fc'),'as':_0x2793('0x1ee')});db[_0x2793('0xf7')][_0x2793('0x125')](db[_0x2793('0x13')],{'foreignKey':_0x2793('0x1f5'),'as':_0x2793('0x1ef')});db[_0x2793('0xf7')]['belongsTo'](db[_0x2793('0x13')],{'foreignKey':_0x2793('0x1f0'),'as':_0x2793('0x1f7')});db[_0x2793('0xf7')][_0x2793('0x125')](db[_0x2793('0x59')],{'foreignKey':_0x2793('0x1fd'),'as':'ToQueue'});db['SmsTransferReport'][_0x2793('0x125')](db['SmsAccount'],{'foreignKey':_0x2793('0x1fe'),'as':_0x2793('0x1f3')});db['CmList'][_0x2793('0x118')](db[_0x2793('0x80')],{'as':'Dispositions','foreignKey':_0x2793('0x17e'),'onDelete':_0x2793('0x116')});db[_0x2793('0xf9')][_0x2793('0x118')](db['CmCustomField'],{'as':'CustomFields','foreignKey':_0x2793('0x17e')});db['CmList'][_0x2793('0x118')](db[_0x2793('0x163')],{'as':_0x2793('0x129'),'onDelete':_0x2793('0x116'),'foreignKey':_0x2793('0x17e')});db['CmList'][_0x2793('0x118')](db['CmHopperFinal'],{'as':_0x2793('0x14d'),'foreignKey':_0x2793('0x17e')});db['CmList'][_0x2793('0x118')](db[_0x2793('0x14e')],{'as':_0x2793('0x11b'),'foreignKey':_0x2793('0x17e')});db['CmList'][_0x2793('0x118')](db[_0x2793('0x11c')],{'as':_0x2793('0x11c'),'foreignKey':_0x2793('0x17e')});db[_0x2793('0xf9')]['belongsToMany'](db[_0x2793('0x1b')],{'as':_0x2793('0x1ff'),'through':_0x2793('0x158')});db[_0x2793('0xf9')]['belongsToMany'](db['User'],{'as':_0x2793('0x159'),'through':_0x2793('0x12c')});db['VoicePrefix'][_0x2793('0x118')](db[_0x2793('0x19')],{'as':_0x2793('0x1b1'),'onDelete':_0x2793('0x116')});db[_0x2793('0xfb')][_0x2793('0x128')](db[_0x2793('0x13')],{'as':'Agents','through':_0x2793('0x134')});db[_0x2793('0xfb')][_0x2793('0x128')](db[_0x2793('0xe5')],{'through':_0x2793('0x1e8'),'as':_0x2793('0x15a')});db[_0x2793('0xfd')][_0x2793('0x118')](db['User'],{'as':_0x2793('0x177'),'foreignKey':_0x2793('0x126')});db[_0x2793('0xfd')][_0x2793('0x118')](db[_0x2793('0xff')],{'as':_0x2793('0x200'),'foreignKey':_0x2793('0x126'),'onDelete':'cascade'});db['UserProfileSection'][_0x2793('0x118')](db['UserProfileResource'],{'as':_0x2793('0x201'),'foreignKey':_0x2793('0x202'),'onDelete':_0x2793('0x116')});db[_0x2793('0x103')][_0x2793('0x118')](db[_0x2793('0x80')],{'as':_0x2793('0x16c'),'foreignKey':'WhatsappAccountId','onDelete':_0x2793('0x116')});db[_0x2793('0x103')]['hasMany'](db[_0x2793('0x16d')],{'as':'Answers','foreignKey':_0x2793('0x203')});db['WhatsappAccount'][_0x2793('0x118')](db[_0x2793('0x109')],{'as':_0x2793('0x15d'),'foreignKey':_0x2793('0x203')});db[_0x2793('0x103')][_0x2793('0x118')](db[_0x2793('0x107')],{'as':_0x2793('0x16f')});db['WhatsappAccount'][_0x2793('0x118')](db[_0x2793('0x105')],{'as':_0x2793('0x145')});db[_0x2793('0x103')][_0x2793('0x125')](db[_0x2793('0xf9')],{'as':_0x2793('0x170'),'foreignKey':_0x2793('0x17e')});db['WhatsappAccount']['belongsTo'](db[_0x2793('0x85')],{'as':_0x2793('0x156'),'foreignKey':_0x2793('0x157')});db[_0x2793('0x103')][_0x2793('0x128')](db[_0x2793('0x13')],{'as':'Agents','through':_0x2793('0x142')});db[_0x2793('0x105')]['belongsTo'](db[_0x2793('0x13')],{'onDelete':_0x2793('0x169')});db[_0x2793('0x105')][_0x2793('0x125')](db['WhatsappQueue'],{'onDelete':_0x2793('0x169')});db[_0x2793('0x105')][_0x2793('0x125')](db[_0x2793('0x103')],{'onDelete':_0x2793('0x169')});db[_0x2793('0x105')][_0x2793('0x125')](db['Interval'],{'onDelete':_0x2793('0x169'),'foreignKey':_0x2793('0x17d')});db['WhatsappApplication']['belongsTo'](db[_0x2793('0x8b')],{'onDelete':_0x2793('0x169'),'foreignKey':_0x2793('0x184')});db[_0x2793('0x107')][_0x2793('0x118')](db['WhatsappMessage'],{'as':'Messages','onDelete':_0x2793('0x116'),'foreignKey':_0x2793('0x204')});db[_0x2793('0x107')][_0x2793('0x125')](db[_0x2793('0x103')],{'as':_0x2793('0x173'),'foreignKey':_0x2793('0x203')});db[_0x2793('0x107')][_0x2793('0x125')](db[_0x2793('0x163')],{'as':_0x2793('0x164'),'foreignKey':'ContactId'});db[_0x2793('0x107')]['belongsTo'](db[_0x2793('0x13')],{'as':_0x2793('0x186'),'foreignKey':_0x2793('0x117')});db[_0x2793('0x107')][_0x2793('0x128')](db[_0x2793('0x8b')],{'through':_0x2793('0x1b8'),'as':_0x2793('0x175')});db[_0x2793('0x107')]['belongsToMany'](db[_0x2793('0x8b')],{'through':_0x2793('0x1b8'),'as':_0x2793('0x176')});db[_0x2793('0x107')][_0x2793('0x128')](db['User'],{'as':_0x2793('0x177'),'through':'user_has_whatsapp_interactions','foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0x2793('0x125')](db[_0x2793('0x13')],{'as':'User'});db[_0x2793('0x109')][_0x2793('0x125')](db[_0x2793('0x163')],{'onDelete':_0x2793('0x116'),'as':_0x2793('0x164')});db[_0x2793('0x109')][_0x2793('0x125')](db['WhatsappInteraction'],{'onDelete':_0x2793('0x116'),'as':_0x2793('0x179'),'foreignKey':'WhatsappInteractionId'});db[_0x2793('0x109')][_0x2793('0x125')](db[_0x2793('0x103')],{'as':_0x2793('0x173'),'foreignKey':_0x2793('0x203')});db[_0x2793('0x10a')][_0x2793('0x125')](db[_0x2793('0x103')],{});db[_0x2793('0x10a')]['belongsTo'](db[_0x2793('0xf9')],{'as':_0x2793('0x170'),'foreignKey':'ListId'});db[_0x2793('0x10a')]['belongsTo'](db[_0x2793('0x163')],{'as':'Contact','foreignKey':_0x2793('0x17f')});db[_0x2793('0x10a')][_0x2793('0x125')](db[_0x2793('0x107')],{});db[_0x2793('0x10a')][_0x2793('0x125')](db[_0x2793('0x10e')],{});db[_0x2793('0x10a')][_0x2793('0x125')](db[_0x2793('0x109')],{});db[_0x2793('0x10a')]['belongsTo'](db[_0x2793('0x13')],{});db[_0x2793('0x10c')][_0x2793('0x125')](db[_0x2793('0x109')],{});db['WhatsappTransferReport'][_0x2793('0x125')](db[_0x2793('0x107')],{});db[_0x2793('0x10c')]['belongsTo'](db[_0x2793('0x103')],{'foreignKey':_0x2793('0x205'),'as':_0x2793('0x1ee')});db['WhatsappTransferReport'][_0x2793('0x125')](db[_0x2793('0x103')],{'foreignKey':'ToWhatsappAccountId','as':_0x2793('0x1f3')});db[_0x2793('0x10c')]['belongsTo'](db[_0x2793('0x10e')],{'foreignKey':'ToQueueId','as':'ToQueue'});db[_0x2793('0x10c')]['belongsTo'](db[_0x2793('0x13')],{'foreignKey':_0x2793('0x1f5'),'as':_0x2793('0x1ef')});db[_0x2793('0x10c')][_0x2793('0x125')](db[_0x2793('0x13')],{'foreignKey':_0x2793('0x1f0'),'as':'ToAgent'});db[_0x2793('0x10e')][_0x2793('0x128')](db[_0x2793('0x13')],{'as':'Agents','through':_0x2793('0x39'),'foreignKey':_0x2793('0x206')});db[_0x2793('0x10e')][_0x2793('0x128')](db[_0x2793('0xe5')],{'through':_0x2793('0x207'),'as':'Teams'});db[_0x2793('0x113')][_0x2793('0x125')](db[_0x2793('0x13')],{'as':'user','foreignKey':_0x2793('0x117'),'onDelete':_0x2793('0x116'),'hooks':!![]});db[_0x2793('0x110')][_0x2793('0x115')](db[_0x2793('0xc1')],{'as':_0x2793('0xc1'),'onDelete':_0x2793('0x169')});db['CloudProvider'][_0x2793('0x115')](db['MailServerIn'],{'as':_0x2793('0x16a'),'onDelete':_0x2793('0x169')});db[_0x2793('0x110')][_0x2793('0x115')](db[_0x2793('0x3b')],{'as':'Smtp','onDelete':'restrict'});module[_0x2793('0x208')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x7e0e=['ChatInteractions','user_has_chat_interactions','SmsInteraction','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefixes','MailQueues','UserMailQueue','ChatQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_whatsapp_accounts','VoiceChanSpy','ChanSpyId','Applications','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','belongsTo','TrunkBackup','Interval','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','BlackLists','voice_queues_has_cm_blacklists','VoiceRecording','Messages','mailboxuser','mailbox','VoiceMailMessage','VoiceQueueReport','QueueCalls','uniqueid','AgentReports','Contact','ContactId','CloudProvider','restrict','MailAccountId','CloudProviderId','Imap','hasOne','Smtp','Dispositions','Answers','MailApplication','Template','mandatoryDispositionPause','MailInteractionId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachments','ChatWebsiteId','ChatOfflineMessageId','IntervalId','TagId','ListId','Items','FaxAccount','FaxAccountId','Interactions','Exntensions','List','FaxInteractionId','Account','fax_interaction_has_tags','user_has_fax_interactions','Interaction','AttachmentId','team_has_fax_queues','Teams','FaxQueueReport','SmsAccountId','SmsApplication','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelQueueId','team_has_openchannel_queues','ChatMessage','Agent','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','chat_group_has_users','CmCompany','CompanyId','CmContactHasItem','Phones','CmContactId','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','Queue','Campaign','OwnerId','CampaignId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Action','AutomationId','ParentId','MailApplications','ChatApplications','SmsApplications','Schedule','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemTypeId','AllConditions','AllCondition','TriggerAllId','Trigger','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','MetricId','Configurations','AccountId','SalesforceField','Subjects','Descriptions','DescriptionId','FieldId','SubjectId','Field','VariableId','SugarcrmAccount','Subject','Description','int_desk_configuration_has_tags','ZohoAccount','ZendeskAccount','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ServicenowConfiguration','FreshsalesField','FromId','ToId','SessionId','JscriptyAnswerReport','ProjectId','team_has_mail_queues','team_has_chat_queues','FaxQueues','team_has_whatsapp_queues','VoicePrefix','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToQueue','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToAccount','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','../config/environment','lodash','sequelize','defaultsDeep','motion2','xcall','127.0.0.1','mysql','name','utf8_general_ci','sequelizeHistory','xC@LL1234','utf8mb4','utf8','database','username','password','options','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','import','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','../api/sound/sound.model','Tag','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','cascade','UserId','userSetting','hasMany','Recordings','Extensions','User','CmHopperFinal','HopperFinals','HopperHistory','OpenchannelInteractions','SmsInteractions','MailInteractions','WhatsappInteractions','userProfileId','belongsToMany','Groups','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams'];(function(_0x188b88,_0x29c926){var _0x21fc22=function(_0x30289c){while(--_0x30289c){_0x188b88['push'](_0x188b88['shift']());}};_0x21fc22(++_0x29c926);}(_0x7e0e,0xde));var _0xe7e0=function(_0x4d19f5,_0x5e5b16){_0x4d19f5=_0x4d19f5-0x0;var _0x2709a4=_0x7e0e[_0x4d19f5];return _0x2709a4;};'use strict';var config=require(_0xe7e0('0x0'));var Sequelize=require('sequelize');var _=require(_0xe7e0('0x1'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0xe7e0('0x2')]=_[_0xe7e0('0x3')](config['sequelize'],{'database':_0xe7e0('0x4'),'username':_0xe7e0('0x5'),'password':'xC@LL1234','options':{'host':_0xe7e0('0x6'),'port':0xcea,'dialect':_0xe7e0('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xe7e0('0x8')](),'define':{'charset':'utf8','collate':_0xe7e0('0x9')}}});config[_0xe7e0('0xa')]=_[_0xe7e0('0x3')](config[_0xe7e0('0xa')],{'database':_0xe7e0('0x4'),'username':_0xe7e0('0x5'),'password':_0xe7e0('0xb'),'options':{'host':_0xe7e0('0x6'),'port':0xcea,'dialect':_0xe7e0('0x7'),'dialectOptions':{'charset':_0xe7e0('0xc')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xe7e0('0xd'),'collate':_0xe7e0('0x9')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe7e0('0x2')][_0xe7e0('0xe')],config['sequelize'][_0xe7e0('0xf')],config[_0xe7e0('0x2')][_0xe7e0('0x10')],config['sequelize'][_0xe7e0('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe7e0('0xa')][_0xe7e0('0xe')],config[_0xe7e0('0xa')][_0xe7e0('0xf')],config[_0xe7e0('0xa')][_0xe7e0('0x10')],config[_0xe7e0('0xa')][_0xe7e0('0x11')])};db['User']=db[_0xe7e0('0x2')]['import']('../api/user/user.model');db['VoiceChanSpy']=db['sequelize']['import'](_0xe7e0('0x12'));db[_0xe7e0('0x13')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x15'));db[_0xe7e0('0x16')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')]('../api/voiceExtension/voiceExtension.model');db[_0xe7e0('0x17')]=db[_0xe7e0('0x2')]['import'](_0xe7e0('0x18'));db[_0xe7e0('0x19')]=db['sequelize']['import'](_0xe7e0('0x1a'));db['VoiceRecording']=db[_0xe7e0('0x2')]['import'](_0xe7e0('0x1b'));db[_0xe7e0('0x1c')]=db['sequelize']['import'](_0xe7e0('0x1d'));db[_0xe7e0('0x1e')]=db[_0xe7e0('0x2')]['import'](_0xe7e0('0x1f'));db['VoiceMailMessage']=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x20'));db[_0xe7e0('0x21')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x22'));db[_0xe7e0('0x23')]=db[_0xe7e0('0x2')]['import']('../api/voiceDialReport/voiceDialReport.model');db[_0xe7e0('0x24')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x25'));db['VoiceQueueReport']=db['sequelize'][_0xe7e0('0x14')](_0xe7e0('0x26'));db[_0xe7e0('0x27')]=db['sequelize'][_0xe7e0('0x14')](_0xe7e0('0x28'));db[_0xe7e0('0x29')]=db['sequelize']['import'](_0xe7e0('0x2a'));db[_0xe7e0('0x2b')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x2c'));db[_0xe7e0('0x2d')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x2e'));db['UserVoiceQueue']=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x2f'));db[_0xe7e0('0x30')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x31'));db['UserMailQueue']=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x32'));db[_0xe7e0('0x33')]=db['sequelize'][_0xe7e0('0x14')](_0xe7e0('0x34'));db['UserSmsQueue']=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x35'));db[_0xe7e0('0x36')]=db['sequelize']['import'](_0xe7e0('0x37'));db[_0xe7e0('0x38')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x39'));db[_0xe7e0('0x3a')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x3b'));db[_0xe7e0('0x3c')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')]('../api/mailServerOut/mailServerOut.model');db[_0xe7e0('0x3d')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')]('../api/mailAccount/mailAccount.model');db[_0xe7e0('0x3e')]=db['sequelize'][_0xe7e0('0x14')](_0xe7e0('0x3f'));db[_0xe7e0('0x40')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')]('../api/mailSubstatus/mailSubstatus.model');db[_0xe7e0('0x41')]=db[_0xe7e0('0x2')]['import'](_0xe7e0('0x42'));db[_0xe7e0('0x43')]=db['sequelize'][_0xe7e0('0x14')](_0xe7e0('0x44'));db['MailApplication']=db['sequelize']['import'](_0xe7e0('0x45'));db[_0xe7e0('0x46')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')]('../api/mailQueueReport/mailQueueReport.model');db[_0xe7e0('0x47')]=db['sequelize'][_0xe7e0('0x14')](_0xe7e0('0x48'));db[_0xe7e0('0x49')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')]('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db['sequelize'][_0xe7e0('0x14')](_0xe7e0('0x4a'));db[_0xe7e0('0x4b')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')]('../api/faxApplication/faxApplication.model');db[_0xe7e0('0x4c')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x4d'));db[_0xe7e0('0x4e')]=db['sequelize'][_0xe7e0('0x14')](_0xe7e0('0x4f'));db[_0xe7e0('0x50')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x51'));db['FaxQueueReport']=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x52'));db['SmsAccount']=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x53'));db['SmsApplication']=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x54'));db['SmsInteraction']=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x55'));db[_0xe7e0('0x56')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')]('../api/smsMessage/smsMessage.model');db[_0xe7e0('0x57')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x58'));db[_0xe7e0('0x59')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x5a'));db[_0xe7e0('0x5b')]=db['sequelize']['import']('../api/openchannelApplication/openchannelApplication.model');db[_0xe7e0('0x5c')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x5d'));db[_0xe7e0('0x5e')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x5f'));db[_0xe7e0('0x60')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x61'));db[_0xe7e0('0x62')]=db['sequelize'][_0xe7e0('0x14')](_0xe7e0('0x63'));db[_0xe7e0('0x64')]=db[_0xe7e0('0x2')]['import'](_0xe7e0('0x65'));db[_0xe7e0('0x66')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x67'));db[_0xe7e0('0x68')]=db['sequelize'][_0xe7e0('0x14')](_0xe7e0('0x69'));db['ChatMessage']=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x6a'));db[_0xe7e0('0x6b')]=db[_0xe7e0('0x2')]['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xe7e0('0x6c')]=db['sequelize']['import'](_0xe7e0('0x6d'));db[_0xe7e0('0x6e')]=db[_0xe7e0('0x2')]['import'](_0xe7e0('0x6f'));db[_0xe7e0('0x70')]=db['sequelize'][_0xe7e0('0x14')](_0xe7e0('0x71'));db['CmCompany']=db[_0xe7e0('0x2')][_0xe7e0('0x14')]('../api/cmCompany/cmCompany.model');db[_0xe7e0('0x72')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x73'));db[_0xe7e0('0x74')]=db[_0xe7e0('0x2')]['import'](_0xe7e0('0x75'));db[_0xe7e0('0x76')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x77'));db['CmHopperFinal']=db['sequelize']['import'](_0xe7e0('0x78'));db[_0xe7e0('0x79')]=db[_0xe7e0('0x2')]['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0xe7e0('0x7a')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x7b'));db[_0xe7e0('0x7c')]=db['sequelize'][_0xe7e0('0x14')](_0xe7e0('0x7d'));db['Action']=db['sequelize']['import'](_0xe7e0('0x7e'));db[_0xe7e0('0x7f')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')]('../api/automation/automation.model');db[_0xe7e0('0x80')]=db[_0xe7e0('0x2')]['import'](_0xe7e0('0x81'));db[_0xe7e0('0x82')]=db[_0xe7e0('0x2')]['import'](_0xe7e0('0x83'));db[_0xe7e0('0x84')]=db['sequelize'][_0xe7e0('0x14')]('../api/condition/condition.model');db['Interval']=db['sequelize'][_0xe7e0('0x14')](_0xe7e0('0x85'));db[_0xe7e0('0x86')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x87'));db['Cdr']=db['sequelize']['import']('../api/cdr/cdr.model');db['VoiceQueuesLog']=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x88'));db['Schedule']=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x89'));db['Sound']=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x8a'));db[_0xe7e0('0x8b')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')]('../api/tag/tag.model');db[_0xe7e0('0x8c')]=db['sequelize'][_0xe7e0('0x14')](_0xe7e0('0x8d'));db['CmContactHasItem']=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x8e'));db[_0xe7e0('0x8f')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x90'));db['Template']=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x91'));db['Trigger']=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x92'));db[_0xe7e0('0x93')]=db[_0xe7e0('0x2')]['import']('../api/variable/variable.model');db['Integration']=db[_0xe7e0('0x2')]['import'](_0xe7e0('0x94'));db[_0xe7e0('0x95')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x96'));db['AnalyticCustomReport']=db[_0xe7e0('0x2')]['import'](_0xe7e0('0x97'));db[_0xe7e0('0x98')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x99'));db[_0xe7e0('0x9a')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x9b'));db[_0xe7e0('0x9c')]=db[_0xe7e0('0x2')]['import'](_0xe7e0('0x9d'));db[_0xe7e0('0x9e')]=db[_0xe7e0('0x2')]['import'](_0xe7e0('0x9f'));db['AnalyticTreeReport']=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0xa0'));db[_0xe7e0('0xa1')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0xa2'));db[_0xe7e0('0xa3')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0xa4'));db['SalesforceField']=db[_0xe7e0('0x2')]['import'](_0xe7e0('0xa5'));db['SugarcrmAccount']=db[_0xe7e0('0x2')]['import'](_0xe7e0('0xa6'));db[_0xe7e0('0xa7')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0xa8'));db[_0xe7e0('0xa9')]=db['sequelize'][_0xe7e0('0x14')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xe7e0('0xaa')]=db['sequelize']['import'](_0xe7e0('0xab'));db[_0xe7e0('0xac')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0xad'));db[_0xe7e0('0xae')]=db['sequelize']['import'](_0xe7e0('0xaf'));db['ZohoAccount']=db['sequelize'][_0xe7e0('0x14')](_0xe7e0('0xb0'));db[_0xe7e0('0xb1')]=db[_0xe7e0('0x2')]['import'](_0xe7e0('0xb2'));db[_0xe7e0('0xb3')]=db['sequelize'][_0xe7e0('0x14')](_0xe7e0('0xb4'));db['ZendeskAccount']=db['sequelize'][_0xe7e0('0x14')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xe7e0('0xb5')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0xb6'));db[_0xe7e0('0xb7')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0xb8'));db[_0xe7e0('0xb9')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0xba'));db[_0xe7e0('0xbb')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0xbc'));db[_0xe7e0('0xbd')]=db['sequelize'][_0xe7e0('0x14')](_0xe7e0('0xbe'));db[_0xe7e0('0xbf')]=db['sequelize']['import']('../api/intVtigerAccount/intVtigerAccount.model');db[_0xe7e0('0xc0')]=db['sequelize']['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0xe7e0('0xc1')]=db['sequelize'][_0xe7e0('0x14')]('../api/intVtigerField/intVtigerField.model');db[_0xe7e0('0xc2')]=db[_0xe7e0('0x2')]['import']('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db['sequelize'][_0xe7e0('0x14')](_0xe7e0('0xc3'));db[_0xe7e0('0xc4')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')]('../api/intServicenowField/intServicenowField.model');db[_0xe7e0('0xc5')]=db[_0xe7e0('0x2')]['import'](_0xe7e0('0xc6'));db[_0xe7e0('0xc7')]=db['sequelize'][_0xe7e0('0x14')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xe7e0('0xc8')]=db['sequelize'][_0xe7e0('0x14')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0xe7e0('0xc9')]=db[_0xe7e0('0x2')]['import'](_0xe7e0('0xca'));db[_0xe7e0('0xcb')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0xcc'));db[_0xe7e0('0xcd')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x94'));db[_0xe7e0('0xce')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0xcf'));db[_0xe7e0('0xd0')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')]('../api/chatQueueReport/chatQueueReport.model');db[_0xe7e0('0xd1')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')]('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db[_0xe7e0('0x2')][_0xe7e0('0x14')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0xe7e0('0xd2')]=db[_0xe7e0('0x2')]['import'](_0xe7e0('0xd3'));db[_0xe7e0('0xd4')]=db['sequelize'][_0xe7e0('0x14')](_0xe7e0('0xd5'));db[_0xe7e0('0xd6')]=db[_0xe7e0('0x2')]['import'](_0xe7e0('0xd7'));db[_0xe7e0('0xd8')]=db['sequelize']['import'](_0xe7e0('0xd9'));db[_0xe7e0('0xda')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')]('../api/squareReportDetail/squareReportDetail.model');db[_0xe7e0('0xdb')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0xdc'));db[_0xe7e0('0xdd')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')]('../api/setting/setting.model');db[_0xe7e0('0xde')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')]('../api/squareOdbc/squareOdbc.model');db[_0xe7e0('0xdf')]=db[_0xe7e0('0x2')]['import'](_0xe7e0('0xe0'));db['SquareRecording']=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0xe1'));db[_0xe7e0('0xe2')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0xe3'));db[_0xe7e0('0xe4')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0xe5'));db[_0xe7e0('0xe6')]=db['sequelize'][_0xe7e0('0x14')]('../api/license/license.model');db['Campaign']=db['sequelize'][_0xe7e0('0x14')](_0xe7e0('0xe7'));db[_0xe7e0('0xe8')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')]('../api/migration/migration.model');db[_0xe7e0('0xe9')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0xea'));db[_0xe7e0('0xeb')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0xec'));db['MailTransferReport']=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0xed'));db[_0xe7e0('0xee')]=db['sequelize'][_0xe7e0('0x14')]('../api/chatTransferReport/chatTransferReport.model');db[_0xe7e0('0xef')]=db['sequelize'][_0xe7e0('0x14')]('../api/faxTransferReport/faxTransferReport.model');db[_0xe7e0('0xf0')]=db[_0xe7e0('0x2')]['import']('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0xe7e0('0xf1')]=db['sequelize'][_0xe7e0('0x14')](_0xe7e0('0xf2'));db[_0xe7e0('0xf3')]=db['sequelize'][_0xe7e0('0x14')](_0xe7e0('0xf4'));db['VoicePrefix']=db['sequelize'][_0xe7e0('0x14')](_0xe7e0('0xf5'));db[_0xe7e0('0xf6')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0xf7'));db[_0xe7e0('0xf8')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0xf9'));db['UserProfileResource']=db[_0xe7e0('0x2')]['import']('../api/userProfileResource/userProfileResource.model');db[_0xe7e0('0xfa')]=db[_0xe7e0('0x2')]['import'](_0xe7e0('0xfb'));db[_0xe7e0('0xfc')]=db['sequelize']['import']('../api/whatsappAccount/whatsappAccount.model');db[_0xe7e0('0xfd')]=db[_0xe7e0('0x2')]['import'](_0xe7e0('0xfe'));db[_0xe7e0('0xff')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x100'));db[_0xe7e0('0x101')]=db['sequelize']['import']('../api/whatsappMessage/whatsappMessage.model');db[_0xe7e0('0x102')]=db['sequelize']['import'](_0xe7e0('0x103'));db[_0xe7e0('0x104')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x105'));db[_0xe7e0('0x106')]=db[_0xe7e0('0x2')]['import'](_0xe7e0('0x107'));db['CloudProvider']=db[_0xe7e0('0x2')]['import'](_0xe7e0('0x108'));db[_0xe7e0('0x109')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x10a'));db[_0xe7e0('0x10b')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x10c'));db[_0xe7e0('0x10d')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x10e'));db[_0xe7e0('0x10f')]=db[_0xe7e0('0x2')][_0xe7e0('0x14')](_0xe7e0('0x110'));db['User']['hasOne'](db[_0xe7e0('0x1e')],{'as':_0xe7e0('0x1e'),'onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x112')});db['User']['hasOne'](db[_0xe7e0('0x10f')],{'as':_0xe7e0('0x113'),'onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x112')});db['User'][_0xe7e0('0x114')](db['VoiceRecording'],{'as':_0xe7e0('0x115'),'foreignKey':_0xe7e0('0x112')});db['User']['hasMany'](db[_0xe7e0('0x2d')],{'as':'VoiceQueuesRt','foreignKey':_0xe7e0('0x112')});db['User'][_0xe7e0('0x114')](db[_0xe7e0('0x16')],{'as':_0xe7e0('0x116'),'onDelete':_0xe7e0('0x111'),'hooks':!![]});db[_0xe7e0('0x117')][_0xe7e0('0x114')](db[_0xe7e0('0x118')],{'as':_0xe7e0('0x119'),'foreignKey':_0xe7e0('0x112')});db[_0xe7e0('0x117')]['hasMany'](db[_0xe7e0('0x79')],{'as':_0xe7e0('0x11a'),'foreignKey':_0xe7e0('0x112')});db[_0xe7e0('0x117')][_0xe7e0('0x114')](db['ReportAgentPreview'],{'as':_0xe7e0('0x7a'),'foreignKey':_0xe7e0('0x112')});db['User'][_0xe7e0('0x114')](db['OpenchannelInteraction'],{'as':_0xe7e0('0x11b'),'foreignKey':_0xe7e0('0x112')});db[_0xe7e0('0x117')]['hasMany'](db[_0xe7e0('0x68')],{'as':'ChatInteractions','foreignKey':'UserId'});db[_0xe7e0('0x117')]['hasMany'](db['SmsInteraction'],{'as':_0xe7e0('0x11c'),'foreignKey':_0xe7e0('0x112')});db['User'][_0xe7e0('0x114')](db[_0xe7e0('0x4c')],{'as':'FaxInteractions','foreignKey':'UserId'});db[_0xe7e0('0x117')]['hasMany'](db[_0xe7e0('0x41')],{'as':_0xe7e0('0x11d'),'foreignKey':_0xe7e0('0x112')});db[_0xe7e0('0x117')][_0xe7e0('0x114')](db[_0xe7e0('0xff')],{'as':_0xe7e0('0x11e'),'foreignKey':_0xe7e0('0x112')});db[_0xe7e0('0x117')]['hasMany'](db[_0xe7e0('0xfa')],{'as':'UserNotifications','foreignKey':'SenderId'});db[_0xe7e0('0x117')]['belongsTo'](db['UserProfile'],{'as':'UserProfile','foreignKey':_0xe7e0('0x11f')});db[_0xe7e0('0x117')][_0xe7e0('0x120')](db[_0xe7e0('0x6e')],{'as':_0xe7e0('0x121'),'through':'chat_group_has_users'});db[_0xe7e0('0x117')]['belongsToMany'](db[_0xe7e0('0x72')],{'as':_0xe7e0('0x122'),'through':_0xe7e0('0x123')});db[_0xe7e0('0x117')][_0xe7e0('0x120')](db['CmList'],{'as':_0xe7e0('0x124'),'through':_0xe7e0('0x125')});db[_0xe7e0('0x117')][_0xe7e0('0x120')](db[_0xe7e0('0xe4')],{'through':_0xe7e0('0x126')});db['User']['belongsToMany'](db[_0xe7e0('0x41')],{'as':_0xe7e0('0x11d'),'through':'user_has_mail_interactions'});db[_0xe7e0('0x117')][_0xe7e0('0x120')](db[_0xe7e0('0x68')],{'as':_0xe7e0('0x127'),'through':_0xe7e0('0x128')});db[_0xe7e0('0x117')][_0xe7e0('0x120')](db['FaxInteraction'],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db[_0xe7e0('0x117')][_0xe7e0('0x120')](db[_0xe7e0('0x129')],{'as':_0xe7e0('0x11c'),'through':_0xe7e0('0x12a')});db['User'][_0xe7e0('0x120')](db[_0xe7e0('0x5c')],{'as':_0xe7e0('0x11b'),'through':'user_has_openchannel_interactions'});db[_0xe7e0('0x117')][_0xe7e0('0x120')](db['WhatsappInteraction'],{'as':_0xe7e0('0x11e'),'through':_0xe7e0('0x12b')});db[_0xe7e0('0x117')][_0xe7e0('0x120')](db[_0xe7e0('0x19')],{'as':_0xe7e0('0x12c'),'through':_0xe7e0('0x12d'),'required':![]});db[_0xe7e0('0x117')][_0xe7e0('0x120')](db['VoicePrefix'],{'as':_0xe7e0('0x12e'),'through':'UserVoicePrefix','required':![]});db[_0xe7e0('0x117')][_0xe7e0('0x120')](db[_0xe7e0('0x3e')],{'as':_0xe7e0('0x12f'),'through':_0xe7e0('0x130'),'required':![]});db['User']['belongsToMany'](db[_0xe7e0('0x6c')],{'as':_0xe7e0('0x131'),'through':_0xe7e0('0x30'),'required':![],'hooks':!![]});db[_0xe7e0('0x117')][_0xe7e0('0x120')](db[_0xe7e0('0x50')],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db['User'][_0xe7e0('0x120')](db[_0xe7e0('0x57')],{'as':_0xe7e0('0x132'),'through':_0xe7e0('0x133'),'required':![]});db[_0xe7e0('0x117')][_0xe7e0('0x120')](db[_0xe7e0('0x60')],{'as':_0xe7e0('0x134'),'through':_0xe7e0('0x36'),'required':![]});db[_0xe7e0('0x117')][_0xe7e0('0x120')](db[_0xe7e0('0x106')],{'as':_0xe7e0('0x135'),'through':_0xe7e0('0x38'),'required':![]});db[_0xe7e0('0x117')][_0xe7e0('0x120')](db[_0xe7e0('0xf3')],{'through':_0xe7e0('0x125')});db[_0xe7e0('0x117')][_0xe7e0('0x120')](db['ChatWebsite'],{'as':_0xe7e0('0x136'),'through':_0xe7e0('0x137')});db[_0xe7e0('0x117')]['belongsToMany'](db['FaxAccount'],{'as':_0xe7e0('0x138'),'through':_0xe7e0('0x139')});db[_0xe7e0('0x117')][_0xe7e0('0x120')](db[_0xe7e0('0x3d')],{'as':_0xe7e0('0x13a'),'through':_0xe7e0('0x13b')});db[_0xe7e0('0x117')][_0xe7e0('0x120')](db[_0xe7e0('0x59')],{'as':_0xe7e0('0x13c'),'through':_0xe7e0('0x13d')});db['User'][_0xe7e0('0x120')](db[_0xe7e0('0x13e')],{'as':_0xe7e0('0x13f'),'through':'user_has_sms_accounts'});db[_0xe7e0('0x117')][_0xe7e0('0x120')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0xe7e0('0x140')});db[_0xe7e0('0x141')][_0xe7e0('0x114')](db[_0xe7e0('0x16')],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':_0xe7e0('0x142')});db[_0xe7e0('0x13')][_0xe7e0('0x114')](db[_0xe7e0('0x16')],{'onDelete':_0xe7e0('0x111')});db['VoiceExtension'][_0xe7e0('0x114')](db[_0xe7e0('0x16')],{'as':_0xe7e0('0x143'),'onDelete':_0xe7e0('0x111')});db[_0xe7e0('0x17')][_0xe7e0('0x120')](db[_0xe7e0('0x144')],{'as':_0xe7e0('0x145'),'through':_0xe7e0('0x146')});db[_0xe7e0('0x19')][_0xe7e0('0x114')](db['UserVoiceQueueRt'],{'as':_0xe7e0('0x147'),'foreignKey':_0xe7e0('0x148')});db[_0xe7e0('0x19')][_0xe7e0('0x114')](db[_0xe7e0('0x74')],{'as':_0xe7e0('0x149'),'foreignKey':_0xe7e0('0x148')});db[_0xe7e0('0x19')]['hasMany'](db[_0xe7e0('0x118')],{'as':_0xe7e0('0x119'),'foreignKey':_0xe7e0('0x148')});db[_0xe7e0('0x19')][_0xe7e0('0x114')](db[_0xe7e0('0x79')],{'as':_0xe7e0('0x14a'),'foreignKey':_0xe7e0('0x148')});db[_0xe7e0('0x19')]['hasMany'](db['ReportAgentPreview'],{'as':_0xe7e0('0x7a'),'foreignKey':_0xe7e0('0x148')});db[_0xe7e0('0x19')][_0xe7e0('0x114')](db[_0xe7e0('0x76')],{'as':_0xe7e0('0x14b'),'foreignKey':_0xe7e0('0x148')});db[_0xe7e0('0x19')][_0xe7e0('0x114')](db['JscriptySessionReport'],{'as':_0xe7e0('0x14c'),'foreignKey':_0xe7e0('0x148')});db[_0xe7e0('0x19')][_0xe7e0('0x14d')](db[_0xe7e0('0x29')],{'as':_0xe7e0('0x29'),'foreignKey':'TrunkId'});db[_0xe7e0('0x19')][_0xe7e0('0x14d')](db[_0xe7e0('0x29')],{'as':_0xe7e0('0x14e'),'foreignKey':'TrunkBackupId'});db[_0xe7e0('0x19')][_0xe7e0('0x14d')](db['Interval'],{'as':_0xe7e0('0x14f'),'foreignKey':'IntervalId'});db[_0xe7e0('0x19')][_0xe7e0('0x14d')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xe7e0('0x150')});db[_0xe7e0('0x19')][_0xe7e0('0x120')](db['CmList'],{'as':_0xe7e0('0x124'),'through':_0xe7e0('0x151')});db[_0xe7e0('0x19')][_0xe7e0('0x120')](db[_0xe7e0('0x117')],{'as':_0xe7e0('0x152'),'through':_0xe7e0('0x12d')});db[_0xe7e0('0x19')][_0xe7e0('0x120')](db['Team'],{'as':'Teams','through':_0xe7e0('0x109')});db[_0xe7e0('0x19')][_0xe7e0('0x120')](db[_0xe7e0('0xf3')],{'as':_0xe7e0('0x153'),'through':_0xe7e0('0x154')});db[_0xe7e0('0x155')][_0xe7e0('0x14d')](db[_0xe7e0('0x117')],{'as':_0xe7e0('0x117'),'foreignKey':'UserId'});db['ScreenRecording'][_0xe7e0('0x14d')](db[_0xe7e0('0x117')],{'as':'User','foreignKey':_0xe7e0('0x112')});db[_0xe7e0('0x1e')][_0xe7e0('0x114')](db['VoiceMailMessage'],{'as':_0xe7e0('0x156'),'onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x157'),'sourceKey':_0xe7e0('0x158')});db[_0xe7e0('0x159')][_0xe7e0('0x14d')](db[_0xe7e0('0x1e')],{'foreignKey':'mailboxuser','targetKey':_0xe7e0('0x158')});db[_0xe7e0('0x21')][_0xe7e0('0x114')](db[_0xe7e0('0x15a')],{'as':_0xe7e0('0x15b'),'foreignKey':_0xe7e0('0x15c'),'constraints':![]});db[_0xe7e0('0x21')][_0xe7e0('0x114')](db[_0xe7e0('0x24')],{'as':_0xe7e0('0x15d'),'foreignKey':_0xe7e0('0x15c'),'constraints':![]});db[_0xe7e0('0x21')]['belongsTo'](db['User'],{'as':'User','foreignKey':_0xe7e0('0x112')});db['VoiceCallReport'][_0xe7e0('0x14d')](db[_0xe7e0('0x72')],{'as':_0xe7e0('0x15e'),'foreignKey':_0xe7e0('0x15f')});db['MailServerIn'][_0xe7e0('0x14d')](db[_0xe7e0('0x3d')],{'as':_0xe7e0('0x3d'),'foreignKey':'MailAccountId'});db[_0xe7e0('0x3a')][_0xe7e0('0x14d')](db[_0xe7e0('0x160')],{'as':_0xe7e0('0x160'),'foreignKey':'CloudProviderId','onDelete':_0xe7e0('0x161')});db[_0xe7e0('0x3c')][_0xe7e0('0x14d')](db[_0xe7e0('0x3d')],{'as':_0xe7e0('0x3d'),'foreignKey':_0xe7e0('0x162')});db['MailServerOut'][_0xe7e0('0x14d')](db[_0xe7e0('0x160')],{'as':_0xe7e0('0x160'),'foreignKey':_0xe7e0('0x163'),'onDelete':_0xe7e0('0x161')});db[_0xe7e0('0x3d')]['hasOne'](db[_0xe7e0('0x3a')],{'as':_0xe7e0('0x164'),'onDelete':_0xe7e0('0x111')});db[_0xe7e0('0x3d')][_0xe7e0('0x165')](db['MailServerOut'],{'as':_0xe7e0('0x166'),'onDelete':_0xe7e0('0x111')});db[_0xe7e0('0x3d')][_0xe7e0('0x114')](db[_0xe7e0('0x82')],{'as':_0xe7e0('0x167'),'foreignKey':_0xe7e0('0x162'),'onDelete':_0xe7e0('0x111')});db[_0xe7e0('0x3d')][_0xe7e0('0x114')](db[_0xe7e0('0x80')],{'as':_0xe7e0('0x168'),'foreignKey':_0xe7e0('0x162')});db[_0xe7e0('0x3d')][_0xe7e0('0x114')](db[_0xe7e0('0x43')],{'as':'Messages','foreignKey':_0xe7e0('0x162')});db['MailAccount'][_0xe7e0('0x114')](db[_0xe7e0('0x41')],{'as':'Interactions'});db[_0xe7e0('0x3d')][_0xe7e0('0x114')](db[_0xe7e0('0x169')],{'as':_0xe7e0('0x143')});db['MailAccount']['belongsTo'](db[_0xe7e0('0xf3')],{'as':'List','foreignKey':'ListId'});db[_0xe7e0('0x3d')]['belongsTo'](db[_0xe7e0('0x16a')],{'as':_0xe7e0('0x16a'),'foreignKey':'TemplateId'});db['MailAccount']['belongsTo'](db['Pause'],{'as':_0xe7e0('0x16b'),'foreignKey':_0xe7e0('0x150')});db['MailAccount'][_0xe7e0('0x120')](db[_0xe7e0('0x117')],{'as':_0xe7e0('0x152'),'through':_0xe7e0('0x13b')});db['MailQueue']['belongsToMany'](db[_0xe7e0('0x117')],{'as':_0xe7e0('0x152'),'through':'UserMailQueue'});db['MailQueue']['belongsToMany'](db[_0xe7e0('0xe4')],{'through':'team_has_mail_queues','as':'Teams'});db[_0xe7e0('0x41')]['hasMany'](db[_0xe7e0('0x43')],{'as':_0xe7e0('0x156'),'onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x16c')});db['MailInteraction'][_0xe7e0('0x14d')](db[_0xe7e0('0x3d')],{'as':'Account','foreignKey':_0xe7e0('0x162')});db['MailInteraction'][_0xe7e0('0x14d')](db[_0xe7e0('0x72')],{'as':_0xe7e0('0x15e'),'foreignKey':'ContactId'});db[_0xe7e0('0x41')][_0xe7e0('0x14d')](db['User'],{'as':_0xe7e0('0x16d'),'foreignKey':_0xe7e0('0x112')});db[_0xe7e0('0x41')][_0xe7e0('0x120')](db[_0xe7e0('0x8b')],{'through':_0xe7e0('0x16e'),'as':_0xe7e0('0x16f')});db[_0xe7e0('0x41')][_0xe7e0('0x120')](db['Tag'],{'through':_0xe7e0('0x16e'),'as':_0xe7e0('0x170')});db[_0xe7e0('0x41')][_0xe7e0('0x120')](db[_0xe7e0('0x117')],{'as':_0xe7e0('0x171'),'through':_0xe7e0('0x172'),'foreignKey':_0xe7e0('0x16c')});db['MailMessage']['hasMany'](db['Attachment'],{'as':_0xe7e0('0x173'),'onDelete':_0xe7e0('0x111')});db[_0xe7e0('0x43')]['belongsTo'](db[_0xe7e0('0x117')],{'as':'User'});db[_0xe7e0('0x43')][_0xe7e0('0x14d')](db[_0xe7e0('0x72')],{'onDelete':'cascade','as':_0xe7e0('0x15e')});db[_0xe7e0('0x43')][_0xe7e0('0x14d')](db['MailInteraction'],{'as':'Interaction','foreignKey':_0xe7e0('0x16c')});db['MailMessage'][_0xe7e0('0x14d')](db[_0xe7e0('0x3d')],{'as':'Account','foreignKey':_0xe7e0('0x162')});db[_0xe7e0('0x43')]['belongsTo'](db[_0xe7e0('0x62')],{'as':_0xe7e0('0x62'),'foreignKey':_0xe7e0('0x174')});db[_0xe7e0('0x43')]['belongsTo'](db[_0xe7e0('0x6b')],{'as':'ChatOfflineMessage','foreignKey':_0xe7e0('0x175')});db[_0xe7e0('0x169')][_0xe7e0('0x14d')](db[_0xe7e0('0x117')],{'onDelete':_0xe7e0('0x161')});db[_0xe7e0('0x169')][_0xe7e0('0x14d')](db['MailQueue'],{'onDelete':_0xe7e0('0x161')});db[_0xe7e0('0x169')]['belongsTo'](db[_0xe7e0('0x3d')],{'onDelete':_0xe7e0('0x161')});db[_0xe7e0('0x169')][_0xe7e0('0x14d')](db[_0xe7e0('0x14f')],{'onDelete':_0xe7e0('0x161'),'foreignKey':_0xe7e0('0x176')});db['MailApplication'][_0xe7e0('0x14d')](db[_0xe7e0('0x8b')],{'onDelete':_0xe7e0('0x161'),'foreignKey':_0xe7e0('0x177')});db['MailQueueReport'][_0xe7e0('0x14d')](db[_0xe7e0('0x3d')],{});db['MailQueueReport'][_0xe7e0('0x14d')](db[_0xe7e0('0xf3')],{'as':'List','foreignKey':_0xe7e0('0x178')});db[_0xe7e0('0x46')]['belongsTo'](db['CmContact'],{'as':_0xe7e0('0x15e'),'foreignKey':'ContactId'});db[_0xe7e0('0x46')]['belongsTo'](db[_0xe7e0('0x41')],{});db[_0xe7e0('0x46')][_0xe7e0('0x14d')](db[_0xe7e0('0x43')],{});db[_0xe7e0('0x46')][_0xe7e0('0x14d')](db[_0xe7e0('0x117')],{});db[_0xe7e0('0x46')][_0xe7e0('0x14d')](db[_0xe7e0('0x3e')],{});db[_0xe7e0('0x47')][_0xe7e0('0x114')](db[_0xe7e0('0x49')],{'as':_0xe7e0('0x179'),'onDelete':_0xe7e0('0x111')});db[_0xe7e0('0x17a')][_0xe7e0('0x114')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xe7e0('0x17b'),'onDelete':_0xe7e0('0x111')});db['FaxAccount']['hasMany'](db[_0xe7e0('0x80')],{'as':_0xe7e0('0x168'),'foreignKey':_0xe7e0('0x17b')});db['FaxAccount'][_0xe7e0('0x114')](db['FaxInteraction'],{'as':_0xe7e0('0x17c')});db[_0xe7e0('0x17a')]['hasMany'](db[_0xe7e0('0x4b')],{'as':_0xe7e0('0x143')});db[_0xe7e0('0x17a')][_0xe7e0('0x114')](db[_0xe7e0('0x16')],{'as':_0xe7e0('0x17d'),'onDelete':'cascade'});db[_0xe7e0('0x17a')][_0xe7e0('0x114')](db[_0xe7e0('0x4e')],{'as':_0xe7e0('0x156')});db[_0xe7e0('0x17a')]['belongsTo'](db[_0xe7e0('0x29')],{'as':_0xe7e0('0x29')});db[_0xe7e0('0x17a')]['belongsTo'](db[_0xe7e0('0xf3')],{'as':_0xe7e0('0x17e'),'foreignKey':'ListId'});db[_0xe7e0('0x17a')][_0xe7e0('0x14d')](db[_0xe7e0('0x86')],{'as':'mandatoryDispositionPause','foreignKey':_0xe7e0('0x150')});db[_0xe7e0('0x17a')][_0xe7e0('0x120')](db[_0xe7e0('0x117')],{'as':_0xe7e0('0x152'),'through':_0xe7e0('0x139')});db['FaxApplication'][_0xe7e0('0x14d')](db[_0xe7e0('0x117')],{'onDelete':_0xe7e0('0x161')});db['FaxApplication'][_0xe7e0('0x14d')](db[_0xe7e0('0x50')],{'onDelete':_0xe7e0('0x161')});db[_0xe7e0('0x4b')][_0xe7e0('0x14d')](db[_0xe7e0('0x17a')],{'onDelete':_0xe7e0('0x161')});db[_0xe7e0('0x4b')][_0xe7e0('0x14d')](db[_0xe7e0('0x8b')],{'onDelete':_0xe7e0('0x161'),'foreignKey':_0xe7e0('0x177')});db[_0xe7e0('0x4c')]['hasMany'](db[_0xe7e0('0x4e')],{'as':'Messages','onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x17f')});db[_0xe7e0('0x4c')][_0xe7e0('0x14d')](db[_0xe7e0('0x17a')],{'as':_0xe7e0('0x180'),'foreignKey':'FaxAccountId'});db[_0xe7e0('0x4c')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xe7e0('0x15f')});db[_0xe7e0('0x4c')][_0xe7e0('0x14d')](db[_0xe7e0('0x117')],{'as':_0xe7e0('0x16d'),'foreignKey':_0xe7e0('0x112')});db[_0xe7e0('0x4c')]['belongsToMany'](db[_0xe7e0('0x8b')],{'through':_0xe7e0('0x181'),'as':_0xe7e0('0x16f')});db[_0xe7e0('0x4c')][_0xe7e0('0x120')](db[_0xe7e0('0x8b')],{'through':_0xe7e0('0x181'),'as':_0xe7e0('0x170')});db[_0xe7e0('0x4c')]['belongsToMany'](db['User'],{'as':_0xe7e0('0x171'),'through':_0xe7e0('0x182'),'foreignKey':_0xe7e0('0x17f')});db[_0xe7e0('0x4e')][_0xe7e0('0x14d')](db['User'],{'onDelete':'cascade','as':'User'});db['FaxMessage']['belongsTo'](db[_0xe7e0('0x4c')],{'as':_0xe7e0('0x183'),'foreignKey':'FaxInteractionId'});db[_0xe7e0('0x4e')][_0xe7e0('0x14d')](db[_0xe7e0('0x72')],{'onDelete':_0xe7e0('0x111'),'as':_0xe7e0('0x15e')});db[_0xe7e0('0x4e')][_0xe7e0('0x14d')](db[_0xe7e0('0xe9')],{'as':_0xe7e0('0xe9'),'foreignKey':_0xe7e0('0x184')});db[_0xe7e0('0x4e')][_0xe7e0('0x14d')](db['FaxAccount'],{'as':_0xe7e0('0x180'),'foreignKey':_0xe7e0('0x17b')});db[_0xe7e0('0x50')][_0xe7e0('0x120')](db[_0xe7e0('0x117')],{'as':_0xe7e0('0x152'),'through':_0xe7e0('0x33')});db[_0xe7e0('0x50')][_0xe7e0('0x120')](db[_0xe7e0('0xe4')],{'through':_0xe7e0('0x185'),'as':_0xe7e0('0x186')});db[_0xe7e0('0x187')][_0xe7e0('0x14d')](db[_0xe7e0('0x17a')],{});db['FaxQueueReport'][_0xe7e0('0x14d')](db[_0xe7e0('0xf3')],{'as':_0xe7e0('0x17e'),'foreignKey':_0xe7e0('0x178')});db[_0xe7e0('0x187')]['belongsTo'](db[_0xe7e0('0x72')],{'as':_0xe7e0('0x15e'),'foreignKey':_0xe7e0('0x15f')});db[_0xe7e0('0x187')][_0xe7e0('0x14d')](db['FaxInteraction'],{});db[_0xe7e0('0x187')][_0xe7e0('0x14d')](db[_0xe7e0('0x4e')],{});db['FaxQueueReport'][_0xe7e0('0x14d')](db[_0xe7e0('0x117')],{});db[_0xe7e0('0x187')][_0xe7e0('0x14d')](db[_0xe7e0('0x50')],{});db[_0xe7e0('0x13e')][_0xe7e0('0x114')](db[_0xe7e0('0x82')],{'as':_0xe7e0('0x167'),'foreignKey':_0xe7e0('0x188'),'onDelete':_0xe7e0('0x111')});db[_0xe7e0('0x13e')][_0xe7e0('0x114')](db['CannedAnswer'],{'as':_0xe7e0('0x168'),'foreignKey':_0xe7e0('0x188')});db[_0xe7e0('0x13e')][_0xe7e0('0x114')](db[_0xe7e0('0x56')],{'as':_0xe7e0('0x156'),'foreignKey':'SmsAccountId'});db[_0xe7e0('0x13e')][_0xe7e0('0x114')](db['SmsInteraction'],{'as':'Interactions'});db[_0xe7e0('0x13e')][_0xe7e0('0x114')](db[_0xe7e0('0x189')],{'as':'Applications'});db[_0xe7e0('0x13e')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0xe7e0('0x13e')][_0xe7e0('0x14d')](db[_0xe7e0('0x86')],{'as':_0xe7e0('0x16b'),'foreignKey':_0xe7e0('0x150')});db[_0xe7e0('0x13e')][_0xe7e0('0x120')](db[_0xe7e0('0x117')],{'as':_0xe7e0('0x152'),'through':_0xe7e0('0x18a')});db['SmsApplication'][_0xe7e0('0x14d')](db[_0xe7e0('0x117')],{'onDelete':'restrict'});db[_0xe7e0('0x189')]['belongsTo'](db[_0xe7e0('0x57')],{'onDelete':_0xe7e0('0x161')});db[_0xe7e0('0x189')][_0xe7e0('0x14d')](db[_0xe7e0('0x13e')],{'onDelete':'restrict'});db['SmsApplication'][_0xe7e0('0x14d')](db[_0xe7e0('0x14f')],{'onDelete':_0xe7e0('0x161'),'foreignKey':_0xe7e0('0x176')});db[_0xe7e0('0x189')][_0xe7e0('0x14d')](db[_0xe7e0('0x8b')],{'onDelete':_0xe7e0('0x161'),'foreignKey':_0xe7e0('0x177')});db['SmsInteraction'][_0xe7e0('0x114')](db[_0xe7e0('0x56')],{'as':'Messages','onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x18b')});db[_0xe7e0('0x129')]['belongsTo'](db[_0xe7e0('0x13e')],{'as':_0xe7e0('0x180'),'foreignKey':_0xe7e0('0x188')});db[_0xe7e0('0x129')][_0xe7e0('0x14d')](db[_0xe7e0('0x72')],{'as':_0xe7e0('0x15e'),'foreignKey':_0xe7e0('0x15f')});db['SmsInteraction']['belongsTo'](db[_0xe7e0('0x117')],{'as':_0xe7e0('0x16d'),'foreignKey':_0xe7e0('0x112')});db['SmsInteraction']['belongsToMany'](db[_0xe7e0('0x8b')],{'through':_0xe7e0('0x18c'),'as':_0xe7e0('0x16f')});db[_0xe7e0('0x129')][_0xe7e0('0x120')](db[_0xe7e0('0x8b')],{'through':_0xe7e0('0x18c'),'as':'ThroughTags'});db['SmsInteraction'][_0xe7e0('0x120')](db['User'],{'as':_0xe7e0('0x171'),'through':_0xe7e0('0x12a'),'foreignKey':_0xe7e0('0x18b')});db['SmsMessage'][_0xe7e0('0x14d')](db['User'],{'as':'User'});db['SmsMessage'][_0xe7e0('0x14d')](db[_0xe7e0('0x72')],{'onDelete':_0xe7e0('0x111'),'as':_0xe7e0('0x15e')});db[_0xe7e0('0x56')][_0xe7e0('0x14d')](db[_0xe7e0('0x129')],{'onDelete':_0xe7e0('0x111'),'as':'Interaction','foreignKey':_0xe7e0('0x18b')});db[_0xe7e0('0x56')]['belongsTo'](db[_0xe7e0('0x13e')],{'as':_0xe7e0('0x180'),'foreignKey':_0xe7e0('0x188')});db['SmsQueue'][_0xe7e0('0x120')](db['User'],{'as':_0xe7e0('0x152'),'through':'UserSmsQueue','foreignKey':_0xe7e0('0x18d')});db[_0xe7e0('0x57')][_0xe7e0('0x120')](db[_0xe7e0('0xe4')],{'through':'team_has_sms_queues','as':_0xe7e0('0x186')});db[_0xe7e0('0x59')][_0xe7e0('0x114')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xe7e0('0x18e'),'onDelete':'cascade'});db[_0xe7e0('0x59')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xe7e0('0x114')](db['OpenchannelInteraction'],{'as':_0xe7e0('0x17c'),'foreignKey':'OpenchannelAccountId'});db[_0xe7e0('0x59')][_0xe7e0('0x114')](db[_0xe7e0('0x5e')],{'as':_0xe7e0('0x156'),'foreignKey':_0xe7e0('0x18e')});db[_0xe7e0('0x59')][_0xe7e0('0x114')](db['OpenchannelApplication'],{'as':_0xe7e0('0x143'),'foreignKey':_0xe7e0('0x18e')});db[_0xe7e0('0x59')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xe7e0('0x178')});db[_0xe7e0('0x59')]['belongsTo'](db[_0xe7e0('0x86')],{'as':_0xe7e0('0x16b'),'foreignKey':_0xe7e0('0x150')});db['OpenchannelAccount'][_0xe7e0('0x120')](db['User'],{'as':'Agents','through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0xe7e0('0x14d')](db[_0xe7e0('0x117')],{'onDelete':_0xe7e0('0x161')});db['OpenchannelApplication']['belongsTo'](db[_0xe7e0('0x60')],{'onDelete':_0xe7e0('0x161'),'foreignKey':'OpenchannelQueueId'});db[_0xe7e0('0x5b')][_0xe7e0('0x14d')](db['OpenchannelAccount'],{'onDelete':_0xe7e0('0x161'),'foreignKey':'OpenchannelAccountId'});db[_0xe7e0('0x5b')]['belongsTo'](db[_0xe7e0('0x14f')],{'onDelete':_0xe7e0('0x161'),'foreignKey':_0xe7e0('0x176')});db[_0xe7e0('0x5b')]['belongsTo'](db['Tag'],{'onDelete':_0xe7e0('0x161'),'foreignKey':_0xe7e0('0x177')});db[_0xe7e0('0x5c')]['hasMany'](db[_0xe7e0('0x5e')],{'as':_0xe7e0('0x156'),'onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x18f')});db[_0xe7e0('0x5c')]['belongsTo'](db[_0xe7e0('0x59')],{'as':_0xe7e0('0x180'),'foreignKey':_0xe7e0('0x18e')});db[_0xe7e0('0x5c')][_0xe7e0('0x14d')](db['CmContact'],{'as':_0xe7e0('0x15e'),'foreignKey':_0xe7e0('0x15f')});db['OpenchannelInteraction']['belongsTo'](db[_0xe7e0('0x117')],{'as':'Owner','foreignKey':'UserId'});db[_0xe7e0('0x5c')][_0xe7e0('0x120')](db[_0xe7e0('0x8b')],{'through':_0xe7e0('0x190'),'as':_0xe7e0('0x16f')});db['OpenchannelInteraction'][_0xe7e0('0x120')](db[_0xe7e0('0x8b')],{'through':_0xe7e0('0x190'),'as':_0xe7e0('0x170')});db[_0xe7e0('0x5c')][_0xe7e0('0x120')](db[_0xe7e0('0x117')],{'as':'Users','through':_0xe7e0('0x191'),'foreignKey':_0xe7e0('0x18f')});db[_0xe7e0('0x5e')][_0xe7e0('0x14d')](db[_0xe7e0('0x117')],{'onDelete':'cascade','as':_0xe7e0('0x117')});db['OpenchannelMessage'][_0xe7e0('0x14d')](db['CmContact'],{'onDelete':_0xe7e0('0x111'),'as':'Contact'});db['OpenchannelMessage'][_0xe7e0('0x14d')](db[_0xe7e0('0x5c')],{'onDelete':'cascade','as':_0xe7e0('0x183'),'foreignKey':_0xe7e0('0x18f')});db[_0xe7e0('0x5e')][_0xe7e0('0x14d')](db[_0xe7e0('0xe9')],{'as':_0xe7e0('0xe9'),'foreignKey':_0xe7e0('0x184')});db['OpenchannelMessage'][_0xe7e0('0x14d')](db[_0xe7e0('0x59')],{'as':_0xe7e0('0x180'),'foreignKey':_0xe7e0('0x18e')});db[_0xe7e0('0x60')]['belongsToMany'](db[_0xe7e0('0x117')],{'as':_0xe7e0('0x152'),'through':_0xe7e0('0x36'),'foreignKey':_0xe7e0('0x192')});db[_0xe7e0('0x60')][_0xe7e0('0x120')](db[_0xe7e0('0xe4')],{'through':_0xe7e0('0x193'),'as':_0xe7e0('0x186')});db[_0xe7e0('0x62')][_0xe7e0('0x114')](db[_0xe7e0('0x82')],{'as':'Dispositions','foreignKey':'ChatWebsiteId','onDelete':_0xe7e0('0x111')});db[_0xe7e0('0x62')]['hasMany'](db[_0xe7e0('0x80')],{'as':_0xe7e0('0x168'),'foreignKey':_0xe7e0('0x174')});db['ChatWebsite'][_0xe7e0('0x114')](db['ChatProactiveAction'],{'as':'ProactiveActions'});db[_0xe7e0('0x62')]['hasMany'](db['ChatInteraction'],{'as':_0xe7e0('0x17c')});db[_0xe7e0('0x62')][_0xe7e0('0x114')](db[_0xe7e0('0x66')],{'as':_0xe7e0('0x143')});db[_0xe7e0('0x62')][_0xe7e0('0x114')](db[_0xe7e0('0x194')],{'as':_0xe7e0('0x156')});db[_0xe7e0('0x62')][_0xe7e0('0x14d')](db[_0xe7e0('0xf3')],{'as':_0xe7e0('0x17e'),'foreignKey':_0xe7e0('0x178')});db['ChatWebsite'][_0xe7e0('0x14d')](db[_0xe7e0('0x14f')],{'as':_0xe7e0('0x14f'),'foreignKey':_0xe7e0('0x176')});db['ChatWebsite'][_0xe7e0('0x14d')](db[_0xe7e0('0x3d')],{'as':_0xe7e0('0x3d'),'foreignKey':_0xe7e0('0x162')});db[_0xe7e0('0x62')][_0xe7e0('0x14d')](db[_0xe7e0('0x86')],{'as':_0xe7e0('0x16b'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xe7e0('0x62')][_0xe7e0('0x120')](db[_0xe7e0('0x117')],{'as':_0xe7e0('0x152'),'through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0xe7e0('0x14d')](db[_0xe7e0('0x59')],{});db[_0xe7e0('0x64')][_0xe7e0('0x14d')](db['CmList'],{'as':_0xe7e0('0x17e'),'foreignKey':_0xe7e0('0x178')});db[_0xe7e0('0x64')][_0xe7e0('0x14d')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0xe7e0('0x64')][_0xe7e0('0x14d')](db[_0xe7e0('0x5c')],{});db[_0xe7e0('0x64')][_0xe7e0('0x14d')](db['OpenchannelMessage'],{});db[_0xe7e0('0x64')][_0xe7e0('0x14d')](db[_0xe7e0('0x117')],{});db[_0xe7e0('0x64')][_0xe7e0('0x14d')](db[_0xe7e0('0x60')],{});db[_0xe7e0('0x66')][_0xe7e0('0x14d')](db['User'],{'as':_0xe7e0('0x195'),'foreignKey':_0xe7e0('0x112'),'onDelete':_0xe7e0('0x161')});db[_0xe7e0('0x66')]['belongsTo'](db['ChatQueue'],{'as':'Queue','foreignKey':_0xe7e0('0x196'),'onDelete':_0xe7e0('0x161')});db[_0xe7e0('0x66')][_0xe7e0('0x14d')](db[_0xe7e0('0x62')],{'as':_0xe7e0('0x197'),'foreignKey':_0xe7e0('0x174'),'onDelete':'restrict'});db['ChatApplication'][_0xe7e0('0x14d')](db[_0xe7e0('0x8b')],{'onDelete':'restrict','foreignKey':_0xe7e0('0x177')});db[_0xe7e0('0x68')][_0xe7e0('0x114')](db['ChatMessage'],{'as':_0xe7e0('0x156'),'onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x198')});db[_0xe7e0('0x68')][_0xe7e0('0x14d')](db['ChatWebsite'],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0xe7e0('0x68')][_0xe7e0('0x14d')](db[_0xe7e0('0x72')],{'as':_0xe7e0('0x15e'),'foreignKey':_0xe7e0('0x15f')});db[_0xe7e0('0x68')][_0xe7e0('0x14d')](db[_0xe7e0('0x117')],{'as':_0xe7e0('0x16d'),'foreignKey':'UserId'});db[_0xe7e0('0x68')][_0xe7e0('0x120')](db[_0xe7e0('0x8b')],{'through':_0xe7e0('0x199'),'as':'Tags'});db[_0xe7e0('0x68')][_0xe7e0('0x120')](db[_0xe7e0('0x8b')],{'through':'chat_interaction_has_tags','as':_0xe7e0('0x170')});db['ChatInteraction']['belongsToMany'](db[_0xe7e0('0x117')],{'as':_0xe7e0('0x171'),'through':_0xe7e0('0x128'),'foreignKey':_0xe7e0('0x198')});db['ChatMessage'][_0xe7e0('0x14d')](db['User'],{'onDelete':'cascade','as':'User'});db[_0xe7e0('0x194')]['belongsTo'](db[_0xe7e0('0x72')],{'onDelete':_0xe7e0('0x111'),'as':_0xe7e0('0x15e'),'foreignKey':'ContactId'});db[_0xe7e0('0x194')]['belongsTo'](db[_0xe7e0('0x68')],{'onDelete':_0xe7e0('0x111'),'as':_0xe7e0('0x183'),'foreignKey':_0xe7e0('0x198')});db[_0xe7e0('0x194')][_0xe7e0('0x14d')](db[_0xe7e0('0xe9')],{'as':'Attachment','foreignKey':'AttachmentId'});db['ChatMessage']['belongsTo'](db[_0xe7e0('0x62')],{'as':_0xe7e0('0x180'),'foreignKey':_0xe7e0('0x174')});db[_0xe7e0('0x6b')]['hasMany'](db[_0xe7e0('0xe9')],{'as':'Attachments','foreignKey':_0xe7e0('0x175'),'onDelete':_0xe7e0('0x111'),'hooks':!![]});db[_0xe7e0('0x6b')][_0xe7e0('0x14d')](db[_0xe7e0('0x72')],{'onDelete':_0xe7e0('0x111'),'as':_0xe7e0('0x15e'),'foreignKey':_0xe7e0('0x15f')});db[_0xe7e0('0x6b')][_0xe7e0('0x14d')](db[_0xe7e0('0x62')],{'as':'Account','foreignKey':_0xe7e0('0x174')});db[_0xe7e0('0x6c')][_0xe7e0('0x120')](db[_0xe7e0('0x117')],{'as':_0xe7e0('0x152'),'through':_0xe7e0('0x30'),'hooks':!![]});db[_0xe7e0('0x6c')][_0xe7e0('0x120')](db[_0xe7e0('0xe4')],{'through':'team_has_chat_queues','as':_0xe7e0('0x186')});db[_0xe7e0('0x6e')][_0xe7e0('0x114')](db['ChatInternalMessage'],{'as':_0xe7e0('0x156'),'foreignKey':_0xe7e0('0x19a'),'onDelete':'cascade'});db[_0xe7e0('0x6e')]['belongsToMany'](db[_0xe7e0('0x117')],{'as':_0xe7e0('0x147'),'through':_0xe7e0('0x19b')});db[_0xe7e0('0x70')][_0xe7e0('0x14d')](db['ChatWebsite'],{'as':_0xe7e0('0x197'),'foreignKey':'ChatWebsiteId'});db[_0xe7e0('0x19c')][_0xe7e0('0x114')](db['CmContact'],{'as':_0xe7e0('0x122'),'foreignKey':_0xe7e0('0x19d')});db[_0xe7e0('0x72')][_0xe7e0('0x114')](db[_0xe7e0('0x19e')],{'as':_0xe7e0('0x19f'),'foreignKey':_0xe7e0('0x1a0')});db[_0xe7e0('0x72')][_0xe7e0('0x114')](db['CmHopper'],{'as':_0xe7e0('0x149'),'foreignKey':_0xe7e0('0x15f')});db[_0xe7e0('0x72')][_0xe7e0('0x114')](db[_0xe7e0('0x118')],{'as':'HopperFinals','foreignKey':_0xe7e0('0x15f')});db[_0xe7e0('0x72')][_0xe7e0('0x114')](db[_0xe7e0('0x79')],{'as':'HopperHistories','foreignKey':_0xe7e0('0x15f')});db[_0xe7e0('0x72')][_0xe7e0('0x114')](db['ReportAgentPreview'],{'as':_0xe7e0('0x7a'),'foreignKey':_0xe7e0('0x15f')});db[_0xe7e0('0x72')][_0xe7e0('0x114')](db[_0xe7e0('0xd4')],{'as':_0xe7e0('0x14c'),'foreignKey':_0xe7e0('0x15f')});db[_0xe7e0('0x72')][_0xe7e0('0x114')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0xe7e0('0x161')});db['CmContact'][_0xe7e0('0x114')](db[_0xe7e0('0x68')],{'as':_0xe7e0('0x127'),'foreignKey':_0xe7e0('0x15f'),'onDelete':_0xe7e0('0x161')});db['CmContact'][_0xe7e0('0x114')](db[_0xe7e0('0x129')],{'as':_0xe7e0('0x11c'),'foreignKey':_0xe7e0('0x15f'),'onDelete':'restrict'});db[_0xe7e0('0x72')][_0xe7e0('0x114')](db[_0xe7e0('0x4c')],{'as':'FaxInteractions','foreignKey':_0xe7e0('0x15f'),'onDelete':_0xe7e0('0x161')});db[_0xe7e0('0x72')][_0xe7e0('0x114')](db['MailInteraction'],{'as':_0xe7e0('0x11d'),'foreignKey':_0xe7e0('0x15f'),'onDelete':_0xe7e0('0x161')});db['CmContact']['belongsTo'](db['CmCompany'],{'as':_0xe7e0('0x1a1'),'foreignKey':_0xe7e0('0x19d')});db['CmContact'][_0xe7e0('0x14d')](db[_0xe7e0('0xf3')],{'as':_0xe7e0('0x17e'),'foreignKey':'ListId','onDelete':_0xe7e0('0x111')});db[_0xe7e0('0x72')][_0xe7e0('0x120')](db[_0xe7e0('0x117')],{'as':_0xe7e0('0x171'),'through':_0xe7e0('0x123')});db['CmContact'][_0xe7e0('0x120')](db['Tag'],{'as':_0xe7e0('0x16f'),'through':_0xe7e0('0x1a2')});db[_0xe7e0('0x72')][_0xe7e0('0x120')](db['Tag'],{'through':_0xe7e0('0x1a2'),'as':'ThroughTags'});db['CmHopper'][_0xe7e0('0x114')](db[_0xe7e0('0x8f')],{'as':_0xe7e0('0x1a3'),'foreignKey':_0xe7e0('0x1a4')});db['CmHopper'][_0xe7e0('0x14d')](db[_0xe7e0('0x72')],{'as':_0xe7e0('0x15e'),'foreignKey':_0xe7e0('0x15f'),'onDelete':'cascade'});db[_0xe7e0('0x74')][_0xe7e0('0x14d')](db[_0xe7e0('0xf3')],{'as':_0xe7e0('0x17e'),'foreignKey':_0xe7e0('0x178'),'onDelete':_0xe7e0('0x111')});db[_0xe7e0('0x74')][_0xe7e0('0x14d')](db['User'],{'as':_0xe7e0('0x195'),'foreignKey':_0xe7e0('0x112')});db[_0xe7e0('0x74')]['belongsTo'](db[_0xe7e0('0x19')],{'as':_0xe7e0('0x1a5'),'foreignKey':_0xe7e0('0x148'),'onDelete':_0xe7e0('0x111')});db[_0xe7e0('0x74')][_0xe7e0('0x14d')](db[_0xe7e0('0x1a6')],{'as':_0xe7e0('0x1a6'),'foreignKey':'CampaignId','onDelete':_0xe7e0('0x111')});db[_0xe7e0('0x74')][_0xe7e0('0x14d')](db['User'],{'as':_0xe7e0('0x16d'),'foreignKey':_0xe7e0('0x1a7')});db[_0xe7e0('0x76')]['belongsTo'](db[_0xe7e0('0x72')],{'as':'Contact','foreignKey':_0xe7e0('0x15f'),'onDelete':'cascade'});db[_0xe7e0('0x76')]['belongsTo'](db[_0xe7e0('0xf3')],{'as':'List','foreignKey':_0xe7e0('0x178'),'onDelete':'cascade'});db[_0xe7e0('0x76')][_0xe7e0('0x14d')](db[_0xe7e0('0x19')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0xe7e0('0x111')});db['CmHopperBlack']['belongsTo'](db['Campaign'],{'as':_0xe7e0('0x1a6'),'foreignKey':_0xe7e0('0x1a8'),'onDelete':'cascade'});db[_0xe7e0('0x7f')]['hasMany'](db[_0xe7e0('0x84')],{'as':{'plural':_0xe7e0('0x1a9'),'singular':_0xe7e0('0x1aa')},'foreignKey':_0xe7e0('0x1ab'),'onDelete':'cascade','hooks':!![]});db[_0xe7e0('0x7f')]['hasMany'](db[_0xe7e0('0x84')],{'as':{'plural':_0xe7e0('0x1ac'),'singular':_0xe7e0('0x1ad')},'foreignKey':_0xe7e0('0x1ae'),'onDelete':_0xe7e0('0x111'),'hooks':!![]});db[_0xe7e0('0x7f')][_0xe7e0('0x114')](db[_0xe7e0('0x1af')],{'as':'Actions','foreignKey':_0xe7e0('0x1b0'),'onDelete':_0xe7e0('0x111'),'hooks':!![]});db[_0xe7e0('0x82')][_0xe7e0('0x114')](db['Disposition'],{'as':_0xe7e0('0x167'),'foreignKey':_0xe7e0('0x1b1'),'onDelete':_0xe7e0('0x111')});db[_0xe7e0('0x14f')]['hasMany'](db[_0xe7e0('0x14f')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':_0xe7e0('0x111'),'hooks':!![],'required':![]});db[_0xe7e0('0x14f')][_0xe7e0('0x114')](db[_0xe7e0('0x16')],{'as':_0xe7e0('0x116'),'foreignKey':'IntervalId','onDelete':'restrict'});db[_0xe7e0('0x14f')][_0xe7e0('0x114')](db[_0xe7e0('0x169')],{'as':_0xe7e0('0x1b2'),'foreignKey':_0xe7e0('0x176')});db[_0xe7e0('0x14f')][_0xe7e0('0x114')](db['ChatApplication'],{'as':_0xe7e0('0x1b3'),'foreignKey':_0xe7e0('0x176')});db[_0xe7e0('0x14f')][_0xe7e0('0x114')](db[_0xe7e0('0x4b')],{'as':'FaxApplications','foreignKey':_0xe7e0('0x176')});db[_0xe7e0('0x14f')][_0xe7e0('0x114')](db[_0xe7e0('0x189')],{'as':_0xe7e0('0x1b4'),'foreignKey':_0xe7e0('0x176')});db[_0xe7e0('0x1b5')][_0xe7e0('0x14d')](db[_0xe7e0('0x3d')],{});db['Schedule'][_0xe7e0('0x14d')](db['AnalyticDefaultReport'],{'foreignKey':_0xe7e0('0x1b6')});db[_0xe7e0('0x1b5')][_0xe7e0('0x14d')](db[_0xe7e0('0x1b7')],{'foreignKey':_0xe7e0('0x1b8')});db[_0xe7e0('0x144')][_0xe7e0('0x120')](db['VoiceMusicOnHold'],{'as':_0xe7e0('0x1b9'),'through':_0xe7e0('0x146'),'onDelete':_0xe7e0('0x161')});db['Tag'][_0xe7e0('0x120')](db[_0xe7e0('0x72')],{'through':'cm_contact_has_tags'});db[_0xe7e0('0x8b')][_0xe7e0('0x120')](db[_0xe7e0('0x68')],{'through':_0xe7e0('0x199')});db[_0xe7e0('0x8b')][_0xe7e0('0x120')](db[_0xe7e0('0x41')],{'through':_0xe7e0('0x16e')});db[_0xe7e0('0x8b')][_0xe7e0('0x120')](db[_0xe7e0('0x129')],{'through':_0xe7e0('0x18c')});db['Tag'][_0xe7e0('0x120')](db[_0xe7e0('0x4c')],{'through':_0xe7e0('0x181')});db[_0xe7e0('0x8b')][_0xe7e0('0x120')](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db['Tag'][_0xe7e0('0x120')](db[_0xe7e0('0xff')],{'through':_0xe7e0('0x1ba')});db[_0xe7e0('0x19e')]['belongsTo'](db[_0xe7e0('0x8c')],{'as':'ItemType','foreignKey':_0xe7e0('0x1bb')});db[_0xe7e0('0x8f')]['belongsTo'](db[_0xe7e0('0x74')],{'as':'Hopper','foreignKey':_0xe7e0('0x1a4')});db[_0xe7e0('0x19e')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xe7e0('0x1a0')});db['Trigger'][_0xe7e0('0x114')](db['Condition'],{'as':{'plural':_0xe7e0('0x1bc'),'singular':_0xe7e0('0x1bd')},'foreignKey':_0xe7e0('0x1be'),'onDelete':_0xe7e0('0x111'),'hooks':!![]});db[_0xe7e0('0x1bf')]['hasMany'](db[_0xe7e0('0x84')],{'as':{'plural':'AnyConditions','singular':_0xe7e0('0x1c0')},'foreignKey':_0xe7e0('0x1c1'),'onDelete':_0xe7e0('0x111'),'hooks':!![]});db[_0xe7e0('0x1bf')][_0xe7e0('0x114')](db['Action'],{'as':_0xe7e0('0x1c2'),'foreignKey':_0xe7e0('0x1c3'),'onDelete':_0xe7e0('0x111'),'hooks':!![]});db[_0xe7e0('0x1b7')][_0xe7e0('0x114')](db[_0xe7e0('0x9e')],{'as':_0xe7e0('0x1c4'),'onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x1b8'),'hooks':!![]});db[_0xe7e0('0x98')][_0xe7e0('0x114')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x1b6')});db[_0xe7e0('0x9c')][_0xe7e0('0x114')](db[_0xe7e0('0x9e')],{'as':_0xe7e0('0x1c4'),'onDelete':'cascade','foreignKey':'MetricId'});db[_0xe7e0('0x9e')][_0xe7e0('0x14d')](db[_0xe7e0('0x9c')],{'foreignKey':_0xe7e0('0x1c5')});db['SalesforceAccount'][_0xe7e0('0x114')](db[_0xe7e0('0xa3')],{'as':_0xe7e0('0x1c6'),'onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x1c7')});db[_0xe7e0('0xa3')][_0xe7e0('0x114')](db[_0xe7e0('0x1c8')],{'as':_0xe7e0('0x1c9'),'onDelete':_0xe7e0('0x111'),'foreignKey':'SubjectId'});db[_0xe7e0('0xa3')][_0xe7e0('0x114')](db[_0xe7e0('0x1c8')],{'as':_0xe7e0('0x1ca'),'onDelete':'cascade','foreignKey':_0xe7e0('0x1cb')});db[_0xe7e0('0xa3')][_0xe7e0('0x114')](db['SalesforceField'],{'as':_0xe7e0('0x1c4'),'onDelete':'cascade','foreignKey':_0xe7e0('0x1cc')});db[_0xe7e0('0xa3')][_0xe7e0('0x14d')](db[_0xe7e0('0xa1')],{'as':'Account','foreignKey':_0xe7e0('0x1c7')});db[_0xe7e0('0x1c8')]['hasMany'](db[_0xe7e0('0x1c8')],{'as':'Subject','foreignKey':_0xe7e0('0x1cd')});db[_0xe7e0('0x1c8')]['hasMany'](db[_0xe7e0('0x1c8')],{'as':'Description','foreignKey':_0xe7e0('0x1cb')});db[_0xe7e0('0x1c8')][_0xe7e0('0x114')](db[_0xe7e0('0x1c8')],{'as':_0xe7e0('0x1ce'),'foreignKey':_0xe7e0('0x1cc')});db[_0xe7e0('0x1c8')][_0xe7e0('0x14d')](db['Variable'],{'as':_0xe7e0('0x93'),'foreignKey':_0xe7e0('0x1cf')});db[_0xe7e0('0x1d0')][_0xe7e0('0x114')](db[_0xe7e0('0xa7')],{'as':_0xe7e0('0x1c6'),'onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x1c7')});db[_0xe7e0('0xa7')][_0xe7e0('0x114')](db[_0xe7e0('0xa9')],{'as':'Subjects','onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x1cd')});db[_0xe7e0('0xa7')][_0xe7e0('0x114')](db[_0xe7e0('0xa9')],{'as':_0xe7e0('0x1ca'),'onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x1cb')});db['SugarcrmConfiguration'][_0xe7e0('0x114')](db[_0xe7e0('0xa9')],{'as':_0xe7e0('0x1c4'),'onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x1cc')});db[_0xe7e0('0xa7')]['belongsTo'](db[_0xe7e0('0x1d0')],{'as':_0xe7e0('0x180'),'foreignKey':_0xe7e0('0x1c7')});db[_0xe7e0('0xa9')]['hasMany'](db[_0xe7e0('0xa9')],{'as':_0xe7e0('0x1d1'),'foreignKey':_0xe7e0('0x1cd')});db[_0xe7e0('0xa9')][_0xe7e0('0x114')](db[_0xe7e0('0xa9')],{'as':_0xe7e0('0x1d2'),'foreignKey':_0xe7e0('0x1cb')});db[_0xe7e0('0xa9')][_0xe7e0('0x114')](db[_0xe7e0('0xa9')],{'as':_0xe7e0('0x1ce'),'foreignKey':'FieldId'});db[_0xe7e0('0xa9')][_0xe7e0('0x14d')](db['Variable'],{'as':_0xe7e0('0x93'),'foreignKey':'VariableId'});db['DeskAccount'][_0xe7e0('0x114')](db[_0xe7e0('0xac')],{'as':_0xe7e0('0x1c6'),'onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x1c7')});db[_0xe7e0('0xac')][_0xe7e0('0x114')](db[_0xe7e0('0xae')],{'as':_0xe7e0('0x1c9'),'onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x1cd')});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Descriptions','onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x1cb')});db['DeskConfiguration'][_0xe7e0('0x114')](db[_0xe7e0('0xae')],{'as':_0xe7e0('0x1c4'),'onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x1cc')});db[_0xe7e0('0xac')][_0xe7e0('0x14d')](db['DeskAccount'],{'as':_0xe7e0('0x180'),'foreignKey':_0xe7e0('0x1c7')});db[_0xe7e0('0xac')][_0xe7e0('0x120')](db['Tag'],{'through':_0xe7e0('0x1d3')});db[_0xe7e0('0xae')]['hasMany'](db[_0xe7e0('0xae')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xe7e0('0xae')]['hasMany'](db[_0xe7e0('0xae')],{'as':_0xe7e0('0x1d2'),'foreignKey':_0xe7e0('0x1cb')});db[_0xe7e0('0xae')][_0xe7e0('0x114')](db['DeskField'],{'as':_0xe7e0('0x1ce'),'foreignKey':_0xe7e0('0x1cc')});db[_0xe7e0('0xae')][_0xe7e0('0x14d')](db['Variable'],{'as':_0xe7e0('0x93'),'foreignKey':_0xe7e0('0x1cf')});db['ZohoAccount'][_0xe7e0('0x114')](db[_0xe7e0('0xb1')],{'as':_0xe7e0('0x1c6'),'onDelete':_0xe7e0('0x111'),'foreignKey':'AccountId'});db[_0xe7e0('0xb1')][_0xe7e0('0x114')](db[_0xe7e0('0xb3')],{'as':_0xe7e0('0x1c9'),'onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x1cd')});db[_0xe7e0('0xb1')][_0xe7e0('0x114')](db[_0xe7e0('0xb3')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xe7e0('0xb1')]['hasMany'](db[_0xe7e0('0xb3')],{'as':_0xe7e0('0x1c4'),'onDelete':'cascade','foreignKey':_0xe7e0('0x1cc')});db[_0xe7e0('0xb1')][_0xe7e0('0x14d')](db[_0xe7e0('0x1d4')],{'as':'Account','foreignKey':'AccountId'});db[_0xe7e0('0xb3')][_0xe7e0('0x114')](db[_0xe7e0('0xb3')],{'as':'Subject','foreignKey':_0xe7e0('0x1cd')});db[_0xe7e0('0xb3')][_0xe7e0('0x114')](db[_0xe7e0('0xb3')],{'as':_0xe7e0('0x1d2'),'foreignKey':_0xe7e0('0x1cb')});db[_0xe7e0('0xb3')]['hasMany'](db[_0xe7e0('0xb3')],{'as':_0xe7e0('0x1ce'),'foreignKey':_0xe7e0('0x1cc')});db['ZohoField']['belongsTo'](db[_0xe7e0('0x93')],{'as':_0xe7e0('0x93'),'foreignKey':_0xe7e0('0x1cf')});db[_0xe7e0('0x1d5')][_0xe7e0('0x114')](db[_0xe7e0('0xb5')],{'as':_0xe7e0('0x1c6'),'onDelete':'cascade','foreignKey':_0xe7e0('0x1c7')});db[_0xe7e0('0xb5')]['hasMany'](db[_0xe7e0('0xb7')],{'as':_0xe7e0('0x1c9'),'foreignKey':_0xe7e0('0x1cd')});db[_0xe7e0('0xb5')][_0xe7e0('0x114')](db['ZendeskField'],{'as':'Descriptions','foreignKey':_0xe7e0('0x1cb')});db[_0xe7e0('0xb5')]['hasMany'](db['ZendeskField'],{'as':_0xe7e0('0x1c4'),'foreignKey':_0xe7e0('0x1cc')});db['ZendeskConfiguration'][_0xe7e0('0x14d')](db[_0xe7e0('0x1d5')],{'as':_0xe7e0('0x180'),'foreignKey':_0xe7e0('0x1c7')});db['ZendeskConfiguration'][_0xe7e0('0x120')](db[_0xe7e0('0x8b')],{'through':_0xe7e0('0x1d6')});db['ZendeskField']['hasMany'](db[_0xe7e0('0xb7')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xe7e0('0xb7')][_0xe7e0('0x114')](db[_0xe7e0('0xb7')],{'as':'Description','foreignKey':_0xe7e0('0x1cb')});db[_0xe7e0('0xb7')][_0xe7e0('0x114')](db[_0xe7e0('0xb7')],{'as':'Field','foreignKey':'FieldId'});db[_0xe7e0('0xb7')]['belongsTo'](db[_0xe7e0('0x93')],{'as':_0xe7e0('0x93'),'foreignKey':'VariableId'});db['FreshdeskAccount'][_0xe7e0('0x114')](db[_0xe7e0('0xbb')],{'as':_0xe7e0('0x1c6'),'onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x1c7')});db[_0xe7e0('0xbb')][_0xe7e0('0x114')](db[_0xe7e0('0xbd')],{'as':_0xe7e0('0x1c9'),'onDelete':'cascade','foreignKey':_0xe7e0('0x1cd')});db[_0xe7e0('0xbb')]['hasMany'](db[_0xe7e0('0xbd')],{'as':_0xe7e0('0x1ca'),'onDelete':'cascade','foreignKey':_0xe7e0('0x1cb')});db[_0xe7e0('0xbb')][_0xe7e0('0x114')](db['FreshdeskField'],{'as':_0xe7e0('0x1c4'),'onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x1cc')});db[_0xe7e0('0xbb')][_0xe7e0('0x14d')](db['FreshdeskAccount'],{'as':'Account','foreignKey':_0xe7e0('0x1c7')});db[_0xe7e0('0xbb')][_0xe7e0('0x120')](db[_0xe7e0('0x8b')],{'through':_0xe7e0('0x1d7')});db[_0xe7e0('0xbd')][_0xe7e0('0x114')](db[_0xe7e0('0xbd')],{'as':_0xe7e0('0x1d1'),'foreignKey':'SubjectId'});db['FreshdeskField'][_0xe7e0('0x114')](db[_0xe7e0('0xbd')],{'as':_0xe7e0('0x1d2'),'foreignKey':_0xe7e0('0x1cb')});db[_0xe7e0('0xbd')][_0xe7e0('0x114')](db[_0xe7e0('0xbd')],{'as':_0xe7e0('0x1ce'),'foreignKey':_0xe7e0('0x1cc')});db[_0xe7e0('0xbd')][_0xe7e0('0x14d')](db[_0xe7e0('0x93')],{'as':_0xe7e0('0x93'),'foreignKey':'VariableId'});db[_0xe7e0('0xbf')][_0xe7e0('0x114')](db[_0xe7e0('0xc0')],{'as':_0xe7e0('0x1c6'),'onDelete':'cascade','foreignKey':_0xe7e0('0x1c7')});db[_0xe7e0('0xc0')][_0xe7e0('0x114')](db[_0xe7e0('0xc1')],{'as':_0xe7e0('0x1c9'),'foreignKey':_0xe7e0('0x1cd')});db['VtigerConfiguration'][_0xe7e0('0x114')](db[_0xe7e0('0xc1')],{'as':_0xe7e0('0x1ca'),'foreignKey':_0xe7e0('0x1cb')});db['VtigerConfiguration'][_0xe7e0('0x114')](db[_0xe7e0('0xc1')],{'as':_0xe7e0('0x1c4'),'foreignKey':'FieldId'});db['VtigerConfiguration'][_0xe7e0('0x14d')](db[_0xe7e0('0xbf')],{'as':_0xe7e0('0x180'),'foreignKey':'AccountId'});db[_0xe7e0('0xc1')]['hasMany'](db['VtigerField'],{'as':'Subject','foreignKey':_0xe7e0('0x1cd')});db['VtigerField'][_0xe7e0('0x114')](db[_0xe7e0('0xc1')],{'as':_0xe7e0('0x1d2'),'foreignKey':_0xe7e0('0x1cb')});db[_0xe7e0('0xc1')][_0xe7e0('0x114')](db['VtigerField'],{'as':_0xe7e0('0x1ce'),'foreignKey':_0xe7e0('0x1cc')});db[_0xe7e0('0xc1')]['belongsTo'](db[_0xe7e0('0x93')],{'as':_0xe7e0('0x93'),'foreignKey':_0xe7e0('0x1cf')});db[_0xe7e0('0xc2')]['hasMany'](db[_0xe7e0('0x1d8')],{'as':_0xe7e0('0x1c6'),'onDelete':_0xe7e0('0x111'),'foreignKey':'AccountId'});db[_0xe7e0('0x1d8')][_0xe7e0('0x114')](db['ServicenowField'],{'as':'Subjects','foreignKey':_0xe7e0('0x1cd')});db['ServicenowConfiguration'][_0xe7e0('0x114')](db[_0xe7e0('0xc4')],{'as':'Descriptions','foreignKey':_0xe7e0('0x1cb')});db[_0xe7e0('0x1d8')][_0xe7e0('0x114')](db[_0xe7e0('0xc4')],{'as':'Fields','foreignKey':_0xe7e0('0x1cc')});db[_0xe7e0('0x1d8')][_0xe7e0('0x14d')](db[_0xe7e0('0xc2')],{'as':_0xe7e0('0x180'),'foreignKey':'AccountId'});db[_0xe7e0('0xc4')][_0xe7e0('0x114')](db[_0xe7e0('0xc4')],{'as':_0xe7e0('0x1d1'),'foreignKey':_0xe7e0('0x1cd')});db['ServicenowField'][_0xe7e0('0x114')](db['ServicenowField'],{'as':_0xe7e0('0x1d2'),'foreignKey':_0xe7e0('0x1cb')});db['ServicenowField'][_0xe7e0('0x114')](db[_0xe7e0('0xc4')],{'as':'Field','foreignKey':_0xe7e0('0x1cc')});db[_0xe7e0('0xc4')][_0xe7e0('0x14d')](db[_0xe7e0('0x93')],{'as':_0xe7e0('0x93'),'foreignKey':_0xe7e0('0x1cf')});db[_0xe7e0('0xc5')][_0xe7e0('0x114')](db[_0xe7e0('0xc7')],{'as':_0xe7e0('0x1c6'),'onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x1c7')});db[_0xe7e0('0xc5')][_0xe7e0('0x14d')](db[_0xe7e0('0x160')],{'as':_0xe7e0('0x160'),'foreignKey':_0xe7e0('0x163')});db[_0xe7e0('0xc7')][_0xe7e0('0x114')](db[_0xe7e0('0xc8')],{'as':'Subjects','onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x1cd')});db[_0xe7e0('0xc7')][_0xe7e0('0x114')](db[_0xe7e0('0xc8')],{'as':_0xe7e0('0x1ca'),'onDelete':_0xe7e0('0x111'),'foreignKey':'DescriptionId'});db[_0xe7e0('0xc7')][_0xe7e0('0x114')](db[_0xe7e0('0xc8')],{'as':_0xe7e0('0x1c4'),'onDelete':_0xe7e0('0x111'),'foreignKey':'FieldId'});db[_0xe7e0('0xc7')][_0xe7e0('0x14d')](db[_0xe7e0('0xc5')],{'as':_0xe7e0('0x180'),'foreignKey':_0xe7e0('0x1c7')});db[_0xe7e0('0xc8')][_0xe7e0('0x114')](db[_0xe7e0('0xc8')],{'as':_0xe7e0('0x1d1'),'foreignKey':'SubjectId'});db['Dynamics365Field'][_0xe7e0('0x114')](db[_0xe7e0('0xc8')],{'as':_0xe7e0('0x1d2'),'foreignKey':_0xe7e0('0x1cb')});db[_0xe7e0('0xc8')][_0xe7e0('0x114')](db[_0xe7e0('0xc8')],{'as':_0xe7e0('0x1ce'),'foreignKey':_0xe7e0('0x1cc')});db[_0xe7e0('0xc8')][_0xe7e0('0x14d')](db[_0xe7e0('0x93')],{'as':_0xe7e0('0x93'),'foreignKey':_0xe7e0('0x1cf')});db[_0xe7e0('0xc9')][_0xe7e0('0x114')](db[_0xe7e0('0xcb')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xe7e0('0x1c7')});db['FreshsalesConfiguration'][_0xe7e0('0x114')](db['FreshsalesField'],{'as':_0xe7e0('0x1c9'),'foreignKey':_0xe7e0('0x1cd')});db[_0xe7e0('0xcb')][_0xe7e0('0x114')](db[_0xe7e0('0x1d9')],{'as':_0xe7e0('0x1ca'),'foreignKey':_0xe7e0('0x1cb')});db[_0xe7e0('0xcb')][_0xe7e0('0x114')](db[_0xe7e0('0x1d9')],{'as':_0xe7e0('0x1c4'),'foreignKey':_0xe7e0('0x1cc')});db['FreshsalesConfiguration'][_0xe7e0('0x14d')](db[_0xe7e0('0xc9')],{'as':'Account','foreignKey':_0xe7e0('0x1c7')});db[_0xe7e0('0x1d9')][_0xe7e0('0x114')](db[_0xe7e0('0x1d9')],{'as':_0xe7e0('0x1d1'),'foreignKey':_0xe7e0('0x1cd')});db['FreshsalesField'][_0xe7e0('0x114')](db[_0xe7e0('0x1d9')],{'as':_0xe7e0('0x1d2'),'foreignKey':_0xe7e0('0x1cb')});db[_0xe7e0('0x1d9')][_0xe7e0('0x114')](db[_0xe7e0('0x1d9')],{'as':_0xe7e0('0x1ce'),'foreignKey':_0xe7e0('0x1cc')});db[_0xe7e0('0x1d9')][_0xe7e0('0x14d')](db['Variable'],{'as':_0xe7e0('0x93'),'foreignKey':_0xe7e0('0x1cf')});db['ChatQueueReport']['belongsTo'](db['ChatWebsite'],{});db['ChatQueueReport']['belongsTo'](db[_0xe7e0('0xf3')],{'as':_0xe7e0('0x17e'),'foreignKey':_0xe7e0('0x178')});db[_0xe7e0('0xd0')]['belongsTo'](db[_0xe7e0('0x72')],{'as':_0xe7e0('0x15e'),'foreignKey':_0xe7e0('0x15f')});db[_0xe7e0('0xd0')]['belongsTo'](db['ChatInteraction'],{});db[_0xe7e0('0xd0')]['belongsTo'](db[_0xe7e0('0x194')],{});db['ChatQueueReport'][_0xe7e0('0x14d')](db[_0xe7e0('0x117')],{});db['ChatQueueReport']['belongsTo'](db[_0xe7e0('0x6c')],{});db[_0xe7e0('0xd1')][_0xe7e0('0x14d')](db['User'],{'onDelete':'cascade','foreignKey':_0xe7e0('0x1da')});db[_0xe7e0('0xd1')][_0xe7e0('0x14d')](db[_0xe7e0('0x117')],{'onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x1db')});db['JscriptySessionReport'][_0xe7e0('0x114')](db[_0xe7e0('0xd2')],{'foreignKey':_0xe7e0('0x1dc'),'onDelete':'cascade'});db[_0xe7e0('0xd4')]['hasMany'](db[_0xe7e0('0x1dd')],{'foreignKey':_0xe7e0('0x1dc'),'onDelete':_0xe7e0('0x111')});db[_0xe7e0('0xd6')][_0xe7e0('0x14d')](db[_0xe7e0('0x13e')],{});db[_0xe7e0('0xd6')][_0xe7e0('0x14d')](db[_0xe7e0('0xf3')],{'as':_0xe7e0('0x17e'),'foreignKey':'ListId'});db[_0xe7e0('0xd6')][_0xe7e0('0x14d')](db[_0xe7e0('0x72')],{'as':'Contact','foreignKey':_0xe7e0('0x15f')});db['SmsQueueReport']['belongsTo'](db[_0xe7e0('0x129')],{});db[_0xe7e0('0xd6')][_0xe7e0('0x14d')](db[_0xe7e0('0x56')],{});db[_0xe7e0('0xd6')][_0xe7e0('0x14d')](db['User'],{});db[_0xe7e0('0xd6')][_0xe7e0('0x14d')](db[_0xe7e0('0x57')],{});db[_0xe7e0('0xdb')]['hasMany'](db[_0xe7e0('0xd4')],{'foreignKey':_0xe7e0('0x1de')});db[_0xe7e0('0xdb')][_0xe7e0('0x114')](db[_0xe7e0('0xd2')],{'foreignKey':_0xe7e0('0x1de')});db[_0xe7e0('0xdb')][_0xe7e0('0x114')](db[_0xe7e0('0x1dd')],{'foreignKey':_0xe7e0('0x1de')});db[_0xe7e0('0xe4')]['belongsToMany'](db[_0xe7e0('0x117')],{'as':_0xe7e0('0x152'),'through':_0xe7e0('0x126')});db[_0xe7e0('0xe4')][_0xe7e0('0x120')](db[_0xe7e0('0x19')],{'through':_0xe7e0('0x109'),'as':_0xe7e0('0x12c')});db[_0xe7e0('0xe4')][_0xe7e0('0x120')](db['MailQueue'],{'through':_0xe7e0('0x1df'),'as':_0xe7e0('0x12f')});db[_0xe7e0('0xe4')][_0xe7e0('0x120')](db['ChatQueue'],{'through':_0xe7e0('0x1e0'),'as':_0xe7e0('0x131')});db[_0xe7e0('0xe4')][_0xe7e0('0x120')](db[_0xe7e0('0x50')],{'through':_0xe7e0('0x185'),'as':_0xe7e0('0x1e1')});db['Team'][_0xe7e0('0x120')](db[_0xe7e0('0x57')],{'through':'team_has_sms_queues','as':_0xe7e0('0x132')});db[_0xe7e0('0xe4')][_0xe7e0('0x120')](db[_0xe7e0('0x60')],{'through':_0xe7e0('0x193'),'as':_0xe7e0('0x134')});db['Team'][_0xe7e0('0x120')](db[_0xe7e0('0x106')],{'through':_0xe7e0('0x1e2'),'as':_0xe7e0('0x135')});db[_0xe7e0('0xe4')][_0xe7e0('0x120')](db[_0xe7e0('0x1e3')],{'through':_0xe7e0('0x10b'),'as':_0xe7e0('0x12e')});db[_0xe7e0('0x1a6')][_0xe7e0('0x114')](db['CmHopper'],{'as':_0xe7e0('0x149'),'foreignKey':_0xe7e0('0x1a8')});db[_0xe7e0('0x1a6')][_0xe7e0('0x114')](db['CmHopperFinal'],{'as':_0xe7e0('0x119'),'foreignKey':_0xe7e0('0x1a8')});db[_0xe7e0('0x1a6')][_0xe7e0('0x114')](db[_0xe7e0('0x79')],{'as':'HopperHistories','foreignKey':_0xe7e0('0x1a8')});db[_0xe7e0('0x1a6')][_0xe7e0('0x114')](db[_0xe7e0('0x76')],{'as':_0xe7e0('0x14b'),'foreignKey':'CampaignId'});db[_0xe7e0('0x1a6')][_0xe7e0('0x14d')](db[_0xe7e0('0x29')],{'as':_0xe7e0('0x29'),'foreignKey':'TrunkId'});db[_0xe7e0('0x1a6')][_0xe7e0('0x14d')](db[_0xe7e0('0x29')],{'as':'TrunkBackup','foreignKey':_0xe7e0('0x1e4')});db[_0xe7e0('0x1a6')][_0xe7e0('0x14d')](db[_0xe7e0('0x14f')],{'as':_0xe7e0('0x14f'),'foreignKey':_0xe7e0('0x176')});db[_0xe7e0('0x1a6')]['belongsTo'](db[_0xe7e0('0xdf')],{'as':'SquareProject','foreignKey':_0xe7e0('0x1e5')});db['Campaign'][_0xe7e0('0x120')](db[_0xe7e0('0xf3')],{'as':'Lists','through':_0xe7e0('0x1e6')});db[_0xe7e0('0x1a6')][_0xe7e0('0x120')](db[_0xe7e0('0xf3')],{'as':'BlackLists','through':_0xe7e0('0x1e7')});db[_0xe7e0('0xe9')][_0xe7e0('0x14d')](db[_0xe7e0('0x6b')],{'as':_0xe7e0('0x6b'),'foreignKey':_0xe7e0('0x175')});db[_0xe7e0('0x1e8')][_0xe7e0('0x14d')](db[_0xe7e0('0x43')],{});db[_0xe7e0('0x1e8')][_0xe7e0('0x14d')](db[_0xe7e0('0x41')],{});db[_0xe7e0('0x1e8')]['belongsTo'](db['MailAccount'],{'foreignKey':'FromMailAccountId','as':_0xe7e0('0x1e9')});db[_0xe7e0('0x1e8')][_0xe7e0('0x14d')](db[_0xe7e0('0x117')],{'foreignKey':_0xe7e0('0x1ea'),'as':_0xe7e0('0x1eb')});db[_0xe7e0('0x1e8')]['belongsTo'](db[_0xe7e0('0x117')],{'foreignKey':_0xe7e0('0x1ec'),'as':_0xe7e0('0x1ed')});db[_0xe7e0('0x1e8')][_0xe7e0('0x14d')](db[_0xe7e0('0x3e')],{'foreignKey':'ToMailQueueId','as':_0xe7e0('0x1ee')});db[_0xe7e0('0x1e8')][_0xe7e0('0x14d')](db[_0xe7e0('0x3d')],{'foreignKey':'ToMailAccountId','as':'ToAccount'});db[_0xe7e0('0xee')][_0xe7e0('0x14d')](db['ChatMessage'],{});db[_0xe7e0('0xee')][_0xe7e0('0x14d')](db[_0xe7e0('0x68')],{});db[_0xe7e0('0xee')][_0xe7e0('0x14d')](db[_0xe7e0('0x62')],{'foreignKey':'FromChatWebsiteId','as':_0xe7e0('0x1e9')});db[_0xe7e0('0xee')]['belongsTo'](db[_0xe7e0('0x117')],{'foreignKey':_0xe7e0('0x1ea'),'as':_0xe7e0('0x1eb')});db[_0xe7e0('0xee')][_0xe7e0('0x14d')](db[_0xe7e0('0x117')],{'foreignKey':_0xe7e0('0x1ec'),'as':_0xe7e0('0x1ed')});db['ChatTransferReport'][_0xe7e0('0x14d')](db['ChatQueue'],{'foreignKey':_0xe7e0('0x1ef'),'as':'ToQueue'});db[_0xe7e0('0xee')][_0xe7e0('0x14d')](db['ChatWebsite'],{'foreignKey':_0xe7e0('0x1f0'),'as':'ToAccount'});db['FaxTransferReport'][_0xe7e0('0x14d')](db[_0xe7e0('0x4e')],{});db[_0xe7e0('0xef')][_0xe7e0('0x14d')](db['FaxInteraction'],{});db[_0xe7e0('0xef')][_0xe7e0('0x14d')](db[_0xe7e0('0x17a')],{'foreignKey':_0xe7e0('0x1f1'),'as':'FromAccount'});db[_0xe7e0('0xef')][_0xe7e0('0x14d')](db[_0xe7e0('0x117')],{'foreignKey':_0xe7e0('0x1ea'),'as':'FromAgent'});db[_0xe7e0('0xef')][_0xe7e0('0x14d')](db['User'],{'foreignKey':_0xe7e0('0x1ec'),'as':_0xe7e0('0x1ed')});db[_0xe7e0('0xef')][_0xe7e0('0x14d')](db[_0xe7e0('0x50')],{'foreignKey':_0xe7e0('0x1f2'),'as':_0xe7e0('0x1ee')});db['FaxTransferReport'][_0xe7e0('0x14d')](db[_0xe7e0('0x17a')],{'foreignKey':_0xe7e0('0x1f3'),'as':_0xe7e0('0x1f4')});db[_0xe7e0('0xf0')][_0xe7e0('0x14d')](db[_0xe7e0('0x5e')],{});db[_0xe7e0('0xf0')][_0xe7e0('0x14d')](db[_0xe7e0('0x5c')],{});db[_0xe7e0('0xf0')][_0xe7e0('0x14d')](db[_0xe7e0('0x59')],{'foreignKey':_0xe7e0('0x1f5'),'as':_0xe7e0('0x1e9')});db[_0xe7e0('0xf0')][_0xe7e0('0x14d')](db[_0xe7e0('0x117')],{'foreignKey':_0xe7e0('0x1ea'),'as':'FromAgent'});db[_0xe7e0('0xf0')]['belongsTo'](db[_0xe7e0('0x117')],{'foreignKey':_0xe7e0('0x1ec'),'as':_0xe7e0('0x1ed')});db['OpenchannelTransferReport']['belongsTo'](db[_0xe7e0('0x60')],{'foreignKey':'ToOpenchannelQueueId','as':_0xe7e0('0x1ee')});db[_0xe7e0('0xf0')][_0xe7e0('0x14d')](db[_0xe7e0('0x59')],{'foreignKey':_0xe7e0('0x1f6'),'as':_0xe7e0('0x1f4')});db['SmsTransferReport']['belongsTo'](db[_0xe7e0('0x56')],{});db[_0xe7e0('0xf1')][_0xe7e0('0x14d')](db[_0xe7e0('0x129')],{});db[_0xe7e0('0xf1')][_0xe7e0('0x14d')](db[_0xe7e0('0x13e')],{'foreignKey':_0xe7e0('0x1f7'),'as':_0xe7e0('0x1e9')});db['SmsTransferReport'][_0xe7e0('0x14d')](db['User'],{'foreignKey':_0xe7e0('0x1ea'),'as':_0xe7e0('0x1eb')});db[_0xe7e0('0xf1')][_0xe7e0('0x14d')](db[_0xe7e0('0x117')],{'foreignKey':_0xe7e0('0x1ec'),'as':_0xe7e0('0x1ed')});db['SmsTransferReport'][_0xe7e0('0x14d')](db[_0xe7e0('0x57')],{'foreignKey':_0xe7e0('0x1f8'),'as':_0xe7e0('0x1ee')});db['SmsTransferReport'][_0xe7e0('0x14d')](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':_0xe7e0('0x1f4')});db['CmList'][_0xe7e0('0x114')](db[_0xe7e0('0x82')],{'as':_0xe7e0('0x167'),'foreignKey':_0xe7e0('0x178'),'onDelete':'cascade'});db['CmList'][_0xe7e0('0x114')](db[_0xe7e0('0x7c')],{'as':_0xe7e0('0x1f9'),'foreignKey':'ListId'});db['CmList'][_0xe7e0('0x114')](db[_0xe7e0('0x72')],{'as':_0xe7e0('0x122'),'onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x178')});db[_0xe7e0('0xf3')][_0xe7e0('0x114')](db[_0xe7e0('0x118')],{'as':_0xe7e0('0x119'),'foreignKey':_0xe7e0('0x178')});db[_0xe7e0('0xf3')][_0xe7e0('0x114')](db[_0xe7e0('0x79')],{'as':_0xe7e0('0x11a'),'foreignKey':_0xe7e0('0x178')});db[_0xe7e0('0xf3')]['hasMany'](db['ReportAgentPreview'],{'as':_0xe7e0('0x7a'),'foreignKey':_0xe7e0('0x178')});db[_0xe7e0('0xf3')][_0xe7e0('0x120')](db[_0xe7e0('0x19')],{'as':_0xe7e0('0x1fa'),'through':_0xe7e0('0x151')});db[_0xe7e0('0xf3')][_0xe7e0('0x120')](db[_0xe7e0('0x117')],{'as':'Agents','through':_0xe7e0('0x125')});db[_0xe7e0('0x1e3')][_0xe7e0('0x114')](db[_0xe7e0('0x16')],{'as':_0xe7e0('0x116'),'onDelete':_0xe7e0('0x111')});db['VoicePrefix'][_0xe7e0('0x120')](db[_0xe7e0('0x117')],{'as':_0xe7e0('0x152'),'through':'UserVoicePrefix'});db[_0xe7e0('0x1e3')][_0xe7e0('0x120')](db[_0xe7e0('0xe4')],{'through':_0xe7e0('0x10b'),'as':_0xe7e0('0x186')});db[_0xe7e0('0xf6')][_0xe7e0('0x114')](db[_0xe7e0('0x117')],{'as':_0xe7e0('0x171'),'foreignKey':'userProfileId'});db[_0xe7e0('0xf6')][_0xe7e0('0x114')](db[_0xe7e0('0xf8')],{'as':_0xe7e0('0x1fb'),'foreignKey':'userProfileId','onDelete':'cascade'});db[_0xe7e0('0xf8')][_0xe7e0('0x114')](db['UserProfileResource'],{'as':_0xe7e0('0x1fc'),'foreignKey':_0xe7e0('0x1fd'),'onDelete':_0xe7e0('0x111')});db[_0xe7e0('0xfc')][_0xe7e0('0x114')](db[_0xe7e0('0x82')],{'as':_0xe7e0('0x167'),'foreignKey':_0xe7e0('0x1fe'),'onDelete':_0xe7e0('0x111')});db['WhatsappAccount'][_0xe7e0('0x114')](db[_0xe7e0('0x80')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db[_0xe7e0('0xfc')]['hasMany'](db[_0xe7e0('0x101')],{'as':_0xe7e0('0x156'),'foreignKey':'WhatsappAccountId'});db[_0xe7e0('0xfc')]['hasMany'](db[_0xe7e0('0xff')],{'as':'Interactions'});db['WhatsappAccount'][_0xe7e0('0x114')](db[_0xe7e0('0xfd')],{'as':_0xe7e0('0x143')});db[_0xe7e0('0xfc')][_0xe7e0('0x14d')](db[_0xe7e0('0xf3')],{'as':'List','foreignKey':_0xe7e0('0x178')});db['WhatsappAccount'][_0xe7e0('0x14d')](db[_0xe7e0('0x86')],{'as':'mandatoryDispositionPause','foreignKey':_0xe7e0('0x150')});db[_0xe7e0('0xfc')][_0xe7e0('0x120')](db[_0xe7e0('0x117')],{'as':_0xe7e0('0x152'),'through':_0xe7e0('0x140')});db[_0xe7e0('0xfd')]['belongsTo'](db['User'],{'onDelete':_0xe7e0('0x161')});db[_0xe7e0('0xfd')][_0xe7e0('0x14d')](db[_0xe7e0('0x106')],{'onDelete':'restrict'});db[_0xe7e0('0xfd')][_0xe7e0('0x14d')](db[_0xe7e0('0xfc')],{'onDelete':_0xe7e0('0x161')});db[_0xe7e0('0xfd')][_0xe7e0('0x14d')](db[_0xe7e0('0x14f')],{'onDelete':_0xe7e0('0x161'),'foreignKey':'IntervalId'});db['WhatsappApplication']['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':_0xe7e0('0x177')});db[_0xe7e0('0xff')][_0xe7e0('0x114')](db[_0xe7e0('0x101')],{'as':_0xe7e0('0x156'),'onDelete':_0xe7e0('0x111'),'foreignKey':_0xe7e0('0x1ff')});db[_0xe7e0('0xff')][_0xe7e0('0x14d')](db[_0xe7e0('0xfc')],{'as':_0xe7e0('0x180'),'foreignKey':'WhatsappAccountId'});db[_0xe7e0('0xff')][_0xe7e0('0x14d')](db[_0xe7e0('0x72')],{'as':_0xe7e0('0x15e'),'foreignKey':_0xe7e0('0x15f')});db[_0xe7e0('0xff')][_0xe7e0('0x14d')](db[_0xe7e0('0x117')],{'as':_0xe7e0('0x16d'),'foreignKey':_0xe7e0('0x112')});db[_0xe7e0('0xff')][_0xe7e0('0x120')](db[_0xe7e0('0x8b')],{'through':_0xe7e0('0x1ba'),'as':'Tags'});db[_0xe7e0('0xff')][_0xe7e0('0x120')](db[_0xe7e0('0x8b')],{'through':_0xe7e0('0x1ba'),'as':_0xe7e0('0x170')});db[_0xe7e0('0xff')][_0xe7e0('0x120')](db[_0xe7e0('0x117')],{'as':'Users','through':_0xe7e0('0x12b'),'foreignKey':_0xe7e0('0x1ff')});db[_0xe7e0('0x101')]['belongsTo'](db[_0xe7e0('0x117')],{'as':'User'});db['WhatsappMessage']['belongsTo'](db[_0xe7e0('0x72')],{'onDelete':'cascade','as':_0xe7e0('0x15e')});db[_0xe7e0('0x101')][_0xe7e0('0x14d')](db[_0xe7e0('0xff')],{'onDelete':_0xe7e0('0x111'),'as':'Interaction','foreignKey':_0xe7e0('0x1ff')});db[_0xe7e0('0x101')][_0xe7e0('0x14d')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0xe7e0('0x1fe')});db['WhatsappQueueReport'][_0xe7e0('0x14d')](db[_0xe7e0('0xfc')],{});db['WhatsappQueueReport'][_0xe7e0('0x14d')](db[_0xe7e0('0xf3')],{'as':_0xe7e0('0x17e'),'foreignKey':_0xe7e0('0x178')});db['WhatsappQueueReport'][_0xe7e0('0x14d')](db[_0xe7e0('0x72')],{'as':_0xe7e0('0x15e'),'foreignKey':_0xe7e0('0x15f')});db[_0xe7e0('0x102')][_0xe7e0('0x14d')](db[_0xe7e0('0xff')],{});db[_0xe7e0('0x102')]['belongsTo'](db[_0xe7e0('0x106')],{});db[_0xe7e0('0x102')][_0xe7e0('0x14d')](db[_0xe7e0('0x101')],{});db[_0xe7e0('0x102')][_0xe7e0('0x14d')](db[_0xe7e0('0x117')],{});db[_0xe7e0('0x104')]['belongsTo'](db['WhatsappMessage'],{});db[_0xe7e0('0x104')][_0xe7e0('0x14d')](db[_0xe7e0('0xff')],{});db[_0xe7e0('0x104')][_0xe7e0('0x14d')](db[_0xe7e0('0xfc')],{'foreignKey':_0xe7e0('0x200'),'as':_0xe7e0('0x1e9')});db[_0xe7e0('0x104')][_0xe7e0('0x14d')](db[_0xe7e0('0xfc')],{'foreignKey':_0xe7e0('0x201'),'as':_0xe7e0('0x1f4')});db[_0xe7e0('0x104')][_0xe7e0('0x14d')](db['WhatsappQueue'],{'foreignKey':_0xe7e0('0x202'),'as':'ToQueue'});db[_0xe7e0('0x104')]['belongsTo'](db['User'],{'foreignKey':_0xe7e0('0x1ea'),'as':_0xe7e0('0x1eb')});db[_0xe7e0('0x104')][_0xe7e0('0x14d')](db[_0xe7e0('0x117')],{'foreignKey':_0xe7e0('0x1ec'),'as':_0xe7e0('0x1ed')});db[_0xe7e0('0x106')]['belongsToMany'](db[_0xe7e0('0x117')],{'as':_0xe7e0('0x152'),'through':_0xe7e0('0x38'),'foreignKey':_0xe7e0('0x203')});db[_0xe7e0('0x106')][_0xe7e0('0x120')](db[_0xe7e0('0xe4')],{'through':'team_has_whatsapp_queues','as':_0xe7e0('0x186')});db[_0xe7e0('0x10f')]['belongsTo'](db[_0xe7e0('0x117')],{'as':_0xe7e0('0x204'),'foreignKey':_0xe7e0('0x112'),'onDelete':_0xe7e0('0x111'),'hooks':!![]});db[_0xe7e0('0x160')][_0xe7e0('0x165')](db[_0xe7e0('0xc5')],{'as':_0xe7e0('0xc5'),'onDelete':'restrict'});db[_0xe7e0('0x160')][_0xe7e0('0x165')](db['MailServerIn'],{'as':_0xe7e0('0x164'),'onDelete':'restrict'});db['CloudProvider'][_0xe7e0('0x165')](db[_0xe7e0('0x3c')],{'as':_0xe7e0('0x166'),'onDelete':_0xe7e0('0x161')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 513e67c..ea7abb7 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x147f=['./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/desk/accounts','./api/intDeskAccount','/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/intZendeskAccount','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/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/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','/api/realtime','./api/realtime','/api/user-settings','./api/authLocal','./api/authGoogle','/api/auth/activedirectory','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/webbar','./api/webbar','/api/logs','static','join','root','/www','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','sendFile','get','appPath','/index.html','path','express','./errors','./utils/client-side-logger','setupLoggers','default','then','use','/api/users','./api/user','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x147f,0xd5));var _0xf147=function(_0x18dc06,_0x344863){_0x18dc06=_0x18dc06-0x0;var _0x211d83=_0x147f[_0x18dc06];return _0x211d83;};'use strict';var path=require(_0xf147('0x0'));var express=require(_0xf147('0x1'));var errors=require(_0xf147('0x2'));var config=require('./config/environment');var setupLoggers=require(_0xf147('0x3'))[_0xf147('0x4')];var clientSideLogs=require('./api/client-side-logs');exports[_0xf147('0x5')]=function(_0x16dd09){return setupLoggers(_0x16dd09)[_0xf147('0x6')](function(){_0x16dd09[_0xf147('0x7')](_0xf147('0x8'),require(_0xf147('0x9')));_0x16dd09[_0xf147('0x7')]('/api/voice/chanspy',require('./api/voiceChanSpy'));_0x16dd09[_0xf147('0x7')](_0xf147('0xa'),require(_0xf147('0xb')));_0x16dd09['use']('/api/voice/extensions',require(_0xf147('0xc')));_0x16dd09[_0xf147('0x7')]('/api/voice/mohs',require(_0xf147('0xd')));_0x16dd09[_0xf147('0x7')](_0xf147('0xe'),require(_0xf147('0xf')));_0x16dd09[_0xf147('0x7')](_0xf147('0x10'),require('./api/voiceRecording'));_0x16dd09['use'](_0xf147('0x11'),require('./api/screenRecording'));_0x16dd09[_0xf147('0x7')](_0xf147('0x12'),require(_0xf147('0x13')));_0x16dd09[_0xf147('0x7')]('/api/voice/mails/messages',require(_0xf147('0x14')));_0x16dd09['use'](_0xf147('0x15'),require(_0xf147('0x16')));_0x16dd09[_0xf147('0x7')](_0xf147('0x17'),require(_0xf147('0x18')));_0x16dd09[_0xf147('0x7')](_0xf147('0x19'),require(_0xf147('0x1a')));_0x16dd09[_0xf147('0x7')]('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x16dd09[_0xf147('0x7')](_0xf147('0x1b'),require(_0xf147('0x1c')));_0x16dd09[_0xf147('0x7')]('/api/trunks',require(_0xf147('0x1d')));_0x16dd09[_0xf147('0x7')](_0xf147('0x1e'),require('./api/voiceTransferReport'));_0x16dd09['use']('/api/mail/out_servers',require('./api/mailServerOut'));_0x16dd09[_0xf147('0x7')](_0xf147('0x1f'),require(_0xf147('0x20')));_0x16dd09[_0xf147('0x7')](_0xf147('0x21'),require('./api/mailQueue'));_0x16dd09[_0xf147('0x7')]('/api/mail/substatuses',require(_0xf147('0x22')));_0x16dd09[_0xf147('0x7')](_0xf147('0x23'),require(_0xf147('0x24')));_0x16dd09[_0xf147('0x7')]('/api/mail/messages',require('./api/mailMessage'));_0x16dd09[_0xf147('0x7')](_0xf147('0x25'),require(_0xf147('0x26')));_0x16dd09[_0xf147('0x7')](_0xf147('0x27'),require(_0xf147('0x28')));_0x16dd09[_0xf147('0x7')](_0xf147('0x29'),require('./api/dashboard'));_0x16dd09[_0xf147('0x7')]('/api/dashboards/items',require(_0xf147('0x2a')));_0x16dd09[_0xf147('0x7')](_0xf147('0x2b'),require(_0xf147('0x2c')));_0x16dd09[_0xf147('0x7')]('/api/fax/applications',require(_0xf147('0x2d')));_0x16dd09[_0xf147('0x7')](_0xf147('0x2e'),require(_0xf147('0x2f')));_0x16dd09[_0xf147('0x7')](_0xf147('0x30'),require(_0xf147('0x31')));_0x16dd09[_0xf147('0x7')]('/api/fax/queues',require(_0xf147('0x32')));_0x16dd09[_0xf147('0x7')](_0xf147('0x33'),require('./api/faxQueueReport'));_0x16dd09[_0xf147('0x7')](_0xf147('0x34'),require(_0xf147('0x35')));_0x16dd09[_0xf147('0x7')](_0xf147('0x36'),require(_0xf147('0x37')));_0x16dd09[_0xf147('0x7')](_0xf147('0x38'),require(_0xf147('0x39')));_0x16dd09[_0xf147('0x7')](_0xf147('0x3a'),require(_0xf147('0x3b')));_0x16dd09[_0xf147('0x7')](_0xf147('0x3c'),require(_0xf147('0x3d')));_0x16dd09[_0xf147('0x7')]('/api/openchannel/accounts',require(_0xf147('0x3e')));_0x16dd09[_0xf147('0x7')](_0xf147('0x3f'),require(_0xf147('0x40')));_0x16dd09[_0xf147('0x7')](_0xf147('0x41'),require('./api/openchannelInteraction'));_0x16dd09[_0xf147('0x7')]('/api/openchannel/messages',require(_0xf147('0x42')));_0x16dd09[_0xf147('0x7')](_0xf147('0x43'),require(_0xf147('0x44')));_0x16dd09[_0xf147('0x7')](_0xf147('0x45'),require('./api/chatWebsite'));_0x16dd09[_0xf147('0x7')]('/api/openchannel/reports/queue',require(_0xf147('0x46')));_0x16dd09[_0xf147('0x7')](_0xf147('0x47'),require(_0xf147('0x48')));_0x16dd09[_0xf147('0x7')](_0xf147('0x49'),require(_0xf147('0x4a')));_0x16dd09[_0xf147('0x7')]('/api/chat/messages',require(_0xf147('0x4b')));_0x16dd09[_0xf147('0x7')](_0xf147('0x4c'),require(_0xf147('0x4d')));_0x16dd09['use'](_0xf147('0x4e'),require(_0xf147('0x4f')));_0x16dd09['use']('/api/chat/groups',require('./api/chatGroup'));_0x16dd09[_0xf147('0x7')](_0xf147('0x50'),require(_0xf147('0x51')));_0x16dd09['use'](_0xf147('0x52'),require(_0xf147('0x53')));_0x16dd09[_0xf147('0x7')](_0xf147('0x54'),require(_0xf147('0x55')));_0x16dd09[_0xf147('0x7')](_0xf147('0x56'),require(_0xf147('0x57')));_0x16dd09[_0xf147('0x7')](_0xf147('0x58'),require('./api/cmHopperBlack'));_0x16dd09[_0xf147('0x7')](_0xf147('0x59'),require(_0xf147('0x5a')));_0x16dd09['use'](_0xf147('0x5b'),require(_0xf147('0x5c')));_0x16dd09[_0xf147('0x7')](_0xf147('0x5d'),require(_0xf147('0x5e')));_0x16dd09['use'](_0xf147('0x5f'),require(_0xf147('0x60')));_0x16dd09['use'](_0xf147('0x61'),require(_0xf147('0x62')));_0x16dd09[_0xf147('0x7')](_0xf147('0x63'),require(_0xf147('0x64')));_0x16dd09[_0xf147('0x7')](_0xf147('0x65'),require(_0xf147('0x66')));_0x16dd09[_0xf147('0x7')]('/api/conditions',require(_0xf147('0x67')));_0x16dd09['use'](_0xf147('0x68'),require('./api/interval'));_0x16dd09[_0xf147('0x7')](_0xf147('0x69'),require(_0xf147('0x6a')));_0x16dd09[_0xf147('0x7')](_0xf147('0x6b'),require('./api/cdr'));_0x16dd09['use'](_0xf147('0x6c'),require('./api/voiceQueuesLog'));_0x16dd09[_0xf147('0x7')](_0xf147('0x6d'),require(_0xf147('0x6e')));_0x16dd09['use'](_0xf147('0x6f'),require('./api/sound'));_0x16dd09[_0xf147('0x7')](_0xf147('0x70'),require('./api/tag'));_0x16dd09[_0xf147('0x7')](_0xf147('0x71'),require(_0xf147('0x72')));_0x16dd09['use'](_0xf147('0x73'),require(_0xf147('0x74')));_0x16dd09[_0xf147('0x7')]('/api/cm_hopper_additional_phones',require(_0xf147('0x75')));_0x16dd09['use'](_0xf147('0x76'),require(_0xf147('0x77')));_0x16dd09[_0xf147('0x7')](_0xf147('0x78'),require(_0xf147('0x79')));_0x16dd09[_0xf147('0x7')](_0xf147('0x7a'),require(_0xf147('0x7b')));_0x16dd09['use'](_0xf147('0x7c'),require(_0xf147('0x7d')));_0x16dd09[_0xf147('0x7')](_0xf147('0x7e'),require(_0xf147('0x7f')));_0x16dd09[_0xf147('0x7')](_0xf147('0x80'),require(_0xf147('0x81')));_0x16dd09[_0xf147('0x7')](_0xf147('0x82'),require(_0xf147('0x83')));_0x16dd09[_0xf147('0x7')](_0xf147('0x84'),require(_0xf147('0x85')));_0x16dd09[_0xf147('0x7')](_0xf147('0x86'),require('./api/analyticMetric'));_0x16dd09[_0xf147('0x7')](_0xf147('0x87'),require(_0xf147('0x88')));_0x16dd09[_0xf147('0x7')](_0xf147('0x89'),require(_0xf147('0x8a')));_0x16dd09[_0xf147('0x7')](_0xf147('0x8b'),require(_0xf147('0x8c')));_0x16dd09[_0xf147('0x7')](_0xf147('0x8d'),require(_0xf147('0x8e')));_0x16dd09[_0xf147('0x7')](_0xf147('0x8f'),require(_0xf147('0x90')));_0x16dd09[_0xf147('0x7')]('/api/integrations/sugarcrm/accounts',require(_0xf147('0x91')));_0x16dd09[_0xf147('0x7')]('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x16dd09['use']('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x16dd09[_0xf147('0x7')](_0xf147('0x92'),require(_0xf147('0x93')));_0x16dd09[_0xf147('0x7')](_0xf147('0x94'),require(_0xf147('0x95')));_0x16dd09['use'](_0xf147('0x96'),require(_0xf147('0x97')));_0x16dd09[_0xf147('0x7')](_0xf147('0x98'),require(_0xf147('0x99')));_0x16dd09[_0xf147('0x7')](_0xf147('0x9a'),require(_0xf147('0x9b')));_0x16dd09[_0xf147('0x7')](_0xf147('0x9c'),require(_0xf147('0x9d')));_0x16dd09['use']('/api/integrations/zendesk/accounts',require(_0xf147('0x9e')));_0x16dd09['use']('/api/integrations/zendesk/configurations',require('./api/intZendeskConfiguration'));_0x16dd09[_0xf147('0x7')]('/api/integrations/zendesk/fields',require(_0xf147('0x9f')));_0x16dd09[_0xf147('0x7')](_0xf147('0xa0'),require(_0xf147('0xa1')));_0x16dd09[_0xf147('0x7')](_0xf147('0xa2'),require(_0xf147('0xa3')));_0x16dd09[_0xf147('0x7')](_0xf147('0xa4'),require(_0xf147('0xa5')));_0x16dd09['use']('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x16dd09[_0xf147('0x7')](_0xf147('0xa6'),require(_0xf147('0xa7')));_0x16dd09[_0xf147('0x7')](_0xf147('0xa8'),require(_0xf147('0xa9')));_0x16dd09[_0xf147('0x7')](_0xf147('0xaa'),require(_0xf147('0xab')));_0x16dd09[_0xf147('0x7')]('/api/integrations/servicenow/configurations',require(_0xf147('0xac')));_0x16dd09[_0xf147('0x7')](_0xf147('0xad'),require(_0xf147('0xae')));_0x16dd09['use']('/api/integrations/dynamics365/accounts',require(_0xf147('0xaf')));_0x16dd09[_0xf147('0x7')](_0xf147('0xb0'),require(_0xf147('0xb1')));_0x16dd09['use'](_0xf147('0xb2'),require(_0xf147('0xb3')));_0x16dd09[_0xf147('0x7')](_0xf147('0xb4'),require('./api/intFreshsalesAccount'));_0x16dd09['use'](_0xf147('0xb5'),require(_0xf147('0xb6')));_0x16dd09[_0xf147('0x7')](_0xf147('0xb7'),require(_0xf147('0xb8')));_0x16dd09['use'](_0xf147('0xb9'),require(_0xf147('0xba')));_0x16dd09[_0xf147('0x7')](_0xf147('0xbb'),require(_0xf147('0xbc')));_0x16dd09['use']('/api/chat/internal/messages',require('./api/chatInternalMessage'));_0x16dd09[_0xf147('0x7')]('/api/jscripty/answers/reports',require(_0xf147('0xbd')));_0x16dd09['use']('/api/jscripty/questions/reports',require(_0xf147('0xbe')));_0x16dd09[_0xf147('0x7')](_0xf147('0xbf'),require(_0xf147('0xc0')));_0x16dd09['use'](_0xf147('0xc1'),require(_0xf147('0xc2')));_0x16dd09['use'](_0xf147('0xc3'),require(_0xf147('0xc4')));_0x16dd09[_0xf147('0x7')](_0xf147('0xc5'),require(_0xf147('0xc6')));_0x16dd09[_0xf147('0x7')](_0xf147('0xc7'),require(_0xf147('0xc8')));_0x16dd09['use'](_0xf147('0xc9'),require(_0xf147('0xca')));_0x16dd09[_0xf147('0x7')]('/api/square/odbc',require('./api/squareOdbc'));_0x16dd09[_0xf147('0x7')](_0xf147('0xcb'),require(_0xf147('0xcc')));_0x16dd09[_0xf147('0x7')](_0xf147('0xcd'),require(_0xf147('0xce')));_0x16dd09[_0xf147('0x7')](_0xf147('0xcf'),require(_0xf147('0xd0')));_0x16dd09['use'](_0xf147('0xd1'),require(_0xf147('0xd2')));_0x16dd09[_0xf147('0x7')](_0xf147('0xd3'),require(_0xf147('0xd4')));_0x16dd09['use'](_0xf147('0xd5'),require(_0xf147('0xd6')));_0x16dd09[_0xf147('0x7')](_0xf147('0xd7'),require(_0xf147('0xd8')));_0x16dd09['use'](_0xf147('0xd9'),require(_0xf147('0xda')));_0x16dd09[_0xf147('0x7')](_0xf147('0xdb'),require(_0xf147('0xdc')));_0x16dd09['use']('/api/mail/reports/transfer',require(_0xf147('0xdd')));_0x16dd09['use']('/api/chat/reports/transfer',require(_0xf147('0xde')));_0x16dd09[_0xf147('0x7')](_0xf147('0xdf'),require(_0xf147('0xe0')));_0x16dd09[_0xf147('0x7')](_0xf147('0xe1'),require(_0xf147('0xe2')));_0x16dd09['use'](_0xf147('0xe3'),require(_0xf147('0xe4')));_0x16dd09[_0xf147('0x7')]('/api/cm/lists',require(_0xf147('0xe5')));_0x16dd09[_0xf147('0x7')]('/api/voice/prefixes',require(_0xf147('0xe6')));_0x16dd09[_0xf147('0x7')](_0xf147('0xe7'),require(_0xf147('0xe8')));_0x16dd09['use'](_0xf147('0xe9'),require(_0xf147('0xea')));_0x16dd09[_0xf147('0x7')](_0xf147('0xeb'),require(_0xf147('0xec')));_0x16dd09[_0xf147('0x7')]('/api/userNotifications',require('./api/userNotification'));_0x16dd09[_0xf147('0x7')]('/api/whatsapp/accounts',require(_0xf147('0xed')));_0x16dd09['use'](_0xf147('0xee'),require('./api/whatsappApplication'));_0x16dd09[_0xf147('0x7')](_0xf147('0xef'),require('./api/whatsappInteraction'));_0x16dd09['use'](_0xf147('0xf0'),require(_0xf147('0xf1')));_0x16dd09['use']('/api/whatsapp/reports/queue',require(_0xf147('0xf2')));_0x16dd09[_0xf147('0x7')](_0xf147('0xf3'),require(_0xf147('0xf4')));_0x16dd09[_0xf147('0x7')](_0xf147('0xf5'),require('./api/whatsappQueue'));_0x16dd09[_0xf147('0x7')](_0xf147('0xf6'),require('./api/cloudProvider'));_0x16dd09[_0xf147('0x7')](_0xf147('0xf7'),require(_0xf147('0xf8')));_0x16dd09['use'](_0xf147('0xf9'),require('./api/user-setting'));_0x16dd09[_0xf147('0x7')]('/api/auth/local',require(_0xf147('0xfa')));_0x16dd09[_0xf147('0x7')]('/api/auth/google',require(_0xf147('0xfb')));_0x16dd09[_0xf147('0x7')](_0xf147('0xfc'),require('./api/authActiveDirectory'));_0x16dd09[_0xf147('0x7')](_0xf147('0xfd'),require('./api/jira'));_0x16dd09[_0xf147('0x7')](_0xf147('0xfe'),require(_0xf147('0xff')));_0x16dd09[_0xf147('0x7')](_0xf147('0x100'),require(_0xf147('0x101')));_0x16dd09[_0xf147('0x7')](_0xf147('0x102'),require(_0xf147('0x103')));_0x16dd09[_0xf147('0x7')]('/api/pm2',require('./api/pm2'));_0x16dd09[_0xf147('0x7')](_0xf147('0x104'),require(_0xf147('0x105')));_0x16dd09[_0xf147('0x7')](_0xf147('0x106'),clientSideLogs);_0x16dd09['use']('/apidoc',express[_0xf147('0x107')](path[_0xf147('0x108')](config[_0xf147('0x109')],'/apidoc')));_0x16dd09[_0xf147('0x7')]('/www',express['static'](path[_0xf147('0x108')](config[_0xf147('0x109')],_0xf147('0x10a'))));_0x16dd09[_0xf147('0x7')](_0xf147('0x10b'),express[_0xf147('0x107')](path[_0xf147('0x108')](config[_0xf147('0x109')],'/demo')));_0x16dd09[_0xf147('0x7')](_0xf147('0x10c'),express[_0xf147('0x107')](path[_0xf147('0x108')](config[_0xf147('0x109')],_0xf147('0x10d'),_0xf147('0x10e'))));_0x16dd09[_0xf147('0x7')](_0xf147('0x10f'),express[_0xf147('0x107')](path[_0xf147('0x108')](config[_0xf147('0x109')],_0xf147('0x110'))));_0x16dd09[_0xf147('0x111')](_0xf147('0x112'))['get'](errors[0x194]);_0x16dd09[_0xf147('0x111')]('/*')['get'](function(_0x4008b6,_0x3722b4){_0x3722b4[_0xf147('0x113')](path['resolve'](_0x16dd09[_0xf147('0x114')](_0xf147('0x115'))+_0xf147('0x116')));});return _0x16dd09;});}; \ No newline at end of file +var _0xcbdf=['/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/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/automations','./api/automation','./api/cannedAnswer','./api/disposition','./api/condition','/api/pauses','./api/pause','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZendeskAccount','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intDynamics365Account','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/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/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','./api/user-setting','/api/auth/google','./api/authGoogle','./api/authActiveDirectory','./api/jira','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','snippet','3.0.0','/server/files/plugins','route','get','sendFile','resolve','express','./errors','./config/environment','./utils/client-side-logger','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./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/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','./api/faxInteraction','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/openchannelQueueReport','/api/chat/applications'];(function(_0x4a321c,_0x3ab7d5){var _0x108e52=function(_0x3e5e3b){while(--_0x3e5e3b){_0x4a321c['push'](_0x4a321c['shift']());}};_0x108e52(++_0x3ab7d5);}(_0xcbdf,0xbf));var _0xfcbd=function(_0x27ca80,_0x489ccb){_0x27ca80=_0x27ca80-0x0;var _0x191c73=_0xcbdf[_0x27ca80];return _0x191c73;};'use strict';var path=require('path');var express=require(_0xfcbd('0x0'));var errors=require(_0xfcbd('0x1'));var config=require(_0xfcbd('0x2'));var setupLoggers=require(_0xfcbd('0x3'))['setupLoggers'];var clientSideLogs=require('./api/client-side-logs');exports[_0xfcbd('0x4')]=function(_0x40b632){return setupLoggers(_0x40b632)[_0xfcbd('0x5')](function(){_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x7'),require(_0xfcbd('0x8')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x9'),require(_0xfcbd('0xa')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xb'),require('./api/voiceContext'));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xc'),require(_0xfcbd('0xd')));_0x40b632[_0xfcbd('0x6')]('/api/voice/mohs',require(_0xfcbd('0xe')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xf'),require(_0xfcbd('0x10')));_0x40b632[_0xfcbd('0x6')]('/api/voice/recordings',require('./api/voiceRecording'));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x11'),require(_0xfcbd('0x12')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x13'),require(_0xfcbd('0x14')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x15'),require(_0xfcbd('0x16')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x17'),require(_0xfcbd('0x18')));_0x40b632[_0xfcbd('0x6')]('/api/voice/dials/reports',require(_0xfcbd('0x19')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x1a'),require(_0xfcbd('0x1b')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x1c'),require(_0xfcbd('0x1d')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x1e'),require('./api/memberReport'));_0x40b632['use'](_0xfcbd('0x1f'),require(_0xfcbd('0x20')));_0x40b632['use'](_0xfcbd('0x21'),require(_0xfcbd('0x22')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x23'),require(_0xfcbd('0x24')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x25'),require(_0xfcbd('0x26')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x27'),require('./api/mailQueue'));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x28'),require(_0xfcbd('0x29')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x2a'),require(_0xfcbd('0x2b')));_0x40b632[_0xfcbd('0x6')]('/api/mail/messages',require('./api/mailMessage'));_0x40b632[_0xfcbd('0x6')]('/api/mail/applications',require(_0xfcbd('0x2c')));_0x40b632['use'](_0xfcbd('0x2d'),require(_0xfcbd('0x2e')));_0x40b632[_0xfcbd('0x6')]('/api/dashboards',require(_0xfcbd('0x2f')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x30'),require(_0xfcbd('0x31')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x32'),require('./api/faxAccount'));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x33'),require(_0xfcbd('0x34')));_0x40b632[_0xfcbd('0x6')]('/api/fax/interactions',require(_0xfcbd('0x35')));_0x40b632[_0xfcbd('0x6')]('/api/fax/messages',require(_0xfcbd('0x36')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x37'),require('./api/faxQueue'));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x38'),require(_0xfcbd('0x39')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x3a'),require(_0xfcbd('0x3b')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x3c'),require(_0xfcbd('0x3d')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x3e'),require(_0xfcbd('0x3f')));_0x40b632['use']('/api/sms/messages',require('./api/smsMessage'));_0x40b632['use'](_0xfcbd('0x40'),require(_0xfcbd('0x41')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x42'),require(_0xfcbd('0x43')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x44'),require(_0xfcbd('0x45')));_0x40b632[_0xfcbd('0x6')]('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0x40b632['use']('/api/openchannel/messages',require(_0xfcbd('0x46')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x47'),require(_0xfcbd('0x48')));_0x40b632[_0xfcbd('0x6')]('/api/chat/websites',require('./api/chatWebsite'));_0x40b632[_0xfcbd('0x6')]('/api/openchannel/reports/queue',require(_0xfcbd('0x49')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x4a'),require('./api/chatApplication'));_0x40b632['use'](_0xfcbd('0x4b'),require(_0xfcbd('0x4c')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x4d'),require(_0xfcbd('0x4e')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x4f'),require(_0xfcbd('0x50')));_0x40b632['use'](_0xfcbd('0x51'),require(_0xfcbd('0x52')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x53'),require(_0xfcbd('0x54')));_0x40b632[_0xfcbd('0x6')]('/api/chat/proactive_actions',require(_0xfcbd('0x55')));_0x40b632[_0xfcbd('0x6')]('/api/cm/companies',require(_0xfcbd('0x56')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x57'),require(_0xfcbd('0x58')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x59'),require(_0xfcbd('0x5a')));_0x40b632[_0xfcbd('0x6')]('/api/cm/hopper_black',require(_0xfcbd('0x5b')));_0x40b632[_0xfcbd('0x6')]('/api/cm/hopper_final',require(_0xfcbd('0x5c')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x5d'),require(_0xfcbd('0x5e')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x5f'),require(_0xfcbd('0x60')));_0x40b632['use']('/api/actions',require('./api/action'));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x61'),require(_0xfcbd('0x62')));_0x40b632[_0xfcbd('0x6')]('/api/canned_answers',require(_0xfcbd('0x63')));_0x40b632[_0xfcbd('0x6')]('/api/dispositions',require(_0xfcbd('0x64')));_0x40b632['use']('/api/conditions',require(_0xfcbd('0x65')));_0x40b632[_0xfcbd('0x6')]('/api/intervals',require('./api/interval'));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x66'),require(_0xfcbd('0x67')));_0x40b632['use']('/api/cdr',require('./api/cdr'));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x68'),require(_0xfcbd('0x69')));_0x40b632['use']('/api/schedules',require(_0xfcbd('0x6a')));_0x40b632[_0xfcbd('0x6')]('/api/sounds',require(_0xfcbd('0x6b')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x6c'),require(_0xfcbd('0x6d')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x6e'),require(_0xfcbd('0x6f')));_0x40b632['use'](_0xfcbd('0x70'),require(_0xfcbd('0x71')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x72'),require(_0xfcbd('0x73')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x74'),require(_0xfcbd('0x75')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x76'),require(_0xfcbd('0x77')));_0x40b632[_0xfcbd('0x6')]('/api/variables',require(_0xfcbd('0x78')));_0x40b632[_0xfcbd('0x6')]('/api/integrations',require('./api/integration'));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x79'),require(_0xfcbd('0x7a')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x7b'),require(_0xfcbd('0x7c')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x7d'),require(_0xfcbd('0x7e')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x7f'),require(_0xfcbd('0x80')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x81'),require(_0xfcbd('0x82')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x83'),require('./api/analyticFieldReport'));_0x40b632['use']('/api/analytics/tree_reports',require(_0xfcbd('0x84')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x85'),require(_0xfcbd('0x86')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x87'),require('./api/intSalesforceConfiguration'));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x88'),require(_0xfcbd('0x89')));_0x40b632['use']('/api/integrations/sugarcrm/accounts',require(_0xfcbd('0x8a')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x8b'),require(_0xfcbd('0x8c')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x8d'),require(_0xfcbd('0x8e')));_0x40b632[_0xfcbd('0x6')]('/api/integrations/desk/accounts',require(_0xfcbd('0x8f')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x90'),require(_0xfcbd('0x91')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x92'),require('./api/intDeskField'));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x93'),require(_0xfcbd('0x94')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x95'),require(_0xfcbd('0x96')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x97'),require('./api/intZohoField'));_0x40b632['use']('/api/integrations/zendesk/accounts',require(_0xfcbd('0x98')));_0x40b632[_0xfcbd('0x6')]('/api/integrations/zendesk/configurations',require('./api/intZendeskConfiguration'));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x99'),require(_0xfcbd('0x9a')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x9b'),require(_0xfcbd('0x9c')));_0x40b632[_0xfcbd('0x6')]('/api/integrations/freshdesk/configurations',require(_0xfcbd('0x9d')));_0x40b632['use']('/api/integrations/freshdesk/fields',require(_0xfcbd('0x9e')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x9f'),require(_0xfcbd('0xa0')));_0x40b632['use']('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xa1'),require(_0xfcbd('0xa2')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xa3'),require(_0xfcbd('0xa4')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xa5'),require(_0xfcbd('0xa6')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xa7'),require('./api/intServicenowField'));_0x40b632['use']('/api/integrations/dynamics365/accounts',require(_0xfcbd('0xa8')));_0x40b632[_0xfcbd('0x6')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xa9'),require('./api/intDynamics365Field'));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xaa'),require(_0xfcbd('0xab')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xac'),require(_0xfcbd('0xad')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xae'),require('./api/intFreshsalesField'));_0x40b632[_0xfcbd('0x6')]('/api/networks',require(_0xfcbd('0xaf')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xb0'),require('./api/chatQueueReport'));_0x40b632['use'](_0xfcbd('0xb1'),require(_0xfcbd('0xb2')));_0x40b632['use']('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x40b632['use']('/api/jscripty/questions/reports',require(_0xfcbd('0xb3')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xb4'),require(_0xfcbd('0xb5')));_0x40b632['use'](_0xfcbd('0xb6'),require(_0xfcbd('0xb7')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xb8'),require('./api/squareReport'));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xb9'),require('./api/squareReportDetail'));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xba'),require(_0xfcbd('0xbb')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xbc'),require(_0xfcbd('0xbd')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xbe'),require(_0xfcbd('0xbf')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xc0'),require(_0xfcbd('0xc1')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xc2'),require(_0xfcbd('0xc3')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xc4'),require(_0xfcbd('0xc5')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xc6'),require(_0xfcbd('0xc7')));_0x40b632['use'](_0xfcbd('0xc8'),require(_0xfcbd('0xc9')));_0x40b632[_0xfcbd('0x6')]('/api/campaigns',require('./api/campaign'));_0x40b632[_0xfcbd('0x6')]('/api/migrations',require(_0xfcbd('0xca')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xcb'),require(_0xfcbd('0xcc')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xcd'),require(_0xfcbd('0xce')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xcf'),require(_0xfcbd('0xd0')));_0x40b632['use'](_0xfcbd('0xd1'),require('./api/chatTransferReport'));_0x40b632['use'](_0xfcbd('0xd2'),require(_0xfcbd('0xd3')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xd4'),require(_0xfcbd('0xd5')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xd6'),require('./api/smsTransferReport'));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xd7'),require(_0xfcbd('0xd8')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xd9'),require(_0xfcbd('0xda')));_0x40b632[_0xfcbd('0x6')]('/api/userProfiles',require(_0xfcbd('0xdb')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xdc'),require(_0xfcbd('0xdd')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xde'),require(_0xfcbd('0xdf')));_0x40b632[_0xfcbd('0x6')]('/api/userNotifications',require(_0xfcbd('0xe0')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xe1'),require(_0xfcbd('0xe2')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xe3'),require('./api/whatsappApplication'));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xe4'),require(_0xfcbd('0xe5')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xe6'),require(_0xfcbd('0xe7')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xe8'),require(_0xfcbd('0xe9')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xea'),require(_0xfcbd('0xeb')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xec'),require(_0xfcbd('0xed')));_0x40b632[_0xfcbd('0x6')]('/api/cloudProviders',require(_0xfcbd('0xee')));_0x40b632['use']('/api/realtime',require('./api/realtime'));_0x40b632[_0xfcbd('0x6')]('/api/user-settings',require(_0xfcbd('0xef')));_0x40b632[_0xfcbd('0x6')]('/api/auth/local',require('./api/authLocal'));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xf0'),require(_0xfcbd('0xf1')));_0x40b632[_0xfcbd('0x6')]('/api/auth/activedirectory',require(_0xfcbd('0xf2')));_0x40b632[_0xfcbd('0x6')]('/api/jira',require(_0xfcbd('0xf3')));_0x40b632[_0xfcbd('0x6')]('/api/rpc',require(_0xfcbd('0xf4')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xf5'),require(_0xfcbd('0xf6')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xf7'),require(_0xfcbd('0xf8')));_0x40b632['use'](_0xfcbd('0xf9'),require('./api/pm2'));_0x40b632['use'](_0xfcbd('0xfa'),require(_0xfcbd('0xfb')));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xfc'),clientSideLogs);_0x40b632[_0xfcbd('0x6')](_0xfcbd('0xfd'),express[_0xfcbd('0xfe')](path[_0xfcbd('0xff')](config[_0xfcbd('0x100')],_0xfcbd('0xfd'))));_0x40b632[_0xfcbd('0x6')](_0xfcbd('0x101'),express[_0xfcbd('0xfe')](path[_0xfcbd('0xff')](config['root'],_0xfcbd('0x101'))));_0x40b632['use']('/demo',express['static'](path[_0xfcbd('0xff')](config[_0xfcbd('0x100')],_0xfcbd('0x102'))));_0x40b632['use']('/snippet',express['static'](path['join'](config['root'],_0xfcbd('0x103'),_0xfcbd('0x104'))));_0x40b632['use']('/plugins',express[_0xfcbd('0xfe')](path[_0xfcbd('0xff')](config[_0xfcbd('0x100')],_0xfcbd('0x105'))));_0x40b632[_0xfcbd('0x106')]('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x40b632[_0xfcbd('0x106')]('/*')[_0xfcbd('0x107')](function(_0x5bcab0,_0xc6e640){_0xc6e640[_0xfcbd('0x108')](path[_0xfcbd('0x109')](_0x40b632[_0xfcbd('0x107')]('appPath')+'/index.html'));});return _0x40b632;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 7c5a682..fb041a4 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb835=['../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.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/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','port','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','lodash','../config/environment','listen','merge'];(function(_0x54a2e4,_0x1ff92c){var _0x4742d0=function(_0x147a6f){while(--_0x147a6f){_0x54a2e4['push'](_0x54a2e4['shift']());}};_0x4742d0(++_0x1ff92c);}(_0xb835,0xcd));var _0x5b83=function(_0x1930a8,_0x723de2){_0x1930a8=_0x1930a8-0x0;var _0xc139f0=_0xb835[_0x1930a8];return _0xc139f0;};'use strict';var jayson=require(_0x5b83('0x0'));var _=require(_0x5b83('0x1'));var config=require(_0x5b83('0x2'));exports[_0x5b83('0x3')]=function(){return new Promise(function(_0x2b425c,_0x30c429){var _0x94077b={};_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x5')));_0x94077b=_['merge'](_0x94077b,require('../api/voiceExtension/voiceExtension.rpc'));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x6')));_0x94077b=_['merge'](_0x94077b,require(_0x5b83('0x7')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x94077b=_['merge'](_0x94077b,require(_0x5b83('0x8')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x9')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0xa')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require('../api/memberReport/memberReport.rpc'));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require('../api/trunk/trunk.rpc'));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0xb')));_0x94077b=_['merge'](_0x94077b,require(_0x5b83('0xc')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0xd')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0xe')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require('../api/mailQueue/mailQueue.rpc'));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0xf')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x10')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x11')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x12')));_0x94077b=_['merge'](_0x94077b,require(_0x5b83('0x13')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x14')));_0x94077b=_['merge'](_0x94077b,require('../api/faxInteraction/faxInteraction.rpc'));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x15')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require('../api/faxQueue/faxQueue.rpc'));_0x94077b=_['merge'](_0x94077b,require(_0x5b83('0x16')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x17')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x18')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x19')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x1a')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x1b')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x1c')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x1d')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require('../api/chatInteraction/chatInteraction.rpc'));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x1e')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require('../api/chatQueue/chatQueue.rpc'));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x1f')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require('../api/cmHopper/cmHopper.rpc'));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x20')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x21')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x22')));_0x94077b=_['merge'](_0x94077b,require(_0x5b83('0x23')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x24')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require('../api/pause/pause.rpc'));_0x94077b=_['merge'](_0x94077b,require('../api/sound/sound.rpc'));_0x94077b=_['merge'](_0x94077b,require(_0x5b83('0x25')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require('../api/template/template.rpc'));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x26')));_0x94077b=_['merge'](_0x94077b,require(_0x5b83('0x27')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x28')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x29')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x2a')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x2b')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x2c')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x2d')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x2e')));_0x94077b=_['merge'](_0x94077b,require(_0x5b83('0x2f')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x30')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x94077b=_['merge'](_0x94077b,require(_0x5b83('0x31')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require('../api/squareReport/squareReport.rpc'));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x94077b=_['merge'](_0x94077b,require(_0x5b83('0x32')));_0x94077b=_['merge'](_0x94077b,require(_0x5b83('0x33')));_0x94077b=_['merge'](_0x94077b,require(_0x5b83('0x34')));_0x94077b=_['merge'](_0x94077b,require(_0x5b83('0x35')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x36')));_0x94077b=_['merge'](_0x94077b,require(_0x5b83('0x37')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require('../api/attachment/attachment.rpc'));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x38')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x39')));_0x94077b=_['merge'](_0x94077b,require(_0x5b83('0x3a')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x3b')));_0x94077b=_[_0x5b83('0x4')](_0x94077b,require(_0x5b83('0x3c')));var _0x55707a=jayson['server'](_0x94077b)[_0x5b83('0x3d')]();var _0x583d49=config['rpc'][_0x5b83('0x3e')]||config['port']+0x1;var _0x507dac=config[_0x5b83('0x3f')]['ip']||_0x5b83('0x40');_0x55707a['on'](_0x5b83('0x41'),function(_0x3e4c6a){return _0x30c429(_0x3e4c6a);});_0x55707a[_0x5b83('0x3')](_0x583d49,_0x507dac,function(){console[_0x5b83('0x42')](_0x5b83('0x43'),_0x507dac,_0x583d49);require(_0x5b83('0x44'))[_0x5b83('0x45')]();return _0x2b425c('RPC\x20listening\x20on\x20'+_0x507dac+':'+_0x583d49);});});}; \ No newline at end of file +var _0x861a=['../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.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/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x861a,0xcd));var _0xa861=function(_0xef6d46,_0xf0c465){_0xef6d46=_0xef6d46-0x0;var _0x139d17=_0x861a[_0xef6d46];return _0x139d17;};'use strict';var jayson=require('jayson/promise');var _=require('lodash');var config=require(_0xa861('0x0'));exports[_0xa861('0x1')]=function(){return new Promise(function(_0x3e8ec3,_0x5a4acd){var _0x74dd77={};_0x74dd77=_['merge'](_0x74dd77,require(_0xa861('0x2')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x4')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require('../api/voiceQueue/voiceQueue.rpc'));_0x74dd77=_['merge'](_0x74dd77,require(_0xa861('0x5')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x6')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x7')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x8')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require('../api/memberReport/memberReport.rpc'));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x9')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x74dd77=_['merge'](_0x74dd77,require(_0xa861('0xa')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0xb')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0xc')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0xd')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require('../api/mailMessage/mailMessage.rpc'));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0xe')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0xf')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require('../api/faxAccount/faxAccount.rpc'));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x10')));_0x74dd77=_['merge'](_0x74dd77,require(_0xa861('0x11')));_0x74dd77=_['merge'](_0x74dd77,require(_0xa861('0x12')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x13')));_0x74dd77=_['merge'](_0x74dd77,require(_0xa861('0x14')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x15')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x16')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x17')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x18')));_0x74dd77=_['merge'](_0x74dd77,require(_0xa861('0x19')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x1a')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x1b')));_0x74dd77=_['merge'](_0x74dd77,require(_0xa861('0x1c')));_0x74dd77=_['merge'](_0x74dd77,require(_0xa861('0x1d')));_0x74dd77=_['merge'](_0x74dd77,require('../api/chatInteraction/chatInteraction.rpc'));_0x74dd77=_['merge'](_0x74dd77,require(_0xa861('0x1e')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x1f')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require('../api/cmContact/cmContact.rpc'));_0x74dd77=_['merge'](_0x74dd77,require(_0xa861('0x20')));_0x74dd77=_['merge'](_0x74dd77,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x74dd77=_['merge'](_0x74dd77,require(_0xa861('0x21')));_0x74dd77=_['merge'](_0x74dd77,require(_0xa861('0x22')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x23')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require('../api/interval/interval.rpc'));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x24')));_0x74dd77=_['merge'](_0x74dd77,require(_0xa861('0x25')));_0x74dd77=_['merge'](_0x74dd77,require(_0xa861('0x26')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x27')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x28')));_0x74dd77=_['merge'](_0x74dd77,require('../api/variable/variable.rpc'));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x29')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x2a')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x2b')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x2c')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x2d')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x2e')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x2f')));_0x74dd77=_['merge'](_0x74dd77,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x74dd77=_['merge'](_0x74dd77,require(_0xa861('0x30')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x31')));_0x74dd77=_['merge'](_0x74dd77,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x74dd77=_['merge'](_0x74dd77,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x32')));_0x74dd77=_['merge'](_0x74dd77,require(_0xa861('0x33')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x34')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x35')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x36')));_0x74dd77=_['merge'](_0x74dd77,require(_0xa861('0x37')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x38')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x39')));_0x74dd77=_['merge'](_0x74dd77,require('../api/attachment/attachment.rpc'));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require(_0xa861('0x3a')));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x74dd77=_['merge'](_0x74dd77,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x74dd77=_[_0xa861('0x3')](_0x74dd77,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x74dd77=_['merge'](_0x74dd77,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x74dd77=_['merge'](_0x74dd77,require(_0xa861('0x3b')));var _0x248458=jayson[_0xa861('0x3c')](_0x74dd77)[_0xa861('0x3d')]();var _0x329daf=config[_0xa861('0x3e')][_0xa861('0x3f')]||config['port']+0x1;var _0x30836e=config[_0xa861('0x3e')]['ip']||_0xa861('0x40');_0x248458['on']('error',function(_0xd2a522){return _0x5a4acd(_0xd2a522);});_0x248458['listen'](_0x329daf,_0x30836e,function(){console[_0xa861('0x41')](_0xa861('0x42'),_0x30836e,_0x329daf);require(_0xa861('0x43'))[_0xa861('0x44')]();return _0x3e8ec3(_0xa861('0x45')+_0x30836e+':'+_0x329daf);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 7ef54ba..1982225 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 _0x6788=['SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','getVariable','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','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','events','EventEmitter','./reply','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','inherits','prototype','command','sync','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','sendRequest','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext'];(function(_0x18d5d7,_0x19074b){var _0x30a9ea=function(_0x514f3f){while(--_0x514f3f){_0x18d5d7['push'](_0x18d5d7['shift']());}};_0x30a9ea(++_0x19074b);}(_0x6788,0xfa));var _0x8678=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x6788[_0x2c91e9];return _0x13f0ff;};'use strict';var util=require(_0x8678('0x0'));var _=require(_0x8678('0x1'));var EventEmitter=require(_0x8678('0x2'))[_0x8678('0x3')];var AGIReply=require(_0x8678('0x4'));var AGIError=require('./error');function AGIChannel(_0x4e0b1a){var _0x562a03=this,_0x841b57=new AGIReply(),_0x1f41d7=![],_0x201297={};EventEmitter[_0x8678('0x5')](_0x562a03);_0x4e0b1a[_0x8678('0x6')](_0x8678('0x7'));_0x4e0b1a[_0x8678('0x8')](0x8*0x3c*0x3c*0x3e8);_0x841b57[_0x8678('0x6')](_0x8678('0x7'));_0x841b57['on'](_0x8678('0x9'),function(_0x2d180b){for(var _0x4f1f0b in _0x2d180b){_0x562a03[_0x4f1f0b]=_0x2d180b[_0x4f1f0b];}_0x562a03[_0x8678('0xa')](_0x8678('0xb'));});_0x841b57['on'](_0x8678('0xc'),function(_0x4623d4){if(_0x4623d4[_0x8678('0xd')]()==_0x8678('0xe')){_0x562a03[_0x8678('0xa')](_0x8678('0xe'));return;}if(_0x4623d4[_0x8678('0xf')](0x0,0xb)==_0x8678('0x10')){_0x1f41d7=!![];}if(_0x1f41d7){_0x201297['rx']+=_0x4623d4+'\x0a';if(_0x4623d4[_0x8678('0x11')](_0x8678('0x12'))!=-0x1){_0x1f41d7=![];}}else{_0x201297['rx']=_0x4623d4;}if(_0x1f41d7){return;}if(typeof _0x201297['cb']==_0x8678('0x13')){var _0x4ee96c=_0x201297['rx']['substring'](0x0,0x3),_0x1ae329=null,_0x4020f3=null;_0x4ee96c=parseInt(_0x4ee96c);if(isNaN(_0x4ee96c)){_0x201297['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x8678('0x14')});return;}if(_0x4ee96c!=0xc8){_0x201297['cb'](null,{'code':_0x4ee96c,'result':-0x1,'extra':'KO'});return;}_0x1ae329=_0x201297['rx'][_0x8678('0xf')](0x4)[_0x8678('0x15')](_0x8678('0x16'),'');if(_0x1ae329[_0x8678('0x17')]('\x20')!=-0x1){_0x1ae329=_0x1ae329['substr'](0x0,_0x1ae329[_0x8678('0x17')]('\x20'));}if(_[_0x8678('0x18')](_0x1ae329,'-1')){_0x1ae329=parseInt(_0x1ae329);}_0x4020f3=_0x201297['rx'][_0x8678('0x19')]('\x20');if(_0x4020f3[_0x8678('0x1a')]==0x3){_0x4020f3=_0x4020f3[0x2][_0x8678('0xf')](0x1,_0x4020f3[0x2][_0x8678('0x1a')]-0x1);}else if(_0x4020f3['length']>0x3){var _0x5cd3d8=/\((.+)\)/;var _0x55be2b=_0x201297['rx'][_0x8678('0x1b')](_0x5cd3d8);if(_0x55be2b){_0x4020f3=_0x55be2b[0x1];}else{_0x4020f3=null;}}else{_0x4020f3=null;}_0x201297['cb'](null,{'code':_0x4ee96c,'result':_0x1ae329,'extra':_0x4020f3});}});_0x4e0b1a['on'](_0x8678('0x1c'),function(_0x516d46){_0x562a03[_0x8678('0xa')]('error',new AGIError(_0x8678('0x1d'),_0x516d46[_0x8678('0x1e')]));});_0x4e0b1a['on'](_0x8678('0x1f'),function(){_0x562a03['emit'](_0x8678('0x1f'),new AGIError(_0x8678('0x20')));});_0x4e0b1a['on']('timeout',function(){_0x562a03['emit'](_0x8678('0x21'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x4e0b1a[_0x8678('0x22')]();});_0x4e0b1a['pipe'](_0x841b57);this['command']=function(_0x43aed7,_0x1d66e4){var _0x43aed7=_0x43aed7||'',_0x1d66e4=typeof _0x1d66e4==_0x8678('0x13')?_0x1d66e4:new Function();_0x201297={'tx':_0x43aed7,'rx':'','cb':_0x1d66e4};_0x4e0b1a['write'](_0x43aed7+'\x0a');},this[_0x8678('0x1f')]=function(){_0x4e0b1a['destroy']();};}util[_0x8678('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x8678('0x24')]['sendRequest']=function(_0xe38edb){return this[_0x8678('0x25')][_0x8678('0x26')](this,_0xe38edb);};AGIChannel['prototype'][_0x8678('0x27')]=function(){return this['sendRequest'](_0x8678('0x28'));};AGIChannel[_0x8678('0x24')][_0x8678('0x29')]=function(_0x1a6d31,_0x39ac03,_0x1d94cd){_0x1a6d31=_0x1a6d31===undefined?_0x8678('0x2a'):_0x1a6d31;_0x39ac03=_0x39ac03===undefined?'5':_0x39ac03;_0x1d94cd=_0x1d94cd===undefined?'1':_0x1d94cd;return this['sendRequest'](util[_0x8678('0x2b')](_0x8678('0x2c'),_0x1a6d31,_0x39ac03*0x3e8,_0x1d94cd));};AGIChannel[_0x8678('0x24')][_0x8678('0x2d')]=function(_0x1fdf07){_0x1fdf07=_0x1fdf07||_0x8678('0x2e');return this[_0x8678('0x2f')](util[_0x8678('0x2b')](_0x8678('0x30'),_0x1fdf07));};AGIChannel[_0x8678('0x24')][_0x8678('0x31')]=function(_0x2b6d13,_0x2b3de6){if(_[_0x8678('0x32')](_0x2b3de6)){return this[_0x8678('0x2f')](util[_0x8678('0x2b')](_0x8678('0x33'),_0x2b6d13,_0x2b3de6[_0x8678('0x34')](',')));}return this['sendRequest'](util['format'](_0x8678('0x33'),_0x2b6d13,_0x2b3de6));};AGIChannel['prototype'][_0x8678('0x35')]=function(_0x180cc5){return this[_0x8678('0x2f')](util[_0x8678('0x2b')](_0x8678('0x36'),_0x180cc5));};AGIChannel[_0x8678('0x24')][_0x8678('0x37')]=function(_0x5f0fcb){return this[_0x8678('0x2f')](util[_0x8678('0x2b')](_0x8678('0x38'),_0x5f0fcb));};AGIChannel['prototype']['setPriority']=function(_0x1108d9){return this[_0x8678('0x2f')](util[_0x8678('0x2b')]('SET\x20PRIORITY\x20%s',_0x1108d9));};AGIChannel[_0x8678('0x24')][_0x8678('0xe')]=function(){return this['sendRequest'](_0x8678('0x39'));};AGIChannel[_0x8678('0x24')]['setVariable']=function(_0x3b7ee6,_0x392f5f){var _0x4586ab=_[_0x8678('0x3a')](_0x392f5f)||_[_0x8678('0x3b')](_0x392f5f)?_0x392f5f[_0x8678('0x3c')]():_0x392f5f;return this[_0x8678('0x2f')](util[_0x8678('0x2b')](_0x8678('0x3d'),_0x3b7ee6,_0x4586ab?_0x4586ab[_0x8678('0x3c')]()[_0x8678('0x15')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x8678('0x24')]['sayNumber']=function(_0x1a8cb1,_0x370db9){return this['sendRequest'](util[_0x8678('0x2b')](_0x8678('0x3e'),_0x1a8cb1,_0x370db9));};AGIChannel[_0x8678('0x24')][_0x8678('0x3f')]=function(_0x359e79,_0x293922){return this[_0x8678('0x2f')](util[_0x8678('0x2b')]('SAY\x20DIGITS\x20%s\x20%s',_0x359e79,_0x293922));};AGIChannel[_0x8678('0x24')]['sayPhonetic']=function(_0x1686c6,_0x54f092){return this['sendRequest'](util[_0x8678('0x2b')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x1686c6,_0x54f092));};AGIChannel[_0x8678('0x24')]['continueAt']=function(_0x5a293c,_0xac44fd,_0x36d1f9){_0xac44fd=_0xac44fd||this['extension'];_0x36d1f9=_0x36d1f9||0x1;this[_0x8678('0x35')](_0x5a293c);this[_0x8678('0x37')](_0xac44fd);this['setPriority'](_0x36d1f9);return this[_0x8678('0x2d')](util[_0x8678('0x2b')]('GOTO\x20%s\x20%s\x20%s',_0x5a293c,_0xac44fd,_0x36d1f9));};AGIChannel[_0x8678('0x24')][_0x8678('0x40')]=function(_0x4caee8){return this[_0x8678('0x2f')](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x4caee8));};AGIChannel[_0x8678('0x24')][_0x8678('0x41')]=function(_0x8010fb,_0x23b5e1,_0x19d64c,_0x37d7fa,_0x3244f8,_0x2155db){_0x23b5e1=_0x23b5e1||_0x8678('0x42');_0x19d64c=_0x19d64c||'';_0x37d7fa=_0x37d7fa===undefined?-0x1:_0x37d7fa==='-1'?-0x1:_0x37d7fa*0x3e8;_0x3244f8=_0x3244f8===undefined?'':'s='+_0x3244f8;_0x2155db=_0x2155db?_0x8678('0x43'):'';return this[_0x8678('0x2f')](util[_0x8678('0x2b')](_0x8678('0x44'),_0x8010fb,_0x23b5e1,_0x19d64c,_0x37d7fa,_0x2155db,_0x3244f8));};AGIChannel[_0x8678('0x24')][_0x8678('0x45')]=function(_0x2d3b4b,_0x59c8e9){_0x59c8e9=_0x59c8e9||'';return this[_0x8678('0x2f')](util['format'](_0x8678('0x46'),_0x2d3b4b,_0x59c8e9));};AGIChannel['prototype']['agi']=function(_0x2c3c36){return this['exec'](_0x8678('0x47'),_0x2c3c36);};AGIChannel[_0x8678('0x24')][_0x8678('0x48')]=function(_0x58515c){return this['exec'](_0x8678('0x49'),_0x58515c);};AGIChannel['prototype'][_0x8678('0x1c')]=function(_0xae4cb1,_0x31a541){this[_0x8678('0x2d')](util[_0x8678('0x2b')](_0x8678('0x4a'),_0xae4cb1['id'],_0xae4cb1['label'],_0x31a541));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x8678('0x4b')]=AGIChannel; \ No newline at end of file +var _0xa21e=['520-Invalid','search','520\x20End\x20of\x20proper','function','substring','replace','result=','indexOf','substr','startsWith','length','error','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','command','write','prototype','sendRequest','sync','ANSWER','beep','format','noop','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','hangup','HANGUP','setVariable','isBoolean','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','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','label','exports','util','lodash','events','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0xa21e,0x166));var _0xea21=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xa21e[_0x2e4e19];return _0x9ba20b;};'use strict';var util=require(_0xea21('0x0'));var _=require(_0xea21('0x1'));var EventEmitter=require(_0xea21('0x2'))['EventEmitter'];var AGIReply=require(_0xea21('0x3'));var AGIError=require(_0xea21('0x4'));function AGIChannel(_0x172d00){var _0x4d5b9f=this,_0x58ef5e=new AGIReply(),_0x15a69e=![],_0x4729ab={};EventEmitter[_0xea21('0x5')](_0x4d5b9f);_0x172d00[_0xea21('0x6')](_0xea21('0x7'));_0x172d00[_0xea21('0x8')](0x8*0x3c*0x3c*0x3e8);_0x58ef5e[_0xea21('0x6')](_0xea21('0x7'));_0x58ef5e['on'](_0xea21('0x9'),function(_0x1b06bc){for(var _0x2c37fb in _0x1b06bc){_0x4d5b9f[_0x2c37fb]=_0x1b06bc[_0x2c37fb];}_0x4d5b9f[_0xea21('0xa')](_0xea21('0xb'));});_0x58ef5e['on']('line',function(_0x2200e8){if(_0x2200e8['toLowerCase']()=='hangup'){_0x4d5b9f[_0xea21('0xa')]('hangup');return;}if(_0x2200e8['substring'](0x0,0xb)==_0xea21('0xc')){_0x15a69e=!![];}if(_0x15a69e){_0x4729ab['rx']+=_0x2200e8+'\x0a';if(_0x2200e8[_0xea21('0xd')](_0xea21('0xe'))!=-0x1){_0x15a69e=![];}}else{_0x4729ab['rx']=_0x2200e8;}if(_0x15a69e){return;}if(typeof _0x4729ab['cb']==_0xea21('0xf')){var _0x3e31fe=_0x4729ab['rx'][_0xea21('0x10')](0x0,0x3),_0x4c1eff=null,_0x2fd677=null;_0x3e31fe=parseInt(_0x3e31fe);if(isNaN(_0x3e31fe)){_0x4729ab['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x3e31fe!=0xc8){_0x4729ab['cb'](null,{'code':_0x3e31fe,'result':-0x1,'extra':'KO'});return;}_0x4c1eff=_0x4729ab['rx'][_0xea21('0x10')](0x4)[_0xea21('0x11')](_0xea21('0x12'),'');if(_0x4c1eff[_0xea21('0x13')]('\x20')!=-0x1){_0x4c1eff=_0x4c1eff[_0xea21('0x14')](0x0,_0x4c1eff[_0xea21('0x13')]('\x20'));}if(_[_0xea21('0x15')](_0x4c1eff,'-1')){_0x4c1eff=parseInt(_0x4c1eff);}_0x2fd677=_0x4729ab['rx']['split']('\x20');if(_0x2fd677[_0xea21('0x16')]==0x3){_0x2fd677=_0x2fd677[0x2]['substring'](0x1,_0x2fd677[0x2]['length']-0x1);}else if(_0x2fd677[_0xea21('0x16')]>0x3){var _0x3c4daf=/\((.+)\)/;var _0x388f40=_0x4729ab['rx']['match'](_0x3c4daf);if(_0x388f40){_0x2fd677=_0x388f40[0x1];}else{_0x2fd677=null;}}else{_0x2fd677=null;}_0x4729ab['cb'](null,{'code':_0x3e31fe,'result':_0x4c1eff,'extra':_0x2fd677});}});_0x172d00['on'](_0xea21('0x17'),function(_0x1e03ac){_0x4d5b9f[_0xea21('0xa')](_0xea21('0x17'),new AGIError('E_AGI_SOCKET_ERROR',_0x1e03ac[_0xea21('0x18')]));});_0x172d00['on'](_0xea21('0x19'),function(){_0x4d5b9f['emit'](_0xea21('0x19'),new AGIError(_0xea21('0x1a')));});_0x172d00['on']('timeout',function(){_0x4d5b9f[_0xea21('0xa')](_0xea21('0x1b'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x172d00[_0xea21('0x1c')]();});_0x172d00['pipe'](_0x58ef5e);this[_0xea21('0x1d')]=function(_0x43dd20,_0x360754){var _0x43dd20=_0x43dd20||'',_0x360754=typeof _0x360754==_0xea21('0xf')?_0x360754:new Function();_0x4729ab={'tx':_0x43dd20,'rx':'','cb':_0x360754};_0x172d00[_0xea21('0x1e')](_0x43dd20+'\x0a');},this[_0xea21('0x19')]=function(){_0x172d00[_0xea21('0x1c')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xea21('0x1f')][_0xea21('0x20')]=function(_0x320154){return this[_0xea21('0x1d')][_0xea21('0x21')](this,_0x320154);};AGIChannel[_0xea21('0x1f')]['answer']=function(){return this[_0xea21('0x20')](_0xea21('0x22'));};AGIChannel['prototype']['getData']=function(_0x5d407c,_0x4a6f76,_0x58e575){_0x5d407c=_0x5d407c===undefined?_0xea21('0x23'):_0x5d407c;_0x4a6f76=_0x4a6f76===undefined?'5':_0x4a6f76;_0x58e575=_0x58e575===undefined?'1':_0x58e575;return this['sendRequest'](util[_0xea21('0x24')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x5d407c,_0x4a6f76*0x3e8,_0x58e575));};AGIChannel[_0xea21('0x1f')][_0xea21('0x25')]=function(_0x4465c4){_0x4465c4=_0x4465c4||_0xea21('0x26');return this['sendRequest'](util['format']('VERBOSE\x20\x22%s\x22',_0x4465c4));};AGIChannel[_0xea21('0x1f')][_0xea21('0x27')]=function(_0x85164b,_0x5c62a3){if(_[_0xea21('0x28')](_0x5c62a3)){return this[_0xea21('0x20')](util['format'](_0xea21('0x29'),_0x85164b,_0x5c62a3['join'](',')));}return this[_0xea21('0x20')](util[_0xea21('0x24')](_0xea21('0x29'),_0x85164b,_0x5c62a3));};AGIChannel['prototype'][_0xea21('0x2a')]=function(_0x100e9e){return this[_0xea21('0x20')](util['format'](_0xea21('0x2b'),_0x100e9e));};AGIChannel['prototype'][_0xea21('0x2c')]=function(_0x5c17d1){return this['sendRequest'](util['format'](_0xea21('0x2d'),_0x5c17d1));};AGIChannel[_0xea21('0x1f')][_0xea21('0x2e')]=function(_0x3d678d){return this['sendRequest'](util[_0xea21('0x24')](_0xea21('0x2f'),_0x3d678d));};AGIChannel[_0xea21('0x1f')][_0xea21('0x30')]=function(){return this[_0xea21('0x20')](_0xea21('0x31'));};AGIChannel[_0xea21('0x1f')][_0xea21('0x32')]=function(_0x13aab5,_0x5b3e0d){var _0xbb3bb1=_[_0xea21('0x33')](_0x5b3e0d)||_['isNumber'](_0x5b3e0d)?_0x5b3e0d['toString']():_0x5b3e0d;return this[_0xea21('0x20')](util['format'](_0xea21('0x34'),_0x13aab5,_0xbb3bb1?_0xbb3bb1['toString']()[_0xea21('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xea21('0x1f')][_0xea21('0x35')]=function(_0x377c81,_0x238174){return this[_0xea21('0x20')](util[_0xea21('0x24')](_0xea21('0x36'),_0x377c81,_0x238174));};AGIChannel[_0xea21('0x1f')][_0xea21('0x37')]=function(_0x262938,_0x10e512){return this[_0xea21('0x20')](util[_0xea21('0x24')](_0xea21('0x38'),_0x262938,_0x10e512));};AGIChannel[_0xea21('0x1f')][_0xea21('0x39')]=function(_0x115818,_0x3c330a){return this['sendRequest'](util[_0xea21('0x24')](_0xea21('0x3a'),_0x115818,_0x3c330a));};AGIChannel[_0xea21('0x1f')][_0xea21('0x3b')]=function(_0x4e4674,_0x555e39,_0x11b50c){_0x555e39=_0x555e39||this[_0xea21('0x3c')];_0x11b50c=_0x11b50c||0x1;this[_0xea21('0x2a')](_0x4e4674);this['setExtension'](_0x555e39);this['setPriority'](_0x11b50c);return this[_0xea21('0x25')](util[_0xea21('0x24')](_0xea21('0x3d'),_0x4e4674,_0x555e39,_0x11b50c));};AGIChannel[_0xea21('0x1f')][_0xea21('0x3e')]=function(_0x165243){return this[_0xea21('0x20')](util[_0xea21('0x24')](_0xea21('0x3f'),_0x165243));};AGIChannel[_0xea21('0x1f')][_0xea21('0x40')]=function(_0x11ff94,_0xaebfa5,_0xbccc2a,_0x3ea96c,_0x23d7a5,_0x3b4611){_0xaebfa5=_0xaebfa5||_0xea21('0x41');_0xbccc2a=_0xbccc2a||'';_0x3ea96c=_0x3ea96c===undefined?-0x1:_0x3ea96c==='-1'?-0x1:_0x3ea96c*0x3e8;_0x23d7a5=_0x23d7a5===undefined?'':'s='+_0x23d7a5;_0x3b4611=_0x3b4611?_0xea21('0x42'):'';return this[_0xea21('0x20')](util['format'](_0xea21('0x43'),_0x11ff94,_0xaebfa5,_0xbccc2a,_0x3ea96c,_0x3b4611,_0x23d7a5));};AGIChannel[_0xea21('0x1f')][_0xea21('0x44')]=function(_0x31565f,_0x157dd4){_0x157dd4=_0x157dd4||'';return this['sendRequest'](util[_0xea21('0x24')](_0xea21('0x45'),_0x31565f,_0x157dd4));};AGIChannel[_0xea21('0x1f')][_0xea21('0x46')]=function(_0x4050d3){return this[_0xea21('0x27')]('AGI',_0x4050d3);};AGIChannel['prototype'][_0xea21('0x47')]=function(_0x20c47d){return this[_0xea21('0x27')]('WAIT',_0x20c47d);};AGIChannel[_0xea21('0x1f')][_0xea21('0x17')]=function(_0x4a7a64,_0x1d250d){this[_0xea21('0x25')](util[_0xea21('0x24')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x4a7a64['id'],_0x4a7a64[_0xea21('0x48')],_0x1d250d));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xea21('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 905ca7c..a749175 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 _0x62ec=['apply','message','name','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format'];(function(_0x3a0aef,_0x4815f2){var _0x837448=function(_0x2ccc78){while(--_0x2ccc78){_0x3a0aef['push'](_0x3a0aef['shift']());}};_0x837448(++_0x4815f2);}(_0x62ec,0x83));var _0xc62e=function(_0x2cf6b5,_0x1d75ea){_0x2cf6b5=_0x2cf6b5-0x0;var _0x4631c4=_0x62ec[_0x2cf6b5];return _0x4631c4;};'use strict';var util=require(_0xc62e('0x0'));var error={'E_AGI_UNDEFINED':_0xc62e('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xc62e('0x2'),'E_AGI_SERVER_CLOSE':_0xc62e('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xc62e('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xc62e('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xc62e('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xc62e('0x7'),'E_AGI_COMMAND_EMPTY':_0xc62e('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xc62e('0x9'),'E_AGI_IVR_ENTRY':_0xc62e('0xa')};function AGIError(_0x2c0c6b){var _0x2c0c6b=_0x2c0c6b||null,_0x24f3ee=_0x24f3ee||[],_0x40f4b1=0x1,_0x33eb52='';if(!error[_0x2c0c6b]){_0x2c0c6b='E_AGI_UNDEFINED';}_0x24f3ee[_0xc62e('0xb')](error[_0x2c0c6b]);while(arguments[_0x40f4b1]){_0x24f3ee[_0xc62e('0xb')](arguments[_0x40f4b1]);_0x40f4b1++;}_0x33eb52=util[_0xc62e('0xc')][_0xc62e('0xd')](util,_0x24f3ee);this[_0xc62e('0xe')]=_0x33eb52;this[_0xc62e('0xf')]=_0x2c0c6b;}module['exports']=AGIError; \ No newline at end of file +var _0x0b37=['format','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push'];(function(_0x417346,_0xe51d24){var _0x2d1c93=function(_0x3d95e2){while(--_0x3d95e2){_0x417346['push'](_0x417346['shift']());}};_0x2d1c93(++_0xe51d24);}(_0x0b37,0xab));var _0x70b3=function(_0x3a504d,_0x399ae8){_0x3a504d=_0x3a504d-0x0;var _0x93f596=_0x0b37[_0x3a504d];return _0x93f596;};'use strict';var util=require(_0x70b3('0x0'));var error={'E_AGI_UNDEFINED':_0x70b3('0x1'),'E_AGI_ARGUMENT_PORT':_0x70b3('0x2'),'E_AGI_SERVER_ERROR':_0x70b3('0x3'),'E_AGI_SERVER_CLOSE':_0x70b3('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x70b3('0x5'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x70b3('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x70b3('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x70b3('0x8'),'E_AGI_IVR_ENTRY':_0x70b3('0x9')};function AGIError(_0x10dbd7){var _0x10dbd7=_0x10dbd7||null,_0x11ba8d=_0x11ba8d||[],_0x425272=0x1,_0x2e2bca='';if(!error[_0x10dbd7]){_0x10dbd7='E_AGI_UNDEFINED';}_0x11ba8d['push'](error[_0x10dbd7]);while(arguments[_0x425272]){_0x11ba8d[_0x70b3('0xa')](arguments[_0x425272]);_0x425272++;}_0x2e2bca=util[_0x70b3('0xb')]['apply'](util,_0x11ba8d);this['message']=_0x2e2bca;this[_0x70b3('0xc')]=_0x10dbd7;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 8f2959a..67fd04b 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x012b=['message','parse','projectUpdate','E_AGI_SERVER_ERROR','lodash','EventEmitter','ioredis','./error','redis','defaults','subscribe','agi','emit','error'];(function(_0x57b432,_0x1589a0){var _0x2edf2a=function(_0x20edfc){while(--_0x20edfc){_0x57b432['push'](_0x57b432['shift']());}};_0x2edf2a(++_0x1589a0);}(_0x012b,0xc8));var _0xb012=function(_0x3fc95d,_0x107220){_0x3fc95d=_0x3fc95d-0x0;var _0x5ca643=_0x012b[_0x3fc95d];return _0x5ca643;};'use strict';var _=require(_0xb012('0x0'));var EventEmitter=require('events')[_0xb012('0x1')];var Redis=require(_0xb012('0x2'));var AGIError=require(_0xb012('0x3'));var config=require('../../config/environment');config[_0xb012('0x4')]=_[_0xb012('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xb012('0x4')]);sub[_0xb012('0x6')](_0xb012('0x7'),function(_0x249ed6){if(_0x249ed6)return eventEmitter[_0xb012('0x8')](_0xb012('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x249ed6));});sub['on'](_0xb012('0xa'),function(_0x511ae7,_0x20cf09){if(_0x511ae7!==_0xb012('0x7'))return;try{var _0x5c3939=JSON[_0xb012('0xb')](_0x20cf09);eventEmitter[_0xb012('0x8')](_0xb012('0xc'),_0x5c3939);}catch(_0x447255){eventEmitter[_0xb012('0x8')](_0xb012('0x9'),new AGIError(_0xb012('0xd'),_0x447255));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x151e=['events','EventEmitter','ioredis','../../config/environment','redis','localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','exports'];(function(_0x165f0a,_0x224f22){var _0xb453ff=function(_0x2154ca){while(--_0x2154ca){_0x165f0a['push'](_0x165f0a['shift']());}};_0xb453ff(++_0x224f22);}(_0x151e,0x75));var _0xe151=function(_0x2134b7,_0x1eb5e2){_0x2134b7=_0x2134b7-0x0;var _0x6c5914=_0x151e[_0x2134b7];return _0x6c5914;};'use strict';var _=require('lodash');var EventEmitter=require(_0xe151('0x0'))[_0xe151('0x1')];var Redis=require(_0xe151('0x2'));var AGIError=require('./error');var config=require(_0xe151('0x3'));config[_0xe151('0x4')]=_['defaults'](config[_0xe151('0x4')],{'host':_0xe151('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xe151('0x4')]);sub[_0xe151('0x6')](_0xe151('0x7'),function(_0x4ff61b){if(_0x4ff61b)return eventEmitter[_0xe151('0x8')](_0xe151('0x9'),new AGIError(_0xe151('0xa'),_0x4ff61b));});sub['on'](_0xe151('0xb'),function(_0x201271,_0x4871b7){if(_0x201271!==_0xe151('0x7'))return;try{var _0x4b534a=JSON['parse'](_0x4871b7);eventEmitter[_0xe151('0x8')]('projectUpdate',_0x4b534a);}catch(_0x336821){eventEmitter[_0xe151('0x8')]('error',new AGIError(_0xe151('0xa'),_0x336821));}});module[_0xe151('0xc')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 9920be2..ec2478c 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 _0x4295=['agicommand','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','exports','lodash','agi','menu','getdigits','vertices','edges','prototype','addVertex','addEdge','numberOfEdges','size','relations','getVertex','traverseBFS','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','target'];(function(_0x43e83b,_0x5a7ad1){var _0x2a6ab5=function(_0x4dd3c7){while(--_0x4dd3c7){_0x43e83b['push'](_0x43e83b['shift']());}};_0x2a6ab5(++_0x5a7ad1);}(_0x4295,0xc3));var _0x5429=function(_0xb6b285,_0x596e01){_0xb6b285=_0xb6b285-0x0;var _0x11393c=_0x4295[_0xb6b285];return _0x11393c;};'use strict';var _=require(_0x5429('0x0'));var logger=require('../../../config/logger')(_0x5429('0x1'));var verticesWithRetry=[_0x5429('0x2'),_0x5429('0x3'),'getsecretdigits'];var Graph=function(){this[_0x5429('0x4')]={};this[_0x5429('0x5')]={};this['numberOfEdges']=0x0;};Graph[_0x5429('0x6')][_0x5429('0x7')]=function(_0x415adf){this['vertices'][_0x415adf['id']]=_0x415adf;this[_0x5429('0x5')][_0x415adf['id']]=[];};Graph['prototype'][_0x5429('0x8')]=function(_0x7315eb,_0x58f37e,_0x2d814d){this[_0x5429('0x5')][_0x7315eb]['push']({'target':_0x58f37e,'condition':_0x2d814d});this[_0x5429('0x9')]+=0x1;};Graph['prototype'][_0x5429('0xa')]=function(){return _['size'](this[_0x5429('0x4')]);};Graph[_0x5429('0x6')][_0x5429('0xb')]=function(){return this[_0x5429('0x9')];};Graph[_0x5429('0x6')][_0x5429('0xc')]=function(_0x597cdc){return this[_0x5429('0x4')][_0x597cdc];};Graph[_0x5429('0x6')][_0x5429('0xd')]=function(_0x5e4239,_0x45a72d){if(!this['vertices'][_0x5e4239]){return logger[_0x5429('0xe')]('no\x20vertex\x20found');}var _0x5abbc6=_0x45a72d(this[_0x5429('0x4')][_0x5e4239]);if(!_0x5abbc6){return logger[_0x5429('0xe')](_0x5429('0xf'));}if(this[_0x5429('0x5')][_0x5e4239][_0x5429('0x10')]===0x0){return logger[_0x5429('0xe')](_0x5429('0x11'));}for(var _0x48f684=0x0,_0x557198=[],_0x4326a5=![];_0x48f684\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','find','production','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','connection','close','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','EventEmitter','127.0.0.1','nextTick','error','stack','findIndex','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','name','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname'];(function(_0x3193fa,_0x3279fa){var _0x4f0b76=function(_0x456ce4){while(--_0x456ce4){_0x3193fa['push'](_0x3193fa['shift']());}};_0x4f0b76(++_0x3279fa);}(_0xfb32,0xd9));var _0x2fb3=function(_0x38eb23,_0x196e8b){_0x38eb23=_0x38eb23-0x0;var _0x48506a=_0xfb32[_0x38eb23];return _0x48506a;};'use strict';var _=require(_0x2fb3('0x0'));var syncho=require(_0x2fb3('0x1'));var util=require(_0x2fb3('0x2'));var config=require(_0x2fb3('0x3'));var logger=require(_0x2fb3('0x4'))(_0x2fb3('0x5'));var utilLicense=require(_0x2fb3('0x6'));var rpc=require(_0x2fb3('0x7'));var Project=require(_0x2fb3('0x8'));var AGIEmitter=require('./events')[_0x2fb3('0x9')];var projects=[];config[_0x2fb3('0x5')]=_['defaults'](config['agi'],{'ip':_0x2fb3('0xa'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x3ad49f){process[_0x2fb3('0xb')](function(){syncho(function(){try{setChannelVariables(_0x3ad49f);agiHandler(_0x3ad49f);}catch(_0x2ac5d8){logger[_0x2fb3('0xc')](_0x2ac5d8[_0x2fb3('0xd')]);}});});}function projectUpdateHandler(_0x17a77d){try{var _0x2aaf08=_[_0x2fb3('0xe')](projects,['id',_0x17a77d['id']]);if(_0x2aaf08>-0x1){if(_0x17a77d['deleted']===!![]){projects['splice'](_0x2aaf08,0x1);}else{projects[_0x2aaf08]=_0x17a77d;}}else{projects['push'](_0x17a77d);}}catch(_0x17d4b2){logger['error'](_0x17d4b2[_0x2fb3('0xd')]);}}function listeningHandler(){console[_0x2fb3('0xf')](_0x2fb3('0x10'),config[_0x2fb3('0x5')][_0x2fb3('0x11')]);logger[_0x2fb3('0x12')](util[_0x2fb3('0x13')](_0x2fb3('0x14'),config[_0x2fb3('0x5')]['ip'],config['agi'][_0x2fb3('0x11')]));}function errorHandler(_0x2440cb){if(_0x2440cb&&_0x2440cb['name']&&_0x2440cb[_0x2fb3('0x15')]){logger[_0x2fb3('0xc')](util[_0x2fb3('0x13')]('[%s]\x20%s',_0x2440cb[_0x2fb3('0x16')],_0x2440cb[_0x2fb3('0x15')]));}else{logger[_0x2fb3('0xc')](util[_0x2fb3('0x13')](_0x2fb3('0x17'),_0x2440cb[_0x2fb3('0xd')]));}}function closeHandler(){logger['info'](util[_0x2fb3('0x13')](_0x2fb3('0x18'),this[_0x2fb3('0x19')],this[_0x2fb3('0x1a')],this['callerid'],this[_0x2fb3('0x1b')],this[_0x2fb3('0x1c')]));try{createSquareReport(this);}catch(_0xdd9863){logger[_0x2fb3('0xc')](_0xdd9863['stack']);}}function timeoutHandler(){logger[_0x2fb3('0x12')](util[_0x2fb3('0x13')](_0x2fb3('0x1d'),this[_0x2fb3('0x19')],this[_0x2fb3('0x1a')],this[_0x2fb3('0x1e')],this[_0x2fb3('0x1b')],this[_0x2fb3('0x1c')]));}function hangupHandler(){logger[_0x2fb3('0x12')](util[_0x2fb3('0x13')](_0x2fb3('0x1f'),this['arg_1'],this[_0x2fb3('0x1a')],this[_0x2fb3('0x1e')],this['dnid'],this[_0x2fb3('0x1c')]));this[_0x2fb3('0x20')]=!![];}function createSquareReport(_0xc73f1c,_0x160310){rpc[_0x2fb3('0x21')](_0xc73f1c)[_0x2fb3('0x22')](function(_0x490d9){if(_0x160310){_0x160310(null,_0x490d9);}})[_0x2fb3('0x23')](function(_0x2d5b23){if(_0x160310){_0x160310(null,_0x2d5b23);}});}function setChannelVariables(_0x40a467){for(var _0x455dcf in _0x40a467){if(_0x40a467[_0x2fb3('0x24')](_0x455dcf)){if(_0x455dcf[_0x2fb3('0x25')](_0x2fb3('0x26'))===0x0){_0x40a467[_0x455dcf[_0x2fb3('0x27')](0x4)]=_0x40a467[_0x455dcf];delete _0x40a467[_0x455dcf];}}}}function agiHandler(_0xd98823){logger[_0x2fb3('0x28')](_0x2fb3('0x29'),JSON[_0x2fb3('0x2a')](_0xd98823,null,0x2));logger[_0x2fb3('0x12')](util[_0x2fb3('0x13')](_0x2fb3('0x2b'),_0xd98823['arg_1'],_0xd98823['calleridname'],_0xd98823[_0x2fb3('0x1e')],_0xd98823[_0x2fb3('0x1b')],_0xd98823[_0x2fb3('0x1c')]));_0xd98823['on'](_0x2fb3('0xc'),errorHandler);_0xd98823['on']('close',closeHandler);_0xd98823['on'](_0x2fb3('0x2c'),timeoutHandler);_0xd98823['evtHangup']=![];_0xd98823['on'](_0x2fb3('0x2d'),hangupHandler);var _0x3831a2=_[_0x2fb3('0x2e')](projects,[_0x2fb3('0x16'),_0xd98823[_0x2fb3('0x19')]]);if(!_0x3831a2)return Project['handleNotFound'](_0xd98823);if(!_0x3831a2[_0x2fb3('0x2f')])return Project['handleUnpublished'](_0xd98823);return Project[_0x2fb3('0x30')](_0x3831a2,_0xd98823);}function main(){var _0x143a10;return utilLicense[_0x2fb3('0x31')]()[_0x2fb3('0x22')](function(_0x11e89f){if(!_0x11e89f)return;if(_0x11e89f[_0x2fb3('0x32')]){if(_0x11e89f['callysquare']&&_0x11e89f[_0x2fb3('0x33')]>0x0){logger['info'](util['format'](_0x2fb3('0x34'),_0x11e89f[_0x2fb3('0x33')]));_0x143a10=_0x11e89f['callysquare'];}else{logger[_0x2fb3('0x12')](_0x2fb3('0x35'));}}else{logger[_0x2fb3('0x12')](_0x2fb3('0x36'));_0x143a10=-0x1;}})[_0x2fb3('0x22')](function(){return Project[_0x2fb3('0x37')]();})[_0x2fb3('0x22')](function(_0x3c43e3){projects=_0x3c43e3;return;})[_0x2fb3('0x23')](function(_0x509ec3){logger['error'](_0x2fb3('0x38'),_0x509ec3['stack']);})[_0x2fb3('0x39')](function(){var _0x947281=require(_0x2fb3('0x3a'))(config[_0x2fb3('0x5')][_0x2fb3('0x11')],config[_0x2fb3('0x5')]['ip'],_0x143a10);_0x947281['on'](_0x2fb3('0xc'),errorHandler);_0x947281['on']('listening',listeningHandler);_0x947281['on'](_0x2fb3('0x3b'),connectionHandler);_0x947281['on'](_0x2fb3('0x3c'),closeHandler);});}main(); \ No newline at end of file +var _0x6012=['finally','./server','listening','connection','lodash','syncho','util','../../config/license/util','./rpc','./events','agi','projectUpdate','nextTick','error','stack','findIndex','deleted','splice','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[ERROR]\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','handleNotFound','production','handleUnpublished','initialize','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','getAll','[LICENSE]'];(function(_0x58998c,_0x2b9ab4){var _0x9789db=function(_0x1c4108){while(--_0x1c4108){_0x58998c['push'](_0x58998c['shift']());}};_0x9789db(++_0x2b9ab4);}(_0x6012,0xec));var _0x2601=function(_0x1064bc,_0x206f12){_0x1064bc=_0x1064bc-0x0;var _0x5edc45=_0x6012[_0x1064bc];return _0x5edc45;};'use strict';var _=require(_0x2601('0x0'));var syncho=require(_0x2601('0x1'));var util=require(_0x2601('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')('agi');var utilLicense=require(_0x2601('0x3'));var rpc=require(_0x2601('0x4'));var Project=require('./project');var AGIEmitter=require(_0x2601('0x5'))['EventEmitter'];var projects=[];config[_0x2601('0x6')]=_['defaults'](config[_0x2601('0x6')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x2601('0x7'),projectUpdateHandler);function connectionHandler(_0x403b49){process[_0x2601('0x8')](function(){syncho(function(){try{setChannelVariables(_0x403b49);agiHandler(_0x403b49);}catch(_0x57d1f9){logger[_0x2601('0x9')](_0x57d1f9[_0x2601('0xa')]);}});});}function projectUpdateHandler(_0x501f89){try{var _0x2d94f2=_[_0x2601('0xb')](projects,['id',_0x501f89['id']]);if(_0x2d94f2>-0x1){if(_0x501f89[_0x2601('0xc')]===!![]){projects[_0x2601('0xd')](_0x2d94f2,0x1);}else{projects[_0x2d94f2]=_0x501f89;}}else{projects[_0x2601('0xe')](_0x501f89);}}catch(_0x2207ef){logger['error'](_0x2207ef['stack']);}}function listeningHandler(){console[_0x2601('0xf')](_0x2601('0x10'),config[_0x2601('0x6')][_0x2601('0x11')]);logger[_0x2601('0x12')](util[_0x2601('0x13')](_0x2601('0x14'),config[_0x2601('0x6')]['ip'],config[_0x2601('0x6')][_0x2601('0x11')]));}function errorHandler(_0x3833f7){if(_0x3833f7&&_0x3833f7[_0x2601('0x15')]&&_0x3833f7['message']){logger[_0x2601('0x9')](util['format']('[%s]\x20%s',_0x3833f7[_0x2601('0x15')],_0x3833f7[_0x2601('0x16')]));}else{logger[_0x2601('0x9')](util[_0x2601('0x13')](_0x2601('0x17'),_0x3833f7[_0x2601('0xa')]));}}function closeHandler(){logger['info'](util[_0x2601('0x13')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x2601('0x18')],this[_0x2601('0x19')],this[_0x2601('0x1a')],this[_0x2601('0x1b')],this[_0x2601('0x1c')]));try{createSquareReport(this);}catch(_0x10d916){logger[_0x2601('0x9')](_0x10d916[_0x2601('0xa')]);}}function timeoutHandler(){logger[_0x2601('0x12')](util[_0x2601('0x13')](_0x2601('0x1d'),this[_0x2601('0x18')],this[_0x2601('0x19')],this[_0x2601('0x1a')],this[_0x2601('0x1b')],this[_0x2601('0x1c')]));}function hangupHandler(){logger[_0x2601('0x12')](util[_0x2601('0x13')](_0x2601('0x1e'),this[_0x2601('0x18')],this['calleridname'],this[_0x2601('0x1a')],this[_0x2601('0x1b')],this[_0x2601('0x1c')]));this[_0x2601('0x1f')]=!![];}function createSquareReport(_0x33afd5,_0x33a3d7){rpc[_0x2601('0x20')](_0x33afd5)[_0x2601('0x21')](function(_0x484a2b){if(_0x33a3d7){_0x33a3d7(null,_0x484a2b);}})[_0x2601('0x22')](function(_0x32fa29){if(_0x33a3d7){_0x33a3d7(null,_0x32fa29);}});}function setChannelVariables(_0x484c40){for(var _0x43b283 in _0x484c40){if(_0x484c40[_0x2601('0x23')](_0x43b283)){if(_0x43b283[_0x2601('0x24')](_0x2601('0x25'))===0x0){_0x484c40[_0x43b283['substring'](0x4)]=_0x484c40[_0x43b283];delete _0x484c40[_0x43b283];}}}}function agiHandler(_0x39a25a){logger['debug'](_0x2601('0x26'),JSON[_0x2601('0x27')](_0x39a25a,null,0x2));logger[_0x2601('0x12')](util['format'](_0x2601('0x28'),_0x39a25a[_0x2601('0x18')],_0x39a25a[_0x2601('0x19')],_0x39a25a[_0x2601('0x1a')],_0x39a25a[_0x2601('0x1b')],_0x39a25a[_0x2601('0x1c')]));_0x39a25a['on'](_0x2601('0x9'),errorHandler);_0x39a25a['on'](_0x2601('0x29'),closeHandler);_0x39a25a['on'](_0x2601('0x2a'),timeoutHandler);_0x39a25a[_0x2601('0x1f')]=![];_0x39a25a['on'](_0x2601('0x2b'),hangupHandler);var _0x554ecd=_[_0x2601('0x2c')](projects,[_0x2601('0x15'),_0x39a25a[_0x2601('0x18')]]);if(!_0x554ecd)return Project[_0x2601('0x2d')](_0x39a25a);if(!_0x554ecd[_0x2601('0x2e')])return Project[_0x2601('0x2f')](_0x39a25a);return Project[_0x2601('0x30')](_0x554ecd,_0x39a25a);}function main(){var _0x2b6fc7;return utilLicense[_0x2601('0x31')]()[_0x2601('0x21')](function(_0xe90410){if(!_0xe90410)return;if(_0xe90410['voice']){if(_0xe90410[_0x2601('0x32')]&&_0xe90410['callysquare']>0x0){logger['info'](util['format'](_0x2601('0x33'),_0xe90410[_0x2601('0x32')]));_0x2b6fc7=_0xe90410['callysquare'];}else{logger[_0x2601('0x12')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x2601('0x12')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x2b6fc7=-0x1;}})[_0x2601('0x21')](function(){return Project[_0x2601('0x34')]();})[_0x2601('0x21')](function(_0x1abbaa){projects=_0x1abbaa;return;})[_0x2601('0x22')](function(_0x4d6e94){logger['error'](_0x2601('0x35'),_0x4d6e94[_0x2601('0xa')]);})[_0x2601('0x36')](function(){var _0x58a3f2=require(_0x2601('0x37'))(config[_0x2601('0x6')]['port'],config['agi']['ip'],_0x2b6fc7);_0x58a3f2['on'](_0x2601('0x9'),errorHandler);_0x58a3f2['on'](_0x2601('0x38'),listeningHandler);_0x58a3f2['on'](_0x2601('0x39'),connectionHandler);_0x58a3f2['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 46c10a5..8637317 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 _0x8c8b=['jayson/promise','http','request','then','error','message','result','catch','sendMailMessage','SendMail','bluebird'];(function(_0x28813e,_0x36dd25){var _0x289f78=function(_0x361534){while(--_0x361534){_0x28813e['push'](_0x28813e['shift']());}};_0x289f78(++_0x36dd25);}(_0x8c8b,0xa4));var _0xb8c8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8c8b[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require(_0xb8c8('0x0'));var jayson=require(_0xb8c8('0x1'));var client=jayson['client'][_0xb8c8('0x2')]({'port':0x232b});function request(_0x27ac1d,_0x1bd4d7){return new BPromise(function(_0x477433,_0xf209ba){return client[_0xb8c8('0x3')](_0x27ac1d,_0x1bd4d7)[_0xb8c8('0x4')](function(_0xb3e016){if(_0xb3e016['error']){return _0xf209ba(_0xb3e016[_0xb8c8('0x5')][_0xb8c8('0x6')]);}else{return _0x477433(_0xb3e016[_0xb8c8('0x7')]);}})[_0xb8c8('0x8')](function(_0x4f8369){return _0xf209ba(_0x4f8369);});});}exports[_0xb8c8('0x9')]=function(_0xc1db04,_0x1f3f7b){return request(_0xb8c8('0xa'),{'account':_0xc1db04,'message':_0x1f3f7b});}; \ No newline at end of file +var _0x4cc7=['result','catch','sendMailMessage','SendMail','bluebird','client','request','then','error','message'];(function(_0x56b4bd,_0x2ee80f){var _0x17a6f3=function(_0x233445){while(--_0x233445){_0x56b4bd['push'](_0x56b4bd['shift']());}};_0x17a6f3(++_0x2ee80f);}(_0x4cc7,0x9a));var _0x74cc=function(_0x28f582,_0x16950e){_0x28f582=_0x28f582-0x0;var _0x2d7e9d=_0x4cc7[_0x28f582];return _0x2d7e9d;};'use strict';var BPromise=require(_0x74cc('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x74cc('0x1')]['http']({'port':0x232b});function request(_0x41bcd7,_0x18b489){return new BPromise(function(_0x3c2ac7,_0x2724f7){return client[_0x74cc('0x2')](_0x41bcd7,_0x18b489)[_0x74cc('0x3')](function(_0x67e227){if(_0x67e227[_0x74cc('0x4')]){return _0x2724f7(_0x67e227[_0x74cc('0x4')][_0x74cc('0x5')]);}else{return _0x3c2ac7(_0x67e227[_0x74cc('0x6')]);}})[_0x74cc('0x7')](function(_0x5b762d){return _0x2724f7(_0x5b762d);});});}exports[_0x74cc('0x8')]=function(_0x598412,_0x255e5a){return request(_0x74cc('0x9'),{'account':_0x598412,'message':_0x255e5a});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 73b22c3..0423b30 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe839=['./rpc','./mailRpc','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','target','addEdge','source','value','toJson','mxGraphModel','root','start','debug','stringify','joinAt','info','format','arg_1','calleridname','callerid','uniqueid','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','stack','finally','dnid','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','close','exports','moment','xml2json','util','../../config/logger','agi'];(function(_0x2b0d5c,_0x1cef0b){var _0x45b074=function(_0x3606e){while(--_0x3606e){_0x2b0d5c['push'](_0x2b0d5c['shift']());}};_0x45b074(++_0x1cef0b);}(_0xe839,0x122));var _0x9e83=function(_0x1b1f88,_0x3fe1cb){_0x1b1f88=_0x1b1f88-0x0;var _0x5045b9=_0xe839[_0x1b1f88];return _0x5045b9;};'use strict';var _=require('lodash');var moment=require(_0x9e83('0x0'));var parser=require(_0x9e83('0x1'));var util=require(_0x9e83('0x2'));var logger=require(_0x9e83('0x3'))(_0x9e83('0x4'));var rpc=require(_0x9e83('0x5'));var mailRpc=require(_0x9e83('0x6'));var Graph=require('./graph');var Vertices=require(_0x9e83('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x9e83('0x8')]()[_0x9e83('0x9')](function(_0x1e582a){logger[_0x9e83('0xa')](_0x9e83('0xb'),_0x1e582a['stack']);return[];});}function addVertex(_0x5e23d6,_0x4831fc,_0x5562e3){_0x4831fc[_0x9e83('0xc')]=_0x5562e3;if(_0x4831fc[_0x9e83('0xd')](_0x9e83('0xe'))){_0x4831fc[_0x9e83('0xf')]=parseInt(_0x4831fc[_0x9e83('0xe')],0xa);}_0x5e23d6[_0x9e83('0x10')](_[_0x9e83('0x11')](_0x4831fc,_0x9e83('0x12')));}function initGraph(_0xd02a14,_0x413d33){var _0x46f5d1=new Graph();for(var _0x2b6cab in _0xd02a14){if(_0xd02a14[_0x9e83('0xd')](_0x2b6cab)){if(_[_0x9e83('0x13')](_0xd02a14[_0x2b6cab])){for(var _0x400ffa=0x0;_0x400ffa<_0xd02a14[_0x2b6cab][_0x9e83('0x14')];_0x400ffa+=0x1){addVertex(_0x46f5d1,_0xd02a14[_0x2b6cab][_0x400ffa],_0x2b6cab);}}else{addVertex(_0x46f5d1,_0xd02a14[_0x2b6cab],_0x2b6cab);}}}for(var _0x39f6ae=0x0;_0x39f6ae<_0x413d33[_0x9e83('0x14')];_0x39f6ae+=0x1){if(_0x413d33[_0x39f6ae]['source']&&_0x413d33[_0x39f6ae][_0x9e83('0x15')]){_0x46f5d1[_0x9e83('0x16')](_0x413d33[_0x39f6ae][_0x9e83('0x17')],_0x413d33[_0x39f6ae]['target'],_0x413d33[_0x39f6ae][_0x9e83('0x18')]);}}return _0x46f5d1;}function getRoot(_0x5e43fb){return parser[_0x9e83('0x19')](_0x5e43fb,{'object':!![]})[_0x9e83('0x1a')][_0x9e83('0x1b')];}function inspect(_0xbe706c){return util['inspect'](_0xbe706c,{'showHidden':![],'depth':null});}function initialize(_0x30282f,_0x40adcd){var _0x4c6ba6=getRoot(_0x30282f['production']);if(!_0x4c6ba6||!_0x4c6ba6[_0x9e83('0x1c')])return;var _0x4dbe58,_0x5d6430,_0x26c5dd;logger[_0x9e83('0x1d')](_0x9e83('0x1b'),JSON[_0x9e83('0x1e')](_0x4c6ba6,null,0x2));_0x40adcd[_0x9e83('0x1f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4dbe58=initGraph(_[_0x9e83('0x11')](_0x4c6ba6,_0x9e83('0x12')),_0x4c6ba6[_0x9e83('0x12')]);_0x5d6430=new Vertices(_0x40adcd,rpc,mailRpc);logger[_0x9e83('0x20')](util[_0x9e83('0x21')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x40adcd[_0x9e83('0x22')],_0x40adcd[_0x9e83('0x23')],_0x40adcd[_0x9e83('0x24')],_0x40adcd['dnid'],_0x40adcd[_0x9e83('0x25')]));_0x4dbe58['traverseBFS'](_0x4c6ba6['start']['id'],function(_0x5946a1){try{_0x5946a1=_0x5d6430['clear'](_0x5946a1);logger[_0x9e83('0x1d')](_0x9e83('0x26'),JSON[_0x9e83('0x1e')](_0x5946a1,null,0x2));if(_0x5946a1[_0x9e83('0xc')]==='gotoc'){logger[_0x9e83('0x20')](_0x9e83('0x27'));_0x40adcd[_0x9e83('0x28')]=_0x5946a1['context']||_0x40adcd[_0x9e83('0x28')];_0x40adcd[_0x9e83('0x29')]=_0x5946a1[_0x9e83('0x29')];_0x40adcd[_0x9e83('0x2a')]=_0x5946a1[_0x9e83('0x2a')]?_0x5946a1[_0x9e83('0x2a')]-0x1:0x1;return null;}else if(_0x5946a1&&_0x5d6430[_0x5946a1[_0x9e83('0xc')]]){_0x26c5dd=_0x5d6430[_0x5946a1[_0x9e83('0xc')]](_0x5946a1);logger['info'](_0x9e83('0x2b'),JSON[_0x9e83('0x1e')](_0x26c5dd,null,0x2));if(_0x26c5dd&&_0x26c5dd[_0x9e83('0x2c')]===AGI_CODE_SUCCESS&&_0x26c5dd[_0x9e83('0x2d')]!==AGI_RESULT_ERROR&&!_0x40adcd[_0x9e83('0x2e')]){logger[_0x9e83('0x1d')](_0x9e83('0x2b'),inspect(_0x26c5dd));return _[_0x9e83('0x2f')](_0x26c5dd['result'])?null:_0x26c5dd[_0x9e83('0x2d')]['toString']();}else{logger[_0x9e83('0xa')]('response',inspect(_0x26c5dd));return null;}}else{logger[_0x9e83('0xa')]('agicommand\x20not\x20found');return null;}}catch(_0x1ee6f8){logger[_0x9e83('0xa')](_0x1ee6f8[_0x9e83('0x30')]);return null;}});if(_0x4c6ba6[_0x9e83('0x31')]){logger[_0x9e83('0x20')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x40adcd[_0x9e83('0x22')],_0x40adcd[_0x9e83('0x23')],_0x40adcd['callerid'],_0x40adcd[_0x9e83('0x32')],_0x40adcd[_0x9e83('0x25')]));_0x4dbe58['traverseBFS'](_0x4c6ba6[_0x9e83('0x31')]['id'],function(_0x3906ef){try{_0x3906ef=_0x5d6430['clear'](_0x3906ef);logger[_0x9e83('0x1d')]('vertex',JSON['stringify'](_0x3906ef,null,0x2));if(_0x3906ef&&_0x5d6430[_0x3906ef[_0x9e83('0xc')]]){_0x26c5dd=_0x5d6430[_0x3906ef[_0x9e83('0xc')]](_0x3906ef);if(_0x26c5dd){logger[_0x9e83('0x1d')](_0x9e83('0x2b'),inspect(_0x26c5dd));return _[_0x9e83('0x2f')](_0x26c5dd[_0x9e83('0x2d')])?null:_0x26c5dd[_0x9e83('0x2d')]['toString']();}else{logger[_0x9e83('0xa')](_0x9e83('0x2b'),inspect(_0x26c5dd));return null;}}else{logger[_0x9e83('0xa')](_0x9e83('0x33'));return null;}}catch(_0x44b795){logger[_0x9e83('0xa')](_0x44b795[_0x9e83('0x30')]);return null;}});}logger['info'](util[_0x9e83('0x21')](_0x9e83('0x34'),_0x40adcd[_0x9e83('0x22')],_0x40adcd[_0x9e83('0x23')],_0x40adcd[_0x9e83('0x24')],_0x40adcd[_0x9e83('0x32')],_0x40adcd[_0x9e83('0x25')]));logger[_0x9e83('0x20')](util['format'](_0x9e83('0x35'),_0x40adcd['context'],_0x40adcd['extension'],parseInt(_0x40adcd[_0x9e83('0x2a')],0xa)+0x1));_0x40adcd[_0x9e83('0x36')](_0x40adcd[_0x9e83('0x28')],_0x40adcd[_0x9e83('0x29')],parseInt(_0x40adcd['priority'],0xa)+0x1);_0x40adcd['close']();}function handleNotFound(_0x280b29){logger['error'](util[_0x9e83('0x21')](_0x9e83('0x37'),_0x280b29[_0x9e83('0x22')]));_0x280b29[_0x9e83('0x36')](_0x280b29['context'],_0x280b29[_0x9e83('0x29')],parseInt(_0x280b29[_0x9e83('0x2a')],0xa)+0x1);_0x280b29['close']();}function handleUnpublished(_0x5d05e7){logger[_0x9e83('0xa')](util[_0x9e83('0x21')](_0x9e83('0x38'),_0x5d05e7['arg_1']));_0x5d05e7[_0x9e83('0x36')](_0x5d05e7[_0x9e83('0x28')],_0x5d05e7[_0x9e83('0x29')],parseInt(_0x5d05e7[_0x9e83('0x2a')],0xa)+0x1);_0x5d05e7[_0x9e83('0x39')]();}module[_0x9e83('0x3a')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x6b24=['omit','mxCell','isArray','length','source','target','addEdge','value','inspect','debug','root','stringify','joinAt','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','uniqueid','traverseBFS','start','clear','vertex','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','evtHangup','isUndefined','toString','response','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','lodash','moment','xml2json','../../config/logger','agi','./mailRpc','./graph','./vertices','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','addVertex'];(function(_0x39a2db,_0x170743){var _0xc22b25=function(_0x2329dc){while(--_0x2329dc){_0x39a2db['push'](_0x39a2db['shift']());}};_0xc22b25(++_0x170743);}(_0x6b24,0x18d));var _0x46b2=function(_0x426dd2,_0x4b0012){_0x426dd2=_0x426dd2-0x0;var _0x4bc76c=_0x6b24[_0x426dd2];return _0x4bc76c;};'use strict';var _=require(_0x46b2('0x0'));var moment=require(_0x46b2('0x1'));var parser=require(_0x46b2('0x2'));var util=require('util');var logger=require(_0x46b2('0x3'))(_0x46b2('0x4'));var rpc=require('./rpc');var mailRpc=require(_0x46b2('0x5'));var Graph=require(_0x46b2('0x6'));var Vertices=require(_0x46b2('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x46b2('0x8')]()['catch'](function(_0x328e9d){logger[_0x46b2('0x9')](_0x46b2('0xa'),_0x328e9d[_0x46b2('0xb')]);return[];});}function addVertex(_0x4b9f88,_0x2e6b56,_0x22a691){_0x2e6b56[_0x46b2('0xc')]=_0x22a691;if(_0x2e6b56[_0x46b2('0xd')]('retry')){_0x2e6b56['maxRetry']=parseInt(_0x2e6b56[_0x46b2('0xe')],0xa);}_0x4b9f88[_0x46b2('0xf')](_[_0x46b2('0x10')](_0x2e6b56,_0x46b2('0x11')));}function initGraph(_0x4b5c21,_0x14a429){var _0x2a8a14=new Graph();for(var _0x4820e0 in _0x4b5c21){if(_0x4b5c21[_0x46b2('0xd')](_0x4820e0)){if(_[_0x46b2('0x12')](_0x4b5c21[_0x4820e0])){for(var _0x342dfd=0x0;_0x342dfd<_0x4b5c21[_0x4820e0][_0x46b2('0x13')];_0x342dfd+=0x1){addVertex(_0x2a8a14,_0x4b5c21[_0x4820e0][_0x342dfd],_0x4820e0);}}else{addVertex(_0x2a8a14,_0x4b5c21[_0x4820e0],_0x4820e0);}}}for(var _0x1205f2=0x0;_0x1205f2<_0x14a429[_0x46b2('0x13')];_0x1205f2+=0x1){if(_0x14a429[_0x1205f2][_0x46b2('0x14')]&&_0x14a429[_0x1205f2][_0x46b2('0x15')]){_0x2a8a14[_0x46b2('0x16')](_0x14a429[_0x1205f2]['source'],_0x14a429[_0x1205f2]['target'],_0x14a429[_0x1205f2][_0x46b2('0x17')]);}}return _0x2a8a14;}function getRoot(_0x52a455){return parser['toJson'](_0x52a455,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x5cffdd){return util[_0x46b2('0x18')](_0x5cffdd,{'showHidden':![],'depth':null});}function initialize(_0xc56d83,_0x44badb){var _0x57749d=getRoot(_0xc56d83['production']);if(!_0x57749d||!_0x57749d['start'])return;var _0x3bcd24,_0x4747dc,_0x58d558;logger[_0x46b2('0x19')](_0x46b2('0x1a'),JSON[_0x46b2('0x1b')](_0x57749d,null,0x2));_0x44badb[_0x46b2('0x1c')]=moment()[_0x46b2('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');_0x3bcd24=initGraph(_[_0x46b2('0x10')](_0x57749d,_0x46b2('0x11')),_0x57749d[_0x46b2('0x11')]);_0x4747dc=new Vertices(_0x44badb,rpc,mailRpc);logger['info'](util[_0x46b2('0x1d')](_0x46b2('0x1e'),_0x44badb[_0x46b2('0x1f')],_0x44badb['calleridname'],_0x44badb['callerid'],_0x44badb['dnid'],_0x44badb[_0x46b2('0x20')]));_0x3bcd24[_0x46b2('0x21')](_0x57749d[_0x46b2('0x22')]['id'],function(_0x5e027a){try{_0x5e027a=_0x4747dc[_0x46b2('0x23')](_0x5e027a);logger[_0x46b2('0x19')](_0x46b2('0x24'),JSON[_0x46b2('0x1b')](_0x5e027a,null,0x2));if(_0x5e027a['agicommand']===_0x46b2('0x25')){logger[_0x46b2('0x26')](_0x46b2('0x27'));_0x44badb['context']=_0x5e027a[_0x46b2('0x28')]||_0x44badb[_0x46b2('0x28')];_0x44badb[_0x46b2('0x29')]=_0x5e027a[_0x46b2('0x29')];_0x44badb[_0x46b2('0x2a')]=_0x5e027a[_0x46b2('0x2a')]?_0x5e027a[_0x46b2('0x2a')]-0x1:0x1;return null;}else if(_0x5e027a&&_0x4747dc[_0x5e027a[_0x46b2('0xc')]]){_0x58d558=_0x4747dc[_0x5e027a[_0x46b2('0xc')]](_0x5e027a);logger['info']('response',JSON[_0x46b2('0x1b')](_0x58d558,null,0x2));if(_0x58d558&&_0x58d558[_0x46b2('0x2b')]===AGI_CODE_SUCCESS&&_0x58d558[_0x46b2('0x2c')]!==AGI_RESULT_ERROR&&!_0x44badb[_0x46b2('0x2d')]){logger[_0x46b2('0x19')]('response',inspect(_0x58d558));return _[_0x46b2('0x2e')](_0x58d558[_0x46b2('0x2c')])?null:_0x58d558[_0x46b2('0x2c')][_0x46b2('0x2f')]();}else{logger[_0x46b2('0x9')](_0x46b2('0x30'),inspect(_0x58d558));return null;}}else{logger[_0x46b2('0x9')](_0x46b2('0x31'));return null;}}catch(_0x7f70fd){logger[_0x46b2('0x9')](_0x7f70fd['stack']);return null;}});if(_0x57749d[_0x46b2('0x32')]){logger[_0x46b2('0x26')](util[_0x46b2('0x1d')](_0x46b2('0x33'),_0x44badb[_0x46b2('0x1f')],_0x44badb['calleridname'],_0x44badb['callerid'],_0x44badb[_0x46b2('0x34')],_0x44badb[_0x46b2('0x20')]));_0x3bcd24[_0x46b2('0x21')](_0x57749d[_0x46b2('0x32')]['id'],function(_0x2359c1){try{_0x2359c1=_0x4747dc['clear'](_0x2359c1);logger['debug'](_0x46b2('0x24'),JSON[_0x46b2('0x1b')](_0x2359c1,null,0x2));if(_0x2359c1&&_0x4747dc[_0x2359c1[_0x46b2('0xc')]]){_0x58d558=_0x4747dc[_0x2359c1['agicommand']](_0x2359c1);if(_0x58d558){logger[_0x46b2('0x19')]('response',inspect(_0x58d558));return _[_0x46b2('0x2e')](_0x58d558[_0x46b2('0x2c')])?null:_0x58d558[_0x46b2('0x2c')][_0x46b2('0x2f')]();}else{logger[_0x46b2('0x9')]('response',inspect(_0x58d558));return null;}}else{logger[_0x46b2('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x16d37f){logger['error'](_0x16d37f[_0x46b2('0xb')]);return null;}});}logger[_0x46b2('0x26')](util[_0x46b2('0x1d')](_0x46b2('0x35'),_0x44badb[_0x46b2('0x1f')],_0x44badb['calleridname'],_0x44badb[_0x46b2('0x36')],_0x44badb[_0x46b2('0x34')],_0x44badb[_0x46b2('0x20')]));logger[_0x46b2('0x26')](util[_0x46b2('0x1d')](_0x46b2('0x37'),_0x44badb[_0x46b2('0x28')],_0x44badb['extension'],parseInt(_0x44badb[_0x46b2('0x2a')],0xa)+0x1));_0x44badb[_0x46b2('0x38')](_0x44badb[_0x46b2('0x28')],_0x44badb[_0x46b2('0x29')],parseInt(_0x44badb[_0x46b2('0x2a')],0xa)+0x1);_0x44badb[_0x46b2('0x39')]();}function handleNotFound(_0x480c5b){logger[_0x46b2('0x9')](util[_0x46b2('0x1d')](_0x46b2('0x3a'),_0x480c5b['arg_1']));_0x480c5b[_0x46b2('0x38')](_0x480c5b[_0x46b2('0x28')],_0x480c5b[_0x46b2('0x29')],parseInt(_0x480c5b[_0x46b2('0x2a')],0xa)+0x1);_0x480c5b['close']();}function handleUnpublished(_0xb2a773){logger[_0x46b2('0x9')](util[_0x46b2('0x1d')]('Project\x20%s\x20not\x20published',_0xb2a773[_0x46b2('0x1f')]));_0xb2a773[_0x46b2('0x38')](_0xb2a773['context'],_0xb2a773['extension'],parseInt(_0xb2a773['priority'],0xa)+0x1);_0xb2a773[_0x46b2('0x39')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 7f8e2b9..5a0194f 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 _0xdd64=['_inBody','substring','length','split','indexOf','trim','slice','emit','headers','line','exports','util','stream','Transform','_localBuffer','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xdd64,0xd3));var _0x4dd6=function(_0x1e5b45,_0x1b8ee7){_0x1e5b45=_0x1e5b45-0x0;var _0x1b87d1=_0xdd64[_0x1e5b45];return _0x1b87d1;};'use strict';var util=require(_0x4dd6('0x0'));var Transform=require(_0x4dd6('0x1'))[_0x4dd6('0x2')];function AGIReply(_0x11fb76){Transform['call'](this,_0x11fb76);this[_0x4dd6('0x3')]='';this['_inBody']=![];}util[_0x4dd6('0x4')](AGIReply,Transform);AGIReply[_0x4dd6('0x5')][_0x4dd6('0x6')]=function(_0x5a1516,_0x24bc6b,_0x118ec2){var _0x33f99d='\x0a',_0x51f2b3=['\x0a\x0a',_0x4dd6('0x7')],_0x5cd8e0=-0x1,_0x32b759=-0x1,_0x2efc76='',_0x2592df=0x0,_0x1f8241='',_0x7f0bb5='';this['_localBuffer']+=_0x5a1516[_0x4dd6('0x8')]();_0x1f8241=this[_0x4dd6('0x3')];if(!this[_0x4dd6('0x9')]){_0x2592df=0x0;while(_0x51f2b3[_0x2592df]){while((_0x32b759=_0x1f8241['indexOf'](_0x51f2b3[_0x2592df]))!=-0x1){_0x2efc76=_0x51f2b3[_0x2592df];_0x7f0bb5=_0x1f8241[_0x4dd6('0xa')](0x0,_0x32b759);_0x1f8241=_0x1f8241[_0x4dd6('0xa')](_0x32b759+_0x2efc76[_0x4dd6('0xb')]);var _0x1e9d4a=_0x7f0bb5[_0x4dd6('0xc')](_0x33f99d),_0x492f3a=0x0,_0x315cc4={},_0x19f3e2='',_0x1804b8='',_0x431f72=-0x1;while(_0x1e9d4a[_0x492f3a]){_0x431f72=_0x1e9d4a[_0x492f3a][_0x4dd6('0xd')](':');if(_0x431f72!=-0x1){_0x19f3e2=_0x1e9d4a[_0x492f3a]['slice'](0x0,_0x431f72)[_0x4dd6('0xe')]();_0x1804b8=_0x1e9d4a[_0x492f3a][_0x4dd6('0xf')](_0x431f72+0x1)[_0x4dd6('0xe')]();if(_0x19f3e2[_0x4dd6('0xb')]>0x0){_0x315cc4[_0x19f3e2]=_0x1804b8;}}else{}_0x492f3a++;}this[_0x4dd6('0x10')](_0x4dd6('0x11'),_0x315cc4);this['_inBody']=!![];}_0x2592df++;}this[_0x4dd6('0x3')]=_0x1f8241;}else{while((_0x5cd8e0=_0x1f8241[_0x4dd6('0xd')](_0x33f99d))!=-0x1){_0x7f0bb5=_0x1f8241[_0x4dd6('0xa')](0x0,_0x5cd8e0);this[_0x4dd6('0x10')](_0x4dd6('0x12'),_0x7f0bb5);_0x1f8241=_0x1f8241[_0x4dd6('0xa')](_0x5cd8e0+_0x33f99d[_0x4dd6('0xb')]);}this['_localBuffer']=_0x1f8241;}_0x118ec2();};module[_0x4dd6('0x13')]=AGIReply; \ No newline at end of file +var _0x96eb=['_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','emit','headers','line','exports','util','stream','Transform','call','_localBuffer'];(function(_0x33a53a,_0x3206c4){var _0x54e4b6=function(_0x4808ff){while(--_0x4808ff){_0x33a53a['push'](_0x33a53a['shift']());}};_0x54e4b6(++_0x3206c4);}(_0x96eb,0x113));var _0xb96e=function(_0x1d740d,_0x3bc3f3){_0x1d740d=_0x1d740d-0x0;var _0x582350=_0x96eb[_0x1d740d];return _0x582350;};'use strict';var util=require(_0xb96e('0x0'));var Transform=require(_0xb96e('0x1'))[_0xb96e('0x2')];function AGIReply(_0x210464){Transform[_0xb96e('0x3')](this,_0x210464);this[_0xb96e('0x4')]='';this[_0xb96e('0x5')]=![];}util[_0xb96e('0x6')](AGIReply,Transform);AGIReply[_0xb96e('0x7')][_0xb96e('0x8')]=function(_0x96a569,_0xa8c53a,_0xbda7a7){var _0x2f6997='\x0a',_0x5b233a=['\x0a\x0a',_0xb96e('0x9')],_0x1c7818=-0x1,_0x42d0df=-0x1,_0x335e28='',_0x331f86=0x0,_0x48d5f3='',_0x441d3c='';this[_0xb96e('0x4')]+=_0x96a569[_0xb96e('0xa')]();_0x48d5f3=this['_localBuffer'];if(!this[_0xb96e('0x5')]){_0x331f86=0x0;while(_0x5b233a[_0x331f86]){while((_0x42d0df=_0x48d5f3[_0xb96e('0xb')](_0x5b233a[_0x331f86]))!=-0x1){_0x335e28=_0x5b233a[_0x331f86];_0x441d3c=_0x48d5f3[_0xb96e('0xc')](0x0,_0x42d0df);_0x48d5f3=_0x48d5f3[_0xb96e('0xc')](_0x42d0df+_0x335e28[_0xb96e('0xd')]);var _0x504461=_0x441d3c[_0xb96e('0xe')](_0x2f6997),_0x3cf4cc=0x0,_0x3254ec={},_0xc0de40='',_0x2c0c32='',_0x32b31c=-0x1;while(_0x504461[_0x3cf4cc]){_0x32b31c=_0x504461[_0x3cf4cc][_0xb96e('0xb')](':');if(_0x32b31c!=-0x1){_0xc0de40=_0x504461[_0x3cf4cc]['slice'](0x0,_0x32b31c)['trim']();_0x2c0c32=_0x504461[_0x3cf4cc][_0xb96e('0xf')](_0x32b31c+0x1)['trim']();if(_0xc0de40['length']>0x0){_0x3254ec[_0xc0de40]=_0x2c0c32;}}else{}_0x3cf4cc++;}this[_0xb96e('0x10')](_0xb96e('0x11'),_0x3254ec);this[_0xb96e('0x5')]=!![];}_0x331f86++;}this[_0xb96e('0x4')]=_0x48d5f3;}else{while((_0x1c7818=_0x48d5f3[_0xb96e('0xb')](_0x2f6997))!=-0x1){_0x441d3c=_0x48d5f3[_0xb96e('0xc')](0x0,_0x1c7818);this[_0xb96e('0x10')](_0xb96e('0x12'),_0x441d3c);_0x48d5f3=_0x48d5f3[_0xb96e('0xc')](_0x1c7818+_0x2f6997['length']);}this[_0xb96e('0x4')]=_0x48d5f3;}_0xbda7a7();};module[_0xb96e('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 96ae29b..af7f6f9 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 _0x3036=['agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','jayson/promise','client','http','then','error','message','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','merge','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','getPauseById','agentLogin'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3036,0x1a9));var _0x6303=function(_0x4fcfa8,_0x2fe99){_0x4fcfa8=_0x4fcfa8-0x0;var _0xe7d457=_0x3036[_0x4fcfa8];return _0xe7d457;};'use strict';var _=require('lodash');var moment=require('moment');var jayson=require(_0x6303('0x0'));var client=jayson[_0x6303('0x1')][_0x6303('0x2')]({'port':0x2329});function request(_0x586c8f,_0x130341){return new Promise(function(_0x4b6d75,_0x48aa0c){return client['request'](_0x586c8f,_0x130341)[_0x6303('0x3')](function(_0x48d0c8){if(_0x48d0c8[_0x6303('0x4')]){return _0x48aa0c(_0x48d0c8[_0x6303('0x4')][_0x6303('0x5')]);}else{return _0x4b6d75(_0x48d0c8['result']);}})[_0x6303('0x6')](function(_0x420da8){return _0x48aa0c(_0x420da8);});});}exports[_0x6303('0x7')]=function(){return request(_0x6303('0x8'),{'options':{'raw':![],'attributes':['id',_0x6303('0x9'),_0x6303('0xa')]}});};exports[_0x6303('0xb')]=function(_0x179151){return request(_0x6303('0xc'),{'options':{'raw':![],'where':{'name':_0x179151},'attributes':['production']}});};exports[_0x6303('0xd')]=function(_0x24aa6c){return request(_0x6303('0xe'),{'options':{'raw':![],'where':{'id':_0x24aa6c},'include':[{'model':_0x6303('0xf'),'as':_0x6303('0x10'),'include':[{'model':'CloudProvider','as':_0x6303('0x11')}]}],'attributes':['id',_0x6303('0x9'),_0x6303('0x12')],'smtp':!![]}});};exports[_0x6303('0x13')]=function(_0x284a8b){return request('ShowSquareProject',{'options':{'where':{'id':_0x284a8b},'attributes':['name']}});};exports['getVoiceQueueById']=function(_0x2726ef){return request(_0x6303('0x14'),{'options':{'where':{'id':_0x2726ef},'attributes':[_0x6303('0x9')]}});};exports[_0x6303('0x15')]=function(_0x2bbc57){return request(_0x6303('0x16'),{'options':{'where':{'id':_0x2bbc57},'attributes':[_0x6303('0x9')]}});};exports[_0x6303('0x17')]=function(_0x13874f){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x13874f},'attributes':['dsn']}});};exports[_0x6303('0x18')]=function(_0xc26f2c){return request(_0x6303('0x19'),{'options':{'where':{'id':_0xc26f2c},'attributes':[_0x6303('0x9')]}});};exports[_0x6303('0x1a')]=function(_0x4fe5cf){return request(_0x6303('0x1b'),{'options':{'where':{'phone':_0x4fe5cf[_0x6303('0x1c')]},'attributes':['id']}});};exports[_0x6303('0x1d')]=function(_0x397b97){return request(_0x6303('0x1e'),{'options':{'where':{'id':_0x397b97},'attributes':[_0x6303('0x9')]}});};exports[_0x6303('0x1f')]=function(_0x1211b4){return request(_0x6303('0x20'),{'options':{'where':{'id':_0x1211b4},'attributes':[_0x6303('0x21')]}});};exports[_0x6303('0x22')]=function(_0x4e591d){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x4e591d},'include':[{'model':_0x6303('0x23'),'as':_0x6303('0x24')}]}});};exports[_0x6303('0x25')]=function(_0x20454a){return request('ShowSmsAccount',{'options':{'where':{'id':_0x20454a},'attributes':['id',_0x6303('0x9')]}});};exports[_0x6303('0x26')]=function(_0x2872e8){return request(_0x6303('0x27'),{'body':_0x2872e8});};exports[_0x6303('0x28')]=function(_0x21eec0){return request(_0x6303('0x29'),{'body':_0x21eec0});};exports['createSquareReport']=function(_0x5cb1b5){return request(_0x6303('0x2a'),{'body':_[_0x6303('0x2b')](_0x5cb1b5,{'project_name':_0x5cb1b5['arg_1'],'prev_project_name':_0x5cb1b5[_0x6303('0x2c')]||'','is_subproject':_0x5cb1b5[_0x6303('0x2c')]?!![]:![],'leaveAt':moment()[_0x6303('0x2d')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x6303('0x2e')]=function(_0x45843f){return request(_0x6303('0x2f'),{'body':_0x45843f});};exports[_0x6303('0x30')]=function(_0x768494){return request(_0x6303('0x31'),{'body':_0x768494});};exports[_0x6303('0x32')]=function(_0x3bcf79){return request(_0x6303('0x33'),{'options':{'raw':![],'where':{'phone':_0x3bcf79[_0x6303('0x1c')],'ListId':_0x3bcf79[_0x6303('0x34')]}}})['then'](function(_0x6fe268){if(_0x6fe268){return _0x6fe268;}return request('CreateCmContact',{'body':_0x3bcf79});});};exports[_0x6303('0x35')]=function(_0x544107){return request('ShowPause',{'options':{'where':{'id':_0x544107},'attributes':[_0x6303('0x9')]}});};exports[_0x6303('0x36')]=function(_0x24f68a,_0x4a029d){return request('LoginUser',{'body':{'interface':_0x4a029d},'options':{'where':_0x24f68a}});};exports[_0x6303('0x37')]=function(_0x56113f,_0x4a9d34,_0x57f803){return request(_0x6303('0x38'),{'body':{'type':_0x4a9d34,'uniqueid':_0x57f803},'options':{'where':_0x56113f}});};exports[_0x6303('0x39')]=function(_0x187b90){return request(_0x6303('0x3a'),{'body':{},'options':{'where':_0x187b90}});};exports['agentLogout']=function(_0x3d00da){return request(_0x6303('0x3b'),{'body':{},'options':{'where':_0x3d00da}});}; \ No newline at end of file +var _0x38df=['getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','lodash','moment','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','CloudProvider','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','ListId'];(function(_0x23535e,_0x4de969){var _0x50f005=function(_0x161077){while(--_0x161077){_0x23535e['push'](_0x23535e['shift']());}};_0x50f005(++_0x4de969);}(_0x38df,0x144));var _0xf38d=function(_0x5e2a54,_0x424ad7){_0x5e2a54=_0x5e2a54-0x0;var _0x1c8b6b=_0x38df[_0x5e2a54];return _0x1c8b6b;};'use strict';var _=require(_0xf38d('0x0'));var moment=require(_0xf38d('0x1'));var jayson=require(_0xf38d('0x2'));var client=jayson[_0xf38d('0x3')][_0xf38d('0x4')]({'port':0x2329});function request(_0xa69f2a,_0x5c6950){return new Promise(function(_0x5776bb,_0x115eaa){return client[_0xf38d('0x5')](_0xa69f2a,_0x5c6950)[_0xf38d('0x6')](function(_0x560797){if(_0x560797[_0xf38d('0x7')]){return _0x115eaa(_0x560797[_0xf38d('0x7')][_0xf38d('0x8')]);}else{return _0x5776bb(_0x560797[_0xf38d('0x9')]);}})[_0xf38d('0xa')](function(_0x51e028){return _0x115eaa(_0x51e028);});});}exports[_0xf38d('0xb')]=function(){return request(_0xf38d('0xc'),{'options':{'raw':![],'attributes':['id',_0xf38d('0xd'),_0xf38d('0xe')]}});};exports[_0xf38d('0xf')]=function(_0x1cc441){return request(_0xf38d('0x10'),{'options':{'raw':![],'where':{'name':_0x1cc441},'attributes':['production']}});};exports[_0xf38d('0x11')]=function(_0x2755e2){return request(_0xf38d('0x12'),{'options':{'raw':![],'where':{'id':_0x2755e2},'include':[{'model':_0xf38d('0x13'),'as':'Smtp','include':[{'model':'CloudProvider','as':_0xf38d('0x14')}]}],'attributes':['id',_0xf38d('0xd'),'email'],'smtp':!![]}});};exports[_0xf38d('0x15')]=function(_0x433e6e){return request(_0xf38d('0x10'),{'options':{'where':{'id':_0x433e6e},'attributes':['name']}});};exports[_0xf38d('0x16')]=function(_0x55fd72){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x55fd72},'attributes':[_0xf38d('0xd')]}});};exports[_0xf38d('0x17')]=function(_0x2768fa){return request(_0xf38d('0x18'),{'options':{'where':{'id':_0x2768fa},'attributes':[_0xf38d('0xd')]}});};exports[_0xf38d('0x19')]=function(_0x52dffb){return request(_0xf38d('0x1a'),{'options':{'where':{'id':_0x52dffb},'attributes':[_0xf38d('0x1b')]}});};exports[_0xf38d('0x1c')]=function(_0x43da45){return request(_0xf38d('0x1d'),{'options':{'where':{'id':_0x43da45},'attributes':[_0xf38d('0xd')]}});};exports[_0xf38d('0x1e')]=function(_0x3f48f7){return request(_0xf38d('0x1f'),{'options':{'where':{'phone':_0x3f48f7[_0xf38d('0x20')]},'attributes':['id']}});};exports[_0xf38d('0x21')]=function(_0x1a0b37){return request(_0xf38d('0x22'),{'options':{'where':{'id':_0x1a0b37},'attributes':[_0xf38d('0xd')]}});};exports['getSoundById']=function(_0x5ba90){return request(_0xf38d('0x23'),{'options':{'where':{'id':_0x5ba90},'attributes':[_0xf38d('0x24')]}});};exports[_0xf38d('0x25')]=function(_0xb886b8){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0xb886b8},'include':[{'model':'Interval','as':_0xf38d('0x26')}]}});};exports['getSmsAccountById']=function(_0x1269e5){return request(_0xf38d('0x27'),{'options':{'where':{'id':_0x1269e5},'attributes':['id',_0xf38d('0xd')]}});};exports[_0xf38d('0x28')]=function(_0x1b6fab){return request(_0xf38d('0x29'),{'body':_0x1b6fab});};exports[_0xf38d('0x2a')]=function(_0x470d1b){return request(_0xf38d('0x2b'),{'body':_0x470d1b});};exports['createSquareReport']=function(_0x5bf349){return request(_0xf38d('0x2c'),{'body':_[_0xf38d('0x2d')](_0x5bf349,{'project_name':_0x5bf349[_0xf38d('0x2e')],'prev_project_name':_0x5bf349[_0xf38d('0x2f')]||'','is_subproject':_0x5bf349[_0xf38d('0x2f')]?!![]:![],'leaveAt':moment()[_0xf38d('0x30')](_0xf38d('0x31'))})});};exports[_0xf38d('0x32')]=function(_0x220cbf){return request('CreateSquareRecording',{'body':_0x220cbf});};exports[_0xf38d('0x33')]=function(_0x2eb126){return request(_0xf38d('0x34'),{'body':_0x2eb126});};exports['createCmContact']=function(_0x32c032){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x32c032[_0xf38d('0x20')],'ListId':_0x32c032[_0xf38d('0x35')]}}})[_0xf38d('0x6')](function(_0x81e997){if(_0x81e997){return _0x81e997;}return request('CreateCmContact',{'body':_0x32c032});});};exports[_0xf38d('0x36')]=function(_0x456342){return request(_0xf38d('0x37'),{'options':{'where':{'id':_0x456342},'attributes':[_0xf38d('0xd')]}});};exports[_0xf38d('0x38')]=function(_0x42167d,_0xe14e68){return request(_0xf38d('0x39'),{'body':{'interface':_0xe14e68},'options':{'where':_0x42167d}});};exports[_0xf38d('0x3a')]=function(_0x3447d1,_0x1f0a21,_0x34fa07){return request(_0xf38d('0x3b'),{'body':{'type':_0x1f0a21,'uniqueid':_0x34fa07},'options':{'where':_0x3447d1}});};exports[_0xf38d('0x3c')]=function(_0x558d58){return request(_0xf38d('0x3d'),{'body':{},'options':{'where':_0x558d58}});};exports['agentLogout']=function(_0x348448){return request(_0xf38d('0x3e'),{'body':{},'options':{'where':_0x348448}});}; \ 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 1775df7..073edd6 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 _0x7f05=['exports','./polly','./lex'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7f05,0xdc));var _0x57f0=function(_0xda652b,_0x5120db){_0xda652b=_0xda652b-0x0;var _0x25e81d=_0x7f05[_0xda652b];return _0x25e81d;};var polly=require(_0x57f0('0x0'));var lex=require(_0x57f0('0x1'));module[_0x57f0('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x5a9e=['exports','./lex'];(function(_0x2a563c,_0x30138e){var _0x3bcc5a=function(_0x372ba9){while(--_0x372ba9){_0x2a563c['push'](_0x2a563c['shift']());}};_0x3bcc5a(++_0x30138e);}(_0x5a9e,0xbd));var _0xe5a9=function(_0x838813,_0x448f0f){_0x838813=_0x838813-0x0;var _0x2bd32d=_0x5a9e[_0x838813];return _0x2bd32d;};var polly=require('./polly');var lex=require(_0xe5a9('0x0'));module[_0xe5a9('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 6c6d4a1..963a994 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. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x352a8d,_0x2a91b2,_0x4611be,_0x20aa4b,_0x447096,_0x192d48){return lex(_0x352a8d,_0x2a91b2,_0x4611be,_0x20aa4b,_0x447096,_0x192d48);}; \ No newline at end of file +var _0x6f0d=['exports'];(function(_0x325cc0,_0x46d7d6){var _0x4c118d=function(_0x26cd62){while(--_0x26cd62){_0x325cc0['push'](_0x325cc0['shift']());}};_0x4c118d(++_0x46d7d6);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x99f105,_0x193ee6){_0x99f105=_0x99f105-0x0;var _0x212b05=_0x6f0d[_0x99f105];return _0x212b05;};'use strict';var lex=require('./lib/api');module[_0xd6f0('0x0')]=function(_0x64ebf2,_0xd1480,_0x107a8c,_0x573473,_0x275230,_0x135a93){return lex(_0x64ebf2,_0xd1480,_0x107a8c,_0x573473,_0x275230,_0x135a93);}; \ 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 8edca1b..11d3a64 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(_0x112c2d,_0x24875f){var _0x365bcb=function(_0x518625){while(--_0x518625){_0x112c2d['push'](_0x112c2d['shift']());}};_0x365bcb(++_0x24875f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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(_0x1a71ef,_0x3e5ebb){var _0xdf20b3=function(_0x2cdcbc){while(--_0x2cdcbc){_0x1a71ef['push'](_0x1a71ef['shift']());}};_0xdf20b3(++_0x3e5ebb);}(_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 diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index 4e783fe..554ad36 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 _0xf665=['./lib/api'];(function(_0x5a6fd6,_0x586859){var _0x29023e=function(_0x17dc70){while(--_0x17dc70){_0x5a6fd6['push'](_0x5a6fd6['shift']());}};_0x29023e(++_0x586859);}(_0xf665,0x103));var _0x5f66=function(_0x2d1f6e,_0x13fdc7){_0x2d1f6e=_0x2d1f6e-0x0;var _0x421074=_0xf665[_0x2d1f6e];return _0x421074;};'use strict';var polly=require(_0x5f66('0x0'));module['exports']=function(_0x3c1c14,_0x455693,_0x2ebb27,_0x216ec1,_0x140108,_0x25db75,_0x51e96e){return polly(_0x3c1c14,_0x455693,_0x2ebb27,_0x216ec1,_0x140108,_0x25db75,_0x51e96e);}; \ No newline at end of file +'use strict';var polly=require('./lib/api');module['exports']=function(_0x3faca2,_0x51f5ca,_0x49a2f8,_0x460803,_0x2794dd,_0x3a283d,_0x8986b5){return polly(_0x3faca2,_0x51f5ca,_0x49a2f8,_0x460803,_0x2794dd,_0x3a283d,_0x8986b5);}; \ 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 d38a160..1f924f7 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 _0x4477=['Polly','mp3','path','bluebird','randomstring','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x5998e1,_0x54da5f){var _0x29889d=function(_0x5f328a){while(--_0x5f328a){_0x5998e1['push'](_0x5998e1['shift']());}};_0x29889d(++_0x54da5f);}(_0x4477,0x160));var _0x7447=function(_0x5cbf33,_0x454e1f){_0x5cbf33=_0x5cbf33-0x0;var _0x286643=_0x4477[_0x5cbf33];return _0x286643;};'use strict';var fs=require('fs');var path=require(_0x7447('0x0'));var BPromise=require(_0x7447('0x1'));var rs=require(_0x7447('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x324d84,_0x2ac1e5,_0x2cf03b){return new BPromise(function(_0x7da2ba,_0x487ebc){_0x324d84['synthesizeSpeech'](_0x2ac1e5,function(_0x3763e3,_0x2fcb18){if(_0x3763e3){_0x487ebc(_0x3763e3);}else if(_0x2fcb18){if(_0x2fcb18['AudioStream']instanceof Buffer){fs[_0x7447('0x3')](_0x2cf03b,_0x2fcb18[_0x7447('0x4')],function(_0x246022){if(_0x246022){_0x487ebc(_0x246022);}else{_0x7da2ba();}});}else{_0x487ebc(new Error(_0x7447('0x5')));}}else{_0x487ebc(new Error(_0x7447('0x6')));}});});}module[_0x7447('0x7')]=function(_0x14ef2b,_0x376839,_0x2f08f2,_0x4649b5,_0x4e1d6b,_0xd781d7,_0x5d4c8c){var _0x36b523=new AWS[(_0x7447('0x8'))]({'accessKeyId':_0x14ef2b,'secretAccessKey':_0x376839,'region':_0x2f08f2});var _0x512e08={'Text':_0x4e1d6b,'TextType':_0xd781d7||'text','OutputFormat':_0x7447('0x9'),'VoiceId':_0x4649b5};return pollyResult(_0x36b523,_0x512e08,_0x5d4c8c);}; \ No newline at end of file +var _0xf500=['randomstring','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','path','bluebird'];(function(_0x1bc42d,_0x1b8a92){var _0x2a4351=function(_0x247ad2){while(--_0x247ad2){_0x1bc42d['push'](_0x1bc42d['shift']());}};_0x2a4351(++_0x1b8a92);}(_0xf500,0x1ac));var _0x0f50=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0xf500[_0x1c34e7];return _0x378cb1;};'use strict';var fs=require('fs');var path=require(_0x0f50('0x0'));var BPromise=require(_0x0f50('0x1'));var rs=require(_0x0f50('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x369e18,_0x1dbccd,_0x5485c0){return new BPromise(function(_0x176c1f,_0x46c1e4){_0x369e18[_0x0f50('0x3')](_0x1dbccd,function(_0x2f229f,_0x471b90){if(_0x2f229f){_0x46c1e4(_0x2f229f);}else if(_0x471b90){if(_0x471b90[_0x0f50('0x4')]instanceof Buffer){fs['writeFile'](_0x5485c0,_0x471b90[_0x0f50('0x4')],function(_0x40895d){if(_0x40895d){_0x46c1e4(_0x40895d);}else{_0x176c1f();}});}else{_0x46c1e4(new Error(_0x0f50('0x5')));}}else{_0x46c1e4(new Error(_0x0f50('0x6')));}});});}module[_0x0f50('0x7')]=function(_0x3ca701,_0x3610f4,_0x5667ef,_0x2fdb62,_0x6d4730,_0x2d2a2c,_0x39049c){var _0x27c28a=new AWS['Polly']({'accessKeyId':_0x3ca701,'secretAccessKey':_0x3610f4,'region':_0x5667ef});var _0x645bf9={'Text':_0x6d4730,'TextType':_0x2d2a2c||_0x0f50('0x8'),'OutputFormat':_0x0f50('0x9'),'VoiceId':_0x2fdb62};return pollyResult(_0x27c28a,_0x645bf9,_0x39049c);}; \ 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 b33abc3..a36db3a 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 _0xa9f1=['exports'];(function(_0x199e89,_0x123640){var _0x184e7d=function(_0x254a3a){while(--_0x254a3a){_0x199e89['push'](_0x199e89['shift']());}};_0x184e7d(++_0x123640);}(_0xa9f1,0x9d));var _0x1a9f=function(_0x6d89ae,_0x3cce87){_0x6d89ae=_0x6d89ae-0x0;var _0x5c4471=_0xa9f1[_0x6d89ae];return _0x5c4471;};'use strict';var asr=require('./lib/api');module[_0x1a9f('0x0')]=function(_0x2ef60d,_0x266fdb,_0x3772c7,_0x4689e0){return asr(_0x2ef60d,_0x266fdb,_0x3772c7);}; \ No newline at end of file +var _0xa272=['./lib/api'];(function(_0x14bac2,_0x1c4319){var _0x66bf30=function(_0x4ded97){while(--_0x4ded97){_0x14bac2['push'](_0x14bac2['shift']());}};_0x66bf30(++_0x1c4319);}(_0xa272,0xde));var _0x2a27=function(_0x5b85bc,_0x26c6ad){_0x5b85bc=_0x5b85bc-0x0;var _0x2ec50b=_0xa272[_0x5b85bc];return _0x2ec50b;};'use strict';var asr=require(_0x2a27('0x0'));module['exports']=function(_0x2ecaab,_0x765641,_0x3006a2,_0x48e973){return asr(_0x2ecaab,_0x765641,_0x3006a2);}; \ 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 4ccb6cb..cb3fbf3 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 _0x07c3=['bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','url'];(function(_0x1a021b,_0xf4ee94){var _0x1a34a3=function(_0x6343bc){while(--_0x6343bc){_0x1a021b['push'](_0x1a021b['shift']());}};_0x1a34a3(++_0xf4ee94);}(_0x07c3,0x1bf));var _0x307c=function(_0x31cb77,_0x348021){_0x31cb77=_0x31cb77-0x0;var _0x710374=_0x07c3[_0x31cb77];return _0x710374;};'use strict';var url=require(_0x307c('0x0'));var BPromise=require(_0x307c('0x1'));var fs=require('fs');var host=_0x307c('0x2');module[_0x307c('0x3')]=function(_0x39fd38,_0x8b0b1c,_0x3b8f6e){return new BPromise(function(_0x186b09,_0x52cf54){var _0x37adf4;if(typeof _0x39fd38!==_0x307c('0x4')||_0x39fd38[_0x307c('0x5')]===0x0){return _0x52cf54(_0x307c('0x6'));}if(typeof _0x8b0b1c!==_0x307c('0x4')||_0x8b0b1c[_0x307c('0x5')]===0x0){return _0x52cf54(_0x307c('0x7'));}if(typeof _0x3b8f6e!==_0x307c('0x8')&&(typeof _0x3b8f6e!==_0x307c('0x4')||_0x3b8f6e[_0x307c('0x5')]===0x0)){return _0x52cf54(_0x307c('0x9'));}try{_0x37adf4=fs[_0x307c('0xa')](_0x39fd38)[_0x307c('0xb')](_0x307c('0xc'));}catch(_0x3c4a4c){return _0x52cf54(_0x3c4a4c);}return _0x186b09({'method':'POST','uri':host+_0x307c('0xd')+_0x8b0b1c,'body':{'config':{'encoding':_0x307c('0xe'),'sampleRateHertz':_0x307c('0xf'),'languageCode':_0x3b8f6e},'audio':{'content':_0x37adf4}},'json':!![]});});}; \ No newline at end of file +var _0x515d=['undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','8000','bluebird','https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x515d,0x104));var _0xd515=function(_0x532c9f,_0x13027f){_0x532c9f=_0x532c9f-0x0;var _0x10a8d4=_0x515d[_0x532c9f];return _0x10a8d4;};'use strict';var url=require('url');var BPromise=require(_0xd515('0x0'));var fs=require('fs');var host=_0xd515('0x1');module[_0xd515('0x2')]=function(_0x2241af,_0x153f6a,_0x4240ce){return new BPromise(function(_0x23aa98,_0x442530){var _0x51e08b;if(typeof _0x2241af!==_0xd515('0x3')||_0x2241af['length']===0x0){return _0x442530('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x153f6a!==_0xd515('0x3')||_0x153f6a[_0xd515('0x4')]===0x0){return _0x442530(_0xd515('0x5'));}if(typeof _0x4240ce!==_0xd515('0x6')&&(typeof _0x4240ce!==_0xd515('0x3')||_0x4240ce['length']===0x0)){return _0x442530(_0xd515('0x7'));}try{_0x51e08b=fs[_0xd515('0x8')](_0x2241af)[_0xd515('0x9')](_0xd515('0xa'));}catch(_0x21d6ce){return _0x442530(_0x21d6ce);}return _0x23aa98({'method':_0xd515('0xb'),'uri':host+'/v1/speech:recognize?key='+_0x153f6a,'body':{'config':{'encoding':_0xd515('0xc'),'sampleRateHertz':_0xd515('0xd'),'languageCode':_0x4240ce},'audio':{'content':_0x51e08b}},'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 bd65ce8..5160eb0 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 _0xdb72=['exports','./asr'];(function(_0x335bc7,_0x2feb4e){var _0x2a3fb1=function(_0x376029){while(--_0x376029){_0x335bc7['push'](_0x335bc7['shift']());}};_0x2a3fb1(++_0x2feb4e);}(_0xdb72,0xb5));var _0x2db7=function(_0x567bcb,_0x4978c1){_0x567bcb=_0x567bcb-0x0;var _0x4eebc2=_0xdb72[_0x567bcb];return _0x4eebc2;};var asr=require(_0x2db7('0x0'));module[_0x2db7('0x1')]={'asr':asr}; \ No newline at end of file +var _0x806a=['./asr','exports'];(function(_0x34da22,_0x427b95){var _0x1d5801=function(_0x2e4258){while(--_0x2e4258){_0x34da22['push'](_0x34da22['shift']());}};_0x1d5801(++_0x427b95);}(_0x806a,0xc6));var _0xa806=function(_0x3a7616,_0x176c5d){_0x3a7616=_0x3a7616-0x0;var _0x33ffe2=_0x806a[_0x3a7616];return _0x33ffe2;};var asr=require(_0xa806('0x0'));module[_0xa806('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 733c3a9..17bb31d 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 _0xdf85=['md5','path','querystring','request-promise','randomstring','google-tts-api','parse','./aws','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','close','unlink','download\x20error','pipe','end','https:','get','request\x20to\x20','data','transcode','wav','finish\x20to\x20convert','resolve','tmp','generate','writeFileSync','base64','then','chmodSync','777','split','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','from','audioContent','writeFile','.wav','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','score','status','code','metadata','isFallbackIntent','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','name','isFallback','languageCode','queryText','responseId','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','model=%s','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','http'];(function(_0x38a040,_0x1cb9c3){var _0x50e92f=function(_0x3e0482){while(--_0x3e0482){_0x38a040['push'](_0x38a040['shift']());}};_0x50e92f(++_0x1cb9c3);}(_0xdf85,0x115));var _0x5df8=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xdf85[_0x46698a];return _0x356db0;};'use strict';var apiai=require(_0x5df8('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x5df8('0x1'));var fs=require('fs');var http=require(_0x5df8('0x2'));var https=require('https');var md5=require(_0x5df8('0x3'));var path=require(_0x5df8('0x4'));var querystring=require(_0x5df8('0x5'));var rp=require(_0x5df8('0x6'));var rs=require(_0x5df8('0x7'));var sox=require('sox');var tts=require(_0x5df8('0x8'));var urlParse=require('url')[_0x5df8('0x9')];var util=require('util');var aws=require(_0x5df8('0xa'));var google=require(_0x5df8('0xb'));var sestek=require(_0x5df8('0xc'));var tilde=require(_0x5df8('0xd'));var logger=require('../../../config/logger')(_0x5df8('0xe'));var ISPEECH_API=_0x5df8('0xf');function downloadFile(_0x3c93a2,_0x53f6ae){return new BPromise(function(_0x5c83d6,_0x3481c6){var _0x2523fb=urlParse(_0x3c93a2);var _0x22ef2a=_0x2523fb[_0x5df8('0x10')]==='https:'?https:http;var _0x58ead3={'host':_0x2523fb[_0x5df8('0x11')],'path':_0x2523fb[_0x5df8('0x4')],'headers':{'user-agent':_0x5df8('0x12')}};_0x22ef2a['get'](_0x58ead3,function(_0x426b21){if(_0x426b21[_0x5df8('0x13')]!==0xc8){logger[_0x5df8('0x14')]('request\x20to\x20'+_0x3c93a2+_0x5df8('0x15')+_0x426b21[_0x5df8('0x13')]+'\x20('+_0x426b21['statusMessage']+')');_0x3481c6(new Error('request\x20to\x20'+_0x3c93a2+'\x20failed,\x20status\x20code\x20=\x20'+_0x426b21[_0x5df8('0x13')]+'\x20('+_0x426b21[_0x5df8('0x16')]+')'));return;}var _0x4b2423=fs[_0x5df8('0x17')](_0x53f6ae);_0x4b2423['on'](_0x5df8('0x18'),function(){logger[_0x5df8('0x19')]('finish\x20download\x20file');_0x4b2423[_0x5df8('0x1a')](_0x5c83d6);});_0x4b2423['on'](_0x5df8('0x14'),function(_0x324b53){fs[_0x5df8('0x1b')](_0x53f6ae);logger[_0x5df8('0x14')](_0x5df8('0x1c'),_0x324b53);_0x3481c6(_0x324b53);});_0x426b21[_0x5df8('0x1d')](_0x4b2423);})['on'](_0x5df8('0x14'),function(_0x871b51){logger[_0x5df8('0x14')](_0x871b51);_0x3481c6(_0x871b51);})[_0x5df8('0x1e')]();});}function uploadFile(_0x3ec6d2){return new BPromise(function(_0x33d586,_0x590cd2){var _0x15cefd=urlParse(_0x3ec6d2);var _0x3ceb20=_0x15cefd[_0x5df8('0x10')]===_0x5df8('0x1f')?https:http;var _0x273866={'host':_0x15cefd[_0x5df8('0x11')],'path':_0x15cefd[_0x5df8('0x4')],'headers':{'user-agent':_0x5df8('0x12')}};_0x3ceb20[_0x5df8('0x20')](_0x273866,function(_0x3812c2){if(_0x3812c2[_0x5df8('0x13')]!==0xc8){_0x590cd2(new Error(_0x5df8('0x21')+_0x3ec6d2+_0x5df8('0x15')+_0x3812c2['statusCode']+'\x20('+_0x3812c2[_0x5df8('0x16')]+')'));return;}var _0x9cd30e='';_0x3812c2['on'](_0x5df8('0x22'),function(_0x233bef){_0x9cd30e+=_0x233bef;});_0x3812c2['on'](_0x5df8('0x1e'),function(){_0x33d586(_0x9cd30e);});})['on'](_0x5df8('0x14'),function(_0xff402){_0x590cd2(_0xff402);})[_0x5df8('0x1e')]();});}function convertFile(_0x3916df,_0x33719c){return new BPromise(function(_0x53be0e,_0x2450c2){var _0x4b3e92=sox[_0x5df8('0x23')](_0x3916df,_0x33719c,{'sampleRate':0x1f40,'format':_0x5df8('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4b3e92['on'](_0x5df8('0x14'),function(_0x20368b){logger[_0x5df8('0x14')]('error\x20convert',_0x20368b);_0x2450c2(_0x20368b);});_0x4b3e92['on'](_0x5df8('0x1e'),function(){logger[_0x5df8('0x19')](_0x5df8('0x25'));_0x53be0e();});_0x4b3e92['start']();});}function base64Decode(_0x1f0683,_0x5917f0){var _0x1019fd=path[_0x5df8('0x26')](__dirname,_0x5df8('0x27'),rs[_0x5df8('0x28')](0x4)+'.wav');fs[_0x5df8('0x29')](_0x1019fd,_0x1f0683,_0x5df8('0x2a'));return convertFile(_0x1019fd,_0x5917f0)[_0x5df8('0x2b')](function(){try{fs[_0x5df8('0x1b')](_0x1019fd);fs[_0x5df8('0x2c')](_0x5917f0,_0x5df8('0x2d'));}catch(_0xdad069){logger[_0x5df8('0x14')](_0xdad069);}return _0x5917f0[_0x5df8('0x2e')]('.')[0x0];});}function base64Encode(_0x455c3d){var _0x1dd3fc=fs['readFileSync'](_0x455c3d);return new Buffer(_0x1dd3fc)[_0x5df8('0x2f')](_0x5df8('0x2a'));}exports['googleCloudTTS']=function(_0x53243b,_0x34917c,_0x21c23d,_0x28a4a1,_0x217dd3,_0x151b95){var _0x571c16,_0xd01149;var _0x51ad98=_0x5df8('0x30');var _0x11b808=_0x5df8('0x31')+_0x53243b;var _0x22004d={};if(_0x34917c===_0x5df8('0x32')){_0x22004d['input']={'ssml':_0x21c23d};}else{_0x22004d[_0x5df8('0x33')]={'text':_0x21c23d};};_0x22004d[_0x5df8('0x34')]={'languageCode':_0x28a4a1,'ssmlGender':_0x217dd3};_0x22004d[_0x5df8('0x35')]={'audioEncoding':_0x5df8('0x36'),'sampleRateHertz':0x1f40};var _0x438783={'url':_0x51ad98+_0x5df8('0x37')+_0x11b808,'method':_0x5df8('0x38'),'json':!![],'body':_0x22004d};return rp(_0x438783)[_0x5df8('0x2b')](function(_0x2c6e82){return new BPromise(function(_0x4c73ae,_0x48e431){_0x571c16=path[_0x5df8('0x26')](__dirname,'tmp',rs['generate'](0x4)+'.mp3');var _0x4be4c1=Buffer[_0x5df8('0x39')](_0x2c6e82[_0x5df8('0x3a')],_0x5df8('0x2a'));return fs[_0x5df8('0x3b')](_0x571c16,_0x4be4c1,function(_0x5601a1){_0x48e431(_0x5601a1);},function(_0x2b12d1){fs[_0x5df8('0x2c')](_0x571c16,_0x5df8('0x2d'));_0x4c73ae(_0x2b12d1);});});})[_0x5df8('0x2b')](function(_0x56ef97){_0xd01149=path['resolve'](__dirname,'tmp',rs[_0x5df8('0x28')](0x4)+_0x5df8('0x3c'));return convertFile(_0x571c16,_0xd01149);})['then'](function(){try{fs['unlink'](_0x571c16);fs[_0x5df8('0x2c')](_0xd01149,'777');}catch(_0x203755){logger[_0x5df8('0x14')](_0x203755);}logger[_0x5df8('0x19')](_0x5df8('0x3d'),_0xd01149['split']('.')[0x0]);return _0xd01149[_0x5df8('0x2e')]('.')[0x0];});};exports[_0x5df8('0x3e')]=function(_0x74f14d,_0x1e3701){var _0x2a40b9=_0x5df8('0x3f');var _0x585e89,_0x2cb5fa;var _0x2decc2;var _0x6eec6c={'encoding':_0x5df8('0x40'),'method':_0x5df8('0x38'),'timeout':0x2710,'url':_0x2a40b9,'headers':{'Content-Type':_0x5df8('0x41')},'body':_0x5df8('0x42')+encodeURIComponent(JSON['stringify']([[[_0x5df8('0x43'),JSON[_0x5df8('0x44')]([_0x74f14d,_0x1e3701||'en',![],_0x5df8('0x45')]),null,_0x5df8('0x46')]]]))};return rp(_0x6eec6c)[_0x5df8('0x2b')](function(_0x41be73){try{_0x2decc2=eval(_0x41be73[_0x5df8('0x47')](0x5))[0x0][0x2];}catch(_0x2ef336){throw new Error(_0x5df8('0x48')+_0x41be73[_0x5df8('0x22')]);}if(!_0x2decc2){if(_0x74f14d[_0x5df8('0x49')]>0xc8){throw new Error(_0x5df8('0x4a'));}else{throw new Error(_0x5df8('0x4b')+_0x1e3701+_0x5df8('0x4c'));}}try{_0x2decc2=eval(_0x2decc2)[0x0];}catch(_0x3a4f81){throw new Error(_0x5df8('0x48')+res['data']);}const _0x38b32c=_0x2decc2;_0x585e89=path[_0x5df8('0x26')](__dirname,'tmp',rs[_0x5df8('0x28')](0x4)+_0x5df8('0x4d'));fs[_0x5df8('0x29')](_0x585e89,_0x2decc2,{'encoding':_0x5df8('0x2a')});_0x2cb5fa=path[_0x5df8('0x26')](__dirname,'tmp',rs[_0x5df8('0x28')](0x4)+'.wav');return convertFile(_0x585e89,_0x2cb5fa);})['then'](function(){try{fs[_0x5df8('0x1b')](_0x585e89);fs['chmodSync'](_0x2cb5fa,_0x5df8('0x2d'));}catch(_0x595669){logger[_0x5df8('0x14')](_0x595669);}logger[_0x5df8('0x19')](_0x5df8('0x4e'),_0x2cb5fa[_0x5df8('0x2e')]('.')[0x0]);return _0x2cb5fa[_0x5df8('0x2e')]('.')[0x0];});};exports[_0x5df8('0x4f')]=function(_0x4e292e,_0x71f235,_0x19bdb3){return google['asr'](_0x4e292e,_0x71f235,_0x19bdb3)[_0x5df8('0x2b')](function(_0x505b83){logger[_0x5df8('0x19')](_0x505b83[_0x5df8('0x50')]);return rp(_0x505b83);})[_0x5df8('0x2b')](function(_0x311874){var _0x516275='';var _0x38a6f3=0x0;try{fs[_0x5df8('0x1b')](_0x4e292e);}catch(_0x460963){logger[_0x5df8('0x14')](_0x460963);}if(_0x311874&&_0x311874[_0x5df8('0x51')]){_0x516275=_0x311874[_0x5df8('0x51')][_0x5df8('0x52')](function(_0x279598){return _0x279598&&_0x279598[_0x5df8('0x53')][0x0]&&_0x279598[_0x5df8('0x53')][0x0][_0x5df8('0x54')]?_0x279598['alternatives'][0x0][_0x5df8('0x54')]:'';})[_0x5df8('0x55')]('\x0a');_0x38a6f3=_0x311874[_0x5df8('0x51')][_0x5df8('0x52')](function(_0x22607e){return _0x22607e&&_0x22607e[_0x5df8('0x53')][0x0]&&_0x22607e[_0x5df8('0x53')][0x0][_0x5df8('0x56')]?_0x22607e[_0x5df8('0x53')][0x0][_0x5df8('0x56')]:0x0;})[_0x5df8('0x55')]('\x0a');}logger[_0x5df8('0x19')](_0x5df8('0x57'),_0x516275);logger[_0x5df8('0x19')](_0x5df8('0x58'),_0x38a6f3);return{'transcript':_0x516275,'confidence':_0x38a6f3};})[_0x5df8('0x59')](function(_0x3ccf9e){logger['error'](_0x5df8('0x5a'),_0x3ccf9e[_0x5df8('0x13')],_0x3ccf9e['name'],_0x3ccf9e[_0x5df8('0x5b')]);});};exports[_0x5df8('0x5c')]=function(_0x3f0609,_0xa17cbe,_0x14f6a1,_0x413f6f){var _0x3ae87b=apiai(_0xa17cbe,{'language':_0x413f6f||'en'});return _0x3ae87b[_0x5df8('0x5d')](_0x14f6a1,{'sessionId':md5(_0x3f0609)})['then'](function(_0x1602b7){logger[_0x5df8('0x19')](JSON[_0x5df8('0x44')](_0x1602b7));return{'source':_0x1602b7[_0x5df8('0x5e')][_0x5df8('0x5f')],'resolvedQuery':_0x1602b7[_0x5df8('0x5e')][_0x5df8('0x60')],'action':_0x1602b7[_0x5df8('0x5e')][_0x5df8('0x61')],'actionIncomplete':_0x1602b7[_0x5df8('0x5e')][_0x5df8('0x62')],'speech':_0x1602b7['result']['fulfillment']['speech'],'score':_0x1602b7[_0x5df8('0x5e')][_0x5df8('0x63')],'statusCode':_0x1602b7[_0x5df8('0x64')][_0x5df8('0x65')],'endConversation':_0x1602b7['result'][_0x5df8('0x66')]['endConversation']||![],'isFallbackIntent':_0x1602b7[_0x5df8('0x5e')][_0x5df8('0x66')][_0x5df8('0x67')]};});};exports['googleDialogflowV2']=function(_0x37d023,_0x4cd230,_0x4bb213,_0x532dc5,_0x504d58,_0x2ff235){var _0x58f04e=_0x532dc5['replace'](/\\n/g,'\x0a');var _0x3eaaea={'credentials':{'private_key':_0x58f04e,'client_email':_0x4bb213}};var _0x2cb97a=new dialogflow[(_0x5df8('0x68'))](_0x3eaaea);var _0x1a6e2f=_0x2cb97a[_0x5df8('0x69')](_0x4cd230,md5(_0x37d023));var _0x560517={'session':_0x1a6e2f,'queryInput':{'text':{'text':_0x504d58,'languageCode':_0x2ff235}}};return _0x2cb97a[_0x5df8('0x6a')](_0x560517)[_0x5df8('0x2b')](function(_0x3b63e5){if(_0x3b63e5&&_0x3b63e5[_0x5df8('0x49')]){logger[_0x5df8('0x19')](_0x5df8('0x6b'),JSON[_0x5df8('0x44')](_0x3b63e5));var _0x683ed8=_0x3b63e5[0x0];if(_0x683ed8){var _0x5246cd={'action':_0x683ed8[_0x5df8('0x6c')]['action'],'allRequiredParamsPresent':_0x683ed8[_0x5df8('0x6c')][_0x5df8('0x6d')],'endConversation':_0x683ed8[_0x5df8('0x6c')][_0x5df8('0x6e')]&&_0x683ed8['queryResult'][_0x5df8('0x6e')][_0x5df8('0x6f')]?_0x683ed8[_0x5df8('0x6c')]['diagnosticInfo'][_0x5df8('0x6f')][_0x5df8('0x70')]['boolValue']:![],'fulfillmentText':_0x683ed8[_0x5df8('0x6c')][_0x5df8('0x71')],'intentName':_0x683ed8['queryResult'][_0x5df8('0x72')][_0x5df8('0x73')],'intentDisplayName':_0x683ed8[_0x5df8('0x6c')][_0x5df8('0x72')]['displayName'],'isFallbackIntent':_0x683ed8['queryResult'][_0x5df8('0x72')][_0x5df8('0x74')],'languageCode':_0x683ed8[_0x5df8('0x6c')][_0x5df8('0x75')],'queryText':_0x683ed8['queryResult'][_0x5df8('0x76')],'responseId':_0x683ed8[_0x5df8('0x77')],'score':_0x683ed8[_0x5df8('0x6c')]['intentDetectionConfidence'],'speech':_0x683ed8[_0x5df8('0x6c')][_0x5df8('0x71')],'providerResponse':JSON[_0x5df8('0x44')](_0x3b63e5)};return _0x5246cd;}}});};exports['tildeASR']=function(_0x32f28e,_0x35d01f,_0x57e063,_0x2749bc){return tilde[_0x5df8('0x78')](_0x32f28e,_0x35d01f,_0x57e063,_0x2749bc)[_0x5df8('0x2b')](function(_0x48c10c){try{fs[_0x5df8('0x1b')](_0x32f28e);}catch(_0x3c53a4){logger['error'](_0x3c53a4);}logger[_0x5df8('0x19')](_0x5df8('0x79'),_0x48c10c['transcript']);logger['info'](_0x5df8('0x7a'),_0x48c10c[_0x5df8('0x56')]);return _0x48c10c;});};exports[_0x5df8('0x7b')]=function(_0x89a239,_0x1e41a4,_0x298f1c,_0x34c65f,_0x15f3da,_0xe9c7d2){var _0x23fc92=path[_0x5df8('0x26')](__dirname,_0x5df8('0x27'),rs['generate'](0x4)+_0x5df8('0x4d'));var _0x48c918;return aws[_0x5df8('0x7c')](_0x89a239,_0x1e41a4,_0x298f1c,_0x34c65f,_0x15f3da,_0xe9c7d2,_0x23fc92)[_0x5df8('0x2b')](function(){_0x48c918=path[_0x5df8('0x26')](__dirname,_0x5df8('0x27'),rs[_0x5df8('0x28')](0x4)+_0x5df8('0x3c'));return convertFile(_0x23fc92,_0x48c918);})[_0x5df8('0x2b')](function(){try{fs[_0x5df8('0x1b')](_0x23fc92);fs[_0x5df8('0x2c')](_0x48c918,_0x5df8('0x2d'));}catch(_0x7a9509){logger['error'](_0x7a9509);}return _0x48c918[_0x5df8('0x2e')]('.')[0x0];});};exports[_0x5df8('0x7d')]=function(_0x32970e,_0x56fd8,_0x21c4c6,_0x10db9a,_0x2e15dc,_0x495cb9){return aws[_0x5df8('0x7e')](_0x32970e,_0x56fd8,_0x21c4c6,_0x10db9a,_0x2e15dc,_0x495cb9)['then'](function(_0x27d035){logger[_0x5df8('0x19')](JSON[_0x5df8('0x44')](_0x27d035));return _0x27d035;});};exports['ispeechTTS']=function(_0x51a0cd,_0x34265e,_0x1b496e,_0x475926){var _0x1284dd=util[_0x5df8('0x7f')](_0x5df8('0x80'),ISPEECH_API,_0x51a0cd,encodeURIComponent(_0x34265e),_0x1b496e,_0x475926);var _0x5136d0=path['resolve'](__dirname,_0x5df8('0x27'),rs['generate'](0x4)+_0x5df8('0x4d'));var _0x465024;return downloadFile(_0x1284dd,_0x5136d0)['then'](function(){_0x465024=path[_0x5df8('0x26')](__dirname,_0x5df8('0x27'),rs[_0x5df8('0x28')](0x4)+_0x5df8('0x3c'));return convertFile(_0x5136d0,_0x465024);})[_0x5df8('0x2b')](function(){try{fs[_0x5df8('0x1b')](_0x5136d0);fs[_0x5df8('0x2c')](_0x465024,'777');}catch(_0x23e8e8){logger[_0x5df8('0x14')](_0x23e8e8);}return _0x465024['split']('.')[0x0];});};exports['ispeechASR']=function(_0x2de346,_0x28a15b,_0x4dae71,_0x7db6d1){var _0xf85a24=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x28a15b,_0x4dae71,base64Encode(_0x2de346),_0x7db6d1?util[_0x5df8('0x7f')](_0x5df8('0x81'),encodeURIComponent(_0x7db6d1)):'freeform=3');return uploadFile(_0xf85a24)[_0x5df8('0x2b')](function(_0x257ed6){return querystring[_0x5df8('0x9')](_0x257ed6);});};exports[_0x5df8('0x82')]=function(_0x3fd524,_0x1579ab){return sestek[_0x5df8('0x83')](_0x3fd524,_0x1579ab)[_0x5df8('0x2b')](function(_0x20923d){logger[_0x5df8('0x19')](JSON['stringify'](_0x20923d));var _0x296e00={'speech':_0x20923d[_0x5df8('0x84')],'action':_0x20923d['channelData']?_0x20923d[_0x5df8('0x85')][_0x5df8('0x86')]:undefined,'actiondata':_0x20923d['channelData']?_0x20923d[_0x5df8('0x85')][_0x5df8('0x87')]:undefined};if(_0x20923d['channelData']&&_0x20923d[_0x5df8('0x85')][_0x5df8('0x88')]){return base64Decode(_0x20923d[_0x5df8('0x85')][_0x5df8('0x88')][_0x5df8('0x89')],path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x5df8('0x3c')))[_0x5df8('0x2b')](function(_0x39dd75){_0x296e00[_0x5df8('0x8a')]=_0x39dd75;return _0x296e00;});}return _0x296e00;});};exports[_0x5df8('0x8b')]=function(){return __dirname;}; \ No newline at end of file +var _0xfdf1=['from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','allRequiredParamsPresent','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','queryText','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','bluebird','http','https','path','querystring','request-promise','randomstring','sox','google-tts-api','url','./aws','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','https:','host','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','unlink','download\x20error','pipe','end','protocol','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','then','chmodSync','777','split','readFileSync','base64','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3'];(function(_0x455eed,_0x822290){var _0x31cb46=function(_0x54e871){while(--_0x54e871){_0x455eed['push'](_0x455eed['shift']());}};_0x31cb46(++_0x822290);}(_0xfdf1,0x159));var _0x1fdf=function(_0x26e540,_0x1e120d){_0x26e540=_0x26e540-0x0;var _0x23486a=_0xfdf1[_0x26e540];return _0x23486a;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x1fdf('0x0'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x1fdf('0x1'));var https=require(_0x1fdf('0x2'));var md5=require('md5');var path=require(_0x1fdf('0x3'));var querystring=require(_0x1fdf('0x4'));var rp=require(_0x1fdf('0x5'));var rs=require(_0x1fdf('0x6'));var sox=require(_0x1fdf('0x7'));var tts=require(_0x1fdf('0x8'));var urlParse=require(_0x1fdf('0x9'))['parse'];var util=require('util');var aws=require(_0x1fdf('0xa'));var google=require('./google');var sestek=require(_0x1fdf('0xb'));var tilde=require(_0x1fdf('0xc'));var logger=require(_0x1fdf('0xd'))('agi');var ISPEECH_API=_0x1fdf('0xe');function downloadFile(_0x447916,_0x1ee99d){return new BPromise(function(_0xb596b9,_0x42be87){var _0x390ecf=urlParse(_0x447916);var _0x16496b=_0x390ecf['protocol']===_0x1fdf('0xf')?https:http;var _0x1fe681={'host':_0x390ecf[_0x1fdf('0x10')],'path':_0x390ecf[_0x1fdf('0x3')],'headers':{'user-agent':_0x1fdf('0x11')}};_0x16496b['get'](_0x1fe681,function(_0x93fc76){if(_0x93fc76[_0x1fdf('0x12')]!==0xc8){logger[_0x1fdf('0x13')](_0x1fdf('0x14')+_0x447916+_0x1fdf('0x15')+_0x93fc76['statusCode']+'\x20('+_0x93fc76['statusMessage']+')');_0x42be87(new Error(_0x1fdf('0x14')+_0x447916+_0x1fdf('0x15')+_0x93fc76['statusCode']+'\x20('+_0x93fc76[_0x1fdf('0x16')]+')'));return;}var _0x532091=fs[_0x1fdf('0x17')](_0x1ee99d);_0x532091['on']('finish',function(){logger[_0x1fdf('0x18')]('finish\x20download\x20file');_0x532091['close'](_0xb596b9);});_0x532091['on'](_0x1fdf('0x13'),function(_0x478c83){fs[_0x1fdf('0x19')](_0x1ee99d);logger[_0x1fdf('0x13')](_0x1fdf('0x1a'),_0x478c83);_0x42be87(_0x478c83);});_0x93fc76[_0x1fdf('0x1b')](_0x532091);})['on'](_0x1fdf('0x13'),function(_0x185427){logger[_0x1fdf('0x13')](_0x185427);_0x42be87(_0x185427);})[_0x1fdf('0x1c')]();});}function uploadFile(_0x5a6214){return new BPromise(function(_0x5a5b74,_0x1bcc12){var _0x3a78a7=urlParse(_0x5a6214);var _0x1103ce=_0x3a78a7[_0x1fdf('0x1d')]===_0x1fdf('0xf')?https:http;var _0x2abc12={'host':_0x3a78a7['host'],'path':_0x3a78a7[_0x1fdf('0x3')],'headers':{'user-agent':_0x1fdf('0x11')}};_0x1103ce['get'](_0x2abc12,function(_0x3cbbb9){if(_0x3cbbb9[_0x1fdf('0x12')]!==0xc8){_0x1bcc12(new Error(_0x1fdf('0x14')+_0x5a6214+_0x1fdf('0x15')+_0x3cbbb9['statusCode']+'\x20('+_0x3cbbb9[_0x1fdf('0x16')]+')'));return;}var _0x49d4fc='';_0x3cbbb9['on'](_0x1fdf('0x1e'),function(_0x15a198){_0x49d4fc+=_0x15a198;});_0x3cbbb9['on'](_0x1fdf('0x1c'),function(){_0x5a5b74(_0x49d4fc);});})['on'](_0x1fdf('0x13'),function(_0x1ffd99){_0x1bcc12(_0x1ffd99);})[_0x1fdf('0x1c')]();});}function convertFile(_0x289dad,_0x25f960){return new BPromise(function(_0x806ae8,_0x498ff2){var _0x16422b=sox[_0x1fdf('0x1f')](_0x289dad,_0x25f960,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x16422b['on'](_0x1fdf('0x13'),function(_0x2fbbae){logger['error'](_0x1fdf('0x20'),_0x2fbbae);_0x498ff2(_0x2fbbae);});_0x16422b['on'](_0x1fdf('0x1c'),function(){logger[_0x1fdf('0x18')](_0x1fdf('0x21'));_0x806ae8();});_0x16422b[_0x1fdf('0x22')]();});}function base64Decode(_0x450087,_0x166d13){var _0x573a4f=path[_0x1fdf('0x23')](__dirname,_0x1fdf('0x24'),rs[_0x1fdf('0x25')](0x4)+_0x1fdf('0x26'));fs['writeFileSync'](_0x573a4f,_0x450087,'base64');return convertFile(_0x573a4f,_0x166d13)[_0x1fdf('0x27')](function(){try{fs[_0x1fdf('0x19')](_0x573a4f);fs[_0x1fdf('0x28')](_0x166d13,_0x1fdf('0x29'));}catch(_0x35dcf8){logger[_0x1fdf('0x13')](_0x35dcf8);}return _0x166d13[_0x1fdf('0x2a')]('.')[0x0];});}function base64Encode(_0x2217e4){var _0x1e14be=fs[_0x1fdf('0x2b')](_0x2217e4);return new Buffer(_0x1e14be)['toString'](_0x1fdf('0x2c'));}exports['googleCloudTTS']=function(_0xcb522d,_0x2f24b1,_0x10a2b6,_0xc34055,_0x13e1ef,_0x174f76){var _0x409fe0,_0x38f554;var _0x145786='https://texttospeech.googleapis.com/v1/';var _0x1119a1=_0x1fdf('0x2d')+_0xcb522d;var _0x203ac1={};if(_0x2f24b1===_0x1fdf('0x2e')){_0x203ac1[_0x1fdf('0x2f')]={'ssml':_0x10a2b6};}else{_0x203ac1[_0x1fdf('0x2f')]={'text':_0x10a2b6};};_0x203ac1[_0x1fdf('0x30')]={'languageCode':_0xc34055,'ssmlGender':_0x13e1ef};_0x203ac1[_0x1fdf('0x31')]={'audioEncoding':_0x1fdf('0x32'),'sampleRateHertz':0x1f40};var _0x5d5fd8={'url':_0x145786+_0x1fdf('0x33')+_0x1119a1,'method':_0x1fdf('0x34'),'json':!![],'body':_0x203ac1};return rp(_0x5d5fd8)[_0x1fdf('0x27')](function(_0x33ebf5){return new BPromise(function(_0xed97fb,_0x2cd746){_0x409fe0=path['resolve'](__dirname,'tmp',rs[_0x1fdf('0x25')](0x4)+_0x1fdf('0x35'));var _0x1e704e=Buffer[_0x1fdf('0x36')](_0x33ebf5[_0x1fdf('0x37')],_0x1fdf('0x2c'));return fs[_0x1fdf('0x38')](_0x409fe0,_0x1e704e,function(_0x1bc4bb){_0x2cd746(_0x1bc4bb);},function(_0x23254a){fs['chmodSync'](_0x409fe0,_0x1fdf('0x29'));_0xed97fb(_0x23254a);});});})[_0x1fdf('0x27')](function(_0x3b469c){_0x38f554=path[_0x1fdf('0x23')](__dirname,'tmp',rs[_0x1fdf('0x25')](0x4)+_0x1fdf('0x26'));return convertFile(_0x409fe0,_0x38f554);})['then'](function(){try{fs[_0x1fdf('0x19')](_0x409fe0);fs[_0x1fdf('0x28')](_0x38f554,_0x1fdf('0x29'));}catch(_0x492914){logger[_0x1fdf('0x13')](_0x492914);}logger[_0x1fdf('0x18')](_0x1fdf('0x39'),_0x38f554['split']('.')[0x0]);return _0x38f554[_0x1fdf('0x2a')]('.')[0x0];});};exports[_0x1fdf('0x3a')]=function(_0x591d36,_0x87abfe){var _0x1f7bbf=_0x1fdf('0x3b');var _0x3964ff,_0xb765a8;var _0x1be7f5;var _0x561af7={'encoding':_0x1fdf('0x3c'),'method':_0x1fdf('0x34'),'timeout':0x2710,'url':_0x1f7bbf,'headers':{'Content-Type':_0x1fdf('0x3d')},'body':_0x1fdf('0x3e')+encodeURIComponent(JSON[_0x1fdf('0x3f')]([[[_0x1fdf('0x40'),JSON[_0x1fdf('0x3f')]([_0x591d36,_0x87abfe||'en',![],'null']),null,_0x1fdf('0x41')]]]))};return rp(_0x561af7)[_0x1fdf('0x27')](function(_0x5b93f0){try{_0x1be7f5=eval(_0x5b93f0['slice'](0x5))[0x0][0x2];}catch(_0x199352){throw new Error(_0x1fdf('0x42')+_0x5b93f0[_0x1fdf('0x1e')]);}if(!_0x1be7f5){if(_0x591d36[_0x1fdf('0x43')]>0xc8){throw new Error(_0x1fdf('0x44'));}else{throw new Error(_0x1fdf('0x45')+_0x87abfe+_0x1fdf('0x46'));}}try{_0x1be7f5=eval(_0x1be7f5)[0x0];}catch(_0x2d63d6){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x1fdf('0x1e')]);}const _0x5a2434=_0x1be7f5;_0x3964ff=path[_0x1fdf('0x23')](__dirname,_0x1fdf('0x24'),rs[_0x1fdf('0x25')](0x4)+_0x1fdf('0x35'));fs['writeFileSync'](_0x3964ff,_0x1be7f5,{'encoding':_0x1fdf('0x2c')});_0xb765a8=path[_0x1fdf('0x23')](__dirname,_0x1fdf('0x24'),rs[_0x1fdf('0x25')](0x4)+_0x1fdf('0x26'));return convertFile(_0x3964ff,_0xb765a8);})[_0x1fdf('0x27')](function(){try{fs[_0x1fdf('0x19')](_0x3964ff);fs[_0x1fdf('0x28')](_0xb765a8,_0x1fdf('0x29'));}catch(_0x45efb4){logger[_0x1fdf('0x13')](_0x45efb4);}logger[_0x1fdf('0x18')](_0x1fdf('0x47'),_0xb765a8[_0x1fdf('0x2a')]('.')[0x0]);return _0xb765a8[_0x1fdf('0x2a')]('.')[0x0];});};exports[_0x1fdf('0x48')]=function(_0x4124d6,_0x364cb5,_0xa918aa){return google[_0x1fdf('0x49')](_0x4124d6,_0x364cb5,_0xa918aa)[_0x1fdf('0x27')](function(_0x53b99d){logger[_0x1fdf('0x18')](_0x53b99d['uri']);return rp(_0x53b99d);})[_0x1fdf('0x27')](function(_0xf7ecdd){var _0xc7041d='';var _0x48bfb3=0x0;try{fs[_0x1fdf('0x19')](_0x4124d6);}catch(_0x5ca2b1){logger[_0x1fdf('0x13')](_0x5ca2b1);}if(_0xf7ecdd&&_0xf7ecdd[_0x1fdf('0x4a')]){_0xc7041d=_0xf7ecdd['results'][_0x1fdf('0x4b')](function(_0x412b9b){return _0x412b9b&&_0x412b9b[_0x1fdf('0x4c')][0x0]&&_0x412b9b['alternatives'][0x0]['transcript']?_0x412b9b['alternatives'][0x0][_0x1fdf('0x4d')]:'';})[_0x1fdf('0x4e')]('\x0a');_0x48bfb3=_0xf7ecdd[_0x1fdf('0x4a')][_0x1fdf('0x4b')](function(_0x453ad3){return _0x453ad3&&_0x453ad3['alternatives'][0x0]&&_0x453ad3['alternatives'][0x0][_0x1fdf('0x4f')]?_0x453ad3['alternatives'][0x0][_0x1fdf('0x4f')]:0x0;})[_0x1fdf('0x4e')]('\x0a');}logger[_0x1fdf('0x18')](_0x1fdf('0x50'),_0xc7041d);logger[_0x1fdf('0x18')]('googleASR\x20confidence',_0x48bfb3);return{'transcript':_0xc7041d,'confidence':_0x48bfb3};})[_0x1fdf('0x51')](function(_0x46fcff){logger[_0x1fdf('0x13')](_0x1fdf('0x52'),_0x46fcff[_0x1fdf('0x12')],_0x46fcff[_0x1fdf('0x53')],_0x46fcff['message']);});};exports[_0x1fdf('0x54')]=function(_0x16ce50,_0x135eee,_0x150c76,_0x2799ee){var _0x306e9a=apiai(_0x135eee,{'language':_0x2799ee||'en'});return _0x306e9a[_0x1fdf('0x55')](_0x150c76,{'sessionId':md5(_0x16ce50)})[_0x1fdf('0x27')](function(_0x2236f1){logger['info'](JSON[_0x1fdf('0x3f')](_0x2236f1));return{'source':_0x2236f1[_0x1fdf('0x56')][_0x1fdf('0x57')],'resolvedQuery':_0x2236f1[_0x1fdf('0x56')][_0x1fdf('0x58')],'action':_0x2236f1[_0x1fdf('0x56')][_0x1fdf('0x59')],'actionIncomplete':_0x2236f1[_0x1fdf('0x56')][_0x1fdf('0x5a')],'speech':_0x2236f1[_0x1fdf('0x56')][_0x1fdf('0x5b')][_0x1fdf('0x5c')],'score':_0x2236f1['result'][_0x1fdf('0x5d')],'statusCode':_0x2236f1[_0x1fdf('0x5e')][_0x1fdf('0x5f')],'endConversation':_0x2236f1[_0x1fdf('0x56')][_0x1fdf('0x60')]['endConversation']||![],'isFallbackIntent':_0x2236f1['result'][_0x1fdf('0x60')][_0x1fdf('0x61')]};});};exports[_0x1fdf('0x62')]=function(_0x2e140f,_0x3c3577,_0x578788,_0x4b49c5,_0x26b2ee,_0x5b3c63){var _0x28dea5=_0x4b49c5['replace'](/\\n/g,'\x0a');var _0x4ae42e={'credentials':{'private_key':_0x28dea5,'client_email':_0x578788}};var _0x211b3d=new dialogflow[(_0x1fdf('0x63'))](_0x4ae42e);var _0x630dc=_0x211b3d[_0x1fdf('0x64')](_0x3c3577,md5(_0x2e140f));var _0x282ab0={'session':_0x630dc,'queryInput':{'text':{'text':_0x26b2ee,'languageCode':_0x5b3c63}}};return _0x211b3d['detectIntent'](_0x282ab0)[_0x1fdf('0x27')](function(_0x2e5a2c){if(_0x2e5a2c&&_0x2e5a2c[_0x1fdf('0x43')]){logger[_0x1fdf('0x18')](_0x1fdf('0x65'),JSON[_0x1fdf('0x3f')](_0x2e5a2c));var _0x34bde0=_0x2e5a2c[0x0];if(_0x34bde0){var _0x44ae83={'action':_0x34bde0['queryResult']['action'],'allRequiredParamsPresent':_0x34bde0['queryResult'][_0x1fdf('0x66')],'endConversation':_0x34bde0[_0x1fdf('0x67')][_0x1fdf('0x68')]&&_0x34bde0['queryResult'][_0x1fdf('0x68')][_0x1fdf('0x69')]?_0x34bde0[_0x1fdf('0x67')][_0x1fdf('0x68')][_0x1fdf('0x69')][_0x1fdf('0x6a')][_0x1fdf('0x6b')]:![],'fulfillmentText':_0x34bde0['queryResult'][_0x1fdf('0x6c')],'intentName':_0x34bde0[_0x1fdf('0x67')][_0x1fdf('0x6d')]['name'],'intentDisplayName':_0x34bde0['queryResult']['intent']['displayName'],'isFallbackIntent':_0x34bde0[_0x1fdf('0x67')][_0x1fdf('0x6d')][_0x1fdf('0x6e')],'languageCode':_0x34bde0['queryResult']['languageCode'],'queryText':_0x34bde0['queryResult'][_0x1fdf('0x6f')],'responseId':_0x34bde0[_0x1fdf('0x70')],'score':_0x34bde0['queryResult']['intentDetectionConfidence'],'speech':_0x34bde0[_0x1fdf('0x67')]['fulfillmentText'],'providerResponse':JSON[_0x1fdf('0x3f')](_0x2e5a2c)};return _0x44ae83;}}});};exports[_0x1fdf('0x71')]=function(_0x2bddca,_0x4bcaba,_0x1ba1db,_0x5beb96){return tilde[_0x1fdf('0x49')](_0x2bddca,_0x4bcaba,_0x1ba1db,_0x5beb96)[_0x1fdf('0x27')](function(_0x485042){try{fs[_0x1fdf('0x19')](_0x2bddca);}catch(_0xf273a1){logger['error'](_0xf273a1);}logger[_0x1fdf('0x18')](_0x1fdf('0x72'),_0x485042[_0x1fdf('0x4d')]);logger['info'](_0x1fdf('0x73'),_0x485042[_0x1fdf('0x4f')]);return _0x485042;});};exports[_0x1fdf('0x74')]=function(_0x4d81e8,_0x2d46f8,_0x309dc0,_0x1c5f74,_0xec2d19,_0x3f7ed8){var _0x9418de=path['resolve'](__dirname,_0x1fdf('0x24'),rs['generate'](0x4)+_0x1fdf('0x35'));var _0x49787b;return aws[_0x1fdf('0x75')](_0x4d81e8,_0x2d46f8,_0x309dc0,_0x1c5f74,_0xec2d19,_0x3f7ed8,_0x9418de)[_0x1fdf('0x27')](function(){_0x49787b=path[_0x1fdf('0x23')](__dirname,_0x1fdf('0x24'),rs[_0x1fdf('0x25')](0x4)+'.wav');return convertFile(_0x9418de,_0x49787b);})[_0x1fdf('0x27')](function(){try{fs['unlink'](_0x9418de);fs[_0x1fdf('0x28')](_0x49787b,_0x1fdf('0x29'));}catch(_0x293003){logger[_0x1fdf('0x13')](_0x293003);}return _0x49787b['split']('.')[0x0];});};exports[_0x1fdf('0x76')]=function(_0x1dab35,_0x4d6c2c,_0x2d740c,_0x41e4d8,_0x22bb5c,_0x11ff94){return aws[_0x1fdf('0x77')](_0x1dab35,_0x4d6c2c,_0x2d740c,_0x41e4d8,_0x22bb5c,_0x11ff94)[_0x1fdf('0x27')](function(_0x352845){logger['info'](JSON['stringify'](_0x352845));return _0x352845;});};exports['ispeechTTS']=function(_0xc273fe,_0x2c0151,_0x35a896,_0x476edf){var _0x454532=util[_0x1fdf('0x78')](_0x1fdf('0x79'),ISPEECH_API,_0xc273fe,encodeURIComponent(_0x2c0151),_0x35a896,_0x476edf);var _0x1e2c07=path['resolve'](__dirname,_0x1fdf('0x24'),rs[_0x1fdf('0x25')](0x4)+_0x1fdf('0x35'));var _0x1c81e2;return downloadFile(_0x454532,_0x1e2c07)[_0x1fdf('0x27')](function(){_0x1c81e2=path[_0x1fdf('0x23')](__dirname,_0x1fdf('0x24'),rs[_0x1fdf('0x25')](0x4)+_0x1fdf('0x26'));return convertFile(_0x1e2c07,_0x1c81e2);})[_0x1fdf('0x27')](function(){try{fs['unlink'](_0x1e2c07);fs[_0x1fdf('0x28')](_0x1c81e2,'777');}catch(_0x2e2169){logger[_0x1fdf('0x13')](_0x2e2169);}return _0x1c81e2[_0x1fdf('0x2a')]('.')[0x0];});};exports[_0x1fdf('0x7a')]=function(_0x3fd518,_0x26d71d,_0x1e6ced,_0x4dfa19){var _0x223eba=util[_0x1fdf('0x78')](_0x1fdf('0x7b'),ISPEECH_API,_0x26d71d,_0x1e6ced,base64Encode(_0x3fd518),_0x4dfa19?util[_0x1fdf('0x78')]('model=%s',encodeURIComponent(_0x4dfa19)):_0x1fdf('0x7c'));return uploadFile(_0x223eba)[_0x1fdf('0x27')](function(_0x2ebf0b){return querystring['parse'](_0x2ebf0b);});};exports[_0x1fdf('0x7d')]=function(_0x306a1f,_0x8fb78d){return sestek['nda'](_0x306a1f,_0x8fb78d)[_0x1fdf('0x27')](function(_0x42962f){logger[_0x1fdf('0x18')](JSON[_0x1fdf('0x3f')](_0x42962f));var _0x5cd0fb={'speech':_0x42962f[_0x1fdf('0x7e')],'action':_0x42962f[_0x1fdf('0x7f')]?_0x42962f[_0x1fdf('0x7f')][_0x1fdf('0x80')]:undefined,'actiondata':_0x42962f['channelData']?_0x42962f['channelData'][_0x1fdf('0x81')]:undefined};if(_0x42962f['channelData']&&_0x42962f['channelData'][_0x1fdf('0x82')]){return base64Decode(_0x42962f[_0x1fdf('0x7f')][_0x1fdf('0x82')]['Data'],path[_0x1fdf('0x23')](__dirname,'tmp',rs[_0x1fdf('0x25')](0x4)+_0x1fdf('0x26')))['then'](function(_0x58bdc8){_0x5cd0fb[_0x1fdf('0x83')]=_0x58bdc8;return _0x5cd0fb;});}return _0x5cd0fb;});};exports[_0x1fdf('0x84')]=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 513ecdb..3120599 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 _0xe6ce=['./nda'];(function(_0x1ffc1c,_0x271907){var _0xf330b8=function(_0x4bc68e){while(--_0x4bc68e){_0x1ffc1c['push'](_0x1ffc1c['shift']());}};_0xf330b8(++_0x271907);}(_0xe6ce,0x64));var _0xee6c=function(_0x270ac9,_0x43ba27){_0x270ac9=_0x270ac9-0x0;var _0x5627f2=_0xe6ce[_0x270ac9];return _0x5627f2;};var nda=require(_0xee6c('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x8d08=['exports'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x8d08,0x6d));var _0x88d0=function(_0x2e986d,_0x4b6b63){_0x2e986d=_0x2e986d-0x0;var _0x351c79=_0x8d08[_0x2e986d];return _0x351c79;};var nda=require('./nda');module[_0x88d0('0x0')]={'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 b2ad5bb..f0fb4ea 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 _0x38d0=['stringify','url','../../../../../config/logger','agi','resolve','/token','password','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','calleridname','dnid','extension','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','custom_action','CustomActionData','custom_action_data','info'];(function(_0x16ebcd,_0x4eb95c){var _0x5b8fb4=function(_0x444614){while(--_0x444614){_0x16ebcd['push'](_0x16ebcd['shift']());}};_0x5b8fb4(++_0x4eb95c);}(_0x38d0,0x123));var _0x038d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x38d0[_0x321bb2];return _0x9c12ed;};'use strict';var rp=require('request-promise');var url=require(_0x038d('0x0'));var logger=require(_0x038d('0x1'))(_0x038d('0x2'));module['exports']=function(_0xddfa16,_0x27db0a){var _0x5e42a5={'method':'POST','uri':url[_0x038d('0x3')](_0x27db0a['ndauth_url'],_0x038d('0x4')),'form':{'grant_type':_0x038d('0x5'),'username':_0x27db0a['username'],'password':_0x27db0a[_0x038d('0x5')]},'json':!![]};return rp(_0x5e42a5)[_0x038d('0x6')](function(_0x434026){var _0x76bc10={'method':_0x038d('0x7'),'uri':url[_0x038d('0x3')](_0x27db0a[_0x038d('0x8')],_0x038d('0x9')),'body':{'type':_0x27db0a[_0x038d('0xa')]||_0x038d('0xb'),'channelId':_0x038d('0xc'),'conversation':{'id':_0xddfa16[_0x038d('0xd')]},'from':{'id':_0xddfa16['callerid'],'name':_0xddfa16[_0x038d('0xe')]},'recipient':{'id':_0xddfa16[_0x038d('0xf')],'name':_0xddfa16[_0x038d('0x10')]},'text':_0x27db0a['text'],'channelData':{}},'headers':{'Authorization':_0x038d('0x11')+_0x434026[_0x038d('0x12')]},'json':!![]};if(_0x27db0a[_0x038d('0x13')]){_0x76bc10[_0x038d('0x14')][_0x038d('0x15')][_0x038d('0x16')]=_0x27db0a[_0x038d('0x13')];}if(_0x27db0a[_0x038d('0x17')]=='1'){_0x76bc10[_0x038d('0x14')]['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x27db0a[_0x038d('0x18')]){_0x76bc10[_0x038d('0x14')]['channelData']['CustomAction']=_0x27db0a['custom_action'];if(_0x27db0a['custom_action_data']){_0x76bc10[_0x038d('0x14')][_0x038d('0x15')][_0x038d('0x19')]=_0x27db0a[_0x038d('0x1a')];}}logger[_0x038d('0x1b')](JSON[_0x038d('0x1c')](_0x76bc10));return rp(_0x76bc10);});}; \ No newline at end of file +var _0xd84c=['ndaactivity_type','Nda','uniqueid','calleridname','dnid','extension','Bearer\x20','access_token','project','body','ProjectName','ndagenerate_audio','channelData','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','request-promise','url','../../../../../config/logger','agi','exports','POST','ndauth_url','/token','password','username','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run'];(function(_0x38598f,_0x342e17){var _0x33e382=function(_0x172191){while(--_0x172191){_0x38598f['push'](_0x38598f['shift']());}};_0x33e382(++_0x342e17);}(_0xd84c,0x102));var _0xcd84=function(_0x1740d8,_0x1a56a7){_0x1740d8=_0x1740d8-0x0;var _0x5b17b4=_0xd84c[_0x1740d8];return _0x5b17b4;};'use strict';var rp=require(_0xcd84('0x0'));var url=require(_0xcd84('0x1'));var logger=require(_0xcd84('0x2'))(_0xcd84('0x3'));module[_0xcd84('0x4')]=function(_0x3213d7,_0xbdfd34){var _0x1f6250={'method':_0xcd84('0x5'),'uri':url['resolve'](_0xbdfd34[_0xcd84('0x6')],_0xcd84('0x7')),'form':{'grant_type':_0xcd84('0x8'),'username':_0xbdfd34[_0xcd84('0x9')],'password':_0xbdfd34['password']},'json':!![]};return rp(_0x1f6250)[_0xcd84('0xa')](function(_0x22c811){var _0x3f3617={'method':'POST','uri':url[_0xcd84('0xb')](_0xbdfd34[_0xcd84('0xc')],_0xcd84('0xd')),'body':{'type':_0xbdfd34[_0xcd84('0xe')]||'message','channelId':_0xcd84('0xf'),'conversation':{'id':_0x3213d7[_0xcd84('0x10')]},'from':{'id':_0x3213d7['callerid'],'name':_0x3213d7[_0xcd84('0x11')]},'recipient':{'id':_0x3213d7[_0xcd84('0x12')],'name':_0x3213d7[_0xcd84('0x13')]},'text':_0xbdfd34['text'],'channelData':{}},'headers':{'Authorization':_0xcd84('0x14')+_0x22c811[_0xcd84('0x15')]},'json':!![]};if(_0xbdfd34[_0xcd84('0x16')]){_0x3f3617[_0xcd84('0x17')]['channelData'][_0xcd84('0x18')]=_0xbdfd34[_0xcd84('0x16')];}if(_0xbdfd34[_0xcd84('0x19')]=='1'){_0x3f3617[_0xcd84('0x17')][_0xcd84('0x1a')][_0xcd84('0x1b')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xcd84('0x1c')};}if(_0xbdfd34[_0xcd84('0x1d')]){_0x3f3617[_0xcd84('0x17')][_0xcd84('0x1a')][_0xcd84('0x1e')]=_0xbdfd34[_0xcd84('0x1d')];if(_0xbdfd34[_0xcd84('0x1f')]){_0x3f3617[_0xcd84('0x17')][_0xcd84('0x1a')][_0xcd84('0x20')]=_0xbdfd34[_0xcd84('0x1f')];}}logger[_0xcd84('0x21')](JSON['stringify'](_0x3f3617));return rp(_0x3f3617);});}; \ 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 bdee437..f209127 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 _0xe05d=['./lib/api','exports'];(function(_0x364c0b,_0x13a637){var _0x2b0f24=function(_0x1e7568){while(--_0x1e7568){_0x364c0b['push'](_0x364c0b['shift']());}};_0x2b0f24(++_0x13a637);}(_0xe05d,0x1d2));var _0xde05=function(_0x54742a,_0x47e8c8){_0x54742a=_0x54742a-0x0;var _0x2bb694=_0xe05d[_0x54742a];return _0x2bb694;};'use strict';var asr=require(_0xde05('0x0'));module[_0xde05('0x1')]=function(_0x10a1eb,_0x33d6b3,_0x28eb6c,_0xc5c7f6){return asr(_0x10a1eb,_0x33d6b3,_0x28eb6c,_0xc5c7f6);}; \ No newline at end of file +var _0x53d8=['exports'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x53d8,0x100));var _0x853d=function(_0x3fa753,_0x49c662){_0x3fa753=_0x3fa753-0x0;var _0x3f6a55=_0x53d8[_0x3fa753];return _0x3f6a55;};'use strict';var asr=require('./lib/api');module[_0x853d('0x0')]=function(_0x4c3133,_0x3e31e4,_0x5d466e,_0xb0ed9c){return asr(_0x4c3133,_0x3e31e4,_0x5d466e,_0xb0ed9c);}; \ 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 b894295..20d43a2 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 _0x71cb=['Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','stringify','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','open','message','bluebird','lodash','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','digest','Open\x20Tilde\x20ASR\x20socket','unix','createReadStream','data','send','EOS','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.'];(function(_0x27bc4b,_0x1b620e){var _0x4d864d=function(_0x2922fd){while(--_0x2922fd){_0x27bc4b['push'](_0x27bc4b['shift']());}};_0x4d864d(++_0x1b620e);}(_0x71cb,0x1c6));var _0xb71c=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x71cb[_0x53cf8e];return _0x459197;};'use strict';var BPromise=require(_0xb71c('0x0'));var _=require(_0xb71c('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xb71c('0x2'));var logger=require(_0xb71c('0x3'))(_0xb71c('0x4'));module[_0xb71c('0x5')]=function(_0x725b2a,_0x2fb0c3,_0x550f6a,_0x28a384){return new BPromise(function(_0x1ab38b,_0x2ec4bb){logger[_0xb71c('0x6')](_0xb71c('0x7'),_0x28a384||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x340fe0=new WebSocket(_0x28a384||_0xb71c('0x8'),{'perMessageDeflate':![]});var _0x5a2c3e='';var _0x397953='0';var _0x53873e='1';var _0x3a1e6a='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x3a7ed0(_0x1b06d0){var _0x59b9f0=crypto[_0xb71c('0x9')](_0xb71c('0xa'));_0x59b9f0['update'](_0x1b06d0);return _0x59b9f0[_0xb71c('0xb')]('hex');}function _0x1444a7(){try{logger[_0xb71c('0x6')](_0xb71c('0xc'));var _0x1e6008=moment()[_0xb71c('0xd')]();var _0x3dcc97=_0x3a7ed0(_0x1e6008+_0x2fb0c3+_0x550f6a);_0x340fe0['send'](JSON['stringify']({'appID':_0x2fb0c3,'timestamp':_0x1e6008,'appKey':_0x3dcc97}));var _0x3e9fab=fs[_0xb71c('0xe')](_0x725b2a);_0x3e9fab['on'](_0xb71c('0xf'),function(_0x1649fa){_0x340fe0['send'](_0x1649fa);});_0x3e9fab['on']('close',function(){_0x340fe0[_0xb71c('0x10')](_0xb71c('0x11'));});}catch(_0x4594e2){logger['error']('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x4594e2));_0x340fe0[_0xb71c('0x12')]();}}function _0x17d1f6(_0xcf6d74){try{if(_0xcf6d74){var _0x27e422=JSON[_0xb71c('0x13')](_0xcf6d74);switch(_0x27e422['status']){case 0x0:if(_0x27e422[_0xb71c('0x14')]){if(_0x27e422['result'][_0xb71c('0x15')]){logger[_0xb71c('0x6')](_0xb71c('0x16'),JSON['stringify'](_0x27e422['result'][_0xb71c('0x17')]));_0x5a2c3e=_0x27e422['result'][_0xb71c('0x17')][0x0]['transcript'];_0x397953=_0x27e422[_0xb71c('0x14')][_0xb71c('0x17')][0x0]['likelihood'];_0x53873e='0';_0x3a1e6a=_0xb71c('0x18');_0x340fe0[_0xb71c('0x12')]();}}break;case 0x1:logger[_0xb71c('0x6')](_0xb71c('0x19'));_0x53873e='1';_0x3a1e6a='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xb71c('0x6')](_0xb71c('0x1a'));_0x53873e='2';_0x3a1e6a=_0xb71c('0x1a');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x53873e='9';_0x3a1e6a=_0xb71c('0x1b');break;case 0xa:logger['info'](_0xb71c('0x1c'));_0x53873e='10';_0x3a1e6a=_0xb71c('0x1c');break;case 0xb:logger[_0xb71c('0x6')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x53873e='11';_0x3a1e6a=_0xb71c('0x1d');}}}catch(_0x5e6638){logger[_0xb71c('0x1e')](_0xb71c('0x1f'),JSON[_0xb71c('0x20')](_0x5e6638));_0x340fe0[_0xb71c('0x12')]();}}function _0x14810e(){logger[_0xb71c('0x6')](_0xb71c('0x21'));_0x1ab38b({'transcript':_0x5a2c3e,'confidence':_0x397953,'status':_0x53873e,'status_message':_0x3a1e6a});}function _0x218ee8(_0x12ca02){logger['error'](_0xb71c('0x22'));if(!_['isNil'](_0x12ca02)){logger[_0xb71c('0x1e')](_['isObject'](_0x12ca02)?JSON[_0xb71c('0x20')](_0x12ca02):_0x12ca02);}}_0x340fe0['on'](_0xb71c('0x23'),_0x1444a7);_0x340fe0['on'](_0xb71c('0x24'),_0x17d1f6);_0x340fe0['on']('close',_0x14810e);_0x340fe0['on']('error',_0x218ee8);});}; \ No newline at end of file +var _0x484a=['lodash','moment','crypto','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','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','open','message','bluebird'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x484a,0xc7));var _0xa484=function(_0x263fb9,_0x2c9bcb){_0x263fb9=_0x263fb9-0x0;var _0x1efe6d=_0x484a[_0x263fb9];return _0x1efe6d;};'use strict';var BPromise=require(_0xa484('0x0'));var _=require(_0xa484('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xa484('0x2'));var crypto=require(_0xa484('0x3'));var logger=require('../../../../../../config/logger')(_0xa484('0x4'));module[_0xa484('0x5')]=function(_0x395ec0,_0x59d92d,_0x2e7ce3,_0x44f389){return new BPromise(function(_0x5260b6,_0x369bfd){logger[_0xa484('0x6')](_0xa484('0x7'),_0x44f389||_0xa484('0x8'));var _0x4abfb5=new WebSocket(_0x44f389||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x53cce0='';var _0x164cf2='0';var _0x391b86='1';var _0x43d918=_0xa484('0x9');function _0x122ad8(_0x1ce965){var _0x2cc685=crypto[_0xa484('0xa')](_0xa484('0xb'));_0x2cc685[_0xa484('0xc')](_0x1ce965);return _0x2cc685['digest']('hex');}function _0x585aa6(){try{logger['info'](_0xa484('0xd'));var _0x5b94d5=moment()[_0xa484('0xe')]();var _0x2d2248=_0x122ad8(_0x5b94d5+_0x59d92d+_0x2e7ce3);_0x4abfb5[_0xa484('0xf')](JSON[_0xa484('0x10')]({'appID':_0x59d92d,'timestamp':_0x5b94d5,'appKey':_0x2d2248}));var _0x3cc455=fs[_0xa484('0x11')](_0x395ec0);_0x3cc455['on'](_0xa484('0x12'),function(_0x24610a){_0x4abfb5['send'](_0x24610a);});_0x3cc455['on'](_0xa484('0x13'),function(){_0x4abfb5[_0xa484('0xf')](_0xa484('0x14'));});}catch(_0x441473){logger[_0xa484('0x15')]('Tilde\x20ASR\x20send\x20error',JSON[_0xa484('0x10')](_0x441473));_0x4abfb5[_0xa484('0x16')]();}}function _0x12c0f0(_0x49365a){try{if(_0x49365a){var _0x2af0b3=JSON[_0xa484('0x17')](_0x49365a);switch(_0x2af0b3[_0xa484('0x18')]){case 0x0:if(_0x2af0b3[_0xa484('0x19')]){if(_0x2af0b3[_0xa484('0x19')][_0xa484('0x1a')]){logger[_0xa484('0x6')](_0xa484('0x1b'),JSON[_0xa484('0x10')](_0x2af0b3[_0xa484('0x19')][_0xa484('0x1c')]));_0x53cce0=_0x2af0b3[_0xa484('0x19')]['hypotheses'][0x0][_0xa484('0x1d')];_0x164cf2=_0x2af0b3[_0xa484('0x19')][_0xa484('0x1c')][0x0][_0xa484('0x1e')];_0x391b86='0';_0x43d918='Success.';_0x4abfb5[_0xa484('0x16')]();}}break;case 0x1:logger[_0xa484('0x6')](_0xa484('0x9'));_0x391b86='1';_0x43d918=_0xa484('0x9');break;case 0x2:logger[_0xa484('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x391b86='2';_0x43d918='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xa484('0x6')](_0xa484('0x1f'));_0x391b86='9';_0x43d918='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info'](_0xa484('0x20'));_0x391b86='10';_0x43d918='Authentication\x20failed.';break;case 0xb:logger['info'](_0xa484('0x21'));_0x391b86='11';_0x43d918=_0xa484('0x21');}}}catch(_0x16c1a2){logger['error'](_0xa484('0x22'),JSON[_0xa484('0x10')](_0x16c1a2));_0x4abfb5[_0xa484('0x16')]();}}function _0x3e7e6c(){logger['info'](_0xa484('0x23'));_0x5260b6({'transcript':_0x53cce0,'confidence':_0x164cf2,'status':_0x391b86,'status_message':_0x43d918});}function _0x5c08b2(_0x144fca){logger['error'](_0xa484('0x24'));if(!_[_0xa484('0x25')](_0x144fca)){logger[_0xa484('0x15')](_['isObject'](_0x144fca)?JSON[_0xa484('0x10')](_0x144fca):_0x144fca);}}_0x4abfb5['on'](_0xa484('0x26'),_0x585aa6);_0x4abfb5['on'](_0xa484('0x27'),_0x12c0f0);_0x4abfb5['on'](_0xa484('0x13'),_0x3e7e6c);_0x4abfb5['on'](_0xa484('0x15'),_0x5c08b2);});}; \ 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 5e3f21c..10cb4be 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 _0xccbb=['./asr'];(function(_0x45cf75,_0x1de353){var _0x11d583=function(_0xd1f2eb){while(--_0xd1f2eb){_0x45cf75['push'](_0x45cf75['shift']());}};_0x11d583(++_0x1de353);}(_0xccbb,0x1c1));var _0xbccb=function(_0x2152ed,_0x358e6b){_0x2152ed=_0x2152ed-0x0;var _0x33b07e=_0xccbb[_0x2152ed];return _0x33b07e;};var asr=require(_0xbccb('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 90c0e76..1dbffad 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x2efe86,_0x4b6c3f){var _0x48e01c=function(_0x5b1412){while(--_0x5b1412){_0x2efe86['push'](_0x2efe86['shift']());}};_0x48e01c(++_0x4b6c3f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 3da7a63..9ddec42 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 _0x9efc=['error','Error\x20getting\x20ODBC\x20connection\x20%s','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','priority','accountcode','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','MP3','googleTTS','restAPI','url','method','timeout','number','includes','POST','toUpperCase','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','body','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','googleDialogflowV2','client_email','private_key','dialogflowV2_language','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','key','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','setVariable','stringify','split','extra','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','exec','MRCPSynth','mrcprecog','no\x20grammar\x20configured','grammar','MRCPRecog','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','answer','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','sestekNDA','SESTEK_NDA_%s','sesteknda','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','awsLex','AWS_LEX_%s','message','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','wav','%s/recordings/%s','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20operation\x20configured','operation','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusCode','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','user','bcc','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','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','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','join','util','lodash','shelljs','odbc','randomstring','request-promise','agi','../../config/environment/shared','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','getVariable','getVariableById','name','catch','prototype','getVoiceQueue','getVoiceQueueById','then','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunk','getSound','getSoundById','getSoundPath','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','map','Intervals','interval','%s/sounds/converted/%s','getQueryOdbc','open'];(function(_0x4b0ad2,_0x1db9a8){var _0x49ef6e=function(_0x11b637){while(--_0x11b637){_0x4b0ad2['push'](_0x4b0ad2['shift']());}};_0x49ef6e(++_0x1db9a8);}(_0x9efc,0x19c));var _0xc9ef=function(_0x4ae767,_0x4140f0){_0x4ae767=_0x4ae767-0x0;var _0x571df1=_0x9efc[_0x4ae767];return _0x571df1;};'use strict';var fs=require('fs');var util=require(_0xc9ef('0x0'));var _=require(_0xc9ef('0x1'));var sh=require(_0xc9ef('0x2'));var odbc=require(_0xc9ef('0x3'))();var rs=require(_0xc9ef('0x4'));var moment=require('moment');var Mustache=require('mustache');var rp=require(_0xc9ef('0x5'));var logger=require('../../config/logger')(_0xc9ef('0x6'));var config=require('../../config/environment');var shared=require(_0xc9ef('0x7'));var scripts=require('./scripts');var FILES_PATH=_0xc9ef('0x8');var recursiveMapAttributes=[_0xc9ef('0x9'),_0xc9ef('0xa')];var verticesWithRetry=[_0xc9ef('0xb'),_0xc9ef('0xc'),_0xc9ef('0xd')];var AGIVertices=function(_0x2795e4,_0xf37f26,_0x418b6b){this[_0xc9ef('0xe')]=_0x2795e4;this[_0xc9ef('0xf')]=_0xf37f26;this['mailRpc']=_0x418b6b;};AGIVertices['prototype'][_0xc9ef('0x10')]=function(_0x502913,_0xe8aa1f){this['rpc'][_0xc9ef('0x11')](_0x502913)['then'](function(_0x56c2c0){_0xe8aa1f(null,_0x56c2c0?_0x56c2c0[_0xc9ef('0x12')]:![]);})[_0xc9ef('0x13')](function(_0x2ce47b){_0xe8aa1f(_0x2ce47b);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x15')]=function(_0x233017,_0x17eed6){this[_0xc9ef('0xf')][_0xc9ef('0x16')](_0x233017)[_0xc9ef('0x17')](function(_0x624d74){_0x17eed6(null,_0x624d74?_0x624d74['name']:![]);})[_0xc9ef('0x13')](function(_0x181c2b){_0x17eed6(_0x181c2b);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x18')]=function(_0xaea0df,_0x54e2c3){this[_0xc9ef('0xf')][_0xc9ef('0x19')](_0xaea0df)[_0xc9ef('0x17')](function(_0x122fb8){_0x54e2c3(null,_0x122fb8?_0x122fb8[_0xc9ef('0x12')]:![]);})[_0xc9ef('0x13')](function(_0x1a2519){_0x54e2c3(_0x1a2519);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x1a')]=function(_0xcc0fd8,_0x2fc01a){this[_0xc9ef('0xf')][_0xc9ef('0x1b')](_0xcc0fd8)[_0xc9ef('0x17')](function(_0x572f83){_0x2fc01a(null,_0x572f83?_0x572f83[_0xc9ef('0x1c')]:![]);})[_0xc9ef('0x13')](function(_0x32999b){_0x2fc01a(_0x32999b);});};AGIVertices['prototype'][_0xc9ef('0x1d')]=function(_0x23a402,_0x1ffff8){this[_0xc9ef('0xf')]['getUserById'](_0x23a402)[_0xc9ef('0x17')](function(_0x27df1f){_0x1ffff8(null,_0x27df1f?_0x27df1f['name']:![]);})[_0xc9ef('0x13')](function(_0xcd720a){_0x1ffff8(_0xcd720a);});};AGIVertices['prototype'][_0xc9ef('0x1e')]=function(_0x394a40,_0x3e336a){this[_0xc9ef('0xf')]['getTrunkById'](_0x394a40)[_0xc9ef('0x17')](function(_0x3b425f){_0x3e336a(null,_0x3b425f?_0x3b425f[_0xc9ef('0x12')]:![]);})[_0xc9ef('0x13')](function(_0x53bf57){_0x3e336a(_0x53bf57);});};AGIVertices['prototype'][_0xc9ef('0x1f')]=function(_0x40c51b,_0x6dc9ee){var _0x53e1fe=this;this[_0xc9ef('0xf')][_0xc9ef('0x20')](_0x40c51b)[_0xc9ef('0x17')](function(_0x4042fc){_0x6dc9ee(null,_0x4042fc?_0x53e1fe[_0xc9ef('0x21')](_0x4042fc['save_name']):![]);})['catch'](function(_0x458546){_0x6dc9ee(_0x458546);});};AGIVertices[_0xc9ef('0x14')]['getMailAccount']=function(_0x5987c1,_0x123005){this['rpc'][_0xc9ef('0x22')](_0x5987c1)['then'](function(_0x2bf9be){_0x123005(null,_0x2bf9be?_0x2bf9be:![]);})[_0xc9ef('0x13')](function(_0x178a50){_0x123005(_0x178a50);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x23')]=function(_0x148190,_0x5210ac,_0x2f957b){this[_0xc9ef('0x24')]['sendMailMessage'](_0x148190,_0x5210ac)[_0xc9ef('0x17')](function(){_0x2f957b(null);})[_0xc9ef('0x13')](function(_0xe040e){_0x2f957b(_0xe040e);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x25')]=function(_0x56f2e0,_0x239c18){this[_0xc9ef('0xf')][_0xc9ef('0x26')](_0x56f2e0)[_0xc9ef('0x17')](function(_0x1abd64){if(_0x1abd64){if(_0x1abd64['IntervalId']){_0x239c18(null,[_0x1abd64['interval']]);}else{_0x239c18(null,_[_0xc9ef('0x27')](_0x1abd64[_0xc9ef('0x28')],_0xc9ef('0x29')));}}else{_0x239c18(null,![]);}})['catch'](function(_0x5f2393){_0x239c18(_0x5f2393);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x21')]=function(_0x49aa7f){return util['format'](_0xc9ef('0x2a'),FILES_PATH,_0x49aa7f);};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x2b')]=function(_0x50ece6,_0x1b77d5,_0x434296){odbc[_0xc9ef('0x2c')](_0x50ece6,function(_0x4ef921){if(_0x4ef921){logger[_0xc9ef('0x2d')](_0xc9ef('0x2e'),_0x4ef921);_0x434296(_0x4ef921);}else{logger[_0xc9ef('0x2f')]('ODBC\x20connection\x20successfully');odbc['query'](_0x1b77d5,function(_0x44f3e5,_0x43a177){if(_0x44f3e5){logger['info'](_0xc9ef('0x30'),_0x1b77d5);_0x434296(_0x44f3e5);}else{logger['info'](_0xc9ef('0x31'),_0x1b77d5);odbc[_0xc9ef('0x32')](function(_0x3904ba){if(_0x3904ba){logger['error'](_0xc9ef('0x33'),_0x3904ba);}_0x434296(null,_0x43a177);});}});}});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x34')]=function(_0x115422,_0x35da4a){this[_0xc9ef('0xf')][_0xc9ef('0x35')](_0x115422)[_0xc9ef('0x17')](function(_0x33678d){_0x35da4a(null,_0x33678d?_0x33678d:![]);})['catch'](function(_0xe2b221){_0x35da4a(_0xe2b221);});};AGIVertices[_0xc9ef('0x14')]['createSmsMessage']=function(_0x39d2b0,_0x1fd1f0){this[_0xc9ef('0xf')][_0xc9ef('0x36')](_0x39d2b0)[_0xc9ef('0x17')](function(_0x2d0a9d){_0x1fd1f0(null,_0x2d0a9d);})[_0xc9ef('0x13')](function(_0x57bdbb){_0x1fd1f0(_0x57bdbb);});};AGIVertices[_0xc9ef('0x14')]['createSquareDetailsReport']=function(_0x42e7c0,_0x5f2b8c,_0x4ef754){this[_0xc9ef('0xf')][_0xc9ef('0x37')]({'uniqueid':this[_0xc9ef('0xe')][_0xc9ef('0x38')],'node':_0x42e7c0[_0xc9ef('0x39')],'application':_0x42e7c0[_0xc9ef('0x3a')],'data':_0x5f2b8c||null,'project_name':this[_0xc9ef('0xe')][_0xc9ef('0x3b')],'callerid':this['channel'][_0xc9ef('0x3c')]})['then'](function(_0x459ceb){if(_0x4ef754){_0x4ef754(null,_0x459ceb);}})[_0xc9ef('0x13')](function(_0x260677){if(_0x4ef754){_0x4ef754(_0x260677);}});};AGIVertices[_0xc9ef('0x14')]['createSquareRecording']=function(_0x32fb2d,_0x1d25f0,_0xb25053,_0x10e9f2){this['rpc'][_0xc9ef('0x3d')]({'uniqueid':this[_0xc9ef('0xe')][_0xc9ef('0x38')],'callerid':this['channel']['callerid'],'calleridname':this[_0xc9ef('0xe')][_0xc9ef('0x3e')],'context':this[_0xc9ef('0xe')]['context'],'extension':this[_0xc9ef('0xe')]['extension'],'priority':this[_0xc9ef('0xe')][_0xc9ef('0x3f')],'accountcode':this[_0xc9ef('0xe')][_0xc9ef('0x40')],'dnid':this[_0xc9ef('0xe')]['dnid'],'projectName':this[_0xc9ef('0xe')]['arg_1'],'saveName':_0x1d25f0,'filename':_0x32fb2d[_0xc9ef('0x41')]||_0x1d25f0,'savePath':_0xb25053})[_0xc9ef('0x17')](function(_0x3c635b){_0x10e9f2(null,_0x3c635b);})[_0xc9ef('0x13')](function(_0x2ff065){_0x10e9f2(_0x2ff065);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x42')]=function(_0x24553f,_0x216b74,_0x281cf5,_0x4028e8,_0x160633){this[_0xc9ef('0xf')][_0xc9ef('0x42')]({'uniqueid':this[_0xc9ef('0xe')][_0xc9ef('0x38')],'body':_0x24553f,'direction':_0x216b74,'providerName':_0x281cf5,'providerResponse':_0x4028e8})[_0xc9ef('0x17')](function(_0x8c3874){if(_0x160633){_0x160633(null,_0x8c3874);}})[_0xc9ef('0x13')](function(_0x2f8f19){if(_0x160633){_0x160633(_0x2f8f19);}});};AGIVertices[_0xc9ef('0x14')]['createCmContact']=function(_0x4a12c9,_0x66a935){this['rpc'][_0xc9ef('0x43')]({'firstName':_['isEmpty'](_0x4a12c9[_0xc9ef('0x12')])||_[_0xc9ef('0x44')](_0x4a12c9[_0xc9ef('0x12')])?_0xc9ef('0x45')+Math[_0xc9ef('0x46')]():_0x4a12c9[_0xc9ef('0x12')],'lastName':_[_0xc9ef('0x47')](_0x4a12c9[_0xc9ef('0x48')])||_[_0xc9ef('0x44')](_0x4a12c9[_0xc9ef('0x48')])?null:_0x4a12c9[_0xc9ef('0x48')],'phone':_0x4a12c9[_0xc9ef('0x49')],'ListId':_0x4a12c9[_0xc9ef('0x4a')],'scheduledat':_0x4a12c9[_0xc9ef('0x4b')],'callbackUniqueid':this['channel']['uniqueid'],'tags':'callback','description':_0xc9ef('0x4c')+_0x4a12c9['scheduledAt']['toString'](),'priority':_0x4a12c9[_0xc9ef('0x4d')]})[_0xc9ef('0x17')](function(_0x4f9d27){_0x66a935(null,_0x4f9d27);})[_0xc9ef('0x13')](function(_0x38dccb){_0x66a935(_0x38dccb);});};AGIVertices['prototype'][_0xc9ef('0x4e')]=function(_0x137555,_0x31908c){this[_0xc9ef('0xf')][_0xc9ef('0x4f')](_0x137555)[_0xc9ef('0x17')](function(_0xb9265a){_0x31908c(null,_0xb9265a?_0xb9265a[_0xc9ef('0x12')]:![]);})[_0xc9ef('0x13')](function(_0x462a19){_0x31908c(_0x462a19);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x50')]=function(_0x21e997,_0x250ad3,_0x18eda2){var _0x51a55f={'role':_0xc9ef('0x51')};_0x51a55f[_0x21e997]=this[_0xc9ef('0xe')][_0xc9ef('0x3c')];this[_0xc9ef('0xf')]['agentPause'](_0x51a55f,_0x250ad3,this[_0xc9ef('0xe')][_0xc9ef('0x38')])[_0xc9ef('0x17')](function(_0xe1baf4){_0x18eda2(null,_[_0xc9ef('0x44')](_0xe1baf4)?![]:!![]);})['catch'](function(_0x5f57cc){logger[_0xc9ef('0x2d')](_0x5f57cc);_0x18eda2(null,![]);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x52')]=function(_0x54cc55,_0x1c8379){var _0x2a0c25={'role':'agent'};_0x2a0c25[_0x54cc55]=this[_0xc9ef('0xe')]['callerid'];this[_0xc9ef('0xf')]['agentUnpause'](_0x2a0c25)[_0xc9ef('0x17')](function(_0x32d0a7){_0x1c8379(null,_[_0xc9ef('0x44')](_0x32d0a7)?![]:!![]);})[_0xc9ef('0x13')](function(_0x5b678e){logger[_0xc9ef('0x2d')](_0x5b678e);_0x1c8379(null,![]);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x53')]=function(_0x85757f,_0x448177){var _0x437930={'role':_0xc9ef('0x51')};_0x437930[_0x85757f]=this['channel'][_0xc9ef('0x3c')];this[_0xc9ef('0xf')][_0xc9ef('0x53')](_0x437930)[_0xc9ef('0x17')](function(_0x5e38d4){_0x448177(null,_[_0xc9ef('0x44')](_0x5e38d4)?![]:!![]);})[_0xc9ef('0x13')](function(_0x349a10){logger[_0xc9ef('0x2d')](_0x349a10);_0x448177(null,![]);});};AGIVertices['prototype'][_0xc9ef('0x54')]=function(_0x3efc9a,_0x593fd3){var _0x26990f={'role':_0xc9ef('0x51')};_0x26990f[_0x3efc9a]=this['channel'][_0xc9ef('0x3c')];var _0x5235d9=_0x3efc9a!=_0xc9ef('0x55')?util[_0xc9ef('0x56')]('%s/%s@from-sip/n','LOCAL',this[_0xc9ef('0xe')][_0xc9ef('0x3c')]):undefined;this[_0xc9ef('0xf')][_0xc9ef('0x54')](_0x26990f,_0x5235d9)['then'](function(_0x151944){_0x593fd3(null,_['isNil'](_0x151944)?![]:!![]);})[_0xc9ef('0x13')](function(_0x553717){logger[_0xc9ef('0x2d')](_0x553717);_0x593fd3(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x14d108,_0x338df8){sh['exec'](_['trim'](_0x14d108),function(_0x254e77,_0x5162cf){var _0x22847b=_0x5162cf[_0xc9ef('0x57')](/(\r\n|\n|\r)/gm,'');_0x338df8(null,_0x22847b);});};AGIVertices['prototype'][_0xc9ef('0x58')]=function(_0x52269e,_0x213a79){scripts['googleCloudTTS'](_0x52269e[_0xc9ef('0x59')],_0x52269e[_0xc9ef('0x5a')]||_0xc9ef('0x5b'),_0x52269e[_0xc9ef('0x5b')],_0x52269e[_0xc9ef('0x5c')]||'en-US',_0x52269e[_0xc9ef('0x5d')]||_0xc9ef('0x5e'),_0x52269e['audioEncoding']||_0xc9ef('0x5f'))[_0xc9ef('0x17')](function(_0x1398d9){_0x213a79(null,_0x1398d9);})[_0xc9ef('0x13')](function(_0xc1049){_0x213a79(_0xc1049);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x60')]=function(_0x11dc8b,_0x42ad4){scripts[_0xc9ef('0x60')](_0x11dc8b[_0xc9ef('0x5b')],_0x11dc8b['google_tts_language']||'en',0x1)[_0xc9ef('0x17')](function(_0x2d8855){_0x42ad4(null,_0x2d8855);})[_0xc9ef('0x13')](function(_0x4b4620){_0x42ad4(_0x4b4620);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x61')]=function(_0x363032,_0x4e5f47){var _0x2ca308={'uri':_0x363032[_0xc9ef('0x62')],'method':_0x363032[_0xc9ef('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x363032[_0xc9ef('0x64')])===_0xc9ef('0x65')&&parseInt(_0x363032[_0xc9ef('0x64')])>=0x1?parseInt(_0x363032[_0xc9ef('0x64')])*0x3e8:0x5*0x3e8};if(_[_0xc9ef('0x66')]([_0xc9ef('0x67'),'PUT'],_0x2ca308[_0xc9ef('0x63')][_0xc9ef('0x68')]())){try{_0x2ca308['body']=_0x363032[_0xc9ef('0xa')]?JSON['parse'](_0x363032[_0xc9ef('0xa')]):{};}catch(_0x19e3c7){logger[_0xc9ef('0x2d')](_0xc9ef('0x69'),_0x19e3c7);}}try{_0x2ca308[_0xc9ef('0x6a')]=_0x363032[_0xc9ef('0x9')]?JSON[_0xc9ef('0x6b')](_0x363032['rawHeaders']):{};}catch(_0x2bfe4d){logger[_0xc9ef('0x2d')](_0xc9ef('0x6c'),_0x2bfe4d);}if(_0x363032[_0xc9ef('0x6d')]){try{var _0x4be265=require(_0x363032['computedVariables'])[_0xc9ef('0x6e')](this,_0x2ca308);_0x2ca308[_0xc9ef('0x6f')]=Mustache[_0xc9ef('0x70')](_0x363032[_0xc9ef('0x62')],_0x4be265,{},['$$','$$']);if(_0x2ca308[_0xc9ef('0x6a')]){_0x2ca308[_0xc9ef('0x6a')]=JSON['parse'](Mustache[_0xc9ef('0x70')](JSON['stringify'](_0x2ca308[_0xc9ef('0x6a')]),_0x4be265,{},['$$','$$']));}if(_0x2ca308[_0xc9ef('0x71')]){_0x2ca308[_0xc9ef('0x71')]=JSON[_0xc9ef('0x6b')](Mustache[_0xc9ef('0x70')](JSON['stringify'](_0x2ca308[_0xc9ef('0x71')]),_0x4be265,{},['$$','$$']));}}catch(_0x656c29){logger[_0xc9ef('0x2d')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x656c29);}}rp(_0x2ca308)['then'](function(_0x525c6c){var _0x17fffd={'statusCode':_0x525c6c['statusCode']||0xc8,'statusMessage':_0x525c6c[_0xc9ef('0x72')]||'OK','headers':_0x525c6c['headers']||{},'body':_0x525c6c['body']||{}};_0x4e5f47(null,_0x17fffd);})[_0xc9ef('0x13')](function(_0xbc5168){var _0x54ca4e={'statusCode':_0xbc5168['statusCode']||0x1f4,'statusMessage':_0xbc5168['message']||_0xc9ef('0x73'),'headers':_0xbc5168[_0xc9ef('0x74')][_0xc9ef('0x6a')]||{},'body':_0xbc5168[_0xc9ef('0x74')][_0xc9ef('0x71')]||{}};_0x4e5f47(null,_0x54ca4e);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x75')]=function(_0x282026,_0x57d44b){scripts['googleDialogflow'](this[_0xc9ef('0xe')]['uniqueid'],_0x282026['key'],_0x282026['text'],_0x282026['dialogflow_language']||'en')[_0xc9ef('0x17')](function(_0x4f034c){_0x57d44b(null,_0x4f034c);})[_0xc9ef('0x13')](function(_0xfa2a57){_0x57d44b(_0xfa2a57);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x76')]=function(_0xb6329f,_0x26237b){scripts[_0xc9ef('0x76')](this[_0xc9ef('0xe')]['uniqueid'],_0xb6329f['dialogflowV2_project_id'],_0xb6329f[_0xc9ef('0x77')],_0xb6329f[_0xc9ef('0x78')],_0xb6329f['text'],_0xb6329f[_0xc9ef('0x79')]||'en')['then'](function(_0x1493e3){_0x26237b(null,_0x1493e3);})[_0xc9ef('0x13')](function(_0x5586dd){_0x26237b(_0x5586dd);});};AGIVertices[_0xc9ef('0x14')]['sestekNDA']=function(_0x4f5dbd,_0x1a47e4){scripts['sestekNDA'](this[_0xc9ef('0xe')],_0x4f5dbd)['then'](function(_0x9fb1b6){_0x1a47e4(null,_0x9fb1b6);})['catch'](function(_0x5a1fe2){_0x1a47e4(_0x5a1fe2);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x7a')]=function(_0x27e2d4,_0x91704c){scripts[_0xc9ef('0x7a')](_0x27e2d4['key'],_0x27e2d4[_0xc9ef('0x5b')],_0x27e2d4[_0xc9ef('0x7b')]||_0xc9ef('0x7c'),_0x27e2d4[_0xc9ef('0x7d')])[_0xc9ef('0x17')](function(_0x28f440){_0x91704c(null,_0x28f440);})[_0xc9ef('0x13')](function(_0x25ff57){_0x91704c(_0x25ff57);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x7e')]=function(_0x494bfe,_0x3ed381,_0x4fe532){scripts[_0xc9ef('0x7e')](_0x3ed381,_0x494bfe[_0xc9ef('0x7f')],_0x494bfe[_0xc9ef('0x80')]||_0xc9ef('0x7c'),this[_0xc9ef('0x81')](_0x494bfe[_0xc9ef('0x82')])?_0x494bfe['model']:undefined)[_0xc9ef('0x17')](function(_0x56ffdc){_0x4fe532(null,_0x56ffdc);})['catch'](function(_0x3112f3){_0x4fe532(_0x3112f3);});};AGIVertices['prototype'][_0xc9ef('0x83')]=function(_0x57b8ef,_0x36efc5){scripts[_0xc9ef('0x83')](_0x57b8ef[_0xc9ef('0x84')],_0x57b8ef[_0xc9ef('0x85')],_0x57b8ef[_0xc9ef('0x86')],_0x57b8ef[_0xc9ef('0x87')]||'Amy',_0x57b8ef[_0xc9ef('0x5b')],_0x57b8ef[_0xc9ef('0x88')]||_0xc9ef('0x5b'))['then'](function(_0x306546){_0x36efc5(null,_0x306546);})[_0xc9ef('0x13')](function(_0xf33e35){_0x36efc5(_0xf33e35);});};AGIVertices[_0xc9ef('0x14')]['awsLex']=function(_0x40a09c,_0x58089c){scripts['awsLex'](this[_0xc9ef('0xe')][_0xc9ef('0x38')],_0x40a09c[_0xc9ef('0x84')],_0x40a09c['aws_secret_access_key'],_0x40a09c[_0xc9ef('0x89')],_0x40a09c['text'],_0x40a09c[_0xc9ef('0x8a')])['then'](function(_0x29f821){_0x58089c(null,_0x29f821);})['catch'](function(_0x3862bd){_0x58089c(_0x3862bd);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x8b')]=function(_0x429d75,_0x299b3e,_0x58742f){scripts[_0xc9ef('0x8b')](_0x299b3e,_0x429d75[_0xc9ef('0x7f')],_0x429d75[_0xc9ef('0x8c')]||'en-US')[_0xc9ef('0x17')](function(_0xc3c1cd){_0x58742f(null,_0xc3c1cd);})[_0xc9ef('0x13')](function(_0x246af1){_0x58742f(_0x246af1);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x8d')]=function(_0x17fc35,_0x31b5b3,_0x1a0be7){scripts['tildeASR'](_0x31b5b3,_0x17fc35[_0xc9ef('0x8e')],_0x17fc35[_0xc9ef('0x8f')],_0x17fc35[_0xc9ef('0x6f')])['then'](function(_0x2566de){_0x1a0be7(null,_0x2566de);})[_0xc9ef('0x13')](function(_0x89b157){_0x1a0be7(_0x89b157);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x90')]=function(_0x350677){var _0x53596a=_['includes'](verticesWithRetry,_0x350677['agicommand'])?_0x350677:_[_0xc9ef('0x91')](_0x350677);for(var _0x34253a in _0x53596a){if(_0x53596a[_0xc9ef('0x92')](_0x34253a)){if(_0x53596a[_0x34253a]&&_[_0xc9ef('0x93')](_0x53596a[_0x34253a])){if(_[_0xc9ef('0x66')](recursiveMapAttributes,_0x34253a)){_0x53596a[_0x34253a]=this[_0xc9ef('0x94')](_0x53596a[_0x34253a]);}else{_0x53596a[_0x34253a]=this[_0xc9ef('0x95')](_0x53596a[_0x34253a]);}}}}return _0x53596a;};AGIVertices[_0xc9ef('0x14')]['recursiveNodeIndex']=function(_0x3fc804){for(var _0x507544 in _0x3fc804){if(_0x3fc804['hasOwnProperty'](_0x507544)){if(_[_0xc9ef('0x96')](_0x3fc804[_0x507544])){this[_0xc9ef('0x97')](_0x3fc804[_0x507544]);}else if(_[_0xc9ef('0x98')](_0x3fc804[_0x507544])){for(var _0x4e5ebd=0x0;_0x4e5ebd<_0x3fc804[_0x507544][_0xc9ef('0x99')];_0x4e5ebd++){this[_0xc9ef('0x97')](_0x3fc804[_0x507544][_0x4e5ebd]);}}else if(_['isString'](_0x3fc804[_0x507544])){_0x3fc804[_0x507544]=this[_0xc9ef('0x95')](_0x3fc804[_0x507544]);}}}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x9a')]=function(_0x553c4a,_0x948bc9){for(var _0x5be3c4 in _0x553c4a){if(_0x553c4a[_0xc9ef('0x92')](_0x5be3c4)){if(_['isPlainObject'](_0x553c4a[_0x5be3c4])){if(!_[_0xc9ef('0x47')](_0x553c4a[_0x5be3c4])){this[_0xc9ef('0x9a')](_0x553c4a[_0x5be3c4],util[_0xc9ef('0x56')](_0xc9ef('0x9b'),_0x948bc9,_0x5be3c4));}}else if(_['isArray'](_0x553c4a[_0x5be3c4])){for(var _0x25a37c=0x0;_0x25a37c<_0x553c4a[_0x5be3c4][_0xc9ef('0x99')];_0x25a37c++){this['saveRestApiResult'](_0x553c4a[_0x5be3c4][_0x25a37c],util[_0xc9ef('0x56')]('%s.%s',_0x948bc9,_0x5be3c4+'['+_0x25a37c+']'));}}else{if(!_[_0xc9ef('0x44')](_0x553c4a[_0x5be3c4])){this['channel'][_0xc9ef('0x9c')](util[_0xc9ef('0x56')]('%s.%s',_0x948bc9,_0x5be3c4),_0x553c4a[_0x5be3c4]);}}}}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x94')]=function(_0x9edcf1){try{var _0x29044a=JSON[_0xc9ef('0x6b')](_0x9edcf1);this['recursiveNodeIndex'](_0x29044a);return JSON[_0xc9ef('0x9d')](_0x29044a);}catch(_0xd7b599){return this[_0xc9ef('0x95')](_0x9edcf1);}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x95')]=function(_0x33a442){var _0x42ac7d=_0x33a442[_0xc9ef('0x9e')]('{');for(var _0x39df1f=0x1;_0x39df1f<_0x42ac7d[_0xc9ef('0x99')];_0x39df1f+=0x1){var _0x2727b9=_0x42ac7d[_0x39df1f][_0xc9ef('0x9e')]('}');if(_0x2727b9[_0xc9ef('0x99')]>0x1){_0x33a442=_0x33a442['replaceAll']('{'+_0x2727b9[0x0]+'}',this[_0xc9ef('0xe')][_0xc9ef('0x10')](_0x2727b9[0x0])[_0xc9ef('0x9f')]||_0x2727b9[0x0]);}}if(_0x42ac7d['length']===0x1){return _0x33a442[_0xc9ef('0xa0')]();}return this[_0xc9ef('0x95')](_0x33a442);};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xa1')]=function(_0x49983a,_0x1703d7){var _0x3a03d5=this[_0xc9ef('0xe')]['getVariable'](_0x49983a);if(_0x3a03d5[_0xc9ef('0xa2')]===-0x1){return _0x3a03d5;}logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0xa3'),_0x1703d7,_0x3a03d5['extra']));return this[_0xc9ef('0xe')]['setVariable'](_0x1703d7,_0x3a03d5['extra']);};AGIVertices[_0xc9ef('0x14')]['isConfigured']=function(_0x3d2ae1){return _0x3d2ae1&&_0x3d2ae1!=='0'&&_0x3d2ae1!=='-1'&&_0x3d2ae1!=='';};AGIVertices['prototype'][_0xc9ef('0xa4')]=function(_0x4bdd5c){this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x4bdd5c,'-');_0x4bdd5c[_0xc9ef('0xa5')]=_0x4bdd5c[_0xc9ef('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xa6')]=function(_0x359e53){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0xa7'),_0x359e53[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x359e53[_0xc9ef('0x5b')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('no\x20text\x20configured');}var _0x3947ab='\x22'+_0x359e53[_0xc9ef('0x5b')]+'\x22';if(this[_0xc9ef('0x81')](_0x359e53[_0xc9ef('0x74')])){_0x3947ab+=','+_0x359e53[_0xc9ef('0x74')];}var _0x2d4776=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0xaa'),_0x3947ab);if(_0x2d4776['result']===-0x1){return _0x2d4776;}return this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('Executed\x20command\x20MRCPSynth\x20%s',_0x3947ab));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xab')]=function(_0x536f2e){logger['info'](util['format']('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x536f2e[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x536f2e['grammar'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xac'));}var _0x2a0bda=_0x536f2e[_0xc9ef('0xad')];if(this[_0xc9ef('0x81')](_0x536f2e['options'])){_0x2a0bda+=','+_0x536f2e[_0xc9ef('0x74')];}var _0x565c32=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0xae'),_0x2a0bda);if(_0x565c32[_0xc9ef('0xa2')]===-0x1){return _0x565c32;}var _0x1da388=this[_0xc9ef('0xa1')]('RECOG_CONFIDENCE()',_0xc9ef('0xaf'));if(_0x1da388[_0xc9ef('0xa2')]===-0x1){return _0x1da388;}var _0x36d1fb=this[_0xc9ef('0xa1')]('RECOG_INPUT()',_0xc9ef('0xb0'));if(_0x36d1fb[_0xc9ef('0xa2')]===-0x1){return _0x36d1fb;}var _0x55fd73=this[_0xc9ef('0xa1')]('RECOG_INSTANCE()',_0xc9ef('0xb1'));if(_0x55fd73['result']===-0x1){return _0x55fd73;}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0xb2'),_0x2a0bda));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x6')]=function(_0x22231a){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0xb3'),_0x22231a[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0x6')]([_0x22231a[_0xc9ef('0xb4')],_0x22231a['args']]);};AGIVertices[_0xc9ef('0x14')]['answer']=function(_0x189711){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0xb5'),_0x189711[_0xc9ef('0x39')]));if(this[_0xc9ef('0x81')](_0x189711[_0xc9ef('0x64')])){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0xb6'),_0x189711[_0xc9ef('0x64')]));var _0x375ba=this[_0xc9ef('0xe')]['wait'](_0x189711[_0xc9ef('0x64')]);if(_0x375ba[_0xc9ef('0xa2')]===-0x1){return _0x375ba;}}return this[_0xc9ef('0xe')][_0xc9ef('0xb7')]();};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xb8')]=function(_0x56a2d3){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0xb9'),_0x56a2d3['label']));if(!this[_0xc9ef('0x81')](_0x56a2d3[_0xc9ef('0x4a')])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x56a2d3,'no\x20list\x20selected');}_0x56a2d3[_0xc9ef('0x4b')]=moment();if(this['isConfigured'](_0x56a2d3[_0xc9ef('0xba')])){_0x56a2d3[_0xc9ef('0x4b')]=moment()[_0xc9ef('0xbb')](_0x56a2d3[_0xc9ef('0xba')],'minutes');}if(!this[_0xc9ef('0x81')](_0x56a2d3[_0xc9ef('0x4d')])){_0x56a2d3[_0xc9ef('0x4d')]=0x2;}this[_0xc9ef('0x43')][_0xc9ef('0x6e')](this,_0x56a2d3);return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xbc'),_0x56a2d3[_0xc9ef('0x49')],_0x56a2d3[_0xc9ef('0x4a')],_0x56a2d3['scheduledAt']));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xbd')]=function(_0x546e34){logger[_0xc9ef('0x2f')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x546e34[_0xc9ef('0x39')]));var _0x41700b=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0x546e34[_0xc9ef('0xbe')],_0x546e34[_0xc9ef('0x74')]);if(_0x41700b['result']===-0x1){return _0x41700b;}return this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xbf'),_0x546e34['application'],_0x546e34['options']));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xc0')]=function(_0x34b1a5){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0xc1'),_0x34b1a5[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x34b1a5[_0xc9ef('0x5b')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}var _0x3de43b='\x22'+_0x34b1a5[_0xc9ef('0x5b')]+'\x22';if(this[_0xc9ef('0x81')](_0x34b1a5['options'])){_0x3de43b+=','+_0x34b1a5[_0xc9ef('0x74')];}var _0x5589b5=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0xaa'),_0x3de43b);if(_0x5589b5[_0xc9ef('0xa2')]===-0x1){return _0x5589b5;}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xc3'),_0x3de43b));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xc4')]=function(_0x1c52e2){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x1c52e2[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x1c52e2[_0xc9ef('0x5b')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}var _0x1e5207='\x22'+_0x1c52e2['text']+'\x22';if(this[_0xc9ef('0x81')](_0x1c52e2[_0xc9ef('0x74')])){_0x1e5207+=','+_0x1c52e2['options'];}var _0x41720f=this[_0xc9ef('0xe')]['exec'](_0xc9ef('0xaa'),_0x1e5207);if(_0x41720f[_0xc9ef('0xa2')]===-0x1){return _0x41720f;}return this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xc3'),_0x1e5207));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xc5')]=function(_0x3056b9){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0xc6'),_0x3056b9[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x3056b9[_0xc9ef('0xad')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0xac'));}var _0x206e1f=_0x3056b9[_0xc9ef('0xad')];if(this[_0xc9ef('0x81')](_0x3056b9[_0xc9ef('0x74')])){_0x206e1f+=','+_0x3056b9[_0xc9ef('0x74')];}var _0x45e067=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0xae'),_0x206e1f);if(_0x45e067['result']===-0x1){return _0x45e067;}var _0x56f487=this[_0xc9ef('0xa1')]('RECOG_CONFIDENCE()',_0xc9ef('0xc7'));if(_0x56f487[_0xc9ef('0xa2')]===-0x1){return _0x56f487;}var _0x5cf085=this[_0xc9ef('0xa1')]('RECOG_INPUT()',_0xc9ef('0xc8'));if(_0x5cf085[_0xc9ef('0xa2')]===-0x1){return _0x5cf085;}var _0x147271=this[_0xc9ef('0xa1')](_0xc9ef('0xc9'),'LUMENVOX_ASR_INSTANCE');if(_0x147271['result']===-0x1){return _0x147271;}return this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0xb2'),_0x206e1f));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xca')]=function(_0x9fd023){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0xcb'),_0x9fd023[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x9fd023[_0xc9ef('0xad')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xac'));}var _0x561d03=_0x9fd023[_0xc9ef('0xad')];if(this[_0xc9ef('0x81')](_0x9fd023[_0xc9ef('0x74')])){_0x561d03+=','+_0x9fd023[_0xc9ef('0x74')];}var _0x1b00ff=this['channel'][_0xc9ef('0xa9')](_0xc9ef('0xae'),_0x561d03);if(_0x1b00ff[_0xc9ef('0xa2')]===-0x1){return _0x1b00ff;}var _0x5e7635=this[_0xc9ef('0xa1')](_0xc9ef('0xcc'),_0xc9ef('0xcd'));if(_0x5e7635[_0xc9ef('0xa2')]===-0x1){return _0x5e7635;}var _0xb06252=this[_0xc9ef('0xa1')]('RECOG_INPUT()',_0xc9ef('0xce'));if(_0xb06252[_0xc9ef('0xa2')]===-0x1){return _0xb06252;}var _0x59bd93=this[_0xc9ef('0xa1')](_0xc9ef('0xc9'),_0xc9ef('0xcf'));if(_0x59bd93[_0xc9ef('0xa2')]===-0x1){return _0x59bd93;}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xb2'),_0x561d03));};AGIVertices['prototype'][_0xc9ef('0xd0')]=function(_0x423d31){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0xd1'),_0x423d31[_0xc9ef('0x39')]));if(!this['isConfigured'](_0x423d31[_0xc9ef('0xd2')])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x423d31,_0xc9ef('0xd3'));}var _0x733fa5=this['getSquareOdbc'][_0xc9ef('0x6e')](this,_0x423d31[_0xc9ef('0xd2')]);if(!_0x733fa5){return this[_0xc9ef('0xe')]['error'](_0x423d31,_0xc9ef('0xd4'));}if(!this[_0xc9ef('0x81')](_0x423d31['query'])){return this['channel'][_0xc9ef('0x2d')](_0x423d31,_0xc9ef('0xd5'));}var _0x3cd3ed=_0x423d31[_0xc9ef('0xd6')][_0xc9ef('0x57')](/(\r\n|\n|\r)/gm,'\x20');this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xd7'),_0x3cd3ed));var _0x1463c3=this['getQueryOdbc'][_0xc9ef('0x6e')](this,_0x733fa5,_0x3cd3ed);this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x423d31,_0x3cd3ed);if(!this[_0xc9ef('0x81')](_0x423d31[_0xc9ef('0xd8')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xd9'));}var _0x343a68=this[_0xc9ef('0x10')][_0xc9ef('0x6e')](this,_0x423d31[_0xc9ef('0xd8')]);if(!_0x343a68){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x423d31,'no\x20variable\x20found');}var _0x4ccab=this;_0x1463c3[_0xc9ef('0xda')](function(_0x213717,_0xc577e3){Object[_0xc9ef('0xdb')](_0x213717)[_0xc9ef('0xda')](function(_0x3ce224){_0x4ccab[_0xc9ef('0xe')][_0xc9ef('0x9c')](util['format'](_0xc9ef('0xdc'),_0x343a68,_0xc577e3,_0x3ce224),_0x213717[_0x3ce224]);});});this[_0xc9ef('0xe')]['setVariable'](util[_0xc9ef('0x56')](_0xc9ef('0xdd'),_0x343a68),_0x1463c3[_0xc9ef('0x99')]);return this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0xde'),_0x343a68));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xdf')]=function(_0x426dcc){logger[_0xc9ef('0xe0')](util[_0xc9ef('0x56')](_0xc9ef('0xe1'),_0x426dcc['label']));if(!this[_0xc9ef('0x81')](_0x426dcc['sip_id'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x426dcc,_0xc9ef('0xe2'));}var _0xd36d8a=this[_0xc9ef('0x1d')][_0xc9ef('0x6e')](this,_0x426dcc['sip_id']);if(!_0xd36d8a){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x426dcc,_0xc9ef('0xe3'));}var _0x3fa98e=this[_0xc9ef('0xe')]['exec'](_0xc9ef('0xe4'),[util[_0xc9ef('0x56')]('SIP/%s',_0xd36d8a),_0x426dcc[_0xc9ef('0x64')],_0x426dcc[_0xc9ef('0xe5')],_0x426dcc[_0xc9ef('0x62')]]);if(_0x3fa98e[_0xc9ef('0xa2')]===-0x1){return _0x3fa98e;}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xe6'),_0xc9ef('0xe4')));};AGIVertices[_0xc9ef('0x14')]['dialogflow']=function(_0x321e5c){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0xe7'),_0x321e5c[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x321e5c[_0xc9ef('0x7f')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xe8'));}if(!this[_0xc9ef('0x81')](_0x321e5c[_0xc9ef('0x5b')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}this[_0xc9ef('0xe')][_0xc9ef('0xe9')]=!![];this[_0xc9ef('0x37')](_0x321e5c);this[_0xc9ef('0x42')](_0x321e5c[_0xc9ef('0x5b')],'in','','');this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format']('Trying\x20Dialogflow:\x20%s',_0x321e5c[_0xc9ef('0x5b')]));var _0x5c2090=this[_0xc9ef('0x75')][_0xc9ef('0x6e')](this,_0x321e5c);if(_0x5c2090){for(var _0x594371 in _0x5c2090){if(_0x5c2090['hasOwnProperty'](_0x594371)){this[_0xc9ef('0xe')]['setVariable'](util[_0xc9ef('0x56')]('DIALOGFLOW_%s',_0x594371[_0xc9ef('0x68')]()),_0x5c2090[_0x594371]);}}this[_0xc9ef('0x42')](_0x5c2090[_0xc9ef('0xea')],_0xc9ef('0xeb'),_0xc9ef('0xec'),'');return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0xed'),_0x5c2090['speech']));}return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x321e5c,_0xc9ef('0xee'));};AGIVertices['prototype']['dialogflowV2']=function(_0x13d5fa){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x13d5fa[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x13d5fa[_0xc9ef('0xef')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xf0'));}if(!this[_0xc9ef('0x81')](_0x13d5fa[_0xc9ef('0x77')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xf1'));}if(!this[_0xc9ef('0x81')](_0x13d5fa[_0xc9ef('0x78')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xf2'));}if(!this[_0xc9ef('0x81')](_0x13d5fa[_0xc9ef('0x79')])){return this['channel'][_0xc9ef('0xa8')]('no\x20anguage\x20configured');}if(!this[_0xc9ef('0x81')](_0x13d5fa['text'])){return this[_0xc9ef('0xe')]['noop']('no\x20text\x20configured');}this[_0xc9ef('0xe')][_0xc9ef('0xe9')]=!![];this['createSquareDetailsReport'](_0x13d5fa);this['createSquareMessage'](_0x13d5fa['text'],'in','','');this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xf3'),_0x13d5fa['text']));var _0x37e239=this[_0xc9ef('0x76')][_0xc9ef('0x6e')](this,_0x13d5fa);if(_0x37e239){for(var _0x21ead5 in _0x37e239){if(_0x37e239[_0xc9ef('0x92')](_0x21ead5)){if(_0x21ead5!==_0xc9ef('0xf4')){this['channel']['setVariable'](util[_0xc9ef('0x56')](_0xc9ef('0xf5'),_0x21ead5[_0xc9ef('0x68')]()),_0x37e239[_0x21ead5]);}}}this[_0xc9ef('0x42')](_0x37e239[_0xc9ef('0xea')],_0xc9ef('0xeb'),_0xc9ef('0xf6'),_0x37e239[_0xc9ef('0xf4')]);return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0xf7'),_0x37e239[_0xc9ef('0xea')]));}return this['channel'][_0xc9ef('0x2d')](_0x13d5fa,_0xc9ef('0xf8'));};AGIVertices[_0xc9ef('0x14')]['sesteknda']=function(_0x4812cf){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0xf9'),_0x4812cf[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x4812cf[_0xc9ef('0xfa')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0xfb'));}if(!this[_0xc9ef('0x81')](_0x4812cf[_0xc9ef('0xfc')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xfd'));}if(!this[_0xc9ef('0x81')](_0x4812cf[_0xc9ef('0xfe')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0xff'));}if(!this[_0xc9ef('0x81')](_0x4812cf['ndassistant_url'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}this['channel'][_0xc9ef('0xe9')]=!![];this[_0xc9ef('0x37')](_0x4812cf);this[_0xc9ef('0x42')](_0x4812cf[_0xc9ef('0x5b')],'in','','');this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x100'),_0x4812cf[_0xc9ef('0x5b')]));var _0x1ea210=this[_0xc9ef('0x101')][_0xc9ef('0x6e')](this,_0x4812cf);if(_0x1ea210){for(var _0x3c1c92 in _0x1ea210){if(_0x1ea210['hasOwnProperty'](_0x3c1c92)){this['channel'][_0xc9ef('0x9c')](util[_0xc9ef('0x56')](_0xc9ef('0x102'),_0x3c1c92[_0xc9ef('0x68')]()),_0x1ea210[_0x3c1c92]);}}this[_0xc9ef('0x42')](_0x1ea210[_0xc9ef('0xea')],'out',_0xc9ef('0x103'),'');if(_0x1ea210['audiofile']){this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x104'),_0x1ea210['audiofile']));var _0x4249f4=this['channel'][_0xc9ef('0x105')](_0x1ea210[_0xc9ef('0x106')]);try{fs[_0xc9ef('0x107')](_0x1ea210[_0xc9ef('0x106')]+_0xc9ef('0x108'));}catch(_0x486127){logger[_0xc9ef('0x2d')](_0x486127);}return _0x4249f4;}else{return this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0x109'),_0x1ea210[_0xc9ef('0xea')]));}}return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x4812cf,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x10a')]=function(_0x5a06d6){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x10b'),_0x5a06d6[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('end');};AGIVertices['prototype'][_0xc9ef('0x10c')]=function(_0x184eac){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x184eac[_0xc9ef('0x39')]));var _0x444fe0='';if(_0x184eac[_0xc9ef('0x10d')]){if(!this[_0xc9ef('0x81')](_0x184eac[_0xc9ef('0x10d')])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x184eac,'no\x20trunk\x20selected');}else{var _0x4a84f0=parseInt(_0x184eac[_0xc9ef('0x10d')],0xa);if(isNaN(_0x4a84f0)){_0x444fe0=_0x184eac['trunk_id'];}else{_0x444fe0=this[_0xc9ef('0x1e')][_0xc9ef('0x6e')](this,_0x184eac[_0xc9ef('0x10d')]);if(!_0x444fe0){return this['channel'][_0xc9ef('0x2d')](_0x184eac,'no\x20trunk\x20found');}}}}else if(_0x184eac[_0xc9ef('0x10e')]){_0x444fe0=_0x184eac['trunk_name'];}else{return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x184eac,_0xc9ef('0x10f'));}var _0x35c5c2=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0xe4'),[util[_0xc9ef('0x56')](_0xc9ef('0x110'),_0x444fe0,_0x184eac[_0xc9ef('0x49')]),_0x184eac[_0xc9ef('0x64')],_0x184eac[_0xc9ef('0xe5')],_0x184eac[_0xc9ef('0x62')]]);if(_0x35c5c2[_0xc9ef('0xa2')]===-0x1){return _0x35c5c2;}return this['channel'][_0xc9ef('0xa8')](util['format'](_0xc9ef('0xe6'),_0xc9ef('0xe4')));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x111')]=function(_0x9409c0){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x112'),_0x9409c0[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('finally');};AGIVertices['prototype'][_0xc9ef('0xc')]=function(_0x264b9e){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x113'),_0x264b9e[_0xc9ef('0x39')]));if(_0x264b9e[_0xc9ef('0xa5')]===0x0){return this[_0xc9ef('0xa4')](_0x264b9e);}_0x264b9e[_0xc9ef('0xa5')]-=0x1;if(!this[_0xc9ef('0x81')](_0x264b9e['file_id'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x264b9e,_0xc9ef('0x114'));}var _0x3e2a87=this[_0xc9ef('0x1f')]['sync'](this,_0x264b9e[_0xc9ef('0x115')]);if(!_0x3e2a87){return this['channel'][_0xc9ef('0x2d')](_0x264b9e,_0xc9ef('0x116'));}if(!this[_0xc9ef('0x81')](_0x264b9e[_0xc9ef('0xd8')])){return this['channel']['error'](_0xc9ef('0xd9'));}var _0x3b416f=this[_0xc9ef('0xe')][_0xc9ef('0x117')](_0x3e2a87,_0x264b9e[_0xc9ef('0x118')],_0x264b9e[_0xc9ef('0x119')]);var _0x3216a9=_0x3b416f[_0xc9ef('0xa2')]?_0x3b416f[_0xc9ef('0xa2')][_0xc9ef('0xa0')]():'';logger[_0xc9ef('0x2f')](_0xc9ef('0x11a'),JSON[_0xc9ef('0x9d')](_0x3b416f));if(_0x3b416f[_0xc9ef('0xa2')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x264b9e,_0x3216a9);return _0x3b416f;}else if(_0x3b416f[_0xc9ef('0x9f')]===_0xc9ef('0x64')){_0x3b416f[_0xc9ef('0xa2')]=_0x3216a9['length']>=parseInt(_0x264b9e[_0xc9ef('0x11b')])?'x':'i';}else{_0x3b416f[_0xc9ef('0xa2')]=_0x3216a9[_0xc9ef('0x99')]>=parseInt(_0x264b9e['mindigit'])&&_0x3216a9[_0xc9ef('0x99')]<=parseInt(_0x264b9e['maxdigit'])?'x':'i';}var _0x126ea5=this['getVariable']['sync'](this,_0x264b9e[_0xc9ef('0xd8')]);if(!_0x126ea5){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x264b9e,_0xc9ef('0x11c'));}this['channel'][_0xc9ef('0x9c')](_0x126ea5,_0x3216a9);if(this[_0xc9ef('0x81')](_0x264b9e[_0xc9ef('0x11d')])){var _0x2aeadd=parseInt(_0x264b9e[_0xc9ef('0x11d')],0xa);var _0x3d4e76=rs[_0xc9ef('0x11e')]({'charset':'*','length':_0x2aeadd});var _0x890848=_0x3216a9[_0xc9ef('0x99')];if(_0x890848>0x0){if(_0x890848>_0x2aeadd){this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x264b9e,_0x264b9e[_0xc9ef('0x11f')]===_0xc9ef('0x120')?_0x3d4e76+_0x3216a9[_0xc9ef('0x121')](_0x2aeadd):_0x3216a9[_0xc9ef('0x121')](0x0,_0x890848-_0x2aeadd)+_0x3d4e76);}else{this[_0xc9ef('0x37')]['sync'](this,_0x264b9e,rs[_0xc9ef('0x11e')]({'charset':'*','length':_0x890848}));}}else{this['createSquareDetailsReport']['sync'](this,_0x264b9e,'');}}else{this[_0xc9ef('0x37')]['sync'](this,_0x264b9e,_0x3216a9);}return _0x3b416f;};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xd')]=function(_0x8dcb07){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x122'),_0x8dcb07[_0xc9ef('0x39')]));return this['getdigits'](_0x8dcb07);};AGIVertices[_0xc9ef('0x14')]['goal']=function(_0x3a05c0){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x123'),_0x3a05c0[_0xc9ef('0x39')]));this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x3a05c0,_0x3a05c0[_0xc9ef('0x124')]);return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x125'),_0x3a05c0['goalname']));};AGIVertices['prototype'][_0xc9ef('0x126')]=function(_0xd048e9){logger['info'](util[_0xc9ef('0x56')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0xd048e9['label']));if(!this[_0xc9ef('0x81')](_0xd048e9[_0xc9ef('0x84')])||!this['isConfigured'](_0xd048e9[_0xc9ef('0x85')])){return this[_0xc9ef('0xe')]['noop'](_0xc9ef('0x127'));}if(!this[_0xc9ef('0x81')](_0xd048e9[_0xc9ef('0x5b')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0x128'),_0xd048e9[_0xc9ef('0x5b')]));var _0x453081=this['awsPolly']['sync'](this,_0xd048e9);if(_0x453081){this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x129'),_0x453081));var _0x566248=this['channel'][_0xc9ef('0x105')](_0x453081);try{fs[_0xc9ef('0x107')](_0x453081+_0xc9ef('0x108'));}catch(_0x43c2a2){logger['error'](_0x43c2a2);}return _0x566248;}return this['channel'][_0xc9ef('0x2d')](_0xd048e9,_0xc9ef('0x12a'));};AGIVertices[_0xc9ef('0x14')]['awslex']=function(_0x202c96){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x12b'),_0x202c96[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x202c96['aws_access_key_id'])||!this[_0xc9ef('0x81')](_0x202c96['aws_secret_access_key'])){return this[_0xc9ef('0xe')]['noop'](_0xc9ef('0x127'));}if(!this[_0xc9ef('0x81')](_0x202c96[_0xc9ef('0x8a')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0x12c'));}if(!this[_0xc9ef('0x81')](_0x202c96[_0xc9ef('0x5b')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}this[_0xc9ef('0xe')][_0xc9ef('0xe9')]=!![];this[_0xc9ef('0x37')](_0x202c96);this[_0xc9ef('0x42')](_0x202c96['text'],'in','','');this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x202c96[_0xc9ef('0x5b')]));var _0x281bdf=this[_0xc9ef('0x12d')][_0xc9ef('0x6e')](this,_0x202c96);if(_0x281bdf){for(var _0x10f1f8 in _0x281bdf){if(_0x281bdf['hasOwnProperty'](_0x10f1f8)&&_[_0xc9ef('0x93')](_0x281bdf[_0x10f1f8])){this[_0xc9ef('0xe')][_0xc9ef('0x9c')](util[_0xc9ef('0x56')](_0xc9ef('0x12e'),_0x10f1f8[_0xc9ef('0x68')]()),_0x281bdf[_0x10f1f8]);}}if(_[_0xc9ef('0x44')](_0x281bdf[_0xc9ef('0x12f')])){return this['channel'][_0xc9ef('0xa8')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xc9ef('0x42')](_0x281bdf[_0xc9ef('0x12f')],_0xc9ef('0xeb'),_0xc9ef('0x130'),'');return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x131'),_0x281bdf[_0xc9ef('0x12f')]));}}return this['channel'][_0xc9ef('0x2d')](_0x202c96,_0xc9ef('0x132'));};AGIVertices['prototype'][_0xc9ef('0x133')]=function(_0x1166bd){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x134'),_0x1166bd[_0xc9ef('0x39')],_0x1166bd[_0xc9ef('0x64')]));if(!this['isConfigured'](_0x1166bd[_0xc9ef('0x7f')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('no\x20key\x20configured');}var _0x453ac3='wav';var _0x240f6e=util[_0xc9ef('0x56')]('%s/recordings/%s',FILES_PATH,rs[_0xc9ef('0x11e')](0x4));var _0x418f41=util[_0xc9ef('0x56')](_0xc9ef('0x9b'),_0x240f6e,_0x453ac3);var _0x4caae4=!![];if(_0x1166bd[_0xc9ef('0x135')]===_0xc9ef('0x136')){_0x4caae4=![];}var _0x319b5a=this['channel'][_0xc9ef('0x137')](_0x240f6e,_0x453ac3,_0x1166bd[_0xc9ef('0x138')],_0x1166bd[_0xc9ef('0x64')],undefined,_0x4caae4);if(_0x319b5a[_0xc9ef('0xa2')]!==-0x1){this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x139'),_0x418f41));var _0x10f14d=this[_0xc9ef('0x8b')][_0xc9ef('0x6e')](this,_0x1166bd,_0x418f41);if(_0x10f14d){for(var _0x228ead in _0x10f14d){if(_0x10f14d[_0xc9ef('0x92')](_0x228ead)){this['channel'][_0xc9ef('0x9c')](util['format']('GOOGLE_ASR_%s',_0x228ead[_0xc9ef('0x68')]()),_0x10f14d[_0x228ead]);}}return this['channel']['noop'](util['format'](_0xc9ef('0x13a'),JSON[_0xc9ef('0x9d')](_0x10f14d)));}}return _0x319b5a;};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x13b')]=function(_0x112996){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x13c'),_0x112996['label']));if(!this[_0xc9ef('0x81')](_0x112996['appid'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0x13d'));}if(!this[_0xc9ef('0x81')](_0x112996[_0xc9ef('0x8f')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('no\x20appsecret\x20configured');}var _0x5102d9='wav';var _0x129cb7=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xc9ef('0x11e')](0x4));var _0x48f5f7=util[_0xc9ef('0x56')](_0xc9ef('0x9b'),_0x129cb7,_0x5102d9);var _0x220ecc=!![];if(_0x112996[_0xc9ef('0x135')]===_0xc9ef('0x136')){_0x220ecc=![];}var _0x547e2a=this[_0xc9ef('0xe')]['recordFile'](_0x129cb7,_0x5102d9,_0x112996[_0xc9ef('0x138')],_0x112996['timeout'],undefined,_0x220ecc);if(_0x547e2a[_0xc9ef('0xa2')]!==-0x1){this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')]('tilde\x20%s\x20file\x20created',_0x48f5f7));var _0x433bdf=this['tildeASR'][_0xc9ef('0x6e')](this,_0x112996,_0x48f5f7);if(_0x433bdf){for(var _0x4902d7 in _0x433bdf){if(_0x433bdf[_0xc9ef('0x92')](_0x4902d7)){this[_0xc9ef('0xe')][_0xc9ef('0x9c')](util['format'](_0xc9ef('0x13e'),_0x4902d7[_0xc9ef('0x68')]()),_0x433bdf[_0x4902d7]);}}return this['channel']['noop'](util[_0xc9ef('0x56')]('TildeASR\x20Result\x20%s',JSON[_0xc9ef('0x9d')](_0x433bdf)));}}return _0x547e2a;};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x13f')]=function(_0x5cbe53){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x140'),_0x5cbe53[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0x141')](_0x5cbe53['context'],_0x5cbe53[_0xc9ef('0x142')],_0x5cbe53[_0xc9ef('0x3f')]);};AGIVertices[_0xc9ef('0x14')]['gotoif']=function(_0x5c5dad){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x143'),_0x5c5dad[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x5c5dad[_0xc9ef('0x144')])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x5c5dad,'no\x20condition\x20configured');}try{var _0x2e4760=eval(_0x5c5dad[_0xc9ef('0x144')])?_0xc9ef('0x145'):_0xc9ef('0x146');this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x147'),_0x5c5dad[_0xc9ef('0x144')],_0x2e4760));return{'code':0xc8,'result':_0x2e4760};}catch(_0x1c99c1){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x148')]=function(_0x1f7304){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x149'),_0x1f7304[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x1f7304[_0xc9ef('0x14a')])){return this[_0xc9ef('0xe')]['error'](_0x1f7304,'no\x20interval\x20configured');}var _0x196386=this['getIntervals']['sync'](this,_0x1f7304[_0xc9ef('0x14a')]);if(!_0x196386){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x1f7304,_0xc9ef('0x14b'));}for(var _0x543c28=0x0;_0x543c28<_0x196386['length'];_0x543c28+=0x1){var _0x279bd9=this[_0xc9ef('0xe')][_0xc9ef('0x10')](util['format']('IFTIME(%s?true:false)',_0x196386[_0x543c28]));if(_0x279bd9['result']===-0x1){return _0x279bd9;}logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x14c'),_0x196386[_0x543c28],_0x279bd9[_0xc9ef('0x9f')]));if(_0x279bd9[_0xc9ef('0x9f')]===_0xc9ef('0x145')){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x14c'),_0x196386[_0x543c28],_0xc9ef('0x145')));this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0x14c'),_0x196386[_0x543c28],_0xc9ef('0x145')));return{'code':0xc8,'result':'true'};}else{logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x14c'),_0x196386[_0x543c28],_0xc9ef('0x146')));this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('IFTIME\x20%s\x20%s',_0x196386[_0x543c28],'false'));}}return{'code':0xc8,'result':_0xc9ef('0x146')};};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x14d')]=function(_0xf6e8bd){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x14e'),_0xf6e8bd[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0x14d')]();};AGIVertices[_0xc9ef('0x14')]['ispeechasr']=function(_0x41e07f){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x14f'),_0x41e07f[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x41e07f[_0xc9ef('0x7f')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0xe8'));}var _0x1adb5a=_0xc9ef('0x150');var _0x8b6352=util['format'](_0xc9ef('0x151'),FILES_PATH,rs['generate'](0x4));var _0xa6a933=util[_0xc9ef('0x56')](_0xc9ef('0x9b'),_0x8b6352,_0x1adb5a);var _0x12a58a=!![];if(_0x41e07f[_0xc9ef('0x135')]===_0xc9ef('0x136')){_0x12a58a=![];}var _0x32383f=this[_0xc9ef('0xe')][_0xc9ef('0x137')](_0x8b6352,_0x1adb5a,_0x41e07f[_0xc9ef('0x138')],_0x41e07f[_0xc9ef('0x64')],undefined,_0x12a58a);if(_0x32383f[_0xc9ef('0xa2')]!==-0x1){this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x152'),_0xa6a933));var _0x3a97c8=this[_0xc9ef('0x7e')][_0xc9ef('0x6e')](this,_0x41e07f,_0xa6a933);if(_0x3a97c8){for(var _0x4bc2a6 in _0x3a97c8){if(_0x3a97c8[_0xc9ef('0x92')](_0x4bc2a6)){this[_0xc9ef('0xe')][_0xc9ef('0x9c')](util[_0xc9ef('0x56')](_0xc9ef('0x153'),_0x4bc2a6[_0xc9ef('0x68')]()),_0x3a97c8[_0x4bc2a6]);}}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x154'),JSON[_0xc9ef('0x9d')](_0x3a97c8)));}}return _0x32383f;};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x155')]=function(_0x148f5c){logger['info'](util['format'](_0xc9ef('0x156'),_0x148f5c[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x148f5c[_0xc9ef('0x7f')])){return this[_0xc9ef('0xe')]['noop'](_0xc9ef('0xe8'));}if(!this[_0xc9ef('0x81')](_0x148f5c['text'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('no\x20text\x20configured');}this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x157'),_0x148f5c[_0xc9ef('0x5b')]));var _0x37ef76=this['ispeechTTS'][_0xc9ef('0x6e')](this,_0x148f5c);if(_0x37ef76){this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('ispeech\x20%s\x20file\x20created',_0x37ef76));var _0x36f978=this[_0xc9ef('0xe')][_0xc9ef('0x105')](_0x37ef76,_0x148f5c[_0xc9ef('0x138')]);try{fs[_0xc9ef('0x107')](_0x37ef76+'.wav');}catch(_0x17654c){logger[_0xc9ef('0x2d')](_0x17654c);}return _0x36f978;}return this[_0xc9ef('0xe')]['error'](_0x148f5c,_0xc9ef('0x158'));};AGIVertices['prototype']['login']=function(_0x29814d){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x29814d[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x29814d['findBy'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x29814d,_0xc9ef('0x159'));}logger['info'](util['format'](_0xc9ef('0x15a'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x29814d[_0xc9ef('0x15b')]));var _0x47977d=this['agentLogin'][_0xc9ef('0x6e')](this,_0x29814d[_0xc9ef('0x15b')]);if(_0x47977d){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x15c'),this[_0xc9ef('0xe')]['callerid'],_0x29814d[_0xc9ef('0x15b')]));this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x29814d['findBy']));return{'code':0xc8,'result':_0xc9ef('0x15d')};}else{logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x15e'),this['channel']['callerid'],_0x29814d[_0xc9ef('0x15b')]));this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x29814d[_0xc9ef('0x15b')]));return{'code':0xc8,'result':_0xc9ef('0x15f')};}};AGIVertices[_0xc9ef('0x14')]['logout']=function(_0x5e5d2b){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x160'),_0x5e5d2b[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x5e5d2b['findBy'])){return this[_0xc9ef('0xe')]['error'](_0x5e5d2b,_0xc9ef('0x159'));}logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x15a'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x5e5d2b[_0xc9ef('0x15b')]));var _0x7c08e6=this[_0xc9ef('0x53')][_0xc9ef('0x6e')](this,_0x5e5d2b[_0xc9ef('0x15b')]);if(_0x7c08e6){logger['info'](util[_0xc9ef('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x5e5d2b[_0xc9ef('0x15b')]));this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xc9ef('0x3c')],_0x5e5d2b['findBy']));return{'code':0xc8,'result':_0xc9ef('0x15d')};}else{logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xc9ef('0xe')]['callerid'],_0x5e5d2b[_0xc9ef('0x15b')]));this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x15e'),this[_0xc9ef('0xe')]['callerid'],_0x5e5d2b['findBy']));return{'code':0xc8,'result':_0xc9ef('0x15f')};}};AGIVertices[_0xc9ef('0x14')]['math']=function(_0x447d4e){logger[_0xc9ef('0x2f')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x447d4e[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x447d4e['operation'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x447d4e,_0xc9ef('0x161'));}this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format']('math\x20%s',_0x447d4e[_0xc9ef('0x162')]));var _0x2f08ae=eval(_0x447d4e[_0xc9ef('0x162')]);if(!this[_0xc9ef('0x81')](_0x447d4e['variable_id'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xd9'));}var _0x1c71d0=this['getVariable']['sync'](this,_0x447d4e[_0xc9ef('0xd8')]);if(!_0x1c71d0){return this[_0xc9ef('0xe')]['error'](_0x447d4e,_0xc9ef('0x11c'));}if(_[_0xc9ef('0x98')](_0x2f08ae)){var _0x48ddc5=this;_0x2f08ae[_0xc9ef('0xda')](function(_0x565bd9,_0x11a6f9){_0x48ddc5[_0xc9ef('0xe')]['setVariable'](util[_0xc9ef('0x56')]('%s[%s]',_0x1c71d0,_0x11a6f9),_0x565bd9);});return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x163'),_0x1c71d0));}else{return this['channel'][_0xc9ef('0x9c')](_0x1c71d0,_0x2f08ae);}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xb')]=function(_0x41a2c1){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x164'),_0x41a2c1[_0xc9ef('0x39')]));if(_0x41a2c1['retry']===0x0){return this[_0xc9ef('0xa4')](_0x41a2c1);}_0x41a2c1[_0xc9ef('0xa5')]-=0x1;if(!this[_0xc9ef('0x81')](_0x41a2c1['file_id'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x41a2c1,_0xc9ef('0x114'));}var _0x15c874=this[_0xc9ef('0x1f')][_0xc9ef('0x6e')](this,_0x41a2c1[_0xc9ef('0x115')]);if(!_0x15c874){return this[_0xc9ef('0xe')]['error'](_0x41a2c1,_0xc9ef('0x116'));}var _0x1cbb53=this[_0xc9ef('0xe')][_0xc9ef('0x117')](_0x15c874,_0x41a2c1['response'],_0x41a2c1[_0xc9ef('0x165')]);var _0x391aa6=_0x1cbb53['result'];if(_0x1cbb53[_0xc9ef('0xa2')]===-0x1){this[_0xc9ef('0x37')]['sync'](this,_0x41a2c1,'-1');return _0x1cbb53;}else if(_0x1cbb53['extra']===_0xc9ef('0x64')){_0x1cbb53['result']=_0x1cbb53[_0xc9ef('0xa2')]['length']>0x0?_0x1cbb53['result']:'t';}else if(_[_0xc9ef('0x47')](_0x1cbb53[_0xc9ef('0xa2')])){_0x1cbb53[_0xc9ef('0xa2')]='#';_0x391aa6='#';}if(!this[_0xc9ef('0x81')](_0x41a2c1[_0xc9ef('0xd8')])){this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xd9'));}else{var _0x3bd069=this[_0xc9ef('0x10')][_0xc9ef('0x6e')](this,_0x41a2c1['variable_id']);if(!_0x3bd069){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x41a2c1,_0xc9ef('0x11c'));}this['channel'][_0xc9ef('0x9c')](_0x3bd069,_0x391aa6);}this['createSquareDetailsReport']['sync'](this,_0x41a2c1,_0x391aa6);return _0x1cbb53;};AGIVertices['prototype']['noop']=function(_0x14f9b3){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x166'),_0x14f9b3['label']));return this[_0xc9ef('0xe')]['noop'](_0x14f9b3[_0xc9ef('0x167')]||_0x14f9b3[_0xc9ef('0x39')]);};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x168')]=function(_0x495221){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x169'),_0x495221[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x495221['findBy'])){return this['channel'][_0xc9ef('0x2d')](_0x495221,_0xc9ef('0x159'));}logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x15a'),this[_0xc9ef('0xe')]['callerid'],_0x495221[_0xc9ef('0x15b')]));var _0x2d2281=this['getPause'][_0xc9ef('0x6e')](this,_0x495221[_0xc9ef('0x16a')]);var _0x3c4d22=this[_0xc9ef('0x50')][_0xc9ef('0x6e')](this,_0x495221['findBy'],_0x2d2281);if(_0x3c4d22){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x15c'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x495221[_0xc9ef('0x15b')]));this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x15c'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x495221['findBy']));return{'code':0xc8,'result':_0xc9ef('0x15d')};}else{logger['info'](util[_0xc9ef('0x56')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xc9ef('0x3c')],_0x495221['findBy']));this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x15c'),this[_0xc9ef('0xe')]['callerid'],_0x495221['findBy']));return{'code':0xc8,'result':_0xc9ef('0x15f')};}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x16b')]=function(_0x3df1fd){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x16c'),_0x3df1fd['label']));if(!this['isConfigured'](_0x3df1fd['file_id'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x3df1fd,_0xc9ef('0x114'));}var _0x3697ef=this[_0xc9ef('0x1f')][_0xc9ef('0x6e')](this,_0x3df1fd[_0xc9ef('0x115')]);if(!_0x3697ef){return this[_0xc9ef('0xe')]['error'](_0x3df1fd,'no\x20file\x20audio\x20found');}var _0x392f10=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0x16d'),[_0x3697ef,_0x3df1fd['opts']]);if(_0x392f10[_0xc9ef('0xa2')]===-0x1){return _0x392f10;}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xbf'),_0xc9ef('0x16d'),_0x3697ef));};AGIVertices['prototype'][_0xc9ef('0x16e')]=function(_0x15e7de){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x16f'),_0x15e7de[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x15e7de[_0xc9ef('0x170')])){return this[_0xc9ef('0xe')]['error'](_0x15e7de,'no\x20queue\x20selected');}var _0x11072f='';var _0x51f7dc=parseInt(_0x15e7de[_0xc9ef('0x170')],0xa);if(isNaN(_0x51f7dc)){_0x11072f=_0x15e7de['queue_id'];}else{_0x11072f=this['getVoiceQueue'][_0xc9ef('0x6e')](this,_0x15e7de[_0xc9ef('0x170')]);if(!_0x11072f){return this['channel']['error'](_0x15e7de,_0xc9ef('0x171'));}}var _0x2a7f9b='';if(this[_0xc9ef('0x81')](_0x15e7de[_0xc9ef('0x115')])){var _0xe40fc5=this['getSound'][_0xc9ef('0x6e')](this,_0x15e7de['file_id']);if(_0xe40fc5){_0x2a7f9b=_0xe40fc5;}}this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x15e7de,_0x11072f);if(_0x15e7de[_0xc9ef('0xe5')]['indexOf']('x')<0x0){_0x15e7de[_0xc9ef('0xe5')]+='x';}if(_0x15e7de['opts'][_0xc9ef('0x172')]('X')<0x0){_0x15e7de[_0xc9ef('0xe5')]+='X';}this[_0xc9ef('0xe')][_0xc9ef('0x9c')](_0xc9ef('0x173'),_0x11072f?_0x11072f[_0xc9ef('0x174')]():'');var _0x6d9adc=this[_0xc9ef('0xe')]['exec'](_0xc9ef('0x175'),[_0x11072f,_0x15e7de['opts'],_0x15e7de[_0xc9ef('0x62')],_0x2a7f9b,_0x15e7de[_0xc9ef('0x64')],_0x15e7de[_0xc9ef('0x6')],_0x15e7de[_0xc9ef('0x176')],_0x15e7de[_0xc9ef('0x177')],'',_0x15e7de[_0xc9ef('0x178')]]);if(_0x6d9adc['result']===-0x1){return _0x6d9adc;}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x11072f));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x179')]=function(_0x17d573){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x17a'),_0x17d573[_0xc9ef('0x39')]));var _0x1c7140=_0x17d573['recordingFormat']||_0xc9ef('0x150');var _0x5f3c28=util[_0xc9ef('0x56')](_0xc9ef('0x17b'),this['channel'][_0xc9ef('0x38')],rs[_0xc9ef('0x11e')](0x5));var _0x5c8771=util['format'](_0xc9ef('0x17c'),FILES_PATH,_0x5f3c28,_0x1c7140);var _0x16f7b1=util['format'](_0xc9ef('0x151'),FILES_PATH,_0x5f3c28);this[_0xc9ef('0x3d')][_0xc9ef('0x6e')](this,_0x17d573,_0x5f3c28,_0x5c8771);this[_0xc9ef('0xe')][_0xc9ef('0x9c')](_0xc9ef('0x17d'),_0x5f3c28);logger[_0xc9ef('0x2f')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x16f7b1,_0x1c7140,_0x17d573[_0xc9ef('0x17e')],_0x17d573[_0xc9ef('0x64')]);return this[_0xc9ef('0xe')][_0xc9ef('0x137')](_0x16f7b1,_0x1c7140,_0x17d573[_0xc9ef('0x17e')],_0x17d573[_0xc9ef('0x64')],undefined,!![]);};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x17f')]=function(_0x3b4ae1){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x180'),_0x3b4ae1[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x3b4ae1[_0xc9ef('0x62')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0x181'));}var _0x24de27=this[_0xc9ef('0x61')][_0xc9ef('0x6e')](this,_0x3b4ae1);logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x182'),util[_0xc9ef('0x183')](_0x24de27,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x3b4ae1[_0xc9ef('0xd8')])){return this[_0xc9ef('0xe')]['noop'](_0xc9ef('0x184'));}var _0x18125a=this[_0xc9ef('0x10')][_0xc9ef('0x6e')](this,_0x3b4ae1['variable_id']);if(!_0x18125a){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x3b4ae1,_0xc9ef('0x11c'));}this['channel'][_0xc9ef('0x9c')](util[_0xc9ef('0x56')](_0xc9ef('0x185'),_0x18125a),_0x24de27['statusCode']?_0x24de27[_0xc9ef('0x186')]:_0xc9ef('0x187'));this[_0xc9ef('0xe')]['setVariable'](util[_0xc9ef('0x56')]('%s_STATUS_MESSAGE',_0x18125a),_0x24de27['statusMessage']?_0x24de27[_0xc9ef('0x72')]:'OK');if(_0x24de27['body']){try{this['saveRestApiResult'](_0x24de27[_0xc9ef('0x71')],_0x18125a);}catch(_0x128b5f){logger[_0xc9ef('0x2d')](util[_0xc9ef('0x56')](_0xc9ef('0x188'),_0x18125a));}}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('variable\x20%s\x20set',_0x18125a));};AGIVertices['prototype']['saydigits']=function(_0x2c7900){logger[_0xc9ef('0x2f')](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x2c7900[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')]['sayDigits'](_0x2c7900[_0xc9ef('0x189')][_0xc9ef('0x57')](/\s+/g,''),_0x2c7900[_0xc9ef('0x17e')]);};AGIVertices['prototype'][_0xc9ef('0x18a')]=function(_0x21222b){logger['info'](util['format'](_0xc9ef('0x18b'),_0x21222b[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0x18c')](_0x21222b[_0xc9ef('0x65')][_0xc9ef('0x57')](/\s+/g,''),_0x21222b[_0xc9ef('0x17e')]);};AGIVertices[_0xc9ef('0x14')]['sayphonetic']=function(_0x308d03){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x18d'),_0x308d03[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0x18e')](_0x308d03[_0xc9ef('0x5b')],_0x308d03[_0xc9ef('0x17e')]);};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x18f')]=function(_0x3d5d0c){logger['info'](util[_0xc9ef('0x56')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x3d5d0c['label']));if(!this['isConfigured'](_0x3d5d0c[_0xc9ef('0x190')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0x191'));}var _0x1fe881=this[_0xc9ef('0x192')][_0xc9ef('0x6e')](this,_0x3d5d0c[_0xc9ef('0x190')]);if(!_0x1fe881||!_0x1fe881[_0xc9ef('0x193')]){return this[_0xc9ef('0xe')]['error'](_0x3d5d0c,_0xc9ef('0x194'));}var _0x5e9a88={'from':util[_0xc9ef('0x56')]('\x22%s\x22\x20<%s>',_0x1fe881[_0xc9ef('0x12')],_0x1fe881['email']||_0x1fe881[_0xc9ef('0x193')][_0xc9ef('0x195')]),'to':_0x3d5d0c['to']||'','cc':_0x3d5d0c['cc']||'','bcc':_0x3d5d0c[_0xc9ef('0x196')]||'','subject':_0x3d5d0c['subject'],'html':_0x3d5d0c[_0xc9ef('0x5b')],'text':_0x3d5d0c['text']};if(this['isConfigured'](_0x3d5d0c[_0xc9ef('0x197')])){}logger[_0xc9ef('0xe0')](_0xc9ef('0x198'),JSON[_0xc9ef('0x9d')](_0x5e9a88));this[_0xc9ef('0x37')]['sync'](this,_0x3d5d0c,_0x3d5d0c[_0xc9ef('0x190')]);this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x199'),_0x1fe881[_0xc9ef('0x12')]));this[_0xc9ef('0x23')][_0xc9ef('0x6e')](this,_0x1fe881[_0xc9ef('0x19a')],_0x5e9a88);return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0x19b'));};AGIVertices['prototype'][_0xc9ef('0x19c')]=function(_0x1226b9){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x19d'),_0x1226b9[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0x19e'));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x19f')]=function(_0x9a621f){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x1a0'),_0x9a621f[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x9a621f[_0xc9ef('0x1a1')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0x1a2'));}var _0x34e0d1=this['getSmsAccount'][_0xc9ef('0x6e')](this,_0x9a621f[_0xc9ef('0x1a1')]);if(!_0x34e0d1){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x9a621f,_0xc9ef('0x1a3'));}var _0x1216ea={'body':_0x9a621f[_0xc9ef('0x1a4')],'phone':_0x9a621f['to']||'','SmsAccountId':_0x34e0d1['id']};logger['debug']('sendSMS\x20message',JSON[_0xc9ef('0x9d')](_0x1216ea));this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x9a621f,_0x9a621f[_0xc9ef('0x1a1')]);this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x1a5'),_0x34e0d1[_0xc9ef('0x12')]));this[_0xc9ef('0x36')]['sync'](this,_0x1216ea);return this['channel']['noop'](_0xc9ef('0x1a6'));};AGIVertices['prototype'][_0xc9ef('0x1a7')]=function(_0x1abe8b){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x1abe8b['label']));if(!this[_0xc9ef('0x81')](_0x1abe8b['variable_id'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x1abe8b,_0xc9ef('0x1a8'));}var _0x25cabc=this['getVariable'][_0xc9ef('0x6e')](this,_0x1abe8b[_0xc9ef('0xd8')]);if(!_0x25cabc){return this['channel'][_0xc9ef('0x2d')](_0x1abe8b,_0xc9ef('0x11c'));}return this['channel'][_0xc9ef('0x9c')](_0x25cabc,_0x1abe8b[_0xc9ef('0x1a9')]);};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x1aa')]=function(_0x1f6149){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x1ab'),_0x1f6149[_0xc9ef('0x39')]));this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0x1ac'));if(_0x1f6149[_0xc9ef('0xb7')]===_0xc9ef('0x1ad')){this['channel'][_0xc9ef('0xa8')](_0xc9ef('0x1ae'));return this[_0xc9ef('0xe')][_0xc9ef('0xb7')]();}return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0x1af'));};AGIVertices[_0xc9ef('0x14')]['subproject']=function(_0x4f4070){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x1b0'),_0x4f4070[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x4f4070[_0xc9ef('0x1b1')])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x4f4070,'no\x20subproject\x20selected');}var _0x48ce45=this[_0xc9ef('0x18')][_0xc9ef('0x6e')](this,_0x4f4070['project_id']);if(!this['isConfigured'](_0x48ce45)){return this[_0xc9ef('0xe')]['error'](_0x4f4070,util[_0xc9ef('0x56')](_0xc9ef('0x1b2'),_0x4f4070[_0xc9ef('0x1b1')]));}if(_0x48ce45===this[_0xc9ef('0xe')]['arg_1']){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x4f4070,_0xc9ef('0x1b3'));}this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x4f4070,_0x48ce45);var _0x3dd088=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0x1b4'),util[_0xc9ef('0x56')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xc9ef('0x6')]['host']||_0xc9ef('0x1b5'),_0x48ce45,this[_0xc9ef('0xe')]['arg_1']));if(_0x3dd088[_0xc9ef('0xa2')]===-0x1){return _0x3dd088;}return this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')]('Executed\x20command\x20%s\x20%s',_0xc9ef('0x1b4'),_0x48ce45));};AGIVertices[_0xc9ef('0x14')]['system']=function(_0xe8fc97){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x1b6'),_0xe8fc97['label']));var _0x218904=this[_0xc9ef('0x1b7')][_0xc9ef('0x6e')](this,_0xe8fc97[_0xc9ef('0xb4')]);this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0xe8fc97,_0xe8fc97[_0xc9ef('0xb4')]);if(this[_0xc9ef('0x81')](_0xe8fc97[_0xc9ef('0xd8')])){var _0x3c170c=this[_0xc9ef('0x10')]['sync'](this,_0xe8fc97[_0xc9ef('0xd8')]);if(_0x3c170c){this[_0xc9ef('0xe')]['setVariable'](_0x3c170c,_0x218904);return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x1b8'),_0xe8fc97[_0xc9ef('0xb4')],_0x3c170c));}}return this['channel']['noop'](util[_0xc9ef('0x56')](_0xc9ef('0x1b9'),_0xe8fc97[_0xc9ef('0xb4')]));};AGIVertices[_0xc9ef('0x14')]['google_cloud_tts']=function(_0xca4789){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x1ba'),_0xca4789[_0xc9ef('0x39')]));_0xca4789[_0xc9ef('0x5b')]=_0xca4789[_0xc9ef('0x5b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc9ef('0x81')](_0xca4789['apiKey'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0x1bb'));}if(!this['isConfigured'](_0xca4789['text'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('no\x20text\x20configured');}this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0x1bc'),_0xca4789[_0xc9ef('0x5b')]));var _0x227998=this[_0xc9ef('0x58')][_0xc9ef('0x6e')](this,_0xca4789);if(_0x227998){this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x1bd'),_0x227998));var _0xaf53a2=this[_0xc9ef('0xe')][_0xc9ef('0x105')](_0x227998);try{fs[_0xc9ef('0x107')](_0x227998+_0xc9ef('0x108'));}catch(_0x39167d){logger[_0xc9ef('0x2d')](_0x39167d);}return _0xaf53a2;}return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0xca4789,_0xc9ef('0x1be'));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x1bf')]=function(_0x524a04){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x524a04[_0xc9ef('0x39')]));_0x524a04['text']=_0x524a04['text'][_0xc9ef('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc9ef('0x81')](_0x524a04[_0xc9ef('0x5b')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}this['channel'][_0xc9ef('0xa8')](util['format']('Trying\x20Google\x20TTS\x20%s',_0x524a04['text']));var _0x1861b1=this[_0xc9ef('0x60')][_0xc9ef('0x6e')](this,_0x524a04);if(_0x1861b1){this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('Google\x20TTS\x20%s\x20file\x20created',_0x1861b1));var _0x1f93e9=this['channel'][_0xc9ef('0x105')](_0x1861b1);try{fs[_0xc9ef('0x107')](_0x1861b1+_0xc9ef('0x108'));}catch(_0x4a72a6){logger[_0xc9ef('0x2d')](_0x4a72a6);}return _0x1f93e9;}return this['channel'][_0xc9ef('0x2d')](_0x524a04,_0xc9ef('0x1c0'));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x1c1')]=function(_0x490e87){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x1c2'),_0x490e87[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x490e87[_0xc9ef('0x15b')])){return this[_0xc9ef('0xe')]['error'](_0x490e87,_0xc9ef('0x159'));}logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x15a'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x490e87[_0xc9ef('0x15b')]));var _0x2e2e8c=this[_0xc9ef('0x52')]['sync'](this,_0x490e87[_0xc9ef('0x15b')]);if(_0x2e2e8c){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x15c'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x490e87[_0xc9ef('0x15b')]));this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x490e87[_0xc9ef('0x15b')]));return{'code':0xc8,'result':_0xc9ef('0x15d')};}else{logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x15e'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x490e87[_0xc9ef('0x15b')]));this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0x15e'),this['channel'][_0xc9ef('0x3c')],_0x490e87[_0xc9ef('0x15b')]));return{'code':0xc8,'result':_0xc9ef('0x15f')};}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x1c3')]=function(_0x4534d8){logger['info'](util['format'](_0xc9ef('0x1c4'),_0x4534d8[_0xc9ef('0x39')]));var _0x1251fc=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0x1c5'),[_0x4534d8[_0xc9ef('0x1c6')],_0x4534d8['options']]);if(_0x1251fc[_0xc9ef('0xa2')]===-0x1){return _0x1251fc;}return this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0xbf'),'VOICEMAIL',_0x4534d8[_0xc9ef('0x1c6')]));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x1c7')]=function(_0x54b78f){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x54b78f[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x54b78f[_0xc9ef('0xd8')])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x54b78f,'no\x20variable\x20selected');}var _0x1145fa=this[_0xc9ef('0x10')]['sync'](this,_0x54b78f['variable_id']);if(!_0x1145fa){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x54b78f,_0xc9ef('0x11c'));}var _0x58b245=this['channel']['getVariable'](_0x1145fa);return{'code':0xc8,'result':_0x58b245[_0xc9ef('0x9f')]?_0x58b245['extra']:'-'};};String[_0xc9ef('0x14')]['replaceAll']=function(_0x5c1410,_0x2e42bd){return this[_0xc9ef('0x9e')](_0x5c1410)[_0xc9ef('0x1c8')](_0x2e42bd);};module['exports']=AGIVertices; \ No newline at end of file +var _0x4ded=['MRCPRecog','getAndSetVariable','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','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','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','dialogflow','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','audiofile','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','variable_id','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','unlink','.wav','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','%s/recordings/%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','condition','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','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','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','Smtp','email','user','bcc','subject','template_id','sendMail\x20message','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','createSmsMessage','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','mailRpc','prototype','rpc','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','format','getQueryOdbc','open','info','query','Error\x20executing\x20query\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','channel','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','callback_priority','getPause','agentPause','agentUnpause','agent','agentLogout','agentLogin','shellCommand','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','includes','PUT','method','toUpperCase','body','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','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','awsLex','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','recursiveNodeIndex','isPlainObject','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','replaceAllVariables','split','replaceAll','getVariable','toString','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','retry','maxRetry','no\x20text\x20configured','exec','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured'];(function(_0x4d6ac0,_0x201628){var _0x5296c4=function(_0x3d0b3d){while(--_0x3d0b3d){_0x4d6ac0['push'](_0x4d6ac0['shift']());}};_0x5296c4(++_0x201628);}(_0x4ded,0x116));var _0xd4de=function(_0x53e092,_0x336bba){_0x53e092=_0x53e092-0x0;var _0x5ee44d=_0x4ded[_0x53e092];return _0x5ee44d;};'use strict';var fs=require('fs');var util=require(_0xd4de('0x0'));var _=require(_0xd4de('0x1'));var sh=require(_0xd4de('0x2'));var odbc=require(_0xd4de('0x3'))();var rs=require(_0xd4de('0x4'));var moment=require(_0xd4de('0x5'));var Mustache=require(_0xd4de('0x6'));var rp=require(_0xd4de('0x7'));var logger=require(_0xd4de('0x8'))(_0xd4de('0x9'));var config=require(_0xd4de('0xa'));var shared=require(_0xd4de('0xb'));var scripts=require('./scripts');var FILES_PATH=_0xd4de('0xc');var recursiveMapAttributes=[_0xd4de('0xd'),_0xd4de('0xe')];var verticesWithRetry=[_0xd4de('0xf'),_0xd4de('0x10'),_0xd4de('0x11')];var AGIVertices=function(_0x5c612f,_0xb7e8cf,_0x5ebcf3){this['channel']=_0x5c612f;this['rpc']=_0xb7e8cf;this[_0xd4de('0x12')]=_0x5ebcf3;};AGIVertices[_0xd4de('0x13')]['getVariable']=function(_0x5b6dc4,_0x4c9499){this[_0xd4de('0x14')]['getVariableById'](_0x5b6dc4)[_0xd4de('0x15')](function(_0x3eb84a){_0x4c9499(null,_0x3eb84a?_0x3eb84a[_0xd4de('0x16')]:![]);})[_0xd4de('0x17')](function(_0x3ffc72){_0x4c9499(_0x3ffc72);});};AGIVertices[_0xd4de('0x13')][_0xd4de('0x18')]=function(_0x1b9039,_0x3e3735){this[_0xd4de('0x14')][_0xd4de('0x19')](_0x1b9039)[_0xd4de('0x15')](function(_0x164ca0){_0x3e3735(null,_0x164ca0?_0x164ca0[_0xd4de('0x16')]:![]);})[_0xd4de('0x17')](function(_0xa7c18b){_0x3e3735(_0xa7c18b);});};AGIVertices[_0xd4de('0x13')]['getSquareProject']=function(_0x5d0aeb,_0x3df820){this[_0xd4de('0x14')][_0xd4de('0x1a')](_0x5d0aeb)[_0xd4de('0x15')](function(_0x5b1d1c){_0x3df820(null,_0x5b1d1c?_0x5b1d1c['name']:![]);})[_0xd4de('0x17')](function(_0x54b757){_0x3df820(_0x54b757);});};AGIVertices[_0xd4de('0x13')][_0xd4de('0x1b')]=function(_0x50b9e3,_0xc15081){this['rpc'][_0xd4de('0x1c')](_0x50b9e3)[_0xd4de('0x15')](function(_0x2bad14){_0xc15081(null,_0x2bad14?_0x2bad14[_0xd4de('0x1d')]:![]);})['catch'](function(_0x318658){_0xc15081(_0x318658);});};AGIVertices[_0xd4de('0x13')][_0xd4de('0x1e')]=function(_0xdb3fc,_0x1c631a){this[_0xd4de('0x14')][_0xd4de('0x1f')](_0xdb3fc)[_0xd4de('0x15')](function(_0x2f9de6){_0x1c631a(null,_0x2f9de6?_0x2f9de6[_0xd4de('0x16')]:![]);})['catch'](function(_0xad333f){_0x1c631a(_0xad333f);});};AGIVertices[_0xd4de('0x13')][_0xd4de('0x20')]=function(_0x22970c,_0x2dad88){this[_0xd4de('0x14')][_0xd4de('0x21')](_0x22970c)[_0xd4de('0x15')](function(_0x2aa82a){_0x2dad88(null,_0x2aa82a?_0x2aa82a[_0xd4de('0x16')]:![]);})[_0xd4de('0x17')](function(_0xb2d8a1){_0x2dad88(_0xb2d8a1);});};AGIVertices['prototype'][_0xd4de('0x22')]=function(_0x35e2fc,_0x5005b0){var _0x1d7d37=this;this['rpc'][_0xd4de('0x23')](_0x35e2fc)[_0xd4de('0x15')](function(_0x15d2b7){_0x5005b0(null,_0x15d2b7?_0x1d7d37['getSoundPath'](_0x15d2b7[_0xd4de('0x24')]):![]);})[_0xd4de('0x17')](function(_0x17f0a){_0x5005b0(_0x17f0a);});};AGIVertices['prototype'][_0xd4de('0x25')]=function(_0x1804c7,_0x55f9f9){this['rpc']['getMailAccountById'](_0x1804c7)[_0xd4de('0x15')](function(_0x496795){_0x55f9f9(null,_0x496795?_0x496795:![]);})[_0xd4de('0x17')](function(_0x1429ba){_0x55f9f9(_0x1429ba);});};AGIVertices[_0xd4de('0x13')][_0xd4de('0x26')]=function(_0x4d3380,_0x3fe6c8,_0xcd6312){this['mailRpc'][_0xd4de('0x26')](_0x4d3380,_0x3fe6c8)[_0xd4de('0x15')](function(){_0xcd6312(null);})['catch'](function(_0x5d669e){_0xcd6312(_0x5d669e);});};AGIVertices[_0xd4de('0x13')][_0xd4de('0x27')]=function(_0x4020cc,_0x1a2fd0){this['rpc'][_0xd4de('0x28')](_0x4020cc)[_0xd4de('0x15')](function(_0x4def30){if(_0x4def30){if(_0x4def30[_0xd4de('0x29')]){_0x1a2fd0(null,[_0x4def30[_0xd4de('0x2a')]]);}else{_0x1a2fd0(null,_[_0xd4de('0x2b')](_0x4def30[_0xd4de('0x2c')],_0xd4de('0x2a')));}}else{_0x1a2fd0(null,![]);}})[_0xd4de('0x17')](function(_0x53441c){_0x1a2fd0(_0x53441c);});};AGIVertices['prototype'][_0xd4de('0x2d')]=function(_0x2d2fda){return util[_0xd4de('0x2e')]('%s/sounds/converted/%s',FILES_PATH,_0x2d2fda);};AGIVertices[_0xd4de('0x13')][_0xd4de('0x2f')]=function(_0x4fd981,_0x26ed59,_0x4724bd){odbc[_0xd4de('0x30')](_0x4fd981,function(_0x1f60e8){if(_0x1f60e8){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x1f60e8);_0x4724bd(_0x1f60e8);}else{logger[_0xd4de('0x31')]('ODBC\x20connection\x20successfully');odbc[_0xd4de('0x32')](_0x26ed59,function(_0x4de12c,_0x97c0ab){if(_0x4de12c){logger[_0xd4de('0x31')](_0xd4de('0x33'),_0x26ed59);_0x4724bd(_0x4de12c);}else{logger[_0xd4de('0x31')]('Query\x20executed\x20correctly\x20%s',_0x26ed59);odbc[_0xd4de('0x34')](function(_0x4bd6ed){if(_0x4bd6ed){logger[_0xd4de('0x35')](_0xd4de('0x36'),_0x4bd6ed);}_0x4724bd(null,_0x97c0ab);});}});}});};AGIVertices[_0xd4de('0x13')][_0xd4de('0x37')]=function(_0x349c5f,_0x13c256){this[_0xd4de('0x14')]['getSmsAccountById'](_0x349c5f)[_0xd4de('0x15')](function(_0x1eb001){_0x13c256(null,_0x1eb001?_0x1eb001:![]);})[_0xd4de('0x17')](function(_0x2ec1fa){_0x13c256(_0x2ec1fa);});};AGIVertices[_0xd4de('0x13')]['createSmsMessage']=function(_0x193707,_0x3e1e69){this[_0xd4de('0x14')]['createSmsMessage'](_0x193707)[_0xd4de('0x15')](function(_0x1f2ff4){_0x3e1e69(null,_0x1f2ff4);})[_0xd4de('0x17')](function(_0x516542){_0x3e1e69(_0x516542);});};AGIVertices[_0xd4de('0x13')][_0xd4de('0x38')]=function(_0x419c49,_0x3f1e22,_0x3267bd){this[_0xd4de('0x14')][_0xd4de('0x38')]({'uniqueid':this['channel'][_0xd4de('0x39')],'node':_0x419c49[_0xd4de('0x3a')],'application':_0x419c49[_0xd4de('0x3b')],'data':_0x3f1e22||null,'project_name':this['channel'][_0xd4de('0x3c')],'callerid':this[_0xd4de('0x3d')][_0xd4de('0x3e')]})['then'](function(_0x5c704a){if(_0x3267bd){_0x3267bd(null,_0x5c704a);}})[_0xd4de('0x17')](function(_0x20aac){if(_0x3267bd){_0x3267bd(_0x20aac);}});};AGIVertices['prototype'][_0xd4de('0x3f')]=function(_0x1f477b,_0x3a3c63,_0x13b317,_0x564a96){this[_0xd4de('0x14')][_0xd4de('0x3f')]({'uniqueid':this[_0xd4de('0x3d')][_0xd4de('0x39')],'callerid':this[_0xd4de('0x3d')][_0xd4de('0x3e')],'calleridname':this['channel'][_0xd4de('0x40')],'context':this[_0xd4de('0x3d')][_0xd4de('0x41')],'extension':this[_0xd4de('0x3d')][_0xd4de('0x42')],'priority':this[_0xd4de('0x3d')][_0xd4de('0x43')],'accountcode':this[_0xd4de('0x3d')][_0xd4de('0x44')],'dnid':this[_0xd4de('0x3d')]['dnid'],'projectName':this[_0xd4de('0x3d')][_0xd4de('0x3c')],'saveName':_0x3a3c63,'filename':_0x1f477b[_0xd4de('0x45')]||_0x3a3c63,'savePath':_0x13b317})['then'](function(_0x13a900){_0x564a96(null,_0x13a900);})[_0xd4de('0x17')](function(_0x299bf3){_0x564a96(_0x299bf3);});};AGIVertices[_0xd4de('0x13')][_0xd4de('0x46')]=function(_0xa24bb7,_0xc63e99,_0x29cb16,_0x182b35,_0x138b04){this['rpc'][_0xd4de('0x46')]({'uniqueid':this[_0xd4de('0x3d')][_0xd4de('0x39')],'body':_0xa24bb7,'direction':_0xc63e99,'providerName':_0x29cb16,'providerResponse':_0x182b35})[_0xd4de('0x15')](function(_0x9ea613){if(_0x138b04){_0x138b04(null,_0x9ea613);}})['catch'](function(_0x5a4602){if(_0x138b04){_0x138b04(_0x5a4602);}});};AGIVertices[_0xd4de('0x13')][_0xd4de('0x47')]=function(_0x4f9b6b,_0x48cb7d){this[_0xd4de('0x14')][_0xd4de('0x47')]({'firstName':_[_0xd4de('0x48')](_0x4f9b6b[_0xd4de('0x16')])||_[_0xd4de('0x49')](_0x4f9b6b[_0xd4de('0x16')])?_0xd4de('0x4a')+Math[_0xd4de('0x4b')]():_0x4f9b6b[_0xd4de('0x16')],'lastName':_[_0xd4de('0x48')](_0x4f9b6b[_0xd4de('0x4c')])||_[_0xd4de('0x49')](_0x4f9b6b['lastName'])?null:_0x4f9b6b[_0xd4de('0x4c')],'phone':_0x4f9b6b[_0xd4de('0x4d')],'ListId':_0x4f9b6b[_0xd4de('0x4e')],'scheduledat':_0x4f9b6b[_0xd4de('0x4f')],'callbackUniqueid':this[_0xd4de('0x3d')][_0xd4de('0x39')],'tags':'callback','description':_0xd4de('0x50')+_0x4f9b6b['scheduledAt']['toString'](),'priority':_0x4f9b6b[_0xd4de('0x51')]})[_0xd4de('0x15')](function(_0x2d1e45){_0x48cb7d(null,_0x2d1e45);})[_0xd4de('0x17')](function(_0x4e533c){_0x48cb7d(_0x4e533c);});};AGIVertices[_0xd4de('0x13')][_0xd4de('0x52')]=function(_0x10802d,_0x117052){this[_0xd4de('0x14')]['getPauseById'](_0x10802d)['then'](function(_0x4b55cc){_0x117052(null,_0x4b55cc?_0x4b55cc[_0xd4de('0x16')]:![]);})[_0xd4de('0x17')](function(_0x33933f){_0x117052(_0x33933f);});};AGIVertices[_0xd4de('0x13')]['agentPause']=function(_0x35ba6f,_0x146eaa,_0x2e0d76){var _0x17047a={'role':'agent'};_0x17047a[_0x35ba6f]=this[_0xd4de('0x3d')][_0xd4de('0x3e')];this[_0xd4de('0x14')][_0xd4de('0x53')](_0x17047a,_0x146eaa,this['channel']['uniqueid'])['then'](function(_0x42e40b){_0x2e0d76(null,_[_0xd4de('0x49')](_0x42e40b)?![]:!![]);})[_0xd4de('0x17')](function(_0x4b7b84){logger[_0xd4de('0x35')](_0x4b7b84);_0x2e0d76(null,![]);});};AGIVertices[_0xd4de('0x13')][_0xd4de('0x54')]=function(_0x55e1a3,_0x1758b3){var _0x511b21={'role':_0xd4de('0x55')};_0x511b21[_0x55e1a3]=this[_0xd4de('0x3d')][_0xd4de('0x3e')];this[_0xd4de('0x14')][_0xd4de('0x54')](_0x511b21)[_0xd4de('0x15')](function(_0x1bd30f){_0x1758b3(null,_[_0xd4de('0x49')](_0x1bd30f)?![]:!![]);})['catch'](function(_0x233c8){logger['error'](_0x233c8);_0x1758b3(null,![]);});};AGIVertices[_0xd4de('0x13')][_0xd4de('0x56')]=function(_0x572d49,_0x29c840){var _0xb366b0={'role':_0xd4de('0x55')};_0xb366b0[_0x572d49]=this[_0xd4de('0x3d')][_0xd4de('0x3e')];this[_0xd4de('0x14')][_0xd4de('0x56')](_0xb366b0)[_0xd4de('0x15')](function(_0x1c2f97){_0x29c840(null,_[_0xd4de('0x49')](_0x1c2f97)?![]:!![]);})[_0xd4de('0x17')](function(_0x37057c){logger[_0xd4de('0x35')](_0x37057c);_0x29c840(null,![]);});};AGIVertices['prototype'][_0xd4de('0x57')]=function(_0xe5e332,_0x216fd5){var _0x331f08={'role':_0xd4de('0x55')};_0x331f08[_0xe5e332]=this[_0xd4de('0x3d')][_0xd4de('0x3e')];var _0x3fdd63=_0xe5e332!='internal'?util[_0xd4de('0x2e')]('%s/%s@from-sip/n','LOCAL',this['channel'][_0xd4de('0x3e')]):undefined;this[_0xd4de('0x14')]['agentLogin'](_0x331f08,_0x3fdd63)['then'](function(_0x5348bd){_0x216fd5(null,_['isNil'](_0x5348bd)?![]:!![]);})[_0xd4de('0x17')](function(_0x502b2e){logger[_0xd4de('0x35')](_0x502b2e);_0x216fd5(null,![]);});};AGIVertices['prototype'][_0xd4de('0x58')]=function(_0x223b1a,_0x4ee475){sh['exec'](_['trim'](_0x223b1a),function(_0x5a1a88,_0x3b3a1d){var _0x214e05=_0x3b3a1d[_0xd4de('0x59')](/(\r\n|\n|\r)/gm,'');_0x4ee475(null,_0x214e05);});};AGIVertices[_0xd4de('0x13')][_0xd4de('0x5a')]=function(_0x282d4f,_0x574c46){scripts['googleCloudTTS'](_0x282d4f['apiKey'],_0x282d4f[_0xd4de('0x5b')]||_0xd4de('0x5c'),_0x282d4f['text'],_0x282d4f[_0xd4de('0x5d')]||'en-US',_0x282d4f[_0xd4de('0x5e')]||'MALE',_0x282d4f[_0xd4de('0x5f')]||_0xd4de('0x60'))['then'](function(_0x2d1b39){_0x574c46(null,_0x2d1b39);})['catch'](function(_0x2bdc7c){_0x574c46(_0x2bdc7c);});};AGIVertices[_0xd4de('0x13')][_0xd4de('0x61')]=function(_0xa94c28,_0x4ac45a){scripts[_0xd4de('0x61')](_0xa94c28[_0xd4de('0x5c')],_0xa94c28[_0xd4de('0x62')]||'en',0x1)[_0xd4de('0x15')](function(_0x3108b5){_0x4ac45a(null,_0x3108b5);})[_0xd4de('0x17')](function(_0xb10dbb){_0x4ac45a(_0xb10dbb);});};AGIVertices[_0xd4de('0x13')][_0xd4de('0x63')]=function(_0x227c9a,_0xc908e9){var _0x396f9f={'uri':_0x227c9a[_0xd4de('0x64')],'method':_0x227c9a['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x227c9a[_0xd4de('0x65')])==='number'&&parseInt(_0x227c9a['timeout'])>=0x1?parseInt(_0x227c9a[_0xd4de('0x65')])*0x3e8:0x5*0x3e8};if(_[_0xd4de('0x66')](['POST',_0xd4de('0x67')],_0x396f9f[_0xd4de('0x68')][_0xd4de('0x69')]())){try{_0x396f9f[_0xd4de('0x6a')]=_0x227c9a['rawBody']?JSON[_0xd4de('0x6b')](_0x227c9a[_0xd4de('0xe')]):{};}catch(_0xf9c757){logger[_0xd4de('0x35')](_0xd4de('0x6c'),_0xf9c757);}}try{_0x396f9f['headers']=_0x227c9a['rawHeaders']?JSON['parse'](_0x227c9a['rawHeaders']):{};}catch(_0x26ea6d){logger['error'](_0xd4de('0x6d'),_0x26ea6d);}if(_0x227c9a['computedVariables']){try{var _0x2ec967=require(_0x227c9a[_0xd4de('0x6e')])[_0xd4de('0x6f')](this,_0x396f9f);_0x396f9f[_0xd4de('0x70')]=Mustache[_0xd4de('0x71')](_0x227c9a[_0xd4de('0x64')],_0x2ec967,{},['$$','$$']);if(_0x396f9f[_0xd4de('0x72')]){_0x396f9f[_0xd4de('0x72')]=JSON['parse'](Mustache[_0xd4de('0x71')](JSON[_0xd4de('0x73')](_0x396f9f[_0xd4de('0x72')]),_0x2ec967,{},['$$','$$']));}if(_0x396f9f[_0xd4de('0x6a')]){_0x396f9f['body']=JSON[_0xd4de('0x6b')](Mustache[_0xd4de('0x71')](JSON['stringify'](_0x396f9f[_0xd4de('0x6a')]),_0x2ec967,{},['$$','$$']));}}catch(_0x229bb9){logger[_0xd4de('0x35')](_0xd4de('0x74'),_0x229bb9);}}rp(_0x396f9f)[_0xd4de('0x15')](function(_0x2ff9f5){var _0x8314b5={'statusCode':_0x2ff9f5[_0xd4de('0x75')]||0xc8,'statusMessage':_0x2ff9f5[_0xd4de('0x76')]||'OK','headers':_0x2ff9f5[_0xd4de('0x72')]||{},'body':_0x2ff9f5[_0xd4de('0x6a')]||{}};_0xc908e9(null,_0x8314b5);})['catch'](function(_0x1a379f){var _0x5c2d1c={'statusCode':_0x1a379f[_0xd4de('0x75')]||0x1f4,'statusMessage':_0x1a379f[_0xd4de('0x77')]||_0xd4de('0x78'),'headers':_0x1a379f['options'][_0xd4de('0x72')]||{},'body':_0x1a379f[_0xd4de('0x79')]['body']||{}};_0xc908e9(null,_0x5c2d1c);});};AGIVertices[_0xd4de('0x13')][_0xd4de('0x7a')]=function(_0x46d4cb,_0x6b966d){scripts[_0xd4de('0x7a')](this[_0xd4de('0x3d')]['uniqueid'],_0x46d4cb[_0xd4de('0x7b')],_0x46d4cb[_0xd4de('0x5c')],_0x46d4cb['dialogflow_language']||'en')[_0xd4de('0x15')](function(_0x3e7827){_0x6b966d(null,_0x3e7827);})[_0xd4de('0x17')](function(_0x3c216a){_0x6b966d(_0x3c216a);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x46a986,_0x5f8c94){scripts[_0xd4de('0x7c')](this[_0xd4de('0x3d')]['uniqueid'],_0x46a986[_0xd4de('0x7d')],_0x46a986[_0xd4de('0x7e')],_0x46a986[_0xd4de('0x7f')],_0x46a986[_0xd4de('0x5c')],_0x46a986['dialogflowV2_language']||'en')['then'](function(_0x110e19){_0x5f8c94(null,_0x110e19);})['catch'](function(_0x1ac87e){_0x5f8c94(_0x1ac87e);});};AGIVertices[_0xd4de('0x13')][_0xd4de('0x80')]=function(_0x449bba,_0x5afe8e){scripts['sestekNDA'](this[_0xd4de('0x3d')],_0x449bba)[_0xd4de('0x15')](function(_0x5d860d){_0x5afe8e(null,_0x5d860d);})['catch'](function(_0x2a0a0c){_0x5afe8e(_0x2a0a0c);});};AGIVertices[_0xd4de('0x13')][_0xd4de('0x81')]=function(_0x5ac397,_0x456b15){scripts[_0xd4de('0x81')](_0x5ac397['key'],_0x5ac397[_0xd4de('0x5c')],_0x5ac397['ispeech_tts_language']||_0xd4de('0x82'),_0x5ac397[_0xd4de('0x83')])['then'](function(_0x4d83ba){_0x456b15(null,_0x4d83ba);})[_0xd4de('0x17')](function(_0x1e2a39){_0x456b15(_0x1e2a39);});};AGIVertices[_0xd4de('0x13')][_0xd4de('0x84')]=function(_0x20af58,_0x4b758a,_0x297c07){scripts[_0xd4de('0x84')](_0x4b758a,_0x20af58[_0xd4de('0x7b')],_0x20af58[_0xd4de('0x85')]||_0xd4de('0x82'),this[_0xd4de('0x86')](_0x20af58['model'])?_0x20af58[_0xd4de('0x87')]:undefined)['then'](function(_0x424dcd){_0x297c07(null,_0x424dcd);})[_0xd4de('0x17')](function(_0x2171fb){_0x297c07(_0x2171fb);});};AGIVertices[_0xd4de('0x13')][_0xd4de('0x88')]=function(_0x4cea38,_0x3c7fd3){scripts[_0xd4de('0x88')](_0x4cea38[_0xd4de('0x89')],_0x4cea38[_0xd4de('0x8a')],_0x4cea38[_0xd4de('0x8b')],_0x4cea38[_0xd4de('0x8c')]||_0xd4de('0x8d'),_0x4cea38[_0xd4de('0x5c')],_0x4cea38['aws_text_type']||_0xd4de('0x5c'))[_0xd4de('0x15')](function(_0x42714f){_0x3c7fd3(null,_0x42714f);})[_0xd4de('0x17')](function(_0x20a5c3){_0x3c7fd3(_0x20a5c3);});};AGIVertices[_0xd4de('0x13')]['awsLex']=function(_0x1fbe19,_0xbd49a4){scripts[_0xd4de('0x8e')](this[_0xd4de('0x3d')]['uniqueid'],_0x1fbe19['aws_access_key_id'],_0x1fbe19[_0xd4de('0x8a')],_0x1fbe19['aws_lex_region'],_0x1fbe19['text'],_0x1fbe19['aws_bot_name'])['then'](function(_0x47acfb){_0xbd49a4(null,_0x47acfb);})['catch'](function(_0x563786){_0xbd49a4(_0x563786);});};AGIVertices[_0xd4de('0x13')][_0xd4de('0x8f')]=function(_0x32c222,_0x54ffda,_0x2b06c){scripts[_0xd4de('0x8f')](_0x54ffda,_0x32c222[_0xd4de('0x7b')],_0x32c222[_0xd4de('0x90')]||'en-US')[_0xd4de('0x15')](function(_0x416206){_0x2b06c(null,_0x416206);})['catch'](function(_0x138ae1){_0x2b06c(_0x138ae1);});};AGIVertices[_0xd4de('0x13')][_0xd4de('0x91')]=function(_0x3ea9e3,_0x2e9cbd,_0x2d5f5a){scripts[_0xd4de('0x91')](_0x2e9cbd,_0x3ea9e3[_0xd4de('0x92')],_0x3ea9e3[_0xd4de('0x93')],_0x3ea9e3['uri'])[_0xd4de('0x15')](function(_0x2ee37b){_0x2d5f5a(null,_0x2ee37b);})[_0xd4de('0x17')](function(_0x33ea46){_0x2d5f5a(_0x33ea46);});};AGIVertices[_0xd4de('0x13')][_0xd4de('0x94')]=function(_0x167bf3){var _0x2f45af=_[_0xd4de('0x66')](verticesWithRetry,_0x167bf3[_0xd4de('0x3b')])?_0x167bf3:_[_0xd4de('0x95')](_0x167bf3);for(var _0x4fa7e6 in _0x2f45af){if(_0x2f45af[_0xd4de('0x96')](_0x4fa7e6)){if(_0x2f45af[_0x4fa7e6]&&_['isString'](_0x2f45af[_0x4fa7e6])){if(_[_0xd4de('0x66')](recursiveMapAttributes,_0x4fa7e6)){_0x2f45af[_0x4fa7e6]=this['replaceObjectAllVariables'](_0x2f45af[_0x4fa7e6]);}else{_0x2f45af[_0x4fa7e6]=this['replaceAllVariables'](_0x2f45af[_0x4fa7e6]);}}}}return _0x2f45af;};AGIVertices['prototype'][_0xd4de('0x97')]=function(_0x31055c){for(var _0x156d4f in _0x31055c){if(_0x31055c['hasOwnProperty'](_0x156d4f)){if(_[_0xd4de('0x98')](_0x31055c[_0x156d4f])){this[_0xd4de('0x97')](_0x31055c[_0x156d4f]);}else if(_[_0xd4de('0x99')](_0x31055c[_0x156d4f])){for(var _0x4b1076=0x0;_0x4b1076<_0x31055c[_0x156d4f][_0xd4de('0x9a')];_0x4b1076++){this[_0xd4de('0x97')](_0x31055c[_0x156d4f][_0x4b1076]);}}else if(_[_0xd4de('0x9b')](_0x31055c[_0x156d4f])){_0x31055c[_0x156d4f]=this['replaceAllVariables'](_0x31055c[_0x156d4f]);}}}};AGIVertices['prototype'][_0xd4de('0x9c')]=function(_0x5f4eaf,_0x5827f6){for(var _0x3241c4 in _0x5f4eaf){if(_0x5f4eaf[_0xd4de('0x96')](_0x3241c4)){if(_[_0xd4de('0x98')](_0x5f4eaf[_0x3241c4])){if(!_['isEmpty'](_0x5f4eaf[_0x3241c4])){this['saveRestApiResult'](_0x5f4eaf[_0x3241c4],util[_0xd4de('0x2e')]('%s.%s',_0x5827f6,_0x3241c4));}}else if(_['isArray'](_0x5f4eaf[_0x3241c4])){for(var _0x3904d7=0x0;_0x3904d7<_0x5f4eaf[_0x3241c4][_0xd4de('0x9a')];_0x3904d7++){this[_0xd4de('0x9c')](_0x5f4eaf[_0x3241c4][_0x3904d7],util[_0xd4de('0x2e')](_0xd4de('0x9d'),_0x5827f6,_0x3241c4+'['+_0x3904d7+']'));}}else{if(!_[_0xd4de('0x49')](_0x5f4eaf[_0x3241c4])){this[_0xd4de('0x3d')][_0xd4de('0x9e')](util[_0xd4de('0x2e')]('%s.%s',_0x5827f6,_0x3241c4),_0x5f4eaf[_0x3241c4]);}}}}};AGIVertices[_0xd4de('0x13')]['replaceObjectAllVariables']=function(_0x13a5ff){try{var _0x3fbda5=JSON[_0xd4de('0x6b')](_0x13a5ff);this[_0xd4de('0x97')](_0x3fbda5);return JSON[_0xd4de('0x73')](_0x3fbda5);}catch(_0x484147){return this['replaceAllVariables'](_0x13a5ff);}};AGIVertices['prototype'][_0xd4de('0x9f')]=function(_0x51e7f3){var _0x532daf=_0x51e7f3[_0xd4de('0xa0')]('{');for(var _0x5d3555=0x1;_0x5d3555<_0x532daf['length'];_0x5d3555+=0x1){var _0x13d78f=_0x532daf[_0x5d3555][_0xd4de('0xa0')]('}');if(_0x13d78f[_0xd4de('0x9a')]>0x1){_0x51e7f3=_0x51e7f3[_0xd4de('0xa1')]('{'+_0x13d78f[0x0]+'}',this[_0xd4de('0x3d')][_0xd4de('0xa2')](_0x13d78f[0x0])['extra']||_0x13d78f[0x0]);}}if(_0x532daf[_0xd4de('0x9a')]===0x1){return _0x51e7f3[_0xd4de('0xa3')]();}return this[_0xd4de('0x9f')](_0x51e7f3);};AGIVertices[_0xd4de('0x13')]['getAndSetVariable']=function(_0x42cca3,_0x6cec25){var _0x21fac5=this['channel']['getVariable'](_0x42cca3);if(_0x21fac5[_0xd4de('0xa4')]===-0x1){return _0x21fac5;}logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0xa5'),_0x6cec25,_0x21fac5[_0xd4de('0xa6')]));return this['channel']['setVariable'](_0x6cec25,_0x21fac5[_0xd4de('0xa6')]);};AGIVertices['prototype'][_0xd4de('0x86')]=function(_0x297071){return _0x297071&&_0x297071!=='0'&&_0x297071!=='-1'&&_0x297071!=='';};AGIVertices['prototype']['maxRetry']=function(_0x3cf8a3){this['createSquareDetailsReport']['sync'](this,_0x3cf8a3,'-');_0x3cf8a3[_0xd4de('0xa7')]=_0x3cf8a3[_0xd4de('0xa8')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xd4de('0x13')]['mrcpsynth']=function(_0x437a81){logger['info'](util[_0xd4de('0x2e')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x437a81[_0xd4de('0x3a')]));if(!this['isConfigured'](_0x437a81['text'])){return this['channel']['noop'](_0xd4de('0xa9'));}var _0x48db80='\x22'+_0x437a81['text']+'\x22';if(this[_0xd4de('0x86')](_0x437a81[_0xd4de('0x79')])){_0x48db80+=','+_0x437a81[_0xd4de('0x79')];}var _0x553e9a=this['channel'][_0xd4de('0xaa')](_0xd4de('0xab'),_0x48db80);if(_0x553e9a['result']===-0x1){return _0x553e9a;}return this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0xad'),_0x48db80));};AGIVertices['prototype'][_0xd4de('0xae')]=function(_0x3bb021){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0xaf'),_0x3bb021[_0xd4de('0x3a')]));if(!this[_0xd4de('0x86')](_0x3bb021[_0xd4de('0xb0')])){return this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0xb1'));}var _0x3abf27=_0x3bb021[_0xd4de('0xb0')];if(this['isConfigured'](_0x3bb021[_0xd4de('0x79')])){_0x3abf27+=','+_0x3bb021[_0xd4de('0x79')];}var _0xc7d43b=this[_0xd4de('0x3d')]['exec'](_0xd4de('0xb2'),_0x3abf27);if(_0xc7d43b[_0xd4de('0xa4')]===-0x1){return _0xc7d43b;}var _0x2fc4e9=this[_0xd4de('0xb3')]('RECOG_CONFIDENCE()',_0xd4de('0xb4'));if(_0x2fc4e9[_0xd4de('0xa4')]===-0x1){return _0x2fc4e9;}var _0xc7288f=this['getAndSetVariable'](_0xd4de('0xb5'),_0xd4de('0xb6'));if(_0xc7288f['result']===-0x1){return _0xc7288f;}var _0x364802=this[_0xd4de('0xb3')](_0xd4de('0xb7'),'MRCP_RECOG_INSTANCE');if(_0x364802[_0xd4de('0xa4')]===-0x1){return _0x364802;}return this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0xb8'),_0x3abf27));};AGIVertices[_0xd4de('0x13')][_0xd4de('0x9')]=function(_0x4f3036){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0xb9'),_0x4f3036[_0xd4de('0x3a')]));return this[_0xd4de('0x3d')]['agi']([_0x4f3036[_0xd4de('0xba')],_0x4f3036[_0xd4de('0xbb')]]);};AGIVertices['prototype'][_0xd4de('0xbc')]=function(_0x3dd78a){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0xbd'),_0x3dd78a[_0xd4de('0x3a')]));if(this[_0xd4de('0x86')](_0x3dd78a[_0xd4de('0x65')])){logger['info'](util[_0xd4de('0x2e')](_0xd4de('0xbe'),_0x3dd78a['timeout']));var _0x173ccf=this['channel']['wait'](_0x3dd78a['timeout']);if(_0x173ccf[_0xd4de('0xa4')]===-0x1){return _0x173ccf;}}return this[_0xd4de('0x3d')]['answer']();};AGIVertices['prototype'][_0xd4de('0xbf')]=function(_0x101ff1){logger['info'](util[_0xd4de('0x2e')](_0xd4de('0xc0'),_0x101ff1[_0xd4de('0x3a')]));if(!this[_0xd4de('0x86')](_0x101ff1[_0xd4de('0x4e')])){return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0x101ff1,_0xd4de('0xc1'));}_0x101ff1['scheduledAt']=moment();if(this[_0xd4de('0x86')](_0x101ff1[_0xd4de('0xc2')])){_0x101ff1[_0xd4de('0x4f')]=moment()['add'](_0x101ff1['delay'],'minutes');}if(!this[_0xd4de('0x86')](_0x101ff1['callback_priority'])){_0x101ff1[_0xd4de('0x51')]=0x2;}this[_0xd4de('0x47')]['sync'](this,_0x101ff1);return this['channel'][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0xc3'),_0x101ff1[_0xd4de('0x4d')],_0x101ff1[_0xd4de('0x4e')],_0x101ff1[_0xd4de('0x4f')]));};AGIVertices[_0xd4de('0x13')][_0xd4de('0xc4')]=function(_0x5db65b){logger[_0xd4de('0x31')](util['format'](_0xd4de('0xc5'),_0x5db65b[_0xd4de('0x3a')]));var _0x2c35f8=this[_0xd4de('0x3d')][_0xd4de('0xaa')](_0x5db65b[_0xd4de('0xc6')],_0x5db65b[_0xd4de('0x79')]);if(_0x2c35f8[_0xd4de('0xa4')]===-0x1){return _0x2c35f8;}return this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0xc7'),_0x5db65b[_0xd4de('0xc6')],_0x5db65b[_0xd4de('0x79')]));};AGIVertices[_0xd4de('0x13')][_0xd4de('0xc8')]=function(_0x120b26){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0xc9'),_0x120b26[_0xd4de('0x3a')]));if(!this[_0xd4de('0x86')](_0x120b26[_0xd4de('0x5c')])){return this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0xa9'));}var _0x8a1566='\x22'+_0x120b26[_0xd4de('0x5c')]+'\x22';if(this['isConfigured'](_0x120b26[_0xd4de('0x79')])){_0x8a1566+=','+_0x120b26[_0xd4de('0x79')];}var _0x251653=this[_0xd4de('0x3d')]['exec'](_0xd4de('0xab'),_0x8a1566);if(_0x251653['result']===-0x1){return _0x251653;}return this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0xad'),_0x8a1566));};AGIVertices[_0xd4de('0x13')][_0xd4de('0xca')]=function(_0x44fc71){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0xcb'),_0x44fc71[_0xd4de('0x3a')]));if(!this[_0xd4de('0x86')](_0x44fc71['text'])){return this[_0xd4de('0x3d')]['noop'](_0xd4de('0xa9'));}var _0x576f4d='\x22'+_0x44fc71[_0xd4de('0x5c')]+'\x22';if(this[_0xd4de('0x86')](_0x44fc71[_0xd4de('0x79')])){_0x576f4d+=','+_0x44fc71[_0xd4de('0x79')];}var _0x53f847=this['channel'][_0xd4de('0xaa')](_0xd4de('0xab'),_0x576f4d);if(_0x53f847[_0xd4de('0xa4')]===-0x1){return _0x53f847;}return this[_0xd4de('0x3d')][_0xd4de('0xac')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x576f4d));};AGIVertices['prototype'][_0xd4de('0xcc')]=function(_0x1130bb){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0xcd'),_0x1130bb[_0xd4de('0x3a')]));if(!this['isConfigured'](_0x1130bb[_0xd4de('0xb0')])){return this['channel'][_0xd4de('0xac')](_0xd4de('0xb1'));}var _0x5655b3=_0x1130bb['grammar'];if(this[_0xd4de('0x86')](_0x1130bb[_0xd4de('0x79')])){_0x5655b3+=','+_0x1130bb['options'];}var _0x5143de=this[_0xd4de('0x3d')]['exec']('MRCPRecog',_0x5655b3);if(_0x5143de[_0xd4de('0xa4')]===-0x1){return _0x5143de;}var _0x84646a=this['getAndSetVariable'](_0xd4de('0xce'),_0xd4de('0xcf'));if(_0x84646a[_0xd4de('0xa4')]===-0x1){return _0x84646a;}var _0x23ed40=this[_0xd4de('0xb3')]('RECOG_INPUT()',_0xd4de('0xd0'));if(_0x23ed40[_0xd4de('0xa4')]===-0x1){return _0x23ed40;}var _0x3245de=this[_0xd4de('0xb3')](_0xd4de('0xb7'),_0xd4de('0xd1'));if(_0x3245de[_0xd4de('0xa4')]===-0x1){return _0x3245de;}return this[_0xd4de('0x3d')]['noop'](util['format'](_0xd4de('0xb8'),_0x5655b3));};AGIVertices['prototype']['sestekasr']=function(_0x3804a5){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0xd2'),_0x3804a5[_0xd4de('0x3a')]));if(!this[_0xd4de('0x86')](_0x3804a5[_0xd4de('0xb0')])){return this['channel'][_0xd4de('0xac')](_0xd4de('0xb1'));}var _0x398bd6=_0x3804a5[_0xd4de('0xb0')];if(this[_0xd4de('0x86')](_0x3804a5[_0xd4de('0x79')])){_0x398bd6+=','+_0x3804a5[_0xd4de('0x79')];}var _0x245d69=this[_0xd4de('0x3d')][_0xd4de('0xaa')](_0xd4de('0xb2'),_0x398bd6);if(_0x245d69[_0xd4de('0xa4')]===-0x1){return _0x245d69;}var _0x43d363=this[_0xd4de('0xb3')](_0xd4de('0xce'),_0xd4de('0xd3'));if(_0x43d363['result']===-0x1){return _0x43d363;}var _0x40e154=this[_0xd4de('0xb3')](_0xd4de('0xb5'),_0xd4de('0xd4'));if(_0x40e154['result']===-0x1){return _0x40e154;}var _0x53aab6=this['getAndSetVariable'](_0xd4de('0xb7'),_0xd4de('0xd5'));if(_0x53aab6[_0xd4de('0xa4')]===-0x1){return _0x53aab6;}return this[_0xd4de('0x3d')][_0xd4de('0xac')](util['format'](_0xd4de('0xb8'),_0x398bd6));};AGIVertices['prototype'][_0xd4de('0xd6')]=function(_0x33195c){logger['info'](util['format'](_0xd4de('0xd7'),_0x33195c['label']));if(!this[_0xd4de('0x86')](_0x33195c[_0xd4de('0xd8')])){return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0x33195c,_0xd4de('0xd9'));}var _0x3e36af=this[_0xd4de('0x1b')][_0xd4de('0x6f')](this,_0x33195c[_0xd4de('0xd8')]);if(!_0x3e36af){return this[_0xd4de('0x3d')]['error'](_0x33195c,_0xd4de('0xda'));}if(!this[_0xd4de('0x86')](_0x33195c['query'])){return this[_0xd4de('0x3d')]['error'](_0x33195c,'no\x20query\x20configured');}var _0x2b221a=_0x33195c[_0xd4de('0x32')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xd4de('0x3d')]['noop'](util[_0xd4de('0x2e')](_0xd4de('0xdb'),_0x2b221a));var _0x4cc3db=this[_0xd4de('0x2f')][_0xd4de('0x6f')](this,_0x3e36af,_0x2b221a);this[_0xd4de('0x38')][_0xd4de('0x6f')](this,_0x33195c,_0x2b221a);if(!this[_0xd4de('0x86')](_0x33195c['variable_id'])){return this[_0xd4de('0x3d')]['noop'](_0xd4de('0xdc'));}var _0x30e363=this[_0xd4de('0xa2')][_0xd4de('0x6f')](this,_0x33195c['variable_id']);if(!_0x30e363){return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0x33195c,_0xd4de('0xdd'));}var _0x591ae6=this;_0x4cc3db['forEach'](function(_0x364d17,_0x275e90){Object['keys'](_0x364d17)[_0xd4de('0xde')](function(_0x37a658){_0x591ae6['channel'][_0xd4de('0x9e')](util[_0xd4de('0x2e')]('%s[%s][%s]',_0x30e363,_0x275e90,_0x37a658),_0x364d17[_0x37a658]);});});this[_0xd4de('0x3d')][_0xd4de('0x9e')](util[_0xd4de('0x2e')](_0xd4de('0xdf'),_0x30e363),_0x4cc3db['length']);return this[_0xd4de('0x3d')][_0xd4de('0xac')](util['format'](_0xd4de('0xe0'),_0x30e363));};AGIVertices[_0xd4de('0x13')]['dial']=function(_0x6ae92d){logger[_0xd4de('0xe1')](util[_0xd4de('0x2e')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x6ae92d[_0xd4de('0x3a')]));if(!this[_0xd4de('0x86')](_0x6ae92d[_0xd4de('0xe2')])){return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0x6ae92d,_0xd4de('0xe3'));}var _0x4823fb=this[_0xd4de('0x1e')][_0xd4de('0x6f')](this,_0x6ae92d['sip_id']);if(!_0x4823fb){return this['channel']['error'](_0x6ae92d,_0xd4de('0xe4'));}var _0x1abecb=this[_0xd4de('0x3d')]['exec']('DIAL',[util[_0xd4de('0x2e')](_0xd4de('0xe5'),_0x4823fb),_0x6ae92d['timeout'],_0x6ae92d[_0xd4de('0xe6')],_0x6ae92d[_0xd4de('0x64')]]);if(_0x1abecb['result']===-0x1){return _0x1abecb;}return this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0xe7'),_0xd4de('0xe8')));};AGIVertices[_0xd4de('0x13')]['dialogflow']=function(_0x2167d4){logger['info'](util[_0xd4de('0x2e')](_0xd4de('0xe9'),_0x2167d4[_0xd4de('0x3a')]));if(!this[_0xd4de('0x86')](_0x2167d4[_0xd4de('0x7b')])){return this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0xea'));}if(!this['isConfigured'](_0x2167d4['text'])){return this[_0xd4de('0x3d')]['noop'](_0xd4de('0xa9'));}this[_0xd4de('0x3d')][_0xd4de('0xeb')]=!![];this[_0xd4de('0x38')](_0x2167d4);this['createSquareMessage'](_0x2167d4['text'],'in','','');this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0xec'),_0x2167d4[_0xd4de('0x5c')]));var _0x5e9df2=this[_0xd4de('0x7a')][_0xd4de('0x6f')](this,_0x2167d4);if(_0x5e9df2){for(var _0x58cdd9 in _0x5e9df2){if(_0x5e9df2[_0xd4de('0x96')](_0x58cdd9)){this[_0xd4de('0x3d')][_0xd4de('0x9e')](util[_0xd4de('0x2e')](_0xd4de('0xed'),_0x58cdd9[_0xd4de('0x69')]()),_0x5e9df2[_0x58cdd9]);}}this['createSquareMessage'](_0x5e9df2['speech'],'out',_0xd4de('0xee'),'');return this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0xef'),_0x5e9df2[_0xd4de('0xf0')]));}return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0x2167d4,_0xd4de('0xf1'));};AGIVertices[_0xd4de('0x13')][_0xd4de('0xf2')]=function(_0x2f1bcc){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0xf3'),_0x2f1bcc['label']));if(!this[_0xd4de('0x86')](_0x2f1bcc['dialogflowV2_project_id'])){return this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0xf4'));}if(!this[_0xd4de('0x86')](_0x2f1bcc['client_email'])){return this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0xf5'));}if(!this['isConfigured'](_0x2f1bcc[_0xd4de('0x7f')])){return this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0xf6'));}if(!this[_0xd4de('0x86')](_0x2f1bcc[_0xd4de('0xf7')])){return this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0xf8'));}if(!this[_0xd4de('0x86')](_0x2f1bcc[_0xd4de('0x5c')])){return this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0xa9'));}this[_0xd4de('0x3d')]['bot']=!![];this[_0xd4de('0x38')](_0x2f1bcc);this[_0xd4de('0x46')](_0x2f1bcc[_0xd4de('0x5c')],'in','','');this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0xf9'),_0x2f1bcc[_0xd4de('0x5c')]));var _0x4d1294=this[_0xd4de('0x7c')]['sync'](this,_0x2f1bcc);if(_0x4d1294){for(var _0xfd4219 in _0x4d1294){if(_0x4d1294[_0xd4de('0x96')](_0xfd4219)){if(_0xfd4219!=='providerResponse'){this['channel'][_0xd4de('0x9e')](util[_0xd4de('0x2e')](_0xd4de('0xed'),_0xfd4219['toUpperCase']()),_0x4d1294[_0xfd4219]);}}}this[_0xd4de('0x46')](_0x4d1294[_0xd4de('0xf0')],_0xd4de('0xfa'),_0xd4de('0xf2'),_0x4d1294['providerResponse']);return this['channel'][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0xfb'),_0x4d1294[_0xd4de('0xf0')]));}return this[_0xd4de('0x3d')]['error'](_0x2f1bcc,_0xd4de('0xfc'));};AGIVertices[_0xd4de('0x13')][_0xd4de('0xfd')]=function(_0x154ae5){logger[_0xd4de('0x31')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x154ae5['label']));if(!this['isConfigured'](_0x154ae5[_0xd4de('0xfe')])){return this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0xff'));}if(!this['isConfigured'](_0x154ae5['username'])){return this['channel'][_0xd4de('0xac')](_0xd4de('0x100'));}if(!this[_0xd4de('0x86')](_0x154ae5[_0xd4de('0x101')])){return this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0x102'));}if(!this['isConfigured'](_0x154ae5[_0xd4de('0x103')])){return this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0xa9'));}this['channel'][_0xd4de('0xeb')]=!![];this[_0xd4de('0x38')](_0x154ae5);this[_0xd4de('0x46')](_0x154ae5[_0xd4de('0x5c')],'in','','');this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')]('Trying\x20SestekNDA:\x20%s',_0x154ae5['text']));var _0x440591=this[_0xd4de('0x80')][_0xd4de('0x6f')](this,_0x154ae5);if(_0x440591){for(var _0x5adf1f in _0x440591){if(_0x440591[_0xd4de('0x96')](_0x5adf1f)){this[_0xd4de('0x3d')][_0xd4de('0x9e')](util[_0xd4de('0x2e')]('SESTEK_NDA_%s',_0x5adf1f[_0xd4de('0x69')]()),_0x440591[_0x5adf1f]);}}this[_0xd4de('0x46')](_0x440591[_0xd4de('0xf0')],_0xd4de('0xfa'),_0xd4de('0xfd'),'');if(_0x440591[_0xd4de('0x104')]){this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x440591['audiofile']));var _0x104eba=this[_0xd4de('0x3d')]['streamFile'](_0x440591['audiofile']);try{fs['unlink'](_0x440591[_0xd4de('0x104')]+'.wav');}catch(_0x4abe05){logger[_0xd4de('0x35')](_0x4abe05);}return _0x104eba;}else{return this[_0xd4de('0x3d')][_0xd4de('0xac')](util['format'](_0xd4de('0x105'),_0x440591[_0xd4de('0xf0')]));}}return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0x154ae5,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xd4de('0x13')][_0xd4de('0x106')]=function(_0x21fe00){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0x107'),_0x21fe00['label']));return this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0x106'));};AGIVertices['prototype'][_0xd4de('0x108')]=function(_0xd51f8f){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0xd51f8f[_0xd4de('0x3a')]));var _0x54ca53='';if(_0xd51f8f[_0xd4de('0x109')]){if(!this[_0xd4de('0x86')](_0xd51f8f['trunk_id'])){return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0xd51f8f,_0xd4de('0x10a'));}else{var _0x5ce1d6=parseInt(_0xd51f8f[_0xd4de('0x109')],0xa);if(isNaN(_0x5ce1d6)){_0x54ca53=_0xd51f8f[_0xd4de('0x109')];}else{_0x54ca53=this[_0xd4de('0x20')][_0xd4de('0x6f')](this,_0xd51f8f['trunk_id']);if(!_0x54ca53){return this['channel'][_0xd4de('0x35')](_0xd51f8f,_0xd4de('0x10b'));}}}}else if(_0xd51f8f[_0xd4de('0x10c')]){_0x54ca53=_0xd51f8f[_0xd4de('0x10c')];}else{return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0xd51f8f,_0xd4de('0x10a'));}var _0x3a27b9=this[_0xd4de('0x3d')][_0xd4de('0xaa')](_0xd4de('0xe8'),[util['format'](_0xd4de('0x10d'),_0x54ca53,_0xd51f8f[_0xd4de('0x4d')]),_0xd51f8f[_0xd4de('0x65')],_0xd51f8f[_0xd4de('0xe6')],_0xd51f8f[_0xd4de('0x64')]]);if(_0x3a27b9[_0xd4de('0xa4')]===-0x1){return _0x3a27b9;}return this['channel'][_0xd4de('0xac')](util['format'](_0xd4de('0xe7'),_0xd4de('0xe8')));};AGIVertices[_0xd4de('0x13')][_0xd4de('0x10e')]=function(_0x5a4286){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0x10f'),_0x5a4286[_0xd4de('0x3a')]));return this[_0xd4de('0x3d')]['noop'](_0xd4de('0x10e'));};AGIVertices[_0xd4de('0x13')][_0xd4de('0x10')]=function(_0x566ad6){logger[_0xd4de('0x31')](util['format'](_0xd4de('0x110'),_0x566ad6[_0xd4de('0x3a')]));if(_0x566ad6[_0xd4de('0xa7')]===0x0){return this['maxRetry'](_0x566ad6);}_0x566ad6[_0xd4de('0xa7')]-=0x1;if(!this[_0xd4de('0x86')](_0x566ad6[_0xd4de('0x111')])){return this['channel'][_0xd4de('0x35')](_0x566ad6,_0xd4de('0x112'));}var _0x5074a1=this[_0xd4de('0x22')][_0xd4de('0x6f')](this,_0x566ad6['file_id']);if(!_0x5074a1){return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0x566ad6,_0xd4de('0x113'));}if(!this[_0xd4de('0x86')](_0x566ad6[_0xd4de('0x114')])){return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0xd4de('0xdc'));}var _0x591827=this['channel'][_0xd4de('0x115')](_0x5074a1,_0x566ad6[_0xd4de('0x116')],_0x566ad6[_0xd4de('0x117')]);var _0x19f2a5=_0x591827['result']?_0x591827[_0xd4de('0xa4')][_0xd4de('0xa3')]():'';logger['info'](_0xd4de('0x118'),JSON['stringify'](_0x591827));if(_0x591827['result']===-0x1){this[_0xd4de('0x38')][_0xd4de('0x6f')](this,_0x566ad6,_0x19f2a5);return _0x591827;}else if(_0x591827[_0xd4de('0xa6')]===_0xd4de('0x65')){_0x591827[_0xd4de('0xa4')]=_0x19f2a5[_0xd4de('0x9a')]>=parseInt(_0x566ad6[_0xd4de('0x119')])?'x':'i';}else{_0x591827['result']=_0x19f2a5[_0xd4de('0x9a')]>=parseInt(_0x566ad6['mindigit'])&&_0x19f2a5[_0xd4de('0x9a')]<=parseInt(_0x566ad6['maxdigit'])?'x':'i';}var _0x5c5b2f=this['getVariable']['sync'](this,_0x566ad6[_0xd4de('0x114')]);if(!_0x5c5b2f){return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0x566ad6,_0xd4de('0xdd'));}this[_0xd4de('0x3d')][_0xd4de('0x9e')](_0x5c5b2f,_0x19f2a5);if(this[_0xd4de('0x86')](_0x566ad6[_0xd4de('0x11a')])){var _0xea8253=parseInt(_0x566ad6[_0xd4de('0x11a')],0xa);var _0x5a0496=rs[_0xd4de('0x11b')]({'charset':'*','length':_0xea8253});var _0xf287aa=_0x19f2a5[_0xd4de('0x9a')];if(_0xf287aa>0x0){if(_0xf287aa>_0xea8253){this[_0xd4de('0x38')][_0xd4de('0x6f')](this,_0x566ad6,_0x566ad6[_0xd4de('0x11c')]===_0xd4de('0x11d')?_0x5a0496+_0x19f2a5[_0xd4de('0x11e')](_0xea8253):_0x19f2a5[_0xd4de('0x11e')](0x0,_0xf287aa-_0xea8253)+_0x5a0496);}else{this[_0xd4de('0x38')][_0xd4de('0x6f')](this,_0x566ad6,rs[_0xd4de('0x11b')]({'charset':'*','length':_0xf287aa}));}}else{this[_0xd4de('0x38')][_0xd4de('0x6f')](this,_0x566ad6,'');}}else{this[_0xd4de('0x38')]['sync'](this,_0x566ad6,_0x19f2a5);}return _0x591827;};AGIVertices[_0xd4de('0x13')][_0xd4de('0x11')]=function(_0x168a79){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0x11f'),_0x168a79[_0xd4de('0x3a')]));return this[_0xd4de('0x10')](_0x168a79);};AGIVertices[_0xd4de('0x13')]['goal']=function(_0x1139e6){logger['info'](util[_0xd4de('0x2e')](_0xd4de('0x120'),_0x1139e6[_0xd4de('0x3a')]));this['createSquareDetailsReport'][_0xd4de('0x6f')](this,_0x1139e6,_0x1139e6[_0xd4de('0x121')]);return this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0x122'),_0x1139e6[_0xd4de('0x121')]));};AGIVertices[_0xd4de('0x13')][_0xd4de('0x123')]=function(_0x6c4d93){logger['info'](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x6c4d93['label']));if(!this[_0xd4de('0x86')](_0x6c4d93[_0xd4de('0x89')])||!this[_0xd4de('0x86')](_0x6c4d93[_0xd4de('0x8a')])){return this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0x124'));}if(!this[_0xd4de('0x86')](_0x6c4d93[_0xd4de('0x5c')])){return this['channel']['noop'](_0xd4de('0xa9'));}this[_0xd4de('0x3d')]['noop'](util['format'](_0xd4de('0x125'),_0x6c4d93[_0xd4de('0x5c')]));var _0x52a949=this[_0xd4de('0x88')][_0xd4de('0x6f')](this,_0x6c4d93);if(_0x52a949){this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0x126'),_0x52a949));var _0x4095c3=this[_0xd4de('0x3d')][_0xd4de('0x127')](_0x52a949);try{fs[_0xd4de('0x128')](_0x52a949+_0xd4de('0x129'));}catch(_0x241e5b){logger[_0xd4de('0x35')](_0x241e5b);}return _0x4095c3;}return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0x6c4d93,_0xd4de('0x12a'));};AGIVertices[_0xd4de('0x13')]['awslex']=function(_0x4a6d36){logger[_0xd4de('0x31')](util['format'](_0xd4de('0x12b'),_0x4a6d36[_0xd4de('0x3a')]));if(!this[_0xd4de('0x86')](_0x4a6d36[_0xd4de('0x89')])||!this[_0xd4de('0x86')](_0x4a6d36['aws_secret_access_key'])){return this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0x124'));}if(!this[_0xd4de('0x86')](_0x4a6d36[_0xd4de('0x12c')])){return this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0x12d'));}if(!this[_0xd4de('0x86')](_0x4a6d36[_0xd4de('0x5c')])){return this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0xa9'));}this[_0xd4de('0x3d')][_0xd4de('0xeb')]=!![];this[_0xd4de('0x38')](_0x4a6d36);this[_0xd4de('0x46')](_0x4a6d36['text'],'in','','');this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0x12e'),_0x4a6d36['text']));var _0xad5eab=this[_0xd4de('0x8e')][_0xd4de('0x6f')](this,_0x4a6d36);if(_0xad5eab){for(var _0x1a6ca4 in _0xad5eab){if(_0xad5eab[_0xd4de('0x96')](_0x1a6ca4)&&_[_0xd4de('0x9b')](_0xad5eab[_0x1a6ca4])){this[_0xd4de('0x3d')][_0xd4de('0x9e')](util[_0xd4de('0x2e')]('AWS_LEX_%s',_0x1a6ca4['toUpperCase']()),_0xad5eab[_0x1a6ca4]);}}if(_[_0xd4de('0x49')](_0xad5eab['message'])){return this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0x12f'));}else{this[_0xd4de('0x46')](_0xad5eab['message'],_0xd4de('0xfa'),'amazonlex','');return this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0x130'),_0xad5eab[_0xd4de('0x77')]));}}return this['channel'][_0xd4de('0x35')](_0x4a6d36,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0xd4de('0x13')][_0xd4de('0x131')]=function(_0x4201d2){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0x132'),_0x4201d2[_0xd4de('0x3a')],_0x4201d2['timeout']));if(!this[_0xd4de('0x86')](_0x4201d2[_0xd4de('0x7b')])){return this[_0xd4de('0x3d')][_0xd4de('0xac')]('no\x20key\x20configured');}var _0x559247='wav';var _0x2a5d92=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x17ffdb=util[_0xd4de('0x2e')](_0xd4de('0x9d'),_0x2a5d92,_0x559247);var _0xb20fcc=!![];if(_0x4201d2[_0xd4de('0x133')]===_0xd4de('0x134')){_0xb20fcc=![];}var _0x1fc7c5=this[_0xd4de('0x3d')][_0xd4de('0x135')](_0x2a5d92,_0x559247,_0x4201d2[_0xd4de('0x136')],_0x4201d2[_0xd4de('0x65')],undefined,_0xb20fcc);if(_0x1fc7c5[_0xd4de('0xa4')]!==-0x1){this[_0xd4de('0x3d')]['noop'](util[_0xd4de('0x2e')](_0xd4de('0x137'),_0x17ffdb));var _0x21e5a6=this[_0xd4de('0x8f')][_0xd4de('0x6f')](this,_0x4201d2,_0x17ffdb);if(_0x21e5a6){for(var _0xe9c311 in _0x21e5a6){if(_0x21e5a6[_0xd4de('0x96')](_0xe9c311)){this[_0xd4de('0x3d')][_0xd4de('0x9e')](util[_0xd4de('0x2e')]('GOOGLE_ASR_%s',_0xe9c311[_0xd4de('0x69')]()),_0x21e5a6[_0xe9c311]);}}return this[_0xd4de('0x3d')][_0xd4de('0xac')](util['format']('GoogleASR\x20Result\x20%s',JSON[_0xd4de('0x73')](_0x21e5a6)));}}return _0x1fc7c5;};AGIVertices[_0xd4de('0x13')][_0xd4de('0x138')]=function(_0x55b6fd){logger[_0xd4de('0x31')](util['format'](_0xd4de('0x139'),_0x55b6fd[_0xd4de('0x3a')]));if(!this['isConfigured'](_0x55b6fd[_0xd4de('0x92')])){return this['channel'][_0xd4de('0xac')](_0xd4de('0x13a'));}if(!this[_0xd4de('0x86')](_0x55b6fd[_0xd4de('0x93')])){return this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0x13b'));}var _0x3639c4=_0xd4de('0x13c');var _0x40b01d=util['format'](_0xd4de('0x13d'),FILES_PATH,rs[_0xd4de('0x11b')](0x4));var _0x46cc71=util[_0xd4de('0x2e')](_0xd4de('0x9d'),_0x40b01d,_0x3639c4);var _0x7d48e1=!![];if(_0x55b6fd[_0xd4de('0x133')]===_0xd4de('0x134')){_0x7d48e1=![];}var _0x178041=this['channel'][_0xd4de('0x135')](_0x40b01d,_0x3639c4,_0x55b6fd['intKey'],_0x55b6fd[_0xd4de('0x65')],undefined,_0x7d48e1);if(_0x178041['result']!==-0x1){this[_0xd4de('0x3d')]['noop'](util[_0xd4de('0x2e')]('tilde\x20%s\x20file\x20created',_0x46cc71));var _0x1ef242=this[_0xd4de('0x91')]['sync'](this,_0x55b6fd,_0x46cc71);if(_0x1ef242){for(var _0x13eb09 in _0x1ef242){if(_0x1ef242[_0xd4de('0x96')](_0x13eb09)){this[_0xd4de('0x3d')]['setVariable'](util[_0xd4de('0x2e')]('TILDE_ASR_%s',_0x13eb09[_0xd4de('0x69')]()),_0x1ef242[_0x13eb09]);}}return this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0x13e'),JSON[_0xd4de('0x73')](_0x1ef242)));}}return _0x178041;};AGIVertices[_0xd4de('0x13')][_0xd4de('0x13f')]=function(_0x33f0f5){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0x140'),_0x33f0f5[_0xd4de('0x3a')]));return this[_0xd4de('0x3d')][_0xd4de('0x141')](_0x33f0f5['context'],_0x33f0f5[_0xd4de('0x42')],_0x33f0f5[_0xd4de('0x43')]);};AGIVertices[_0xd4de('0x13')][_0xd4de('0x142')]=function(_0x42f729){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x42f729[_0xd4de('0x3a')]));if(!this[_0xd4de('0x86')](_0x42f729['condition'])){return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0x42f729,'no\x20condition\x20configured');}try{var _0x5c509c=eval(_0x42f729[_0xd4de('0x143')])?'true':_0xd4de('0x144');this[_0xd4de('0x3d')][_0xd4de('0xac')](util['format'](_0xd4de('0x145'),_0x42f729[_0xd4de('0x143')],_0x5c509c));return{'code':0xc8,'result':_0x5c509c};}catch(_0x7d1338){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xd4de('0x13')][_0xd4de('0x146')]=function(_0x24cad4){logger[_0xd4de('0x31')](util['format'](_0xd4de('0x147'),_0x24cad4[_0xd4de('0x3a')]));if(!this[_0xd4de('0x86')](_0x24cad4[_0xd4de('0x148')])){return this['channel'][_0xd4de('0x35')](_0x24cad4,'no\x20interval\x20configured');}var _0x10d58f=this[_0xd4de('0x27')][_0xd4de('0x6f')](this,_0x24cad4['interval_id']);if(!_0x10d58f){return this['channel'][_0xd4de('0x35')](_0x24cad4,_0xd4de('0x149'));}for(var _0x29f3af=0x0;_0x29f3af<_0x10d58f[_0xd4de('0x9a')];_0x29f3af+=0x1){var _0x1bf84d=this['channel'][_0xd4de('0xa2')](util[_0xd4de('0x2e')](_0xd4de('0x14a'),_0x10d58f[_0x29f3af]));if(_0x1bf84d[_0xd4de('0xa4')]===-0x1){return _0x1bf84d;}logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0x14b'),_0x10d58f[_0x29f3af],_0x1bf84d[_0xd4de('0xa6')]));if(_0x1bf84d[_0xd4de('0xa6')]===_0xd4de('0x14c')){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0x14b'),_0x10d58f[_0x29f3af],_0xd4de('0x14c')));this[_0xd4de('0x3d')]['noop'](util[_0xd4de('0x2e')]('IFTIME\x20%s\x20%s',_0x10d58f[_0x29f3af],_0xd4de('0x14c')));return{'code':0xc8,'result':_0xd4de('0x14c')};}else{logger[_0xd4de('0x31')](util['format'](_0xd4de('0x14b'),_0x10d58f[_0x29f3af],_0xd4de('0x144')));this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0x14b'),_0x10d58f[_0x29f3af],_0xd4de('0x144')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xd4de('0x13')][_0xd4de('0x14d')]=function(_0x4ddf00){logger['info'](util[_0xd4de('0x2e')](_0xd4de('0x14e'),_0x4ddf00['label']));return this['channel'][_0xd4de('0x14d')]();};AGIVertices['prototype'][_0xd4de('0x14f')]=function(_0x1f99ed){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0x150'),_0x1f99ed['label']));if(!this['isConfigured'](_0x1f99ed[_0xd4de('0x7b')])){return this[_0xd4de('0x3d')][_0xd4de('0xac')]('no\x20key\x20configured');}var _0x546dc1=_0xd4de('0x13c');var _0x38a2e1=util['format'](_0xd4de('0x13d'),FILES_PATH,rs[_0xd4de('0x11b')](0x4));var _0x1ab6e5=util[_0xd4de('0x2e')](_0xd4de('0x9d'),_0x38a2e1,_0x546dc1);var _0x1a47c0=!![];if(_0x1f99ed[_0xd4de('0x133')]===_0xd4de('0x134')){_0x1a47c0=![];}var _0x44e465=this[_0xd4de('0x3d')]['recordFile'](_0x38a2e1,_0x546dc1,_0x1f99ed[_0xd4de('0x136')],_0x1f99ed[_0xd4de('0x65')],undefined,_0x1a47c0);if(_0x44e465[_0xd4de('0xa4')]!==-0x1){this['channel'][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0x151'),_0x1ab6e5));var _0x1ec6ac=this[_0xd4de('0x84')][_0xd4de('0x6f')](this,_0x1f99ed,_0x1ab6e5);if(_0x1ec6ac){for(var _0x585a22 in _0x1ec6ac){if(_0x1ec6ac[_0xd4de('0x96')](_0x585a22)){this[_0xd4de('0x3d')]['setVariable'](util[_0xd4de('0x2e')]('ISPEECH_ASR_%s',_0x585a22[_0xd4de('0x69')]()),_0x1ec6ac[_0x585a22]);}}return this['channel']['noop'](util['format'](_0xd4de('0x152'),JSON[_0xd4de('0x73')](_0x1ec6ac)));}}return _0x44e465;};AGIVertices[_0xd4de('0x13')][_0xd4de('0x153')]=function(_0x1d893d){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0x154'),_0x1d893d[_0xd4de('0x3a')]));if(!this['isConfigured'](_0x1d893d[_0xd4de('0x7b')])){return this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0xea'));}if(!this['isConfigured'](_0x1d893d[_0xd4de('0x5c')])){return this['channel']['noop'](_0xd4de('0xa9'));}this[_0xd4de('0x3d')]['noop'](util['format'](_0xd4de('0x155'),_0x1d893d[_0xd4de('0x5c')]));var _0x12a6d7=this['ispeechTTS'][_0xd4de('0x6f')](this,_0x1d893d);if(_0x12a6d7){this[_0xd4de('0x3d')]['noop'](util[_0xd4de('0x2e')](_0xd4de('0x151'),_0x12a6d7));var _0x12bd0f=this[_0xd4de('0x3d')][_0xd4de('0x127')](_0x12a6d7,_0x1d893d['intKey']);try{fs[_0xd4de('0x128')](_0x12a6d7+_0xd4de('0x129'));}catch(_0x29bd61){logger[_0xd4de('0x35')](_0x29bd61);}return _0x12bd0f;}return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0x1d893d,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xd4de('0x13')][_0xd4de('0x156')]=function(_0x48ccea){logger['info'](util['format'](_0xd4de('0x157'),_0x48ccea['label']));if(!this['isConfigured'](_0x48ccea[_0xd4de('0x158')])){return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0x48ccea,_0xd4de('0x159'));}logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0x15a'),this[_0xd4de('0x3d')]['callerid'],_0x48ccea[_0xd4de('0x158')]));var _0xdf94cf=this[_0xd4de('0x57')][_0xd4de('0x6f')](this,_0x48ccea[_0xd4de('0x158')]);if(_0xdf94cf){logger[_0xd4de('0x31')](util['format'](_0xd4de('0x15b'),this[_0xd4de('0x3d')][_0xd4de('0x3e')],_0x48ccea[_0xd4de('0x158')]));this[_0xd4de('0x3d')]['noop'](util[_0xd4de('0x2e')](_0xd4de('0x15b'),this[_0xd4de('0x3d')]['callerid'],_0x48ccea['findBy']));return{'code':0xc8,'result':_0xd4de('0x15c')};}else{logger[_0xd4de('0x31')](util[_0xd4de('0x2e')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd4de('0x3d')][_0xd4de('0x3e')],_0x48ccea[_0xd4de('0x158')]));this['channel'][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0x15d'),this[_0xd4de('0x3d')]['callerid'],_0x48ccea['findBy']));return{'code':0xc8,'result':_0xd4de('0x15e')};}};AGIVertices[_0xd4de('0x13')][_0xd4de('0x15f')]=function(_0x50d37){logger['info'](util[_0xd4de('0x2e')](_0xd4de('0x160'),_0x50d37['label']));if(!this[_0xd4de('0x86')](_0x50d37[_0xd4de('0x158')])){return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0x50d37,_0xd4de('0x159'));}logger[_0xd4de('0x31')](util[_0xd4de('0x2e')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xd4de('0x3e')],_0x50d37[_0xd4de('0x158')]));var _0xd61749=this[_0xd4de('0x56')]['sync'](this,_0x50d37[_0xd4de('0x158')]);if(_0xd61749){logger[_0xd4de('0x31')](util['format'](_0xd4de('0x15b'),this['channel'][_0xd4de('0x3e')],_0x50d37['findBy']));this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0x15b'),this[_0xd4de('0x3d')][_0xd4de('0x3e')],_0x50d37[_0xd4de('0x158')]));return{'code':0xc8,'result':_0xd4de('0x15c')};}else{logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0x15d'),this['channel'][_0xd4de('0x3e')],_0x50d37[_0xd4de('0x158')]));this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd4de('0x3d')][_0xd4de('0x3e')],_0x50d37[_0xd4de('0x158')]));return{'code':0xc8,'result':_0xd4de('0x15e')};}};AGIVertices[_0xd4de('0x13')][_0xd4de('0x161')]=function(_0x463818){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0x162'),_0x463818['label']));if(!this[_0xd4de('0x86')](_0x463818[_0xd4de('0x163')])){return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0x463818,'no\x20operation\x20configured');}this['channel'][_0xd4de('0xac')](util[_0xd4de('0x2e')]('math\x20%s',_0x463818[_0xd4de('0x163')]));var _0x204a27=eval(_0x463818[_0xd4de('0x163')]);if(!this[_0xd4de('0x86')](_0x463818['variable_id'])){return this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0xdc'));}var _0x451c96=this[_0xd4de('0xa2')][_0xd4de('0x6f')](this,_0x463818[_0xd4de('0x114')]);if(!_0x451c96){return this['channel'][_0xd4de('0x35')](_0x463818,_0xd4de('0xdd'));}if(_[_0xd4de('0x99')](_0x204a27)){var _0x30fd69=this;_0x204a27['forEach'](function(_0x5009f5,_0x4defed){_0x30fd69[_0xd4de('0x3d')][_0xd4de('0x9e')](util[_0xd4de('0x2e')](_0xd4de('0x164'),_0x451c96,_0x4defed),_0x5009f5);});return this['channel'][_0xd4de('0xac')](util[_0xd4de('0x2e')]('variable\x20%s[key]\x20set',_0x451c96));}else{return this['channel'][_0xd4de('0x9e')](_0x451c96,_0x204a27);}};AGIVertices[_0xd4de('0x13')][_0xd4de('0xf')]=function(_0x539fe9){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0x165'),_0x539fe9['label']));if(_0x539fe9[_0xd4de('0xa7')]===0x0){return this['maxRetry'](_0x539fe9);}_0x539fe9[_0xd4de('0xa7')]-=0x1;if(!this['isConfigured'](_0x539fe9[_0xd4de('0x111')])){return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0x539fe9,'no\x20file\x20audio\x20selected');}var _0x58d1ab=this[_0xd4de('0x22')][_0xd4de('0x6f')](this,_0x539fe9[_0xd4de('0x111')]);if(!_0x58d1ab){return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0x539fe9,_0xd4de('0x113'));}var _0x2ccbec=this[_0xd4de('0x3d')][_0xd4de('0x115')](_0x58d1ab,_0x539fe9[_0xd4de('0x116')],_0x539fe9['digit']);var _0x56822a=_0x2ccbec[_0xd4de('0xa4')];if(_0x2ccbec['result']===-0x1){this['createSquareDetailsReport'][_0xd4de('0x6f')](this,_0x539fe9,'-1');return _0x2ccbec;}else if(_0x2ccbec[_0xd4de('0xa6')]===_0xd4de('0x65')){_0x2ccbec[_0xd4de('0xa4')]=_0x2ccbec['result'][_0xd4de('0x9a')]>0x0?_0x2ccbec[_0xd4de('0xa4')]:'t';}else if(_[_0xd4de('0x48')](_0x2ccbec[_0xd4de('0xa4')])){_0x2ccbec[_0xd4de('0xa4')]='#';_0x56822a='#';}if(!this[_0xd4de('0x86')](_0x539fe9[_0xd4de('0x114')])){this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0xdc'));}else{var _0x568f7a=this[_0xd4de('0xa2')][_0xd4de('0x6f')](this,_0x539fe9[_0xd4de('0x114')]);if(!_0x568f7a){return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0x539fe9,'no\x20variable\x20found');}this[_0xd4de('0x3d')][_0xd4de('0x9e')](_0x568f7a,_0x56822a);}this[_0xd4de('0x38')][_0xd4de('0x6f')](this,_0x539fe9,_0x56822a);return _0x2ccbec;};AGIVertices[_0xd4de('0x13')][_0xd4de('0xac')]=function(_0x484b00){logger[_0xd4de('0x31')](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x484b00[_0xd4de('0x3a')]));return this['channel'][_0xd4de('0xac')](_0x484b00['output']||_0x484b00[_0xd4de('0x3a')]);};AGIVertices[_0xd4de('0x13')][_0xd4de('0x166')]=function(_0x5ebbda){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0x167'),_0x5ebbda[_0xd4de('0x3a')]));if(!this[_0xd4de('0x86')](_0x5ebbda[_0xd4de('0x158')])){return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0x5ebbda,_0xd4de('0x159'));}logger[_0xd4de('0x31')](util[_0xd4de('0x2e')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xd4de('0x3d')][_0xd4de('0x3e')],_0x5ebbda['findBy']));var _0x4c585a=this[_0xd4de('0x52')]['sync'](this,_0x5ebbda[_0xd4de('0x168')]);var _0x32a4a1=this[_0xd4de('0x53')][_0xd4de('0x6f')](this,_0x5ebbda[_0xd4de('0x158')],_0x4c585a);if(_0x32a4a1){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0x15b'),this['channel'][_0xd4de('0x3e')],_0x5ebbda[_0xd4de('0x158')]));this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0x15b'),this[_0xd4de('0x3d')][_0xd4de('0x3e')],_0x5ebbda[_0xd4de('0x158')]));return{'code':0xc8,'result':_0xd4de('0x15c')};}else{logger['info'](util[_0xd4de('0x2e')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd4de('0x3d')][_0xd4de('0x3e')],_0x5ebbda['findBy']));this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0x15b'),this[_0xd4de('0x3d')]['callerid'],_0x5ebbda[_0xd4de('0x158')]));return{'code':0xc8,'result':_0xd4de('0x15e')};}};AGIVertices[_0xd4de('0x13')]['playback']=function(_0x512b0d){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0x169'),_0x512b0d['label']));if(!this[_0xd4de('0x86')](_0x512b0d[_0xd4de('0x111')])){return this[_0xd4de('0x3d')]['error'](_0x512b0d,_0xd4de('0x112'));}var _0x2db9a9=this['getSound']['sync'](this,_0x512b0d['file_id']);if(!_0x2db9a9){return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0x512b0d,_0xd4de('0x113'));}var _0x4e3939=this[_0xd4de('0x3d')][_0xd4de('0xaa')](_0xd4de('0x16a'),[_0x2db9a9,_0x512b0d[_0xd4de('0xe6')]]);if(_0x4e3939[_0xd4de('0xa4')]===-0x1){return _0x4e3939;}return this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0xc7'),'PLAYBACK',_0x2db9a9));};AGIVertices['prototype'][_0xd4de('0x16b')]=function(_0x2c6f6a){logger['info'](util[_0xd4de('0x2e')](_0xd4de('0x16c'),_0x2c6f6a['label']));if(!this[_0xd4de('0x86')](_0x2c6f6a[_0xd4de('0x16d')])){return this['channel'][_0xd4de('0x35')](_0x2c6f6a,_0xd4de('0x16e'));}var _0x1c17c9='';var _0x5c3c93=parseInt(_0x2c6f6a['queue_id'],0xa);if(isNaN(_0x5c3c93)){_0x1c17c9=_0x2c6f6a[_0xd4de('0x16d')];}else{_0x1c17c9=this[_0xd4de('0x18')][_0xd4de('0x6f')](this,_0x2c6f6a[_0xd4de('0x16d')]);if(!_0x1c17c9){return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0x2c6f6a,_0xd4de('0x16f'));}}var _0x33fe8c='';if(this[_0xd4de('0x86')](_0x2c6f6a['file_id'])){var _0x2f938d=this[_0xd4de('0x22')][_0xd4de('0x6f')](this,_0x2c6f6a[_0xd4de('0x111')]);if(_0x2f938d){_0x33fe8c=_0x2f938d;}}this[_0xd4de('0x38')][_0xd4de('0x6f')](this,_0x2c6f6a,_0x1c17c9);if(_0x2c6f6a[_0xd4de('0xe6')][_0xd4de('0x170')]('x')<0x0){_0x2c6f6a[_0xd4de('0xe6')]+='x';}if(_0x2c6f6a[_0xd4de('0xe6')]['indexOf']('X')<0x0){_0x2c6f6a['opts']+='X';}this['channel']['setVariable'](_0xd4de('0x171'),_0x1c17c9?_0x1c17c9[_0xd4de('0x172')]():'');var _0x3a7cf3=this[_0xd4de('0x3d')][_0xd4de('0xaa')](_0xd4de('0x173'),[_0x1c17c9,_0x2c6f6a[_0xd4de('0xe6')],_0x2c6f6a['url'],_0x33fe8c,_0x2c6f6a[_0xd4de('0x65')],_0x2c6f6a[_0xd4de('0x9')],_0x2c6f6a[_0xd4de('0x174')],_0x2c6f6a[_0xd4de('0x175')],'',_0x2c6f6a['position']]);if(_0x3a7cf3[_0xd4de('0xa4')]===-0x1){return _0x3a7cf3;}return this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0xc7'),_0xd4de('0x173'),_0x1c17c9));};AGIVertices[_0xd4de('0x13')][_0xd4de('0x176')]=function(_0x4be161){logger[_0xd4de('0x31')](util['format'](_0xd4de('0x177'),_0x4be161[_0xd4de('0x3a')]));var _0x2edd67=_0x4be161[_0xd4de('0x178')]||_0xd4de('0x13c');var _0x45d40d=util['format']('%s_%s',this[_0xd4de('0x3d')][_0xd4de('0x39')],rs['generate'](0x5));var _0x34e22b=util[_0xd4de('0x2e')](_0xd4de('0x179'),FILES_PATH,_0x45d40d,_0x2edd67);var _0x189553=util[_0xd4de('0x2e')](_0xd4de('0x13d'),FILES_PATH,_0x45d40d);this[_0xd4de('0x3f')][_0xd4de('0x6f')](this,_0x4be161,_0x45d40d,_0x34e22b);this[_0xd4de('0x3d')][_0xd4de('0x9e')]('RECORDING_SAVENAME',_0x45d40d);logger[_0xd4de('0x31')](_0xd4de('0x17a'),_0x189553,_0x2edd67,_0x4be161[_0xd4de('0x17b')],_0x4be161[_0xd4de('0x65')]);return this[_0xd4de('0x3d')]['recordFile'](_0x189553,_0x2edd67,_0x4be161[_0xd4de('0x17b')],_0x4be161['timeout'],undefined,!![]);};AGIVertices['prototype'][_0xd4de('0x17c')]=function(_0xb51652){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0xb51652[_0xd4de('0x3a')]));if(!this[_0xd4de('0x86')](_0xb51652[_0xd4de('0x64')])){return this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0x17d'));}var _0x3e0b08=this[_0xd4de('0x63')]['sync'](this,_0xb51652);logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0x17e'),util[_0xd4de('0x17f')](_0x3e0b08,{'showHidden':![],'depth':null})));if(!this[_0xd4de('0x86')](_0xb51652[_0xd4de('0x114')])){return this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0x180'));}var _0x3f7892=this[_0xd4de('0xa2')][_0xd4de('0x6f')](this,_0xb51652['variable_id']);if(!_0x3f7892){return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0xb51652,_0xd4de('0xdd'));}this[_0xd4de('0x3d')][_0xd4de('0x9e')](util[_0xd4de('0x2e')](_0xd4de('0x181'),_0x3f7892),_0x3e0b08[_0xd4de('0x75')]?_0x3e0b08[_0xd4de('0x75')]:'200');this[_0xd4de('0x3d')]['setVariable'](util['format'](_0xd4de('0x182'),_0x3f7892),_0x3e0b08['statusMessage']?_0x3e0b08[_0xd4de('0x76')]:'OK');if(_0x3e0b08[_0xd4de('0x6a')]){try{this[_0xd4de('0x9c')](_0x3e0b08[_0xd4de('0x6a')],_0x3f7892);}catch(_0x21262e){logger['error'](util[_0xd4de('0x2e')](_0xd4de('0x183'),_0x3f7892));}}return this['channel'][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0xe0'),_0x3f7892));};AGIVertices[_0xd4de('0x13')][_0xd4de('0x184')]=function(_0x3302f9){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0x185'),_0x3302f9['label']));return this[_0xd4de('0x3d')][_0xd4de('0x186')](_0x3302f9[_0xd4de('0x187')][_0xd4de('0x59')](/\s+/g,''),_0x3302f9[_0xd4de('0x17b')]);};AGIVertices[_0xd4de('0x13')][_0xd4de('0x188')]=function(_0x4f9530){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x4f9530[_0xd4de('0x3a')]));return this[_0xd4de('0x3d')][_0xd4de('0x189')](_0x4f9530['number'][_0xd4de('0x59')](/\s+/g,''),_0x4f9530['escape_digits']);};AGIVertices[_0xd4de('0x13')][_0xd4de('0x18a')]=function(_0x335443){logger['info'](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x335443[_0xd4de('0x3a')]));return this[_0xd4de('0x3d')][_0xd4de('0x18b')](_0x335443[_0xd4de('0x5c')],_0x335443[_0xd4de('0x17b')]);};AGIVertices[_0xd4de('0x13')][_0xd4de('0x18c')]=function(_0x1c4e9e){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0x18d'),_0x1c4e9e[_0xd4de('0x3a')]));if(!this['isConfigured'](_0x1c4e9e['account_id'])){return this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0x18e'));}var _0x100763=this[_0xd4de('0x25')][_0xd4de('0x6f')](this,_0x1c4e9e['account_id']);if(!_0x100763||!_0x100763[_0xd4de('0x18f')]){return this[_0xd4de('0x3d')]['error'](_0x1c4e9e,'no\x20mail\x20account\x20found');}var _0x2955bb={'from':util[_0xd4de('0x2e')]('\x22%s\x22\x20<%s>',_0x100763[_0xd4de('0x16')],_0x100763[_0xd4de('0x190')]||_0x100763[_0xd4de('0x18f')][_0xd4de('0x191')]),'to':_0x1c4e9e['to']||'','cc':_0x1c4e9e['cc']||'','bcc':_0x1c4e9e[_0xd4de('0x192')]||'','subject':_0x1c4e9e[_0xd4de('0x193')],'html':_0x1c4e9e[_0xd4de('0x5c')],'text':_0x1c4e9e[_0xd4de('0x5c')]};if(this[_0xd4de('0x86')](_0x1c4e9e[_0xd4de('0x194')])){}logger[_0xd4de('0xe1')](_0xd4de('0x195'),JSON[_0xd4de('0x73')](_0x2955bb));this[_0xd4de('0x38')][_0xd4de('0x6f')](this,_0x1c4e9e,_0x1c4e9e['account_id']);this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x100763[_0xd4de('0x16')]));this[_0xd4de('0x26')][_0xd4de('0x6f')](this,_0x100763[_0xd4de('0x196')],_0x2955bb);return this[_0xd4de('0x3d')]['noop'](_0xd4de('0x197'));};AGIVertices['prototype'][_0xd4de('0x198')]=function(_0x2189de){logger['info'](util[_0xd4de('0x2e')](_0xd4de('0x199'),_0x2189de[_0xd4de('0x3a')]));return this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0x19a'));};AGIVertices[_0xd4de('0x13')][_0xd4de('0x19b')]=function(_0x5cca7a){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0x19c'),_0x5cca7a[_0xd4de('0x3a')]));if(!this[_0xd4de('0x86')](_0x5cca7a[_0xd4de('0x19d')])){return this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0x19e'));}var _0x186f8c=this[_0xd4de('0x37')]['sync'](this,_0x5cca7a[_0xd4de('0x19d')]);if(!_0x186f8c){return this[_0xd4de('0x3d')]['error'](_0x5cca7a,_0xd4de('0x19f'));}var _0x4c9d19={'body':_0x5cca7a[_0xd4de('0x1a0')],'phone':_0x5cca7a['to']||'','SmsAccountId':_0x186f8c['id']};logger[_0xd4de('0xe1')](_0xd4de('0x1a1'),JSON[_0xd4de('0x73')](_0x4c9d19));this[_0xd4de('0x38')][_0xd4de('0x6f')](this,_0x5cca7a,_0x5cca7a[_0xd4de('0x19d')]);this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x186f8c[_0xd4de('0x16')]));this[_0xd4de('0x1a2')][_0xd4de('0x6f')](this,_0x4c9d19);return this[_0xd4de('0x3d')][_0xd4de('0xac')](_0xd4de('0x1a3'));};AGIVertices[_0xd4de('0x13')][_0xd4de('0x1a4')]=function(_0x351101){logger['info'](util[_0xd4de('0x2e')](_0xd4de('0x1a5'),_0x351101[_0xd4de('0x3a')]));if(!this[_0xd4de('0x86')](_0x351101[_0xd4de('0x114')])){return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0x351101,_0xd4de('0x1a6'));}var _0x47c733=this[_0xd4de('0xa2')][_0xd4de('0x6f')](this,_0x351101['variable_id']);if(!_0x47c733){return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0x351101,_0xd4de('0xdd'));}return this[_0xd4de('0x3d')]['setVariable'](_0x47c733,_0x351101[_0xd4de('0x1a7')]);};AGIVertices[_0xd4de('0x13')][_0xd4de('0x1a8')]=function(_0x2360db){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0x1a9'),_0x2360db[_0xd4de('0x3a')]));this[_0xd4de('0x3d')][_0xd4de('0xac')]('START\x20CALLY\x20SQUARE');if(_0x2360db[_0xd4de('0xbc')]===_0xd4de('0x1aa')){this['channel']['noop'](_0xd4de('0x1ab'));return this[_0xd4de('0x3d')]['answer']();}return this[_0xd4de('0x3d')][_0xd4de('0xac')]('Skipped\x20Answer');};AGIVertices[_0xd4de('0x13')][_0xd4de('0x1ac')]=function(_0x5b3a21){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0x1ad'),_0x5b3a21['label']));if(!this[_0xd4de('0x86')](_0x5b3a21[_0xd4de('0x1ae')])){return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0x5b3a21,'no\x20subproject\x20selected');}var _0x2219cb=this['getSquareProject'][_0xd4de('0x6f')](this,_0x5b3a21[_0xd4de('0x1ae')]);if(!this[_0xd4de('0x86')](_0x2219cb)){return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0x5b3a21,util[_0xd4de('0x2e')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x5b3a21['project_id']));}if(_0x2219cb===this[_0xd4de('0x3d')][_0xd4de('0x3c')]){return this[_0xd4de('0x3d')]['error'](_0x5b3a21,_0xd4de('0x1af'));}this[_0xd4de('0x38')][_0xd4de('0x6f')](this,_0x5b3a21,_0x2219cb);var _0x4d4fee=this[_0xd4de('0x3d')]['exec'](_0xd4de('0x1b0'),util[_0xd4de('0x2e')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xd4de('0x9')][_0xd4de('0x1b1')]||_0xd4de('0x1b2'),_0x2219cb,this[_0xd4de('0x3d')][_0xd4de('0x3c')]));if(_0x4d4fee[_0xd4de('0xa4')]===-0x1){return _0x4d4fee;}return this[_0xd4de('0x3d')]['noop'](util[_0xd4de('0x2e')](_0xd4de('0xc7'),_0xd4de('0x1b0'),_0x2219cb));};AGIVertices[_0xd4de('0x13')][_0xd4de('0x1b3')]=function(_0x5de285){logger[_0xd4de('0x31')](util['format'](_0xd4de('0x1b4'),_0x5de285[_0xd4de('0x3a')]));var _0x3289c7=this[_0xd4de('0x58')][_0xd4de('0x6f')](this,_0x5de285[_0xd4de('0xba')]);this[_0xd4de('0x38')][_0xd4de('0x6f')](this,_0x5de285,_0x5de285[_0xd4de('0xba')]);if(this['isConfigured'](_0x5de285['variable_id'])){var _0x239393=this[_0xd4de('0xa2')]['sync'](this,_0x5de285[_0xd4de('0x114')]);if(_0x239393){this['channel']['setVariable'](_0x239393,_0x3289c7);return this['channel'][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0x1b5'),_0x5de285[_0xd4de('0xba')],_0x239393));}}return this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x5de285[_0xd4de('0xba')]));};AGIVertices[_0xd4de('0x13')][_0xd4de('0x1b6')]=function(_0x192af5){logger['info'](util[_0xd4de('0x2e')](_0xd4de('0x1b7'),_0x192af5[_0xd4de('0x3a')]));_0x192af5[_0xd4de('0x5c')]=_0x192af5[_0xd4de('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x192af5['apiKey'])){return this['channel'][_0xd4de('0xac')](_0xd4de('0x1b8'));}if(!this['isConfigured'](_0x192af5[_0xd4de('0x5c')])){return this['channel']['noop'](_0xd4de('0xa9'));}this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0x1b9'),_0x192af5[_0xd4de('0x5c')]));var _0x37e0b2=this[_0xd4de('0x5a')][_0xd4de('0x6f')](this,_0x192af5);if(_0x37e0b2){this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0x1ba'),_0x37e0b2));var _0x5a81ba=this[_0xd4de('0x3d')][_0xd4de('0x127')](_0x37e0b2);try{fs[_0xd4de('0x128')](_0x37e0b2+'.wav');}catch(_0x49e335){logger['error'](_0x49e335);}return _0x5a81ba;}return this[_0xd4de('0x3d')]['error'](_0x192af5,_0xd4de('0x1bb'));};AGIVertices['prototype'][_0xd4de('0x1bc')]=function(_0x5285f1){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x5285f1[_0xd4de('0x3a')]));_0x5285f1['text']=_0x5285f1[_0xd4de('0x5c')][_0xd4de('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd4de('0x86')](_0x5285f1['text'])){return this[_0xd4de('0x3d')]['noop'](_0xd4de('0xa9'));}this['channel'][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0x1bd'),_0x5285f1[_0xd4de('0x5c')]));var _0x406b08=this[_0xd4de('0x61')]['sync'](this,_0x5285f1);if(_0x406b08){this['channel'][_0xd4de('0xac')](util['format'](_0xd4de('0x1be'),_0x406b08));var _0x19e305=this['channel']['streamFile'](_0x406b08);try{fs[_0xd4de('0x128')](_0x406b08+'.wav');}catch(_0x49b0cf){logger[_0xd4de('0x35')](_0x49b0cf);}return _0x19e305;}return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0x5285f1,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xd4de('0x13')][_0xd4de('0x1bf')]=function(_0x308c75){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0x1c0'),_0x308c75['label']));if(!this[_0xd4de('0x86')](_0x308c75['findBy'])){return this[_0xd4de('0x3d')][_0xd4de('0x35')](_0x308c75,_0xd4de('0x159'));}logger['info'](util[_0xd4de('0x2e')](_0xd4de('0x15a'),this[_0xd4de('0x3d')]['callerid'],_0x308c75['findBy']));var _0x549957=this[_0xd4de('0x54')][_0xd4de('0x6f')](this,_0x308c75[_0xd4de('0x158')]);if(_0x549957){logger[_0xd4de('0x31')](util['format'](_0xd4de('0x15b'),this[_0xd4de('0x3d')][_0xd4de('0x3e')],_0x308c75[_0xd4de('0x158')]));this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0x15b'),this['channel'][_0xd4de('0x3e')],_0x308c75['findBy']));return{'code':0xc8,'result':_0xd4de('0x15c')};}else{logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0x15d'),this[_0xd4de('0x3d')][_0xd4de('0x3e')],_0x308c75[_0xd4de('0x158')]));this[_0xd4de('0x3d')][_0xd4de('0xac')](util['format'](_0xd4de('0x15d'),this[_0xd4de('0x3d')]['callerid'],_0x308c75[_0xd4de('0x158')]));return{'code':0xc8,'result':_0xd4de('0x15e')};}};AGIVertices[_0xd4de('0x13')][_0xd4de('0x1c1')]=function(_0x392258){logger[_0xd4de('0x31')](util[_0xd4de('0x2e')](_0xd4de('0x1c2'),_0x392258[_0xd4de('0x3a')]));var _0x1fd6a0=this[_0xd4de('0x3d')][_0xd4de('0xaa')](_0xd4de('0x1c3'),[_0x392258[_0xd4de('0x1c4')],_0x392258[_0xd4de('0x79')]]);if(_0x1fd6a0[_0xd4de('0xa4')]===-0x1){return _0x1fd6a0;}return this[_0xd4de('0x3d')][_0xd4de('0xac')](util[_0xd4de('0x2e')](_0xd4de('0xc7'),_0xd4de('0x1c3'),_0x392258[_0xd4de('0x1c4')]));};AGIVertices['prototype'][_0xd4de('0x1c5')]=function(_0x11e430){logger['info'](util['format'](_0xd4de('0x1c6'),_0x11e430['label']));if(!this['isConfigured'](_0x11e430['variable_id'])){return this['channel'][_0xd4de('0x35')](_0x11e430,_0xd4de('0x1a6'));}var _0x473fad=this[_0xd4de('0xa2')][_0xd4de('0x6f')](this,_0x11e430[_0xd4de('0x114')]);if(!_0x473fad){return this['channel'][_0xd4de('0x35')](_0x11e430,_0xd4de('0xdd'));}var _0x55b372=this[_0xd4de('0x3d')][_0xd4de('0xa2')](_0x473fad);return{'code':0xc8,'result':_0x55b372[_0xd4de('0xa6')]?_0x55b372[_0xd4de('0xa6')]:'-'};};String[_0xd4de('0x13')]['replaceAll']=function(_0x46590b,_0x424b92){return this[_0xd4de('0xa0')](_0x46590b)[_0xd4de('0x1c7')](_0x424b92);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index c3d02bd..f0f3d3f 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 _0x9142=['../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','updateAcw','timer','update','uniqueid','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','../ami','../../../config/logger'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0x9142,0x102));var _0x2914=function(_0x30a87d,_0xb776e2){_0x30a87d=_0x30a87d-0x0;var _0x3fd74c=_0x9142[_0x30a87d];return _0x3fd74c;};'use strict';var _=require(_0x2914('0x0'));var moment=require('moment');var ami=require(_0x2914('0x1'));var logger=require(_0x2914('0x2'))('acw');var RpcUser=require(_0x2914('0x3'));var RpcVoiceAgentReport=require(_0x2914('0x4'));function Acw(_0x3d056e){this['voiceQueues']=_0x3d056e[_0x2914('0x5')];this[_0x2914('0x6')]=_0x3d056e[_0x2914('0x6')];this[_0x2914('0x7')]=_0x3d056e[_0x2914('0x7')];this['channels']={};ami['on']('agentconnect',this[_0x2914('0x8')][_0x2914('0x9')](this));ami['on'](_0x2914('0xa'),this[_0x2914('0xb')][_0x2914('0x9')](this));ami['on'](_0x2914('0xc'),this['syncHangup']['bind'](this));ami['on'](_0x2914('0xd'),this[_0x2914('0xe')][_0x2914('0x9')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x2914('0x9')](this));ami['on'](_0x2914('0xf'),this[_0x2914('0x10')][_0x2914('0x9')](this));ami['on'](_0x2914('0x11'),this['syncAgentConnectPreview'][_0x2914('0x9')](this));}function getDiff(_0x4d2b3c){var _0x254d5e=moment()[_0x2914('0x12')](0x0);var _0x5a2dcf=moment(_0x4d2b3c)['milliseconds'](0x0);return _0x254d5e[_0x2914('0x13')](_0x5a2dcf,_0x2914('0x14'));}Acw[_0x2914('0x15')][_0x2914('0x16')]=function(_0x2da22d){try{var _0x50f0c4=this;var _0x1bc8d0=this[_0x2914('0x17')][_0x2da22d][_0x2914('0x18')];var _0x41a029=this['channels'][_0x2da22d][_0x2914('0x19')];var _0xfff5ed=this[_0x2914('0x5')][_0x41a029];var _0x3e55db=![];var _0x26899c=_0x2914('0x1a');if(_0xfff5ed[_0x2914('0x1b')]){if(_0xfff5ed['mandatoryDispositionPause']['name']){_0x3e55db=!![];_0x26899c=_0xfff5ed[_0x2914('0x1c')][_0x2914('0x1d')];}}ami[_0x2914('0x1e')]({'action':'QueuePause','interface':_0x1bc8d0,'paused':!![],'reason':_0x26899c})['then'](function(){if(_0x50f0c4[_0x2914('0x6')][_0x1bc8d0]){return RpcUser['getAgent'](_0x50f0c4[_0x2914('0x6')][_0x1bc8d0]['id'])[_0x2914('0x1f')](function(_0x4cef8f){if(_0x4cef8f&&!_0x4cef8f[_0x2914('0x20')]){logger[_0x2914('0x21')](_0x2914('0x22'),_0x2da22d,_0x1bc8d0,_0x41a029);var _0x58cf22=_0x50f0c4[_0x2914('0x17')][_0x2da22d][_0x2914('0x23')]&&_0x50f0c4[_0x2914('0x17')][_0x2da22d][_0x2914('0x24')]?_0x50f0c4[_0x2914('0x17')][_0x2da22d]['destlinkedid']:_0x2da22d;return RpcUser[_0x2914('0x25')](_0x50f0c4['agents'][_0x1bc8d0],_0x26899c,_0x58cf22)['then'](function(){if(!_0x3e55db){_0x50f0c4[_0x2914('0x7')][_0x1bc8d0]={};logger[_0x2914('0x21')](_0x2914('0x26'),_0x2da22d,_0x50f0c4[_0x2914('0x5')][_0x41a029][_0x2914('0x27')],_0x1bc8d0,_0x41a029);_0x50f0c4['timers'][_0x1bc8d0]['timer']=setTimeout(_0x50f0c4[_0x2914('0x28')]['bind'](_0x50f0c4,_0x1bc8d0),_0x50f0c4[_0x2914('0x5')][_0x41a029][_0x2914('0x27')]*0x3e8);_0x50f0c4[_0x2914('0x7')][_0x1bc8d0][_0x2914('0x29')]=moment()[_0x2914('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');_0x50f0c4[_0x2914('0x7')][_0x1bc8d0]['uniqueid']=_0x2da22d;_0x50f0c4['timers'][_0x1bc8d0]['queue']=_0x41a029;_0x50f0c4[_0x2914('0x7')][_0x1bc8d0][_0x2914('0x2b')]=function(){var _0x345d3e=getDiff(_0x50f0c4[_0x2914('0x7')][_0x1bc8d0][_0x2914('0x29')]);clearTimeout(_0x50f0c4[_0x2914('0x7')][_0x1bc8d0][_0x2914('0x2c')]);_0x50f0c4[_0x2914('0x7')][_0x1bc8d0][_0x2914('0x2c')]=![];RpcVoiceAgentReport[_0x2914('0x2d')]({'acwtime':_0x345d3e},_0x50f0c4[_0x2914('0x7')][_0x1bc8d0][_0x2914('0x2e')],_0x1bc8d0)[_0x2914('0x1f')](function(_0x394fbd){logger[_0x2914('0x21')]('[%s][UPDATE][ACWTIME:%s]',_0x2da22d,_0x345d3e,_0x394fbd);})[_0x2914('0x2f')](function(_0x361d80){logger[_0x2914('0x30')]('[%s][UPDATE][ERRORS:%s]',_0x2da22d,_0x361d80);});delete _0x50f0c4[_0x2914('0x7')][_0x1bc8d0];};}});}else{logger[_0x2914('0x21')](_0x2914('0x31'),_0x2da22d,_0x1bc8d0,_0x41a029);}});}})['catch'](function(){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2da22d,_0x50f0c4[_0x2914('0x5')][_0x41a029][_0x2914('0x27')],_0x1bc8d0,_0x41a029);})[_0x2914('0x32')](function(){delete _0x50f0c4['channels'][_0x2da22d];});}catch(_0x511b57){logger[_0x2914('0x30')](_0x2914('0x33'),_0x511b57[_0x2914('0x34')]);}};Acw[_0x2914('0x15')][_0x2914('0x28')]=function(_0x3b745b){try{var _0x3670cf=this;if(_0x3670cf['timers'][_0x3b745b]){_0x3670cf['timers'][_0x3b745b]['timer']=![];var _0x6a25a8=_0x3670cf[_0x2914('0x7')][_0x3b745b][_0x2914('0x2e')];var _0x10f483=_0x3670cf[_0x2914('0x7')][_0x3b745b][_0x2914('0x19')];var _0x1ce4d9=_0x3670cf[_0x2914('0x5')][_0x10f483][_0x2914('0x27')];logger[_0x2914('0x21')](_0x2914('0x35'),_0x6a25a8,_0x3b745b);RpcUser[_0x2914('0x36')](this[_0x2914('0x6')][_0x3b745b]);RpcVoiceAgentReport[_0x2914('0x2d')]({'acwtime':_0x1ce4d9,'agentacw':!![]},_0x6a25a8,_0x3b745b)['then'](function(_0x410cb4){logger[_0x2914('0x21')]('[%s][UPDATE][ACWTIME:%s]',_0x6a25a8,_0x1ce4d9,_0x410cb4);})[_0x2914('0x2f')](function(_0x234232){logger['error'](_0x2914('0x37'),_0x6a25a8,_0x234232);});}else{logger[_0x2914('0x30')](_0x2914('0x38'),_0x3b745b);if(_0x3670cf[_0x2914('0x7')]){logger[_0x2914('0x21')](_0x2914('0x39'),JSON[_0x2914('0x3a')](_0x3670cf['timers']));}}}catch(_0x86039c){logger['error'](_0x2914('0x3b'),_0x86039c[_0x2914('0x34')]);}};Acw[_0x2914('0x15')][_0x2914('0x8')]=function(_0x2a366f){try{if(this[_0x2914('0x5')][_0x2a366f[_0x2914('0x19')]]&&(this[_0x2914('0x5')][_0x2a366f['queue']][_0x2914('0x3c')]||this[_0x2914('0x5')][_0x2a366f[_0x2914('0x19')]][_0x2914('0x1b')])){if(this[_0x2914('0x6')][_0x2a366f['interface']]){this[_0x2914('0x17')][_0x2a366f[_0x2914('0x2e')]]={'queue':_0x2a366f[_0x2914('0x19')],'interface':_0x2a366f[_0x2914('0x18')],'destlinkedid':_0x2a366f[_0x2914('0x24')]};}}}catch(_0x154eac){logger[_0x2914('0x30')](_0x2914('0x3d'),_0x154eac[_0x2914('0x34')]);}};Acw[_0x2914('0x15')][_0x2914('0x3e')]=function(_0x2231a2){try{if(this[_0x2914('0x5')][_0x2231a2[_0x2914('0x19')]]&&(this['voiceQueues'][_0x2231a2['queue']][_0x2914('0x3c')]||this['voiceQueues'][_0x2231a2[_0x2914('0x19')]][_0x2914('0x1b')])){if(this['agents'][_0x2231a2[_0x2914('0x18')]]){this['channels'][_0x2231a2[_0x2914('0x2e')]]={'queue':_0x2231a2[_0x2914('0x19')],'interface':_0x2231a2['interface']};}}}catch(_0x5b1586){logger[_0x2914('0x30')](_0x2914('0x3f'),_0x5b1586[_0x2914('0x34')]);}};Acw[_0x2914('0x15')][_0x2914('0xb')]=function(_0x368167){try{if(this[_0x2914('0x17')][_0x368167[_0x2914('0x2e')]]&&_[_0x2914('0x40')](this[_0x2914('0x17')][_0x368167['uniqueid']][_0x2914('0x23')])){logger[_0x2914('0x21')](_0x2914('0x41'),_0x368167[_0x2914('0x2e')]);this['startAcw'](_0x368167[_0x2914('0x2e')]);}else if(this[_0x2914('0x17')][_0x368167[_0x2914('0x42')]]&&_[_0x2914('0x40')](this[_0x2914('0x17')][_0x368167['linkedid']]['attended'])){logger[_0x2914('0x21')](_0x2914('0x43'),_0x368167['linkedid']);this[_0x2914('0x16')](_0x368167[_0x2914('0x42')]);}}catch(_0x1d9f0d){logger[_0x2914('0x30')](_0x2914('0x44'),_0x1d9f0d[_0x2914('0x34')]);}};Acw[_0x2914('0x15')][_0x2914('0x45')]=function(_0x2cb9b0){try{if(this[_0x2914('0x17')][_0x2cb9b0[_0x2914('0x2e')]]&&this['channels'][_0x2cb9b0[_0x2914('0x2e')]][_0x2914('0x23')]){logger[_0x2914('0x21')](_0x2914('0x46'),_0x2cb9b0[_0x2914('0x2e')]);this['startAcw'](_0x2cb9b0['uniqueid']);}else if(this[_0x2914('0x17')][_0x2cb9b0['linkedid']]&&this['channels'][_0x2cb9b0[_0x2914('0x42')]][_0x2914('0x23')]){logger[_0x2914('0x21')](_0x2914('0x47'),_0x2cb9b0[_0x2914('0x42')]);this[_0x2914('0x16')](_0x2cb9b0[_0x2914('0x42')]);}}catch(_0x330e22){logger['error']('[ACW][syncHangup]\x20%s',_0x330e22[_0x2914('0x34')]);}};Acw[_0x2914('0x15')][_0x2914('0x48')]=function(_0x267eb8){try{if(!_[_0x2914('0x49')](this[_0x2914('0x17')][_0x267eb8[_0x2914('0x4a')]])){this[_0x2914('0x16')](_0x267eb8[_0x2914('0x4a')]);if(this[_0x2914('0x17')][_0x267eb8[_0x2914('0x4b')]]){this[_0x2914('0x17')][_0x267eb8[_0x2914('0x4b')]][_0x2914('0x23')]=!![];this[_0x2914('0x17')][_0x267eb8[_0x2914('0x4c')]]=this[_0x2914('0x17')][_0x267eb8[_0x2914('0x4b')]];delete this[_0x2914('0x17')][_0x267eb8['secondtransfereruniqueid']];}}else if(!_[_0x2914('0x49')](this[_0x2914('0x17')][_0x267eb8[_0x2914('0x4c')]])){this[_0x2914('0x16')](_0x267eb8[_0x2914('0x4c')]);if(this[_0x2914('0x17')][_0x267eb8['origtransfereruniqueid']]){this[_0x2914('0x17')][_0x267eb8[_0x2914('0x4d')]][_0x2914('0x23')]=!![];this[_0x2914('0x17')][_0x267eb8[_0x2914('0x4a')]]=this[_0x2914('0x17')][_0x267eb8[_0x2914('0x4d')]];delete this[_0x2914('0x17')][_0x267eb8['origtransfereruniqueid']];}}}catch(_0x53fa20){logger[_0x2914('0x30')](_0x2914('0x4e'),_0x53fa20[_0x2914('0x34')]);}};Acw[_0x2914('0x15')][_0x2914('0x10')]=function(_0x47051a){try{if(this['channels'][_0x47051a[_0x2914('0x4f')]]){logger[_0x2914('0x21')](_0x2914('0x50'),JSON[_0x2914('0x3a')](_0x47051a[_0x2914('0x4f')]));this[_0x2914('0x16')](_0x47051a[_0x2914('0x4f')]);}else if(this[_0x2914('0x17')][_0x47051a['transfererlinkedid']]){logger[_0x2914('0x21')](_0x2914('0x51'),JSON[_0x2914('0x3a')](_0x47051a[_0x2914('0x52')]));this['startAcw'](_0x47051a[_0x2914('0x52')]);}}catch(_0xd34468){logger[_0x2914('0x30')]('[ACW][syncBlindTransfer]\x20%s',_0xd34468['message']);}};Acw[_0x2914('0x15')][_0x2914('0xe')]=function(_0x2fde27){try{if(this['voiceQueues'][_0x2fde27['queue']]&&this['voiceQueues'][_0x2fde27[_0x2914('0x19')]]['autopause']===_0x2914('0x53')){if(this['agents'][_0x2fde27['interface']]){logger[_0x2914('0x21')](_0x2914('0x54'),_0x2fde27[_0x2914('0x2e')],_0x2fde27[_0x2914('0x18')],_0x2fde27[_0x2914('0x19')]);return RpcUser[_0x2914('0x25')](this[_0x2914('0x6')][_0x2fde27[_0x2914('0x18')]],'Auto-Pause',_0x2fde27[_0x2914('0x2e')]);}}}catch(_0x59b610){logger[_0x2914('0x30')](_0x2914('0x55'),_0x59b610[_0x2914('0x34')]);}};module[_0x2914('0x56')]=Acw; \ No newline at end of file +var _0x1e1a=['moment','../ami','../../../config/logger','acw','../rpc/user','agents','timers','channels','agentconnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','prototype','interface','queue','voiceQueues','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','getAgent','info','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','message','[%s][TIMER][STOP][AGENT:%s]','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','startAcw','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash'];(function(_0x49a3a5,_0x5a8caf){var _0xf6b7fb=function(_0x3b05aa){while(--_0x3b05aa){_0x49a3a5['push'](_0x49a3a5['shift']());}};_0xf6b7fb(++_0x5a8caf);}(_0x1e1a,0x1f1));var _0xa1e1=function(_0x35b433,_0x1abe39){_0x35b433=_0x35b433-0x0;var _0xbb3fc2=_0x1e1a[_0x35b433];return _0xbb3fc2;};'use strict';var _=require(_0xa1e1('0x0'));var moment=require(_0xa1e1('0x1'));var ami=require(_0xa1e1('0x2'));var logger=require(_0xa1e1('0x3'))(_0xa1e1('0x4'));var RpcUser=require(_0xa1e1('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x513fb2){this['voiceQueues']=_0x513fb2['voiceQueues'];this['agents']=_0x513fb2[_0xa1e1('0x6')];this['timers']=_0x513fb2[_0xa1e1('0x7')];this[_0xa1e1('0x8')]={};ami['on'](_0xa1e1('0x9'),this['syncAgentConnect'][_0xa1e1('0xa')](this));ami['on'](_0xa1e1('0xb'),this['syncHangupRequest']['bind'](this));ami['on'](_0xa1e1('0xc'),this[_0xa1e1('0xd')][_0xa1e1('0xa')](this));ami['on'](_0xa1e1('0xe'),this[_0xa1e1('0xf')][_0xa1e1('0xa')](this));ami['on'](_0xa1e1('0x10'),this[_0xa1e1('0x11')][_0xa1e1('0xa')](this));ami['on'](_0xa1e1('0x12'),this[_0xa1e1('0x13')]['bind'](this));ami['on'](_0xa1e1('0x14'),this[_0xa1e1('0x15')][_0xa1e1('0xa')](this));}function getDiff(_0x2642f4){var _0x132a96=moment()['milliseconds'](0x0);var _0x74a9b9=moment(_0x2642f4)[_0xa1e1('0x16')](0x0);return _0x132a96[_0xa1e1('0x17')](_0x74a9b9,'seconds');}Acw[_0xa1e1('0x18')]['startAcw']=function(_0x2d4ae7){try{var _0x408e6c=this;var _0x48f134=this[_0xa1e1('0x8')][_0x2d4ae7][_0xa1e1('0x19')];var _0x3ce942=this['channels'][_0x2d4ae7][_0xa1e1('0x1a')];var _0x4fa28c=this[_0xa1e1('0x1b')][_0x3ce942];var _0x47c449=![];var _0x46e72d=_0xa1e1('0x1c');if(_0x4fa28c[_0xa1e1('0x1d')]){if(_0x4fa28c[_0xa1e1('0x1e')][_0xa1e1('0x1f')]){_0x47c449=!![];_0x46e72d=_0x4fa28c[_0xa1e1('0x1e')][_0xa1e1('0x1f')];}}ami[_0xa1e1('0x20')]({'action':'QueuePause','interface':_0x48f134,'paused':!![],'reason':_0x46e72d})[_0xa1e1('0x21')](function(){if(_0x408e6c[_0xa1e1('0x6')][_0x48f134]){return RpcUser[_0xa1e1('0x22')](_0x408e6c[_0xa1e1('0x6')][_0x48f134]['id'])['then'](function(_0x3f13e3){if(_0x3f13e3&&!_0x3f13e3['voicePause']){logger[_0xa1e1('0x23')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x2d4ae7,_0x48f134,_0x3ce942);var _0x5c83d3=_0x408e6c['channels'][_0x2d4ae7][_0xa1e1('0x24')]&&_0x408e6c['channels'][_0x2d4ae7][_0xa1e1('0x25')]?_0x408e6c[_0xa1e1('0x8')][_0x2d4ae7]['destlinkedid']:_0x2d4ae7;return RpcUser[_0xa1e1('0x26')](_0x408e6c['agents'][_0x48f134],_0x46e72d,_0x5c83d3)[_0xa1e1('0x21')](function(){if(!_0x47c449){_0x408e6c[_0xa1e1('0x7')][_0x48f134]={};logger['info'](_0xa1e1('0x27'),_0x2d4ae7,_0x408e6c['voiceQueues'][_0x3ce942][_0xa1e1('0x28')],_0x48f134,_0x3ce942);_0x408e6c[_0xa1e1('0x7')][_0x48f134][_0xa1e1('0x29')]=setTimeout(_0x408e6c[_0xa1e1('0x2a')]['bind'](_0x408e6c,_0x48f134),_0x408e6c[_0xa1e1('0x1b')][_0x3ce942][_0xa1e1('0x28')]*0x3e8);_0x408e6c[_0xa1e1('0x7')][_0x48f134][_0xa1e1('0x2b')]=moment()['format'](_0xa1e1('0x2c'));_0x408e6c['timers'][_0x48f134][_0xa1e1('0x2d')]=_0x2d4ae7;_0x408e6c[_0xa1e1('0x7')][_0x48f134][_0xa1e1('0x1a')]=_0x3ce942;_0x408e6c['timers'][_0x48f134][_0xa1e1('0x2e')]=function(){var _0x21a60e=getDiff(_0x408e6c[_0xa1e1('0x7')][_0x48f134][_0xa1e1('0x2b')]);clearTimeout(_0x408e6c[_0xa1e1('0x7')][_0x48f134][_0xa1e1('0x29')]);_0x408e6c[_0xa1e1('0x7')][_0x48f134][_0xa1e1('0x29')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x21a60e},_0x408e6c['timers'][_0x48f134][_0xa1e1('0x2d')],_0x48f134)[_0xa1e1('0x21')](function(_0x121ba7){logger['info'](_0xa1e1('0x2f'),_0x2d4ae7,_0x21a60e,_0x121ba7);})[_0xa1e1('0x30')](function(_0x58b48c){logger[_0xa1e1('0x31')](_0xa1e1('0x32'),_0x2d4ae7,_0x58b48c);});delete _0x408e6c[_0xa1e1('0x7')][_0x48f134];};}});}else{logger[_0xa1e1('0x23')](_0xa1e1('0x33'),_0x2d4ae7,_0x48f134,_0x3ce942);}});}})['catch'](function(){logger[_0xa1e1('0x31')](_0xa1e1('0x27'),_0x2d4ae7,_0x408e6c[_0xa1e1('0x1b')][_0x3ce942][_0xa1e1('0x28')],_0x48f134,_0x3ce942);})[_0xa1e1('0x34')](function(){delete _0x408e6c[_0xa1e1('0x8')][_0x2d4ae7];});}catch(_0xfe13d6){logger[_0xa1e1('0x31')]('[ACW][START]\x20%s',_0xfe13d6[_0xa1e1('0x35')]);}};Acw[_0xa1e1('0x18')][_0xa1e1('0x2a')]=function(_0x8c700a){try{var _0x14d6a6=this;if(_0x14d6a6[_0xa1e1('0x7')][_0x8c700a]){_0x14d6a6[_0xa1e1('0x7')][_0x8c700a][_0xa1e1('0x29')]=![];var _0x5d4b45=_0x14d6a6[_0xa1e1('0x7')][_0x8c700a][_0xa1e1('0x2d')];var _0xf85e03=_0x14d6a6[_0xa1e1('0x7')][_0x8c700a]['queue'];var _0x5e2347=_0x14d6a6[_0xa1e1('0x1b')][_0xf85e03][_0xa1e1('0x28')];logger[_0xa1e1('0x23')](_0xa1e1('0x36'),_0x5d4b45,_0x8c700a);RpcUser['saveUnpause'](this[_0xa1e1('0x6')][_0x8c700a]);RpcVoiceAgentReport[_0xa1e1('0x37')]({'acwtime':_0x5e2347,'agentacw':!![]},_0x5d4b45,_0x8c700a)['then'](function(_0x32a3d2){logger[_0xa1e1('0x23')](_0xa1e1('0x2f'),_0x5d4b45,_0x5e2347,_0x32a3d2);})[_0xa1e1('0x30')](function(_0x25972c){logger[_0xa1e1('0x31')](_0xa1e1('0x32'),_0x5d4b45,_0x25972c);});}else{logger['error'](_0xa1e1('0x38'),_0x8c700a);if(_0x14d6a6[_0xa1e1('0x7')]){logger[_0xa1e1('0x23')](_0xa1e1('0x39'),JSON[_0xa1e1('0x3a')](_0x14d6a6[_0xa1e1('0x7')]));}}}catch(_0x3bdbc1){logger[_0xa1e1('0x31')](_0xa1e1('0x3b'),_0x3bdbc1[_0xa1e1('0x35')]);}};Acw[_0xa1e1('0x18')]['syncAgentConnect']=function(_0x4bbb42){try{if(this[_0xa1e1('0x1b')][_0x4bbb42[_0xa1e1('0x1a')]]&&(this[_0xa1e1('0x1b')][_0x4bbb42[_0xa1e1('0x1a')]]['acw']||this[_0xa1e1('0x1b')][_0x4bbb42[_0xa1e1('0x1a')]][_0xa1e1('0x1d')])){if(this[_0xa1e1('0x6')][_0x4bbb42[_0xa1e1('0x19')]]){this[_0xa1e1('0x8')][_0x4bbb42[_0xa1e1('0x2d')]]={'queue':_0x4bbb42['queue'],'interface':_0x4bbb42[_0xa1e1('0x19')],'destlinkedid':_0x4bbb42[_0xa1e1('0x25')]};}}}catch(_0x8d3344){logger[_0xa1e1('0x31')]('[ACW][syncAgentConnect]\x20%s',_0x8d3344['message']);}};Acw[_0xa1e1('0x18')][_0xa1e1('0x15')]=function(_0x43ac5f){try{if(this[_0xa1e1('0x1b')][_0x43ac5f[_0xa1e1('0x1a')]]&&(this[_0xa1e1('0x1b')][_0x43ac5f['queue']][_0xa1e1('0x4')]||this['voiceQueues'][_0x43ac5f[_0xa1e1('0x1a')]][_0xa1e1('0x1d')])){if(this[_0xa1e1('0x6')][_0x43ac5f[_0xa1e1('0x19')]]){this[_0xa1e1('0x8')][_0x43ac5f['uniqueid']]={'queue':_0x43ac5f[_0xa1e1('0x1a')],'interface':_0x43ac5f[_0xa1e1('0x19')]};}}}catch(_0x57ac51){logger[_0xa1e1('0x31')](_0xa1e1('0x3c'),_0x57ac51['message']);}};Acw[_0xa1e1('0x18')][_0xa1e1('0x3d')]=function(_0x33c5ac){try{if(this[_0xa1e1('0x8')][_0x33c5ac[_0xa1e1('0x2d')]]&&_[_0xa1e1('0x3e')](this[_0xa1e1('0x8')][_0x33c5ac['uniqueid']]['attended'])){logger[_0xa1e1('0x23')](_0xa1e1('0x3f'),_0x33c5ac[_0xa1e1('0x2d')]);this['startAcw'](_0x33c5ac['uniqueid']);}else if(this[_0xa1e1('0x8')][_0x33c5ac['linkedid']]&&_['isUndefined'](this[_0xa1e1('0x8')][_0x33c5ac[_0xa1e1('0x40')]][_0xa1e1('0x24')])){logger[_0xa1e1('0x23')]('[%s][HANGUP:LINKEDID]',_0x33c5ac[_0xa1e1('0x40')]);this[_0xa1e1('0x41')](_0x33c5ac[_0xa1e1('0x40')]);}}catch(_0x4cb6dd){logger['error'](_0xa1e1('0x42'),_0x4cb6dd[_0xa1e1('0x35')]);}};Acw['prototype'][_0xa1e1('0xd')]=function(_0x314643){try{if(this['channels'][_0x314643[_0xa1e1('0x2d')]]&&this[_0xa1e1('0x8')][_0x314643[_0xa1e1('0x2d')]][_0xa1e1('0x24')]){logger[_0xa1e1('0x23')](_0xa1e1('0x43'),_0x314643[_0xa1e1('0x2d')]);this[_0xa1e1('0x41')](_0x314643[_0xa1e1('0x2d')]);}else if(this[_0xa1e1('0x8')][_0x314643[_0xa1e1('0x40')]]&&this[_0xa1e1('0x8')][_0x314643[_0xa1e1('0x40')]][_0xa1e1('0x24')]){logger[_0xa1e1('0x23')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x314643[_0xa1e1('0x40')]);this['startAcw'](_0x314643[_0xa1e1('0x40')]);}}catch(_0x4327da){logger[_0xa1e1('0x31')](_0xa1e1('0x44'),_0x4327da[_0xa1e1('0x35')]);}};Acw[_0xa1e1('0x18')][_0xa1e1('0x11')]=function(_0x22339b){try{if(!_[_0xa1e1('0x45')](this[_0xa1e1('0x8')][_0x22339b[_0xa1e1('0x46')]])){this['startAcw'](_0x22339b[_0xa1e1('0x46')]);if(this[_0xa1e1('0x8')][_0x22339b['secondtransfereruniqueid']]){this['channels'][_0x22339b[_0xa1e1('0x47')]][_0xa1e1('0x24')]=!![];this['channels'][_0x22339b[_0xa1e1('0x48')]]=this[_0xa1e1('0x8')][_0x22339b[_0xa1e1('0x47')]];delete this['channels'][_0x22339b[_0xa1e1('0x47')]];}}else if(!_[_0xa1e1('0x45')](this[_0xa1e1('0x8')][_0x22339b['transfertargetuniqueid']])){this[_0xa1e1('0x41')](_0x22339b[_0xa1e1('0x48')]);if(this[_0xa1e1('0x8')][_0x22339b[_0xa1e1('0x49')]]){this[_0xa1e1('0x8')][_0x22339b[_0xa1e1('0x49')]][_0xa1e1('0x24')]=!![];this['channels'][_0x22339b[_0xa1e1('0x46')]]=this[_0xa1e1('0x8')][_0x22339b[_0xa1e1('0x49')]];delete this['channels'][_0x22339b['origtransfereruniqueid']];}}}catch(_0xa00eb){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0xa00eb[_0xa1e1('0x35')]);}};Acw['prototype'][_0xa1e1('0x13')]=function(_0xeefab1){try{if(this['channels'][_0xeefab1[_0xa1e1('0x4a')]]){logger['info'](_0xa1e1('0x4b'),JSON['stringify'](_0xeefab1[_0xa1e1('0x4a')]));this[_0xa1e1('0x41')](_0xeefab1['transfereruniqueid']);}else if(this[_0xa1e1('0x8')][_0xeefab1['transfererlinkedid']]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xa1e1('0x3a')](_0xeefab1['transfererlinkedid']));this[_0xa1e1('0x41')](_0xeefab1[_0xa1e1('0x4c')]);}}catch(_0x6ed528){logger['error'](_0xa1e1('0x4d'),_0x6ed528[_0xa1e1('0x35')]);}};Acw[_0xa1e1('0x18')]['syncAgentRingNoAnswer']=function(_0x3d4a3b){try{if(this[_0xa1e1('0x1b')][_0x3d4a3b[_0xa1e1('0x1a')]]&&this[_0xa1e1('0x1b')][_0x3d4a3b['queue']][_0xa1e1('0x4e')]===_0xa1e1('0x4f')){if(this[_0xa1e1('0x6')][_0x3d4a3b['interface']]){logger[_0xa1e1('0x23')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x3d4a3b['uniqueid'],_0x3d4a3b[_0xa1e1('0x19')],_0x3d4a3b[_0xa1e1('0x1a')]);return RpcUser[_0xa1e1('0x26')](this[_0xa1e1('0x6')][_0x3d4a3b['interface']],_0xa1e1('0x50'),_0x3d4a3b[_0xa1e1('0x2d')]);}}}catch(_0x1337e9){logger[_0xa1e1('0x31')](_0xa1e1('0x51'),_0x1337e9[_0xa1e1('0x35')]);}};module[_0xa1e1('0x52')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 9503f53..7553a4e 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 _0xd699=['username','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','info','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionQueueSummary','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','../../config/logger','ami','../../config/environment','port','asterisk','password','keepConnected','Action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s'];(function(_0x2e39ee,_0x26acd3){var _0x3c84a6=function(_0x4dcf2f){while(--_0x4dcf2f){_0x2e39ee['push'](_0x2e39ee['shift']());}};_0x3c84a6(++_0x26acd3);}(_0xd699,0x1de));var _0x9d69=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0xd699[_0x11c573];return _0x6b72de;};'use strict';var Manager=require(_0x9d69('0x0'));var BPromise=require(_0x9d69('0x1'));var util=require('util');var logger=require(_0x9d69('0x2'))(_0x9d69('0x3'));var config=require(_0x9d69('0x4'));var ami=new Manager(config['asterisk'][_0x9d69('0x5')],config[_0x9d69('0x6')]['ip'],config[_0x9d69('0x6')]['username'],config['asterisk'][_0x9d69('0x7')],!![]);ami[_0x9d69('0x8')]();ami[_0x9d69('0x9')]=BPromise['promisify'](ami['action']);function error(_0x4b665e){logger['error'](util[_0x9d69('0xa')](_0x9d69('0xb'),config[_0x9d69('0x6')][_0x9d69('0xc')],config['asterisk']['ip'],config[_0x9d69('0x6')]['port'],util[_0x9d69('0xd')](_0x4b665e,![],null)));}function close(){logger[_0x9d69('0xe')](util['format'](_0x9d69('0xf'),config[_0x9d69('0x6')][_0x9d69('0xc')],config[_0x9d69('0x6')]['ip'],config[_0x9d69('0x6')]['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x9d69('0x9')]({'action':_0x9d69('0x10')});};};ami[_0x9d69('0x11')]=function(){return function(){return ami[_0x9d69('0x9')]({'action':'devicestatelist'});};};ami[_0x9d69('0x12')]=function(){return function(){return ami['Action']({'action':_0x9d69('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x9d69('0x9')]({'action':_0x9d69('0x14')});};};ami[_0x9d69('0x15')]=function(){return function(){return ami[_0x9d69('0x9')]({'action':_0x9d69('0x16')});};};function connect(){logger['info'](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x9d69('0x6')][_0x9d69('0xc')],config[_0x9d69('0x6')]['ip'],config[_0x9d69('0x6')][_0x9d69('0x5')]));ami[_0x9d69('0x17')](_0x9d69('0xe'),error);ami['once'](_0x9d69('0x18'),close);}ami['on'](_0x9d69('0x19'),connect);ami['on'](_0x9d69('0x1a'),function(_0x587c1c){logger['info'](util[_0x9d69('0xa')](_0x9d69('0x1b'),config[_0x9d69('0x6')][_0x9d69('0xc')],config[_0x9d69('0x6')]['ip'],config['asterisk'][_0x9d69('0x5')],util[_0x9d69('0xd')](_0x587c1c,![],null)));});ami['on']('fullybooted',function(){logger[_0x9d69('0x1c')](util[_0x9d69('0xa')](_0x9d69('0x1d'),config[_0x9d69('0x6')][_0x9d69('0xc')],config[_0x9d69('0x6')]['ip'],config[_0x9d69('0x6')][_0x9d69('0x5')]));return Promise[_0x9d69('0x1e')]()[_0x9d69('0x1f')](ami['actionSipShowRegistry']())['then'](ami[_0x9d69('0x11')]())['then'](ami[_0x9d69('0x12')]())[_0x9d69('0x1f')](ami[_0x9d69('0x20')]())[_0x9d69('0x1f')](ami[_0x9d69('0x15')]())['catch'](function(_0x368616){logger[_0x9d69('0xe')](_0x9d69('0x21'),util[_0x9d69('0xd')](_0x368616,{'showHidden':![],'depth':null}));});});ami['once'](_0x9d69('0xe'),error);ami[_0x9d69('0x17')](_0x9d69('0x18'),close);module[_0x9d69('0x22')]=ami; \ No newline at end of file +var _0x981e=['keepConnected','Action','promisify','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','actionSipShowRegistry','sipshowregistry','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','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','catch','[ami.js][fullybooted]','bluebird','util','ami','../../config/environment','asterisk','port','username','password'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x981e,0x16a));var _0xe981=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x981e[_0x122ef9];return _0x42fba0;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xe981('0x0'));var util=require(_0xe981('0x1'));var logger=require('../../config/logger')(_0xe981('0x2'));var config=require(_0xe981('0x3'));var ami=new Manager(config[_0xe981('0x4')][_0xe981('0x5')],config[_0xe981('0x4')]['ip'],config[_0xe981('0x4')][_0xe981('0x6')],config['asterisk'][_0xe981('0x7')],!![]);ami[_0xe981('0x8')]();ami[_0xe981('0x9')]=BPromise[_0xe981('0xa')](ami['action']);function error(_0x31a359){logger[_0xe981('0xb')](util[_0xe981('0xc')](_0xe981('0xd'),config[_0xe981('0x4')][_0xe981('0x6')],config[_0xe981('0x4')]['ip'],config[_0xe981('0x4')]['port'],util[_0xe981('0xe')](_0x31a359,![],null)));}function close(){logger[_0xe981('0xb')](util['format'](_0xe981('0xf'),config[_0xe981('0x4')][_0xe981('0x6')],config[_0xe981('0x4')]['ip'],config['asterisk'][_0xe981('0x5')]));}ami[_0xe981('0x10')]=function(){return function(){return ami[_0xe981('0x9')]({'action':_0xe981('0x11')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xe981('0x9')]({'action':'devicestatelist'});};};ami[_0xe981('0x12')]=function(){return function(){return ami[_0xe981('0x9')]({'action':_0xe981('0x13')});};};ami[_0xe981('0x14')]=function(){return function(){return ami[_0xe981('0x9')]({'action':_0xe981('0x15')});};};ami[_0xe981('0x16')]=function(){return function(){return ami[_0xe981('0x9')]({'action':_0xe981('0x17')});};};function connect(){logger[_0xe981('0x18')](util[_0xe981('0xc')](_0xe981('0x19'),config['asterisk'][_0xe981('0x6')],config[_0xe981('0x4')]['ip'],config['asterisk'][_0xe981('0x5')]));ami[_0xe981('0x1a')](_0xe981('0xb'),error);ami['once'](_0xe981('0x1b'),close);}ami['on']('connect',connect);ami['on'](_0xe981('0x1c'),function(_0x5073b6){logger['info'](util[_0xe981('0xc')](_0xe981('0x1d'),config[_0xe981('0x4')][_0xe981('0x6')],config[_0xe981('0x4')]['ip'],config['asterisk'][_0xe981('0x5')],util['inspect'](_0x5073b6,![],null)));});ami['on'](_0xe981('0x1e'),function(){logger[_0xe981('0x18')](util[_0xe981('0xc')](_0xe981('0x1f'),config[_0xe981('0x4')][_0xe981('0x6')],config[_0xe981('0x4')]['ip'],config[_0xe981('0x4')][_0xe981('0x5')]));return Promise[_0xe981('0x20')]()[_0xe981('0x21')](ami[_0xe981('0x10')]())['then'](ami[_0xe981('0x22')]())[_0xe981('0x21')](ami[_0xe981('0x12')]())[_0xe981('0x21')](ami['actionQueueSummary']())[_0xe981('0x21')](ami[_0xe981('0x16')]())[_0xe981('0x23')](function(_0xa36007){logger[_0xe981('0xb')](_0xe981('0x24'),util[_0xe981('0xe')](_0xa36007,{'showHidden':![],'depth':null}));});});ami[_0xe981('0x1a')](_0xe981('0xb'),error);ami[_0xe981('0x1a')](_0xe981('0x1b'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 12cf3f2..e3d7f72 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 _0xb43b=['catch','exports','jayson/promise','bluebird','ami','client','http','rpc','memberReport','error','message','result'];(function(_0x2b1a89,_0x41fbef){var _0x25ff90=function(_0xd95aea){while(--_0xd95aea){_0x2b1a89['push'](_0x2b1a89['shift']());}};_0x25ff90(++_0x41fbef);}(_0xb43b,0x1b2));var _0xbb43=function(_0x56a9f3,_0x2c1e7b){_0x56a9f3=_0x56a9f3-0x0;var _0x90b9c1=_0xb43b[_0x56a9f3];return _0x90b9c1;};'use strict';var jayson=require(_0xbb43('0x0'));var BPromise=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var client=jayson[_0xbb43('0x3')][_0xbb43('0x4')]({'port':0x2329});client['Request']=function(_0x131e9e,_0x41aff6){return new BPromise(function(_0x351254,_0x16432a){return client['request'](_0x131e9e,_0x41aff6)['then'](function(_0x378df5){logger['debug'](_0xbb43('0x5'),_0xbb43('0x6'),_0x131e9e,_0x41aff6,_0x378df5);if(_0x378df5[_0xbb43('0x7')]){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x378df5[_0xbb43('0x7')][_0xbb43('0x8')],_0x41aff6);return _0x16432a(_0x378df5['error'][_0xbb43('0x8')]);}else{return _0x351254(_0x378df5[_0xbb43('0x9')]);}})[_0xbb43('0xa')](function(_0x5e3611){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x5e3611,_0x41aff6);return _0x16432a(_0x5e3611);});});};module[_0xbb43('0xb')]=client; \ No newline at end of file +var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x466247,_0x5d69e3){var _0x4b352e=function(_0x58c71b){while(--_0x58c71b){_0x466247['push'](_0x466247['shift']());}};_0x4b352e(++_0x5d69e3);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xb7e7[_0x34bc30];return _0x5706de;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 8211de8..c24cbe3 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 _0x8f67=['dialCutDigit','substring','voiceQueue','getQueue','queue','util','lodash','moment','isNil','string','uniqueid','Contact','phone','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','CampaignId','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>'];(function(_0x4e4183,_0x5aa36a){var _0x519754=function(_0x55746f){while(--_0x55746f){_0x4e4183['push'](_0x4e4183['shift']());}};_0x519754(++_0x5aa36a);}(_0x8f67,0x195));var _0x78f6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8f67[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x78f6('0x0'));var _=require(_0x78f6('0x1'));var moment=require(_0x78f6('0x2'));function checkNameSurname(_0x274365,_0x305e82,_0x8bbed0){var _0x530302='';if(!_['isNil'](_0x305e82)&&'string'===typeof _0x305e82){_0x530302+=_0x305e82;}if(!_[_0x78f6('0x3')](_0x8bbed0)&&_0x78f6('0x4')===typeof _0x8bbed0){_0x530302+='\x20'+_0x8bbed0;}if(_0x530302!==''){return _0x530302;}return _0x274365;}function Action(_0x3dc53c,_0x3f4196,_0x17ed2b){this['voiceQueue']=_0x3dc53c;this[_0x78f6('0x5')]=_0x17ed2b||undefined;this['name']=checkNameSurname(_0x3f4196[_0x78f6('0x6')][_0x78f6('0x7')],_0x3f4196[_0x78f6('0x6')]['firstName'],_0x3f4196[_0x78f6('0x6')][_0x78f6('0x8')]);this[_0x78f6('0x9')]=_0x3f4196[_0x78f6('0x7')];this['queue']=_0x3dc53c['name'];this[_0x78f6('0xa')]=_0x3f4196[_0x78f6('0xa')]||![];this[_0x78f6('0xb')]=_0x3dc53c[_0x78f6('0xb')];this[_0x78f6('0xc')]=_0x3dc53c[_0x78f6('0xc')]||0x3;this[_0x78f6('0xd')]=_0x3f4196[_0x78f6('0xd')];this['countbusyretry']=_0x3f4196[_0x78f6('0xe')];this['countcongestionretry']=_0x3f4196[_0x78f6('0xf')];this[_0x78f6('0x10')]=_0x3f4196[_0x78f6('0x10')];this[_0x78f6('0x11')]=_0x3f4196[_0x78f6('0x11')];this[_0x78f6('0x12')]=_0x3f4196['countdropretry'];this[_0x78f6('0x13')]=_0x3f4196['countabandonedretry'];this['countmachineretry']=_0x3f4196[_0x78f6('0x14')];this[_0x78f6('0x15')]=_0x3f4196[_0x78f6('0x15')];this[_0x78f6('0x16')]=_0x3f4196[_0x78f6('0x16')];this[_0x78f6('0x17')]=_0x3f4196['ListId'];this[_0x78f6('0x18')]=_0x3f4196[_0x78f6('0x18')];this['VoiceQueueId']=_0x3f4196['VoiceQueueId'];this[_0x78f6('0x19')]=_0x3f4196['CampaignId'];this['idHopper']=_0x3f4196['id'];this['ContactFirstName']=_0x3f4196[_0x78f6('0x6')]['firstName']||'';this['starttime']=moment()['format'](_0x78f6('0x1a'));this[_0x78f6('0x1b')]=_0x3f4196[_0x78f6('0x1b')];this[_0x78f6('0x1c')]=_0x3f4196[_0x78f6('0x1c')];this[_0x78f6('0x1d')]=_0x3f4196['callbackat'];this[_0x78f6('0x1e')]=_0x3f4196[_0x78f6('0x1e')];this[_0x78f6('0x1f')]='';this[_0x78f6('0x20')]='';}Action[_0x78f6('0x21')]['getCaller']=function(){return util['format'](_0x78f6('0x22'),this['name'],this['voiceQueue'][_0x78f6('0x23')]>0x0?this['number'][_0x78f6('0x24')](this[_0x78f6('0x25')][_0x78f6('0x23')]):this[_0x78f6('0x9')]);};Action[_0x78f6('0x21')][_0x78f6('0x26')]=function(){return this[_0x78f6('0x27')];};module['exports']=Action; \ No newline at end of file +var _0x7dd5=['getQueue','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','firstName','lastName','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit'];(function(_0x2c1869,_0xec85ff){var _0x259a5c=function(_0x49a89e){while(--_0x49a89e){_0x2c1869['push'](_0x2c1869['shift']());}};_0x259a5c(++_0xec85ff);}(_0x7dd5,0x10f));var _0x57dd=function(_0x139439,_0x29be0f){_0x139439=_0x139439-0x0;var _0x38cdd5=_0x7dd5[_0x139439];return _0x38cdd5;};'use strict';var util=require(_0x57dd('0x0'));var _=require(_0x57dd('0x1'));var moment=require(_0x57dd('0x2'));function checkNameSurname(_0x29079b,_0x548542,_0x504530){var _0x1f6612='';if(!_[_0x57dd('0x3')](_0x548542)&&_0x57dd('0x4')===typeof _0x548542){_0x1f6612+=_0x548542;}if(!_[_0x57dd('0x3')](_0x504530)&&_0x57dd('0x4')===typeof _0x504530){_0x1f6612+='\x20'+_0x504530;}if(_0x1f6612!==''){return _0x1f6612;}return _0x29079b;}function Action(_0x112e73,_0x1175f2,_0x42f5b3){this[_0x57dd('0x5')]=_0x112e73;this[_0x57dd('0x6')]=_0x42f5b3||undefined;this[_0x57dd('0x7')]=checkNameSurname(_0x1175f2['Contact']['phone'],_0x1175f2[_0x57dd('0x8')][_0x57dd('0x9')],_0x1175f2['Contact'][_0x57dd('0xa')]);this[_0x57dd('0xb')]=_0x1175f2[_0x57dd('0xc')];this[_0x57dd('0xd')]=_0x112e73['name'];this['active']=_0x1175f2[_0x57dd('0xe')]||![];this[_0x57dd('0xf')]=_0x112e73['type'];this[_0x57dd('0x10')]=_0x112e73[_0x57dd('0x10')]||0x3;this[_0x57dd('0x11')]=_0x1175f2['scheduledat'];this['countbusyretry']=_0x1175f2[_0x57dd('0x12')];this['countcongestionretry']=_0x1175f2[_0x57dd('0x13')];this['countnoanswerretry']=_0x1175f2[_0x57dd('0x14')];this['countnosuchnumberretry']=_0x1175f2[_0x57dd('0x15')];this['countdropretry']=_0x1175f2['countdropretry'];this[_0x57dd('0x16')]=_0x1175f2[_0x57dd('0x16')];this[_0x57dd('0x17')]=_0x1175f2['countmachineretry'];this[_0x57dd('0x18')]=_0x1175f2[_0x57dd('0x18')];this[_0x57dd('0x19')]=_0x1175f2['ContactId'];this[_0x57dd('0x1a')]=_0x1175f2[_0x57dd('0x1a')];this[_0x57dd('0x1b')]=_0x1175f2[_0x57dd('0x1b')];this['VoiceQueueId']=_0x1175f2[_0x57dd('0x1c')];this[_0x57dd('0x1d')]=_0x1175f2[_0x57dd('0x1d')];this[_0x57dd('0x1e')]=_0x1175f2['id'];this[_0x57dd('0x1f')]=_0x1175f2['Contact'][_0x57dd('0x9')]||'';this['starttime']=moment()[_0x57dd('0x20')](_0x57dd('0x21'));this[_0x57dd('0x22')]=_0x1175f2['callback'];this[_0x57dd('0x23')]=_0x1175f2[_0x57dd('0x23')];this[_0x57dd('0x24')]=_0x1175f2['callbackat'];this[_0x57dd('0x25')]=_0x1175f2['recallme'];this[_0x57dd('0x26')]='';this[_0x57dd('0x27')]='';}Action[_0x57dd('0x28')][_0x57dd('0x29')]=function(){return util[_0x57dd('0x20')](_0x57dd('0x2a'),this[_0x57dd('0x7')],this[_0x57dd('0x5')][_0x57dd('0x2b')]>0x0?this[_0x57dd('0xb')]['substring'](this[_0x57dd('0x5')][_0x57dd('0x2b')]):this[_0x57dd('0xb')]);};Action[_0x57dd('0x28')][_0x57dd('0x2c')]=function(){return this[_0x57dd('0xd')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 0d850ac..9f9e2e6 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 _0x7605=['starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','Answer','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum'];(function(_0x581e02,_0x17c007){var _0x40d0a0=function(_0x20b4c1){while(--_0x20b4c1){_0x581e02['push'](_0x581e02['shift']());}};_0x40d0a0(++_0x17c007);}(_0x7605,0xc2));var _0x5760=function(_0x1d3df7,_0x359672){_0x1d3df7=_0x1d3df7-0x0;var _0x33e0af=_0x7605[_0x1d3df7];return _0x33e0af;};'use strict';var util=require('util');var _=require(_0x5760('0x0'));var moment=require(_0x5760('0x1'));function getSeconds(_0x1f6ab4,_0x5bf55c){var _0x385133=moment(_0x1f6ab4)[_0x5760('0x2')](0x0);var _0x19e083=moment(_0x5bf55c)['milliseconds'](0x0);return _0x385133[_0x5760('0x3')](_0x19e083,_0x5760('0x4'));}function AgentComplete(_0x1df2df,_0x2db439){this['state']=0x4;this['statedesc']=_0x5760('0x5');this[_0x5760('0x6')]=_0x1df2df['scheduledat'];this['type']=_0x1df2df[_0x5760('0x7')];this[_0x5760('0x8')]=_0x1df2df[_0x5760('0x7')]==='outbound'?'queue':_0x1df2df[_0x5760('0x7')];this[_0x5760('0x9')]=_0x1df2df[_0x5760('0x9')];this['countcongestionretry']=_0x1df2df[_0x5760('0xa')];this[_0x5760('0xb')]=_0x1df2df[_0x5760('0xb')];this[_0x5760('0xc')]=_0x1df2df[_0x5760('0x9')]+_0x1df2df[_0x5760('0xa')]+_0x1df2df[_0x5760('0xb')]+_0x1df2df[_0x5760('0xd')]+_0x1df2df[_0x5760('0xe')]+_0x1df2df[_0x5760('0xf')]+_0x1df2df['countmachineretry']+_0x1df2df['countagentrejectretry'];this[_0x5760('0xd')]=_0x1df2df[_0x5760('0xd')];this[_0x5760('0xe')]=_0x1df2df[_0x5760('0xe')];this[_0x5760('0xf')]=_0x1df2df[_0x5760('0xf')];this[_0x5760('0x10')]=_0x1df2df[_0x5760('0x10')];this[_0x5760('0x11')]=_0x1df2df['countagentrejectretry'];this['uniqueid']=_0x2db439['uniqueid'];this[_0x5760('0x12')]=_0x1df2df[_0x5760('0x13')];this[_0x5760('0x14')]=_0x1df2df['number'];this[_0x5760('0x15')]=_0x1df2df[_0x5760('0x15')];this[_0x5760('0x16')]=_0x1df2df['responsetime'];this[_0x5760('0x17')]=_0x1df2df[_0x5760('0x17')];this[_0x5760('0x18')]=moment()['format'](_0x5760('0x19'));this[_0x5760('0x1a')]=getSeconds(_0x1df2df[_0x5760('0x16')],_0x1df2df[_0x5760('0x15')]);this[_0x5760('0x1b')]=getSeconds(_0x1df2df['answertime'],_0x1df2df[_0x5760('0x16')]);this[_0x5760('0x1c')]=getSeconds(this['endtime'],_0x1df2df[_0x5760('0x17')]);this[_0x5760('0x1d')]=_0x2db439[_0x5760('0x1d')];this[_0x5760('0x1e')]=_0x2db439[_0x5760('0x1e')];this['reason']=_0x2db439[_0x5760('0x1f')];this['callback']=_0x1df2df[_0x5760('0x20')];this[_0x5760('0x21')]=_0x1df2df[_0x5760('0x21')];this['callbackat']=_0x1df2df['callbackat'];this[_0x5760('0x22')]=_0x1df2df[_0x5760('0x22')];this[_0x5760('0x23')]=_0x1df2df[_0x5760('0x23')];this[_0x5760('0x24')]=_0x1df2df[_0x5760('0x24')];this[_0x5760('0x25')]=_0x1df2df[_0x5760('0x25')];this[_0x5760('0x26')]=_0x1df2df[_0x5760('0x26')];this['CampaignId']=_0x1df2df[_0x5760('0x27')];this['originatecalleridnum']=_0x1df2df[_0x5760('0x28')]||'';this[_0x5760('0x29')]=_0x1df2df['originatecalleridname']||'';}module[_0x5760('0x2a')]=AgentComplete; \ No newline at end of file +var _0x920c=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x3c6ae2,_0x5c52d8){var _0x4edda=function(_0x5593eb){while(--_0x5593eb){_0x3c6ae2['push'](_0x3c6ae2['shift']());}};_0x4edda(++_0x5c52d8);}(_0x920c,0x152));var _0xc920=function(_0x576710,_0x2766d0){_0x576710=_0x576710-0x0;var _0x792aaa=_0x920c[_0x576710];return _0x792aaa;};'use strict';var util=require('util');var _=require(_0xc920('0x0'));var moment=require(_0xc920('0x1'));function getSeconds(_0x12982b,_0x536884){var _0x49dc8e=moment(_0x12982b)[_0xc920('0x2')](0x0);var _0x521133=moment(_0x536884)[_0xc920('0x2')](0x0);return _0x49dc8e['diff'](_0x521133,'seconds');}function AgentComplete(_0x39e37e,_0x4fca9f){this[_0xc920('0x3')]=0x4;this[_0xc920('0x4')]=_0xc920('0x5');this[_0xc920('0x6')]=_0x39e37e['scheduledat'];this[_0xc920('0x7')]=_0x39e37e[_0xc920('0x7')];this[_0xc920('0x8')]=_0x39e37e[_0xc920('0x7')]==='outbound'?_0xc920('0x9'):_0x39e37e[_0xc920('0x7')];this[_0xc920('0xa')]=_0x39e37e[_0xc920('0xa')];this[_0xc920('0xb')]=_0x39e37e[_0xc920('0xb')];this['countnoanswerretry']=_0x39e37e[_0xc920('0xc')];this[_0xc920('0xd')]=_0x39e37e['countbusyretry']+_0x39e37e['countcongestionretry']+_0x39e37e['countnoanswerretry']+_0x39e37e['countnosuchnumberretry']+_0x39e37e[_0xc920('0xe')]+_0x39e37e[_0xc920('0xf')]+_0x39e37e[_0xc920('0x10')]+_0x39e37e[_0xc920('0x11')];this[_0xc920('0x12')]=_0x39e37e[_0xc920('0x12')];this[_0xc920('0xe')]=_0x39e37e['countdropretry'];this[_0xc920('0xf')]=_0x39e37e[_0xc920('0xf')];this[_0xc920('0x10')]=_0x39e37e[_0xc920('0x10')];this[_0xc920('0x11')]=_0x39e37e[_0xc920('0x11')];this['uniqueid']=_0x4fca9f[_0xc920('0x13')];this[_0xc920('0x14')]=_0x39e37e[_0xc920('0x15')];this[_0xc920('0x16')]=_0x39e37e[_0xc920('0x17')];this[_0xc920('0x18')]=_0x39e37e[_0xc920('0x18')];this[_0xc920('0x19')]=_0x39e37e[_0xc920('0x19')];this[_0xc920('0x1a')]=_0x39e37e[_0xc920('0x1a')];this[_0xc920('0x1b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0x39e37e[_0xc920('0x19')],_0x39e37e[_0xc920('0x18')]);this[_0xc920('0x1c')]=getSeconds(_0x39e37e['answertime'],_0x39e37e[_0xc920('0x19')]);this[_0xc920('0x1d')]=getSeconds(this[_0xc920('0x1b')],_0x39e37e['answertime']);this[_0xc920('0x9')]=_0x4fca9f[_0xc920('0x9')];this[_0xc920('0x1e')]=_0x4fca9f[_0xc920('0x1e')];this['reason']=_0x4fca9f[_0xc920('0x1f')];this['callback']=_0x39e37e[_0xc920('0x20')];this[_0xc920('0x21')]=_0x39e37e[_0xc920('0x21')];this['callbackat']=_0x39e37e[_0xc920('0x22')];this[_0xc920('0x23')]=_0x39e37e[_0xc920('0x23')];this['ContactId']=_0x39e37e[_0xc920('0x24')];this[_0xc920('0x25')]=_0x39e37e['ListId'];this[_0xc920('0x26')]=_0x39e37e['UserId'];this[_0xc920('0x27')]=_0x39e37e[_0xc920('0x27')];this['CampaignId']=_0x39e37e[_0xc920('0x28')];this[_0xc920('0x29')]=_0x39e37e[_0xc920('0x29')]||'';this['originatecalleridname']=_0x39e37e[_0xc920('0x2a')]||'';}module[_0xc920('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 7cfd0b9..02a4710 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 _0xbfe8=['countagentrejectretry','countabandonedretry','countmachineretry','calleridname','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry'];(function(_0x3a4e5d,_0x4a8933){var _0x385d92=function(_0x24f215){while(--_0x24f215){_0x3a4e5d['push'](_0x3a4e5d['shift']());}};_0x385d92(++_0x4a8933);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x58317e,_0x217190){_0x58317e=_0x58317e-0x0;var _0x1639a0=_0xbfe8[_0x58317e];return _0x1639a0;};'use strict';var util=require('util');var _=require(_0x8bfe('0x0'));var moment=require('moment');function getSeconds(_0x1fd32c,_0x39d664){var _0x56fddf=moment(_0x1fd32c)['milliseconds'](0x0);var _0x101fc1=moment(_0x39d664)[_0x8bfe('0x1')](0x0);return _0x56fddf['diff'](_0x101fc1,_0x8bfe('0x2'));}function Final(_0x1deab0){this[_0x8bfe('0x3')]=_0x1deab0['uniqueid'];this[_0x8bfe('0x4')]=_0x1deab0[_0x8bfe('0x4')];this[_0x8bfe('0x5')]=_0x1deab0[_0x8bfe('0x5')];this[_0x8bfe('0x6')]=_0x1deab0[_0x8bfe('0x5')]===_0x8bfe('0x7')?_0x8bfe('0x8'):_0x1deab0[_0x8bfe('0x5')];this[_0x8bfe('0x9')]=_0x1deab0[_0x8bfe('0x9')];this[_0x8bfe('0xa')]=_0x1deab0[_0x8bfe('0xa')];this[_0x8bfe('0xb')]=_0x1deab0[_0x8bfe('0xb')];this['countglobal']=_0x1deab0[_0x8bfe('0x9')]+_0x1deab0['countcongestionretry']+_0x1deab0[_0x8bfe('0xb')]+_0x1deab0[_0x8bfe('0xc')]+_0x1deab0[_0x8bfe('0xd')]+_0x1deab0['countabandonedretry']+_0x1deab0['countmachineretry']+_0x1deab0[_0x8bfe('0xe')];this[_0x8bfe('0xc')]=_0x1deab0[_0x8bfe('0xc')];this[_0x8bfe('0xd')]=_0x1deab0[_0x8bfe('0xd')];this['countabandonedretry']=_0x1deab0[_0x8bfe('0xf')];this[_0x8bfe('0x10')]=_0x1deab0['countmachineretry'];this[_0x8bfe('0xe')]=_0x1deab0[_0x8bfe('0xe')];this[_0x8bfe('0x8')]=_0x1deab0['queue'];this['calleridname']=_0x1deab0[_0x8bfe('0x11')];this['calleridnum']=_0x1deab0['calleridnum'];this[_0x8bfe('0x12')]=_0x1deab0[_0x8bfe('0x12')];this[_0x8bfe('0x13')]=_0x1deab0[_0x8bfe('0x13')];this[_0x8bfe('0x14')]=_0x1deab0[_0x8bfe('0x13')];this[_0x8bfe('0x15')]=_0x1deab0['ringtime']||0x0;this[_0x8bfe('0x16')]=_0x1deab0['holdtime']||0x0;this[_0x8bfe('0x17')]=_0x1deab0[_0x8bfe('0x17')]||0x0;this[_0x8bfe('0x18')]=_0x1deab0['callback'];this['callbackuniqueid']=_0x1deab0[_0x8bfe('0x19')];this['callbackat']=_0x1deab0['callbackat'];this[_0x8bfe('0x1a')]=_0x1deab0['recallme'];this[_0x8bfe('0x1b')]=_0x1deab0['ContactId'];this[_0x8bfe('0x1c')]=_0x1deab0[_0x8bfe('0x1c')];this[_0x8bfe('0x1d')]=_0x1deab0[_0x8bfe('0x1d')];this['VoiceQueueId']=_0x1deab0[_0x8bfe('0x1e')];this[_0x8bfe('0x1f')]=_0x1deab0['CampaignId'];this[_0x8bfe('0x20')]=_0x1deab0[_0x8bfe('0x20')]||'';this[_0x8bfe('0x21')]=_0x1deab0[_0x8bfe('0x21')]||'';}module[_0x8bfe('0x22')]=Final; \ No newline at end of file +var _0xa7e6=['diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds'];(function(_0x3e9402,_0x130b9e){var _0x1f5996=function(_0x5ad15c){while(--_0x5ad15c){_0x3e9402['push'](_0x3e9402['shift']());}};_0x1f5996(++_0x130b9e);}(_0xa7e6,0x74));var _0x6a7e=function(_0xa48f75,_0x10137e){_0xa48f75=_0xa48f75-0x0;var _0x1c5d00=_0xa7e6[_0xa48f75];return _0x1c5d00;};'use strict';var util=require(_0x6a7e('0x0'));var _=require(_0x6a7e('0x1'));var moment=require(_0x6a7e('0x2'));function getSeconds(_0x1bda1f,_0x67fa72){var _0x21c1de=moment(_0x1bda1f)['milliseconds'](0x0);var _0x3ccca2=moment(_0x67fa72)[_0x6a7e('0x3')](0x0);return _0x21c1de[_0x6a7e('0x4')](_0x3ccca2,_0x6a7e('0x5'));}function Final(_0x8734ab){this['uniqueid']=_0x8734ab[_0x6a7e('0x6')];this[_0x6a7e('0x7')]=_0x8734ab[_0x6a7e('0x7')];this[_0x6a7e('0x8')]=_0x8734ab[_0x6a7e('0x8')];this[_0x6a7e('0x9')]=_0x8734ab[_0x6a7e('0x8')]===_0x6a7e('0xa')?_0x6a7e('0xb'):_0x8734ab['type'];this['countbusyretry']=_0x8734ab['countbusyretry'];this['countcongestionretry']=_0x8734ab[_0x6a7e('0xc')];this[_0x6a7e('0xd')]=_0x8734ab[_0x6a7e('0xd')];this[_0x6a7e('0xe')]=_0x8734ab[_0x6a7e('0xf')]+_0x8734ab['countcongestionretry']+_0x8734ab[_0x6a7e('0xd')]+_0x8734ab[_0x6a7e('0x10')]+_0x8734ab['countdropretry']+_0x8734ab['countabandonedretry']+_0x8734ab[_0x6a7e('0x11')]+_0x8734ab[_0x6a7e('0x12')];this[_0x6a7e('0x10')]=_0x8734ab[_0x6a7e('0x10')];this['countdropretry']=_0x8734ab[_0x6a7e('0x13')];this[_0x6a7e('0x14')]=_0x8734ab[_0x6a7e('0x14')];this[_0x6a7e('0x11')]=_0x8734ab[_0x6a7e('0x11')];this['countagentrejectretry']=_0x8734ab[_0x6a7e('0x12')];this['queue']=_0x8734ab['queue'];this[_0x6a7e('0x15')]=_0x8734ab['calleridname'];this[_0x6a7e('0x16')]=_0x8734ab[_0x6a7e('0x16')];this[_0x6a7e('0x17')]=_0x8734ab[_0x6a7e('0x17')];this[_0x6a7e('0x18')]=_0x8734ab['responsetime'];this['endtime']=_0x8734ab['responsetime'];this[_0x6a7e('0x19')]=_0x8734ab[_0x6a7e('0x19')]||0x0;this[_0x6a7e('0x1a')]=_0x8734ab[_0x6a7e('0x1a')]||0x0;this[_0x6a7e('0x1b')]=_0x8734ab[_0x6a7e('0x1b')]||0x0;this[_0x6a7e('0x1c')]=_0x8734ab[_0x6a7e('0x1c')];this['callbackuniqueid']=_0x8734ab[_0x6a7e('0x1d')];this[_0x6a7e('0x1e')]=_0x8734ab['callbackat'];this[_0x6a7e('0x1f')]=_0x8734ab[_0x6a7e('0x1f')];this[_0x6a7e('0x20')]=_0x8734ab['ContactId'];this[_0x6a7e('0x21')]=_0x8734ab[_0x6a7e('0x21')];this['UserId']=_0x8734ab[_0x6a7e('0x22')];this['VoiceQueueId']=_0x8734ab[_0x6a7e('0x23')];this[_0x6a7e('0x24')]=_0x8734ab['CampaignId'];this[_0x6a7e('0x25')]=_0x8734ab[_0x6a7e('0x25')]||'';this[_0x6a7e('0x26')]=_0x8734ab[_0x6a7e('0x26')]||'';}module[_0x6a7e('0x27')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index a5d5e42..213a878 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 _0x5ef0=['holdtime','talktime','endtime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','milliseconds','diff','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime'];(function(_0x56b1e6,_0x5ebdb8){var _0x2b4b31=function(_0x24e1ac){while(--_0x24e1ac){_0x56b1e6['push'](_0x56b1e6['shift']());}};_0x2b4b31(++_0x5ebdb8);}(_0x5ef0,0xbc));var _0x05ef=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5ef0[_0x14add3];return _0x4a174f;};'use strict';var util=require('util');var _=require(_0x05ef('0x0'));var moment=require('moment');function getSeconds(_0x19d423,_0x50e31d){var _0xdd4689=moment(_0x19d423)['milliseconds'](0x0);var _0x1d37d0=moment(_0x50e31d)[_0x05ef('0x1')](0x0);return _0xdd4689[_0x05ef('0x2')](_0x1d37d0,'seconds');}function Hangup(_0x11ebe8,_0x24a15f){this[_0x05ef('0x3')]=0x4;this['statedesc']=_0x05ef('0x4');this[_0x05ef('0x5')]=_0x11ebe8[_0x05ef('0x5')];this[_0x05ef('0x6')]=_0x11ebe8['type'];this[_0x05ef('0x7')]=_0x11ebe8['type']===_0x05ef('0x8')?_0x05ef('0x9'):_0x11ebe8[_0x05ef('0x6')];this['countbusyretry']=_0x11ebe8[_0x05ef('0xa')];this['countcongestionretry']=_0x11ebe8['countcongestionretry'];this['countnoanswerretry']=_0x11ebe8['countnoanswerretry'];this['countglobal']=_0x11ebe8[_0x05ef('0xa')]+_0x11ebe8[_0x05ef('0xb')]+_0x11ebe8[_0x05ef('0xc')]+_0x11ebe8['countnosuchnumberretry']+_0x11ebe8['countdropretry']+_0x11ebe8[_0x05ef('0xd')]+_0x11ebe8[_0x05ef('0xe')]+_0x11ebe8[_0x05ef('0xf')];this[_0x05ef('0x10')]=_0x11ebe8[_0x05ef('0x10')];this[_0x05ef('0x11')]=_0x11ebe8[_0x05ef('0x11')];this[_0x05ef('0xd')]=_0x11ebe8[_0x05ef('0xd')];this[_0x05ef('0xe')]=_0x11ebe8[_0x05ef('0xe')];this['countagentrejectretry']=_0x11ebe8[_0x05ef('0xf')];this['uniqueid']=_0x24a15f[_0x05ef('0x12')];this[_0x05ef('0x13')]=_0x11ebe8[_0x05ef('0x14')];this[_0x05ef('0x15')]=_0x11ebe8['number'];this['starttime']=_0x11ebe8[_0x05ef('0x16')];this[_0x05ef('0x17')]=_0x11ebe8[_0x05ef('0x17')];this['endtime']=moment()[_0x05ef('0x18')](_0x05ef('0x19'));this[_0x05ef('0x1a')]=getSeconds(_0x11ebe8[_0x05ef('0x17')],_0x11ebe8[_0x05ef('0x16')]);this[_0x05ef('0x1b')]=0x0;this[_0x05ef('0x1c')]=getSeconds(this[_0x05ef('0x1d')],_0x11ebe8[_0x05ef('0x17')]);this[_0x05ef('0x9')]=_0x11ebe8[_0x05ef('0x9')];this['membername']=_0x05ef('0x1e');this[_0x05ef('0x1f')]=_0x24a15f[_0x05ef('0x20')];this['callback']=_0x11ebe8[_0x05ef('0x21')];this[_0x05ef('0x22')]=_0x11ebe8['callbackuniqueid'];this[_0x05ef('0x23')]=_0x11ebe8[_0x05ef('0x23')];this[_0x05ef('0x24')]=_0x11ebe8[_0x05ef('0x24')];this['ContactId']=_0x11ebe8[_0x05ef('0x25')];this['ListId']=_0x11ebe8[_0x05ef('0x26')];this[_0x05ef('0x27')]=_0x11ebe8[_0x05ef('0x27')];this[_0x05ef('0x28')]=_0x11ebe8[_0x05ef('0x28')];this[_0x05ef('0x29')]=_0x11ebe8['CampaignId'];}module[_0x05ef('0x2a')]=Hangup; \ No newline at end of file +var _0x34d6=['countglobal','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','queue','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','util','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry'];(function(_0x4bfd5a,_0x12be31){var _0x5d7806=function(_0xbc42d6){while(--_0xbc42d6){_0x4bfd5a['push'](_0x4bfd5a['shift']());}};_0x5d7806(++_0x12be31);}(_0x34d6,0x187));var _0x634d=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x34d6[_0x4e676e];return _0x336a3c;};'use strict';var util=require(_0x634d('0x0'));var _=require(_0x634d('0x1'));var moment=require('moment');function getSeconds(_0x47afd0,_0x28aa9d){var _0x4f9eda=moment(_0x47afd0)[_0x634d('0x2')](0x0);var _0x506abf=moment(_0x28aa9d)['milliseconds'](0x0);return _0x4f9eda[_0x634d('0x3')](_0x506abf,_0x634d('0x4'));}function Hangup(_0x1c7b54,_0x590671){this[_0x634d('0x5')]=0x4;this[_0x634d('0x6')]=_0x634d('0x7');this[_0x634d('0x8')]=_0x1c7b54[_0x634d('0x8')];this[_0x634d('0x9')]=_0x1c7b54[_0x634d('0x9')];this[_0x634d('0xa')]=_0x1c7b54['type']===_0x634d('0xb')?'queue':_0x1c7b54[_0x634d('0x9')];this[_0x634d('0xc')]=_0x1c7b54[_0x634d('0xc')];this[_0x634d('0xd')]=_0x1c7b54['countcongestionretry'];this['countnoanswerretry']=_0x1c7b54['countnoanswerretry'];this[_0x634d('0xe')]=_0x1c7b54[_0x634d('0xc')]+_0x1c7b54[_0x634d('0xd')]+_0x1c7b54[_0x634d('0xf')]+_0x1c7b54['countnosuchnumberretry']+_0x1c7b54[_0x634d('0x10')]+_0x1c7b54[_0x634d('0x11')]+_0x1c7b54[_0x634d('0x12')]+_0x1c7b54['countagentrejectretry'];this[_0x634d('0x13')]=_0x1c7b54[_0x634d('0x13')];this[_0x634d('0x10')]=_0x1c7b54[_0x634d('0x10')];this['countabandonedretry']=_0x1c7b54[_0x634d('0x11')];this['countmachineretry']=_0x1c7b54['countmachineretry'];this['countagentrejectretry']=_0x1c7b54[_0x634d('0x14')];this[_0x634d('0x15')]=_0x590671[_0x634d('0x15')];this[_0x634d('0x16')]=_0x1c7b54[_0x634d('0x17')];this['calleridnum']=_0x1c7b54[_0x634d('0x18')];this[_0x634d('0x19')]=_0x1c7b54[_0x634d('0x19')];this[_0x634d('0x1a')]=_0x1c7b54[_0x634d('0x1a')];this[_0x634d('0x1b')]=moment()[_0x634d('0x1c')](_0x634d('0x1d'));this[_0x634d('0x1e')]=getSeconds(_0x1c7b54['responsetime'],_0x1c7b54[_0x634d('0x19')]);this[_0x634d('0x1f')]=0x0;this['talktime']=getSeconds(this[_0x634d('0x1b')],_0x1c7b54[_0x634d('0x1a')]);this[_0x634d('0x20')]=_0x1c7b54[_0x634d('0x20')];this[_0x634d('0x21')]=_0x634d('0x22');this[_0x634d('0x23')]=_0x590671[_0x634d('0x24')];this[_0x634d('0x25')]=_0x1c7b54[_0x634d('0x25')];this[_0x634d('0x26')]=_0x1c7b54[_0x634d('0x26')];this[_0x634d('0x27')]=_0x1c7b54[_0x634d('0x27')];this[_0x634d('0x28')]=_0x1c7b54[_0x634d('0x28')];this[_0x634d('0x29')]=_0x1c7b54[_0x634d('0x29')];this[_0x634d('0x2a')]=_0x1c7b54[_0x634d('0x2a')];this['UserId']=_0x1c7b54['UserId'];this[_0x634d('0x2b')]=_0x1c7b54['VoiceQueueId'];this[_0x634d('0x2c')]=_0x1c7b54[_0x634d('0x2c')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index cdb97f2..2b63381 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 _0x793c=['number','starttime','responsetime','ringtime','holdtime','talktime','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','name','calleridnum'];(function(_0x444d57,_0x2ced49){var _0x40353a=function(_0x1221b9){while(--_0x1221b9){_0x444d57['push'](_0x444d57['shift']());}};_0x40353a(++_0x2ced49);}(_0x793c,0x1a8));var _0xc793=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x793c[_0x39d544];return _0x5a5ff2;};'use strict';var util=require('util');var _=require(_0xc793('0x0'));var moment=require(_0xc793('0x1'));function getSeconds(_0x355664,_0x48f5e4){var _0x151e55=moment(_0x355664)[_0xc793('0x2')](0x0);var _0x3df3cb=moment(_0x48f5e4)['milliseconds'](0x0);return _0x151e55[_0xc793('0x3')](_0x3df3cb,'seconds');}function History(_0x48f550){this[_0xc793('0x4')]=_0x48f550[_0xc793('0x4')];this[_0xc793('0x5')]=_0x48f550[_0xc793('0x5')]||undefined;this[_0xc793('0x6')]=_0x48f550[_0xc793('0x6')];this[_0xc793('0x7')]=_0x48f550[_0xc793('0x6')]===_0xc793('0x8')?'queue':_0x48f550[_0xc793('0x6')];this[_0xc793('0x9')]=_0x48f550['countbusyretry'];this['countcongestionretry']=_0x48f550[_0xc793('0xa')];this[_0xc793('0xb')]=_0x48f550[_0xc793('0xb')];this['countglobal']=_0x48f550[_0xc793('0x9')]+_0x48f550[_0xc793('0xa')]+_0x48f550['countnoanswerretry']+_0x48f550[_0xc793('0xc')]+_0x48f550['countdropretry']+_0x48f550['countabandonedretry']+_0x48f550['countmachineretry']+_0x48f550['countagentrejectretry'];this[_0xc793('0xc')]=_0x48f550[_0xc793('0xc')];this[_0xc793('0xd')]=_0x48f550[_0xc793('0xd')];this[_0xc793('0xe')]=_0x48f550['countabandonedretry'];this['countmachineretry']=_0x48f550[_0xc793('0xf')];this[_0xc793('0x10')]=_0x48f550['countagentrejectretry'];this[_0xc793('0x11')]=_0x48f550[_0xc793('0x11')];this['calleridname']=_0x48f550[_0xc793('0x12')];this[_0xc793('0x13')]=_0x48f550[_0xc793('0x14')];this[_0xc793('0x15')]=_0x48f550[_0xc793('0x15')];this[_0xc793('0x16')]=_0x48f550[_0xc793('0x16')];this['endtime']=_0x48f550[_0xc793('0x16')];this[_0xc793('0x17')]=getSeconds(_0x48f550['responsetime'],_0x48f550['starttime']);this[_0xc793('0x18')]=0x0;this[_0xc793('0x19')]=0x0;this['callback']=_0x48f550['callback'];this['callbackuniqueid']=_0x48f550[_0xc793('0x1a')];this[_0xc793('0x1b')]=_0x48f550[_0xc793('0x1b')];this[_0xc793('0x1c')]=_0x48f550[_0xc793('0x1c')];this[_0xc793('0x1d')]=_0x48f550[_0xc793('0x1d')];this['ListId']=_0x48f550[_0xc793('0x1e')];this['UserId']=_0x48f550[_0xc793('0x1f')];this[_0xc793('0x20')]=_0x48f550[_0xc793('0x20')];this[_0xc793('0x21')]=_0x48f550[_0xc793('0x21')];this[_0xc793('0x22')]=_0x48f550['originatecalleridnum']||'';this[_0xc793('0x23')]=_0x48f550[_0xc793('0x23')]||'';}module[_0xc793('0x24')]=History; \ No newline at end of file +var _0x8c87=['countagentrejectretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','util','milliseconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x8c87,0x10a));var _0x78c8=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x8c87[_0x513aa5];return _0x1a1a7c;};'use strict';var util=require(_0x78c8('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0xe52902,_0x2ad67f){var _0x1dbdb3=moment(_0xe52902)[_0x78c8('0x1')](0x0);var _0x2bcc01=moment(_0x2ad67f)[_0x78c8('0x1')](0x0);return _0x1dbdb3['diff'](_0x2bcc01,'seconds');}function History(_0x1f70b7){this['uniqueid']=_0x1f70b7['uniqueid'];this['scheduledat']=_0x1f70b7[_0x78c8('0x2')]||undefined;this[_0x78c8('0x3')]=_0x1f70b7[_0x78c8('0x3')];this[_0x78c8('0x4')]=_0x1f70b7['type']===_0x78c8('0x5')?_0x78c8('0x6'):_0x1f70b7[_0x78c8('0x3')];this[_0x78c8('0x7')]=_0x1f70b7[_0x78c8('0x7')];this[_0x78c8('0x8')]=_0x1f70b7[_0x78c8('0x8')];this[_0x78c8('0x9')]=_0x1f70b7[_0x78c8('0x9')];this[_0x78c8('0xa')]=_0x1f70b7[_0x78c8('0x7')]+_0x1f70b7[_0x78c8('0x8')]+_0x1f70b7[_0x78c8('0x9')]+_0x1f70b7[_0x78c8('0xb')]+_0x1f70b7[_0x78c8('0xc')]+_0x1f70b7[_0x78c8('0xd')]+_0x1f70b7['countmachineretry']+_0x1f70b7[_0x78c8('0xe')];this[_0x78c8('0xb')]=_0x1f70b7['countnosuchnumberretry'];this[_0x78c8('0xc')]=_0x1f70b7[_0x78c8('0xc')];this[_0x78c8('0xd')]=_0x1f70b7[_0x78c8('0xd')];this[_0x78c8('0xf')]=_0x1f70b7[_0x78c8('0xf')];this['countagentrejectretry']=_0x1f70b7['countagentrejectretry'];this[_0x78c8('0x6')]=_0x1f70b7[_0x78c8('0x6')];this[_0x78c8('0x10')]=_0x1f70b7[_0x78c8('0x11')];this[_0x78c8('0x12')]=_0x1f70b7[_0x78c8('0x13')];this[_0x78c8('0x14')]=_0x1f70b7[_0x78c8('0x14')];this[_0x78c8('0x15')]=_0x1f70b7['responsetime'];this[_0x78c8('0x16')]=_0x1f70b7[_0x78c8('0x15')];this['ringtime']=getSeconds(_0x1f70b7['responsetime'],_0x1f70b7[_0x78c8('0x14')]);this[_0x78c8('0x17')]=0x0;this['talktime']=0x0;this[_0x78c8('0x18')]=_0x1f70b7[_0x78c8('0x18')];this[_0x78c8('0x19')]=_0x1f70b7['callbackuniqueid'];this['callbackat']=_0x1f70b7[_0x78c8('0x1a')];this[_0x78c8('0x1b')]=_0x1f70b7[_0x78c8('0x1b')];this[_0x78c8('0x1c')]=_0x1f70b7[_0x78c8('0x1c')];this[_0x78c8('0x1d')]=_0x1f70b7[_0x78c8('0x1d')];this[_0x78c8('0x1e')]=_0x1f70b7[_0x78c8('0x1e')];this[_0x78c8('0x1f')]=_0x1f70b7[_0x78c8('0x1f')];this[_0x78c8('0x20')]=_0x1f70b7[_0x78c8('0x20')];this['originatecalleridnum']=_0x1f70b7['originatecalleridnum']||'';this[_0x78c8('0x21')]=_0x1f70b7[_0x78c8('0x21')]||'';}module[_0x78c8('0x22')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 78ef897..3c7f8bb 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 _0xcbb3=['syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','voice:queue:%s','voice_queue:save','ivr','campaign:save','-----\x20Stats\x20Predictive\x20---','info','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','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','debug','inspect','error','stack','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','prototype','clearZombieChannels','[actions]','undefined','isNil','Action','status','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','countReScheduled','resolve','then','checkIsBlackList','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','updateOriginated','emptyContact','notFound','pick','UserId','VoiceQueueId','CampaignId','Success','SIP/%s','reachable','unmonitored','saveInDb','uniqueid','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','statedesc','HangupInAMD','membername','AMD','buildObj','amd','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','dialMachineRetryFrequency','minutes','ListId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countnoanswerretry','reason\x2019\x20machine....','add','YYYY-MM-DD\x20HH:mm:ss','ContactId','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','Unknow','reason','agent','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','syncAgentConnect','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','dialDropMaxRetry','additional','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','Abandoned','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','channel','actionid','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','loopCampaigns','resetActiveCalls','checkIsTrunkReachable','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','command','iftime\x20%s,%s','interval','timezones','content','indexOf','true','some','GLOBAL_INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','dialPowerLevel','booked','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','handleIvr','syncQueueSummary','dialActive','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','checkDialMethod','[syncQueueSummary]','throttle','filter','dialPreviewRecallmeReminder','online','map','syncCampaigns','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','substring','dialCutDigit','TrunkBackup','from-sip','OriginateError','[originate][error]','Error','getQueue','isSuccess','response','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callProgressDetecting','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','[syncAgentComplete][createHistory][0]','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','outboundRejectCallsDay','custom:agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','dialPredictiveInterval','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimization','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','agentBusyFactor','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','dialLimitQueue','not_inuse','[countReScheduled]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','predictive','predictiveCalls','../ami','redis','defaults','localhost','../rpc/cmHopperHistory','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./final','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','bind','custom:queuesummary','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset'];(function(_0x56d3eb,_0x2fd037){var _0x2ea969=function(_0x3a2814){while(--_0x3a2814){_0x56d3eb['push'](_0x56d3eb['shift']());}};_0x2ea969(++_0x2fd037);}(_0xcbb3,0x1ea));var _0x3cbb=function(_0x4322e5,_0x5ada1a){_0x4322e5=_0x4322e5-0x0;var _0x182c7d=_0xcbb3[_0x4322e5];return _0x182c7d;};'use strict';var util=require(_0x3cbb('0x0'));var _=require(_0x3cbb('0x1'));var uuid=require(_0x3cbb('0x2'));var moment=require(_0x3cbb('0x3'));var rr=require('rr');var md5=require(_0x3cbb('0x4'));var Redis=require(_0x3cbb('0x5'));var ut=require(_0x3cbb('0x6'));var config=require(_0x3cbb('0x7'));var logger=require('../../../config/logger')('dialer');var loggerBooked=require(_0x3cbb('0x8'))('booked');var loggerPredictive=require(_0x3cbb('0x8'))(_0x3cbb('0x9'));var loggerPredictiveCalls=require('../../../config/logger')(_0x3cbb('0xa'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require(_0x3cbb('0xb'));config[_0x3cbb('0xc')]=_[_0x3cbb('0xd')](config[_0x3cbb('0xc')],{'host':_0x3cbb('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3cbb('0xc')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x3cbb('0xf'));var cmHopperAdditionalPhone=require(_0x3cbb('0x10'));var cmHopperBlack=require(_0x3cbb('0x11'));var voiceQueueRt=require(_0x3cbb('0x12'));var RpcSetting=require(_0x3cbb('0x13'));var Action=require(_0x3cbb('0x14'));var History=require('./history');var Final=require(_0x3cbb('0x15'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x3cbb('0x16'));var ipAgi=process[_0x3cbb('0x17')][_0x3cbb('0x18')]||_0x3cbb('0x19');var strategy={'rrmemory':_0x3cbb('0x1a'),'roundrobin':_0x3cbb('0x1b')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x3cbb('0x1c')]=function(_0xbb0b3e){this[_0x3cbb('0x1d')]=this[_0x3cbb('0x1d')]?this[_0x3cbb('0x1d')][_0x3cbb('0x1e')](_0xbb0b3e):_0xbb0b3e();};function Dialer(_0x5d553b,_0x45e2a2){this[_0x3cbb('0x1f')]=new Sequence();this['preview']=_0x45e2a2;this['voiceQueues']=_0x5d553b[_0x3cbb('0x20')];this[_0x3cbb('0x21')]=_0x5d553b[_0x3cbb('0x21')];this[_0x3cbb('0x22')]=_0x5d553b[_0x3cbb('0x22')];this[_0x3cbb('0x23')]=_0x5d553b['trunks'];this[_0x3cbb('0x24')]=config[_0x3cbb('0x24')]||0x2;this['channels']={};this[_0x3cbb('0x25')]={};this[_0x3cbb('0x26')]={};this[_0x3cbb('0x27')]={};this[_0x3cbb('0x28')]={};this[_0x3cbb('0x29')]={};this[_0x3cbb('0x2a')]={};this[_0x3cbb('0x2b')]={};this[_0x3cbb('0x2c')]={};this['queueBookedRR']={};ami['on'](_0x3cbb('0x2d'),this['syncAgentConnect']['bind'](this));ami['on'](_0x3cbb('0x2e'),this[_0x3cbb('0x2f')]['bind'](this));ami['on']('originateresponse',this[_0x3cbb('0x30')]['bind'](this));ami['on'](_0x3cbb('0x31'),this[_0x3cbb('0x32')][_0x3cbb('0x33')](this));ami['on'](_0x3cbb('0x34'),this['syncQueueSummary']['bind'](this));ami['on']('custom:queuesummarycomplete',this[_0x3cbb('0x35')][_0x3cbb('0x33')](this));ami['on'](_0x3cbb('0x36'),this[_0x3cbb('0x37')][_0x3cbb('0x33')](this));ami['on'](_0x3cbb('0x38'),this[_0x3cbb('0x39')][_0x3cbb('0x33')](this));ami['on'](_0x3cbb('0x3a'),this[_0x3cbb('0x3b')][_0x3cbb('0x33')](this));ami['on'](_0x3cbb('0x3c'),this[_0x3cbb('0x3d')][_0x3cbb('0x33')](this));ami['on'](_0x3cbb('0x3e'),this[_0x3cbb('0x3f')][_0x3cbb('0x33')](this));this['loopCampaigns']();this['loopClearZombieChannels']();RpcSetting['getSettings']()['then'](function(_0x2bf4ce){previewRecallmeReminderInterval=_0x2bf4ce['previewRecallmeReminderInterval'];});}function isNotNull(_0x47652e){return _0x47652e!==null&&!_[_0x3cbb('0x40')](_0x47652e);}function checkIsLoggedIn(_0x4c68ab,_0x3c9403){return function(){if(_0x3c9403<=0x0){_0x4c68ab[_0x3cbb('0x41')]=_0x3cbb('0x42');throw _0x4c68ab[_0x3cbb('0x43')]+_0x3cbb('0x44');}};}function isActive(_0x42664b){return _0x42664b;}function checkIsActive(_0x33e35c,_0x243a52){return function(){if(!isActive(_0x243a52)){_0x33e35c['message']=_0x3cbb('0x45');throw _0x33e35c[_0x3cbb('0x43')]+_0x3cbb('0x46');}};}function checkInterval(_0x43168e){return function(){if(!isNotNull(_0x43168e[_0x3cbb('0x47')])){_0x43168e[_0x3cbb('0x41')]=_0x3cbb('0x48');throw _0x43168e[_0x3cbb('0x43')]+_0x3cbb('0x49');}if(!isNotNull(_0x43168e[_0x3cbb('0x47')][_0x3cbb('0x4a')])){_0x43168e[_0x3cbb('0x41')]=_0x3cbb('0x48');throw _0x43168e[_0x3cbb('0x43')]+_0x3cbb('0x49');}if(!isNotNull(_[_0x3cbb('0x4b')](_0x43168e['Interval'][_0x3cbb('0x4a')]))){_0x43168e[_0x3cbb('0x41')]='INTERVAL_IS_NULL';throw _0x43168e[_0x3cbb('0x43')]+_0x3cbb('0x49');}};}function msgResponse(_0x11115e,_0x5ef9c8,_0x2e57e1){return{'action':_0x11115e,'response':_0x5ef9c8,'message':_0x2e57e1,'stack':_0x2e57e1};}function myreject(_0x2458df){return function(_0x470dbc){return _0x2458df(msgResponse(_0x3cbb('0x4c'),'Error',JSON[_0x3cbb('0x4d')](_0x470dbc)));};}function getSeconds(_0x3d02e7,_0x206b1d){var _0x17f655=moment(_0x3d02e7)[_0x3cbb('0x4e')](0x0);var _0x2fabd0=moment(_0x206b1d)['milliseconds'](0x0);return _0x17f655[_0x3cbb('0x4f')](_0x2fabd0,_0x3cbb('0x50'));}function emit(_0xc3262,_0x4a8172,_0x37cabb){io['to'](_0xc3262)[_0x3cbb('0x51')](_0x4a8172,_0x37cabb);}function emitVoiceQueueSummary(_0x4e5285){if(_0x4e5285[_0x3cbb('0x52')]===_0x3cbb('0x53')){var _0x101041={'id':_0x4e5285['id'],'name':_0x4e5285['name'],'strategy':_0x4e5285[_0x3cbb('0x54')],'answered':_0x4e5285['answered'],'available':_0x4e5285[_0x3cbb('0x55')],'loggedIn':_0x4e5285[_0x3cbb('0x56')],'pTalking':_0x4e5285[_0x3cbb('0x57')],'sumBillable':_0x4e5285['sumBillable'],'sumDuration':_0x4e5285[_0x3cbb('0x58')],'sumHoldTime':_0x4e5285[_0x3cbb('0x59')]||0x0,'talking':_0x4e5285[_0x3cbb('0x5a')],'total':_0x4e5285[_0x3cbb('0x5b')],'type':_0x4e5285[_0x3cbb('0x52')],'unmanaged':_0x4e5285[_0x3cbb('0x5c')],'abandoned':_0x4e5285['abandoned'],'waiting':_0x4e5285[_0x3cbb('0x5d')],'loggedInDb':_0x4e5285[_0x3cbb('0x5e')],'dialActive':_0x4e5285['dialActive'],'dialMethod':_0x4e5285[_0x3cbb('0x5f')],'dialOriginateCallerIdName':_0x4e5285[_0x3cbb('0x60')],'dialOriginateCallerIdNumber':_0x4e5285[_0x3cbb('0x61')],'dialOriginateTimeout':_0x4e5285['dialOriginateTimeout'],'dialPrefix':_0x4e5285[_0x3cbb('0x62')],'outboundAnswerAgiCallsDay':_0x4e5285[_0x3cbb('0x63')],'outboundAnswerCallsDay':_0x4e5285[_0x3cbb('0x64')],'outboundBlacklistCallsDay':_0x4e5285[_0x3cbb('0x65')],'outboundBusyCallsDay':_0x4e5285[_0x3cbb('0x66')],'outboundCongestionCallsDay':_0x4e5285[_0x3cbb('0x67')],'outboundDropCallsDayACS':_0x4e5285[_0x3cbb('0x68')],'outboundDropCallsDayCallersExit':_0x4e5285[_0x3cbb('0x69')],'outboundDropCallsDayTimeout':_0x4e5285[_0x3cbb('0x6a')],'outboundNoAnswerCallsDay':_0x4e5285[_0x3cbb('0x6b')],'outboundNoSuchCallsDay':_0x4e5285[_0x3cbb('0x6c')],'outboundOriginateFailureCallsDay':_0x4e5285['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x4e5285[_0x3cbb('0x6d')],'outboundRejectCallsDay':_0x4e5285['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x4e5285[_0x3cbb('0x6e')],'predictiveIntervalAnsweredCalls':_0x4e5285[_0x3cbb('0x6f')],'predictiveIntervalAvgHoldtime':_0x4e5285[_0x3cbb('0x70')],'predictiveIntervalAvgTalktime':_0x4e5285[_0x3cbb('0x71')],'predictiveIntervalDroppedCallsCallersExit':_0x4e5285['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x4e5285[_0x3cbb('0x72')],'predictiveIntervalErlangCalls':_0x4e5285[_0x3cbb('0x73')],'predictiveIntervalErlangCallsDroppedCalls':_0x4e5285[_0x3cbb('0x74')],'predictiveIntervalHitRate':_0x4e5285['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x4e5285['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x4e5285[_0x3cbb('0x75')],'predictiveIntervalAvailable':_0x4e5285[_0x3cbb('0x76')],'predictiveIntervalTotalCalls':_0x4e5285[_0x3cbb('0x77')],'message':_0x4e5285[_0x3cbb('0x41')],'originated':_0x4e5285[_0x3cbb('0x78')],'erlangCalls':_0x4e5285['erlangCalls'],'erlangCallToSecond':_0x4e5285[_0x3cbb('0x79')],'erlangAbandonmentRate':_0x4e5285[_0x3cbb('0x7a')],'erlangBusyFactor':_0x4e5285[_0x3cbb('0x7b')],'startPredictive':_0x4e5285[_0x3cbb('0x29')],'startProgressive':_0x4e5285[_0x3cbb('0x2a')]};if(_0x4e5285[_0x3cbb('0x7c')]){_0x101041[_0x3cbb('0x7c')]={'id':_0x4e5285[_0x3cbb('0x7c')]['id'],'name':_0x4e5285['Trunk']['name'],'active':_0x4e5285[_0x3cbb('0x7c')][_0x3cbb('0x7d')],'callerid':_0x4e5285[_0x3cbb('0x7c')]['callerid']};}if(_0x4e5285[_0x3cbb('0x47')]){_0x101041[_0x3cbb('0x47')]={'id':_0x4e5285[_0x3cbb('0x47')]['id'],'name':_0x4e5285[_0x3cbb('0x47')][_0x3cbb('0x43')]};}var _0x6b1988=md5(JSON[_0x3cbb('0x4d')](_0x101041));if(_0x4e5285[_0x3cbb('0x4')]!==_0x6b1988){_0x4e5285[_0x3cbb('0x4')]=_0x6b1988;emit(util['format'](_0x3cbb('0x7e'),_0x101041[_0x3cbb('0x43')]),_0x3cbb('0x7f'),_0x101041);}}}function emitCampaignSummary(_0x2a955a){if(_0x2a955a[_0x3cbb('0x52')]===_0x3cbb('0x80')){emit(util['format']('campaign:ivr:%s',_0x2a955a[_0x3cbb('0x43')]),_0x3cbb('0x81'),_0x2a955a);}}function checkGetDataPredictive(_0x44b08d){if(isNotNull(_0x44b08d)&&!_[_0x3cbb('0x4b')](_0x44b08d)){loggerPredictive['info'](_0x3cbb('0x82'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x44b08d[_0x3cbb('0x77')]);loggerPredictive[_0x3cbb('0x83')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x44b08d[_0x3cbb('0x6f')]);loggerPredictive[_0x3cbb('0x83')](_0x3cbb('0x84'),_0x44b08d[_0x3cbb('0x72')]);loggerPredictive[_0x3cbb('0x83')](_0x3cbb('0x85'),_0x44b08d[_0x3cbb('0x86')]);loggerPredictive[_0x3cbb('0x83')](_0x3cbb('0x87'),_0x44b08d[_0x3cbb('0x70')]);loggerPredictive[_0x3cbb('0x83')](_0x3cbb('0x88'),_0x44b08d[_0x3cbb('0x71')]);loggerPredictive[_0x3cbb('0x83')](_0x3cbb('0x89'));if(_0x44b08d['predictiveIntervalTotalCalls']>0x0){if(!_[_0x3cbb('0x40')](_0x44b08d['predictiveIntervalAvgTalktime'])&&_0x44b08d[_0x3cbb('0x71')]>0x0){return!![];}loggerPredictive[_0x3cbb('0x83')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x3cbb('0x40')](_0x44b08d[_0x3cbb('0x70')])&&_0x44b08d[_0x3cbb('0x70')]>0x0){return!![];}loggerPredictive[_0x3cbb('0x83')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x3cbb('0x83')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x3cbb('0x83')](_0x3cbb('0x8a'));}return![];}function mergeDataErlangB(_0x30a2da){return function(_0x1d5523){loggerPredictive[_0x3cbb('0x83')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x3cbb('0x83')](_0x3cbb('0x8b'),_0x1d5523[_0x3cbb('0x8c')]);loggerPredictive[_0x3cbb('0x83')](_0x3cbb('0x8d'),_0x1d5523[_0x3cbb('0x79')]);loggerPredictive['info'](_0x3cbb('0x8e'),_0x1d5523['erlangAbandonmentRate']);loggerPredictive[_0x3cbb('0x83')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1d5523[_0x3cbb('0x7b')]);loggerPredictive[_0x3cbb('0x83')](_0x3cbb('0x8e'),_0x1d5523[_0x3cbb('0x7a')]);loggerPredictive[_0x3cbb('0x83')]('---------------------------');_[_0x3cbb('0x8f')](_0x30a2da,_0x1d5523);};}function getDiff(_0x4fc739){var _0x24a34d=moment()[_0x3cbb('0x4e')](0x0);var _0xbbbc9d=moment(_0x4fc739)['milliseconds'](0x0);return _0x24a34d[_0x3cbb('0x4f')](_0xbbbc9d,_0x3cbb('0x50'));}function ifInterval(_0x4a41ee,_0x3dbbe6){if(_[_0x3cbb('0x40')](_0x3dbbe6)){return![];}return getDiff(_0x3dbbe6)<_0x4a41ee*0x3c;}function freeVariablesPredictive(_0x5037b6){if(isNotNull(_0x5037b6)){if(!_[_0x3cbb('0x40')](_0x5037b6[_0x3cbb('0x2a')])){_0x5037b6[_0x3cbb('0x2a')]=undefined;loggerPredictive[_0x3cbb('0x83')](_0x5037b6[_0x3cbb('0x43')],_0x3cbb('0x90'));}if(!_[_0x3cbb('0x40')](_0x5037b6[_0x3cbb('0x29')])){_0x5037b6[_0x3cbb('0x29')]=undefined;loggerPredictive[_0x3cbb('0x83')](_0x5037b6[_0x3cbb('0x43')],'clearing\x20variable\x20start\x20predictive');}if(!_['isUndefined'](_0x5037b6[_0x3cbb('0x91')])){clearInterval(_0x5037b6[_0x3cbb('0x91')]);_0x5037b6['handlePredictive']=undefined;loggerPredictive[_0x3cbb('0x83')](_0x5037b6[_0x3cbb('0x43')],_0x3cbb('0x92'));}}}function erlangb(_0x594071,_0x44fd68){if(_0x44fd68===0x0){return 0x0;}var _0x541ff6=0x1;for(var _0x22bd97=0x1;_0x22bd97<=_0x44fd68;_0x22bd97+=0x1){_0x541ff6=0x1+_0x541ff6*_0x22bd97/_0x594071;}return 0x1/_0x541ff6;}function isVoiceQueueOutbound(_0x53e5d1){return _0x53e5d1===_0x3cbb('0x53');}function isNotPreview(_0x10f3c9){return _0x10f3c9!==_0x3cbb('0x93');}function isCampaignIvr(_0x2219fe){return _0x2219fe===_0x3cbb('0x80');}function getCallerId(_0x1d6e27,_0x36e8de,_0x55ce0b){if(!_['isUndefined'](_0x55ce0b)&&typeof _0x55ce0b===_0x3cbb('0x94')&&!_[_0x3cbb('0x4b')](_0x55ce0b)){if(!_[_0x3cbb('0x40')](_0x36e8de)&&typeof _0x36e8de==='string'&&!_['isEmpty'](_0x36e8de)){return util[_0x3cbb('0x95')](_0x3cbb('0x96'),_0x36e8de,_0x55ce0b);}return util[_0x3cbb('0x95')](_0x3cbb('0x96'),_0x55ce0b,_0x55ce0b);}if(!_[_0x3cbb('0x40')](_0x1d6e27)&&typeof _0x1d6e27===_0x3cbb('0x94')&&!_[_0x3cbb('0x4b')](_0x1d6e27)){return _0x1d6e27;}return _0x3cbb('0x97');}function loggerCatchQueueSummary(_0x1a7bd2,_0x1d9978){return function(_0xa65cf3){freeVariablesPredictive(_0x1d9978);emitVoiceQueueSummary(_0x1d9978);emitCampaignSummary(_0x1d9978);loggerSyncQueueSummary[_0x3cbb('0x98')](_0x1a7bd2,util[_0x3cbb('0x99')](_0xa65cf3,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3a280e,_0x2a4eaf){return function(_0x419408){loggerPredictive[_0x3cbb('0x9a')](_0x2a4eaf[_0x3cbb('0x43')],_0x3a280e);loggerPredictive['error'](_0x419408[_0x3cbb('0x9b')]);freeVariablesPredictive(_0x2a4eaf);};}function loggerCatch(_0x3d342d){return function(_0xbe70d5){logger[_0x3cbb('0x9a')](_0x3d342d,util['inspect'](_0xbe70d5,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x39bfea){return _0x39bfea&&!_[_0x3cbb('0x40')](_0x39bfea)&&_0x39bfea[_0x3cbb('0x9c')]>0x0;}function decremetOriginate(_0x2e0df6){if(!_[_0x3cbb('0x40')](_0x2e0df6)&&_0x2e0df6!==null){if(typeof _0x2e0df6[_0x3cbb('0x78')]!=='undefined'){if(_0x2e0df6[_0x3cbb('0x78')]>0x0){_0x2e0df6['originated']-=0x1;}else{logger[_0x3cbb('0x9a')](_0x3cbb('0x9d'));}}}else{logger[_0x3cbb('0x9a')](_0x3cbb('0x9e'));}}function checkContactLowerLimitOriginate(_0x960017,_0x2fd77c,_0x7293c0){if(_0x2fd77c>_0x7293c0){for(var _0x58ac4b=0x0;_0x58ac4b<_0x2fd77c-_0x7293c0;_0x58ac4b+=0x1){decremetOriginate(_0x960017);}}}function loggerGetContactDialer(_0x4bc617,_0x419b18,_0x3e9514){return function(_0x194979){checkContactLowerLimitOriginate(_0x419b18,_0x3e9514,0x0);logger['error'](_0x4bc617,util[_0x3cbb('0x99')](_0x194979,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2f3e33){return function(_0x5c9153){if(isNotNull(_0x5c9153)&&isNotNull(_0x5c9153[0x0])){if(_0x5c9153[0x0][_0x3cbb('0x9f')]>0x0){_0x2f3e33[_0x3cbb('0x41')]=_0x3cbb('0xa0');logger['info'](_0x3cbb('0xa1')+_0x2f3e33['name'],_0x5c9153[0x0][_0x3cbb('0x9f')],_0x3cbb('0xa2'));}else{_0x2f3e33[_0x3cbb('0x41')]=_0x3cbb('0xa3');logger[_0x3cbb('0x83')](_0x3cbb('0xa4')+_0x2f3e33[_0x3cbb('0x43')]);}}};}function notSendMessagesQueue(_0x3a044b){if(_0x3a044b['sendMessageOneNotActive']){freeVariablesPredictive(_0x3a044b);if(_0x3a044b[_0x3cbb('0x78')]===0x0&&_0x3a044b['talking']===0x0&&_0x3a044b[_0x3cbb('0x5d')]===0x0&&(_0x3a044b['pTalking']||0x0)===0x0){_0x3a044b[_0x3cbb('0xa5')]=![];_0x3a044b[_0x3cbb('0x55')]=0x0;_0x3a044b['message']='NOT_ACTIVE';loggerSyncQueueSummary['debug'](_0x3cbb('0xa6'),_0x3a044b[_0x3cbb('0x43')],_0x3cbb('0xa7'));}else{_0x3a044b[_0x3cbb('0x41')]=_0x3cbb('0xa8');loggerSyncQueueSummary[_0x3cbb('0x98')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x3a044b['name'],_0x3cbb('0xa9'));}emitVoiceQueueSummary(_0x3a044b);}}function notSendMessagesCampaign(_0x4825dd){if(_0x4825dd[_0x3cbb('0xa5')]){if(_0x4825dd['originated']===0x0){_0x4825dd['sendMessageOneNotActive']=![];_0x4825dd[_0x3cbb('0x41')]=_0x3cbb('0x45');loggerSyncQueueSummary[_0x3cbb('0x98')](_0x3cbb('0xaa'),_0x4825dd['name'],_0x3cbb('0xa7'));}else{_0x4825dd[_0x3cbb('0x41')]=_0x3cbb('0xa8');loggerSyncQueueSummary[_0x3cbb('0x98')](_0x3cbb('0xaa'),_0x4825dd[_0x3cbb('0x43')],'is\x20disactive');}emitCampaignSummary(_0x4825dd);}}function createObjHistory(_0x2cacc2,_0x1b2db8,_0x5e4f84,_0x50538e,_0x3d8c01){_0x2cacc2['message']=_0x5e4f84;var _0x5d8880=new Action(_0x2cacc2,_0x1b2db8);var _0x1ca0de=new History(_0x5d8880);_0x1ca0de[_0x3cbb('0xab')]=_0x50538e;_0x1ca0de['statedesc']=_0x3d8c01;_0x1ca0de[_0x3cbb('0xac')]=_0x5d8880[_0x3cbb('0xad')];return _0x1ca0de;}Dialer[_0x3cbb('0xae')]['loopClearZombieChannels']=function(){var _0x1d6fbd=this;setInterval(function(){_0x1d6fbd[_0x3cbb('0xaf')](_0x1d6fbd[_0x3cbb('0x27')],'[uniqueid]');_0x1d6fbd[_0x3cbb('0xaf')](_0x1d6fbd['actions'],_0x3cbb('0xb0'));},0x32c8);};Dialer[_0x3cbb('0xae')][_0x3cbb('0xaf')]=function(_0x1b34af,_0x7e8552){var _0x204ccf=this;for(var _0x19ee81 in _0x1b34af){if(typeof _0x1b34af[_0x19ee81]!==_0x3cbb('0xb1')){this[_0x3cbb('0x1f')][_0x3cbb('0x1c')](function(){if(!_[_0x3cbb('0xb2')](_0x1b34af[_0x19ee81])){return ami[_0x3cbb('0xb3')]({'action':_0x3cbb('0xb4'),'channel':_0x1b34af[_0x19ee81]['channel']})[_0x3cbb('0xb5')](function(_0xec6450){if(_0xec6450[_0x3cbb('0x41')]===_0x3cbb('0xb6')){setTimeout(function(){if(_0x1b34af[_0x19ee81]&&_0x1b34af[_0x19ee81][_0x3cbb('0x52')]!==_0x3cbb('0x80')){_0x204ccf['updateOriginated'](_0x204ccf['voiceQueues'][_0x1b34af[_0x19ee81][_0x3cbb('0xb7')]]);logger[_0x3cbb('0x9a')](_0x3cbb('0xb8'),_0x7e8552,_0x19ee81,_0x1b34af[_0x19ee81][_0x3cbb('0xb7')]);delete _0x1b34af[_0x19ee81];}if(_0x1b34af[_0x19ee81]&&_0x1b34af[_0x19ee81]['type']===_0x3cbb('0x80')){_0x204ccf['updateOriginated'](_0x204ccf[_0x3cbb('0x21')][_0x1b34af[_0x19ee81]['queue']]);logger[_0x3cbb('0x9a')]('[Dialer][checkChannel][ivr]',_0x7e8552,_0x19ee81,_0x1b34af[_0x19ee81]['queue']);delete _0x1b34af[_0x19ee81];}},0x2328);}});}});}}};Dialer[_0x3cbb('0xae')][_0x3cbb('0xb9')]=function(_0x562530){return Promise[_0x3cbb('0xba')]()[_0x3cbb('0xbb')](cmHopper['countReScheduled'](_0x562530))['catch'](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x3cbb('0xae')][_0x3cbb('0xbc')]=function(_0x31db73){return Promise['resolve']()[_0x3cbb('0xbb')](cmHopperBlack[_0x3cbb('0xbc')](_0x31db73))[_0x3cbb('0xb5')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x3cbb('0xae')][_0x3cbb('0xbd')]=function(_0xdb7e4f,_0x4b5d23,_0x2414e4){return Promise[_0x3cbb('0xba')]()[_0x3cbb('0xbb')](cmHopperAdditionalPhone[_0x3cbb('0xbd')](_0xdb7e4f,_0x4b5d23,_0x2414e4))[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0xbe')));};Dialer[_0x3cbb('0xae')]['swapAdditionalPhones']=function(_0x3f291e,_0x1b209f,_0x414e52){return Promise[_0x3cbb('0xba')]()[_0x3cbb('0xbb')](cmHopperAdditionalPhone['swapAdditionalPhones'](_0x3f291e,_0x1b209f,_0x414e52))[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0xbf')));};Dialer[_0x3cbb('0xae')][_0x3cbb('0xc0')]=function(_0x1bca51){return Promise[_0x3cbb('0xba')]()[_0x3cbb('0xbb')](cmHopperBlack[_0x3cbb('0xc0')](_0x1bca51))[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0xc1')));};Dialer[_0x3cbb('0xae')][_0x3cbb('0xc2')]=function(_0x23be71){return Promise[_0x3cbb('0xba')]()['then'](cmHopperHistory['avgHandleTime'](_0x23be71))[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0xc3')));};Dialer[_0x3cbb('0xae')]['rescheduleContact']=function(_0x7a361e){return Promise[_0x3cbb('0xba')]()[_0x3cbb('0xbb')](cmHopper[_0x3cbb('0xc4')](_0x7a361e))[_0x3cbb('0xb5')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x3cbb('0xae')][_0x3cbb('0xc5')]=function(_0x3f221b,_0x2a1224,_0x1d61bb){return Promise['resolve']()[_0x3cbb('0xbb')](cmHopper[_0x3cbb('0xc5')](_0x3f221b,_0x2a1224,_0x1d61bb))[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0xc6')));};Dialer[_0x3cbb('0xae')][_0x3cbb('0xc7')]=function(_0x31430c,_0x5a8ad6,_0x5dfb65,_0x15dff4,_0x5aa891){return Promise[_0x3cbb('0xba')]()[_0x3cbb('0xbb')](cmHopper[_0x3cbb('0xc7')](_0x31430c,_0x5a8ad6,_0x5dfb65,_0x15dff4))['catch'](function(_0x54327b){_0x5aa891[_0x3cbb('0xc8')]-=_0x5dfb65;_0x5aa891[_0x3cbb('0xc8')]=_0x5aa891[_0x3cbb('0xc8')]>0x0?_0x5aa891[_0x3cbb('0xc8')]:0x0;loggerCatch(_0x3cbb('0xc9'))(_0x54327b);});};Dialer[_0x3cbb('0xae')][_0x3cbb('0xca')]=function(_0x26431f,_0x3969fd,_0x4ca0b8,_0x15a4dd){return Promise[_0x3cbb('0xba')]()['then'](cmHopper[_0x3cbb('0xca')](_0x26431f,_0x3969fd,_0x4ca0b8))[_0x3cbb('0xb5')](function(_0x79b0a4){_0x15a4dd[_0x3cbb('0xc8')]-=_0x3969fd;_0x15a4dd[_0x3cbb('0xc8')]=_0x15a4dd[_0x3cbb('0xc8')]>0x0?_0x15a4dd[_0x3cbb('0xc8')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x79b0a4);});};Dialer[_0x3cbb('0xae')][_0x3cbb('0xcb')]=function(_0x4e3f72){return Promise[_0x3cbb('0xba')]()[_0x3cbb('0xbb')](voiceQueueRt['getVoiceQueueRtPauses'](_0x4e3f72))[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0xcc')));};Dialer[_0x3cbb('0xae')][_0x3cbb('0xcd')]=function(_0x58aa65){return Promise[_0x3cbb('0xba')]()['then'](cmHopper[_0x3cbb('0xcd')](_0x58aa65))[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0xce')));};Dialer[_0x3cbb('0xae')][_0x3cbb('0xcf')]=function(_0x40c2b6){return Promise[_0x3cbb('0xba')]()['then'](cmHopperHistory[_0x3cbb('0xcf')](_0x40c2b6))[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0xd0')));};Dialer[_0x3cbb('0xae')]['updateOriginated']=function(_0x46f752){if(!_[_0x3cbb('0x40')](_0x46f752)&&_0x46f752!==null){if(typeof _0x46f752['originated']!==_0x3cbb('0xb1')){if(_0x46f752[_0x3cbb('0x78')]>0x0){_0x46f752[_0x3cbb('0x78')]-=0x1;}else{logger[_0x3cbb('0x9a')](_0x3cbb('0xd1'));}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x3cbb('0xae')][_0x3cbb('0xd2')]=function(_0x5804cd,_0x3d03af){var _0x1ab6d6=this;return function(_0x340bd6){_0x1ab6d6[_0x3cbb('0xd3')](_0x3d03af);logger[_0x3cbb('0x9a')](_0x5804cd,util[_0x3cbb('0x99')](_0x340bd6,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x3cbb('0xd4')]=function(_0x26e01a,_0x3013f0,_0x4a203e){var _0x54ae00={'state':0x19,'statedesc':_0x3cbb('0xd5')};this[_0x3cbb('0xd3')](_0x3013f0);this['saveInDb'](_[_0x3cbb('0x8f')](_0x54ae00,_[_0x3cbb('0xd6')](_0x4a203e,['ContactId','ListId',_0x3cbb('0xd7'),_0x3cbb('0xd8'),_0x3cbb('0xd9')])),'[emptyContact][createHistory]','[emptyContact]');logger['error'](_0x26e01a);};Dialer[_0x3cbb('0xae')]['isSuccess']=function(_0x1090c7){return _0x1090c7===_0x3cbb('0xda');};Dialer[_0x3cbb('0xae')]['isTrunkReachable']=function(_0xcb9f60){return!_[_0x3cbb('0x40')](_0xcb9f60)&&_0xcb9f60&&!_[_0x3cbb('0x40')](_0xcb9f60['name'])&&!_['isUndefined'](_0xcb9f60[_0x3cbb('0x7d')])&&_0xcb9f60['active']&&(this[_0x3cbb('0x23')][util[_0x3cbb('0x95')](_0x3cbb('0xdb'),_0xcb9f60[_0x3cbb('0x43')])]['status']===_0x3cbb('0xdc')||this[_0x3cbb('0x23')][util[_0x3cbb('0x95')]('SIP/%s',_0xcb9f60[_0x3cbb('0x43')])][_0x3cbb('0xb4')]===_0x3cbb('0xdd'));};Dialer[_0x3cbb('0xae')][_0x3cbb('0xde')]=function(_0x2abd9a,_0x1dac76,_0x28bfef){this[_0x3cbb('0xcf')](_0x2abd9a)[_0x3cbb('0xb5')](loggerCatch(_0x1dac76));this[_0x3cbb('0xcd')](_0x2abd9a)[_0x3cbb('0xb5')](loggerCatch(_0x28bfef));};Dialer[_0x3cbb('0xae')][_0x3cbb('0x3b')]=function(_0x9af292){var _0x5ad2f9=this;var _0x41b2f5=this[_0x3cbb('0x27')][_0x9af292[_0x3cbb('0xdf')]];var _0x4c79e0;if(!_[_0x3cbb('0xb2')](_0x9af292)&&!_[_0x3cbb('0xb2')](_0x9af292[_0x3cbb('0xe0')])&&!_[_0x3cbb('0xb2')](_0x9af292[_0x3cbb('0xe0')]['amdstatus'])&&_0x9af292[_0x3cbb('0xe1')]===_0x3cbb('0xe2')&&_0x41b2f5){if(_0x41b2f5[_0x3cbb('0x52')]!=='ivr'&&this[_0x3cbb('0x20')][_0x41b2f5[_0x3cbb('0xb7')]][_0x3cbb('0xe3')]&&_0x9af292[_0x3cbb('0xe4')]===_0x3cbb('0xe5')){delete this[_0x3cbb('0x27')][_0x9af292['uniqueid']];this[_0x3cbb('0xd3')](this[_0x3cbb('0x20')][_0x41b2f5['queue']]);this['voiceQueues'][_0x41b2f5[_0x3cbb('0xb7')]][_0x3cbb('0x64')]+=0x1;this['voiceQueues'][_0x41b2f5['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x4c79e0=new Hangup(_0x41b2f5,_0x9af292);_0x4c79e0[_0x3cbb('0xab')]=0x12;_0x4c79e0[_0x3cbb('0xe6')]=_0x3cbb('0xe7');_0x4c79e0[_0x3cbb('0xe8')]=_0x3cbb('0xe9');ami[_0x3cbb('0x51')]('custom:amd',ut[_0x3cbb('0xea')](_0x4c79e0,_0x3cbb('0xeb')));this[_0x3cbb('0xde')](_0x4c79e0,'[syncHangupInAMD][createHistory]',_0x3cbb('0xec'));}if(_0x41b2f5['type']!==_0x3cbb('0x80')&&this[_0x3cbb('0x20')][_0x41b2f5['queue']]['dialAMDActive']&&_0x9af292['value']===_0x3cbb('0xed')){return new Promise(function(_0x3fe8f6,_0x469618){delete _0x5ad2f9[_0x3cbb('0x27')][_0x9af292[_0x3cbb('0xdf')]];_0x5ad2f9['updateOriginated'](_0x5ad2f9['voiceQueues'][_0x41b2f5[_0x3cbb('0xb7')]]);_0x5ad2f9[_0x3cbb('0x20')][_0x41b2f5['queue']][_0x3cbb('0x64')]+=0x1;_0x5ad2f9[_0x3cbb('0x20')][_0x41b2f5[_0x3cbb('0xb7')]][_0x3cbb('0x63')]+=0x1;var _0x15602e=_0x5ad2f9[_0x3cbb('0x20')][_0x41b2f5[_0x3cbb('0xb7')]];var _0x5297f3=new Hangup(_0x41b2f5,_0x9af292);_0x5297f3['state']=0x13;_0x5297f3[_0x3cbb('0xe6')]=_0x3cbb('0xee');_0x5297f3[_0x3cbb('0xe8')]=_0x3cbb('0xe9');_0x5297f3[_0x3cbb('0xef')]+=0x1;_0x5297f3[_0x3cbb('0xf0')]+=0x1;_0x5297f3[_0x3cbb('0xeb')]=!![];ami[_0x3cbb('0x51')]('custom:amd',ut[_0x3cbb('0xea')](_0x5297f3,_0x3cbb('0xeb')));_0x5ad2f9[_0x3cbb('0xcf')](_0x5297f3)[_0x3cbb('0xb5')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5297f3[_0x3cbb('0xf1')]+_0x5297f3[_0x3cbb('0xf2')]+_0x5297f3['countnoanswerretry']+_0x5297f3[_0x3cbb('0xf3')]+_0x5297f3[_0x3cbb('0xf4')]+_0x5297f3[_0x3cbb('0xf5')]+_0x5297f3['countmachineretry']+_0x5297f3[_0x3cbb('0xf6')]>=_0x15602e[_0x3cbb('0xf7')]){_0x5ad2f9[_0x3cbb('0xf8')](_0x5297f3,_0x3fe8f6,_0x469618,_0x3cbb('0xf9'));}else{if(_0x5297f3[_0x3cbb('0xef')]>=_0x15602e[_0x3cbb('0xfa')]){_0x5ad2f9[_0x3cbb('0xfb')](_0x5297f3,_0x3fe8f6,_0x469618,'reason\x2019\x20machine....');}else{_0x5ad2f9['rescheduleContact']({'active':![],'countmachineretry':_0x5297f3[_0x3cbb('0xef')],'scheduledat':moment()['add'](_0x15602e[_0x3cbb('0xfc')],_0x3cbb('0xfd'))[_0x3cbb('0x95')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5297f3['ContactId'],'ListId':_0x5297f3[_0x3cbb('0xfe')],'VoiceQueueId':_0x5297f3[_0x3cbb('0xd8')]||undefined,'CampaignId':_0x5297f3[_0x3cbb('0xd9')]||undefined})[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0xff')));_0x3fe8f6({'reschedule':0x1});}}});}if(_0x41b2f5[_0x3cbb('0x52')]==='ivr'&&this[_0x3cbb('0x21')][_0x41b2f5[_0x3cbb('0xb7')]][_0x3cbb('0xe3')]&&_0x9af292[_0x3cbb('0xe4')]===_0x3cbb('0xe5')){delete this[_0x3cbb('0x27')][_0x9af292[_0x3cbb('0xdf')]];this[_0x3cbb('0xd3')](this[_0x3cbb('0x21')][_0x41b2f5['queue']]);_0x4c79e0=new Hangup(_0x41b2f5,_0x9af292);_0x4c79e0[_0x3cbb('0xab')]=0x12;_0x4c79e0[_0x3cbb('0xe6')]=_0x3cbb('0xe7');_0x4c79e0[_0x3cbb('0xe8')]='AMD';ami[_0x3cbb('0x51')]('custom:amd',ut[_0x3cbb('0xea')](_0x4c79e0,_0x3cbb('0xeb')));this[_0x3cbb('0xde')](_0x4c79e0,_0x3cbb('0x100'),_0x3cbb('0x101'));}if(_0x41b2f5['type']===_0x3cbb('0x80')&&this[_0x3cbb('0x21')][_0x41b2f5[_0x3cbb('0xb7')]][_0x3cbb('0xe3')]&&_0x9af292['value']===_0x3cbb('0xed')){return new Promise(function(_0x39fbe6,_0x2cb1a8){delete _0x5ad2f9[_0x3cbb('0x27')][_0x9af292[_0x3cbb('0xdf')]];_0x5ad2f9['updateOriginated'](_0x5ad2f9['campaigns'][_0x41b2f5[_0x3cbb('0xb7')]]);_0x5ad2f9[_0x3cbb('0x21')][_0x41b2f5[_0x3cbb('0xb7')]][_0x3cbb('0x64')]+=0x1;_0x5ad2f9[_0x3cbb('0x21')][_0x41b2f5[_0x3cbb('0xb7')]][_0x3cbb('0x63')]+=0x1;var _0x43c2cb=_0x5ad2f9['campaigns'][_0x41b2f5[_0x3cbb('0xb7')]];var _0x59cdb5=new Hangup(_0x41b2f5,_0x9af292);_0x59cdb5[_0x3cbb('0xab')]=0x13;_0x59cdb5[_0x3cbb('0xe6')]=_0x3cbb('0xee');_0x59cdb5['membername']=_0x3cbb('0xe9');_0x59cdb5[_0x3cbb('0xef')]+=0x1;_0x59cdb5['countglobal']+=0x1;_0x59cdb5['amd']=!![];ami[_0x3cbb('0x51')]('custom:amd',ut[_0x3cbb('0xea')](_0x59cdb5,'amd'));_0x5ad2f9[_0x3cbb('0xcf')](_0x59cdb5)[_0x3cbb('0xb5')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x59cdb5[_0x3cbb('0xf1')]+_0x59cdb5[_0x3cbb('0xf2')]+_0x59cdb5[_0x3cbb('0x102')]+_0x59cdb5[_0x3cbb('0xf3')]+_0x59cdb5[_0x3cbb('0xf4')]+_0x59cdb5[_0x3cbb('0xf5')]+_0x59cdb5[_0x3cbb('0xef')]+_0x59cdb5['countagentrejectretry']>=_0x43c2cb[_0x3cbb('0xf7')]){_0x5ad2f9['stateGlobal'](_0x59cdb5,_0x39fbe6,_0x2cb1a8,_0x3cbb('0xf9'));}else{if(_0x59cdb5['countmachineretry']>=_0x43c2cb[_0x3cbb('0xfa')]){_0x5ad2f9[_0x3cbb('0xfb')](_0x59cdb5,_0x39fbe6,_0x2cb1a8,_0x3cbb('0x103'));}else{_0x5ad2f9[_0x3cbb('0xc4')]({'active':![],'countmachineretry':_0x59cdb5[_0x3cbb('0xef')],'scheduledat':moment()[_0x3cbb('0x104')](_0x43c2cb['dialMachineRetryFrequency'],_0x3cbb('0xfd'))[_0x3cbb('0x95')](_0x3cbb('0x105')),'ContactId':_0x59cdb5[_0x3cbb('0x106')],'ListId':_0x59cdb5[_0x3cbb('0xfe')],'VoiceQueueId':_0x59cdb5[_0x3cbb('0xd8')]||undefined,'CampaignId':_0x59cdb5[_0x3cbb('0xd9')]||undefined})[_0x3cbb('0xb5')](loggerCatch('[rescheduleContact][Machine]'));_0x39fbe6({'reschedule':0x1});}}});}}};Dialer[_0x3cbb('0xae')][_0x3cbb('0x37')]=function(_0x5aae82){var _0x15b2d8=this[_0x3cbb('0x27')][_0x5aae82[_0x3cbb('0xdf')]];var _0x3002b8;if(_0x15b2d8&&_0x15b2d8[_0x3cbb('0x52')]==='ivr'){delete this[_0x3cbb('0x27')][_0x5aae82['uniqueid']];this[_0x3cbb('0xd3')](this[_0x3cbb('0x21')][_0x15b2d8[_0x3cbb('0xb7')]]);this[_0x3cbb('0x21')][_0x15b2d8[_0x3cbb('0xb7')]][_0x3cbb('0x107')]+=0x1;_0x3002b8=new Hangup(_0x15b2d8,_0x5aae82);this[_0x3cbb('0xcf')](_0x3002b8)[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0x108')));this['moveContactManagedDialer'](_0x3002b8)['catch'](loggerCatch(_0x3cbb('0x109')));}if(_0x15b2d8&&_0x15b2d8[_0x3cbb('0x52')]!=='ivr'&&isNotNull(this['voiceQueues'][_0x15b2d8['queue']][_0x3cbb('0x10a')])){delete this[_0x3cbb('0x27')][_0x5aae82[_0x3cbb('0xdf')]];this[_0x3cbb('0xd3')](this[_0x3cbb('0x20')][_0x15b2d8[_0x3cbb('0xb7')]]);this['voiceQueues'][_0x15b2d8[_0x3cbb('0xb7')]][_0x3cbb('0x64')]+=0x1;this[_0x3cbb('0x20')][_0x15b2d8[_0x3cbb('0xb7')]]['outboundAnswerAgiCallsDay']+=0x1;_0x3002b8=new Hangup(_0x15b2d8,_0x5aae82);_0x3002b8[_0x3cbb('0xab')]=0x10;_0x3002b8['statedesc']=_0x3cbb('0x10b');_0x3002b8[_0x3cbb('0xe8')]=_0x3cbb('0x10c');this['createHistory'](_0x3002b8)['catch'](loggerCatch(_0x3cbb('0x108')));this[_0x3cbb('0xcd')](_0x3002b8)[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0x109')));}if(_0x15b2d8&&_0x15b2d8[_0x3cbb('0x52')]!==_0x3cbb('0x80')&&!isNotNull(this[_0x3cbb('0x20')][_0x15b2d8[_0x3cbb('0xb7')]][_0x3cbb('0x10a')])){delete this[_0x3cbb('0x27')][_0x5aae82[_0x3cbb('0xdf')]];this[_0x3cbb('0xd3')](this[_0x3cbb('0x20')][_0x15b2d8['queue']]);this['voiceQueues'][_0x15b2d8[_0x3cbb('0xb7')]]['outboundUnknownCallsDay']+=0x1;_0x3002b8=new Hangup(_0x15b2d8,_0x5aae82);_0x3002b8['state']=0xc;_0x3002b8[_0x3cbb('0xe6')]=_0x5aae82['cause-txt'];_0x3002b8[_0x3cbb('0xe8')]=_0x3cbb('0x10d');this['createHistory'](_0x3002b8)[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0x108')));this['moveContactManagedDialer'](_0x3002b8)[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0x109')));}};Dialer['prototype']['syncAgentComplete']=function(_0x2524b9){var _0x51688a=this[_0x3cbb('0x27')][_0x2524b9[_0x3cbb('0xdf')]];if(this['voiceQueues'][_0x2524b9['queue']]){if(_0x51688a&&_0x51688a[_0x3cbb('0x52')]!==_0x3cbb('0x80')){delete this[_0x3cbb('0x27')][_0x2524b9['uniqueid']];this['voiceQueues'][_0x2524b9['queue']][_0x3cbb('0x64')]+=0x1;var _0xa1031d=new AgentComplete(_0x51688a,_0x2524b9);if(_0x2524b9[_0x3cbb('0x10e')]===_0x3cbb('0x10f')){_0xa1031d[_0x3cbb('0x110')]=this['voiceQueues'][_0x2524b9[_0x3cbb('0xb7')]]['dialQueueProject2']&&this[_0x3cbb('0x20')][_0x2524b9[_0x3cbb('0xb7')]][_0x3cbb('0x111')]?moment()[_0x3cbb('0x95')](_0x3cbb('0x105')):undefined;}this[_0x3cbb('0xcf')](_0xa1031d)['catch'](loggerCatch(_0x3cbb('0x112')));this[_0x3cbb('0xcd')](_0xa1031d)[_0x3cbb('0xb5')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x3cbb('0xae')][_0x3cbb('0x113')]=function(_0x228ecc){if(this['voiceQueues'][_0x228ecc['queue']]){if(this[_0x3cbb('0x27')][_0x228ecc['uniqueid']]&&this[_0x3cbb('0x27')][_0x228ecc[_0x3cbb('0xdf')]][_0x3cbb('0x52')]!=='ivr'){this[_0x3cbb('0xd3')](this[_0x3cbb('0x20')][_0x228ecc[_0x3cbb('0xb7')]]);this['uniqueId'][_0x228ecc['uniqueid']]['answertime']=moment()['format'](_0x3cbb('0x105'));}}};Dialer[_0x3cbb('0xae')][_0x3cbb('0x114')]=function(_0x30c8f4,_0x14d84c){this[_0x3cbb('0xcf')](_0x30c8f4)[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0x112')));if(_0x14d84c==0x0){this[_0x3cbb('0xcd')](_0x30c8f4)[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0x115')));}};Dialer['prototype'][_0x3cbb('0x2f')]=function(_0x4abc92){var _0x57aa4d=this[_0x3cbb('0x27')][_0x4abc92[_0x3cbb('0xdf')]];var _0x8e858d=this;var _0x2d7eef=![];var _0x294288;var _0x4689b2;if(this['voiceQueues'][_0x4abc92['queue']]){if(_0x57aa4d&&_0x57aa4d[_0x3cbb('0x52')]!==_0x3cbb('0x80')){delete this[_0x3cbb('0x27')][_0x4abc92['uniqueid']];this[_0x3cbb('0xd3')](this[_0x3cbb('0x20')][_0x4abc92[_0x3cbb('0xb7')]]);_0x57aa4d['droptime']=moment()[_0x3cbb('0x95')]('YYYY-MM-DD\x20HH:mm:ss');var _0x37c88a=new QueueCallerAbandon(_0x57aa4d,_0x4abc92);if(getSeconds(_0x57aa4d[_0x3cbb('0x116')],_0x57aa4d[_0x3cbb('0x117')])>=_0x57aa4d[_0x3cbb('0x118')]){this['voiceQueues'][_0x4abc92[_0x3cbb('0xb7')]][_0x3cbb('0x72')]+=0x1;this['voiceQueues'][_0x4abc92[_0x3cbb('0xb7')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x3cbb('0x20')][_0x4abc92[_0x3cbb('0xb7')]][_0x3cbb('0x74')]+=0x1;_0x37c88a['state']=0xa;_0x37c88a[_0x3cbb('0xe6')]=_0x3cbb('0x119');_0x37c88a[_0x3cbb('0x11a')]=_0x3cbb('0x11b');_0x37c88a['agiafterat']=this[_0x3cbb('0x20')][_0x4abc92[_0x3cbb('0xb7')]]['dialQueueProject2']?moment()[_0x3cbb('0x95')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x37c88a[_0x3cbb('0xf4')]+=0x1;_0x37c88a['countglobal']+=0x1;_0x294288=this[_0x3cbb('0x20')][_0x4abc92['queue']][_0x3cbb('0x11c')];_0x4689b2=this['voiceQueues'][_0x4abc92[_0x3cbb('0xb7')]][_0x3cbb('0x11d')];_0x8e858d['verifyAdditionalPhones'](_0x37c88a,_0x37c88a[_0x3cbb('0xab')],_0x57aa4d[_0x3cbb('0x11e')])[_0x3cbb('0xbb')](function(_0x1c710a){_0x2d7eef=_0x1c710a['additional']==0x1;if(_0x37c88a[_0x3cbb('0xf4')]>=_0x8e858d[_0x3cbb('0x20')][_0x4abc92[_0x3cbb('0xb7')]][_0x3cbb('0x11f')]){_0x8e858d['queueCallerAbandonCreateState'](_0x37c88a,_0x1c710a[_0x3cbb('0x120')]);}else{_0x8e858d[_0x3cbb('0xc4')]({'active':![],'countdropretry':_0x37c88a[_0x3cbb('0xf4')],'scheduledat':moment()[_0x3cbb('0x104')](_0x8e858d[_0x3cbb('0x20')][_0x4abc92[_0x3cbb('0xb7')]][_0x3cbb('0x11c')],_0x3cbb('0xfd'))[_0x3cbb('0x95')](_0x3cbb('0x105')),'ContactId':_0x57aa4d[_0x3cbb('0x106')],'ListId':_0x57aa4d[_0x3cbb('0xfe')],'VoiceQueueId':_0x57aa4d[_0x3cbb('0xd8')]||undefined,'CampaignId':_0x57aa4d['CampaignId']||undefined})['catch'](loggerCatch(_0x3cbb('0x121')));var _0x370c1c=new History(_0x37c88a);_0x370c1c[_0x3cbb('0xab')]=0xa;_0x370c1c[_0x3cbb('0xe6')]=_0x3cbb('0x119');_0x370c1c[_0x3cbb('0xad')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x370c1c['endtime']=_0x370c1c[_0x3cbb('0xad')];_0x370c1c[_0x3cbb('0x122')]=_0x37c88a[_0x3cbb('0x122')];_0x370c1c[_0x3cbb('0x123')]=_0x37c88a[_0x3cbb('0x123')];_0x8e858d[_0x3cbb('0xcf')](_0x370c1c)[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0x124')));}})[_0x3cbb('0xbb')](function(){if(_0x2d7eef)_0x8e858d[_0x3cbb('0x125')](_0x37c88a,_0x294288,_0x4689b2)['then'](function(){return 0x1;});});}else{this[_0x3cbb('0x20')][_0x4abc92[_0x3cbb('0xb7')]][_0x3cbb('0x86')]+=0x1;this[_0x3cbb('0x20')][_0x4abc92[_0x3cbb('0xb7')]]['outboundDropCallsDayCallersExit']+=0x1;_0x37c88a[_0x3cbb('0xab')]=0xb;_0x37c88a[_0x3cbb('0xe6')]=_0x3cbb('0x126');_0x37c88a[_0x3cbb('0x11a')]='CALLEREXIT';_0x37c88a[_0x3cbb('0xf5')]+=0x1;_0x37c88a[_0x3cbb('0xf0')]+=0x1;_0x294288=this['voiceQueues'][_0x4abc92[_0x3cbb('0xb7')]][_0x3cbb('0x127')];_0x4689b2=this[_0x3cbb('0x20')][_0x4abc92['queue']][_0x3cbb('0x11d')];_0x8e858d[_0x3cbb('0xbd')](_0x37c88a,_0x37c88a[_0x3cbb('0xab')],_0x57aa4d['voiceQueue'])['then'](function(_0x386e72){if(_0x37c88a[_0x3cbb('0xf5')]>=_0x8e858d['voiceQueues'][_0x4abc92['queue']]['dialAbandonedMaxRetry']){_0x8e858d[_0x3cbb('0x114')](_0x37c88a,_0x386e72[_0x3cbb('0x120')]);}else{_0x8e858d[_0x3cbb('0xc4')]({'active':![],'countabandonedretry':_0x37c88a['countabandonedretry'],'scheduledat':moment()[_0x3cbb('0x104')](_0x8e858d[_0x3cbb('0x20')][_0x4abc92[_0x3cbb('0xb7')]][_0x3cbb('0x127')],_0x3cbb('0xfd'))['format'](_0x3cbb('0x105')),'ContactId':_0x57aa4d[_0x3cbb('0x106')],'ListId':_0x57aa4d['ListId'],'VoiceQueueId':_0x57aa4d[_0x3cbb('0xd8')]||undefined,'CampaignId':_0x57aa4d['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x598687=new History(_0x37c88a);_0x598687[_0x3cbb('0xab')]=0xb;_0x598687[_0x3cbb('0xe6')]=_0x3cbb('0x126');_0x598687[_0x3cbb('0xad')]=moment()['format'](_0x3cbb('0x105'));_0x598687[_0x3cbb('0xac')]=_0x598687[_0x3cbb('0xad')];_0x598687[_0x3cbb('0x122')]=_0x37c88a[_0x3cbb('0x122')];_0x598687[_0x3cbb('0x123')]=_0x37c88a['calleridnum'];_0x8e858d[_0x3cbb('0xcf')](_0x598687)[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0x128')));}})['then'](function(){if(_0x2d7eef)_0x8e858d['swapAdditionalPhones'](_0x37c88a,_0x294288,_0x4689b2)[_0x3cbb('0xbb')](function(){return 0x1;});});}}}};Dialer[_0x3cbb('0xae')][_0x3cbb('0x39')]=function(_0x3aec23){if(this[_0x3cbb('0x25')][_0x3aec23[_0x3cbb('0xdf')]]){this[_0x3cbb('0x25')][_0x3aec23[_0x3cbb('0xdf')]][_0x3cbb('0x129')]=_0x3aec23[_0x3cbb('0x129')];}if(this[_0x3cbb('0x27')][_0x3aec23[_0x3cbb('0xdf')]]){this[_0x3cbb('0x27')][_0x3aec23[_0x3cbb('0xdf')]][_0x3cbb('0x129')]=_0x3aec23[_0x3cbb('0x129')];}};Dialer[_0x3cbb('0xae')][_0x3cbb('0x3d')]=function(_0x3b0863){if(!this[_0x3cbb('0x25')][_0x3b0863[_0x3cbb('0x12a')]]){return;}if(strategy[this[_0x3cbb('0x20')][this['actions'][_0x3b0863[_0x3cbb('0x12a')]][_0x3cbb('0xb7')]]['strategy']]===_0x3cbb('0x1b')){if(this[_0x3cbb('0x25')][_0x3b0863[_0x3cbb('0x12a')]]&&_[_0x3cbb('0xb2')](this[_0x3cbb('0x25')][_0x3b0863['actionid']][_0x3cbb('0x12b')])&&_0x3b0863[_0x3cbb('0xb4')]==='1'&&_0x3b0863[_0x3cbb('0x12c')]==='0'){if(this[_0x3cbb('0x22')][_0x3b0863[_0x3cbb('0x12d')]]){if(!this[_0x3cbb('0x22')][_0x3b0863[_0x3cbb('0x12d')]][_0x3cbb('0x12b')]){this[_0x3cbb('0x22')][_0x3b0863[_0x3cbb('0x12d')]][_0x3cbb('0x12b')]=!![];this[_0x3cbb('0x25')][_0x3b0863[_0x3cbb('0x12a')]][_0x3cbb('0x12b')]=!![];this[_0x3cbb('0x25')][_0x3b0863[_0x3cbb('0x12a')]][_0x3cbb('0x12d')]=_0x3b0863['stateinterface'];}}}}else if((strategy[this[_0x3cbb('0x20')][this[_0x3cbb('0x25')][_0x3b0863[_0x3cbb('0x12a')]][_0x3cbb('0xb7')]][_0x3cbb('0x54')]]||_0x3cbb('0x1a'))===_0x3cbb('0x1a')){if(this['actions'][_0x3b0863[_0x3cbb('0x12a')]]){if(this[_0x3cbb('0x22')][_0x3b0863[_0x3cbb('0x12d')]]){this[_0x3cbb('0x25')][_0x3b0863[_0x3cbb('0x12a')]][_0x3cbb('0x12d')]=_0x3b0863[_0x3cbb('0x12d')];if(_[_0x3cbb('0xb2')](this[_0x3cbb('0x2c')][this[_0x3cbb('0x25')][_0x3b0863[_0x3cbb('0x12a')]][_0x3cbb('0xb7')]])){this[_0x3cbb('0x2c')][this['actions'][_0x3b0863[_0x3cbb('0x12a')]][_0x3cbb('0xb7')]]=[];}this[_0x3cbb('0x2c')][this[_0x3cbb('0x25')][_0x3b0863[_0x3cbb('0x12a')]]['queue']][_0x3cbb('0x12e')](_['merge'](_[_0x3cbb('0xd6')](this[_0x3cbb('0x25')][_0x3b0863[_0x3cbb('0x12a')]],[_0x3cbb('0x12f'),_0x3cbb('0x12d')]),{'status':_0x3b0863[_0x3cbb('0xb4')],'paused':_0x3b0863[_0x3cbb('0x12c')]}));}}}};function unlockQueueStatus(_0xb944c5,_0x460ba4){setTimeout(function(){if(_[_0x3cbb('0x40')](_0xb944c5['queueStatusComplete'])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x460ba4);}_0xb944c5[_0x3cbb('0x130')]=!![];loggerBooked[_0x3cbb('0x83')](_0x3cbb('0x131'),_0x460ba4,JSON[_0x3cbb('0x4d')](_[_0x3cbb('0xd6')](_0xb944c5,['name',_0x3cbb('0x130')])));},0x1f3);}Dialer[_0x3cbb('0xae')][_0x3cbb('0x3f')]=function(_0x18d7b8){if(!this['actions'][_0x18d7b8[_0x3cbb('0x12a')]]){return;}var _0x4206dd=this;var _0x5b072b=_0x4206dd['voiceQueues'][_0x4206dd[_0x3cbb('0x25')][_0x18d7b8[_0x3cbb('0x12a')]][_0x3cbb('0xb7')]];if(strategy[this[_0x3cbb('0x20')][this['actions'][_0x18d7b8[_0x3cbb('0x12a')]]['queue']][_0x3cbb('0x54')]]===_0x3cbb('0x1b')){if(this[_0x3cbb('0x25')][_0x18d7b8[_0x3cbb('0x12a')]]&&this[_0x3cbb('0x25')][_0x18d7b8['actionid']][_0x3cbb('0x12d')]){this[_0x3cbb('0x93')][_0x3cbb('0x132')](this[_0x3cbb('0x25')][_0x18d7b8['actionid']][_0x3cbb('0x12f')],this[_0x3cbb('0x25')][_0x18d7b8[_0x3cbb('0x12a')]][_0x3cbb('0x12d')])['catch'](function(_0x239ec4){logger['error'](_0x3cbb('0x133'),util[_0x3cbb('0x99')](_0x239ec4,{'showHidden':![],'depth':null}));})[_0x3cbb('0x1e')](function(){_0x4206dd['updateOriginated'](_0x4206dd['voiceQueues'][_0x4206dd['actions'][_0x18d7b8[_0x3cbb('0x12a')]][_0x3cbb('0xb7')]]);_0x4206dd[_0x3cbb('0x22')][_0x4206dd[_0x3cbb('0x25')][_0x18d7b8['actionid']]['stateinterface']][_0x3cbb('0x12b')]=![];delete _0x4206dd[_0x3cbb('0x25')][_0x18d7b8[_0x3cbb('0x12a')]];unlockQueueStatus(_0x5b072b);});}else{this[_0x3cbb('0xd3')](this[_0x3cbb('0x20')][this[_0x3cbb('0x25')][_0x18d7b8[_0x3cbb('0x12a')]][_0x3cbb('0xb7')]]);this[_0x3cbb('0xc4')]({'active':![],'ContactId':this[_0x3cbb('0x25')][_0x18d7b8[_0x3cbb('0x12a')]][_0x3cbb('0x106')],'ListId':this[_0x3cbb('0x25')][_0x18d7b8[_0x3cbb('0x12a')]][_0x3cbb('0xfe')],'VoiceQueueId':this[_0x3cbb('0x25')][_0x18d7b8[_0x3cbb('0x12a')]][_0x3cbb('0xd8')]||undefined,'CampaignId':this[_0x3cbb('0x25')][_0x18d7b8[_0x3cbb('0x12a')]][_0x3cbb('0xd9')]||undefined})[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0x134')));delete this['actions'][_0x18d7b8[_0x3cbb('0x12a')]];unlockQueueStatus(_0x5b072b);}}else if((strategy[this[_0x3cbb('0x20')][this[_0x3cbb('0x25')][_0x18d7b8[_0x3cbb('0x12a')]]['queue']]['strategy']]||_0x3cbb('0x1a'))===_0x3cbb('0x1a')){var _0xf41109;if(this[_0x3cbb('0x25')][_0x18d7b8[_0x3cbb('0x12a')]]&&!_[_0x3cbb('0x4b')](this[_0x3cbb('0x2c')][this[_0x3cbb('0x25')][_0x18d7b8[_0x3cbb('0x12a')]]['queue']])){if(this[_0x3cbb('0x135')][_0x4206dd[_0x3cbb('0x25')][_0x18d7b8[_0x3cbb('0x12a')]][_0x3cbb('0xb7')]]){this[_0x3cbb('0x135')][_0x4206dd['actions'][_0x18d7b8[_0x3cbb('0x12a')]][_0x3cbb('0xb7')]]=this['queueBookedRR'][this[_0x3cbb('0x25')][_0x18d7b8[_0x3cbb('0x12a')]][_0x3cbb('0xb7')]]?this['queueBookedRR'][this['actions'][_0x18d7b8[_0x3cbb('0x12a')]][_0x3cbb('0xb7')]]:this['queueBooked'][this[_0x3cbb('0x25')][_0x18d7b8[_0x3cbb('0x12a')]]['queue']]?this[_0x3cbb('0x2c')][this['actions'][_0x18d7b8[_0x3cbb('0x12a')]][_0x3cbb('0xb7')]]['_rr']||0x0:0x0;}this['queueBooked'][this[_0x3cbb('0x25')][_0x18d7b8[_0x3cbb('0x12a')]][_0x3cbb('0xb7')]][_0x3cbb('0x136')]=this[_0x3cbb('0x135')][this['actions'][_0x18d7b8[_0x3cbb('0x12a')]][_0x3cbb('0xb7')]];for(var _0x23d893=0x0;_0x23d893=0x0;})[_0x3cbb('0xb5')](myreject(_0x20a8be)));}}else{_0x1681ac[_0x3cbb('0x12e')](ami[_0x3cbb('0xb3')]({'action':_0x3cbb('0x14b'),'command':util[_0x3cbb('0x95')]('iftime\x20%s,%s',_0x42172d,!_[_0x3cbb('0x40')](config['timezones'][_0x3e6204])?_0x3e6204:'')})[_0x3cbb('0xbb')](function(_0x3b899e){return _0x3b899e[_0x3cbb('0x14f')][_0x3cbb('0x150')]('true')>=0x0;})[_0x3cbb('0xb5')](myreject(_0x20a8be)));}Promise['all'](_0x1681ac)[_0x3cbb('0xbb')](function(_0x3910e5){var _0x39309f=_[_0x3cbb('0x152')](_0x3910e5);if(_0x39309f){return _0x8c8b8c(_0x39309f);}else{_0x51c761[_0x3cbb('0x41')]=_0x22b5af?_0x3cbb('0x153'):'INTERVAL_IS_OVERTIME';return _0x20a8be(msgResponse('[ifTime][promiseAll]','Failure',_0x3cbb('0x154')+_0x22b5af+'\x20'+_0x3b54c1+_0x3cbb('0x155')+util[_0x3cbb('0x99')](_0x42172d,{'showHidden':![],'depth':null})+_0x3cbb('0x156')+_0x3e6204));}})[_0x3cbb('0xb5')](function(_0x206e5b){return _0x20a8be(msgResponse(_0x3cbb('0x145'),_0x3cbb('0x146'),JSON[_0x3cbb('0x4d')](_0x206e5b)));});});};Dialer[_0x3cbb('0xae')]['checkDialMethod']=function(_0x45b497){var _0x3ef026=this;return function(){switch(_0x45b497[_0x3cbb('0x5f')]){case _0x3cbb('0x157'):freeVariablesPredictive(_0x45b497);_0x3ef026[_0x3cbb('0x158')](_0x45b497,0x1);break;case'power':freeVariablesPredictive(_0x45b497);_0x3ef026[_0x3cbb('0x158')](_0x45b497,_0x45b497[_0x3cbb('0x159')]);break;case _0x3cbb('0x9'):_0x3ef026[_0x3cbb('0x9')](_0x45b497);break;case _0x3cbb('0x15a'):freeVariablesPredictive(_0x45b497);_0x3ef026[_0x3cbb('0x158')](_0x45b497,0x1);break;default:freeVariablesPredictive(_0x45b497);logger[_0x3cbb('0x9a')](_0x3cbb('0x15b'),_0x45b497[_0x3cbb('0x43')],_0x3cbb('0x15c'));}};};Dialer[_0x3cbb('0xae')][_0x3cbb('0x15d')]=function(_0x497f8a){return Promise[_0x3cbb('0xba')]()['then'](cmHopper[_0x3cbb('0x15e')](_0x497f8a['id'],previewRecallmeReminderInterval))[_0x3cbb('0xbb')](function(_0x34de79){for(var _0x2422b1=0x0;_0x2422b1<_0x34de79[_0x3cbb('0x9c')];_0x2422b1++){var _0x877aa1=_0x34de79[_0x2422b1][_0x3cbb('0x15f')]['name'];if(_0x877aa1)io['to'](util[_0x3cbb('0x95')](_0x3cbb('0x160'),_0x877aa1))['emit'](_0x3cbb('0x161'),{'hopper':_0x34de79[_0x2422b1]});}})[_0x3cbb('0xb5')](function(){});};Dialer[_0x3cbb('0xae')]['launchHandleIvr']=function(_0x2dbab9){var _0x4fd9e2=this;return function(){_0x4fd9e2[_0x3cbb('0x162')](_0x2dbab9);};};Dialer[_0x3cbb('0xae')][_0x3cbb('0x163')]=function(_0x4a0cfb){var _0x4f02fe=this;if(isNotPreview(_0x4a0cfb['dialMethod'])){if(isVoiceQueueOutbound(_0x4a0cfb[_0x3cbb('0x52')])&&isActive(_0x4a0cfb['dialActive'])){_0x4a0cfb['sendMessageOneNotActive']=!![];Promise[_0x3cbb('0xba')]()[_0x3cbb('0xbb')](checkIsLoggedIn(_0x4a0cfb,_0x4a0cfb[_0x3cbb('0x56')]))[_0x3cbb('0xbb')](checkIsActive(_0x4a0cfb,_0x4a0cfb[_0x3cbb('0x164')]))[_0x3cbb('0xbb')](checkInterval(_0x4a0cfb))[_0x3cbb('0xbb')](_0x4f02fe[_0x3cbb('0x140')](_0x4a0cfb))['then'](_0x4f02fe[_0x3cbb('0x144')](_0x4a0cfb[_0x3cbb('0x165')],_0x4a0cfb[_0x3cbb('0x166')],_0x4a0cfb[_0x3cbb('0x43')],_0x4a0cfb))[_0x3cbb('0xbb')](_0x4f02fe[_0x3cbb('0x167')](_0x4a0cfb['Interval'],_0x4a0cfb[_0x3cbb('0x166')],_0x4a0cfb[_0x3cbb('0x43')],_0x4a0cfb))[_0x3cbb('0xbb')](_0x4f02fe[_0x3cbb('0x168')](_0x4a0cfb))[_0x3cbb('0xb5')](loggerCatchQueueSummary(_0x3cbb('0x169'),_0x4a0cfb));}else{notSendMessagesQueue(_0x4a0cfb);}}else{freeVariablesPredictive(_0x4a0cfb);}};Dialer['prototype'][_0x3cbb('0x35')]=_[_0x3cbb('0x16a')](function(){var _0x516ce3=_[_0x3cbb('0x16b')](this[_0x3cbb('0x20')],function(_0xd97407){return _0xd97407[_0x3cbb('0x16c')];});var _0x28e609=_['filter'](this[_0x3cbb('0x22')],function(_0x235541){return _0x235541[_0x3cbb('0x16d')]&&_0x235541[_0x3cbb('0xb4')]===_0x3cbb('0xdc');});if(_0x516ce3[_0x3cbb('0x9c')]>0x0&&_0x28e609['length']>0x0){return Promise[_0x3cbb('0xba')]()[_0x3cbb('0xbb')](cmHopper[_0x3cbb('0x15e')](_[_0x3cbb('0x16e')](_0x516ce3,'id'),previewRecallmeReminderInterval,_[_0x3cbb('0x16e')](_0x28e609,'id')))[_0x3cbb('0xbb')](function(_0x205f69){for(var _0x5b7531=0x0;_0x5b7531<_0x205f69['length'];_0x5b7531++){var _0x32cf90=_0x205f69[_0x5b7531]['Agent'][_0x3cbb('0x43')];if(_0x32cf90)io['to'](util[_0x3cbb('0x95')](_0x3cbb('0x160'),_0x32cf90))[_0x3cbb('0x51')](_0x3cbb('0x161'),{'hopper':_0x205f69[_0x5b7531]});}})[_0x3cbb('0xb5')](function(_0x437a80){logger[_0x3cbb('0x9a')](_0x3cbb('0x15d'),_0x437a80);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x3cbb('0xae')][_0x3cbb('0x16f')]=function(){var _0x11cbb4=this;var _0x51d979;for(var _0xf28681 in this[_0x3cbb('0x21')]){if(typeof this[_0x3cbb('0x21')][_0xf28681]!==_0x3cbb('0xb1')){_0x51d979=this[_0x3cbb('0x21')][_0xf28681];if(isCampaignIvr(_0x51d979['type'])&&isActive(_0x51d979['active'])){_0x51d979['sendMessageOneNotActive']=!![];Promise[_0x3cbb('0xba')]()['then'](checkIsActive(_0x51d979,_0x51d979[_0x3cbb('0x7d')]))[_0x3cbb('0xbb')](checkInterval(_0x51d979))[_0x3cbb('0xbb')](_0x11cbb4[_0x3cbb('0x140')](_0x51d979))[_0x3cbb('0xbb')](_0x11cbb4['checkIfTime'](_0x51d979['dialGlobalInterval'],_0x51d979[_0x3cbb('0x166')],_0x51d979['name'],_0x51d979))[_0x3cbb('0xbb')](_0x11cbb4[_0x3cbb('0x167')](_0x51d979[_0x3cbb('0x47')],_0x51d979['dialTimezone'],_0x51d979['name'],_0x51d979))[_0x3cbb('0xbb')](_0x11cbb4[_0x3cbb('0x170')](_0x51d979))[_0x3cbb('0xb5')](loggerCatchQueueSummary(_0x3cbb('0x171'),_0x51d979));}else{notSendMessagesCampaign(_0x51d979);}}}};function getCallerIdRandom(_0x249639,_0x19061b){var _0x2cb27f;var _0x47abf3;var _0x4abce0;if(_0x19061b<=0x0){_0x19061b=0x1;}_0x2cb27f=new RegExp(_0x3cbb('0x172')+_0x19061b+'}$');_0x47abf3=Math[_0x3cbb('0x173')](0xa,_0x19061b-0x1);_0x4abce0=Math[_0x3cbb('0x173')](0xa,_0x19061b)-0x1;return util[_0x3cbb('0x95')]('%s',_[_0x3cbb('0x174')](_0x249639,_0x2cb27f,_['random'](_0x47abf3,_0x4abce0)));}function extractCalleridName(_0x4ed1cf){var _0x2dcb4e=_0x4ed1cf[_0x3cbb('0x175')](/"(.*?)"/);return _0x2dcb4e?_0x2dcb4e[0x1]:_0x4ed1cf;}Dialer[_0x3cbb('0xae')][_0x3cbb('0x176')]=function(_0x308f9c,_0x23a24e){var _0x173bb2=this;var _0x2e4335=uuid['v4']();this[_0x3cbb('0x25')][_0x2e4335]=new Action(_0x308f9c,_0x23a24e,_0x2e4335);return new Promise(function(_0x33df20,_0x2f1706){if(_[_0x3cbb('0x40')](_0x308f9c)&&typeof _0x308f9c!==_0x3cbb('0x177')){return _0x2f1706(msgResponse(_0x3cbb('0x178'),_0x3cbb('0x146'),_0x3cbb('0x179')));}if(_['isUndefined'](_0x23a24e[_0x3cbb('0x17a')])||_0x23a24e[_0x3cbb('0x17a')]===null){return _0x2f1706(msgResponse(_0x3cbb('0x178'),_0x3cbb('0x146'),_0x3cbb('0x17b')));}var _0x166ab7={'XMD-CALLERID':_0x173bb2['actions'][_0x2e4335][_0x3cbb('0x17c')](),'XMD-AGI':_0x308f9c[_0x3cbb('0x10a')]?util[_0x3cbb('0x95')](_0x3cbb('0x17d'),ipAgi,_0x308f9c[_0x3cbb('0x10a')]):_0x3cbb('0x17e'),'XMD-AGIAFTER':_0x308f9c[_0x3cbb('0x17f')]?util['format'](_0x3cbb('0x17d'),ipAgi,_0x308f9c[_0x3cbb('0x17f')]):'NONE','XMD-QUEUE':_0x308f9c[_0x3cbb('0x52')]===_0x3cbb('0x53')?util[_0x3cbb('0x95')](_0x3cbb('0x180'),_0x308f9c[_0x3cbb('0x43')],_0x308f9c[_0x3cbb('0x181')]||'',_0x308f9c[_0x3cbb('0x111')]?'c':'',_0x308f9c[_0x3cbb('0x118')]||0x3):_0x3cbb('0x17e'),'XMD-CONTACTID':_0x23a24e['ContactId'],'XMD-CDRTYPE':_0x3cbb('0x182'),'CALLERID(all)':_0x173bb2[_0x3cbb('0x25')][_0x2e4335][_0x3cbb('0x17c')](),'XMD-AMD':_0x308f9c[_0x3cbb('0xe3')]?_0x3cbb('0x183'):_0x3cbb('0x17e'),'XMD-DESTINATION':_0x3cbb('0xe2')};if(_0x308f9c[_0x3cbb('0xe3')]){_0x166ab7[_0x3cbb('0x184')]=_0x308f9c['dialAMDInitialSilence']||0x9c4;_0x166ab7[_0x3cbb('0x185')]=_0x308f9c[_0x3cbb('0x186')]||0x5dc;_0x166ab7[_0x3cbb('0x187')]=_0x308f9c[_0x3cbb('0x188')]||0x320;_0x166ab7[_0x3cbb('0x189')]=_0x308f9c[_0x3cbb('0x18a')]||0x1388;_0x166ab7['XMD-AMDMINWORDLENGTH']=_0x308f9c[_0x3cbb('0x18b')]||0x64;_0x166ab7[_0x3cbb('0x18c')]=_0x308f9c['dialAMDBetweenWordsSilence']||0x32;_0x166ab7[_0x3cbb('0x18d')]=_0x308f9c[_0x3cbb('0x18e')]||0x3;_0x166ab7[_0x3cbb('0x18f')]=_0x308f9c['dialAMDSilenceThreshold']||0x100;_0x166ab7[_0x3cbb('0x190')]=_0x308f9c[_0x3cbb('0x191')]||0x1388;}if(_0x308f9c[_0x3cbb('0x52')]===_0x3cbb('0x53')){_0x166ab7[_0x3cbb('0x192')]=_0x23a24e[_0x3cbb('0xd8')];}else{_0x166ab7['XMD-CAMPAIGNID']=_0x23a24e['CampaignId'];}for(var _0x7bade4 in _0x23a24e[_0x3cbb('0x193')]){if(typeof _0x23a24e[_0x3cbb('0x193')][_0x7bade4]!==_0x3cbb('0xb1')){if(isNotNull(_0x23a24e[_0x3cbb('0x193')][_0x7bade4])&&_0x7bade4!=='id'&&_0x7bade4!==_0x3cbb('0x194')&&_0x7bade4!==_0x3cbb('0x195')&&_0x7bade4!==_0x3cbb('0x196')){_0x166ab7[util[_0x3cbb('0x95')](_0x3cbb('0x197'),_0x3cbb('0x198'),_[_0x3cbb('0x199')](_0x7bade4))]=_0x23a24e[_0x3cbb('0x193')][_0x7bade4];}}}var _0x2e9772=_0x173bb2['isTrunkReachable'](_0x308f9c[_0x3cbb('0x7c')])?getCallerId(_0x308f9c[_0x3cbb('0x7c')]['callerid'],_0x308f9c['dialOriginateCallerIdName'],_0x308f9c[_0x3cbb('0x19a')]>0x0?getCallerIdRandom(_0x308f9c['dialOriginateCallerIdNumber'],_0x308f9c[_0x3cbb('0x19a')]):_0x308f9c[_0x3cbb('0x61')]):getCallerId(_[_0x3cbb('0xb2')](_0x308f9c['TrunkBackup'])?_0x308f9c['Trunk'][_0x3cbb('0x19b')]:_0x308f9c['TrunkBackup'][_0x3cbb('0x19b')],_0x308f9c[_0x3cbb('0x60')],_0x308f9c[_0x3cbb('0x19a')]>0x0?getCallerIdRandom(_0x308f9c[_0x3cbb('0x61')],_0x308f9c[_0x3cbb('0x19a')]):_0x308f9c[_0x3cbb('0x61')]);if(_0x2e9772){_0x166ab7[_0x3cbb('0x19c')]=_0x173bb2[_0x3cbb('0x25')][_0x2e4335]['originatecalleridname']=extractCalleridName(_0x2e9772);_0x166ab7[_0x3cbb('0x19d')]=_0x23a24e[_0x3cbb('0x17a')];}_0x308f9c[_0x3cbb('0x19e')]=_0x166ab7;return ami[_0x3cbb('0xb3')]({'actionid':_0x2e4335,'action':'originate','channel':_0x173bb2[_0x3cbb('0x141')](_0x308f9c[_0x3cbb('0x7c')])?util['format'](_0x3cbb('0x19f'),_0x308f9c['Trunk']['name'],isNotNull(_0x308f9c['dialPrefix'])?_0x308f9c[_0x3cbb('0x62')]['trim']()||'':'',_0x308f9c['dialCutDigit']>0x0?_0x23a24e[_0x3cbb('0x17a')][_0x3cbb('0x1a0')](_0x308f9c[_0x3cbb('0x1a1')]):_0x23a24e[_0x3cbb('0x17a')]):util[_0x3cbb('0x95')](_0x3cbb('0x19f'),_[_0x3cbb('0xb2')](_0x308f9c['TrunkBackup'])?_0x308f9c[_0x3cbb('0x7c')][_0x3cbb('0x43')]:_0x308f9c[_0x3cbb('0x1a2')][_0x3cbb('0x43')],isNotNull(_0x308f9c[_0x3cbb('0x62')])?_0x308f9c[_0x3cbb('0x62')]['trim']()||'':'',_0x308f9c[_0x3cbb('0x1a1')]>0x0?_0x23a24e[_0x3cbb('0x17a')]['substring'](_0x308f9c['dialCutDigit']):_0x23a24e[_0x3cbb('0x17a')]),'callerid':_0x2e9772,'Exten':'xcally-motion-dialer','Context':_0x3cbb('0x1a3'),'Priority':'1','variable':_0x166ab7,'timeout':(_0x308f9c['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x2e4335})[_0x3cbb('0xbb')](function(_0x322e68){return _0x33df20(_0x322e68);})['catch'](function(_0x393bd4){_0x308f9c['outboundOriginateFailureCallsDay']+=0x1;var _0x50926d=new History(_0x173bb2['actions'][_0x2e4335]);logger[_0x3cbb('0x9a')](util[_0x3cbb('0x95')]('[originateError]:\x20%s',JSON[_0x3cbb('0x4d')](_0x393bd4)));_0x50926d['state']=0xe;_0x50926d[_0x3cbb('0xe6')]=_0x3cbb('0x1a4');_0x50926d[_0x3cbb('0xad')]=moment()['format'](_0x3cbb('0x105'));_0x50926d['endtime']=_0x50926d[_0x3cbb('0xad')];_0x173bb2['createHistory'](_0x50926d)[_0x3cbb('0xb5')](loggerCatch('[originate][error]'));_0x173bb2['moveContactManagedDialer'](_0x50926d)[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0x1a5')))[_0x3cbb('0x1e')](function(){delete _0x173bb2[_0x3cbb('0x25')][_0x2e4335];return _0x2f1706(msgResponse(_0x3cbb('0x178'),_0x3cbb('0x1a6'),'originate\x20action\x20Error'));});});});};Dialer['prototype'][_0x3cbb('0x30')]=function(_0x17e96f){var _0x3f8ae6=this[_0x3cbb('0x25')][_0x17e96f[_0x3cbb('0x12a')]];if(_0x3f8ae6){delete this[_0x3cbb('0x25')][_0x17e96f[_0x3cbb('0x12a')]];_0x3f8ae6[_0x3cbb('0x117')]=moment()['format'](_0x3cbb('0x105'));var _0x5f3b0e=_0x3f8ae6['type']==='ivr'?this['campaigns'][_0x3f8ae6[_0x3cbb('0xb7')]]:this[_0x3cbb('0x20')][_0x3f8ae6[_0x3cbb('0x1a7')]()];if(!this[_0x3cbb('0x1a8')](_0x17e96f[_0x3cbb('0x1a9')])){this['updateOriginated'](_0x5f3b0e);return this['callProgressDetecting'](_0x3f8ae6,_0x5f3b0e,_0x17e96f)[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0x1aa')));}this[_0x3cbb('0x27')][_0x17e96f[_0x3cbb('0xdf')]]=_0x3f8ae6;}};Dialer[_0x3cbb('0xae')][_0x3cbb('0x1ab')]=function(_0x35ce34,_0x448d05,_0xb1516c){var _0x2e6469=new History(_0x448d05);if(_0x2e6469['countbusyretry']+_0x2e6469[_0x3cbb('0xf2')]+_0x2e6469[_0x3cbb('0x102')]+_0x2e6469[_0x3cbb('0xf3')]+_0x2e6469['countdropretry']+_0x2e6469['countabandonedretry']+_0x2e6469[_0x3cbb('0xef')]+_0x2e6469[_0x3cbb('0xf6')]>=_0xb1516c[_0x3cbb('0xf7')]-0x1){return!![];}switch(_0x35ce34){case 0x3:if(_0x2e6469[_0x3cbb('0x102')]>=_0xb1516c[_0x3cbb('0x1ac')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x2e6469[_0x3cbb('0x102')]+=0x1,'scheduledat':moment()[_0x3cbb('0x104')](_0xb1516c[_0x3cbb('0x1ad')],_0x3cbb('0xfd'))[_0x3cbb('0x95')](_0x3cbb('0x105')),'ContactId':_0x2e6469[_0x3cbb('0x106')],'ListId':_0x2e6469['ListId'],'VoiceQueueId':_0x2e6469[_0x3cbb('0xd8')]||undefined,'CampaignId':_0x2e6469[_0x3cbb('0xd9')]||undefined})['catch'](loggerCatch(_0x3cbb('0x1ae')));break;case 0x5:if(_0x2e6469[_0x3cbb('0xf1')]>=_0xb1516c[_0x3cbb('0x1af')]-0x1){return!![];}this[_0x3cbb('0xc4')]({'active':![],'countbusyretry':_0x2e6469[_0x3cbb('0xf1')]+=0x1,'scheduledat':moment()[_0x3cbb('0x104')](_0xb1516c[_0x3cbb('0x1b0')],'minutes')[_0x3cbb('0x95')](_0x3cbb('0x105')),'ContactId':_0x2e6469[_0x3cbb('0x106')],'ListId':_0x2e6469[_0x3cbb('0xfe')],'VoiceQueueId':_0x2e6469[_0x3cbb('0xd8')]||undefined,'CampaignId':_0x2e6469['CampaignId']||undefined})[_0x3cbb('0xb5')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x2e6469[_0x3cbb('0xf2')]>=_0xb1516c['dialCongestionMaxRetry']-0x1){return!![];}this[_0x3cbb('0xc4')]({'active':![],'countcongestionretry':_0x2e6469[_0x3cbb('0xf2')]+=0x1,'scheduledat':moment()[_0x3cbb('0x104')](_0xb1516c['dialCongestionRetryFrequency'],'minutes')[_0x3cbb('0x95')](_0x3cbb('0x105')),'ContactId':_0x2e6469[_0x3cbb('0x106')],'ListId':_0x2e6469[_0x3cbb('0xfe')],'VoiceQueueId':_0x2e6469['VoiceQueueId']||undefined,'CampaignId':_0x2e6469[_0x3cbb('0xd9')]||undefined})[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0x1b1')));break;case 0x0:if(_0x2e6469[_0x3cbb('0xf3')]>=_0xb1516c[_0x3cbb('0x1b2')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x2e6469[_0x3cbb('0xf3')]+=0x1,'scheduledat':moment()[_0x3cbb('0x104')](_0xb1516c['dialNoSuchNumberRetryFrequency'],'minutes')[_0x3cbb('0x95')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2e6469[_0x3cbb('0x106')],'ListId':_0x2e6469[_0x3cbb('0xfe')],'VoiceQueueId':_0x2e6469[_0x3cbb('0xd8')]||undefined,'CampaignId':_0x2e6469[_0x3cbb('0xd9')]||undefined})['catch'](loggerCatch(_0x3cbb('0x1b3')));}break;case 0xa:if(_0x2e6469[_0x3cbb('0xf4')]>=_0xb1516c[_0x3cbb('0x11f')]-0x1){return!![];}this[_0x3cbb('0xc4')]({'active':![],'countdropretry':_0x2e6469['countdropretry']+=0x1,'scheduledat':moment()['add'](_0xb1516c[_0x3cbb('0x11c')],_0x3cbb('0xfd'))[_0x3cbb('0x95')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2e6469['ContactId'],'ListId':_0x2e6469['ListId'],'VoiceQueueId':_0x2e6469['VoiceQueueId']||undefined,'CampaignId':_0x2e6469['CampaignId']||undefined})[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0x121')));break;case 0xb:if(_0x2e6469['countabandonedretry']>=_0xb1516c[_0x3cbb('0x1b4')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x2e6469[_0x3cbb('0xf5')]+=0x1,'scheduledat':moment()[_0x3cbb('0x104')](_0xb1516c[_0x3cbb('0x127')],_0x3cbb('0xfd'))[_0x3cbb('0x95')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2e6469['ContactId'],'ListId':_0x2e6469['ListId'],'VoiceQueueId':_0x2e6469[_0x3cbb('0xd8')]||undefined,'CampaignId':_0x2e6469[_0x3cbb('0xd9')]||undefined})['catch'](loggerCatch(_0x3cbb('0x1b5')));break;case 0x13:if(_0x2e6469[_0x3cbb('0xef')]>=_0xb1516c[_0x3cbb('0xfa')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x2e6469[_0x3cbb('0xef')]+=0x1,'scheduledat':moment()[_0x3cbb('0x104')](_0xb1516c[_0x3cbb('0xfc')],_0x3cbb('0xfd'))[_0x3cbb('0x95')](_0x3cbb('0x105')),'ContactId':_0x2e6469[_0x3cbb('0x106')],'ListId':_0x2e6469['ListId'],'VoiceQueueId':_0x2e6469[_0x3cbb('0xd8')]||undefined,'CampaignId':_0x2e6469[_0x3cbb('0xd9')]||undefined})[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0xff')));break;case 0x14:if(_0x2e6469[_0x3cbb('0xf6')]>=_0xb1516c[_0x3cbb('0x1b6')]-0x1){return!![];}this[_0x3cbb('0xc4')]({'active':![],'countagentrejectretry':_0x2e6469[_0x3cbb('0xf6')]+=0x1,'scheduledat':moment()['add'](_0xb1516c[_0x3cbb('0x1b7')],_0x3cbb('0xfd'))['format'](_0x3cbb('0x105')),'ContactId':_0x2e6469[_0x3cbb('0x106')],'ListId':_0x2e6469['ListId'],'VoiceQueueId':_0x2e6469[_0x3cbb('0xd8')]||undefined,'CampaignId':_0x2e6469[_0x3cbb('0xd9')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x3cbb('0xae')][_0x3cbb('0x1b8')]=function(_0x57953c,_0x2f83e4,_0x1568e0){var _0x1baf59=this;var _0x335dc5=new History(_0x57953c);var _0x3138b4=![];var _0xe22b33;var _0x50a719;return new Promise(function(_0x1d19e6,_0x39de74){if(_['isUndefined'](_0x2f83e4)&&typeof _0x2f83e4!==_0x3cbb('0x177')){return _0x39de74(msgResponse('[callProgressDetecting]',_0x3cbb('0x146'),_0x3cbb('0x1b9')));}if(_[_0x3cbb('0x40')](_0x1568e0)&&typeof _0x1568e0!=='object'){return _0x39de74(msgResponse('[callProgressDetecting]',_0x3cbb('0x146'),_0x3cbb('0x1ba')));}_0x1baf59[_0x3cbb('0xbd')](_0x335dc5,_0x1568e0[_0x3cbb('0x10e')],_0x2f83e4)[_0x3cbb('0xbb')](function(_0x53cd70){if(_0x53cd70['additional']==0x1)_0x3138b4=!![];switch(_0x1568e0['reason']){case'0':_0x2f83e4[_0x3cbb('0x6c')]+=0x1;_0x335dc5[_0x3cbb('0xab')]=0x0;_0x335dc5[_0x3cbb('0xe6')]=_0x3cbb('0x1bb');_0x335dc5[_0x3cbb('0xf3')]+=0x1;_0x335dc5[_0x3cbb('0xf0')]+=0x1;ami[_0x3cbb('0x51')](_0x3cbb('0x1bc'),ut['buildObj'](_0x57953c,_0x3cbb('0x1bd')));_0xe22b33=_0x2f83e4[_0x3cbb('0x1be')];_0x50a719=_0x2f83e4[_0x3cbb('0x11d')];_0x1baf59[_0x3cbb('0xcf')](_0x335dc5)['catch'](loggerCatch(_0x3cbb('0x1bf')));if(_0x1baf59[_0x3cbb('0x1ab')](0x0,_0x57953c,_0x2f83e4)&&!_0x3138b4){if(_0x335dc5[_0x3cbb('0xf3')]>=_0x2f83e4[_0x3cbb('0x1b2')]){_0x1baf59[_0x3cbb('0xfb')](_0x335dc5,_0x1d19e6,_0x39de74,'reason\x200\x20no\x20such\x20number....');}else{_0x1baf59[_0x3cbb('0xf8')](_0x335dc5,_0x1d19e6,_0x39de74,_0x3cbb('0x1c0'));}}break;case'3':_0x2f83e4[_0x3cbb('0x6b')]+=0x1;_0x335dc5['state']=0x3;_0x335dc5[_0x3cbb('0xe6')]=_0x3cbb('0x1c1');_0x335dc5[_0x3cbb('0x102')]+=0x1;_0x335dc5[_0x3cbb('0xf0')]+=0x1;var _0x4cc262=ut[_0x3cbb('0x1c2')](_0x57953c,_0x2f83e4);ami['emit'](_0x3cbb('0x1c3'),_0x4cc262);_0xe22b33=_0x2f83e4['dialNoAnswerRetryFrequency'];_0x50a719=_0x2f83e4[_0x3cbb('0x11d')];_0x1baf59[_0x3cbb('0xcf')](_0x335dc5)['catch'](loggerCatch(_0x3cbb('0x1c4')));if(_0x1baf59[_0x3cbb('0x1ab')](0x3,_0x57953c,_0x2f83e4)&&!_0x3138b4){if(_0x335dc5[_0x3cbb('0x102')]>=_0x2f83e4['dialNoAnswerMaxRetry']){_0x1baf59['createStateFinal'](_0x335dc5,_0x1d19e6,_0x39de74,_0x3cbb('0x1c5'));}else{_0x1baf59[_0x3cbb('0xf8')](_0x335dc5,_0x1d19e6,_0x39de74,_0x3cbb('0x1c5'));}}break;case'5':_0x2f83e4[_0x3cbb('0x66')]+=0x1;_0x335dc5[_0x3cbb('0xab')]=0x5;_0x335dc5[_0x3cbb('0xe6')]=_0x3cbb('0x1c6');_0x335dc5[_0x3cbb('0xf1')]+=0x1;_0x335dc5['countglobal']+=0x1;ami[_0x3cbb('0x51')](_0x3cbb('0x1c7'),ut[_0x3cbb('0xea')](_0x57953c,'busy'));_0xe22b33=_0x2f83e4[_0x3cbb('0x1b0')];_0x50a719=_0x2f83e4['callAdditionalPhoneAfterMin'];_0x1baf59['createHistory'](_0x335dc5)[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0x1c8')));if(_0x1baf59[_0x3cbb('0x1ab')](0x5,_0x57953c,_0x2f83e4)&&!_0x3138b4){if(_0x335dc5[_0x3cbb('0xf1')]>=_0x2f83e4[_0x3cbb('0x1af')]){_0x1baf59[_0x3cbb('0xfb')](_0x335dc5,_0x1d19e6,_0x39de74,'reason\x205\x20busy');}else{_0x1baf59[_0x3cbb('0xf8')](_0x335dc5,_0x1d19e6,_0x39de74,'reason\x205\x20busy');}}break;case'8':_0x2f83e4['outboundCongestionCallsDay']+=0x1;_0x335dc5['state']=0x8;_0x335dc5[_0x3cbb('0xe6')]=_0x3cbb('0x1c9');_0x335dc5[_0x3cbb('0xf2')]+=0x1;_0x335dc5[_0x3cbb('0xf0')]+=0x1;_0xe22b33=_0x2f83e4[_0x3cbb('0x1ca')];_0x50a719=_0x2f83e4[_0x3cbb('0x11d')];ami[_0x3cbb('0x51')](_0x3cbb('0x1cb'),ut['buildObj'](_0x57953c,_0x3cbb('0x1cc')));_0x1baf59[_0x3cbb('0xcf')](_0x335dc5)[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0x1cd')));if(_0x1baf59[_0x3cbb('0x1ab')](0x8,_0x57953c,_0x2f83e4)&&!_0x3138b4){if(_0x335dc5['countcongestionretry']>=_0x2f83e4[_0x3cbb('0x1ce')]){_0x1baf59[_0x3cbb('0xfb')](_0x335dc5,_0x1d19e6,_0x39de74,_0x3cbb('0x1cf'));}else{_0x1baf59[_0x3cbb('0xf8')](_0x335dc5,_0x1d19e6,_0x39de74,'reason\x208\x20congestion');}}break;case'11':_0x2f83e4[_0x3cbb('0x1d0')]+=0x1;_0x335dc5[_0x3cbb('0xab')]=0xb;_0x335dc5[_0x3cbb('0xe6')]=_0x3cbb('0x126');_0x335dc5[_0x3cbb('0xf5')]+=0x1;_0x335dc5[_0x3cbb('0xf0')]+=0x1;_0xe22b33=_0x2f83e4['dialAbandonedRetryFrequency'];_0x50a719=_0x2f83e4[_0x3cbb('0x11d')];_0x1baf59[_0x3cbb('0xcf')](_0x335dc5)[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0x128')));if(_0x1baf59[_0x3cbb('0x1ab')](0xb,_0x57953c,_0x2f83e4)&&!_0x3138b4){if(_0x335dc5[_0x3cbb('0xf5')]>=_0x2f83e4['dialAbandonedMaxRetry']){_0x1baf59['createStateFinal'](_0x335dc5,_0x1d19e6,_0x39de74,'reason\x2011\x20abandoned');}else{_0x1baf59[_0x3cbb('0xf8')](_0x335dc5,_0x1d19e6,_0x39de74,'reason\x2011\x20abandoned');}}break;case'20':_0x2f83e4[_0x3cbb('0x1d1')]+=0x1;_0x335dc5[_0x3cbb('0xab')]=0x14;_0x335dc5[_0x3cbb('0xe6')]='AgentReject';_0x335dc5['countagentrejectretry']+=0x1;_0x335dc5[_0x3cbb('0xf0')]+=0x1;_0xe22b33=_0x2f83e4[_0x3cbb('0x1b7')];_0x50a719=_0x2f83e4[_0x3cbb('0x11d')];ami[_0x3cbb('0x51')](_0x3cbb('0x1d2'),ut['buildObj'](_0x57953c,'agentreject'));_0x1baf59['createHistory'](_0x335dc5)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x1baf59[_0x3cbb('0x1ab')](0x14,_0x57953c,_0x2f83e4)&&!_0x3138b4){if(_0x335dc5[_0x3cbb('0xf6')]>=_0x2f83e4['dialAgentRejectMaxRetry']){_0x1baf59[_0x3cbb('0xfb')](_0x335dc5,_0x1d19e6,_0x39de74,_0x3cbb('0x1d3'));}else{_0x1baf59[_0x3cbb('0xf8')](_0x335dc5,_0x1d19e6,_0x39de74,_0x3cbb('0x1d3'));}}break;default:_0x2f83e4[_0x3cbb('0x6e')]+=0x1;_0x335dc5['state']=0xc;_0x335dc5[_0x3cbb('0xe6')]=_0x1568e0[_0x3cbb('0x10e')];_0xe22b33=_0x2f83e4[_0x3cbb('0x1b7')];_0x50a719=_0x2f83e4['callAdditionalPhoneAfterMin'];_0x1baf59[_0x3cbb('0xcf')](_0x335dc5)['catch'](loggerCatch(_0x3cbb('0x1d4')));if(_0x1baf59[_0x3cbb('0x1ab')](_0x1568e0[_0x3cbb('0x10e')],_0x57953c,_0x2f83e4)&&!_0x3138b4){if(_0x335dc5[_0x3cbb('0xf1')]+_0x335dc5['countcongestionretry']+_0x335dc5['countnoanswerretry']+_0x335dc5['countnosuchnumberretry']+_0x335dc5['countdropretry']+_0x335dc5[_0x3cbb('0xf5')]+_0x335dc5[_0x3cbb('0xef')]+_0x335dc5[_0x3cbb('0xf6')]>=_0x2f83e4[_0x3cbb('0xf7')]){_0x1baf59['stateGlobal'](_0x335dc5,_0x1d19e6,_0x39de74,_0x1568e0['reason']);}else{_0x1baf59[_0x3cbb('0xfb')](_0x335dc5,_0x1d19e6,_0x39de74,_0x1568e0['reason']);}}}})[_0x3cbb('0xbb')](function(){if(_0x3138b4){_0x1baf59[_0x3cbb('0x125')](_0x335dc5,_0xe22b33,_0x50a719)['then'](function(){return _0x1d19e6(0x1);});}});});};Dialer[_0x3cbb('0xae')][_0x3cbb('0xf8')]=function(_0x3f64cf,_0x2571b1,_0x28fd48,_0x5ae90a){var _0xd9e620=new Final(_0x3f64cf);_0xd9e620[_0x3cbb('0xab')]=0xf;_0xd9e620[_0x3cbb('0xe6')]=_0x3cbb('0x1d5');this[_0x3cbb('0xfb')](_0xd9e620,_0x2571b1,_0x28fd48,_0x5ae90a);};Dialer[_0x3cbb('0xae')][_0x3cbb('0xfb')]=function(_0x56c4b5,_0x12e5eb,_0x48449d,_0x503ee8){this[_0x3cbb('0xcd')](_0x56c4b5)['then'](function(){return _0x12e5eb(msgResponse('[callProgressDetecting]','Success',_0x503ee8));})['catch'](function(){return _0x48449d(msgResponse(_0x3cbb('0x1d6'),_0x3cbb('0x146'),'contact\x20not\x20moved'));});};Dialer[_0x3cbb('0xae')]['predictive']=function(_0xd1336b){var _0x35fb99=_0xd1336b[_0x3cbb('0x1d7')]/0x64;var _0x689beb=_0xd1336b[_0x3cbb('0x6a')]/(_0xd1336b[_0x3cbb('0x6a')]+_0xd1336b[_0x3cbb('0x64')]);var _0x4e3d3b=Math[_0x3cbb('0x1d8')](_0xd1336b[_0x3cbb('0x76')]*(_0xd1336b[_0x3cbb('0x1d9')]/0x64));var _0x168b28=Math['round'](_0xd1336b['predictiveIntervalAvailable']*(_0xd1336b[_0x3cbb('0x1da')]/0x64));var _0x19a843=_0xd1336b[_0x3cbb('0x55')]+_0xd1336b[_0x3cbb('0x5a')];var _0x42f173=Math[_0x3cbb('0x1db')](_0xd1336b[_0x3cbb('0x8c')]*_0xd1336b[_0x3cbb('0x7a')]*_0xd1336b[_0x3cbb('0x1dc')]*_0xd1336b['predictiveIntervalMultiplicativeFactor']);if(_[_0x3cbb('0x40')](_0xd1336b[_0x3cbb('0x2a')])){if(!_[_0x3cbb('0x40')](_0xd1336b[_0x3cbb('0x29')])){_0xd1336b[_0x3cbb('0x29')]=undefined;loggerPredictive[_0x3cbb('0x9a')]('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0xd1336b['handlePredictive'])){loggerPredictive[_0x3cbb('0x9a')](_0x3cbb('0x1dd'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0xd1336b[_0x3cbb('0x91')]);_0xd1336b[_0x3cbb('0x91')]=undefined;}_0xd1336b[_0x3cbb('0x2a')]=moment()[_0x3cbb('0x95')](_0x3cbb('0x105'));loggerPredictive['info'](_0xd1336b[_0x3cbb('0x43')],'collection\x20data\x20in\x20progressive\x20at',_0xd1336b[_0x3cbb('0x2a')]);this[_0x3cbb('0x158')](_0xd1336b,0x1);}else if(ifInterval(_0xd1336b[_0x3cbb('0x1de')],_0xd1336b['startProgressive'])){this[_0x3cbb('0x158')](_0xd1336b,0x1);loggerPredictiveCalls[_0x3cbb('0x83')]('[startMethodPredictive][StartProgressive][Loop]',_0xd1336b[_0x3cbb('0x2a')],_0xd1336b['name']);_0xd1336b[_0x3cbb('0x8c')]=0x0;_0xd1336b['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x35fb99<_0x689beb&&_0xd1336b['dialPredictiveOptimization']===_0x3cbb('0x1df')){freeVariablesPredictive(_0xd1336b);loggerPredictive[_0x3cbb('0x83')](_0x3cbb('0x1e0'),_0x3cbb('0x1e1'),_0x689beb,_0x3cbb('0x2a'),_0xd1336b[_0x3cbb('0x43')]);}else if(_0x42f173<_0xd1336b[_0x3cbb('0x74')]&&_0xd1336b['dialPredictiveOptimization']===_0x3cbb('0x1df')){freeVariablesPredictive(_0xd1336b);loggerPredictive[_0x3cbb('0x83')](_0x3cbb('0x1e2'),_0x3cbb('0x1e3'),_0x42f173,'Drop\x20in\x20this\x20interval',_0xd1336b[_0x3cbb('0x74')],'startProgressive',_0xd1336b['name']);}else if(!ifInterval(_0xd1336b[_0x3cbb('0x1de')],_0xd1336b['startProgressive'])&&_[_0x3cbb('0x40')](_0xd1336b[_0x3cbb('0x29')])&&!_[_0x3cbb('0x40')](_0xd1336b[_0x3cbb('0x2a')])){_0xd1336b['startPredictive']=moment()[_0x3cbb('0x95')](_0x3cbb('0x105'));loggerPredictive[_0x3cbb('0x83')](_0xd1336b[_0x3cbb('0x43')],'started\x20in\x20predictive\x20at',_0xd1336b['startPredictive']);this['averageHandleTime'](_0xd1336b['dialPredictiveInterval'])[_0x3cbb('0xbb')](this[_0x3cbb('0x1e4')](_0xd1336b))[_0x3cbb('0xbb')](mergeDataErlangB(_0xd1336b))['then'](this[_0x3cbb('0x1e5')](_0xd1336b))['catch'](loggerCatchPredictive(_0x3cbb('0x1e6'),_0xd1336b));}else if(!ifInterval(_0xd1336b[_0x3cbb('0x1de')],_0xd1336b[_0x3cbb('0x29')])){_0xd1336b[_0x3cbb('0x74')]=0x0;_0xd1336b[_0x3cbb('0x29')]=moment()[_0x3cbb('0x95')](_0x3cbb('0x105'));loggerPredictive['info'](_0xd1336b[_0x3cbb('0x43')],_0x3cbb('0x1e7'),_0xd1336b['startPredictive']);clearInterval(_0xd1336b[_0x3cbb('0x91')]);_0xd1336b['handlePredictive']=undefined;this[_0x3cbb('0xc2')](_0xd1336b[_0x3cbb('0x1de')])[_0x3cbb('0xbb')](this[_0x3cbb('0x1e4')](_0xd1336b))[_0x3cbb('0xbb')](mergeDataErlangB(_0xd1336b))[_0x3cbb('0xbb')](this['startMethodPredictive'](_0xd1336b))[_0x3cbb('0xb5')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0xd1336b));}else if(_0xd1336b[_0x3cbb('0x76')]&&_0x19a843<_0xd1336b[_0x3cbb('0x76')]-_0x168b28){freeVariablesPredictive(_0xd1336b);loggerPredictive[_0x3cbb('0x83')](_0xd1336b[_0x3cbb('0x43')],_0x3cbb('0x1e8'),_0x19a843,_0x3cbb('0x1e9'),_0xd1336b[_0x3cbb('0x76')],'-',_0x168b28,'=',_0xd1336b[_0x3cbb('0x76')]-_0x168b28,')');}else if(_0xd1336b['predictiveIntervalAvailable']&&_0x19a843>_0xd1336b[_0x3cbb('0x76')]+_0x4e3d3b){freeVariablesPredictive(_0xd1336b);loggerPredictive['info'](_0xd1336b[_0x3cbb('0x43')],_0x3cbb('0x1e8'),_0x19a843,_0x3cbb('0x1ea'),_0xd1336b[_0x3cbb('0x76')],'+',_0x4e3d3b,'=',_0xd1336b[_0x3cbb('0x76')]+_0x4e3d3b,')');}};Dialer[_0x3cbb('0xae')][_0x3cbb('0x1e4')]=function(_0x5d5b8d){var _0x496e91=this;return function(_0x1e8135){return new Promise(function(_0x7145b8,_0xd47088){_[_0x3cbb('0x8f')](_0x5d5b8d,_0x1e8135[0x0]);if(checkGetDataPredictive(_0x1e8135[0x0])){var _0x4bae5a=_0x5d5b8d[_0x3cbb('0x76')]=_0x5d5b8d[_0x3cbb('0x5a')]+_0x5d5b8d['available'];var _0x175157=_0x5d5b8d[_0x3cbb('0x1de')]*0x3c;var _0x481bec=_0x1e8135[0x0][_0x3cbb('0x71')]+_0x1e8135[0x0][_0x3cbb('0x70')];var _0x5def5a=(_0x1e8135[0x0][_0x3cbb('0x6f')]+_0x1e8135[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1e8135[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1e8135[0x0][_0x3cbb('0x77')];_0x5d5b8d[_0x3cbb('0x1dc')]=_0x5def5a>0x0?_0x5def5a:0x1;switch(_0x5d5b8d[_0x3cbb('0x1eb')]){case'dropRate':var _0x1b0f06=_0x5d5b8d['dialPredictiveOptimizationPercentage']/0x64;return _0x496e91['abandonmentRate'](_0x4bae5a,_0x175157,_0x481bec,_0x5def5a,_0x1b0f06)['then'](function(_0x3fc09e){return _0x7145b8(_0x3fc09e);});case'agentBusyFactor':var _0x51272e=_0x5d5b8d['dialPredictiveOptimizationPercentage']/0x64;return _0x496e91[_0x3cbb('0x1ec')](_0x4bae5a,_0x175157,_0x481bec,_0x5def5a,_0x51272e)['then'](function(_0x307ec1){return _0x7145b8(_0x307ec1);});default:return _0xd47088(msgResponse(_0x3cbb('0x1ed'),_0x3cbb('0x146'),_0x3cbb('0x1ee')));}}else{return _0xd47088(msgResponse('[getDataPredictive]',_0x3cbb('0x146'),_0x3cbb('0x1ef')));}});};};Dialer[_0x3cbb('0xae')][_0x3cbb('0x1f0')]=function(_0x46394b){var _0x4ee31f=this;return function(_0x470a95){return new Promise(function(_0x2eb497,_0x5d1bea){_[_0x3cbb('0x8f')](_0x46394b,_0x470a95[0x0]);if(checkGetDataPredictive(_0x470a95[0x0])){loggerPredictive[_0x3cbb('0x83')](JSON[_0x3cbb('0x4d')](_0x470a95[0x0]));if(_0x46394b[_0x3cbb('0x1eb')]===_0x3cbb('0x1df')){return _0x4ee31f[_0x3cbb('0xcb')](_0x46394b['id'])[_0x3cbb('0xbb')](function(_0x5354c9){var _0x2f47db=_0x46394b['loggedIn']-_0x5354c9[0x0][_0x3cbb('0x1f1')];var _0x1e9989=_0x46394b[_0x3cbb('0x1de')]*0x3c;var _0x29bce6=_0x470a95[0x0][_0x3cbb('0x71')]+_0x470a95[0x0][_0x3cbb('0x70')];var _0x81e681=(_0x470a95[0x0][_0x3cbb('0x6f')]+_0x470a95[0x0][_0x3cbb('0x72')]+_0x470a95[0x0][_0x3cbb('0x86')])/_0x470a95[0x0][_0x3cbb('0x77')];var _0x249c7d=_0x46394b['dialPredictiveOptimizationPercentage']/0x64;_0x46394b[_0x3cbb('0x75')]=_0x5354c9[0x0]['outboundQueuePauses']||0x0;_0x46394b['predictiveIntervalHitRate']=_0x81e681>0x0?_0x81e681:0x1;return _0x4ee31f[_0x3cbb('0x1f2')](_0x2f47db,_0x1e9989,_0x29bce6,_0x81e681,_0x249c7d);})['then'](function(_0x1a6e98){return _0x2eb497(_0x1a6e98);})['catch'](function(_0x49f5bb){return _0x5d1bea(msgResponse(_0x3cbb('0x1f3'),_0x3cbb('0x146'),JSON['stringify'](_0x49f5bb)));});}if(_0x46394b['dialPredictiveOptimization']===_0x3cbb('0x1f4')){return _0x4ee31f['getVoiceQueueRtPauses'](_0x46394b['id'])['then'](function(_0x159e09){var _0x2dcc9a=_0x46394b['loggedIn']-_0x159e09[0x0]['outboundQueuePauses'];var _0x57f54c=_0x46394b['dialPredictiveInterval']*0x3c;var _0x2d0874=_0x470a95[0x0][_0x3cbb('0x71')]+_0x470a95[0x0][_0x3cbb('0x70')];var _0x3883a1=(_0x470a95[0x0][_0x3cbb('0x6f')]+_0x470a95[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x470a95[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x470a95[0x0]['predictiveIntervalTotalCalls'];var _0x4e488b=_0x46394b[_0x3cbb('0x1d7')]/0x64;_0x46394b[_0x3cbb('0x75')]=_0x159e09[0x0][_0x3cbb('0x1f1')]||0x0;_0x46394b[_0x3cbb('0x1dc')]=_0x3883a1>0x0?_0x3883a1:0x1;return _0x4ee31f['busyFactor'](_0x2dcc9a,_0x57f54c,_0x2d0874,_0x3883a1,_0x4e488b);})[_0x3cbb('0xbb')](function(_0x15f791){return _0x2eb497(_0x15f791);})[_0x3cbb('0xb5')](function(_0x2e79b2){return _0x5d1bea(msgResponse(_0x3cbb('0x1f3'),'Failure',JSON[_0x3cbb('0x4d')](_0x2e79b2)));});}}else{return _0x5d1bea(msgResponse(_0x3cbb('0x1ed'),_0x3cbb('0x146'),_0x3cbb('0x1ef')));}});};};Dialer[_0x3cbb('0xae')]['startMethodPredictive']=function(_0x15aec2){var _0x25ac89=this;return function(){var _0x3b2be8=0x0;var _0x1c8806=Math['floor'](_0x15aec2[_0x3cbb('0x79')]*0x3e8);if(_0x1c8806>0x0){_0x1c8806=_0x1c8806<0x64?0x64:_0x1c8806;loggerPredictive['info'](_0x15aec2[_0x3cbb('0x43')],_0x3cbb('0x1f5'),_0x1c8806,_0x3cbb('0x4e'));_0x15aec2[_0x3cbb('0x91')]=setInterval(function(){_0x25ac89[_0x3cbb('0x91')](_0x15aec2);loggerPredictiveCalls[_0x3cbb('0x83')]('[handlePredictive]',_0x3b2be8+=0x1);},_0x1c8806);}else{loggerPredictive[_0x3cbb('0x83')](_0x15aec2[_0x3cbb('0x43')],_0x3cbb('0x1f6'));}};};Dialer['prototype'][_0x3cbb('0x1f7')]=function(_0x43c32f,_0x2aeab8){var _0x5137f7=this;return function(_0x5192a0){if(_['isEmpty'](_0x5192a0)){if(_['isNil'](_0x2aeab8['UserId'])||!_0x2aeab8['recallme']){if(_0x43c32f[_0x3cbb('0x5f')]===_0x3cbb('0x15a')){_0x43c32f[_0x3cbb('0x130')]=_[_0x3cbb('0x40')](_0x43c32f[_0x3cbb('0x130')])?!![]:_0x43c32f['queueStatusComplete'];var _0xb84e4a=uuid['v4']();_0x5137f7[_0x3cbb('0x25')][_0xb84e4a]=new Action(_0x43c32f,_0x2aeab8,_0xb84e4a);loggerBooked['info']('[booked][checkContactBlack]',_0xb84e4a,_0x3cbb('0x1f8'),JSON[_0x3cbb('0x4d')](_0x43c32f['queueStatusComplete']),_0x3cbb('0x1f9'),_0x43c32f[_0x3cbb('0x43')]);if(_0x43c32f['queueStatusComplete']){_0x43c32f[_0x3cbb('0x130')]=![];_0x5137f7[_0x3cbb('0x2c')][_0x5137f7[_0x3cbb('0x25')][_0xb84e4a][_0x3cbb('0xb7')]]=[];ami[_0x3cbb('0xb3')]({'actionid':_0xb84e4a,'action':'queuestatus','queue':_0x43c32f['name']})['catch'](function(){_0x5137f7[_0x3cbb('0xd3')](_0x43c32f);_0x5137f7['rescheduleContact']({'active':![],'ContactId':_0x5137f7[_0x3cbb('0x25')][_0xb84e4a][_0x3cbb('0x106')],'ListId':_0x5137f7['actions'][_0xb84e4a][_0x3cbb('0xfe')],'VoiceQueueId':_0x5137f7['actions'][_0xb84e4a][_0x3cbb('0xd8')]||undefined,'CampaignId':_0x5137f7['actions'][_0xb84e4a]['CampaignId']||undefined})[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0x1fa')));delete _0x5137f7[_0x3cbb('0x25')][_0xb84e4a];});}else{loggerBooked[_0x3cbb('0x83')](_0x3cbb('0x1fb'),JSON[_0x3cbb('0x4d')](_0x43c32f[_0x3cbb('0x130')]),'Queue:\x20',_0x43c32f[_0x3cbb('0x43')]);_0x5137f7[_0x3cbb('0xd3')](_0x43c32f);_0x5137f7[_0x3cbb('0xc4')]({'active':![],'ContactId':_0x5137f7[_0x3cbb('0x25')][_0xb84e4a][_0x3cbb('0x106')],'ListId':_0x5137f7[_0x3cbb('0x25')][_0xb84e4a]['ListId'],'VoiceQueueId':_0x5137f7[_0x3cbb('0x25')][_0xb84e4a]['VoiceQueueId']||undefined,'CampaignId':_0x5137f7[_0x3cbb('0x25')][_0xb84e4a]['CampaignId']||undefined})['catch'](loggerCatch(_0x3cbb('0x1fa')));delete _0x5137f7[_0x3cbb('0x25')][_0xb84e4a];}}else{return _0x5137f7[_0x3cbb('0x176')](_0x43c32f,_0x2aeab8);}}else{if(getDiff(_0x2aeab8['scheduledat'])<_0x43c32f[_0x3cbb('0x1fc')]*0x3c){if(_0x2aeab8[_0x3cbb('0x15f')]&&!_0x2aeab8[_0x3cbb('0x15f')][_0x3cbb('0x1fd')]){_0x5137f7['preview']['run'](_0x2aeab8['id'])[_0x3cbb('0x1e')](function(){_0x5137f7['updateOriginated'](_0x43c32f);});}else{_0x5137f7['unlockContact']({'active':![]},_0x2aeab8['id'],0x1)['finally'](function(){_0x5137f7[_0x3cbb('0xd3')](_0x43c32f);});}}else{_0x43c32f['outboundReCallsDay']+=0x1;_0x5137f7[_0x3cbb('0xd3')](_0x43c32f);if(_0x43c32f[_0x3cbb('0x1fe')]){_0x5137f7[_0x3cbb('0xc4')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2aeab8[_0x3cbb('0x106')],'ListId':_0x2aeab8[_0x3cbb('0xfe')],'VoiceQueueId':_0x2aeab8[_0x3cbb('0xd8')]||undefined,'CampaignId':_0x2aeab8[_0x3cbb('0xd9')]||undefined})['catch'](loggerCatch(_0x3cbb('0x1ff')));_0x5137f7[_0x3cbb('0xcf')](createObjHistory(_0x43c32f,_0x2aeab8,_0x3cbb('0x200'),0x17,_0x3cbb('0x201')))[_0x3cbb('0xb5')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x5137f7['saveInDb'](createObjHistory(_0x43c32f,_0x2aeab8,_0x3cbb('0x202'),0x16,_0x3cbb('0x203')),'[Originate][HistoryRecallClose][historyCatch]',_0x3cbb('0x204'));}}}}else{_0x43c32f[_0x3cbb('0x65')]+=0x1;_0x5137f7[_0x3cbb('0xde')](createObjHistory(_0x43c32f,_0x2aeab8,_0x3cbb('0x205'),0xd,_0x3cbb('0x206')),_0x3cbb('0x207'),_0x3cbb('0x208'));throw _0x3cbb('0x209');}};};Dialer[_0x3cbb('0xae')][_0x3cbb('0x162')]=function(_0x2f48a0){var _0x2f3fde=this;var _0x22e1f8=_0x2f48a0['limitCalls']-_0x2f48a0[_0x3cbb('0x78')]-_0x2f48a0['temp'];emitCampaignSummary(_0x2f48a0);if(_0x22e1f8>0x0){if(_0x22e1f8>this[_0x3cbb('0x24')]){_0x22e1f8=this[_0x3cbb('0x24')];}_0x2f48a0[_0x3cbb('0xc8')]+=_0x22e1f8;this[_0x3cbb('0xca')](_0x2f48a0['id'],_0x22e1f8,_0x2f48a0[_0x3cbb('0x20a')],_0x2f48a0)['then'](function(_0x419b5d){_0x2f48a0[_0x3cbb('0xc8')]-=_0x22e1f8;_0x2f48a0[_0x3cbb('0xc8')]=_0x2f48a0[_0x3cbb('0xc8')]>0x0?_0x2f48a0[_0x3cbb('0xc8')]:0x0;if(!checkContactEmpty(_0x419b5d)){_0x2f48a0['message']='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0x3cbb('0x20b')+_0x2f48a0[_0x3cbb('0x43')]);}else{_0x2f48a0['originated']+=_0x419b5d['length'];_0x2f48a0[_0x3cbb('0x41')]=_0x3cbb('0x20c');for(var _0x588171=0x0;_0x588171<_0x419b5d[_0x3cbb('0x9c')];_0x588171+=0x1){_0x2f48a0[_0x3cbb('0x20d')]+=0x1;if(_[_0x3cbb('0xb2')](_0x419b5d[_0x588171])||_['isNil'](_0x419b5d[_0x588171][_0x3cbb('0x193')])||_[_0x3cbb('0xb2')](_0x419b5d[_0x588171][_0x3cbb('0x17a')])){_0x2f3fde[_0x3cbb('0xd4')](_0x3cbb('0x20e'),_0x2f48a0,_0x419b5d[_0x588171]);}else{_0x2f3fde[_0x3cbb('0xc0')](_['pick'](_0x419b5d[_0x588171],['CampaignId',_0x3cbb('0x17a')]))['then'](_0x2f3fde[_0x3cbb('0x1f7')](_0x2f48a0,_0x419b5d[_0x588171]))['catch'](_0x2f3fde['loggerHandler']('[actionOriginateIvr]\x20',_0x2f48a0));}}}})[_0x3cbb('0xb5')](loggerGetContactDialer('[getContactCampaign2]',_0x2f48a0,_0x22e1f8));}};Dialer['prototype']['handlePower']=function(_0x4bfc21,_0x4462ce){var _0x250ec8=this;var _0x2ce604=[];var _0x25f94f=_0x4462ce>=0x1?_0x4462ce:0x1;if(_0x4bfc21[_0x3cbb('0x5f')]==='booked'){_0x25f94f=0x1;}var _0x1e0094=Math[_0x3cbb('0x1db')](_0x4bfc21['available']*_0x25f94f)-_0x4bfc21[_0x3cbb('0x78')]-_0x4bfc21[_0x3cbb('0xc8')];emitVoiceQueueSummary(_0x4bfc21);if(_0x4bfc21[_0x3cbb('0x20f')]>0x0){var _0x3211f5=_0x4bfc21[_0x3cbb('0x20f')]-_0x4bfc21['originated']-_0x4bfc21[_0x3cbb('0x5a')]-_0x4bfc21[_0x3cbb('0xc8')]-_0x4bfc21[_0x3cbb('0x57')];if(_0x1e0094>_0x3211f5){_0x1e0094=_0x3211f5;}}if(_0x1e0094>0x0){if(_0x4bfc21[_0x3cbb('0x5f')]===_0x3cbb('0x15a')){_0x1e0094=0x1;}if(_0x1e0094>this[_0x3cbb('0x24')]){_0x1e0094=this[_0x3cbb('0x24')];}_0x4bfc21[_0x3cbb('0xc8')]+=_0x1e0094;for(var _0x4caf20 in this[_0x3cbb('0x22')]){if(typeof this['agents'][_0x4caf20]!=='undefined'){if(this[_0x3cbb('0x22')][_0x4caf20][_0x3cbb('0xab')]===_0x3cbb('0x210')&&this['agents'][_0x4caf20][_0x3cbb('0xb4')]===_0x3cbb('0xdc')){_0x2ce604[_0x3cbb('0x12e')](this[_0x3cbb('0x22')][_0x4caf20]['id']);}}}this[_0x3cbb('0xc7')](_0x4bfc21['id'],_0x2ce604,_0x1e0094,_0x4bfc21[_0x3cbb('0x20a')],_0x4bfc21)['then'](function(_0x19c6a7){_0x4bfc21['temp']-=_0x1e0094;_0x4bfc21[_0x3cbb('0xc8')]=_0x4bfc21['temp']>0x0?_0x4bfc21[_0x3cbb('0xc8')]:0x0;if(!checkContactEmpty(_0x19c6a7)){_0x250ec8[_0x3cbb('0xb9')](_0x4bfc21)[_0x3cbb('0xbb')](sendMessageReschedule(_0x4bfc21))[_0x3cbb('0xb5')](loggerCatch(_0x3cbb('0x211')));}else{_0x4bfc21['originated']+=_0x19c6a7[_0x3cbb('0x9c')];_0x4bfc21['message']=_0x4bfc21['dialMethod']===_0x3cbb('0x15a')?_0x3cbb('0x183'):'RUNNING';for(var _0x5c00b3=0x0;_0x5c00b3<_0x19c6a7['length'];_0x5c00b3+=0x1){if(_[_0x3cbb('0xb2')](_0x19c6a7[_0x5c00b3])||_[_0x3cbb('0xb2')](_0x19c6a7[_0x5c00b3]['Contact'])||_[_0x3cbb('0xb2')](_0x19c6a7[_0x5c00b3]['phone'])){_0x250ec8[_0x3cbb('0xd4')](_0x3cbb('0x20e'),_0x4bfc21,_0x19c6a7[_0x5c00b3]);}else{_0x250ec8[_0x3cbb('0xbc')](_[_0x3cbb('0xd6')](_0x19c6a7[_0x5c00b3],['VoiceQueueId',_0x3cbb('0x17a')]))[_0x3cbb('0xbb')](_0x250ec8['checkContactBlack'](_0x4bfc21,_0x19c6a7[_0x5c00b3]))[_0x3cbb('0xb5')](_0x250ec8[_0x3cbb('0xd2')](_0x3cbb('0x20e'),_0x4bfc21));}}}})[_0x3cbb('0xb5')](loggerGetContactDialer(_0x3cbb('0x212'),_0x4bfc21,_0x1e0094));}};Dialer['prototype']['handlePredictive']=function(_0x529d8d){if(_0x529d8d[_0x3cbb('0x20f')]>0x0){var _0x235ba2=_0x529d8d[_0x3cbb('0x20f')]-_0x529d8d['originated']-_0x529d8d[_0x3cbb('0x5a')];if(_0x235ba2>0x0){this[_0x3cbb('0x213')](_0x529d8d);}else{loggerPredictiveCalls[_0x3cbb('0x83')](_0x3cbb('0x214'));}}else{this[_0x3cbb('0x213')](_0x529d8d);}};Dialer[_0x3cbb('0xae')][_0x3cbb('0x213')]=function(_0x18e9fa){var _0x24e393=this;var _0x1dc018=[];_0x18e9fa[_0x3cbb('0x78')]+=0x1;for(var _0x9f89af in this['agents']){if(typeof this['agents'][_0x9f89af]!=='undefined'){if(this[_0x3cbb('0x22')][_0x9f89af][_0x3cbb('0xab')]===_0x3cbb('0x210')&&this['agents'][_0x9f89af]['status']==='reachable'){_0x1dc018[_0x3cbb('0x12e')](this[_0x3cbb('0x22')][_0x9f89af]['id']);}}}this['getContactDialer'](_0x18e9fa['id'],_0x1dc018,0x1,_0x18e9fa[_0x3cbb('0x20a')],_0x18e9fa)[_0x3cbb('0xbb')](function(_0x1621cc){if(!checkContactEmpty(_0x1621cc)){checkContactLowerLimitOriginate(_0x18e9fa,0x1,0x0);_0x24e393[_0x3cbb('0xb9')](_0x18e9fa)['then'](sendMessageReschedule(_0x18e9fa))['catch'](loggerCatch(_0x3cbb('0x211')));}else{_0x18e9fa[_0x3cbb('0x41')]='RUNNING';if(_['isNil'](_0x1621cc[0x0])||_[_0x3cbb('0xb2')](_0x1621cc[0x0][_0x3cbb('0x193')])||_[_0x3cbb('0xb2')](_0x1621cc[0x0][_0x3cbb('0x17a')])){_0x24e393[_0x3cbb('0xd4')](_0x3cbb('0x20e'),_0x18e9fa,_0x1621cc[0x0]);}else{_0x24e393[_0x3cbb('0xbc')](_[_0x3cbb('0xd6')](_0x1621cc[0x0],[_0x3cbb('0xd8'),_0x3cbb('0x17a')]))[_0x3cbb('0xbb')](_0x24e393[_0x3cbb('0x1f7')](_0x18e9fa,_0x1621cc[0x0]))[_0x3cbb('0xb5')](_0x24e393[_0x3cbb('0xd2')]('[actionOriginatePredictive]\x20',_0x18e9fa));}}})[_0x3cbb('0xb5')](loggerGetContactDialer(_0x3cbb('0x215'),_0x18e9fa,0x1));emitVoiceQueueSummary(_0x18e9fa);};Dialer[_0x3cbb('0xae')][_0x3cbb('0x1f2')]=function(_0xf315ff,_0x4eda4c,_0x2b51e9,_0x46b1dd,_0x1d3d91,_0x15217c){loggerPredictive[_0x3cbb('0x83')](_0x3cbb('0x216'));loggerPredictive[_0x3cbb('0x83')](_0x3cbb('0x217'),_0xf315ff);loggerPredictive['info'](_0x3cbb('0x218'),_0x4eda4c);loggerPredictive[_0x3cbb('0x83')](_0x3cbb('0x219'),_0x2b51e9);loggerPredictive[_0x3cbb('0x83')]('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',_0x46b1dd);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1d3d91);loggerPredictive[_0x3cbb('0x83')](_0x3cbb('0x89'));return new Promise(function(_0x2c4629,_0x4f04b5){if(_0xf315ff<=0x0||isNaN(_0xf315ff)){return _0x4f04b5(msgResponse('[abandonmentRate]',_0x3cbb('0x1a6'),_0x3cbb('0x21a')+_0xf315ff));}if(_0x2b51e9<=0x0||isNaN(_0x2b51e9)){return _0x4f04b5(msgResponse(_0x3cbb('0x21b'),_0x3cbb('0x1a6'),_0x3cbb('0x21c')+_0x2b51e9));}if(_0x46b1dd<=0x0||isNaN(_0x46b1dd)){return _0x4f04b5(msgResponse(_0x3cbb('0x21b'),_0x3cbb('0x1a6'),_0x3cbb('0x21d')+_0x46b1dd));}if(_0x4eda4c<=0x0||isNaN(_0x4eda4c)){return _0x4f04b5(msgResponse(_0x3cbb('0x21b'),_0x3cbb('0x1a6'),_0x3cbb('0x21e')+_0x4eda4c));}if(_0x1d3d91<=0x0||isNaN(_0x1d3d91)){return _0x4f04b5(msgResponse(_0x3cbb('0x21b'),_0x3cbb('0x1a6'),'Amax\x20=\x20'+_0x1d3d91));}_0x15217c=_0x15217c||0x0;var _0x4e61ac=0x1/_0x2b51e9;var _0x3da59b=0x0;var _0x3f83c2=0x0;var _0x35f1a5=0x0;var _0x51ee29=0x0;for(var _0x426276=0x0;_0x35f1a5<_0x1d3d91;_0x426276+=0x1){_0x3f83c2=_0x426276/_0x4eda4c;_0x3da59b=(_0x46b1dd*_0x3f83c2+_0x15217c)/_0x4e61ac;_0x35f1a5=erlangb(_0x3da59b,_0xf315ff);_0x51ee29=_0x3da59b/_0xf315ff*(0x1-erlangb(_0x3da59b,_0xf315ff));}return _0x2c4629({'erlangCalls':_0x426276,'erlangCallToSecond':_0x4eda4c/_0x426276,'erlangAbandonmentRate':_0x35f1a5,'erlangBusyFactor':_0x51ee29});});};Dialer['prototype'][_0x3cbb('0x1ec')]=function(_0x48c428,_0x1e9364,_0x420274,_0x22323a,_0x12f19d,_0x43a86b){loggerPredictive['info'](_0x3cbb('0x21f'));loggerPredictive[_0x3cbb('0x83')]('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',_0x48c428);loggerPredictive[_0x3cbb('0x83')](_0x3cbb('0x218'),_0x1e9364);loggerPredictive[_0x3cbb('0x83')](_0x3cbb('0x219'),_0x420274);loggerPredictive['info'](_0x3cbb('0x220'),_0x22323a);loggerPredictive[_0x3cbb('0x83')](_0x3cbb('0x221'),_0x12f19d);loggerPredictive[_0x3cbb('0x83')](_0x3cbb('0x89'));return new Promise(function(_0x4cf6fe,_0x5a4fa6){if(_0x48c428<=0x0||isNaN(_0x48c428)){return _0x5a4fa6(msgResponse(_0x3cbb('0x222'),'Error',_0x3cbb('0x21a')+_0x48c428));}if(_0x420274<=0x0||isNaN(_0x420274)){return _0x5a4fa6(msgResponse(_0x3cbb('0x222'),'Error','Ts\x20=\x20'+_0x420274));}if(_0x22323a<=0x0||isNaN(_0x22323a)){return _0x5a4fa6(msgResponse(_0x3cbb('0x222'),_0x3cbb('0x1a6'),_0x3cbb('0x21d')+_0x22323a));}if(_0x1e9364<=0x0||isNaN(_0x1e9364)){return _0x5a4fa6(msgResponse('[busyFactor]',_0x3cbb('0x1a6'),_0x3cbb('0x21e')+_0x1e9364));}if(_0x12f19d<=0x0||isNaN(_0x12f19d)){return _0x5a4fa6(msgResponse(_0x3cbb('0x222'),_0x3cbb('0x1a6'),_0x3cbb('0x223')+_0x12f19d));}_0x43a86b=_0x43a86b||0x0;var _0x596edf=0x1/_0x420274;var _0x2879ff=0x0;var _0x1b2204=0x0;var _0x55a93b=0x0;var _0x16d196=0x0;for(var _0x1e659a=0x0;_0x16d196<_0x12f19d;_0x1e659a+=0x1){_0x1b2204=_0x1e659a/_0x1e9364;_0x2879ff=(_0x22323a*_0x1b2204+_0x43a86b)/_0x596edf;_0x55a93b=erlangb(_0x2879ff,_0x48c428);_0x16d196=_0x2879ff/_0x48c428*(0x1-erlangb(_0x2879ff,_0x48c428));}return _0x4cf6fe({'erlangCalls':_0x1e659a,'erlangCallToSecond':_0x1e9364/_0x1e659a,'erlangAbandonmentRate':_0x55a93b,'erlangBusyFactor':_0x16d196});});};module[_0x3cbb('0x224')]=Dialer; \ No newline at end of file +var _0x5dd3=['%s%s','XMD-','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','dialCutDigit','substring','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countcongestionretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','dialCongestionRetryFrequency','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','dialAgentRejectRetryFrequency','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','Success','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','startMethodPredictive','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallMeTimeout','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','limitCalls','dialOrderByScheduledAt','[actionOriginate]\x20','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','ACTIVE','RUNNING','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','m\x20=\x20','[abandonmentRate]','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','../ami','redis','defaults','localhost','../rpc/cmHopperHistory','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','roundrobin','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','ivrOriginated','queueBooked','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','Error','milliseconds','seconds','emit','type','outbound','strategy','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','erlangCallToSecond','erlangBusyFactor','startProgressive','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','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','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','merge','diff','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','debug','inspect','error','stack','length','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','pTalking','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','state','statedesc','endtime','starttime','prototype','clearZombieChannels','[uniqueid]','[actions]','undefined','isNil','status','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','updateOriginated','emptyContact','notFound','saveInDb','ContactId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','xcally-motion-dialer','HANGUP','membername','AMD','custom:amd','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','value','MACHINE','Machine','countmachineretry','countglobal','buildObj','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countagentrejectretry','createStateFinal','add','ListId','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','reason','agent','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialQueueProject2','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','CALLEREXIT','dialAbandonedMaxRetry','Abandoned','channel','locked','paused','stateinterface','rrmemory','actionid','push','pick','idHopper','[unlockQueueStatus][undefined]','stringify','queueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','TrunkBackup','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','Action','iftime\x20%s,%s','interval','content','indexOf','true','command','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','progressive','handlePower','dialPowerLevel','predictive','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:dialPreviewRecallReminder','handleIvr','syncQueueSummary','dialMethod','dialActive','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncQueueSummary]','syncQueueSummaryComplete','throttle','filter','online','map','user:%s','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','createdAt','updatedAt'];(function(_0x33c637,_0x597c26){var _0x14aa20=function(_0x32a8b5){while(--_0x32a8b5){_0x33c637['push'](_0x33c637['shift']());}};_0x14aa20(++_0x597c26);}(_0x5dd3,0x95));var _0x35dd=function(_0xe4c712,_0x1e26d5){_0xe4c712=_0xe4c712-0x0;var _0x101962=_0x5dd3[_0xe4c712];return _0x101962;};'use strict';var util=require(_0x35dd('0x0'));var _=require(_0x35dd('0x1'));var uuid=require(_0x35dd('0x2'));var moment=require('moment');var rr=require('rr');var md5=require(_0x35dd('0x3'));var Redis=require(_0x35dd('0x4'));var ut=require(_0x35dd('0x5'));var config=require(_0x35dd('0x6'));var logger=require(_0x35dd('0x7'))(_0x35dd('0x8'));var loggerBooked=require(_0x35dd('0x7'))(_0x35dd('0x9'));var loggerPredictive=require(_0x35dd('0x7'))('predictive');var loggerPredictiveCalls=require(_0x35dd('0x7'))(_0x35dd('0xa'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require(_0x35dd('0xb'));config[_0x35dd('0xc')]=_[_0x35dd('0xd')](config[_0x35dd('0xc')],{'host':_0x35dd('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35dd('0xc')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x35dd('0xf'));var cmHopperAdditionalPhone=require(_0x35dd('0x10'));var cmHopperBlack=require(_0x35dd('0x11'));var voiceQueueRt=require(_0x35dd('0x12'));var RpcSetting=require(_0x35dd('0x13'));var Action=require(_0x35dd('0x14'));var History=require(_0x35dd('0x15'));var Final=require(_0x35dd('0x16'));var AgentComplete=require(_0x35dd('0x17'));var QueueCallerAbandon=require(_0x35dd('0x18'));var Hangup=require(_0x35dd('0x19'));var ipAgi=process[_0x35dd('0x1a')]['XCALLY_IP_AGI']||_0x35dd('0x1b');var strategy={'rrmemory':'rrmemory','roundrobin':_0x35dd('0x1c')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x35dd('0x1d')]=function(_0x4d2ace){this[_0x35dd('0x1e')]=this[_0x35dd('0x1e')]?this[_0x35dd('0x1e')][_0x35dd('0x1f')](_0x4d2ace):_0x4d2ace();};function Dialer(_0x2152fd,_0x59fef7){this[_0x35dd('0x20')]=new Sequence();this[_0x35dd('0x21')]=_0x59fef7;this[_0x35dd('0x22')]=_0x2152fd[_0x35dd('0x22')];this['campaigns']=_0x2152fd[_0x35dd('0x23')];this[_0x35dd('0x24')]=_0x2152fd[_0x35dd('0x24')];this[_0x35dd('0x25')]=_0x2152fd['trunks'];this[_0x35dd('0x26')]=config[_0x35dd('0x26')]||0x2;this[_0x35dd('0x27')]={};this[_0x35dd('0x28')]={};this[_0x35dd('0x29')]={};this[_0x35dd('0x2a')]={};this['optionPredictive']={};this[_0x35dd('0x2b')]={};this['startProgressive']={};this[_0x35dd('0x2c')]={};this[_0x35dd('0x2d')]={};this['queueBookedRR']={};ami['on'](_0x35dd('0x2e'),this['syncAgentConnect'][_0x35dd('0x2f')](this));ami['on'](_0x35dd('0x30'),this[_0x35dd('0x31')][_0x35dd('0x2f')](this));ami['on'](_0x35dd('0x32'),this['syncOriginateResponse'][_0x35dd('0x2f')](this));ami['on'](_0x35dd('0x33'),this[_0x35dd('0x34')][_0x35dd('0x2f')](this));ami['on'](_0x35dd('0x35'),this['syncQueueSummary'][_0x35dd('0x2f')](this));ami['on'](_0x35dd('0x36'),this['syncQueueSummaryComplete'][_0x35dd('0x2f')](this));ami['on']('hangup',this[_0x35dd('0x37')]['bind'](this));ami['on'](_0x35dd('0x38'),this[_0x35dd('0x39')][_0x35dd('0x2f')](this));ami['on'](_0x35dd('0x3a'),this[_0x35dd('0x3b')][_0x35dd('0x2f')](this));ami['on'](_0x35dd('0x3c'),this[_0x35dd('0x3d')][_0x35dd('0x2f')](this));ami['on'](_0x35dd('0x3e'),this['syncQueueStatusComplete'][_0x35dd('0x2f')](this));this[_0x35dd('0x3f')]();this[_0x35dd('0x40')]();RpcSetting[_0x35dd('0x41')]()[_0x35dd('0x42')](function(_0x1d92a4){previewRecallmeReminderInterval=_0x1d92a4[_0x35dd('0x43')];});}function isNotNull(_0x2d375d){return _0x2d375d!==null&&!_[_0x35dd('0x44')](_0x2d375d);}function checkIsLoggedIn(_0x371f41,_0x4089d1){return function(){if(_0x4089d1<=0x0){_0x371f41[_0x35dd('0x45')]=_0x35dd('0x46');throw _0x371f41[_0x35dd('0x47')]+_0x35dd('0x48');}};}function isActive(_0x5813aa){return _0x5813aa;}function checkIsActive(_0x49ebad,_0x2e847e){return function(){if(!isActive(_0x2e847e)){_0x49ebad[_0x35dd('0x45')]=_0x35dd('0x49');throw _0x49ebad['name']+'\x20NOT\x20Active';}};}function checkInterval(_0x5e779d){return function(){if(!isNotNull(_0x5e779d[_0x35dd('0x4a')])){_0x5e779d[_0x35dd('0x45')]=_0x35dd('0x4b');throw _0x5e779d['name']+_0x35dd('0x4c');}if(!isNotNull(_0x5e779d[_0x35dd('0x4a')]['Intervals'])){_0x5e779d['message']=_0x35dd('0x4b');throw _0x5e779d[_0x35dd('0x47')]+_0x35dd('0x4c');}if(!isNotNull(_[_0x35dd('0x4d')](_0x5e779d['Interval'][_0x35dd('0x4e')]))){_0x5e779d['message']=_0x35dd('0x4b');throw _0x5e779d['name']+_0x35dd('0x4c');}};}function msgResponse(_0x185795,_0x21b918,_0x1d5b68){return{'action':_0x185795,'response':_0x21b918,'message':_0x1d5b68,'stack':_0x1d5b68};}function myreject(_0x2cc771){return function(_0x403897){return _0x2cc771(msgResponse(_0x35dd('0x4f'),_0x35dd('0x50'),JSON['stringify'](_0x403897)));};}function getSeconds(_0x1c49d2,_0x30bfca){var _0x56a5ea=moment(_0x1c49d2)[_0x35dd('0x51')](0x0);var _0x44f31c=moment(_0x30bfca)[_0x35dd('0x51')](0x0);return _0x56a5ea['diff'](_0x44f31c,_0x35dd('0x52'));}function emit(_0x501ad6,_0x1847a9,_0x1b156a){io['to'](_0x501ad6)[_0x35dd('0x53')](_0x1847a9,_0x1b156a);}function emitVoiceQueueSummary(_0x227456){if(_0x227456[_0x35dd('0x54')]===_0x35dd('0x55')){var _0x28715f={'id':_0x227456['id'],'name':_0x227456[_0x35dd('0x47')],'strategy':_0x227456[_0x35dd('0x56')],'answered':_0x227456['answered'],'available':_0x227456[_0x35dd('0x57')],'loggedIn':_0x227456[_0x35dd('0x58')],'pTalking':_0x227456['pTalking'],'sumBillable':_0x227456[_0x35dd('0x59')],'sumDuration':_0x227456[_0x35dd('0x5a')],'sumHoldTime':_0x227456[_0x35dd('0x5b')]||0x0,'talking':_0x227456[_0x35dd('0x5c')],'total':_0x227456[_0x35dd('0x5d')],'type':_0x227456['type'],'unmanaged':_0x227456[_0x35dd('0x5e')],'abandoned':_0x227456['abandoned'],'waiting':_0x227456[_0x35dd('0x5f')],'loggedInDb':_0x227456[_0x35dd('0x60')],'dialActive':_0x227456['dialActive'],'dialMethod':_0x227456['dialMethod'],'dialOriginateCallerIdName':_0x227456[_0x35dd('0x61')],'dialOriginateCallerIdNumber':_0x227456['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x227456[_0x35dd('0x62')],'dialPrefix':_0x227456[_0x35dd('0x63')],'outboundAnswerAgiCallsDay':_0x227456[_0x35dd('0x64')],'outboundAnswerCallsDay':_0x227456[_0x35dd('0x65')],'outboundBlacklistCallsDay':_0x227456[_0x35dd('0x66')],'outboundBusyCallsDay':_0x227456[_0x35dd('0x67')],'outboundCongestionCallsDay':_0x227456[_0x35dd('0x68')],'outboundDropCallsDayACS':_0x227456['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x227456['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x227456[_0x35dd('0x69')],'outboundNoAnswerCallsDay':_0x227456[_0x35dd('0x6a')],'outboundNoSuchCallsDay':_0x227456[_0x35dd('0x6b')],'outboundOriginateFailureCallsDay':_0x227456[_0x35dd('0x6c')],'outboundReCallsDay':_0x227456[_0x35dd('0x6d')],'outboundRejectCallsDay':_0x227456[_0x35dd('0x6e')],'outboundUnknownCallsDay':_0x227456[_0x35dd('0x6f')],'predictiveIntervalAnsweredCalls':_0x227456[_0x35dd('0x70')],'predictiveIntervalAvgHoldtime':_0x227456[_0x35dd('0x71')],'predictiveIntervalAvgTalktime':_0x227456[_0x35dd('0x72')],'predictiveIntervalDroppedCallsCallersExit':_0x227456[_0x35dd('0x73')],'predictiveIntervalDroppedCallsTimeout':_0x227456[_0x35dd('0x74')],'predictiveIntervalErlangCalls':_0x227456[_0x35dd('0x75')],'predictiveIntervalErlangCallsDroppedCalls':_0x227456[_0x35dd('0x76')],'predictiveIntervalHitRate':_0x227456[_0x35dd('0x77')],'predictiveIntervalMultiplicativeFactor':_0x227456[_0x35dd('0x78')],'predictiveIntervalPauses':_0x227456[_0x35dd('0x79')],'predictiveIntervalAvailable':_0x227456[_0x35dd('0x7a')],'predictiveIntervalTotalCalls':_0x227456['predictiveIntervalTotalCalls'],'message':_0x227456[_0x35dd('0x45')],'originated':_0x227456['originated'],'erlangCalls':_0x227456['erlangCalls'],'erlangCallToSecond':_0x227456[_0x35dd('0x7b')],'erlangAbandonmentRate':_0x227456['erlangAbandonmentRate'],'erlangBusyFactor':_0x227456[_0x35dd('0x7c')],'startPredictive':_0x227456[_0x35dd('0x2b')],'startProgressive':_0x227456[_0x35dd('0x7d')]};if(_0x227456['Trunk']){_0x28715f[_0x35dd('0x7e')]={'id':_0x227456[_0x35dd('0x7e')]['id'],'name':_0x227456['Trunk'][_0x35dd('0x47')],'active':_0x227456[_0x35dd('0x7e')][_0x35dd('0x7f')],'callerid':_0x227456[_0x35dd('0x7e')][_0x35dd('0x80')]};}if(_0x227456[_0x35dd('0x4a')]){_0x28715f[_0x35dd('0x4a')]={'id':_0x227456['Interval']['id'],'name':_0x227456[_0x35dd('0x4a')][_0x35dd('0x47')]};}var _0x1cdffe=md5(JSON['stringify'](_0x28715f));if(_0x227456[_0x35dd('0x3')]!==_0x1cdffe){_0x227456[_0x35dd('0x3')]=_0x1cdffe;emit(util[_0x35dd('0x81')](_0x35dd('0x82'),_0x28715f[_0x35dd('0x47')]),_0x35dd('0x83'),_0x28715f);}}}function emitCampaignSummary(_0x176a5d){if(_0x176a5d[_0x35dd('0x54')]===_0x35dd('0x84')){emit(util[_0x35dd('0x81')](_0x35dd('0x85'),_0x176a5d[_0x35dd('0x47')]),_0x35dd('0x86'),_0x176a5d);}}function checkGetDataPredictive(_0x1a1dee){if(isNotNull(_0x1a1dee)&&!_[_0x35dd('0x4d')](_0x1a1dee)){loggerPredictive['info'](_0x35dd('0x87'));loggerPredictive['info'](_0x35dd('0x88'),_0x1a1dee[_0x35dd('0x89')]);loggerPredictive[_0x35dd('0x8a')](_0x35dd('0x8b'),_0x1a1dee['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x35dd('0x8c'),_0x1a1dee[_0x35dd('0x74')]);loggerPredictive[_0x35dd('0x8a')](_0x35dd('0x8d'),_0x1a1dee[_0x35dd('0x73')]);loggerPredictive[_0x35dd('0x8a')](_0x35dd('0x8e'),_0x1a1dee[_0x35dd('0x71')]);loggerPredictive[_0x35dd('0x8a')](_0x35dd('0x8f'),_0x1a1dee['predictiveIntervalAvgTalktime']);loggerPredictive['info'](_0x35dd('0x90'));if(_0x1a1dee[_0x35dd('0x89')]>0x0){if(!_[_0x35dd('0x44')](_0x1a1dee[_0x35dd('0x72')])&&_0x1a1dee[_0x35dd('0x72')]>0x0){return!![];}loggerPredictive['info'](_0x35dd('0x91'));if(!_[_0x35dd('0x44')](_0x1a1dee[_0x35dd('0x71')])&&_0x1a1dee['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x35dd('0x8a')](_0x35dd('0x92'));}else{loggerPredictive[_0x35dd('0x8a')](_0x35dd('0x93'));}}else{loggerPredictive[_0x35dd('0x8a')](_0x35dd('0x94'));}return![];}function mergeDataErlangB(_0x2652ec){return function(_0x2857a3){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0x35dd('0x8a')](_0x35dd('0x95'),_0x2857a3[_0x35dd('0x96')]);loggerPredictive[_0x35dd('0x8a')](_0x35dd('0x97'),_0x2857a3[_0x35dd('0x7b')]);loggerPredictive['info'](_0x35dd('0x98'),_0x2857a3[_0x35dd('0x99')]);loggerPredictive[_0x35dd('0x8a')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2857a3[_0x35dd('0x7c')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2857a3['erlangAbandonmentRate']);loggerPredictive[_0x35dd('0x8a')](_0x35dd('0x90'));_[_0x35dd('0x9a')](_0x2652ec,_0x2857a3);};}function getDiff(_0x32407e){var _0x196fc7=moment()['milliseconds'](0x0);var _0x1a9575=moment(_0x32407e)[_0x35dd('0x51')](0x0);return _0x196fc7[_0x35dd('0x9b')](_0x1a9575,_0x35dd('0x52'));}function ifInterval(_0x524e0a,_0x192dab){if(_[_0x35dd('0x44')](_0x192dab)){return![];}return getDiff(_0x192dab)<_0x524e0a*0x3c;}function freeVariablesPredictive(_0x29ceb8){if(isNotNull(_0x29ceb8)){if(!_[_0x35dd('0x44')](_0x29ceb8[_0x35dd('0x7d')])){_0x29ceb8['startProgressive']=undefined;loggerPredictive['info'](_0x29ceb8[_0x35dd('0x47')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x35dd('0x44')](_0x29ceb8['startPredictive'])){_0x29ceb8['startPredictive']=undefined;loggerPredictive[_0x35dd('0x8a')](_0x29ceb8[_0x35dd('0x47')],_0x35dd('0x9c'));}if(!_['isUndefined'](_0x29ceb8[_0x35dd('0x9d')])){clearInterval(_0x29ceb8[_0x35dd('0x9d')]);_0x29ceb8[_0x35dd('0x9d')]=undefined;loggerPredictive['info'](_0x29ceb8[_0x35dd('0x47')],_0x35dd('0x9e'));}}}function erlangb(_0x2ee708,_0x462e6d){if(_0x462e6d===0x0){return 0x0;}var _0x3374f9=0x1;for(var _0x41c2e7=0x1;_0x41c2e7<=_0x462e6d;_0x41c2e7+=0x1){_0x3374f9=0x1+_0x3374f9*_0x41c2e7/_0x2ee708;}return 0x1/_0x3374f9;}function isVoiceQueueOutbound(_0x576113){return _0x576113==='outbound';}function isNotPreview(_0x3221bd){return _0x3221bd!==_0x35dd('0x21');}function isCampaignIvr(_0x347998){return _0x347998===_0x35dd('0x84');}function getCallerId(_0x18314b,_0x3e9c01,_0x5c13a0){if(!_[_0x35dd('0x44')](_0x5c13a0)&&typeof _0x5c13a0===_0x35dd('0x9f')&&!_[_0x35dd('0x4d')](_0x5c13a0)){if(!_[_0x35dd('0x44')](_0x3e9c01)&&typeof _0x3e9c01===_0x35dd('0x9f')&&!_[_0x35dd('0x4d')](_0x3e9c01)){return util[_0x35dd('0x81')](_0x35dd('0xa0'),_0x3e9c01,_0x5c13a0);}return util['format'](_0x35dd('0xa0'),_0x5c13a0,_0x5c13a0);}if(!_[_0x35dd('0x44')](_0x18314b)&&typeof _0x18314b===_0x35dd('0x9f')&&!_[_0x35dd('0x4d')](_0x18314b)){return _0x18314b;}return _0x35dd('0xa1');}function loggerCatchQueueSummary(_0x27f052,_0x53b90a){return function(_0x10db40){freeVariablesPredictive(_0x53b90a);emitVoiceQueueSummary(_0x53b90a);emitCampaignSummary(_0x53b90a);loggerSyncQueueSummary[_0x35dd('0xa2')](_0x27f052,util[_0x35dd('0xa3')](_0x10db40,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x40a02c,_0x41c757){return function(_0x2191b7){loggerPredictive[_0x35dd('0xa4')](_0x41c757[_0x35dd('0x47')],_0x40a02c);loggerPredictive[_0x35dd('0xa4')](_0x2191b7[_0x35dd('0xa5')]);freeVariablesPredictive(_0x41c757);};}function loggerCatch(_0x2f8bba){return function(_0x155653){logger['error'](_0x2f8bba,util['inspect'](_0x155653,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1d7d20){return _0x1d7d20&&!_[_0x35dd('0x44')](_0x1d7d20)&&_0x1d7d20[_0x35dd('0xa6')]>0x0;}function decremetOriginate(_0xc490bf){if(!_[_0x35dd('0x44')](_0xc490bf)&&_0xc490bf!==null){if(typeof _0xc490bf[_0x35dd('0xa7')]!=='undefined'){if(_0xc490bf[_0x35dd('0xa7')]>0x0){_0xc490bf['originated']-=0x1;}else{logger[_0x35dd('0xa4')](_0x35dd('0xa8'));}}}else{logger[_0x35dd('0xa4')](_0x35dd('0xa9'));}}function checkContactLowerLimitOriginate(_0x3ce87a,_0x59a13c,_0x34244c){if(_0x59a13c>_0x34244c){for(var _0x1192b8=0x0;_0x1192b8<_0x59a13c-_0x34244c;_0x1192b8+=0x1){decremetOriginate(_0x3ce87a);}}}function loggerGetContactDialer(_0x2c51e7,_0x4c7ab0,_0x20c74a){return function(_0x471019){checkContactLowerLimitOriginate(_0x4c7ab0,_0x20c74a,0x0);logger[_0x35dd('0xa4')](_0x2c51e7,util[_0x35dd('0xa3')](_0x471019,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x48e6a5){return function(_0x203c4c){if(isNotNull(_0x203c4c)&&isNotNull(_0x203c4c[0x0])){if(_0x203c4c[0x0][_0x35dd('0xaa')]>0x0){_0x48e6a5[_0x35dd('0x45')]=_0x35dd('0xab');logger['info'](_0x35dd('0xac')+_0x48e6a5[_0x35dd('0x47')],_0x203c4c[0x0][_0x35dd('0xaa')],_0x35dd('0xad'));}else{_0x48e6a5[_0x35dd('0x45')]=_0x35dd('0xae');logger[_0x35dd('0x8a')](_0x35dd('0xaf')+_0x48e6a5[_0x35dd('0x47')]);}}};}function notSendMessagesQueue(_0x4722a6){if(_0x4722a6['sendMessageOneNotActive']){freeVariablesPredictive(_0x4722a6);if(_0x4722a6[_0x35dd('0xa7')]===0x0&&_0x4722a6[_0x35dd('0x5c')]===0x0&&_0x4722a6['waiting']===0x0&&(_0x4722a6[_0x35dd('0xb0')]||0x0)===0x0){_0x4722a6[_0x35dd('0xb1')]=![];_0x4722a6['available']=0x0;_0x4722a6['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0x35dd('0xa2')](_0x35dd('0xb2'),_0x4722a6['name'],_0x35dd('0xb3'));}else{_0x4722a6['message']='IS_DISACTIVED';loggerSyncQueueSummary['debug'](_0x35dd('0xb2'),_0x4722a6[_0x35dd('0x47')],_0x35dd('0xb4'));}emitVoiceQueueSummary(_0x4722a6);}}function notSendMessagesCampaign(_0x40972e){if(_0x40972e[_0x35dd('0xb1')]){if(_0x40972e[_0x35dd('0xa7')]===0x0){_0x40972e['sendMessageOneNotActive']=![];_0x40972e['message']=_0x35dd('0x49');loggerSyncQueueSummary[_0x35dd('0xa2')](_0x35dd('0xb5'),_0x40972e['name'],_0x35dd('0xb3'));}else{_0x40972e['message']=_0x35dd('0xb6');loggerSyncQueueSummary['debug'](_0x35dd('0xb5'),_0x40972e[_0x35dd('0x47')],_0x35dd('0xb4'));}emitCampaignSummary(_0x40972e);}}function createObjHistory(_0x1e03f8,_0x20ba4d,_0x591546,_0x59d1de,_0x1670ad){_0x1e03f8[_0x35dd('0x45')]=_0x591546;var _0x3b017f=new Action(_0x1e03f8,_0x20ba4d);var _0x26e42e=new History(_0x3b017f);_0x26e42e[_0x35dd('0xb7')]=_0x59d1de;_0x26e42e[_0x35dd('0xb8')]=_0x1670ad;_0x26e42e[_0x35dd('0xb9')]=_0x3b017f[_0x35dd('0xba')];return _0x26e42e;}Dialer[_0x35dd('0xbb')][_0x35dd('0x40')]=function(){var _0x2e738f=this;setInterval(function(){_0x2e738f[_0x35dd('0xbc')](_0x2e738f['uniqueId'],_0x35dd('0xbd'));_0x2e738f[_0x35dd('0xbc')](_0x2e738f[_0x35dd('0x28')],_0x35dd('0xbe'));},0x32c8);};Dialer[_0x35dd('0xbb')][_0x35dd('0xbc')]=function(_0x238503,_0x21483f){var _0x1e6945=this;for(var _0x10ebce in _0x238503){if(typeof _0x238503[_0x10ebce]!==_0x35dd('0xbf')){this[_0x35dd('0x20')]['enqueue'](function(){if(!_[_0x35dd('0xc0')](_0x238503[_0x10ebce])){return ami['Action']({'action':_0x35dd('0xc1'),'channel':_0x238503[_0x10ebce]['channel']})[_0x35dd('0xc2')](function(_0x36ff25){if(_0x36ff25[_0x35dd('0x45')]===_0x35dd('0xc3')){setTimeout(function(){if(_0x238503[_0x10ebce]&&_0x238503[_0x10ebce][_0x35dd('0x54')]!=='ivr'){_0x1e6945['updateOriginated'](_0x1e6945[_0x35dd('0x22')][_0x238503[_0x10ebce][_0x35dd('0xc4')]]);logger[_0x35dd('0xa4')](_0x35dd('0xc5'),_0x21483f,_0x10ebce,_0x238503[_0x10ebce]['queue']);delete _0x238503[_0x10ebce];}if(_0x238503[_0x10ebce]&&_0x238503[_0x10ebce][_0x35dd('0x54')]==='ivr'){_0x1e6945['updateOriginated'](_0x1e6945['campaigns'][_0x238503[_0x10ebce][_0x35dd('0xc4')]]);logger['error'](_0x35dd('0xc6'),_0x21483f,_0x10ebce,_0x238503[_0x10ebce][_0x35dd('0xc4')]);delete _0x238503[_0x10ebce];}},0x2328);}});}});}}};Dialer['prototype'][_0x35dd('0xc7')]=function(_0x4937eb){return Promise[_0x35dd('0xc8')]()[_0x35dd('0x42')](cmHopper[_0x35dd('0xc7')](_0x4937eb))['catch'](loggerCatch(_0x35dd('0xc9')));};Dialer[_0x35dd('0xbb')][_0x35dd('0xca')]=function(_0x8e42e0){return Promise['resolve']()[_0x35dd('0x42')](cmHopperBlack['checkIsBlackList'](_0x8e42e0))[_0x35dd('0xc2')](loggerCatch(_0x35dd('0xcb')));};Dialer['prototype'][_0x35dd('0xcc')]=function(_0xc90664,_0x3ed1cd,_0x175da0){return Promise['resolve']()[_0x35dd('0x42')](cmHopperAdditionalPhone[_0x35dd('0xcc')](_0xc90664,_0x3ed1cd,_0x175da0))[_0x35dd('0xc2')](loggerCatch(_0x35dd('0xcd')));};Dialer[_0x35dd('0xbb')]['swapAdditionalPhones']=function(_0x3e3d06,_0x5ec211,_0x4fbcd9){return Promise['resolve']()[_0x35dd('0x42')](cmHopperAdditionalPhone['swapAdditionalPhones'](_0x3e3d06,_0x5ec211,_0x4fbcd9))[_0x35dd('0xc2')](loggerCatch(_0x35dd('0xce')));};Dialer[_0x35dd('0xbb')][_0x35dd('0xcf')]=function(_0x49f095){return Promise['resolve']()[_0x35dd('0x42')](cmHopperBlack[_0x35dd('0xcf')](_0x49f095))[_0x35dd('0xc2')](loggerCatch(_0x35dd('0xd0')));};Dialer['prototype'][_0x35dd('0xd1')]=function(_0x3ffbc4){return Promise['resolve']()[_0x35dd('0x42')](cmHopperHistory['avgHandleTime'](_0x3ffbc4))[_0x35dd('0xc2')](loggerCatch(_0x35dd('0xd2')));};Dialer[_0x35dd('0xbb')][_0x35dd('0xd3')]=function(_0x4af330){return Promise['resolve']()['then'](cmHopper[_0x35dd('0xd3')](_0x4af330))[_0x35dd('0xc2')](loggerCatch(_0x35dd('0xd4')));};Dialer[_0x35dd('0xbb')]['unlockContact']=function(_0x4c83fc,_0x2de7f4,_0x1a7b57){return Promise[_0x35dd('0xc8')]()[_0x35dd('0x42')](cmHopper[_0x35dd('0xd5')](_0x4c83fc,_0x2de7f4,_0x1a7b57))['catch'](loggerCatch(_0x35dd('0xd6')));};Dialer[_0x35dd('0xbb')]['getContactDialer']=function(_0x1aa4b3,_0x147ed3,_0x565957,_0x5712ab,_0x557eb0){return Promise[_0x35dd('0xc8')]()[_0x35dd('0x42')](cmHopper['getContactDialer'](_0x1aa4b3,_0x147ed3,_0x565957,_0x5712ab))[_0x35dd('0xc2')](function(_0x4dd6bd){_0x557eb0[_0x35dd('0xd7')]-=_0x565957;_0x557eb0[_0x35dd('0xd7')]=_0x557eb0[_0x35dd('0xd7')]>0x0?_0x557eb0[_0x35dd('0xd7')]:0x0;loggerCatch(_0x35dd('0xd8'))(_0x4dd6bd);});};Dialer[_0x35dd('0xbb')][_0x35dd('0xd9')]=function(_0x45a53a,_0x5da2e8,_0x2b6b70,_0x33e302){return Promise[_0x35dd('0xc8')]()['then'](cmHopper[_0x35dd('0xd9')](_0x45a53a,_0x5da2e8,_0x2b6b70))[_0x35dd('0xc2')](function(_0x3542ee){_0x33e302[_0x35dd('0xd7')]-=_0x5da2e8;_0x33e302[_0x35dd('0xd7')]=_0x33e302[_0x35dd('0xd7')]>0x0?_0x33e302[_0x35dd('0xd7')]:0x0;loggerCatch(_0x35dd('0xda'))(_0x3542ee);});};Dialer[_0x35dd('0xbb')][_0x35dd('0xdb')]=function(_0x319605){return Promise['resolve']()['then'](voiceQueueRt[_0x35dd('0xdb')](_0x319605))[_0x35dd('0xc2')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x35dd('0xbb')][_0x35dd('0xdc')]=function(_0x4d1cb1){return Promise[_0x35dd('0xc8')]()[_0x35dd('0x42')](cmHopper[_0x35dd('0xdc')](_0x4d1cb1))[_0x35dd('0xc2')](loggerCatch(_0x35dd('0xdd')));};Dialer[_0x35dd('0xbb')][_0x35dd('0xde')]=function(_0x4778f1){return Promise[_0x35dd('0xc8')]()[_0x35dd('0x42')](cmHopperHistory[_0x35dd('0xde')](_0x4778f1))[_0x35dd('0xc2')](loggerCatch(_0x35dd('0xdf')));};Dialer[_0x35dd('0xbb')]['updateOriginated']=function(_0x1972ac){if(!_['isUndefined'](_0x1972ac)&&_0x1972ac!==null){if(typeof _0x1972ac[_0x35dd('0xa7')]!==_0x35dd('0xbf')){if(_0x1972ac[_0x35dd('0xa7')]>0x0){_0x1972ac[_0x35dd('0xa7')]-=0x1;}else{logger[_0x35dd('0xa4')](_0x35dd('0xe0'));}}}else{logger[_0x35dd('0xa4')](_0x35dd('0xe1'));}};Dialer[_0x35dd('0xbb')][_0x35dd('0xe2')]=function(_0x2aede5,_0xfb5b59){var _0x11fcb6=this;return function(_0x3dde74){_0x11fcb6[_0x35dd('0xe3')](_0xfb5b59);logger[_0x35dd('0xa4')](_0x2aede5,util[_0x35dd('0xa3')](_0x3dde74,{'showHidden':![],'depth':null}));};};Dialer[_0x35dd('0xbb')][_0x35dd('0xe4')]=function(_0x548f0a,_0x39e1a1,_0x1d9ff2){var _0x26a1b0={'state':0x19,'statedesc':_0x35dd('0xe5')};this['updateOriginated'](_0x39e1a1);this[_0x35dd('0xe6')](_[_0x35dd('0x9a')](_0x26a1b0,_['pick'](_0x1d9ff2,[_0x35dd('0xe7'),'ListId',_0x35dd('0xe8'),'VoiceQueueId',_0x35dd('0xe9')])),_0x35dd('0xea'),_0x35dd('0xeb'));logger['error'](_0x548f0a);};Dialer[_0x35dd('0xbb')][_0x35dd('0xec')]=function(_0x129222){return _0x129222==='Success';};Dialer[_0x35dd('0xbb')][_0x35dd('0xed')]=function(_0x412916){return!_['isUndefined'](_0x412916)&&_0x412916&&!_['isUndefined'](_0x412916[_0x35dd('0x47')])&&!_[_0x35dd('0x44')](_0x412916[_0x35dd('0x7f')])&&_0x412916[_0x35dd('0x7f')]&&(this[_0x35dd('0x25')][util[_0x35dd('0x81')](_0x35dd('0xee'),_0x412916[_0x35dd('0x47')])]['status']===_0x35dd('0xef')||this['trunks'][util[_0x35dd('0x81')](_0x35dd('0xee'),_0x412916[_0x35dd('0x47')])][_0x35dd('0xc1')]===_0x35dd('0xf0'));};Dialer[_0x35dd('0xbb')][_0x35dd('0xe6')]=function(_0x137470,_0x4be3fc,_0x184751){this[_0x35dd('0xde')](_0x137470)[_0x35dd('0xc2')](loggerCatch(_0x4be3fc));this[_0x35dd('0xdc')](_0x137470)['catch'](loggerCatch(_0x184751));};Dialer[_0x35dd('0xbb')][_0x35dd('0x3b')]=function(_0x2c1ad1){var _0x58da35=this;var _0x118cac=this['uniqueId'][_0x2c1ad1[_0x35dd('0xf1')]];var _0x5ba2f5;if(!_['isNil'](_0x2c1ad1)&&!_['isNil'](_0x2c1ad1[_0x35dd('0xf2')])&&!_[_0x35dd('0xc0')](_0x2c1ad1['variable'][_0x35dd('0xf3')])&&_0x2c1ad1['exten']===_0x35dd('0xf4')&&_0x118cac){if(_0x118cac[_0x35dd('0x54')]!==_0x35dd('0x84')&&this[_0x35dd('0x22')][_0x118cac['queue']]['dialAMDActive']&&_0x2c1ad1['value']===_0x35dd('0xf5')){delete this[_0x35dd('0x2a')][_0x2c1ad1[_0x35dd('0xf1')]];this[_0x35dd('0xe3')](this[_0x35dd('0x22')][_0x118cac[_0x35dd('0xc4')]]);this[_0x35dd('0x22')][_0x118cac[_0x35dd('0xc4')]][_0x35dd('0x65')]+=0x1;this[_0x35dd('0x22')][_0x118cac[_0x35dd('0xc4')]][_0x35dd('0x64')]+=0x1;_0x5ba2f5=new Hangup(_0x118cac,_0x2c1ad1);_0x5ba2f5['state']=0x12;_0x5ba2f5['statedesc']='HangupInAMD';_0x5ba2f5[_0x35dd('0xf6')]=_0x35dd('0xf7');ami[_0x35dd('0x53')](_0x35dd('0xf8'),ut['buildObj'](_0x5ba2f5,_0x35dd('0xf9')));this[_0x35dd('0xe6')](_0x5ba2f5,_0x35dd('0xfa'),_0x35dd('0xfb'));}if(_0x118cac[_0x35dd('0x54')]!=='ivr'&&this['voiceQueues'][_0x118cac['queue']][_0x35dd('0xfc')]&&_0x2c1ad1[_0x35dd('0xfd')]===_0x35dd('0xfe')){return new Promise(function(_0x12e6ac,_0x399960){delete _0x58da35[_0x35dd('0x2a')][_0x2c1ad1[_0x35dd('0xf1')]];_0x58da35[_0x35dd('0xe3')](_0x58da35['voiceQueues'][_0x118cac[_0x35dd('0xc4')]]);_0x58da35[_0x35dd('0x22')][_0x118cac[_0x35dd('0xc4')]]['outboundAnswerCallsDay']+=0x1;_0x58da35[_0x35dd('0x22')][_0x118cac['queue']][_0x35dd('0x64')]+=0x1;var _0x1f9140=_0x58da35[_0x35dd('0x22')][_0x118cac['queue']];var _0xac1a45=new Hangup(_0x118cac,_0x2c1ad1);_0xac1a45[_0x35dd('0xb7')]=0x13;_0xac1a45[_0x35dd('0xb8')]=_0x35dd('0xff');_0xac1a45[_0x35dd('0xf6')]=_0x35dd('0xf7');_0xac1a45[_0x35dd('0x100')]+=0x1;_0xac1a45[_0x35dd('0x101')]+=0x1;_0xac1a45['amd']=!![];ami['emit']('custom:amd',ut[_0x35dd('0x102')](_0xac1a45,_0x35dd('0xf9')));_0x58da35[_0x35dd('0xde')](_0xac1a45)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0xac1a45[_0x35dd('0x103')]+_0xac1a45['countcongestionretry']+_0xac1a45[_0x35dd('0x104')]+_0xac1a45[_0x35dd('0x105')]+_0xac1a45[_0x35dd('0x106')]+_0xac1a45[_0x35dd('0x107')]+_0xac1a45['countmachineretry']+_0xac1a45['countagentrejectretry']>=_0x1f9140[_0x35dd('0x108')]){_0x58da35[_0x35dd('0x109')](_0xac1a45,_0x12e6ac,_0x399960,_0x35dd('0x10a'));}else{if(_0xac1a45[_0x35dd('0x100')]>=_0x1f9140[_0x35dd('0x10b')]){_0x58da35['createStateFinal'](_0xac1a45,_0x12e6ac,_0x399960,_0x35dd('0x10c'));}else{_0x58da35[_0x35dd('0xd3')]({'active':![],'countmachineretry':_0xac1a45[_0x35dd('0x100')],'scheduledat':moment()['add'](_0x1f9140[_0x35dd('0x10d')],_0x35dd('0x10e'))['format'](_0x35dd('0x10f')),'ContactId':_0xac1a45[_0x35dd('0xe7')],'ListId':_0xac1a45['ListId'],'VoiceQueueId':_0xac1a45[_0x35dd('0x110')]||undefined,'CampaignId':_0xac1a45[_0x35dd('0xe9')]||undefined})[_0x35dd('0xc2')](loggerCatch('[rescheduleContact][Machine]'));_0x12e6ac({'reschedule':0x1});}}});}if(_0x118cac[_0x35dd('0x54')]===_0x35dd('0x84')&&this[_0x35dd('0x23')][_0x118cac[_0x35dd('0xc4')]][_0x35dd('0xfc')]&&_0x2c1ad1[_0x35dd('0xfd')]===_0x35dd('0xf5')){delete this['uniqueId'][_0x2c1ad1[_0x35dd('0xf1')]];this[_0x35dd('0xe3')](this[_0x35dd('0x23')][_0x118cac[_0x35dd('0xc4')]]);_0x5ba2f5=new Hangup(_0x118cac,_0x2c1ad1);_0x5ba2f5['state']=0x12;_0x5ba2f5[_0x35dd('0xb8')]='HangupInAMD';_0x5ba2f5[_0x35dd('0xf6')]='AMD';ami[_0x35dd('0x53')](_0x35dd('0xf8'),ut[_0x35dd('0x102')](_0x5ba2f5,'amd'));this[_0x35dd('0xe6')](_0x5ba2f5,_0x35dd('0x111'),_0x35dd('0x112'));}if(_0x118cac['type']===_0x35dd('0x84')&&this[_0x35dd('0x23')][_0x118cac['queue']][_0x35dd('0xfc')]&&_0x2c1ad1[_0x35dd('0xfd')]==='MACHINE'){return new Promise(function(_0x2f8c57,_0x383d29){delete _0x58da35[_0x35dd('0x2a')][_0x2c1ad1[_0x35dd('0xf1')]];_0x58da35[_0x35dd('0xe3')](_0x58da35[_0x35dd('0x23')][_0x118cac[_0x35dd('0xc4')]]);_0x58da35[_0x35dd('0x23')][_0x118cac['queue']][_0x35dd('0x65')]+=0x1;_0x58da35['campaigns'][_0x118cac[_0x35dd('0xc4')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x207b0a=_0x58da35[_0x35dd('0x23')][_0x118cac['queue']];var _0x33542a=new Hangup(_0x118cac,_0x2c1ad1);_0x33542a[_0x35dd('0xb7')]=0x13;_0x33542a[_0x35dd('0xb8')]=_0x35dd('0xff');_0x33542a[_0x35dd('0xf6')]=_0x35dd('0xf7');_0x33542a['countmachineretry']+=0x1;_0x33542a[_0x35dd('0x101')]+=0x1;_0x33542a[_0x35dd('0xf9')]=!![];ami[_0x35dd('0x53')]('custom:amd',ut[_0x35dd('0x102')](_0x33542a,'amd'));_0x58da35[_0x35dd('0xde')](_0x33542a)['catch'](loggerCatch(_0x35dd('0x113')));if(_0x33542a[_0x35dd('0x103')]+_0x33542a['countcongestionretry']+_0x33542a[_0x35dd('0x104')]+_0x33542a[_0x35dd('0x105')]+_0x33542a[_0x35dd('0x106')]+_0x33542a[_0x35dd('0x107')]+_0x33542a[_0x35dd('0x100')]+_0x33542a[_0x35dd('0x114')]>=_0x207b0a['dialGlobalMaxRetry']){_0x58da35['stateGlobal'](_0x33542a,_0x2f8c57,_0x383d29,_0x35dd('0x10a'));}else{if(_0x33542a[_0x35dd('0x100')]>=_0x207b0a[_0x35dd('0x10b')]){_0x58da35[_0x35dd('0x115')](_0x33542a,_0x2f8c57,_0x383d29,_0x35dd('0x10c'));}else{_0x58da35['rescheduleContact']({'active':![],'countmachineretry':_0x33542a[_0x35dd('0x100')],'scheduledat':moment()[_0x35dd('0x116')](_0x207b0a['dialMachineRetryFrequency'],_0x35dd('0x10e'))[_0x35dd('0x81')](_0x35dd('0x10f')),'ContactId':_0x33542a[_0x35dd('0xe7')],'ListId':_0x33542a[_0x35dd('0x117')],'VoiceQueueId':_0x33542a[_0x35dd('0x110')]||undefined,'CampaignId':_0x33542a['CampaignId']||undefined})['catch'](loggerCatch(_0x35dd('0x118')));_0x2f8c57({'reschedule':0x1});}}});}}};Dialer[_0x35dd('0xbb')]['syncHangup']=function(_0xbd596c){var _0x2ef3fd=this[_0x35dd('0x2a')][_0xbd596c[_0x35dd('0xf1')]];var _0xdcf1f5;if(_0x2ef3fd&&_0x2ef3fd[_0x35dd('0x54')]===_0x35dd('0x84')){delete this[_0x35dd('0x2a')][_0xbd596c[_0x35dd('0xf1')]];this[_0x35dd('0xe3')](this[_0x35dd('0x23')][_0x2ef3fd['queue']]);this['campaigns'][_0x2ef3fd['queue']][_0x35dd('0x119')]+=0x1;_0xdcf1f5=new Hangup(_0x2ef3fd,_0xbd596c);this[_0x35dd('0xde')](_0xdcf1f5)[_0x35dd('0xc2')](loggerCatch(_0x35dd('0x11a')));this[_0x35dd('0xdc')](_0xdcf1f5)['catch'](loggerCatch(_0x35dd('0x11b')));}if(_0x2ef3fd&&_0x2ef3fd[_0x35dd('0x54')]!==_0x35dd('0x84')&&isNotNull(this[_0x35dd('0x22')][_0x2ef3fd[_0x35dd('0xc4')]][_0x35dd('0x11c')])){delete this[_0x35dd('0x2a')][_0xbd596c[_0x35dd('0xf1')]];this[_0x35dd('0xe3')](this[_0x35dd('0x22')][_0x2ef3fd[_0x35dd('0xc4')]]);this['voiceQueues'][_0x2ef3fd['queue']][_0x35dd('0x65')]+=0x1;this[_0x35dd('0x22')][_0x2ef3fd[_0x35dd('0xc4')]][_0x35dd('0x64')]+=0x1;_0xdcf1f5=new Hangup(_0x2ef3fd,_0xbd596c);_0xdcf1f5['state']=0x10;_0xdcf1f5[_0x35dd('0xb8')]=_0x35dd('0x11d');_0xdcf1f5[_0x35dd('0xf6')]=_0x35dd('0x11e');this[_0x35dd('0xde')](_0xdcf1f5)[_0x35dd('0xc2')](loggerCatch(_0x35dd('0x11a')));this['moveContactManagedDialer'](_0xdcf1f5)[_0x35dd('0xc2')](loggerCatch(_0x35dd('0x11b')));}if(_0x2ef3fd&&_0x2ef3fd['type']!==_0x35dd('0x84')&&!isNotNull(this['voiceQueues'][_0x2ef3fd[_0x35dd('0xc4')]]['dialQueueProject'])){delete this[_0x35dd('0x2a')][_0xbd596c['uniqueid']];this[_0x35dd('0xe3')](this[_0x35dd('0x22')][_0x2ef3fd[_0x35dd('0xc4')]]);this[_0x35dd('0x22')][_0x2ef3fd[_0x35dd('0xc4')]]['outboundUnknownCallsDay']+=0x1;_0xdcf1f5=new Hangup(_0x2ef3fd,_0xbd596c);_0xdcf1f5[_0x35dd('0xb7')]=0xc;_0xdcf1f5['statedesc']=_0xbd596c[_0x35dd('0x11f')];_0xdcf1f5[_0x35dd('0xf6')]='Unknow';this[_0x35dd('0xde')](_0xdcf1f5)[_0x35dd('0xc2')](loggerCatch(_0x35dd('0x11a')));this[_0x35dd('0xdc')](_0xdcf1f5)[_0x35dd('0xc2')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x35dd('0xbb')][_0x35dd('0x34')]=function(_0x174066){var _0x281eff=this[_0x35dd('0x2a')][_0x174066[_0x35dd('0xf1')]];if(this[_0x35dd('0x22')][_0x174066[_0x35dd('0xc4')]]){if(_0x281eff&&_0x281eff[_0x35dd('0x54')]!==_0x35dd('0x84')){delete this[_0x35dd('0x2a')][_0x174066[_0x35dd('0xf1')]];this[_0x35dd('0x22')][_0x174066[_0x35dd('0xc4')]][_0x35dd('0x65')]+=0x1;var _0x5806b6=new AgentComplete(_0x281eff,_0x174066);if(_0x174066[_0x35dd('0x120')]===_0x35dd('0x121')){_0x5806b6[_0x35dd('0x122')]=this[_0x35dd('0x22')][_0x174066[_0x35dd('0xc4')]]['dialQueueProject2']&&this[_0x35dd('0x22')][_0x174066[_0x35dd('0xc4')]][_0x35dd('0x123')]?moment()[_0x35dd('0x81')](_0x35dd('0x10f')):undefined;}this[_0x35dd('0xde')](_0x5806b6)[_0x35dd('0xc2')](loggerCatch(_0x35dd('0x124')));this['moveContactManagedDialer'](_0x5806b6)[_0x35dd('0xc2')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x35dd('0xbb')]['syncAgentConnect']=function(_0x415137){if(this[_0x35dd('0x22')][_0x415137['queue']]){if(this[_0x35dd('0x2a')][_0x415137[_0x35dd('0xf1')]]&&this['uniqueId'][_0x415137[_0x35dd('0xf1')]][_0x35dd('0x54')]!==_0x35dd('0x84')){this[_0x35dd('0xe3')](this[_0x35dd('0x22')][_0x415137[_0x35dd('0xc4')]]);this[_0x35dd('0x2a')][_0x415137[_0x35dd('0xf1')]][_0x35dd('0x125')]=moment()[_0x35dd('0x81')](_0x35dd('0x10f'));}}};Dialer[_0x35dd('0xbb')][_0x35dd('0x126')]=function(_0x524a65,_0x33099f){this[_0x35dd('0xde')](_0x524a65)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x33099f==0x0){this[_0x35dd('0xdc')](_0x524a65)[_0x35dd('0xc2')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x35dd('0xbb')][_0x35dd('0x31')]=function(_0x5afb1f){var _0x16e028=this[_0x35dd('0x2a')][_0x5afb1f['uniqueid']];var _0x2714f9=this;var _0x3ddce2=![];var _0x35899a;var _0x302420;if(this[_0x35dd('0x22')][_0x5afb1f[_0x35dd('0xc4')]]){if(_0x16e028&&_0x16e028[_0x35dd('0x54')]!==_0x35dd('0x84')){delete this[_0x35dd('0x2a')][_0x5afb1f[_0x35dd('0xf1')]];this['updateOriginated'](this[_0x35dd('0x22')][_0x5afb1f[_0x35dd('0xc4')]]);_0x16e028[_0x35dd('0x127')]=moment()[_0x35dd('0x81')](_0x35dd('0x10f'));var _0x9d282b=new QueueCallerAbandon(_0x16e028,_0x5afb1f);if(getSeconds(_0x16e028['droptime'],_0x16e028[_0x35dd('0x128')])>=_0x16e028[_0x35dd('0x129')]){this[_0x35dd('0x22')][_0x5afb1f[_0x35dd('0xc4')]][_0x35dd('0x74')]+=0x1;this[_0x35dd('0x22')][_0x5afb1f[_0x35dd('0xc4')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x5afb1f[_0x35dd('0xc4')]][_0x35dd('0x76')]+=0x1;_0x9d282b[_0x35dd('0xb7')]=0xa;_0x9d282b[_0x35dd('0xb8')]=_0x35dd('0x12a');_0x9d282b[_0x35dd('0x12b')]=_0x35dd('0x12c');_0x9d282b[_0x35dd('0x122')]=this['voiceQueues'][_0x5afb1f[_0x35dd('0xc4')]][_0x35dd('0x12d')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x9d282b['countdropretry']+=0x1;_0x9d282b[_0x35dd('0x101')]+=0x1;_0x35899a=this[_0x35dd('0x22')][_0x5afb1f[_0x35dd('0xc4')]][_0x35dd('0x12e')];_0x302420=this[_0x35dd('0x22')][_0x5afb1f[_0x35dd('0xc4')]][_0x35dd('0x12f')];_0x2714f9[_0x35dd('0xcc')](_0x9d282b,_0x9d282b[_0x35dd('0xb7')],_0x16e028[_0x35dd('0x130')])[_0x35dd('0x42')](function(_0xc078b6){_0x3ddce2=_0xc078b6[_0x35dd('0x131')]==0x1;if(_0x9d282b[_0x35dd('0x106')]>=_0x2714f9[_0x35dd('0x22')][_0x5afb1f[_0x35dd('0xc4')]][_0x35dd('0x132')]){_0x2714f9[_0x35dd('0x126')](_0x9d282b,_0xc078b6['additional']);}else{_0x2714f9[_0x35dd('0xd3')]({'active':![],'countdropretry':_0x9d282b[_0x35dd('0x106')],'scheduledat':moment()[_0x35dd('0x116')](_0x2714f9[_0x35dd('0x22')][_0x5afb1f[_0x35dd('0xc4')]][_0x35dd('0x12e')],_0x35dd('0x10e'))[_0x35dd('0x81')](_0x35dd('0x10f')),'ContactId':_0x16e028[_0x35dd('0xe7')],'ListId':_0x16e028[_0x35dd('0x117')],'VoiceQueueId':_0x16e028[_0x35dd('0x110')]||undefined,'CampaignId':_0x16e028[_0x35dd('0xe9')]||undefined})[_0x35dd('0xc2')](loggerCatch('[rescheduleContact][Drop]'));var _0x4a7f11=new History(_0x9d282b);_0x4a7f11[_0x35dd('0xb7')]=0xa;_0x4a7f11[_0x35dd('0xb8')]='Drop';_0x4a7f11[_0x35dd('0xba')]=moment()[_0x35dd('0x81')](_0x35dd('0x10f'));_0x4a7f11['endtime']=_0x4a7f11[_0x35dd('0xba')];_0x4a7f11[_0x35dd('0x133')]=_0x9d282b[_0x35dd('0x133')];_0x4a7f11[_0x35dd('0x134')]=_0x9d282b[_0x35dd('0x134')];_0x2714f9['createHistory'](_0x4a7f11)['catch'](loggerCatch(_0x35dd('0x135')));}})[_0x35dd('0x42')](function(){if(_0x3ddce2)_0x2714f9[_0x35dd('0x136')](_0x9d282b,_0x35899a,_0x302420)[_0x35dd('0x42')](function(){return 0x1;});});}else{this['voiceQueues'][_0x5afb1f['queue']][_0x35dd('0x73')]+=0x1;this[_0x35dd('0x22')][_0x5afb1f[_0x35dd('0xc4')]][_0x35dd('0x137')]+=0x1;_0x9d282b[_0x35dd('0xb7')]=0xb;_0x9d282b['statedesc']='Abandoned';_0x9d282b[_0x35dd('0x12b')]=_0x35dd('0x138');_0x9d282b[_0x35dd('0x107')]+=0x1;_0x9d282b[_0x35dd('0x101')]+=0x1;_0x35899a=this[_0x35dd('0x22')][_0x5afb1f[_0x35dd('0xc4')]]['dialAbandonedRetryFrequency'];_0x302420=this['voiceQueues'][_0x5afb1f[_0x35dd('0xc4')]][_0x35dd('0x12f')];_0x2714f9[_0x35dd('0xcc')](_0x9d282b,_0x9d282b[_0x35dd('0xb7')],_0x16e028[_0x35dd('0x130')])[_0x35dd('0x42')](function(_0x93c4f){if(_0x9d282b[_0x35dd('0x107')]>=_0x2714f9[_0x35dd('0x22')][_0x5afb1f[_0x35dd('0xc4')]][_0x35dd('0x139')]){_0x2714f9[_0x35dd('0x126')](_0x9d282b,_0x93c4f[_0x35dd('0x131')]);}else{_0x2714f9[_0x35dd('0xd3')]({'active':![],'countabandonedretry':_0x9d282b[_0x35dd('0x107')],'scheduledat':moment()[_0x35dd('0x116')](_0x2714f9[_0x35dd('0x22')][_0x5afb1f['queue']]['dialAbandonedRetryFrequency'],'minutes')[_0x35dd('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x16e028[_0x35dd('0xe7')],'ListId':_0x16e028['ListId'],'VoiceQueueId':_0x16e028[_0x35dd('0x110')]||undefined,'CampaignId':_0x16e028['CampaignId']||undefined})[_0x35dd('0xc2')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x59298c=new History(_0x9d282b);_0x59298c[_0x35dd('0xb7')]=0xb;_0x59298c[_0x35dd('0xb8')]=_0x35dd('0x13a');_0x59298c[_0x35dd('0xba')]=moment()[_0x35dd('0x81')]('YYYY-MM-DD\x20HH:mm:ss');_0x59298c[_0x35dd('0xb9')]=_0x59298c[_0x35dd('0xba')];_0x59298c[_0x35dd('0x133')]=_0x9d282b[_0x35dd('0x133')];_0x59298c[_0x35dd('0x134')]=_0x9d282b[_0x35dd('0x134')];_0x2714f9[_0x35dd('0xde')](_0x59298c)[_0x35dd('0xc2')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x35dd('0x42')](function(){if(_0x3ddce2)_0x2714f9[_0x35dd('0x136')](_0x9d282b,_0x35899a,_0x302420)[_0x35dd('0x42')](function(){return 0x1;});});}}}};Dialer[_0x35dd('0xbb')][_0x35dd('0x39')]=function(_0x51331e){if(this[_0x35dd('0x28')][_0x51331e[_0x35dd('0xf1')]]){this[_0x35dd('0x28')][_0x51331e[_0x35dd('0xf1')]][_0x35dd('0x13b')]=_0x51331e['channel'];}if(this[_0x35dd('0x2a')][_0x51331e[_0x35dd('0xf1')]]){this['uniqueId'][_0x51331e[_0x35dd('0xf1')]][_0x35dd('0x13b')]=_0x51331e[_0x35dd('0x13b')];}};Dialer[_0x35dd('0xbb')][_0x35dd('0x3d')]=function(_0x40ed75){if(!this[_0x35dd('0x28')][_0x40ed75['actionid']]){return;}if(strategy[this[_0x35dd('0x22')][this[_0x35dd('0x28')][_0x40ed75['actionid']]['queue']][_0x35dd('0x56')]]===_0x35dd('0x1c')){if(this[_0x35dd('0x28')][_0x40ed75['actionid']]&&_[_0x35dd('0xc0')](this['actions'][_0x40ed75['actionid']][_0x35dd('0x13c')])&&_0x40ed75[_0x35dd('0xc1')]==='1'&&_0x40ed75[_0x35dd('0x13d')]==='0'){if(this[_0x35dd('0x24')][_0x40ed75[_0x35dd('0x13e')]]){if(!this[_0x35dd('0x24')][_0x40ed75[_0x35dd('0x13e')]][_0x35dd('0x13c')]){this['agents'][_0x40ed75[_0x35dd('0x13e')]][_0x35dd('0x13c')]=!![];this[_0x35dd('0x28')][_0x40ed75['actionid']][_0x35dd('0x13c')]=!![];this['actions'][_0x40ed75['actionid']][_0x35dd('0x13e')]=_0x40ed75['stateinterface'];}}}}else if((strategy[this[_0x35dd('0x22')][this[_0x35dd('0x28')][_0x40ed75['actionid']][_0x35dd('0xc4')]]['strategy']]||_0x35dd('0x13f'))===_0x35dd('0x13f')){if(this[_0x35dd('0x28')][_0x40ed75[_0x35dd('0x140')]]){if(this[_0x35dd('0x24')][_0x40ed75[_0x35dd('0x13e')]]){this[_0x35dd('0x28')][_0x40ed75[_0x35dd('0x140')]]['stateinterface']=_0x40ed75[_0x35dd('0x13e')];if(_['isNil'](this[_0x35dd('0x2d')][this[_0x35dd('0x28')][_0x40ed75['actionid']][_0x35dd('0xc4')]])){this[_0x35dd('0x2d')][this[_0x35dd('0x28')][_0x40ed75[_0x35dd('0x140')]][_0x35dd('0xc4')]]=[];}this[_0x35dd('0x2d')][this[_0x35dd('0x28')][_0x40ed75[_0x35dd('0x140')]]['queue']][_0x35dd('0x141')](_['merge'](_[_0x35dd('0x142')](this[_0x35dd('0x28')][_0x40ed75[_0x35dd('0x140')]],[_0x35dd('0x143'),_0x35dd('0x13e')]),{'status':_0x40ed75['status'],'paused':_0x40ed75[_0x35dd('0x13d')]}));}}}};function unlockQueueStatus(_0x49e808,_0x3d4751){setTimeout(function(){if(_[_0x35dd('0x44')](_0x49e808['queueStatusComplete'])){loggerBooked[_0x35dd('0xa4')](_0x35dd('0x144'),_0x3d4751);}_0x49e808['queueStatusComplete']=!![];loggerBooked[_0x35dd('0x8a')]('[booked][unlockQueueStatus]',_0x3d4751,JSON[_0x35dd('0x145')](_['pick'](_0x49e808,[_0x35dd('0x47'),_0x35dd('0x146')])));},0x1f3);}Dialer[_0x35dd('0xbb')]['syncQueueStatusComplete']=function(_0x2e20d6){if(!this[_0x35dd('0x28')][_0x2e20d6[_0x35dd('0x140')]]){return;}var _0xc13219=this;var _0x2f04bf=_0xc13219[_0x35dd('0x22')][_0xc13219[_0x35dd('0x28')][_0x2e20d6[_0x35dd('0x140')]][_0x35dd('0xc4')]];if(strategy[this['voiceQueues'][this[_0x35dd('0x28')][_0x2e20d6[_0x35dd('0x140')]][_0x35dd('0xc4')]][_0x35dd('0x56')]]===_0x35dd('0x1c')){if(this['actions'][_0x2e20d6[_0x35dd('0x140')]]&&this['actions'][_0x2e20d6[_0x35dd('0x140')]]['stateinterface']){this[_0x35dd('0x21')][_0x35dd('0x147')](this[_0x35dd('0x28')][_0x2e20d6[_0x35dd('0x140')]][_0x35dd('0x143')],this[_0x35dd('0x28')][_0x2e20d6[_0x35dd('0x140')]][_0x35dd('0x13e')])[_0x35dd('0xc2')](function(_0x2defa3){logger[_0x35dd('0xa4')](_0x35dd('0x148'),util[_0x35dd('0xa3')](_0x2defa3,{'showHidden':![],'depth':null}));})['finally'](function(){_0xc13219[_0x35dd('0xe3')](_0xc13219[_0x35dd('0x22')][_0xc13219[_0x35dd('0x28')][_0x2e20d6[_0x35dd('0x140')]][_0x35dd('0xc4')]]);_0xc13219[_0x35dd('0x24')][_0xc13219[_0x35dd('0x28')][_0x2e20d6['actionid']][_0x35dd('0x13e')]][_0x35dd('0x13c')]=![];delete _0xc13219[_0x35dd('0x28')][_0x2e20d6[_0x35dd('0x140')]];unlockQueueStatus(_0x2f04bf);});}else{this[_0x35dd('0xe3')](this[_0x35dd('0x22')][this[_0x35dd('0x28')][_0x2e20d6[_0x35dd('0x140')]][_0x35dd('0xc4')]]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x2e20d6[_0x35dd('0x140')]][_0x35dd('0xe7')],'ListId':this[_0x35dd('0x28')][_0x2e20d6[_0x35dd('0x140')]]['ListId'],'VoiceQueueId':this[_0x35dd('0x28')][_0x2e20d6[_0x35dd('0x140')]][_0x35dd('0x110')]||undefined,'CampaignId':this['actions'][_0x2e20d6[_0x35dd('0x140')]][_0x35dd('0xe9')]||undefined})['catch'](loggerCatch(_0x35dd('0x149')));delete this[_0x35dd('0x28')][_0x2e20d6['actionid']];unlockQueueStatus(_0x2f04bf);}}else if((strategy[this[_0x35dd('0x22')][this[_0x35dd('0x28')][_0x2e20d6[_0x35dd('0x140')]]['queue']][_0x35dd('0x56')]]||_0x35dd('0x13f'))===_0x35dd('0x13f')){var _0x3d63e5;if(this[_0x35dd('0x28')][_0x2e20d6[_0x35dd('0x140')]]&&!_['isEmpty'](this[_0x35dd('0x2d')][this[_0x35dd('0x28')][_0x2e20d6[_0x35dd('0x140')]][_0x35dd('0xc4')]])){if(this[_0x35dd('0x14a')][_0xc13219[_0x35dd('0x28')][_0x2e20d6[_0x35dd('0x140')]]['queue']]){this['queueBookedRR'][_0xc13219[_0x35dd('0x28')][_0x2e20d6[_0x35dd('0x140')]][_0x35dd('0xc4')]]=this['queueBookedRR'][this[_0x35dd('0x28')][_0x2e20d6[_0x35dd('0x140')]][_0x35dd('0xc4')]]?this['queueBookedRR'][this[_0x35dd('0x28')][_0x2e20d6[_0x35dd('0x140')]][_0x35dd('0xc4')]]:this['queueBooked'][this[_0x35dd('0x28')][_0x2e20d6[_0x35dd('0x140')]][_0x35dd('0xc4')]]?this[_0x35dd('0x2d')][this[_0x35dd('0x28')][_0x2e20d6[_0x35dd('0x140')]][_0x35dd('0xc4')]][_0x35dd('0x14b')]||0x0:0x0;}this[_0x35dd('0x2d')][this[_0x35dd('0x28')][_0x2e20d6[_0x35dd('0x140')]]['queue']]['_rr']=this[_0x35dd('0x14a')][this[_0x35dd('0x28')][_0x2e20d6[_0x35dd('0x140')]][_0x35dd('0xc4')]];for(var _0x17d2f5=0x0;_0x17d2f5=0x0;})[_0x35dd('0xc2')](myreject(_0x58154f)));}}else{_0x25e0df['push'](ami[_0x35dd('0x161')]({'action':_0x35dd('0x167'),'command':util[_0x35dd('0x81')](_0x35dd('0x162'),_0x56139c,!_[_0x35dd('0x44')](config[_0x35dd('0x15e')][_0x4f01f2])?_0x4f01f2:'')})[_0x35dd('0x42')](function(_0x1f2424){return _0x1f2424[_0x35dd('0x164')][_0x35dd('0x165')]('true')>=0x0;})[_0x35dd('0xc2')](myreject(_0x58154f)));}Promise['all'](_0x25e0df)[_0x35dd('0x42')](function(_0x379bc7){var _0x21d538=_[_0x35dd('0x168')](_0x379bc7);if(_0x21d538){return _0x21d1d6(_0x21d538);}else{_0x50a060[_0x35dd('0x45')]=_0x12dc4f?_0x35dd('0x169'):_0x35dd('0x16a');return _0x58154f(msgResponse(_0x35dd('0x16b'),_0x35dd('0x15a'),_0x35dd('0x16c')+_0x12dc4f+'\x20'+_0x28a4f7+_0x35dd('0x16d')+util[_0x35dd('0xa3')](_0x56139c,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x4f01f2));}})[_0x35dd('0xc2')](function(_0x4540b7){return _0x58154f(msgResponse(_0x35dd('0x158'),'Failure',JSON[_0x35dd('0x145')](_0x4540b7)));});});};Dialer[_0x35dd('0xbb')][_0x35dd('0x16e')]=function(_0x18e5ab){var _0x2598ee=this;return function(){switch(_0x18e5ab['dialMethod']){case _0x35dd('0x16f'):freeVariablesPredictive(_0x18e5ab);_0x2598ee[_0x35dd('0x170')](_0x18e5ab,0x1);break;case'power':freeVariablesPredictive(_0x18e5ab);_0x2598ee['handlePower'](_0x18e5ab,_0x18e5ab[_0x35dd('0x171')]);break;case _0x35dd('0x172'):_0x2598ee[_0x35dd('0x172')](_0x18e5ab);break;case'booked':freeVariablesPredictive(_0x18e5ab);_0x2598ee[_0x35dd('0x170')](_0x18e5ab,0x1);break;default:freeVariablesPredictive(_0x18e5ab);logger['error'](_0x35dd('0x173'),_0x18e5ab[_0x35dd('0x47')],_0x35dd('0x174'));}};};Dialer[_0x35dd('0xbb')][_0x35dd('0x175')]=function(_0x4446e2){return Promise[_0x35dd('0xc8')]()['then'](cmHopper[_0x35dd('0x176')](_0x4446e2['id'],previewRecallmeReminderInterval))['then'](function(_0x1819aa){for(var _0x29b88f=0x0;_0x29b88f<_0x1819aa['length'];_0x29b88f++){var _0x81bee5=_0x1819aa[_0x29b88f][_0x35dd('0x177')][_0x35dd('0x47')];if(_0x81bee5)io['to'](util[_0x35dd('0x81')]('user:%s',_0x81bee5))[_0x35dd('0x53')](_0x35dd('0x178'),{'hopper':_0x1819aa[_0x29b88f]});}})[_0x35dd('0xc2')](function(){});};Dialer[_0x35dd('0xbb')]['launchHandleIvr']=function(_0x3145b7){var _0x4ddc46=this;return function(){_0x4ddc46[_0x35dd('0x179')](_0x3145b7);};};Dialer['prototype'][_0x35dd('0x17a')]=function(_0x2ef527){var _0x48bdc7=this;if(isNotPreview(_0x2ef527[_0x35dd('0x17b')])){if(isVoiceQueueOutbound(_0x2ef527[_0x35dd('0x54')])&&isActive(_0x2ef527[_0x35dd('0x17c')])){_0x2ef527[_0x35dd('0xb1')]=!![];Promise[_0x35dd('0xc8')]()[_0x35dd('0x42')](checkIsLoggedIn(_0x2ef527,_0x2ef527[_0x35dd('0x58')]))[_0x35dd('0x42')](checkIsActive(_0x2ef527,_0x2ef527[_0x35dd('0x17c')]))[_0x35dd('0x42')](checkInterval(_0x2ef527))[_0x35dd('0x42')](_0x48bdc7[_0x35dd('0x17d')](_0x2ef527))['then'](_0x48bdc7[_0x35dd('0x157')](_0x2ef527[_0x35dd('0x17e')],_0x2ef527[_0x35dd('0x17f')],_0x2ef527[_0x35dd('0x47')],_0x2ef527))['then'](_0x48bdc7[_0x35dd('0x159')](_0x2ef527[_0x35dd('0x4a')],_0x2ef527[_0x35dd('0x17f')],_0x2ef527[_0x35dd('0x47')],_0x2ef527))[_0x35dd('0x42')](_0x48bdc7['checkDialMethod'](_0x2ef527))[_0x35dd('0xc2')](loggerCatchQueueSummary(_0x35dd('0x180'),_0x2ef527));}else{notSendMessagesQueue(_0x2ef527);}}else{freeVariablesPredictive(_0x2ef527);}};Dialer[_0x35dd('0xbb')][_0x35dd('0x181')]=_[_0x35dd('0x182')](function(){var _0x438090=_[_0x35dd('0x183')](this[_0x35dd('0x22')],function(_0x44c2b7){return _0x44c2b7['dialPreviewRecallmeReminder'];});var _0xb99f8a=_['filter'](this['agents'],function(_0x2cec1a){return _0x2cec1a[_0x35dd('0x184')]&&_0x2cec1a[_0x35dd('0xc1')]==='reachable';});if(_0x438090[_0x35dd('0xa6')]>0x0&&_0xb99f8a['length']>0x0){return Promise[_0x35dd('0xc8')]()[_0x35dd('0x42')](cmHopper[_0x35dd('0x176')](_[_0x35dd('0x185')](_0x438090,'id'),previewRecallmeReminderInterval,_[_0x35dd('0x185')](_0xb99f8a,'id')))[_0x35dd('0x42')](function(_0x441c34){for(var _0x20bd99=0x0;_0x20bd99<_0x441c34[_0x35dd('0xa6')];_0x20bd99++){var _0xf810a9=_0x441c34[_0x20bd99][_0x35dd('0x177')]['name'];if(_0xf810a9)io['to'](util[_0x35dd('0x81')](_0x35dd('0x186'),_0xf810a9))[_0x35dd('0x53')](_0x35dd('0x178'),{'hopper':_0x441c34[_0x20bd99]});}})[_0x35dd('0xc2')](function(_0x5a2053){logger[_0x35dd('0xa4')](_0x35dd('0x175'),_0x5a2053);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x35dd('0xbb')][_0x35dd('0x155')]=function(){var _0x18b8a4=this;var _0x1f48ee;for(var _0xa2f55e in this[_0x35dd('0x23')]){if(typeof this[_0x35dd('0x23')][_0xa2f55e]!==_0x35dd('0xbf')){_0x1f48ee=this[_0x35dd('0x23')][_0xa2f55e];if(isCampaignIvr(_0x1f48ee[_0x35dd('0x54')])&&isActive(_0x1f48ee[_0x35dd('0x7f')])){_0x1f48ee[_0x35dd('0xb1')]=!![];Promise[_0x35dd('0xc8')]()[_0x35dd('0x42')](checkIsActive(_0x1f48ee,_0x1f48ee[_0x35dd('0x7f')]))[_0x35dd('0x42')](checkInterval(_0x1f48ee))[_0x35dd('0x42')](_0x18b8a4['checkIsTrunkReachable'](_0x1f48ee))[_0x35dd('0x42')](_0x18b8a4[_0x35dd('0x157')](_0x1f48ee[_0x35dd('0x17e')],_0x1f48ee[_0x35dd('0x17f')],_0x1f48ee[_0x35dd('0x47')],_0x1f48ee))[_0x35dd('0x42')](_0x18b8a4[_0x35dd('0x159')](_0x1f48ee['Interval'],_0x1f48ee[_0x35dd('0x17f')],_0x1f48ee[_0x35dd('0x47')],_0x1f48ee))[_0x35dd('0x42')](_0x18b8a4[_0x35dd('0x187')](_0x1f48ee))['catch'](loggerCatchQueueSummary(_0x35dd('0x188'),_0x1f48ee));}else{notSendMessagesCampaign(_0x1f48ee);}}}};function getCallerIdRandom(_0x61eea8,_0x19bb41){var _0x58d78b;var _0x49dc56;var _0xe7f24b;if(_0x19bb41<=0x0){_0x19bb41=0x1;}_0x58d78b=new RegExp(_0x35dd('0x189')+_0x19bb41+'}$');_0x49dc56=Math['pow'](0xa,_0x19bb41-0x1);_0xe7f24b=Math[_0x35dd('0x18a')](0xa,_0x19bb41)-0x1;return util['format']('%s',_[_0x35dd('0x18b')](_0x61eea8,_0x58d78b,_[_0x35dd('0x18c')](_0x49dc56,_0xe7f24b)));}function extractCalleridName(_0x233c2a){var _0x5cf50b=_0x233c2a[_0x35dd('0x18d')](/"(.*?)"/);return _0x5cf50b?_0x5cf50b[0x1]:_0x233c2a;}Dialer[_0x35dd('0xbb')]['actionOriginate']=function(_0x4a3f0f,_0x38cbd2){var _0x3b5006=this;var _0x30a75b=uuid['v4']();this[_0x35dd('0x28')][_0x30a75b]=new Action(_0x4a3f0f,_0x38cbd2,_0x30a75b);return new Promise(function(_0x40820b,_0x1e29dc){if(_[_0x35dd('0x44')](_0x4a3f0f)&&typeof _0x4a3f0f!==_0x35dd('0x18e')){return _0x1e29dc(msgResponse(_0x35dd('0x18f'),_0x35dd('0x15a'),_0x35dd('0x190')));}if(_[_0x35dd('0x44')](_0x38cbd2[_0x35dd('0x191')])||_0x38cbd2[_0x35dd('0x191')]===null){return _0x1e29dc(msgResponse('originate','Failure',_0x35dd('0x192')));}var _0x21c022={'XMD-CALLERID':_0x3b5006[_0x35dd('0x28')][_0x30a75b][_0x35dd('0x193')](),'XMD-AGI':_0x4a3f0f[_0x35dd('0x11c')]?util['format'](_0x35dd('0x194'),ipAgi,_0x4a3f0f['dialQueueProject']):_0x35dd('0x195'),'XMD-AGIAFTER':_0x4a3f0f[_0x35dd('0x12d')]?util[_0x35dd('0x81')](_0x35dd('0x194'),ipAgi,_0x4a3f0f[_0x35dd('0x12d')]):_0x35dd('0x195'),'XMD-QUEUE':_0x4a3f0f['type']===_0x35dd('0x55')?util[_0x35dd('0x81')](_0x35dd('0x196'),_0x4a3f0f['name'],_0x4a3f0f[_0x35dd('0x197')]||'',_0x4a3f0f['dialAgiAfterHangupAgent']?'c':'',_0x4a3f0f['dialQueueTimeout']||0x3):_0x35dd('0x195'),'XMD-CONTACTID':_0x38cbd2['ContactId'],'XMD-CDRTYPE':_0x35dd('0x8'),'CALLERID(all)':_0x3b5006[_0x35dd('0x28')][_0x30a75b][_0x35dd('0x193')](),'XMD-AMD':_0x4a3f0f[_0x35dd('0xfc')]?'ACTIVE':'NONE','XMD-DESTINATION':_0x35dd('0xf4')};if(_0x4a3f0f[_0x35dd('0xfc')]){_0x21c022[_0x35dd('0x198')]=_0x4a3f0f[_0x35dd('0x199')]||0x9c4;_0x21c022['XMD-AMDGREETING']=_0x4a3f0f[_0x35dd('0x19a')]||0x5dc;_0x21c022[_0x35dd('0x19b')]=_0x4a3f0f['dialAMDAfterGreetingSilence']||0x320;_0x21c022[_0x35dd('0x19c')]=_0x4a3f0f[_0x35dd('0x19d')]||0x1388;_0x21c022[_0x35dd('0x19e')]=_0x4a3f0f[_0x35dd('0x19f')]||0x64;_0x21c022['XMD-AMDBETWEENWORDSSILENCE']=_0x4a3f0f['dialAMDBetweenWordsSilence']||0x32;_0x21c022[_0x35dd('0x1a0')]=_0x4a3f0f[_0x35dd('0x1a1')]||0x3;_0x21c022[_0x35dd('0x1a2')]=_0x4a3f0f[_0x35dd('0x1a3')]||0x100;_0x21c022[_0x35dd('0x1a4')]=_0x4a3f0f[_0x35dd('0x1a5')]||0x1388;}if(_0x4a3f0f[_0x35dd('0x54')]===_0x35dd('0x55')){_0x21c022[_0x35dd('0x1a6')]=_0x38cbd2[_0x35dd('0x110')];}else{_0x21c022[_0x35dd('0x1a7')]=_0x38cbd2[_0x35dd('0xe9')];}for(var _0x367e0e in _0x38cbd2[_0x35dd('0x1a8')]){if(typeof _0x38cbd2[_0x35dd('0x1a8')][_0x367e0e]!=='undefined'){if(isNotNull(_0x38cbd2[_0x35dd('0x1a8')][_0x367e0e])&&_0x367e0e!=='id'&&_0x367e0e!=='tags'&&_0x367e0e!==_0x35dd('0x1a9')&&_0x367e0e!==_0x35dd('0x1aa')){_0x21c022[util[_0x35dd('0x81')](_0x35dd('0x1ab'),_0x35dd('0x1ac'),_['toUpper'](_0x367e0e))]=_0x38cbd2[_0x35dd('0x1a8')][_0x367e0e];}}}var _0x445a61=_0x3b5006['isTrunkReachable'](_0x4a3f0f[_0x35dd('0x7e')])?getCallerId(_0x4a3f0f[_0x35dd('0x7e')]['callerid'],_0x4a3f0f[_0x35dd('0x61')],_0x4a3f0f['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x4a3f0f[_0x35dd('0x1ad')],_0x4a3f0f[_0x35dd('0x1ae')]):_0x4a3f0f['dialOriginateCallerIdNumber']):getCallerId(_[_0x35dd('0xc0')](_0x4a3f0f[_0x35dd('0x156')])?_0x4a3f0f[_0x35dd('0x7e')]['callerid']:_0x4a3f0f[_0x35dd('0x156')]['callerid'],_0x4a3f0f[_0x35dd('0x61')],_0x4a3f0f[_0x35dd('0x1ae')]>0x0?getCallerIdRandom(_0x4a3f0f[_0x35dd('0x1ad')],_0x4a3f0f[_0x35dd('0x1ae')]):_0x4a3f0f[_0x35dd('0x1ad')]);if(_0x445a61){_0x21c022[_0x35dd('0x1af')]=_0x3b5006[_0x35dd('0x28')][_0x30a75b][_0x35dd('0x1b0')]=extractCalleridName(_0x445a61);_0x21c022[_0x35dd('0x1b1')]=_0x38cbd2[_0x35dd('0x191')];}_0x4a3f0f['variables']=_0x21c022;return ami[_0x35dd('0x161')]({'actionid':_0x30a75b,'action':_0x35dd('0x18f'),'channel':_0x3b5006[_0x35dd('0xed')](_0x4a3f0f[_0x35dd('0x7e')])?util[_0x35dd('0x81')](_0x35dd('0x1b2'),_0x4a3f0f[_0x35dd('0x7e')][_0x35dd('0x47')],isNotNull(_0x4a3f0f[_0x35dd('0x63')])?_0x4a3f0f[_0x35dd('0x63')][_0x35dd('0x1b3')]()||'':'',_0x4a3f0f[_0x35dd('0x1b4')]>0x0?_0x38cbd2[_0x35dd('0x191')][_0x35dd('0x1b5')](_0x4a3f0f[_0x35dd('0x1b4')]):_0x38cbd2[_0x35dd('0x191')]):util[_0x35dd('0x81')]('SIP/%s/%s%s',_['isNil'](_0x4a3f0f['TrunkBackup'])?_0x4a3f0f[_0x35dd('0x7e')][_0x35dd('0x47')]:_0x4a3f0f['TrunkBackup'][_0x35dd('0x47')],isNotNull(_0x4a3f0f['dialPrefix'])?_0x4a3f0f[_0x35dd('0x63')][_0x35dd('0x1b3')]()||'':'',_0x4a3f0f['dialCutDigit']>0x0?_0x38cbd2[_0x35dd('0x191')][_0x35dd('0x1b5')](_0x4a3f0f['dialCutDigit']):_0x38cbd2[_0x35dd('0x191')]),'callerid':_0x445a61,'Exten':_0x35dd('0xf4'),'Context':'from-sip','Priority':'1','variable':_0x21c022,'timeout':(_0x4a3f0f['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x30a75b})[_0x35dd('0x42')](function(_0x4d349a){return _0x40820b(_0x4d349a);})[_0x35dd('0xc2')](function(_0xe7d866){_0x4a3f0f[_0x35dd('0x6c')]+=0x1;var _0x2f2535=new History(_0x3b5006[_0x35dd('0x28')][_0x30a75b]);logger[_0x35dd('0xa4')](util[_0x35dd('0x81')](_0x35dd('0x1b6'),JSON[_0x35dd('0x145')](_0xe7d866)));_0x2f2535[_0x35dd('0xb7')]=0xe;_0x2f2535[_0x35dd('0xb8')]=_0x35dd('0x1b7');_0x2f2535['starttime']=moment()['format'](_0x35dd('0x10f'));_0x2f2535[_0x35dd('0xb9')]=_0x2f2535[_0x35dd('0xba')];_0x3b5006[_0x35dd('0xde')](_0x2f2535)[_0x35dd('0xc2')](loggerCatch(_0x35dd('0x1b8')));_0x3b5006[_0x35dd('0xdc')](_0x2f2535)[_0x35dd('0xc2')](loggerCatch(_0x35dd('0x1b8')))[_0x35dd('0x1f')](function(){delete _0x3b5006['actions'][_0x30a75b];return _0x1e29dc(msgResponse(_0x35dd('0x18f'),_0x35dd('0x50'),_0x35dd('0x1b9')));});});});};Dialer[_0x35dd('0xbb')]['syncOriginateResponse']=function(_0x11e155){var _0x5cba4b=this[_0x35dd('0x28')][_0x11e155[_0x35dd('0x140')]];if(_0x5cba4b){delete this['actions'][_0x11e155[_0x35dd('0x140')]];_0x5cba4b['responsetime']=moment()['format'](_0x35dd('0x10f'));var _0x5f283a=_0x5cba4b[_0x35dd('0x54')]==='ivr'?this[_0x35dd('0x23')][_0x5cba4b[_0x35dd('0xc4')]]:this[_0x35dd('0x22')][_0x5cba4b[_0x35dd('0x1ba')]()];if(!this[_0x35dd('0xec')](_0x11e155[_0x35dd('0x1bb')])){this[_0x35dd('0xe3')](_0x5f283a);return this[_0x35dd('0x1bc')](_0x5cba4b,_0x5f283a,_0x11e155)[_0x35dd('0xc2')](loggerCatch(_0x35dd('0x1bd')));}this[_0x35dd('0x2a')][_0x11e155[_0x35dd('0xf1')]]=_0x5cba4b;}};Dialer[_0x35dd('0xbb')][_0x35dd('0x1be')]=function(_0x38a6ab,_0x528b82,_0x32d854){var _0x240c2b=new History(_0x528b82);if(_0x240c2b['countbusyretry']+_0x240c2b[_0x35dd('0x1bf')]+_0x240c2b[_0x35dd('0x104')]+_0x240c2b[_0x35dd('0x105')]+_0x240c2b[_0x35dd('0x106')]+_0x240c2b[_0x35dd('0x107')]+_0x240c2b['countmachineretry']+_0x240c2b[_0x35dd('0x114')]>=_0x32d854[_0x35dd('0x108')]-0x1){return!![];}switch(_0x38a6ab){case 0x3:if(_0x240c2b['countnoanswerretry']>=_0x32d854[_0x35dd('0x1c0')]-0x1){return!![];}this[_0x35dd('0xd3')]({'active':![],'countnoanswerretry':_0x240c2b[_0x35dd('0x104')]+=0x1,'scheduledat':moment()['add'](_0x32d854[_0x35dd('0x1c1')],_0x35dd('0x10e'))[_0x35dd('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x240c2b['ContactId'],'ListId':_0x240c2b['ListId'],'VoiceQueueId':_0x240c2b[_0x35dd('0x110')]||undefined,'CampaignId':_0x240c2b['CampaignId']||undefined})[_0x35dd('0xc2')](loggerCatch(_0x35dd('0x1c2')));break;case 0x5:if(_0x240c2b['countbusyretry']>=_0x32d854['dialBusyMaxRetry']-0x1){return!![];}this[_0x35dd('0xd3')]({'active':![],'countbusyretry':_0x240c2b['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0x32d854[_0x35dd('0x1c3')],_0x35dd('0x10e'))[_0x35dd('0x81')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x240c2b[_0x35dd('0xe7')],'ListId':_0x240c2b[_0x35dd('0x117')],'VoiceQueueId':_0x240c2b[_0x35dd('0x110')]||undefined,'CampaignId':_0x240c2b[_0x35dd('0xe9')]||undefined})[_0x35dd('0xc2')](loggerCatch(_0x35dd('0x1c4')));break;case 0x8:if(_0x240c2b[_0x35dd('0x1bf')]>=_0x32d854['dialCongestionMaxRetry']-0x1){return!![];}this[_0x35dd('0xd3')]({'active':![],'countcongestionretry':_0x240c2b[_0x35dd('0x1bf')]+=0x1,'scheduledat':moment()[_0x35dd('0x116')](_0x32d854['dialCongestionRetryFrequency'],'minutes')[_0x35dd('0x81')](_0x35dd('0x10f')),'ContactId':_0x240c2b[_0x35dd('0xe7')],'ListId':_0x240c2b[_0x35dd('0x117')],'VoiceQueueId':_0x240c2b['VoiceQueueId']||undefined,'CampaignId':_0x240c2b[_0x35dd('0xe9')]||undefined})[_0x35dd('0xc2')](loggerCatch(_0x35dd('0x1c5')));break;case 0x0:if(_0x240c2b[_0x35dd('0x105')]>=_0x32d854[_0x35dd('0x1c6')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x240c2b[_0x35dd('0x105')]+=0x1,'scheduledat':moment()[_0x35dd('0x116')](_0x32d854[_0x35dd('0x1c7')],'minutes')[_0x35dd('0x81')](_0x35dd('0x10f')),'ContactId':_0x240c2b[_0x35dd('0xe7')],'ListId':_0x240c2b[_0x35dd('0x117')],'VoiceQueueId':_0x240c2b['VoiceQueueId']||undefined,'CampaignId':_0x240c2b['CampaignId']||undefined})[_0x35dd('0xc2')](loggerCatch(_0x35dd('0x1c8')));}break;case 0xa:if(_0x240c2b[_0x35dd('0x106')]>=_0x32d854[_0x35dd('0x132')]-0x1){return!![];}this[_0x35dd('0xd3')]({'active':![],'countdropretry':_0x240c2b['countdropretry']+=0x1,'scheduledat':moment()[_0x35dd('0x116')](_0x32d854[_0x35dd('0x12e')],'minutes')[_0x35dd('0x81')](_0x35dd('0x10f')),'ContactId':_0x240c2b['ContactId'],'ListId':_0x240c2b['ListId'],'VoiceQueueId':_0x240c2b[_0x35dd('0x110')]||undefined,'CampaignId':_0x240c2b[_0x35dd('0xe9')]||undefined})[_0x35dd('0xc2')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x240c2b[_0x35dd('0x107')]>=_0x32d854[_0x35dd('0x139')]-0x1){return!![];}this[_0x35dd('0xd3')]({'active':![],'countabandonedretry':_0x240c2b[_0x35dd('0x107')]+=0x1,'scheduledat':moment()['add'](_0x32d854[_0x35dd('0x1c9')],'minutes')[_0x35dd('0x81')](_0x35dd('0x10f')),'ContactId':_0x240c2b[_0x35dd('0xe7')],'ListId':_0x240c2b[_0x35dd('0x117')],'VoiceQueueId':_0x240c2b['VoiceQueueId']||undefined,'CampaignId':_0x240c2b[_0x35dd('0xe9')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x240c2b[_0x35dd('0x100')]>=_0x32d854[_0x35dd('0x10b')]-0x1){return!![];}this[_0x35dd('0xd3')]({'active':![],'countmachineretry':_0x240c2b['countmachineretry']+=0x1,'scheduledat':moment()[_0x35dd('0x116')](_0x32d854[_0x35dd('0x10d')],_0x35dd('0x10e'))[_0x35dd('0x81')](_0x35dd('0x10f')),'ContactId':_0x240c2b['ContactId'],'ListId':_0x240c2b[_0x35dd('0x117')],'VoiceQueueId':_0x240c2b[_0x35dd('0x110')]||undefined,'CampaignId':_0x240c2b['CampaignId']||undefined})[_0x35dd('0xc2')](loggerCatch(_0x35dd('0x118')));break;case 0x14:if(_0x240c2b[_0x35dd('0x114')]>=_0x32d854[_0x35dd('0x1ca')]-0x1){return!![];}this[_0x35dd('0xd3')]({'active':![],'countagentrejectretry':_0x240c2b[_0x35dd('0x114')]+=0x1,'scheduledat':moment()[_0x35dd('0x116')](_0x32d854['dialAgentRejectRetryFrequency'],_0x35dd('0x10e'))[_0x35dd('0x81')](_0x35dd('0x10f')),'ContactId':_0x240c2b['ContactId'],'ListId':_0x240c2b[_0x35dd('0x117')],'VoiceQueueId':_0x240c2b['VoiceQueueId']||undefined,'CampaignId':_0x240c2b[_0x35dd('0xe9')]||undefined})[_0x35dd('0xc2')](loggerCatch(_0x35dd('0x1cb')));break;default:return!![];}};Dialer['prototype'][_0x35dd('0x1bc')]=function(_0x427e03,_0x41660d,_0x4b40be){var _0x5c3cd9=this;var _0xe1d080=new History(_0x427e03);var _0x21a488=![];var _0x4ef63e;var _0x32643f;return new Promise(function(_0x213913,_0x4f6a97){if(_[_0x35dd('0x44')](_0x41660d)&&typeof _0x41660d!==_0x35dd('0x18e')){return _0x4f6a97(msgResponse(_0x35dd('0x1cc'),_0x35dd('0x15a'),_0x35dd('0x1cd')));}if(_['isUndefined'](_0x4b40be)&&typeof _0x4b40be!==_0x35dd('0x18e')){return _0x4f6a97(msgResponse(_0x35dd('0x1cc'),'Failure','evt\x20is\x20undefine'));}_0x5c3cd9[_0x35dd('0xcc')](_0xe1d080,_0x4b40be[_0x35dd('0x120')],_0x41660d)[_0x35dd('0x42')](function(_0x3f1730){if(_0x3f1730['additional']==0x1)_0x21a488=!![];switch(_0x4b40be[_0x35dd('0x120')]){case'0':_0x41660d[_0x35dd('0x6b')]+=0x1;_0xe1d080[_0x35dd('0xb7')]=0x0;_0xe1d080[_0x35dd('0xb8')]=_0x35dd('0x1ce');_0xe1d080['countnosuchnumberretry']+=0x1;_0xe1d080[_0x35dd('0x101')]+=0x1;ami['emit'](_0x35dd('0x1cf'),ut['buildObj'](_0x427e03,_0x35dd('0x1d0')));_0x4ef63e=_0x41660d[_0x35dd('0x1c7')];_0x32643f=_0x41660d['callAdditionalPhoneAfterMin'];_0x5c3cd9[_0x35dd('0xde')](_0xe1d080)[_0x35dd('0xc2')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5c3cd9[_0x35dd('0x1be')](0x0,_0x427e03,_0x41660d)&&!_0x21a488){if(_0xe1d080[_0x35dd('0x105')]>=_0x41660d[_0x35dd('0x1c6')]){_0x5c3cd9[_0x35dd('0x115')](_0xe1d080,_0x213913,_0x4f6a97,'reason\x200\x20no\x20such\x20number....');}else{_0x5c3cd9[_0x35dd('0x109')](_0xe1d080,_0x213913,_0x4f6a97,_0x35dd('0x1d1'));}}break;case'3':_0x41660d['outboundNoAnswerCallsDay']+=0x1;_0xe1d080[_0x35dd('0xb7')]=0x3;_0xe1d080[_0x35dd('0xb8')]=_0x35dd('0x1d2');_0xe1d080[_0x35dd('0x104')]+=0x1;_0xe1d080[_0x35dd('0x101')]+=0x1;var _0x457b61=ut[_0x35dd('0x1d3')](_0x427e03,_0x41660d);ami[_0x35dd('0x53')]('custom:agentnoanswer',_0x457b61);_0x4ef63e=_0x41660d[_0x35dd('0x1c1')];_0x32643f=_0x41660d[_0x35dd('0x12f')];_0x5c3cd9[_0x35dd('0xde')](_0xe1d080)[_0x35dd('0xc2')](loggerCatch(_0x35dd('0x1d4')));if(_0x5c3cd9[_0x35dd('0x1be')](0x3,_0x427e03,_0x41660d)&&!_0x21a488){if(_0xe1d080[_0x35dd('0x104')]>=_0x41660d[_0x35dd('0x1c0')]){_0x5c3cd9[_0x35dd('0x115')](_0xe1d080,_0x213913,_0x4f6a97,_0x35dd('0x1d5'));}else{_0x5c3cd9[_0x35dd('0x109')](_0xe1d080,_0x213913,_0x4f6a97,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x41660d[_0x35dd('0x67')]+=0x1;_0xe1d080[_0x35dd('0xb7')]=0x5;_0xe1d080['statedesc']=_0x35dd('0x1d6');_0xe1d080[_0x35dd('0x103')]+=0x1;_0xe1d080['countglobal']+=0x1;ami['emit'](_0x35dd('0x1d7'),ut[_0x35dd('0x102')](_0x427e03,_0x35dd('0x1d8')));_0x4ef63e=_0x41660d[_0x35dd('0x1c3')];_0x32643f=_0x41660d[_0x35dd('0x12f')];_0x5c3cd9['createHistory'](_0xe1d080)['catch'](loggerCatch(_0x35dd('0x1d9')));if(_0x5c3cd9['checkRetriveMax'](0x5,_0x427e03,_0x41660d)&&!_0x21a488){if(_0xe1d080[_0x35dd('0x103')]>=_0x41660d[_0x35dd('0x1da')]){_0x5c3cd9[_0x35dd('0x115')](_0xe1d080,_0x213913,_0x4f6a97,'reason\x205\x20busy');}else{_0x5c3cd9['stateGlobal'](_0xe1d080,_0x213913,_0x4f6a97,_0x35dd('0x1db'));}}break;case'8':_0x41660d[_0x35dd('0x68')]+=0x1;_0xe1d080[_0x35dd('0xb7')]=0x8;_0xe1d080[_0x35dd('0xb8')]=_0x35dd('0x1dc');_0xe1d080[_0x35dd('0x1bf')]+=0x1;_0xe1d080[_0x35dd('0x101')]+=0x1;_0x4ef63e=_0x41660d[_0x35dd('0x1dd')];_0x32643f=_0x41660d[_0x35dd('0x12f')];ami[_0x35dd('0x53')]('custom:agentcongestion',ut[_0x35dd('0x102')](_0x427e03,_0x35dd('0x1de')));_0x5c3cd9['createHistory'](_0xe1d080)[_0x35dd('0xc2')](loggerCatch(_0x35dd('0x1df')));if(_0x5c3cd9[_0x35dd('0x1be')](0x8,_0x427e03,_0x41660d)&&!_0x21a488){if(_0xe1d080[_0x35dd('0x1bf')]>=_0x41660d['dialCongestionMaxRetry']){_0x5c3cd9['createStateFinal'](_0xe1d080,_0x213913,_0x4f6a97,'reason\x208\x20congestion');}else{_0x5c3cd9[_0x35dd('0x109')](_0xe1d080,_0x213913,_0x4f6a97,_0x35dd('0x1e0'));}}break;case'11':_0x41660d[_0x35dd('0x1e1')]+=0x1;_0xe1d080[_0x35dd('0xb7')]=0xb;_0xe1d080[_0x35dd('0xb8')]=_0x35dd('0x13a');_0xe1d080[_0x35dd('0x107')]+=0x1;_0xe1d080['countglobal']+=0x1;_0x4ef63e=_0x41660d[_0x35dd('0x1c9')];_0x32643f=_0x41660d[_0x35dd('0x12f')];_0x5c3cd9['createHistory'](_0xe1d080)[_0x35dd('0xc2')](loggerCatch(_0x35dd('0x1e2')));if(_0x5c3cd9[_0x35dd('0x1be')](0xb,_0x427e03,_0x41660d)&&!_0x21a488){if(_0xe1d080[_0x35dd('0x107')]>=_0x41660d['dialAbandonedMaxRetry']){_0x5c3cd9[_0x35dd('0x115')](_0xe1d080,_0x213913,_0x4f6a97,_0x35dd('0x1e3'));}else{_0x5c3cd9[_0x35dd('0x109')](_0xe1d080,_0x213913,_0x4f6a97,_0x35dd('0x1e3'));}}break;case'20':_0x41660d[_0x35dd('0x6e')]+=0x1;_0xe1d080[_0x35dd('0xb7')]=0x14;_0xe1d080[_0x35dd('0xb8')]=_0x35dd('0x1e4');_0xe1d080['countagentrejectretry']+=0x1;_0xe1d080[_0x35dd('0x101')]+=0x1;_0x4ef63e=_0x41660d[_0x35dd('0x1e5')];_0x32643f=_0x41660d[_0x35dd('0x12f')];ami['emit']('custom:agentreject',ut[_0x35dd('0x102')](_0x427e03,'agentreject'));_0x5c3cd9[_0x35dd('0xde')](_0xe1d080)[_0x35dd('0xc2')](loggerCatch(_0x35dd('0x1e6')));if(_0x5c3cd9[_0x35dd('0x1be')](0x14,_0x427e03,_0x41660d)&&!_0x21a488){if(_0xe1d080[_0x35dd('0x114')]>=_0x41660d[_0x35dd('0x1ca')]){_0x5c3cd9[_0x35dd('0x115')](_0xe1d080,_0x213913,_0x4f6a97,_0x35dd('0x1e7'));}else{_0x5c3cd9[_0x35dd('0x109')](_0xe1d080,_0x213913,_0x4f6a97,'reason\x2020\x20agentreject');}}break;default:_0x41660d[_0x35dd('0x6f')]+=0x1;_0xe1d080[_0x35dd('0xb7')]=0xc;_0xe1d080[_0x35dd('0xb8')]=_0x4b40be['reason'];_0x4ef63e=_0x41660d[_0x35dd('0x1e5')];_0x32643f=_0x41660d['callAdditionalPhoneAfterMin'];_0x5c3cd9[_0x35dd('0xde')](_0xe1d080)[_0x35dd('0xc2')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x5c3cd9[_0x35dd('0x1be')](_0x4b40be['reason'],_0x427e03,_0x41660d)&&!_0x21a488){if(_0xe1d080[_0x35dd('0x103')]+_0xe1d080['countcongestionretry']+_0xe1d080['countnoanswerretry']+_0xe1d080[_0x35dd('0x105')]+_0xe1d080['countdropretry']+_0xe1d080[_0x35dd('0x107')]+_0xe1d080[_0x35dd('0x100')]+_0xe1d080[_0x35dd('0x114')]>=_0x41660d[_0x35dd('0x108')]){_0x5c3cd9[_0x35dd('0x109')](_0xe1d080,_0x213913,_0x4f6a97,_0x4b40be[_0x35dd('0x120')]);}else{_0x5c3cd9[_0x35dd('0x115')](_0xe1d080,_0x213913,_0x4f6a97,_0x4b40be[_0x35dd('0x120')]);}}}})[_0x35dd('0x42')](function(){if(_0x21a488){_0x5c3cd9[_0x35dd('0x136')](_0xe1d080,_0x4ef63e,_0x32643f)[_0x35dd('0x42')](function(){return _0x213913(0x1);});}});});};Dialer['prototype']['stateGlobal']=function(_0x284bf9,_0x172e53,_0x3c1cfd,_0xd6dfd){var _0x47e5f8=new Final(_0x284bf9);_0x47e5f8[_0x35dd('0xb7')]=0xf;_0x47e5f8[_0x35dd('0xb8')]=_0x35dd('0x1e8');this[_0x35dd('0x115')](_0x47e5f8,_0x172e53,_0x3c1cfd,_0xd6dfd);};Dialer[_0x35dd('0xbb')]['createStateFinal']=function(_0x31be7e,_0x1ce17d,_0x14f6cb,_0x554500){this[_0x35dd('0xdc')](_0x31be7e)[_0x35dd('0x42')](function(){return _0x1ce17d(msgResponse(_0x35dd('0x1cc'),_0x35dd('0x1e9'),_0x554500));})[_0x35dd('0xc2')](function(){return _0x14f6cb(msgResponse(_0x35dd('0x1ea'),_0x35dd('0x15a'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0x35dd('0x172')]=function(_0x1182a0){var _0x36a8ab=_0x1182a0[_0x35dd('0x1eb')]/0x64;var _0xc26284=_0x1182a0['outboundDropCallsDayTimeout']/(_0x1182a0['outboundDropCallsDayTimeout']+_0x1182a0['outboundAnswerCallsDay']);var _0x4770e5=Math[_0x35dd('0x1ec')](_0x1182a0['predictiveIntervalAvailable']*(_0x1182a0['predictiveIntervalMaxThreshold']/0x64));var _0x52729b=Math[_0x35dd('0x1ec')](_0x1182a0[_0x35dd('0x7a')]*(_0x1182a0[_0x35dd('0x1ed')]/0x64));var _0x398590=_0x1182a0[_0x35dd('0x57')]+_0x1182a0['talking'];var _0x4072c9=Math[_0x35dd('0x1ee')](_0x1182a0[_0x35dd('0x96')]*_0x1182a0[_0x35dd('0x99')]*_0x1182a0[_0x35dd('0x77')]*_0x1182a0[_0x35dd('0x78')]);if(_[_0x35dd('0x44')](_0x1182a0[_0x35dd('0x7d')])){if(!_['isUndefined'](_0x1182a0[_0x35dd('0x2b')])){_0x1182a0[_0x35dd('0x2b')]=undefined;loggerPredictive[_0x35dd('0xa4')](_0x35dd('0x1ef'),_0x35dd('0x1f0'));}if(!_[_0x35dd('0x44')](_0x1182a0[_0x35dd('0x9d')])){loggerPredictive['error'](_0x35dd('0x1ef'),_0x35dd('0x1f1'));clearInterval(_0x1182a0['handlePredictive']);_0x1182a0['handlePredictive']=undefined;}_0x1182a0[_0x35dd('0x7d')]=moment()[_0x35dd('0x81')](_0x35dd('0x10f'));loggerPredictive['info'](_0x1182a0[_0x35dd('0x47')],_0x35dd('0x1f2'),_0x1182a0['startProgressive']);this['handlePower'](_0x1182a0,0x1);}else if(ifInterval(_0x1182a0[_0x35dd('0x1f3')],_0x1182a0['startProgressive'])){this['handlePower'](_0x1182a0,0x1);loggerPredictiveCalls[_0x35dd('0x8a')](_0x35dd('0x1f4'),_0x1182a0['startProgressive'],_0x1182a0[_0x35dd('0x47')]);_0x1182a0['erlangCalls']=0x0;_0x1182a0[_0x35dd('0x76')]=0x0;}else if(_0x36a8ab<_0xc26284&&_0x1182a0[_0x35dd('0x1f5')]===_0x35dd('0x1f6')){freeVariablesPredictive(_0x1182a0);loggerPredictive[_0x35dd('0x8a')](_0x35dd('0x1f7'),'Dropped\x20calls\x20day',_0xc26284,_0x35dd('0x7d'),_0x1182a0['name']);}else if(_0x4072c9<_0x1182a0[_0x35dd('0x76')]&&_0x1182a0[_0x35dd('0x1f5')]===_0x35dd('0x1f6')){freeVariablesPredictive(_0x1182a0);loggerPredictive[_0x35dd('0x8a')](_0x35dd('0x1f8'),_0x35dd('0x1f9'),_0x4072c9,_0x35dd('0x1fa'),_0x1182a0[_0x35dd('0x76')],_0x35dd('0x7d'),_0x1182a0['name']);}else if(!ifInterval(_0x1182a0[_0x35dd('0x1f3')],_0x1182a0['startProgressive'])&&_[_0x35dd('0x44')](_0x1182a0[_0x35dd('0x2b')])&&!_['isUndefined'](_0x1182a0[_0x35dd('0x7d')])){_0x1182a0[_0x35dd('0x2b')]=moment()[_0x35dd('0x81')](_0x35dd('0x10f'));loggerPredictive['info'](_0x1182a0[_0x35dd('0x47')],_0x35dd('0x1fb'),_0x1182a0['startPredictive']);this[_0x35dd('0xd1')](_0x1182a0['dialPredictiveInterval'])[_0x35dd('0x42')](this['getDataPredictive'](_0x1182a0))[_0x35dd('0x42')](mergeDataErlangB(_0x1182a0))[_0x35dd('0x42')](this['startMethodPredictive'](_0x1182a0))[_0x35dd('0xc2')](loggerCatchPredictive(_0x35dd('0x1fc'),_0x1182a0));}else if(!ifInterval(_0x1182a0['dialPredictiveInterval'],_0x1182a0['startPredictive'])){_0x1182a0[_0x35dd('0x76')]=0x0;_0x1182a0[_0x35dd('0x2b')]=moment()[_0x35dd('0x81')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x35dd('0x8a')](_0x1182a0[_0x35dd('0x47')],_0x35dd('0x1fd'),_0x1182a0[_0x35dd('0x2b')]);clearInterval(_0x1182a0[_0x35dd('0x9d')]);_0x1182a0['handlePredictive']=undefined;this[_0x35dd('0xd1')](_0x1182a0['dialPredictiveInterval'])[_0x35dd('0x42')](this[_0x35dd('0x1fe')](_0x1182a0))['then'](mergeDataErlangB(_0x1182a0))[_0x35dd('0x42')](this['startMethodPredictive'](_0x1182a0))['catch'](loggerCatchPredictive(_0x35dd('0x1ff'),_0x1182a0));}else if(_0x1182a0['predictiveIntervalAvailable']&&_0x398590<_0x1182a0[_0x35dd('0x7a')]-_0x52729b){freeVariablesPredictive(_0x1182a0);loggerPredictive[_0x35dd('0x8a')](_0x1182a0['name'],_0x35dd('0x200'),_0x398590,_0x35dd('0x201'),_0x1182a0[_0x35dd('0x7a')],'-',_0x52729b,'=',_0x1182a0['predictiveIntervalAvailable']-_0x52729b,')');}else if(_0x1182a0[_0x35dd('0x7a')]&&_0x398590>_0x1182a0[_0x35dd('0x7a')]+_0x4770e5){freeVariablesPredictive(_0x1182a0);loggerPredictive[_0x35dd('0x8a')](_0x1182a0[_0x35dd('0x47')],_0x35dd('0x200'),_0x398590,_0x35dd('0x202'),_0x1182a0[_0x35dd('0x7a')],'+',_0x4770e5,'=',_0x1182a0[_0x35dd('0x7a')]+_0x4770e5,')');}};Dialer['prototype'][_0x35dd('0x1fe')]=function(_0x300900){var _0x56924a=this;return function(_0x24139b){return new Promise(function(_0x19dbfb,_0x90b4c){_[_0x35dd('0x9a')](_0x300900,_0x24139b[0x0]);if(checkGetDataPredictive(_0x24139b[0x0])){var _0x5c3f76=_0x300900['predictiveIntervalAvailable']=_0x300900['talking']+_0x300900['available'];var _0x555f58=_0x300900[_0x35dd('0x1f3')]*0x3c;var _0x33d6f8=_0x24139b[0x0]['predictiveIntervalAvgTalktime']+_0x24139b[0x0][_0x35dd('0x71')];var _0xb29449=(_0x24139b[0x0][_0x35dd('0x70')]+_0x24139b[0x0][_0x35dd('0x74')]+_0x24139b[0x0][_0x35dd('0x73')])/_0x24139b[0x0]['predictiveIntervalTotalCalls'];_0x300900[_0x35dd('0x77')]=_0xb29449>0x0?_0xb29449:0x1;switch(_0x300900[_0x35dd('0x1f5')]){case'dropRate':var _0x3518db=_0x300900[_0x35dd('0x1eb')]/0x64;return _0x56924a[_0x35dd('0x203')](_0x5c3f76,_0x555f58,_0x33d6f8,_0xb29449,_0x3518db)[_0x35dd('0x42')](function(_0x57af0b){return _0x19dbfb(_0x57af0b);});case _0x35dd('0x204'):var _0x22cd74=_0x300900['dialPredictiveOptimizationPercentage']/0x64;return _0x56924a[_0x35dd('0x205')](_0x5c3f76,_0x555f58,_0x33d6f8,_0xb29449,_0x22cd74)['then'](function(_0x9bfa33){return _0x19dbfb(_0x9bfa33);});default:return _0x90b4c(msgResponse('[getDataPredictive]',_0x35dd('0x15a'),_0x35dd('0x206')));}}else{return _0x90b4c(msgResponse(_0x35dd('0x207'),'Failure',_0x35dd('0x208')));}});};};Dialer['prototype'][_0x35dd('0x209')]=function(_0x59502c){var _0x28c24a=this;return function(_0x1c1cc2){return new Promise(function(_0x26bad5,_0x39ff13){_['merge'](_0x59502c,_0x1c1cc2[0x0]);if(checkGetDataPredictive(_0x1c1cc2[0x0])){loggerPredictive[_0x35dd('0x8a')](JSON[_0x35dd('0x145')](_0x1c1cc2[0x0]));if(_0x59502c[_0x35dd('0x1f5')]===_0x35dd('0x1f6')){return _0x28c24a[_0x35dd('0xdb')](_0x59502c['id'])[_0x35dd('0x42')](function(_0x28c605){var _0x85fb7e=_0x59502c[_0x35dd('0x58')]-_0x28c605[0x0][_0x35dd('0x20a')];var _0x4aab1f=_0x59502c[_0x35dd('0x1f3')]*0x3c;var _0x1a8489=_0x1c1cc2[0x0]['predictiveIntervalAvgTalktime']+_0x1c1cc2[0x0][_0x35dd('0x71')];var _0x38f170=(_0x1c1cc2[0x0]['predictiveIntervalAnsweredCalls']+_0x1c1cc2[0x0][_0x35dd('0x74')]+_0x1c1cc2[0x0][_0x35dd('0x73')])/_0x1c1cc2[0x0][_0x35dd('0x89')];var _0x5f3300=_0x59502c[_0x35dd('0x1eb')]/0x64;_0x59502c[_0x35dd('0x79')]=_0x28c605[0x0]['outboundQueuePauses']||0x0;_0x59502c[_0x35dd('0x77')]=_0x38f170>0x0?_0x38f170:0x1;return _0x28c24a[_0x35dd('0x203')](_0x85fb7e,_0x4aab1f,_0x1a8489,_0x38f170,_0x5f3300);})[_0x35dd('0x42')](function(_0x473e49){return _0x26bad5(_0x473e49);})[_0x35dd('0xc2')](function(_0x2019a6){return _0x39ff13(msgResponse(_0x35dd('0x20b'),_0x35dd('0x15a'),JSON[_0x35dd('0x145')](_0x2019a6)));});}if(_0x59502c[_0x35dd('0x1f5')]===_0x35dd('0x204')){return _0x28c24a[_0x35dd('0xdb')](_0x59502c['id'])[_0x35dd('0x42')](function(_0x1a97dd){var _0x4fa206=_0x59502c['loggedIn']-_0x1a97dd[0x0][_0x35dd('0x20a')];var _0x2b463b=_0x59502c[_0x35dd('0x1f3')]*0x3c;var _0x16063d=_0x1c1cc2[0x0][_0x35dd('0x72')]+_0x1c1cc2[0x0][_0x35dd('0x71')];var _0x3249d5=(_0x1c1cc2[0x0]['predictiveIntervalAnsweredCalls']+_0x1c1cc2[0x0][_0x35dd('0x74')]+_0x1c1cc2[0x0][_0x35dd('0x73')])/_0x1c1cc2[0x0][_0x35dd('0x89')];var _0x5def76=_0x59502c[_0x35dd('0x1eb')]/0x64;_0x59502c[_0x35dd('0x79')]=_0x1a97dd[0x0][_0x35dd('0x20a')]||0x0;_0x59502c[_0x35dd('0x77')]=_0x3249d5>0x0?_0x3249d5:0x1;return _0x28c24a[_0x35dd('0x205')](_0x4fa206,_0x2b463b,_0x16063d,_0x3249d5,_0x5def76);})[_0x35dd('0x42')](function(_0x595933){return _0x26bad5(_0x595933);})['catch'](function(_0x1e4645){return _0x39ff13(msgResponse(_0x35dd('0x20b'),_0x35dd('0x15a'),JSON[_0x35dd('0x145')](_0x1e4645)));});}}else{return _0x39ff13(msgResponse('[getDataPredictive]',_0x35dd('0x15a'),_0x35dd('0x208')));}});};};Dialer[_0x35dd('0xbb')][_0x35dd('0x20c')]=function(_0x59d38a){var _0x9f2fbe=this;return function(){var _0x3705d0=0x0;var _0x3cf00f=Math[_0x35dd('0x1ee')](_0x59d38a[_0x35dd('0x7b')]*0x3e8);if(_0x3cf00f>0x0){_0x3cf00f=_0x3cf00f<0x64?0x64:_0x3cf00f;loggerPredictive[_0x35dd('0x8a')](_0x59d38a['name'],_0x35dd('0x20d'),_0x3cf00f,_0x35dd('0x51'));_0x59d38a['handlePredictive']=setInterval(function(){_0x9f2fbe[_0x35dd('0x9d')](_0x59d38a);loggerPredictiveCalls[_0x35dd('0x8a')](_0x35dd('0x20e'),_0x3705d0+=0x1);},_0x3cf00f);}else{loggerPredictive[_0x35dd('0x8a')](_0x59d38a[_0x35dd('0x47')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x35dd('0xbb')][_0x35dd('0x20f')]=function(_0x6bccd9,_0x2923eb){var _0x3f1b5c=this;return function(_0x23da22){if(_[_0x35dd('0x4d')](_0x23da22)){if(_['isNil'](_0x2923eb[_0x35dd('0xe8')])||!_0x2923eb[_0x35dd('0x210')]){if(_0x6bccd9[_0x35dd('0x17b')]===_0x35dd('0x9')){_0x6bccd9[_0x35dd('0x146')]=_[_0x35dd('0x44')](_0x6bccd9[_0x35dd('0x146')])?!![]:_0x6bccd9[_0x35dd('0x146')];var _0x1c5730=uuid['v4']();_0x3f1b5c[_0x35dd('0x28')][_0x1c5730]=new Action(_0x6bccd9,_0x2923eb,_0x1c5730);loggerBooked['info'](_0x35dd('0x211'),_0x1c5730,_0x35dd('0x212'),JSON[_0x35dd('0x145')](_0x6bccd9[_0x35dd('0x146')]),_0x35dd('0x213'),_0x6bccd9[_0x35dd('0x47')]);if(_0x6bccd9[_0x35dd('0x146')]){_0x6bccd9[_0x35dd('0x146')]=![];_0x3f1b5c[_0x35dd('0x2d')][_0x3f1b5c['actions'][_0x1c5730][_0x35dd('0xc4')]]=[];ami[_0x35dd('0x161')]({'actionid':_0x1c5730,'action':_0x35dd('0x214'),'queue':_0x6bccd9[_0x35dd('0x47')]})[_0x35dd('0xc2')](function(){_0x3f1b5c[_0x35dd('0xe3')](_0x6bccd9);_0x3f1b5c[_0x35dd('0xd3')]({'active':![],'ContactId':_0x3f1b5c[_0x35dd('0x28')][_0x1c5730][_0x35dd('0xe7')],'ListId':_0x3f1b5c['actions'][_0x1c5730][_0x35dd('0x117')],'VoiceQueueId':_0x3f1b5c['actions'][_0x1c5730][_0x35dd('0x110')]||undefined,'CampaignId':_0x3f1b5c[_0x35dd('0x28')][_0x1c5730][_0x35dd('0xe9')]||undefined})[_0x35dd('0xc2')](loggerCatch(_0x35dd('0x215')));delete _0x3f1b5c[_0x35dd('0x28')][_0x1c5730];});}else{loggerBooked[_0x35dd('0x8a')](_0x35dd('0x216'),JSON[_0x35dd('0x145')](_0x6bccd9['queueStatusComplete']),_0x35dd('0x213'),_0x6bccd9[_0x35dd('0x47')]);_0x3f1b5c[_0x35dd('0xe3')](_0x6bccd9);_0x3f1b5c[_0x35dd('0xd3')]({'active':![],'ContactId':_0x3f1b5c[_0x35dd('0x28')][_0x1c5730][_0x35dd('0xe7')],'ListId':_0x3f1b5c[_0x35dd('0x28')][_0x1c5730][_0x35dd('0x117')],'VoiceQueueId':_0x3f1b5c['actions'][_0x1c5730]['VoiceQueueId']||undefined,'CampaignId':_0x3f1b5c['actions'][_0x1c5730]['CampaignId']||undefined})['catch'](loggerCatch(_0x35dd('0x215')));delete _0x3f1b5c['actions'][_0x1c5730];}}else{return _0x3f1b5c[_0x35dd('0x217')](_0x6bccd9,_0x2923eb);}}else{if(getDiff(_0x2923eb[_0x35dd('0x218')])<_0x6bccd9[_0x35dd('0x219')]*0x3c){if(_0x2923eb[_0x35dd('0x177')]&&!_0x2923eb[_0x35dd('0x177')][_0x35dd('0x21a')]){_0x3f1b5c[_0x35dd('0x21')][_0x35dd('0x147')](_0x2923eb['id'])[_0x35dd('0x1f')](function(){_0x3f1b5c[_0x35dd('0xe3')](_0x6bccd9);});}else{_0x3f1b5c[_0x35dd('0xd5')]({'active':![]},_0x2923eb['id'],0x1)[_0x35dd('0x1f')](function(){_0x3f1b5c['updateOriginated'](_0x6bccd9);});}}else{_0x6bccd9[_0x35dd('0x6d')]+=0x1;_0x3f1b5c[_0x35dd('0xe3')](_0x6bccd9);if(_0x6bccd9[_0x35dd('0x21b')]){_0x3f1b5c['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2923eb[_0x35dd('0xe7')],'ListId':_0x2923eb[_0x35dd('0x117')],'VoiceQueueId':_0x2923eb[_0x35dd('0x110')]||undefined,'CampaignId':_0x2923eb['CampaignId']||undefined})[_0x35dd('0xc2')](loggerCatch(_0x35dd('0x21c')));_0x3f1b5c[_0x35dd('0xde')](createObjHistory(_0x6bccd9,_0x2923eb,'RECALLINQUEUE',0x17,_0x35dd('0x21d')))[_0x35dd('0xc2')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x3f1b5c[_0x35dd('0xe6')](createObjHistory(_0x6bccd9,_0x2923eb,_0x35dd('0x21e'),0x16,_0x35dd('0x21f')),'[Originate][HistoryRecallClose][historyCatch]',_0x35dd('0x220'));}}}}else{_0x6bccd9[_0x35dd('0x66')]+=0x1;_0x3f1b5c['saveInDb'](createObjHistory(_0x6bccd9,_0x2923eb,_0x35dd('0x221'),0xd,'Blacklist'),_0x35dd('0x222'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer['prototype'][_0x35dd('0x179')]=function(_0x280bd6){var _0x14a436=this;var _0x5cd205=_0x280bd6[_0x35dd('0x223')]-_0x280bd6['originated']-_0x280bd6[_0x35dd('0xd7')];emitCampaignSummary(_0x280bd6);if(_0x5cd205>0x0){if(_0x5cd205>this[_0x35dd('0x26')]){_0x5cd205=this[_0x35dd('0x26')];}_0x280bd6[_0x35dd('0xd7')]+=_0x5cd205;this[_0x35dd('0xd9')](_0x280bd6['id'],_0x5cd205,_0x280bd6[_0x35dd('0x224')],_0x280bd6)[_0x35dd('0x42')](function(_0x1cbc87){_0x280bd6[_0x35dd('0xd7')]-=_0x5cd205;_0x280bd6[_0x35dd('0xd7')]=_0x280bd6['temp']>0x0?_0x280bd6['temp']:0x0;if(!checkContactEmpty(_0x1cbc87)){_0x280bd6[_0x35dd('0x45')]=_0x35dd('0xae');logger[_0x35dd('0x8a')]('[getContactCampaign2][Empty]'+_0x280bd6[_0x35dd('0x47')]);}else{_0x280bd6['originated']+=_0x1cbc87[_0x35dd('0xa6')];_0x280bd6['message']='RUNNING';for(var _0x5e9720=0x0;_0x5e9720<_0x1cbc87[_0x35dd('0xa6')];_0x5e9720+=0x1){_0x280bd6['ivrTotalCallsDays']+=0x1;if(_[_0x35dd('0xc0')](_0x1cbc87[_0x5e9720])||_[_0x35dd('0xc0')](_0x1cbc87[_0x5e9720]['Contact'])||_[_0x35dd('0xc0')](_0x1cbc87[_0x5e9720][_0x35dd('0x191')])){_0x14a436[_0x35dd('0xe4')](_0x35dd('0x225'),_0x280bd6,_0x1cbc87[_0x5e9720]);}else{_0x14a436[_0x35dd('0xcf')](_[_0x35dd('0x142')](_0x1cbc87[_0x5e9720],[_0x35dd('0xe9'),_0x35dd('0x191')]))[_0x35dd('0x42')](_0x14a436[_0x35dd('0x20f')](_0x280bd6,_0x1cbc87[_0x5e9720]))[_0x35dd('0xc2')](_0x14a436[_0x35dd('0xe2')](_0x35dd('0x226'),_0x280bd6));}}}})[_0x35dd('0xc2')](loggerGetContactDialer('[getContactCampaign2]',_0x280bd6,_0x5cd205));}};Dialer[_0x35dd('0xbb')][_0x35dd('0x170')]=function(_0x20b74e,_0x2f7131){var _0x5e7849=this;var _0x5e539e=[];var _0x524c6e=_0x2f7131>=0x1?_0x2f7131:0x1;if(_0x20b74e[_0x35dd('0x17b')]===_0x35dd('0x9')){_0x524c6e=0x1;}var _0x47a7a9=Math['floor'](_0x20b74e[_0x35dd('0x57')]*_0x524c6e)-_0x20b74e['originated']-_0x20b74e[_0x35dd('0xd7')];emitVoiceQueueSummary(_0x20b74e);if(_0x20b74e[_0x35dd('0x227')]>0x0){var _0x5c1d85=_0x20b74e[_0x35dd('0x227')]-_0x20b74e[_0x35dd('0xa7')]-_0x20b74e['talking']-_0x20b74e['temp']-_0x20b74e[_0x35dd('0xb0')];if(_0x47a7a9>_0x5c1d85){_0x47a7a9=_0x5c1d85;}}if(_0x47a7a9>0x0){if(_0x20b74e[_0x35dd('0x17b')]==='booked'){_0x47a7a9=0x1;}if(_0x47a7a9>this[_0x35dd('0x26')]){_0x47a7a9=this['maxNumberOriginate'];}_0x20b74e[_0x35dd('0xd7')]+=_0x47a7a9;for(var _0x25ce8b in this[_0x35dd('0x24')]){if(typeof this[_0x35dd('0x24')][_0x25ce8b]!=='undefined'){if(this[_0x35dd('0x24')][_0x25ce8b]['state']===_0x35dd('0x228')&&this['agents'][_0x25ce8b][_0x35dd('0xc1')]===_0x35dd('0xef')){_0x5e539e[_0x35dd('0x141')](this[_0x35dd('0x24')][_0x25ce8b]['id']);}}}this['getContactDialer'](_0x20b74e['id'],_0x5e539e,_0x47a7a9,_0x20b74e[_0x35dd('0x224')],_0x20b74e)[_0x35dd('0x42')](function(_0x32dcfb){_0x20b74e[_0x35dd('0xd7')]-=_0x47a7a9;_0x20b74e[_0x35dd('0xd7')]=_0x20b74e['temp']>0x0?_0x20b74e[_0x35dd('0xd7')]:0x0;if(!checkContactEmpty(_0x32dcfb)){_0x5e7849['countReScheduled'](_0x20b74e)[_0x35dd('0x42')](sendMessageReschedule(_0x20b74e))[_0x35dd('0xc2')](loggerCatch(_0x35dd('0xc9')));}else{_0x20b74e[_0x35dd('0xa7')]+=_0x32dcfb['length'];_0x20b74e[_0x35dd('0x45')]=_0x20b74e['dialMethod']===_0x35dd('0x9')?_0x35dd('0x229'):_0x35dd('0x22a');for(var _0x4d0c29=0x0;_0x4d0c29<_0x32dcfb[_0x35dd('0xa6')];_0x4d0c29+=0x1){if(_['isNil'](_0x32dcfb[_0x4d0c29])||_[_0x35dd('0xc0')](_0x32dcfb[_0x4d0c29][_0x35dd('0x1a8')])||_['isNil'](_0x32dcfb[_0x4d0c29][_0x35dd('0x191')])){_0x5e7849[_0x35dd('0xe4')](_0x35dd('0x225'),_0x20b74e,_0x32dcfb[_0x4d0c29]);}else{_0x5e7849[_0x35dd('0xca')](_[_0x35dd('0x142')](_0x32dcfb[_0x4d0c29],[_0x35dd('0x110'),_0x35dd('0x191')]))['then'](_0x5e7849[_0x35dd('0x20f')](_0x20b74e,_0x32dcfb[_0x4d0c29]))[_0x35dd('0xc2')](_0x5e7849['loggerHandler'](_0x35dd('0x225'),_0x20b74e));}}}})[_0x35dd('0xc2')](loggerGetContactDialer(_0x35dd('0x22b'),_0x20b74e,_0x47a7a9));}};Dialer[_0x35dd('0xbb')]['handlePredictive']=function(_0x30034c){if(_0x30034c[_0x35dd('0x227')]>0x0){var _0x258756=_0x30034c['dialLimitQueue']-_0x30034c[_0x35dd('0xa7')]-_0x30034c[_0x35dd('0x5c')];if(_0x258756>0x0){this['tryOriginatePredictive'](_0x30034c);}else{loggerPredictiveCalls['info'](_0x35dd('0x22c'));}}else{this[_0x35dd('0x22d')](_0x30034c);}};Dialer[_0x35dd('0xbb')]['tryOriginatePredictive']=function(_0xe6bb34){var _0x2ae6c5=this;var _0x8e1b02=[];_0xe6bb34[_0x35dd('0xa7')]+=0x1;for(var _0x1221ce in this['agents']){if(typeof this[_0x35dd('0x24')][_0x1221ce]!=='undefined'){if(this[_0x35dd('0x24')][_0x1221ce][_0x35dd('0xb7')]===_0x35dd('0x228')&&this['agents'][_0x1221ce][_0x35dd('0xc1')]==='reachable'){_0x8e1b02[_0x35dd('0x141')](this[_0x35dd('0x24')][_0x1221ce]['id']);}}}this['getContactDialer'](_0xe6bb34['id'],_0x8e1b02,0x1,_0xe6bb34[_0x35dd('0x224')],_0xe6bb34)[_0x35dd('0x42')](function(_0x3c774a){if(!checkContactEmpty(_0x3c774a)){checkContactLowerLimitOriginate(_0xe6bb34,0x1,0x0);_0x2ae6c5[_0x35dd('0xc7')](_0xe6bb34)[_0x35dd('0x42')](sendMessageReschedule(_0xe6bb34))[_0x35dd('0xc2')](loggerCatch(_0x35dd('0xc9')));}else{_0xe6bb34[_0x35dd('0x45')]=_0x35dd('0x22a');if(_['isNil'](_0x3c774a[0x0])||_['isNil'](_0x3c774a[0x0]['Contact'])||_[_0x35dd('0xc0')](_0x3c774a[0x0][_0x35dd('0x191')])){_0x2ae6c5['emptyContact'](_0x35dd('0x225'),_0xe6bb34,_0x3c774a[0x0]);}else{_0x2ae6c5[_0x35dd('0xca')](_['pick'](_0x3c774a[0x0],[_0x35dd('0x110'),'phone']))[_0x35dd('0x42')](_0x2ae6c5['checkContactBlack'](_0xe6bb34,_0x3c774a[0x0]))['catch'](_0x2ae6c5['loggerHandler']('[actionOriginatePredictive]\x20',_0xe6bb34));}}})['catch'](loggerGetContactDialer(_0x35dd('0x22e'),_0xe6bb34,0x1));emitVoiceQueueSummary(_0xe6bb34);};Dialer[_0x35dd('0xbb')][_0x35dd('0x203')]=function(_0x96776c,_0x32c9dc,_0x3d70cc,_0x200c29,_0x3539e3,_0x422fb5){loggerPredictive[_0x35dd('0x8a')](_0x35dd('0x22f'));loggerPredictive[_0x35dd('0x8a')](_0x35dd('0x230'),_0x96776c);loggerPredictive['info'](_0x35dd('0x231'),_0x32c9dc);loggerPredictive[_0x35dd('0x8a')]('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',_0x3d70cc);loggerPredictive[_0x35dd('0x8a')](_0x35dd('0x232'),_0x200c29);loggerPredictive['info'](_0x35dd('0x233'),_0x3539e3);loggerPredictive[_0x35dd('0x8a')]('---------------------------');return new Promise(function(_0x66439e,_0xd2a827){if(_0x96776c<=0x0||isNaN(_0x96776c)){return _0xd2a827(msgResponse('[abandonmentRate]',_0x35dd('0x50'),_0x35dd('0x234')+_0x96776c));}if(_0x3d70cc<=0x0||isNaN(_0x3d70cc)){return _0xd2a827(msgResponse('[abandonmentRate]',_0x35dd('0x50'),'Ts\x20=\x20'+_0x3d70cc));}if(_0x200c29<=0x0||isNaN(_0x200c29)){return _0xd2a827(msgResponse(_0x35dd('0x235'),_0x35dd('0x50'),_0x35dd('0x236')+_0x200c29));}if(_0x32c9dc<=0x0||isNaN(_0x32c9dc)){return _0xd2a827(msgResponse(_0x35dd('0x235'),_0x35dd('0x50'),'interval\x20=\x20'+_0x32c9dc));}if(_0x3539e3<=0x0||isNaN(_0x3539e3)){return _0xd2a827(msgResponse(_0x35dd('0x235'),_0x35dd('0x50'),_0x35dd('0x237')+_0x3539e3));}_0x422fb5=_0x422fb5||0x0;var _0x465d03=0x1/_0x3d70cc;var _0x52928d=0x0;var _0x9b164=0x0;var _0x8c956b=0x0;var _0x450c08=0x0;for(var _0x3af563=0x0;_0x8c956b<_0x3539e3;_0x3af563+=0x1){_0x9b164=_0x3af563/_0x32c9dc;_0x52928d=(_0x200c29*_0x9b164+_0x422fb5)/_0x465d03;_0x8c956b=erlangb(_0x52928d,_0x96776c);_0x450c08=_0x52928d/_0x96776c*(0x1-erlangb(_0x52928d,_0x96776c));}return _0x66439e({'erlangCalls':_0x3af563,'erlangCallToSecond':_0x32c9dc/_0x3af563,'erlangAbandonmentRate':_0x8c956b,'erlangBusyFactor':_0x450c08});});};Dialer['prototype'][_0x35dd('0x205')]=function(_0x5a3f53,_0x217377,_0x11890c,_0x28905f,_0x4db47d,_0x52b2b5){loggerPredictive[_0x35dd('0x8a')](_0x35dd('0x238'));loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5a3f53);loggerPredictive[_0x35dd('0x8a')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x217377);loggerPredictive[_0x35dd('0x8a')](_0x35dd('0x239'),_0x11890c);loggerPredictive[_0x35dd('0x8a')](_0x35dd('0x232'),_0x28905f);loggerPredictive[_0x35dd('0x8a')](_0x35dd('0x23a'),_0x4db47d);loggerPredictive[_0x35dd('0x8a')](_0x35dd('0x90'));return new Promise(function(_0x14c80e,_0x109197){if(_0x5a3f53<=0x0||isNaN(_0x5a3f53)){return _0x109197(msgResponse(_0x35dd('0x23b'),_0x35dd('0x50'),_0x35dd('0x234')+_0x5a3f53));}if(_0x11890c<=0x0||isNaN(_0x11890c)){return _0x109197(msgResponse(_0x35dd('0x23b'),'Error',_0x35dd('0x23c')+_0x11890c));}if(_0x28905f<=0x0||isNaN(_0x28905f)){return _0x109197(msgResponse('[busyFactor]','Error',_0x35dd('0x236')+_0x28905f));}if(_0x217377<=0x0||isNaN(_0x217377)){return _0x109197(msgResponse(_0x35dd('0x23b'),_0x35dd('0x50'),_0x35dd('0x23d')+_0x217377));}if(_0x4db47d<=0x0||isNaN(_0x4db47d)){return _0x109197(msgResponse('[busyFactor]',_0x35dd('0x50'),_0x35dd('0x23e')+_0x4db47d));}_0x52b2b5=_0x52b2b5||0x0;var _0x1149cc=0x1/_0x11890c;var _0x1feda4=0x0;var _0xc98057=0x0;var _0x15399f=0x0;var _0x5d153f=0x0;for(var _0x5d67ec=0x0;_0x5d153f<_0x4db47d;_0x5d67ec+=0x1){_0xc98057=_0x5d67ec/_0x217377;_0x1feda4=(_0x28905f*_0xc98057+_0x52b2b5)/_0x1149cc;_0x15399f=erlangb(_0x1feda4,_0x5a3f53);_0x5d153f=_0x1feda4/_0x5a3f53*(0x1-erlangb(_0x1feda4,_0x5a3f53));}return _0x14c80e({'erlangCalls':_0x5d67ec,'erlangCallToSecond':_0x217377/_0x5d67ec,'erlangAbandonmentRate':_0x15399f,'erlangBusyFactor':_0x5d153f});});};module[_0x35dd('0x23f')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 4c8907e..c2569c0 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 _0xcf81=['lodash','moment','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','droptime','endtime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util'];(function(_0x1f239e,_0x367b43){var _0x826971=function(_0x2c5777){while(--_0x2c5777){_0x1f239e['push'](_0x1f239e['shift']());}};_0x826971(++_0x367b43);}(_0xcf81,0x199));var _0x1cf8=function(_0x1ebf76,_0x482439){_0x1ebf76=_0x1ebf76-0x0;var _0x5a2e6d=_0xcf81[_0x1ebf76];return _0x5a2e6d;};'use strict';var util=require(_0x1cf8('0x0'));var _=require(_0x1cf8('0x1'));var moment=require(_0x1cf8('0x2'));function getSeconds(_0x4f0183,_0x538073){var _0x58c781=moment(_0x4f0183)[_0x1cf8('0x3')](0x0);var _0x56e81d=moment(_0x538073)[_0x1cf8('0x3')](0x0);return _0x58c781[_0x1cf8('0x4')](_0x56e81d,'seconds');}function QueueCallerAbandon(_0x32fc27,_0x314ab5){this[_0x1cf8('0x5')]=_0x32fc27['scheduledat'];this[_0x1cf8('0x6')]=_0x32fc27[_0x1cf8('0x6')];this[_0x1cf8('0x7')]=_0x32fc27['type']===_0x1cf8('0x8')?_0x1cf8('0x9'):_0x32fc27[_0x1cf8('0x6')];this[_0x1cf8('0xa')]=_0x32fc27['countbusyretry'];this[_0x1cf8('0xb')]=_0x32fc27[_0x1cf8('0xb')];this[_0x1cf8('0xc')]=_0x32fc27[_0x1cf8('0xc')];this['countglobal']=_0x32fc27[_0x1cf8('0xa')]+_0x32fc27[_0x1cf8('0xb')]+_0x32fc27['countnoanswerretry']+_0x32fc27[_0x1cf8('0xd')]+_0x32fc27[_0x1cf8('0xe')]+_0x32fc27[_0x1cf8('0xf')]+_0x32fc27[_0x1cf8('0x10')]+_0x32fc27['countagentrejectretry'];this[_0x1cf8('0xd')]=_0x32fc27['countnosuchnumberretry'];this[_0x1cf8('0xe')]=_0x32fc27['countdropretry'];this[_0x1cf8('0xf')]=_0x32fc27[_0x1cf8('0xf')];this[_0x1cf8('0x10')]=_0x32fc27['countmachineretry'];this[_0x1cf8('0x11')]=_0x32fc27['countagentrejectretry'];this[_0x1cf8('0x12')]=_0x314ab5[_0x1cf8('0x12')];this[_0x1cf8('0x13')]=_0x32fc27['name'];this['calleridnum']=_0x32fc27[_0x1cf8('0x14')];this[_0x1cf8('0x15')]=_0x32fc27[_0x1cf8('0x15')];this[_0x1cf8('0x16')]=_0x32fc27[_0x1cf8('0x16')];this[_0x1cf8('0x17')]=_0x32fc27[_0x1cf8('0x17')];this[_0x1cf8('0x18')]=this[_0x1cf8('0x17')];this['ringtime']=getSeconds(_0x32fc27[_0x1cf8('0x16')],_0x32fc27[_0x1cf8('0x15')]);this[_0x1cf8('0x19')]=getSeconds(this[_0x1cf8('0x17')],_0x32fc27[_0x1cf8('0x16')]);this[_0x1cf8('0x1a')]=0x0;this[_0x1cf8('0x9')]=_0x314ab5['queue'];this['membername']=_0x314ab5[_0x1cf8('0x1b')];this[_0x1cf8('0x1c')]=_0x314ab5[_0x1cf8('0x1c')];this[_0x1cf8('0x1d')]=_0x32fc27['callback'];this[_0x1cf8('0x1e')]=_0x32fc27[_0x1cf8('0x1e')];this[_0x1cf8('0x1f')]=_0x32fc27[_0x1cf8('0x1f')];this['recallme']=_0x32fc27[_0x1cf8('0x20')];this[_0x1cf8('0x21')]=_0x32fc27[_0x1cf8('0x21')];this[_0x1cf8('0x22')]=_0x32fc27[_0x1cf8('0x22')];this[_0x1cf8('0x23')]=_0x32fc27[_0x1cf8('0x23')];this[_0x1cf8('0x24')]=_0x32fc27[_0x1cf8('0x24')];this['CampaignId']=_0x32fc27[_0x1cf8('0x25')];this[_0x1cf8('0x26')]=_0x32fc27[_0x1cf8('0x26')]||'';this[_0x1cf8('0x27')]=_0x32fc27[_0x1cf8('0x27')]||'';}module[_0x1cf8('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0xc962=['droptime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime'];(function(_0x5aa8e0,_0x1e552c){var _0x4f4060=function(_0x247415){while(--_0x247415){_0x5aa8e0['push'](_0x5aa8e0['shift']());}};_0x4f4060(++_0x1e552c);}(_0xc962,0x6d));var _0x2c96=function(_0x179ec3,_0x2bf538){_0x179ec3=_0x179ec3-0x0;var _0x2ba267=_0xc962[_0x179ec3];return _0x2ba267;};'use strict';var util=require(_0x2c96('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x53fc8d,_0x444b56){var _0x2e7163=moment(_0x53fc8d)[_0x2c96('0x1')](0x0);var _0x1a1faf=moment(_0x444b56)[_0x2c96('0x1')](0x0);return _0x2e7163[_0x2c96('0x2')](_0x1a1faf,_0x2c96('0x3'));}function QueueCallerAbandon(_0x11a936,_0x599a47){this[_0x2c96('0x4')]=_0x11a936[_0x2c96('0x4')];this[_0x2c96('0x5')]=_0x11a936[_0x2c96('0x5')];this[_0x2c96('0x6')]=_0x11a936[_0x2c96('0x5')]===_0x2c96('0x7')?_0x2c96('0x8'):_0x11a936[_0x2c96('0x5')];this['countbusyretry']=_0x11a936['countbusyretry'];this[_0x2c96('0x9')]=_0x11a936[_0x2c96('0x9')];this[_0x2c96('0xa')]=_0x11a936[_0x2c96('0xa')];this[_0x2c96('0xb')]=_0x11a936[_0x2c96('0xc')]+_0x11a936['countcongestionretry']+_0x11a936['countnoanswerretry']+_0x11a936[_0x2c96('0xd')]+_0x11a936[_0x2c96('0xe')]+_0x11a936[_0x2c96('0xf')]+_0x11a936[_0x2c96('0x10')]+_0x11a936[_0x2c96('0x11')];this[_0x2c96('0xd')]=_0x11a936[_0x2c96('0xd')];this['countdropretry']=_0x11a936['countdropretry'];this['countabandonedretry']=_0x11a936[_0x2c96('0xf')];this[_0x2c96('0x10')]=_0x11a936['countmachineretry'];this[_0x2c96('0x11')]=_0x11a936[_0x2c96('0x11')];this['uniqueid']=_0x599a47[_0x2c96('0x12')];this[_0x2c96('0x13')]=_0x11a936[_0x2c96('0x14')];this[_0x2c96('0x15')]=_0x11a936[_0x2c96('0x16')];this[_0x2c96('0x17')]=_0x11a936[_0x2c96('0x17')];this[_0x2c96('0x18')]=_0x11a936[_0x2c96('0x18')];this['droptime']=_0x11a936['droptime'];this[_0x2c96('0x19')]=this[_0x2c96('0x1a')];this[_0x2c96('0x1b')]=getSeconds(_0x11a936['responsetime'],_0x11a936[_0x2c96('0x17')]);this[_0x2c96('0x1c')]=getSeconds(this[_0x2c96('0x1a')],_0x11a936['responsetime']);this[_0x2c96('0x1d')]=0x0;this[_0x2c96('0x8')]=_0x599a47['queue'];this[_0x2c96('0x1e')]=_0x599a47[_0x2c96('0x1f')];this[_0x2c96('0x20')]=_0x599a47[_0x2c96('0x20')];this[_0x2c96('0x21')]=_0x11a936[_0x2c96('0x21')];this[_0x2c96('0x22')]=_0x11a936['callbackuniqueid'];this[_0x2c96('0x23')]=_0x11a936['callbackat'];this['recallme']=_0x11a936[_0x2c96('0x24')];this['ContactId']=_0x11a936[_0x2c96('0x25')];this[_0x2c96('0x26')]=_0x11a936[_0x2c96('0x26')];this[_0x2c96('0x27')]=_0x11a936['UserId'];this[_0x2c96('0x28')]=_0x11a936[_0x2c96('0x28')];this['CampaignId']=_0x11a936[_0x2c96('0x29')];this[_0x2c96('0x2a')]=_0x11a936[_0x2c96('0x2a')]||'';this[_0x2c96('0x2b')]=_0x11a936['originatecalleridname']||'';}module[_0x2c96('0x2c')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 7f513fc..9125ca9 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(_0x9c2956,_0x47998b){var _0x2260c9=function(_0x190635){while(--_0x190635){_0x9c2956['push'](_0x9c2956['shift']());}};_0x2260c9(++_0x47998b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x28868d,_0x125e13){var _0x1aad13=function(_0x119e39){while(--_0x119e39){_0x28868d['push'](_0x28868d['shift']());}};_0x1aad13(++_0x125e13);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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 7efa87a..6ac1049 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 _0x6458=['context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','resolution','transferrate','calleridnum','pagestransferred','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','response','reason','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','AttachmentId','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','Action','variablesAction','execOriginate','addVariables','isTrunkReachable','isNil','active','SIP/%s','unmonitored','checkTrunk','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','uuid','moment','path','tiff2pdf','../../../config/logger','fax','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','channels','faxAccounts','trunks','actions','newchannel','bind','varset','syncNewState','syncNewExten','receivefax','syncOriginateResponse','prototype'];(function(_0x5b274a,_0x3424b3){var _0x137601=function(_0x85558b){while(--_0x85558b){_0x5b274a['push'](_0x5b274a['shift']());}};_0x137601(++_0x3424b3);}(_0x6458,0xc3));var _0x8645=function(_0x2140a2,_0x537416){_0x2140a2=_0x2140a2-0x0;var _0x1dd6e=_0x6458[_0x2140a2];return _0x1dd6e;};'use strict';var util=require('util');var _=require(_0x8645('0x0'));var BPromise=require(_0x8645('0x1'));var uuid=require(_0x8645('0x2'));var moment=require(_0x8645('0x3'));var path=require(_0x8645('0x4'));var tiff2pdf=require(_0x8645('0x5'));var gs=require('./util/gs');var logger=require(_0x8645('0x6'))(_0x8645('0x7'));var ami=require('../ami');var rpcDb=require(_0x8645('0x8'));var Channel=require(_0x8645('0x9'));var ut=require(_0x8645('0xa'));var Action=require(_0x8645('0xb'));var faxAccount=require(_0x8645('0xc'));var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0x479394){this[_0x8645('0xd')]={};this[_0x8645('0xe')]=_0x479394[_0x8645('0xe')];this[_0x8645('0xf')]=_0x479394[_0x8645('0xf')];this[_0x8645('0x10')]={};ami['on'](_0x8645('0x11'),this['syncNewchannel'][_0x8645('0x12')](this));ami['on'](_0x8645('0x13'),this['syncVarSet']['bind'](this));ami['on']('newstate',this[_0x8645('0x14')]['bind'](this));ami['on']('newexten',this[_0x8645('0x15')][_0x8645('0x12')](this));ami['on']('faxstatus',this['syncFaxStatus'][_0x8645('0x12')](this));ami['on'](_0x8645('0x16'),this['syncReceiveFax'][_0x8645('0x12')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on']('originateresponse',this[_0x8645('0x17')][_0x8645('0x12')](this));}Fax[_0x8645('0x18')]['syncNewchannel']=function(_0x14ddcf){if(_0x14ddcf[_0x8645('0x19')]===_0x8645('0x1a')){for(var _0x4ad2d0 in this[_0x8645('0xe')]){if(this[_0x8645('0xe')][_0x8645('0x1b')](_0x4ad2d0)){if(_0x14ddcf[_0x8645('0x1c')]===this[_0x8645('0xe')][_0x4ad2d0][_0x8645('0x1d')]){this[_0x8645('0xd')][_0x14ddcf[_0x8645('0x1e')]]={};this[_0x8645('0xd')][_0x14ddcf[_0x8645('0x1e')]]['channel']=_0x14ddcf[_0x8645('0x1f')];this['channels'][_0x14ddcf['uniqueid']]['id']=this[_0x8645('0xe')][_0x4ad2d0]['id'];this[_0x8645('0xd')][_0x14ddcf[_0x8645('0x1e')]][_0x8645('0x20')]=this[_0x8645('0xe')][_0x4ad2d0][_0x8645('0x20')];logger[_0x8645('0x21')](_0x14ddcf['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x14ddcf['uniqueid']]){this['channels'][_0x14ddcf[_0x8645('0x1e')]]={};this['channels'][_0x14ddcf[_0x8645('0x1e')]][_0x8645('0x1f')]=_0x14ddcf[_0x8645('0x1f')];logger[_0x8645('0x21')](_0x14ddcf[_0x8645('0x1e')],_0x8645('0x22'));}};Fax[_0x8645('0x18')][_0x8645('0x23')]=function(_0x289505){if(this[_0x8645('0xd')][_0x289505[_0x8645('0x1e')]]){for(var _0x563cc8 in _0x289505[_0x8645('0x24')]){if(_0x289505['variable']['hasOwnProperty'](_0x563cc8)){this['channels'][_0x289505[_0x8645('0x1e')]][_0x563cc8]=_0x289505['value'];}}}};Fax[_0x8645('0x18')][_0x8645('0x14')]=function(_0x3ea0b4){if(this[_0x8645('0xd')][_0x3ea0b4[_0x8645('0x1e')]]){this[_0x8645('0xd')][_0x3ea0b4[_0x8645('0x1e')]][_0x8645('0x25')]=_0x3ea0b4['channelstate'];this[_0x8645('0xd')][_0x3ea0b4[_0x8645('0x1e')]][_0x8645('0x26')]=_0x3ea0b4[_0x8645('0x26')];}};Fax[_0x8645('0x18')]['syncNewExten']=function(_0xafb47e){if(this['channels'][_0xafb47e[_0x8645('0x1e')]]){for(var _0x32d378 in _0xafb47e[_0x8645('0x24')]){if(_0xafb47e[_0x8645('0x24')][_0x8645('0x1b')](_0x32d378)){this['channels'][_0xafb47e[_0x8645('0x1e')]][_0x32d378]=_0xafb47e[_0x8645('0x27')];}}}};Fax[_0x8645('0x18')]['syncFaxStatus']=function(_0x4684d2){if(this[_0x8645('0xd')][_0x4684d2[_0x8645('0x1e')]]){this[_0x8645('0xd')][_0x4684d2[_0x8645('0x1e')]][_0x8645('0x28')]=_0x4684d2[_0x8645('0x28')];this[_0x8645('0xd')][_0x4684d2[_0x8645('0x1e')]][_0x8645('0x29')]=_0x4684d2['status'];this[_0x8645('0xd')][_0x4684d2[_0x8645('0x1e')]][_0x8645('0x1d')]=_0x4684d2['localstationid'];this[_0x8645('0xd')][_0x4684d2[_0x8645('0x1e')]]['filename']=_0x4684d2[_0x8645('0x2a')];logger[_0x8645('0x21')](_0x4684d2[_0x8645('0x1e')],_0x8645('0x2b'));}};Fax[_0x8645('0x18')][_0x8645('0x2c')]=function(_0x15e9e4){var _0x593e27=this;if(this[_0x8645('0xd')][_0x15e9e4[_0x8645('0x1e')]]){var _0x1dae90=this[_0x8645('0xd')][_0x15e9e4['uniqueid']]['id'];this['channels'][_0x15e9e4[_0x8645('0x1e')]][_0x8645('0x2d')]=_0x15e9e4[_0x8645('0x2d')];this['channels'][_0x15e9e4[_0x8645('0x1e')]]['pagestransferred']=_0x15e9e4['pagestransferred'];this[_0x8645('0xd')][_0x15e9e4['uniqueid']][_0x8645('0x1d')]=_0x15e9e4[_0x8645('0x1d')];this[_0x8645('0xd')][_0x15e9e4[_0x8645('0x1e')]]['resolution']=_0x15e9e4[_0x8645('0x2e')];this[_0x8645('0xd')][_0x15e9e4['uniqueid']]['transferrate']=_0x15e9e4[_0x8645('0x2f')];this[_0x8645('0xd')][_0x15e9e4['uniqueid']][_0x8645('0x2a')]=_0x15e9e4[_0x8645('0x2a')];this[_0x8645('0xd')][_0x15e9e4[_0x8645('0x1e')]]['calleridnum']=_0x15e9e4[_0x8645('0x30')];if(this['channels'][_0x15e9e4[_0x8645('0x1e')]][_0x8645('0x31')]>0x0){tiff2pdf(_0x15e9e4[_0x8645('0x2a')],_0x8645('0x32'),function(_0x6aa522){logger['info'](_0x15e9e4['uniqueid'],_0x8645('0x33'),_0x6aa522[_0x8645('0x34')]);attachment[_0x8645('0x35')]({'name':path['parse'](_0x15e9e4['filename'])[_0x8645('0x20')],'basename':path[_0x8645('0x36')](_0x15e9e4[_0x8645('0x2a')])[_0x8645('0x20')]+_0x8645('0x37'),'type':_0x8645('0x38')})[_0x8645('0x39')](function(_0x435f37){faxAccount['notify'](_0x1dae90,{'from':_0x15e9e4[_0x8645('0x30')],'mapKey':_0x8645('0x7'),'body':path[_0x8645('0x36')](_0x15e9e4['filename'])[_0x8645('0x20')]+'.pdf','AttachmentId':_0x435f37['id']})[_0x8645('0x3a')](function(_0x588d99){logger[_0x8645('0x3b')](_0x15e9e4['uniqueid'],_0x8645('0x3c'),JSON[_0x8645('0x3d')](_0x588d99));});})[_0x8645('0x3a')](function(_0x1b15c7){logger[_0x8645('0x3b')](_0x15e9e4[_0x8645('0x1e')],'\x20receiveFax\x20',JSON[_0x8645('0x3d')](_0x1b15c7));});});}logger[_0x8645('0x21')](_0x15e9e4[_0x8645('0x1e')],_0x8645('0x3e'));}};Fax['prototype'][_0x8645('0x17')]=function(_0x1a92cd){if(this[_0x8645('0x10')][_0x1a92cd[_0x8645('0x1e')]]){_['merge'](this[_0x8645('0xd')][_0x1a92cd['uniqueid']],_['pick'](_0x1a92cd,[_0x8645('0x3f'),_0x8645('0x40')]));}};function updateStatus(_0x50682c){if(_0x50682c['AttachmentId']){faxMessage[_0x8645('0x41')](_0x50682c['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0x8645('0x39')](function(_0x4d344f){ut[_0x8645('0x42')](_0x8645('0x43'),_0x4d344f);})[_0x8645('0x3a')](function(_0x30c8cd){ut['logger'](_0x8645('0x44'),_0x30c8cd);});}else{ut[_0x8645('0x42')](_0x8645('0x45'));}}Fax[_0x8645('0x18')][_0x8645('0x46')]=function(_0x56ed9e,_0x5aeade,_0x2c5a6b){var _0x47cfba=this;var _0x4604cd={};if(_0x5aeade){_0x4604cd={'read':_0x5aeade};}else{_0x4604cd={'failMessage':_0x2c5a6b};}if(this[_0x8645('0x10')][_0x56ed9e]['AttachmentId']){faxMessage[_0x8645('0x41')](this[_0x8645('0x10')][_0x56ed9e][_0x8645('0x47')],_0x4604cd)['then'](function(_0x150fe2){ut['logger'](_0x8645('0x48'),_0x150fe2);})[_0x8645('0x3a')](function(_0x2cf429){ut[_0x8645('0x42')](_0x8645('0x49'),_0x2cf429);})[_0x8645('0x4a')](function(){delete _0x47cfba['channels'][_0x56ed9e];delete _0x47cfba[_0x8645('0x10')][_0x56ed9e];});}else{ut['logger'](_0x8645('0x4b'));delete this['channels'][_0x56ed9e];delete this[_0x8645('0x10')][_0x56ed9e];}};Fax[_0x8645('0x18')]['syncHangup']=function(_0x214c5f){var _0x5df0f1=this;if(this[_0x8645('0xd')][_0x214c5f['uniqueid']]){if(this[_0x8645('0x10')][_0x214c5f[_0x8645('0x1e')]]){this[_0x8645('0xd')][_0x214c5f['uniqueid']]['id']=this[_0x8645('0x10')][_0x214c5f[_0x8645('0x1e')]]['id'];this['channels'][_0x214c5f[_0x8645('0x1e')]]['name']=this['actions'][_0x214c5f['uniqueid']][_0x8645('0x20')];}logger[_0x8645('0x21')](_0x214c5f[_0x8645('0x1e')],this[_0x8645('0x10')][_0x214c5f[_0x8645('0x1e')]]?_0x8645('0x4c'):_0x8645('0x4d'),JSON[_0x8645('0x3d')](this[_0x8645('0xd')][_0x214c5f[_0x8645('0x1e')]]));if(this[_0x8645('0x10')][_0x214c5f[_0x8645('0x1e')]]){if(this[_0x8645('0xd')][_0x214c5f[_0x8645('0x1e')]][_0x8645('0x4e')]>0x0&&this[_0x8645('0xd')][_0x214c5f[_0x8645('0x1e')]][_0x8645('0x4f')]===_0x8645('0x50')){this[_0x8645('0x46')](_0x214c5f[_0x8645('0x1e')],!![]);}else{this[_0x8645('0x46')](_0x214c5f['uniqueid'],![],this[_0x8645('0xd')][_0x214c5f[_0x8645('0x1e')]][_0x8645('0x51')]?_0x8645('0x52')+this[_0x8645('0xd')][_0x214c5f[_0x8645('0x1e')]]['faxstatusstring']:_0x8645('0x53'));}}}};Fax[_0x8645('0x18')][_0x8645('0x54')]=function(_0xc7b089){var _0x47179b=this;return new BPromise(function(_0x2f3a4b,_0x4cbd79){_0x47179b['execOriginate'](_0xc7b089,_0x47179b[_0x8645('0xe')][_0xc7b089[_0x8645('0x55')]])['then'](function(_0x8bb032){ut[_0x8645('0x42')](_0x8645('0x56'),_0x8bb032);_0x2f3a4b(ut[_0x8645('0x34')](_0x8645('0x57')));})[_0x8645('0x3a')](function(_0x29bbd4){ut[_0x8645('0x42')]('[Fax][execOriginate][failure]',_0x29bbd4);updateStatus(_0xc7b089);_0x4cbd79(ut[_0x8645('0x34')]('Fax\x20failed'));});});};Fax[_0x8645('0x18')]['checkAfterSend']=function(_0x4ef3f8){var _0xfecbcb=this;return new BPromise(function(_0xe17cb6,_0x5150ff){var _0x3d85cf=_0xfecbcb['checkTrunk'](_0xfecbcb[_0x8645('0xe')][_0x4ef3f8['FaxAccountId']]['Trunk'],_0x4ef3f8);if(_0x3d85cf['isValid']){_0xe17cb6(ut['message']('Trunk\x20Reachable'));}else{_0x5150ff(ut[_0x8645('0x34')](_0x3d85cf[_0x8645('0x34')]));}});};function originate(_0x440435,_0x180af1,_0x3e76f2){return new BPromise(function(_0x972d2,_0x4b0e72){if(_0x3e76f2){var _0x2abf0b=util[_0x8645('0x58')](_0x8645('0x59'),path[_0x8645('0x36')](_0x440435['path'])[_0x8645('0x20')],_0x440435[_0x8645('0x4')]);gs[_0x8645('0x5a')](_0x2abf0b)[_0x8645('0x39')](function(){_0x440435[_0x8645('0x4')]=util[_0x8645('0x58')](_0x8645('0x5b'),path[_0x8645('0x36')](_0x440435['path'])[_0x8645('0x5c')],path[_0x8645('0x36')](_0x440435[_0x8645('0x4')])[_0x8645('0x20')]);_0x180af1['XMF-PATH']=_0x440435['path'];ut['logger']('Convert\x20pdf\x20to\x20tif','');ami[_0x8645('0x5d')](ut[_0x8645('0x5e')](_0x440435,_0x180af1))[_0x8645('0x39')](function(_0x566830){_0x972d2(_0x566830);})[_0x8645('0x3a')](function(_0x822710){_0x4b0e72(_0x822710);});})[_0x8645('0x3a')](function(_0x37037){_0x4b0e72(_0x37037);});}else{ami[_0x8645('0x5d')](ut[_0x8645('0x5e')](_0x440435,_0x180af1))[_0x8645('0x39')](function(_0x38b78c){_0x972d2(_0x38b78c);})[_0x8645('0x3a')](function(_0x2575a1){_0x4b0e72(_0x2575a1);});}});}Fax[_0x8645('0x18')][_0x8645('0x5f')]=function(_0x2abece,_0x828d55){var _0x19ff77=this;return new BPromise(function(_0x469bfe,_0x247734){var _0x1f53c2=uuid['v4']();var _0x1b70a6=ut[_0x8645('0x60')](_0x2abece,_0x828d55);_0x19ff77[_0x8645('0x10')][_0x1f53c2]=new Action(_0x1f53c2,_0x828d55,_0x2abece);var _0x45e3ed=_0x19ff77[_0x8645('0x10')][_0x1f53c2];if(path[_0x8645('0x36')](_0x2abece['path'])['ext']===_0x8645('0x37')){originate(_0x45e3ed,_0x1b70a6,!![])[_0x8645('0x39')](function(_0x1972c5){_0x469bfe(_0x1972c5);})[_0x8645('0x3a')](function(_0xc61ddf){_0x247734(_0xc61ddf);});}else{originate(_0x45e3ed,_0x1b70a6,![])[_0x8645('0x39')](function(_0x159c82){_0x469bfe(_0x159c82);})[_0x8645('0x3a')](function(_0x30ec39){_0x247734(_0x30ec39);});}});};Fax[_0x8645('0x18')][_0x8645('0x61')]=function(_0x1b5c90){return!_[_0x8645('0x62')](_0x1b5c90)&&!_[_0x8645('0x62')](_0x1b5c90[_0x8645('0x20')])&&!_[_0x8645('0x62')](_0x1b5c90[_0x8645('0x63')])&&_0x1b5c90[_0x8645('0x63')]&&!_[_0x8645('0x62')](this[_0x8645('0xf')][util[_0x8645('0x58')](_0x8645('0x64'),_0x1b5c90[_0x8645('0x20')])])&&!_[_0x8645('0x62')](this[_0x8645('0xf')][util[_0x8645('0x58')](_0x8645('0x64'),_0x1b5c90[_0x8645('0x20')])][_0x8645('0x29')])&&(this[_0x8645('0xf')][util['format'](_0x8645('0x64'),_0x1b5c90[_0x8645('0x20')])][_0x8645('0x29')]==='reachable'||this[_0x8645('0xf')][util['format'](_0x8645('0x64'),_0x1b5c90['name'])]['status']===_0x8645('0x65'));};Fax[_0x8645('0x18')][_0x8645('0x66')]=function(_0x3d8cc5,_0x17f595){if(!this[_0x8645('0x61')](_0x3d8cc5)){ut[_0x8645('0x42')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x8645('0x62')](_0x3d8cc5)?'':_0x3d8cc5[_0x8645('0x20')]+_0x8645('0x67'));return{'isValid':![],'message':_0x8645('0x68')};}if(_[_0x8645('0x62')](_0x17f595['fax'])){ut[_0x8645('0x42')](_0x8645('0x69'),JSON[_0x8645('0x3d')](_0x17f595));return{'isValid':![],'message':_0x8645('0x6a')};}if(_[_0x8645('0x62')](_0x17f595[_0x8645('0x4')])){ut[_0x8645('0x42')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x8645('0x3d')](_0x17f595));return{'isValid':![],'message':_0x8645('0x6b')};}return{'isValid':!![],'message':_0x8645('0x6c')};};module[_0x8645('0x6d')]=Fax; \ No newline at end of file +var _0x37fb=['faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','newstate','newexten','faxstatus','syncHangup','originateresponse','syncOriginateResponse','context','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','prototype','syncNewState','channelstate','channelstatedesc','value','operation','status','filename','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20failed','checkAfterSend','Trunk','isValid','Trunk\x20Reachable','format','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','variablesAction','Action','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage'];(function(_0x24d0a6,_0x48ff79){var _0xe6e137=function(_0x306c7e){while(--_0x306c7e){_0x24d0a6['push'](_0x24d0a6['shift']());}};_0xe6e137(++_0x48ff79);}(_0x37fb,0x151));var _0xb37f=function(_0x10d83f,_0x45843d){_0x10d83f=_0x10d83f-0x0;var _0x5e2214=_0x37fb[_0x10d83f];return _0x5e2214;};'use strict';var util=require(_0xb37f('0x0'));var _=require(_0xb37f('0x1'));var BPromise=require(_0xb37f('0x2'));var uuid=require(_0xb37f('0x3'));var moment=require(_0xb37f('0x4'));var path=require(_0xb37f('0x5'));var tiff2pdf=require(_0xb37f('0x6'));var gs=require(_0xb37f('0x7'));var logger=require(_0xb37f('0x8'))('fax');var ami=require(_0xb37f('0x9'));var rpcDb=require(_0xb37f('0xa'));var Channel=require(_0xb37f('0xb'));var ut=require(_0xb37f('0xc'));var Action=require(_0xb37f('0xd'));var faxAccount=require(_0xb37f('0xe'));var attachment=require(_0xb37f('0xf'));var faxMessage=require(_0xb37f('0x10'));function Fax(_0x1eb76e){this['channels']={};this[_0xb37f('0x11')]=_0x1eb76e[_0xb37f('0x11')];this[_0xb37f('0x12')]=_0x1eb76e[_0xb37f('0x12')];this[_0xb37f('0x13')]={};ami['on']('newchannel',this[_0xb37f('0x14')][_0xb37f('0x15')](this));ami['on'](_0xb37f('0x16'),this[_0xb37f('0x17')][_0xb37f('0x15')](this));ami['on'](_0xb37f('0x18'),this['syncNewState']['bind'](this));ami['on'](_0xb37f('0x19'),this['syncNewExten']['bind'](this));ami['on'](_0xb37f('0x1a'),this['syncFaxStatus'][_0xb37f('0x15')](this));ami['on']('receivefax',this['syncReceiveFax'][_0xb37f('0x15')](this));ami['on']('hangup',this[_0xb37f('0x1b')][_0xb37f('0x15')](this));ami['on'](_0xb37f('0x1c'),this[_0xb37f('0x1d')][_0xb37f('0x15')](this));}Fax['prototype']['syncNewchannel']=function(_0x9d7890){if(_0x9d7890[_0xb37f('0x1e')]==='from-voip-provider'){for(var _0x14bcb8 in this['faxAccounts']){if(this[_0xb37f('0x11')][_0xb37f('0x1f')](_0x14bcb8)){if(_0x9d7890[_0xb37f('0x20')]===this[_0xb37f('0x11')][_0x14bcb8][_0xb37f('0x21')]){this[_0xb37f('0x22')][_0x9d7890[_0xb37f('0x23')]]={};this[_0xb37f('0x22')][_0x9d7890[_0xb37f('0x23')]]['channel']=_0x9d7890[_0xb37f('0x24')];this[_0xb37f('0x22')][_0x9d7890[_0xb37f('0x23')]]['id']=this[_0xb37f('0x11')][_0x14bcb8]['id'];this['channels'][_0x9d7890[_0xb37f('0x23')]][_0xb37f('0x25')]=this[_0xb37f('0x11')][_0x14bcb8]['name'];logger[_0xb37f('0x26')](_0x9d7890[_0xb37f('0x23')],_0xb37f('0x27'));}}}}if(this['actions'][_0x9d7890[_0xb37f('0x23')]]){this[_0xb37f('0x22')][_0x9d7890[_0xb37f('0x23')]]={};this[_0xb37f('0x22')][_0x9d7890[_0xb37f('0x23')]][_0xb37f('0x24')]=_0x9d7890[_0xb37f('0x24')];logger[_0xb37f('0x26')](_0x9d7890['uniqueid'],_0xb37f('0x27'));}};Fax['prototype']['syncVarSet']=function(_0x29d1c6){if(this[_0xb37f('0x22')][_0x29d1c6[_0xb37f('0x23')]]){for(var _0x2da27c in _0x29d1c6[_0xb37f('0x28')]){if(_0x29d1c6['variable'][_0xb37f('0x1f')](_0x2da27c)){this[_0xb37f('0x22')][_0x29d1c6[_0xb37f('0x23')]][_0x2da27c]=_0x29d1c6['value'];}}}};Fax[_0xb37f('0x29')][_0xb37f('0x2a')]=function(_0xec1cf5){if(this[_0xb37f('0x22')][_0xec1cf5[_0xb37f('0x23')]]){this[_0xb37f('0x22')][_0xec1cf5[_0xb37f('0x23')]][_0xb37f('0x2b')]=_0xec1cf5[_0xb37f('0x2b')];this[_0xb37f('0x22')][_0xec1cf5[_0xb37f('0x23')]][_0xb37f('0x2c')]=_0xec1cf5[_0xb37f('0x2c')];}};Fax[_0xb37f('0x29')]['syncNewExten']=function(_0x16e6b0){if(this[_0xb37f('0x22')][_0x16e6b0[_0xb37f('0x23')]]){for(var _0xd2a161 in _0x16e6b0['variable']){if(_0x16e6b0[_0xb37f('0x28')][_0xb37f('0x1f')](_0xd2a161)){this['channels'][_0x16e6b0[_0xb37f('0x23')]][_0xd2a161]=_0x16e6b0[_0xb37f('0x2d')];}}}};Fax['prototype']['syncFaxStatus']=function(_0xba503e){if(this[_0xb37f('0x22')][_0xba503e[_0xb37f('0x23')]]){this[_0xb37f('0x22')][_0xba503e[_0xb37f('0x23')]][_0xb37f('0x2e')]=_0xba503e['operation'];this[_0xb37f('0x22')][_0xba503e[_0xb37f('0x23')]][_0xb37f('0x2f')]=_0xba503e[_0xb37f('0x2f')];this['channels'][_0xba503e[_0xb37f('0x23')]][_0xb37f('0x21')]=_0xba503e['localstationid'];this[_0xb37f('0x22')][_0xba503e[_0xb37f('0x23')]][_0xb37f('0x30')]=_0xba503e[_0xb37f('0x30')];logger[_0xb37f('0x26')](_0xba503e[_0xb37f('0x23')],'\x20syncFaxStatus\x20');}};Fax[_0xb37f('0x29')][_0xb37f('0x31')]=function(_0x1a5f3a){var _0x251bb0=this;if(this[_0xb37f('0x22')][_0x1a5f3a['uniqueid']]){var _0x5f0893=this[_0xb37f('0x22')][_0x1a5f3a[_0xb37f('0x23')]]['id'];this[_0xb37f('0x22')][_0x1a5f3a[_0xb37f('0x23')]][_0xb37f('0x32')]=_0x1a5f3a[_0xb37f('0x32')];this['channels'][_0x1a5f3a[_0xb37f('0x23')]][_0xb37f('0x33')]=_0x1a5f3a['pagestransferred'];this[_0xb37f('0x22')][_0x1a5f3a[_0xb37f('0x23')]][_0xb37f('0x21')]=_0x1a5f3a[_0xb37f('0x21')];this[_0xb37f('0x22')][_0x1a5f3a[_0xb37f('0x23')]][_0xb37f('0x34')]=_0x1a5f3a[_0xb37f('0x34')];this['channels'][_0x1a5f3a[_0xb37f('0x23')]][_0xb37f('0x35')]=_0x1a5f3a[_0xb37f('0x35')];this[_0xb37f('0x22')][_0x1a5f3a[_0xb37f('0x23')]][_0xb37f('0x30')]=_0x1a5f3a['filename'];this[_0xb37f('0x22')][_0x1a5f3a[_0xb37f('0x23')]][_0xb37f('0x36')]=_0x1a5f3a['calleridnum'];if(this[_0xb37f('0x22')][_0x1a5f3a[_0xb37f('0x23')]][_0xb37f('0x33')]>0x0){tiff2pdf(_0x1a5f3a['filename'],_0xb37f('0x37'),function(_0x1c8b51){logger['info'](_0x1a5f3a[_0xb37f('0x23')],_0xb37f('0x38'),_0x1c8b51[_0xb37f('0x39')]);attachment[_0xb37f('0x3a')]({'name':path[_0xb37f('0x3b')](_0x1a5f3a['filename'])[_0xb37f('0x25')],'basename':path['parse'](_0x1a5f3a[_0xb37f('0x30')])[_0xb37f('0x25')]+_0xb37f('0x3c'),'type':_0xb37f('0x3d')})[_0xb37f('0x3e')](function(_0x1cf3a0){faxAccount[_0xb37f('0x3f')](_0x5f0893,{'from':_0x1a5f3a[_0xb37f('0x36')],'mapKey':_0xb37f('0x40'),'body':path[_0xb37f('0x3b')](_0x1a5f3a['filename'])[_0xb37f('0x25')]+'.pdf','AttachmentId':_0x1cf3a0['id']})[_0xb37f('0x41')](function(_0x1d87a3){logger[_0xb37f('0x42')](_0x1a5f3a['uniqueid'],_0xb37f('0x43'),JSON[_0xb37f('0x44')](_0x1d87a3));});})['catch'](function(_0xd7d9f2){logger['error'](_0x1a5f3a[_0xb37f('0x23')],_0xb37f('0x45'),JSON[_0xb37f('0x44')](_0xd7d9f2));});});}logger['info'](_0x1a5f3a[_0xb37f('0x23')],_0xb37f('0x45'));}};Fax[_0xb37f('0x29')][_0xb37f('0x1d')]=function(_0x244aa0){if(this[_0xb37f('0x13')][_0x244aa0[_0xb37f('0x23')]]){_[_0xb37f('0x46')](this[_0xb37f('0x22')][_0x244aa0['uniqueid']],_[_0xb37f('0x47')](_0x244aa0,[_0xb37f('0x48'),_0xb37f('0x49')]));}};function updateStatus(_0x201f77){if(_0x201f77[_0xb37f('0x4a')]){faxMessage[_0xb37f('0x4b')](_0x201f77['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0xb37f('0x3e')](function(_0x4dcf8b){ut[_0xb37f('0x4c')](_0xb37f('0x4d'),_0x4dcf8b);})[_0xb37f('0x41')](function(_0x363e20){ut[_0xb37f('0x4c')](_0xb37f('0x4e'),_0x363e20);});}else{ut[_0xb37f('0x4c')]('[Fax][Message][Error][NoUpdate2]');}}Fax['prototype'][_0xb37f('0x4f')]=function(_0x5b1106,_0x25dc47,_0xae4539){var _0x4980c2=this;var _0x28935b={};if(_0x25dc47){_0x28935b={'read':_0x25dc47};}else{_0x28935b={'failMessage':_0xae4539};}if(this[_0xb37f('0x13')][_0x5b1106][_0xb37f('0x4a')]){faxMessage[_0xb37f('0x4b')](this[_0xb37f('0x13')][_0x5b1106][_0xb37f('0x4a')],_0x28935b)['then'](function(_0x351d16){ut[_0xb37f('0x4c')](_0xb37f('0x50'),_0x351d16);})[_0xb37f('0x41')](function(_0x1a05d5){ut[_0xb37f('0x4c')](_0xb37f('0x51'),_0x1a05d5);})['finally'](function(){delete _0x4980c2[_0xb37f('0x22')][_0x5b1106];delete _0x4980c2[_0xb37f('0x13')][_0x5b1106];});}else{ut[_0xb37f('0x4c')](_0xb37f('0x52'));delete this['channels'][_0x5b1106];delete this['actions'][_0x5b1106];}};Fax[_0xb37f('0x29')]['syncHangup']=function(_0x241410){var _0x70a5ae=this;if(this[_0xb37f('0x22')][_0x241410['uniqueid']]){if(this[_0xb37f('0x13')][_0x241410['uniqueid']]){this[_0xb37f('0x22')][_0x241410['uniqueid']]['id']=this[_0xb37f('0x13')][_0x241410[_0xb37f('0x23')]]['id'];this[_0xb37f('0x22')][_0x241410[_0xb37f('0x23')]][_0xb37f('0x25')]=this[_0xb37f('0x13')][_0x241410[_0xb37f('0x23')]][_0xb37f('0x25')];}logger['info'](_0x241410[_0xb37f('0x23')],this[_0xb37f('0x13')][_0x241410['uniqueid']]?_0xb37f('0x53'):_0xb37f('0x54'),JSON[_0xb37f('0x44')](this['channels'][_0x241410[_0xb37f('0x23')]]));if(this[_0xb37f('0x13')][_0x241410['uniqueid']]){if(this[_0xb37f('0x22')][_0x241410[_0xb37f('0x23')]][_0xb37f('0x55')]>0x0&&this[_0xb37f('0x22')][_0x241410[_0xb37f('0x23')]][_0xb37f('0x1a')]===_0xb37f('0x56')){this[_0xb37f('0x4f')](_0x241410[_0xb37f('0x23')],!![]);}else{this['updateStatus'](_0x241410[_0xb37f('0x23')],![],this['channels'][_0x241410['uniqueid']][_0xb37f('0x57')]?_0xb37f('0x58')+this[_0xb37f('0x22')][_0x241410[_0xb37f('0x23')]][_0xb37f('0x57')]:_0xb37f('0x59'));}}}};Fax[_0xb37f('0x29')]['send']=function(_0x4f7b51){var _0x206e85=this;return new BPromise(function(_0x27c39b,_0x12cde5){_0x206e85[_0xb37f('0x5a')](_0x4f7b51,_0x206e85[_0xb37f('0x11')][_0x4f7b51[_0xb37f('0x5b')]])[_0xb37f('0x3e')](function(_0x232b54){ut[_0xb37f('0x4c')](_0xb37f('0x5c'),_0x232b54);_0x27c39b(ut[_0xb37f('0x39')]('Fax\x20received'));})['catch'](function(_0x24cca6){ut[_0xb37f('0x4c')]('[Fax][execOriginate][failure]',_0x24cca6);updateStatus(_0x4f7b51);_0x12cde5(ut[_0xb37f('0x39')](_0xb37f('0x5d')));});});};Fax[_0xb37f('0x29')][_0xb37f('0x5e')]=function(_0x4075cb){var _0x3e77fe=this;return new BPromise(function(_0x10c181,_0x4de529){var _0x2eba30=_0x3e77fe['checkTrunk'](_0x3e77fe[_0xb37f('0x11')][_0x4075cb[_0xb37f('0x5b')]][_0xb37f('0x5f')],_0x4075cb);if(_0x2eba30[_0xb37f('0x60')]){_0x10c181(ut[_0xb37f('0x39')](_0xb37f('0x61')));}else{_0x4de529(ut[_0xb37f('0x39')](_0x2eba30[_0xb37f('0x39')]));}});};function originate(_0x30334b,_0x4c91b0,_0x432b92){return new BPromise(function(_0x491fdb,_0x57464f){if(_0x432b92){var _0x1c07be=util[_0xb37f('0x62')]('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[_0xb37f('0x3b')](_0x30334b[_0xb37f('0x5')])[_0xb37f('0x25')],_0x30334b[_0xb37f('0x5')]);gs[_0xb37f('0x63')](_0x1c07be)[_0xb37f('0x3e')](function(){_0x30334b['path']=util['format'](_0xb37f('0x64'),path['parse'](_0x30334b[_0xb37f('0x5')])[_0xb37f('0x65')],path[_0xb37f('0x3b')](_0x30334b['path'])[_0xb37f('0x25')]);_0x4c91b0['XMF-PATH']=_0x30334b[_0xb37f('0x5')];ut[_0xb37f('0x4c')](_0xb37f('0x66'),'');ami['Action'](ut[_0xb37f('0x67')](_0x30334b,_0x4c91b0))[_0xb37f('0x3e')](function(_0x27db9a){_0x491fdb(_0x27db9a);})[_0xb37f('0x41')](function(_0x2c223b){_0x57464f(_0x2c223b);});})['catch'](function(_0x388a60){_0x57464f(_0x388a60);});}else{ami[_0xb37f('0x68')](ut['variablesAction'](_0x30334b,_0x4c91b0))[_0xb37f('0x3e')](function(_0x339513){_0x491fdb(_0x339513);})[_0xb37f('0x41')](function(_0x8292ce){_0x57464f(_0x8292ce);});}});}Fax[_0xb37f('0x29')][_0xb37f('0x5a')]=function(_0x575b29,_0x23c64a){var _0xf50f4b=this;return new BPromise(function(_0x24186c,_0x921918){var _0xe9b5a1=uuid['v4']();var _0x1fe723=ut['addVariables'](_0x575b29,_0x23c64a);_0xf50f4b[_0xb37f('0x13')][_0xe9b5a1]=new Action(_0xe9b5a1,_0x23c64a,_0x575b29);var _0x3675a3=_0xf50f4b[_0xb37f('0x13')][_0xe9b5a1];if(path[_0xb37f('0x3b')](_0x575b29['path'])['ext']===_0xb37f('0x3c')){originate(_0x3675a3,_0x1fe723,!![])[_0xb37f('0x3e')](function(_0x2cdc51){_0x24186c(_0x2cdc51);})['catch'](function(_0x150a00){_0x921918(_0x150a00);});}else{originate(_0x3675a3,_0x1fe723,![])['then'](function(_0x495c2c){_0x24186c(_0x495c2c);})['catch'](function(_0x3d90b7){_0x921918(_0x3d90b7);});}});};Fax[_0xb37f('0x29')]['isTrunkReachable']=function(_0x27516f){return!_['isNil'](_0x27516f)&&!_[_0xb37f('0x69')](_0x27516f[_0xb37f('0x25')])&&!_['isNil'](_0x27516f[_0xb37f('0x6a')])&&_0x27516f['active']&&!_[_0xb37f('0x69')](this[_0xb37f('0x12')][util[_0xb37f('0x62')](_0xb37f('0x6b'),_0x27516f[_0xb37f('0x25')])])&&!_[_0xb37f('0x69')](this[_0xb37f('0x12')][util[_0xb37f('0x62')](_0xb37f('0x6b'),_0x27516f['name'])][_0xb37f('0x2f')])&&(this[_0xb37f('0x12')][util[_0xb37f('0x62')]('SIP/%s',_0x27516f[_0xb37f('0x25')])][_0xb37f('0x2f')]===_0xb37f('0x6c')||this['trunks'][util[_0xb37f('0x62')](_0xb37f('0x6b'),_0x27516f[_0xb37f('0x25')])]['status']===_0xb37f('0x6d'));};Fax[_0xb37f('0x29')][_0xb37f('0x6e')]=function(_0x356383,_0x51fe52){if(!this['isTrunkReachable'](_0x356383)){ut[_0xb37f('0x4c')](_0xb37f('0x6f'),_[_0xb37f('0x69')](_0x356383)?'':_0x356383[_0xb37f('0x25')]+_0xb37f('0x70'));return{'isValid':![],'message':_0xb37f('0x71')};}if(_[_0xb37f('0x69')](_0x51fe52['fax'])){ut[_0xb37f('0x4c')](_0xb37f('0x72'),JSON[_0xb37f('0x44')](_0x51fe52));return{'isValid':![],'message':_0xb37f('0x73')};}if(_['isNil'](_0x51fe52['path'])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x51fe52));return{'isValid':![],'message':_0xb37f('0x74')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xb37f('0x75')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 9e0a792..6b2435d 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 _0xb571=['../../../config/logger','preview','lodash','../rpc/faxAccount','notify','catch','util','bluebird'];(function(_0x1e0843,_0x9fa430){var _0x93aeeb=function(_0xa594b0){while(--_0xa594b0){_0x1e0843['push'](_0x1e0843['shift']());}};_0x93aeeb(++_0x9fa430);}(_0xb571,0x1d6));var _0x1b57=function(_0x20fcc9,_0x5ee8b9){_0x20fcc9=_0x20fcc9-0x0;var _0x6e2114=_0xb571[_0x20fcc9];return _0x6e2114;};'use strict';var util=require(_0x1b57('0x0'));var BPromise=require(_0x1b57('0x1'));var logger=require(_0x1b57('0x2'))(_0x1b57('0x3'));var _=require(_0x1b57('0x4'));var faxAccount=require(_0x1b57('0x5'));function loggerCatch(_0x287871){return function(_0x3ac4d2){logger['error'](_0x287871,util['inspect'](_0x3ac4d2,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x12d871,_0x2e8f49){return BPromise['resolve']()['then'](faxAccount[_0x1b57('0x6')](_0x12d871,_0x2e8f49))[_0x1b57('0x7')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0xdf50=['notify','resolve','then','catch','[Notify]\x20','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','inspect'];(function(_0x14d896,_0x53578b){var _0x28679a=function(_0x14921f){while(--_0x14921f){_0x14d896['push'](_0x14d896['shift']());}};_0x28679a(++_0x53578b);}(_0xdf50,0xc0));var _0x0df5=function(_0x3a24b8,_0x1b7651){_0x3a24b8=_0x3a24b8-0x0;var _0x502dd8=_0xdf50[_0x3a24b8];return _0x502dd8;};'use strict';var util=require('util');var BPromise=require(_0x0df5('0x0'));var logger=require(_0x0df5('0x1'))(_0x0df5('0x2'));var _=require(_0x0df5('0x3'));var faxAccount=require(_0x0df5('0x4'));function loggerCatch(_0x1f5382){return function(_0x190d5b){logger['error'](_0x1f5382,util[_0x0df5('0x5')](_0x190d5b,{'showHidden':![],'depth':null}));};}exports[_0x0df5('0x6')]=function(_0x510b76,_0x25d528){return BPromise[_0x0df5('0x7')]()[_0x0df5('0x8')](faxAccount['notify'](_0x510b76,_0x25d528))[_0x0df5('0x9')](loggerCatch(_0x0df5('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index c6e4d88..0cf070e 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 _0xb491=['exec','execute','info','\x20Error\x20:','inspect','fax','bluebird','child_process'];(function(_0x921c7f,_0x2af506){var _0x1c1ce9=function(_0x2b2274){while(--_0x2b2274){_0x921c7f['push'](_0x921c7f['shift']());}};_0x1c1ce9(++_0x2af506);}(_0xb491,0x105));var _0x1b49=function(_0xcaf223,_0xd39f07){_0xcaf223=_0xcaf223-0x0;var _0x17e00d=_0xb491[_0xcaf223];return _0x17e00d;};'use strict';var util=require('util');var logger=require('../../../../config/logger')(_0x1b49('0x0'));var BPromise=require(_0x1b49('0x1'));var exec=require(_0x1b49('0x2'))[_0x1b49('0x3')];exports[_0x1b49('0x4')]=function(_0x59659b){return new BPromise(function(_0x224bd0,_0x416ba8){exec(_0x59659b,function(_0x164718,_0x5bc22d,_0x29ffc3){logger[_0x1b49('0x5')]('Exec\x20gs',_0x5bc22d);if(_0x164718){logger['info']('Exec\x20gs',_0x1b49('0x6'),util[_0x1b49('0x7')](_0x164718,{'showHidden':![],'depth':null}),_0x5bc22d,_0x29ffc3);_0x416ba8(_0x164718);}_0x224bd0(_0x5bc22d);});});}; \ No newline at end of file +var _0xdfd3=['exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird'];(function(_0xb6fd84,_0x43e55c){var _0x534b61=function(_0x2f077a){while(--_0x2f077a){_0xb6fd84['push'](_0xb6fd84['shift']());}};_0x534b61(++_0x43e55c);}(_0xdfd3,0x182));var _0x3dfd=function(_0x1fb7d1,_0x108781){_0x1fb7d1=_0x1fb7d1-0x0;var _0x2480d8=_0xdfd3[_0x1fb7d1];return _0x2480d8;};'use strict';var util=require(_0x3dfd('0x0'));var logger=require(_0x3dfd('0x1'))(_0x3dfd('0x2'));var BPromise=require(_0x3dfd('0x3'));var exec=require('child_process')[_0x3dfd('0x4')];exports[_0x3dfd('0x5')]=function(_0x2acbab){return new BPromise(function(_0x1ca36a,_0x593db9){exec(_0x2acbab,function(_0x4242c6,_0x491587,_0x59ea9d){logger[_0x3dfd('0x6')]('Exec\x20gs',_0x491587);if(_0x4242c6){logger[_0x3dfd('0x6')](_0x3dfd('0x7'),_0x3dfd('0x8'),util[_0x3dfd('0x9')](_0x4242c6,{'showHidden':![],'depth':null}),_0x491587,_0x59ea9d);_0x593db9(_0x4242c6);}_0x1ca36a(_0x491587);});});}; \ 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 75598e9..d91bb51 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 _0xb373=['addVariables','ecm','headerinfo','minrate','format','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','path','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','uniqueid','lodash','moment','fax','message','info','inspect'];(function(_0x367fc6,_0x528ed7){var _0xb28f69=function(_0x4c1fa0){while(--_0x4c1fa0){_0x367fc6['push'](_0x367fc6['shift']());}};_0xb28f69(++_0x528ed7);}(_0xb373,0xb7));var _0x3b37=function(_0x1c0024,_0x28446c){_0x1c0024=_0x1c0024-0x0;var _0x43732c=_0xb373[_0x1c0024];return _0x43732c;};'use strict';var util=require('util');var _=require(_0x3b37('0x0'));var moment=require(_0x3b37('0x1'));var logger=require('../../../../config/logger')(_0x3b37('0x2'));exports[_0x3b37('0x3')]=function(_0x63a6bf){return{'message':_0x63a6bf};};exports['logger']=function(_0x30ae31,_0x55942e){logger[_0x3b37('0x4')](_0x30ae31,util[_0x3b37('0x5')](_0x55942e,{'showHidden':![],'depth':null}));};exports[_0x3b37('0x6')]=function(_0x260093,_0x5a6ccf){var _0x2beef8={'XMF-ECM':_0x5a6ccf[_0x3b37('0x7')],'XMF-HEADERINFO':_0x5a6ccf[_0x3b37('0x8')],'XMF-MINRATE':_0x5a6ccf[_0x3b37('0x9')],'XMF-MAXRATE':_0x5a6ccf['maxrate'],'XMF-MODEM':util[_0x3b37('0xa')](_0x3b37('0xb'),_0x5a6ccf[_0x3b37('0xc')]),'XMF-GATEWAY':_0x5a6ccf['gateway'],'XMF-FAXDETECT':_0x5a6ccf[_0x3b37('0xd')],'XMF-T38TIMEOUT':_0x5a6ccf[_0x3b37('0xe')],'XMF-LOCALSTATIONID':_0x5a6ccf[_0x3b37('0xf')],'XMF-PATH':_0x260093[_0x3b37('0x10')]};return _0x2beef8;};exports['variablesAction']=function(_0xeed70a,_0x35cc9b){return{'actionid':_0xeed70a['uniqueid'],'action':'originate','channel':_0xeed70a[_0x3b37('0x11')],'Exten':_0x3b37('0x12'),'Context':'from-sip','Priority':'1','callerid':util[_0x3b37('0xa')](_0x3b37('0x13'),_0xeed70a[_0x3b37('0x8')]?_0xeed70a[_0x3b37('0x8')]:'',_0xeed70a['localstationid']),'variable':_0x35cc9b,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xeed70a[_0x3b37('0x14')]};}; \ No newline at end of file +var _0x6326=['originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','localstationid','lodash','../../../../config/logger','fax','message','logger','info','addVariables','headerinfo','minrate','maxrate','format','modem','faxdetect','path','variablesAction','uniqueid'];(function(_0x2ba740,_0x62a305){var _0x358bda=function(_0x16cc07){while(--_0x16cc07){_0x2ba740['push'](_0x2ba740['shift']());}};_0x358bda(++_0x62a305);}(_0x6326,0x101));var _0x6632=function(_0x38037a,_0x196abc){_0x38037a=_0x38037a-0x0;var _0x1a1246=_0x6326[_0x38037a];return _0x1a1246;};'use strict';var util=require('util');var _=require(_0x6632('0x0'));var moment=require('moment');var logger=require(_0x6632('0x1'))(_0x6632('0x2'));exports[_0x6632('0x3')]=function(_0x2c66bf){return{'message':_0x2c66bf};};exports[_0x6632('0x4')]=function(_0x524488,_0x571ccf){logger[_0x6632('0x5')](_0x524488,util['inspect'](_0x571ccf,{'showHidden':![],'depth':null}));};exports[_0x6632('0x6')]=function(_0x54c609,_0x58c561){var _0x1703db={'XMF-ECM':_0x58c561['ecm'],'XMF-HEADERINFO':_0x58c561[_0x6632('0x7')],'XMF-MINRATE':_0x58c561[_0x6632('0x8')],'XMF-MAXRATE':_0x58c561[_0x6632('0x9')],'XMF-MODEM':util[_0x6632('0xa')]('\x22%s\x22',_0x58c561[_0x6632('0xb')]),'XMF-GATEWAY':_0x58c561['gateway'],'XMF-FAXDETECT':_0x58c561[_0x6632('0xc')],'XMF-T38TIMEOUT':_0x58c561['t38timeout'],'XMF-LOCALSTATIONID':_0x58c561['localstationid'],'XMF-PATH':_0x54c609[_0x6632('0xd')]};return _0x1703db;};exports[_0x6632('0xe')]=function(_0xc0e5c6,_0x338c1e){return{'actionid':_0xc0e5c6[_0x6632('0xf')],'action':_0x6632('0x10'),'channel':_0xc0e5c6[_0x6632('0x11')],'Exten':_0x6632('0x12'),'Context':'from-sip','Priority':'1','callerid':util[_0x6632('0xa')](_0x6632('0x13'),_0xc0e5c6['headerinfo']?_0xc0e5c6[_0x6632('0x7')]:'',_0xc0e5c6[_0x6632('0x14')]),'variable':_0x338c1e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xc0e5c6[_0x6632('0xf')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 788c3fe..602f473 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 _0x49e5=['getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getVoiceCallReports','catch','error','inspect','listen','sync','moment','./server','./realtime','./acw','./trigger','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','then','initAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','getTemplates','initTemplates'];(function(_0x4fd87c,_0x326aa3){var _0x4b3177=function(_0x31e785){while(--_0x31e785){_0x4fd87c['push'](_0x4fd87c['shift']());}};_0x4b3177(++_0x326aa3);}(_0x49e5,0xdd));var _0x549e=function(_0x43ad35,_0x3071d8){_0x43ad35=_0x43ad35-0x0;var _0x26e158=_0x49e5[_0x43ad35];return _0x26e158;};'use strict';var util=require('util');var moment=require(_0x549e('0x0'));var server=require(_0x549e('0x1'));var Realtime=require(_0x549e('0x2'));var Report=require('./report');var Acw=require(_0x549e('0x3'));var Trigger=require(_0x549e('0x4'));var Dialer=require('./dialer');var Preview=require(_0x549e('0x5'));var Fax=require('./fax');var user=require(_0x549e('0x6'));var voiceQueue=require(_0x549e('0x7'));var voiceQueueReport=require(_0x549e('0x8'));var voiceCallReport=require(_0x549e('0x9'));var trunk=require('./rpc/trunk');var trigger=require(_0x549e('0xa'));var template=require(_0x549e('0xb'));var cmHopperHistory=require(_0x549e('0xc'));var campaign=require(_0x549e('0xd'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x549e('0xe'));var zendesk=require(_0x549e('0xf'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x549e('0x10'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x549e('0x11'));var zoho=require(_0x549e('0x12'));var vtiger=require(_0x549e('0x13'));var freshsales=require(_0x549e('0x14'));var servicenow=require(_0x549e('0x15'));var dynamics365=require(_0x549e('0x16'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x549e('0x17'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x549e('0x18')](_0x549e('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x549e('0x18')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()['then'](user['getAgents']())[_0x549e('0x1a')](realtime[_0x549e('0x1b')]())[_0x549e('0x1a')](user[_0x549e('0x1c')]())[_0x549e('0x1a')](realtime['initTelephones']())[_0x549e('0x1a')](trunk[_0x549e('0x1d')]())[_0x549e('0x1a')](realtime[_0x549e('0x1e')]())[_0x549e('0x1a')](voiceQueue[_0x549e('0x1f')]())[_0x549e('0x1a')](realtime['initVoiceQueues']())[_0x549e('0x1a')](trigger[_0x549e('0x20')]())[_0x549e('0x1a')](realtime['initTriggers']())[_0x549e('0x1a')](template[_0x549e('0x21')]())[_0x549e('0x1a')](realtime[_0x549e('0x22')]())[_0x549e('0x1a')](zendesk[_0x549e('0x23')]())[_0x549e('0x1a')](realtime[_0x549e('0x24')]())[_0x549e('0x1a')](salesforce[_0x549e('0x25')]())['then'](realtime[_0x549e('0x26')]())['then'](sugarcrm['getSugarcrmAccounts']())[_0x549e('0x1a')](realtime[_0x549e('0x27')]())['then'](freshdesk[_0x549e('0x28')]())[_0x549e('0x1a')](realtime['initFreshdeskAccounts']())[_0x549e('0x1a')](desk[_0x549e('0x29')]())[_0x549e('0x1a')](realtime['initDeskAccounts']())[_0x549e('0x1a')](zoho[_0x549e('0x2a')]())[_0x549e('0x1a')](realtime[_0x549e('0x2b')]())[_0x549e('0x1a')](vtiger['getVtigerAccounts']())['then'](realtime[_0x549e('0x2c')]())[_0x549e('0x1a')](freshsales[_0x549e('0x2d')]())[_0x549e('0x1a')](realtime['initFreshsalesAccounts']())[_0x549e('0x1a')](servicenow[_0x549e('0x2e')]())['then'](realtime[_0x549e('0x2f')]())[_0x549e('0x1a')](dynamics365[_0x549e('0x30')]())[_0x549e('0x1a')](realtime['initDynamics365Accounts']())['then'](campaign[_0x549e('0x31')]())[_0x549e('0x1a')](realtime[_0x549e('0x32')]())[_0x549e('0x1a')](voiceExtension['getVoiceExtensions']())[_0x549e('0x1a')](realtime[_0x549e('0x33')]())['then'](faxAccount[_0x549e('0x34')]())[_0x549e('0x1a')](realtime[_0x549e('0x35')]())[_0x549e('0x1a')](function(){return realtime;});}function initParams(){return Promise[_0x549e('0x36')]()[_0x549e('0x1a')](voiceQueueReport[_0x549e('0x37')]())[_0x549e('0x1a')](realtime[_0x549e('0x38')]())[_0x549e('0x1a')](cmHopperHistory[_0x549e('0x39')]())[_0x549e('0x1a')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime['initCampaignHopperHistory']())[_0x549e('0x1a')](voiceCallReport[_0x549e('0x3a')]())[_0x549e('0x1a')](realtime['initVoiceCallReports']())[_0x549e('0x3b')](function(_0x29d2a0){logger[_0x549e('0x3c')]('[index.js][initParams]',util[_0x549e('0x3d')](_0x29d2a0,{'showHidden':![],'depth':null}));});}function main(){return server[_0x549e('0x3e')](realtime,preview,fax)[_0x549e('0x1a')](function(){return initRealtime();})[_0x549e('0x1a')](function(){return initParams();})[_0x549e('0x1a')](function(){report[_0x549e('0x3f')]();setInterval(initRealtime,0x1388);})[_0x549e('0x3b')](function(_0x27af22){logger[_0x549e('0x3c')]('[index.js][main]',util[_0x549e('0x3d')](_0x27af22,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xa4bc=['initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','[index.js][initParams]','inspect','error','util','moment','./realtime','./report','./acw','./trigger','./dialer','./preview','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','initAgents','getTelephones','initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','initServicenowAccounts','initDynamics365Accounts'];(function(_0x986be3,_0x4224b9){var _0x18c8bb=function(_0x57d7e7){while(--_0x57d7e7){_0x986be3['push'](_0x986be3['shift']());}};_0x18c8bb(++_0x4224b9);}(_0xa4bc,0x116));var _0xca4b=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0xa4bc[_0x56fe98];return _0x212f4f;};'use strict';var util=require(_0xca4b('0x0'));var moment=require(_0xca4b('0x1'));var server=require('./server');var Realtime=require(_0xca4b('0x2'));var Report=require(_0xca4b('0x3'));var Acw=require(_0xca4b('0x4'));var Trigger=require(_0xca4b('0x5'));var Dialer=require(_0xca4b('0x6'));var Preview=require(_0xca4b('0x7'));var Fax=require('./fax');var user=require('./rpc/user');var voiceQueue=require(_0xca4b('0x8'));var voiceQueueReport=require(_0xca4b('0x9'));var voiceCallReport=require(_0xca4b('0xa'));var trunk=require(_0xca4b('0xb'));var trigger=require(_0xca4b('0xc'));var template=require(_0xca4b('0xd'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xca4b('0xe'));var voiceExtension=require(_0xca4b('0xf'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xca4b('0x10'));var salesforce=require(_0xca4b('0x11'));var sugarcrm=require(_0xca4b('0x12'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xca4b('0x13'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xca4b('0x14'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xca4b('0x15'));var dynamics365=require(_0xca4b('0x16'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xca4b('0x17'))(_0xca4b('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xca4b('0x19')](_0xca4b('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xca4b('0x19')](_0xca4b('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xca4b('0x1b')]()[_0xca4b('0x1c')](user['getAgents']())[_0xca4b('0x1c')](realtime[_0xca4b('0x1d')]())[_0xca4b('0x1c')](user[_0xca4b('0x1e')]())[_0xca4b('0x1c')](realtime['initTelephones']())[_0xca4b('0x1c')](trunk['getTrunks']())['then'](realtime[_0xca4b('0x1f')]())['then'](voiceQueue['getVoiceQueues']())[_0xca4b('0x1c')](realtime[_0xca4b('0x20')]())[_0xca4b('0x1c')](trigger[_0xca4b('0x21')]())[_0xca4b('0x1c')](realtime[_0xca4b('0x22')]())['then'](template[_0xca4b('0x23')]())[_0xca4b('0x1c')](realtime[_0xca4b('0x24')]())[_0xca4b('0x1c')](zendesk[_0xca4b('0x25')]())[_0xca4b('0x1c')](realtime[_0xca4b('0x26')]())[_0xca4b('0x1c')](salesforce[_0xca4b('0x27')]())[_0xca4b('0x1c')](realtime[_0xca4b('0x28')]())[_0xca4b('0x1c')](sugarcrm[_0xca4b('0x29')]())['then'](realtime[_0xca4b('0x2a')]())[_0xca4b('0x1c')](freshdesk['getFreshdeskAccounts']())[_0xca4b('0x1c')](realtime[_0xca4b('0x2b')]())['then'](desk['getDeskAccounts']())[_0xca4b('0x1c')](realtime[_0xca4b('0x2c')]())[_0xca4b('0x1c')](zoho[_0xca4b('0x2d')]())['then'](realtime[_0xca4b('0x2e')]())[_0xca4b('0x1c')](vtiger[_0xca4b('0x2f')]())[_0xca4b('0x1c')](realtime[_0xca4b('0x30')]())['then'](freshsales['getFreshsalesAccounts']())[_0xca4b('0x1c')](realtime[_0xca4b('0x31')]())[_0xca4b('0x1c')](servicenow['getServicenowAccounts']())['then'](realtime[_0xca4b('0x32')]())['then'](dynamics365['getDynamics365Accounts']())[_0xca4b('0x1c')](realtime[_0xca4b('0x33')]())[_0xca4b('0x1c')](campaign['getCampaigns']())[_0xca4b('0x1c')](realtime['initCampaigns']())[_0xca4b('0x1c')](voiceExtension['getVoiceExtensions']())[_0xca4b('0x1c')](realtime[_0xca4b('0x34')]())[_0xca4b('0x1c')](faxAccount[_0xca4b('0x35')]())[_0xca4b('0x1c')](realtime[_0xca4b('0x36')]())[_0xca4b('0x1c')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0xca4b('0x1c')](voiceQueueReport['getVoiceQueueReports']())[_0xca4b('0x1c')](realtime[_0xca4b('0x37')]())['then'](cmHopperHistory[_0xca4b('0x38')]())['then'](realtime[_0xca4b('0x39')]())['then'](cmHopperHistory[_0xca4b('0x3a')]())[_0xca4b('0x1c')](realtime[_0xca4b('0x3b')]())[_0xca4b('0x1c')](voiceCallReport[_0xca4b('0x3c')]())['then'](realtime[_0xca4b('0x3d')]())[_0xca4b('0x3e')](function(_0x55cb4a){logger['error'](_0xca4b('0x3f'),util[_0xca4b('0x40')](_0x55cb4a,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0xca4b('0x1c')](function(){return initRealtime();})[_0xca4b('0x1c')](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xca4b('0x3e')](function(_0x22a01a){logger[_0xca4b('0x41')]('[index.js][main]',util[_0xca4b('0x40')](_0x22a01a,{'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 6678069..c250bb0 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 _0x8da0=['name','email','accountcode','state','unknown','stateTime','status','address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','toLowerCase','not_inuse','idle','inuse','talking','statePause','format','fullname','interface','md5','emit','user:save','user:presence','exports','lodash','util','moment','ioredis','defaults','redis'];(function(_0x33670a,_0x55e188){var _0x36ad1d=function(_0x3cacbb){while(--_0x3cacbb){_0x33670a['push'](_0x33670a['shift']());}};_0x36ad1d(++_0x55e188);}(_0x8da0,0x135));var _0x08da=function(_0x32af2e,_0x387757){_0x32af2e=_0x32af2e-0x0;var _0x4e00d8=_0x8da0[_0x32af2e];return _0x4e00d8;};'use strict';var _=require(_0x08da('0x0'));var util=require(_0x08da('0x1'));var moment=require(_0x08da('0x2'));var md5=require('md5');var Redis=require(_0x08da('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x08da('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x08da('0x5')]));function Agent(_0x8fd120){this['id']=_0x8fd120['id']||0x0;this[_0x08da('0x6')]=_0x8fd120[_0x08da('0x6')]||'';this[_0x08da('0x7')]=_0x8fd120[_0x08da('0x7')]||'';this[_0x08da('0x8')]=_0x8fd120[_0x08da('0x8')]||'';this['fullname']=_0x8fd120['fullname']||'';this[_0x08da('0x9')]=_0x08da('0xa');this[_0x08da('0xb')]=0x0;this[_0x08da('0xc')]=_0x08da('0xa');this[_0x08da('0xd')]='';this[_0x08da('0xe')]='';this['mobile']='';this['interface']='';this[_0x08da('0xf')]=_0x8fd120[_0x08da('0xf')]||![];this[_0x08da('0x10')]=_0x08da('0xa');this[_0x08da('0x11')]=0x0;this[_0x08da('0x12')]='';this[_0x08da('0x13')]='';this['onhold']=![];this[_0x08da('0x14')]=![];this['md5']='';}Agent['prototype']['updateStatusRealtime']=function(_0x4d4e2f){var _0x3d6c8f;if(_0x4d4e2f&&_0x4d4e2f[_0x08da('0x9')]){_0x3d6c8f=_0x4d4e2f[_0x08da('0x9')][_0x08da('0x15')]();switch(_0x3d6c8f){case _0x08da('0x16'):_0x3d6c8f=_0x08da('0x17');break;case _0x08da('0x18'):_0x3d6c8f=_0x08da('0x19');break;}}if(_0x3d6c8f&&this['voiceStatus']!==_0x3d6c8f||_0x4d4e2f[_0x08da('0x1a')]){this[_0x08da('0x11')]=_['toNumber'](moment()[_0x08da('0x1b')]('x'));}if(_0x3d6c8f){this[_0x08da('0x10')]=_0x3d6c8f;}var _0x483d9d={'id':this['id'],'name':this[_0x08da('0x6')],'email':this[_0x08da('0x7')],'accountcode':this[_0x08da('0x8')],'fullname':this[_0x08da('0x1c')],'state':this[_0x08da('0x9')],'stateTime':this[_0x08da('0xb')],'status':this[_0x08da('0xc')],'address':this[_0x08da('0xd')],'online':this[_0x08da('0xf')],'voiceStatus':this[_0x08da('0x10')],'voiceStatusTime':this[_0x08da('0x11')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x08da('0x13')],'interface':this[_0x08da('0x1d')],'onhold':this['onhold']};var _0x10a9a3=md5(JSON['stringify'](_0x483d9d));if(this[_0x08da('0x1e')]!==_0x10a9a3){this[_0x08da('0x1e')]=_0x10a9a3;io['to'](util[_0x08da('0x1b')]('user:%s',_0x483d9d[_0x08da('0x6')]))[_0x08da('0x1f')](_0x08da('0x20'),_0x483d9d);io[_0x08da('0x1f')](_0x08da('0x21'),_0x483d9d);}};module[_0x08da('0x22')]=Agent; \ No newline at end of file +var _0x2539=['updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format','voiceStatus','address','voiceStatusCallerIdNumber','stringify','user:%s','emit','user:save','lodash','util','moment','md5','ioredis','../../../config/environment','defaults','redis','name','email','accountcode','fullname','state','stateTime','status','unknown','phone','interface','online','voiceStatusTime','voiceStatusQueue','onhold','local','prototype'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2539,0x147));var _0x9253=function(_0x19df33,_0xfd64aa){_0x19df33=_0x19df33-0x0;var _0x5cae77=_0x2539[_0x19df33];return _0x5cae77;};'use strict';var _=require(_0x9253('0x0'));var util=require(_0x9253('0x1'));var moment=require(_0x9253('0x2'));var md5=require(_0x9253('0x3'));var Redis=require(_0x9253('0x4'));var config=require(_0x9253('0x5'));config['redis']=_[_0x9253('0x6')](config[_0x9253('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9253('0x7')]));function Agent(_0x5c3245){this['id']=_0x5c3245['id']||0x0;this[_0x9253('0x8')]=_0x5c3245['name']||'';this[_0x9253('0x9')]=_0x5c3245[_0x9253('0x9')]||'';this[_0x9253('0xa')]=_0x5c3245[_0x9253('0xa')]||'';this[_0x9253('0xb')]=_0x5c3245[_0x9253('0xb')]||'';this[_0x9253('0xc')]='unknown';this[_0x9253('0xd')]=0x0;this[_0x9253('0xe')]=_0x9253('0xf');this['address']='';this[_0x9253('0x10')]='';this['mobile']='';this[_0x9253('0x11')]='';this[_0x9253('0x12')]=_0x5c3245[_0x9253('0x12')]||![];this['voiceStatus']='unknown';this[_0x9253('0x13')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x9253('0x14')]='';this[_0x9253('0x15')]=![];this[_0x9253('0x16')]=![];this['md5']='';}Agent[_0x9253('0x17')][_0x9253('0x18')]=function(_0x40c5db){var _0x3f0e1f;if(_0x40c5db&&_0x40c5db[_0x9253('0xc')]){_0x3f0e1f=_0x40c5db['state'][_0x9253('0x19')]();switch(_0x3f0e1f){case _0x9253('0x1a'):_0x3f0e1f=_0x9253('0x1b');break;case _0x9253('0x1c'):_0x3f0e1f='talking';break;}}if(_0x3f0e1f&&this['voiceStatus']!==_0x3f0e1f||_0x40c5db[_0x9253('0x1d')]){this[_0x9253('0x13')]=_[_0x9253('0x1e')](moment()[_0x9253('0x1f')]('x'));}if(_0x3f0e1f){this[_0x9253('0x20')]=_0x3f0e1f;}var _0x335802={'id':this['id'],'name':this[_0x9253('0x8')],'email':this[_0x9253('0x9')],'accountcode':this[_0x9253('0xa')],'fullname':this['fullname'],'state':this[_0x9253('0xc')],'stateTime':this[_0x9253('0xd')],'status':this['status'],'address':this[_0x9253('0x21')],'online':this['online'],'voiceStatus':this[_0x9253('0x20')],'voiceStatusTime':this[_0x9253('0x13')],'voiceStatusCallerIdNumber':this[_0x9253('0x22')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x9253('0x11')],'onhold':this[_0x9253('0x15')]};var _0x255d09=md5(JSON[_0x9253('0x23')](_0x335802));if(this[_0x9253('0x3')]!==_0x255d09){this[_0x9253('0x3')]=_0x255d09;io['to'](util[_0x9253('0x1f')](_0x9253('0x24'),_0x335802[_0x9253('0x8')]))[_0x9253('0x25')](_0x9253('0x26'),_0x335802);io[_0x9253('0x25')]('user:presence',_0x335802);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 2d5e03e..afb1efb 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 _0x105e=['dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','exports','name','type','temp','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry'];(function(_0x31e965,_0xbd1e54){var _0x120351=function(_0x45229d){while(--_0x45229d){_0x31e965['push'](_0x31e965['shift']());}};_0x120351(++_0xbd1e54);}(_0x105e,0x190));var _0xe105=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x105e[_0x14add3];return _0x4a174f;};'use strict';function Campaign(_0x5d1551){this['id']=_0x5d1551['id']||0x0;this[_0xe105('0x0')]=_0x5d1551['name']||'';this[_0xe105('0x1')]=_0x5d1551[_0xe105('0x1')]||'campaign';this['originated']=0x0;this[_0xe105('0x2')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0xe105('0x3')]=!![];this['active']=_0x5d1551[_0xe105('0x4')];this[_0xe105('0x5')]=_0x5d1551[_0xe105('0x5')];this[_0xe105('0x6')]=_0x5d1551[_0xe105('0x6')]||null;this[_0xe105('0x7')]=_0x5d1551[_0xe105('0x7')]?_0x5d1551[_0xe105('0x7')]:null;this[_0xe105('0x8')]=_0x5d1551[_0xe105('0x8')];this['dialOriginateCallerIdNumber']=_0x5d1551[_0xe105('0x9')];this['dialOriginateTimeout']=_0x5d1551[_0xe105('0xa')]||0x1e;this[_0xe105('0xb')]=_0x5d1551[_0xe105('0xb')];this['dialCongestionRetryFrequency']=_0x5d1551[_0xe105('0xc')];this[_0xe105('0xd')]=_0x5d1551[_0xe105('0xd')];this[_0xe105('0xe')]=_0x5d1551[_0xe105('0xe')];this[_0xe105('0xf')]=_0x5d1551[_0xe105('0xf')];this[_0xe105('0x10')]=_0x5d1551[_0xe105('0x10')];this[_0xe105('0x11')]=_0x5d1551[_0xe105('0x11')];this[_0xe105('0x12')]=_0x5d1551[_0xe105('0x12')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x5d1551['dialNoSuchNumberRetryFrequency']||0x96;this[_0xe105('0x13')]=_0x5d1551['dialDropMaxRetry']||0x3;this[_0xe105('0x14')]=_0x5d1551[_0xe105('0x14')]||0x96;this['dialAbandonedMaxRetry']=_0x5d1551[_0xe105('0x15')]||0x3;this[_0xe105('0x16')]=_0x5d1551[_0xe105('0x16')]||0x96;this[_0xe105('0x17')]=_0x5d1551[_0xe105('0x17')]||0x3;this[_0xe105('0x18')]=_0x5d1551[_0xe105('0x18')]||0x96;this[_0xe105('0x19')]=_0x5d1551[_0xe105('0x19')]||0x3;this[_0xe105('0x1a')]=_0x5d1551[_0xe105('0x1a')]||0x96;this[_0xe105('0x1b')]=_0x5d1551[_0xe105('0x1b')]||_0xe105('0x1c');this['dialPrefix']=_0x5d1551[_0xe105('0x1d')]||undefined;this[_0xe105('0x1e')]=_0x5d1551[_0xe105('0x1e')]||undefined;this['dialCutDigit']=_0x5d1551['dialCutDigit']||undefined;this['TrunkBackup']=_0x5d1551[_0xe105('0x1f')]?_0x5d1551[_0xe105('0x1f')]:undefined;this['Trunk']=_0x5d1551[_0xe105('0x20')]?_0x5d1551[_0xe105('0x20')]:undefined;this[_0xe105('0x21')]=_0x5d1551['Interval']?_0x5d1551[_0xe105('0x21')]:undefined;this['SquareProject']=_0x5d1551[_0xe105('0x22')]?_0x5d1551[_0xe105('0x22')]:undefined;this[_0xe105('0x23')]=_0x5d1551[_0xe105('0x22')]?_0x5d1551[_0xe105('0x22')][_0xe105('0x0')]:undefined;this[_0xe105('0x24')]=_0x5d1551[_0xe105('0x24')]||![];this[_0xe105('0x25')]=_0x5d1551[_0xe105('0x25')];this[_0xe105('0x26')]=_0x5d1551['dialAMDGreeting'];this[_0xe105('0x27')]=_0x5d1551['dialAMDAfterGreetingSilence'];this[_0xe105('0x28')]=_0x5d1551[_0xe105('0x28')];this[_0xe105('0x29')]=_0x5d1551[_0xe105('0x29')];this[_0xe105('0x2a')]=_0x5d1551['dialAMDBetweenWordsSilence'];this[_0xe105('0x2b')]=_0x5d1551[_0xe105('0x2b')];this['dialAMDSilenceThreshold']=_0x5d1551[_0xe105('0x2c')];this['dialAMDMaximumWordLength']=_0x5d1551['dialAMDMaximumWordLength'];}module[_0xe105('0x2d')]=Campaign; \ No newline at end of file +var _0xefb1=['dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence'];(function(_0x1b8d98,_0x37ed79){var _0x87d0c7=function(_0x2e0222){while(--_0x2e0222){_0x1b8d98['push'](_0x1b8d98['shift']());}};_0x87d0c7(++_0x37ed79);}(_0xefb1,0x94));var _0x1efb=function(_0x57f964,_0x4589d0){_0x57f964=_0x57f964-0x0;var _0x3661f6=_0xefb1[_0x57f964];return _0x3661f6;};'use strict';function Campaign(_0x3b5cd7){this['id']=_0x3b5cd7['id']||0x0;this[_0x1efb('0x0')]=_0x3b5cd7['name']||'';this[_0x1efb('0x1')]=_0x3b5cd7[_0x1efb('0x1')]||'campaign';this[_0x1efb('0x2')]=0x0;this[_0x1efb('0x3')]=0x0;this[_0x1efb('0x4')]=0x0;this[_0x1efb('0x5')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this[_0x1efb('0x6')]=_0x3b5cd7[_0x1efb('0x6')];this[_0x1efb('0x7')]=_0x3b5cd7['limitCalls'];this[_0x1efb('0x8')]=_0x3b5cd7[_0x1efb('0x8')]||null;this['dialGlobalInterval']=_0x3b5cd7[_0x1efb('0x9')]?_0x3b5cd7['dialGlobalInterval']:null;this[_0x1efb('0xa')]=_0x3b5cd7[_0x1efb('0xa')];this[_0x1efb('0xb')]=_0x3b5cd7[_0x1efb('0xb')];this[_0x1efb('0xc')]=_0x3b5cd7[_0x1efb('0xc')]||0x1e;this[_0x1efb('0xd')]=_0x3b5cd7[_0x1efb('0xd')];this[_0x1efb('0xe')]=_0x3b5cd7[_0x1efb('0xe')];this[_0x1efb('0xf')]=_0x3b5cd7['dialBusyMaxRetry'];this[_0x1efb('0x10')]=_0x3b5cd7[_0x1efb('0x10')];this[_0x1efb('0x11')]=_0x3b5cd7[_0x1efb('0x11')];this[_0x1efb('0x12')]=_0x3b5cd7[_0x1efb('0x12')];this[_0x1efb('0x13')]=_0x3b5cd7[_0x1efb('0x13')];this[_0x1efb('0x14')]=_0x3b5cd7['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x3b5cd7[_0x1efb('0x15')]||0x96;this[_0x1efb('0x16')]=_0x3b5cd7[_0x1efb('0x16')]||0x3;this[_0x1efb('0x17')]=_0x3b5cd7[_0x1efb('0x17')]||0x96;this[_0x1efb('0x18')]=_0x3b5cd7[_0x1efb('0x18')]||0x3;this[_0x1efb('0x19')]=_0x3b5cd7[_0x1efb('0x19')]||0x96;this[_0x1efb('0x1a')]=_0x3b5cd7[_0x1efb('0x1a')]||0x3;this[_0x1efb('0x1b')]=_0x3b5cd7['dialMachineRetryFrequency']||0x96;this[_0x1efb('0x1c')]=_0x3b5cd7[_0x1efb('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x3b5cd7['dialAgentRejectRetryFrequency']||0x96;this[_0x1efb('0x1d')]=_0x3b5cd7[_0x1efb('0x1d')]||'DESC';this[_0x1efb('0x1e')]=_0x3b5cd7['dialPrefix']||undefined;this[_0x1efb('0x1f')]=_0x3b5cd7[_0x1efb('0x1f')]||undefined;this['dialCutDigit']=_0x3b5cd7['dialCutDigit']||undefined;this[_0x1efb('0x20')]=_0x3b5cd7[_0x1efb('0x20')]?_0x3b5cd7['TrunkBackup']:undefined;this[_0x1efb('0x21')]=_0x3b5cd7[_0x1efb('0x21')]?_0x3b5cd7[_0x1efb('0x21')]:undefined;this[_0x1efb('0x22')]=_0x3b5cd7[_0x1efb('0x22')]?_0x3b5cd7[_0x1efb('0x22')]:undefined;this['SquareProject']=_0x3b5cd7[_0x1efb('0x23')]?_0x3b5cd7[_0x1efb('0x23')]:undefined;this[_0x1efb('0x24')]=_0x3b5cd7[_0x1efb('0x23')]?_0x3b5cd7[_0x1efb('0x23')][_0x1efb('0x0')]:undefined;this[_0x1efb('0x25')]=_0x3b5cd7[_0x1efb('0x25')]||![];this[_0x1efb('0x26')]=_0x3b5cd7[_0x1efb('0x26')];this[_0x1efb('0x27')]=_0x3b5cd7[_0x1efb('0x27')];this['dialAMDAfterGreetingSilence']=_0x3b5cd7[_0x1efb('0x28')];this[_0x1efb('0x29')]=_0x3b5cd7[_0x1efb('0x29')];this[_0x1efb('0x2a')]=_0x3b5cd7[_0x1efb('0x2a')];this[_0x1efb('0x2b')]=_0x3b5cd7[_0x1efb('0x2b')];this[_0x1efb('0x2c')]=_0x3b5cd7[_0x1efb('0x2c')];this['dialAMDSilenceThreshold']=_0x3b5cd7[_0x1efb('0x2d')];this[_0x1efb('0x2e')]=_0x3b5cd7[_0x1efb('0x2e')];}module[_0x1efb('0x2f')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index c0c15b0..4cbba30 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 _0x4910=['monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinenum','connectedlinename','accountcode','context','linkedid','exten','answered','answertime','endtime','abandoned','lastapplication','lastdata','duration','billableseconds','type','disposition'];(function(_0x5d5b95,_0x397591){var _0x27bb1e=function(_0x38ed91){while(--_0x38ed91){_0x5d5b95['push'](_0x5d5b95['shift']());}};_0x27bb1e(++_0x397591);}(_0x4910,0x1d9));var _0x0491=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4910[_0x17d9e3];return _0x14192d;};'use strict';function Channel(){this[_0x0491('0x0')]=null;this[_0x0491('0x1')]='';this[_0x0491('0x2')]='';this['calleridnum']=0x0;this[_0x0491('0x3')]='';this[_0x0491('0x4')]=undefined;this[_0x0491('0x5')]=undefined;this[_0x0491('0x6')]=0x0;this[_0x0491('0x7')]='';this['uniqueid']=0x0;this[_0x0491('0x8')]=0x0;this[_0x0491('0x9')]=0x0;this[_0x0491('0xa')]=![];this[_0x0491('0xb')]=null;this[_0x0491('0xc')]=null;this['unmanaged']=![];this[_0x0491('0xd')]=![];this[_0x0491('0xe')]='';this[_0x0491('0xf')]='';this[_0x0491('0x10')]=0x0;this[_0x0491('0x11')]=0x0;this['holdtime']=0x0;this[_0x0491('0x12')]=null;this['tag']=null;this[_0x0491('0x13')]=null;this[_0x0491('0x14')]=![];this[_0x0491('0x15')]=null;this[_0x0491('0x16')]=null;this[_0x0491('0x17')]=[];this[_0x0491('0x18')]=undefined;this[_0x0491('0x19')]=undefined;this[_0x0491('0x1a')]=undefined;this[_0x0491('0x1b')]=0x0;}module[_0x0491('0x1c')]=Channel; \ No newline at end of file +var _0x6d0c=['queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','accountcode','linkedid','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename'];(function(_0x5a9a97,_0x405349){var _0x19d83a=function(_0x10c5d4){while(--_0x10c5d4){_0x5a9a97['push'](_0x5a9a97['shift']());}};_0x19d83a(++_0x405349);}(_0x6d0c,0x8c));var _0xc6d0=function(_0x1f0936,_0x29c748){_0x1f0936=_0x1f0936-0x0;var _0x5b69ae=_0x6d0c[_0x1f0936];return _0x5b69ae;};'use strict';function Channel(){this[_0xc6d0('0x0')]=null;this[_0xc6d0('0x1')]='';this[_0xc6d0('0x2')]='';this[_0xc6d0('0x3')]=0x0;this[_0xc6d0('0x4')]='';this[_0xc6d0('0x5')]=undefined;this['connectedlinename']=undefined;this[_0xc6d0('0x6')]=0x0;this['context']='';this['uniqueid']=0x0;this[_0xc6d0('0x7')]=0x0;this['exten']=0x0;this['answered']=![];this[_0xc6d0('0x8')]=null;this[_0xc6d0('0x9')]=null;this[_0xc6d0('0xa')]=![];this[_0xc6d0('0xb')]=![];this[_0xc6d0('0xc')]='';this[_0xc6d0('0xd')]='';this[_0xc6d0('0xe')]=0x0;this[_0xc6d0('0xf')]=0x0;this[_0xc6d0('0x10')]=0x0;this[_0xc6d0('0x11')]=null;this[_0xc6d0('0x12')]=null;this[_0xc6d0('0x13')]=null;this[_0xc6d0('0x14')]=![];this[_0xc6d0('0x15')]=null;this[_0xc6d0('0x16')]=null;this[_0xc6d0('0x17')]=[];this[_0xc6d0('0x18')]=undefined;this[_0xc6d0('0x19')]=undefined;this[_0xc6d0('0x1a')]=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 033cc8b..959a20b 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 _0x1d2d=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name'];(function(_0x1b9438,_0x5081c6){var _0x132e53=function(_0xf906ef){while(--_0xf906ef){_0x1b9438['push'](_0x1b9438['shift']());}};_0x132e53(++_0x5081c6);}(_0x1d2d,0x113));var _0xd1d2=function(_0x5b3e02,_0x4e7179){_0x5b3e02=_0x5b3e02-0x0;var _0x1ee64b=_0x1d2d[_0x5b3e02];return _0x1ee64b;};'use strict';function DeskAccount(_0x2e6cd0){this['id']=_0x2e6cd0['id']||0x0;this[_0xd1d2('0x0')]=_0x2e6cd0[_0xd1d2('0x0')]||'';this['username']=_0x2e6cd0[_0xd1d2('0x1')]||'';this[_0xd1d2('0x2')]=_0x2e6cd0[_0xd1d2('0x2')]||'';this[_0xd1d2('0x3')]=_0x2e6cd0[_0xd1d2('0x3')]||'';this[_0xd1d2('0x4')]=_0x2e6cd0[_0xd1d2('0x4')]||'';this[_0xd1d2('0x5')]=_0x2e6cd0[_0xd1d2('0x5')]||'';this[_0xd1d2('0x6')]=_0x2e6cd0[_0xd1d2('0x6')]||'';this[_0xd1d2('0x7')]=_0x2e6cd0[_0xd1d2('0x7')]||'';this['tokenSecret']=_0x2e6cd0[_0xd1d2('0x8')]||'';this['type']=_0x2e6cd0[_0xd1d2('0x9')]||'';this[_0xd1d2('0xa')]=_0x2e6cd0[_0xd1d2('0xa')]||'';this['Configurations']=_0x2e6cd0[_0xd1d2('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x6b7c=['Configurations','name','username','remoteUri','authType','password','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b7c,0x1cf));var _0xc6b7=function(_0x35747a,_0x5763f4){_0x35747a=_0x35747a-0x0;var _0x224e75=_0x6b7c[_0x35747a];return _0x224e75;};'use strict';function DeskAccount(_0x22aa1e){this['id']=_0x22aa1e['id']||0x0;this[_0xc6b7('0x0')]=_0x22aa1e[_0xc6b7('0x0')]||'';this[_0xc6b7('0x1')]=_0x22aa1e[_0xc6b7('0x1')]||'';this[_0xc6b7('0x2')]=_0x22aa1e[_0xc6b7('0x2')]||'';this[_0xc6b7('0x3')]=_0x22aa1e[_0xc6b7('0x3')]||'';this[_0xc6b7('0x4')]=_0x22aa1e[_0xc6b7('0x4')]||'';this['consumerKey']=_0x22aa1e['consumerKey']||'';this[_0xc6b7('0x5')]=_0x22aa1e[_0xc6b7('0x5')]||'';this[_0xc6b7('0x6')]=_0x22aa1e[_0xc6b7('0x6')]||'';this[_0xc6b7('0x7')]=_0x22aa1e[_0xc6b7('0x7')]||'';this[_0xc6b7('0x8')]=_0x22aa1e['type']||'';this[_0xc6b7('0x9')]=_0x22aa1e[_0xc6b7('0x9')]||'';this[_0xc6b7('0xa')]=_0x22aa1e['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index da5208d..c48939e 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 _0xd6a7=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports'];(function(_0x4f0c21,_0x364746){var _0x2796c0=function(_0x318ff3){while(--_0x318ff3){_0x4f0c21['push'](_0x4f0c21['shift']());}};_0x2796c0(++_0x364746);}(_0xd6a7,0xcc));var _0x7d6a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xd6a7[_0x167cc1];return _0x10bc4b;};'use strict';function Dynamics365Account(_0x2bb086){this['id']=_0x2bb086['id']||0x0;this['name']=_0x2bb086[_0x7d6a('0x0')]||'';this[_0x7d6a('0x1')]=_0x2bb086[_0x7d6a('0x1')]||'';this['password']=_0x2bb086[_0x7d6a('0x2')]||'';this['remoteUri']=_0x2bb086[_0x7d6a('0x3')]||'';this[_0x7d6a('0x4')]=_0x2bb086['tenantId']||'';this[_0x7d6a('0x5')]=_0x2bb086[_0x7d6a('0x5')]||'';this[_0x7d6a('0x6')]=_0x2bb086[_0x7d6a('0x6')]||{};this[_0x7d6a('0x7')]=_0x2bb086['serverUrl']||'';this['modernAuthentication']=_0x2bb086[_0x7d6a('0x8')]||![];this[_0x7d6a('0x9')]=_0x2bb086[_0x7d6a('0x9')]||{};this[_0x7d6a('0xa')]=_0x2bb086['CloudProvider']||{};}module[_0x7d6a('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x7573=['username','password','tenantId','clientId','clientSecret','modernAuthentication','Configurations','CloudProvider','exports','name'];(function(_0x335fd2,_0x10e6fd){var _0x507b86=function(_0x1294e0){while(--_0x1294e0){_0x335fd2['push'](_0x335fd2['shift']());}};_0x507b86(++_0x10e6fd);}(_0x7573,0x12b));var _0x3757=function(_0x508e1f,_0x552199){_0x508e1f=_0x508e1f-0x0;var _0x868cd=_0x7573[_0x508e1f];return _0x868cd;};'use strict';function Dynamics365Account(_0x2b898f){this['id']=_0x2b898f['id']||0x0;this[_0x3757('0x0')]=_0x2b898f[_0x3757('0x0')]||'';this[_0x3757('0x1')]=_0x2b898f['username']||'';this['password']=_0x2b898f[_0x3757('0x2')]||'';this['remoteUri']=_0x2b898f['remoteUri']||'';this[_0x3757('0x3')]=_0x2b898f['tenantId']||'';this[_0x3757('0x4')]=_0x2b898f['clientId']||'';this['clientSecret']=_0x2b898f[_0x3757('0x5')]||{};this['serverUrl']=_0x2b898f['serverUrl']||'';this['modernAuthentication']=_0x2b898f[_0x3757('0x6')]||![];this[_0x3757('0x7')]=_0x2b898f[_0x3757('0x7')]||{};this['CloudProvider']=_0x2b898f[_0x3757('0x8')]||{};}module[_0x3757('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 2dbfe1b..8f5609e 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 _0xb788=['v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb788,0x17f));var _0x8b78=function(_0x43444b,_0x8cf95b){_0x43444b=_0x43444b-0x0;var _0x392fe5=_0xb788[_0x43444b];return _0x392fe5;};'use strict';function FaxAccount(_0x5be346){this['id']=_0x5be346['id']||0x0;this[_0x8b78('0x0')]=_0x5be346['name']||'';this[_0x8b78('0x1')]=_0x5be346[_0x8b78('0x1')];this[_0x8b78('0x2')]=_0x5be346[_0x8b78('0x2')];this[_0x8b78('0x3')]=_0x5be346[_0x8b78('0x3')];this['localstationid']=_0x5be346[_0x8b78('0x4')];this[_0x8b78('0x5')]=_0x5be346[_0x8b78('0x5')]||0x960;this[_0x8b78('0x6')]=_0x5be346['maxrate']||0x3840;this[_0x8b78('0x7')]=_0x5be346[_0x8b78('0x7')]||_0x8b78('0x8');this[_0x8b78('0x9')]=_0x5be346[_0x8b78('0x9')]||'no';this[_0x8b78('0xa')]=_0x5be346[_0x8b78('0xa')]||'no';this[_0x8b78('0xb')]=_0x5be346['t38timeout']||0x1388;this[_0x8b78('0xc')]=_0x5be346[_0x8b78('0xc')]||_0x8b78('0xd');this['Trunk']=_0x5be346[_0x8b78('0xe')]?_0x5be346[_0x8b78('0xe')]:undefined;this[_0x8b78('0xf')]=_0x5be346[_0x8b78('0xf')];this['key']=_0x5be346[_0x8b78('0x10')];}module['exports']=FaxAccount; \ No newline at end of file +var _0xd988=['faxdetect','t38timeout','tech','SIP','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway'];(function(_0x503741,_0x4ead4e){var _0x1f9fc3=function(_0x544506){while(--_0x544506){_0x503741['push'](_0x503741['shift']());}};_0x1f9fc3(++_0x4ead4e);}(_0xd988,0x17d));var _0x8d98=function(_0x928b0d,_0x321841){_0x928b0d=_0x928b0d-0x0;var _0x4cbb26=_0xd988[_0x928b0d];return _0x4cbb26;};'use strict';function FaxAccount(_0x1a7f4d){this['id']=_0x1a7f4d['id']||0x0;this[_0x8d98('0x0')]=_0x1a7f4d['name']||'';this[_0x8d98('0x1')]=_0x1a7f4d[_0x8d98('0x1')];this[_0x8d98('0x2')]=_0x1a7f4d['ecm'];this[_0x8d98('0x3')]=_0x1a7f4d[_0x8d98('0x3')];this[_0x8d98('0x4')]=_0x1a7f4d[_0x8d98('0x4')];this[_0x8d98('0x5')]=_0x1a7f4d['minrate']||0x960;this[_0x8d98('0x6')]=_0x1a7f4d[_0x8d98('0x6')]||0x3840;this[_0x8d98('0x7')]=_0x1a7f4d[_0x8d98('0x7')]||_0x8d98('0x8');this[_0x8d98('0x9')]=_0x1a7f4d[_0x8d98('0x9')]||'no';this[_0x8d98('0xa')]=_0x1a7f4d[_0x8d98('0xa')]||'no';this[_0x8d98('0xb')]=_0x1a7f4d[_0x8d98('0xb')]||0x1388;this[_0x8d98('0xc')]=_0x1a7f4d[_0x8d98('0xc')]||_0x8d98('0xd');this['Trunk']=_0x1a7f4d['Trunk']?_0x1a7f4d['Trunk']:undefined;this[_0x8d98('0xe')]=_0x1a7f4d['ListId'];this['key']=_0x1a7f4d[_0x8d98('0xf')];}module[_0x8d98('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 7fc164b..14c1276 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 _0x83ba=['username','apiKey','token','remoteUri','serverUrl','Configurations','name'];(function(_0x38f737,_0x54f685){var _0x7afda3=function(_0x1ac1d7){while(--_0x1ac1d7){_0x38f737['push'](_0x38f737['shift']());}};_0x7afda3(++_0x54f685);}(_0x83ba,0x1f0));var _0xa83b=function(_0x51fb14,_0x49c0b0){_0x51fb14=_0x51fb14-0x0;var _0x248dd1=_0x83ba[_0x51fb14];return _0x248dd1;};'use strict';function FreshdeskAccount(_0xefe535){this['id']=_0xefe535['id']||0x0;this[_0xa83b('0x0')]=_0xefe535[_0xa83b('0x0')]||'';this[_0xa83b('0x1')]=_0xefe535['username']||'';this[_0xa83b('0x2')]=_0xefe535[_0xa83b('0x3')]||'';this[_0xa83b('0x4')]=_0xefe535[_0xa83b('0x4')]||'';this[_0xa83b('0x5')]=_0xefe535[_0xa83b('0x5')]||'';this[_0xa83b('0x6')]=_0xefe535[_0xa83b('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0xb4cf=['apiKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x1f9f5f,_0x509fb7){var _0x51d649=function(_0x4a5285){while(--_0x4a5285){_0x1f9f5f['push'](_0x1f9f5f['shift']());}};_0x51d649(++_0x509fb7);}(_0xb4cf,0x186));var _0xfb4c=function(_0x56b9c4,_0x14f739){_0x56b9c4=_0x56b9c4-0x0;var _0x5b7404=_0xb4cf[_0x56b9c4];return _0x5b7404;};'use strict';function FreshdeskAccount(_0x228d54){this['id']=_0x228d54['id']||0x0;this['name']=_0x228d54[_0xfb4c('0x0')]||'';this[_0xfb4c('0x1')]=_0x228d54[_0xfb4c('0x1')]||'';this[_0xfb4c('0x2')]=_0x228d54['token']||'';this[_0xfb4c('0x3')]=_0x228d54['remoteUri']||'';this[_0xfb4c('0x4')]=_0x228d54['serverUrl']||'';this[_0xfb4c('0x5')]=_0x228d54['Configurations']||{};}module[_0xfb4c('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 8611c5e..d773051 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 _0xcbd3=['Configurations','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x4d131e,_0x1f9e91){var _0x49bebb=function(_0x1d3ce2){while(--_0x1d3ce2){_0x4d131e['push'](_0x4d131e['shift']());}};_0x49bebb(++_0x1f9e91);}(_0xcbd3,0x1eb));var _0x3cbd=function(_0x26311b,_0x1b517f){_0x26311b=_0x26311b-0x0;var _0x2ccc2e=_0xcbd3[_0x26311b];return _0x2ccc2e;};'use strict';function FreshsalesAccount(_0x57522a){this['id']=_0x57522a['id']||0x0;this[_0x3cbd('0x0')]=_0x57522a[_0x3cbd('0x0')]||'';this[_0x3cbd('0x1')]=_0x57522a[_0x3cbd('0x1')]||'';this[_0x3cbd('0x2')]=_0x57522a[_0x3cbd('0x3')]||'';this[_0x3cbd('0x4')]=_0x57522a[_0x3cbd('0x4')]||'';this[_0x3cbd('0x5')]=_0x57522a['serverUrl']||'';this[_0x3cbd('0x6')]=_0x57522a[_0x3cbd('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0xcb41=['serverUrl','Configurations','exports','name','username','apiKey','remoteUri'];(function(_0x43b06b,_0x1929c7){var _0x2c555b=function(_0x30fa8c){while(--_0x30fa8c){_0x43b06b['push'](_0x43b06b['shift']());}};_0x2c555b(++_0x1929c7);}(_0xcb41,0x1df));var _0x1cb4=function(_0x1f5fb3,_0x8e1de0){_0x1f5fb3=_0x1f5fb3-0x0;var _0x50b376=_0xcb41[_0x1f5fb3];return _0x50b376;};'use strict';function FreshsalesAccount(_0x527ab0){this['id']=_0x527ab0['id']||0x0;this[_0x1cb4('0x0')]=_0x527ab0[_0x1cb4('0x0')]||'';this[_0x1cb4('0x1')]=_0x527ab0['username']||'';this[_0x1cb4('0x2')]=_0x527ab0['token']||'';this[_0x1cb4('0x3')]=_0x527ab0[_0x1cb4('0x3')]||'';this[_0x1cb4('0x4')]=_0x527ab0[_0x1cb4('0x4')]||'';this[_0x1cb4('0x5')]=_0x527ab0[_0x1cb4('0x5')]||{};}module[_0x1cb4('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 24ff558..71bfded 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 _0x7807=['type','uniqueid','calleridnum','queue','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexitAt','originalposition','channel','connectedlinename','accountcode','context','holdtime','assigned','lastAssignedTo','motionChannel','mohtime','variables'];(function(_0x25ba6a,_0x4422d6){var _0x1be09a=function(_0x308e7b){while(--_0x308e7b){_0x25ba6a['push'](_0x25ba6a['shift']());}};_0x1be09a(++_0x4422d6);}(_0x7807,0x1b8));var _0x7780=function(_0x392788,_0x2b64dd){_0x392788=_0x392788-0x0;var _0x19ff25=_0x7807[_0x392788];return _0x19ff25;};'use strict';function QueueReport(){this[_0x7780('0x0')]='inbound';this[_0x7780('0x1')]='';this[_0x7780('0x2')]='';this['calleridname']='';this[_0x7780('0x3')]='';this['queuecallerjoinAt']=null;this[_0x7780('0x4')]=null;this[_0x7780('0x5')]=0x1;this[_0x7780('0x6')]=0x1;this[_0x7780('0x7')]=![];this[_0x7780('0x8')]=null;this[_0x7780('0x9')]=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0x7780('0xa')]=null;this[_0x7780('0xb')]=0x1;this[_0x7780('0xc')]='';this['connectedlinenum']='';this[_0x7780('0xd')]='';this[_0x7780('0xe')]='';this[_0x7780('0xf')]='';this['exten']='';this['priority']='';this[_0x7780('0x10')]=0x0;this[_0x7780('0x11')]=![];this[_0x7780('0x12')]='';this[_0x7780('0x13')]='voice';this[_0x7780('0x14')]=0x0;this[_0x7780('0x15')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0xcb52=['connectedlinename','accountcode','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','type','uniqueid','calleridnum','calleridname','queue','position','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel'];(function(_0x1ef82a,_0x48efe7){var _0x18dc8e=function(_0x47ada0){while(--_0x47ada0){_0x1ef82a['push'](_0x1ef82a['shift']());}};_0x18dc8e(++_0x48efe7);}(_0xcb52,0x173));var _0x2cb5=function(_0x34e337,_0x1e5979){_0x34e337=_0x34e337-0x0;var _0x8eaab4=_0xcb52[_0x34e337];return _0x8eaab4;};'use strict';function QueueReport(){this[_0x2cb5('0x0')]='inbound';this[_0x2cb5('0x1')]='';this[_0x2cb5('0x2')]='';this[_0x2cb5('0x3')]='';this[_0x2cb5('0x4')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0x2cb5('0x5')]=0x1;this['count']=0x1;this['queuecallerabandon']=![];this[_0x2cb5('0x6')]=null;this[_0x2cb5('0x7')]=![];this[_0x2cb5('0x8')]=null;this[_0x2cb5('0x9')]=![];this[_0x2cb5('0xa')]=null;this[_0x2cb5('0xb')]=0x1;this[_0x2cb5('0xc')]='';this['connectedlinenum']='';this[_0x2cb5('0xd')]='';this[_0x2cb5('0xe')]='';this['context']='';this[_0x2cb5('0xf')]='';this[_0x2cb5('0x10')]='';this[_0x2cb5('0x11')]=0x0;this[_0x2cb5('0x12')]=![];this[_0x2cb5('0x13')]='';this[_0x2cb5('0x14')]=_0x2cb5('0x15');this[_0x2cb5('0x16')]=0x0;this[_0x2cb5('0x17')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 704d1bc..6246071 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 _0xc740=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name','username','remoteUri','clientId'];(function(_0x188296,_0x4942ee){var _0x393492=function(_0x14ba07){while(--_0x14ba07){_0x188296['push'](_0x188296['shift']());}};_0x393492(++_0x4942ee);}(_0xc740,0xba));var _0x0c74=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc740[_0x501510];return _0x1e6ee5;};'use strict';function SalesforceAccount(_0x4ad71d){this['id']=_0x4ad71d['id']||0x0;this[_0x0c74('0x0')]=_0x4ad71d[_0x0c74('0x0')]||'';this[_0x0c74('0x1')]=_0x4ad71d[_0x0c74('0x1')]||'';this['remoteUri']=_0x4ad71d[_0x0c74('0x2')]||'';this['password']=_0x4ad71d['password']||'';this[_0x0c74('0x3')]=_0x4ad71d['clientId']||'';this[_0x0c74('0x4')]=_0x4ad71d[_0x0c74('0x4')]||'';this[_0x0c74('0x5')]=_0x4ad71d['securityToken']||'';this['type']=_0x4ad71d[_0x0c74('0x6')]||_0x0c74('0x7');this[_0x0c74('0x8')]=_0x4ad71d['serverUrl']||'';this[_0x0c74('0x9')]=_0x4ad71d[_0x0c74('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xd9eb=['remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0x320f82,_0x295194){var _0x22e720=function(_0x3d13f6){while(--_0x3d13f6){_0x320f82['push'](_0x320f82['shift']());}};_0x22e720(++_0x295194);}(_0xd9eb,0xca));var _0xbd9e=function(_0x26222d,_0x1d2de1){_0x26222d=_0x26222d-0x0;var _0x16bf9f=_0xd9eb[_0x26222d];return _0x16bf9f;};'use strict';function SalesforceAccount(_0x4e5bd7){this['id']=_0x4e5bd7['id']||0x0;this[_0xbd9e('0x0')]=_0x4e5bd7[_0xbd9e('0x0')]||'';this[_0xbd9e('0x1')]=_0x4e5bd7[_0xbd9e('0x1')]||'';this[_0xbd9e('0x2')]=_0x4e5bd7[_0xbd9e('0x2')]||'';this[_0xbd9e('0x3')]=_0x4e5bd7[_0xbd9e('0x3')]||'';this[_0xbd9e('0x4')]=_0x4e5bd7[_0xbd9e('0x4')]||'';this[_0xbd9e('0x5')]=_0x4e5bd7[_0xbd9e('0x5')]||'';this['securityToken']=_0x4e5bd7[_0xbd9e('0x6')]||'';this[_0xbd9e('0x7')]=_0x4e5bd7[_0xbd9e('0x7')]||_0xbd9e('0x8');this[_0xbd9e('0x9')]=_0x4e5bd7[_0xbd9e('0x9')]||'';this[_0xbd9e('0xa')]=_0x4e5bd7[_0xbd9e('0xa')]||{};}module[_0xbd9e('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 b649cee..4fb1130 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 _0x93cf=['username','password','serverUrl','Configurations','name'];(function(_0x354811,_0x49091d){var _0x5e43de=function(_0x181cb0){while(--_0x181cb0){_0x354811['push'](_0x354811['shift']());}};_0x5e43de(++_0x49091d);}(_0x93cf,0xc2));var _0xf93c=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x93cf[_0xbca1b1];return _0x4e1686;};'use strict';function ServicenowAccount(_0x268fb5){this['id']=_0x268fb5['id']||0x0;this[_0xf93c('0x0')]=_0x268fb5[_0xf93c('0x0')]||'';this[_0xf93c('0x1')]=_0x268fb5[_0xf93c('0x1')]||'';this[_0xf93c('0x2')]=_0x268fb5['password']||'';this['remoteUri']=_0x268fb5['remoteUri']||'';this['serverUrl']=_0x268fb5[_0xf93c('0x3')]||'';this[_0xf93c('0x4')]=_0x268fb5[_0xf93c('0x4')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x038f=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x4be6ab,_0x32e758){var _0x541f4c=function(_0x1e1353){while(--_0x1e1353){_0x4be6ab['push'](_0x4be6ab['shift']());}};_0x541f4c(++_0x32e758);}(_0x038f,0x1a3));var _0xf038=function(_0x4a82ac,_0x1fb931){_0x4a82ac=_0x4a82ac-0x0;var _0x58ee97=_0x038f[_0x4a82ac];return _0x58ee97;};'use strict';function ServicenowAccount(_0x39fafc){this['id']=_0x39fafc['id']||0x0;this[_0xf038('0x0')]=_0x39fafc[_0xf038('0x0')]||'';this[_0xf038('0x1')]=_0x39fafc[_0xf038('0x1')]||'';this[_0xf038('0x2')]=_0x39fafc[_0xf038('0x2')]||'';this[_0xf038('0x3')]=_0x39fafc['remoteUri']||'';this[_0xf038('0x4')]=_0x39fafc[_0xf038('0x4')]||'';this[_0xf038('0x5')]=_0x39fafc[_0xf038('0x5')]||{};}module[_0xf038('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index cc09fa7..ea76913 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 _0x2e15=['name','username','password','remoteUri','Configurations','exports'];(function(_0x452001,_0xb73eeb){var _0x4f6ac7=function(_0x3a9608){while(--_0x3a9608){_0x452001['push'](_0x452001['shift']());}};_0x4f6ac7(++_0xb73eeb);}(_0x2e15,0x174));var _0x52e1=function(_0x11a485,_0x44430f){_0x11a485=_0x11a485-0x0;var _0x19308b=_0x2e15[_0x11a485];return _0x19308b;};'use strict';function SugarcrmAccount(_0x58e440){this['id']=_0x58e440['id']||0x0;this[_0x52e1('0x0')]=_0x58e440[_0x52e1('0x0')]||'';this[_0x52e1('0x1')]=_0x58e440[_0x52e1('0x1')]||'';this[_0x52e1('0x2')]=_0x58e440['password']||'';this['remoteUri']=_0x58e440[_0x52e1('0x3')]||'';this['serverUrl']=_0x58e440['serverUrl']||'';this[_0x52e1('0x4')]=_0x58e440[_0x52e1('0x4')]||{};}module[_0x52e1('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0xe878=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x22985c,_0x3f780d){var _0x4c3668=function(_0x5c2f3d){while(--_0x5c2f3d){_0x22985c['push'](_0x22985c['shift']());}};_0x4c3668(++_0x3f780d);}(_0xe878,0x82));var _0x8e87=function(_0x40b981,_0x48b308){_0x40b981=_0x40b981-0x0;var _0x58696b=_0xe878[_0x40b981];return _0x58696b;};'use strict';function SugarcrmAccount(_0x3fb130){this['id']=_0x3fb130['id']||0x0;this[_0x8e87('0x0')]=_0x3fb130['name']||'';this[_0x8e87('0x1')]=_0x3fb130[_0x8e87('0x1')]||'';this['password']=_0x3fb130[_0x8e87('0x2')]||'';this['remoteUri']=_0x3fb130[_0x8e87('0x3')]||'';this[_0x8e87('0x4')]=_0x3fb130[_0x8e87('0x4')]||'';this[_0x8e87('0x5')]=_0x3fb130[_0x8e87('0x5')]||{};}module[_0x8e87('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 3327ced..05895bd 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 _0x145d=['stateTime','status','address','name','accountcode','unknown'];(function(_0x3068ef,_0x3ff033){var _0x54ee53=function(_0x9f82b6){while(--_0x9f82b6){_0x3068ef['push'](_0x3068ef['shift']());}};_0x54ee53(++_0x3ff033);}(_0x145d,0xc9));var _0xd145=function(_0x19d339,_0x18ae8e){_0x19d339=_0x19d339-0x0;var _0x49e86f=_0x145d[_0x19d339];return _0x49e86f;};'use strict';function Telephone(_0x3906bf){this['id']=_0x3906bf['id']||0x0;this[_0xd145('0x0')]=_0x3906bf[_0xd145('0x0')]||'';this[_0xd145('0x1')]=_0x3906bf[_0xd145('0x1')]||'';this['state']=_0xd145('0x2');this[_0xd145('0x3')]=0x0;this[_0xd145('0x4')]='unknown';this[_0xd145('0x5')]='';}module['exports']=Telephone; \ No newline at end of file +var _0x980c=['unknown','stateTime','status','address','name','accountcode','state'];(function(_0x42bb6d,_0x412255){var _0x1db89b=function(_0x5da43a){while(--_0x5da43a){_0x42bb6d['push'](_0x42bb6d['shift']());}};_0x1db89b(++_0x412255);}(_0x980c,0x100));var _0xc980=function(_0x43b949,_0x3ee06c){_0x43b949=_0x43b949-0x0;var _0x2aa536=_0x980c[_0x43b949];return _0x2aa536;};'use strict';function Telephone(_0xd39c9e){this['id']=_0xd39c9e['id']||0x0;this[_0xc980('0x0')]=_0xd39c9e[_0xc980('0x0')]||'';this[_0xc980('0x1')]=_0xd39c9e[_0xc980('0x1')]||'';this[_0xc980('0x2')]=_0xc980('0x3');this[_0xc980('0x4')]=0x0;this[_0xc980('0x5')]=_0xc980('0x3');this[_0xc980('0x6')]='';}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 7eb6105..0d72230 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x5b9d36,_0xffbef6){var _0x90a4e9=function(_0x1cf352){while(--_0x1cf352){_0x5b9d36['push'](_0x5b9d36['shift']());}};_0x90a4e9(++_0xffbef6);}(_0xb10b,0x12a));var _0xbb10=function(_0x1fe14f,_0x36745d){_0x1fe14f=_0x1fe14f-0x0;var _0x4c4904=_0xb10b[_0x1fe14f];return _0x4c4904;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x10110e,_0x6c44d5){var _0x58a234=function(_0x7ed14f){while(--_0x7ed14f){_0x10110e['push'](_0x10110e['shift']());}};_0x58a234(++_0x6c44d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 823f076..e80b500 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(_0x149ec4,_0x4fc89e){var _0x398ac2=function(_0x223d6c){while(--_0x223d6c){_0x149ec4['push'](_0x149ec4['shift']());}};_0x398ac2(++_0x4fc89e);}(_0xb10b,0x12a));var _0xbb10=function(_0x4e7844,_0x30ce77){_0x4e7844=_0x4e7844-0x0;var _0x336119=_0xb10b[_0x4e7844];return _0x336119;};'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 _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x4126dc,_0x1430f8){var _0xef998b=function(_0x48432c){while(--_0x48432c){_0x4126dc['push'](_0x4126dc['shift']());}};_0xef998b(++_0x1430f8);}(_0x8603,0x190));var _0x3860=function(_0x4702ee,_0xaf6a45){_0x4702ee=_0x4702ee-0x0;var _0x62ca7d=_0x8603[_0x4702ee];return _0x62ca7d;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 170db88..244638c 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 _0xd0d0=['stateTime','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','address','defaultuser','exports','active','name','state','unknown'];(function(_0x1bd6af,_0x4f959a){var _0x4671fb=function(_0x5f151d){while(--_0x5f151d){_0x1bd6af['push'](_0x1bd6af['shift']());}};_0x4671fb(++_0x4f959a);}(_0xd0d0,0x11d));var _0x0d0d=function(_0x4da44f,_0x45b425){_0x4da44f=_0x4da44f-0x0;var _0x3fbc54=_0xd0d0[_0x4da44f];return _0x3fbc54;};'use strict';function Trunk(_0x58a6ae){this['id']=_0x58a6ae['id']||0x0;this[_0x0d0d('0x0')]=_0x58a6ae['active']||![];this[_0x0d0d('0x1')]=_0x58a6ae[_0x0d0d('0x1')]||'';this[_0x0d0d('0x2')]=_0x0d0d('0x3');this[_0x0d0d('0x4')]=0x0;this['status']=_0x0d0d('0x3');this[_0x0d0d('0x5')]=_0x58a6ae['registry']&&_0x58a6ae['registry'][_0x0d0d('0x6')](':')?_0x58a6ae['registry'][_0x0d0d('0x7')](':')[0x0]:'';this[_0x0d0d('0x8')]='';this[_0x0d0d('0x9')]='';this[_0x0d0d('0xa')]='';this[_0x0d0d('0xb')]='';this[_0x0d0d('0xc')]='';this[_0x0d0d('0xd')]=_0x0d0d('0x3');this['registrationtime']='';this[_0x0d0d('0xe')]='';this[_0x0d0d('0xf')]=_0x58a6ae['defaultuser']||'';}module[_0x0d0d('0x10')]=Trunk; \ No newline at end of file +var _0x8eed=['defaultuser','exports','active','name','state','unknown','registry','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address'];(function(_0x253ec9,_0x59fbba){var _0x2346a6=function(_0x69033d){while(--_0x69033d){_0x253ec9['push'](_0x253ec9['shift']());}};_0x2346a6(++_0x59fbba);}(_0x8eed,0x92));var _0xd8ee=function(_0x5e5e65,_0x37530e){_0x5e5e65=_0x5e5e65-0x0;var _0xaa412f=_0x8eed[_0x5e5e65];return _0xaa412f;};'use strict';function Trunk(_0x2792bd){this['id']=_0x2792bd['id']||0x0;this[_0xd8ee('0x0')]=_0x2792bd['active']||![];this['name']=_0x2792bd[_0xd8ee('0x1')]||'';this[_0xd8ee('0x2')]=_0xd8ee('0x3');this['stateTime']=0x0;this['status']=_0xd8ee('0x3');this[_0xd8ee('0x4')]=_0x2792bd['registry']&&_0x2792bd[_0xd8ee('0x4')]['indexOf'](':')?_0x2792bd[_0xd8ee('0x4')][_0xd8ee('0x5')](':')[0x0]:'';this[_0xd8ee('0x6')]='';this[_0xd8ee('0x7')]='';this[_0xd8ee('0x8')]='';this[_0xd8ee('0x9')]='';this[_0xd8ee('0xa')]='';this[_0xd8ee('0xb')]=_0xd8ee('0x3');this[_0xd8ee('0xc')]='';this[_0xd8ee('0xd')]='';this['defaultuser']=_0x2792bd[_0xd8ee('0xe')]||'';}module[_0xd8ee('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index f3c51c5..ab41076 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 _0xb240=['exten','recordingFormat','mandatoryDisposition','exports'];(function(_0x290540,_0x4b1b28){var _0x3ce52f=function(_0x10ced9){while(--_0x10ced9){_0x290540['push'](_0x290540['shift']());}};_0x3ce52f(++_0x4b1b28);}(_0xb240,0xb8));var _0x0b24=function(_0x497069,_0x145b88){_0x497069=_0x497069-0x0;var _0x15eb9c=_0xb240[_0x497069];return _0x15eb9c;};'use strict';function voiceExtension(_0x5bd04a){this['id']=_0x5bd04a['id']||0x0;this[_0x0b24('0x0')]=_0x5bd04a[_0x0b24('0x0')]||'';this[_0x0b24('0x1')]=_0x5bd04a['recordingFormat']||'none';this[_0x0b24('0x2')]=_0x5bd04a['mandatoryDisposition']||![];}module[_0x0b24('0x3')]=voiceExtension; \ No newline at end of file +var _0xfd8b=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0xfd8b,0x131));var _0xbfd8=function(_0x53bed7,_0x127cb4){_0x53bed7=_0x53bed7-0x0;var _0x518d63=_0xfd8b[_0x53bed7];return _0x518d63;};'use strict';function voiceExtension(_0x47b043){this['id']=_0x47b043['id']||0x0;this[_0xbfd8('0x0')]=_0x47b043[_0xbfd8('0x0')]||'';this[_0xbfd8('0x1')]=_0x47b043['recordingFormat']||_0xbfd8('0x2');this[_0xbfd8('0x3')]=_0x47b043['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 c5315d1..f32d552 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 _0x9957=['outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayTimeout','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','erlangCalls','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','wav','wav49','gsm','fewestcalls','linear','random','ringall','roundrobin','rrordered','wrandom','name','monitor_format','type','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','available','busy','invalid','loggedIn','notInUse','onHold','paused','ringing','ringInUse','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','TrunkBackup','dialPrefix','Interval','DESC','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay'];(function(_0x2545d0,_0x397e79){var _0x10111b=function(_0x2fdcd8){while(--_0x2fdcd8){_0x2545d0['push'](_0x2545d0['shift']());}};_0x10111b(++_0x397e79);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var monitorFormat={'wav':_0x7995('0x0'),'wav49':_0x7995('0x1'),'gsm':_0x7995('0x2')};var strategy={'fewestcalls':_0x7995('0x3'),'leastrecent':'leastrecent','linear':_0x7995('0x4'),'random':_0x7995('0x5'),'ringall':_0x7995('0x6'),'rr':_0x7995('0x7'),'rrmemory':'rrmemory','rrordered':_0x7995('0x8'),'wrandom':_0x7995('0x9')};function VoiceQueue(_0x137b6b){this['id']=_0x137b6b['id']||0x0;this[_0x7995('0xa')]=_0x137b6b[_0x7995('0xa')]||'';this[_0x7995('0xb')]=_0x137b6b['monitor_format']||'';this[_0x7995('0xc')]=_0x137b6b[_0x7995('0xc')]||'inbound';this[_0x7995('0xd')]=0x0;this[_0x7995('0xe')]=0x0;this[_0x7995('0xf')]=0x0;this[_0x7995('0x10')]=0x0;this[_0x7995('0x11')]=0x0;this[_0x7995('0x12')]=0x0;this[_0x7995('0x13')]=0x0;this['abandoned']=0x0;this[_0x7995('0x14')]=0x0;this[_0x7995('0x15')]=0x0;this['inUse']=0x0;this[_0x7995('0x16')]=0x0;this[_0x7995('0x17')]=0x0;this[_0x7995('0x18')]=0x0;this[_0x7995('0x19')]=0x0;this[_0x7995('0x1a')]=0x0;this[_0x7995('0x1b')]=0x0;this[_0x7995('0x1c')]=0x0;this['talking']=0x0;this['unavailable']=0x0;this[_0x7995('0x1d')]=0x0;this[_0x7995('0x1e')]=_0x137b6b[_0x7995('0x1e')]||![];this[_0x7995('0x1f')]=_0x137b6b[_0x7995('0x1f')]||0xa;this[_0x7995('0x20')]=_0x137b6b[_0x7995('0x20')]||'no';this[_0x7995('0x21')]=!![];this['message']='';this[_0x7995('0x22')]=0x0;this['temp']=0x0;this[_0x7995('0x23')]=_0x137b6b[_0x7995('0x23')]||null;this[_0x7995('0x24')]=_0x137b6b[_0x7995('0x24')]?_0x137b6b[_0x7995('0x24')]:null;this[_0x7995('0x25')]=_0x137b6b['dialActive'];this['dialMethod']=_0x137b6b[_0x7995('0x26')]||'progressive';this['dialLimitChannel']=_0x137b6b[_0x7995('0x27')]||0x0;this[_0x7995('0x28')]=_0x137b6b['dialLimitQueue']||0x0;this[_0x7995('0x29')]=_0x137b6b['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0x137b6b[_0x7995('0x2a')]||_0x7995('0x2b');this[_0x7995('0x2c')]=_0x137b6b[_0x7995('0x2c')]||0.03;this[_0x7995('0x2d')]=_0x137b6b[_0x7995('0x2d')]||0x258;this['dialOriginateCallerIdName']=_0x137b6b[_0x7995('0x2e')]||_0x7995('0x2f');this[_0x7995('0x30')]=_0x137b6b[_0x7995('0x30')]||_0x7995('0x2f');this[_0x7995('0x31')]=_0x137b6b[_0x7995('0x31')]||0x1e;this[_0x7995('0x32')]=_0x137b6b['dialQueueOptions']||_0x7995('0x33');this[_0x7995('0x34')]=_0x137b6b[_0x7995('0x34')]||0x3;this[_0x7995('0x35')]=_0x137b6b[_0x7995('0x35')]||undefined;this[_0x7995('0x36')]=_0x137b6b['dialCongestionMaxRetry']||0x3;this[_0x7995('0x37')]=_0x137b6b['dialCongestionRetryFrequency']||0x96;this[_0x7995('0x38')]=_0x137b6b[_0x7995('0x38')]||0x3;this[_0x7995('0x39')]=_0x137b6b[_0x7995('0x39')]||0x96;this[_0x7995('0x3a')]=_0x137b6b['dialNoAnswerMaxRetry']||0x3;this[_0x7995('0x3b')]=_0x137b6b['dialNoAnswerRetryFrequency']||0x96;this[_0x7995('0x3c')]=_0x137b6b[_0x7995('0x3c')]||0x3;this[_0x7995('0x3d')]=_0x137b6b['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x137b6b['dialDropMaxRetry']||0x3;this[_0x7995('0x3e')]=_0x137b6b[_0x7995('0x3e')]||0x96;this[_0x7995('0x3f')]=_0x137b6b[_0x7995('0x3f')]||0x3;this[_0x7995('0x40')]=_0x137b6b[_0x7995('0x40')]||0x96;this['dialMachineMaxRetry']=_0x137b6b['dialMachineMaxRetry']||0x3;this[_0x7995('0x41')]=_0x137b6b['dialMachineRetryFrequency']||0x96;this[_0x7995('0x42')]=_0x137b6b[_0x7995('0x42')]||0x3;this[_0x7995('0x43')]=_0x137b6b[_0x7995('0x43')]||0x96;this[_0x7995('0x44')]=_0x137b6b['callAdditionalPhoneAfterMin']||0x3;this[_0x7995('0x45')]=_0x137b6b[_0x7995('0x45')]||0x4;this['Trunk']=_0x137b6b['Trunk']?_0x137b6b['Trunk']:undefined;this[_0x7995('0x46')]=_0x137b6b[_0x7995('0x46')]?_0x137b6b['TrunkBackup']:undefined;this[_0x7995('0x47')]=_0x137b6b['dialPrefix']||undefined;this[_0x7995('0x48')]=_0x137b6b[_0x7995('0x48')]?_0x137b6b[_0x7995('0x48')]:undefined;this['dialOrderByScheduledAt']=_0x137b6b['dialOrderByScheduledAt']||_0x7995('0x49');this['dialRandomLastDigitCallerIdNumber']=_0x137b6b['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x7995('0x4a')]=_0x137b6b[_0x7995('0x4a')]||undefined;this['strategy']=strategy[_0x137b6b[_0x7995('0x4b')]]||_0x7995('0x4c');this[_0x7995('0x4d')]=!![];this[_0x7995('0x4e')]=_0x137b6b[_0x7995('0x4e')]||![];this['dialAMDInitialSilence']=_0x137b6b[_0x7995('0x4f')];this[_0x7995('0x50')]=_0x137b6b[_0x7995('0x50')];this[_0x7995('0x51')]=_0x137b6b['dialAMDAfterGreetingSilence'];this[_0x7995('0x52')]=_0x137b6b[_0x7995('0x52')];this[_0x7995('0x53')]=_0x137b6b[_0x7995('0x53')];this[_0x7995('0x54')]=_0x137b6b[_0x7995('0x54')];this['dialAMDMaximumNumberOfWords']=_0x137b6b[_0x7995('0x55')];this[_0x7995('0x56')]=_0x137b6b[_0x7995('0x56')];this[_0x7995('0x57')]=_0x137b6b[_0x7995('0x57')];this[_0x7995('0x58')]=0x0;this[_0x7995('0x59')]=0x0;this[_0x7995('0x5a')]=_0x137b6b[_0x7995('0x5a')];this[_0x7995('0x5b')]=0x0;this[_0x7995('0x5c')]=0x0;this[_0x7995('0x5d')]=0x0;this[_0x7995('0x5e')]=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x7995('0x5f')]=0x0;this[_0x7995('0x60')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x7995('0x61')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this[_0x7995('0x62')]=0x0;this[_0x7995('0x63')]=undefined;this[_0x7995('0x64')]=undefined;this['handlePredictive']=undefined;this[_0x7995('0x65')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x7995('0x66')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x7995('0x67')]=0x0;this[_0x7995('0x68')]=0x0;this[_0x7995('0x69')]=0x0;this[_0x7995('0x6a')]=0x0;this['predictiveIntervalMaxThreshold']=_0x137b6b[_0x7995('0x6b')]||0x14;this[_0x7995('0x6c')]=_0x137b6b[_0x7995('0x6b')]||0xa;this[_0x7995('0x6d')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x7995('0x6e')]=0x0;this['erlangCallToSecond']=0x0;this[_0x7995('0x6f')]=0x0;this['erlangBusyFactor']=0x0;this[_0x7995('0x70')]=_0x137b6b['dialRecallMeTimeout']||0x1e;this[_0x7995('0x71')]=_0x137b6b[_0x7995('0x71')]||![];this['dialPreviewAutoRecallMe']=!!_0x137b6b[_0x7995('0x72')]||![];this[_0x7995('0x73')]=!!_0x137b6b[_0x7995('0x73')]||![];this[_0x7995('0x74')]=_0x137b6b['dialQueueProject2']||undefined;this[_0x7995('0x75')]=_0x137b6b[_0x7995('0x75')]||![];this[_0x7995('0x76')]=_0x137b6b['dialAgiAfterHangupAgent']||![];this[_0x7995('0xb')]=monitorFormat[_0x137b6b[_0x7995('0xb')]]?monitorFormat[_0x137b6b[_0x7995('0xb')]]:undefined;this[_0x7995('0x77')]=_0x137b6b[_0x7995('0x77')]||![];this['mandatoryDispositionPause']=_0x137b6b[_0x7995('0x78')]?_0x137b6b[_0x7995('0x78')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0x5fc3=['dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','wav','wav49','fewestcalls','leastrecent','linear','random','ringall','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumHoldTime','sumBillable','abandoned','available','inUse','invalid','onHold','ringing','ringInUse','talking','unavailable','unknown','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive'];(function(_0x2d2a58,_0x1f8f4b){var _0x451dfb=function(_0x4a1780){while(--_0x4a1780){_0x2d2a58['push'](_0x2d2a58['shift']());}};_0x451dfb(++_0x1f8f4b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4bd67a,_0x4f9725){_0x4bd67a=_0x4bd67a-0x0;var _0x2be5fb=_0x5fc3[_0x4bd67a];return _0x2be5fb;};'use strict';var monitorFormat={'wav':_0x35fc('0x0'),'wav49':_0x35fc('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0x35fc('0x2'),'leastrecent':_0x35fc('0x3'),'linear':_0x35fc('0x4'),'random':_0x35fc('0x5'),'ringall':_0x35fc('0x6'),'rr':'roundrobin','rrmemory':_0x35fc('0x7'),'rrordered':_0x35fc('0x8'),'wrandom':_0x35fc('0x9')};function VoiceQueue(_0x5b85ad){this['id']=_0x5b85ad['id']||0x0;this['name']=_0x5b85ad[_0x35fc('0xa')]||'';this['monitor_format']=_0x5b85ad[_0x35fc('0xb')]||'';this[_0x35fc('0xc')]=_0x5b85ad[_0x35fc('0xc')]||_0x35fc('0xd');this[_0x35fc('0xe')]=0x0;this[_0x35fc('0xf')]=0x0;this[_0x35fc('0x10')]=0x0;this['sumDuration']=0x0;this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;this['unmanaged']=0x0;this[_0x35fc('0x13')]=0x0;this[_0x35fc('0x14')]=0x0;this['busy']=0x0;this[_0x35fc('0x15')]=0x0;this[_0x35fc('0x16')]=0x0;this['loggedIn']=0x0;this['notInUse']=0x0;this[_0x35fc('0x17')]=0x0;this['paused']=0x0;this[_0x35fc('0x18')]=0x0;this[_0x35fc('0x19')]=0x0;this[_0x35fc('0x1a')]=0x0;this[_0x35fc('0x1b')]=0x0;this[_0x35fc('0x1c')]=0x0;this['acw']=_0x5b85ad['acw']||![];this['acwTimeout']=_0x5b85ad['acwTimeout']||0xa;this[_0x35fc('0x1d')]=_0x5b85ad[_0x35fc('0x1d')]||'no';this[_0x35fc('0x1e')]=!![];this[_0x35fc('0x1f')]='';this[_0x35fc('0x20')]=0x0;this[_0x35fc('0x21')]=0x0;this['dialTimezone']=_0x5b85ad[_0x35fc('0x22')]||null;this[_0x35fc('0x23')]=_0x5b85ad['dialGlobalInterval']?_0x5b85ad[_0x35fc('0x23')]:null;this[_0x35fc('0x24')]=_0x5b85ad[_0x35fc('0x24')];this['dialMethod']=_0x5b85ad[_0x35fc('0x25')]||_0x35fc('0x26');this[_0x35fc('0x27')]=_0x5b85ad['dialLimitChannel']||0x0;this[_0x35fc('0x28')]=_0x5b85ad[_0x35fc('0x28')]||0x0;this[_0x35fc('0x29')]=_0x5b85ad[_0x35fc('0x29')]||0x1;this[_0x35fc('0x2a')]=_0x5b85ad[_0x35fc('0x2a')]||_0x35fc('0x2b');this[_0x35fc('0x2c')]=_0x5b85ad[_0x35fc('0x2c')]||0.03;this[_0x35fc('0x2d')]=_0x5b85ad['dialPredictiveInterval']||0x258;this[_0x35fc('0x2e')]=_0x5b85ad[_0x35fc('0x2e')]||_0x35fc('0x2f');this[_0x35fc('0x30')]=_0x5b85ad[_0x35fc('0x30')]||'anonymous';this[_0x35fc('0x31')]=_0x5b85ad[_0x35fc('0x31')]||0x1e;this['dialQueueOptions']=_0x5b85ad[_0x35fc('0x32')]||_0x35fc('0x33');this[_0x35fc('0x34')]=_0x5b85ad['dialQueueTimeout']||0x3;this[_0x35fc('0x35')]=_0x5b85ad['dialQueueProject']||undefined;this[_0x35fc('0x36')]=_0x5b85ad[_0x35fc('0x36')]||0x3;this['dialCongestionRetryFrequency']=_0x5b85ad['dialCongestionRetryFrequency']||0x96;this[_0x35fc('0x37')]=_0x5b85ad['dialBusyMaxRetry']||0x3;this[_0x35fc('0x38')]=_0x5b85ad[_0x35fc('0x38')]||0x96;this['dialNoAnswerMaxRetry']=_0x5b85ad[_0x35fc('0x39')]||0x3;this[_0x35fc('0x3a')]=_0x5b85ad[_0x35fc('0x3a')]||0x96;this[_0x35fc('0x3b')]=_0x5b85ad[_0x35fc('0x3b')]||0x3;this[_0x35fc('0x3c')]=_0x5b85ad[_0x35fc('0x3c')]||0x96;this[_0x35fc('0x3d')]=_0x5b85ad['dialDropMaxRetry']||0x3;this[_0x35fc('0x3e')]=_0x5b85ad[_0x35fc('0x3e')]||0x96;this[_0x35fc('0x3f')]=_0x5b85ad['dialAbandonedMaxRetry']||0x3;this[_0x35fc('0x40')]=_0x5b85ad[_0x35fc('0x40')]||0x96;this[_0x35fc('0x41')]=_0x5b85ad[_0x35fc('0x41')]||0x3;this[_0x35fc('0x42')]=_0x5b85ad[_0x35fc('0x42')]||0x96;this[_0x35fc('0x43')]=_0x5b85ad[_0x35fc('0x43')]||0x3;this[_0x35fc('0x44')]=_0x5b85ad[_0x35fc('0x44')]||0x96;this['callAdditionalPhoneAfterMin']=_0x5b85ad['callAdditionalPhoneAfterMin']||0x3;this[_0x35fc('0x45')]=_0x5b85ad['dialGlobalMaxRetry']||0x4;this[_0x35fc('0x46')]=_0x5b85ad[_0x35fc('0x46')]?_0x5b85ad[_0x35fc('0x46')]:undefined;this[_0x35fc('0x47')]=_0x5b85ad[_0x35fc('0x47')]?_0x5b85ad[_0x35fc('0x47')]:undefined;this['dialPrefix']=_0x5b85ad[_0x35fc('0x48')]||undefined;this[_0x35fc('0x49')]=_0x5b85ad[_0x35fc('0x49')]?_0x5b85ad[_0x35fc('0x49')]:undefined;this[_0x35fc('0x4a')]=_0x5b85ad[_0x35fc('0x4a')]||'DESC';this[_0x35fc('0x4b')]=_0x5b85ad[_0x35fc('0x4b')]||undefined;this[_0x35fc('0x4c')]=_0x5b85ad['dialCutDigit']||undefined;this[_0x35fc('0x4d')]=strategy[_0x5b85ad['strategy']]||_0x35fc('0x7');this[_0x35fc('0x4e')]=!![];this[_0x35fc('0x4f')]=_0x5b85ad[_0x35fc('0x4f')]||![];this['dialAMDInitialSilence']=_0x5b85ad['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x5b85ad[_0x35fc('0x50')];this['dialAMDAfterGreetingSilence']=_0x5b85ad[_0x35fc('0x51')];this['dialAMDTotalAnalysisTime']=_0x5b85ad[_0x35fc('0x52')];this[_0x35fc('0x53')]=_0x5b85ad[_0x35fc('0x53')];this[_0x35fc('0x54')]=_0x5b85ad[_0x35fc('0x54')];this[_0x35fc('0x55')]=_0x5b85ad[_0x35fc('0x55')];this['dialAMDSilenceThreshold']=_0x5b85ad[_0x35fc('0x56')];this[_0x35fc('0x57')]=_0x5b85ad['dialAMDMaximumWordLength'];this[_0x35fc('0x58')]=0x0;this[_0x35fc('0x59')]=0x0;this[_0x35fc('0x5a')]=_0x5b85ad[_0x35fc('0x5a')];this[_0x35fc('0x5b')]=0x0;this[_0x35fc('0x5c')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x35fc('0x5d')]=0x0;this[_0x35fc('0x5e')]=0x0;this[_0x35fc('0x5f')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x35fc('0x60')]=0x0;this[_0x35fc('0x61')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x35fc('0x62')]=0x0;this[_0x35fc('0x63')]=0x0;this[_0x35fc('0x64')]=0x0;this[_0x35fc('0x65')]=0x0;this[_0x35fc('0x66')]=undefined;this[_0x35fc('0x67')]=undefined;this[_0x35fc('0x68')]=undefined;this[_0x35fc('0x69')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x35fc('0x6a')]=0x0;this[_0x35fc('0x6b')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this[_0x35fc('0x6c')]=0x0;this[_0x35fc('0x6d')]=_0x5b85ad['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x35fc('0x6e')]=_0x5b85ad[_0x35fc('0x6f')]||0xa;this[_0x35fc('0x70')]=0x0;this[_0x35fc('0x71')]=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0x35fc('0x72')]=_0x5b85ad[_0x35fc('0x72')]||0x1e;this['dialRecallInQueue']=_0x5b85ad[_0x35fc('0x73')]||![];this['dialPreviewAutoRecallMe']=!!_0x5b85ad[_0x35fc('0x74')]||![];this[_0x35fc('0x75')]=!!_0x5b85ad[_0x35fc('0x75')]||![];this[_0x35fc('0x76')]=_0x5b85ad[_0x35fc('0x76')]||undefined;this['dialAgiAfterHangupClient']=_0x5b85ad[_0x35fc('0x77')]||![];this[_0x35fc('0x78')]=_0x5b85ad['dialAgiAfterHangupAgent']||![];this[_0x35fc('0xb')]=monitorFormat[_0x5b85ad[_0x35fc('0xb')]]?monitorFormat[_0x5b85ad[_0x35fc('0xb')]]:undefined;this[_0x35fc('0x79')]=_0x5b85ad['mandatoryDisposition']||![];this[_0x35fc('0x7a')]=_0x5b85ad['mandatoryDispositionPause']?_0x5b85ad['mandatoryDispositionPause']:undefined;}module[_0x35fc('0x7b')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 5be58b5..8a44c5e 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e89=['dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','name','strategy','abandoned','answered','available','busy','inUse','invalid','loggedIn','loggedInDb','onHold','notInUse','paused','pTalking','ringing','ringInUse','sumBillable','sumDuration','talking','total','type','unavailable','unknown','unmanaged','waiting','outbound','dialActive','dialMethod'];(function(_0x378891,_0x4e3e16){var _0xfbfda2=function(_0x3b7681){while(--_0x3b7681){_0x378891['push'](_0x378891['shift']());}};_0xfbfda2(++_0x4e3e16);}(_0x1e89,0x129));var _0x91e8=function(_0x2088ce,_0x2f4659){_0x2088ce=_0x2088ce-0x0;var _0x14e5d5=_0x1e89[_0x2088ce];return _0x14e5d5;};'use strict';function VoiceQueueSummary(_0x546f0b){this['id']=_0x546f0b['id'];this[_0x91e8('0x0')]=_0x546f0b[_0x91e8('0x0')];this[_0x91e8('0x1')]=_0x546f0b['strategy'];this[_0x91e8('0x2')]=_0x546f0b[_0x91e8('0x2')]||0x0;this['answered']=_0x546f0b[_0x91e8('0x3')]||0x0;this[_0x91e8('0x4')]=_0x546f0b[_0x91e8('0x4')]||0x0;this[_0x91e8('0x5')]=_0x546f0b[_0x91e8('0x5')]||0x0;this[_0x91e8('0x6')]=_0x546f0b[_0x91e8('0x6')]||0x0;this[_0x91e8('0x7')]=_0x546f0b[_0x91e8('0x7')]||0x0;this[_0x91e8('0x8')]=_0x546f0b['loggedIn']||0x0;this[_0x91e8('0x9')]=_0x546f0b['loggedInDb']||0x0;this[_0x91e8('0xa')]=_0x546f0b[_0x91e8('0xa')]||0x0;this[_0x91e8('0xb')]=_0x546f0b[_0x91e8('0xb')]||0x0;this[_0x91e8('0xc')]=_0x546f0b['paused']||0x0;this[_0x91e8('0xd')]=_0x546f0b[_0x91e8('0xd')]||0x0;this[_0x91e8('0xe')]=_0x546f0b[_0x91e8('0xe')]||0x0;this[_0x91e8('0xf')]=_0x546f0b[_0x91e8('0xf')];this['sumBillable']=_0x546f0b[_0x91e8('0x10')];this[_0x91e8('0x11')]=_0x546f0b[_0x91e8('0x11')];this['sumHoldTime']=_0x546f0b['sumHoldTime']||0x0;this[_0x91e8('0x12')]=_0x546f0b[_0x91e8('0x12')]||0x0;this[_0x91e8('0x13')]=_0x546f0b[_0x91e8('0x13')]||0x0;this[_0x91e8('0x14')]=_0x546f0b[_0x91e8('0x14')];this[_0x91e8('0x15')]=_0x546f0b[_0x91e8('0x15')]||0x0;this[_0x91e8('0x16')]=_0x546f0b['unknown']||0x0;this[_0x91e8('0x17')]=_0x546f0b[_0x91e8('0x17')]||0x0;this[_0x91e8('0x18')]=_0x546f0b[_0x91e8('0x18')]||0x0;if(_0x546f0b[_0x91e8('0x14')]===_0x91e8('0x19')){this[_0x91e8('0x1a')]=_0x546f0b[_0x91e8('0x1a')];this[_0x91e8('0x1b')]=_0x546f0b[_0x91e8('0x1b')];this[_0x91e8('0x1c')]=_0x546f0b[_0x91e8('0x1c')];this['dialOriginateCallerIdNumber']=_0x546f0b['dialOriginateCallerIdNumber'];this[_0x91e8('0x1d')]=_0x546f0b[_0x91e8('0x1d')];this[_0x91e8('0x1e')]=_0x546f0b[_0x91e8('0x1e')];this['temp']=_0x546f0b[_0x91e8('0x1f')];this[_0x91e8('0x20')]=_0x546f0b[_0x91e8('0x20')];this[_0x91e8('0x21')]=_0x546f0b[_0x91e8('0x21')];this['outboundBlacklistCallsDay']=_0x546f0b['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x546f0b['outboundBusyCallsDay'];this[_0x91e8('0x22')]=_0x546f0b['outboundCongestionCallsDay'];this[_0x91e8('0x23')]=_0x546f0b[_0x91e8('0x23')];this[_0x91e8('0x24')]=_0x546f0b[_0x91e8('0x24')];this[_0x91e8('0x25')]=_0x546f0b[_0x91e8('0x25')];this['outboundNoAnswerCallsDay']=_0x546f0b[_0x91e8('0x26')];this[_0x91e8('0x27')]=_0x546f0b['outboundNoSuchCallsDay'];this[_0x91e8('0x28')]=_0x546f0b[_0x91e8('0x28')];this[_0x91e8('0x29')]=_0x546f0b[_0x91e8('0x29')];this[_0x91e8('0x2a')]=_0x546f0b[_0x91e8('0x2a')];this[_0x91e8('0x2b')]=_0x546f0b[_0x91e8('0x2b')];this[_0x91e8('0x2c')]=_0x546f0b[_0x91e8('0x2c')];this['predictiveIntervalAvgHoldtime']=_0x546f0b[_0x91e8('0x2d')];this[_0x91e8('0x2e')]=_0x546f0b[_0x91e8('0x2e')];this[_0x91e8('0x2f')]=_0x546f0b[_0x91e8('0x2f')];this['predictiveIntervalDroppedCallsTimeout']=_0x546f0b[_0x91e8('0x30')];this[_0x91e8('0x31')]=_0x546f0b['predictiveIntervalErlangCalls'];this[_0x91e8('0x32')]=_0x546f0b[_0x91e8('0x32')];this[_0x91e8('0x33')]=_0x546f0b['predictiveIntervalHitRate'];this[_0x91e8('0x34')]=_0x546f0b[_0x91e8('0x34')];this[_0x91e8('0x35')]=_0x546f0b[_0x91e8('0x35')];this['predictiveIntervalAvailable']=_0x546f0b['predictiveIntervalAvailable'];this[_0x91e8('0x36')]=_0x546f0b[_0x91e8('0x36')];this[_0x91e8('0x37')]=_0x546f0b['message'];this['originated']=_0x546f0b['originated'];this[_0x91e8('0x38')]=_0x546f0b[_0x91e8('0x38')];this[_0x91e8('0x39')]=_0x546f0b[_0x91e8('0x39')];this[_0x91e8('0x3a')]=_0x546f0b[_0x91e8('0x3a')];this['erlangBusyFactor']=_0x546f0b[_0x91e8('0x3b')];this[_0x91e8('0x3c')]=_0x546f0b['startPredictive'];this['startProgressive']=_0x546f0b[_0x91e8('0x3d')];}if(_0x546f0b[_0x91e8('0x3e')]){this['Trunk']={'id':_0x546f0b[_0x91e8('0x3e')]['id'],'name':_0x546f0b[_0x91e8('0x3e')]['name'],'active':_0x546f0b[_0x91e8('0x3e')]['active'],'callerid':_0x546f0b[_0x91e8('0x3e')][_0x91e8('0x3f')]};}if(_0x546f0b[_0x91e8('0x40')]){this['Interval']={'id':_0x546f0b[_0x91e8('0x40')]['id'],'name':_0x546f0b['Interval'][_0x91e8('0x0')]};}}module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0xb9bf=['ringInUse','sumBillable','sumDuration','sumHoldTime','talking','total','type','unavailable','unknown','unmanaged','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','exports','name','strategy','abandoned','answered','available','inUse','invalid','loggedIn','loggedInDb','onHold','notInUse','paused','pTalking','ringing'];(function(_0x11be60,_0x552db9){var _0x3fbb63=function(_0x26d00b){while(--_0x26d00b){_0x11be60['push'](_0x11be60['shift']());}};_0x3fbb63(++_0x552db9);}(_0xb9bf,0x7a));var _0xfb9b=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0xb9bf[_0x15c421];return _0x5e5ed5;};'use strict';function VoiceQueueSummary(_0x485fc6){this['id']=_0x485fc6['id'];this['name']=_0x485fc6[_0xfb9b('0x0')];this[_0xfb9b('0x1')]=_0x485fc6[_0xfb9b('0x1')];this[_0xfb9b('0x2')]=_0x485fc6[_0xfb9b('0x2')]||0x0;this[_0xfb9b('0x3')]=_0x485fc6['answered']||0x0;this[_0xfb9b('0x4')]=_0x485fc6[_0xfb9b('0x4')]||0x0;this['busy']=_0x485fc6['busy']||0x0;this[_0xfb9b('0x5')]=_0x485fc6[_0xfb9b('0x5')]||0x0;this[_0xfb9b('0x6')]=_0x485fc6[_0xfb9b('0x6')]||0x0;this[_0xfb9b('0x7')]=_0x485fc6[_0xfb9b('0x7')]||0x0;this[_0xfb9b('0x8')]=_0x485fc6[_0xfb9b('0x8')]||0x0;this['onHold']=_0x485fc6[_0xfb9b('0x9')]||0x0;this[_0xfb9b('0xa')]=_0x485fc6[_0xfb9b('0xa')]||0x0;this[_0xfb9b('0xb')]=_0x485fc6['paused']||0x0;this[_0xfb9b('0xc')]=_0x485fc6['pTalking']||0x0;this[_0xfb9b('0xd')]=_0x485fc6['ringing']||0x0;this[_0xfb9b('0xe')]=_0x485fc6[_0xfb9b('0xe')];this[_0xfb9b('0xf')]=_0x485fc6[_0xfb9b('0xf')];this[_0xfb9b('0x10')]=_0x485fc6[_0xfb9b('0x10')];this[_0xfb9b('0x11')]=_0x485fc6[_0xfb9b('0x11')]||0x0;this[_0xfb9b('0x12')]=_0x485fc6[_0xfb9b('0x12')]||0x0;this['total']=_0x485fc6[_0xfb9b('0x13')]||0x0;this['type']=_0x485fc6[_0xfb9b('0x14')];this[_0xfb9b('0x15')]=_0x485fc6[_0xfb9b('0x15')]||0x0;this[_0xfb9b('0x16')]=_0x485fc6[_0xfb9b('0x16')]||0x0;this['unmanaged']=_0x485fc6[_0xfb9b('0x17')]||0x0;this[_0xfb9b('0x18')]=_0x485fc6[_0xfb9b('0x18')]||0x0;if(_0x485fc6['type']===_0xfb9b('0x19')){this[_0xfb9b('0x1a')]=_0x485fc6[_0xfb9b('0x1a')];this[_0xfb9b('0x1b')]=_0x485fc6[_0xfb9b('0x1b')];this[_0xfb9b('0x1c')]=_0x485fc6['dialOriginateCallerIdName'];this[_0xfb9b('0x1d')]=_0x485fc6[_0xfb9b('0x1d')];this[_0xfb9b('0x1e')]=_0x485fc6[_0xfb9b('0x1e')];this['dialPrefix']=_0x485fc6['dialPrefix'];this[_0xfb9b('0x1f')]=_0x485fc6[_0xfb9b('0x1f')];this[_0xfb9b('0x20')]=_0x485fc6[_0xfb9b('0x20')];this[_0xfb9b('0x21')]=_0x485fc6[_0xfb9b('0x21')];this[_0xfb9b('0x22')]=_0x485fc6[_0xfb9b('0x22')];this[_0xfb9b('0x23')]=_0x485fc6[_0xfb9b('0x23')];this[_0xfb9b('0x24')]=_0x485fc6['outboundCongestionCallsDay'];this[_0xfb9b('0x25')]=_0x485fc6[_0xfb9b('0x25')];this[_0xfb9b('0x26')]=_0x485fc6[_0xfb9b('0x26')];this[_0xfb9b('0x27')]=_0x485fc6[_0xfb9b('0x27')];this[_0xfb9b('0x28')]=_0x485fc6[_0xfb9b('0x28')];this['outboundNoSuchCallsDay']=_0x485fc6[_0xfb9b('0x29')];this['outboundOriginateFailureCallsDay']=_0x485fc6['outboundOriginateFailureCallsDay'];this[_0xfb9b('0x2a')]=_0x485fc6['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x485fc6[_0xfb9b('0x2b')];this['outboundUnknownCallsDay']=_0x485fc6[_0xfb9b('0x2c')];this[_0xfb9b('0x2d')]=_0x485fc6['predictiveIntervalAnsweredCalls'];this['predictiveIntervalAvgHoldtime']=_0x485fc6[_0xfb9b('0x2e')];this[_0xfb9b('0x2f')]=_0x485fc6[_0xfb9b('0x2f')];this['predictiveIntervalDroppedCallsCallersExit']=_0x485fc6[_0xfb9b('0x30')];this[_0xfb9b('0x31')]=_0x485fc6[_0xfb9b('0x31')];this[_0xfb9b('0x32')]=_0x485fc6[_0xfb9b('0x32')];this[_0xfb9b('0x33')]=_0x485fc6[_0xfb9b('0x33')];this['predictiveIntervalHitRate']=_0x485fc6[_0xfb9b('0x34')];this[_0xfb9b('0x35')]=_0x485fc6[_0xfb9b('0x35')];this[_0xfb9b('0x36')]=_0x485fc6[_0xfb9b('0x36')];this['predictiveIntervalAvailable']=_0x485fc6['predictiveIntervalAvailable'];this[_0xfb9b('0x37')]=_0x485fc6[_0xfb9b('0x37')];this[_0xfb9b('0x38')]=_0x485fc6[_0xfb9b('0x38')];this[_0xfb9b('0x39')]=_0x485fc6[_0xfb9b('0x39')];this[_0xfb9b('0x3a')]=_0x485fc6['erlangCalls'];this[_0xfb9b('0x3b')]=_0x485fc6[_0xfb9b('0x3b')];this[_0xfb9b('0x3c')]=_0x485fc6[_0xfb9b('0x3c')];this[_0xfb9b('0x3d')]=_0x485fc6['erlangBusyFactor'];this[_0xfb9b('0x3e')]=_0x485fc6[_0xfb9b('0x3e')];this['startProgressive']=_0x485fc6[_0xfb9b('0x3f')];}if(_0x485fc6[_0xfb9b('0x40')]){this['Trunk']={'id':_0x485fc6['Trunk']['id'],'name':_0x485fc6['Trunk'][_0xfb9b('0x0')],'active':_0x485fc6['Trunk'][_0xfb9b('0x41')],'callerid':_0x485fc6['Trunk']['callerid']};}if(_0x485fc6['Interval']){this[_0xfb9b('0x42')]={'id':_0x485fc6['Interval']['id'],'name':_0x485fc6['Interval'][_0xfb9b('0x0')]};}}module[_0xfb9b('0x43')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index d7bb0db..dac570a 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 _0x55cd=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x57b236,_0x30614e){var _0x4feb29=function(_0x26d3e6){while(--_0x26d3e6){_0x57b236['push'](_0x57b236['shift']());}};_0x4feb29(++_0x30614e);}(_0x55cd,0xdb));var _0xd55c=function(_0x1f4e18,_0x4717dc){_0x1f4e18=_0x1f4e18-0x0;var _0x555c2a=_0x55cd[_0x1f4e18];return _0x555c2a;};'use strict';function VtigerAccount(_0x1ad8c9){this['id']=_0x1ad8c9['id']||0x0;this['name']=_0x1ad8c9[_0xd55c('0x0')]||'';this['username']=_0x1ad8c9[_0xd55c('0x1')]||'';this[_0xd55c('0x2')]=_0x1ad8c9[_0xd55c('0x2')]||'';this[_0xd55c('0x3')]=_0x1ad8c9['remoteUri']||'';this[_0xd55c('0x4')]=_0x1ad8c9[_0xd55c('0x4')]||'';this['Configurations']=_0x1ad8c9[_0xd55c('0x5')]||{};}module[_0xd55c('0x6')]=VtigerAccount; \ No newline at end of file +var _0x31e2=['remoteUri','serverUrl','Configurations','name','username','accessKey'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0x31e2,0x12f));var _0x231e=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0x31e2[_0x1030ce];return _0x3367fd;};'use strict';function VtigerAccount(_0x33c328){this['id']=_0x33c328['id']||0x0;this[_0x231e('0x0')]=_0x33c328[_0x231e('0x0')]||'';this[_0x231e('0x1')]=_0x33c328['username']||'';this[_0x231e('0x2')]=_0x33c328[_0x231e('0x2')]||'';this[_0x231e('0x3')]=_0x33c328[_0x231e('0x3')]||'';this[_0x231e('0x4')]=_0x33c328[_0x231e('0x4')]||'';this[_0x231e('0x5')]=_0x33c328[_0x231e('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 5ba12c6..9737ca4 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 _0xe228=['serverUrl','exports','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x4a278e,_0xb34daf){var _0xfd0b82=function(_0x41448f){while(--_0x41448f){_0x4a278e['push'](_0x4a278e['shift']());}};_0xfd0b82(++_0xb34daf);}(_0xe228,0xfc));var _0x8e22=function(_0x2f68c4,_0xb7d971){_0x2f68c4=_0x2f68c4-0x0;var _0x5b0735=_0xe228[_0x2f68c4];return _0x5b0735;};'use strict';function ZendeskAccount(_0x66774e){this['id']=_0x66774e['id']||0x0;this['name']=_0x66774e[_0x8e22('0x0')]||'';this[_0x8e22('0x1')]=_0x66774e[_0x8e22('0x1')]||'';this[_0x8e22('0x2')]=_0x66774e[_0x8e22('0x2')]||'';this[_0x8e22('0x3')]=_0x66774e[_0x8e22('0x3')]||'';this['remoteUri']=_0x66774e[_0x8e22('0x4')]||'';this[_0x8e22('0x5')]=_0x66774e[_0x8e22('0x5')]||'';this['type']=_0x66774e[_0x8e22('0x6')]||_0x8e22('0x7');this[_0x8e22('0x8')]=_0x66774e[_0x8e22('0x8')]||'';this['Configurations']=_0x66774e['Configurations']||{};}module[_0x8e22('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xf28e=['password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','name','username'];(function(_0x2ce499,_0x38a2dc){var _0x304d0f=function(_0x431b9e){while(--_0x431b9e){_0x2ce499['push'](_0x2ce499['shift']());}};_0x304d0f(++_0x38a2dc);}(_0xf28e,0xf8));var _0xef28=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0xf28e[_0x33554b];return _0x256954;};'use strict';function ZendeskAccount(_0x569232){this['id']=_0x569232['id']||0x0;this[_0xef28('0x0')]=_0x569232[_0xef28('0x0')]||'';this[_0xef28('0x1')]=_0x569232[_0xef28('0x1')]||'';this[_0xef28('0x2')]=_0x569232['password']||'';this[_0xef28('0x3')]=_0x569232[_0xef28('0x3')]||'';this[_0xef28('0x4')]=_0x569232[_0xef28('0x4')]||'';this[_0xef28('0x5')]=_0x569232['authType']||'';this[_0xef28('0x6')]=_0x569232[_0xef28('0x6')]||_0xef28('0x7');this[_0xef28('0x8')]=_0x569232[_0xef28('0x8')]||'';this[_0xef28('0x9')]=_0x569232['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 9d6585a..099a497 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 _0xf20d=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x16f35e,_0x2a432a){var _0x3a5403=function(_0x41d5ae){while(--_0x41d5ae){_0x16f35e['push'](_0x16f35e['shift']());}};_0x3a5403(++_0x2a432a);}(_0xf20d,0x193));var _0xdf20=function(_0x426048,_0x2ee84b){_0x426048=_0x426048-0x0;var _0x307f54=_0xf20d[_0x426048];return _0x307f54;};'use strict';function ZohoAccount(_0xf882c9){this['id']=_0xf882c9['id']||0x0;this[_0xdf20('0x0')]=_0xf882c9[_0xdf20('0x0')]||'';this[_0xdf20('0x1')]=_0xf882c9[_0xdf20('0x1')]||'';this[_0xdf20('0x2')]=_0xf882c9[_0xdf20('0x2')]||'';this[_0xdf20('0x3')]=_0xf882c9['zone']||'';this['clientId']=_0xf882c9[_0xdf20('0x4')]||'';this[_0xdf20('0x5')]=_0xf882c9['clientSecret']||'';this[_0xdf20('0x6')]=_0xf882c9[_0xdf20('0x6')]||'';this['code']=_0xf882c9[_0xdf20('0x7')]||'';this[_0xdf20('0x8')]=_0xf882c9[_0xdf20('0x8')]||'';this[_0xdf20('0x9')]=_0xf882c9[_0xdf20('0x9')]||{};}module[_0xdf20('0xa')]=ZohoAccount; \ No newline at end of file +var _0x6b5d=['exports','name','description','host','clientId','clientSecret','serverUrl','refreshToken','Configurations'];(function(_0x5c24b2,_0x5ab2f3){var _0x5e5c50=function(_0x1fa02e){while(--_0x1fa02e){_0x5c24b2['push'](_0x5c24b2['shift']());}};_0x5e5c50(++_0x5ab2f3);}(_0x6b5d,0x64));var _0xd6b5=function(_0x2d0e4c,_0x308307){_0x2d0e4c=_0x2d0e4c-0x0;var _0x401024=_0x6b5d[_0x2d0e4c];return _0x401024;};'use strict';function ZohoAccount(_0x4a67a6){this['id']=_0x4a67a6['id']||0x0;this[_0xd6b5('0x0')]=_0x4a67a6[_0xd6b5('0x0')]||'';this['description']=_0x4a67a6[_0xd6b5('0x1')]||'';this[_0xd6b5('0x2')]=_0x4a67a6[_0xd6b5('0x2')]||'';this['zone']=_0x4a67a6['zone']||'';this[_0xd6b5('0x3')]=_0x4a67a6[_0xd6b5('0x3')]||'';this[_0xd6b5('0x4')]=_0x4a67a6[_0xd6b5('0x4')]||'';this[_0xd6b5('0x5')]=_0x4a67a6['serverUrl']||'';this['code']=_0x4a67a6['code']||'';this[_0xd6b5('0x6')]=_0x4a67a6[_0xd6b5('0x6')]||'';this[_0xd6b5('0x7')]=_0x4a67a6['Configurations']||{};}module[_0xd6b5('0x8')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 3db839e..fd0860e 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 _0xf4f4=['active','calleridnum','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','util','lodash','isNil','uniqueid','idContact','queue','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','phone','firstName','Contact','lastName'];(function(_0x10dbf6,_0x3ff964){var _0x452147=function(_0x7476e0){while(--_0x7476e0){_0x10dbf6['push'](_0x10dbf6['shift']());}};_0x452147(++_0x3ff964);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x4e0553,_0x5b9049){_0x4e0553=_0x4e0553-0x0;var _0x53b5a2=_0xf4f4[_0x4e0553];return _0x53b5a2;};'use strict';var util=require(_0x4f4f('0x0'));var _=require(_0x4f4f('0x1'));var moment=require('moment');function checkNameSurname(_0x16a496,_0x304b11,_0x19aa05){var _0xfff808='';if(!_[_0x4f4f('0x2')](_0x304b11)&&'string'===typeof _0x304b11){_0xfff808+=_0x304b11;}if(!_[_0x4f4f('0x2')](_0x19aa05)&&'string'===typeof _0x19aa05){_0xfff808+='\x20'+_0x19aa05;}if(_0xfff808!==''){return _0xfff808;}return _0x16a496;}function Action(_0x3f274d,_0x132d5c,_0x20ee6e,_0x1ff75a,_0x3c4877){this[_0x4f4f('0x3')]=_0x20ee6e||undefined;this[_0x4f4f('0x4')]=_0x3f274d['id'];this[_0x4f4f('0x5')]=_0x132d5c['name'];this[_0x4f4f('0x6')]=_0x132d5c[_0x4f4f('0x6')];this[_0x4f4f('0x7')]=_0x4f4f('0x5');this[_0x4f4f('0x8')]=![];this[_0x4f4f('0x9')]=_[_0x4f4f('0x2')](_0x3f274d[_0x4f4f('0xa')])?undefined:_0x3f274d['Agent']['name'];this[_0x4f4f('0xb')]=this[_0x4f4f('0x9')]?util[_0x4f4f('0xc')](_0x4f4f('0xd'),this[_0x4f4f('0x9')]):_0x1ff75a||undefined;this[_0x4f4f('0xe')]=checkNameSurname(_0x3f274d['Contact'][_0x4f4f('0xf')],_0x3f274d['Contact'][_0x4f4f('0x10')],_0x3f274d[_0x4f4f('0x11')][_0x4f4f('0x12')]);this[_0x4f4f('0x13')]=_0x3f274d['active']||![];this[_0x4f4f('0x14')]=_0x3f274d['phone'];this['scheduledat']=_0x3f274d['scheduledat'];this[_0x4f4f('0x15')]=_0x3f274d[_0x4f4f('0x15')]||0x0;this[_0x4f4f('0x16')]=_0x3f274d[_0x4f4f('0x16')]||0x0;this[_0x4f4f('0x17')]=_0x3f274d[_0x4f4f('0x17')]||0x0;this[_0x4f4f('0x18')]=(_0x3f274d[_0x4f4f('0x15')]||0x0)+(_0x3f274d[_0x4f4f('0x16')]||0x0)+(_0x3f274d[_0x4f4f('0x17')]||0x0)+(_0x3f274d[_0x4f4f('0x19')]||0x0)+(_0x3f274d[_0x4f4f('0x1a')]||0x0)+(_0x3f274d['countabandonedretry']||0x0)+(_0x3f274d[_0x4f4f('0x1b')]||0x0)+(_0x3f274d[_0x4f4f('0x1c')]||0x0);this[_0x4f4f('0x19')]=_0x3f274d[_0x4f4f('0x19')]||0x0;this[_0x4f4f('0x1a')]=_0x3f274d[_0x4f4f('0x1a')]||0x0;this[_0x4f4f('0x1d')]=_0x3f274d[_0x4f4f('0x1d')]||0x0;this[_0x4f4f('0x1b')]=_0x3f274d[_0x4f4f('0x1b')]||0x0;this[_0x4f4f('0x1c')]=_0x3f274d[_0x4f4f('0x1c')]||0x0;this[_0x4f4f('0x1e')]=_0x3f274d[_0x4f4f('0x1e')];this['callbackuniqueid']=_0x3f274d['callbackuniqueid'];this['callbackat']=_0x3f274d[_0x4f4f('0x1f')];this[_0x4f4f('0x20')]=_0x3f274d['recallme'];this[_0x4f4f('0x21')]=_0x3f274d[_0x4f4f('0x21')];this[_0x4f4f('0x22')]=_0x3f274d[_0x4f4f('0x22')];this[_0x4f4f('0x23')]=_[_0x4f4f('0x2')](_0x3f274d[_0x4f4f('0xa')])?_0x3f274d['UserId']:_0x3f274d[_0x4f4f('0xa')]['id'];this[_0x4f4f('0x24')]=_0x3f274d[_0x4f4f('0x24')];this[_0x4f4f('0x25')]='';this[_0x4f4f('0x26')]='';}Action['prototype'][_0x4f4f('0x27')]=function(){return util[_0x4f4f('0xc')](_0x4f4f('0x28'),this['calleridname'],this['number']);};module['exports']=Action; \ No newline at end of file +var _0x5c3c=['prototype','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','idContact','queue','type','dialAnswer','Agent','channelAgent','membername','SIP/%s','calleridname','phone','Contact','firstName','lastName','calleridnum','scheduledat','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x5c3c,0x132));var _0xc5c3=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5c3c[_0x138adb];return _0x1b27f2;};'use strict';var util=require(_0xc5c3('0x0'));var _=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));function checkNameSurname(_0x32103c,_0x4b9233,_0x400726){var _0x3c5552='';if(!_[_0xc5c3('0x3')](_0x4b9233)&&_0xc5c3('0x4')===typeof _0x4b9233){_0x3c5552+=_0x4b9233;}if(!_[_0xc5c3('0x3')](_0x400726)&&_0xc5c3('0x4')===typeof _0x400726){_0x3c5552+='\x20'+_0x400726;}if(_0x3c5552!==''){return _0x3c5552;}return _0x32103c;}function Action(_0xe85098,_0x23a6b5,_0x28bdd9,_0x5a392b,_0x4b8404){this['uniqueid']=_0x28bdd9||undefined;this[_0xc5c3('0x5')]=_0xe85098['id'];this[_0xc5c3('0x6')]=_0x23a6b5['name'];this[_0xc5c3('0x7')]=_0x23a6b5[_0xc5c3('0x7')];this['campaigntype']=_0xc5c3('0x6');this[_0xc5c3('0x8')]=![];this['membername']=_[_0xc5c3('0x3')](_0xe85098[_0xc5c3('0x9')])?undefined:_0xe85098[_0xc5c3('0x9')]['name'];this[_0xc5c3('0xa')]=this[_0xc5c3('0xb')]?util['format'](_0xc5c3('0xc'),this[_0xc5c3('0xb')]):_0x5a392b||undefined;this[_0xc5c3('0xd')]=checkNameSurname(_0xe85098['Contact'][_0xc5c3('0xe')],_0xe85098[_0xc5c3('0xf')][_0xc5c3('0x10')],_0xe85098[_0xc5c3('0xf')][_0xc5c3('0x11')]);this['active']=_0xe85098['active']||![];this[_0xc5c3('0x12')]=_0xe85098[_0xc5c3('0xe')];this[_0xc5c3('0x13')]=_0xe85098[_0xc5c3('0x13')];this['countbusyretry']=_0xe85098['countbusyretry']||0x0;this[_0xc5c3('0x14')]=_0xe85098['countcongestionretry']||0x0;this[_0xc5c3('0x15')]=_0xe85098[_0xc5c3('0x15')]||0x0;this[_0xc5c3('0x16')]=(_0xe85098[_0xc5c3('0x17')]||0x0)+(_0xe85098[_0xc5c3('0x14')]||0x0)+(_0xe85098['countnoanswerretry']||0x0)+(_0xe85098[_0xc5c3('0x18')]||0x0)+(_0xe85098[_0xc5c3('0x19')]||0x0)+(_0xe85098[_0xc5c3('0x1a')]||0x0)+(_0xe85098[_0xc5c3('0x1b')]||0x0)+(_0xe85098['countagentrejectretry']||0x0);this[_0xc5c3('0x18')]=_0xe85098[_0xc5c3('0x18')]||0x0;this[_0xc5c3('0x19')]=_0xe85098[_0xc5c3('0x19')]||0x0;this[_0xc5c3('0x1a')]=_0xe85098['countabandonedretry']||0x0;this[_0xc5c3('0x1b')]=_0xe85098[_0xc5c3('0x1b')]||0x0;this[_0xc5c3('0x1c')]=_0xe85098[_0xc5c3('0x1c')]||0x0;this[_0xc5c3('0x1d')]=_0xe85098[_0xc5c3('0x1d')];this[_0xc5c3('0x1e')]=_0xe85098['callbackuniqueid'];this['callbackat']=_0xe85098[_0xc5c3('0x1f')];this[_0xc5c3('0x20')]=_0xe85098['recallme'];this['ContactId']=_0xe85098[_0xc5c3('0x21')];this[_0xc5c3('0x22')]=_0xe85098[_0xc5c3('0x22')];this['UserId']=_['isNil'](_0xe85098[_0xc5c3('0x9')])?_0xe85098[_0xc5c3('0x23')]:_0xe85098[_0xc5c3('0x9')]['id'];this[_0xc5c3('0x24')]=_0xe85098['VoiceQueueId'];this[_0xc5c3('0x25')]='';this['originatecalleridname']='';}Action[_0xc5c3('0x26')]['getCaller']=function(){return util[_0xc5c3('0x27')](_0xc5c3('0x28'),this[_0xc5c3('0xd')],this[_0xc5c3('0x29')]);};module[_0xc5c3('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 8558c5a..239de7b 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 _0xedf1=['unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','busy','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','NOANSWER','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','countcongestionretry','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','dialBusyRetryFrequency','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','uniqueid','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','phone','Contact\x20is\x20undefined','Queue','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','checkIsBlackList','VoiceQueueId','checkInBlack','[Preview][checkIsBlackList]','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','trim','dialCutDigit','SIP/%s/%s%s','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','isFailure','response','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][cause]','syncDialEnd','variables','keys','variable','addVariable','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','util','lodash','md5','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','format','voice:queue:%s','voice_queue:save','info','stringify','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','available','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','prototype','syncCampaigns','hasOwnProperty','dialMethod','booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','ListId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','getContactRecallMe','agentReadyId','then','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt'];(function(_0x2c6120,_0x1f3e60){var _0x5fb114=function(_0x45a72d){while(--_0x45a72d){_0x2c6120['push'](_0x2c6120['shift']());}};_0x5fb114(++_0x1f3e60);}(_0xedf1,0xb2));var _0x1edf=function(_0x4a0860,_0x10d619){_0x4a0860=_0x4a0860-0x0;var _0x4f8d2d=_0xedf1[_0x4a0860];return _0x4f8d2d;};'use strict';var util=require(_0x1edf('0x0'));var _=require(_0x1edf('0x1'));var uuid=require('uuid');var moment=require('moment');var md5=require(_0x1edf('0x2'));var Redis=require(_0x1edf('0x3'));var config=require(_0x1edf('0x4'));var logger=require('../../../config/logger')(_0x1edf('0x5'));var loggerAction=require(_0x1edf('0x6'))(_0x1edf('0x7'));var ami=require('../ami');var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x1edf('0x8'));var Action=require(_0x1edf('0x9'));var ut=require(_0x1edf('0xa'));config[_0x1edf('0xb')]=_[_0x1edf('0xc')](config[_0x1edf('0xb')],{'host':_0x1edf('0xd'),'port':0x18eb});var io=require(_0x1edf('0xe'))(new Redis(config[_0x1edf('0xb')]));var Sequence=function(){};Sequence['prototype'][_0x1edf('0xf')]=function(_0xd843f7){this[_0x1edf('0x10')]=this[_0x1edf('0x10')]?this['tail'][_0x1edf('0x11')](_0xd843f7):_0xd843f7();};function Preview(_0x53ff9f){this[_0x1edf('0x12')]=new Sequence();this[_0x1edf('0x13')]=_0x53ff9f[_0x1edf('0x14')];this[_0x1edf('0x15')]=_0x53ff9f[_0x1edf('0x15')];this[_0x1edf('0x16')]={};this[_0x1edf('0x17')]=_0x53ff9f[_0x1edf('0x17')];this[_0x1edf('0x18')]=0x0;ami['on']('originateresponse',this[_0x1edf('0x19')][_0x1edf('0x1a')](this));ami['on']('hangup',this[_0x1edf('0x1b')][_0x1edf('0x1a')](this));ami['on'](_0x1edf('0x1c'),this[_0x1edf('0x1d')][_0x1edf('0x1a')](this));ami['on'](_0x1edf('0x1e'),this['syncDialEnd'][_0x1edf('0x1a')](this));ami['on'](_0x1edf('0x1f'),this[_0x1edf('0x20')][_0x1edf('0x1a')](this));ami['on'](_0x1edf('0x21'),this[_0x1edf('0x22')]['bind'](this));ami['on'](_0x1edf('0x23'),this['syncAttendedTransfer'][_0x1edf('0x1a')](this));ami['on'](_0x1edf('0x24'),this[_0x1edf('0x25')][_0x1edf('0x1a')](this));this[_0x1edf('0x26')](this[_0x1edf('0x13')]);}function emit(_0x61679a,_0x3683f9,_0x38e25b){io['to'](_0x61679a)[_0x1edf('0x27')](_0x3683f9,_0x38e25b);}function emitCampaignPreview(_0x351442){if(_0x351442[_0x1edf('0x28')]===_0x1edf('0x29')){var _0x50cf63={'id':_0x351442['id'],'name':_0x351442[_0x1edf('0x2a')],'strategy':_0x351442[_0x1edf('0x2b')],'answered':_0x351442[_0x1edf('0x2c')],'available':_0x351442['available'],'loggedIn':_0x351442[_0x1edf('0x2d')],'pTalking':_0x351442[_0x1edf('0x2e')],'sumBillable':_0x351442[_0x1edf('0x2f')],'sumDuration':_0x351442[_0x1edf('0x30')],'sumHoldTime':_0x351442[_0x1edf('0x31')]||0x0,'talking':_0x351442[_0x1edf('0x32')],'total':_0x351442[_0x1edf('0x33')],'type':_0x351442[_0x1edf('0x28')],'unmanaged':_0x351442[_0x1edf('0x34')],'abandoned':_0x351442[_0x1edf('0x35')],'waiting':_0x351442[_0x1edf('0x36')],'loggedInDb':_0x351442[_0x1edf('0x37')],'dialActive':_0x351442[_0x1edf('0x38')],'dialMethod':_0x351442['dialMethod'],'dialOriginateCallerIdName':_0x351442['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x351442[_0x1edf('0x39')],'dialOriginateTimeout':_0x351442[_0x1edf('0x3a')],'dialPrefix':_0x351442[_0x1edf('0x3b')],'outboundAnswerAgiCallsDay':_0x351442[_0x1edf('0x3c')],'outboundAnswerCallsDay':_0x351442[_0x1edf('0x3d')],'outboundBlacklistCallsDay':_0x351442[_0x1edf('0x3e')],'outboundBusyCallsDay':_0x351442[_0x1edf('0x3f')],'outboundCongestionCallsDay':_0x351442[_0x1edf('0x40')],'outboundDropCallsDayACS':_0x351442[_0x1edf('0x41')],'outboundDropCallsDayCallersExit':_0x351442[_0x1edf('0x42')],'outboundDropCallsDayTimeout':_0x351442[_0x1edf('0x43')],'outboundNoAnswerCallsDay':_0x351442[_0x1edf('0x44')],'outboundNoSuchCallsDay':_0x351442[_0x1edf('0x45')],'outboundOriginateFailureCallsDay':_0x351442[_0x1edf('0x46')],'outboundReCallsDay':_0x351442['outboundReCallsDay'],'outboundRejectCallsDay':_0x351442[_0x1edf('0x47')],'outboundUnknownCallsDay':_0x351442['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x351442[_0x1edf('0x48')],'predictiveIntervalAnsweredCalls':_0x351442[_0x1edf('0x49')],'predictiveIntervalAvgHoldtime':_0x351442[_0x1edf('0x4a')],'predictiveIntervalAvgTalktime':_0x351442['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x351442[_0x1edf('0x4b')],'predictiveIntervalDroppedCallsTimeout':_0x351442['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x351442[_0x1edf('0x4c')],'predictiveIntervalErlangCallsDroppedCalls':_0x351442[_0x1edf('0x4d')],'predictiveIntervalHitRate':_0x351442['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x351442[_0x1edf('0x4e')],'predictiveIntervalPauses':_0x351442[_0x1edf('0x4f')],'predictiveIntervalAvailable':_0x351442[_0x1edf('0x50')],'predictiveIntervalTotalCalls':_0x351442[_0x1edf('0x51')],'message':_0x351442[_0x1edf('0x52')],'originated':_0x351442[_0x1edf('0x53')],'erlangCalls':_0x351442[_0x1edf('0x54')],'erlangCallToSecond':_0x351442[_0x1edf('0x55')],'erlangAbandonmentRate':_0x351442[_0x1edf('0x56')],'erlangBusyFactor':_0x351442[_0x1edf('0x57')],'startPredictive':_0x351442[_0x1edf('0x58')],'startProgressive':_0x351442['startProgressive']};if(_0x351442[_0x1edf('0x59')]){_0x50cf63[_0x1edf('0x59')]={'id':_0x351442[_0x1edf('0x59')]['id'],'name':_0x351442[_0x1edf('0x59')][_0x1edf('0x2a')],'active':_0x351442[_0x1edf('0x59')][_0x1edf('0x5a')],'callerid':_0x351442[_0x1edf('0x59')][_0x1edf('0x5b')]};}if(_0x351442[_0x1edf('0x5c')]){_0x50cf63[_0x1edf('0x5c')]={'id':_0x351442[_0x1edf('0x5c')]['id'],'name':_0x351442['Interval'][_0x1edf('0x2a')]};}var _0x2ce5da=md5(JSON['stringify'](_0x50cf63));if(_0x351442['md5']!==_0x2ce5da){_0x351442[_0x1edf('0x2')]=_0x2ce5da;emit(util[_0x1edf('0x5d')](_0x1edf('0x5e'),_0x50cf63[_0x1edf('0x2a')]),_0x1edf('0x5f'),_0x50cf63);}}}function emitVoiceQueueChannelRemove(_0x4243cb){logger[_0x1edf('0x60')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x1edf('0x61')](_0x4243cb));emit(util[_0x1edf('0x5d')](_0x1edf('0x5e'),_0x4243cb[_0x1edf('0x2a')]),_0x1edf('0x62'),_0x4243cb);io[_0x1edf('0x27')](_0x1edf('0x63'),_0x4243cb);}function notSendMessagesQueue(_0x2e61e3){if(_0x2e61e3[_0x1edf('0x64')]){if(_0x2e61e3[_0x1edf('0x53')]===0x0&&_0x2e61e3[_0x1edf('0x2e')]===0x0){_0x2e61e3['sendMessageOneNotActive']=![];_0x2e61e3[_0x1edf('0x65')]=0x0;_0x2e61e3[_0x1edf('0x66')]=0x0;_0x2e61e3[_0x1edf('0x52')]='NOT_ACTIVE';ut[_0x1edf('0x67')](_0x1edf('0x68'),_0x2e61e3[_0x1edf('0x2a')]+_0x1edf('0x69'));}else{_0x2e61e3[_0x1edf('0x52')]=_0x1edf('0x6a');ut[_0x1edf('0x67')](_0x1edf('0x68'),_0x2e61e3[_0x1edf('0x2a')]+_0x1edf('0x6b'));}emitCampaignPreview(_0x2e61e3);}}Preview[_0x1edf('0x6c')]['loopCampaigns']=function(){var _0x50cc4f=this;setInterval(function(){_0x50cc4f[_0x1edf('0x6d')]();},0x7cf);};Preview[_0x1edf('0x6c')][_0x1edf('0x6d')]=function(){var _0x4a011=this[_0x1edf('0x13')];this[_0x1edf('0x18')]+=0x1;for(var _0x171af6 in _0x4a011){if(_0x4a011[_0x1edf('0x6e')](_0x171af6)&&(_0x4a011[_0x171af6][_0x1edf('0x6f')]===_0x1edf('0x5')||_0x4a011[_0x171af6]['dialMethod']===_0x1edf('0x70'))&&_0x4a011[_0x171af6][_0x1edf('0x28')]===_0x1edf('0x29')){if(this[_0x1edf('0x18')]>0x7){this[_0x1edf('0x18')]=0x0;this[_0x1edf('0x71')]();}}if(_0x4a011[_0x1edf('0x6e')](_0x171af6)&&_0x4a011[_0x171af6][_0x1edf('0x6f')]===_0x1edf('0x5')&&_0x4a011[_0x171af6][_0x1edf('0x28')]==='outbound'){if(_0x4a011[_0x171af6]['dialActive']){this[_0x1edf('0x72')](_0x4a011[_0x171af6]);if(_0x4a011[_0x171af6]['dialPreviewAutoRecallMe'])this[_0x1edf('0x73')](_0x4a011[_0x171af6]);}else{notSendMessagesQueue(_0x4a011[_0x171af6]);}}}};Preview[_0x1edf('0x6c')][_0x1edf('0x74')]=function(_0x32ea94){var _0x45054c=this;this[_0x1edf('0x12')]['enqueue'](function(){if(!_[_0x1edf('0x75')](_0x45054c['actions'][_0x32ea94])){loggerAction[_0x1edf('0x60')](_0x1edf('0x76'),_0x32ea94,'Queue',_0x45054c[_0x1edf('0x16')][_0x32ea94][_0x1edf('0x77')],_0x1edf('0x78'),JSON[_0x1edf('0x61')](_0x45054c[_0x1edf('0x13')][_0x45054c[_0x1edf('0x16')][_0x32ea94][_0x1edf('0x77')]][_0x1edf('0x53')]),_0x1edf('0x79'),JSON[_0x1edf('0x61')](_0x45054c['campaignsPreview'][_0x45054c[_0x1edf('0x16')][_0x32ea94]['queue']][_0x1edf('0x2e')]),JSON[_0x1edf('0x61')](_0x45054c[_0x1edf('0x16')][_0x32ea94][_0x1edf('0x7a')]),JSON[_0x1edf('0x61')](_['pick'](_0x45054c[_0x1edf('0x16')][_0x32ea94],[_0x1edf('0x7b'),'UserId','VoiceQueueId',_0x1edf('0x7c')])));return ami[_0x1edf('0x7d')]({'action':_0x1edf('0x7e'),'channel':_0x45054c[_0x1edf('0x16')][_0x32ea94][_0x1edf('0x7f')]})[_0x1edf('0x80')](function(_0x7b5d4e){if(_0x7b5d4e['message']===_0x1edf('0x81')){setTimeout(function(){if(_0x45054c[_0x1edf('0x16')][_0x32ea94]){ut['updateOriginated'](_0x45054c['campaignsPreview'][_0x45054c[_0x1edf('0x16')][_0x32ea94][_0x1edf('0x77')]],_0x1edf('0x82'));if(_0x45054c[_0x1edf('0x16')][_0x32ea94][_0x1edf('0x7a')]===!![]){ut[_0x1edf('0x83')](_0x45054c[_0x1edf('0x13')][_0x45054c['actions'][_0x32ea94]['queue']],_0x1edf('0x82'));ut['loggerError'](_0x1edf('0x84')+_0x32ea94,_0x45054c[_0x1edf('0x16')][_0x32ea94][_0x1edf('0x77')]);}ut[_0x1edf('0x85')](_0x1edf('0x86')+_0x32ea94,_0x45054c[_0x1edf('0x16')][_0x32ea94][_0x1edf('0x77')]);delete _0x45054c['actions'][_0x32ea94];}},0x2328);}});}});};Preview['prototype'][_0x1edf('0x71')]=function(){var _0x4447a5=this;loggerAction['info']('[action]',_['size'](this[_0x1edf('0x16')]));for(var _0x14adc6 in this[_0x1edf('0x16')]){if(_0x4447a5['actions'][_0x1edf('0x6e')](_0x14adc6)){_0x4447a5[_0x1edf('0x74')](_0x14adc6);}}};Preview[_0x1edf('0x6c')][_0x1edf('0x73')]=function(_0x4a42c6){var _0x4cb1d1=this;rpcDb[_0x1edf('0x87')](_0x4a42c6['id'],ut[_0x1edf('0x88')](this['agents']))[_0x1edf('0x89')](function(_0x55d894){if(!_[_0x1edf('0x75')](_0x55d894)){for(var _0x244fe1=0x0;_0x244fe1<_0x55d894['length'];_0x244fe1+=0x1){if(ut['getDiff'](_0x55d894[_0x244fe1][_0x1edf('0x8a')])<_0x4a42c6[_0x1edf('0x8b')]*0x3c){if(_0x55d894[_0x244fe1]['Agent']&&!_0x55d894[_0x244fe1][_0x1edf('0x8c')][_0x1edf('0x8d')]){_0x4cb1d1[_0x1edf('0x8e')](_0x55d894[_0x244fe1]['id'])['then'](ut['logger2'](_0x1edf('0x8f')))[_0x1edf('0x80')](ut[_0x1edf('0x90')]('[RecallMe]'));}else{rpcDb[_0x1edf('0x91')](_0x55d894[_0x244fe1]['id']);}}else{var _0x3d1c34=new Action(_0x55d894[_0x244fe1],_0x4a42c6);_0x3d1c34[_0x1edf('0x92')]=moment()[_0x1edf('0x5d')](_0x1edf('0x93'));_0x4a42c6[_0x1edf('0x94')]+=0x1;ut[_0x1edf('0x95')](_0x3d1c34,0x17,_0x1edf('0x96'));if(_0x4a42c6[_0x1edf('0x97')]){rpcDb[_0x1edf('0x98')](ut[_0x1edf('0x99')](_0x55d894[_0x244fe1]));rpcDb['createCustomerHistory'](_0x3d1c34,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x1edf('0x95')](_0x3d1c34,0x16,_0x1edf('0x9a'));rpcDb[_0x1edf('0x9b')](_0x3d1c34,_0x1edf('0x9c'));rpcDb[_0x1edf('0x9d')](_0x3d1c34,_0x1edf('0x9c'));}}}}})[_0x1edf('0x80')](ut[_0x1edf('0x90')](_0x1edf('0x9e')));};Preview[_0x1edf('0x6c')][_0x1edf('0x72')]=function(_0x13a8bd){_0x13a8bd[_0x1edf('0x64')]=!![];if(ut[_0x1edf('0x9f')](_0x13a8bd[_0x1edf('0x2d')])){_0x13a8bd[_0x1edf('0x52')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x1edf('0xa0')](_0x13a8bd[_0x1edf('0x38')])){_0x13a8bd[_0x1edf('0x52')]='NOT_ACTIVE';}else if(!this[_0x1edf('0xa1')](_0x13a8bd[_0x1edf('0x59')])){if(!this[_0x1edf('0xa1')](_0x13a8bd[_0x1edf('0xa2')])){_0x13a8bd[_0x1edf('0x52')]=_0x1edf('0xa3');}else{_0x13a8bd[_0x1edf('0x52')]=_0x1edf('0xa4');}}else{_0x13a8bd[_0x1edf('0x52')]=_0x1edf('0xa4');}emitCampaignPreview(_0x13a8bd);};Preview[_0x1edf('0x6c')][_0x1edf('0xa5')]=function(_0x994f6,_0x85b980,_0x2e9a04){var _0x89b203=this;var _0x9ab8c6=this['actions'][_0x85b980];var _0x508b9d=this['campaignsPreview'][_0x9ab8c6[_0x1edf('0x77')]];var _0x31befa;var _0x2a35a7=![];var _0x2b43c0=0x2;var _0x1d8b6f=0x3;if(_0x508b9d){switch(_0x2e9a04){case'1':_0x508b9d[_0x1edf('0x45')]+=0x1;_0x9ab8c6[_0x1edf('0xa6')]+=0x1;_0x9ab8c6[_0x1edf('0xa7')]=ut[_0x1edf('0xa8')](_0x9ab8c6);ut['logCustomer'](_0x9ab8c6,0x0,_0x1edf('0xa9'));ami[_0x1edf('0x27')](_0x1edf('0xaa'),ut[_0x1edf('0xab')](_0x9ab8c6,_0x1edf('0xac')));rpcDb['createCustomerHistory'](_0x9ab8c6,'[callProgressDetectingCustomer][logNoSuch]');_0x89b203[_0x1edf('0xad')](_0x9ab8c6,'0',_0x508b9d)[_0x1edf('0x89')](function(_0x290da4){_0x2a35a7=_0x290da4[_0x1edf('0xae')]==0x1;_0x2b43c0=_0x508b9d[_0x1edf('0xaf')];_0x1d8b6f=_0x508b9d[_0x1edf('0xb0')];if(!_0x2a35a7){if(ut[_0x1edf('0xa8')](_0x9ab8c6)>=_0x508b9d[_0x1edf('0xb1')]){_0x31befa=ut['cloneAction'](_0x9ab8c6,0xf,_0x1edf('0xb2'));rpcDb[_0x1edf('0x9d')](_0x31befa,_0x1edf('0xb3'));}else{if(_0x9ab8c6[_0x1edf('0xa6')]>=_0x508b9d[_0x1edf('0xb4')]){rpcDb[_0x1edf('0x9d')](_0x9ab8c6,_0x1edf('0xb3'));}else{rpcDb[_0x1edf('0xb5')](ut[_0x1edf('0xb6')](_0x9ab8c6,_0x1edf('0xa6'),_0x508b9d[_0x1edf('0xaf')]),_0x9ab8c6[_0x1edf('0xb7')],_0x9ab8c6[_0x1edf('0xb8')]);}}delete this[_0x1edf('0x16')][_0x994f6[_0x1edf('0xb9')]];}else{_0x9ab8c6[_0x1edf('0xa6')]++;logger[_0x1edf('0x60')](_0x1edf('0xba'),_0x9ab8c6['countnosuchnumberretry']);logger[_0x1edf('0x60')]('id',_0x9ab8c6[_0x1edf('0xbb')]);_0x89b203[_0x1edf('0xbc')]({'id':_0x9ab8c6[_0x1edf('0xbb')],'field':{'countnosuchnumberretry':_0x9ab8c6['countnosuchnumberretry']}})['then'](function(){_0x89b203[_0x1edf('0xbd')](_0x9ab8c6,_0x2b43c0,_0x1d8b6f)[_0x1edf('0x89')](function(){});});}});break;case _0x1edf('0xbe'):var _0x165e46=moment()[_0x1edf('0x5d')](_0x1edf('0x93'));_0x9ab8c6[_0x1edf('0xbf')]=_0x165e46;_0x9ab8c6['answertime']=_0x165e46;_0x9ab8c6[_0x1edf('0x7a')]=!![];_0x508b9d['pTalking']+=0x1;logger[_0x1edf('0x60')](_0x1edf('0xc0'),_0x9ab8c6['uniqueid'],_0x1edf('0xc1'),_0x508b9d[_0x1edf('0x2a')],_0x1edf('0x79'),_0x508b9d[_0x1edf('0x2e')]);ami[_0x1edf('0x27')](_0x1edf('0xc2'),ut[_0x1edf('0xab')](_0x9ab8c6,'connect',this[_0x1edf('0x13')][_0x9ab8c6[_0x1edf('0x77')]]));if(_0x508b9d['acw']){ami['emit'](_0x1edf('0xc3'),ut[_0x1edf('0xc4')](_0x9ab8c6));}break;case'16':ami['emit'](_0x1edf('0xc5'),ut[_0x1edf('0xab')](_0x9ab8c6,_0x1edf('0xc6'),this[_0x1edf('0x13')][_0x9ab8c6['queue']]));emitVoiceQueueChannelRemove(ut[_0x1edf('0xab')](_0x9ab8c6,'complete'));_0x508b9d[_0x1edf('0x3d')]+=0x1;_0x508b9d['total']+=0x1;_0x508b9d[_0x1edf('0x2c')]+=0x1;ut['decrementTalkink'](_0x508b9d,_0x1edf('0xc7'));_0x9ab8c6['countglobal']=ut['totalGlobal'](_0x9ab8c6);ut[_0x1edf('0x95')](_0x9ab8c6,0x4,_0x1edf('0xc8'));rpcDb['createCustomerHistory'](_0x9ab8c6,_0x1edf('0xc9'));rpcDb[_0x1edf('0x9d')](_0x9ab8c6,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x1edf('0xca')](_0x9ab8c6);_0x508b9d[_0x1edf('0x30')]+=_0x9ab8c6[_0x1edf('0xcb')];_0x508b9d[_0x1edf('0x2f')]+=_0x9ab8c6[_0x1edf('0xcb')];logger['info'](_0x1edf('0xcc'),_0x9ab8c6['uniqueid'],_0x1edf('0xc1'),_0x508b9d['name'],_0x1edf('0x79'),_0x508b9d[_0x1edf('0x2e')]);delete this[_0x1edf('0x16')][_0x994f6[_0x1edf('0xb9')]];break;case _0x1edf('0xcd'):_0x508b9d[_0x1edf('0x3f')]+=0x1;_0x9ab8c6[_0x1edf('0xce')]+=0x1;_0x9ab8c6['countglobal']=ut[_0x1edf('0xa8')](_0x9ab8c6);ut[_0x1edf('0x95')](_0x9ab8c6,0x5,'Busy');_0x2b43c0=_0x508b9d['dialBusyRetryFrequency'];_0x1d8b6f=_0x508b9d[_0x1edf('0xb0')];ami[_0x1edf('0x27')]('custom:agentbusy',ut[_0x1edf('0xab')](_0x9ab8c6,_0x1edf('0xcf')));rpcDb['createCustomerHistory'](_0x9ab8c6,'[callProgressDetectingCustomer][logBusy]');_0x89b203[_0x1edf('0xad')](_0x9ab8c6,'5',_0x508b9d)[_0x1edf('0x89')](function(_0x32076d){_0x2a35a7=_0x32076d[_0x1edf('0xae')]==0x1;if(!_0x2a35a7){if(ut[_0x1edf('0xa8')](_0x9ab8c6)>=_0x508b9d[_0x1edf('0xb1')]){_0x31befa=ut[_0x1edf('0xd0')](_0x9ab8c6,0xf,'Global');rpcDb['createCustomerFinal'](_0x31befa,_0x1edf('0xd1'));}else{if(_0x9ab8c6[_0x1edf('0xce')]>=_0x508b9d[_0x1edf('0xd2')]){rpcDb[_0x1edf('0x9d')](_0x9ab8c6,_0x1edf('0xd3'));}else{rpcDb[_0x1edf('0xb5')](ut[_0x1edf('0xb6')](_0x9ab8c6,_0x1edf('0xce'),_0x508b9d['dialBusyRetryFrequency']),_0x9ab8c6[_0x1edf('0xb7')],_0x9ab8c6[_0x1edf('0xb8')]);}}}else{_0x9ab8c6['countbusyretry']++;_0x89b203[_0x1edf('0xbc')]({'id':_0x9ab8c6['idContact'],'field':{'countbusyretry':_0x9ab8c6['countbusyretry']}})[_0x1edf('0x89')](function(){_0x89b203['swapAdditionalPhones'](_0x9ab8c6,_0x2b43c0,_0x1d8b6f)['then'](function(){});});}});break;case _0x1edf('0xd4'):_0x508b9d[_0x1edf('0x44')]+=0x1;_0x9ab8c6['countnoanswerretry']+=0x1;_0x9ab8c6[_0x1edf('0xa7')]=ut[_0x1edf('0xa8')](_0x9ab8c6);ut[_0x1edf('0x95')](_0x9ab8c6,0x3,_0x1edf('0xd5'));_0x2b43c0=_0x508b9d[_0x1edf('0xd6')];_0x1d8b6f=_0x508b9d[_0x1edf('0xb0')];var _0x36c0a=ut[_0x1edf('0xd7')](_0x9ab8c6,_0x508b9d);ami[_0x1edf('0x27')](_0x1edf('0xd8'),_0x36c0a);rpcDb['createCustomerHistory'](_0x9ab8c6,'[callProgressDetectingCustomer][logNoAnswer]');_0x89b203['verifyAdditionalPhones'](_0x9ab8c6,'3',_0x508b9d)[_0x1edf('0x89')](function(_0x2e0208){_0x2a35a7=_0x2e0208[_0x1edf('0xae')]==0x1;if(!_0x2a35a7){if(ut[_0x1edf('0xa8')](_0x9ab8c6)>=_0x508b9d[_0x1edf('0xb1')]){_0x31befa=ut[_0x1edf('0xd0')](_0x9ab8c6,0xf,'Global');rpcDb[_0x1edf('0x9d')](_0x31befa,_0x1edf('0xd9'));}else{if(_0x9ab8c6[_0x1edf('0xda')]>=_0x508b9d[_0x1edf('0xdb')]){rpcDb[_0x1edf('0x9d')](_0x9ab8c6,_0x1edf('0xdc'));}else{rpcDb['rescheduleContact'](ut[_0x1edf('0xb6')](_0x9ab8c6,_0x1edf('0xda'),_0x508b9d['dialNoAnswerRetryFrequency']),_0x9ab8c6[_0x1edf('0xb7')],_0x9ab8c6['activeContact']);}}}else{_0x9ab8c6['countnoanswerretry']++;_0x89b203[_0x1edf('0xbc')]({'id':_0x9ab8c6[_0x1edf('0xbb')],'field':{'countnoanswerretry':_0x9ab8c6[_0x1edf('0xda')]}})[_0x1edf('0x89')](function(){_0x89b203[_0x1edf('0xbd')](_0x9ab8c6,_0x2b43c0,_0x1d8b6f)['then'](function(){});});}});break;case _0x1edf('0xdd'):_0x508b9d['outboundCongestionCallsDay']+=0x1;_0x9ab8c6[_0x1edf('0xde')]+=0x1;_0x9ab8c6[_0x1edf('0xa7')]=ut[_0x1edf('0xa8')](_0x9ab8c6);ut[_0x1edf('0x95')](_0x9ab8c6,0x8,'Congestion');_0x2b43c0=_0x508b9d[_0x1edf('0xdf')];_0x1d8b6f=_0x508b9d[_0x1edf('0xb0')];ami[_0x1edf('0x27')](_0x1edf('0xe0'),ut[_0x1edf('0xab')](_0x9ab8c6,_0x1edf('0xe1')));rpcDb['createCustomerHistory'](_0x9ab8c6,_0x1edf('0xe2'));_0x89b203['verifyAdditionalPhones'](_0x9ab8c6,'8',_0x508b9d)[_0x1edf('0x89')](function(_0x23dc51){_0x2a35a7=_0x23dc51[_0x1edf('0xae')]==0x1;if(!_0x2a35a7){if(ut[_0x1edf('0xa8')](_0x9ab8c6)>=_0x508b9d[_0x1edf('0xb1')]){_0x31befa=ut[_0x1edf('0xd0')](_0x9ab8c6,0xf,_0x1edf('0xb2'));rpcDb['createCustomerFinal'](_0x31befa,_0x1edf('0xe3'));}else{if(_0x9ab8c6[_0x1edf('0xde')]>=_0x508b9d[_0x1edf('0xe4')]){rpcDb[_0x1edf('0x9d')](_0x9ab8c6,_0x1edf('0xe2'));}else{rpcDb[_0x1edf('0xb5')](ut[_0x1edf('0xb6')](_0x9ab8c6,_0x1edf('0xde'),_0x508b9d[_0x1edf('0xe5')]),_0x9ab8c6['unlockAgent'],_0x9ab8c6[_0x1edf('0xb8')]);}}}else{_0x9ab8c6[_0x1edf('0xde')]++;_0x89b203['incrementPreviewCounters']({'id':_0x9ab8c6['idContact'],'field':{'countcongestionretry':_0x9ab8c6['countcongestionretry']}})[_0x1edf('0x89')](function(){_0x89b203['swapAdditionalPhones'](_0x9ab8c6,_0x2b43c0,_0x1d8b6f)['then'](function(){});});}});break;case _0x1edf('0xe6'):_0x508b9d['outboundRejectCallsDay']+=0x1;_0x9ab8c6[_0x1edf('0xe7')]+=0x1;_0x9ab8c6['countglobal']=ut['totalGlobal'](_0x9ab8c6);ut[_0x1edf('0x95')](_0x9ab8c6,0x14,_0x1edf('0xe8'));_0x2b43c0=_0x508b9d[_0x1edf('0xe9')];_0x1d8b6f=_0x508b9d[_0x1edf('0xb0')];ami[_0x1edf('0x27')](_0x1edf('0xea'),ut['buildObj'](_0x9ab8c6,_0x1edf('0xeb')));rpcDb[_0x1edf('0x9b')](_0x9ab8c6,_0x1edf('0xec'));_0x89b203[_0x1edf('0xad')](_0x9ab8c6,'20',_0x508b9d)[_0x1edf('0x89')](function(_0x35da75){_0x2a35a7=_0x35da75[_0x1edf('0xae')]==0x1;if(!_0x2a35a7){if(ut[_0x1edf('0xa8')](_0x9ab8c6)>=_0x508b9d[_0x1edf('0xb1')]){_0x31befa=ut[_0x1edf('0xd0')](_0x9ab8c6,0x14,'AgentReject');rpcDb[_0x1edf('0x9d')](_0x31befa,_0x1edf('0xed'));}else{if(_0x9ab8c6[_0x1edf('0xe7')]>=_0x508b9d[_0x1edf('0xee')]){rpcDb['createCustomerFinal'](_0x9ab8c6,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x1edf('0xb5')](ut['scheduledAt'](_0x9ab8c6,_0x1edf('0xe7'),_0x508b9d[_0x1edf('0xe9')]),_0x9ab8c6['unlockAgent'],_0x9ab8c6[_0x1edf('0xb8')]);}}}else{_0x9ab8c6['countnoanswerretry']++;_0x89b203[_0x1edf('0xbc')]({'id':_0x9ab8c6[_0x1edf('0xbb')],'field':{'countnoanswerretry':_0x9ab8c6[_0x1edf('0xda')]}})[_0x1edf('0x89')](function(){_0x89b203[_0x1edf('0xbd')](_0x9ab8c6,_0x2b43c0,_0x1d8b6f)[_0x1edf('0x89')](function(){});});}});break;case _0x1edf('0xef'):_0x508b9d[_0x1edf('0x48')]+=0x1;_0x9ab8c6[_0x1edf('0xf0')]+=0x1;_0x9ab8c6[_0x1edf('0xa7')]=ut[_0x1edf('0xa8')](_0x9ab8c6);ut['logCustomer'](_0x9ab8c6,0xb,'Abandoned');rpcDb['createCustomerHistory'](_0x9ab8c6,'[callProgressDetectingCustomer][logAbandoned]');_0x89b203[_0x1edf('0xad')](_0x9ab8c6,'11',_0x508b9d)['then'](function(_0x203e7e){_0x2a35a7=_0x203e7e[_0x1edf('0xae')]==0x1;if(!_0x2a35a7){if(ut[_0x1edf('0xa8')](_0x9ab8c6)>=_0x508b9d[_0x1edf('0xb1')]){_0x31befa=ut[_0x1edf('0xd0')](_0x9ab8c6,0xf,_0x1edf('0xb2'));rpcDb[_0x1edf('0x9d')](_0x31befa,_0x1edf('0xf1'));}else{if(_0x9ab8c6[_0x1edf('0xf2')]>=_0x508b9d[_0x1edf('0xf3')]){rpcDb[_0x1edf('0x9d')](_0x9ab8c6,_0x1edf('0xf1'));}else{rpcDb[_0x1edf('0xb5')](ut[_0x1edf('0xb6')](_0x9ab8c6,_0x1edf('0xf0'),_0x508b9d['dialAbandonedRetryFrequency']),_0x9ab8c6[_0x1edf('0xb7')],_0x9ab8c6[_0x1edf('0xb8')]);}}}else{_0x9ab8c6[_0x1edf('0xda')]++;_0x89b203[_0x1edf('0xbc')]({'id':_0x9ab8c6[_0x1edf('0xbb')],'field':{'countnoanswerretry':_0x9ab8c6[_0x1edf('0xda')]}})[_0x1edf('0x89')](function(){_0x89b203[_0x1edf('0xbd')](_0x9ab8c6,_0x2b43c0,_0x1d8b6f)['then'](function(){});});}});break;case'18':_0x508b9d[_0x1edf('0xf4')]+=0x1;_0x9ab8c6[_0x1edf('0xf5')]+=0x1;_0x9ab8c6[_0x1edf('0xa7')]=ut[_0x1edf('0xa8')](_0x9ab8c6);ut[_0x1edf('0x95')](_0x9ab8c6,0x12,_0x994f6[_0x1edf('0xf6')]||_0x994f6[_0x1edf('0xf7')]);ami[_0x1edf('0x27')](_0x1edf('0xf8'),ut['buildObj'](_0x9ab8c6,_0x1edf('0xf9')));rpcDb[_0x1edf('0x9b')](_0x9ab8c6,'[callProgressDetectingCustomer][hangupInAMD]');_0x89b203[_0x1edf('0xad')](_0x9ab8c6,'18',_0x508b9d)[_0x1edf('0x89')](function(_0xe95af8){_0x2a35a7=_0xe95af8[_0x1edf('0xae')]==0x1;if(!_0x2a35a7){if(ut[_0x1edf('0xa8')](_0x9ab8c6)>=_0x508b9d[_0x1edf('0xb1')]){_0x31befa=ut['cloneAction'](_0x9ab8c6,0x12,_0x1edf('0xb2'));rpcDb['createCustomerFinal'](_0x31befa,_0x1edf('0xfa'));}else{rpcDb[_0x1edf('0x9d')](_0x9ab8c6,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x9ab8c6[_0x1edf('0xda')]++;_0x89b203[_0x1edf('0xbc')]({'id':_0x9ab8c6[_0x1edf('0xbb')],'field':{'countnoanswerretry':_0x9ab8c6[_0x1edf('0xda')]}})[_0x1edf('0x89')](function(){_0x89b203[_0x1edf('0xbd')](_0x9ab8c6,_0x2b43c0,_0x1d8b6f)[_0x1edf('0x89')](function(){});});}});delete this[_0x1edf('0x16')][_0x994f6[_0x1edf('0xb9')]];break;case'19':_0x508b9d[_0x1edf('0xf4')]+=0x1;_0x9ab8c6[_0x1edf('0xa7')]=ut['totalGlobal'](_0x9ab8c6);ut[_0x1edf('0x95')](_0x9ab8c6,0x13,_0x994f6[_0x1edf('0xf6')]||_0x994f6['dialstatus']);ami[_0x1edf('0x27')](_0x1edf('0xf8'),ut[_0x1edf('0xab')](_0x9ab8c6,_0x1edf('0xf9')));rpcDb[_0x1edf('0x9b')](_0x9ab8c6,_0x1edf('0xfb'));_0x89b203[_0x1edf('0xad')](_0x9ab8c6,'18',_0x508b9d)[_0x1edf('0x89')](function(_0x377abc){_0x2a35a7=_0x377abc[_0x1edf('0xae')]==0x1;if(!_0x2a35a7){if(ut[_0x1edf('0xa8')](_0x9ab8c6)>=_0x508b9d['dialGlobalMaxRetry']){_0x31befa=ut[_0x1edf('0xd0')](_0x9ab8c6,0xf,_0x1edf('0xb2'));rpcDb[_0x1edf('0x9d')](_0x31befa,_0x1edf('0xfb'));}else{rpcDb['createCustomerFinal'](_0x9ab8c6,'[callProgressDetectingCustomer][machine]');}}else{_0x9ab8c6[_0x1edf('0xda')]++;_0x89b203['incrementPreviewCounters']({'id':_0x9ab8c6['idContact'],'field':{'countnoanswerretry':_0x9ab8c6[_0x1edf('0xda')]}})['then'](function(){_0x89b203[_0x1edf('0xbd')](_0x9ab8c6,_0x2b43c0,_0x1d8b6f)[_0x1edf('0x89')](function(){});});}});delete this[_0x1edf('0x16')][_0x994f6[_0x1edf('0xb9')]];break;default:if(_0x9ab8c6[_0x1edf('0x7a')]){ut['decrementTalkink'](_0x508b9d,_0x1edf('0xfc'));ut[_0x1edf('0x85')](_0x1edf('0xfd')+_0x508b9d[_0x1edf('0x2a')],_0x994f6);}_0x508b9d[_0x1edf('0xf4')]+=0x1;_0x9ab8c6[_0x1edf('0xa7')]=ut[_0x1edf('0xa8')](_0x9ab8c6);ut[_0x1edf('0x95')](_0x9ab8c6,0xc,_0x994f6[_0x1edf('0xf6')]||_0x994f6[_0x1edf('0xf7')]);_0x2b43c0=_0x508b9d[_0x1edf('0xe9')];_0x1d8b6f=_0x508b9d[_0x1edf('0xb0')];rpcDb[_0x1edf('0x9b')](_0x9ab8c6,_0x1edf('0xfe'));_0x89b203[_0x1edf('0xad')](_0x9ab8c6,'20',_0x508b9d)[_0x1edf('0x89')](function(_0x2f9117){_0x2a35a7=_0x2f9117[_0x1edf('0xae')]==0x1;if(!_0x2a35a7){if(ut[_0x1edf('0xa8')](_0x9ab8c6)>=_0x508b9d['dialGlobalMaxRetry']){_0x31befa=ut[_0x1edf('0xd0')](_0x9ab8c6,0xf,_0x1edf('0xb2'));rpcDb[_0x1edf('0x9d')](_0x31befa,_0x1edf('0xff'));}else{rpcDb[_0x1edf('0x9d')](_0x9ab8c6,_0x1edf('0xff'));}delete this['actions'][_0x994f6[_0x1edf('0xb9')]];}else{_0x89b203['swapAdditionalPhones'](_0x9ab8c6,_0x2b43c0,_0x1d8b6f)[_0x1edf('0x89')](function(){});}});}if(!(_0x9ab8c6[_0x1edf('0x7a')]&&_0x2e9a04==='16')){ut[_0x1edf('0x100')](_0x508b9d,_0x1edf('0x101'));logger[_0x1edf('0x60')](_0x1edf('0x102'),_0x9ab8c6['uniqueid'],_0x1edf('0xc1'),_0x508b9d[_0x1edf('0x2a')],_0x1edf('0x78'),_0x508b9d[_0x1edf('0x53')]);}if(_0x2e9a04!==_0x1edf('0xbe')){delete this[_0x1edf('0x16')][_0x994f6[_0x1edf('0xb9')]];delete this[_0x1edf('0x16')][_0x994f6[_0x1edf('0x103')]];}}};Preview[_0x1edf('0x6c')][_0x1edf('0x104')]=function(_0xe1703d,_0x1fa3e2,_0x503648){if(_[_0x1edf('0x105')](_0x1fa3e2)&&_0x1edf('0x106')!==typeof _0x1fa3e2){return;}if(_['isUndefined'](_0x503648)&&_0x1edf('0x106')!==typeof _0x503648){return;}switch(_0x503648['reason']){case'0':ut[_0x1edf('0x107')](_0xe1703d,0x0,'NoSuchNumber');rpcDb[_0x1edf('0x108')](_0xe1703d,_0x1edf('0x109'));break;case'3':ut[_0x1edf('0x107')](_0xe1703d,0x3,_0x1edf('0xd5'));rpcDb[_0x1edf('0x108')](_0xe1703d,_0x1edf('0x10a'));break;case'5':ut[_0x1edf('0x107')](_0xe1703d,0x5,_0x1edf('0x10b'));rpcDb['createAgentHistory'](_0xe1703d,_0x1edf('0x10c'));break;case'8':ut['logAgent'](_0xe1703d,0x8,_0x1edf('0x10d'));rpcDb['createAgentHistory'](_0xe1703d,_0x1edf('0x10e'));break;case'22':ut[_0x1edf('0x107')](_0xe1703d,0x16,_0x1edf('0x10f'));rpcDb['createAgentHistory'](_0xe1703d,_0x1edf('0x110'));break;default:ut[_0x1edf('0x107')](_0xe1703d,0xc,_0x503648[_0x1edf('0x111')]);rpcDb['createAgentHistory'](_0xe1703d,_0x1edf('0x10e'));}ut[_0x1edf('0x100')](_0x1fa3e2,_0x1edf('0x112'));logger['info'](_0x1edf('0x113'),_0xe1703d['uniqueid'],_0x1edf('0xc1'),_0x1fa3e2[_0x1edf('0x2a')],'originated:\x20',_0x1fa3e2[_0x1edf('0x53')]);delete this[_0x1edf('0x16')][_0xe1703d[_0x1edf('0x114')]];};Preview[_0x1edf('0x6c')][_0x1edf('0xad')]=function(_0x6863a3,_0x593910,_0x5d4169){return Promise[_0x1edf('0x115')]()[_0x1edf('0x89')](cmHopperAdditionalPhone[_0x1edf('0xad')](_0x6863a3,_0x593910,_0x5d4169))['catch'](logger['info'](_0x1edf('0x116')));};Preview[_0x1edf('0x6c')]['swapAdditionalPhones']=function(_0x155c60,_0x5da7ae,_0x52a811){return Promise[_0x1edf('0x115')]()[_0x1edf('0x89')](cmHopperAdditionalPhone[_0x1edf('0xbd')](_0x155c60,_0x5da7ae,_0x52a811))[_0x1edf('0x80')](logger[_0x1edf('0x60')](_0x1edf('0x117')));};Preview[_0x1edf('0x6c')][_0x1edf('0xbc')]=function(_0x170576){return Promise[_0x1edf('0x115')]()[_0x1edf('0x89')](cmHopperAdditionalPhone[_0x1edf('0xbc')](_0x170576))[_0x1edf('0x80')](logger[_0x1edf('0x60')](_0x1edf('0x118')));};Preview[_0x1edf('0x6c')]['checkInBlack']=function(_0xc77447,_0x143f3b,_0x18e8a7,_0xe17466,_0x131d61){var _0x818f89=this;return new Promise(function(_0x4a9bfc,_0x5a9b9f){if(_[_0x1edf('0x75')](_0x143f3b)||_[_0x1edf('0x75')](_0x143f3b['Contact'])||_['isNil'](_0x143f3b[_0x1edf('0x119')])||_[_0x1edf('0x75')](_0x143f3b['VoiceQueueId'])){_0x5a9b9f(ut[_0x1edf('0x52')](_0x1edf('0x11a'),_0xe17466,_0x131d61));return;}var _0x5a2c31=uuid['v4']();var _0x415886=_0x818f89[_0x1edf('0x13')][_0x143f3b[_0x1edf('0x11b')][_0x1edf('0x2a')]];var _0x1173e6=_0x18e8a7?_0x818f89['agents'][_0x18e8a7]['id']:undefined;_0x818f89[_0x1edf('0x16')][_0x5a2c31]=new Action(_0x143f3b,_0x415886,_0x5a2c31,_0x18e8a7,_0x1173e6);var _0x23e383=_0x818f89[_0x1edf('0x16')][_0x5a2c31];_0x23e383[_0x1edf('0xb7')]=_0xe17466;_0x23e383[_0x1edf('0xb8')]=_0x131d61;_0x23e383[_0x1edf('0x11c')]=_0x18e8a7;if(_['isEmpty'](_0xc77447)){_0x818f89[_0x1edf('0x11d')](_0x23e383,_0x415886,_0x143f3b,_0x18e8a7)[_0x1edf('0x89')](function(_0x33b657){logger[_0x1edf('0x60')](_0x1edf('0x11e'),_0x1edf('0x11f')+_0x23e383[_0x1edf('0x77')]+_0x1edf('0x120')+_0x23e383[_0x1edf('0xbb')],JSON[_0x1edf('0x61')](_0x33b657));ami[_0x1edf('0x27')](_0x1edf('0x121'),ut[_0x1edf('0xab')](_0x23e383,_0x1edf('0x122'),_0x818f89[_0x1edf('0x13')][_0x23e383[_0x1edf('0x77')]]));_0x4a9bfc(ut[_0x1edf('0x52')]('Calling'));})[_0x1edf('0x80')](function(_0x537296){ut[_0x1edf('0x67')](_0x1edf('0x123'),_0x537296);_0x5a9b9f(ut[_0x1edf('0x52')](_0x1edf('0x124'),_0xe17466,_0x131d61));});}else{_0x415886[_0x1edf('0x3e')]+=0x1;ut[_0x1edf('0x125')](_0x23e383);rpcDb[_0x1edf('0x126')](_0x23e383,'[Blacklist][error]');delete _0x818f89[_0x1edf('0x16')][_0x5a2c31];_0x5a9b9f(ut[_0x1edf('0x52')](_0x1edf('0x127'),_0xe17466,_0x131d61));}});};Preview[_0x1edf('0x6c')][_0x1edf('0xa1')]=function(_0x32793f){return!_['isNil'](_0x32793f)&&!_['isNil'](_0x32793f['name'])&&!_[_0x1edf('0x75')](_0x32793f[_0x1edf('0x5a')])&&_0x32793f[_0x1edf('0x5a')]&&!_[_0x1edf('0x75')](this['trunks'][util[_0x1edf('0x5d')](_0x1edf('0x128'),_0x32793f[_0x1edf('0x2a')])])&&!_['isNil'](this['trunks'][util[_0x1edf('0x5d')](_0x1edf('0x128'),_0x32793f[_0x1edf('0x2a')])][_0x1edf('0x7e')])&&(this[_0x1edf('0x15')][util[_0x1edf('0x5d')]('SIP/%s',_0x32793f[_0x1edf('0x2a')])][_0x1edf('0x7e')]===_0x1edf('0x129')||this[_0x1edf('0x15')][util[_0x1edf('0x5d')]('SIP/%s',_0x32793f[_0x1edf('0x2a')])]['status']===_0x1edf('0x12a'));};Preview['prototype'][_0x1edf('0x8e')]=function(_0xd37693,_0x27626a){return this[_0x1edf('0x12b')](_0xd37693,_0x27626a)[_0x1edf('0x89')](function(_0x10e2fe){return _[_0x1edf('0x12c')](_0x10e2fe,[_0x1edf('0x52')]);})[_0x1edf('0x80')](function(_0x4ccd0c){if(_0x4ccd0c[_0x1edf('0x12d')]){rpcDb[_0x1edf('0x12e')](_0xd37693);}if(_0x4ccd0c[_0x1edf('0x5a')]){rpcDb[_0x1edf('0x91')](_0xd37693);}throw _[_0x1edf('0x12c')](_0x4ccd0c,['message']);});};Preview[_0x1edf('0x6c')][_0x1edf('0x12b')]=function(_0x1fbaa5,_0x9e7692){var _0x1c24b7=this;var _0x12a496,_0x17f3cb;return rpcDb[_0x1edf('0x12f')](_0x1fbaa5)['then'](function(_0x16117a){if(!_[_0x1edf('0x75')](_0x16117a[0x0])){_0x17f3cb=_0x16117a[0x0][_0x1edf('0x130')]?![]:!![];_0x12a496=_0x16117a[0x0][_0x1edf('0x130')]?!![]:![];_0x12a496=_0x9e7692?!![]:_0x12a496;}var _0x473679=_0x1c24b7[_0x1edf('0x131')](_0x16117a);if(_0x473679['isValid']){rpcDb[_0x1edf('0x132')](_[_0x1edf('0x12c')](_0x16117a[0x0],[_0x1edf('0x133'),_0x1edf('0x119')]))['then'](function(_0x30df7e){_0x1c24b7[_0x1edf('0x134')](_0x30df7e,_0x16117a[0x0],_0x9e7692,_0x17f3cb,_0x12a496)[_0x1edf('0x89')](function(_0xea25fd){return _0xea25fd;})[_0x1edf('0x80')](function(_0x21dcc6){throw _0x21dcc6;});})['catch'](function(_0x4118a9){ut[_0x1edf('0x67')](_0x1edf('0x135'),_0x4118a9);throw ut[_0x1edf('0x52')]('Call\x20unsuccessful',_0x17f3cb,_0x12a496);});}else{throw ut[_0x1edf('0x52')](_0x473679[_0x1edf('0x52')],_0x17f3cb,_0x12a496);}})[_0x1edf('0x80')](function(_0xd7e7ac){ut[_0x1edf('0x67')](_0x1edf('0x136'),_0xd7e7ac);throw ut[_0x1edf('0x52')]('Call\x20unsuccessful',![],!![]);});};Preview[_0x1edf('0x6c')]['validateContact']=function(_0x130f74){if(_[_0x1edf('0x75')](_0x130f74)||_['isEmpty'](_0x130f74)||!_[_0x1edf('0x75')](_0x130f74[0x0][_0x1edf('0x8c')])&&_[_0x1edf('0x75')](_0x130f74[0x0][_0x1edf('0x8c')]['name'])){ut[_0x1edf('0x67')](_0x1edf('0x137'),_0x130f74);return{'isValid':![],'message':_0x1edf('0x138')};}var _0x20afa9=this[_0x1edf('0x13')][_0x130f74[0x0][_0x1edf('0x11b')][_0x1edf('0x2a')]];_0x20afa9[_0x1edf('0x52')]=_0x1edf('0xa4');if(_['isNil'](_0x20afa9)){ut['logger'](_0x1edf('0x139'),_0x20afa9);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x1edf('0xa1')](_0x20afa9['Trunk'])){ut['logger'](_0x1edf('0x13a'),_0x1edf('0x13b')+_0x20afa9[_0x1edf('0x2a')]+_0x1edf('0x13c'));if(!this[_0x1edf('0xa1')](_0x20afa9[_0x1edf('0xa2')])){ut['logger'](_0x1edf('0x13a'),_0x20afa9['name']+_0x1edf('0x13d'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x1edf('0xa0')](_0x20afa9[_0x1edf('0x38')])){ut[_0x1edf('0x67')](_0x1edf('0x13e'),_0x20afa9[_0x1edf('0x2a')]+_0x1edf('0x13f'));return{'isValid':![],'message':_0x1edf('0x13b')+_0x20afa9[_0x1edf('0x2a')]+_0x1edf('0x13f')};}return{'isValid':!![],'message':_0x1edf('0x140')};};Preview[_0x1edf('0x6c')][_0x1edf('0x11d')]=function(_0x593945,_0x179034,_0x171acf,_0x239670){var _0x1786ff=this;return new Promise(function(_0x1dd8a8,_0xcfe80a){var _0x3f40a9=_0x593945[_0x1edf('0x114')];var _0x206ad4=_0x1786ff['isTrunkReachable'](_0x179034[_0x1edf('0x59')])?util[_0x1edf('0x5d')]('SIP/%s/%s%s',_0x179034[_0x1edf('0x59')][_0x1edf('0x2a')],_[_0x1edf('0x75')](_0x179034[_0x1edf('0x3b')])?'':_0x179034[_0x1edf('0x3b')][_0x1edf('0x141')]()||'',_0x179034[_0x1edf('0x142')]>0x0?_0x171acf[_0x1edf('0x119')]['substring'](_0x179034['dialCutDigit']):_0x171acf[_0x1edf('0x119')]):util['format'](_0x1edf('0x143'),_[_0x1edf('0x75')](_0x179034['TrunkBackup'])?_0x179034[_0x1edf('0x59')]['name']:_0x179034[_0x1edf('0xa2')][_0x1edf('0x2a')],_[_0x1edf('0x75')](_0x179034['dialPrefix'])?'':_0x179034['dialPrefix'][_0x1edf('0x141')]()||'',_0x179034[_0x1edf('0x142')]>0x0?_0x171acf[_0x1edf('0x119')]['substring'](_0x179034[_0x1edf('0x142')]):_0x171acf[_0x1edf('0x119')]);var _0x4ffeb4=_0x1786ff[_0x1edf('0xa1')](_0x179034[_0x1edf('0x59')])?ut[_0x1edf('0x144')](_0x179034[_0x1edf('0x59')][_0x1edf('0x5b')],_0x179034[_0x1edf('0x145')],_0x179034[_0x1edf('0x146')]>0x0?ut['getCallerIdRandom'](_0x179034['dialOriginateCallerIdNumber'],_0x179034['dialRandomLastDigitCallerIdNumber']):_0x179034[_0x1edf('0x39')]):ut['getCallerId'](_[_0x1edf('0x75')](_0x179034[_0x1edf('0xa2')])?_0x179034[_0x1edf('0x59')][_0x1edf('0x5b')]:_0x179034[_0x1edf('0xa2')][_0x1edf('0x5b')],_0x179034['dialOriginateCallerIdName'],_0x179034[_0x1edf('0x146')]>0x0?ut[_0x1edf('0x147')](_0x179034[_0x1edf('0x39')],_0x179034[_0x1edf('0x146')]):_0x179034[_0x1edf('0x39')]);if(_0x4ffeb4){_0x593945[_0x1edf('0x148')]=ut[_0x1edf('0x149')](_0x4ffeb4);_0x593945[_0x1edf('0x14a')]=ut['extractCalleridNumber'](_0x4ffeb4);}var _0x175d56=ut['addVariables'](_0x179034,_0x171acf,_0x206ad4,_0x4ffeb4,_0x3f40a9,_0x593945);_['merge'](_0x593945,ut[_0x1edf('0x14b')](_0x175d56));_0x593945[_0x1edf('0x92')]=moment()['format'](_0x1edf('0x93'));_0x179034['variables']=_0x175d56;ami[_0x1edf('0x7d')](ut[_0x1edf('0x14c')](_0x593945,_0x179034,_0x175d56,_0x593945[_0x1edf('0xb8')],_0x239670))[_0x1edf('0x89')](function(_0x37551d){_0x179034[_0x1edf('0x53')]+=0x1;logger[_0x1edf('0x60')](_0x1edf('0x14d'),_0x3f40a9,_0x1edf('0xc1'),_0x179034[_0x1edf('0x2a')],'originated:\x20',_0x179034[_0x1edf('0x53')]);_0x1dd8a8(_0x37551d);})[_0x1edf('0x80')](function(_0x24de08){ut[_0x1edf('0x107')](_0x593945,0xe,_0x1edf('0x14e'));rpcDb[_0x1edf('0x108')](_0x593945,_0x1edf('0x14f'));_0xcfe80a(_0x24de08);});});};Preview[_0x1edf('0x6c')]['syncNewExten']=function(_0x17b71d){if(this[_0x1edf('0x16')][_0x17b71d[_0x1edf('0xb9')]]){this[_0x1edf('0x16')][_0x17b71d[_0x1edf('0xb9')]][_0x1edf('0x7f')]=_0x17b71d['channel'];}};Preview[_0x1edf('0x6c')]['syncOriginateResponse']=function(_0x20c49c){var _0xff1e77=this;var _0x4e4a63=this['actions'][_0x20c49c[_0x1edf('0x150')]];if(_0x4e4a63){if(_0x4e4a63[_0x1edf('0x11c')]&&this['agents'][_0x4e4a63[_0x1edf('0x11c')]]){ut[_0x1edf('0x151')](_0x4e4a63,this[_0x1edf('0x17')][_0x4e4a63[_0x1edf('0x11c')]][_0x1edf('0x2a')],this[_0x1edf('0x17')][_0x4e4a63['lookAgent']]['id']);}var _0x1d1769=_[_0x1edf('0x152')](_0x4e4a63);_0x1d1769['responsetime']=moment()[_0x1edf('0x5d')](_0x1edf('0x93'));var _0x4878cf=_0xff1e77['campaignsPreview'][_0x4e4a63[_0x1edf('0x77')]];if(ut[_0x1edf('0x153')](_0x20c49c[_0x1edf('0x154')])){if(_0x4e4a63[_0x1edf('0xb7')]){rpcDb[_0x1edf('0x12e')](_0x4e4a63[_0x1edf('0xbb')]);}if(_0x4e4a63[_0x1edf('0xb8')]){rpcDb[_0x1edf('0x91')](_0x4e4a63['idContact']);}ami[_0x1edf('0x27')]('custom:agentringnoanswer',ut[_0x1edf('0xab')](_0x4e4a63,_0x1edf('0x155'),this[_0x1edf('0x13')][_0x4e4a63[_0x1edf('0x77')]]));this[_0x1edf('0x104')](_0x1d1769,_0x4878cf,_0x20c49c);}else{_0x4e4a63[_0x1edf('0x92')]=moment()['format'](_0x1edf('0x93'));ut[_0x1edf('0x107')](_0x1d1769,0x4,_0x1edf('0xc8'));rpcDb[_0x1edf('0x108')](_0x1d1769,_0x1edf('0x156'));}}};Preview['prototype'][_0x1edf('0x1b')]=function(_0x353ab6){var _0x1ed1ff=this['actions'][_0x353ab6[_0x1edf('0xb9')]];var _0x376cf7;if(_0x1ed1ff){_0x376cf7=this[_0x1edf('0x13')][_0x1ed1ff[_0x1edf('0x77')]];logger[_0x1edf('0x60')](_0x1edf('0x157'),_0x353ab6[_0x1edf('0xb9')],_0x1edf('0xc1'),_0x376cf7[_0x1edf('0x2a')],'pTalking:\x20',_0x376cf7['pTalking']);}if(this[_0x1edf('0x16')][_0x353ab6[_0x1edf('0xb9')]]&&_0x353ab6['linkedid']!==_0x353ab6[_0x1edf('0x114')]){if(_0x353ab6[_0x1edf('0x158')]==='16'&&this[_0x1edf('0x16')][_0x353ab6[_0x1edf('0xb9')]]['dialAnswer']){this[_0x1edf('0xa5')](_0x353ab6,_0x353ab6[_0x1edf('0xb9')],_0x353ab6['cause']);}else if(this[_0x1edf('0x16')][_0x353ab6[_0x1edf('0xb9')]][_0x1edf('0x7a')]){logger['info']('[syncHangup][talking][cause]',_0x353ab6[_0x1edf('0xb9')],_0x353ab6['cause'],_0x1edf('0xc1'),_0x376cf7['name'],_0x1edf('0x79'),_0x376cf7[_0x1edf('0x2e')]);this[_0x1edf('0xa5')](_0x353ab6,_0x353ab6[_0x1edf('0xb9')],_0x353ab6[_0x1edf('0x158')]);}}else if(_0x1ed1ff&&_[_0x1edf('0x75')](_0x1ed1ff[_0x1edf('0x159')])&&_0x376cf7[_0x1edf('0x15a')]&&_0x353ab6['linkedid']===_0x353ab6['uniqueid']&&_[_0x1edf('0x75')](_0x353ab6['reason'])&&_0x353ab6['cause']==='16'&&_0x353ab6[_0x1edf('0x15b')]==='6'&&_[_0x1edf('0x105')](_0x1ed1ff[_0x1edf('0x15c')])){if(_0x1ed1ff[_0x1edf('0xb7')]){rpcDb[_0x1edf('0x12e')](_0x1ed1ff[_0x1edf('0xbb')]);}if(_0x1ed1ff[_0x1edf('0xb8')]){rpcDb[_0x1edf('0x91')](_0x1ed1ff['idContact']);}_0x353ab6[_0x1edf('0x111')]='22';this['callProgressDetectingAgent'](_0x1ed1ff,_0x376cf7,_0x353ab6);}else if(_0x1ed1ff&&_0x1ed1ff[_0x1edf('0x15c')]){if(_0x353ab6[_0x1edf('0x158')]==='16'&&this[_0x1edf('0x16')][_0x353ab6[_0x1edf('0xb9')]][_0x1edf('0x7a')]){logger[_0x1edf('0x60')]('[syncHangup][talking][transfer]',_0x353ab6[_0x1edf('0xb9')],_0x353ab6[_0x1edf('0x158')],'\x20Queue',_0x376cf7['name'],_0x1edf('0x79'),_0x376cf7[_0x1edf('0x2e')]);this[_0x1edf('0xa5')](_0x353ab6,_0x353ab6[_0x1edf('0xb9')],_0x353ab6[_0x1edf('0x158')]);}else if(this[_0x1edf('0x16')][_0x353ab6[_0x1edf('0xb9')]][_0x1edf('0x7a')]){logger[_0x1edf('0x60')](_0x1edf('0x15d'),_0x353ab6['linkedid'],_0x353ab6['cause'],_0x1edf('0xc1'),_0x376cf7[_0x1edf('0x2a')],_0x1edf('0x79'),_0x376cf7[_0x1edf('0x2e')]);this[_0x1edf('0xa5')](_0x353ab6,_0x353ab6[_0x1edf('0xb9')],_0x353ab6['cause']);}}};Preview['prototype'][_0x1edf('0x15e')]=function(_0xbae400){if(this['actions'][_0xbae400['destlinkedid']]&&_0xbae400[_0x1edf('0x103')]!==_0xbae400['destuniqueid']){this[_0x1edf('0xa5')](_0xbae400,_0xbae400[_0x1edf('0x103')],_0xbae400[_0x1edf('0xf7')]);}};Preview['prototype'][_0x1edf('0x1d')]=function(_0xb5928a){if(this[_0x1edf('0x16')][_0xb5928a[_0x1edf('0xb9')]]&&_0xb5928a[_0x1edf('0xb9')]!==_0xb5928a[_0x1edf('0x114')]&&!this[_0x1edf('0x16')][_0xb5928a[_0x1edf('0xb9')]][_0x1edf('0x7a')]){if(_0xb5928a[_0x1edf('0x158')]==='1'){this['callProgressDetectingCustomer'](_0xb5928a,_0xb5928a[_0x1edf('0xb9')],_0xb5928a['cause']);}}};Preview[_0x1edf('0x6c')]['addVariable']=function(_0x588eb,_0x3b6375,_0x2bbfbd){if(this[_0x1edf('0x16')][_0x588eb]){if(_[_0x1edf('0x75')](this[_0x1edf('0x16')][_0x588eb]['variables'])){this[_0x1edf('0x16')][_0x588eb][_0x1edf('0x15f')]={};}this[_0x1edf('0x16')][_0x588eb][_0x1edf('0x15f')][_0x3b6375]=_0x2bbfbd;}};Preview['prototype'][_0x1edf('0x22')]=function(_0x4654be){try{if(!_['isNil'](_0x4654be)){if(ut['filterKey'](_[_0x1edf('0x160')](_0x4654be[_0x1edf('0x161')])[0x0])){this[_0x1edf('0x162')](_0x4654be[_0x1edf('0x114')],_[_0x1edf('0x160')](_0x4654be[_0x1edf('0x161')])[0x0],_0x4654be['value']);}}}catch(_0x13a091){logger[_0x1edf('0x163')](_0x1edf('0x164'),util[_0x1edf('0x165')](_0x13a091,{'showHidden':![],'depth':null}));}};Preview[_0x1edf('0x6c')][_0x1edf('0x166')]=function(_0x2bad47){if(_0x2bad47){if(this['actions'][_0x2bad47[_0x1edf('0x167')]]){this[_0x1edf('0x16')][_0x2bad47['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0x1edf('0x6c')]['syncBlindTransfer']=function(_0x42f58f){if(_0x42f58f){if(this[_0x1edf('0x16')][_0x42f58f[_0x1edf('0x168')]]){this[_0x1edf('0x16')][_0x42f58f[_0x1edf('0x168')]][_0x1edf('0x15c')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0xaf11=['waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCallToSecond','erlangBusyFactor','startPredictive','Trunk','name','active','callerid','Interval','stringify','md5','format','voice:queue:%s','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','booked','type','preview','setMessage','clearZombieChannel','isNil','info','Queue','actions','originated:\x20','queue','pTalking:\x20','pick','UserId','VoiceQueueId','Action','status','catch','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','clearZombieChannels','getContactRecallMe','length','getDiff','dialRecallMeTimeout','run','then','logger2','[RecallMe]','starttime','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','linkedid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','countnoanswerretry','dialNoAnswerMaxRetry','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','activeContact','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','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','unmonitored','unlockContact','getContactPreview','validateContact','isValid','checkIsBlackList','logger','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','Agent','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','isActive','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdName','extractCalleridName','originatecalleridnum','addVariables','merge','toLowerVariables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','channel','syncOriginateResponse','actionid','logLookAgent','clone','response','rejected','[syncHangup][talking]','cause','statedesc','channelstate','transfer','[syncHangup][talking][cause]','addVariable','variables','syncVarSet','filterKey','keys','variable','value','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','actionPreview','../ami','../rpc/cmHopperAdditionalPhone','./util/util','redis','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','outbound','strategy','answered','available','pTalking','sumBillable','total','abandoned'];(function(_0x42d2af,_0x3961b5){var _0x1d6d63=function(_0x10833e){while(--_0x10833e){_0x42d2af['push'](_0x42d2af['shift']());}};_0x1d6d63(++_0x3961b5);}(_0xaf11,0x12f));var _0x1af1=function(_0xff1957,_0x57f658){_0xff1957=_0xff1957-0x0;var _0x37c52c=_0xaf11[_0xff1957];return _0x37c52c;};'use strict';var util=require(_0x1af1('0x0'));var _=require(_0x1af1('0x1'));var uuid=require(_0x1af1('0x2'));var moment=require(_0x1af1('0x3'));var md5=require('md5');var Redis=require(_0x1af1('0x4'));var config=require(_0x1af1('0x5'));var logger=require(_0x1af1('0x6'))('preview');var loggerAction=require(_0x1af1('0x6'))(_0x1af1('0x7'));var ami=require(_0x1af1('0x8'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x1af1('0x9'));var Action=require('./action');var ut=require(_0x1af1('0xa'));config[_0x1af1('0xb')]=_['defaults'](config[_0x1af1('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1af1('0xb')]));var Sequence=function(){};Sequence[_0x1af1('0xc')][_0x1af1('0xd')]=function(_0x26cd31){this[_0x1af1('0xe')]=this[_0x1af1('0xe')]?this['tail'][_0x1af1('0xf')](_0x26cd31):_0x26cd31();};function Preview(_0xb89447){this[_0x1af1('0x10')]=new Sequence();this[_0x1af1('0x11')]=_0xb89447[_0x1af1('0x12')];this[_0x1af1('0x13')]=_0xb89447[_0x1af1('0x13')];this['actions']={};this[_0x1af1('0x14')]=_0xb89447[_0x1af1('0x14')];this[_0x1af1('0x15')]=0x0;ami['on'](_0x1af1('0x16'),this['syncOriginateResponse'][_0x1af1('0x17')](this));ami['on'](_0x1af1('0x18'),this[_0x1af1('0x19')]['bind'](this));ami['on'](_0x1af1('0x1a'),this[_0x1af1('0x1b')][_0x1af1('0x17')](this));ami['on'](_0x1af1('0x1c'),this[_0x1af1('0x1d')][_0x1af1('0x17')](this));ami['on'](_0x1af1('0x1e'),this[_0x1af1('0x1f')][_0x1af1('0x17')](this));ami['on'](_0x1af1('0x20'),this['syncVarSet']['bind'](this));ami['on']('attendedtransfer',this[_0x1af1('0x21')]['bind'](this));ami['on'](_0x1af1('0x22'),this[_0x1af1('0x23')][_0x1af1('0x17')](this));this[_0x1af1('0x24')](this[_0x1af1('0x11')]);}function emit(_0x5d336,_0x4af71a,_0x11c42b){io['to'](_0x5d336)[_0x1af1('0x25')](_0x4af71a,_0x11c42b);}function emitCampaignPreview(_0x4a251){if(_0x4a251['type']===_0x1af1('0x26')){var _0xca2e20={'id':_0x4a251['id'],'name':_0x4a251['name'],'strategy':_0x4a251[_0x1af1('0x27')],'answered':_0x4a251[_0x1af1('0x28')],'available':_0x4a251[_0x1af1('0x29')],'loggedIn':_0x4a251['loggedIn'],'pTalking':_0x4a251[_0x1af1('0x2a')],'sumBillable':_0x4a251[_0x1af1('0x2b')],'sumDuration':_0x4a251['sumDuration'],'sumHoldTime':_0x4a251['sumHoldTime']||0x0,'talking':_0x4a251['talking'],'total':_0x4a251[_0x1af1('0x2c')],'type':_0x4a251['type'],'unmanaged':_0x4a251['unmanaged'],'abandoned':_0x4a251[_0x1af1('0x2d')],'waiting':_0x4a251[_0x1af1('0x2e')],'loggedInDb':_0x4a251[_0x1af1('0x2f')],'dialActive':_0x4a251[_0x1af1('0x30')],'dialMethod':_0x4a251[_0x1af1('0x31')],'dialOriginateCallerIdName':_0x4a251['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x4a251[_0x1af1('0x32')],'dialOriginateTimeout':_0x4a251[_0x1af1('0x33')],'dialPrefix':_0x4a251[_0x1af1('0x34')],'outboundAnswerAgiCallsDay':_0x4a251[_0x1af1('0x35')],'outboundAnswerCallsDay':_0x4a251[_0x1af1('0x36')],'outboundBlacklistCallsDay':_0x4a251[_0x1af1('0x37')],'outboundBusyCallsDay':_0x4a251['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x4a251[_0x1af1('0x38')],'outboundDropCallsDayACS':_0x4a251['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x4a251[_0x1af1('0x39')],'outboundDropCallsDayTimeout':_0x4a251[_0x1af1('0x3a')],'outboundNoAnswerCallsDay':_0x4a251['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x4a251['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x4a251[_0x1af1('0x3b')],'outboundReCallsDay':_0x4a251[_0x1af1('0x3c')],'outboundRejectCallsDay':_0x4a251[_0x1af1('0x3d')],'outboundUnknownCallsDay':_0x4a251[_0x1af1('0x3e')],'outboundAbandonedCallsDay':_0x4a251['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x4a251[_0x1af1('0x3f')],'predictiveIntervalAvgHoldtime':_0x4a251[_0x1af1('0x40')],'predictiveIntervalAvgTalktime':_0x4a251['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x4a251[_0x1af1('0x41')],'predictiveIntervalDroppedCallsTimeout':_0x4a251['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x4a251[_0x1af1('0x42')],'predictiveIntervalErlangCallsDroppedCalls':_0x4a251[_0x1af1('0x43')],'predictiveIntervalHitRate':_0x4a251[_0x1af1('0x44')],'predictiveIntervalMultiplicativeFactor':_0x4a251[_0x1af1('0x45')],'predictiveIntervalPauses':_0x4a251['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x4a251[_0x1af1('0x46')],'predictiveIntervalTotalCalls':_0x4a251[_0x1af1('0x47')],'message':_0x4a251[_0x1af1('0x48')],'originated':_0x4a251['originated'],'erlangCalls':_0x4a251['erlangCalls'],'erlangCallToSecond':_0x4a251[_0x1af1('0x49')],'erlangAbandonmentRate':_0x4a251['erlangAbandonmentRate'],'erlangBusyFactor':_0x4a251[_0x1af1('0x4a')],'startPredictive':_0x4a251[_0x1af1('0x4b')],'startProgressive':_0x4a251['startProgressive']};if(_0x4a251['Trunk']){_0xca2e20[_0x1af1('0x4c')]={'id':_0x4a251['Trunk']['id'],'name':_0x4a251[_0x1af1('0x4c')][_0x1af1('0x4d')],'active':_0x4a251[_0x1af1('0x4c')][_0x1af1('0x4e')],'callerid':_0x4a251['Trunk'][_0x1af1('0x4f')]};}if(_0x4a251['Interval']){_0xca2e20[_0x1af1('0x50')]={'id':_0x4a251['Interval']['id'],'name':_0x4a251[_0x1af1('0x50')][_0x1af1('0x4d')]};}var _0x25280f=md5(JSON[_0x1af1('0x51')](_0xca2e20));if(_0x4a251['md5']!==_0x25280f){_0x4a251[_0x1af1('0x52')]=_0x25280f;emit(util[_0x1af1('0x53')](_0x1af1('0x54'),_0xca2e20[_0x1af1('0x4d')]),_0x1af1('0x55'),_0xca2e20);}}}function emitVoiceQueueChannelRemove(_0x39fc2a){logger['info'](_0x1af1('0x56'),JSON[_0x1af1('0x51')](_0x39fc2a));emit(util['format'](_0x1af1('0x54'),_0x39fc2a['name']),_0x1af1('0x57'),_0x39fc2a);io[_0x1af1('0x25')](_0x1af1('0x58'),_0x39fc2a);}function notSendMessagesQueue(_0x169a16){if(_0x169a16[_0x1af1('0x59')]){if(_0x169a16['originated']===0x0&&_0x169a16['pTalking']===0x0){_0x169a16[_0x1af1('0x59')]=![];_0x169a16[_0x1af1('0x29')]=0x0;_0x169a16[_0x1af1('0x5a')]=0x0;_0x169a16[_0x1af1('0x48')]=_0x1af1('0x5b');ut['logger'](_0x1af1('0x5c'),_0x169a16['name']+_0x1af1('0x5d'));}else{_0x169a16[_0x1af1('0x48')]=_0x1af1('0x5e');ut['logger'](_0x1af1('0x5c'),_0x169a16[_0x1af1('0x4d')]+_0x1af1('0x5f'));}emitCampaignPreview(_0x169a16);}}Preview[_0x1af1('0xc')][_0x1af1('0x24')]=function(){var _0x52794e=this;setInterval(function(){_0x52794e[_0x1af1('0x60')]();},0x7cf);};Preview[_0x1af1('0xc')]['syncCampaigns']=function(){var _0x4ca014=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x35b73f in _0x4ca014){if(_0x4ca014[_0x1af1('0x61')](_0x35b73f)&&(_0x4ca014[_0x35b73f][_0x1af1('0x31')]==='preview'||_0x4ca014[_0x35b73f][_0x1af1('0x31')]===_0x1af1('0x62'))&&_0x4ca014[_0x35b73f][_0x1af1('0x63')]===_0x1af1('0x26')){if(this[_0x1af1('0x15')]>0x7){this[_0x1af1('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x4ca014[_0x1af1('0x61')](_0x35b73f)&&_0x4ca014[_0x35b73f][_0x1af1('0x31')]===_0x1af1('0x64')&&_0x4ca014[_0x35b73f][_0x1af1('0x63')]==='outbound'){if(_0x4ca014[_0x35b73f][_0x1af1('0x30')]){this[_0x1af1('0x65')](_0x4ca014[_0x35b73f]);if(_0x4ca014[_0x35b73f]['dialPreviewAutoRecallMe'])this['recallMe'](_0x4ca014[_0x35b73f]);}else{notSendMessagesQueue(_0x4ca014[_0x35b73f]);}}}};Preview[_0x1af1('0xc')][_0x1af1('0x66')]=function(_0x582c85){var _0x44db4a=this;this[_0x1af1('0x10')]['enqueue'](function(){if(!_[_0x1af1('0x67')](_0x44db4a['actions'][_0x582c85])){loggerAction[_0x1af1('0x68')]('[clearZombieChannels][talking]',_0x582c85,_0x1af1('0x69'),_0x44db4a[_0x1af1('0x6a')][_0x582c85]['queue'],_0x1af1('0x6b'),JSON[_0x1af1('0x51')](_0x44db4a[_0x1af1('0x11')][_0x44db4a[_0x1af1('0x6a')][_0x582c85][_0x1af1('0x6c')]]['originated']),_0x1af1('0x6d'),JSON['stringify'](_0x44db4a[_0x1af1('0x11')][_0x44db4a[_0x1af1('0x6a')][_0x582c85]['queue']][_0x1af1('0x2a')]),JSON[_0x1af1('0x51')](_0x44db4a[_0x1af1('0x6a')][_0x582c85]['dialAnswer']),JSON[_0x1af1('0x51')](_[_0x1af1('0x6e')](_0x44db4a[_0x1af1('0x6a')][_0x582c85],['contactId',_0x1af1('0x6f'),_0x1af1('0x70'),'ListId'])));return ami[_0x1af1('0x71')]({'action':_0x1af1('0x72'),'channel':_0x44db4a[_0x1af1('0x6a')][_0x582c85]['channel']})[_0x1af1('0x73')](function(_0x2ef64a){if(_0x2ef64a[_0x1af1('0x48')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x44db4a['actions'][_0x582c85]){ut[_0x1af1('0x74')](_0x44db4a['campaignsPreview'][_0x44db4a['actions'][_0x582c85]['queue']],_0x1af1('0x75'));if(_0x44db4a[_0x1af1('0x6a')][_0x582c85][_0x1af1('0x76')]===!![]){ut[_0x1af1('0x77')](_0x44db4a['campaignsPreview'][_0x44db4a[_0x1af1('0x6a')][_0x582c85]['queue']],'[clearZombieChannel]');ut[_0x1af1('0x78')]('[Dialer][checkChannel][pTalking][Preview]'+_0x582c85,_0x44db4a[_0x1af1('0x6a')][_0x582c85][_0x1af1('0x6c')]);}ut[_0x1af1('0x78')](_0x1af1('0x79')+_0x582c85,_0x44db4a[_0x1af1('0x6a')][_0x582c85][_0x1af1('0x6c')]);delete _0x44db4a[_0x1af1('0x6a')][_0x582c85];}},0x2328);}});}});};Preview['prototype'][_0x1af1('0x7a')]=function(){var _0x244e8a=this;loggerAction[_0x1af1('0x68')]('[action]',_['size'](this[_0x1af1('0x6a')]));for(var _0x379ca1 in this[_0x1af1('0x6a')]){if(_0x244e8a['actions'][_0x1af1('0x61')](_0x379ca1)){_0x244e8a[_0x1af1('0x66')](_0x379ca1);}}};Preview[_0x1af1('0xc')]['recallMe']=function(_0x38b5e0){var _0x2a97b8=this;rpcDb[_0x1af1('0x7b')](_0x38b5e0['id'],ut['agentReadyId'](this[_0x1af1('0x14')]))['then'](function(_0x2bb3b7){if(!_[_0x1af1('0x67')](_0x2bb3b7)){for(var _0x579c9e=0x0;_0x579c9e<_0x2bb3b7[_0x1af1('0x7c')];_0x579c9e+=0x1){if(ut[_0x1af1('0x7d')](_0x2bb3b7[_0x579c9e]['scheduledat'])<_0x38b5e0[_0x1af1('0x7e')]*0x3c){if(_0x2bb3b7[_0x579c9e]['Agent']&&!_0x2bb3b7[_0x579c9e]['Agent']['voicePause']){_0x2a97b8[_0x1af1('0x7f')](_0x2bb3b7[_0x579c9e]['id'])[_0x1af1('0x80')](ut[_0x1af1('0x81')](_0x1af1('0x82')))[_0x1af1('0x73')](ut[_0x1af1('0x81')](_0x1af1('0x82')));}else{rpcDb['disableContact'](_0x2bb3b7[_0x579c9e]['id']);}}else{var _0xb4d239=new Action(_0x2bb3b7[_0x579c9e],_0x38b5e0);_0xb4d239[_0x1af1('0x83')]=moment()[_0x1af1('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x38b5e0[_0x1af1('0x3c')]+=0x1;ut[_0x1af1('0x84')](_0xb4d239,0x17,_0x1af1('0x85'));if(_0x38b5e0[_0x1af1('0x86')]){rpcDb[_0x1af1('0x87')](ut['createBody'](_0x2bb3b7[_0x579c9e]));rpcDb[_0x1af1('0x88')](_0xb4d239,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x1af1('0x84')](_0xb4d239,0x16,_0x1af1('0x89'));rpcDb[_0x1af1('0x88')](_0xb4d239,_0x1af1('0x8a'));rpcDb[_0x1af1('0x8b')](_0xb4d239,_0x1af1('0x8a'));}}}}})['catch'](ut['logger2'](_0x1af1('0x8c')));};Preview[_0x1af1('0xc')][_0x1af1('0x65')]=function(_0x2c6b23){_0x2c6b23['sendMessageOneNotActive']=!![];if(ut[_0x1af1('0x8d')](_0x2c6b23[_0x1af1('0x8e')])){_0x2c6b23[_0x1af1('0x48')]=_0x1af1('0x8f');}else if(!ut['isActive'](_0x2c6b23[_0x1af1('0x30')])){_0x2c6b23[_0x1af1('0x48')]=_0x1af1('0x5b');}else if(!this['isTrunkReachable'](_0x2c6b23[_0x1af1('0x4c')])){if(!this[_0x1af1('0x90')](_0x2c6b23[_0x1af1('0x91')])){_0x2c6b23[_0x1af1('0x48')]=_0x1af1('0x92');}else{_0x2c6b23[_0x1af1('0x48')]=_0x1af1('0x93');}}else{_0x2c6b23[_0x1af1('0x48')]='ACTIVE';}emitCampaignPreview(_0x2c6b23);};Preview[_0x1af1('0xc')][_0x1af1('0x94')]=function(_0x310ae0,_0x214a82,_0x3a94e2){var _0x2370bd=this;var _0x58b7af=this[_0x1af1('0x6a')][_0x214a82];var _0x3433f0=this[_0x1af1('0x11')][_0x58b7af[_0x1af1('0x6c')]];var _0xaea8a1;var _0x5d53dc=![];var _0x182233=0x2;var _0x4025b5=0x3;if(_0x3433f0){switch(_0x3a94e2){case'1':_0x3433f0[_0x1af1('0x95')]+=0x1;_0x58b7af[_0x1af1('0x96')]+=0x1;_0x58b7af[_0x1af1('0x97')]=ut[_0x1af1('0x98')](_0x58b7af);ut[_0x1af1('0x84')](_0x58b7af,0x0,_0x1af1('0x99'));ami[_0x1af1('0x25')]('custom:agentnosuchnumber',ut[_0x1af1('0x9a')](_0x58b7af,'nosuchnumber'));rpcDb[_0x1af1('0x88')](_0x58b7af,_0x1af1('0x9b'));_0x2370bd[_0x1af1('0x9c')](_0x58b7af,'0',_0x3433f0)[_0x1af1('0x80')](function(_0x3c034f){_0x5d53dc=_0x3c034f[_0x1af1('0x9d')]==0x1;_0x182233=_0x3433f0[_0x1af1('0x9e')];_0x4025b5=_0x3433f0[_0x1af1('0x9f')];if(!_0x5d53dc){if(ut[_0x1af1('0x98')](_0x58b7af)>=_0x3433f0[_0x1af1('0xa0')]){_0xaea8a1=ut[_0x1af1('0xa1')](_0x58b7af,0xf,_0x1af1('0xa2'));rpcDb[_0x1af1('0x8b')](_0xaea8a1,_0x1af1('0xa3'));}else{if(_0x58b7af[_0x1af1('0x96')]>=_0x3433f0[_0x1af1('0xa4')]){rpcDb['createCustomerFinal'](_0x58b7af,_0x1af1('0xa3'));}else{rpcDb[_0x1af1('0xa5')](ut[_0x1af1('0xa6')](_0x58b7af,_0x1af1('0x96'),_0x3433f0[_0x1af1('0x9e')]),_0x58b7af[_0x1af1('0xa7')],_0x58b7af['activeContact']);}}delete this[_0x1af1('0x6a')][_0x310ae0['linkedid']];}else{_0x58b7af[_0x1af1('0x96')]++;logger['info'](_0x1af1('0xa8'),_0x58b7af[_0x1af1('0x96')]);logger[_0x1af1('0x68')]('id',_0x58b7af[_0x1af1('0xa9')]);_0x2370bd[_0x1af1('0xaa')]({'id':_0x58b7af[_0x1af1('0xa9')],'field':{'countnosuchnumberretry':_0x58b7af[_0x1af1('0x96')]}})[_0x1af1('0x80')](function(){_0x2370bd[_0x1af1('0xab')](_0x58b7af,_0x182233,_0x4025b5)[_0x1af1('0x80')](function(){});});}});break;case'ANSWER':var _0x2044fa=moment()['format'](_0x1af1('0xac'));_0x58b7af[_0x1af1('0xad')]=_0x2044fa;_0x58b7af[_0x1af1('0xae')]=_0x2044fa;_0x58b7af[_0x1af1('0x76')]=!![];_0x3433f0[_0x1af1('0x2a')]+=0x1;logger[_0x1af1('0x68')](_0x1af1('0xaf'),_0x58b7af[_0x1af1('0xb0')],_0x1af1('0xb1'),_0x3433f0[_0x1af1('0x4d')],_0x1af1('0x6d'),_0x3433f0[_0x1af1('0x2a')]);ami[_0x1af1('0x25')](_0x1af1('0xb2'),ut[_0x1af1('0x9a')](_0x58b7af,_0x1af1('0xb3'),this['campaignsPreview'][_0x58b7af['queue']]));if(_0x3433f0[_0x1af1('0xb4')]){ami[_0x1af1('0x25')](_0x1af1('0xb5'),ut[_0x1af1('0xb6')](_0x58b7af));}break;case'16':ami['emit'](_0x1af1('0xb7'),ut[_0x1af1('0x9a')](_0x58b7af,_0x1af1('0xb8'),this[_0x1af1('0x11')][_0x58b7af['queue']]));emitVoiceQueueChannelRemove(ut[_0x1af1('0x9a')](_0x58b7af,'complete'));_0x3433f0['outboundAnswerCallsDay']+=0x1;_0x3433f0[_0x1af1('0x2c')]+=0x1;_0x3433f0[_0x1af1('0x28')]+=0x1;ut[_0x1af1('0x77')](_0x3433f0,_0x1af1('0xb9'));_0x58b7af[_0x1af1('0x97')]=ut[_0x1af1('0x98')](_0x58b7af);ut['logCustomer'](_0x58b7af,0x4,_0x1af1('0xba'));rpcDb['createCustomerHistory'](_0x58b7af,_0x1af1('0xbb'));rpcDb[_0x1af1('0x8b')](_0x58b7af,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x1af1('0xbc')](_0x58b7af);_0x3433f0[_0x1af1('0xbd')]+=_0x58b7af[_0x1af1('0xbe')];_0x3433f0[_0x1af1('0x2b')]+=_0x58b7af[_0x1af1('0xbe')];logger[_0x1af1('0x68')](_0x1af1('0xbf'),_0x58b7af['uniqueid'],_0x1af1('0xb1'),_0x3433f0['name'],_0x1af1('0x6d'),_0x3433f0[_0x1af1('0x2a')]);delete this[_0x1af1('0x6a')][_0x310ae0[_0x1af1('0xc0')]];break;case _0x1af1('0xc1'):_0x3433f0[_0x1af1('0xc2')]+=0x1;_0x58b7af[_0x1af1('0xc3')]+=0x1;_0x58b7af[_0x1af1('0x97')]=ut['totalGlobal'](_0x58b7af);ut[_0x1af1('0x84')](_0x58b7af,0x5,_0x1af1('0xc4'));_0x182233=_0x3433f0['dialBusyRetryFrequency'];_0x4025b5=_0x3433f0['callAdditionalPhoneAfterMin'];ami[_0x1af1('0x25')](_0x1af1('0xc5'),ut[_0x1af1('0x9a')](_0x58b7af,_0x1af1('0xc6')));rpcDb['createCustomerHistory'](_0x58b7af,_0x1af1('0xc7'));_0x2370bd[_0x1af1('0x9c')](_0x58b7af,'5',_0x3433f0)['then'](function(_0x314af2){_0x5d53dc=_0x314af2[_0x1af1('0x9d')]==0x1;if(!_0x5d53dc){if(ut[_0x1af1('0x98')](_0x58b7af)>=_0x3433f0['dialGlobalMaxRetry']){_0xaea8a1=ut[_0x1af1('0xa1')](_0x58b7af,0xf,'Global');rpcDb['createCustomerFinal'](_0xaea8a1,_0x1af1('0xc8'));}else{if(_0x58b7af['countbusyretry']>=_0x3433f0[_0x1af1('0xc9')]){rpcDb['createCustomerFinal'](_0x58b7af,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x1af1('0xa5')](ut['scheduledAt'](_0x58b7af,_0x1af1('0xc3'),_0x3433f0[_0x1af1('0xca')]),_0x58b7af['unlockAgent'],_0x58b7af['activeContact']);}}}else{_0x58b7af[_0x1af1('0xc3')]++;_0x2370bd['incrementPreviewCounters']({'id':_0x58b7af['idContact'],'field':{'countbusyretry':_0x58b7af['countbusyretry']}})[_0x1af1('0x80')](function(){_0x2370bd[_0x1af1('0xab')](_0x58b7af,_0x182233,_0x4025b5)[_0x1af1('0x80')](function(){});});}});break;case _0x1af1('0xcb'):_0x3433f0[_0x1af1('0xcc')]+=0x1;_0x58b7af['countnoanswerretry']+=0x1;_0x58b7af['countglobal']=ut[_0x1af1('0x98')](_0x58b7af);ut['logCustomer'](_0x58b7af,0x3,_0x1af1('0xcd'));_0x182233=_0x3433f0[_0x1af1('0xce')];_0x4025b5=_0x3433f0[_0x1af1('0x9f')];var _0x19f9a2=ut[_0x1af1('0xcf')](_0x58b7af,_0x3433f0);ami[_0x1af1('0x25')](_0x1af1('0xd0'),_0x19f9a2);rpcDb['createCustomerHistory'](_0x58b7af,_0x1af1('0xd1'));_0x2370bd[_0x1af1('0x9c')](_0x58b7af,'3',_0x3433f0)[_0x1af1('0x80')](function(_0x4354f2){_0x5d53dc=_0x4354f2[_0x1af1('0x9d')]==0x1;if(!_0x5d53dc){if(ut['totalGlobal'](_0x58b7af)>=_0x3433f0[_0x1af1('0xa0')]){_0xaea8a1=ut['cloneAction'](_0x58b7af,0xf,_0x1af1('0xa2'));rpcDb[_0x1af1('0x8b')](_0xaea8a1,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x58b7af[_0x1af1('0xd2')]>=_0x3433f0[_0x1af1('0xd3')]){rpcDb[_0x1af1('0x8b')](_0x58b7af,_0x1af1('0xd1'));}else{rpcDb['rescheduleContact'](ut[_0x1af1('0xa6')](_0x58b7af,'countnoanswerretry',_0x3433f0[_0x1af1('0xce')]),_0x58b7af[_0x1af1('0xa7')],_0x58b7af['activeContact']);}}}else{_0x58b7af['countnoanswerretry']++;_0x2370bd[_0x1af1('0xaa')]({'id':_0x58b7af[_0x1af1('0xa9')],'field':{'countnoanswerretry':_0x58b7af['countnoanswerretry']}})[_0x1af1('0x80')](function(){_0x2370bd[_0x1af1('0xab')](_0x58b7af,_0x182233,_0x4025b5)[_0x1af1('0x80')](function(){});});}});break;case'CONGESTION':_0x3433f0['outboundCongestionCallsDay']+=0x1;_0x58b7af[_0x1af1('0xd4')]+=0x1;_0x58b7af['countglobal']=ut[_0x1af1('0x98')](_0x58b7af);ut['logCustomer'](_0x58b7af,0x8,_0x1af1('0xd5'));_0x182233=_0x3433f0[_0x1af1('0xd6')];_0x4025b5=_0x3433f0['callAdditionalPhoneAfterMin'];ami['emit'](_0x1af1('0xd7'),ut[_0x1af1('0x9a')](_0x58b7af,_0x1af1('0xd8')));rpcDb[_0x1af1('0x88')](_0x58b7af,_0x1af1('0xd9'));_0x2370bd[_0x1af1('0x9c')](_0x58b7af,'8',_0x3433f0)['then'](function(_0x566448){_0x5d53dc=_0x566448[_0x1af1('0x9d')]==0x1;if(!_0x5d53dc){if(ut[_0x1af1('0x98')](_0x58b7af)>=_0x3433f0[_0x1af1('0xa0')]){_0xaea8a1=ut['cloneAction'](_0x58b7af,0xf,_0x1af1('0xa2'));rpcDb[_0x1af1('0x8b')](_0xaea8a1,_0x1af1('0xda'));}else{if(_0x58b7af['countcongestionretry']>=_0x3433f0[_0x1af1('0xdb')]){rpcDb[_0x1af1('0x8b')](_0x58b7af,_0x1af1('0xd9'));}else{rpcDb[_0x1af1('0xa5')](ut['scheduledAt'](_0x58b7af,_0x1af1('0xd4'),_0x3433f0[_0x1af1('0xca')]),_0x58b7af['unlockAgent'],_0x58b7af[_0x1af1('0xdc')]);}}}else{_0x58b7af[_0x1af1('0xd4')]++;_0x2370bd[_0x1af1('0xaa')]({'id':_0x58b7af[_0x1af1('0xa9')],'field':{'countcongestionretry':_0x58b7af[_0x1af1('0xd4')]}})[_0x1af1('0x80')](function(){_0x2370bd[_0x1af1('0xab')](_0x58b7af,_0x182233,_0x4025b5)[_0x1af1('0x80')](function(){});});}});break;case'CANCEL':_0x3433f0[_0x1af1('0x3d')]+=0x1;_0x58b7af[_0x1af1('0xdd')]+=0x1;_0x58b7af[_0x1af1('0x97')]=ut[_0x1af1('0x98')](_0x58b7af);ut[_0x1af1('0x84')](_0x58b7af,0x14,_0x1af1('0xde'));_0x182233=_0x3433f0[_0x1af1('0xdf')];_0x4025b5=_0x3433f0[_0x1af1('0x9f')];ami[_0x1af1('0x25')](_0x1af1('0xe0'),ut['buildObj'](_0x58b7af,'agentreject'));rpcDb['createCustomerHistory'](_0x58b7af,_0x1af1('0xe1'));_0x2370bd['verifyAdditionalPhones'](_0x58b7af,'20',_0x3433f0)[_0x1af1('0x80')](function(_0x12dde8){_0x5d53dc=_0x12dde8[_0x1af1('0x9d')]==0x1;if(!_0x5d53dc){if(ut[_0x1af1('0x98')](_0x58b7af)>=_0x3433f0['dialGlobalMaxRetry']){_0xaea8a1=ut['cloneAction'](_0x58b7af,0x14,_0x1af1('0xde'));rpcDb[_0x1af1('0x8b')](_0xaea8a1,_0x1af1('0xe2'));}else{if(_0x58b7af[_0x1af1('0xdd')]>=_0x3433f0[_0x1af1('0xe3')]){rpcDb['createCustomerFinal'](_0x58b7af,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x1af1('0xa5')](ut['scheduledAt'](_0x58b7af,_0x1af1('0xdd'),_0x3433f0[_0x1af1('0xdf')]),_0x58b7af[_0x1af1('0xa7')],_0x58b7af[_0x1af1('0xdc')]);}}}else{_0x58b7af['countnoanswerretry']++;_0x2370bd['incrementPreviewCounters']({'id':_0x58b7af[_0x1af1('0xa9')],'field':{'countnoanswerretry':_0x58b7af[_0x1af1('0xd2')]}})['then'](function(){_0x2370bd[_0x1af1('0xab')](_0x58b7af,_0x182233,_0x4025b5)['then'](function(){});});}});break;case _0x1af1('0xe4'):_0x3433f0[_0x1af1('0xe5')]+=0x1;_0x58b7af[_0x1af1('0xe6')]+=0x1;_0x58b7af[_0x1af1('0x97')]=ut[_0x1af1('0x98')](_0x58b7af);ut[_0x1af1('0x84')](_0x58b7af,0xb,_0x1af1('0xe7'));rpcDb[_0x1af1('0x88')](_0x58b7af,_0x1af1('0xe8'));_0x2370bd[_0x1af1('0x9c')](_0x58b7af,'11',_0x3433f0)[_0x1af1('0x80')](function(_0x31a485){_0x5d53dc=_0x31a485[_0x1af1('0x9d')]==0x1;if(!_0x5d53dc){if(ut[_0x1af1('0x98')](_0x58b7af)>=_0x3433f0[_0x1af1('0xa0')]){_0xaea8a1=ut[_0x1af1('0xa1')](_0x58b7af,0xf,_0x1af1('0xa2'));rpcDb[_0x1af1('0x8b')](_0xaea8a1,_0x1af1('0xe8'));}else{if(_0x58b7af['countabandonedetry']>=_0x3433f0[_0x1af1('0xe9')]){rpcDb['createCustomerFinal'](_0x58b7af,_0x1af1('0xe8'));}else{rpcDb[_0x1af1('0xa5')](ut[_0x1af1('0xa6')](_0x58b7af,_0x1af1('0xe6'),_0x3433f0[_0x1af1('0xea')]),_0x58b7af[_0x1af1('0xa7')],_0x58b7af[_0x1af1('0xdc')]);}}}else{_0x58b7af['countnoanswerretry']++;_0x2370bd['incrementPreviewCounters']({'id':_0x58b7af[_0x1af1('0xa9')],'field':{'countnoanswerretry':_0x58b7af[_0x1af1('0xd2')]}})[_0x1af1('0x80')](function(){_0x2370bd[_0x1af1('0xab')](_0x58b7af,_0x182233,_0x4025b5)[_0x1af1('0x80')](function(){});});}});break;case'18':_0x3433f0['outboundUnknownCallsDay']+=0x1;_0x58b7af[_0x1af1('0xeb')]+=0x1;_0x58b7af[_0x1af1('0x97')]=ut[_0x1af1('0x98')](_0x58b7af);ut[_0x1af1('0x84')](_0x58b7af,0x12,_0x310ae0['cause-txt']||_0x310ae0[_0x1af1('0xec')]);ami[_0x1af1('0x25')](_0x1af1('0xed'),ut['buildObj'](_0x58b7af,_0x1af1('0xee')));rpcDb[_0x1af1('0x88')](_0x58b7af,_0x1af1('0xef'));_0x2370bd[_0x1af1('0x9c')](_0x58b7af,'18',_0x3433f0)['then'](function(_0x1b67e4){_0x5d53dc=_0x1b67e4[_0x1af1('0x9d')]==0x1;if(!_0x5d53dc){if(ut[_0x1af1('0x98')](_0x58b7af)>=_0x3433f0[_0x1af1('0xa0')]){_0xaea8a1=ut[_0x1af1('0xa1')](_0x58b7af,0x12,'Global');rpcDb['createCustomerFinal'](_0xaea8a1,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x58b7af,_0x1af1('0xef'));}}else{_0x58b7af[_0x1af1('0xd2')]++;_0x2370bd[_0x1af1('0xaa')]({'id':_0x58b7af[_0x1af1('0xa9')],'field':{'countnoanswerretry':_0x58b7af[_0x1af1('0xd2')]}})['then'](function(){_0x2370bd[_0x1af1('0xab')](_0x58b7af,_0x182233,_0x4025b5)[_0x1af1('0x80')](function(){});});}});delete this[_0x1af1('0x6a')][_0x310ae0[_0x1af1('0xc0')]];break;case'19':_0x3433f0[_0x1af1('0x3e')]+=0x1;_0x58b7af['countglobal']=ut[_0x1af1('0x98')](_0x58b7af);ut[_0x1af1('0x84')](_0x58b7af,0x13,_0x310ae0[_0x1af1('0xf0')]||_0x310ae0[_0x1af1('0xec')]);ami['emit'](_0x1af1('0xed'),ut['buildObj'](_0x58b7af,_0x1af1('0xee')));rpcDb[_0x1af1('0x88')](_0x58b7af,'[callProgressDetectingCustomer][machine]');_0x2370bd[_0x1af1('0x9c')](_0x58b7af,'18',_0x3433f0)[_0x1af1('0x80')](function(_0x1fbb7b){_0x5d53dc=_0x1fbb7b[_0x1af1('0x9d')]==0x1;if(!_0x5d53dc){if(ut[_0x1af1('0x98')](_0x58b7af)>=_0x3433f0[_0x1af1('0xa0')]){_0xaea8a1=ut['cloneAction'](_0x58b7af,0xf,_0x1af1('0xa2'));rpcDb['createCustomerFinal'](_0xaea8a1,_0x1af1('0xf1'));}else{rpcDb['createCustomerFinal'](_0x58b7af,_0x1af1('0xf1'));}}else{_0x58b7af[_0x1af1('0xd2')]++;_0x2370bd['incrementPreviewCounters']({'id':_0x58b7af[_0x1af1('0xa9')],'field':{'countnoanswerretry':_0x58b7af[_0x1af1('0xd2')]}})[_0x1af1('0x80')](function(){_0x2370bd[_0x1af1('0xab')](_0x58b7af,_0x182233,_0x4025b5)[_0x1af1('0x80')](function(){});});}});delete this['actions'][_0x310ae0[_0x1af1('0xc0')]];break;default:if(_0x58b7af[_0x1af1('0x76')]){ut[_0x1af1('0x77')](_0x3433f0,_0x1af1('0xf2'));ut[_0x1af1('0x78')](_0x1af1('0xf3')+_0x3433f0[_0x1af1('0x4d')],_0x310ae0);}_0x3433f0[_0x1af1('0x3e')]+=0x1;_0x58b7af[_0x1af1('0x97')]=ut[_0x1af1('0x98')](_0x58b7af);ut['logCustomer'](_0x58b7af,0xc,_0x310ae0['cause-txt']||_0x310ae0['dialstatus']);_0x182233=_0x3433f0['dialAgentRejectRetryFrequency'];_0x4025b5=_0x3433f0[_0x1af1('0x9f')];rpcDb[_0x1af1('0x88')](_0x58b7af,_0x1af1('0xf4'));_0x2370bd['verifyAdditionalPhones'](_0x58b7af,'20',_0x3433f0)[_0x1af1('0x80')](function(_0x9ab375){_0x5d53dc=_0x9ab375[_0x1af1('0x9d')]==0x1;if(!_0x5d53dc){if(ut[_0x1af1('0x98')](_0x58b7af)>=_0x3433f0[_0x1af1('0xa0')]){_0xaea8a1=ut[_0x1af1('0xa1')](_0x58b7af,0xf,_0x1af1('0xa2'));rpcDb['createCustomerFinal'](_0xaea8a1,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x1af1('0x8b')](_0x58b7af,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x310ae0[_0x1af1('0xc0')]];}else{_0x2370bd[_0x1af1('0xab')](_0x58b7af,_0x182233,_0x4025b5)[_0x1af1('0x80')](function(){});}});}if(!(_0x58b7af[_0x1af1('0x76')]&&_0x3a94e2==='16')){ut['updateOriginated'](_0x3433f0,_0x1af1('0xf5'));logger[_0x1af1('0x68')](_0x1af1('0xf6'),_0x58b7af[_0x1af1('0xb0')],_0x1af1('0xb1'),_0x3433f0['name'],_0x1af1('0x6b'),_0x3433f0[_0x1af1('0xf7')]);}if(_0x3a94e2!=='ANSWER'){delete this[_0x1af1('0x6a')][_0x310ae0['linkedid']];delete this[_0x1af1('0x6a')][_0x310ae0[_0x1af1('0xf8')]];}}};Preview[_0x1af1('0xc')][_0x1af1('0xf9')]=function(_0x13074c,_0x1a0b56,_0x192355){if(_[_0x1af1('0xfa')](_0x1a0b56)&&'object'!==typeof _0x1a0b56){return;}if(_['isUndefined'](_0x192355)&&_0x1af1('0xfb')!==typeof _0x192355){return;}switch(_0x192355[_0x1af1('0xfc')]){case'0':ut[_0x1af1('0xfd')](_0x13074c,0x0,_0x1af1('0x99'));rpcDb[_0x1af1('0xfe')](_0x13074c,_0x1af1('0xff'));break;case'3':ut[_0x1af1('0xfd')](_0x13074c,0x3,_0x1af1('0xcd'));rpcDb[_0x1af1('0xfe')](_0x13074c,_0x1af1('0x100'));break;case'5':ut[_0x1af1('0xfd')](_0x13074c,0x5,_0x1af1('0xc4'));rpcDb[_0x1af1('0xfe')](_0x13074c,_0x1af1('0x101'));break;case'8':ut[_0x1af1('0xfd')](_0x13074c,0x8,'Congestion');rpcDb[_0x1af1('0xfe')](_0x13074c,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x1af1('0xfd')](_0x13074c,0x16,_0x1af1('0x102'));rpcDb[_0x1af1('0xfe')](_0x13074c,_0x1af1('0x103'));break;default:ut[_0x1af1('0xfd')](_0x13074c,0xc,_0x192355[_0x1af1('0xfc')]);rpcDb[_0x1af1('0xfe')](_0x13074c,_0x1af1('0x104'));}ut[_0x1af1('0x74')](_0x1a0b56,_0x1af1('0x105'));logger[_0x1af1('0x68')](_0x1af1('0x106'),_0x13074c[_0x1af1('0xb0')],'\x20Queue',_0x1a0b56['name'],_0x1af1('0x6b'),_0x1a0b56[_0x1af1('0xf7')]);delete this[_0x1af1('0x6a')][_0x13074c[_0x1af1('0xb0')]];};Preview[_0x1af1('0xc')]['verifyAdditionalPhones']=function(_0x1c6ba2,_0x51e24b,_0x14c044){return Promise[_0x1af1('0x107')]()['then'](cmHopperAdditionalPhone[_0x1af1('0x9c')](_0x1c6ba2,_0x51e24b,_0x14c044))[_0x1af1('0x73')](logger[_0x1af1('0x68')](_0x1af1('0x108')));};Preview[_0x1af1('0xc')][_0x1af1('0xab')]=function(_0x362110,_0x495e50,_0x254123){return Promise[_0x1af1('0x107')]()[_0x1af1('0x80')](cmHopperAdditionalPhone[_0x1af1('0xab')](_0x362110,_0x495e50,_0x254123))[_0x1af1('0x73')](logger[_0x1af1('0x68')](_0x1af1('0x109')));};Preview['prototype'][_0x1af1('0xaa')]=function(_0x38c9ef){return Promise[_0x1af1('0x107')]()['then'](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x38c9ef))[_0x1af1('0x73')](logger[_0x1af1('0x68')](_0x1af1('0x10a')));};Preview[_0x1af1('0xc')][_0x1af1('0x10b')]=function(_0x2a8abe,_0xdd111d,_0x40fb7a,_0x6c2df2,_0x51bc58){var _0xbb01b1=this;return new Promise(function(_0x3a874e,_0x24666e){if(_[_0x1af1('0x67')](_0xdd111d)||_[_0x1af1('0x67')](_0xdd111d[_0x1af1('0x10c')])||_[_0x1af1('0x67')](_0xdd111d[_0x1af1('0x10d')])||_[_0x1af1('0x67')](_0xdd111d[_0x1af1('0x70')])){_0x24666e(ut[_0x1af1('0x48')](_0x1af1('0x10e'),_0x6c2df2,_0x51bc58));return;}var _0x42816a=uuid['v4']();var _0x165518=_0xbb01b1[_0x1af1('0x11')][_0xdd111d[_0x1af1('0x69')][_0x1af1('0x4d')]];var _0x295dac=_0x40fb7a?_0xbb01b1['agents'][_0x40fb7a]['id']:undefined;_0xbb01b1[_0x1af1('0x6a')][_0x42816a]=new Action(_0xdd111d,_0x165518,_0x42816a,_0x40fb7a,_0x295dac);var _0x372836=_0xbb01b1[_0x1af1('0x6a')][_0x42816a];_0x372836[_0x1af1('0xa7')]=_0x6c2df2;_0x372836['activeContact']=_0x51bc58;_0x372836[_0x1af1('0x10f')]=_0x40fb7a;if(_[_0x1af1('0x110')](_0x2a8abe)){_0xbb01b1[_0x1af1('0x111')](_0x372836,_0x165518,_0xdd111d,_0x40fb7a)['then'](function(_0x447278){logger[_0x1af1('0x68')](_0x1af1('0x112'),_0x1af1('0x113')+_0x372836[_0x1af1('0x6c')]+_0x1af1('0x114')+_0x372836[_0x1af1('0xa9')],JSON['stringify'](_0x447278));ami['emit'](_0x1af1('0x115'),ut[_0x1af1('0x9a')](_0x372836,_0x1af1('0x116'),_0xbb01b1['campaignsPreview'][_0x372836[_0x1af1('0x6c')]]));_0x3a874e(ut['message'](_0x1af1('0x117')));})[_0x1af1('0x73')](function(_0x11dc40){ut['logger'](_0x1af1('0x118'),_0x11dc40);_0x24666e(ut['message'](_0x1af1('0x119'),_0x6c2df2,_0x51bc58));});}else{_0x165518[_0x1af1('0x37')]+=0x1;ut[_0x1af1('0x11a')](_0x372836);rpcDb[_0x1af1('0x11b')](_0x372836,_0x1af1('0x11c'));delete _0xbb01b1['actions'][_0x42816a];_0x24666e(ut[_0x1af1('0x48')](_0x1af1('0x11d'),_0x6c2df2,_0x51bc58));}});};Preview[_0x1af1('0xc')]['isTrunkReachable']=function(_0x4302b8){return!_['isNil'](_0x4302b8)&&!_[_0x1af1('0x67')](_0x4302b8['name'])&&!_[_0x1af1('0x67')](_0x4302b8[_0x1af1('0x4e')])&&_0x4302b8[_0x1af1('0x4e')]&&!_[_0x1af1('0x67')](this[_0x1af1('0x13')][util['format'](_0x1af1('0x11e'),_0x4302b8[_0x1af1('0x4d')])])&&!_[_0x1af1('0x67')](this['trunks'][util[_0x1af1('0x53')](_0x1af1('0x11e'),_0x4302b8[_0x1af1('0x4d')])][_0x1af1('0x72')])&&(this['trunks'][util[_0x1af1('0x53')]('SIP/%s',_0x4302b8[_0x1af1('0x4d')])][_0x1af1('0x72')]==='reachable'||this[_0x1af1('0x13')][util['format']('SIP/%s',_0x4302b8[_0x1af1('0x4d')])][_0x1af1('0x72')]===_0x1af1('0x11f'));};Preview[_0x1af1('0xc')][_0x1af1('0x7f')]=function(_0x20bc9b,_0x319fce){return this['execRun'](_0x20bc9b,_0x319fce)[_0x1af1('0x80')](function(_0x2eec79){return _[_0x1af1('0x6e')](_0x2eec79,['message']);})[_0x1af1('0x73')](function(_0xc7d7d2){if(_0xc7d7d2['unlock']){rpcDb[_0x1af1('0x120')](_0x20bc9b);}if(_0xc7d7d2[_0x1af1('0x4e')]){rpcDb['disableContact'](_0x20bc9b);}throw _['pick'](_0xc7d7d2,[_0x1af1('0x48')]);});};Preview[_0x1af1('0xc')]['execRun']=function(_0x28b2ca,_0x5a803d){var _0x409250=this;var _0x3dfa90,_0x2915a8;return rpcDb[_0x1af1('0x121')](_0x28b2ca)[_0x1af1('0x80')](function(_0x5af8c7){if(!_[_0x1af1('0x67')](_0x5af8c7[0x0])){_0x2915a8=_0x5af8c7[0x0]['recallme']?![]:!![];_0x3dfa90=_0x5af8c7[0x0]['recallme']?!![]:![];_0x3dfa90=_0x5a803d?!![]:_0x3dfa90;}var _0x4350b3=_0x409250[_0x1af1('0x122')](_0x5af8c7);if(_0x4350b3[_0x1af1('0x123')]){rpcDb[_0x1af1('0x124')](_[_0x1af1('0x6e')](_0x5af8c7[0x0],[_0x1af1('0x70'),'phone']))[_0x1af1('0x80')](function(_0x4ba193){_0x409250[_0x1af1('0x10b')](_0x4ba193,_0x5af8c7[0x0],_0x5a803d,_0x2915a8,_0x3dfa90)[_0x1af1('0x80')](function(_0x4ea4f3){return _0x4ea4f3;})[_0x1af1('0x73')](function(_0xb5eb0f){throw _0xb5eb0f;});})['catch'](function(_0x427aab){ut[_0x1af1('0x125')](_0x1af1('0x126'),_0x427aab);throw ut[_0x1af1('0x48')]('Call\x20unsuccessful',_0x2915a8,_0x3dfa90);});}else{throw ut[_0x1af1('0x48')](_0x4350b3[_0x1af1('0x48')],_0x2915a8,_0x3dfa90);}})[_0x1af1('0x73')](function(_0x463d03){ut[_0x1af1('0x125')](_0x1af1('0x127'),_0x463d03);throw ut[_0x1af1('0x48')](_0x1af1('0x128'),![],!![]);});};Preview[_0x1af1('0xc')][_0x1af1('0x122')]=function(_0x2a7624){if(_[_0x1af1('0x67')](_0x2a7624)||_['isEmpty'](_0x2a7624)||!_[_0x1af1('0x67')](_0x2a7624[0x0][_0x1af1('0x129')])&&_['isNil'](_0x2a7624[0x0][_0x1af1('0x129')]['name'])){ut[_0x1af1('0x125')](_0x1af1('0x12a'),_0x2a7624);return{'isValid':![],'message':_0x1af1('0x12b')};}var _0x4615ad=this[_0x1af1('0x11')][_0x2a7624[0x0]['Queue'][_0x1af1('0x4d')]];_0x4615ad[_0x1af1('0x48')]=_0x1af1('0x93');if(_[_0x1af1('0x67')](_0x4615ad)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0x4615ad);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x1af1('0x90')](_0x4615ad[_0x1af1('0x4c')])){ut[_0x1af1('0x125')](_0x1af1('0x12c'),_0x1af1('0x12d')+_0x4615ad[_0x1af1('0x4d')]+_0x1af1('0x12e'));if(!this[_0x1af1('0x90')](_0x4615ad[_0x1af1('0x91')])){ut[_0x1af1('0x125')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4615ad[_0x1af1('0x4d')]+_0x1af1('0x12f'));return{'isValid':![],'message':_0x1af1('0x130')};}}if(!ut[_0x1af1('0x131')](_0x4615ad[_0x1af1('0x30')])){ut[_0x1af1('0x125')]('[Preview][validateContact][Campaign\x20Active]',_0x4615ad[_0x1af1('0x4d')]+_0x1af1('0x132'));return{'isValid':![],'message':_0x1af1('0x12d')+_0x4615ad['name']+_0x1af1('0x132')};}return{'isValid':!![],'message':_0x1af1('0x133')};};Preview[_0x1af1('0xc')]['execCall']=function(_0x312c7f,_0x1ae35a,_0x54c396,_0x2287e8){var _0x21d618=this;return new Promise(function(_0x571d22,_0x405240){var _0x2e22bc=_0x312c7f[_0x1af1('0xb0')];var _0x4ed052=_0x21d618[_0x1af1('0x90')](_0x1ae35a[_0x1af1('0x4c')])?util[_0x1af1('0x53')](_0x1af1('0x134'),_0x1ae35a[_0x1af1('0x4c')][_0x1af1('0x4d')],_[_0x1af1('0x67')](_0x1ae35a['dialPrefix'])?'':_0x1ae35a[_0x1af1('0x34')][_0x1af1('0x135')]()||'',_0x1ae35a['dialCutDigit']>0x0?_0x54c396['phone']['substring'](_0x1ae35a[_0x1af1('0x136')]):_0x54c396[_0x1af1('0x10d')]):util['format'](_0x1af1('0x134'),_[_0x1af1('0x67')](_0x1ae35a['TrunkBackup'])?_0x1ae35a[_0x1af1('0x4c')][_0x1af1('0x4d')]:_0x1ae35a[_0x1af1('0x91')][_0x1af1('0x4d')],_[_0x1af1('0x67')](_0x1ae35a[_0x1af1('0x34')])?'':_0x1ae35a['dialPrefix']['trim']()||'',_0x1ae35a[_0x1af1('0x136')]>0x0?_0x54c396[_0x1af1('0x10d')][_0x1af1('0x137')](_0x1ae35a[_0x1af1('0x136')]):_0x54c396[_0x1af1('0x10d')]);var _0x2271d8=_0x21d618[_0x1af1('0x90')](_0x1ae35a[_0x1af1('0x4c')])?ut[_0x1af1('0x138')](_0x1ae35a[_0x1af1('0x4c')]['callerid'],_0x1ae35a['dialOriginateCallerIdName'],_0x1ae35a[_0x1af1('0x139')]>0x0?ut[_0x1af1('0x13a')](_0x1ae35a[_0x1af1('0x32')],_0x1ae35a[_0x1af1('0x139')]):_0x1ae35a['dialOriginateCallerIdNumber']):ut['getCallerId'](_[_0x1af1('0x67')](_0x1ae35a[_0x1af1('0x91')])?_0x1ae35a[_0x1af1('0x4c')][_0x1af1('0x4f')]:_0x1ae35a[_0x1af1('0x91')][_0x1af1('0x4f')],_0x1ae35a[_0x1af1('0x13b')],_0x1ae35a['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x1af1('0x13a')](_0x1ae35a[_0x1af1('0x32')],_0x1ae35a[_0x1af1('0x139')]):_0x1ae35a[_0x1af1('0x32')]);if(_0x2271d8){_0x312c7f['originatecalleridname']=ut[_0x1af1('0x13c')](_0x2271d8);_0x312c7f[_0x1af1('0x13d')]=ut['extractCalleridNumber'](_0x2271d8);}var _0x119f9f=ut[_0x1af1('0x13e')](_0x1ae35a,_0x54c396,_0x4ed052,_0x2271d8,_0x2e22bc,_0x312c7f);_[_0x1af1('0x13f')](_0x312c7f,ut[_0x1af1('0x140')](_0x119f9f));_0x312c7f[_0x1af1('0x83')]=moment()['format'](_0x1af1('0xac'));_0x1ae35a['variables']=_0x119f9f;ami[_0x1af1('0x71')](ut['variablesAction'](_0x312c7f,_0x1ae35a,_0x119f9f,_0x312c7f[_0x1af1('0xdc')],_0x2287e8))[_0x1af1('0x80')](function(_0x34fb29){_0x1ae35a[_0x1af1('0xf7')]+=0x1;logger[_0x1af1('0x68')](_0x1af1('0x141'),_0x2e22bc,_0x1af1('0xb1'),_0x1ae35a[_0x1af1('0x4d')],_0x1af1('0x6b'),_0x1ae35a[_0x1af1('0xf7')]);_0x571d22(_0x34fb29);})['catch'](function(_0x5bb5c7){ut['logAgent'](_0x312c7f,0xe,_0x1af1('0x142'));rpcDb[_0x1af1('0xfe')](_0x312c7f,_0x1af1('0x143'));_0x405240(_0x5bb5c7);});});};Preview[_0x1af1('0xc')][_0x1af1('0x1f')]=function(_0x243d28){if(this['actions'][_0x243d28['linkedid']]){this[_0x1af1('0x6a')][_0x243d28[_0x1af1('0xc0')]][_0x1af1('0x144')]=_0x243d28[_0x1af1('0x144')];}};Preview[_0x1af1('0xc')][_0x1af1('0x145')]=function(_0x5f7aad){var _0x539aea=this;var _0x2530c6=this['actions'][_0x5f7aad[_0x1af1('0x146')]];if(_0x2530c6){if(_0x2530c6[_0x1af1('0x10f')]&&this[_0x1af1('0x14')][_0x2530c6[_0x1af1('0x10f')]]){ut[_0x1af1('0x147')](_0x2530c6,this[_0x1af1('0x14')][_0x2530c6['lookAgent']]['name'],this[_0x1af1('0x14')][_0x2530c6['lookAgent']]['id']);}var _0x398a1b=_[_0x1af1('0x148')](_0x2530c6);_0x398a1b[_0x1af1('0xad')]=moment()['format'](_0x1af1('0xac'));var _0x2b3930=_0x539aea['campaignsPreview'][_0x2530c6['queue']];if(ut['isFailure'](_0x5f7aad[_0x1af1('0x149')])){if(_0x2530c6['unlockAgent']){rpcDb[_0x1af1('0x120')](_0x2530c6[_0x1af1('0xa9')]);}if(_0x2530c6[_0x1af1('0xdc')]){rpcDb['disableContact'](_0x2530c6[_0x1af1('0xa9')]);}ami[_0x1af1('0x25')]('custom:agentringnoanswer',ut[_0x1af1('0x9a')](_0x2530c6,_0x1af1('0x14a'),this[_0x1af1('0x11')][_0x2530c6[_0x1af1('0x6c')]]));this[_0x1af1('0xf9')](_0x398a1b,_0x2b3930,_0x5f7aad);}else{_0x2530c6[_0x1af1('0x83')]=moment()[_0x1af1('0x53')](_0x1af1('0xac'));ut[_0x1af1('0xfd')](_0x398a1b,0x4,'Answer');rpcDb[_0x1af1('0xfe')](_0x398a1b,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x1af1('0xc')][_0x1af1('0x19')]=function(_0x3f1f41){var _0x461953=this[_0x1af1('0x6a')][_0x3f1f41['linkedid']];var _0x279d18;if(_0x461953){_0x279d18=this[_0x1af1('0x11')][_0x461953[_0x1af1('0x6c')]];logger['info'](_0x1af1('0x14b'),_0x3f1f41['linkedid'],_0x1af1('0xb1'),_0x279d18[_0x1af1('0x4d')],_0x1af1('0x6d'),_0x279d18[_0x1af1('0x2a')]);}if(this[_0x1af1('0x6a')][_0x3f1f41[_0x1af1('0xc0')]]&&_0x3f1f41[_0x1af1('0xc0')]!==_0x3f1f41[_0x1af1('0xb0')]){if(_0x3f1f41[_0x1af1('0x14c')]==='16'&&this[_0x1af1('0x6a')][_0x3f1f41['linkedid']][_0x1af1('0x76')]){this[_0x1af1('0x94')](_0x3f1f41,_0x3f1f41[_0x1af1('0xc0')],_0x3f1f41['cause']);}else if(this[_0x1af1('0x6a')][_0x3f1f41[_0x1af1('0xc0')]][_0x1af1('0x76')]){logger[_0x1af1('0x68')]('[syncHangup][talking][cause]',_0x3f1f41[_0x1af1('0xc0')],_0x3f1f41[_0x1af1('0x14c')],_0x1af1('0xb1'),_0x279d18[_0x1af1('0x4d')],_0x1af1('0x6d'),_0x279d18[_0x1af1('0x2a')]);this[_0x1af1('0x94')](_0x3f1f41,_0x3f1f41[_0x1af1('0xc0')],_0x3f1f41[_0x1af1('0x14c')]);}}else if(_0x461953&&_[_0x1af1('0x67')](_0x461953[_0x1af1('0x14d')])&&_0x279d18['dialQueueProject']&&_0x3f1f41[_0x1af1('0xc0')]===_0x3f1f41['uniqueid']&&_['isNil'](_0x3f1f41[_0x1af1('0xfc')])&&_0x3f1f41[_0x1af1('0x14c')]==='16'&&_0x3f1f41[_0x1af1('0x14e')]==='6'&&_['isUndefined'](_0x461953[_0x1af1('0x14f')])){if(_0x461953[_0x1af1('0xa7')]){rpcDb[_0x1af1('0x120')](_0x461953[_0x1af1('0xa9')]);}if(_0x461953['activeContact']){rpcDb['disableContact'](_0x461953['idContact']);}_0x3f1f41[_0x1af1('0xfc')]='22';this['callProgressDetectingAgent'](_0x461953,_0x279d18,_0x3f1f41);}else if(_0x461953&&_0x461953[_0x1af1('0x14f')]){if(_0x3f1f41['cause']==='16'&&this[_0x1af1('0x6a')][_0x3f1f41[_0x1af1('0xc0')]][_0x1af1('0x76')]){logger[_0x1af1('0x68')]('[syncHangup][talking][transfer]',_0x3f1f41[_0x1af1('0xc0')],_0x3f1f41[_0x1af1('0x14c')],_0x1af1('0xb1'),_0x279d18[_0x1af1('0x4d')],_0x1af1('0x6d'),_0x279d18['pTalking']);this[_0x1af1('0x94')](_0x3f1f41,_0x3f1f41[_0x1af1('0xc0')],_0x3f1f41['cause']);}else if(this[_0x1af1('0x6a')][_0x3f1f41[_0x1af1('0xc0')]][_0x1af1('0x76')]){logger['info'](_0x1af1('0x150'),_0x3f1f41[_0x1af1('0xc0')],_0x3f1f41[_0x1af1('0x14c')],_0x1af1('0xb1'),_0x279d18[_0x1af1('0x4d')],_0x1af1('0x6d'),_0x279d18[_0x1af1('0x2a')]);this[_0x1af1('0x94')](_0x3f1f41,_0x3f1f41[_0x1af1('0xc0')],_0x3f1f41[_0x1af1('0x14c')]);}}};Preview[_0x1af1('0xc')][_0x1af1('0x1d')]=function(_0x19d1ae){if(this['actions'][_0x19d1ae['destlinkedid']]&&_0x19d1ae[_0x1af1('0xf8')]!==_0x19d1ae['destuniqueid']){this['callProgressDetectingCustomer'](_0x19d1ae,_0x19d1ae['destlinkedid'],_0x19d1ae[_0x1af1('0xec')]);}};Preview['prototype'][_0x1af1('0x1b')]=function(_0x22a19e){if(this[_0x1af1('0x6a')][_0x22a19e[_0x1af1('0xc0')]]&&_0x22a19e['linkedid']!==_0x22a19e['uniqueid']&&!this[_0x1af1('0x6a')][_0x22a19e[_0x1af1('0xc0')]][_0x1af1('0x76')]){if(_0x22a19e[_0x1af1('0x14c')]==='1'){this[_0x1af1('0x94')](_0x22a19e,_0x22a19e[_0x1af1('0xc0')],_0x22a19e[_0x1af1('0x14c')]);}}};Preview[_0x1af1('0xc')][_0x1af1('0x151')]=function(_0x36c62d,_0x2fcd9d,_0x43f3d9){if(this[_0x1af1('0x6a')][_0x36c62d]){if(_[_0x1af1('0x67')](this[_0x1af1('0x6a')][_0x36c62d][_0x1af1('0x152')])){this[_0x1af1('0x6a')][_0x36c62d]['variables']={};}this[_0x1af1('0x6a')][_0x36c62d]['variables'][_0x2fcd9d]=_0x43f3d9;}};Preview[_0x1af1('0xc')][_0x1af1('0x153')]=function(_0x36f063){try{if(!_[_0x1af1('0x67')](_0x36f063)){if(ut[_0x1af1('0x154')](_[_0x1af1('0x155')](_0x36f063['variable'])[0x0])){this[_0x1af1('0x151')](_0x36f063[_0x1af1('0xb0')],_[_0x1af1('0x155')](_0x36f063[_0x1af1('0x156')])[0x0],_0x36f063[_0x1af1('0x157')]);}}}catch(_0x1e332c){logger[_0x1af1('0x158')]('[syncVarSet][Preview]',util[_0x1af1('0x159')](_0x1e332c,{'showHidden':![],'depth':null}));}};Preview[_0x1af1('0xc')][_0x1af1('0x21')]=function(_0x383dff){if(_0x383dff){if(this[_0x1af1('0x6a')][_0x383dff[_0x1af1('0x15a')]]){this[_0x1af1('0x6a')][_0x383dff[_0x1af1('0x15a')]][_0x1af1('0x14f')]=!![];}}};Preview[_0x1af1('0xc')][_0x1af1('0x23')]=function(_0x2d8bcb){if(_0x2d8bcb){if(this[_0x1af1('0x6a')][_0x2d8bcb[_0x1af1('0x15b')]]){this[_0x1af1('0x6a')][_0x2d8bcb['transfererlinkedid']][_0x1af1('0x14f')]=!![];}}};module[_0x1af1('0x15c')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index c127a85..4b4eddb 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 _0xafbf=['../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue'];(function(_0x314bb5,_0x476e6a){var _0x32c85e=function(_0x52673d){while(--_0x52673d){_0x314bb5['push'](_0x314bb5['shift']());}};_0x32c85e(++_0x476e6a);}(_0xafbf,0x18f));var _0xfafb=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xafbf[_0x3947c9];return _0x2e7871;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0xfafb('0x0'))(_0xfafb('0x1'));var _=require(_0xfafb('0x2'));var cmHopper=require(_0xfafb('0x3'));var cmHopperFinal=require(_0xfafb('0x4'));var cmHopperHistory=require(_0xfafb('0x5'));var cmHopperBlack=require(_0xfafb('0x6'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xfafb('0x7'));var voiceQueueReport=require(_0xfafb('0x8'));function loggerCatch(_0x336cb5){return function(_0x4ccb77){logger[_0xfafb('0x9')](_0x336cb5,util[_0xfafb('0xa')](_0x4ccb77,{'showHidden':![],'depth':null}));};}function create(_0x485c95){return BPromise[_0xfafb('0xb')]()[_0xfafb('0xc')](cmHopperHistory[_0xfafb('0xd')](_0x485c95))[_0xfafb('0xe')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x1387df){return BPromise['resolve']()[_0xfafb('0xc')](agentReportPreview[_0xfafb('0xd')](_0x1387df))['catch'](loggerCatch(_0xfafb('0xf')));}function moveContact(_0x56148){return BPromise[_0xfafb('0xb')]()[_0xfafb('0xc')](cmHopper[_0xfafb('0x10')](_0x56148,!![]))['catch'](loggerCatch(_0xfafb('0x11')));}exports[_0xfafb('0x12')]=function(_0x285b8b){return BPromise[_0xfafb('0xb')]()[_0xfafb('0xc')](cmHopperBlack[_0xfafb('0x12')](_0x285b8b))[_0xfafb('0xe')](loggerCatch(_0xfafb('0x13')));};exports[_0xfafb('0x14')]=function(_0x2f11ed){return BPromise['resolve']()[_0xfafb('0xc')](cmHopper[_0xfafb('0x14')](_0x2f11ed))[_0xfafb('0xe')](loggerCatch(_0xfafb('0x15')));};exports[_0xfafb('0xd')]=function(_0x17b729,_0x11024f){create(_0x17b729)[_0xfafb('0xe')](loggerCatch(_0x11024f));moveContact(_0x17b729)[_0xfafb('0xe')](loggerCatch(_0x11024f));};exports[_0xfafb('0x16')]=function(_0x4a798e,_0x537ee6){createAgent(_0x4a798e)['catch'](loggerCatch(_0x537ee6));};exports[_0xfafb('0x17')]=function(_0x42f838,_0x5682f3){create(_0x42f838)[_0xfafb('0xe')](loggerCatch(_0x5682f3));};exports['createCustomerFinal']=function(_0x632ac4,_0x119e0f){moveContact(_0x632ac4)[_0xfafb('0xe')](loggerCatch(_0x119e0f));};exports[_0xfafb('0x18')]=function(_0x8058d,_0x40a26d,_0x264c7b){if(_0x40a26d){_0x8058d[_0xfafb('0x19')]=null;}if(_0x264c7b){_0x8058d[_0xfafb('0x1a')]=![];}return BPromise['resolve']()['then'](cmHopper[_0xfafb('0x18')](_0x8058d))[_0xfafb('0xe')](loggerCatch(_0xfafb('0x1b')));};exports['countReScheduled']=function(_0x168970){return BPromise[_0xfafb('0xb')]()[_0xfafb('0xc')](cmHopper[_0xfafb('0x1c')](_0x168970))[_0xfafb('0xe')](loggerCatch(_0xfafb('0x1d')));};exports[_0xfafb('0x1e')]=function(_0xceffe1){return BPromise[_0xfafb('0xb')]()['then'](cmHopper['unlockContact']({'UserId':null},_0xceffe1,0x1))[_0xfafb('0xe')](loggerCatch(_0xfafb('0x1f')));};exports['disableContact']=function(_0x42baa0){return BPromise[_0xfafb('0xb')]()[_0xfafb('0xc')](cmHopper['unlockContact']({'active':![]},_0x42baa0,0x1))['catch'](loggerCatch(_0xfafb('0x20')));};exports[_0xfafb('0x21')]=function(_0x4070d4){var _0x289296={};_0x289296[_0xfafb('0x22')]=_0x4070d4[_0xfafb('0x22')];_0x289296[_0xfafb('0x23')]=_0x4070d4[_0xfafb('0x23')];_0x289296[_0xfafb('0x24')]=_0x4070d4['calleridnum'];_0x289296[_0xfafb('0x25')]=_0x4070d4['calleridname'];_0x289296[_0xfafb('0x26')]=_0x4070d4[_0xfafb('0x26')];_0x289296[_0xfafb('0x27')]=_0x4070d4[_0xfafb('0x28')];_0x289296[_0xfafb('0x29')]=_0x4070d4[_0xfafb('0x28')];_0x289296[_0xfafb('0x2a')]=0x1;_0x289296[_0xfafb('0x2b')]=_0x4070d4['endtime'];_0x289296[_0xfafb('0x2c')]=_0x4070d4[_0xfafb('0x2d')];_0x289296[_0xfafb('0x2e')]=_0xfafb('0x2f');_0x289296[_0xfafb('0x30')]='xcally-motion-preview';_0x289296[_0xfafb('0x31')]=0x0;_0x289296[_0xfafb('0x32')]=0x1;_0x289296[_0xfafb('0x33')]=_0x4070d4[_0xfafb('0x2d')];_0x289296[_0xfafb('0x34')]=_0xfafb('0x35');return BPromise['resolve']()['then'](voiceQueueReport['create'](_0x289296))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports[_0xfafb('0x36')]=function(_0x2eef43,_0x4aa20b){return BPromise[_0xfafb('0xb')]()[_0xfafb('0xc')](cmHopper[_0xfafb('0x36')](_0x2eef43,_0x4aa20b))[_0xfafb('0xe')](loggerCatch(_0xfafb('0x37')));};exports[_0xfafb('0x38')]=function(_0x252efb){return BPromise['resolve']()[_0xfafb('0xc')](cmHopper['rescheduleContact'](_0x252efb,!![],!![]))[_0xfafb('0xe')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x7b21=['checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','endtime','membername','from-sip','exten','xcally-motion-preview','assigned','queuecallerexitreason','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer'];(function(_0x52666e,_0x5b3776){var _0x515330=function(_0x29cd4f){while(--_0x29cd4f){_0x52666e['push'](_0x52666e['shift']());}};_0x515330(++_0x5b3776);}(_0x7b21,0x18e));var _0x17b2=function(_0x1be444,_0x574435){_0x1be444=_0x1be444-0x0;var _0x28fd7a=_0x7b21[_0x1be444];return _0x28fd7a;};'use strict';var util=require(_0x17b2('0x0'));var BPromise=require('bluebird');var logger=require(_0x17b2('0x1'))(_0x17b2('0x2'));var _=require(_0x17b2('0x3'));var cmHopper=require(_0x17b2('0x4'));var cmHopperFinal=require(_0x17b2('0x5'));var cmHopperHistory=require(_0x17b2('0x6'));var cmHopperBlack=require(_0x17b2('0x7'));var voiceQueueRt=require(_0x17b2('0x8'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x17b2('0x9'));function loggerCatch(_0x50979d){return function(_0x401899){logger[_0x17b2('0xa')](_0x50979d,util[_0x17b2('0xb')](_0x401899,{'showHidden':![],'depth':null}));};}function create(_0x21a911){return BPromise[_0x17b2('0xc')]()[_0x17b2('0xd')](cmHopperHistory[_0x17b2('0xe')](_0x21a911))[_0x17b2('0xf')](loggerCatch(_0x17b2('0x10')));}function createAgent(_0x21f16d){return BPromise[_0x17b2('0xc')]()[_0x17b2('0xd')](agentReportPreview[_0x17b2('0xe')](_0x21f16d))[_0x17b2('0xf')](loggerCatch(_0x17b2('0x10')));}function moveContact(_0x59dee1){return BPromise[_0x17b2('0xc')]()[_0x17b2('0xd')](cmHopper[_0x17b2('0x11')](_0x59dee1,!![]))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports['checkIsBlackList']=function(_0x5a62f7){return BPromise[_0x17b2('0xc')]()[_0x17b2('0xd')](cmHopperBlack[_0x17b2('0x12')](_0x5a62f7))[_0x17b2('0xf')](loggerCatch(_0x17b2('0x13')));};exports[_0x17b2('0x14')]=function(_0x49d741){return BPromise['resolve']()[_0x17b2('0xd')](cmHopper[_0x17b2('0x14')](_0x49d741))[_0x17b2('0xf')](loggerCatch('[getContactPreview]\x20'));};exports[_0x17b2('0xe')]=function(_0x36f4ba,_0x49c353){create(_0x36f4ba)['catch'](loggerCatch(_0x49c353));moveContact(_0x36f4ba)[_0x17b2('0xf')](loggerCatch(_0x49c353));};exports[_0x17b2('0x15')]=function(_0x565eaf,_0x353dc4){createAgent(_0x565eaf)[_0x17b2('0xf')](loggerCatch(_0x353dc4));};exports[_0x17b2('0x16')]=function(_0x3b6e78,_0x444e1d){create(_0x3b6e78)[_0x17b2('0xf')](loggerCatch(_0x444e1d));};exports[_0x17b2('0x17')]=function(_0x2b15e1,_0x4c82e3){moveContact(_0x2b15e1)[_0x17b2('0xf')](loggerCatch(_0x4c82e3));};exports[_0x17b2('0x18')]=function(_0x1568ea,_0x3d51d1,_0x14d5ac){if(_0x3d51d1){_0x1568ea[_0x17b2('0x19')]=null;}if(_0x14d5ac){_0x1568ea[_0x17b2('0x1a')]=![];}return BPromise[_0x17b2('0xc')]()[_0x17b2('0xd')](cmHopper[_0x17b2('0x18')](_0x1568ea))[_0x17b2('0xf')](loggerCatch(_0x17b2('0x1b')));};exports[_0x17b2('0x1c')]=function(_0x19d84c){return BPromise[_0x17b2('0xc')]()[_0x17b2('0xd')](cmHopper[_0x17b2('0x1c')](_0x19d84c))[_0x17b2('0xf')](loggerCatch(_0x17b2('0x1d')));};exports[_0x17b2('0x1e')]=function(_0x52a532){return BPromise[_0x17b2('0xc')]()[_0x17b2('0xd')](cmHopper[_0x17b2('0x1e')]({'UserId':null},_0x52a532,0x1))['catch'](loggerCatch(_0x17b2('0x1f')));};exports[_0x17b2('0x20')]=function(_0x50f96f){return BPromise[_0x17b2('0xc')]()[_0x17b2('0xd')](cmHopper['unlockContact']({'active':![]},_0x50f96f,0x1))[_0x17b2('0xf')](loggerCatch(_0x17b2('0x21')));};exports['crateCustomerReportQueue']=function(_0x24f056){var _0x1e68a9={};_0x1e68a9[_0x17b2('0x22')]=_0x24f056[_0x17b2('0x22')];_0x1e68a9['uniqueid']=_0x24f056[_0x17b2('0x23')];_0x1e68a9[_0x17b2('0x24')]=_0x24f056[_0x17b2('0x24')];_0x1e68a9['calleridname']=_0x24f056[_0x17b2('0x25')];_0x1e68a9['queue']=_0x24f056[_0x17b2('0x26')];_0x1e68a9[_0x17b2('0x27')]=_0x24f056[_0x17b2('0x28')];_0x1e68a9[_0x17b2('0x29')]=_0x24f056[_0x17b2('0x28')];_0x1e68a9['queuecallercomplete']=0x1;_0x1e68a9['queuecallercompleteAt']=_0x24f056[_0x17b2('0x2a')];_0x1e68a9['connectedlinename']=_0x24f056[_0x17b2('0x2b')];_0x1e68a9['context']=_0x17b2('0x2c');_0x1e68a9[_0x17b2('0x2d')]=_0x17b2('0x2e');_0x1e68a9['holdtime']=0x0;_0x1e68a9[_0x17b2('0x2f')]=0x1;_0x1e68a9['lastAssignedTo']=_0x24f056[_0x17b2('0x2b')];_0x1e68a9[_0x17b2('0x30')]='COMPLETED';return BPromise[_0x17b2('0xc')]()[_0x17b2('0xd')](voiceQueueReport['create'](_0x1e68a9))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x17b2('0x31')]=function(_0x488983,_0x57943c){return BPromise[_0x17b2('0xc')]()[_0x17b2('0xd')](cmHopper[_0x17b2('0x31')](_0x488983,_0x57943c))[_0x17b2('0xf')](loggerCatch(_0x17b2('0x32')));};exports['rescheduleContactInQueue']=function(_0x26b26e){return BPromise['resolve']()[_0x17b2('0xd')](cmHopper[_0x17b2('0x18')](_0x26b26e,!![],!![]))[_0x17b2('0xf')](loggerCatch(_0x17b2('0x33')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 26c4cfe..fdc679c 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 _0xd76e=['[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','interface','channelAgent','motionChannel','voice','mandatoryDisposition','buildObj','uniqueid','agentReadyId','not_inuse','reachable','getDiff','seconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','membername','active','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-callerid','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosrtt','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','env','127.0.0.1','milliseconds','diff','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','%s%s','XMD-','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','state','Blacklist','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','statedesc','ringtime','logLookAgent','UserId','answertime','isFailure','Failure','variablesAction','BOOKED','originate','xcally-motion-preview','timeout','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','scheduledat','add','minutes','ListId','VoiceQueueId','pTalking'];(function(_0x130705,_0x2d266b){var _0x1fa991=function(_0x395639){while(--_0x395639){_0x130705['push'](_0x130705['shift']());}};_0x1fa991(++_0x2d266b);}(_0xd76e,0xcc));var _0xed76=function(_0x430d8f,_0x193631){_0x430d8f=_0x430d8f-0x0;var _0x40bf26=_0xd76e[_0x430d8f];return _0x40bf26;};'use strict';var util=require(_0xed76('0x0'));var _=require(_0xed76('0x1'));var moment=require(_0xed76('0x2'));var logger=require(_0xed76('0x3'))(_0xed76('0x4'));var ipAgi=process[_0xed76('0x5')]['XCALLY_IP_AGI']||_0xed76('0x6');function getSeconds(_0x980e01,_0x9023d1){var _0x133308=moment(_0x980e01)[_0xed76('0x7')](0x0);var _0x185b7f=moment(_0x9023d1)[_0xed76('0x7')](0x0);return _0x133308[_0xed76('0x8')](_0x185b7f,'seconds');}exports[_0xed76('0x9')]=function(_0xc0dbda){return function(_0x373421){logger[_0xed76('0xa')](_0xc0dbda,util[_0xed76('0xb')](_0x373421,{'showHidden':![],'depth':null}));};};exports[_0xed76('0xc')]=function(_0x31fa0b,_0x520f15){logger[_0xed76('0xd')](_0x31fa0b,util[_0xed76('0xb')](_0x520f15,{'showHidden':![],'depth':null}));};exports[_0xed76('0xe')]=function(_0x4d2b07,_0xc39c8d){logger[_0xed76('0xa')](_0x4d2b07,util[_0xed76('0xb')](_0xc39c8d,{'showHidden':![],'depth':null}));};exports[_0xed76('0xf')]=function(_0x2dd30b){return function(_0x2ff504){logger[_0xed76('0xd')](_0x2dd30b,util[_0xed76('0xb')](_0x2ff504,{'showHidden':![],'depth':null}));};};exports[_0xed76('0x10')]=function(_0x5552ce,_0x2664fc,_0x2e6e1d){return{'message':_0x5552ce,'unlock':_0x2664fc,'active':_0x2e6e1d};};exports[_0xed76('0x11')]=function(_0x493fa5,_0x23541a,_0x294227){if(!_[_0xed76('0x12')](_0x294227)&&_0xed76('0x13')===typeof _0x294227&&!_['isEmpty'](_0x294227)){if(!_['isUndefined'](_0x23541a)&&_0xed76('0x13')===typeof _0x23541a&&!_[_0xed76('0x14')](_0x23541a)){return util[_0xed76('0x15')](_0xed76('0x16'),_0x23541a,_0x294227);}return util['format'](_0xed76('0x16'),_0x294227,_0x294227);}if(!_[_0xed76('0x12')](_0x493fa5)&&'string'===typeof _0x493fa5&&!_[_0xed76('0x14')](_0x493fa5)){return _0x493fa5;}return'\x22\x22\x20<>';};exports[_0xed76('0x17')]=function(_0x547d15){if(_[_0xed76('0x18')](_0x547d15)){return![];}return _0x547d15;};exports[_0xed76('0x19')]=function(_0x579d95,_0x3479f3,_0x38d863,_0x42f776,_0x368709,_0x2974f5){var _0x190f4e={'XMD-QUEUE':_0x3479f3[_0xed76('0x1a')]?_0x3479f3['Queue'][_0xed76('0x1b')]:'','XMD-CALLERID':_0x42f776,'XMD-CALLERID-PREVIEW':_0x2974f5?util[_0xed76('0x15')](_0xed76('0x16'),_0x2974f5[_0xed76('0x1c')],_0x2974f5[_0xed76('0x1d')]):_0x42f776,'XMD-DIALID':_0x368709,'XMD-CONTACTID':_0x3479f3[_0xed76('0x1e')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x42f776,'XMD-VOICEQUEUEID':_0x3479f3['VoiceQueueId'],'XMD-DIALCHANNEL':_0x38d863,'XMD-DIALTIMEOUT':_0x579d95[_0xed76('0x1f')]||0x1e,'XMD-DIALOPTIONS':util[_0xed76('0x15')](_0xed76('0x20'),_0x579d95[_0xed76('0x21')]?'g':'',_[_0xed76('0x14')](_0x579d95[_0xed76('0x22')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x579d95[_0xed76('0x23')]||'','XMD-AGI':_0x579d95['dialQueueProject']?util[_0xed76('0x15')](_0xed76('0x24'),ipAgi,_0x579d95[_0xed76('0x25')]):'NONE','XMD-AGIAFTER':_0x579d95['dialQueueProject2']?util[_0xed76('0x15')](_0xed76('0x24'),ipAgi,_0x579d95[_0xed76('0x21')]):_0xed76('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x2974f5?_0x2974f5[_0xed76('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x2974f5?_0x2974f5[_0xed76('0x28')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0xed76('0x29')};if(!_['isEmpty'](_0x579d95[_0xed76('0x22')])){_0x190f4e[util['format']('%s',_0xed76('0x2a'))]=_0x579d95[_0xed76('0x22')];_0x190f4e[util[_0xed76('0x15')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x368709;}if(_0x3479f3&&_0x3479f3[_0xed76('0x2b')]){for(var _0x30351d in _0x3479f3['Contact']){if(_0x3479f3[_0xed76('0x2b')][_0xed76('0x2c')](_0x30351d)){if(!_[_0xed76('0x18')](_0x3479f3[_0xed76('0x2b')][_0x30351d])&&_0x30351d!=='id'&&_0x30351d!==_0xed76('0x2d')&&_0x30351d!=='createdAt'&&_0x30351d!=='updatedAt'){_0x190f4e[util[_0xed76('0x15')](_0xed76('0x2e'),_0xed76('0x2f'),_[_0xed76('0x30')](_0x30351d))]=_0x3479f3[_0xed76('0x2b')][_0x30351d];}}}}return _0x190f4e;};exports[_0xed76('0x31')]=function(_0x1b5b70){var _0x457344={};for(var _0x4540e3 in _0x1b5b70){if(_0x1b5b70[_0xed76('0x2c')](_0x4540e3)){_0x457344[util[_0xed76('0x15')]('%s',_['toLower'](_0x4540e3))]=_0x1b5b70[_0x4540e3];}}return{'variables':_0x457344};};exports[_0xed76('0x32')]=function(_0x120356,_0x511335){if(!_[_0xed76('0x18')](_0x120356)){if(_0x120356[_0xed76('0x2c')](_0xed76('0x33'))){if(_0x120356[_0xed76('0x33')]>0x0){_0x120356[_0xed76('0x33')]-=0x1;}else{logger['error'](_0xed76('0x34'),_0x511335);}}}else{logger[_0xed76('0xa')](_0xed76('0x35'),_0x511335);}};exports['logBlacklist']=function(_0x14cd3e){var _0x551386=moment()[_0xed76('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x14cd3e[_0xed76('0x36')]=0xd;_0x14cd3e['statedesc']=_0xed76('0x37');_0x14cd3e['starttime']=_0x551386;_0x14cd3e[_0xed76('0x38')]=_0x551386;_0x14cd3e[_0xed76('0x39')]=_0x551386;};exports[_0xed76('0x3a')]=function(_0x450512,_0x532e39,_0x428d33){var _0x5e8fd1=moment()[_0xed76('0x15')](_0xed76('0x3b'));_0x450512[_0xed76('0x36')]=_0x532e39;_0x450512[_0xed76('0x3c')]=_0x428d33;_0x450512['responsetime']=_0x5e8fd1;_0x450512[_0xed76('0x3d')]=getSeconds(_0x450512[_0xed76('0x38')],_0x450512['starttime']);};exports[_0xed76('0x3e')]=function(_0x1000a1,_0x13024f,_0x21dc6b){_0x1000a1['membername']=_0x13024f;_0x1000a1[_0xed76('0x3f')]=_0x21dc6b;};exports['logCustomer']=function(_0x5bad64,_0xe3cdae,_0x156155){var _0x18df77=moment()[_0xed76('0x15')](_0xed76('0x3b'));_0x5bad64[_0xed76('0x36')]=_0xe3cdae;_0x5bad64[_0xed76('0x3c')]=_0x156155;_0x5bad64[_0xed76('0x38')]=_0x5bad64[_0xed76('0x38')]?_0x5bad64[_0xed76('0x38')]:_0x18df77;_0x5bad64[_0xed76('0x39')]=_0x5bad64['endtime']?_0x5bad64[_0xed76('0x39')]:_0x18df77;_0x5bad64[_0xed76('0x3d')]=getSeconds(_0x5bad64[_0xed76('0x38')]||0x0,_0x5bad64['starttime']||0x0);_0x5bad64['talktime']=_0x5bad64['answertime']?getSeconds(_0x5bad64['endtime'],_0x5bad64[_0xed76('0x40')]):0x0;};exports[_0xed76('0x41')]=function(_0x443221){return _0x443221===_0xed76('0x42');};exports[_0xed76('0x43')]=function(_0x20f968,_0xc14bfc,_0x11ff02,_0x3abcd7,_0x7dead3){var _0x4b2d4a=_0x3abcd7?'RECALL':_0x20f968[_0xed76('0x1c')];_0x4b2d4a=_0x7dead3?_0xed76('0x44'):_0x4b2d4a;return{'actionid':_0x20f968['uniqueid'],'action':_0xed76('0x45'),'channel':_0x20f968['channelAgent'],'callerid':util[_0xed76('0x15')](_0xed76('0x16'),_0x4b2d4a,_0x20f968[_0xed76('0x1d')]),'Exten':_0xed76('0x46'),'Context':'from-sip','Priority':'1','variable':_0x11ff02,'timeout':(_0xc14bfc[_0xed76('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x20f968['uniqueid']};};exports['totalGlobal']=function(_0x2c05c5){return _0x2c05c5[_0xed76('0x48')]+_0x2c05c5[_0xed76('0x49')]+_0x2c05c5[_0xed76('0x4a')]+_0x2c05c5[_0xed76('0x4b')]+_0x2c05c5[_0xed76('0x4c')];};exports['cloneAction']=function(_0x2dc05c){var _0x253a06=_[_0xed76('0x4d')](_0x2dc05c);_0x253a06[_0xed76('0x36')]=0xf;_0x253a06['statedesc']=_0xed76('0x4e');return _0x253a06;};exports[_0xed76('0x4f')]=function(_0xfe6439,_0x2e589f,_0x3f2045){var _0x28db91={};_0x28db91[_0x2e589f]=_0xfe6439[_0x2e589f];_0x28db91['active']=![];_0x28db91[_0xed76('0x50')]=moment()[_0xed76('0x51')](_0x3f2045,_0xed76('0x52'))['format'](_0xed76('0x3b'));_0x28db91[_0xed76('0x1e')]=_0xfe6439['ContactId'];_0x28db91[_0xed76('0x53')]=_0xfe6439[_0xed76('0x53')];_0x28db91[_0xed76('0x54')]=_0xfe6439[_0xed76('0x54')]||undefined;return _0x28db91;};exports['decrementTalkink']=function(_0x4f96cd,_0x45b4bf){if(!_[_0xed76('0x18')](_0x4f96cd)){if(_0x4f96cd[_0xed76('0x55')]>0x0){_0x4f96cd['pTalking']-=0x1;}else{logger[_0xed76('0xa')](_0x45b4bf,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xed76('0xa')](_0x45b4bf,_0xed76('0x56'));}};exports[_0xed76('0x57')]=function(_0x19499b){if(_0x19499b<=0x0){return!![];}return![];};function buildObj(_0x45d0b4,_0x29cf5b,_0x1c4ac){_0x45d0b4['lastevent']=_0x29cf5b;_0x45d0b4['name']=_0x45d0b4[_0xed76('0x58')];_0x45d0b4[_0xed76('0x59')]=_0x45d0b4[_0xed76('0x5a')];_0x45d0b4[_0xed76('0x5b')]=_0xed76('0x5c');if(_0x1c4ac){_0x45d0b4[_0xed76('0x5d')]=_0x1c4ac[_0xed76('0x5d')];}return _0x45d0b4;}exports[_0xed76('0x5e')]=buildObj;exports['buildAcw']=function(_0x12ac88){var _0x1ee156={};_0x1ee156[_0xed76('0x58')]=_0x12ac88[_0xed76('0x58')];_0x1ee156['interface']=_0x12ac88[_0xed76('0x5a')];_0x1ee156[_0xed76('0x5f')]=_0x12ac88[_0xed76('0x5f')];return _0x1ee156;};exports[_0xed76('0x60')]=function(_0xf86efc){var _0x5bbca2=[];for(var _0x3b8770 in _0xf86efc){if(_0xf86efc[_0xed76('0x2c')](_0x3b8770)){if(!_[_0xed76('0x18')](_0xf86efc[_0x3b8770])&&_0xf86efc[_0x3b8770][_0xed76('0x36')]===_0xed76('0x61')&&_0xf86efc[_0x3b8770]['status']===_0xed76('0x62')){_0x5bbca2['push'](_0xf86efc[_0x3b8770]['id']);}}}return _0x5bbca2;};exports[_0xed76('0x63')]=function(_0x2e520b){var _0x155a49=moment()['milliseconds'](0x0);var _0x161fc5=moment(_0x2e520b)[_0xed76('0x7')](0x0);return _0x155a49['diff'](_0x161fc5,_0xed76('0x64'));};exports[_0xed76('0x65')]=function(_0x524d1d){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x524d1d['ContactId'],'ListId':_0x524d1d[_0xed76('0x53')],'VoiceQueueId':_0x524d1d[_0xed76('0x54')]||undefined,'CampaignId':_0x524d1d[_0xed76('0x66')]||undefined};};exports[_0xed76('0x67')]=function(_0x4689b8){if(_0x4689b8===_0xed76('0x5f')||_0x4689b8===_0xed76('0x68')||_0x4689b8==='queue'||_0x4689b8===_0xed76('0x69')||_0x4689b8===_0xed76('0x6a')||_0x4689b8===_0xed76('0x6b')||_0x4689b8===_0xed76('0x6c')||_0x4689b8==='channelAgent'||_0x4689b8==='calleridname'||_0x4689b8===_0xed76('0x6d')||_0x4689b8===_0xed76('0x1d')||_0x4689b8===_0xed76('0x50')||_0x4689b8===_0xed76('0x48')||_0x4689b8==='countcongestionretry'||_0x4689b8==='countnoanswerretry'||_0x4689b8==='countglobal'||_0x4689b8===_0xed76('0x6e')||_0x4689b8===_0xed76('0x6f')||_0x4689b8===_0xed76('0x70')||_0x4689b8===_0xed76('0x71')||_0x4689b8==='ContactId'||_0x4689b8===_0xed76('0x53')||_0x4689b8===_0xed76('0x3f')||_0x4689b8===_0xed76('0x54')||_0x4689b8===_0xed76('0x72')||_0x4689b8===_0xed76('0x73')||_0x4689b8==='xmd-queue'||_0x4689b8===_0xed76('0x74')||_0x4689b8===_0xed76('0x75')||_0x4689b8===_0xed76('0x76')||_0x4689b8===_0xed76('0x77')||_0x4689b8===_0xed76('0x78')||_0x4689b8===_0xed76('0x79')||_0x4689b8==='xmd-dialchannel'||_0x4689b8===_0xed76('0x7a')||_0x4689b8==='xmd-cdrtype'||_0x4689b8===_0xed76('0x7b')||_0x4689b8==='xmd-agiafter'||_0x4689b8==='xmd-agi'||_0x4689b8===_0xed76('0x7c')||_0x4689b8==='rtpaudioqosbridged'||_0x4689b8===_0xed76('0x7d')||_0x4689b8===_0xed76('0x7e')||_0x4689b8===_0xed76('0x7f')||_0x4689b8===_0xed76('0x80')||_0x4689b8==='rtpaudioqosrtt'||_0x4689b8===_0xed76('0x81')||_0x4689b8===_0xed76('0x7c')||_0x4689b8===_0xed76('0x82')||_0x4689b8==='rtpaudioqosjitter'||_0x4689b8===_0xed76('0x7e')||_0x4689b8==='rtpaudioqosloss'||_0x4689b8===_0xed76('0x80')||_0x4689b8===_0xed76('0x83')||_0x4689b8===_0xed76('0x81')||_0x4689b8===_0xed76('0x84')||_0x4689b8==='bridgepvtcallid'||_0x4689b8==='state'||_0x4689b8===_0xed76('0x3c')){return![];}return!![];};exports[_0xed76('0x85')]=function(_0x4c2891,_0x4102bd){var _0x4f09cb,_0x1dcf0b,_0x18b313;if(_0x4102bd<=0x0){_0x4102bd=0x1;}_0x4f09cb=new RegExp(_0xed76('0x86')+_0x4102bd+'}$');_0x1dcf0b=Math[_0xed76('0x87')](0xa,_0x4102bd-0x1);_0x18b313=Math[_0xed76('0x87')](0xa,_0x4102bd)-0x1;return util[_0xed76('0x15')]('%s',_[_0xed76('0x88')](_0x4c2891,_0x4f09cb,_[_0xed76('0x89')](_0x1dcf0b,_0x18b313)));};exports[_0xed76('0x8a')]=function(_0x6c3e2){var _0x4d8a7b=_0x6c3e2[_0xed76('0x8b')](/"(.*?)"/);return _0x4d8a7b?_0x4d8a7b[0x1]:_0x6c3e2;};exports[_0xed76('0x8c')]=function(_0x5e6ab2){var _0x4f022e=_0x5e6ab2[_0xed76('0x8b')](/<(.*?)>/);return _0x4f022e?_0x4f022e[0x1]:_0x5e6ab2;};function buildNoAnswerEventPayload(_0x23c4fd,_0x1a669a){var _0x211d37=buildObj(_0x23c4fd,_0xed76('0x8d'));if(!_[_0xed76('0x14')](_0x1a669a[_0xed76('0x8e')])){Object['keys'](_0x1a669a['variables'])['forEach'](function(_0x1533d8){_0x211d37[_0x1533d8[_0xed76('0x8f')]()]=_0x1a669a['variables'][_0x1533d8];});}return _0x211d37;}exports[_0xed76('0x90')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xbcb2=['rtpaudioqosjitter','rtpaudioqoslossbridged','pow','random','extractCalleridName','extractCalleridNumber','match','noanswer','variables','keys','buildNoAnswerEventPayload','util','lodash','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','error','inspect','logger','logger2','info','message','getCallerId','isUndefined','string','isEmpty','format','isActive','isNil','addVariables','Queue','name','\x22%s\x22\x20<%s>','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','Contact','tags','createdAt','updatedAt','%s%s','toUpper','toLower','updateOriginated','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','logAgent','ringtime','logLookAgent','endtime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','channelAgent','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','scheduledAt','active','add','minutes','ListId','VoiceQueueId','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','queue','interface','agentReadyId','not_inuse','status','push','getDiff','CampaignId','filterKey','type','campaigntype','dialAnswer','membername','scheduledat','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbcb2,0x1af));var _0x2bcb=function(_0x304189,_0x377e9e){_0x304189=_0x304189-0x0;var _0x5cc413=_0xbcb2[_0x304189];return _0x5cc413;};'use strict';var util=require(_0x2bcb('0x0'));var _=require(_0x2bcb('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x2bcb('0x2'));var ipAgi=process[_0x2bcb('0x3')][_0x2bcb('0x4')]||_0x2bcb('0x5');function getSeconds(_0x122508,_0x480936){var _0x2707f4=moment(_0x122508)[_0x2bcb('0x6')](0x0);var _0x69742=moment(_0x480936)['milliseconds'](0x0);return _0x2707f4[_0x2bcb('0x7')](_0x69742,_0x2bcb('0x8'));}exports['loggerCatch']=function(_0x37c116){return function(_0x21440a){logger[_0x2bcb('0x9')](_0x37c116,util[_0x2bcb('0xa')](_0x21440a,{'showHidden':![],'depth':null}));};};exports[_0x2bcb('0xb')]=function(_0x15ead7,_0x48f475){logger['info'](_0x15ead7,util[_0x2bcb('0xa')](_0x48f475,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x35ab68,_0x323072){logger['error'](_0x35ab68,util['inspect'](_0x323072,{'showHidden':![],'depth':null}));};exports[_0x2bcb('0xc')]=function(_0x39e819){return function(_0xc92292){logger[_0x2bcb('0xd')](_0x39e819,util[_0x2bcb('0xa')](_0xc92292,{'showHidden':![],'depth':null}));};};exports[_0x2bcb('0xe')]=function(_0x53af24,_0x134033,_0x302869){return{'message':_0x53af24,'unlock':_0x134033,'active':_0x302869};};exports[_0x2bcb('0xf')]=function(_0x25c0ae,_0x25184a,_0x57e6c7){if(!_[_0x2bcb('0x10')](_0x57e6c7)&&_0x2bcb('0x11')===typeof _0x57e6c7&&!_[_0x2bcb('0x12')](_0x57e6c7)){if(!_['isUndefined'](_0x25184a)&&_0x2bcb('0x11')===typeof _0x25184a&&!_[_0x2bcb('0x12')](_0x25184a)){return util[_0x2bcb('0x13')]('\x22%s\x22\x20<%s>',_0x25184a,_0x57e6c7);}return util[_0x2bcb('0x13')]('\x22%s\x22\x20<%s>',_0x57e6c7,_0x57e6c7);}if(!_[_0x2bcb('0x10')](_0x25c0ae)&&_0x2bcb('0x11')===typeof _0x25c0ae&&!_[_0x2bcb('0x12')](_0x25c0ae)){return _0x25c0ae;}return'\x22\x22\x20<>';};exports[_0x2bcb('0x14')]=function(_0x53b5ea){if(_[_0x2bcb('0x15')](_0x53b5ea)){return![];}return _0x53b5ea;};exports[_0x2bcb('0x16')]=function(_0x2e4ae4,_0x583249,_0x13f06c,_0x1c979d,_0xb02d40,_0x5bf7c7){var _0x2b0564={'XMD-QUEUE':_0x583249['Queue']?_0x583249[_0x2bcb('0x17')][_0x2bcb('0x18')]:'','XMD-CALLERID':_0x1c979d,'XMD-CALLERID-PREVIEW':_0x5bf7c7?util['format'](_0x2bcb('0x19'),_0x5bf7c7[_0x2bcb('0x1a')],_0x5bf7c7[_0x2bcb('0x1b')]):_0x1c979d,'XMD-DIALID':_0xb02d40,'XMD-CONTACTID':_0x583249[_0x2bcb('0x1c')],'XMD-CDRTYPE':_0x2bcb('0x1d'),'CALLERID(all)':_0x1c979d,'XMD-VOICEQUEUEID':_0x583249['VoiceQueueId'],'XMD-DIALCHANNEL':_0x13f06c,'XMD-DIALTIMEOUT':_0x2e4ae4[_0x2bcb('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x2bcb('0x13')](_0x2bcb('0x1f'),_0x2e4ae4[_0x2bcb('0x20')]?'g':'',_[_0x2bcb('0x12')](_0x2e4ae4['monitor_format'])?'':_0x2bcb('0x21')),'XMD-DIALURL':_0x2e4ae4[_0x2bcb('0x22')]||'','XMD-AGI':_0x2e4ae4[_0x2bcb('0x23')]?util[_0x2bcb('0x13')](_0x2bcb('0x24'),ipAgi,_0x2e4ae4[_0x2bcb('0x23')]):_0x2bcb('0x25'),'XMD-AGIAFTER':_0x2e4ae4[_0x2bcb('0x20')]?util[_0x2bcb('0x13')](_0x2bcb('0x24'),ipAgi,_0x2e4ae4[_0x2bcb('0x20')]):_0x2bcb('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x5bf7c7?_0x5bf7c7[_0x2bcb('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x5bf7c7?_0x5bf7c7[_0x2bcb('0x27')]:'','XMD-DESTINATION':_0x2bcb('0x28'),'SIPADDHEADER':_0x2bcb('0x29')};if(!_[_0x2bcb('0x12')](_0x2e4ae4[_0x2bcb('0x2a')])){_0x2b0564[util[_0x2bcb('0x13')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x2e4ae4[_0x2bcb('0x2a')];_0x2b0564[util[_0x2bcb('0x13')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0xb02d40;}if(_0x583249&&_0x583249[_0x2bcb('0x2b')]){for(var _0x344e16 in _0x583249['Contact']){if(_0x583249[_0x2bcb('0x2b')]['hasOwnProperty'](_0x344e16)){if(!_[_0x2bcb('0x15')](_0x583249[_0x2bcb('0x2b')][_0x344e16])&&_0x344e16!=='id'&&_0x344e16!==_0x2bcb('0x2c')&&_0x344e16!==_0x2bcb('0x2d')&&_0x344e16!==_0x2bcb('0x2e')){_0x2b0564[util[_0x2bcb('0x13')](_0x2bcb('0x2f'),'XMD-',_[_0x2bcb('0x30')](_0x344e16))]=_0x583249['Contact'][_0x344e16];}}}}return _0x2b0564;};exports['toLowerVariables']=function(_0x339410){var _0x47627c={};for(var _0x587adb in _0x339410){if(_0x339410['hasOwnProperty'](_0x587adb)){_0x47627c[util[_0x2bcb('0x13')]('%s',_[_0x2bcb('0x31')](_0x587adb))]=_0x339410[_0x587adb];}}return{'variables':_0x47627c};};exports[_0x2bcb('0x32')]=function(_0xc8ff7b,_0x35b904){if(!_[_0x2bcb('0x15')](_0xc8ff7b)){if(_0xc8ff7b[_0x2bcb('0x33')](_0x2bcb('0x34'))){if(_0xc8ff7b[_0x2bcb('0x34')]>0x0){_0xc8ff7b[_0x2bcb('0x34')]-=0x1;}else{logger['error'](_0x2bcb('0x35'),_0x35b904);}}}else{logger[_0x2bcb('0x9')](_0x2bcb('0x36'),_0x35b904);}};exports['logBlacklist']=function(_0x16aa33){var _0x38cdeb=moment()[_0x2bcb('0x13')](_0x2bcb('0x37'));_0x16aa33[_0x2bcb('0x38')]=0xd;_0x16aa33[_0x2bcb('0x39')]=_0x2bcb('0x3a');_0x16aa33[_0x2bcb('0x3b')]=_0x38cdeb;_0x16aa33[_0x2bcb('0x3c')]=_0x38cdeb;_0x16aa33['endtime']=_0x38cdeb;};exports[_0x2bcb('0x3d')]=function(_0x56a4ba,_0x27c5e2,_0x4e7356){var _0x3ae546=moment()[_0x2bcb('0x13')](_0x2bcb('0x37'));_0x56a4ba[_0x2bcb('0x38')]=_0x27c5e2;_0x56a4ba[_0x2bcb('0x39')]=_0x4e7356;_0x56a4ba['responsetime']=_0x3ae546;_0x56a4ba[_0x2bcb('0x3e')]=getSeconds(_0x56a4ba[_0x2bcb('0x3c')],_0x56a4ba[_0x2bcb('0x3b')]);};exports[_0x2bcb('0x3f')]=function(_0xa5cdcb,_0x185ad7,_0xd6733d){_0xa5cdcb['membername']=_0x185ad7;_0xa5cdcb['UserId']=_0xd6733d;};exports['logCustomer']=function(_0x40b0c0,_0x162eb5,_0x4d2953){var _0x2c2d69=moment()[_0x2bcb('0x13')](_0x2bcb('0x37'));_0x40b0c0['state']=_0x162eb5;_0x40b0c0[_0x2bcb('0x39')]=_0x4d2953;_0x40b0c0[_0x2bcb('0x3c')]=_0x40b0c0[_0x2bcb('0x3c')]?_0x40b0c0['responsetime']:_0x2c2d69;_0x40b0c0[_0x2bcb('0x40')]=_0x40b0c0[_0x2bcb('0x40')]?_0x40b0c0[_0x2bcb('0x40')]:_0x2c2d69;_0x40b0c0['ringtime']=getSeconds(_0x40b0c0[_0x2bcb('0x3c')]||0x0,_0x40b0c0[_0x2bcb('0x3b')]||0x0);_0x40b0c0['talktime']=_0x40b0c0[_0x2bcb('0x41')]?getSeconds(_0x40b0c0['endtime'],_0x40b0c0[_0x2bcb('0x41')]):0x0;};exports[_0x2bcb('0x42')]=function(_0x14d1ad){return _0x14d1ad===_0x2bcb('0x43');};exports['variablesAction']=function(_0x1a3584,_0x582612,_0x558174,_0x3c0a97,_0x351020){var _0x4f5de8=_0x3c0a97?_0x2bcb('0x44'):_0x1a3584[_0x2bcb('0x1a')];_0x4f5de8=_0x351020?_0x2bcb('0x45'):_0x4f5de8;return{'actionid':_0x1a3584[_0x2bcb('0x46')],'action':'originate','channel':_0x1a3584[_0x2bcb('0x47')],'callerid':util[_0x2bcb('0x13')](_0x2bcb('0x19'),_0x4f5de8,_0x1a3584[_0x2bcb('0x1b')]),'Exten':_0x2bcb('0x28'),'Context':_0x2bcb('0x48'),'Priority':'1','variable':_0x558174,'timeout':(_0x582612['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1a3584[_0x2bcb('0x46')]};};exports[_0x2bcb('0x49')]=function(_0x126ff7){return _0x126ff7[_0x2bcb('0x4a')]+_0x126ff7[_0x2bcb('0x4b')]+_0x126ff7[_0x2bcb('0x4c')]+_0x126ff7[_0x2bcb('0x4d')]+_0x126ff7['countnosuchnumberretry'];};exports[_0x2bcb('0x4e')]=function(_0x46ed92){var _0x5206a9=_['clone'](_0x46ed92);_0x5206a9[_0x2bcb('0x38')]=0xf;_0x5206a9['statedesc']='Global';return _0x5206a9;};exports[_0x2bcb('0x4f')]=function(_0x147534,_0x2d94ce,_0xafce21){var _0xb9dfc7={};_0xb9dfc7[_0x2d94ce]=_0x147534[_0x2d94ce];_0xb9dfc7[_0x2bcb('0x50')]=![];_0xb9dfc7['scheduledat']=moment()[_0x2bcb('0x51')](_0xafce21,_0x2bcb('0x52'))[_0x2bcb('0x13')](_0x2bcb('0x37'));_0xb9dfc7['ContactId']=_0x147534[_0x2bcb('0x1c')];_0xb9dfc7[_0x2bcb('0x53')]=_0x147534['ListId'];_0xb9dfc7[_0x2bcb('0x54')]=_0x147534[_0x2bcb('0x54')]||undefined;return _0xb9dfc7;};exports['decrementTalkink']=function(_0x319e3f,_0x5ae4ca){if(!_[_0x2bcb('0x15')](_0x319e3f)){if(_0x319e3f[_0x2bcb('0x55')]>0x0){_0x319e3f[_0x2bcb('0x55')]-=0x1;}else{logger[_0x2bcb('0x9')](_0x5ae4ca,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x2bcb('0x9')](_0x5ae4ca,_0x2bcb('0x56'));}};exports[_0x2bcb('0x57')]=function(_0x22ef3f){if(_0x22ef3f<=0x0){return!![];}return![];};function buildObj(_0x23b431,_0x32f477,_0x3666fa){_0x23b431['lastevent']=_0x32f477;_0x23b431[_0x2bcb('0x18')]=_0x23b431['queue'];_0x23b431['interface']=_0x23b431['channelAgent'];_0x23b431[_0x2bcb('0x58')]=_0x2bcb('0x59');if(_0x3666fa){_0x23b431[_0x2bcb('0x5a')]=_0x3666fa[_0x2bcb('0x5a')];}return _0x23b431;}exports[_0x2bcb('0x5b')]=buildObj;exports[_0x2bcb('0x5c')]=function(_0x1dadb6){var _0x11baa3={};_0x11baa3[_0x2bcb('0x5d')]=_0x1dadb6[_0x2bcb('0x5d')];_0x11baa3[_0x2bcb('0x5e')]=_0x1dadb6[_0x2bcb('0x47')];_0x11baa3[_0x2bcb('0x46')]=_0x1dadb6[_0x2bcb('0x46')];return _0x11baa3;};exports[_0x2bcb('0x5f')]=function(_0x4431e6){var _0xcdcf68=[];for(var _0x2509ed in _0x4431e6){if(_0x4431e6[_0x2bcb('0x33')](_0x2509ed)){if(!_[_0x2bcb('0x15')](_0x4431e6[_0x2509ed])&&_0x4431e6[_0x2509ed][_0x2bcb('0x38')]===_0x2bcb('0x60')&&_0x4431e6[_0x2509ed][_0x2bcb('0x61')]==='reachable'){_0xcdcf68[_0x2bcb('0x62')](_0x4431e6[_0x2509ed]['id']);}}}return _0xcdcf68;};exports[_0x2bcb('0x63')]=function(_0x46e783){var _0x391a8a=moment()[_0x2bcb('0x6')](0x0);var _0x35a310=moment(_0x46e783)[_0x2bcb('0x6')](0x0);return _0x391a8a['diff'](_0x35a310,_0x2bcb('0x8'));};exports['createBody']=function(_0x1b5565){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1b5565[_0x2bcb('0x1c')],'ListId':_0x1b5565[_0x2bcb('0x53')],'VoiceQueueId':_0x1b5565['VoiceQueueId']||undefined,'CampaignId':_0x1b5565[_0x2bcb('0x64')]||undefined};};exports[_0x2bcb('0x65')]=function(_0x41bf60){if(_0x41bf60==='uniqueid'||_0x41bf60==='idContact'||_0x41bf60===_0x2bcb('0x5d')||_0x41bf60===_0x2bcb('0x66')||_0x41bf60===_0x2bcb('0x67')||_0x41bf60===_0x2bcb('0x68')||_0x41bf60===_0x2bcb('0x69')||_0x41bf60==='channelAgent'||_0x41bf60===_0x2bcb('0x1a')||_0x41bf60===_0x2bcb('0x50')||_0x41bf60===_0x2bcb('0x1b')||_0x41bf60===_0x2bcb('0x6a')||_0x41bf60===_0x2bcb('0x4a')||_0x41bf60===_0x2bcb('0x4b')||_0x41bf60===_0x2bcb('0x4c')||_0x41bf60===_0x2bcb('0x6b')||_0x41bf60===_0x2bcb('0x6c')||_0x41bf60===_0x2bcb('0x6d')||_0x41bf60===_0x2bcb('0x6e')||_0x41bf60===_0x2bcb('0x6f')||_0x41bf60===_0x2bcb('0x1c')||_0x41bf60===_0x2bcb('0x53')||_0x41bf60===_0x2bcb('0x70')||_0x41bf60==='VoiceQueueId'||_0x41bf60===_0x2bcb('0x71')||_0x41bf60===_0x2bcb('0x72')||_0x41bf60===_0x2bcb('0x73')||_0x41bf60==='xmd-phone'||_0x41bf60===_0x2bcb('0x74')||_0x41bf60==='xmd-dialurl'||_0x41bf60==='xmd-dialtimeout'||_0x41bf60==='xmd-dialoptions'||_0x41bf60===_0x2bcb('0x75')||_0x41bf60===_0x2bcb('0x76')||_0x41bf60===_0x2bcb('0x77')||_0x41bf60===_0x2bcb('0x78')||_0x41bf60==='xmd-callerid'||_0x41bf60===_0x2bcb('0x79')||_0x41bf60===_0x2bcb('0x7a')||_0x41bf60===_0x2bcb('0x7b')||_0x41bf60===_0x2bcb('0x7c')||_0x41bf60==='rtpaudioqosjitter'||_0x41bf60===_0x2bcb('0x7d')||_0x41bf60===_0x2bcb('0x7e')||_0x41bf60==='rtpaudioqoslossbridged'||_0x41bf60===_0x2bcb('0x7f')||_0x41bf60===_0x2bcb('0x80')||_0x41bf60===_0x2bcb('0x7b')||_0x41bf60===_0x2bcb('0x7c')||_0x41bf60===_0x2bcb('0x81')||_0x41bf60===_0x2bcb('0x7d')||_0x41bf60==='rtpaudioqosloss'||_0x41bf60===_0x2bcb('0x82')||_0x41bf60===_0x2bcb('0x7f')||_0x41bf60===_0x2bcb('0x80')||_0x41bf60==='bridgepeer'||_0x41bf60==='bridgepvtcallid'||_0x41bf60===_0x2bcb('0x38')||_0x41bf60==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x13b7fc,_0x259501){var _0x3b6024,_0x153ba0,_0x4afa2d;if(_0x259501<=0x0){_0x259501=0x1;}_0x3b6024=new RegExp('\x5cw{0,'+_0x259501+'}$');_0x153ba0=Math[_0x2bcb('0x83')](0xa,_0x259501-0x1);_0x4afa2d=Math['pow'](0xa,_0x259501)-0x1;return util[_0x2bcb('0x13')]('%s',_['replace'](_0x13b7fc,_0x3b6024,_[_0x2bcb('0x84')](_0x153ba0,_0x4afa2d)));};exports[_0x2bcb('0x85')]=function(_0x59e315){var _0x4ad966=_0x59e315['match'](/"(.*?)"/);return _0x4ad966?_0x4ad966[0x1]:_0x59e315;};exports[_0x2bcb('0x86')]=function(_0x4bcc8d){var _0xdd9f86=_0x4bcc8d[_0x2bcb('0x87')](/<(.*?)>/);return _0xdd9f86?_0xdd9f86[0x1]:_0x4bcc8d;};function buildNoAnswerEventPayload(_0x6846ac,_0x1b20df){var _0xfcd370=buildObj(_0x6846ac,_0x2bcb('0x88'));if(!_[_0x2bcb('0x12')](_0x1b20df[_0x2bcb('0x89')])){Object[_0x2bcb('0x8a')](_0x1b20df['variables'])['forEach'](function(_0x142653){_0xfcd370[_0x142653['toLowerCase']()]=_0x1b20df[_0x2bcb('0x89')][_0x142653];});}return _0xfcd370;}exports[_0x2bcb('0x8b')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 846ee00..79c75e9 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 _0xc5ad=['voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','queuepause','boolean','reload','voicequeuechannel','voicechannel'];(function(_0x2648a3,_0x434923){var _0x394969=function(_0x282692){while(--_0x282692){_0x2648a3['push'](_0x2648a3['shift']());}};_0x394969(++_0x434923);}(_0xc5ad,0x6e));var _0xdc5a=function(_0x2016c6,_0xd527dd){_0x2016c6=_0x2016c6-0x0;var _0x2c5dea=_0xc5ad[_0x2016c6];return _0x2c5dea;};'use strict';exports[_0xdc5a('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xdc5a('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':'string','required':!![]},'interface':{'type':_0xdc5a('0x1'),'required':!![]}};exports[_0xdc5a('0x2')]={'interface':{'type':_0xdc5a('0x1'),'required':!![]},'paused':{'type':_0xdc5a('0x3')},'reason':{'type':_0xdc5a('0x1'),'required':![]}};exports[_0xdc5a('0x4')]={'module':{'type':_0xdc5a('0x1'),'required':![]}};exports[_0xdc5a('0x5')]={'uniqueid':{'type':_0xdc5a('0x1'),'required':!![]}};exports[_0xdc5a('0x6')]={'uniqueid':{'type':_0xdc5a('0x1'),'required':!![]},'filename':{'type':_0xdc5a('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xdc5a('0x1')}};exports[_0xdc5a('0x7')]={'uniqueid':{'type':_0xdc5a('0x1'),'required':!![]}};exports[_0xdc5a('0x8')]={'uniqueid':{'type':_0xdc5a('0x1'),'required':!![]},'exten':{'type':_0xdc5a('0x1'),'required':!![]},'context':{'type':_0xdc5a('0x1')}}; \ No newline at end of file +var _0x5229=['string','boolean','queueremove','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd'];(function(_0x35247a,_0x235724){var _0xe973cc=function(_0x242287){while(--_0x242287){_0x35247a['push'](_0x35247a['shift']());}};_0xe973cc(++_0x235724);}(_0x5229,0x8f));var _0x9522=function(_0x3b7615,_0x566832){_0x3b7615=_0x3b7615-0x0;var _0x1ee9e4=_0x5229[_0x3b7615];return _0x1ee9e4;};'use strict';exports[_0x9522('0x0')]={'queue':{'type':_0x9522('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x9522('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x9522('0x2'),'required':![]}};exports[_0x9522('0x3')]={'queue':{'type':_0x9522('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x9522('0x4')]={'interface':{'type':_0x9522('0x1'),'required':!![]},'paused':{'type':_0x9522('0x2')},'reason':{'type':_0x9522('0x1'),'required':![]}};exports[_0x9522('0x5')]={'module':{'type':_0x9522('0x1'),'required':![]}};exports[_0x9522('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x9522('0x1'),'required':!![]},'filename':{'type':_0x9522('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x9522('0x7')]={'uniqueid':{'type':_0x9522('0x1'),'required':!![]}};exports[_0x9522('0x8')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x9522('0x1'),'required':!![]},'context':{'type':_0x9522('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 02f6962..699afc1 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 _0xdb28=['initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks'];(function(_0x2d26d5,_0x2dea30){var _0x2df9c1=function(_0x32cf5c){while(--_0x32cf5c){_0x2d26d5['push'](_0x2d26d5['shift']());}};_0x2df9c1(++_0x2dea30);}(_0xdb28,0x106));var _0x8db2=function(_0x56c418,_0x1562ec){_0x56c418=_0x56c418-0x0;var _0x4d2f44=_0xdb28[_0x56c418];return _0x4d2f44;};'use strict';var _=require(_0x8db2('0x0'));var moment=require(_0x8db2('0x1'));var util=require(_0x8db2('0x2'));var Agent=require(_0x8db2('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x8db2('0x4'));var VoiceQueue=require(_0x8db2('0x5'));var Trigger=require(_0x8db2('0x6'));var Template=require(_0x8db2('0x7'));var Campaign=require(_0x8db2('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x8db2('0x9'));var SalesforceAccount=require(_0x8db2('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x8db2('0xb'));var DeskAccount=require(_0x8db2('0xc'));var VtigerAccount=require(_0x8db2('0xd'));var ServicenowAccount=require(_0x8db2('0xe'));var Dynamics365Account=require(_0x8db2('0xf'));var FreshsalesAccount=require(_0x8db2('0x10'));var FaxAccount=require(_0x8db2('0x11'));function Realtime(){this['agents']={};this[_0x8db2('0x12')]={};this[_0x8db2('0x13')]={};this[_0x8db2('0x14')]={};this['triggers']={};this[_0x8db2('0x15')]={};this[_0x8db2('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8db2('0x17')]={};this[_0x8db2('0x18')]={};this[_0x8db2('0x19')]={};this[_0x8db2('0x1a')]={};this[_0x8db2('0x1b')]={};this['settings']={};this['zendeskAccounts']={};this[_0x8db2('0x1c')]={};this[_0x8db2('0x1d')]={};this[_0x8db2('0x1e')]={};this[_0x8db2('0x1f')]={};this[_0x8db2('0x20')]={};this[_0x8db2('0x21')]={};this[_0x8db2('0x22')]={};this[_0x8db2('0x23')]={};this[_0x8db2('0x24')]={};this[_0x8db2('0x25')]={};}function freeIsNotKey(_0x5489a9,_0x13b0f5,_0x24da1b){var _0x48101e=_[_0x8db2('0x26')](_0x5489a9,function(_0x44957d){return _0x44957d[_0x24da1b];});for(var _0x21db8c in _0x13b0f5){if(_0x13b0f5[_0x8db2('0x27')](_0x21db8c)){if(!_0x48101e[_0x21db8c]){delete _0x13b0f5[_0x21db8c];}}}}function freeIsNotKeySip(_0x2efd06,_0x46ce14){var _0x51d60d=_['mapKeys'](_0x2efd06,function(_0x77789){return util[_0x8db2('0x28')](_0x8db2('0x29'),_0x77789[_0x8db2('0x2a')]);});for(var _0x58562e in _0x46ce14){if(_0x46ce14[_0x8db2('0x27')](_0x58562e)){if(!_0x51d60d[_0x58562e]){delete _0x46ce14[_0x58562e];}}}}function freeIsNotKeyAgent(_0x36a9ff,_0x260940){var _0x297ba3=_[_0x8db2('0x26')](_0x36a9ff,function(_0x597260){var _0x124467=_[_0x8db2('0x2b')](_0x597260[_0x8db2('0x2c')])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x597260[_0x8db2('0x2a')]):_0x597260[_0x8db2('0x2c')];return _0x124467;});for(var _0x5c6614 in _0x260940){if(_0x260940[_0x8db2('0x27')](_0x5c6614)){if(!_0x297ba3[_0x5c6614]){delete _0x260940[_0x5c6614];}}}}function clearVoiceCallReports(_0x4f6516){_0x4f6516['total']=0x0;_0x4f6516['answered']=0x0;_0x4f6516['sumHoldTime']=0x0;_0x4f6516[_0x8db2('0x2d')]=0x0;_0x4f6516[_0x8db2('0x2e')]=0x0;}function clearCampaigns(_0x3be281){if(!_[_0x8db2('0x2f')](_0x3be281)){for(var _0x145328 in _0x3be281){if(_0x3be281[_0x8db2('0x27')](_0x145328)){_0x3be281[_0x145328]['ivrTotalCallsDays']=0x0;_0x3be281[_0x145328][_0x8db2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x372311){if(!_[_0x8db2('0x2f')](_0x372311)){for(var _0x8b7cec in _0x372311){if(_0x372311['hasOwnProperty'](_0x8b7cec)){_0x372311[_0x8b7cec][_0x8db2('0x31')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x32')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x33')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x34')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x35')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2e')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x37')]=0x0;_0x372311[_0x8b7cec]['outboundBusyCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x38')]=0x0;_0x372311[_0x8b7cec]['outboundNoSuchCallsDay']=0x0;_0x372311[_0x8b7cec]['outboundUnknownCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x39')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3a')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3b')]=0x0;_0x372311[_0x8b7cec]['outboundOriginateFailureCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3c')]=0x0;_0x372311[_0x8b7cec]['outboundReCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3e')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x35d337,_0x1a460b){for(var _0x4df530 in _0x1a460b){if(_0x35d337['hasOwnProperty'](_0x4df530)){_0x35d337[_0x4df530]=_0x1a460b[_0x4df530];}}};Realtime[_0x8db2('0x3f')][_0x8db2('0x40')]=function(){var _0xc884a=this;return function(_0x2a2d65){if(_0x2a2d65){freeIsNotKeyAgent(_0x2a2d65,_0xc884a[_0x8db2('0x41')]);for(var _0xd39848=0x0,_0x101711={};_0xd39848<_0x2a2d65[_0x8db2('0x42')];_0xd39848+=0x1){_0x101711=_0x2a2d65[_0xd39848];var _0x46e0c8=_[_0x8db2('0x2b')](_0x101711['interface'])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x101711['name']):_0x101711[_0x8db2('0x2c')];if(_[_0x8db2('0x43')](_0xc884a['agents'][_0x46e0c8])){_0xc884a['agents'][_0x46e0c8]=new Agent(_0x101711);}else{_0xc884a[_0x8db2('0x44')](_0xc884a['agents'][_0x46e0c8],_0x101711);}}}return _0xc884a[_0x8db2('0x41')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x45')]=function(){var _0x22c896=this;return function(_0x5cc419){if(_0x5cc419){freeIsNotKeySip(_0x5cc419,_0x22c896[_0x8db2('0x12')]);for(var _0x5e34e0=0x0,_0x227a08={};_0x5e34e0<_0x5cc419[_0x8db2('0x42')];_0x5e34e0+=0x1){_0x227a08=_0x5cc419[_0x5e34e0];if(_[_0x8db2('0x43')](_0x22c896[_0x8db2('0x12')][util['format']('SIP/%s',_0x227a08[_0x8db2('0x2a')])])){_0x22c896[_0x8db2('0x12')][util['format'](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])]=new Telephone(_0x227a08);}else{_0x22c896[_0x8db2('0x44')](_0x22c896['telephones'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])],_0x227a08);}}}return _0x22c896[_0x8db2('0x12')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x46')]=function(){var _0x380046=this;return function(_0x1575ea){if(_0x1575ea){freeIsNotKeySip(_0x1575ea,_0x380046[_0x8db2('0x13')]);for(var _0x63c561=0x0,_0x21cf7c={};_0x63c561<_0x1575ea[_0x8db2('0x42')];_0x63c561+=0x1){_0x21cf7c=_0x1575ea[_0x63c561];if(_[_0x8db2('0x43')](_0x380046['trunks'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c['name'])])){_0x380046['trunks'][util[_0x8db2('0x28')]('SIP/%s',_0x21cf7c[_0x8db2('0x2a')])]=new Trunk(_0x21cf7c);}else{_0x380046[_0x8db2('0x44')](_0x380046[_0x8db2('0x13')][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c[_0x8db2('0x2a')])],_0x21cf7c);}}}return _0x380046[_0x8db2('0x13')];};};Realtime['prototype'][_0x8db2('0x47')]=function(){var _0x3d44de=this;return function(_0x40c69e){if(_0x40c69e){freeIsNotKey(_0x40c69e,_0x3d44de[_0x8db2('0x48')],'id');for(var _0x482b26=0x0,_0x424c27={};_0x482b26<_0x40c69e[_0x8db2('0x42')];_0x482b26+=0x1){_0x424c27=_0x40c69e[_0x482b26];if(_[_0x8db2('0x43')](_0x3d44de[_0x8db2('0x48')][_0x424c27['id']])){_0x3d44de['triggers'][_0x424c27['id']]=new Trigger(_0x424c27);}else{_0x3d44de[_0x8db2('0x44')](_0x3d44de['triggers'][_0x424c27['id']],_0x424c27);}}}return _0x3d44de[_0x8db2('0x48')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x49')]=function(){var _0x4d2164=this;return function(_0x4b0e72){if(_0x4b0e72){freeIsNotKey(_0x4b0e72,_0x4d2164[_0x8db2('0x16')],'id');for(var _0x47c556=0x0,_0x173cc7={};_0x47c556<_0x4b0e72[_0x8db2('0x42')];_0x47c556+=0x1){_0x173cc7=_0x4b0e72[_0x47c556];if(_[_0x8db2('0x43')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']])){_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']]=new Template(_0x173cc7);}else{_0x4d2164[_0x8db2('0x44')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']],_0x173cc7);}}}return _0x4d2164[_0x8db2('0x16')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4a')]=function(){var _0x1362ed=this;return function(_0x36f9d6){if(_0x36f9d6){freeIsNotKey(_0x36f9d6,_0x1362ed['zendeskAccounts'],'id');for(var _0x449109=0x0,_0x2ada52={};_0x449109<_0x36f9d6[_0x8db2('0x42')];_0x449109+=0x1){_0x2ada52=_0x36f9d6[_0x449109];if(_[_0x8db2('0x43')](_0x1362ed['zendeskAccounts'][_0x2ada52['id']])){_0x1362ed['zendeskAccounts'][_0x2ada52['id']]=new ZendeskAccount(_0x2ada52);}else{_0x1362ed[_0x8db2('0x44')](_0x1362ed[_0x8db2('0x4b')][_0x2ada52['id']],_0x2ada52);}}}return _0x1362ed[_0x8db2('0x4b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x494d6e=this;return function(_0x44ac56){if(_0x44ac56){freeIsNotKey(_0x44ac56,_0x494d6e[_0x8db2('0x1c')],'id');for(var _0x55c7dd=0x0,_0x383fa1={};_0x55c7dd<_0x44ac56[_0x8db2('0x42')];_0x55c7dd+=0x1){_0x383fa1=_0x44ac56[_0x55c7dd];if(_[_0x8db2('0x43')](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']])){_0x494d6e['salesforceAccounts'][_0x383fa1['id']]=new SalesforceAccount(_0x383fa1);}else{_0x494d6e['mergeFromDatabase'](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']],_0x383fa1);}}}return _0x494d6e[_0x8db2('0x1c')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4c')]=function(){var _0x3daed6=this;return function(_0x2bf408){if(_0x2bf408){freeIsNotKey(_0x2bf408,_0x3daed6[_0x8db2('0x1e')],'id');for(var _0x3ca2a7=0x0,_0x4187d6={};_0x3ca2a7<_0x2bf408[_0x8db2('0x42')];_0x3ca2a7+=0x1){_0x4187d6=_0x2bf408[_0x3ca2a7];if(_[_0x8db2('0x43')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']])){_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']]=new FreshdeskAccount(_0x4187d6);}else{_0x3daed6[_0x8db2('0x44')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']],_0x4187d6);}}}return _0x3daed6['freshdeskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4d')]=function(){var _0x579317=this;return function(_0x27b644){if(_0x27b644){freeIsNotKey(_0x27b644,_0x579317[_0x8db2('0x1f')],'id');for(var _0x3af298=0x0,_0x547215={};_0x3af298<_0x27b644[_0x8db2('0x42')];_0x3af298+=0x1){_0x547215=_0x27b644[_0x3af298];if(_[_0x8db2('0x43')](_0x579317[_0x8db2('0x1f')][_0x547215['id']])){_0x579317[_0x8db2('0x1f')][_0x547215['id']]=new ZohoAccount(_0x547215);}else{_0x579317[_0x8db2('0x44')](_0x579317['zohoAccounts'][_0x547215['id']],_0x547215);}}}return _0x579317[_0x8db2('0x1f')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4e')]=function(){var _0x58bb60=this;return function(_0x1e7d1a){if(_0x1e7d1a){freeIsNotKey(_0x1e7d1a,_0x58bb60[_0x8db2('0x20')],'id');for(var _0x33dddd=0x0,_0x7b0de8={};_0x33dddd<_0x1e7d1a[_0x8db2('0x42')];_0x33dddd+=0x1){_0x7b0de8=_0x1e7d1a[_0x33dddd];if(_[_0x8db2('0x43')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']])){_0x58bb60['deskAccounts'][_0x7b0de8['id']]=new DeskAccount(_0x7b0de8);}else{_0x58bb60[_0x8db2('0x44')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']],_0x7b0de8);}}}return _0x58bb60['deskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4f')]=function(){var _0x533e41=this;return function(_0x107bbe){if(_0x107bbe){freeIsNotKey(_0x107bbe,_0x533e41[_0x8db2('0x1d')],'id');for(var _0x63e8f7=0x0,_0x30f4f3={};_0x63e8f7<_0x107bbe[_0x8db2('0x42')];_0x63e8f7+=0x1){_0x30f4f3=_0x107bbe[_0x63e8f7];if(_[_0x8db2('0x43')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']])){_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']]=new SugarcrmAccount(_0x30f4f3);}else{_0x533e41[_0x8db2('0x44')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']],_0x30f4f3);}}}return _0x533e41[_0x8db2('0x1d')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x50')]=function(){var _0x1ce89f=this;return function(_0x64ec90){if(_0x64ec90){freeIsNotKey(_0x64ec90,_0x1ce89f[_0x8db2('0x21')],'id');for(var _0x4a20a7=0x0,_0xe0c3e={};_0x4a20a7<_0x64ec90[_0x8db2('0x42')];_0x4a20a7+=0x1){_0xe0c3e=_0x64ec90[_0x4a20a7];if(_[_0x8db2('0x43')](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']])){_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']]=new VtigerAccount(_0xe0c3e);}else{_0x1ce89f['mergeFromDatabase'](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']],_0xe0c3e);}}}return _0x1ce89f[_0x8db2('0x21')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x51')]=function(){var _0x2ad70f=this;return function(_0x348da8){if(_0x348da8){freeIsNotKey(_0x348da8,_0x2ad70f[_0x8db2('0x22')],'id');for(var _0x2c7b04=0x0,_0x24cfe9={};_0x2c7b04<_0x348da8[_0x8db2('0x42')];_0x2c7b04+=0x1){_0x24cfe9=_0x348da8[_0x2c7b04];if(_[_0x8db2('0x43')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']])){_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']]=new ServicenowAccount(_0x24cfe9);}else{_0x2ad70f[_0x8db2('0x44')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']],_0x24cfe9);}}}return _0x2ad70f[_0x8db2('0x22')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x52')]=function(){var _0x5a719f=this;return function(_0x3273dd){if(_0x3273dd){freeIsNotKey(_0x3273dd,_0x5a719f['dynamics365Accounts'],'id');for(var _0x364176=0x0,_0x570c53={};_0x364176<_0x3273dd[_0x8db2('0x42')];_0x364176+=0x1){_0x570c53=_0x3273dd[_0x364176];if(_[_0x8db2('0x43')](_0x5a719f[_0x8db2('0x23')][_0x570c53['id']])){_0x5a719f[_0x8db2('0x23')][_0x570c53['id']]=new Dynamics365Account(_0x570c53);}else{_0x5a719f[_0x8db2('0x44')](_0x5a719f['dynamics365Accounts'][_0x570c53['id']],_0x570c53);}}}return _0x5a719f['dynamics365Accounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x53')]=function(){var _0x21ec87=this;return function(_0x3ba1d2){if(_0x3ba1d2){freeIsNotKey(_0x3ba1d2,_0x21ec87[_0x8db2('0x24')],'id');for(var _0x1f28d2=0x0,_0x3e3de3={};_0x1f28d2<_0x3ba1d2[_0x8db2('0x42')];_0x1f28d2+=0x1){_0x3e3de3=_0x3ba1d2[_0x1f28d2];if(_['isUndefined'](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']])){_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']]=new FreshsalesAccount(_0x3e3de3);}else{_0x21ec87[_0x8db2('0x44')](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']],_0x3e3de3);}}}return _0x21ec87[_0x8db2('0x24')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x54')]=function(){var _0x20caf0=this;return function(_0x4938bb){for(var _0x54318c=0x0;_0x54318c<_0x4938bb[_0x8db2('0x42')];_0x54318c+=0x1){_[_0x8db2('0x55')](_0x20caf0[_0x8db2('0x14')][_0x4938bb[_0x54318c][_0x8db2('0x2a')]],_0x4938bb[_0x54318c]);}return _0x20caf0[_0x8db2('0x14')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3611da=this;return function(_0x364807){clearVoiceQueues(_0x3611da['voiceQueues']);if(_0x364807){_0x364807=_[_0x8db2('0x56')](_0x364807,_0x8db2('0x57'));for(var _0x1ab84c in _0x364807){if(_0x364807['hasOwnProperty'](_0x1ab84c)){for(var _0x26523b=0x0;_0x26523b<_0x364807[_0x1ab84c][_0x8db2('0x42')];_0x26523b+=0x1){var _0x2cf731=_0x364807[_0x1ab84c][_0x26523b]['queue'];if(_0x3611da[_0x8db2('0x14')][_0x2cf731]){if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x58')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x33')]+=0x1;}if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x59')]){_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x34')]+=0x1;}_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x35')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallerleaveAt'])['diff'](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;if(_0x26523b===_0x364807[_0x1ab84c]['length']-0x1){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5c')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5d')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5e')])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x31')]+=0x1;if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x60')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x32')]+=0x1;_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x2e')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallercompleteAt'])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x61')]),'seconds')||0x0;}}else{_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x35')]||0x0;}}}}}}return _0x3611da[_0x8db2('0x14')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x62')]=function(){var _0x242379=this;return function(_0x31a095){clearVoiceCallReports(_0x242379[_0x8db2('0x63')]);if(_0x31a095){for(var _0x3ac0fa=0x0;_0x3ac0fa<_0x31a095[_0x8db2('0x42')];_0x3ac0fa+=0x1){_0x242379['outbound']['total']+=0x1;_0x242379[_0x8db2('0x63')]['sumDuration']+=_0x31a095[_0x3ac0fa][_0x8db2('0x64')];if(_0x31a095[_0x3ac0fa][_0x8db2('0x65')]===_0x8db2('0x66')){_0x242379['outbound'][_0x8db2('0x32')]+=0x1;_0x242379[_0x8db2('0x63')][_0x8db2('0x35')]+=_0x31a095[_0x3ac0fa]['duration']-_0x31a095[_0x3ac0fa][_0x8db2('0x67')]||0x0;_0x242379[_0x8db2('0x63')][_0x8db2('0x2e')]+=_0x31a095[_0x3ac0fa][_0x8db2('0x67')];}}}return _0x242379['outbound'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x68')]=function(){var _0x299640=this;return function(_0x1edb1a){if(_0x1edb1a){freeIsNotKey(_0x1edb1a,_0x299640[_0x8db2('0x15')],_0x8db2('0x2a'));for(var _0x1aadfb=0x0,_0x3682bf={};_0x1aadfb<_0x1edb1a[_0x8db2('0x42')];_0x1aadfb+=0x1){_0x3682bf=_0x1edb1a[_0x1aadfb];if(_[_0x8db2('0x43')](_0x299640[_0x8db2('0x15')][_0x3682bf['name']])){_0x299640[_0x8db2('0x15')][_0x3682bf[_0x8db2('0x2a')]]=new Campaign(_0x3682bf);}else{_0x299640[_0x8db2('0x44')](_0x299640['campaigns'][_0x3682bf['name']],_0x3682bf);_0x299640['campaigns'][_0x3682bf[_0x8db2('0x2a')]][_0x8db2('0x69')]=_0x3682bf[_0x8db2('0x6a')]?_0x3682bf[_0x8db2('0x6a')][_0x8db2('0x2a')]:undefined;}}}return _0x299640[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6b')]=function(){var _0x3b1929=this;return function(_0x37cf6d){if(_0x37cf6d){freeIsNotKey(_0x37cf6d,_0x3b1929[_0x8db2('0x17')],'id');for(var _0x4d0ff6=0x0,_0x360a06={};_0x4d0ff6<_0x37cf6d[_0x8db2('0x42')];_0x4d0ff6+=0x1){_0x360a06=_0x37cf6d[_0x4d0ff6];if(_[_0x8db2('0x43')](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']])){_0x3b1929['voiceExtensions'][_0x360a06['id']]=new VoiceExtension(_0x360a06);}else{_0x3b1929['mergeFromDatabase'](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']],_0x360a06);}}}return _0x3b1929[_0x8db2('0x17')];};};Realtime['prototype'][_0x8db2('0x6c')]=function(){var _0x121f31=this;return function(_0x9132b4){clearCampaigns(_0x121f31['campaigns']);for(var _0x5dc46c=0x0;_0x5dc46c<_0x9132b4['length'];_0x5dc46c+=0x1){_[_0x8db2('0x55')](_0x121f31[_0x8db2('0x15')][_0x9132b4[_0x5dc46c][_0x8db2('0x2a')]],_0x9132b4[_0x5dc46c]);}return _0x121f31[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')]['initFaxAccounts']=function(){var _0x30930a=this;return function(_0x5e349c){if(_0x5e349c){freeIsNotKey(_0x5e349c,_0x30930a[_0x8db2('0x25')],'id');for(var _0x353101=0x0,_0xa083b1={};_0x353101<_0x5e349c[_0x8db2('0x42')];_0x353101+=0x1){_0xa083b1=_0x5e349c[_0x353101];if(_[_0x8db2('0x43')](_0x30930a['faxAccounts'][_0xa083b1['id']])){_0x30930a['faxAccounts'][_0xa083b1['id']]=new FaxAccount(_0xa083b1);}else{_0x30930a[_0x8db2('0x44')](_0x30930a['faxAccounts'][_0xa083b1['id']],_0xa083b1);}}}return _0x30930a[_0x8db2('0x25')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6d')]=function(){var _0x1e7bc2=this;return function(_0x2b7224){if(_0x2b7224){freeIsNotKey(_0x2b7224,_0x1e7bc2[_0x8db2('0x14')],'name');for(var _0x19f9a0=0x0,_0x222ea2={};_0x19f9a0<_0x2b7224[_0x8db2('0x42')];_0x19f9a0+=0x1){_0x222ea2=_0x2b7224[_0x19f9a0];if(_['isUndefined'](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]])){_0x1e7bc2['voiceQueues'][_0x222ea2[_0x8db2('0x2a')]]=new VoiceQueue(_0x222ea2);}else{_0x1e7bc2[_0x8db2('0x44')](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]],_0x222ea2);}}}return _0x1e7bc2[_0x8db2('0x14')];};};module[_0x8db2('0x6e')]=Realtime; \ No newline at end of file +var _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0b0e,0x187));var _0xe0b0=function(_0x435dde,_0x2a2fa3){_0x435dde=_0x435dde-0x0;var _0x4aca2d=_0x0b0e[_0x435dde];return _0x4aca2d;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 1377df2..30442fa 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8059=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0x23c791,_0xa8bee3){var _0x57b777=function(_0x25f8c4){while(--_0x25f8c4){_0x23c791['push'](_0x23c791['shift']());}};_0x57b777(++_0xa8bee3);}(_0x8059,0x1d0));var _0x9805=function(_0x48e1ec,_0x35f468){_0x48e1ec=_0x48e1ec-0x0;var _0x3b33eb=_0x8059[_0x48e1ec];return _0x3b33eb;};'use strict';function mergeDBDataToRealtime(_0x45ae18,_0x46b31f){var _0x2420f2=Object[_0x9805('0x0')]({},_0x45ae18);for(var _0x5557ca in _0x46b31f){if(_0x2420f2[_0x9805('0x1')](_0x5557ca)){_0x2420f2[_0x5557ca]=_0x46b31f[_0x5557ca];}}return _0x2420f2;}exports[_0x9805('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xb1c2=['assign'];(function(_0x44b88c,_0x5f2ce9){var _0xca09a3=function(_0x402a7d){while(--_0x402a7d){_0x44b88c['push'](_0x44b88c['shift']());}};_0xca09a3(++_0x5f2ce9);}(_0xb1c2,0x19a));var _0x2b1c=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xb1c2[_0x126558];return _0x1f6d14;};'use strict';function mergeDBDataToRealtime(_0x511751,_0x3a3d06){var _0x1d199d=Object[_0x2b1c('0x0')]({},_0x511751);for(var _0x5f2819 in _0x3a3d06){if(_0x1d199d['hasOwnProperty'](_0x5f2819)){_0x1d199d[_0x5f2819]=_0x3a3d06[_0x5f2819];}}return _0x1d199d;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 8419204..4829662 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 _0xb75e=['UserId','split','membername','monitor','monitors','filename','createdAt','connectedlinenum','connectedlinename','xcally-motion-dialer','originatecalleridnum','voiceAgentReport','isArray','forEach','startsWith','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','moment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','findAgent','isNil','find','name','interface','format','SIP/%s','length','accountcode','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','channel','calleridnum','outbound','destination','exten','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','destinationchannel','disposition','linkedid','transfers','transfereelinkedid','type'];(function(_0x544a3d,_0x22f2a1){var _0x1d6816=function(_0x22d610){while(--_0x22d610){_0x544a3d['push'](_0x544a3d['shift']());}};_0x1d6816(++_0x22f2a1);}(_0xb75e,0x176));var _0xeb75=function(_0x46a134,_0x55a433){_0x46a134=_0x46a134-0x0;var _0x9d8f2d=_0xb75e[_0x46a134];return _0x9d8f2d;};'use strict';var _=require('lodash');var moment=require(_0xeb75('0x0'));var util=require('util');var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0xeb75('0x1'));var RpcVoiceCallReport=require(_0xeb75('0x2'));var RpcVoiceDialReport=require(_0xeb75('0x3'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xeb75('0x4'));var RpcVoiceTransferReport=require(_0xeb75('0x5'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xeb75('0x6'));var VoiceAgentReport=require(_0xeb75('0x7'));var VoiceDialReport=require(_0xeb75('0x8'));var UserReport=require(_0xeb75('0x9'));function Report(_0x3ac196){this['realtime']=_0x3ac196;this['agents']=_0x3ac196[_0xeb75('0xa')];this[_0xeb75('0xb')]=_0x3ac196['telephones'];}Report[_0xeb75('0xc')]['sync']=function(_0x3b135b){var _0x1b058b=new VoiceQueueReport(this[_0xeb75('0xd')]);var _0x10e646=new VoiceAgentReport(this[_0xeb75('0xd')]);var _0x36d5ea=new VoiceDialReport(this[_0xeb75('0xd')]);var _0x29b630=new VoiceCallReport(this['realtime']);var _0x1e6752=new UserReport(this[_0xeb75('0xd')]);if(config[_0xeb75('0xe')]&&config[_0xeb75('0xe')][_0xeb75('0xf')]){ami['on'](_0xeb75('0x10'),this[_0xeb75('0x11')]['bind'](this));ami['on'](_0xeb75('0x12'),this[_0xeb75('0x13')][_0xeb75('0x14')](this));ami['on'](_0xeb75('0x15'),this['voiceAgentReport'][_0xeb75('0x14')](this));ami['on'](_0xeb75('0x16'),this[_0xeb75('0x17')][_0xeb75('0x14')](this));ami['on']('blindtransfer',this[_0xeb75('0x18')][_0xeb75('0x14')](this));ami['on'](_0xeb75('0x19'),this[_0xeb75('0x1a')]['bind'](this));}};Report['prototype'][_0xeb75('0x1b')]=function(_0x59ec0d){var _0x2fbc9c;_0x2fbc9c=_['find'](this[_0xeb75('0xa')],function(_0x14d83f){return _0x14d83f['accountcode']==_0x59ec0d||_0x14d83f['name']==_0x59ec0d;});if(_[_0xeb75('0x1c')](_0x2fbc9c)){var _0xf7b729=_[_0xeb75('0x1d')](this[_0xeb75('0xb')],function(_0x4178db){return _0x4178db['accountcode']==_0x59ec0d||_0x4178db[_0xeb75('0x1e')]==_0x59ec0d;});if(_0xf7b729){_0x2fbc9c=_[_0xeb75('0x1d')](this['agents'],function(_0x3dccf5){return _0x3dccf5[_0xeb75('0x1f')]==util[_0xeb75('0x20')](_0xeb75('0x21'),_0xf7b729[_0xeb75('0x1e')]);});}}return _0x2fbc9c;};Report[_0xeb75('0xc')]['voiceQueueReport']=function(_0x12838a){for(var _0x341851=0x0;_0x341851<_0x12838a[_0xeb75('0x22')];_0x341851+=0x1){var _0x18ca84=this[_0xeb75('0x1b')](_0x12838a[_0x341851]['connectedlinenum']);if(_0x18ca84){_0x12838a[_0x341851][_0xeb75('0x23')]=_0x18ca84[_0xeb75('0x23')];_0x12838a[_0x341851][_0xeb75('0x24')]=!![];_0x12838a[_0x341851][_0xeb75('0x25')]=_0x18ca84[_0xeb75('0x1e')];_0x12838a[_0x341851][_0xeb75('0x1f')]=_[_0xeb75('0x1c')](_0x18ca84[_0xeb75('0x1f')])?util[_0xeb75('0x20')]('SIP/%s',_0x18ca84['name']):_0x18ca84[_0xeb75('0x1f')];if(_0x12838a[_0x341851][_0xeb75('0x26')]){_0x12838a[_0x341851][_0xeb75('0x27')]=moment()['format'](_0xeb75('0x28'));}if(_0x12838a[_0x341851][_0xeb75('0x29')]){_0x12838a[_0x341851][_0xeb75('0x2a')]=moment()['format'](_0xeb75('0x28'));}RpcMemberReport[_0xeb75('0x11')](_0x12838a[_0x341851]);}RpcVoiceQueueReport[_0xeb75('0x2b')](_0x12838a[_0x341851]);}};function extractCalleridNumber(_0x5e514b){var _0x33d657=_0x5e514b[_0xeb75('0x2c')](/<(.*?)>/);return _0x33d657?_0x33d657[0x1]:_0x5e514b;}Report[_0xeb75('0xc')][_0xeb75('0x2d')]=function(_0x225fb7){for(var _0x266dee=0x0;_0x266dee',_0x4eaf17['calleridname'],_0x4eaf17[_0xeb75('0x30')]);}if(RpcVoiceTransferReport['transfers'][_0x4eaf17[_0xeb75('0x3e')]]){var _0x23b840=RpcVoiceTransferReport[_0xeb75('0x3f')][_0x4eaf17['linkedid']];_0x23b840[_0xeb75('0x40')]=_0x4eaf17['uniqueid'];RpcVoiceTransferReport['blindTransfer'](_0x23b840);delete RpcVoiceTransferReport['transfers'][_0x4eaf17[_0xeb75('0x3e')]];}if(_[_0xeb75('0x1c')](_0x4eaf17['type'])){_0x4eaf17[_0xeb75('0x41')]=this['getCallType'](_0x4eaf17);}if(_[_0xeb75('0x1c')](_0x4eaf17[_0xeb75('0x42')])){var _0x127e99=_0x4eaf17[_0xeb75('0x2f')][_0xeb75('0x43')]('-')[0x0];var _0x34ae10=this['agents'][_0x127e99];if(!_0x34ae10)_0x34ae10=this[_0xeb75('0x2d')](_0x4eaf17[_0xeb75('0x23')]);if(_0x34ae10){_0x4eaf17[_0xeb75('0x42')]=_0x34ae10['id'];_0x4eaf17[_0xeb75('0x44')]=_0x34ae10[_0xeb75('0x1e')];}}RpcVoiceCallReport[_0xeb75('0x2b')](_0x4eaf17);if(_0x4eaf17[_0xeb75('0x45')]){for(var _0x4b4cc7=0x0;_0x4b4cc7<_0x4eaf17[_0xeb75('0x46')][_0xeb75('0x22')];_0x4b4cc7+=0x1){_0x4eaf17['monitorFilename']=_0x4eaf17[_0xeb75('0x46')][_0x4b4cc7][_0xeb75('0x47')];_0x4eaf17[_0xeb75('0x48')]=_0x4eaf17[_0xeb75('0x46')][_0x4b4cc7]['createdAt'];if(_0x4eaf17['exten']=='xcally-motion-preview'){_0x4eaf17[_0xeb75('0x30')]=_0x4eaf17[_0xeb75('0x49')];_0x4eaf17['calleridname']=_0x4eaf17[_0xeb75('0x4a')];_0x4eaf17[_0xeb75('0x49')]=_0x4eaf17[_0xeb75('0x23')];_0x4eaf17[_0xeb75('0x4a')]=_0x4eaf17[_0xeb75('0x44')];_0x4eaf17[_0xeb75('0x33')]=_0x4eaf17['originatecalleridnum'];}else if(_0x4eaf17[_0xeb75('0x33')]==_0xeb75('0x4b')){_0x4eaf17[_0xeb75('0x30')]=_0x4eaf17[_0xeb75('0x32')];_0x4eaf17['exten']=_0x4eaf17[_0xeb75('0x4c')];}RpcVoiceRecording[_0xeb75('0x2b')](_0x4eaf17);}}};Report['prototype'][_0xeb75('0x4d')]=function(_0x57c67d){if(_[_0xeb75('0x4e')](_0x57c67d)){_0x57c67d[_0xeb75('0x4f')](function(_0x17d597){RpcVoiceAgentReport['create'](_0x17d597);});}else{RpcVoiceAgentReport[_0xeb75('0x2b')](_0x57c67d);}};Report[_0xeb75('0xc')][_0xeb75('0x17')]=function(_0x5e5c3f){RpcVoiceDialReport[_0xeb75('0x2b')](_0x5e5c3f);var _0x1b6a19;var _0x1579f6;var _0x196b90=_0x5e5c3f[_0xeb75('0x2f')];if(_[_0xeb75('0x50')](_0x196b90,'Local')){_0x1579f6=_0x196b90[_0xeb75('0x51')](_0x196b90[_0xeb75('0x52')]('/')+0x1,_0x196b90['indexOf']('@'));_0x1b6a19=_[_0xeb75('0x1d')](this[_0xeb75('0xa')],function(_0x25f32b){return _0x25f32b[_0xeb75('0x53')]==_0x1579f6||_0x25f32b[_0xeb75('0x54')]==_0x1579f6||_0x25f32b[_0xeb75('0x23')]==_0x1579f6;});}else{_0x1579f6=_0x196b90[_0xeb75('0x51')](_0x196b90['indexOf']('/')+0x1,_0x196b90[_0xeb75('0x55')]('-'));_0x1b6a19=this[_0xeb75('0x1b')](_0x1579f6);}if(_0x1b6a19){_0x5e5c3f[_0xeb75('0x1f')]=_['isNil'](_0x1b6a19[_0xeb75('0x1f')])?util[_0xeb75('0x20')]('SIP/%s',_0x1b6a19['name']):_0x1b6a19[_0xeb75('0x1f')];_0x5e5c3f[_0xeb75('0x44')]=_0x1b6a19[_0xeb75('0x1e')];_0x5e5c3f[_0xeb75('0x23')]=_0x1b6a19['accountcode'];RpcMemberReport['voiceDialReport'](_0x5e5c3f);}};Report['prototype'][_0xeb75('0x18')]=function(_0x3d31d0){RpcVoiceTransferReport[_0xeb75('0x3f')][_0x3d31d0[_0xeb75('0x56')]]=_0x3d31d0;};Report['prototype'][_0xeb75('0x1a')]=function(_0x1c1fa7){RpcVoiceTransferReport[_0xeb75('0x1a')](_0x1c1fa7);};module[_0xeb75('0x57')]=Report; \ No newline at end of file +var _0xcb2c=['keys','channel','split','calleridnum','outbound','internal','destination','type','lastapplication','queue','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','getCallType','UserId','membername','monitor','monitors','createdAt','exten','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','moment','util','../ami','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','isNil','accountcode','name','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','getAgentByInternal'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xcb2c,0x12d));var _0xccb2=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xcb2c[_0x5b78e8];return _0xf2c321;};'use strict';var _=require('lodash');var moment=require(_0xccb2('0x0'));var util=require(_0xccb2('0x1'));var config=require('../../../config/environment');var ami=require(_0xccb2('0x2'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xccb2('0x3'));var RpcMemberReport=require(_0xccb2('0x4'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xccb2('0x5'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xccb2('0x6'));var VoiceAgentReport=require(_0xccb2('0x7'));var VoiceDialReport=require(_0xccb2('0x8'));var UserReport=require(_0xccb2('0x9'));function Report(_0x237342){this['realtime']=_0x237342;this[_0xccb2('0xa')]=_0x237342['agents'];this[_0xccb2('0xb')]=_0x237342[_0xccb2('0xb')];}Report[_0xccb2('0xc')][_0xccb2('0xd')]=function(_0x5a940a){var _0x168674=new VoiceQueueReport(this['realtime']);var _0x1af501=new VoiceAgentReport(this[_0xccb2('0xe')]);var _0x15c161=new VoiceDialReport(this[_0xccb2('0xe')]);var _0x197dfa=new VoiceCallReport(this[_0xccb2('0xe')]);var _0x3fd034=new UserReport(this[_0xccb2('0xe')]);if(config[_0xccb2('0xf')]&&config['xdr'][_0xccb2('0x10')]){ami['on'](_0xccb2('0x11'),this[_0xccb2('0x12')][_0xccb2('0x13')](this));ami['on'](_0xccb2('0x14'),this[_0xccb2('0x15')][_0xccb2('0x13')](this));ami['on'](_0xccb2('0x16'),this[_0xccb2('0x17')][_0xccb2('0x13')](this));ami['on'](_0xccb2('0x18'),this[_0xccb2('0x19')]['bind'](this));ami['on']('blindtransfer',this[_0xccb2('0x1a')]['bind'](this));ami['on'](_0xccb2('0x1b'),this[_0xccb2('0x1c')][_0xccb2('0x13')](this));}};Report[_0xccb2('0xc')][_0xccb2('0x1d')]=function(_0x439497){var _0x2dfb33;_0x2dfb33=_[_0xccb2('0x1e')](this[_0xccb2('0xa')],function(_0x1c6f79){return _0x1c6f79['accountcode']==_0x439497||_0x1c6f79['name']==_0x439497;});if(_[_0xccb2('0x1f')](_0x2dfb33)){var _0x121be3=_[_0xccb2('0x1e')](this[_0xccb2('0xb')],function(_0x27fd5b){return _0x27fd5b[_0xccb2('0x20')]==_0x439497||_0x27fd5b[_0xccb2('0x21')]==_0x439497;});if(_0x121be3){_0x2dfb33=_['find'](this[_0xccb2('0xa')],function(_0x253ded){return _0x253ded[_0xccb2('0x22')]==util[_0xccb2('0x23')](_0xccb2('0x24'),_0x121be3[_0xccb2('0x21')]);});}}return _0x2dfb33;};Report[_0xccb2('0xc')][_0xccb2('0x12')]=function(_0x485674){for(var _0x4c18b5=0x0;_0x4c18b5<_0x485674[_0xccb2('0x25')];_0x4c18b5+=0x1){var _0x350486=this[_0xccb2('0x1d')](_0x485674[_0x4c18b5][_0xccb2('0x26')]);if(_0x350486){_0x485674[_0x4c18b5][_0xccb2('0x20')]=_0x350486[_0xccb2('0x20')];_0x485674[_0x4c18b5][_0xccb2('0x27')]=!![];_0x485674[_0x4c18b5][_0xccb2('0x28')]=_0x350486[_0xccb2('0x21')];_0x485674[_0x4c18b5]['interface']=_['isNil'](_0x350486[_0xccb2('0x22')])?util['format'](_0xccb2('0x24'),_0x350486['name']):_0x350486[_0xccb2('0x22')];if(_0x485674[_0x4c18b5]['queuecallercomplete']){_0x485674[_0x4c18b5][_0xccb2('0x29')]=moment()[_0xccb2('0x23')](_0xccb2('0x2a'));}if(_0x485674[_0x4c18b5][_0xccb2('0x2b')]){_0x485674[_0x4c18b5]['queuecallerexitAt']=moment()[_0xccb2('0x23')](_0xccb2('0x2a'));}RpcMemberReport['voiceQueueReport'](_0x485674[_0x4c18b5]);}RpcVoiceQueueReport[_0xccb2('0x2c')](_0x485674[_0x4c18b5]);}};function extractCalleridNumber(_0x3cdca9){var _0xec51fa=_0x3cdca9[_0xccb2('0x2d')](/<(.*?)>/);return _0xec51fa?_0xec51fa[0x1]:_0x3cdca9;}Report[_0xccb2('0xc')][_0xccb2('0x2e')]=function(_0x1b2f49){for(var _0x2a8c04=0x0;_0x2a8c04',_0x34ad9c[_0xccb2('0x42')],_0x34ad9c[_0xccb2('0x32')]);}if(RpcVoiceTransferReport[_0xccb2('0x43')][_0x34ad9c[_0xccb2('0x44')]]){var _0xefb363=RpcVoiceTransferReport['transfers'][_0x34ad9c[_0xccb2('0x44')]];_0xefb363[_0xccb2('0x45')]=_0x34ad9c[_0xccb2('0x46')];RpcVoiceTransferReport[_0xccb2('0x1a')](_0xefb363);delete RpcVoiceTransferReport[_0xccb2('0x43')][_0x34ad9c[_0xccb2('0x44')]];}if(_[_0xccb2('0x1f')](_0x34ad9c[_0xccb2('0x36')])){_0x34ad9c['type']=this[_0xccb2('0x47')](_0x34ad9c);}if(_['isNil'](_0x34ad9c[_0xccb2('0x48')])){var _0x1ee3ec=_0x34ad9c['channel'][_0xccb2('0x31')]('-')[0x0];var _0x18ce44=this[_0xccb2('0xa')][_0x1ee3ec];if(!_0x18ce44)_0x18ce44=this[_0xccb2('0x2e')](_0x34ad9c[_0xccb2('0x20')]);if(_0x18ce44){_0x34ad9c[_0xccb2('0x48')]=_0x18ce44['id'];_0x34ad9c[_0xccb2('0x49')]=_0x18ce44[_0xccb2('0x21')];}}RpcVoiceCallReport[_0xccb2('0x2c')](_0x34ad9c);if(_0x34ad9c[_0xccb2('0x4a')]){for(var _0x503137=0x0;_0x503137<_0x34ad9c[_0xccb2('0x4b')][_0xccb2('0x25')];_0x503137+=0x1){_0x34ad9c['monitorFilename']=_0x34ad9c[_0xccb2('0x4b')][_0x503137]['filename'];_0x34ad9c['createdAt']=_0x34ad9c[_0xccb2('0x4b')][_0x503137][_0xccb2('0x4c')];if(_0x34ad9c[_0xccb2('0x4d')]==_0xccb2('0x3c')){_0x34ad9c['calleridnum']=_0x34ad9c['connectedlinenum'];_0x34ad9c[_0xccb2('0x42')]=_0x34ad9c[_0xccb2('0x4e')];_0x34ad9c['connectedlinenum']=_0x34ad9c['accountcode'];_0x34ad9c[_0xccb2('0x4e')]=_0x34ad9c['membername'];_0x34ad9c[_0xccb2('0x4d')]=_0x34ad9c[_0xccb2('0x3e')];}else if(_0x34ad9c[_0xccb2('0x4d')]==_0xccb2('0x4f')){_0x34ad9c[_0xccb2('0x32')]=_0x34ad9c['destination'];_0x34ad9c['exten']=_0x34ad9c['originatecalleridnum'];}RpcVoiceRecording[_0xccb2('0x2c')](_0x34ad9c);}}};Report[_0xccb2('0xc')]['voiceAgentReport']=function(_0x47e9f7){if(_[_0xccb2('0x50')](_0x47e9f7)){_0x47e9f7[_0xccb2('0x51')](function(_0x41b1f2){RpcVoiceAgentReport[_0xccb2('0x2c')](_0x41b1f2);});}else{RpcVoiceAgentReport['create'](_0x47e9f7);}};Report[_0xccb2('0xc')][_0xccb2('0x19')]=function(_0x50eea5){RpcVoiceDialReport[_0xccb2('0x2c')](_0x50eea5);var _0x2c2baf;var _0x3abf25;var _0x3c303c=_0x50eea5[_0xccb2('0x30')];if(_[_0xccb2('0x52')](_0x3c303c,_0xccb2('0x53'))){_0x3abf25=_0x3c303c[_0xccb2('0x54')](_0x3c303c[_0xccb2('0x55')]('/')+0x1,_0x3c303c[_0xccb2('0x55')]('@'));_0x2c2baf=_[_0xccb2('0x1e')](this[_0xccb2('0xa')],function(_0x219608){return _0x219608[_0xccb2('0x56')]==_0x3abf25||_0x219608['phone']==_0x3abf25||_0x219608[_0xccb2('0x20')]==_0x3abf25;});}else{_0x3abf25=_0x3c303c[_0xccb2('0x54')](_0x3c303c[_0xccb2('0x55')]('/')+0x1,_0x3c303c['lastIndexOf']('-'));_0x2c2baf=this[_0xccb2('0x1d')](_0x3abf25);}if(_0x2c2baf){_0x50eea5[_0xccb2('0x22')]=_['isNil'](_0x2c2baf[_0xccb2('0x22')])?util[_0xccb2('0x23')](_0xccb2('0x24'),_0x2c2baf[_0xccb2('0x21')]):_0x2c2baf[_0xccb2('0x22')];_0x50eea5[_0xccb2('0x49')]=_0x2c2baf[_0xccb2('0x21')];_0x50eea5[_0xccb2('0x20')]=_0x2c2baf[_0xccb2('0x20')];RpcMemberReport[_0xccb2('0x19')](_0x50eea5);}};Report[_0xccb2('0xc')][_0xccb2('0x1a')]=function(_0x3fb512){RpcVoiceTransferReport['transfers'][_0x3fb512['transfererlinkedid']]=_0x3fb512;};Report[_0xccb2('0xc')][_0xccb2('0x1c')]=function(_0x23fe0c){RpcVoiceTransferReport[_0xccb2('0x1c')](_0x23fe0c);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index b2514e6..41e1b59 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf972=['device','local','toLowerCase','stateTime','toNumber','format','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','name','telephone:save','startsWith','indexOf','mobile','phone','updateStatusRealtime','[userReport][devicestatechange]','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','trunk:%s','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','syncDeviceState','peerstatus','syncPeerStatus','resolve','then','actionSipShowRegistry','catch','[userReport][sipshowregistry]','inspect','actionSipPeerStatus','error','[userReport][sippeerstatus]','syncRealtimeShow','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','debug','[userReport][registry]','find','state','merge','omit','username','[userReport][registry]\x20sending\x20trunk:save\x20event:','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s'];(function(_0x444199,_0x1acd8f){var _0x56cfc8=function(_0x1012b8){while(--_0x1012b8){_0x444199['push'](_0x444199['shift']());}};_0x56cfc8(++_0x1acd8f);}(_0xf972,0x1d0));var _0x2f97=function(_0x22abdb,_0x48975e){_0x22abdb=_0x22abdb-0x0;var _0x555bc6=_0xf972[_0x22abdb];return _0x555bc6;};'use strict';var _=require(_0x2f97('0x0'));var moment=require(_0x2f97('0x1'));var util=require(_0x2f97('0x2'));var Redis=require(_0x2f97('0x3'));var BPromise=require('bluebird');var config=require(_0x2f97('0x4'));var logger=require(_0x2f97('0x5'))(_0x2f97('0x6'));var ami=require(_0x2f97('0x7'));config[_0x2f97('0x8')]=_[_0x2f97('0x9')](config[_0x2f97('0x8')],{'host':_0x2f97('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2f97('0x8')]));function UserReport(_0x135b22){this[_0x2f97('0xb')]=_0x135b22[_0x2f97('0xb')];this[_0x2f97('0xc')]=_0x135b22[_0x2f97('0xc')];this[_0x2f97('0xd')]=_0x135b22[_0x2f97('0xd')];ami['on'](_0x2f97('0xe'),this[_0x2f97('0xf')][_0x2f97('0x10')](this));ami['on'](_0x2f97('0x11'),this['syncRegistry'][_0x2f97('0x10')](this));ami['on']('devicestatechange',this[_0x2f97('0x12')][_0x2f97('0x10')](this));ami['on'](_0x2f97('0x13'),this[_0x2f97('0x14')][_0x2f97('0x10')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x2f97('0x15')]()[_0x2f97('0x16')](ami[_0x2f97('0x17')]())[_0x2f97('0x18')](function(_0x1a38b2){logger['error'](_0x2f97('0x19'),util[_0x2f97('0x1a')](_0x1a38b2,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x2f97('0x15')]()[_0x2f97('0x16')](ami['actionDeviceStateList']())[_0x2f97('0x18')](function(_0x59b772){logger['error']('[userReport][devicestatelist]',util[_0x2f97('0x1a')](_0x59b772,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x2f97('0x15')]()[_0x2f97('0x16')](ami[_0x2f97('0x1b')]())[_0x2f97('0x18')](function(_0xbed19){logger[_0x2f97('0x1c')](_0x2f97('0x1d'),util[_0x2f97('0x1a')](_0xbed19,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0x2f97('0x1e')]=function(){setInterval(function(){BPromise[_0x2f97('0x15')]()[_0x2f97('0x16')](showSipRegistrations())['then'](listDeviceStates())[_0x2f97('0x16')](showPeersStatus());},0x32c8);};UserReport[_0x2f97('0x1f')][_0x2f97('0x20')]=function(_0x4a20ac){return _0x4a20ac!==null&&!_[_0x2f97('0x21')](_0x4a20ac);};UserReport[_0x2f97('0x1f')][_0x2f97('0x22')]=function(_0xa83e0b,_0x4bde4e,_0x4733ab){io['to'](_0xa83e0b)[_0x2f97('0x22')](_0x4bde4e,_0x4733ab);};UserReport[_0x2f97('0x1f')][_0x2f97('0xf')]=function(_0x337f20){try{if(this['isNotNull'](_0x337f20)){logger[_0x2f97('0x23')](_0x2f97('0x24'),_0x337f20['username'],_0x337f20['state']);logger[_0x2f97('0x25')](_0x2f97('0x26'),util[_0x2f97('0x1a')](_0x337f20,{'showHidden':![],'depth':null}));var _0x3bc046=_[_0x2f97('0x27')](this['trunks'],{'defaultuser':_0x337f20['username']});if(_0x3bc046){_0x337f20['stateRegistry']=_0x337f20[_0x2f97('0x28')];_[_0x2f97('0x29')](_0x3bc046,_[_0x2f97('0x2a')](_0x337f20,['event','actionid',_0x2f97('0x2b'),'state']));logger['debug'](_0x2f97('0x2c'),util['inspect'](_0x3bc046,{'showHidden':![],'depth':null}));this[_0x2f97('0x22')](util['format']('trunk:%s',_0x3bc046['name']),_0x2f97('0x2d'),_0x3bc046);}}}catch(_0x1a421a){logger['error'](_0x2f97('0x26'),util[_0x2f97('0x1a')](_0x1a421a,{'showHidden':![],'depth':null}));}};UserReport[_0x2f97('0x1f')][_0x2f97('0x12')]=function(_0x59ee3a){try{if(this[_0x2f97('0x20')](_0x59ee3a)){logger[_0x2f97('0x23')](_0x2f97('0x2e'),_0x59ee3a['device'],_0x59ee3a[_0x2f97('0x28')]);logger['debug']('[userReport][devicestatechange]',util[_0x2f97('0x1a')](_0x59ee3a,{'showHidden':![],'depth':null}));if(this[_0x2f97('0xc')][_0x59ee3a[_0x2f97('0x2f')]]){if(!this[_0x2f97('0xc')][_0x59ee3a['device']][_0x2f97('0x30')]||_0x59ee3a[_0x2f97('0x28')][_0x2f97('0x31')]()=='inuse'){this[_0x2f97('0xc')][_0x59ee3a[_0x2f97('0x2f')]][_0x2f97('0x30')]=![];if(this[_0x2f97('0xc')][_0x59ee3a['device']][_0x2f97('0x28')]!==_0x59ee3a[_0x2f97('0x28')][_0x2f97('0x31')]()){this['agents'][_0x59ee3a[_0x2f97('0x2f')]][_0x2f97('0x32')]=_[_0x2f97('0x33')](moment()[_0x2f97('0x34')]('x'));}this[_0x2f97('0xc')][_0x59ee3a[_0x2f97('0x2f')]][_0x2f97('0x28')]=_0x59ee3a[_0x2f97('0x28')][_0x2f97('0x31')]();this[_0x2f97('0xc')][_0x59ee3a['device']]['updateStatusRealtime'](_0x59ee3a);}}else if(this[_0x2f97('0xd')][_0x59ee3a[_0x2f97('0x2f')]]){if(this[_0x2f97('0xd')][_0x59ee3a[_0x2f97('0x2f')]]['state']!==_0x59ee3a[_0x2f97('0x28')]['toLowerCase']()){this[_0x2f97('0xd')][_0x59ee3a[_0x2f97('0x2f')]][_0x2f97('0x32')]=_[_0x2f97('0x33')](moment()['format']('x'));}this[_0x2f97('0xd')][_0x59ee3a[_0x2f97('0x2f')]]['state']=_0x59ee3a[_0x2f97('0x28')]['toLowerCase']();logger['debug'](_0x2f97('0x35'),util[_0x2f97('0x1a')](this[_0x2f97('0xd')][_0x59ee3a[_0x2f97('0x2f')]],{'showHidden':![],'depth':null}));this[_0x2f97('0x22')](util[_0x2f97('0x34')](_0x2f97('0x36'),this['telephones'][_0x59ee3a[_0x2f97('0x2f')]][_0x2f97('0x37')]),_0x2f97('0x38'),this['telephones'][_0x59ee3a['device']]);}else if(this[_0x2f97('0xb')][_0x59ee3a['device']]){if(this[_0x2f97('0xb')][_0x59ee3a[_0x2f97('0x2f')]][_0x2f97('0x28')]!==_0x59ee3a[_0x2f97('0x28')]['toLowerCase']()){this[_0x2f97('0xb')][_0x59ee3a[_0x2f97('0x2f')]]['stateTime']=_[_0x2f97('0x33')](moment()[_0x2f97('0x34')]('x'));}this['trunks'][_0x59ee3a['device']][_0x2f97('0x28')]=_0x59ee3a[_0x2f97('0x28')][_0x2f97('0x31')]();logger[_0x2f97('0x25')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x2f97('0x1a')](this['trunks'][_0x59ee3a[_0x2f97('0x2f')]],{'showHidden':![],'depth':null}));this[_0x2f97('0x22')](util[_0x2f97('0x34')]('trunk:%s',this[_0x2f97('0xb')][_0x59ee3a[_0x2f97('0x2f')]]['name']),_0x2f97('0x2d'),this[_0x2f97('0xb')][_0x59ee3a[_0x2f97('0x2f')]]);}else if(_[_0x2f97('0x39')](_0x59ee3a[_0x2f97('0x2f')],'Local')){var _0x464689=_0x59ee3a['device'];var _0x7d8a5d=_0x464689['substring'](_0x464689[_0x2f97('0x3a')]('/')+0x1,_0x464689[_0x2f97('0x3a')]('@'));var _0x55a744=_[_0x2f97('0x27')](this['agents'],function(_0x454409){return _0x454409[_0x2f97('0x3b')]==_0x7d8a5d||_0x454409[_0x2f97('0x3c')]==_0x7d8a5d||_0x454409['accountcode']==_0x7d8a5d;});if(_0x55a744){if(_0x55a744[_0x2f97('0x28')]!==_0x59ee3a[_0x2f97('0x28')]['toLowerCase']()){_0x55a744[_0x2f97('0x32')]=_[_0x2f97('0x33')](moment()[_0x2f97('0x34')]('x'));}_0x55a744[_0x2f97('0x28')]=_0x59ee3a[_0x2f97('0x28')]['toLowerCase']();_0x55a744['local']=!![];_0x55a744[_0x2f97('0x3d')](_0x59ee3a);}}}}catch(_0x457214){logger['error'](_0x2f97('0x3e'),util[_0x2f97('0x1a')](_0x457214,{'showHidden':![],'depth':null}));}};UserReport[_0x2f97('0x1f')][_0x2f97('0x14')]=function(_0x3fd3f7){try{if(this[_0x2f97('0x20')](_0x3fd3f7)&&this[_0x2f97('0x20')](_0x3fd3f7['peerstatus'])){logger[_0x2f97('0x23')](_0x2f97('0x3f'),_0x3fd3f7[_0x2f97('0x40')],_0x3fd3f7[_0x2f97('0x41')],_0x3fd3f7[_0x2f97('0x13')]);logger[_0x2f97('0x25')](_0x2f97('0x42'),util[_0x2f97('0x1a')](_0x3fd3f7,{'showHidden':![],'depth':null}));if(this[_0x2f97('0xc')][_0x3fd3f7[_0x2f97('0x40')]]){if(!this[_0x2f97('0xc')][_0x3fd3f7[_0x2f97('0x40')]][_0x2f97('0x30')]||_0x3fd3f7[_0x2f97('0x13')]['toLowerCase']()==_0x2f97('0x43')){this[_0x2f97('0xc')][_0x3fd3f7[_0x2f97('0x40')]]['local']=![];this[_0x2f97('0xc')][_0x3fd3f7[_0x2f97('0x40')]]['status']=_0x3fd3f7['peerstatus']['toLowerCase']();this[_0x2f97('0xc')][_0x3fd3f7[_0x2f97('0x40')]][_0x2f97('0x41')]=_0x3fd3f7['address'];this[_0x2f97('0xc')][_0x3fd3f7[_0x2f97('0x40')]][_0x2f97('0x3d')](_0x3fd3f7);}}else if(this[_0x2f97('0xd')][_0x3fd3f7[_0x2f97('0x40')]]){this[_0x2f97('0xd')][_0x3fd3f7['peer']][_0x2f97('0x44')]=_0x3fd3f7[_0x2f97('0x13')][_0x2f97('0x31')]();this[_0x2f97('0xd')][_0x3fd3f7['peer']][_0x2f97('0x41')]=_0x3fd3f7[_0x2f97('0x41')];logger[_0x2f97('0x25')](_0x2f97('0x45'),util['inspect'](this[_0x2f97('0xd')][_0x3fd3f7[_0x2f97('0x40')]],{'showHidden':![],'depth':null}));this[_0x2f97('0x22')](util[_0x2f97('0x34')](_0x2f97('0x36'),this[_0x2f97('0xd')][_0x3fd3f7[_0x2f97('0x40')]][_0x2f97('0x37')]),_0x2f97('0x38'),this[_0x2f97('0xd')][_0x3fd3f7[_0x2f97('0x40')]]);}else if(this[_0x2f97('0xb')][_0x3fd3f7['peer']]){this['trunks'][_0x3fd3f7[_0x2f97('0x40')]]['status']=_0x3fd3f7[_0x2f97('0x13')][_0x2f97('0x31')]();this[_0x2f97('0xb')][_0x3fd3f7[_0x2f97('0x40')]]['address']=_0x3fd3f7[_0x2f97('0x41')];logger['debug'](_0x2f97('0x46'),util[_0x2f97('0x1a')](this[_0x2f97('0xb')][_0x3fd3f7[_0x2f97('0x40')]],{'showHidden':![],'depth':null}));this[_0x2f97('0x22')](util[_0x2f97('0x34')](_0x2f97('0x47'),this['trunks'][_0x3fd3f7[_0x2f97('0x40')]]['name']),_0x2f97('0x2d'),this[_0x2f97('0xb')][_0x3fd3f7['peer']]);}}}catch(_0x4e8a3b){logger[_0x2f97('0x1c')](_0x2f97('0x42'),util[_0x2f97('0x1a')](_0x4e8a3b,{'showHidden':![],'depth':null}));}};module[_0x2f97('0x48')]=UserReport; \ No newline at end of file +var _0xe559=['emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','indexOf','mobile','accountcode','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','ioredis','bluebird','../../../config/environment','../../../config/logger','defaults','redis','localhost','trunks','agents','telephones','registryentry','bind','registry','syncRegistry','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','inspect','actionDeviceStateList','[userReport][devicestatelist]','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined'];(function(_0x57c087,_0x4fee10){var _0x5043d7=function(_0x504ac3){while(--_0x504ac3){_0x57c087['push'](_0x57c087['shift']());}};_0x5043d7(++_0x4fee10);}(_0xe559,0xc1));var _0x9e55=function(_0x1707a8,_0x204f72){_0x1707a8=_0x1707a8-0x0;var _0x564468=_0xe559[_0x1707a8];return _0x564468;};'use strict';var _=require(_0x9e55('0x0'));var moment=require(_0x9e55('0x1'));var util=require('util');var Redis=require(_0x9e55('0x2'));var BPromise=require(_0x9e55('0x3'));var config=require(_0x9e55('0x4'));var logger=require(_0x9e55('0x5'))('ami');var ami=require('../ami');config['redis']=_[_0x9e55('0x6')](config[_0x9e55('0x7')],{'host':_0x9e55('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function UserReport(_0x240e85){this['trunks']=_0x240e85[_0x9e55('0x9')];this[_0x9e55('0xa')]=_0x240e85[_0x9e55('0xa')];this[_0x9e55('0xb')]=_0x240e85[_0x9e55('0xb')];ami['on'](_0x9e55('0xc'),this['syncRegistry'][_0x9e55('0xd')](this));ami['on'](_0x9e55('0xe'),this[_0x9e55('0xf')][_0x9e55('0xd')](this));ami['on']('devicestatechange',this[_0x9e55('0x10')][_0x9e55('0xd')](this));ami['on'](_0x9e55('0x11'),this[_0x9e55('0x12')][_0x9e55('0xd')](this));return this[_0x9e55('0x13')]();}function showSipRegistrations(){Promise[_0x9e55('0x14')]()[_0x9e55('0x15')](ami[_0x9e55('0x16')]())[_0x9e55('0x17')](function(_0x211239){logger[_0x9e55('0x18')]('[userReport][sipshowregistry]',util[_0x9e55('0x19')](_0x211239,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0x9e55('0x15')](ami[_0x9e55('0x1a')]())[_0x9e55('0x17')](function(_0x17d448){logger[_0x9e55('0x18')](_0x9e55('0x1b'),util['inspect'](_0x17d448,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x9e55('0x14')]()[_0x9e55('0x15')](ami['actionSipPeerStatus']())[_0x9e55('0x17')](function(_0x1a1233){logger[_0x9e55('0x18')](_0x9e55('0x1c'),util[_0x9e55('0x19')](_0x1a1233,{'showHidden':![],'depth':null}));});}UserReport[_0x9e55('0x1d')][_0x9e55('0x13')]=function(){setInterval(function(){BPromise[_0x9e55('0x14')]()[_0x9e55('0x15')](showSipRegistrations())[_0x9e55('0x15')](listDeviceStates())[_0x9e55('0x15')](showPeersStatus());},0x32c8);};UserReport[_0x9e55('0x1d')][_0x9e55('0x1e')]=function(_0x4301eb){return _0x4301eb!==null&&!_[_0x9e55('0x1f')](_0x4301eb);};UserReport[_0x9e55('0x1d')]['emit']=function(_0x306739,_0x4887bb,_0x5bc77d){io['to'](_0x306739)[_0x9e55('0x20')](_0x4887bb,_0x5bc77d);};UserReport[_0x9e55('0x1d')][_0x9e55('0xf')]=function(_0x3ecb41){try{if(this[_0x9e55('0x1e')](_0x3ecb41)){logger[_0x9e55('0x21')](_0x9e55('0x22'),_0x3ecb41[_0x9e55('0x23')],_0x3ecb41[_0x9e55('0x24')]);logger[_0x9e55('0x25')](_0x9e55('0x26'),util['inspect'](_0x3ecb41,{'showHidden':![],'depth':null}));var _0x4b0a19=_[_0x9e55('0x27')](this[_0x9e55('0x9')],{'defaultuser':_0x3ecb41['username']});if(_0x4b0a19){_0x3ecb41[_0x9e55('0x28')]=_0x3ecb41[_0x9e55('0x24')];_['merge'](_0x4b0a19,_[_0x9e55('0x29')](_0x3ecb41,[_0x9e55('0x2a'),_0x9e55('0x2b'),'username','state']));logger['debug'](_0x9e55('0x2c'),util['inspect'](_0x4b0a19,{'showHidden':![],'depth':null}));this[_0x9e55('0x20')](util[_0x9e55('0x2d')](_0x9e55('0x2e'),_0x4b0a19[_0x9e55('0x2f')]),_0x9e55('0x30'),_0x4b0a19);}}}catch(_0x55212f){logger['error'](_0x9e55('0x26'),util[_0x9e55('0x19')](_0x55212f,{'showHidden':![],'depth':null}));}};UserReport[_0x9e55('0x1d')][_0x9e55('0x10')]=function(_0x2b65e9){try{if(this[_0x9e55('0x1e')](_0x2b65e9)){logger[_0x9e55('0x21')](_0x9e55('0x31'),_0x2b65e9[_0x9e55('0x32')],_0x2b65e9['state']);logger[_0x9e55('0x25')](_0x9e55('0x33'),util[_0x9e55('0x19')](_0x2b65e9,{'showHidden':![],'depth':null}));if(this[_0x9e55('0xa')][_0x2b65e9['device']]){if(!this[_0x9e55('0xa')][_0x2b65e9[_0x9e55('0x32')]][_0x9e55('0x34')]||_0x2b65e9[_0x9e55('0x24')][_0x9e55('0x35')]()==_0x9e55('0x36')){this['agents'][_0x2b65e9[_0x9e55('0x32')]][_0x9e55('0x34')]=![];if(this[_0x9e55('0xa')][_0x2b65e9['device']][_0x9e55('0x24')]!==_0x2b65e9[_0x9e55('0x24')][_0x9e55('0x35')]()){this['agents'][_0x2b65e9['device']][_0x9e55('0x37')]=_[_0x9e55('0x38')](moment()[_0x9e55('0x2d')]('x'));}this[_0x9e55('0xa')][_0x2b65e9['device']]['state']=_0x2b65e9[_0x9e55('0x24')][_0x9e55('0x35')]();this[_0x9e55('0xa')][_0x2b65e9[_0x9e55('0x32')]][_0x9e55('0x39')](_0x2b65e9);}}else if(this['telephones'][_0x2b65e9[_0x9e55('0x32')]]){if(this['telephones'][_0x2b65e9[_0x9e55('0x32')]][_0x9e55('0x24')]!==_0x2b65e9['state']['toLowerCase']()){this['telephones'][_0x2b65e9['device']][_0x9e55('0x37')]=_['toNumber'](moment()[_0x9e55('0x2d')]('x'));}this[_0x9e55('0xb')][_0x2b65e9[_0x9e55('0x32')]][_0x9e55('0x24')]=_0x2b65e9[_0x9e55('0x24')][_0x9e55('0x35')]();logger[_0x9e55('0x25')](_0x9e55('0x3a'),util[_0x9e55('0x19')](this[_0x9e55('0xb')][_0x2b65e9[_0x9e55('0x32')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x9e55('0x2d')](_0x9e55('0x3b'),this[_0x9e55('0xb')][_0x2b65e9[_0x9e55('0x32')]][_0x9e55('0x2f')]),_0x9e55('0x3c'),this[_0x9e55('0xb')][_0x2b65e9['device']]);}else if(this[_0x9e55('0x9')][_0x2b65e9['device']]){if(this[_0x9e55('0x9')][_0x2b65e9['device']][_0x9e55('0x24')]!==_0x2b65e9['state']['toLowerCase']()){this[_0x9e55('0x9')][_0x2b65e9[_0x9e55('0x32')]][_0x9e55('0x37')]=_[_0x9e55('0x38')](moment()[_0x9e55('0x2d')]('x'));}this[_0x9e55('0x9')][_0x2b65e9['device']]['state']=_0x2b65e9[_0x9e55('0x24')][_0x9e55('0x35')]();logger['debug'](_0x9e55('0x3d'),util[_0x9e55('0x19')](this[_0x9e55('0x9')][_0x2b65e9[_0x9e55('0x32')]],{'showHidden':![],'depth':null}));this[_0x9e55('0x20')](util['format'](_0x9e55('0x2e'),this['trunks'][_0x2b65e9[_0x9e55('0x32')]]['name']),'trunk:save',this[_0x9e55('0x9')][_0x2b65e9[_0x9e55('0x32')]]);}else if(_[_0x9e55('0x3e')](_0x2b65e9[_0x9e55('0x32')],_0x9e55('0x3f'))){var _0x183739=_0x2b65e9[_0x9e55('0x32')];var _0x1f89bd=_0x183739['substring'](_0x183739[_0x9e55('0x40')]('/')+0x1,_0x183739[_0x9e55('0x40')]('@'));var _0x42b532=_[_0x9e55('0x27')](this['agents'],function(_0x4cde80){return _0x4cde80[_0x9e55('0x41')]==_0x1f89bd||_0x4cde80['phone']==_0x1f89bd||_0x4cde80[_0x9e55('0x42')]==_0x1f89bd;});if(_0x42b532){if(_0x42b532[_0x9e55('0x24')]!==_0x2b65e9['state'][_0x9e55('0x35')]()){_0x42b532[_0x9e55('0x37')]=_['toNumber'](moment()[_0x9e55('0x2d')]('x'));}_0x42b532['state']=_0x2b65e9[_0x9e55('0x24')][_0x9e55('0x35')]();_0x42b532[_0x9e55('0x34')]=!![];_0x42b532[_0x9e55('0x39')](_0x2b65e9);}}}}catch(_0x3c92dc){logger['error'](_0x9e55('0x33'),util['inspect'](_0x3c92dc,{'showHidden':![],'depth':null}));}};UserReport[_0x9e55('0x1d')][_0x9e55('0x12')]=function(_0x6da233){try{if(this[_0x9e55('0x1e')](_0x6da233)&&this[_0x9e55('0x1e')](_0x6da233[_0x9e55('0x11')])){logger['info']('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x6da233[_0x9e55('0x43')],_0x6da233[_0x9e55('0x44')],_0x6da233[_0x9e55('0x11')]);logger[_0x9e55('0x25')](_0x9e55('0x45'),util[_0x9e55('0x19')](_0x6da233,{'showHidden':![],'depth':null}));if(this['agents'][_0x6da233[_0x9e55('0x43')]]){if(!this[_0x9e55('0xa')][_0x6da233['peer']]['local']||_0x6da233[_0x9e55('0x11')][_0x9e55('0x35')]()==_0x9e55('0x46')){this['agents'][_0x6da233[_0x9e55('0x43')]]['local']=![];this[_0x9e55('0xa')][_0x6da233[_0x9e55('0x43')]]['status']=_0x6da233[_0x9e55('0x11')][_0x9e55('0x35')]();this[_0x9e55('0xa')][_0x6da233[_0x9e55('0x43')]][_0x9e55('0x44')]=_0x6da233['address'];this[_0x9e55('0xa')][_0x6da233[_0x9e55('0x43')]][_0x9e55('0x39')](_0x6da233);}}else if(this[_0x9e55('0xb')][_0x6da233[_0x9e55('0x43')]]){this[_0x9e55('0xb')][_0x6da233[_0x9e55('0x43')]][_0x9e55('0x47')]=_0x6da233[_0x9e55('0x11')][_0x9e55('0x35')]();this[_0x9e55('0xb')][_0x6da233[_0x9e55('0x43')]][_0x9e55('0x44')]=_0x6da233[_0x9e55('0x44')];logger[_0x9e55('0x25')](_0x9e55('0x48'),util[_0x9e55('0x19')](this['telephones'][_0x6da233[_0x9e55('0x43')]],{'showHidden':![],'depth':null}));this[_0x9e55('0x20')](util[_0x9e55('0x2d')](_0x9e55('0x3b'),this[_0x9e55('0xb')][_0x6da233[_0x9e55('0x43')]]['name']),'telephone:save',this[_0x9e55('0xb')][_0x6da233[_0x9e55('0x43')]]);}else if(this[_0x9e55('0x9')][_0x6da233[_0x9e55('0x43')]]){this[_0x9e55('0x9')][_0x6da233['peer']]['status']=_0x6da233['peerstatus'][_0x9e55('0x35')]();this['trunks'][_0x6da233[_0x9e55('0x43')]][_0x9e55('0x44')]=_0x6da233[_0x9e55('0x44')];logger[_0x9e55('0x25')](_0x9e55('0x49'),util['inspect'](this[_0x9e55('0x9')][_0x6da233[_0x9e55('0x43')]],{'showHidden':![],'depth':null}));this[_0x9e55('0x20')](util[_0x9e55('0x2d')](_0x9e55('0x2e'),this['trunks'][_0x6da233[_0x9e55('0x43')]]['name']),_0x9e55('0x30'),this['trunks'][_0x6da233['peer']]);}}}catch(_0x189f39){logger[_0x9e55('0x18')](_0x9e55('0x45'),util[_0x9e55('0x19')](_0x189f39,{'showHidden':![],'depth':null}));}};module[_0x9e55('0x4a')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 92bc0a9..7c44bc3 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','voice','merge','omit','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connectedlinenum','destchannelstatedesc','holdtime','lastevent','connect','voiceChannels','routealias','interface','pick','queue','destconnectedlinenum','channel','name','accountcode','exten','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','agentringnoanswer','reason','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][agentcomplete]\x20event:','agentconnectAt','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','destaccountcode','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/logger','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind'];(function(_0x159684,_0x188460){var _0x14c865=function(_0x113622){while(--_0x113622){_0x159684['push'](_0x159684['shift']());}};_0x14c865(++_0x188460);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}var _0x16b1ca=this['agents'][_0x155cce['interface']];var _0x197ec0=this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]];var _0x526cf3=this[_0x0a9e('0x9')][_0x155cce['queue']];var _0x45a1e7=this['variables'][_0x155cce[_0x0a9e('0x26')]];if(_[_0x0a9e('0x1f')](_0x197ec0)){_0x197ec0={'agentcalledAt':moment()[_0x0a9e('0x27')](_0x0a9e('0x28')),'lastevent':_0x0a9e('0x29'),'mandatoryDisposition':_0x526cf3&&_0x526cf3[_0x0a9e('0x2a')]?_0x526cf3[_0x0a9e('0x2a')]:![],'type':_0x526cf3&&_0x526cf3[_0x0a9e('0x2b')]?_0x526cf3['type']:_0x0a9e('0x2c'),'variables':_0x45a1e7,'motionChannel':_0x0a9e('0x2d')};}_[_0x0a9e('0x2e')](_0x197ec0,_[_0x0a9e('0x2f')](_0x155cce,['event',_0x0a9e('0x30')]));logger[_0x0a9e('0x23')](_0x0a9e('0x31'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x197ec0,{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x32'),_0x197ec0);var _0x2e8759={'id':_0x16b1ca['id'],'calleridnum':_0x197ec0[_0x0a9e('0x33')],'queue':_0x197ec0['queue'],'variables':_0x197ec0[_0x0a9e('0xb')],'uniqueid':_0x155cce['uniqueid']};logger[_0x0a9e('0x23')](_0x0a9e('0x34'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2e8759,{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util['format'](_0x0a9e('0x35'),_0x155cce[_0x0a9e('0x21')]),_0x0a9e('0x36'),_0x2e8759);}}catch(_0x2da5c0){logger[_0x0a9e('0x37')](_0x0a9e('0x38'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2da5c0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x39')]=function(_0x5e7238){try{if(this[_0x0a9e('0x1e')](_0x5e7238)){if(this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]]){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0x5e7238[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x5e7238,{'showHidden':![],'depth':null}));for(var _0x1fa90d in this[_0x0a9e('0x8')][_0x5e7238['uniqueid']]){if(this['channels'][_0x5e7238[_0x0a9e('0x26')]]['hasOwnProperty'](_0x1fa90d)){if(_0x5e7238[_0x0a9e('0x22')]===_0x1fa90d){logger[_0x0a9e('0x20')](_0x0a9e('0x3a'),_0x5e7238[_0x0a9e('0x26')],_0x5e7238['membername'],_0x5e7238[_0x0a9e('0x22')]);this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]][_0x1fa90d]['agentconnectAt']=moment()[_0x0a9e('0x27')](_0x0a9e('0x28'));this[_0x0a9e('0x8')][_0x5e7238['uniqueid']][_0x1fa90d]['connectedlinename']=_0x5e7238[_0x0a9e('0x3b')];this[_0x0a9e('0x8')][_0x5e7238['uniqueid']][_0x1fa90d][_0x0a9e('0x3c')]=_0x5e7238[_0x0a9e('0x3c')];this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]][_0x1fa90d]['destchannelstate']=_0x5e7238['destchannelstate'];this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]][_0x1fa90d]['destchannelstatedesc']=_0x5e7238[_0x0a9e('0x3d')];this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]][_0x1fa90d]['holdtime']=_0x5e7238[_0x0a9e('0x3e')];this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]][_0x1fa90d][_0x0a9e('0x3f')]=_0x0a9e('0x40');if(this[_0x0a9e('0x41')][this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]][_0x1fa90d][_0x0a9e('0x26')]]){var _0x3da2cd=this[_0x0a9e('0x41')][this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]][_0x1fa90d][_0x0a9e('0x26')]][_0x0a9e('0x42')];this['channels'][_0x5e7238['uniqueid']][_0x1fa90d][_0x0a9e('0x42')]=_0x3da2cd;_0x5e7238[_0x0a9e('0x42')]=_0x3da2cd;}_[_0x0a9e('0x2e')](this[_0x0a9e('0xa')][_0x5e7238[_0x0a9e('0x43')]],_[_0x0a9e('0x44')](_0x5e7238,[_0x0a9e('0x45'),_0x0a9e('0x46'),_0x0a9e('0x42')]));var _0x25c6e6=this[_0x0a9e('0xa')][_0x5e7238[_0x0a9e('0x47')]['split']('-')[0x0]];var _0x117c99={'id':_0x25c6e6['id'],'name':_0x25c6e6[_0x0a9e('0x48')],'agentconnected':!![],'destaccountcode':_0x25c6e6[_0x0a9e('0x49')],'destconnectedlinenum':this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]][_0x5e7238[_0x0a9e('0x22')]][_0x0a9e('0x4a')],'queue':this[_0x0a9e('0x8')][_0x5e7238['uniqueid']][_0x5e7238[_0x0a9e('0x22')]]['queue'],'routealias':this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]][_0x5e7238[_0x0a9e('0x22')]]['routealias'],'uniqueid':this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]][_0x5e7238[_0x0a9e('0x22')]][_0x0a9e('0x26')]};logger[_0x0a9e('0x23')](_0x0a9e('0x4b'),_0x5e7238[_0x0a9e('0x26')],util['inspect'](_0x117c99,{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x4c'),_0x117c99);logger[_0x0a9e('0x23')](_0x0a9e('0x4d'),_0x5e7238[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x117c99,{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x27')](_0x0a9e('0x35'),_0x5e7238['membername']),_0x0a9e('0x4e'),_0x117c99);}else if(!this[_0x0a9e('0x8')][_0x5e7238['uniqueid']][_0x1fa90d]['agentringnoanswer']&&!this['channels'][_0x5e7238[_0x0a9e('0x26')]][_0x1fa90d][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x4f'),_0x5e7238[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]][_0x1fa90d][_0x0a9e('0x21')],_0x1fa90d);this['channels'][_0x5e7238['uniqueid']][_0x1fa90d]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]][_0x1fa90d][_0x0a9e('0x50')]=moment()['format'](_0x0a9e('0x28'));this[_0x0a9e('0x8')][_0x5e7238['uniqueid']][_0x1fa90d]['answeredelsewheredestinationuniqueid']=_0x5e7238[_0x0a9e('0x22')];this['channels'][_0x5e7238[_0x0a9e('0x26')]][_0x1fa90d]['answeredelsewheremembername']=_0x5e7238[_0x0a9e('0x21')];this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]][_0x1fa90d]['lastevent']=_0x0a9e('0x51');this[_0x0a9e('0x8')][_0x5e7238['uniqueid']][_0x1fa90d]['reason']=_0x0a9e('0x51');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x5e7238[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x5e7238['uniqueid']][_0x1fa90d],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentansweredelsewhere',this['channels'][_0x5e7238['uniqueid']][_0x1fa90d]);}}}}}}catch(_0x2da03c){logger['error'](_0x0a9e('0x52'),_0x5e7238[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2da03c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x53')]=function(_0x272738){try{if(this[_0x0a9e('0x1e')](_0x272738)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x272738[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x272738,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']]){logger[_0x0a9e('0x20')](_0x0a9e('0x54'),_0x272738['uniqueid'],_0x272738[_0x0a9e('0x21')],_0x272738['destuniqueid']);var _0x20c668=this['agents'][_0x272738['interface']];var _0x5674ee=this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738[_0x0a9e('0x22')]];_0x5674ee[_0x0a9e('0x55')]=!![];_0x5674ee[_0x0a9e('0x50')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x28'));_0x5674ee[_0x0a9e('0x3f')]='rejected';_0x5674ee[_0x0a9e('0x56')]='rejected';var _0xca4ade={'id':_0x20c668['id'],'name':_0x20c668[_0x0a9e('0x48')],'queue':_0x5674ee[_0x0a9e('0x45')],'uniqueid':_0x5674ee['uniqueid']};logger[_0x0a9e('0x23')](_0x0a9e('0x57'),_0x272738[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xca4ade,{'showHidden':![],'depth':null}));this['emit'](util[_0x0a9e('0x27')](_0x0a9e('0x35'),_0x20c668['name']),_0x0a9e('0x58'),_0xca4ade);ami[_0x0a9e('0x1d')](_0x0a9e('0x59'),_0x5674ee);}}}catch(_0x409b29){logger[_0x0a9e('0x37')]('[%s][voiceAgentReport][agentringnoanswer]',_0x272738[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x409b29,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncQueueCallerAbandon']=function(_0x3528b7){try{if(this['isNotNull'](_0x3528b7)){logger['debug'](_0x0a9e('0x5a'),_0x3528b7[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3528b7,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x3528b7[_0x0a9e('0x26')]]){for(var _0xc8c264 in this[_0x0a9e('0x8')][_0x3528b7[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x3528b7[_0x0a9e('0x26')]][_0x0a9e('0x5b')](_0xc8c264)&&!this[_0x0a9e('0x8')][_0x3528b7[_0x0a9e('0x26')]][_0xc8c264][_0x0a9e('0x55')]&&!this[_0x0a9e('0x8')][_0x3528b7[_0x0a9e('0x26')]][_0xc8c264][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x3528b7[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x3528b7[_0x0a9e('0x26')]][_0xc8c264]['membername'],_0xc8c264);this[_0x0a9e('0x8')][_0x3528b7[_0x0a9e('0x26')]][_0xc8c264]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x3528b7[_0x0a9e('0x26')]][_0xc8c264][_0x0a9e('0x50')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x28'));this['channels'][_0x3528b7['uniqueid']][_0xc8c264]['lastevent']=_0x0a9e('0x5c');this[_0x0a9e('0x8')][_0x3528b7[_0x0a9e('0x26')]][_0xc8c264][_0x0a9e('0x56')]=_0x0a9e('0x5c');logger[_0x0a9e('0x23')](_0x0a9e('0x5d'),_0x3528b7[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x3528b7[_0x0a9e('0x26')]][_0xc8c264],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentqueuecallerabandon',this[_0x0a9e('0x8')][_0x3528b7['uniqueid']][_0xc8c264]);}}}}}catch(_0x4437ff){logger[_0x0a9e('0x37')]('[%s][voiceAgentReport][queuecallerabandon]',_0x3528b7[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4437ff,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x13')]=function(_0x542ece){try{if(this[_0x0a9e('0x1e')](_0x542ece)){logger[_0x0a9e('0x23')](_0x0a9e('0x5e'),_0x542ece[_0x0a9e('0x26')],util['inspect'](_0x542ece,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x542ece[_0x0a9e('0x26')]]){for(var _0x2d5506 in this[_0x0a9e('0x8')][_0x542ece['uniqueid']]){if(this[_0x0a9e('0x8')][_0x542ece[_0x0a9e('0x26')]][_0x0a9e('0x5b')](_0x2d5506)){if(this[_0x0a9e('0x8')][_0x542ece[_0x0a9e('0x26')]][_0x2d5506][_0x0a9e('0x5f')]&&!this[_0x0a9e('0x8')][_0x542ece[_0x0a9e('0x26')]][_0x2d5506][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x60'),_0x542ece[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x542ece[_0x0a9e('0x26')]][_0x2d5506]['membername'],_0x2d5506);this[_0x0a9e('0x8')][_0x542ece[_0x0a9e('0x26')]][_0x2d5506][_0x0a9e('0x12')]=!![];this['channels'][_0x542ece[_0x0a9e('0x26')]][_0x2d5506][_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x28'));this['channels'][_0x542ece['uniqueid']][_0x2d5506][_0x0a9e('0x3f')]=_0x0a9e('0x62');this['channels'][_0x542ece[_0x0a9e('0x26')]][_0x2d5506]['reason']=_0x542ece[_0x0a9e('0x56')]==_0x0a9e('0x63')?'agent':_0x542ece[_0x0a9e('0x56')];this[_0x0a9e('0x8')][_0x542ece[_0x0a9e('0x26')]][_0x2d5506][_0x0a9e('0x64')]=_0x542ece[_0x0a9e('0x64')];if(this[_0x0a9e('0x9')][_0x542ece[_0x0a9e('0x45')]]&&this['voiceQueues'][_0x542ece[_0x0a9e('0x45')]][_0x0a9e('0x65')]){this[_0x0a9e('0x8')][_0x542ece[_0x0a9e('0x26')]][_0x2d5506]['acwtime']=this[_0x0a9e('0x9')][_0x542ece[_0x0a9e('0x45')]]['acwTimeout'];this[_0x0a9e('0x8')][_0x542ece['uniqueid']][_0x2d5506][_0x0a9e('0x66')]=!![];}this[_0x0a9e('0xa')][_0x542ece[_0x0a9e('0x43')]]=_[_0x0a9e('0x2f')](this['agents'][_0x542ece['interface']],[_0x0a9e('0x45'),_0x0a9e('0x46')]);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x542ece[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x542ece['uniqueid']][_0x2d5506],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentcomplete',this['channels'][_0x542ece['uniqueid']][_0x2d5506]);logger[_0x0a9e('0x23')](_0x0a9e('0x67'),_0x542ece[_0x0a9e('0x26')],util[_0x0a9e('0x25')]({'id':this[_0x0a9e('0xa')][_0x542ece[_0x0a9e('0x43')]]['id'],'destaccountcode':_0x542ece['destaccountcode']},{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util['format'](_0x0a9e('0x35'),_0x542ece[_0x0a9e('0x21')]),_0x0a9e('0x68'),{'id':this[_0x0a9e('0xa')][_0x542ece['interface']]['id'],'destaccountcode':Number(_0x542ece[_0x0a9e('0x69')])});}}}}}}catch(_0x32f761){logger[_0x0a9e('0x37')]('[%s][voiceAgentReport][agentcomplete]',_0x542ece[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x32f761,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x255e49){try{if(this[_0x0a9e('0x1e')](_0x255e49)){logger[_0x0a9e('0x23')](_0x0a9e('0x6a'),_0x255e49['uniqueid'],util[_0x0a9e('0x25')](_0x255e49,{'showHidden':![],'depth':null}));this[_0x0a9e('0x6b')](_0x255e49['uniqueid'],_[_0x0a9e('0x6c')](_0x255e49[_0x0a9e('0x6d')])[0x0],_0x255e49[_0x0a9e('0x6e')]);if(this['channels'][_0x255e49[_0x0a9e('0x26')]]){for(var _0x52ec10 in this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x0a9e('0x5b')](_0x52ec10)){logger[_0x0a9e('0x20')](_0x0a9e('0x6f'),_0x255e49[_0x0a9e('0x26')],_0x52ec10,_['keys'](_0x255e49[_0x0a9e('0x6d')])[0x0],_0x255e49[_0x0a9e('0x6e')]);if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')])){this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]=this[_0x0a9e('0xb')][_0x255e49['uniqueid']];}}}}}catch(_0xc81b64){logger[_0x0a9e('0x37')](_0x0a9e('0x70'),_0x255e49[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xc81b64,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x6b')]=function(_0x1756c7,_0x5ce99d,_0x23b447){var _0x5e725e=[_0x0a9e('0x71'),_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),'rtpaudioqosloss',_0x0a9e('0x75'),'rtpaudioqosrtt',_0x0a9e('0x76'),_0x0a9e('0x77'),'sipuri',_0x0a9e('0x78'),_0x0a9e('0x79'),_0x0a9e('0x7a'),'memberdynamic','memberinterface',_0x0a9e('0x7b'),_0x0a9e('0x21'),_0x0a9e('0x7c'),_0x0a9e('0x7d')];if(!_[_0x0a9e('0x7e')](_0x5ce99d)&&!_[_0x0a9e('0x7f')](_0x5e725e,_0x5ce99d)){if(_[_0x0a9e('0x1f')](this[_0x0a9e('0xb')][_0x1756c7])){this[_0x0a9e('0xb')][_0x1756c7]={};}this['variables'][_0x1756c7][_0x5ce99d]=_0x23b447;}};VoiceAgentReport[_0x0a9e('0x1c')]['syncHangup']=function(_0x287324){try{if(this[_0x0a9e('0x1e')](_0x287324)){logger[_0x0a9e('0x23')](_0x0a9e('0x80'),_0x287324[_0x0a9e('0x26')],util['inspect'](_0x287324,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){for(var _0x2791c5 in this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){if(this['channels'][_0x287324['uniqueid']][_0x0a9e('0x5b')](_0x2791c5)){if(this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x56')]==_0x0a9e('0x63')&&this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x287324[_0x0a9e('0x26')],_0x2791c5);this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5]['agentcompleteAt']=moment()[_0x0a9e('0x27')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug'](_0x0a9e('0x81'),_0x287324[_0x0a9e('0x26')],util['inspect'](_[_0x0a9e('0x82')](this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x83'),_['values'](this['channels'][_0x287324[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]];}if(this[_0x0a9e('0xb')][_0x287324[_0x0a9e('0x26')]]){delete this['variables'][_0x287324[_0x0a9e('0x26')]];}}}catch(_0xadce3d){logger['error'](_0x0a9e('0x84'),_0x287324[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xadce3d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x85')]=function(_0x23b39e){try{if(this[_0x0a9e('0x1e')](_0x23b39e)){logger[_0x0a9e('0x23')](_0x0a9e('0x86'),_0x23b39e[_0x0a9e('0x26')],util['inspect'](_0x23b39e,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x87')]]){for(var _0x2ada60 in this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x87')]]){if(this['channels'][_0x23b39e['transfereeuniqueid']][_0x0a9e('0x5b')](_0x2ada60)){if(_0x23b39e[_0x0a9e('0x88')]===_0x2ada60){logger[_0x0a9e('0x20')](_0x0a9e('0x89'),_0x23b39e[_0x0a9e('0x26')],this['channels'][_0x23b39e[_0x0a9e('0x87')]][_0x2ada60][_0x0a9e('0x21')],_0x2ada60);var _0x3450ae=moment();this['channels'][_0x23b39e[_0x0a9e('0x87')]][_0x2ada60]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x23b39e['transfereeuniqueid']][_0x2ada60][_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x28'));this['channels'][_0x23b39e[_0x0a9e('0x87')]][_0x2ada60]['lastevent']=_0x0a9e('0x62');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x87')]][_0x2ada60][_0x0a9e('0x56')]=_0x0a9e('0x63');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x87')]][_0x2ada60][_0x0a9e('0x64')]=_0x3450ae[_0x0a9e('0x8a')](this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x87')]][_0x2ada60][_0x0a9e('0x5f')],_0x0a9e('0x8b'));}}}}if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x8c')]]){var _0x248368=this['channels'][_0x23b39e['secondtransfereruniqueid']];this[_0x0a9e('0x8')][_0x23b39e['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x87')]];this['channels'][_0x23b39e[_0x0a9e('0x87')]]=_0x248368;}}}catch(_0xe2b083){logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x23b39e['uniqueid'],util[_0x0a9e('0x25')](_0xe2b083,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1b')]=function(_0x34a791){try{if(this['isNotNull'](_0x34a791)){logger[_0x0a9e('0x23')](_0x0a9e('0x8e'),_0x34a791[_0x0a9e('0x26')],util['inspect'](_0x34a791,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x87')]]){for(var _0x17b29d in this['channels'][_0x34a791[_0x0a9e('0x87')]]){if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x87')]][_0x0a9e('0x5b')](_0x17b29d)){if(_0x34a791[_0x0a9e('0x8f')]===_0x17b29d){logger['info'](_0x0a9e('0x90'),_0x34a791[_0x0a9e('0x26')],this['channels'][_0x34a791[_0x0a9e('0x87')]][_0x17b29d][_0x0a9e('0x21')],_0x17b29d);var _0x1f6f1c=moment();this['channels'][_0x34a791['transfereeuniqueid']][_0x17b29d]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x87')]][_0x17b29d]['agentcompleteAt']=_0x1f6f1c;this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x87')]][_0x17b29d][_0x0a9e('0x3f')]='complete';this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x87')]][_0x17b29d][_0x0a9e('0x56')]=_0x0a9e('0x63');this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x87')]][_0x17b29d][_0x0a9e('0x64')]=_0x1f6f1c[_0x0a9e('0x8a')](this[_0x0a9e('0x8')][_0x34a791['transfereeuniqueid']][_0x17b29d][_0x0a9e('0x5f')],'seconds');}}}}}}catch(_0x138cf5){logger[_0x0a9e('0x37')](_0x0a9e('0x91'),_0x34a791[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x138cf5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStart']=function(_0x1a0314){var _0x33da81='';try{if(this[_0x0a9e('0x1e')](_0x1a0314)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1a0314,{'showHidden':![],'depth':null}));if(_0x1a0314[_0x0a9e('0x47')]){_0x33da81=_0x1a0314[_0x0a9e('0x47')][_0x0a9e('0x92')](0x0,_0x1a0314[_0x0a9e('0x47')][_0x0a9e('0x93')]('-'));if(this[_0x0a9e('0xa')][_0x33da81]){logger[_0x0a9e('0x20')](_0x0a9e('0x94'),_0x1a0314['uniqueid'],_0x33da81);this[_0x0a9e('0xa')][_0x33da81][_0x0a9e('0x95')]=!![];}}}}catch(_0x2ff265){logger[_0x0a9e('0x37')](_0x0a9e('0x96'),_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2ff265,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStop']=function(_0x3b581c){var _0xd2391='';try{if(this[_0x0a9e('0x1e')](_0x3b581c)){logger['debug'](_0x0a9e('0x97'),_0x3b581c[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3b581c,{'showHidden':![],'depth':null}));if(_0x3b581c[_0x0a9e('0x47')]){_0xd2391=_0x3b581c[_0x0a9e('0x47')][_0x0a9e('0x92')](0x0,_0x3b581c[_0x0a9e('0x47')][_0x0a9e('0x93')]('-'));if(this[_0x0a9e('0xa')][_0xd2391]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x3b581c[_0x0a9e('0x26')],_0xd2391);this[_0x0a9e('0xa')][_0xd2391][_0x0a9e('0x95')]=![];}}}}catch(_0x3db98f){logger[_0x0a9e('0x37')](_0x0a9e('0x98'),_0x3b581c['uniqueid'],util[_0x0a9e('0x25')](_0x3db98f,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xa9e0=['agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','voice','merge','omit','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connectedlinenum','destchannelstatedesc','holdtime','lastevent','connect','voiceChannels','routealias','interface','pick','queue','destconnectedlinenum','channel','name','accountcode','exten','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','agentringnoanswer','reason','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][agentcomplete]\x20event:','agentconnectAt','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','destaccountcode','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/logger','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind'];(function(_0x3c1a06,_0x4efcfe){var _0x507f57=function(_0x5d4acc){while(--_0x5d4acc){_0x3c1a06['push'](_0x3c1a06['shift']());}};_0x507f57(++_0x4efcfe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}var _0x16b1ca=this['agents'][_0x155cce['interface']];var _0x197ec0=this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]];var _0x526cf3=this[_0x0a9e('0x9')][_0x155cce['queue']];var _0x45a1e7=this['variables'][_0x155cce[_0x0a9e('0x26')]];if(_[_0x0a9e('0x1f')](_0x197ec0)){_0x197ec0={'agentcalledAt':moment()[_0x0a9e('0x27')](_0x0a9e('0x28')),'lastevent':_0x0a9e('0x29'),'mandatoryDisposition':_0x526cf3&&_0x526cf3[_0x0a9e('0x2a')]?_0x526cf3[_0x0a9e('0x2a')]:![],'type':_0x526cf3&&_0x526cf3[_0x0a9e('0x2b')]?_0x526cf3['type']:_0x0a9e('0x2c'),'variables':_0x45a1e7,'motionChannel':_0x0a9e('0x2d')};}_[_0x0a9e('0x2e')](_0x197ec0,_[_0x0a9e('0x2f')](_0x155cce,['event',_0x0a9e('0x30')]));logger[_0x0a9e('0x23')](_0x0a9e('0x31'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x197ec0,{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x32'),_0x197ec0);var _0x2e8759={'id':_0x16b1ca['id'],'calleridnum':_0x197ec0[_0x0a9e('0x33')],'queue':_0x197ec0['queue'],'variables':_0x197ec0[_0x0a9e('0xb')],'uniqueid':_0x155cce['uniqueid']};logger[_0x0a9e('0x23')](_0x0a9e('0x34'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2e8759,{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util['format'](_0x0a9e('0x35'),_0x155cce[_0x0a9e('0x21')]),_0x0a9e('0x36'),_0x2e8759);}}catch(_0x2da5c0){logger[_0x0a9e('0x37')](_0x0a9e('0x38'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2da5c0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x39')]=function(_0x5e7238){try{if(this[_0x0a9e('0x1e')](_0x5e7238)){if(this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]]){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0x5e7238[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x5e7238,{'showHidden':![],'depth':null}));for(var _0x1fa90d in this[_0x0a9e('0x8')][_0x5e7238['uniqueid']]){if(this['channels'][_0x5e7238[_0x0a9e('0x26')]]['hasOwnProperty'](_0x1fa90d)){if(_0x5e7238[_0x0a9e('0x22')]===_0x1fa90d){logger[_0x0a9e('0x20')](_0x0a9e('0x3a'),_0x5e7238[_0x0a9e('0x26')],_0x5e7238['membername'],_0x5e7238[_0x0a9e('0x22')]);this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]][_0x1fa90d]['agentconnectAt']=moment()[_0x0a9e('0x27')](_0x0a9e('0x28'));this[_0x0a9e('0x8')][_0x5e7238['uniqueid']][_0x1fa90d]['connectedlinename']=_0x5e7238[_0x0a9e('0x3b')];this[_0x0a9e('0x8')][_0x5e7238['uniqueid']][_0x1fa90d][_0x0a9e('0x3c')]=_0x5e7238[_0x0a9e('0x3c')];this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]][_0x1fa90d]['destchannelstate']=_0x5e7238['destchannelstate'];this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]][_0x1fa90d]['destchannelstatedesc']=_0x5e7238[_0x0a9e('0x3d')];this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]][_0x1fa90d]['holdtime']=_0x5e7238[_0x0a9e('0x3e')];this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]][_0x1fa90d][_0x0a9e('0x3f')]=_0x0a9e('0x40');if(this[_0x0a9e('0x41')][this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]][_0x1fa90d][_0x0a9e('0x26')]]){var _0x3da2cd=this[_0x0a9e('0x41')][this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]][_0x1fa90d][_0x0a9e('0x26')]][_0x0a9e('0x42')];this['channels'][_0x5e7238['uniqueid']][_0x1fa90d][_0x0a9e('0x42')]=_0x3da2cd;_0x5e7238[_0x0a9e('0x42')]=_0x3da2cd;}_[_0x0a9e('0x2e')](this[_0x0a9e('0xa')][_0x5e7238[_0x0a9e('0x43')]],_[_0x0a9e('0x44')](_0x5e7238,[_0x0a9e('0x45'),_0x0a9e('0x46'),_0x0a9e('0x42')]));var _0x25c6e6=this[_0x0a9e('0xa')][_0x5e7238[_0x0a9e('0x47')]['split']('-')[0x0]];var _0x117c99={'id':_0x25c6e6['id'],'name':_0x25c6e6[_0x0a9e('0x48')],'agentconnected':!![],'destaccountcode':_0x25c6e6[_0x0a9e('0x49')],'destconnectedlinenum':this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]][_0x5e7238[_0x0a9e('0x22')]][_0x0a9e('0x4a')],'queue':this[_0x0a9e('0x8')][_0x5e7238['uniqueid']][_0x5e7238[_0x0a9e('0x22')]]['queue'],'routealias':this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]][_0x5e7238[_0x0a9e('0x22')]]['routealias'],'uniqueid':this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]][_0x5e7238[_0x0a9e('0x22')]][_0x0a9e('0x26')]};logger[_0x0a9e('0x23')](_0x0a9e('0x4b'),_0x5e7238[_0x0a9e('0x26')],util['inspect'](_0x117c99,{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x4c'),_0x117c99);logger[_0x0a9e('0x23')](_0x0a9e('0x4d'),_0x5e7238[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x117c99,{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x27')](_0x0a9e('0x35'),_0x5e7238['membername']),_0x0a9e('0x4e'),_0x117c99);}else if(!this[_0x0a9e('0x8')][_0x5e7238['uniqueid']][_0x1fa90d]['agentringnoanswer']&&!this['channels'][_0x5e7238[_0x0a9e('0x26')]][_0x1fa90d][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x4f'),_0x5e7238[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]][_0x1fa90d][_0x0a9e('0x21')],_0x1fa90d);this['channels'][_0x5e7238['uniqueid']][_0x1fa90d]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]][_0x1fa90d][_0x0a9e('0x50')]=moment()['format'](_0x0a9e('0x28'));this[_0x0a9e('0x8')][_0x5e7238['uniqueid']][_0x1fa90d]['answeredelsewheredestinationuniqueid']=_0x5e7238[_0x0a9e('0x22')];this['channels'][_0x5e7238[_0x0a9e('0x26')]][_0x1fa90d]['answeredelsewheremembername']=_0x5e7238[_0x0a9e('0x21')];this[_0x0a9e('0x8')][_0x5e7238[_0x0a9e('0x26')]][_0x1fa90d]['lastevent']=_0x0a9e('0x51');this[_0x0a9e('0x8')][_0x5e7238['uniqueid']][_0x1fa90d]['reason']=_0x0a9e('0x51');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x5e7238[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x5e7238['uniqueid']][_0x1fa90d],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentansweredelsewhere',this['channels'][_0x5e7238['uniqueid']][_0x1fa90d]);}}}}}}catch(_0x2da03c){logger['error'](_0x0a9e('0x52'),_0x5e7238[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2da03c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x53')]=function(_0x272738){try{if(this[_0x0a9e('0x1e')](_0x272738)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x272738[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x272738,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']]){logger[_0x0a9e('0x20')](_0x0a9e('0x54'),_0x272738['uniqueid'],_0x272738[_0x0a9e('0x21')],_0x272738['destuniqueid']);var _0x20c668=this['agents'][_0x272738['interface']];var _0x5674ee=this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738[_0x0a9e('0x22')]];_0x5674ee[_0x0a9e('0x55')]=!![];_0x5674ee[_0x0a9e('0x50')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x28'));_0x5674ee[_0x0a9e('0x3f')]='rejected';_0x5674ee[_0x0a9e('0x56')]='rejected';var _0xca4ade={'id':_0x20c668['id'],'name':_0x20c668[_0x0a9e('0x48')],'queue':_0x5674ee[_0x0a9e('0x45')],'uniqueid':_0x5674ee['uniqueid']};logger[_0x0a9e('0x23')](_0x0a9e('0x57'),_0x272738[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xca4ade,{'showHidden':![],'depth':null}));this['emit'](util[_0x0a9e('0x27')](_0x0a9e('0x35'),_0x20c668['name']),_0x0a9e('0x58'),_0xca4ade);ami[_0x0a9e('0x1d')](_0x0a9e('0x59'),_0x5674ee);}}}catch(_0x409b29){logger[_0x0a9e('0x37')]('[%s][voiceAgentReport][agentringnoanswer]',_0x272738[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x409b29,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncQueueCallerAbandon']=function(_0x3528b7){try{if(this['isNotNull'](_0x3528b7)){logger['debug'](_0x0a9e('0x5a'),_0x3528b7[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3528b7,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x3528b7[_0x0a9e('0x26')]]){for(var _0xc8c264 in this[_0x0a9e('0x8')][_0x3528b7[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x3528b7[_0x0a9e('0x26')]][_0x0a9e('0x5b')](_0xc8c264)&&!this[_0x0a9e('0x8')][_0x3528b7[_0x0a9e('0x26')]][_0xc8c264][_0x0a9e('0x55')]&&!this[_0x0a9e('0x8')][_0x3528b7[_0x0a9e('0x26')]][_0xc8c264][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x3528b7[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x3528b7[_0x0a9e('0x26')]][_0xc8c264]['membername'],_0xc8c264);this[_0x0a9e('0x8')][_0x3528b7[_0x0a9e('0x26')]][_0xc8c264]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x3528b7[_0x0a9e('0x26')]][_0xc8c264][_0x0a9e('0x50')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x28'));this['channels'][_0x3528b7['uniqueid']][_0xc8c264]['lastevent']=_0x0a9e('0x5c');this[_0x0a9e('0x8')][_0x3528b7[_0x0a9e('0x26')]][_0xc8c264][_0x0a9e('0x56')]=_0x0a9e('0x5c');logger[_0x0a9e('0x23')](_0x0a9e('0x5d'),_0x3528b7[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x3528b7[_0x0a9e('0x26')]][_0xc8c264],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentqueuecallerabandon',this[_0x0a9e('0x8')][_0x3528b7['uniqueid']][_0xc8c264]);}}}}}catch(_0x4437ff){logger[_0x0a9e('0x37')]('[%s][voiceAgentReport][queuecallerabandon]',_0x3528b7[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4437ff,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x13')]=function(_0x542ece){try{if(this[_0x0a9e('0x1e')](_0x542ece)){logger[_0x0a9e('0x23')](_0x0a9e('0x5e'),_0x542ece[_0x0a9e('0x26')],util['inspect'](_0x542ece,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x542ece[_0x0a9e('0x26')]]){for(var _0x2d5506 in this[_0x0a9e('0x8')][_0x542ece['uniqueid']]){if(this[_0x0a9e('0x8')][_0x542ece[_0x0a9e('0x26')]][_0x0a9e('0x5b')](_0x2d5506)){if(this[_0x0a9e('0x8')][_0x542ece[_0x0a9e('0x26')]][_0x2d5506][_0x0a9e('0x5f')]&&!this[_0x0a9e('0x8')][_0x542ece[_0x0a9e('0x26')]][_0x2d5506][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x60'),_0x542ece[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x542ece[_0x0a9e('0x26')]][_0x2d5506]['membername'],_0x2d5506);this[_0x0a9e('0x8')][_0x542ece[_0x0a9e('0x26')]][_0x2d5506][_0x0a9e('0x12')]=!![];this['channels'][_0x542ece[_0x0a9e('0x26')]][_0x2d5506][_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x28'));this['channels'][_0x542ece['uniqueid']][_0x2d5506][_0x0a9e('0x3f')]=_0x0a9e('0x62');this['channels'][_0x542ece[_0x0a9e('0x26')]][_0x2d5506]['reason']=_0x542ece[_0x0a9e('0x56')]==_0x0a9e('0x63')?'agent':_0x542ece[_0x0a9e('0x56')];this[_0x0a9e('0x8')][_0x542ece[_0x0a9e('0x26')]][_0x2d5506][_0x0a9e('0x64')]=_0x542ece[_0x0a9e('0x64')];if(this[_0x0a9e('0x9')][_0x542ece[_0x0a9e('0x45')]]&&this['voiceQueues'][_0x542ece[_0x0a9e('0x45')]][_0x0a9e('0x65')]){this[_0x0a9e('0x8')][_0x542ece[_0x0a9e('0x26')]][_0x2d5506]['acwtime']=this[_0x0a9e('0x9')][_0x542ece[_0x0a9e('0x45')]]['acwTimeout'];this[_0x0a9e('0x8')][_0x542ece['uniqueid']][_0x2d5506][_0x0a9e('0x66')]=!![];}this[_0x0a9e('0xa')][_0x542ece[_0x0a9e('0x43')]]=_[_0x0a9e('0x2f')](this['agents'][_0x542ece['interface']],[_0x0a9e('0x45'),_0x0a9e('0x46')]);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x542ece[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x542ece['uniqueid']][_0x2d5506],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentcomplete',this['channels'][_0x542ece['uniqueid']][_0x2d5506]);logger[_0x0a9e('0x23')](_0x0a9e('0x67'),_0x542ece[_0x0a9e('0x26')],util[_0x0a9e('0x25')]({'id':this[_0x0a9e('0xa')][_0x542ece[_0x0a9e('0x43')]]['id'],'destaccountcode':_0x542ece['destaccountcode']},{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util['format'](_0x0a9e('0x35'),_0x542ece[_0x0a9e('0x21')]),_0x0a9e('0x68'),{'id':this[_0x0a9e('0xa')][_0x542ece['interface']]['id'],'destaccountcode':Number(_0x542ece[_0x0a9e('0x69')])});}}}}}}catch(_0x32f761){logger[_0x0a9e('0x37')]('[%s][voiceAgentReport][agentcomplete]',_0x542ece[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x32f761,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x255e49){try{if(this[_0x0a9e('0x1e')](_0x255e49)){logger[_0x0a9e('0x23')](_0x0a9e('0x6a'),_0x255e49['uniqueid'],util[_0x0a9e('0x25')](_0x255e49,{'showHidden':![],'depth':null}));this[_0x0a9e('0x6b')](_0x255e49['uniqueid'],_[_0x0a9e('0x6c')](_0x255e49[_0x0a9e('0x6d')])[0x0],_0x255e49[_0x0a9e('0x6e')]);if(this['channels'][_0x255e49[_0x0a9e('0x26')]]){for(var _0x52ec10 in this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x0a9e('0x5b')](_0x52ec10)){logger[_0x0a9e('0x20')](_0x0a9e('0x6f'),_0x255e49[_0x0a9e('0x26')],_0x52ec10,_['keys'](_0x255e49[_0x0a9e('0x6d')])[0x0],_0x255e49[_0x0a9e('0x6e')]);if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')])){this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]=this[_0x0a9e('0xb')][_0x255e49['uniqueid']];}}}}}catch(_0xc81b64){logger[_0x0a9e('0x37')](_0x0a9e('0x70'),_0x255e49[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xc81b64,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x6b')]=function(_0x1756c7,_0x5ce99d,_0x23b447){var _0x5e725e=[_0x0a9e('0x71'),_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),'rtpaudioqosloss',_0x0a9e('0x75'),'rtpaudioqosrtt',_0x0a9e('0x76'),_0x0a9e('0x77'),'sipuri',_0x0a9e('0x78'),_0x0a9e('0x79'),_0x0a9e('0x7a'),'memberdynamic','memberinterface',_0x0a9e('0x7b'),_0x0a9e('0x21'),_0x0a9e('0x7c'),_0x0a9e('0x7d')];if(!_[_0x0a9e('0x7e')](_0x5ce99d)&&!_[_0x0a9e('0x7f')](_0x5e725e,_0x5ce99d)){if(_[_0x0a9e('0x1f')](this[_0x0a9e('0xb')][_0x1756c7])){this[_0x0a9e('0xb')][_0x1756c7]={};}this['variables'][_0x1756c7][_0x5ce99d]=_0x23b447;}};VoiceAgentReport[_0x0a9e('0x1c')]['syncHangup']=function(_0x287324){try{if(this[_0x0a9e('0x1e')](_0x287324)){logger[_0x0a9e('0x23')](_0x0a9e('0x80'),_0x287324[_0x0a9e('0x26')],util['inspect'](_0x287324,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){for(var _0x2791c5 in this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){if(this['channels'][_0x287324['uniqueid']][_0x0a9e('0x5b')](_0x2791c5)){if(this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x56')]==_0x0a9e('0x63')&&this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x287324[_0x0a9e('0x26')],_0x2791c5);this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5]['agentcompleteAt']=moment()[_0x0a9e('0x27')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug'](_0x0a9e('0x81'),_0x287324[_0x0a9e('0x26')],util['inspect'](_[_0x0a9e('0x82')](this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x83'),_['values'](this['channels'][_0x287324[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]];}if(this[_0x0a9e('0xb')][_0x287324[_0x0a9e('0x26')]]){delete this['variables'][_0x287324[_0x0a9e('0x26')]];}}}catch(_0xadce3d){logger['error'](_0x0a9e('0x84'),_0x287324[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xadce3d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x85')]=function(_0x23b39e){try{if(this[_0x0a9e('0x1e')](_0x23b39e)){logger[_0x0a9e('0x23')](_0x0a9e('0x86'),_0x23b39e[_0x0a9e('0x26')],util['inspect'](_0x23b39e,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x87')]]){for(var _0x2ada60 in this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x87')]]){if(this['channels'][_0x23b39e['transfereeuniqueid']][_0x0a9e('0x5b')](_0x2ada60)){if(_0x23b39e[_0x0a9e('0x88')]===_0x2ada60){logger[_0x0a9e('0x20')](_0x0a9e('0x89'),_0x23b39e[_0x0a9e('0x26')],this['channels'][_0x23b39e[_0x0a9e('0x87')]][_0x2ada60][_0x0a9e('0x21')],_0x2ada60);var _0x3450ae=moment();this['channels'][_0x23b39e[_0x0a9e('0x87')]][_0x2ada60]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x23b39e['transfereeuniqueid']][_0x2ada60][_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x28'));this['channels'][_0x23b39e[_0x0a9e('0x87')]][_0x2ada60]['lastevent']=_0x0a9e('0x62');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x87')]][_0x2ada60][_0x0a9e('0x56')]=_0x0a9e('0x63');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x87')]][_0x2ada60][_0x0a9e('0x64')]=_0x3450ae[_0x0a9e('0x8a')](this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x87')]][_0x2ada60][_0x0a9e('0x5f')],_0x0a9e('0x8b'));}}}}if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x8c')]]){var _0x248368=this['channels'][_0x23b39e['secondtransfereruniqueid']];this[_0x0a9e('0x8')][_0x23b39e['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x87')]];this['channels'][_0x23b39e[_0x0a9e('0x87')]]=_0x248368;}}}catch(_0xe2b083){logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x23b39e['uniqueid'],util[_0x0a9e('0x25')](_0xe2b083,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1b')]=function(_0x34a791){try{if(this['isNotNull'](_0x34a791)){logger[_0x0a9e('0x23')](_0x0a9e('0x8e'),_0x34a791[_0x0a9e('0x26')],util['inspect'](_0x34a791,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x87')]]){for(var _0x17b29d in this['channels'][_0x34a791[_0x0a9e('0x87')]]){if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x87')]][_0x0a9e('0x5b')](_0x17b29d)){if(_0x34a791[_0x0a9e('0x8f')]===_0x17b29d){logger['info'](_0x0a9e('0x90'),_0x34a791[_0x0a9e('0x26')],this['channels'][_0x34a791[_0x0a9e('0x87')]][_0x17b29d][_0x0a9e('0x21')],_0x17b29d);var _0x1f6f1c=moment();this['channels'][_0x34a791['transfereeuniqueid']][_0x17b29d]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x87')]][_0x17b29d]['agentcompleteAt']=_0x1f6f1c;this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x87')]][_0x17b29d][_0x0a9e('0x3f')]='complete';this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x87')]][_0x17b29d][_0x0a9e('0x56')]=_0x0a9e('0x63');this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x87')]][_0x17b29d][_0x0a9e('0x64')]=_0x1f6f1c[_0x0a9e('0x8a')](this[_0x0a9e('0x8')][_0x34a791['transfereeuniqueid']][_0x17b29d][_0x0a9e('0x5f')],'seconds');}}}}}}catch(_0x138cf5){logger[_0x0a9e('0x37')](_0x0a9e('0x91'),_0x34a791[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x138cf5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStart']=function(_0x1a0314){var _0x33da81='';try{if(this[_0x0a9e('0x1e')](_0x1a0314)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1a0314,{'showHidden':![],'depth':null}));if(_0x1a0314[_0x0a9e('0x47')]){_0x33da81=_0x1a0314[_0x0a9e('0x47')][_0x0a9e('0x92')](0x0,_0x1a0314[_0x0a9e('0x47')][_0x0a9e('0x93')]('-'));if(this[_0x0a9e('0xa')][_0x33da81]){logger[_0x0a9e('0x20')](_0x0a9e('0x94'),_0x1a0314['uniqueid'],_0x33da81);this[_0x0a9e('0xa')][_0x33da81][_0x0a9e('0x95')]=!![];}}}}catch(_0x2ff265){logger[_0x0a9e('0x37')](_0x0a9e('0x96'),_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2ff265,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStop']=function(_0x3b581c){var _0xd2391='';try{if(this[_0x0a9e('0x1e')](_0x3b581c)){logger['debug'](_0x0a9e('0x97'),_0x3b581c[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3b581c,{'showHidden':![],'depth':null}));if(_0x3b581c[_0x0a9e('0x47')]){_0xd2391=_0x3b581c[_0x0a9e('0x47')][_0x0a9e('0x92')](0x0,_0x3b581c[_0x0a9e('0x47')][_0x0a9e('0x93')]('-'));if(this[_0x0a9e('0xa')][_0xd2391]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x3b581c[_0x0a9e('0x26')],_0xd2391);this[_0x0a9e('0xa')][_0xd2391][_0x0a9e('0x95')]=![];}}}}catch(_0x3db98f){logger[_0x0a9e('0x37')](_0x0a9e('0x98'),_0x3b581c['uniqueid'],util[_0x0a9e('0x25')](_0x3db98f,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index dacd691..0fe7d2d 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1413=['BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','mohstarttime','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','lodash','moment','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','localhost','redis','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','debug','linkedid','merge','pick','keys','context','from-sip','channel','exten','xcally-motion-preview','split','destconnectedlinenum','format','user:%s','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','blindTransfers','disposition','toNumber','channelstate','undefined','name','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastdata','cdr(','match','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinenum','connectedlinename','calleridname','destinationchannel','UserId','membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','monitorFilename','find','isNil','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','syncMixMonitorFilename','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','isEmpty','then','stopRecordingOnTransfer','resolve','catch','Action','StopMixMonitor','finally','webbar:stopmonitors','BlindTransfer','outbound','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfereeuniqueid','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','origtransfererlinkedid','some','routeid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:'];(function(_0x1fbf34,_0x4ccf54){var _0x5d4b5a=function(_0x1ab658){while(--_0x1ab658){_0x1fbf34['push'](_0x1fbf34['shift']());}};_0x5d4b5a(++_0x4ccf54);}(_0x1413,0xd5));var _0x3141=function(_0x4af681,_0x4f9784){_0x4af681=_0x4af681-0x0;var _0xf070a4=_0x1413[_0x4af681];return _0xf070a4;};'use strict';var _=require(_0x3141('0x0'));var moment=require(_0x3141('0x1'));var util=require('util');var path=require(_0x3141('0x2'));var Redis=require(_0x3141('0x3'));var config=require(_0x3141('0x4'));var logger=require(_0x3141('0x5'))(_0x3141('0x6'));var ami=require(_0x3141('0x7'));var Channel=require(_0x3141('0x8'));var RpcSetting=require(_0x3141('0x9'));var applications=[_0x3141('0xa'),_0x3141('0xb'),_0x3141('0xc'),_0x3141('0xd'),_0x3141('0xe'),_0x3141('0xf')];var dispositions=[_0x3141('0x10'),_0x3141('0x11'),_0x3141('0x11'),_0x3141('0x10'),'NO\x20ANSWER',_0x3141('0x10'),_0x3141('0x12'),_0x3141('0x13'),_0x3141('0x11'),'FAILED',_0x3141('0x11')];config['redis']=_[_0x3141('0x14')](config['redis'],{'host':_0x3141('0x15'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3141('0x16')]));function VoiceCallReport(_0x1f3639){this['channels']=_0x1f3639[_0x3141('0x17')];this[_0x3141('0x18')]=_0x1f3639[_0x3141('0x18')];this['blindTransfers']={};ami['on'](_0x3141('0x19'),this[_0x3141('0x1a')][_0x3141('0x1b')](this));ami['on'](_0x3141('0x1c'),this[_0x3141('0x1a')][_0x3141('0x1b')](this));ami['on'](_0x3141('0x1d'),this[_0x3141('0x1e')]['bind'](this));ami['on'](_0x3141('0x1f'),this[_0x3141('0x20')][_0x3141('0x1b')](this));ami['on'](_0x3141('0x21'),this[_0x3141('0x22')]['bind'](this));ami['on']('hangup',this[_0x3141('0x23')][_0x3141('0x1b')](this));ami['on'](_0x3141('0x24'),this[_0x3141('0x25')][_0x3141('0x1b')](this));ami['on'](_0x3141('0x26'),this[_0x3141('0x27')][_0x3141('0x1b')](this));ami['on'](_0x3141('0x28'),this[_0x3141('0x29')][_0x3141('0x1b')](this));ami['on'](_0x3141('0x2a'),this[_0x3141('0x2b')][_0x3141('0x1b')](this));ami['on'](_0x3141('0x2c'),this['syncMusicOnHoldStop'][_0x3141('0x1b')](this));try{logger[_0x3141('0x2d')](_0x3141('0x2e'));ami[_0x3141('0x2f')]();}catch(_0x523dfc){logger[_0x3141('0x30')]('[voiceCallReport][coreshowchannels]',util[_0x3141('0x31')](_0x523dfc,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x3141('0x32')][_0x3141('0x33')]=function(_0x17f3e8){return _0x17f3e8!==null&&!_[_0x3141('0x34')](_0x17f3e8);};VoiceCallReport[_0x3141('0x32')][_0x3141('0x35')]=function(_0x3972ad,_0x2510e4,_0x175773){io['to'](_0x3972ad)[_0x3141('0x35')](_0x2510e4,_0x175773);};VoiceCallReport[_0x3141('0x32')][_0x3141('0x25')]=function(_0x8f9094){try{if(this[_0x3141('0x33')](_0x8f9094)){logger[_0x3141('0x2d')](_0x3141('0x36'),_0x8f9094[_0x3141('0x37')],_0x8f9094['calleridname'],_0x8f9094[_0x3141('0x38')]);logger[_0x3141('0x39')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x8f9094[_0x3141('0x37')],util[_0x3141('0x31')](_0x8f9094,{'showHidden':![],'depth':null}));if(_0x8f9094[_0x3141('0x37')]===_0x8f9094[_0x3141('0x3a')]){if(!_['isUndefined'](this[_0x3141('0x17')][_0x8f9094[_0x3141('0x37')]])){_[_0x3141('0x3b')](this[_0x3141('0x17')][_0x8f9094['uniqueid']],_[_0x3141('0x3c')](_0x8f9094,_[_0x3141('0x3d')](this[_0x3141('0x17')][_0x8f9094[_0x3141('0x37')]])));}}if(_0x8f9094[_0x3141('0x3e')]===_0x3141('0x3f')){if(this[_0x3141('0x18')][_0x8f9094[_0x3141('0x40')]['split']('-')[0x0]]){if(_0x8f9094[_0x3141('0x41')]==_0x3141('0x42')){this[_0x3141('0x18')][_0x8f9094['channel'][_0x3141('0x43')]('-')[0x0]][_0x3141('0x44')]=_0x8f9094['connectedlinenum'];this[_0x3141('0x35')](util[_0x3141('0x45')](_0x3141('0x46'),this[_0x3141('0x18')][_0x8f9094[_0x3141('0x40')][_0x3141('0x43')]('-')[0x0]]['name']),_0x3141('0x47'),{'destaccountcode':this['agents'][_0x8f9094['channel']['split']('-')[0x0]][_0x3141('0x48')],'destconnectedlinenum':_0x8f9094['connectedlinenum']});}}}}}catch(_0x18f62d){logger[_0x3141('0x30')](_0x3141('0x49'),_0x8f9094[_0x3141('0x37')],util[_0x3141('0x31')](_0x18f62d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3141('0x32')][_0x3141('0x1e')]=function(_0x4bed70){try{if(this['isNotNull'](_0x4bed70)){logger[_0x3141('0x39')](_0x3141('0x4a'),_0x4bed70['uniqueid'],util[_0x3141('0x31')](_0x4bed70,{'showHidden':![],'depth':null}));if(this[_0x3141('0x17')][_0x4bed70[_0x3141('0x37')]]){return;}if(_0x4bed70[_0x3141('0x40')]===_0x3141('0x4b')){return;}if(_0x4bed70[_0x3141('0x37')]!==_0x4bed70[_0x3141('0x3a')]&&!this[_0x3141('0x4c')][_0x4bed70[_0x3141('0x3a')]]){return;}logger[_0x3141('0x2d')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x4bed70['uniqueid'],_0x4bed70[_0x3141('0x3e')],_0x4bed70[_0x3141('0x41')]);this['channels'][_0x4bed70['uniqueid']]=new Channel();this['channels'][_0x4bed70[_0x3141('0x37')]]['starttime']=moment()[_0x3141('0x45')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x4bed70[_0x3141('0x37')]][_0x3141('0x4d')]=dispositions[_[_0x3141('0x4e')](_0x4bed70[_0x3141('0x4f')])];_['merge'](this[_0x3141('0x17')][_0x4bed70[_0x3141('0x37')]],_[_0x3141('0x3c')](_0x4bed70,_[_0x3141('0x3d')](this['channels'][_0x4bed70['uniqueid']])));if(_0x4bed70[_0x3141('0x3e')]===_0x3141('0x3f')){var _0xf71642=this[_0x3141('0x18')][_0x4bed70[_0x3141('0x40')][_0x3141('0x43')]('-')[0x0]];if(_0xf71642&&typeof _0xf71642[_0x3141('0x44')]===_0x3141('0x50')){_0xf71642[_0x3141('0x44')]=_0x4bed70[_0x3141('0x41')];logger[_0x3141('0x39')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x4bed70[_0x3141('0x37')],util[_0x3141('0x31')]({'id':_0xf71642['id'],'destaccountcode':_0xf71642[_0x3141('0x48')],'destconnectedlinenum':_0x4bed70[_0x3141('0x41')]},{'showHidden':![],'depth':null}));this[_0x3141('0x35')](util[_0x3141('0x45')]('user:%s',_0xf71642[_0x3141('0x51')]),_0x3141('0x47'),{'id':_0xf71642['id'],'destaccountcode':_0xf71642[_0x3141('0x48')],'destconnectedlinenum':_0x4bed70['exten']});}}}}catch(_0x530a1e){logger[_0x3141('0x30')]('[%s][voiceCallReport][newchannel]',_0x4bed70[_0x3141('0x37')],util[_0x3141('0x31')](_0x530a1e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3141('0x32')]['syncNewExten']=function(_0x55c9cb){try{if(this[_0x3141('0x33')](_0x55c9cb)){logger[_0x3141('0x39')](_0x3141('0x52'),_0x55c9cb['uniqueid'],util[_0x3141('0x31')](_0x55c9cb,{'showHidden':![],'depth':null}));if(_0x55c9cb[_0x3141('0x40')]===_0x3141('0x4b')||_0x55c9cb['exten']==='h')return;if(_0x55c9cb[_0x3141('0x37')]===_0x55c9cb[_0x3141('0x3a')]||this[_0x3141('0x4c')][_0x55c9cb['linkedid']]){_0x55c9cb[_0x3141('0x53')]=_0x55c9cb[_0x3141('0x53')][_0x3141('0x54')]();_0x55c9cb[_0x3141('0x55')]=_0x55c9cb[_0x3141('0x56')]||_0x55c9cb[_0x3141('0x55')];if(_0x55c9cb['appdata']&&!_0x55c9cb[_0x3141('0x56')][_0x3141('0x57')](_0x3141('0x58'))&&_0x55c9cb[_0x3141('0x53')]!=='queue'){_0x55c9cb[_0x3141('0x55')]=_0x55c9cb[_0x3141('0x55')]['toLowerCase']();}logger['info'](_0x3141('0x59'),_0x55c9cb[_0x3141('0x37')],_0x55c9cb['application'],_0x55c9cb[_0x3141('0x55')]);if(_[_0x3141('0x34')](this['channels'][_0x55c9cb[_0x3141('0x37')]])){this[_0x3141('0x17')][_0x55c9cb['uniqueid']]=new Channel();this['channels'][_0x55c9cb[_0x3141('0x37')]][_0x3141('0x5a')]=_0x55c9cb[_0x3141('0x5b')]?moment()[_0x3141('0x5c')](moment[_0x3141('0x5b')](_0x55c9cb['duration'])['seconds'](),_0x3141('0x5d'))['format'](_0x3141('0x5e')):moment()[_0x3141('0x45')](_0x3141('0x5e'));this['channels'][_0x55c9cb[_0x3141('0x37')]][_0x3141('0x4d')]=_0x3141('0x10');}_[_0x3141('0x3b')](this['channels'][_0x55c9cb[_0x3141('0x37')]],_[_0x3141('0x3c')](_0x55c9cb,_[_0x3141('0x3d')](this[_0x3141('0x17')][_0x55c9cb[_0x3141('0x37')]])));if(_[_0x3141('0x5f')](applications,_0x55c9cb[_0x3141('0x53')])){this['channels'][_0x55c9cb[_0x3141('0x37')]]['lastapplication']=_0x55c9cb[_0x3141('0x53')];this[_0x3141('0x17')][_0x55c9cb[_0x3141('0x37')]][_0x3141('0x60')]=_0x55c9cb[_0x3141('0x55')];if(_0x55c9cb[_0x3141('0x53')]===_0x3141('0xa')&&_[_0x3141('0x57')](_0x55c9cb[_0x3141('0x55')][_0x3141('0x54')](),_0x3141('0x61'))){var _0x2c25a6=_0x55c9cb[_0x3141('0x55')][_0x3141('0x43')]('=');var _0x35ffa3=_0x2c25a6[0x0][_0x3141('0x54')]()[_0x3141('0x62')](/cdr\((.*)\)/);if(_0x35ffa3){if(_0x35ffa3[0x1]==='type'&&!_['isNil'](this[_0x3141('0x17')][_0x55c9cb['uniqueid']][_0x35ffa3[0x1]]))return;this[_0x3141('0x17')][_0x55c9cb[_0x3141('0x37')]][_0x35ffa3[0x1]]=_0x2c25a6[0x1];}}else if(_0x55c9cb[_0x3141('0x53')]===_0x3141('0xb')){this[_0x3141('0x17')][_0x55c9cb['uniqueid']][_0x3141('0xb')]=_0x55c9cb['applicationdata'][_0x3141('0x43')](',')[0x0];}}}}}catch(_0x254aff){logger[_0x3141('0x30')]('[%s][voiceCallReport][newexten]',_0x55c9cb['uniqueid'],util['inspect'](_0x254aff,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3141('0x32')][_0x3141('0x20')]=function(_0x28b2f0){try{if(this[_0x3141('0x33')](_0x28b2f0)){logger[_0x3141('0x2d')](_0x3141('0x63'),_0x28b2f0[_0x3141('0x37')],_0x28b2f0[_0x3141('0x3a')],_0x28b2f0['calleridname'],_0x28b2f0['calleridnum']);logger[_0x3141('0x39')](_0x3141('0x64'),_0x28b2f0[_0x3141('0x37')],util[_0x3141('0x31')](_0x28b2f0,{'showHidden':![],'depth':null}));if(_0x28b2f0[_0x3141('0x4f')]!=='6')return;var _0x34edc3=this[_0x3141('0x18')][_0x28b2f0[_0x3141('0x40')][_0x3141('0x43')]('-')[0x0]];if(_0x28b2f0['uniqueid']!==_0x28b2f0['linkedid']){var _0x1e3e63=moment();if(this[_0x3141('0x17')][_0x28b2f0[_0x3141('0x3a')]]){if(!this[_0x3141('0x17')][_0x28b2f0[_0x3141('0x3a')]][_0x3141('0x65')]){this[_0x3141('0x17')][_0x28b2f0[_0x3141('0x3a')]]['answered']=!![];this[_0x3141('0x17')][_0x28b2f0[_0x3141('0x3a')]][_0x3141('0x66')]=_0x1e3e63['format'](_0x3141('0x5e'));if(this['channels'][_0x28b2f0[_0x3141('0x3a')]]['starttime']){this[_0x3141('0x17')][_0x28b2f0[_0x3141('0x3a')]][_0x3141('0x67')]=_0x1e3e63[_0x3141('0x68')](this[_0x3141('0x17')][_0x28b2f0[_0x3141('0x3a')]][_0x3141('0x5a')],_0x3141('0x5d'));}}this[_0x3141('0x17')][_0x28b2f0['linkedid']][_0x3141('0x3a')]=_0x28b2f0[_0x3141('0x37')];if(_0x28b2f0['calleridnum']!==_0x3141('0x42')){this[_0x3141('0x17')][_0x28b2f0['linkedid']][_0x3141('0x69')]=_0x28b2f0[_0x3141('0x38')];}this[_0x3141('0x17')][_0x28b2f0[_0x3141('0x3a')]][_0x3141('0x6a')]=_0x28b2f0[_0x3141('0x6b')];this[_0x3141('0x17')][_0x28b2f0[_0x3141('0x3a')]][_0x3141('0x6c')]=_0x28b2f0[_0x3141('0x40')];this[_0x3141('0x17')][_0x28b2f0[_0x3141('0x3a')]][_0x3141('0x4d')]=dispositions[_['toNumber'](_0x28b2f0['channelstate'])];if(_0x34edc3){this['channels'][_0x28b2f0[_0x3141('0x3a')]][_0x3141('0x6d')]=_0x34edc3['id'];this[_0x3141('0x17')][_0x28b2f0['linkedid']]['membername']=_0x34edc3[_0x3141('0x51')];}}if(this[_0x3141('0x17')][_0x28b2f0[_0x3141('0x37')]]){if(!this[_0x3141('0x17')][_0x28b2f0[_0x3141('0x37')]][_0x3141('0x65')]){this[_0x3141('0x17')][_0x28b2f0[_0x3141('0x37')]][_0x3141('0x65')]=!![];this[_0x3141('0x17')][_0x28b2f0[_0x3141('0x37')]]['answertime']=_0x1e3e63[_0x3141('0x45')](_0x3141('0x5e'));if(this[_0x3141('0x17')][_0x28b2f0[_0x3141('0x37')]][_0x3141('0x5a')]){this[_0x3141('0x17')][_0x28b2f0[_0x3141('0x37')]][_0x3141('0x67')]=_0x1e3e63[_0x3141('0x68')](this[_0x3141('0x17')][_0x28b2f0['uniqueid']][_0x3141('0x5a')],_0x3141('0x5d'));}}if(_0x28b2f0[_0x3141('0x38')]!==_0x3141('0x42')){this[_0x3141('0x17')][_0x28b2f0[_0x3141('0x37')]][_0x3141('0x69')]=_0x28b2f0[_0x3141('0x38')];}this['channels'][_0x28b2f0[_0x3141('0x37')]][_0x3141('0x6a')]=_0x28b2f0[_0x3141('0x6b')];this[_0x3141('0x17')][_0x28b2f0['uniqueid']][_0x3141('0x6c')]=_0x28b2f0[_0x3141('0x40')];this[_0x3141('0x17')][_0x28b2f0[_0x3141('0x37')]][_0x3141('0x4d')]=dispositions[_[_0x3141('0x4e')](_0x28b2f0[_0x3141('0x4f')])];}}else{if(this[_0x3141('0x17')][_0x28b2f0[_0x3141('0x37')]]){if(_0x34edc3){this['channels'][_0x28b2f0[_0x3141('0x37')]]['UserId']=_0x34edc3['id'];this['channels'][_0x28b2f0[_0x3141('0x37')]][_0x3141('0x6e')]=_0x34edc3[_0x3141('0x51')];}}}if(_0x28b2f0[_0x3141('0x3e')]===_0x3141('0x3f')){if(_0x34edc3){_0x34edc3[_0x3141('0x44')]=_0x28b2f0[_0x3141('0x41')];var _0x38dc73,_0x5d7369;if(this['channels'][_0x28b2f0['uniqueid']]){_0x38dc73=this[_0x3141('0x17')][_0x28b2f0[_0x3141('0x37')]][_0x3141('0x6f')];_0x5d7369=this['channels'][_0x28b2f0[_0x3141('0x37')]][_0x3141('0xb')];}else if(this[_0x3141('0x17')][_0x28b2f0[_0x3141('0x3a')]]){_0x38dc73=this[_0x3141('0x17')][_0x28b2f0['linkedid']]['routealias'];_0x5d7369=this[_0x3141('0x17')][_0x28b2f0['linkedid']]['queue'];}_0x34edc3[_0x3141('0xb')]=_0x5d7369;_0x34edc3[_0x3141('0x6f')]=_0x38dc73;var _0xbed7f8={'id':_0x34edc3['id'],'name':_0x34edc3['name'],'agentconnected':!![],'destaccountcode':_0x34edc3[_0x3141('0x48')],'destconnectedlinenum':_0x28b2f0['exten'],'queue':_0x5d7369||undefined,'routealias':_0x38dc73,'uniqueid':_0x28b2f0['linkedid']};logger['debug'](_0x3141('0x70'),_0x28b2f0[_0x3141('0x37')],util[_0x3141('0x31')](_0xbed7f8,{'showHidden':![],'depth':null}));this['emit'](util[_0x3141('0x45')](_0x3141('0x46'),_0x34edc3[_0x3141('0x51')]),_0x3141('0x47'),_0xbed7f8);}}}}catch(_0x2faed8){logger[_0x3141('0x30')](_0x3141('0x71'),_0x28b2f0[_0x3141('0x37')],util[_0x3141('0x31')](_0x2faed8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3141('0x32')]['syncMixMonitorFilename']=function(_0xfa9ba0,_0xf4204a){try{if(this[_0x3141('0x17')][_0xfa9ba0]){logger[_0x3141('0x2d')](_0x3141('0x72'),_0xfa9ba0,_0xf4204a);this['channels'][_0xfa9ba0][_0x3141('0x73')]=!![];if(_[_0x3141('0x74')](_0xf4204a,_0x3141('0x75'))){_0xf4204a=_0xf4204a[_0x3141('0x76')](_0x3141('0x75'),'.WAV');}this[_0x3141('0x17')][_0xfa9ba0][_0x3141('0x77')]=_0xf4204a;var _0xd0d431=_[_0x3141('0x78')](this[_0x3141('0x17')][_0xfa9ba0]['monitors'],{'filename':_0xf4204a});if(_[_0x3141('0x79')](_0xd0d431)){this[_0x3141('0x17')][_0xfa9ba0][_0x3141('0x7a')][_0x3141('0x7b')]({'filename':_0xf4204a,'createdAt':moment()[_0x3141('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x3141('0x7c')});}}}catch(_0x539cfb){logger['error'](_0x3141('0x7d'),_0xfa9ba0,util[_0x3141('0x31')](_0x539cfb,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3141('0x32')][_0x3141('0x22')]=function(_0x103cf0){try{if(this[_0x3141('0x33')](_0x103cf0)){logger[_0x3141('0x39')](_0x3141('0x7e'),_0x103cf0[_0x3141('0x37')],util[_0x3141('0x31')](_0x103cf0,{'showHidden':![],'depth':null}));if(this[_0x3141('0x17')][_0x103cf0[_0x3141('0x37')]]&&_0x103cf0[_0x3141('0x40')]!=_0x3141('0x4b')){if(this['isNotNull'](_0x103cf0[_0x3141('0x7f')])){if(this[_0x3141('0x33')](_0x103cf0[_0x3141('0x7f')]['mixmonitor_filename'])){logger[_0x3141('0x2d')](_0x3141('0x80'),_0x103cf0['uniqueid'],_0x103cf0[_0x3141('0x81')]);this[_0x3141('0x82')](_0x103cf0['uniqueid'],_0x103cf0['value']);}else if(this[_0x3141('0x33')](_0x103cf0[_0x3141('0x7f')][_0x3141('0x83')])){logger['info'](_0x3141('0x84'),_0x103cf0[_0x3141('0x37')],_0x103cf0['value']);this['channels'][_0x103cf0[_0x3141('0x37')]]['calleridnum']=_0x103cf0[_0x3141('0x81')];}else if(this['isNotNull'](_0x103cf0[_0x3141('0x7f')]['xmd-callerid'])){logger[_0x3141('0x2d')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x103cf0['uniqueid'],_0x103cf0['value']);this[_0x3141('0x17')][_0x103cf0[_0x3141('0x37')]][_0x3141('0x85')]=_0x103cf0[_0x3141('0x81')];}else if(this[_0x3141('0x33')](_0x103cf0[_0x3141('0x7f')][_0x3141('0x86')])){logger[_0x3141('0x2d')](_0x3141('0x87'),_0x103cf0[_0x3141('0x37')],_0x103cf0[_0x3141('0x81')]);this[_0x3141('0x17')][_0x103cf0['uniqueid']][_0x3141('0x88')]=_0x103cf0['value'];}else if(this[_0x3141('0x33')](_0x103cf0['variable'][_0x3141('0x89')])){logger[_0x3141('0x2d')](_0x3141('0x8a'),_0x103cf0['uniqueid'],_0x103cf0[_0x3141('0x81')][_0x3141('0x43')](',')[0x0]);this[_0x3141('0x17')][_0x103cf0[_0x3141('0x37')]][_0x3141('0xb')]=_0x103cf0[_0x3141('0x81')][_0x3141('0x43')](',')[0x0];}else if(this[_0x3141('0x33')](_0x103cf0[_0x3141('0x7f')][_0x3141('0x8b')])){logger['info'](_0x3141('0x8c'),_0x103cf0[_0x3141('0x37')],_0x103cf0[_0x3141('0x81')]);this[_0x3141('0x17')][_0x103cf0[_0x3141('0x37')]][_0x3141('0x8d')]=_0x103cf0['value'];}else if(this[_0x3141('0x33')](_0x103cf0[_0x3141('0x7f')][_0x3141('0x8e')])){logger[_0x3141('0x2d')](_0x3141('0x8f'),_0x103cf0[_0x3141('0x37')],_0x103cf0[_0x3141('0x81')]);this[_0x3141('0x17')][_0x103cf0['uniqueid']][_0x3141('0x90')]=_0x103cf0[_0x3141('0x81')];}else if(this[_0x3141('0x33')](_0x103cf0[_0x3141('0x7f')][_0x3141('0x91')])){logger[_0x3141('0x2d')](_0x3141('0x92'),_0x103cf0[_0x3141('0x37')],_0x103cf0[_0x3141('0x81')]);this[_0x3141('0x17')][_0x103cf0[_0x3141('0x37')]][_0x3141('0x93')]=_0x103cf0[_0x3141('0x81')];}else if(this[_0x3141('0x33')](_0x103cf0['variable']['xmcs-queue'])){logger[_0x3141('0x2d')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x103cf0[_0x3141('0x37')],_0x103cf0[_0x3141('0x81')]);this['channels'][_0x103cf0[_0x3141('0x37')]][_0x3141('0xb')]=_0x103cf0[_0x3141('0x81')];}else if(this[_0x3141('0x33')](_0x103cf0[_0x3141('0x7f')][_0x3141('0x94')])){logger['info'](_0x3141('0x95'),_0x103cf0[_0x3141('0x37')],_0x103cf0[_0x3141('0x81')]);this['channels'][_0x103cf0[_0x3141('0x37')]][_0x3141('0x96')]=_0x103cf0[_0x3141('0x81')];}}}else if(this[_0x3141('0x33')](_0x103cf0[_0x3141('0x7f')]['mixmonitor_filename'])){if(_0x103cf0[_0x3141('0x81')]){var _0xcfc15e=path[_0x3141('0x97')](_0x103cf0['value'])[_0x3141('0x51')];logger[_0x3141('0x2d')](_0x3141('0x80'),_0xcfc15e,_0x103cf0['value']);this[_0x3141('0x82')](_0xcfc15e,_0x103cf0[_0x3141('0x81')]);}}else if(this['channels'][_0x103cf0[_0x3141('0x3a')]]){if(this['isNotNull'](_0x103cf0[_0x3141('0x7f')])){if(this[_0x3141('0x33')](_0x103cf0[_0x3141('0x7f')][_0x3141('0x94')])){logger['info'](_0x3141('0x95'),_0x103cf0[_0x3141('0x3a')],_0x103cf0['value']);this['channels'][_0x103cf0[_0x3141('0x3a')]][_0x3141('0x98')]=_0x103cf0[_0x3141('0x81')];}}}}}catch(_0xb1cf40){logger[_0x3141('0x30')](_0x3141('0x99'),_0x103cf0['uniqueid'],util[_0x3141('0x31')](_0xb1cf40,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3141('0x32')][_0x3141('0x23')]=function(_0x544363){try{if(this[_0x3141('0x33')](_0x544363)){logger[_0x3141('0x39')](_0x3141('0x9a'),_0x544363[_0x3141('0x37')],util[_0x3141('0x31')](_0x544363,{'showHidden':![],'depth':null}));if(this[_0x3141('0x4c')][_0x544363['linkedid']]){if(this[_0x3141('0x17')][this[_0x3141('0x4c')][_0x544363[_0x3141('0x3a')]][_0x3141('0x3a')]]){this['channels'][this['blindTransfers'][_0x544363[_0x3141('0x3a')]][_0x3141('0x3a')]][_0x3141('0x37')]=_0x544363[_0x3141('0x37')];this[_0x3141('0x17')][this[_0x3141('0x4c')][_0x544363[_0x3141('0x3a')]][_0x3141('0x3a')]][_0x3141('0x65')]=this[_0x3141('0x17')][_0x544363[_0x3141('0x37')]][_0x3141('0x65')];this[_0x3141('0x17')][this[_0x3141('0x4c')][_0x544363[_0x3141('0x3a')]][_0x3141('0x3a')]][_0x3141('0x66')]=this['channels'][_0x544363[_0x3141('0x37')]][_0x3141('0x66')];this[_0x3141('0x17')][this[_0x3141('0x4c')][_0x544363[_0x3141('0x3a')]][_0x3141('0x3a')]]['destinationchannel']=this[_0x3141('0x17')][this[_0x3141('0x4c')][_0x544363[_0x3141('0x3a')]][_0x3141('0x3a')]][_0x3141('0x40')];this['channels'][this[_0x3141('0x4c')][_0x544363[_0x3141('0x3a')]][_0x3141('0x3a')]][_0x3141('0x4d')]=this[_0x3141('0x17')][_0x544363['uniqueid']]['disposition'];this[_0x3141('0x17')][_0x544363[_0x3141('0x37')]]=this[_0x3141('0x17')][this[_0x3141('0x4c')][_0x544363['linkedid']][_0x3141('0x3a')]];delete this[_0x3141('0x17')][this[_0x3141('0x4c')][_0x544363[_0x3141('0x3a')]][_0x3141('0x3a')]];}else if(this[_0x3141('0x17')][this[_0x3141('0x4c')][_0x544363[_0x3141('0x3a')]][_0x3141('0x37')]]){this[_0x3141('0x17')][this[_0x3141('0x4c')][_0x544363[_0x3141('0x3a')]][_0x3141('0x37')]][_0x3141('0x37')]=[this[_0x3141('0x17')][this[_0x3141('0x4c')][_0x544363[_0x3141('0x3a')]][_0x3141('0x37')]][_0x3141('0x3a')],this[_0x3141('0x17')][this['blindTransfers'][_0x544363[_0x3141('0x3a')]][_0x3141('0x37')]][_0x3141('0x3a')]=this[_0x3141('0x17')][this[_0x3141('0x4c')][_0x544363[_0x3141('0x3a')]][_0x3141('0x37')]][_0x3141('0x37')]][0x0];this[_0x3141('0x17')][this[_0x3141('0x4c')][_0x544363[_0x3141('0x3a')]][_0x3141('0x37')]][_0x3141('0x65')]=this[_0x3141('0x17')][_0x544363[_0x3141('0x37')]][_0x3141('0x65')];this[_0x3141('0x17')][this[_0x3141('0x4c')][_0x544363[_0x3141('0x3a')]][_0x3141('0x37')]][_0x3141('0x66')]=this[_0x3141('0x17')][_0x544363[_0x3141('0x37')]][_0x3141('0x66')];this[_0x3141('0x17')][this['blindTransfers'][_0x544363['linkedid']]['uniqueid']]['destinationchannel']=this[_0x3141('0x17')][this['blindTransfers'][_0x544363[_0x3141('0x3a')]][_0x3141('0x37')]]['channel'];this[_0x3141('0x17')][this['blindTransfers'][_0x544363[_0x3141('0x3a')]][_0x3141('0x37')]]['disposition']=this[_0x3141('0x17')][_0x544363[_0x3141('0x37')]][_0x3141('0x4d')];this[_0x3141('0x17')][_0x544363['uniqueid']]=this[_0x3141('0x17')][this[_0x3141('0x4c')][_0x544363[_0x3141('0x3a')]]['uniqueid']];delete this[_0x3141('0x17')][this[_0x3141('0x4c')][_0x544363['linkedid']]['uniqueid']];}}if(this[_0x3141('0x17')][_0x544363[_0x3141('0x37')]]){logger[_0x3141('0x2d')](_0x3141('0x9b'),_0x544363['uniqueid'],_0x544363[_0x3141('0x9c')]);var _0x56da2a=moment();this['channels'][_0x544363[_0x3141('0x37')]][_0x3141('0x9d')]=_0x56da2a[_0x3141('0x45')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x3141('0x17')][_0x544363[_0x3141('0x37')]][_0x3141('0x5b')]=_0x56da2a[_0x3141('0x68')](this[_0x3141('0x17')][_0x544363[_0x3141('0x37')]][_0x3141('0x5a')],_0x3141('0x5d'));if(this['channels'][_0x544363[_0x3141('0x37')]][_0x3141('0x65')]){this[_0x3141('0x17')][_0x544363[_0x3141('0x37')]][_0x3141('0x9e')]=_0x56da2a['diff'](this['channels'][_0x544363[_0x3141('0x37')]][_0x3141('0x66')],_0x3141('0x5d'));this[_0x3141('0x17')][_0x544363[_0x3141('0x37')]]['holdtime']=this['channels'][_0x544363['uniqueid']][_0x3141('0x5b')]-this[_0x3141('0x17')][_0x544363[_0x3141('0x37')]][_0x3141('0x9e')];}if(_0x544363[_0x3141('0x3e')]===_0x3141('0x3f')){if(this[_0x3141('0x18')][_0x544363[_0x3141('0x40')][_0x3141('0x43')]('-')[0x0]]){this[_0x3141('0x18')][_0x544363['channel'][_0x3141('0x43')]('-')[0x0]]=_[_0x3141('0x9f')](this[_0x3141('0x18')][_0x544363['channel'][_0x3141('0x43')]('-')[0x0]],[_0x3141('0x44')]);logger['debug'](_0x3141('0xa0'),_0x544363[_0x3141('0x37')],util[_0x3141('0x31')]({'id':this[_0x3141('0x18')][_0x544363[_0x3141('0x40')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x3141('0x18')][_0x544363[_0x3141('0x40')][_0x3141('0x43')]('-')[0x0]][_0x3141('0x48')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x3141('0x45')](_0x3141('0x46'),this[_0x3141('0x18')][_0x544363[_0x3141('0x40')]['split']('-')[0x0]][_0x3141('0x51')]),_0x3141('0xa1'),{'id':this[_0x3141('0x18')][_0x544363[_0x3141('0x40')]['split']('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x544363['channel'][_0x3141('0x43')]('-')[0x0]]['accountcode']});for(var _0x1f129e=0x0;_0x1f129e0x0?!![]:![];if(!_0xc600e6){return this[_0x6155('0x1c')](this[_0x6155('0x17')][_0x6155('0x78')]);}};VoiceQueueReport[_0x6155('0xd')][_0x6155('0x1e')]=function(_0x5746e4){var _0x3544a0=this[_0x6155('0x17')]['id'];if(this['summary'][_0x6155('0x64')][_0x3544a0]&&this[_0x6155('0x17')]['queuestatus'][_0x3544a0][_0x5746e4[_0x6155('0x63')]]){this[_0x6155('0x17')]['queuestatus'][_0x3544a0][_0x5746e4[_0x6155('0x63')]][_0x6155('0x13')][_0x6155('0x79')](_0x5746e4);}};VoiceQueueReport[_0x6155('0xd')][_0x6155('0x1a')]=function(_0x4928c0){var _0x4d8df1=this;try{if(this[_0x6155('0x7a')](_0x4928c0)&&this[_0x6155('0x7a')](_0x4928c0['queue'])){logger[_0x6155('0x4d')](_0x6155('0x7b'),util['inspect'](_0x4928c0,{'showHidden':![],'depth':null}));var _0x12adc8=this[_0x6155('0x15')][_0x4928c0[_0x6155('0x73')]];if(_0x12adc8){logger[_0x6155('0x7c')](_0x6155('0x7d'),_0x12adc8['name']);this[_0x6155('0x17')]['queues'][_0x12adc8[_0x6155('0x52')]]={'summaryEvent':_0x4928c0};this['summary']['statusRequests']+=0x1;return ami[_0x6155('0x40')]({'action':_0x6155('0x64'),'queue':_0x12adc8['name']})[_0x6155('0x62')](function(_0x16b182){_0x4d8df1['summary']['queuestatus'][_0x4928c0[_0x6155('0x63')]][_0x16b182[_0x6155('0x63')]]={'queue':_0x12adc8[_0x6155('0x52')],'agents':[]};})[_0x6155('0x7e')](function(_0x5927c1){throw _0x5927c1;});}}}catch(_0x5bd84a){logger['error'](_0x6155('0x65'),util[_0x6155('0x46')](_0x5bd84a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6155('0x1c')]=function(_0xa1a44e){if(this['summary'][_0x6155('0x77')]>0x0){this[_0x6155('0x17')][_0x6155('0x78')]=_0xa1a44e;return;}logger[_0x6155('0x4d')](_0x6155('0x7f'),util[_0x6155('0x46')](_0xa1a44e,{'showHidden':![],'depth':null}));this[_0x6155('0x17')]=initializeSummary();ami[_0x6155('0x4c')](_0x6155('0x80'),{});};VoiceQueueReport[_0x6155('0xd')][_0x6155('0x21')]=function(_0x196955){try{if(this['isNotNull'](_0x196955)){logger['debug'](_0x6155('0x81'),_0x196955[_0x6155('0x82')],util[_0x6155('0x46')](_0x196955,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x6155('0x12')][_0x196955[_0x6155('0x82')]]))this[_0x6155('0x12')][_0x196955[_0x6155('0x82')]]=[];if(_['isUndefined'](this[_0x6155('0x3d')][_0x196955[_0x6155('0x82')]]))this[_0x6155('0x3d')][_0x196955[_0x6155('0x82')]]={};var _0x8f1057=new QueueReport();_0x8f1057[_0x6155('0x52')]=_0x196955[_0x6155('0x73')];_0x8f1057[_0x6155('0x59')]=this[_0x6155('0x15')][_0x8f1057[_0x6155('0x52')]]&&this[_0x6155('0x15')][_0x8f1057['name']]['type']?this[_0x6155('0x15')][_0x8f1057[_0x6155('0x52')]]['type']||_0x6155('0x5a'):'inbound';_0x8f1057['queue']=_0x196955[_0x6155('0x73')];_0x8f1057[_0x6155('0x83')]=moment()[_0x6155('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x8f1057[_0x6155('0x84')]=_0x196955[_0x6155('0x84')];_0x8f1057['count']=_0x196955['count'];_0x8f1057[_0x6155('0x82')]=_0x196955[_0x6155('0x82')];_0x8f1057[_0x6155('0x85')]=this['channels'][_0x196955[_0x6155('0x82')]][_0x6155('0x85')];logger[_0x6155('0x7c')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x8f1057[_0x6155('0x52')],_0x8f1057['type']);_[_0x6155('0x86')](_0x8f1057,_[_0x6155('0x87')](_0x196955,_['keys'](_0x8f1057)));this['queueReports'][_0x196955[_0x6155('0x82')]]['push'](_0x8f1057);this['channels'][_0x196955[_0x6155('0x82')]]=_0x8f1057;this[_0x6155('0x88')](_0x8f1057,_0x6155('0x89'));}}catch(_0x5695d2){logger[_0x6155('0x44')]('[%s][voiceQueueReport][queuecallerjoin]',_0x196955[_0x6155('0x82')],util[_0x6155('0x46')](_0x5695d2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6155('0xd')][_0x6155('0x8a')]=function(_0xa6fd34){try{if(this[_0x6155('0x7a')](_0xa6fd34)){logger[_0x6155('0x4d')]('[%s][voiceQueueReport][queuecallerabandon]',_0xa6fd34[_0x6155('0x82')],util[_0x6155('0x46')](_0xa6fd34,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xa6fd34['uniqueid']]){var _0x311a1a=_[_0x6155('0x8b')](this['queueReports'][_0xa6fd34[_0x6155('0x82')]]);_0x311a1a[_0x6155('0x8c')]=![];_0x311a1a[_0x6155('0x8d')]=null;_0x311a1a[_0x6155('0x8e')]=_0xa6fd34[_0x6155('0x8e')];_0x311a1a[_0x6155('0x8f')]=_0xa6fd34[_0x6155('0x8f')];_0x311a1a[_0x6155('0x22')]=!![];_0x311a1a[_0x6155('0x90')]=moment()[_0x6155('0x50')](_0x6155('0x91'));_0x311a1a[_0x6155('0x56')]=_0x6155('0x92');_0x311a1a[_0x6155('0x93')]=null;logger[_0x6155('0x7c')](_0x6155('0x94'),_0x311a1a[_0x6155('0x52')],_0x311a1a[_0x6155('0x59')]);this[_0x6155('0x3d')][_0xa6fd34[_0x6155('0x82')]]=_0x311a1a;this[_0x6155('0x4a')](_0x311a1a,'queuecallerabandon');}}}catch(_0x483aca){logger['error'](_0x6155('0x95'),_0xa6fd34['uniqueid'],util[_0x6155('0x46')](_0x483aca,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6155('0x24')]=function(_0xfa2cb5){try{if(this['isNotNull'](_0xfa2cb5)){logger[_0x6155('0x4d')](_0x6155('0x96'),_0xfa2cb5['uniqueid'],util[_0x6155('0x46')](_0xfa2cb5,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xfa2cb5['uniqueid']]){var _0x5c8be8=_[_0x6155('0x8b')](this[_0x6155('0x12')][_0xfa2cb5[_0x6155('0x82')]]);_0x5c8be8[_0x6155('0x97')]=moment()[_0x6155('0x50')](_0x6155('0x91'));_0x5c8be8[_0x6155('0x98')]=_0xfa2cb5[_0x6155('0x98')];_0x5c8be8[_0x6155('0x99')]=_0xfa2cb5[_0x6155('0x99')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x5c8be8[_0x6155('0x52')],_0x5c8be8[_0x6155('0x59')],_0xfa2cb5['connectedlinenum'],_0xfa2cb5['connectedlinename']);this[_0x6155('0x3d')][_0xfa2cb5[_0x6155('0x82')]]=_0x5c8be8;this[_0x6155('0x88')](_0x5c8be8,_0x6155('0x23'));}}}catch(_0x16e86b){logger[_0x6155('0x44')](_0x6155('0x96'),_0xfa2cb5[_0x6155('0x82')],util['inspect'](_0x16e86b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6155('0xd')]['syncAgentConnect']=function(_0x3df53d){try{if(this[_0x6155('0x7a')](_0x3df53d)){logger['debug'](_0x6155('0x9a'),_0x3df53d['uniqueid'],util[_0x6155('0x46')](_0x3df53d,{'showHidden':![],'depth':null}));if(this[_0x6155('0x12')][_0x3df53d[_0x6155('0x82')]]){var _0x1cbc90=_[_0x6155('0x8b')](this[_0x6155('0x12')][_0x3df53d[_0x6155('0x82')]]);_0x1cbc90['queuecallercomplete']=!![];_0x1cbc90[_0x6155('0x56')]=_0x6155('0x9b');logger[_0x6155('0x7c')](_0x6155('0x9c'),_0x1cbc90[_0x6155('0x52')],_0x1cbc90[_0x6155('0x59')]);}}}catch(_0x401ed7){logger[_0x6155('0x44')](_0x6155('0x9a'),_0x3df53d['uniqueid'],util[_0x6155('0x46')](_0x401ed7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6155('0xd')][_0x6155('0x9d')]=function(_0x357719){try{if(this['isNotNull'](_0x357719)){logger[_0x6155('0x4d')](_0x6155('0x9e'),_0x357719['uniqueid'],util[_0x6155('0x46')](_0x357719,{'showHidden':![],'depth':null}));if(this[_0x6155('0x12')][_0x357719[_0x6155('0x82')]]){var _0x1eeeb8=_[_0x6155('0x8b')](this[_0x6155('0x12')][_0x357719[_0x6155('0x82')]]);_0x1eeeb8['queuecallerabandon']=![];_0x1eeeb8['queuecallerabandonAt']=null;_0x1eeeb8['assigned']=!![];_0x1eeeb8[_0x6155('0x93')]=_0x357719['membername'];_0x1eeeb8[_0x6155('0x8e')]=_0x357719['holdtime'];_0x1eeeb8[_0x6155('0x8c')]=!![];_0x1eeeb8[_0x6155('0x9f')]=![];_0x1eeeb8[_0x6155('0xa0')]=null;if(!_0x1eeeb8[_0x6155('0xa1')]){if(_0x357719[_0x6155('0xa2')]==_0x6155('0xa1')){_0x1eeeb8[_0x6155('0x56')]=_0x6155('0xa3');logger['info'](_0x6155('0xa4'),_0x1eeeb8[_0x6155('0x52')],_0x1eeeb8['type']);}else{if(_['startsWith'](_0x357719[_0x6155('0x42')][_0x6155('0xa5')](),_0x6155('0xa6'))){if(this['queueReports'][_0x357719[_0x6155('0xa7')]]){var _0x434a2d=_[_0x6155('0x8b')](this[_0x6155('0x12')][_0x357719['linkedid']]);_0x434a2d[_0x6155('0x8c')]=![];_0x434a2d[_0x6155('0x9f')]=!![];_0x434a2d[_0x6155('0xa0')]=moment(_0x1eeeb8[_0x6155('0x83')])['add'](_0x357719[_0x6155('0x8e')],'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');_0x434a2d[_0x6155('0x56')]='FORWARDTRANSFER';_0x434a2d[_0x6155('0xa1')]=!![];_0x434a2d[_0x6155('0xa8')]=_0x6155('0xa9');_0x434a2d[_0x6155('0xaa')]=_0x357719[_0x6155('0xab')];_0x434a2d[_0x6155('0xac')]=_0x357719[_0x6155('0x82')];logger[_0x6155('0x7c')](_0x6155('0xad'),_0x434a2d[_0x6155('0x52')],_0x434a2d[_0x6155('0x59')]);var _0x2a6752=this[_0x6155('0x12')][_0x357719[_0x6155('0xa7')]];this['queueReports'][_0x357719[_0x6155('0xa7')]]=this[_0x6155('0x12')][_0x357719['uniqueid']];this['queueReports'][_0x357719['uniqueid']]=_0x2a6752;}}else{_0x1eeeb8[_0x6155('0x56')]=_0x6155('0xae')+_0x357719[_0x6155('0xa2')]['toUpperCase']();logger[_0x6155('0x7c')](_0x6155('0xaf'),_0x1eeeb8[_0x6155('0x52')],_0x1eeeb8[_0x6155('0x59')],_0x1eeeb8[_0x6155('0x56')]);}}}this[_0x6155('0x3d')][_0x357719[_0x6155('0x82')]]=_0x1eeeb8;this[_0x6155('0x4a')](_0x1eeeb8,_0x6155('0xb0'));}}}catch(_0x8b0d2){logger['error'](_0x6155('0x9e'),_0x357719['uniqueid'],util[_0x6155('0x46')](_0x8b0d2,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6155('0xb1')]=function(_0x4034f6){try{if(this[_0x6155('0x7a')](_0x4034f6)){logger[_0x6155('0x4d')](_0x6155('0xb2'),_0x4034f6['uniqueid'],util['inspect'](_0x4034f6,{'showHidden':![],'depth':null}));this[_0x6155('0xb3')](_0x4034f6[_0x6155('0x82')],_[_0x6155('0xb4')](_0x4034f6[_0x6155('0xb5')])[0x0],_0x4034f6['value']);if(this[_0x6155('0x12')][_0x4034f6[_0x6155('0x82')]]){var _0x17675e=_[_0x6155('0x8b')](this[_0x6155('0x12')][_0x4034f6[_0x6155('0x82')]]);if(_0x17675e){if(this[_0x6155('0x7a')](_0x4034f6[_0x6155('0xb5')])&&this[_0x6155('0x7a')](_0x4034f6[_0x6155('0xb5')][_0x6155('0x64')])){switch(_0x4034f6['value']){case _0x6155('0xb6'):_0x17675e['queuecallerexit']=![];_0x17675e['queuecallerexitAt']=null;break;case _0x6155('0xb7'):_0x17675e[_0x6155('0xb8')]=_0x6155('0xb9');_0x17675e[_0x6155('0x9f')]=!![];_0x17675e[_0x6155('0xa0')]=moment()[_0x6155('0x50')](_0x6155('0x91'));_0x17675e[_0x6155('0x97')]=moment()[_0x6155('0x50')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x6155('0x4d')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x4034f6[_0x6155('0x82')],util[_0x6155('0x46')](_0x17675e,{'showHidden':![],'depth':null}));ami[_0x6155('0x4c')](_0x6155('0xba'),_0x17675e);break;default:_0x17675e[_0x6155('0x9f')]=!![];_0x17675e[_0x6155('0xa0')]=moment()[_0x6155('0x50')](_0x6155('0x91'));_0x17675e[_0x6155('0x97')]=moment()[_0x6155('0x50')](_0x6155('0x91'));}_0x17675e[_0x6155('0x22')]=![];_0x17675e[_0x6155('0x90')]=null;_0x17675e['queuecallerexitreason']=_0x4034f6['value'];this['channels'][_0x4034f6['uniqueid']]=_0x17675e;this[_0x6155('0x4a')](_0x17675e,_0x6155('0x26'));}else if(this['isNotNull'](_0x4034f6[_0x6155('0xb5')])&&this['isNotNull'](_0x4034f6[_0x6155('0xb5')][_0x6155('0xbb')])){if(!_0x17675e[_0x6155('0x22')]){_0x17675e['queuecallerexit']=!![];_0x17675e[_0x6155('0xa0')]=moment()[_0x6155('0x50')](_0x6155('0x91'));_0x17675e[_0x6155('0x56')]=_0x6155('0xbc');_0x17675e[_0x6155('0x97')]=moment()[_0x6155('0x50')](_0x6155('0x91'));this[_0x6155('0x3d')][_0x4034f6[_0x6155('0x82')]]=_0x17675e;}}logger[_0x6155('0x7c')](_0x6155('0xbd'),_0x4034f6['uniqueid'],_0x17675e[_0x6155('0x52')],_0x17675e[_0x6155('0x59')],_['keys'](_0x4034f6[_0x6155('0xb5')])[0x0],_0x4034f6[_0x6155('0xbe')]);_0x17675e[_0x6155('0x18')]=this[_0x6155('0x18')][_0x4034f6[_0x6155('0x82')]];}}}}catch(_0x2788e7){logger[_0x6155('0x44')]('[%s][voiceQueueReport][varset]',_0x4034f6[_0x6155('0x82')],util['inspect'](_0x2788e7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6155('0xd')][_0x6155('0xb3')]=function(_0x348ce4,_0x4bb6d0,_0x2cbf9e){var _0x3b79e7=[_0x6155('0xbf'),'rtpaudioqosbridged','rtpaudioqosjitter',_0x6155('0xc0'),_0x6155('0xc1'),_0x6155('0xc2'),_0x6155('0xc3'),_0x6155('0xc4'),_0x6155('0xc5'),_0x6155('0xc6'),_0x6155('0xc7'),'bridgepvtcallid',_0x6155('0xc8'),'memberdynamic',_0x6155('0xc9'),_0x6155('0xca'),_0x6155('0xcb'),'memberpenalty',_0x6155('0xcc')];if(!_[_0x6155('0x3f')](_0x4bb6d0)&&!_[_0x6155('0x6c')](_0x3b79e7,_0x4bb6d0)){if(_['isUndefined'](this[_0x6155('0x18')][_0x348ce4])){this[_0x6155('0x18')][_0x348ce4]={};}this[_0x6155('0x18')][_0x348ce4][_0x4bb6d0]=_0x2cbf9e;}};VoiceQueueReport[_0x6155('0xd')][_0x6155('0xcd')]=function(_0x4c9cd5,_0x137309,_0x20692e){var _0x23df54={};for(var _0x434d35=0x0;_0x434d350x0?!![]:![];if(!_0x36a97d){return this[_0x458d('0x19')](this[_0x458d('0x54')][_0x458d('0x86')]);}};VoiceQueueReport[_0x458d('0x43')][_0x458d('0x1b')]=function(_0x114525){var _0x174044=this[_0x458d('0x54')]['id'];if(this['summary'][_0x458d('0x72')][_0x174044]&&this[_0x458d('0x54')][_0x458d('0x72')][_0x174044][_0x114525[_0x458d('0x70')]]){this[_0x458d('0x54')]['queuestatus'][_0x174044][_0x114525[_0x458d('0x70')]][_0x458d('0x11')][_0x458d('0x87')](_0x114525);}};VoiceQueueReport[_0x458d('0x43')]['syncQueueSummary']=function(_0x339de9){var _0x7c4622=this;try{if(this[_0x458d('0x6b')](_0x339de9)&&this['isNotNull'](_0x339de9[_0x458d('0x83')])){logger['debug'](_0x458d('0x88'),util[_0x458d('0x4e')](_0x339de9,{'showHidden':![],'depth':null}));var _0x26074c=this[_0x458d('0x12')][_0x339de9['queue']];if(_0x26074c){logger['info'](_0x458d('0x89'),_0x26074c[_0x458d('0x5e')]);this[_0x458d('0x54')][_0x458d('0x6d')][_0x26074c[_0x458d('0x5e')]]={'summaryEvent':_0x339de9};this['summary']['statusRequests']+=0x1;return ami[_0x458d('0x49')]({'action':_0x458d('0x72'),'queue':_0x26074c[_0x458d('0x5e')]})[_0x458d('0x6f')](function(_0xb06feb){_0x7c4622[_0x458d('0x54')]['queuestatus'][_0x339de9[_0x458d('0x70')]][_0xb06feb[_0x458d('0x70')]]={'queue':_0x26074c[_0x458d('0x5e')],'agents':[]};})[_0x458d('0x4c')](function(_0x160433){throw _0x160433;});}}}catch(_0x57ae04){logger[_0x458d('0x4f')](_0x458d('0x73'),util['inspect'](_0x57ae04,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x458d('0x43')]['syncQueueSummaryComplete']=function(_0x5ab570){if(this[_0x458d('0x54')][_0x458d('0x85')]>0x0){this[_0x458d('0x54')]['completeEvent']=_0x5ab570;return;}logger['debug'](_0x458d('0x8a'),util[_0x458d('0x4e')](_0x5ab570,{'showHidden':![],'depth':null}));this[_0x458d('0x54')]=initializeSummary();ami[_0x458d('0x57')](_0x458d('0x8b'),{});};VoiceQueueReport[_0x458d('0x43')][_0x458d('0x1f')]=function(_0x2c28d6){try{if(this[_0x458d('0x6b')](_0x2c28d6)){logger['debug'](_0x458d('0x8c'),_0x2c28d6[_0x458d('0x5c')],util[_0x458d('0x4e')](_0x2c28d6,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x2c28d6['uniqueid']]))this['queueReports'][_0x2c28d6[_0x458d('0x5c')]]=[];if(_[_0x458d('0x6c')](this[_0x458d('0x45')][_0x2c28d6['uniqueid']]))this[_0x458d('0x45')][_0x2c28d6[_0x458d('0x5c')]]={};var _0x500116=new QueueReport();_0x500116['name']=_0x2c28d6[_0x458d('0x83')];_0x500116[_0x458d('0x8d')]=this[_0x458d('0x12')][_0x500116[_0x458d('0x5e')]]&&this[_0x458d('0x12')][_0x500116[_0x458d('0x5e')]]['type']?this['voiceQueues'][_0x500116['name']][_0x458d('0x8d')]||_0x458d('0x66'):_0x458d('0x66');_0x500116[_0x458d('0x83')]=_0x2c28d6[_0x458d('0x83')];_0x500116[_0x458d('0x8e')]=moment()[_0x458d('0x69')](_0x458d('0x8f'));_0x500116[_0x458d('0x90')]=_0x2c28d6['position'];_0x500116[_0x458d('0x91')]=_0x2c28d6[_0x458d('0x91')];_0x500116['uniqueid']=_0x2c28d6[_0x458d('0x5c')];_0x500116[_0x458d('0x92')]=this[_0x458d('0x45')][_0x2c28d6[_0x458d('0x5c')]][_0x458d('0x92')];logger[_0x458d('0x93')](_0x458d('0x94'),_0x500116[_0x458d('0x5e')],_0x500116[_0x458d('0x8d')]);_['merge'](_0x500116,_['pick'](_0x2c28d6,_['keys'](_0x500116)));this[_0x458d('0x53')][_0x2c28d6[_0x458d('0x5c')]]['push'](_0x500116);this[_0x458d('0x45')][_0x2c28d6['uniqueid']]=_0x500116;this[_0x458d('0x58')](_0x500116,_0x458d('0x1e'));}}catch(_0xd4f15f){logger[_0x458d('0x4f')]('[%s][voiceQueueReport][queuecallerjoin]',_0x2c28d6[_0x458d('0x5c')],util[_0x458d('0x4e')](_0xd4f15f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x458d('0x43')][_0x458d('0x21')]=function(_0x587271){try{if(this[_0x458d('0x6b')](_0x587271)){logger[_0x458d('0x59')](_0x458d('0x95'),_0x587271[_0x458d('0x5c')],util[_0x458d('0x4e')](_0x587271,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x587271[_0x458d('0x5c')]]){var _0x95b4d0=_[_0x458d('0x96')](this[_0x458d('0x53')][_0x587271['uniqueid']]);_0x95b4d0[_0x458d('0x97')]=![];_0x95b4d0['queuecallercompleteAt']=null;_0x95b4d0[_0x458d('0x98')]=_0x587271[_0x458d('0x98')];_0x95b4d0[_0x458d('0x99')]=_0x587271[_0x458d('0x99')];_0x95b4d0[_0x458d('0x20')]=!![];_0x95b4d0[_0x458d('0x9a')]=moment()[_0x458d('0x69')](_0x458d('0x8f'));_0x95b4d0['queuecallerexitreason']=_0x458d('0x9b');_0x95b4d0[_0x458d('0x9c')]=null;logger[_0x458d('0x93')](_0x458d('0x9d'),_0x95b4d0[_0x458d('0x5e')],_0x95b4d0[_0x458d('0x8d')]);this[_0x458d('0x45')][_0x587271[_0x458d('0x5c')]]=_0x95b4d0;this[_0x458d('0x55')](_0x95b4d0,_0x458d('0x20'));}}}catch(_0x578fd3){logger[_0x458d('0x4f')](_0x458d('0x95'),_0x587271[_0x458d('0x5c')],util[_0x458d('0x4e')](_0x578fd3,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0xbd96c){try{if(this[_0x458d('0x6b')](_0xbd96c)){logger[_0x458d('0x59')](_0x458d('0x9e'),_0xbd96c[_0x458d('0x5c')],util['inspect'](_0xbd96c,{'showHidden':![],'depth':null}));if(this[_0x458d('0x53')][_0xbd96c[_0x458d('0x5c')]]){var _0x4cb335=_[_0x458d('0x96')](this['queueReports'][_0xbd96c['uniqueid']]);_0x4cb335[_0x458d('0x9f')]=moment()[_0x458d('0x69')](_0x458d('0x8f'));_0x4cb335[_0x458d('0xa0')]=_0xbd96c[_0x458d('0xa0')];_0x4cb335['connectedlinename']=_0xbd96c[_0x458d('0xa1')];logger[_0x458d('0x93')](_0x458d('0xa2'),_0x4cb335['name'],_0x4cb335[_0x458d('0x8d')],_0xbd96c[_0x458d('0xa0')],_0xbd96c['connectedlinename']);this[_0x458d('0x45')][_0xbd96c['uniqueid']]=_0x4cb335;this[_0x458d('0x58')](_0x4cb335,_0x458d('0x22'));}}}catch(_0x2fed6c){logger[_0x458d('0x4f')](_0x458d('0x9e'),_0xbd96c[_0x458d('0x5c')],util['inspect'](_0x2fed6c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x458d('0x43')][_0x458d('0x27')]=function(_0x17e544){try{if(this['isNotNull'](_0x17e544)){logger[_0x458d('0x59')](_0x458d('0xa3'),_0x17e544[_0x458d('0x5c')],util['inspect'](_0x17e544,{'showHidden':![],'depth':null}));if(this[_0x458d('0x53')][_0x17e544[_0x458d('0x5c')]]){var _0x4db8bd=_[_0x458d('0x96')](this[_0x458d('0x53')][_0x17e544['uniqueid']]);_0x4db8bd['queuecallercomplete']=!![];_0x4db8bd['queuecallerexitreason']=_0x458d('0xa4');logger[_0x458d('0x93')](_0x458d('0xa5'),_0x4db8bd[_0x458d('0x5e')],_0x4db8bd['type']);}}}catch(_0x58d6be){logger[_0x458d('0x4f')](_0x458d('0xa3'),_0x17e544['uniqueid'],util[_0x458d('0x4e')](_0x58d6be,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x458d('0x25')]=function(_0x2fb8de){try{if(this[_0x458d('0x6b')](_0x2fb8de)){logger[_0x458d('0x59')](_0x458d('0xa6'),_0x2fb8de[_0x458d('0x5c')],util['inspect'](_0x2fb8de,{'showHidden':![],'depth':null}));if(this[_0x458d('0x53')][_0x2fb8de[_0x458d('0x5c')]]){var _0xab531a=_[_0x458d('0x96')](this['queueReports'][_0x2fb8de[_0x458d('0x5c')]]);_0xab531a[_0x458d('0x20')]=![];_0xab531a[_0x458d('0x9a')]=null;_0xab531a[_0x458d('0xa7')]=!![];_0xab531a['lastAssignedTo']=_0x2fb8de[_0x458d('0xa8')];_0xab531a[_0x458d('0x98')]=_0x2fb8de[_0x458d('0x98')];_0xab531a[_0x458d('0x97')]=!![];_0xab531a[_0x458d('0xa9')]=![];_0xab531a[_0x458d('0xaa')]=null;if(!_0xab531a[_0x458d('0xab')]){if(_0x2fb8de[_0x458d('0xac')]=='transfer'){_0xab531a[_0x458d('0x62')]=_0x458d('0xad');logger[_0x458d('0x93')](_0x458d('0xae'),_0xab531a['name'],_0xab531a[_0x458d('0x8d')]);}else{if(_['startsWith'](_0x2fb8de['channel'][_0x458d('0xaf')](),_0x458d('0xb0'))){if(this[_0x458d('0x53')][_0x2fb8de[_0x458d('0xb1')]]){var _0x32470b=_[_0x458d('0x96')](this[_0x458d('0x53')][_0x2fb8de[_0x458d('0xb1')]]);_0x32470b[_0x458d('0x97')]=![];_0x32470b[_0x458d('0xa9')]=!![];_0x32470b[_0x458d('0xaa')]=moment(_0xab531a[_0x458d('0x8e')])[_0x458d('0xb2')](_0x2fb8de[_0x458d('0x98')],'seconds')['format'](_0x458d('0x8f'));_0x32470b[_0x458d('0x62')]=_0x458d('0xb3');_0x32470b[_0x458d('0xab')]=!![];_0x32470b[_0x458d('0xb4')]=_0x458d('0xb5');_0x32470b[_0x458d('0xb6')]=_0x2fb8de[_0x458d('0xb7')];_0x32470b[_0x458d('0xb8')]=_0x2fb8de[_0x458d('0x5c')];logger[_0x458d('0x93')](_0x458d('0xb9'),_0x32470b['name'],_0x32470b[_0x458d('0x8d')]);var _0xc88118=this[_0x458d('0x53')][_0x2fb8de[_0x458d('0xb1')]];this['queueReports'][_0x2fb8de[_0x458d('0xb1')]]=this[_0x458d('0x53')][_0x2fb8de['uniqueid']];this['queueReports'][_0x2fb8de[_0x458d('0x5c')]]=_0xc88118;}}else{_0xab531a[_0x458d('0x62')]=_0x458d('0xba')+_0x2fb8de[_0x458d('0xac')]['toUpperCase']();logger[_0x458d('0x93')](_0x458d('0xbb'),_0xab531a[_0x458d('0x5e')],_0xab531a['type'],_0xab531a[_0x458d('0x62')]);}}}this[_0x458d('0x45')][_0x2fb8de[_0x458d('0x5c')]]=_0xab531a;this[_0x458d('0x55')](_0xab531a,'agentcomplete');}}}catch(_0x1a3618){logger[_0x458d('0x4f')](_0x458d('0xa6'),_0x2fb8de[_0x458d('0x5c')],util['inspect'](_0x1a3618,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x458d('0x43')][_0x458d('0x29')]=function(_0x5d44d7){try{if(this[_0x458d('0x6b')](_0x5d44d7)){logger[_0x458d('0x59')](_0x458d('0xbc'),_0x5d44d7[_0x458d('0x5c')],util[_0x458d('0x4e')](_0x5d44d7,{'showHidden':![],'depth':null}));this[_0x458d('0xbd')](_0x5d44d7[_0x458d('0x5c')],_[_0x458d('0xbe')](_0x5d44d7['variable'])[0x0],_0x5d44d7['value']);if(this[_0x458d('0x53')][_0x5d44d7[_0x458d('0x5c')]]){var _0xc02226=_[_0x458d('0x96')](this[_0x458d('0x53')][_0x5d44d7['uniqueid']]);if(_0xc02226){if(this['isNotNull'](_0x5d44d7[_0x458d('0xbf')])&&this[_0x458d('0x6b')](_0x5d44d7[_0x458d('0xbf')][_0x458d('0x72')])){switch(_0x5d44d7[_0x458d('0xc0')]){case _0x458d('0xc1'):_0xc02226['queuecallerexit']=![];_0xc02226[_0x458d('0xaa')]=null;break;case _0x458d('0xc2'):_0xc02226['lastevent']=_0x458d('0xc3');_0xc02226[_0x458d('0xa9')]=!![];_0xc02226[_0x458d('0xaa')]=moment()[_0x458d('0x69')](_0x458d('0x8f'));_0xc02226[_0x458d('0x9f')]=moment()[_0x458d('0x69')](_0x458d('0x8f'));logger[_0x458d('0x59')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x5d44d7[_0x458d('0x5c')],util[_0x458d('0x4e')](_0xc02226,{'showHidden':![],'depth':null}));ami[_0x458d('0x57')]('custom:timeout',_0xc02226);break;default:_0xc02226[_0x458d('0xa9')]=!![];_0xc02226[_0x458d('0xaa')]=moment()[_0x458d('0x69')](_0x458d('0x8f'));_0xc02226[_0x458d('0x9f')]=moment()[_0x458d('0x69')](_0x458d('0x8f'));}_0xc02226['queuecallerabandon']=![];_0xc02226[_0x458d('0x9a')]=null;_0xc02226[_0x458d('0x62')]=_0x5d44d7[_0x458d('0xc0')];this[_0x458d('0x45')][_0x5d44d7[_0x458d('0x5c')]]=_0xc02226;this[_0x458d('0x55')](_0xc02226,_0x458d('0x28'));}else if(this[_0x458d('0x6b')](_0x5d44d7[_0x458d('0xbf')])&&this[_0x458d('0x6b')](_0x5d44d7['variable'][_0x458d('0xc4')])){if(!_0xc02226[_0x458d('0x20')]){_0xc02226[_0x458d('0xa9')]=!![];_0xc02226[_0x458d('0xaa')]=moment()[_0x458d('0x69')](_0x458d('0x8f'));_0xc02226[_0x458d('0x62')]='EXITWITHKEY';_0xc02226['queuecallerleaveAt']=moment()[_0x458d('0x69')](_0x458d('0x8f'));this[_0x458d('0x45')][_0x5d44d7['uniqueid']]=_0xc02226;}}logger['info'](_0x458d('0xc5'),_0x5d44d7['uniqueid'],_0xc02226[_0x458d('0x5e')],_0xc02226[_0x458d('0x8d')],_[_0x458d('0xbe')](_0x5d44d7['variable'])[0x0],_0x5d44d7[_0x458d('0xc0')]);_0xc02226[_0x458d('0x14')]=this['variables'][_0x5d44d7[_0x458d('0x5c')]];}}}}catch(_0x4a4e36){logger[_0x458d('0x4f')]('[%s][voiceQueueReport][varset]',_0x5d44d7['uniqueid'],util[_0x458d('0x4e')](_0x4a4e36,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x458d('0x43')][_0x458d('0xbd')]=function(_0x11f25f,_0x21ef67,_0x30b4b4){var _0x1ce816=[_0x458d('0xc6'),'rtpaudioqosbridged',_0x458d('0xc7'),_0x458d('0xc8'),'rtpaudioqosloss',_0x458d('0xc9'),_0x458d('0xca'),_0x458d('0xcb'),'sipcallid',_0x458d('0xcc'),'bridgepeer',_0x458d('0xcd'),_0x458d('0xce'),_0x458d('0xcf'),_0x458d('0xd0'),_0x458d('0xd1'),_0x458d('0xa8'),_0x458d('0xd2'),_0x458d('0xd3')];if(!_[_0x458d('0x48')](_0x21ef67)&&!_[_0x458d('0xd4')](_0x1ce816,_0x21ef67)){if(_['isUndefined'](this['variables'][_0x11f25f])){this[_0x458d('0x14')][_0x11f25f]={};}this['variables'][_0x11f25f][_0x21ef67]=_0x30b4b4;}};VoiceQueueReport[_0x458d('0x43')][_0x458d('0xd5')]=function(_0x1a5cd7,_0x3ae554,_0xc36581){var _0x1f7300={};for(var _0x331c36=0x0;_0x331c36=0x0?moment(_0x1cd58f[_0x6db6('0x17')])['diff'](_0x1cd58f[_0x6db6('0x18')],_0x6db6('0xc')):null,'data1':_0x6db6('0x19'),'data2':_0x1cd58f[_0x6db6('0x11')],'data3':_0x1cd58f[_0x6db6('0xe')],'data4':_0x1cd58f['dialstring']||null,'role':_0x6db6('0x10'),'internal':_0x1cd58f['accountcode']?_[_0x6db6('0x12')](_0x1cd58f[_0x6db6('0x11')]):undefined,'uniqueid':_0x1cd58f[_0x6db6('0x1a')]},'log':_0x6db6('0x13')});}; \ No newline at end of file +var _0x2a4b=['voice','lastAssignedTo','interface','format','SIP/%s','TALKING','queuecallerleaveAt','inbound','calleridnum','queue','accountcode','toNumber','uniqueid','membername','endtime','diff','starttime','seconds','outbound','exten','dialstring','moment','../client','queuecallercompleteAt','Request','CreateMemberReport'];(function(_0x1cbb0f,_0x373874){var _0x1ef60c=function(_0x50b49d){while(--_0x50b49d){_0x1cbb0f['push'](_0x1cbb0f['shift']());}};_0x1ef60c(++_0x373874);}(_0x2a4b,0x167));var _0xb2a4=function(_0x22ca57,_0x5c491b){_0x22ca57=_0x22ca57-0x0;var _0x192e46=_0x2a4b[_0x22ca57];return _0x192e46;};'use strict';var moment=require(_0xb2a4('0x0'));var _=require('lodash');var util=require('util');var client=require(_0xb2a4('0x1'));exports['voiceQueueReport']=function(_0x2d3140){var _0x4fc88c=_0x2d3140[_0xb2a4('0x2')]||_0x2d3140['queuecallerexitAt'];return client[_0xb2a4('0x3')](_0xb2a4('0x4'),{'body':{'channel':_0xb2a4('0x5'),'membername':_0x2d3140[_0xb2a4('0x6')],'interface':_['isNil'](_0x2d3140[_0xb2a4('0x7')])?util[_0xb2a4('0x8')](_0xb2a4('0x9'),_0x2d3140[_0xb2a4('0x6')]):_0x2d3140[_0xb2a4('0x7')],'type':_0xb2a4('0xa'),'enterAt':_0x2d3140[_0xb2a4('0xb')],'exitAt':_0x4fc88c,'duration':moment(_0x4fc88c)['diff'](_0x2d3140['queuecallerleaveAt'],'seconds'),'data1':_0xb2a4('0xc'),'data2':_0x2d3140[_0xb2a4('0xd')],'data3':_0x2d3140['exten'],'data4':null,'data5':_0x2d3140[_0xb2a4('0xe')],'role':'agent','internal':_0x2d3140[_0xb2a4('0xf')]?_[_0xb2a4('0x10')](_0x2d3140[_0xb2a4('0xf')]):undefined,'uniqueid':_0x2d3140[_0xb2a4('0x11')]},'log':'CreateMemberReport'});};exports['voiceDialReport']=function(_0x53fdbe){return client[_0xb2a4('0x3')](_0xb2a4('0x4'),{'body':{'channel':'voice','membername':_0x53fdbe[_0xb2a4('0x12')],'interface':_0x53fdbe[_0xb2a4('0x7')],'type':'TALKING','enterAt':_0x53fdbe['starttime'],'exitAt':_0x53fdbe[_0xb2a4('0x13')],'duration':moment(_0x53fdbe[_0xb2a4('0x13')])[_0xb2a4('0x14')](_0x53fdbe[_0xb2a4('0x15')],_0xb2a4('0x16'))>=0x0?moment(_0x53fdbe[_0xb2a4('0x13')])[_0xb2a4('0x14')](_0x53fdbe['starttime'],_0xb2a4('0x16')):null,'data1':_0xb2a4('0x17'),'data2':_0x53fdbe[_0xb2a4('0xf')],'data3':_0x53fdbe[_0xb2a4('0x18')],'data4':_0x53fdbe[_0xb2a4('0x19')]||null,'role':'agent','internal':_0x53fdbe[_0xb2a4('0xf')]?_[_0xb2a4('0x10')](_0x53fdbe['accountcode']):undefined,'uniqueid':_0x53fdbe[_0xb2a4('0x11')]},'log':_0xb2a4('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index c8973e2..4ed3808 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 _0xb1a4=['Request','GetSettings','../client','getSettings'];(function(_0x187204,_0x121717){var _0xd30c69=function(_0x3ff850){while(--_0x3ff850){_0x187204['push'](_0x187204['shift']());}};_0xd30c69(++_0x121717);}(_0xb1a4,0x16a));var _0x4b1a=function(_0x57aef3,_0x475d9b){_0x57aef3=_0x57aef3-0x0;var _0x5e553e=_0xb1a4[_0x57aef3];return _0x5e553e;};'use strict';var client=require(_0x4b1a('0x0'));exports[_0x4b1a('0x1')]=function(){return client[_0x4b1a('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer','previewRecallmeReminderInterval']},'log':_0x4b1a('0x3')});}; \ No newline at end of file +var _0x8d05=['ShowSetting','stopRecordingOnTransfer','../client','getSettings','Request'];(function(_0x4251fc,_0x45a6be){var _0x43f5b0=function(_0x783a5){while(--_0x783a5){_0x4251fc['push'](_0x4251fc['shift']());}};_0x43f5b0(++_0x45a6be);}(_0x8d05,0xe8));var _0x58d0=function(_0x2bfe36,_0x5773b3){_0x2bfe36=_0x2bfe36-0x0;var _0x17dd89=_0x8d05[_0x2bfe36];return _0x17dd89;};'use strict';var client=require(_0x58d0('0x0'));exports[_0x58d0('0x1')]=function(){return client[_0x58d0('0x2')](_0x58d0('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x58d0('0x4'),'previewRecallmeReminderInterval']},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 7b0961a..0e422a1 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 _0x9652=['../client','getTemplates','Request','GetTemplate','name'];(function(_0x1890b3,_0x52eae8){var _0x3866d7=function(_0x5e4e6e){while(--_0x5e4e6e){_0x1890b3['push'](_0x1890b3['shift']());}};_0x3866d7(++_0x52eae8);}(_0x9652,0xaf));var _0x2965=function(_0x433650,_0x2780ed){_0x433650=_0x433650-0x0;var _0x13ce1d=_0x9652[_0x433650];return _0x13ce1d;};'use strict';var client=require(_0x2965('0x0'));exports[_0x2965('0x1')]=function(_0x5ed1ff){return function(_0x41dbb1){return client[_0x2965('0x2')](_0x2965('0x3'),{'options':{'raw':!![],'attributes':['id',_0x2965('0x4'),'html']},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x1aab=['html','GetTemplate','../client','getTemplates','Request','name'];(function(_0x478fd9,_0x252d54){var _0x993ea6=function(_0x42bceb){while(--_0x42bceb){_0x478fd9['push'](_0x478fd9['shift']());}};_0x993ea6(++_0x252d54);}(_0x1aab,0x122));var _0xb1aa=function(_0x319f60,_0x4f36b0){_0x319f60=_0x319f60-0x0;var _0x1d4491=_0x1aab[_0x319f60];return _0x1d4491;};'use strict';var client=require(_0xb1aa('0x0'));exports[_0xb1aa('0x1')]=function(_0x424fbc){return function(_0x549949){return client[_0xb1aa('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xb1aa('0x3'),_0xb1aa('0x4')]},'log':_0xb1aa('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 3b102ba..809e383 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 _0xccdb=['data3','data4','data5','data6','getTriggers','GetTrigger','name','channel','status','Condition','field','operator','value','AnyConditions','Action','Actions','action','data1','data2'];(function(_0x3c5b3a,_0x570586){var _0x3d43c1=function(_0x2f26b9){while(--_0x2f26b9){_0x3c5b3a['push'](_0x3c5b3a['shift']());}};_0x3d43c1(++_0x570586);}(_0xccdb,0xfb));var _0xbccd=function(_0x714f44,_0x6d7dd8){_0x714f44=_0x714f44-0x0;var _0x5625ae=_0xccdb[_0x714f44];return _0x5625ae;};'use strict';var client=require('../client');exports[_0xbccd('0x0')]=function(_0x4e3737){return function(_0x50f113){return client['Request'](_0xbccd('0x1'),{'options':{'raw':![],'attributes':['id',_0xbccd('0x2'),_0xbccd('0x3'),_0xbccd('0x4')],'include':[{'model':_0xbccd('0x5'),'as':'AllConditions','attributes':['id',_0xbccd('0x6'),_0xbccd('0x7'),_0xbccd('0x8')]},{'model':'Condition','as':_0xbccd('0x9'),'attributes':['id',_0xbccd('0x6'),'operator',_0xbccd('0x8')]},{'model':_0xbccd('0xa'),'as':_0xbccd('0xb'),'attributes':['id',_0xbccd('0xc'),_0xbccd('0xd'),_0xbccd('0xe'),_0xbccd('0xf'),_0xbccd('0x10'),_0xbccd('0x11'),_0xbccd('0x12'),'data7']}]},'log':_0xbccd('0x1')});};}; \ No newline at end of file +var _0x5eb6=['data3','data5','data6','data7','../client','getTriggers','Request','GetTrigger','channel','Condition','AnyConditions','field','operator','value','Action','Actions','action'];(function(_0x10df18,_0x13338c){var _0x1f9a1d=function(_0x3157f4){while(--_0x3157f4){_0x10df18['push'](_0x10df18['shift']());}};_0x1f9a1d(++_0x13338c);}(_0x5eb6,0x114));var _0x65eb=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x5eb6[_0x178e48];return _0x440d7e;};'use strict';var client=require(_0x65eb('0x0'));exports[_0x65eb('0x1')]=function(_0x44fa81){return function(_0x5bfc4d){return client[_0x65eb('0x2')](_0x65eb('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x65eb('0x4'),'status'],'include':[{'model':'Condition','as':'AllConditions','attributes':['id','field','operator','value']},{'model':_0x65eb('0x5'),'as':_0x65eb('0x6'),'attributes':['id',_0x65eb('0x7'),_0x65eb('0x8'),_0x65eb('0x9')]},{'model':_0x65eb('0xa'),'as':_0x65eb('0xb'),'attributes':['id',_0x65eb('0xc'),'data1','data2',_0x65eb('0xd'),'data4',_0x65eb('0xe'),_0x65eb('0xf'),_0x65eb('0x10')]}]},'log':_0x65eb('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index cfe90bc..69fe845 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 _0x5b96=['name','registry','defaultuser','../client','GetTrunk'];(function(_0x3e451f,_0x10500d){var _0x57978f=function(_0x52f960){while(--_0x52f960){_0x3e451f['push'](_0x3e451f['shift']());}};_0x57978f(++_0x10500d);}(_0x5b96,0xbc));var _0x65b9=function(_0x3eef60,_0x9eb279){_0x3eef60=_0x3eef60-0x0;var _0x569efe=_0x5b96[_0x3eef60];return _0x569efe;};'use strict';var client=require(_0x65b9('0x0'));exports['getTrunks']=function(_0x143612){return function(_0x248d34){return client['Request'](_0x65b9('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x65b9('0x2'),_0x65b9('0x3'),_0x65b9('0x4')]},'log':_0x65b9('0x1')});};}; \ No newline at end of file +var _0x5580=['Request','GetTrunk','name','defaultuser','../client','getTrunks'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x5580,0xa6));var _0x0558=function(_0x567617,_0x11a166){_0x567617=_0x567617-0x0;var _0x4e2262=_0x5580[_0x567617];return _0x4e2262;};'use strict';var client=require(_0x0558('0x0'));exports[_0x0558('0x1')]=function(_0x134a4c){return function(_0x5451a5){return client[_0x0558('0x2')](_0x0558('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x0558('0x4'),'registry',_0x0558('0x5')]},'log':_0x0558('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 3331d27..6f5c7f7 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 _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0xe13bb4,_0x4a31a7){var _0x5e4310=function(_0xf56e78){while(--_0xf56e78){_0xe13bb4['push'](_0xe13bb4['shift']());}};_0x5e4310(++_0x4a31a7);}(_0xedd9,0xfc));var _0x9edd=function(_0x1cf247,_0x3f34d0){_0x1cf247=_0x1cf247-0x0;var _0x44583f=_0xedd9[_0x1cf247];return _0x44583f;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file +var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x48ad95,_0x243ef4){var _0x7a34b9=function(_0x19462b){while(--_0x19462b){_0x48ad95['push'](_0x48ad95['shift']());}};_0x7a34b9(++_0x243ef4);}(_0xedd9,0xfc));var _0x9edd=function(_0x138d6d,_0x4dc6f9){_0x138d6d=_0x138d6d-0x0;var _0x3f080a=_0xedd9[_0x138d6d];return _0x3f080a;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 2bb18e6..ff704ef 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 _0xba1c=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x41094d,_0x4ca21d){var _0x503ee1=function(_0x7e4dac){while(--_0x7e4dac){_0x41094d['push'](_0x41094d['shift']());}};_0x503ee1(++_0x4ca21d);}(_0xba1c,0xfb));var _0xcba1=function(_0x11596a,_0x9399a1){_0x11596a=_0x11596a-0x0;var _0x3b898a=_0xba1c[_0x11596a];return _0x3b898a;};'use strict';var client=require(_0xcba1('0x0'));exports[_0xcba1('0x1')]=function(_0x512934){return client[_0xcba1('0x2')](_0xcba1('0x3'),{'body':_0x512934,'log':'CreateVoiceAgentReport'});};exports[_0xcba1('0x4')]=function(_0x462f37,_0xd05011,_0xf72df){return client['Request'](_0xcba1('0x5'),{'body':_0x462f37,'options':{'where':{'uniqueid':_0xd05011,'interface':_0xf72df,'agentcomplete':!![]}},'log':_0xcba1('0x5')});}; \ No newline at end of file +var _0xd1ef=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x17173f,_0x3afb87){var _0x205c97=function(_0x45b52f){while(--_0x45b52f){_0x17173f['push'](_0x17173f['shift']());}};_0x205c97(++_0x3afb87);}(_0xd1ef,0x79));var _0xfd1e=function(_0x5cecb4,_0x4fba38){_0x5cecb4=_0x5cecb4-0x0;var _0x5affc1=_0xd1ef[_0x5cecb4];return _0x5affc1;};'use strict';var client=require(_0xfd1e('0x0'));exports[_0xfd1e('0x1')]=function(_0x5741ce){return client[_0xfd1e('0x2')](_0xfd1e('0x3'),{'body':_0x5741ce,'log':'CreateVoiceAgentReport'});};exports[_0xfd1e('0x4')]=function(_0x138cb0,_0x5aa540,_0x5f2c9a){return client[_0xfd1e('0x2')](_0xfd1e('0x5'),{'body':_0x138cb0,'options':{'where':{'uniqueid':_0x5aa540,'interface':_0x5f2c9a,'agentcomplete':!![]}},'log':_0xfd1e('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index d1f6a01..b6173bc 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 _0x348d=['type','disposition','duration','billableseconds','moment','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','callerid','DOCUMENTATION','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf'];(function(_0x1b5329,_0x13cdcb){var _0x443464=function(_0x2da49b){while(--_0x2da49b){_0x1b5329['push'](_0x1b5329['shift']());}};_0x443464(++_0x13cdcb);}(_0x348d,0x180));var _0xd348=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0x348d[_0x46ae5a];return _0x434986;};'use strict';var moment=require(_0xd348('0x0'));var util=require('util');var _=require(_0xd348('0x1'));var client=require(_0xd348('0x2'));exports[_0xd348('0x3')]=function(_0x5c4ecb){return client[_0xd348('0x4')](_0xd348('0x5'),{'body':_[_0xd348('0x6')](_0x5c4ecb,{'source':_0x5c4ecb[_0xd348('0x7')],'destinationcontext':_0x5c4ecb['context'],'callerid':_0x5c4ecb[_0xd348('0x8')],'amaflags':_0xd348('0x9')}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client[_0xd348('0x4')]('GetVoiceCallReport',{'options':{'where':{'type':[_0xd348('0xa')],'createdAt':{'$between':[moment()['startOf'](_0xd348('0xb'))[_0xd348('0xc')](_0xd348('0xd')),moment()[_0xd348('0xe')]('day')[_0xd348('0xc')](_0xd348('0xd'))]}},'attributes':[_0xd348('0xf'),_0xd348('0x10'),_0xd348('0x11'),_0xd348('0x12')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x7bce=['DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','billableseconds','GetVoiceCallReports','moment','util','../client','create','CreateVoiceCallReport','calleridnum','context'];(function(_0x5dfdc7,_0x587032){var _0x419f9d=function(_0x2e17b1){while(--_0x2e17b1){_0x5dfdc7['push'](_0x5dfdc7['shift']());}};_0x419f9d(++_0x587032);}(_0x7bce,0x70));var _0xe7bc=function(_0x5642c1,_0x2d6e21){_0x5642c1=_0x5642c1-0x0;var _0x351e2e=_0x7bce[_0x5642c1];return _0x351e2e;};'use strict';var moment=require(_0xe7bc('0x0'));var util=require(_0xe7bc('0x1'));var _=require('lodash');var client=require(_0xe7bc('0x2'));exports[_0xe7bc('0x3')]=function(_0x549712){return client['Request'](_0xe7bc('0x4'),{'body':_['merge'](_0x549712,{'source':_0x549712[_0xe7bc('0x5')],'destinationcontext':_0x549712[_0xe7bc('0x6')],'callerid':_0x549712['callerid'],'amaflags':_0xe7bc('0x7')}),'log':'CreateVoiceCallReport'});};exports[_0xe7bc('0x8')]=function(){return function(){return client['Request'](_0xe7bc('0x9'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xe7bc('0xa')]('day')[_0xe7bc('0xb')](_0xe7bc('0xc')),moment()[_0xe7bc('0xd')](_0xe7bc('0xe'))[_0xe7bc('0xb')](_0xe7bc('0xc'))]}},'attributes':['type','disposition','duration',_0xe7bc('0xf')]},'log':_0xe7bc('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 71f7bfb..8a5d2c6 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 _0x605e=['create','Request','CreateVoiceDialReport'];(function(_0x39973d,_0x486168){var _0x1767d1=function(_0x324af7){while(--_0x324af7){_0x39973d['push'](_0x39973d['shift']());}};_0x1767d1(++_0x486168);}(_0x605e,0x1bf));var _0xe605=function(_0x5ec285,_0x1b4f77){_0x5ec285=_0x5ec285-0x0;var _0x41f73e=_0x605e[_0x5ec285];return _0x41f73e;};'use strict';var client=require('../client');exports[_0xe605('0x0')]=function(_0x21d7d1){return client[_0xe605('0x1')](_0xe605('0x2'),{'body':_0x21d7d1,'log':_0xe605('0x2')});}; \ No newline at end of file +var _0x678e=['create','Request','CreateVoiceDialReport'];(function(_0x48b810,_0x173a5e){var _0x23c17d=function(_0x38531e){while(--_0x38531e){_0x48b810['push'](_0x48b810['shift']());}};_0x23c17d(++_0x173a5e);}(_0x678e,0xfc));var _0xe678=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x678e[_0x1ac595];return _0x455fff;};'use strict';var client=require('../client');exports[_0xe678('0x0')]=function(_0x2da358){return client[_0xe678('0x1')](_0xe678('0x2'),{'body':_0x2da358,'log':_0xe678('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index ec35691..9cfa7ef 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 _0xd691=['../client','getVoiceExtensions','Request','exten','recordingFormat'];(function(_0x44ca6e,_0x5e2c91){var _0x2edab2=function(_0x3afa91){while(--_0x3afa91){_0x44ca6e['push'](_0x44ca6e['shift']());}};_0x2edab2(++_0x5e2c91);}(_0xd691,0xe6));var _0x1d69=function(_0x146eed,_0x547c97){_0x146eed=_0x146eed-0x0;var _0x17cdc4=_0xd691[_0x146eed];return _0x17cdc4;};'use strict';var client=require(_0x1d69('0x0'));exports[_0x1d69('0x1')]=function(){return function(){return client[_0x1d69('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x1d69('0x3'),_0x1d69('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x1d69('0x1')});};}; \ No newline at end of file +var _0xc9c3=['GetVoiceExtension','getVoiceExtensions','Request'];(function(_0x28cc2d,_0x2a0998){var _0x26951b=function(_0x54ece3){while(--_0x54ece3){_0x28cc2d['push'](_0x28cc2d['shift']());}};_0x26951b(++_0x2a0998);}(_0xc9c3,0xd0));var _0x3c9c=function(_0x4ccc53,_0x95c2f){_0x4ccc53=_0x4ccc53-0x0;var _0x2d8d7e=_0xc9c3[_0x4ccc53];return _0x2d8d7e;};'use strict';var client=require('../client');exports[_0x3c9c('0x0')]=function(){return function(){return client[_0x3c9c('0x1')](_0x3c9c('0x2'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x3c9c('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 505d910..3c07321 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 _0x81c3=['dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','getVoiceQueues','Request','name','acw','monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval'];(function(_0x9e93f7,_0x4e60a5){var _0x1d6a5e=function(_0x20cd65){while(--_0x20cd65){_0x9e93f7['push'](_0x9e93f7['shift']());}};_0x1d6a5e(++_0x4e60a5);}(_0x81c3,0xd2));var _0x381c=function(_0x59c59b,_0x2ef8ac){_0x59c59b=_0x59c59b-0x0;var _0x5665ae=_0x81c3[_0x59c59b];return _0x5665ae;};'use strict';var client=require('../client');exports[_0x381c('0x0')]=function(){return function(){return client[_0x381c('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x381c('0x2'),_0x381c('0x3'),'acwTimeout','autopause',_0x381c('0x4'),_0x381c('0x5'),'dialActive',_0x381c('0x6'),_0x381c('0x7'),_0x381c('0x8'),_0x381c('0x9'),_0x381c('0xa'),_0x381c('0xb'),_0x381c('0xc'),_0x381c('0xd'),_0x381c('0xe'),_0x381c('0xf'),_0x381c('0x10'),_0x381c('0x11'),_0x381c('0x12'),_0x381c('0x13'),_0x381c('0x14'),_0x381c('0x15'),'dialBusyRetryFrequency',_0x381c('0x16'),_0x381c('0x17'),_0x381c('0x18'),'dialTimezone',_0x381c('0x19'),_0x381c('0x1a'),_0x381c('0x1b'),_0x381c('0x1c'),'dialAMDInitialSilence',_0x381c('0x1d'),_0x381c('0x1e'),'dialAMDTotalAnalysisTime',_0x381c('0x1f'),'dialAMDBetweenWordsSilence',_0x381c('0x20'),_0x381c('0x21'),_0x381c('0x22'),'timeout',_0x381c('0x23'),_0x381c('0x24'),_0x381c('0x25'),_0x381c('0x26'),'dialAgiAfterHangupClient','dialQueueProject2',_0x381c('0x4'),_0x381c('0x27'),_0x381c('0x28'),_0x381c('0x29'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency',_0x381c('0x2a'),_0x381c('0x2b'),_0x381c('0x2c'),'dialAbandonedRetryFrequency',_0x381c('0x2d'),_0x381c('0x2e'),_0x381c('0x2f'),_0x381c('0x30'),_0x381c('0x31'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0x381c('0x32'),_0x381c('0x33')],'include':[{'model':_0x381c('0x34'),'as':'Trunk','attributes':['id',_0x381c('0x2'),_0x381c('0x35'),_0x381c('0x36')]},{'model':'Pause','as':_0x381c('0x37'),'attributes':['id',_0x381c('0x2')]},{'model':_0x381c('0x34'),'as':_0x381c('0x38'),'attributes':['id',_0x381c('0x2'),_0x381c('0x35'),_0x381c('0x36')]},{'model':'Interval','as':_0x381c('0x39'),'attributes':['id',_0x381c('0x2')],'include':[{'model':_0x381c('0x39'),'as':_0x381c('0x3a'),'attributes':['id',_0x381c('0x2'),'interval']}]}]},'log':_0x381c('0x0')});};}; \ No newline at end of file +var _0xfc2f=['Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','acw','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','name','callerid','Pause','TrunkBackup','active','Interval'];(function(_0x5663d6,_0x528070){var _0x33e1e4=function(_0x31631f){while(--_0x31631f){_0x5663d6['push'](_0x5663d6['shift']());}};_0x33e1e4(++_0x528070);}(_0xfc2f,0x164));var _0xffc2=function(_0x5a65ec,_0x141672){_0x5a65ec=_0x5a65ec-0x0;var _0x5181ed=_0xfc2f[_0x5a65ec];return _0x5181ed;};'use strict';var client=require('../client');exports[_0xffc2('0x0')]=function(){return function(){return client[_0xffc2('0x1')](_0xffc2('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xffc2('0x3'),'acwTimeout','autopause','monitor_format','type','dialActive',_0xffc2('0x4'),_0xffc2('0x5'),_0xffc2('0x6'),'dialPowerLevel',_0xffc2('0x7'),_0xffc2('0x8'),_0xffc2('0x9'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout',_0xffc2('0xa'),_0xffc2('0xb'),_0xffc2('0xc'),_0xffc2('0xd'),_0xffc2('0xe'),_0xffc2('0xf'),'dialBusyRetryFrequency',_0xffc2('0x10'),_0xffc2('0x11'),'dialGlobalMaxRetry',_0xffc2('0x12'),_0xffc2('0x13'),_0xffc2('0x14'),'dialCheckDuplicateType',_0xffc2('0x15'),_0xffc2('0x16'),_0xffc2('0x17'),_0xffc2('0x18'),_0xffc2('0x19'),_0xffc2('0x1a'),_0xffc2('0x1b'),_0xffc2('0x1c'),_0xffc2('0x1d'),_0xffc2('0x1e'),_0xffc2('0x1f'),_0xffc2('0x20'),'dialRecallInQueue',_0xffc2('0x21'),_0xffc2('0x22'),_0xffc2('0x23'),_0xffc2('0x24'),_0xffc2('0x25'),'strategy',_0xffc2('0x26'),_0xffc2('0x27'),'dialNoSuchNumberMaxRetry',_0xffc2('0x28'),'dialDropMaxRetry','dialDropRetryFrequency',_0xffc2('0x29'),'dialAbandonedRetryFrequency',_0xffc2('0x2a'),'dialMachineRetryFrequency',_0xffc2('0x2b'),_0xffc2('0x2c'),_0xffc2('0x2d'),_0xffc2('0x2e'),_0xffc2('0x2f'),_0xffc2('0x30'),_0xffc2('0x31')],'include':[{'model':_0xffc2('0x32'),'as':_0xffc2('0x32'),'attributes':['id',_0xffc2('0x33'),_0xffc2('0x34'),'active']},{'model':_0xffc2('0x35'),'as':'mandatoryDispositionPause','attributes':['id',_0xffc2('0x33')]},{'model':'Trunk','as':_0xffc2('0x36'),'attributes':['id',_0xffc2('0x33'),_0xffc2('0x34'),_0xffc2('0x37')]},{'model':_0xffc2('0x38'),'as':_0xffc2('0x38'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0xffc2('0x39'),'attributes':['id','name',_0xffc2('0x3a')]}]}]},'log':_0xffc2('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 173c569..c93a667 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(_0x2ffcb1,_0x1b6f1f){var _0x2a7223=function(_0x539d5d){while(--_0x539d5d){_0x2ffcb1['push'](_0x2ffcb1['shift']());}};_0x2a7223(++_0x1b6f1f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x29539d,_0x1f4bf9){var _0x5848f8=function(_0x5d29f0){while(--_0x5d29f0){_0x29539d['push'](_0x29539d['shift']());}};_0x5848f8(++_0x1f4bf9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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 4a8bc72..ae7fed1 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 _0x705c=['../client','Request','getVoiceQueueRtPauses'];(function(_0x2cd5b7,_0x4aaa19){var _0x193480=function(_0x34170b){while(--_0x34170b){_0x2cd5b7['push'](_0x2cd5b7['shift']());}};_0x193480(++_0x4aaa19);}(_0x705c,0x1b9));var _0xc705=function(_0x4c582a,_0x1be6cf){_0x4c582a=_0x4c582a-0x0;var _0x23f6e7=_0x705c[_0x4c582a];return _0x23f6e7;};'use strict';var client=require(_0xc705('0x0'));exports['getVoiceQueueRtPauses']=function(_0xf0533b){return function(){return client[_0xc705('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0xf0533b,'paused':!![]},'raw':!![]},'log':_0xc705('0x2')});};}; \ No newline at end of file +var _0x98cd=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x45de99,_0x4e14ae){var _0x468408=function(_0x5d125a){while(--_0x5d125a){_0x45de99['push'](_0x45de99['shift']());}};_0x468408(++_0x4e14ae);}(_0x98cd,0x174));var _0xd98c=function(_0x1f5fa6,_0x5815be){_0x1f5fa6=_0x1f5fa6-0x0;var _0x3f93b5=_0x98cd[_0x1f5fa6];return _0x3f93b5;};'use strict';var client=require(_0xd98c('0x0'));exports[_0xd98c('0x1')]=function(_0x410a25){return function(){return client[_0xd98c('0x2')](_0xd98c('0x3'),{'options':{'where':{'VoiceQueueId':_0x410a25,'paused':!![]},'raw':!![]},'log':_0xd98c('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 08dc25d..73718e3 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(_0x5b0cf1,_0x1af244){var _0xe89408=function(_0x43a923){while(--_0x43a923){_0x5b0cf1['push'](_0x5b0cf1['shift']());}};_0xe89408(++_0x1af244);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x51725d,_0x4aca08){var _0x5bc237=function(_0x4de2fe){while(--_0x4de2fe){_0x51725d['push'](_0x51725d['shift']());}};_0x5bc237(++_0x4aca08);}(_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 diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 2099185..6a3d488 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 _0xf926=['transfereeexten','isexternal','context','extension','blind','attendedTransfer','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf926,0xbc));var _0x6f92=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf926[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x6f92('0x0'));exports[_0x6f92('0x1')]={};exports[_0x6f92('0x2')]=function(_0x21d01c){return client[_0x6f92('0x3')](_0x6f92('0x4'),{'body':{'result':_0x21d01c[_0x6f92('0x5')],'transfererchannel':_0x21d01c[_0x6f92('0x6')],'transferercalleridnum':_0x21d01c[_0x6f92('0x7')],'transferercalleridname':_0x21d01c[_0x6f92('0x8')],'transfererconnectedlinenum':_0x21d01c['transfererconnectedlinenum'],'transfererconnectedlinename':_0x21d01c[_0x6f92('0x9')],'transfereraccountcode':_0x21d01c[_0x6f92('0xa')],'transferercontext':_0x21d01c[_0x6f92('0xb')],'transfererexten':_0x21d01c['transfererexten'],'transfererlinkedid':_0x21d01c[_0x6f92('0xc')],'transfereechannel':_0x21d01c['transfereechannel'],'transfereecalleridnum':_0x21d01c['transfereecalleridnum'],'transfereecalleridname':_0x21d01c[_0x6f92('0xd')],'transfereeconnectedlinenum':_0x21d01c[_0x6f92('0xe')],'transfereeconnectedlinename':_0x21d01c['transfereeconnectedlinename'],'transfereeaccountcode':_0x21d01c[_0x6f92('0xf')],'transfereecontext':_0x21d01c['transfereecontext'],'transfereeexten':_0x21d01c[_0x6f92('0x10')],'transfereelinkedid':_0x21d01c['transfereelinkedid'],'isexternal':_0x21d01c[_0x6f92('0x11')],'context':_0x21d01c[_0x6f92('0x12')],'extension':_0x21d01c[_0x6f92('0x13')],'type':_0x6f92('0x14')},'log':_0x6f92('0x4')});};exports[_0x6f92('0x15')]=function(_0x2d435b){return client[_0x6f92('0x3')](_0x6f92('0x4'),{'body':{'result':_0x2d435b[_0x6f92('0x5')],'transfererchannel':_0x2d435b['origtransfererchannel'],'transferercalleridnum':_0x2d435b['origtransferercalleridnum'],'transferercalleridname':_0x2d435b['origtransferercalleridname'],'transfererconnectedlinenum':_0x2d435b['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2d435b[_0x6f92('0x16')],'transfereraccountcode':_0x2d435b[_0x6f92('0x17')],'transferercontext':_0x2d435b[_0x6f92('0x18')],'transfererexten':_0x2d435b['secondtransfererexten'],'transfererlinkedid':_0x2d435b[_0x6f92('0x19')],'transfereechannel':_0x2d435b[_0x6f92('0x1a')],'transfereecalleridnum':_0x2d435b[_0x6f92('0x1b')],'transfereecalleridname':_0x2d435b['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x2d435b['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2d435b[_0x6f92('0x1c')],'transfereeaccountcode':_0x2d435b['transfertargetaccountcode'],'transfereecontext':_0x2d435b[_0x6f92('0x1d')],'transfereeexten':_0x2d435b['transfertargetexten'],'transfereelinkedid':_0x2d435b[_0x6f92('0x1e')],'isexternal':_0x2d435b[_0x6f92('0x11')],'context':_0x2d435b[_0x6f92('0x1f')],'extension':_0x2d435b[_0x6f92('0x20')],'type':_0x6f92('0x21')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xb846=['transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','context','CreateVoiceTransferReport','result','origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','transfererchannel','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereeconnectedlinename'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xb846,0x1ba));var _0x6b84=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xb846[_0x3ab9ee];return _0x82ee88;};'use strict';var client=require(_0x6b84('0x0'));exports[_0x6b84('0x1')]={};exports[_0x6b84('0x2')]=function(_0x346ca3){return client[_0x6b84('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x346ca3['result'],'transfererchannel':_0x346ca3[_0x6b84('0x4')],'transferercalleridnum':_0x346ca3['transferercalleridnum'],'transferercalleridname':_0x346ca3[_0x6b84('0x5')],'transfererconnectedlinenum':_0x346ca3['transfererconnectedlinenum'],'transfererconnectedlinename':_0x346ca3[_0x6b84('0x6')],'transfereraccountcode':_0x346ca3[_0x6b84('0x7')],'transferercontext':_0x346ca3[_0x6b84('0x8')],'transfererexten':_0x346ca3[_0x6b84('0x9')],'transfererlinkedid':_0x346ca3['transfererlinkedid'],'transfereechannel':_0x346ca3[_0x6b84('0xa')],'transfereecalleridnum':_0x346ca3[_0x6b84('0xb')],'transfereecalleridname':_0x346ca3['transfereecalleridname'],'transfereeconnectedlinenum':_0x346ca3['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x346ca3[_0x6b84('0xc')],'transfereeaccountcode':_0x346ca3[_0x6b84('0xd')],'transfereecontext':_0x346ca3[_0x6b84('0xe')],'transfereeexten':_0x346ca3[_0x6b84('0xf')],'transfereelinkedid':_0x346ca3[_0x6b84('0x10')],'isexternal':_0x346ca3['isexternal'],'context':_0x346ca3[_0x6b84('0x11')],'extension':_0x346ca3['extension'],'type':'blind'},'log':_0x6b84('0x12')});};exports['attendedTransfer']=function(_0x120aea){return client[_0x6b84('0x3')](_0x6b84('0x12'),{'body':{'result':_0x120aea[_0x6b84('0x13')],'transfererchannel':_0x120aea['origtransfererchannel'],'transferercalleridnum':_0x120aea[_0x6b84('0x14')],'transferercalleridname':_0x120aea['origtransferercalleridname'],'transfererconnectedlinenum':_0x120aea[_0x6b84('0x15')],'transfererconnectedlinename':_0x120aea['secondtransfererconnectedlinename'],'transfereraccountcode':_0x120aea[_0x6b84('0x16')],'transferercontext':_0x120aea[_0x6b84('0x17')],'transfererexten':_0x120aea[_0x6b84('0x18')],'transfererlinkedid':_0x120aea[_0x6b84('0x19')],'transfereechannel':_0x120aea[_0x6b84('0x1a')],'transfereecalleridnum':_0x120aea[_0x6b84('0x1b')],'transfereecalleridname':_0x120aea[_0x6b84('0x1c')],'transfereeconnectedlinenum':_0x120aea[_0x6b84('0x1d')],'transfereeconnectedlinename':_0x120aea[_0x6b84('0x1e')],'transfereeaccountcode':_0x120aea[_0x6b84('0x1f')],'transfereecontext':_0x120aea[_0x6b84('0x20')],'transfereeexten':_0x120aea['transfertargetexten'],'transfereelinkedid':_0x120aea['transfertargetlinkedid'],'isexternal':_0x120aea['isexternal'],'context':_0x120aea['origtransferercontext'],'extension':_0x120aea[_0x6b84('0x21')],'type':_0x6b84('0x22')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index e7052b1..95227da 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 _0xd7fa=['uniqueid','%s.%s','filename','format','wav','/var/spool/asterisk/monitor/','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','toLowerCase','resolve','channel','destinationchannel','monitors','stop','Channel\x20doesn\x27t\x20exist','values','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','Redirect','exten','context','telephones','outboundChannels','outbound','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','moment','../../../config/environment','../properties','../ami','../model/voiceQueueSummary','listen','timers','timer','updateAcw','agents','pause','asterisk','username','join','pick','keys','action','Reload','Action','then','message','catch','error','isConnected','ami\x20disconnected','command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','channels','voicechannel','map'];(function(_0x4db3de,_0x1a8488){var _0x521438=function(_0x3c7ad5){while(--_0x3c7ad5){_0x4db3de['push'](_0x4db3de['shift']());}};_0x521438(++_0x1a8488);}(_0xd7fa,0x127));var _0xad7f=function(_0x5510b5,_0x46907f){_0x5510b5=_0x5510b5-0x0;var _0x2c8979=_0xd7fa[_0x5510b5];return _0x2c8979;};'use strict';var _=require(_0xad7f('0x0'));var util=require(_0xad7f('0x1'));var jayson=require(_0xad7f('0x2'));var schema=require(_0xad7f('0x3'));var moment=require(_0xad7f('0x4'));var config=require(_0xad7f('0x5'));var properties=require(_0xad7f('0x6'));var ami=require(_0xad7f('0x7'));var VoiceQueueSummary=require(_0xad7f('0x8'));exports[_0xad7f('0x9')]=function(_0x16a99f,_0xce8b25,_0x2b9731){return new Promise(function(_0x17a346,_0x5d5db4){var _0x4170a1={'QueuePause':function(_0x5e3449){return new Promise(function(_0x1c7813){var _0x528d53=util['format']('%s/%s','SIP',_0x5e3449['name']);if(_0x16a99f[_0xad7f('0xa')]&&_0x16a99f[_0xad7f('0xa')][_0x528d53]&&_0x16a99f['timers'][_0x528d53][_0xad7f('0xb')]){_0x16a99f[_0xad7f('0xa')][_0x528d53][_0xad7f('0xc')]();}if(_0x16a99f[_0xad7f('0xd')][_0x528d53]){_0x16a99f[_0xad7f('0xd')][_0x528d53]['updateStatusRealtime']({'statePause':_0x5e3449[_0xad7f('0xe')]?!![]:![]});}_0x1c7813({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x55238a){var _0x592ad5=this;return new Promise(function(_0x41b325,_0x5e65d5){if(ami['isConnected']()==![]){return _0x5e65d5(_0x592ad5['error'](0x1f4,[config[_0xad7f('0xf')]['ip'],config['asterisk'][_0xad7f('0x10')],'ami\x20disconnected'][_0xad7f('0x11')]('\x20')));}_0x55238a=_[_0xad7f('0x12')](_0x55238a,_[_0xad7f('0x13')](properties['module']));_0x55238a[_0xad7f('0x14')]=_0xad7f('0x15');return ami[_0xad7f('0x16')](_0x55238a)[_0xad7f('0x17')](function(_0x44ef94){_0x41b325({'code':0xc8,'message':_0x44ef94[_0xad7f('0x18')]});})[_0xad7f('0x19')](function(_0x2e8ac9){_0x5e65d5(_0x592ad5[_0xad7f('0x1a')](0x1f5,_0x2e8ac9['message']));});});},'Command':function(_0x40b559){var _0x159161=this;return new Promise(function(_0x219470,_0x2f6089){if(ami[_0xad7f('0x1b')]()==![]){return _0x2f6089(_0x159161[_0xad7f('0x1a')](0x1f4,[config[_0xad7f('0xf')]['ip'],config[_0xad7f('0xf')][_0xad7f('0x10')],_0xad7f('0x1c')][_0xad7f('0x11')]('\x20')));}_0x40b559=_[_0xad7f('0x12')](_0x40b559,_0xad7f('0x1d'));_0x40b559[_0xad7f('0x14')]='Command';return ami[_0xad7f('0x16')](_0x40b559)[_0xad7f('0x17')](function(_0x2aecbd){_0x219470({'code':0xc8,'message':_0x2aecbd[_0xad7f('0x1e')]});})[_0xad7f('0x19')](function(_0x23b6ed){_0x2f6089(_0x159161[_0xad7f('0x1a')](0x1f5,_0x23b6ed[_0xad7f('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3517e2){var _0x4ed781=[];for(var _0x3d3b8a in _0x16a99f[_0xad7f('0x1f')]){if(_0x16a99f[_0xad7f('0x1f')][_0xad7f('0x20')](_0x3d3b8a)){var _0x2b4978=_0x16a99f['voiceQueues'][_0x3d3b8a];var _0x23b8eb=new VoiceQueueSummary(_0x2b4978);_0x4ed781[_0xad7f('0x21')](_0x23b8eb);}}_0x3517e2({'count':_0x4ed781[_0xad7f('0x22')],'rows':_0x4ed781});});},'UpdateVoiceQueue':function(_0x10bfe9){return new Promise(function(_0x3b4dfd,_0x4e13b0){var _0x1cd979=_[_0xad7f('0x23')](_0x16a99f[_0xad7f('0x1f')],{'id':parseInt(_0x10bfe9['id'])});var _0x1b58a5=_[_0xad7f('0x24')](_0x10bfe9,['id']);if(_0x1cd979){for(var _0x3afab4 in _0x1b58a5){if(typeof _0x1b58a5[_0x3afab4]!==_0xad7f('0x25')&&typeof _0x1cd979[_0x3afab4]!=='undefined'){_0x1cd979[_0x3afab4]=_0x1b58a5[_0x3afab4];}}_0x3b4dfd(_0x1cd979);}else{_0x4e13b0();}});},'VoiceChannels':function(){return new Promise(function(_0x5b9292){var _0x437a14=_['values'](_0x16a99f[_0xad7f('0x26')]);_0x5b9292({'count':_0x437a14[_0xad7f('0x22')],'rows':_0x437a14});});},'VoiceChannelMixMonitor':function(_0x3d3c26){var _0x341a3e=this;return new Promise(function(_0x59c5a8,_0x1d6891){if(ami[_0xad7f('0x1b')]()==![]){return _0x1d6891(_0x341a3e[_0xad7f('0x1a')](0x1f4,[config[_0xad7f('0xf')]['ip'],config[_0xad7f('0xf')][_0xad7f('0x10')],'ami\x20disconnected'][_0xad7f('0x11')]('\x20')));}var _0x1dc816=schema(properties[_0xad7f('0x27')])[_0xad7f('0x3')](_0x3d3c26);if(_0x1dc816[_0xad7f('0x22')]>0x0){return _0x1d6891(_0x341a3e['error'](0x1f4,_[_0xad7f('0x28')](_0x1dc816,_0xad7f('0x18'))[_0xad7f('0x11')](',\x20')));}var _0x408bd0=_[_0xad7f('0x23')](_0x16a99f[_0xad7f('0x26')],{'uniqueid':_0x3d3c26[_0xad7f('0x29')]});if(_0x408bd0&&_0x408bd0['channel']){var _0x378e20=util['format'](_0xad7f('0x2a'),_0x3d3c26[_0xad7f('0x2b')]||_0x3d3c26[_0xad7f('0x29')],_0x3d3c26[_0xad7f('0x2c')]||_0xad7f('0x2d'));return ami['Action']({'action':'MixMonitor','channel':_0x408bd0['channel'],'file':_0x378e20,'options':'ai(mixmonitorid)'})['then'](function(_0x5343f9){var _0x3db959=_[_0xad7f('0x23')](_0x408bd0['monitors'],{'filename':_0xad7f('0x2e')+_0x378e20['toLowerCase']()});if(_[_0xad7f('0x2f')](_0x3db959)){_0x408bd0['monitors'][_0xad7f('0x21')]({'filename':'/var/spool/asterisk/monitor/'+_0x378e20['toLowerCase'](),'createdAt':moment()['format'](_0xad7f('0x30')),'mixmonitorid':_0x5343f9[_0xad7f('0x31')],'status':_0xad7f('0x32')});}else{_0x3db959[_0xad7f('0x31')]=_0x5343f9['mixmonitorid'];_0x3db959[_0xad7f('0x33')]=_0xad7f('0x32');}_0x59c5a8({'code':0xc8,'message':[_0x3d3c26[_0xad7f('0x29')],_0xad7f('0x34'),_0x5343f9['mixmonitorid']][_0xad7f('0x11')]('\x20'),'mixmonitorid':_0x5343f9[_0xad7f('0x31')]});})['catch'](function(_0x582345){_0x1d6891(_0x341a3e['error'](0x1f5,[_0x3d3c26['uniqueid'],_0x582345[_0xad7f('0x18')][_0xad7f('0x35')]()][_0xad7f('0x11')]('\x20')));});}else{return _0x1d6891(_0x341a3e[_0xad7f('0x1a')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x389a71){var _0x44fccd=this;return new Promise(function(_0xa98261,_0x353914){if(ami[_0xad7f('0x1b')]()==![]){return _0x353914(_0x44fccd['error'](0x1f4,[config[_0xad7f('0xf')]['ip'],config['asterisk'][_0xad7f('0x10')],_0xad7f('0x1c')][_0xad7f('0x11')]('\x20')));}var _0x5662fb=schema(properties[_0xad7f('0x27')])[_0xad7f('0x3')](_0x389a71);if(_0x5662fb['length']>0x0){return _0x353914(_0x44fccd[_0xad7f('0x1a')](0x1f4,_[_0xad7f('0x28')](_0x5662fb,_0xad7f('0x18'))[_0xad7f('0x11')](',\x20')));}var _0x3b9e5a=_[_0xad7f('0x23')](_0x16a99f[_0xad7f('0x26')],{'uniqueid':_0x389a71[_0xad7f('0x29')]});if(_0x3b9e5a){return Promise[_0xad7f('0x36')]()['then'](function(){if(_0x3b9e5a['channel']){return ami[_0xad7f('0x16')]({'action':'StopMixMonitor','channel':_0x3b9e5a[_0xad7f('0x37')],'mixmonitorid':_0x389a71[_0xad7f('0x31')]})[_0xad7f('0x19')](function(){});}})['then'](function(){if(_0x3b9e5a[_0xad7f('0x38')]){return ami[_0xad7f('0x16')]({'action':'StopMixMonitor','channel':_0x3b9e5a['destinationchannel'],'mixmonitorid':_0x389a71['mixmonitorid']})['catch'](function(){});}})[_0xad7f('0x17')](function(){var _0x565b60=_[_0xad7f('0x23')](_0x3b9e5a[_0xad7f('0x39')],{'mixmonitorid':_0x389a71[_0xad7f('0x31')]});if(_0x565b60){_0x565b60[_0xad7f('0x33')]=_0xad7f('0x3a');}})[_0xad7f('0x17')](function(){var _0x42de6d=util['format'](_0xad7f('0x2a'),_0x389a71[_0xad7f('0x2b')]||_0x389a71[_0xad7f('0x29')],_0x389a71[_0xad7f('0x2c')]||'wav');var _0x33b23c=_[_0xad7f('0x23')](_0x3b9e5a['monitors'],{'filename':_0xad7f('0x2e')+_0x42de6d[_0xad7f('0x35')]()});if(_0x33b23c){_0x33b23c[_0xad7f('0x33')]=_0xad7f('0x3a');}})['then'](function(){_0xa98261({'code':0xc8,'message':[_0x389a71[_0xad7f('0x29')],'StopMixMonitor\x20Success'][_0xad7f('0x11')]('\x20')});})[_0xad7f('0x19')](function(_0x1cb947){_0x353914(_0x44fccd[_0xad7f('0x1a')](0x1f5,[_0x389a71[_0xad7f('0x29')],_0x1cb947[_0xad7f('0x18')][_0xad7f('0x35')]()][_0xad7f('0x11')]('\x20')));});}else{return _0x353914(_0x44fccd[_0xad7f('0x1a')](0x1f5,_0xad7f('0x3b')));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0x34262f){var _0x398dc6=_[_0xad7f('0x3c')](_0x16a99f[_0xad7f('0x3d')]);_0x34262f({'count':_0x398dc6[_0xad7f('0x22')],'rows':_0x398dc6});});},'VoiceQueuesChannel':function(_0x2acda0){var _0x12894f=this;return new Promise(function(_0x222b30,_0x35b023){var _0x50fa87=schema(properties[_0xad7f('0x3e')])[_0xad7f('0x3')](_0x2acda0);if(_0x50fa87['length']>0x0){return _0x35b023(_0x12894f[_0xad7f('0x1a')](0x1f4,_[_0xad7f('0x28')](_0x50fa87,_0xad7f('0x18'))['join'](',\x20')));}var _0x32a9f4=_[_0xad7f('0x23')](_0x16a99f[_0xad7f('0x3d')],{'uniqueid':_0x2acda0[_0xad7f('0x29')]});if(_0x32a9f4){_0x222b30(_0x32a9f4);}else{return _0x35b023(_0x12894f[_0xad7f('0x1a')](0x1f5,_0xad7f('0x3b')));}});},'VoiceQueuesChannelHangup':function(_0x259168){var _0x300737=this;return new Promise(function(_0x25b001,_0x111717){if(ami['isConnected']()==![]){return _0x111717(_0x300737[_0xad7f('0x1a')](0x1f4,[config['asterisk']['ip'],config[_0xad7f('0xf')]['username'],'ami\x20disconnected'][_0xad7f('0x11')]('\x20')));}var _0x1a1003=schema(properties[_0xad7f('0x3f')])['validate'](_0x259168);if(_0x1a1003['length']>0x0){return _0x111717(_0x300737[_0xad7f('0x1a')](0x1f4,_['map'](_0x1a1003,_0xad7f('0x18'))[_0xad7f('0x11')](',\x20')));}var _0x555667=_[_0xad7f('0x23')](_0x16a99f['queueChannels'],{'uniqueid':_0x259168[_0xad7f('0x29')]});if(_0x555667&&_0x555667[_0xad7f('0x37')]){return ami[_0xad7f('0x16')]({'action':_0xad7f('0x40'),'channel':_0x555667['channel']})[_0xad7f('0x17')](function(_0x1da259){_0x25b001({'code':0xc8,'message':[_0x259168[_0xad7f('0x29')],_0x1da259[_0xad7f('0x18')][_0xad7f('0x35')]()][_0xad7f('0x11')]('\x20')});})['catch'](function(_0x1aa8a1){_0x111717(_0x300737[_0xad7f('0x1a')](0x1f5,[_0x259168['uniqueid'],_0x1aa8a1[_0xad7f('0x18')][_0xad7f('0x35')]()][_0xad7f('0x11')]('\x20')));});}else{return _0x111717(_0x300737[_0xad7f('0x1a')](0x1f5,_0xad7f('0x3b')));}});},'VoiceQueuesChannelRedirect':function(_0x396f8a){var _0x2d10a0=this;return new Promise(function(_0x17f90e,_0x3f8598){if(ami['isConnected']()==![]){return _0x3f8598(_0x2d10a0['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xad7f('0x10')],_0xad7f('0x1c')][_0xad7f('0x11')]('\x20')));}var _0x77514e=schema(properties['voicequeuechannelredirect'])[_0xad7f('0x3')](_0x396f8a);if(_0x77514e[_0xad7f('0x22')]>0x0){return _0x3f8598(_0x2d10a0[_0xad7f('0x1a')](0x1f4,_[_0xad7f('0x28')](_0x77514e,'message')[_0xad7f('0x11')](',\x20')));}var _0x41b2cf=_[_0xad7f('0x23')](_0x16a99f[_0xad7f('0x3d')],{'uniqueid':_0x396f8a['uniqueid']});if(_0x41b2cf&&_0x41b2cf['channel']){return ami['Action']({'action':_0xad7f('0x41'),'channel':_0x41b2cf[_0xad7f('0x37')],'exten':_0x396f8a[_0xad7f('0x42')],'context':_0x396f8a[_0xad7f('0x43')]||_0x41b2cf['context'],'priority':0x1})[_0xad7f('0x17')](function(_0x4de3bf){_0x17f90e({'code':0xc8,'message':[_0x396f8a[_0xad7f('0x29')],_0x4de3bf['message'][_0xad7f('0x35')]()]['join']('\x20')});})[_0xad7f('0x19')](function(_0x56c8c8){_0x3f8598(_0x2d10a0['error'](0x1f5,[_0x396f8a[_0xad7f('0x29')],_0x56c8c8['message']['toLowerCase']()][_0xad7f('0x11')]('\x20')));});}else{return _0x3f8598(_0x2d10a0[_0xad7f('0x1a')](0x1f5,_0xad7f('0x3b')));}});},'Agents':function(_0x102d08){return new Promise(function(_0x183f8c){var _0x3eaccf=_['values'](_0x16a99f[_0xad7f('0xd')]);if(_0x102d08&&_0x102d08['id']){var _0xe8462e=_['find'](_0x3eaccf,function(_0x380849){return _0x380849['id']===_0x102d08['id'];});_0x183f8c(_0xe8462e);}else{_0x183f8c({'count':_0x3eaccf[_0xad7f('0x22')],'rows':_0x3eaccf});}});},'Telephones':function(){return new Promise(function(_0x42237e){var _0x3cc410=_[_0xad7f('0x3c')](_0x16a99f[_0xad7f('0x44')]);_0x42237e({'count':_0x3cc410[_0xad7f('0x22')],'rows':_0x3cc410});});},'Trunks':function(){return new Promise(function(_0x99d424){var _0x1931d6=_[_0xad7f('0x3c')](_0x16a99f['trunks']);_0x99d424({'count':_0x1931d6[_0xad7f('0x22')],'rows':_0x1931d6});});},'OutboundChannels':function(){return new Promise(function(_0x3020da){var _0x5b2134=_[_0xad7f('0x3c')](_0x16a99f[_0xad7f('0x45')]);_0x3020da({'count':_0x5b2134[_0xad7f('0x22')],'rows':_0x5b2134});});},'Outbound':function(){return new Promise(function(_0x2737b4){_0x2737b4(_0x16a99f[_0xad7f('0x46')]);});},'Campaigns':function(){return new Promise(function(_0x38f82f){var _0x4b99ed=_[_0xad7f('0x3c')](_0x16a99f[_0xad7f('0x47')]);_0x38f82f({'count':_0x4b99ed[_0xad7f('0x22')],'rows':_0x4b99ed});});},'VoiceQueuesPreview':function(_0x407580){var _0x4607ee=this;return new Promise(function(_0x54e508,_0x1049f8){_0xce8b25[_0xad7f('0x48')](_0x407580['id'])[_0xad7f('0x17')](function(_0x32e8ef){_0x54e508({'code':0xc8,'message':_0x32e8ef[_0xad7f('0x18')]});})[_0xad7f('0x19')](function(_0xff210e){_0x1049f8(_0x4607ee[_0xad7f('0x1a')](0x1f4,_0xff210e[_0xad7f('0x18')]));});});},'EventManager':function(_0x558fb3){var _0x14da6b=this;return new Promise(function(_0x7023da,_0xb57c2a){if(!_0x558fb3[_0xad7f('0x49')]){return _0xb57c2a(_0x14da6b[_0xad7f('0x1a')](0x1f4,_0xad7f('0x4a')));}ami[_0xad7f('0x4b')](_0xad7f('0x4c')+_0x558fb3[_0xad7f('0x49')],_0x558fb3[_0xad7f('0x18')]);_0x7023da({'code':0xc8,'message':_0x558fb3});});},'FaxAccounts':function(){return new Promise(function(_0x3dcc5a){var _0x5c3b35=_[_0xad7f('0x3c')](_0x16a99f['faxAccounts']);_0x3dcc5a({'count':_0x5c3b35[_0xad7f('0x22')],'rows':_0x5c3b35});});},'SendFax':function(_0x41b12b){var _0x15c0d7=this;return new Promise(function(_0x42cdfa,_0x5f8edc){_0x2b9731['send'](_0x41b12b)[_0xad7f('0x17')](function(_0xd11ca0){_0x42cdfa({'code':0xc8,'message':_0xd11ca0['message']});})[_0xad7f('0x19')](function(_0x511a47){_0x5f8edc(_0x15c0d7[_0xad7f('0x1a')](0x1f4,_0x511a47[_0xad7f('0x18')]));});});},'CheckAfterSend':function(_0x234b4c){var _0x39f0b1=this;return new Promise(function(_0x53344c,_0x298992){_0x2b9731[_0xad7f('0x4d')](_0x234b4c)[_0xad7f('0x17')](function(_0x5bf6d3){_0x53344c({'code':0xc8,'message':_0x5bf6d3[_0xad7f('0x18')]});})[_0xad7f('0x19')](function(_0x5412c6){_0x298992(_0x39f0b1[_0xad7f('0x1a')](0x1f4,_0x5412c6[_0xad7f('0x18')]));});});}};var _0x46b4df=jayson[_0xad7f('0x4e')](_0x4170a1)[_0xad7f('0x4f')]();_0x46b4df['on'](_0xad7f('0x1a'),function(_0x10c61b){return _0x5d5db4(_0x10c61b);});_0x46b4df[_0xad7f('0x9')](0x232a,_0xad7f('0x50'),function(){console[_0xad7f('0x51')](_0xad7f('0x52'),0x232a);return _0x17a346(_0xad7f('0x53')+0x232a);});});}; \ No newline at end of file +var _0x3059=['length','voicechannel','map','uniqueid','channel','%s.%s','wav','MixMonitor','ai(mixmonitorid)','then','monitors','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','filename','/var/spool/asterisk/monitor/','voicequeuechannel','voicequeuechannelhangup','queueChannels','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','outbound','campaigns','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate','moment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','updateAcw','agents','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','message','catch','Command','Action','content','voiceQueues','find','omit','undefined','values','channels'];(function(_0x3c9288,_0x24d151){var _0x517cb1=function(_0x2004f1){while(--_0x2004f1){_0x3c9288['push'](_0x3c9288['shift']());}};_0x517cb1(++_0x24d151);}(_0x3059,0x1df));var _0x9305=function(_0x1c99bb,_0x3ff9a8){_0x1c99bb=_0x1c99bb-0x0;var _0x4ad1f0=_0x3059[_0x1c99bb];return _0x4ad1f0;};'use strict';var _=require('lodash');var util=require(_0x9305('0x0'));var jayson=require(_0x9305('0x1'));var schema=require(_0x9305('0x2'));var moment=require(_0x9305('0x3'));var config=require('../../../config/environment');var properties=require(_0x9305('0x4'));var ami=require(_0x9305('0x5'));var VoiceQueueSummary=require('../model/voiceQueueSummary');exports[_0x9305('0x6')]=function(_0x1def52,_0x15d56e,_0x1190f9){return new Promise(function(_0x184ec3,_0x519402){var _0x5dcf2e={'QueuePause':function(_0x37f4b1){return new Promise(function(_0x140ef4){var _0x514c1f=util[_0x9305('0x7')](_0x9305('0x8'),_0x9305('0x9'),_0x37f4b1[_0x9305('0xa')]);if(_0x1def52['timers']&&_0x1def52[_0x9305('0xb')][_0x514c1f]&&_0x1def52['timers'][_0x514c1f]['timer']){_0x1def52[_0x9305('0xb')][_0x514c1f][_0x9305('0xc')]();}if(_0x1def52[_0x9305('0xd')][_0x514c1f]){_0x1def52[_0x9305('0xd')][_0x514c1f]['updateStatusRealtime']({'statePause':_0x37f4b1[_0x9305('0xe')]?!![]:![]});}_0x140ef4({'code':0xc8,'message':_0x9305('0xf')});});},'Reload':function(_0x20c398){var _0x34d5cb=this;return new Promise(function(_0x44fa29,_0x1b7071){if(ami[_0x9305('0x10')]()==![]){return _0x1b7071(_0x34d5cb[_0x9305('0x11')](0x1f4,[config[_0x9305('0x12')]['ip'],config[_0x9305('0x12')][_0x9305('0x13')],_0x9305('0x14')][_0x9305('0x15')]('\x20')));}_0x20c398=_[_0x9305('0x16')](_0x20c398,_[_0x9305('0x17')](properties[_0x9305('0x18')]));_0x20c398[_0x9305('0x19')]='Reload';return ami['Action'](_0x20c398)['then'](function(_0x33f5b3){_0x44fa29({'code':0xc8,'message':_0x33f5b3[_0x9305('0x1a')]});})[_0x9305('0x1b')](function(_0x2c01d4){_0x1b7071(_0x34d5cb[_0x9305('0x11')](0x1f5,_0x2c01d4['message']));});});},'Command':function(_0x3629a4){var _0xe6f6fc=this;return new Promise(function(_0x4a3d5d,_0x4b6f44){if(ami[_0x9305('0x10')]()==![]){return _0x4b6f44(_0xe6f6fc['error'](0x1f4,[config[_0x9305('0x12')]['ip'],config[_0x9305('0x12')][_0x9305('0x13')],_0x9305('0x14')][_0x9305('0x15')]('\x20')));}_0x3629a4=_[_0x9305('0x16')](_0x3629a4,'command');_0x3629a4[_0x9305('0x19')]=_0x9305('0x1c');return ami[_0x9305('0x1d')](_0x3629a4)['then'](function(_0x3ff681){_0x4a3d5d({'code':0xc8,'message':_0x3ff681[_0x9305('0x1e')]});})[_0x9305('0x1b')](function(_0x32fc95){_0x4b6f44(_0xe6f6fc[_0x9305('0x11')](0x1f5,_0x32fc95[_0x9305('0x1a')]));});});},'VoiceQueues':function(){return new Promise(function(_0x1779d0){var _0xfbd70f=[];for(var _0x4f498a in _0x1def52[_0x9305('0x1f')]){if(_0x1def52[_0x9305('0x1f')]['hasOwnProperty'](_0x4f498a)){var _0x98cc=_0x1def52['voiceQueues'][_0x4f498a];var _0x2d30a4=new VoiceQueueSummary(_0x98cc);_0xfbd70f['push'](_0x2d30a4);}}_0x1779d0({'count':_0xfbd70f['length'],'rows':_0xfbd70f});});},'UpdateVoiceQueue':function(_0x5960c1){return new Promise(function(_0x5087bc,_0xdeed43){var _0x40be15=_[_0x9305('0x20')](_0x1def52[_0x9305('0x1f')],{'id':parseInt(_0x5960c1['id'])});var _0x382326=_[_0x9305('0x21')](_0x5960c1,['id']);if(_0x40be15){for(var _0xe8357d in _0x382326){if(typeof _0x382326[_0xe8357d]!==_0x9305('0x22')&&typeof _0x40be15[_0xe8357d]!==_0x9305('0x22')){_0x40be15[_0xe8357d]=_0x382326[_0xe8357d];}}_0x5087bc(_0x40be15);}else{_0xdeed43();}});},'VoiceChannels':function(){return new Promise(function(_0x37850a){var _0x19354b=_[_0x9305('0x23')](_0x1def52[_0x9305('0x24')]);_0x37850a({'count':_0x19354b[_0x9305('0x25')],'rows':_0x19354b});});},'VoiceChannelMixMonitor':function(_0x197e89){var _0x4d7f25=this;return new Promise(function(_0x4c21fe,_0x31292d){if(ami[_0x9305('0x10')]()==![]){return _0x31292d(_0x4d7f25[_0x9305('0x11')](0x1f4,[config[_0x9305('0x12')]['ip'],config[_0x9305('0x12')]['username'],_0x9305('0x14')]['join']('\x20')));}var _0x159ec1=schema(properties[_0x9305('0x26')])[_0x9305('0x2')](_0x197e89);if(_0x159ec1['length']>0x0){return _0x31292d(_0x4d7f25[_0x9305('0x11')](0x1f4,_[_0x9305('0x27')](_0x159ec1,_0x9305('0x1a'))[_0x9305('0x15')](',\x20')));}var _0x5256e4=_[_0x9305('0x20')](_0x1def52[_0x9305('0x24')],{'uniqueid':_0x197e89[_0x9305('0x28')]});if(_0x5256e4&&_0x5256e4[_0x9305('0x29')]){var _0x456880=util[_0x9305('0x7')](_0x9305('0x2a'),_0x197e89['filename']||_0x197e89[_0x9305('0x28')],_0x197e89[_0x9305('0x7')]||_0x9305('0x2b'));return ami['Action']({'action':_0x9305('0x2c'),'channel':_0x5256e4[_0x9305('0x29')],'file':_0x456880,'options':_0x9305('0x2d')})[_0x9305('0x2e')](function(_0x37e623){var _0x4cd2d4=_[_0x9305('0x20')](_0x5256e4[_0x9305('0x2f')],{'filename':'/var/spool/asterisk/monitor/'+_0x456880[_0x9305('0x30')]()});if(_[_0x9305('0x31')](_0x4cd2d4)){_0x5256e4[_0x9305('0x2f')][_0x9305('0x32')]({'filename':'/var/spool/asterisk/monitor/'+_0x456880[_0x9305('0x30')](),'createdAt':moment()[_0x9305('0x7')](_0x9305('0x33')),'mixmonitorid':_0x37e623[_0x9305('0x34')],'status':_0x9305('0x35')});}else{_0x4cd2d4[_0x9305('0x34')]=_0x37e623[_0x9305('0x34')];_0x4cd2d4[_0x9305('0x36')]='rec';}_0x4c21fe({'code':0xc8,'message':[_0x197e89['uniqueid'],_0x9305('0x37'),_0x37e623[_0x9305('0x34')]][_0x9305('0x15')]('\x20'),'mixmonitorid':_0x37e623[_0x9305('0x34')]});})[_0x9305('0x1b')](function(_0x36c3a3){_0x31292d(_0x4d7f25[_0x9305('0x11')](0x1f5,[_0x197e89[_0x9305('0x28')],_0x36c3a3[_0x9305('0x1a')][_0x9305('0x30')]()]['join']('\x20')));});}else{return _0x31292d(_0x4d7f25[_0x9305('0x11')](0x1f5,_0x9305('0x38')));}});},'VoiceChannelStopMixMonitor':function(_0x18e0bb){var _0x221bb3=this;return new Promise(function(_0x3a00a7,_0x349d3f){if(ami[_0x9305('0x10')]()==![]){return _0x349d3f(_0x221bb3[_0x9305('0x11')](0x1f4,[config[_0x9305('0x12')]['ip'],config['asterisk'][_0x9305('0x13')],_0x9305('0x14')][_0x9305('0x15')]('\x20')));}var _0x4ef7e1=schema(properties['voicechannel'])['validate'](_0x18e0bb);if(_0x4ef7e1[_0x9305('0x25')]>0x0){return _0x349d3f(_0x221bb3[_0x9305('0x11')](0x1f4,_[_0x9305('0x27')](_0x4ef7e1,_0x9305('0x1a'))['join'](',\x20')));}var _0x20e6a1=_[_0x9305('0x20')](_0x1def52['channels'],{'uniqueid':_0x18e0bb['uniqueid']});if(_0x20e6a1){return Promise[_0x9305('0x39')]()[_0x9305('0x2e')](function(){if(_0x20e6a1[_0x9305('0x29')]){return ami[_0x9305('0x1d')]({'action':_0x9305('0x3a'),'channel':_0x20e6a1['channel'],'mixmonitorid':_0x18e0bb[_0x9305('0x34')]})['catch'](function(){});}})[_0x9305('0x2e')](function(){if(_0x20e6a1[_0x9305('0x3b')]){return ami[_0x9305('0x1d')]({'action':_0x9305('0x3a'),'channel':_0x20e6a1[_0x9305('0x3b')],'mixmonitorid':_0x18e0bb[_0x9305('0x34')]})[_0x9305('0x1b')](function(){});}})[_0x9305('0x2e')](function(){var _0x27e3af=_[_0x9305('0x20')](_0x20e6a1['monitors'],{'mixmonitorid':_0x18e0bb['mixmonitorid']});if(_0x27e3af){_0x27e3af[_0x9305('0x36')]=_0x9305('0x3c');}})[_0x9305('0x2e')](function(){var _0x11f408=util[_0x9305('0x7')](_0x9305('0x2a'),_0x18e0bb[_0x9305('0x3d')]||_0x18e0bb['uniqueid'],_0x18e0bb[_0x9305('0x7')]||'wav');var _0x350645=_[_0x9305('0x20')](_0x20e6a1[_0x9305('0x2f')],{'filename':_0x9305('0x3e')+_0x11f408[_0x9305('0x30')]()});if(_0x350645){_0x350645[_0x9305('0x36')]=_0x9305('0x3c');}})['then'](function(){_0x3a00a7({'code':0xc8,'message':[_0x18e0bb[_0x9305('0x28')],'StopMixMonitor\x20Success'][_0x9305('0x15')]('\x20')});})['catch'](function(_0x4ca649){_0x349d3f(_0x221bb3[_0x9305('0x11')](0x1f5,[_0x18e0bb[_0x9305('0x28')],_0x4ca649[_0x9305('0x1a')]['toLowerCase']()]['join']('\x20')));});}else{return _0x349d3f(_0x221bb3['error'](0x1f5,_0x9305('0x38')));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0xaa2fca){var _0x1eb3f2=_[_0x9305('0x23')](_0x1def52['queueChannels']);_0xaa2fca({'count':_0x1eb3f2[_0x9305('0x25')],'rows':_0x1eb3f2});});},'VoiceQueuesChannel':function(_0x695a42){var _0x51ddbc=this;return new Promise(function(_0x1366e5,_0x534f71){var _0xb127a8=schema(properties[_0x9305('0x3f')])[_0x9305('0x2')](_0x695a42);if(_0xb127a8['length']>0x0){return _0x534f71(_0x51ddbc['error'](0x1f4,_[_0x9305('0x27')](_0xb127a8,_0x9305('0x1a'))[_0x9305('0x15')](',\x20')));}var _0x9f1bac=_[_0x9305('0x20')](_0x1def52['queueChannels'],{'uniqueid':_0x695a42['uniqueid']});if(_0x9f1bac){_0x1366e5(_0x9f1bac);}else{return _0x534f71(_0x51ddbc[_0x9305('0x11')](0x1f5,_0x9305('0x38')));}});},'VoiceQueuesChannelHangup':function(_0x589f62){var _0x5034eb=this;return new Promise(function(_0x461555,_0x2be29f){if(ami[_0x9305('0x10')]()==![]){return _0x2be29f(_0x5034eb[_0x9305('0x11')](0x1f4,[config[_0x9305('0x12')]['ip'],config[_0x9305('0x12')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x12efc5=schema(properties[_0x9305('0x40')])[_0x9305('0x2')](_0x589f62);if(_0x12efc5[_0x9305('0x25')]>0x0){return _0x2be29f(_0x5034eb[_0x9305('0x11')](0x1f4,_[_0x9305('0x27')](_0x12efc5,_0x9305('0x1a'))[_0x9305('0x15')](',\x20')));}var _0xb7989c=_[_0x9305('0x20')](_0x1def52[_0x9305('0x41')],{'uniqueid':_0x589f62[_0x9305('0x28')]});if(_0xb7989c&&_0xb7989c[_0x9305('0x29')]){return ami['Action']({'action':'Hangup','channel':_0xb7989c[_0x9305('0x29')]})[_0x9305('0x2e')](function(_0x2daeea){_0x461555({'code':0xc8,'message':[_0x589f62[_0x9305('0x28')],_0x2daeea[_0x9305('0x1a')][_0x9305('0x30')]()][_0x9305('0x15')]('\x20')});})[_0x9305('0x1b')](function(_0x147871){_0x2be29f(_0x5034eb[_0x9305('0x11')](0x1f5,[_0x589f62[_0x9305('0x28')],_0x147871['message']['toLowerCase']()][_0x9305('0x15')]('\x20')));});}else{return _0x2be29f(_0x5034eb[_0x9305('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x433b31){var _0x1b540a=this;return new Promise(function(_0x9eede2,_0x5422b1){if(ami[_0x9305('0x10')]()==![]){return _0x5422b1(_0x1b540a[_0x9305('0x11')](0x1f4,[config[_0x9305('0x12')]['ip'],config['asterisk']['username'],_0x9305('0x14')][_0x9305('0x15')]('\x20')));}var _0x382392=schema(properties[_0x9305('0x42')])[_0x9305('0x2')](_0x433b31);if(_0x382392[_0x9305('0x25')]>0x0){return _0x5422b1(_0x1b540a['error'](0x1f4,_[_0x9305('0x27')](_0x382392,_0x9305('0x1a'))[_0x9305('0x15')](',\x20')));}var _0x369caa=_['find'](_0x1def52[_0x9305('0x41')],{'uniqueid':_0x433b31[_0x9305('0x28')]});if(_0x369caa&&_0x369caa[_0x9305('0x29')]){return ami[_0x9305('0x1d')]({'action':_0x9305('0x43'),'channel':_0x369caa[_0x9305('0x29')],'exten':_0x433b31[_0x9305('0x44')],'context':_0x433b31[_0x9305('0x45')]||_0x369caa['context'],'priority':0x1})[_0x9305('0x2e')](function(_0x25408d){_0x9eede2({'code':0xc8,'message':[_0x433b31[_0x9305('0x28')],_0x25408d['message'][_0x9305('0x30')]()][_0x9305('0x15')]('\x20')});})['catch'](function(_0x129e81){_0x5422b1(_0x1b540a[_0x9305('0x11')](0x1f5,[_0x433b31[_0x9305('0x28')],_0x129e81[_0x9305('0x1a')]['toLowerCase']()][_0x9305('0x15')]('\x20')));});}else{return _0x5422b1(_0x1b540a['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0xd8e58a){return new Promise(function(_0x360d73){var _0x105533=_[_0x9305('0x23')](_0x1def52[_0x9305('0xd')]);if(_0xd8e58a&&_0xd8e58a['id']){var _0x5cb666=_[_0x9305('0x20')](_0x105533,function(_0x217a94){return _0x217a94['id']===_0xd8e58a['id'];});_0x360d73(_0x5cb666);}else{_0x360d73({'count':_0x105533[_0x9305('0x25')],'rows':_0x105533});}});},'Telephones':function(){return new Promise(function(_0x1e242d){var _0x36eb72=_[_0x9305('0x23')](_0x1def52[_0x9305('0x46')]);_0x1e242d({'count':_0x36eb72['length'],'rows':_0x36eb72});});},'Trunks':function(){return new Promise(function(_0x301024){var _0x35a086=_[_0x9305('0x23')](_0x1def52[_0x9305('0x47')]);_0x301024({'count':_0x35a086[_0x9305('0x25')],'rows':_0x35a086});});},'OutboundChannels':function(){return new Promise(function(_0x3a3907){var _0x362d63=_[_0x9305('0x23')](_0x1def52[_0x9305('0x48')]);_0x3a3907({'count':_0x362d63[_0x9305('0x25')],'rows':_0x362d63});});},'Outbound':function(){return new Promise(function(_0x390fbe){_0x390fbe(_0x1def52[_0x9305('0x49')]);});},'Campaigns':function(){return new Promise(function(_0x3d7b98){var _0x133265=_[_0x9305('0x23')](_0x1def52[_0x9305('0x4a')]);_0x3d7b98({'count':_0x133265['length'],'rows':_0x133265});});},'VoiceQueuesPreview':function(_0x43a493){var _0x585afd=this;return new Promise(function(_0x348d18,_0x4a4c33){_0x15d56e['run'](_0x43a493['id'])[_0x9305('0x2e')](function(_0x4cee6d){_0x348d18({'code':0xc8,'message':_0x4cee6d[_0x9305('0x1a')]});})[_0x9305('0x1b')](function(_0x199066){_0x4a4c33(_0x585afd[_0x9305('0x11')](0x1f4,_0x199066[_0x9305('0x1a')]));});});},'EventManager':function(_0x45e2ac){var _0x5e13d5=this;return new Promise(function(_0xd63fda,_0x343df0){if(!_0x45e2ac[_0x9305('0x4b')]){return _0x343df0(_0x5e13d5[_0x9305('0x11')](0x1f4,_0x9305('0x4c')));}ami['emit'](_0x9305('0x4d')+_0x45e2ac[_0x9305('0x4b')],_0x45e2ac[_0x9305('0x1a')]);_0xd63fda({'code':0xc8,'message':_0x45e2ac});});},'FaxAccounts':function(){return new Promise(function(_0x4944bc){var _0x1e3d2b=_[_0x9305('0x23')](_0x1def52[_0x9305('0x4e')]);_0x4944bc({'count':_0x1e3d2b[_0x9305('0x25')],'rows':_0x1e3d2b});});},'SendFax':function(_0x5e6a14){var _0x58714f=this;return new Promise(function(_0x3f5222,_0x2b2db5){_0x1190f9[_0x9305('0x4f')](_0x5e6a14)[_0x9305('0x2e')](function(_0x4e4cfe){_0x3f5222({'code':0xc8,'message':_0x4e4cfe['message']});})[_0x9305('0x1b')](function(_0x386dc4){_0x2b2db5(_0x58714f['error'](0x1f4,_0x386dc4['message']));});});},'CheckAfterSend':function(_0x2dd714){var _0x54ffac=this;return new Promise(function(_0x391839,_0xa1c13f){_0x1190f9[_0x9305('0x50')](_0x2dd714)['then'](function(_0x37795d){_0x391839({'code':0xc8,'message':_0x37795d[_0x9305('0x1a')]});})[_0x9305('0x1b')](function(_0x1bbdd6){_0xa1c13f(_0x54ffac['error'](0x1f4,_0x1bbdd6[_0x9305('0x1a')]));});});}};var _0x1a0276=jayson[_0x9305('0x51')](_0x5dcf2e)[_0x9305('0x52')]();_0x1a0276['on'](_0x9305('0x11'),function(_0x30ca77){return _0x519402(_0x30ca77);});_0x1a0276[_0x9305('0x6')](0x232a,_0x9305('0x53'),function(){console[_0x9305('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x184ec3(_0x9305('0x55')+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 b9c2bd8..11fe9dd 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 _0x666f=['../../../../config/environment','../../../../config/logger','../../rpc/cmContact','defaults','redis','info','emit','data1','data2','isNil','data5','xmd-contactid','ListId','data3','$or','map','routeId','destcalleridnum','calleridnum','phone','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','firstName','format','user:%s','name','trigger:%s','action','toLowerCase','lodash','bluebird','util'];(function(_0x4098b9,_0xfa0347){var _0x29f063=function(_0x37aa5d){while(--_0x37aa5d){_0x4098b9['push'](_0x4098b9['shift']());}};_0x29f063(++_0xfa0347);}(_0x666f,0x110));var _0xf666=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x666f[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0xf666('0x0'));var BPromise=require(_0xf666('0x1'));var Redis=require('ioredis');var util=require(_0xf666('0x2'));var config=require(_0xf666('0x3'));var logger=require(_0xf666('0x4'))('trigger');var cmContactRpc=require(_0xf666('0x5'));config['redis']=_[_0xf666('0x6')](config[_0xf666('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf666('0x7')]));function emit(_0x5b0663,_0xa918eb,_0x46023e,_0x232b2d,_0x46e1b1){logger[_0xf666('0x8')]('[CM][%s][%s]',_0x5b0663,_0xa918eb['id'],_0x46023e,_0x232b2d,JSON['stringify'](_0x46e1b1));io['to'](_0x46023e)[_0xf666('0x9')](_0x232b2d,_0x46e1b1);}exports['exec']=function(_0x3e5d99,_0x362854,_0x225d6f,_0x1485e0){var _0x1e1ef4,_0x574e28;var _0x45ba0f={};var _0x1369fa;var _0x2d76d0=Number(_0x225d6f[_0xf666('0xa')]);var _0x425a58=_0x225d6f[_0xf666('0xb')]?Boolean(Number(_0x225d6f[_0xf666('0xb')])):![];var _0x1f4b65;var _0xb0b538=![];if(!_[_0xf666('0xc')](_0x225d6f[_0xf666('0xd')])){if(_0x225d6f['data5']=='1')_0xb0b538=!![];}if(!_0xb0b538){if(_0x1485e0['xmd-contactid']){_0x45ba0f['id']=_0x1485e0[_0xf666('0xe')];}}if(!_0x45ba0f['id']){_0x45ba0f[_0xf666('0xf')]=_0x2d76d0;_0x1f4b65=_0x225d6f[_0xf666('0x10')]&&_0x225d6f[_0xf666('0x10')]!=='0'?_0x225d6f['data3']['split'](','):['phone'];_0x45ba0f[_0xf666('0x11')]=_[_0xf666('0x12')](_0x1f4b65,function(_0x453d9a){var _0x596ee3={};_0x596ee3[_0x453d9a]=_0x1485e0[_0xf666('0x13')]?_0x1485e0[_0xf666('0x14')]:_0x1485e0[_0xf666('0x15')];return _0x596ee3;});_0x1369fa=_0x1485e0[_0xf666('0x13')]?_0x1485e0[_0xf666('0x14')]:_0x1485e0[_0xf666('0x15')];}var _0x26f35d=['id','firstName','lastName',_0xf666('0x16'),_0xf666('0x17'),_0xf666('0x18'),_0xf666('0xf'),_0xf666('0x19'),_0xf666('0x1a'),_0xf666('0x1b')];var _0x440c2d=_[_0xf666('0x1c')](_0x26f35d,_0x1f4b65);BPromise[_0xf666('0x1d')]()[_0xf666('0x1e')](cmContactRpc[_0xf666('0x1f')]({'attributes':_0x440c2d,'where':_0x45ba0f,'phone':_0x1369fa}))[_0xf666('0x1e')](function(_0x8e2441){_0x574e28=_0x8e2441;if(!_[_0xf666('0x20')](_0x574e28)){if(_0x574e28[_0xf666('0x21')]===0x1){_0x1e1ef4=_0x574e28[0x0];logger[_0xf666('0x8')](_0xf666('0x22'),_0x1485e0[_0xf666('0x23')],_0x362854['id'],_0x1e1ef4['id']);}else{logger[_0xf666('0x8')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x1485e0[_0xf666('0x23')],_0x362854['id'],_[_0xf666('0x12')](_0x574e28,'id')[_0xf666('0x24')](','));}return;}else{logger[_0xf666('0x8')](_0xf666('0x25'),_0x1485e0[_0xf666('0x23')],_0x362854['id']);var _0x2fc656={'ListId':_0x2d76d0};var _0x1f5cca=_0x225d6f['data4']&&_0x225d6f['data4']!=='0'?_0x225d6f[_0xf666('0x26')]:_0xf666('0x16');if(_0x425a58){logger['info'](_0xf666('0x27'),_0x1485e0['uniqueid'],_0x362854['id']);_0x2fc656[_0x1f5cca]=_[_0xf666('0xc')](_0x1485e0[_0xf666('0x13')])?_0x1485e0[_0xf666('0x15')]:_0x1485e0[_0xf666('0x14')];if(_[_0xf666('0xc')](_0x1485e0[_0xf666('0x13')])){_0x2fc656['firstName']=_0x1485e0['calleridname']&&_0x1485e0[_0xf666('0x28')]!==_0xf666('0x29')?_0x1485e0[_0xf666('0x28')]:_0xf666('0x2a');}else{_0x2fc656['firstName']=_0x1485e0[_0xf666('0x2b')]&&_0x1485e0['destcalleridname']!==_0xf666('0x29')?_0x1485e0[_0xf666('0x2b')]:_0xf666('0x2a');}return BPromise[_0xf666('0x1d')]()[_0xf666('0x1e')](cmContactRpc[_0xf666('0x2c')](_0x2fc656))['then'](function(_0x590587){_0x1e1ef4=_0x590587;_0x574e28[_0xf666('0x2d')](_0x590587);if(_0x1e1ef4){logger[_0xf666('0x8')](_0xf666('0x2e'),_0x1485e0['uniqueid'],_0x362854['id'],_0x1e1ef4['id']);}return;});}else{logger[_0xf666('0x8')](_0xf666('0x2f'),_0x1485e0[_0xf666('0x23')],_0x362854['id']);_0x2fc656[_0x1f5cca]=_[_0xf666('0xc')](_0x1485e0[_0xf666('0x13')])?_0x1485e0[_0xf666('0x15')]:_0x1485e0[_0xf666('0x14')];if(_[_0xf666('0xc')](_0x1485e0['routeId'])){_0x2fc656[_0xf666('0x30')]=_0x1485e0['calleridname']&&_0x1485e0['calleridname']!==_0xf666('0x29')?_0x1485e0[_0xf666('0x28')]:'Unknown';}else{_0x2fc656[_0xf666('0x30')]=_0x1485e0[_0xf666('0x2b')]&&_0x1485e0['destcalleridname']!==''?_0x1485e0[_0xf666('0x2b')]:'Unknown';}_0x1e1ef4=_0x2fc656;_0x574e28['push'](_0x2fc656);return;}}})[_0xf666('0x1e')](function(){if(_0x3e5d99){emit(_0x1485e0[_0xf666('0x23')],_0x362854,util[_0xf666('0x31')](_0xf666('0x32'),_0x3e5d99[_0xf666('0x33')]),util[_0xf666('0x31')](_0xf666('0x34'),_0x225d6f[_0xf666('0x35')][_0xf666('0x36')]()),{'evt':_['merge'](_0x1485e0,{'autoCreate':_0x425a58}),'contact':_0x1e1ef4===undefined?{}:_0x1e1ef4,'contacts':_0x574e28[_0xf666('0x21')]===0x0?undefined:_0x574e28});}});}; \ No newline at end of file +var _0xb41e=['redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','map','join','data4','phone','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','action','toLowerCase','merge','length','bluebird','util','../../../../config/environment','../../../../config/logger'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xb41e,0x68));var _0xeb41=function(_0x2daba3,_0x1de650){_0x2daba3=_0x2daba3-0x0;var _0x564279=_0xb41e[_0x2daba3];return _0x564279;};'use strict';var _=require('lodash');var BPromise=require(_0xeb41('0x0'));var Redis=require('ioredis');var util=require(_0xeb41('0x1'));var config=require(_0xeb41('0x2'));var logger=require(_0xeb41('0x3'))('trigger');var cmContactRpc=require('../../rpc/cmContact');config[_0xeb41('0x4')]=_[_0xeb41('0x5')](config['redis'],{'host':_0xeb41('0x6'),'port':0x18eb});var io=require(_0xeb41('0x7'))(new Redis(config[_0xeb41('0x4')]));function emit(_0x214bd4,_0x3f3390,_0xbbdd19,_0x354d11,_0x1aed9a){logger[_0xeb41('0x8')](_0xeb41('0x9'),_0x214bd4,_0x3f3390['id'],_0xbbdd19,_0x354d11,JSON['stringify'](_0x1aed9a));io['to'](_0xbbdd19)[_0xeb41('0xa')](_0x354d11,_0x1aed9a);}exports[_0xeb41('0xb')]=function(_0x1a643f,_0x3bbd79,_0x8a66ef,_0x1dcd37){var _0x369835,_0x4b0e31;var _0x4ca004={};var _0x2662cf;var _0x8ed41c=Number(_0x8a66ef['data1']);var _0x3107ab=_0x8a66ef['data2']?Boolean(Number(_0x8a66ef[_0xeb41('0xc')])):![];var _0x9e0b85;var _0x31a7e1=![];if(!_[_0xeb41('0xd')](_0x8a66ef[_0xeb41('0xe')])){if(_0x8a66ef[_0xeb41('0xe')]=='1')_0x31a7e1=!![];}if(!_0x31a7e1){if(_0x1dcd37[_0xeb41('0xf')]){_0x4ca004['id']=_0x1dcd37[_0xeb41('0xf')];}}if(!_0x4ca004['id']){_0x4ca004[_0xeb41('0x10')]=_0x8ed41c;_0x9e0b85=_0x8a66ef[_0xeb41('0x11')]&&_0x8a66ef[_0xeb41('0x11')]!=='0'?_0x8a66ef['data3'][_0xeb41('0x12')](','):['phone'];_0x4ca004[_0xeb41('0x13')]=_['map'](_0x9e0b85,function(_0x172101){var _0x3cd262={};_0x3cd262[_0x172101]=_0x1dcd37[_0xeb41('0x14')]?_0x1dcd37[_0xeb41('0x15')]:_0x1dcd37[_0xeb41('0x16')];return _0x3cd262;});_0x2662cf=_0x1dcd37[_0xeb41('0x14')]?_0x1dcd37['destcalleridnum']:_0x1dcd37[_0xeb41('0x16')];}var _0x26df6b=['id',_0xeb41('0x17'),_0xeb41('0x18'),'phone',_0xeb41('0x19'),_0xeb41('0x1a'),_0xeb41('0x10'),'createdAt',_0xeb41('0x1b'),_0xeb41('0x1c')];var _0x1c8f79=_[_0xeb41('0x1d')](_0x26df6b,_0x9e0b85);BPromise[_0xeb41('0x1e')]()[_0xeb41('0x1f')](cmContactRpc[_0xeb41('0x20')]({'attributes':_0x1c8f79,'where':_0x4ca004,'phone':_0x2662cf}))[_0xeb41('0x1f')](function(_0x156229){_0x4b0e31=_0x156229;if(!_[_0xeb41('0x21')](_0x4b0e31)){if(_0x4b0e31['length']===0x1){_0x369835=_0x4b0e31[0x0];logger[_0xeb41('0x8')](_0xeb41('0x22'),_0x1dcd37[_0xeb41('0x23')],_0x3bbd79['id'],_0x369835['id']);}else{logger[_0xeb41('0x8')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x1dcd37['uniqueid'],_0x3bbd79['id'],_[_0xeb41('0x24')](_0x4b0e31,'id')[_0xeb41('0x25')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x1dcd37[_0xeb41('0x23')],_0x3bbd79['id']);var _0x23741e={'ListId':_0x8ed41c};var _0x2588b7=_0x8a66ef[_0xeb41('0x26')]&&_0x8a66ef[_0xeb41('0x26')]!=='0'?_0x8a66ef[_0xeb41('0x26')]:_0xeb41('0x27');if(_0x3107ab){logger[_0xeb41('0x8')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x1dcd37[_0xeb41('0x23')],_0x3bbd79['id']);_0x23741e[_0x2588b7]=_[_0xeb41('0xd')](_0x1dcd37[_0xeb41('0x14')])?_0x1dcd37[_0xeb41('0x16')]:_0x1dcd37[_0xeb41('0x15')];if(_[_0xeb41('0xd')](_0x1dcd37[_0xeb41('0x14')])){_0x23741e[_0xeb41('0x17')]=_0x1dcd37[_0xeb41('0x28')]&&_0x1dcd37['calleridname']!==_0xeb41('0x29')?_0x1dcd37[_0xeb41('0x28')]:_0xeb41('0x2a');}else{_0x23741e[_0xeb41('0x17')]=_0x1dcd37['destcalleridname']&&_0x1dcd37[_0xeb41('0x2b')]!==_0xeb41('0x29')?_0x1dcd37[_0xeb41('0x2b')]:_0xeb41('0x2a');}return BPromise[_0xeb41('0x1e')]()[_0xeb41('0x1f')](cmContactRpc[_0xeb41('0x2c')](_0x23741e))[_0xeb41('0x1f')](function(_0x2b77a9){_0x369835=_0x2b77a9;_0x4b0e31[_0xeb41('0x2d')](_0x2b77a9);if(_0x369835){logger['info'](_0xeb41('0x2e'),_0x1dcd37[_0xeb41('0x23')],_0x3bbd79['id'],_0x369835['id']);}return;});}else{logger[_0xeb41('0x8')](_0xeb41('0x2f'),_0x1dcd37[_0xeb41('0x23')],_0x3bbd79['id']);_0x23741e[_0x2588b7]=_['isNil'](_0x1dcd37['routeId'])?_0x1dcd37[_0xeb41('0x16')]:_0x1dcd37['destcalleridnum'];if(_[_0xeb41('0xd')](_0x1dcd37[_0xeb41('0x14')])){_0x23741e[_0xeb41('0x17')]=_0x1dcd37['calleridname']&&_0x1dcd37[_0xeb41('0x28')]!==_0xeb41('0x29')?_0x1dcd37[_0xeb41('0x28')]:_0xeb41('0x2a');}else{_0x23741e[_0xeb41('0x17')]=_0x1dcd37[_0xeb41('0x2b')]&&_0x1dcd37[_0xeb41('0x2b')]!==''?_0x1dcd37[_0xeb41('0x2b')]:_0xeb41('0x2a');}_0x369835=_0x23741e;_0x4b0e31[_0xeb41('0x2d')](_0x23741e);return;}}})[_0xeb41('0x1f')](function(){if(_0x1a643f){emit(_0x1dcd37[_0xeb41('0x23')],_0x3bbd79,util[_0xeb41('0x30')]('user:%s',_0x1a643f[_0xeb41('0x31')]),util[_0xeb41('0x30')]('trigger:%s',_0x8a66ef[_0xeb41('0x32')][_0xeb41('0x33')]()),{'evt':_[_0xeb41('0x34')](_0x1dcd37,{'autoCreate':_0x3107ab}),'contact':_0x369835===undefined?{}:_0x369835,'contacts':_0x4b0e31[_0xeb41('0x35')]===0x0?undefined:_0x4b0e31});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index d7b4c7f..c94dcea 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 _0xd3ef=['freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','accounts','vtigerAccounts','dynamics365Accounts','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnoanswer','custom:agentcongestion','custom:agentreject','custom:amd','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','info','stringify','emit','clone','motionChannel','checkTriggers','interface','status','checkTrigger','merge','variables','Actions','length','action','contactmanager','motionbar','browser','data2','render','uri','buildUri','isNil','data3','location','uriLocation','data4','windowWidth','data5','windowHeight','data6','600','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','toLowerCase','data1','jscripty','trigger:%s','integration','queue','routeId','urlforward','exec','script','parse','query','search','channel','AllConditions','every','AnyConditions','some','checkConditions','field','chat','ChatWebsiteId','operator','value','AccountId','upperFirst','interaction','message','event','membername','lastevent','substatus','undefined','offlineMessage','created','equals','util','url','mustache','ioredis','./integration','./script','../../../config/logger','defaults','redis','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts'];(function(_0x388e50,_0x25089d){var _0x3cb6f2=function(_0x25587e){while(--_0x25587e){_0x388e50['push'](_0x388e50['shift']());}};_0x3cb6f2(++_0x25089d);}(_0xd3ef,0x69));var _0xfd3e=function(_0x2233be,_0xd10120){_0x2233be=_0x2233be-0x0;var _0x1a6468=_0xd3ef[_0x2233be];return _0x1a6468;};'use strict';var util=require(_0xfd3e('0x0'));var _=require('lodash');var url=require(_0xfd3e('0x1'));var Mustache=require(_0xfd3e('0x2'));var Redis=require(_0xfd3e('0x3'));var urlforward=require('./urlforward');var integration=require(_0xfd3e('0x4'));var cmContact=require('./cmContact');var script=require(_0xfd3e('0x5'));var config=require('../../../config/environment');var logger=require(_0xfd3e('0x6'))('trigger');var ami=require('../ami');config['redis']=_[_0xfd3e('0x7')](config[_0xfd3e('0x8')],{'host':_0xfd3e('0x9'),'port':0x18eb});var io=require(_0xfd3e('0xa'))(new Redis(config[_0xfd3e('0x8')]));var operators={'equals':function(_0x880ef6,_0x4955a6){return _0x880ef6==_0x4955a6;},'not_equals':function(_0xef3f66,_0x3e958c){return _0xef3f66!=_0x3e958c;}};var barAndWebActions=[_0xfd3e('0xb'),_0xfd3e('0x1'),_0xfd3e('0xc')];function Trigger(_0x4aa237){this[_0xfd3e('0xd')]=_0x4aa237[_0xfd3e('0xd')];this['agents']=_0x4aa237[_0xfd3e('0xe')];this['voiceQueues']=_0x4aa237[_0xfd3e('0xf')];this['templates']=_0x4aa237[_0xfd3e('0x10')];this[_0xfd3e('0x11')]=_0x4aa237[_0xfd3e('0x11')];this[_0xfd3e('0x12')]=_0x4aa237['zendeskAccounts'];this[_0xfd3e('0x13')]=_0x4aa237['freshdeskAccounts'];this['salesforceAccounts']=_0x4aa237[_0xfd3e('0x14')];this[_0xfd3e('0x15')]=_0x4aa237[_0xfd3e('0x15')];this['zohoAccounts']=_0x4aa237[_0xfd3e('0x16')];this[_0xfd3e('0x17')]=_0x4aa237[_0xfd3e('0x17')];this['vtigerAccounts']=_0x4aa237['vtigerAccounts'];this['servicenowAccounts']=_0x4aa237[_0xfd3e('0x18')];this['dynamics365Accounts']=_0x4aa237['dynamics365Accounts'];this[_0xfd3e('0x19')]=_0x4aa237[_0xfd3e('0x19')];this[_0xfd3e('0x1a')]={'zendesk':this[_0xfd3e('0x12')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0xfd3e('0x13')],'sugarcrm':this[_0xfd3e('0x15')],'zoho':this[_0xfd3e('0x16')],'desk':this[_0xfd3e('0x17')],'vtiger':this[_0xfd3e('0x1b')],'dynamics365':this[_0xfd3e('0x1c')],'freshsales':this[_0xfd3e('0x19')],'servicenow':this['servicenowAccounts']};ami['on']('custom:agentcalled',this[_0xfd3e('0x1d')][_0xfd3e('0x1e')](this));ami['on'](_0xfd3e('0x1f'),this[_0xfd3e('0x1d')][_0xfd3e('0x1e')](this));ami['on'](_0xfd3e('0x20'),this[_0xfd3e('0x1d')][_0xfd3e('0x1e')](this));ami['on'](_0xfd3e('0x21'),this[_0xfd3e('0x1d')]['bind'](this));ami['on']('custom:agentnosuchnumber',this[_0xfd3e('0x1d')][_0xfd3e('0x1e')](this));ami['on'](_0xfd3e('0x22'),this[_0xfd3e('0x1d')]['bind'](this));ami['on']('custom:agentbusy',this[_0xfd3e('0x1d')]['bind'](this));ami['on'](_0xfd3e('0x23'),this[_0xfd3e('0x1d')][_0xfd3e('0x1e')](this));ami['on'](_0xfd3e('0x24'),this[_0xfd3e('0x1d')][_0xfd3e('0x1e')](this));ami['on'](_0xfd3e('0x25'),this[_0xfd3e('0x1d')][_0xfd3e('0x1e')](this));ami['on']('custom:queuecallerabandon',this[_0xfd3e('0x1d')][_0xfd3e('0x1e')](this));ami['on'](_0xfd3e('0x26'),this[_0xfd3e('0x1d')][_0xfd3e('0x1e')](this));ami['on'](_0xfd3e('0x27'),this[_0xfd3e('0x28')][_0xfd3e('0x1e')](this));ami['on'](_0xfd3e('0x29'),this[_0xfd3e('0x28')][_0xfd3e('0x1e')](this));ami['on'](_0xfd3e('0x2a'),this[_0xfd3e('0x28')][_0xfd3e('0x1e')](this));ami['on'](_0xfd3e('0x2b'),this['syncCustomEvent'][_0xfd3e('0x1e')](this));ami['on'](_0xfd3e('0x2c'),this[_0xfd3e('0x1d')][_0xfd3e('0x1e')](this));ami['on'](_0xfd3e('0x2d'),this['syncCustomEvent'][_0xfd3e('0x1e')](this));ami['on'](_0xfd3e('0x2e'),this[_0xfd3e('0x1d')][_0xfd3e('0x1e')](this));ami['on']('custom:outgoingmessage',this['syncCustomEvent'][_0xfd3e('0x1e')](this));ami['on'](_0xfd3e('0x2f'),this['syncCustomEvent'][_0xfd3e('0x1e')](this));ami['on'](_0xfd3e('0x30'),this[_0xfd3e('0x1d')]['bind'](this));ami['on'](_0xfd3e('0x31'),this[_0xfd3e('0x1d')][_0xfd3e('0x1e')](this));}Trigger[_0xfd3e('0x32')]['emit']=function(_0x1e94d5,_0x159254,_0x1a63dd){logger[_0xfd3e('0x33')](_0x1e94d5,_0x159254,JSON[_0xfd3e('0x34')](_0x1a63dd));io['to'](_0x1e94d5)[_0xfd3e('0x35')](_0x159254,_0x1a63dd);};Trigger[_0xfd3e('0x32')][_0xfd3e('0x1d')]=function(_0x15f16a){var _0x2633da=_[_0xfd3e('0x36')](_0x15f16a);if(typeof _0x2633da[_0xfd3e('0x37')]==='undefined'){_0x2633da[_0xfd3e('0x37')]='voice';}this[_0xfd3e('0x38')](_0x2633da);};Trigger[_0xfd3e('0x32')][_0xfd3e('0x28')]=function(_0x4eefe8){if(this[_0xfd3e('0xe')][_0x4eefe8[_0xfd3e('0x39')]]){this[_0xfd3e('0x1d')](_0x4eefe8);}};Trigger['prototype'][_0xfd3e('0x38')]=function(_0x2f8de4){var _0x20aeef;for(var _0x15a64c in this['triggers']){if(this['triggers']['hasOwnProperty'](_0x15a64c)){if(this[_0xfd3e('0xd')][_0x15a64c][_0xfd3e('0x3a')]){_0x20aeef=this[_0xfd3e('0x3b')](this[_0xfd3e('0xd')][_0x15a64c],_0x2f8de4);if(_0x20aeef){_[_0xfd3e('0x3c')](_0x2f8de4,_0x2f8de4[_0xfd3e('0x3d')]);for(var _0x4c2c65=0x0,_0x1f9a57,_0x3fa39c,_0x20a215;_0x4c2c650x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file +var _0x7217=['format','%s/users','remoteUri','then','total_entries','find','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','length','map','forEach','string','picklist','nameField','customField','content','toString','includes','idField','custom_fields','variable','variableName','type','customVariable','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','new','xCALLY','Motion','CTI','Tags','Descriptions','user','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0x545a0b,_0x493140){var _0x59dfe9=function(_0x39328c){while(--_0x39328c){_0x545a0b['push'](_0x545a0b['shift']());}};_0x59dfe9(++_0x493140);}(_0x7217,0x19e));var _0x7721=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x7217[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x7721('0x0'));var rp=require('request-promise');var md5=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var Redis=require(_0x7721('0x3'));var intUtil=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('desk');config[_0x7721('0x6')]=_[_0x7721('0x7')](config[_0x7721('0x6')],{'host':_0x7721('0x8'),'port':0x18eb});var io=require(_0x7721('0x9'))(new Redis(config[_0x7721('0x6')]));function emit(_0x18ab6b,_0x21f680,_0x225610){io['to'](_0x18ab6b)[_0x7721('0xa')](_0x21f680,_0x225610);}var headers={'Content-Type':_0x7721('0xb'),'Accept':_0x7721('0xb')};function getUser(_0xfa8835,_0x138740){if(intUtil[_0x7721('0xc')](_0x138740)===!![]){logger['info'](_0x7721('0xd'),_0x138740);return request({'uri':util[_0x7721('0xe')](_0x7721('0xf'),_0xfa8835[_0x7721('0x10')])})[_0x7721('0x11')](function(_0x409b37){if(_0x409b37[_0x7721('0x12')]){return _[_0x7721('0x13')](_0x409b37['_embedded'][_0x7721('0x14')],{'email':_0x138740});}})[_0x7721('0x11')](function(_0x57ff6d){if(_0x57ff6d){logger[_0x7721('0x15')](_0x7721('0x16'));return _0x57ff6d;}else{logger[_0x7721('0x15')](_0x7721('0x17'));return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}}function request(_0x3cc909){logger[_0x7721('0x19')]('[HTTP]',JSON[_0x7721('0x1a')](_0x3cc909));return rp(_['defaults'](_0x3cc909,{'method':_0x7721('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x5cb0e6){var _0xfec626;if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x1d')){_0xfec626=util[_0x7721('0xe')](_0x7721('0x1e'),_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x20')]);}else if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x21')){_0xfec626=util[_0x7721('0xe')]('%s/token:%s',_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x21')]);}return util[_0x7721('0xe')](_0x7721('0x22'),new Buffer(_0xfec626)['toString'](_0x7721('0x23')));}function getEndUser(_0x512f31,_0xb9e9dd,_0x288e3a){logger[_0x7721('0x15')](_0x7721('0x24'),_0x288e3a);return request({'uri':util[_0x7721('0xe')](_0x7721('0x25'),_0x512f31[_0x7721('0x10')]),'qs':{'phone':_0x288e3a}})['then'](function(_0x216f20){if(_0x216f20[_0x7721('0x12')]){logger[_0x7721('0x15')](_0x7721('0x26'));return _0x216f20[_0x7721('0x27')][_0x7721('0x14')][0x0];}else{logger[_0x7721('0x15')](_0x7721('0x28'));return request({'uri':util[_0x7721('0xe')]('%s/customers',_0x512f31[_0x7721('0x10')]),'method':'POST','body':{'first_name':_0xb9e9dd,'title':_0xb9e9dd,'phone_numbers':[{'type':'work','value':_0x288e3a}]}});}});}function getTags(_0x315202,_0x343c19){var _0x53c904=[];if(_0x315202&&_0x315202[_0x7721('0x29')]>0x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 502c795..c978401 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 _0x3231=['redis','localhost','socket.io-emitter','modernAuthentication','CloudProvider','data7','POST','clientId','username','password','then','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','value','isNil','email','userEmail','internalemailaddress','isdisabled','info','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','systemuserid','catch','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','4.0','body','headers','odata-entityid','substring','lastIndexOf','enduserId','outbound','&$filter=','%2b','Bearer\x20','length','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','customField','indexOf','content','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','callDirection','queue','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','unmanaged','format','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','dynamics365','../../../../config/environment','defaults'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3231,0xcf));var _0x1323=function(_0x4b7c62,_0x161976){_0x4b7c62=_0x4b7c62-0x0;var _0x316b43=_0x3231[_0x4b7c62];return _0x316b43;};'use strict';var _=require(_0x1323('0x0'));var rp=require(_0x1323('0x1'));var util=require(_0x1323('0x2'));var intUtil=require(_0x1323('0x3'));var md5=require(_0x1323('0x4'));var Redis=require(_0x1323('0x5'));var logger=require('../../../../config/logger')(_0x1323('0x6'));var config=require(_0x1323('0x7'));config['redis']=_[_0x1323('0x8')](config[_0x1323('0x9')],{'host':_0x1323('0xa'),'port':0x18eb});var io=require(_0x1323('0xb'))(new Redis(config[_0x1323('0x9')]));function getAuthToken(_0x500d82,_0x2d5c86,_0x247b48){if(_0x500d82[_0x1323('0xc')]){_0x500d82['remoteUri']=_0x500d82[_0x1323('0xd')][_0x1323('0xe')];_0x500d82['tenantId']=_0x500d82['CloudProvider']['data2'];return Promise['resolve'](_0x500d82[_0x1323('0xd')]['data5']);}var _0x2dc2c7={'method':_0x1323('0xf'),'uri':_0x2d5c86,'form':{'client_id':_0x500d82[_0x1323('0x10')],'resource':_0x500d82['remoteUri'],'username':_0x500d82[_0x1323('0x11')],'password':_0x500d82[_0x1323('0x12')],'grant_type':_0x1323('0x12'),'client_secret':_0x500d82['clientSecret']},'json':!![]};return rp(_0x2dc2c7)[_0x1323('0x13')](function(_0x101b95){return _0x101b95['access_token'];})['catch'](function(_0x57101f){logger[_0x1323('0x14')]('['+[_0x247b48[_0x1323('0x15')]()]+_0x1323('0x16'));return _0x57101f[_0x1323('0x17')];});}function getUser(_0x58fd79,_0x3eb586,_0x331d20,_0x25db78,_0x5e84e7,_0x3ed88b){return new Promise(function(_0x1cda5c,_0x43afbb){return getAuthToken(_0x3eb586,_0x25db78,_0x3ed88b)[_0x1323('0x13')](function(_0x256511){var _0x286890={'method':_0x1323('0x18'),'uri':_0x5e84e7+_0x1323('0x19'),'headers':{'Authorization':'Bearer\x20'+_0x256511,'OData-Version':'4.0'},'json':!![]};return rp(_0x286890);})[_0x1323('0x13')](function(_0xf17309){var _0x802721=_0xf17309[_0x1323('0x1a')];var _0x6f12cc=![];var _0x1ca6f6=null;if(!_[_0x1323('0x1b')](_0x331d20)){if(intUtil['validateEmail'](_0x331d20[_0x1323('0x1c')])){_0x58fd79[_0x1323('0x1d')]=_0x331d20[_0x1323('0x1c')];for(_0x1ca6f6=0x0;_0x1ca6f6<_0x802721['length'];_0x1ca6f6++){if(_0x802721[_0x1ca6f6][_0x1323('0x1e')]===_0x331d20['email']&&!_0x802721[_0x1ca6f6][_0x1323('0x1f')]){_0x6f12cc=!![];logger[_0x1323('0x20')]('['+[_0x3ed88b[_0x1323('0x15')]()]+']\x20Agent\x20found\x20'+_0x802721[_0x1ca6f6]['systemuserid']+'!');_0x58fd79[_0x1323('0x21')]=_0x802721[_0x1ca6f6]['systemuserid'];}}}}if(!_0x6f12cc){logger[_0x1323('0x20')]('['+[_0x3ed88b[_0x1323('0x15')]()]+_0x1323('0x22'));_0x58fd79[_0x1323('0x1d')]=_0x3eb586[_0x1323('0x11')];for(_0x1ca6f6=0x0;_0x1ca6f6<_0x802721['length'];_0x1ca6f6++){if(_0x802721[_0x1ca6f6][_0x1323('0x1e')]===_0x3eb586[_0x1323('0x11')]){_0x58fd79[_0x1323('0x21')]=_0x802721[_0x1ca6f6][_0x1323('0x23')];}}}_0x1cda5c(_0x58fd79);})[_0x1323('0x24')](function(_0x3bf9f0){_0x43afbb(_0x3bf9f0['message']);});});}function createEndUser(_0x2bf092,_0x45407f,_0x477bf5,_0x525a3c,_0x40a6f7,_0x5372aa,_0x1e3cf4){return new Promise(function(_0x28cbbb,_0x42f21b){return getAuthToken(_0x45407f,_0x477bf5,_0x5372aa)[_0x1323('0x13')](function(_0x1f5712){var _0x5b3771=_0x5372aa[_0x1323('0x25')]()==='outbound'?_0x40a6f7[_0x1323('0x26')]:_0x40a6f7[_0x1323('0x27')];var _0x17ef6d={'method':_0x1323('0xf'),'uri':_0x525a3c+_0x1323('0x28'),'body':{'fullname':_0x5b3771,'firstname':_0x5b3771,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x1323('0x29')+_0x2bf092['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x1f5712,'OData-Version':_0x1323('0x2a')},'json':!![],'resolveWithFullResponse':!![]};_0x17ef6d[_0x1323('0x2b')][_0x1e3cf4]=_0x5b3771;return rp(_0x17ef6d);})[_0x1323('0x13')](function(_0x17cb4a){var _0x4be11d=_0x17cb4a[_0x1323('0x2c')][_0x1323('0x2d')];var _0x1a1faa=_0x4be11d[_0x1323('0x2e')](_0x4be11d['lastIndexOf']('(')+0x1,_0x4be11d[_0x1323('0x2f')](')'));_0x2bf092[_0x1323('0x30')]=_0x1a1faa;_0x28cbbb(_0x2bf092);})[_0x1323('0x24')](function(_0x352f22){_0x42f21b(_0x352f22['message']);});});}function getEndUser(_0x5357fb,_0x57e98b,_0x1f7df2,_0x375d7e,_0x5aa119,_0x54f48e,_0x3106c2,_0x5a23ad){var _0x58739f=_0x54f48e['toLowerCase']()===_0x1323('0x31')?_0x5aa119[_0x1323('0x26')]:_0x5aa119['calleridnum'];return getAuthToken(_0x57e98b,_0x1f7df2,_0x54f48e)['then'](function(_0x54c940){_0x5a23ad=_0x5a23ad?_0x5a23ad:'telephone1';var _0x138696={'method':'GET','uri':_0x375d7e+'contacts?$select='+_0x5a23ad+_0x1323('0x32')+_0x5a23ad+'\x20eq\x20\x27'+_0x58739f['replace']('+',_0x1323('0x33'))+'\x27','headers':{'Authorization':_0x1323('0x34')+_0x54c940,'If-None-Match':null,'OData-Version':_0x1323('0x2a')},'json':!![]};return rp(_0x138696);})['then'](function(_0x383362){var _0x47934f=![];if(!_0x383362)return _0x47934f;var _0x4df0bc=_0x383362['value'];for(var _0x2badd0=0x0;_0x2badd0<_0x4df0bc[_0x1323('0x35')];_0x2badd0++){if(_0x4df0bc[_0x2badd0][_0x5a23ad]===_0x58739f){_0x47934f=!![];_0x5357fb['enduserId']=_0x4df0bc[_0x2badd0][_0x1323('0x36')];}}return _0x47934f;})[_0x1323('0x13')](function(_0x5b0abc){if(_0x5b0abc)return _0x5357fb;if(_0x3106c2===_0x1323('0x37')){logger[_0x1323('0x20')]('['+[_0x54f48e[_0x1323('0x15')]()]+_0x1323('0x38'));return _0x5357fb;}return createEndUser(_0x5357fb,_0x57e98b,_0x1f7df2,_0x375d7e,_0x5aa119,_0x54f48e,_0x5a23ad)['then'](function(_0x44f7d9){logger['info']('['+[_0x54f48e['toUpperCase']()]+_0x1323('0x39'),_0x44f7d9[_0x1323('0x30')]);return _0x44f7d9;});});}function getCustomFields(_0x56d4b1,_0x5d2899,_0x34221d){var _0x3b7492={};if(_0x56d4b1[_0x1323('0x35')]>0x0){_[_0x1323('0x3a')](_0x56d4b1,function(_0x169ee9){if(_[_0x1323('0x3b')]([_0x1323('0x3c'),_0x1323('0x3d')],_0x169ee9[_0x1323('0x3e')])&&_0x169ee9[_0x1323('0x3f')]&&!_0x169ee9[_0x1323('0x40')]){var _0x3df589=_0x169ee9['idField']['toLowerCase']();var _0x58a3d9=_0x3df589['substring'](0x0,_0x3df589[_0x1323('0x41')]('_'));var _0x9a57c9=_0x3df589['substring'](_0x3df589[_0x1323('0x41')]('_')+0x1);if(_0x58a3d9===_0x34221d){_0x3b7492[_0x9a57c9]=_0x169ee9[_0x1323('0x42')];}}});}return _0x3b7492;}function getTicket(_0x45bd22,_0xcb2260,_0x49a508,_0x293a19,_0xd1638d,_0x5e8cf2,_0x1a8306){return new Promise(function(_0x1ed8fb,_0x2e7c86){var _0x15de2a;return getAuthToken(_0xcb2260,_0x49a508,_0x1a8306)['then'](function(_0x1fe4b2){if(_0x5e8cf2['ticketType']===_0x1323('0x43')){_0x15de2a={'method':_0x1323('0xf'),'uri':_0x293a19+_0x1323('0x44'),'body':Object[_0x1323('0x45')]({},{'title':intUtil[_0x1323('0x46')](_0x5e8cf2[_0x1323('0x47')],_0xd1638d,'\x20'),'description':intUtil[_0x1323('0x46')](_0x5e8cf2[_0x1323('0x48')],_0xd1638d,'\x0a'),'customerid_contact@odata.bind':_0x45bd22[_0x1323('0x30')]?_0x1323('0x49')+_0x45bd22[_0x1323('0x30')]+')':undefined,'ownerid@odata.bind':_0x1323('0x29')+_0x45bd22[_0x1323('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x5e8cf2[_0x1323('0x4a')],_0xd1638d,_0x5e8cf2[_0x1323('0x4b')])),'headers':{'Authorization':_0x1323('0x34')+_0x1fe4b2,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5e8cf2[_0x1323('0x4b')]===_0x1323('0x4c')){var _0xa5ad03=_0x45bd22[_0x1323('0x30')]?[{'partyid_systemuser@odata.bind':_0x1323('0x29')+_0x45bd22[_0x1323('0x21')]+')','participationtypemask':_0x45bd22[_0x1323('0x4d')]===_0x1323('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':_0x1323('0x49')+_0x45bd22[_0x1323('0x30')]+')','participationtypemask':_0x45bd22['callDirection']===_0x1323('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x45bd22[_0x1323('0x21')]+')','participationtypemask':_0x45bd22[_0x1323('0x4d')]===_0x1323('0x4e')?0x2:0x1}];_0x15de2a={'method':_0x1323('0xf'),'uri':_0x293a19+'phonecalls','body':Object[_0x1323('0x45')]({},{'subject':intUtil['getString'](_0x5e8cf2[_0x1323('0x47')],_0xd1638d,'\x20'),'phonenumber':String(_0xd1638d[_0x1323('0x27')]),'description':intUtil[_0x1323('0x46')](_0x5e8cf2[_0x1323('0x48')],_0xd1638d,'\x0a'),'regardingobjectid_contact@odata.bind':_0x45bd22[_0x1323('0x30')]?_0x1323('0x49')+_0x45bd22['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x45bd22[_0x1323('0x21')]+')','directioncode':_0x45bd22['callDirection']===_0x1323('0x4e')?![]:!![],'phonecall_activity_parties':_0xa5ad03},getCustomFields(_0x5e8cf2[_0x1323('0x4a')],_0xd1638d,_0x5e8cf2[_0x1323('0x4b')])),'headers':{'Authorization':_0x1323('0x34')+_0x1fe4b2,'OData-Version':_0x1323('0x2a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x15de2a);})['then'](function(_0x427329){var _0x4f3512=_0x427329[_0x1323('0x2c')][_0x1323('0x2d')];var _0x2e1119=_0x4f3512['substring'](_0x4f3512['lastIndexOf']('(')+0x1,_0x4f3512[_0x1323('0x2f')](')'));_0x45bd22[_0x1323('0x4f')]=_0x2e1119;_0x1ed8fb(_0x45bd22);})[_0x1323('0x24')](function(_0x493695){_0x2e7c86(_0x493695['message']);});});}function emit(_0x31a40c,_0x8c8364,_0x3b4f8f,_0x3417b2){var _0x326aff={'uri':util['format'](_0x1323('0x50'),_0x31a40c,_0x3b4f8f,_0x3417b2)};io['to'](util['format'](_0x1323('0x51'),_0x8c8364))['emit'](_0x1323('0x52'),_0x326aff);}exports['cs']=function(_0x4603a0,_0x4e4df9,_0x33a859,_0x4bc0c9,_0xdf755a,_0x596d57,_0x443873,_0x2ba5f7){var _0x2bb599={};_0x596d57[_0x1323('0x53')]=_0x596d57[_0x1323('0xc')]?intUtil[_0x1323('0x54')](_0x596d57[_0x1323('0xd')]['data7']):intUtil[_0x1323('0x54')](_0x596d57[_0x1323('0x53')]);_0x596d57['serverUrl']=intUtil[_0x1323('0x54')](_0x596d57[_0x1323('0x55')]);_0x2bb599[_0x1323('0x4d')]=_0x2ba5f7===_0x1323('0x4e')||_0x2ba5f7===_0x1323('0x56')?_0x1323('0x4e'):_0x1323('0x31');var _0x2a978e=_0x596d57[_0x1323('0xc')]?util[_0x1323('0x57')](_0x1323('0x58'),_0x596d57[_0x1323('0xd')][_0x1323('0xe')]):util[_0x1323('0x57')]('%s/api/data/v9.0/',_0x596d57[_0x1323('0x53')]);var _0x53f14d=util[_0x1323('0x57')](_0x1323('0x59'),_0x596d57[_0x1323('0x5a')]);var _0x372df6=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x596d57[_0x1323('0x55')],_0x4e4df9[_0x1323('0x5b')],md5(_0x4e4df9['uniqueid']));if(_0xdf755a&&_0xdf755a[_0x1323('0x5c')]){logger[_0x1323('0x20')](_0x1323('0x5d'),_0x1323('0x5e'));_0x4e4df9['recordingURL']=_0x372df6;}else if(_0x443873&&_0x443873[_0x1323('0x5f')]&&_0x443873[_0x1323('0x5f')]!=='none'){logger[_0x1323('0x20')](_0x1323('0x60'),_0x1323('0x5e'));_0x4e4df9[_0x1323('0x61')]=_0x372df6;}else{_0x4e4df9['recordingURL']='';}return getUser(_0x2bb599,_0x596d57,_0x4bc0c9,_0x53f14d,_0x2a978e,_0x2ba5f7)[_0x1323('0x13')](function(_0x4ec93f){logger[_0x1323('0x20')]('['+_0x2ba5f7[_0x1323('0x15')]()+_0x1323('0x62'),_0x4ec93f[_0x1323('0x21')]);logger[_0x1323('0x20')]('['+_0x2ba5f7[_0x1323('0x15')]()+']\x20The\x20User\x20email\x20is:',_0x4ec93f['userEmail']);return getEndUser(_0x4ec93f,_0x596d57,_0x53f14d,_0x2a978e,_0x4e4df9,_0x2ba5f7,_0x33a859[_0x1323('0x63')],_0x33a859[_0x1323('0x64')]);})[_0x1323('0x13')](function(_0x375dc7){logger[_0x1323('0x20')]('['+_0x2ba5f7[_0x1323('0x15')]()+_0x1323('0x65'),_0x375dc7[_0x1323('0x30')]);logger[_0x1323('0x20')]('['+_0x2ba5f7[_0x1323('0x15')]()+_0x1323('0x66'),_0x4e4df9[_0x1323('0x27')]);return getTicket(_0x375dc7,_0x596d57,_0x53f14d,_0x2a978e,_0x4e4df9,_0x33a859,_0x2ba5f7);})[_0x1323('0x13')](function(_0x1d322a){logger[_0x1323('0x20')](util[_0x1323('0x57')]('['+_0x2ba5f7[_0x1323('0x15')]()+_0x1323('0x67'),_0x33a859[_0x1323('0x4b')],_0x1d322a[_0x1323('0x4f')]));logger['info'](util[_0x1323('0x57')]('['+_0x2ba5f7[_0x1323('0x15')]()+']\x20Call\x20direction:\x20%s',_0x2ba5f7));if(_0x2ba5f7!==_0x1323('0x56')&&_0x33a859[_0x1323('0x68')]){logger[_0x1323('0x20')]('['+_0x2ba5f7[_0x1323('0x15')]()+']',_0x1323('0x69'));emit(_0x596d57['remoteUri'],_0x4bc0c9[_0x1323('0x6a')],_0x33a859['ticketType'],_0x1d322a['ticketId']);}})[_0x1323('0x24')](function(_0x48b7dc){logger['error']('['+_0x2ba5f7[_0x1323('0x15')]()+_0x1323('0x6b'),_0x48b7dc[_0x1323('0x17')]);console['error']('Error\x20running\x20Dynamics365\x20integration',_0x48b7dc);});}; \ No newline at end of file +var _0x21bc=['userId','username','destcalleridnum','contacts','/systemusers(','body','headers','lastIndexOf','toLowerCase','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','enduserId','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','customField','indexOf','ticketType','incident','incidents','assign','getString','Descriptions','/contacts(','Bearer\x20','phonecall','queue','callDirection','calleridnum','Fields','odata-entityid','substring','ticketId','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','moduleCreate','additionalSearchContact',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','ioredis','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','data2','resolve','POST','password','clientSecret','then','access_token','catch','error','toUpperCase','message','GET','4.0','value','isNil','validateEmail','userEmail','email','length','internalemailaddress','isdisabled','info','systemuserid'];(function(_0x435a3f,_0x4607b4){var _0x37fa41=function(_0x37a3a8){while(--_0x37a3a8){_0x435a3f['push'](_0x435a3f['shift']());}};_0x37fa41(++_0x4607b4);}(_0x21bc,0x1de));var _0xc21b=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x21bc[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xc21b('0x0'));var rp=require(_0xc21b('0x1'));var util=require('util');var intUtil=require(_0xc21b('0x2'));var md5=require(_0xc21b('0x3'));var Redis=require(_0xc21b('0x4'));var logger=require('../../../../config/logger')(_0xc21b('0x5'));var config=require(_0xc21b('0x6'));config[_0xc21b('0x7')]=_['defaults'](config[_0xc21b('0x7')],{'host':_0xc21b('0x8'),'port':0x18eb});var io=require(_0xc21b('0x9'))(new Redis(config['redis']));function getAuthToken(_0x231052,_0x1c108a,_0x37d510){if(_0x231052[_0xc21b('0xa')]){_0x231052[_0xc21b('0xb')]=_0x231052[_0xc21b('0xc')][_0xc21b('0xd')];_0x231052['tenantId']=_0x231052['CloudProvider'][_0xc21b('0xe')];return Promise[_0xc21b('0xf')](_0x231052[_0xc21b('0xc')]['data5']);}var _0x1e61f8={'method':_0xc21b('0x10'),'uri':_0x1c108a,'form':{'client_id':_0x231052['clientId'],'resource':_0x231052['remoteUri'],'username':_0x231052['username'],'password':_0x231052[_0xc21b('0x11')],'grant_type':_0xc21b('0x11'),'client_secret':_0x231052[_0xc21b('0x12')]},'json':!![]};return rp(_0x1e61f8)[_0xc21b('0x13')](function(_0x56b652){return _0x56b652[_0xc21b('0x14')];})[_0xc21b('0x15')](function(_0x4eb85f){logger[_0xc21b('0x16')]('['+[_0x37d510[_0xc21b('0x17')]()]+']\x20Wrong\x20credentials!');return _0x4eb85f[_0xc21b('0x18')];});}function getUser(_0x46ec8e,_0x4f18e5,_0x5d34b9,_0xbe4ae9,_0x1b3d98,_0x50ab5b){return new Promise(function(_0x16e910,_0x3beaa1){return getAuthToken(_0x4f18e5,_0xbe4ae9,_0x50ab5b)['then'](function(_0x4f3da6){var _0x3bd271={'method':_0xc21b('0x19'),'uri':_0x1b3d98+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x4f3da6,'OData-Version':_0xc21b('0x1a')},'json':!![]};return rp(_0x3bd271);})['then'](function(_0x5d943d){var _0x32dce3=_0x5d943d[_0xc21b('0x1b')];var _0x5e600d=![];var _0x4c34ee=null;if(!_[_0xc21b('0x1c')](_0x5d34b9)){if(intUtil[_0xc21b('0x1d')](_0x5d34b9['email'])){_0x46ec8e[_0xc21b('0x1e')]=_0x5d34b9[_0xc21b('0x1f')];for(_0x4c34ee=0x0;_0x4c34ee<_0x32dce3[_0xc21b('0x20')];_0x4c34ee++){if(_0x32dce3[_0x4c34ee][_0xc21b('0x21')]===_0x5d34b9['email']&&!_0x32dce3[_0x4c34ee][_0xc21b('0x22')]){_0x5e600d=!![];logger[_0xc21b('0x23')]('['+[_0x50ab5b[_0xc21b('0x17')]()]+']\x20Agent\x20found\x20'+_0x32dce3[_0x4c34ee][_0xc21b('0x24')]+'!');_0x46ec8e[_0xc21b('0x25')]=_0x32dce3[_0x4c34ee]['systemuserid'];}}}}if(!_0x5e600d){logger[_0xc21b('0x23')]('['+[_0x50ab5b[_0xc21b('0x17')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x46ec8e[_0xc21b('0x1e')]=_0x4f18e5['username'];for(_0x4c34ee=0x0;_0x4c34ee<_0x32dce3[_0xc21b('0x20')];_0x4c34ee++){if(_0x32dce3[_0x4c34ee][_0xc21b('0x21')]===_0x4f18e5[_0xc21b('0x26')]){_0x46ec8e['userId']=_0x32dce3[_0x4c34ee][_0xc21b('0x24')];}}}_0x16e910(_0x46ec8e);})[_0xc21b('0x15')](function(_0x2c772f){_0x3beaa1(_0x2c772f[_0xc21b('0x18')]);});});}function createEndUser(_0x1a7e31,_0x403936,_0x6a2682,_0x38b5fa,_0x26ceda,_0x13937d,_0x17e06f){return new Promise(function(_0x49ab18,_0x414819){return getAuthToken(_0x403936,_0x6a2682,_0x13937d)[_0xc21b('0x13')](function(_0x8d6a4){var _0x132042=_0x13937d['toLowerCase']()==='outbound'?_0x26ceda[_0xc21b('0x27')]:_0x26ceda['calleridnum'];var _0x277da3={'method':'POST','uri':_0x38b5fa+_0xc21b('0x28'),'body':{'fullname':_0x132042,'firstname':_0x132042,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xc21b('0x29')+_0x1a7e31[_0xc21b('0x25')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x8d6a4,'OData-Version':_0xc21b('0x1a')},'json':!![],'resolveWithFullResponse':!![]};_0x277da3[_0xc21b('0x2a')][_0x17e06f]=_0x132042;return rp(_0x277da3);})[_0xc21b('0x13')](function(_0x4b94b9){var _0x5b50f3=_0x4b94b9[_0xc21b('0x2b')]['odata-entityid'];var _0x5e850a=_0x5b50f3['substring'](_0x5b50f3[_0xc21b('0x2c')]('(')+0x1,_0x5b50f3[_0xc21b('0x2c')](')'));_0x1a7e31['enduserId']=_0x5e850a;_0x49ab18(_0x1a7e31);})[_0xc21b('0x15')](function(_0x1b7da3){_0x414819(_0x1b7da3[_0xc21b('0x18')]);});});}function getEndUser(_0x4b145e,_0x4a8d14,_0x1f02f9,_0x4dd047,_0x5b7d19,_0x474b0d,_0x3d6578,_0x3053f2){var _0x1fd2d5=_0x474b0d[_0xc21b('0x2d')]()==='outbound'?_0x5b7d19[_0xc21b('0x27')]:_0x5b7d19['calleridnum'];return getAuthToken(_0x4a8d14,_0x1f02f9,_0x474b0d)['then'](function(_0x10edd7){_0x3053f2=_0x3053f2?_0x3053f2:'telephone1';var _0x299743={'method':'GET','uri':_0x4dd047+_0xc21b('0x2e')+_0x3053f2+_0xc21b('0x2f')+_0x3053f2+_0xc21b('0x30')+_0x1fd2d5[_0xc21b('0x31')]('+',_0xc21b('0x32'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x10edd7,'If-None-Match':null,'OData-Version':_0xc21b('0x1a')},'json':!![]};return rp(_0x299743);})['then'](function(_0x54944e){var _0x176a36=![];if(!_0x54944e)return _0x176a36;var _0x2933c4=_0x54944e[_0xc21b('0x1b')];for(var _0x436234=0x0;_0x436234<_0x2933c4[_0xc21b('0x20')];_0x436234++){if(_0x2933c4[_0x436234][_0x3053f2]===_0x1fd2d5){_0x176a36=!![];_0x4b145e[_0xc21b('0x33')]=_0x2933c4[_0x436234][_0xc21b('0x34')];}}return _0x176a36;})[_0xc21b('0x13')](function(_0x3001c3){if(_0x3001c3)return _0x4b145e;if(_0x3d6578===_0xc21b('0x35')){logger[_0xc21b('0x23')]('['+[_0x474b0d[_0xc21b('0x17')]()]+_0xc21b('0x36'));return _0x4b145e;}return createEndUser(_0x4b145e,_0x4a8d14,_0x1f02f9,_0x4dd047,_0x5b7d19,_0x474b0d,_0x3053f2)[_0xc21b('0x13')](function(_0x14c244){logger['info']('['+[_0x474b0d[_0xc21b('0x17')]()]+_0xc21b('0x37'),_0x14c244['enduserId']);return _0x14c244;});});}function getCustomFields(_0x2eee3f,_0x1df69b,_0xecbd00){var _0x35b678={};if(_0x2eee3f[_0xc21b('0x20')]>0x0){_[_0xc21b('0x38')](_0x2eee3f,function(_0x149354){if(_[_0xc21b('0x39')]([_0xc21b('0x3a'),_0xc21b('0x3b')],_0x149354[_0xc21b('0x3c')])&&_0x149354[_0xc21b('0x3d')]&&!_0x149354[_0xc21b('0x3e')]){var _0x2e6239=_0x149354['idField']['toLowerCase']();var _0x502117=_0x2e6239['substring'](0x0,_0x2e6239[_0xc21b('0x3f')]('_'));var _0x23e434=_0x2e6239['substring'](_0x2e6239[_0xc21b('0x3f')]('_')+0x1);if(_0x502117===_0xecbd00){_0x35b678[_0x23e434]=_0x149354['content'];}}});}return _0x35b678;}function getTicket(_0x42d74c,_0x20c9d1,_0x1f2742,_0x487195,_0xb0e7b8,_0x51c658,_0xd44adc){return new Promise(function(_0x5d1bb6,_0x3b4bf5){var _0x6fe0bd;return getAuthToken(_0x20c9d1,_0x1f2742,_0xd44adc)[_0xc21b('0x13')](function(_0x303c08){if(_0x51c658[_0xc21b('0x40')]===_0xc21b('0x41')){_0x6fe0bd={'method':_0xc21b('0x10'),'uri':_0x487195+_0xc21b('0x42'),'body':Object[_0xc21b('0x43')]({},{'title':intUtil[_0xc21b('0x44')](_0x51c658['Subjects'],_0xb0e7b8,'\x20'),'description':intUtil[_0xc21b('0x44')](_0x51c658[_0xc21b('0x45')],_0xb0e7b8,'\x0a'),'customerid_contact@odata.bind':_0x42d74c[_0xc21b('0x33')]?_0xc21b('0x46')+_0x42d74c[_0xc21b('0x33')]+')':undefined,'ownerid@odata.bind':_0xc21b('0x29')+_0x42d74c[_0xc21b('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x51c658['Fields'],_0xb0e7b8,_0x51c658[_0xc21b('0x40')])),'headers':{'Authorization':_0xc21b('0x47')+_0x303c08,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x51c658[_0xc21b('0x40')]===_0xc21b('0x48')){var _0x43f13d=_0x42d74c['enduserId']?[{'partyid_systemuser@odata.bind':_0xc21b('0x29')+_0x42d74c['userId']+')','participationtypemask':_0x42d74c['callDirection']===_0xc21b('0x49')?0x2:0x1},{'partyid_contact@odata.bind':_0xc21b('0x46')+_0x42d74c[_0xc21b('0x33')]+')','participationtypemask':_0x42d74c[_0xc21b('0x4a')]===_0xc21b('0x49')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xc21b('0x29')+_0x42d74c['userId']+')','participationtypemask':_0x42d74c['callDirection']===_0xc21b('0x49')?0x2:0x1}];_0x6fe0bd={'method':'POST','uri':_0x487195+'phonecalls','body':Object[_0xc21b('0x43')]({},{'subject':intUtil[_0xc21b('0x44')](_0x51c658['Subjects'],_0xb0e7b8,'\x20'),'phonenumber':String(_0xb0e7b8[_0xc21b('0x4b')]),'description':intUtil[_0xc21b('0x44')](_0x51c658[_0xc21b('0x45')],_0xb0e7b8,'\x0a'),'regardingobjectid_contact@odata.bind':_0x42d74c[_0xc21b('0x33')]?_0xc21b('0x46')+_0x42d74c[_0xc21b('0x33')]+')':undefined,'ownerid@odata.bind':_0xc21b('0x29')+_0x42d74c[_0xc21b('0x25')]+')','directioncode':_0x42d74c[_0xc21b('0x4a')]===_0xc21b('0x49')?![]:!![],'phonecall_activity_parties':_0x43f13d},getCustomFields(_0x51c658[_0xc21b('0x4c')],_0xb0e7b8,_0x51c658[_0xc21b('0x40')])),'headers':{'Authorization':'Bearer\x20'+_0x303c08,'OData-Version':_0xc21b('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x6fe0bd);})['then'](function(_0x105d73){var _0x3a8f27=_0x105d73[_0xc21b('0x2b')][_0xc21b('0x4d')];var _0x56c500=_0x3a8f27[_0xc21b('0x4e')](_0x3a8f27[_0xc21b('0x2c')]('(')+0x1,_0x3a8f27[_0xc21b('0x2c')](')'));_0x42d74c[_0xc21b('0x4f')]=_0x56c500;_0x5d1bb6(_0x42d74c);})[_0xc21b('0x15')](function(_0x464ba7){_0x3b4bf5(_0x464ba7['message']);});});}function emit(_0x4ec40a,_0x3c0be5,_0x2cd0c3,_0x2dca6d){var _0x40b2b7={'uri':util[_0xc21b('0x50')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x4ec40a,_0x2cd0c3,_0x2dca6d)};io['to'](util[_0xc21b('0x50')](_0xc21b('0x51'),_0x3c0be5))[_0xc21b('0x52')](_0xc21b('0x53'),_0x40b2b7);}exports['cs']=function(_0x299457,_0x50e69f,_0x224696,_0x3f01b7,_0x29519e,_0x4b9a66,_0x3ee06b,_0x54b4b6){var _0x45b7e5={};_0x4b9a66[_0xc21b('0xb')]=_0x4b9a66[_0xc21b('0xa')]?intUtil[_0xc21b('0x54')](_0x4b9a66[_0xc21b('0xc')][_0xc21b('0xd')]):intUtil[_0xc21b('0x54')](_0x4b9a66[_0xc21b('0xb')]);_0x4b9a66[_0xc21b('0x55')]=intUtil['stripTrailingSlash'](_0x4b9a66[_0xc21b('0x55')]);_0x45b7e5[_0xc21b('0x4a')]=_0x54b4b6==='queue'||_0x54b4b6==='unmanaged'?_0xc21b('0x49'):'outbound';var _0x17f656=_0x4b9a66[_0xc21b('0xa')]?util['format'](_0xc21b('0x56'),_0x4b9a66[_0xc21b('0xc')]['data7']):util[_0xc21b('0x50')]('%s/api/data/v9.0/',_0x4b9a66['remoteUri']);var _0xd3ed3e=util['format'](_0xc21b('0x57'),_0x4b9a66[_0xc21b('0x58')]);var _0x3f967c=util[_0xc21b('0x50')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4b9a66['serverUrl'],_0x50e69f['uniqueid'],md5(_0x50e69f[_0xc21b('0x59')]));if(_0x29519e&&_0x29519e['monitor_format']){logger[_0xc21b('0x23')](_0xc21b('0x5a'),_0xc21b('0x5b'));_0x50e69f[_0xc21b('0x5c')]=_0x3f967c;}else if(_0x3ee06b&&_0x3ee06b['recordingFormat']&&_0x3ee06b['recordingFormat']!==_0xc21b('0x5d')){logger[_0xc21b('0x23')](_0xc21b('0x5e'),_0xc21b('0x5b'));_0x50e69f['recordingURL']=_0x3f967c;}else{_0x50e69f['recordingURL']='';}return getUser(_0x45b7e5,_0x4b9a66,_0x3f01b7,_0xd3ed3e,_0x17f656,_0x54b4b6)[_0xc21b('0x13')](function(_0x487458){logger[_0xc21b('0x23')]('['+_0x54b4b6[_0xc21b('0x17')]()+']\x20The\x20User\x20ID\x20is:',_0x487458[_0xc21b('0x25')]);logger[_0xc21b('0x23')]('['+_0x54b4b6[_0xc21b('0x17')]()+']\x20The\x20User\x20email\x20is:',_0x487458[_0xc21b('0x1e')]);return getEndUser(_0x487458,_0x4b9a66,_0xd3ed3e,_0x17f656,_0x50e69f,_0x54b4b6,_0x224696[_0xc21b('0x5f')],_0x224696[_0xc21b('0x60')]);})[_0xc21b('0x13')](function(_0x29205b){logger[_0xc21b('0x23')]('['+_0x54b4b6[_0xc21b('0x17')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x29205b[_0xc21b('0x33')]);logger[_0xc21b('0x23')]('['+_0x54b4b6[_0xc21b('0x17')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x50e69f[_0xc21b('0x4b')]);return getTicket(_0x29205b,_0x4b9a66,_0xd3ed3e,_0x17f656,_0x50e69f,_0x224696,_0x54b4b6);})[_0xc21b('0x13')](function(_0x67b25a){logger[_0xc21b('0x23')](util[_0xc21b('0x50')]('['+_0x54b4b6[_0xc21b('0x17')]()+_0xc21b('0x61'),_0x224696[_0xc21b('0x40')],_0x67b25a[_0xc21b('0x4f')]));logger[_0xc21b('0x23')](util[_0xc21b('0x50')]('['+_0x54b4b6[_0xc21b('0x17')]()+_0xc21b('0x62'),_0x54b4b6));if(_0x54b4b6!=='unmanaged'&&_0x224696[_0xc21b('0x63')]){logger['info']('['+_0x54b4b6[_0xc21b('0x17')]()+']',_0xc21b('0x64'));emit(_0x4b9a66['remoteUri'],_0x3f01b7[_0xc21b('0x65')],_0x224696[_0xc21b('0x40')],_0x67b25a['ticketId']);}})[_0xc21b('0x15')](function(_0x305976){logger[_0xc21b('0x16')]('['+_0x54b4b6['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x305976[_0xc21b('0x18')]);console[_0xc21b('0x16')](_0xc21b('0x66'),_0x305976);});}; \ 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 f36fbea..d69cb02 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 _0xb7bf=['uniqueid','Authorization','The\x20User\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','trigger:browser:url','catch','stringify','The\x20Enduser\x20ID\x20is:','lastevent','toUpperCase','lodash','md5','util','ioredis','./util','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','Subjects','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','length','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','POST','Enduser\x20created.','Basic\x20%s','toString','debug','GET','map','forEach','includes','string','picklist','type','customField','toLowerCase','content','idField','push','variable','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x52868c,_0x136c1a){var _0x9fc033=function(_0x51df43){while(--_0x51df43){_0x52868c['push'](_0x52868c['shift']());}};_0x9fc033(++_0x136c1a);}(_0xb7bf,0x174));var _0xfb7b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb7bf[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xfb7b('0x0'));var rp=require('request-promise');var md5=require(_0xfb7b('0x1'));var util=require(_0xfb7b('0x2'));var Redis=require(_0xfb7b('0x3'));var intUtil=require(_0xfb7b('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xfb7b('0x5'));config[_0xfb7b('0x6')]=_[_0xfb7b('0x7')](config[_0xfb7b('0x6')],{'host':_0xfb7b('0x8'),'port':0x18eb});var io=require(_0xfb7b('0x9'))(new Redis(config[_0xfb7b('0x6')]));var headers={'Content-Type':_0xfb7b('0xa'),'Accept':_0xfb7b('0xa')};function emit(_0x546fc2,_0x4662d2,_0x582462){io['to'](_0x546fc2)['emit'](_0x4662d2,_0x582462);}function getTicket(_0x214780,_0x565791,_0x2f1e27,_0x2173ff,_0xfb700d){logger[_0xfb7b('0xb')](_0xfb7b('0xc'));var _0x178c03=_[_0xfb7b('0xd')]({'responder_id':_0x565791['id'],'requester_id':_0x2f1e27['id'],'name':util[_0xfb7b('0xe')]('Caller\x20-\x20%s',_0xfb700d[_0xfb7b('0xf')]),'phone':_0xfb700d[_0xfb7b('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x2173ff[_0xfb7b('0x11')],_0xfb700d,'\x20'),'description':intUtil['getString'](_0x2173ff['Descriptions'],_0xfb700d,'
'),'tags':getTags(_0x2173ff['Tags'],_0xfb7b('0x12'))},getCustomFields(_0x2173ff[_0xfb7b('0x13')],_0xfb700d));_0x178c03[_0xfb7b('0x14')]=_[_0xfb7b('0x15')](_[_0xfb7b('0x16')](_0x178c03['custom_fields'],'id'),_0xfb7b('0x17'));return request({'uri':util[_0xfb7b('0xe')](_0xfb7b('0x18'),_0x214780[_0xfb7b('0x19')]),'method':'POST','body':_0x178c03})['then'](function(_0x1e2eaa){logger[_0xfb7b('0xb')](_0xfb7b('0x1a'));return _0x1e2eaa;});}function getUser(_0xa285be,_0x17fd75){if(intUtil[_0xfb7b('0x1b')](_0x17fd75)){return request({'uri':util[_0xfb7b('0xe')](_0xfb7b('0x1c'),_0xa285be[_0xfb7b('0x19')]),'qs':{'email':_0x17fd75}})[_0xfb7b('0x1d')](function(_0x3e3ff6){if(_0x3e3ff6[_0xfb7b('0x1e')]){logger[_0xfb7b('0xb')](_0xfb7b('0x1f'));return _[_0xfb7b('0x20')](_0x3e3ff6,function(_0x152be2){return _0x152be2[_0xfb7b('0x21')][_0xfb7b('0x22')]===_0x17fd75;});}else{logger[_0xfb7b('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xfb7b('0xe')](_0xfb7b('0x23'),_0xa285be[_0xfb7b('0x19')])})[_0xfb7b('0x1d')](function(_0x66f5b4){logger['info'](_0xfb7b('0x24'));return _0x66f5b4;});}});}else{logger[_0xfb7b('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xfb7b('0xe')]('%s/api/v2/agents/me',_0xa285be[_0xfb7b('0x19')])})['then'](function(_0x1e9c85){logger['info'](_0xfb7b('0x24'));return _0x1e9c85;});}}function getEndUser(_0x126d3d,_0x3e6750,_0x18cebe){logger[_0xfb7b('0xb')](_0xfb7b('0x25'),_0x18cebe);return request({'uri':util[_0xfb7b('0xe')]('%s/api/v2/contacts',_0x126d3d[_0xfb7b('0x19')]),'qs':{'phone':_0x18cebe}})[_0xfb7b('0x1d')](function(_0x859c7e){if(_0x859c7e[_0xfb7b('0x1e')]){logger['info']('Enduser\x20found!');return _[_0xfb7b('0x20')](_0x859c7e,{'phone':_0x18cebe});}else{logger['info'](_0xfb7b('0x26'));return request({'uri':util[_0xfb7b('0xe')](_0xfb7b('0x27'),_0x126d3d['remoteUri']),'method':_0xfb7b('0x28'),'body':{'name':_0x3e6750,'phone':_0x18cebe}})[_0xfb7b('0x1d')](function(_0x58a9f8){logger[_0xfb7b('0xb')](_0xfb7b('0x29'));return _0x58a9f8;});}});}function getAuth(_0xba3a2b){return util[_0xfb7b('0xe')](_0xfb7b('0x2a'),new Buffer(_0xba3a2b['apiKey']+':X')[_0xfb7b('0x2b')]('base64'));}function request(_0xe031b7){logger[_0xfb7b('0x2c')]('[HTTP]',JSON['stringify'](_0xe031b7));return rp(_[_0xfb7b('0x7')](_0xe031b7,{'method':_0xfb7b('0x2d'),'headers':headers,'json':!![]}));}function getTags(_0x35ef0d,_0x24b261){var _0x15abdf=[];if(_0x35ef0d&&_0x35ef0d[_0xfb7b('0x1e')]>0x0){_0x15abdf=_[_0xfb7b('0x2e')](_0x35ef0d,_0x24b261);}return _0x15abdf;}function getCustomFields(_0x10231f,_0x3da488){var _0x22e400=[];var _0x314380={'custom_fields':[]};if(_0x10231f[_0xfb7b('0x1e')]>0x0){_[_0xfb7b('0x2f')](_0x10231f,function(_0x252591){if(_[_0xfb7b('0x30')]([_0xfb7b('0x31'),_0xfb7b('0x32')],_0x252591[_0xfb7b('0x33')])&&_0x252591['nameField']&&!_0x252591[_0xfb7b('0x34')]){_0x314380[_0x252591['nameField'][_0xfb7b('0x35')]()]=_0x252591[_0xfb7b('0x36')][_0xfb7b('0x2b')]();}else if(_[_0xfb7b('0x30')](['string',_0xfb7b('0x32')],_0x252591[_0xfb7b('0x33')])&&_0x252591[_0xfb7b('0x37')]&&_0x252591['customField']){_0x314380[_0xfb7b('0x14')][_0xfb7b('0x38')]({'id':_0x252591[_0xfb7b('0x37')],'value':_0x252591[_0xfb7b('0x36')][_0xfb7b('0x2b')]()});}else if(_0x252591[_0xfb7b('0x33')]===_0xfb7b('0x39')&&_0x252591['variableName']&&_0x252591['idField']&&_0x252591[_0xfb7b('0x34')]){_0x3da488[_0x252591['variableName']]&&_0x314380[_0xfb7b('0x14')][_0xfb7b('0x38')]({'id':_0x252591[_0xfb7b('0x37')],'value':_0x3da488[_0x252591['variableName']][_0xfb7b('0x2b')]()});}else if(_0x252591['type']===_0xfb7b('0x3a')&&_0x252591[_0xfb7b('0x3b')]&&_0x252591['Variable']['name']&&_0x252591['idField']&&_0x252591[_0xfb7b('0x34')]){_0x3da488[_0x252591['Variable'][_0xfb7b('0x12')][_0xfb7b('0x35')]()]&&_0x314380[_0xfb7b('0x14')][_0xfb7b('0x38')]({'id':_0x252591[_0xfb7b('0x37')],'value':_0x3da488[_0x252591[_0xfb7b('0x3b')]['name']['toLowerCase']()][_0xfb7b('0x2b')]()});}});}return _0x314380;}exports[_0xfb7b('0x3c')]=function(_0x15b476,_0x28ff61,_0x29bbaa,_0x3242bb,_0xb759bd,_0x3b8fd6){var _0xd18f39,_0x75acf4;_0x3b8fd6[_0xfb7b('0x19')]=intUtil[_0xfb7b('0x3d')](_0x3b8fd6[_0xfb7b('0x19')]);_0x3b8fd6[_0xfb7b('0x3e')]=intUtil['stripTrailingSlash'](_0x3b8fd6[_0xfb7b('0x3e')]);if(_0xb759bd&&_0xb759bd[_0xfb7b('0x3f')]){logger[_0xfb7b('0xb')](_0xfb7b('0x40'),_0xfb7b('0x41'));_0x28ff61[_0xfb7b('0x42')]=util[_0xfb7b('0xe')](_0xfb7b('0x43'),_0x3b8fd6['serverUrl'],_0x28ff61[_0xfb7b('0x44')],md5(_0x28ff61[_0xfb7b('0x44')]));}else{_0x28ff61['recordingURL']='';}headers[_0xfb7b('0x45')]=getAuth(_0x3b8fd6);return getUser(_0x3b8fd6,_0x3242bb['email'])[_0xfb7b('0x1d')](function(_0x4e7297){_0xd18f39=_0x4e7297;logger[_0xfb7b('0xb')](_0xfb7b('0x46'),_0xd18f39['id']);return getEndUser(_0x3b8fd6,_0x28ff61['calleridname'],_0x28ff61[_0xfb7b('0x10')]);})[_0xfb7b('0x1d')](function(_0x82b7b4){_0x75acf4=_0x82b7b4;logger[_0xfb7b('0xb')]('The\x20Enduser\x20ID\x20is:',_0x75acf4['id']);return getTicket(_0x3b8fd6,_0xd18f39,_0x75acf4,_0x29bbaa,_0x28ff61);})[_0xfb7b('0x1d')](function(_0x419f3d){if(_0x419f3d&&_0x419f3d['id']){logger[_0xfb7b('0xb')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x419f3d['id']);logger[_0xfb7b('0xb')]('[QUEUE]',_0xfb7b('0x47'));emit(util[_0xfb7b('0xe')](_0xfb7b('0x48'),_0x3242bb['name']),'trigger:browser:url',{'uri':util[_0xfb7b('0xe')](_0xfb7b('0x49'),_0x3b8fd6['remoteUri'],_0x419f3d['id'])});}})['catch'](function(_0x75f485){logger[_0xfb7b('0x4a')]('[QUEUE]',JSON['stringify'](_0x75f485));});};exports[_0xfb7b('0x4b')]=function(_0x563257,_0x5816da,_0xe2822d,_0x5cf4f1,_0x466d17,_0x1228fc,_0x11cf3a){var _0x30e980,_0x5384df;_0x1228fc[_0xfb7b('0x19')]=intUtil[_0xfb7b('0x3d')](_0x1228fc[_0xfb7b('0x19')]);_0x1228fc[_0xfb7b('0x3e')]=intUtil['stripTrailingSlash'](_0x1228fc[_0xfb7b('0x3e')]);if(_0x11cf3a&&_0x11cf3a[_0xfb7b('0x4c')]&&_0x11cf3a[_0xfb7b('0x4c')]!==_0xfb7b('0x4d')){logger[_0xfb7b('0xb')](_0xfb7b('0x4e'),'Recording\x20is\x20enabled!');_0x5816da[_0xfb7b('0x42')]=util[_0xfb7b('0xe')](_0xfb7b('0x43'),_0x1228fc[_0xfb7b('0x3e')],_0x5816da['uniqueid'],md5(_0x5816da['uniqueid']));}headers['Authorization']=getAuth(_0x1228fc);return getUser(_0x1228fc,_0x5cf4f1[_0xfb7b('0x22')])[_0xfb7b('0x1d')](function(_0x47fcbf){_0x30e980=_0x47fcbf;logger['info']('The\x20User\x20ID\x20is:',_0x30e980['id']);return getEndUser(_0x1228fc,_0x5816da[_0xfb7b('0x4f')],_0x5816da[_0xfb7b('0x50')]);})[_0xfb7b('0x1d')](function(_0x44779d){_0x5384df=_0x44779d;logger['info']('The\x20Enduser\x20ID\x20is:',_0x5384df['id']);return getTicket(_0x1228fc,_0x30e980,_0x5384df,_0xe2822d,_0x5816da);})[_0xfb7b('0x1d')](function(_0xeec07b){if(_0xeec07b&&_0xeec07b['id']){logger[_0xfb7b('0xb')]('Ticket\x20created!');logger[_0xfb7b('0xb')](_0xfb7b('0x51'),_0xeec07b['id']);logger[_0xfb7b('0xb')](_0xfb7b('0x4e'),_0xfb7b('0x47'));emit(util[_0xfb7b('0xe')](_0xfb7b('0x48'),_0x5cf4f1['name']),_0xfb7b('0x52'),{'uri':util[_0xfb7b('0xe')](_0xfb7b('0x49'),_0x1228fc[_0xfb7b('0x19')],_0xeec07b['id'])});}})[_0xfb7b('0x53')](function(_0x112fe7){logger[_0xfb7b('0x4a')](_0xfb7b('0x4e'),JSON[_0xfb7b('0x54')](_0x112fe7));});};exports['unmanaged']=function(_0xed8eef,_0x305b8d,_0x2c8bdf,_0x50a814,_0x12fc8a,_0x64ef7a){var _0x1add95,_0x3d86af;_0x64ef7a['remoteUri']=intUtil['stripTrailingSlash'](_0x64ef7a[_0xfb7b('0x19')]);_0x64ef7a[_0xfb7b('0x3e')]=intUtil[_0xfb7b('0x3d')](_0x64ef7a[_0xfb7b('0x3e')]);if(_0x12fc8a&&_0x12fc8a['monitor_format']){logger['info']('['+_0x305b8d['lastevent']['toUpperCase']()+']',_0xfb7b('0x41'));_0x305b8d[_0xfb7b('0x42')]=util[_0xfb7b('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x64ef7a[_0xfb7b('0x3e')],_0x305b8d[_0xfb7b('0x44')],md5(_0x305b8d[_0xfb7b('0x44')]));}else{_0x305b8d['recordingURL']='';}headers[_0xfb7b('0x45')]=getAuth(_0x64ef7a);return getUser(_0x64ef7a,'')[_0xfb7b('0x1d')](function(_0x17993a){_0x1add95=_0x17993a;logger[_0xfb7b('0xb')](_0xfb7b('0x46'),_0x1add95['id']);return getEndUser(_0x64ef7a,_0x305b8d['calleridname'],_0x305b8d[_0xfb7b('0x10')]);})[_0xfb7b('0x1d')](function(_0x4a285f){_0x3d86af=_0x4a285f;logger[_0xfb7b('0xb')](_0xfb7b('0x55'),_0x3d86af['id']);return getTicket(_0x64ef7a,_0x1add95,_0x3d86af,_0x2c8bdf,_0x305b8d);})[_0xfb7b('0x1d')](function(_0x5ad6ec){if(_0x5ad6ec){logger[_0xfb7b('0xb')]('Ticket\x20created!');logger[_0xfb7b('0xb')](_0xfb7b('0x51'),_0x5ad6ec['id']);}})[_0xfb7b('0x53')](function(_0x4f2d6e){logger[_0xfb7b('0x4a')]('['+_0x305b8d[_0xfb7b('0x56')][_0xfb7b('0x57')]()+']',JSON['stringify'](_0x4f2d6e));});}; \ No newline at end of file +var _0x8da8=['getString','Descriptions','
','Tags','name','keyBy','format','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','push','variable','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','trigger:browser:url','%s/helpdesk/tickets/%d','error','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lastevent','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','calleridname','calleridnum','Subjects'];(function(_0xf74eaa,_0x4ac030){var _0x44b505=function(_0x62d789){while(--_0x62d789){_0xf74eaa['push'](_0xf74eaa['shift']());}};_0x44b505(++_0x4ac030);}(_0x8da8,0x106));var _0x88da=function(_0x22fc85,_0xfba9){_0x22fc85=_0x22fc85-0x0;var _0x5bbb70=_0x8da8[_0x22fc85];return _0x5bbb70;};'use strict';var _=require('lodash');var rp=require(_0x88da('0x0'));var md5=require(_0x88da('0x1'));var util=require(_0x88da('0x2'));var Redis=require('ioredis');var intUtil=require(_0x88da('0x3'));var config=require(_0x88da('0x4'));var logger=require(_0x88da('0x5'))('freshdesk');config[_0x88da('0x6')]=_['defaults'](config[_0x88da('0x6')],{'host':_0x88da('0x7'),'port':0x18eb});var io=require(_0x88da('0x8'))(new Redis(config['redis']));var headers={'Content-Type':_0x88da('0x9'),'Accept':_0x88da('0x9')};function emit(_0xb86c38,_0x3cc468,_0x4e7bd2){io['to'](_0xb86c38)[_0x88da('0xa')](_0x3cc468,_0x4e7bd2);}function getTicket(_0x570b5b,_0x3b15e5,_0x629f44,_0x2b0c0c,_0x5dba10){logger[_0x88da('0xb')](_0x88da('0xc'));var _0x283b17=_[_0x88da('0xd')]({'responder_id':_0x3b15e5['id'],'requester_id':_0x629f44['id'],'name':util['format']('Caller\x20-\x20%s',_0x5dba10[_0x88da('0xe')]),'phone':_0x5dba10[_0x88da('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x2b0c0c[_0x88da('0x10')],_0x5dba10,'\x20'),'description':intUtil[_0x88da('0x11')](_0x2b0c0c[_0x88da('0x12')],_0x5dba10,_0x88da('0x13')),'tags':getTags(_0x2b0c0c[_0x88da('0x14')],_0x88da('0x15'))},getCustomFields(_0x2b0c0c['Fields'],_0x5dba10));_0x283b17['custom_fields']=_['mapValues'](_[_0x88da('0x16')](_0x283b17['custom_fields'],'id'),'value');return request({'uri':util[_0x88da('0x17')](_0x88da('0x18'),_0x570b5b[_0x88da('0x19')]),'method':_0x88da('0x1a'),'body':_0x283b17})[_0x88da('0x1b')](function(_0x5413f6){logger['info'](_0x88da('0x1c'));return _0x5413f6;});}function getUser(_0x4919df,_0x560040){if(intUtil[_0x88da('0x1d')](_0x560040)){return request({'uri':util[_0x88da('0x17')]('%s/api/v2/agents',_0x4919df[_0x88da('0x19')]),'qs':{'email':_0x560040}})[_0x88da('0x1b')](function(_0x34006a){if(_0x34006a[_0x88da('0x1e')]){logger[_0x88da('0xb')](_0x88da('0x1f'));return _[_0x88da('0x20')](_0x34006a,function(_0x5046d4){return _0x5046d4['contact'][_0x88da('0x21')]===_0x560040;});}else{logger[_0x88da('0xb')](_0x88da('0x22'));return request({'uri':util[_0x88da('0x17')](_0x88da('0x23'),_0x4919df[_0x88da('0x19')])})[_0x88da('0x1b')](function(_0x41b78e){logger[_0x88da('0xb')](_0x88da('0x24'));return _0x41b78e;});}});}else{logger[_0x88da('0xb')](_0x88da('0x25'));return request({'uri':util[_0x88da('0x17')](_0x88da('0x23'),_0x4919df[_0x88da('0x19')])})[_0x88da('0x1b')](function(_0x16972d){logger[_0x88da('0xb')](_0x88da('0x24'));return _0x16972d;});}}function getEndUser(_0x111af2,_0x4ddf1a,_0x411d4f){logger['info'](_0x88da('0x26'),_0x411d4f);return request({'uri':util[_0x88da('0x17')]('%s/api/v2/contacts',_0x111af2['remoteUri']),'qs':{'phone':_0x411d4f}})['then'](function(_0x445ace){if(_0x445ace['length']){logger[_0x88da('0xb')](_0x88da('0x27'));return _[_0x88da('0x20')](_0x445ace,{'phone':_0x411d4f});}else{logger['info'](_0x88da('0x28'));return request({'uri':util[_0x88da('0x17')]('%s/api/v2/contacts',_0x111af2['remoteUri']),'method':'POST','body':{'name':_0x4ddf1a,'phone':_0x411d4f}})['then'](function(_0x4c03c2){logger[_0x88da('0xb')](_0x88da('0x29'));return _0x4c03c2;});}});}function getAuth(_0x1bb8f1){return util['format'](_0x88da('0x2a'),new Buffer(_0x1bb8f1[_0x88da('0x2b')]+':X')[_0x88da('0x2c')](_0x88da('0x2d')));}function request(_0xadb55c){logger[_0x88da('0x2e')](_0x88da('0x2f'),JSON['stringify'](_0xadb55c));return rp(_['defaults'](_0xadb55c,{'method':_0x88da('0x30'),'headers':headers,'json':!![]}));}function getTags(_0xe5f015,_0x22726f){var _0x46386d=[];if(_0xe5f015&&_0xe5f015[_0x88da('0x1e')]>0x0){_0x46386d=_[_0x88da('0x31')](_0xe5f015,_0x22726f);}return _0x46386d;}function getCustomFields(_0x5d47df,_0x3f5274){var _0x4997a3=[];var _0xe0499c={'custom_fields':[]};if(_0x5d47df['length']>0x0){_[_0x88da('0x32')](_0x5d47df,function(_0x462dd3){if(_[_0x88da('0x33')]([_0x88da('0x34'),_0x88da('0x35')],_0x462dd3[_0x88da('0x36')])&&_0x462dd3[_0x88da('0x37')]&&!_0x462dd3[_0x88da('0x38')]){_0xe0499c[_0x462dd3[_0x88da('0x37')][_0x88da('0x39')]()]=_0x462dd3[_0x88da('0x3a')][_0x88da('0x2c')]();}else if(_[_0x88da('0x33')]([_0x88da('0x34'),_0x88da('0x35')],_0x462dd3[_0x88da('0x36')])&&_0x462dd3[_0x88da('0x3b')]&&_0x462dd3[_0x88da('0x38')]){_0xe0499c[_0x88da('0x3c')][_0x88da('0x3d')]({'id':_0x462dd3['idField'],'value':_0x462dd3[_0x88da('0x3a')][_0x88da('0x2c')]()});}else if(_0x462dd3[_0x88da('0x36')]===_0x88da('0x3e')&&_0x462dd3[_0x88da('0x3f')]&&_0x462dd3[_0x88da('0x3b')]&&_0x462dd3[_0x88da('0x38')]){_0x3f5274[_0x462dd3[_0x88da('0x3f')]]&&_0xe0499c[_0x88da('0x3c')][_0x88da('0x3d')]({'id':_0x462dd3[_0x88da('0x3b')],'value':_0x3f5274[_0x462dd3[_0x88da('0x3f')]][_0x88da('0x2c')]()});}else if(_0x462dd3[_0x88da('0x36')]===_0x88da('0x40')&&_0x462dd3['Variable']&&_0x462dd3[_0x88da('0x41')][_0x88da('0x15')]&&_0x462dd3[_0x88da('0x3b')]&&_0x462dd3[_0x88da('0x38')]){_0x3f5274[_0x462dd3[_0x88da('0x41')][_0x88da('0x15')][_0x88da('0x39')]()]&&_0xe0499c['custom_fields'][_0x88da('0x3d')]({'id':_0x462dd3[_0x88da('0x3b')],'value':_0x3f5274[_0x462dd3[_0x88da('0x41')][_0x88da('0x15')][_0x88da('0x39')]()][_0x88da('0x2c')]()});}});}return _0xe0499c;}exports[_0x88da('0x42')]=function(_0x412473,_0x498df3,_0x512210,_0xe2d051,_0x13e50f,_0x155506){var _0xb49bcd,_0x47f6e5;_0x155506[_0x88da('0x19')]=intUtil['stripTrailingSlash'](_0x155506['remoteUri']);_0x155506[_0x88da('0x43')]=intUtil[_0x88da('0x44')](_0x155506['serverUrl']);if(_0x13e50f&&_0x13e50f[_0x88da('0x45')]){logger[_0x88da('0xb')](_0x88da('0x46'),_0x88da('0x47'));_0x498df3[_0x88da('0x48')]=util[_0x88da('0x17')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x155506[_0x88da('0x43')],_0x498df3[_0x88da('0x49')],md5(_0x498df3[_0x88da('0x49')]));}else{_0x498df3[_0x88da('0x48')]='';}headers[_0x88da('0x4a')]=getAuth(_0x155506);return getUser(_0x155506,_0xe2d051[_0x88da('0x21')])[_0x88da('0x1b')](function(_0x43d1a6){_0xb49bcd=_0x43d1a6;logger[_0x88da('0xb')](_0x88da('0x4b'),_0xb49bcd['id']);return getEndUser(_0x155506,_0x498df3['calleridname'],_0x498df3[_0x88da('0xf')]);})[_0x88da('0x1b')](function(_0x4f2e74){_0x47f6e5=_0x4f2e74;logger['info'](_0x88da('0x4c'),_0x47f6e5['id']);return getTicket(_0x155506,_0xb49bcd,_0x47f6e5,_0x512210,_0x498df3);})[_0x88da('0x1b')](function(_0x2e1828){if(_0x2e1828&&_0x2e1828['id']){logger['info'](_0x88da('0x1c'));logger[_0x88da('0xb')](_0x88da('0x4d'),_0x2e1828['id']);logger[_0x88da('0xb')](_0x88da('0x46'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x88da('0x17')]('user:%s',_0xe2d051[_0x88da('0x15')]),_0x88da('0x4e'),{'uri':util[_0x88da('0x17')](_0x88da('0x4f'),_0x155506[_0x88da('0x19')],_0x2e1828['id'])});}})['catch'](function(_0x3b7fe5){logger[_0x88da('0x50')](_0x88da('0x46'),JSON[_0x88da('0x51')](_0x3b7fe5));});};exports[_0x88da('0x52')]=function(_0xbc8583,_0x27ddb6,_0x38d285,_0x1f123a,_0x3c41bc,_0x48cfd2,_0x60dc67){var _0x7c5f86,_0x2025ec;_0x48cfd2[_0x88da('0x19')]=intUtil[_0x88da('0x44')](_0x48cfd2['remoteUri']);_0x48cfd2[_0x88da('0x43')]=intUtil[_0x88da('0x44')](_0x48cfd2['serverUrl']);if(_0x60dc67&&_0x60dc67[_0x88da('0x53')]&&_0x60dc67[_0x88da('0x53')]!==_0x88da('0x54')){logger[_0x88da('0xb')](_0x88da('0x55'),_0x88da('0x47'));_0x27ddb6[_0x88da('0x48')]=util[_0x88da('0x17')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x48cfd2['serverUrl'],_0x27ddb6[_0x88da('0x49')],md5(_0x27ddb6[_0x88da('0x49')]));}headers[_0x88da('0x4a')]=getAuth(_0x48cfd2);return getUser(_0x48cfd2,_0x1f123a[_0x88da('0x21')])[_0x88da('0x1b')](function(_0x21f11b){_0x7c5f86=_0x21f11b;logger[_0x88da('0xb')]('The\x20User\x20ID\x20is:',_0x7c5f86['id']);return getEndUser(_0x48cfd2,_0x27ddb6['destcalleridname'],_0x27ddb6[_0x88da('0x56')]);})[_0x88da('0x1b')](function(_0x569f6b){_0x2025ec=_0x569f6b;logger[_0x88da('0xb')](_0x88da('0x4c'),_0x2025ec['id']);return getTicket(_0x48cfd2,_0x7c5f86,_0x2025ec,_0x38d285,_0x27ddb6);})[_0x88da('0x1b')](function(_0x80cc8){if(_0x80cc8&&_0x80cc8['id']){logger[_0x88da('0xb')]('Ticket\x20created!');logger[_0x88da('0xb')](_0x88da('0x4d'),_0x80cc8['id']);logger[_0x88da('0xb')](_0x88da('0x55'),_0x88da('0x57'));emit(util[_0x88da('0x17')](_0x88da('0x58'),_0x1f123a[_0x88da('0x15')]),_0x88da('0x4e'),{'uri':util[_0x88da('0x17')](_0x88da('0x4f'),_0x48cfd2[_0x88da('0x19')],_0x80cc8['id'])});}})[_0x88da('0x59')](function(_0x10a1a0){logger['error'](_0x88da('0x55'),JSON['stringify'](_0x10a1a0));});};exports['unmanaged']=function(_0x994455,_0x42bc41,_0x1bd456,_0x15d48f,_0x133432,_0x5b6695){var _0x338b98,_0x3e2695;_0x5b6695[_0x88da('0x19')]=intUtil[_0x88da('0x44')](_0x5b6695[_0x88da('0x19')]);_0x5b6695[_0x88da('0x43')]=intUtil[_0x88da('0x44')](_0x5b6695[_0x88da('0x43')]);if(_0x133432&&_0x133432[_0x88da('0x45')]){logger[_0x88da('0xb')]('['+_0x42bc41['lastevent'][_0x88da('0x5a')]()+']',_0x88da('0x47'));_0x42bc41[_0x88da('0x48')]=util['format'](_0x88da('0x5b'),_0x5b6695[_0x88da('0x43')],_0x42bc41[_0x88da('0x49')],md5(_0x42bc41[_0x88da('0x49')]));}else{_0x42bc41['recordingURL']='';}headers[_0x88da('0x4a')]=getAuth(_0x5b6695);return getUser(_0x5b6695,'')[_0x88da('0x1b')](function(_0x1589b1){_0x338b98=_0x1589b1;logger['info'](_0x88da('0x4b'),_0x338b98['id']);return getEndUser(_0x5b6695,_0x42bc41[_0x88da('0xe')],_0x42bc41[_0x88da('0xf')]);})[_0x88da('0x1b')](function(_0x5c0b95){_0x3e2695=_0x5c0b95;logger[_0x88da('0xb')](_0x88da('0x4c'),_0x3e2695['id']);return getTicket(_0x5b6695,_0x338b98,_0x3e2695,_0x1bd456,_0x42bc41);})[_0x88da('0x1b')](function(_0x40a9ec){if(_0x40a9ec){logger[_0x88da('0xb')](_0x88da('0x1c'));logger[_0x88da('0xb')]('The\x20Ticket\x20ID\x20is:',_0x40a9ec['id']);}})['catch'](function(_0x5cc761){logger[_0x88da('0x50')]('['+_0x42bc41[_0x88da('0x5c')][_0x88da('0x5a')]()+']',JSON[_0x88da('0x51')](_0x5cc761));});}; \ 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 afb72fa..78e0ac6 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 _0x8090=['moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','GET','/api/selector/owners','headers','info','users','length','email','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','then','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','Admin\x20selected','/api/lookup?q=','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','work_number','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','/api/tasks','getString','Subjects','Descriptions','ticketId','task','Task\x20created:','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util'];(function(_0x33ba78,_0xbcaa2d){var _0x24a8a8=function(_0x2c25f5){while(--_0x2c25f5){_0x33ba78['push'](_0x33ba78['shift']());}};_0x24a8a8(++_0xbcaa2d);}(_0x8090,0x1ee));var _0x0809=function(_0x2c658a,_0x18d39e){_0x2c658a=_0x2c658a-0x0;var _0x26806e=_0x8090[_0x2c658a];return _0x26806e;};'use strict';var _=require(_0x0809('0x0'));var rp=require(_0x0809('0x1'));var md5=require(_0x0809('0x2'));var util=require(_0x0809('0x3'));var moment=require(_0x0809('0x4'));var Promise=require(_0x0809('0x5'));var Redis=require(_0x0809('0x6'));var intUtil=require(_0x0809('0x7'));var config=require(_0x0809('0x8'));var logger=require(_0x0809('0x9'))('freshsales');config[_0x0809('0xa')]=_['defaults'](config[_0x0809('0xa')],{'host':_0x0809('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0809('0xa')]));function getAdminId(_0x477097,_0x1f64af,_0x50b164,_0x5a7be9){return new Promise(function(_0x4b592e,_0x526cea){var _0x23cf75=![];var _0x56808c={'method':_0x0809('0xc'),'uri':_0x5a7be9+_0x0809('0xd'),'json':!![]};_0x56808c[_0x0809('0xe')]=_0x50b164;logger[_0x0809('0xf')]('Getting\x20admin\x20information');return rp(_0x56808c)['then'](function(_0x3b7c41){if(_0x3b7c41){var _0x294601=_0x3b7c41[_0x0809('0x10')];var _0x3b1539=null;for(_0x3b1539=0x0;_0x3b1539<_0x294601[_0x0809('0x11')];_0x3b1539++){if(_0x294601[_0x3b1539][_0x0809('0x12')]===_0x477097[_0x0809('0x13')]){_0x477097['adminId']=_0x294601[_0x3b1539]['id'];_0x23cf75=!![];}}if(_0x23cf75){logger[_0x0809('0xf')](_0x0809('0x14'),_0x477097[_0x0809('0x15')]);_0x4b592e(_0x477097);}else{_0x526cea({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x526cea({'statusCode':0x194,'message':_0x0809('0x16')});}})[_0x0809('0x17')](function(_0x2f59b0){logger[_0x0809('0x18')]('['+[_0x1f64af[_0x0809('0x19')]()]+']',_0x2f59b0[_0x0809('0x1a')]);_0x526cea(_0x2f59b0);});});}function getUser(_0x544a83,_0x3585f4,_0x408f3d){return function(_0x577eed){return new Promise(function(_0x59b430,_0x20dc6d){var _0x4bbcde={'method':_0x0809('0xc'),'uri':_0x408f3d+'/api/selector/owners','json':!![]};_0x4bbcde[_0x0809('0xe')]=_0x3585f4;logger[_0x0809('0xf')](_0x0809('0x1b'));return rp(_0x4bbcde)[_0x0809('0x1c')](function(_0x137371){if(_0x137371){var _0x471087=_0x137371[_0x0809('0x10')];var _0x430c02=![];var _0x1d9cc6=null;if(_0x577eed['agentEmail']!==null){logger[_0x0809('0xf')](_0x0809('0x1d'),_0x577eed[_0x0809('0x1e')]);_0x577eed[_0x0809('0x1f')]=_0x577eed[_0x0809('0x1e')];for(_0x1d9cc6=0x0;_0x1d9cc6<_0x471087[_0x0809('0x11')];_0x1d9cc6++){if(_0x471087[_0x1d9cc6][_0x0809('0x12')]===_0x577eed['agentEmail']){_0x430c02=!![];_0x577eed[_0x0809('0x20')]=_0x471087[_0x1d9cc6]['id'];logger['info']('User\x20found:',_0x577eed['userId']);}}}if(!_0x430c02){logger[_0x0809('0xf')](_0x0809('0x21'));_0x577eed['userEmail']=_0x577eed['adminEmail'];_0x577eed['userId']=_0x577eed[_0x0809('0x15')];_0x430c02=!![];}if(_0x430c02){_0x59b430(_0x577eed);}else{_0x20dc6d({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x20dc6d({'statusCode':0x194,'message':_0x0809('0x16')});}})['catch'](function(_0x4de04d){logger[_0x0809('0x18')]('['+[_0x544a83[_0x0809('0x19')]()]+']',_0x4de04d[_0x0809('0x1a')]);_0x20dc6d(_0x4de04d);});});};}function searchContact(_0x5ef8d8,_0x5cec94,_0x10d014,_0x4dcb04){return new Promise(function(_0x38b3ec,_0x44aa56){var _0x2c0d3d={'method':_0x0809('0xc'),'headers':_0x5cec94,'uri':_0x5ef8d8+_0x0809('0x22')+_0x4dcb04+_0x0809('0x23')+_0x10d014+_0x0809('0x24'),'json':!![]};rp(_0x2c0d3d)[_0x0809('0x1c')](function(_0xe129a5){var _0x3993e7=_[_0x0809('0x25')](_0xe129a5[_0x0809('0x26')]['contacts'],[_0x10d014,_0x4dcb04]);_0x38b3ec(_0x3993e7);})[_0x0809('0x17')](function(_0x543be5){_0x44aa56(_0x543be5);});});}function getEndUser(_0x28e9d2,_0x4ea86,_0x3324c3){return function(_0x44b6a1){return new Promise(function(_0x963b7c,_0x3fe577){logger[_0x0809('0xf')](util['format'](_0x0809('0x27'),_0x44b6a1['contactNumber']));searchContact(_0x3324c3,_0x4ea86,'mobile_number',_0x44b6a1[_0x0809('0x28')])[_0x0809('0x1c')](function(_0x41dcf4){if(_0x41dcf4){_0x44b6a1['endUserId']=_0x41dcf4['id'];logger['info']('Contact\x20found\x20mobile_number:',_0x44b6a1['endUserId']);return _0x963b7c(_0x44b6a1);}searchContact(_0x3324c3,_0x4ea86,_0x0809('0x29'),_0x44b6a1[_0x0809('0x28')])[_0x0809('0x1c')](function(_0x56576d){if(_0x56576d){_0x44b6a1[_0x0809('0x2a')]=_0x56576d['id'];logger[_0x0809('0xf')](_0x0809('0x2b'),_0x44b6a1[_0x0809('0x2a')]);return _0x963b7c(_0x44b6a1);}createEndUser(_0x44b6a1,_0x28e9d2,_0x4ea86,_0x3324c3)[_0x0809('0x1c')](function(_0x7f1022){logger[_0x0809('0xf')](_0x0809('0x2c'),_0x7f1022[_0x0809('0x2a')]);return _0x963b7c(_0x7f1022);});});})[_0x0809('0x17')](function(_0x48ede7){_0x3fe577(_0x48ede7);});});};}function createEndUser(_0x137db3,_0x4beb43,_0x2ddfaa,_0x4065c1){return new Promise(function(_0x22ecdc,_0xa39d7e){var _0x256f9c=moment();var _0x2a2473={'method':_0x0809('0x2d'),'uri':_0x4065c1+_0x0809('0x2e'),'body':{'contact':{'last_name':_0x137db3[_0x0809('0x28')],'work_number':_0x137db3['contactNumber'],'mobile_number':_0x137db3[_0x0809('0x28')],'owner_id':_0x137db3['userId'],'created_at':_0x256f9c[_0x0809('0x2f')](_0x0809('0x30'))}},'json':!![]};_0x2a2473[_0x0809('0xe')]=_0x2ddfaa;logger[_0x0809('0xf')](_0x0809('0x31'));return rp(_0x2a2473)[_0x0809('0x1c')](function(_0x332e32){_0x137db3[_0x0809('0x2a')]=_0x332e32['contact']['id'];_0x22ecdc(_0x137db3);})[_0x0809('0x17')](function(_0x35d599){logger[_0x0809('0x18')]('['+[_0x4beb43[_0x0809('0x19')]()]+']',_0x35d599[_0x0809('0x1a')]);_0xa39d7e(_0x35d599['message']);});});}function getTicket(_0x179db7,_0x42c5a1,_0x1f77a3,_0x40317a,_0x528921){return function(_0x25c7ef){logger[_0x0809('0xf')]('Creating\x20new\x20task');return new Promise(function(_0xc6f11c,_0x5cc240){var _0x5c10ff=moment();var _0x2b5277={'method':_0x0809('0x2d'),'uri':_0x1f77a3+_0x0809('0x32'),'body':{'title':intUtil[_0x0809('0x33')](_0x40317a[_0x0809('0x34')],_0x528921,'\x20'),'description':intUtil[_0x0809('0x33')](_0x40317a[_0x0809('0x35')],_0x528921,'\x0a'),'owner_id':_0x25c7ef[_0x0809('0x20')],'creater_id':_0x25c7ef['adminId'],'targetable_id':_0x25c7ef[_0x0809('0x2a')],'targetable_type':'Contact','created_at':_0x5c10ff[_0x0809('0x2f')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x5c10ff['add'](0x1e,'m')[_0x0809('0x2f')](_0x0809('0x30'))},'json':!![]};_0x2b5277[_0x0809('0xe')]=_0x42c5a1;return rp(_0x2b5277)[_0x0809('0x1c')](function(_0x4c3558){_0x25c7ef[_0x0809('0x36')]=_0x4c3558[_0x0809('0x37')]['id'];logger['info'](_0x0809('0x38'),_0x25c7ef[_0x0809('0x36')]);_0xc6f11c(_0x25c7ef);})['catch'](function(_0x5a56ba){logger['error']('['+[_0x179db7['toUpperCase']()]+']',_0x5a56ba[_0x0809('0x1a')]);_0x5cc240(_0x5a56ba[_0x0809('0x1a')]);});});};}function emit(_0x1d5c06,_0x3f9d2e,_0x55b8c2){var _0x562801={'uri':_0x1d5c06+_0x0809('0x39')+_0x55b8c2};io['to'](util[_0x0809('0x2f')](_0x0809('0x3a'),_0x3f9d2e))['emit'](_0x0809('0x3b'),_0x562801);}exports['cs']=function(_0x688fe,_0x252068,_0x4dff83,_0x2dd5e2,_0x36f5fb,_0x36c776,_0x5293c2,_0x56ad7a){var _0x2a47d9={};var _0x47f350={'Authorization':_0x0809('0x3c')+_0x36c776[_0x0809('0x3d')]};_0x36c776[_0x0809('0x3e')]=intUtil['stripTrailingSlash'](_0x36c776[_0x0809('0x3e')]);_0x36c776[_0x0809('0x3f')]=intUtil['stripTrailingSlash'](_0x36c776[_0x0809('0x3f')]);var _0x2a52d8=_0x36c776['remoteUri'];_0x2a47d9['adminEmail']=_0x36c776[_0x0809('0x40')];_0x2a47d9[_0x0809('0x28')]=_0x56ad7a[_0x0809('0x41')]()===_0x0809('0x42')?_0x252068[_0x0809('0x43')]:_0x252068[_0x0809('0x44')];_0x2a47d9['callDirection']=_0x56ad7a===_0x0809('0x45')||_0x56ad7a===_0x0809('0x46')?_0x0809('0x45'):'outbound';if(_0x2dd5e2){_0x2a47d9['agentEmail']=_0x2dd5e2[_0x0809('0x12')];}var _0x3e3eb0=util[_0x0809('0x2f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x36c776[_0x0809('0x3f')],_0x252068[_0x0809('0x47')],md5(_0x252068[_0x0809('0x47')]));if(_0x36f5fb&&_0x36f5fb[_0x0809('0x48')]){logger['info'](_0x0809('0x49'),_0x0809('0x4a'));_0x252068[_0x0809('0x4b')]=_0x3e3eb0;}else if(_0x5293c2&&_0x5293c2[_0x0809('0x4c')]&&_0x5293c2['recordingFormat']!==_0x0809('0x4d')){logger[_0x0809('0xf')](_0x0809('0x4e'),_0x0809('0x4a'));_0x252068[_0x0809('0x4b')]=_0x3e3eb0;}else{_0x252068[_0x0809('0x4b')]='';}return getAdminId(_0x2a47d9,_0x56ad7a,_0x47f350,_0x2a52d8)[_0x0809('0x1c')](getUser(_0x56ad7a,_0x47f350,_0x2a52d8))[_0x0809('0x1c')](getEndUser(_0x56ad7a,_0x47f350,_0x2a52d8))[_0x0809('0x1c')](getTicket(_0x56ad7a,_0x47f350,_0x2a52d8,_0x4dff83,_0x252068))[_0x0809('0x1c')](function(_0x5690b3){logger[_0x0809('0xf')](util[_0x0809('0x2f')](_0x0809('0x4f'),_0x5690b3['ticketId']));if(_0x56ad7a!==_0x0809('0x46')){logger[_0x0809('0xf')]('['+[_0x56ad7a['toUpperCase']()]+']',_0x0809('0x50'));emit(_0x2a52d8,_0x2dd5e2['name'],_0x5690b3[_0x0809('0x2a')]);}})[_0x0809('0x17')](function(_0x72934b){logger[_0x0809('0x18')]('['+[_0x56ad7a[_0x0809('0x19')]()]+_0x0809('0x51'),util[_0x0809('0x52')](_0x72934b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8d47=['catch','error','toUpperCase','message','GET','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','Admin\x20selected','adminEmail','/api/lookup?q=','&f=','&entities=contact','then','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','email','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','headers','Getting\x20admin\x20information','users','length','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found'];(function(_0x13b9bf,_0x207232){var _0x140878=function(_0x37ea6d){while(--_0x37ea6d){_0x13b9bf['push'](_0x13b9bf['shift']());}};_0x140878(++_0x207232);}(_0x8d47,0xf7));var _0x78d4=function(_0xef49f,_0x25b3de){_0xef49f=_0xef49f-0x0;var _0x2fd25b=_0x8d47[_0xef49f];return _0x2fd25b;};'use strict';var _=require(_0x78d4('0x0'));var rp=require(_0x78d4('0x1'));var md5=require(_0x78d4('0x2'));var util=require(_0x78d4('0x3'));var moment=require(_0x78d4('0x4'));var Promise=require(_0x78d4('0x5'));var Redis=require(_0x78d4('0x6'));var intUtil=require(_0x78d4('0x7'));var config=require(_0x78d4('0x8'));var logger=require(_0x78d4('0x9'))('freshsales');config[_0x78d4('0xa')]=_[_0x78d4('0xb')](config[_0x78d4('0xa')],{'host':_0x78d4('0xc'),'port':0x18eb});var io=require(_0x78d4('0xd'))(new Redis(config[_0x78d4('0xa')]));function getAdminId(_0x3eebdc,_0x348a4,_0x3edd35,_0x56c124){return new Promise(function(_0x2d248f,_0x1056c7){var _0xdfc36f=![];var _0x3c3ece={'method':'GET','uri':_0x56c124+_0x78d4('0xe'),'json':!![]};_0x3c3ece[_0x78d4('0xf')]=_0x3edd35;logger['info'](_0x78d4('0x10'));return rp(_0x3c3ece)['then'](function(_0x4ea150){if(_0x4ea150){var _0x320198=_0x4ea150[_0x78d4('0x11')];var _0x5ddb25=null;for(_0x5ddb25=0x0;_0x5ddb25<_0x320198[_0x78d4('0x12')];_0x5ddb25++){if(_0x320198[_0x5ddb25]['email']===_0x3eebdc['adminEmail']){_0x3eebdc[_0x78d4('0x13')]=_0x320198[_0x5ddb25]['id'];_0xdfc36f=!![];}}if(_0xdfc36f){logger[_0x78d4('0x14')](_0x78d4('0x15'),_0x3eebdc[_0x78d4('0x13')]);_0x2d248f(_0x3eebdc);}else{_0x1056c7({'statusCode':0x194,'message':_0x78d4('0x16')});}}else{_0x1056c7({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x78d4('0x17')](function(_0x3d95af){logger[_0x78d4('0x18')]('['+[_0x348a4[_0x78d4('0x19')]()]+']',_0x3d95af[_0x78d4('0x1a')]);_0x1056c7(_0x3d95af);});});}function getUser(_0x31dd53,_0x36196b,_0x22ecca){return function(_0x579df5){return new Promise(function(_0x173eff,_0x1e2f29){var _0x42c042={'method':_0x78d4('0x1b'),'uri':_0x22ecca+_0x78d4('0xe'),'json':!![]};_0x42c042[_0x78d4('0xf')]=_0x36196b;logger[_0x78d4('0x14')](_0x78d4('0x1c'));return rp(_0x42c042)['then'](function(_0x368c11){if(_0x368c11){var _0x2660da=_0x368c11[_0x78d4('0x11')];var _0x459552=![];var _0x5ebde7=null;if(_0x579df5[_0x78d4('0x1d')]!==null){logger['info'](_0x78d4('0x1e'),_0x579df5[_0x78d4('0x1d')]);_0x579df5[_0x78d4('0x1f')]=_0x579df5[_0x78d4('0x1d')];for(_0x5ebde7=0x0;_0x5ebde7<_0x2660da[_0x78d4('0x12')];_0x5ebde7++){if(_0x2660da[_0x5ebde7]['email']===_0x579df5['agentEmail']){_0x459552=!![];_0x579df5[_0x78d4('0x20')]=_0x2660da[_0x5ebde7]['id'];logger[_0x78d4('0x14')]('User\x20found:',_0x579df5[_0x78d4('0x20')]);}}}if(!_0x459552){logger[_0x78d4('0x14')](_0x78d4('0x21'));_0x579df5['userEmail']=_0x579df5[_0x78d4('0x22')];_0x579df5['userId']=_0x579df5[_0x78d4('0x13')];_0x459552=!![];}if(_0x459552){_0x173eff(_0x579df5);}else{_0x1e2f29({'statusCode':0x194,'message':_0x78d4('0x16')});}}else{_0x1e2f29({'statusCode':0x194,'message':_0x78d4('0x16')});}})[_0x78d4('0x17')](function(_0x513e01){logger['error']('['+[_0x31dd53[_0x78d4('0x19')]()]+']',_0x513e01[_0x78d4('0x1a')]);_0x1e2f29(_0x513e01);});});};}function searchContact(_0x12216b,_0xbf71a0,_0x4f9e34,_0x15d2d5){return new Promise(function(_0x197324,_0x3400e8){var _0x78a5ce={'method':'GET','headers':_0xbf71a0,'uri':_0x12216b+_0x78d4('0x23')+_0x15d2d5+_0x78d4('0x24')+_0x4f9e34+_0x78d4('0x25'),'json':!![]};rp(_0x78a5ce)[_0x78d4('0x26')](function(_0x383d77){var _0x1ad434=_[_0x78d4('0x27')](_0x383d77[_0x78d4('0x28')][_0x78d4('0x28')],[_0x4f9e34,_0x15d2d5]);_0x197324(_0x1ad434);})[_0x78d4('0x17')](function(_0x4df410){_0x3400e8(_0x4df410);});});}function getEndUser(_0x694c5d,_0x1020b1,_0x18613e){return function(_0x58ac52){return new Promise(function(_0x271fd6,_0x5a8f2a){logger[_0x78d4('0x14')](util[_0x78d4('0x29')](_0x78d4('0x2a'),_0x58ac52[_0x78d4('0x2b')]));searchContact(_0x18613e,_0x1020b1,'mobile_number',_0x58ac52['contactNumber'])[_0x78d4('0x26')](function(_0x45642d){if(_0x45642d){_0x58ac52[_0x78d4('0x2c')]=_0x45642d['id'];logger['info'](_0x78d4('0x2d'),_0x58ac52[_0x78d4('0x2c')]);return _0x271fd6(_0x58ac52);}searchContact(_0x18613e,_0x1020b1,'work_number',_0x58ac52[_0x78d4('0x2b')])[_0x78d4('0x26')](function(_0x2970eb){if(_0x2970eb){_0x58ac52[_0x78d4('0x2c')]=_0x2970eb['id'];logger[_0x78d4('0x14')](_0x78d4('0x2e'),_0x58ac52[_0x78d4('0x2c')]);return _0x271fd6(_0x58ac52);}createEndUser(_0x58ac52,_0x694c5d,_0x1020b1,_0x18613e)[_0x78d4('0x26')](function(_0x5830c2){logger[_0x78d4('0x14')](_0x78d4('0x2f'),_0x5830c2[_0x78d4('0x2c')]);return _0x271fd6(_0x5830c2);});});})[_0x78d4('0x17')](function(_0x240352){_0x5a8f2a(_0x240352);});});};}function createEndUser(_0x110179,_0x199ee2,_0x282f86,_0x425d39){return new Promise(function(_0x329997,_0x5a89e0){var _0x5138fa=moment();var _0x4120e3={'method':_0x78d4('0x30'),'uri':_0x425d39+'/api/contacts','body':{'contact':{'last_name':_0x110179[_0x78d4('0x2b')],'work_number':_0x110179[_0x78d4('0x2b')],'mobile_number':_0x110179[_0x78d4('0x2b')],'owner_id':_0x110179[_0x78d4('0x20')],'created_at':_0x5138fa[_0x78d4('0x29')](_0x78d4('0x31'))}},'json':!![]};_0x4120e3[_0x78d4('0xf')]=_0x282f86;logger[_0x78d4('0x14')](_0x78d4('0x32'));return rp(_0x4120e3)[_0x78d4('0x26')](function(_0x13b3d3){_0x110179['endUserId']=_0x13b3d3[_0x78d4('0x33')]['id'];_0x329997(_0x110179);})[_0x78d4('0x17')](function(_0x409f11){logger[_0x78d4('0x18')]('['+[_0x199ee2['toUpperCase']()]+']',_0x409f11['message']);_0x5a89e0(_0x409f11[_0x78d4('0x1a')]);});});}function getTicket(_0x311806,_0x8c18d9,_0x3a98b1,_0xca7c59,_0x2a092c){return function(_0x2dc36e){logger[_0x78d4('0x14')](_0x78d4('0x34'));return new Promise(function(_0x3ea8ef,_0x5c3b34){var _0x5433b8=moment();var _0x3c5e63={'method':'POST','uri':_0x3a98b1+_0x78d4('0x35'),'body':{'title':intUtil['getString'](_0xca7c59[_0x78d4('0x36')],_0x2a092c,'\x20'),'description':intUtil[_0x78d4('0x37')](_0xca7c59[_0x78d4('0x38')],_0x2a092c,'\x0a'),'owner_id':_0x2dc36e['userId'],'creater_id':_0x2dc36e['adminId'],'targetable_id':_0x2dc36e[_0x78d4('0x2c')],'targetable_type':_0x78d4('0x39'),'created_at':_0x5433b8[_0x78d4('0x29')](_0x78d4('0x31')),'due_date':_0x5433b8[_0x78d4('0x3a')](0x1e,'m')[_0x78d4('0x29')](_0x78d4('0x31'))},'json':!![]};_0x3c5e63[_0x78d4('0xf')]=_0x8c18d9;return rp(_0x3c5e63)['then'](function(_0xc338c7){_0x2dc36e[_0x78d4('0x3b')]=_0xc338c7[_0x78d4('0x3c')]['id'];logger[_0x78d4('0x14')](_0x78d4('0x3d'),_0x2dc36e[_0x78d4('0x3b')]);_0x3ea8ef(_0x2dc36e);})['catch'](function(_0x3c4833){logger['error']('['+[_0x311806[_0x78d4('0x19')]()]+']',_0x3c4833[_0x78d4('0x1a')]);_0x5c3b34(_0x3c4833['message']);});});};}function emit(_0x21b700,_0x207c6d,_0x33782f){var _0x24e3bc={'uri':_0x21b700+_0x78d4('0x3e')+_0x33782f};io['to'](util[_0x78d4('0x29')](_0x78d4('0x3f'),_0x207c6d))[_0x78d4('0x40')]('trigger:browser:url',_0x24e3bc);}exports['cs']=function(_0x4d302f,_0x572f6a,_0x15653f,_0x28f80b,_0x39d95d,_0x4e1089,_0x1c3d0b,_0x22db16){var _0x3005fc={};var _0x429743={'Authorization':'Token\x20token='+_0x4e1089[_0x78d4('0x41')]};_0x4e1089[_0x78d4('0x42')]=intUtil['stripTrailingSlash'](_0x4e1089['remoteUri']);_0x4e1089[_0x78d4('0x43')]=intUtil[_0x78d4('0x44')](_0x4e1089[_0x78d4('0x43')]);var _0x2f47a5=_0x4e1089['remoteUri'];_0x3005fc[_0x78d4('0x22')]=_0x4e1089[_0x78d4('0x45')];_0x3005fc['contactNumber']=_0x22db16['toLowerCase']()===_0x78d4('0x46')?_0x572f6a[_0x78d4('0x47')]:_0x572f6a[_0x78d4('0x48')];_0x3005fc[_0x78d4('0x49')]=_0x22db16===_0x78d4('0x4a')||_0x22db16===_0x78d4('0x4b')?_0x78d4('0x4a'):'outbound';if(_0x28f80b){_0x3005fc['agentEmail']=_0x28f80b[_0x78d4('0x4c')];}var _0x1f15b9=util[_0x78d4('0x29')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4e1089[_0x78d4('0x43')],_0x572f6a['uniqueid'],md5(_0x572f6a[_0x78d4('0x4d')]));if(_0x39d95d&&_0x39d95d[_0x78d4('0x4e')]){logger[_0x78d4('0x14')](_0x78d4('0x4f'),_0x78d4('0x50'));_0x572f6a[_0x78d4('0x51')]=_0x1f15b9;}else if(_0x1c3d0b&&_0x1c3d0b[_0x78d4('0x52')]&&_0x1c3d0b['recordingFormat']!==_0x78d4('0x53')){logger['info'](_0x78d4('0x54'),'Recording\x20is\x20enabled!');_0x572f6a[_0x78d4('0x51')]=_0x1f15b9;}else{_0x572f6a[_0x78d4('0x51')]='';}return getAdminId(_0x3005fc,_0x22db16,_0x429743,_0x2f47a5)[_0x78d4('0x26')](getUser(_0x22db16,_0x429743,_0x2f47a5))[_0x78d4('0x26')](getEndUser(_0x22db16,_0x429743,_0x2f47a5))['then'](getTicket(_0x22db16,_0x429743,_0x2f47a5,_0x15653f,_0x572f6a))[_0x78d4('0x26')](function(_0x572e91){logger['info'](util[_0x78d4('0x29')](_0x78d4('0x55'),_0x572e91['ticketId']));if(_0x22db16!==_0x78d4('0x4b')){logger['info']('['+[_0x22db16[_0x78d4('0x19')]()]+']',_0x78d4('0x56'));emit(_0x2f47a5,_0x28f80b[_0x78d4('0x57')],_0x572e91[_0x78d4('0x2c')]);}})['catch'](function(_0xe46fdf){logger['error']('['+[_0x22db16['toUpperCase']()]+_0x78d4('0x58'),util[_0x78d4('0x59')](_0xe46fdf,{'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 aa2a2bf..6dd90ed 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 _0x61f6=['toLowerCase','zoho','unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','util','./salesforce','./freshdesk','./desk','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','sugarcrm','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','data2','find','Configurations','data3','queue','routeId','outbound','log','unmanaged'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x61f6,0x171));var _0x661f=function(_0x44b3bd,_0x44c97d){_0x44b3bd=_0x44b3bd-0x0;var _0x1efc4a=_0x61f6[_0x44b3bd];return _0x1efc4a;};'use strict';var _=require('lodash');var util=require(_0x661f('0x0'));var zendesk=require('./zendesk');var salesforce=require(_0x661f('0x1'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x661f('0x2'));var zoho=require('./zoho');var desk=require(_0x661f('0x3'));var vtiger=require(_0x661f('0x4'));var servicenow=require(_0x661f('0x5'));var dynamics365=require(_0x661f('0x6'));var freshsales=require('./freshsales');var integrations=[_0x661f('0x7'),_0x661f('0x8'),_0x661f('0x9'),'freshdesk','zoho',_0x661f('0xa'),_0x661f('0xb'),_0x661f('0xc'),_0x661f('0xd'),_0x661f('0xe')];exports[_0x661f('0xf')]=function(_0x2d766c,_0x57fb8c,_0x2a48d2,_0x27c8ba,_0x56ccaa,_0x532a02){if(_0x2a48d2){if(_[_0x661f('0x10')](integrations,_0x2d766c[_0x661f('0x11')]['toLowerCase']())){try{var _0xff7a9f=null;var _0x26b1b8='';var _0x99600c=_0x2a48d2[_0x2d766c['data1']['toLowerCase']()];if(_0x99600c){var _0x1bac39=_0x99600c[_0x2d766c[_0x661f('0x12')]];if(_0x1bac39){var _0x434c66=_[_0x661f('0x13')](_0x1bac39[_0x661f('0x14')],{'id':parseInt(_0x2d766c[_0x661f('0x15')],0xa)});if(_0x434c66){if(_0x27c8ba){if(_0x56ccaa&&_0x57fb8c[_0x661f('0x16')]){_0x26b1b8=_0x661f('0x16');}else if(_0x57fb8c[_0x661f('0x17')]){_0x26b1b8=_0x661f('0x18');}else{console[_0x661f('0x19')]('EVENT\x20UNKNOWN',_0x57fb8c);}}else{_0x26b1b8=_0x661f('0x1a');}switch(_0x2d766c[_0x661f('0x11')][_0x661f('0x1b')]()){case'zendesk':zendesk[_0x26b1b8](_0x2d766c,_0x57fb8c,_0x434c66,_0x27c8ba,_0x56ccaa,_0x1bac39,_0x532a02);break;case'salesforce':salesforce[_0x26b1b8](_0x2d766c,_0x57fb8c,_0x434c66,_0x27c8ba,_0x56ccaa,_0x1bac39,_0x532a02);break;case _0x661f('0x9'):sugarcrm[_0x26b1b8](_0x2d766c,_0x57fb8c,_0x434c66,_0x27c8ba,_0x56ccaa,_0x1bac39,_0x532a02);break;case'freshdesk':freshdesk[_0x26b1b8](_0x2d766c,_0x57fb8c,_0x434c66,_0x27c8ba,_0x56ccaa,_0x1bac39,_0x532a02);break;case _0x661f('0x1c'):zoho[_0x26b1b8](_0x2d766c,_0x57fb8c,_0x434c66,_0x27c8ba,_0x56ccaa,_0x1bac39,_0x532a02);break;case'desk':desk[_0x26b1b8](_0x2d766c,_0x57fb8c,_0x434c66,_0x27c8ba,_0x56ccaa,_0x1bac39,_0x532a02);break;case'vtiger':vtiger[_0x26b1b8](_0x2d766c,_0x57fb8c,_0x434c66,_0x27c8ba,_0x56ccaa,_0x1bac39,_0x532a02);break;case _0x661f('0xd'):freshsales['cs'](_0x2d766c,_0x57fb8c,_0x434c66,_0x27c8ba,_0x56ccaa,_0x1bac39,_0x532a02,_0x26b1b8);break;case'servicenow':servicenow['cs'](_0x2d766c,_0x57fb8c,_0x434c66,_0x27c8ba,_0x56ccaa,_0x1bac39,_0x532a02,_0x26b1b8);break;case _0x661f('0xc'):dynamics365['cs'](_0x2d766c,_0x57fb8c,_0x434c66,_0x27c8ba,_0x56ccaa,_0x1bac39,_0x532a02,_0x26b1b8);break;default:console[_0x661f('0x19')](_0x661f('0x1d'));}}else{_0xff7a9f=require('../../../../config/logger')(_0x2d766c[_0x661f('0x11')]['toLowerCase']());_0xff7a9f[_0x661f('0x1e')](_0x661f('0x1f'),util[_0x661f('0x20')](_0x661f('0x21'),_0x2d766c['data1'][_0x661f('0x1b')](),_0x2d766c[_0x661f('0x15')]));}}else{_0xff7a9f=require(_0x661f('0x22'))(_0x2d766c[_0x661f('0x11')][_0x661f('0x1b')]());_0xff7a9f['error'](_0x661f('0x1f'),util[_0x661f('0x20')](_0x661f('0x23'),_0x2d766c[_0x661f('0x11')][_0x661f('0x1b')](),_0x2d766c['data2']));}}else{}}catch(_0x488d02){console[_0x661f('0x1e')](_0x488d02);}}}}; \ No newline at end of file +var _0xc13e=['desk','dynamics365','freshsales','servicenow','exec','includes','data1','data2','find','Configurations','data3','queue','outbound','EVENT\x20UNKNOWN','unmanaged','salesforce','zoho','log','../../../../config/logger','toLowerCase','format','%s\x20configuration\x20#%s\x20not\x20found','error','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','./freshsales','zendesk'];(function(_0x3d6907,_0x2f08fb){var _0x2ab3aa=function(_0x5f2f01){while(--_0x5f2f01){_0x3d6907['push'](_0x3d6907['shift']());}};_0x2ab3aa(++_0x2f08fb);}(_0xc13e,0x12f));var _0xec13=function(_0x2f1915,_0x3d0520){_0x2f1915=_0x2f1915-0x0;var _0x1022c0=_0xc13e[_0x2f1915];return _0x1022c0;};'use strict';var _=require(_0xec13('0x0'));var util=require(_0xec13('0x1'));var zendesk=require(_0xec13('0x2'));var salesforce=require(_0xec13('0x3'));var sugarcrm=require(_0xec13('0x4'));var freshdesk=require(_0xec13('0x5'));var zoho=require(_0xec13('0x6'));var desk=require(_0xec13('0x7'));var vtiger=require(_0xec13('0x8'));var servicenow=require('./servicenow');var dynamics365=require(_0xec13('0x9'));var freshsales=require(_0xec13('0xa'));var integrations=[_0xec13('0xb'),'salesforce','sugarcrm','freshdesk','zoho',_0xec13('0xc'),'vtiger',_0xec13('0xd'),_0xec13('0xe'),_0xec13('0xf')];exports[_0xec13('0x10')]=function(_0x3d229d,_0x50ada6,_0xfbac00,_0xf03119,_0xbc3acd,_0x3ad3a2){if(_0xfbac00){if(_[_0xec13('0x11')](integrations,_0x3d229d[_0xec13('0x12')]['toLowerCase']())){try{var _0x3b8ce1=null;var _0x2efac1='';var _0x5ad972=_0xfbac00[_0x3d229d[_0xec13('0x12')]['toLowerCase']()];if(_0x5ad972){var _0x37313c=_0x5ad972[_0x3d229d[_0xec13('0x13')]];if(_0x37313c){var _0x7ab568=_[_0xec13('0x14')](_0x37313c[_0xec13('0x15')],{'id':parseInt(_0x3d229d[_0xec13('0x16')],0xa)});if(_0x7ab568){if(_0xf03119){if(_0xbc3acd&&_0x50ada6[_0xec13('0x17')]){_0x2efac1=_0xec13('0x17');}else if(_0x50ada6['routeId']){_0x2efac1=_0xec13('0x18');}else{console['log'](_0xec13('0x19'),_0x50ada6);}}else{_0x2efac1=_0xec13('0x1a');}switch(_0x3d229d[_0xec13('0x12')]['toLowerCase']()){case _0xec13('0xb'):zendesk[_0x2efac1](_0x3d229d,_0x50ada6,_0x7ab568,_0xf03119,_0xbc3acd,_0x37313c,_0x3ad3a2);break;case _0xec13('0x1b'):salesforce[_0x2efac1](_0x3d229d,_0x50ada6,_0x7ab568,_0xf03119,_0xbc3acd,_0x37313c,_0x3ad3a2);break;case'sugarcrm':sugarcrm[_0x2efac1](_0x3d229d,_0x50ada6,_0x7ab568,_0xf03119,_0xbc3acd,_0x37313c,_0x3ad3a2);break;case'freshdesk':freshdesk[_0x2efac1](_0x3d229d,_0x50ada6,_0x7ab568,_0xf03119,_0xbc3acd,_0x37313c,_0x3ad3a2);break;case _0xec13('0x1c'):zoho[_0x2efac1](_0x3d229d,_0x50ada6,_0x7ab568,_0xf03119,_0xbc3acd,_0x37313c,_0x3ad3a2);break;case _0xec13('0xc'):desk[_0x2efac1](_0x3d229d,_0x50ada6,_0x7ab568,_0xf03119,_0xbc3acd,_0x37313c,_0x3ad3a2);break;case'vtiger':vtiger[_0x2efac1](_0x3d229d,_0x50ada6,_0x7ab568,_0xf03119,_0xbc3acd,_0x37313c,_0x3ad3a2);break;case _0xec13('0xe'):freshsales['cs'](_0x3d229d,_0x50ada6,_0x7ab568,_0xf03119,_0xbc3acd,_0x37313c,_0x3ad3a2,_0x2efac1);break;case _0xec13('0xf'):servicenow['cs'](_0x3d229d,_0x50ada6,_0x7ab568,_0xf03119,_0xbc3acd,_0x37313c,_0x3ad3a2,_0x2efac1);break;case _0xec13('0xd'):dynamics365['cs'](_0x3d229d,_0x50ada6,_0x7ab568,_0xf03119,_0xbc3acd,_0x37313c,_0x3ad3a2,_0x2efac1);break;default:console[_0xec13('0x1d')]('unknown\x20integration');}}else{_0x3b8ce1=require(_0xec13('0x1e'))(_0x3d229d['data1'][_0xec13('0x1f')]());_0x3b8ce1['error']('[EXEC]',util[_0xec13('0x20')](_0xec13('0x21'),_0x3d229d[_0xec13('0x12')]['toLowerCase'](),_0x3d229d[_0xec13('0x16')]));}}else{_0x3b8ce1=require(_0xec13('0x1e'))(_0x3d229d[_0xec13('0x12')][_0xec13('0x1f')]());_0x3b8ce1[_0xec13('0x22')]('[EXEC]',util[_0xec13('0x20')]('%s\x20account\x20#%s\x20not\x20found',_0x3d229d['data1'][_0xec13('0x1f')](),_0x3d229d[_0xec13('0x13')]));}}else{}}catch(_0x4488cf){console[_0xec13('0x22')](_0x4488cf);}}}}; \ 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 0a901e7..1d13215 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 _0xea99=['localhost','socket.io-emitter','emit','getString','Descriptions','ticketType','Task','utc','IsReminderSet','IsRecurrence','endUserType','WhoId','WhatId','Case','contact','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','length','find','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','resolve','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','$or','Contact','execute','cloneDeep','additionalSearchLead','Lead','additionalSearchAccount','Account','lead','account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','','Caller\x20-\x20%s','No\x20Company','upperFirst','forEach','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','concat','https://login.salesforce.com','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','calleridname','lastevent',']\x20Ticket\x20%s\x20created.','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis'];(function(_0x2ad5af,_0x1a567a){var _0x395ad4=function(_0x5e6785){while(--_0x5e6785){_0x2ad5af['push'](_0x2ad5af['shift']());}};_0x395ad4(++_0x1a567a);}(_0xea99,0xf4));var _0x9ea9=function(_0x548f8f,_0x2b2833){_0x548f8f=_0x548f8f-0x0;var _0x8a5e55=_0xea99[_0x548f8f];return _0x8a5e55;};'use strict';var _=require(_0x9ea9('0x0'));var rp=require(_0x9ea9('0x1'));var moment=require(_0x9ea9('0x2'));var BPromise=require(_0x9ea9('0x3'));var md5=require('md5');var jsforce=require('jsforce');var util=require(_0x9ea9('0x4'));var Redis=require('ioredis');var intUtil=require(_0x9ea9('0x5'));var config=require(_0x9ea9('0x6'));var logger=require(_0x9ea9('0x7'))(_0x9ea9('0x8'));config[_0x9ea9('0x9')]=_['defaults'](config[_0x9ea9('0x9')],{'host':_0x9ea9('0xa'),'port':0x18eb});var io=require(_0x9ea9('0xb'))(new Redis(config[_0x9ea9('0x9')]));function emit(_0x2a45fb,_0xc9708a,_0x213f45){io['to'](_0x2a45fb)[_0x9ea9('0xc')](_0xc9708a,_0x213f45);}function getTicket(_0x5de051,_0x153ee4,_0x4a40e2,_0x324c9b,_0x5751c4,_0x215245,_0x46b65f,_0x84b03e){var _0x29c2c1=Object['assign']({},{'OwnerId':_0x153ee4['id'],'Subject':intUtil[_0x9ea9('0xd')](_0x324c9b['Subjects'],_0x5751c4,'\x20'),'Description':intUtil['getString'](_0x324c9b[_0x9ea9('0xe')],_0x5751c4,'\x0a')},getCustomFields(_0x215245,_0x5751c4));if(_0x4a40e2){if(_0x324c9b[_0x9ea9('0xf')]===_0x9ea9('0x10')){_0x29c2c1['ActivityDate']=moment[_0x9ea9('0x11')]();_0x29c2c1[_0x9ea9('0x12')]=![];_0x29c2c1[_0x9ea9('0x13')]=![];if(_0x4a40e2['endUserType']==='contact'||_0x4a40e2[_0x9ea9('0x14')]==='lead'){_0x29c2c1[_0x9ea9('0x15')]=_0x4a40e2['id'];}else if(_0x4a40e2[_0x9ea9('0x14')]==='account'){_0x29c2c1[_0x9ea9('0x16')]=_0x4a40e2['id'];}}else if(_0x324c9b[_0x9ea9('0xf')]===_0x9ea9('0x17')){if(_0x4a40e2[_0x9ea9('0x14')]===_0x9ea9('0x18')){_0x29c2c1[_0x9ea9('0x19')]=_0x4a40e2['id'];}else if(_0x4a40e2[_0x9ea9('0x14')]==='account'){_0x29c2c1[_0x9ea9('0x1a')]=_0x4a40e2['id'];}else if(_0x4a40e2[_0x9ea9('0x14')]==='lead'&&_0x324c9b[_0x9ea9('0x1b')]){_0x29c2c1[_0x324c9b[_0x9ea9('0x1b')]]=_0x4a40e2['id'];}else{logger[_0x9ea9('0x1c')](_0x9ea9('0x1d'));}}}return _0x46b65f[_0x9ea9('0x1e')](_0x324c9b[_0x9ea9('0xf')])[_0x9ea9('0x1f')](_0x29c2c1);}function getUser(_0x4e9dae,_0x3a9552,_0x3748c8){if(!_[_0x9ea9('0x20')](_0x3a9552)&&intUtil[_0x9ea9('0x21')](_0x3a9552)){var _0x5c1fe7={'Email':_0x3a9552};var _0xe20b7a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3748c8[_0x9ea9('0x1e')]('User')['find'](_0x5c1fe7,_0xe20b7a)['execute']()['then'](function(_0x82ba0d){if(_0x82ba0d[_0x9ea9('0x22')]){var _0xd362d8=_[_0x9ea9('0x23')](_0x82ba0d,function(_0x3d6c8b){return _0x3d6c8b['Email']===_0x3a9552;});if(_0xd362d8){logger[_0x9ea9('0x1c')](_0x9ea9('0x24'),_0x3a9552);return BPromise['resolve']({'id':_0xd362d8['Id'],'name':_0xd362d8[_0x9ea9('0x25')]});}}else{logger[_0x9ea9('0x1c')](_0x9ea9('0x26'),_0x3a9552);return _0x3748c8[_0x9ea9('0x27')]()[_0x9ea9('0x28')](function(_0x185276){return BPromise[_0x9ea9('0x29')]({'id':_0x185276['user_id'],'name':_0x185276[_0x9ea9('0x2a')]});});}});}else{logger[_0x9ea9('0x1c')](_0x9ea9('0x26'),_0x3a9552);return _0x3748c8[_0x9ea9('0x27')]()['then'](function(_0x1dcbf8){return BPromise[_0x9ea9('0x29')]({'id':_0x1dcbf8['user_id'],'name':_0x1dcbf8[_0x9ea9('0x2a')]});});}}function getEndUser(_0x572ece,_0x36edde,_0x28eeb4,_0x109d9c,_0x4e9c2c){var _0x27aeb7={'$or':{'Phone':_0x109d9c}};var _0x5ab71c={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x9ea9('0x28')](function(){logger[_0x9ea9('0x1c')](_0x9ea9('0x2b'),_0x109d9c,_0x36edde[_0x9ea9('0x2c')]);switch(_0x36edde[_0x9ea9('0x2c')]){case _0x9ea9('0x2d'):var _0x148cb6=_['cloneDeep'](_0x27aeb7);if(_0x36edde[_0x9ea9('0x2e')]){var _0x5e1553={};_0x5e1553[_0x36edde['additionalSearchContact']]=_0x109d9c;_[_0x9ea9('0x2f')](_0x148cb6[_0x9ea9('0x30')],_0x5e1553);}return _0x4e9c2c[_0x9ea9('0x1e')](_0x9ea9('0x31'))[_0x9ea9('0x23')](_0x148cb6,_0x5ab71c)[_0x9ea9('0x32')]()[_0x9ea9('0x28')](function(_0x5a2a51){if(_0x5a2a51&&_0x5a2a51[_0x9ea9('0x22')]){return _0x5a2a51;}else{var _0x1a7b07=_[_0x9ea9('0x33')](_0x27aeb7);if(_0x36edde[_0x9ea9('0x34')]){var _0x249f70={};_0x249f70[_0x36edde[_0x9ea9('0x34')]]=_0x109d9c;_[_0x9ea9('0x2f')](_0x1a7b07['$or'],_0x249f70);}return _0x4e9c2c[_0x9ea9('0x1e')](_0x9ea9('0x35'))['find'](_0x1a7b07,_0x5ab71c);}});case'account_contact_lead':var _0x28b99d=_[_0x9ea9('0x33')](_0x27aeb7);if(_0x36edde[_0x9ea9('0x36')]){var _0x5e1553={};_0x5e1553[_0x36edde[_0x9ea9('0x36')]]=_0x109d9c;_[_0x9ea9('0x2f')](_0x28b99d[_0x9ea9('0x30')],_0x5e1553);}return _0x4e9c2c[_0x9ea9('0x1e')](_0x9ea9('0x37'))[_0x9ea9('0x23')](_0x28b99d,_0x5ab71c)[_0x9ea9('0x32')]()[_0x9ea9('0x28')](function(_0x2fc89b){if(_0x2fc89b&&_0x2fc89b[_0x9ea9('0x22')]){return _0x2fc89b;}else{var _0x1c2cb4=_[_0x9ea9('0x33')](_0x27aeb7);if(_0x36edde[_0x9ea9('0x2e')]){var _0x4e8b0f={};_0x4e8b0f[_0x36edde[_0x9ea9('0x2e')]]=_0x109d9c;_[_0x9ea9('0x2f')](_0x1c2cb4['$or'],_0x4e8b0f);}return _0x4e9c2c[_0x9ea9('0x1e')](_0x9ea9('0x31'))[_0x9ea9('0x23')](_0x1c2cb4,_0x5ab71c)[_0x9ea9('0x28')](function(_0x152387){if(_0x152387&&_0x152387[_0x9ea9('0x22')]){return _0x152387;}else{var _0x359af6=_['cloneDeep'](_0x27aeb7);if(_0x36edde[_0x9ea9('0x34')]){var _0x3a8183={};_0x3a8183[_0x36edde[_0x9ea9('0x34')]]=_0x109d9c;_[_0x9ea9('0x2f')](_0x359af6[_0x9ea9('0x30')],_0x3a8183);}return _0x4e9c2c[_0x9ea9('0x1e')]('Lead')[_0x9ea9('0x23')](_0x359af6,_0x5ab71c);}});}});case'contact':var _0x148cb6=_[_0x9ea9('0x33')](_0x27aeb7);if(_0x36edde['additionalSearchContact']){var _0x5e1553={};_0x5e1553[_0x36edde[_0x9ea9('0x2e')]]=_0x109d9c;_['merge'](_0x148cb6['$or'],_0x5e1553);}return _0x4e9c2c[_0x9ea9('0x1e')](_0x9ea9('0x31'))[_0x9ea9('0x23')](_0x148cb6,_0x5ab71c)['execute']();case _0x9ea9('0x38'):var _0x1c47bf=_[_0x9ea9('0x33')](_0x27aeb7);if(_0x36edde[_0x9ea9('0x34')]){var _0x5e1553={};_0x5e1553[_0x36edde['additionalSearchLead']]=_0x109d9c;_[_0x9ea9('0x2f')](_0x1c47bf['$or'],_0x5e1553);}return _0x4e9c2c[_0x9ea9('0x1e')]('Lead')[_0x9ea9('0x23')](_0x1c47bf,_0x5ab71c);case _0x9ea9('0x39'):var _0x28b99d=_[_0x9ea9('0x33')](_0x27aeb7);if(_0x36edde[_0x9ea9('0x36')]){var _0x5e1553={};_0x5e1553[_0x36edde[_0x9ea9('0x36')]]=_0x109d9c;_[_0x9ea9('0x2f')](_0x28b99d['$or'],_0x5e1553);}return _0x4e9c2c[_0x9ea9('0x1e')]('Account')['find'](_0x28b99d,_0x5ab71c);default:return null;}})[_0x9ea9('0x28')](function(_0x1ef251){if(_0x1ef251&&_0x1ef251[_0x9ea9('0x22')]){var _0x4f5a5c=_[_0x9ea9('0x3a')](_0x1ef251);if(_0x4f5a5c){return BPromise['resolve']({'id':_0x4f5a5c['Id'],'name':_0x4f5a5c[_0x9ea9('0x25')],'phone':_0x4f5a5c[_0x9ea9('0x3b')],'endUserType':_0x4f5a5c[_0x9ea9('0x3c')][_0x9ea9('0x3d')][_0x9ea9('0x3e')]()});}}})[_0x9ea9('0x28')](function(_0x3fc6ef){if(_0x3fc6ef){logger[_0x9ea9('0x1c')](_0x9ea9('0x3f'),_0x3fc6ef[_0x9ea9('0x14')],_0x109d9c);return BPromise[_0x9ea9('0x29')](_0x3fc6ef);}else{logger['info'](_0x9ea9('0x40'),_0x109d9c);var _0x5aed7b={'Phone':_0x109d9c};if(_0x36edde[_0x9ea9('0x41')]){if(_0x36edde['moduleCreate']===_0x9ea9('0x18')){logger['info'](_0x9ea9('0x42'),_0x109d9c,_0x36edde[_0x9ea9('0x41')]);_0x5aed7b[_0x9ea9('0x43')]=_0x28eeb4!==''?_0x28eeb4:util[_0x9ea9('0x44')]('Caller\x20-\x20%s',_0x109d9c);}else if(_0x36edde[_0x9ea9('0x41')]===_0x9ea9('0x38')){logger['info'](_0x9ea9('0x42'),_0x109d9c,_0x36edde[_0x9ea9('0x41')]);_0x5aed7b[_0x9ea9('0x43')]=_0x28eeb4!==_0x9ea9('0x45')?_0x28eeb4:util[_0x9ea9('0x44')](_0x9ea9('0x46'),_0x109d9c);_0x5aed7b['Company']=_0x9ea9('0x47');}else if(_0x36edde[_0x9ea9('0x41')]===_0x9ea9('0x39')){logger[_0x9ea9('0x1c')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x109d9c,_0x36edde['moduleCreate']);_0x5aed7b[_0x9ea9('0x25')]=_0x28eeb4!==''?_0x28eeb4:util[_0x9ea9('0x44')](_0x9ea9('0x46'),_0x109d9c);}else{return null;}}return _0x4e9c2c[_0x9ea9('0x1e')](_[_0x9ea9('0x48')](_0x36edde[_0x9ea9('0x41')]))['create'](_0x5aed7b)['then'](function(_0x2f35d0){return BPromise[_0x9ea9('0x29')]({'id':_0x2f35d0['id'],'endUserType':_0x36edde[_0x9ea9('0x41')]});});}});}function getCustomFields(_0x1c5a43,_0x34e668){var _0x3a4508={};if(_0x1c5a43['length']>0x0){_[_0x9ea9('0x49')](_0x1c5a43,function(_0x15f16b){if(_['includes'](['string',_0x9ea9('0x4a')],_0x15f16b[_0x9ea9('0x3d')])&&_0x15f16b[_0x9ea9('0x4b')]){_0x3a4508[_0x15f16b[_0x9ea9('0x4b')]]=_0x15f16b[_0x9ea9('0x4c')][_0x9ea9('0x4d')]();}else if(_0x15f16b[_0x9ea9('0x3d')]===_0x9ea9('0x4e')&&_0x15f16b[_0x9ea9('0x4f')]&&_0x15f16b[_0x9ea9('0x4b')]){_0x34e668[_0x15f16b[_0x9ea9('0x4f')]]&&(_0x3a4508[_0x15f16b['idField']]=_0x34e668[_0x15f16b[_0x9ea9('0x4f')]][_0x9ea9('0x4d')]());}else if(_0x15f16b[_0x9ea9('0x3d')]===_0x9ea9('0x50')&&_0x15f16b[_0x9ea9('0x51')]&&_0x15f16b[_0x9ea9('0x51')][_0x9ea9('0x52')]&&_0x15f16b[_0x9ea9('0x4b')]){_0x34e668[_0x15f16b[_0x9ea9('0x51')][_0x9ea9('0x52')][_0x9ea9('0x3e')]()]&&(_0x3a4508[_0x15f16b[_0x9ea9('0x4b')]]=_0x34e668[_0x15f16b[_0x9ea9('0x51')][_0x9ea9('0x52')]['toLowerCase']()]['toString']());}});}return _0x3a4508;}function getConnection(_0x2eb95a){var _0x409abe=_0x2eb95a['password'][_0x9ea9('0x53')](_0x2eb95a['securityToken']);var _0x2708d2=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2eb95a['remoteUri']||_0x9ea9('0x54'),'clientId':_0x2eb95a[_0x9ea9('0x55')],'clientSecret':_0x2eb95a[_0x9ea9('0x56')]}});return _0x2708d2[_0x9ea9('0x57')](_0x2eb95a[_0x9ea9('0x58')],_0x409abe)[_0x9ea9('0x28')](function(){logger[_0x9ea9('0x1c')]('Connection\x20established.');return _0x2708d2;});}exports[_0x9ea9('0x59')]=function(_0x1af324,_0x170052,_0x2df2e7,_0xa1e947,_0xf36374,_0x4023df){var _0x27fd21,_0x24eaf9,_0x57f2c2,_0x5cefda;_0x4023df[_0x9ea9('0x5a')]=intUtil[_0x9ea9('0x5b')](_0x4023df['serverUrl']);_0x4023df['remoteUri']=intUtil[_0x9ea9('0x5b')](_0x4023df[_0x9ea9('0x5c')]);if(_0xf36374&&_0xf36374[_0x9ea9('0x5d')]){logger['info'](_0x9ea9('0x5e'),'Recording\x20is\x20enabled!');_0x170052['recordingURL']=util['format'](_0x9ea9('0x5f'),_0x4023df['serverUrl'],_0x170052[_0x9ea9('0x60')],md5(_0x170052[_0x9ea9('0x60')]));}else{_0x170052[_0x9ea9('0x61')]='';}return getConnection(_0x4023df)[_0x9ea9('0x28')](function(_0x3616f1){_0x5cefda=_0x3616f1;return getUser(_0x4023df,_0xa1e947[_0x9ea9('0x62')],_0x5cefda);})[_0x9ea9('0x28')](function(_0xefe499){_0x27fd21=_0xefe499;return getEndUser(_0x4023df,_0x2df2e7,_0x170052['calleridname'],_0x170052[_0x9ea9('0x63')],_0x5cefda);})[_0x9ea9('0x28')](function(_0x3da3d0){_0x24eaf9=_0x3da3d0;return getTicket(_0x4023df,_0x27fd21,_0x24eaf9,_0x2df2e7,_0x170052,_0x2df2e7[_0x9ea9('0x64')],_0x5cefda,'queue');})[_0x9ea9('0x28')](function(_0x42c652){_0x57f2c2=_0x42c652;logger[_0x9ea9('0x1c')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x57f2c2['id']);logger[_0x9ea9('0x1c')](_0x9ea9('0x65'),_0x57f2c2['id'],_0xa1e947[_0x9ea9('0x52')],_0x4023df[_0x9ea9('0x3d')]);switch(_0x4023df[_0x9ea9('0x3d')]){case _0x9ea9('0x66'):emit(util['format'](_0x9ea9('0x67'),_0xa1e947['name']),'trigger:salesforce:display',{'recordId':_0x57f2c2['id']});break;case _0x9ea9('0x68'):emit(util['format'](_0x9ea9('0x67'),_0xa1e947['name']),_0x9ea9('0x69'),{'uri':util[_0x9ea9('0x44')](_0x9ea9('0x6a'),_0x5cefda[_0x9ea9('0x6b')],_0x57f2c2['id'])});break;default:logger[_0x9ea9('0x6c')](_0x9ea9('0x6d'));}})['catch'](function(_0x2f6258){logger[_0x9ea9('0x6c')](_0x9ea9('0x5e'),_0x2f6258);});};exports[_0x9ea9('0x6e')]=function(_0x5e7d76,_0x5c0922,_0x4a2b47,_0x28787d,_0x3e0271,_0x46eca,_0x470d6a){var _0x2471ce,_0x145d09,_0xa2b9be,_0x5d33dd;_0x46eca['serverUrl']=intUtil['stripTrailingSlash'](_0x46eca[_0x9ea9('0x5a')]);_0x46eca[_0x9ea9('0x5c')]=intUtil[_0x9ea9('0x5b')](_0x46eca[_0x9ea9('0x5c')]);if(_0x470d6a&&_0x470d6a[_0x9ea9('0x6f')]&&_0x470d6a[_0x9ea9('0x6f')]!=='none'){logger[_0x9ea9('0x1c')](_0x9ea9('0x70'),_0x9ea9('0x71'));_0x5c0922[_0x9ea9('0x61')]=util[_0x9ea9('0x44')](_0x9ea9('0x5f'),_0x46eca['serverUrl'],_0x5c0922[_0x9ea9('0x60')],md5(_0x5c0922['uniqueid']));}return getConnection(_0x46eca)[_0x9ea9('0x28')](function(_0x1b44d6){_0x5d33dd=_0x1b44d6;return getUser(_0x46eca,_0x28787d[_0x9ea9('0x62')],_0x5d33dd);})[_0x9ea9('0x28')](function(_0xe47a0f){_0x2471ce=_0xe47a0f;return getEndUser(_0x46eca,_0x4a2b47,_0x5c0922[_0x9ea9('0x72')],_0x5c0922[_0x9ea9('0x73')],_0x5d33dd);})['then'](function(_0x293787){_0x145d09=_0x293787;return getTicket(_0x46eca,_0x2471ce,_0x145d09,_0x4a2b47,_0x5c0922,_0x4a2b47[_0x9ea9('0x64')],_0x5d33dd,_0x9ea9('0x6e'));})['then'](function(_0x4c0c43){_0xa2b9be=_0x4c0c43;logger[_0x9ea9('0x1c')](_0x9ea9('0x74'),_0xa2b9be['id']);logger[_0x9ea9('0x1c')](_0x9ea9('0x75'),_0xa2b9be['id'],_0x28787d['name'],_0x46eca[_0x9ea9('0x3d')]);switch(_0x46eca[_0x9ea9('0x3d')]){case _0x9ea9('0x66'):emit(util[_0x9ea9('0x44')](_0x9ea9('0x67'),_0x28787d[_0x9ea9('0x52')]),_0x9ea9('0x76'),{'recordId':_0xa2b9be['id']});break;case _0x9ea9('0x68'):emit(util[_0x9ea9('0x44')](_0x9ea9('0x67'),_0x28787d[_0x9ea9('0x52')]),_0x9ea9('0x69'),{'uri':util[_0x9ea9('0x44')](_0x9ea9('0x6a'),_0x5d33dd[_0x9ea9('0x6b')],_0xa2b9be['id'])});break;default:logger[_0x9ea9('0x6c')](_0x9ea9('0x70'),_0x9ea9('0x77'));}})[_0x9ea9('0x78')](function(_0xe7078f){logger[_0x9ea9('0x6c')](_0x9ea9('0x70'),_0xe7078f);});};exports[_0x9ea9('0x79')]=function(_0x392779,_0x30a6e1,_0x333e04,_0xfc3e70,_0x24deab,_0x19140e){var _0x19a246,_0x22f0dd,_0x4acb8c,_0xb775d;_0x19140e[_0x9ea9('0x5a')]=intUtil[_0x9ea9('0x5b')](_0x19140e['serverUrl']);_0x19140e[_0x9ea9('0x5c')]=intUtil[_0x9ea9('0x5b')](_0x19140e[_0x9ea9('0x5c')]);if(_0x24deab&&_0x24deab[_0x9ea9('0x5d')]){logger[_0x9ea9('0x1c')]('['+_0x30a6e1['lastevent']['toUpperCase']()+']',_0x9ea9('0x71'));_0x30a6e1['recordingURL']=util[_0x9ea9('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x19140e['serverUrl'],_0x30a6e1['uniqueid'],md5(_0x30a6e1[_0x9ea9('0x60')]));}else{_0x30a6e1[_0x9ea9('0x61')]='';}return getConnection(_0x19140e)[_0x9ea9('0x28')](function(_0x3542d1){_0xb775d=_0x3542d1;if(!_[_0x9ea9('0x20')](_0xfc3e70)){return getUser(_0x19140e,_0xfc3e70[_0x9ea9('0x52')],_0xb775d);}else{return getUser(_0x19140e,null,_0xb775d);}})[_0x9ea9('0x28')](function(_0x1a6fc1){_0x19a246=_0x1a6fc1;return getEndUser(_0x19140e,_0x333e04,_0x30a6e1[_0x9ea9('0x7a')],_0x30a6e1[_0x9ea9('0x63')],_0xb775d);})[_0x9ea9('0x28')](function(_0x68756a){_0x22f0dd=_0x68756a;return getTicket(_0x19140e,_0x19a246,_0x22f0dd,_0x333e04,_0x30a6e1,_0x333e04[_0x9ea9('0x64')],_0xb775d);})[_0x9ea9('0x28')](function(_0x417168){_0x4acb8c=_0x417168;logger['info']('['+_0x30a6e1[_0x9ea9('0x7b')]['toUpperCase']()+_0x9ea9('0x7c'),_0x4acb8c['id']);logger[_0x9ea9('0x1c')]('['+_0x30a6e1['lastevent'][_0x9ea9('0x7d')]()+_0x9ea9('0x7e'),_0x19140e['type']);})[_0x9ea9('0x78')](function(_0x43e46a){logger[_0x9ea9('0x6c')]('['+_0x30a6e1['lastevent']['toUpperCase']()+']',_0x43e46a);});}; \ No newline at end of file +var _0xc775=['[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','[OUTBOUND]','unmanaged','monitor_format','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','emit','assign','getString','Descriptions','ticketType','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','WhoId','WhatId','Case','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','find','execute','length','Email','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','resolve','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','additionalSearchLead','merge','Lead','Account','lead','additionalSearchAccount','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Caller\x20-\x20%s','LastName','upperFirst','picklist','type','idField','content','variable','variableName','toString','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','destcalleridname','destcalleridnum','Fields','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0xc775,0x17f));var _0x5c77=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc775[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x5c77('0x0'));var jsforce=require(_0x5c77('0x1'));var util=require(_0x5c77('0x2'));var Redis=require(_0x5c77('0x3'));var intUtil=require(_0x5c77('0x4'));var config=require(_0x5c77('0x5'));var logger=require(_0x5c77('0x6'))(_0x5c77('0x7'));config[_0x5c77('0x8')]=_[_0x5c77('0x9')](config[_0x5c77('0x8')],{'host':_0x5c77('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5c77('0x8')]));function emit(_0x48f507,_0x3d0253,_0x550423){io['to'](_0x48f507)[_0x5c77('0xb')](_0x3d0253,_0x550423);}function getTicket(_0xe48804,_0xb7d380,_0x4bb489,_0xe0e40,_0x4aa31a,_0x22c435,_0xb294f5,_0x343ff7){var _0x351c1c=Object[_0x5c77('0xc')]({},{'OwnerId':_0xb7d380['id'],'Subject':intUtil[_0x5c77('0xd')](_0xe0e40['Subjects'],_0x4aa31a,'\x20'),'Description':intUtil['getString'](_0xe0e40[_0x5c77('0xe')],_0x4aa31a,'\x0a')},getCustomFields(_0x22c435,_0x4aa31a));if(_0x4bb489){if(_0xe0e40[_0x5c77('0xf')]==='Task'){_0x351c1c[_0x5c77('0x10')]=moment[_0x5c77('0x11')]();_0x351c1c[_0x5c77('0x12')]=![];_0x351c1c[_0x5c77('0x13')]=![];if(_0x4bb489[_0x5c77('0x14')]===_0x5c77('0x15')||_0x4bb489[_0x5c77('0x14')]==='lead'){_0x351c1c[_0x5c77('0x16')]=_0x4bb489['id'];}else if(_0x4bb489[_0x5c77('0x14')]==='account'){_0x351c1c[_0x5c77('0x17')]=_0x4bb489['id'];}}else if(_0xe0e40[_0x5c77('0xf')]===_0x5c77('0x18')){if(_0x4bb489['endUserType']===_0x5c77('0x15')){_0x351c1c['ContactId']=_0x4bb489['id'];}else if(_0x4bb489[_0x5c77('0x14')]===_0x5c77('0x19')){_0x351c1c[_0x5c77('0x1a')]=_0x4bb489['id'];}else if(_0x4bb489[_0x5c77('0x14')]==='lead'&&_0xe0e40[_0x5c77('0x1b')]){_0x351c1c[_0xe0e40['leadId']]=_0x4bb489['id'];}else{logger[_0x5c77('0x1c')](_0x5c77('0x1d'));}}}return _0xb294f5[_0x5c77('0x1e')](_0xe0e40[_0x5c77('0xf')])['create'](_0x351c1c);}function getUser(_0x359c3c,_0x281f12,_0x5299fa){if(!_[_0x5c77('0x1f')](_0x281f12)&&intUtil[_0x5c77('0x20')](_0x281f12)){var _0x2ee4e7={'Email':_0x281f12};var _0x140188={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5299fa[_0x5c77('0x1e')](_0x5c77('0x21'))[_0x5c77('0x22')](_0x2ee4e7,_0x140188)[_0x5c77('0x23')]()['then'](function(_0x5ba32d){if(_0x5ba32d[_0x5c77('0x24')]){var _0x293632=_[_0x5c77('0x22')](_0x5ba32d,function(_0x31210c){return _0x31210c[_0x5c77('0x25')]===_0x281f12;});if(_0x293632){logger[_0x5c77('0x1c')](_0x5c77('0x26'),_0x281f12);return BPromise['resolve']({'id':_0x293632['Id'],'name':_0x293632[_0x5c77('0x27')]});}}else{logger[_0x5c77('0x1c')](_0x5c77('0x28'),_0x281f12);return _0x5299fa['identity']()[_0x5c77('0x29')](function(_0xa9a936){return BPromise[_0x5c77('0x2a')]({'id':_0xa9a936[_0x5c77('0x2b')],'name':_0xa9a936[_0x5c77('0x2c')]});});}});}else{logger[_0x5c77('0x1c')](_0x5c77('0x28'),_0x281f12);return _0x5299fa[_0x5c77('0x2d')]()[_0x5c77('0x29')](function(_0x59da67){return BPromise[_0x5c77('0x2a')]({'id':_0x59da67['user_id'],'name':_0x59da67[_0x5c77('0x2c')]});});}}function getEndUser(_0x2dd8b9,_0x4c5074,_0x73da49,_0xffc07e,_0x44981f){var _0x17b788={'$or':{'Phone':_0xffc07e}};var _0x10746f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x5c77('0x29')](function(){logger[_0x5c77('0x1c')](_0x5c77('0x2e'),_0xffc07e,_0x4c5074[_0x5c77('0x2f')]);switch(_0x4c5074['moduleSearch']){case _0x5c77('0x30'):var _0x1e7ba1=_[_0x5c77('0x31')](_0x17b788);if(_0x4c5074[_0x5c77('0x32')]){var _0x1aecfe={};_0x1aecfe[_0x4c5074[_0x5c77('0x32')]]=_0xffc07e;_['merge'](_0x1e7ba1[_0x5c77('0x33')],_0x1aecfe);}return _0x44981f[_0x5c77('0x1e')](_0x5c77('0x34'))[_0x5c77('0x22')](_0x1e7ba1,_0x10746f)[_0x5c77('0x23')]()['then'](function(_0x48ecba){if(_0x48ecba&&_0x48ecba[_0x5c77('0x24')]){return _0x48ecba;}else{var _0x55966f=_[_0x5c77('0x31')](_0x17b788);if(_0x4c5074[_0x5c77('0x35')]){var _0x4ccd08={};_0x4ccd08[_0x4c5074[_0x5c77('0x35')]]=_0xffc07e;_[_0x5c77('0x36')](_0x55966f[_0x5c77('0x33')],_0x4ccd08);}return _0x44981f[_0x5c77('0x1e')](_0x5c77('0x37'))['find'](_0x55966f,_0x10746f);}});case'account_contact_lead':var _0x3b6cda=_[_0x5c77('0x31')](_0x17b788);if(_0x4c5074['additionalSearchAccount']){var _0x1aecfe={};_0x1aecfe[_0x4c5074['additionalSearchAccount']]=_0xffc07e;_[_0x5c77('0x36')](_0x3b6cda[_0x5c77('0x33')],_0x1aecfe);}return _0x44981f[_0x5c77('0x1e')](_0x5c77('0x38'))[_0x5c77('0x22')](_0x3b6cda,_0x10746f)[_0x5c77('0x23')]()[_0x5c77('0x29')](function(_0x2f7893){if(_0x2f7893&&_0x2f7893['length']){return _0x2f7893;}else{var _0x3b2ecc=_[_0x5c77('0x31')](_0x17b788);if(_0x4c5074[_0x5c77('0x32')]){var _0x164095={};_0x164095[_0x4c5074[_0x5c77('0x32')]]=_0xffc07e;_[_0x5c77('0x36')](_0x3b2ecc[_0x5c77('0x33')],_0x164095);}return _0x44981f[_0x5c77('0x1e')]('Contact')[_0x5c77('0x22')](_0x3b2ecc,_0x10746f)[_0x5c77('0x29')](function(_0x2d5685){if(_0x2d5685&&_0x2d5685['length']){return _0x2d5685;}else{var _0x1a3759=_[_0x5c77('0x31')](_0x17b788);if(_0x4c5074[_0x5c77('0x35')]){var _0x4ffd5b={};_0x4ffd5b[_0x4c5074['additionalSearchLead']]=_0xffc07e;_[_0x5c77('0x36')](_0x1a3759[_0x5c77('0x33')],_0x4ffd5b);}return _0x44981f[_0x5c77('0x1e')](_0x5c77('0x37'))[_0x5c77('0x22')](_0x1a3759,_0x10746f);}});}});case _0x5c77('0x15'):var _0x1e7ba1=_[_0x5c77('0x31')](_0x17b788);if(_0x4c5074['additionalSearchContact']){var _0x1aecfe={};_0x1aecfe[_0x4c5074[_0x5c77('0x32')]]=_0xffc07e;_[_0x5c77('0x36')](_0x1e7ba1[_0x5c77('0x33')],_0x1aecfe);}return _0x44981f[_0x5c77('0x1e')](_0x5c77('0x34'))[_0x5c77('0x22')](_0x1e7ba1,_0x10746f)[_0x5c77('0x23')]();case _0x5c77('0x39'):var _0x224ab9=_[_0x5c77('0x31')](_0x17b788);if(_0x4c5074[_0x5c77('0x35')]){var _0x1aecfe={};_0x1aecfe[_0x4c5074['additionalSearchLead']]=_0xffc07e;_[_0x5c77('0x36')](_0x224ab9[_0x5c77('0x33')],_0x1aecfe);}return _0x44981f[_0x5c77('0x1e')](_0x5c77('0x37'))[_0x5c77('0x22')](_0x224ab9,_0x10746f);case _0x5c77('0x19'):var _0x3b6cda=_[_0x5c77('0x31')](_0x17b788);if(_0x4c5074[_0x5c77('0x3a')]){var _0x1aecfe={};_0x1aecfe[_0x4c5074['additionalSearchAccount']]=_0xffc07e;_[_0x5c77('0x36')](_0x3b6cda['$or'],_0x1aecfe);}return _0x44981f['sobject']('Account')[_0x5c77('0x22')](_0x3b6cda,_0x10746f);default:return null;}})['then'](function(_0x5ead9b){if(_0x5ead9b&&_0x5ead9b['length']){var _0xc06fbb=_['first'](_0x5ead9b);if(_0xc06fbb){return BPromise[_0x5c77('0x2a')]({'id':_0xc06fbb['Id'],'name':_0xc06fbb['Name'],'phone':_0xc06fbb[_0x5c77('0x3b')],'endUserType':_0xc06fbb[_0x5c77('0x3c')]['type'][_0x5c77('0x3d')]()});}}})[_0x5c77('0x29')](function(_0x12bed8){if(_0x12bed8){logger[_0x5c77('0x1c')](_0x5c77('0x3e'),_0x12bed8[_0x5c77('0x14')],_0xffc07e);return BPromise[_0x5c77('0x2a')](_0x12bed8);}else{logger[_0x5c77('0x1c')](_0x5c77('0x3f'),_0xffc07e);var _0x5b7b3f={'Phone':_0xffc07e};if(_0x4c5074[_0x5c77('0x40')]){if(_0x4c5074[_0x5c77('0x40')]===_0x5c77('0x15')){logger[_0x5c77('0x1c')](_0x5c77('0x41'),_0xffc07e,_0x4c5074[_0x5c77('0x40')]);_0x5b7b3f['LastName']=_0x73da49!==_0x5c77('0x42')?_0x73da49:util[_0x5c77('0x43')](_0x5c77('0x44'),_0xffc07e);}else if(_0x4c5074['moduleCreate']==='lead'){logger[_0x5c77('0x1c')](_0x5c77('0x41'),_0xffc07e,_0x4c5074[_0x5c77('0x40')]);_0x5b7b3f[_0x5c77('0x45')]=_0x73da49!==_0x5c77('0x42')?_0x73da49:util[_0x5c77('0x43')](_0x5c77('0x44'),_0xffc07e);_0x5b7b3f['Company']='No\x20Company';}else if(_0x4c5074['moduleCreate']===_0x5c77('0x19')){logger['info'](_0x5c77('0x41'),_0xffc07e,_0x4c5074[_0x5c77('0x40')]);_0x5b7b3f['Name']=_0x73da49!==_0x5c77('0x42')?_0x73da49:util[_0x5c77('0x43')]('Caller\x20-\x20%s',_0xffc07e);}else{return null;}}return _0x44981f[_0x5c77('0x1e')](_[_0x5c77('0x46')](_0x4c5074['moduleCreate']))['create'](_0x5b7b3f)[_0x5c77('0x29')](function(_0x1e7c8e){return BPromise[_0x5c77('0x2a')]({'id':_0x1e7c8e['id'],'endUserType':_0x4c5074[_0x5c77('0x40')]});});}});}function getCustomFields(_0x4ed4b2,_0x37424c){var _0x577053={};if(_0x4ed4b2[_0x5c77('0x24')]>0x0){_['forEach'](_0x4ed4b2,function(_0x34ea8a){if(_['includes'](['string',_0x5c77('0x47')],_0x34ea8a[_0x5c77('0x48')])&&_0x34ea8a[_0x5c77('0x49')]){_0x577053[_0x34ea8a[_0x5c77('0x49')]]=_0x34ea8a[_0x5c77('0x4a')]['toString']();}else if(_0x34ea8a[_0x5c77('0x48')]===_0x5c77('0x4b')&&_0x34ea8a[_0x5c77('0x4c')]&&_0x34ea8a['idField']){_0x37424c[_0x34ea8a['variableName']]&&(_0x577053[_0x34ea8a[_0x5c77('0x49')]]=_0x37424c[_0x34ea8a['variableName']][_0x5c77('0x4d')]());}else if(_0x34ea8a[_0x5c77('0x48')]===_0x5c77('0x4e')&&_0x34ea8a[_0x5c77('0x4f')]&&_0x34ea8a['Variable'][_0x5c77('0x50')]&&_0x34ea8a[_0x5c77('0x49')]){_0x37424c[_0x34ea8a[_0x5c77('0x4f')][_0x5c77('0x50')][_0x5c77('0x3d')]()]&&(_0x577053[_0x34ea8a[_0x5c77('0x49')]]=_0x37424c[_0x34ea8a['Variable']['name'][_0x5c77('0x3d')]()][_0x5c77('0x4d')]());}});}return _0x577053;}function getConnection(_0x2e3cab){var _0x3066ac=_0x2e3cab[_0x5c77('0x51')][_0x5c77('0x52')](_0x2e3cab[_0x5c77('0x53')]);var _0x167c94=new jsforce[(_0x5c77('0x54'))]({'oauth2':{'loginUrl':_0x2e3cab[_0x5c77('0x55')]||'https://login.salesforce.com','clientId':_0x2e3cab['clientId'],'clientSecret':_0x2e3cab[_0x5c77('0x56')]}});return _0x167c94[_0x5c77('0x57')](_0x2e3cab[_0x5c77('0x58')],_0x3066ac)[_0x5c77('0x29')](function(){logger['info'](_0x5c77('0x59'));return _0x167c94;});}exports[_0x5c77('0x5a')]=function(_0x1741c6,_0x430d9f,_0x4e96a5,_0x161e30,_0x2fd607,_0xb3dc35){var _0x2155c2,_0x30ed2f,_0x4eea43,_0x404b05;_0xb3dc35['serverUrl']=intUtil[_0x5c77('0x5b')](_0xb3dc35[_0x5c77('0x5c')]);_0xb3dc35[_0x5c77('0x55')]=intUtil[_0x5c77('0x5b')](_0xb3dc35[_0x5c77('0x55')]);if(_0x2fd607&&_0x2fd607['monitor_format']){logger[_0x5c77('0x1c')]('[QUEUE]',_0x5c77('0x5d'));_0x430d9f['recordingURL']=util[_0x5c77('0x43')](_0x5c77('0x5e'),_0xb3dc35[_0x5c77('0x5c')],_0x430d9f[_0x5c77('0x5f')],md5(_0x430d9f['uniqueid']));}else{_0x430d9f[_0x5c77('0x60')]='';}return getConnection(_0xb3dc35)[_0x5c77('0x29')](function(_0xae34c6){_0x404b05=_0xae34c6;return getUser(_0xb3dc35,_0x161e30[_0x5c77('0x61')],_0x404b05);})[_0x5c77('0x29')](function(_0x4acb7d){_0x2155c2=_0x4acb7d;return getEndUser(_0xb3dc35,_0x4e96a5,_0x430d9f[_0x5c77('0x62')],_0x430d9f[_0x5c77('0x63')],_0x404b05);})[_0x5c77('0x29')](function(_0x1328aa){_0x30ed2f=_0x1328aa;return getTicket(_0xb3dc35,_0x2155c2,_0x30ed2f,_0x4e96a5,_0x430d9f,_0x4e96a5['Fields'],_0x404b05,_0x5c77('0x5a'));})[_0x5c77('0x29')](function(_0x5c6cd3){_0x4eea43=_0x5c6cd3;logger['info'](_0x5c77('0x64'),_0x4eea43['id']);logger[_0x5c77('0x1c')](_0x5c77('0x65'),_0x4eea43['id'],_0x161e30['name'],_0xb3dc35[_0x5c77('0x48')]);switch(_0xb3dc35[_0x5c77('0x48')]){case _0x5c77('0x66'):emit(util[_0x5c77('0x43')](_0x5c77('0x67'),_0x161e30[_0x5c77('0x50')]),_0x5c77('0x68'),{'recordId':_0x4eea43['id']});break;case'newTab':emit(util[_0x5c77('0x43')](_0x5c77('0x67'),_0x161e30[_0x5c77('0x50')]),_0x5c77('0x69'),{'uri':util['format'](_0x5c77('0x6a'),_0x404b05[_0x5c77('0x6b')],_0x4eea43['id'])});break;default:logger[_0x5c77('0x6c')](_0x5c77('0x6d'));}})[_0x5c77('0x6e')](function(_0x5b9b57){logger[_0x5c77('0x6c')]('[QUEUE]',_0x5b9b57);});};exports['outbound']=function(_0x37e850,_0x40ef21,_0x51f259,_0x2105cd,_0x50749e,_0x62a4c4,_0x2c8585){var _0x2ea87d,_0x37b351,_0x23d203,_0x343930;_0x62a4c4[_0x5c77('0x5c')]=intUtil['stripTrailingSlash'](_0x62a4c4[_0x5c77('0x5c')]);_0x62a4c4[_0x5c77('0x55')]=intUtil[_0x5c77('0x5b')](_0x62a4c4[_0x5c77('0x55')]);if(_0x2c8585&&_0x2c8585[_0x5c77('0x6f')]&&_0x2c8585['recordingFormat']!=='none'){logger[_0x5c77('0x1c')]('[OUTBOUND]',_0x5c77('0x5d'));_0x40ef21['recordingURL']=util[_0x5c77('0x43')](_0x5c77('0x5e'),_0x62a4c4[_0x5c77('0x5c')],_0x40ef21[_0x5c77('0x5f')],md5(_0x40ef21[_0x5c77('0x5f')]));}return getConnection(_0x62a4c4)[_0x5c77('0x29')](function(_0x49aaa1){_0x343930=_0x49aaa1;return getUser(_0x62a4c4,_0x2105cd[_0x5c77('0x61')],_0x343930);})['then'](function(_0x3b1238){_0x2ea87d=_0x3b1238;return getEndUser(_0x62a4c4,_0x51f259,_0x40ef21[_0x5c77('0x70')],_0x40ef21[_0x5c77('0x71')],_0x343930);})[_0x5c77('0x29')](function(_0x5a4743){_0x37b351=_0x5a4743;return getTicket(_0x62a4c4,_0x2ea87d,_0x37b351,_0x51f259,_0x40ef21,_0x51f259[_0x5c77('0x72')],_0x343930,_0x5c77('0x73'));})[_0x5c77('0x29')](function(_0x551190){_0x23d203=_0x551190;logger[_0x5c77('0x1c')](_0x5c77('0x74'),_0x23d203['id']);logger[_0x5c77('0x1c')](_0x5c77('0x75'),_0x23d203['id'],_0x2105cd['name'],_0x62a4c4[_0x5c77('0x48')]);switch(_0x62a4c4[_0x5c77('0x48')]){case _0x5c77('0x66'):emit(util[_0x5c77('0x43')]('user:%s',_0x2105cd['name']),_0x5c77('0x68'),{'recordId':_0x23d203['id']});break;case _0x5c77('0x76'):emit(util[_0x5c77('0x43')](_0x5c77('0x67'),_0x2105cd['name']),_0x5c77('0x69'),{'uri':util['format'](_0x5c77('0x6a'),_0x343930['instanceUrl'],_0x23d203['id'])});break;default:logger[_0x5c77('0x6c')](_0x5c77('0x77'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x5c77('0x6e')](function(_0xb801f7){logger[_0x5c77('0x6c')](_0x5c77('0x77'),_0xb801f7);});};exports[_0x5c77('0x78')]=function(_0x125359,_0x2e86e0,_0x3221b1,_0x561e67,_0x5bf273,_0x569c49){var _0x4f4e94,_0x210876,_0x3bc541,_0x1af423;_0x569c49['serverUrl']=intUtil[_0x5c77('0x5b')](_0x569c49[_0x5c77('0x5c')]);_0x569c49[_0x5c77('0x55')]=intUtil[_0x5c77('0x5b')](_0x569c49[_0x5c77('0x55')]);if(_0x5bf273&&_0x5bf273[_0x5c77('0x79')]){logger[_0x5c77('0x1c')]('['+_0x2e86e0[_0x5c77('0x7a')][_0x5c77('0x7b')]()+']',_0x5c77('0x5d'));_0x2e86e0['recordingURL']=util['format'](_0x5c77('0x5e'),_0x569c49[_0x5c77('0x5c')],_0x2e86e0[_0x5c77('0x5f')],md5(_0x2e86e0[_0x5c77('0x5f')]));}else{_0x2e86e0[_0x5c77('0x60')]='';}return getConnection(_0x569c49)['then'](function(_0x417fbe){_0x1af423=_0x417fbe;if(!_[_0x5c77('0x1f')](_0x561e67)){return getUser(_0x569c49,_0x561e67[_0x5c77('0x50')],_0x1af423);}else{return getUser(_0x569c49,null,_0x1af423);}})[_0x5c77('0x29')](function(_0x126313){_0x4f4e94=_0x126313;return getEndUser(_0x569c49,_0x3221b1,_0x2e86e0[_0x5c77('0x62')],_0x2e86e0[_0x5c77('0x63')],_0x1af423);})['then'](function(_0x4e51ba){_0x210876=_0x4e51ba;return getTicket(_0x569c49,_0x4f4e94,_0x210876,_0x3221b1,_0x2e86e0,_0x3221b1[_0x5c77('0x72')],_0x1af423);})['then'](function(_0x40cd9f){_0x3bc541=_0x40cd9f;logger[_0x5c77('0x1c')]('['+_0x2e86e0[_0x5c77('0x7a')][_0x5c77('0x7b')]()+']\x20Ticket\x20%s\x20created.',_0x3bc541['id']);logger[_0x5c77('0x1c')]('['+_0x2e86e0['lastevent'][_0x5c77('0x7b')]()+_0x5c77('0x7c'),_0x569c49[_0x5c77('0x48')]);})[_0x5c77('0x6e')](function(_0x2ac0a3){logger[_0x5c77('0x6c')]('['+_0x2e86e0[_0x5c77('0x7a')]['toUpperCase']()+']',_0x2ac0a3);});}; \ 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 e9c140d..3a6ec35 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 _0x47f9=['Incident','ticketId','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','name','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','isNil','email','adminEmail','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','bluebird','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','catch','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','length','active','true','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','System','endUserNumber','sys_id','error','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','customField','nameField','toLowerCase','toString','type','idField','variable','variableName','customVariable','Variable',']\x20getTicket\x20input\x20crm','endUserId','incident','assign','getString','Subjects','Descriptions','ticketNumber','number',']\x20getTicket\x20crm','label','GET','?sysparm_query=name%3D','label_entry'];(function(_0x34aa94,_0x5f32e5){var _0x17e776=function(_0x286f38){while(--_0x286f38){_0x34aa94['push'](_0x34aa94['shift']());}};_0x17e776(++_0x5f32e5);}(_0x47f9,0xff));var _0x947f=function(_0x515cff,_0x4fb356){_0x515cff=_0x515cff-0x0;var _0x128bf4=_0x47f9[_0x515cff];return _0x128bf4;};'use strict';var _=require('lodash');var Promise=require(_0x947f('0x0'));var rp=require(_0x947f('0x1'));var util=require(_0x947f('0x2'));var md5=require('md5');var Redis=require(_0x947f('0x3'));var intUtil=require(_0x947f('0x4'));var config=require(_0x947f('0x5'));var logger=require(_0x947f('0x6'))(_0x947f('0x7'));config[_0x947f('0x8')]=_[_0x947f('0x9')](config[_0x947f('0x8')],{'host':_0x947f('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x249ba2,_0x272053,_0x3e6ea1,_0x467d29,_0xa98bde,_0x516300){return new Promise(function(_0x180487,_0x16434a){var _0x97935={'method':'GET','uri':_0x467d29+_0x947f('0xb')+'&'+_0xa98bde+'&'+_0x516300,'auth':_0x272053,'json':!![]};return rp(_0x97935)[_0x947f('0xc')](function(_0x18606d){if(_0x18606d[_0x947f('0xd')]['length']>0x0){_0x3e6ea1[_0x947f('0xe')]=_0x18606d[_0x947f('0xd')][0x0]['sys_id'];}logger[_0x947f('0xf')]('['+[_0x249ba2[_0x947f('0x10')]()]+_0x947f('0x11'),_0x3e6ea1);_0x180487(_0x3e6ea1);})[_0x947f('0x12')](function(_0x41f338){logger['error']('['+[_0x249ba2[_0x947f('0x10')]()]+']',_0x41f338[_0x947f('0x13')]);_0x16434a(_0x41f338[_0x947f('0x13')]);});});}function getUser(_0x28a7b9,_0x1cbcbc,_0x4bf31d,_0xff29e5,_0x36c194){return function(_0x59663b){logger[_0x947f('0xf')]('['+[_0x28a7b9['toUpperCase']()]+_0x947f('0x14'),_0x59663b);return new Promise(function(_0x277117,_0x1b1fbd){if(intUtil[_0x947f('0x15')](_0x59663b[_0x947f('0x16')])){var _0x2a7ad5={'method':'GET','uri':_0x4bf31d+_0x947f('0x17')+_0x59663b[_0x947f('0x16')]+'&'+_0xff29e5+'&'+_0x36c194,'auth':_0x1cbcbc,'json':!![]};logger[_0x947f('0xf')]('['+[_0x28a7b9[_0x947f('0x10')]()]+'],\x20getUser\x20rp\x20obj',_0x2a7ad5);return rp(_0x2a7ad5)[_0x947f('0xc')](function(_0x7bc615){logger[_0x947f('0xf')]('['+[_0x28a7b9['toUpperCase']()]+_0x947f('0x18'),_0x7bc615);if(_0x7bc615[_0x947f('0xd')][_0x947f('0x19')]>0x0&&String(_0x7bc615[_0x947f('0xd')][0x0][_0x947f('0x1a')])===_0x947f('0x1b')){_0x59663b[_0x947f('0x1c')]=_0x7bc615['result'][0x0]['sys_id'];}else{_0x59663b[_0x947f('0x1c')]=_0x59663b['adminId'];_0x59663b['userEmail']=_0x59663b['adminEmail'];}logger[_0x947f('0xf')]('['+[_0x28a7b9[_0x947f('0x10')]()]+_0x947f('0x1d'),_0x59663b);_0x277117(_0x59663b);})[_0x947f('0x12')](function(_0x2a3877){logger['error']('['+[_0x28a7b9['toUpperCase']()]+']',_0x2a3877[_0x947f('0x13')]);_0x1b1fbd(_0x2a3877[_0x947f('0x13')]);});}else{logger[_0x947f('0xf')]('['+[_0x28a7b9[_0x947f('0x10')]()]+_0x947f('0x1e'));_0x59663b[_0x947f('0x1c')]=_0x59663b[_0x947f('0xe')];_0x59663b[_0x947f('0x16')]=_0x59663b['adminEmail'];_0x277117(_0x59663b);}});};}function createEndUser(_0x28dd20,_0x2ab6bc,_0xc9afae,_0x1a1536,_0x40fd12){logger['info']('['+[_0x28dd20[_0x947f('0x10')]()]+_0x947f('0x1f'),_0xc9afae);return new Promise(function(_0x3faa43,_0x31a7d3){var _0x57b98a={'method':_0x947f('0x20'),'uri':_0x1a1536+_0x947f('0x21')+_0x40fd12,'body':{'user_name':_0xc9afae['endUserNumber'],'roles':'user','first_name':_0xc9afae['endUserNumber'],'active':_0x947f('0x1b'),'date_format':_0x947f('0x22'),'phone':_0xc9afae[_0x947f('0x23')]},'auth':_0x2ab6bc,'json':!![]};return rp(_0x57b98a)['then'](function(_0x86ab46){logger[_0x947f('0xf')]('['+[_0x28dd20['toUpperCase']()]+'],\x20EndUser\x20schema',_0x86ab46[_0x947f('0xd')]);_0xc9afae['endUserId']=_0x86ab46[_0x947f('0xd')][_0x947f('0x24')];_0x3faa43(_0xc9afae);})[_0x947f('0x12')](function(_0x11a540){logger[_0x947f('0x25')]('['+[_0x28dd20[_0x947f('0x10')]()]+']',_0x11a540[_0x947f('0x13')]);_0x31a7d3(_0x11a540[_0x947f('0x13')]);});});}function getEndUser(_0x444b20,_0x55e12f,_0x33f0d6,_0x2583bb,_0x3446bb){return function(_0xe93aa4){logger[_0x947f('0xf')]('['+[_0x444b20[_0x947f('0x10')]()]+'],\x20getEndUser\x20input\x20crm',_0xe93aa4);return new Promise(function(_0xd7f9be,_0x2aced8){var _0x29b3c5={'method':'GET','uri':_0x33f0d6+_0x947f('0x26')+_0xe93aa4[_0x947f('0x23')]+'&'+_0x2583bb+'&'+_0x3446bb,'auth':_0x55e12f,'json':!![]};return rp(_0x29b3c5)[_0x947f('0xc')](function(_0x2fc48c){if(_0x2fc48c[_0x947f('0xd')][_0x947f('0x19')]>0x0){_0xe93aa4['endUserId']=_0x2fc48c[_0x947f('0xd')][0x0][_0x947f('0x24')];logger['info']('['+[_0x444b20[_0x947f('0x10')]()]+_0x947f('0x27'),_0xe93aa4);_0xd7f9be(_0xe93aa4);}else{return createEndUser(_0x444b20,_0x55e12f,_0xe93aa4,_0x33f0d6,_0x2583bb)['then'](function(_0x985e91){logger[_0x947f('0xf')]('['+[_0x444b20[_0x947f('0x10')]()]+_0x947f('0x28'),_0x985e91);_0xd7f9be(_0x985e91);});}})['catch'](function(_0x4e950b){logger[_0x947f('0x25')]('['+[_0x444b20[_0x947f('0x10')]()]+']',_0x4e950b[_0x947f('0x13')]);_0x2aced8(_0x4e950b[_0x947f('0x13')]);});});};}function getCustomFields(_0x43d48a,_0x68aba3){var _0x4e620f={};if(_0x43d48a[_0x947f('0x19')]>0x0){_[_0x947f('0x29')](_0x43d48a,function(_0x2a8242){if(_[_0x947f('0x2a')]([_0x947f('0x2b'),_0x947f('0x2c')],_0x2a8242['type'])&&_0x2a8242['nameField']&&!_0x2a8242[_0x947f('0x2d')]){_0x4e620f[_0x2a8242[_0x947f('0x2e')][_0x947f('0x2f')]()]=_0x2a8242['content'][_0x947f('0x30')]();}else if(_[_0x947f('0x2a')]([_0x947f('0x2b'),_0x947f('0x2c')],_0x2a8242[_0x947f('0x31')])&&_0x2a8242[_0x947f('0x32')]&&_0x2a8242[_0x947f('0x2d')]){_0x4e620f[_0x2a8242['idField'][_0x947f('0x2f')]()]=_0x2a8242['content']['toString']();}else if(_0x2a8242[_0x947f('0x31')]===_0x947f('0x33')&&_0x2a8242[_0x947f('0x34')]&&_0x2a8242['idField']&&_0x2a8242[_0x947f('0x2d')]){_0x4e620f[_0x2a8242[_0x947f('0x32')][_0x947f('0x2f')]()]=_0x68aba3[_0x2a8242[_0x947f('0x34')]][_0x947f('0x30')]();}else if(_0x2a8242['type']===_0x947f('0x35')&&_0x2a8242['Variable']&&_0x2a8242[_0x947f('0x36')]['name']&&_0x2a8242['idField']&&_0x2a8242[_0x947f('0x2d')]){_0x4e620f[_0x2a8242['idField'][_0x947f('0x2f')]()]=_0x68aba3[_0x2a8242[_0x947f('0x36')]['name'][_0x947f('0x2f')]()][_0x947f('0x30')]();}});}return _0x4e620f;}function getTicket(_0x154375,_0x5aa65a,_0x38000e,_0x21d94a,_0x446350,_0x43c482){return function(_0x4d7735){logger[_0x947f('0xf')]('['+[_0x154375['toUpperCase']()]+_0x947f('0x37'),_0x4d7735);return new Promise(function(_0x140ebb,_0x3d1a6b){var _0x2f973f=_0x154375[_0x947f('0x2f')]()==='outbound'?_0x4d7735[_0x947f('0x1c')]:_0x4d7735[_0x947f('0x38')];var _0x57c474={'method':_0x947f('0x20'),'uri':_0x38000e+_0x947f('0x39')+'?'+_0x43c482,'body':Object[_0x947f('0x3a')]({},{'active':'true','caller_id':_0x2f973f,'assigned_to':_0x4d7735[_0x947f('0x1c')],'short_description':intUtil[_0x947f('0x3b')](_0x21d94a[_0x947f('0x3c')],_0x446350,'\x20'),'description':intUtil[_0x947f('0x3b')](_0x21d94a[_0x947f('0x3d')],_0x446350,'\x0a')},getCustomFields(_0x21d94a['Fields'],_0x446350)),'auth':_0x5aa65a,'json':!![]};return rp(_0x57c474)['then'](function(_0x556fa5){logger[_0x947f('0xf')]('['+[_0x154375[_0x947f('0x10')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x556fa5[_0x947f('0xd')]);_0x4d7735['ticketId']=_0x556fa5[_0x947f('0xd')]['sys_id'];_0x4d7735[_0x947f('0x3e')]=_0x556fa5[_0x947f('0xd')][_0x947f('0x3f')];logger['info']('['+[_0x154375[_0x947f('0x10')]()]+_0x947f('0x40'),_0x4d7735);_0x140ebb(_0x4d7735);})['catch'](function(_0x2c07a0){logger[_0x947f('0x25')]('['+[_0x154375['toUpperCase']()]+']',_0x2c07a0['message']);_0x3d1a6b(_0x2c07a0[_0x947f('0x13')]);});});};}function createRemoteTag(_0x5aa35a,_0x5bf1c6,_0x535f7f,_0x3b43cf){return new Promise(function(_0x3ce44b,_0x22a417){var _0x208324={'method':_0x947f('0x20'),'uri':_0x535f7f+_0x947f('0x41')+'?'+_0x3b43cf,'body':{'short_description':_0x5aa35a,'global':!![],'active':!![],'name':_0x5aa35a},'auth':_0x5bf1c6,'json':!![]};return rp(_0x208324)[_0x947f('0xc')](function(_0x56007f){var _0x44050b=_0x56007f[_0x947f('0xd')][_0x947f('0x24')];_0x3ce44b(_0x44050b);});});}function getRemoteTag(_0x5e47c7,_0x58971a,_0x1047ad,_0x2cc5f2,_0x1a8cec){return new Promise(function(_0x2cf754,_0x34ab2e){var _0x25952f={'method':_0x947f('0x42'),'uri':_0x1047ad+_0x947f('0x41')+_0x947f('0x43')+_0x5e47c7+'&'+_0x2cc5f2,'auth':_0x58971a,'json':!![]};return rp(_0x25952f)[_0x947f('0xc')](function(_0x2f4430){if(_0x2f4430['result'][_0x947f('0x19')]>0x0){var _0x253913=_0x2f4430[_0x947f('0xd')][0x0]['sys_id'];_0x2cf754(_0x253913);}else{return createRemoteTag(_0x5e47c7,_0x58971a,_0x1047ad,_0x2cc5f2)[_0x947f('0xc')](function(_0x36b631){_0x2cf754(_0x36b631);});}});});}function assignTagToIncident(_0x723096,_0x32eb43,_0x2f8a6e,_0x4f21ec,_0x65cb48){return new Promise(function(_0x595092,_0x48aa04){var _0xcefb59={'method':_0x947f('0x20'),'uri':_0x2f8a6e+_0x947f('0x44')+'?'+_0x65cb48,'body':{'label':_0x723096,'table':_0x947f('0x39'),'id_type':_0x947f('0x45'),'table_key':_0x4f21ec[_0x947f('0x46')],'title':'Incident\x20-\x20'+_0x4f21ec[_0x947f('0x3e')],'id_display':_0x4f21ec[_0x947f('0x3e')]},'auth':_0x32eb43,'json':!![]};return rp(_0xcefb59)[_0x947f('0xc')](function(_0x141565){_0x595092();})[_0x947f('0x12')](function(){_0x595092();});});}function manageTags(_0x544ba2,_0x385624,_0x4fc914,_0x3ecd52,_0x4557b0,_0x13d9e3,_0x2ad87d){return new Promise(function(_0x2805f5,_0x3c6e53){var _0x4ec1eb=[];_0x385624[_0x947f('0x29')](function(_0x3ae3db){_0x4ec1eb[_0x947f('0x47')](getRemoteTag(_0x3ae3db,_0x4fc914,_0x3ecd52,_0x13d9e3,_0x2ad87d));});return Promise['all'](_0x4ec1eb)['then'](function(_0x51765a){if(_0x51765a[_0x947f('0x19')]){logger[_0x947f('0xf')]('['+[_0x544ba2['toUpperCase']()]+_0x947f('0x48'),_0x51765a);var _0x5ce8d5=[];_0x51765a[_0x947f('0x29')](function(_0x4c6db7){_0x5ce8d5[_0x947f('0x47')](assignTagToIncident(_0x4c6db7,_0x4fc914,_0x3ecd52,_0x4557b0,_0x13d9e3));});return Promise[_0x947f('0x49')](_0x5ce8d5)['then'](function(){_0x2805f5();})['catch'](function(){_0x2805f5();});}else{_0x2805f5();}});});}function getTags(_0x55eab1,_0x4f50de,_0x17173e,_0x36c414,_0x49e465,_0x54e3fe){return function(_0x3c2650){return new Promise(function(_0xab993c,_0x256980){var _0x10ed42=[];var _0x5f2f6c=_0x36c414[_0x947f('0x4a')];if(_0x5f2f6c&&_0x5f2f6c[_0x947f('0x19')]>0x0){_0x10ed42=_['map'](_0x5f2f6c,_0x947f('0x4b'));}if(_0x10ed42['length']>0x0){return manageTags(_0x55eab1,_0x10ed42,_0x4f50de,_0x17173e,_0x3c2650,_0x49e465,_0x54e3fe)['then'](function(){_0xab993c(_0x3c2650);});}else{_0xab993c(_0x3c2650);}});};}function emit(_0x2258a9,_0x36d8b4,_0x710ae4){var _0xf84554='%26sysparm_record_target%3Dincident'+_0x947f('0x4c')+_0x947f('0x4d')+_0x947f('0x4e');var _0x54981c={'uri':_0x2258a9+_0x947f('0x4f')+_0x710ae4+_0xf84554};io['to'](util[_0x947f('0x50')]('user:%s',_0x36d8b4))['emit'](_0x947f('0x51'),_0x54981c);}exports['cs']=function(_0x47d9fd,_0xc50cf6,_0x2bee13,_0x2b1300,_0x72025c,_0x4505fc,_0x38d9d6,_0x2b54bb){var _0x4c8860={};var _0x3d0140={'user':_0x4505fc['username'],'pass':_0x4505fc[_0x947f('0x52')]};var _0x9a94a7=_0x947f('0x53');var _0x4c329e=_0x947f('0x54');_0x4505fc['remoteUri']=intUtil[_0x947f('0x55')](_0x4505fc[_0x947f('0x56')]);_0x4505fc[_0x947f('0x57')]=intUtil[_0x947f('0x55')](_0x4505fc[_0x947f('0x57')]);var _0x2b0897=util[_0x947f('0x50')](_0x947f('0x58'),_0x4505fc[_0x947f('0x56')]);_0x4c8860[_0x947f('0x16')]=!_[_0x947f('0x59')](_0x2b1300)?_0x2b1300[_0x947f('0x5a')]:null;_0x4c8860[_0x947f('0x5b')]=_0x4505fc[_0x947f('0x5a')];_0x4c8860['endUserNumber']=_0x2b54bb[_0x947f('0x2f')]()===_0x947f('0x5c')?_0xc50cf6[_0x947f('0x5d')]:_0xc50cf6[_0x947f('0x5e')];_0x4c8860['callDirection']=_0x2b54bb===_0x947f('0x5f')||_0x2b54bb===_0x947f('0x60')?_0x947f('0x5f'):_0x947f('0x5c');var _0x17a2ec=util[_0x947f('0x50')](_0x947f('0x61'),_0x4505fc['serverUrl'],_0xc50cf6['uniqueid'],md5(_0xc50cf6[_0x947f('0x62')]));if(_0x72025c&&_0x72025c['monitor_format']){logger[_0x947f('0xf')](_0x947f('0x63'),_0x947f('0x64'));_0xc50cf6['recordingURL']=_0x17a2ec;}else if(_0x38d9d6&&_0x38d9d6[_0x947f('0x65')]&&_0x38d9d6[_0x947f('0x65')]!==_0x947f('0x66')){logger[_0x947f('0xf')](_0x947f('0x67'),_0x947f('0x64'));_0xc50cf6[_0x947f('0x68')]=_0x17a2ec;}else{_0xc50cf6[_0x947f('0x68')]='';}return getAdminUser(_0x2b54bb,_0x3d0140,_0x4c8860,_0x2b0897,_0x4c329e,_0x9a94a7)['then'](getUser(_0x2b54bb,_0x3d0140,_0x2b0897,_0x4c329e,_0x9a94a7))[_0x947f('0xc')](getEndUser(_0x2b54bb,_0x3d0140,_0x2b0897,_0x4c329e,_0x9a94a7))['then'](getTicket(_0x2b54bb,_0x3d0140,_0x2b0897,_0x2bee13,_0xc50cf6,_0x4c329e))[_0x947f('0xc')](function(_0x413e05){logger[_0x947f('0xf')](util[_0x947f('0x50')](_0x947f('0x69'),_0x413e05[_0x947f('0x46')]));logger[_0x947f('0xf')](util[_0x947f('0x50')]('call\x20direction:\x20%s',_0x2b54bb));if(_0x2b54bb!==_0x947f('0x60')){logger[_0x947f('0xf')]('['+[_0x2b54bb['toUpperCase']()]+']',_0x947f('0x6a'));emit(_0x4505fc[_0x947f('0x56')],_0x2b1300[_0x947f('0x4b')],_0x413e05[_0x947f('0x46')]);}})[_0x947f('0x12')](function(_0x258baa){logger['error']('['+[_0x2b54bb[_0x947f('0x10')]()]+_0x947f('0x6b'),util['inspect'](_0x258baa,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x41f8=['lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','type','nameField','customField','toLowerCase','content','toString','picklist','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','label','POST','Incident','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','map','%26sysparm_record_target%3Dincident','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect'];(function(_0x4e668d,_0x409130){var _0x476a12=function(_0x498501){while(--_0x498501){_0x4e668d['push'](_0x4e668d['shift']());}};_0x476a12(++_0x409130);}(_0x41f8,0x156));var _0x841f=function(_0x228d42,_0x1ba008){_0x228d42=_0x228d42-0x0;var _0xdfc2e2=_0x41f8[_0x228d42];return _0xdfc2e2;};'use strict';var _=require(_0x841f('0x0'));var Promise=require(_0x841f('0x1'));var rp=require(_0x841f('0x2'));var util=require(_0x841f('0x3'));var md5=require(_0x841f('0x4'));var Redis=require(_0x841f('0x5'));var intUtil=require(_0x841f('0x6'));var config=require(_0x841f('0x7'));var logger=require('../../../../config/logger')(_0x841f('0x8'));config[_0x841f('0x9')]=_[_0x841f('0xa')](config[_0x841f('0x9')],{'host':_0x841f('0xb'),'port':0x18eb});var io=require(_0x841f('0xc'))(new Redis(config[_0x841f('0x9')]));function getAdminUser(_0x367e11,_0x23ac4c,_0xeec2d6,_0x5bd894,_0x1aeaef,_0x336362){return new Promise(function(_0x56589d,_0x3c0a87){var _0x1dfcda={'method':_0x841f('0xd'),'uri':_0x5bd894+_0x841f('0xe')+'&'+_0x1aeaef+'&'+_0x336362,'auth':_0x23ac4c,'json':!![]};return rp(_0x1dfcda)[_0x841f('0xf')](function(_0x400c97){if(_0x400c97[_0x841f('0x10')][_0x841f('0x11')]>0x0){_0xeec2d6[_0x841f('0x12')]=_0x400c97[_0x841f('0x10')][0x0][_0x841f('0x13')];}logger[_0x841f('0x14')]('['+[_0x367e11[_0x841f('0x15')]()]+'],\x20getAdminUser\x20crm',_0xeec2d6);_0x56589d(_0xeec2d6);})[_0x841f('0x16')](function(_0x4a2fab){logger[_0x841f('0x17')]('['+[_0x367e11[_0x841f('0x15')]()]+']',_0x4a2fab[_0x841f('0x18')]);_0x3c0a87(_0x4a2fab[_0x841f('0x18')]);});});}function getUser(_0x4626fe,_0x4c43b3,_0x54023b,_0x275591,_0x4db404){return function(_0x2ef13c){logger[_0x841f('0x14')]('['+[_0x4626fe[_0x841f('0x15')]()]+_0x841f('0x19'),_0x2ef13c);return new Promise(function(_0x3ca5a7,_0x3826a3){if(intUtil[_0x841f('0x1a')](_0x2ef13c[_0x841f('0x1b')])){var _0x9b0b3a={'method':_0x841f('0xd'),'uri':_0x54023b+_0x841f('0x1c')+_0x2ef13c[_0x841f('0x1b')]+'&'+_0x275591+'&'+_0x4db404,'auth':_0x4c43b3,'json':!![]};logger[_0x841f('0x14')]('['+[_0x4626fe[_0x841f('0x15')]()]+'],\x20getUser\x20rp\x20obj',_0x9b0b3a);return rp(_0x9b0b3a)[_0x841f('0xf')](function(_0x6cdc71){logger['info']('['+[_0x4626fe['toUpperCase']()]+_0x841f('0x1d'),_0x6cdc71);if(_0x6cdc71[_0x841f('0x10')][_0x841f('0x11')]>0x0&&String(_0x6cdc71[_0x841f('0x10')][0x0][_0x841f('0x1e')])===_0x841f('0x1f')){_0x2ef13c[_0x841f('0x20')]=_0x6cdc71[_0x841f('0x10')][0x0][_0x841f('0x13')];}else{_0x2ef13c[_0x841f('0x20')]=_0x2ef13c[_0x841f('0x12')];_0x2ef13c[_0x841f('0x1b')]=_0x2ef13c[_0x841f('0x21')];}logger[_0x841f('0x14')]('['+[_0x4626fe[_0x841f('0x15')]()]+_0x841f('0x22'),_0x2ef13c);_0x3ca5a7(_0x2ef13c);})[_0x841f('0x16')](function(_0x13df1a){logger[_0x841f('0x17')]('['+[_0x4626fe[_0x841f('0x15')]()]+']',_0x13df1a['message']);_0x3826a3(_0x13df1a[_0x841f('0x18')]);});}else{logger[_0x841f('0x14')]('['+[_0x4626fe[_0x841f('0x15')]()]+_0x841f('0x23'));_0x2ef13c[_0x841f('0x20')]=_0x2ef13c[_0x841f('0x12')];_0x2ef13c[_0x841f('0x1b')]=_0x2ef13c[_0x841f('0x21')];_0x3ca5a7(_0x2ef13c);}});};}function createEndUser(_0x1aadc8,_0x539dad,_0x47b912,_0x296024,_0x3ed0b5){logger[_0x841f('0x14')]('['+[_0x1aadc8[_0x841f('0x15')]()]+_0x841f('0x24'),_0x47b912);return new Promise(function(_0x13b591,_0x5ab676){var _0x4e5881={'method':'POST','uri':_0x296024+_0x841f('0x25')+_0x3ed0b5,'body':{'user_name':_0x47b912[_0x841f('0x26')],'roles':_0x841f('0x27'),'first_name':_0x47b912[_0x841f('0x26')],'active':_0x841f('0x1f'),'date_format':_0x841f('0x28'),'phone':_0x47b912[_0x841f('0x26')]},'auth':_0x539dad,'json':!![]};return rp(_0x4e5881)[_0x841f('0xf')](function(_0x4409cf){logger[_0x841f('0x14')]('['+[_0x1aadc8[_0x841f('0x15')]()]+_0x841f('0x29'),_0x4409cf[_0x841f('0x10')]);_0x47b912[_0x841f('0x2a')]=_0x4409cf[_0x841f('0x10')][_0x841f('0x13')];_0x13b591(_0x47b912);})[_0x841f('0x16')](function(_0x5a7147){logger[_0x841f('0x17')]('['+[_0x1aadc8[_0x841f('0x15')]()]+']',_0x5a7147[_0x841f('0x18')]);_0x5ab676(_0x5a7147[_0x841f('0x18')]);});});}function getEndUser(_0x178004,_0x4d48b1,_0x22ca16,_0x20ef11,_0x3ca583){return function(_0x1444ac){logger[_0x841f('0x14')]('['+[_0x178004[_0x841f('0x15')]()]+_0x841f('0x2b'),_0x1444ac);return new Promise(function(_0x22f295,_0x13a1fa){var _0x44cf32={'method':_0x841f('0xd'),'uri':_0x22ca16+_0x841f('0x2c')+_0x1444ac[_0x841f('0x26')]+'&'+_0x20ef11+'&'+_0x3ca583,'auth':_0x4d48b1,'json':!![]};return rp(_0x44cf32)[_0x841f('0xf')](function(_0x3716fa){if(_0x3716fa['result'][_0x841f('0x11')]>0x0){_0x1444ac[_0x841f('0x2a')]=_0x3716fa[_0x841f('0x10')][0x0][_0x841f('0x13')];logger['info']('['+[_0x178004[_0x841f('0x15')]()]+_0x841f('0x2d'),_0x1444ac);_0x22f295(_0x1444ac);}else{return createEndUser(_0x178004,_0x4d48b1,_0x1444ac,_0x22ca16,_0x20ef11)[_0x841f('0xf')](function(_0x3a3db4){logger[_0x841f('0x14')]('['+[_0x178004[_0x841f('0x15')]()]+_0x841f('0x2e'),_0x3a3db4);_0x22f295(_0x3a3db4);});}})[_0x841f('0x16')](function(_0x17eeac){logger[_0x841f('0x17')]('['+[_0x178004[_0x841f('0x15')]()]+']',_0x17eeac['message']);_0x13a1fa(_0x17eeac[_0x841f('0x18')]);});});};}function getCustomFields(_0x4ce663,_0x2df34b){var _0x142b7f={};if(_0x4ce663[_0x841f('0x11')]>0x0){_[_0x841f('0x2f')](_0x4ce663,function(_0x574234){if(_[_0x841f('0x30')]([_0x841f('0x31'),'picklist'],_0x574234[_0x841f('0x32')])&&_0x574234[_0x841f('0x33')]&&!_0x574234[_0x841f('0x34')]){_0x142b7f[_0x574234[_0x841f('0x33')][_0x841f('0x35')]()]=_0x574234[_0x841f('0x36')][_0x841f('0x37')]();}else if(_[_0x841f('0x30')]([_0x841f('0x31'),_0x841f('0x38')],_0x574234[_0x841f('0x32')])&&_0x574234[_0x841f('0x39')]&&_0x574234['customField']){_0x142b7f[_0x574234[_0x841f('0x39')]['toLowerCase']()]=_0x574234[_0x841f('0x36')][_0x841f('0x37')]();}else if(_0x574234['type']===_0x841f('0x3a')&&_0x574234['variableName']&&_0x574234[_0x841f('0x39')]&&_0x574234[_0x841f('0x34')]){_0x142b7f[_0x574234[_0x841f('0x39')]['toLowerCase']()]=_0x2df34b[_0x574234[_0x841f('0x3b')]]['toString']();}else if(_0x574234[_0x841f('0x32')]===_0x841f('0x3c')&&_0x574234[_0x841f('0x3d')]&&_0x574234[_0x841f('0x3d')][_0x841f('0x3e')]&&_0x574234['idField']&&_0x574234[_0x841f('0x34')]){_0x142b7f[_0x574234['idField']['toLowerCase']()]=_0x2df34b[_0x574234[_0x841f('0x3d')][_0x841f('0x3e')][_0x841f('0x35')]()][_0x841f('0x37')]();}});}return _0x142b7f;}function getTicket(_0x134250,_0x5b73e2,_0x74c90c,_0x28653d,_0x118464,_0x41b7f4){return function(_0x48209b){logger[_0x841f('0x14')]('['+[_0x134250[_0x841f('0x15')]()]+_0x841f('0x3f'),_0x48209b);return new Promise(function(_0x4f47c9,_0x59cc38){var _0x312f20=_0x134250[_0x841f('0x35')]()===_0x841f('0x40')?_0x48209b['userId']:_0x48209b[_0x841f('0x2a')];var _0x50d457={'method':'POST','uri':_0x74c90c+_0x841f('0x41')+'?'+_0x41b7f4,'body':Object['assign']({},{'active':_0x841f('0x1f'),'caller_id':_0x312f20,'assigned_to':_0x48209b['userId'],'short_description':intUtil[_0x841f('0x42')](_0x28653d[_0x841f('0x43')],_0x118464,'\x20'),'description':intUtil['getString'](_0x28653d[_0x841f('0x44')],_0x118464,'\x0a')},getCustomFields(_0x28653d[_0x841f('0x45')],_0x118464)),'auth':_0x5b73e2,'json':!![]};return rp(_0x50d457)[_0x841f('0xf')](function(_0x10f5d0){logger['info']('['+[_0x134250[_0x841f('0x15')]()]+_0x841f('0x46'),_0x10f5d0['result']);_0x48209b[_0x841f('0x47')]=_0x10f5d0[_0x841f('0x10')][_0x841f('0x13')];_0x48209b[_0x841f('0x48')]=_0x10f5d0[_0x841f('0x10')]['number'];logger[_0x841f('0x14')]('['+[_0x134250[_0x841f('0x15')]()]+']\x20getTicket\x20crm',_0x48209b);_0x4f47c9(_0x48209b);})[_0x841f('0x16')](function(_0x58aed7){logger[_0x841f('0x17')]('['+[_0x134250['toUpperCase']()]+']',_0x58aed7['message']);_0x59cc38(_0x58aed7[_0x841f('0x18')]);});});};}function createRemoteTag(_0x1366b9,_0x8d1903,_0x425ea1,_0x3cf9c4){return new Promise(function(_0x24b6c6,_0x506d83){var _0x2660b1={'method':'POST','uri':_0x425ea1+_0x841f('0x49')+'?'+_0x3cf9c4,'body':{'short_description':_0x1366b9,'global':!![],'active':!![],'name':_0x1366b9},'auth':_0x8d1903,'json':!![]};return rp(_0x2660b1)[_0x841f('0xf')](function(_0x318720){var _0x692611=_0x318720[_0x841f('0x10')]['sys_id'];_0x24b6c6(_0x692611);});});}function getRemoteTag(_0x2f78ca,_0x5bfc1e,_0x181318,_0x32929d,_0x9e318f){return new Promise(function(_0x46b060,_0xa1b934){var _0x2c90b3={'method':_0x841f('0xd'),'uri':_0x181318+_0x841f('0x49')+'?sysparm_query=name%3D'+_0x2f78ca+'&'+_0x32929d,'auth':_0x5bfc1e,'json':!![]};return rp(_0x2c90b3)['then'](function(_0x485264){if(_0x485264[_0x841f('0x10')][_0x841f('0x11')]>0x0){var _0x4c0f52=_0x485264[_0x841f('0x10')][0x0][_0x841f('0x13')];_0x46b060(_0x4c0f52);}else{return createRemoteTag(_0x2f78ca,_0x5bfc1e,_0x181318,_0x32929d)['then'](function(_0x12faa9){_0x46b060(_0x12faa9);});}});});}function assignTagToIncident(_0x4d529b,_0x3bdd13,_0xedbb47,_0x256692,_0x5a313c){return new Promise(function(_0x11fa2c,_0x1ca989){var _0x4724af={'method':_0x841f('0x4a'),'uri':_0xedbb47+'label_entry'+'?'+_0x5a313c,'body':{'label':_0x4d529b,'table':_0x841f('0x41'),'id_type':_0x841f('0x4b'),'table_key':_0x256692['ticketId'],'title':_0x841f('0x4c')+_0x256692[_0x841f('0x48')],'id_display':_0x256692['ticketNumber']},'auth':_0x3bdd13,'json':!![]};return rp(_0x4724af)[_0x841f('0xf')](function(_0x5ece0e){_0x11fa2c();})['catch'](function(){_0x11fa2c();});});}function manageTags(_0x8fb7c5,_0x1958dd,_0x32b0b4,_0x2036e8,_0x36fd62,_0x2b339a,_0x569bac){return new Promise(function(_0xe8d684,_0x4e1ce9){var _0x3c4f2d=[];_0x1958dd[_0x841f('0x2f')](function(_0x50a293){_0x3c4f2d[_0x841f('0x4d')](getRemoteTag(_0x50a293,_0x32b0b4,_0x2036e8,_0x2b339a,_0x569bac));});return Promise['all'](_0x3c4f2d)['then'](function(_0x4424a9){if(_0x4424a9[_0x841f('0x11')]){logger[_0x841f('0x14')]('['+[_0x8fb7c5[_0x841f('0x15')]()]+_0x841f('0x4e'),_0x4424a9);var _0x5159a4=[];_0x4424a9[_0x841f('0x2f')](function(_0xfe8c55){_0x5159a4[_0x841f('0x4d')](assignTagToIncident(_0xfe8c55,_0x32b0b4,_0x2036e8,_0x36fd62,_0x2b339a));});return Promise[_0x841f('0x4f')](_0x5159a4)['then'](function(){_0xe8d684();})[_0x841f('0x16')](function(){_0xe8d684();});}else{_0xe8d684();}});});}function getTags(_0x1087b3,_0x25fb76,_0x528f61,_0x52bf31,_0x9e10ea,_0x1236af){return function(_0x23d84b){return new Promise(function(_0x3a2616,_0x1154d0){var _0x5bc9fd=[];var _0x1c281a=_0x52bf31['Tags'];if(_0x1c281a&&_0x1c281a['length']>0x0){_0x5bc9fd=_[_0x841f('0x50')](_0x1c281a,_0x841f('0x3e'));}if(_0x5bc9fd[_0x841f('0x11')]>0x0){return manageTags(_0x1087b3,_0x5bc9fd,_0x25fb76,_0x528f61,_0x23d84b,_0x9e10ea,_0x1236af)[_0x841f('0xf')](function(){_0x3a2616(_0x23d84b);});}else{_0x3a2616(_0x23d84b);}});};}function emit(_0x4e1cb0,_0x446fa7,_0x7caea0){var _0x85b7b9=_0x841f('0x51')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x841f('0x52');var _0x25fd42={'uri':_0x4e1cb0+_0x841f('0x53')+_0x7caea0+_0x85b7b9};io['to'](util[_0x841f('0x54')](_0x841f('0x55'),_0x446fa7))[_0x841f('0x56')](_0x841f('0x57'),_0x25fd42);}exports['cs']=function(_0x1695ee,_0x2230d2,_0x4b1a7a,_0x33be7b,_0x529daf,_0x3bd6c8,_0x87cf17,_0x4f1174){var _0x850c3c={};var _0x2cd11a={'user':_0x3bd6c8['username'],'pass':_0x3bd6c8[_0x841f('0x58')]};var _0x50b7b7=_0x841f('0x59');var _0x2b6c87=_0x841f('0x5a');_0x3bd6c8[_0x841f('0x5b')]=intUtil[_0x841f('0x5c')](_0x3bd6c8[_0x841f('0x5b')]);_0x3bd6c8[_0x841f('0x5d')]=intUtil[_0x841f('0x5c')](_0x3bd6c8['serverUrl']);var _0x402541=util['format'](_0x841f('0x5e'),_0x3bd6c8[_0x841f('0x5b')]);_0x850c3c['userEmail']=!_[_0x841f('0x5f')](_0x33be7b)?_0x33be7b[_0x841f('0x60')]:null;_0x850c3c[_0x841f('0x21')]=_0x3bd6c8[_0x841f('0x60')];_0x850c3c[_0x841f('0x26')]=_0x4f1174[_0x841f('0x35')]()===_0x841f('0x40')?_0x2230d2[_0x841f('0x61')]:_0x2230d2[_0x841f('0x62')];_0x850c3c['callDirection']=_0x4f1174===_0x841f('0x63')||_0x4f1174===_0x841f('0x64')?'queue':_0x841f('0x40');var _0xcdcf84=util[_0x841f('0x54')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3bd6c8[_0x841f('0x5d')],_0x2230d2[_0x841f('0x65')],md5(_0x2230d2[_0x841f('0x65')]));if(_0x529daf&&_0x529daf[_0x841f('0x66')]){logger['info'](_0x841f('0x67'),_0x841f('0x68'));_0x2230d2['recordingURL']=_0xcdcf84;}else if(_0x87cf17&&_0x87cf17[_0x841f('0x69')]&&_0x87cf17[_0x841f('0x69')]!==_0x841f('0x6a')){logger[_0x841f('0x14')](_0x841f('0x6b'),_0x841f('0x68'));_0x2230d2[_0x841f('0x6c')]=_0xcdcf84;}else{_0x2230d2[_0x841f('0x6c')]='';}return getAdminUser(_0x4f1174,_0x2cd11a,_0x850c3c,_0x402541,_0x2b6c87,_0x50b7b7)[_0x841f('0xf')](getUser(_0x4f1174,_0x2cd11a,_0x402541,_0x2b6c87,_0x50b7b7))[_0x841f('0xf')](getEndUser(_0x4f1174,_0x2cd11a,_0x402541,_0x2b6c87,_0x50b7b7))[_0x841f('0xf')](getTicket(_0x4f1174,_0x2cd11a,_0x402541,_0x4b1a7a,_0x2230d2,_0x2b6c87))[_0x841f('0xf')](function(_0x28914c){logger['info'](util['format'](_0x841f('0x6d'),_0x28914c[_0x841f('0x47')]));logger[_0x841f('0x14')](util['format'](_0x841f('0x6e'),_0x4f1174));if(_0x4f1174!=='unmanaged'){logger['info']('['+[_0x4f1174[_0x841f('0x15')]()]+']',_0x841f('0x6f'));emit(_0x3bd6c8[_0x841f('0x5b')],_0x33be7b[_0x841f('0x3e')],_0x28914c['ticketId']);}})['catch'](function(_0x5c2a98){logger['error']('['+[_0x4f1174[_0x841f('0x15')]()]+_0x841f('0x70'),util[_0x841f('0x71')](_0x5c2a98,{'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 963560e..0ba097d 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 _0xed11=['Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','users','[OUTBOUND]','unmanaged','monitor_format','lastevent','calleridname','lodash','bluebird','md5','util','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','emit','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','direction','length','forEach','variableName','push','idField','set_entry','JSON','Calls','apiKey','toString','base64','get_server_info','stringify','isNil','info','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','find','entry_list','name_value_list','user_name','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','format','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Enduser\x20created.','first_name','debug','merge','map','string','nameField','customField','toLowerCase','content','custom_fields','type','variable','customVariable','Variable','POST','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','remoteUri','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound'];(function(_0x18469a,_0x5a6daa){var _0x3d7581=function(_0x248ed4){while(--_0x248ed4){_0x18469a['push'](_0x18469a['shift']());}};_0x3d7581(++_0x5a6daa);}(_0xed11,0x10b));var _0x1ed1=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xed11[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x1ed1('0x0'));var rp=require('request-promise');var BPromise=require(_0x1ed1('0x1'));var md5=require(_0x1ed1('0x2'));var util=require(_0x1ed1('0x3'));var Redis=require('ioredis');var intUtil=require(_0x1ed1('0x4'));var config=require(_0x1ed1('0x5'));var logger=require('../../../../config/logger')(_0x1ed1('0x6'));config[_0x1ed1('0x7')]=_[_0x1ed1('0x8')](config[_0x1ed1('0x7')],{'host':_0x1ed1('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1ed1('0x7')]));var def={'method':'POST','json':!![]};function emit(_0x102e2d,_0x4b4477,_0x475dec){io['to'](_0x102e2d)[_0x1ed1('0xa')](_0x4b4477,_0x475dec);}function getTicket(_0xafb129,_0x35c7af,_0x148174,_0x16cb0c,_0x38a142,_0x2ac538,_0x2faa,_0xd32e6d){logger['info'](_0x1ed1('0xb'));var _0x937308=new Date();var _0x569720=[{'name':_0x1ed1('0xc'),'value':intUtil[_0x1ed1('0xd')](_0x16cb0c[_0x1ed1('0xe')],_0x38a142,'\x20')},{'name':_0x1ed1('0xf'),'value':_0x35c7af['id']},{'name':_0x1ed1('0x10'),'value':_0x35c7af['id']},{'name':'description','value':intUtil['getString'](_0x16cb0c[_0x1ed1('0x11')],_0x38a142,'\x0a')},{'name':'date_start','value':_0x937308[_0x1ed1('0x12')]()[_0x1ed1('0x13')](0x0,0x13)[_0x1ed1('0x14')]('T','\x20')},{'name':_0x1ed1('0x15'),'value':'0'},{'name':_0x1ed1('0x16'),'value':'15'},{'name':_0x1ed1('0x17'),'value':_0x148174['id']},{'name':_0x1ed1('0x18'),'value':_0x1ed1('0x19')},{'name':'parent_name','value':_0x148174[_0x1ed1('0xc')]},{'name':_0x1ed1('0x1a'),'value':_0xd32e6d}];if(_0x2ac538[_0x1ed1('0x1b')]){_[_0x1ed1('0x1c')](_0x2ac538,function(_0x57fbd4){if(_0x38a142[_0x57fbd4[_0x1ed1('0x1d')]]){_0x569720[_0x1ed1('0x1e')]({'name':_0x57fbd4[_0x1ed1('0x1f')],'value':_0x38a142[_0x57fbd4[_0x1ed1('0x1d')]]});}});}return request({'form':{'method':_0x1ed1('0x20'),'input_type':'JSON','response_type':_0x1ed1('0x21'),'rest_data':JSON['stringify']({'session':_0x2faa['id'],'module_name':_0x1ed1('0x22'),'name_value_list':_0x569720})}});}function getAuth(_0x5f5956){return util['format']('Basic\x20%s',new Buffer(_0x5f5956[_0x1ed1('0x23')]+':X')[_0x1ed1('0x24')](_0x1ed1('0x25')));}function getServerInfo(_0x2c33f6){return request({'form':{'method':_0x1ed1('0x26'),'input_type':_0x1ed1('0x21'),'response_type':_0x1ed1('0x21'),'rest_data':JSON[_0x1ed1('0x27')]({'session':_0x2c33f6['id']})}});}function getUser(_0x2d3929,_0x2300e2,_0x5d2f0a){if(!_[_0x1ed1('0x28')](_0x2300e2)){logger[_0x1ed1('0x29')]('Getting\x20agent\x20with\x20name',_0x2300e2);return request({'form':{'method':_0x1ed1('0x2a'),'input_type':_0x1ed1('0x21'),'response_type':_0x1ed1('0x21'),'rest_data':JSON[_0x1ed1('0x27')]({'session':_0x5d2f0a['id'],'module_name':_0x1ed1('0x2b'),'query':util['format'](_0x1ed1('0x2c'),_0x2300e2),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1ed1('0x2d')](function(_0x20c7ec){if(_0x20c7ec['entry_list']['length']){var _0x43cc3e=_[_0x1ed1('0x2e')](_0x20c7ec[_0x1ed1('0x2f')],function(_0x333c9f){return _0x333c9f[_0x1ed1('0x30')][_0x1ed1('0x31')]['value']===_0x2300e2;});if(_0x43cc3e){logger[_0x1ed1('0x29')](_0x1ed1('0x32'));return BPromise[_0x1ed1('0x33')]({'id':_0x43cc3e[_0x1ed1('0x30')]['id'][_0x1ed1('0x34')],'name':_0x43cc3e[_0x1ed1('0x30')][_0x1ed1('0xc')]['value']});}}logger['info'](_0x1ed1('0x35'));return BPromise[_0x1ed1('0x33')]({'id':_0x5d2f0a[_0x1ed1('0x30')][_0x1ed1('0x36')][_0x1ed1('0x34')],'name':_0x5d2f0a[_0x1ed1('0x30')][_0x1ed1('0x31')][_0x1ed1('0x34')]});});}else{logger[_0x1ed1('0x29')](_0x1ed1('0x37'));return BPromise['resolve']({'id':_0x5d2f0a[_0x1ed1('0x30')][_0x1ed1('0x36')][_0x1ed1('0x34')],'name':_0x5d2f0a['name_value_list'][_0x1ed1('0x31')][_0x1ed1('0x34')]});}}function getEndUser(_0xc946c,_0x2c6be9,_0x122d88,_0x521c4c){logger[_0x1ed1('0x29')]('Searching\x20enduser\x20with\x20phone',_0x122d88);return request({'form':{'method':_0x1ed1('0x2a'),'input_type':_0x1ed1('0x21'),'response_type':_0x1ed1('0x21'),'rest_data':JSON['stringify']({'session':_0x521c4c['id'],'module_name':_0x1ed1('0x19'),'query':util[_0x1ed1('0x38')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x122d88),'order_by':'','offset':'0','select_fields':['id','name',_0x1ed1('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1ed1('0x2d')](function(_0x158ac9){if(_0x158ac9[_0x1ed1('0x2f')][_0x1ed1('0x1b')]){var _0x2c7f81=_[_0x1ed1('0x2e')](_0x158ac9[_0x1ed1('0x2f')],function(_0x48c32a){return _0x48c32a[_0x1ed1('0x30')][_0x1ed1('0x39')][_0x1ed1('0x34')]===_0x122d88;});if(_0x2c7f81){logger[_0x1ed1('0x29')](_0x1ed1('0x3a'));return BPromise['resolve']({'id':_0x2c7f81[_0x1ed1('0x30')]['id']['value'],'name':_0x2c7f81['name_value_list'][_0x1ed1('0xc')]['value'],'phone':_0x2c7f81['name_value_list'][_0x1ed1('0x39')][_0x1ed1('0x34')]});}}else{logger[_0x1ed1('0x29')](_0x1ed1('0x3b'));return request({'form':{'method':_0x1ed1('0x20'),'input_type':'JSON','response_type':_0x1ed1('0x21'),'rest_data':JSON[_0x1ed1('0x27')]({'session':_0x521c4c['id'],'module_name':_0x1ed1('0x19'),'name_value_list':[{'name':'first_name','value':_0x2c6be9!==_0x1ed1('0x3c')?_0x2c6be9:util[_0x1ed1('0x38')]('Caller\x20-\x20%s',_0x122d88)},{'name':_0x1ed1('0x39'),'value':_0x122d88}]})}})[_0x1ed1('0x2d')](function(_0x156693){logger[_0x1ed1('0x29')](_0x1ed1('0x3d'));return BPromise[_0x1ed1('0x33')]({'id':_0x156693['id'],'name':_0x156693['entry_list'][_0x1ed1('0x3e')][_0x1ed1('0x34')],'phone':_0x156693[_0x1ed1('0x2f')][_0x1ed1('0x39')][_0x1ed1('0x34')]});});}});}function request(_0x3906fd){logger[_0x1ed1('0x3f')]('[HTTP]',JSON[_0x1ed1('0x27')](_0x3906fd));return rp(_[_0x1ed1('0x40')](def,_0x3906fd));}function getTags(_0x2e0b98,_0x1503dd){var _0x194057=[];if(_0x2e0b98&&_0x2e0b98['length']>0x0){_0x194057=_[_0x1ed1('0x41')](_0x2e0b98,_0x1503dd);}return _0x194057;}function getCustomFields(_0x44d82e,_0x45bc43){var _0x208ab8=[];var _0x1e74c1={'custom_fields':[]};if(_0x44d82e[_0x1ed1('0x1b')]>0x0){_[_0x1ed1('0x1c')](_0x44d82e,function(_0x26ba2b){if(_0x26ba2b['type']===_0x1ed1('0x42')&&_0x26ba2b[_0x1ed1('0x43')]&&!_0x26ba2b[_0x1ed1('0x44')]){_0x1e74c1[_0x26ba2b[_0x1ed1('0x43')][_0x1ed1('0x45')]()]=_0x26ba2b[_0x1ed1('0x46')]['toString']();}else if(_0x26ba2b['type']===_0x1ed1('0x42')&&_0x26ba2b[_0x1ed1('0x1f')]&&_0x26ba2b['customField']){_0x1e74c1[_0x1ed1('0x47')][_0x1ed1('0x1e')]({'id':_0x26ba2b[_0x1ed1('0x1f')],'value':_0x26ba2b[_0x1ed1('0x46')][_0x1ed1('0x24')]()});}else if(_0x26ba2b[_0x1ed1('0x48')]===_0x1ed1('0x49')&&_0x26ba2b['variableName']&&_0x26ba2b[_0x1ed1('0x1f')]&&_0x26ba2b[_0x1ed1('0x44')]){_0x45bc43[_0x26ba2b[_0x1ed1('0x1d')]]&&_0x1e74c1['custom_fields']['push']({'id':_0x26ba2b[_0x1ed1('0x1f')],'value':_0x45bc43[_0x26ba2b[_0x1ed1('0x1d')]][_0x1ed1('0x24')]()});}else if(_0x26ba2b[_0x1ed1('0x48')]===_0x1ed1('0x4a')&&_0x26ba2b['Variable']&&_0x26ba2b['Variable'][_0x1ed1('0xc')]&&_0x26ba2b[_0x1ed1('0x1f')]&&_0x26ba2b[_0x1ed1('0x44')]){_0x45bc43[_0x26ba2b[_0x1ed1('0x4b')]['name']['toLowerCase']()]&&_0x1e74c1[_0x1ed1('0x47')]['push']({'id':_0x26ba2b[_0x1ed1('0x1f')],'value':_0x45bc43[_0x26ba2b[_0x1ed1('0x4b')][_0x1ed1('0xc')][_0x1ed1('0x45')]()][_0x1ed1('0x24')]()});}});}return _0x1e74c1;}function getConnection(_0x74dd8e){return request({'method':_0x1ed1('0x4c'),'form':{'method':_0x1ed1('0x4d'),'input_type':_0x1ed1('0x21'),'response_type':_0x1ed1('0x21'),'rest_data':JSON[_0x1ed1('0x27')]({'user_auth':{'user_name':_0x74dd8e[_0x1ed1('0x4e')],'password':_0x74dd8e[_0x1ed1('0x4f')],'encryption':_0x1ed1('0x50')},'application':_0x1ed1('0x51')})}})[_0x1ed1('0x2d')](function(_0x4e543b){var _0x4ae41f=_0x4e543b;if(_0x4ae41f['id']){def[_0x1ed1('0x52')]=_0x4ae41f['id'];return BPromise[_0x1ed1('0x33')](_0x4ae41f);}else{throw new Error(util['format'](_0x1ed1('0x53'),_0x74dd8e['id']));}});}function setRelationship(_0x2472a5,_0x1ba467,_0x985ee8,_0x4274d8){return request({'form':{'method':'set_relationship','input_type':_0x1ed1('0x21'),'response_type':_0x1ed1('0x21'),'rest_data':JSON[_0x1ed1('0x27')]({'session':_0x2472a5['id'],'module_name':_0x1ed1('0x22'),'module_id':_0x985ee8['id'],'link_field_name':_0x4274d8,'related_ids':[_0x1ba467['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x5d1481,_0x5b3d45,_0x1426b8,_0x583f15,_0x523710,_0x3a0c70){var _0x260cac,_0x15862f,_0x4cb7f8,_0x135f97;_0x3a0c70['remoteUri']=intUtil[_0x1ed1('0x54')](_0x3a0c70['remoteUri']);_0x3a0c70[_0x1ed1('0x55')]=intUtil[_0x1ed1('0x54')](_0x3a0c70['serverUrl']);def[_0x1ed1('0x56')]=util['format'](_0x1ed1('0x57'),_0x3a0c70[_0x1ed1('0x58')]);if(_0x523710&&_0x523710['monitor_format']){logger[_0x1ed1('0x29')](_0x1ed1('0x59'),_0x1ed1('0x5a'));_0x5b3d45[_0x1ed1('0x5b')]=util['format'](_0x1ed1('0x5c'),_0x3a0c70[_0x1ed1('0x55')],_0x5b3d45['uniqueid'],md5(_0x5b3d45[_0x1ed1('0x5d')]));}else{_0x5b3d45[_0x1ed1('0x5b')]='';}return getConnection(_0x3a0c70)[_0x1ed1('0x2d')](function(_0x266e83){_0x135f97=_0x266e83;return getUser(_0x3a0c70,_0x583f15[_0x1ed1('0xc')],_0x135f97);})[_0x1ed1('0x2d')](function(_0x3566e7){_0x260cac=_0x3566e7;logger['info'](_0x1ed1('0x5e'),_0x260cac['id']);return getEndUser(_0x3a0c70,_0x5b3d45['calleridname'],_0x5b3d45[_0x1ed1('0x5f')],_0x135f97);})[_0x1ed1('0x2d')](function(_0x339abc){_0x15862f=_0x339abc;logger['info'](_0x1ed1('0x60'),_0x15862f['id']);return getTicket(_0x3a0c70,_0x260cac,_0x15862f,_0x1426b8,_0x5b3d45,_0x1426b8[_0x1ed1('0x61')],_0x135f97,_0x1ed1('0x62'));})[_0x1ed1('0x2d')](function(_0x12a224){_0x4cb7f8=_0x12a224;logger['info'](_0x1ed1('0x63'));logger[_0x1ed1('0x29')](_0x1ed1('0x64'),_0x4cb7f8['id']);return setRelationship(_0x135f97,_0x260cac,_0x4cb7f8,'users');})[_0x1ed1('0x2d')](function(){return setRelationship(_0x135f97,_0x15862f,_0x4cb7f8,_0x1ed1('0x65'));})[_0x1ed1('0x2d')](function(){return getServerInfo(_0x135f97);})[_0x1ed1('0x2d')](function(_0x53ab83){var _0x36158e=parseInt(_0x53ab83[_0x1ed1('0x66')][_0x1ed1('0x67')](0x0));var _0x258ffb=util[_0x1ed1('0x38')](_0x1ed1('0x68'),_0x3a0c70[_0x1ed1('0x58')],_0x4cb7f8['id']);if(_0x36158e>0x6){_0x258ffb=util[_0x1ed1('0x38')](_0x1ed1('0x69'),_0x3a0c70['remoteUri'],_0x4cb7f8['id']);}logger[_0x1ed1('0x29')](_0x1ed1('0x59'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x1ed1('0x38')](_0x1ed1('0x6a'),_0x583f15[_0x1ed1('0xc')]),_0x1ed1('0x6b'),{'uri':_0x258ffb});})[_0x1ed1('0x6c')](function(_0x5f2adb){logger[_0x1ed1('0x6d')]('[QUEUE]',JSON[_0x1ed1('0x27')](_0x5f2adb));});};exports[_0x1ed1('0x6e')]=function(_0x3bad04,_0x4f4d0c,_0x36f776,_0x4eea9d,_0x36d4ff,_0x393005,_0x23fdfb){var _0x322949,_0x3fdd89,_0x8f49fb,_0xe253ba;_0x393005['remoteUri']=intUtil[_0x1ed1('0x54')](_0x393005[_0x1ed1('0x58')]);_0x393005[_0x1ed1('0x55')]=intUtil['stripTrailingSlash'](_0x393005[_0x1ed1('0x55')]);def['uri']=util[_0x1ed1('0x38')](_0x1ed1('0x57'),_0x393005[_0x1ed1('0x58')]);if(_0x23fdfb&&_0x23fdfb[_0x1ed1('0x6f')]&&_0x23fdfb[_0x1ed1('0x6f')]!==_0x1ed1('0x70')){logger[_0x1ed1('0x29')]('[OUTBOUND]',_0x1ed1('0x5a'));_0x4f4d0c[_0x1ed1('0x5b')]=util[_0x1ed1('0x38')](_0x1ed1('0x5c'),_0x393005[_0x1ed1('0x55')],_0x4f4d0c['uniqueid'],md5(_0x4f4d0c[_0x1ed1('0x5d')]));}return getConnection(_0x393005)[_0x1ed1('0x2d')](function(_0x525387){_0xe253ba=_0x525387;return getUser(_0x393005,_0x4eea9d[_0x1ed1('0xc')],_0xe253ba);})[_0x1ed1('0x2d')](function(_0x2066d4){_0x322949=_0x2066d4;logger[_0x1ed1('0x29')](_0x1ed1('0x5e'),_0x322949['id']);return getEndUser(_0x393005,_0x4f4d0c[_0x1ed1('0x71')],_0x4f4d0c[_0x1ed1('0x72')],_0xe253ba);})[_0x1ed1('0x2d')](function(_0x55e683){_0x3fdd89=_0x55e683;logger['info'](_0x1ed1('0x60'),_0x3fdd89['id']);return getTicket(_0x393005,_0x322949,_0x3fdd89,_0x36f776,_0x4f4d0c,_0x36f776[_0x1ed1('0x61')],_0xe253ba,_0x1ed1('0x73'));})['then'](function(_0x20e8f3){_0x8f49fb=_0x20e8f3;logger[_0x1ed1('0x29')](_0x1ed1('0x63'));logger[_0x1ed1('0x29')](_0x1ed1('0x64'),_0x8f49fb['id']);return setRelationship(_0xe253ba,_0x322949,_0x8f49fb,_0x1ed1('0x74'));})[_0x1ed1('0x2d')](function(){return setRelationship(_0xe253ba,_0x3fdd89,_0x8f49fb,_0x1ed1('0x65'));})[_0x1ed1('0x2d')](function(){return getServerInfo(_0xe253ba);})[_0x1ed1('0x2d')](function(_0x2210f4){var _0x3503d9=parseInt(_0x2210f4['version'][_0x1ed1('0x67')](0x0));var _0x57af25=util[_0x1ed1('0x38')](_0x1ed1('0x68'),_0x393005[_0x1ed1('0x58')],_0x8f49fb['id']);if(_0x3503d9>0x6){_0x57af25=util[_0x1ed1('0x38')](_0x1ed1('0x69'),_0x393005['remoteUri'],_0x8f49fb['id']);}logger[_0x1ed1('0x29')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x4eea9d['name']),_0x1ed1('0x6b'),{'uri':_0x57af25});})[_0x1ed1('0x6c')](function(_0x5f2cab){logger[_0x1ed1('0x6d')](_0x1ed1('0x75'),JSON[_0x1ed1('0x27')](_0x5f2cab));});};exports[_0x1ed1('0x76')]=function(_0xfbaa2e,_0x4f5671,_0x3be7de,_0x259f24,_0x3c259c,_0x532f1c){var _0x1a0ac6,_0x406c90,_0x16d498,_0x2471f6;_0x532f1c[_0x1ed1('0x58')]=intUtil[_0x1ed1('0x54')](_0x532f1c[_0x1ed1('0x58')]);_0x532f1c[_0x1ed1('0x55')]=intUtil[_0x1ed1('0x54')](_0x532f1c[_0x1ed1('0x55')]);def[_0x1ed1('0x56')]=util['format'](_0x1ed1('0x57'),_0x532f1c[_0x1ed1('0x58')]);if(_0x3c259c&&_0x3c259c[_0x1ed1('0x77')]){logger['info']('['+_0x4f5671[_0x1ed1('0x78')]['toUpperCase']()+']',_0x1ed1('0x5a'));_0x4f5671[_0x1ed1('0x5b')]=util[_0x1ed1('0x38')](_0x1ed1('0x5c'),_0x532f1c['serverUrl'],_0x4f5671[_0x1ed1('0x5d')],md5(_0x4f5671[_0x1ed1('0x5d')]));}else{_0x4f5671[_0x1ed1('0x5b')]='';}return getConnection(_0x532f1c)[_0x1ed1('0x2d')](function(_0x394c45){_0x2471f6=_0x394c45;if(!_[_0x1ed1('0x28')](_0x259f24)){return getUser(_0x532f1c,_0x259f24[_0x1ed1('0xc')],_0x2471f6);}else{return getUser(_0x532f1c,null,_0x2471f6);}})['then'](function(_0x191052){_0x1a0ac6=_0x191052;logger[_0x1ed1('0x29')](_0x1ed1('0x5e'),_0x1a0ac6['id']);return getEndUser(_0x532f1c,_0x4f5671[_0x1ed1('0x79')],_0x4f5671[_0x1ed1('0x5f')],_0x2471f6);})[_0x1ed1('0x2d')](function(_0x13929b){_0x406c90=_0x13929b;logger[_0x1ed1('0x29')](_0x1ed1('0x60'),_0x406c90['id']);return getTicket(_0x532f1c,_0x1a0ac6,_0x406c90,_0x3be7de,_0x4f5671,_0x3be7de[_0x1ed1('0x61')],_0x2471f6,_0x1ed1('0x62'));})['then'](function(_0xc3a3cd){_0x16d498=_0xc3a3cd;logger[_0x1ed1('0x29')](_0x1ed1('0x63'));logger[_0x1ed1('0x29')](_0x1ed1('0x64'),_0x16d498['id']);return setRelationship(_0x2471f6,_0x1a0ac6,_0x16d498,'users');})[_0x1ed1('0x2d')](function(){return setRelationship(_0x2471f6,_0x406c90,_0x16d498,'contacts');})[_0x1ed1('0x2d')](function(){return getServerInfo(_0x2471f6);})['catch'](function(_0x36bb6b){logger[_0x1ed1('0x6d')]('['+_0x4f5671[_0x1ed1('0x78')]['toUpperCase']()+']',JSON[_0x1ed1('0x27')](_0x36bb6b));});}; \ No newline at end of file +var _0x7694=['Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','entry_list','find','Enduser\x20found!','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','then','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','customField','nameField','content','toString','custom_fields','variable','customVariable','Variable','toLowerCase','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','contacts','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','unmanaged','lastevent','toUpperCase','users','lodash','bluebird','md5','util','ioredis','./util','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','assigned_user_id','created_by','description','Descriptions','toISOString','slice','duration_hours','parent_id','parent_type','Contacts','parent_name','direction','forEach','variableName','push','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','base64','isNil','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','length','Agent\x20found!','name_value_list','value'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7694,0x13f));var _0x4769=function(_0x2cfb52,_0x1b0d00){_0x2cfb52=_0x2cfb52-0x0;var _0x52cdae=_0x7694[_0x2cfb52];return _0x52cdae;};'use strict';var _=require(_0x4769('0x0'));var rp=require('request-promise');var BPromise=require(_0x4769('0x1'));var md5=require(_0x4769('0x2'));var util=require(_0x4769('0x3'));var Redis=require(_0x4769('0x4'));var intUtil=require(_0x4769('0x5'));var config=require('../../../../config/environment');var logger=require(_0x4769('0x6'))(_0x4769('0x7'));config[_0x4769('0x8')]=_[_0x4769('0x9')](config[_0x4769('0x8')],{'host':_0x4769('0xa'),'port':0x18eb});var io=require(_0x4769('0xb'))(new Redis(config[_0x4769('0x8')]));var def={'method':_0x4769('0xc'),'json':!![]};function emit(_0x7a895b,_0x5f5e08,_0x9587f6){io['to'](_0x7a895b)[_0x4769('0xd')](_0x5f5e08,_0x9587f6);}function getTicket(_0x3a2329,_0x1de467,_0x1e444d,_0x1f05d8,_0x4412b6,_0x448a2b,_0x6a315d,_0x519dcb){logger[_0x4769('0xe')](_0x4769('0xf'));var _0x4f8726=new Date();var _0x14f163=[{'name':_0x4769('0x10'),'value':intUtil[_0x4769('0x11')](_0x1f05d8['Subjects'],_0x4412b6,'\x20')},{'name':_0x4769('0x12'),'value':_0x1de467['id']},{'name':_0x4769('0x13'),'value':_0x1de467['id']},{'name':_0x4769('0x14'),'value':intUtil[_0x4769('0x11')](_0x1f05d8[_0x4769('0x15')],_0x4412b6,'\x0a')},{'name':'date_start','value':_0x4f8726[_0x4769('0x16')]()[_0x4769('0x17')](0x0,0x13)['replace']('T','\x20')},{'name':_0x4769('0x18'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x4769('0x19'),'value':_0x1e444d['id']},{'name':_0x4769('0x1a'),'value':_0x4769('0x1b')},{'name':_0x4769('0x1c'),'value':_0x1e444d[_0x4769('0x10')]},{'name':_0x4769('0x1d'),'value':_0x519dcb}];if(_0x448a2b['length']){_[_0x4769('0x1e')](_0x448a2b,function(_0x5b63ab){if(_0x4412b6[_0x5b63ab[_0x4769('0x1f')]]){_0x14f163[_0x4769('0x20')]({'name':_0x5b63ab[_0x4769('0x21')],'value':_0x4412b6[_0x5b63ab[_0x4769('0x1f')]]});}});}return request({'form':{'method':_0x4769('0x22'),'input_type':_0x4769('0x23'),'response_type':_0x4769('0x23'),'rest_data':JSON[_0x4769('0x24')]({'session':_0x6a315d['id'],'module_name':'Calls','name_value_list':_0x14f163})}});}function getAuth(_0x41f16b){return util[_0x4769('0x25')](_0x4769('0x26'),new Buffer(_0x41f16b[_0x4769('0x27')]+':X')['toString'](_0x4769('0x28')));}function getServerInfo(_0x8cfd67){return request({'form':{'method':'get_server_info','input_type':'JSON','response_type':_0x4769('0x23'),'rest_data':JSON[_0x4769('0x24')]({'session':_0x8cfd67['id']})}});}function getUser(_0x2c80c5,_0x5c35ae,_0x509ba4){if(!_[_0x4769('0x29')](_0x5c35ae)){logger[_0x4769('0xe')](_0x4769('0x2a'),_0x5c35ae);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x4769('0x23'),'rest_data':JSON[_0x4769('0x24')]({'session':_0x509ba4['id'],'module_name':_0x4769('0x2b'),'query':util[_0x4769('0x25')](_0x4769('0x2c'),_0x5c35ae),'order_by':'','offset':'0','select_fields':['id',_0x4769('0x10'),_0x4769('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x4da039){if(_0x4da039['entry_list'][_0x4769('0x2e')]){var _0x470820=_['find'](_0x4da039['entry_list'],function(_0x27662a){return _0x27662a['name_value_list'][_0x4769('0x2d')]['value']===_0x5c35ae;});if(_0x470820){logger[_0x4769('0xe')](_0x4769('0x2f'));return BPromise['resolve']({'id':_0x470820[_0x4769('0x30')]['id']['value'],'name':_0x470820[_0x4769('0x30')]['name'][_0x4769('0x31')]});}}logger[_0x4769('0xe')](_0x4769('0x32'));return BPromise[_0x4769('0x33')]({'id':_0x509ba4['name_value_list'][_0x4769('0x34')]['value'],'name':_0x509ba4[_0x4769('0x30')][_0x4769('0x2d')][_0x4769('0x31')]});});}else{logger[_0x4769('0xe')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x4769('0x33')]({'id':_0x509ba4['name_value_list']['user_id'][_0x4769('0x31')],'name':_0x509ba4[_0x4769('0x30')]['user_name'][_0x4769('0x31')]});}}function getEndUser(_0x40f07a,_0x26cbf2,_0x5d43ee,_0x287d2b){logger[_0x4769('0xe')](_0x4769('0x35'),_0x5d43ee);return request({'form':{'method':_0x4769('0x36'),'input_type':_0x4769('0x23'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x287d2b['id'],'module_name':'Contacts','query':util['format'](_0x4769('0x37'),_0x5d43ee),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x5e4a6c){if(_0x5e4a6c[_0x4769('0x38')]['length']){var _0x30d0e7=_[_0x4769('0x39')](_0x5e4a6c['entry_list'],function(_0x239d5b){return _0x239d5b[_0x4769('0x30')]['phone_home'][_0x4769('0x31')]===_0x5d43ee;});if(_0x30d0e7){logger[_0x4769('0xe')](_0x4769('0x3a'));return BPromise['resolve']({'id':_0x30d0e7[_0x4769('0x30')]['id']['value'],'name':_0x30d0e7[_0x4769('0x30')][_0x4769('0x10')]['value'],'phone':_0x30d0e7[_0x4769('0x30')][_0x4769('0x3b')][_0x4769('0x31')]});}}else{logger[_0x4769('0xe')](_0x4769('0x3c'));return request({'form':{'method':_0x4769('0x22'),'input_type':_0x4769('0x23'),'response_type':_0x4769('0x23'),'rest_data':JSON['stringify']({'session':_0x287d2b['id'],'module_name':'Contacts','name_value_list':[{'name':_0x4769('0x3d'),'value':_0x26cbf2!==''?_0x26cbf2:util[_0x4769('0x25')](_0x4769('0x3e'),_0x5d43ee)},{'name':_0x4769('0x3b'),'value':_0x5d43ee}]})}})[_0x4769('0x3f')](function(_0x5b048d){logger[_0x4769('0xe')](_0x4769('0x40'));return BPromise[_0x4769('0x33')]({'id':_0x5b048d['id'],'name':_0x5b048d[_0x4769('0x38')][_0x4769('0x3d')][_0x4769('0x31')],'phone':_0x5b048d['entry_list']['phone_home'][_0x4769('0x31')]});});}});}function request(_0x4cf5a7){logger[_0x4769('0x41')](_0x4769('0x42'),JSON[_0x4769('0x24')](_0x4cf5a7));return rp(_[_0x4769('0x43')](def,_0x4cf5a7));}function getTags(_0x2d5984,_0x2bab8b){var _0x190fc3=[];if(_0x2d5984&&_0x2d5984[_0x4769('0x2e')]>0x0){_0x190fc3=_[_0x4769('0x44')](_0x2d5984,_0x2bab8b);}return _0x190fc3;}function getCustomFields(_0x4160d1,_0x3487a2){var _0x167527=[];var _0xa0d438={'custom_fields':[]};if(_0x4160d1[_0x4769('0x2e')]>0x0){_[_0x4769('0x1e')](_0x4160d1,function(_0x566288){if(_0x566288[_0x4769('0x45')]===_0x4769('0x46')&&_0x566288['nameField']&&!_0x566288[_0x4769('0x47')]){_0xa0d438[_0x566288[_0x4769('0x48')]['toLowerCase']()]=_0x566288[_0x4769('0x49')][_0x4769('0x4a')]();}else if(_0x566288[_0x4769('0x45')]==='string'&&_0x566288[_0x4769('0x21')]&&_0x566288[_0x4769('0x47')]){_0xa0d438[_0x4769('0x4b')][_0x4769('0x20')]({'id':_0x566288[_0x4769('0x21')],'value':_0x566288['content'][_0x4769('0x4a')]()});}else if(_0x566288['type']===_0x4769('0x4c')&&_0x566288[_0x4769('0x1f')]&&_0x566288[_0x4769('0x21')]&&_0x566288[_0x4769('0x47')]){_0x3487a2[_0x566288[_0x4769('0x1f')]]&&_0xa0d438[_0x4769('0x4b')][_0x4769('0x20')]({'id':_0x566288[_0x4769('0x21')],'value':_0x3487a2[_0x566288['variableName']][_0x4769('0x4a')]()});}else if(_0x566288[_0x4769('0x45')]===_0x4769('0x4d')&&_0x566288['Variable']&&_0x566288[_0x4769('0x4e')]['name']&&_0x566288[_0x4769('0x21')]&&_0x566288[_0x4769('0x47')]){_0x3487a2[_0x566288['Variable']['name'][_0x4769('0x4f')]()]&&_0xa0d438[_0x4769('0x4b')][_0x4769('0x20')]({'id':_0x566288['idField'],'value':_0x3487a2[_0x566288[_0x4769('0x4e')]['name'][_0x4769('0x4f')]()][_0x4769('0x4a')]()});}});}return _0xa0d438;}function getConnection(_0x55a285){return request({'method':_0x4769('0xc'),'form':{'method':'login','input_type':_0x4769('0x23'),'response_type':_0x4769('0x23'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x55a285['username'],'password':_0x55a285[_0x4769('0x50')],'encryption':_0x4769('0x51')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x4769('0x3f')](function(_0x81cc19){var _0xd68985=_0x81cc19;if(_0xd68985['id']){def[_0x4769('0x52')]=_0xd68985['id'];return BPromise[_0x4769('0x33')](_0xd68985);}else{throw new Error(util[_0x4769('0x25')](_0x4769('0x53'),_0x55a285['id']));}});}function setRelationship(_0x25d56e,_0x3daeab,_0x588131,_0x229f3e){return request({'form':{'method':_0x4769('0x54'),'input_type':_0x4769('0x23'),'response_type':_0x4769('0x23'),'rest_data':JSON[_0x4769('0x24')]({'session':_0x25d56e['id'],'module_name':'Calls','module_id':_0x588131['id'],'link_field_name':_0x229f3e,'related_ids':[_0x3daeab['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x4f0e94,_0x108cb6,_0x4ec3e1,_0x5a7246,_0x2070ea,_0x33c987){var _0x1853b0,_0x106dde,_0x25f18e,_0x178d34;_0x33c987[_0x4769('0x55')]=intUtil[_0x4769('0x56')](_0x33c987[_0x4769('0x55')]);_0x33c987[_0x4769('0x57')]=intUtil[_0x4769('0x56')](_0x33c987[_0x4769('0x57')]);def[_0x4769('0x58')]=util['format'](_0x4769('0x59'),_0x33c987[_0x4769('0x55')]);if(_0x2070ea&&_0x2070ea[_0x4769('0x5a')]){logger[_0x4769('0xe')]('[QUEUE]',_0x4769('0x5b'));_0x108cb6['recordingURL']=util[_0x4769('0x25')](_0x4769('0x5c'),_0x33c987[_0x4769('0x57')],_0x108cb6[_0x4769('0x5d')],md5(_0x108cb6['uniqueid']));}else{_0x108cb6['recordingURL']='';}return getConnection(_0x33c987)['then'](function(_0x41de47){_0x178d34=_0x41de47;return getUser(_0x33c987,_0x5a7246[_0x4769('0x10')],_0x178d34);})[_0x4769('0x3f')](function(_0x4ab9aa){_0x1853b0=_0x4ab9aa;logger[_0x4769('0xe')]('The\x20User\x20ID\x20is:',_0x1853b0['id']);return getEndUser(_0x33c987,_0x108cb6[_0x4769('0x5e')],_0x108cb6[_0x4769('0x5f')],_0x178d34);})['then'](function(_0x291340){_0x106dde=_0x291340;logger[_0x4769('0xe')](_0x4769('0x60'),_0x106dde['id']);return getTicket(_0x33c987,_0x1853b0,_0x106dde,_0x4ec3e1,_0x108cb6,_0x4ec3e1[_0x4769('0x61')],_0x178d34,_0x4769('0x62'));})[_0x4769('0x3f')](function(_0x2c2df4){_0x25f18e=_0x2c2df4;logger[_0x4769('0xe')](_0x4769('0x63'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x25f18e['id']);return setRelationship(_0x178d34,_0x1853b0,_0x25f18e,'users');})[_0x4769('0x3f')](function(){return setRelationship(_0x178d34,_0x106dde,_0x25f18e,_0x4769('0x64'));})[_0x4769('0x3f')](function(){return getServerInfo(_0x178d34);})['then'](function(_0x38f2f6){var _0x384989=parseInt(_0x38f2f6[_0x4769('0x65')]['charAt'](0x0));var _0x42fa38=util[_0x4769('0x25')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x33c987[_0x4769('0x55')],_0x25f18e['id']);if(_0x384989>0x6){_0x42fa38=util[_0x4769('0x25')](_0x4769('0x66'),_0x33c987[_0x4769('0x55')],_0x25f18e['id']);}logger[_0x4769('0xe')](_0x4769('0x67'),_0x4769('0x68'));emit(util[_0x4769('0x25')](_0x4769('0x69'),_0x5a7246[_0x4769('0x10')]),_0x4769('0x6a'),{'uri':_0x42fa38});})[_0x4769('0x6b')](function(_0x53caa6){logger[_0x4769('0x6c')]('[QUEUE]',JSON[_0x4769('0x24')](_0x53caa6));});};exports['outbound']=function(_0x430e91,_0x3cfe37,_0x61c838,_0x685e86,_0x3dc14f,_0x5e8e68,_0xf301fd){var _0x52af18,_0x23982a,_0x271f29,_0x552800;_0x5e8e68['remoteUri']=intUtil[_0x4769('0x56')](_0x5e8e68[_0x4769('0x55')]);_0x5e8e68[_0x4769('0x57')]=intUtil[_0x4769('0x56')](_0x5e8e68[_0x4769('0x57')]);def[_0x4769('0x58')]=util[_0x4769('0x25')](_0x4769('0x59'),_0x5e8e68['remoteUri']);if(_0xf301fd&&_0xf301fd[_0x4769('0x6d')]&&_0xf301fd[_0x4769('0x6d')]!==_0x4769('0x6e')){logger[_0x4769('0xe')](_0x4769('0x6f'),'Recording\x20is\x20enabled!');_0x3cfe37[_0x4769('0x70')]=util[_0x4769('0x25')](_0x4769('0x5c'),_0x5e8e68['serverUrl'],_0x3cfe37[_0x4769('0x5d')],md5(_0x3cfe37[_0x4769('0x5d')]));}return getConnection(_0x5e8e68)[_0x4769('0x3f')](function(_0x583ef3){_0x552800=_0x583ef3;return getUser(_0x5e8e68,_0x685e86[_0x4769('0x10')],_0x552800);})[_0x4769('0x3f')](function(_0x3b4b7f){_0x52af18=_0x3b4b7f;logger['info'](_0x4769('0x71'),_0x52af18['id']);return getEndUser(_0x5e8e68,_0x3cfe37[_0x4769('0x72')],_0x3cfe37[_0x4769('0x73')],_0x552800);})[_0x4769('0x3f')](function(_0x30d165){_0x23982a=_0x30d165;logger[_0x4769('0xe')](_0x4769('0x60'),_0x23982a['id']);return getTicket(_0x5e8e68,_0x52af18,_0x23982a,_0x61c838,_0x3cfe37,_0x61c838[_0x4769('0x61')],_0x552800,'Outbound');})['then'](function(_0xaf48a7){_0x271f29=_0xaf48a7;logger['info'](_0x4769('0x63'));logger[_0x4769('0xe')](_0x4769('0x74'),_0x271f29['id']);return setRelationship(_0x552800,_0x52af18,_0x271f29,'users');})['then'](function(){return setRelationship(_0x552800,_0x23982a,_0x271f29,_0x4769('0x64'));})['then'](function(){return getServerInfo(_0x552800);})[_0x4769('0x3f')](function(_0x30293e){var _0x30d871=parseInt(_0x30293e[_0x4769('0x65')][_0x4769('0x75')](0x0));var _0x4ba9e7=util[_0x4769('0x25')](_0x4769('0x76'),_0x5e8e68[_0x4769('0x55')],_0x271f29['id']);if(_0x30d871>0x6){_0x4ba9e7=util['format'](_0x4769('0x66'),_0x5e8e68[_0x4769('0x55')],_0x271f29['id']);}logger[_0x4769('0xe')](_0x4769('0x6f'),_0x4769('0x68'));emit(util['format'](_0x4769('0x69'),_0x685e86[_0x4769('0x10')]),_0x4769('0x6a'),{'uri':_0x4ba9e7});})[_0x4769('0x6b')](function(_0x58254b){logger['error']('[OUTBOUND]',JSON[_0x4769('0x24')](_0x58254b));});};exports[_0x4769('0x77')]=function(_0x308d30,_0x4a5b5f,_0x2faa2c,_0x1d58b3,_0x38a87b,_0x56ad29){var _0x3fc4e1,_0x4d345a,_0x26850d,_0x4f9916;_0x56ad29['remoteUri']=intUtil[_0x4769('0x56')](_0x56ad29[_0x4769('0x55')]);_0x56ad29[_0x4769('0x57')]=intUtil[_0x4769('0x56')](_0x56ad29[_0x4769('0x57')]);def[_0x4769('0x58')]=util[_0x4769('0x25')](_0x4769('0x59'),_0x56ad29[_0x4769('0x55')]);if(_0x38a87b&&_0x38a87b[_0x4769('0x5a')]){logger[_0x4769('0xe')]('['+_0x4a5b5f[_0x4769('0x78')][_0x4769('0x79')]()+']',_0x4769('0x5b'));_0x4a5b5f[_0x4769('0x70')]=util['format'](_0x4769('0x5c'),_0x56ad29[_0x4769('0x57')],_0x4a5b5f[_0x4769('0x5d')],md5(_0x4a5b5f['uniqueid']));}else{_0x4a5b5f[_0x4769('0x70')]='';}return getConnection(_0x56ad29)[_0x4769('0x3f')](function(_0x40592){_0x4f9916=_0x40592;if(!_['isNil'](_0x1d58b3)){return getUser(_0x56ad29,_0x1d58b3[_0x4769('0x10')],_0x4f9916);}else{return getUser(_0x56ad29,null,_0x4f9916);}})[_0x4769('0x3f')](function(_0x190f9c){_0x3fc4e1=_0x190f9c;logger[_0x4769('0xe')](_0x4769('0x71'),_0x3fc4e1['id']);return getEndUser(_0x56ad29,_0x4a5b5f[_0x4769('0x5e')],_0x4a5b5f['calleridnum'],_0x4f9916);})[_0x4769('0x3f')](function(_0x39c8b1){_0x4d345a=_0x39c8b1;logger['info'](_0x4769('0x60'),_0x4d345a['id']);return getTicket(_0x56ad29,_0x3fc4e1,_0x4d345a,_0x2faa2c,_0x4a5b5f,_0x2faa2c[_0x4769('0x61')],_0x4f9916,_0x4769('0x62'));})[_0x4769('0x3f')](function(_0x33359c){_0x26850d=_0x33359c;logger[_0x4769('0xe')]('Ticket\x20created!');logger[_0x4769('0xe')](_0x4769('0x74'),_0x26850d['id']);return setRelationship(_0x4f9916,_0x3fc4e1,_0x26850d,_0x4769('0x7a'));})[_0x4769('0x3f')](function(){return setRelationship(_0x4f9916,_0x4d345a,_0x26850d,_0x4769('0x64'));})[_0x4769('0x3f')](function(){return getServerInfo(_0x4f9916);})[_0x4769('0x6b')](function(_0x5c0cbb){logger[_0x4769('0x6c')]('['+_0x4a5b5f['lastevent'][_0x4769('0x79')]()+']',JSON[_0x4769('0x24')](_0x5c0cbb));});}; \ 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 dbe365e..e3b12f1 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 _0x9a68=['keyContent','format','join','substring','lastIndexOf','isNil','test','lodash','util','length','sortBy','type','string','content','variable','variableName','customVariable','Variable','name','toLowerCase','push','keyType','%s:\x20%s','key'];(function(_0x224eee,_0x4fad21){var _0x7c6a16=function(_0x27225f){while(--_0x27225f){_0x224eee['push'](_0x224eee['shift']());}};_0x7c6a16(++_0x4fad21);}(_0x9a68,0xaf));var _0x89a6=function(_0x10efba,_0x3e19cf){_0x10efba=_0x10efba-0x0;var _0x3f9482=_0x9a68[_0x10efba];return _0x3f9482;};'use strict';var _=require(_0x89a6('0x0'));var util=require(_0x89a6('0x1'));exports['getString']=function(_0x2958b8,_0x503551,_0x5723b8){var _0x215fd0=[];if(_0x2958b8[_0x89a6('0x2')]>0x0){var _0x1e511e=_[_0x89a6('0x3')](_0x2958b8,['id']);for(var _0x2cd88c=0x0;_0x2cd88c<_0x1e511e[_0x89a6('0x2')];_0x2cd88c++){var _0x2d2522=_0x1e511e[_0x2cd88c];if(_0x2d2522[_0x89a6('0x4')]===_0x89a6('0x5')){_0x215fd0['push'](_0x2d2522[_0x89a6('0x6')]);}else if(_0x2d2522[_0x89a6('0x4')]===_0x89a6('0x7')&&_0x2d2522[_0x89a6('0x8')]){_0x503551[_0x2d2522[_0x89a6('0x8')]]&&_0x215fd0['push'](_0x503551[_0x2d2522[_0x89a6('0x8')]]['toString']());}else if(_0x2d2522[_0x89a6('0x4')]===_0x89a6('0x9')&&_0x2d2522[_0x89a6('0xa')]&&_0x2d2522[_0x89a6('0xa')][_0x89a6('0xb')]){_0x503551[_0x2d2522['Variable'][_0x89a6('0xb')][_0x89a6('0xc')]()]&&_0x215fd0[_0x89a6('0xd')](_0x503551[_0x2d2522[_0x89a6('0xa')]['name'][_0x89a6('0xc')]()]['toString']());}else if(_0x2d2522['type']==='keyValue'){if(_0x2d2522[_0x89a6('0xe')]===_0x89a6('0x5')&&_0x2d2522['key']){_0x215fd0[_0x89a6('0xd')](util['format'](_0x89a6('0xf'),_0x2d2522[_0x89a6('0x10')],_0x2d2522[_0x89a6('0x11')]));}else if(_0x2d2522[_0x89a6('0xe')]===_0x89a6('0x7')&&_0x2d2522[_0x89a6('0x8')]&&_0x2d2522[_0x89a6('0x10')]){_0x503551[_0x2d2522[_0x89a6('0x8')]]&&_0x215fd0[_0x89a6('0xd')](util[_0x89a6('0x12')](_0x89a6('0xf'),_0x2d2522[_0x89a6('0x10')],_0x503551[_0x2d2522[_0x89a6('0x8')]]));}else if(_0x2d2522[_0x89a6('0xe')]===_0x89a6('0x9')&&_0x2d2522[_0x89a6('0xa')]&&_0x2d2522[_0x89a6('0xa')][_0x89a6('0xb')]&&_0x2d2522[_0x89a6('0x10')]){_0x503551[_0x2d2522['Variable'][_0x89a6('0xb')]['toLowerCase']()]&&_0x215fd0[_0x89a6('0xd')](util[_0x89a6('0x12')](_0x89a6('0xf'),_0x2d2522[_0x89a6('0x10')],_0x503551[_0x2d2522[_0x89a6('0xa')][_0x89a6('0xb')][_0x89a6('0xc')]()]));}}}}return _0x215fd0[_0x89a6('0x13')](_0x5723b8);};exports['stripTrailingSlash']=function(_0x1ebc09){var _0xb17e58=_0x1ebc09['slice'](-0x1);if(_0xb17e58==='/'){_0x1ebc09=_0x1ebc09[_0x89a6('0x14')](0x0,_0x1ebc09[_0x89a6('0x15')](_0xb17e58));}return _0x1ebc09;};exports['validateEmail']=function(_0x51a5fd){if(!_[_0x89a6('0x16')](_0x51a5fd)&&_0x51a5fd!==''){var _0x35ecda=/^(([^<>()\[\]\\.,;:\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 _0x35ecda[_0x89a6('0x17')](String(_0x51a5fd)[_0x89a6('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x9461=['stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','sortBy','string','push','content','type','variable','variableName','toString','Variable','name','toLowerCase','keyValue','keyType','key','format','keyContent','%s:\x20%s','customVariable'];(function(_0x4cc492,_0x162c85){var _0x1f36b9=function(_0xce4b2){while(--_0xce4b2){_0x4cc492['push'](_0x4cc492['shift']());}};_0x1f36b9(++_0x162c85);}(_0x9461,0x1e3));var _0x1946=function(_0x388314,_0x32fd85){_0x388314=_0x388314-0x0;var _0x28b509=_0x9461[_0x388314];return _0x28b509;};'use strict';var _=require(_0x1946('0x0'));var util=require(_0x1946('0x1'));exports[_0x1946('0x2')]=function(_0x1a03e9,_0x49ca96,_0x2329e4){var _0x23fa69=[];if(_0x1a03e9['length']>0x0){var _0xb866ce=_[_0x1946('0x3')](_0x1a03e9,['id']);for(var _0x179163=0x0;_0x179163<_0xb866ce['length'];_0x179163++){var _0x35fffc=_0xb866ce[_0x179163];if(_0x35fffc['type']===_0x1946('0x4')){_0x23fa69[_0x1946('0x5')](_0x35fffc[_0x1946('0x6')]);}else if(_0x35fffc[_0x1946('0x7')]===_0x1946('0x8')&&_0x35fffc[_0x1946('0x9')]){_0x49ca96[_0x35fffc[_0x1946('0x9')]]&&_0x23fa69[_0x1946('0x5')](_0x49ca96[_0x35fffc['variableName']][_0x1946('0xa')]());}else if(_0x35fffc[_0x1946('0x7')]==='customVariable'&&_0x35fffc[_0x1946('0xb')]&&_0x35fffc[_0x1946('0xb')][_0x1946('0xc')]){_0x49ca96[_0x35fffc[_0x1946('0xb')]['name'][_0x1946('0xd')]()]&&_0x23fa69[_0x1946('0x5')](_0x49ca96[_0x35fffc[_0x1946('0xb')]['name'][_0x1946('0xd')]()]['toString']());}else if(_0x35fffc[_0x1946('0x7')]===_0x1946('0xe')){if(_0x35fffc[_0x1946('0xf')]===_0x1946('0x4')&&_0x35fffc[_0x1946('0x10')]){_0x23fa69[_0x1946('0x5')](util[_0x1946('0x11')]('%s:\x20%s',_0x35fffc['key'],_0x35fffc[_0x1946('0x12')]));}else if(_0x35fffc['keyType']===_0x1946('0x8')&&_0x35fffc[_0x1946('0x9')]&&_0x35fffc[_0x1946('0x10')]){_0x49ca96[_0x35fffc[_0x1946('0x9')]]&&_0x23fa69['push'](util[_0x1946('0x11')](_0x1946('0x13'),_0x35fffc[_0x1946('0x10')],_0x49ca96[_0x35fffc[_0x1946('0x9')]]));}else if(_0x35fffc[_0x1946('0xf')]===_0x1946('0x14')&&_0x35fffc[_0x1946('0xb')]&&_0x35fffc[_0x1946('0xb')][_0x1946('0xc')]&&_0x35fffc['key']){_0x49ca96[_0x35fffc['Variable']['name'][_0x1946('0xd')]()]&&_0x23fa69[_0x1946('0x5')](util[_0x1946('0x11')](_0x1946('0x13'),_0x35fffc[_0x1946('0x10')],_0x49ca96[_0x35fffc[_0x1946('0xb')][_0x1946('0xc')]['toLowerCase']()]));}}}}return _0x23fa69['join'](_0x2329e4);};exports[_0x1946('0x15')]=function(_0x1723ed){var _0x5b196b=_0x1723ed[_0x1946('0x16')](-0x1);if(_0x5b196b==='/'){_0x1723ed=_0x1723ed[_0x1946('0x17')](0x0,_0x1723ed[_0x1946('0x18')](_0x5b196b));}return _0x1723ed;};exports[_0x1946('0x19')]=function(_0x1a55ec){if(!_[_0x1946('0x1a')](_0x1a55ec)&&_0x1a55ec!==''){var _0x23adb6=/^(([^<>()\[\]\\.,;:\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 _0x23adb6[_0x1946('0x1b')](String(_0x1a55ec)['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 035e81d..adb3202 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x178236,_0x4ba736){var _0x21a2ef=function(_0xd69960){while(--_0xd69960){_0x178236['push'](_0x178236['shift']());}};_0x21a2ef(++_0x4ba736);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _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(_0x1ff26a,_0x22431f){var _0x3e1197=function(_0x2d371c){while(--_0x2d371c){_0x1ff26a['push'](_0x1ff26a['shift']());}};_0x3e1197(++_0x22431f);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'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 774823c..e4ecac7 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 _0x3f69=['customVariable','Variable','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','stripTrailingSlash','recordingFormat','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','[OUTBOUND]','user:%s','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','localhost','socket.io-emitter','emit','Creating\x20new\x20ticket...','format','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','Enduser\x20found!','authType','password','token','%s/token:%s','username','Basic\x20%s','toString','debug','[HTTP]','GET','map','includes','picklist','type','nameField','toLowerCase','content','customField','custom_fields','push','variable','variableName','idField'];(function(_0xd5bfff,_0x1baece){var _0x576f93=function(_0x5236e7){while(--_0x5236e7){_0xd5bfff['push'](_0xd5bfff['shift']());}};_0x576f93(++_0x1baece);}(_0x3f69,0x92));var _0x93f6=function(_0x1cf4b3,_0x313379){_0x1cf4b3=_0x1cf4b3-0x0;var _0x2bcd90=_0x3f69[_0x1cf4b3];return _0x2bcd90;};'use strict';var _=require(_0x93f6('0x0'));var rp=require('request-promise');var md5=require(_0x93f6('0x1'));var util=require(_0x93f6('0x2'));var Redis=require('ioredis');var intUtil=require(_0x93f6('0x3'));var config=require(_0x93f6('0x4'));var logger=require(_0x93f6('0x5'))(_0x93f6('0x6'));config['redis']=_[_0x93f6('0x7')](config[_0x93f6('0x8')],{'host':_0x93f6('0x9'),'port':0x18eb});var io=require(_0x93f6('0xa'))(new Redis(config['redis']));function emit(_0x1a0fba,_0x4443f4,_0x2fbb38){io['to'](_0x1a0fba)[_0x93f6('0xb')](_0x4443f4,_0x2fbb38);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getTicket(_0x586ab0,_0x453c2f,_0x57e97e,_0x4c35ee,_0xd6b5e1){logger['info'](_0x93f6('0xc'));return request({'uri':util[_0x93f6('0xd')]('%s/tickets.json',_0x586ab0[_0x93f6('0xe')]),'method':_0x93f6('0xf'),'body':{'ticket':_['merge']({'requester_id':_0x57e97e['id'],'submitter_id':_0x453c2f?_0x453c2f['id']:undefined,'assignee_id':_0x453c2f?_0x453c2f['id']:undefined,'tags':getTags(_0x4c35ee[_0x93f6('0x10')],_0x93f6('0x11')),'subject':intUtil[_0x93f6('0x12')](_0x4c35ee[_0x93f6('0x13')],_0xd6b5e1,'\x20'),'description':intUtil[_0x93f6('0x12')](_0x4c35ee[_0x93f6('0x14')],_0xd6b5e1,'\x0a'),'comment':{'public':![],'body':intUtil[_0x93f6('0x12')](_0x4c35ee[_0x93f6('0x14')],_0xd6b5e1,'\x0a')}},getCustomFields(_0x4c35ee['Fields'],_0xd6b5e1))}})[_0x93f6('0x15')](function(_0x16b113){logger[_0x93f6('0x16')](_0x93f6('0x17'));return _0x16b113[_0x93f6('0x18')];});}function getUser(_0x4d458e,_0x555774){if(intUtil[_0x93f6('0x19')](_0x555774)){logger['info'](_0x93f6('0x1a'),_0x555774);return request({'uri':util[_0x93f6('0xd')](_0x93f6('0x1b'),_0x4d458e[_0x93f6('0xe')]),'qs':{'query':util['format'](_0x93f6('0x1c'),_0x555774)}})[_0x93f6('0x15')](function(_0x48eb56){if(_0x48eb56['count']){logger[_0x93f6('0x16')](_0x93f6('0x1d'));return _[_0x93f6('0x1e')](_0x48eb56[_0x93f6('0x1f')],{'email':_0x555774,'role':_0x93f6('0x20')});}else{logger[_0x93f6('0x16')](_0x93f6('0x21'));return request({'uri':util[_0x93f6('0xd')](_0x93f6('0x22'),_0x4d458e['remoteUri'])})[_0x93f6('0x15')](function(_0x5c68eb){logger[_0x93f6('0x16')]('Admin\x20account\x20selected.');return _0x5c68eb['user'];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x93f6('0x22'),_0x4d458e[_0x93f6('0xe')])})[_0x93f6('0x15')](function(_0x4349b0){logger[_0x93f6('0x16')](_0x93f6('0x23'));return _0x4349b0[_0x93f6('0x24')];});}}function getEndUser(_0x120c9a,_0x3c0ca0,_0x383271){logger['info'](_0x93f6('0x25'),_0x383271);return request({'uri':util[_0x93f6('0xd')](_0x93f6('0x1b'),_0x120c9a['remoteUri']),'qs':{'query':util['format'](_0x93f6('0x26'),_0x383271)}})[_0x93f6('0x15')](function(_0x1e7d79){var _0x483b15;if(_0x1e7d79['results'][_0x93f6('0x27')]){_0x1e7d79[_0x93f6('0x1f')]=_[_0x93f6('0x28')](_0x1e7d79['results'],{'suspended':![],'role':_0x93f6('0x29')});if(_0x1e7d79[_0x93f6('0x1f')][_0x93f6('0x27')]){_0x483b15=_['first'](_0x1e7d79[_0x93f6('0x1f')]);}}if(_0x483b15){logger[_0x93f6('0x16')](_0x93f6('0x2a'));return _0x483b15;}else{logger[_0x93f6('0x16')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format']('%s/users.json',_0x120c9a[_0x93f6('0xe')]),'method':_0x93f6('0xf'),'body':{'user':{'role':'end-user','name':util[_0x93f6('0xd')]('Caller\x20-\x20%s',_0x3c0ca0||_0x383271),'phone':_0x383271}}})[_0x93f6('0x15')](function(_0x39f7a0){logger['info']('Enduser\x20created.');return _0x39f7a0['user'];});}});}function getAuth(_0x2662ab){var _0x57272b;if(_0x2662ab[_0x93f6('0x2b')]===_0x93f6('0x2c')){_0x57272b=util[_0x93f6('0xd')]('%s:%s',_0x2662ab['username'],_0x2662ab[_0x93f6('0x2c')]);}else if(_0x2662ab['authType']===_0x93f6('0x2d')){_0x57272b=util['format'](_0x93f6('0x2e'),_0x2662ab[_0x93f6('0x2f')],_0x2662ab[_0x93f6('0x2d')]);}return util[_0x93f6('0xd')](_0x93f6('0x30'),new Buffer(_0x57272b)[_0x93f6('0x31')]('base64'));}function request(_0x204bdf){logger[_0x93f6('0x32')](_0x93f6('0x33'),JSON['stringify'](_0x204bdf));return rp(_[_0x93f6('0x7')](_0x204bdf,{'method':_0x93f6('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x32e396,_0x4a7bcc){var _0x496f27=[];if(_0x32e396&&_0x32e396[_0x93f6('0x27')]>0x0){_0x496f27=_[_0x93f6('0x35')](_0x32e396,_0x4a7bcc);}return _0x496f27;}function getCustomFields(_0x20f4eb,_0xd54134){var _0xf207c0=[];var _0x3ca814={'custom_fields':[]};if(_0x20f4eb[_0x93f6('0x27')]>0x0){_['forEach'](_0x20f4eb,function(_0x2af199){if(_[_0x93f6('0x36')](['string',_0x93f6('0x37')],_0x2af199[_0x93f6('0x38')])&&_0x2af199[_0x93f6('0x39')]&&!_0x2af199['customField']){_0x3ca814[_0x2af199[_0x93f6('0x39')][_0x93f6('0x3a')]()]=_0x2af199[_0x93f6('0x3b')]['toString']();}else if(_['includes'](['string',_0x93f6('0x37')],_0x2af199['type'])&&_0x2af199['idField']&&_0x2af199[_0x93f6('0x3c')]){_0x3ca814[_0x93f6('0x3d')][_0x93f6('0x3e')]({'id':_0x2af199['idField'],'value':_0x2af199[_0x93f6('0x3b')]['toString']()});}else if(_0x2af199['type']===_0x93f6('0x3f')&&_0x2af199[_0x93f6('0x40')]&&_0x2af199[_0x93f6('0x41')]&&_0x2af199['customField']){_0xd54134[_0x2af199['variableName']]&&_0x3ca814[_0x93f6('0x3d')][_0x93f6('0x3e')]({'id':_0x2af199[_0x93f6('0x41')],'value':_0xd54134[_0x2af199['variableName']][_0x93f6('0x31')]()});}else if(_0x2af199[_0x93f6('0x38')]===_0x93f6('0x42')&&_0x2af199[_0x93f6('0x43')]&&_0x2af199[_0x93f6('0x43')][_0x93f6('0x11')]&&_0x2af199[_0x93f6('0x41')]&&_0x2af199[_0x93f6('0x3c')]){_0xd54134[_0x2af199[_0x93f6('0x43')][_0x93f6('0x11')]['toLowerCase']()]&&_0x3ca814[_0x93f6('0x3d')][_0x93f6('0x3e')]({'id':_0x2af199[_0x93f6('0x41')],'value':_0xd54134[_0x2af199[_0x93f6('0x43')][_0x93f6('0x11')]['toLowerCase']()]['toString']()});}});}return _0x3ca814;}exports['queue']=function(_0x4ee83a,_0x9fedfb,_0x4aaec1,_0x1f143e,_0xa58100,_0x506af0){var _0x90d843,_0x444474;_0x506af0[_0x93f6('0xe')]=intUtil['stripTrailingSlash'](_0x506af0[_0x93f6('0xe')]);_0x506af0[_0x93f6('0x44')]=intUtil['stripTrailingSlash'](_0x506af0[_0x93f6('0x44')]);if(_0xa58100&&_0xa58100[_0x93f6('0x45')]){logger[_0x93f6('0x16')](_0x93f6('0x46'),_0x93f6('0x47'));_0x9fedfb[_0x93f6('0x48')]=util['format'](_0x93f6('0x49'),_0x506af0[_0x93f6('0x44')],_0x9fedfb['uniqueid'],md5(_0x9fedfb[_0x93f6('0x4a')]));}else{_0x9fedfb[_0x93f6('0x48')]='';}headers[_0x93f6('0x4b')]=getAuth(_0x506af0);return getUser(_0x506af0,_0x1f143e[_0x93f6('0x4c')])[_0x93f6('0x15')](function(_0x179130){_0x90d843=_0x179130;logger[_0x93f6('0x16')](_0x93f6('0x4d'),_0x90d843['id']);return getEndUser(_0x506af0,_0x9fedfb['calleridname'],_0x9fedfb[_0x93f6('0x4e')]);})[_0x93f6('0x15')](function(_0x446e85){_0x444474=_0x446e85;logger[_0x93f6('0x16')](_0x93f6('0x4f'),_0x444474['id']);return getTicket(_0x506af0,_0x90d843,_0x444474,_0x4aaec1,_0x9fedfb);})[_0x93f6('0x15')](function(_0x5c3408){if(_0x5c3408){logger[_0x93f6('0x16')]('The\x20Ticket\x20ID\x20is:',_0x5c3408['id']);switch(_0x506af0[_0x93f6('0x38')]){case'integrationTab':logger[_0x93f6('0x16')](_0x93f6('0x46'),_0x93f6('0x50'));return request({'uri':util[_0x93f6('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x506af0[_0x93f6('0xe')],_0x90d843['id'],_0x5c3408['id']),'method':_0x93f6('0xf')});case _0x93f6('0x51'):logger['info'](_0x93f6('0x46'),_0x93f6('0x52'));emit(util['format']('user:%s',_0x1f143e[_0x93f6('0x11')]),_0x93f6('0x53'),{'uri':util['format']('%s/agent/tickets/%s',_0x506af0[_0x93f6('0xe')][_0x93f6('0x54')](_0x93f6('0x55'),''),_0x5c3408['id'])});break;default:logger[_0x93f6('0x56')]('[QUEUE]',_0x93f6('0x57'));}}})[_0x93f6('0x58')](function(_0x1b43e4){logger[_0x93f6('0x56')](_0x93f6('0x59'),util['inspect'](_0x1b43e4,{'showHidden':!![],'depth':null}));});};exports[_0x93f6('0x5a')]=function(_0x3e1b72,_0x5a569d,_0x9aeec2,_0x169f94,_0x595e81,_0x5c921d,_0x30ef6d){var _0x178b00,_0x17a6bc;_0x5c921d['remoteUri']=intUtil[_0x93f6('0x5b')](_0x5c921d['remoteUri']);_0x5c921d[_0x93f6('0x44')]=intUtil[_0x93f6('0x5b')](_0x5c921d['serverUrl']);if(_0x30ef6d&&_0x30ef6d[_0x93f6('0x5c')]&&_0x30ef6d[_0x93f6('0x5c')]!=='none'){logger[_0x93f6('0x16')]('[OUTBOUND]',_0x93f6('0x47'));_0x5a569d[_0x93f6('0x48')]=util[_0x93f6('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5c921d[_0x93f6('0x44')],_0x5a569d['uniqueid'],md5(_0x5a569d[_0x93f6('0x4a')]));}headers[_0x93f6('0x4b')]=getAuth(_0x5c921d);return getUser(_0x5c921d,_0x169f94['email'])['then'](function(_0x3256b7){_0x178b00=_0x3256b7;logger[_0x93f6('0x16')](_0x93f6('0x4d'),_0x178b00['id']);return getEndUser(_0x5c921d,_0x5a569d[_0x93f6('0x5d')],_0x5a569d[_0x93f6('0x5e')]);})[_0x93f6('0x15')](function(_0x352333){_0x17a6bc=_0x352333;logger[_0x93f6('0x16')]('The\x20Enduser\x20ID\x20is:',_0x17a6bc['id']);return getTicket(_0x5c921d,_0x178b00,_0x17a6bc,_0x9aeec2,_0x5a569d);})[_0x93f6('0x15')](function(_0x10291e){if(_0x10291e){logger[_0x93f6('0x16')](_0x93f6('0x5f'),_0x10291e['id']);switch(_0x5c921d[_0x93f6('0x38')]){case'integrationTab':logger[_0x93f6('0x16')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x93f6('0xd')](_0x93f6('0x60'),_0x5c921d['remoteUri'],_0x178b00['id'],_0x10291e['id']),'method':_0x93f6('0xf')});case _0x93f6('0x51'):logger['info'](_0x93f6('0x61'),_0x93f6('0x52'));emit(util[_0x93f6('0xd')](_0x93f6('0x62'),_0x169f94[_0x93f6('0x11')]),_0x93f6('0x53'),{'uri':util['format'](_0x93f6('0x63'),_0x5c921d['remoteUri']['replace'](_0x93f6('0x55'),''),_0x10291e['id'])});break;default:logger['error'](_0x93f6('0x61'),_0x93f6('0x57'));}}})[_0x93f6('0x58')](function(_0x4c62fa){logger['error'](_0x93f6('0x64'),util[_0x93f6('0x65')](_0x4c62fa,{'showHidden':!![],'depth':null}));});};exports[_0x93f6('0x66')]=function(_0x251a8e,_0x4ac1b2,_0x929af2,_0x17a555,_0x405ba6,_0x6160b){var _0x4cda74,_0x48ea71;_0x6160b[_0x93f6('0xe')]=intUtil[_0x93f6('0x5b')](_0x6160b[_0x93f6('0xe')]);_0x6160b[_0x93f6('0x44')]=intUtil[_0x93f6('0x5b')](_0x6160b[_0x93f6('0x44')]);if(_0x405ba6&&_0x405ba6[_0x93f6('0x45')]){logger[_0x93f6('0x16')]('['+_0x4ac1b2['lastevent'][_0x93f6('0x67')]()+']','Recording\x20is\x20enabled!');_0x4ac1b2[_0x93f6('0x48')]=util[_0x93f6('0xd')](_0x93f6('0x49'),_0x6160b[_0x93f6('0x44')],_0x4ac1b2['uniqueid'],md5(_0x4ac1b2[_0x93f6('0x4a')]));}else{_0x4ac1b2[_0x93f6('0x48')]='';}headers[_0x93f6('0x4b')]=getAuth(_0x6160b);return getUser(_0x6160b)['then'](function(_0x5553d4){_0x4cda74=_0x5553d4;logger[_0x93f6('0x16')](_0x93f6('0x4d'),_0x4cda74['id']);return getEndUser(_0x6160b,_0x4ac1b2['calleridname'],_0x4ac1b2[_0x93f6('0x4e')]);})[_0x93f6('0x15')](function(_0x5d34e7){_0x48ea71=_0x5d34e7;logger[_0x93f6('0x16')](_0x93f6('0x4f'),_0x48ea71['id']);return getTicket(_0x6160b,_0x4cda74,_0x48ea71,_0x929af2,_0x4ac1b2);})[_0x93f6('0x15')](function(_0x380800){if(_0x380800){logger[_0x93f6('0x16')]('The\x20Ticket\x20ID\x20is:',_0x380800['id']);}})[_0x93f6('0x58')](function(_0x2b9fba){logger[_0x93f6('0x56')]('['+_0x4ac1b2[_0x93f6('0x68')][_0x93f6('0x67')]()+']'+_0x93f6('0x69'),util[_0x93f6('0x65')](_0x2b9fba,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2444=['authType','%s:%s','username','password','token','%s/token:%s','toString','base64','debug','stringify','defaults','map','string','picklist','type','nameField','customField','toLowerCase','includes','custom_fields','push','variable','variableName','idField','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','user:%s','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','/api/v2','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x2444,0xb5));var _0x4244=function(_0x52ac93,_0x19d0e9){_0x52ac93=_0x52ac93-0x0;var _0x2a80f7=_0x2444[_0x52ac93];return _0x2a80f7;};'use strict';var _=require(_0x4244('0x0'));var rp=require('request-promise');var md5=require(_0x4244('0x1'));var util=require(_0x4244('0x2'));var Redis=require(_0x4244('0x3'));var intUtil=require('./util');var config=require(_0x4244('0x4'));var logger=require(_0x4244('0x5'))(_0x4244('0x6'));config[_0x4244('0x7')]=_['defaults'](config[_0x4244('0x7')],{'host':_0x4244('0x8'),'port':0x18eb});var io=require(_0x4244('0x9'))(new Redis(config[_0x4244('0x7')]));function emit(_0x18bdc,_0x444824,_0x3abc52){io['to'](_0x18bdc)[_0x4244('0xa')](_0x444824,_0x3abc52);}var headers={'Content-Type':_0x4244('0xb'),'Accept':_0x4244('0xb')};function getTicket(_0x445133,_0x13d953,_0x2c8f83,_0x49365d,_0x96b209){logger['info'](_0x4244('0xc'));return request({'uri':util['format'](_0x4244('0xd'),_0x445133[_0x4244('0xe')]),'method':_0x4244('0xf'),'body':{'ticket':_['merge']({'requester_id':_0x2c8f83['id'],'submitter_id':_0x13d953?_0x13d953['id']:undefined,'assignee_id':_0x13d953?_0x13d953['id']:undefined,'tags':getTags(_0x49365d[_0x4244('0x10')],_0x4244('0x11')),'subject':intUtil[_0x4244('0x12')](_0x49365d[_0x4244('0x13')],_0x96b209,'\x20'),'description':intUtil[_0x4244('0x12')](_0x49365d[_0x4244('0x14')],_0x96b209,'\x0a'),'comment':{'public':![],'body':intUtil[_0x4244('0x12')](_0x49365d[_0x4244('0x14')],_0x96b209,'\x0a')}},getCustomFields(_0x49365d[_0x4244('0x15')],_0x96b209))}})[_0x4244('0x16')](function(_0x4964bb){logger['info'](_0x4244('0x17'));return _0x4964bb[_0x4244('0x18')];});}function getUser(_0x51d362,_0x4ebc73){if(intUtil[_0x4244('0x19')](_0x4ebc73)){logger[_0x4244('0x1a')](_0x4244('0x1b'),_0x4ebc73);return request({'uri':util[_0x4244('0x1c')](_0x4244('0x1d'),_0x51d362[_0x4244('0xe')]),'qs':{'query':util[_0x4244('0x1c')](_0x4244('0x1e'),_0x4ebc73)}})[_0x4244('0x16')](function(_0x23dd44){if(_0x23dd44[_0x4244('0x1f')]){logger[_0x4244('0x1a')](_0x4244('0x20'));return _[_0x4244('0x21')](_0x23dd44[_0x4244('0x22')],{'email':_0x4ebc73,'role':'agent'});}else{logger['info'](_0x4244('0x23'));return request({'uri':util[_0x4244('0x1c')](_0x4244('0x24'),_0x51d362['remoteUri'])})[_0x4244('0x16')](function(_0x40da05){logger[_0x4244('0x1a')]('Admin\x20account\x20selected.');return _0x40da05[_0x4244('0x25')];});}});}else{logger[_0x4244('0x1a')](_0x4244('0x23'));return request({'uri':util['format'](_0x4244('0x24'),_0x51d362[_0x4244('0xe')])})['then'](function(_0x4762f2){logger[_0x4244('0x1a')](_0x4244('0x26'));return _0x4762f2[_0x4244('0x25')];});}}function getEndUser(_0x49f76f,_0x15a218,_0x32b6e4){logger[_0x4244('0x1a')](_0x4244('0x27'),_0x32b6e4);return request({'uri':util[_0x4244('0x1c')](_0x4244('0x1d'),_0x49f76f[_0x4244('0xe')]),'qs':{'query':util[_0x4244('0x1c')](_0x4244('0x28'),_0x32b6e4)}})[_0x4244('0x16')](function(_0x1e172f){var _0x2a55f1;if(_0x1e172f['results'][_0x4244('0x29')]){_0x1e172f['results']=_[_0x4244('0x2a')](_0x1e172f[_0x4244('0x22')],{'suspended':![],'role':_0x4244('0x2b')});if(_0x1e172f[_0x4244('0x22')][_0x4244('0x29')]){_0x2a55f1=_[_0x4244('0x2c')](_0x1e172f[_0x4244('0x22')]);}}if(_0x2a55f1){logger[_0x4244('0x1a')]('Enduser\x20found!');return _0x2a55f1;}else{logger['info'](_0x4244('0x2d'));return request({'uri':util[_0x4244('0x1c')](_0x4244('0x2e'),_0x49f76f[_0x4244('0xe')]),'method':_0x4244('0xf'),'body':{'user':{'role':_0x4244('0x2b'),'name':util[_0x4244('0x1c')](_0x4244('0x2f'),_0x15a218||_0x32b6e4),'phone':_0x32b6e4}}})['then'](function(_0x16b597){logger[_0x4244('0x1a')](_0x4244('0x30'));return _0x16b597[_0x4244('0x25')];});}});}function getAuth(_0x12b1ad){var _0x378074;if(_0x12b1ad[_0x4244('0x31')]==='password'){_0x378074=util[_0x4244('0x1c')](_0x4244('0x32'),_0x12b1ad[_0x4244('0x33')],_0x12b1ad[_0x4244('0x34')]);}else if(_0x12b1ad['authType']===_0x4244('0x35')){_0x378074=util[_0x4244('0x1c')](_0x4244('0x36'),_0x12b1ad[_0x4244('0x33')],_0x12b1ad['token']);}return util[_0x4244('0x1c')]('Basic\x20%s',new Buffer(_0x378074)[_0x4244('0x37')](_0x4244('0x38')));}function request(_0x5e5b1a){logger[_0x4244('0x39')]('[HTTP]',JSON[_0x4244('0x3a')](_0x5e5b1a));return rp(_[_0x4244('0x3b')](_0x5e5b1a,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x3c3820,_0x37dcc8){var _0x3a1c89=[];if(_0x3c3820&&_0x3c3820[_0x4244('0x29')]>0x0){_0x3a1c89=_[_0x4244('0x3c')](_0x3c3820,_0x37dcc8);}return _0x3a1c89;}function getCustomFields(_0xd5dcc4,_0x24391c){var _0x461310=[];var _0x26faf4={'custom_fields':[]};if(_0xd5dcc4[_0x4244('0x29')]>0x0){_['forEach'](_0xd5dcc4,function(_0x3fdc2e){if(_['includes']([_0x4244('0x3d'),_0x4244('0x3e')],_0x3fdc2e[_0x4244('0x3f')])&&_0x3fdc2e[_0x4244('0x40')]&&!_0x3fdc2e[_0x4244('0x41')]){_0x26faf4[_0x3fdc2e['nameField'][_0x4244('0x42')]()]=_0x3fdc2e['content']['toString']();}else if(_[_0x4244('0x43')]([_0x4244('0x3d'),_0x4244('0x3e')],_0x3fdc2e[_0x4244('0x3f')])&&_0x3fdc2e['idField']&&_0x3fdc2e[_0x4244('0x41')]){_0x26faf4[_0x4244('0x44')][_0x4244('0x45')]({'id':_0x3fdc2e['idField'],'value':_0x3fdc2e['content']['toString']()});}else if(_0x3fdc2e[_0x4244('0x3f')]===_0x4244('0x46')&&_0x3fdc2e[_0x4244('0x47')]&&_0x3fdc2e[_0x4244('0x48')]&&_0x3fdc2e[_0x4244('0x41')]){_0x24391c[_0x3fdc2e[_0x4244('0x47')]]&&_0x26faf4[_0x4244('0x44')][_0x4244('0x45')]({'id':_0x3fdc2e[_0x4244('0x48')],'value':_0x24391c[_0x3fdc2e[_0x4244('0x47')]]['toString']()});}else if(_0x3fdc2e[_0x4244('0x3f')]==='customVariable'&&_0x3fdc2e[_0x4244('0x49')]&&_0x3fdc2e[_0x4244('0x49')][_0x4244('0x11')]&&_0x3fdc2e[_0x4244('0x48')]&&_0x3fdc2e['customField']){_0x24391c[_0x3fdc2e[_0x4244('0x49')][_0x4244('0x11')][_0x4244('0x42')]()]&&_0x26faf4[_0x4244('0x44')][_0x4244('0x45')]({'id':_0x3fdc2e[_0x4244('0x48')],'value':_0x24391c[_0x3fdc2e[_0x4244('0x49')][_0x4244('0x11')][_0x4244('0x42')]()]['toString']()});}});}return _0x26faf4;}exports[_0x4244('0x4a')]=function(_0x15e6bd,_0x5d1c8f,_0x2db41c,_0x4379a1,_0x40a927,_0xc51969){var _0x81192e,_0x5d2f26;_0xc51969[_0x4244('0xe')]=intUtil[_0x4244('0x4b')](_0xc51969[_0x4244('0xe')]);_0xc51969[_0x4244('0x4c')]=intUtil[_0x4244('0x4b')](_0xc51969['serverUrl']);if(_0x40a927&&_0x40a927['monitor_format']){logger[_0x4244('0x1a')](_0x4244('0x4d'),'Recording\x20is\x20enabled!');_0x5d1c8f[_0x4244('0x4e')]=util[_0x4244('0x1c')](_0x4244('0x4f'),_0xc51969['serverUrl'],_0x5d1c8f['uniqueid'],md5(_0x5d1c8f[_0x4244('0x50')]));}else{_0x5d1c8f[_0x4244('0x4e')]='';}headers[_0x4244('0x51')]=getAuth(_0xc51969);return getUser(_0xc51969,_0x4379a1[_0x4244('0x52')])['then'](function(_0x412441){_0x81192e=_0x412441;logger['info'](_0x4244('0x53'),_0x81192e['id']);return getEndUser(_0xc51969,_0x5d1c8f[_0x4244('0x54')],_0x5d1c8f[_0x4244('0x55')]);})[_0x4244('0x16')](function(_0x2aba2f){_0x5d2f26=_0x2aba2f;logger[_0x4244('0x1a')]('The\x20Enduser\x20ID\x20is:',_0x5d2f26['id']);return getTicket(_0xc51969,_0x81192e,_0x5d2f26,_0x2db41c,_0x5d1c8f);})[_0x4244('0x16')](function(_0x42ee85){if(_0x42ee85){logger[_0x4244('0x1a')]('The\x20Ticket\x20ID\x20is:',_0x42ee85['id']);switch(_0xc51969[_0x4244('0x3f')]){case _0x4244('0x56'):logger[_0x4244('0x1a')](_0x4244('0x4d'),_0x4244('0x57'));return request({'uri':util[_0x4244('0x1c')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0xc51969[_0x4244('0xe')],_0x81192e['id'],_0x42ee85['id']),'method':_0x4244('0xf')});case _0x4244('0x58'):logger[_0x4244('0x1a')](_0x4244('0x4d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4244('0x1c')](_0x4244('0x59'),_0x4379a1[_0x4244('0x11')]),'trigger:browser:url',{'uri':util[_0x4244('0x1c')](_0x4244('0x5a'),_0xc51969['remoteUri'][_0x4244('0x5b')]('/api/v2',''),_0x42ee85['id'])});break;default:logger[_0x4244('0x5c')](_0x4244('0x4d'),_0x4244('0x5d'));}}})['catch'](function(_0x3d8bac){logger[_0x4244('0x5c')](_0x4244('0x5e'),util[_0x4244('0x5f')](_0x3d8bac,{'showHidden':!![],'depth':null}));});};exports[_0x4244('0x60')]=function(_0x4c13d0,_0x32f326,_0x3b0905,_0x472ee1,_0x178fcb,_0x2c3016,_0x17d723){var _0xff8db4,_0x41f922;_0x2c3016[_0x4244('0xe')]=intUtil['stripTrailingSlash'](_0x2c3016[_0x4244('0xe')]);_0x2c3016[_0x4244('0x4c')]=intUtil[_0x4244('0x4b')](_0x2c3016['serverUrl']);if(_0x17d723&&_0x17d723['recordingFormat']&&_0x17d723['recordingFormat']!==_0x4244('0x61')){logger['info'](_0x4244('0x62'),'Recording\x20is\x20enabled!');_0x32f326[_0x4244('0x4e')]=util[_0x4244('0x1c')](_0x4244('0x4f'),_0x2c3016['serverUrl'],_0x32f326[_0x4244('0x50')],md5(_0x32f326[_0x4244('0x50')]));}headers[_0x4244('0x51')]=getAuth(_0x2c3016);return getUser(_0x2c3016,_0x472ee1[_0x4244('0x52')])[_0x4244('0x16')](function(_0x55439e){_0xff8db4=_0x55439e;logger[_0x4244('0x1a')](_0x4244('0x53'),_0xff8db4['id']);return getEndUser(_0x2c3016,_0x32f326[_0x4244('0x63')],_0x32f326[_0x4244('0x64')]);})[_0x4244('0x16')](function(_0x2cd3f3){_0x41f922=_0x2cd3f3;logger[_0x4244('0x1a')](_0x4244('0x65'),_0x41f922['id']);return getTicket(_0x2c3016,_0xff8db4,_0x41f922,_0x3b0905,_0x32f326);})[_0x4244('0x16')](function(_0x38738f){if(_0x38738f){logger[_0x4244('0x1a')](_0x4244('0x66'),_0x38738f['id']);switch(_0x2c3016[_0x4244('0x3f')]){case _0x4244('0x56'):logger[_0x4244('0x1a')]('[OUTBOUND]',_0x4244('0x57'));return request({'uri':util[_0x4244('0x1c')](_0x4244('0x67'),_0x2c3016[_0x4244('0xe')],_0xff8db4['id'],_0x38738f['id']),'method':_0x4244('0xf')});case'newTab':logger[_0x4244('0x1a')]('[OUTBOUND]',_0x4244('0x68'));emit(util[_0x4244('0x1c')](_0x4244('0x59'),_0x472ee1['name']),_0x4244('0x69'),{'uri':util[_0x4244('0x1c')](_0x4244('0x5a'),_0x2c3016['remoteUri'][_0x4244('0x5b')](_0x4244('0x6a'),''),_0x38738f['id'])});break;default:logger['error'](_0x4244('0x62'),_0x4244('0x5d'));}}})[_0x4244('0x6b')](function(_0x54ffd7){logger[_0x4244('0x5c')](_0x4244('0x6c'),util[_0x4244('0x5f')](_0x54ffd7,{'showHidden':!![],'depth':null}));});};exports[_0x4244('0x6d')]=function(_0x16ad43,_0x1afc04,_0x4055d8,_0x6699e8,_0x1a091b,_0x259af1){var _0x57d48d,_0x57e7d0;_0x259af1[_0x4244('0xe')]=intUtil[_0x4244('0x4b')](_0x259af1['remoteUri']);_0x259af1[_0x4244('0x4c')]=intUtil[_0x4244('0x4b')](_0x259af1[_0x4244('0x4c')]);if(_0x1a091b&&_0x1a091b[_0x4244('0x6e')]){logger[_0x4244('0x1a')]('['+_0x1afc04[_0x4244('0x6f')][_0x4244('0x70')]()+']',_0x4244('0x71'));_0x1afc04[_0x4244('0x4e')]=util[_0x4244('0x1c')](_0x4244('0x4f'),_0x259af1[_0x4244('0x4c')],_0x1afc04['uniqueid'],md5(_0x1afc04[_0x4244('0x50')]));}else{_0x1afc04[_0x4244('0x4e')]='';}headers[_0x4244('0x51')]=getAuth(_0x259af1);return getUser(_0x259af1)[_0x4244('0x16')](function(_0x309339){_0x57d48d=_0x309339;logger[_0x4244('0x1a')](_0x4244('0x53'),_0x57d48d['id']);return getEndUser(_0x259af1,_0x1afc04[_0x4244('0x54')],_0x1afc04[_0x4244('0x55')]);})[_0x4244('0x16')](function(_0x4a1ed6){_0x57e7d0=_0x4a1ed6;logger[_0x4244('0x1a')](_0x4244('0x65'),_0x57e7d0['id']);return getTicket(_0x259af1,_0x57d48d,_0x57e7d0,_0x4055d8,_0x1afc04);})['then'](function(_0x2a35f5){if(_0x2a35f5){logger[_0x4244('0x1a')](_0x4244('0x66'),_0x2a35f5['id']);}})[_0x4244('0x6b')](function(_0x53bc68){logger[_0x4244('0x5c')]('['+_0x1afc04['lastevent']['toUpperCase']()+']'+_0x4244('0x72'),util[_0x4244('0x5f')](_0x53bc68,{'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 fcba6eb..454c5b9 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 _0x6177=['error','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','enduserType','Error:\x20','log','CREATE\x20ERROR','GET','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','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','complete','connect','Call_Result','Rejected','abandoned','timeout','Call_Start_Time','agentcalledAt','Call_Type','merge','/crm/v2/Calls','Call\x20created!','err','stack','queue','stripTrailingSlash','host','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','Inbound','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','outbound','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','/crm/EntityInfo.do?module=Calls&id=','[OUTBOUND]','unmanaged','toUpperCase','request-promise','md5','util','./util','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','refresh_token','then','add','expires_in','seconds','catch','Failing\x20creating\x20the\x20access_token','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','info','Using\x20the\x20admin\x20account!','profile','user','Administrator'];(function(_0x1861d2,_0x217fde){var _0x4a3f68=function(_0x441b46){while(--_0x441b46){_0x1861d2['push'](_0x1861d2['shift']());}};_0x4a3f68(++_0x217fde);}(_0x6177,0x192));var _0x7617=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x6177[_0x5834bc];return _0x3e183a;};'use strict';var _=require('lodash');var rp=require(_0x7617('0x0'));var md5=require(_0x7617('0x1'));var util=require(_0x7617('0x2'));var intUtil=require(_0x7617('0x3'));var moment=require('moment');var Redis=require('ioredis');var BPromise=require(_0x7617('0x4'));var config=require(_0x7617('0x5'));var logger=require(_0x7617('0x6'))(_0x7617('0x7'));config[_0x7617('0x8')]=_[_0x7617('0x9')](config[_0x7617('0x8')],{'host':_0x7617('0xa'),'port':0x18eb});var io=require(_0x7617('0xb'))(new Redis(config[_0x7617('0x8')]));function emit(_0x429169,_0x17ae72,_0x3d793a){io['to'](_0x429169)[_0x7617('0xc')](_0x17ae72,_0x3d793a);}function request(_0x4f5771){logger[_0x7617('0xd')](_0x7617('0xe'),JSON[_0x7617('0xf')](_0x4f5771));return rp(_0x4f5771);}function getCustomFields(_0xa29410,_0x9715f2){var _0x5611e6={};if(_0xa29410['length']>0x0){_['forEach'](_0xa29410,function(_0x2e0a5b){if(_['includes'](['string',_0x7617('0x10')],_0x2e0a5b[_0x7617('0x11')])&&_0x2e0a5b['idField']){_0x5611e6[_0x2e0a5b[_0x7617('0x12')]]=_0x2e0a5b[_0x7617('0x13')][_0x7617('0x14')]();}else if(_0x2e0a5b['type']===_0x7617('0x15')&&_0x2e0a5b['variableName']&&_0x2e0a5b[_0x7617('0x12')]&&_0x9715f2[_0x2e0a5b[_0x7617('0x16')]]){_0x5611e6[_0x2e0a5b[_0x7617('0x12')]]=_0x9715f2[_0x2e0a5b[_0x7617('0x16')]][_0x7617('0x14')]();}else if(_0x2e0a5b[_0x7617('0x11')]===_0x7617('0x17')&&_0x2e0a5b[_0x7617('0x18')]&&_0x2e0a5b[_0x7617('0x18')][_0x7617('0x19')]&&_0x2e0a5b[_0x7617('0x12')]&&_0x9715f2[_0x2e0a5b[_0x7617('0x18')][_0x7617('0x19')][_0x7617('0x1a')]()]){_0x5611e6[_0x2e0a5b[_0x7617('0x12')]]=_0x9715f2[_0x2e0a5b[_0x7617('0x18')]['name'][_0x7617('0x1a')]()]['toString']();}});}return _0x5611e6;}function getName(_0x2d2c75){if(_0x2d2c75['indexOf']('\x20')>0x0){var _0x2e4de6=_0x2d2c75[_0x7617('0x1b')](/ (.+)/);if(_0x2e4de6[0x1]){return _0x2e4de6;}}return[_0x2d2c75,_0x2d2c75];}var accountsTokens={};function getAccessToken(_0x1ec898){return new Promise(function(_0x3c643b,_0x2f2206){if(!_[_0x7617('0x1c')](accountsTokens[_0x1ec898['id']])&&!_[_0x7617('0x1c')](accountsTokens[_0x1ec898['id']][_0x7617('0x1d')])){if(moment()[_0x7617('0x1e')](accountsTokens[_0x1ec898['id']]['expires_in'])){_0x3c643b(accountsTokens[_0x1ec898['id']][_0x7617('0x1d')]);}}var _0x53dc59;switch(_0x1ec898[_0x7617('0x1f')]){case'US':_0x53dc59=_0x7617('0x20');break;case'AU':_0x53dc59=_0x7617('0x21');break;case'EU':_0x53dc59=_0x7617('0x22');break;case'IN':_0x53dc59='https://accounts.zoho.in';break;case'CN':_0x53dc59=_0x7617('0x23');break;default:_0x53dc59=_0x7617('0x22');break;}var _0x3ce127={'method':_0x7617('0x24'),'uri':_0x53dc59+_0x7617('0x25'),'qs':{'refresh_token':_0x1ec898[_0x7617('0x26')],'client_id':_0x1ec898['clientId'],'client_secret':_0x1ec898['clientSecret'],'grant_type':_0x7617('0x27')},'json':!![]};return rp(_0x3ce127)[_0x7617('0x28')](function(_0x56b495){accountsTokens[_0x1ec898['id']]={'access_token':_0x56b495['access_token'],'expires_in':moment()[_0x7617('0x29')](_0x56b495[_0x7617('0x2a')],_0x7617('0x2b'))};_0x3c643b(_0x56b495['access_token']);})[_0x7617('0x2c')](function(_0x123832){logger['error'](_0x7617('0x2d'),_0x123832['stack']);_0x2f2206(_0x123832);});});}function getUser(_0x4ce575,_0x105f56,_0x1334c9,_0x212ea5){logger['info'](_0x7617('0x2e'));return request({'method':'GET','uri':util[_0x7617('0x2f')](_0x7617('0x30'),_0x105f56),'qs':{'type':_0x7617('0x31')},'headers':{'Authorization':_0x7617('0x32')+_0x4ce575},'json':!![]})[_0x7617('0x28')](function(_0x548270){if(_0x548270[_0x7617('0x33')]){var _0x5e634d=-0x1;if(_[_0x7617('0x34')](_0x548270[_0x7617('0x33')])){if(!_[_0x7617('0x1c')](_0x212ea5)){_0x5e634d=_[_0x7617('0x35')](_0x548270[_0x7617('0x33')],function(_0x3d7a28){return _0x3d7a28[_0x7617('0x36')]===_0x212ea5;});}if(_0x5e634d>=0x0){logger[_0x7617('0x37')]('Agent\x20found!');}else{logger['info'](_0x7617('0x38'));_0x5e634d=_['findIndex'](_0x548270[_0x7617('0x33')],function(_0x351b67){return _0x351b67[_0x7617('0x39')][_0x7617('0x19')]==='Administrator';});}return _0x548270['users'][_0x5e634d];}else{if(_0x548270[_0x7617('0x3a')][_0x7617('0x39')][_0x7617('0x19')]===_0x7617('0x3b')){logger[_0x7617('0x37')](_0x7617('0x38'));user=_0x548270[_0x7617('0x3a')];return user;}else{logger[_0x7617('0x3c')]('The\x20failing\x20result\x20is',JSON[_0x7617('0xf')](_0x548270));throw new Error(_0x7617('0x3d')+JSON[_0x7617('0xf')](_0x548270));}}}else{logger[_0x7617('0x3c')](_0x7617('0x3e'),JSON[_0x7617('0xf')](_0x548270));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x7617('0xf')](_0x548270));}})[_0x7617('0x2c')](function(_0x544f3f){console['error'](_0x544f3f);});}function getZohoUser(_0x33aaf6,_0x3aa6d0){return new BPromise(function(_0x57917e,_0x51aa6b){request(_0x33aaf6)[_0x7617('0x28')](function(_0x5985a2){var _0x520c6f=null;if(_0x5985a2){_0x520c6f=_0x5985a2[_0x7617('0x3f')][0x0];_0x520c6f['enduserType']=_0x3aa6d0;}_0x57917e(_0x520c6f);})['catch'](function(_0x592550){_0x51aa6b(_0x592550);});});}function createEndUser(_0x378f38,_0x5726e9,_0x5d840c,_0x3a95b9,_0x20362b,_0x4d5629){var _0x5d840c=getName(_0x5d840c);return request({'method':_0x7617('0x24'),'uri':_0x7617('0x40')+_0x5726e9+'/crm/v2/'+_[_0x7617('0x41')](_0x4d5629[_0x7617('0x42')])+'s','body':{'data':[{'Last_Name':_0x5d840c[0x1],'First_Name':_0x5d840c[0x0],'Phone':_0x3a95b9,'Owner':{'name':!_[_0x7617('0x1c')](_0x20362b['role'][_0x7617('0x19')])?_0x20362b[_0x7617('0x43')][_0x7617('0x19')]:!_['isNil'](_0x20362b['first_name'])?_0x20362b[_0x7617('0x44')]+'\x20'+_0x20362b[_0x7617('0x45')]:_0x20362b[_0x7617('0x45')],'id':_0x20362b['id']}}]},'headers':{'Authorization':_0x7617('0x32')+_0x378f38},'json':!![]})[_0x7617('0x28')](function(_0x33e8b6){if(_0x33e8b6&&_0x33e8b6['data'][0x0][_0x7617('0x46')]===_0x7617('0x47')){var _0x51527d=_0x33e8b6[_0x7617('0x3f')][0x0][_0x7617('0x48')];_0x51527d[_0x7617('0x49')]=_[_0x7617('0x41')](_0x4d5629['moduleCreate'])+'s';return _0x51527d;}logger[_0x7617('0x3c')]('The\x20failing\x20result\x20is',JSON[_0x7617('0xf')](data));throw new Error(_0x7617('0x4a')+JSON[_0x7617('0xf')](data));})['catch'](function(_0x5373d6){console[_0x7617('0x4b')](_0x7617('0x4c'),_0x5373d6);});}function getEndUser(_0x11f29e,_0x5587e2,_0x547818,_0x19a3a6,_0x4580e2,_0x20fc89,_0x525c44){var _0x5aaacc={'method':_0x7617('0x4d'),'uri':'','headers':{'Authorization':_0x7617('0x32')+_0x11f29e},'json':!![]};switch(_0x525c44['moduleSearch']){case _0x7617('0x4e'):_0x5aaacc[_0x7617('0x4f')]=_0x7617('0x40')+_0x5587e2+_0x7617('0x50')+_0x4580e2+'))';return getZohoUser(_0x5aaacc,_0x7617('0x51'))[_0x7617('0x28')](function(_0x379f36){if(_0x379f36)return _0x379f36;_0x5aaacc[_0x7617('0x4f')]=_0x7617('0x40')+_0x5587e2+_0x7617('0x52')+_0x4580e2+'))';return getZohoUser(_0x5aaacc,_0x7617('0x53'))['then'](function(_0x31aef6){if(_0x31aef6)return _0x31aef6;if(_0x525c44[_0x7617('0x42')]!=_0x7617('0x54')){return createEndUser(_0x11f29e,_0x5587e2,_0x19a3a6,_0x4580e2,_0x20fc89,_0x525c44);}else{return{};}});});break;case _0x7617('0x55'):_0x5aaacc[_0x7617('0x4f')]=_0x7617('0x40')+_0x5587e2+_0x7617('0x50')+_0x4580e2+'))';return getZohoUser(_0x5aaacc,_0x7617('0x51'))[_0x7617('0x28')](function(_0x2edd77){if(_0x2edd77)return _0x2edd77;if(_0x525c44['moduleCreate']!=_0x7617('0x54')){return createEndUser(_0x11f29e,_0x5587e2,_0x19a3a6,_0x4580e2,_0x20fc89,_0x525c44);}else{return{};}});break;case _0x7617('0x56'):_0x5aaacc['uri']=_0x7617('0x40')+_0x5587e2+_0x7617('0x52')+_0x4580e2+'))';return getZohoUser(_0x5aaacc,_0x7617('0x53'))[_0x7617('0x28')](function(_0x5f331b){if(_0x5f331b)return _0x5f331b;if(_0x525c44['moduleCreate']!=_0x7617('0x54')){return createEndUser(_0x11f29e,_0x5587e2,_0x19a3a6,_0x4580e2,_0x20fc89,_0x525c44);}else{return{};}});break;}}function getCall(_0x231aca,_0x4781c3,_0x403e0a,_0x59bda5,_0x36caab,_0x5e269a,_0x12893e,_0x247dc1){logger[_0x7617('0x37')](_0x7617('0x57'));var _0x1d427d={};_0x1d427d[_0x7617('0x58')]={'name':!_[_0x7617('0x1c')](_0x59bda5['role'][_0x7617('0x19')])&&!_[_0x7617('0x1c')](_0x59bda5['profile'][_0x7617('0x19')])&&_0x59bda5[_0x7617('0x39')]['name']===_0x7617('0x59')?_0x59bda5[_0x7617('0x43')][_0x7617('0x19')]:!_[_0x7617('0x1c')](_0x59bda5[_0x7617('0x44')])?_0x59bda5['first_name']+'\x20'+_0x59bda5[_0x7617('0x45')]:_0x59bda5[_0x7617('0x45')],'id':_0x59bda5['id']};_0x1d427d[_0x7617('0x5a')]=intUtil[_0x7617('0x5b')](_0x5e269a['Subjects'],_0x12893e,'\x20');_0x1d427d[_0x7617('0x5c')]=intUtil[_0x7617('0x5b')](_0x5e269a[_0x7617('0x5d')],_0x12893e,'\x0a');if(_0x36caab[_0x7617('0x49')]===_0x7617('0x51')){_0x1d427d[_0x7617('0x5e')]={'name':!_[_0x7617('0x1c')](_0x36caab['Full_Name'])?_0x36caab[_0x7617('0x5f')]:!_[_0x7617('0x1c')](_0x36caab[_0x7617('0x60')])?_0x36caab[_0x7617('0x60')]+'\x20'+_0x36caab[_0x7617('0x61')]:_0x36caab[_0x7617('0x61')],'id':_0x36caab['id']};}if(_0x36caab[_0x7617('0x49')]===_0x7617('0x53')){_0x1d427d[_0x7617('0x62')]={'name':!_[_0x7617('0x1c')](_0x36caab[_0x7617('0x5f')])?_0x36caab[_0x7617('0x5f')]:!_[_0x7617('0x1c')](_0x36caab[_0x7617('0x60')])?_0x36caab['First_Name']+'\x20'+_0x36caab[_0x7617('0x61')]:_0x36caab[_0x7617('0x61')],'id':_0x36caab['id']};_0x1d427d['$se_module']=_[_0x7617('0x41')](_0x36caab[_0x7617('0x49')]);}if(_0x12893e[_0x7617('0x63')]){_0x1d427d[_0x7617('0x64')]=moment['utc'](parseInt(_0x12893e[_0x7617('0x63')])*0x3e8)[_0x7617('0x2f')]('mm:ss');}else if(_0x12893e[_0x7617('0x65')]&&_0x12893e[_0x7617('0x66')]){_0x1d427d[_0x7617('0x64')]=moment[_0x7617('0x67')](moment(_0x12893e['endtime'],_0x7617('0x68'))[_0x7617('0x69')](moment(_0x12893e[_0x7617('0x6a')],_0x7617('0x68'))))[_0x7617('0x2f')]('mm:ss');}switch(_0x12893e[_0x7617('0x6b')]){case _0x7617('0x6c'):_0x1d427d['Call_Result']='Called';break;case _0x7617('0x6d'):case _0x7617('0x6e'):_0x1d427d[_0x7617('0x6f')]='Answered';break;case'rejected':_0x1d427d['Call_Result']=_0x7617('0x70');break;case _0x7617('0x71'):_0x1d427d[_0x7617('0x6f')]='Abandoned';break;case _0x7617('0x72'):_0x1d427d['Call_Result']='Timeout';default:}_0x1d427d[_0x7617('0x73')]=(_0x247dc1==='outbound'?moment(_0x12893e['starttime'])[_0x7617('0x2f')](_0x7617('0x68')):moment(_0x12893e[_0x7617('0x74')])[_0x7617('0x2f')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x7617('0x2f')]('YYYY-MM-DDTHH:mm:ss');_0x1d427d[_0x7617('0x75')]=_0x247dc1||'Inbound';_0x1d427d=_[_0x7617('0x76')](_0x1d427d,getCustomFields(_0x5e269a['Fields'],_0x12893e));return request({'method':_0x7617('0x24'),'uri':_0x7617('0x40')+_0x4781c3+_0x7617('0x77'),'headers':{'Authorization':_0x7617('0x32')+_0x231aca},'body':{'data':[_0x1d427d]},'json':!![]})[_0x7617('0x28')](function(_0x4d6b65){if(_0x4d6b65&&_0x4d6b65['data'][0x0][_0x7617('0x46')]==='SUCCESS'){logger[_0x7617('0x37')](_0x7617('0x78'));return{'id':_0x4d6b65[_0x7617('0x3f')][0x0][_0x7617('0x48')]['id']};}})[_0x7617('0x2c')](function(_0x1c8543){logger[_0x7617('0x37')](_0x7617('0x79'),_0x1c8543[_0x7617('0x7a')]);console[_0x7617('0x4b')]('err',_0x1c8543);});}exports[_0x7617('0x7b')]=function(_0x1572dc,_0x5a3497,_0x52ca42,_0x5735ed,_0x84b07b,_0x23a9e9){var _0x1feba7,_0x37bee3,_0x4073f9;_0x23a9e9['host']=intUtil[_0x7617('0x7c')](_0x23a9e9[_0x7617('0x7d')]);_0x23a9e9[_0x7617('0x7e')]=intUtil[_0x7617('0x7c')](_0x23a9e9[_0x7617('0x7e')]);if(_0x84b07b&&_0x84b07b[_0x7617('0x7f')]){logger[_0x7617('0x37')]('[QUEUE]',_0x7617('0x80'));_0x5a3497[_0x7617('0x81')]=_0x23a9e9[_0x7617('0x7e')]+_0x7617('0x82')+_0x5a3497[_0x7617('0x83')]+_0x7617('0x84')+md5(_0x5a3497[_0x7617('0x83')]);}else{_0x5a3497['recordingURL']='';}var _0x38f680=_0x23a9e9[_0x7617('0x7d')]===_0x7617('0x85')?'eu':_0x7617('0x86');return getAccessToken(_0x23a9e9)[_0x7617('0x28')](function(_0xf0fd2e){_0x4073f9=_0xf0fd2e;return getUser(_0x4073f9,_0x38f680,_0x23a9e9,_0x5735ed[_0x7617('0x36')]);})[_0x7617('0x28')](function(_0x19967a){_0x1feba7=_0x19967a;logger[_0x7617('0x37')](_0x7617('0x87'),_0x1feba7['id']);return getEndUser(_0x4073f9,_0x38f680,_0x23a9e9,_0x5a3497[_0x7617('0x88')],_0x5a3497['calleridnum'],_0x1feba7,_0x52ca42);})[_0x7617('0x28')](function(_0x3ff7d9){_0x37bee3=_0x3ff7d9;return getCall(_0x4073f9,_0x38f680,_0x23a9e9,_0x1feba7,_0x37bee3,_0x52ca42,_0x5a3497,_0x7617('0x89'));})[_0x7617('0x28')](function(_0x1c908f){if(_0x1c908f){logger[_0x7617('0x37')](_0x7617('0x8a'),_0x1c908f['id']);logger[_0x7617('0x37')](_0x7617('0x8b'),_0x7617('0x8c'));emit(util[_0x7617('0x2f')](_0x7617('0x8d'),_0x5735ed['name']),_0x7617('0x8e'),{'uri':_0x7617('0x8f')+_0x23a9e9['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x1c908f['id']});}})[_0x7617('0x2c')](function(_0x7e4a5e){logger[_0x7617('0x3c')](_0x7617('0x8b'),JSON[_0x7617('0xf')](_0x7e4a5e));});};exports[_0x7617('0x90')]=function(_0x354098,_0x1948e6,_0x4da4b3,_0x4747d0,_0x35cc4c,_0x16156c,_0x44d9f3){var _0x54815b,_0x9b1eb2,_0x3a6c5d;_0x16156c[_0x7617('0x7d')]=intUtil[_0x7617('0x7c')](_0x16156c['host']);_0x16156c['serverUrl']=intUtil['stripTrailingSlash'](_0x16156c[_0x7617('0x7e')]);if(_0x44d9f3&&_0x44d9f3[_0x7617('0x91')]&&_0x44d9f3[_0x7617('0x91')]!==_0x7617('0x92')){logger[_0x7617('0x37')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1948e6['recordingURL']=_0x16156c['serverUrl']+'/api/voice/recordings/'+_0x1948e6['uniqueid']+_0x7617('0x84')+md5(_0x1948e6[_0x7617('0x83')]);}var _0x21cff5=_0x16156c['host']==='zoho.eu'?'eu':_0x7617('0x86');return getAccessToken(_0x16156c)[_0x7617('0x28')](function(_0x2bb454){_0x3a6c5d=_0x2bb454;return getUser(_0x3a6c5d,_0x21cff5,_0x16156c,_0x4747d0['email']);})[_0x7617('0x28')](function(_0x5ed5d4){_0x54815b=_0x5ed5d4;logger[_0x7617('0x37')](_0x7617('0x87'),_0x54815b['id']);return getEndUser(_0x3a6c5d,_0x21cff5,_0x16156c,_0x1948e6[_0x7617('0x93')],_0x1948e6[_0x7617('0x94')],_0x54815b,_0x4da4b3);})[_0x7617('0x28')](function(_0x4d1c06){_0x9b1eb2=_0x4d1c06;return getCall(_0x3a6c5d,_0x21cff5,_0x16156c,_0x54815b,_0x9b1eb2,_0x4da4b3,_0x1948e6,_0x7617('0x95'));})[_0x7617('0x28')](function(_0x22f09c){if(_0x22f09c){logger[_0x7617('0x37')]('The\x20Call\x20ID\x20is:',_0x22f09c['id']);logger['info']('[OUTBOUND]',_0x7617('0x8c'));emit(util[_0x7617('0x2f')](_0x7617('0x8d'),_0x4747d0[_0x7617('0x19')]),'trigger:browser:url',{'uri':_0x7617('0x8f')+_0x16156c['host']+_0x7617('0x96')+_0x22f09c['id']});}})['catch'](function(_0x3b03b6){logger[_0x7617('0x3c')](_0x7617('0x97'),JSON[_0x7617('0xf')](_0x3b03b6));});};exports[_0x7617('0x98')]=function(_0x4b79d8,_0x4e015e,_0x47e1b5,_0x122b8d,_0xe50d0f,_0x10fdb9){var _0x32d967,_0x380318,_0x5b4bd9;_0x10fdb9[_0x7617('0x7d')]=intUtil['stripTrailingSlash'](_0x10fdb9[_0x7617('0x7d')]);_0x10fdb9[_0x7617('0x7e')]=intUtil[_0x7617('0x7c')](_0x10fdb9[_0x7617('0x7e')]);if(_0xe50d0f&&_0xe50d0f[_0x7617('0x7f')]){logger[_0x7617('0x37')]('['+_0x4e015e[_0x7617('0x6b')][_0x7617('0x99')]()+']','Recording\x20is\x20enabled!');_0x4e015e['recordingURL']=_0x10fdb9[_0x7617('0x7e')]+'/api/voice/recordings/'+_0x4e015e[_0x7617('0x83')]+_0x7617('0x84')+md5(_0x4e015e[_0x7617('0x83')]);}else{_0x4e015e[_0x7617('0x81')]='';}var _0x2f2c61=_0x10fdb9['host']===_0x7617('0x85')?'eu':'com';return getAccessToken(_0x10fdb9)[_0x7617('0x28')](function(_0x44e79d){_0x5b4bd9=_0x44e79d;return getUser(_0x5b4bd9,_0x2f2c61,_0x10fdb9);})['then'](function(_0x25ecb9){_0x32d967=_0x25ecb9;logger['info']('The\x20User\x20ID\x20is:',_0x32d967['id']);return getEndUser(_0x5b4bd9,_0x2f2c61,_0x10fdb9,_0x4e015e[_0x7617('0x88')],_0x4e015e['calleridnum'],_0x32d967,_0x47e1b5);})['then'](function(_0x5047fd){_0x380318=_0x5047fd;return getCall(_0x5b4bd9,_0x2f2c61,_0x10fdb9,_0x32d967,_0x380318,_0x47e1b5,_0x4e015e,_0x7617('0x89'));})['then'](function(_0x2b2431){if(_0x2b2431){logger[_0x7617('0x37')](_0x7617('0x8a'),_0x2b2431['id']);}})[_0x7617('0x2c')](function(_0xe3fab9){logger['error']('['+_0x4e015e[_0x7617('0x6b')][_0x7617('0x99')]()+']',JSON[_0x7617('0xf')](_0xe3fab9));});}; \ No newline at end of file +var _0x8728=['zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','user:%s','unmanaged','calleridnum','toUpperCase','lodash','request-promise','util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','emit','debug','[HTTP]','stringify','forEach','includes','string','picklist','idField','content','toString','type','variable','variableName','Variable','toLowerCase','name','indexOf','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','profile','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','error','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','SUCCESS','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Contacts','lead','Owner','administrator','getString','Subjects','Who_Id','Full_Name','First_Name','What_Id','Last_Name','talktime','Call_Duration','mm:ss','answertime','endtime','diff','lastevent','called','Call_Result','Called','connect','Abandoned','timeout','Timeout','outbound','starttime','YYYY-MM-DDTHH:mm:ss','Call_Type','Inbound','merge','Fields','Call\x20created!','details','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token='];(function(_0x4880fd,_0x2cc70d){var _0x4a4b50=function(_0xafeb91){while(--_0xafeb91){_0x4880fd['push'](_0x4880fd['shift']());}};_0x4a4b50(++_0x2cc70d);}(_0x8728,0x14a));var _0x8872=function(_0x4bd7e8,_0x47ab46){_0x4bd7e8=_0x4bd7e8-0x0;var _0x66f37c=_0x8728[_0x4bd7e8];return _0x66f37c;};'use strict';var _=require(_0x8872('0x0'));var rp=require(_0x8872('0x1'));var md5=require('md5');var util=require(_0x8872('0x2'));var intUtil=require('./util');var moment=require(_0x8872('0x3'));var Redis=require(_0x8872('0x4'));var BPromise=require(_0x8872('0x5'));var config=require(_0x8872('0x6'));var logger=require(_0x8872('0x7'))(_0x8872('0x8'));config[_0x8872('0x9')]=_[_0x8872('0xa')](config[_0x8872('0x9')],{'host':_0x8872('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8872('0x9')]));function emit(_0x20bc33,_0x4068c1,_0x4bfa22){io['to'](_0x20bc33)[_0x8872('0xc')](_0x4068c1,_0x4bfa22);}function request(_0x246e75){logger[_0x8872('0xd')](_0x8872('0xe'),JSON[_0x8872('0xf')](_0x246e75));return rp(_0x246e75);}function getCustomFields(_0x1201a2,_0x166539){var _0x5f9e34={};if(_0x1201a2['length']>0x0){_[_0x8872('0x10')](_0x1201a2,function(_0xb72393){if(_[_0x8872('0x11')]([_0x8872('0x12'),_0x8872('0x13')],_0xb72393['type'])&&_0xb72393[_0x8872('0x14')]){_0x5f9e34[_0xb72393[_0x8872('0x14')]]=_0xb72393[_0x8872('0x15')][_0x8872('0x16')]();}else if(_0xb72393[_0x8872('0x17')]===_0x8872('0x18')&&_0xb72393[_0x8872('0x19')]&&_0xb72393[_0x8872('0x14')]&&_0x166539[_0xb72393[_0x8872('0x19')]]){_0x5f9e34[_0xb72393[_0x8872('0x14')]]=_0x166539[_0xb72393['variableName']]['toString']();}else if(_0xb72393[_0x8872('0x17')]==='customVariable'&&_0xb72393[_0x8872('0x1a')]&&_0xb72393[_0x8872('0x1a')]['name']&&_0xb72393[_0x8872('0x14')]&&_0x166539[_0xb72393[_0x8872('0x1a')]['name'][_0x8872('0x1b')]()]){_0x5f9e34[_0xb72393['idField']]=_0x166539[_0xb72393[_0x8872('0x1a')][_0x8872('0x1c')]['toLowerCase']()][_0x8872('0x16')]();}});}return _0x5f9e34;}function getName(_0x24e243){if(_0x24e243[_0x8872('0x1d')]('\x20')>0x0){var _0x53cb2a=_0x24e243['split'](/ (.+)/);if(_0x53cb2a[0x1]){return _0x53cb2a;}}return[_0x24e243,_0x24e243];}var accountsTokens={};function getAccessToken(_0x4cec78){return new Promise(function(_0x522fa0,_0x56eaee){if(!_[_0x8872('0x1e')](accountsTokens[_0x4cec78['id']])&&!_[_0x8872('0x1e')](accountsTokens[_0x4cec78['id']][_0x8872('0x1f')])){if(moment()[_0x8872('0x20')](accountsTokens[_0x4cec78['id']][_0x8872('0x21')])){_0x522fa0(accountsTokens[_0x4cec78['id']][_0x8872('0x1f')]);}}var _0x324025;switch(_0x4cec78[_0x8872('0x22')]){case'US':_0x324025=_0x8872('0x23');break;case'AU':_0x324025=_0x8872('0x24');break;case'EU':_0x324025=_0x8872('0x25');break;case'IN':_0x324025=_0x8872('0x26');break;case'CN':_0x324025=_0x8872('0x27');break;default:_0x324025=_0x8872('0x25');break;}var _0x1f56a8={'method':_0x8872('0x28'),'uri':_0x324025+_0x8872('0x29'),'qs':{'refresh_token':_0x4cec78[_0x8872('0x2a')],'client_id':_0x4cec78[_0x8872('0x2b')],'client_secret':_0x4cec78[_0x8872('0x2c')],'grant_type':_0x8872('0x2d')},'json':!![]};return rp(_0x1f56a8)[_0x8872('0x2e')](function(_0x4779d0){accountsTokens[_0x4cec78['id']]={'access_token':_0x4779d0[_0x8872('0x1f')],'expires_in':moment()[_0x8872('0x2f')](_0x4779d0[_0x8872('0x21')],_0x8872('0x30'))};_0x522fa0(_0x4779d0[_0x8872('0x1f')]);})['catch'](function(_0x562886){logger['error'](_0x8872('0x31'),_0x562886[_0x8872('0x32')]);_0x56eaee(_0x562886);});});}function getUser(_0x3b6be7,_0xbc571,_0xb04dae,_0x4a4458){logger[_0x8872('0x33')](_0x8872('0x34'));return request({'method':_0x8872('0x35'),'uri':util[_0x8872('0x36')]('https://www.zohoapis.%s/crm/v2/users',_0xbc571),'qs':{'type':_0x8872('0x37')},'headers':{'Authorization':_0x8872('0x38')+_0x3b6be7},'json':!![]})[_0x8872('0x2e')](function(_0x1e56d9){if(_0x1e56d9[_0x8872('0x39')]){var _0x26dd0c=-0x1;if(_[_0x8872('0x3a')](_0x1e56d9['users'])){if(!_['isNil'](_0x4a4458)){_0x26dd0c=_[_0x8872('0x3b')](_0x1e56d9[_0x8872('0x39')],function(_0x34d1a5){return _0x34d1a5[_0x8872('0x3c')]===_0x4a4458;});}if(_0x26dd0c>=0x0){logger[_0x8872('0x33')](_0x8872('0x3d'));}else{logger[_0x8872('0x33')](_0x8872('0x3e'));_0x26dd0c=_[_0x8872('0x3b')](_0x1e56d9[_0x8872('0x39')],function(_0x3e7688){return _0x3e7688['profile'][_0x8872('0x1c')]===_0x8872('0x3f');});}return _0x1e56d9['users'][_0x26dd0c];}else{if(_0x1e56d9[_0x8872('0x40')][_0x8872('0x41')][_0x8872('0x1c')]==='Administrator'){logger[_0x8872('0x33')]('Using\x20the\x20admin\x20account!');user=_0x1e56d9['user'];return user;}else{logger['error'](_0x8872('0x42'),JSON['stringify'](_0x1e56d9));throw new Error(_0x8872('0x43')+JSON[_0x8872('0xf')](_0x1e56d9));}}}else{logger[_0x8872('0x44')]('The\x20failing\x20result\x20is',JSON[_0x8872('0xf')](_0x1e56d9));throw new Error(_0x8872('0x43')+JSON[_0x8872('0xf')](_0x1e56d9));}})[_0x8872('0x45')](function(_0x3ec5d3){console[_0x8872('0x44')](_0x3ec5d3);});}function getZohoUser(_0x1800ea,_0x5aa377){return new BPromise(function(_0x1201eb,_0x2c2538){request(_0x1800ea)[_0x8872('0x2e')](function(_0x2cd59f){var _0x2d5fa6=null;if(_0x2cd59f){_0x2d5fa6=_0x2cd59f[_0x8872('0x46')][0x0];_0x2d5fa6[_0x8872('0x47')]=_0x5aa377;}_0x1201eb(_0x2d5fa6);})[_0x8872('0x45')](function(_0x407478){_0x2c2538(_0x407478);});});}function createEndUser(_0x554da8,_0x5d1665,_0xc505b4,_0x5a3228,_0x35eb77,_0x448db5){var _0xc505b4=getName(_0xc505b4);return request({'method':_0x8872('0x28'),'uri':_0x8872('0x48')+_0x5d1665+_0x8872('0x49')+_[_0x8872('0x4a')](_0x448db5['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0xc505b4[0x1],'First_Name':_0xc505b4[0x0],'Phone':_0x5a3228,'Owner':{'name':!_[_0x8872('0x1e')](_0x35eb77[_0x8872('0x4b')]['name'])?_0x35eb77[_0x8872('0x4b')][_0x8872('0x1c')]:!_[_0x8872('0x1e')](_0x35eb77[_0x8872('0x4c')])?_0x35eb77[_0x8872('0x4c')]+'\x20'+_0x35eb77[_0x8872('0x4d')]:_0x35eb77[_0x8872('0x4d')],'id':_0x35eb77['id']}}]},'headers':{'Authorization':_0x8872('0x38')+_0x554da8},'json':!![]})[_0x8872('0x2e')](function(_0x636dc5){if(_0x636dc5&&_0x636dc5[_0x8872('0x46')][0x0][_0x8872('0x4e')]===_0x8872('0x4f')){var _0x28e898=_0x636dc5['data'][0x0]['details'];_0x28e898[_0x8872('0x47')]=_[_0x8872('0x4a')](_0x448db5[_0x8872('0x50')])+'s';return _0x28e898;}logger[_0x8872('0x44')](_0x8872('0x42'),JSON['stringify'](data));throw new Error(_0x8872('0x51')+JSON['stringify'](data));})[_0x8872('0x45')](function(_0x48f20e){console[_0x8872('0x52')](_0x8872('0x53'),_0x48f20e);});}function getEndUser(_0x59fb27,_0x342cee,_0x506f31,_0x41548e,_0x500c8c,_0x1c7937,_0x4d2c15){var _0x53a7a4={'method':_0x8872('0x35'),'uri':'','headers':{'Authorization':_0x8872('0x38')+_0x59fb27},'json':!![]};switch(_0x4d2c15[_0x8872('0x54')]){case _0x8872('0x55'):_0x53a7a4[_0x8872('0x56')]=_0x8872('0x48')+_0x342cee+_0x8872('0x57')+_0x500c8c+'))';return getZohoUser(_0x53a7a4,'Contacts')['then'](function(_0x233005){if(_0x233005)return _0x233005;_0x53a7a4[_0x8872('0x56')]='https://www.zohoapis.'+_0x342cee+_0x8872('0x58')+_0x500c8c+'))';return getZohoUser(_0x53a7a4,_0x8872('0x59'))[_0x8872('0x2e')](function(_0xaea0bf){if(_0xaea0bf)return _0xaea0bf;if(_0x4d2c15[_0x8872('0x50')]!=_0x8872('0x5a')){return createEndUser(_0x59fb27,_0x342cee,_0x41548e,_0x500c8c,_0x1c7937,_0x4d2c15);}else{return{};}});});break;case _0x8872('0x5b'):_0x53a7a4[_0x8872('0x56')]='https://www.zohoapis.'+_0x342cee+_0x8872('0x57')+_0x500c8c+'))';return getZohoUser(_0x53a7a4,_0x8872('0x5c'))[_0x8872('0x2e')](function(_0x31d633){if(_0x31d633)return _0x31d633;if(_0x4d2c15[_0x8872('0x50')]!='nothing'){return createEndUser(_0x59fb27,_0x342cee,_0x41548e,_0x500c8c,_0x1c7937,_0x4d2c15);}else{return{};}});break;case _0x8872('0x5d'):_0x53a7a4['uri']=_0x8872('0x48')+_0x342cee+_0x8872('0x58')+_0x500c8c+'))';return getZohoUser(_0x53a7a4,_0x8872('0x59'))[_0x8872('0x2e')](function(_0x557c2b){if(_0x557c2b)return _0x557c2b;if(_0x4d2c15[_0x8872('0x50')]!=_0x8872('0x5a')){return createEndUser(_0x59fb27,_0x342cee,_0x41548e,_0x500c8c,_0x1c7937,_0x4d2c15);}else{return{};}});break;}}function getCall(_0x46af23,_0x51d227,_0x577be4,_0x153aa9,_0x5bc29f,_0x434501,_0x4b9221,_0x2214ca){logger[_0x8872('0x33')]('Creating\x20new\x20call...');var _0x50a12c={};_0x50a12c[_0x8872('0x5e')]={'name':!_[_0x8872('0x1e')](_0x153aa9['role'][_0x8872('0x1c')])&&!_['isNil'](_0x153aa9['profile'][_0x8872('0x1c')])&&_0x153aa9['profile'][_0x8872('0x1c')]===_0x8872('0x5f')?_0x153aa9['role'][_0x8872('0x1c')]:!_[_0x8872('0x1e')](_0x153aa9['first_name'])?_0x153aa9[_0x8872('0x4c')]+'\x20'+_0x153aa9[_0x8872('0x4d')]:_0x153aa9[_0x8872('0x4d')],'id':_0x153aa9['id']};_0x50a12c['Subject']=intUtil[_0x8872('0x60')](_0x434501[_0x8872('0x61')],_0x4b9221,'\x20');_0x50a12c['Description']=intUtil['getString'](_0x434501['Descriptions'],_0x4b9221,'\x0a');if(_0x5bc29f[_0x8872('0x47')]===_0x8872('0x5c')){_0x50a12c[_0x8872('0x62')]={'name':!_[_0x8872('0x1e')](_0x5bc29f['Full_Name'])?_0x5bc29f[_0x8872('0x63')]:!_[_0x8872('0x1e')](_0x5bc29f[_0x8872('0x64')])?_0x5bc29f[_0x8872('0x64')]+'\x20'+_0x5bc29f['Last_Name']:_0x5bc29f['Last_Name'],'id':_0x5bc29f['id']};}if(_0x5bc29f[_0x8872('0x47')]===_0x8872('0x59')){_0x50a12c[_0x8872('0x65')]={'name':!_[_0x8872('0x1e')](_0x5bc29f[_0x8872('0x63')])?_0x5bc29f[_0x8872('0x63')]:!_[_0x8872('0x1e')](_0x5bc29f[_0x8872('0x64')])?_0x5bc29f[_0x8872('0x64')]+'\x20'+_0x5bc29f[_0x8872('0x66')]:_0x5bc29f['Last_Name'],'id':_0x5bc29f['id']};_0x50a12c['$se_module']=_['startCase'](_0x5bc29f[_0x8872('0x47')]);}if(_0x4b9221[_0x8872('0x67')]){_0x50a12c[_0x8872('0x68')]=moment['utc'](parseInt(_0x4b9221['talktime'])*0x3e8)['format'](_0x8872('0x69'));}else if(_0x4b9221[_0x8872('0x6a')]&&_0x4b9221[_0x8872('0x6b')]){_0x50a12c[_0x8872('0x68')]=moment['utc'](moment(_0x4b9221[_0x8872('0x6b')],'YYYY-MM-DDTHH:mm:ss')[_0x8872('0x6c')](moment(_0x4b9221['starttime'],'YYYY-MM-DDTHH:mm:ss')))[_0x8872('0x36')](_0x8872('0x69'));}switch(_0x4b9221[_0x8872('0x6d')]){case _0x8872('0x6e'):_0x50a12c[_0x8872('0x6f')]=_0x8872('0x70');break;case'complete':case _0x8872('0x71'):_0x50a12c[_0x8872('0x6f')]='Answered';break;case'rejected':_0x50a12c[_0x8872('0x6f')]='Rejected';break;case'abandoned':_0x50a12c[_0x8872('0x6f')]=_0x8872('0x72');break;case _0x8872('0x73'):_0x50a12c[_0x8872('0x6f')]=_0x8872('0x74');default:}_0x50a12c['Call_Start_Time']=(_0x2214ca===_0x8872('0x75')?moment(_0x4b9221[_0x8872('0x76')])[_0x8872('0x36')](_0x8872('0x77')):moment(_0x4b9221['agentcalledAt'])[_0x8872('0x36')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x8872('0x36')]('YYYY-MM-DDTHH:mm:ss');_0x50a12c[_0x8872('0x78')]=_0x2214ca||_0x8872('0x79');_0x50a12c=_[_0x8872('0x7a')](_0x50a12c,getCustomFields(_0x434501[_0x8872('0x7b')],_0x4b9221));return request({'method':'POST','uri':_0x8872('0x48')+_0x51d227+'/crm/v2/Calls','headers':{'Authorization':_0x8872('0x38')+_0x46af23},'body':{'data':[_0x50a12c]},'json':!![]})[_0x8872('0x2e')](function(_0x43b028){if(_0x43b028&&_0x43b028[_0x8872('0x46')][0x0]['code']===_0x8872('0x4f')){logger[_0x8872('0x33')](_0x8872('0x7c'));return{'id':_0x43b028[_0x8872('0x46')][0x0][_0x8872('0x7d')]['id']};}})[_0x8872('0x45')](function(_0x415d24){logger[_0x8872('0x33')](_0x8872('0x7e'),_0x415d24[_0x8872('0x32')]);console[_0x8872('0x52')]('err',_0x415d24);});}exports[_0x8872('0x7f')]=function(_0x60bba3,_0x4a3410,_0x2ff681,_0x364d4a,_0x10c20d,_0x21a349){var _0x1e5c9f,_0x5159d9,_0x35f8af;_0x21a349[_0x8872('0x80')]=intUtil[_0x8872('0x81')](_0x21a349[_0x8872('0x80')]);_0x21a349[_0x8872('0x82')]=intUtil['stripTrailingSlash'](_0x21a349[_0x8872('0x82')]);if(_0x10c20d&&_0x10c20d[_0x8872('0x83')]){logger['info'](_0x8872('0x84'),_0x8872('0x85'));_0x4a3410[_0x8872('0x86')]=_0x21a349[_0x8872('0x82')]+_0x8872('0x87')+_0x4a3410[_0x8872('0x88')]+_0x8872('0x89')+md5(_0x4a3410[_0x8872('0x88')]);}else{_0x4a3410[_0x8872('0x86')]='';}var _0x519e4e=_0x21a349[_0x8872('0x80')]===_0x8872('0x8a')?'eu':_0x8872('0x8b');return getAccessToken(_0x21a349)[_0x8872('0x2e')](function(_0x2c1ecc){_0x35f8af=_0x2c1ecc;return getUser(_0x35f8af,_0x519e4e,_0x21a349,_0x364d4a[_0x8872('0x3c')]);})[_0x8872('0x2e')](function(_0x11cc93){_0x1e5c9f=_0x11cc93;logger[_0x8872('0x33')](_0x8872('0x8c'),_0x1e5c9f['id']);return getEndUser(_0x35f8af,_0x519e4e,_0x21a349,_0x4a3410[_0x8872('0x8d')],_0x4a3410['calleridnum'],_0x1e5c9f,_0x2ff681);})['then'](function(_0x49af38){_0x5159d9=_0x49af38;return getCall(_0x35f8af,_0x519e4e,_0x21a349,_0x1e5c9f,_0x5159d9,_0x2ff681,_0x4a3410,_0x8872('0x79'));})[_0x8872('0x2e')](function(_0x30276b){if(_0x30276b){logger[_0x8872('0x33')](_0x8872('0x8e'),_0x30276b['id']);logger[_0x8872('0x33')](_0x8872('0x84'),_0x8872('0x8f'));emit(util[_0x8872('0x36')]('user:%s',_0x364d4a[_0x8872('0x1c')]),_0x8872('0x90'),{'uri':_0x8872('0x91')+_0x21a349[_0x8872('0x80')]+_0x8872('0x92')+_0x30276b['id']});}})[_0x8872('0x45')](function(_0x577499){logger[_0x8872('0x44')]('[QUEUE]',JSON[_0x8872('0xf')](_0x577499));});};exports['outbound']=function(_0x5a8acc,_0x33d65d,_0x310b19,_0x36a3a6,_0x3c4f3f,_0x45403d,_0x4a0faa){var _0x1614e8,_0x5e8490,_0x396eae;_0x45403d[_0x8872('0x80')]=intUtil[_0x8872('0x81')](_0x45403d[_0x8872('0x80')]);_0x45403d['serverUrl']=intUtil[_0x8872('0x81')](_0x45403d[_0x8872('0x82')]);if(_0x4a0faa&&_0x4a0faa[_0x8872('0x93')]&&_0x4a0faa['recordingFormat']!=='none'){logger[_0x8872('0x33')](_0x8872('0x94'),_0x8872('0x85'));_0x33d65d[_0x8872('0x86')]=_0x45403d[_0x8872('0x82')]+_0x8872('0x87')+_0x33d65d[_0x8872('0x88')]+_0x8872('0x89')+md5(_0x33d65d['uniqueid']);}var _0x2eca5b=_0x45403d[_0x8872('0x80')]===_0x8872('0x8a')?'eu':_0x8872('0x8b');return getAccessToken(_0x45403d)[_0x8872('0x2e')](function(_0x41c031){_0x396eae=_0x41c031;return getUser(_0x396eae,_0x2eca5b,_0x45403d,_0x36a3a6[_0x8872('0x3c')]);})['then'](function(_0x2e3d92){_0x1614e8=_0x2e3d92;logger[_0x8872('0x33')](_0x8872('0x8c'),_0x1614e8['id']);return getEndUser(_0x396eae,_0x2eca5b,_0x45403d,_0x33d65d[_0x8872('0x95')],_0x33d65d[_0x8872('0x96')],_0x1614e8,_0x310b19);})[_0x8872('0x2e')](function(_0x5c72d9){_0x5e8490=_0x5c72d9;return getCall(_0x396eae,_0x2eca5b,_0x45403d,_0x1614e8,_0x5e8490,_0x310b19,_0x33d65d,_0x8872('0x97'));})[_0x8872('0x2e')](function(_0x5454aa){if(_0x5454aa){logger[_0x8872('0x33')](_0x8872('0x8e'),_0x5454aa['id']);logger[_0x8872('0x33')](_0x8872('0x94'),_0x8872('0x8f'));emit(util[_0x8872('0x36')](_0x8872('0x98'),_0x36a3a6[_0x8872('0x1c')]),_0x8872('0x90'),{'uri':_0x8872('0x91')+_0x45403d[_0x8872('0x80')]+_0x8872('0x92')+_0x5454aa['id']});}})['catch'](function(_0x2f3b98){logger[_0x8872('0x44')](_0x8872('0x94'),JSON[_0x8872('0xf')](_0x2f3b98));});};exports[_0x8872('0x99')]=function(_0x5a0059,_0x226588,_0x496413,_0x237902,_0x1f96b7,_0x36af14){var _0x59de80,_0x2918de,_0x326a14;_0x36af14['host']=intUtil[_0x8872('0x81')](_0x36af14['host']);_0x36af14[_0x8872('0x82')]=intUtil['stripTrailingSlash'](_0x36af14[_0x8872('0x82')]);if(_0x1f96b7&&_0x1f96b7[_0x8872('0x83')]){logger[_0x8872('0x33')]('['+_0x226588['lastevent']['toUpperCase']()+']',_0x8872('0x85'));_0x226588[_0x8872('0x86')]=_0x36af14[_0x8872('0x82')]+_0x8872('0x87')+_0x226588['uniqueid']+_0x8872('0x89')+md5(_0x226588[_0x8872('0x88')]);}else{_0x226588[_0x8872('0x86')]='';}var _0x1f22d3=_0x36af14['host']===_0x8872('0x8a')?'eu':_0x8872('0x8b');return getAccessToken(_0x36af14)[_0x8872('0x2e')](function(_0x304891){_0x326a14=_0x304891;return getUser(_0x326a14,_0x1f22d3,_0x36af14);})[_0x8872('0x2e')](function(_0x2d9086){_0x59de80=_0x2d9086;logger[_0x8872('0x33')](_0x8872('0x8c'),_0x59de80['id']);return getEndUser(_0x326a14,_0x1f22d3,_0x36af14,_0x226588[_0x8872('0x8d')],_0x226588[_0x8872('0x9a')],_0x59de80,_0x496413);})['then'](function(_0x567b17){_0x2918de=_0x567b17;return getCall(_0x326a14,_0x1f22d3,_0x36af14,_0x59de80,_0x2918de,_0x496413,_0x226588,_0x8872('0x79'));})[_0x8872('0x2e')](function(_0x5c3ca7){if(_0x5c3ca7){logger['info'](_0x8872('0x8e'),_0x5c3ca7['id']);}})['catch'](function(_0x6eb4ae){logger[_0x8872('0x44')]('['+_0x226588['lastevent'][_0x8872('0x9b')]()+']',JSON[_0x8872('0xf')](_0x6eb4ae));});}; \ 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 f9a38fe..5ba2c6e 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 _0x609f=['error','format','util','shelljs','mustache','../../../../config/logger','exec','data3','render'];(function(_0x25c1d0,_0x4fe6cf){var _0x342b07=function(_0x449b49){while(--_0x449b49){_0x25c1d0['push'](_0x25c1d0['shift']());}};_0x342b07(++_0x4fe6cf);}(_0x609f,0x16a));var _0xf609=function(_0x1367cb,_0x1a8582){_0x1367cb=_0x1367cb-0x0;var _0x4d84f0=_0x609f[_0x1367cb];return _0x4d84f0;};'use strict';var util=require(_0xf609('0x0'));var sh=require(_0xf609('0x1'));var Mustache=require(_0xf609('0x2'));var logger=require(_0xf609('0x3'))('trigger');exports[_0xf609('0x4')]=function(_0x1129a4,_0x2a3788){var _0x5de4bc=_0x1129a4['data2']?_0x1129a4['data2']:'Script';var _0x81afea=_0x1129a4[_0xf609('0x5')]?Mustache[_0xf609('0x6')](_0x1129a4['data3'],_0x2a3788):_0x2a3788;sh[_0xf609('0x4')](_0x81afea,function(_0x500b11,_0x2eb8c4,_0x40f181){if(_0x500b11!==0x0){logger[_0xf609('0x7')](util['format']('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x5de4bc,_0x81afea,_0x500b11,_0x40f181));}else{logger['info'](util[_0xf609('0x8')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x5de4bc,_0x81afea,_0x2eb8c4));}});}; \ No newline at end of file +var _0x5c3c=['Script','render','exec','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','mustache','trigger','data2'];(function(_0x120fb0,_0x2298d5){var _0x1c65c4=function(_0x506c9d){while(--_0x506c9d){_0x120fb0['push'](_0x120fb0['shift']());}};_0x1c65c4(++_0x2298d5);}(_0x5c3c,0x75));var _0xc5c3=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x5c3c[_0x9df060];return _0x338dfe;};'use strict';var util=require(_0xc5c3('0x0'));var sh=require('shelljs');var Mustache=require(_0xc5c3('0x1'));var logger=require('../../../../config/logger')(_0xc5c3('0x2'));exports['exec']=function(_0x1ffe9d,_0x35a079){var _0x451cad=_0x1ffe9d[_0xc5c3('0x3')]?_0x1ffe9d[_0xc5c3('0x3')]:_0xc5c3('0x4');var _0x369a4b=_0x1ffe9d['data3']?Mustache[_0xc5c3('0x5')](_0x1ffe9d['data3'],_0x35a079):_0x35a079;sh[_0xc5c3('0x6')](_0x369a4b,function(_0x55d705,_0x570bf4,_0x22b6a0){if(_0x55d705!==0x0){logger[_0xc5c3('0x7')](util['format'](_0xc5c3('0x8'),_0x451cad,_0x369a4b,_0x55d705,_0x22b6a0));}else{logger[_0xc5c3('0x9')](util['format'](_0xc5c3('0xa'),_0x451cad,_0x369a4b,_0x570bf4));}});}; \ 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 7869665..a6acc13 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 _0xdb29=['data5','number','headers','data6','parse','DELETE','PUT','data7','body','error','stack','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data1',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data2','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','request-promise','mustache','../../../../config/logger','trigger','exec','toUpperCase','render'];(function(_0x443494,_0x51fc7e){var _0x4a6794=function(_0x15197a){while(--_0x15197a){_0x443494['push'](_0x443494['shift']());}};_0x4a6794(++_0x51fc7e);}(_0xdb29,0xb9));var _0x9db2=function(_0x451c31,_0x420acf){_0x451c31=_0x451c31-0x0;var _0x549434=_0xdb29[_0x451c31];return _0x549434;};'use strict';var rp=require(_0x9db2('0x0'));var util=require('util');var _=require('lodash');var Mustache=require(_0x9db2('0x1'));var logger=require(_0x9db2('0x2'))(_0x9db2('0x3'));exports[_0x9db2('0x4')]=function(_0x1db34f,_0x37757f){var _0xbb3825,_0x182174;var _0x4d4646={'method':_0x1db34f['data1'][_0x9db2('0x5')](),'uri':Mustache[_0x9db2('0x6')](_0x1db34f['data2'],_0x37757f),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1db34f[_0x9db2('0x7')])===_0x9db2('0x8')&&parseInt(_0x1db34f['data5'])>=0x1&&parseInt(_0x1db34f[_0x9db2('0x7')])<=0xa?parseInt(_0x1db34f[_0x9db2('0x7')])*0x3e8:0x5*0x3e8};try{_0x4d4646[_0x9db2('0x9')]=_0x1db34f[_0x9db2('0xa')]?JSON[_0x9db2('0xb')](Mustache[_0x9db2('0x6')](_0x1db34f[_0x9db2('0xa')],_0x37757f)):{};}catch(_0x434f70){logger['error'](_0x434f70['stack']);}switch(_0x1db34f['data1'][_0x9db2('0x5')]()){case'GET':case _0x9db2('0xc'):_0xbb3825=null;_0x4d4646['qs']=_0x37757f;break;case'POST':case _0x9db2('0xd'):if(_0x1db34f[_0x9db2('0xe')]){try{_0xbb3825=JSON['parse'](Mustache['render'](_0x1db34f[_0x9db2('0xe')],_0x37757f));_0x4d4646[_0x9db2('0xf')]=_0xbb3825;}catch(_0x5605c7){logger[_0x9db2('0x10')](_0x5605c7[_0x9db2('0x11')]);logger[_0x9db2('0x10')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0xbb3825=_0x37757f;_0x4d4646[_0x9db2('0xf')]=_0xbb3825;}break;}logger[_0x9db2('0x12')](util[_0x9db2('0x13')](_0x9db2('0x14'),_0x1db34f[_0x9db2('0x15')],_0x1db34f['data2'],JSON['stringify'](_0x4d4646)));rp(_0x4d4646)['then'](function(_0x24216a){_0xbb3825=!_['isNil'](_0xbb3825)?_0x9db2('0x16')+_0xbb3825:'';_0x182174=typeof _0x24216a[_0x9db2('0xf')]===_0x9db2('0x17')?JSON[_0x9db2('0x18')](_0x24216a[_0x9db2('0xf')]):_0x24216a[_0x9db2('0xf')];logger[_0x9db2('0x12')](util[_0x9db2('0x13')](_0x9db2('0x19'),_0x1db34f['data1'],_0x1db34f[_0x9db2('0x1a')],_0x24216a['statusCode'],_0x182174));})[_0x9db2('0x1b')](function(_0x390281){logger[_0x9db2('0x10')](util['format'](_0x9db2('0x1c'),_0x1db34f['data1'],_0x1db34f[_0x9db2('0x1a')],_0x390281[_0x9db2('0x1d')],_0x390281[_0x9db2('0x1e')],_0x390281[_0x9db2('0x1f')]));});}; \ No newline at end of file +var _0xf131=['data1','GET','DELETE','POST','PUT','data7','body','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil',',\x20request\x20body:\x20','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','toUpperCase','render','data2','data5','data6','parse','error','stack'];(function(_0x291d3f,_0x3ef99f){var _0x242080=function(_0x257705){while(--_0x257705){_0x291d3f['push'](_0x291d3f['shift']());}};_0x242080(++_0x3ef99f);}(_0xf131,0x9b));var _0x1f13=function(_0x98009,_0x1338aa){_0x98009=_0x98009-0x0;var _0x1edb12=_0xf131[_0x98009];return _0x1edb12;};'use strict';var rp=require(_0x1f13('0x0'));var util=require(_0x1f13('0x1'));var _=require(_0x1f13('0x2'));var Mustache=require(_0x1f13('0x3'));var logger=require(_0x1f13('0x4'))(_0x1f13('0x5'));exports[_0x1f13('0x6')]=function(_0x3d9e7d,_0x41a6c5){var _0x4e57ab,_0x5cfd86;var _0x55aed2={'method':_0x3d9e7d['data1'][_0x1f13('0x7')](),'uri':Mustache[_0x1f13('0x8')](_0x3d9e7d[_0x1f13('0x9')],_0x41a6c5),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3d9e7d[_0x1f13('0xa')])==='number'&&parseInt(_0x3d9e7d[_0x1f13('0xa')])>=0x1&&parseInt(_0x3d9e7d[_0x1f13('0xa')])<=0xa?parseInt(_0x3d9e7d[_0x1f13('0xa')])*0x3e8:0x5*0x3e8};try{_0x55aed2['headers']=_0x3d9e7d[_0x1f13('0xb')]?JSON[_0x1f13('0xc')](Mustache[_0x1f13('0x8')](_0x3d9e7d['data6'],_0x41a6c5)):{};}catch(_0x248880){logger[_0x1f13('0xd')](_0x248880[_0x1f13('0xe')]);}switch(_0x3d9e7d[_0x1f13('0xf')][_0x1f13('0x7')]()){case _0x1f13('0x10'):case _0x1f13('0x11'):_0x4e57ab=null;_0x55aed2['qs']=_0x41a6c5;break;case _0x1f13('0x12'):case _0x1f13('0x13'):if(_0x3d9e7d['data7']){try{_0x4e57ab=JSON[_0x1f13('0xc')](Mustache[_0x1f13('0x8')](_0x3d9e7d[_0x1f13('0x14')],_0x41a6c5));_0x55aed2[_0x1f13('0x15')]=_0x4e57ab;}catch(_0x2cd938){logger[_0x1f13('0xd')](_0x2cd938[_0x1f13('0xe')]);logger[_0x1f13('0xd')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x4e57ab=_0x41a6c5;_0x55aed2[_0x1f13('0x15')]=_0x4e57ab;}break;}logger['info'](util[_0x1f13('0x16')](_0x1f13('0x17'),_0x3d9e7d[_0x1f13('0xf')],_0x3d9e7d['data2'],JSON['stringify'](_0x55aed2)));rp(_0x55aed2)[_0x1f13('0x18')](function(_0x5815b9){_0x4e57ab=!_[_0x1f13('0x19')](_0x4e57ab)?_0x1f13('0x1a')+_0x4e57ab:'';_0x5cfd86=typeof _0x5815b9[_0x1f13('0x15')]==='object'?JSON['stringify'](_0x5815b9['body']):_0x5815b9[_0x1f13('0x15')];logger[_0x1f13('0x1b')](util[_0x1f13('0x16')](_0x1f13('0x1c'),_0x3d9e7d[_0x1f13('0xf')],_0x3d9e7d[_0x1f13('0x9')],_0x5815b9[_0x1f13('0x1d')],_0x5cfd86));})[_0x1f13('0x1e')](function(_0xe65d38){logger[_0x1f13('0xd')](util[_0x1f13('0x16')](_0x1f13('0x1f'),_0x3d9e7d[_0x1f13('0xf')],_0x3d9e7d['data2'],_0xe65d38[_0x1f13('0x1d')],_0xe65d38[_0x1f13('0x20')],_0xe65d38[_0x1f13('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 7ce7c6b..a207e45 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 _0xc745=['client','request','debug','rpc','error','message','result','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x3b96cf,_0x1592f2){var _0x2e315a=function(_0x21fa50){while(--_0x21fa50){_0x3b96cf['push'](_0x3b96cf['shift']());}};_0x2e315a(++_0x1592f2);}(_0xc745,0x11a));var _0x5c74=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc745[_0x122ef9];return _0x42fba0;};'use strict';var jayson=require(_0x5c74('0x0'));var BPromise=require(_0x5c74('0x1'));var logger=require(_0x5c74('0x2'))(_0x5c74('0x3'));var client=jayson[_0x5c74('0x4')]['http']({'port':0x2329});client['Request']=function(_0x4de801,_0x39f313){return new BPromise(function(_0x10738b,_0x493ada){return client[_0x5c74('0x5')](_0x4de801,_0x39f313)['then'](function(_0x24950e){logger[_0x5c74('0x6')](_0x5c74('0x7'),_0x5c74('0x3'),_0x4de801,_0x39f313,_0x24950e);if(_0x24950e['error']){logger[_0x5c74('0x8')](_0x5c74('0x7'),_0x5c74('0x3'),_0x4de801,_0x24950e[_0x5c74('0x8')][_0x5c74('0x9')],_0x39f313);return _0x493ada(_0x24950e[_0x5c74('0x8')][_0x5c74('0x9')]);}else{return _0x10738b(_0x24950e[_0x5c74('0xa')]);}})['catch'](function(_0x1cd95e){logger[_0x5c74('0x8')]('rpc',_0x5c74('0x3'),_0x4de801,_0x1cd95e,_0x39f313);return _0x493ada(_0x1cd95e);});});};module['exports']=client; \ No newline at end of file +var _0x088a=['catch','exports','bluebird','routing','client','http','request','error','rpc','message'];(function(_0x4a5240,_0x159b70){var _0x3ffca2=function(_0x33cd4e){while(--_0x33cd4e){_0x4a5240['push'](_0x4a5240['shift']());}};_0x3ffca2(++_0x159b70);}(_0x088a,0x192));var _0xa088=function(_0x3ab7a7,_0x3d421d){_0x3ab7a7=_0x3ab7a7-0x0;var _0x3f7a31=_0x088a[_0x3ab7a7];return _0x3f7a31;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xa088('0x0'));var logger=require('../../config/logger')(_0xa088('0x1'));var client=jayson[_0xa088('0x2')][_0xa088('0x3')]({'port':0x2329});client['Request']=function(_0x1838c2,_0x265e0a){return new BPromise(function(_0x9b054f,_0x5211c4){return client[_0xa088('0x4')](_0x1838c2,_0x265e0a)['then'](function(_0x1b9991){logger['debug']('rpc',_0xa088('0x1'),_0x1838c2,_0x265e0a,_0x1b9991);if(_0x1b9991[_0xa088('0x5')]){logger[_0xa088('0x5')](_0xa088('0x6'),'routing',_0x1838c2,_0x1b9991[_0xa088('0x5')][_0xa088('0x7')],_0x265e0a);return _0x5211c4(_0x1b9991[_0xa088('0x5')][_0xa088('0x7')]);}else{return _0x9b054f(_0x1b9991['result']);}})[_0xa088('0x8')](function(_0x3468e3){logger[_0xa088('0x5')](_0xa088('0x6'),_0xa088('0x1'),_0x1838c2,_0x3468e3,_0x265e0a);return _0x5211c4(_0x3468e3);});});};module[_0xa088('0x9')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 55397a6..eaa6c89 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 _0x1800=['then','mailAccounts','listen','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1800,0x124));var _0x0180=function(_0x3bc222,_0x481df5){_0x3bc222=_0x3bc222-0x0;var _0x574be4=_0x1800[_0x3bc222];return _0x574be4;};'use strict';var server=require(_0x0180('0x0'));var Realtime=require(_0x0180('0x1'));var EmailChannel=require(_0x0180('0x2'));var mailAccount=require(_0x0180('0x3'));var setting=require(_0x0180('0x4'));var logger=require(_0x0180('0x5'))(_0x0180('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x0180('0x7')]()[_0x0180('0x8')](mailAccount['getMailAccounts']())['then'](realtime['initMailAccounts']())[_0x0180('0x8')](function(){email['refresh'](realtime[_0x0180('0x9')]);return realtime;});}function main(){return server[_0x0180('0xa')](realtime,email)[_0x0180('0x8')](function(){return initRealtime();})[_0x0180('0x8')](function(){return setting['getSettings']();})[_0x0180('0x8')](function(_0x3cb87c){return setInterval(initRealtime,_0x3cb87c[_0x0180('0xb')]*0x3e8);})[_0x0180('0xc')](function(_0x3312df){logger[_0x0180('0xd')](_0x0180('0xe'),_0x3312df);});}main(); \ No newline at end of file +var _0x5850=['email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','catch','error','./server','./realtime','./lib/email','./rpc/mailAccount','../../config/logger'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5850,0xeb));var _0x0585=function(_0x1f21e5,_0x7f76df){_0x1f21e5=_0x1f21e5-0x0;var _0x41b8df=_0x5850[_0x1f21e5];return _0x41b8df;};'use strict';var server=require(_0x0585('0x0'));var Realtime=require(_0x0585('0x1'));var EmailChannel=require(_0x0585('0x2'));var mailAccount=require(_0x0585('0x3'));var setting=require('./rpc/setting');var logger=require(_0x0585('0x4'))(_0x0585('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x0585('0x6')]()[_0x0585('0x7')](mailAccount[_0x0585('0x8')]())[_0x0585('0x7')](realtime[_0x0585('0x9')]())['then'](function(){email[_0x0585('0xa')](realtime[_0x0585('0xb')]);return realtime;});}function main(){return server[_0x0585('0xc')](realtime,email)[_0x0585('0x7')](function(){return initRealtime();})[_0x0585('0x7')](function(){return setting['getSettings']();})['then'](function(_0x48d04c){return setInterval(initRealtime,_0x48d04c['loginMailFrequency']*0x3e8);})[_0x0585('0xd')](function(_0x33f3a3){logger[_0x0585('0xe')]('Email\x20service\x20initialization',_0x33f3a3);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 9070558..9b758f5 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 _0x3e90=['then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','verifySmtp','Smtp','verify','verified','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','email','defaults','redis','localhost','socket.io-emitter','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','active','provider','custom','service','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','connected','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify'];(function(_0x3758f0,_0x4ea5a6){var _0x1df736=function(_0x4448e4){while(--_0x4448e4){_0x3758f0['push'](_0x3758f0['shift']());}};_0x1df736(++_0x4ea5a6);}(_0x3e90,0x182));var _0x03e9=function(_0x5115b1,_0x3b237b){_0x5115b1=_0x5115b1-0x0;var _0x140ee5=_0x3e90[_0x5115b1];return _0x140ee5;};'use strict';var _=require(_0x03e9('0x0'));var moment=require(_0x03e9('0x1'));var BPromise=require('bluebird');var md5=require(_0x03e9('0x2'));var Redis=require(_0x03e9('0x3'));var config=require(_0x03e9('0x4'));var logger=require(_0x03e9('0x5'))(_0x03e9('0x6'));config['redis']=_[_0x03e9('0x7')](config[_0x03e9('0x8')],{'host':_0x03e9('0x9'),'port':0x18eb});var io=require(_0x03e9('0xa'))(new Redis(config[_0x03e9('0x8')]));var EmailImap=require(_0x03e9('0xb'));var EmailSmtp=require(_0x03e9('0xc'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x4ca429){logger[_0x03e9('0xd')](_0x03e9('0xe'));this[_0x03e9('0xf')]=_0x4ca429[_0x03e9('0xf')];this[_0x03e9('0x10')]={};this[_0x03e9('0x11')]=new EmailSmtp();}EmailChannel[_0x03e9('0x12')][_0x03e9('0x13')]=function(_0x4a165a){var _0x79161b=this[_0x03e9('0xf')][_0x4a165a];var _0x156a78={'id':_0x79161b['id'],'name':_0x79161b[_0x03e9('0x14')],'key':_0x79161b['key'],'active':_0x79161b['active'],'Imap':{'status':_0x79161b[_0x03e9('0x15')][_0x03e9('0x16')],'messageStatus':_0x79161b['Imap'][_0x03e9('0x17')],'total':_0x79161b[_0x03e9('0x15')][_0x03e9('0x18')]}};if(_[_0x03e9('0x19')](md5Accounts[_0x4a165a])){md5Accounts[_0x4a165a]={};}var _0x3ac8cf=md5(JSON[_0x03e9('0x1a')](_0x156a78));if(md5Accounts[_0x4a165a][_0x03e9('0x2')]!==_0x3ac8cf){md5Accounts[_0x4a165a][_0x03e9('0x2')]=_0x3ac8cf;io[_0x03e9('0x13')](_0x03e9('0x1b'),_0x156a78);}};EmailChannel['prototype'][_0x03e9('0x1c')]=function(_0x3c26ea){for(var _0x1ae065 in _0x3c26ea){if(_0x3c26ea[_0x03e9('0x1d')](_0x1ae065)){if(_0x3c26ea[_0x1ae065][_0x03e9('0x15')]&&_0x3c26ea[_0x1ae065][_0x03e9('0x1e')]){var _0x2eeb2c=_0x3c26ea[_0x1ae065][_0x03e9('0x15')];if(!_0x2eeb2c['service']&&_0x3c26ea[_0x1ae065][_0x03e9('0x1f')]!==_0x03e9('0x20'))_0x2eeb2c[_0x03e9('0x21')]=_0x3c26ea[_0x1ae065][_0x03e9('0x1f')];if(!this['imapAccounts']['hasOwnProperty'](_0x2eeb2c['id'])){this[_0x03e9('0x10')][_0x2eeb2c['id']]=new EmailImap(_0x2eeb2c,_0x3c26ea[_0x1ae065]['email']);this[_0x03e9('0x10')][_0x2eeb2c['id']]['on']('box',this[_0x03e9('0x22')][_0x03e9('0x23')](this,_0x1ae065));this[_0x03e9('0x10')][_0x2eeb2c['id']]['on'](_0x03e9('0x6'),this[_0x03e9('0x24')][_0x03e9('0x23')](this,_0x1ae065));this[_0x03e9('0x10')][_0x2eeb2c['id']]['on'](_0x03e9('0x25'),this[_0x03e9('0x26')][_0x03e9('0x23')](this,_0x1ae065));this[_0x03e9('0x10')][_0x2eeb2c['id']]['on'](_0x03e9('0x27'),this[_0x03e9('0x28')][_0x03e9('0x23')](this,_0x1ae065));}}else{if(_[_0x03e9('0x19')](this['mailAccounts'][_0x1ae065][_0x03e9('0x15')])){this['mailAccounts'][_0x1ae065][_0x03e9('0x15')]={};}this[_0x03e9('0xf')][_0x1ae065][_0x03e9('0x15')]['status']='disabled';this[_0x03e9('0xf')][_0x1ae065]['Imap'][_0x03e9('0x17')]='';this['emit'](_0x1ae065);}}}};EmailChannel[_0x03e9('0x12')][_0x03e9('0x22')]=function(_0x46ca8d,_0xc2d722){if(this[_0x03e9('0xf')][_0x46ca8d]){this['mailAccounts'][_0x46ca8d]['Imap'][_0x03e9('0x16')]=_0x03e9('0x29');this[_0x03e9('0xf')][_0x46ca8d][_0x03e9('0x15')][_0x03e9('0x17')]=_0xc2d722[_0x03e9('0x14')];if(_0xc2d722['messages']){this[_0x03e9('0xf')][_0x46ca8d][_0x03e9('0x15')][_0x03e9('0x18')]=_0xc2d722['messages'][_0x03e9('0x18')];}return this[_0x03e9('0x13')](_0x46ca8d);}};EmailChannel['prototype'][_0x03e9('0x24')]=function(_0x32c427,_0x43f03c){logger[_0x03e9('0xd')](_0x03e9('0x2a'),_0x43f03c['firstName'],_0x43f03c[_0x03e9('0x2b')],_0x43f03c[_0x03e9('0x2c')],_0x32c427);if(this[_0x03e9('0xf')][_0x32c427]){return mailAccount[_0x03e9('0x2d')](_0x32c427,_0x43f03c)[_0x03e9('0x2e')](function(_0x20a0a8){if(_0x20a0a8){logger[_0x03e9('0xd')]('Mail\x20accepted\x20from\x20routing');}})[_0x03e9('0x2f')](function(_0x201c21){logger['error'](_0x03e9('0x30'),JSON['stringify'](_0x201c21));});}};EmailChannel['prototype'][_0x03e9('0x26')]=function(_0xa4a3c1){if(this[_0x03e9('0xf')][_0xa4a3c1]&&this[_0x03e9('0xf')][_0xa4a3c1]['Imap']){if(this[_0x03e9('0x10')][this['mailAccounts'][_0xa4a3c1][_0x03e9('0x15')]['id']]){delete this[_0x03e9('0x10')][this['mailAccounts'][_0xa4a3c1][_0x03e9('0x15')]['id']];}this[_0x03e9('0xf')][_0xa4a3c1][_0x03e9('0x15')]['lastSync']=moment();this['emit'](_0xa4a3c1);}};EmailChannel[_0x03e9('0x12')][_0x03e9('0x28')]=function(_0x1f3637,_0x2dcd5b){if(this['mailAccounts'][_0x1f3637]){this[_0x03e9('0xf')][_0x1f3637]['Imap']['status']='error';this['mailAccounts'][_0x1f3637][_0x03e9('0x15')]['messageStatus']=_0x2dcd5b;return this[_0x03e9('0x13')](_0x1f3637);}};EmailChannel[_0x03e9('0x12')][_0x03e9('0x31')]=function(_0x1c156f,_0x20b3a4){return this['smtp']['send'](_0x1c156f,_0x20b3a4);};EmailChannel['prototype'][_0x03e9('0x32')]=function(_0x5916a1){var _0x5558c4=this;if(this[_0x03e9('0xf')][_0x5916a1['id']]){if(_[_0x03e9('0x19')](this[_0x03e9('0xf')][_0x5916a1['id']][_0x03e9('0x33')])){this['mailAccounts'][_0x5916a1['id']][_0x03e9('0x33')]={};}this[_0x03e9('0xf')][_0x5916a1['id']][_0x03e9('0x33')]['lastSync']=moment();return new BPromise(function(_0x136ad4,_0x4f36b2){return _0x5558c4[_0x03e9('0x11')][_0x03e9('0x34')](_0x5916a1)[_0x03e9('0x2e')](function(_0x4f250b){_0x5558c4[_0x03e9('0xf')][_0x5916a1['id']][_0x03e9('0x33')][_0x03e9('0x16')]=_0x03e9('0x35');_0x5558c4['mailAccounts'][_0x5916a1['id']][_0x03e9('0x33')][_0x03e9('0x17')]='';_0x5558c4['emit'](_0x5916a1['id']);_0x136ad4(_0x4f250b);})['catch'](function(_0x596d5f){_0x5558c4['mailAccounts'][_0x5916a1['id']][_0x03e9('0x33')]['status']=_0x03e9('0x27');_0x5558c4[_0x03e9('0xf')][_0x5916a1['id']][_0x03e9('0x33')][_0x03e9('0x17')]=_0x596d5f;_0x5558c4[_0x03e9('0x13')](_0x5916a1['id']);_0x4f36b2(_0x596d5f);});});}return this[_0x03e9('0x11')][_0x03e9('0x34')](_0x5916a1);};module['exports']=EmailChannel; \ No newline at end of file +var _0xa50c=['total','isNil','stringify','mailAccount:update','hasOwnProperty','service','provider','handleImapBox','handleImapEmail','bind','end','handleImapEnd','error','handleImapError','disabled','name','messages','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','verifySmtp','Smtp','lastSync','verify','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','key','Imap','status','messageStatus'];(function(_0x3dcfcb,_0x3df130){var _0x4785e9=function(_0x3f9800){while(--_0x3f9800){_0x3dcfcb['push'](_0x3dcfcb['shift']());}};_0x4785e9(++_0x3df130);}(_0xa50c,0x199));var _0xca50=function(_0x18e0bf,_0x2b3088){_0x18e0bf=_0x18e0bf-0x0;var _0x13c438=_0xa50c[_0x18e0bf];return _0x13c438;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0xca50('0x0'));var md5=require(_0xca50('0x1'));var Redis=require(_0xca50('0x2'));var config=require(_0xca50('0x3'));var logger=require(_0xca50('0x4'))(_0xca50('0x5'));config[_0xca50('0x6')]=_[_0xca50('0x7')](config[_0xca50('0x6')],{'host':_0xca50('0x8'),'port':0x18eb});var io=require(_0xca50('0x9'))(new Redis(config[_0xca50('0x6')]));var EmailImap=require(_0xca50('0xa'));var EmailSmtp=require('./smtp');var mailAccount=require(_0xca50('0xb'));var md5Accounts={};function EmailChannel(_0x538859){logger[_0xca50('0xc')](_0xca50('0xd'));this[_0xca50('0xe')]=_0x538859[_0xca50('0xe')];this[_0xca50('0xf')]={};this[_0xca50('0x10')]=new EmailSmtp();}EmailChannel[_0xca50('0x11')][_0xca50('0x12')]=function(_0x160603){var _0x46cf6a=this['mailAccounts'][_0x160603];var _0x30ca2d={'id':_0x46cf6a['id'],'name':_0x46cf6a['name'],'key':_0x46cf6a[_0xca50('0x13')],'active':_0x46cf6a['active'],'Imap':{'status':_0x46cf6a[_0xca50('0x14')][_0xca50('0x15')],'messageStatus':_0x46cf6a[_0xca50('0x14')][_0xca50('0x16')],'total':_0x46cf6a[_0xca50('0x14')][_0xca50('0x17')]}};if(_[_0xca50('0x18')](md5Accounts[_0x160603])){md5Accounts[_0x160603]={};}var _0x3811d7=md5(JSON[_0xca50('0x19')](_0x30ca2d));if(md5Accounts[_0x160603][_0xca50('0x1')]!==_0x3811d7){md5Accounts[_0x160603]['md5']=_0x3811d7;io[_0xca50('0x12')](_0xca50('0x1a'),_0x30ca2d);}};EmailChannel['prototype']['refresh']=function(_0x475c92){for(var _0x135794 in _0x475c92){if(_0x475c92[_0xca50('0x1b')](_0x135794)){if(_0x475c92[_0x135794][_0xca50('0x14')]&&_0x475c92[_0x135794]['active']){var _0x4dba19=_0x475c92[_0x135794][_0xca50('0x14')];if(!_0x4dba19[_0xca50('0x1c')]&&_0x475c92[_0x135794][_0xca50('0x1d')]!=='custom')_0x4dba19[_0xca50('0x1c')]=_0x475c92[_0x135794]['provider'];if(!this[_0xca50('0xf')]['hasOwnProperty'](_0x4dba19['id'])){this[_0xca50('0xf')][_0x4dba19['id']]=new EmailImap(_0x4dba19,_0x475c92[_0x135794]['email']);this['imapAccounts'][_0x4dba19['id']]['on']('box',this[_0xca50('0x1e')]['bind'](this,_0x135794));this['imapAccounts'][_0x4dba19['id']]['on'](_0xca50('0x5'),this[_0xca50('0x1f')][_0xca50('0x20')](this,_0x135794));this['imapAccounts'][_0x4dba19['id']]['on'](_0xca50('0x21'),this[_0xca50('0x22')][_0xca50('0x20')](this,_0x135794));this[_0xca50('0xf')][_0x4dba19['id']]['on'](_0xca50('0x23'),this[_0xca50('0x24')][_0xca50('0x20')](this,_0x135794));}}else{if(_['isNil'](this[_0xca50('0xe')][_0x135794][_0xca50('0x14')])){this[_0xca50('0xe')][_0x135794][_0xca50('0x14')]={};}this[_0xca50('0xe')][_0x135794]['Imap'][_0xca50('0x15')]=_0xca50('0x25');this[_0xca50('0xe')][_0x135794]['Imap'][_0xca50('0x16')]='';this[_0xca50('0x12')](_0x135794);}}}};EmailChannel[_0xca50('0x11')][_0xca50('0x1e')]=function(_0x287f5d,_0x50160f){if(this['mailAccounts'][_0x287f5d]){this[_0xca50('0xe')][_0x287f5d]['Imap'][_0xca50('0x15')]='connected';this['mailAccounts'][_0x287f5d]['Imap'][_0xca50('0x16')]=_0x50160f[_0xca50('0x26')];if(_0x50160f[_0xca50('0x27')]){this['mailAccounts'][_0x287f5d]['Imap']['total']=_0x50160f['messages']['total'];}return this[_0xca50('0x12')](_0x287f5d);}};EmailChannel[_0xca50('0x11')]['handleImapEmail']=function(_0x3085b6,_0x5c69b1){logger[_0xca50('0xc')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x5c69b1[_0xca50('0x28')],_0x5c69b1[_0xca50('0x29')],_0x5c69b1[_0xca50('0x2a')],_0x3085b6);if(this['mailAccounts'][_0x3085b6]){return mailAccount[_0xca50('0x2b')](_0x3085b6,_0x5c69b1)[_0xca50('0x2c')](function(_0x279fb6){if(_0x279fb6){logger[_0xca50('0xc')](_0xca50('0x2d'));}})[_0xca50('0x2e')](function(_0x3748d7){logger[_0xca50('0x23')](_0xca50('0x2f'),JSON['stringify'](_0x3748d7));});}};EmailChannel[_0xca50('0x11')][_0xca50('0x22')]=function(_0x43f2c7){if(this[_0xca50('0xe')][_0x43f2c7]&&this['mailAccounts'][_0x43f2c7][_0xca50('0x14')]){if(this[_0xca50('0xf')][this[_0xca50('0xe')][_0x43f2c7][_0xca50('0x14')]['id']]){delete this['imapAccounts'][this['mailAccounts'][_0x43f2c7]['Imap']['id']];}this[_0xca50('0xe')][_0x43f2c7]['Imap']['lastSync']=moment();this[_0xca50('0x12')](_0x43f2c7);}};EmailChannel['prototype'][_0xca50('0x24')]=function(_0xae6ce3,_0x2f50b0){if(this[_0xca50('0xe')][_0xae6ce3]){this[_0xca50('0xe')][_0xae6ce3]['Imap'][_0xca50('0x15')]=_0xca50('0x23');this['mailAccounts'][_0xae6ce3][_0xca50('0x14')]['messageStatus']=_0x2f50b0;return this[_0xca50('0x12')](_0xae6ce3);}};EmailChannel[_0xca50('0x11')][_0xca50('0x30')]=function(_0x1fedca,_0x26350a){return this['smtp'][_0xca50('0x31')](_0x1fedca,_0x26350a);};EmailChannel[_0xca50('0x11')][_0xca50('0x32')]=function(_0x31bca0){var _0x81bd9d=this;if(this[_0xca50('0xe')][_0x31bca0['id']]){if(_[_0xca50('0x18')](this['mailAccounts'][_0x31bca0['id']][_0xca50('0x33')])){this[_0xca50('0xe')][_0x31bca0['id']][_0xca50('0x33')]={};}this[_0xca50('0xe')][_0x31bca0['id']][_0xca50('0x33')][_0xca50('0x34')]=moment();return new BPromise(function(_0x3e0a87,_0x5d4416){return _0x81bd9d[_0xca50('0x10')][_0xca50('0x35')](_0x31bca0)[_0xca50('0x2c')](function(_0x4d09bd){_0x81bd9d[_0xca50('0xe')][_0x31bca0['id']][_0xca50('0x33')][_0xca50('0x15')]='verified';_0x81bd9d[_0xca50('0xe')][_0x31bca0['id']][_0xca50('0x33')]['messageStatus']='';_0x81bd9d[_0xca50('0x12')](_0x31bca0['id']);_0x3e0a87(_0x4d09bd);})[_0xca50('0x2e')](function(_0x5b89f0){_0x81bd9d[_0xca50('0xe')][_0x31bca0['id']][_0xca50('0x33')][_0xca50('0x15')]=_0xca50('0x23');_0x81bd9d['mailAccounts'][_0x31bca0['id']]['Smtp']['messageStatus']=_0x5b89f0;_0x81bd9d['emit'](_0x31bca0['id']);_0x5d4416(_0x5b89f0);});});}return this[_0xca50('0x10')][_0xca50('0x35')](_0x31bca0);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 8049d8b..084def1 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 _0xc650=['ready','end','handleEnd','bind','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','required','handleReady','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','search','handleReadUnseen','fetch','message','closeBox','handleFetchMessage','body','handleMessageAttributes','handleMessageBody','handleSimpleParser','handleMessageEnd','handleFetchEnd','handleFetchError','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','once'];(function(_0x125106,_0x1a5f5d){var _0xc1ffd5=function(_0x338ca5){while(--_0x338ca5){_0x125106['push'](_0x125106['shift']());}};_0xc1ffd5(++_0x1a5f5d);}(_0xc650,0xb1));var _0x0c65=function(_0x40e9cc,_0x2f6503){_0x40e9cc=_0x40e9cc-0x0;var _0x481478=_0xc650[_0x40e9cc];return _0x481478;};'use strict';var _=require(_0x0c65('0x0'));var util=require(_0x0c65('0x1'));var Imap=require(_0x0c65('0x2'));var simpleParser=require(_0x0c65('0x3'))[_0x0c65('0x4')];var Iconv=require(_0x0c65('0x5'))['Iconv'];var EventEmitter=require(_0x0c65('0x6'))[_0x0c65('0x7')];var utils=require(_0x0c65('0x8'));var logger=require(_0x0c65('0x9'))(_0x0c65('0xa'));function EmailImap(_0x96357c,_0x8fe23){this['mailbox']=_0x96357c[_0x0c65('0xb')];this[_0x0c65('0xc')]=this[_0x0c65('0xd')](_0x96357c,_0x8fe23);this[_0x0c65('0x2')]=new Imap(this['account']);this['imap'][_0x0c65('0xe')](_0x0c65('0xf'),this['handleReady']['bind'](this));this[_0x0c65('0x2')]['once'](_0x0c65('0x10'),this[_0x0c65('0x11')][_0x0c65('0x12')](this));this[_0x0c65('0x2')]['on'](_0x0c65('0x13'),this[_0x0c65('0x14')][_0x0c65('0x12')](this));this[_0x0c65('0x2')][_0x0c65('0x15')]();}util[_0x0c65('0x16')](EmailImap,EventEmitter);EmailImap[_0x0c65('0x17')][_0x0c65('0xd')]=function(_0x3fb790,_0x115f74){var _0x395fcf={'connTimeout':_0x3fb790[_0x0c65('0x18')]?_0x3fb790[_0x0c65('0x18')]*0x3e8:0x2710,'authTimeout':_0x3fb790['authTimeout']?_0x3fb790[_0x0c65('0x19')]*0x3e8:0x1388};if(_0x3fb790[_0x0c65('0x1a')]){_0x395fcf[_0x0c65('0x1b')]=_0x3fb790[_0x0c65('0x1b')];if(_0x3fb790[_0x0c65('0x1c')]){_0x395fcf[_0x0c65('0x1d')]=utils[_0x0c65('0x1e')](_0x3fb790[_0x0c65('0x1f')][_0x0c65('0x20')],_0x3fb790[_0x0c65('0x1b')]);}else{_0x395fcf[_0x0c65('0x21')]=_0x3fb790[_0x0c65('0x21')];}}else{if(_0x3fb790[_0x0c65('0x22')]){_0x395fcf[_0x0c65('0x1b')]=_0x3fb790[_0x0c65('0x1b')];_0x395fcf[_0x0c65('0x21')]=_0x3fb790[_0x0c65('0x21')];}}_0x395fcf[_0x0c65('0xa')]=_0x115f74||_0x3fb790[_0x0c65('0x1b')]||'anonymous@xcally.com';_0x395fcf['host']=_0x3fb790[_0x0c65('0x23')];_0x395fcf['port']=_0x3fb790[_0x0c65('0x24')]||0x3e1;if(_0x3fb790['tls']){_0x395fcf[_0x0c65('0x25')]=!![];}else{_0x395fcf[_0x0c65('0x25')]=![];_0x395fcf[_0x0c65('0x26')]=_0x0c65('0x27');}return _0x395fcf;};EmailImap['prototype'][_0x0c65('0x28')]=function(){this[_0x0c65('0x2')][_0x0c65('0x29')](this[_0x0c65('0xb')],![],this[_0x0c65('0x2a')][_0x0c65('0x12')](this));};EmailImap['prototype'][_0x0c65('0x2a')]=function(_0x48e310,_0x359fb3){if(_0x48e310){this[_0x0c65('0x14')](_0x48e310,!![]);}else{this[_0x0c65('0x2b')]('box',_0x359fb3);this[_0x0c65('0x2c')]();}};EmailImap[_0x0c65('0x17')][_0x0c65('0x2d')]=function(_0x187058){if(_0x187058){this[_0x0c65('0x14')](_0x187058,!![]);}else{this['imap'][_0x0c65('0x10')]();}};EmailImap[_0x0c65('0x17')][_0x0c65('0x2c')]=function(){this[_0x0c65('0x2')][_0x0c65('0x2e')](['UNSEEN'],this[_0x0c65('0x2f')]['bind'](this));};EmailImap[_0x0c65('0x17')]['handleReadUnseen']=function(_0x42a073,_0x1b5237){if(_0x42a073){this[_0x0c65('0x14')](_0x42a073,!![]);}else{if(_0x1b5237['length']){try{var _0x1a60fc=this[_0x0c65('0x2')][_0x0c65('0x30')](_0x1b5237,{'bodies':'','markSeen':!![]});_0x1a60fc['on'](_0x0c65('0x31'),this['handleFetchMessage']['bind'](this));_0x1a60fc[_0x0c65('0xe')]('error',this['handleFetchError'][_0x0c65('0x12')](this));_0x1a60fc[_0x0c65('0xe')](_0x0c65('0x10'),this['handleFetchEnd'][_0x0c65('0x12')](this));}catch(_0x5294e6){logger[_0x0c65('0x13')](_0x5294e6);}}else{this[_0x0c65('0x2')][_0x0c65('0x32')](!![],this[_0x0c65('0x2d')][_0x0c65('0x12')](this));}}};EmailImap[_0x0c65('0x17')][_0x0c65('0x33')]=function(_0x4b674e){_0x4b674e['on'](_0x0c65('0x34'),this['handleMessageBody']['bind'](this));_0x4b674e[_0x0c65('0xe')]('attributes',this[_0x0c65('0x35')][_0x0c65('0x12')](this));_0x4b674e[_0x0c65('0xe')](_0x0c65('0x10'),this['handleMessageEnd'][_0x0c65('0x12')](this));};EmailImap['prototype'][_0x0c65('0x36')]=function(_0xe3757){simpleParser(_0xe3757,{'Iconv':Iconv},this[_0x0c65('0x37')][_0x0c65('0x12')](this));};EmailImap['prototype']['handleMessageAttributes']=function(){};EmailImap['prototype'][_0x0c65('0x38')]=function(){};EmailImap[_0x0c65('0x17')][_0x0c65('0x37')]=function(_0x2b75fc,_0x10a6c6){if(_0x2b75fc){logger[_0x0c65('0x13')](_0x2b75fc);}else{var _0x42a2c4=this;utils['parser'](this[_0x0c65('0xc')],_0x10a6c6,function(_0x2b79b4){_0x42a2c4['emit'](_0x0c65('0xa'),_0x2b79b4);});}};EmailImap[_0x0c65('0x17')][_0x0c65('0x39')]=function(){this[_0x0c65('0x2')][_0x0c65('0x32')](!![],this['handleCloseBox'][_0x0c65('0x12')](this));};EmailImap[_0x0c65('0x17')][_0x0c65('0x3a')]=function(_0x1b82e7){this[_0x0c65('0x14')](_0x1b82e7);this[_0x0c65('0x2')][_0x0c65('0x32')](!![],this[_0x0c65('0x2d')]['bind'](this));};EmailImap[_0x0c65('0x17')]['handleEnd']=function(){this[_0x0c65('0x2b')](_0x0c65('0x10'));};EmailImap[_0x0c65('0x17')][_0x0c65('0x14')]=function(_0x9c3037,_0xd9bf8){logger['error']('handleError',this[_0x0c65('0xc')][_0x0c65('0xa')],JSON[_0x0c65('0x3b')](_0x9c3037));var _0x5d878a='';if(_0x9c3037){if(_0x9c3037[_0x0c65('0x3c')]){_0x5d878a=_0x9c3037[_0x0c65('0x3c')];}else{for(var _0x43f558 in _0x9c3037){if(_0x9c3037[_0x0c65('0x3d')](_0x43f558)){_0x5d878a+=_[_0x0c65('0x3e')](_0x43f558)+':\x20'+_0x9c3037[_0x43f558]+'\x0a';}}}}if(_0xd9bf8){this[_0x0c65('0x2')]['end']();}else{this[_0x0c65('0x2b')](_0x0c65('0x13'),_0x5d878a);this[_0x0c65('0x2b')](_0x0c65('0x10'));}};module[_0x0c65('0x3f')]=EmailImap; \ No newline at end of file +var _0x3109=['connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','password','anonymous@xcally.com','host','port','tls','autotls','handleOpenBox','emit','box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','handleFetchError','handleFetchEnd','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','closeBox','stringify','textCode','hasOwnProperty','upperFirst','lodash','util','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','getAccount','imap','account','once','ready','handleReady','handleEnd','error','handleError','bind'];(function(_0x50f3b6,_0x56a9b5){var _0x59a9cc=function(_0x5cfef6){while(--_0x5cfef6){_0x50f3b6['push'](_0x50f3b6['shift']());}};_0x59a9cc(++_0x56a9b5);}(_0x3109,0x68));var _0x9310=function(_0x24e040,_0x1d7365){_0x24e040=_0x24e040-0x0;var _0x212e5b=_0x3109[_0x24e040];return _0x212e5b;};'use strict';var _=require(_0x9310('0x0'));var util=require(_0x9310('0x1'));var Imap=require('imap');var simpleParser=require(_0x9310('0x2'))[_0x9310('0x3')];var Iconv=require(_0x9310('0x4'))[_0x9310('0x5')];var EventEmitter=require(_0x9310('0x6'))[_0x9310('0x7')];var utils=require(_0x9310('0x8'));var logger=require(_0x9310('0x9'))(_0x9310('0xa'));function EmailImap(_0x486bff,_0x1387b6){this[_0x9310('0xb')]=_0x486bff[_0x9310('0xb')];this['account']=this[_0x9310('0xc')](_0x486bff,_0x1387b6);this[_0x9310('0xd')]=new Imap(this[_0x9310('0xe')]);this[_0x9310('0xd')][_0x9310('0xf')](_0x9310('0x10'),this[_0x9310('0x11')]['bind'](this));this['imap'][_0x9310('0xf')]('end',this[_0x9310('0x12')]['bind'](this));this[_0x9310('0xd')]['on'](_0x9310('0x13'),this[_0x9310('0x14')][_0x9310('0x15')](this));this['imap'][_0x9310('0x16')]();}util[_0x9310('0x17')](EmailImap,EventEmitter);EmailImap[_0x9310('0x18')][_0x9310('0xc')]=function(_0x22ac60,_0x5a3fd7){var _0x5f10cc={'connTimeout':_0x22ac60[_0x9310('0x19')]?_0x22ac60[_0x9310('0x19')]*0x3e8:0x2710,'authTimeout':_0x22ac60['authTimeout']?_0x22ac60[_0x9310('0x1a')]*0x3e8:0x1388};if(_0x22ac60[_0x9310('0x1b')]){_0x5f10cc[_0x9310('0x1c')]=_0x22ac60[_0x9310('0x1c')];if(_0x22ac60[_0x9310('0x1d')]){_0x5f10cc[_0x9310('0x1e')]=utils[_0x9310('0x1f')](_0x22ac60[_0x9310('0x20')]['data5'],_0x22ac60[_0x9310('0x1c')]);}else{_0x5f10cc['password']=_0x22ac60[_0x9310('0x21')];}}else{if(_0x22ac60['authentication']){_0x5f10cc['user']=_0x22ac60['user'];_0x5f10cc['password']=_0x22ac60[_0x9310('0x21')];}}_0x5f10cc[_0x9310('0xa')]=_0x5a3fd7||_0x22ac60[_0x9310('0x1c')]||_0x9310('0x22');_0x5f10cc[_0x9310('0x23')]=_0x22ac60[_0x9310('0x23')];_0x5f10cc[_0x9310('0x24')]=_0x22ac60['port']||0x3e1;if(_0x22ac60[_0x9310('0x25')]){_0x5f10cc[_0x9310('0x25')]=!![];}else{_0x5f10cc['tls']=![];_0x5f10cc[_0x9310('0x26')]='required';}return _0x5f10cc;};EmailImap[_0x9310('0x18')][_0x9310('0x11')]=function(){this[_0x9310('0xd')]['openBox'](this[_0x9310('0xb')],![],this[_0x9310('0x27')][_0x9310('0x15')](this));};EmailImap[_0x9310('0x18')][_0x9310('0x27')]=function(_0x180999,_0x2a0d1e){if(_0x180999){this[_0x9310('0x14')](_0x180999,!![]);}else{this[_0x9310('0x28')](_0x9310('0x29'),_0x2a0d1e);this[_0x9310('0x2a')]();}};EmailImap[_0x9310('0x18')][_0x9310('0x2b')]=function(_0x3831fc){if(_0x3831fc){this[_0x9310('0x14')](_0x3831fc,!![]);}else{this[_0x9310('0xd')][_0x9310('0x2c')]();}};EmailImap[_0x9310('0x18')][_0x9310('0x2a')]=function(){this[_0x9310('0xd')][_0x9310('0x2d')]([_0x9310('0x2e')],this[_0x9310('0x2f')][_0x9310('0x15')](this));};EmailImap[_0x9310('0x18')]['handleReadUnseen']=function(_0x5dbf9c,_0x4e3294){if(_0x5dbf9c){this['handleError'](_0x5dbf9c,!![]);}else{if(_0x4e3294[_0x9310('0x30')]){try{var _0x4c7053=this[_0x9310('0xd')]['fetch'](_0x4e3294,{'bodies':'','markSeen':!![]});_0x4c7053['on'](_0x9310('0x31'),this[_0x9310('0x32')]['bind'](this));_0x4c7053[_0x9310('0xf')](_0x9310('0x13'),this[_0x9310('0x33')][_0x9310('0x15')](this));_0x4c7053['once']('end',this[_0x9310('0x34')][_0x9310('0x15')](this));}catch(_0x91d20d){logger[_0x9310('0x13')](_0x91d20d);}}else{this['imap']['closeBox'](!![],this[_0x9310('0x2b')][_0x9310('0x15')](this));}}};EmailImap['prototype'][_0x9310('0x32')]=function(_0x52ae30){_0x52ae30['on']('body',this[_0x9310('0x35')][_0x9310('0x15')](this));_0x52ae30[_0x9310('0xf')]('attributes',this['handleMessageAttributes'][_0x9310('0x15')](this));_0x52ae30[_0x9310('0xf')](_0x9310('0x2c'),this['handleMessageEnd'][_0x9310('0x15')](this));};EmailImap[_0x9310('0x18')][_0x9310('0x35')]=function(_0x46ab3e){simpleParser(_0x46ab3e,{'Iconv':Iconv},this['handleSimpleParser'][_0x9310('0x15')](this));};EmailImap['prototype'][_0x9310('0x36')]=function(){};EmailImap[_0x9310('0x18')][_0x9310('0x37')]=function(){};EmailImap[_0x9310('0x18')][_0x9310('0x38')]=function(_0xb54bda,_0x34dd1d){if(_0xb54bda){logger[_0x9310('0x13')](_0xb54bda);}else{var _0x91a82b=this;utils[_0x9310('0x39')](this[_0x9310('0xe')],_0x34dd1d,function(_0x28fc01){_0x91a82b[_0x9310('0x28')](_0x9310('0xa'),_0x28fc01);});}};EmailImap[_0x9310('0x18')][_0x9310('0x34')]=function(){this[_0x9310('0xd')][_0x9310('0x3a')](!![],this['handleCloseBox'][_0x9310('0x15')](this));};EmailImap[_0x9310('0x18')][_0x9310('0x33')]=function(_0x2e9602){this[_0x9310('0x14')](_0x2e9602);this[_0x9310('0xd')]['closeBox'](!![],this['handleCloseBox'][_0x9310('0x15')](this));};EmailImap[_0x9310('0x18')][_0x9310('0x12')]=function(){this[_0x9310('0x28')]('end');};EmailImap[_0x9310('0x18')][_0x9310('0x14')]=function(_0x18630d,_0x22039e){logger['error'](_0x9310('0x14'),this[_0x9310('0xe')]['email'],JSON[_0x9310('0x3b')](_0x18630d));var _0x1a1bc9='';if(_0x18630d){if(_0x18630d[_0x9310('0x3c')]){_0x1a1bc9=_0x18630d[_0x9310('0x3c')];}else{for(var _0x3e5b6c in _0x18630d){if(_0x18630d[_0x9310('0x3d')](_0x3e5b6c)){_0x1a1bc9+=_[_0x9310('0x3e')](_0x3e5b6c)+':\x20'+_0x18630d[_0x3e5b6c]+'\x0a';}}}}if(_0x22039e){this[_0x9310('0xd')][_0x9310('0x2c')]();}else{this['emit'](_0x9310('0x13'),_0x1a1bc9);this['emit'](_0x9310('0x2c'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 5578fad..af55a04 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 _0x0892=['nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','compile','sendMail','Not\x20verifired','exports'];(function(_0x377a6e,_0x59b99d){var _0x37f751=function(_0x2ed25c){while(--_0x2ed25c){_0x377a6e['push'](_0x377a6e['shift']());}};_0x37f751(++_0x59b99d);}(_0x0892,0x15f));var _0x2089=function(_0x350dd5,_0x3bd466){_0x350dd5=_0x350dd5-0x0;var _0x2f3472=_0x0892[_0x350dd5];return _0x2f3472;};'use strict';var nodemailer=require(_0x2089('0x0'));var inlineBase64=require(_0x2089('0x1'));function EmailSmtp(){}EmailSmtp[_0x2089('0x2')][_0x2089('0x3')]=function(_0xd2ffe8,_0x126b87){return new Promise(function(_0x377f54,_0x17ca22){var _0x54924d=nodemailer[_0x2089('0x4')](_0xd2ffe8);_0x54924d['use'](_0x2089('0x5'),inlineBase64());_0x54924d[_0x2089('0x6')](_0x126b87,function(_0xaac42a,_0x2acd89){if(_0xaac42a){_0x17ca22(_0xaac42a['toString']());}else{_0x377f54(_0x2acd89);}});});};EmailSmtp[_0x2089('0x2')]['verify']=function(_0x646775){return new Promise(function(_0x1e8157,_0x2f5a8c){var _0x1e7aa9=nodemailer[_0x2089('0x4')](_0x646775);_0x1e7aa9['verify'](function(_0x51de4f,_0x4db451){if(_0x51de4f){_0x2f5a8c(_0x51de4f['toString']());}else{if(_0x4db451){_0x1e8157(_0x4db451);}else{_0x2f5a8c(_0x2089('0x7'));}}});});};module[_0x2089('0x8')]=EmailSmtp; \ No newline at end of file +var _0xde5b=['send','createTransport','use','sendMail','toString','verify','Not\x20verifired','exports','nodemailer-plugin-inline-base64','prototype'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xde5b,0x17a));var _0xbde5=function(_0x31abd8,_0x2e3037){_0x31abd8=_0x31abd8-0x0;var _0x5935c1=_0xde5b[_0x31abd8];return _0x5935c1;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0xbde5('0x0'));function EmailSmtp(){}EmailSmtp[_0xbde5('0x1')][_0xbde5('0x2')]=function(_0x21e1db,_0x26ea3f){return new Promise(function(_0x4c1ea0,_0x12475c){var _0x570659=nodemailer[_0xbde5('0x3')](_0x21e1db);_0x570659[_0xbde5('0x4')]('compile',inlineBase64());_0x570659[_0xbde5('0x5')](_0x26ea3f,function(_0x38e094,_0x260657){if(_0x38e094){_0x12475c(_0x38e094[_0xbde5('0x6')]());}else{_0x4c1ea0(_0x260657);}});});};EmailSmtp['prototype'][_0xbde5('0x7')]=function(_0x4888d5){return new Promise(function(_0x1d3943,_0x2bce07){var _0x3a0e34=nodemailer[_0xbde5('0x3')](_0x4888d5);_0x3a0e34[_0xbde5('0x7')](function(_0x3eebe1,_0x5ba6d6){if(_0x3eebe1){_0x2bce07(_0x3eebe1[_0xbde5('0x6')]());}else{if(_0x5ba6d6){_0x1d3943(_0x5ba6d6);}else{_0x2bce07(_0xbde5('0x8'));}}});});};module[_0xbde5('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 4a12b09..8c55be4 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 _0xd25e=['../../../config/logger','email','../../../config/environment','value','address','anonymous','generate','@xcally.com','head','name','substring','indexOf','split','length','slice','join','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','originTo','isEmpty','message','originCc','bcc','attachments','attach','type','attachment','now','root','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','subject','messageId','inReplyTo','date','format','YYYY-MM-DD\x20HH:mm:ss','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Data','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','path','util'];(function(_0x56ff06,_0x51d6f7){var _0x1425d3=function(_0x3d68c9){while(--_0x3d68c9){_0x56ff06['push'](_0x56ff06['shift']());}};_0x1425d3(++_0x51d6f7);}(_0xd25e,0x173));var _0xed25=function(_0x41c5dd,_0x391b74){_0x41c5dd=_0x41c5dd-0x0;var _0x3e6b5a=_0xd25e[_0x41c5dd];return _0x3e6b5a;};'use strict';var _=require(_0xed25('0x0'));var moment=require(_0xed25('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0xed25('0x2'));var util=require(_0xed25('0x3'));var tnef=require('node-tnef');var logger=require(_0xed25('0x4'))(_0xed25('0x5'));var config=require(_0xed25('0x6'));function getAddress(_0x2fc955){var _0x348094=_['head'](_0x2fc955[_0xed25('0x7')]);return _0x348094&&_0x348094['address']?_0x348094[_0xed25('0x8')]:_0xed25('0x9')+random[_0xed25('0xa')](0x6)+_0xed25('0xb');}function getFirstName(_0x2f6886){var _0x4235ba=_[_0xed25('0xc')](_0x2f6886[_0xed25('0x7')]);if(_0x4235ba&&_0x4235ba[_0xed25('0xd')]){if(_0x4235ba[_0xed25('0xd')]==_0x4235ba['address']){return _0x4235ba[_0xed25('0xd')][_0xed25('0xe')](0x0,_0x4235ba[_0xed25('0xd')][_0xed25('0xf')]('@'));}var _0x3b98c2=_0x4235ba[_0xed25('0xd')][_0xed25('0x10')](/\s+/);return _0x3b98c2[_0xed25('0x11')]>0x1?_0x3b98c2[_0xed25('0x12')](0x0,-0x1)[_0xed25('0x13')]('\x20'):_0x4235ba['name'];}return'Anonymous';}function getLastName(_0x4eb27a){var _0x42be8d=_[_0xed25('0xc')](_0x4eb27a['value']);if(_0x42be8d&&_0x42be8d[_0xed25('0xd')]){var _0x3558cf=_0x42be8d[_0xed25('0xd')][_0xed25('0x10')](/\s+/);return _0x3558cf[_0xed25('0x11')]>0x1?_0x3558cf['pop']():'';}return'';}function getMails(_0x2c549f,_0x431b35){var _0x3cd227='';for(var _0x2a9e7c=0x0;_0x2a9e7c<_0x431b35[_0xed25('0x7')][_0xed25('0x11')];_0x2a9e7c+=0x1){if(_0x431b35['value'][_0x2a9e7c][_0xed25('0x8')]!==_0x2c549f){if(!_['isEmpty'](_0x3cd227)){_0x3cd227+=',';}_0x3cd227+=_0x431b35['value'][_0x2a9e7c][_0xed25('0xd')]||_0x431b35[_0xed25('0x7')][_0x2a9e7c][_0xed25('0x8')]||'';_0x3cd227+='\x20<';_0x3cd227+=_0x431b35[_0xed25('0x7')][_0x2a9e7c]['address']?_0x431b35[_0xed25('0x7')][_0x2a9e7c][_0xed25('0x8')]:_0xed25('0x9')+random['generate'](0x6)+_0xed25('0xb');_0x3cd227+='>';}}return _0x3cd227;}function parseEmail(_0x204d1f,_0x49b7aa,_0x1504c4){if(_0x49b7aa[_0xed25('0x14')]){var _0x2789d2=/)<[^<]*)*<\/script>/gi;while(_0x2789d2[_0xed25('0x15')](_0x49b7aa[_0xed25('0x14')])){_0x49b7aa['html']=_0x49b7aa[_0xed25('0x14')][_0xed25('0x16')](_0x2789d2,'');}if(_0x49b7aa[_0xed25('0x14')][_0xed25('0x17')](_0xed25('0x18'))){var _0x587643=[];_0x49b7aa['attachments'][_0xed25('0x19')](_0x47f761=>{_0x587643[_0xed25('0x1a')](_0x47f761[_0xed25('0x1b')]);});var _0x56a355=/]+>/g;var _0x2b6560=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x47cff0=_0x49b7aa['html'][_0xed25('0x16')](_0x2b6560,_0xed25('0x1c'));var _0x2736b2=_0x47cff0[_0xed25('0x16')](_0x56a355,_0xed25('0x1d'));for(let _0x54aac6=0x0;_0x54aac6<_0x587643[_0xed25('0x11')];_0x54aac6++){var _0x22b80c=_0x2736b2[_0xed25('0x16')](_0xed25('0x1d'),_0xed25('0x1e')+_0x587643[_0x54aac6]+_0xed25('0x1f'));_0x2736b2=_0x22b80c;}_0x49b7aa[_0xed25('0x14')]=_0x2736b2;}_0x1504c4['body']=_0x49b7aa[_0xed25('0x14')];}else{_0x1504c4[_0xed25('0x20')]=_0x49b7aa[_0xed25('0x21')];}if(_0x1504c4[_0xed25('0x20')]){_0x1504c4[_0xed25('0x20')]=_0x1504c4[_0xed25('0x20')][_0xed25('0x16')](/0x0){var _0x1c93d2=[_0xed25('0x31'),_0xed25('0x32'),_0xed25('0x33')];for(var _0x2dc3ec=0x0;_0x2dc3ec<_0x49b7aa[_0xed25('0x30')][_0xed25('0x11')];_0x2dc3ec++){var _0x1ef864=_[_0xed25('0xf')](_0x1c93d2,_0x49b7aa[_0xed25('0x30')][_0x2dc3ec][_0xed25('0x34')]);if(_0x1ef864>=0x0){_0x1504c4[_0xed25('0x35')]=!![];}}}return _0x1504c4;}exports[_0xed25('0x36')]=function(_0x379ee,_0x273c05,_0xa1788a){var _0x139ea1={'from':getAddress(_0x273c05[_0xed25('0x37')]),'firstName':getFirstName(_0x273c05[_0xed25('0x37')]),'lastName':getLastName(_0x273c05[_0xed25('0x37')]),'mapKey':_0xed25('0x5'),'message':{'from':getMails(_0x379ee[_0xed25('0x5')],_0x273c05['from']),'to':_0x379ee['email'],'cc':'','subject':_0x273c05[_0xed25('0x38')]||'','messageId':_0x273c05[_0xed25('0x39')],'inReplyTo':_0x273c05[_0xed25('0x3a')],'sentAt':moment(_0x273c05[_0xed25('0x3b')])[_0xed25('0x3c')](_0xed25('0x3d')),'attach':![],'attachments':[]}};if(!_0x273c05[_0xed25('0x14')]&&!_0x273c05['textAsHtml']){var _0x3e677b=_['filter'](_0x273c05['attachments'],{'contentType':'application/ms-tnef'});if(_0x3e677b[_0xed25('0x11')]){logger[_0xed25('0x3e')](util[_0xed25('0x3c')](_0xed25('0x3f'),_0x273c05[_0xed25('0x39')]));tnef[_0xed25('0x40')](_[_0xed25('0x41')](_0x3e677b)[_0xed25('0x2e')],function(_0x4bbf0c,_0x2ba8d1){if(_0x2ba8d1){_0x273c05[_0xed25('0x14')]=_0x2ba8d1[_0xed25('0x42')]||_0xed25('0x43');if(_0x2ba8d1['Attachments']){for(var _0x310c41=0x0;_0x310c41<_0x2ba8d1[_0xed25('0x44')][_0xed25('0x11')];_0x310c41++){var _0x5ee244=_0x2ba8d1[_0xed25('0x44')][_0x310c41];_0x139ea1[_0xed25('0x24')][_0xed25('0x27')][_0xed25('0x1a')]({'filename':_0x5ee244['Title'],'content':Buffer[_0xed25('0x37')](_0x5ee244[_0xed25('0x45')])});}}}_0xa1788a(parseEmail(_0x379ee,_0x273c05,_0x139ea1));});}else{_0x273c05[_0xed25('0x14')]='

Empty\x20message

';_0xa1788a(parseEmail(_0x379ee,_0x273c05,_0x139ea1));}}else{_0xa1788a(parseEmail(_0x379ee,_0x273c05,_0x139ea1));}};exports['generateXOAuth2Token']=function(_0x373dd8,_0x5b83b8){var _0x5d83c4=[_0xed25('0x46')+(_0x5b83b8||''),_0xed25('0x47')+_0x373dd8,'',''];return Buffer[_0xed25('0x37')](_0x5d83c4[_0xed25('0x13')](''),_0xed25('0x48'))[_0xed25('0x49')](_0xed25('0x4a'));}; \ No newline at end of file +var _0xf41c=['@xcally.com','name','substring','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','anonymous','html','test','replace','includes','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','originCc','bcc','attachments','attach','type','attachment','attachment-','format','%s-%s','now','root','push','contentType','headerLines','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','isAutoreply','parser','from','messageId','date','YYYY-MM-DD\x20HH:mm:ss','filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','content','Attachments','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','head','value','address','generate'];(function(_0x321d26,_0x50b3a1){var _0x5cd848=function(_0x59aceb){while(--_0x59aceb){_0x321d26['push'](_0x321d26['shift']());}};_0x5cd848(++_0x50b3a1);}(_0xf41c,0xc6));var _0xcf41=function(_0x46681f,_0x1d8143){_0x46681f=_0x46681f-0x0;var _0x37832a=_0xf41c[_0x46681f];return _0x37832a;};'use strict';var _=require(_0xcf41('0x0'));var moment=require(_0xcf41('0x1'));var random=require(_0xcf41('0x2'));var fs=require('fs');var path=require(_0xcf41('0x3'));var util=require(_0xcf41('0x4'));var tnef=require(_0xcf41('0x5'));var logger=require(_0xcf41('0x6'))(_0xcf41('0x7'));var config=require('../../../config/environment');function getAddress(_0x154412){var _0x44161e=_[_0xcf41('0x8')](_0x154412[_0xcf41('0x9')]);return _0x44161e&&_0x44161e[_0xcf41('0xa')]?_0x44161e[_0xcf41('0xa')]:'anonymous'+random[_0xcf41('0xb')](0x6)+_0xcf41('0xc');}function getFirstName(_0x58a490){var _0x157324=_['head'](_0x58a490[_0xcf41('0x9')]);if(_0x157324&&_0x157324[_0xcf41('0xd')]){if(_0x157324[_0xcf41('0xd')]==_0x157324[_0xcf41('0xa')]){return _0x157324[_0xcf41('0xd')][_0xcf41('0xe')](0x0,_0x157324[_0xcf41('0xd')][_0xcf41('0xf')]('@'));}var _0x30a157=_0x157324[_0xcf41('0xd')][_0xcf41('0x10')](/\s+/);return _0x30a157[_0xcf41('0x11')]>0x1?_0x30a157[_0xcf41('0x12')](0x0,-0x1)[_0xcf41('0x13')]('\x20'):_0x157324[_0xcf41('0xd')];}return _0xcf41('0x14');}function getLastName(_0x295717){var _0x1473b6=_['head'](_0x295717[_0xcf41('0x9')]);if(_0x1473b6&&_0x1473b6['name']){var _0x183633=_0x1473b6[_0xcf41('0xd')][_0xcf41('0x10')](/\s+/);return _0x183633[_0xcf41('0x11')]>0x1?_0x183633[_0xcf41('0x15')]():'';}return'';}function getMails(_0x5924d3,_0x5c8fbe){var _0x2be1be='';for(var _0xd28cbe=0x0;_0xd28cbe<_0x5c8fbe[_0xcf41('0x9')][_0xcf41('0x11')];_0xd28cbe+=0x1){if(_0x5c8fbe[_0xcf41('0x9')][_0xd28cbe]['address']!==_0x5924d3){if(!_[_0xcf41('0x16')](_0x2be1be)){_0x2be1be+=',';}_0x2be1be+=_0x5c8fbe[_0xcf41('0x9')][_0xd28cbe][_0xcf41('0xd')]||_0x5c8fbe[_0xcf41('0x9')][_0xd28cbe][_0xcf41('0xa')]||'';_0x2be1be+='\x20<';_0x2be1be+=_0x5c8fbe['value'][_0xd28cbe]['address']?_0x5c8fbe[_0xcf41('0x9')][_0xd28cbe][_0xcf41('0xa')]:_0xcf41('0x17')+random[_0xcf41('0xb')](0x6)+'@xcally.com';_0x2be1be+='>';}}return _0x2be1be;}function parseEmail(_0x2d76b3,_0x363a91,_0x19c36a){if(_0x363a91[_0xcf41('0x18')]){var _0x1bdd52=/)<[^<]*)*<\/script>/gi;while(_0x1bdd52[_0xcf41('0x19')](_0x363a91['html'])){_0x363a91[_0xcf41('0x18')]=_0x363a91['html'][_0xcf41('0x1a')](_0x1bdd52,'');}if(_0x363a91[_0xcf41('0x18')][_0xcf41('0x1b')]('{_0x516c4a['push'](_0x95a030['filename']);});var _0x497a55=/]+>/g;var _0x281060=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x158008=_0x363a91[_0xcf41('0x18')][_0xcf41('0x1a')](_0x281060,_0xcf41('0x1c'));var _0x479f4d=_0x158008[_0xcf41('0x1a')](_0x497a55,'_IMG');for(let _0x47d1de=0x0;_0x47d1de<_0x516c4a[_0xcf41('0x11')];_0x47d1de++){var _0x38ed7c=_0x479f4d[_0xcf41('0x1a')](_0xcf41('0x1d'),_0xcf41('0x1e')+_0x516c4a[_0x47d1de]+_0xcf41('0x1f'));_0x479f4d=_0x38ed7c;}_0x363a91[_0xcf41('0x18')]=_0x479f4d;}_0x19c36a['body']=_0x363a91[_0xcf41('0x18')];}else{_0x19c36a[_0xcf41('0x20')]=_0x363a91[_0xcf41('0x21')];}if(_0x19c36a[_0xcf41('0x20')]){_0x19c36a[_0xcf41('0x20')]=_0x19c36a[_0xcf41('0x20')][_0xcf41('0x1a')](/0x0){var _0x38bf12=['Auto-Submitted:\x20auto-replied',_0xcf41('0x32'),_0xcf41('0x33')];for(var _0x57f9e3=0x0;_0x57f9e3<_0x363a91[_0xcf41('0x31')]['length'];_0x57f9e3++){var _0x4985c2=_[_0xcf41('0xf')](_0x38bf12,_0x363a91[_0xcf41('0x31')][_0x57f9e3]['line']);if(_0x4985c2>=0x0){_0x19c36a[_0xcf41('0x34')]=!![];}}}return _0x19c36a;}exports[_0xcf41('0x35')]=function(_0x154e79,_0x33c615,_0x4fa677){var _0x2aea7a={'from':getAddress(_0x33c615[_0xcf41('0x36')]),'firstName':getFirstName(_0x33c615['from']),'lastName':getLastName(_0x33c615[_0xcf41('0x36')]),'mapKey':_0xcf41('0x7'),'message':{'from':getMails(_0x154e79[_0xcf41('0x7')],_0x33c615['from']),'to':_0x154e79[_0xcf41('0x7')],'cc':'','subject':_0x33c615['subject']||'','messageId':_0x33c615[_0xcf41('0x37')],'inReplyTo':_0x33c615['inReplyTo'],'sentAt':moment(_0x33c615[_0xcf41('0x38')])[_0xcf41('0x2b')](_0xcf41('0x39')),'attach':![],'attachments':[]}};if(!_0x33c615[_0xcf41('0x18')]&&!_0x33c615['textAsHtml']){var _0x5cc267=_[_0xcf41('0x3a')](_0x33c615[_0xcf41('0x26')],{'contentType':'application/ms-tnef'});if(_0x5cc267[_0xcf41('0x11')]){logger[_0xcf41('0x3b')](util[_0xcf41('0x2b')](_0xcf41('0x3c'),_0x33c615[_0xcf41('0x37')]));tnef[_0xcf41('0x3d')](_['first'](_0x5cc267)[_0xcf41('0x3e')],function(_0x1c918e,_0x538124){if(_0x538124){_0x33c615[_0xcf41('0x18')]=_0x538124['BodyHTML']||'

Empty\x20message

';if(_0x538124[_0xcf41('0x3f')]){for(var _0x3702b9=0x0;_0x3702b9<_0x538124['Attachments']['length'];_0x3702b9++){var _0x5e156d=_0x538124[_0xcf41('0x3f')][_0x3702b9];_0x2aea7a['message'][_0xcf41('0x26')][_0xcf41('0x2f')]({'filename':_0x5e156d['Title'],'content':Buffer[_0xcf41('0x36')](_0x5e156d['Data'])});}}}_0x4fa677(parseEmail(_0x154e79,_0x33c615,_0x2aea7a));});}else{_0x33c615[_0xcf41('0x18')]='

Empty\x20message

';_0x4fa677(parseEmail(_0x154e79,_0x33c615,_0x2aea7a));}}else{_0x4fa677(parseEmail(_0x154e79,_0x33c615,_0x2aea7a));}};exports[_0xcf41('0x40')]=function(_0x37e3e0,_0xe4c920){var _0x34e509=[_0xcf41('0x41')+(_0xe4c920||''),_0xcf41('0x42')+_0x37e3e0,'',''];return Buffer[_0xcf41('0x36')](_0x34e509[_0xcf41('0x13')](''),_0xcf41('0x43'))[_0xcf41('0x44')](_0xcf41('0x45'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 3994931..fbcf624 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 _0xfc69=['key','active','Imap','Smtp','lodash','name','Service'];(function(_0x50bc98,_0x1e99b8){var _0x34163b=function(_0x18b463){while(--_0x18b463){_0x50bc98['push'](_0x50bc98['shift']());}};_0x34163b(++_0x1e99b8);}(_0xfc69,0x89));var _0x9fc6=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0xfc69[_0x342700];return _0x53406f;};'use strict';var _=require(_0x9fc6('0x0'));function MailAccount(_0x13528f){this['id']=_0x13528f['id']||0x0;this[_0x9fc6('0x1')]=_0x13528f[_0x9fc6('0x1')]||_0x9fc6('0x2');this[_0x9fc6('0x3')]=_0x13528f[_0x9fc6('0x3')]||'SERV';this[_0x9fc6('0x4')]=_0x13528f[_0x9fc6('0x4')]||![];this[_0x9fc6('0x5')]=_0x13528f[_0x9fc6('0x5')]||[];this[_0x9fc6('0x6')]=_0x13528f[_0x9fc6('0x6')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x1320=['exports','Service','key','SERV','active','Smtp'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x1320,0x1b1));var _0x0132=function(_0x470170,_0x454483){_0x470170=_0x470170-0x0;var _0x2cc1cc=_0x1320[_0x470170];return _0x2cc1cc;};'use strict';var _=require('lodash');function MailAccount(_0x386708){this['id']=_0x386708['id']||0x0;this['name']=_0x386708['name']||_0x0132('0x0');this[_0x0132('0x1')]=_0x386708[_0x0132('0x1')]||_0x0132('0x2');this[_0x0132('0x3')]=_0x386708[_0x0132('0x3')]||![];this['Imap']=_0x386708['Imap']||[];this['Smtp']=_0x386708[_0x0132('0x4')]||[];}module[_0x0132('0x5')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index c241b7b..35088b1 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 _0x8142=['hasOwnProperty','prototype','mergeFromDatabase','mailAccounts','length','isUndefined','merge','exports','lodash'];(function(_0x5daafc,_0x19f4b0){var _0x220679=function(_0x4b9e83){while(--_0x4b9e83){_0x5daafc['push'](_0x5daafc['shift']());}};_0x220679(++_0x19f4b0);}(_0x8142,0x74));var _0x2814=function(_0x525af9,_0x4edd23){_0x525af9=_0x525af9-0x0;var _0x129fbf=_0x8142[_0x525af9];return _0x129fbf;};'use strict';var _=require(_0x2814('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x19c0e4,_0x5227c3,_0x2e5c70){var _0x4fe3a5=_['mapKeys'](_0x19c0e4,function(_0x2b1611,_0x8c39d7){return _0x2b1611[_0x2e5c70];});for(var _0x5b16e5 in _0x5227c3){if(_0x5227c3[_0x2814('0x1')](_0x5b16e5)){if(!_0x4fe3a5[_0x5b16e5]){delete _0x5227c3[_0x5b16e5];}}}}Realtime[_0x2814('0x2')][_0x2814('0x3')]=function(_0x358922,_0x241f55){for(var _0x535108 in _0x241f55){if(_0x358922[_0x2814('0x1')](_0x535108)){_0x358922[_0x535108]=_0x241f55[_0x535108];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x5917a2=this;return function(_0xfe7223){if(_0xfe7223){freeIsNotKey(_0xfe7223,_0x5917a2[_0x2814('0x4')],'id');for(var _0x386049=0x0,_0x2fec79={},_0x347bdf={};_0x386049<_0xfe7223[_0x2814('0x5')];_0x386049+=0x1){_0x2fec79=_0xfe7223[_0x386049];if(_[_0x2814('0x6')](_0x5917a2[_0x2814('0x4')][_0x2fec79['id']])){_0x5917a2['mailAccounts'][_0x2fec79['id']]=new MailAccount(_0x2fec79);}else{_[_0x2814('0x7')](_0x5917a2['mailAccounts'][_0x2fec79['id']],_0x2fec79);}}}return _0x5917a2[_0x2814('0x4')];};};module[_0x2814('0x8')]=Realtime; \ No newline at end of file +var _0xcee7=['merge','exports','lodash','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length'];(function(_0xa4c81d,_0x29f20c){var _0x3cae79=function(_0xc47ce2){while(--_0xc47ce2){_0xa4c81d['push'](_0xa4c81d['shift']());}};_0x3cae79(++_0x29f20c);}(_0xcee7,0x1a6));var _0x7cee=function(_0x11a1dc,_0x48b098){_0x11a1dc=_0x11a1dc-0x0;var _0x2a1068=_0xcee7[_0x11a1dc];return _0x2a1068;};'use strict';var _=require(_0x7cee('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x7cee('0x1')]={};};function freeIsNotKey(_0x23cb35,_0x55de0d,_0x3ae32c){var _0x12e3bd=_[_0x7cee('0x2')](_0x23cb35,function(_0x5b180e,_0x5a4fdc){return _0x5b180e[_0x3ae32c];});for(var _0x39fa0a in _0x55de0d){if(_0x55de0d[_0x7cee('0x3')](_0x39fa0a)){if(!_0x12e3bd[_0x39fa0a]){delete _0x55de0d[_0x39fa0a];}}}}Realtime[_0x7cee('0x4')][_0x7cee('0x5')]=function(_0x128d06,_0x540e62){for(var _0x3ba9d9 in _0x540e62){if(_0x128d06['hasOwnProperty'](_0x3ba9d9)){_0x128d06[_0x3ba9d9]=_0x540e62[_0x3ba9d9];}}};Realtime[_0x7cee('0x4')][_0x7cee('0x6')]=function(){var _0x1e4243=this;return function(_0x51da63){if(_0x51da63){freeIsNotKey(_0x51da63,_0x1e4243[_0x7cee('0x1')],'id');for(var _0x4fc07b=0x0,_0x19a0e3={},_0x3cc42b={};_0x4fc07b<_0x51da63[_0x7cee('0x7')];_0x4fc07b+=0x1){_0x19a0e3=_0x51da63[_0x4fc07b];if(_['isUndefined'](_0x1e4243[_0x7cee('0x1')][_0x19a0e3['id']])){_0x1e4243[_0x7cee('0x1')][_0x19a0e3['id']]=new MailAccount(_0x19a0e3);}else{_[_0x7cee('0x8')](_0x1e4243[_0x7cee('0x1')][_0x19a0e3['id']],_0x19a0e3);}}}return _0x1e4243[_0x7cee('0x1')];};};module[_0x7cee('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 db6e5a9..df81785 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 _0xd5f9=['getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','provider','service','email','active','key','ListId','CloudProvider','name','type','data5','MailServerOut','Smtp'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd5f9,0x1f1));var _0x9d5f=function(_0x2ab251,_0x41f7bb){_0x2ab251=_0x2ab251-0x0;var _0x4461c4=_0xd5f9[_0x2ab251];return _0x4461c4;};'use strict';var client=require(_0x9d5f('0x0'));exports[_0x9d5f('0x1')]=function(){return function(){return client[_0x9d5f('0x2')](_0x9d5f('0x3'),{'options':{'attributes':['id','name',_0x9d5f('0x4'),_0x9d5f('0x5'),_0x9d5f('0x6'),_0x9d5f('0x7'),_0x9d5f('0x8'),_0x9d5f('0x9'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':'Imap','include':[{'model':_0x9d5f('0xa'),'attributes':['id',_0x9d5f('0xb'),'service',_0x9d5f('0xc'),_0x9d5f('0xd')],'as':'CloudProvider'}]},{'model':_0x9d5f('0xe'),'as':_0x9d5f('0xf'),'include':[{'model':'CloudProvider','attributes':['id',_0x9d5f('0xb'),'service',_0x9d5f('0xc'),_0x9d5f('0xd')],'as':_0x9d5f('0xa')}]}]},'log':_0x9d5f('0x10')});};};exports[_0x9d5f('0x11')]=function(_0x48e120,_0x446a44){return client[_0x9d5f('0x2')](_0x9d5f('0x12'),{'account':{'id':_0x48e120},'body':_0x446a44,'log':_0x9d5f('0x12')});}; \ No newline at end of file +var _0x6f7c=['type','data5','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','email','key','ListId','TemplateId','CloudProvider','Smtp'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6f7c,0x137));var _0xc6f7=function(_0x13dc04,_0x52a21a){_0x13dc04=_0x13dc04-0x0;var _0x2db388=_0x6f7c[_0x13dc04];return _0x2db388;};'use strict';var client=require(_0xc6f7('0x0'));exports[_0xc6f7('0x1')]=function(){return function(){return client[_0xc6f7('0x2')](_0xc6f7('0x3'),{'options':{'attributes':['id',_0xc6f7('0x4'),_0xc6f7('0x5'),_0xc6f7('0x6'),_0xc6f7('0x7'),'active',_0xc6f7('0x8'),_0xc6f7('0x9'),_0xc6f7('0xa')],'raw':![],'include':[{'model':'MailServerIn','as':'Imap','include':[{'model':_0xc6f7('0xb'),'attributes':['id','name',_0xc6f7('0x6'),'type','data5'],'as':_0xc6f7('0xb')}]},{'model':'MailServerOut','as':_0xc6f7('0xc'),'include':[{'model':_0xc6f7('0xb'),'attributes':['id',_0xc6f7('0x4'),_0xc6f7('0x6'),_0xc6f7('0xd'),_0xc6f7('0xe')],'as':_0xc6f7('0xb')}]}]},'log':_0xc6f7('0xf')});};};exports[_0xc6f7('0x10')]=function(_0x488805,_0x1572ae){return client['Request'](_0xc6f7('0x11'),{'account':{'id':_0x488805},'body':_0x1572ae,'log':_0xc6f7('0x11')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index c57e991..5326685 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 _0x18c7=['Request','../client','getSettings'];(function(_0x261b8a,_0x553ec4){var _0x3455e8=function(_0xdf10d4){while(--_0xdf10d4){_0x261b8a['push'](_0x261b8a['shift']());}};_0x3455e8(++_0x553ec4);}(_0x18c7,0x8b));var _0x718c=function(_0x1cf21e,_0x240223){_0x1cf21e=_0x1cf21e-0x0;var _0x21d822=_0x18c7[_0x1cf21e];return _0x21d822;};'use strict';var client=require(_0x718c('0x0'));exports[_0x718c('0x1')]=function(){return client[_0x718c('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':'GetSettings'});}; \ No newline at end of file +var _0x5a59=['ShowSetting','loginMailFrequency','GetSettings','../client','getSettings','Request'];(function(_0x49bdb0,_0x348987){var _0x514346=function(_0x50326d){while(--_0x50326d){_0x49bdb0['push'](_0x49bdb0['shift']());}};_0x514346(++_0x348987);}(_0x5a59,0x1e9));var _0x95a5=function(_0x2b5318,_0x1dcff0){_0x2b5318=_0x2b5318-0x0;var _0x16e75b=_0x5a59[_0x2b5318];return _0x16e75b;};'use strict';var client=require(_0x95a5('0x0'));exports[_0x95a5('0x1')]=function(){return client[_0x95a5('0x2')](_0x95a5('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x95a5('0x4')]},'log':_0x95a5('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 6ce6f7e..2d016e0 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +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(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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 4325428..cfc50dc 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 _0x22db=['createServer','timeout','listen','socket.io','polling','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../routes','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','express','sticky-session','../../config/environment'];(function(_0x296897,_0x4d23ea){var _0x2b44ab=function(_0xdf90d8){while(--_0xdf90d8){_0x296897['push'](_0x296897['shift']());}};_0x2b44ab(++_0x4d23ea);}(_0x22db,0x1e0));var _0xb22d=function(_0x3f1885,_0x3aa3ff){_0x3f1885=_0x3f1885-0x0;var _0x459832=_0x22db[_0x3f1885];return _0x459832;};'use strict';var _=require(_0xb22d('0x0'));var http=require('http');var express=require(_0xb22d('0x1'));var sticky=require(_0xb22d('0x2'));var Redis=require('ioredis');var config=require(_0xb22d('0x3'));var app=express();var server=http[_0xb22d('0x4')](app);server[_0xb22d('0x5')]=0xdbba0;if(sticky[_0xb22d('0x6')](server,config['port'])){var socketio=require(_0xb22d('0x7'))(server,{'transports':['websocket',_0xb22d('0x8')]});config[_0xb22d('0x9')]=_['defaults'](config[_0xb22d('0x9')],{'host':_0xb22d('0xa'),'port':0x18eb});socketio[_0xb22d('0xb')](require(_0xb22d('0xc'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xb22d('0x9')])}));require(_0xb22d('0xd'))[_0xb22d('0xe')]();require(_0xb22d('0xf'))[_0xb22d('0xe')](socketio);require('../../config/express')[_0xb22d('0xe')](app);require(_0xb22d('0x10'))['default'](app);}else{server[_0xb22d('0x11')](_0xb22d('0x12'),function(){console['log'](_0xb22d('0x13'),config[_0xb22d('0x14')]);});}exports=module[_0xb22d('0x15')]=app; \ No newline at end of file +var _0xf07b=['polling','redis','localhost','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','http','express','ioredis','../../config/environment','createServer','timeout','listen','socket.io','websocket'];(function(_0x3452a8,_0x4bfaa4){var _0x233814=function(_0x40b537){while(--_0x40b537){_0x3452a8['push'](_0x3452a8['shift']());}};_0x233814(++_0x4bfaa4);}(_0xf07b,0x7a));var _0xbf07=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xf07b[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xbf07('0x0'));var http=require(_0xbf07('0x1'));var express=require(_0xbf07('0x2'));var sticky=require('sticky-session');var Redis=require(_0xbf07('0x3'));var config=require(_0xbf07('0x4'));var app=express();var server=http[_0xbf07('0x5')](app);server[_0xbf07('0x6')]=0xdbba0;if(sticky[_0xbf07('0x7')](server,config['port'])){var socketio=require(_0xbf07('0x8'))(server,{'transports':[_0xbf07('0x9'),_0xbf07('0xa')]});config[_0xbf07('0xb')]=_['defaults'](config['redis'],{'host':_0xbf07('0xc'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xbf07('0xb')])}));require(_0xbf07('0xd'))[_0xbf07('0xe')]();require(_0xbf07('0xf'))['default'](socketio);require(_0xbf07('0x10'))[_0xbf07('0xe')](app);require(_0xbf07('0x11'))[_0xbf07('0xe')](app);}else{server[_0xbf07('0x12')]('listening',function(){console['log'](_0xbf07('0x13'),config[_0xbf07('0x14')]);});}exports=module[_0xbf07('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index dc671b6..d8919c6 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 _0x042e=['jayson/promise','bluebird','../../config/logger','routing','Request','then','debug','rpc','error','message','catch','exports'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0x042e,0xd8));var _0xe042=function(_0x1db612,_0x572609){_0x1db612=_0x1db612-0x0;var _0x47c65a=_0x042e[_0x1db612];return _0x47c65a;};'use strict';var jayson=require(_0xe042('0x0'));var BPromise=require(_0xe042('0x1'));var logger=require(_0xe042('0x2'))(_0xe042('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0xe042('0x4')]=function(_0x4961e6,_0x371a80){return new BPromise(function(_0x172aa8,_0x4b7c38){return client['request'](_0x4961e6,_0x371a80)[_0xe042('0x5')](function(_0x19c37b){logger[_0xe042('0x6')](_0xe042('0x7'),_0xe042('0x3'),_0x4961e6,_0x371a80,_0x19c37b);if(_0x19c37b[_0xe042('0x8')]){logger['error']('rpc',_0xe042('0x3'),_0x4961e6,_0x19c37b[_0xe042('0x8')]['message'],_0x371a80);return _0x4b7c38(_0x19c37b['error'][_0xe042('0x9')]);}else{return _0x172aa8(_0x19c37b['result']);}})[_0xe042('0xa')](function(_0x1f29b6){logger[_0xe042('0x8')](_0xe042('0x7'),_0xe042('0x3'),_0x4961e6,_0x1f29b6,_0x371a80);return _0x4b7c38(_0x1f29b6);});});};module[_0xe042('0xb')]=client; \ No newline at end of file +var _0xc14b=['Request','request','then','debug','rpc','error','message','result','jayson/promise','bluebird','routing','client','http'];(function(_0x3ae147,_0x4ca19b){var _0x235663=function(_0x1a9a99){while(--_0x1a9a99){_0x3ae147['push'](_0x3ae147['shift']());}};_0x235663(++_0x4ca19b);}(_0xc14b,0x181));var _0xbc14=function(_0x2cad63,_0x15a505){_0x2cad63=_0x2cad63-0x0;var _0x2ac69e=_0xc14b[_0x2cad63];return _0x2ac69e;};'use strict';var jayson=require(_0xbc14('0x0'));var BPromise=require(_0xbc14('0x1'));var logger=require('../../config/logger')(_0xbc14('0x2'));var client=jayson[_0xbc14('0x3')][_0xbc14('0x4')]({'port':0x2329});client[_0xbc14('0x5')]=function(_0x2c90f6,_0x441a5e){return new BPromise(function(_0x1d3dbc,_0x1a61f7){return client[_0xbc14('0x6')](_0x2c90f6,_0x441a5e)[_0xbc14('0x7')](function(_0x20ddad){logger[_0xbc14('0x8')](_0xbc14('0x9'),'routing',_0x2c90f6,_0x441a5e,_0x20ddad);if(_0x20ddad[_0xbc14('0xa')]){logger['error'](_0xbc14('0x9'),_0xbc14('0x2'),_0x2c90f6,_0x20ddad[_0xbc14('0xa')]['message'],_0x441a5e);return _0x1a61f7(_0x20ddad[_0xbc14('0xa')][_0xbc14('0xb')]);}else{return _0x1d3dbc(_0x20ddad[_0xbc14('0xc')]);}})['catch'](function(_0x3d746b){logger[_0xbc14('0xa')](_0xbc14('0x9'),_0xbc14('0x2'),_0x2c90f6,_0x3d746b,_0x441a5e);return _0x1a61f7(_0x3d746b);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 05581c1..9527742 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 _0x5b8f=['getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initFaxQueues','getWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','getAgents','initAgents','getIntervals','initIntervals'];(function(_0x5d8d84,_0x21e7fc){var _0x1f0afe=function(_0x26c9bf){while(--_0x26c9bf){_0x5d8d84['push'](_0x5d8d84['shift']());}};_0x1f0afe(++_0x21e7fc);}(_0x5b8f,0xe4));var _0xf5b8=function(_0x3e186f,_0x2eb7be){_0x3e186f=_0x3e186f-0x0;var _0x3595bf=_0x5b8f[_0x3e186f];return _0x3595bf;};'use strict';var BPromise=require(_0xf5b8('0x0'));var server=require(_0xf5b8('0x1'));var Realtime=require(_0xf5b8('0x2'));var user=require(_0xf5b8('0x3'));var interval=require(_0xf5b8('0x4'));var openchannelQueue=require(_0xf5b8('0x5'));var chatQueue=require(_0xf5b8('0x6'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xf5b8('0x7'));var faxQueue=require(_0xf5b8('0x8'));var whatsappQueue=require(_0xf5b8('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xf5b8('0xa')](user[_0xf5b8('0xb')]())[_0xf5b8('0xa')](realtime[_0xf5b8('0xc')]())['then'](interval[_0xf5b8('0xd')]())[_0xf5b8('0xa')](realtime[_0xf5b8('0xe')]())[_0xf5b8('0xa')](openchannelQueue[_0xf5b8('0xf')]())[_0xf5b8('0xa')](realtime[_0xf5b8('0x10')]())[_0xf5b8('0xa')](chatQueue[_0xf5b8('0x11')]())[_0xf5b8('0xa')](realtime[_0xf5b8('0x12')]())[_0xf5b8('0xa')](smsQueue[_0xf5b8('0x13')]())['then'](realtime[_0xf5b8('0x14')]())['then'](mailQueue[_0xf5b8('0x15')]())['then'](realtime['initMailQueues']())['then'](faxQueue['getFaxQueues']())[_0xf5b8('0xa')](realtime[_0xf5b8('0x16')]())['then'](whatsappQueue[_0xf5b8('0x17')]())[_0xf5b8('0xa')](realtime['initWhatsappQueues']())[_0xf5b8('0xa')](function(){return realtime;});}function main(){return server[_0xf5b8('0x18')](realtime)[_0xf5b8('0xa')](function(_0xc110fd){return initRealtime();})[_0xf5b8('0xa')](function(_0x259fcb){return setInterval(initRealtime,0x1388);})[_0xf5b8('0x19')](function(_0xef6f49){console[_0xf5b8('0x1a')](_0xef6f49);});}main(); \ No newline at end of file +var _0xd704=['./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','log','./realtime','./rpc/user'];(function(_0x3861f7,_0x995b22){var _0x50879f=function(_0x3003f1){while(--_0x3003f1){_0x3861f7['push'](_0x3861f7['shift']());}};_0x50879f(++_0x995b22);}(_0xd704,0xdf));var _0x4d70=function(_0x4eaa76,_0x2cb6ce){_0x4eaa76=_0x4eaa76-0x0;var _0x527a49=_0xd704[_0x4eaa76];return _0x527a49;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0x4d70('0x0'));var user=require(_0x4d70('0x1'));var interval=require(_0x4d70('0x2'));var openchannelQueue=require(_0x4d70('0x3'));var chatQueue=require(_0x4d70('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x4d70('0x5'));var faxQueue=require(_0x4d70('0x6'));var whatsappQueue=require(_0x4d70('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x4d70('0x8')]()[_0x4d70('0x9')](user[_0x4d70('0xa')]())[_0x4d70('0x9')](realtime[_0x4d70('0xb')]())[_0x4d70('0x9')](interval[_0x4d70('0xc')]())[_0x4d70('0x9')](realtime['initIntervals']())['then'](openchannelQueue[_0x4d70('0xd')]())[_0x4d70('0x9')](realtime[_0x4d70('0xe')]())[_0x4d70('0x9')](chatQueue[_0x4d70('0xf')]())['then'](realtime[_0x4d70('0x10')]())['then'](smsQueue[_0x4d70('0x11')]())[_0x4d70('0x9')](realtime['initSmsQueues']())[_0x4d70('0x9')](mailQueue[_0x4d70('0x12')]())['then'](realtime[_0x4d70('0x13')]())['then'](faxQueue[_0x4d70('0x14')]())['then'](realtime[_0x4d70('0x15')]())[_0x4d70('0x9')](whatsappQueue[_0x4d70('0x16')]())[_0x4d70('0x9')](realtime['initWhatsappQueues']())[_0x4d70('0x9')](function(){return realtime;});}function main(){return server[_0x4d70('0x17')](realtime)['then'](function(_0xaf8bd5){return initRealtime();})[_0x4d70('0x9')](function(_0x38c44d){return setInterval(initRealtime,0x1388);})['catch'](function(_0x1b48ff){console[_0x4d70('0x18')](_0x1b48ff);});}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 372a340..c2d26b7 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x6f6049,_0x48ab4d){var _0x183899=function(_0x4b964c){while(--_0x4b964c){_0x6f6049['push'](_0x6f6049['shift']());}};_0x183899(++_0x48ab4d);}(_0xe14b,0x93));var _0xbe14=function(_0x56af09,_0x4fcf12){_0x56af09=_0x56af09-0x0;var _0x290aa3=_0xe14b[_0x56af09];return _0x290aa3;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file +var _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(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1261,0x144));var _0x1126=function(_0x4459b8,_0x3271b8){_0x4459b8=_0x4459b8-0x0;var _0x4a4b07=_0x1261[_0x4459b8];return _0x4a4b07;};'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 8b971f0..c40bd31 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 _0x0469=['bluebird','jayson/promise','client','http','request','then','error','message','result','sendMailMessage','SendMail'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0x0469,0x181));var _0x9046=function(_0x4974b9,_0x3b3903){_0x4974b9=_0x4974b9-0x0;var _0x2564d2=_0x0469[_0x4974b9];return _0x2564d2;};'use strict';var BPromise=require(_0x9046('0x0'));var jayson=require(_0x9046('0x1'));var client=jayson[_0x9046('0x2')][_0x9046('0x3')]({'port':0x232b});function request(_0x45aa16,_0x2ae437){return new BPromise(function(_0x571014,_0x1d872e){return client[_0x9046('0x4')](_0x45aa16,_0x2ae437)[_0x9046('0x5')](function(_0x274a78){if(_0x274a78[_0x9046('0x6')]){return _0x1d872e(_0x274a78['error'][_0x9046('0x7')]);}else{return _0x571014(_0x274a78[_0x9046('0x8')]);}})['catch'](function(_0x4396d1){return _0x1d872e(_0x4396d1);});});}exports[_0x9046('0x9')]=function(_0x5eac99,_0x22b2bb){return request(_0x9046('0xa'),{'account':_0x5eac99,'message':_0x22b2bb});}; \ No newline at end of file +var _0xad70=['message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','then','error'];(function(_0x4e2370,_0x3c2601){var _0x3a9f59=function(_0x120b51){while(--_0x120b51){_0x4e2370['push'](_0x4e2370['shift']());}};_0x3a9f59(++_0x3c2601);}(_0xad70,0xaa));var _0x0ad7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad70[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x0ad7('0x0'));var jayson=require(_0x0ad7('0x1'));var client=jayson[_0x0ad7('0x2')][_0x0ad7('0x3')]({'port':0x232b});function request(_0x32cd49,_0x2d2d78){return new BPromise(function(_0x1d61f1,_0x152ec1){return client['request'](_0x32cd49,_0x2d2d78)[_0x0ad7('0x4')](function(_0x4e6a5f){if(_0x4e6a5f[_0x0ad7('0x5')]){return _0x152ec1(_0x4e6a5f['error'][_0x0ad7('0x6')]);}else{return _0x1d61f1(_0x4e6a5f[_0x0ad7('0x7')]);}})[_0x0ad7('0x8')](function(_0x5a10e5){return _0x152ec1(_0x5a10e5);});});}exports[_0x0ad7('0x9')]=function(_0x50f67c,_0x43db18){return request(_0x0ad7('0xa'),{'account':_0x50f67c,'message':_0x43db18});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index da35c68..2e728e7 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 _0x802d=['openchannel','fax','sms','length','Status','StatusTime','toNumber','format','faxPause','chatStatusTime','chatCapacity','faxStatus','smsStatus','whatsappCurrentCapacity','chatWaitingInteractions','stringify','emit','user:save','exports','lodash','moment','ioredis','defaults','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','smsPause','openchannelPause','chatStatus','unknown','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','Capacity','maxcapacity','working','idle','mail','chat'];(function(_0x46f9d7,_0x272fc6){var _0x31fdc8=function(_0x2feac0){while(--_0x2feac0){_0x46f9d7['push'](_0x46f9d7['shift']());}};_0x31fdc8(++_0x272fc6);}(_0x802d,0x16c));var _0xd802=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x802d[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0xd802('0x0'));var moment=require(_0xd802('0x1'));var md5=require('md5');var Redis=require(_0xd802('0x2'));var config=require('../../../config/environment');config['redis']=_[_0xd802('0x3')](config[_0xd802('0x4')],{'host':_0xd802('0x5'),'port':0x18eb});var io=require(_0xd802('0x6'))(new Redis(config[_0xd802('0x4')]));function Agent(_0x3d41ca){this['id']=_0x3d41ca['id']||0x0;this[_0xd802('0x7')]=_0x3d41ca[_0xd802('0x7')]||'';this[_0xd802('0x8')]=_0x3d41ca[_0xd802('0x8')]||!![];this['voicePause']=_0x3d41ca[_0xd802('0x9')]||![];this[_0xd802('0xa')]=_0x3d41ca[_0xd802('0xa')]||![];this[_0xd802('0xb')]=_0x3d41ca['mailPause']||![];this['faxPause']=_0x3d41ca['faxPause']||![];this[_0xd802('0xc')]=_0x3d41ca[_0xd802('0xc')]||![];this[_0xd802('0xd')]=_0x3d41ca['openchannelPause']||![];this[_0xd802('0xe')]=_0xd802('0xf');this['chatStatusTime']=0x0;this['chatCapacity']=_0x3d41ca['chatCapacity']||0x0;this[_0xd802('0x10')]=0x0;this[_0xd802('0x11')]='unknown';this[_0xd802('0x12')]=0x0;this[_0xd802('0x13')]=_0x3d41ca['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0xd802('0xf');this[_0xd802('0x14')]=0x0;this[_0xd802('0x15')]=_0x3d41ca[_0xd802('0x15')]||0x0;this[_0xd802('0x16')]=0x0;this['smsStatus']='unknown';this[_0xd802('0x17')]=0x0;this[_0xd802('0x18')]=_0x3d41ca[_0xd802('0x18')]||0x0;this[_0xd802('0x19')]=0x0;this[_0xd802('0x1a')]='unknown';this[_0xd802('0x1b')]=0x0;this['whatsappCapacity']=_0x3d41ca[_0xd802('0x1c')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xd802('0x1d')]=_0xd802('0xf');this[_0xd802('0x1e')]=0x0;this[_0xd802('0x1f')]=_0x3d41ca[_0xd802('0x1f')]||0x0;this[_0xd802('0x20')]=0x0;this[_0xd802('0x21')]=![];this[_0xd802('0x22')]=undefined;this[_0xd802('0x23')]='';this['chatWaitingInteractions']={};this[_0xd802('0x24')]={};this[_0xd802('0x25')]={};this[_0xd802('0x26')]={};this[_0xd802('0x27')]={};this[_0xd802('0x28')]={};this[_0xd802('0x29')]();}Agent[_0xd802('0x2a')][_0xd802('0x2b')]=function(_0x4180a6){if(this[_0x4180a6+'CurrentCapacity']>0x0){if(this[_0x4180a6+'Capacity']>0x0&&this[_0x4180a6+'CurrentCapacity']>=this[_0x4180a6+_0xd802('0x2c')]){return _0xd802('0x2d');}else{return _0xd802('0x2e');}}else{return _0xd802('0x2f');}};Agent[_0xd802('0x2a')][_0xd802('0x29')]=function(){var _0x54c344=[_0xd802('0x30'),_0xd802('0x31'),_0xd802('0x32'),_0xd802('0x33'),_0xd802('0x34'),'whatsapp'];for(var _0xa4afd6=0x0;_0xa4afd6<_0x54c344[_0xd802('0x35')];_0xa4afd6+=0x1){var _0x73aa9e=this[_0xd802('0x2b')](_0x54c344[_0xa4afd6]);if(this[_0x54c344[_0xa4afd6]+_0xd802('0x36')]!==_0x73aa9e){this[_0x54c344[_0xa4afd6]+_0xd802('0x37')]=_[_0xd802('0x38')](moment()[_0xd802('0x39')]('x'));}this[_0x54c344[_0xa4afd6]+_0xd802('0x36')]=_0x73aa9e;}var _0x215d0c={'id':this['id'],'name':this[_0xd802('0x7')],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this[_0xd802('0xb')],'smsPause':this[_0xd802('0xc')],'faxPause':this[_0xd802('0x3a')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xd802('0xe')],'chatStatusTime':this[_0xd802('0x3b')],'chatCapacity':this[_0xd802('0x3c')],'chatCurrentCapacity':this[_0xd802('0x10')],'mailStatus':this[_0xd802('0x11')],'mailStatusTime':this[_0xd802('0x12')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xd802('0x3d')],'faxStatusTime':this[_0xd802('0x14')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xd802('0x16')],'smsStatus':this[_0xd802('0x3e')],'smsStatusTime':this[_0xd802('0x17')],'smsCapacity':this[_0xd802('0x18')],'smsCurrentCapacity':this[_0xd802('0x19')],'whatsappStatus':this[_0xd802('0x1a')],'whatsappStatusTime':this[_0xd802('0x1b')],'whatsappCapacity':this[_0xd802('0x1c')],'whatsappCurrentCapacity':this[_0xd802('0x3f')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xd802('0x1e')],'openchannelCapacity':this[_0xd802('0x1f')],'openchannelCurrentCapacity':this[_0xd802('0x20')],'busy':this[_0xd802('0x21')],'busyQueue':this[_0xd802('0x22')],'chatWaitingInteractions':this[_0xd802('0x40')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0xd802('0x25')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x2524ce=md5(JSON[_0xd802('0x41')](_0x215d0c));if(this['md5']!==_0x2524ce){this['md5']=_0x2524ce;io[_0xd802('0x42')](_0xd802('0x43'),_0x215d0c);}};module[_0xd802('0x44')]=Agent; \ No newline at end of file +var _0x33af=['redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailCapacity','faxStatus','unknown','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','fax','sms','length','Status','toNumber','mailStatus','mailStatusTime','mailCurrentCapacity','faxStatusTime','whatsappCurrentCapacity','smsWaitingInteractions','stringify','emit','user:save','lodash','moment','md5','../../../config/environment','defaults'];(function(_0xa0b37f,_0x2437f8){var _0x4a80b4=function(_0x42f56f){while(--_0x42f56f){_0xa0b37f['push'](_0xa0b37f['shift']());}};_0x4a80b4(++_0x2437f8);}(_0x33af,0xbb));var _0xf33a=function(_0x4b5bab,_0x1d73d4){_0x4b5bab=_0x4b5bab-0x0;var _0x5abd6b=_0x33af[_0x4b5bab];return _0x5abd6b;};'use strict';var _=require(_0xf33a('0x0'));var moment=require(_0xf33a('0x1'));var md5=require(_0xf33a('0x2'));var Redis=require('ioredis');var config=require(_0xf33a('0x3'));config['redis']=_[_0xf33a('0x4')](config[_0xf33a('0x5')],{'host':_0xf33a('0x6'),'port':0x18eb});var io=require(_0xf33a('0x7'))(new Redis(config[_0xf33a('0x5')]));function Agent(_0x3ca416){this['id']=_0x3ca416['id']||0x0;this['name']=_0x3ca416[_0xf33a('0x8')]||'';this[_0xf33a('0x9')]=_0x3ca416[_0xf33a('0x9')]||!![];this[_0xf33a('0xa')]=_0x3ca416[_0xf33a('0xa')]||![];this[_0xf33a('0xb')]=_0x3ca416[_0xf33a('0xb')]||![];this[_0xf33a('0xc')]=_0x3ca416[_0xf33a('0xc')]||![];this[_0xf33a('0xd')]=_0x3ca416[_0xf33a('0xd')]||![];this[_0xf33a('0xe')]=_0x3ca416[_0xf33a('0xe')]||![];this[_0xf33a('0xf')]=_0x3ca416[_0xf33a('0xf')]||![];this[_0xf33a('0x10')]='unknown';this[_0xf33a('0x11')]=0x0;this[_0xf33a('0x12')]=_0x3ca416[_0xf33a('0x12')]||0x0;this[_0xf33a('0x13')]=0x0;this['mailStatus']='unknown';this['mailStatusTime']=0x0;this[_0xf33a('0x14')]=_0x3ca416[_0xf33a('0x14')]||0x0;this['mailCurrentCapacity']=0x0;this[_0xf33a('0x15')]=_0xf33a('0x16');this['faxStatusTime']=0x0;this[_0xf33a('0x17')]=_0x3ca416[_0xf33a('0x17')]||0x0;this[_0xf33a('0x18')]=0x0;this[_0xf33a('0x19')]=_0xf33a('0x16');this[_0xf33a('0x1a')]=0x0;this['smsCapacity']=_0x3ca416[_0xf33a('0x1b')]||0x0;this[_0xf33a('0x1c')]=0x0;this['whatsappStatus']=_0xf33a('0x16');this[_0xf33a('0x1d')]=0x0;this[_0xf33a('0x1e')]=_0x3ca416[_0xf33a('0x1e')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xf33a('0x1f')]=_0xf33a('0x16');this[_0xf33a('0x20')]=0x0;this[_0xf33a('0x21')]=_0x3ca416['openchannelCapacity']||0x0;this[_0xf33a('0x22')]=0x0;this['busy']=![];this[_0xf33a('0x23')]=undefined;this['md5']='';this[_0xf33a('0x24')]={};this[_0xf33a('0x25')]={};this[_0xf33a('0x26')]={};this[_0xf33a('0x27')]={};this['smsWaitingInteractions']={};this[_0xf33a('0x28')]={};this[_0xf33a('0x29')]();}Agent[_0xf33a('0x2a')][_0xf33a('0x2b')]=function(_0x28511e){if(this[_0x28511e+_0xf33a('0x2c')]>0x0){if(this[_0x28511e+_0xf33a('0x2d')]>0x0&&this[_0x28511e+_0xf33a('0x2c')]>=this[_0x28511e+_0xf33a('0x2d')]){return _0xf33a('0x2e');}else{return _0xf33a('0x2f');}}else{return _0xf33a('0x30');}};Agent[_0xf33a('0x2a')][_0xf33a('0x29')]=function(){var _0x4506de=[_0xf33a('0x31'),'chat','openchannel',_0xf33a('0x32'),_0xf33a('0x33'),'whatsapp'];for(var _0x439b09=0x0;_0x439b09<_0x4506de[_0xf33a('0x34')];_0x439b09+=0x1){var _0x20e333=this['getChannelStatus'](_0x4506de[_0x439b09]);if(this[_0x4506de[_0x439b09]+_0xf33a('0x35')]!==_0x20e333){this[_0x4506de[_0x439b09]+'StatusTime']=_[_0xf33a('0x36')](moment()['format']('x'));}this[_0x4506de[_0x439b09]+_0xf33a('0x35')]=_0x20e333;}var _0x2e380e={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0xf33a('0xa')],'chatPause':this[_0xf33a('0xb')],'mailPause':this[_0xf33a('0xc')],'smsPause':this[_0xf33a('0xe')],'faxPause':this['faxPause'],'openchannelPause':this[_0xf33a('0xf')],'chatStatus':this[_0xf33a('0x10')],'chatStatusTime':this[_0xf33a('0x11')],'chatCapacity':this[_0xf33a('0x12')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xf33a('0x37')],'mailStatusTime':this[_0xf33a('0x38')],'mailCapacity':this[_0xf33a('0x14')],'mailCurrentCapacity':this[_0xf33a('0x39')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xf33a('0x3a')],'faxCapacity':this[_0xf33a('0x17')],'faxCurrentCapacity':this[_0xf33a('0x18')],'smsStatus':this[_0xf33a('0x19')],'smsStatusTime':this[_0xf33a('0x1a')],'smsCapacity':this[_0xf33a('0x1b')],'smsCurrentCapacity':this[_0xf33a('0x1c')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xf33a('0x1d')],'whatsappCapacity':this[_0xf33a('0x1e')],'whatsappCurrentCapacity':this[_0xf33a('0x3b')],'openchannelStatus':this[_0xf33a('0x1f')],'openchannelStatusTime':this[_0xf33a('0x20')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xf33a('0x22')],'busy':this['busy'],'busyQueue':this[_0xf33a('0x23')],'chatWaitingInteractions':this[_0xf33a('0x24')],'faxWaitingInteractions':this[_0xf33a('0x25')],'mailWaitingInteractions':this[_0xf33a('0x26')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0xf33a('0x3c')],'whatsappWaitingInteractions':this[_0xf33a('0x28')]};var _0x2eb46d=md5(JSON[_0xf33a('0x3d')](_0x2e380e));if(this[_0xf33a('0x2')]!==_0x2eb46d){this[_0xf33a('0x2')]=_0x2eb46d;io[_0xf33a('0x3e')](_0xf33a('0x3f'),_0x2e380e);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 2d27ad3..7b7435c 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 _0xbb57=['Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','paused','length','online','chatPause','available','loggedIn','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall'];(function(_0x45edad,_0x2e5992){var _0x1584f8=function(_0x1d0196){while(--_0x1d0196){_0x45edad['push'](_0x45edad['shift']());}};_0x1584f8(++_0x2e5992);}(_0xbb57,0x148));var _0x7bb5=function(_0x55284d,_0x4fe613){_0x55284d=_0x55284d-0x0;var _0x3f7b97=_0xbb57[_0x55284d];return _0x3f7b97;};'use strict';var _=require(_0x7bb5('0x0'));var md5=require(_0x7bb5('0x1'));var util=require(_0x7bb5('0x2'));var Redis=require(_0x7bb5('0x3'));var config=require(_0x7bb5('0x4'));config['redis']=_[_0x7bb5('0x5')](config['redis'],{'host':_0x7bb5('0x6'),'port':0x18eb});var io=require(_0x7bb5('0x7'))(new Redis(config[_0x7bb5('0x8')]));function ChatQueue(_0x2ae1b9){this['id']=_0x2ae1b9['id']||0x0;this[_0x7bb5('0x9')]=_0x2ae1b9[_0x7bb5('0x9')]||'';this[_0x7bb5('0xa')]=_0x2ae1b9[_0x7bb5('0xa')]||0xa;this[_0x7bb5('0xb')]=_0x2ae1b9['strategy']||_0x7bb5('0xc');this[_0x7bb5('0xd')]=_0x2ae1b9[_0x7bb5('0xd')];this[_0x7bb5('0xe')]={};this['waiting']=0x0;this[_0x7bb5('0x1')]='';this[_0x7bb5('0xf')]();this[_0x7bb5('0x10')]();}ChatQueue[_0x7bb5('0x11')][_0x7bb5('0xf')]=function(){var _0x43f400=this[_0x7bb5('0xe')][_0x7bb5('0x12')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0x7bb5('0xe')][_0x7bb5('0x12')]=_0x43f400;};ChatQueue[_0x7bb5('0x11')][_0x7bb5('0x10')]=function(){this['loggedIn']=0x0;this[_0x7bb5('0x13')]=0x0;for(var _0x33de1e=0x0;_0x33de1e=0x0?this[_0x7bb5('0x17')]:0x0;var _0x1dbaf7={'id':this['id'],'available':this['available'],'loggedIn':this[_0x7bb5('0x18')],'name':this[_0x7bb5('0x9')],'paused':this[_0x7bb5('0x13')],'waiting':this['waiting']};var _0x252e91=md5(JSON[_0x7bb5('0x19')](_0x1dbaf7));if(this[_0x7bb5('0x1')]!==_0x252e91){this[_0x7bb5('0x1')]=_0x252e91;io['to'](util[_0x7bb5('0x1a')](_0x7bb5('0x1b'),_0x1dbaf7[_0x7bb5('0x9')]))[_0x7bb5('0x1c')](_0x7bb5('0x1d'),_0x1dbaf7);}};module[_0x7bb5('0x1e')]=ChatQueue; \ No newline at end of file +var _0x6683=['map','loggedIn','paused','length','online','chatPause','available','stringify','format','chat:queue:%s','emit','exports','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype'];(function(_0xa37706,_0x4a0f17){var _0x533b75=function(_0x4bbf6a){while(--_0x4bbf6a){_0xa37706['push'](_0xa37706['shift']());}};_0x533b75(++_0x4a0f17);}(_0x6683,0x178));var _0x3668=function(_0x285cf1,_0x47e330){_0x285cf1=_0x285cf1-0x0;var _0x2fea93=_0x6683[_0x285cf1];return _0x2fea93;};'use strict';var _=require('lodash');var md5=require(_0x3668('0x0'));var util=require('util');var Redis=require(_0x3668('0x1'));var config=require(_0x3668('0x2'));config[_0x3668('0x3')]=_[_0x3668('0x4')](config['redis'],{'host':_0x3668('0x5'),'port':0x18eb});var io=require(_0x3668('0x6'))(new Redis(config[_0x3668('0x3')]));function ChatQueue(_0x2d028a){this['id']=_0x2d028a['id']||0x0;this[_0x3668('0x7')]=_0x2d028a[_0x3668('0x7')]||'';this['timeout']=_0x2d028a['timeout']||0xa;this[_0x3668('0x8')]=_0x2d028a[_0x3668('0x8')]||_0x3668('0x9');this[_0x3668('0xa')]=_0x2d028a[_0x3668('0xa')];this[_0x3668('0xb')]={};this[_0x3668('0xc')]=0x0;this[_0x3668('0x0')]='';this[_0x3668('0xd')]();this[_0x3668('0xe')]();}ChatQueue[_0x3668('0xf')]['updateRouting']=function(){var _0x302098=this[_0x3668('0xb')]['_rr'];this[_0x3668('0xb')]=_[_0x3668('0x10')](this[_0x3668('0xa')],'id');this[_0x3668('0xb')]['_rr']=_0x302098;};ChatQueue[_0x3668('0xf')]['updateRealtime']=function(){this[_0x3668('0x11')]=0x0;this[_0x3668('0x12')]=0x0;for(var _0x2f3458=0x0;_0x2f3458=0x0?this['available']:0x0;var _0x7e1cd8={'id':this['id'],'available':this[_0x3668('0x16')],'loggedIn':this[_0x3668('0x11')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x3668('0xc')]};var _0x266d5b=md5(JSON[_0x3668('0x17')](_0x7e1cd8));if(this['md5']!==_0x266d5b){this[_0x3668('0x0')]=_0x266d5b;io['to'](util[_0x3668('0x18')](_0x3668('0x19'),_0x7e1cd8[_0x3668('0x7')]))[_0x3668('0x1a')]('chat_queue:save',_0x7e1cd8);}};module[_0x3668('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index da09959..31bd91d 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 _0x61e7=['name','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','redis','defaults','localhost','socket.io-emitter','timeout','beepall','Agents','mapAgentsId','updateRealtime','prototype','updateRouting','map','_rr','loggedIn','paused','length','online','available'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x61e7,0x1d2));var _0x761e=function(_0x5b7a1e,_0x51fa6b){_0x5b7a1e=_0x5b7a1e-0x0;var _0x3dbdbc=_0x61e7[_0x5b7a1e];return _0x3dbdbc;};'use strict';var _=require(_0x761e('0x0'));var md5=require(_0x761e('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x761e('0x2')]=_[_0x761e('0x3')](config[_0x761e('0x2')],{'host':_0x761e('0x4'),'port':0x18eb});var io=require(_0x761e('0x5'))(new Redis(config[_0x761e('0x2')]));function FaxQueue(_0x1a7de1){this['id']=_0x1a7de1['id']||0x0;this['name']=_0x1a7de1['name']||'';this[_0x761e('0x6')]=_0x1a7de1[_0x761e('0x6')]||0xa;this['strategy']=_0x1a7de1['strategy']||_0x761e('0x7');this[_0x761e('0x8')]=_0x1a7de1[_0x761e('0x8')];this[_0x761e('0x9')]={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this[_0x761e('0xa')]();}FaxQueue[_0x761e('0xb')][_0x761e('0xc')]=function(){var _0x2e9abb=this[_0x761e('0x9')]['_rr'];this[_0x761e('0x9')]=_[_0x761e('0xd')](this[_0x761e('0x8')],'id');this[_0x761e('0x9')][_0x761e('0xe')]=_0x2e9abb;};FaxQueue[_0x761e('0xb')][_0x761e('0xa')]=function(){this[_0x761e('0xf')]=0x0;this[_0x761e('0x10')]=0x0;for(var _0x13aef8=0x0;_0x13aef8=0x0?this[_0x761e('0x13')]:0x0;var _0x38de56={'id':this['id'],'available':this[_0x761e('0x13')],'loggedIn':this[_0x761e('0xf')],'name':this[_0x761e('0x14')],'paused':this[_0x761e('0x10')],'waiting':this['waiting']};var _0x3eedce=md5(JSON[_0x761e('0x15')](_0x38de56));if(this[_0x761e('0x1')]!==_0x3eedce){this[_0x761e('0x1')]=_0x3eedce;io['to'](util[_0x761e('0x16')](_0x761e('0x17'),_0x38de56[_0x761e('0x14')]))[_0x761e('0x18')](_0x761e('0x19'),_0x38de56);}};module[_0x761e('0x1a')]=FaxQueue; \ No newline at end of file +var _0x31f1=['beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','faxPause','available','waiting','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x2265e3,_0x3d5275){var _0xc57ece=function(_0x1b686d){while(--_0x1b686d){_0x2265e3['push'](_0x2265e3['shift']());}};_0xc57ece(++_0x3d5275);}(_0x31f1,0x145));var _0x131f=function(_0x786293,_0x11a1dd){_0x786293=_0x786293-0x0;var _0x2d02ce=_0x31f1[_0x786293];return _0x2d02ce;};'use strict';var _=require(_0x131f('0x0'));var md5=require(_0x131f('0x1'));var util=require('util');var Redis=require(_0x131f('0x2'));var config=require(_0x131f('0x3'));config[_0x131f('0x4')]=_[_0x131f('0x5')](config[_0x131f('0x4')],{'host':_0x131f('0x6'),'port':0x18eb});var io=require(_0x131f('0x7'))(new Redis(config['redis']));function FaxQueue(_0x16aa2e){this['id']=_0x16aa2e['id']||0x0;this[_0x131f('0x8')]=_0x16aa2e['name']||'';this[_0x131f('0x9')]=_0x16aa2e['timeout']||0xa;this[_0x131f('0xa')]=_0x16aa2e[_0x131f('0xa')]||_0x131f('0xb');this[_0x131f('0xc')]=_0x16aa2e[_0x131f('0xc')];this[_0x131f('0xd')]={};this['waiting']=0x0;this['md5']='';this[_0x131f('0xe')]();this[_0x131f('0xf')]();}FaxQueue[_0x131f('0x10')]['updateRouting']=function(){var _0x3d3f0e=this[_0x131f('0xd')][_0x131f('0x11')];this[_0x131f('0xd')]=_['map'](this[_0x131f('0xc')],'id');this[_0x131f('0xd')][_0x131f('0x11')]=_0x3d3f0e;};FaxQueue['prototype'][_0x131f('0xf')]=function(){this[_0x131f('0x12')]=0x0;this[_0x131f('0x13')]=0x0;for(var _0x53e32a=0x0;_0x53e32a=0x0?this[_0x131f('0x16')]:0x0;var _0x2cd21d={'id':this['id'],'available':this[_0x131f('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x131f('0x8')],'paused':this[_0x131f('0x13')],'waiting':this[_0x131f('0x17')]};var _0x25acaf=md5(JSON['stringify'](_0x2cd21d));if(this[_0x131f('0x1')]!==_0x25acaf){this[_0x131f('0x1')]=_0x25acaf;io['to'](util['format'](_0x131f('0x18'),_0x2cd21d[_0x131f('0x8')]))[_0x131f('0x19')](_0x131f('0x1a'),_0x2cd21d);}};module[_0x131f('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 d78fcba..267151d 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 _0x80a0=['name','Intervals','exports'];(function(_0x3017a4,_0x1664cb){var _0x467b3d=function(_0x82d36f){while(--_0x82d36f){_0x3017a4['push'](_0x3017a4['shift']());}};_0x467b3d(++_0x1664cb);}(_0x80a0,0x138));var _0x080a=function(_0x405c76,_0x428f48){_0x405c76=_0x405c76-0x0;var _0x2e84ec=_0x80a0[_0x405c76];return _0x2e84ec;};'use strict';function Interval(_0x1fc7c5){this['id']=_0x1fc7c5['id']||0x0;this[_0x080a('0x0')]=_0x1fc7c5[_0x080a('0x0')]||'';this[_0x080a('0x1')]=_0x1fc7c5[_0x080a('0x1')]||{};}module[_0x080a('0x2')]=Interval; \ No newline at end of file +var _0x2271=['name','Intervals','exports'];(function(_0x4a095e,_0x381cd5){var _0x10ef73=function(_0x1f6964){while(--_0x1f6964){_0x4a095e['push'](_0x4a095e['shift']());}};_0x10ef73(++_0x381cd5);}(_0x2271,0x69));var _0x1227=function(_0x13db6d,_0x3e0feb){_0x13db6d=_0x13db6d-0x0;var _0x5890d6=_0x2271[_0x13db6d];return _0x5890d6;};'use strict';function Interval(_0x1802c5){this['id']=_0x1802c5['id']||0x0;this[_0x1227('0x0')]=_0x1802c5[_0x1227('0x0')]||'';this['Intervals']=_0x1802c5[_0x1227('0x1')]||{};}module[_0x1227('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 67541a6..c46dbd2 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 _0x1141=['util','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','available','waiting','stringify','mail:queue:%s','emit','mail_queue:save','exports'];(function(_0x10ce92,_0x471996){var _0x3f54e7=function(_0x150736){while(--_0x150736){_0x10ce92['push'](_0x10ce92['shift']());}};_0x3f54e7(++_0x471996);}(_0x1141,0x138));var _0x1114=function(_0x1d6528,_0x1c20a3){_0x1d6528=_0x1d6528-0x0;var _0x3928df=_0x1141[_0x1d6528];return _0x3928df;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x1114('0x0'));var Redis=require('ioredis');var config=require(_0x1114('0x1'));config[_0x1114('0x2')]=_[_0x1114('0x3')](config[_0x1114('0x2')],{'host':_0x1114('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1114('0x2')]));function MailQueue(_0x10399f){this['id']=_0x10399f['id']||0x0;this['name']=_0x10399f[_0x1114('0x5')]||'';this[_0x1114('0x6')]=_0x10399f['timeout']||0xa;this[_0x1114('0x7')]=_0x10399f['strategy']||'beepall';this[_0x1114('0x8')]=_0x10399f['Agents'];this[_0x1114('0x9')]={};this['waiting']=0x0;this[_0x1114('0xa')]='';this[_0x1114('0xb')]();this[_0x1114('0xc')]();}MailQueue[_0x1114('0xd')][_0x1114('0xb')]=function(){var _0x5d2e85=this[_0x1114('0x9')][_0x1114('0xe')];this['mapAgentsId']=_[_0x1114('0xf')](this['Agents'],'id');this['mapAgentsId'][_0x1114('0xe')]=_0x5d2e85;};MailQueue['prototype'][_0x1114('0xc')]=function(){this[_0x1114('0x10')]=0x0;this[_0x1114('0x11')]=0x0;for(var _0x1d47a8=0x0;_0x1d47a8=0x0?this[_0x1114('0x13')]:0x0;var _0x34157a={'id':this['id'],'available':this[_0x1114('0x13')],'loggedIn':this[_0x1114('0x10')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1114('0x14')]};var _0xd0e727=md5(JSON[_0x1114('0x15')](_0x34157a));if(this[_0x1114('0xa')]!==_0xd0e727){this[_0x1114('0xa')]=_0xd0e727;io['to'](util['format'](_0x1114('0x16'),_0x34157a[_0x1114('0x5')]))[_0x1114('0x17')](_0x1114('0x18'),_0x34157a);}};module[_0x1114('0x19')]=MailQueue; \ No newline at end of file +var _0xefae=['emit','mail_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','online','mailPause','available','stringify','format','mail:queue:%s'];(function(_0x5de51f,_0x47a799){var _0x32c138=function(_0x261666){while(--_0x261666){_0x5de51f['push'](_0x5de51f['shift']());}};_0x32c138(++_0x47a799);}(_0xefae,0x158));var _0xeefa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xefae[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var md5=require(_0xeefa('0x0'));var util=require(_0xeefa('0x1'));var Redis=require(_0xeefa('0x2'));var config=require(_0xeefa('0x3'));config[_0xeefa('0x4')]=_[_0xeefa('0x5')](config[_0xeefa('0x4')],{'host':_0xeefa('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xeefa('0x4')]));function MailQueue(_0x355a8a){this['id']=_0x355a8a['id']||0x0;this[_0xeefa('0x7')]=_0x355a8a['name']||'';this[_0xeefa('0x8')]=_0x355a8a[_0xeefa('0x8')]||0xa;this['strategy']=_0x355a8a[_0xeefa('0x9')]||_0xeefa('0xa');this[_0xeefa('0xb')]=_0x355a8a['Agents'];this[_0xeefa('0xc')]={};this[_0xeefa('0xd')]=0x0;this['md5']='';this[_0xeefa('0xe')]();this['updateRealtime']();}MailQueue[_0xeefa('0xf')]['updateRouting']=function(){var _0x4b45f1=this['mapAgentsId'][_0xeefa('0x10')];this[_0xeefa('0xc')]=_[_0xeefa('0x11')](this[_0xeefa('0xb')],'id');this[_0xeefa('0xc')][_0xeefa('0x10')]=_0x4b45f1;};MailQueue['prototype'][_0xeefa('0x12')]=function(){this[_0xeefa('0x13')]=0x0;this[_0xeefa('0x14')]=0x0;for(var _0x2ebcd7=0x0;_0x2ebcd7=0x0?this[_0xeefa('0x18')]:0x0;var _0x32b333={'id':this['id'],'available':this[_0xeefa('0x18')],'loggedIn':this[_0xeefa('0x13')],'name':this[_0xeefa('0x7')],'paused':this[_0xeefa('0x14')],'waiting':this['waiting']};var _0xae53eb=md5(JSON[_0xeefa('0x19')](_0x32b333));if(this['md5']!==_0xae53eb){this[_0xeefa('0x0')]=_0xae53eb;io['to'](util[_0xeefa('0x1a')](_0xeefa('0x1b'),_0x32b333[_0xeefa('0x7')]))[_0xeefa('0x1c')](_0xeefa('0x1d'),_0x32b333);}};module[_0xeefa('0x1e')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 8d1d340..8e29f2f 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 _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0x1261,0x144));var _0x1126=function(_0x2cbec0,_0x262fef){_0x2cbec0=_0x2cbec0-0x0;var _0x3d4101=_0x1261[_0x2cbec0];return _0x3d4101;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x326f,0xd1));var _0xf326=function(_0x78ac42,_0x172e09){_0x78ac42=_0x78ac42-0x0;var _0x1a55b6=_0x326f[_0x78ac42];return _0x1a55b6;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index e03da1d..e8091b4 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 _0xaf93=['_rr','map','paused','online','loggedIn','smsPause','available','waiting','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','updateRouting','updateRealtime','prototype','mapAgentsId'];(function(_0x44b648,_0x1567d9){var _0x83dfb2=function(_0x3a8446){while(--_0x3a8446){_0x44b648['push'](_0x44b648['shift']());}};_0x83dfb2(++_0x1567d9);}(_0xaf93,0x151));var _0x3af9=function(_0x1b41a0,_0x24e232){_0x1b41a0=_0x1b41a0-0x0;var _0x5e5e27=_0xaf93[_0x1b41a0];return _0x5e5e27;};'use strict';var _=require(_0x3af9('0x0'));var md5=require(_0x3af9('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x3af9('0x2'));config[_0x3af9('0x3')]=_['defaults'](config[_0x3af9('0x3')],{'host':_0x3af9('0x4'),'port':0x18eb});var io=require(_0x3af9('0x5'))(new Redis(config[_0x3af9('0x3')]));function SmsQueue(_0x1cbec3){this['id']=_0x1cbec3['id']||0x0;this[_0x3af9('0x6')]=_0x1cbec3[_0x3af9('0x6')]||'';this['timeout']=_0x1cbec3[_0x3af9('0x7')]||0xa;this['strategy']=_0x1cbec3[_0x3af9('0x8')]||'beepall';this['Agents']=_0x1cbec3[_0x3af9('0x9')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x3af9('0x1')]='';this[_0x3af9('0xa')]();this[_0x3af9('0xb')]();}SmsQueue[_0x3af9('0xc')]['updateRouting']=function(){var _0x4392b9=this[_0x3af9('0xd')][_0x3af9('0xe')];this[_0x3af9('0xd')]=_[_0x3af9('0xf')](this[_0x3af9('0x9')],'id');this[_0x3af9('0xd')][_0x3af9('0xe')]=_0x4392b9;};SmsQueue['prototype'][_0x3af9('0xb')]=function(){this['loggedIn']=0x0;this[_0x3af9('0x10')]=0x0;for(var _0x222b6f=0x0;_0x222b6f=0x0?this[_0x3af9('0x14')]:0x0;var _0x1b8cab={'id':this['id'],'available':this[_0x3af9('0x14')],'loggedIn':this['loggedIn'],'name':this[_0x3af9('0x6')],'paused':this[_0x3af9('0x10')],'waiting':this[_0x3af9('0x15')]};var _0x1f685e=md5(JSON[_0x3af9('0x16')](_0x1b8cab));if(this['md5']!==_0x1f685e){this[_0x3af9('0x1')]=_0x1f685e;io['to'](util[_0x3af9('0x17')](_0x3af9('0x18'),_0x1b8cab[_0x3af9('0x6')]))[_0x3af9('0x19')](_0x3af9('0x1a'),_0x1b8cab);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xde64=['sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','map','updateRealtime','loggedIn','paused','length','available','stringify','format'];(function(_0x516b99,_0x24bf9a){var _0x290cef=function(_0x561723){while(--_0x561723){_0x516b99['push'](_0x516b99['shift']());}};_0x290cef(++_0x24bf9a);}(_0xde64,0x17c));var _0x4de6=function(_0xfbb651,_0x572b26){_0xfbb651=_0xfbb651-0x0;var _0x4b2002=_0xde64[_0xfbb651];return _0x4b2002;};'use strict';var _=require(_0x4de6('0x0'));var md5=require(_0x4de6('0x1'));var util=require(_0x4de6('0x2'));var Redis=require(_0x4de6('0x3'));var config=require(_0x4de6('0x4'));config[_0x4de6('0x5')]=_['defaults'](config[_0x4de6('0x5')],{'host':_0x4de6('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function SmsQueue(_0xe0bed){this['id']=_0xe0bed['id']||0x0;this[_0x4de6('0x7')]=_0xe0bed['name']||'';this['timeout']=_0xe0bed[_0x4de6('0x8')]||0xa;this[_0x4de6('0x9')]=_0xe0bed[_0x4de6('0x9')]||_0x4de6('0xa');this[_0x4de6('0xb')]=_0xe0bed[_0x4de6('0xb')];this['mapAgentsId']={};this[_0x4de6('0xc')]=0x0;this[_0x4de6('0x1')]='';this[_0x4de6('0xd')]();this['updateRealtime']();}SmsQueue[_0x4de6('0xe')][_0x4de6('0xd')]=function(){var _0x2e205b=this[_0x4de6('0xf')][_0x4de6('0x10')];this['mapAgentsId']=_[_0x4de6('0x11')](this[_0x4de6('0xb')],'id');this[_0x4de6('0xf')]['_rr']=_0x2e205b;};SmsQueue[_0x4de6('0xe')][_0x4de6('0x12')]=function(){this[_0x4de6('0x13')]=0x0;this[_0x4de6('0x14')]=0x0;for(var _0x58b0c1=0x0;_0x58b0c1=0x0?this[_0x4de6('0x16')]:0x0;var _0x5aacb4={'id':this['id'],'available':this[_0x4de6('0x16')],'loggedIn':this[_0x4de6('0x13')],'name':this[_0x4de6('0x7')],'paused':this[_0x4de6('0x14')],'waiting':this[_0x4de6('0xc')]};var _0x360cf7=md5(JSON[_0x4de6('0x17')](_0x5aacb4));if(this[_0x4de6('0x1')]!==_0x360cf7){this[_0x4de6('0x1')]=_0x360cf7;io['to'](util[_0x4de6('0x18')]('sms:queue:%s',_0x5aacb4[_0x4de6('0x7')]))['emit'](_0x4de6('0x19'),_0x5aacb4);}};module[_0x4de6('0x1a')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 1acde6e..aac6326 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 _0x8f6a=['whatsapp_queue:save','exports','lodash','util','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','whatsappPause','paused','available','stringify','format','whatsapp:queue:%s','emit'];(function(_0x173999,_0x2370be){var _0x8feb60=function(_0x53cfe3){while(--_0x53cfe3){_0x173999['push'](_0x173999['shift']());}};_0x8feb60(++_0x2370be);}(_0x8f6a,0xd4));var _0xa8f6=function(_0xa468a4,_0x457e23){_0xa468a4=_0xa468a4-0x0;var _0x12d389=_0x8f6a[_0xa468a4];return _0x12d389;};'use strict';var _=require(_0xa8f6('0x0'));var md5=require('md5');var util=require(_0xa8f6('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xa8f6('0x2')]=_['defaults'](config[_0xa8f6('0x2')],{'host':_0xa8f6('0x3'),'port':0x18eb});var io=require(_0xa8f6('0x4'))(new Redis(config[_0xa8f6('0x2')]));function WhatsappQueue(_0x4e7a6b){this['id']=_0x4e7a6b['id']||0x0;this[_0xa8f6('0x5')]=_0x4e7a6b['name']||'';this[_0xa8f6('0x6')]=_0x4e7a6b['timeout']||0xa;this[_0xa8f6('0x7')]=_0x4e7a6b[_0xa8f6('0x7')]||_0xa8f6('0x8');this['Agents']=_0x4e7a6b[_0xa8f6('0x9')];this[_0xa8f6('0xa')]={};this[_0xa8f6('0xb')]=0x0;this[_0xa8f6('0xc')]='';this['updateRouting']();this[_0xa8f6('0xd')]();}WhatsappQueue[_0xa8f6('0xe')][_0xa8f6('0xf')]=function(){var _0x4a7b5b=this[_0xa8f6('0xa')][_0xa8f6('0x10')];this[_0xa8f6('0xa')]=_[_0xa8f6('0x11')](this[_0xa8f6('0x9')],'id');this[_0xa8f6('0xa')][_0xa8f6('0x10')]=_0x4a7b5b;};WhatsappQueue[_0xa8f6('0xe')]['updateRealtime']=function(){this[_0xa8f6('0x12')]=0x0;this['paused']=0x0;for(var _0x2f0ec2=0x0;_0x2f0ec2=0x0?this[_0xa8f6('0x17')]:0x0;var _0x3ad575={'id':this['id'],'available':this['available'],'loggedIn':this[_0xa8f6('0x12')],'name':this[_0xa8f6('0x5')],'paused':this[_0xa8f6('0x16')],'waiting':this['waiting']};var _0x5d8b47=md5(JSON[_0xa8f6('0x18')](_0x3ad575));if(this[_0xa8f6('0xc')]!==_0x5d8b47){this[_0xa8f6('0xc')]=_0x5d8b47;io['to'](util[_0xa8f6('0x19')](_0xa8f6('0x1a'),_0x3ad575[_0xa8f6('0x5')]))[_0xa8f6('0x1b')](_0xa8f6('0x1c'),_0x3ad575);}};module[_0xa8f6('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0x4ff6=['prototype','map','paused','length','online','loggedIn','whatsappPause','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x5c39b6,_0x516984){var _0x5d57f2=function(_0x37c2f8){while(--_0x37c2f8){_0x5c39b6['push'](_0x5c39b6['shift']());}};_0x5d57f2(++_0x516984);}(_0x4ff6,0x1ed));var _0x64ff=function(_0x176cc0,_0x41b955){_0x176cc0=_0x176cc0-0x0;var _0x5b056c=_0x4ff6[_0x176cc0];return _0x5b056c;};'use strict';var _=require(_0x64ff('0x0'));var md5=require(_0x64ff('0x1'));var util=require('util');var Redis=require(_0x64ff('0x2'));var config=require(_0x64ff('0x3'));config['redis']=_[_0x64ff('0x4')](config[_0x64ff('0x5')],{'host':_0x64ff('0x6'),'port':0x18eb});var io=require(_0x64ff('0x7'))(new Redis(config[_0x64ff('0x5')]));function WhatsappQueue(_0xe8d088){this['id']=_0xe8d088['id']||0x0;this[_0x64ff('0x8')]=_0xe8d088[_0x64ff('0x8')]||'';this[_0x64ff('0x9')]=_0xe8d088[_0x64ff('0x9')]||0xa;this[_0x64ff('0xa')]=_0xe8d088['strategy']||_0x64ff('0xb');this[_0x64ff('0xc')]=_0xe8d088['Agents'];this[_0x64ff('0xd')]={};this[_0x64ff('0xe')]=0x0;this[_0x64ff('0x1')]='';this[_0x64ff('0xf')]();this[_0x64ff('0x10')]();}WhatsappQueue[_0x64ff('0x11')]['updateRouting']=function(){var _0x5ebaf5=this[_0x64ff('0xd')]['_rr'];this[_0x64ff('0xd')]=_[_0x64ff('0x12')](this[_0x64ff('0xc')],'id');this[_0x64ff('0xd')]['_rr']=_0x5ebaf5;};WhatsappQueue['prototype'][_0x64ff('0x10')]=function(){this['loggedIn']=0x0;this[_0x64ff('0x13')]=0x0;for(var _0x13dfa4=0x0;_0x13dfa4=0x0?this[_0x64ff('0x18')]:0x0;var _0x260c90={'id':this['id'],'available':this['available'],'loggedIn':this[_0x64ff('0x16')],'name':this['name'],'paused':this[_0x64ff('0x13')],'waiting':this[_0x64ff('0xe')]};var _0x1388c9=md5(JSON[_0x64ff('0x19')](_0x260c90));if(this[_0x64ff('0x1')]!==_0x1388c9){this[_0x64ff('0x1')]=_0x1388c9;io['to'](util['format'](_0x64ff('0x1a'),_0x260c90[_0x64ff('0x8')]))[_0x64ff('0x1b')](_0x64ff('0x1c'),_0x260c90);}};module[_0x64ff('0x1d')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 3170f82..7dce83d 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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 5f2dd45..c233a1f 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 _0x8b8d=['Request','UpdateChatInteraction','updateChatInteraction','addTags','../client','update'];(function(_0x3481e3,_0x490ed1){var _0x29abb8=function(_0x560c9a){while(--_0x560c9a){_0x3481e3['push'](_0x3481e3['shift']());}};_0x29abb8(++_0x490ed1);}(_0x8b8d,0x130));var _0xd8b8=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x8b8d[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0xd8b8('0x0'));exports[_0xd8b8('0x1')]=function(_0x5e92c9,_0x58c6ad){return client[_0xd8b8('0x2')](_0xd8b8('0x3'),{'body':_0x58c6ad,'options':{'where':{'id':_0x5e92c9}},'log':_0xd8b8('0x4')});};exports[_0xd8b8('0x5')]=function(_0x2403a9,_0x411f56){return client[_0xd8b8('0x2')]('AddTagsToChatInteraction',{'body':_0x411f56,'options':{'where':{'id':_0x2403a9}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xc441=['updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction'];(function(_0xf2f332,_0x299fbf){var _0x56cce3=function(_0x5f37e0){while(--_0x5f37e0){_0xf2f332['push'](_0xf2f332['shift']());}};_0x56cce3(++_0x299fbf);}(_0xc441,0x14c));var _0x1c44=function(_0x4103ac,_0x585009){_0x4103ac=_0x4103ac-0x0;var _0x3d90bb=_0xc441[_0x4103ac];return _0x3d90bb;};'use strict';var client=require(_0x1c44('0x0'));exports[_0x1c44('0x1')]=function(_0x462406,_0x3a1a6f){return client[_0x1c44('0x2')](_0x1c44('0x3'),{'body':_0x3a1a6f,'options':{'where':{'id':_0x462406}},'log':_0x1c44('0x4')});};exports[_0x1c44('0x5')]=function(_0x49c506,_0xff04c){return client[_0x1c44('0x2')](_0x1c44('0x6'),{'body':_0xff04c,'options':{'where':{'id':_0x49c506}},'log':_0x1c44('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 943740a..57ff293 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 _0xdfb1=['Request','createChatMessage','../client','create'];(function(_0x3feb92,_0x5a6316){var _0x2182ea=function(_0x484b59){while(--_0x484b59){_0x3feb92['push'](_0x3feb92['shift']());}};_0x2182ea(++_0x5a6316);}(_0xdfb1,0x1a2));var _0x1dfb=function(_0x18afe6,_0xe981e4){_0x18afe6=_0x18afe6-0x0;var _0x9060b5=_0xdfb1[_0x18afe6];return _0x9060b5;};'use strict';var client=require(_0x1dfb('0x0'));exports[_0x1dfb('0x1')]=function(_0x33c7c6){return client[_0x1dfb('0x2')]('CreateChatMessage',{'body':_0x33c7c6,'log':_0x1dfb('0x3')});}; \ No newline at end of file +var _0xcd82=['../client','create','Request','CreateChatMessage','createChatMessage'];(function(_0x5f5a50,_0x2a498b){var _0x4194d5=function(_0x3aee3a){while(--_0x3aee3a){_0x5f5a50['push'](_0x5f5a50['shift']());}};_0x4194d5(++_0x2a498b);}(_0xcd82,0x17c));var _0x2cd8=function(_0x463c90,_0x4ac540){_0x463c90=_0x463c90-0x0;var _0x4ce53e=_0xcd82[_0x463c90];return _0x4ce53e;};'use strict';var client=require(_0x2cd8('0x0'));exports[_0x2cd8('0x1')]=function(_0x5e61ed){return client[_0x2cd8('0x2')](_0x2cd8('0x3'),{'body':_0x5e61ed,'log':_0x2cd8('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 5d5905c..a885f19 100644 --- a/server/services/routing/rpc/chatQueue.js +++ b/server/services/routing/rpc/chatQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd493=['timeout','Agents','name','getChatQueues','../client','Request','GetChatQueue'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd493,0x1bd));var _0x3d49=function(_0x1aade2,_0x2c1dcf){_0x1aade2=_0x1aade2-0x0;var _0x56b83e=_0xd493[_0x1aade2];return _0x56b83e;};'use strict';var client=require(_0x3d49('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x3d49('0x1')](_0x3d49('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x3d49('0x3'),'strategy'],'include':[{'model':'User','as':_0x3d49('0x4'),'attributes':['id',_0x3d49('0x5'),'online','chatPause']}]},'log':_0x3d49('0x6')});};}; \ No newline at end of file +var _0xc01b=['GetChatQueue','timeout','strategy','online','chatPause','../client','getChatQueues','Request'];(function(_0x31b5de,_0x1c4fee){var _0x16ff09=function(_0x21c18c){while(--_0x21c18c){_0x31b5de['push'](_0x31b5de['shift']());}};_0x16ff09(++_0x1c4fee);}(_0xc01b,0x65));var _0xbc01=function(_0x1a3f8e,_0x59f281){_0x1a3f8e=_0x1a3f8e-0x0;var _0xfeb36e=_0xc01b[_0x1a3f8e];return _0xfeb36e;};'use strict';var client=require(_0xbc01('0x0'));exports[_0xbc01('0x1')]=function(){return function(){return client[_0xbc01('0x2')](_0xbc01('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xbc01('0x4'),_0xbc01('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0xbc01('0x6'),_0xbc01('0x7')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 27a56a9..f630a98 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 _0xd240=['create','CreateChatQueueReport','update','Request','UpdateChatQueueReport'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xd240,0x1c7));var _0x0d24=function(_0x5f4bc3,_0x3afda1){_0x5f4bc3=_0x5f4bc3-0x0;var _0x1ff23b=_0xd240[_0x5f4bc3];return _0x1ff23b;};'use strict';var client=require('../client');exports[_0x0d24('0x0')]=function(_0x50efaf){return client['Request'](_0x0d24('0x1'),{'body':_0x50efaf,'log':_0x0d24('0x1')});};exports[_0x0d24('0x2')]=function(_0x41aab5,_0x359c54){return client[_0x0d24('0x3')]('UpdateChatQueueReport',{'body':_0x359c54,'options':{'where':{'uniqueid':_0x41aab5},'order':[['id','DESC']],'limit':0x1},'log':_0x0d24('0x4')});}; \ No newline at end of file +var _0x9d02=['update','Request','UpdateChatQueueReport','DESC','../client','CreateChatQueueReport'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x9d02,0x118));var _0x29d0=function(_0x4264ae,_0x380aa7){_0x4264ae=_0x4264ae-0x0;var _0xb8a700=_0x9d02[_0x4264ae];return _0xb8a700;};'use strict';var client=require(_0x29d0('0x0'));exports['create']=function(_0x38b711){return client['Request'](_0x29d0('0x1'),{'body':_0x38b711,'log':'CreateChatQueueReport'});};exports[_0x29d0('0x2')]=function(_0x13171d,_0x58e99e){return client[_0x29d0('0x3')](_0x29d0('0x4'),{'body':_0x58e99e,'options':{'where':{'uniqueid':_0x13171d},'order':[['id',_0x29d0('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 306e187..b4cc3ed 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(_0x294ee4,_0x3773a9){var _0x1a3f59=function(_0x3a9f53){while(--_0x3a9f53){_0x294ee4['push'](_0x294ee4['shift']());}};_0x1a3f59(++_0x3773a9);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x4361c1,_0x175703){var _0x7d47bd=function(_0x185980){while(--_0x185980){_0x4361c1['push'](_0x4361c1['shift']());}};_0x7d47bd(++_0x175703);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 8abd747..a19a531 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 _0xe2bc=['create','CreateFaxMessage','../client'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0xe2bc,0x18e));var _0xce2b=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xe2bc[_0x413feb];return _0x40ee88;};'use strict';var client=require(_0xce2b('0x0'));exports[_0xce2b('0x1')]=function(_0x37ed8e){return client['Request'](_0xce2b('0x2'),{'body':_0x37ed8e,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x65dc=['create','createFaxMessage','../client'];(function(_0x341a7a,_0x4d69ab){var _0xe3c378=function(_0x18f27b){while(--_0x18f27b){_0x341a7a['push'](_0x341a7a['shift']());}};_0xe3c378(++_0x4d69ab);}(_0x65dc,0x16d));var _0xc65d=function(_0x34bb68,_0x5b0079){_0x34bb68=_0x34bb68-0x0;var _0x3db9fb=_0x65dc[_0x34bb68];return _0x3db9fb;};'use strict';var client=require(_0xc65d('0x0'));exports[_0xc65d('0x1')]=function(_0x3e099f){return client['Request']('CreateFaxMessage',{'body':_0x3e099f,'log':_0xc65d('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 5302e01..2d63381 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 _0x1532=['../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User','Agents','online','faxPause'];(function(_0x4c4a7a,_0x284d8f){var _0x37ef18=function(_0x17d2a8){while(--_0x17d2a8){_0x4c4a7a['push'](_0x4c4a7a['shift']());}};_0x37ef18(++_0x284d8f);}(_0x1532,0xdc));var _0x2153=function(_0x33933e,_0x3b2743){_0x33933e=_0x33933e-0x0;var _0x184718=_0x1532[_0x33933e];return _0x184718;};'use strict';var client=require(_0x2153('0x0'));exports[_0x2153('0x1')]=function(){return function(){return client[_0x2153('0x2')](_0x2153('0x3'),{'options':{'raw':![],'attributes':['id',_0x2153('0x4'),_0x2153('0x5'),_0x2153('0x6')],'include':[{'model':_0x2153('0x7'),'as':_0x2153('0x8'),'attributes':['id',_0x2153('0x4'),_0x2153('0x9'),_0x2153('0xa')]}]},'log':_0x2153('0x1')});};}; \ No newline at end of file +var _0x760c=['online','faxPause','../client','getFaxQueues','GetFaxQueue','name','timeout','strategy','User','Agents'];(function(_0x3c97f2,_0xaa11dd){var _0x369f29=function(_0x8c57ea){while(--_0x8c57ea){_0x3c97f2['push'](_0x3c97f2['shift']());}};_0x369f29(++_0xaa11dd);}(_0x760c,0x138));var _0xc760=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x760c[_0x46e363];return _0x3fb059;};'use strict';var client=require(_0xc760('0x0'));exports[_0xc760('0x1')]=function(){return function(){return client['Request'](_0xc760('0x2'),{'options':{'raw':![],'attributes':['id',_0xc760('0x3'),_0xc760('0x4'),_0xc760('0x5')],'include':[{'model':_0xc760('0x6'),'as':_0xc760('0x7'),'attributes':['id',_0xc760('0x3'),_0xc760('0x8'),_0xc760('0x9')]}]},'log':_0xc760('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 5a21c8c..2c2ea71 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 _0x2de5=['UpdateFaxQueueReport','DESC','../client','Request','CreateFaxQueueReport'];(function(_0x2b67a7,_0x3c0881){var _0x1a8b81=function(_0x793cbb){while(--_0x793cbb){_0x2b67a7['push'](_0x2b67a7['shift']());}};_0x1a8b81(++_0x3c0881);}(_0x2de5,0xe8));var _0x52de=function(_0x35387d,_0x1ba72f){_0x35387d=_0x35387d-0x0;var _0x3aba56=_0x2de5[_0x35387d];return _0x3aba56;};'use strict';var client=require(_0x52de('0x0'));exports['create']=function(_0x16a889){return client[_0x52de('0x1')]('CreateFaxQueueReport',{'body':_0x16a889,'log':_0x52de('0x2')});};exports['update']=function(_0x52d826,_0x1f4827){return client[_0x52de('0x1')](_0x52de('0x3'),{'body':_0x1f4827,'options':{'where':{'uniqueid':_0x52d826},'order':[['id',_0x52de('0x4')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x7262=['create','Request','CreateFaxQueueReport','update','DESC','UpdateFaxQueueReport'];(function(_0x39db05,_0x3868d0){var _0x3f0e22=function(_0x532c4f){while(--_0x532c4f){_0x39db05['push'](_0x39db05['shift']());}};_0x3f0e22(++_0x3868d0);}(_0x7262,0x180));var _0x2726=function(_0x5b02d3,_0x591d0c){_0x5b02d3=_0x5b02d3-0x0;var _0x39fdf2=_0x7262[_0x5b02d3];return _0x39fdf2;};'use strict';var client=require('../client');exports[_0x2726('0x0')]=function(_0xb57ef9){return client[_0x2726('0x1')]('CreateFaxQueueReport',{'body':_0xb57ef9,'log':_0x2726('0x2')});};exports[_0x2726('0x3')]=function(_0x346b41,_0x4734fc){return client['Request']('UpdateFaxQueueReport',{'body':_0x4734fc,'options':{'where':{'uniqueid':_0x346b41},'order':[['id',_0x2726('0x4')]],'limit':0x1},'log':_0x2726('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index fd27c3b..e34ac63 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 _0x9e1e=['name','interval','../client','getIntervals','Request','GetInterval','Interval','Intervals'];(function(_0x1c5cc1,_0x299da1){var _0x4bc598=function(_0x29a6fd){while(--_0x29a6fd){_0x1c5cc1['push'](_0x1c5cc1['shift']());}};_0x4bc598(++_0x299da1);}(_0x9e1e,0x10a));var _0xe9e1=function(_0x20edcb,_0x4d49a8){_0x20edcb=_0x20edcb-0x0;var _0x1ced78=_0x9e1e[_0x20edcb];return _0x1ced78;};'use strict';var client=require(_0xe9e1('0x0'));exports[_0xe9e1('0x1')]=function(){return function(){return client[_0xe9e1('0x2')](_0xe9e1('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xe9e1('0x4'),'as':_0xe9e1('0x5'),'attributes':['id',_0xe9e1('0x6'),_0xe9e1('0x7')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x7433=['Interval','Intervals','interval','../client','getIntervals','Request','GetInterval','name'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x7433,0xeb));var _0x3743=function(_0x486efc,_0x1cca6a){_0x486efc=_0x486efc-0x0;var _0x42ae7e=_0x7433[_0x486efc];return _0x42ae7e;};'use strict';var client=require(_0x3743('0x0'));exports[_0x3743('0x1')]=function(){return function(){return client[_0x3743('0x2')](_0x3743('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x3743('0x4')],'include':[{'model':_0x3743('0x5'),'as':_0x3743('0x6'),'attributes':['id',_0x3743('0x4'),_0x3743('0x7')]}]},'log':_0x3743('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 46ec1d5..5917f63 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 _0xa30a=['Request','UpdateMailInteraction','updateMailInteraction','addTags','addTagsToChatInteraction','../client','update'];(function(_0x3d84b8,_0x56c6d0){var _0x7d98c4=function(_0x4f58ed){while(--_0x4f58ed){_0x3d84b8['push'](_0x3d84b8['shift']());}};_0x7d98c4(++_0x56c6d0);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xaa30('0x0'));exports[_0xaa30('0x1')]=function(_0x25634b,_0x4dfa7e){return client[_0xaa30('0x2')](_0xaa30('0x3'),{'body':_0x4dfa7e,'options':{'where':{'id':_0x25634b}},'log':_0xaa30('0x4')});};exports[_0xaa30('0x5')]=function(_0x2a9b06,_0x271425){return client[_0xaa30('0x2')]('AddTagsToMailInteraction',{'body':_0x271425,'options':{'where':{'id':_0x2a9b06}},'log':_0xaa30('0x6')});}; \ No newline at end of file +var _0x77e6=['addTags','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x478e2f,_0xcc2041){var _0x4b088d=function(_0x1d262b){while(--_0x1d262b){_0x478e2f['push'](_0x478e2f['shift']());}};_0x4b088d(++_0xcc2041);}(_0x77e6,0x1a6));var _0x677e=function(_0x541ef3,_0x18a340){_0x541ef3=_0x541ef3-0x0;var _0x36c34d=_0x77e6[_0x541ef3];return _0x36c34d;};'use strict';var client=require(_0x677e('0x0'));exports[_0x677e('0x1')]=function(_0x3855c7,_0xa48f0c){return client[_0x677e('0x2')](_0x677e('0x3'),{'body':_0xa48f0c,'options':{'where':{'id':_0x3855c7}},'log':_0x677e('0x4')});};exports[_0x677e('0x5')]=function(_0x50231c,_0x2f0307){return client[_0x677e('0x2')]('AddTagsToMailInteraction',{'body':_0x2f0307,'options':{'where':{'id':_0x50231c}},'log':_0x677e('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 511bc18..58b54f2 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 _0x7ac9=['Request','CreateMailMessage','../client'];(function(_0x19ea96,_0x5ca46a){var _0x195c9f=function(_0x383d7e){while(--_0x383d7e){_0x19ea96['push'](_0x19ea96['shift']());}};_0x195c9f(++_0x5ca46a);}(_0x7ac9,0x1a0));var _0x97ac=function(_0x4cc22c,_0x3a1bae){_0x4cc22c=_0x4cc22c-0x0;var _0x5453c1=_0x7ac9[_0x4cc22c];return _0x5453c1;};'use strict';var client=require(_0x97ac('0x0'));exports['create']=function(_0xcbbbf5){return client[_0x97ac('0x1')](_0x97ac('0x2'),{'body':_0xcbbbf5,'log':'createMailMessage'});}; \ No newline at end of file +var _0x0bbc=['createMailMessage','../client','create','Request'];(function(_0x103d48,_0x24011e){var _0x49a571=function(_0x44896e){while(--_0x44896e){_0x103d48['push'](_0x103d48['shift']());}};_0x49a571(++_0x24011e);}(_0x0bbc,0x1c9));var _0xc0bb=function(_0x331702,_0x544735){_0x331702=_0x331702-0x0;var _0xb8895f=_0x0bbc[_0x331702];return _0xb8895f;};'use strict';var client=require(_0xc0bb('0x0'));exports[_0xc0bb('0x1')]=function(_0x3a9aaf){return client[_0xc0bb('0x2')]('CreateMailMessage',{'body':_0x3a9aaf,'log':_0xc0bb('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 519097b..532d22e 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 _0x6b07=['GetMailQueue','timeout','strategy','User','Agents','name','mailPause','../client','getMailQueues'];(function(_0x57e251,_0x54e8e8){var _0x209f76=function(_0x4c9773){while(--_0x4c9773){_0x57e251['push'](_0x57e251['shift']());}};_0x209f76(++_0x54e8e8);}(_0x6b07,0xb2));var _0x76b0=function(_0x4dcaa2,_0x2739de){_0x4dcaa2=_0x4dcaa2-0x0;var _0x1026de=_0x6b07[_0x4dcaa2];return _0x1026de;};'use strict';var client=require(_0x76b0('0x0'));exports[_0x76b0('0x1')]=function(){return function(){return client['Request'](_0x76b0('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x76b0('0x3'),_0x76b0('0x4')],'include':[{'model':_0x76b0('0x5'),'as':_0x76b0('0x6'),'attributes':['id',_0x76b0('0x7'),'online',_0x76b0('0x8')]}]},'log':_0x76b0('0x1')});};}; \ No newline at end of file +var _0x13c8=['../client','getMailQueues','Request','timeout','strategy','User','Agents','mailPause'];(function(_0x1685ec,_0x249c2c){var _0x549d0f=function(_0x43615e){while(--_0x43615e){_0x1685ec['push'](_0x1685ec['shift']());}};_0x549d0f(++_0x249c2c);}(_0x13c8,0xa0));var _0x813c=function(_0x2bcd1f,_0x4f1972){_0x2bcd1f=_0x2bcd1f-0x0;var _0x2381ca=_0x13c8[_0x2bcd1f];return _0x2381ca;};'use strict';var client=require(_0x813c('0x0'));exports[_0x813c('0x1')]=function(){return function(){return client[_0x813c('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name',_0x813c('0x3'),_0x813c('0x4')],'include':[{'model':_0x813c('0x5'),'as':_0x813c('0x6'),'attributes':['id','name','online',_0x813c('0x7')]}]},'log':_0x813c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index ed0115f..23ecb4d 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 _0xfb0a=['../client','create','Request','CreateMailQueueReport','UpdateMailQueueReport'];(function(_0x1e51fb,_0x31a124){var _0x5845a6=function(_0x545e09){while(--_0x545e09){_0x1e51fb['push'](_0x1e51fb['shift']());}};_0x5845a6(++_0x31a124);}(_0xfb0a,0x1ea));var _0xafb0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xfb0a[_0x397e5f];return _0x5302b8;};'use strict';var client=require(_0xafb0('0x0'));exports[_0xafb0('0x1')]=function(_0x3fbbb5){return client[_0xafb0('0x2')](_0xafb0('0x3'),{'body':_0x3fbbb5,'log':_0xafb0('0x3')});};exports['update']=function(_0x2564f5,_0x3daf66){return client[_0xafb0('0x2')](_0xafb0('0x4'),{'body':_0x3daf66,'options':{'where':{'uniqueid':_0x2564f5},'order':[['id','DESC']],'limit':0x1},'log':_0xafb0('0x4')});}; \ No newline at end of file +var _0xc1e2=['UpdateMailQueueReport','DESC','create','Request','CreateMailQueueReport','update'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xc1e2,0x14c));var _0x2c1e=function(_0xf46928,_0x5e88fd){_0xf46928=_0xf46928-0x0;var _0x6be97e=_0xc1e2[_0xf46928];return _0x6be97e;};'use strict';var client=require('../client');exports[_0x2c1e('0x0')]=function(_0x641562){return client[_0x2c1e('0x1')](_0x2c1e('0x2'),{'body':_0x641562,'log':_0x2c1e('0x2')});};exports[_0x2c1e('0x3')]=function(_0x57dee9,_0x3439fb){return client[_0x2c1e('0x1')](_0x2c1e('0x4'),{'body':_0x3439fb,'options':{'where':{'uniqueid':_0x57dee9},'order':[['id',_0x2c1e('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index a033326..1d7a5e8 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 _0xcc10=['AddTagsToOpenchannelInteraction','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x5897ea,_0x3bd341){var _0xe0fe8d=function(_0x588065){while(--_0x588065){_0x5897ea['push'](_0x5897ea['shift']());}};_0xe0fe8d(++_0x3bd341);}(_0xcc10,0x1af));var _0x0cc1=function(_0x11ee01,_0xee35eb){_0x11ee01=_0x11ee01-0x0;var _0x1c03e6=_0xcc10[_0x11ee01];return _0x1c03e6;};'use strict';var client=require('../client');exports['update']=function(_0x3a2f42,_0x5a8a6b){return client[_0x0cc1('0x0')](_0x0cc1('0x1'),{'body':_0x5a8a6b,'options':{'where':{'id':_0x3a2f42}},'log':_0x0cc1('0x2')});};exports[_0x0cc1('0x3')]=function(_0x133b69,_0x138d09){return client[_0x0cc1('0x0')](_0x0cc1('0x4'),{'body':_0x138d09,'options':{'where':{'id':_0x133b69}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x7f9a=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x527e6a,_0x4f989b){var _0x17e91e=function(_0x1f1e91){while(--_0x1f1e91){_0x527e6a['push'](_0x527e6a['shift']());}};_0x17e91e(++_0x4f989b);}(_0x7f9a,0x163));var _0xa7f9=function(_0x1aa4ba,_0x4c2f64){_0x1aa4ba=_0x1aa4ba-0x0;var _0xa52230=_0x7f9a[_0x1aa4ba];return _0xa52230;};'use strict';var client=require(_0xa7f9('0x0'));exports[_0xa7f9('0x1')]=function(_0xb47784,_0x3bde04){return client[_0xa7f9('0x2')](_0xa7f9('0x3'),{'body':_0x3bde04,'options':{'where':{'id':_0xb47784}},'log':_0xa7f9('0x4')});};exports[_0xa7f9('0x5')]=function(_0x9632da,_0xf03a59){return client[_0xa7f9('0x2')](_0xa7f9('0x6'),{'body':_0xf03a59,'options':{'where':{'id':_0x9632da}},'log':_0xa7f9('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index fc19dc7..6c748db 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 _0xff83=['createOpenchannelMessage','../client','create','Request'];(function(_0x2a1f38,_0x40c5ea){var _0x321d9d=function(_0x214848){while(--_0x214848){_0x2a1f38['push'](_0x2a1f38['shift']());}};_0x321d9d(++_0x40c5ea);}(_0xff83,0xb9));var _0x3ff8=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xff83[_0x220dbb];return _0x2b77de;};'use strict';var client=require(_0x3ff8('0x0'));exports[_0x3ff8('0x1')]=function(_0x47a546){return client[_0x3ff8('0x2')]('CreateOpenchannelMessage',{'body':_0x47a546,'log':_0x3ff8('0x3')});}; \ No newline at end of file +var _0x74f3=['create','Request','CreateOpenchannelMessage'];(function(_0x1b5fff,_0x4a7dad){var _0x31cc64=function(_0x5d8eb1){while(--_0x5d8eb1){_0x1b5fff['push'](_0x1b5fff['shift']());}};_0x31cc64(++_0x4a7dad);}(_0x74f3,0x17d));var _0x374f=function(_0x25ed4c,_0x438909){_0x25ed4c=_0x25ed4c-0x0;var _0x111e18=_0x74f3[_0x25ed4c];return _0x111e18;};'use strict';var client=require('../client');exports[_0x374f('0x0')]=function(_0x4e0b5f){return client[_0x374f('0x1')](_0x374f('0x2'),{'body':_0x4e0b5f,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index e2e11e1..f169b9d 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 _0xe66d=['GetOpenchannelQueue','name','timeout','strategy','User','Agents','openchannelPause','../client','getOpenchannelQueues'];(function(_0xea0b79,_0x15cc69){var _0x16c9e6=function(_0x29590e){while(--_0x29590e){_0xea0b79['push'](_0xea0b79['shift']());}};_0x16c9e6(++_0x15cc69);}(_0xe66d,0x14b));var _0xde66=function(_0x524e23,_0x1e2aa7){_0x524e23=_0x524e23-0x0;var _0x231413=_0xe66d[_0x524e23];return _0x231413;};'use strict';var client=require(_0xde66('0x0'));exports[_0xde66('0x1')]=function(){return function(){return client['Request'](_0xde66('0x2'),{'options':{'raw':![],'attributes':['id',_0xde66('0x3'),_0xde66('0x4'),_0xde66('0x5')],'include':[{'model':_0xde66('0x6'),'as':_0xde66('0x7'),'attributes':['id','name','online',_0xde66('0x8')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x3c7c=['Request','GetOpenchannelQueue','strategy','User','Agents','name','getOpenchannelQueues'];(function(_0x20118a,_0x3dbdf3){var _0x538b5f=function(_0x31c5b4){while(--_0x31c5b4){_0x20118a['push'](_0x20118a['shift']());}};_0x538b5f(++_0x3dbdf3);}(_0x3c7c,0xd8));var _0xc3c7=function(_0x267210,_0x2e390f){_0x267210=_0x267210-0x0;var _0x5d0893=_0x3c7c[_0x267210];return _0x5d0893;};'use strict';var client=require('../client');exports[_0xc3c7('0x0')]=function(){return function(){return client[_0xc3c7('0x1')](_0xc3c7('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xc3c7('0x3')],'include':[{'model':_0xc3c7('0x4'),'as':_0xc3c7('0x5'),'attributes':['id',_0xc3c7('0x6'),'online','openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 227e2b9..0214cd9 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 _0x147f=['Request','UpdateOpenchannelQueueReport','DESC','../client','create','CreateOpenchannelQueueReport'];(function(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0x147f,0xd5));var _0xf147=function(_0x5749a1,_0x20f805){_0x5749a1=_0x5749a1-0x0;var _0x20db5a=_0x147f[_0x5749a1];return _0x20db5a;};'use strict';var client=require(_0xf147('0x0'));exports[_0xf147('0x1')]=function(_0x32aaf3){return client['Request'](_0xf147('0x2'),{'body':_0x32aaf3,'log':_0xf147('0x2')});};exports['update']=function(_0x367300,_0x16dd09){return client[_0xf147('0x3')](_0xf147('0x4'),{'body':_0x16dd09,'options':{'where':{'uniqueid':_0x367300},'order':[['id',_0xf147('0x5')]],'limit':0x1},'log':_0xf147('0x4')});}; \ No newline at end of file +var _0x46d1=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client','create'];(function(_0x5aeca6,_0x4d446f){var _0x4b0416=function(_0x49286d){while(--_0x49286d){_0x5aeca6['push'](_0x5aeca6['shift']());}};_0x4b0416(++_0x4d446f);}(_0x46d1,0xbe));var _0x146d=function(_0x43c273,_0x59ae17){_0x43c273=_0x43c273-0x0;var _0x13d983=_0x46d1[_0x43c273];return _0x13d983;};'use strict';var client=require(_0x146d('0x0'));exports[_0x146d('0x1')]=function(_0x5b1b99){return client[_0x146d('0x2')](_0x146d('0x3'),{'body':_0x5b1b99,'log':_0x146d('0x3')});};exports[_0x146d('0x4')]=function(_0x487f9c,_0x28792c){return client[_0x146d('0x2')](_0x146d('0x5'),{'body':_0x28792c,'options':{'where':{'uniqueid':_0x487f9c},'order':[['id','DESC']],'limit':0x1},'log':_0x146d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index aebf336..7f6608e 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 _0x1928=['../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x129418,_0x35e05a){var _0x47ff20=function(_0x19052a){while(--_0x19052a){_0x129418['push'](_0x129418['shift']());}};_0x47ff20(++_0x35e05a);}(_0x1928,0x138));var _0x8192=function(_0x38acf2,_0x559827){_0x38acf2=_0x38acf2-0x0;var _0x230393=_0x1928[_0x38acf2];return _0x230393;};'use strict';var client=require(_0x8192('0x0'));exports[_0x8192('0x1')]=function(_0x2a432c,_0x49fae0){return client[_0x8192('0x2')](_0x8192('0x3'),{'body':_0x49fae0,'options':{'where':{'id':_0x2a432c}},'log':_0x8192('0x4')});};exports[_0x8192('0x5')]=function(_0x16f410,_0x11fa71){return client[_0x8192('0x2')](_0x8192('0x6'),{'body':_0x11fa71,'options':{'where':{'id':_0x16f410}},'log':_0x8192('0x7')});}; \ No newline at end of file +var _0xfd0f=['update','Request','UpdateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x339db2,_0x4807df){var _0x3da505=function(_0x1b5acd){while(--_0x1b5acd){_0x339db2['push'](_0x339db2['shift']());}};_0x3da505(++_0x4807df);}(_0xfd0f,0x1b8));var _0xffd0=function(_0xa00003,_0x1a8538){_0xa00003=_0xa00003-0x0;var _0x8ad142=_0xfd0f[_0xa00003];return _0x8ad142;};'use strict';var client=require(_0xffd0('0x0'));exports[_0xffd0('0x1')]=function(_0x498df9,_0x568847){return client[_0xffd0('0x2')](_0xffd0('0x3'),{'body':_0x568847,'options':{'where':{'id':_0x498df9}},'log':'updateSmsInteraction'});};exports[_0xffd0('0x4')]=function(_0x5e9c0a,_0x303f38){return client[_0xffd0('0x2')](_0xffd0('0x5'),{'body':_0x303f38,'options':{'where':{'id':_0x5e9c0a}},'log':_0xffd0('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 0fe01b9..b01c73a 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 _0x5cd6=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x40a52f,_0x15515d){var _0x15bc95=function(_0xa9b27d){while(--_0xa9b27d){_0x40a52f['push'](_0x40a52f['shift']());}};_0x15bc95(++_0x15515d);}(_0x5cd6,0x161));var _0x65cd=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x5cd6[_0x3899d1];return _0xeb4a7d;};'use strict';var client=require(_0x65cd('0x0'));exports[_0x65cd('0x1')]=function(_0x430590){return client[_0x65cd('0x2')](_0x65cd('0x3'),{'body':_0x430590,'log':_0x65cd('0x4')});}; \ No newline at end of file +var _0x60d4=['CreateSmsMessage','../client','create','Request'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x60d4,0xc9));var _0x460d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x60d4[_0xfae23b];return _0x200640;};'use strict';var client=require(_0x460d('0x0'));exports[_0x460d('0x1')]=function(_0x4110e9){return client[_0x460d('0x2')](_0x460d('0x3'),{'body':_0x4110e9,'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 59d1120..5e42aac 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0xdffded,_0x5917cc){var _0x5f0155=function(_0x55ff6c){while(--_0x55ff6c){_0xdffded['push'](_0xdffded['shift']());}};_0x5f0155(++_0x5917cc);}(_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')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x31e230,_0x62e85b){var _0x562df0=function(_0x27f891){while(--_0x27f891){_0x31e230['push'](_0x31e230['shift']());}};_0x562df0(++_0x62e85b);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xb7e7[_0x1f9f37];return _0x21c080;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 0aec867..a4e8ef0 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 _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x5dfdcb,_0x233d98){var _0x502fe7=function(_0x33c002){while(--_0x33c002){_0x5dfdcb['push'](_0x5dfdcb['shift']());}};_0x502fe7(++_0x233d98);}(_0x3e74,0x175));var _0x43e7=function(_0x507e74,_0x38028e){_0x507e74=_0x507e74-0x0;var _0x1bbb6d=_0x3e74[_0x507e74];return _0x1bbb6d;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file +var _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x34c0f4,_0x349dd2){var _0x4d46d7=function(_0xfd5ca9){while(--_0xfd5ca9){_0x34c0f4['push'](_0x34c0f4['shift']());}};_0x4d46d7(++_0x349dd2);}(_0x34e8,0x12c));var _0x834e=function(_0x15842b,_0x552322){_0x15842b=_0x15842b-0x0;var _0x35c048=_0x34e8[_0x15842b];return _0x35c048;};'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 9024c22..293209e 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(_0x35e7b9,_0x2620e0){var _0x5a7aa1=function(_0x3979c2){while(--_0x3979c2){_0x35e7b9['push'](_0x35e7b9['shift']());}};_0x5a7aa1(++_0x2620e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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(_0x810d09,_0x4adab4){var _0x417828=function(_0x2537a9){while(--_0x2537a9){_0x810d09['push'](_0x810d09['shift']());}};_0x417828(++_0x4adab4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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 e5a3e5c..ed6ec81 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 _0x8cad=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update'];(function(_0x49c749,_0x323a15){var _0x44ad8f=function(_0x56ed9c){while(--_0x56ed9c){_0x49c749['push'](_0x49c749['shift']());}};_0x44ad8f(++_0x323a15);}(_0x8cad,0xfe));var _0xd8ca=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x8cad[_0x5834bc];return _0x3e183a;};'use strict';var client=require(_0xd8ca('0x0'));exports[_0xd8ca('0x1')]=function(_0x200c70,_0xd40e70){return client[_0xd8ca('0x2')](_0xd8ca('0x3'),{'body':_0xd40e70,'options':{'where':{'id':_0x200c70}},'log':_0xd8ca('0x4')});};exports[_0xd8ca('0x5')]=function(_0x1334ec,_0x1e29ce){return client[_0xd8ca('0x2')](_0xd8ca('0x6'),{'body':_0x1e29ce,'options':{'where':{'id':_0x1334ec}},'log':_0xd8ca('0x7')});}; \ No newline at end of file +var _0x41d0=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update'];(function(_0x214204,_0x54681b){var _0x2d84a2=function(_0x254b61){while(--_0x254b61){_0x214204['push'](_0x214204['shift']());}};_0x2d84a2(++_0x54681b);}(_0x41d0,0x1c6));var _0x041d=function(_0x306d5d,_0x3293d5){_0x306d5d=_0x306d5d-0x0;var _0xb5cee4=_0x41d0[_0x306d5d];return _0xb5cee4;};'use strict';var client=require(_0x041d('0x0'));exports[_0x041d('0x1')]=function(_0x2326c5,_0x288ebb){return client['Request'](_0x041d('0x2'),{'body':_0x288ebb,'options':{'where':{'id':_0x2326c5}},'log':_0x041d('0x3')});};exports[_0x041d('0x4')]=function(_0x397dad,_0x41e587){return client[_0x041d('0x5')](_0x041d('0x6'),{'body':_0x41e587,'options':{'where':{'id':_0x397dad}},'log':_0x041d('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index aa486e2..a2d96b8 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 _0x4c15=['../client','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x59026b,_0x12ace5){var _0x2c6152=function(_0x193dc2){while(--_0x193dc2){_0x59026b['push'](_0x59026b['shift']());}};_0x2c6152(++_0x12ace5);}(_0x4c15,0xec));var _0x54c1=function(_0x1afea6,_0x314555){_0x1afea6=_0x1afea6-0x0;var _0x3d54eb=_0x4c15[_0x1afea6];return _0x3d54eb;};'use strict';var client=require(_0x54c1('0x0'));exports['create']=function(_0x238e94){return client[_0x54c1('0x1')](_0x54c1('0x2'),{'body':_0x238e94,'log':_0x54c1('0x3')});}; \ No newline at end of file +var _0x8806=['Request','CreateWhatsappMessage','../client','create'];(function(_0x17ef6d,_0x5902b2){var _0x2c8bca=function(_0x101982){while(--_0x101982){_0x17ef6d['push'](_0x17ef6d['shift']());}};_0x2c8bca(++_0x5902b2);}(_0x8806,0x1ae));var _0x6880=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x8806[_0x476bf4];return _0x788ffe;};'use strict';var client=require(_0x6880('0x0'));exports[_0x6880('0x1')]=function(_0x3b438b){return client[_0x6880('0x2')](_0x6880('0x3'),{'body':_0x3b438b,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 418b690..b8e7c15 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 _0xa126=['strategy','User','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name'];(function(_0x35e922,_0xa6eb8b){var _0x254dcf=function(_0x555bfe){while(--_0x555bfe){_0x35e922['push'](_0x35e922['shift']());}};_0x254dcf(++_0xa6eb8b);}(_0xa126,0x153));var _0x6a12=function(_0x291239,_0x16abc1){_0x291239=_0x291239-0x0;var _0x4b24e2=_0xa126[_0x291239];return _0x4b24e2;};'use strict';var client=require(_0x6a12('0x0'));exports[_0x6a12('0x1')]=function(){return function(){return client[_0x6a12('0x2')](_0x6a12('0x3'),{'options':{'raw':![],'attributes':['id',_0x6a12('0x4'),'timeout',_0x6a12('0x5')],'include':[{'model':_0x6a12('0x6'),'as':'Agents','attributes':['id',_0x6a12('0x4'),'online',_0x6a12('0x7')]}]},'log':_0x6a12('0x1')});};}; \ No newline at end of file +var _0x8dfe=['User','Agents','online','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','name','strategy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8dfe,0x1b4));var _0xe8df=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8dfe[_0x42cae2];return _0x5f256f;};'use strict';var client=require('../client');exports[_0xe8df('0x0')]=function(){return function(){return client[_0xe8df('0x1')](_0xe8df('0x2'),{'options':{'raw':![],'attributes':['id',_0xe8df('0x3'),'timeout',_0xe8df('0x4')],'include':[{'model':_0xe8df('0x5'),'as':_0xe8df('0x6'),'attributes':['id',_0xe8df('0x3'),_0xe8df('0x7'),_0xe8df('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 7253f43..dfc4c79 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 _0xd9bb=['create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xd9bb,0xcc));var _0xbd9b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd9bb[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports[_0xbd9b('0x0')]=function(_0x8f03ba){return client[_0xbd9b('0x1')](_0xbd9b('0x2'),{'body':_0x8f03ba,'log':_0xbd9b('0x2')});};exports[_0xbd9b('0x3')]=function(_0x266f91,_0x437c81){return client[_0xbd9b('0x1')](_0xbd9b('0x4'),{'body':_0x437c81,'options':{'where':{'uniqueid':_0x266f91},'order':[['id',_0xbd9b('0x5')]],'limit':0x1},'log':_0xbd9b('0x4')});}; \ No newline at end of file +var _0xb182=['DESC','../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x1e40a7,_0x332c8e){var _0x15a350=function(_0x1ea22b){while(--_0x1ea22b){_0x1e40a7['push'](_0x1e40a7['shift']());}};_0x15a350(++_0x332c8e);}(_0xb182,0x151));var _0x2b18=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0xb182[_0x476bf4];return _0x788ffe;};'use strict';var client=require(_0x2b18('0x0'));exports[_0x2b18('0x1')]=function(_0x31fbbe){return client[_0x2b18('0x2')](_0x2b18('0x3'),{'body':_0x31fbbe,'log':'CreateWhatsappQueueReport'});};exports[_0x2b18('0x4')]=function(_0x2dc0fa,_0x3c0083){return client[_0x2b18('0x2')](_0x2b18('0x5'),{'body':_0x3c0083,'options':{'where':{'uniqueid':_0x2dc0fa},'order':[['id',_0x2b18('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 6828ee0..eabc427 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 _0x80d7=['createQueue','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','error','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','message','join','stop','agents','timeout'];(function(_0x326e79,_0x33dc91){var _0x37eb89=function(_0xbaef25){while(--_0xbaef25){_0x326e79['push'](_0x326e79['shift']());}};_0x37eb89(++_0x33dc91);}(_0x80d7,0x149));var _0x780d=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0x80d7[_0x261522];return _0x98a25a;};'use strict';var schema=require(_0x780d('0x0'));var _=require(_0x780d('0x1'));var util=require(_0x780d('0x2'));var seqqueue=require(_0x780d('0x3'));var logger=require(_0x780d('0x4'))(_0x780d('0x5'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x780d('0x6'),'required':!![],'message':_0x780d('0x7')},'timeout':{'type':'number','message':_0x780d('0x8')}});function writeLog(_0x5cfbbb,_0x5678b5,_0x38396a){return logger[_0x780d('0x9')](util[_0x780d('0xa')](_0x780d('0xb'),_0x5cfbbb,_0x5678b5['name'],_0x38396a));}function handleFindAgent(_0x5ec49e){return function(_0x491bfa){return _0x491bfa[_0x780d('0xc')]['toLowerCase']()===_0x5ec49e[_0x780d('0xd')]();};}exports[_0x780d('0xe')]=function(_0x3e56ef,_0x4014b6,_0x31209b,_0x3dc035){return function(_0x19cc5f){try{var _0x1068a5={'name':_0x4014b6[0x0],'timeout':_0x4014b6[0x1]};var _0x5f120b=queue[_0x780d('0x0')](_0x1068a5,{'typecast':!![]});if(_0x5f120b[_0x780d('0xf')]){logger['error']('[%s][AGENT]\x20%s',_0x3e56ef,_['map'](_0x5f120b,_0x780d('0x10'))[_0x780d('0x11')](',\x20'));_0x19cc5f[_0x780d('0x12')]();}else{var _0x55f463=_['find'](_0x31209b[_0x780d('0x13')],handleFindAgent(_0x1068a5['name']));if(_0x55f463){var _0x2e55a7=(_0x1068a5[_0x780d('0x14')]||0xa)*0x3e8;var _0x1aa420,_0xe06a8a;var _0x2269e2=seqqueue[_0x780d('0x15')](_0x2e55a7);_0x2269e2['id']=_0x3e56ef;_0x2269e2['atimeout']=_0x2e55a7;_0x2269e2[_0x780d('0x16')]=_0x3dc035[_0x780d('0x16')];writeLog(_0x3e56ef,_0x55f463,util[_0x780d('0xa')](_0x780d('0x17'),_0x2e55a7));_0x31209b['rules'][_0x3e56ef]['on'](_0x780d('0x18'),function(){logger['info'](_0x780d('0x19'),_0x3e56ef);clearTimeout(_0xe06a8a);_0xe06a8a=undefined;_0x2269e2[_0x780d('0x1a')]();if(_0x31209b[_0x780d('0x1b')][_0x3e56ef]){delete _0x31209b[_0x780d('0x1b')][_0x3e56ef];}_0x19cc5f[_0x780d('0x12')]();});_0x31209b['rules'][_0x3e56ef]['on']('complete',function(){if(_0x31209b['rules'][_0x3e56ef]){delete _0x31209b[_0x780d('0x1b')][_0x3e56ef];}});_0xe06a8a=setTimeout(function(){logger[_0x780d('0x9')](_0x780d('0x1c'),_0x3e56ef);clearTimeout(_0xe06a8a);_0x2269e2['close']();_0x19cc5f['next']();},_0x2e55a7);strategy[_0x780d('0x1d')](_0x2269e2,_0x55f463,_0x31209b,_0x3dc035);}else{logger['error'](_0x780d('0x1e'),_0x3e56ef,_0x1068a5[_0x780d('0xc')]);_0x19cc5f[_0x780d('0x12')]();}}}catch(_0x559f98){console[_0x780d('0x1f')](_0x559f98);logger[_0x780d('0x20')](_0x780d('0x21'),_0x3e56ef,_0x559f98[_0x780d('0x22')]);_0x19cc5f[_0x780d('0x12')]();}};}; \ No newline at end of file +var _0x5396=['log','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','error','[%s][AGENT]\x20%s','message','join','stop','find','timeout','createQueue','atimeout','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','[%s][AGENT]\x20agent\x20not\x20found\x20%s'];(function(_0x541600,_0x3d3619){var _0x1f277f=function(_0x7cc82){while(--_0x7cc82){_0x541600['push'](_0x541600['shift']());}};_0x1f277f(++_0x3d3619);}(_0x5396,0x134));var _0x6539=function(_0x1a5dd5,_0x10d8a2){_0x1a5dd5=_0x1a5dd5-0x0;var _0x5707fa=_0x5396[_0x1a5dd5];return _0x5707fa;};'use strict';var schema=require(_0x6539('0x0'));var _=require(_0x6539('0x1'));var util=require(_0x6539('0x2'));var seqqueue=require(_0x6539('0x3'));var logger=require(_0x6539('0x4'))(_0x6539('0x5'));var strategy=require(_0x6539('0x6'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x6539('0x7')}});function writeLog(_0xdeba9e,_0x3a7dde,_0x3c0fa1){return logger[_0x6539('0x8')](util[_0x6539('0x9')](_0x6539('0xa'),_0xdeba9e,_0x3a7dde[_0x6539('0xb')],_0x3c0fa1));}function handleFindAgent(_0x2da1c8){return function(_0x4b9e75){return _0x4b9e75[_0x6539('0xb')][_0x6539('0xc')]()===_0x2da1c8[_0x6539('0xc')]();};}exports[_0x6539('0xd')]=function(_0x3c2ee4,_0x59b3d0,_0x333744,_0x382f28){return function(_0x1e15e8){try{var _0x3ded76={'name':_0x59b3d0[0x0],'timeout':_0x59b3d0[0x1]};var _0x3642cd=queue['validate'](_0x3ded76,{'typecast':!![]});if(_0x3642cd['length']){logger[_0x6539('0xe')](_0x6539('0xf'),_0x3c2ee4,_['map'](_0x3642cd,_0x6539('0x10'))[_0x6539('0x11')](',\x20'));_0x1e15e8[_0x6539('0x12')]();}else{var _0x350825=_[_0x6539('0x13')](_0x333744['agents'],handleFindAgent(_0x3ded76[_0x6539('0xb')]));if(_0x350825){var _0x76a581=(_0x3ded76[_0x6539('0x14')]||0xa)*0x3e8;var _0x588588,_0x2292cb;var _0x7eec14=seqqueue[_0x6539('0x15')](_0x76a581);_0x7eec14['id']=_0x3c2ee4;_0x7eec14[_0x6539('0x16')]=_0x76a581;_0x7eec14[_0x6539('0x17')]=_0x382f28['channel'];writeLog(_0x3c2ee4,_0x350825,util[_0x6539('0x9')](_0x6539('0x18'),_0x76a581));_0x333744['rules'][_0x3c2ee4]['on'](_0x6539('0x19'),function(){logger[_0x6539('0x8')](_0x6539('0x1a'),_0x3c2ee4);clearTimeout(_0x2292cb);_0x2292cb=undefined;_0x7eec14[_0x6539('0x1b')]();if(_0x333744['rules'][_0x3c2ee4]){delete _0x333744[_0x6539('0x1c')][_0x3c2ee4];}_0x1e15e8['stop']();});_0x333744[_0x6539('0x1c')][_0x3c2ee4]['on'](_0x6539('0x1d'),function(){if(_0x333744[_0x6539('0x1c')][_0x3c2ee4]){delete _0x333744['rules'][_0x3c2ee4];}});_0x2292cb=setTimeout(function(){logger[_0x6539('0x8')](_0x6539('0x1e'),_0x3c2ee4);clearTimeout(_0x2292cb);_0x7eec14[_0x6539('0x1b')]();_0x1e15e8['next']();},_0x76a581);strategy['agent'](_0x7eec14,_0x350825,_0x333744,_0x382f28);}else{logger[_0x6539('0xe')](_0x6539('0x1f'),_0x3c2ee4,_0x3ded76['name']);_0x1e15e8['stop']();}}}catch(_0x2aa01b){console[_0x6539('0x20')](_0x2aa01b);logger[_0x6539('0xe')](_0x6539('0x21'),_0x3c2ee4,_0x2aa01b['stack']);_0x1e15e8[_0x6539('0x12')]();}};}; \ 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 ac45f7a..a6811bf 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 _0xcc01=['isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','chat','upperFirst','AccountId','account','InteractionId','body','getMustacheRender','Message','create','then','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','LexRuntime','$LATEST','toString','message','amazonlex','providerName','providerResponse','dialogState','Failed','stop','catch','lodash','moment','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x2e1906,_0xa281e9){var _0x3ea10e=function(_0x19749){while(--_0x19749){_0x2e1906['push'](_0x2e1906['shift']());}};_0x3ea10e(++_0xa281e9);}(_0xcc01,0xd4));var _0x1cc0=function(_0x4f9b5b,_0x338f8f){_0x4f9b5b=_0x4f9b5b-0x0;var _0x5d171a=_0xcc01[_0x4f9b5b];return _0x5d171a;};'use strict';var _=require(_0x1cc0('0x0'));var moment=require(_0x1cc0('0x1'));var AWS=require('aws-sdk');var utils=require(_0x1cc0('0x2'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x1cc0('0x3')),'openchannelMessage':require(_0x1cc0('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x1cc0('0x5')),'faxMessage':require(_0x1cc0('0x6')),'whatsappMessage':require(_0x1cc0('0x7'))};exports['consequence']=function(_0x2dcad7,_0xe1d650){return function(_0x5617c3){try{if(!_[_0x1cc0('0x8')](this[_0x1cc0('0x9')]['UserId'])){logger[_0x1cc0('0xa')](_0x1cc0('0xb'),_0x2dcad7,_0x1cc0('0xc'));return _0x5617c3[_0x1cc0('0xd')]();}var _0x44f270={'ContactId':this['contact']['id'],'sentAt':moment()[_0x1cc0('0xe')](_0x1cc0('0xf')),'direction':'out'};if(this[_0x1cc0('0x10')]==='sms'||this[_0x1cc0('0x10')]===_0x1cc0('0x11')){_0x44f270[_0x1cc0('0x12')]=this[_0x1cc0('0x9')][_0x1cc0('0x12')];}var _0x28b78d=this[_0x1cc0('0x10')];if(_0x28b78d===_0x1cc0('0x13')){_0x44f270['ChatWebsiteId']=this['account']['id'];}else{_0x44f270[_[_0x1cc0('0x14')](_0x28b78d)+_0x1cc0('0x15')]=this[_0x1cc0('0x16')]['id'];}_0x44f270[_[_0x1cc0('0x14')](_0x28b78d)+_0x1cc0('0x17')]=this[_0x1cc0('0x9')]['id'];if(this[_0x1cc0('0x9')]['created']){var _0x2c6963=_0xe1d650[0x4];if(!_['isEmpty'](_0x2c6963)){_0x44f270[_0x1cc0('0x18')]=utils[_0x1cc0('0x19')](_0x2c6963,this);return rpc[_0x28b78d+_0x1cc0('0x1a')][_0x1cc0('0x1b')](_0x44f270)[_0x1cc0('0x1c')](function(_0x271b6d){logger['info']('[%s][AMAZONLEX]\x20%s',_0x2dcad7,_0x44f270[_0x1cc0('0x18')]);})['catch'](function(_0x25f4c6){logger[_0x1cc0('0x1d')](_0x1cc0('0xb'),_0x2dcad7,JSON[_0x1cc0('0x1e')](_0x25f4c6));})[_0x1cc0('0x1f')](function(){logger[_0x1cc0('0xa')](_0x1cc0('0x20'),_0x2dcad7);_0x5617c3['stop']();});}else{logger[_0x1cc0('0xa')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2dcad7);_0x5617c3['stop']();}}else{var _0x149782=this;var _0x404bbc=new AWS[(_0x1cc0('0x21'))]({'accessKeyId':_0xe1d650[0x0],'secretAccessKey':_0xe1d650[0x1],'region':_0xe1d650[0x2]});var _0x646b9a={'botAlias':_0x1cc0('0x22'),'botName':_0xe1d650[0x3],'inputText':this['message'][_0x1cc0('0x18')],'userId':this[_0x1cc0('0x10')]+':'+this[_0x1cc0('0x9')]['id'][_0x1cc0('0x23')]()};_0x404bbc['postText'](_0x646b9a,function(_0x1582ac,_0x3aa24d){if(_0x1582ac){logger['error'](_0x1cc0('0xb'),_0x2dcad7,_0x1582ac[_0x1cc0('0x24')]);_0x5617c3[_0x1cc0('0xd')]();}else if(_0x3aa24d&&_0x3aa24d[_0x1cc0('0x24')]){_0x149782[_0x1cc0('0x18')][_0x1cc0('0x25')]=_0x3aa24d;_0x44f270['body']=_0x3aa24d[_0x1cc0('0x24')];_0x44f270[_0x1cc0('0x26')]=_0x1cc0('0x25');_0x44f270[_0x1cc0('0x27')]=JSON[_0x1cc0('0x1e')](_0x3aa24d);return rpc[_0x28b78d+_0x1cc0('0x1a')]['create'](_0x44f270)[_0x1cc0('0x1c')](function(_0x210b73){logger[_0x1cc0('0xa')](_0x1cc0('0xb'),_0x2dcad7,_0x44f270[_0x1cc0('0x18')]);if(_0x3aa24d[_0x1cc0('0x28')]==_0x1cc0('0x29')){_0x5617c3['next']();}else{_0x5617c3[_0x1cc0('0x2a')]();}})[_0x1cc0('0x2b')](function(_0xa55681){logger[_0x1cc0('0x1d')](_0x1cc0('0xb'),_0x2dcad7,JSON[_0x1cc0('0x1e')](_0xa55681));_0x5617c3[_0x1cc0('0xd')]();});}else{_0x5617c3[_0x1cc0('0xd')]();}});}}catch(_0x9b1356){logger['error'](_0x1cc0('0xb'),_0x2dcad7,JSON[_0x1cc0('0x1e')](_0x9b1356));_0x5617c3[_0x1cc0('0x2a')]();}};}; \ No newline at end of file +var _0xd14d=['Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','getMustacheRender','create','info','body','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','toString','postText','message','amazonlex','providerName','providerResponse','Message','then','dialogState','stop','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','isNil','interaction','[%s][AMAZONLEX]\x20%s'];(function(_0x3142d3,_0x49644b){var _0x340382=function(_0xd645c5){while(--_0xd645c5){_0x3142d3['push'](_0x3142d3['shift']());}};_0x340382(++_0x49644b);}(_0xd14d,0x1de));var _0xdd14=function(_0x360e8f,_0x1364a9){_0x360e8f=_0x360e8f-0x0;var _0x3543a3=_0xd14d[_0x360e8f];return _0x3543a3;};'use strict';var _=require(_0xdd14('0x0'));var moment=require(_0xdd14('0x1'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0xdd14('0x2'))(_0xdd14('0x3'));var rpc={'chatMessage':require(_0xdd14('0x4')),'openchannelMessage':require(_0xdd14('0x5')),'mailMessage':require(_0xdd14('0x6')),'smsMessage':require(_0xdd14('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xdd14('0x8')]=function(_0x1a426d,_0x295717){return function(_0x366943){try{if(!_[_0xdd14('0x9')](this[_0xdd14('0xa')]['UserId'])){logger['info'](_0xdd14('0xb'),_0x1a426d,_0xdd14('0xc'));return _0x366943[_0xdd14('0xd')]();}var _0x2f4d91={'ContactId':this[_0xdd14('0xe')]['id'],'sentAt':moment()[_0xdd14('0xf')](_0xdd14('0x10')),'direction':'out'};if(this[_0xdd14('0x11')]===_0xdd14('0x12')||this[_0xdd14('0x11')]===_0xdd14('0x13')){_0x2f4d91[_0xdd14('0x14')]=this[_0xdd14('0xa')]['phone'];}var _0x1a1765=this[_0xdd14('0x11')];if(_0x1a1765===_0xdd14('0x15')){_0x2f4d91[_0xdd14('0x16')]=this[_0xdd14('0x17')]['id'];}else{_0x2f4d91[_[_0xdd14('0x18')](_0x1a1765)+_0xdd14('0x19')]=this[_0xdd14('0x17')]['id'];}_0x2f4d91[_[_0xdd14('0x18')](_0x1a1765)+'InteractionId']=this['interaction']['id'];if(this[_0xdd14('0xa')][_0xdd14('0x1a')]){var _0x35c5a2=_0x295717[0x4];if(!_[_0xdd14('0x1b')](_0x35c5a2)){_0x2f4d91['body']=utils[_0xdd14('0x1c')](_0x35c5a2,this);return rpc[_0x1a1765+'Message'][_0xdd14('0x1d')](_0x2f4d91)['then'](function(_0xb29962){logger[_0xdd14('0x1e')](_0xdd14('0xb'),_0x1a426d,_0x2f4d91[_0xdd14('0x1f')]);})[_0xdd14('0x20')](function(_0x38e962){logger[_0xdd14('0x21')](_0xdd14('0xb'),_0x1a426d,JSON[_0xdd14('0x22')](_0x38e962));})[_0xdd14('0x23')](function(){logger[_0xdd14('0x1e')](_0xdd14('0x24'),_0x1a426d);_0x366943['stop']();});}else{logger[_0xdd14('0x1e')](_0xdd14('0x25'),_0x1a426d);_0x366943['stop']();}}else{var _0x61f5a4=this;var _0xe9244e=new AWS['LexRuntime']({'accessKeyId':_0x295717[0x0],'secretAccessKey':_0x295717[0x1],'region':_0x295717[0x2]});var _0x41a8f9={'botAlias':_0xdd14('0x26'),'botName':_0x295717[0x3],'inputText':this['message'][_0xdd14('0x1f')],'userId':this[_0xdd14('0x11')]+':'+this['interaction']['id'][_0xdd14('0x27')]()};_0xe9244e[_0xdd14('0x28')](_0x41a8f9,function(_0xce77f5,_0x28da42){if(_0xce77f5){logger[_0xdd14('0x21')]('[%s][AMAZONLEX]\x20%s',_0x1a426d,_0xce77f5[_0xdd14('0x29')]);_0x366943['next']();}else if(_0x28da42&&_0x28da42[_0xdd14('0x29')]){_0x61f5a4[_0xdd14('0x1f')][_0xdd14('0x2a')]=_0x28da42;_0x2f4d91[_0xdd14('0x1f')]=_0x28da42[_0xdd14('0x29')];_0x2f4d91[_0xdd14('0x2b')]=_0xdd14('0x2a');_0x2f4d91[_0xdd14('0x2c')]=JSON['stringify'](_0x28da42);return rpc[_0x1a1765+_0xdd14('0x2d')][_0xdd14('0x1d')](_0x2f4d91)[_0xdd14('0x2e')](function(_0x254db8){logger[_0xdd14('0x1e')]('[%s][AMAZONLEX]\x20%s',_0x1a426d,_0x2f4d91[_0xdd14('0x1f')]);if(_0x28da42[_0xdd14('0x2f')]=='Failed'){_0x366943[_0xdd14('0xd')]();}else{_0x366943[_0xdd14('0x30')]();}})['catch'](function(_0x4b683b){logger['error'](_0xdd14('0xb'),_0x1a426d,JSON[_0xdd14('0x22')](_0x4b683b));_0x366943[_0xdd14('0xd')]();});}else{_0x366943[_0xdd14('0xd')]();}});}}catch(_0x2f3e6c){logger[_0xdd14('0x21')](_0xdd14('0xb'),_0x1a426d,JSON[_0xdd14('0x22')](_0x2f3e6c));_0x366943[_0xdd14('0x30')]();}};}; \ 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 9eafd6a..19c707f 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 _0xf5a7=['','headers','auto-replied','All','auto_reply','smtpOptions','then','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Interaction','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','getMustacheRender','message','from','phone','subject','Re:\x20','account','AccountId','InteractionId','Message','inReplyTo','messageId','html','replace',''+_[_0x7f5a('0x30')](_0x41be9e[_0x7f5a('0x15')],_0x7f5a('0x31'),_0x7f5a('0x32'))+_0x7f5a('0x33');_0x41be9e[_0x7f5a('0x34')]={'Auto-Submitted':_0x7f5a('0x35'),'X-Auto-Response-Suppress':_0x7f5a('0x36'),'Precedence':_0x7f5a('0x37')};return mailRpc['sendMailMessage'](this[_0x7f5a('0x29')][_0x7f5a('0x38')],_0x41be9e)[_0x7f5a('0x39')](function(_0x4dfe4d){logger[_0x7f5a('0x16')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x83d794);_0x41be9e[_0x7f5a('0x2e')]=_0x4dfe4d[_0x7f5a('0x24')][_0x7f5a('0x2e')];return rpc[_0x55a002+_0x7f5a('0x2c')][_0x7f5a('0x3a')](_0x41be9e);})[_0x7f5a('0x39')](function(_0x4956cf){logger[_0x7f5a('0x16')](_0x7f5a('0x1c'),_0x83d794,JSON[_0x7f5a('0x3b')](_0x4956cf));})[_0x7f5a('0x3c')](function(_0x16110e){logger[_0x7f5a('0x3d')](_0x7f5a('0x3e'),_0x83d794,JSON[_0x7f5a('0x3b')](_0x16110e));})[_0x7f5a('0x3f')](function(){Promise[_0x7f5a('0x40')]()['then'](function(){if(_0x23a735[0x0]!=='2'||_0x3c8429[_0x7f5a('0x1e')])return;return rpc[_0x55a002+'Interaction'][_0x7f5a('0x41')](_0x3c8429['id'],{'autoreplyExecuted':!![]})[_0x7f5a('0x39')](function(_0x32f122){logger[_0x7f5a('0x16')](_0x7f5a('0x1f'),_0x83d794,JSON[_0x7f5a('0x3b')](_0x32f122));})['catch'](function(_0x2204b4){logger[_0x7f5a('0x3d')](_0x7f5a('0x42'),_0x83d794,JSON[_0x7f5a('0x3b')](_0x2204b4));});})[_0x7f5a('0x39')](function(){_0x38adbc[_0x7f5a('0x18')]();});});}else{return rpc[this[_0x7f5a('0x13')]+_0x7f5a('0x2c')][_0x7f5a('0x3a')](_0x41be9e)[_0x7f5a('0x39')](function(){logger[_0x7f5a('0x16')](_0x7f5a('0x1c'),_0x83d794,_0x41be9e[_0x7f5a('0x15')]);})[_0x7f5a('0x3c')](function(_0x266ebc){logger['error'](_0x7f5a('0x1c'),_0x83d794,JSON[_0x7f5a('0x3b')](_0x266ebc));})[_0x7f5a('0x3f')](function(){Promise[_0x7f5a('0x40')]()[_0x7f5a('0x39')](function(){if(_0x23a735[0x0]!=='2'||_0x3c8429['autoreplyExecuted'])return;return rpc[_0x55a002+_0x7f5a('0x43')][_0x7f5a('0x41')](_0x3c8429['id'],{'autoreplyExecuted':!![]})[_0x7f5a('0x39')](function(_0x2f41b8){logger[_0x7f5a('0x16')](_0x7f5a('0x1f'),_0x83d794,JSON[_0x7f5a('0x3b')](_0x2f41b8));})[_0x7f5a('0x3c')](function(_0x1d06f6){logger[_0x7f5a('0x3d')](_0x7f5a('0x42'),_0x83d794,JSON[_0x7f5a('0x3b')](_0x1d06f6));});})[_0x7f5a('0x39')](function(){_0x38adbc[_0x7f5a('0x18')]();});});}}}catch(_0x1732b5){logger['error'](_0x7f5a('0x1c'),_0x83d794,JSON['stringify'](_0x1732b5));_0x38adbc['stop']();}};}; \ No newline at end of file +var _0xa2ac=['../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','next','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','Re:','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','Message','messageId','html','','replace','','headers','All','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','finally','resolve','Interaction','update','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','error','stop','moment','./utils','../../../../config/logger','routing'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa2ac,0x1d1));var _0xca2a=function(_0x412ff5,_0x1e020b){_0x412ff5=_0x412ff5-0x0;var _0x445abb=_0xa2ac[_0x412ff5];return _0x445abb;};'use strict';var _=require('lodash');var moment=require(_0xca2a('0x0'));var utils=require(_0xca2a('0x1'));var logger=require(_0xca2a('0x2'))(_0xca2a('0x3'));var rpc={'chatMessage':require(_0xca2a('0x4')),'openchannelMessage':require(_0xca2a('0x5')),'mailMessage':require(_0xca2a('0x6')),'smsMessage':require(_0xca2a('0x7')),'faxMessage':require(_0xca2a('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0xca2a('0x9')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0xca2a('0xa')),'whatsappInteraction':require(_0xca2a('0xb'))};var mailRpc=require(_0xca2a('0xc'));exports[_0xca2a('0xd')]=function(_0x41ae49,_0x488c53,_0x4ac71e,_0x277ec7){return function(_0x355f8d){try{var _0x260a28=this[_0xca2a('0xe')];if(_0x260a28===_0xca2a('0xf')&&_0x277ec7[_0xca2a('0x10')][_0xca2a('0x11')]){logger[_0xca2a('0x12')](_0xca2a('0x13'),_0x41ae49,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x355f8d[_0xca2a('0x14')]();}if(_0x488c53[0x0]==='1'&&(_['isNil'](this[_0xca2a('0x15')]['created'])||!this[_0xca2a('0x15')][_0xca2a('0x16')])){logger[_0xca2a('0x12')](_0xca2a('0x13'),_0x41ae49,_0xca2a('0x17'));return _0x355f8d[_0xca2a('0x14')]();}if(_0x488c53[0x0]==='2'&&this[_0xca2a('0x15')][_0xca2a('0x18')]){logger[_0xca2a('0x12')](_0xca2a('0x19'),_0x41ae49,_0xca2a('0x1a'));return _0x355f8d['next']();}var _0x2092bc={'ContactId':this[_0xca2a('0x1b')]['id'],'sentAt':moment()[_0xca2a('0x1c')](_0xca2a('0x1d')),'direction':_0xca2a('0x1e')};if(this['channel']===_0xca2a('0xf')){_0x2092bc[_0xca2a('0x10')]=utils[_0xca2a('0x1f')](_0x488c53[0x2],this);}else{_0x2092bc[_0xca2a('0x10')]=utils[_0xca2a('0x1f')](_0x488c53[0x1],this);}if(this[_0xca2a('0x20')]){_0x2092bc['to']=this[_0xca2a('0x20')][_0xca2a('0x21')]||'';if(this[_0xca2a('0xe')]===_0xca2a('0xf')&&_0x488c53[0x1]==='1'){_0x2092bc['cc']=this['message']['cc']||'';}_0x2092bc[_0xca2a('0x21')]=this[_0xca2a('0x20')]['to']||'';_0x2092bc[_0xca2a('0x22')]=this[_0xca2a('0x20')][_0xca2a('0x22')]||'';_0x2092bc[_0xca2a('0x23')]=!![];if(this[_0xca2a('0x20')]['subject']){_0x2092bc[_0xca2a('0x24')]='';_0x2092bc['subject']+=_['startsWith'](this['message']['subject'],_0xca2a('0x25'))?'':'Re:\x20';_0x2092bc['subject']+=this[_0xca2a('0x20')][_0xca2a('0x24')];}}if(this[_0xca2a('0xe')]===_0xca2a('0x26')){_0x2092bc[_0xca2a('0x27')]=this['account']['id'];}else{_0x2092bc[_[_0xca2a('0x28')](this[_0xca2a('0xe')])+_0xca2a('0x29')]=this[_0xca2a('0x2a')]['id'];}_0x2092bc[_[_0xca2a('0x28')](this[_0xca2a('0xe')])+_0xca2a('0x2b')]=this[_0xca2a('0x15')]['id'];var _0x252197=this['interaction'];if(rpc[this[_0xca2a('0xe')]+_0xca2a('0x2c')]){if(this[_0xca2a('0xe')]==='mail'){_0x2092bc['inReplyTo']=this[_0xca2a('0x20')][_0xca2a('0x2d')];_0x2092bc[_0xca2a('0x2e')]=_0xca2a('0x2f')+_[_0xca2a('0x30')](_0x2092bc[_0xca2a('0x10')],_0xca2a('0x31'),']+(>|$)/g,''),'priorityTrue':_0x31cf04[0x1],'priorityFalse':_0x31cf04[0x2]};var _0x19538d=gotoif[_0xd95c('0x0')](_0x320102,{'typecast':!![]});if(_0x19538d['length']){logger['error']('[%s][GOTOIF]\x20%s',_0x19686b,_[_0xd95c('0xd')](_0x19538d,_0xd95c('0xe'))['join'](',\x20'));_0x3c931d['stop']();}else{try{var _0x482c1a=eval('('+_0x320102[_0xd95c('0xf')]+')');var _0x1ab475=_0x482c1a?_0x320102['priorityTrue']:_0x320102[_0xd95c('0x10')];logger[_0xd95c('0x11')](_0xd95c('0x12'),_0x19686b,_0x320102['condition'],_0x482c1a,_0x1ab475||_0xd95c('0x13'));if(_0x1ab475){var _0x57b83b=_['findIndex'](_0x3c931d[_0xd95c('0x14')](),{'p':_0x1ab475});if(_0x57b83b>=0x0){logger[_0xd95c('0x11')](_0xd95c('0x15'),_0x19686b,_0x1ab475||_0xd95c('0x13'),_0x57b83b);_0x3c931d['next'](_0x57b83b);}else{logger[_0xd95c('0x11')](_0xd95c('0x16'),_0x19686b,_0x1ab475||'next');_0x3c931d[_0xd95c('0x17')]();}}else{_0x3c931d[_0xd95c('0x13')]();}}catch(_0x12d735){logger[_0xd95c('0x18')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x19686b,_0x12d735[_0xd95c('0xe')]);_0x3c931d[_0xd95c('0x17')]();}}}catch(_0x1004ad){logger[_0xd95c('0x18')](_0xd95c('0x19'),_0x19686b,JSON[_0xd95c('0x1a')](_0x1004ad));_0x3c931d[_0xd95c('0x17')]();}};}; \ No newline at end of file +var _0xae81=['[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','html-to-text','./utils','../../../../config/logger','routing','number','fromString','getMustacheRender','replace','validate','error','[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xae81,0xfd));var _0x1ae8=function(_0x471daf,_0x4f3584){_0x471daf=_0x471daf-0x0;var _0x3edb23=_0xae81[_0x471daf];return _0x3edb23;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require(_0x1ae8('0x0'));var utils=require(_0x1ae8('0x1'));var logger=require(_0x1ae8('0x2'))(_0x1ae8('0x3'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x1ae8('0x4'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x1ae8('0x4'),'message':'priority\x20false\x20is\x20a\x20number'}});exports['consequence']=function(_0x127a13,_0x24e308){return function(_0xbc8e16){try{var _0x2b35ed={'condition':htmlToText[_0x1ae8('0x5')](utils[_0x1ae8('0x6')](_0x24e308[0x0],this),{'wordwrap':![]})[_0x1ae8('0x7')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x24e308[0x1],'priorityFalse':_0x24e308[0x2]};var _0x339f2f=gotoif[_0x1ae8('0x8')](_0x2b35ed,{'typecast':!![]});if(_0x339f2f['length']){logger[_0x1ae8('0x9')](_0x1ae8('0xa'),_0x127a13,_[_0x1ae8('0xb')](_0x339f2f,'message')[_0x1ae8('0xc')](',\x20'));_0xbc8e16[_0x1ae8('0xd')]();}else{try{var _0x62d440=eval('('+_0x2b35ed[_0x1ae8('0xe')]+')');var _0x3e1f0c=_0x62d440?_0x2b35ed[_0x1ae8('0xf')]:_0x2b35ed[_0x1ae8('0x10')];logger[_0x1ae8('0x11')](_0x1ae8('0x12'),_0x127a13,_0x2b35ed[_0x1ae8('0xe')],_0x62d440,_0x3e1f0c||_0x1ae8('0x13'));if(_0x3e1f0c){var _0x5910d4=_[_0x1ae8('0x14')](_0xbc8e16[_0x1ae8('0x15')](),{'p':_0x3e1f0c});if(_0x5910d4>=0x0){logger[_0x1ae8('0x11')](_0x1ae8('0x16'),_0x127a13,_0x3e1f0c||_0x1ae8('0x13'),_0x5910d4);_0xbc8e16[_0x1ae8('0x13')](_0x5910d4);}else{logger[_0x1ae8('0x11')](_0x1ae8('0x17'),_0x127a13,_0x3e1f0c||'next');_0xbc8e16[_0x1ae8('0xd')]();}}else{_0xbc8e16[_0x1ae8('0x13')]();}}catch(_0xb4b25c){logger[_0x1ae8('0x9')](_0x1ae8('0x18'),_0x127a13,_0xb4b25c['message']);_0xbc8e16[_0x1ae8('0xd')]();}}}catch(_0x42c7e7){logger[_0x1ae8('0x9')](_0x1ae8('0xa'),_0x127a13,JSON['stringify'](_0x42c7e7));_0xbc8e16[_0x1ae8('0xd')]();}};}; \ 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 8a16969..9fc7a41 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 _0x9e22=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger','number'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x9e22,0x11d));var _0x29e2=function(_0x18d631,_0x4376d2){_0x18d631=_0x18d631-0x0;var _0x50d708=_0x9e22[_0x18d631];return _0x50d708;};'use strict';var schema=require(_0x29e2('0x0'));var _=require(_0x29e2('0x1'));var logger=require(_0x29e2('0x2'))('routing');var gotop=schema({'priority':{'type':_0x29e2('0x3'),'required':!![],'message':_0x29e2('0x4')}});exports['consequence']=function(_0x3c899f,_0x23f6ab){return function(_0x3fd262){try{var _0x1874de={'priority':_0x23f6ab[0x0]};var _0x22a085=gotop[_0x29e2('0x0')](_0x1874de,{'typecast':!![]});if(_0x22a085[_0x29e2('0x5')]){logger[_0x29e2('0x6')](_0x29e2('0x7'),_0x3c899f,_[_0x29e2('0x8')](_0x22a085,_0x29e2('0x9'))[_0x29e2('0xa')](',\x20'));_0x3fd262[_0x29e2('0xb')]();}else{logger[_0x29e2('0xc')]('[%s][GOTOP]\x20priority\x20%s',_0x3c899f,_0x1874de['priority']);if(_0x1874de[_0x29e2('0xd')]){var _0xf58aaf=_['findIndex'](_0x3fd262['rules'](),{'p':_0x1874de['priority']});if(_0xf58aaf>=0x0){logger[_0x29e2('0xc')](_0x29e2('0xe'),_0x3c899f,_0x1874de[_0x29e2('0xd')]||_0x29e2('0xf'),_0xf58aaf);_0x3fd262[_0x29e2('0xf')](_0xf58aaf);}else{logger[_0x29e2('0xc')](_0x29e2('0x10'),_0x3c899f,_0x1874de[_0x29e2('0xd')]||_0x29e2('0xf'));_0x3fd262['stop']();}}else{_0x3fd262[_0x29e2('0xf')]();}}}catch(_0xfd28c5){logger[_0x29e2('0x6')]('[%s][GOTOP]\x20%s',_0x3c899f,JSON['stringify'](_0xfd28c5));_0x3fd262[_0x29e2('0xb')]();}};}; \ No newline at end of file +var _0x2d31=['join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','validate','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map'];(function(_0x51821c,_0x2e39c5){var _0x20bde8=function(_0x2d307a){while(--_0x2d307a){_0x51821c['push'](_0x51821c['shift']());}};_0x20bde8(++_0x2e39c5);}(_0x2d31,0xe5));var _0x12d3=function(_0x26e727,_0x3e65be){_0x26e727=_0x26e727-0x0;var _0x563800=_0x2d31[_0x26e727];return _0x563800;};'use strict';var schema=require(_0x12d3('0x0'));var _=require(_0x12d3('0x1'));var logger=require(_0x12d3('0x2'))(_0x12d3('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x12d3('0x4')}});exports['consequence']=function(_0x536a9f,_0x2db908){return function(_0x296358){try{var _0x42a30e={'priority':_0x2db908[0x0]};var _0x164a0d=gotop[_0x12d3('0x0')](_0x42a30e,{'typecast':!![]});if(_0x164a0d[_0x12d3('0x5')]){logger[_0x12d3('0x6')](_0x12d3('0x7'),_0x536a9f,_[_0x12d3('0x8')](_0x164a0d,'message')[_0x12d3('0x9')](',\x20'));_0x296358[_0x12d3('0xa')]();}else{logger[_0x12d3('0xb')](_0x12d3('0xc'),_0x536a9f,_0x42a30e[_0x12d3('0xd')]);if(_0x42a30e[_0x12d3('0xd')]){var _0x4788ff=_['findIndex'](_0x296358[_0x12d3('0xe')](),{'p':_0x42a30e[_0x12d3('0xd')]});if(_0x4788ff>=0x0){logger[_0x12d3('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x536a9f,_0x42a30e['priority']||'next',_0x4788ff);_0x296358['next'](_0x4788ff);}else{logger[_0x12d3('0xb')](_0x12d3('0xf'),_0x536a9f,_0x42a30e[_0x12d3('0xd')]||_0x12d3('0x10'));_0x296358[_0x12d3('0xa')]();}}else{_0x296358[_0x12d3('0x10')]();}}}catch(_0x4df68a){logger[_0x12d3('0x6')](_0x12d3('0x7'),_0x536a9f,JSON['stringify'](_0x4df68a));_0x296358[_0x12d3('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index a50ad12..c86aa47 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 _0x2cae=['./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash'];(function(_0x5016c9,_0x57cdf0){var _0x5371ee=function(_0x494af9){while(--_0x494af9){_0x5016c9['push'](_0x5016c9['shift']());}};_0x5371ee(++_0x57cdf0);}(_0x2cae,0x16b));var _0xe2ca=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x2cae[_0x40bffc];return _0x3007e9;};'use strict';var _=require(_0xe2ca('0x0'));var utils=require(_0xe2ca('0x1'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xe2ca('0x2')),'openchannelMessage':require(_0xe2ca('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xe2ca('0x4')),'faxMessage':require(_0xe2ca('0x5')),'whatsappMessage':require(_0xe2ca('0x6'))};exports[_0xe2ca('0x7')]=function(_0x4dc701,_0x2b4c70){return function(_0x3cabde){try{var _0x4fbb20={'body':utils[_0xe2ca('0x8')](_0x2b4c70[0x0],this),'ContactId':this['contact']['id']};if(this[_0xe2ca('0x9')]===_0xe2ca('0xa')){_0x4fbb20[_0xe2ca('0xb')]=this[_0xe2ca('0xc')]['id'];}else{_0x4fbb20[_['upperFirst'](this['channel'])+'AccountId']=this['account']['id'];}_0x4fbb20[_[_0xe2ca('0xd')](this[_0xe2ca('0x9')])+_0xe2ca('0xe')]=this[_0xe2ca('0xf')]['id'];if(rpc[this[_0xe2ca('0x9')]+_0xe2ca('0x10')]){return rpc[this[_0xe2ca('0x9')]+'Message'][_0xe2ca('0x11')](_0x4fbb20)[_0xe2ca('0x12')](function(_0x199237){logger[_0xe2ca('0x13')](_0xe2ca('0x14'),_0x4dc701,_0x4fbb20['body']);_0x3cabde[_0xe2ca('0x15')]();})[_0xe2ca('0x16')](function(_0x27c3ad){logger[_0xe2ca('0x17')](_0xe2ca('0x14'),_0x4dc701,JSON[_0xe2ca('0x18')](_0x27c3ad));_0x3cabde[_0xe2ca('0x19')]();});}}catch(_0x29cdcf){logger[_0xe2ca('0x17')](_0xe2ca('0x14'),_0x4dc701,JSON['stringify'](_0x29cdcf));_0x3cabde[_0xe2ca('0x19')]();}};}; \ No newline at end of file +var _0x38dc=['ChatWebsiteId','account','upperFirst','channel','AccountId','interaction','Message','create','[%s][MESSAGE]\x20%s','body','next','catch','error','stop','stringify','../../../../config/logger','routing','../../rpc/smsMessage','../../rpc/whatsappMessage','getMustacheRender','contact','chat'];(function(_0x16e734,_0x46281a){var _0x45f4c3=function(_0x289d23){while(--_0x289d23){_0x16e734['push'](_0x16e734['shift']());}};_0x45f4c3(++_0x46281a);}(_0x38dc,0x117));var _0xc38d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x38dc[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0xc38d('0x0'))(_0xc38d('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xc38d('0x2')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc38d('0x3'))};exports['consequence']=function(_0x2b0e87,_0x300a12){return function(_0x501765){try{var _0x15a1fc={'body':utils[_0xc38d('0x4')](_0x300a12[0x0],this),'ContactId':this[_0xc38d('0x5')]['id']};if(this['channel']===_0xc38d('0x6')){_0x15a1fc[_0xc38d('0x7')]=this[_0xc38d('0x8')]['id'];}else{_0x15a1fc[_[_0xc38d('0x9')](this[_0xc38d('0xa')])+_0xc38d('0xb')]=this[_0xc38d('0x8')]['id'];}_0x15a1fc[_[_0xc38d('0x9')](this[_0xc38d('0xa')])+'InteractionId']=this[_0xc38d('0xc')]['id'];if(rpc[this['channel']+_0xc38d('0xd')]){return rpc[this['channel']+_0xc38d('0xd')][_0xc38d('0xe')](_0x15a1fc)['then'](function(_0x5d1a05){logger['info'](_0xc38d('0xf'),_0x2b0e87,_0x15a1fc[_0xc38d('0x10')]);_0x501765[_0xc38d('0x11')]();})[_0xc38d('0x12')](function(_0x21c3f9){logger[_0xc38d('0x13')](_0xc38d('0xf'),_0x2b0e87,JSON['stringify'](_0x21c3f9));_0x501765[_0xc38d('0x14')]();});}}catch(_0x5e9785){logger[_0xc38d('0x13')](_0xc38d('0xf'),_0x2b0e87,JSON[_0xc38d('0x15')](_0x5e9785));_0x501765[_0xc38d('0x14')]();}};}; \ 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 62fb48e..9039e24 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 _0x3eba=['../../../../config/logger','routing','consequence','info','getMustacheRender','next','error'];(function(_0x107c78,_0x521045){var _0x8dd98e=function(_0x53bea0){while(--_0x53bea0){_0x107c78['push'](_0x107c78['shift']());}};_0x8dd98e(++_0x521045);}(_0x3eba,0x70));var _0xa3eb=function(_0x2dc700,_0x1373f2){_0x2dc700=_0x2dc700-0x0;var _0x765f15=_0x3eba[_0x2dc700];return _0x765f15;};'use strict';var utils=require('./utils');var logger=require(_0xa3eb('0x0'))(_0xa3eb('0x1'));exports[_0xa3eb('0x2')]=function(_0x13fb87,_0x2d9519){return function(_0x1f7a1c){try{logger[_0xa3eb('0x3')]('[%s][NOOP]\x20%s',_0x13fb87,utils[_0xa3eb('0x4')](_0x2d9519[0x0],this));_0x1f7a1c[_0xa3eb('0x5')]();}catch(_0x39c600){logger[_0xa3eb('0x6')]('[%s][NOOP]\x20%s',_0x13fb87,JSON['stringify'](_0x39c600));_0x1f7a1c['stop']();}};}; \ No newline at end of file +var _0xa9c0=['stop','./utils','../../../../config/logger','routing','consequence','info','getMustacheRender','next','[%s][NOOP]\x20%s'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0xa9c0,0xd0));var _0x0a9c=function(_0x3d0665,_0x1b20f7){_0x3d0665=_0x3d0665-0x0;var _0x3e9638=_0xa9c0[_0x3d0665];return _0x3e9638;};'use strict';var utils=require(_0x0a9c('0x0'));var logger=require(_0x0a9c('0x1'))(_0x0a9c('0x2'));exports[_0x0a9c('0x3')]=function(_0x7c43ea,_0x2e0a2f){return function(_0x3b3697){try{logger[_0x0a9c('0x4')]('[%s][NOOP]\x20%s',_0x7c43ea,utils[_0x0a9c('0x5')](_0x2e0a2f[0x0],this));_0x3b3697[_0x0a9c('0x6')]();}catch(_0x1d2319){logger['error'](_0x0a9c('0x7'),_0x7c43ea,JSON['stringify'](_0x1d2319));_0x3b3697[_0x0a9c('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 0197da4..76c471f 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 _0xea07=['stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','rrmemory','beepall','log','stack','validate','lodash','util','moment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','emit','clone','push','capitalize','InteractionId','format','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','number','waiting','body','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','update\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join'];(function(_0x5b17da,_0x4bfd3f){var _0x168950=function(_0x2c666a){while(--_0x2c666a){_0x5b17da['push'](_0x5b17da['shift']());}};_0x168950(++_0x4bfd3f);}(_0xea07,0xfc));var _0x7ea0=function(_0x4e045f,_0x3c6807){_0x4e045f=_0x4e045f-0x0;var _0x5b5b9a=_0xea07[_0x4e045f];return _0x5b5b9a;};'use strict';var schema=require(_0x7ea0('0x0'));var _=require(_0x7ea0('0x1'));var util=require(_0x7ea0('0x2'));var seqqueue=require('seq-queue');var moment=require(_0x7ea0('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x7ea0('0x4'))(_0x7ea0('0x5'));var strategy=require(_0x7ea0('0x6'));config[_0x7ea0('0x7')]=_[_0x7ea0('0x8')](config[_0x7ea0('0x7')],{'host':_0x7ea0('0x9'),'port':0x18eb});var io=require(_0x7ea0('0xa'))(new Redis(config[_0x7ea0('0x7')]));var attributes=['id',_0x7ea0('0xb'),_0x7ea0('0xc'),_0x7ea0('0xd'),_0x7ea0('0xe'),'joinAt'];function emit(_0x153a45,_0xf21172,_0x53340f){io['to'](_0x153a45)[_0x7ea0('0xf')](_0xf21172,_0x53340f);}function emitChannelQueueInteraction(_0x1d6500,_0x497034,_0x36c901,_0x5950eb,_0x140129,_0x239890,_0x347a53,_0x4910c8){var _0x310440=_[_0x7ea0('0x10')](_0x36c901);_0x310440[_0x7ea0('0xb')]=_0x4910c8;_0x310440['queue']=_0x497034;_0x310440[_0x7ea0('0xc')]=_0x5950eb;_0x310440['id']=_0x140129;if(_0x239890){attributes[_0x7ea0('0x11')](_[_0x7ea0('0x12')](_0x1d6500)+_0x7ea0('0x13'));_0x347a53[util[_0x7ea0('0x14')]('%sQueuesWaitingInteractions',_0x1d6500)][_0x140129]=_[_0x7ea0('0x15')](_0x310440,attributes);}else{delete _0x347a53[util[_0x7ea0('0x14')]('%sQueuesWaitingInteractions',_0x1d6500)][_0x140129];}emit(util[_0x7ea0('0x14')](_0x7ea0('0x16'),_0x1d6500,_0x497034),util[_0x7ea0('0x14')](_0x7ea0('0x17'),_0x1d6500,_0x239890?_0x7ea0('0x18'):'remove'),_[_0x7ea0('0x15')](_0x310440,attributes));}var rpc={'openchannelQueueReport':require(_0x7ea0('0x19')),'mailQueueReport':require(_0x7ea0('0x1a')),'chatQueueReport':require(_0x7ea0('0x1b')),'smsQueueReport':require(_0x7ea0('0x1c')),'faxQueueReport':require(_0x7ea0('0x1d')),'whatsappQueueReport':require(_0x7ea0('0x1e'))};var queue=schema({'name':{'type':_0x7ea0('0x1f'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x7ea0('0x20'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x29f3f7,_0x149ee7,_0x5cb574,_0x1eb33b){if(_0x29f3f7&&_0x149ee7&&_0x5cb574){_0x149ee7[_0x7ea0('0x21')]+=0x1;var _0x5c37d4={'uniqueid':_0x29f3f7,'from':_0x5cb574[_0x7ea0('0x22')]?_0x5cb574[_0x7ea0('0x22')][_0x7ea0('0xe')]:'','joinAt':moment()[_0x7ea0('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5cb574['contact']?_0x5cb574[_0x7ea0('0x23')]['id']:null,'ListId':_0x5cb574[_0x7ea0('0x24')]?_0x5cb574[_0x7ea0('0x24')]['id']:null};_0x5c37d4[_[_0x7ea0('0x25')](_0x5cb574[_0x7ea0('0x26')])+_0x7ea0('0x27')]=_0x149ee7['id']||null;_0x5c37d4[_[_0x7ea0('0x25')](_0x5cb574['channel'])+_0x7ea0('0x13')]=_0x5cb574[_0x7ea0('0x28')]?_0x5cb574[_0x7ea0('0x28')]['id']:null;_0x5c37d4[_[_0x7ea0('0x25')](_0x5cb574[_0x7ea0('0x26')])+_0x7ea0('0x29')]=_0x5cb574[_0x7ea0('0x2a')]?_0x5cb574['message']['id']:null;_0x5c37d4[_[_0x7ea0('0x25')](_0x5cb574[_0x7ea0('0x26')])+(_0x5cb574[_0x7ea0('0x26')]!==_0x7ea0('0x2b')?'AccountId':_0x7ea0('0x2c'))]=_0x5cb574[_0x7ea0('0xc')]?_0x5cb574[_0x7ea0('0xc')]['id']:null;logger[_0x7ea0('0x2d')](util[_0x7ea0('0x14')](_0x7ea0('0x2e'),_0x29f3f7,_0x149ee7[_0x7ea0('0x2f')]));emitChannelQueueInteraction(_0x5cb574[_0x7ea0('0x26')],_0x149ee7[_0x7ea0('0x2f')],_0x5c37d4,_0x5cb574[_0x7ea0('0xc')][_0x7ea0('0x2f')],_0x5cb574[_0x7ea0('0x2a')]['id'],!![],_0x1eb33b,_0x149ee7['id']);if(rpc[_0x5cb574[_0x7ea0('0x26')]+'QueueReport']){return rpc[_0x5cb574[_0x7ea0('0x26')]+_0x7ea0('0x30')][_0x7ea0('0x31')](_0x5c37d4)[_0x7ea0('0x32')](function(_0x5f033d){logger[_0x7ea0('0x33')](_0x7ea0('0x34'));});}}}function stopRouting(_0x95dd20,_0x3769db,_0x4364ff,_0x29e57b){if(_0x95dd20&&_0x3769db){_0x3769db[_0x7ea0('0x21')]-=0x1;var _0xc503ba={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x7ea0('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x7ea0('0x35')};logger[_0x7ea0('0x2d')](util[_0x7ea0('0x14')]('[%s][STOP:QUEUE][NAME:%s]',_0x95dd20,_0x3769db[_0x7ea0('0x2f')]));emitChannelQueueInteraction(_0x4364ff[_0x7ea0('0x26')],_0x3769db[_0x7ea0('0x2f')],_0x4364ff[_0x7ea0('0x22')],_0x4364ff[_0x7ea0('0xc')][_0x7ea0('0x2f')],_0x4364ff[_0x7ea0('0x2a')]['id'],![],_0x29e57b,_0x3769db['id']);if(rpc[_0x4364ff[_0x7ea0('0x26')]+_0x7ea0('0x30')]){return rpc[_0x4364ff[_0x7ea0('0x26')]+_0x7ea0('0x30')]['update'](_0x95dd20,_0xc503ba)[_0x7ea0('0x32')](function(_0x363715){logger[_0x7ea0('0x33')](_0x7ea0('0x36'));});}}}function endRouting(_0x8fac0f,_0x2d3c22,_0x27eec1,_0x2ae186){if(_0x8fac0f&&_0x2d3c22){_0x2d3c22[_0x7ea0('0x21')]-=0x1;var _0x23040e={'leaveAt':moment()[_0x7ea0('0x14')](_0x7ea0('0x37')),'exitAt':moment()[_0x7ea0('0x14')](_0x7ea0('0x37')),'reason':_0x7ea0('0x38')};logger[_0x7ea0('0x2d')](util[_0x7ea0('0x14')](_0x7ea0('0x39'),_0x8fac0f,_0x2d3c22[_0x7ea0('0x2f')]));emitChannelQueueInteraction(_0x27eec1[_0x7ea0('0x26')],_0x2d3c22[_0x7ea0('0x2f')],_0x27eec1[_0x7ea0('0x22')],_0x27eec1[_0x7ea0('0xc')]['name'],_0x27eec1['message']['id'],![],_0x2ae186);if(rpc[_0x27eec1['channel']+'QueueReport']){return rpc[_0x27eec1[_0x7ea0('0x26')]+_0x7ea0('0x30')][_0x7ea0('0x3a')](_0x8fac0f,_0x23040e)[_0x7ea0('0x32')](function(_0x36902c){logger[_0x7ea0('0x33')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x37f988){return function(_0x52f561){return _0x52f561[_0x7ea0('0x2f')][_0x7ea0('0x3b')]()===_0x37f988[_0x7ea0('0x3b')]();};}exports[_0x7ea0('0x3c')]=function(_0x44e096,_0x20d71c,_0x4af14d,_0x1f895b){return function(_0x105eb7){try{var _0x31d3e1={'name':_0x20d71c[0x0],'timeout':_0x20d71c[0x1]};var _0x2b4a0b=queue[_0x7ea0('0x0')](_0x31d3e1,{'typecast':!![]});if(_0x2b4a0b['length']){logger['error'](_0x7ea0('0x3d'),_0x44e096,_[_0x7ea0('0x3e')](_0x2b4a0b,'message')[_0x7ea0('0x3f')](',\x20'));_0x105eb7[_0x7ea0('0x40')]();}else{var _0x596915=_[_0x7ea0('0x41')](_0x4af14d[_0x1f895b[_0x7ea0('0x26')]+_0x7ea0('0x42')],handleFindQueue(_0x31d3e1[_0x7ea0('0x2f')]));if(_0x596915){startRouting(_0x44e096,_0x596915,_0x1f895b,_0x4af14d);var _0x43a550=(_0x596915[_0x7ea0('0x38')]||0xa)*0x3e8;var _0x361d6d=(_0x31d3e1[_0x7ea0('0x38')]||0x14)*0x3e8;var _0x5b4338;if(_0x43a550>_0x361d6d){_0x361d6d=_0x43a550;}var _0x3e606d=seqqueue[_0x7ea0('0x43')](_0x43a550);_0x3e606d['id']=_0x44e096;_0x3e606d[_0x7ea0('0x44')]=_0x43a550;_0x3e606d[_0x7ea0('0x45')]=_0x361d6d;_0x3e606d[_0x7ea0('0x26')]=_0x1f895b[_0x7ea0('0x26')];_0x4af14d[_0x7ea0('0x46')][_0x44e096]['on'](_0x7ea0('0x47'),function(){logger[_0x7ea0('0x2d')](_0x7ea0('0x48'),_0x44e096);stopRouting(_0x44e096,_0x596915,_0x1f895b,_0x4af14d);clearTimeout(_0x5b4338);_0x5b4338=undefined;_0x3e606d[_0x7ea0('0x49')](!![]);if(_0x4af14d[_0x7ea0('0x46')][_0x44e096]){delete _0x4af14d[_0x7ea0('0x46')][_0x44e096];}_0x105eb7[_0x7ea0('0x40')]();});_0x4af14d[_0x7ea0('0x46')][_0x44e096]['on'](_0x7ea0('0x4a'),function(){if(_0x4af14d[_0x7ea0('0x46')][_0x44e096]){delete _0x4af14d[_0x7ea0('0x46')][_0x44e096];}});_0x5b4338=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x44e096);endRouting(_0x44e096,_0x596915,_0x1f895b,_0x4af14d);clearTimeout(_0x5b4338);_0x3e606d[_0x7ea0('0x49')](!![]);_0x105eb7['next']();},_0x361d6d);switch(_0x596915['strategy']){case _0x7ea0('0x4b'):strategy['rrmemory'](_0x3e606d,_0x596915,_0x4af14d,_0x1f895b);break;default:strategy[_0x7ea0('0x4c')](_0x3e606d,_0x596915,_0x4af14d,_0x1f895b);}}else{logger['error']('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x44e096,_0x31d3e1[_0x7ea0('0x2f')]);_0x105eb7['stop']();}}}catch(_0x12f0c1){console[_0x7ea0('0x4d')](_0x12f0c1);logger['error']('[%s][QUEUE]\x20%s',_0x44e096,_0x12f0c1[_0x7ea0('0x4e')]);_0x105eb7[_0x7ea0('0x40')]();}};}; \ No newline at end of file +var _0xf1df=['clone','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','string','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel','interaction','message','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','update','catch','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','[%s][QUEUE]\x20%s','join','stop','find','Queues','createQueue','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','account','emit'];(function(_0x230134,_0x33edc4){var _0x504fac=function(_0x1a82d3){while(--_0x1a82d3){_0x230134['push'](_0x230134['shift']());}};_0x504fac(++_0x33edc4);}(_0xf1df,0x1c0));var _0xff1d=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xf1df[_0xbca1b1];return _0x4e1686;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0xff1d('0x0'));var seqqueue=require(_0xff1d('0x1'));var moment=require(_0xff1d('0x2'));var Redis=require(_0xff1d('0x3'));var config=require(_0xff1d('0x4'));var logger=require(_0xff1d('0x5'))(_0xff1d('0x6'));var strategy=require(_0xff1d('0x7'));config[_0xff1d('0x8')]=_['defaults'](config[_0xff1d('0x8')],{'host':_0xff1d('0x9'),'port':0x18eb});var io=require(_0xff1d('0xa'))(new Redis(config[_0xff1d('0x8')]));var attributes=['id',_0xff1d('0xb'),_0xff1d('0xc'),'queue','from','joinAt'];function emit(_0x4662b6,_0x53f7a4,_0x26de93){io['to'](_0x4662b6)[_0xff1d('0xd')](_0x53f7a4,_0x26de93);}function emitChannelQueueInteraction(_0x46f02e,_0x2ba9e3,_0xaaa8f4,_0x149f4b,_0x7dea49,_0x5287a4,_0x438aa0,_0x442987){var _0x5c7698=_[_0xff1d('0xe')](_0xaaa8f4);_0x5c7698[_0xff1d('0xb')]=_0x442987;_0x5c7698['queue']=_0x2ba9e3;_0x5c7698[_0xff1d('0xc')]=_0x149f4b;_0x5c7698['id']=_0x7dea49;if(_0x5287a4){attributes[_0xff1d('0xf')](_[_0xff1d('0x10')](_0x46f02e)+_0xff1d('0x11'));_0x438aa0[util[_0xff1d('0x12')](_0xff1d('0x13'),_0x46f02e)][_0x7dea49]=_[_0xff1d('0x14')](_0x5c7698,attributes);}else{delete _0x438aa0[util[_0xff1d('0x12')]('%sQueuesWaitingInteractions',_0x46f02e)][_0x7dea49];}emit(util[_0xff1d('0x12')](_0xff1d('0x15'),_0x46f02e,_0x2ba9e3),util[_0xff1d('0x12')](_0xff1d('0x16'),_0x46f02e,_0x5287a4?'save':_0xff1d('0x17')),_[_0xff1d('0x14')](_0x5c7698,attributes));}var rpc={'openchannelQueueReport':require(_0xff1d('0x18')),'mailQueueReport':require(_0xff1d('0x19')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xff1d('0x1a')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xff1d('0x1b'))};var queue=schema({'name':{'type':_0xff1d('0x1c'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xff1d('0x1d')}});function startRouting(_0x52c399,_0x283a18,_0x2c9226,_0x182c5b){if(_0x52c399&&_0x283a18&&_0x2c9226){_0x283a18[_0xff1d('0x1e')]+=0x1;var _0x15a269={'uniqueid':_0x52c399,'from':_0x2c9226[_0xff1d('0x1f')]?_0x2c9226[_0xff1d('0x1f')][_0xff1d('0x20')]:'','joinAt':moment()[_0xff1d('0x12')](_0xff1d('0x21')),'ContactId':_0x2c9226['contact']?_0x2c9226[_0xff1d('0x22')]['id']:null,'ListId':_0x2c9226[_0xff1d('0x23')]?_0x2c9226[_0xff1d('0x23')]['id']:null};_0x15a269[_[_0xff1d('0x24')](_0x2c9226['channel'])+_0xff1d('0x25')]=_0x283a18['id']||null;_0x15a269[_[_0xff1d('0x24')](_0x2c9226[_0xff1d('0x26')])+_0xff1d('0x11')]=_0x2c9226[_0xff1d('0x27')]?_0x2c9226[_0xff1d('0x27')]['id']:null;_0x15a269[_['upperFirst'](_0x2c9226['channel'])+'MessageId']=_0x2c9226[_0xff1d('0x28')]?_0x2c9226[_0xff1d('0x28')]['id']:null;_0x15a269[_[_0xff1d('0x24')](_0x2c9226[_0xff1d('0x26')])+(_0x2c9226[_0xff1d('0x26')]!=='chat'?_0xff1d('0x29'):'WebsiteId')]=_0x2c9226[_0xff1d('0xc')]?_0x2c9226[_0xff1d('0xc')]['id']:null;logger[_0xff1d('0x2a')](util[_0xff1d('0x12')](_0xff1d('0x2b'),_0x52c399,_0x283a18[_0xff1d('0x2c')]));emitChannelQueueInteraction(_0x2c9226[_0xff1d('0x26')],_0x283a18[_0xff1d('0x2c')],_0x15a269,_0x2c9226['account'][_0xff1d('0x2c')],_0x2c9226[_0xff1d('0x28')]['id'],!![],_0x182c5b,_0x283a18['id']);if(rpc[_0x2c9226[_0xff1d('0x26')]+_0xff1d('0x2d')]){return rpc[_0x2c9226[_0xff1d('0x26')]+_0xff1d('0x2d')][_0xff1d('0x2e')](_0x15a269)['catch'](function(_0xbecaf5){logger['error'](_0xff1d('0x2f'));});}}}function stopRouting(_0x3ee63c,_0x58cb9b,_0x562290,_0x1951c7){if(_0x3ee63c&&_0x58cb9b){_0x58cb9b[_0xff1d('0x1e')]-=0x1;var _0x1f8ac2={'leaveAt':moment()['format'](_0xff1d('0x21')),'acceptAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger['info'](util['format'](_0xff1d('0x30'),_0x3ee63c,_0x58cb9b[_0xff1d('0x2c')]));emitChannelQueueInteraction(_0x562290[_0xff1d('0x26')],_0x58cb9b[_0xff1d('0x2c')],_0x562290[_0xff1d('0x1f')],_0x562290[_0xff1d('0xc')][_0xff1d('0x2c')],_0x562290[_0xff1d('0x28')]['id'],![],_0x1951c7,_0x58cb9b['id']);if(rpc[_0x562290[_0xff1d('0x26')]+'QueueReport']){return rpc[_0x562290['channel']+_0xff1d('0x2d')][_0xff1d('0x31')](_0x3ee63c,_0x1f8ac2)[_0xff1d('0x32')](function(_0x3ffdcf){logger[_0xff1d('0x33')](_0xff1d('0x34'));});}}}function endRouting(_0x3081f4,_0x4af443,_0xf43f1e,_0x3d04b7){if(_0x3081f4&&_0x4af443){_0x4af443[_0xff1d('0x1e')]-=0x1;var _0x36c0bd={'leaveAt':moment()[_0xff1d('0x12')](_0xff1d('0x21')),'exitAt':moment()[_0xff1d('0x12')](_0xff1d('0x21')),'reason':_0xff1d('0x35')};logger[_0xff1d('0x2a')](util['format'](_0xff1d('0x36'),_0x3081f4,_0x4af443[_0xff1d('0x2c')]));emitChannelQueueInteraction(_0xf43f1e[_0xff1d('0x26')],_0x4af443[_0xff1d('0x2c')],_0xf43f1e['body'],_0xf43f1e[_0xff1d('0xc')]['name'],_0xf43f1e[_0xff1d('0x28')]['id'],![],_0x3d04b7);if(rpc[_0xf43f1e[_0xff1d('0x26')]+_0xff1d('0x2d')]){return rpc[_0xf43f1e['channel']+_0xff1d('0x2d')][_0xff1d('0x31')](_0x3081f4,_0x36c0bd)[_0xff1d('0x32')](function(_0x128c05){logger['error'](_0xff1d('0x34'));});}}}function handleFindQueue(_0x44a383){return function(_0x3f485c){return _0x3f485c['name']['toLowerCase']()===_0x44a383[_0xff1d('0x37')]();};}exports[_0xff1d('0x38')]=function(_0xda9b22,_0x832bfa,_0x5d5db4,_0x5a812c){return function(_0x33c73b){try{var _0x491ff5={'name':_0x832bfa[0x0],'timeout':_0x832bfa[0x1]};var _0x3ddb17=queue[_0xff1d('0x39')](_0x491ff5,{'typecast':!![]});if(_0x3ddb17['length']){logger['error'](_0xff1d('0x3a'),_0xda9b22,_['map'](_0x3ddb17,_0xff1d('0x28'))[_0xff1d('0x3b')](',\x20'));_0x33c73b[_0xff1d('0x3c')]();}else{var _0x26824c=_[_0xff1d('0x3d')](_0x5d5db4[_0x5a812c[_0xff1d('0x26')]+_0xff1d('0x3e')],handleFindQueue(_0x491ff5['name']));if(_0x26824c){startRouting(_0xda9b22,_0x26824c,_0x5a812c,_0x5d5db4);var _0x5abea7=(_0x26824c[_0xff1d('0x35')]||0xa)*0x3e8;var _0xdae628=(_0x491ff5[_0xff1d('0x35')]||0x14)*0x3e8;var _0x23edc3;if(_0x5abea7>_0xdae628){_0xdae628=_0x5abea7;}var _0x1962fb=seqqueue[_0xff1d('0x3f')](_0x5abea7);_0x1962fb['id']=_0xda9b22;_0x1962fb[_0xff1d('0x40')]=_0x5abea7;_0x1962fb['qtimeout']=_0xdae628;_0x1962fb['channel']=_0x5a812c['channel'];_0x5d5db4[_0xff1d('0x41')][_0xda9b22]['on'](_0xff1d('0x42'),function(){logger['info'](_0xff1d('0x43'),_0xda9b22);stopRouting(_0xda9b22,_0x26824c,_0x5a812c,_0x5d5db4);clearTimeout(_0x23edc3);_0x23edc3=undefined;_0x1962fb['close'](!![]);if(_0x5d5db4[_0xff1d('0x41')][_0xda9b22]){delete _0x5d5db4[_0xff1d('0x41')][_0xda9b22];}_0x33c73b[_0xff1d('0x3c')]();});_0x5d5db4[_0xff1d('0x41')][_0xda9b22]['on']('complete',function(){if(_0x5d5db4[_0xff1d('0x41')][_0xda9b22]){delete _0x5d5db4[_0xff1d('0x41')][_0xda9b22];}});_0x23edc3=setTimeout(function(){logger[_0xff1d('0x2a')](_0xff1d('0x44'),_0xda9b22);endRouting(_0xda9b22,_0x26824c,_0x5a812c,_0x5d5db4);clearTimeout(_0x23edc3);_0x1962fb[_0xff1d('0x45')](!![]);_0x33c73b[_0xff1d('0x46')]();},_0xdae628);switch(_0x26824c[_0xff1d('0x47')]){case'rrmemory':strategy[_0xff1d('0x48')](_0x1962fb,_0x26824c,_0x5d5db4,_0x5a812c);break;default:strategy[_0xff1d('0x49')](_0x1962fb,_0x26824c,_0x5d5db4,_0x5a812c);}}else{logger[_0xff1d('0x33')](_0xff1d('0x4a'),_0xda9b22,_0x491ff5[_0xff1d('0x2c')]);_0x33c73b[_0xff1d('0x3c')]();}}}catch(_0x22e19e){console[_0xff1d('0x4b')](_0x22e19e);logger[_0xff1d('0x33')](_0xff1d('0x3a'),_0xda9b22,_0x22e19e[_0xff1d('0x4c')]);_0x33c73b[_0xff1d('0x3c')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 9d13405..99d69c1 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 _0x7217=['[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification','showNotification','writeLog','RINGING'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x7217,0x19e));var _0x7721=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x7217[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0x7721('0x0'));var uuid=require('uuid');var util=require(_0x7721('0x1'));var logger=require(_0x7721('0x2'))(_0x7721('0x3'));var Agent=function(_0x2a78d8,_0x115ab3,_0x4d6446,_0x5bf160){this[_0x7721('0x4')]=uuid['v4']();this[_0x7721('0x5')]=_0x2a78d8;this[_0x7721('0x6')]=_0x115ab3;this[_0x7721('0x7')]=_0x4d6446;this[_0x7721('0x3')]=_0x5bf160;this[_0x7721('0x5')][_0x7721('0x8')](this[_0x7721('0x9')][_0x7721('0xa')](this),this[_0x7721('0xb')][_0x7721('0xa')](this));this[_0x7721('0x5')]['on'](_0x7721('0xc'),this[_0x7721('0xb')][_0x7721('0xa')](this));this['squeue']['on'](_0x7721('0xd'),this[_0x7721('0xe')][_0x7721('0xa')](this));};Agent[_0x7721('0xf')][_0x7721('0x8')]=function(){this[_0x7721('0x5')][_0x7721('0x8')](this[_0x7721('0x9')]['bind'](this),this[_0x7721('0xb')][_0x7721('0xa')](this));};Agent['prototype'][_0x7721('0xe')]=function(){this[_0x7721('0xb')](!![]);};Agent[_0x7721('0xf')][_0x7721('0x9')]=function(){logger['debug'](_0x7721('0x10'),this[_0x7721('0x5')]['id'],this['agent']['id']);if(_['isNil'](this['realtime'][_0x7721('0x11')][this[_0x7721('0x6')]['id']])){logger[_0x7721('0x12')](_0x7721('0x13'),this['squeue']['id'],this[_0x7721('0x6')]['id']);setTimeout(this['push'][_0x7721('0xa')](this),0x3e8);}else{if(this['routing'][_0x7721('0x14')]||util[_0x7721('0x15')](this[_0x7721('0x5')]['id'],this[_0x7721('0x7')][_0x7721('0x11')][this[_0x7721('0x6')]['id']],this[_0x7721('0x5')][_0x7721('0x16')],![])){this[_0x7721('0x7')][_0x7721('0x11')][this['agent']['id']][_0x7721('0x17')]=!![];this[_0x7721('0x7')][_0x7721('0x11')][this[_0x7721('0x6')]['id']]['busyQueue']=undefined;util[_0x7721('0x18')](this['realtime'],this[_0x7721('0x3')],this[_0x7721('0x6')],this[_0x7721('0x5')][_0x7721('0x16')]);util[_0x7721('0x19')](this[_0x7721('0x4')],this[_0x7721('0x5')]['id'],this['realtime'][_0x7721('0x11')][this[_0x7721('0x6')]['id']],null,this[_0x7721('0x3')]);util[_0x7721('0x1a')](this[_0x7721('0x5')]['id'],this[_0x7721('0x7')][_0x7721('0x11')][this[_0x7721('0x6')]['id']],_0x7721('0x1b')+(this['routing'][_0x7721('0x14')]?':FORCED':''));}else{logger['debug'](_0x7721('0x1c'),this[_0x7721('0x5')]['id'],this[_0x7721('0x6')]['id']);setTimeout(this[_0x7721('0x8')][_0x7721('0xa')](this),0x3e8);}}};Agent[_0x7721('0xf')][_0x7721('0xb')]=function(_0x1da2d8){if(_['isNil'](this[_0x7721('0x7')][_0x7721('0x11')][this['agent']['id']])){return logger['debug'](_0x7721('0x13'),this[_0x7721('0x5')]['id'],this['agent']['id']);}else{logger[_0x7721('0x12')](_0x7721('0x1d'),this[_0x7721('0x5')]['id'],this['agent']['id']);util[_0x7721('0x1e')](this[_0x7721('0x4')],this[_0x7721('0x5')]['id'],this[_0x7721('0x7')][_0x7721('0x11')][this['agent']['id']],null,this[_0x7721('0x3')]);this[_0x7721('0x7')][_0x7721('0x11')][this['agent']['id']][_0x7721('0x17')]=![];this[_0x7721('0x7')]['agents'][this[_0x7721('0x6')]['id']]['busyQueue']=undefined;util[_0x7721('0x1f')](this[_0x7721('0x7')],this[_0x7721('0x3')],this[_0x7721('0x6')],this[_0x7721('0x5')][_0x7721('0x16')]);util[_0x7721('0x1a')](this[_0x7721('0x5')]['id'],this[_0x7721('0x7')][_0x7721('0x11')][this[_0x7721('0x6')]['id']],_0x1da2d8?'STOP':_0x7721('0x20'));}if(!_0x1da2d8){setTimeout(this['push'][_0x7721('0xa')](this),0x3e8);}};function agent(_0x35614c,_0x7942f7,_0x1d03de,_0x3968f3){return new Agent(_0x35614c,_0x7942f7,_0x1d03de,_0x3968f3);}module[_0x7721('0x21')]=agent; \ No newline at end of file +var _0x303a=['[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','busyQueue','writeLog','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','bind','handleTimeout','handleDrained','prototype','handleRun','debug','[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','busy','saveWaitingNotification','showNotification','RINGING','forcedOwnership',':FORCED'];(function(_0x13f2d2,_0x319d75){var _0x582c5a=function(_0x13830f){while(--_0x13830f){_0x13f2d2['push'](_0x13f2d2['shift']());}};_0x582c5a(++_0x319d75);}(_0x303a,0x1a0));var _0xa303=function(_0x3b3933,_0x4a5bd2){_0x3b3933=_0x3b3933-0x0;var _0x41d2c4=_0x303a[_0x3b3933];return _0x41d2c4;};'use strict';var _=require(_0xa303('0x0'));var uuid=require('uuid');var util=require(_0xa303('0x1'));var logger=require(_0xa303('0x2'))(_0xa303('0x3'));var Agent=function(_0x19d27a,_0x594b49,_0x46c56b,_0x26b47c){this[_0xa303('0x4')]=uuid['v4']();this[_0xa303('0x5')]=_0x19d27a;this[_0xa303('0x6')]=_0x594b49;this[_0xa303('0x7')]=_0x46c56b;this[_0xa303('0x3')]=_0x26b47c;this[_0xa303('0x5')][_0xa303('0x8')](this['handleRun']['bind'](this),this['handleTimeout'][_0xa303('0x9')](this));this[_0xa303('0x5')]['on']('timeout',this[_0xa303('0xa')]['bind'](this));this[_0xa303('0x5')]['on']('drained',this[_0xa303('0xb')][_0xa303('0x9')](this));};Agent[_0xa303('0xc')][_0xa303('0x8')]=function(){this['squeue'][_0xa303('0x8')](this['handleRun'][_0xa303('0x9')](this),this[_0xa303('0xa')][_0xa303('0x9')](this));};Agent['prototype'][_0xa303('0xb')]=function(){this[_0xa303('0xa')](!![]);};Agent[_0xa303('0xc')][_0xa303('0xd')]=function(){logger[_0xa303('0xe')](_0xa303('0xf'),this[_0xa303('0x5')]['id'],this[_0xa303('0x6')]['id']);if(_['isNil'](this[_0xa303('0x7')][_0xa303('0x10')][this[_0xa303('0x6')]['id']])){logger[_0xa303('0xe')](_0xa303('0x11'),this[_0xa303('0x5')]['id'],this['agent']['id']);setTimeout(this[_0xa303('0x8')]['bind'](this),0x3e8);}else{if(this[_0xa303('0x3')]['forcedOwnership']||util[_0xa303('0x12')](this['squeue']['id'],this[_0xa303('0x7')][_0xa303('0x10')][this[_0xa303('0x6')]['id']],this['squeue'][_0xa303('0x13')],![])){this[_0xa303('0x7')][_0xa303('0x10')][this['agent']['id']][_0xa303('0x14')]=!![];this[_0xa303('0x7')][_0xa303('0x10')][this[_0xa303('0x6')]['id']]['busyQueue']=undefined;util[_0xa303('0x15')](this[_0xa303('0x7')],this['routing'],this[_0xa303('0x6')],this[_0xa303('0x5')][_0xa303('0x13')]);util[_0xa303('0x16')](this[_0xa303('0x4')],this[_0xa303('0x5')]['id'],this[_0xa303('0x7')][_0xa303('0x10')][this[_0xa303('0x6')]['id']],null,this['routing']);util['writeLog'](this['squeue']['id'],this['realtime']['agents'][this[_0xa303('0x6')]['id']],_0xa303('0x17')+(this[_0xa303('0x3')][_0xa303('0x18')]?_0xa303('0x19'):''));}else{logger['debug'](_0xa303('0x1a'),this[_0xa303('0x5')]['id'],this['agent']['id']);setTimeout(this[_0xa303('0x8')][_0xa303('0x9')](this),0x3e8);}}};Agent[_0xa303('0xc')][_0xa303('0xa')]=function(_0x3c85de){if(_[_0xa303('0x1b')](this[_0xa303('0x7')][_0xa303('0x10')][this[_0xa303('0x6')]['id']])){return logger[_0xa303('0xe')](_0xa303('0x11'),this[_0xa303('0x5')]['id'],this[_0xa303('0x6')]['id']);}else{logger[_0xa303('0xe')](_0xa303('0x1c'),this[_0xa303('0x5')]['id'],this[_0xa303('0x6')]['id']);util['hideNotification'](this['notificationId'],this[_0xa303('0x5')]['id'],this[_0xa303('0x7')][_0xa303('0x10')][this[_0xa303('0x6')]['id']],null,this['routing']);this[_0xa303('0x7')][_0xa303('0x10')][this[_0xa303('0x6')]['id']][_0xa303('0x14')]=![];this['realtime'][_0xa303('0x10')][this[_0xa303('0x6')]['id']][_0xa303('0x1d')]=undefined;util['removeWaitingNotification'](this[_0xa303('0x7')],this[_0xa303('0x3')],this[_0xa303('0x6')],this['squeue'][_0xa303('0x13')]);util[_0xa303('0x1e')](this[_0xa303('0x5')]['id'],this['realtime'][_0xa303('0x10')][this[_0xa303('0x6')]['id']],_0x3c85de?_0xa303('0x1f'):_0xa303('0x20'));}if(!_0x3c85de){setTimeout(this['push'][_0xa303('0x9')](this),0x3e8);}};function agent(_0x23c318,_0x107cdc,_0x26ffab,_0x4ee0d5){return new Agent(_0x23c318,_0x107cdc,_0x26ffab,_0x4ee0d5);}module[_0xa303('0x21')]=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 1c1b7b5..4255706 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 _0x2335=['handleRun','bind','timeout','drained','handleDrained','prototype','handleTimeout','Agents','length','isNil','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','RINGING','busy','busyQueue','name','showNotification','routing','debug','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','push','hideNotification','writeLog','lodash','uuid','../../../../../config/logger','notificationId','queue','realtime','squeue'];(function(_0x47e94b,_0x21ae8f){var _0x380f2f=function(_0x2c7b8b){while(--_0x2c7b8b){_0x47e94b['push'](_0x47e94b['shift']());}};_0x380f2f(++_0x21ae8f);}(_0x2335,0x199));var _0x5233=function(_0x15b72d,_0x3b5fac){_0x15b72d=_0x15b72d-0x0;var _0x3310ba=_0x2335[_0x15b72d];return _0x3310ba;};'use strict';var _=require(_0x5233('0x0'));var uuid=require(_0x5233('0x1'));var util=require('./util');var logger=require(_0x5233('0x2'))('routing');var Beepall=function(_0x3dcc01,_0x477a15,_0x46bd78,_0x35a663){this[_0x5233('0x3')]=uuid['v4']();this['squeue']=_0x3dcc01;this[_0x5233('0x4')]=_0x477a15;this[_0x5233('0x5')]=_0x46bd78;this['routing']=_0x35a663;this[_0x5233('0x6')]['push'](this[_0x5233('0x7')][_0x5233('0x8')](this),this['handleTimeout']['bind'](this));this[_0x5233('0x6')]['on'](_0x5233('0x9'),this['handleTimeout'][_0x5233('0x8')](this));this[_0x5233('0x6')]['on'](_0x5233('0xa'),this[_0x5233('0xb')][_0x5233('0x8')](this));};Beepall[_0x5233('0xc')]['push']=function(){this[_0x5233('0x6')]['push'](this[_0x5233('0x7')][_0x5233('0x8')](this),this['handleTimeout'][_0x5233('0x8')](this));};Beepall[_0x5233('0xc')][_0x5233('0xb')]=function(){this[_0x5233('0xd')](!![]);};Beepall[_0x5233('0xc')][_0x5233('0x7')]=function(){var _0x2903cc=!![];if(!_['isNil'](this[_0x5233('0x4')])&&!_['isNil'](this[_0x5233('0x4')][_0x5233('0xe')])&&this[_0x5233('0x4')][_0x5233('0xe')][_0x5233('0xf')]>0x0){for(var _0x57bef8=0x0,_0x5aba6d;_0x57bef80x0){for(var _0xfe3f9e=0x0,_0x43b414;_0xfe3f9e0x0&&_0x3a4d19[_0x267667+_0x11ee('0x23')]>=_0x3a4d19[_0x267667+'Capacity']){writeLog(_0x4d57cf,_0x3a4d19,_0x267667[_0x11ee('0x24')]()+_0x11ee('0x25'));return![];}}return!![];};exports[_0x11ee('0x26')]=function(_0x17bd07,_0x1b84aa,_0x3d3e8b,_0x2fa95a,_0xe57f83){return sendNotification(!![],_0x17bd07,_0x1b84aa,_0x3d3e8b,_0x2fa95a,_0xe57f83);};exports['hideNotification']=function(_0x2367a4,_0x357031,_0x1fc255,_0x48423e,_0x178a5b){return sendNotification(![],_0x2367a4,_0x357031,_0x1fc255,_0x48423e,_0x178a5b);};exports[_0x11ee('0x27')]=function(_0x2dd4fe,_0x497ddd,_0x1a3bb3){var _0x58daa0=_0x497ddd[_0x11ee('0x28')]['UserId'];if(!_0x58daa0&&_0x1a3bb3){_0x58daa0=_0x1a3bb3['id'];}var _0x164019=_[_0x11ee('0x29')](_0x2dd4fe[_0x497ddd['channel']+_0x11ee('0x2a')],function(_0x2de659){var _0x2c2698=_[_0x11ee('0x2b')](_0x497ddd[_0x11ee('0x2c')])+_0x11ee('0x2d');return _0x2de659[_0x2c2698]===_0x497ddd['interaction']['id'];});if(!_0x164019&&_0x58daa0){_0x164019=_[_0x11ee('0x29')](_0x2dd4fe[_0x11ee('0x2e')][_0x58daa0][_0x497ddd[_0x11ee('0x2c')]+_0x11ee('0x2f')],function(_0x371951){return _0x371951['id']===_0x497ddd[_0x11ee('0x28')]['id'];});}return _0x164019;};exports[_0x11ee('0x30')]=function(_0x4da4ba,_0x42debc,_0x386390,_0x244c52){_0x4da4ba[_0x11ee('0x2e')][_0x386390['id']][_0x244c52+_0x11ee('0x2f')][_0x42debc[_0x11ee('0x19')]['id']]={'id':_0x42debc[_0x11ee('0x28')]['id']};};exports[_0x11ee('0x31')]=function(_0x111038,_0x3a5335,_0x310486,_0x2edf05){delete _0x111038[_0x11ee('0x2e')][_0x310486['id']][_0x2edf05+_0x11ee('0x2f')][_0x3a5335[_0x11ee('0x19')]['id']];};exports[_0x11ee('0x32')]=writeLog; \ No newline at end of file +var _0x08b2=['redis','defaults','localhost','format','user:%s','name','emit','user:save','split','\x20interaction','account','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','message','notification:%s','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','online','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','hideNotification','checkWaitingNotifications','interaction','UserId','some','channel','capitalize','InteractionId','WaitingInteractions','removeWaitingNotification','agents','util','../utils','ioredis','../../../../../config/environment','routing'];(function(_0x29790d,_0x3efd42){var _0x3e2e13=function(_0x3852f2){while(--_0x3852f2){_0x29790d['push'](_0x29790d['shift']());}};_0x3e2e13(++_0x3efd42);}(_0x08b2,0xbf));var _0x208b=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x08b2[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x208b('0x0'));var utils=require(_0x208b('0x1'));var Redis=require(_0x208b('0x2'));var config=require(_0x208b('0x3'));var logger=require('../../../../../config/logger')(_0x208b('0x4'));config[_0x208b('0x5')]=_[_0x208b('0x6')](config[_0x208b('0x5')],{'host':_0x208b('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x208b('0x5')]));function sendNotification(_0x1dd359,_0x5e4e8e,_0x2c8b9e,_0x3d3c07,_0x223f3e,_0x2cc43f){io['to'](util[_0x208b('0x8')](_0x208b('0x9'),_0x3d3c07[_0x208b('0xa')]))[_0x208b('0xb')](_0x208b('0xc'),_0x3d3c07);var _0x1fe45c=_0x2cc43f||{};var _0x327768=_0x2c8b9e[_0x208b('0xd')]('.');var _0x4fae56={'uniqueid':_0x5e4e8e,'channel':_0x327768[0x0],'id':_0x327768[0x1],'title':_0x327768[0x0]+_0x208b('0xe'),'interactionId':_0x327768[0x2],'queue':_0x223f3e?_0x223f3e[_0x208b('0xa')]:null,'sound':_0x1fe45c[_0x208b('0xf')]['notificationSound'],'shake':_0x1fe45c[_0x208b('0xf')][_0x208b('0x10')]};try{if(!_0x1fe45c[_0x208b('0x11')]){_0x1fe45c[_0x208b('0x11')]={};}if(_0x223f3e){_0x1fe45c['body'][_0x208b('0x12')]=_0x223f3e;}else if(_0x1fe45c[_0x208b('0x11')][_0x208b('0x12')]){delete _0x1fe45c['body']['queue'];}_0x4fae56[_0x208b('0x13')]=utils[_0x208b('0x14')](_0x1fe45c['account'][_0x208b('0x15')],_0x1fe45c);}catch(_0x42769a){_0x4fae56[_0x208b('0x13')]=_0x208b('0x16');logger['error'](util['format'](_0x208b('0x17'),_0x5e4e8e,_0x42769a[_0x208b('0x18')]));}io['to'](util['format'](_0x208b('0x9'),_0x3d3c07[_0x208b('0xa')]))[_0x208b('0xb')](util[_0x208b('0x8')](_0x208b('0x19'),_0x1dd359?'save':_0x208b('0x1a')),_0x4fae56);}function writeLog(_0x1ff749,_0xedf2e,_0x178295){return logger[_0x208b('0x1b')](util[_0x208b('0x8')](_0x208b('0x1c'),_0x1ff749,_0xedf2e[_0x208b('0xa')],_0x178295));}exports['isAgentAvailable']=function(_0x551c0f,_0x36f8ec,_0x33ea31,_0xf49bce){if(_0x36f8ec[_0x208b('0x1d')]){writeLog(_0x551c0f,_0x36f8ec,_0x208b('0x1e'));return![];}if(!_0x36f8ec[_0x208b('0x1f')]){writeLog(_0x551c0f,_0x36f8ec,'OFFLINE');return![];}if(_0x36f8ec[_0x33ea31+_0x208b('0x20')]){writeLog(_0x551c0f,_0x36f8ec,_0x208b('0x21'));return![];}if(_0xf49bce&&_0x36f8ec[_0x208b('0x22')](_0x33ea31+'Capacity')&&_0x36f8ec[_0x208b('0x22')](_0x33ea31+_0x208b('0x23'))){if(_0x36f8ec[_0x33ea31+_0x208b('0x24')]>0x0&&_0x36f8ec[_0x33ea31+_0x208b('0x23')]>=_0x36f8ec[_0x33ea31+'Capacity']){writeLog(_0x551c0f,_0x36f8ec,_0x33ea31[_0x208b('0x25')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0x2eb807,_0x2b4942,_0x9d83f9,_0x517e6b,_0x211c82){return sendNotification(!![],_0x2eb807,_0x2b4942,_0x9d83f9,_0x517e6b,_0x211c82);};exports[_0x208b('0x26')]=function(_0x3e5844,_0x3bb559,_0x309808,_0x2b0a78,_0x3b467f){return sendNotification(![],_0x3e5844,_0x3bb559,_0x309808,_0x2b0a78,_0x3b467f);};exports[_0x208b('0x27')]=function(_0x473197,_0x19da45,_0x3fc08a){var _0x2f4b72=_0x19da45[_0x208b('0x28')][_0x208b('0x29')];if(!_0x2f4b72&&_0x3fc08a){_0x2f4b72=_0x3fc08a['id'];}var _0x1d1430=_[_0x208b('0x2a')](_0x473197[_0x19da45[_0x208b('0x2b')]+'QueuesWaitingInteractions'],function(_0x41a231){var _0x5e32f5=_[_0x208b('0x2c')](_0x19da45[_0x208b('0x2b')])+_0x208b('0x2d');return _0x41a231[_0x5e32f5]===_0x19da45[_0x208b('0x28')]['id'];});if(!_0x1d1430&&_0x2f4b72){_0x1d1430=_[_0x208b('0x2a')](_0x473197['agents'][_0x2f4b72][_0x19da45[_0x208b('0x2b')]+_0x208b('0x2e')],function(_0x8ae20b){return _0x8ae20b['id']===_0x19da45['interaction']['id'];});}return _0x1d1430;};exports['saveWaitingNotification']=function(_0x2ddec3,_0x2367ee,_0x418afe,_0xecab2){_0x2ddec3['agents'][_0x418afe['id']][_0xecab2+'WaitingInteractions'][_0x2367ee[_0x208b('0x18')]['id']]={'id':_0x2367ee[_0x208b('0x28')]['id']};};exports[_0x208b('0x2f')]=function(_0x1463e8,_0x12af45,_0x21e6ed,_0x5ad6ab){delete _0x1463e8[_0x208b('0x30')][_0x21e6ed['id']][_0x5ad6ab+_0x208b('0x2e')][_0x12af45[_0x208b('0x18')]['id']];};exports['writeLog']=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 ff84cc2..d030754 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 _0x7764=['trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7764,0xa4));var _0x4776=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x7764[_0x1eda20];return _0x31b953;};'use strict';var schema=require(_0x4776('0x0'));var sh=require(_0x4776('0x1'));var _=require(_0x4776('0x2'));var utils=require(_0x4776('0x3'));var logger=require(_0x4776('0x4'))(_0x4776('0x5'));var system=schema({'command':{'type':_0x4776('0x6'),'required':!![],'message':_0x4776('0x7')}});exports[_0x4776('0x8')]=function(_0x1f5638,_0x5ab4c2){return function(_0x5a1e38){try{var _0xc431bf={'command':_0x5ab4c2[0x0]};var _0x3eff9c=system['validate'](_0xc431bf,{'typecast':!![]});if(_0x3eff9c[_0x4776('0x9')]){logger[_0x4776('0xa')]('[%s][SYSTEM]\x20%s',_0x1f5638,_['map'](_0x3eff9c,_0x4776('0xb'))['join'](',\x20'));logger[_0x4776('0xc')](_0x4776('0xd'),_0x1f5638);_0x5a1e38[_0x4776('0xe')]();}else{var _0x3baf2f=this;var _0x48c30c=utils[_0x4776('0xf')](_0x5ab4c2[0x0],this);logger[_0x4776('0xc')](_0x4776('0x10'),_0x1f5638,_0x48c30c);sh[_0x4776('0x11')](_[_0x4776('0x12')](_0x48c30c),function(_0x301eb5,_0x32df9d){logger[_0x4776('0xc')](_0x4776('0x13'),_0x1f5638,_0x301eb5);if(_0x301eb5==0x0){var _0x399e40=_0x32df9d[_0x4776('0x14')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x5ab4c2[0x1])||_['isEmpty'](_0x5ab4c2[0x1])){logger[_0x4776('0xc')](_0x4776('0x15'),_0x1f5638);_0x3baf2f[_0x4776('0x16')][_0x5ab4c2[0x1]]=_0x399e40;}else{logger[_0x4776('0xc')](_0x4776('0x17'),_0x1f5638,_0x5ab4c2[0x1],_0x399e40);_0x3baf2f[_0x4776('0x16')][_0x5ab4c2[0x1]]=_0x399e40;}}_0x5a1e38[_0x4776('0xe')]();});}}catch(_0x1389ed){logger[_0x4776('0xa')](_0x4776('0x18'),_0x1f5638,_['isObject'](_0x1389ed)?JSON[_0x4776('0x19')](_0x1389ed):_0x1389ed);logger['info'](_0x4776('0xd'),_0x1f5638);_0x5a1e38[_0x4776('0xe')]();}};}; \ No newline at end of file +var _0x2962=['consequence','length','error','map','message','join','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','./utils','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x42435c,_0x4ae6e2){var _0x154366=function(_0x44fe39){while(--_0x44fe39){_0x42435c['push'](_0x42435c['shift']());}};_0x154366(++_0x4ae6e2);}(_0x2962,0xca));var _0x2296=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x2962[_0x42cae2];return _0x5f256f;};'use strict';var schema=require(_0x2296('0x0'));var sh=require(_0x2296('0x1'));var _=require(_0x2296('0x2'));var utils=require(_0x2296('0x3'));var logger=require('../../../../config/logger')(_0x2296('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0x2296('0x5')}});exports[_0x2296('0x6')]=function(_0x258024,_0x4591c4){return function(_0x20dbe6){try{var _0x54454d={'command':_0x4591c4[0x0]};var _0x33bbaf=system[_0x2296('0x0')](_0x54454d,{'typecast':!![]});if(_0x33bbaf[_0x2296('0x7')]){logger[_0x2296('0x8')]('[%s][SYSTEM]\x20%s',_0x258024,_[_0x2296('0x9')](_0x33bbaf,_0x2296('0xa'))[_0x2296('0xb')](',\x20'));logger[_0x2296('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x258024);_0x20dbe6['next']();}else{var _0x20461c=this;var _0x1364c1=utils['getMustacheRender'](_0x4591c4[0x0],this);logger[_0x2296('0xc')](_0x2296('0xd'),_0x258024,_0x1364c1);sh[_0x2296('0xe')](_[_0x2296('0xf')](_0x1364c1),function(_0x2d3cbb,_0x35e096){logger[_0x2296('0xc')](_0x2296('0x10'),_0x258024,_0x2d3cbb);if(_0x2d3cbb==0x0){var _0x159809=_0x35e096[_0x2296('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x2296('0x12')](_0x4591c4[0x1])||_[_0x2296('0x13')](_0x4591c4[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x258024);_0x20461c[_0x2296('0x14')][_0x4591c4[0x1]]=_0x159809;}else{logger[_0x2296('0xc')](_0x2296('0x15'),_0x258024,_0x4591c4[0x1],_0x159809);_0x20461c[_0x2296('0x14')][_0x4591c4[0x1]]=_0x159809;}}_0x20dbe6[_0x2296('0x16')]();});}}catch(_0x1422fb){logger[_0x2296('0x8')]('[%s][SYSTEM]\x20%s',_0x258024,_[_0x2296('0x17')](_0x1422fb)?JSON[_0x2296('0x18')](_0x1422fb):_0x1422fb);logger[_0x2296('0xc')](_0x2296('0x19'),_0x258024);_0x20dbe6[_0x2296('0x16')]();}};}; \ 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 61ce72d..a35ec72 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 _0xef98=['then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','error','[%s][TAG]\x20%s','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','addTags','interaction'];(function(_0x15ec35,_0x5b9972){var _0x937cce=function(_0x59326b){while(--_0x59326b){_0x15ec35['push'](_0x15ec35['shift']());}};_0x937cce(++_0x5b9972);}(_0xef98,0xa2));var _0x8ef9=function(_0x413bb0,_0x129f24){_0x413bb0=_0x413bb0-0x0;var _0x54c2f9=_0xef98[_0x413bb0];return _0x54c2f9;};'use strict';var schema=require('validate');var _=require(_0x8ef9('0x0'));var rpc={'chatInteraction':require(_0x8ef9('0x1')),'openchannelInteraction':require(_0x8ef9('0x2')),'smsInteraction':require(_0x8ef9('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x8ef9('0x4')),'whatsappInteraction':require(_0x8ef9('0x5'))};var logger=require(_0x8ef9('0x6'))('routing');var tag=schema({'tag':{'type':_0x8ef9('0x7'),'required':!![],'message':_0x8ef9('0x8')}});exports[_0x8ef9('0x9')]=function(_0xc8ca50,_0x43488d,_0x26b52d,_0x50ef49){return function(_0xe384c6){try{var _0x17eac9={'tag':_0x43488d[0x0]};var _0x8b4021=tag[_0x8ef9('0xa')](_0x17eac9,{'typecast':!![]});if(_0x8b4021['length']){logger[_0x8ef9('0xb')](_0x8ef9('0xc'),_0xc8ca50,_['map'](_0x8b4021,_0x8ef9('0xd'))[_0x8ef9('0xe')](',\x20'));logger['info'](_0x8ef9('0xf'),_0xc8ca50);_0xe384c6[_0x8ef9('0x10')]();}else{var _0x4b4a94={'ids':[_0x43488d[0x0]]};if(rpc[_0x50ef49[_0x8ef9('0x11')]+'Interaction']){rpc[_0x50ef49[_0x8ef9('0x11')]+'Interaction'][_0x8ef9('0x12')](_0x50ef49[_0x8ef9('0x13')]['id'],_0x4b4a94)[_0x8ef9('0x14')](function(_0x40ad91){logger['info'](_0x8ef9('0x15'),_0xc8ca50,_0x43488d[0x1],_0x50ef49[_0x8ef9('0x11')],_0x50ef49[_0x8ef9('0x13')]['id']);})[_0x8ef9('0x16')](function(_0x2debf3){logger[_0x8ef9('0xb')]('[%s][TAG]\x20%s',_0xc8ca50,JSON[_0x8ef9('0x17')](_0x2debf3));logger['info'](_0x8ef9('0xf'),_0xc8ca50);})[_0x8ef9('0x18')](function(){_0xe384c6[_0x8ef9('0x10')]();});}}}catch(_0x3674a2){logger['error'](_0x8ef9('0xc'),_0xc8ca50,_[_0x8ef9('0x19')](_0x3674a2)?JSON['stringify'](_0x3674a2):_0x3674a2);logger['info'](_0x8ef9('0xf'),_0xc8ca50);_0xe384c6[_0x8ef9('0x10')]();}};}; \ No newline at end of file +var _0xf04c=['../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel','addTags','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction'];(function(_0x407d07,_0x515a81){var _0x562ae8=function(_0x1426d0){while(--_0x1426d0){_0x407d07['push'](_0x407d07['shift']());}};_0x562ae8(++_0x515a81);}(_0xf04c,0x67));var _0xcf04=function(_0x14403a,_0x3bf197){_0x14403a=_0x14403a-0x0;var _0x18a74f=_0xf04c[_0x14403a];return _0x18a74f;};'use strict';var schema=require(_0xcf04('0x0'));var _=require(_0xcf04('0x1'));var rpc={'chatInteraction':require(_0xcf04('0x2')),'openchannelInteraction':require(_0xcf04('0x3')),'smsInteraction':require(_0xcf04('0x4')),'mailInteraction':require(_0xcf04('0x5')),'faxInteraction':require(_0xcf04('0x6')),'whatsappInteraction':require(_0xcf04('0x7'))};var logger=require('../../../../config/logger')(_0xcf04('0x8'));var tag=schema({'tag':{'type':_0xcf04('0x9'),'required':!![],'message':_0xcf04('0xa')}});exports[_0xcf04('0xb')]=function(_0x9627d4,_0x8ee4ed,_0x2ed4e6,_0x2af673){return function(_0x39e78e){try{var _0x166e37={'tag':_0x8ee4ed[0x0]};var _0x4ce5c3=tag[_0xcf04('0x0')](_0x166e37,{'typecast':!![]});if(_0x4ce5c3[_0xcf04('0xc')]){logger[_0xcf04('0xd')](_0xcf04('0xe'),_0x9627d4,_[_0xcf04('0xf')](_0x4ce5c3,'message')[_0xcf04('0x10')](',\x20'));logger[_0xcf04('0x11')](_0xcf04('0x12'),_0x9627d4);_0x39e78e[_0xcf04('0x13')]();}else{var _0xe97e8e={'ids':[_0x8ee4ed[0x0]]};if(rpc[_0x2af673['channel']+_0xcf04('0x14')]){rpc[_0x2af673[_0xcf04('0x15')]+_0xcf04('0x14')][_0xcf04('0x16')](_0x2af673['interaction']['id'],_0xe97e8e)['then'](function(_0x3846d8){logger[_0xcf04('0x11')](_0xcf04('0x17'),_0x9627d4,_0x8ee4ed[0x1],_0x2af673['channel'],_0x2af673['interaction']['id']);})[_0xcf04('0x18')](function(_0x110e3e){logger['error']('[%s][TAG]\x20%s',_0x9627d4,JSON['stringify'](_0x110e3e));logger[_0xcf04('0x11')](_0xcf04('0x12'),_0x9627d4);})[_0xcf04('0x19')](function(){_0x39e78e[_0xcf04('0x13')]();});}}}catch(_0x55fa4e){logger['error'](_0xcf04('0xe'),_0x9627d4,_[_0xcf04('0x1a')](_0x55fa4e)?JSON['stringify'](_0x55fa4e):_0x55fa4e);logger['info'](_0xcf04('0x12'),_0x9627d4);_0x39e78e['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 5d3c405..c1ca4e4 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 _0xb99a=['info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','consequence','replace','\x20-\x20','includes','push','urlOnRing','?params=','title','jsonrpc','2.0','method','login','params','stringify','POST','application/json-rpc','then','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId='];(function(_0x12cfa0,_0x4835b5){var _0x35d487=function(_0x1f729b){while(--_0x1f729b){_0x12cfa0['push'](_0x12cfa0['shift']());}};_0x35d487(++_0x4835b5);}(_0xb99a,0x19b));var _0xab99=function(_0x1f24cf,_0x4623c5){_0x1f24cf=_0x1f24cf-0x0;var _0x4e9c95=_0xb99a[_0x1f24cf];return _0x4e9c95;};'use strict';var rp=require('request-promise');var logger=require('../../../../config/logger')('routing');var _=require('lodash');var arr=[];exports[_0xab99('0x0')]=function(_0x5d12dd,_0x33b73f){return function(_0x458e0b){var _0xc79e35=_0x33b73f[0xa];var _0x361746=_0x33b73f[0xb];var _0x1d2008=_0x33b73f[0xc];var _0x487291=_0x33b73f[0xd];var _0x22111d=_0x33b73f[0xe];var _0x10d5fd=_0x33b73f[0xf][_0xab99('0x1')](/\n/g,_0xab99('0x2'));var _0x3c6c44=_0x33b73f[0x10]['replace'](/\n/g,'\x20');if(!arr[_0xab99('0x3')](_0x361746)){arr[_0xab99('0x4')](_0x361746);var _0x175a3e=_0x33b73f[0x3];var _0x119b6a=_0x33b73f[0x4];var _0x1931a5=_0x33b73f[0x1];var _0x1719a8=_0x33b73f[0x0];var _0x121d77={};_0x121d77['urlOnAnswer']=_0x33b73f[0x8]+'?params='+_0x1d2008+'|'+_0xc79e35+'|'+_0x487291+'|'+_0x361746+'|'+_0x22111d;_0x121d77[_0xab99('0x5')]=_0x33b73f[0x7]+_0xab99('0x6')+_0x1d2008+'|'+_0xc79e35+'|'+_0x487291+'|'+_0x361746+'|'+_0x22111d+'|'+_0x10d5fd+'|'+_0x3c6c44;_0x121d77[_0xab99('0x7')]=_0x33b73f[0x9];var _0x42b998={};_0x42b998[_0xab99('0x8')]=_0xab99('0x9');_0x42b998[_0xab99('0xa')]=_0xab99('0xb');var _0x2e212f=[];_0x2e212f[_0xab99('0x4')](_0x33b73f[0x2]);_0x2e212f['push'](_0x33b73f[0x5]);_0x2e212f[_0xab99('0x4')](_0x33b73f[0x6]);_0x42b998[_0xab99('0xc')]=_0x2e212f;_0x42b998['id']=0x1;var _0x3d17f=JSON[_0xab99('0xd')](_0x42b998);var _0x279238={'encoding':'utf8','method':_0xab99('0xe'),'timeout':0x2710,'url':_0x175a3e,'headers':{'Content-Type':_0xab99('0xf')},'body':_0x3d17f};return rp(_0x279238)[_0xab99('0x10')](function(_0x35c0f3){const _0x10bd04=JSON[_0xab99('0x11')](_0x35c0f3);if(!_0x10bd04['result'][_0xab99('0x12')]){throw new Error(_0xab99('0x13'));}var _0x347f29=_0x361746;var _0x5d3fc2=_0xab99('0x14')+_0x1931a5+_0xab99('0x15')+_0x1719a8+_0xab99('0x16')+_0x347f29+'&data='+JSON[_0xab99('0xd')](_0x121d77);var _0x24ca30=_0x119b6a+'?'+_0x5d3fc2;return rp(_0x24ca30);})[_0xab99('0x10')](function(_0x4e6353){logger[_0xab99('0x17')](_0xab99('0x18'),_0x5d12dd,_0x4e6353);_0x458e0b[_0xab99('0x19')]();})[_0xab99('0x1a')](function(_0x56d910){logger[_0xab99('0x1b')](_0xab99('0x1c'),_0x5d12dd,_[_0xab99('0x1d')](_0x56d910)?JSON[_0xab99('0xd')](_0x56d910):_0x56d910);_0x458e0b[_0xab99('0x19')]();});}else{logger[_0xab99('0x17')](_0xab99('0x1e'),_0x5d12dd);_0x458e0b['next']();}};}; \ No newline at end of file +var _0xb061=['method','params','stringify','utf8','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&data=','info','error','[%s][TVOX]\x20%s','isObject','stop','next','request-promise','../../../../config/logger','routing','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0'];(function(_0x4f9228,_0x1e0250){var _0x11c8cb=function(_0x505b4a){while(--_0x505b4a){_0x4f9228['push'](_0x4f9228['shift']());}};_0x11c8cb(++_0x1e0250);}(_0xb061,0xcb));var _0x1b06=function(_0x6ff984,_0x52fbd1){_0x6ff984=_0x6ff984-0x0;var _0x1b8400=_0xb061[_0x6ff984];return _0x1b8400;};'use strict';var rp=require(_0x1b06('0x0'));var logger=require(_0x1b06('0x1'))(_0x1b06('0x2'));var _=require('lodash');var arr=[];exports[_0x1b06('0x3')]=function(_0x5773f8,_0x5a7e7d){return function(_0x53aa1e){var _0x41cf7a=_0x5a7e7d[0xa];var _0x4fc697=_0x5a7e7d[0xb];var _0x2efb31=_0x5a7e7d[0xc];var _0x274b8b=_0x5a7e7d[0xd];var _0x1e06d9=_0x5a7e7d[0xe];var _0x502d34=_0x5a7e7d[0xf][_0x1b06('0x4')](/\n/g,_0x1b06('0x5'));var _0xe1396f=_0x5a7e7d[0x10][_0x1b06('0x4')](/\n/g,'\x20');if(!arr[_0x1b06('0x6')](_0x4fc697)){arr[_0x1b06('0x7')](_0x4fc697);var _0x326913=_0x5a7e7d[0x3];var _0x205e35=_0x5a7e7d[0x4];var _0xec2a55=_0x5a7e7d[0x1];var _0x5ac0b7=_0x5a7e7d[0x0];var _0x5bc1ae={};_0x5bc1ae[_0x1b06('0x8')]=_0x5a7e7d[0x8]+_0x1b06('0x9')+_0x2efb31+'|'+_0x41cf7a+'|'+_0x274b8b+'|'+_0x4fc697+'|'+_0x1e06d9;_0x5bc1ae[_0x1b06('0xa')]=_0x5a7e7d[0x7]+_0x1b06('0x9')+_0x2efb31+'|'+_0x41cf7a+'|'+_0x274b8b+'|'+_0x4fc697+'|'+_0x1e06d9+'|'+_0x502d34+'|'+_0xe1396f;_0x5bc1ae[_0x1b06('0xb')]=_0x5a7e7d[0x9];var _0xa6787f={};_0xa6787f[_0x1b06('0xc')]=_0x1b06('0xd');_0xa6787f[_0x1b06('0xe')]='login';var _0x267904=[];_0x267904[_0x1b06('0x7')](_0x5a7e7d[0x2]);_0x267904[_0x1b06('0x7')](_0x5a7e7d[0x5]);_0x267904[_0x1b06('0x7')](_0x5a7e7d[0x6]);_0xa6787f[_0x1b06('0xf')]=_0x267904;_0xa6787f['id']=0x1;var _0x315760=JSON[_0x1b06('0x10')](_0xa6787f);var _0x295580={'encoding':_0x1b06('0x11'),'method':'POST','timeout':0x2710,'url':_0x326913,'headers':{'Content-Type':'application/json-rpc'},'body':_0x315760};return rp(_0x295580)[_0x1b06('0x12')](function(_0xd8f8c7){const _0x5629fd=JSON[_0x1b06('0x13')](_0xd8f8c7);if(!_0x5629fd[_0x1b06('0x14')][_0x1b06('0x15')]){throw new Error(_0x1b06('0x16'));}var _0x1e4342=_0x4fc697;var _0x6facfe='channelId='+_0xec2a55+_0x1b06('0x17')+_0x5ac0b7+'&sessionId='+_0x1e4342+_0x1b06('0x18')+JSON[_0x1b06('0x10')](_0x5bc1ae);var _0x5211df=_0x205e35+'?'+_0x6facfe;return rp(_0x5211df);})[_0x1b06('0x12')](function(_0x53a9f7){logger[_0x1b06('0x19')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x5773f8,_0x53a9f7);_0x53aa1e['stop']();})['catch'](function(_0x1f2e1c){logger[_0x1b06('0x1a')](_0x1b06('0x1b'),_0x5773f8,_[_0x1b06('0x1c')](_0x1f2e1c)?JSON[_0x1b06('0x10')](_0x1f2e1c):_0x1f2e1c);_0x53aa1e[_0x1b06('0x1d')]();});}else{logger[_0x1b06('0x19')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x5773f8);_0x53aa1e[_0x1b06('0x1e')]();}};}; \ 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 dc21314..acdadb5 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(_0x17d1de,_0x34e35b){var _0x176b07=function(_0x1ef434){while(--_0x1ef434){_0x17d1de['push'](_0x17d1de['shift']());}};_0x176b07(++_0x34e35b);}(_0xe706,0xa3));var _0x6e70=function(_0x34f499,_0xd8ff6e){_0x34f499=_0x34f499-0x0;var _0x2be65b=_0xe706[_0x34f499];return _0x2be65b;};'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(_0xc5f01,_0x4f76eb){var _0x3cf9eb=function(_0x27d50d){while(--_0x27d50d){_0xc5f01['push'](_0xc5f01['shift']());}};_0x3cf9eb(++_0x4f76eb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 f827e61..4d7f05c 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 _0xec8e=['Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','channel','message','interaction','checkWaitingNotifications','isArray','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','dialogflowv2','slice','amazonlex','tag','account','notificationTemplate','ChatWebsiteId','body','%s:%s:%s','./interval','condition','intervals','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','Applications\x20executed','stringify','matchPath','emit','complete','stack','routing\x20is\x20empty','agent','agents','busy','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','find','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','log'];(function(_0x590a38,_0x2bc65c){var _0xf36626=function(_0x551cd1){while(--_0x551cd1){_0x590a38['push'](_0x590a38['shift']());}};_0xf36626(++_0x2bc65c);}(_0xec8e,0xcc));var _0xeec8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xec8e[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xeec8('0x0'));var path=require(_0xeec8('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var utils=require(_0xeec8('0x2'));var sUtils=require('./applications/strategy/util');var logger=require(_0xeec8('0x3'))(_0xeec8('0x4'));var rpc={'openchannelQueueReport':require(_0xeec8('0x5')),'mailQueueReport':require(_0xeec8('0x6')),'chatQueueReport':require(_0xeec8('0x7')),'smsQueueReport':require(_0xeec8('0x8')),'faxQueueReport':require(_0xeec8('0x9')),'whatsappQueueReport':require(_0xeec8('0xa'))};var RuleEngine=require(_0xeec8('0xb'));function getId(_0x35e8a0,_0x315380,_0x1faf25){return util[_0xeec8('0xc')](_0xeec8('0xd'),_0x35e8a0,_0x315380||0x0,_0x1faf25||0x0);}function getIntervals(_0x1bd8ec,_0x5025f9){var _0xd10861=[];if(!_[_0xeec8('0xe')](_0x5025f9[_0xeec8('0xf')])&&!_['isNil'](_0x1bd8ec[_0x5025f9[_0xeec8('0xf')]])&&!_[_0xeec8('0xe')](_0x1bd8ec[_0x5025f9['IntervalId']]['Intervals'])){_0xd10861=_[_0xeec8('0x10')](_0x1bd8ec[_0x5025f9['IntervalId']][_0xeec8('0x11')],_0xeec8('0x12'));}else if(!_['isNil'](_0x5025f9[_0xeec8('0x12')])){_0xd10861=[_0x5025f9[_0xeec8('0x12')]];}return _0xd10861;}exports[_0xeec8('0x13')]=function(_0x42c7dc){_0x42c7dc['rules']={};return new BPromise(function(_0x59b4d0,_0x2dcdcc){var _0x42201f={'Start':function(_0x24683b){var _0x13d18f=this;return new Promise(function(_0x5e2c19,_0x5002b8){if(_0x24683b){try{var _0x4bb24b=[];var _0x409875=getId(_0x24683b[_0xeec8('0x14')],_0x24683b['message']?_0x24683b[_0xeec8('0x15')]['id']:0x0,_0x24683b[_0xeec8('0x16')]?_0x24683b[_0xeec8('0x16')]['id']:0x0);var _0x187296=sUtils[_0xeec8('0x17')](_0x42c7dc,_0x24683b);if(!_0x187296&&_0x24683b['applications']&&_[_0xeec8('0x18')](_0x24683b[_0xeec8('0x19')])&&_0x24683b[_0xeec8('0x19')][_0xeec8('0x1a')]){for(var _0x5f4c64=0x0;_0x5f4c64<_0x24683b[_0xeec8('0x19')][_0xeec8('0x1a')];_0x5f4c64+=0x1){var _0x223c5d=_0x24683b['applications'][_0x5f4c64];if(fs[_0xeec8('0x1b')](path[_0xeec8('0x1c')](__dirname,_0xeec8('0x19'),_0x223c5d[_0xeec8('0x1d')]+_0xeec8('0x1e')))){var _0x398598=[];switch(_0x223c5d[_0xeec8('0x1d')][_0xeec8('0x1f')]()){case _0xeec8('0x20'):var _0x1b85d8=_0x223c5d[_0xeec8('0x21')][_0xeec8('0x22')](',');if(_0x24683b['channel']===_0xeec8('0x23')){_0x398598['push'](_0x1b85d8[0x0]);_0x398598[_0xeec8('0x24')](_0x1b85d8[0x1]);_0x398598[_0xeec8('0x24')](_0x1b85d8['slice'](0x2,_0x1b85d8['length'])[_0xeec8('0x1c')](','));}else{_0x398598[_0xeec8('0x24')](_0x1b85d8[0x0]);_0x398598[_0xeec8('0x24')](_0x1b85d8['slice'](0x1,_0x1b85d8[_0xeec8('0x1a')])[_0xeec8('0x1c')](','));}break;case'dialogflow':var _0x19e475=_0x223c5d[_0xeec8('0x21')][_0xeec8('0x22')](',');_0x398598['push'](_0x19e475[0x0]);_0x398598['push'](_0x19e475[0x1]);_0x398598[_0xeec8('0x24')](_0x19e475['slice'](0x2,_0x19e475[_0xeec8('0x1a')])['join'](','));break;case _0xeec8('0x25'):var _0x3bf954=_0x223c5d['appdata'][_0xeec8('0x22')](',');_0x398598[_0xeec8('0x24')](_0x3bf954[0x0]);_0x398598[_0xeec8('0x24')](_0x3bf954[0x1]);_0x398598[_0xeec8('0x24')](_0x3bf954[0x2]);_0x398598['push'](_0x3bf954[0x3]);_0x398598[_0xeec8('0x24')](_0x3bf954[_0xeec8('0x26')](0x4,_0x3bf954[_0xeec8('0x1a')])[_0xeec8('0x1c')](','));break;case _0xeec8('0x27'):var _0xb15c51=_0x223c5d[_0xeec8('0x21')][_0xeec8('0x22')](',');_0x398598[_0xeec8('0x24')](_0xb15c51[0x0]);_0x398598[_0xeec8('0x24')](_0xb15c51[0x1]);_0x398598['push'](_0xb15c51[0x2]);_0x398598[_0xeec8('0x24')](_0xb15c51[0x3]);_0x398598[_0xeec8('0x24')](_0xb15c51['slice'](0x4,_0xb15c51['length'])[_0xeec8('0x1c')](','));break;case'message':_0x398598[_0xeec8('0x24')](_0x223c5d[_0xeec8('0x21')]);break;case _0xeec8('0x28'):_0x398598[_0xeec8('0x24')](_0x223c5d['TagId']);_0x398598[_0xeec8('0x24')](_0x223c5d['appdata']);break;case'tvox':var _0x117505=utils['getMustacheRender'](_0x24683b[_0xeec8('0x29')][_0xeec8('0x2a')],_0x24683b);var _0x45ef61=_0x223c5d[_0xeec8('0x21')][_0xeec8('0x22')](',');_0x398598[_0xeec8('0x24')](_0x45ef61[0x0]);_0x398598[_0xeec8('0x24')](_0x45ef61[0x1]);_0x398598[_0xeec8('0x24')](_0x45ef61[0x2]);_0x398598[_0xeec8('0x24')](_0x45ef61[0x3]);_0x398598[_0xeec8('0x24')](_0x45ef61[0x4]);_0x398598[_0xeec8('0x24')](_0x45ef61[0x5]);_0x398598['push'](_0x45ef61[0x6]);_0x398598[_0xeec8('0x24')](_0x45ef61[0x7]);_0x398598[_0xeec8('0x24')](_0x45ef61[0x8]);_0x398598[_0xeec8('0x24')](_0x45ef61[0x9]);_0x398598[_0xeec8('0x24')](_0x45ef61[0xa]);_0x398598[_0xeec8('0x24')](_0x24683b['interaction']['id']);_0x398598[_0xeec8('0x24')](_0x24683b[_0xeec8('0x15')]['id']);_0x398598[_0xeec8('0x24')](_0x223c5d[_0xeec8('0x2b')]);_0x398598['push'](_0x24683b[_0xeec8('0x16')]['ContactId']);_0x398598[_0xeec8('0x24')](_0x24683b[_0xeec8('0x2c')][_0xeec8('0x2c')]);_0x398598[_0xeec8('0x24')](_0x117505);break;default:_0x398598=_[_0xeec8('0xe')](_0x223c5d[_0xeec8('0x21')])?[]:_0x223c5d[_0xeec8('0x21')][_0xeec8('0x22')](',');}var _0x38ac40={'id':util[_0xeec8('0xc')](_0xeec8('0x2d'),_0x409875,_0x223c5d['id'],_0x223c5d[_0xeec8('0x1d')]),'condition':require(_0xeec8('0x2e'))[_0xeec8('0x2f')](_0x409875,getIntervals(_0x42c7dc[_0xeec8('0x30')],_0x223c5d),_0x42c7dc),'consequence':require('./applications/'+_0x223c5d[_0xeec8('0x1d')])[_0xeec8('0x31')](_0x409875,_0x398598,_0x42c7dc,_0x24683b),'p':_0x223c5d['priority']||0x0};logger[_0xeec8('0x32')](_0xeec8('0x33'),_0x38ac40['id'],_0xeec8('0x34'),getIntervals(_0x42c7dc[_0xeec8('0x30')],_0x223c5d)['join'](_0xeec8('0x35')));_0x4bb24b[_0xeec8('0x24')](_0x38ac40);}else{logger[_0xeec8('0x36')](_0xeec8('0x37'),path['join'](__dirname,_0xeec8('0x19'),_0x223c5d[_0xeec8('0x1d')]+_0xeec8('0x1e')));}}_0x42c7dc[_0xeec8('0x38')][_0x409875]=new RuleEngine(_0x4bb24b);_0x42c7dc[_0xeec8('0x38')][_0x409875]['execute'](_0x24683b,function(_0x56a7f0){logger[_0xeec8('0x32')](_0xeec8('0x39'),JSON[_0xeec8('0x3a')](_0x56a7f0[_0xeec8('0x3b')]));if(_0x42c7dc[_0xeec8('0x38')][_0x409875]){_0x42c7dc[_0xeec8('0x38')][_0x409875][_0xeec8('0x3c')](_0xeec8('0x3d'));}});return _0x5e2c19({'code':0xc8,'message':_0x24683b});}else{if(_0x187296){logger['info'](util[_0xeec8('0xc')]('Skipped\x20routing\x20for\x20%s',_0x409875));}else{logger[_0xeec8('0x32')]('No\x20applications\x20to\x20execute');}return _0x5e2c19({'code':0xc8,'message':_0x24683b});}}catch(_0x2e11fe){logger['error'](_0x2e11fe[_0xeec8('0x3e')]);return _0x5002b8(_0x13d18f[_0xeec8('0x36')](0x1f4,_0x2e11fe));}}return _0x5002b8(_0xeec8('0x3f'));});},'AcceptMessage':function(_0x302858){var _0x1696e4=this;return new Promise(function(_0x54b1a5,_0x44b3ee){if(_0x302858[_0xeec8('0x40')]&&_0x302858['agent']['id']){if(_0x42c7dc['agents'][_0x302858[_0xeec8('0x40')]['id']]){_0x42c7dc[_0xeec8('0x41')][_0x302858['agent']['id']][_0xeec8('0x42')]=![];_0x42c7dc[_0xeec8('0x41')][_0x302858[_0xeec8('0x40')]['id']]['busyQueue']=undefined;}}if(_0x302858[_0xeec8('0x15')]&&_0x302858[_0xeec8('0x15')]['id']){try{var _0x4b395c=getId(_0x302858['channel'],_0x302858[_0xeec8('0x15')]?_0x302858['message']['id']:0x0,_0x302858[_0xeec8('0x16')]?_0x302858['interaction']['id']:0x0);if(_0x42c7dc[_0xeec8('0x38')][_0x4b395c]){_0x42c7dc[_0xeec8('0x38')][_0x4b395c][_0xeec8('0x3c')](_0xeec8('0x43'));if(rpc[_0x302858[_0xeec8('0x14')]+_0xeec8('0x44')]){rpc[_0x302858[_0xeec8('0x14')]+_0xeec8('0x44')]['update'](_0x4b395c,{'UserId':_0x302858[_0xeec8('0x15')][_0xeec8('0x45')]})[_0xeec8('0x46')](function(){logger[_0xeec8('0x36')](_0xeec8('0x47'));});}}return _0x54b1a5({'code':0xc8,'message':_0x302858});}catch(_0x3e94d2){logger[_0xeec8('0x36')](_0x3e94d2[_0xeec8('0x3e')]);return _0x44b3ee(_0x1696e4[_0xeec8('0x36')](0x1f4,_0x3e94d2));}}logger[_0xeec8('0x36')](_0xeec8('0x48'));return _0x44b3ee(_0x1696e4[_0xeec8('0x36')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x282240){var _0x2cedb6=this;return new Promise(function(_0x256af0,_0x461db9){if(_0x282240['agent']&&_0x282240[_0xeec8('0x40')]['id']){try{if(_0x42c7dc['agents'][_0x282240[_0xeec8('0x40')]['id']]){_0x42c7dc[_0xeec8('0x41')][_0x282240[_0xeec8('0x40')]['id']]['busy']=![];_0x42c7dc[_0xeec8('0x41')][_0x282240[_0xeec8('0x40')]['id']][_0xeec8('0x49')]=undefined;}return _0x256af0({'code':0xc8,'message':_0x282240});}catch(_0x48933b){logger[_0xeec8('0x36')](_0x48933b[_0xeec8('0x3e')]);return _0x461db9(_0x2cedb6[_0xeec8('0x36')](0x1f4,_0x48933b));}}logger[_0xeec8('0x36')](_0xeec8('0x48'));return _0x461db9(_0x2cedb6[_0xeec8('0x36')](0x1f4,_0xeec8('0x48')));});},'AbandonInteraction':function(_0x32c18b){var _0x3b9b30=this;return new Promise(function(_0x5e6e24,_0x277fdf){if(_0x32c18b[_0xeec8('0x14')]&&_0x32c18b[_0xeec8('0x16')]&&_0x32c18b[_0xeec8('0x16')]['id']){try{var _0x142a9e=getId(_0x32c18b[_0xeec8('0x14')],_0x32c18b[_0xeec8('0x15')]?_0x32c18b[_0xeec8('0x15')]['id']:0x0,_0x32c18b[_0xeec8('0x16')]?_0x32c18b[_0xeec8('0x16')]['id']:0x0);if(_0x42c7dc[_0xeec8('0x38')][_0x142a9e]){_0x42c7dc[_0xeec8('0x38')][_0x142a9e]['emit']('end');}return _0x5e6e24({'code':0xc8,'message':_0x32c18b});}catch(_0x4618e1){logger[_0xeec8('0x36')](_0x4618e1[_0xeec8('0x3e')]);return _0x277fdf(_0x3b9b30[_0xeec8('0x36')](0x1f4,_0x4618e1));}}logger['error'](_0xeec8('0x48'));return _0x277fdf(_0x3b9b30[_0xeec8('0x36')](0x1f4,_0xeec8('0x48')));});},'AgentCapacity':function(_0x36aa6d){var _0x155f82=this;return new Promise(function(_0x38a05c,_0x4f61d9){if(_0x42c7dc['agents'][_0xeec8('0x4a')](_0x36aa6d['id'])){for(var _0x4fd91d in _0x36aa6d[_0xeec8('0x4b')]){if(_0x36aa6d['capacity'][_0xeec8('0x4a')](_0x4fd91d)){if(_0x42c7dc[_0xeec8('0x41')][_0x36aa6d['id']]['hasOwnProperty'](_0x4fd91d+_0xeec8('0x4c'))){_0x42c7dc['agents'][_0x36aa6d['id']][_0x4fd91d+_0xeec8('0x4c')]=parseInt(_0x36aa6d[_0xeec8('0x4b')][_0x4fd91d],0xa);}}}_0x42c7dc[_0xeec8('0x41')][_0x36aa6d['id']][_0xeec8('0x4d')]();return _0x38a05c({'code':0xc8,'message':_0x42c7dc['agents'][_0x36aa6d['id']]});}else{return _0x4f61d9(_0x155f82[_0xeec8('0x36')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x4fe8d7){return new Promise(function(_0x2900ee){var _0x164852=_[_0xeec8('0x4e')](_0x42c7dc[_0xeec8('0x41')]);if(_0x4fe8d7&&_0x4fe8d7['id']){var _0x33471a=_[_0xeec8('0x4f')](_0x164852,function(_0x4e7d51){return _0x4e7d51['id']===_0x4fe8d7['id'];});_0x2900ee(_0x33471a);}else{_0x2900ee({'count':_0x164852['length'],'rows':_0x164852});}});},'ChatQueues':function(){return new Promise(function(_0x164578){var _0x210cd1=[];for(var _0x54a4bf in _0x42c7dc[_0xeec8('0x50')]){if(_0x42c7dc[_0xeec8('0x50')][_0xeec8('0x4a')](_0x54a4bf)){var _0x2ab08d=_0x42c7dc[_0xeec8('0x50')][_0x54a4bf];var _0x1a3150={'id':_0x2ab08d['id'],'available':_0x2ab08d[_0xeec8('0x51')],'loggedIn':_0x2ab08d[_0xeec8('0x52')],'name':_0x2ab08d[_0xeec8('0x53')],'paused':_0x2ab08d[_0xeec8('0x54')],'waiting':_0x2ab08d['waiting']};_0x210cd1[_0xeec8('0x24')](_0x1a3150);}}_0x164578({'count':_0x210cd1[_0xeec8('0x1a')],'rows':_0x210cd1});});},'MailQueues':function(){return new Promise(function(_0x2912e1){var _0x2ddf56=[];for(var _0x50e3a7 in _0x42c7dc[_0xeec8('0x55')]){if(_0x42c7dc['mailQueues'][_0xeec8('0x4a')](_0x50e3a7)){var _0x5d93e7=_0x42c7dc[_0xeec8('0x55')][_0x50e3a7];var _0x1c8973={'id':_0x5d93e7['id'],'available':_0x5d93e7[_0xeec8('0x51')],'loggedIn':_0x5d93e7[_0xeec8('0x52')],'name':_0x5d93e7[_0xeec8('0x53')],'paused':_0x5d93e7[_0xeec8('0x54')],'waiting':_0x5d93e7[_0xeec8('0x56')]};_0x2ddf56['push'](_0x1c8973);}}_0x2912e1({'count':_0x2ddf56[_0xeec8('0x1a')],'rows':_0x2ddf56});});},'OpenchannelQueues':function(){return new Promise(function(_0x337b8a){var _0x50deaa=[];for(var _0x59f1c8 in _0x42c7dc[_0xeec8('0x57')]){if(_0x42c7dc[_0xeec8('0x57')]['hasOwnProperty'](_0x59f1c8)){var _0x44bb30=_0x42c7dc[_0xeec8('0x57')][_0x59f1c8];var _0x411593={'id':_0x44bb30['id'],'available':_0x44bb30[_0xeec8('0x51')],'loggedIn':_0x44bb30[_0xeec8('0x52')],'name':_0x44bb30['name'],'paused':_0x44bb30[_0xeec8('0x54')],'waiting':_0x44bb30[_0xeec8('0x56')]};_0x50deaa[_0xeec8('0x24')](_0x411593);}}_0x337b8a({'count':_0x50deaa['length'],'rows':_0x50deaa});});},'SmsQueues':function(){return new Promise(function(_0x2e5431){var _0x4e6dda=[];for(var _0x5c8b4f in _0x42c7dc['smsQueues']){if(_0x42c7dc['smsQueues'][_0xeec8('0x4a')](_0x5c8b4f)){var _0x1788d0=_0x42c7dc[_0xeec8('0x58')][_0x5c8b4f];var _0x2ddf77={'id':_0x1788d0['id'],'available':_0x1788d0[_0xeec8('0x51')],'loggedIn':_0x1788d0[_0xeec8('0x52')],'name':_0x1788d0[_0xeec8('0x53')],'paused':_0x1788d0['paused'],'waiting':_0x1788d0[_0xeec8('0x56')]};_0x4e6dda[_0xeec8('0x24')](_0x2ddf77);}}_0x2e5431({'count':_0x4e6dda[_0xeec8('0x1a')],'rows':_0x4e6dda});});},'FaxQueues':function(){return new Promise(function(_0x402fdd){var _0x391f71=[];for(var _0x324fec in _0x42c7dc[_0xeec8('0x59')]){if(_0x42c7dc[_0xeec8('0x59')][_0xeec8('0x4a')](_0x324fec)){var _0x3a7302=_0x42c7dc[_0xeec8('0x59')][_0x324fec];var _0x5e822a={'id':_0x3a7302['id'],'available':_0x3a7302[_0xeec8('0x51')],'loggedIn':_0x3a7302[_0xeec8('0x52')],'name':_0x3a7302[_0xeec8('0x53')],'paused':_0x3a7302[_0xeec8('0x54')],'waiting':_0x3a7302[_0xeec8('0x56')]};_0x391f71['push'](_0x5e822a);}}_0x402fdd({'count':_0x391f71[_0xeec8('0x1a')],'rows':_0x391f71});});},'WhatsappQueues':function(){return new Promise(function(_0x1be266){var _0x3ac240=[];for(var _0x4464be in _0x42c7dc[_0xeec8('0x5a')]){if(_0x42c7dc[_0xeec8('0x5a')][_0xeec8('0x4a')](_0x4464be)){var _0x4cffa9=_0x42c7dc[_0xeec8('0x5a')][_0x4464be];var _0x57f6f8={'id':_0x4cffa9['id'],'available':_0x4cffa9[_0xeec8('0x51')],'loggedIn':_0x4cffa9['loggedIn'],'name':_0x4cffa9[_0xeec8('0x53')],'paused':_0x4cffa9[_0xeec8('0x54')],'waiting':_0x4cffa9[_0xeec8('0x56')]};_0x3ac240[_0xeec8('0x24')](_0x57f6f8);}}_0x1be266({'count':_0x3ac240[_0xeec8('0x1a')],'rows':_0x3ac240});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x3e5a4a){var _0x297bf4=_[_0xeec8('0x4e')](_0x42c7dc[_0xeec8('0x5b')]);_0x3e5a4a({'count':_0x297bf4[_0xeec8('0x1a')],'rows':_0x297bf4});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x495a65){var _0x4f2825=_[_0xeec8('0x4e')](_0x42c7dc[_0xeec8('0x5c')]);_0x495a65({'count':_0x4f2825[_0xeec8('0x1a')],'rows':_0x4f2825});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x8d12fa){var _0x41c588=_[_0xeec8('0x4e')](_0x42c7dc['openchannelQueuesWaitingInteractions']);_0x8d12fa({'count':_0x41c588[_0xeec8('0x1a')],'rows':_0x41c588});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x5d6519){var _0x25007b=_[_0xeec8('0x4e')](_0x42c7dc[_0xeec8('0x5d')]);_0x5d6519({'count':_0x25007b[_0xeec8('0x1a')],'rows':_0x25007b});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4032a8){var _0x3b4e00=_[_0xeec8('0x4e')](_0x42c7dc[_0xeec8('0x5e')]);_0x4032a8({'count':_0x3b4e00[_0xeec8('0x1a')],'rows':_0x3b4e00});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x2b3284){var _0x5cfa6d=_[_0xeec8('0x4e')](_0x42c7dc[_0xeec8('0x5f')]);_0x2b3284({'count':_0x5cfa6d['length'],'rows':_0x5cfa6d});});}};var _0x43d34a=jayson['server'](_0x42201f)[_0xeec8('0x60')]();_0x43d34a['on']('error',function(_0x6717c){logger[_0xeec8('0x36')](JSON['stringify'](_0x6717c));return _0x2dcdcc(_0x6717c);});_0x43d34a[_0xeec8('0x13')](0x232c,_0xeec8('0x61'),function(){console[_0xeec8('0x62')](_0xeec8('0x63'),0x232c);return _0x59b4d0(_0xeec8('0x64')+0x232c);});});}; \ No newline at end of file +var _0x6edf=['lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','isNil','IntervalId','Intervals','interval','listen','channel','message','interaction','checkWaitingNotifications','isArray','applications','length','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflowv2','TagId','getMustacheRender','account','ChatWebsiteId','body','format','./interval','condition','intervals','./applications/','consequence','priority','info','on\x20interval','error','execute','Applications\x20executed','stringify','matchPath','rules','emit','No\x20applications\x20to\x20execute','stack','agent','agents','busyQueue','QueueReport','update','UserId','catch','message\x20is\x20empty','busy','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:'];(function(_0x3c3ffd,_0x38b338){var _0xe67468=function(_0x3d5e20){while(--_0x3d5e20){_0x3c3ffd['push'](_0x3c3ffd['shift']());}};_0xe67468(++_0x38b338);}(_0x6edf,0x184));var _0xf6ed=function(_0x3696ae,_0x4c462a){_0x3696ae=_0x3696ae-0x0;var _0x3d55c7=_0x6edf[_0x3696ae];return _0x3d55c7;};'use strict';var _=require(_0xf6ed('0x0'));var util=require(_0xf6ed('0x1'));var path=require(_0xf6ed('0x2'));var fs=require('fs');var jayson=require(_0xf6ed('0x3'));var BPromise=require(_0xf6ed('0x4'));var utils=require(_0xf6ed('0x5'));var sUtils=require(_0xf6ed('0x6'));var logger=require(_0xf6ed('0x7'))(_0xf6ed('0x8'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xf6ed('0x9')),'chatQueueReport':require(_0xf6ed('0xa')),'smsQueueReport':require(_0xf6ed('0xb')),'faxQueueReport':require(_0xf6ed('0xc')),'whatsappQueueReport':require(_0xf6ed('0xd'))};var RuleEngine=require(_0xf6ed('0xe'));function getId(_0x82aa7f,_0x3851cb,_0x342efa){return util['format']('%s.%s.%s',_0x82aa7f,_0x3851cb||0x0,_0x342efa||0x0);}function getIntervals(_0x3a0a1d,_0x873a07){var _0x42db99=[];if(!_[_0xf6ed('0xf')](_0x873a07[_0xf6ed('0x10')])&&!_['isNil'](_0x3a0a1d[_0x873a07['IntervalId']])&&!_[_0xf6ed('0xf')](_0x3a0a1d[_0x873a07['IntervalId']][_0xf6ed('0x11')])){_0x42db99=_['map'](_0x3a0a1d[_0x873a07[_0xf6ed('0x10')]][_0xf6ed('0x11')],_0xf6ed('0x12'));}else if(!_['isNil'](_0x873a07[_0xf6ed('0x12')])){_0x42db99=[_0x873a07[_0xf6ed('0x12')]];}return _0x42db99;}exports[_0xf6ed('0x13')]=function(_0x2a29c2){_0x2a29c2['rules']={};return new BPromise(function(_0x32824f,_0x2a4e34){var _0x211474={'Start':function(_0x3b90b7){var _0x54718c=this;return new Promise(function(_0x1052de,_0x8373cd){if(_0x3b90b7){try{var _0x4abb69=[];var _0x347a9e=getId(_0x3b90b7[_0xf6ed('0x14')],_0x3b90b7[_0xf6ed('0x15')]?_0x3b90b7[_0xf6ed('0x15')]['id']:0x0,_0x3b90b7['interaction']?_0x3b90b7[_0xf6ed('0x16')]['id']:0x0);var _0x36642f=sUtils[_0xf6ed('0x17')](_0x2a29c2,_0x3b90b7);if(!_0x36642f&&_0x3b90b7['applications']&&_[_0xf6ed('0x18')](_0x3b90b7[_0xf6ed('0x19')])&&_0x3b90b7[_0xf6ed('0x19')][_0xf6ed('0x1a')]){for(var _0x3e21b4=0x0;_0x3e21b4<_0x3b90b7[_0xf6ed('0x19')][_0xf6ed('0x1a')];_0x3e21b4+=0x1){var _0x29fad7=_0x3b90b7[_0xf6ed('0x19')][_0x3e21b4];if(fs['existsSync'](path[_0xf6ed('0x1b')](__dirname,'applications',_0x29fad7[_0xf6ed('0x1c')]+_0xf6ed('0x1d')))){var _0x17f718=[];switch(_0x29fad7['app'][_0xf6ed('0x1e')]()){case _0xf6ed('0x1f'):var _0x6adf5f=_0x29fad7[_0xf6ed('0x20')][_0xf6ed('0x21')](',');if(_0x3b90b7['channel']===_0xf6ed('0x22')){_0x17f718[_0xf6ed('0x23')](_0x6adf5f[0x0]);_0x17f718[_0xf6ed('0x23')](_0x6adf5f[0x1]);_0x17f718[_0xf6ed('0x23')](_0x6adf5f['slice'](0x2,_0x6adf5f[_0xf6ed('0x1a')])[_0xf6ed('0x1b')](','));}else{_0x17f718[_0xf6ed('0x23')](_0x6adf5f[0x0]);_0x17f718[_0xf6ed('0x23')](_0x6adf5f['slice'](0x1,_0x6adf5f[_0xf6ed('0x1a')])['join'](','));}break;case'dialogflow':var _0x3cc952=_0x29fad7[_0xf6ed('0x20')]['split'](',');_0x17f718[_0xf6ed('0x23')](_0x3cc952[0x0]);_0x17f718['push'](_0x3cc952[0x1]);_0x17f718[_0xf6ed('0x23')](_0x3cc952[_0xf6ed('0x24')](0x2,_0x3cc952['length'])[_0xf6ed('0x1b')](','));break;case _0xf6ed('0x25'):var _0xad858a=_0x29fad7[_0xf6ed('0x20')][_0xf6ed('0x21')](',');_0x17f718['push'](_0xad858a[0x0]);_0x17f718[_0xf6ed('0x23')](_0xad858a[0x1]);_0x17f718[_0xf6ed('0x23')](_0xad858a[0x2]);_0x17f718[_0xf6ed('0x23')](_0xad858a[0x3]);_0x17f718[_0xf6ed('0x23')](_0xad858a[_0xf6ed('0x24')](0x4,_0xad858a['length'])['join'](','));break;case'amazonlex':var _0x28db81=_0x29fad7[_0xf6ed('0x20')][_0xf6ed('0x21')](',');_0x17f718[_0xf6ed('0x23')](_0x28db81[0x0]);_0x17f718[_0xf6ed('0x23')](_0x28db81[0x1]);_0x17f718['push'](_0x28db81[0x2]);_0x17f718['push'](_0x28db81[0x3]);_0x17f718[_0xf6ed('0x23')](_0x28db81[_0xf6ed('0x24')](0x4,_0x28db81[_0xf6ed('0x1a')])[_0xf6ed('0x1b')](','));break;case _0xf6ed('0x15'):_0x17f718[_0xf6ed('0x23')](_0x29fad7['appdata']);break;case'tag':_0x17f718['push'](_0x29fad7[_0xf6ed('0x26')]);_0x17f718[_0xf6ed('0x23')](_0x29fad7[_0xf6ed('0x20')]);break;case'tvox':var _0x310c84=utils[_0xf6ed('0x27')](_0x3b90b7[_0xf6ed('0x28')]['notificationTemplate'],_0x3b90b7);var _0x405089=_0x29fad7[_0xf6ed('0x20')][_0xf6ed('0x21')](',');_0x17f718[_0xf6ed('0x23')](_0x405089[0x0]);_0x17f718[_0xf6ed('0x23')](_0x405089[0x1]);_0x17f718['push'](_0x405089[0x2]);_0x17f718[_0xf6ed('0x23')](_0x405089[0x3]);_0x17f718[_0xf6ed('0x23')](_0x405089[0x4]);_0x17f718[_0xf6ed('0x23')](_0x405089[0x5]);_0x17f718[_0xf6ed('0x23')](_0x405089[0x6]);_0x17f718[_0xf6ed('0x23')](_0x405089[0x7]);_0x17f718[_0xf6ed('0x23')](_0x405089[0x8]);_0x17f718[_0xf6ed('0x23')](_0x405089[0x9]);_0x17f718[_0xf6ed('0x23')](_0x405089[0xa]);_0x17f718[_0xf6ed('0x23')](_0x3b90b7['interaction']['id']);_0x17f718[_0xf6ed('0x23')](_0x3b90b7[_0xf6ed('0x15')]['id']);_0x17f718[_0xf6ed('0x23')](_0x29fad7[_0xf6ed('0x29')]);_0x17f718[_0xf6ed('0x23')](_0x3b90b7[_0xf6ed('0x16')]['ContactId']);_0x17f718['push'](_0x3b90b7['body'][_0xf6ed('0x2a')]);_0x17f718['push'](_0x310c84);break;default:_0x17f718=_[_0xf6ed('0xf')](_0x29fad7['appdata'])?[]:_0x29fad7[_0xf6ed('0x20')]['split'](',');}var _0x416386={'id':util[_0xf6ed('0x2b')]('%s:%s:%s',_0x347a9e,_0x29fad7['id'],_0x29fad7[_0xf6ed('0x1c')]),'condition':require(_0xf6ed('0x2c'))[_0xf6ed('0x2d')](_0x347a9e,getIntervals(_0x2a29c2[_0xf6ed('0x2e')],_0x29fad7),_0x2a29c2),'consequence':require(_0xf6ed('0x2f')+_0x29fad7[_0xf6ed('0x1c')])[_0xf6ed('0x30')](_0x347a9e,_0x17f718,_0x2a29c2,_0x3b90b7),'p':_0x29fad7[_0xf6ed('0x31')]||0x0};logger[_0xf6ed('0x32')]('Push\x20new\x20rule',_0x416386['id'],_0xf6ed('0x33'),getIntervals(_0x2a29c2[_0xf6ed('0x2e')],_0x29fad7)[_0xf6ed('0x1b')]('\x20|\x20'));_0x4abb69['push'](_0x416386);}else{logger[_0xf6ed('0x34')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,'applications',_0x29fad7[_0xf6ed('0x1c')]+'.js'));}}_0x2a29c2['rules'][_0x347a9e]=new RuleEngine(_0x4abb69);_0x2a29c2['rules'][_0x347a9e][_0xf6ed('0x35')](_0x3b90b7,function(_0x4bbbf8){logger['info'](_0xf6ed('0x36'),JSON[_0xf6ed('0x37')](_0x4bbbf8[_0xf6ed('0x38')]));if(_0x2a29c2[_0xf6ed('0x39')][_0x347a9e]){_0x2a29c2['rules'][_0x347a9e][_0xf6ed('0x3a')]('complete');}});return _0x1052de({'code':0xc8,'message':_0x3b90b7});}else{if(_0x36642f){logger[_0xf6ed('0x32')](util['format']('Skipped\x20routing\x20for\x20%s',_0x347a9e));}else{logger[_0xf6ed('0x32')](_0xf6ed('0x3b'));}return _0x1052de({'code':0xc8,'message':_0x3b90b7});}}catch(_0x225802){logger['error'](_0x225802[_0xf6ed('0x3c')]);return _0x8373cd(_0x54718c[_0xf6ed('0x34')](0x1f4,_0x225802));}}return _0x8373cd('routing\x20is\x20empty');});},'AcceptMessage':function(_0x9a9ce3){var _0x584d35=this;return new Promise(function(_0x167930,_0x4b7ce7){if(_0x9a9ce3[_0xf6ed('0x3d')]&&_0x9a9ce3[_0xf6ed('0x3d')]['id']){if(_0x2a29c2['agents'][_0x9a9ce3['agent']['id']]){_0x2a29c2[_0xf6ed('0x3e')][_0x9a9ce3[_0xf6ed('0x3d')]['id']]['busy']=![];_0x2a29c2[_0xf6ed('0x3e')][_0x9a9ce3['agent']['id']][_0xf6ed('0x3f')]=undefined;}}if(_0x9a9ce3[_0xf6ed('0x15')]&&_0x9a9ce3['message']['id']){try{var _0x367476=getId(_0x9a9ce3['channel'],_0x9a9ce3[_0xf6ed('0x15')]?_0x9a9ce3['message']['id']:0x0,_0x9a9ce3[_0xf6ed('0x16')]?_0x9a9ce3['interaction']['id']:0x0);if(_0x2a29c2['rules'][_0x367476]){_0x2a29c2['rules'][_0x367476]['emit']('end');if(rpc[_0x9a9ce3[_0xf6ed('0x14')]+'QueueReport']){rpc[_0x9a9ce3['channel']+_0xf6ed('0x40')][_0xf6ed('0x41')](_0x367476,{'UserId':_0x9a9ce3[_0xf6ed('0x15')][_0xf6ed('0x42')]})[_0xf6ed('0x43')](function(){logger[_0xf6ed('0x34')]('error\x20update\x20queue\x20report');});}}return _0x167930({'code':0xc8,'message':_0x9a9ce3});}catch(_0x151f15){logger[_0xf6ed('0x34')](_0x151f15[_0xf6ed('0x3c')]);return _0x4b7ce7(_0x584d35[_0xf6ed('0x34')](0x1f4,_0x151f15));}}logger[_0xf6ed('0x34')](_0xf6ed('0x44'));return _0x4b7ce7(_0x584d35[_0xf6ed('0x34')](0x1f4,_0xf6ed('0x44')));});},'RejectMessage':function(_0x2b105a){var _0x129e4c=this;return new Promise(function(_0x1ccc3c,_0x1c0e0a){if(_0x2b105a[_0xf6ed('0x3d')]&&_0x2b105a['agent']['id']){try{if(_0x2a29c2[_0xf6ed('0x3e')][_0x2b105a[_0xf6ed('0x3d')]['id']]){_0x2a29c2[_0xf6ed('0x3e')][_0x2b105a[_0xf6ed('0x3d')]['id']][_0xf6ed('0x45')]=![];_0x2a29c2['agents'][_0x2b105a['agent']['id']]['busyQueue']=undefined;}return _0x1ccc3c({'code':0xc8,'message':_0x2b105a});}catch(_0x271664){logger[_0xf6ed('0x34')](_0x271664[_0xf6ed('0x3c')]);return _0x1c0e0a(_0x129e4c[_0xf6ed('0x34')](0x1f4,_0x271664));}}logger[_0xf6ed('0x34')](_0xf6ed('0x44'));return _0x1c0e0a(_0x129e4c[_0xf6ed('0x34')](0x1f4,_0xf6ed('0x44')));});},'AbandonInteraction':function(_0x23b872){var _0x5da349=this;return new Promise(function(_0x3107a7,_0x5eaa85){if(_0x23b872[_0xf6ed('0x14')]&&_0x23b872[_0xf6ed('0x16')]&&_0x23b872[_0xf6ed('0x16')]['id']){try{var _0x190d1b=getId(_0x23b872['channel'],_0x23b872[_0xf6ed('0x15')]?_0x23b872[_0xf6ed('0x15')]['id']:0x0,_0x23b872[_0xf6ed('0x16')]?_0x23b872[_0xf6ed('0x16')]['id']:0x0);if(_0x2a29c2[_0xf6ed('0x39')][_0x190d1b]){_0x2a29c2['rules'][_0x190d1b]['emit']('end');}return _0x3107a7({'code':0xc8,'message':_0x23b872});}catch(_0xa3cc9e){logger[_0xf6ed('0x34')](_0xa3cc9e[_0xf6ed('0x3c')]);return _0x5eaa85(_0x5da349[_0xf6ed('0x34')](0x1f4,_0xa3cc9e));}}logger[_0xf6ed('0x34')](_0xf6ed('0x44'));return _0x5eaa85(_0x5da349[_0xf6ed('0x34')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x13d702){var _0xaba898=this;return new Promise(function(_0x1b872a,_0x227c17){if(_0x2a29c2['agents']['hasOwnProperty'](_0x13d702['id'])){for(var _0x38f1dc in _0x13d702[_0xf6ed('0x46')]){if(_0x13d702[_0xf6ed('0x46')][_0xf6ed('0x47')](_0x38f1dc)){if(_0x2a29c2['agents'][_0x13d702['id']][_0xf6ed('0x47')](_0x38f1dc+_0xf6ed('0x48'))){_0x2a29c2[_0xf6ed('0x3e')][_0x13d702['id']][_0x38f1dc+_0xf6ed('0x48')]=parseInt(_0x13d702['capacity'][_0x38f1dc],0xa);}}}_0x2a29c2[_0xf6ed('0x3e')][_0x13d702['id']][_0xf6ed('0x49')]();return _0x1b872a({'code':0xc8,'message':_0x2a29c2['agents'][_0x13d702['id']]});}else{return _0x227c17(_0xaba898[_0xf6ed('0x34')](0x1f4,_0xf6ed('0x4a')));}});},'Agents':function(_0x2dd192){return new Promise(function(_0x1548ef){var _0x2c5b0f=_[_0xf6ed('0x4b')](_0x2a29c2[_0xf6ed('0x3e')]);if(_0x2dd192&&_0x2dd192['id']){var _0x5c8cbb=_[_0xf6ed('0x4c')](_0x2c5b0f,function(_0x4acc04){return _0x4acc04['id']===_0x2dd192['id'];});_0x1548ef(_0x5c8cbb);}else{_0x1548ef({'count':_0x2c5b0f[_0xf6ed('0x1a')],'rows':_0x2c5b0f});}});},'ChatQueues':function(){return new Promise(function(_0x291a8c){var _0x2e016b=[];for(var _0x2a0df5 in _0x2a29c2[_0xf6ed('0x4d')]){if(_0x2a29c2[_0xf6ed('0x4d')][_0xf6ed('0x47')](_0x2a0df5)){var _0x3c24cf=_0x2a29c2[_0xf6ed('0x4d')][_0x2a0df5];var _0x55d39f={'id':_0x3c24cf['id'],'available':_0x3c24cf[_0xf6ed('0x4e')],'loggedIn':_0x3c24cf[_0xf6ed('0x4f')],'name':_0x3c24cf[_0xf6ed('0x50')],'paused':_0x3c24cf[_0xf6ed('0x51')],'waiting':_0x3c24cf['waiting']};_0x2e016b[_0xf6ed('0x23')](_0x55d39f);}}_0x291a8c({'count':_0x2e016b[_0xf6ed('0x1a')],'rows':_0x2e016b});});},'MailQueues':function(){return new Promise(function(_0x4ef871){var _0x3f98c2=[];for(var _0x51f2a3 in _0x2a29c2[_0xf6ed('0x52')]){if(_0x2a29c2[_0xf6ed('0x52')][_0xf6ed('0x47')](_0x51f2a3)){var _0x4dafea=_0x2a29c2[_0xf6ed('0x52')][_0x51f2a3];var _0x78fee2={'id':_0x4dafea['id'],'available':_0x4dafea[_0xf6ed('0x4e')],'loggedIn':_0x4dafea['loggedIn'],'name':_0x4dafea[_0xf6ed('0x50')],'paused':_0x4dafea[_0xf6ed('0x51')],'waiting':_0x4dafea[_0xf6ed('0x53')]};_0x3f98c2[_0xf6ed('0x23')](_0x78fee2);}}_0x4ef871({'count':_0x3f98c2[_0xf6ed('0x1a')],'rows':_0x3f98c2});});},'OpenchannelQueues':function(){return new Promise(function(_0xdf3b74){var _0x402050=[];for(var _0x1c7625 in _0x2a29c2[_0xf6ed('0x54')]){if(_0x2a29c2[_0xf6ed('0x54')][_0xf6ed('0x47')](_0x1c7625)){var _0x175d0d=_0x2a29c2['openchannelQueues'][_0x1c7625];var _0x231d41={'id':_0x175d0d['id'],'available':_0x175d0d['available'],'loggedIn':_0x175d0d[_0xf6ed('0x4f')],'name':_0x175d0d[_0xf6ed('0x50')],'paused':_0x175d0d[_0xf6ed('0x51')],'waiting':_0x175d0d[_0xf6ed('0x53')]};_0x402050[_0xf6ed('0x23')](_0x231d41);}}_0xdf3b74({'count':_0x402050[_0xf6ed('0x1a')],'rows':_0x402050});});},'SmsQueues':function(){return new Promise(function(_0x361924){var _0x4c7902=[];for(var _0x109822 in _0x2a29c2[_0xf6ed('0x55')]){if(_0x2a29c2[_0xf6ed('0x55')]['hasOwnProperty'](_0x109822)){var _0x3cda89=_0x2a29c2['smsQueues'][_0x109822];var _0xfe864a={'id':_0x3cda89['id'],'available':_0x3cda89['available'],'loggedIn':_0x3cda89[_0xf6ed('0x4f')],'name':_0x3cda89[_0xf6ed('0x50')],'paused':_0x3cda89[_0xf6ed('0x51')],'waiting':_0x3cda89['waiting']};_0x4c7902[_0xf6ed('0x23')](_0xfe864a);}}_0x361924({'count':_0x4c7902[_0xf6ed('0x1a')],'rows':_0x4c7902});});},'FaxQueues':function(){return new Promise(function(_0x385d97){var _0x2e8dd8=[];for(var _0x45f140 in _0x2a29c2['faxQueues']){if(_0x2a29c2[_0xf6ed('0x56')][_0xf6ed('0x47')](_0x45f140)){var _0x3dfde0=_0x2a29c2[_0xf6ed('0x56')][_0x45f140];var _0x46e0d0={'id':_0x3dfde0['id'],'available':_0x3dfde0[_0xf6ed('0x4e')],'loggedIn':_0x3dfde0['loggedIn'],'name':_0x3dfde0[_0xf6ed('0x50')],'paused':_0x3dfde0[_0xf6ed('0x51')],'waiting':_0x3dfde0['waiting']};_0x2e8dd8[_0xf6ed('0x23')](_0x46e0d0);}}_0x385d97({'count':_0x2e8dd8[_0xf6ed('0x1a')],'rows':_0x2e8dd8});});},'WhatsappQueues':function(){return new Promise(function(_0x11a963){var _0x10ad6d=[];for(var _0x3b357a in _0x2a29c2[_0xf6ed('0x57')]){if(_0x2a29c2['whatsappQueues'][_0xf6ed('0x47')](_0x3b357a)){var _0x65d8c2=_0x2a29c2['whatsappQueues'][_0x3b357a];var _0x1fcfc0={'id':_0x65d8c2['id'],'available':_0x65d8c2[_0xf6ed('0x4e')],'loggedIn':_0x65d8c2['loggedIn'],'name':_0x65d8c2[_0xf6ed('0x50')],'paused':_0x65d8c2[_0xf6ed('0x51')],'waiting':_0x65d8c2[_0xf6ed('0x53')]};_0x10ad6d['push'](_0x1fcfc0);}}_0x11a963({'count':_0x10ad6d[_0xf6ed('0x1a')],'rows':_0x10ad6d});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x302201){var _0xffa3bd=_[_0xf6ed('0x4b')](_0x2a29c2[_0xf6ed('0x58')]);_0x302201({'count':_0xffa3bd[_0xf6ed('0x1a')],'rows':_0xffa3bd});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1fd272){var _0x1818fa=_[_0xf6ed('0x4b')](_0x2a29c2[_0xf6ed('0x59')]);_0x1fd272({'count':_0x1818fa[_0xf6ed('0x1a')],'rows':_0x1818fa});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x47b248){var _0x5502ac=_[_0xf6ed('0x4b')](_0x2a29c2[_0xf6ed('0x5a')]);_0x47b248({'count':_0x5502ac[_0xf6ed('0x1a')],'rows':_0x5502ac});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x580ff9){var _0x5bb9fb=_[_0xf6ed('0x4b')](_0x2a29c2[_0xf6ed('0x5b')]);_0x580ff9({'count':_0x5bb9fb[_0xf6ed('0x1a')],'rows':_0x5bb9fb});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x73966a){var _0x15e0cf=_['values'](_0x2a29c2['faxQueuesWaitingInteractions']);_0x73966a({'count':_0x15e0cf[_0xf6ed('0x1a')],'rows':_0x15e0cf});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x3927bc){var _0x3a715d=_[_0xf6ed('0x4b')](_0x2a29c2['whatsappQueuesWaitingInteractions']);_0x3927bc({'count':_0x3a715d[_0xf6ed('0x1a')],'rows':_0x3a715d});});}};var _0x25fa5e=jayson['server'](_0x211474)[_0xf6ed('0x5c')]();_0x25fa5e['on'](_0xf6ed('0x34'),function(_0x366571){logger[_0xf6ed('0x34')](JSON[_0xf6ed('0x37')](_0x366571));return _0x2a4e34(_0x366571);});_0x25fa5e[_0xf6ed('0x13')](0x232c,_0xf6ed('0x5d'),function(){console[_0xf6ed('0x5e')](_0xf6ed('0x5f'),0x232c);return _0x32824f(_0xf6ed('0x60')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index f38da3e..392cc7f 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 _0x43d3=['result','rules','info','stop','push','Command','format','iftime\x20%s','true','catch','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message'];(function(_0x5cde2b,_0x50892a){var _0x2c78fc=function(_0x16adb2){while(--_0x16adb2){_0x5cde2b['push'](_0x5cde2b['shift']());}};_0x2c78fc(++_0x50892a);}(_0x43d3,0x86));var _0x343d=function(_0x527121,_0x4f59b1){_0x527121=_0x527121-0x0;var _0x2cb132=_0x43d3[_0x527121];return _0x2cb132;};'use strict';var util=require(_0x343d('0x0'));var BPromise=require('bluebird');var jayson=require(_0x343d('0x1'));var _=require(_0x343d('0x2'));var logger=require(_0x343d('0x3'))(_0x343d('0x4'));var client=jayson[_0x343d('0x5')][_0x343d('0x6')]({'port':0x232a});function request(_0x2d484d,_0x30b1c1){return new BPromise(function(_0x358ef6,_0x523f3c){return client[_0x343d('0x7')](_0x2d484d,_0x30b1c1)[_0x343d('0x8')](function(_0x244bda){if(_0x244bda[_0x343d('0x9')]){return _0x523f3c(_0x244bda['error'][_0x343d('0xa')]);}else{return _0x358ef6(_0x244bda[_0x343d('0xb')]);}})['catch'](function(_0x3eba11){return _0x523f3c(_0x3eba11);});});}exports['condition']=function(_0x5ed994,_0x34c9a7,_0x20f95c){return function(_0x3d7ede){if(_0x20f95c[_0x343d('0xc')]&&!_0x20f95c[_0x343d('0xc')][_0x5ed994]){logger[_0x343d('0xd')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x5ed994);return _0x3d7ede[_0x343d('0xe')]();}var _0x366f0d=[];for(var _0x3a5650=0x0;_0x3a5650<_0x34c9a7['length'];_0x3a5650+=0x1){_0x366f0d[_0x343d('0xf')](request(_0x343d('0x10'),{'command':util[_0x343d('0x11')](_0x343d('0x12'),_0x34c9a7[_0x3a5650])})['then'](function(_0xfc1615){return _0xfc1615&&_0xfc1615[_0x343d('0xa')]&&_0xfc1615[_0x343d('0xa')]['indexOf'](_0x343d('0x13'))>=0x0?!![]:![];})[_0x343d('0x14')](function(_0x155df9){logger['error'](_0x343d('0x15'),_0x5ed994,_0x34c9a7[_0x3a5650]);}));}BPromise[_0x343d('0x16')](_0x366f0d)[_0x343d('0x8')](function(_0x528e44){var _0x5a9da0=_['some'](_0x528e44);logger[_0x343d('0xd')](_0x343d('0x17'),_0x5ed994,_0x34c9a7[_0x343d('0x18')](_0x343d('0x19')),_0x5a9da0);_0x3d7ede[_0x343d('0x1a')](_0x5a9da0);})[_0x343d('0x14')](function(_0x1ef375){console[_0x343d('0x1b')](_0x1ef375);logger[_0x343d('0x9')](_0x343d('0x17'),_0x5ed994,_0x34c9a7['join']('\x20|\x20'),_0x1ef375[_0x343d('0x1c')]);_0x3d7ede[_0x343d('0xe')]();});};}; \ No newline at end of file +var _0x551d=['bluebird','jayson/promise','lodash','../../../config/logger','routing','http','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stack','util'];(function(_0x13261b,_0x44f33e){var _0x29aaec=function(_0x50261e){while(--_0x50261e){_0x13261b['push'](_0x13261b['shift']());}};_0x29aaec(++_0x44f33e);}(_0x551d,0x9f));var _0xd551=function(_0x418060,_0xd3b3b7){_0x418060=_0x418060-0x0;var _0x21f56b=_0x551d[_0x418060];return _0x21f56b;};'use strict';var util=require(_0xd551('0x0'));var BPromise=require(_0xd551('0x1'));var jayson=require(_0xd551('0x2'));var _=require(_0xd551('0x3'));var logger=require(_0xd551('0x4'))(_0xd551('0x5'));var client=jayson['client'][_0xd551('0x6')]({'port':0x232a});function request(_0x55af5e,_0x5007c3){return new BPromise(function(_0x5791b6,_0x5af8cb){return client['request'](_0x55af5e,_0x5007c3)[_0xd551('0x7')](function(_0x46307a){if(_0x46307a[_0xd551('0x8')]){return _0x5af8cb(_0x46307a['error'][_0xd551('0x9')]);}else{return _0x5791b6(_0x46307a[_0xd551('0xa')]);}})[_0xd551('0xb')](function(_0x94adfe){return _0x5af8cb(_0x94adfe);});});}exports[_0xd551('0xc')]=function(_0x2567d0,_0x4bd3f8,_0x1c975d){return function(_0x4dbe20){if(_0x1c975d[_0xd551('0xd')]&&!_0x1c975d[_0xd551('0xd')][_0x2567d0]){logger[_0xd551('0xe')](_0xd551('0xf'),_0x2567d0);return _0x4dbe20[_0xd551('0x10')]();}var _0x4e1086=[];for(var _0x482f07=0x0;_0x482f07<_0x4bd3f8['length'];_0x482f07+=0x1){_0x4e1086[_0xd551('0x11')](request(_0xd551('0x12'),{'command':util[_0xd551('0x13')](_0xd551('0x14'),_0x4bd3f8[_0x482f07])})[_0xd551('0x7')](function(_0x243a78){return _0x243a78&&_0x243a78[_0xd551('0x9')]&&_0x243a78[_0xd551('0x9')][_0xd551('0x15')](_0xd551('0x16'))>=0x0?!![]:![];})['catch'](function(_0x59bb34){logger[_0xd551('0x8')](_0xd551('0x17'),_0x2567d0,_0x4bd3f8[_0x482f07]);}));}BPromise[_0xd551('0x18')](_0x4e1086)[_0xd551('0x7')](function(_0x451908){var _0x4462ed=_[_0xd551('0x19')](_0x451908);logger[_0xd551('0xe')](_0xd551('0x1a'),_0x2567d0,_0x4bd3f8[_0xd551('0x1b')]('\x20|\x20'),_0x4462ed);_0x4dbe20[_0xd551('0x1c')](_0x4462ed);})['catch'](function(_0x215cdc){console[_0xd551('0x1d')](_0x215cdc);logger[_0xd551('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x2567d0,_0x4bd3f8[_0xd551('0x1b')](_0xd551('0x1e')),_0x215cdc[_0xd551('0x1f')]);_0x4dbe20[_0xd551('0x10')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 6c91e32..7906801 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 _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(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x153f,0x15b));var _0xf153=function(_0x3c1618,_0x1c5256){_0x3c1618=_0x3c1618-0x0;var _0x537527=_0x153f[_0x3c1618];return _0x537527;};'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 +var _0x4483=['agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','debug','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','ringtime','talktime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','reason','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfertype','blind','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','transfertargetuniqueid','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw'];(function(_0x362e7b,_0x139c28){var _0xc8ba25=function(_0xe72a23){while(--_0xe72a23){_0x362e7b['push'](_0x362e7b['shift']());}};_0xc8ba25(++_0x139c28);}(_0x4483,0x1a3));var _0x3448=function(_0x23374e,_0x5547fc){_0x23374e=_0x23374e-0x0;var _0x2ad548=_0x4483[_0x23374e];return _0x2ad548;};'use strict';var _=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var utils=require(_0x3448('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x481d0c,_0x202d3d){utils[_0x3448('0x3')](util[_0x3448('0x4')](_0x3448('0x5'),_0x481d0c[_0x3448('0x6')],_0x481d0c['channel'],_0x481d0c[_0x3448('0x7')],_0x481d0c[_0x3448('0x8')],_0x481d0c[_0x3448('0x9')],_0x481d0c[_0x3448('0xa')],_0x481d0c[_0x3448('0xb')],_0x481d0c[_0x3448('0xc')]));if(_0x481d0c[_0x3448('0x7')]){utils[_0x3448('0xd')](_0x481d0c['queue'])['then'](function(_0x46b1ee){if(_0x46b1ee){_0x481d0c[_0x3448('0xe')]=_0x46b1ee[_0x3448('0xe')];_0x481d0c[_0x3448('0xf')]=_0x481d0c[_0x3448('0x10')]?_0x46b1ee[_0x3448('0x11')]:![];_0x481d0c[_0x3448('0x12')]=_0x481d0c[_0x3448('0xf')]?_0x46b1ee[_0x3448('0x13')]:0x0;}utils[_0x3448('0x14')](_0x3448('0x15'),_0x481d0c);});}else{utils['request']('CreateVoiceAgentReport',_0x481d0c);}if(_0x202d3d){delete transfers[_0x481d0c[_0x3448('0x6')]];}else{delete agents[_0x481d0c[_0x3448('0x16')]];}}exports['agentcalled']=function(_0x2661e1){try{utils[_0x3448('0x17')](util[_0x3448('0x4')]('[%s][agents][agentcalled]',_0x2661e1[_0x3448('0x6')]),_0x2661e1);agents[_0x2661e1[_0x3448('0x16')]]=_0x2661e1;agents[_0x2661e1['destuniqueid']][_0x3448('0x18')]=utils[_0x3448('0x19')]();agents[_0x2661e1[_0x3448('0x16')]]['lastevent']=_0x3448('0x1a');agents[_0x2661e1[_0x3448('0x16')]][_0x3448('0xb')]=null;agents[_0x2661e1[_0x3448('0x16')]][_0x3448('0x1b')]=null;utils[_0x3448('0x3')](util[_0x3448('0x4')](_0x3448('0x1c'),_0x2661e1['uniqueid'],agents[_0x2661e1[_0x3448('0x16')]]['membername'],_0x2661e1['destuniqueid']));}catch(_0x53f8e7){utils[_0x3448('0x1d')](util[_0x3448('0x4')](_0x3448('0x1e'),_0x2661e1['uniqueid']),_0x53f8e7);}};exports[_0x3448('0x1f')]=function(_0x392c8d){try{if(!_[_0x3448('0x20')](agents[_0x392c8d[_0x3448('0x16')]])){utils[_0x3448('0x17')](util[_0x3448('0x4')]('[%s][agents][agentringnoanswer]',_0x392c8d['uniqueid']),_0x392c8d);utils['info'](util[_0x3448('0x4')](_0x3448('0x21'),_0x392c8d['uniqueid'],agents[_0x392c8d['destuniqueid']][_0x3448('0x8')],_0x392c8d[_0x3448('0x16')]));agents[_0x392c8d[_0x3448('0x16')]][_0x3448('0x1f')]=!![];agents[_0x392c8d[_0x3448('0x16')]]['agentringnoanswerAt']=utils[_0x3448('0x19')]();agents[_0x392c8d[_0x3448('0x16')]][_0x3448('0xc')]=_0x3448('0x22');agents[_0x392c8d[_0x3448('0x16')]]['reason']=_0x3448('0x22');agents[_0x392c8d[_0x3448('0x16')]]['holdtime']=_0x392c8d[_0x3448('0x23')]?parseInt(_0x392c8d[_0x3448('0x23')])/0x3e8:0x0;agents[_0x392c8d[_0x3448('0x16')]][_0x3448('0x24')]=0x0;unanswered[_0x3448('0x25')](_0x392c8d[_0x3448('0x16')]);}}catch(_0x31be64){utils[_0x3448('0x1d')](util['format'](_0x3448('0x26'),_0x392c8d[_0x3448('0x6')]),_0x31be64);}};exports[_0x3448('0x27')]=function(_0x52c09d){try{_[_0x3448('0x28')](agents,function(_0x5dfdf7,_0x486f2c){if(_0x5dfdf7['uniqueid']==_0x52c09d[_0x3448('0x6')]&&!_[_0x3448('0x29')](unanswered,_0x5dfdf7['destuniqueid'])){utils['debug'](util[_0x3448('0x4')](_0x3448('0x2a'),_0x52c09d[_0x3448('0x6')]),_0x52c09d);utils[_0x3448('0x3')](util['format'](_0x3448('0x2b'),_0x52c09d[_0x3448('0x6')],_0x5dfdf7[_0x3448('0x8')],_0x5dfdf7['destuniqueid']));_0x5dfdf7[_0x3448('0x1f')]=!![];_0x5dfdf7[_0x3448('0x2c')]=utils['now']();_0x5dfdf7['lastevent']=_0x3448('0x2d');_0x5dfdf7[_0x3448('0x2e')]=_0x3448('0x2d');_0x5dfdf7[_0x3448('0x2f')]=_0x52c09d['holdtime'];_0x5dfdf7[_0x3448('0x24')]=0x0;writeDB(_0x5dfdf7);}});}catch(_0x36291e){utils[_0x3448('0x1d')](util[_0x3448('0x4')]('[%s][agents][queuecallerabandon]',_0x52c09d[_0x3448('0x6')]),_0x36291e);}};exports[_0x3448('0x30')]=function(_0x5ea47c){try{if(agents[_0x5ea47c[_0x3448('0x16')]]){utils[_0x3448('0x17')](util[_0x3448('0x4')](_0x3448('0x31'),_0x5ea47c[_0x3448('0x6')]),_0x5ea47c);utils[_0x3448('0x3')](util[_0x3448('0x4')](_0x3448('0x32'),_0x5ea47c[_0x3448('0x6')],agents[_0x5ea47c['destuniqueid']]['membername'],_0x5ea47c[_0x3448('0x16')]));agents[_0x5ea47c['destuniqueid']][_0x3448('0x33')]=utils[_0x3448('0x19')]();agents[_0x5ea47c[_0x3448('0x16')]][_0x3448('0xb')]=_0x5ea47c['connectedlinenum'];agents[_0x5ea47c[_0x3448('0x16')]][_0x3448('0x1b')]=_0x5ea47c[_0x3448('0x1b')];agents[_0x5ea47c[_0x3448('0x16')]][_0x3448('0x2f')]=_0x5ea47c[_0x3448('0x23')];agents[_0x5ea47c[_0x3448('0x16')]][_0x3448('0xc')]=_0x3448('0x34');_['forIn'](agents,function(_0x39b22e,_0x3c92e2){if(_0x39b22e[_0x3448('0x16')]!=_0x5ea47c[_0x3448('0x16')]&&_0x39b22e[_0x3448('0x6')]==_0x5ea47c['uniqueid']){_0x39b22e[_0x3448('0x24')]=0x0;_0x39b22e[_0x3448('0x2f')]=_0x5ea47c[_0x3448('0x23')];_0x39b22e[_0x3448('0x1f')]=!![];_0x39b22e[_0x3448('0x2c')]=utils[_0x3448('0x19')]();_0x39b22e[_0x3448('0xc')]=_0x3448('0x35');_0x39b22e['reason']=_0x3448('0x35');_0x39b22e[_0x3448('0x36')]=_0x5ea47c[_0x3448('0x16')];_0x39b22e['answeredelsewheremembername']=_0x5ea47c[_0x3448('0x8')];writeDB(_0x39b22e);}});}}catch(_0x1d2a7c){utils[_0x3448('0x1d')](util[_0x3448('0x4')](_0x3448('0x31'),_0x5ea47c[_0x3448('0x6')]),_0x1d2a7c);}};exports[_0x3448('0x10')]=function(_0x4f54e7){try{if(!_[_0x3448('0x20')](agents[_0x4f54e7[_0x3448('0x16')]])){utils[_0x3448('0x17')](util[_0x3448('0x4')](_0x3448('0x37'),_0x4f54e7[_0x3448('0x6')]),_0x4f54e7);utils['info'](util[_0x3448('0x4')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x4f54e7['uniqueid'],agents[_0x4f54e7[_0x3448('0x16')]][_0x3448('0x8')],_0x4f54e7['destuniqueid']));agents[_0x4f54e7[_0x3448('0x16')]][_0x3448('0x10')]=!![];agents[_0x4f54e7['destuniqueid']][_0x3448('0x38')]=utils[_0x3448('0x19')]();agents[_0x4f54e7['destuniqueid']][_0x3448('0x24')]=utils[_0x3448('0x39')](agents[_0x4f54e7[_0x3448('0x16')]][_0x3448('0x38')],agents[_0x4f54e7[_0x3448('0x16')]][_0x3448('0x33')]);agents[_0x4f54e7[_0x3448('0x16')]]['reason']=_0x4f54e7['reason'];agents[_0x4f54e7[_0x3448('0x16')]][_0x3448('0xc')]=_0x3448('0x3a');writeDB(agents[_0x4f54e7[_0x3448('0x16')]]);}}catch(_0x527259){utils[_0x3448('0x1d')](util[_0x3448('0x4')](_0x3448('0x37'),_0x4f54e7[_0x3448('0x6')]),_0x527259);}};exports[_0x3448('0x3b')]=function(_0x5d942b){try{if(!_[_0x3448('0x20')](agents[_0x5d942b['transfereruniqueid']])){utils[_0x3448('0x17')](util[_0x3448('0x4')]('[%s][agents][blindtransfer]',_0x5d942b[_0x3448('0x6')]),_0x5d942b);utils[_0x3448('0x3')](util[_0x3448('0x4')](_0x3448('0x3c'),_0x5d942b[_0x3448('0x6')],agents[_0x5d942b[_0x3448('0x3d')]][_0x3448('0x8')],agents[_0x5d942b['transfereruniqueid']][_0x3448('0x6')]));agents[_0x5d942b[_0x3448('0x3d')]]['transfer']=!![];agents[_0x5d942b['transfereruniqueid']][_0x3448('0x3e')]=_0x3448('0x3f');agents[_0x5d942b['transfereruniqueid']]['transferexten']=_0x5d942b[_0x3448('0x40')];agents[_0x5d942b[_0x3448('0x3d')]][_0x3448('0x41')]=agents[_0x5d942b[_0x3448('0x3d')]][_0x3448('0x6')];}}catch(_0x39db50){utils[_0x3448('0x1d')](util['format']('[%s][agents][blindtransfer]',_0x5d942b['uniqueid']),_0x39db50);}};exports[_0x3448('0x42')]=function(_0x3c734a){try{utils['debug'](util[_0x3448('0x4')](_0x3448('0x43'),_0x3c734a['origtransfereruniqueid']),_0x3c734a);if(_0x3c734a[_0x3448('0x44')]==_0x3c734a[_0x3448('0x45')]){if(!_['isNil'](agents[_0x3c734a[_0x3448('0x46')]])){utils[_0x3448('0x3')](util[_0x3448('0x4')](_0x3448('0x47'),_0x3c734a[_0x3448('0x44')],agents[_0x3c734a[_0x3448('0x46')]][_0x3448('0x8')]));agents[_0x3c734a[_0x3448('0x46')]][_0x3448('0x48')]=!![];agents[_0x3c734a['secondtransfereruniqueid']][_0x3448('0x3e')]='ATTENDED';agents[_0x3c734a[_0x3448('0x46')]][_0x3448('0x49')]=_0x3c734a[_0x3448('0x4a')];agents[_0x3c734a[_0x3448('0x46')]][_0x3448('0x41')]=_0x3c734a[_0x3448('0x44')];}if(_0x3c734a['transfereeuniqueid']&&agents[_0x3c734a[_0x3448('0x4b')]]){agents[_0x3c734a['transfereeuniqueid']][_0x3448('0x4c')]=0x1;transfers[_0x3c734a[_0x3448('0x4b')]]=_[_0x3448('0x4d')](agents[_0x3c734a[_0x3448('0x4b')]]);transfers[_0x3c734a[_0x3448('0x4b')]]['calleridnum']=agents[_0x3c734a['secondtransfereruniqueid']][_0x3448('0xa')];transfers[_0x3c734a[_0x3448('0x4b')]][_0x3448('0x4e')]=agents[_0x3c734a['secondtransfereruniqueid']][_0x3448('0x4e')];transfers[_0x3c734a[_0x3448('0x4b')]][_0x3448('0x18')]=utils[_0x3448('0x19')]();transfers[_0x3c734a[_0x3448('0x4b')]][_0x3448('0x33')]=utils[_0x3448('0x19')]();transfers[_0x3c734a[_0x3448('0x4b')]][_0x3448('0x2f')]=0x0;transfers[_0x3c734a[_0x3448('0x4b')]][_0x3448('0x4c')]=0x2;}}else if(_0x3c734a[_0x3448('0x46')]==_0x3c734a[_0x3448('0x4f')]){if(!_[_0x3448('0x20')](agents[_0x3c734a[_0x3448('0x44')]])){utils[_0x3448('0x3')](util[_0x3448('0x4')](_0x3448('0x47'),_0x3c734a['origtransfereruniqueid'],agents[_0x3c734a[_0x3448('0x44')]]['membername']));agents[_0x3c734a[_0x3448('0x44')]]['transfer']=!![];agents[_0x3c734a[_0x3448('0x44')]][_0x3448('0x3e')]='ATTENDED';agents[_0x3c734a[_0x3448('0x44')]][_0x3448('0x49')]=_0x3c734a['secondtransfererexten'];agents[_0x3c734a['origtransfereruniqueid']][_0x3448('0x41')]=_0x3c734a['secondtransfereruniqueid'];}if(_0x3c734a['transfertargetuniqueid']&&agents[_0x3c734a[_0x3448('0x50')]]){agents[_0x3c734a[_0x3448('0x50')]]['agententerreason']=0x1;transfers[_0x3c734a['transfertargetuniqueid']]=_[_0x3448('0x4d')](agents[_0x3c734a[_0x3448('0x50')]]);transfers[_0x3c734a[_0x3448('0x50')]][_0x3448('0xa')]=agents[_0x3c734a[_0x3448('0x44')]][_0x3448('0xa')];transfers[_0x3c734a[_0x3448('0x50')]][_0x3448('0x4e')]=agents[_0x3c734a[_0x3448('0x44')]][_0x3448('0x4e')];transfers[_0x3c734a[_0x3448('0x50')]][_0x3448('0x18')]=utils[_0x3448('0x19')]();transfers[_0x3c734a[_0x3448('0x50')]]['agentconnectAt']=utils[_0x3448('0x19')]();transfers[_0x3c734a[_0x3448('0x50')]]['holdtime']=0x0;transfers[_0x3c734a[_0x3448('0x50')]][_0x3448('0x4c')]=0x2;}}}catch(_0x543959){utils[_0x3448('0x1d')](util[_0x3448('0x4')](_0x3448('0x43'),_0x3c734a['origtransfereruniqueid']),_0x543959);}};exports['hangup']=function(_0x41d459){try{utils['debug'](util[_0x3448('0x4')](_0x3448('0x51'),_0x41d459[_0x3448('0x6')]),_0x41d459);if(agents[_0x41d459['uniqueid']]&&agents[_0x41d459[_0x3448('0x6')]][_0x3448('0x2e')]===_0x3448('0x22')){if(_0x41d459['cause']==='21'){agents[_0x41d459['uniqueid']][_0x3448('0x2e')]=_0x3448('0x52');agents[_0x41d459[_0x3448('0x6')]][_0x3448('0xc')]=_0x3448('0x52');}utils[_0x3448('0x3')](util['format'](_0x3448('0x53'),_0x41d459['uniqueid'],agents[_0x41d459[_0x3448('0x6')]][_0x3448('0x8')],agents[_0x41d459['uniqueid']][_0x3448('0x2e')],agents[_0x41d459[_0x3448('0x6')]]['lastevent']));writeDB(agents[_0x41d459['uniqueid']]);var _0x188f98=unanswered[_0x3448('0x54')](_0x41d459[_0x3448('0x6')]);if(_0x188f98>-0x1){unanswered[_0x3448('0x55')](_0x188f98,0x1);}}if(transfers[_0x41d459[_0x3448('0x6')]]){transfers[_0x41d459[_0x3448('0x6')]][_0x3448('0x10')]=!![];transfers[_0x41d459[_0x3448('0x6')]][_0x3448('0x38')]=utils[_0x3448('0x19')]();transfers[_0x41d459[_0x3448('0x6')]][_0x3448('0x24')]=utils[_0x3448('0x39')](transfers[_0x41d459[_0x3448('0x6')]][_0x3448('0x38')],transfers[_0x41d459[_0x3448('0x6')]]['agentconnectAt']);transfers[_0x41d459['uniqueid']][_0x3448('0x2e')]='agent';transfers[_0x41d459[_0x3448('0x6')]][_0x3448('0xc')]='complete';utils[_0x3448('0x3')](util['format'](_0x3448('0x53'),_0x41d459[_0x3448('0x6')],transfers[_0x41d459[_0x3448('0x6')]][_0x3448('0x8')],transfers[_0x41d459[_0x3448('0x6')]]['reason'],transfers[_0x41d459[_0x3448('0x6')]][_0x3448('0xc')]));writeDB(transfers[_0x41d459[_0x3448('0x6')]],!![]);}if(agents[_0x41d459['uniqueid']]&&agents[_0x41d459[_0x3448('0x6')]][_0x3448('0x33')]){agents[_0x41d459[_0x3448('0x6')]]['agentcomplete']=!![];agents[_0x41d459[_0x3448('0x6')]]['agentcompleteAt']=utils['now']();agents[_0x41d459[_0x3448('0x6')]]['talktime']=utils[_0x3448('0x39')](agents[_0x41d459['uniqueid']][_0x3448('0x38')],agents[_0x41d459[_0x3448('0x6')]]['agentconnectAt']);agents[_0x41d459['uniqueid']][_0x3448('0x2e')]=agents[_0x41d459[_0x3448('0x6')]]['transfer']?_0x3448('0x48'):_0x3448('0x56');agents[_0x41d459['uniqueid']][_0x3448('0xc')]=_0x3448('0x3a');utils[_0x3448('0x3')](util[_0x3448('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x41d459[_0x3448('0x6')],agents[_0x41d459['uniqueid']][_0x3448('0x8')],agents[_0x41d459['uniqueid']][_0x3448('0x2e')],agents[_0x41d459[_0x3448('0x6')]][_0x3448('0xc')]));writeDB(agents[_0x41d459['uniqueid']]);}}catch(_0x17ebc9){utils[_0x3448('0x1d')](util['format'](_0x3448('0x51'),_0x41d459['uniqueid']),_0x17ebc9);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index ba790d1..0866756 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 _0xb69e=['[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','destinationchannel','answertime','hangup','[%s][calls][hangup]','callerid','calleridname','calleridnum','duration','diffTime','endtime','attendedtransfer','localtwolinkedid','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','source','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','split','substring','lastIndexOf','includes','noop','execif','gotoif','toLowerCase','lodash','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','info','format','queue','membername','interface','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','recording','newchannel','debug'];(function(_0x389b7b,_0x48cc3f){var _0x2aa03c=function(_0x465412){while(--_0x465412){_0x389b7b['push'](_0x389b7b['shift']());}};_0x2aa03c(++_0x48cc3f);}(_0xb69e,0xb3));var _0xeb69=function(_0x528ada,_0x4ee0f8){_0x528ada=_0x528ada-0x0;var _0x49b2d3=_0xb69e[_0x528ada];return _0x49b2d3;};'use strict';var _=require(_0xeb69('0x0'));var util=require('util');var utils=require('./utils');var transfers=require(_0xeb69('0x1'));var dispositions=['NO\x20ANSWER',_0xeb69('0x2'),'FAILED',_0xeb69('0x3'),_0xeb69('0x3'),_0xeb69('0x3'),_0xeb69('0x4'),_0xeb69('0x5'),'FAILED','FAILED',_0xeb69('0x2')];var channels={};function writeDB(_0x414887){var _0x39bf37;if(transfers[_0xeb69('0x6')][_0x414887[_0xeb69('0x7')]]){_0x39bf37=_0x414887[_0xeb69('0x7')];_0x414887[_0xeb69('0x7')]=transfers[_0xeb69('0x6')][_0x414887[_0xeb69('0x7')]]['transfereeuniqueid'];}utils[_0xeb69('0x8')](util[_0xeb69('0x9')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x414887['uniqueid'],_0x414887['channel'],_0x414887[_0xeb69('0xa')],_0x414887[_0xeb69('0xb')],_0x414887[_0xeb69('0xc')],_0x414887['calleridnum'],_0x414887['connectedlinenum'],_0x414887['lastevent']));if(_0x414887[_0xeb69('0xd')]){utils[_0xeb69('0xe')](_0x414887[_0xeb69('0xd')])[_0xeb69('0xf')](function(_0x54e367){if(_0x54e367){_0x414887['UserId']=_0x54e367['id'];}utils[_0xeb69('0x10')]('CreateVoiceCallReport',_0x414887);});}else{utils[_0xeb69('0x10')](_0xeb69('0x11'),_0x414887);}if(channels[_0x414887['uniqueid']]){delete channels[_0x414887[_0xeb69('0x7')]];}else if(_0x39bf37&&channels[_0x39bf37]){if(!transfers[_0xeb69('0x6')][_0x39bf37][_0xeb69('0x12')])delete transfers[_0xeb69('0x6')][_0x39bf37];delete channels[_0x39bf37];}}exports[_0xeb69('0x13')]=function(_0x2a0de9){try{utils[_0xeb69('0x14')](util[_0xeb69('0x9')](_0xeb69('0x15'),_0x2a0de9[_0xeb69('0x7')]),_0x2a0de9);if(_0x2a0de9[_0xeb69('0x7')]==_0x2a0de9[_0xeb69('0x16')]&&_0x2a0de9[_0xeb69('0x17')]!=_0xeb69('0x18')){utils[_0xeb69('0x8')](util['format'](_0xeb69('0x19'),_0x2a0de9['uniqueid'],_0x2a0de9[_0xeb69('0x1a')],_0x2a0de9[_0xeb69('0x1b')]));channels[_0x2a0de9[_0xeb69('0x7')]]={'uniqueid':_0x2a0de9['uniqueid'],'accountcode':_0x2a0de9[_0xeb69('0xd')],'source':_0x2a0de9['calleridnum'],'destination':_0x2a0de9[_0xeb69('0x1b')],'destinationcontext':_0x2a0de9[_0xeb69('0x1a')],'channel':_0x2a0de9[_0xeb69('0x17')],'starttime':utils[_0xeb69('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xeb69('0x3'),'amaflags':_0xeb69('0x1d')};}}catch(_0x8a81cf){utils[_0xeb69('0x1e')](util[_0xeb69('0x9')]('[%s][calls][newchannel]',_0x2a0de9[_0xeb69('0x7')]),_0x8a81cf);}};exports['newstate']=function(_0x1b679b){try{utils[_0xeb69('0x14')](util[_0xeb69('0x9')](_0xeb69('0x1f'),_0x1b679b[_0xeb69('0x7')]),_0x1b679b);if(!_[_0xeb69('0x20')](channels[_0x1b679b['uniqueid']])&&_0x1b679b[_0xeb69('0x21')]==0x6){utils[_0xeb69('0x8')](util[_0xeb69('0x9')](_0xeb69('0x22'),_0x1b679b[_0xeb69('0x7')],_0x1b679b[_0xeb69('0x1a')],_0x1b679b[_0xeb69('0x17')]));if(_[_0xeb69('0x20')](channels[_0x1b679b['uniqueid']][_0xeb69('0x23')])){channels[_0x1b679b['uniqueid']][_0xeb69('0x23')]=utils[_0xeb69('0x1c')]();}}else if(!_['isNil'](channels[_0x1b679b[_0xeb69('0x16')]])&&_0x1b679b[_0xeb69('0x21')]==0x6&&_0x1b679b[_0xeb69('0x1a')]!=_0xeb69('0x24')){utils['info'](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1b679b[_0xeb69('0x7')],_0x1b679b['linkedid'],_0x1b679b[_0xeb69('0x1a')],_0x1b679b[_0xeb69('0x17')]));channels[_0x1b679b['linkedid']]['accountcode']=_0x1b679b[_0xeb69('0xd')];channels[_0x1b679b['linkedid']][_0xeb69('0x25')]=_0x1b679b[_0xeb69('0x17')];if(_[_0xeb69('0x20')](channels[_0x1b679b[_0xeb69('0x16')]][_0xeb69('0x26')])){channels[_0x1b679b['linkedid']][_0xeb69('0x26')]=utils[_0xeb69('0x1c')]();}channels[_0x1b679b[_0xeb69('0x16')]]['disposition']=dispositions[_['toNumber'](_0x1b679b[_0xeb69('0x21')])]||'ANSWERED';}}catch(_0x2969d1){utils['error'](util[_0xeb69('0x9')]('[%s][calls][newstate]',_0x1b679b[_0xeb69('0x7')]),_0x2969d1);}};exports[_0xeb69('0x27')]=function(_0x5b5ae0){try{if(!_[_0xeb69('0x20')](channels[_0x5b5ae0[_0xeb69('0x7')]])){utils[_0xeb69('0x14')](util[_0xeb69('0x9')](_0xeb69('0x28'),_0x5b5ae0['uniqueid']),_0x5b5ae0);if(_[_0xeb69('0x20')](channels[_0x5b5ae0[_0xeb69('0x7')]]['callerid'])){channels[_0x5b5ae0[_0xeb69('0x7')]][_0xeb69('0x29')]=_0x5b5ae0[_0xeb69('0x2a')]+'\x20<'+_0x5b5ae0[_0xeb69('0x2b')]+'>';}utils[_0xeb69('0x8')](util[_0xeb69('0x9')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x5b5ae0[_0xeb69('0x7')],channels[_0x5b5ae0[_0xeb69('0x7')]][_0xeb69('0x29')],_0x5b5ae0['cause-txt']));channels[_0x5b5ae0[_0xeb69('0x7')]]['endtime']=utils[_0xeb69('0x1c')]();channels[_0x5b5ae0[_0xeb69('0x7')]][_0xeb69('0x2c')]=utils[_0xeb69('0x2d')](channels[_0x5b5ae0[_0xeb69('0x7')]][_0xeb69('0x2e')],channels[_0x5b5ae0[_0xeb69('0x7')]]['starttime']);channels[_0x5b5ae0[_0xeb69('0x7')]]['billableseconds']=channels[_0x5b5ae0[_0xeb69('0x7')]][_0xeb69('0x26')]?utils[_0xeb69('0x2d')](channels[_0x5b5ae0['uniqueid']][_0xeb69('0x2e')],channels[_0x5b5ae0[_0xeb69('0x7')]][_0xeb69('0x26')]):0x0;writeDB(channels[_0x5b5ae0[_0xeb69('0x7')]]);}}catch(_0x23cf94){utils['error'](util[_0xeb69('0x9')](_0xeb69('0x28'),_0x5b5ae0[_0xeb69('0x7')]),_0x23cf94);}};exports[_0xeb69('0x2f')]=function(_0x180cf4){try{if(!_[_0xeb69('0x20')](channels[_0x180cf4[_0xeb69('0x30')]])){utils[_0xeb69('0x14')](util[_0xeb69('0x9')]('[%s][calls][attendedtransfer]',_0x180cf4[_0xeb69('0x31')]),_0x180cf4);if(channels[_0x180cf4[_0xeb69('0x30')]][_0xeb69('0x17')]==_0x180cf4['transfereechannel']){utils[_0xeb69('0x8')](util[_0xeb69('0x9')](_0xeb69('0x32'),_0x180cf4[_0xeb69('0x31')],_0x180cf4[_0xeb69('0x30')],_0x180cf4[_0xeb69('0x33')]));channels[_0x180cf4[_0xeb69('0x30')]][_0xeb69('0x25')]=_0x180cf4[_0xeb69('0x33')];channels[_0x180cf4['localtwolinkedid']][_0xeb69('0x34')]=_0xeb69('0x35');}else if(channels[_0x180cf4[_0xeb69('0x30')]][_0xeb69('0x17')]=_0x180cf4[_0xeb69('0x36')]){utils[_0xeb69('0x8')](util[_0xeb69('0x9')](_0xeb69('0x32'),_0x180cf4[_0xeb69('0x31')],_0x180cf4['localtwolinkedid'],_0x180cf4[_0xeb69('0x37')]));channels[_0x180cf4['localtwolinkedid']][_0xeb69('0x25')]=_0x180cf4[_0xeb69('0x37')];channels[_0x180cf4[_0xeb69('0x30')]][_0xeb69('0x34')]='_attended';}}}catch(_0x42a6d8){utils[_0xeb69('0x1e')](util[_0xeb69('0x9')](_0xeb69('0x38'),_0x180cf4[_0xeb69('0x31')]),_0x42a6d8);}};exports[_0xeb69('0x39')]=function(_0xc777f4){try{if(!_['isNil'](channels[_0xc777f4[_0xeb69('0x7')]])){utils[_0xeb69('0x14')](util['format']('[%s][calls][musiconholdstart]',_0xc777f4[_0xeb69('0x7')]),_0xc777f4);channels[_0xc777f4[_0xeb69('0x7')]][_0xeb69('0x3a')]=utils[_0xeb69('0x1c')]();utils[_0xeb69('0x8')](util['format']('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0xc777f4[_0xeb69('0x7')],channels[_0xc777f4[_0xeb69('0x7')]][_0xeb69('0x3a')]));}}catch(_0xef3cf8){utils[_0xeb69('0x1e')](util['format'](_0xeb69('0x3b'),_0xc777f4['uniqueid']),_0xef3cf8);}};exports['musiconholdstop']=function(_0x3384a6){try{if(!_[_0xeb69('0x20')](channels[_0x3384a6['uniqueid']])){utils[_0xeb69('0x14')](util[_0xeb69('0x9')](_0xeb69('0x3c'),_0x3384a6[_0xeb69('0x7')]),_0x3384a6);if(!_['isNil'](channels[_0x3384a6['uniqueid']][_0xeb69('0x3a')])){channels[_0x3384a6[_0xeb69('0x7')]][_0xeb69('0x3d')]+=utils[_0xeb69('0x2d')](utils[_0xeb69('0x1c')](),channels[_0x3384a6[_0xeb69('0x7')]][_0xeb69('0x3a')]);utils[_0xeb69('0x8')](util['format']('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x3384a6[_0xeb69('0x7')],channels[_0x3384a6[_0xeb69('0x7')]][_0xeb69('0x3d')]));delete channels[_0x3384a6[_0xeb69('0x7')]][_0xeb69('0x3a')];}}}catch(_0x57b391){utils['error'](util['format'](_0xeb69('0x3c'),_0x3384a6['uniqueid']),_0x57b391);}};exports[_0xeb69('0x3e')]=function(_0xdc47c6){try{if(!_['isNil'](channels[_0xdc47c6['uniqueid']])){utils[_0xeb69('0x14')](util[_0xeb69('0x9')](_0xeb69('0x3f'),_0xdc47c6[_0xeb69('0x7')]),_0xdc47c6);if(!_['isNil'](_0xdc47c6[_0xeb69('0x40')][_0xeb69('0x41')])){utils[_0xeb69('0x8')](util[_0xeb69('0x9')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0xdc47c6[_0xeb69('0x7')],_0xdc47c6[_0xeb69('0x42')]));channels[_0xdc47c6[_0xeb69('0x7')]][_0xeb69('0x43')]=_0xdc47c6[_0xeb69('0x42')];}if(!_[_0xeb69('0x20')](_0xdc47c6[_0xeb69('0x40')][_0xeb69('0x44')])){utils['info'](util[_0xeb69('0x9')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0xdc47c6[_0xeb69('0x7')],_0xdc47c6[_0xeb69('0x42')]));channels[_0xdc47c6[_0xeb69('0x7')]][_0xeb69('0x45')]=_0xdc47c6['value'];channels[_0xdc47c6[_0xeb69('0x7')]][_0xeb69('0x29')]='\x22'+_0xdc47c6[_0xeb69('0x42')]+_0xeb69('0x46')+_0xdc47c6[_0xeb69('0x42')]+'>';}if(!_[_0xeb69('0x20')](_0xdc47c6['variable'][_0xeb69('0x47')])||!_[_0xeb69('0x20')](_0xdc47c6[_0xeb69('0x40')][_0xeb69('0x48')])){utils['info'](util[_0xeb69('0x9')](_0xeb69('0x49'),_0xdc47c6['uniqueid'],!_[_0xeb69('0x20')](_0xdc47c6[_0xeb69('0x40')][_0xeb69('0x47')])?_0xeb69('0x47'):_0xeb69('0x48'),_0xdc47c6[_0xeb69('0x42')]));channels[_0xdc47c6[_0xeb69('0x7')]]['callerid']=_0xdc47c6[_0xeb69('0x42')];}if(!_['isNil'](_0xdc47c6['variable'][_0xeb69('0x4a')])||!_[_0xeb69('0x20')](_0xdc47c6[_0xeb69('0x40')][_0xeb69('0x4b')])){utils[_0xeb69('0x8')](util['format'](_0xeb69('0x49'),_0xdc47c6[_0xeb69('0x7')],!_[_0xeb69('0x20')](_0xdc47c6[_0xeb69('0x40')][_0xeb69('0x4a')])?_0xeb69('0x4a'):_0xeb69('0x4b'),_0xdc47c6['value']));channels[_0xdc47c6[_0xeb69('0x7')]][_0xeb69('0x4c')]=_0xeb69('0x4d');channels[_0xdc47c6[_0xeb69('0x7')]][_0xeb69('0x4e')]=_0xdc47c6[_0xeb69('0x42')];channels[_0xdc47c6[_0xeb69('0x7')]][_0xeb69('0xa')]=!![];}if(!_[_0xeb69('0x20')](_0xdc47c6[_0xeb69('0x40')][_0xeb69('0x4f')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0xdc47c6[_0xeb69('0x7')],_0xdc47c6['value']));channels[_0xdc47c6[_0xeb69('0x7')]]['ContactId']=_0xdc47c6[_0xeb69('0x42')];}if(!_['isNil'](_0xdc47c6[_0xeb69('0x40')][_0xeb69('0x50')])){utils[_0xeb69('0x8')](util[_0xeb69('0x9')](_0xeb69('0x51'),_0xdc47c6[_0xeb69('0x7')],_0xdc47c6[_0xeb69('0x42')]));channels[_0xdc47c6['uniqueid']][_0xeb69('0x52')]=_0xdc47c6['value'];}if(!_[_0xeb69('0x20')](_0xdc47c6[_0xeb69('0x40')]['outboundrouteid'])){utils[_0xeb69('0x8')](util[_0xeb69('0x9')](_0xeb69('0x53'),_0xdc47c6[_0xeb69('0x7')],_0xdc47c6[_0xeb69('0x42')]));channels[_0xdc47c6[_0xeb69('0x7')]]['routeid']=_0xdc47c6[_0xeb69('0x42')];}if(!_[_0xeb69('0x20')](_0xdc47c6['variable'][_0xeb69('0x54')])){utils[_0xeb69('0x8')](util[_0xeb69('0x9')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0xdc47c6[_0xeb69('0x7')],_0xdc47c6[_0xeb69('0x42')]));channels[_0xdc47c6['uniqueid']]['sipcallid']=_0xdc47c6[_0xeb69('0x42')];}}}catch(_0x98ddc5){utils[_0xeb69('0x1e')](util[_0xeb69('0x9')](_0xeb69('0x3f'),_0xdc47c6['uniqueid']),_0x98ddc5);}};exports[_0xeb69('0x55')]=function(_0x2ff1c4){try{if(!_[_0xeb69('0x20')](channels[_0x2ff1c4[_0xeb69('0x7')]])){utils[_0xeb69('0x14')](util[_0xeb69('0x9')](_0xeb69('0x56'),_0x2ff1c4[_0xeb69('0x7')]),_0x2ff1c4);utils['info'](util[_0xeb69('0x9')](_0xeb69('0x57'),_0x2ff1c4['uniqueid'],_0x2ff1c4[_0xeb69('0x58')],_0x2ff1c4[_0xeb69('0x59')]));if(_0x2ff1c4[_0xeb69('0x58')]['toLowerCase']()==_0xeb69('0x5a')&&_[_0xeb69('0x5b')](_0x2ff1c4[_0xeb69('0x59')]['toLowerCase'](),'cdr')){var _0x157d70=_0x2ff1c4[_0xeb69('0x59')][_0xeb69('0x5c')]('=');var _0x2e76e7=_0x157d70[0x0][_0xeb69('0x5d')](_0x157d70[0x0][_0xeb69('0x5e')]('(')+0x1,_0x157d70[0x0]['lastIndexOf'](')'));var _0x8d10a0=_0x157d70[0x1];channels[_0x2ff1c4[_0xeb69('0x7')]][_0x2e76e7]=_0x8d10a0;}if(!_[_0xeb69('0x5f')]([_0xeb69('0x27'),_0xeb69('0x60'),_0xeb69('0x61'),_0xeb69('0x5a'),_0xeb69('0x62')],_0x2ff1c4[_0xeb69('0x58')][_0xeb69('0x63')]())){channels[_0x2ff1c4['uniqueid']][_0xeb69('0x4c')]=_0x2ff1c4['application'];channels[_0x2ff1c4[_0xeb69('0x7')]][_0xeb69('0x4e')]=_0x2ff1c4[_0xeb69('0x59')];}}}catch(_0x2947c5){utils[_0xeb69('0x1e')](util[_0xeb69('0x9')](_0xeb69('0x56'),_0x2ff1c4[_0xeb69('0x7')]),_0x2947c5);}}; \ No newline at end of file +var _0xf163=['exten','context','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','isNil','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','ANSWERED','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','musiconholdstartAt','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','application','appdata','set','cdr','split','lastIndexOf','includes','noop','execif','gotoif','lodash','./utils','./transfers.controller','NO\x20ANSWER','FAILED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf163,0x129));var _0x3f16=function(_0x32c012,_0xe3c576){_0x32c012=_0x32c012-0x0;var _0x48562e=_0xf163[_0x32c012];return _0x48562e;};'use strict';var _=require(_0x3f16('0x0'));var util=require('util');var utils=require(_0x3f16('0x1'));var transfers=require(_0x3f16('0x2'));var dispositions=[_0x3f16('0x3'),_0x3f16('0x4'),_0x3f16('0x4'),'NO\x20ANSWER',_0x3f16('0x3'),_0x3f16('0x3'),'ANSWERED',_0x3f16('0x5'),_0x3f16('0x4'),_0x3f16('0x4'),_0x3f16('0x4')];var channels={};function writeDB(_0x401a6c){var _0x328f62;if(transfers[_0x3f16('0x6')][_0x401a6c[_0x3f16('0x7')]]){_0x328f62=_0x401a6c[_0x3f16('0x7')];_0x401a6c[_0x3f16('0x7')]=transfers['blinds'][_0x401a6c[_0x3f16('0x7')]][_0x3f16('0x8')];}utils[_0x3f16('0x9')](util[_0x3f16('0xa')](_0x3f16('0xb'),_0x401a6c[_0x3f16('0x7')],_0x401a6c['channel'],_0x401a6c[_0x3f16('0xc')],_0x401a6c['membername'],_0x401a6c[_0x3f16('0xd')],_0x401a6c[_0x3f16('0xe')],_0x401a6c[_0x3f16('0xf')],_0x401a6c[_0x3f16('0x10')]));if(_0x401a6c[_0x3f16('0x11')]){utils[_0x3f16('0x12')](_0x401a6c['accountcode'])[_0x3f16('0x13')](function(_0x36a20b){if(_0x36a20b){_0x401a6c[_0x3f16('0x14')]=_0x36a20b['id'];}utils[_0x3f16('0x15')](_0x3f16('0x16'),_0x401a6c);});}else{utils['request'](_0x3f16('0x16'),_0x401a6c);}if(channels[_0x401a6c['uniqueid']]){delete channels[_0x401a6c[_0x3f16('0x7')]];}else if(_0x328f62&&channels[_0x328f62]){if(!transfers[_0x3f16('0x6')][_0x328f62][_0x3f16('0x17')])delete transfers[_0x3f16('0x6')][_0x328f62];delete channels[_0x328f62];}}exports[_0x3f16('0x18')]=function(_0x164041){try{utils[_0x3f16('0x19')](util[_0x3f16('0xa')](_0x3f16('0x1a'),_0x164041[_0x3f16('0x7')]),_0x164041);if(_0x164041[_0x3f16('0x7')]==_0x164041[_0x3f16('0x1b')]&&_0x164041[_0x3f16('0x1c')]!=_0x3f16('0x1d')){utils[_0x3f16('0x9')](util[_0x3f16('0xa')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x164041[_0x3f16('0x7')],_0x164041['context'],_0x164041[_0x3f16('0x1e')]));channels[_0x164041[_0x3f16('0x7')]]={'uniqueid':_0x164041[_0x3f16('0x7')],'accountcode':_0x164041[_0x3f16('0x11')],'source':_0x164041['calleridnum'],'destination':_0x164041[_0x3f16('0x1e')],'destinationcontext':_0x164041[_0x3f16('0x1f')],'channel':_0x164041[_0x3f16('0x1c')],'starttime':utils[_0x3f16('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x3f16('0x3'),'amaflags':_0x3f16('0x21')};}}catch(_0xa2a3b7){utils[_0x3f16('0x22')](util[_0x3f16('0xa')](_0x3f16('0x1a'),_0x164041['uniqueid']),_0xa2a3b7);}};exports[_0x3f16('0x23')]=function(_0x4a9766){try{utils[_0x3f16('0x19')](util[_0x3f16('0xa')](_0x3f16('0x24'),_0x4a9766[_0x3f16('0x7')]),_0x4a9766);if(!_['isNil'](channels[_0x4a9766['uniqueid']])&&_0x4a9766[_0x3f16('0x25')]==0x6){utils[_0x3f16('0x9')](util[_0x3f16('0xa')](_0x3f16('0x26'),_0x4a9766[_0x3f16('0x7')],_0x4a9766[_0x3f16('0x1f')],_0x4a9766[_0x3f16('0x1c')]));if(_['isNil'](channels[_0x4a9766[_0x3f16('0x7')]][_0x3f16('0x27')])){channels[_0x4a9766['uniqueid']]['systemanswertime']=utils[_0x3f16('0x20')]();}}else if(!_[_0x3f16('0x28')](channels[_0x4a9766['linkedid']])&&_0x4a9766['channelstate']==0x6&&_0x4a9766[_0x3f16('0x1f')]!=_0x3f16('0x29')){utils['info'](util['format'](_0x3f16('0x2a'),_0x4a9766[_0x3f16('0x7')],_0x4a9766[_0x3f16('0x1b')],_0x4a9766[_0x3f16('0x1f')],_0x4a9766[_0x3f16('0x1c')]));channels[_0x4a9766[_0x3f16('0x1b')]]['accountcode']=_0x4a9766[_0x3f16('0x11')];channels[_0x4a9766[_0x3f16('0x1b')]][_0x3f16('0x2b')]=_0x4a9766[_0x3f16('0x1c')];if(_[_0x3f16('0x28')](channels[_0x4a9766[_0x3f16('0x1b')]][_0x3f16('0x2c')])){channels[_0x4a9766[_0x3f16('0x1b')]][_0x3f16('0x2c')]=utils['now']();}channels[_0x4a9766['linkedid']][_0x3f16('0x2d')]=dispositions[_[_0x3f16('0x2e')](_0x4a9766['channelstate'])]||_0x3f16('0x2f');}}catch(_0x12fcd3){utils[_0x3f16('0x22')](util[_0x3f16('0xa')](_0x3f16('0x24'),_0x4a9766[_0x3f16('0x7')]),_0x12fcd3);}};exports['hangup']=function(_0xb8ca5c){try{if(!_[_0x3f16('0x28')](channels[_0xb8ca5c[_0x3f16('0x7')]])){utils[_0x3f16('0x19')](util[_0x3f16('0xa')](_0x3f16('0x30'),_0xb8ca5c[_0x3f16('0x7')]),_0xb8ca5c);if(_[_0x3f16('0x28')](channels[_0xb8ca5c[_0x3f16('0x7')]][_0x3f16('0x31')])){channels[_0xb8ca5c[_0x3f16('0x7')]][_0x3f16('0x31')]=_0xb8ca5c['calleridname']+'\x20<'+_0xb8ca5c[_0x3f16('0xe')]+'>';}utils[_0x3f16('0x9')](util[_0x3f16('0xa')](_0x3f16('0x32'),_0xb8ca5c[_0x3f16('0x7')],channels[_0xb8ca5c[_0x3f16('0x7')]][_0x3f16('0x31')],_0xb8ca5c[_0x3f16('0x33')]));channels[_0xb8ca5c['uniqueid']][_0x3f16('0x34')]=utils[_0x3f16('0x20')]();channels[_0xb8ca5c[_0x3f16('0x7')]][_0x3f16('0x35')]=utils[_0x3f16('0x36')](channels[_0xb8ca5c['uniqueid']][_0x3f16('0x34')],channels[_0xb8ca5c[_0x3f16('0x7')]][_0x3f16('0x37')]);channels[_0xb8ca5c[_0x3f16('0x7')]]['billableseconds']=channels[_0xb8ca5c[_0x3f16('0x7')]][_0x3f16('0x2c')]?utils[_0x3f16('0x36')](channels[_0xb8ca5c[_0x3f16('0x7')]]['endtime'],channels[_0xb8ca5c['uniqueid']][_0x3f16('0x2c')]):0x0;writeDB(channels[_0xb8ca5c[_0x3f16('0x7')]]);}}catch(_0x26cbf2){utils[_0x3f16('0x22')](util[_0x3f16('0xa')](_0x3f16('0x30'),_0xb8ca5c[_0x3f16('0x7')]),_0x26cbf2);}};exports['attendedtransfer']=function(_0x45b45f){try{if(!_['isNil'](channels[_0x45b45f[_0x3f16('0x38')]])){utils[_0x3f16('0x19')](util[_0x3f16('0xa')](_0x3f16('0x39'),_0x45b45f[_0x3f16('0x3a')]),_0x45b45f);if(channels[_0x45b45f['localtwolinkedid']][_0x3f16('0x1c')]==_0x45b45f[_0x3f16('0x3b')]){utils[_0x3f16('0x9')](util[_0x3f16('0xa')](_0x3f16('0x3c'),_0x45b45f['origtransfereruniqueid'],_0x45b45f[_0x3f16('0x38')],_0x45b45f[_0x3f16('0x3d')]));channels[_0x45b45f[_0x3f16('0x38')]]['destinationchannel']=_0x45b45f['secondtransfererchannel'];channels[_0x45b45f[_0x3f16('0x38')]]['userfield']=_0x3f16('0x3e');}else if(channels[_0x45b45f[_0x3f16('0x38')]][_0x3f16('0x1c')]=_0x45b45f[_0x3f16('0x3f')]){utils['info'](util[_0x3f16('0xa')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x45b45f[_0x3f16('0x3a')],_0x45b45f['localtwolinkedid'],_0x45b45f[_0x3f16('0x40')]));channels[_0x45b45f[_0x3f16('0x38')]]['destinationchannel']=_0x45b45f['origtransfererchannel'];channels[_0x45b45f[_0x3f16('0x38')]][_0x3f16('0x41')]=_0x3f16('0x3e');}}}catch(_0x4f5572){utils[_0x3f16('0x22')](util[_0x3f16('0xa')](_0x3f16('0x39'),_0x45b45f[_0x3f16('0x3a')]),_0x4f5572);}};exports[_0x3f16('0x42')]=function(_0x54fa61){try{if(!_[_0x3f16('0x28')](channels[_0x54fa61['uniqueid']])){utils['debug'](util['format']('[%s][calls][musiconholdstart]',_0x54fa61[_0x3f16('0x7')]),_0x54fa61);channels[_0x54fa61[_0x3f16('0x7')]]['musiconholdstartAt']=utils['now']();utils[_0x3f16('0x9')](util[_0x3f16('0xa')](_0x3f16('0x43'),_0x54fa61[_0x3f16('0x7')],channels[_0x54fa61[_0x3f16('0x7')]]['musiconholdstartAt']));}}catch(_0x315563){utils[_0x3f16('0x22')](util[_0x3f16('0xa')]('[%s][calls][musiconholdstart]',_0x54fa61[_0x3f16('0x7')]),_0x315563);}};exports[_0x3f16('0x44')]=function(_0x32beb6){try{if(!_['isNil'](channels[_0x32beb6[_0x3f16('0x7')]])){utils[_0x3f16('0x19')](util[_0x3f16('0xa')](_0x3f16('0x45'),_0x32beb6[_0x3f16('0x7')]),_0x32beb6);if(!_[_0x3f16('0x28')](channels[_0x32beb6['uniqueid']][_0x3f16('0x46')])){channels[_0x32beb6[_0x3f16('0x7')]][_0x3f16('0x47')]+=utils['diffTime'](utils[_0x3f16('0x20')](),channels[_0x32beb6[_0x3f16('0x7')]]['musiconholdstartAt']);utils['info'](util[_0x3f16('0xa')](_0x3f16('0x48'),_0x32beb6[_0x3f16('0x7')],channels[_0x32beb6[_0x3f16('0x7')]]['mohtime']));delete channels[_0x32beb6[_0x3f16('0x7')]][_0x3f16('0x46')];}}}catch(_0xb11bd8){utils[_0x3f16('0x22')](util[_0x3f16('0xa')](_0x3f16('0x45'),_0x32beb6[_0x3f16('0x7')]),_0xb11bd8);}};exports['varset']=function(_0x3e0f0c){try{if(!_[_0x3f16('0x28')](channels[_0x3e0f0c['uniqueid']])){utils[_0x3f16('0x19')](util[_0x3f16('0xa')]('[%s][calls][varset]',_0x3e0f0c['uniqueid']),_0x3e0f0c);if(!_['isNil'](_0x3e0f0c[_0x3f16('0x49')][_0x3f16('0x4a')])){utils[_0x3f16('0x9')](util[_0x3f16('0xa')](_0x3f16('0x4b'),_0x3e0f0c[_0x3f16('0x7')],_0x3e0f0c[_0x3f16('0x4c')]));channels[_0x3e0f0c[_0x3f16('0x7')]][_0x3f16('0x4d')]=_0x3e0f0c['value'];}if(!_[_0x3f16('0x28')](_0x3e0f0c['variable']['xmd-phone'])){utils[_0x3f16('0x9')](util[_0x3f16('0xa')](_0x3f16('0x4e'),_0x3e0f0c['uniqueid'],_0x3e0f0c[_0x3f16('0x4c')]));channels[_0x3e0f0c[_0x3f16('0x7')]][_0x3f16('0x4f')]=_0x3e0f0c['value'];channels[_0x3e0f0c['uniqueid']][_0x3f16('0x31')]='\x22'+_0x3e0f0c[_0x3f16('0x4c')]+_0x3f16('0x50')+_0x3e0f0c[_0x3f16('0x4c')]+'>';}if(!_['isNil'](_0x3e0f0c[_0x3f16('0x49')][_0x3f16('0x51')])||!_['isNil'](_0x3e0f0c[_0x3f16('0x49')][_0x3f16('0x52')])){utils[_0x3f16('0x9')](util['format'](_0x3f16('0x53'),_0x3e0f0c[_0x3f16('0x7')],!_[_0x3f16('0x28')](_0x3e0f0c['variable'][_0x3f16('0x51')])?_0x3f16('0x51'):_0x3f16('0x52'),_0x3e0f0c['value']));channels[_0x3e0f0c['uniqueid']][_0x3f16('0x31')]=_0x3e0f0c[_0x3f16('0x4c')];}if(!_[_0x3f16('0x28')](_0x3e0f0c['variable'][_0x3f16('0x54')])||!_[_0x3f16('0x28')](_0x3e0f0c[_0x3f16('0x49')][_0x3f16('0x55')])){utils[_0x3f16('0x9')](util[_0x3f16('0xa')](_0x3f16('0x53'),_0x3e0f0c[_0x3f16('0x7')],!_[_0x3f16('0x28')](_0x3e0f0c[_0x3f16('0x49')][_0x3f16('0x54')])?_0x3f16('0x54'):'xmcs-queue',_0x3e0f0c[_0x3f16('0x4c')]));channels[_0x3e0f0c[_0x3f16('0x7')]][_0x3f16('0x56')]=_0x3f16('0x57');channels[_0x3e0f0c[_0x3f16('0x7')]][_0x3f16('0x58')]=_0x3e0f0c['value'];channels[_0x3e0f0c['uniqueid']][_0x3f16('0xc')]=!![];}if(!_[_0x3f16('0x28')](_0x3e0f0c[_0x3f16('0x49')][_0x3f16('0x59')])){utils[_0x3f16('0x9')](util['format'](_0x3f16('0x5a'),_0x3e0f0c['uniqueid'],_0x3e0f0c[_0x3f16('0x4c')]));channels[_0x3e0f0c[_0x3f16('0x7')]][_0x3f16('0x5b')]=_0x3e0f0c['value'];}if(!_[_0x3f16('0x28')](_0x3e0f0c[_0x3f16('0x49')][_0x3f16('0x5c')])){utils[_0x3f16('0x9')](util[_0x3f16('0xa')](_0x3f16('0x5d'),_0x3e0f0c[_0x3f16('0x7')],_0x3e0f0c[_0x3f16('0x4c')]));channels[_0x3e0f0c['uniqueid']]['type']=_0x3e0f0c['value'];}if(!_['isNil'](_0x3e0f0c[_0x3f16('0x49')][_0x3f16('0x5e')])){utils['info'](util[_0x3f16('0xa')](_0x3f16('0x5f'),_0x3e0f0c[_0x3f16('0x7')],_0x3e0f0c[_0x3f16('0x4c')]));channels[_0x3e0f0c[_0x3f16('0x7')]]['routeid']=_0x3e0f0c['value'];}if(!_[_0x3f16('0x28')](_0x3e0f0c[_0x3f16('0x49')]['sipcallid'])){utils['info'](util[_0x3f16('0xa')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x3e0f0c[_0x3f16('0x7')],_0x3e0f0c['value']));channels[_0x3e0f0c[_0x3f16('0x7')]][_0x3f16('0x60')]=_0x3e0f0c[_0x3f16('0x4c')];}}}catch(_0x19fa97){utils['error'](util[_0x3f16('0xa')]('[%s][calls][varset]',_0x3e0f0c['uniqueid']),_0x19fa97);}};exports[_0x3f16('0x61')]=function(_0x432037){try{if(!_[_0x3f16('0x28')](channels[_0x432037[_0x3f16('0x7')]])){utils[_0x3f16('0x19')](util[_0x3f16('0xa')](_0x3f16('0x62'),_0x432037[_0x3f16('0x7')]),_0x432037);utils['info'](util[_0x3f16('0xa')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x432037[_0x3f16('0x7')],_0x432037[_0x3f16('0x63')],_0x432037[_0x3f16('0x64')]));if(_0x432037[_0x3f16('0x63')]['toLowerCase']()==_0x3f16('0x65')&&_['startsWith'](_0x432037[_0x3f16('0x64')]['toLowerCase'](),_0x3f16('0x66'))){var _0x50d2c2=_0x432037[_0x3f16('0x64')][_0x3f16('0x67')]('=');var _0x3f0703=_0x50d2c2[0x0]['substring'](_0x50d2c2[0x0][_0x3f16('0x68')]('(')+0x1,_0x50d2c2[0x0][_0x3f16('0x68')](')'));var _0x2304c3=_0x50d2c2[0x1];channels[_0x432037['uniqueid']][_0x3f0703]=_0x2304c3;}if(!_[_0x3f16('0x69')](['hangup',_0x3f16('0x6a'),_0x3f16('0x6b'),_0x3f16('0x65'),_0x3f16('0x6c')],_0x432037[_0x3f16('0x63')]['toLowerCase']())){channels[_0x432037[_0x3f16('0x7')]][_0x3f16('0x56')]=_0x432037[_0x3f16('0x63')];channels[_0x432037[_0x3f16('0x7')]][_0x3f16('0x58')]=_0x432037[_0x3f16('0x64')];}}}catch(_0x56e535){utils[_0x3f16('0x22')](util[_0x3f16('0xa')](_0x3f16('0x62'),_0x432037['uniqueid']),_0x56e535);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 4eced51..92744e7 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 _0x85d0=['[core]\x20fullybooted','[core]\x20error','close','managerevent','shutdown','info','[core]\x20shutdown','fullybooted'];(function(_0x2ad4d8,_0xe618b0){var _0x35eb96=function(_0x2acf80){while(--_0x2acf80){_0x2ad4d8['push'](_0x2ad4d8['shift']());}};_0x35eb96(++_0xe618b0);}(_0x85d0,0x164));var _0x085d=function(_0x240223,_0xa06f97){_0x240223=_0x240223-0x0;var _0x469fef=_0x85d0[_0x240223];return _0x469fef;};'use strict';var utils=require('./utils');exports['connect']=function(){utils['info']('[core]\x20connected');};exports[_0x085d('0x0')]=function(){utils[_0x085d('0x1')](_0x085d('0x2'));};exports[_0x085d('0x3')]=function(){utils[_0x085d('0x1')](_0x085d('0x4'));};exports['error']=function(_0x2f37ca){utils['error'](_0x085d('0x5'),_0x2f37ca);};exports[_0x085d('0x6')]=function(){utils[_0x085d('0x1')]('[core]\x20close');};exports[_0x085d('0x7')]=function(_0xa94124){}; \ No newline at end of file +var _0x39ed=['shutdown','info','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','[core]\x20connected'];(function(_0x4a2fb4,_0x1e4cb4){var _0x4ad38a=function(_0x2b6f2f){while(--_0x2b6f2f){_0x4a2fb4['push'](_0x4a2fb4['shift']());}};_0x4ad38a(++_0x1e4cb4);}(_0x39ed,0xbd));var _0xd39e=function(_0x39c7f4,_0x3b95d9){_0x39c7f4=_0x39c7f4-0x0;var _0x2a9557=_0x39ed[_0x39c7f4];return _0x2a9557;};'use strict';var utils=require(_0xd39e('0x0'));exports[_0xd39e('0x1')]=function(){utils['info'](_0xd39e('0x2'));};exports[_0xd39e('0x3')]=function(){utils[_0xd39e('0x4')]('[core]\x20shutdown');};exports[_0xd39e('0x5')]=function(){utils[_0xd39e('0x4')](_0xd39e('0x6'));};exports['error']=function(_0x53be88){utils[_0xd39e('0x7')](_0xd39e('0x8'),_0x53be88);};exports[_0xd39e('0x9')]=function(){utils[_0xd39e('0x4')](_0xd39e('0xa'));};exports[_0xd39e('0xb')]=function(_0x2bab14){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index aeb01aa..43d79e8 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 _0x7dce=['varset','[%s][dials][varset]','isNil','variable','value','[%s][dials][dialbegin]','assign','starttime','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','duration','diffTime','endtime','billableseconds','lodash','util','format','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','info','application','set','startsWith','toLowerCase','cdr(routeid)','appdata','split','error'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7dce,0x134));var _0xe7dc=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x7dce[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0xe7dc('0x0'));var util=require(_0xe7dc('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x2f2007){utils['info'](util[_0xe7dc('0x2')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x2f2007[_0xe7dc('0x3')],_0x2f2007[_0xe7dc('0x4')],_0x2f2007['dialstring'],_0x2f2007[_0xe7dc('0x5')],_0x2f2007[_0xe7dc('0x6')],_0x2f2007[_0xe7dc('0x7')]));utils[_0xe7dc('0x8')](_0xe7dc('0x9'),_0x2f2007);delete dials[_0x2f2007[_0xe7dc('0x3')]];}exports['newexten']=function(_0x5f5954){try{utils[_0xe7dc('0xa')](util[_0xe7dc('0x2')](_0xe7dc('0xb'),_0x5f5954['uniqueid']),_0x5f5954);utils[_0xe7dc('0xc')](util[_0xe7dc('0x2')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x5f5954['uniqueid'],_0x5f5954[_0xe7dc('0xd')],_0x5f5954['appdata']));if(_0x5f5954[_0xe7dc('0xd')]['toLowerCase']()==_0xe7dc('0xe')&&_[_0xe7dc('0xf')](_0x5f5954['appdata'][_0xe7dc('0x10')](),_0xe7dc('0x11'))){var _0x3e7473=_0x5f5954[_0xe7dc('0x12')][_0xe7dc('0x13')]('=');dials[_0x5f5954[_0xe7dc('0x3')]]={'routeId':_0x3e7473[0x1]};}}catch(_0x564e30){utils[_0xe7dc('0x14')](util[_0xe7dc('0x2')]('[%s][dials][newexten]',_0x5f5954[_0xe7dc('0x3')]),_0x564e30);}};exports[_0xe7dc('0x15')]=function(_0x30f54a){try{utils['debug'](util[_0xe7dc('0x2')](_0xe7dc('0x16'),_0x30f54a['uniqueid']),_0x30f54a);if(!_[_0xe7dc('0x17')](_0x30f54a[_0xe7dc('0x18')]['outboundrouteid'])){utils[_0xe7dc('0xc')](util[_0xe7dc('0x2')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x30f54a[_0xe7dc('0x3')],_0x30f54a[_0xe7dc('0x19')]));dials[_0x30f54a[_0xe7dc('0x3')]]={'routeId':_0x30f54a[_0xe7dc('0x19')]};}}catch(_0x2b42d5){utils[_0xe7dc('0x14')](util[_0xe7dc('0x2')](_0xe7dc('0x16'),_0x30f54a['uniqueid']),_0x2b42d5);}};exports['dialbegin']=function(_0x2aaf69){try{if(!_[_0xe7dc('0x17')](dials[_0x2aaf69['uniqueid']])){utils[_0xe7dc('0xa')](util[_0xe7dc('0x2')](_0xe7dc('0x1a'),_0x2aaf69[_0xe7dc('0x3')]),_0x2aaf69);dials[_0x2aaf69[_0xe7dc('0x3')]]=_[_0xe7dc('0x1b')](dials[_0x2aaf69[_0xe7dc('0x3')]],_0x2aaf69);dials[_0x2aaf69[_0xe7dc('0x3')]][_0xe7dc('0x1c')]=utils[_0xe7dc('0x1d')]();dials[_0x2aaf69['uniqueid']]['lastevent']=_0xe7dc('0x1e');utils['info'](util[_0xe7dc('0x2')](_0xe7dc('0x1f'),_0x2aaf69['uniqueid'],dials[_0x2aaf69[_0xe7dc('0x3')]][_0xe7dc('0x1c')]));}}catch(_0x30af1f){utils[_0xe7dc('0x14')](util[_0xe7dc('0x2')](_0xe7dc('0x1a'),_0x2aaf69['uniqueid']),_0x30af1f);}};exports[_0xe7dc('0x20')]=function(_0x4cff78){try{if(!_[_0xe7dc('0x17')](dials[_0x4cff78[_0xe7dc('0x3')]])){utils['debug'](util['format'](_0xe7dc('0x21'),_0x4cff78['uniqueid']),_0x4cff78);dials[_0x4cff78['uniqueid']][_0xe7dc('0x7')]=_0x4cff78[_0xe7dc('0x7')];if(_0x4cff78[_0xe7dc('0x7')]=='ANSWER'){dials[_0x4cff78[_0xe7dc('0x3')]]=_['assign'](dials[_0x4cff78[_0xe7dc('0x3')]],_0x4cff78);dials[_0x4cff78[_0xe7dc('0x3')]][_0xe7dc('0x22')]=utils[_0xe7dc('0x1d')]();dials[_0x4cff78['uniqueid']][_0xe7dc('0x23')]=_0xe7dc('0x24');utils[_0xe7dc('0xc')](util['format']('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x4cff78[_0xe7dc('0x3')],_0x4cff78[_0xe7dc('0x7')],dials[_0x4cff78[_0xe7dc('0x3')]]['answertime']));}else{utils[_0xe7dc('0xc')](util[_0xe7dc('0x2')](_0xe7dc('0x25'),_0x4cff78[_0xe7dc('0x3')],_0x4cff78[_0xe7dc('0x7')]));}}}catch(_0x296a4f){utils[_0xe7dc('0x14')](util[_0xe7dc('0x2')]('[%s][dials][dialend]',_0x4cff78[_0xe7dc('0x3')]),_0x296a4f);}};exports[_0xe7dc('0x26')]=function(_0x562eee){try{if(!_['isNil'](dials[_0x562eee[_0xe7dc('0x3')]])){utils[_0xe7dc('0xa')](util[_0xe7dc('0x2')](_0xe7dc('0x27'),_0x562eee[_0xe7dc('0x3')]),_0x562eee);utils['info'](util[_0xe7dc('0x2')](_0xe7dc('0x28'),_0x562eee[_0xe7dc('0x3')],_0x562eee[_0xe7dc('0x5')],_0x562eee[_0xe7dc('0x29')],_0x562eee[_0xe7dc('0x2a')]));dials[_0x562eee[_0xe7dc('0x3')]]=_['assign'](dials[_0x562eee[_0xe7dc('0x3')]],{'endtime':utils[_0xe7dc('0x1d')](),'lastevent':'complete'});dials[_0x562eee[_0xe7dc('0x3')]][_0xe7dc('0x2b')]=utils[_0xe7dc('0x2c')](dials[_0x562eee[_0xe7dc('0x3')]][_0xe7dc('0x2d')],dials[_0x562eee[_0xe7dc('0x3')]][_0xe7dc('0x1c')]);dials[_0x562eee[_0xe7dc('0x3')]]['holdtime']=utils['diffTime'](dials[_0x562eee['uniqueid']][_0xe7dc('0x22')]||dials[_0x562eee['uniqueid']][_0xe7dc('0x2d')],dials[_0x562eee['uniqueid']]['starttime']);dials[_0x562eee[_0xe7dc('0x3')]][_0xe7dc('0x2e')]=dials[_0x562eee[_0xe7dc('0x3')]][_0xe7dc('0x22')]?utils['diffTime'](dials[_0x562eee[_0xe7dc('0x3')]][_0xe7dc('0x2d')],dials[_0x562eee[_0xe7dc('0x3')]][_0xe7dc('0x22')]):0x0;writeDB(dials[_0x562eee[_0xe7dc('0x3')]]);}}catch(_0x44ed3a){utils[_0xe7dc('0x14')](util[_0xe7dc('0x2')](_0xe7dc('0x27'),_0x562eee[_0xe7dc('0x3')]),_0x44ed3a);}}; \ No newline at end of file +var _0xf42c=['now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','ANSWER','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','duration','diffTime','endtime','billableseconds','lodash','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','varset','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','[%s][dials][varset]','dialbegin','assign','starttime'];(function(_0xa90789,_0x5246c9){var _0x4f63e6=function(_0x1000bd){while(--_0x1000bd){_0xa90789['push'](_0xa90789['shift']());}};_0x4f63e6(++_0x5246c9);}(_0xf42c,0x7e));var _0xcf42=function(_0x13292f,_0x203f6f){_0x13292f=_0x13292f-0x0;var _0x4a2038=_0xf42c[_0x13292f];return _0x4a2038;};'use strict';var _=require(_0xcf42('0x0'));var util=require('util');var utils=require(_0xcf42('0x1'));var dials={};function writeDB(_0x34507e){utils[_0xcf42('0x2')](util[_0xcf42('0x3')](_0xcf42('0x4'),_0x34507e[_0xcf42('0x5')],_0x34507e[_0xcf42('0x6')],_0x34507e[_0xcf42('0x7')],_0x34507e[_0xcf42('0x8')],_0x34507e[_0xcf42('0x9')],_0x34507e[_0xcf42('0xa')]));utils['request'](_0xcf42('0xb'),_0x34507e);delete dials[_0x34507e['uniqueid']];}exports[_0xcf42('0xc')]=function(_0x9ca8b3){try{utils[_0xcf42('0xd')](util['format'](_0xcf42('0xe'),_0x9ca8b3['uniqueid']),_0x9ca8b3);utils[_0xcf42('0x2')](util[_0xcf42('0x3')](_0xcf42('0xf'),_0x9ca8b3['uniqueid'],_0x9ca8b3[_0xcf42('0x10')],_0x9ca8b3[_0xcf42('0x11')]));if(_0x9ca8b3[_0xcf42('0x10')][_0xcf42('0x12')]()==_0xcf42('0x13')&&_[_0xcf42('0x14')](_0x9ca8b3[_0xcf42('0x11')]['toLowerCase'](),_0xcf42('0x15'))){var _0x161a3d=_0x9ca8b3[_0xcf42('0x11')][_0xcf42('0x16')]('=');dials[_0x9ca8b3[_0xcf42('0x5')]]={'routeId':_0x161a3d[0x1]};}}catch(_0x599111){utils['error'](util[_0xcf42('0x3')](_0xcf42('0xe'),_0x9ca8b3['uniqueid']),_0x599111);}};exports[_0xcf42('0x17')]=function(_0x3e2ab8){try{utils['debug'](util[_0xcf42('0x3')]('[%s][dials][varset]',_0x3e2ab8[_0xcf42('0x5')]),_0x3e2ab8);if(!_[_0xcf42('0x18')](_0x3e2ab8['variable'][_0xcf42('0x19')])){utils[_0xcf42('0x2')](util[_0xcf42('0x3')](_0xcf42('0x1a'),_0x3e2ab8[_0xcf42('0x5')],_0x3e2ab8['value']));dials[_0x3e2ab8[_0xcf42('0x5')]]={'routeId':_0x3e2ab8[_0xcf42('0x1b')]};}}catch(_0x436cb4){utils[_0xcf42('0x1c')](util[_0xcf42('0x3')](_0xcf42('0x1d'),_0x3e2ab8[_0xcf42('0x5')]),_0x436cb4);}};exports[_0xcf42('0x1e')]=function(_0x1b8c19){try{if(!_[_0xcf42('0x18')](dials[_0x1b8c19[_0xcf42('0x5')]])){utils[_0xcf42('0xd')](util[_0xcf42('0x3')]('[%s][dials][dialbegin]',_0x1b8c19[_0xcf42('0x5')]),_0x1b8c19);dials[_0x1b8c19[_0xcf42('0x5')]]=_[_0xcf42('0x1f')](dials[_0x1b8c19[_0xcf42('0x5')]],_0x1b8c19);dials[_0x1b8c19[_0xcf42('0x5')]][_0xcf42('0x20')]=utils[_0xcf42('0x21')]();dials[_0x1b8c19[_0xcf42('0x5')]]['lastevent']=_0xcf42('0x22');utils['info'](util[_0xcf42('0x3')](_0xcf42('0x23'),_0x1b8c19[_0xcf42('0x5')],dials[_0x1b8c19[_0xcf42('0x5')]]['starttime']));}}catch(_0x3a9583){utils[_0xcf42('0x1c')](util['format'](_0xcf42('0x24'),_0x1b8c19[_0xcf42('0x5')]),_0x3a9583);}};exports[_0xcf42('0x25')]=function(_0x46011a){try{if(!_[_0xcf42('0x18')](dials[_0x46011a[_0xcf42('0x5')]])){utils[_0xcf42('0xd')](util[_0xcf42('0x3')](_0xcf42('0x26'),_0x46011a[_0xcf42('0x5')]),_0x46011a);dials[_0x46011a[_0xcf42('0x5')]][_0xcf42('0xa')]=_0x46011a[_0xcf42('0xa')];if(_0x46011a[_0xcf42('0xa')]==_0xcf42('0x27')){dials[_0x46011a[_0xcf42('0x5')]]=_['assign'](dials[_0x46011a[_0xcf42('0x5')]],_0x46011a);dials[_0x46011a['uniqueid']][_0xcf42('0x28')]=utils[_0xcf42('0x21')]();dials[_0x46011a['uniqueid']][_0xcf42('0x29')]=_0xcf42('0x2a');utils['info'](util[_0xcf42('0x3')](_0xcf42('0x2b'),_0x46011a[_0xcf42('0x5')],_0x46011a[_0xcf42('0xa')],dials[_0x46011a[_0xcf42('0x5')]][_0xcf42('0x28')]));}else{utils[_0xcf42('0x2')](util[_0xcf42('0x3')](_0xcf42('0x2c'),_0x46011a[_0xcf42('0x5')],_0x46011a[_0xcf42('0xa')]));}}}catch(_0xa64960){utils[_0xcf42('0x1c')](util[_0xcf42('0x3')](_0xcf42('0x26'),_0x46011a[_0xcf42('0x5')]),_0xa64960);}};exports[_0xcf42('0x2d')]=function(_0x1be596){try{if(!_[_0xcf42('0x18')](dials[_0x1be596[_0xcf42('0x5')]])){utils['debug'](util[_0xcf42('0x3')](_0xcf42('0x2e'),_0x1be596[_0xcf42('0x5')]),_0x1be596);utils['info'](util[_0xcf42('0x3')](_0xcf42('0x2f'),_0x1be596[_0xcf42('0x5')],_0x1be596[_0xcf42('0x8')],_0x1be596[_0xcf42('0x30')],_0x1be596['cause-txt']));dials[_0x1be596[_0xcf42('0x5')]]=_['assign'](dials[_0x1be596[_0xcf42('0x5')]],{'endtime':utils[_0xcf42('0x21')](),'lastevent':'complete'});dials[_0x1be596['uniqueid']][_0xcf42('0x31')]=utils[_0xcf42('0x32')](dials[_0x1be596[_0xcf42('0x5')]]['endtime'],dials[_0x1be596[_0xcf42('0x5')]][_0xcf42('0x20')]);dials[_0x1be596[_0xcf42('0x5')]]['holdtime']=utils['diffTime'](dials[_0x1be596[_0xcf42('0x5')]][_0xcf42('0x28')]||dials[_0x1be596[_0xcf42('0x5')]][_0xcf42('0x33')],dials[_0x1be596[_0xcf42('0x5')]][_0xcf42('0x20')]);dials[_0x1be596[_0xcf42('0x5')]][_0xcf42('0x34')]=dials[_0x1be596[_0xcf42('0x5')]]['answertime']?utils['diffTime'](dials[_0x1be596[_0xcf42('0x5')]][_0xcf42('0x33')],dials[_0x1be596['uniqueid']][_0xcf42('0x28')]):0x0;writeDB(dials[_0x1be596[_0xcf42('0x5')]]);}}catch(_0x24971f){utils[_0xcf42('0x1c')](util['format']('[%s][dials][hangup]',_0x1be596[_0xcf42('0x5')]),_0x24971f);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index bc36c7c..84ed0a6 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 _0x41c4=['[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','shutdown','fullybooted','close','managerevent','devicestatechange','debug','format','error','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','[%s][index][newchannel]','newchannel','[%s][index][dialbegin]','[%s]dialbegin','dialend'];(function(_0xe07a08,_0x4b8bec){var _0x2f54fa=function(_0x253cc9){while(--_0x253cc9){_0xe07a08['push'](_0xe07a08['shift']());}};_0x2f54fa(++_0x4b8bec);}(_0x41c4,0xc7));var _0x441c=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x41c4[_0x3ab9ee];return _0x82ee88;};var AsteriskManager=require(_0x441c('0x0'));var config=require('../../config/environment');var utils=require(_0x441c('0x1'));var util=require(_0x441c('0x2'));var isXDREnabled=config[_0x441c('0x3')]&&config[_0x441c('0x3')][_0x441c('0x4')]?!config['xdr']['disabled']:!![];var isProduction=config[_0x441c('0x5')]===_0x441c('0x6')||![];var isLocalAsterisk=config[_0x441c('0x3')]&&config[_0x441c('0x3')][_0x441c('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x441c('0x8')][_0x441c('0x9')],config[_0x441c('0x8')]['ip'],config[_0x441c('0x8')][_0x441c('0xa')],config['asterisk'][_0x441c('0xb')],!![]);ami[_0x441c('0xc')]();if(!isXDREnabled){utils[_0x441c('0xd')](_0x441c('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x441c('0xd')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require('./agents.controller');var calls=require(_0x441c('0xf'));var queues=require(_0x441c('0x10'));var recordings=require(_0x441c('0x11'));var members=require(_0x441c('0x12'));var dials=require(_0x441c('0x13'));var transfers=require(_0x441c('0x14'));var core=require(_0x441c('0x15'));ami['on']('connect',core['connect']);ami['on']('shutdown',core[_0x441c('0x16')]);ami['on'](_0x441c('0x17'),core[_0x441c('0x17')]);ami['on']('error',core['error']);ami['on'](_0x441c('0x18'),core[_0x441c('0x18')]);ami['on']('managerevent',core[_0x441c('0x19')]);ami['on'](_0x441c('0x1a'),function(_0x335ad8){try{utils[_0x441c('0x1b')](util[_0x441c('0x1c')]('[%s][index][devicestatechange]',_0x335ad8['device']),_0x335ad8);members[_0x441c('0x1a')](_0x335ad8);}catch(_0x564d61){utils[_0x441c('0x1d')](util[_0x441c('0x1c')](_0x441c('0x1e'),_0x335ad8['device']),_0x564d61);}});ami['on'](_0x441c('0x1f'),function(_0x4a2bd9){try{utils[_0x441c('0x1b')](util[_0x441c('0x1c')](_0x441c('0x20'),_0x4a2bd9[_0x441c('0x21')]),_0x4a2bd9);agents['agentcalled'](_0x4a2bd9);}catch(_0x8acda1){utils[_0x441c('0x1d')](util['format'](_0x441c('0x20'),_0x4a2bd9[_0x441c('0x21')]),_0x8acda1);}});ami['on']('agentringnoanswer',function(_0xbc2871){try{utils['debug'](util[_0x441c('0x1c')](_0x441c('0x22'),_0xbc2871[_0x441c('0x21')]),_0xbc2871);agents[_0x441c('0x23')](_0xbc2871);}catch(_0x21e36b){utils[_0x441c('0x1d')](util[_0x441c('0x1c')](_0x441c('0x22'),_0xbc2871[_0x441c('0x21')]),_0x21e36b);}});ami['on'](_0x441c('0x24'),function(_0x224766){try{utils[_0x441c('0x1b')](util['format'](_0x441c('0x25'),_0x224766[_0x441c('0x21')]),_0x224766);agents['agentconnect'](_0x224766);queues[_0x441c('0x24')](_0x224766);}catch(_0x5e81fc){utils['error'](util[_0x441c('0x1c')](_0x441c('0x25'),_0x224766[_0x441c('0x21')]),_0x5e81fc);}});ami['on'](_0x441c('0x26'),function(_0x38888f){try{utils[_0x441c('0x1b')](util['format'](_0x441c('0x27'),_0x38888f[_0x441c('0x21')]),_0x38888f);agents[_0x441c('0x26')](_0x38888f);queues['agentcomplete'](_0x38888f);members[_0x441c('0x26')](_0x38888f);}catch(_0x28297b){utils[_0x441c('0x1d')](util[_0x441c('0x1c')](_0x441c('0x27'),_0x38888f['uniqueid']),_0x28297b);}});ami['on'](_0x441c('0x28'),function(_0x1d97c4){try{utils[_0x441c('0x1b')](util['format'](_0x441c('0x29'),_0x1d97c4[_0x441c('0x21')]),_0x1d97c4);agents[_0x441c('0x28')](_0x1d97c4);queues[_0x441c('0x28')](_0x1d97c4);}catch(_0x8c05e0){utils[_0x441c('0x1d')](util[_0x441c('0x1c')](_0x441c('0x29'),_0x1d97c4[_0x441c('0x21')]),_0x8c05e0);}});ami['on'](_0x441c('0x2a'),function(_0x382397){try{utils[_0x441c('0x1b')](util[_0x441c('0x1c')]('[%s][index][queuecallerjoin]',_0x382397[_0x441c('0x21')]),_0x382397);queues[_0x441c('0x2a')](_0x382397);recordings[_0x441c('0x2a')](_0x382397);}catch(_0x5851d4){utils[_0x441c('0x1d')](util[_0x441c('0x1c')](_0x441c('0x2b'),_0x382397['uniqueid']),_0x5851d4);}});ami['on']('queuecallerleave',function(_0x13cd8a){try{utils[_0x441c('0x1b')](util[_0x441c('0x1c')]('[%s][index][queuecallerleave]',_0x13cd8a[_0x441c('0x21')]),_0x13cd8a);queues[_0x441c('0x2c')](_0x13cd8a);}catch(_0x52ab44){utils['error'](util[_0x441c('0x1c')](_0x441c('0x2d'),_0x13cd8a['uniqueid']),_0x52ab44);}});ami['on'](_0x441c('0x2e'),function(_0x21ba4e){try{utils['debug'](util['format']('[%s][index][musiconholdstart]',_0x21ba4e[_0x441c('0x21')]),_0x21ba4e);queues[_0x441c('0x2e')](_0x21ba4e);calls[_0x441c('0x2e')](_0x21ba4e);}catch(_0x16a6b9){utils['error'](util[_0x441c('0x1c')]('[%s][index][musiconholdstart]',_0x21ba4e[_0x441c('0x21')]),_0x16a6b9);}});ami['on'](_0x441c('0x2f'),function(_0x12b199){try{utils[_0x441c('0x1b')](util[_0x441c('0x1c')]('[%s][index][musiconholdstop]',_0x12b199[_0x441c('0x21')]),_0x12b199);queues[_0x441c('0x2f')](_0x12b199);calls[_0x441c('0x2f')](_0x12b199);}catch(_0x3121b2){utils[_0x441c('0x1d')](util[_0x441c('0x1c')]('[%s][index][musiconholdstop]',_0x12b199[_0x441c('0x21')]),_0x3121b2);}});ami['on'](_0x441c('0x30'),function(_0x692076){try{utils['debug'](util[_0x441c('0x1c')](_0x441c('0x31'),_0x692076[_0x441c('0x21')]),_0x692076);calls['newstate'](_0x692076);recordings[_0x441c('0x30')](_0x692076);}catch(_0x171f52){utils[_0x441c('0x1d')](util[_0x441c('0x1c')](_0x441c('0x31'),_0x692076[_0x441c('0x21')]),_0x171f52);}});ami['on'](_0x441c('0x32'),function(_0x27fc65){try{utils[_0x441c('0x1b')](util['format']('[%s][index][hangup]',_0x27fc65['uniqueid']),_0x27fc65);calls[_0x441c('0x32')](_0x27fc65);recordings[_0x441c('0x32')](_0x27fc65);dials['hangup'](_0x27fc65);agents[_0x441c('0x32')](_0x27fc65);queues[_0x441c('0x32')](_0x27fc65);}catch(_0x276e0f){utils[_0x441c('0x1d')](util[_0x441c('0x1c')](_0x441c('0x33'),_0x27fc65['uniqueid']),_0x276e0f);}});ami['on']('cdr',function(_0x5e2e92){try{utils[_0x441c('0x1b')](util[_0x441c('0x1c')](_0x441c('0x34'),_0x5e2e92[_0x441c('0x21')]),_0x5e2e92);members['cdr'](_0x5e2e92);}catch(_0x6a69ad){utils[_0x441c('0x1d')](util[_0x441c('0x1c')](_0x441c('0x34'),_0x5e2e92['uniqueid']),_0x6a69ad);}});ami['on']('blindtransfer',function(_0x3bd29c){try{utils[_0x441c('0x1b')](util[_0x441c('0x1c')](_0x441c('0x35'),_0x3bd29c['uniqueid']),_0x3bd29c);queues[_0x441c('0x36')](_0x3bd29c);agents['blindtransfer'](_0x3bd29c);transfers[_0x441c('0x36')](_0x3bd29c);recordings[_0x441c('0x36')](_0x3bd29c);}catch(_0x129c68){utils[_0x441c('0x1d')](util['format'](_0x441c('0x35'),_0x3bd29c[_0x441c('0x21')]),_0x129c68);}});ami['on']('attendedtransfer',function(_0x5e9881){try{utils[_0x441c('0x1b')](util[_0x441c('0x1c')]('[%s][index][attendedtransfer]',_0x5e9881[_0x441c('0x37')]),_0x5e9881);queues['attendedtransfer'](_0x5e9881);transfers['attendedtransfer'](_0x5e9881);agents['attendedtransfer'](_0x5e9881);calls[_0x441c('0x38')](_0x5e9881);}catch(_0x4bc66b){utils[_0x441c('0x1d')](util[_0x441c('0x1c')]('[%s][index][attendedtransfer]',_0x5e9881['origtransfereruniqueid']),_0x4bc66b);}});ami['on'](_0x441c('0x39'),function(_0x59998d){try{utils[_0x441c('0x1b')](util[_0x441c('0x1c')](_0x441c('0x3a'),_0x59998d[_0x441c('0x21')]),_0x59998d);queues[_0x441c('0x39')](_0x59998d);recordings[_0x441c('0x39')](_0x59998d);calls[_0x441c('0x39')](_0x59998d);dials[_0x441c('0x39')](_0x59998d);}catch(_0x4ed466){utils[_0x441c('0x1d')](util['format'](_0x441c('0x3a'),_0x59998d[_0x441c('0x21')]),_0x4ed466);}});ami['on'](_0x441c('0x3b'),function(_0x467876){try{utils[_0x441c('0x1b')](util['format']('[%s][index][newexten]',_0x467876[_0x441c('0x21')]),_0x467876);calls[_0x441c('0x3b')](_0x467876);recordings[_0x441c('0x3b')](_0x467876);dials[_0x441c('0x3b')](_0x467876);}catch(_0x4efd31){utils[_0x441c('0x1d')](util['format']('[%s][index][newexten]',_0x467876[_0x441c('0x21')]),_0x4efd31);}});ami['on']('newchannel',function(_0x107727){try{utils[_0x441c('0x1b')](util['format'](_0x441c('0x3c'),_0x107727[_0x441c('0x21')]),_0x107727);calls[_0x441c('0x3d')](_0x107727);recordings[_0x441c('0x3d')](_0x107727);}catch(_0x2bccea){utils[_0x441c('0x1d')](util[_0x441c('0x1c')]('[%s][index][newchannel]',_0x107727[_0x441c('0x21')]),_0x2bccea);}});ami['on']('dialbegin',function(_0x3607b7){try{utils[_0x441c('0x1b')](util[_0x441c('0x1c')](_0x441c('0x3e'),_0x3607b7[_0x441c('0x21')]),_0x3607b7);dials['dialbegin'](_0x3607b7);}catch(_0x359bd0){utils['error'](util[_0x441c('0x1c')](_0x441c('0x3f'),_0x3607b7[_0x441c('0x21')]),_0x359bd0);}});ami['on'](_0x441c('0x40'),function(_0x42c7b3){try{utils[_0x441c('0x1b')](util['format'](_0x441c('0x41'),_0x42c7b3[_0x441c('0x21')]),_0x42c7b3);dials['dialend'](_0x42c7b3);}catch(_0x4e9a0b){utils['error'](util[_0x441c('0x1c')]('[%s][index][dialend]',_0x42c7b3['uniqueid']),_0x4e9a0b);}});} \ No newline at end of file +var _0x12f6=['close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','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]','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','local','asterisk','port','username','password','keepConnected','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error'];(function(_0x2e7c59,_0x50d616){var _0x24d628=function(_0x492269){while(--_0x492269){_0x2e7c59['push'](_0x2e7c59['shift']());}};_0x24d628(++_0x50d616);}(_0x12f6,0x1d7));var _0x612f=function(_0x399849,_0x3b630d){_0x399849=_0x399849-0x0;var _0xfbb04=_0x12f6[_0x399849];return _0xfbb04;};var AsteriskManager=require(_0x612f('0x0'));var config=require(_0x612f('0x1'));var utils=require(_0x612f('0x2'));var util=require(_0x612f('0x3'));var isXDREnabled=config[_0x612f('0x4')]&&config[_0x612f('0x4')]['disabled']?!config['xdr'][_0x612f('0x5')]:!![];var isProduction=config[_0x612f('0x6')]==='production'||![];var isLocalAsterisk=config[_0x612f('0x4')]&&config[_0x612f('0x4')][_0x612f('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x612f('0x8')][_0x612f('0x9')],config['asterisk']['ip'],config[_0x612f('0x8')][_0x612f('0xa')],config[_0x612f('0x8')][_0x612f('0xb')],!![]);ami[_0x612f('0xc')]();if(!isXDREnabled){utils['info'](_0x612f('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x612f('0xe')](_0x612f('0xf'));}else{var agents=require(_0x612f('0x10'));var calls=require(_0x612f('0x11'));var queues=require('./queues.controller');var recordings=require(_0x612f('0x12'));var members=require(_0x612f('0x13'));var dials=require(_0x612f('0x14'));var transfers=require(_0x612f('0x15'));var core=require('./core.controller');ami['on'](_0x612f('0x16'),core[_0x612f('0x16')]);ami['on'](_0x612f('0x17'),core[_0x612f('0x17')]);ami['on']('fullybooted',core[_0x612f('0x18')]);ami['on'](_0x612f('0x19'),core[_0x612f('0x19')]);ami['on'](_0x612f('0x1a'),core['close']);ami['on'](_0x612f('0x1b'),core['managerevent']);ami['on'](_0x612f('0x1c'),function(_0xfabc77){try{utils[_0x612f('0x1d')](util['format'](_0x612f('0x1e'),_0xfabc77[_0x612f('0x1f')]),_0xfabc77);members[_0x612f('0x1c')](_0xfabc77);}catch(_0x276956){utils[_0x612f('0x19')](util[_0x612f('0x20')](_0x612f('0x1e'),_0xfabc77['device']),_0x276956);}});ami['on'](_0x612f('0x21'),function(_0x507ce1){try{utils['debug'](util[_0x612f('0x20')](_0x612f('0x22'),_0x507ce1['uniqueid']),_0x507ce1);agents[_0x612f('0x21')](_0x507ce1);}catch(_0x2efb65){utils[_0x612f('0x19')](util[_0x612f('0x20')](_0x612f('0x22'),_0x507ce1[_0x612f('0x23')]),_0x2efb65);}});ami['on'](_0x612f('0x24'),function(_0x37417b){try{utils[_0x612f('0x1d')](util[_0x612f('0x20')](_0x612f('0x25'),_0x37417b[_0x612f('0x23')]),_0x37417b);agents['agentringnoanswer'](_0x37417b);}catch(_0x146078){utils[_0x612f('0x19')](util[_0x612f('0x20')]('[%s][index][agentringnoanswer]',_0x37417b[_0x612f('0x23')]),_0x146078);}});ami['on'](_0x612f('0x26'),function(_0x6a6f09){try{utils['debug'](util[_0x612f('0x20')](_0x612f('0x27'),_0x6a6f09[_0x612f('0x23')]),_0x6a6f09);agents[_0x612f('0x26')](_0x6a6f09);queues[_0x612f('0x26')](_0x6a6f09);}catch(_0x23cd85){utils[_0x612f('0x19')](util['format'](_0x612f('0x27'),_0x6a6f09[_0x612f('0x23')]),_0x23cd85);}});ami['on'](_0x612f('0x28'),function(_0x5a0865){try{utils[_0x612f('0x1d')](util['format'](_0x612f('0x29'),_0x5a0865[_0x612f('0x23')]),_0x5a0865);agents[_0x612f('0x28')](_0x5a0865);queues[_0x612f('0x28')](_0x5a0865);members[_0x612f('0x28')](_0x5a0865);}catch(_0x5022c6){utils[_0x612f('0x19')](util[_0x612f('0x20')](_0x612f('0x29'),_0x5a0865['uniqueid']),_0x5022c6);}});ami['on']('queuecallerabandon',function(_0x1f51fa){try{utils[_0x612f('0x1d')](util[_0x612f('0x20')](_0x612f('0x2a'),_0x1f51fa[_0x612f('0x23')]),_0x1f51fa);agents['queuecallerabandon'](_0x1f51fa);queues[_0x612f('0x2b')](_0x1f51fa);}catch(_0x322989){utils[_0x612f('0x19')](util['format'](_0x612f('0x2a'),_0x1f51fa[_0x612f('0x23')]),_0x322989);}});ami['on'](_0x612f('0x2c'),function(_0xc4d77f){try{utils[_0x612f('0x1d')](util[_0x612f('0x20')](_0x612f('0x2d'),_0xc4d77f[_0x612f('0x23')]),_0xc4d77f);queues[_0x612f('0x2c')](_0xc4d77f);recordings[_0x612f('0x2c')](_0xc4d77f);}catch(_0x27036a){utils[_0x612f('0x19')](util['format']('[%s][index][queuecallerjoin]',_0xc4d77f[_0x612f('0x23')]),_0x27036a);}});ami['on'](_0x612f('0x2e'),function(_0x1d8d7e){try{utils[_0x612f('0x1d')](util[_0x612f('0x20')](_0x612f('0x2f'),_0x1d8d7e[_0x612f('0x23')]),_0x1d8d7e);queues[_0x612f('0x2e')](_0x1d8d7e);}catch(_0x9c45aa){utils[_0x612f('0x19')](util[_0x612f('0x20')](_0x612f('0x2f'),_0x1d8d7e[_0x612f('0x23')]),_0x9c45aa);}});ami['on']('musiconholdstart',function(_0x3d222a){try{utils[_0x612f('0x1d')](util[_0x612f('0x20')]('[%s][index][musiconholdstart]',_0x3d222a['uniqueid']),_0x3d222a);queues['musiconholdstart'](_0x3d222a);calls[_0x612f('0x30')](_0x3d222a);}catch(_0x3bdcb3){utils[_0x612f('0x19')](util[_0x612f('0x20')](_0x612f('0x31'),_0x3d222a[_0x612f('0x23')]),_0x3bdcb3);}});ami['on'](_0x612f('0x32'),function(_0x1d2828){try{utils['debug'](util['format'](_0x612f('0x33'),_0x1d2828[_0x612f('0x23')]),_0x1d2828);queues[_0x612f('0x32')](_0x1d2828);calls[_0x612f('0x32')](_0x1d2828);}catch(_0x22be53){utils[_0x612f('0x19')](util[_0x612f('0x20')](_0x612f('0x33'),_0x1d2828[_0x612f('0x23')]),_0x22be53);}});ami['on'](_0x612f('0x34'),function(_0x3c21ca){try{utils[_0x612f('0x1d')](util['format']('[%s][index][newstate]',_0x3c21ca[_0x612f('0x23')]),_0x3c21ca);calls[_0x612f('0x34')](_0x3c21ca);recordings[_0x612f('0x34')](_0x3c21ca);}catch(_0x20a0fc){utils[_0x612f('0x19')](util[_0x612f('0x20')](_0x612f('0x35'),_0x3c21ca['uniqueid']),_0x20a0fc);}});ami['on'](_0x612f('0x36'),function(_0x41d6c9){try{utils['debug'](util['format'](_0x612f('0x37'),_0x41d6c9[_0x612f('0x23')]),_0x41d6c9);calls[_0x612f('0x36')](_0x41d6c9);recordings[_0x612f('0x36')](_0x41d6c9);dials['hangup'](_0x41d6c9);agents['hangup'](_0x41d6c9);queues[_0x612f('0x36')](_0x41d6c9);}catch(_0x163e77){utils[_0x612f('0x19')](util[_0x612f('0x20')]('[%s][index][hangup]',_0x41d6c9[_0x612f('0x23')]),_0x163e77);}});ami['on']('cdr',function(_0x39fe24){try{utils[_0x612f('0x1d')](util[_0x612f('0x20')](_0x612f('0x38'),_0x39fe24['uniqueid']),_0x39fe24);members['cdr'](_0x39fe24);}catch(_0x54630a){utils[_0x612f('0x19')](util['format'](_0x612f('0x38'),_0x39fe24[_0x612f('0x23')]),_0x54630a);}});ami['on'](_0x612f('0x39'),function(_0x3c939e){try{utils[_0x612f('0x1d')](util[_0x612f('0x20')](_0x612f('0x3a'),_0x3c939e[_0x612f('0x23')]),_0x3c939e);queues[_0x612f('0x39')](_0x3c939e);agents[_0x612f('0x39')](_0x3c939e);transfers['blindtransfer'](_0x3c939e);recordings['blindtransfer'](_0x3c939e);}catch(_0x507932){utils[_0x612f('0x19')](util[_0x612f('0x20')](_0x612f('0x3a'),_0x3c939e[_0x612f('0x23')]),_0x507932);}});ami['on'](_0x612f('0x3b'),function(_0x378414){try{utils['debug'](util[_0x612f('0x20')](_0x612f('0x3c'),_0x378414[_0x612f('0x3d')]),_0x378414);queues[_0x612f('0x3b')](_0x378414);transfers[_0x612f('0x3b')](_0x378414);agents[_0x612f('0x3b')](_0x378414);calls[_0x612f('0x3b')](_0x378414);}catch(_0xfe5069){utils[_0x612f('0x19')](util[_0x612f('0x20')](_0x612f('0x3c'),_0x378414['origtransfereruniqueid']),_0xfe5069);}});ami['on'](_0x612f('0x3e'),function(_0x4a1390){try{utils['debug'](util[_0x612f('0x20')](_0x612f('0x3f'),_0x4a1390[_0x612f('0x23')]),_0x4a1390);queues['varset'](_0x4a1390);recordings[_0x612f('0x3e')](_0x4a1390);calls[_0x612f('0x3e')](_0x4a1390);dials['varset'](_0x4a1390);}catch(_0x36ef9f){utils[_0x612f('0x19')](util[_0x612f('0x20')](_0x612f('0x3f'),_0x4a1390['uniqueid']),_0x36ef9f);}});ami['on'](_0x612f('0x40'),function(_0x5c8e13){try{utils[_0x612f('0x1d')](util['format'](_0x612f('0x41'),_0x5c8e13['uniqueid']),_0x5c8e13);calls[_0x612f('0x40')](_0x5c8e13);recordings[_0x612f('0x40')](_0x5c8e13);dials[_0x612f('0x40')](_0x5c8e13);}catch(_0x597765){utils[_0x612f('0x19')](util[_0x612f('0x20')]('[%s][index][newexten]',_0x5c8e13[_0x612f('0x23')]),_0x597765);}});ami['on'](_0x612f('0x42'),function(_0x408797){try{utils['debug'](util[_0x612f('0x20')]('[%s][index][newchannel]',_0x408797['uniqueid']),_0x408797);calls[_0x612f('0x42')](_0x408797);recordings['newchannel'](_0x408797);}catch(_0x5378ff){utils[_0x612f('0x19')](util[_0x612f('0x20')]('[%s][index][newchannel]',_0x408797[_0x612f('0x23')]),_0x5378ff);}});ami['on'](_0x612f('0x43'),function(_0x11087e){try{utils[_0x612f('0x1d')](util[_0x612f('0x20')](_0x612f('0x44'),_0x11087e[_0x612f('0x23')]),_0x11087e);dials[_0x612f('0x43')](_0x11087e);}catch(_0x50502d){utils[_0x612f('0x19')](util[_0x612f('0x20')]('[%s]dialbegin',_0x11087e[_0x612f('0x23')]),_0x50502d);}});ami['on'](_0x612f('0x45'),function(_0x328c11){try{utils['debug'](util['format'](_0x612f('0x46'),_0x328c11[_0x612f('0x23')]),_0x328c11);dials[_0x612f('0x45')](_0x328c11);}catch(_0xa33560){utils[_0x612f('0x19')](util['format'](_0x612f('0x46'),_0x328c11[_0x612f('0x23')]),_0xa33560);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index cf66c1d..c59dc08 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 _0xad68=['isNil','[%s][members][agentcomplete]','queue','assign','cdr','data1','type','data2','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','then','name','internal','CreateMemberReport','getUserByName','split','request','catch','error','[%s][members][writeDB]','debug','device','state','INUSE','BUSY','voice','now','agent','NOT_INUSE','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete'];(function(_0x573c61,_0x2f6ca6){var _0x1dd237=function(_0xe5fabb){while(--_0xe5fabb){_0x573c61['push'](_0x573c61['shift']());}};_0x1dd237(++_0x2f6ca6);}(_0xad68,0x102));var _0x8ad6=function(_0x5f44c3,_0x460f76){_0x5f44c3=_0x5f44c3-0x0;var _0x577bf7=_0xad68[_0x5f44c3];return _0x577bf7;};'use strict';var _=require(_0x8ad6('0x0'));var util=require(_0x8ad6('0x1'));var utils=require(_0x8ad6('0x2'));var members={};var exclude=[_0x8ad6('0x3'),'Queue:'];function writeDB(_0x1dcc02){utils[_0x8ad6('0x4')](util[_0x8ad6('0x5')](_0x8ad6('0x6'),_0x1dcc02[_0x8ad6('0x7')],_0x1dcc02[_0x8ad6('0x8')],_0x1dcc02[_0x8ad6('0x9')],_0x1dcc02['data2'],_0x1dcc02[_0x8ad6('0xa')],_0x1dcc02['type']));if(_0x1dcc02['interface']){utils['getUserByInterface'](_0x1dcc02[_0x8ad6('0x8')])[_0x8ad6('0xb')](function(_0x2923bc){if(_0x2923bc){_0x1dcc02[_0x8ad6('0xa')]=_0x2923bc[_0x8ad6('0xc')];_0x1dcc02[_0x8ad6('0xd')]=_0x2923bc['internal'];utils['request'](_0x8ad6('0xe'),_0x1dcc02);}else{utils[_0x8ad6('0xf')](_0x1dcc02['interface'][_0x8ad6('0x10')]('/')[0x1])[_0x8ad6('0xb')](function(_0x1cca6f){if(_0x1cca6f){_0x1dcc02['membername']=_0x1cca6f[_0x8ad6('0xc')];_0x1dcc02[_0x8ad6('0xd')]=_0x1cca6f['internal'];utils[_0x8ad6('0x11')](_0x8ad6('0xe'),_0x1dcc02);}});}})[_0x8ad6('0x12')](function(_0x1725f5){utils[_0x8ad6('0x13')](util[_0x8ad6('0x5')](_0x8ad6('0x14'),_0x1dcc02[_0x8ad6('0x7')]),_0x1725f5);});}delete members[_0x1dcc02[_0x8ad6('0x8')]];}function startsWith(_0x49ba63,_0x4bc3d1){return _['some'](_0x49ba63,function(_0x40f659){return _['startsWith'](_0x4bc3d1,_0x40f659);});}exports['devicestatechange']=function(_0x39e949){try{utils[_0x8ad6('0x15')](util[_0x8ad6('0x5')]('[%s][members][devicestatechange]',members[_0x39e949[_0x8ad6('0x16')]]?members[_0x39e949[_0x8ad6('0x16')]][_0x8ad6('0x7')]:_0x39e949[_0x8ad6('0x16')]),_0x39e949);utils[_0x8ad6('0x4')](util[_0x8ad6('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x39e949[_0x8ad6('0x16')]]?members[_0x39e949[_0x8ad6('0x16')]][_0x8ad6('0x7')]:_0x39e949[_0x8ad6('0x16')],_0x39e949[_0x8ad6('0x17')],_0x39e949[_0x8ad6('0x16')]));switch(_0x39e949[_0x8ad6('0x17')]){case _0x8ad6('0x18'):case _0x8ad6('0x19'):if(!startsWith(exclude,_0x39e949[_0x8ad6('0x16')])){members[_0x39e949[_0x8ad6('0x16')]]={'channel':_0x8ad6('0x1a'),'interface':_0x39e949[_0x8ad6('0x16')],'type':'TALKING','enterAt':utils[_0x8ad6('0x1b')](),'role':_0x8ad6('0x1c')};}break;case _0x8ad6('0x1d'):if(!_['isNil'](members[_0x39e949[_0x8ad6('0x16')]])){members[_0x39e949[_0x8ad6('0x16')]][_0x8ad6('0x1e')]=utils[_0x8ad6('0x1b')]();members[_0x39e949[_0x8ad6('0x16')]][_0x8ad6('0x1f')]=utils[_0x8ad6('0x20')](members[_0x39e949['device']]['exitAt'],members[_0x39e949[_0x8ad6('0x16')]][_0x8ad6('0x21')]);if(members[_0x39e949[_0x8ad6('0x16')]][_0x8ad6('0x7')]){writeDB(members[_0x39e949[_0x8ad6('0x16')]]);}}break;default:break;}}catch(_0x53c512){utils[_0x8ad6('0x13')](util[_0x8ad6('0x5')](_0x8ad6('0x22'),members[_0x39e949[_0x8ad6('0x16')]]?members[_0x39e949[_0x8ad6('0x16')]][_0x8ad6('0x7')]:_0x39e949[_0x8ad6('0x16')]),_0x53c512);}};exports[_0x8ad6('0x23')]=function(_0x3d793c){try{if(!_[_0x8ad6('0x24')](members[_0x3d793c['interface']])){utils['debug'](util[_0x8ad6('0x5')](_0x8ad6('0x25'),_0x3d793c['uniqueid']),_0x3d793c);utils['info'](util['format']('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x3d793c[_0x8ad6('0x7')],_0x3d793c[_0x8ad6('0x8')],_0x3d793c[_0x8ad6('0x26')]));members[_0x3d793c[_0x8ad6('0x8')]]=_[_0x8ad6('0x27')](members[_0x3d793c[_0x8ad6('0x8')]],{'data4':_0x3d793c[_0x8ad6('0x26')],'uniqueid':_0x3d793c['uniqueid']});}}catch(_0x6ce0da){utils[_0x8ad6('0x13')](util['format'](_0x8ad6('0x25'),_0x3d793c[_0x8ad6('0x7')]),_0x6ce0da);}};exports[_0x8ad6('0x28')]=function(_0x41135e){try{utils[_0x8ad6('0x15')](util[_0x8ad6('0x5')]('[%s][members][cdr]',_0x41135e[_0x8ad6('0x7')]),_0x41135e);if(_0x41135e[_0x8ad6('0x9')]){var _0x1a46f6=_0x41135e[_0x8ad6('0x9')][_0x8ad6('0x10')]('-')[0x0];if(!_[_0x8ad6('0x24')](members[_0x1a46f6])){members[_0x1a46f6]=_[_0x8ad6('0x27')](members[_0x1a46f6],{'data1':members[_0x1a46f6][_0x8ad6('0x29')]||_0x41135e[_0x8ad6('0x2a')],'data2':members[_0x1a46f6][_0x8ad6('0x2b')]||_0x41135e['source'],'data3':members[_0x1a46f6][_0x8ad6('0x2c')]||_0x41135e[_0x8ad6('0x2d')],'uniqueid':members[_0x1a46f6][_0x8ad6('0x7')]||_0x41135e[_0x8ad6('0x7')]});utils[_0x8ad6('0x4')](util[_0x8ad6('0x5')](_0x8ad6('0x2e'),_0x41135e[_0x8ad6('0x7')],members[_0x1a46f6]['data1'],members[_0x1a46f6][_0x8ad6('0x2b')],members[_0x1a46f6]['data3']));if(members[_0x1a46f6][_0x8ad6('0x1e')]){writeDB(members[_0x1a46f6]);}}}if(_0x41135e['destinationchannel']){var _0x117a7a=_0x41135e[_0x8ad6('0x2f')][_0x8ad6('0x10')]('-')[0x0];if(!_[_0x8ad6('0x24')](members[_0x117a7a])){members[_0x117a7a]=_[_0x8ad6('0x27')](members[_0x117a7a],{'data1':members[_0x117a7a][_0x8ad6('0x29')]||_0x41135e['type'],'data2':members[_0x117a7a][_0x8ad6('0x2b')]||_0x41135e['source'],'data3':members[_0x117a7a][_0x8ad6('0x2c')]||_0x41135e[_0x8ad6('0x2d')],'uniqueid':members[_0x117a7a][_0x8ad6('0x7')]||_0x41135e[_0x8ad6('0x7')]});utils[_0x8ad6('0x4')](util[_0x8ad6('0x5')](_0x8ad6('0x2e'),_0x41135e[_0x8ad6('0x7')],members[_0x117a7a][_0x8ad6('0x29')],members[_0x117a7a][_0x8ad6('0x2b')],members[_0x117a7a]['data3']));if(members[_0x117a7a][_0x8ad6('0x1e')]){writeDB(members[_0x117a7a]);}}}}catch(_0x6d21e6){utils[_0x8ad6('0x13')](util[_0x8ad6('0x5')](_0x8ad6('0x30'),_0x41135e[_0x8ad6('0x7')]),_0x6d21e6);}}; \ No newline at end of file +var _0x9e04=['assign','data1','source','data3','destination','destinationchannel','isNil','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split','then','catch','error','some','debug','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','voice','TALKING','now','agent','NOT_INUSE','exitAt','duration','diffTime','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','[%s][members][cdr]'];(function(_0x3ed7bc,_0x2d7257){var _0x58e6e1=function(_0xad2ef6){while(--_0xad2ef6){_0x3ed7bc['push'](_0x3ed7bc['shift']());}};_0x58e6e1(++_0x2d7257);}(_0x9e04,0x9e));var _0x49e0=function(_0x3a2b19,_0x3ceebd){_0x3a2b19=_0x3a2b19-0x0;var _0x5e8088=_0x9e04[_0x3a2b19];return _0x5e8088;};'use strict';var _=require(_0x49e0('0x0'));var util=require(_0x49e0('0x1'));var utils=require('./utils');var members={};var exclude=[_0x49e0('0x2'),_0x49e0('0x3')];function writeDB(_0x244796){utils['info'](util[_0x49e0('0x4')](_0x49e0('0x5'),_0x244796[_0x49e0('0x6')],_0x244796[_0x49e0('0x7')],_0x244796[_0x49e0('0x8')],_0x244796[_0x49e0('0x9')],_0x244796[_0x49e0('0xa')],_0x244796[_0x49e0('0xb')]));if(_0x244796[_0x49e0('0x7')]){utils[_0x49e0('0xc')](_0x244796['interface'])['then'](function(_0x449ec4){if(_0x449ec4){_0x244796['membername']=_0x449ec4[_0x49e0('0xd')];_0x244796['internal']=_0x449ec4[_0x49e0('0xe')];utils[_0x49e0('0xf')](_0x49e0('0x10'),_0x244796);}else{utils[_0x49e0('0x11')](_0x244796[_0x49e0('0x7')][_0x49e0('0x12')]('/')[0x1])[_0x49e0('0x13')](function(_0x2c2cbf){if(_0x2c2cbf){_0x244796['membername']=_0x2c2cbf['name'];_0x244796[_0x49e0('0xe')]=_0x2c2cbf[_0x49e0('0xe')];utils[_0x49e0('0xf')](_0x49e0('0x10'),_0x244796);}});}})[_0x49e0('0x14')](function(_0x4a67fd){utils[_0x49e0('0x15')](util[_0x49e0('0x4')]('[%s][members][writeDB]',_0x244796[_0x49e0('0x6')]),_0x4a67fd);});}delete members[_0x244796[_0x49e0('0x7')]];}function startsWith(_0x192f00,_0x27e69c){return _[_0x49e0('0x16')](_0x192f00,function(_0x5b686c){return _['startsWith'](_0x27e69c,_0x5b686c);});}exports['devicestatechange']=function(_0x584936){try{utils[_0x49e0('0x17')](util[_0x49e0('0x4')](_0x49e0('0x18'),members[_0x584936[_0x49e0('0x19')]]?members[_0x584936[_0x49e0('0x19')]]['uniqueid']:_0x584936['device']),_0x584936);utils[_0x49e0('0x1a')](util[_0x49e0('0x4')](_0x49e0('0x1b'),members[_0x584936['device']]?members[_0x584936[_0x49e0('0x19')]][_0x49e0('0x6')]:_0x584936[_0x49e0('0x19')],_0x584936[_0x49e0('0x1c')],_0x584936[_0x49e0('0x19')]));switch(_0x584936[_0x49e0('0x1c')]){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x584936['device'])){members[_0x584936[_0x49e0('0x19')]]={'channel':_0x49e0('0x1d'),'interface':_0x584936['device'],'type':_0x49e0('0x1e'),'enterAt':utils[_0x49e0('0x1f')](),'role':_0x49e0('0x20')};}break;case _0x49e0('0x21'):if(!_['isNil'](members[_0x584936[_0x49e0('0x19')]])){members[_0x584936[_0x49e0('0x19')]][_0x49e0('0x22')]=utils[_0x49e0('0x1f')]();members[_0x584936['device']][_0x49e0('0x23')]=utils[_0x49e0('0x24')](members[_0x584936[_0x49e0('0x19')]][_0x49e0('0x22')],members[_0x584936[_0x49e0('0x19')]]['enterAt']);if(members[_0x584936[_0x49e0('0x19')]][_0x49e0('0x6')]){writeDB(members[_0x584936[_0x49e0('0x19')]]);}}break;default:break;}}catch(_0x2f4c46){utils[_0x49e0('0x15')](util[_0x49e0('0x4')](_0x49e0('0x18'),members[_0x584936[_0x49e0('0x19')]]?members[_0x584936['device']][_0x49e0('0x6')]:_0x584936[_0x49e0('0x19')]),_0x2f4c46);}};exports[_0x49e0('0x25')]=function(_0x594e0c){try{if(!_['isNil'](members[_0x594e0c[_0x49e0('0x7')]])){utils['debug'](util[_0x49e0('0x4')](_0x49e0('0x26'),_0x594e0c[_0x49e0('0x6')]),_0x594e0c);utils[_0x49e0('0x1a')](util['format'](_0x49e0('0x27'),_0x594e0c['uniqueid'],_0x594e0c['interface'],_0x594e0c[_0x49e0('0x28')]));members[_0x594e0c[_0x49e0('0x7')]]=_['assign'](members[_0x594e0c['interface']],{'data4':_0x594e0c['queue'],'uniqueid':_0x594e0c[_0x49e0('0x6')]});}}catch(_0x270e46){utils['error'](util['format'](_0x49e0('0x26'),_0x594e0c[_0x49e0('0x6')]),_0x270e46);}};exports['cdr']=function(_0x210a63){try{utils[_0x49e0('0x17')](util[_0x49e0('0x4')](_0x49e0('0x29'),_0x210a63[_0x49e0('0x6')]),_0x210a63);if(_0x210a63[_0x49e0('0x8')]){var _0x55c4a5=_0x210a63['channel']['split']('-')[0x0];if(!_['isNil'](members[_0x55c4a5])){members[_0x55c4a5]=_[_0x49e0('0x2a')](members[_0x55c4a5],{'data1':members[_0x55c4a5][_0x49e0('0x2b')]||_0x210a63['type'],'data2':members[_0x55c4a5][_0x49e0('0x9')]||_0x210a63[_0x49e0('0x2c')],'data3':members[_0x55c4a5][_0x49e0('0x2d')]||_0x210a63[_0x49e0('0x2e')],'uniqueid':members[_0x55c4a5]['uniqueid']||_0x210a63[_0x49e0('0x6')]});utils[_0x49e0('0x1a')](util[_0x49e0('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x210a63[_0x49e0('0x6')],members[_0x55c4a5][_0x49e0('0x2b')],members[_0x55c4a5][_0x49e0('0x9')],members[_0x55c4a5][_0x49e0('0x2d')]));if(members[_0x55c4a5]['exitAt']){writeDB(members[_0x55c4a5]);}}}if(_0x210a63[_0x49e0('0x2f')]){var _0x1803b8=_0x210a63[_0x49e0('0x2f')]['split']('-')[0x0];if(!_[_0x49e0('0x30')](members[_0x1803b8])){members[_0x1803b8]=_['assign'](members[_0x1803b8],{'data1':members[_0x1803b8][_0x49e0('0x2b')]||_0x210a63[_0x49e0('0xb')],'data2':members[_0x1803b8][_0x49e0('0x9')]||_0x210a63[_0x49e0('0x2c')],'data3':members[_0x1803b8][_0x49e0('0x2d')]||_0x210a63[_0x49e0('0x2e')],'uniqueid':members[_0x1803b8]['uniqueid']||_0x210a63['uniqueid']});utils[_0x49e0('0x1a')](util['format'](_0x49e0('0x31'),_0x210a63[_0x49e0('0x6')],members[_0x1803b8][_0x49e0('0x2b')],members[_0x1803b8][_0x49e0('0x9')],members[_0x1803b8]['data3']));if(members[_0x1803b8]['exitAt']){writeDB(members[_0x1803b8]);}}}}catch(_0x2c89a9){utils[_0x49e0('0x15')](util[_0x49e0('0x4')]('[%s][members][cdr]',_0x210a63['uniqueid']),_0x2c89a9);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 53f89d3..e4a5bf0 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 _0x9eba=['agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%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','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','name','varset','variable','value','CONTINUE','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerexitAt','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','holdtime','diffTime','count','connectedlinenum'];(function(_0x48e91c,_0x253dac){var _0x27276=function(_0x20435f){while(--_0x20435f){_0x48e91c['push'](_0x48e91c['shift']());}};_0x27276(++_0x253dac);}(_0x9eba,0x1e8));var _0xa9eb=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9eba[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xa9eb('0x0'));var util=require(_0xa9eb('0x1'));var utils=require(_0xa9eb('0x2'));var queues={};function writeDB(_0x2ae299){utils[_0xa9eb('0x3')](util[_0xa9eb('0x4')](_0xa9eb('0x5'),_0x2ae299[_0xa9eb('0x6')],_0x2ae299[_0xa9eb('0x7')],_0x2ae299[_0xa9eb('0x8')],_0x2ae299[_0xa9eb('0x9')],_0x2ae299[_0xa9eb('0xa')],_0x2ae299[_0xa9eb('0xb')],_0x2ae299[_0xa9eb('0xc')]));if(_0x2ae299['queue']){utils[_0xa9eb('0xd')](_0x2ae299[_0xa9eb('0x8')])[_0xa9eb('0xe')](function(_0x42e235){if(_0x42e235){_0x2ae299[_0xa9eb('0xf')]=_0x42e235['type'];}utils[_0xa9eb('0x10')]('CreateVoiceQueueReport',_0x2ae299);});}else{utils[_0xa9eb('0x10')](_0xa9eb('0x11'),_0x2ae299);}if(_0x2ae299[_0xa9eb('0x12')]){delete queues[_0x2ae299[_0xa9eb('0x12')]];}else{delete queues[_0x2ae299[_0xa9eb('0x6')]];}}exports[_0xa9eb('0x13')]=function(_0x50d471){try{utils[_0xa9eb('0x14')](util[_0xa9eb('0x4')](_0xa9eb('0x15'),_0x50d471[_0xa9eb('0x6')]),_0x50d471);utils[_0xa9eb('0x3')](util[_0xa9eb('0x4')](_0xa9eb('0x16'),_0x50d471[_0xa9eb('0x6')],_0x50d471[_0xa9eb('0x8')],_0x50d471[_0xa9eb('0x17')]));queues[_0x50d471[_0xa9eb('0x6')]]=_['assign'](_0x50d471,{'originalposition':_0x50d471['position'],'queuecallerjoinAt':utils[_0xa9eb('0x18')](),'mohtime':0x0});}catch(_0x8dd9a5){utils[_0xa9eb('0x19')](util[_0xa9eb('0x4')](_0xa9eb('0x15'),_0x50d471[_0xa9eb('0x6')]),_0x8dd9a5);}};exports[_0xa9eb('0x1a')]=function(_0x27d111){try{if(!_[_0xa9eb('0x1b')](queues[_0x27d111['uniqueid']])){utils[_0xa9eb('0x14')](util[_0xa9eb('0x4')](_0xa9eb('0x1c'),_0x27d111['uniqueid']),_0x27d111);if(queues[_0x27d111[_0xa9eb('0x6')]][_0xa9eb('0x1d')]){if(!queues[_0x27d111[_0xa9eb('0x6')]][_0xa9eb('0x1e')]&&!queues[_0x27d111[_0xa9eb('0x6')]][_0xa9eb('0x1f')]){queues[_0x27d111[_0xa9eb('0x6')]][_0xa9eb('0x20')]=!![];queues[_0x27d111[_0xa9eb('0x6')]][_0xa9eb('0x21')]=utils[_0xa9eb('0x18')]();queues[_0x27d111[_0xa9eb('0x6')]]['queuecallerexitreason']=_0xa9eb('0x22');}utils[_0xa9eb('0x3')](util[_0xa9eb('0x4')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x27d111[_0xa9eb('0x6')],queues[_0x27d111['uniqueid']][_0xa9eb('0x23')],queues[_0x27d111[_0xa9eb('0x6')]][_0xa9eb('0xc')]));writeDB(queues[_0x27d111[_0xa9eb('0x6')]]);}else if(queues[_0x27d111[_0xa9eb('0x6')]][_0xa9eb('0x12')]){utils[_0xa9eb('0x3')](util[_0xa9eb('0x4')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x27d111[_0xa9eb('0x6')],queues[_0x27d111[_0xa9eb('0x6')]]['name'],queues[_0x27d111[_0xa9eb('0x6')]][_0xa9eb('0x12')]));queues[queues[_0x27d111[_0xa9eb('0x6')]][_0xa9eb('0x12')]]=queues[_0x27d111[_0xa9eb('0x6')]];queues[queues[_0x27d111[_0xa9eb('0x6')]]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x27d111[_0xa9eb('0x6')]];}}}catch(_0x1e7673){utils[_0xa9eb('0x19')](util[_0xa9eb('0x4')](_0xa9eb('0x1c'),_0x27d111[_0xa9eb('0x6')]),_0x1e7673);}};exports[_0xa9eb('0x24')]=function(_0x484c7f){try{utils[_0xa9eb('0x14')](util[_0xa9eb('0x4')]('[%s][queues][varset]',_0x484c7f[_0xa9eb('0x6')]),_0x484c7f);if(!_[_0xa9eb('0x1b')](_0x484c7f[_0xa9eb('0x25')]['queuestatus'])&&_0x484c7f[_0xa9eb('0x26')]['toUpperCase']()!==_0xa9eb('0x27')){if(!_[_0xa9eb('0x1b')](queues[_0x484c7f['uniqueid']])){queues[_0x484c7f[_0xa9eb('0x6')]][_0xa9eb('0x1e')]=![];queues[_0x484c7f[_0xa9eb('0x6')]][_0xa9eb('0x28')]=null;queues[_0x484c7f['uniqueid']]['queuecallerexit']=!![];queues[_0x484c7f[_0xa9eb('0x6')]]['queuecallerexitAt']=utils[_0xa9eb('0x18')]();queues[_0x484c7f[_0xa9eb('0x6')]][_0xa9eb('0xc')]=_0x484c7f['value']['toUpperCase']();utils['info'](util[_0xa9eb('0x4')](_0xa9eb('0x29'),_0x484c7f[_0xa9eb('0x6')],queues[_0x484c7f[_0xa9eb('0x6')]]['name'],_0x484c7f[_0xa9eb('0x26')],queues[_0x484c7f[_0xa9eb('0x6')]]['queuecallerexitreason']));writeDB(queues[_0x484c7f['uniqueid']]);}}else if(!_[_0xa9eb('0x1b')](_0x484c7f[_0xa9eb('0x25')][_0xa9eb('0x2a')])){if(!_[_0xa9eb('0x1b')](queues[_0x484c7f[_0xa9eb('0x6')]])&&!queues[_0x484c7f[_0xa9eb('0x6')]][_0xa9eb('0x1e')]){queues[_0x484c7f['uniqueid']][_0xa9eb('0x1e')]=![];queues[_0x484c7f[_0xa9eb('0x6')]]['queuecallerabandonAt']=null;queues[_0x484c7f[_0xa9eb('0x6')]][_0xa9eb('0x1f')]=!![];queues[_0x484c7f['uniqueid']]['queuecallerexitAt']=utils[_0xa9eb('0x18')]();queues[_0x484c7f[_0xa9eb('0x6')]][_0xa9eb('0xc')]=_0xa9eb('0x2b');utils[_0xa9eb('0x3')](util['format'](_0xa9eb('0x2c'),_0x484c7f[_0xa9eb('0x6')],queues[_0x484c7f[_0xa9eb('0x6')]][_0xa9eb('0x23')],_0x484c7f['value'],queues[_0x484c7f[_0xa9eb('0x6')]]['queuecallerexitreason']));}}}catch(_0x44d7c3){utils[_0xa9eb('0x19')](util[_0xa9eb('0x4')]('[%s][queues][varset]',_0x484c7f[_0xa9eb('0x6')]),_0x44d7c3);}};exports[_0xa9eb('0x1e')]=function(_0x52b605){try{if(!_[_0xa9eb('0x1b')](queues[_0x52b605['uniqueid']])){utils[_0xa9eb('0x14')](util[_0xa9eb('0x4')](_0xa9eb('0x2d'),_0x52b605[_0xa9eb('0x6')]),_0x52b605);queues[_0x52b605[_0xa9eb('0x6')]][_0xa9eb('0x1f')]=![];queues[_0x52b605[_0xa9eb('0x6')]][_0xa9eb('0x2e')]=null;queues[_0x52b605[_0xa9eb('0x6')]][_0xa9eb('0x1e')]=!![];queues[_0x52b605[_0xa9eb('0x6')]][_0xa9eb('0x28')]=utils[_0xa9eb('0x18')]();queues[_0x52b605['uniqueid']][_0xa9eb('0xc')]=_0xa9eb('0x2f');utils[_0xa9eb('0x3')](util['format'](_0xa9eb('0x30'),_0x52b605[_0xa9eb('0x6')],queues[_0x52b605['uniqueid']][_0xa9eb('0x23')],queues[_0x52b605[_0xa9eb('0x6')]][_0xa9eb('0xc')]));}}catch(_0x3572e3){utils[_0xa9eb('0x19')](util[_0xa9eb('0x4')](_0xa9eb('0x2d'),_0x52b605[_0xa9eb('0x6')]),_0x3572e3);}};exports[_0xa9eb('0x31')]=function(_0x4f3fcb){try{if(!_[_0xa9eb('0x1b')](queues[_0x4f3fcb[_0xa9eb('0x6')]])){utils['debug'](util[_0xa9eb('0x4')](_0xa9eb('0x32'),_0x4f3fcb['uniqueid']),_0x4f3fcb);utils[_0xa9eb('0x3')](util[_0xa9eb('0x4')](_0xa9eb('0x33'),_0x4f3fcb[_0xa9eb('0x6')],queues[_0x4f3fcb['uniqueid']][_0xa9eb('0x23')],_0x4f3fcb['connectedlinenum'],_0x4f3fcb[_0xa9eb('0x34')]));queues[_0x4f3fcb[_0xa9eb('0x6')]][_0xa9eb('0x31')]=!![];queues[_0x4f3fcb['uniqueid']]['queuecallerleaveAt']=utils[_0xa9eb('0x18')]();queues[_0x4f3fcb[_0xa9eb('0x6')]][_0xa9eb('0x35')]=utils[_0xa9eb('0x36')](queues[_0x4f3fcb[_0xa9eb('0x6')]]['queuecallerleaveAt'],queues[_0x4f3fcb[_0xa9eb('0x6')]]['queuecallerjoinAt']);queues[_0x4f3fcb[_0xa9eb('0x6')]][_0xa9eb('0x17')]=_0x4f3fcb[_0xa9eb('0x17')];queues[_0x4f3fcb[_0xa9eb('0x6')]][_0xa9eb('0x37')]=_0x4f3fcb[_0xa9eb('0x37')];queues[_0x4f3fcb[_0xa9eb('0x6')]][_0xa9eb('0x38')]=_0x4f3fcb[_0xa9eb('0x38')];queues[_0x4f3fcb[_0xa9eb('0x6')]]['connectedlinename']=_0x4f3fcb[_0xa9eb('0x34')];}}catch(_0x597511){utils['error'](util[_0xa9eb('0x4')](_0xa9eb('0x32'),_0x4f3fcb[_0xa9eb('0x6')]),_0x597511);}};exports[_0xa9eb('0x39')]=function(_0x3da79c){try{if(!_[_0xa9eb('0x1b')](queues[_0x3da79c[_0xa9eb('0x6')]])){utils[_0xa9eb('0x14')](util['format'](_0xa9eb('0x3a'),_0x3da79c[_0xa9eb('0x6')]),_0x3da79c);utils[_0xa9eb('0x3')](util['format'](_0xa9eb('0x3b'),_0x3da79c[_0xa9eb('0x6')],queues[_0x3da79c[_0xa9eb('0x6')]][_0xa9eb('0x23')],_0x3da79c[_0xa9eb('0x3c')],_0x3da79c['destaccountcode']));queues[_0x3da79c[_0xa9eb('0x6')]][_0xa9eb('0x1e')]=![];queues[_0x3da79c[_0xa9eb('0x6')]][_0xa9eb('0x1e')]=![];queues[_0x3da79c[_0xa9eb('0x6')]][_0xa9eb('0x28')]=null;queues[_0x3da79c[_0xa9eb('0x6')]]['queuecallerexit']=![];queues[_0x3da79c['uniqueid']]['queuecallerexitreason']=null;queues[_0x3da79c['uniqueid']][_0xa9eb('0x2e')]=null;queues[_0x3da79c['uniqueid']][_0xa9eb('0x3d')]=!![];queues[_0x3da79c[_0xa9eb('0x6')]][_0xa9eb('0xb')]=_0x3da79c[_0xa9eb('0x3e')];queues[_0x3da79c['uniqueid']][_0xa9eb('0x9')]=_0x3da79c[_0xa9eb('0x3c')];}}catch(_0x530692){utils[_0xa9eb('0x19')](util[_0xa9eb('0x4')](_0xa9eb('0x3a'),_0x3da79c[_0xa9eb('0x6')]),_0x530692);}};exports[_0xa9eb('0x3f')]=function(_0x82b780){try{if(!_[_0xa9eb('0x1b')](queues[_0x82b780[_0xa9eb('0x6')]])){if(queues[_0x82b780['uniqueid']][_0xa9eb('0x1d')]){utils[_0xa9eb('0x14')](util[_0xa9eb('0x4')](_0xa9eb('0x40'),_0x82b780[_0xa9eb('0x6')]),_0x82b780);queues[_0x82b780[_0xa9eb('0x6')]][_0xa9eb('0x1e')]=![];queues[_0x82b780[_0xa9eb('0x6')]][_0xa9eb('0x1e')]=![];queues[_0x82b780[_0xa9eb('0x6')]][_0xa9eb('0x28')]=null;queues[_0x82b780[_0xa9eb('0x6')]][_0xa9eb('0x1f')]=![];queues[_0x82b780['uniqueid']][_0xa9eb('0x2e')]=null;queues[_0x82b780['uniqueid']][_0xa9eb('0x3d')]=!![];queues[_0x82b780['uniqueid']][_0xa9eb('0x9')]=_0x82b780[_0xa9eb('0x3c')];queues[_0x82b780[_0xa9eb('0x6')]][_0xa9eb('0x20')]=!![];queues[_0x82b780['uniqueid']][_0xa9eb('0x21')]=utils['now']();if(_0x82b780[_0xa9eb('0x41')]=='transfer'){if(!queues[_0x82b780[_0xa9eb('0x6')]][_0xa9eb('0x42')]){queues[_0x82b780[_0xa9eb('0x6')]]['queuecallerexitreason']=_0xa9eb('0x43');}}else{queues[_0x82b780['uniqueid']][_0xa9eb('0xc')]=_0xa9eb('0x44')+_0x82b780['reason'][_0xa9eb('0x45')]();}utils[_0xa9eb('0x3')](util[_0xa9eb('0x4')](_0xa9eb('0x46'),_0x82b780[_0xa9eb('0x6')],queues[_0x82b780[_0xa9eb('0x6')]][_0xa9eb('0x23')],_0x82b780[_0xa9eb('0x3c')],queues[_0x82b780[_0xa9eb('0x6')]][_0xa9eb('0xc')]));writeDB(queues[_0x82b780[_0xa9eb('0x6')]]);}}}catch(_0x1cc829){utils[_0xa9eb('0x19')](util[_0xa9eb('0x4')](_0xa9eb('0x40'),_0x82b780['uniqueid']),_0x1cc829);}};exports[_0xa9eb('0x47')]=function(_0x2956c7){try{if(!_[_0xa9eb('0x1b')](queues[_0x2956c7['transfereeuniqueid']])){utils[_0xa9eb('0x14')](util[_0xa9eb('0x4')](_0xa9eb('0x48'),_0x2956c7[_0xa9eb('0x6')]),_0x2956c7);queues[_0x2956c7[_0xa9eb('0x49')]][_0xa9eb('0x42')]=!![];queues[_0x2956c7[_0xa9eb('0x49')]][_0xa9eb('0x4a')]=_0xa9eb('0x4b');queues[_0x2956c7[_0xa9eb('0x49')]][_0xa9eb('0x4c')]=_0x2956c7[_0xa9eb('0x4d')];queues[_0x2956c7[_0xa9eb('0x49')]][_0xa9eb('0x4e')]=_0x2956c7[_0xa9eb('0x49')];queues[_0x2956c7[_0xa9eb('0x49')]]['queuecallerexitreason']=_0xa9eb('0x4f');utils[_0xa9eb('0x3')](util[_0xa9eb('0x4')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x2956c7[_0xa9eb('0x6')],queues[_0x2956c7[_0xa9eb('0x49')]]['name'],_0x2956c7[_0xa9eb('0x49')],_0x2956c7['extension']));}}catch(_0x3034d6){utils[_0xa9eb('0x19')](util[_0xa9eb('0x4')](_0xa9eb('0x48'),_0x2956c7[_0xa9eb('0x6')]),_0x3034d6);}};exports[_0xa9eb('0x50')]=function(_0x1adfb3){try{utils[_0xa9eb('0x14')](util['format'](_0xa9eb('0x51'),_0x1adfb3[_0xa9eb('0x52')]),_0x1adfb3);if(_0x1adfb3[_0xa9eb('0x52')]==_0x1adfb3['origtransfererlinkedid']){if(!_[_0xa9eb('0x1b')](queues[_0x1adfb3[_0xa9eb('0x53')]])){utils[_0xa9eb('0x3')](util[_0xa9eb('0x4')](_0xa9eb('0x54'),_0x1adfb3[_0xa9eb('0x52')],queues[_0x1adfb3[_0xa9eb('0x53')]][_0xa9eb('0x23')],_0x1adfb3[_0xa9eb('0x55')]));queues[_0x1adfb3['secondtransfererlinkedid']]['transfer']=!![];queues[_0x1adfb3[_0xa9eb('0x53')]]['transfertype']=_0xa9eb('0x56');queues[_0x1adfb3[_0xa9eb('0x53')]][_0xa9eb('0x4c')]=_0x1adfb3[_0xa9eb('0x55')];queues[_0x1adfb3[_0xa9eb('0x53')]][_0xa9eb('0x4e')]=_0x1adfb3[_0xa9eb('0x52')];queues[_0x1adfb3[_0xa9eb('0x53')]][_0xa9eb('0xc')]=_0xa9eb('0x57');}if(!_[_0xa9eb('0x1b')](queues[_0x1adfb3[_0xa9eb('0x58')]])){if(_0x1adfb3[_0xa9eb('0x59')]&&queues[_0x1adfb3[_0xa9eb('0x59')]]){queues[_0x1adfb3[_0xa9eb('0x59')]][_0xa9eb('0x5a')]=0x1;queues[_0x1adfb3[_0xa9eb('0x49')]]=_[_0xa9eb('0x5b')](queues[_0x1adfb3['transfereelinkedid']]);queues[_0x1adfb3[_0xa9eb('0x49')]][_0xa9eb('0x12')]=_0x1adfb3[_0xa9eb('0x5c')];queues[_0x1adfb3['transfereeuniqueid']][_0xa9eb('0x5a')]=0x2;queues[_0x1adfb3[_0xa9eb('0x49')]][_0xa9eb('0xa')]=queues[_0x1adfb3[_0xa9eb('0x53')]][_0xa9eb('0xa')];queues[_0x1adfb3[_0xa9eb('0x49')]]['calleridname']=queues[_0x1adfb3[_0xa9eb('0x53')]][_0xa9eb('0x5d')];queues[_0x1adfb3[_0xa9eb('0x49')]][_0xa9eb('0x5e')]=utils[_0xa9eb('0x18')]();queues[_0x1adfb3['transfereeuniqueid']]['queuecallerleaveAt']=utils['now']();queues[_0x1adfb3[_0xa9eb('0x49')]][_0xa9eb('0x35')]=0x0;queues[_0x1adfb3[_0xa9eb('0x49')]][_0xa9eb('0x5f')]=0x0;utils[_0xa9eb('0x3')](util[_0xa9eb('0x4')](_0xa9eb('0x60'),_0x1adfb3[_0xa9eb('0x52')],queues[_0x1adfb3['transfereeuniqueid']][_0xa9eb('0x23')],queues[_0x1adfb3[_0xa9eb('0x49')]]['calleridnum'],queues[_0x1adfb3[_0xa9eb('0x49')]][_0xa9eb('0x5d')]));}else{utils[_0xa9eb('0x3')](util[_0xa9eb('0x4')](_0xa9eb('0x61'),_0x1adfb3[_0xa9eb('0x52')],queues[_0x1adfb3[_0xa9eb('0x58')]][_0xa9eb('0x23')],_0x1adfb3[_0xa9eb('0x53')]));queues[_0x1adfb3[_0xa9eb('0x58')]]['transfereduniqueid']=_0x1adfb3[_0xa9eb('0x53')];}}}else if(_0x1adfb3[_0xa9eb('0x62')]==_0x1adfb3['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x1adfb3[_0xa9eb('0x58')]])){utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x1adfb3[_0xa9eb('0x52')],queues[_0x1adfb3[_0xa9eb('0x58')]][_0xa9eb('0x23')],_0x1adfb3['secondtransfereruniqueid'],_0x1adfb3[_0xa9eb('0x63')]));queues[_0x1adfb3[_0xa9eb('0x58')]][_0xa9eb('0x42')]=!![];queues[_0x1adfb3[_0xa9eb('0x58')]]['transfertype']='ATTENDED';queues[_0x1adfb3[_0xa9eb('0x58')]]['transferexten']=_0x1adfb3[_0xa9eb('0x63')];queues[_0x1adfb3[_0xa9eb('0x58')]][_0xa9eb('0x4e')]=_0x1adfb3[_0xa9eb('0x62')];queues[_0x1adfb3[_0xa9eb('0x58')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0xa9eb('0x1b')](queues[_0x1adfb3[_0xa9eb('0x53')]])){if(_0x1adfb3[_0xa9eb('0x64')]&&queues[_0x1adfb3['transfertargetlinkedid']]){queues[_0x1adfb3[_0xa9eb('0x64')]]['queuecallerenterreason']=0x1;queues[_0x1adfb3[_0xa9eb('0x5c')]]=_[_0xa9eb('0x5b')](queues[_0x1adfb3[_0xa9eb('0x64')]]);queues[_0x1adfb3['transfertargetuniqueid']]['transfereduniqueid']=_0x1adfb3[_0xa9eb('0x5c')];queues[_0x1adfb3[_0xa9eb('0x5c')]][_0xa9eb('0x5a')]=0x2;queues[_0x1adfb3['transfertargetuniqueid']][_0xa9eb('0xa')]=queues[_0x1adfb3[_0xa9eb('0x58')]][_0xa9eb('0xa')];queues[_0x1adfb3[_0xa9eb('0x5c')]]['calleridname']=queues[_0x1adfb3[_0xa9eb('0x58')]][_0xa9eb('0x5d')];queues[_0x1adfb3[_0xa9eb('0x5c')]][_0xa9eb('0x5e')]=utils[_0xa9eb('0x18')]();queues[_0x1adfb3[_0xa9eb('0x5c')]]['queuecallerleaveAt']=utils['now']();queues[_0x1adfb3[_0xa9eb('0x5c')]][_0xa9eb('0x35')]=0x0;queues[_0x1adfb3['transfertargetuniqueid']][_0xa9eb('0x5f')]=0x0;utils[_0xa9eb('0x3')](util['format'](_0xa9eb('0x65'),_0x1adfb3[_0xa9eb('0x52')],queues[_0x1adfb3['transfertargetuniqueid']][_0xa9eb('0x23')],queues[_0x1adfb3[_0xa9eb('0x5c')]]['transfereduniqueid'],queues[_0x1adfb3[_0xa9eb('0x5c')]][_0xa9eb('0xa')],queues[_0x1adfb3['transfertargetuniqueid']][_0xa9eb('0x5d')]));}else{utils['info'](util['format'](_0xa9eb('0x61'),_0x1adfb3[_0xa9eb('0x52')],queues[_0x1adfb3[_0xa9eb('0x53')]]['name'],_0x1adfb3[_0xa9eb('0x58')]));queues[_0x1adfb3['secondtransfererlinkedid']][_0xa9eb('0x12')]=_0x1adfb3[_0xa9eb('0x58')];}}}}catch(_0x52bd1b){utils[_0xa9eb('0x19')](util[_0xa9eb('0x4')](_0xa9eb('0x51'),_0x1adfb3[_0xa9eb('0x52')]),_0x52bd1b);}};exports[_0xa9eb('0x66')]=function(_0x7a2cd){try{if(!_[_0xa9eb('0x1b')](queues[_0x7a2cd['uniqueid']])){utils[_0xa9eb('0x14')](util[_0xa9eb('0x4')](_0xa9eb('0x67'),_0x7a2cd['uniqueid']),_0x7a2cd);queues[_0x7a2cd['uniqueid']][_0xa9eb('0x68')]=utils[_0xa9eb('0x18')]();utils[_0xa9eb('0x3')](util[_0xa9eb('0x4')](_0xa9eb('0x69'),_0x7a2cd[_0xa9eb('0x6')],queues[_0x7a2cd['uniqueid']][_0xa9eb('0x23')],queues[_0x7a2cd[_0xa9eb('0x6')]][_0xa9eb('0x68')]));}}catch(_0x3fa91f){utils[_0xa9eb('0x19')](util[_0xa9eb('0x4')](_0xa9eb('0x67'),_0x7a2cd['uniqueid']),_0x3fa91f);}};exports[_0xa9eb('0x6a')]=function(_0x2553f2){try{if(!_[_0xa9eb('0x1b')](queues[_0x2553f2[_0xa9eb('0x6')]])){if(!_[_0xa9eb('0x1b')](queues[_0x2553f2[_0xa9eb('0x6')]][_0xa9eb('0x68')])){utils[_0xa9eb('0x14')](util[_0xa9eb('0x4')]('[%s][queues][musiconholdstop]',_0x2553f2[_0xa9eb('0x6')]),_0x2553f2);queues[_0x2553f2[_0xa9eb('0x6')]][_0xa9eb('0x5f')]+=utils['diffTime'](utils[_0xa9eb('0x18')](),queues[_0x2553f2[_0xa9eb('0x6')]][_0xa9eb('0x68')]);utils[_0xa9eb('0x3')](util['format'](_0xa9eb('0x6b'),_0x2553f2[_0xa9eb('0x6')],queues[_0x2553f2[_0xa9eb('0x6')]][_0xa9eb('0x23')],queues[_0x2553f2['uniqueid']][_0xa9eb('0x5f')]));delete queues[_0x2553f2['uniqueid']]['musiconholdstartAt'];}}}catch(_0x17aae8){utils['error'](util[_0xa9eb('0x4')](_0xa9eb('0x6c'),_0x2553f2[_0xa9eb('0x6')]),_0x17aae8);}}; \ No newline at end of file +var _0x0286=['[%s][queues][attendedtransfer]','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','transfertype','ATTENDED','transfereelinkedid','queuecallerenterreason','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','origtransfereruniqueid','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','uniqueid','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','error','[%s][queues][hangup]','varset','[%s][queues][varset]','queuestatus','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','holdtime','diffTime','queuecallerjoinAt','count','connectedlinename','[%s][queues][queuecallerleave]','agentconnect','membername','destaccountcode','assigned','[%s][queues][agentconnect]','agentcomplete','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x0286,0xeb));var _0x6028=function(_0x221f71,_0x221c04){_0x221f71=_0x221f71-0x0;var _0x2df2e5=_0x0286[_0x221f71];return _0x2df2e5;};'use strict';var _=require(_0x6028('0x0'));var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0xba3943){utils[_0x6028('0x1')](util[_0x6028('0x2')](_0x6028('0x3'),_0xba3943['uniqueid'],_0xba3943[_0x6028('0x4')],_0xba3943[_0x6028('0x5')],_0xba3943[_0x6028('0x6')],_0xba3943[_0x6028('0x7')],_0xba3943[_0x6028('0x8')],_0xba3943[_0x6028('0x9')]));if(_0xba3943[_0x6028('0x5')]){utils[_0x6028('0xa')](_0xba3943['queue'])[_0x6028('0xb')](function(_0x29049c){if(_0x29049c){_0xba3943[_0x6028('0xc')]=_0x29049c['type'];}utils[_0x6028('0xd')]('CreateVoiceQueueReport',_0xba3943);});}else{utils[_0x6028('0xd')](_0x6028('0xe'),_0xba3943);}if(_0xba3943[_0x6028('0xf')]){delete queues[_0xba3943[_0x6028('0xf')]];}else{delete queues[_0xba3943['uniqueid']];}}exports[_0x6028('0x10')]=function(_0x1746cf){try{utils[_0x6028('0x11')](util[_0x6028('0x2')](_0x6028('0x12'),_0x1746cf[_0x6028('0x13')]),_0x1746cf);utils[_0x6028('0x1')](util[_0x6028('0x2')](_0x6028('0x14'),_0x1746cf['uniqueid'],_0x1746cf[_0x6028('0x5')],_0x1746cf['position']));queues[_0x1746cf[_0x6028('0x13')]]=_['assign'](_0x1746cf,{'originalposition':_0x1746cf[_0x6028('0x15')],'queuecallerjoinAt':utils[_0x6028('0x16')](),'mohtime':0x0});}catch(_0x3145d9){utils['error'](util[_0x6028('0x2')](_0x6028('0x12'),_0x1746cf['uniqueid']),_0x3145d9);}};exports[_0x6028('0x17')]=function(_0x360aff){try{if(!_[_0x6028('0x18')](queues[_0x360aff[_0x6028('0x13')]])){utils[_0x6028('0x11')](util[_0x6028('0x2')]('[%s][queues][hangup]',_0x360aff[_0x6028('0x13')]),_0x360aff);if(queues[_0x360aff['uniqueid']][_0x6028('0x19')]){if(!queues[_0x360aff[_0x6028('0x13')]][_0x6028('0x1a')]&&!queues[_0x360aff[_0x6028('0x13')]]['queuecallerexit']){queues[_0x360aff[_0x6028('0x13')]][_0x6028('0x1b')]=!![];queues[_0x360aff[_0x6028('0x13')]][_0x6028('0x1c')]=utils[_0x6028('0x16')]();queues[_0x360aff[_0x6028('0x13')]][_0x6028('0x9')]=_0x6028('0x1d');}utils[_0x6028('0x1')](util[_0x6028('0x2')](_0x6028('0x1e'),_0x360aff['uniqueid'],queues[_0x360aff['uniqueid']]['name'],queues[_0x360aff[_0x6028('0x13')]][_0x6028('0x9')]));writeDB(queues[_0x360aff[_0x6028('0x13')]]);}else if(queues[_0x360aff[_0x6028('0x13')]][_0x6028('0xf')]){utils[_0x6028('0x1')](util[_0x6028('0x2')](_0x6028('0x1f'),_0x360aff[_0x6028('0x13')],queues[_0x360aff[_0x6028('0x13')]][_0x6028('0x20')],queues[_0x360aff[_0x6028('0x13')]][_0x6028('0xf')]));queues[queues[_0x360aff[_0x6028('0x13')]]['transfereduniqueid']]=queues[_0x360aff[_0x6028('0x13')]];queues[queues[_0x360aff['uniqueid']][_0x6028('0xf')]]['queuecallerenterreason']=0x2;delete queues[_0x360aff[_0x6028('0x13')]];}}}catch(_0x395d64){utils[_0x6028('0x21')](util[_0x6028('0x2')](_0x6028('0x22'),_0x360aff['uniqueid']),_0x395d64);}};exports[_0x6028('0x23')]=function(_0x12d3e){try{utils[_0x6028('0x11')](util[_0x6028('0x2')](_0x6028('0x24'),_0x12d3e[_0x6028('0x13')]),_0x12d3e);if(!_[_0x6028('0x18')](_0x12d3e['variable'][_0x6028('0x25')])&&_0x12d3e['value'][_0x6028('0x26')]()!==_0x6028('0x27')){if(!_[_0x6028('0x18')](queues[_0x12d3e[_0x6028('0x13')]])){queues[_0x12d3e[_0x6028('0x13')]][_0x6028('0x1a')]=![];queues[_0x12d3e[_0x6028('0x13')]][_0x6028('0x28')]=null;queues[_0x12d3e['uniqueid']][_0x6028('0x29')]=!![];queues[_0x12d3e[_0x6028('0x13')]][_0x6028('0x2a')]=utils[_0x6028('0x16')]();queues[_0x12d3e[_0x6028('0x13')]][_0x6028('0x9')]=_0x12d3e[_0x6028('0x2b')][_0x6028('0x26')]();utils[_0x6028('0x1')](util[_0x6028('0x2')](_0x6028('0x2c'),_0x12d3e[_0x6028('0x13')],queues[_0x12d3e[_0x6028('0x13')]][_0x6028('0x20')],_0x12d3e[_0x6028('0x2b')],queues[_0x12d3e['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x12d3e[_0x6028('0x13')]]);}}else if(!_[_0x6028('0x18')](_0x12d3e[_0x6028('0x2d')][_0x6028('0x2e')])){if(!_['isNil'](queues[_0x12d3e[_0x6028('0x13')]])&&!queues[_0x12d3e[_0x6028('0x13')]][_0x6028('0x1a')]){queues[_0x12d3e[_0x6028('0x13')]][_0x6028('0x1a')]=![];queues[_0x12d3e['uniqueid']][_0x6028('0x28')]=null;queues[_0x12d3e[_0x6028('0x13')]][_0x6028('0x29')]=!![];queues[_0x12d3e[_0x6028('0x13')]]['queuecallerexitAt']=utils[_0x6028('0x16')]();queues[_0x12d3e[_0x6028('0x13')]][_0x6028('0x9')]='EXITWITHKEY';utils[_0x6028('0x1')](util[_0x6028('0x2')](_0x6028('0x2f'),_0x12d3e[_0x6028('0x13')],queues[_0x12d3e[_0x6028('0x13')]]['name'],_0x12d3e['value'],queues[_0x12d3e[_0x6028('0x13')]]['queuecallerexitreason']));}}}catch(_0x3492b7){utils[_0x6028('0x21')](util['format'](_0x6028('0x24'),_0x12d3e[_0x6028('0x13')]),_0x3492b7);}};exports[_0x6028('0x1a')]=function(_0x17b0fe){try{if(!_[_0x6028('0x18')](queues[_0x17b0fe[_0x6028('0x13')]])){utils[_0x6028('0x11')](util[_0x6028('0x2')]('[%s][queues][queuecallerabandon]',_0x17b0fe[_0x6028('0x13')]),_0x17b0fe);queues[_0x17b0fe[_0x6028('0x13')]][_0x6028('0x29')]=![];queues[_0x17b0fe[_0x6028('0x13')]][_0x6028('0x2a')]=null;queues[_0x17b0fe[_0x6028('0x13')]]['queuecallerabandon']=!![];queues[_0x17b0fe[_0x6028('0x13')]][_0x6028('0x28')]=utils[_0x6028('0x16')]();queues[_0x17b0fe['uniqueid']]['queuecallerexitreason']=_0x6028('0x30');utils[_0x6028('0x1')](util[_0x6028('0x2')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x17b0fe['uniqueid'],queues[_0x17b0fe[_0x6028('0x13')]][_0x6028('0x20')],queues[_0x17b0fe[_0x6028('0x13')]][_0x6028('0x9')]));}}catch(_0x2abdd3){utils['error'](util[_0x6028('0x2')](_0x6028('0x31'),_0x17b0fe[_0x6028('0x13')]),_0x2abdd3);}};exports[_0x6028('0x32')]=function(_0x1413a1){try{if(!_[_0x6028('0x18')](queues[_0x1413a1['uniqueid']])){utils['debug'](util[_0x6028('0x2')]('[%s][queues][queuecallerleave]',_0x1413a1['uniqueid']),_0x1413a1);utils[_0x6028('0x1')](util[_0x6028('0x2')](_0x6028('0x33'),_0x1413a1[_0x6028('0x13')],queues[_0x1413a1[_0x6028('0x13')]]['name'],_0x1413a1['connectedlinenum'],_0x1413a1['connectedlinename']));queues[_0x1413a1[_0x6028('0x13')]][_0x6028('0x32')]=!![];queues[_0x1413a1[_0x6028('0x13')]][_0x6028('0x19')]=utils['now']();queues[_0x1413a1['uniqueid']][_0x6028('0x34')]=utils[_0x6028('0x35')](queues[_0x1413a1['uniqueid']][_0x6028('0x19')],queues[_0x1413a1[_0x6028('0x13')]][_0x6028('0x36')]);queues[_0x1413a1[_0x6028('0x13')]]['position']=_0x1413a1[_0x6028('0x15')];queues[_0x1413a1['uniqueid']]['count']=_0x1413a1[_0x6028('0x37')];queues[_0x1413a1[_0x6028('0x13')]]['connectedlinenum']=_0x1413a1['connectedlinenum'];queues[_0x1413a1['uniqueid']][_0x6028('0x38')]=_0x1413a1['connectedlinename'];}}catch(_0x3bde8a){utils[_0x6028('0x21')](util[_0x6028('0x2')](_0x6028('0x39'),_0x1413a1['uniqueid']),_0x3bde8a);}};exports[_0x6028('0x3a')]=function(_0x540bf4){try{if(!_[_0x6028('0x18')](queues[_0x540bf4[_0x6028('0x13')]])){utils['debug'](util[_0x6028('0x2')]('[%s][queues][agentconnect]',_0x540bf4[_0x6028('0x13')]),_0x540bf4);utils[_0x6028('0x1')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x540bf4[_0x6028('0x13')],queues[_0x540bf4[_0x6028('0x13')]][_0x6028('0x20')],_0x540bf4[_0x6028('0x3b')],_0x540bf4[_0x6028('0x3c')]));queues[_0x540bf4[_0x6028('0x13')]][_0x6028('0x1a')]=![];queues[_0x540bf4[_0x6028('0x13')]][_0x6028('0x1a')]=![];queues[_0x540bf4[_0x6028('0x13')]][_0x6028('0x28')]=null;queues[_0x540bf4[_0x6028('0x13')]]['queuecallerexit']=![];queues[_0x540bf4[_0x6028('0x13')]]['queuecallerexitreason']=null;queues[_0x540bf4['uniqueid']][_0x6028('0x2a')]=null;queues[_0x540bf4[_0x6028('0x13')]][_0x6028('0x3d')]=!![];queues[_0x540bf4[_0x6028('0x13')]]['accountcode']=_0x540bf4['destaccountcode'];queues[_0x540bf4[_0x6028('0x13')]][_0x6028('0x6')]=_0x540bf4['membername'];}}catch(_0x250cee){utils[_0x6028('0x21')](util[_0x6028('0x2')](_0x6028('0x3e'),_0x540bf4['uniqueid']),_0x250cee);}};exports[_0x6028('0x3f')]=function(_0x4d6805){try{if(!_['isNil'](queues[_0x4d6805[_0x6028('0x13')]])){if(queues[_0x4d6805[_0x6028('0x13')]][_0x6028('0x19')]){utils[_0x6028('0x11')](util[_0x6028('0x2')]('[%s][queues][agentcomplete]',_0x4d6805[_0x6028('0x13')]),_0x4d6805);queues[_0x4d6805[_0x6028('0x13')]][_0x6028('0x1a')]=![];queues[_0x4d6805[_0x6028('0x13')]]['queuecallerabandon']=![];queues[_0x4d6805[_0x6028('0x13')]][_0x6028('0x28')]=null;queues[_0x4d6805[_0x6028('0x13')]]['queuecallerexit']=![];queues[_0x4d6805[_0x6028('0x13')]][_0x6028('0x2a')]=null;queues[_0x4d6805[_0x6028('0x13')]][_0x6028('0x3d')]=!![];queues[_0x4d6805['uniqueid']]['lastAssignedTo']=_0x4d6805['membername'];queues[_0x4d6805[_0x6028('0x13')]][_0x6028('0x1b')]=!![];queues[_0x4d6805[_0x6028('0x13')]][_0x6028('0x1c')]=utils[_0x6028('0x16')]();if(_0x4d6805['reason']==_0x6028('0x40')){if(!queues[_0x4d6805[_0x6028('0x13')]][_0x6028('0x40')]){queues[_0x4d6805[_0x6028('0x13')]][_0x6028('0x9')]=_0x6028('0x41');}}else{queues[_0x4d6805[_0x6028('0x13')]][_0x6028('0x9')]=_0x6028('0x42')+_0x4d6805['reason'][_0x6028('0x26')]();}utils[_0x6028('0x1')](util[_0x6028('0x2')](_0x6028('0x43'),_0x4d6805[_0x6028('0x13')],queues[_0x4d6805['uniqueid']]['name'],_0x4d6805['membername'],queues[_0x4d6805[_0x6028('0x13')]]['queuecallerexitreason']));writeDB(queues[_0x4d6805[_0x6028('0x13')]]);}}}catch(_0x38a337){utils[_0x6028('0x21')](util[_0x6028('0x2')](_0x6028('0x44'),_0x4d6805[_0x6028('0x13')]),_0x38a337);}};exports['blindtransfer']=function(_0x3f8884){try{if(!_[_0x6028('0x18')](queues[_0x3f8884[_0x6028('0x45')]])){utils[_0x6028('0x11')](util['format'](_0x6028('0x46'),_0x3f8884[_0x6028('0x13')]),_0x3f8884);queues[_0x3f8884[_0x6028('0x45')]][_0x6028('0x40')]=!![];queues[_0x3f8884[_0x6028('0x45')]]['transfertype']=_0x6028('0x47');queues[_0x3f8884[_0x6028('0x45')]][_0x6028('0x48')]=_0x3f8884[_0x6028('0x49')];queues[_0x3f8884[_0x6028('0x45')]][_0x6028('0x4a')]=_0x3f8884['transfereeuniqueid'];queues[_0x3f8884[_0x6028('0x45')]][_0x6028('0x9')]=_0x6028('0x4b');utils['info'](util[_0x6028('0x2')](_0x6028('0x4c'),_0x3f8884[_0x6028('0x13')],queues[_0x3f8884['transfereeuniqueid']][_0x6028('0x20')],_0x3f8884[_0x6028('0x45')],_0x3f8884[_0x6028('0x49')]));}}catch(_0x1462a2){utils[_0x6028('0x21')](util[_0x6028('0x2')](_0x6028('0x46'),_0x3f8884['uniqueid']),_0x1462a2);}};exports['attendedtransfer']=function(_0x2f2cc2){try{utils[_0x6028('0x11')](util[_0x6028('0x2')](_0x6028('0x4d'),_0x2f2cc2['origtransfereruniqueid']),_0x2f2cc2);if(_0x2f2cc2['origtransfereruniqueid']==_0x2f2cc2[_0x6028('0x4e')]){if(!_['isNil'](queues[_0x2f2cc2[_0x6028('0x4f')]])){utils[_0x6028('0x1')](util[_0x6028('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x2f2cc2['origtransfereruniqueid'],queues[_0x2f2cc2[_0x6028('0x4f')]]['name'],_0x2f2cc2[_0x6028('0x50')]));queues[_0x2f2cc2[_0x6028('0x4f')]][_0x6028('0x40')]=!![];queues[_0x2f2cc2['secondtransfererlinkedid']][_0x6028('0x51')]=_0x6028('0x52');queues[_0x2f2cc2['secondtransfererlinkedid']][_0x6028('0x48')]=_0x2f2cc2[_0x6028('0x50')];queues[_0x2f2cc2['secondtransfererlinkedid']][_0x6028('0x4a')]=_0x2f2cc2['origtransfereruniqueid'];queues[_0x2f2cc2[_0x6028('0x4f')]][_0x6028('0x9')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x2f2cc2[_0x6028('0x4e')]])){if(_0x2f2cc2[_0x6028('0x53')]&&queues[_0x2f2cc2[_0x6028('0x53')]]){queues[_0x2f2cc2[_0x6028('0x53')]][_0x6028('0x54')]=0x1;queues[_0x2f2cc2[_0x6028('0x45')]]=_['clone'](queues[_0x2f2cc2[_0x6028('0x53')]]);queues[_0x2f2cc2[_0x6028('0x45')]]['transfereduniqueid']=_0x2f2cc2[_0x6028('0x55')];queues[_0x2f2cc2[_0x6028('0x45')]][_0x6028('0x54')]=0x2;queues[_0x2f2cc2[_0x6028('0x45')]][_0x6028('0x7')]=queues[_0x2f2cc2[_0x6028('0x4f')]][_0x6028('0x7')];queues[_0x2f2cc2[_0x6028('0x45')]]['calleridname']=queues[_0x2f2cc2[_0x6028('0x4f')]][_0x6028('0x56')];queues[_0x2f2cc2[_0x6028('0x45')]][_0x6028('0x36')]=utils[_0x6028('0x16')]();queues[_0x2f2cc2['transfereeuniqueid']][_0x6028('0x19')]=utils['now']();queues[_0x2f2cc2[_0x6028('0x45')]][_0x6028('0x34')]=0x0;queues[_0x2f2cc2[_0x6028('0x45')]][_0x6028('0x57')]=0x0;utils[_0x6028('0x1')](util[_0x6028('0x2')](_0x6028('0x58'),_0x2f2cc2['origtransfereruniqueid'],queues[_0x2f2cc2[_0x6028('0x45')]][_0x6028('0x20')],queues[_0x2f2cc2[_0x6028('0x45')]][_0x6028('0x7')],queues[_0x2f2cc2[_0x6028('0x45')]]['calleridname']));}else{utils['info'](util[_0x6028('0x2')](_0x6028('0x59'),_0x2f2cc2[_0x6028('0x5a')],queues[_0x2f2cc2[_0x6028('0x4e')]][_0x6028('0x20')],_0x2f2cc2[_0x6028('0x4f')]));queues[_0x2f2cc2[_0x6028('0x4e')]][_0x6028('0xf')]=_0x2f2cc2['secondtransfererlinkedid'];}}}else if(_0x2f2cc2[_0x6028('0x5b')]==_0x2f2cc2[_0x6028('0x4f')]){if(!_[_0x6028('0x18')](queues[_0x2f2cc2[_0x6028('0x4e')]])){utils[_0x6028('0x1')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x2f2cc2[_0x6028('0x5a')],queues[_0x2f2cc2[_0x6028('0x4e')]][_0x6028('0x20')],_0x2f2cc2['secondtransfereruniqueid'],_0x2f2cc2['secondtransfererexten']));queues[_0x2f2cc2[_0x6028('0x4e')]][_0x6028('0x40')]=!![];queues[_0x2f2cc2['origtransfererlinkedid']]['transfertype']=_0x6028('0x52');queues[_0x2f2cc2[_0x6028('0x4e')]]['transferexten']=_0x2f2cc2[_0x6028('0x5c')];queues[_0x2f2cc2['origtransfererlinkedid']]['transferuniqueid']=_0x2f2cc2[_0x6028('0x5b')];queues[_0x2f2cc2['origtransfererlinkedid']][_0x6028('0x9')]=_0x6028('0x5d');}if(!_[_0x6028('0x18')](queues[_0x2f2cc2['secondtransfererlinkedid']])){if(_0x2f2cc2[_0x6028('0x5e')]&&queues[_0x2f2cc2[_0x6028('0x5e')]]){queues[_0x2f2cc2['transfertargetlinkedid']][_0x6028('0x54')]=0x1;queues[_0x2f2cc2[_0x6028('0x55')]]=_[_0x6028('0x5f')](queues[_0x2f2cc2[_0x6028('0x5e')]]);queues[_0x2f2cc2['transfertargetuniqueid']][_0x6028('0xf')]=_0x2f2cc2[_0x6028('0x55')];queues[_0x2f2cc2[_0x6028('0x55')]][_0x6028('0x54')]=0x2;queues[_0x2f2cc2[_0x6028('0x55')]][_0x6028('0x7')]=queues[_0x2f2cc2[_0x6028('0x4e')]][_0x6028('0x7')];queues[_0x2f2cc2[_0x6028('0x55')]][_0x6028('0x56')]=queues[_0x2f2cc2['origtransfererlinkedid']]['calleridname'];queues[_0x2f2cc2['transfertargetuniqueid']][_0x6028('0x36')]=utils['now']();queues[_0x2f2cc2[_0x6028('0x55')]][_0x6028('0x19')]=utils[_0x6028('0x16')]();queues[_0x2f2cc2[_0x6028('0x55')]]['holdtime']=0x0;queues[_0x2f2cc2[_0x6028('0x55')]][_0x6028('0x57')]=0x0;utils[_0x6028('0x1')](util[_0x6028('0x2')](_0x6028('0x60'),_0x2f2cc2[_0x6028('0x5a')],queues[_0x2f2cc2[_0x6028('0x55')]][_0x6028('0x20')],queues[_0x2f2cc2[_0x6028('0x55')]][_0x6028('0xf')],queues[_0x2f2cc2[_0x6028('0x55')]]['calleridnum'],queues[_0x2f2cc2[_0x6028('0x55')]]['calleridname']));}else{utils['info'](util[_0x6028('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x2f2cc2['origtransfereruniqueid'],queues[_0x2f2cc2[_0x6028('0x4f')]]['name'],_0x2f2cc2[_0x6028('0x4e')]));queues[_0x2f2cc2[_0x6028('0x4f')]][_0x6028('0xf')]=_0x2f2cc2[_0x6028('0x4e')];}}}}catch(_0xfb6a9c){utils[_0x6028('0x21')](util[_0x6028('0x2')](_0x6028('0x4d'),_0x2f2cc2[_0x6028('0x5a')]),_0xfb6a9c);}};exports[_0x6028('0x61')]=function(_0x18ae87){try{if(!_['isNil'](queues[_0x18ae87[_0x6028('0x13')]])){utils[_0x6028('0x11')](util['format'](_0x6028('0x62'),_0x18ae87[_0x6028('0x13')]),_0x18ae87);queues[_0x18ae87['uniqueid']][_0x6028('0x63')]=utils[_0x6028('0x16')]();utils[_0x6028('0x1')](util[_0x6028('0x2')](_0x6028('0x64'),_0x18ae87[_0x6028('0x13')],queues[_0x18ae87[_0x6028('0x13')]]['name'],queues[_0x18ae87[_0x6028('0x13')]]['musiconholdstartAt']));}}catch(_0x461743){utils[_0x6028('0x21')](util[_0x6028('0x2')](_0x6028('0x62'),_0x18ae87[_0x6028('0x13')]),_0x461743);}};exports[_0x6028('0x65')]=function(_0x2beb95){try{if(!_['isNil'](queues[_0x2beb95['uniqueid']])){if(!_[_0x6028('0x18')](queues[_0x2beb95[_0x6028('0x13')]][_0x6028('0x63')])){utils[_0x6028('0x11')](util[_0x6028('0x2')](_0x6028('0x66'),_0x2beb95['uniqueid']),_0x2beb95);queues[_0x2beb95[_0x6028('0x13')]]['mohtime']+=utils[_0x6028('0x35')](utils[_0x6028('0x16')](),queues[_0x2beb95[_0x6028('0x13')]][_0x6028('0x63')]);utils['info'](util[_0x6028('0x2')](_0x6028('0x67'),_0x2beb95['uniqueid'],queues[_0x2beb95[_0x6028('0x13')]][_0x6028('0x20')],queues[_0x2beb95[_0x6028('0x13')]][_0x6028('0x57')]));delete queues[_0x2beb95['uniqueid']]['musiconholdstartAt'];}}}catch(_0x4ef3c6){utils['error'](util['format'](_0x6028('0x66'),_0x2beb95['uniqueid']),_0x4ef3c6);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 925ce14..a2218c5 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 _0x18f7=['cdr','substring','lastIndexOf','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','info','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','getUserByInternal','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','debug','format','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newstate]','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','linkedid','channelstate','varset','variable','[%s][recordings][varset]','value','endsWith','.wav49','replace','.WAV','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x18f7,0xe6));var _0x718f=function(_0x46e1b0,_0x145a6d){_0x46e1b0=_0x46e1b0-0x0;var _0x31520a=_0x18f7[_0x46e1b0];return _0x31520a;};'use strict';var _=require(_0x718f('0x0'));var util=require(_0x718f('0x1'));var utils=require(_0x718f('0x2'));var transfers=require(_0x718f('0x3'));var recordings={};function writeDB(_0x4c819f){var _0x28d9b6;utils[_0x718f('0x4')](util['format'](_0x718f('0x5'),_0x4c819f[_0x718f('0x6')]));if(transfers[_0x718f('0x7')][_0x4c819f['uniqueid']]){_0x28d9b6=_0x4c819f[_0x718f('0x6')];_0x4c819f['uniqueid']=transfers[_0x718f('0x7')][_0x4c819f['uniqueid']][_0x718f('0x8')];}if(_0x4c819f['accountcode']){utils[_0x718f('0x9')](_0x4c819f[_0x718f('0xa')])[_0x718f('0xb')](function(_0x5254e0){if(_0x5254e0){_0x4c819f[_0x718f('0xc')]=_0x5254e0[_0x718f('0xd')];_0x4c819f[_0x718f('0xe')]=_0x5254e0['id'];}utils[_0x718f('0xf')](_0x718f('0x10'),_0x4c819f);});}else{utils[_0x718f('0xf')]('CreateVoiceRecording',_0x4c819f);}if(_0x28d9b6)delete transfers[_0x718f('0x7')][_0x28d9b6];}exports['newchannel']=function(_0x20ad74){try{utils[_0x718f('0x11')](util[_0x718f('0x12')](_0x718f('0x13'),_0x20ad74['uniqueid']),_0x20ad74);if(_0x20ad74[_0x718f('0x6')]==_0x20ad74['linkedid']){utils[_0x718f('0x4')](util['format'](_0x718f('0x14'),_0x20ad74[_0x718f('0x6')],_0x20ad74[_0x718f('0x15')],_0x20ad74[_0x718f('0x16')]));recordings[_0x20ad74[_0x718f('0x6')]]={'uniqueid':_0x20ad74[_0x718f('0x6')],'accountcode':_0x20ad74[_0x718f('0xa')],'exten':_0x20ad74['exten'],'context':_0x20ad74['context'],'channel':_0x20ad74[_0x718f('0x17')],'monitors':[]};}}catch(_0x1078f5){utils[_0x718f('0x18')](util['format']('[%s][recordings][newchannel]',_0x20ad74[_0x718f('0x6')]),_0x1078f5);}};exports['newstate']=function(_0x5bb3f4){try{utils[_0x718f('0x11')](util[_0x718f('0x12')](_0x718f('0x19'),_0x5bb3f4[_0x718f('0x6')]),_0x5bb3f4);if(!_['isNil'](recordings[_0x5bb3f4[_0x718f('0x6')]])&&_0x5bb3f4['channelstate']==0x6){utils[_0x718f('0x4')](util[_0x718f('0x12')](_0x718f('0x1a'),_0x5bb3f4[_0x718f('0x6')],_0x5bb3f4[_0x718f('0x15')],_0x5bb3f4[_0x718f('0x17')]));}else if(!_[_0x718f('0x1b')](recordings[_0x5bb3f4[_0x718f('0x1c')]])&&_0x5bb3f4[_0x718f('0x1d')]==0x6&&_0x5bb3f4[_0x718f('0x15')]!='transfer'){utils[_0x718f('0x4')](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x5bb3f4['uniqueid'],_0x5bb3f4[_0x718f('0x1c')],_0x5bb3f4[_0x718f('0x15')],_0x5bb3f4[_0x718f('0x17')]));recordings[_0x5bb3f4['linkedid']][_0x718f('0xa')]=_0x5bb3f4[_0x718f('0xa')];}}catch(_0x183009){utils[_0x718f('0x18')](util[_0x718f('0x12')](_0x718f('0x19'),_0x5bb3f4[_0x718f('0x6')]),_0x183009);}};exports[_0x718f('0x1e')]=function(_0x46c74a){try{if(!_[_0x718f('0x1b')](_0x46c74a[_0x718f('0x1f')])&&!_[_0x718f('0x1b')](_0x46c74a[_0x718f('0x1f')]['mixmonitor_filename'])){utils['debug'](util[_0x718f('0x12')](_0x718f('0x20'),_0x46c74a[_0x718f('0x6')]),_0x46c74a);utils['info'](util[_0x718f('0x12')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x46c74a[_0x718f('0x6')],_0x46c74a[_0x718f('0x1f')],_0x46c74a[_0x718f('0x21')]));if(_[_0x718f('0x22')](_0x46c74a['value'],_0x718f('0x23'))){_0x46c74a['value']=_0x46c74a[_0x718f('0x21')][_0x718f('0x24')](_0x718f('0x23'),_0x718f('0x25'));}if(recordings[_0x46c74a[_0x718f('0x1c')]]){var _0x3e4628=_['find'](recordings[_0x46c74a[_0x718f('0x1c')]][_0x718f('0x26')],{'value':_0x46c74a[_0x718f('0x21')]});if(_[_0x718f('0x1b')](_0x3e4628)){recordings[_0x46c74a[_0x718f('0x1c')]][_0x718f('0x26')][_0x718f('0x27')]({'value':_0x46c74a['value']});}}}}catch(_0x17fc13){utils[_0x718f('0x18')](util[_0x718f('0x12')]('[%s][recordings][varset]',_0x46c74a['uniqueid']),_0x17fc13);}};exports['hangup']=function(_0x281051){try{if(!_[_0x718f('0x1b')](recordings[_0x281051['uniqueid']])){utils['debug'](util[_0x718f('0x12')](_0x718f('0x28'),_0x281051['uniqueid']),_0x281051);utils[_0x718f('0x4')](util['format'](_0x718f('0x29'),_0x281051[_0x718f('0x6')],_0x281051[_0x718f('0x2a')],_0x281051[_0x718f('0x2b')],_0x281051[_0x718f('0x2c')]));recordings[_0x281051[_0x718f('0x6')]][_0x718f('0x2a')]=_0x281051[_0x718f('0x2a')];recordings[_0x281051[_0x718f('0x6')]][_0x718f('0x2b')]=_0x281051[_0x718f('0x2b')];recordings[_0x281051[_0x718f('0x6')]][_0x718f('0x2d')]=_0x281051[_0x718f('0x2d')];recordings[_0x281051[_0x718f('0x6')]][_0x718f('0x2e')]=_0x281051[_0x718f('0x2e')];if(recordings[_0x281051[_0x718f('0x6')]]['type']==_0x718f('0x2f')&&recordings[_0x281051[_0x718f('0x6')]][_0x718f('0xa')]){recordings[_0x281051['uniqueid']]['connectedlinenum']=recordings[_0x281051[_0x718f('0x6')]][_0x718f('0xa')];recordings[_0x281051[_0x718f('0x6')]][_0x718f('0x2e')]='';}recordings[_0x281051[_0x718f('0x6')]][_0x718f('0x26')][_0x718f('0x30')](function(_0x316a24){var _0x287a1f=_[_0x718f('0x31')](recordings[_0x281051[_0x718f('0x6')]]);_0x287a1f['value']=_0x316a24['value'];writeDB(_0x287a1f);});delete recordings[_0x281051[_0x718f('0x6')]];}}catch(_0x2ff6c5){utils[_0x718f('0x18')](util[_0x718f('0x12')](_0x718f('0x28'),_0x281051[_0x718f('0x6')]),_0x2ff6c5);}};exports[_0x718f('0x32')]=function(_0x4f6430){try{if(!_[_0x718f('0x1b')](recordings[_0x4f6430['uniqueid']])){utils[_0x718f('0x11')](util[_0x718f('0x12')](_0x718f('0x33'),_0x4f6430['uniqueid']),_0x4f6430);utils['info'](util[_0x718f('0x12')](_0x718f('0x34'),_0x4f6430[_0x718f('0x6')],_0x4f6430[_0x718f('0x35')],_0x4f6430['appdata']));if(_0x4f6430[_0x718f('0x35')][_0x718f('0x36')]()==_0x718f('0x37')&&_[_0x718f('0x38')](_0x4f6430[_0x718f('0x39')][_0x718f('0x36')](),_0x718f('0x3a'))){var _0x4f4e3b=_0x4f6430[_0x718f('0x39')]['split']('=');var _0x2672fe=_0x4f4e3b[0x0][_0x718f('0x3b')](_0x4f4e3b[0x0][_0x718f('0x3c')]('(')+0x1,_0x4f4e3b[0x0][_0x718f('0x3c')](')'));var _0x43afea=_0x4f4e3b[0x1];recordings[_0x4f6430[_0x718f('0x6')]][_0x2672fe]=_0x43afea;}}}catch(_0x8041cb){utils[_0x718f('0x18')](util['format'](_0x718f('0x33'),_0x4f6430['uniqueid']),_0x8041cb);}};exports['queuecallerjoin']=function(_0x36d398){try{if(!_[_0x718f('0x1b')](recordings[_0x36d398[_0x718f('0x6')]])){utils['debug'](util['format']('[%s][recordings][queuecallerjoin]',_0x36d398[_0x718f('0x6')]),_0x36d398);utils['info'](util[_0x718f('0x12')](_0x718f('0x3d'),_0x36d398['uniqueid'],_0x36d398[_0x718f('0x3e')]));recordings[_0x36d398[_0x718f('0x6')]][_0x718f('0x3e')]=_0x36d398[_0x718f('0x3e')];}}catch(_0x3f7693){utils[_0x718f('0x18')](util['format'](_0x718f('0x3f'),_0x36d398[_0x718f('0x6')]),_0x3f7693);}};exports[_0x718f('0x40')]=function(_0x525901){try{utils[_0x718f('0x11')](util[_0x718f('0x12')](_0x718f('0x41'),_0x525901['uniqueid']),_0x525901);utils[_0x718f('0x4')](util[_0x718f('0x12')](_0x718f('0x42'),_0x525901[_0x718f('0x6')],_0x525901[_0x718f('0x43')],_0x525901[_0x718f('0x44')],_0x525901[_0x718f('0x45')],_0x525901['transfereecalleridname']));if(recordings[_0x525901[_0x718f('0x46')]]&&transfers[_0x718f('0x7')][_0x525901[_0x718f('0x46')]]){transfers[_0x718f('0x7')][_0x525901[_0x718f('0x46')]][_0x718f('0x47')]=!![];}}catch(_0x48f5b0){utils[_0x718f('0x18')](util[_0x718f('0x12')](_0x718f('0x41'),_0x525901[_0x718f('0x6')]),_0x48f5b0);}}; \ No newline at end of file +var _0xa08e=['variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','find','monitors','push','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','application','toLowerCase','set','startsWith','appdata','cdr','split','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','[%s][recordings][blindtransfer]','lodash','util','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','linkedid','context','exten','channel','error','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset'];(function(_0x21b762,_0xc8ef11){var _0x2ea6d4=function(_0x22bd14){while(--_0x22bd14){_0x21b762['push'](_0x21b762['shift']());}};_0x2ea6d4(++_0xc8ef11);}(_0xa08e,0x6f));var _0xea08=function(_0x2678d6,_0x4e2001){_0x2678d6=_0x2678d6-0x0;var _0x475503=_0xa08e[_0x2678d6];return _0x475503;};'use strict';var _=require(_0xea08('0x0'));var util=require(_0xea08('0x1'));var utils=require('./utils');var transfers=require(_0xea08('0x2'));var recordings={};function writeDB(_0x509099){var _0x37bd4b;utils[_0xea08('0x3')](util[_0xea08('0x4')](_0xea08('0x5'),_0x509099[_0xea08('0x6')]));if(transfers[_0xea08('0x7')][_0x509099[_0xea08('0x6')]]){_0x37bd4b=_0x509099[_0xea08('0x6')];_0x509099['uniqueid']=transfers[_0xea08('0x7')][_0x509099[_0xea08('0x6')]][_0xea08('0x8')];}if(_0x509099[_0xea08('0x9')]){utils[_0xea08('0xa')](_0x509099[_0xea08('0x9')])['then'](function(_0x3b533a){if(_0x3b533a){_0x509099[_0xea08('0xb')]=_0x3b533a[_0xea08('0xc')];_0x509099[_0xea08('0xd')]=_0x3b533a['id'];}utils[_0xea08('0xe')](_0xea08('0xf'),_0x509099);});}else{utils['request'](_0xea08('0xf'),_0x509099);}if(_0x37bd4b)delete transfers[_0xea08('0x7')][_0x37bd4b];}exports[_0xea08('0x10')]=function(_0x2b546b){try{utils[_0xea08('0x11')](util[_0xea08('0x4')]('[%s][recordings][newchannel]',_0x2b546b[_0xea08('0x6')]),_0x2b546b);if(_0x2b546b[_0xea08('0x6')]==_0x2b546b[_0xea08('0x12')]){utils[_0xea08('0x3')](util[_0xea08('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x2b546b[_0xea08('0x6')],_0x2b546b[_0xea08('0x13')],_0x2b546b[_0xea08('0x14')]));recordings[_0x2b546b[_0xea08('0x6')]]={'uniqueid':_0x2b546b['uniqueid'],'accountcode':_0x2b546b[_0xea08('0x9')],'exten':_0x2b546b[_0xea08('0x14')],'context':_0x2b546b['context'],'channel':_0x2b546b[_0xea08('0x15')],'monitors':[]};}}catch(_0x18b6ae){utils[_0xea08('0x16')](util[_0xea08('0x4')]('[%s][recordings][newchannel]',_0x2b546b[_0xea08('0x6')]),_0x18b6ae);}};exports['newstate']=function(_0x177b77){try{utils[_0xea08('0x11')](util['format'](_0xea08('0x17'),_0x177b77[_0xea08('0x6')]),_0x177b77);if(!_[_0xea08('0x18')](recordings[_0x177b77[_0xea08('0x6')]])&&_0x177b77[_0xea08('0x19')]==0x6){utils['info'](util[_0xea08('0x4')](_0xea08('0x1a'),_0x177b77[_0xea08('0x6')],_0x177b77[_0xea08('0x13')],_0x177b77['channel']));}else if(!_[_0xea08('0x18')](recordings[_0x177b77[_0xea08('0x12')]])&&_0x177b77[_0xea08('0x19')]==0x6&&_0x177b77[_0xea08('0x13')]!='transfer'){utils['info'](util[_0xea08('0x4')](_0xea08('0x1b'),_0x177b77[_0xea08('0x6')],_0x177b77['linkedid'],_0x177b77[_0xea08('0x13')],_0x177b77['channel']));recordings[_0x177b77['linkedid']]['accountcode']=_0x177b77[_0xea08('0x9')];}}catch(_0x323559){utils['error'](util[_0xea08('0x4')](_0xea08('0x17'),_0x177b77[_0xea08('0x6')]),_0x323559);}};exports[_0xea08('0x1c')]=function(_0x201143){try{if(!_[_0xea08('0x18')](_0x201143[_0xea08('0x1d')])&&!_['isNil'](_0x201143[_0xea08('0x1d')][_0xea08('0x1e')])){utils[_0xea08('0x11')](util[_0xea08('0x4')](_0xea08('0x1f'),_0x201143[_0xea08('0x6')]),_0x201143);utils[_0xea08('0x3')](util[_0xea08('0x4')](_0xea08('0x20'),_0x201143['uniqueid'],_0x201143['variable'],_0x201143['value']));if(_['endsWith'](_0x201143[_0xea08('0x21')],_0xea08('0x22'))){_0x201143[_0xea08('0x21')]=_0x201143[_0xea08('0x21')][_0xea08('0x23')](_0xea08('0x22'),'.WAV');}if(recordings[_0x201143['linkedid']]){var _0x14057e=_[_0xea08('0x24')](recordings[_0x201143['linkedid']]['monitors'],{'value':_0x201143[_0xea08('0x21')]});if(_[_0xea08('0x18')](_0x14057e)){recordings[_0x201143[_0xea08('0x12')]][_0xea08('0x25')][_0xea08('0x26')]({'value':_0x201143[_0xea08('0x21')]});}}}}catch(_0x3996b6){utils[_0xea08('0x16')](util[_0xea08('0x4')](_0xea08('0x1f'),_0x201143[_0xea08('0x6')]),_0x3996b6);}};exports['hangup']=function(_0x1151df){try{if(!_[_0xea08('0x18')](recordings[_0x1151df[_0xea08('0x6')]])){utils[_0xea08('0x11')](util[_0xea08('0x4')]('[%s][recordings][hangup]',_0x1151df[_0xea08('0x6')]),_0x1151df);utils[_0xea08('0x3')](util[_0xea08('0x4')](_0xea08('0x27'),_0x1151df[_0xea08('0x6')],_0x1151df[_0xea08('0x28')],_0x1151df[_0xea08('0x29')],_0x1151df[_0xea08('0x2a')]));recordings[_0x1151df[_0xea08('0x6')]][_0xea08('0x28')]=_0x1151df[_0xea08('0x28')];recordings[_0x1151df['uniqueid']][_0xea08('0x29')]=_0x1151df[_0xea08('0x29')];recordings[_0x1151df[_0xea08('0x6')]][_0xea08('0x2b')]=_0x1151df[_0xea08('0x2b')];recordings[_0x1151df[_0xea08('0x6')]][_0xea08('0x2c')]=_0x1151df[_0xea08('0x2c')];if(recordings[_0x1151df[_0xea08('0x6')]]['type']==_0xea08('0x2d')&&recordings[_0x1151df[_0xea08('0x6')]][_0xea08('0x9')]){recordings[_0x1151df['uniqueid']][_0xea08('0x2b')]=recordings[_0x1151df['uniqueid']]['accountcode'];recordings[_0x1151df[_0xea08('0x6')]][_0xea08('0x2c')]='';}recordings[_0x1151df[_0xea08('0x6')]][_0xea08('0x25')][_0xea08('0x2e')](function(_0xc50073){var _0x37c3ef=_[_0xea08('0x2f')](recordings[_0x1151df[_0xea08('0x6')]]);_0x37c3ef[_0xea08('0x21')]=_0xc50073[_0xea08('0x21')];writeDB(_0x37c3ef);});delete recordings[_0x1151df[_0xea08('0x6')]];}}catch(_0x56f819){utils[_0xea08('0x16')](util[_0xea08('0x4')](_0xea08('0x30'),_0x1151df['uniqueid']),_0x56f819);}};exports[_0xea08('0x31')]=function(_0x167a83){try{if(!_[_0xea08('0x18')](recordings[_0x167a83['uniqueid']])){utils[_0xea08('0x11')](util[_0xea08('0x4')](_0xea08('0x32'),_0x167a83[_0xea08('0x6')]),_0x167a83);utils[_0xea08('0x3')](util['format']('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x167a83[_0xea08('0x6')],_0x167a83[_0xea08('0x33')],_0x167a83['appdata']));if(_0x167a83[_0xea08('0x33')][_0xea08('0x34')]()==_0xea08('0x35')&&_[_0xea08('0x36')](_0x167a83[_0xea08('0x37')]['toLowerCase'](),_0xea08('0x38'))){var _0x3e5dc4=_0x167a83['appdata'][_0xea08('0x39')]('=');var _0x134114=_0x3e5dc4[0x0]['substring'](_0x3e5dc4[0x0]['lastIndexOf']('(')+0x1,_0x3e5dc4[0x0]['lastIndexOf'](')'));var _0x279899=_0x3e5dc4[0x1];recordings[_0x167a83[_0xea08('0x6')]][_0x134114]=_0x279899;}}}catch(_0x3b8d51){utils[_0xea08('0x16')](util[_0xea08('0x4')](_0xea08('0x32'),_0x167a83['uniqueid']),_0x3b8d51);}};exports[_0xea08('0x3a')]=function(_0x1109a7){try{if(!_[_0xea08('0x18')](recordings[_0x1109a7[_0xea08('0x6')]])){utils[_0xea08('0x11')](util[_0xea08('0x4')]('[%s][recordings][queuecallerjoin]',_0x1109a7['uniqueid']),_0x1109a7);utils[_0xea08('0x3')](util[_0xea08('0x4')](_0xea08('0x3b'),_0x1109a7[_0xea08('0x6')],_0x1109a7[_0xea08('0x3c')]));recordings[_0x1109a7['uniqueid']][_0xea08('0x3c')]=_0x1109a7[_0xea08('0x3c')];}}catch(_0x12b59f){utils['error'](util[_0xea08('0x4')](_0xea08('0x3d'),_0x1109a7[_0xea08('0x6')]),_0x12b59f);}};exports['blindtransfer']=function(_0x449bb0){try{utils[_0xea08('0x11')](util[_0xea08('0x4')]('[%s][recordings][blindtransfer]',_0x449bb0[_0xea08('0x6')]),_0x449bb0);utils['info'](util[_0xea08('0x4')](_0xea08('0x3e'),_0x449bb0[_0xea08('0x6')],_0x449bb0[_0xea08('0x3f')],_0x449bb0[_0xea08('0x40')],_0x449bb0[_0xea08('0x41')],_0x449bb0[_0xea08('0x42')]));if(recordings[_0x449bb0[_0xea08('0x43')]]&&transfers[_0xea08('0x7')][_0x449bb0[_0xea08('0x43')]]){transfers['blinds'][_0x449bb0[_0xea08('0x43')]][_0xea08('0x44')]=!![];}}catch(_0x8cc91d){utils[_0xea08('0x16')](util[_0xea08('0x4')](_0xea08('0x45'),_0x449bb0[_0xea08('0x6')]),_0x8cc91d);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 96063a5..e9ef8fc 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 _0x79d9=['origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','attended','isNil','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','blinds','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','transfertargetcalleridname','assign'];(function(_0x4a43e7,_0x335cfc){var _0x55aaf7=function(_0x59b619){while(--_0x59b619){_0x4a43e7['push'](_0x4a43e7['shift']());}};_0x55aaf7(++_0x335cfc);}(_0x79d9,0x145));var _0x979d=function(_0x57a9ea,_0x88436d){_0x57a9ea=_0x57a9ea-0x0;var _0x15126d=_0x79d9[_0x57a9ea];return _0x15126d;};'use strict';var _=require(_0x979d('0x0'));var util=require(_0x979d('0x1'));var utils=require(_0x979d('0x2'));function writeDB(_0x212d49){utils[_0x979d('0x3')](util[_0x979d('0x4')](_0x979d('0x5'),_0x212d49[_0x979d('0x6')]==='attended'?_0x212d49[_0x979d('0x7')]:_0x212d49['uniqueid'],_0x212d49[_0x979d('0x6')]));utils[_0x979d('0x8')](_0x979d('0x9'),_0x212d49);}exports['blinds']={};exports[_0x979d('0xa')]=function(_0x37ebf6){try{utils[_0x979d('0xb')](util[_0x979d('0x4')](_0x979d('0xc'),_0x37ebf6[_0x979d('0xd')]),_0x37ebf6);utils['info'](util[_0x979d('0x4')](_0x979d('0xe'),_0x37ebf6[_0x979d('0xd')],_0x37ebf6[_0x979d('0xf')],_0x37ebf6['transferercalleridname'],_0x37ebf6[_0x979d('0x10')],_0x37ebf6[_0x979d('0x11')]));_0x37ebf6[_0x979d('0x6')]=_0x979d('0x12');exports[_0x979d('0x13')][_0x37ebf6[_0x979d('0x14')]]=_0x37ebf6;writeDB(_0x37ebf6);}catch(_0x163ad0){utils[_0x979d('0x15')](util['format']('[%s][transfers][blindtransfer]',_0x37ebf6['uniqueid']),_0x163ad0);}};exports[_0x979d('0x16')]=function(_0x4b958b){try{utils['debug'](util[_0x979d('0x4')](_0x979d('0x17'),_0x4b958b[_0x979d('0x7')]),_0x4b958b);utils[_0x979d('0x3')](util[_0x979d('0x4')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x4b958b['origtransfereruniqueid'],_0x4b958b['origtransferercalleridnum'],_0x4b958b['origtransferercalleridname'],_0x4b958b['transfertargetcalleridnum'],_0x4b958b[_0x979d('0x18')]));_0x4b958b=_[_0x979d('0x19')](_0x4b958b,{'transfererchannel':_0x4b958b['origtransfererchannel'],'transferercalleridnum':_0x4b958b[_0x979d('0x1a')],'transferercalleridname':_0x4b958b['origtransferercalleridname'],'transfererconnectedlinenum':_0x4b958b[_0x979d('0x1b')],'transfererconnectedlinename':_0x4b958b['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4b958b[_0x979d('0x1c')],'transferercontext':_0x4b958b[_0x979d('0x1d')],'transfererexten':_0x4b958b[_0x979d('0x1e')],'transfererlinkedid':_0x4b958b[_0x979d('0x1f')],'context':_0x4b958b[_0x979d('0x20')],'extension':_0x4b958b['origtransfererexten'],'type':_0x979d('0x21')});if(_[_0x979d('0x22')](_0x4b958b['transfereechannel'])){_0x4b958b=_['assign'](_0x4b958b,{'transfereechannel':_0x4b958b['transfertargetchannel'],'transfereecalleridnum':_0x4b958b[_0x979d('0x23')],'transfereecalleridname':_0x4b958b[_0x979d('0x18')],'transfereeconnectedlinenum':_0x4b958b[_0x979d('0x24')],'transfereeconnectedlinename':_0x4b958b[_0x979d('0x25')],'transfereeaccountcode':_0x4b958b[_0x979d('0x26')],'transfereecontext':_0x4b958b['transfertargetcontext'],'transfereeexten':_0x4b958b['transfertargetexten'],'transfereelinkedid':_0x4b958b['transfertargetlinkedid']});}writeDB(_0x4b958b);}catch(_0x1dd978){utils[_0x979d('0x15')](util[_0x979d('0x4')]('[%s][transfers][attendedtransfer]',_0x4b958b[_0x979d('0x7')]),_0x1dd978);}}; \ No newline at end of file +var _0xf295=['blindtransfer','[%s][transfers][blindtransfer]','uniqueid','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','transfereruniqueid','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','util','format','[%s][transfers][writeDB]\x20type:%s','type','request','CreateVoiceTransferReport','blinds'];(function(_0x4dc8fc,_0x27d9a5){var _0x18d77f=function(_0x49050c){while(--_0x49050c){_0x4dc8fc['push'](_0x4dc8fc['shift']());}};_0x18d77f(++_0x27d9a5);}(_0xf295,0x1b1));var _0x5f29=function(_0x3f7925,_0x550b45){_0x3f7925=_0x3f7925-0x0;var _0x15b0ee=_0xf295[_0x3f7925];return _0x15b0ee;};'use strict';var _=require('lodash');var util=require(_0x5f29('0x0'));var utils=require('./utils');function writeDB(_0x1d623b){utils['info'](util[_0x5f29('0x1')](_0x5f29('0x2'),_0x1d623b[_0x5f29('0x3')]==='attended'?_0x1d623b['origtransfereruniqueid']:_0x1d623b['uniqueid'],_0x1d623b[_0x5f29('0x3')]));utils[_0x5f29('0x4')](_0x5f29('0x5'),_0x1d623b);}exports[_0x5f29('0x6')]={};exports[_0x5f29('0x7')]=function(_0x1b444c){try{utils['debug'](util[_0x5f29('0x1')](_0x5f29('0x8'),_0x1b444c[_0x5f29('0x9')]),_0x1b444c);utils[_0x5f29('0xa')](util[_0x5f29('0x1')](_0x5f29('0xb'),_0x1b444c[_0x5f29('0x9')],_0x1b444c[_0x5f29('0xc')],_0x1b444c[_0x5f29('0xd')],_0x1b444c['transfereecalleridnum'],_0x1b444c[_0x5f29('0xe')]));_0x1b444c['type']='blind';exports[_0x5f29('0x6')][_0x1b444c[_0x5f29('0xf')]]=_0x1b444c;writeDB(_0x1b444c);}catch(_0x1aacd5){utils[_0x5f29('0x10')](util['format'](_0x5f29('0x8'),_0x1b444c['uniqueid']),_0x1aacd5);}};exports[_0x5f29('0x11')]=function(_0x35c3ab){try{utils[_0x5f29('0x12')](util[_0x5f29('0x1')](_0x5f29('0x13'),_0x35c3ab[_0x5f29('0x14')]),_0x35c3ab);utils[_0x5f29('0xa')](util[_0x5f29('0x1')](_0x5f29('0x15'),_0x35c3ab[_0x5f29('0x14')],_0x35c3ab['origtransferercalleridnum'],_0x35c3ab['origtransferercalleridname'],_0x35c3ab[_0x5f29('0x16')],_0x35c3ab[_0x5f29('0x17')]));_0x35c3ab=_[_0x5f29('0x18')](_0x35c3ab,{'transfererchannel':_0x35c3ab['origtransfererchannel'],'transferercalleridnum':_0x35c3ab[_0x5f29('0x19')],'transferercalleridname':_0x35c3ab[_0x5f29('0x1a')],'transfererconnectedlinenum':_0x35c3ab['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x35c3ab[_0x5f29('0x1b')],'transfereraccountcode':_0x35c3ab[_0x5f29('0x1c')],'transferercontext':_0x35c3ab['secondtransferercontext'],'transfererexten':_0x35c3ab['secondtransfererexten'],'transfererlinkedid':_0x35c3ab[_0x5f29('0x1d')],'context':_0x35c3ab[_0x5f29('0x1e')],'extension':_0x35c3ab[_0x5f29('0x1f')],'type':_0x5f29('0x20')});if(_[_0x5f29('0x21')](_0x35c3ab[_0x5f29('0x22')])){_0x35c3ab=_[_0x5f29('0x18')](_0x35c3ab,{'transfereechannel':_0x35c3ab['transfertargetchannel'],'transfereecalleridnum':_0x35c3ab[_0x5f29('0x16')],'transfereecalleridname':_0x35c3ab['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x35c3ab[_0x5f29('0x23')],'transfereeconnectedlinename':_0x35c3ab['transfertargetconnectedlinename'],'transfereeaccountcode':_0x35c3ab[_0x5f29('0x24')],'transfereecontext':_0x35c3ab[_0x5f29('0x25')],'transfereeexten':_0x35c3ab[_0x5f29('0x26')],'transfereelinkedid':_0x35c3ab[_0x5f29('0x27')]});}writeDB(_0x35c3ab);}catch(_0x488ba5){utils[_0x5f29('0x10')](util[_0x5f29('0x1')](_0x5f29('0x13'),_0x35c3ab[_0x5f29('0x14')]),_0x488ba5);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 8e50195..9ccdb55 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 _0x0e6a=['getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','addTime','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','util','client','http','../../config/logger','info','inspect','debug','error','then','[utils][request]\x20name:%s','GetUser','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','catch','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','notfound','[utils][getUserByInterface]'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0x0e6a,0x100));var _0xa0e6=function(_0x3bc7bd,_0x1e7bbc){_0x3bc7bd=_0x3bc7bd-0x0;var _0x2f3d89=_0x0e6a[_0x3bc7bd];return _0x2f3d89;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xa0e6('0x0'));var moment=require(_0xa0e6('0x1'));var util=require(_0xa0e6('0x2'));var client=jayson[_0xa0e6('0x3')][_0xa0e6('0x4')]({'port':0x2329});var logger=require(_0xa0e6('0x5'))('xdr');exports[_0xa0e6('0x6')]=function(_0x19cadf,_0x3b4ce9){logger[_0xa0e6('0x6')](_0x19cadf,_0x3b4ce9?util[_0xa0e6('0x7')](_0x3b4ce9,{'showHidden':![],'depth':null}):'');};exports[_0xa0e6('0x8')]=function(_0x52171c,_0x4e0b00){logger[_0xa0e6('0x8')](_0x52171c,_0x4e0b00?util[_0xa0e6('0x7')](_0x4e0b00,{'showHidden':![],'depth':null}):'');};exports[_0xa0e6('0x9')]=function(_0x4271a7,_0x826963){logger[_0xa0e6('0x9')](_0x4271a7,_0x826963?util['inspect'](_0x826963,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x242eff,_0x1d290f){return client['request'](_0x242eff,{'body':_0x1d290f})[_0xa0e6('0xa')](function(_0x49a867){logger[_0xa0e6('0x8')](_0xa0e6('0xb'),_0x242eff,_0x49a867?util['inspect'](_0x49a867,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x1854b2){logger[_0xa0e6('0x9')](_0xa0e6('0xb'),_0x242eff,_0x1854b2?util[_0xa0e6('0x7')](_0x1854b2,{'showHidden':![],'depth':null}):'');});};function getUser(_0x463a77){return client['request'](_0xa0e6('0xc'),{'options':{'raw':!![],'attributes':['id','internal',_0xa0e6('0xd'),_0xa0e6('0xe')],'where':_0x463a77,'limit':0x1}})['then'](function(_0x197e8b){logger[_0xa0e6('0x8')](_0xa0e6('0xf'),JSON[_0xa0e6('0x10')](_0x463a77),_0x197e8b?util[_0xa0e6('0x7')](_0x197e8b,{'showHidden':![],'depth':null}):'');return _0x197e8b[_0xa0e6('0x11')][_0xa0e6('0x12')]?_0x197e8b['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x535e39){return new BPromise(function(_0x3cc453,_0x18490f){if(_0x535e39){return getUser({'internal':_0x535e39})['then'](function(_0x777543){logger[_0xa0e6('0x6')](_0xa0e6('0x13'),_0x535e39,_0x777543?'found':'notfound');return _0x3cc453(_0x777543);})[_0xa0e6('0x14')](function(_0xa4972a){logger['error'](_0xa0e6('0x15'),_0xa4972a?util[_0xa0e6('0x7')](_0xa4972a,{'showHidden':![],'depth':null}):'');return _0x3cc453(null);});}return _0x3cc453(null);});};exports['getUserByInterface']=function(_0x200849){return new BPromise(function(_0x3d6642,_0x568e91){if(_0x200849){return getUser({'interface':_0x200849})[_0xa0e6('0xa')](function(_0x582ee5){logger[_0xa0e6('0x6')](_0xa0e6('0x16'),_0x200849,_0x582ee5?_0xa0e6('0x17'):_0xa0e6('0x18'));return _0x3d6642(_0x582ee5);})[_0xa0e6('0x14')](function(_0x1182ee){logger[_0xa0e6('0x9')](_0xa0e6('0x19'),_0x1182ee?util[_0xa0e6('0x7')](_0x1182ee,{'showHidden':![],'depth':null}):'');return _0x3d6642(null);});}return _0x3d6642(null);});};exports[_0xa0e6('0x1a')]=function(_0x106367){return new BPromise(function(_0x275269,_0xf35c98){if(_0x106367){return getUser({'name':_0x106367})[_0xa0e6('0xa')](function(_0x18497a){logger[_0xa0e6('0x6')](_0xa0e6('0x1b'),_0x106367,_0x18497a?_0xa0e6('0x17'):_0xa0e6('0x18'));return _0x275269(_0x18497a);})['catch'](function(_0xd5bc26){logger[_0xa0e6('0x9')](_0xa0e6('0x1c'),_0xd5bc26?util[_0xa0e6('0x7')](_0xd5bc26,{'showHidden':![],'depth':null}):'');return _0x275269(null);});}return _0x275269(null);});};exports[_0xa0e6('0x1d')]=function(_0x17c0a5){return new BPromise(function(_0x2a5d3c,_0x51c173){if(_0x17c0a5){return client['request'](_0xa0e6('0x1e'),{'options':{'raw':!![],'attributes':['id',_0xa0e6('0xd'),_0xa0e6('0x1f'),_0xa0e6('0x20'),_0xa0e6('0x21')],'where':{'name':_0x17c0a5},'limit':0x1}})[_0xa0e6('0xa')](function(_0x26e407){logger[_0xa0e6('0x8')](_0xa0e6('0x22'),_0x17c0a5,_0x26e407?util[_0xa0e6('0x7')](_0x26e407,{'showHidden':![],'depth':null}):'');logger[_0xa0e6('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x17c0a5,_0x26e407?'found':'notfound');return _0x2a5d3c(_0x26e407[_0xa0e6('0x11')][_0xa0e6('0x12')]?_0x26e407[_0xa0e6('0x11')][0x0]:null);})[_0xa0e6('0x14')](function(_0x59f602){logger[_0xa0e6('0x9')]('[utils][getVoiceQueueByName]',_0x59f602?util[_0xa0e6('0x7')](_0x59f602,{'showHidden':![],'depth':null}):'');return _0x2a5d3c(null);});}return _0x2a5d3c(null);});};exports[_0xa0e6('0x23')]=function(_0x4dad9a,_0x198b64){return moment(_0x4dad9a)['add'](_0x198b64,'seconds')[_0xa0e6('0x24')](_0xa0e6('0x25'));};exports[_0xa0e6('0x26')]=function(_0x56eddf,_0x44df47){return moment(_0x56eddf)[_0xa0e6('0x27')](_0x44df47,_0xa0e6('0x28'))[_0xa0e6('0x24')](_0xa0e6('0x25'));};exports[_0xa0e6('0x29')]=function(_0x23e3f6,_0x3dbf99){return moment(_0x23e3f6)[_0xa0e6('0x2a')](moment(_0x3dbf99),_0xa0e6('0x28'));};exports[_0xa0e6('0x2b')]=function(_0x1974df,_0x2ca990){return parseInt(_0x1974df,0xa)+parseInt(_0x2ca990,0xa);};exports[_0xa0e6('0x2c')]=function(){return moment()[_0xa0e6('0x24')](_0xa0e6('0x25'));};exports[_0xa0e6('0x2d')]=function(_0xee691d,_0x1c1ffd){if(_0x1c1ffd){return moment(_0xee691d)[_0xa0e6('0x2d')](_0x1c1ffd);}return!![];};exports['isBefore']=function(_0x6c309e,_0x43d4b){if(_0x43d4b){return moment(_0x6c309e)[_0xa0e6('0x2e')](_0x43d4b);}else if(_0x6c309e){return!![];}return![];}; \ No newline at end of file +var _0x7181=['error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByInterface]','getUserByName','getVoiceQueueByName','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtract','format','diffTime','diff','now','isAfter','isBefore','bluebird','moment','util','client','http','../../config/logger','xdr','info','inspect','debug'];(function(_0x218972,_0x1f9794){var _0x1bb1a8=function(_0x3fb962){while(--_0x3fb962){_0x218972['push'](_0x218972['shift']());}};_0x1bb1a8(++_0x1f9794);}(_0x7181,0x11c));var _0x1718=function(_0x1f79c9,_0x21021b){_0x1f79c9=_0x1f79c9-0x0;var _0x1cfcf9=_0x7181[_0x1f79c9];return _0x1cfcf9;};'use strict';var BPromise=require(_0x1718('0x0'));var jayson=require('jayson/promise');var moment=require(_0x1718('0x1'));var util=require(_0x1718('0x2'));var client=jayson[_0x1718('0x3')][_0x1718('0x4')]({'port':0x2329});var logger=require(_0x1718('0x5'))(_0x1718('0x6'));exports['info']=function(_0x1447b9,_0x218ff6){logger[_0x1718('0x7')](_0x1447b9,_0x218ff6?util[_0x1718('0x8')](_0x218ff6,{'showHidden':![],'depth':null}):'');};exports[_0x1718('0x9')]=function(_0x5a93c3,_0x2f98c2){logger[_0x1718('0x9')](_0x5a93c3,_0x2f98c2?util['inspect'](_0x2f98c2,{'showHidden':![],'depth':null}):'');};exports[_0x1718('0xa')]=function(_0x5a0c45,_0x4f1163){logger['error'](_0x5a0c45,_0x4f1163?util[_0x1718('0x8')](_0x4f1163,{'showHidden':![],'depth':null}):'');};exports[_0x1718('0xb')]=function(_0x4af642,_0x49130e){return client[_0x1718('0xb')](_0x4af642,{'body':_0x49130e})[_0x1718('0xc')](function(_0x226d0d){logger['debug'](_0x1718('0xd'),_0x4af642,_0x226d0d?util['inspect'](_0x226d0d,{'showHidden':![],'depth':null}):'');})[_0x1718('0xe')](function(_0x114c76){logger[_0x1718('0xa')](_0x1718('0xd'),_0x4af642,_0x114c76?util[_0x1718('0x8')](_0x114c76,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3f87ff){return client[_0x1718('0xb')](_0x1718('0xf'),{'options':{'raw':!![],'attributes':['id',_0x1718('0x10'),_0x1718('0x11'),_0x1718('0x12')],'where':_0x3f87ff,'limit':0x1}})[_0x1718('0xc')](function(_0x36d52d){logger[_0x1718('0x9')](_0x1718('0x13'),JSON[_0x1718('0x14')](_0x3f87ff),_0x36d52d?util[_0x1718('0x8')](_0x36d52d,{'showHidden':![],'depth':null}):'');return _0x36d52d[_0x1718('0x15')][_0x1718('0x16')]?_0x36d52d[_0x1718('0x15')][0x0]:null;});}exports[_0x1718('0x17')]=function(_0x5e4779){return new BPromise(function(_0x41b23c,_0x263b3b){if(_0x5e4779){return getUser({'internal':_0x5e4779})['then'](function(_0x5665b6){logger['info'](_0x1718('0x18'),_0x5e4779,_0x5665b6?_0x1718('0x19'):'notfound');return _0x41b23c(_0x5665b6);})[_0x1718('0xe')](function(_0x485932){logger[_0x1718('0xa')](_0x1718('0x1a'),_0x485932?util[_0x1718('0x8')](_0x485932,{'showHidden':![],'depth':null}):'');return _0x41b23c(null);});}return _0x41b23c(null);});};exports[_0x1718('0x1b')]=function(_0x306e43){return new BPromise(function(_0x2f67de,_0x30c158){if(_0x306e43){return getUser({'interface':_0x306e43})[_0x1718('0xc')](function(_0x3f69f7){logger['info'](_0x1718('0x1c'),_0x306e43,_0x3f69f7?_0x1718('0x19'):_0x1718('0x1d'));return _0x2f67de(_0x3f69f7);})['catch'](function(_0x3afc34){logger['error'](_0x1718('0x1e'),_0x3afc34?util[_0x1718('0x8')](_0x3afc34,{'showHidden':![],'depth':null}):'');return _0x2f67de(null);});}return _0x2f67de(null);});};exports[_0x1718('0x1f')]=function(_0x1c5ab1){return new BPromise(function(_0x4a2f8f,_0x68bf31){if(_0x1c5ab1){return getUser({'name':_0x1c5ab1})[_0x1718('0xc')](function(_0x2f74e5){logger[_0x1718('0x7')]('[utils][getUserByName]\x20name:%s\x20%s',_0x1c5ab1,_0x2f74e5?_0x1718('0x19'):_0x1718('0x1d'));return _0x4a2f8f(_0x2f74e5);})[_0x1718('0xe')](function(_0x560208){logger['error']('[utils][getUserByName]',_0x560208?util['inspect'](_0x560208,{'showHidden':![],'depth':null}):'');return _0x4a2f8f(null);});}return _0x4a2f8f(null);});};exports[_0x1718('0x20')]=function(_0x20aca1){return new BPromise(function(_0x459d29,_0x212bdb){if(_0x20aca1){return client[_0x1718('0xb')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0x1718('0x21'),_0x1718('0x22'),'acwTimeout'],'where':{'name':_0x20aca1},'limit':0x1}})[_0x1718('0xc')](function(_0x127be1){logger[_0x1718('0x9')](_0x1718('0x23'),_0x20aca1,_0x127be1?util['inspect'](_0x127be1,{'showHidden':![],'depth':null}):'');logger['info'](_0x1718('0x24'),_0x20aca1,_0x127be1?'found':'notfound');return _0x459d29(_0x127be1['result']['length']?_0x127be1[_0x1718('0x15')][0x0]:null);})[_0x1718('0xe')](function(_0x50826b){logger[_0x1718('0xa')](_0x1718('0x25'),_0x50826b?util['inspect'](_0x50826b,{'showHidden':![],'depth':null}):'');return _0x459d29(null);});}return _0x459d29(null);});};exports[_0x1718('0x26')]=function(_0x4cdd01,_0x3c2149){return moment(_0x4cdd01)[_0x1718('0x27')](_0x3c2149,_0x1718('0x28'))['format'](_0x1718('0x29'));};exports['subtractTime']=function(_0x574f20,_0x21fbae){return moment(_0x574f20)[_0x1718('0x2a')](_0x21fbae,'seconds')[_0x1718('0x2b')](_0x1718('0x29'));};exports[_0x1718('0x2c')]=function(_0x1b8eb5,_0x5bbdc5){return moment(_0x1b8eb5)[_0x1718('0x2d')](moment(_0x5bbdc5),'seconds');};exports['sumTime']=function(_0x415522,_0x431b9){return parseInt(_0x415522,0xa)+parseInt(_0x431b9,0xa);};exports[_0x1718('0x2e')]=function(){return moment()[_0x1718('0x2b')](_0x1718('0x29'));};exports[_0x1718('0x2f')]=function(_0x260384,_0x451fba){if(_0x451fba){return moment(_0x260384)[_0x1718('0x2f')](_0x451fba);}return!![];};exports[_0x1718('0x30')]=function(_0x50b9d4,_0x1d59e6){if(_0x1d59e6){return moment(_0x50b9d4)[_0x1718('0x30')](_0x1d59e6);}else if(_0x50b9d4){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index f63b141..9dde8c4 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1f7=['x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','method','other','agent_name','test','setupLoggers','fs-extra','lodash','path','util','fileLogger','safeTemplate','maskSensitiveData','join','/var','log','xcally','client','ensureDir','then','catch','user','no-user','data','timestamp','error','api','auth','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','\x20body=%s','body','format','headers'];(function(_0x6a6ee2,_0x356a69){var _0x4a53b4=function(_0x466b7b){while(--_0x466b7b){_0x6a6ee2['push'](_0x6a6ee2['shift']());}};_0x4a53b4(++_0x356a69);}(_0xc1f7,0x152));var _0x7c1f=function(_0x14c9de,_0x5e6146){_0x14c9de=_0x14c9de-0x0;var _0x1712f1=_0xc1f7[_0x14c9de];return _0x1712f1;};var fs=require(_0x7c1f('0x0'));var _=require(_0x7c1f('0x1'));var ewinston=require('express-winston');var path=require(_0x7c1f('0x2'));var util=require(_0x7c1f('0x3'));var fileLogger=require('./loggers')[_0x7c1f('0x4')];var safeTemplate=require('./safe-template')[_0x7c1f('0x5')];var maskSensitiveData=require('./mask-sensitive-data')[_0x7c1f('0x6')];function ClientSideLogger(){function _0x4cfd8c(_0x148daf){var _0x91d9db=path[_0x7c1f('0x7')](_0x7c1f('0x8'),_0x7c1f('0x9'),_0x7c1f('0xa'));var _0x5583fc=path[_0x7c1f('0x7')](_0x7c1f('0xb'),_0x148daf['role']+'-'+_0x148daf['name']);return fs[_0x7c1f('0xc')](path[_0x7c1f('0x7')](_0x91d9db,_0x5583fc))[_0x7c1f('0xd')](function(){var _0x339a56=fileLogger(_0x7c1f('0xb'),path['join'](_0x91d9db,_0x5583fc));return _0x339a56;})[_0x7c1f('0xe')](function(_0x415e8c){throw _0x415e8c;});}this[_0x7c1f('0x9')]=function(_0x3938a6,_0x272d53,_0x2c4f22,_0x357bd7){return _0x4cfd8c(_0x3938a6[_0x7c1f('0xf')])['then'](function(_0x1cf2eb){var _0x49bc36=_0x1cf2eb[_0x272d53];return _0x49bc36;})[_0x7c1f('0xd')](function(_0x58c884){var _0x4babba=_0x3938a6[_0x7c1f('0xf')]?_0x3938a6['user']['id']:_0x7c1f('0x10');var _0x2837b1=_0x357bd7[_0x7c1f('0x11')];var _0x2fef29=_0x357bd7[_0x7c1f('0x12')];var _0xbc8ca0=new Date(Number(_0x2fef29));return _0x58c884(_0x4babba,_0xbc8ca0,_0x2c4f22,_0x2837b1);})['catch'](function(_0x5a92a6){fileLogger(_0x7c1f('0xb'))[_0x7c1f('0x13')](_0x5a92a6);});};}function setupLoggers(_0x32ec18){return new Promise(function(_0x1b4577){var _0x667bb0=new ClientSideLogger();var _0x2f4906=fileLogger(_0x7c1f('0x14'));var _0x21f154=fileLogger(_0x7c1f('0x15'));_0x32ec18[_0x7c1f('0x16')](_0x7c1f('0x17'),_0x667bb0);_0x32ec18['use'](ewinston[_0x7c1f('0x18')]({'winstonInstance':_0x2f4906,'meta':![],'statusLevels':!![],'msg':function(_0x31d33f,_0x22df72){var _0x5e536c=_0x7c1f('0x19');if(!_['isEmpty'](_0x31d33f['body'])){_0x5e536c+=_0x7c1f('0x1a');var _0x9a07c8=_0x31d33f[_0x7c1f('0x1b')];maskSensitiveData(_0x9a07c8);}return safeTemplate(util[_0x7c1f('0x1c')](_0x5e536c,_0x31d33f['method'],_0x31d33f[_0x7c1f('0x1d')]['x-forwarded-for']?_0x31d33f[_0x7c1f('0x1d')][_0x7c1f('0x1e')]:_0x31d33f[_0x7c1f('0x1f')][_0x7c1f('0x20')]||_0x31d33f['ip'],_0x31d33f[_0x7c1f('0x21')],_0x22df72[_0x7c1f('0x22')],_0x22df72[_0x7c1f('0x23')],_0x31d33f[_0x7c1f('0xf')]?_0x31d33f[_0x7c1f('0xf')]['id']:null,_0x31d33f[_0x7c1f('0xf')]?_0x31d33f['user'][_0x7c1f('0x24')]:null,_0x31d33f['user']?_0x31d33f['user'][_0x7c1f('0x25')]:null,_0x9a07c8?util['inspect'](_0x9a07c8,![],null):''));}}));_0x32ec18['use'](ewinston[_0x7c1f('0x18')]({'winstonInstance':_0x21f154,'meta':![],'statusLevels':!![],'msg':function(_0x49d6ee,_0x2fd6c4){var _0x23649d=_0x7c1f('0x26');if(_0x49d6ee[_0x7c1f('0x1b')]&&_0x49d6ee[_0x7c1f('0x1b')][_0x7c1f('0x27')]&&_0x49d6ee['body'][_0x7c1f('0x28')]){_0x23649d='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x7c1f('0x1c')](_0x23649d,_0x49d6ee[_0x7c1f('0x29')],_0x49d6ee['headers'][_0x7c1f('0x1e')]?_0x49d6ee['headers']['x-forwarded-for']:_0x49d6ee['connection'][_0x7c1f('0x20')]||_0x49d6ee['ip'],_0x49d6ee[_0x7c1f('0x21')],_0x2fd6c4['statusCode'],_0x2fd6c4['responseTime'],_0x49d6ee['user']?_0x49d6ee['user']['id']:null,_0x49d6ee[_0x7c1f('0xf')]?_0x49d6ee[_0x7c1f('0xf')][_0x7c1f('0x24')]:null,_0x49d6ee['user']?_0x49d6ee['user']['role']:null,_0x49d6ee[_0x7c1f('0x1b')]&&_0x49d6ee[_0x7c1f('0x1b')][_0x7c1f('0x27')]?_0x49d6ee[_0x7c1f('0x1b')][_0x7c1f('0x27')]:_0x7c1f('0x2a'),_0x49d6ee[_0x7c1f('0x1b')]&&_0x49d6ee['body'][_0x7c1f('0x28')]?_0x49d6ee[_0x7c1f('0x1b')][_0x7c1f('0x28')]:'',_0x49d6ee[_0x7c1f('0x1b')]&&_0x49d6ee['body'][_0x7c1f('0x2b')]?_0x49d6ee[_0x7c1f('0x1b')][_0x7c1f('0x2b')]:'');},'ignoreRoute':function(_0x5cce39){var _0xe9dd59=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xe9dd59[_0x7c1f('0x2c')](_0x5cce39[_0x7c1f('0x21')]);}}));return _0x1b4577();});}exports[_0x7c1f('0x2d')]=setupLoggers; \ No newline at end of file +var _0xb1a7=['fs-extra','lodash','express-winston','util','./loggers','fileLogger','safeTemplate','./mask-sensitive-data','maskSensitiveData','/var','log','xcally','join','client','role','name','then','catch','user','no-user','data','error','api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','method','headers','x-forwarded-for','connection','url','statusCode','responseTime','inspect','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','agent_name','test','setupLoggers'];(function(_0x4150e9,_0x447d20){var _0x30a374=function(_0x4d72b3){while(--_0x4d72b3){_0x4150e9['push'](_0x4150e9['shift']());}};_0x30a374(++_0x447d20);}(_0xb1a7,0x178));var _0x7b1a=function(_0x253ee6,_0x119127){_0x253ee6=_0x253ee6-0x0;var _0x3d480a=_0xb1a7[_0x253ee6];return _0x3d480a;};var fs=require(_0x7b1a('0x0'));var _=require(_0x7b1a('0x1'));var ewinston=require(_0x7b1a('0x2'));var path=require('path');var util=require(_0x7b1a('0x3'));var fileLogger=require(_0x7b1a('0x4'))[_0x7b1a('0x5')];var safeTemplate=require('./safe-template')[_0x7b1a('0x6')];var maskSensitiveData=require(_0x7b1a('0x7'))[_0x7b1a('0x8')];function ClientSideLogger(){function _0x3fd414(_0xd740aa){var _0x12aad2=path['join'](_0x7b1a('0x9'),_0x7b1a('0xa'),_0x7b1a('0xb'));var _0x38f998=path[_0x7b1a('0xc')](_0x7b1a('0xd'),_0xd740aa[_0x7b1a('0xe')]+'-'+_0xd740aa[_0x7b1a('0xf')]);return fs['ensureDir'](path[_0x7b1a('0xc')](_0x12aad2,_0x38f998))[_0x7b1a('0x10')](function(){var _0x117b91=fileLogger(_0x7b1a('0xd'),path[_0x7b1a('0xc')](_0x12aad2,_0x38f998));return _0x117b91;})[_0x7b1a('0x11')](function(_0x45ed24){throw _0x45ed24;});}this[_0x7b1a('0xa')]=function(_0x23eb62,_0x3a6885,_0x402e07,_0x4e7b46){return _0x3fd414(_0x23eb62[_0x7b1a('0x12')])['then'](function(_0x5960fd){var _0x5a32d8=_0x5960fd[_0x3a6885];return _0x5a32d8;})[_0x7b1a('0x10')](function(_0x592d36){var _0x4927f0=_0x23eb62[_0x7b1a('0x12')]?_0x23eb62[_0x7b1a('0x12')]['id']:_0x7b1a('0x13');var _0x30aa4b=_0x4e7b46[_0x7b1a('0x14')];var _0x5ab4cc=_0x4e7b46['timestamp'];var _0x5e851c=new Date(Number(_0x5ab4cc));return _0x592d36(_0x4927f0,_0x5e851c,_0x402e07,_0x30aa4b);})[_0x7b1a('0x11')](function(_0x59547d){fileLogger(_0x7b1a('0xd'))[_0x7b1a('0x15')](_0x59547d);});};}function setupLoggers(_0x1ad260){return new Promise(function(_0x3940f4){var _0x5e4994=new ClientSideLogger();var _0x24195e=fileLogger(_0x7b1a('0x16'));var _0x549b56=fileLogger(_0x7b1a('0x17'));_0x1ad260[_0x7b1a('0x18')](_0x7b1a('0x19'),_0x5e4994);_0x1ad260[_0x7b1a('0x1a')](ewinston[_0x7b1a('0x1b')]({'winstonInstance':_0x24195e,'meta':![],'statusLevels':!![],'msg':function(_0x35a21e,_0x1eecd6){var _0x5a5930=_0x7b1a('0x1c');if(!_[_0x7b1a('0x1d')](_0x35a21e[_0x7b1a('0x1e')])){_0x5a5930+=_0x7b1a('0x1f');var _0x333d8e=_0x35a21e[_0x7b1a('0x1e')];maskSensitiveData(_0x333d8e);}return safeTemplate(util['format'](_0x5a5930,_0x35a21e[_0x7b1a('0x20')],_0x35a21e[_0x7b1a('0x21')][_0x7b1a('0x22')]?_0x35a21e[_0x7b1a('0x21')]['x-forwarded-for']:_0x35a21e[_0x7b1a('0x23')]['remoteAddress']||_0x35a21e['ip'],_0x35a21e[_0x7b1a('0x24')],_0x1eecd6[_0x7b1a('0x25')],_0x1eecd6[_0x7b1a('0x26')],_0x35a21e[_0x7b1a('0x12')]?_0x35a21e[_0x7b1a('0x12')]['id']:null,_0x35a21e['user']?_0x35a21e[_0x7b1a('0x12')][_0x7b1a('0xf')]:null,_0x35a21e[_0x7b1a('0x12')]?_0x35a21e['user']['role']:null,_0x333d8e?util[_0x7b1a('0x27')](_0x333d8e,![],null):''));}}));_0x1ad260[_0x7b1a('0x1a')](ewinston[_0x7b1a('0x1b')]({'winstonInstance':_0x549b56,'meta':![],'statusLevels':!![],'msg':function(_0x5866a9,_0x5c1286){var _0x52392d='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x5866a9[_0x7b1a('0x1e')]&&_0x5866a9[_0x7b1a('0x1e')][_0x7b1a('0x28')]&&_0x5866a9[_0x7b1a('0x1e')][_0x7b1a('0x29')]){_0x52392d=_0x7b1a('0x2a');}return util[_0x7b1a('0x2b')](_0x52392d,_0x5866a9['method'],_0x5866a9[_0x7b1a('0x21')]['x-forwarded-for']?_0x5866a9[_0x7b1a('0x21')]['x-forwarded-for']:_0x5866a9[_0x7b1a('0x23')]['remoteAddress']||_0x5866a9['ip'],_0x5866a9[_0x7b1a('0x24')],_0x5c1286[_0x7b1a('0x25')],_0x5c1286['responseTime'],_0x5866a9[_0x7b1a('0x12')]?_0x5866a9[_0x7b1a('0x12')]['id']:null,_0x5866a9[_0x7b1a('0x12')]?_0x5866a9[_0x7b1a('0x12')][_0x7b1a('0xf')]:null,_0x5866a9[_0x7b1a('0x12')]?_0x5866a9[_0x7b1a('0x12')][_0x7b1a('0xe')]:null,_0x5866a9['body']&&_0x5866a9['body']['device']?_0x5866a9['body'][_0x7b1a('0x28')]:'other',_0x5866a9[_0x7b1a('0x1e')]&&_0x5866a9['body'][_0x7b1a('0x29')]?_0x5866a9[_0x7b1a('0x1e')][_0x7b1a('0x29')]:'',_0x5866a9[_0x7b1a('0x1e')]&&_0x5866a9['body'][_0x7b1a('0x2c')]?_0x5866a9[_0x7b1a('0x1e')]['agent_name']:'');},'ignoreRoute':function(_0x326eae){var _0x4ed1e3=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4ed1e3[_0x7b1a('0x2d')](_0x326eae[_0x7b1a('0x24')]);}}));return _0x3940f4();});}exports[_0x7b1a('0x2e')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 367eb40..0fff561 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x066c=['info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20magenta','bold\x20blue','addColors','/var/log/xcally','join','%s-%s.log','message','replace','{{{','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','}}}','meta','keys','length','stringify','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','fileLogger','util','moment','winston','../config/environment','debugLevel','toLowerCase'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x066c,0x162));var _0xc066=function(_0x44e984,_0x585bab){_0x44e984=_0x44e984-0x0;var _0x4d5255=_0x066c[_0x44e984];return _0x4d5255;};'use strict';var path=require('path');var util=require(_0xc066('0x0'));var moment=require(_0xc066('0x1'));var winston=require(_0xc066('0x2'));var config=require(_0xc066('0x3'));var debugLevel=config[_0xc066('0x4')]?config[_0xc066('0x4')][_0xc066('0x5')]():_0xc066('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xc066('0x7'),'error':_0xc066('0x8'),'warn':_0xc066('0x9'),'info':_0xc066('0xa'),'print':_0xc066('0xb'),'success':'bold\x20green','http':'gray','verbose':_0xc066('0xc'),'debug':_0xc066('0xd'),'silly':'bold\x20cyan'};winston[_0xc066('0xe')](XC_LOG_COLORS);function getLogFileName(_0x4bc3ee,_0x503ddb,_0x53c463){var _0x5b5671=_0x4bc3ee||_0xc066('0xf');return path[_0xc066('0x10')](_0x5b5671,util['format'](_0xc066('0x11'),_0x503ddb,_0x53c463));}function formatter(_0x1245f6,_0x18ba7c){_0x18ba7c[_0xc066('0x12')]=_0x18ba7c[_0xc066('0x12')][_0xc066('0x13')](/@@{/g,_0xc066('0x14'))[_0xc066('0x13')](/}@@/g,'}}}')[_0xc066('0x13')](/@{/g,'{{')[_0xc066('0x13')](/}@/g,'}}');return util[_0xc066('0x15')](_0xc066('0x16'),moment()[_0xc066('0x15')](_0xc066('0x17')),_0x18ba7c[_0xc066('0x18')][_0xc066('0x19')](),_0x1245f6,_0x18ba7c[_0xc066('0x12')]);}function fileFormat(_0x4a9771,_0x3a6038){_0x3a6038['message']=_0x3a6038['message'][_0xc066('0x13')](/@@{/g,'{{{')[_0xc066('0x13')](/}@@/g,_0xc066('0x1a'))[_0xc066('0x13')](/@{/g,'{{')[_0xc066('0x13')](/}@/g,'}}');var _0x2b1280=_0x3a6038[_0xc066('0x1b')]&&Object[_0xc066('0x1c')](_0x3a6038['meta'])[_0xc066('0x1d')]?'\x0a\x09'+JSON[_0xc066('0x1e')](_0x3a6038[_0xc066('0x1b')]):'';return util[_0xc066('0x15')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xc066('0x15')](_0xc066('0x17')),_0x3a6038[_0xc066('0x18')][_0xc066('0x19')](),_0x4a9771,_0x3a6038[_0xc066('0x12')],_0x2b1280);}function consoleLogger(){var _0x73ab36=new winston[(_0xc066('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xc066('0x20'))][(_0xc066('0x21'))]({'level':_0xc066('0x22'),'json':![],'formatter':function(_0x36a8b8){return formatter('',_0x36a8b8);}})]});return _0x73ab36;}function fileLogger(_0x351113,_0x103794){var _0x1db3f3=new winston[(_0xc066('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xc066('0x23'))]({'name':util[_0xc066('0x15')](_0xc066('0x24'),_0x351113,_0xc066('0x25')),'filename':getLogFileName(_0x103794,_0x351113,'error'),'level':_0xc066('0x25'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4f109e){return fileFormat(_0x351113,_0x4f109e);}}),new winston[(_0xc066('0x20'))][(_0xc066('0x23'))]({'name':util[_0xc066('0x15')]('%s-%s',_0x351113,debugLevel),'filename':getLogFileName(_0x103794,_0x351113,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x310020){return fileFormat(_0x351113,_0x310020);}}),new winston[(_0xc066('0x20'))]['Console']({'level':'warn','json':![],'formatter':function(_0x2cc362){return fileFormat(_0x351113,_0x2cc362);}})]});return _0x1db3f3;}exports[_0xc066('0x26')]=consoleLogger;exports[_0xc066('0x27')]=fileLogger; \ No newline at end of file +var _0x37a2=['File','%s-%s','error','consoleLogger','fileLogger','path','moment','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','bold\x20green','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','message','{{{','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','level','Logger','Console','warn','transports'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x37a2,0x1e1));var _0x237a=function(_0x3a9ba1,_0x4b90d8){_0x3a9ba1=_0x3a9ba1-0x0;var _0x2beb4f=_0x37a2[_0x3a9ba1];return _0x2beb4f;};'use strict';var path=require(_0x237a('0x0'));var util=require('util');var moment=require(_0x237a('0x1'));var winston=require('winston');var config=require(_0x237a('0x2'));var debugLevel=config[_0x237a('0x3')]?config[_0x237a('0x3')][_0x237a('0x4')]():_0x237a('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x237a('0x6'),'error':'red','warn':'bold\x20yellow','info':'white','print':'bold\x20white','success':_0x237a('0x7'),'http':'gray','verbose':_0x237a('0x8'),'debug':_0x237a('0x9'),'silly':_0x237a('0xa')};winston[_0x237a('0xb')](XC_LOG_COLORS);function getLogFileName(_0x3ff683,_0x1636fb,_0x3cf2d7){var _0x30030d=_0x3ff683||_0x237a('0xc');return path[_0x237a('0xd')](_0x30030d,util[_0x237a('0xe')]('%s-%s.log',_0x1636fb,_0x3cf2d7));}function formatter(_0x29f189,_0x3bb6ff){_0x3bb6ff[_0x237a('0xf')]=_0x3bb6ff['message']['replace'](/@@{/g,_0x237a('0x10'))[_0x237a('0x11')](/}@@/g,'}}}')[_0x237a('0x11')](/@{/g,'{{')[_0x237a('0x11')](/}@/g,'}}');return util['format'](_0x237a('0x12'),moment()[_0x237a('0xe')](_0x237a('0x13')),_0x3bb6ff['level']['toUpperCase'](),_0x29f189,_0x3bb6ff[_0x237a('0xf')]);}function fileFormat(_0x6dc3e9,_0xd196b9){_0xd196b9[_0x237a('0xf')]=_0xd196b9[_0x237a('0xf')][_0x237a('0x11')](/@@{/g,_0x237a('0x10'))[_0x237a('0x11')](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0x237a('0x11')](/}@/g,'}}');var _0x27b7f=_0xd196b9[_0x237a('0x14')]&&Object['keys'](_0xd196b9['meta'])[_0x237a('0x15')]?'\x0a\x09'+JSON[_0x237a('0x16')](_0xd196b9['meta']):'';return util['format'](_0x237a('0x17'),moment()[_0x237a('0xe')](_0x237a('0x13')),_0xd196b9[_0x237a('0x18')]['toUpperCase'](),_0x6dc3e9,_0xd196b9[_0x237a('0xf')],_0x27b7f);}function consoleLogger(){var _0x34f26d=new winston[(_0x237a('0x19'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x237a('0x1a'))]({'level':_0x237a('0x1b'),'json':![],'formatter':function(_0x454981){return formatter('',_0x454981);}})]});return _0x34f26d;}function fileLogger(_0x33f628,_0x1ff6d2){var _0x15c87b=new winston[(_0x237a('0x19'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x237a('0x1c'))][(_0x237a('0x1d'))]({'name':util[_0x237a('0xe')](_0x237a('0x1e'),_0x33f628,'error'),'filename':getLogFileName(_0x1ff6d2,_0x33f628,_0x237a('0x1f')),'level':_0x237a('0x1f'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x35be4e){return fileFormat(_0x33f628,_0x35be4e);}}),new winston[(_0x237a('0x1c'))][(_0x237a('0x1d'))]({'name':util[_0x237a('0xe')](_0x237a('0x1e'),_0x33f628,debugLevel),'filename':getLogFileName(_0x1ff6d2,_0x33f628,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x179cf1){return fileFormat(_0x33f628,_0x179cf1);}}),new winston['transports'][(_0x237a('0x1a'))]({'level':'warn','json':![],'formatter':function(_0x305c8a){return fileFormat(_0x33f628,_0x305c8a);}})]});return _0x15c87b;}exports[_0x237a('0x20')]=consoleLogger;exports[_0x237a('0x21')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 8fa5d85..4a2ca31 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda2d=['@@{','replace','}@@','includes','exports','maskSensitiveData','username','password','newPassword','apiKey','firstName','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','key','user','pass','accountSid','localstationid','dsn','secret','oldPassword','isPlainObject','isArray','isString'];(function(_0x5cee22,_0x22d3db){var _0x31a331=function(_0x4e4499){while(--_0x4e4499){_0x5cee22['push'](_0x5cee22['shift']());}};_0x31a331(++_0x22d3db);}(_0xda2d,0x102));var _0xdda2=function(_0x170cb7,_0xb1aeb0){_0x170cb7=_0x170cb7-0x0;var _0x2430fa=_0xda2d[_0x170cb7];return _0x2430fa;};var _=require('lodash');var sensitiveFields=[_0xdda2('0x0'),_0xdda2('0x1'),_0xdda2('0x2'),_0xdda2('0x3'),_0xdda2('0x4'),'lastName','street','phone',_0xdda2('0x5'),_0xdda2('0x6'),_0xdda2('0x7'),_0xdda2('0x8'),_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xb'),_0xdda2('0xc'),_0xdda2('0xd'),_0xdda2('0xe'),'channelSecret',_0xdda2('0xf'),_0xdda2('0x10'),'authToken',_0xdda2('0x11'),_0xdda2('0x12'),_0xdda2('0x13'),_0xdda2('0x14'),_0xdda2('0x15'),_0xdda2('0x16'),_0xdda2('0x17'),_0xdda2('0x18'),'privateKey','accesskeyid','secretaccesskey',_0xdda2('0x19'),_0xdda2('0x1a'),_0xdda2('0x1b'),_0xdda2('0x1c'),_0xdda2('0x1d'),_0xdda2('0x1e'),_0xdda2('0x1f'),'registry',_0xdda2('0x20')];function maskSensitiveData(_0x4b0220){const _0xbef148=/(?!^)[\s\S](?!$)/g;if(_[_0xdda2('0x21')](_0x4b0220)){for(const _0x3553d5 in _0x4b0220){if(_[_0xdda2('0x22')](_0x4b0220[_0x3553d5])){for(let _0x1922b1=0x0;_0x1922b1<_0x4b0220[_0x3553d5]['length'];_0x1922b1++){maskSensitiveData(_0x4b0220[_0x3553d5][_0x1922b1]);}}else if(_['isPlainObject'](_0x4b0220[_0x3553d5])){maskSensitiveData(_0x4b0220[_0x3553d5]);}else if(_[_0xdda2('0x23')](_0x4b0220[_0x3553d5])){_0x4b0220[_0x3553d5]=_0x4b0220[_0x3553d5]['replace'](/{{{/g,_0xdda2('0x24'))[_0xdda2('0x25')](/}}}/g,_0xdda2('0x26'))[_0xdda2('0x25')](/{{/g,'@{')[_0xdda2('0x25')](/}}/g,'}@');if(_[_0xdda2('0x27')](sensitiveFields,_0x3553d5)){_0x4b0220[_0x3553d5]=_0x4b0220[_0x3553d5][_0xdda2('0x25')](_0xbef148,'*');}}}}}module[_0xdda2('0x28')][_0xdda2('0x29')]=maskSensitiveData; \ No newline at end of file +var _0x66fa=['calleridnum','vidaooApiKey','privateKey','secretaccesskey','key','user','localstationid','oldPassword','isPlainObject','length','isString','replace','includes','exports','maskSensitiveData','lodash','username','newPassword','apiKey','firstName','lastName','street','phone','mobile','clientId','clientSecret','securityToken','code','accessKey','token','accessToken','authToken','calleridname'];(function(_0x595490,_0x511c88){var _0x24c5ff=function(_0x3dc435){while(--_0x3dc435){_0x595490['push'](_0x595490['shift']());}};_0x24c5ff(++_0x511c88);}(_0x66fa,0x117));var _0xa66f=function(_0x2a2412,_0x58a7c1){_0x2a2412=_0x2a2412-0x0;var _0x17f0d5=_0x66fa[_0x2a2412];return _0x17f0d5;};var _=require(_0xa66f('0x0'));var sensitiveFields=[_0xa66f('0x1'),'password',_0xa66f('0x2'),_0xa66f('0x3'),_0xa66f('0x4'),_0xa66f('0x5'),_0xa66f('0x6'),_0xa66f('0x7'),_0xa66f('0x8'),'fax','email',_0xa66f('0x9'),_0xa66f('0xa'),_0xa66f('0xb'),_0xa66f('0xc'),_0xa66f('0xd'),'tenantId',_0xa66f('0xe'),'channelSecret',_0xa66f('0xf'),'accessTokenSecret',_0xa66f('0x10'),'consumerKey','consumerSecret','membername',_0xa66f('0x11'),_0xa66f('0x12'),'exten',_0xa66f('0x13'),'clientEmail',_0xa66f('0x14'),'accesskeyid',_0xa66f('0x15'),_0xa66f('0x16'),_0xa66f('0x17'),'pass','accountSid',_0xa66f('0x18'),'dsn','secret','registry',_0xa66f('0x19')];function maskSensitiveData(_0x452c37){const _0x267129=/(?!^)[\s\S](?!$)/g;if(_[_0xa66f('0x1a')](_0x452c37)){for(const _0xd348f9 in _0x452c37){if(_['isArray'](_0x452c37[_0xd348f9])){for(let _0x5510dc=0x0;_0x5510dc<_0x452c37[_0xd348f9][_0xa66f('0x1b')];_0x5510dc++){maskSensitiveData(_0x452c37[_0xd348f9][_0x5510dc]);}}else if(_[_0xa66f('0x1a')](_0x452c37[_0xd348f9])){maskSensitiveData(_0x452c37[_0xd348f9]);}else if(_[_0xa66f('0x1c')](_0x452c37[_0xd348f9])){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](/{{{/g,'@@{')[_0xa66f('0x1d')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xa66f('0x1d')](/}}/g,'}@');if(_[_0xa66f('0x1e')](sensitiveFields,_0xd348f9)){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](_0x267129,'*');}}}}}module[_0xa66f('0x1f')][_0xa66f('0x20')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index b638e46..8f505cf 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7708=['lodash','\x20}\x20}','isArray','map','isPlainObject','reduce','exports','safeTemplate'];(function(_0x365ad7,_0x3d9036){var _0x5988f5=function(_0x27d95a){while(--_0x27d95a){_0x365ad7['push'](_0x365ad7['shift']());}};_0x5988f5(++_0x3d9036);}(_0x7708,0x188));var _0x8770=function(_0x26bbd1,_0xb274f3){_0x26bbd1=_0x26bbd1-0x0;var _0x26b1eb=_0x7708[_0x26bbd1];return _0x26b1eb;};var _=require(_0x8770('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x24909b){return _0x24909b==='{{'?'{\x20{\x20':_0x8770('0x1');}function safeTemplate(_0x5a8b5b){var _0x5ca46f=_0x5a8b5b;if(typeof _0x5a8b5b==='string'){_0x5ca46f=_0x5a8b5b['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x8770('0x2')](_0x5a8b5b)){_0x5ca46f=_0x5a8b5b[_0x8770('0x3')](function(_0x577b13){return safeTemplate(_0x577b13);});}else if(_[_0x8770('0x4')](_0x5a8b5b)){_0x5ca46f=Object['keys'](_0x5a8b5b)[_0x8770('0x5')](function(_0x42d305,_0x2b0295){_0x42d305[_0x2b0295]=safeTemplate(_0x5a8b5b[_0x2b0295]);return _0x42d305;},{});}return _0x5ca46f;}module[_0x8770('0x6')][_0x8770('0x7')]=safeTemplate; \ No newline at end of file +var _0x2032=['isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','\x20}\x20}','string'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x2032,0xd9));var _0x2203=function(_0x16d286,_0x3def34){_0x16d286=_0x16d286-0x0;var _0x410cb2=_0x2032[_0x16d286];return _0x410cb2;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2c2259){return _0x2c2259==='{{'?_0x2203('0x0'):_0x2203('0x1');}function safeTemplate(_0x4c28da){var _0x486390=_0x4c28da;if(typeof _0x4c28da===_0x2203('0x2')){_0x486390=_0x4c28da['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x2203('0x3')](_0x4c28da)){_0x486390=_0x4c28da[_0x2203('0x4')](function(_0x44ccfd){return safeTemplate(_0x44ccfd);});}else if(_[_0x2203('0x5')](_0x4c28da)){_0x486390=Object[_0x2203('0x6')](_0x4c28da)[_0x2203('0x7')](function(_0x2e0f63,_0x2676aa){_0x2e0f63[_0x2676aa]=safeTemplate(_0x4c28da[_0x2676aa]);return _0x2e0f63;},{});}return _0x486390;}module[_0x2203('0x8')][_0x2203('0x9')]=safeTemplate; \ No newline at end of file